diff --git a/IOBox/ANSDAQ_Device.jpg b/IOBox/ANSDAQ_Device.jpg new file mode 100644 index 0000000..5179ed5 Binary files /dev/null and b/IOBox/ANSDAQ_Device.jpg differ diff --git a/IOBox/Backup/iobox_api.zip b/IOBox/Backup/iobox_api.zip new file mode 100644 index 0000000..e0467a4 Binary files /dev/null and b/IOBox/Backup/iobox_api.zip differ diff --git a/IOBox/Backup/v1.0.0/flow_chart.jpg b/IOBox/Backup/v1.0.0/flow_chart.jpg new file mode 100644 index 0000000..2cc4c98 Binary files /dev/null and b/IOBox/Backup/v1.0.0/flow_chart.jpg differ diff --git a/IOBox/Backup/v1.0.0/iobox_api.cpp b/IOBox/Backup/v1.0.0/iobox_api.cpp new file mode 100644 index 0000000..6c51c06 --- /dev/null +++ b/IOBox/Backup/v1.0.0/iobox_api.cpp @@ -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& 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(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(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(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(hw_version) << std::endl; + std::cout << " FW Version: " << static_cast(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 iobox_api::scanNetworkDevicesMulticast(int timeout) { + std::vector 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 createModbusWriteSingleRegisterRequest(uint8_t slaveAddress, uint16_t address, uint16_t value) { + std::vector 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 createModbusReadHoldingRegistersRequest(uint8_t slaveAddress, uint16_t startAddress, uint16_t quantity) { + std::vector 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 parseModbusReadHoldingRegistersResponse(const std::vector& response) { + std::vector 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(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 request = createModbusReadHoldingRegistersRequest(profile->iobox_info.modbus_address, DEVICE_DATA_ADDRESS, DEVICE_DATA_LENGTH); + if (!sendTcpMessage(ip, reinterpret_cast(request.data()), request.size())) { + return false; + } + + char response[256]; + size_t responseLength = sizeof(response); + if (!receiveTcpMessage(ip, response, responseLength)) { + return false; + } + + std::vector responseVec(response, response + responseLength); + std::vector 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 request = createModbusWriteSingleRegisterRequest(profile->iobox_info.modbus_address, address, value); + if (!sendTcpMessage(ip, reinterpret_cast(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 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 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 iobox_api::getDeviceChannelNames(const std::string& ip, int timeout) { + // To do + // Get channel names from IOBox (if available) + std::vector channelNames = { "DO1", "DO2", "DO3", "DO4", "DI1", "DI2", "DI3", "DI4", "AI1", "AI2" }; + return channelNames; + } + +} \ No newline at end of file diff --git a/IOBox/Backup/v1.0.0/iobox_api.h b/IOBox/Backup/v1.0.0/iobox_api.h new file mode 100644 index 0000000..5e6d6f3 --- /dev/null +++ b/IOBox/Backup/v1.0.0/iobox_api.h @@ -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 +#include +#include +#include +#include +#include + +#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_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 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 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 + + diff --git a/IOBox/Backup/v1.0.0/main.cpp b/IOBox/Backup/v1.0.0/main.cpp new file mode 100644 index 0000000..f1dc9a7 --- /dev/null +++ b/IOBox/Backup/v1.0.0/main.cpp @@ -0,0 +1,91 @@ + +#include "iobox_api.h" +#include + +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 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; +} diff --git a/IOBox/Backup/v1.0.0/readme.md b/IOBox/Backup/v1.0.0/readme.md new file mode 100644 index 0000000..cb48c57 --- /dev/null +++ b/IOBox/Backup/v1.0.0/readme.md @@ -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 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. + + + + diff --git a/IOBox/Backup/v1.1.0/ANSDAQ_Device.jpg b/IOBox/Backup/v1.1.0/ANSDAQ_Device.jpg new file mode 100644 index 0000000..5179ed5 Binary files /dev/null and b/IOBox/Backup/v1.1.0/ANSDAQ_Device.jpg differ diff --git a/IOBox/Backup/v1.1.0/banve.pdf b/IOBox/Backup/v1.1.0/banve.pdf new file mode 100644 index 0000000..dbbc378 --- /dev/null +++ b/IOBox/Backup/v1.1.0/banve.pdf @@ -0,0 +1,2590 @@ +%PDF-1.6 %âãÏÓ +1 0 obj <>/OCGs[6 0 R]>>/Pages 3 0 R/Type/Catalog>> endobj 2 0 obj <>stream + + + + + application/pdf + + + banve + + + 2024-11-29T16:15:02+07:00 + 2024-11-29T16:15:02+07:00 + 2024-11-29T16:15:02+08:00 + Adobe Illustrator 27.5 (Windows) + + + + 156 + 256 + JPEG + /9j/4AAQSkZJRgABAgEASABIAAD/7QAsUGhvdG9zaG9wIDMuMAA4QklNA+0AAAAAABAASAAAAAEA AQBIAAAAAQAB/+4ADkFkb2JlAGTAAAAAAf/bAIQABgQEBAUEBgUFBgkGBQYJCwgGBggLDAoKCwoK DBAMDAwMDAwQDA4PEA8ODBMTFBQTExwbGxscHx8fHx8fHx8fHwEHBwcNDA0YEBAYGhURFRofHx8f Hx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8f/8AAEQgBAACcAwER AAIRAQMRAf/EAaIAAAAHAQEBAQEAAAAAAAAAAAQFAwIGAQAHCAkKCwEAAgIDAQEBAQEAAAAAAAAA AQACAwQFBgcICQoLEAACAQMDAgQCBgcDBAIGAnMBAgMRBAAFIRIxQVEGE2EicYEUMpGhBxWxQiPB UtHhMxZi8CRygvElQzRTkqKyY3PCNUQnk6OzNhdUZHTD0uIIJoMJChgZhJRFRqS0VtNVKBry4/PE 1OT0ZXWFlaW1xdXl9WZ2hpamtsbW5vY3R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo+Ck5SVlpeYmZ qbnJ2en5KjpKWmp6ipqqusra6voRAAICAQIDBQUEBQYECAMDbQEAAhEDBCESMUEFURNhIgZxgZEy obHwFMHR4SNCFVJicvEzJDRDghaSUyWiY7LCB3PSNeJEgxdUkwgJChgZJjZFGidkdFU38qOzwygp 0+PzhJSktMTU5PRldYWVpbXF1eX1RlZmdoaWprbG1ub2R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo +DlJWWl5iZmpucnZ6fkqOkpaanqKmqq6ytrq+v/aAAwDAQACEQMRAD8A9U4qldhYRTxSyyy3Bc3F wNridQAs7gAAOAAAKADMnJkIIAA5DoO4eThYcIkCSZfVL+KX84+aI/RNr/Pcf9JNx/1UyvxpeX+l j+pt/LR75f6aX63fom1/nuP+km4/6qY+NLy/0sf1L+Wj3y/00v1pfoeg6fBazekZ053Vyz0ubgVb 13Wp/edaKMv1GokZC6+mP8I7h5OLo9FjjE1xbyl/FL+cfNfrmj2b6LfqzTlTby1BuZyD8B6gvQ4N PnkMkeXMfwj9TLWaWBwzB4vpP8Uu73oqHRLCGFIYjcJFEoSNBc3FAqigH954ZVLUSJs1f9WP6m6G jhECI4qH9KX60Fqug6dPc6YJfXcJdc1rc3BoyQyspHx7EEZdh1EwJVX09w7x5OPqdFjlLHfEanf1 S/my80w/RNr/AD3H/STcf9VMo8aXl/pY/qcr8tHvl/ppfrWafH6N5eRK8jRqYyokkeSlV3oXLEYc puMT7+lIwx4ZSFmtuZJ+9j35r3slh5NuL2O7u7NoJIyJLKT0XJdvTAdgrtwq9Tx3ykOSxnzFPewa 75T9HVLqJNQ0u49bTfWpBILezY8vT9RPirKCTwfoOnXJaPnD/NR2kdsv+d+l6tkUuxV2KuxV2Kux V2KuxV2KoPSf95X/AOYi5/6iJMtzfV8I/wC5Dj6b6T/Wl/uijMqchI/MWqahBPb2ljHKRIrTX1zA iyywwKQvKOJvtuzNts2wPwsaDFUpXWltB9Y0W+l1mzgLz6qrCIwxRkmSZhKiRlZxUsIt/AqoIYSk SebGMREUPxe6I1bVJZ7+6hvpJbHy7D/o8l7CEKvLxBl+sSMGaGIBwoYKBUNycCgLEkGxzWcRIEHk V2na5PFeoRLNe6Fc81ttQnCBjKkbzfuuCoZYDHE1JGHWnEurVUMkEdThZYbjzQ1zZ3d0yvpcVtLK ISZAeEMDW/Bnn4tRlk3J5cPgrQgkMTEGr6Kw1rzRFC2lmD1NVldHtXdovUW0kWV+UvECL11+rsgo PT5MlTTlgZKYuxIWj8v3N3N5iQr9chu2bgh6gXyMOEStT4fRUFhulVw2eTERANpb+a0dtq35f22r TSta2aeldSxGBbksl1GYfTZGlgSn7/4q1+WBkkXmKHT7XzT5Vup7yJZ9Q0l4bezeNTKTb2knxLJu 4r6/y2w6LnD/ADWPafLL/nfpexZFk7FXYq7FXYq7FXYq7FWI+c9VuIbqG0SxvNSjHogabYssb3Mt wZeCyyu8SxwxpbOz8nAYlQf5WVSWHzdZJqlpDpWgalpF+sn+5W0ntXt7WO3AHNpGTlayMxosbRuW 5U348hhRVPSMCUj8w6VqNxNBd2Esi8FaG9tonEUk1uxDcYpT/dyArsajYt8SmjKqlKaQmox+jo9h LolpKzwanLygVJY0dopo/RjabnK3Er6p4kfa5MBxJVEa3pjWd1d6hdRS6loRDXc+mo0YCTRoOTtG 5jWaMiPlxL7PU8WqCiqrp2hXEmqrcNA+n6Pb8ng0mRo5A1xIjRtJxT1EiQJIw4K5DE8qKR8SqDh0 l9KYWeo2J143fKzsbqRomb0QjSLBLHLwWNQkXxNHy5kcmFcVVW8o6obF5Yr5oNXWVZLRg7SxwxIr oLYSSKXZSk8n7xl5BmrSihcVUhYPc/6BpultpWp2dOWqtLG5iM3xM6uGkkuS1ORWZQH/AGt8VSP8 7oNH0/8ALOOyuJJ4oIZbWCzMU8kTck+FQ5jILjgp2IIrQ9qgKl2v6VqEvmryrfW+lyyWkOjTLe6s jTGNKWknpxuoAjG7Heu9d+2S0fOH+ax7T5Zf879L17IsnYq7FXYq7FXYq7FXYql2oaddPcpf6fKs N8i+m4kUtFNFXlwkClWBU14MPs1OxBIKqEt49Q1nhJfCK3sre4atpCzStJLazFVZ5WWOiCSPlxCV NBVqVUxhKxfv+w02ZcfAa8gfmAf0p5kmt2KpdoH+8Mv/ADGXv/UZLirvMv8Ayjmq/wDMHcf8mmxV McVS7Vf97tG/5jH/AOoO4xVMcVS2w/47Oqf88P8Ak2cVTLFUmX/lDR/2zv8AmRh0XOH+avan+V/z /wBKc4FdirsVdirsVdirsVdirsVS/Q/94pP+Yu8/6ipcqw8vjL7y5Oq+sf1Yf7iKYZa4zsVS7QP9 4Zf+Yy9/6jJcVd5l/wCUc1X/AJg7j/k02KpjiqXar/vdo3/MY/8A1B3GKpjiqW2H/HZ1T/nh/wAm ziqZYqky/wDKGj/tnf8AMjDoucP81e1P8r/n/pTnArsVdirsVdirsVdirsVdiqBGjWILlTOnN2kZ UuJ0Xk7F2IVXAFWJO2VeFHz+Zcj8zPy/0senwb/RFp/vy5/6Srn/AKqYfCHn8z+tH5iXdH/Sx/U7 9EWn+/Ln/pKuf+qmPhDz+Z/Wv5iXdH/Sx/Ul+haVatZSEvcV+t3g2ubgdLuUdnHhj4Q8/mf1r+Yl 3R/0sf1JUmg6dZ+TdXW2E0aJ+kyqC4nK/DLMBVS9D03r1yrBhiB15nqe9y9drMk53LhJ4Yfwx/mj yTHzToGnXHlvU4p/Xkj+rSsUa5uCKohZagydmAwZ8UeA8+XeV0GrnHPAjhB4h/DH9S/UtJtEvNIR XuOJumXe5uDQC0nO1ZNunbLhiHn8z+txDqZH+b/pY/qU7jy9pjeZ7C4b1zMlndBZDc3HID1INgfU /wAo5ScMfEHPkep8nMhrMg08o+muOP8ADHul5KllpVqdX1JS9xRfQpS5uAd0PUh6n6cu8IefzP63 D/MS7o/6WP6kdoXL6gys7ycLm6RWkdpG4pcyKoLOWY0AoN8GH6fifvLLV/X/AJsfL+EIZf8AlDR/ 2zv+ZGXaLnD/ADXG7U/yv+f+lOcCuxV2KuxV2KuxV2KuxV2KuxV2KuxVLtA/3hl/5jL3/qMlxVL7 j/lD9Z+Wqf8AJ6fKsPL4y+8uTqvqH9WH+4imPmH/AI4Gp/8AMJP/AMm2xz/RL3FdH/fQ/rR+9rVf 97tG/wCYx/8AqDuMtcZuf/jv2X/MJdf8nLfKj9Y9x/3rkx/uZf1o/dNbYf8AHZ1T/nh/ybOWuMu0 P/eKT/mLvP8AqKlyrDy+MvvLk6r6x/Vh/uIoZf8AlDR/2zv+ZGXaLnD/ADXG7U/yv+f+lOcCuxV2 KuxV2KuxV2KuxVhvlnRbrU9Egv7vWtSa4nMrSFJwi19VhsqoFUbdAKeGKVvmHQbi0GmiDW9UX6zf wQS/6T1RiSR9n/JxVBTXFnHdtGNV1RoFIHP61JyPIclK0hMXxr8SKZQzLuBiqK8x6PfWUGnyadq9 7NLc3sEIW4upPRdHqfiMXB6Gn7JxVC2Vn5ggAt4buxuC95cRTGK+vyIpG9W5ZZOMmzKBQg7+OKoa Sy1iTS5rePUdPeyvIbyY34vr0wKpkAerCThsZ+/hvkIRofE/e2ZcnGb8gPkAP0Im/h1qS3uLe4vr CC2mt4+N3JfXwiYXfqIgUvLxavDbxxnHiiR3rhycE4y7iD8m3sfMFxNYtLd2NvKt1OlvDJe34eV4 RLAwQNLU9S3w70ybWpSDXOEOoNdWQuVsJLpLE3196zQuEkLAGXlQenSo2yBj6gfL9TYMlQMe8g/K /wBaobLX4Ly8aO8sZ7gyW0Vxbx3t+ZIjKyxpzAl5CvOvxfRk2t1tb65FEqwXthcRSXU8cssd9fFY 5KSXDhystAVAoa79zkIRofE/e2ZcnGb8gPkAFI2+rppcMJ1DT/0fLZyMNQF9e+gI4uERPL1PToTJ 8sng9HD/AEa+xr1f73j6cV/artNrqTXEcs1uggJ/e/WNVaNgIBcEq6uV+wSaVrtiq/8A52P/AD/T mKtSSa/HG0kjBI0BZ3Y62AABUkk9AMVUXj1ibU4oJr6a3jWsbPZzXwDOLy3t3Ba55RtxEjfZ74qj dbt7bTJVgOr6m87KJCrXMlAh5CtIoZ3P2DX4OI7kbVVQqWbXWraMlvrWqLFdfWUuo/rNRVIklSh4 jswYGlaHsajFWRf4T/7XOqf9JP8Azbihjn+5b6x+h/0xe/VvV9X1ecfr0/Sn1b0/W4c+HDfrXtXj 8OKU28nXF3JoNnZ2ZjjkjjeWaaVS6hXnlVFVFZKk8GqeW3vXZVU166knXS0lUJcW+sW0U6qary4l wVPgVcH26Yq1L5I5XvqR3pis+SOLcKaholVInDB/7yNUUI9NuIry3qrap5vFpbWujIzLb20eo2yg 8vTVUUN0NRSgGKsFsfIGi6daPZv5ktbpr5PqbXCRxRqkUdvOsRnj9V0dV5qnEcFILV+J2Yqr18ka dDarYxeabdL2eWa+l1ONEEf1gi3jLPC0zD1H4NIG5ji4UqAqKoVWz+QtCkhtNNg16whg0+Bk4vEk tpKl1czzywLEZ1dVWqptKW9MsjEhziq8+RdEvUsefmO3jgs4WsJ4Z1ikklSC6maGdJPVjKSUlLrU MvPhJx5IpxVbP5S0ueVtdfXrYN9Uilj00KgnjnjsUt2CzCUGsnpKrBoyePJFKh35Kqv+CtFtr+8v 5PMkNybuRoYjCUhuY4Lq8jlcNMJXD+mecnLgCXPJq8VCqqMXkTSbWxntG8x2MtxqcsHq3UMEKQp9 UiuGiMtu00sbx/vFhMfwr6YCddyqvuPJGkm0tNNh8yWsU4nuL+TUFRGQzOkED1Vp2cSSoHkMgl5+ pV1pSgVZH5Y0/wAradpU+kT39rJbw3Rkh4yrBH+8gTksSK/wwrzaNU5EBfhJNMVZR+n9C/6uVr/y Oj/5qxQtl1vy7LG8Ut/ZyRSAq6NLEVZSKEEE0IIxVJdQu9FN9p1tp01sUSnGG3aOgLX1oxoqHvuc Uo/XvLLaldx3lvdGzu40EYnVSWVQWPwEMpUnma+I223xQlyaPBpOueXbWHj1vGcqvBSRbqgotWp8 KgdST1JJxSm7anffVJNUURfo+JWk9Eq3qvClayB+QVSVHJUKexIr8KhjP/TRf5/9XzFKa+T7BZvL NhNHNJbXCiVfWi48inrOeLB1dSK9Kjbt1OKqnmK1itotGjSprqtuzu27MzcizMfE4qyPFCTebJ4r fSlnfT4NSlFzaw21vckJGJbqdLVXL+nMV4ic7hCabd8VSS9j1SzETS+VtFKyMy/BdSuRwieU/Cun Fj8MZ2UE1xVC6Rf3Grw2s9h5X0d7e9iee3llmubfkkZQcuE+mRvRvVBU8aEYqg/M/mOPyynqav5a 0eOI8FRoprics0iTyBeMWmuw+G1ckkUHjilObW11e5iaRPK2hgLJJEQbx+sUjRk/8c/xXFCQ3Pmu C2vrXT5fLOk/X7yy/SEMCy3DL6RillUPMNNMKuy28nFS9TxPtilPrq11e2iWR/K2hkNJHEALx+ss ixg/8c/xbFCUaPr41i5ubew8r6U72d62m3Jme6twtwkJmYD19Mj5AKOq17diDiqbra6u15Lajyto fOKOOVm+uPQiRnUAf7j/APis4q6C11eaW4jXytoYNtIInJvH3JjSSo/3H+EgxVW/Retf9SvoX/SZ J/3j8Vd+i9a/6lfQv+kyT/vH4q3pyPH5htdP1Dy/plo8tvPeW11aS+uytayQIRR7W241+s1DBu2K sqxVIdY/5Sry9/0ef8mRiqPbR4WaRfWlFpKzPLZVX0mZyWap4+pRmNSoeh8KEjFWJf8ATRf5/wDV 8xSn3kX/AJRWx/56/wDJ58UF3mz/AKU3/bUtv+NsVT7FUj85f8ci3/7aelf91K3xV5Z5K8z3uveR tclu7pLt7O81C3Fw7XcqELps5YH1zPyRGJUGMfEo3QNWqlJvKXHRfyHd9Pv/AKslpBqjLf2zvEyK uoQc2R42X4uNfsSUY7cxXZVBfmMP0n+VnlIape+tNMNMupLy8MrO8scF/KOTSLzDE7Hq3ZQ/dVmP mXWb+1/NPybp8GqS28F5dX3q6fHLcqkoW8m5NLHERHToFLqwJ2PDqVUl8z2FrJ+bnlO+eSNbmDyw 8UURH7xlkstRLGtK0HD5DepUlQ6hkq6/cz/nVr2iG9llgtLfT5vqJlmaCLlcWRRlj/ulkcvJz78e JXq+KpD+TS6fperebbozxvEmvT3F16EchKcLe95fAFqdl2UDlX9kbVUvQ9O/MTytcaPe+czPJDoA tIWM8kT+pxju7m3r6SBpN3XYUr4gb4oYB5z85y3vm7yLd+XtRuo7TXNUeSK2jmntY7pFh088LiNE bmoUsKPQUJxVINK/Ojzn5jby241JLW3vr66tbw2MaJGyJ6ADP6qzS0DzNEvpOtaqa8hilB/ld+au ueXtD0vSI0tb+XVb29JqkyFFt44eIhULHG3JPjdmKVJLfExNVXrPkTzbqHmrVdI1a+s4rCV7LVY0 t4JhcIEWfTyp9UBeRNf5Vp0p3xQ9FxVIdY/5Sry9/wBHn/JkYqn2KsD/AOmi/wA/+r5ilPvIv/KK 2P8Az1/5PPigu82f9Kb/ALalt/xtiqfYqkvm+FJtHiievFr/AE2vFmRttQgOzKQw+g4qvi8p6HDx 9GKaLg5lX07m4T4ypQt8Mg34sRircnlbRpAFkSZ0VGjCG5uSvBypZePqUoSgxVyeVtGQgoky0CKo Fzc0AiJaOg9Sg4liRirQ8p6GJEl9KYyxszxyG5uCys7F2KsZKirMTirZ8q6MbcW5W4MKxG3VfrV1 tEwAKA+pWhCjFWn8p6G8zTtHMZ3Kl5vrNwHPpsrLVhJU0KL92Kqh8t6UXV/9IDq5lDC6uQeZQoW2 k3PE0xVbJ5Y0iQyGRZ39ZQkoa6uWDKpZgCDJTq5OKqa+TvL6OjrBKGjbnGfrFx8DBVSqfvPh+FFG 3hiq+DytotuoWCOWJVJZQlxcKATSpFJPYYq1/hPQqxn0ZKwljEfrE/wFjVuPx7VO5piqGGnW1r5w 01ojKT+jr9R6k0soA9ez6CRmp07YqyDFUh1j/lKvL3/R5/yZGKp9irA/+mi/z/6vmKU+8i/8orY/ 89f+Tz4oLvNn/Sm/7alt/wAbYqn2KpR5p/45kP8AzH6b/wBR8GKpvirsVdirsVdirsVdirsVdirs VdiqUXX/AClum/8AMBf/APJ6zxVN8VSHWP8AlKvL3/R5/wAmRiqfYqwP/pov8/8Aq+YpT7yL/wAo rY/89f8Ak8+KC7zZ/wBKb/tqW3/G2Kp9iqUeaf8AjmQ/8x+m/wDUfBiqb4q7FXYq7FXYq7FXYq7F XYq7FXYqlF1/ylum/wDMBf8A/J6zxVN8VSHWP+Uq8vf9Hn/JkYqn2KsD/wCmi/z/AOr5ilPvIv8A yitj/wA9f+Tz4oLvNn/Sm/7alt/xtiqfYqlHmn/jmQ/8x+m/9R8GKpvirsVdirsVeda/+Z2o6f53 uNBgtY2soxZW8d1JHMa3s1zbevCZAVjJFnerIijcFSW2oMVSbRfze8x3vli71eWOwN5Fo2oanJp0 UcgksZrJkWBbvlMeSXSuZUH7v4R8JcVcKoab85/M66fa3EMOnSXspjVNJKS/WLpZEkkSaD05pgqT yRLaR7SL6zg83HFXKvVfLOoy6n5d03UZpYZpry2inkktlZIS0iBjwVyzgVP7Rr44FTLFXYq7FUou v+Ut03/mAv8A/k9Z4qm+KpDrH/KVeXv+jz/kyMVT7FWB/wDTRf5/9XzFKfeRf+UVsf8Anr/yefFB d5s/6U3/AG1Lb/jbFU+xVKPNP/HMh/5j9N/6j4MVTfFXYq7FXYq7FXYq7FXYq7FXYq7FUouv+Ut0 3/mAv/8Ak9Z4qm+KpDrH/KVeXv8Ao8/5MjFU+xVgf/TRf5/9XzFKfeRf+UVsf+ev/J58UF3mz/pT f9tS2/42xVPsVSjzT/xzIf8AmP03/qPgxVN8VdirsVdirsVdirsVdirsVdirsVSi6/5S3Tf+YC// AOT1niqb4qkOsf8AKVeXv+jz/kyMVT7FWB/9NF/n/wBXzFKfeRf+UVsf+ev/ACefFBd5s/6U3/bU tv8AjbFU+xVKPNP/ABzIf+Y/Tf8AqPgxVN8VdirsVdirsVdirsVdirsVdirsVSi6/wCUt03/AJgL /wD5PWeKpviqQ6x/ylXl7/o8/wCTIxVPsVYH/wBNF/n/ANXzFKfeRf8AlFbH/nr/AMnnxQXebP8A pTf9tS2/42xVPsVSLznz/QsQRzGzajpaiRaEry1G3FRyDCu/cYqwbyh+Zd1rmiahq11dXFrDo97d W14IhBKzw2trLcF1Q268WPp04hm+fgpZP5c14eYbOw1Ox1S8j068hu3PrLZcla0nSBvijjkjK8uW 6sQRQg4oTUQ3o1G4gk1a4WGKGCRWK2o+KV5VNSYf+KxTFWrFLqWEmfWJ0kM9xHGtLVSVinaJaAw7 7BfpxVQ/3Kf4Y/SX6UuPrP1L6z9i248/S59PR6VxVFajbahb26SR6rc8mngjNUtT8MsyRt/un+Vj irHPL/nSx8xI0+natexW9revaXrXKWa0VLaSfmGWN1A+EV5EMN+QGKq3mDzXZ6DZXeq3Ws3NxpkC Wwia2FixeWeeWEqHeNIhQx7lmAFDU4qmegT3GsWr30GrXZtJTFJaEx2yMYpraKZeSmCoP73FUz/R t5/1dbr/AIG1/wCqGKu/Rt5/1dbr/gbX/qhiqWGG4g866Ysl3Lcq+m6iaSiIUKz2PT00j/m74qyL FUh1j/lKvL3/AEef8mRiqfYqwP8A6aL/AD/6vmKU+8i/8orY/wDPX/k8+KC7zZ/0pv8AtqW3/G2K p9iqR+cv+ORb/wDbT0r/ALqVvirz/wAufl/r+k6DrumXFlYWl1reoXz2EUE9xNCVn06aOP1Wk+MD l1pv19sUpdeflb5k/wCVS6T5FSCxOpx290ssaqjQCI38U1V9ZXHq+mwJbrzqQ3cqEf8AmD5C80eY /LGk6NaRWh1bT4tMlvY2ESwAxW97DIIxw4KPUkFOKCg+yBiqI1zyLr2s+fvLev2kcDaZpF3cm7Zy glqL6Z/hqjN8IoRQ79NuuKVknlXzGPMaeY44rP8AQTeXhbzyGKD616i2rgESmMzDdgDRwCOvQDFU z0vyZrGj+bvMutXX1I6frN5p8ll9WQJPUXaep9YPAFj9mhDkddsUJF5Q/K/XdE8q6xoN+mnxXGu3 179Xa3DvERcadPEDMX+Nl5E0XqF29gpUZ/ys8wS/lVceSPSsH1dIIGkRSy2h56hdzsYuKwkfC9QC B4HxxQzKLTvNtl5LvNO0N7aLzHa/UYEdABbhora0Wf0xItAvpq/DkvhiqTajY/nypi+oahaPEQxm Eq2/qhvrM3AKwiVKfVvR5VX7fKm22KUFp9j/AM5I/WLBNS1HTRaerTUJLZYvW9MkklPUiKdCO3Y9 dsUMy0yPVo9c8tJrEom1YaLffpCRQoU3Bl08y8eCoOIeoXbpirK8VSHWP+Uq8vf9Hn/JkYqn2KsD /wCmi/z/AOr5ilG+ThLc6PZ2bzPBbrC8oEZ4NKxuJQ3xj4qRcVJ4n9octjQqquszTSJpqSuZhBrU ESXBABkCgkkhQFqrEoad1+jFWVYoY954vVt9MtoZLKLUIL67htJrSaJJw/q19OkckkMZPqhPtOAB U9cVY1LoNnFJCj+SrINO5ji/3GaaasEZ/wDlv/lQ4pc2g2a3KW58lWXqyI8iD9Gab9mMqG3+v+Lj FXLoNm1y9uPJVl6saJI4/Rmm/ZkLBd/r/ihxV1voNnPGXi8lWRUO8Z/3GaaPijco3/H/APzKcVUv 0Rp36O/SH+C7L6r6P1jl+jNNr6fHnWn1+v2cVVbjQbOCMPL5KsgpdIx/uM00/FI4Rf8Aj/8A5mGK ul0GzikhR/JVkGncxxf7jNNNWCM//Lf/ACocVcug2bXL248lWXqxokjj9Gab9mQsF3+v+KHFWotB s5ZJkTyVZFoHEcv+4zTBRiiv/wAt/wDK4xVV/wAMwf8AUk2X/cN0z/svxV3+GYP+pJsv+4bpn/Zf iqrpiro+s20dv5dtNKnulpJMlna27NB68EMirJbXVw1ec8Z4stDTrUDFWe4oSHWP+Uq8vf8AR5/y ZGKukmuTplxqwuZFuoPVItgR6StEzD6uyUoxJXizda/ZNDiqQ/8ATRf5/wDV8xSnHk+ys7vynYJd QR3CKZSqyorgH1XFQGBxVU80Rxxx6JHGoSNNTtVRFAAAAYAADoBihiV2Z/00PrAb9Kc4q8PT9XgV Uz8eXxet6nIQf5FKbccUp7+YLyR6Jo73k8drKup2BuLlTSONufxOC/7KnccvpxV59p+jPY2N1A/m nSEutQZVAhv2kgd4oLhS8pPpyxerGVikdWaRiWcuW4hVVQ6UItFj0uHzHo31ySW5unt3vVexpItu jwiiKqIZVa4SIQ+mGopVl5EpUbrtS0i1uLbT9Og8xaVcRWNusdxbXeov6ZjknmkjWK5HqOXt0AhV zGG4MSvptSgVfcaal7caVMvmzTHWxBilu570R3KXEN3Mxu4lXmreqsnNk5JzKoGZkqpKqP1KFtQO uSeZNM+qpYj0FS8C3XBrH0pLaSEDg681XgOYC/E3EyNyAVXttOFpd6rd3HmzTBJegWtvdW16Glfn eQyQ3U8R4KJoaSMW5ts3FeCIASqla6YlppNxanzDosF1f3MMiWsF+8lkGgin5h94ZES4i9OCSlWY DkzOzHFVo0eP9DTaTH5j0gTGa2uXtpL5WtfRZbiOaJH4cK+pIblF+r+kkhA9PiBii2beSda8u6Tp s9jd6/YSSxTCjfXFkUKYIuMaSSuZJFiH7tXf4mC1O+Ksh/xh5S/6vdh/0lQ/81Yq7/GHlL/q92H/ AElQ/wDNWKpJqutaPqPmPTF0++t7xo4XMgt5UlKg6hp9OXAmlaYpU/PXL9IQ/XQTpPpDlTjz9Xk/ 93yp34c6b8emKhbpRvjqfl363x+1d+jwIKcfq0fIIR+z6vPjT4afY+DjirMG07T3uRdNaxNdChE5 jUyAgUHxUrihhf8A00X+f/V8xSnNp5HtbOAW9rqupw26ljHEtyaKGYtxFVJoK9zXFC278i292IhN q+qH0JUniP1no8ZqDuv0Yqr/AOE/+1zqn/ST/wA24qhtQ8g2eoRJFd6pqU0aSLKEedXHJDUbMjDF NpfYfl1okv1jlPcj053QUaPoKf5GVYuvvb8/8P8AVCHb8v8ARv8ADRvPWufV+p+tTknHl6XL+StK 5drNjP8AznH7MN+F/m/oRGo/lzokVujrPckmeBN2j6PMiH9jwbKsvL4j7w36f6j/AFZf7kuuPy60 RL60iE9zxl9TkS0dfhWop8GCf1R+Kcf93L4Ok/LnRBqdvD69zxeCZyeUdao8QH7H+WcJ+se4/oRH +6l/Wj90nad+XOiS27s09yCJ7hNmj6JM6D9jwXJRcTEdvifvLen/AJc6JLAzNPcgiadNmj6JM6j9 jwGX5hv8I/cGGmPpP9aX+6KGX8v9G/w0Lz1rn1fqXrU5Jx5ely/krSuR031R94a8h/wc/wBT9CZf 8q00L/f91/wcf/VPIOZbDXt/L6NGjrMJJVhZY1kuZWBuU9SJCYdPlTmy9FDHGkWpp/hdwpDyhWXm HZrxU4c/T5ljpoULz+HkTSu2NLbK9N/L/SbqKO8S7vrO4ilkicQTpQmCejLy9JeS+pAGGwO3bFbT r/Cf/a51T/pJ/wCbcVUJfItvLd293Jq+qGa1DiE/WenqABj9ivQUxVX/AMJ/9rnVP+kn/m3FVH/A WlfV+H1u/wDrPq+r9e+sv6/996/D+Thz7cff7W+KskxV2KuxV2KoHSv+Pz/mJk/hlWLr7y5Go/h/ qhLnklk8u2un28ZkubuwHEDjQIBFHIfiZByCzVUVFadRmRqo8UpDvJcPQT4YY5DoIlX1S4vpo0tb e19S8iNtczx81CKObOAHbjX95BxJpsDyAP2cqlGw3wnwm/Ij5il80t1caxCLeHlDZSNFcSMQAC8S P41pxcUoDU7HiPixMbIPcsZ1EjvdHPdXOrwXEMFbKNbi3eVmUEOJeL/DUn7UC8fEMSacaM8O9qJ1 Ex7yD8r/AFojR/8AeST/AJibr/qJkxi4+Hl8T95b0n/eV/8AmIuf+oiTL831fCP+5DDTfSf60v8A dFBL/wAoaP8Atnf8yMGm+uPvDXk/xY/1P0JzlbmMA8v+WBqUS3gu3t3hbTpFRVVh6ltYxNGTy/4z NUYULtT8gQ2Oh3ci6hLItrYzRhGRByjSQ3agkD/fo6+GNqyzQP8AeGX/AJjL3/qMlwJTHFXYq7FX Yq7FXYq7FXYqgdK/4/P+YmT+GVYuvvLkaj+H+qEt/wBKt9HsdTtgrNaafxZGFfhf0WZgKpXikTGn IVPcZmZYk5SB1l+l1unmI4Ik8hAfcr6i2qWj/X4YonmuFtbaWEsSqtzkGzfBUGSZV5U2FW4mnE48 pU5kIGRoef2brmbULTWljjSOS21GZpZHJIZBHBGlPvjr3r7dcBkAQO9IgSCe51qdQtNSiseMb2s/ 1m5aTcMOUzOfu9WMUpvUmo4gMeLekCB4TLoP0/2IrR/95JP+Ym6/6iZMEWjDy+J+8t6T/vK//MRc /wDURJl+b6vhH/chhpvpP9aX+6KCX/lDR/2zv+ZGDTfXH3hryf4sf6n6ETrstxFp4NvM0EslxbRe qgRmVZbiON6B1dfsseoytzHnukzeaLby89oGY3P1lEnUm1jmC2skdu6LLHfW3+6ren2Vr498KEXB ca/IdSt5PUjsr22SCk8kE5BPqiQxiTVZuB4uu/fbbbFU6/L6XVzYhNSnklkmt4r/AIyCEFWvJ7ly f3KqvxKqmm9MSlluBXYq7FXYq7FXYq7FXYqgdK/4/P8AmKk/hlWLr7y5Go/h/qhC/wDTH/8Abv8A +ZGZ/wDl/wDP/S6j/kJ/yT/3qL1f/eSP/mJtf+omPMHLy+I+8O20/wBR/qy/3Jau/wDjp2H/AD2/ 4gME/rj8U4/7uXw+9uX/AI7Vr/zDXP8Aycgwn6x7j+hEf7qX9aP3Sdo/+8kn/MTdf9RMmSi4eHl8 T95b0n/eV/8AmIuf+oiTL831fCP+5DDTfSf60v8AdFBL/wAoaP8Atnf8yMGm+uPvDXk/xY/1P0K3 mJgmmCRto4rm0lkbsqR3Ubux9lUEnK3MRj6fYOxd7aJnY1Ziikk+5IxVb+jNN/5ZIf8AkWv9MVQl kyPr+pNFQxwQ2ts9Oiyp6spT6I54z9OKppirsVdirsVdirsVdirsVSDR7bXVm1NjfwPC97K0CPbE mNCFonJZU5U8SMxcQnctx9R6ftdjqZ4SIek3wC/Vz8/pKn6Wrf4Ur9Zg9L6h9n0H5cfR6cvW6+9M 2AE/H5j6+7z97pjLF+V2jL+7/nD+b/VRWq6Z5ivLZIoNSt7d1mhlLi1ZqiKRZCtGmPXjmFPHOQqx 8v2u20+fBCVmEjsR9XeK/mtXWneZJdSsbmO/tUgtvV9eM2z1fmvFaH1uxwSxzMgbG3l+1cebAMco mMrlVeodP81SntvMJ8x2cgv7YQi0uQYfqrbn1Id6+tX/AD+4GM+Mbjkenu82cJ4fAkOGV8Ud+Lyl /RVtJi1j6q/G6twPrFz1t3O/1iSv+7h3ycRPvHy/a4OKWKvplzP8Q7z/AEVmnS6lC1ssk0Lwz3l1 G6rEyNs071DGRx9pPDLcxmJxsjeun9H3lGmGOWORiJAgy5kH+Ov5o716/wDKGj/tnf8AMjLdN9cf eHByf4sf6n6E3liimieKVA8UilJEYVDKwoQQexGVuYlekvPZXTaNcsZVRDLp9wxLM9upClHJ/bhL qpP7SlT15UVV9Yv57WCOK0QSX92/o2iNXgGILNI9P2I1UsfHoNyMVVdM0+Kws1t0ZpGqXmmf7ckj nk8jU7sxr4DoNsVRWKuxV2KuxV2KuxV2KrJ43kjKJK8LH/diBSw/4NXX8MEhfWmUJAGyL/HlST6P a6gLi6Wa4kRYpwXVXhkEjMiSNX/R4ioo1NjhlpxCjGUje/Id/wCxENZLIZCWOEeH0ijI9AfLv81/ /TH/APbv/wCZGZX+X/z/ANLr/wDkJ/yT/wB6nGYrnuxVBS/8dq1/5hrn/k5BlZ+se4/ob4/3Uv60 fuk7R/8AeST/AJibr/qJkyUXDw8vifvKDh62H/bRu/1XOT1X1x+H+4bdD/d5P87/AKaOX/lDR/2z v+ZGT031x94cPJ/ix/qfoTnK3MSbX3vrJxrFtDFcR2NpdetDJK0RIb05KqVjlr/ckb0xVRsJdav9 WWS8tba1XTJJIpvRuJJyzywxuvHlBDtxkFa98VT/ABV2KuxV2KuxV2KuxV2KuxVB2P8AvVqP/MQv /UPFluT6Y+7/AHxcfD9U/wCt/vYoP/pj/wDt3/8AMjLf8v8A5/6Wj/kJ/wAk/wDepxmK57sVeU/m wt7b3mraraWtlezWWnaeiW97apcEtPd3KBkdxJ6fGhqPTblt0pXGk2yzyfYWthrGuW1pGkVvW1lW ONI4kBkiLGiRLGu2w+zWg3qcUMF/MQXVsdZ1e3hsLmWxtoFSG/t45QTPqd6nJJJA4j4gEkcG5bdK Vy3MPUPdH/cho0pIgf60v92WY2um2em3PmG2soo4IX0m2nKRRxxJzle+qeMSxr9lVWtKkKKk44P7 yPvCNV/cy/qn7mZ5U5CXeZf+Uc1X/mDuP+TTYq7Sv97tZ/5jE/6g7fFUxxV2KuxV2KuxV2KuxV2K uxVB2P8AvVqP/MQv/UPFluT6Y+7/AHxcfD9U/wCt/vYoP/pj/wDt3/8AMjLf8v8A5/6Wj/kJ/wAk /wDepxmK57sVeW/m+JW07zHHFZrfGSy0ZTA8QnFDfXXx+kQeYQ7t0otTXbFWYeXiD5h1sjpwsaUH Ef3B7dsVYH+ZIlbRPM8cVmt8ZItPUwPEJxQ6tffH6RB5hDu3Si1NdstzfV8I/wC5DRpvpP8AWl/u izSUg6jrpHT9B2VKDiPtX3btjg/vI+8Lqv7qf9U/cyrKm9LvMv8Ayjmq/wDMHcf8mmxV2lf73az/ AMxif9QdviqY4q7FXYq7FXYq7FXYq7FXYqg7H/erUf8AmIX/AKh4styfTH3f74uPh+qf9b/exQf/ AEx//bv/AOZGW/5f/P8A0tH/ACE/5J/71OMxXPdiqSX+halLq8upWGqGxae3htpovQjmBEDyurAs QQf35xVV0TRLmwub27u71r66vmjMkhjWIARLxUBVxVAW2kaz9fudS02+trf6xztpYrm1e4/3nu7l 1ZWS4t6V+sEEEHplub6vhH/cho030n+tL/dFUl0rUILfWdQ1C7hubm5sVtwLeBreNY7cTOvwvLOS xM7VPLw2xwf3kfeF1f8AdT/qn7mQ5U3rJ4Ip4JIJlDwyqUkQ9CrChB+YxVTs7G2s0dIA37xucjSO 8rs1AtWeQsx+FQNz0xVXxV2KuxV2KuxV2KuxV2KuxVLIr2K2u9QEsc/xTK6skEzqV9CIVDIjA7gj bMg4zKMarl3jvPm4UcwhOdiX1fzZH+GPcEnHmPSj5I+sBpjB9R9P1Pq8/HkE9OnLhT7e1emZf5Wf 5itr4u8d997gfyhi/JcW/DwVfDLuru70/Gr2hAIS4odx/o1x/wBU8wfBl5f6aP63aDUx7pf6WX6n fpa1/kuP+ka4/wCqePgy8v8ATR/Wv5mPdL/Sy/U79LWv8lx/0jXH/VPHwZeX+mj+tfzMe6X+ll+p 36Wtf5Lj/pGuP+qePgy8v9NH9a/mY90v9LL9SX6Hr2nzW04i9dzFdXKSUtrg8W9ZmoaJ1owy/Uaa YIut4x6ju97i6PW45RNcW05D6Zfzj5K+qahDNpl3FHFcNJJDIiL9WuN2ZCAPsZDDiImCSOY/iH62 zUZxLHIASsxP8Mu73JrmM5zsVdirsVdirsVdirsVf//Z + + + + uuid:b669ec92-ee21-4cae-a6c0-341b4db91c0d + xmp.did:fb14a6d0-01ba-364b-a85d-47a68f01d1d2 + uuid:5D20892493BFDB11914A8590D31508C8 + proof:pdf + + uuid:45cefb37-329e-4b33-b86c-322853ca0ab6 + xmp.did:eedf3116-2fd9-a546-98d1-3c864bf140f0 + uuid:5D20892493BFDB11914A8590D31508C8 + default + + + + + saved + xmp.iid:eedf3116-2fd9-a546-98d1-3c864bf140f0 + 2024-11-29T15:35:04+07:00 + Adobe Illustrator 27.5 (Windows) + / + + + saved + xmp.iid:fb14a6d0-01ba-364b-a85d-47a68f01d1d2 + 2024-11-29T16:14:59+07:00 + Adobe Illustrator 27.5 (Windows) + / + + + + Print + Adobe Illustrator + False + False + 1 + + 297.000024 + 209.999994 + Millimeters + + + + + MyriadPro-Regular + Myriad Pro + Regular + Open Type + Version 2.106;PS 2.000;hotconv 1.0.70;makeotf.lib2.5.58329 + False + MyriadPro-Regular.otf + + + + + + Cyan + Magenta + Yellow + Black + + + + + + Default Swatch Group + 0 + + + + White + CMYK + PROCESS + 0.000000 + 0.000000 + 0.000000 + 0.000000 + + + Black + CMYK + PROCESS + 0.000000 + 0.000000 + 0.000000 + 100.000000 + + + CMYK Red + CMYK + PROCESS + 0.000000 + 100.000000 + 100.000000 + 0.000000 + + + CMYK Yellow + CMYK + PROCESS + 0.000000 + 0.000000 + 100.000000 + 0.000000 + + + CMYK Green + CMYK + PROCESS + 100.000000 + 0.000000 + 100.000000 + 0.000000 + + + CMYK Cyan + CMYK + PROCESS + 100.000000 + 0.000000 + 0.000000 + 0.000000 + + + CMYK Blue + CMYK + PROCESS + 100.000000 + 100.000000 + 0.000000 + 0.000000 + + + CMYK Magenta + CMYK + PROCESS + 0.000000 + 100.000000 + 0.000000 + 0.000000 + + + C=15 M=100 Y=90 K=10 + CMYK + PROCESS + 15.000000 + 100.000000 + 90.000000 + 10.000000 + + + C=0 M=90 Y=85 K=0 + CMYK + PROCESS + 0.000000 + 90.000000 + 85.000000 + 0.000000 + + + C=0 M=80 Y=95 K=0 + CMYK + PROCESS + 0.000000 + 80.000000 + 95.000000 + 0.000000 + + + C=0 M=50 Y=100 K=0 + CMYK + PROCESS + 0.000000 + 50.000000 + 100.000000 + 0.000000 + + + C=0 M=35 Y=85 K=0 + CMYK + PROCESS + 0.000000 + 35.000000 + 85.000000 + 0.000000 + + + C=5 M=0 Y=90 K=0 + CMYK + PROCESS + 5.000000 + 0.000000 + 90.000000 + 0.000000 + + + C=20 M=0 Y=100 K=0 + CMYK + PROCESS + 20.000000 + 0.000000 + 100.000000 + 0.000000 + + + C=50 M=0 Y=100 K=0 + CMYK + PROCESS + 50.000000 + 0.000000 + 100.000000 + 0.000000 + + + C=75 M=0 Y=100 K=0 + CMYK + PROCESS + 75.000000 + 0.000000 + 100.000000 + 0.000000 + + + C=85 M=10 Y=100 K=10 + CMYK + PROCESS + 85.000000 + 10.000000 + 100.000000 + 10.000000 + + + C=90 M=30 Y=95 K=30 + CMYK + PROCESS + 90.000000 + 30.000000 + 95.000000 + 30.000000 + + + C=75 M=0 Y=75 K=0 + CMYK + PROCESS + 75.000000 + 0.000000 + 75.000000 + 0.000000 + + + C=80 M=10 Y=45 K=0 + CMYK + PROCESS + 80.000000 + 10.000000 + 45.000000 + 0.000000 + + + C=70 M=15 Y=0 K=0 + CMYK + PROCESS + 70.000000 + 15.000000 + 0.000000 + 0.000000 + + + C=85 M=50 Y=0 K=0 + CMYK + PROCESS + 85.000000 + 50.000000 + 0.000000 + 0.000000 + + + C=100 M=95 Y=5 K=0 + CMYK + PROCESS + 100.000000 + 95.000000 + 5.000000 + 0.000000 + + + C=100 M=100 Y=25 K=25 + CMYK + PROCESS + 100.000000 + 100.000000 + 25.000000 + 25.000000 + + + C=75 M=100 Y=0 K=0 + CMYK + PROCESS + 75.000000 + 100.000000 + 0.000000 + 0.000000 + + + C=50 M=100 Y=0 K=0 + CMYK + PROCESS + 50.000000 + 100.000000 + 0.000000 + 0.000000 + + + C=35 M=100 Y=35 K=10 + CMYK + PROCESS + 35.000000 + 100.000000 + 35.000000 + 10.000000 + + + C=10 M=100 Y=50 K=0 + CMYK + PROCESS + 10.000000 + 100.000000 + 50.000000 + 0.000000 + + + C=0 M=95 Y=20 K=0 + CMYK + PROCESS + 0.000000 + 95.000000 + 20.000000 + 0.000000 + + + C=25 M=25 Y=40 K=0 + CMYK + PROCESS + 25.000000 + 25.000000 + 40.000000 + 0.000000 + + + C=40 M=45 Y=50 K=5 + CMYK + PROCESS + 40.000000 + 45.000000 + 50.000000 + 5.000000 + + + C=50 M=50 Y=60 K=25 + CMYK + PROCESS + 50.000000 + 50.000000 + 60.000000 + 25.000000 + + + C=55 M=60 Y=65 K=40 + CMYK + PROCESS + 55.000000 + 60.000000 + 65.000000 + 40.000000 + + + C=25 M=40 Y=65 K=0 + CMYK + PROCESS + 25.000000 + 40.000000 + 65.000000 + 0.000000 + + + C=30 M=50 Y=75 K=10 + CMYK + PROCESS + 30.000000 + 50.000000 + 75.000000 + 10.000000 + + + C=35 M=60 Y=80 K=25 + CMYK + PROCESS + 35.000000 + 60.000000 + 80.000000 + 25.000000 + + + C=40 M=65 Y=90 K=35 + CMYK + PROCESS + 40.000000 + 65.000000 + 90.000000 + 35.000000 + + + C=40 M=70 Y=100 K=50 + CMYK + PROCESS + 40.000000 + 70.000000 + 100.000000 + 50.000000 + + + C=50 M=70 Y=80 K=70 + CMYK + PROCESS + 50.000000 + 70.000000 + 80.000000 + 70.000000 + + + AutoCAD Color 3 + PROCESS + 100.000000 + CMYK + 74.972147 + 67.919427 + 67.049664 + 90.145719 + + + AutoCAD Color 5 + PROCESS + 100.000000 + CMYK + 0.000000 + 99.334705 + 100.000000 + 0.000000 + + + AutoCAD Color 2 + PROCESS + 100.000000 + CMYK + 73.534751 + 0.000000 + 100.000000 + 0.000000 + + + AutoCAD Color + PROCESS + 100.000000 + CMYK + 62.658119 + 0.000000 + 100.000000 + 0.000000 + + + + + + Grays + 1 + + + + C=0 M=0 Y=0 K=100 + CMYK + PROCESS + 0.000000 + 0.000000 + 0.000000 + 100.000000 + + + C=0 M=0 Y=0 K=90 + CMYK + PROCESS + 0.000000 + 0.000000 + 0.000000 + 89.999400 + + + C=0 M=0 Y=0 K=80 + CMYK + PROCESS + 0.000000 + 0.000000 + 0.000000 + 79.998800 + + + C=0 M=0 Y=0 K=70 + CMYK + PROCESS + 0.000000 + 0.000000 + 0.000000 + 69.999700 + + + C=0 M=0 Y=0 K=60 + CMYK + PROCESS + 0.000000 + 0.000000 + 0.000000 + 59.999100 + + + C=0 M=0 Y=0 K=50 + CMYK + PROCESS + 0.000000 + 0.000000 + 0.000000 + 50.000000 + + + C=0 M=0 Y=0 K=40 + CMYK + PROCESS + 0.000000 + 0.000000 + 0.000000 + 39.999400 + + + C=0 M=0 Y=0 K=30 + CMYK + PROCESS + 0.000000 + 0.000000 + 0.000000 + 29.998800 + + + C=0 M=0 Y=0 K=20 + CMYK + PROCESS + 0.000000 + 0.000000 + 0.000000 + 19.999700 + + + C=0 M=0 Y=0 K=10 + CMYK + PROCESS + 0.000000 + 0.000000 + 0.000000 + 9.999100 + + + C=0 M=0 Y=0 K=5 + CMYK + PROCESS + 0.000000 + 0.000000 + 0.000000 + 4.998800 + + + + + + Brights + 1 + + + + C=0 M=100 Y=100 K=0 + CMYK + PROCESS + 0.000000 + 100.000000 + 100.000000 + 0.000000 + + + C=0 M=75 Y=100 K=0 + CMYK + PROCESS + 0.000000 + 75.000000 + 100.000000 + 0.000000 + + + C=0 M=10 Y=95 K=0 + CMYK + PROCESS + 0.000000 + 10.000000 + 95.000000 + 0.000000 + + + C=85 M=10 Y=100 K=0 + CMYK + PROCESS + 85.000000 + 10.000000 + 100.000000 + 0.000000 + + + C=100 M=90 Y=0 K=0 + CMYK + PROCESS + 100.000000 + 90.000000 + 0.000000 + 0.000000 + + + C=60 M=90 Y=0 K=0 + CMYK + PROCESS + 60.000000 + 90.000000 + 0.003100 + 0.003100 + + + + + + + Adobe PDF library 17.00 + + + + + + + + + + + + + + + + + + + + + + + + + +endstream endobj 3 0 obj <> endobj 8 0 obj <>/Font<>/ProcSet[/PDF/Text]/Properties<>>>/Thumb 11 0 R/TrimBox[0.0 0.0 841.89 595.276]/Type/Page/PieceInfo<>>> endobj 9 0 obj <>stream +H‰ìWË®ä¶Ý߯Ð:9|?¶™bAàE>`ÄpÆ’,üû©âa‘TKêÛíñÂhîѹR‘U§ÞŸþòyûôçÏfûý>ooFç¸rm¿–~«±ÛwüÂÔíçÍn?ÒÿÚÞ>ýñ{³ýóoÿ!hè?»¹\u1&mÁ’ Û—ŸÞøÿ*ç’v%m_ß¾ûë*UœöÙmÁYí¼+{!oupõ äMÔцúÜUÞmJòÏÝ% +ÚÂæ7…\5:2GG¡ÂVŽy +ÅØt;ÊD›uŠ9ŸÉd]¿#Sê”P¶˜ûß]éþž„÷œµ2›‹:÷—2ždö·Ü‘ÉÚ˾Dl‰;רd´;1Ïܽ¦ÉøÊ´¿ç=goeÞáÌQtšº~µ þTæ;Ò!Ü^¡óiE>=øx™º#åˆKWí‰sÔµ~#pÎS眸!t$®å[»ëÒª#ôú4¢­Ú!ÛŒ6û[èûp¬ƒ„óúqaŽݺ•EÊiÅ Ãí2ß„h›nbçnB³!ö‘„Žù²tªËÚ4"ú¡2ø:ÍÏ‹jÃeå$¡‹Â3‡²'Ñ©®‹ôzJ?¡ïýè/‘üîrÚJ°\Ÿ•àÿþýíoÛ¿ë\I—Íj-…Z3¿|¹j¿Æa× 'T»3/U»ìÁ¿ä¸;>ì§Ag­ÖNºn¿Ïsv'ôŸUë:]é5Ÿ¥ÖCÔݳÂíɳî4ҽǞ(‰Éç1¹cZí{¢é«‡äŽžLݳÏs›lýÒ¸ƒS=MïqSÔiSÚ²6| þÁïJ:šðéÚþÒ†Ö”»\G¦}‡g%¯ ¦v‡ªq*nìØˆ”iGýp[`j•qé8&x#›^rÙR«È +ÿà—®ª¤ˆ@e]›”!ÕÔdzÂȨÝjœˆÛ:6]æ\wïˆtNÏ3ö©Ž0cVSöÒBø¿tQÒ‘ºEWt ÐešæxTýDÔî<5ä«:2"r¥¸å“ü©â–fÇØŠž¯Ä¥£· +ÿà—n¢õa¼Q]HXkæÁ'xÑ$Ôî45ŽÃU‘¹R½G| ^r[©?VÄŸm!%âÏØÿ¦øo;âcÚ\U™ñ1}Üiv·W¥ò·ñ1çx†ùp5~Dü‡­ñ#â?`ÿÑjüˆøRãÎÑ)·ßTè·Ô²}GobÊÛÏÛÍŽPK |¦ (:ã—­2W2GÅ×~n´v/Í‹PôW_"q™w©WÛEHteuB¬ë¢e2P‚*£ËóÚ3¥KNô«NÎ,×ZO—Úô˜Ò)jÓ²ѽ†BŸÔªáþõÕ›°¹È1Mù±³:ÒÒNwÆÀQÆB.¹t¸•sªGºl"6ÒS—‘yäUÊŧ„Rц~ºt+ò3BfºØ|iŽrw8¼uá"T¨EëÎÌâÒþ€iåÞ×]Èyr6«Nb5·.×ÍËaiwÔMrv”[¦”£¦‰êxµùœDhˆ˜5wŸ;³ÊzRà_ê¨Cøä¤ñÔ‚H€%MŠå\ò$|¦æÅ$Àük%©pÜS€& +H¿£‰ñµ=YW婿þä"×k$žÑTâ/)}JXPŠˆdI)ër¬ª.§xÇJVS¨•`ÞDÎãK¾i¢è„¬nˆ&rÁ-ˆ%DUç€ú™Á»ñ@4Qjó*t!DDL”cJ[òPQÔ/Æ:*ÕnÐB¨„A £9–©Î”A{`ô2?éNS—Óyd=(ÕM_Gf?¹¤MfáËQ¨2'ÌÌ×7þ;Ëûòìšõ±…š'ç†EçVTü‚R´ j®ÆLˆ<×f®͘-NâæfRhsƒŽÃ=¡](´„îV¸‡ÐäO@£64‹«e€ââp¡V8‘>9¼ã +CÉPò‚„‘ÛÿHNAH_ Þ ˆ”žpUHÎrvÊ¥ + ¹@äþ€ˆ;X¦¦Õr + +‰ØéR{^Õ$½CNLñÁ +ˆç²m€]½@öªšÀ" +‘š¯`‡*¤°D”B·X³íÔÔC .cVuï"f'jŸÔÎa×W áqä .È µMAŠŒºC=N˜Ä#'1§G(n4ˆûDp ˆH4ó©Δ„@…6ó:Ö\BFÞ"è >&*­pÁÂÆÜ̱d¼1½ —äZR +B«hij~Ü…ê&JQåËv¨:8QnÁlA ÕT8ÈÕQw…X Áÿ€ë·j9®Ä¹jª °†Â0´ñvB—Vˆ“ѱƽBI@ƒ§Æ7´µ½ŠA.-¨±/—Ç6n 48F^OäþQ+&BH„ìˆ ’œo$$ñø7aˆaPBHöù©yÌ ÕÕ"Òa?ßî$Zµò$ή„ÎR*ŒÔ‘X‡­£ªX©"&P‘@è[míµ üŽÙEÈK=íJ,Ð&)½0MžY‘Q¯aѨæØÉY¸@fcôp¥ædÈDŽæ–Õœ7Ù#jަæ9îì#îBüâ’é:Ù6Åë#(~xûÇïöKLegUOz%#â~‰‘ÑCõÞ‹ª31òŠðð”S2>ÀŠå룲$dß.|- ¯%áµ$¼–„o[ì°ìµ$|ë’`G /Ô¾–„×’ðZ^K¸ù—;ˆXákIXá;KFå_}IH¤‡-•–„Èã_9]È0ëPpf$d/äSG=ïB?™!%¢£º™ó‘4Â’æ•5iöHhÏ­XÔÆ[A(ò% ÒD¬îDØ$ö[† ý$ºô]E_mÀÆ#ÖÅõ•„€pg¶ #o‡Ì6ÝâÊîíeV|ŠuENí3î¨îú\ï–Õµé­Fú±º­ïroÔ莠ÑwöÎðû§¾g ‡ +*m£B^Ê.!(·½L6ÛךØö9y‡Ýe ¶ù òm=Ôv#¹+Ô ²è—v‰8Z½¦ÅäÞè±¢(A²ˆÅõÕÚpo‘äÐÚ‹÷­xæ2ôÔŽ|j‘Õ +šëÿ4!Î0ö²”‹v ‹ +Û‹סP¬`¾”ÞQ˜¦*)Û¶ÏÐbeëjp‘_ ÷l4‹Þ¥©(Ó÷Ê$eÖò¢†½WßÌk‰hæS fŒ1R!&bV'bR1úHEšˆ<¿ŒuÙ®‹¬\^¹{Ú´xOÝÓ¶¾6_!Dƒ#Ð*ä‚FaÞ.K.žá œ³|Õ€çM©"Z·ê[›ãJŸ69öñ7I­‰8íð…dkË0Iëxb€KÃ\5& c;EY’KPÎ&BÕ¾iøê‡âžâ/,(63J/³¼ê‰ÁXCæR˜g,úî×¹ÖŸ‚À5 ñƒ Ô»Ð.2N²S +Ò@¶/cmÖEA´.ŠRuÉ"„ZÒWJbLòŸKÇ-ž•çv¤©Ôv É#MdF—‘fLÇs–ÞõI™yMkò½é® H:·ô”ô€d +Dù#bCë8¹Ÿ5—A´Õ¨9£ÎQ•o éuÉæÔçyxS²Ã¶^VdË3È ÐD¬‚§lF0•¯µ+Zž± ÙŒdp÷3<ì.<0j,‹D›êö(Ä^œL]œ$ËÊ~1jh<©ýþ¤öËÕÉŽSvËõ·+ù?ûå’,»ѹWq7@‡ø‘DîÈ{ÿÓ&HR•#"a—‹JÜ 4Ï+PÕ èʨº™ðX;.Dl¸Q¬mBÕk¾×¤=P§Ïlã„÷­Œ+‚c“I÷W[N˜ÛÄû@9šKæë°Œ8ÕÆâ©FE–´Ê´uòeÑ Ô½ÜÐ^˜h“æËUŒž*aۈǕEuµw¤94„øÑm´ò£¹‰dJB¡¿¸Øùkk;výÞI™[¶’‹õ÷/=)9}búØm•ÝÆR¾oÞ?Õ¹ièC‹ß¿øø~Î= êsn鸎÷99ô˜O¤\‘º-: a  +IâSêcÖÔ˜mû9Çf“ÓÌŸ~ÝûÞ»¨_ó“Žù¯þdÚG,®ñ+ØQÅþq°ÏÌM¿¹Û… +”Û-Zq÷}}ŸÉ÷”rÙw¹÷}}ÿ÷LFî|&þ]3¹þü;”ÿÊ_†rõ!òïTþÛ§r÷tþ£¦rÿ_žÊýç6•ëÏs,ßûãh{,ïõr÷c”±Ë¶pöl|Gi +"µ€„Ó’p§5á–xÃi¯s*¢ê&Ñý é­ã`4ÙoÔüm¼%èÌ_Éá‚äàAr)¼¨øì€yž“(Íq“f +5äÙè¯ +3R“„Y„¿,ˆvÎDx §!Ýüaí^Ê.ѨúO‡D¿‘zÅv=‡f»žcrÚs18Ñ”…ÓÑ ßp=ôÜè²Qø3èÇ/I"á~ó€K` œfHÇ´€Ñ Á„ÜÖ*0(—µ¬ éô{g{ó0=WH­Ñ“SÄ€'Á¨à,ÑöFÇåc‚bæt¬®rVuù‰N¡à!Ù‰¦?ÚÎî"-'êQm˜#<$m¥´Ùl,Ì)mìu\ɸš©5s:“W¤>}&Å\°¢ja¹YbÃfs Ñvÿ­Æ>ëÞËxø›Ð›8D—’‹«°çqéÃQâg«±ÍÐt ó/0äY$þ_p O\¡’;B¹çãÇ9é…Õ‚Š(‘wEfÐgßi8 +_Zø§£p8ÇxnuXl8{Þ£Pêùü±m„Odü9Ö3•nË#ïòâ?ÙNwlû!ÛéØ)®5ßc?¿sNÄt•ÃL‰:$}â1¦8êž{l4w”çnÇ-s>¶ ç†ÄU +S`ô•Ô•„qr†¶žWŒô Ø2*¦Ø+6#•–Ô´ÙïËÃk$Êßœ‘{ÞöÍës ¥’ëµrç¦&èá†mWó›D^Œl&¡¦™A›æ=}矼Õ”ŸhÛQ³^þö¦Äð¶ÝGÎ]\øåJZª-· +g„ܾđÐ$”¸e¼?–ÁƒÓ1ÃUó!¤>Ñ|¥Ë˜,~%±^i^ez i‚Å ”pȆ‡ÍsŒDši2ê”Ô…¹ßڨlDEVÊ +Šûœ¬­6of›¬µö6<·²x+“8<1t9<1tѼ³6r¯0l²—ÍŸ™ºcÖiå.;¶nò31KMpH¶û]ð^FØöHSïCRK„pt“²t “ŽË$<[¶MzhˆÓЪD†Ô£5Ìc!’ãשF’óm¼>Õ+²¸W¹z~´ÊI›ŸtÌîeBBA‘Pˆ ¯YǺ2¡Üóƒ¼7ÑHÚf8ž·+nYž!(´w;Zvàº=x%b©-J§QZ=|Ü&ØŒ2“ª(ÏÄU &½ÐÄ£"¶¥'œÕ†ü>iánàvf'Ë.‘”dA'³^ Z™¥P‚›‘@`+~8ΑQŸ -÷÷꩘Îqíw˜^—W»<3X£±¼J[Ž#ËxøïX¥NëNÔÙÇWŒXš¯3ŽM}$¡_4) t£± 6]—K'€ªÖi"Õf’DÿM|Š#Q]Ä£ÀY’êJgVÀݺٺseÐîçR‚ø¼V’I.¨%qŽ5¨ç†‹ÉÂÔF¹ŽLL|ßw€oÄygäÆ1a^ˆÒräü»QZwíœ>¢JÌóÏh$G®2éÊs –XeFºâ`Ý¢Ä`ì–˜…ºPêRdcK5¥RצYL(Ù¤1…V9f0mZæYÔqjÇÅÕ­¸ù4“¸pÕiŽòžq@š§G¿’Ó«!*• !Cò ÎÍMã’sÝB¹PÆ–B<ðÞ#›DGsµÉþ&ŸœütTñÇ6v²Lî÷k³uÜ­’£Fêaô é Ã>‚è-A8£Ó‰èQmûh=ÓŒ­6¬¯,s±üa7y‘­\*ewlcI ñ·Aò– 3%‡ ç™H.åñyÃcW}.Æ­–»Œ„—!ÙÒ —‡úp•;\Ó~û¥ø¶ýGBýe±@à $¼ƒ„Ónþ°êÈÐr5D^¢òMÙ>ñ¶çÊ (R÷¥ý4Í„1µRg7Z9²Wy3øpÇCîe +5Èv¹ +’H„¨œ+.Aºkþîž $Þ|"B$1áìX8¬²[—ðÞöÙÔt¾>CÜñwoBLœѪf÷ÙöFN+§Ž×ȶÚÕïPc~œ“^X-¨ˆy?ZšC¾‘<§ùÚöæÐÂQ¸3vì'õ{ßäØAñQ'ÅT‚x={KÜÇL×µ‚»ßóH-– ¤.8É™-+&¸øÞÕ˜•}~¿ÊÚÆbí¡~ÉéÆk¨sÅ4“ô@”‹5}ì!ízÛ_Q÷Ù{«ûK~Õþã9Úµ+oM è6ýPj`Á^S°UXý£‡llÍŸÌ;™ÛtóÇï_ü5ä£mM©£k ·QS &2‡YWP] Ì7Pf8Q÷—/Gb‹ v:ZÔž†Ö3œ¾8Ï{'³Ð˜ª(PÚ'of½—&ÓêjëHS%çPÅMËŒ¿:5 +6Á†®‰r8^+*›×Û¦ÒЩÊIŒ2lªy8½'À¼YCÃpÚÿ0_.iê: žŸUÔèH€°£39ûŸ^bI–©îÜYýÝUø!Ë)Ú‰ØuóË_Xß’¢íö ¿œ'ZŠÇnkç•7KYN¼·3£°h¼åæ¶)bØë¾‘c&¨â¿ÝKV +b™”uá¦)ãªÈµT#;« ®ÚÑ[Q㉱“ˆë +¯ûõßq¾^tãB@Œþ‚m+7jÑvÏ~øöí)Áªö$cs\›vÞ/”å¸K†º²‹ü=xßÎnG:5’{4Ôö7è>]EÆý¬¸Ñ Ûë¿(f™K¬‡OKTáÏ‹–¶˜!)örÔæD ³Ï;µè`-S¨dþû;XµÔ¼Q› +•ý¯›Ýø`ÖKZZö¼1f]ºpçh1k¸~Uö´=ì–"!UËxÂY é„ýz|˜°õ׃wQ2,¤fëŒTtc#Þ‡“B—å”Q(6íëíi¦rN*þÐÌjåÁë´AÉT®Òdxă¹cÊ (0ßSÞQÁ)à´”èh”ÅžiÛ‹£q²Ž9­ËX·¾®n°?œâ“Äë˜Nñ©Üõ9G:EÜ´Œà‰°›ü’¡/Â2cW¨Ÿ-š}ÚÕ7ù[ù)³Ã÷ glsð¬_—j÷øiíùñÿ¹M„ëéñç Ó¦Ï(¿Io‰ÜeÐGµyD97VŠœ›0Mz™ÞÐÔ…Ê΂t‘Í'æXÌ®HÖ6Ôï«»±¾zHxA:QRñöBª«…àFGñübãæ +Ò[¢ÁÒ= +gW”A$tcâÝ+~ûÅýeÙÇ2Ò> +éq#l¨yýGjiW(â+Ш9þM=ÿl¬­–c{ËGË*xç«@V)DKåeÜÏŠ¨EôsVªÛ[mbé[ó~(Ÿ›#Š9‰'ƒ“‰ÛBŒt‰ëÛÈàd0Òó º +îúk«´¶ópÅÞ(:¯iÆ”²3L¤OÙíáîDûø¸¶c+4+ê]}&(kÒ~ÞE]èó®þwk˜æÌ1­aVÕq3h¥9Ã2ŠŽûã6žYqÇO=°:ÌrùEdQ*3%(¨&Q¤!‡”JÈf)YôHÙ êcÚ¿ÿ°ð…ÿŒ'q +­"‰ ÛXŸ;—¥A¬“o}MC<^S²SøßÓ”“—S¹}<°sIˆaž£ýרߢ‹U&&Á\¶Ïk!x/ßV¥XF·ða"š (¼Ýñ™o£DCE‚ÙÒö#&º ²,.„ÖeQív³@4? $La' êèËüAGCûéðŸéTÛÊ·ÊrÂÓ"&ò»"8cŽ¥dÎÁºè1†É(:ÂÌ&Åœ!Õ"ÌÂ2 -õz=ÆB¡’ôþòµ=þê‰y”yy„5BX:ÓŠô<äø 8®X14WAœUc?2= o&Iywl;m\…ЄÇϺÙœ"´/(‡p"ZÚX~º 9 ½â¥e&Ñû‰šÉóf‹oMœ}¨ ,vçm½D\8S9¨h%Ä,ï˜TÆ™ÕŃ •B{! a8¸fÒT¶¼-ZÁ0Ì.CR|5)žãU". +Wâ­4<‹C ']IÖîç •$:¥/T‚åÁΣâ—C“ èO,8ùF¹<\¦^7O®’Æ%¿©vi&ì[¸aÃJ%˜1V!¦ùèBûYh¦<Š{/T†ZËwAÝt(7:hº`—÷³B5UŒ“ö;uWeüëw—ò R‰ç.>‚ðîq1ZGý׸ŸñdL¬|o" \?ZÍtÚ"¨ôR¡ˆ¾^~„ÝHÊ£¯M­ÄZaBI&¡$ISôüU%)ÚÎb|P„4D"%”$ýS€>ddh†ËOˆ|¾û&D\¤SÑî!Y‰H% 8¥b•ŽwÞ5Ue“R$r§ÚŠÏ7†¶RËß”Hþ´àzZOW-`‰Û)éÅÕô™Ê +½¶ç¾¶®¸glÆØ4#ÒÏËÆ2¡áÃíÀ~3v [Sâe»›aH¤Å-/)qê´™(ëfÅo‡~=ÊÔÇýiç9ÕªC÷‘ëå}óååcÓZÁ ýÍб‡¹®_ÿÿâ¿7‰ó~üè6ž¯å÷1YòµÜ88QE̘«ˆ…Z+/å ²™ ŠT—Åâ.W`™8Õ¬k*±˜’¯ŽýúZ6 +Ñ2Ôåc±ã¾órÀnÒ— Î··‰AפÔy"º@xÅa¨8zÅ÷“ËŸÛAÁs-7ÂDËëcø-Þn\amŽSõãzçÜýÈlË*xý« Nþ,/c(hâF ×Qõý^gÑó‹Y¤oÁ[è |þnÿ·ïσïÐ%à;tßœ FÙÔ°c!¸p!…b­Q°©åN R† O„íOÙ¹7í£,[¬a¢5¶Z}&,½I±9Õ¢.ôyWÿ»5LSÜMóÊî8lÙœÛ]è¸?nã™wüÔ«Ã,—_D!A¥2S‚RjE/+‰R²è­ÅÚˆ¨Yhÿþ³ÈkÌ/üg̉rÙJ‰ðL ë‚­S‡IĹ9ÓRûñ5jQÜRîÊÅ7¥É½à4[ìm[$Sâ¥Ï:>³%4MyhxHCÑÓ¼.ŠQ9…º1ù¨ZŠöº=E:ª[–eÿi}dÝ™ŽòyÓ4öú«ûð7qÓî ã¹ÂóèvõŸq¶«. ¹3ÐöxmØ>ukØÊÄÄl퇗:Ï]Ø,h@n1ÉsÊÇäª~à›ÞÎ!iôb1 œ¶ó›ÚE!–ZT!²;[¸0$¿7Áü$õ°I¢£|†ÑJª0b,¤[>ÈSÚÛY}]\îoÏ·ÇXÀåfçùâ2Ž2œGQûÇpžW1±¤ÍFU ‚‰eîàv5°äÆL·]¶ÝÕ‚Í6¶=ÑÈsèÛYLþÝÕjl¿º2Œ¾ý;¥:DþêhX\Ú¸êôÀ-ú« úÏ]æ,(eçi¡qZuÄþ&<_Ôï2KzSÞy^–£`šõв×ôÒàk/¬¦g¯Ó eóx‹~Ô98£ž dN3T²WÖÄÐ˲b/TÜÍòôÏÙOn¦Æ‹c~\/ÜÏ,ÊÌê7+Ž~hßþÇ}Ù$ÉŽÛ@xïSÔÔ!‰¤(ÞÈ›wÿ­Id&©zÂã•#fW_w•Dâ'‘ˆ?¯~P% W‚V©îÐcz¦ Ô[øvKS@3 „1AèƒVèYéw°WNf½D+ã±–¬¨‡È®”¿ IœóZ’woÎÉ }3w–)ðá¢× ïžQ€}†ûã^¸dBöÝ’j…'!Íb¿=ÊA+‰¢¯øÅ@¶™ã^¼ëÐ Av'¶à•bé‰aÖt/€ «pUŸ`[  4¡ûŽjŠÑ¥hà×Ñ4n·£Â'f‹jäæŽ¥]Òº§ü¦Ì§‰Êù²µöŸzmz‹öSyi·h© ÑŠà ù7Ô +÷¶ÄpÊ€aŸ[¨ iEŽþ½'ãºbA’…߇ï÷zø\þJ›A?Ž8ü†×.µáG|ØË7ÓŽú÷Ÿ\¼§Ì½¾°êiXßì™ôOß·¹ËºîýÛm›?;bb£ÈŸ?ƒ×߸ãŃz«ç ý§Ÿw›g˜±/³|â Ô5Dl}”÷ßà1^øûju}é…%ž>êK»ú>÷˜÷>Û?¤ÆlÅ»ýE!ØàasìI}Øî¡FY˜žÿqa¢N½d‹'¤ +©ŽwÍg‹Ohœö¤žGÓ‹ö$Ñ_(ý#ö'%£6M1®ž¯¡Æ/¿Pð÷ù¨éù­¯±‹«¾‘ˆ ¤Ð¢ãÜb¸³{*vÏÑîÉÛ} `QÔò¶Îûç/ö5§»'jf°D;ßáã_$‹#‚ýÁ,5¶‹È&ÀD‰žv«ef»ˆüÛ.‰€ÀÊÙ!œIþÉcˆ–ÝâWDäÕQçÞ5£ÎL”³!"dþ^5Žçýpp‰€{ÀÝ[Ð¥%ôrWBWÔøíÞTêáUè΂qYñGÔ¦ž3Mb¬/ {ñ\`ò,a\yJ±C)ß%6›4xøêÚh2«_Ò†š&á}%g©3qléøT{l_6tí#JA +>5ÿðË7Zô7Ï›9÷Ѱ™yêàQ#×TÝߨJƒýùàñÀ%8N…µy±<9¥ã1žµyfÇý—#ºí3 +mü›„äÎrAÿ›-BWªÙ‰ÃµýúÓÌý3 Q;fKÖY$ÿOg\ʪ·‹Ò]KœƒØÇ7è " ‹ä.PbBH¢ãGã<´ \ÔzXø¯ÕAáóÖÃbw%QBVìcë]oJdË… ¨ù²^äe½'æÉúõ, º€kø‘5ÜEÍ¢ +aùsZÇ‹Yû4\9¥aAd`Ož¤8ÃÈÈÄ!áL@™£U\e‹ÑtfKG„+ñ/¿0¿e“Ÿù2¡6åŸr+=E8 â8.ÂjÑÚb°Í¿*b°oì5[Âa¿=ëÀŸÞ…ÆFxcI, ¥6øvØá +œF-˜’ >DxÁ¥8âºÂ>ÿ½¯Ç‹.,–ׄåH7*Öx ¯Úâö«ÙS¨ÊLÆq-2K/DN&¦ Ueù›8Fd·"2϶Å&Ѹ¢ŠÏ+#ê3°<þ‹bƃ÷øDRÙT(.^›Ên%µ’l¢õ)B§ža¾£¿ËÒqW‚Ba÷„H@ð» • õ ÞD½:3?㦥Õ:CŠWí¯*…º~€>[ÐM(!°"Œ”jçy’„yæËï&½ëšÍ¢×¦_iYR0))™ÈB2çb­®d O¾#*ÅÒå¨Ç +Gõ·,oÆ'¡dŽP2וÌQ¥?°S¨1VL¼Å¾-’°"í^©FÕL©ºXúõl±¬T©Þ=Jt‚övÜÔ¨óŒ~œè㎕]hš°ä,*Tn¹ÈÀ—z{i/ÏÁ~Ù±6©[¬ª°•;cíÚGÆR>qD¡ ±ª­3RÓ¯äþ} :Ç¥ÅLæzÄ›t˜^9ÌQþ§•ºYL3„k˜¹8J\Ôv0éQa|Ñ¡\Àbèí< +;ÚÝŒe,èFç˘dˆç'3q`ÉÒá Éîa„«2ʦoT„ãx<êíZ·Mù21IžÜÄéZp£iSJ‹ëÏv§IÛÑ•W ]ˆøÕÝ)NLû o*ŽªàIÔ*V¶5ŽÊ+ð¼2¢çÌn5*¸Ç'³HßZψG€üù¶Á ˜x2XY‰ÃL‡.qœ±«.S †^DWÁ¡ïG¦½|"ÝöÑÚe#e—-:¢Úû'²[ÍbˆÎûup´#Ѫ¨gõ]æMœÎñyu¢Ï³úŸ­´t/h¯y\AKÍi¾EÔFÚ WV¢ã—¤]sÔo¢ ‹R™%A®@9‰"$ø½õ®R +Ñ#ql€¨^hÿþ;_øˆÿo°Yr¸Žxª# Ö†Y¥ó8âèN­+³›«M¡CT7Fö×f7PÌÉ} /¬Ž8ÐlN têB:u½•N½P™ÍzñÀ4mNf÷B +*Î+4çªa.3Pñ£Âì°eˆ=ÌSÃÛ’àÑ«±DœÉs½¤ów9¥SuµåVšb]º ví6Öl£ðoIêÉèÄàž†ŠW°+â4„lD}~ÝîYasã+ýž_Ÿ×yn‰Æ«??‡†ù|P|Ë?yz»í2nxÖ÷¥ö¾†Àù)Wû©w¾ÔNKº_±DÚÚ€ŠJÜXu¿-Ñ1>¨6m´«xÐc°\nÇÌ_ÈÆÁ|ÈýÁ¨ 9œ.¼`Õ¬ oJd3làg˜aèH¼hEÑà4#ú‘G½éš¿j…Õ+ö³Q­ãéâçÚk¾ûꡃ3­vØly“âÏê¶FК{A[ÏVp-5§éјÉA®¬Dǯy¼æìßÄA‚,jʬä('Q„¿]ï*¥z$® ç£Úß?ì|á_ þ†Àá™"¨«‚E¥Ã8âÜGÖ}ÙJ +TQÜÒ‚g*‹Jj³à4’¢ì,m@ÇS'ÞŽ·Û'öèfEr]±Ï¤qÿ uÝØÎëh˜nL¾¶º…BCÚÕÀ*P +ë^Aãó”Aמ5G|Ç Z'Ú¯«ÛxŽ[õ°úWçE§‡V[QÓ-1GLEsKQ•í88·kçíÙ„8EF» é–#‘ i”Àb…I¯˜'£xöÏÓ'j„ŠdWvÂù§ä‰2‚B¹IQC¢;QÚT¾ß6¶šÚñ¼ü%œÐºc,?HGű*,ê†á/q“ßáû¶·òhKKíÑ$ •sªsD…òeµ„ÎEQ•¨1Ûëb ZõZR יŵi s’Þ¾ÃçšÆI˜2]H™®·R¦7ŽeÓ]<0›“i½çšlŒ©a3Pñã„Ù É{N0O k¬¤G¡þÅšàLžÏKÊ~§”©>mi)PSå¥Tƒ}vk±qð—4êÉèÄà3VŠ¿£/+á´€l;}~3 uiÖoÓpÝ_¿/ó4 ãBGº,7ôêjsŒµn³Ba' ê1þ5‚Žâ‰§CJ»è6™-) .õ yŽ˜Hº‹ ò¹a?ÚA1âc#cÉ‹†ér'[ù"¤Z„µþ‰¥[K¯Ç†K”’Þ½Û_cù´ú‡©<„¥3­HÏM?—éinIĵ{íÃÓ³:5L–·÷4ãÖ®3špüluxsŠÐ¾ ׎héÀôÓ‚æL!Ž—&yADï;J^¬›•¸5qõ¡‚PBD3F?âZ"èÄÕ˜ÊAÆX*“%K7peµDØF¥P) ¨}Æq}’ºÉ‚²<ÕfBÓ7Ì.Å“}ÕÉž#©Ø¸D&°Kʯ­ÐLA&©<¹*I}/T‚%'‘ñ%6¥LMÎÆ'œ$°+HbY¯['WIã’oê#g¬#nØà+Æê d#h=:Ñ~$Ú­)G2"‰ÒRkþ.L7 +TÇÇ :¡ü÷#B‚iª;íÓç® òø;æï–ô R‰ç–8‚pöŒ¸U°þ¸ñdl,¯# Ü>r™:måÔ@ˆz)‘E_/&7œ<Æèë –âY„’tBI’Ö@Òó7•¤¨Iø )ˆDJ(Iê'}ðÈP×§Ÿù<|÷Iˆ¸H§¢ÎD²‘Jz ŽŠMsdL¿«O•ªIáH{X“e ´ÙÊY†øúˆäOnGÌÓM^Ò±½¸š>s²b^‡}8ë7ÜÓŒP !í·&R†æ‹´|htBošM +iJrEÜ%‰RŠ¡·%e#â|ôBûû§Hj¬/ü ô…r†’á™"èÕÓ©Ã8âÜ\i>ûñ5ª(n)í„rQ ¦´¸ NSͶVK> “㩯:Þ»ÅfšrÓ;MñZ×E1*§˜nL>ª–C{ ºÝ‡´U·Ë~oÞËë.h¤Ïë˜Aמ5G|Ç Z'Ú¯«ÛxŽýgô°úWçE§ë*˜º%æˆ"€‰£è`n)ª0¨O/ûEÉö&ŠŒ6vÒ y¡†S_Âð©lD¨)YC´”l#ªQS–„¾éTúò¨Fþ)¹U¢l©ðimeS‰zQï§2FS;žáp}kᎱü¤}ĪD°¨†¼DÄW¦ŠζDmi©=šô®rNy¨‚°MêÕ²>¢ŒPT%jÌöú£ƒV½–TÃuRk ˜]§® +ˈóMã$Ì`r(вoµØ ©»x`*6'Óz1 +:Î+4ÙSÃ$f âÇ ³A“!ö’ôJ k¬¤·C´}±&8“çóÒôI§çÃÑì5U^J5Øg·±› þ’F=|ÆJñâwô¥Bûé ȶÓçÿ¬Í9~F½Ÿö²68 ý–õaå¯>3n½of4ÚÓ +Ê:y4›²Õþß’íÑoÊ6³ã|Øñ\첨…UXC53«òÍ(µÄ•Ç?s­ùÄàöl²¬¥.¯1@²wëOëqó’T›ns)b×FŠlÿ²‹Öä^7nÏ„¿WÂu—SÝÇírÇO¿zv¹”½ÛQÙjÕf}Tš¨%}pwF=>ß²«ÎŠÚZÛøÕÑÊu.ùLÆH*BãHaB!rN^€Å‰ŠÁ›ÙªœøV%’…±ðåU:øªŸ~dü:hX΋òy¶DëxºxåÚDßï>NPå*FO#áoRœW¨B´®ûxzÊœm:mcœ×ׯ㚳éË/Ìo)¡›‰XÎ8QAt\+Â36„jÔqZ +>)¹]î¿*bGÿ Ï›)!ÆÎžò’ð˜ÑwÜŽæ½ÐV©4&CÂ*AØ7N«‰• õ!<ÐÿŽÇ™ñœÿ^ÇãE’Tá’¶šnÔ¬ñ˜B¸½+„jͰquMôÂPA]ÙEþnœ3²Û‘Χˆ,fŒæñxÄýÈèòØÿ•´4=Ÿ\c¢©¤)×á⹩ìVšV3®ˆŽú¡SCª¿ïMØc”56 g$DDª_´²/™¹ÞÄy5uf~ÆMµ»u†&^·¿ªúúúlÁiƒV„õÒí!±A¸÷½f, +ˆ‰Ñ÷YRpSšd" Éø©½û$yòQ)Ž]Žz¬pvËO|2“Ì“ ÇõIæ¨ÒŸýʱbRÂi]¹=iïôÎi4XÍUK¿ï#Ôl×Ô»f‹NÑ`ÇI³oô‚)áX­ëm&ÀF¸Û¡XoPÀÒõng:ûÅF‘s+ð€'ÚD ì烶™±õǃwQhƒXÈ©V„ŽGH‹³Ç:÷˺‹©\Yt1ÛŒ}fã‚D»¨ L›+;¨•%)žÊMSzÃqp%wì…» x7%;…Us¥Šª349ý‘Æ0ýêØ‘û:-ö˜°[4Ø/jñ>ãq§÷/Ïíz* {Ø.¡xe±A”~ài¥„.Ó¡¤¦ePâ¢æ5—Ј +ã‹uç8Ci{…'Úݼшh$Lé€U@bâ¡ø]á É®a„Öæ?ÂË%Kv†¡ó¬¢6à>¶%ë³£7Hö?E$íêœÌêvUÛ? (”M!T„ã|<êíZ·Mù21IžÜÄéZp£Û¦”+®ÏK¡òý‹v!â_Two¤8y™)Ï.^O¢V± +4°­qT^gˈZäöªJîñ‰Å,Ò¯Ö3â ¾m0(f'ž –@Vâ0Ó¡K\#†ǃáƒÑUpïÐ÷#Ó^>‘‡nû‹¨õ唲f‹Ž¨öþ‰ìV³¢s|¢ŽëH´*êY}Aͼ‰Ó9?Ï¢NôyVÿ³5‚–îí5¯‚+h©9Í·ˆ®™6È••èø¥iלõ›($È¢TfI+PN¢ ~o½«”BôH ê£ÚŸ¿ØøÁ?ø~ƒÍ’ÃuÄSa°6Ì*ÇGßpj]™Ý¤Xm +¢ºá™JdžY%ùáEèÔô¹ìïÛ}Õ²Baƒ’#!ü_ÐÊNP·Å Óô[ z²ÀT(;óÃ{j²ÕÇ’Sí¯*…ŠUfý|A·•+Âd‚~’„™Ë)ï&½a¯¢wÝÖíòÈŠ‚›’’‰,$×ÏQ«+È“ïˆJq„t9ê±ÂYý-ËùðÉD(™#” Çu%sTés«PcPCÐb¾U( +ÒÞéZ2.V3¥ª±ôëy優7f‰N€FyÇÝužÑ7zÁl°ÖÞõ¦ K΢B7³èZü¶µ¥/í+ûŤHHÝ +4Í 4E ¬ýAûÌXêãÁ'Ž(4!RµuFjzàšÒºg….Ë9£Pp(1jœg +)'¥â%ð츧ìíá*§,UY~”xq$Ód¢(ÜdBàÃdÒ(ÉUÒEåEïË6Ò(¢ŽÃ7b^¿|#vûÅ,^?ý¼ÍÒïÿìûHn19Œ¼š¬?%³A”àiå„nÓ A_‡¶ ÄEד{¶€FT_t¨[|Ç™]:ó(ìh_Yú>2q­1GÚðüd&lA +¤ÃA’ÝÃWe$”M!T„ã¬ß®å|Ø”/“äÉMŒ®7ºm +6.\ÿnwš´]9qÚ…ˆQݽ‘âÄ´¿pPqTO¢V± +4°­qT^gˈZ¼göU£R{|b1‹ô«20œz"¾m0(f'ž –@Vâ0Ó¡K\#†ǃáƒÑUpïÐ÷#Ó^>‘‡nû‹¨õ唲f‹Ž¨öþ‰ìV³¢s|¢ŽëH´*êY}Aͼ‰Ó9?Ï¢NôyVÿ³5‚–îí5¯‚+h©9Í·ˆ®™6È••èø¥iלõ›($È¢TfI+PN¢ ~o½«”BôH ê£ÚŸ¿ØøÁ?ø !ƒ+Â3EpW•ãˆso8²îËVR 6Å !ÝðLåbà’ÛÜpYQv–& c׉÷övÿÄÝ­Hƈy&ƒø­ëÆt^Gƒº1ùšêX‰´»UáÖ½‚®ÏÓR3ÿ×¼â—8NÐ:AÐ9¬nã9nkT¯€Õ¿:/:=¼ÚŠšn Q 8ŠtKQÕÚѨ[ÍÚùEg^Bœ"£…݆tk#Ñ:“”`Å + ’?^1O‹b¯Ÿçž( iM\Ù‰µÐÈ?¥¨EP¨m‹¨C¢o¢\Sù~›ØjjÇ>ü[lBëŽ1ü`Äj‹`Ñ7\ð-"nö;ö¾ Ó[y´¡¥ö(²†Ê9ݹ +â€óeµ„ÏEQmQc6×Å´êuK5|Ìl®Ík ˜“õ6ìŽ8Ðç.*%–FQéEÉ*×K©¨tYjÎÍŽçΕMc¯.Ù0!2³ÅÞŒ¾I|ðø=7ŽË³S´7±1ª'fãÀ»Õçuóò‡›j"±«?WŠl…yfP"Ñõ´yâï¥Poý¹ãw–ÛTÏ2_•°·ƒšqü‚N3äF-åXä„°ùTY¡kdÔ"tÀDqÕšê…5a ¤N-y G&6©ls-aOg„}#.th€:bºÂÃ:"ŽÆç4¢ +Üã­ÀAoq”–iöDþ6ó$°8è}ìvú¥Þ‡€û™í¾¦GÑaE/à,ØDX'i›Ü¹?аlèHX6´^ÜM¯mr͵ ." ÏÎòUÀœê_"ªóP¹pB¢ žFH„— ‡×‹ÍèoØMK}`EiaÝ¥ŒŒ µ$ì¨á€tl5£‰Ÿ°¨'…¹Šº'.êºJûÅ®{a¡W«WŠL±gxÜd•àŸXà"dPvEÈ<^ï¡~ŠÊÎj«<ꮨî¦bŸ­Ì¥Ï3¸òóHÄ¿ì—Krì:Dç½ +o@Q¤>\PGôäMzÿƒ™Xö +:<ºu®«$ß̤ë®»¼çD–Фá]¦gZ)$q"Ô“‹bû$\uùIh”p–,Hs›"šdScÛüSp†ÆšõÀ~…¦×ž”c§}õ–¸Ä”m†91d(Jίµ¾àÍרi +ÚY›oMàá6ηé†N_=§62΢ÏvÌøüŒølWÓgxÈXùPxFn£×ã¸:æºÎŒÿÕ…ð ]’G‘±·*h? +°è¡¡¸¼šW‚Xƒ~Ï'š^È·=kžyÔ˜n‡jDPµñÙƒs¥×JžëÈæIz<AWýÛôÈOÚ IB¶ƒf¼c ÉF„ªÝb0éö»¤±m‘5¸^å©3Ûäq.Ïcâ?¸›‘Å—®;2%ÂÔÜþ˜"LƒágRëW!ô°#–Ÿb&b)&.„á¨÷Q¾œåJ´_Ÿ¸}èU„&Œ¢Zÿ¯;’S¢nyÜ2u®ø%º¹ +B°Ã^„›37HÁ6Ózp½æGné¬bßákù—/_0Â8; N@Õ‘èE§§€ÑÝ(vròÐ"Lhøˆ!¦A¸‹¶š G™ z8,ÎúÍÑ‹?$*8KyéÈèH‹ja—>ðJi¸«~÷bwVˆÈm‚¢H‘86aGØ>‘¢}²&èðv¹S:¼]n6y–œpÁE|ØgéÑõ¿0=aØ#D¿ð®Í ¿ôÉ7~Îlß@L¡íÃ]%C$na·ús/ŒÑ‘Œ9#IQ>rRÑ öq¾qj¯-=ß\GQ¡pÿûoûÒêa¯ÃLì° ½·ª&ö­î+·ö‹Ï”Íñð?´D}ùF¿_4ÂcVL‘°¥â b›baÄ/±1±2"JHab+GÔž‹¥§•§ƒWËY½á&…‡ãl««üé@$äåVc¿ïFSk«vçy¾Ò–A¦ 0ð¤ç€ˆ‘–~mæçjõLõ‘4àÎÔ"Iç(„Ž_$>á¹[©ûÅÒÒÀ?ˆÜfäòH‡ÓgÏ…‡ +Ç#'zç–JÏsÁ{Êô¨Ñæ¨8x‚»Ô@_+„‹TÚ±«$$BXÒ+±¨Û@ ¯@ȧÀsë©xËW¯¹¼møð²~D춸ò×síYhÐÔÞ * 2^ð¢Âð'zPïqd¶=—Xû‘iÔLÔA¢¯H[IÜ­³Jð­‚ö†‚® ÀCI$ú—½-B„$Ý-¨×xrCÍóÌÓi@ví'å‚x³,¹ü.­]ÂÝuVÖ&ö¢”l|ÐÁð¥·yŒOž8u¤ßGó²|D3÷žMÁ°&žhŠ›£ £¡„ÇJmV¬ÍF=–øÌ^Ñ‚º­ÎmKËwÕ[¢±¶j·t‘ã-­Qn”(«J<àÜ&^Ä¥g (‹8 jˆgU…á'*½ Ô,o­vŽ¿¢9(T¢…É6]©~æ;Þ©ú'þÀŸøàëOèãŸøÿ×ÛÝÀý=Ž·6V€Hmã=déUñ{ß[ì.ŒOþ] %êÛ?qŽ÷Ýï/þ”»õÚ{,û„ oŸ:Eˆ-’÷ýØïØ-¨ l‡”Ö)@’ý-ªÔ t×»'Þ4¥T±‹ZªñÍó±ë¥¦Q1Xz%{™”/e’•¨FÄ{ wbe¡Øñ¬ðQ¨v $;ÂZCYý§Ç$¨|¶_eÓØíp¨­£Ÿ‘:œD{ð [·BÉ5ÁJãD¼ä"; £ÈÉÈ&è«è°Æ¡9õHá³|Y¯ÿ”t)-ê3¤Òd«ÙḚ̈løßPtø_kÃ?!á +^#4¢^²à‘«‚×Áyƒ¸ß˜åxê“‚Ó?÷ÑùŒŠG;*öÑ*Ú|(xö§â…‹^Ë—Ü4ðZÞ;gù«íž²Òàp³W´+ïý¶K¦6ŽŒ'”In´·ùDJOyÁ;³*‚ßgE©;/‹¹$ÿ©u|ÅâÎËAEˆ +lsùk£¼#B÷ü_³7æ3@è‰ÁfEˆt4R^±¨Û;^ð´bHpJ·â*¬³m±á –ê•4¿§fÛK³¥À½Žã+ÅðkZ¥šoŸáÒ×Ïc£iaÚƒ2í¤†oNJJ:aòß{;#®/==2 ÂÅAÛOôÜ¢:ë“¢”‘[œ!Ê0ðÎÃG±ãžÑD/¢Ñq£Žj´­("~9°®…nV:'Òê¥á †á‹*IûÔŽŠ>ÞÉE.ƒØ®j]h0„½ÍŠ®1õbd%ÒÀØp6&¸«À}Vì£Ua.îEOY’3ú!;ßÊŸsŒ÷æíXÕ´Þ¿EéM·‹ûò±s Icr¨ü47Ëß?øwÕžß}Îë=§eçÔ^ðc®¨q%ê´¸ DK„ )ÒSÚ²mÚ²n@ÈK§ŠŸìmRøÕs½Ç¼ï¡å¦$³®…\B£”Žï»Ÿ±?`c“ÌÅJõ£ íóAÖx×%X[%í¾Ç¤ì¬Q¤å,¡úl–!>Ç'ìÇÔšùxÑîÇ–=±—ä&D>ÆòtùAÕqç¬pdÈd†Â6ùD¦ò³A²[–à•²+kºE( x@ˆ]JÂ&ÜÓ¤±2ú+íCòþ•­MýŸm2)öÃéo…ô·SÕ­ˆÍ. ˆx$z°6ÙED9Ñó±Uc¹)Ø¿›ì)&ë&'û<|kóZÂTæÄ’èBÈr ÛõsX€¸5ðJÛ/ +"Áj%É"¡½äH°°$Y-ºíÕ£X­B÷(dÕ›tÍú;‹AÒsÔ§<³²xˆÐ‰I®@êåÔI60tu “O:ž˜:Óop<1¿R!ؾØ9=MÄ(‘<Ú®ýzs"›TBh +˜žÞô²c–‘t`sÏ>ꚲ_åªkZMS +f𠙤_l‰¥Dr õHá³|Y¯'ÆÙvY–ÊÒŠ¢I9î[ ÒTÚ;¥¼«sµµ»6*"Yñ)~›ü”ðLÜd½„¤¯”@±w4‚ -Ž¡@’è¦%Ñ-M¢ûŸDwG‰×~-x-_~pÓÀky¯Û°Uðª˜}–°-ç–›=Ý›Î0çØó#ž0•êV:Ο¨¡·ÏïÌ"hÛ:ÃXp¶±X^ºü§1‰^gå ¢ Ô”$¢¾Y®¸ç§øš½1ŸBOü>¢u4Róó‹–_¤<úSNñÞæ +qÖÙŠZ…ÃS½’æ×à4Ãl{iö˜‰ãm‰\…ÃÌ'*jxs¨d†k'¥]¤Õg”i'5|sŽT"-ÂYtâù½·3âúÒÓ#"\´ýDÏ] ª#°>)J)¹Å¢ ï<|;îMô"º7êhñ¨FÛŠ"âÇQ‘ëZèf¥sÒ)­^Ú’ªl°ÔMÞ¸¨5y!›‰>¤á ¤*Ú0‘úƒè*Øíâ‰÷ S/FV¢Ï7 Á˜‰>9 î³bÇ…„® 4XÐ'¶ÞËážè{ •¯/Ý·)®wÅ)WÐsî¼íÊu™Ö j™zʆH¤¹Iº K¢.P¾*”z”! +m²¥þ"Ê»6,H)7!ý*€™º¥G%J¡¾¶ð¤EOY’3ú§½Þb~ÞquŒ÷æí½z²ñþ-JÏJΟX>v®¡ímc+ßO†y™µ±üýƒ÷_ÏyÎ÷¶»ÓÎ2Žsj/ø1WÔ¸uzР¿ô> =¥-Û¦-넼tªøÉÞ&±yÿÇ~ÙäÈŽã@ø*u$K–í5ð6o3÷_´È`”+f×3o—_U¦-ñ7B2À¹ÞÃ긖G˜‚ÄÃ%R R‚d­¾T±MËHÕ6L˵dv]@SƒGªºÇ¨ì¤Q¨å$¡ü,–Á?û'ìÇКñxRÕcӞȊ RB#y‚waÇO†#BF3ä¶Iï@•¢Ý’ï]™ÓMBaÀ²hHÖ¥FØ„5üHx)Ó‡ÿ5ûà…\¿¢³¹©%˺~ø;ÏvÄ0;X·$kvZ@Ä#PƒUöj>J6–…)Àþ-´§˜¬…Nö¾í­Mk SÙ&EB]®«@d[¯”ýr³ ä¤A î% @€„%Hj1Ñ%¯Éj%ºF"©Þ ùäßI ‚î#?E´dă„N :p£žN1$ƒWÇ0yÓqûÔqxôÇíó+2€íÛ-Õ¦§ˆ&‚‡Ûu©!,—Md‘JM¢ÓS›žvL2ì©Ñç]3’]S–Ïp Ù5í¦)³™ 𤶄ž¨ÁezUßЮ³k.².{á^™Z¦Ü8-2”yîkíúé3Á$Š¤ÂŒÇ• (S:è0/@mÆc‰8:1,9cÑÅÆÑàÕ²yNvTÏt{2«å‰®–#¸$dŽ­?ÅAÂ.AaáÙ¼**%Qú,¿b€ðDf½™QÅPl–gLéfõa³YÏü&›Öæ9™eͪ¡¥8TÿhžÈGïíË|½¡Ÿ­ªÈ’l¸P¦V$=&ÇUc³AK»š”WuÎÖ2íΊHfœ#Äo£Ÿ"ž¡“­qBúR ${gæ‚ð@‹c(˜ TÓ¨–&PýO º£ÀYç†sûò›:Îí½jÃbTÁ«böuøXÎ-5{¼·9ØcÎxÂT²[ÍqþD½úlxEAû ,ûtca³ÍŠeÑÔŸúP4Ô:(¥#§¤!ê;ðx2•k|ò¯Éã ôÄçÍ£å9O1¿iùMÊ£o15áïíÙÁ¯bu¶#WáÐTïÄù5lša¶-zºÏıZ"Váó‰ŠÚ,™!ÖÍW‰«O(ÒnÔðÍg„ú#q>I'žßµ×Ew÷ pqPù‰š;GT‡c~’—’#r‹3x:^qx/vÜÓ›h!º7òhѨzÛ’<âÇ‘ÑÖÜè²J·IÇ´jiSªZƒ…nÒÆE•°ÉÉÔù@ !•Q† ÕDWÂ.”¸L=Y:ß0}6êäLXŸŒ"¸QbBØ|¯ ÷@Ý¡|u¡ð¾qEpl7™8µÅå´ÅÜvÞ„vµuÖqj™jzJôާY(]Ð%^(_ JÝË à…‰6)¡¿ é]$•Ñüª!:3µ„G5¤>4„ø*îI“žH²$fô!{·±Ôã1ÖÍÛºz²þþâ¥'%§OL»­¡²ÚXÊ÷Íp ‹­6êëÿ/®ŸÏ9t$CŽ2Ž×1¹ô”;rZ‘ºYÐ0{:Íú€ø”¶-›¶mÒÒMÄ?ÖÚFÖ»’ŽõNÇ¥<¢$.‘*hT| Ëlµ¥jm’8FŠ~ta"8® j´éš:RÕ5Fa'}B)'ùägq þÙ?a=†ÔŒçÀ"ª›îD6\zÚÉCä(î|22z!wMz’ˆühDÝ–$x§hÊœn +EC²&5Â"¬aGŠH™>ü¯¹/äúÍEý+9ÖõÃßx¶#„ÑÁº%Y¯Ó"¬²‡¿ëJš˜¶Á“ýç/ùRÞvëTcEíèÏJàÌËŽ–4zŸ6#lÆØ<±Ùt²y”8¸ÞºO?ÎÜ!&œŒ–˜~BMcó•„¶çDÅ€à´Õ´r,cÐ#‘\}Ž´ HÇ8a•8é®|‘= ˆ„%EÂúÂYP…A—Î&ê’Beó²hI†ŠDƒ²Ä´‘w„­ß=ÖºÒÂñü‘Š}íþ:“.Ø•€©„™ ZÃÚÉÆu·Š(ÚM:U8i“Ðߤëö¢ƒÏÔ£x=ú)QJû`¢õJCÿÊëŽïØèC_Ȱ K,´èI#`>i\gø9çÁ}œž ¡K*¦ƒÑÿ=§¤¼ßW"ôṚýôþ$¡ƒA­š]˜~ZП 1dðÒBÕàÈñeˆÊÃÍJ\ÛPZ‘Q(1@W¼ÊØQ7”Þd2 +0u€ ±•\'”´–¨ùIA© M¶ƒd´ ‹YR%-Œ¦Oå6‘JL(E«JÇ‹6H¿ê¤Ï ÅÝ™¤t’ŲJ¡ÕªêÈdu¢{ãú޹Æd‚5 L¿#ŠÃ•¬ñÉ +Ïd‘òR‹×a5¢¤qÉ7Ñ9=:HYtjä$Æì d#¨§îê¶uHfÍŒ°­œÒ^ëþ.Œ7 +’†ÇÇ º4@¸6 !Á8eŒŽÇ/ òø;æï–ô R‰ç–8ñq1lÿoà13âÉXZþ^GX¿¨>yÚfS?!"è¥D}¾üœw&1ú:¨§øcV¡$P’F2Ü ±$I-ôõ—i"Òá2ß%”?xdÐê%ýÄО‡ï“x*OnåˆæöôÌ•sä|ü®>U'…#j M¨³Õfâë#Ò~šJö´‹ë!¶ÉÑ‹«ñ³Äç5näÓ<°âžÒ… %¾#«âPéËQ.!9%#%Ô©áŠ×Ãàh*7>¥$RgvÓ³Œ¢0}Œë»õ¹‘ö%ä¤JˆdâÜdÅK ÕçQ€>ë"+ ÓC-QRP?õOR^Ð}eä°>s=”T£wzI ™Õ›ŠØ…æÙÐ9[¦è«FJ´6s„ JæCç&œŒ¬gŠ¥w¤«¥ÓÑé4‡¯°¬•02Є®•^èÒé¼£'åhŸ””aʼnÿAXiá²jÊoÊ|*¨œŸ¢éXºÎñoMÇÕçÜEÉѤ_>—ÄëèõiY4y¸Ëºûq|d=tñùŠä-îØoF®…s)”Î䣎7l”Y±‘Ì.V±ÌŠ Öò.Xê¾ÉŠMi Oýú\2«cúÉõ;7;þ•eéìôábó!h¯•€ŠÝt‚¬ínƒÇî>è€,6Ck!b70,²C_™zïŒÅÏ9¼5 ë§Rïó^R8koÍv¿Jeî»2c(…È‘¶ µJâS ®Ñ;NwK”w3oëd­#M̾ +-Ý“€|ú‘è¾²¸¼UcVas‡(EÇ’¤©CÚŽ+ ]HÔþf¿Zv9Žà_Áã.Œn×#ëu”$CØ€aø`k°–,ÖE¿ïÈÊʪj²93,¬m€‡]vpX]ùŒŒÔ¾w3 ˆêUdœ»RÒm8WÁ­³9çþ$b=ôpKðB^´ñ@•ŸÄjÉÃ@²{(Ç27BÖ×™Æî¾úй>Î«Ž ]ƒ8Á[4Ñþ”nEºvqÏkÑ(ÒMN€>³ÇB7ôÈPç1º^èŠãÓiQÑÁ°±±B1HZ®÷aC/u…k-Ý¡tü6äÖ|,º†j +ÓèºÙˆHÜé<%žˆ0¬û…KÏ÷)å‰û¢=5™µ~5ë¼™e-ˆØÒ8:¼ŒÌC–¸'”øjª¡’M!ˆ«w Xæsƒ²›ß’Ëüއ"éÄœ¸ÐŸ¬ˆ C]2¹D.wÖé T\îü¥1÷-2’|Ë€iìÉãV);¥®b2Û´dK’ÐLh¬œc ËÓ*(‹ØØ­J¥8]žI¿RÓöRØ™2!éWj;ô$m6E®­*VµªÛ|Ý`íÚ6È|âÚuUöžÖ/ÉžuÑq|Y£qy–uQ¤‡4£@˜í¹z§?”>Ô!0žÇˆâT] ñ«þ´Háé…VÕ Ô€¼ëZ«š„PC=øc€o¸} ðÇã·þà¿Á'ËÛ®Lr9Àû …ž±´nG˜¿ °¨…=,],i€]ìfžø=ÜÚ\’صÁÒfiotI9ãØþÎýºhR_[tÑ” «yRLKow)»EKh‘ʘ1÷ç +˜°mæ§<½ÞkVÙøÚÅ#KT+diDÕsÚ|£„á;­ŽÜªt7bGk˜"Kõ’‘ªF,m ­Ag!ÝÍyGõ€ÊWW(=TÏù¡z¶ªgŒà‡êy¨ž—U{¨ž‡êù T/©°oS=P#¸™Cï˸iÔI#HCØÞý +4Ôx£ñRc–Æ`ÊD2蔳åÖ |~pô®ò °é)JÓwTù@™VÈB‘ + +íºÁÞe\ò¶[“c;UX¸ $ÓGQ˜žeru4pzuÎó5u0é¬5yž¼24¹ZÍâ7Û<ÍeòJˆÐª>÷`bšÇ1b:²±·±&HW“'ͪüTøoa"*u¼-“ Ä3¯¢Z•Џ‘µªÐÈ6öú“¶6½m-EQŸãP†ß×P·â5TÓXeKáõ¶Ûö¤¦ ÂqâA]s«Õ† +´e†qƒHVÔz«I•;îŒitºÈ28J–‚0<„UÝPºHì¿AgQä¸è‰z×Û}•Q¶ãì-CcºY^·½¤©k)‰®Q=‘F<Û2 WZþ€.öªìy“î ÕmÎMSޝ¹!´¤YâFÒº“&ÓËd¨’D ”&_Ó4@¨$(òGB?‡~BµôGzBÓ °md4iV£>h–S~‰Ä!EJÏ2 ”º)­K÷˜h'¤¿œ;KQ“„2„Æõ +sš¡Î€ÖgMvV?zaˆ“l}Ç\­á™ —²©%&Qˆ30¡ÑW퇶6ëÐøÞuÒ éô-ÃVíÈ>ŠCËAkIDËØ)ØùÞ„šeLÜ2–ë5ìëCÈ£';dÓtà.ÓÎÐà´4,cæÎ+e°ŒEaäwÊüT £ršìš‚,ëD† —»ìYj6Ã1 +$·~¢œPQ±ý¯àM—úIA†&í{9³yaŸÜ&д¦¾ãÓéûƇ€1‡½l<]|l§ÿ³ñ†Pk¼é òÖ‡´5žVg¸¨¶‡¼Ob¼‡–²ÍÓ!›JUüf÷P.¼ ذ’ÚÜTÖì¯Î›@g¬ìùL„ÈgVcR=Wª¦¸Ì R‘ykzûeD s$ò®31à p9Cöꌻß ‡a[G™¹ö´Ùã±t}(s„Ð;^a’Ñ«žÕ§â&#K1l¥·×°óâ•\¦ƒ´¦äú8¹04B—ð>ñjøA9Öž=Ï—¢õLàÍ”/ qº´±Î-7]†òÈöþƒÆ³ûRadéÆÁôûA·&¼ãd¨D­ÆÚôÊIÃ=³ T¯¡ë´^ÖÐEˆ=e›mF ´Óœ(ÓsSææÜ|€–‚ŒööuB­S?)¨Òœ<¶ïåÌæMý}r›@ÓìÓœ§M6t^”™æÀªŒ‹‚Û«JLNÝ1½^§ûNX&è >ƒ~’ƒÍw;œNé˜^ç¯s¸Ûk2húʺGôºd¬~tW“ÅöŠ?¤×dñ[2ö~¯]\m½ãd°«Ã½b«‰î•“;²Þ¾=C9Ñ‘z†e}ÁX€ñ-‚ Ü!ë}Á¾xH¯!ëKæŒßë5t=vÇô¾äx¿ÓÐõdaÀ!†®/…¹öN¯Y×c´­¡ëKI÷·5ëzr.Òk²n5ÆßßÖ¬ëÉåc¶5¹¯‹½ßk{òÇdpò™EÏ;ÚºŽçcz ¥bœ¹ŸÂY×ÄÜ1½†‚5.¾µ­÷t=·Á`»†I£s_ûïö´p+%À¼æ˜.!ÿŽ Sœaëf`(×à¯pýiX¢úÈ&þéôõSµ€ûéôû'ûw~zz>Y ‚* +"ƒ¤ÓùéçÓ_?|õÍ7ß¿þî#øªœ?üåãßž¾=ýáéô_¼,ll0'“]3¥ø—N>ÿçÄïçpü±ÊWsþÿ¾Ýî>Ø/BIg›Gv.‡w†kå<μNju1 ¹±g%¶ÆTÿÇO Ḭ̀Góea“ÝÚÄcÌÅL° ç³ ÛÝþeþ0>r)z¬õƒ¡Ì<òmû_i.õ“‚jÙÊcû^Îl^Øß'· 4íÀí,ƇÚþXÆ,~(c޼µt±¢b¥4Z¯V–G%–@E*Ëø·TÖ8Ø¡ðÙ+ ²0Dî¬,ÿ¹“ãß•œnü]•õ…ŸxDD÷Y*+3Å{Weõ3¯VÖÞ!—P.sÄù‹‰Ú§3>®X¹Î’º87ùiX³Ÿß³—ÓYÌ–â ß-6Z7Íkµ—!šcytƒÅƒ¥â6z³:_¼›Ö„ÿvîÆñ‘ ´#00X=ô˜EãÎG +?¿#?zÖóZ %»=”×ìuPvÑœS½½~Q=ÐG,®NiDð‰¹:5;6†ìNöºu%®¶Ä-?`œƒšnÚv}‹Ayæ´wÆmïx“Êu ºi¡¡.‡î +½ðÞâàÂr­_¨þ:<Ø8êñ]dœ°·!FÇóÝø#Žy–ÖÑ.Že •‹wI§ŸÞcek +ºãÕ#‡nF™ÆÙî™Ø)”üÊ/„þ^t7 +?Y–ȨêÀ¡!0²C+ž‘Kg }«Øvç_ÿõËG–¸ç?œiq°æ+•Ü{½5ä0ú$[ã¯F å)×ÇËZ":ÒBñ—h71(p-‡yˆõ¦ +€ñ~÷ñéÇ“]#/W«ÁŠôôÏÓ‡…¿|ãºp3È›ôë~Œ +L…lï 8%¸“óYš'½7àÄEŽ›9bž6c)0Øs¯WÞ¦(ìp™çN£u7E”‘ç÷S„Xô-t›"_Ö@HQ̘¾Ÿ%E- ?mØ=®Cد@h +f Î-óKäeuóîp éØ¿ö˜&©d„²ê£|/g6oêï«— 2í÷BEÏo"•ãø³'ÒAfG0ýù¨†_o­i ÔÊ…ŒO_®éÏG5ü2æL¨ýò«åù vÚ¨¦Ÿ6›@Z½KözãøÒ|x¾¡ûŽãÁ×È.r_¾áÏÇ4ûzÏ‚Äã%ô‹·üù vÿúòçq¢xïOáò®ˆµ³ÿ·ä §+€HˆNâBˆŽÏÎo־Ď“]Q¼öÎîì›Ù™÷¾ B¯÷{rK³írS:)•϶ʥʙ‡GdŽ8Õjld8övlê¬/ÍHNu=ZË +ÃÃð÷Ø]Ë,¨îã0{:ÚÎÝÏä侕ÈÖb÷$$*Ftýaý¦îíº$ãG4ˆª„ñ 4d}…¤U­¹rH»ÂÕ“ 5nÛ`hí* VQÕáƒÍîE¿f FÛý†AïÍç¦ÍUÂçLÜ‘ŸÉuÙ•'œ2‹†^ùâ9k99C¥Šœ˜L@YÙ“3 ÉHT +X•Î%¡§vIФó"Â!A˜ØO,Ý¥¥«&[¦a°Tí 1 £Kšÿ ¡Ëx·ûbÑhÀÁ|Õk4<÷³½õvËöûcÓ©^ÎwÅ9®’F ûÝ!„ìs`åÀo.WJɱÚ7¾z+,ƒÉ˜.H˜[zÂSŠçòÑ'Ru•|'2·Éä¬FD±Fç–ebE«•¯˜9Iél°3u#p=Ô0¥1 ÿØdr +ì¤`§bÂ`{Ã’9hbSK–e‚MÍñ^ \Á(ŒSæ4ØÞDê©Õhóù`S<¼8/•Ô†tØZ½=R°}”eVNÝEÓçg¦bž µCê$üQ¨m²g#í9GHEÚæ|V !­-P·Ú¤¤ç¥uìiÎöK¡Ç@‘@RbêÅahl®x’°FBûŽÂïCÏü,0B…“hß!2¹¤çGæMs³nœ._rý@–9ƒ¯°r° ˜èzÞÙvý­¹ú{½þÚ¼Z7?A"ÔPÄ6Óü³’‚aL÷{ß~oIEôaût‹~úÃÿW~¯ÛI‹ †6e²#r/âo%¢TãfïÒÒDãzÐÄÙ™…‡.Yí ‡-LŽsI©ÒîlËÍC ¹©„ÖOo63À ïÈV#“é*6•#½;"Aw›B}\,G-‰N\ŒÀ͉ÎMÕä-Ç«–šä4m7¤§¶¢6┿Olr>°ÏSßR èä8$¼Tæ|ì8œ(d !Þ§0ƒða²'%ܲðÜþÒDΞ8[Žã³Æ›(rÔßË÷|³P¿gˆSÄ£».ßõÍRï1ßu¿1«7”iÚ±–ùäöXßEb3:Âí20§ù‘erZ€ë›¥:>gûPì:çâ]ß,Õñæ¾^ ^B¯kÇì‰w•€£’ËÎ%ˆÜÊ+â;ŸôRU( +$ ßÙQª4«Æ€ð!>\Ý]«^j¯~Üúý«}ûÎç°ºöíÕ‹ëë×éŒj [™ôúþÈü›:ÑñêîeÛü`Nù¦ +endstream endobj 11 0 obj <>stream +8;Z]"6-A4A%#'sH%T'AQi*CQ%Jo,=)+KP.F8XeIhmT7Ur./Sm$aIATq@WGuh6jPVI +WdReGLj1jb=8rEj\n4&b3""A^#.hcNrAfHL=YPe#,eM?2lGs%7UG>l0WM:NPd9E&" +$38I$Wf!e?XCaMI$YLcN&g6VDQ9Y,U>X/Nm5@&X`4s23&EZpll!R^A5k)og[`K.*D +4_J=sm('[g8H,n?duYB%Bq072=^(_g^GmE]7h^!T\ou&F!ZWeYX5bf)?TFQt'FhXu +dB'*gKCq#EU5lBXmfKW^eBpKH?W]hGVtW-aO4F?Cll)[D'/#rI\fgW^EnT'tWqCMo +go2X#9tOi)^WP5o")):V0@Y0Flb65i/Y060!1JK=?FB#^QBrkBANVgY:V[+L;-S3X +RhXNUi]"o.dR_K%FEeaN7P,i0_\"WD4?MUP@F'oQQ(B5P>qf_@;NN'TLSM?8%!*[! +8((1"@mWhUP<'0iuhkcP`-S"#WZY@Oe@^93$LXT2l'536K-9+3G"41ifs2X$Kn&`Xts-<=3/:N*W?4CQ8MYEZ/p?3B;EFqr5p% +2dq\8~> +endstream endobj 12 0 obj <> endobj 14 0 obj <> endobj 15 0 obj <>stream +%!PS-Adobe-3.0 +%%Creator: Adobe Illustrator(R) 24.0 +%%AI8_CreatorVersion: 27.5.0 +%%For: (T\772 Nguyn) () +%%Title: (banve.ai) +%%CreationDate: 11/29/2024 4:15 PM +%%Canvassize: 16383 +%%BoundingBox: 156 -677 453 -187 +%%HiResBoundingBox: 156.139119401079 -676.330513890378 452.56206653168 -187.405308756865 +%%DocumentProcessColors: Cyan Magenta Yellow Black +%AI5_FileFormat 14.0 +%AI12_BuildNumber: 695 +%AI3_ColorUsage: Color +%AI7_ImageSettings: 0 +%%CMYKProcessColor: 0.626581192016602 0 1 0 (AutoCAD Color) +%%+ 0.735347509384155 0 1 0 (AutoCAD Color 2) +%%+ 0.749721467494965 0.679194271564484 0.670496642589569 0.901457190513611 (AutoCAD Color 3) +%%+ 0 0.993347048759461 1 0 (AutoCAD Color 5) +%%+ 1 1 1 1 ([Registration]) +%AI3_Cropmarks: -123.30712890625 -718.58270263675 718.58270263675 -123.30712890625 +%AI3_TemplateBox: 298.5 -421.5 298.5 -421.5 +%AI3_TileBox: -98.3622131347502 -726.944915771499 693.637786865249 -114.9449157715 +%AI3_DocumentPreview: None +%AI5_ArtSize: 14400 14400 +%AI5_RulerUnits: 1 +%AI24_LargeCanvasScale: 1 +%AI9_ColorModel: 2 +%AI5_ArtFlags: 0 0 0 1 0 0 1 0 0 +%AI5_TargetResolution: 800 +%AI5_NumLayers: 1 +%AI17_Begin_Content_if_version_gt:24 4 +%AI10_OpenToVie: -73.3034482758603 -151.986206896553 3.02083333333333 0 8066.48275862069 8094.95172413793 1503 1028 18 0 0 96 108 0 0 0 1 1 0 1 1 0 1 +%AI17_Alternate_Content +%AI9_OpenToView: -73.3034482758603 -151.986206896553 3.02083333333333 1503 1028 18 0 0 96 108 0 0 0 1 1 0 1 1 0 1 +%AI17_End_Versioned_Content +%AI5_OpenViewLayers: 7 +%AI17_Begin_Content_if_version_gt:24 4 +%AI17_Alternate_Content +%AI17_End_Versioned_Content +%%PageOrigin:-8 -817 +%AI7_GridSettings: 72 8 72 8 1 0 0.800000011920929 0.800000011920929 0.800000011920929 0.899999976158142 0.899999976158142 0.899999976158142 +%AI9_Flatten: 1 +%AI12_CMSettings: 00.MS +%%EndComments + +endstream endobj 16 0 obj <>stream +%AI24_ZStandard_Data(µ/ýXüÁ 0°Ñ&mk¥qØ…®õ› P2?ö.<ìÛÿ?µ™Ùݽ¹˜”KÊ áOéËU7vÀm +¨  † ÄP"8P$Š’ ….P€B.(.(T° +YX”‹à@‘\ˆ,6 ²(ÁÁïèç¤Yµ’¸¥÷ر¨î¬]îR_yTÄÉs¡Ðàðy @0)EâP$ 2á€A|³!3}ÙP•,¤±¢sΊm³dÁœ=m]ZÃ!"E¢HФÁøC½`(’ãëXd¢ ½¼ƒØÉZ¨H¾©H‰‰C‹Í{œe)EÒØ«RSï÷î{>gƒaq4 |4¨g†"IEò8Ȫ"±R$†"És,R‘<ʱÐ,ÈÃÑ`¬š)HB Wû‘u§f4¦D˜´d´-q×gv§›ýˆxŠäáh0«yФ ãêÁx8Šd5ñI©b)’áH +²H,Eâh0_U$U$fEH#É™AŽcqM<+CèÓIÄDºÒK22CÔS¥²íPÑôâ!o‡Êùô7Tð|([h‘LCU«„„Ze›"¹Ú–Ï«YnÐ⚨H´ò^¶±º¡’¦4©XCÅ…†V5¤‡zW–ÝÒ±òª&Ý<P$ŽÆâ‰&*Üz(’US$xU$?+’S$5S$g»\ÆC‘9×wŠDo­Šä†Ã’¡HE‚©«H¬H +õ EÒpX‘(£ñ 2Ìu¹m7)•ò¾S«òN‘, Émø-ȃ±XEbÈÃÁX|5ÏÊŒÅÉ~5ñ¬ D‘À‚¿6‡ŠõNËnƒ‹´Ç±P$ŠÄŠ„ê¡H¬ñ{ä••ù ãÌkz<É¡HN‘4‹W$»ªsÅ\²( ŒôÙÏTñ¤H¬H‰âY); Y(4R$#I5®HN‘ø ÄÖPKÙ÷:ˆA'=ER†<Š„±xž9_E¢Žt$šÃez4 GcÑXl6P‘\à a< cÁX0ŽŠD! ͤ„$"áãŠdOéæ0FÚAÊQŒ¬«*ª‡^x>—ÉjЂ–’ŽŠ +™‰¦6TÒ¥C¥|I9—ÅVÛ-•{Í5¯rC£¡¢—*GB3³1+Y¬H‰"y4Ë`ã‰!cÁX<iöp4‹¯&òP$ŠäaŽGãÁP$Œd C‘(’øŠd5­¬H¾ŠgV$+’T$ j(CUQñ‰i™ŽÆâš‰V”T$|ࣱÈ+´"QKCÃ2?Ê¡Š¤ î|WDëüP±½B*j‹Jç¬*ë¯i•Í«ªS{cJië¡yñ~¢ +àC‘0ÏC‘•"¢gŠŠä FÃñ€˜ + H‰"Y,‹ÆÂA 3ŠaŒc #ÊXÆ ãÁ€0¨áF5¬q Ür˜ãèH‡:öa\† ªKE²0ÃᕯPÏp")33Ô3u†—?E²h<Rhˆ˜ÇEãºÄÍ3T§¨ºŠd¡‹ÆƒêtwáØî+EâxX‘¸ìЊ©Kdi—Ky¯êu\©”x|}*­„j‰^ͳÍ^U‘Žo‹\èb_4FÃÑx4 HƒvXo,Œ†")„ÉÃÑP$ŒÅW‘hZ™ÈT¤HŒŽ’”–N bPƒô ‘í²ùŒN«×÷ 7ìðÃS¹ª¬®°²´¶^‹R$Œj”£)2[™ÙZšÚÚma k˜Ã1:_Ý^žÞÞoqŒkœã9Bc¡"1›Ëe› ¡9¨A bЂNKJIHGFE&"D‘XëXÇw, ÃÑp4‡Ãñp<ÄAzøáG=êa{ÜøÈG>ô¡}ìã?E²x0ŒGãÑx8Çãy@!ˆ!†¤ 1ÈA‚„$D! +YÈB9dY@¤i@äy@ [ÛZ/-DêІ2t¡×UÕTÔSÓR+)$éÈF2r‘ÏMÍLÌKËJ§"¡„àØ@.𸨘ˆxXh$„Üã×8Æ-î·§—‡wgW磃ØÃÖ0†-ì¶VŠ$ÕÁ`,g,CÉ@Æ1ŒQ 3ˆY<Ž…"i,‹Åâ‹]è"¸¸…-já- ÜñÆ_üßëóø{ݧCö±Žm,cûÝÕÍŽU$g¤H +@Šäб}ä÷P$ö¨‡ô€8‡£á`8Ž;Ö¡Žt ãæ(‡ä€4 G£ÑX4ÞØ†6²kX£nPÂx0ŒƒÁP$P$‰¤H +€…Š"` + L€x8ŠÄC‘X`Dp H(`DpPˆ\KÑP¡rCE‚ÁA±"1€"!R$P$¤HnH‘ìÐF©BE‘@°A(( &4@(& "$Á(T`…È„… (ˆ\`¡¡Â‰ˆEÒððà0!"""aƒ­Ë… + ‘‰ " &$"$"\°±   *X¸ðƒ"¡á Á!!¡¡ĈDD‚"‚A`À0ñÐ ÁBÄC©K¡Bä‚ d!aÓŠD¢ÁˆH"$,`ÈtÙ@DDB₆K—ˆ„† ,0 "‡ `8º8X°y˜ˆ˜À‰°À H2 ÑP!2¡Ab‚!2áÁa¢B„  " ‘‡‡ L`@ÁAB‘L\yÀsyHÀ0qAäáÁሉ 0L€h°p!ƒ ‰H ˆ<\Pá‚  LˆP Ð0A‘Xp°ÃÃCÄ‚ 0D,4X@æ!qáÁ°åÑ A‚C¾D(@8XˆLD\ÐÃM‘T@‘dpa"B…ˆ‡‰ (D,L@D*TˆhL€x8p H(`À1 ¡ " :/:õ¯ÓÎ–Ò ˆ Þe@€p à !A„BÃtà„H„  <2Ñ!™xXDP/¹ä×e‹\ŒÐÅ®æ+5~î´åI5™´…Š-CÌoRå~Œ~PŒrQkïŒlLDTÉ@‚ä+W&(DÐ Â& ""Œj‰È ¨p¡;qá!ÂBÄ + Pix€Tð™Á€G$P¡ Ѱ€W.,L8@<@"òpÁDwLH,"`"¢Â"DÎ~P~…¹¹ª–cÏòŸUÑ¿ûdéƒR6W¥ÍþÁƒŽëœ}E&2¨©  ¦e‘Öâ¬õAÁJú–•l¬ü @°‰† +DH@pˆ +Tà£óŽºGzfÿP±b§éV<ӇʿX—ù£Û»DkÝ}Í¡‚ùûižKU}k'Ô34*p,*.TŠ2Mu{1+‡ +L€Á‡‰‰ + "ˆ B„Bƒ…D° > ‰ˆ.4`ƒÃF„r —‰† +ȃ$F°˜™‰4@¢áá…ˆDHL0¡ÁAb& " ÐðÀ(ˆxxˆL 4L@D(40 @4lÐ(,HDx4ù‚W´]{ÏzôwÊ.J¹™[6-llþ>®)VZ¦Khc%éîËSF´ÃÄ´áÍ6×| ‘¬§W¸{Ò5{ Ÿ¶.¬ÌôsËè£FÜÔçšqÍWÒµ1­Ðº6ÅY²eéÞ®çÏèîtK‹F‹ºWhãßæú¥Fx–K…vµ˜¹ZæÙBºË¥;4Ä’ñ[f¹iÓøÐl•·ƒ†ø“åîýñá uwwóp*sñ¹úkâšâת‹GüÍ’ÒˆYg´èDßU÷ò;¤˜j=\üiPqó…kX4µHI‰k\'¥^qmª©Ä¼åâQ“¼N\L²y"¢¢&îÝ>™Xßuî’uòpÕîgC‰W‰k™4OD#®âæ5§ÏNçyG}TµåVî!îÔ¡-¦U®¯vîPƒ“y)7I?„øÜ££"60“Nq ñæÍÔ숾|V.¢qìð°L™›»6dx¶¨‹s£e.RM­›yšZú’tï’¦Œªw‘®é˜1﹈¥“Fó!Ym7d¼£ª$D"TëjjŽâU—p¯&Î\›Ña]©+W¿8xxUõauq—ÌsIJÍ×G“2ÉðÉÏ=£ZჅˆG²\Z¥©Ã­%Ê-玡׸wŠøË4.Úzt÷¥T¸¸x—„›U5>¢%’–‘!–¢«ò‰NÅ£káÞ–N­u qý»)ÍKŸpo•ÆUŸ.’®mâÔqO ·’>µ˜Š„&ëoëèsÇ=¬Ã½A+Fy¨·µ{‹º²›ûß:kÇŽY3³~ßЬɣ­èýnKïcƒFY2S‡Ê¤>ÎíïÌY. G±ø–¾5ä,jdCZìyùÛµzðh/IëZ¢,§µY-™•{»äš‹úÆ®TÝoì«×h.úm¥vW27Íž²‚5‹4tåLæß¸ë1+Vd][½¼YÃó¬•Üú´rÊÊ•QÑm┽ÊåÚk‹I;t[·³U6w}¶eiº;Z%5IÉöò<¤Yo¬Šíæî*ÕøÐºÞ¬rÍ¥­¥ÕS«×nå55g­ µ–l7³X9ÕJd[šååšµRfsš¥“Vìÿn­î —¦®dékËìÛ:zem†¶%ÔLCúè•ßjišg¯Xíñ:t¥ç•yÚ1–ÛíÖ­ù>®,Y9yåÛ»ÝlaÙüÊ]õn¦Ï1+ÖÕ¶Hq|Y0ϳX|8v‡7•ÅŒGµÝÕ‚¾),–×\ÛÅÅYËb÷œÂrK»:«:£qï켟Òª·¾Ý;š¬,F[sÌ5ÍÓ’>´Å¬èÖmsnY¬EñlUç[0qÏX>S×s +^_wù~Mù£Ø®U™•ªøK«*GË^?C´½†Œå¥pÍh#—¦=@1Sn}öRË‘ÞNü}tMEÚ˺”»ÝÑO¹˜sÔ(‰7橞¾ÆêAŠ„£¸ÞMÖ–\Ä¡¬[ñƒBŧXÇk®Ç¹>zP @³€ÑÐ4ÓÊ+’™.®qLXÒ•z7v.…X¤ºk×IóÚåNYê%Ÿ^¾Jqn.·Dt]<ý¬^±§¡å‹š’­nÞ:F-M]4ýè^ÙsbåMT³ç²'Õ:Ymï»ÒíjÝŽéy]ÊvÏ»Ï+¥yuþ´jŒ.gY_Ý{Ö\¯¬ºŠòë¼Qt±Þ´º¶¸S{ß+Êß¡"m©¦ÚP5UwË5·WNsoÅœU«£®=¾é¬v[ÝUµñ^¹²«Ã¯–Çx„ºK–s¿b´X‹7´L—¢LDݲâÔo3ïxÞPº\×nºY¦ù¯è:Kñ¹êyºìUíéâtxMëx]j-_ºTºS¤öªÉ"¥ñ¯¤*ê• ï¦[ºŸý•MÃ;üÞkh].õY£³£¦Ž¦‹é*–Þ´ˆòf«Ù½Ò]D#,{wwër]ò²nÝ[ý$’-¿y”™o”;M³{^=WjëRáç„厨ð®VŸt•$ósfýaÞÓRÇ®²©?ËU;ûR•4çW‰l±ªù÷]³1U)Ô¹,+]§õæîR{¼Ä%£šM,¸y´÷JÌAª’©øÄµ²šL,ú¥ãnϹŠÒ•JÙýv÷>ÇUe«ÊœKˆŸ=,›˜X÷34Ý%µ\U¹áùnÊ4CBÌZC³Û‘ÎCWÅH³0WÅ­Êm¸˜{7w1·Š>Dk[wC­Éªr»!榳¦ ÚÏÈc²Ì\³ûhaA­+ºëNÖVi®SqPO[k¿³Í]3i¼ëí¶²+ê5§Ìè;ªqlµ¹vÊqÙ´ewùª¢¹Ees…åô,ëN´4ZUJ]Ï%#5–³Û|'Ýš²*Æ"$]£sÊhïí‹X³Ve¼¤6nŠä‚ S<3|񾆼ìË +sñôÆ P~k>Én®.ÿÚY}6|íÞດÒ-7«tög×å¸d•«„4xXö6D£¢å’ ÄŸáΩZ£Xå\ºäÖÚåêmæE<•?§..Z¼\\¤IâëZÃ/^§Ö%ý!S]—MÓÒÜËÛ`e ”Ž(Dp Hà€‘‡ +"P€pÈ€„F„,( †â „²DD„ÄG¤ô|U¦Íêž“¦­g¯Á¥ÙÙ6ª©Ú.õ÷êËÁtÖ ¦&éuÌjŽiSyJ9Ϭßg¯kÓ±L¯òÞdÛáX¯vƒW3UÒimªÖoíîî¥ùWÒù +éU¥ù²kuó¸´ƒeÓSË/â]ÒÙV<çÓ|Jgyçgâ¥å=uñê­ü¡õôç=Ã$¤2£Tôu3÷™ëUÌ´íåXúVõ*¿çïÑ*žó…6“Öúv÷­TT¬LMÓ!9IoNeï›Öè32ÄõÝz?•¡Ý ǪÒgu.5ß­TwÌÊ6©îUeóª¤Å´»Ui½îwÓd•öênþ-™úÈʰn´Ê¾´»SÕÉz§JDÓ©ák]¨N5¥“P»NT»W‹ðFt”uvHF|g¡ª•vº9¤Î­#»ý:KÛ馞î‰'5¾ÖµwøµgÄ«š¯›Ÿ§ohÊ+º ëL7ªêÛ½ÂûlGë5TµáýNuï^sǨìuJw®ô¼“ëкw=ÑÑaÞÉ•c×Ýu2R{Ýì•1K§®ê–Y¹wYmUÕé^•½,±Ô¾WOjW^_ýW5¥>+[;Úæ2ç –v¤ô&ÝjÖ½7˜ÞÂ3-:çIW§Ð?¤"»ÃŸÓªšN½ÔÄ[½æBÄÛ&Mªí:{W°Í¾©öžU®B½Êßü><ÞxM4¨ÎÊL¼Õvéěީ¯ÿáªÕx½‰ÊV§*U#}“TYÏÒûªo¥‹zW*ÿÊ™öE—“Êi.tžñž[Iõ½û]Õ¥"ÞÑ……t»WUÞ¥UV[•÷òÖ$•>-÷nT…eC3/áÝ/=üýÞ“ég*›úpï¥Ï1*Û®ô¾Tª{‹ç*ûNÕTmºT´»]ÛÃ$¼:§–¥êÝëJ3þkS†X¦ZI©VX^ÛwÕÊúp+õ4û+4‘¥^Ú®óú 8íp³¾¥VÂ%wóŒ>­Êßéîõ5VKï5OiX¾54˲Ëg§,ÛóžÝh4‹õ¼[Ú±ªŒ>;UæP–Ö–a–ViYâ}öʽ¡¬_‘ÑžXF%µ_!ÖÝoµ'g¯ ¯ÖŽ^^ùl]wú×ÕÜ•én¥Vû^ý©¾Ñ•÷hUj‡tG+´úñvY¡i­î«K³U.±ˆ0!2ÑÉ â€"hœ~qiL/ýYÒ(ÙÞ}çô%½7-Ïú²åí˜ÿEë—ò¦ŒéóœëLµH­Jz´I¿ ×Þêqnš†{µKµÂ[¼U×Nž/¦:WóŒºÆ%Zœ\33ãRþfWÉN„H¸NÊ;!Õ®ÚÉloŸy£çyw,H¤še¿<Òó«‡SfD¶Gi¿ï>écå½Õ¿,MÓ;7%çYíÞ¢±¨¡}Œör&žŽeÿV~žTiªüMÙ­3o•|c§ 7 Ï\ÖU«Hi—öÚ9?(&¢oþÎoV""]e^§Êˆ +ªÖÞt#ݹD-hK?£á‘éƒbÅ©ôÜ#>(›ö«ªm’gëA©ŸÛD|ð§U£˜Ù§I¨•j¶DåK¢á}UQoÕ¢˦õê™f‹eªvÕ¼É+#ùv5Ò˜Î÷Ò¤_ÔÒò¾2qˆ£‰¥h·ng{Ѝˆk¯´»*÷f‹ÒSWÅ’h}åíxú»E5#Z;+L´žéÎhä;•o̪œ¦á⒙ݡï—7ë­ÆÕÌOî½÷Üê¾~Ý ñèÕ~QÕ¦é©h”wßÙ]ow¬ª(™Rq7ÇKúudÛÜ¥üÐUÀ]¢Ë-z@jɈ S‹î/µhç/}€•—vcfK˜Sÿæš»:ÉôIDvj*Zˆóë~ðy¬:½eÑL«™ÞK7H{ãZ¯V7¶™Uééü9•–•^8'ÄÅ´þ¾žr);Ë:f<›’ÞŽ;èE­²þð;f G†ˆTôEÄӵ݊†{EÃ]ųÅCT4Ò3\LEÝÂEºM-ž¶¨p)OmѶpjÑø|aíÚ]ˆk½swtÑŠwñ{Ý©¼"Ë'"!šZ–i÷vŸº™j´ß;4µÄ¼]Ѥ¹èm¥éüK˜k.{¾<^êØÐÊŠùÓÒAÃÓ[µÛ|Y.m>+k/µ\¶Ð§·‹DvæÔ<Õ•kó’ì%E=½Ö&–˪Íòv)Ë­šëM§NRÖÓårG¿²)Y7oå’‰—ªzÒòVV@JÌšµ,ó¨ý±þc$Ð}ÒrÌgB£êÔïÖ–N÷Önö·dº¶·)ÂÂܲnÚ8'D¥}®3mиëëÚ±VQ=ôtÙi‹6¶d;³=¦ [ûík¨£Vd»cUÞ騦ì}ï¨YST¸Ey›QÕg6z—:õêý.q’ê´nwWÝ­ñž¶Ô;•ñäôØ­¤§U +÷©š¾Dk]™tÂ/šÍÝš¸ø»nÁ+áÑäÑsÍJ‘õ.Û»aâ•âó;Ë{G*¥Û«Ò»ÉŸ%´}îœJÞÏÖ ªÔË»]LO†Ÿ¢ÊÓ)ÍoÜzþ~ÿÖtýnªDÂïfÞåhè.:*<îí|­þ©ð_ç]˜E†¯»®oo…Ï­›]Ûþ…ODš\WÞ’r®F+âQwµáq] + Ëð¨HƒkR4ħúHÏ?üªšâÍLgSUòy·“h¼Ýãí¬¼ž÷ŽßUÒÙNÞb•âËeót–Ñ&žîR—ÓÙÎzÕ˜yºá” ž×B9h,]W½9?[ÞñfëUj¥²¦Yßz™nÚîäü¡÷–?Sæíßœí1-…;vv:ó‡_µÝÅ +U¿óÎÞº».¼Öä]Ž»g|Ýþ!þp=©>é`º8gDÓüLÆ:>lœ.•ÇES[É𘩃k¼ŸÚÕK³hÓ.¶M·|åsê\¬6ù­ú˜}Pó‰–³uµ¥™§$[9×åå×òsóÓG„“¥eÍ´I°’ý¾¥¹ˆ“÷­±÷Ý–®vÉJw™ùªRÍ´MÑf¿?>•ˆ¾w8x¢ç!M]5_ô[¤=•Ö©ªi‘Œn»¥¦H/ÅÝR¤›.™ÌD·ŸÑÍüoÓì[uìu;¯T¥Z4;›‘•V¦]iÏ«£™zÊv~ÚS[Xµ:J©Å›Y§5tÚ6NiÎôý£½¦‡L/}3ÚÂTóÙÎÖ|ªº®dô÷ŽŒ‡›O3Òלּ[¡Ë° +O›i{S£Ióä§ùŒò˜§;%<2ßY¹ò•®–O3½\ÍC“_…9ˆf›”®µ1Ú2ùNÅ\*§çÌ—tg6¡3͒ȯݟ%&~ÐÌK–¦•º6Sº³ÖÔ‹ôZ,¤Ÿž¿Tki~–u<›jyÓt6ZíÒ‡z_m5Z/QZ¦iºOwžR;_ÖÙIÖËo"™*ªkM†tjKªÖøÿüÎ×2ÑÈk/º­)]·èÖ*õed¸Xj·iô\ÓŲ£«UгI=D§åf™d›ù뺫ýàMËÞ¿¶_¶–fyù®äò’mÎÆ%óœIÇ*¥2ÏÝ´Ô™Ñæ¾´’\/T+;,Ò:R$—ÛÓ’Ý3«ñi&R²¡]ZÕ™³N>îq +íÈt{ÏÊ®WÎ3½ÙNYÏTéTon†s3§Ÿ”x¼×6h³»È†TéSÙ/ÍÒTj-K£zºjÐf²]ÌuÛ|"ª´Ýݦ_v‰vç5³5–Ïl´_úvJôñHsfvö m­”lh˜”v†j§—šÎb‘Ñ–¾vÓìü*]Ó’nk¸ŠštÜÓ<-›tC«¥á*Ò½¸jW£"¼4¦ª–4U¨_5â Ý~‹ŽèLÏÛàÍWÎ_o¶î—èˆNæÏÝÌ.2ßYô,ãàšéºf.Z³3•Ñmͦæ5ýw­‚åM½ßº7©ò¶Žµ“`¹Æz¾¦^Ú( t]]TÚ¹î]ÔÃBÚ5ºO©„ĵÝãÕX]Ó»Tj³yl¯>zš¡ùÐÈkVG§+ÍG£j5§F{ôº·‚c4h¤Ê;ü¥¥êª­Íí=}ÚµÞÙóñÒîvOón¼Õ==÷œKzÝ-õ¤žš¢+ów +Ï¿wo—ZUõͺ[;w}¸{T8†‡WgfwK¹5‰‡µk«ËÃÛUÛij¼T¬ÝË+*ͳŸz7ï4›‡¦yíšyW÷zÞµ^ÙM5OåÕí.ÞíËfñÔ‹xCy´‡W”Ò˜û»»DšßYZeîì]±Mz!~ÍgÍ¥+ù£ÿ—R‘.æk¿ZÇ):ýêi®¿uµëDùì3î×l:¦Û=$²ßz¿´FctëÒ>T§v»Šˆ»†§x¾ÛÕ_Þ Þ–)wU]c<ÓeÖí;Wwk3~‰Êƒ>Óš¥SûVúcvxÔÝ»óW‰¾TåA»Óq³F]Þ¯ÑMÒü¢â7ÕrÊ·‰»ãº<£Ó'ÝÞÒ6_Ä,ú&®÷E¿5Õ,ÝÑí—ôÊ©·_ÓÙ«\…e¢ÛZ¦ÿµ&Ýê9¸&º}×T¤kVÿŽÛ0íþ(ÕŠžOÚ4ÔJ:R¥/Õ%ËnHmÕTéf£§‘ͦ½îµtLÓXÚöÕÚ¡!e‘of5ˆF”¤¦Aã +ÏŽõ"¥­[D̹«úˆÌn³]ý®èhHvDýœÖëªûÚü¢eedëÿþÚ:iÓôë{ó2š×JOÍÖ‰hUdÇÛªiêÚÖÕ7íöåé®þª¯.Ùê™Çñ+)óY¿+­u]OitqsjÉŽv›Ôªã^ë¦Iƒ{d¦X7ÜõêU¹£¯úS¯¾Zg£¯¼Â:ÙüZýHkLVÔÖ«úéw’¬êª”¬JÉÊÖuõ—QÚ¹NøÙ +ñ´êgï ™%gÉ\WïÙlï“ÍF}º9.S²-×‘Ìø½!ù~Þ4×¹KêÓ.¯d¨«x>ÞÛÜ^—¾¼ÍÔ_³_æÙeéü®î]ö:Ñze6ô¡ïe§[”Š^»+‰yD§Ÿ•¾ÓDˆÇ“ËC飜Dcªš|^ïF#¯×1¢bbél–V8Ú¨"©WÏ«µZ6z^;Wå}®à£ÐP»Õ~òêv_å׈î‡h£V®!+›Ý¯ÊìîTõÃC×ÀcÝ^/L»±4ØgUƒ®ŽªôJO›_åúrwœuuV·vc•¯NW¤YyÇ+riÐ8-N@Â$Ðíø4°çГ ›Ò¥³1[yì+ŽRÖÜç”ɨ”lïÕÞ\Þ~o0q qNóô£Js¹¾9­¬±jís2mÛ¹,û8GmïŠ|“hZõ/yèç5SS#û_»Öà‹Æî¼•ôhãWŸ¿dù¼¦k¨¼—gHjÌ%t97¯œ×[´%7­òIKú£ÄA#éYfŸrÞjWÝaÖ&–Ê'•ËTzz¢ਔq¨SrÇ1¥”AŠA‘  € ( Ärñlë>uV4V:$‰D‚áÉu”"QB 333äB`åÖµ2: ¶ˆ«D,ð¦/§\b öXþ#ýy¤jla¤Œ“¶ÁTââG¸ˆÒEpôƒ;‘{>žI¾7Їj‚ Z ‰[ƒ¾ñe +Êþ& ÁE¾ž,¸¯[4ŒENb·ÿpû´¨ýýmq 4e†oÓï¼ÅÚ€Ãò[Ô 9¹„<„o‡XྭPìØ•àAðmʶ^Èj-Ú~ÕȳeµBȵòMpM6Cêµ`£À/JŸŠ/šß¸;ªžâé3óò}2ZÌw±º%þýWÀ0êÙÌt9Ü-™y{&…z¡wæE€YÄ ††—þ/&îKk’V÷ø·}ˆ°ñhs~0Qp‰]{ `SÓ¼d‡ËϲHBhƒ_?…‚Œ©Ú™çÄ\±‘Æǰ°pæ„'à@/U‚%ŸaŸÓê™­ÐÇñÍô8è:_Þ<+û +4¯ŽçRK©‹Ö•ŽÔG£q~?eX°¼·wعWÛpRX+ k]Ø øž)*!àÁ\ɨ·Á îÿºÖ¸ ±§ŠžjªôaŒ+†“Fò•nkcT¿´PlÏVÍG‹Ä¢Úta‰ÎPa[ª¡G­sWão·Š)²Þƒ…DN°†úpdÐZ&ÆSdkì´‹O•¬ŽyãEîI5Í}~)*ÕኀKENçþHÁÞæì$Àd–.òº®Ú}6„UÈ zº9«}Í‚¿öY²I½ÄÝOZ¾Ï¯[ ¥ÄubÝà(“€"èKÚðå6Q²Œ/i[T>–`ïèh‹ )gÒÃeo™sc»8 ðÀIêGŽèt~6œ´Š›3;®-•Ã,á¤SD’=ÇŠVõ|jú‘¨IBPl5㨜€àËöù1òjÿÜ:”d¯¬#®ôá¤&«(‡ëpÒ~CzœIW°M8‘–™Ò) Ô,9ë’N_ÀchfRLBÔ«Kz("Ôn¿s#èfª ?%ÅuÝ´÷I¤²à³sûÀ*ûø²Aû÷m¾rEÙ¤E8ù1ÝT@Š:§P°l¡Œ|kqö•W×]íIoF +îý×z/´y9‘[²¤ÙGïhÆf®×ª3ªäSeIj&µœXÙ›œ ˜TŸiLûˆYd킎0óŽò’ #rc´°Ñfd¾L†˜/ë¨÷0ªôÍø.j|í¤gz'¨Ã…cÛ ';ΆÉELÔl']:@Û ]ØNjçÓ‡½µÐbÁPçFîvÒ!ÓÑEšhc5"ëàN~[aÝqaT¹ÍTÜIîåµÞ ͦèþºªwÒäëNgÎæŸ£³vFÚ¹^éØÁ“£d‰oExB2cí‚ðdìG7á q HÚmÆÁ+öN: +OºFA× OúÜ âOømÙê‚+òx¢ßNàeŽ'ôtµ•x—'‚R?`cžÔ€Õk‰×†󈦛RÃ6?9JH¾‘ޝžb–LqžÊ’ƒôÑ &v@ìºFIz÷òžŽ¦}Œ‰9á•,_ˆ:êè§ÍA+6ê×IÇ3*éËt‰”éÊqyGÃ;7¿ÂÉð$'zö@aö ÖÝÌ“¼o“l£˜väl°uÍÑ"ÃXë3×”mŒb.`)D¸ëRBC#öt,4å}å«5Ê9ìÆG­8üšoÓ*F=|ÂíË—mѶ"RV©¤¦¥­oÝÎ’Œ¢5P‚ªE-ub´‹ ‰YˆQÒŠ i”C@\öô–èÎØœWEäQÙBma úäØZ‚ZéÕݸÀQʽ'åSå@´—ô›ùBcò‘ÕJSO­˜n"ÛD_J0 ¨>2ì»'؇Iµ¬ªaIæz½°[©[i +­™ÙÈ8UÓϳsK³t1$‚ öPodf/¤L®Œ¡/3:u‘c‘¡£NÍŒ>^ºŽ¸F2º»}(`žç¯F7H…äBå­y…@uPL_ŠÀ?’X "Vz Bøs Øá¸áÞÊ@jè$«€màÑ"<첓¤ñLªp‡q ¿©»ýÿ ¨¾hû}y¶ýð C !ùO*nŸ²ŒéŠ2¿Ÿ¼Ä0ZfàY£h¨p¢¼BlÝ04h¨Y÷ \‡ÙgÙ 4|–ÉÕŸÜG›}¢4…›mOîðM*yâynCÜI×j3‡Mõ,k(b”nГ ^¿›:š:hHbcàìiÀÍ]îˆo OÞCŽ•ns.ð†µ_[ +"ÿljôóýØVëm lr²;À[GLWéØvS݆4*–#ä¿(?†I¤ l×Uu•ÃÙ +|zb0REг{›£M(ÕSÍ¢)m¯Ìü28ÙûÐ$Œ6L+6’+X¼h[ž4å†ÝAdÂt³‡ +Ö£±:€Ñ_qêü, Æ—6$>ÔÈ£n9 ÂE —OÃÃâoNEð¸m\‡°Ö´`«u´:Ïs¾™¥ËW¨«ïòâÉZ5‡ÕHk`’!½·`3Í£dj`õ²DA]Õ\àšföŽxQØH@. ¦{‹Æ<£¿o©£Vj³(UOtôÈ¿­"zºÅÐi À²œ¾Ï€I仢‘ë’rDÙ8Í´ ì¥^€ðÑøçü8V¸»* +Ji‹n`À︲ˆ+ÎB§‡œ¬¶Ft)©ûïÊ+ºBq/O*dh|]wE7ÞÓ?ÿ®¨¾>ï´AåY®ï5F|E+' fmšïÅM‚ÖòÀMêQ8¼)¡E]löT´þз-š[“*Qƒið;Á±ØþTtWH›0)û튒RÅ^lTìí0DÕ¾v\3|$´’1z´[Q†Ù#îü­uƒŽìF·"ÖÍœhO!4YmVZÆŒØùíæ•¨±åíIÊ]pȧqäò:¨p†-‹ÖD™ÓàÓSŸ”6ºÚéæÌ­Eó—hH§XTqYŒ®¬lû3T¢‹Ecãö;û?l²¢ùwçÉ´Oy…£ÍµãÙ6tÍ!ÈGÒ¼Äp+‘”ùwf!}Ž—/CÜšðWØè'm‹vvš±o@ÔÍ`ÛPžøú,]6av5S½o,j†žO„ ÚOµg%¾K~hik¯f;Uþc‘9 øË² Öðs¥VAèeB妌—§}ö+5Ý®«P[2ÑìáŽ,½ÊDÕÛµìIÏAÈDÜ|½–uä§‘•œ’Dx'ê¾éBLVÍt£7%Êjèxø”¨¯—d[JÔ©.HsË ÞžìLJ”½V eP?“/þ9]|bÞzˆi%!xôt³‰ªG{ª¦3S<¢ÎÜ£6ΙTëñïäãt™Þl2·hC¤:!¤ŽGtØÍ(ÎmfaÅ)#eÆ +³hZ¾”i(?:dSÇ1VÆ—LF E[¢Ì„C–,"W⬾*¨’@ÆK])D× †²\RuÂÖú™¤3ZüŠM² +Š$ _F¢&WÛ"’ãXÑIH”UeIæOÙ@(ê0µiyf¤4׈úwP:eºAQ¹žC#ã69.(Ò™©n0òB/±â"jV©™€>MæBЂq>‘sQX"¢gô)TÅòÍ¡ãCŠàs8†ZVÃ9$€6Ñß~,ií»L6ÄLˆ:èzaD÷Â~†ñ:õüŒ…ç§/þµHÌËg¿Z…ö ¶fYŸñ$M}Æ€3bû ˜LFo¿¨-F'>C/||„ó"wÏHáòmÏÜOæY4ÂÀ¯àÖ3 W™Æ^¨oÊ%êEš(ô O,˜Cf‚Zž±ÌJ\És¯"ñgn˜\Ýå"šðLøƒ]ßÿh­[ýQ»séÚÿ[ºM®ü±¡[ î‡tnÛÓK²sU¾Ÿr *ü~Èm×îzëÜ g¯„¸UNuþăÓñÐÿ¶¡1w¯·Å}| :Ü‹ÜV3þðÎY ÕÿMÛ$Zú•íô>~lkàH¨œN6¬õÇçü©mF1¨U»+/TºóÑæ”1HœØ„ˆšgç†uYÎ~`tÍ,.óqH ù ™ÐÉ|Ì›©µ#PÊî:¢+ùuÌ"ÕÒæí]»GÜ ›nE°ßfØ`«; E‰5³Ì§þÅ/¤ÃTt> ·ÂøÂDÇ>xÅÌÛ®™M,‰Ö±RM°i<Ãf&-_¼™¬)Võrg˘.i0Ò`¶¶fý¶PdÍb–«¢Š®B˜v8 ¥ƒ\KŽ +Ç!I­RsÞLü£mµ Á£½ÒÛiܦ™#çËÞ´^â\ñ³Jt¨M˜‡_&iÒ ÙÃåEÙh]¼ô„%áËã6-[KvRB£N—{®®]¾#>ÉŒ°gj&VîN·3[6È™zG•ï,P´¶.Í*G/“™‘ÇWòfÎŒ’s)¦`ú• +±ƒRoý¨ŽŽz©þ™/ +ÏûÎØ}µØˆ$Ó_¤;µŸD¦7Ù {¶V¨O$&Ñ6&K½8à"æ$6ÅÝšˆýÙ Y™Šyýil=%fÈ»ƒwg1%7±8^J•Ã,ÄÅÒ’k¥šYkŸ€au+pÒàIQ‡Ói<´ÚJÌ^J’ é½\^X‘¸ +³ ˜C•µ´"æ%4Í6 £‰ŠHÏTê3hTR õ‹fëŵÍ–YËÔž—¬ ˇí/ µ‹——4d¤ IÜú©UX]ÒîƒØ‰ƒ,¶œþmÔ®ž«KGEsé ôÛMF.árÕ/òÏüÕ,çKÕëËß²Xê#A(]:|…P–âLAÈ7m±-c½ØÒòH*¹#k™a¡–ÄŽ¶„Û›é×u´”y>Ë¿féôÆäÄ%› +–eË ŽÀê²?oäÙZˆÕXÄòÇjÓ¼GÚ$LXú5u6mÖHvÚÎ ÙÙØ—ö…—ª95_)¤úJë!/ç3Jð–GR‡¿Œƒ’½7ÉL$¡ ®4½H•†úÑ8ZvÓ¥1Ãô£Ëv¢ M¶›ô£$¥±’DÆÕv)dè]èGõU7ç]?Zø¹%‘s&´ 1RgB •¿+„“‘K‚káC ¹uDˆA }È.r½¡ÒXNÞ3ݰ+¤p<~ûZH[7 yÔe§Sàñ3õVHU"W2¾ +)Eù”WHS !§¢(¤ìÑßtãÈà3Hùí/| RËÚF‚3H­*ZˆÀÜK©ˆ@êzBþ†Òí±œþnƒtx/¢I M9î~–!j­BðF ñÈMš5î∣ð:}Füí_ÓøËMØ¢u]þ¨ã–¿h•>R¨­7½,ŒvfJŒ»;÷Åò E B½O3¶lÚ:ŸR/÷±pÝ›cüÀßXŒº4½:뺨hŒY% “ú…&uÎÂf6‹…Y¸1µY8VV%É´KN!ÞËÂèi>­6–”_Æ@aOÞôŒb0êѰ6<áZ'|u§uU“s¢NX 0uÂ[Ê!ás›£y~>o'ŒXŒ†Z«ÞgÝ},óÂ@”0º^̵ -C|'|‡IDH0ªplŠ‹¦P\¿Ÿ »'aÚY.áî™8OÂh>ÈÈ$̢׋ñ¶¶ÂN]0FàÇ3Œróû€ —ªmzSoKЉIôƧÒÉÓ(T*n±ÕŒ‘Ô îîÈßÄÇ’Ø -°ogž ²Å>ÎÝTŠGiÊ$NÙ’»O +ö£=^85òú%Œ&…gû<¤9 +Žß8×ùß3X€6È–ðpA‡"؇-è^l !cs]Eç=d¼Ê “CFÀÖKݶ_iIM]×Iö´SÁɽáOÕœËÚ;-6U¨Þ&Ý™î?&q¨ÁE…´ñ8ûu £¦º¯/€wäÂ5Ý‚Ü:$œo¹ÏÜ5ewÆUq&ÙaÊf O<&’û(âr›Š±M!QFÛa-Ð|+öc­ámÍ€áÞ|i8§!YJ^KÜø%žÔ÷K7¼§&Mû +ù7½el…œòm’8Bþ+>?Ø¢¸~èi§­½À¯'pÜûfŒµ¥#Heßã·4Ñl‡qŒ×O“‰ ¦ÃÀÙê-¨¡Рr.·K"™‘^WT´yì^Ôôßñw\VTò=AÖzŽK‹uq¨Iè›Á]:Q +ö©ƒàB·¯¤kÔå©U›p‰²vgu\P!T"B5}‹Úx FnHDÝúÚÐÍEúr’­·Ôù !ûE^'£­à·6oð²çØànÃDR»ºýiÄœQ|Q2Žº( ;E&ÄpÚá( +œ–¢/99ž†®"NZûQ¥èÜ1Rñ£®gkB€ÖéÕ„t÷˜¿ÜÃ=;pýaâ9©ÖX¦líxTmeÒpI{]S÷"<Ç'¢Ëωñ=R‡`͙̂=©àÇI¾w0_ÝÍV8v%f+Le|SP&3â´h‘v"§eJ,p¢¦ø [ 4h2ýô;•oaѵǙRÄ”ÍUdù‹h¾P4Ûxæ.e—•¯SÓ C §(ÌaÀ©0¸öÓ¯F +ˆåþðX$[,Ù§Ènã*g½½Y°žÚºa?à´–Ëz–Lk;逽˜)ôTX"“’¶“3@ÒØŒ8ewÎËø“«ÚxAu-|kõ›¬&a¡úURœÊïWuµøSqjº^¤,¨$ÆEiE7ää !NËÔ±û@_%¤ªÃÁÏQ¦~Æü5ÿeå eå¦ rb(tï‡ÿI.qyAÈžb¨JÖUFQÄé” +Xk“p aniÚaoe² +áZcÐ xÉ CÜlŠV®PZ¸Àƒ/3œ g·f&£Þœ‹Ã'øÃíÖEr™ æ6ø+U|àÆBÏõ´N m™Ä}¬ Eñ7Ñ퀺Ñ6¼}p¨pÕ¶Áh´~vása°;!‘Xû€=¡ôˆAÿ;‘( +@µNÀ:Ž ðeШÜWÄŸOâ’ ÙíXɃÜBÝݹ…uÃF@Í9Àô3N•y¤ÎçêtÛAÛ•²ÿ´lM«•ØnºFSÚ*fg Cvù»>ú²ž©&¦'•`fšÞ[ëÔ­“;ºkiFéŒ5¯‡¥¶~CÂ7UÕ3Œ5%ž¼~E'fˆOy“MC¾ŒsÉõ–¹Nn¬.>~[OxèŶ›qùN ¸;C­‰) Jq¨q› Ôkµíoɹ†wʾ´gÑ̤¬èe¾£¿ÖúÕͺU Ü”¾óSäús¡—.Ã=] x~Žh䜓PŠæÍ!ó\aMƒæ`‚3Çfc²×L#00›0•±€måq£\-SæŠåOšsäóKf$NHjg‡ò2 3Jóã~+îÄX'3yp\/ˆë¡Ñý ãáÖ“9¡¼).|ÁL´¿BÄËXЇTï;Î øžPÁð'äÕB¡“ØÕáy¢‹w¤vîWœàä3¡›ÃÖÌž¬´Ÿþ£`òãÍ´Ÿ¦»Û>8íRv¾ÿØJà÷ü/¬èëžêéyT*ú%ƨ¦½x’;!…½mD³z·-Î…egV“BnÜ +‡wÖz÷<Ê +èÍ‘}¸%åNÅCIÕªš¢„P?«=BGÓ|VFÕD»§§Ÿ-'aüfïì°o—ù°BkÉŽlƒ¡Žfðô,6ÊÿrÍþ‚Ù¾ÿ~Íšºúz›¼®»²øË©ær†,ÑnK´Ék¥§9„¡•Ü#ÊrÀð°(ßëü¼J n€Zå™ ±«üjA¸©èï©8 JÀhšÊ›&å£rE J]…Š‚Ç>ëSº%øÕÉSDã•ø|ŒÐ$z3{í½!KMëQšÉ4 IêÌãÖ µ×Ó£9š\+Ku¨Î›5&"F!u¡T†zN„„×IlZT™€R r±ŸG¦-2é𡵞~al)dzäÈbÇFb¬eWH<ª™%ç"k<»*ƒpþ;ü•èÆÃÒ˜Ù5`i`Tãå°¿Ÿ²_òÎ H—…¯¦é}f!G3Ë +k–øf5d5ÃUŒg×àíƒxÖŒ¶·¶LTÂÀ.¡ ñ— ÇÂÝ(mX©EK^e‘¥]ö˜ AHÚfaooy˜ÚZUµ„N¯VÇ7 É[ËHQàxûm/æv>ñQ`oâ¶—]æ×®‹[³]·gB†Âijy74Ǥ{ KŒ’œqm›*Ö·ì£]ëw6^¾d¾·Õ註Fxëôß ß¶¡ƒ°ÔŒ–£ï»’ˆäÛ²+@ïpŒÂ5—¦ÂPΦ³MC7\Éá+]À" ë•î »Q§ˆ†VºÃ'€[®.¹ey<(Zô6!ƒ¬²*ÖFâ3H1+­úî ÈgÙ“ú/И­t1o$«Õ²‘a¬KœÿjêTú›°Â– óä¼¹oŠ0ƒ û ¯¨¼›¥ûæºxö|½T«|UŒö$«ÌjU”2Ü]e|¢?ÎM™zu:`¨~ó/o6ëIõê|…ªj†­ CHf®aÂ%©™{¥ÕGLµ{ePiy}«H +Ê~çJ(Pj¹ ¿žûˆׯo0öŽhË¥©Îb¡Wð@×¹²õçBo tC$±T¬ó@ ú9Ÿ±ôê…‹àx“(|®\ºæ=ÊD± M«@cžNœeTG—Ap®0¬Ī•S^I•^¼4]~-NÜÄ>Ys9 kD]H£ÒO&ÁC©Þ&òº³Iu?Œqæ¾ðLGGÍ^tfß™[¡}úfRA{ä¿É³Ž<{JA·QÜ3·¦q‘å‚A.ž+÷Û¹½´~‹¤:wsë +Å$1¡8Ò¼%áuM«Õ„¨é"UÃïp¸©ÁýAçê|#êèI +Ÿ>OsÍ1)ZÆq§¹Qð ()j 6Æk„g¡Ðó{l-óŸ a7©¹:3¿æ‘r~Ç÷Ô0ç”7û¨ç;Î¥+!Ó|g:˜)ˈ;ù«/•Õt®QÙ*ØÞt®å-òUôÄJÜyWDPàØ!A–Π®N[j˜¾É±$'íA—|P^Æ\I ‡ÚaU˜;àçh‹$G‰~¥Xkn†èûí³S¸}"ªL¿Q;iz7'!rRŸª5·èpyÙZsÓ¯kh©Øó¦s5qug:×⎑eîÒѹK¸d%Céÿl°¿J4UÎEgï ­|zz‹û%Øm¥Èwàèšå•Ñdäv}e“ã ê‡ ‡9ÅO—gy,סõãôŒÿËEåØN +Ý(VØ»Ih³t³@]?ãb×,Ó:\aÙ̲FfW‡f9~+.³lGs!º4Ë/#¶ÊôfÉšh½YÎ#Ú°ˆ>fæs³YŸ=—‡±‹W³üdªRf¹Ÿ5pŽYÞYãFóY:²{k<4´tË~‰-ƒ§Ú]»q-wT‘÷Òü@Ëw¼a²isÁ5XŒ,Ý}LÙ‚e—‚w1|˜ðl¡B%ö¯gz¡RÁ•Þj¶v›ð*z`¹Îmd¬è„#TÐÿ^Ø£ð"Ž¿‹…·Ã‰—£Ï&‚ /D§2)Q¼à…°lüô’¡Ž·éSè€Âðˆ®]æï[]-†iã`éxñ(Ç;sViçxEÉsáx£æˆ¦¯øÙV¦¥ ¨çxéç¿b'Ç«\‰@âÆ+  èÆKQBÒy9U{wDÈÆÛƒB­~Ýx±lVÎÛxeÉ÷™ÞÓx‰è^HOã=Bsš_ä)à§﹟ó€}FãMåA¹/ÛñößiëE{õ¶‘Ãx÷þ毚+Œòðj‰«=ÈNq°Ð1ì:2"À€®e„‘£VÏàk“ecCSùùÌF´Ä…&Œ¯YÆÌlE¤j„‘ˆzgïÊ_˜F¸ËEÒá› +061®¶Óƒ|$cÀè‡0Ó3¾8d8AT­|QùÑš:ã°øâN:ê"â‹£P }1„7` ø_¾˜6 K!Q€Qoú„ÇJòWbäà‰Qv-1ʔУ'c߸S—ÓCÎäL™°Äh§*$yi‰QžÒm‰QŽ,¦é$å‘uI/ã}þSVn¼Uãe[Œ¨Ý7¾Öžb€æÑÆÖÏ1Iµ‚ŠBÏÊxin bdÊq€"属G4µ¦î⦬; ‹èÀ8²”óÛ BÛ~&‡nIå(Þ:€)I·0\êå:Ê ö‹…¡W°þÂ|¾+f1µª“Ô•ÏK?ƒ8¶Ù•ŽdÛãD Áq©TÉÈB-éÚö‰‡>7±%fê,ñôWÓD¶˜îò<áGÂ;ar' ˆ=ø‚¾9˜¶Ï4±Àê<%­¢æ"íÇӥücÕ d5uÕsQ4A¿ N…^Ÿf­Z¿ +x3Ä"rŒáÂG°W›­S“`«U‘U lи„hêüå=£ +$«ÉóÝ ‡ƒY«³¸ +ã©K&¿²BO!ï8)KìÑ>~—‡û…š9}ÐLd)ï—e7T»™ >Ã\Õ_´ð\‹ZgókÙt=©JýÐMD£ªª¶Š÷ê¶§ÝêV*»òwî&þ²¸÷6¹fÝ¬Ô H…¶»ô±®'›“J¤¡7º¿Ý"IÅIQ±‡ ì0 z•%9ú¶À_jzçÁJ0cXS­II–)/fEw…W–¸¸KcJ¦t—fBÄšÚo +¡;•W:dJ* ž4}TÝgÈA³#t™¢{æTålVúXA@êç³to4¹î@%懣Î.ÈH®éœ¶âîT,3:Ô ,…<”®4¨V=–Í%îm™~¶œ5ü{wТãɆ›+QÆ3ïùs¿1Tî°Ñ°f°,ûÛLþ¯Uõ%3-a5˜@3›ã‡Én“.¸šèdø—·(ç\ãwLØÿ!ãÒp1Cô&kb#Ö®ÉLÝ_Ò5¹óxƒ¿¾©á$ –µw¼/Ï®R²¼£ + ÉÕÁ!øËcAîœõgÞ&–kº‡ ¹Ê8Á\Ú,Œ†éƒV_µ~¯ƒEisi¾~é; †+)–ú+5E]6QnµÑƒgý]4"ÕýóÑÖæy(Ĩ j–Ñ„›AOÏ +š\« õAƒÆEñìÐ)ÄÁÞ ÔÝÈáŠh ,'gïsbÆzÛ ä¨SÏ4 ±‡/|ünO( 3 +Ô3Ȱ[Ån5ÍQKì?Å„Cÿ ~73нŽ6rM'Å—q·Ý +ŠQ“Œ*µ|ÂaÈ´É¥ÛîôXwŒ6rÓ ¡Ó/ž*„R``dˆ#yÖ<êU‚æ*:h5ó ‰iË€\™Ž`d B˜‡ÇI #\Ø“ u”ññk%ªŒV“7J Üp9n+LÚÿ8æÞ™¶ë0wÑ3Gx„i퀻ޘ~·ôô÷ŸRÙá‹$ +0-‚+ƒ8&)# nâÂ3¥À^·Ueýz»ß“Fõ‹>H¦º6…ðBäŸÀt>S…‡ð.¾ãÑ%t㥃sBt¼‹°…o2:ÒR˜G‰±(ôFWÊɳpbJ+³M¡Aoî§5â*‰³é¢õJ~ØÐÑ¢2+YæEa_ǦE3°µ¨5NˆÔŠõuvï‚^TSÆWCQÆ~;|dü+5®DT@ †Ê†Ï +”´ç~„¶ÏžÒïX“´ÀPS¤ÿ™¥²L•ÉâU¸ÚãÐð‚G¢m¢Ba÷.›@ † bK±7ƒÚ 1ξ¦3cêoD¬‰.Ièƒàª¯Toì^ðo¯-Œ)FÁਗ,\°…vÔ“TÀÐÌ[É"ÑÚm†@°©Z¿b!ƒÊ+?”ŒvUM$ì;§A6H¬ø?€|˜¦lïg +Ç¡|uÌ(ö Yè›ù+Ð3锾(æt Wçš‹›WºÞ'ºp6nŒ'hw ×DÖUZ·{v +U †®¬­tù±ÿ'ʧÁ3:$ Dµ`p•yÙ¼ìà_üSZ7ϧé@ý@V?|ƒ¡|} ‘ÚΧ÷‘eÜP;åû³vÒvj»…»mû8¦wÀö¢2¤ŸøM§ÇóD ž±.mBPAe^#Çä‹Iw{yÓP¶Á´xêýôT{\Ü.Òòmñ©ÎøWȵ¡ô¶Uw!ûæ9ɨi?¦Ut##Âó|4˜&5rc–‡Ù¢·#)–X° }„Äj,,ƒÂŒ+ðúZä|Dÿ[x§¿Ït|Â×Bà:=è°5>¼ÚDƒx»„,™ ê +¶Ÿæ’ÈuǹXdÇT§åf<(êÌV!2Ai5`"U´ +ÁÔY>#ÈS•‘g%Œeçä„ÞÖù"îËýérÁ.ÛªO }$HÚþªÜàÃ*´aT•µ†TL\r(+÷à<±Ê©g2P¼±t_®Ð±$ÁxÿìÍ2zM2¹1öU¿ø² ”o{YИi¸îIˆ2’ððøÂ‚+¢žûEÑ–(Þ8„ÚiÎ'Ë„ÃòaFÙ(é.$aø³´sO ­B7gSlCÀ©=1b¬õ/¹h +[/@‹©?)2k&©[‡Ò࣡w´ª£Bš‘·aÌVªa†áFzÆ-h2( ÅÄ„P¢ðÂ*D§O¼CÑ“†šX×…Ê<ŒQ +žEäjWЧ…hDÊ DÑ€R‚Ã7Ÿÿûæ%FüÆÝÉ¢ÃñSîN=ý]O<­ Õ´›RÁרÿ€õi2·/ú†ÄG~íª÷hY«-XÚª]ÛPSVTó¨‹Iï;ØÞyvñö˜7«ñHqÌÅÃ>ì*´¢\‚iª]±û¯e³ý´Ø/Iã]ø}{®6¾;TGßè QatŠ’/ºÓtѦÑç UÎ+×°cma¿ô>”ãµh#šä ’ëCE‹ŒG&j6ÂXÃÑ×Ñy€RÈσõ­ äaX"ž‹LlQ&Ìc-ÇÌvˆ¤†&g­­ÉW¨ó¹Íþl³ +·ôÔflÆV!$ÃX Ákm»*Õ½vÊþ´ELï1tEB†‡ØsÜ5ÅÆ"¯ ßÄÖ›9L{òŽ2·ªÖ{mc-ò75pzü¦@"¡J ‡³ï„ÜòéÜÒ¨:Û¥y9†ÁÔÖäDeŠ+X +|¡û`ÜW4ž5Ž'F‘Ä¡^ªOd³½ÒÈaȼ,ƒÆKG¹Uø†U.øþþäC pP Í¼äÊÀ²%äÃýÜ +¿›Ö'šRzgíp‰Š«óSYnuãæd7UååDÑO„)fU.7FyšÈhîBá¼íûZÇjí®Û}ùlC̼ҳ”d>éªä,¸¹KyÄ»0|(F"üG±Qcó]eo÷,ƒS¨;¢ÿLôßÐ ¿IŠdbY=A +‘ +û´ô—/I!'†Âjx±@xDxeh¦¯<¬o–‘‡ÏÒ1Jpê£0Êc‚4]ß—ò @ÓÅ)Ü D*Y;×Pûw›¬>Bƒû¥TNo-hZï‘pa=Ç®1å1z+«)ÿ¦ÒìD­{-O+O[ ¼Ÿãy!ïm2ìaÿU/­¢j¸HjH38|Ñ.I’‹ãy¡¶àÿ-¸ êVî2#rÈ~¹¬ªeu’àúý;&ç"»S9Ø,ÊnŒ¸=jƒ°‹Ù€ˆã½r`q„Øê A0NØ!&o°SÜGMÜÙBÍgä…{ƒ™ü•r™Âè&?æüðXÕ,iž›ÿÈ£ÏRôõX9ÿ…ŽFštð¥ ÆwA+×T«Ò‡ÍÄ÷Ê­^×3­Ë“”NI2ÐýŸ>Ÿ&Å~E¦ìE)&˜¡A÷OÙÒMùúíÈcì(Í1Éàx¢†´æjÌL&¬¨ÆÅ›žHE ÓR$vôÄË„PÏÜÁƱkûE.é8R]Ð$Ù矀>$⪻͂u¼6øåÈd%VJð^…*Àýû1Oë\/Èû@4ï>tô/9e/Y씃Ñkz:ˆ¹Î8Gm;®DÙ‡MQÏ~3;x9=¹%dVX²¥.ámUU*šRo†ž¨'´v¿F£Éø1·`Æa$_‘ƒ5Û-A^&{§*½0Ã\’IY(04§—ô +NV8C·$äM$ëáQ£ô‘KG ˜23uP¼âÒb$T®Ezho$îZÎí¶˜!l8pj—5ùâÑ1åÜ žÏÁ:|?và¢Iº#º‘ÚÅäSß ÇnhÛ™šlS È@›d‘gÓà3*£ï§Ð ! ]õYx´Ò&²(šá7¦¥îqJ‚vcÀp¢ÅìnÒì¶>6Ç +πɆEq:"W1 €•xØjÆàÅ0ã[ =…£jZäJ$°²¢ï,'l°2±¾í²[îFcö‰tò²¯PÌ* ¶Þ÷r´Re¶•<»õ¦]éx£VüÚ6LЪ¨åUjwDWŒ5›rÕ‹­,³¬|W6hœ˜™Î˜~˜Ä.ÐDÑÁ¥ÇYˆÕš†dmx¯<7D³•Xz»g•ô+ì×½ŽB“Ìýu=}*‘‚û9+ íh/ijWÍ Ó®E¬—æp¤Ha™K<Кè1¾>ô Gì ë^7Ö˵ª§×9ªghä¥Ô!KíôÄGXId,¯"ÄÖrøV¸•E⃟C7uæ9{_¶Eïzã XQÔ +|~+lŸ,+_†‡†Ãa›YmnMðëР"ÛK È̤ÕâAõâU•–¡¥(‹—äŸXA2În¡~QõHk&ÖÁy<ò€ IýŽAô™1êTRm:»¸}àÂÞÿŨÌO€â£ÙºÚŒ†à.à#1u†9«ç樆Ì5øŸ~$3n·iEe®÷xð½¶Ã=}§­}„“m°ELP‰0Mï]6=hŒyÿ‚ÛôGw{®×”±*¹mß§ÀÅØ‹œ&`ˆ×3>1¹%Ø;pï-8ªz„Ý]š™¡Qž•ömA¯ %½vÃú\PæØ¼—tXû‘²XƒË-'ëˆ>ùÿ£Öãì¿À‚ΊЉöQ…Ê:>îí¬±ì…ïFº ŒEÖÉ56ŠäÖü„PýkjhͳëDŒô¼¾qaî17›Í0½¸wµ~+¾Ì¦ÊM&Ós±³Hð¯ÅèšCFQŸÎ@œúÄ5m˜e?ƒNÜÀ¿D߶ᙢ‚ÀB[ÿÑ‚ ‚ÂI#‡ŽŠj^jz P¼÷q™ê7¾L#¯m.Ùoá~ÓƒLIÔ²0ôLRŠ7\dF±LîMf€¼7VÄ¿Å[`Y¶Q…}§•gkñÕÍØZŒZ >ÙŒ QoÛZ£¡Ö‰(žDöIHÓðdº4[]²†i(h–’èÒ žÂûjü,\Aç á7JI’>Ÿñª°‰úEC(t˜Xð›ù3@š™V_ŸSF­ÜÌ„ØÈ^‰´Q"¥øv")cm0$u_FRBâºò Fh)Üú3h]³ [ñ&°>ž@WÆ'uÑ^s g¤ À@«âìôEÏ$@už´ºSKÿayv¿Ý²%¸ë÷ +ä· ¿È;/w6œyUñ{Ùizeݹ¶Åk‡MŠ@ßø FÙ¤_ +ͦ¥[WJ=ŠêßD€›ÝN¬àœÔFñY@à[ÈxRv)OÌ1OqIž'Ž¢çƒzÖ®®5rÕ-°Ü•‡öTgÜó‚“5ó=¹þ3Ýýé‡w~¦þ>#5.€”dEʧœùXJÒÎ{Í׋¡Oƒ +Ç|ìXCíT‘u´O=Ñå°%#ËNyŸºbD¶¡;ó÷Õïc&ïH|Aä(‰¥%èˆ_[ºÜÏ'rqwøÛ;(X-Møó…ÏäsHöžˆµŸQ;/(܃ çàÆ…ÖàØ½®/ý<Ï–‰¦u]ü€JÁ¿o®'Ñ™ö‡èÐf¶È‡Áü ÿ” +EÊ>Ù|ŽJ^qô©Øµ4XnžÊ;›à|x%9Á‰mv”Ïyñ³g=ú,õgómÕ 1E 9+ÚÔkþ²,XÿÙhæ;Ë2ï34~’’«Y¶Ó›3„Ñ'Ê ~%Ó4}Bòð±)ßì‘&p’KXIz³Ö³#飂‰l¼dRÉÆåŸ4O£ýë^Kje%<…gƒN(­ç&ÌÁ·¶âdˆ7l€šû”@IJÖ®·Q<:嫼tE¨ˆ^‚!Ê-0C¦†?€žWùFŸ, ZòàL ˜¶ öÑnaLF/´×…<¾pÓV¦,ÊõÒ%DΩ–ø\ï%÷¼Ø>¾Ï8‘É·wÎb(™˜´ÁÐ,c1}°ý”`«rÛd³Ý¤¢„oœ æ›jʼº>–¿¼Õ¥É»`~IÆ#™]däøÈ©Kb49ݤÃI®øÄªM.lÞeLÝy}à9cã;§ +°×zb€¼ÖbäûÈ×"‹É¼%’€“—àoeEâúOPÛ! Û0àÌž­€uÂ!îUz¤Æ±“tÖ_‚_‹„`ä¡ Í¶0­º—2ÈÚq˜w‡s<¿sö~9 `v|J0ïݳ¢=çÌ +’ŽG‡TtBmøåŽ|¹‚Êâå¾?ê&¨³>²µØDÃ[9Þ‚®Qfr°iŸŸ<l£¥Îü?Lúrb)»l+‹ÞYêÕ¿‚BS{`üÒw”k7¬òù{ÎJ“ó÷¦¼S$ѦÝXˆ+KE*{º„uïx‹Gîás±–ýº:n˨ª³€;Dq¹¤›Éç˜O\Õn®q˜ûUDZßÅ‹ùªäÚÆ¸ÊK=seŽß^›et4#ÀÜ +˜2Ö Ì¯nÈ “¦ª[&Ó@ÉÌr“„Ù³0ÑK1LÆû¡s˜Ê¦ „I³B¡›•ÛR_§[ãt'ý¨µÄèe(º¨6 >ûµÆñ–yÐüc‚”z¬xMn˜ÿÒ’7Ó–ÆÒâRÖ¥Áö.öôtáè½L9ïÐñÂb|‡>–Ñ-Ù%|ëó„Ê+4àÓ1[ cV†:à9,Så)cÐ_JSwdÊ—õ©pv\{º>Z=0†IËIæú“ÇY¼9‰îßBÊë\¡…rÔÜ2DJ·Ù5åcGÅá¸`©½OL’Qžj…Šªå>Gw¢™y¶ìЭ®[^zLÖ +ÿÛù\Ø9D#³Í´"‘>*’±k“Œì{€ö'8÷ÄE-6^ÞœÙ7fGÁmèR#êä—ç/\.;¾ 9cU‰dOR¡0}K3PaúBµeV1ŸÿØŠñqL,àiçŽLü¤ETËbÃÈQõk»f;[6 ¯o(ŸC½=YµhFÜ×¢hu!@ñ0¥‘`8XÓHn¬8óÐ*¼Ä-#€H¾×Þº˜°³ªK*BiÉ>1%å¦!Í&T\-,B9GD&s¬¦÷ªü˜UãMÒ 3VÍ¿$9Ä#ÉÊ‘€Qþ•É·j ž»4ÉŸiÖÁœJÕeIÌÔ1 ùÜèRÁg‡' ÿ8H‰‚ËÊEâìoÜϱÁnÖU-Ó²îrC¢Zð8¨) ó` ‡H+)¶¶°Ùj]œÞ0ýçnàyÔ. „¹¡7Áß*$жÀÉVàFM’÷¡9›ðYÝÈÉÜ(ÚyÀxÛ. +–L<³BÚÄrûpˆ]!l. +½¿eƒ0A»4$²4Z„*fÍö=GÜd÷¸˜øHìÉ"@L 2 >¦Œ_IñEReÀïUDÍ5’vC +Å+4 R£FA* + +sí +È“ +ÆE@AALÃýww=A€'0í)ºcYË s»5^sn‘™€íeb‚B´±¼Uø¤AøS'æQˆC +rÐÊÃOË@ZÔ…É4=µ+qZMîgßcš;·Œ¦*¡iwRë4¡Sj}8ö4ÝæÝ'?2³Sšj(@áÂE@'‘>` ôáÒ“UÆ*¾7Ð ª'¯¢ÛsÓ,¤TÖÌ’$¨KØ7$Üà/uÿçîÃηÞä™”16¹D$M…ɵZI¸ÔŽ®§ãŽÛ‹X$Íúõ]Z]–؇;”ΤÁ7é±bõƒÐkÅØ–V(-~Ð/­øÇãAWVð+ø½ÝoǨtM¡:TÒñ3é)œÉ1ïO¾P‘ álI“j¨Í†¨Š¥”0Ky†pH‘47ô -¨¡B13))‡ÌÐ"2"†ª¦ *½P”±²IŒ€V 0Ïf Jøü8—§F„Úê%íû2¯~•>‚jÆbxA ŒQ”²pŒF®º¸‘ªé÷¸¯‡íôpØõ·­}x@^ë<_gnKŠŽ1Ú&Ç]v²õ™kYÝ ¦XËôNµ©ÕÀâ´£aúVÙh™–®1H¯p6G‰I¿BÒ÷Or¿²íñ‰!Y¢§@6ç=D±Éû1¬mˆx"Éæ†ï…Ä+ õ‰$—ʪÞÓÒÄR`Vº:Aä8]b›®Í†3¼d)Ÿ–2ëFUÜ×bL¥doZ5åfæÉÈ)Vƒ %£=VÿV?.9³ʨ@ª–Ù§ï‘ù@W1 Od.œ†c3‡;M1ÕH !ØCÞÕArÁ‚/gy) }äÌjO$h&djòÿ¦•„|ÁÔM!-½#ãÊ4ÒD+Ú‹È#IæBþà'DÈ•é' „Z83¨Ð3wA#-i‚š0¬ižlbÂMYànœÑÚH«vê`3¨>‘1Šlia¡Ü÷×}ûãHÅü«Ô¿œ÷Ý¿ ½Ügßÿª™RTtv•Â&ÇÕˆVëJª<×+ÁºÑ%*ô²Þš‹Vð›øÍÔ_?øÂ9Ôtï”O¥î!á:a¯ð‘A´N_ó¦:ÛÙTðçkFMq-ª¢ˆ?v0 Ÿmb‡˜.a?­$m¯½i4ìåö|gtõЧ^Ü—¢ÀTmFLG…~^.wž¯5Rµ™—3 ¨ ºµ>¶Æ+2®ÖÊÌZâ üb7Uäû.³\Y]ú\‘Ò!ù× Eî1³rÄÓ›ò H??øÝ_Åý&ª‰“ke£ŸÐ/ãÃa@ãòºgO\þçÒ ¬Oå§“°mÁ«X‘ò‚p%"ŠÅÀ® +1NëqXµYžÔpGÍœ¡àùÀ£›50Þà§y‡FKŠX×Ð`¢4úz£Å´WLIÑhŸ +œ¢X°ò¸O‘RJ¡1*;ã—Wm½NETqCUj="i·•w%ÈSq,:€IX¬]ú#—‹è#uº`:YÐi±s?ZÛAÊ*Ф“‡Æ)ëPg +± U¦¡ö2; Õv¡þ,²Ïèå3$®/Õq†Ä6êXýÅ€ÍøæÕ˜`’n|÷ú`‡šo:Ë_%›QÖðÚ q[}ÄrúìøÊÌÝ8•‚—-eºrçn{ßçw‚φ¯Ç»äé÷4º|¢s©ÂÌ%[MEõÀ9\…&Høz‡ÚUR¬Ó¬x_ˆÙp¨FÇ Xf¬ç–9EhcNúMÀ?¸)í¿ñþ`ídJ2ÛŸMΛ þiÿÏ¿Ïú÷™†r@†a“KwŒÒb_Adˆ`B`3mÀ¢Ur÷Ië½á feÑÀz"ËžîOÆæñ¦O>¶zØñ™`”¦ç`1·_ÉQ—r0®}çr'ø=<xÎ@€bC¥5]_EÙBxyy¥­w³Ê‰‰…-#rx‹c'ÃŒ¤äràÛäÒ “0-.’ê/©ý^lø½‹;|õÝÉ9uò¥‰E4ÀÙ–Ö`¬\ê=QfˆrAyQ佯ñ:Qá%ù.ïëî"îBa»zÑÎ=£!Iº‘´q¤Žëïy¬cz;þõ޶/íqõUúc©%â(™#øÿ•ý–ë4+åÕâ³Oëf}[UÝ .<ŸÖÒwÌ}¾cᯈdÕ¢êÎd‘’7¹ƒ•ÆFaê˜ó·Ç`JŽ:/Ó1Xb–zÿ H|yÈ´ Bÿ(“cšàa +­ý™¤©Ï¹’crºRåtÿÓªñµFGAMÊ8>GHMM&6 ÈoiPô³‹R”'ëFß(`ϵÀH>çðu”hÉ7†lc¥Ô>ÉÞ"ó4dü?ÆùŽQü…„]†­ß•ƒ% äõ2™¯J×D}Ü·€t^Ð £x ðƒ†umŠªÚ+¯ÒúʨW.W…ûêÊdó§‰9!K¬{GÔ"s g_j$G±ïaÆi=ku?$W¾R»GEõs¤ñBÈ´… |šŠ h#¶BÓI|^ÂÌLx9Aü¿mN’EìÔ>¹üÚ@ y%&«^ç4zÕ“óæ¦Ôâ! ïÕï_à $$?¾Q1¨n*ÐY¼Ðe¢ÃýU— ŸIðf5šx0¢Ple Ҝɫþc¦gQŸâãâïf]’ÄoúQCOYN,+6¶;@‘C­sšÞVŽÜ‘ÔéêuŠ@AƒÁT¶bÀ˜çø!Å‚%eUOp6yãg"• }`ò‰S‘=#ïõ×Añb\Ðm”Â3@ö:z%8ê8[¶ƒ €«è?ó© +½ ™8g÷1 MI&“LÿÔšª_ ¶Ñ·ab™j‘´ülF|Á{KµSi¦ÿ›í•‚²ã†À'k8µ i£Ñ8šïœ…2¬ØGa,?6VÀý +|“¢n{!sðÒ‚+¤ÒÈFÞ;¨•8ç5~…ÅQ h_EÒ¯uÿÓDj~³&s"+42dW®÷«ŒÉz'ƒƒÉ:nFØÙËNn<&¥sÜ?Am¢›ØQ‰  —vº¿þf„XG(#ýø3W¤¿Eá„<‹qÃÑ1ï1G”ôÄ 1Ìâ5€eK ¶¬¢mÖÑâMþTù« eèé+ñkÎc »UZN æiÅ!~jJ`ÍÜß +`®é©`ðóyÁû:¢Š©S–!R*|Wá$“VBDÚ˜h¤[)h¥w§[æ9R–_ pb@<ÃNï4lÑ‹>0¶§i¼ÛÀ:Úµdôô³6“*T¾¯L4xƒ,Ðí¦7z­ºÐ&¿Ý¡¬Âÿ­Zà0”5@ǤÿèAWÒ¬Át†Oxw%’CUÎ"Èf—tÛ« »½×¿¨`†ü*:ÞŽ•þêÉFwÛíxü7íã˜8Pàîúß.S2jœËÉŸàÀôN]DëÆ…ÖbK¶v®Óõ˜ Wk=¾Ü@%{[ñ”-Æoû?Ÿ·¶÷qºL'vL0Oã9ˆx,·8[²…̘7:®qO~í·+Änõ÷d|’Áï=.å•;Xx¾lCæ(ã.ïªâ>?Já,…ìßþפ=QàíìÕóø€ó¸Òì|°¸Z Ý{? ”ÍxßÍ&sY\ñ ÄaîJ¹`Øì€iA¤ÄŠ3iþAKz÷¤…[ê—Äeñúz‹ô8p›”þ/$'W4ÎÄKlá Á‘ÖÿàûšØkÑÿ™"ÿUÏï2Ü4_ôP¯Iô”ÊþÒDÚ!WRé&¾mŒ÷é…Oå–&„”¤L)I%ê0j@¨T ´!¥ME­‘Ò v“|±h<^IbUùH&\ŒÍu€ÁAñ›0%²N;±ix0¶Yû M4 +$vCs3†µ9‹GN•­ç@¤òòhÁŽÛ£¼Ö“I:‹§Ês® ³x‚:fö, Cr” H¾X–d†W¬˜P“Æ›%‘-Õ85Nßæê "h‘|žbKhÖo*6ÖÍ*—ªÚn)9r®7åT+Ñf&žML}ªb(¬Dª&ñÃfà +Q, +4[哵\º•sói¯Â­ÅÚȤxsG&ãÆ¬Ht^­l˜‚gôo[k³}™K:;¸\¶‰á2Ç„ËJhFöÄTæ’É|æÔm™ÇªòWÈʆFCÙœb‹‡ÐÜ1Î…jΙRs;ìÏ«~bÑœ¤îéÜ3 ôŽ?´R¸!bªyæªí%l­±Àòx>w^bº«’—þ©ó<²)¹ÌcAš¹ ÷P*Öe³Z-J< 5›èlÖØÁÎKb¡?`½þ¼f\"“ÒœÅØt[LeÓØÁŠf5wPXEì3tzæ ù„ù&”ÕÁ÷îëÚb¿’ŃÔ?ÙÔJ5ÜZü›Ðì§î½˜õMˆ{¹·eZCtején¦j#¢¨ï ’„Ò,fDBm>¯;ÓÜã~Á9ø´5fKDS ¾£ÙCˆÑlì\f!cœ3²!û>2¾â7£ÏH“j6_L*T’Ɔ1š…é‰r°G|ŠÇFiÕÇó™øÙ\”®h^K=5õL㞊 +«™™æóšòŒ}îbìœqÌd3_å3rr/d.«Ó²ŽŽÆ(/Í„¯ÄÁ•¥ÝÈ3Hzæeб‰ˆ4£),mTî­¤Ö +GïÿÓR^& …q³|Cym—*Q(j(ßlÎhE®¹\º~,Af'h=Sò–O^œá\Óª|$Ÿy^I#jn«B={F4O¹ói0ìSž_ÈóÖxè‘×V +õÍ|:(f—OEIN™"©¼[ý%ç¬uK7¯âåU­`‰I9#‡ÑÅ‹ªR"?G#29dÚ˜Çß°Èí‘p2&‰‚äq—⦠MÑç$µ +µTõqK–S”ÔE!1Þ¬,Ò¨>JV3*ÉA Q™éñÏêSÓ—9;àI·75w”nÄRºj £ñÆZ–¸½žd’Ú§æç„(—ŠòJPÙô9R=‘â~•ÝwHUåcÅ[¢GýÁµõ×á( sf¤l¡±Ð¢q»BùÐK¨§Ý’Å™(]-ºï|¥ÚSF §LŒV57)G8)È}õsY ’ÕõTE{‘ù²‰'¿SPIˆ0èE«S•~‡ìà›Ù‘»Áowÿ bNg£wÇД~.ѲÑGßGyh©Á)1âÛJ®ìÒX(øò3D‰y’sPÖü7Ñ$ÐW®—š`§ ’*2bFß­—ú¢'"EìE¯Ó˜‚œËúx©yÄ|亙"ßì…(± +ºI”ˆ¸×‰+úF¥y8~,v‹YìÞH•£YA»‡ + +!Úó‘aN«%³Q˜/yCc採ƒÊ‘¸DÑÈÈa‡«l#ÊÄã™ÃR,j‰hÆ61f‘*‘܉’—·Ä(LJM’fºÈ ¶ì` Ñi³‡ü{Zj\/Izy0È7·;)>&·Œe*=!5»J/OÎÁÈ8ÈÞ81óÉ!EŒ‘ž«#X1ÔO/bŠÖeC·ŒÐCÜÐ +Y¤}(Ü“ˆéòú*ÅŒB)Dz'‹’¡±E1‘‹…‚EçÌ¥L¥GIÌGC–jê„þ X, öb¡Ù“P—Ë“)Ù-åa.­këË•ýK¨Æ3*– Qs06‰”*ÛE}l>\„_B¶¦x@¾0æ-a…jÂU)1Ù3%¼ /¨Æ#´©ŠjÊ3´K1Ÿð°á¢Me‹{?Ezm鋯R-jFVAQíÿahïÀµ™sr³f6$UÂÛB©¹9&‰I¤—7²³±êI¢¦–P9UmÅ{HE!4UUÉEY®ªË"BÝG,»­eÈ2ñ !{R)²,¼]#½ ¹etImU]n«òñ4˜RÙ$×{ »e q qJbÜiöKAª‰B‰¨ SÒõ±¨QE¥^HHêRí©TG¨ö”ÜÚS’2o…”¦î’©Q÷Ao×çµXYf ?QÙR‡Ô0^B!OøZsnäŽË¯É35¨ÒR«¹HÓŠA4âjÄAä¶%5O¤hu²cÕÄÿàŸÝyƺœžªbUF¤uºm7ª¾¬‰Sg kBä2áDÎ/}h Œ¨W6ŽÜþ‚ZôapG>ƒkH꣙È!JÒ*‹Ìùœ‘5y<­úL©þgÑæ»]A‡Zugý #܃ü `IºLâöGS:dÜéüøxÿÒÁ¢Ä7Ó²Û£U!]KNNjê4‰à—F5<•ãNÌ5!NÝ-Ã>(âÏ»Žà:`(fašºì#Aê`6W ~ ßž­<¨ hu;#K>¥ƒ +EÉía9Jq¹ÊœVùdJ5•ûC1YTE#$ÿÒÉàŠq¬É¢‰²ƒ13‡òÇUM :˜è¼T1Ä< V k öAE‰Ë4ãºÂIt¡õpZT_ÑÚÂRõÁˆ¨âö@È«ÈAQìŸ"¹NÈ…JÄI9pÝùßt¦>œ˜ƒ½‚È!r3$«Èdƒ ÕÀÉÁJ9ÙäiÓÁ”ˆëZ³ƒz|îàu¡‘ÇòëÄ;ûØ45ªNÉ£ylðqça]E48 mCÔUœ"e×Hxô€|àYƒZ´ä +4«¾È3Å!’8Ó UB4kAFJ5}|BÉ„êÉ£M]86]¨#y¹ã“d'IhåÖ$:e¢Ìgeòåá=Q°”\†PˆëC,Gƒ‹VŽðŠÚ`æS'pãÚ$ÈÖey¬Œ8L&—Y ¸¬”§Lù+BS.ÑH •bHRv´N¬¢‰Ÿ0mDŽ…{B•L#ÖF„ŠÕˆ çÆE!%e ÈbY¹ÑÐØ9jE®²KiCìÀÅ6¢ C#äÅ%œ†*!w”PÄÅc<Â-<µ˜Íœb!W„Ë%d6¸%ä©M(6x8ßÐ&„v®Å iÀ*vl’ùu‘é9Q¡hÊbÏARbõ v÷5(Bécxx$Φ’VgxÕ›j;B¤Þ”¨2á3Ègbî¡…ŽÃ8¥Js<#YÄÜ5õîi%ÄÔˆ…ÄLuiš) 54D(ãzU•p(hž[gy0.fšÐñD(¦ʃ¶e+Ì-j|‹s†Å$H±PT½„¦žÀšQÿÀ¾©wˆ\xÎgê¦àY}˸¦\-üÀ™ˆ÷;xpö†´f\%¿é;ø/$jnJáTaSü¥$Èø¶Ì{S’ÀqÔ·ê {ERðì ¼j9ö$VQ†½Ú08 ‡Ì“L勳JàYB#š…Ë ?it½Q ?ЊÆei¨³øµòœ&^ùŲ?b™ÎO]ŽXiè2dœÐ³ZG·—¥ÅHªC•ªÊLNÉT›*×AìØÎŠFì”kéT™u×Љ„*ÎhɲYá‰Á䢌.3‰PÁñ½à;CÝ*ª³…<ê2®5„Vô¡!ÖŠÎ’™ËÉ$üe#5ÅÕ¿MuV4|73:1ü¸2 MÊ|¼èIò¡TÑJ/y„ªºÎ +ÃÅg÷Cr Q„áD¤R}´uÏQþZ^©˜[j±é4È1ª§,Îâø‚ A#‘¢Í‚üo¦†‚„*fâ¦U…¦ b…>•XÐKÚ°á5ãÒéA¡—W“!gí5ÆE6LqЇ"‘F+¸{¥Fíß•‚O«î„hH¦ÏHÕ?)ê×ñï2taÇEA£¯¤b˜„‹šŠ"’¹|GQ–¡º5&Æ÷^L%š iH¹W%µXŸƒŒAÔÀ‰9†£=‰¸¢X…èÛ²SIÎö/MIwåw)¤~ˆdt”g½î +vp@ú*rš¨Wë\¦ 0€˜à `@\! Ø€J‚ 4Á p >p€è\à€ ¤@0¸À@ ”à@€J T€s’H¨£à‚(à‚˜  ¸€A +6Ѐ `Á .`Á‚ F€ „àÁ.  \P`è|` ¸À@ð H‘DàÝ€R0 „à‚”à%Ø€6„€8 “œ”™‰#M5©D:1ΤšyTŒ¬_8Ç‹t¨àÀr™-uP²®› b´f¢&è½¢cÁj øXÀ€‘t€ ,°@ƒœ€-ЀAÔ5r·@ƒ±€,®¬‚™˜­JñŒfÐ)áÉ• Z¿ðlNÔûX{'i ½³Ñ¿V2X¸\í´p¨‘ˆH) ¡“ÅñQcv‘ȳqŒX%âŠhu +­f'9 +‰îAÕÅhe +ÅëѱUõjG,„º³cƃÞ.hsoÅ"Ò6Ÿ66>QTí5“p.³—¸CV qÞ,¨L‚Û2 )б-Ry¨1²¹Ôt® +½‚E9 3TáÓ:ËûG"ÕiPTM¡XJ^(OH)ªðD‡Pq*‹H†KÇ㸩àeAÖÔGaãy‘)Ùf„— $Ä¥'ÆÄ¶±%(«¥¤ú)O¬Š'ùÂÞ +µÔаBÃ`/Öô%)þÁÏú'Èj¨Ó:x£m°âÌ!ŽŸÓ*FÊü~bì¢ô±`.»í1JZ 핾›ÞjD†Omò@æ«2I‹ÙÞ)¦„wÊ&ò • Kx¾÷r`)_‹TøD|Fˆl2È6ø¦â¬OHPLH¹Äó´Q²ª†¢ƒ©éN(RS–£Ž;êžÑ2Ü™£>uŒð2cqZUSÏ[ãb¨v Õy?)‡{0sà(§C³¬’5,KÕPU¶hª¨EºJB±U #ëV°UÓ©i ±ÃžcŠŽX˜ÐPép=ª +BåA4ªb F‘0xZ +JÕ!¡z‘^!!?$¯”\!…“CV2 +K^ïGU‰‹Ô•§SGšMž9]Æ*öÂzÝö€ªê·1cIÌ^S샢š Z;>øÅ10ø!ò˜µ“ã¡ü±L±¨Þ•D Um¬8ºMÄ‹•tX$•x¬6qx´hÛŸº”}`*K¤K$Lö[•ãœ8±^”¼R!“­=ŠL/Oé©W«(QbMj%ö8$z¤Z~ÉǯÇS¢«Ú +¿,t58F…Gd$ÊÂz™*¤QDTãŠ*×¼Ô-Eå1QE•+Þ@&M[5G¤‚Êa9…ÅŠàf<¡Mº%Ñ„s‰&a¯ö*—"§egØUHÅEbVµœ¦Ã®(+Ë\<$²šˆK‰]U–ºˆc5¿D]L#îœdä@5#ê$ý'–~¢P%¢(ÁÛ§SeîO5q?PzPZ'T1å’Ë´‘ƒ•œ“Ñ©ô|J¨l)£$lV?©1Øe³¹“fî*Ncú˜j’1…|~?ûe}~¥L³=,|D4SUh¢ä˜C§xæ:ä";U[‘†Šf¥¡…§ü2ĦùH£ˆÈAš˜hØÅÊZGY®›F4ÛÄ92ªy¬‹—ËÞ°"ÈR¡ GÍ`øHÆLä35—¢c1SQ$Æ«&› Mwà"Ÿâ.~¬ª IÅ%Öé¶}ºÖälHí`BjèŠ ÂƒQ˜Žý§fyÃ|§¼zcjŒ Š CeA Eo@U–’™›Ž„&:>UŽ“j~°Á<ðN1ic^u¥Z\¼À¢?B<^Oè§NÁƒ?ˆ¡Ñ™‹L÷धB²Î;¬â)nºt‹i¬VÑÁN´šˆÔªæèí=¡E_9Ki :(‹'áAðBæM?Œz Y^«æï>rÃU„û0ao +ÿ ZO©y‹°B eÑ]†át@E¶ÐÓƒúeÎ0Ø®©ês¸tF|/ G6h2²êUó€&—¤ò¤°Ö˜Ds0B%ªôæòÚÁƒÄÂp8·p~Ïf,öû Ãýövü®F¼5AnÇàÚÂ#Õ¤¾°xâ <ê`¼&$ݸ!¦ÂxíàÄã¤} X—Ž"ô|Üô±a IlrÇ6 ÷‘;‚¤ÈHìÛ*5‘;ƨr]>CßnúŒð%1EÿH§Dº‡Ò Í“ŠE†å©hM¾ÞN3‹ˆ˜H]¡o¨Í´ª³SDOû3LGA{Ä&j…´ØS”ì±0;Žc–æÓÚ%‹{¦Y'nv¦ +Kå7­Øð¢Ý®±E)î¶?¶SGý”ª[1'uE˪H¶ú÷û¼J$¶£$V+!…¼¯JåÎÐŒi}}Ê8z>„î’&H Eijè[Z&u²|rj–ˆÇ= +›É%¢gPDïÇD¥º—d6#eÒÃPñ¼:B=ASwÐQ—RIÿE,ñ}rÿñ_ü(Yüþ*êQ\Äoo (Lñ ±V¸iª<Ššò~SeŸ¦ì˜wdá=˜ò"¼Ÿ ã´s1:x'Ê“°¤5Xaè`ëƒ& Ž 0$¶ÉÈA±ÛiåM«‚y0""3Ss +Ð`ö’w +‰˜¬Ãï;5®BØòaÓù¥Úˆzb8É‘‚HóQD¬Š""Ï'V“8Hˆü'Dþ„ÅÈdÚ<ß)y뜎ˆW6HöJ¾Ä —![’š)•GuC­ì­#:d³®~…RØz[ÜÌ®Ýv.R‚„OYò hI$mOå!éù +yb!~¥RV"˜¤Š¬ôTO1©R¹PÈf]é…4«sž]»ÔêëbÏË„Mމ¨«=à„4ó +T ò¨6÷—|Þ42Y*‰ÓCÊF#bÛ—©ÂAœ +ªºX‡YW´.7H$m¹%j‰ƒHtäxgª4‡Ë?‚^$²toCÕ©tÅE™Ÿ “’.ª˜'J$žõ\Ä£Ú¨0ÒÕŒ«¨,e»¨*†¦¨†¢<2ã¡ýT£ÊTp‚,ž(ó­)-ˆ/f‹ ð€Ø®x™ë!9õ5ÛƒVKj«SŽÊƒØö`3ÇäðúùÌé2Õ(GÍ,RoQÊ.å`uO1R)‡˜0iK®«Ð¶(JMkÊ›¢œTѸÆbŸè-¯sÙÚ¹J£½\òëÞÆuÓ­UÛMè +¡èJKpfdÆbŒÆi™ÏÈЃ©Š¶–ŠH‚^u™¢JåG0D‚ZâV¹¯FÜ3B!Äw?YMqþÓTræ%b«$äq~œ‘êaBU¡÷ó KT+¡¨”"ÅÐJKfóJ±1ü¢/Š'É51C×LxüyÕÄp1šÏg·M. +Éüªy=U#"›¿Q5sý¯ÌJHBÄ*„±·ÆcÒ=v íïÓù>Ý+4B®ŽÕCsùL†îS3"ûÔŒ.W’ªxТžÏSÏÇsÏxb÷¦*{ŌԼ‰ìS#²OÍ+ûÔÈ>5›¡šÝ41CûhæBÓ IIоÎ[ÝÙ‰‘‰Â%#†<1O›àO ñdÆ£O›éõ§îÔ©±voš"%úU8n²àÐÌ[œÐ=QÛ)æìE{idbèU3´ùÄÊÆ¬tƒl̼1֞Ƀ ‘O¥i‹ñ)J±a¼VNèy‹ËHQE1N²Ùân´&—ËxÕ*ÛÛ)g¶bAŽ£SMÍcʼnÆÇÝ•ÈÏUEâcÙÔ•mFªÔ7J Š<:Ú宕Tr¡gD.È)&!òé¼×CNµÕô!—:I#F›„¶˜œe«Ò*¨†,u”­&îó嵌–«¡Ç«›øjœ8y'W-^#L{hõ9éâó†'^,N]¹øxEýqlŽ _<¼áÄɳCDâò'~ƒ¢q 9B6ç”áwŽ=8˜çݤsúL¦Ô9u:ÿÌë!¥5vÑ¥µ}h¸MuJÙã·´µŠ–@ÎPIÞ2´ Mƒµið¤)Mºq|7”š™Î?!eCzŸ—ó ÏxH3ÃW…l#>6+>6±i á"~›X”öN?/9g§1šyk3§Å"j>ÅhLËI›¼f3Ûä³E”Égóœj6ÚFA*9ÍJƱœ³-ä—ý²|M}¼œ5v–oFå˾àÔÈlL›O6|gj›žÿ….õ)Yz!VÂR¶/™…Ä iYÚËWÎJKÌ%Z¹"}\ºKwÙå1ÒÊÈ.SÑ^æb ¬µH-ÓSH Q0ˆŠqÌİCìL¡êH¼Æd̘Œ~N,΃Û0ŠF¼§ª{Ôì¤ÙnO ÏØ^šŠí¤ùp„3{p¾ç˜à‚(€\ "ÀÀH“  +ö/G§ØâÞJ}çvCÜ4Y|žŒ&(u0#ž7ɪƒÞÍÁchäÁ‹©8΄Èe< Šδ3æHq‹Qâ8xümÍéJƒ0ƒ61átu³Ú*V¦;XS'¿FH©hŒb×T Iè¤JJ‹ˆ1™Ÿ +2AFˆLÄ…OÑE5$%Žã¢y½f.ž«¨¤d~UTÚ¢U³)MµHB†ª:aJ™Ñ!ª© )‡ƒ(8*¨Šj–jTU-"¶VãÂERÒZ|Ê‹RùÓ! E="yKlGÆDdð%%õÓ-ž=b‰ì÷¸8<2 ©q˜µz¹ü‘ÍKËéíš”U’ÚŠí+JVìOõî}±"Þ}ÍÔk>!ö!á{R6\•¸·õl¹1Q^oâ+âsŠ™£¸J«‚CÓ_¥KòjΘn Uÿú|ú›Ô$©þúæ`}Dü("SÛº‡Ö¿~œh4yeâ¬'‡ÍÓÛýS«ŒJ¡‡Ð!¾|šïw-£ÒèãgFôPhšè€$N°ùÑGò%äÑGÿSô|†DrS±»exÓ±áÔLJƒ¶ÏÜõ-kñŠ©[jçWrHoŽÈ K~’ÜS"¤Ælõ2÷¿Ê¼Ì!]¯:Qí„WåÇqÙeìWåiQ4ùª¨Â-(ãÔk–‚ñ]¢fr‹„”Ö0Κ ÍŒWƒƒ—íDì7*4Å.é$‘¢8±K’:3qUf:Í*gGä&§Ò mœ +"úœ2""ZÅ”mP‰ç·6©„´¨èP· ÍO.í¦°BÓ yÔ¨z%Vº&9(D{“<×LÅäœp'Q¸VÞ=ãi*;U©)†Ú YÂRšV½ûh¥CW¦Sk5úF½D» ‹<êZ³ýjdŽö´“5ò«ÿ¼F­øÙI¦µ—ËûEÉåV,ĸ7EÑŒ ª©5qx $–)B¹SKB¦¾-y£éJ…ö@†­¨Ô¯ÈFÃ$‡¢ãPX …ƒ¢AÙpDóÐ2Ha0(•ÔeˆIK·‹&ÌÃû‹–ÜZ2ÐåÖX¢<âÃGL’éòˆ°1­áø‡5úôþæßEŠ„N>)üÃêµ1Y¶Ñö~I©±XPÇhÆ^ÿå¼ñÖ$jP>€XÜQœEL/ëkçd{ Áäë¼ïUJúaSò!e+kûaEÊÎ;fR•Éë% ¨|Fø©þ°Dò¯H©ðˇŠ=ÝûaU4õ(T3ŠNûdØ~X`Ì6Ô<Ǧôùa& AtæÃúÌm…ÝQÚåÊ A‹†Ëft•à¢J`‹°Ó9åÛêå‹Ê€!È “éÀÏò6ÑÝ1‡ò3–2¯›–¦ŽÄ"4œü ¶=,ã jC{XB¼<±&îøß.1Ñ5>î˜ÞχÅ%!1ÅT±Ëu ‹”ÏŒ˜¤íÝii¥Å¹/ˆÂ×<{IW –††xpéÃê[If +ÅùûÔÙ‡%*³Æ3M*>¬þœŠqe¦_ƒãÙ¤ÝÂ/>£a½`8Ïp¤Ë*ž•”>,ÚãR‘-xX^yËZýÎÝÉÃú: –Hod¯Ãš#pwù»c‘:,çF*¢›Ý«1¹ëé°üêR_BhÖatìÑÊü+ˆäõØ@Ol¿%Ó¬!–÷–wŸ¿¾lÚË7«­38Äcë6VRµ"„X~þË”û;H›îk­B'ï«b•®C,prI󭉳ôx +±:˜¹l$8é¤qlåj*yºVX?ÂT;,õ)Œµ…º*Hf8.ë_E,Bq±4¡¦y[áÒr«§¹±E,ºöùh±¨cÄhUjÙ.bI‡¶° àA« @/:u’´ˆ…‚‰ä9ärh†HÄÂûeÆjlõ,‹N¤i€SD«e0’‘}?žD¬Jê–`ë¡Jc›Xø/×1ôß ›˜(M¬·Æ:÷1 ô{ËV,Äþ£_•·f+–@¢¤O+%• xr€ +†ks‘·y ›-–fé,=<ǧ"-–ÂHþÞYe‹5RJæËV Á0ßb¹¥"[ëT™¾Òn±âM瘧íÑ;d„-–ŽÕŠUs@¢bW[¬Éñ†d ªn +‡·%&Maô“².¦X.Ó…GuK‚%ÂÄÏXÂL™ð[¬@º¯7Aé-á¸-Vœ²‚=y'Cù¦¿Årž+j˜úªB~Ó’ËÁèðˆuíV<æwNŸõ;Œ[¬Ç‰»\¬@».ãDŸYˆ Žx±Œƒyvày4H#•Å]¬®Ìá`5Hr±tâ°J±.+ܪ}OÉÅ +¢Â]¥Nò²åb¡½±C¢Þ|+Qm±*ñ+þ¦ž5²“û-VL3ƒÍÌ#Íá ÌþÅs ïJê-V\–äÎn6±Ùg[‚QÀm¡Ûb…€ÇÑWp‹õ|öéÊ?Bre¨ÖæFDdû¨*±Þl9(ï[Æê¨Zç24ÖØºó†ãÊç†×Ôñ‰ÆÂ¼¨R‡Æº ´åüLcEæ­ððhô4–’ÓJçf+íÀÒX ‡ >à/ûß ÷Å‚þ§ŠûÎp{PË!Œ›Ær#áX ^‚îMÖ ÷ª–S KÁ£±ÛhðŒ–am¬íAA”`rI¸‡h¬ÄæÒ¼–ɦ½_¨y1Å‚Xü¤íXHýMÊ  *,ðÜg¬òR'…š±v„ÜOÖ°Ädµ@È•::ï«ÑLî76CfÆŠMvwø2 +LfY Ü:Ž dBÇŒ…ŠkÁ¤Ð  «Þý¸XHœu-4ca]6‡ƒ>£ž±ÌžkŒeØ V©‚Uû6|Óbè)ÖK›Hª+]iµ,2ÝŒ…·¥øÑŒeÃD£ +O:åÒ0˜TVÌXá û¸ÝãÞí½€wým«‰¼þa&VÆB<ù×GðÉÝá݈ñ&e,\0Ž ¨(¤·A ØüvËXpèö~Vκ°kÆŠí{c)€"®Ê°ÔùŬ ¯0ÀcUX¦ÐϾ†!Ø–]îv,VŒ•l§F,r1–È gU)Ycôƒ‡ßÔ{ ¼mÛ;;ÌËX8ï–†þÎ.zQe¬Ziûe,>›CDuÛQô²_V®Œ•z4Ћ#cðXêÐH¥è•±B㞸¹³‰de¬M—£=jÃ?ŒÏB‘Â:ÆŒ•Uºݧ†²µ¬HÒÅ8«ê[·¿¿°0çìó5|`Éêf¬òð¿˜ÍXrƒî ¬”73ËÜ@Æ>øÔ“܌žÑNÀÇ€TÆLf,Ù,U-dµŽõP·ŠoõÈX1ý4šŸ¤ˆl—äHÒ{¯p[)PÆŠú:6AÊjo€*b×(ücG}Ügb¹Pâ·fÒâXÈÌŒ“Å PÝ¢ŒEdY'9ÝânÅŽÄçLÍ›–±6šòJ)"‡p¬’¼Ô‚½D2UÇ&ÝŒeïãy‰K}5¼<°5ArƲ1½´Qñwß‹Lh1¿´$üˆfoª°%‡ 5ö“X&0¶ÿÂÈ®!Ä«`²m‰ëŒ5iD:ˆlºÖ,¯½±Í˜±po Bé6åìv3Ö¦­qUhîà2–å­à’Qõ¬«‹¸å26"'iÆkd|l]Æ¢yAv—ÀiÊù‚Ã&P:¸Œ…ì­Ãk?"nÚŒ¥]ô…O ö7c¡õ8Sý f¬À¿ÂJx:»X‹Ë9¡‹gEI3b0°]¼`Q´+3h€¾­ˆ¥Ûš±(UœcáÚîLY'ð•°Êê<¥+ÇRaÿ0j:X4ûÞæ‚`I‚’¸š±^b½+Z˜±v´ÊìK2$>̓ •ÒÃïº@4c•®´eJ÷ýjIL¿±¢‰$³³Æ÷ªîÇ|‡X]•UÛ08ÖÁ©Žg,E8½XÎ&DÞöQWÖ•Òb (0í,ŠÃqb™U¬U?Ã’¨:gJ(‚2hy(€º$ªX =ÜõH²c=¨ö¿‘S«X6¦ ¿O›Ft÷N—¯¨Xßý@.2,‚Àuý× +™‘Š¥3=ˆ ÷ý°—Sñ©ˆ]+}D,¿z߆,1miuÄ)Þìb T“E…M€ÛÏÈ€¢ž0‘5¤êäq¿•´ À¦‹¥šÐÄ!DQ+|ó½‹%<+å°”ÃY¨XYÞÅÚJí¢ô #Ÿ.Öª¢œçO½v»ÐTÔ¼‹Õ·=¨!·-ÖÅj +;T¯ê·"0t±º†štƒÈ¿¤G-ºXe÷mâRûKìbqÊjðx½E»XR>b˜‰K]¬*_Fpû×ãfþ£‹õø_›ÄS£VÁ®]¬˜„rÿÍGhÙ¿‹z þ¥´‹¥V•YÐp±¢ûž‚L ’}« 5P±ÓB¨.V:¶H(¾œ/h‹Û±Ð¦6‚ ½8û|±‹uÜ1}üºYþsSib-ÿ¸çÄo\òpEŸj×…:³›ÃÊ P ®—‚;^/½¾­ßƒu¦AiS+ù:þž¼…“e˜ž¸i¤¢s¤Eú‡wŠ›š‰í5·LÞ}OÊia95—iéat[›„a “`fæNwãïI¡Í|uÌצÿј¡±IÆJEÅ… gï#ˆNÉÒ!‘<–¦ž nJ¾&¥ðXš¾DoûP†ñ–cØn"ÊdÞ¬Y籞Ž/†‚] ]E÷ÕÁ\Ab¥oMŽYd ˆ?ŸÎ&žÏ".Hþ=‹€‚'\º?<â#¯ÒÁÍe.^©6Œöoéy´*§írØcàl‹¹ºT à 5mä!ïTßèÝå^ÉÝáSùhˆL—ÐH’”$|-чyÈÓí ptørQ•’;cñIJ3”í¶üȦhļ"‘ÿ4ë#ã®±¾³eµ˜¦i|“‚øí`J= -ý¢&Ì_꣙•mZ}° +9‘8+Q¬CWhlU!LJ欒}Ôš¶§ˆ}“óT0¤l‰öŒéQ/k“Û*|òÁ*6׿g?æž;Vu+%¿²f ?>æ-Ø;íBòÑŸøa< Ûª„\¦ à^þh[&ÀB6¸«„a/¨à‡¶Zéò‰bGVR­å…´YúÌ!À9,mð‹ã«sÈ4uÔˆñè©,¿°„ îÔõ­“¡ŽÃ#?ÑÀ\Ö/£)åÚÔÕü åG …q^Ç ø²öö54#´)6[MÄX!¯Ê-Á3˜žI}Ç.¬–† pÍ fþK>E^u€rnUH¡ÉFº>Å´Ú‰·éÊÛYšåù."Tfþh |윅3ˆ,Ø‘‡d¸ƒSÝlø#×´a¬ï$æ„\³€˜Lr\­úRök¨²‡Ës§œ¶&¨ÈiHr2?´üàxš7ìFÉ£7ãþø^Æ/FxÝaDÞ,"LóËÕ•ho}¶;$£Äø +ŠÃäK= !ÌO`E`¢œk[¼ 36¬GF4’6âã‹,‡aÝ5úÞ1йuáýZÃÍ(ÑÿƒÆRß'_ÍútÉÃZvîGq–ÒE°ûƒJ¦ÑíU +¨XfãÅòÕáÏíÚæ¹ÍwTlMš¢ä‚^ÓNéT%'¸%f ëêa«X…%#‡ &ÂPæÊ²°ÏK¦v~›%¢J1pIŸiØÈØ +äk¡#õVõeÊÖ Žë”wôñƒžPXNþ(vö•A>¨/:žÆúÎÓœ+ÍÞUÞ;±D¨¸°^1[Já©õ3]0¸âQZ”2·ü+G Ik”0,°›r|²Ñ\‹·^ÆÓ”©ûÊPªõÓL{²¦”PjŸ¤*Ï©ÀþÁ3g·ú#…‡çÕ£#G,Í¡dØKD8Ó…£¤hET:Þ-¬×‚  X©ŸÇQ»’–Á븣á™g/èd^ºl÷¤Iq¬Zž>uÈAsQñmp†µs)£ÄD#4ݨ¶ÌÊy©­b8–`I +xï_Îxøž´"£E+#GølUÕ½d°~ap3¢óÞ •o0 %aocNkKâ1©~ØÁLÃ0yñædÀâ4ã7©Ä?ßÈe"äëÛ;F8£F­±˜Æs;\0÷žFåh}I06 ”*”F`V@\ ð®±(.º¸ôe Ô$Öx 9-Ú Ä‹ÿä 4ºf9+¿÷‹<’ÀUXAy0ޘ⑛ñÍaxÜ0ogo°=X¡ÂL²Ï*ïA¥ÜíÅË+És´IŠçnû”ë/ÜŽ6”îæÍÊÃúNšñvPαÄö³15CõOA ÿöwsäEpÙî~ñúžV2–5H»ë˜ÚQ¤Bñ{>ýʰ‡BBŸ±ÝA§‘´íà.ÆjJëêÃýÁöcn´ý…Ÿå?%íÇ'ÌŽ +v–Êú´Á¼£‡í8ž¢R¾£g5µÆ*Y©ÞÓŠ +XÎFT;ÒF„éeÏ$Ü‚5,x6bÉ®Û ³ina$—6P?Å­«d¶e"mâý\ºÂt».—ÛõIÔ%‹îsXÆQB’ÚéXX$>×ÍMr!H>猌oE@ÔèÓ`ó,Z<åÙ^Âz ‡‡hkO&Šã^жخÇqÏÊ AdͱƫBoEð\ñü†ä¤tô™öcØkujÌJDúe°!µÓC›Ì1WaËRÊ©dD èërÕÉ•ÊAotª¯˜å:Ñ7ng_‡dLqtœS±€ðó(v»MvÍÌ È³ÌxHs=á#WNõa–ÂÛ†‡{ñd?OCSšÛ¾ÀÓ&ÂcÃ.Õjç£Çf…Õãîäž-"ž¿ˆv4 +ˆn~—œOåˆ05x9VU®2V±¨Á"zk4¤^ +<®é¡ÏøO”Ùì[°hߨÃ1po]†ŠL¾áâÈ õ}ÉXà†VÛ¦§ã gh- +7YùêbýW‘ ­¡~/´AÏy»øxý °NB¸û±Á`N"•Võ]i‚ÑF+³šÄã’{²‡Ëóæ2~árø./ÿ„k×‚í¥¾mƒƒáªðjöE£ß€ºNÔlKÂHJD\d×0i&¿"jFÿŒòÌ21&–0€5°{ŒñPaö{L3—‘$š8·ê@/TæžîF„i»|N‰Ôðæ ¥÷œ6Ñ[æ`J”NI!ÍiL€e",š±ã»ÎOü„òT+# ñ0ݲ6Y@¨2|ü+¬íó«SÐáîü®?˰}I»ån¾zÈuǵ-²[½yh¤¤ÿ‡®ÒÌ%{q:­çUY¡Ý›Eeu¼Í–æçÕH/ äàÊ­‚˜ýyóiÇå_ Öw$œFÒÕâ\E5¾Å¥€•šÐQ܆’­5N,T%(QÓ“JZ{iгà´xrËÕúaÚÐ6h…šB7^ûΨ´ÅµP]"Ħ»PªÖ}ò«ÙÅ^WZ;­˜Ñvä#b°1´&°=E÷.¡I ªRŒôe—Ù¦ ¬q3òrn0_¸wDÍ×A§, û;yÏÙmÍã)Ær>Ö4jó +ç<ëó®^4äÓå%CxÞ ‹ìE.ujá€E_QŸÓWT»¦æsoߺ_{'£•膰;pŠ×xZ¨¦©®GÏ +Ï€TÖ*òqÀgä¨.q°//ZiÍE"Ášr]¹§Döusöȸeëμ%œ–l)š¸<`j_ý÷C‚¾’«x°Ô.Ñu!+|y÷ýú/É++1ÖCçEPš3“­-Ž–FMÝÃvÕZ,䃸,Ù†”pE†%» X"Á=U®DŠ toÏÔÊ 6üß>_8 þ é­ð™[á\úK–ÿì4Š·àKéâq#ÒfÅs—=éøÌ—àîØ¦ ù )Ö)·„1ƒõ‰¨Ç^¨bI#[ŸU¹6¸–¢£‹¶—\³ i)ªª¬“ Òk"8xÓ©üÛ"ö¼«M 0-CdU +KˆQ«pCi$‘˜®ÏŸhÕP»ò¥yä,ûókñˆ‰z7šÐ}ûºånQÙ5•„DвnáR¨* ZUØÄ^/0h«vêªËh]Šä‹y–“hn›Ä,«¾ù©³Ì»Dñ¥rUK¸7Wñª õ«•‚äo÷¤dCAÑUcTSƒî@YBû¯Ví pYVL{°Ps÷·Ý;®¥^ L!`¬Í°ñô€»À³ò<(ø˜^JÕ6-Óf…"¼uU’P~ÊBÊ”ö,‚˜~h€‰ÊÕ5a ÁUòÑôóÓ‚VŒyJìëÿ/ñIã8‹½°(þ0º¤rž"PW–ß"pêÅPIÕß™øeùÒgè:7©ÔˆV˜%cîs +6аVC†*ûr92`ªÈJ% +0á©Ð™4ðËíÓ•‹‹{KÍ•w{(ÃVüÃͨaæè2 +Ãs«ùÃùÖbÑokï9ßÃúCs%¶~Å?´ d®É ‘5•ËÙ%ä»-Š@9‘á’ÕnþÖŽ@ñózÌr7Þ®‰0šÎt° ¢,|(ÙE/P×ÚgËYL,˜m¿(o[ È„áµBc×wbì…ÐÙÙùÔs(ŠšûEÉå8[ .½0½È–ÂZ„¬É¼í9eî§gZq–°µúÚu4h댣]p-yœÌoÂf¹Ë“D†T•‘­BÇjZS¦ƒ16Ui®-PõÜ‚®D-‹zO÷ý‘Ð!uÇ‹æëD[ŸªZ^mR:.è‚b’iÿ¹¯~õm™+E.¶÷*Ví%%©¾hO3@ì\¯C»&ÕŸòD"f”æ0÷°p–hNŠºqøUÂÒR?µr5N#——Å‘«¸Ÿ6)µz΀lâ\¹°ìruÞøë§ŠeˆW+ß‘MôŸýˆÛfºm)ˤÜQ‘ÌñçòÎÃG}ʼn{WV-41ç ƒø€£—[…ãGjе!̯)¡)d# +òY`ÛYÆ"â3c ½>Ek)¨§k)·…ä“ıºÅ/éõ”U°C 'YÁX:9œ==|–áM¥ + +‰BÈ–ï¢TÒ®JïœÖœ=eX8ÁG¡Å_ˆ%‚/HËc" ƒ“[¬ç°õi«†É±ù,^ïΠ¬5ç〃L¬jD)#:ÜJ0îy¡ìòq+F™:+òž#¢ƒÆ®ffŽ…Fô›rê?A&FŒÃ¼úŸÙäk ¨¼ +NðÿsYúÖ›‘lBKNÈnÈè §^í;cØg7©¬X/¨ÈQù¨˜§&0qÄ[~ù×§TR}+™T4Ý¿c¿#U÷††«+ÆyÛ à)Tñ6u!@Sp¬K-4:úx +Õàˆ%˜idOîßîŸCD@ltL¡z+{rìËeb»9¿\;£• µA"8±¸×…Ú‹Þ©»®{ä¬=îÍ„ÄÔ>&©ØŽÐ¤,n•ºž Ce@ù\Ç“ŒÉAZÆð ÜT&'£e›—ü0&ËÂp53‚B*Œ Ü*ÀŠÞø —M +Û‚+îQaSÊó ØžK/¤JµÉp‰L1. ‰'x|ÊP #T °î¢àLí+F'G˜îó:<ÍüËY©EõùÝš¢_†ÕPßëš„e$-˜hò‡âk¢â œ¿çÚ‰ªLTjшT´û-ÈíjùòWGv"¿ûpK²Ï O;Â²ÌØMH.k¨ÊAtÆâyçÂáÛÓEúª'ò¢Dðÿ@òøR›tÊU„Ö…f[ ü™œŒñLs‡¶Êk÷v'ÛŠ?³Å©Æ7l¯•µQàYí®´™èò$:MÃkAu¥·øÓ’£9$aÌÁ0Ì Ò^·÷d©à hµ·&ú¹0g”úLO_ £"iÔ“ºIIJœ×|z7Aì%Gá"ÌpCñ„=‡ˆÅ=ˆà¸]9u#z ¨¥ÓÀ1mz!En?Éy‹—¸cð-<ÒV-`ÚÝ%6:J* à8µïG½'† +ü„iê¿»†ÚºTêTC[¾f–=Ò|iä|¡æ!¾, þ‡ÛT*“L`<Á[ŠŸ¤4¾¼–K'\Ѫ~‘m2 ÚW>F ²èUTÞØâG¾ÃU»õñÍY Ëþ2ÓŠ 1"V6¯þr¸\…Uø&_$Ô]„å¢:*ÇpÒðö/‹áë|M šú“£(yžÌ…E2Y²®…˜VaÏ úÆ4ͤ Ôžn¹V¼Â’â-®­ÙÒ¶eÑ¢W.ÿTü|<•$ýÖ|[‹†c'×{d{‰ñ®³Oí‚m9ð¾!üÛ6›8Û#—àð'wâ^ˆó`æ)`ô„ë噜C'§Éi1Ÿê¯Ð@lMÀí[ºG·zm¹1çi(l—öɃÚ"¤@;a}¯¹íº‚ŸGûäÌÖà :*yˆ&Ø}ÈAú?‘âP`f/¼Ë‹+ñ2 +zùð,íMˆB/ЙÈÞìMÞö­ì€ÿ"bÌXëI¯ º)øÑÃß Šb.H€Ž‡Mñf^; éaaÊx¥h[úyxÊÀ’!N +¯4¯õî”PpU\c ºk©îcÄt…°ß.$ö¦ Í´Xz7£.’_T3G†õ2Ÿ_{ I –³R¶í¥ËQ)vS„3ÞaPãÕÓgïò§«¼c´‡«F/¨=êÃDè5¾úBN—òÓV_Cj,xÁ–¢U˜Mi~Ûð€>õ:Ž¢Y‡_¸”d†°ñ–ïÉ¥öë Ÿ„. 2›àé­I¥óãV¼Ib+ÍqQUçh™È æ¦å•©åw“ßý’LmØ­¹ :]qyéþ§©!3saH[Åï$¡B8ã%åÐòLçh¸ôÖ"†³Áب9f´  Þµu·‚A¯° üÌG‡:£P”Ùá¿íà÷²Ñ¤^¢GYá-U}”–Žºú÷ZÖX¡¼C6kÇ †ZÿAz'ñ»ð3ºæ¹¹« lsŠHsüŠx]`(øµÖI$´……¸¢in¶ÿÐf(a9pXæº^ÑO0äD•+Ànn3‰6˜è«¦ìP¨Wpð³6ô‰ìG@Y¾— +QÀ ZÄS5kŸFp¤!¦MS:AÊð²ÕläB+â›Z°qØMp¡÷²ï@«Éf |ހЂ“¦ù’ûðñÂÆø °àPÿy)\ŒÝK«¦ôÝQnšHV^ŒXJ8Ý£3'Ò3‚ªr³ºMeZ |K+r§Ÿ8d*n|c‚‰Œ=”ïGf(5£"ÿ2-&ŽÕÁ¤“ÔeEnðà¦ÖJ jüJ^ulº…¢­¥¨ä6®*¼•ÞIS+"O’6ü%âÌ. J |vÔ‘ø0ÉqMŸ “±~»käPkÓ²ZÖøü 4n ~³IòÔ¾3ØŸK ¼ Ñ!‘h,©RH)hÓ"OG9ˆo’¶8€ùO­1ÝLÛÒ:ùzàªOj¿_‹¨Kö?¢ØcUJ½²Ê™#ýsP 5²³7Ö zb»sbZÂ)_*r{çŸ1+éâ; + +#Hy6Q;kÜ« +)q6ŠZÓFÖS€P‚ÏÀ…,MGå†(ÛX¦ØÆì‹ÖÍ0{ ¢°aXºtÈ„ØøI|N˜€…Zé÷Ì/¯B¸>ÐQäÁj}Þ$]>”qi==o[ù¢‘Ý«š‡$õ0–@AÀvkˆX¾°EoÐC­Awæ3”KDËéñàÂø=¹bÓHÉš|Paꎘ‚åöáWBRȶªÇx!}ƒ »%§…PDzž|Šò”«ê>j,ÇÛË`>`N#t»Ösˆ>ðYH’:UÜ—9ØÞ8kȽãoÆíƒøB&0†z#-bEêIpDÀç0%IjWÜ£éKÅjØœ#>8Á¦ÿ:TL¼$Öo¦Q\4U1ôAñÁ¤Œ;Æ|d-º`'J_cëük‡RLì–l%bc·¨†JP! ¨u¡6…fQ ÈB¸0?wó¦i·  wܲÑ,?GÌN›s‰Oe.4EȶÆ$Ú<#«¢;_ø ­Û0æ¼,j)øMÆ Ãɺ¿=5v®xη§}O;ÂC.µÅ/©(œ%Cã©> ÂÍÕJ!h–uÿq¤k Ñü&%¿/akà–Äõ¬6q*@[ôqzí¨ÔþM‘zú÷õ’B?ô€Â)ËͳITø9ã|)o¦®Ç=SöÍè>È‚¥,‰ÃQ¨*dñòÁˆ®邇ڑ¢sü`q_¨„ø Nç‹Çá*WÑ ¥`á4"F„ç¹Ü0nýU Ûp j‘‡m†Œ@åy„…yô§Š³÷Ìï7ïìKO×ÄOʳø¤­‡Ï•€ˆ¸Å&°º¨<ß'ìùž fÜ ìB×¢l^ó‹’³ SlÍô%hÉÍëº6¼„”pŠ’/2‡Ç­}Z-3ã¦#%B›@©8´ôø“Š hˆ[NÜÿòÀӸǀQýŸÈ—]q·lÅ›g§sÊéŠ(Ð4 ”ËáF8tÝwC‰OójÆ}ÂkÎp}¡ôBrd·Kü‚²Ò{‹®…ã.]«Ø(°3bYXlÙý‡Ÿýàjå­Ë¦ÕR-r©¤¨¬Aâ›àb,ˆ’G.bóägaÒÃÅ9L¿’B¸¹¼ G¹b³Ê5sz gRz)°9xÆÎ3H0éUÂú«ìÏMÏØDÅŠþ,=ñí8ó2a³päÜŠ™ƒ«n PàìPÚèjèôK*Þlªƒš}¬QOëšW î“`Üvq¥HÃÁ$ÍY©Q¸B—¨hòøíl!?¢,*·"_[¿[R•O¸AÝròµÛâ ÿ +)g«É!Ý%Bx#ÑWÏ83@ S÷Gü¶É´`ämhŸ¡caÖI2øS^P¾E¹o-"ÆJ.cÐ,ßðÎ×.£wÆPù×N!…~%n~’¨72>ü«/ú‡¢{ÀQAg鳺;³€›•4¦€Ã* +åÉ®ƒu—„,63h²?…¸5H›†MŠà,èRÜ»Ðóþìhî]‹‚èdý/ƒjD+…‚pÀ¿TèÓ]YÄ*~ŸÂ ÿ¤Ó¡øt3qÜvn;/Å$‡¼à-²ÎÇ.êÈŒôÑD²'Žò™.ŠßÆÂåÑ…\LwÊon>”•_ÀžœÉÐu“GˆYýÃ’Ÿ,í(%i¸Â<‰&A“Tž9œ¹Yýs"¸®W«¡‘oêåƒÇø[¯`ꙊDÂ…i›r[Ñ?‡Æ2\E:»…r5>|ë°µëßJ²Î †bÎ÷ªÊŸa NÓ›úö•TTʲ\*ÌÁ&²Áª˜†²}0˜cÐÊE9b‹FÒ®€övV$XÅz„ž#(C9äoó4ÈE™=d®­iŠ0ôá27Ž ¾ +Ý 2X£\Â{Ïj²c\ÓŽ;u((3V«3ò«MMÆå/Ù.©Î6ý' Hßç£H +>кØöã«™´G’aºi6§ùR²`6dòh êeÜP*aðfØgs(y2-,©Ùï9Osœòxá¬É´n¤A±`a½Dò»*4Äê‡!Ťžþ·ƒB»ÍÍsœüÉüEÌpÀ«À„ˆ…9©BÅzw£. Ï2X¯®Blç,zl ‘AjXà Í‚ƒA×g#F’O2È[HÍÓH益nrÆE8•¾™úv»I‚ãDoØF‚;fÀ¬AuFm¼çögÍ¿ï·ã°qŃøªRàïMjžµä穨)¤ŽÏ)-»b³À‚ä°BP¢ð=p?ªÂÇ’GlV¨å¾÷ä›Û,=¶–غù…®nõ(ôYjªM«¬{%¨˜}î˜;ßó÷~vË|<þ£cãõÄÀ¡Ú2˜æ«J×ÕnG+Õ' E^A‹ ì"7 Á@ªî•`Hîƒñ’ÈBý((%!…öûߢŠUèa„ cÂé¤ ÆÕº‰žJ“à}¢Ž"Mür·Îù$¥ÃÑÃU &ÉH Ý/ÍO÷q[Fä!iа”ÅÛ>a$Ú¼½M—÷ø…,ãÖ‹5]ÄbÊ#ÿ‘Ì)Á¤¸2Û +®xýCé#A7È z ¾†$Ñ9‰”Ü£=žõuÂR„Rè¤{»ËoQÅÈb‹¸×º]Y¬lod¶ݹp4«[ãia"%0·¸ˆ2¯¸6èL¬ä  +¼Ú– +²˜1 ×zhH:VRý¦ñCÔÇ*<Ë}`³xÑS^q>'`é]c©’AÄâ-ŸÌ§DïGA;~ò™í2>$Ȳ˜€sW1Jyg\;˜<Ñô|âfàÿµ—÷êºÉÄFÄÁ†â<Ñ"Ò‹Òï àG±‡3˜ø¤`Tc+M'AÖæeõo\vz q’ônß]UÓ]õFNB‘&È-²!áA®Ü™U±Û™ë¦ü»õ™ÆÒŽýq†#‘CžØe¼B,p)§ÒÛ…jzÔÁŒm†¸+Z]ÿ¨oªæ å÷y×5‚2ºbYuΫ¯ž¹FÖÂåôéi‘Ž#ëêy:-ÅóQrŒ‹ÊGåoË``WÉéãË–û€%û%Gš<ƒ­P=rvXÄQ´Qø¦ 2a%-°«ÕHâåœ($ï=„²W?5v¶óÜ:ØÐJOÀão #×¾ äÆ4Wä$/ UJ–ß_¥=ºÜåDóL„ÐED‘µ!"%3¥šðL¤Dm2$„åu}U€œ(¿Â*eN9Çh¤©SÕâ‘F_WÄxWÀ ˆ$XSüsD-¤.¤q\ãaF­&ÆòÄ+¯²)BÔ†GkƒšÉ2RÍ[8I‘ÕáÒÁX™›E&‰œ«žßz4ÏCl>FHƒÉhÀ}Y#ú@pàZÇž1)ƒ +¨/òý¥!f‚&…UÕ‡¥rTÃÄÒlt9Tö·k z¬A +ûã…–@ž tMÿ?Mù Ò +Kc$c^Ë EkÎÕPœl•“¾U@/´É1íd6®ìä0u@èÕ¯ƒž~ñœ{|†_¨šÐ?36Í +ÜR"6h†js¬Ã‰)õ +ü Šc™Ç¢ ù÷¯bó*£‰ô_%ƒÞ‰ª0ÕaÐ"ÂP@–¨÷Šÿå€YCžIõ ¦§Ó SÚžOo«4¡£=Q‘Üé¼fOa^žZ'GQ·ØæXY<‚×å!ˆYóu6ÿì,7‹¥† ŸeœkSPµ=Ã!¹wK»ÌÅ™°] +liAè-$Ù&5‹>*\—‰Z®¢m¶¤†¶Q’”{Jš>ú}ŨCõ1Jj¡«\“FJýfTtq¹,kaL^)*¿u(†}5bâR­Óa³Ü:9:Ãä¿Bo£¤‘-Qƒðï”…ú7]àe†#½¥ EÂo±Yž“ö%‹]"LÍRâSyO*s€Í"¾R®5O݆¤÷Õó%’žÞxÄ]ƒ–°¾?UnkUÊ\÷Mö¼ëÇݸÿ.«‘¤``BÉË‘E©r¨þÄ †SV)6i¿@{Yæšú¢i;p~È¿çMͯT*|.ØB´(³.ˆ§x#gFC¿À‹‘L}Å>¿Ù7  +ð™ò®U®)J´3,ç¦táÏàͺ*Õi´žÒJ3r"HÊ&…L–·?(Ódê±<ÀB<øVƒøÀÏ\awyœ/†±qލöÀ?ôV©ÛÏ÷@B+Ñ9|)%3u +¢@–ah!7 b»MÎ.F +¡þDHpÂMEbòÛ^LÕï%9…:Zu]Â#ÈÐèy­‹y2ÞŽˆÂÑüï1ü? i”åËÙ³84–•"…/«áÙ-ìÈ+øÒX"IòÏÏÏœ^öŒ=ÊIç/bîHÜ$OÒ};f²Ãƒ,™ü+áO‰ÙÈ[çÿBÙĉÿ-oa'r}࢜å$q-‹øüQÒ¶mvX¼-<øO°Öú'ŒPú¶P!@ú'ªîØ€Ìуì/Ô‹Q±[cQädðý9USxF)ç“0u_4™Ñ„Ø’-)vz¼@±—?·/¨/ÀYªâÊ„š#€P8'1&ˆ?JÂaZF oâ+Œ’fAj‹TV°AȲÉÎzІ^$!±ùÚ”T« +G¶F»!-2¥Þ6,uË|vfÍ úÅHÖ-Uu9“™ÅWϵe‚¾K ÒfA^ÐÀÓ¦N0Êq‘&­ÀmÅϸ ʦ¾yv˜Ã&¼ŽM!òŽ)$û/Å´ F¯#*îlûAkrxÂÏCr)fù»†²›Ì<:örñ#?8ß?²náUÃNëÞ(‘L¢en0R}5B2ŠB\Æ%ô:®–Ù¦Ä#¢¢pÊÁûTìZwÇ/¾ÅLÁø`ÿ;!T‡^8}¢h¬^¿´eèù0ç"fÙ¹À˜ºÕêÚ8 {}ûX˜["ö¬j|þ’«à´ ãÕüS¹5“Dƒ¤P9¤Eüó×ÝóYöòá§òã Ìó7«8dbmíµ”xV§í¤5¨hëXvxމÃb6EÑí¤¡#؄ˌ€\^QÂÅ +ò AW‘q¡a²%ªWTÛíËþ¡ŠˆÕöS@ + žññ<¤âƒ”ê• áPW(è.­ü(æ¯DI¶›@äLß#˜›å7çlóo¸!QåY»‹øS€,û ˜!ÅÑ×µ¡–GØó¢ûr2`;9…}B1jòõŽžñµ;å½±æîÞ.Ðû(A¼F¹èXANÒTu}ï> Ü„õ| ¥ËïBel"krB(U²è0°Ö§%N þþïÂ_ËDk„Vœ&»/,€ÔI€F[‘óÿaïmSªiÖÁÂu±ÈJÖì†çB‰‹&T͸Hü! e×Åxå·š¥é5µæ[Ü¹Þ “Ø‘Lëçm=XkJâÉ>)4ÁÖb bXaCZ ^bVBÒš3ÀÀóö¨NO¿†`yWX +oÙã¹G«ùicÊàÀBªFŽ̓.“ur\AÂ)SØo…Yá¯G_|îÉ|‡•Õä—S²*â|zÃ-Ÿ‹#r@„··iWÇ §¾¥âÚZ?´¸·Äc‘ƒ[ʳÙ*ñä©ÄñSîûÑŠ¥Ò’nàTØ`·’NGŽÎµYh§5Ü›Yµ=×rß.Á—çšé…ã;>ËW®2V2ó7ƒa§‚˜™ß˜ücsŒùÓ"-©¥ÙtÔAÕ` +Ç)HËrEIƒÇ:æËs–í-î8èUû‹h½x@}¯ÚA÷5ðön †Àªú÷:¹–ÓÑ¥øàȳ™c‹+Ôÿ•uÑŒ×c”¯1›ý§\[ããÐ-*ÖQš®Îs‡mJ'`f6gE°ŒÆý6:ôãŽ6Ä}—3*Ó÷!ظÁ˜ } +‘Ãq¸Yp_0/¾œ„¯©á5p{tY‹íþAàVF˜ô{œ¡#ÛR[­Û£|sbÑ£Mlä—IB%Ÿú^ñç^Agþt0ðœC(5UÇ0Ó„õ¾óû’-ÎKËj¼ý3ı{¢MÉÄ ÂRó¶ø5Îä" D›ØL\bvîÞõ"¯$ÎLª¸³—[êàÉÏݨ]þ6=áOëèÄ8¡Í³™‰»)ÔP¬¿&²9ÀÐã¨ãòiX…»z›wÞP]‡"ÖNbצÕjšÏaÌE¤\:f ó‘¥4DŠNÄ¡(_?ïŠjv-t¢`¼À¨?!èò÷ +hfÉöŒHœ‡€·^€Í{7‡ì`Ü×Ì ꮢKO3»Â£ÕÂÏ0IÈ@W¯–e¹XHÍe.£{DfK§†óåqSÅð%¶b±‚Údä`u³_DUO˜i+LËf2' ·ˆW˾^d'ʃhRODT¯È -Ä”žÙﳬ¥†‡ðÞ \ÞkËy—¸FòhÈuR0`önŒ®æ‡Áßæ0@»2e.;Q$ß«MRRn®í8\¦! ë]6Ç]ÂX78•E\Þ„¹o¶TGò‚°€‚D)姪@B„ ÇPÞp_@®òËiBÅGa_õ|å‡hÉvPˆø|¢VS´2¯õ6e’ ¼²ꥀPˆ¯¹¿¯/•¥‚¡ý4¸Bè2`ô¡ÝÍÕÇ&0éá€æIÌF:¢ÎƒÑñ±ïq¿ÿœPØ÷ŒWLFØ^Ì× ¢Sm>à*VIø õmßô—!e÷z¼†¶Ø…\i«°O5åôâ0AŒžvlèaªv|—`1‚KÉWuy1 T”U*`øðTw˜ì¾‹ÎnÎ×ÙYˆÜ–¡¥ ãMÎ3Ô¼²YeåÏÝüGß=v˜#9$^Ãá%?Á¦yÞ䓬6åGr‚² ]}°0ÿ«   Á·LÖáV+°è5Ñ>mcÐp6ög°¯qzË=ÁH µ„ÿÐtÄÙÛl°ÍŠ5—€ÉM¢ÇEÇûºÀ±`âkA>Xðc”ßGŠ)@‚óožŽZ|²ære>nk£î”üo^pq¢ ™‹ÇQÉÃ’Ãä¸X ?‚¬†Ìé)0U¡åNwÝl¸¯äd/?¸ab$;ÛáÃÆÁE«xÖ}>,Jâܧ»޲?Y™ 8ÙóÝã ̰ÐYà ƒî‡À]nÂ|Õ1m0tûç;ÂïP+²BúÄÿÂìó¤|Ýw™ú{„+¦Zû]µ¯žQªÂqñ¡‚öö^Å­£Ç 8ø ñPÒJ’Å!Y³oÑ'w 6e¶e„JÔâ¯Ï¤øOEð7Á·u—L }k(·ô<¹ÃßB”ÆmmÀHñOõ?ýûζ§^Ò¡a…Ê»œ{‚X| é L΃+"¶êÑŸØ>é ¥7ûæ5‰–È,„$ µ/simÒ(¯É\Ùù¤*$rV ä}¯H¥Fþçì§e²­äíEWäòî"HHÔD‘'~Ü= ÛGì²ÕÕrSÈ:¤"æ ™Þ©»“Å^˜ÒSÀÄàAfä õÅÉ \¹"ŽÙLÒÏ;õGP¾>V’ÀŒG}t^Ðú#j«PÐ +b±Tˆ¥é…wÆøA¢ºïê Äç<4í KÞwH%0~Ǩé'û¾¨”=ÆH ¬.¾s­}+-ô¸@‚NH®ÈÍï&J@Ú·^Ù<µ÷ßÜ_•hÖIɰøýФY7-V“kß•ëQ* {T³†žÅ@'bÅQH‰mwØ×’º}ãŠ)#Ûw‹áßQDgÏUÈf}¢^g Çý¦™-­³œ?‚±3±âg EÁ·R <ýYÇ0jgãÝ‘´F?9Ñš‚>¬hÝÚ!I´—šBVªï!‰ö¤5pr0…¡*­CÄ-­73óTZ»"E`im¼A¢ˆ5à®!{i-­uÕ!ÌÄ4‹~˜ÊÁÿba.{æ‘>`=ù3àR—Ý3¬àîYÓª2œ¼gϪ\9÷kŸA8ÇõJ[«Üï|ÆbUîß!<;…j•9˜qø*WÃÆcåMžÖœ +/ ´ù ˆ¯±²…<1«¯C‡q æ³d¯rq’ÈËg1Õ*—_eC…ϸ=¬¤å3»ZeËà™5Ó’YÊàY„š”›§ÓÕ}=ðÈàaK‹ýâð‚Â…Ï);"PØÑÙšXÝHbo“€åˆŒßöÌ7j¤#áÅ/[Ýi6,…lG²Ë +èD^#«SRÏ^V]ø‘Õ9ËkþÅ*zXq(i2jÔèõ%©,\šÿ ’ßáeèÁªt v^bÓÐ"¨n²Å©K¶ì¥~Ó@ SWfAÐ4–è +rªâª0è h +p½‚­1uqœß4ÁR§nFW­§ J<¦(B ÕíI5µJâÖ€E§³ã„5]éÕ÷剹ŬBw.^ò¹¢OžVs¡GF5×N€Æ\w÷ÂJo¹aS®‹ÕH³’«T£ä2Õdìçä‰wRRÕî5uç9#kˆ»‡‚£GƒûqÍP½‚ëz28àº÷bø¹ß€}0ȵå Iâ-]“¹z‡êPB½>:[A­©&ªc8)”¤ÛåîiEu»èˆS]ÇeÂ{“ãÑC穎iÅÕC„4zê¶4‹Q+Û15Ò(”¨~÷Ò0´è 2‚ÉÈ”¡ Ãc¼1˜æ”5¨…„e1Œ+õ–wqHœ*5¸08ú¼@³ŠW—“3Sÿø!úkÖ6´å°ÇüˆÕ ˜‘IºsÓÕe¥­ƒ´ÝS2Êþ§öÁ&Š:…•ÄÍŒ¬’Ñ5Å&Ñ¢ ë+7 LºçO‚-êŽÜÝ*øIB`“_pàzYŠ„ú~ÓY²Ê¯ïȈ¤¥7 ið>Û,öv 2„Jt§ð„Åx‚†š·B Š„ÓÕY"@V‚¤xU2¡®.%‰<ÀAà±î9.ÖH8Ì€¨“Ì=ê´ él@Ñù€:Iê¼ Ø˜ç°Î¥¤ Î(ÿg#tÃµíª»=š:kwùëRVﯗxÈÀÞcšßD§ô"OŽZ$šá׈ºŸ„ëïÚà€t7ÈoÕT¹‚”E— ›€¿Ù5àPùI>¿6fÁAå—=]rä—.ˆnè#¤»TñÉ}6ÑUg7¬-è&o ]ω‹×´ãœŽ­î«æDíN·†¹ö9ºR,gòŸA¹NlHN`N!« åŠrÜâþQ¬7Íh`„²¤  ñ*EÏc„À +¡B(OºzØ2A9=”¬‰|vÀËœ%bØ ÒQ¢¶5'‰KhðUE¾‘ ÇbDœ.@¨ˆ›ÉB‰‘Ql2DMRÈ !¦Â¬Dk\€1ÐO  Ãghãç­ oU?šb,ãú1g™ÁÓ p)°í •lÄÓµW…œöDsÌ ÓÉTŒë¬ìó‚âô{4ØgZøo½TçO¶@R*ebúr¬¤«ûN'IqØ2[væVÍ™öud÷¬ôNý '"¥Y[åÉHI\IvFLwsо¼! ª˜¯h_pºc¾°äulY߯QëÔ¢6u#˜4ΚۓyaÁ¯¿FÑY©ë-úÌjZ¦+{Bä¶RŽ†Î‰F¤´X¯Èy—dš ²³ÔcŽ0Ú‡E‡8 5 A‘¿PHL[á +ôƒ{Â-2ŸØNk=šÎ¼ðÜîÛ½YpøÓ/K˽悉)jþüàü@hÇM:̦ÿl.o(óûs(•Û—î1{òÔ·sPD]q: +ﯕ_Õ;â)ï}ÉÝÁbºØ@G×M£”šæùç@f¦ª¬åö°ÆI¯–aÒ;¿Ýiª[Œ)¥¨Óʵ*ã@*ÕÀ eG:ºkØ5›‹KA¡1”¼éb/Ó•¬æšK}A¼ `Èæ-´°¦cvúÕt 350¸ + +Ót@8…f‹"kì fÒt2i`2+ºÕ@™nLSÕi7\´b[CHWNšöã®äÏ?øã#šè4¢!ƒ(7<è B¬€,G°©ChšŽâG$ï¢ÿÀ€F®D4¨Ëtìx, ¥=¨ + ×£@={<€Nàg¦+*K „‰î·Š7&ëÁÆø>ÕA°ã/~q.]QÍÀEUvsaé<¥`Ò¼ŽO@\ÜA. „fÄå”áÒÁb*¹tÍî. 6¹à¬LËÐÛUÅÿøÎYöGê&ºtÀñJmŠVÜqé„öûG›½íô«Éoý@¹t‡>å=¿T¬+Ÿ’ªŒ?B+Ÿ‚¥ M|ÿŸÒÓÜŸPé–uyép©ÅMÐy­ÿ +~S§>‹ßÓÝ¥çöo +ý—?Ûk糸8¾ëP»ü«»•Ï$Õà”<ÿ€Ò„ÿí”Ên‡éî‚íT¡ÑÅÐ ´ÅÈ>YI;ïz¸õ{Ö‘ø{Õ1?éHêÔ¥–Ó»:9éPP:Bý~άå=ï†ÅÉ1ëu eAöÑqë’y9NLŒ;ã†)¢^–0ÉF§Š1:÷nJñî[½žfŸ‰Û"¬‡èT:pI8‘%º?ÓÆº~S4jK¦oÁ˜ý—ÚbÓ:ûó%‡BwÎlFÉiX\7cL%1t3SCYžÜ¾Y<ÄM9)m¼·ÕOF«Ámk$$¾ØFV~jkmÚÝ9K›ÐÜ|°³5âÌà.›FWÈöFXàNlú²g‚­ÈH2]ym@D×ÈìxHkê±.¾kb°Äì­ZSèð<§f£Ÿ éÈúÿ ˜üišÔ>nš£Pqó–FŸâ7&iǽY +Uø›‹lI¡Å­3[ô쳺)ȳ ß©Q(ÝfQID±]3IùLó7CÃU2“{èfäÜ0Õ[vEܬ£tÎNc©¬Þ¦e÷gn“½*^6J²Fž¨ò¥"ôKð2ŠÕèoJwð¥cO{Fõ6ÖÝX&Gcù \§\Øq„QÊí¡bVLrh8Ö;½4*1þ()Ä–RîÎ3¹¼ê]ê’“ЉTr0¤0“ý‘sœ£JÃÁdäÉSM°ALÓ“M]ö¬GQÆ ý˪^³_.j¤ ø%µmÎ } !IY¾— O¨Xý¦ø½ì 9)É«“Ó¼ºÎF¹wuÇ ØÕy](=]Õ¼?²çRÖ à–«{ðA™ãªÚzí›áÊn3›ú–ãEþRI%Ë_|YRl)ĈAkµ[ ‘û¨=ϱÿhÙº}’"LÄèeäD-‹> +0Éj£ÑÚ5E@GX?ÜuÄAˆù€KÄÑ<=ô'}¥1<àýÃ!v ØÃ•ôÄípá8Ð|­ÐÅ7´tÃI¨ À¨áHe 2\1 +Áp€Ô 0.’¡ñ£Êý2k*èÿíHÕƒxA3E…ák‚ŠA´Pµ'X€)Ç +°³ØT ‚NÆ:]µ”ô U¥l¬ è­¤¨þmHeã#ZwHG±¾؉QœM„VQT«R8C¢Âœ€pÅ Åäð ªâ;˜×‚ÒhäŸÈà J®O?O ÜžT/8ó7¦<+ ÚÝo-æ‚/õb½üÆ‘ ‚~„ÓHŸ#¹I¶%6uÀà.ç…Àú&H?’í@mó@7àFŽIÈÀ+|C$^#½T9).9“T%×—GYlô‘7´“•¨7•‹éMúèùy[m`â’8ؼ!$À-o˜€b’7‘xÿÚÆÛûÜ_èiæöº^áíêß¼-¾ùŸ‡Ž¸2ñëÞÝnÍû¢a£!Ñ>" ÑG[}Lj˜¤_$™Î—j‹~å+Ö-fñ¡–¢›<øÀ>?Þ{ˆ³D–{ ÑíÔ^*…h4{$}èGµž$:D’ÔÁ I ¥7À =$èÅÇ ÍGy+t·d^ÁMhQ*wúp‘g7À84> +kÐûæE· eá2AïŠàáò@dãwU лlô3†«û€)OäŒÕ§~Œç‰×®fí™xÿz¶¨ÛCñts™q´pƒf€´E!{‰7îƒÌ a¢Õ–·ÎåÙLEÌVÔö¿µni1ˆÀ¿P,È%nÑD↮»áÖ¶^Âm”6ŽÍnþ € Ù)/Ö’‚mäζ°yp“®#³›ÿj€GѶzpãñc8¸W¸“ ti ²7žÍ»fxÄÕÕ^ðyø“>™©ÞdÏÃé«ÀÚâUŽÉ:s‡É¤y‚²R†¯h°×ü×ˈ¢„¤£¦†B9bb.ñ]"dŒÚC`²Ž¥ÁѰ $# B¸Çç¹ KÄ!*»çW»tÌÌf'îq…ßèRÚa(6qÒ°@õÀúã¹à}9-ÏT6sT[™ÝRÑÒ¥)r~ìÁ5 ˆÌ¨.^tm4ðàh:°l´°îs:¹ÝÐo)éAw¸^%åTŒÊÙukС[øæÑÔDNÀ¬*4p{ÆÆân†ÿ(TcTãA9Lz‚™0ü¢ß6HX 2‘îÁ<Õ¹Ó4½Y€¯Z\y~d‚Ô赋  ÝÇC”íKÒZ&Öø,éìb{-cuG¼ñœcE«´X¢9’Âc¶òÙ)'ÛkQ¶Œ\B’f)û°lº&šy{çòª·*dÓ.«¨(\ …çûJØ +F*DÇOìÎÌ£p³í*³d!Ít/ó —õ˜)ŸômÇÚGÕiÞ!EfmP‚€šzvóñ×'õcú¿È­×t ¿*¦Óö²ÌÝÓǦk+I/mºc°õL·m¸>š¶æœM.ýpä?o—P‡H“¯N`‘ÐÉ1léY‰4´$ XJ–eYºnlxÛóH.ÕEözñ` +ÚÔÒ¨ödƒꥅ*hi°µeEpÐÖN|u44Ʉ„PWµt¢¨méÒê-]*걓ÿMÁºõ·¥k…4²¤Dä/-­Àw?_º¶¤‘ßH´K—é[8A!ªf—2Î¥ÕÝ% çrÿcÜ[x·ÉùòWÎç`qh[;zçX)9O{`–ØÊ‹˜/s½»ãMòŒÇ7Áp»àÕì‘`²œ—jìÀœDYù¸§Ãí3לÏU°²»3ÎÍœ[—ƒ á\sGuI¹¹áÒas!EìúHÐiÞYš3Svöâ:j.§=6Gc…íó= QgœÓ¼™=sõ^¨ÓܧÃ+¥qôxü×<­>r“i.¨FAL`Ç–©ë@ged݈›¦[Õè:äðö¨ßDÎ2{`Ô—¬É—K}Ù_„“6õ1q²®£pêçQýÇI¯8³dxƒRtê{ÊâDõ¿dì1!Õ樓¼€PÀ³ú¥„5kR}ôôš¼…¸úHÕÏÆ¢!ÀU-ñä)Agdz.ŸÕ÷Ûn[ËU? ™H¨O,}‘?’h õcÀ¬€˜þSsGÀé§[f<ú:EHï ÇvCî†÷©m; }@³Í,$І>O‡±ˆC?"òmLú·—èVøˆpè7 +C>Ä?UîîCßH_¢áèÁ cèÃв|m¡Ÿ¢fÐ. ú³<ìó¡åôùxœM ýé[+ }X_¬†?xÁB”2w¸Ð§ øÌ?Rè{<ÑúÌ%›ýµÐßø~òb6 ý ð mœmK¡?Ô2oá%Ù)ôÑCÝŠrwæÃøwÔŒBMjVga­f7à“©™8YR.4æ.G‹-äT“¦×aZè¬Mã +6%§ <•MÓb‚¼4#c‹SgØŒEQ%MÅÊêF°5'ª_yšæ¾òGM­ZRu¶*É SSÈaƒ@#d ¨¯R3•‡í¨4>)¯‰Èn g¥¾³äú¦û÷üx Ô Ñ­”Lü&ËÚ„ØNQ¿ì€‡9ý…Bp'êþCÉ +Ý›³ÞàSÞ55ð0g¿3tº’^e©H`³3—c,”ZÞˆñ*0.›A9)ÁÖÈ¡fu€Ï™Ke•¬iJÒƒ"…ŠÔôùpQÞ4ãqíëh½¨ý/“€Š±\«1‹ŽdÊì:)­BF0Kº3àeÎv® ì´S+;ª™©²ž¨$kSûvèÅý¯ÈSÄ’#—аw’¨¨ßoeÃÚE 3| ͳ.³d4¢¥¸ Ò(“Õ=oM¾ˆÛ^’­mª†þº¨âknÝ•xðÆôKé}ÂH¸œ3˯í¨bÚ¨ÏýÁV¡¯-¯úÆ».Ï.IÚ„Q˜¡ö¦½´m/´¿@Þ]œk2Þ@í>JȤlñ5%« +ïpIYÒˆ¼â‘Ñ= Ø9†ñ’(9$ÑÄ;üÀ3g35|#A¦,è”.uÃÄÁã“SÐZZU0h¨;!Uí¯d!³4P¬|ÊaÅ/.ÿd‘lÖ6<0QÚUST·ñm +ÒiCº>¡$ì˜ïíîÿk|w٠뢈3ð¦m‡µx7B¨A"öÂÑz\‹¿ÆFApdÚ“¦aˆ[zzwÿÌÙ!‡Qm®ŸÙ¢¬Ï¯†¥¿ ¨Ú>÷ÏÓÔµªV•YdD÷(ŽÞþ«{GÂÞûÑW«8^Ò³)¶ààfÉz ++²_å´GÃPX¶Nt/’õØuw×ýn°§›„Í™j +üƒ›®ʧøã0Pq†Ã×ÖÙ 5}纇 Õ2– Íz4C)‰÷Ï7¢°…uØS¤f,¼ ÜÒju:—EO˜Ùަ™ïêÀ¢bLE•Ñ·]ÎN_åžÔŒž"|‹ÇЗÀÑî(áUüh “h@s‚ÌU˜øZæNJ3¸LöúSÙЪð  +"=£øÐêUf=0Ý‹ÑàR×òlpÃy töˆ< ÷*kTÍií`¿æÏ§¤D8»‡íIێ΀‰@ ]Ä{¾))®§±ð[+ÓGî½iï`MdŸî.¯®¼„^§¨ÀÔÔ¾žc•Š£vV-VIš|@î´¸ü¢"€)ðDÄTt І]޼þTa0jSY×Ìb#à&eÌÖªž•›Íì@׋ú#}tB³¹ORƒ€à…0¯L&ÍÇ8•JÍ…°TCí³WxlO2´„.Du.uÓˆ†R¢êú˜‹³Å†ïòõîp‡3KÂlÞ-æV>Å/|pŒ›¡ÎFD…ó?þ¦ùMçS| ßá¿D,zði>¿kå5éY¿ÛaÛ÷Ja¤Nœ©¯Û·àÝð8ûü« BfØ2ÕñZ¶^à%%Ñ]³‹dL!‹Ù`D&G‚A<}¶©ÂßÕËÝŠí¯¥™p$Dë6 ß Ï¸"[ö +þ›k‘3ÝUÊY¢Ê¾9˜¥ïÎØ=ZˆÍ1çŸ l…Á<„mÒÉ×kš=>=\+¾ÜCɈ¶EAÀK‹ðCu²È—T`Qà: ኇ6XQ6 :½¡á±§Xô1@·‚á):ë‚æ¡8eYþ‰×ª°g'–Dá8n¢z™p*1ABV—øùS‰&ý†™Äö;p;$¶½AŸ‘"3(¹¼€9*b€kÄE%Šôhš$‘0Ÿƒ@:A`ÇáxÃ0>stream +#¡“-ÃÖy5Ðkx?ÓtÇ(ü´SÌDíO¹—9·©’rÎtVQñ¹ÎÃB +xúÁ?¶ÅéÖ*gjb(x7à6ÿéÐ(¬éãöÝäGT·œk Å÷p.ÀE‘8#¿'¥Ù?·šòü Çö “L!Ý‚ƒ•5n;^ýdF@ÓìzÂ"~‰mJѦ#”×§qÙ˜ÙÊØY¾)Ê ½œdU¸%êðÜVåA”hånü1ôjlI‡5 +ÛJ²ñÄÑq\¨Å7÷Om°tH!Õè½yñÒü ™"ÞÌ N+| “ðº®R6?t6ž´TE˜(hN”/z_8]b3Š`­ïÈËw€žQØ›ñ2¯=æKÁ“•ŠÇÑsiÅÓeID`iÌ“0SíŒE¬zVqÅØgð1W5#˜1J +7Ì ¦†Ëe´´ðO“Sï¦d ôIQ®ôŽý‡—3 âšvö’º]5˜9vŠdwaUn»Öâ\’tØÁŠ•¾ Dµi×®Ô´štõÔ?’ª´0&NI®dî%ùEþÈÿ&­ŸamC†@¸›Úã3yxzàœÿJ*Œ–„,˜.=3Ó¯´_K¨•ÿÁZ÷ +¦•œŽhI´̈8‘¬A=Úq†Mã¶‹¨Gm»r”'Ô4¬jG;ÉȆÍ".KœwÙdeÁp 5.O°ãb×õ‰u•*î{¦»å=×ÀøîR;-C¸¨p'Ü$.¨%«·‰Ñ¢£ÝÆ®¦L’+)†p²¬Xg5VSû‹ £M1¸ÂÈž [.D‰9êÒXg¬ÿ+h¨ݲÆÊfk€ î_kŸXÆÅPÀä7ZD£û ++LÑ„\”“-ÄSØMç¢Æ›™ Ü<£™Pt¶JÒF×J¡?¼:ö‚1—Çò·Š7ƒ"µãÂ6msÇ ÿ¿ _sË¥Ïö_ñæ@BÚP÷YëGCmØä7é‘iš:!` ¬Bp²Ëâᤆ ™Q›¥;6 ‘ÿZ¢7¥Í…%(É#¼n1$V‹þ‰)Åe‹¸ÐÆ}¼³ê $(àÌ` !- _ +6˜`ôvþüYÔöø€vØW“²UT*²ÍÅÞrò¹gö:§§ò +(×Þ"¤Õàrl0Ó2Ô»YTë•NÇ2H¢lò›íx•xÞÍŸÊp—*ë-9)oÛãÔ¡N %@±~ß7d9þ|ór­¼Ô %j”LîÕHª*;¢ïìŽÅ5ëZ8¸ÝéD à~ÚÃF‰ÓÚ(?СUj-CeÅ(ƒC㲕î»Om¥pÄQÆÜ†Ž;P@Žz;15l¹ÏéèB…š¨¹¨8¢Ê6Öç9÷éÖÉB1Ì÷K:@Ä…kåBFÂ÷™KJS6¡yÑÈÊ㓲¥è[AŠ—®s^M$±$5/VÄM è1×vžƒ9x¥Qùâl¥ŒçM_o·,M·hOþÒµ0eóe…0Eoó‰Ò­Ö€—Ø +Ú¤š˜©€¨e‹—ÖQ5ÙŸé £B]FAøWKIe såq\ÛÈx¯:Á7Ù(‘D™VþèÇZáî=EVˆcÛ¾±È¦dw>žã8¸ò ›²LI“ï~ˆs\. +•° +tÔ?Æil‚m=ZãT¸©X¶õ’p²9F5Qî8#S÷|Zö/@wp³9¼v°N ÿêeF‡F]«®6b‚àft"²òìŒnØm DÄ?ž˜$XyNsœ«‘=*'k³CBj‘ɘF©xÎõøwAx3Ó‚’î•ÌK¶“ñs°‡‰ò-ZʺÓ0¬ K»r&Ä@ &1SÎ#·*\ªL­;òÜR‰ô£QìÈà¡Àª®‰õéu#m×+c’p¿8¹)㪟R«§—›Y:Ãýµ¥H™ÖeãÖ÷ÒÈ-ºüofŸ¸’QÊ"Š1˜«ðeU,Fœxkî\#Ta-ˤ'd‰Hжè”)4ëï °]i¹úAϵÉ%_›âÈV'”‚þwÛrXªÉ9a.m5¾(·I!†^*JÅå%/Ré¬_l°¶]ñ®¢à<Ù¬‘+J°ùÅÔ‘êuú×ZÓápì³ cÛ=ààïéE!…ÅV`ÈÓ3) +4Û·@Œ®3fù;`%‘µ—ª{(Ü+Ñê‡$ +Ü­c±hÁ¨XäÈMQc½È¤ÈÍCNÛÙaNeÂäö4Sþ¹ÜòZ‰éQY·åL6'~I U.•øÀgb# +è=Á[ŒãŽE9iA^ˆšÊ=<^A]Þp2ª:ÒF¦å¹ä&XíE•¥^‰J76qÎÙ›ùÆp?Y€M{zL©”ÙÔ÷ñé oõ {[Ë¢OèóíVÂÃBdþÂ^G`Ù‘Ôðľ9&ß糕eÖ‚cO!Íô&nâ€Ç[ª£É+;h‹ûð×G‚2Bß=c€%©á½LËÎð )õ~ê /ÄÂxpª\Çð8É‹F[²ÅÕ!óF´!…N9û øÝŸƒxÞ”¿»@p5,èF‰ù;é°«ÄÁÞ}¨†÷¡ÍETÄoož ¢ÿŽYU³—dÈß™Ûböô •›röïL¨²“N‰ì¿£vàÉ- uÀ¥ß=¨Xƒu'Ì_w¹åÆ®zäèÕ˜½~™BÝJSkoÞº ýËîñµ´çZwØ“`Õ­-Íß-}N4Ä“mg%"9sÓÒòžüB 4Zî~îåT 1‹ÛtÛMHÞßö(õHåºwÃH^`uµ޼l’”|‡P/T­KVÖ$ä{†Çn/=lK +ªu…æ +ãÚþJ]R°i®gìvAøÛù> Âi•k‰Ö®«£»êM¨ã3®ñª«sk œ«¾&Éê¯Q&lÕçG Ûq;¡Uæt? œ´1ûª£Ì,¡5Î Òª±íg[Y‹ˆ¢ê8óœÎîš´ªã‚Ý@USŸŽTu€F#ƒmÉTæràAÕÒz#‡XÕOM¾RÕÁÊu2asÖí×Y—·=ðº\h¢áJÀ›#¯ƒÌíà›×_–[ÒxÝô dy I¤» ïŸトó·ÛdüçùÇ ðÀÝl˜?Z£äï˜+ºMµò§8]ãzþÀÞÀógÌÇÉ à4—Î ùëËQ_œ‡ógJè‚»ØVrþPL/žoàò7n\ÿ¨úË«ëµ6¿^žv»ýÖáÆÑGÎ9¿ìnün~æÁ²ðñoþTç²ð-ùGĺ=…@‰ú þ>)Mÿ~›¼$üŠ4,{x‘IÖÅY±1¸døMìÊ«‚𫃄ì€i¿yÒëîC¿í‘¤Ÿ…ÄòÅÏr²3L±üø«È/ºÞ«wámùiߨºgå÷r +ÕYcÔòk뙸þy¾yE¨ÿî å°Ã->àùÃ>”~¾¢æÆuêR¦†_¥@„˜;¡›ïôªGÙªy™”º†‰'œ ²k¬s'›JUE4Ê~?FêM{h*ºw`/:ܨ¡UÏ_«ÞñØÖá* â>ü¥k€[½?ˆ;°.Bó¢“ ‘åíç§C5éìݬ‹†ìgÖ´#„ý–ÎAÕ˜u¯.xüSá‚òØ&öóá ªÇÚöÃlfm7íÒÛEÁÃ~±T”6ø~|ŽŒ˜ûá|;È}óm>ê¿PÕ'Ø}S„ê;‘vNÑ0û}ûybxƒ2‡kÿ}N9y=ó¾,–?óç°R`È9'ÃÊì:zUиuƒ ¿jºØ(À¡H…>ĸÿ>7kx›Oä­ ÝäÁR=LöŸt3­oФÙˆÓs¸0hñElX2ƒ\õŒÊ]Î'¬O¸~ì`/f‡äÛHÃÆ€ÄDãË-S—aв$†Lý8ŠÀ.6¿úÙÓ +æMb\ܱð°¦uIÆqaÜr£­Áô+QPäV´JéÑ'1£æjP&uw|PLg»üK羸°ƒoü¹…›±±h«vŒ¿< +ûoq~ôLX@‰æ³ïÝF¨¢;ïŽ 7Æ,õiÿ öëlƒsмZÿäÀ?~‰tïvwæ"áäeó75DPPÕÜ/èÆJ³Û. "'Šë¯ýë3¨ÓÄ(åÁGï©,ì=µÛ†¿ú³žKZNGæ¦`æ¡°e£æ[<15ûÝÉÿóÚb<’UC¨¨|YŒ¹ê7Iÿi’ý̸áiÉ_ø›”ð(Æg>š4¾9,—ßhGû®·aíWÒöö„ Û]ËÜ0La[„„Ó«I÷⯂ˇñߢ¦Š¤s„»ÿ£õÃw8kv£&üvúkT$I—Í}Bõ$¥”)%¹Q¯» #dCÓÅýRLM׉ƒ6ñQé23ÒŠ™ø§#Câ’b’8ç$#޶Fˆ_:Q“´È³‘nÎté…Ff­ÝlI/9áÔì¼–o[ ñÌ{ĈÈL+MßN ZK¢u§õëæŒÍJïnÌ[,®ôUF¥hý2>Ö•{ÌÂ23¾¦›ñ±v ~Ö¿{k±@úY¯ y§¶έH¬#²KÑø,çíÁ’ö© +£èY´¦n´'WqÔξ–VoÅÎU2ÉTö¹µUHWÛï[J)§2Ó™R|¦/Åg:MC×ÚîÐtŸKíD$O5\¿ªgQ·æ)¦‘ÃqФ= G‹š›°;ñËdd×(E÷§…ªIÎW5I±æLÄšQÍRÞÕ%"3?Fº0Ç«šÅZOÂ(.N£õ19=….šúpÐfâ GåVe^¡Ìô’H2㙇§ÂþÂòíMÒú ND¤r%ò=BÏI}™ä-®˜¡ÏéWsêÅ,ò‚þLUˆi¤iª¡‰î9æ<#Ù5RèKR›#uIOLc½qü [¾Q‰ÆF*•òŒÏè>©ñÖJT«ÙÏÎ{±’Ù%ú!’êQœ¦#ñR'Þé• gLŽh:Óš—B„ÕÏã$ý¤¯i‡Ûeô¡Gê¥Î¡òu™‰#š®^yG9ežNúdúœrW0ú!®_͵%kD<%Ùê’Éæ×W5zÏ‘Þí¯e†ŠÒ REÝ]ÅV¼Ó`9¬é‰%1÷âWUDq¼U‰æŒÆ¤–™H¯šÚ~}î6Ó'<¯ŽÛsÏcæ°:y:·tþšW˜ó˜å!2Û5Ïãÿ¼Œ¸ß»Ê_øWtø¿Þ"¿Å÷kñªF¼o<ªA6‡(.ÓG¶[¶í™ìUÉ!Ž™¸'RØ{µó«%“¸5¦E-òRúEš^_,OQÇtã…ç*áø­›àNlC¯EÓQ[Ù¶OÚ‘8l‰ªñ¨V<™xPiê~‚âšJ¼ê·…õ¡–©fñ¢ŽÐÉÕÎP\¦qF½i™â•’ QœÑ‰ U|ÓI+¦Ÿë•’O)ŽêxQ…jjg!ÔU-3%æs[FâB]TeU-3MžV®ŽléÜî´sË5ÊílèR¾rj6tY”ÓÉÚËÖìgGJ¦.K­C^Ä×H6î+ÊWT¢®ôã­UØ×N)ý«4g'ÊÓzß'bò"nMû°²·Å+ik±£e/-•Ý®TѸ“+ãNî^î$ȵÄöè¸ÙÙOÑ€PyBÄ<ä¢â9Ɔ<É mfÃó”(ÚQäHIé}Á:ª“û$Íß"éÄÓðm„I’;‰Š_‘ćô#,oBÒ ~fòÇÁi•R5oŠÔ.ÒÖ*ŽªQež¢,ÁXù,k³²QV°\‘ùxC#3áFAû&g³<{äpöų)“ö(ž1HÚï_º¯¡ûN?rK(ö7?âïÞåætCý˜’Øß®*õeÒ„Lš· qEBýÌ#é(’ÉLBªøHÛž„$"’š¶#g‰™Z×ÐC’´Ìņø)Ö8þEšªþD +/Q®°ËzIö\Žor O#bsÆS.§8õHÇæX☣£ãÛ±ÃeŒŸã\­žÃ¢ô#tßá,x·ï´ÒÔ•™ûÖ]ÄbÚs8›´}‡²4îKØIˆ´ï°úÖèD%žˆSTÄK‘#YE_bKCa…¦¡égõÑ"nÑ ±ˆûy"RÈ‹R¤A^L1‡îWVاtTâ¨zæÍ VÇu<2³ÆÙi)r&”9'Dß'"ö|f¡+É +—ÅEBjV3“¼5#©…VKM!jµÜ5{%ÖCÔì­d³7NÊÏçÉifT .¢› †èÌšS¸uÂU)­yźÃ7Ï£Ûèô±åìy…DÍh³ÒcbD1¦Çì²ãçË¡¦Kž@í?¡­*‡±*ÌHÊó¦„j•"øjŒ+LW—$bPØBÐ*Sy¨Xd,/1XDj±¥¦VóÅŠnS‹q{)EÛˆD,†R’µXU ¬(©Ò„( +-ª*j@¨aENcG&(ˆ*PÍHkÍ$:‹BŽÆ‹NˆL}¥bôÉÍÌÏ)Á< r…1=ÄÅ A܇ººpCUær ó_Âüü^{ùME’ðúüê„Æ´øD¬Qšiöãyä áÇôˆù·cºxûL®” ŠO³¡éÂ9Ä&-i“mžœ/E¨i؄͌§¨V¡ˆdd8Eå 3A&ÈX.Å +C£¼¦QÜ%jp{ÉkÛˆ ÍR´h||]æ«ùçeA’óþÈׄ$Šv…sª^…¼¾±rÓ„ƒ$(j¢×S 99ä+òJò¢ñßPï=£ä©#;uÊÑFf¢iûãŒ5d e=g‚—uäÑcu¤Òt§üv5꣊ø2jqUA +jG”¨ñMQ·_¡°%c禑ó"ùRl˜àüE±råR³D„œÆ Æ-¡hžÓ/ ‘³h"Ò|¥qˆÂ銤’_3›!¹\µÇì‹”|‡B«èÈ…6­‘Y>Ÿ´Ïž«cæÂYnsWÍÀ#:ÑLèP'(Ìx‚ÂÌ„‡™N%†µà +ñ·¤Ç¦ÞÏ9Ž"A[·®iMD¶Õ:ŽqÜ@ŸÐÓ7sS1ÔÖ‘½Ü¥¶±„ü˜—>k„Ì\bÚQµ.t¨XÍ&¯TÒÅÔl¢æSá0Ü£æŽÁòj&¢ö2]Ì=¤. [÷6–>µˆð—|+‘t£šöŒQ­„‚ÞŠ Ã-&H„K£KWzÔìÒ'±Öô-6yˆXÐë34MøÄt>áCsÚ'øó?¤ rwè9ä®(CÄJ É=ÑjƒtJË„é:Œy2¯Žž’/ÚHi¤¥¶ªÔÚ—ˆ25qâ—F!W¢ˆBXtÝ3NHˆñ§"ñŸ £¸Êˆà±jBŒ.‡íÍ¥<ùu)¿¬ +V”œnÃYp3 »ÝËI¾™ˆ<”ë\dAyi7KBÅSŸÊ§ÅÐâçkAjÿ*ŸÔÈ]DDLä[•[¹k&¸ö™)rÒ$<òš‘@²AÆ8¦|Eµ/ršr0Fõ™%¬&§)…øLRa‚S¤±¿1Ž„DÍ´âŸ1!R…ÔľDñÅ3ÆITGüz-ÈH‰ÚEĹ!(?fÝ¥VšÚ§*ÃGÖŸ‰ƒÉ®ô CÊÈDWÝ£iŽ íŠ3vŒr1â¤!#]bAÞ= ¼ú0EWjBÍý¡Pã™P#c ¡Mø”2'¢RDØœ ?t‚g:a¦Á%BÚö »ØIŒ´\™á]ï:F-@d²³ªW™DlÎ ŠçÌV V /ŽÖ ”,e/‰©™çQ–ËM/XI>¬ÀáÂC¡2z¬nB0"‚±PÃV°Ã0dva† ÃPJpéò„ªêj yè†bñ(PùÞ;B=Ô9n ‡¡D¢ ²Èå¢væ’rÔ—IªŒëv{W{VŒ¸¨bû8-ú!Öœ1uMM¸ŽL7cQÜ ·“nº¹]]žÉ´aÏÙ­ôvÐNS®´‘.ËÓ=]2*¥”åÜ!dË„n°ø•‰+K;”Õ«”×V[^CV¶†3Ñ›H‹!´Žã÷#-1A³¹ŽXdQ(§œâ¨p('K\…r2¢ä 9Ñr©\4Há0†¢Ï¸5ÛÜdEWQ½i%qL$‹©DE÷u*Yœ§3ËÍ,½pëù1$ šñYšæëõJúxËìÂÓ*GÆJ©Z¥ˆÿ-E¥`‡”ª‘‹® ‘jS¥ej.Ê”§CÕCu\pZὃ~1($œ-„$¬1ƒ¶Ç:ª$Å<˜¤ÙÔ‰š¬HÉ\Rê9œ¢8ë‹ÉAHbZo’ßšÄdY9¹:•&®:,‰¸ðb»æå·Æ¾Ê™DU„|Ûè5È ¹|“‰¢Å.'kÜJ&Å¢S²è˜KÕ‘¦.û£ÐßL;ÓøEAE!ŸU4†ø3õKZ Ÿ„æ¦MùR†81šéa,ªøF¾QÍдyQ6Ó)jͯ©*R2tE†ßhB>A¤×±{Œ•tßu«%èÕÿ›õålmÍa®Ü¸U/7îÆeLK­bÍ'2(k@¥OŒ„䜔šªáœB +Ka]6J+}'3;»iÛ™ÎV"‘ÔJ"Ç7ê÷Qö}©ˆk/—âøhõÚéMØ&,M£ý§]JV5¯”¢sŽªÉ¢«,]ô23‹¾Œè[uaàHÎNÍÄ(ØÃ oÇj,VûüBEèd¡Í¦.ñ'çÈu˹ÚÁ¨Ì„z|A2¤µ.ªj£ó“jˆ44k”žÜá&'?yg2ÚFV>µª1uèTs‚¼Û,Æ\LM³§.æQÏ Uv!"õüeŸÎ©ŸPO":ÿëød›—…uBL†-OQ«OCHØFŸ·rª‚ç¸b´¨6î?"k6a¡U•¬:ªSE;ÇBÞcɳÚÔˆ±‰zÙ>U™ê–3 Q¢hHLJ*BãK&r™Nèt\hUq+)†Æ‚_CR/»'®Õr…–TUp½ÎW ML‰‹ÿM*S+–K¸H¸¬ÂåB%¤ad„„JJ‚í‰Ìt$#³Yá‘°xž;:Åð8!­:%YeDF• ?2µä"ò7AF…3fMøFxâ~}S;ºøòñ‚õGNR2Ç"ÔUý¬f%Ábƒdñ>—N‚Æd²;"aÅÎy&Åfhò‚#¤ˆ(Ÿb8\¨Zfwž†T±Y=4 zÐF»× ³¢õÄoöLJyŤ©Çð‹¦¡¸8‰RZD&RúEBj׳=…£…aŠpª4{ :È5;‹#d"*i’Ʀ!ÖéÅ¯Ê ñ‚<‘Eµ6)#_dlü"މ!­3 Ⱦc¼A% ×Ú°1.ƒk´Mî˜D8d@ÚÁ„M¨!Ú‹>Ú†ãvÛwvçâ‘÷"m\#r +M„e»á݉¹,¹´k¾ÇéÈàk¹Wl—xeÍ—xü>äKÄ¿Äú°ÁÖ}Ö÷ÍÒÏÌ¥*¿ þVL®­4™Pß*å]dün¼<†œxn‰?:O +úg} –ʯÙ™† +JÇ/¢¾ŒA%y6Æãª\j5]Æ“4˜u‘;„Á´ˆ‰ˆ‘—´ +B+éj&±ãe3U}Ç|#‹KàÌŽbõ5{B“Шi¦ÊŠ> ¨–bä:–Ãï/ºeAôVɪ͛ìé„SDa$¡9ÞhWÞZiˆ*5ÙfÊ V€€í¢7nŸˆÅ¤‘H²’e\š—Âä +e,šáDK†:$òj³-·²®´M•,¾‡½DùħX½j%5ª·ÆºLâRMT¦Ñ¢¢¼."ìÈZ•v†áQ‰ˆZâ°¨µð¢8“iO!SÆÞ wñŸù+ô_a*ÅTœ¤…ô©Î/ÚQÂODD*>C=™ÛÐÑ(RqŠU¼pÈ1Â9Ûº”Ž2Œ“Å—§¨ãrèž Í8YrB:!á¡Ìƒ¤1ŽÆÞêPÄ c"½W.ýœÝ‰pãÌæº›Û³”]ÕƒVÏ8[+ óuwôf¤<Æ%Rq&¼”o‘' ë$«ø5kÆËŒ±Î8c¬£Ñ4’ëB +”Ufš:ÛŒˆŒò+ƒÉx6ø±<ÝêÇm5µf²¶4™´Þ”=^K¼†x"^´³h{ –|‘$‡&in›oÖMjŒqÐQF™_ AUµ ªu v¢twƒóèlä#¸X‹yƒ~é¦Óе"8ížÕx“ñ¨]Éäð¨ è…α‚U®¨Æ«~I³2d|£É·)ÊTQjJ\S” +)NL±¢AŸ€¬•æ¹–ˆSDk³˜ZĽúe9(mLc’`I£d‰Y%®¸=²a—é!T¡,:•QpH® xÆ ).©æÅåjsCឺ‘Ë ïZ?\*™ì£ÍŠ EˆæóvÙØ·d±N}±(Zëá?d}JÁà[‘!Q°ë¤~7Ö£ºFVJµ}}Yó}ü=_­£ÕÌfŸkdƒ$GšÈ‰–{rÅ­õÐýP*CZƒ¸‘Ös¸¶f bÐ*ì ¿­&‘s1ˆ¤œÛ¡t(¥V´¢ÓŠ–XÑSý‚BýÚ…?£xÖ0•+FôV‘;[$<,™è«ShÔDö²óžÔöD)Ò\‰¼7_#”`Ùh _”QÐÉ +NttÑE²ŠSD"QÎáë$ê cøË0ÎrQ®´Ö°ÙZo¯ãQÛrä+­¬”u,rpHz bÕ¼Šrð|;V‚HóçT)}PH$qÑYDkªñ¨iwçb ‰H‰ÈÈ/"Åo¬gq8RväP«â¡ÊZ_eÆS<íFn$û=IOæT)Qá»Y]–/i‚»Åž‰2CDñ¢ùCtˆ‡n5GY®yqc8LÙªÒ !œ~ª*P8ÝÍ H)‚2ŠT–’Š<9ô2’Á-Êqœ¬õ šf‚(`8ŠAS33ç4³Ù<>ëÔŽ*‚e öwŒýf¾¢‹Ùç‰'Ž'º'-Á™¤(}´þa©‘¢Ð†ÝöQ<®­ª­Üoåv„ŠT˜8N„W^œÝ‘Å«ŒŸIfY§ vëTl:5¥ŠM¿©DpH–HEw¢"µ§b¬>‡4"qJ‹=h*6õt4‰O2%yôTµáöSN\âìUΕŒ-­u%FÐgÐH«U+i$ØÛ3Z µ`ÇbÍiy }ÎQ\ñ%e´¥µ±L1S©Ô´rÁF#5²k½ZvÚiœ°E–h'G"ÊŒvgýhÝXFã­ü¢Ê%8ùm2-±á¨Dô7’=u6c°Ð ‚¡Ä\ü€Ðd"Ê¡`PÖTÎI$H"ŒÜFV­Éx–ÞnH¨ æC9ÂcVë³6| RÇJnüï;šBD!P†ˆL5$Iè÷À”Bq>kCÂíõ–#rg–£žÂ3Gx ¥¼,.ù%F9G@åxŽ`îAü à #пºïï±¢#x¨Ð@ðž#8 ?PZ«˜xù»×`'å…û•"¢)Þhý@I¾à8G¦ž#àN‡Ž`¨rHki†ÓñØÐ:äèàKTº  +³áǬæC ˆ²Å‘`Ó~`..¼¥ò ­ÐÅÄ `Uäà1Ù;» ë.a5Z˜~\`ûÐ@0¡Ô&©A#/B§j×Ã%TáÀqFT©&#¨Ì'” ú@p—‚úÉÁº)#iu©žŒa•zÄpÄ'A¥·2Âpknb«&ÁÒŒ/\߯EXólQtQ@Ðb±A"e´iÀDiJ‹°¢}.°@0Az…"+ã<Ö6¤„¡ŒnÏ"ü1Á ¶náZApI•AÐ +=´yDPéLž%œVá­£œÓÀS&‚_ˆ”$:)#BôÁUˆõå ‚>ò‚!D{»Bà@p$‡Ð÷n‚Ä"¡afCÀ^ è !ÖÐx3»p™Ô1º|¾¬òk! VÒ(j¯¢œ@ BÒÀˆ áå%ÂÝ‚¯°#Á@0ZáUàƒàŠ@ПƒPÀªAB=éYBA/BWjÄ#s’ÐÂʯ€¡ÍÁ‹Ø¸@@‚ÐàÄ ÏÁr¿p@ðHu@€¸ªŠ,Ø7-?xvùZÑáü™óïA‹÷ƒØÐV? R?à2Y~P—JøÁÇ‚×Ä_Mâ Ÿ¤PR»E{ð›¶|PËo|ðÈ2-{ª{Pn´‡¿¤üq°ÉÕxS…=À3‘XäÅÓƒ&L§…à*zš%×®<$ügX•ÂP+ ÁtRÅù$w@Z¹þf<øù ®©ÀA¡ +A[UBD%m覸Á˜¸C–ÔÙ’˜øÀ?!èq~\vàÒYëW†6œA’ +·´@êÎÁƒbn`BA™eÏå  mÊÁŸQrð. rçãÀX¾!Tw™B +ÁŒwƒMÆâ“ÂôOu +æeMšò«…¥ñ@‹7‚ ì|)-ƒ¡F蘄 +¶SìàÄÖ¶" ¶ÃÚ ¦mpìƒàz³A d²Ql@!èl€€ÆkœÞø…0k ãº ¬T Ç–D¡NAêLöpÒ@Aõh`hÑ€l4 b/HÓ; M’œ˜Îâ/œ€¼JÁfðÁ=3¸MŒ„÷2“iœ·Š†V$ýE@5øØHÀˆ ²ÁùƒÔÉŽxA¬AŒJÆåßbàINŠÒ Ib y'«êTI†¿ÀIc€㲃 §` I”ïhJm^ÑÂ/°¨:_€z/Õ œãÌ þÁnà b +‚ÈÝš&d4:© Þôc ‰`ŒV[°]a¨\ 4R¡(Á¸ Žd8¸À¿Šj‡•(³`…þZÐ;ãµ N0A®Zð†fZ76-@‡và9"³@:‚SYP`‰,ÀÆÎX`W‚X?8…û+ð±ë8v5Ç… >„ ª­ öŠV ç² Xñ ˜ºUpPüy€9š:^š­ +¦|iAÿ"PŠ® +øŠ½*N©a¾„ }5öJy¦AYÏÔr ‚ú° +€ªÏK²º5¯ĹʫÔ Á¦©âÔ©@€Q*ðqLL Kn{)62ŠÖ¢¸.89‚íÄD°øÔ &*ØG‘ ¢UQAqPì?0æGÁ¨1S¢‚„mÁÉ–A"[PT¥iQ…=г¥ƒÌ¨Õ¨€Í•7ËDÓz Ý¢‚ˆ‚% 5^°Š +–8¬üQt‚)Z™ Á¥a wˆ +L8êr¢‚¢‚[ïPÓÛPÉUMä„5®`pT 7`¼j$dô6‡ + +ïb6%DÕDÆäPþ@üŸeh§à¼vKókm +6~CU{ò³c'+Á¡²BG ×0ùnò‹‚9tšµM!b™ „^ÞIÀfp*4Ép’ñÆ­e 7#\MaªP\´¥@3Ni)ÞR +ÞƒórÔ¸:MR®À>ñÁw`3 ý'oÌT¡ê¸š.ïó¹(ð%@"u"ÌZ¢ s<„ųÃ\ÙÄCAŽƒ4ÏÜ—l…‚}¶«z6ÄM`n©¼8¹I&PPïr Dk÷üùß3u‚SGp£’é ²ÇB°óM}¡»µ­-O0îRs™'h¿®µa¤²›l-/»ý§ÄM‚š"^|Nørß1 $¹Å'ik7ބꜛŠeK†Âù—Û_Â&€¶@Ê×ÁâO`§ &*O=<>æÊ|zHæ¥YŒ ¨bgB•p)Uç `•ÁvE[–9Ï-Éâ‚;æÕÝÓ]¬Á4 jë +úÑD QGÈ5zï'ÈÎÎ[%Uv(Œ• ‚0[ˆ „Š;ЉQ²zQ‚Ëtè±m9W7ô$Èü­áKZ_y£Iðk¼™‚Ò™¶RÁ+ BÎõ>‰$ø¾|ÙÑ +€D´á&¾½ât‚w¦Âd=@Z`ÃB#¨4Œ„?úö2Ÿ\òY`xÇrmw›cX˜ûA}«^G ÊÌý# %IyZALß‘ÿù6ô8ƲÐÞ¥PE*cå A!íqS^ŽD¹ÛìÝ… ¸¨ªK{,|˜«éjˆ4d®£’:âi”%ÖWEó|ÖèEP*Âຉ -¥ã‹”U?|¡"‰T-Íœò<Ã}£Ö…IpŸhE~ˆ Üske'Ø£K÷C@;ÃØ¥¿’Z‡€»·Š$ê_aC°‰©¤ÎÚÇxGq’#@ÈÂŒ“°FÃGÜùßáèõð0ê’Qä$™ª¡?¨ƒ$åÁ²A€Dò¦RÛÑ‚ ê’£wx_­^:1² BÁŒr{‚QâÁ÷°ØsTJ¦ýÿXŸ:™ÓØ‘hDÆÖÚ'¸»ñ¿À>Výr„Ú¼é¤Ö&6ûdu¬ l[{ÔxA‹]? £@½Œ‰d€«Ž!IågÊä{V•ó­9>{¹ÏøÀ)©O‰U5Mzdœ¢iS›.ÑÈŸ.rk7‹«JÈ)@—-z §j“À¨ørSɈì©Ë-…&´pdúi©‹Ê<û hÇŒóÀ¥jøx€TÒŽ;¥ÓѕͷÈe V>ˆ°Ó¾î+ËôÚ1´!À¡,Bb5€Æ2ìsa8­wîÀHŸm¨ÚÛ7®Ú¡wˆMCØ[¶É9wÑ‚fX€b ~Ñ„xz¾Ég’ÚÊëtÒöi:#+]èqàÔîÿdTSh˜Ìì0f{Я(s õ†:Í`5î9‹£¬¾/‹9€i` ã‚yrË· |^óq€i¡\rÎÍ .ê}Ë> |c´ð¿ýÉô¶Ü9P)ãh(¿!ñ +–¶)! ÕdÙÈÿC@ê ¯€Ñ>ƒóŠyy†Z—ŸŠ[æ@­ÛkŠxxº³±¦p}¯*ˆó»c§pü›EŸì¼Ð·òÚ€¬ µT_ÎèMŒÅÒf†wtƒ1)^Wt°ØÌ&ÛÑY,¸+SOý¤1FÕÀp¸$¹Êjà9J³wLi:!%“ýG½°zòš0¦§†zX kÿ¾2ÒKŸ—çr÷ÆH©–ÎÀ0A& Sçœé`$Þ:ò‰Cû˜ZâJ 5À[Y· ðæîú+’8.e€C=¡Ye6âõM&ˆNú;?½æÈ@^Pä℆-n T¯Ÿé"À3”¾] \-®€Z²g(1jÔ¯Nì¡ã0þ“[Y¦ÎÝ“n| ¨EGœŸâ¤_„’ß+›ûBôª¢Ì‚éÿÐQ*$[ëdº\ˆqÐü/:01Gç^Ò-ŇÞ؈VÃḊç5Ë”Ó UäyE¯è“è‡öâ0jß‹zÂ*{¸Ö™G›ºÙ0À +f °ÎópH‹èTàNE¾í.‡º»[/l?É+µa]! DêÄ]0{Ϫ¾@Woƒ¦'iBk,ä ,%7&æ ~xåÒ†1=Š•4:Õ?¯a€Â!6Ù¦PèKWÒbέNý 4®âßL„|‡øµ†]3ö!~7À5 ÐBÌ»¿/@JÓ0 ï‰uŽh'pPG­Pü­m@€†ƒØ +804KKÃÀJ™w`ŠC¤4„•ÈRÿŸ† +êZKç¨;ô ºWògă†Gúh«j¼R4 èÌHsv†ýfíÅ •Ô5Là’ò¶œd£)ÛË Ã¶32.Hn÷m/N˜ñUDóŽtYEµâÌ4„†XFÒQ¿ÊÁIàáÓ”ÅL¡5 ÿ¯,L“›bÄœJ& mÅ.A·ÉldRn~.س¾Rà0q(²©ù «!ÐÛ²‘À~ꢛaÀ‰÷áGlÐT†yq<í< \,0 ä#!ð ´.ÏÏ… ÁNÌAíÂãnǽ7¡Cé³\Ó×jq±+íëÒÒÛíñÂÐ,FV®¼Z/{Š…5äu¹p{¬mŸ&§Hk@ËNTlHàW¾…—çÅ€/hCTå±XPp %ðµ0 â^&Q‘î¿-S ®óFú¬‡ã¥ýý>|è +qkÑkaà¦MLeµ0`+ 梩ŽP4¥qÉGënŸâ­tJ<:H‹¬ìØ]6]P}³!œ§Ü€šÎ4ÊÓ7™]M. 0E€†®ú¹•!ÇD9êyà ý€;#÷…õzÀc¸Ý#F¸C˜ej^—\Zjð¹wL«Þ”ð%ƒèî@gÅFÐ0pÞtÂÒ#ÐÅ£w¼ÇHÒþ¬»Ô]s Æ›…o¤|é!>˜k ,f‰Ëg;ÐßAV‡º4 X“…ƒíGÍ¿vIi@Á¬°n‚ŠO.r5 «ø•Ý,±› ´` ]ÅÅqd±”-ˆqÂê‘)þ_àA$j,S!åŠÿÒÜd¥3ûθ<õ(â°-Ðø´W œ/H”S;ç !ºåø™ ü,He6¨“.çîHZÚ–.ÀÖnÉôn+$¢Û¡ê ©8¶'çà«/ÐbLz~Å`}˜‹Á fµùµ¯/°‚¡¬ƒR¬/p't©TÅ37@´õ\f- ëáS0®jþr §¾€…Liz½\‹ ›/Ðqè(Lò7¤­É1vRÀ渫:¼§ýáÿE«‚t7oõÊ Rð†Yr²dIùn%ÄT˜¨úklW¾º±_柔/`ã бe`{Œâp¸‹l*Ôñ0IÀÏÈÁÀ÷˜p‚RØX³Ýªæ  kqÅ‹k(WoÈs`Ë(G¾€ ‚¢ØuÂkŒjœ/À3QÀ2ŽÆ|ê‹Jê D1‘[0–>ÚŽËHãÃé hû°D"Óˆo\@ŠÁ)ø*¥Ýíº'W’çôði²VhŠä2À-¡7ìœBÌÆÅŽÐÃô¶DRŒk˜F<©/PáÚ%Ó)ï.ÇÄBªÝE²“ð)QY‹VD5˜¦…Q«´õ–_3ëv°5ÐSÙñÕ˜»ÁÁÕ‘ñþ2Vu`ñ©ÛW²y9Ú +ΜÖtHX·–ãßž£ÇXü)±4>➬ÿ´¾>9= ];x×è_)A}j†ÉþðÛåɉ¾€—ˆ.€ ;ü`šÙñfŠúè Ý?¢!š9ínuÎÙ©Š ÓØÔØk©*êó‡ê«±†«®Ã–y /`üÔgy¥/ ^°RÌÊUWÔv¯~Û‘óÐN#6_«)n- Ьîœ/Õ:ì œ.‚–‡šy„e_ Bú@Òî Ô‹6!“:˜ òñXÏìñZ>î \z€*¨ÙNðî lÒ/‹4Ûeñ¾ÀõÝP‚æŽ_=»WLR÷@cÉ/»ËiµÜ\ ü?Üüsñ¨œv/}ò °™§$π僷É2•Š—e¦58Q.,øxÎB_%˜´¾ŽØ×Y­/üO»‡D‚ªŒZEè2:ð LÝ_XÇ +ÍŸú ý¨Ã­L&Pà _€J‹²glUÎ øÞ„–Ù`^ q4Ý#-QðHµv8 úp´w“–º€¦ ¦ š2*¸ +Í-í+‡LÊòNš&?‘áà¼îªÈ™dçq Ð +¬Mo¶ªz k{œ×8ÇAYˆ9\§ilVÿšu7¤V˜: 4ræªõçbIYÀÈé‡ü “šÞ¿X@ñ€¥ÇÑuJ°À¹8v£„´Ç¯¡Q-¯@j.ФzmsW zo ÐÆÅóÀ5+ÐìiTë,‚m®«ÀæçŒª@ª~¾Ó©ä,-˜ôûã12æ}˜… + ïÈ­ªJFes +Ĺa¸†¿ä#³RD~»â¸W÷[\3<–‚÷¸Yf ’†IEâ1Lžâµ¦+ı˜ô¯èo§¥äÄ'úƒ¦"ŠÃФj2:ÿZc(°hj™ÛË~œˆâ²”ÚßIÜ+O,Rò]½"9ã pPËÓj;ôʸj£dËžØß!Äæø$àÓã }é&À*¸T âØê0]a¨ °+ZÎw•0’GÌTÔ1è¿Ãý„åË·ŽK™ÃoYð7Ô@ªŽ—Ïå4å?Œ’ð mÙ‚ûÎýZ³ßIà\Ó3˜+( <Êh’Hlx§:»72)B‘Íg_…à., 2S‚ ðŠG`¿p©ZºÚÇo®†ô…ôU£üÍ€ŽÇŒóÐn^¾‹À"ÿTÌT=QØ'IêX"àôºžVu'D C7Zšl»®‡ ÖwÞ9*ƒ­XJ‚B7(ÎamœtaXCà5ÙíbdCŒ#•W| ¼Î)§†ß!p&{aI¡W€@Vê]²2ˆ@@âúÊŧªs^ëÿø¤ ¨Tok?,Ž&–ð)Ö©ÕwHÔÅZò‹nÞ“ aàÓlH…zѼ•r.Ø@•;‚¦(ÇKpRK‘ »:©Ê}=§z~p&(º ‹ÛÚ´9V\ÐA¹µø¹ÏX$À-Þ"““GÐlð7@E¬c‹(9@qÁ‰0¸¯é"VÐbV[‡úÀtè+nQ·˜€»ÇÓ´-Ô8ÚmÀŽ­¼ˆq¨Å (°FÆ/&¬ld5®‚€aTÃíòL D¹ôýµ|1s¥·÷ýÖN6h€p>è8N~y>|Â`c¬âo¶&P.‚M°VÔжµÑÛò¨Tò2€zsëØ.1Žæ/ÌV|•ܚʧòq˜4Ðè°øÇ€¨¥³˜J)Å=p²²v¶`¡ òÑH$þ½‚H`ÀÙœ¶>_@dÔ·¦ämy¼­ïÒmrÿì8ê퇹p ©è§]oß,>»ƒ³!j-€Å‹*sAÎ,_yuÉãÙ_MJØ@,À@ùÓ„é©FW¼dËP2 +¼¹h‘³P \P+QÙŸU»ª€ÒçÀÎÞPG‚E‚ +8}­‚r)`‰÷0ýö1‚½Ž¾û®é½¥]1W(À'03Cxœ$>ˆ´rµØW *ts8€ B¬®œjưΓTô&àÏìáˆS '­† 8<Èc3Vp±SÊyTà£9Ð@¼Òt‹~Ä *42_1Œˆ†A‘]ÔøâÓåQ.-Ó·˜ÄÝžâP¢$ÖigòÀa€F{4w›K0è<°¨_8&@?sÑQÉ£U̼^nUаV¯J9ˆ ø&*€¥tU‰ü,ZDs>1šæÏæ·µ¡íÑúÐzÞ`”m±Jî“ј¡&VÚ†PuÞ‡ +— L@²¾¸‹GÒ¬¼Hi¶aŒ¡VsoFk[aÓT˜€ÅÉÆRvm +@èµ¾sç‘a$³`u +è÷&`îƒBØLL2h?„tî{•àÍŸ¤»rõ°â)õy˜m+="aã†E/L@ +¨(øIõ¾ÜIÃ<ùôJËá”VXrßÈ•m¿"2Ÿˆ2 »=l™™&O™4=zr ð¥Ñåa]{r­áñ»I†‘€AL¿c3JÍXêQìÎ…";ðŽDc{ñФ„>æëð* +Æu!<Š”½Z®`¿u€€âIAÀ‰²„iê0ªa¶µ¥= +sñäÖ«­j $ªdŸø“[Œ°d1´ö<aù(„{ŸxË 'm vpÏ·ÅÄÚ5ÇåüÎ _ÿ‰¦j¹rÐS½ZƳÓzÙćb‰C(/[ohäŽQFdD€g´‘ä–òHQ Ää&GHª¦À2ø *—'krµŒ'ÛÊnî äÄèÚt‚ß ÍìbH9Ào_½Ïë•*SÀÚíÞÛT 3n%Š’ÂÔ +ЙxÕljÿ´ µÏÌ}¯ÇàòæNU¨½¾9Dèu‰ÉD²àbÍ*4ußåÅ6$äæá×vÊÜ£h˜ÚŬκN;˜¼fºCÁÎa¨8@;¯Ð7Ãì –(Å|±y“é:¨îâyóðn$‚³HßË,Þ&º^ õŠ„ +Æs?¦ÅžG\µ‘¿xÄøQž‰Ô+lòö° Þ16î€s U¸€äu<†¸¤ß @Öð ÁÖI¹@T¯5XÞ†©ío¦­tÞ€[iYˆåî뼌†p^P‰ ëiË'²ÖŠn[è„7X FäA”Óûq8iU ‚ÈjÞyb&òé ã} Q¡ ÃÙ*'ÚàÉ}ÑÈ¥•\«Ha¹™«Î̺Upù `w~¦Êª¼4´Ê+ìPgÛV?Л+iø€C’7>v=†9o}OPYªç•âÚ¥‡GÀžK¢Ÿ6;GgFl”¿,-f¤k,eg’~à-7$½fðýoÈS§â®#Þ8qá­‘ t׌nõmŒYÚsò»àØ¿T*ƒ<£pH§ÁhÖÀY.Û"3³Á° 4tˆ¨PøÁ¸dWPÓ˜U…ït ¤±¯”yË%› 8@ôìk¡´” Ý РÀ=xƒÓt‚®þ§4EUÁÀÐnÖ |@èM™, +Mp€.1$aÌ]F ߯ò@[/µ…¼ @œahp¡ÊÖ®Ô9tþc5Ø,½ÉybɪcHk€YÿüËçbõ¥ޏ8տɖ4gl ä”}Æ7¾n2À¾äªãä3W%r+¨:õ†•™> ^0€JU2çkç‘qó8¸ºMÊàNôBÒ 㜠‡/Wl©8 Â…mØ`à3¬\Hrç]jH$ò$¨¬EÀײ{|¼DfºO:Qœža´üF(U ø¨É¢YN€ü“‚‚$]Ãg¦Ô&äð§)•aJžRð¶–è¤F's>H€§SJà64.dÁ)|q¾æòíÃkKšYª®[Èð¼ÉÁªð¨“@§"îyÀ·F—÷‡&uG§Þ'ä?Ò†hÉ+0‘<Ä‹Øèp3£ÑI׋ZPOÏýœg#Ü]§•þTyóç—V}UþØI)D\ñÝ€m%^ú XŸ+NøÛDNÿçz‡}´d1‡ý/7 T&µ|ö ÏmÏÿ}/$\ŸÄ>Ó!Æ÷þ“2CÝZÐTÚÿrÓ £BXiõ¤0ú/ÅcÚq«/æƒûæ(„é7—| ùߢpÜ žt#ñÿ–X™fà¿S0Ök§âýmÔ‚wÿ_ª, ôL>ovûŸÇ*_ø²ÿ‘;wdé‹ÇõŸÖﳂ .§ù>Oýkò£C©+ÅêÂlVIoÒ¿a} Ehw}Äh…Aï«ñó_Óêα°¿‡ÏæÿuÕùž®££ ­Ò3-ÿ ¾úä•S¸g¹ä¿MX’ÛtjŸù¸œaãßz:ín‰É·¥³ž›Té^áßä9ˆ ÿ× ŸFBüó©±Ýe‚êÒÇ÷ïHÙ‰uÉ\‰ÕwÿFûIsÎAÁœˆ¹]àÏšMO»ýƒÃVe£ìz¨ý÷5mËþVàé@Ìq¨ù°ÿþI™§[J]ÿŽúh·[+úXØBJG*€8””OTÿ¶ß¹§bˆ¼Â˜ŠTôéíºOÿÚÃâ‘I7Téß^΀=%Ù„t £è‹þ¬ƒ£[תH𢉄 ?D:¬ÒYDóü/£¦ÂêÒÎ×Û-ˆWÌgþ–œ*w"°/ëå/wé¼wÊÃÏJïþOÑŒ¶kœæÁošÉŸ¢+¿ißÏífÂ8äßu÷—<ìø§Æ¶öJÆ¿ œµ*†Hဃ¬ÀpGb)þÓ;WA\ú©§@›ÿN„âŸsZ«<Õ¥]î”2C²*³’íâŸüÉ:&‰/åˆâÿ„ñÖ…\+ô¤øâá­ü@Èq»Šÿ@ (•!Hèânä9«øW +àç¿A¡Šö7£âÖÇÂȹž—¹æ¤tˆ4«*þ‡$ÂZj”¥â/ˆoŠE·˜F½Ãÿu µ\ýåøTücñ~…¦JÂ¥Þ‹´¨ËB¿ï´WèO ò/à=ÿÌÅø÷(‹”–Í{"\¦"F¹M·hö6ÐFÌ +Xñ¬paO›âÑd”UâʶÏ!:¡m[ $z¤',WLñ]<›SÞª™æ¥¦)yUü‡‡ç±ÚyUüõ©½ô®[†÷Í«<@9$¤Ï¿Üƒ "ÔTØ?¡ 5OèÊF7Ú‘óÛŠ?™¶Á>!wck6Q9z$4½â⑇çSÜgµ +FaçB/DÅ=­2ó¨\¹%‡FŠ?h÷ÝЪ4y ÅŸ«²8•»¶¶*A¥hîË/ügÿáZ†j”`ŸƒÿËS[ebð¤ÀKþkÞ΃¿¿J5÷Ewh˜Ç|ÿâÒ@$=ø$z¿Aذ÷9ñ Qx*àÆü¶“àc÷„²¦ç~2®eW8Sí›|÷„Ú‘ Þ„îí?Ô&‹Œ6+iûÿL›GÅuuµß“Šs³šíogE^T8¦jún,Eeµ –:²ÿÇÕcðØ/ž)%býö‹ ŽÍÏwÁÏîü°íÚ_ÿ`Ô`rYyaµë·SíôÂ.r‡¶þuÍøzÄëÀ(̇Vñþ$¬®X?*aÌÌ^;‘É×gí%aýï~y…#Ú L¬þÏV–_QÄêgóÉ^)r‰Vÿh¯Íçô°Z~T Fh]ia°úgp\ûɸ¬þ¹²dã»Ó6gõ7‡|£¹Ц˜ÎH×j„g!éëa„C«µo¢…ÏoZýùÎ{Øp1uµ‚D88eõ7˜X^óȘ¨U¿È¡ÕËMzl†*¨jAÍ;kGMF»/Zõ÷<-¿Õ¯êo˜¥¬‰züª~Ž=(^EdÜUõcù䃨6K—ÃØco9_C˜ÛWõ×C5'WýÒ½s ÈùY÷Cy:w"9ElSˆÀìðt?[KžðªšÕ/\h›ïó:£B}µúQyI£“É&Çý»FÂèxÿZý6Ë#„ý‡1½v‘´úm‚ +k7J%äNOXýÀ˜“P^=üXý{V½b1ß&"G—fCbQnà Xý¥òg¾®ÞÁ¨%+fïÕ@ƒàb‘®÷ú~V¿-qßÅíw«G«±˜«IÞZý+¹²‡V¸ÅC‚ "°…C&H^«ßeY‹¸«Vÿ&=îF+­~yçìT ¸Û»V¿3Ü\/þ`õ'hýòš|ó + +ÿ»5Å”´Iz÷ÎyXý3Faó( ³úé|Ä1lGÚ‚=aÑ©Õ?ªÜ3Öˆ„Vÿˆº¼ýÖKZ‡2«ŸU.tè,zá‰-Àb3ÿÓÈúÃG'„~úÛÜŽVYÞ8ZŦ¿ÎÂ9¬¦?húGÉåÉ‹60;ªüšˆeH eȰó‹WQVú×r+F›ö†£TJÓèXð|G,ÅkF=ŸÓçŸ"¥Ÿ‹»æXr+Dó3¡ô_øíɾÁÚKrÉ3²í¹JÿS7Nˆoê+Ï(ý +!…C{R¢¾÷ýƒ@?.Æ¥fçîú—C]%WŠd>£xSú¥R°„›¶¥?£QǬ¬Ö·‘Ñztn,àážúíR+«_3B¤°Ð/Û¢Ï#i鯮úøçežmÇ8‹Õ*a[Çàz³#x}é¯÷ú£·lÛÒOàÇ„³šóZú§Yñï%a¹¹µBާê[ú­•Ê]ú;J_Ü'8Ÿ—þÉm0ýlÍl.eÜN§ƒpGƽŒTqóK‚aúÏe?¤–3?ÿoÊ\8óh ï+&Ä#:¨d)ÁôçPSëcÁ­aý…™ÚSiIj^XLÿ$Q‘݌韨.h-¹Ïªü¨|Aƒw.+á¨øWh…ÀÄž=Ë´fö1¦¬d8_ò™;Èür#§€Î¿L%ÃúI¿êñê®Ú ¢­kâòèÿG<»Ìv¤(¼ÂÅŠGsó6h½ñè«ÔBd]ˆ»‘pJÓçË@mNªÔ«¬I¥Ÿ?„škèß„4¾ùƒ ßim;UbÑìóÇýº-:ßïuY–çŽHU_|ˆ|Îì­7±À=¸e§?}'›ß¡‘"H†IÀ22ãÄó×Vé„zÒDÈ—ît›‚u:ÏÿAZ•ç73LOHïP¡ ¤I×^’+úáx7p1•ᘣL• Ÿ Š®­‰™= ÇAâÜówk‚fõøÿÊmYù‡{Í!¾L°©eè—|‹ð¿7ƪ}tàóï’ͧÑ ¥#ǨánÅtÂ: +×UÆØ$Z~FyÏÑõ™{•ßÙb ¤*ªÓ(¿Jº| 7(Mþ'èüs€¢î#ùûßæ6£öwˆüòÙEÊü!®#@G<~G¾oј,ßøã'tœ(ÑäcÆ?>Èõ×GØ!Ç‹…!Z—Áß?’aUü\hà¿N2…Çx?Š$’\3ÄIä„ß°C!~’ ñçš^e,¿8üì\¦ñ¸fµ^ø#5Û-n•þµU›âÊ~ +\ÈLNJ(¯~¯<,X®&Àºø{Ž“¹ãsÀ?’2Šs”ëøû·†÷û©ÌoÛïAE“/Ì£ƒîáaØÖ¾O«6lÖ#’ï;x£Ø´HkȱAÿxæâŽ73cñ¥÷¬~:ö†q™øjò~^±}?GïÁLc:fuKy|Ž<>âyáí;T_M÷Í +~ç~±t Å–€Êeœr¿¾ å”ñ¹¸o\1ï³]pߊ¼…F<JÞ~Žõ Oèí[1[ííï|Óí;ýÁñ¶qŽs÷:âÕ§§‹ÝùÿPmß˜Š£¼ÒQÙw±9*2Â'Ö¾sÉ*Ëð}Ïœ²K¨ŸöYó¬a Ní;í³à8ßYìÙïH#ÔÅ9þE€ˆ# 3³ä´Ë uÅ*ûãÄïþ3 b!û¯ ׸ו±?"šÀÁË·J_WF÷Z ߃}Ÿ«©ë©¤z}¸s• »>.]¡'¨)˼e\_:  ÷Ò—½C[¿PµA°È3ø85zÉÀfp¡õ=þõÝëàP²>ð™»Izù˜7OÒ<‹`hX%¦èwwgßê»Îi}’ +hjWýõV}(iÃÐüfÜ)¥‰IõGVï›úâÊ¡¤¾ÈÂd¹Ê%!Q?¿Ç!ŒÞý£G«¿£1W™9Ëdù–kÀ1á/¤?aÒ¦Ÿ‚¤e³@”Lߟ‘}À[úUµ)Á Ùä_€Qã§:ÆKQ60¦âMî!p—}9ú¡‰Œþ¡v¡,Æý¸\ÓÐŽ„1x¹æRöލ&/eâqùã™"´í|yƒ7fõí Ñ) /ù¶cý|Hè9Øë…Zñù«0[xI*Ëtèù–N í*hجÈ*ä;ßèn;TIëü–°–*\u^™5T¬šó8B˜í•$Ο1>ïÂó4¸wóu(§ISxl4m‘Íï½ümÜgED/z‡èMÍ?%f$an±èD: é2ßžù ì„ÍÛ jž?° ³R6gÚŒžÛT„Cw;×#=ùŠ[¾m«XY¾×sÇð©t¹òù˜{mîc°[NúÞ2=Y%ÿ-ÿßV‘§™‹Ð”a.r<(_]ÊlÀVyŸ°™ãäÜÔµÀJ?°#|Éo¢Šg$š6bÈ_åÚ½ôxÉoÁT€Ê ÖɯÕSA_ÃuÊ·¡&¡!yQˆ–Ïyä+8ÉK tVäãeÝb@ ÿK(Š|Ç#‘Ž–s!Ÿák†.ýÝÂìs²‚Ķâ©éÑ+>>¹—i¸ê‹ã›’<¾ +¼hÛ­tüÕ=yÔà$Úù5Ço,×ø¦‚\}y=Þ|íŒO.|•£»Ý¿ßïºY/>θñE³øu9šEô©Çœ*¾›ÿàOÖz…ŠO/b¯‡73† ©ÑNxa”=âǘgÌ‘q¸Ðž*Ïâ‹kÌ–ÕÐQþ¸ä߇6íÀÞz·¾:üeX˜>Õy×løœÜAhöBÂ&Å>›¬óC >î©[ï/ü ­•X¾@¤®²C$üÊ®)ùIýý:þFµÏ +qGèmtƒO]»?ÄZ!}Då‚\n3B%øÞ/ü¤¶·äˆŸB ¨CŸ»°øÃ-æROG?"YÒ½Ÿ+ +À÷Ù,–ù÷œ5Ħ¿¹ þ^°I*ƒ™²Ò8^ÎïOó®¼§ˆ€Êû~KÛ©_ü‚¬¾ßY9ÞpîJ©t¡÷Ì÷JKF–†ïƒºñÇ„hˆL÷^/’ÑsR=[ݬ{¯}þ\B½¯²FbÌHY»ÜÝŒž™Œö–÷´¡Ø<èu÷!Ô|áýV Ë½åÆ|÷önUNÀ<°©zîk!Ni»ãú·­žyðe$ÿ pÒMؽXW¼ +Á6rȽ̨ö.:ïØþtïúէLwŸŒî3¨i‰P`zî7=åèK3“æÞjSåÂx.Úåʽ'¸—^6B9‹ÜK¸x ú4îÝÞ.£õdú>‘'Œ¸© »€÷øž+Â})€‹(‡2“+¶ÎFsƒA’d{Æ +½½ÿŸ½G Z·G7\Š,ÂSã#Åí?ÁeG«™ÆP2;cj0Â-+J/ÐL3lb®]í+MÅ0¨Âêkµ9»]Þï¦×þÍÒ¿ÃèÉ}cGií»ÔKÔìƒNݪýIîe×J"£ö;ŽJô;C +ަ½Kéû‘[þ‘ö|K÷§âÍúD{Þ?˜!ö«0ÇãàÙã†>Lñ›ýMáaf_¹³c^ðºì]SúAÍÉ•±ì@…¼’þû”ýù3Kö_03Å· ÙW ›T¼Æ$'9ö:8潷ƪ@‘Q\†Ý䉽/±öžbÒÄÙgÄzËžùicw#v:åÝ­ë³” I{ê2™_M}Ä1ÿf°/‡æ@x6MÕ¸‹}m*…SS0Ñ öÅC¯Îål;žƒ½ï-zÏÿŽ”{p̸U¨­õ¾`{2ùGE{¢ö”D[‡!µGáÔ J=nøqìU“ͳœ®5¦ ­ºoö/Ï„,×,Å•Af c˜ìË}°¤Ÿª^¶ƒýúBð°Õ†\ üŠBÎ7 €öóóâòI `IÈ2á-öÜ oM ‚¿~=tíè&$9_?æÎVIW2vèk>F5´-x«×»)zÜoËלzýV ¼úµª×3ù§†ÊEk¯õzÒ•>½~už§v¥€¸MÊ-­C³þË+y>¬ôú^“(ÀN@ ²ph⵨Ȉfz~ öhJ[42^_]²2•Îëk~1Oyâè +Á Íõ±ÒËóúýɽ^Ž÷øÌ¤×‡¡ fZŸlëLOwÌz*ÈG/fÝÒëËA}¿ž»‡z=ÌáÞ²Ío8 ®×?6ú?6'{ýÐZÛ ‚ƒr‹êõNžÚˆ½œ¼¬D½^<#tcí‚·‡f©×O°o$ó²½h/¾…ÏõÓëQK‚‰ñ›^ ä3[ª¨[…Ô˜÷°ž×°ÂÀ?$mÝµÿ0ßÂ3zý'*CØ{¤º ZA¥®èõåc4€ï~^Oä&6dUé¹²gªF¯/Ô|>%p^O¸ÉTy}_Y¸FCÃë]¢c®¼žRU7¯ÿQ‚Æn7çJóú—@íy´’šãEH·ì1ÀjÛ0¯¿`MÔ÷i”<Ä@¼~f‡¡l^ßû…(– ïøn×׫iE„‚ÍëË;Ìg’y}º-Ò”2¯¿g¼Õ‚Fðóúr´UU; ÄRp¸ì–LڠדΆ>9¯7xðáÜf‹:y×ã*¹êz‘¼¯ÓÇÛÉ\_¸rIø·äþšº^’?’þ~˜JwAñùï%•O=À+ÑÚ©ŽŒÌ vV•–I”ÛL—Ž+‡l ˜[&-žž+l›±Î*.f~~°€UU×Á±í Ôr¹ûv`gÿœD2£ÏÁN‚¦U2“áIxÇ;Ív5WËöt¼ƒßØtÅÇ,´õXèPSÁÛI?$áô¤¥/ì?Þq/«ïMÅGt°Íõ eï,lÀƶí«(aït¿¾ŸÀü;6´L.ÏY5(íAD´92%P’Ðv" ÿN*M­†dBqìßA%pþ¨üØ/=Šë„Ѿڦýß‹Á*Þœ4˜‰G*ñõï ÐèïèWø;i½T!üÇ•´>m›£Áªr!ÔЯ¼ú¯Ù‡¸ù±y$ßÜàS¿#ˆØ9«æx¹Ëf‘¦n‘æ©ø¶õ;œorà¾ß9mëwÒs©cÀ“ÒÙÓˆ|¶x” /<|ra€'Š]ÀÓöì9úÀ3J (­¨ø#(<ÇÛ][!:ËDøµßiͺŸlVi¯d¸ß¡¬lñ ¥z/úAØ9x&]) !V¢Žö•sx¤/.Þ¦M(ùCr°-P”‚Rû®ÖÞYûìò\ïï°n%¤H[©¿SX:ÅxÔaM9îï °ƒ ¤^¢7ýû Y‡H4S'[°qD¡”ÏAM`¯?ØÊ}çîƒð8ETòãÄ*J‰(,n.“#×)”¬±,”’ä€èÜ.<†Ð ™ ‘”© •—6JÛáh\z£/V¡WŠ}íc¡+dá¡áÅžYÁ¦Á;ÇN[Hyç ‡amã{àéSåzÀ<Ž=Ì;Âó—@êúVƒ&àC¹]¥ÍlõDÎUc”iaKü‚G œeÏÏ”eÁCQšÈ.àtÉ"äj‰ Oiíô|.žÜ?ûâðøðRâ…-Cç=ŒÕİê­ÇŒ¸…ÆC„ëñÜ>¿ÞÈc¸)îÉ3Ú¨“›)Ò$Î:oJºG;›E¾S:÷À‡äœGAºœèÊçyšYhGÊ Å©ÃŽ7;ÖÀ!”™Æçýo÷lŸoà„0‘¾ü>¼—ž{‡5#5(œ±ìçz·È–„B—bŸ)ÇäB"®~Žü=ÞÓ~ÜŸŠ½ŸsÈV±õW‰½„þu¶½·, ýy§* ~ü#Ї`ºcÚ,¼ +ë%­áEïÒÒÙ©nG"Q·½HñÀÞ¥S>¨ Ðêrò”Mchìæ–£“ºˆr‡m;³) 3÷Ì€’T+.Ö„­²»8Ä>L—¹:ù0¦ƒN“-9[˜î‘ÿ-ÆrôLhÙè³ +$©8]i ÆÈô•‘Érb9™ã¨%™YœN™0¬]¦s;Õ +`·2ñ\œÃ2õÜW£Æ‚òfèë.T 3åtÜÖê´ÌDŸšéOdsa5Ⱦ=ŽòUuƒÒv0ïLÚåÇ æä!òs0~ÓÉ+Ħӄ÷焦ª¢¢¬¢,Ñô-rìšßh"-ǼGÈMÝQ/ å„“ZÓ´Ú¡T7!¡*zÔD +8O¯Ò™aΉ™Ò÷ɲ©Ìo3ïPI«É=ÓW^÷K¶J¡ÇWs¢g-®Pp£š+Êëaù‰ÔdFÕm¥OøÀ IWÙÇ’ê ‡ö`š&û´ý4qæÛc3 +þ$IcÓkòhýBBÂYkiò³$kGÃ"g“ÝŠ€ÝÓ˜„Ô’ÈÉN-MœS|äpCòóŽ$M½n²!ƒètɃºÄ~gLBïBr,{cz bA§kFü²4%Þ hóØëy;”TœqzG(Oß0¤¬ªÁR9ШÔE•¤ª—5ÇJ“jй?˪ªú—øJ%;‹KÒ k4Ñd5% òÔ¡Xdg4%¬Í|ae¤ÏýR„¿Yè`·.&øŒªƒ†èEHÚGâÀ”!ŠÐY^?Y°ÉAªÉDm¯ò–j¢ö÷}\0RM&j3ßµ…À´…&u‰³™)4U—ÒÅÛÈT¦ªRÛ¥‘6QMQÂ4'ܬΘBÖb£"Ò¨nQMÒ*Ê?^‚ƒ +ó¿(µÉ›Ãɯ$T•pÂ~‘èI{\ H¢*K¡[@ÉÎÙÖ¥Ðt·ß‰§#ª‰àzè#5õi˜Aª5©Il.hŸï±ØrDjJ^m¿¶¿¾™Ï„B’D•W*›®PèKÕ¯uŽ×pj*ôÑ/“©)Ô"De¤&ë’† É…l„B’Ð `󂃂BCÓh¥šh5ù7?ƒG@TUŸùmpåФR=hoÐq…”dó‡‚ÂZV»ÄÿŽj6&”–¢`ýœ 183­P¹ g‹ÎÞk…œìmZ´B"$c[‹ïŸi…´S*ÉÏ’ Ò1Ó +é…ZÔIb?˜×[{ô‘¬ÐUæ©%°˜‹t‡JˆqÍj Ÿž§zéK9,¨Ê¦q"›†§v¬i‹ì…:¦Y¡hÈàI‡DY¡éëÃ̺[¾¼AßòóY¡„§óº±Bƒ;眛¨¥Î5)øºD–)jÓ5°BеGs^í/d:4¡bwÌ3¢íP®è]×&„‰@Û95ÈQR¼µ¡Br=z«©ÜyC‡VSëÊHÑÛ]öýÚ¿þ'Œ¼Œ8Pk@ ™pãö€!@…ÐE©!Ë0T«I4žö4ý@¸g¨PhZ‹>O¡,Æ›ZÒCþ®€V“OPNñŽ6’œ!·š†ù4†®9¶ä$7mK˜'$óÞBA…Rf–å™À>+dLû,ŠtÙA‡ó0-$âú's!–8HùB â›+ÃþÛÞC¹5-÷…t 2„|¢C«Ûd®³âõV¡ì€Ã×gH·D(Ë.oS#lÄ÷iW›½ =š¹TùaÕé24ErRšXíUi›n~|Fæ2ä8 !«fZÏÛ¢ù3ÇÈç´*/f¥ùH"oS¦Ï6‹x*Þ¦•¤G’¼MÜžA¦ôä› 96÷üÚÒÜ:”ˆ‰‡š€rKÛdë¿ñ=V›iø~x»O´I?™Mqï+‹6õz±Ñ·Ç•n MÞöåÈò´©I+”Ì +x´åBG+Ð&[°sO{;ð…À,…áñ]¥6ÍPãÓÜ£;nS›FÇ%÷*ì¾Çãl/äijàÖ·„]ú´Ii†¬‰Ãmk.º¹ÐEÓÛPE± ‘hV—M†YÖr|³r›¨Ð-iò’™“cŠ 7ýR€ò©âè‰u¢•Iªg°P\Ívúå) ¥jÇ&³`n·PrÙÓ§…ØS꽄•âê~GçB„¨àØ”pÏf¬Ä®^©L åtºâÂiÔ‰c“îšr• m–­,D|Ð]Šbr¡ðÁÄ=Q"_6uÅ!¤ÁqˆÂ˜Ä+ŒÜ0-Ä÷Ç“F ¦´Ý±‰š2Ìœ’{!…n(½™ÿ›|Žo3ͽ+-$köÖÂT+-$ + #ØÊöH§…8»Î僚¹ëi!Ýl¤°ÑBr#jÔˆKÏa´ÐÓ#N (\“Õ˜"%–i!úFˆn €_*<6Y7‹{:œ§´ÐôžPYú¾¼ÐB(“µŽu#~Ä®¢…>j€2(Ç&ŽD¥bÐÐBq7µn¡…l´‚½ÿ'ÃA ý°¢ÃÏñØ×—9£…k]ª›Èöæl?´lL Õ¥Œ3:0ñØfà,ç€M‰:{cÐÌ2tgh!cèøjL-$D>² `c´PIFI(À˜h`÷±i<ÛaÏ£…4¯{ÙúØôЧ%1¼B…”m©ÀEŠQÜ+DìvÄ ‘Ã&g¤¤ªð‰úšƨ]º&‘qñ¸«ö­5Éò–«‚Ø5 …„#Gœ“®fUˆžÛ6‰•O@+"è°NZ«Q4z…>Ú³Íá+$p@ƒÌPÙï  +äÍ\sR² ,D©‡í4OZ´#6 [—ªÒ.î' ¢Æ1¹†ÙTa]ÀB +%žQý5¾C ,ÔGaû+Ðú,Ħ 7|àË…¼¡Þ2 ”Þ‹…¾@F+øŽ‹ ›7~ez>‰MH·Ï.nES M~—oÈ+×b!éœS&± ÑB²I4hZXc⪪…€Šákú5Ô ÙtTtñ»µ+ùgБMŽwØL¦Û³‘MËwèV{ÄB¸¯êÓp±Ð sqÌiºÊJ¤¬ôõ¹:ÍÃBˆÇüûÒ–SÂBsÍû!9,¤E~a!¶[õ’ŽÁbBW qZ»¦;qJXHú@ëÜCÞêa!e“ª A&•ư©º%zD3囤ŸGã%$0:a!]jÆ\‡daÓ쥾éͬZX(9ï#”–IR,$8„-Uù ‘ 9SµZÝê\ÈCß÷0&È “ºŠ«Ì&B±ÕÙRgÒ…FI]Âàñ¼Ó­ ð°&÷~¦ØÌ¦3V&[Š’î&± ³iHƒ†8φ ›mÔRh¯ãSŠèÊsØ„qCá=T‹“Ã&¸¤mÔÚ`{Ø$ÕÞãÔÊ­3VÃ&Ð… Q«Å[!”×A.%’•7øQØäÞežPaO¦U\^©°i~1~O'þ¶i…4áœr +ËìI°êö¬{èP¯ÊùUD—ÓZä4})+ÔZé¹z‚tFfº˜N‡¬v U7‹µXhxÛûF-–. a&w§Äù`ÂÐëF6?™*"›8tز@¡éŒ,|Öþ²P[j´}m®d“Dh-P"2# áZŽ{ Ù”ºÏÃ( Ù´òE|4G_¡e,dtB±«6l,¤=PÁ"•b!©ù +ÆXÈ âÇ+´n½{,dLH.¿r‰-¤÷ ‡ã‘œ©*¸­ôò?[諱caœ(nT3›¶}Ü3mÜšM~9ùv’ë£Mf­Å缓m!‹t%žªÆ m M¥÷ÈìpØ$uj yk®°[šZD³‰áó‡t:ͦ¢Ž§Y_}Ó6:²Éö™‘¶Rã.Ø…„)*xÿB„ÂR:³bF %7L‘!n†ÖÆóé"ÒUÜŠ]ò+©?§0³´ax‰ +<ú꿉Ü:½/ÿ¨òàµjN!ü§+öòfìC–ÿ=– + AtØ•º²$DŽrKÙ¶w< +ˆrzÚoÎêŸ f8"‘È<P?".cà/H¢«6Â0ìŽ7ÊVKt9«•1äüë/DL§dü%­Î1ÉEìElÞ'êoöf:ü‘ëzŸù¸T oLÑᦠ+~F´þ\á¡")‰–Ô,^èñàN +gçÇŒ¸ÙÁBa¤íŠ€Êšýâ Ui‹˜EKŒ¾ÊÀS±]݃ÔU¿ƒ™üNâêú¤r—š8GÀßäÂ+êCó;]ë,Bÿ=¾åð$êú>ê¾E•/äéVå)•û´æiÆl„`ôat袧Ÿ@ܶ§)ÈËÿÃŽ‘ûzÊ(65W‡öôYqOq"Ø-XV#÷gò³ ‘yå!h¥Ñp]#”S#tk*=¦ÏèíCmT6B#]u9×WHÞþ§á÷©åU tôJŽô¡Û›¿9B´:IG‡ +t­ud²…1»ý‰Òv¾Ý’ìÁ›\ÔíOŒ$³  ús²ÿE>‹Ñ˶£¹G—[Ê¥@ö§)u3‡Ôf‚°ோà[Õ¤zü©ÎÄ6P èõT¤£½$Ûd ,„ž‡™ëùÔ= $|ýù pàSìfìÍ‘Pk#ïæè"¸qxâm[QÃøÌ¯9ÒºÕ&ŽŽ½ÝP’7Sµ#ݘ‘uý¹Ÿ®rà¸a@b‚ÑørRwì‘_øèV|Üèé€ý¤?¼SìP:{àH³›äqDÖ‚DüRDâ½ +ɘ4U¿å€jƒ¦ƒ:‹Þ!ÒÏåe"á'á¦ÁU¤#}‘|Ž  ôäV²/dYea©Ñ"Åùs‰Q˜Jbó0HjX7†òB³¨o6FW’|4|õ$]§„v†CÙ¼>hJ‚žÈPãWR8p‹‡KRïÑ“† 'ôe’j’ää\”þ¸Ý¤_ °ç›“q¢SàdlV¿d¢ÀÖ¯XÜIk:J!(N"QÔ÷+:H”(½«¨oÚ÷k^UâuRb¤¥ôùkyôFKé Cñpñå- +GŒÂ %ï?ï­Ø³,pbîŽ1oQü-!8ÊNÛŽ‹’®Ô³%Pm§îœÂ7%C]Ç@ùÔž¼)yddë&.¥õI„“kå'o¿ò± ™&Úã YÔ~¹×´=>͢Λqý,pI»¢êí(ýøH©»xxTZWTÁ®Þ ½¨¢ü£óÇsbîO£Dú\c ÌÚJ4J^ä.à0A‡ŒFi‚Ø:ÒŸ«Â@RFQvÙò´2ú ìKª¨ýWÌ +öh©¢Ì2ì6»wzðj”6“@3U>É(íª,²Š”Œß5ô,ªÀÍîAQe¡*eJbl§¡–Ó»(nKG›¨´cÝ^À_ÔáBSiÖ4 ¥dTƒMVô±øf±þ/Ö¤QóÊͶ¸RQ.ÚŠ^ékcGç7 +%5ry±4éuò¢,±vJÀFgIqÝL‚Œµ/öZÒÆôu4ÐGMßõŽ~Æ)Rm uíÏ8]JÅVkîH ?R"WètîÒ†¼$7!îR¤êô%n))RÈŽZ¯ƒÕdß/¤†'¤‰±¦©KCƒÄjp«.¥Ê9p©‘üDu)ñÞ!Î}olÆß ÃÕ4ôi„3«K3Ú55ª5c]²þãÙOGMþAª9(X¨^Y]ò+žë™ðƒT.+> +™Y¨b>öñ„ð¹Ñ,—P·ÌÓNêR + ‡„™Á¾î9¥ +†ÿ¨ƒ!‘ ÄÔðUÄzƒM1õªÛ‹ºG±…æ]=ê’e~ZtêA|¥¿ª÷š>Ѩ{2þÔ©Kšú‘ywÉ,ô|Z«3/ᥠ̛ ¢æ%ËC𹯦;¤È¦¹<¿Dk6ýà N:áÛXß]âÌǼdÞ`R¡J¶†©Õ";“„ï!5iûªäÓÔÉ»¤4[&ÓDKŠ=¤ˆåvïà<¾R$svÐ3$ìD ëЦ¤©¦”áØ¬Ý]‚:‡¦­ïÒ‡GŠ*NbxÞ¥µ­¸‰”ëÉ(M&RWâÖ¾yш‰™L¤ÖŠØG``©ò§æ‚dyéÝ}b÷RuHÛŠRÔ½¤ï6ÆA ¨ä^¤tB6lØà0•l/ýèoXÃ*&¦U!{Ij+òÍ&ì%9–ÈíUž¬AÎEÊ€r‰©dl‘ú¨]Ƥ4õ%¨'ï_jmè I)bª¼(@’âßœí>4`HR¡5‚ì#óÀ”ÌÆÐ"ÛýKˆD7#6BDd#IÕ„ˆ()¨©7±Õ¢D0ym…A#½†²\RRÝÌu<)^J +«5wku‰Pš]RRgÑaoá*õGJª9;™µ…Êí¿tÖ²­Ðš~’Ôò0È|Ðû/9ª›]™qƒ´X%IJãÊà EÞeø/ÑÃÖ D3‰ûîÔÿR-x}X°¯þKK÷nöÂ5H +ìÿK 6Y©çúÉ>’ÂöbÖŸÅx êKTªzK l6çéKÇÓ_*`/¬ù¢.}ÖÔr±Ó'Q)|  ÷LÈ +Ý I•Hj%ë¦1ŒÍƒý%¾Ð¥"$,€÷—Œ†Ò@‚9§Ü"YRÂÕ*‡òsYúR,©4ÌŽ$VàÊ@ 8#Iu]È9ÜÚ^ÞëKò"ÿù8)gõ¥¨¸Zˆ@“Õ‚ìŸ üZ_zµ {éç½¹8ˆa‰:u<’ZÕj¬¤†œW_B£ŒÅˆÀÔ¢J_Êœƒo6ºrywüŽ'?áoLWL?Ú#åÎξðã–cz¤š¹kÏ­OõH=ݯ?/Ëy—z S˜)®'¾¬Æô=V쥙?})6Ú•4»ÛK}éË«€ÕXo„IÑ—ÖŽ—ìÝû}L•žv‰{úX÷•8ÿbîSÔd,CMJâÞ8ÿèj +<Õþ’"á—‰ßq©¦¬¿…;›ºM‘mlŒ ª¶d +S=eØSfL.,ž0c¦X– l«3Êä©1.ÓD¢õe&ÏÇ—ÁRª“ïLjŽçfkH¦¥t…¦WZN:š|l;Ð¥éä°šÀcù š2g~b¬©w±Û«kÚ‰Mç ØšMÚÎH°6±Èa© #üÖÉДÝd`oÊnŸÖåã·)5åß–eŠw+Ÿoš3Ö” ù÷‰t6¯–)NVz›š§=­BࡎÁNÝÕðxÓ)„Ñ:”RÛJDø–Ô/!§¨~ÕœŠ²Áì¥1Gý8E’Ü;ò8 !§zøü‰ÙMlNü›Õ=ÞX³9‰„sA¢‰VÙæä¯9Û˜JÃæ$G§g‰€:6§ÈÂéž[KàqÊaãLèúZŠ@|ºqð‚p(|¥ê]©rçs¾‰sóÃðeê”âÙŠë䣹à„Bët‘ Îl^Ëã\¼äð L'~˜Î•a•HT¬Re'±½E cjç³ì¤³S¼ä[úôÈÞ)ÔfÀn ¸d'‡D ê*‚&;iuBã%;¥ÂlµK¨½SŸnjphR€nöôd§(.“¯oók²Ó½Xs¤¡ßG;uÂ4AÿÆNB“>Ù)Víwjó …øxª8úäõ,S×éc>¯p$5×éÒEŠu¶÷Tæ @¤§6cmRufçœÞŒGS½Æ)8Ÿ¼r_߬Oj­Dð÷IlÉÒÑOd4­ÂŽÉ½õúÐêôú'IïGÙP¾d’ºVÒ?[:D¤*"U/²i×özåuó‚žíæFg„²GÊ_”až–L2qI2ªÇ§Éû¨šãšUnÚŒ_)ZôFTD Ú?Ä`R·Æ÷@¡úŽZ:¨™eRŸ¡£€À +)ÌI¨xüvßDñô ªbð?HŒ½A X +`8Fu›Ï6N=P‡Îs¡MÀ¼ô>ªÒìÐË/xA°ï%˜‚ÿ +×Cm:Š4ÿ@)€æÃÅWéóaU¸j@Õ3 ˜œ3:˜úãêËo}?}þ>M6ÐÁ¢i¸áß usSˆõÙ-P°i̤Q××︺寙]r¼¦Àü¨d¤æò<øÞ<'¦Ù#6õÔpX&ðÂ+µVÛƒ:öƒbÁ*ÿmöL–%„Ü?P˛ڑ&FbH‚ÐÄdûBåÔÌUø•1·wsvp¥×`ßÖ˜÷ºT¬uwÞ,ÊA!ÝBþKTPz óÃéî*¨‡ialâTA³¬…GW]J@²TPÀänû®8x²NöâÁÎGùh2ÚÒ¬( ’ +ò Ç ¡.àð¤³Jäc#¬…¨”Tßc™ ÓÓÏ žã})ù6Ô̸ÿŒ’U°Tõãö>۹ͭTW¡•ÿ®&qžöUjÃ[€¹O`Ñ®VPô‚ Ï8Ä€%·MPyý©ÞLÔàªÃß½•àsNB¤ÂK«*Íþذúë֫θx¯#“®Á ¨É}Ï”éx°Æ›ÓAå»b%Ô´:VŽs.ôø*)™HÝöI5û:·!ªFBR±žR]JíW£`FTkRUT±D蓼:Py¤úÑ+SÁÇl™3À±ä½lfÓ!ÕÖV#ä^”·!© A7нèQƒ¥ÑDÏNÈ#tÇ(¢qN aAA«÷ÑV!©ö ev ª sÐtVã{¨@Î=&(kLÈ£©N4 € ÌRÚŒÎøgxÛþžEM”Ô' Ì(+× Ð7(¹•WŸåºS*)™ +²¬ÛWp R^Ä%3Hò¸îò{Té¤ZiÑ$Œÿ8PÿÑ! k¤5•É/¾ Š“ãcâ’¨&J +±nô0†(¤²†¨ðtz›‰ùjgÿ¸8BÿêHˆyg4PçÍÂ&¨g +ßÄä'ЍðRó] ï@µ¦ DlËÏv è ÿð»S;èŒ(èòª-` =ü¨¦­ù¬Zöu^h— © “ÁT&UÝÏÅ8‰Ôùj«ˆ E–“k£P©F7;Í»ÏN32õ¯:ÙPërN³UKxƒÊTÓtˆ +ø4àÅ^½@?UcAUvÊZ §Åªµ¨\A <¾¨iûIŠ2©BÄ£ð}©"Š5&Å©ÒqþÌÖ¨½\Þ¨”Œß ŸÍdePU@€ö<"Æ(9¥Ž}âô/êHy8—fzrºÛHRúÚ†¾iIe•í\Ü&UT>—zÿ¤ðRŠóˆÈ¨Ô`ŠÚ°´ÉŽÀFD%ðêª#ÅU0n¤Z*#<´æR ù¢àKéUœÀã~*öqq„§',âêR5š€ ´ð¬…©!ÊW5ˆ]þïòNq„©[é"Áš~ ó¼ªêà8 ó󪯇DÓZðÁü^*²‡‚$ª‰êáäÔ—€ùÈÖ½«Š4ƒ²Ü»ª$jÝ|)"§W™j`£>º•ÔÃT“½O)LÙ„5ë3†©ÍŽÔ¬6ô^Α SHøx~Îd¯ÒèS¥ôÀ&Oâù—rÎ8¥ª>0Áêz•ÊÏÆ†BœY¯Bå[ïĒ諪! +Õ‹ñÌ™‚iÕáãôW™Ûê`TÐU25æ‚Ü€.®‘©¥‡®B‰?ä#S´È$'9á`}USç½h>32¥t TB]™¢»¾KëÊÒWÁ™+5SB¹ã¡hœšÃyaÍ +mG©/U^3ÅuÜ‹è‚üWA§6‚Á +áNUy¸j¹¦¸ùL=nS|CãÿMBuDï/Ì>]jee±‚s.$S,uè‘•ñóÏQ·§r&·wûš3À}láü§´¼(ŸAµk½ùBguÈ&òFëÖH¡ªÑêK¹à_=‡h%ÙH+—‚ù[TÀæQaIÅ©Æ}Y.ã1.Ï£ºAïkeCM;jlÖ©ÅE[ÑD/¨Ï^'ª <$’åV»˜½ˆ»Use/U%Ú®¨á¿•è9u áŠ[ªªÄUs×ôÖ²qµ?2ùæürOHÕ¤iÕ%ì¦ÁW²eSr¿îñ,·Êƒ·ÖÊU¦APšÏ¨£®VG4ëXMã¥ìˆ'Hj¥ÝÍG˜pÝU)ßSô>TÑ8cÎáÕFOð¾lVK"[ó³BªîÌsŸ^DZaWUW«W¥+«g¯ËZ«¯êÀ­üžwZ4¾*N`ØÏW#DXö[ÐÒs6ˆ«¡:†ÎL“;犓u1ñÿŠlÏGYfè½w `!tõ¶öìsñòƒ·+óÕâU« x%O^u„Ç¥WÛ"h°zT¢ö +Cã»B ¯0Ü‚ öÕ ÁF ½ î—ª‚¯R «Æ7g,ñ‰” Ù6šë¯Ö/*Ým:ÀÒV=š³“yÐä[ _RjѲ`äöY+²°V¸08”ÿVk¸LajT¥ÝöX)ͺ.æY•’o> +,¨ÞÑq¤ýE± e,K²ŠLT$n4±±‹ÒñR¥FOµ­kÕ&a¶L‡ÊÓ<<%°`DýsàküO.`0Ç:<ÍÖÏK’̬ˆKóÑ?¶>7™ÐΚù:å„DrKsoަ&TBX•R ×–Á®¢ Úôô?PXê×?e¾_@φ%ÎÑCÒX ½òîÐäç*-…xR`Éz!-°˜@ʞν‘Gp–`«~µë‰l«1Â<,œÆ÷ðÝÀòîð·¥ Ö>5°¼ ¬ v~¥<Û1gÖ€é4ÎÃÆ¨pHIúßk0ÐuÙ ¬½€d+]­Å¾i\Ujµª=Í'¾ó¦òVŽÁ¹ÎtZGô öÊ­à´ûVbCÈoOBŒ•ýiƒhEI>u +1X’§.áDvƬªø‹ØSÜ–kO7Å/¡ø×_UóækÞNÿƒ%‰ã@iÏ/( –jý ¾ÿŠÐk¸jÁòòIì?¢7 Ûêg˜õÏpkÁê†$á¬J”íy z>÷’â¬ξÏU° Q¸ýDȡɧ4¯­ŸÎŽW°Â°y’3H•Ê‹û¡Þò+ñèC©û•2#áL²šµÚ:œz‡Ø^ûójs.ê,Êy'D +ÌÜe0Œ¹0doLŽ1Zéö«`Á…ÇN ”KxFG±¤wVåöxÜ,éOá9ŽÐ‚ ],œ70¬œÇ‚%1a)±±â²`ýt><´¡ki –%•G,[ Qƒy¬LãZÄ"›]ÉN›º1^xª‡®köjX3 +ÖŠVgxä Öß1{kêi~,X¤JÀå wV VRù—B,2òX°Ú[擊ö®ON\3x[)+,¯Âàþ¤Y?Gg°H –æ\Ôµ^]¯ÅTXû™Ïä4¢vaÁRø+všÏ-XºËÏdñ|ZÀ‚•iöGoÉ8Ò Ç ¸U俲øX‹ˆgLéb˜ 3Ùkí+Ù2[°š èNô†yj#åŸb [WÜnÁ’¨²hYÒÐqÄG@¦%è2 ¿Âvø©‘"˜Ä¾šß~GXß»¶T°%X)¡²9ʾ“¾N2…ÅWBŠÕŸ V*öÛo 9è?‰_ñ8ÁúÒþÈXDIr€¸åKoñù„6‚|õÌq¬Öc©ož‚Écd)l,Ñ÷;*¶àKNi”ÞóÒœ«€ŽÙôS½¨’`­Ú¤‰dS ŽÛ÷œ#XÉR¦-q"X|„jŒ†ìì`wèéᨵ ym¬›LE9NÚ¡.O‚2o$n VÊYÖìó´K° +U "XJù&=ñiè—ëº&Lð+¯®q^ÞÁÂWÙçðpç÷k‰NçU.:«é XÊ^±ïŒCñÆí,KtÏz7ÔXŠ^?JÏân¡–Û,§˜&'5Ø=–Ãð¨L&§o!X™*ÚtôA°œBþÿÒ‹’Âõ}M°YnÖH€ }» ©LÇd1ËÀráÐå„1\Eú3Ték'D`ï`GèWÏm]Ãg™¸ä}ŒaRò"u`É8W¼Õùúë ÂÞ8òdñ¾Xí%-ZgNVæÛ2e^ +¹…¨\ÔÅ »8Wóô,è ¬†õf‘X ,ãJ°©ÜX´ì1–o– F(…kŠR‰úVö«ßfk·Ž>A«^`ÔÊBʽlEt¤ÿÍmBÿ²¨WVîçWÆaC%‹á8,=É>ò]¾… +°¦ü[Ê(àªR]`‘s0Û+{F`5팪—ó›.°ŽgÿÈŸxÿUU`µ­šº6èY'‘-Aµ 8ÏY°.! %0UOæôµÄ¬¬þ\dX1VHlºY„¤°Ù0…ä/—oMQSÅcF™Z2ã9^uöPKu•жÜ|ð!{ËN!±ÈÊ8-fM`½~Óþ²‚0×K€7O`9’ûçÒã”°¨aš~>ùXGi$œ«ýžsîh ,ÛsáȆ¤ÀZFÇ© ƒV¸*’È:,½ÈÈ© +¬ÜјI¥ÀZUj9\'Xäîð(°” vˆT­ +¬QæÊS`B2 +d`0¡ÉÀò+l?´È¶ ,ÒߘÕE9(|”e =, î1ͨF¤‚xíVD„ç–ÏÝ”äÓs­û4i`1ã·Ä\Ô¦ÈØh`yà‚3 +ü€.a—`%ÜUÿ:—(¢Õã«Uö“Ípï8Íq“áøùj`ÍdÛ½%‚ôwNn`½™N>;;°¬jä©- –mÂé1šéÀR€—pv;°ôtï`›‚n-'#Ò + [¿ÂGgÆÜ+XÞ)TËv`…ê5<Ÿ­ù\á’(ù A:3êXŒ€É–!¼½\f€7°€A8Àh`H¿Œ !ðXâ£t,,4r`}š©‡é‡T•:Ù£æ¬t`YÄé,ub€‘,•°}ÀNì<°ŒpDƒƒ;„¨-*c¡ô–Ñê\ÐÖqDx4–t9ñþÞæX!æù<.°Ç öG‘”™\†á„jÿ•–uªê†#‚oèô“sÓÏÓ½ˆ`Brá^¡óI krÜ(ØÞÀá6'‚•—Ò@õñ«]¬eP»-ó!|ÐC‡à§ª?b”Œc¾˜W5ÉŒUÁòÖ”¹ÁJ‡¢ÅÂok‚ƒßõwU#Áº§ryÊ;d‚e_[ú% RÛGB…¾t’! +©¸s°¤W£‰ËÔ&r°‘¬4 +ÐeiBU~û—µ é`m¿FwµôÄ—,ÿ‡G§ª»"I–†=ã—¯ƒ^9gö­ª8[ø°}j/ýÂVyåV<Üv°ˆ+GÓ|,¯«fKyõ…jg©®˜µ£AJ ·ëäÅýê}ë¡s•QSùßÅ¿,¯Ê\ w°œ§É0øé`™ñômôì`‘_Ú9ÜÒ‡tÙ›±.}5±ýƒõãµgàim2×ÖI5/…䌄õlø YÂjßgÅ+êC«™h:ìa¥±þ74јl[ ‚JˆV`΋&n“|°’’§6Nÿ È<‰Cö'xb$-~°Ä¡ãðD€¨vñÁ2îHTƒb>Xè*Èr{9ކµoÉäЂ%ëë&p@ +ë‚?'–Ñxç9”ŒÈðÜœ°º&és/ +²Jþ ¼Á«ÝëÍ-Z„˜ž°È N–¹AñÂj'~Ã*¨!Ý(¬@*zg®…u2®bÆüâÀÖÞ©( +kÃ~;Ä@tIä~U¦§4- +‹'lžj³8"…Å+ô .ö;ý °:‘&**O(,wù(¼™¢XHQX_ùô¢°LbƯ@È@a™.ʼ&›ÏGyP+#•£°„Ã#Âï‚«0UÖ0ô±3¬sÓiA$‚ÎJVàö µLÏŸ Àèç !(¬iý‰)ô!°ÅUQX_Ì,[36ܬCꮲ¡°Dºr »&›Z/PXøXê×$ôRHæ§)Ž^¼·c=‡Â²t¡~$: +ëì‘0È +«®L°mcI…4¤°Î P‡j|j ),')åéZrp•),ßx‚‰/âMa™ÑdY¤D)¬ÍŽ™qV¥°.%…7˜ï¬Tª°€YeÅYìȲU…õp)ñdQ£Ó±üÜÕ²"…e‡æ…ÕÛ‹±w5…¥yÂx‰ÀwÔóLa-WŸæA·k[õí°•ÂÊIÁ»}F†v +KǹHVaÑ}³éQqµkSaA`KõØŠ¼vxÄ*¬ÅmÔö˜*]…Å5ûó/I1Q…e_=ðKËl¸¨°\MÔz'ÂG¢*,™/ºlou…5ÅZ] Cz´D p1b’ÊWX¢Œ‰$ž°+¬AU¨H> +V!ÿÌ1¨Îèi…õ ÷t……r2ï!ÇÈů°æ"Aò"ë^1ýÖ‚D=‹GucD»R5»I_ª÷ +«wÒ ¸£]a‰ÚMYÓ´pæ_aá±ñòÍækW‰‘h…E}ŽrKäq©°ºn PÄ]BˆWaa)VßþÁþ¨°‘{ù›µ©°r‰/ã¹Ð×X…‡ÍÚÖÎh]¬Ââ ÅS2ø+,™Ãýv‹Z•à ++­ß|RV…%¾Õfš!%©°´GÅÛWX®èÇ6TXœM¡`„£íB U˜¤ÂzÃ+ìÖ¦RaIxÀD.'VX3Êû½ñVX›ß-BºX¸ïèkRaç÷ç©]•Ga-(ô“(¬X5¶Öœ©ð€Â²øÄ^Ë=¨ÖÒêÈ EaÝúÕ°öEè ¾8 º¹²¹úF¹ª¶ôü'¬:? $ò„Ezå`ô³Ÿ°ÄÝš™…•Ü*¨ý ¼4¢°¸ìÀ/û VK*»àZ£€ZQX¬ß0 ¸'²¢°Ò¯Š'˜ _ +K!‹È´åî„¥XŠª<EMn)^/E›°\°G,D]ÕD¢fyaÙÚÃü…•†DfôDV ºo£I +G4ÇKƒ­Òe?D-,[¿?…F¥R k¼®ÿx§„ º`…×u!L¶ˆ Œã@«ovU×_pNLøÂÂȱ ZâEÓ<‚‚…ÐíÜe»¬ þi5Ï„¿°¼Â5v°‹P9¾°ToŽ k 2>>åùY²–À.¢#îôÂÊb yX/¬Ðÿ2©Ñ£ÃòIb¤»`60¬Æœ²‹»$x/,oW|Á[fûÊ(¤ðÜ;ŽT‘ò›¯,5 +5ˆªÏ°ì1¹‚/î)Ì «X5Ù-ÜÎ'q–ð¬ÄŠTÅP–™9¨FåÜØ„aI™B]Dõ_ÛaXηúý=7ïÙ`XÀR@¶t;fyàŠÎ†z-½Ì:V‘‹–à1 `XßfÜÀC.laXu¶"aX¬ÌŠà~RdF&20¬¶é0m,¶Öñ’Arf +Càiíxû1¬•_Ñy³Íé$k´LÛ1¬£«ú/¸Óˆa1u€)øÍÁ$ž–¼ôøÎ,ìð¸=‡6°¶;yJ®í­’' A>h[V9 +¶æþ3`X£éò$AG0¬˜ShÅY¿¯‘R:{†Å߯£€L¿rÎäç(À°8cdéZ%°ފ5§çð(w|€FÞÉú|*¹ëRkNm: ‹¶­žE„\Æ&/ùÖrâ—†UGª¦VÂæL`X¹r„˜ +?aX&¹j%-È>ñáÍí8ùJ0¬”gè«Ãò( D0¬œ2‡ÅÂöX“«L[‘*{ˆk˜áRwTE¹Ñ9 VšÜÚä3Ða™_€ŽYÞbbk×aÂÚÛiÌç‹J‡yÅCÁ*¼¹Ãò¹]©yÒ{î°”6°iõ<µ;,Iþìd¡—Û]Xî° ]@mhc߬ÊÀ=,Jæ:XôÚ=S\;ÊËiíëÉ~Û+–ý8þ+xñFvV +Ü6EèÙ<,/ (¢”?ùèèˆÆ*®Û†L ¾ ‚žKêâÁ¢½#ÄÃÂígE¾=vXÍðÑL2¯K"@ÚÀVŸpEðdE‡/ 6Ԯ밆ñIÕäз«ò)¯è…¦ÃZÖJÔd ìl§ä=®½ÐauœÐ›D~¢]+ã»°Á¤»žÃJM#”«Wóʆš¡9™Ã¢u®¸H8Æ%Ìa­Š•ò +K#|rXnÊ„`ÙÕÆÐÉ+ å°®®0Ú­ÒÍaq¿`ºÀ©uX‘Jwc_³2h®Ãb›×Ða-À$3ŒÔÁAÈ +ÖÇå ²˜Zž‹¾ƒ˜áè°ô<ì±>+tX®‹ØX2%Ê»ÃÚ Ãkþ/®>xÁÏͲÝÿ`•¸”µ¶§µ˜|†]ewq ô°bø)%h‹¥ÇÂÖPPÎrüÒ‹¯1=,•ùöj°Ñ}‹¯Ž*ÚÃòaãÔJ‹_y‹$n¦‡eÊ|͘ÜÞ’}6\õ°LëKižÅš ÛÕë(9 5ßR¹‡å­ä~éa­ÛÛz—' ¤îüèc‡¹‡¥óÍö`•µ¤÷ÅU3{Xñ"ƒßa=¬ººÄNä”C’yÊ–ÛF*]~Âsam•HÐBZ©izXŽ A(  +‡³Së²Dê-ízT¨î&‹=¬$ïßÞ ®Úê°:Ï÷ áûéÀg Èl8G8Ò¤ÜzX ëŒÝ€¯“]šwÞÍy>,kÙ¤!±Ò¾æÃÂdG8l3‡û°ÔÎh5ÃV”Ǿ²-sG‹äÆ´‡å(Çw …(£¥“ ¶ãçaõ2Ðm†–<¬ãµ/ª!xƒÂhW»ÉÎ;¬Ž(%Þ¼wB¡UIAóœs‘Öcd›.p 7VbØ>âKVÊ!E²JK’I,x檖®Þ{Xá­Ýzöc—뻃ºîaí+ +KööM{XCu qÇôõ°ÄH3äûN>`ÖŠñ°¦õ°ví¤d-å›´© ÇLô°ª‡&ÓÝÃÂþFn=¬æiM˜CÈû°ö+¨Úîa©‹òz<ÉxÓ÷aÙK[ýK’Cõ‡å ÿ[,Æê=Àr¯¿Ñ¥Ü”iK«bëÙÙ±_†‚d(ûe(”Ø/Cñ°¤´Nÿ‡â‚"¤7XÈð +B à¸`lÁ:p*Vhò€ŠhËl¢ð :œ¢'á!,„ %\Ìq‚®,\„r&2#¸— Ã,U8ºnã(:ŠuóçRl„÷è3…™Â4((î=e˜üM§ kQ¢ …nïƒa29B’B·ÃB¡É®I¡TàÕ”|°‹ªÞ$Ÿ$š° ÎO^´ý1ü[Ú±zÊ’#®ƒšØ(2ÑpF;ºÎ—ÊxŽû”þö+Ò‡Ómê³G`xEÔK`+íøÁ߃súgÞâ?lÇÿiû<9â˜\ ßÑÁÓÿ + ?Æg6ü«egøWKSHu’±üˆ®oø4ï¡è¾œÁ¯)'¿øÃ”Q42‘!Xþ éi0¤j‡æ’UøÆ(ÃgjÎ…>…y0"q­íqrì_tø‚Â=ʽ!ñQÎÈ—}„ qØ„ÅB +ß,,ᑨͳ™ÂlÓ¦™öæEUOf)’pÏAªêöDÒ +Ú7|ÌPŠfÁjL?·PÓñRkkŒ¸Z“1-ÒK(„ŒèŸå1›‹A+%:ﯓ~ÿÞ×Ù`?œÓ Rh:lr`{Öo ÈøêfΙ>G(óèü?ɘ†Â9†—Œð1Ä"+ü=Jc'P£QûCœzÖMÕÿ£÷óoÉo.C¨Ð²¯±ËetøœóùÌ‘óÎE*¶O4‚z‚œ BòÚí/åü&ÿ‘a~Êÿ!ze½Æ—ö8±Èÿ!Â,‹ˆ‚ÂcÜ(M’ºäŸa(þÊßáW-4ÂNÉR£ÿ–ž¾Óà´Rþ.ÿP©xß&Ïžó/S&X)>UªA|ª¢žUH§ŒÐ©ÆðÃrËãŒàã~œÁw°úÅ”ÔLñ0êAï" cÃóŸ”Kìœî‚â!|¾g$õÂl›6 Ú¦Õ›a‚Ô½àQÁ 1E%d’P!›f»!ìâCWaxϘ‡‡¾6+Ì#rìÄ=—…F´ á› c…Cø„‘dˆàëá;â!H‘RiÂÓ¦….bhr‰îQ®Î"EÐá[˜¤0j%ŸÑÛóIC2󆙗&ÆÃÀß!S_¢OŸÀJ”²…V|ªAý'Z'4!…y + ž?jÐ;z1ÛlëãqqŽÆgx¸è{âEÏ7¦ç¨z$yVpÀ€8l–õ y*\ + >^!£0Zˆ2‚ŠoBP¥m×:üÄÃÙM„`ôTœá½0"øA:[ „%‚¦$‚K” 8C3 ‹3>Vœ1Ù +˜9‰3Cœ1ÜïpÂp†àòÉ4{ z8Â7ã3#Îð¥§Ìµ¬…ŽˆÚ×Ä2Š3fËfMœLŠâ i¢A~ŠÅe%Íf¡Êý8‰3üü°Äë¸`”fl åõ&¢Îh®@6¥utJ¬f‡k=h|a,%–J”“ÃPØX¢qÌã7`/£ÖòjàB\+FQÄç6†· §=}Qç—Ughaúgø¡ PÒŠ˜í¡ÓøŠ}°Q BFÄ”ÃÛþ¨²2ΈÇ/KÖÃB™=dIp8ˆfW²_1œ7I!Uþ†w0CëøpˆdïY¾]NGOx~¯A²]jèœ(Àø’Õ¹v¹«PÁN•%$¡éA1µ²ËÇ,=e3æíD&Ñ“ÚFÄ€ªVˆ3ÎÀ>€@DzŽ8¦Í…xþq6!Î(ª¾#=¿0•gjô`3ÝCÁàKÖ^nÖøu3”d”ÈWˆ3h{ +mµjªPTÅ"í¯È ÍqŒ½¿ènø‘ÊK˜0Y£î0Œs¸HÃGŸZÉ<ÎÐW¿¸?¾IU‡¹A¨îWa8£ƒ!4—ê4Fbž¥‡3  Öv0¥g€ÛÑìmC•xÊÐUF‡0®Ú½.Mq…4p|ÆfÏc6ˆ3¶`ëF™•æg 3®¦ÃÆãb£U‹8ãË<Ò¢½&QÞï/ob•3Ê24M±LÌñšd aÄ Î`‚§o°™¨e BœqUØ©Jôb…8#$aâÃ/þÐ@cæõ(‘ƒ%Eq†¬ëärJi—¼³ÅíÊ^¦€8Ãyõ)8œ@œ‘X¨ü:É×)yfjù`5\XÆ””zúïËw\ʨ2¥‡‹½¦ ¦ôçžûÈÐ0Þ¦¸?Œ'‰3 OÌ*æù¼;üÜC&¥$ΘÛ#ÇH’Ù‘ˆ{èdxxOòSˆFâ-θÞ~}÷nI“Ù\œñ¬^êï™(ƒ½O‡î¦ß§œÔ¿`!nÿçEq: v„R4D;ä ¢ç{‘„—¾Ã ÓéRƒ)‹6?`·»Qƒœ?˜$$gÄãí XÒ–ëýC–tØ`4q4#‹’3¨M7­/ŠËUåèÀîŠq'£Å„ù bRG)g‰ôèlãe’”3ìŒ_Hã„á‹@bv9WzÊl»^šwfÊ”)#(J C̪ I ”DØ*O!9ã#Àc6Úƒù6>ûOþ‘·oL¦(gÈ:‰³GT‹Gàwž‡žœÁÝÿ¦NùE€K&nKNÎðC*àáž(‹5‡Ëf¦ÛG^´Ç\h“udEZ—b œaý_è€B…L9ãã° áòRκviÄ|k(æ`i@{­>WÎHw£ù¡Œ€Y•3^MÈÆyÙ˜›5Z*ÊIï.ضn¾wO•3yˆ OÚ`ºUÎ`àËe ΘDV9C½2FÇ/8àvJå ë'“‹ØmüÆš—ž˜×ÜvFçîÝ-•ŠùºŽV+Ñ2 ¬œáÉ`UºŸó¨óÊ'ÍÜ=®ºÛUÎzu$¡¾’£ú÷B5;Ò®œ1€#ÖÒD<6U‘%«’²,k Óí S·!|x>oƒ57©Hþ7Š’ò&Öì#Í4†)e,¨‡Ö î×ÊÑ´„˜™':¬œ1¡KÅúTzm“`Í!¦â“ Å}ã™™€Êˆ*Ñö×\ž¨·buŒR 8™¨ü¬9tÈê[Ì\•3–+sæ“ÀB=H\Î9¨8DÍŽ¬0g5¾^eŠ20;è»ÒnA¯ùe5{/“)+Fª”åxY6„ËÐQX.^Ú,ÒÎærFžtjÂù²r‰®Í˶”A)h%ôîÕ{EIþrFy/–ôr†u+ØÉrËŽCŒ]PЉN üGpø¹ uÞ¢œ9#”Pë–õ¸0ά9ÜYíLÛ‘„¤+ê‚;ËÇjïÍRDJ·x KºJÔv3Â`ò +ÐL² +¢” Ì為‚õ#_bÆ AæŒgMXªwf¶r³—s^!a +hk¬9(öéZÄ8J!æŒÄ}$ӧⵜqÿ¶­Ô¶ -g¤G2†ða±Eˬ9L+åH|;ÑAVÎ “·æ-J$ÿrFÑf‚YÌü&‰æªÏ¡ŽJßöSnØhiaå¸ë%¤–q +Gvþ5C“œ1gÈeúcæý<»j+Ѽæ€j©slˆ9Cìü xk¨ÜMÄœñF­0M‰Äï»ðÞ?ƒ9cVÅ™æPQº"+ÁÚ™œT]è¨ÁA2ƒ®¨°"æ ^¦ÝÙ€Xi00g¤ñ­ìðŽ]¿ð’dÎÀ"aO×:»bf„¶s‰9Di_£~¨þٓ«átªIlª3gDé ómyg¨V„äuésƽÌAsÐ\˜3æÅ­ºaMÌa™åt¤Éò"’ùrLTÅ#¹ù]ÎÀ!TÖvÅD)]ÎØÚ“whL,rAó¢s9cÑa ·ôU˜éŸ ˆgæÄ,ÒV·7Œ Ì.ùQðÉÎõøBIIz˜ƒPª.2%µpƒIÌ—®2.ËÝ]ÂþÅ#w˜Ã"ì¯'}üp™h‡9¬xºX6…S„«K0g & ?Zº¢ÿç»”¹¼°²Ámš3hú +ØÌjÎE¸[+UE —hΘú+Z¥_Ø9£óÀÕ6¦‡71äbTïÖèLô6æyd^,­œ,Ï,Q(nŒ3Ú3gHUlwQÝ3{Ò´ES— ^oƒ©1ÉxÃcåi·¼GI€9#ùË2Ù?Œ.Å×r/ä£V¶´—3/ÛvtcU#q9ƒ€E¨L^h:'24Ävî0Š(X>ç–¼U-1Ù.…àRÓy¢Èª˜3 @ÄÒÿÆ®hÒÄоŒìbd1ù ÒìæŒÍ¥¤½˜3lÃüžxˆ9}d5‘*H‰6òîrž¡àÚëæHl§õ„ÝærF¥’EM¬Hì +e«5õ.L‰9@e# ›"8.g´}öàïs—l°rU_@¸28˜ýÙŠ—ß’ŸÓ sÍ3³Åxž‰9,Ö9ìÌeá.°@mɽœ±ÚUÑ@Š™—38Pö”sø¼CÀɽœ¼è,'gy9#‡@–ˆ,¬ÊÄîW'(ÍÙÓ.gI òØ…¿™q9£ҠyžìÆØˆœ•Pø[@JzMy/gDÍð;1]ßÊî™3 š/Eu¶7CεB/¬V'¸FMVÎ`¹ ÍP[”à›yEcïòB&üK¬âosˆÐ*ŸÙ‘ÅÚsàOÁ™¶y´XôD”3`¸GZòcSÎx"+]z‡îÀ—bÊ_j°ãåD÷4—„˜ƒêQü)gD©+T`ˆÅ†¦œaXk~RÔàØKÎ`[:SHÎø%‡AŒ:ýEs 2Ç`9¸…ŸœÁ1¶¤ÏSÄJ9C¸ÝëšÇÙQÎð¶yØCˆpÕGIðŸ Ô§œáÒW+Z{`ô±Šs>c*‹[‡‚C "‰UÎðeE P@âpVΨV÷+«ÄÅ*gln]nMÈrá•3J§»°ßØÕëTâÐ2 vƒ†«oo(æÊ'Ðf)½•¸•3î;{"×-m7¶$#<'VΘ®¦„ùÊÅ "Á.³¦çÃÙ ãW¤ÐÆŠÜŸiòæd–Ôâ”3<+â[ðÓð·†p@žåŒÁ' ,•'¬^:ƒ=˜Ïm¾åŒýÙ$ÅJŸD>¢Þ‡Ê±g@Õǽ;8|ŒÛnYÎØI ŠÇϰ|Áù7ÀVÃqb·ÂßÍ=Ö‡m'ÐH¹tVõ]l6rQy̆WÔrF͉@þ…¯&hê.:¸úe†´³|Ò¦ ßÈ-g°ÊUN©{Bˆ-Ìr†æX¸ œ.¾b @x‚Í Ð_¹å _ÑQ<±&¾× m9ãxó0$C{±¸O™‰ +ÛßXÎàÌHò`$ÌQ0Zvgý¶º"T.­E7J9·œñø˜eé5pybïü´DelZI$/,NÜr¡ó>±‡²œÑ”×!JíúĦr˜°›îÕ¡´íõZ*j çËWlþÓFœÄ ŠÏYÿ‚–=n ®°bÎA Wΰþ$|È®™ZÇ*gJù¥ã~” TÎè^±•\–äC†•3ÒP²ôÖIæ¸mÈÄF@@r •3Ð8!¥³Ø„ÏZÊ6ä;,”•D«®Ó$7^vPzÆî^Eªµ),T¼©+g!:XÎ@·Õð™=…-^ÌÉAoÆW‰"¦4EѵÁé9õÃaS¹Ž¿œT™K×ÚýŽØ°ìrFh+È©Å$bÎN®þD¸øhür†C’y\•6±Ÿ$ Å !sFž7‹íí›a/$‘³¡óOïNQm`ÄØi6p;ìÖ½,üz³á äµ#Uóz\Ù@¸NþÜÅܪ5’¤d[ÇI‹ïR9®ô;-…°Êt7 ÖbE„³ƒã+´Êù¬HrYhåŒåªKNɾ[ÎxêÑ̶ïœÂrÆÓY’ÛöªzxLBÁ_ä¾öþ5ÐûêРɌ°"^Î8ó$³Ú1ûÞõ5à³>ÂT«¹œqŠy<×g+œVëkxi*rÇŒ»œÁ3Dôr†ÒÏR3IÑÖU_ä{p”—3˜Ó"bÎΈõ‡ËF'0*IÐcø¹ík¸ÄÍiŸÞ¨1Ò cP§F ‰$­¯”ߘeH­Ÿ·íkxìS¦+äúL ¶¯Adl˜À‰îûûãÆ(o` +w¹Ý'{¿e²×À¿m)¥»&O²¯Áeu?å@UsaeóLy£} ¶#¡«¶V¶¯Í瓌ÞŸ:ÀlÁzörFØ…”D¢9+ò§¥¾ôw À¡‡4ßx9C6tO’=ÂðePêk¦»_Jg)®༜1à<I»¬å–¾"¨ Nà:¹²·½Ê¼œq>Î<,÷Ä\±[Ç +OÍaÈŸA”?%þ]OJ4:ÐÙ•²XÎ žyåLj¥œfOZL¢6} À5Ö‚çMaË(°åËðÇrF͇¾¨•»’ï?i9ƒo?‡ýï¯J¼†ú=ÃÁôw7(o†·’­v Ö\|QDxßMöÖ>!~:çœ\—3N MÎ3_i×àÛ00‘³C@(í´fÜ(´kh‘„i9c—­]L èºÒ®FìKá¬å E‡yÇþ.Ï5Ðë“ÇÉö¥ ¡áãÉ  x˺E©ÙjåŒØ›B8áÊ95%ø‘†ˆ]̉«f° k­Ka"Š4ÖQ¸•3ð™ò ?Uâ(©<®a¹Éìó¨$L•3Äñ/´éLé +gDDÛ]Wþz=DåŒ +4êBÂÊ›L™Þ>¼îmÐ19Ѳ¹wÌ:ÁrÒ–Ç„xµ¡—®rÆJP¹Uྟ*oŠ–3Ê8ß,×òh0ªtFϯÂÙb9#Ïõ¯N•ªˆ·œöž‘Sži,'9á?o!ëÄÊWËÒ@Ä|\0G ¬ÒEÛ¾÷¡ög°¯‚a¾\T¯· “y«aU~)gVCj¾c×ìODmìÞr†r´/êÌ®¦Ôhö“å iõEbˆÿ‚ÍŠÉrFM$µŒS=,[ ˜Ž«Û=Ó”ch®bƒ$yÄr†å£;œà¸j˜åVÑ6˜>¬œ‘›h1í¯Tå hf‹Ô¤†WÞçªÁ€³ùJÀøiå 3¸rh—EÒK +Éd¢³›œaþ­åóÕ¬ …« †rÜ43’t»?\5X#˜·.+]ÌQµ 9ãY—AÎQ¦E`Sa¹j K¼¨uáÓ—œÑ]Jï¤ße–œa#ÓŒò„Ÿ,Hλ'êBö°.³>r†Ç¹#wàAzÔb”W©«àœËcøY{ä 8” F ŠÒ…%rÁ8$›¤‘’ý;rò¨ô€ìôq;2"g<µMêèx¾Ló4jtO l9ƒ  ÇçA¶ ¥¼u$g ¬T’ +BJ5 ¿üžép_¥¼¾Ð¨° ù‘3Ä;„©¢åG´?r†>ÃÇÉôâ U‡R I´ó Ç‘3Ö«ê…° sþ%9#nƒ6wY"‡aìä~óù]Ô¡û/²ª¡ŠÎ[7úöl³•ø‘3ÐkÙòŸz·˜…œÑìaS¶4T 9ƒVb¿jÁã 2üæ*Õ@+üÖ†¿Òd¼·R ñ=£3X;S‚Ķu=Û’ú‡ I@ÄN¤T†tx(ÕÈQ„ +K9Cp²ZÎXdøÙº‚Ü‹œq ÞË)èOV¿cÒsôWOb#gÀŽÖŸBþíúµÓ’x Ð¥`2”%i¶Ão-*\>)‘À-n£øRŒ?9cŒ Ê£ÚÉGÓ˜ÙXÀâQÃÏ'gDïEÓ<Þ~nOx:bÙcPeŽÿ“¥ÞrÎkɲ´.$(ì=-Á€t‰ÇSd%gtñJi,¾‡ä~'g:»gY¾ .î@Üú ƒhøé¢òoz.Ñ$M'n ¦ÿíbFXË”žœ CœÚi¼Ï‚°“œQìR]!¾Ë¥„º9äŒ$L ¬T=Ÿì‰œ‘ ª–c”þ'r.UצêÑØ…í#g˜J0(…Àã–÷LƒU="g8ctXØÅ²ú‘‡ƒ[4Oõø0 +2ÈœD‘3ª~‘ é)Þ g¨?ϵ 9c;Uê8Dz{7Õ‘WKçè¡ý™{CJÚ‡#g ^ÓËù`ú·7|:n Ÿ‚:X6ˆÓ½ßl…ŽOÊMíÀ›Hë©.{Èò Å‘=…œáÆ{ýŽ1Ü»ƒg$û1ÌÕÀm ,ÚU!”ªrFJ¤–V’ÖÃ\¾ð!g˜jÊí3®8â]Ïm g*5>ò:Ü{œ‘(˜<Ð1ëqÆÌ®Çý¼×¾ +Ü€"mÓã ïjv36>à6†Îž™ˆÛf¸_3±³­š×ò6†ŽZ èÇÎæãQ£_ŸbèŽH0§¿c즠ãÛh¢÷ýiq€”=¡:WÔÛÔ )œÁ˜ì™C/ôõm²º{߯  +x\ˆ ++n (4öO>û“ûÎg@bܪ[F¯â`-'¤h!ÎÈ{IÐDK;s'θÒñ çåå+– <“H”q†uðC^¢ªZ†PLzñÊé³â t£>ßQ@q†®nFþ$PãqF¾OFÚk â8¯±bu4á?Â~OœÑ†’y‚R…ÅT_tIеa4ZúÇ l 8C¦P äDÍ-±2®t¸‘4“³”¶æŒc(`G^}_¨Wð‹3.§5àâê–À]ŠO9<‡a;)ná3ãŒ\­2O±º¬Ê8Ãy¾¡ÂûûŸbPGo—~‘„ÒRgè5žø‹¡D~#Å2θ€YF]Ôðã U9-DÓUÊJ „Laö_‹3\ZnZI¾LIQ©g´É«[Øl’ä1Äג̳¿íB#o«¯q†Kö{§º‘¤´q”ȵ ¡Ä‡¡ß÷–È€%—.À»1--Üh:ÖqÆ^ªËE±<ÿívg¼TÛA؃yŠîã H× Àiß ïqF)ü>—¶ZµJƒŠ„IÝȾ>΀ày‘Œ:ÄâÈaèѬßvìP \ÿ*t8‹3Ö‘šA3+ÝFãŒÝ +C¶¡Ur"‡á(Í0À‚D‹ØÝi¬(9 B\¸ÀcwZÄa¸œY->dzœ¡ê\%ñ’8 X¬±(é±B…‡áà×/yËK>`DY=Îð©q|a¬ÒVœ?rQ :Hf+#gø©eþ.rFÀ<7«8JÎ|ÐKÎpŠžàõçý’32ê e ý "gX™i0‚o£°ÈО¨ù +#L§èø9c„_ÅÁ[ìÅ3Ô²2B¸º¯Rÿš’Ã3o4ÙÈ©ƒ‡$,Èa€‘ôŽFªø~l‹+™>NB9 Ðä"€ gèUâ»,Òþ:ÎÀÀ1…è†ÎëFµî8£òÎY7À4Ÿ])²l¡qœük$s`ÎäΟhœqdOŸ._³Ÿÿ3"ܹmš=NýÆ„Žl$®£¤Ü1©Éax)㮊d.“ÃÐ01¼ßg, rD©¹Îï g˜ÔŽ*oìøÚð鳲͗d‰ÃàÀΡ- GÏiœmŽ-… £7ã |ÑF·óUõÒ°½¾ßEq´\BŒcfœÑ·pOÊ=Έ”Á·™å<É£g ¶§²SótŒÃðeÑ‹~ÉâÌÔg0\ Ðã0(D´s»—iÆãL{©¼™qÆ_ɵ]Vˆ_*1½ú§Ô>h¿•ØÝIªW‘㌒Ÿä«¸z}y±™ÆapÖ5ÞQµ"ã Äö‘è|tltÖס&Wuúq +ý¥Ñ4aMû?W2Î@¿j5´»nCýÝ8ƒ(<¸ús“‚LT}ˆB*–q©ª4/–<ê.ì±±(h9oÂZÁ}Hgh†ªégœ1\åUg\SgÈq·3:sÖã :—¢(T ‘ÛªA†C3 4λ¡|U}…,9£L4Ï–¿äŒŸeoÎÈêø"9#Ù2*D£"na¸AÑÌ4òrÊÒ®ýÚ‘3ÊZ6üÔT3-ðˆ„×u3 ÏìžôÚ£/¤¼…ÁsÏÔ/»fGèT¥¸~â!gèðHŸ&^%µ8ªä- ÖYOI +rÛ·BÀÛÈåÔè—S8NÇmî­^AΨcX«naè#ƒ7é?äŒèо[¬­CÎ@ª6®ežä ›òŠÖužL)E(âv*0Lu,S„¦j¶÷·0D†³Y}™üãŒ&æ|(Õu˨@…—`TâöžØ$¥ðspSÎCÚF3¾B7ÎÀ`œáÛ|§Vxg”¾˜o1„ ÃjYu«OÛfÜUø7êý­Ýö Â\,΀á³uŽšoüäÏÅZÉ…qFt—G&Ý8c ˜C "Q„Ëæd§óîÎÏÈqFx6xU6_år}V¢ B¡^/ð)"ªmFQu—¤*Kvœ†ù° Ú† +§‰ +ÝÙsð[o::e5© +-C’£3qaà‹Í`X.ÎÙ¸0de¶¼Ú€ ƒr¯n1%âŠ,Ɇ C43EB… ÃQQ9âÂà"@ÿö5t¶0œÙ÷³¯×÷ ¸0ũȺԺîSIÅ"µsÿÝz½Wœ±BŽÌ ÎK*ÔâàRøÚÀ/ÙjòÙNq†Ö¼6õ0—16i Z>ME.*žÄ4´¼¨4Š0 ®ëð5*%»@h&!¬ @gT»×6ESãN®ÚŒ–8ƒ@5¹ëzÃÁc³­í¤n†Ižÿ[ 8ò²¬àd$ ¹ûŸÌÆš‹8C—eIœ$Wu!$EÄ«°hÈ›à›ƒò·Ùë{?KÄà [îˆûö(ÈÂO¥ÇŠw0ÔÜòZY-E0œ±)ƒÃ᪠50¿+# øë}x¢ÝôFÈó6CÀ“&†ñÄÀå¾ÈgÜ`Rƒàï]èxÃgåçÏ0øä¡1ű¬ÕðÁV­gœ`Яüb² _‰—_<O‡EqÆØoÊ¡Œ¡ w‚s¥Û&q}»˜jÐÝÓ¼ÓH• …ðƒc}"‰p[à nUü>ËãŒw¨Õ %Û7×VåÅŒÚJ·œÅÒéúg€š19™cS$g”&¸Ç"0äDIgrÎÒlsJê[K¯p‚Ô²8cãôi‹;m¬åÃåý­\%ûê8Á@Ñ\="Ûà^œ`¨÷ú“Ú‹3<(£zO÷¥­ÅþWGÈ8ãå ± gø r'£ø,Îøpëг8ƒúô°‹ØÕ¦µ8ã +ìãg´KÚ  œÂå×ðøê°8cpC”BÉÿ"áü¢ŸàbôíSHœ‘ÎÝËÊ8Ãùž-ß^ˆŒ¿ œ±Gs§Ú‰J\Z"§øg =ü<Ú™¾GÎÒ"ÎÀ"ȸâ!W@œ¬Át¹ÎÌDœqRŠNé]Óq®¾° ±ì÷ZG(9¢/˜5¸²`+ßÀ$pR®‰3œêÕÎR¿‘_<ˆÄÄüc4‚+~‰©}±/ìï0 ‰3®Ù)нÛž9ÜŸ-jÏDʽi3m«pD½†⌳_Ü.÷6nœì»w âŒíL§)ÓDœ±Oº5=ÄËû·lŒŠÍób]¡±8&äÐÏŒÀé"ÎpˆÌg\“› ˆqMqF‚³AFå¢0/ö™)ùp%ƒPœ$0Lš·Ú§(Í3¿ùÖ[©8éBŸ«£úô8‚ò&xÉI‚¬Ð#ßoš‡rNÑ0sõðô×c”Í€PèË8CŒqæÌ#/ò÷ÙaÝEA‘z7³€ÃØ…Kü.kJ¯ÈAµ†±å{jlÍj¼-È%iˆqÆhªf¯l3örÆY¤¢/Šÿ†qFü²I0U1^ö/bѾ4$oµõ¥Â8ðî 1{ ñ\"‡ÃË+Esf$fœ¡ãS¼±7kÏ8ÃÈž³÷w¿ +ʰ\ïï×" wä‚¿ÂÈà$²ôt††AÅïŸÆJvå°[l¤¤d¬ø’ŒI7#ZÅAŠ3(ƒˆæßñ8ÐÀ†-´ÆŸ dn"+$Ýh”Ô)΀–‚èý¦Šâ-„/ _ìzšÌéâ¦eø &Îzå…³®¿Â¾ š1%öˆ3œ‚2œãŽ@9¾ÚΣƒ6M×"ˆ†xØŽ# +`Ä”q¶…¾$¸3#S6àiÖbtàŒò©y©áÚòcœQäùô?‹>$g g«• †“à ˆE©'Tí#yÚ2=×p¾|g™”i0C3P*´ü\Y¡ ˜èò#pEt!Ÿwý]eÎHäì@а¯há–+¿¡6ðÛgüú^€ë¾¡U ôm^¤CùƒÜ +jTÍ©«þ8QÌß PÚ¤æ~3 òÒ­/–*›kivZ³à '™e_¶ãFæ¡’‚úðïæß 4ÕHÉr ²’("ŠÅ¯—…¢Ü°e$/áß „ª[‡ùÆÂ3R7…”JC͆3¸ ÀL˜Y¼Û Â¿ÂXeÀÏW’IÁnX¨Á«,dèãz 4a×Ãàñõ%ô͘­<¬Âø…ßf“ͪäD.­üzfÔ†@2€QGaR±o†²ÛØâuT8²pÝr˜ìÈÙ}}3’·š] G÷o.øK1伡³Âæ›1æÃêmKRUc¡S* [ŠbX^ᾺÛBWl|3"„D¿@ncÝFê1œJ`†‰é7ÙÐÅî7CºÆG)¢~¶ipÂxÂSô›¡zTÄ p ó›ÑT’ŸTE!€[~3Hµ,»¬0/ ÉoÀ«Z—_Xð'#ô¯ÂoôY–LéDjx_a +G©–ð Yí›Ax|®ÆC,x¯Pƒ}aû?ãç³¶Hâz}ž|÷ÏéúoFÄ€ñ¼’?£ûÍò>艜g6ç(?æ7Cf©s+?Øt×o†a–àt3é7¬dŒË`ïœcºŸ£&yIè6<¯eìoFuý׬ñ»Iß +‹¨šþ fWæûÛ%Ô¢L;xW§lwsÏõùÍÀðqŒZÁb­Úíj¾Å0JRÀÖ‡R|PÛá¤nÚ!*O›?›•œ¡ÞDè·àŒ±%¢Í- ÇnÖ‘œñÒr¡+²¼“PÞUæoư2b;«¬¸Æüþ›!ç¥Ñ¦.¡RÝEÞ.n{cð'ûºé%Áð‘áëlÒ·\ fh ‹È…[£«`ÞXš¯»àŒ·c ‰©ÿUbU@—‹ý½Qô|z«êz0à OhGy»ðoÆ4+C|¬¥5RpÆ1Žó#­ƒ30Ö]K­±ðÉl©Áàé3î+š.Q΢,j)"¤ÚTø%FÓ¢þ²(Œ£S¨é³z)µáœ9íHo[ú|@ßÛ—aéPÍÓ ˆêá$âŒ}Ò,&GúÏKà¨æ0úl‰3+„‹\²øÇSQT𙓓>ƒ_€-E½¥¨*˜-pcþðž¹ .lǼ‰õ;"!_ÄÌúL•ß ¶z> +užõEá…Ø2AUØ«°»ÞV²QrWTbUÆ%wg¼šª’™CêäÏk^()]ŒºÃ·xr8Ù¸‡3@ortã…Ô‡3\ï0o!SÓ!|a25e8CZQˆC/‰$M Ò­-aoZ8!†“™Â¿‘—, +hQ md +1y1ÙyÝÒݵ‘)¨Oýèt\™Â¢êè&‹Áá 3o×j6œaN¿yÅ!è-Æ€6øTP÷1ýhÓ+¹¿¿ed +-Ó¦ˆRb2b„á ™x:¢$-έ´Ã-»á ­Ûö£ƒÊ •Lá’¸›m°n†3€<¶x€T¶Ò|d“ð’)ðÕM;.UHÎC\[?G†ÑØáŒbH0°ÊÝi¯d +=š–3ë !™Â%ÛÒñ§×]»`X4GûB °y`àñ”‚8CµêvXBh,$᥀b5ßSå S[žÈ&%é’Ò[ +ð.L[/Ú›?ôè[ +Óq{r5:GºÄ?Z¡Ÿ6ºÄÞR¸‘M)8G½¶œq¿‡Õ4êÃ'ü¶r8K&9s¿ùta)C© sѽs½Çœ×]òCŸ’þúOAvu½Eœ‘tú…ÅT'ÎX)RK£¶ÚR +íè57š;·Œ<‹z­‹½nÆmKÇß#*S/x0új(ªl¼(÷ëigl•tâŒð¾5®¯In<g¤ ¸:þYùJªÒuk-…|³Åe ËÄíÏiMÛ¨Rqp]l¤þ#Îà5¸vÇ Cœ!_á* OȰò¼–‚³0èc]Gó9å^KA%L¨-ñÂÒy-…»#ùÜN­š¡öÃdÆ/íÜ=©YÄþCgŒGFõ;Hi¯PP_oÄpF"J.ÑM;RÔyþ†3ÜÈði>¢ÙóÞN™Ú{ à‰N¹ð :‚¬θ ƒÙ¸oFRÓÍ€„ÉÚŒ»ÛŠÍh]d{Ö D™?ÔŒ $£G3®ÆË½fK}f4KÉn730.3N´ÉŒ¥cÆœŸê·]FÛ–Œ,0ã—$ЂÝþ2¶ø—!'“e-$µÉÖfd'û¿2ÚMæ¬mžKËX–,ã XÿV†xW6KeH°“åU%W'[‚%ÓÉ>%Ú“M  ÉÜ ÉÉð8»É\F“QóK†ÍJ†Ÿ&29Y%’1¼#Ó=¯ŠrôdD ›'ËôÙ B<ÕAÆ#sŒì d¸ïǸ £šc'c1J“é:FÚRƹÑñRÓ3˜ÃÉ3Ò¦‘Ôó’1žJ4ÆÁeŒ–cŒç +c\{2Å#%”ñ\ŒsO6j1 r²‹U²X14̈à)ÆR‘¡QŒoUî‚c°œlúa´T%S‰ºäCbĤÈ*0b˜8ÙN'z²µÂÐAÙ$Æé1ÌÞ‡‘”‡q4O‡q/”¡à0þø†á eÀÆf¾P¶ðمaÚ³/ ƒÂPöXN…£ÂÀE¾Æ—¬|š‹' ´Šú1”EÞÒBsFÏPv„ñw(C©zg _ÙZˆæˆÃvæœ3Šf0ÎDs¡ Æ/CႱÅQßPÖ)Ì\n%Š£€#l¹,Œà Œ[si#ØcÁR¥#0Ê­-Ù†Ìa./À8@ƒ¹‘ÉŠ À˜AáEøØœ¿à{¿°d²§ú…2Ì/$†_|›lu_ =öÅ‚úâîóÅ!–/ü/<›l _iLöø^PB÷Âí…7±’fM–W;ê„ÎÆ\½?æxËuô"÷y!~Óõt²HÎÜ9ÙsødšJŸL–'ûÉ$eRó"U§y1p,Ê\þ“‰5/Vjlæ„Þ2gõr€i^È€2­*ô%ÞÄô'ç‰²Ê P”é(ŸÓA™2u¢Á †dÞ-™9J™Š²ÎÍ ´ +aÓXe +®V¦_ËcYi -ãL¶l‰¸Ìk¬Ë|L/“"Ñ~™°ÌÜÌ v³ß†+ÆÌs!3÷wÂ0S!ÏLÓ$ó"Y4Ã1/&§™W³n6óyÚl"€–›9a^ÌÞlH„AÆzÓ̽r¦”3µg93 TøŠAK@§l«3½ºÚ™ýÎ(^EÁó/93//Jä³ïÿ–•û¸ÿ3±¬ê}æk4h2ÐͽÕtí¯¡1ɇ +æÅÄüH4Jæ…æQ4»ESU`ô‚Ih¡é™/ýÑè*Æ~´Æ>Z>ËPH{êHÓ3/þ—4’u`f“˜|bUÕƒNˆ*/ ÊªLC^ü>Ú@ªÙb¼(¯iŸ‡>tˆÃ‹Ãé´‰^”JÙzïÓà 2Aí»v ¡†¢±ÒðâÏ¢öL 5½1¥æ®LëZ6!ªÁ¼©6dUÍ8¼xõª^à³ZCƒ«…C^Í*krÜbÍ=”5ѵxÀ´æÙkí3Üš÷‹_yCIø,©ðµ\3†¯3áš,¼`çÖ>rˆáÅ2°µpx1>­Íýˆ–ð¬-*kÑpuµá—[ÏZ€‘†+kΫÆ%. +fÉÄÍygÎáÅÆn0Öþpk䌲¦¹:kÏQýWŒ@`·5¼|Z£X7ØÏ)¨ÜZXºøð¢K¸f!¹¶LŠÚ© ^œ'®­¤NLâÅ.B3\ë2¬:âEÌ®KhÌ/Éxáâ¿‹Ùì]lG˜ÝCÍJ7´pmcwñº\Æ]µ]\E»ø…ìÂï×…§®ÍÖ…äZ]ÀºX6] Ö‘t!–®µ]<ô]HŽþ\ÈŒ®UعؖIÕæ¢T‡ÌÅtË…¼”‹#Œ¿-Ñ5‹‘¡pÔà—Y¸÷< »=;Rë‰Þî.=ʇó¤'òB¶yârÄ$OÀ—¸’x"€âÀ×TÜpw.‹kn'¢¿–y©K5 +1nã:ÜŒ¡:‘^ãÐÒ‰78†ŠO¸<Î.tb÷qo>AN›†œqµÈ©Ô¹vyä,ÉI®&…NpåävÊPNÆ0å¤W•cÚ+WFÎr4ÁåB‚—C'¾s&£˜Ó…N¼˜Ì)3çØIiÎyášÃU݆NðB­úš#)-è:¡ i.lgÎÂØfNW¶C'Ú#lú1-%s¦Gæ‚×ÌiD'ÍùQ5çÏæÞªD'ž7·Éç,ý8B9×9PÏ5KzN7t¢äs—Ð Äös> k7ƒŽåWè–÷Ð u¢atzè„‘£{DHg ˆM‹u»ÀAÆùf²aN8žœ(PéC'Ž*2œH2逃ú&î&âM$‡nBs²w›è[›À¶ÙÄ‚ØD安ÝBÙÛ¬‰hHǨš8&Ý5ÔL4&hCWP¥s¡‰]>â{&˜@âŽWñ`Ò™bU:k𯙍r&®^ºéU:ᥓ[¥óæLl›Ë™è~6­t¤¦"¯Ò o& +)‹6¸¸™Èué ÎÌL§7:Ëtp\2ÝgÂý64v:ÇÎ傜‰ãŸn7&6ít;ü§+/”¬Ì™˜C@jŠf¤5ÎÄ"£*Žæwº”3‘½O›ÎŠM—mët4ßN—‚/«9¨N‡€éq&¶Øt­œ‰Uä“çL`œæ@%]õS Ì„ï6Z,ȱ蓉­6s21•”xéW"›î L4«™€`ü¯Ø‰**uÓõ2Eç'Óix¬=©0áY ÁAE6óTrŠ(ðD\ÈD¸Nÿùé\ß´4ØT©³‡Wø^`zU7 …Êת Î¦C­3àºu¬3×yé]×–Ù÷ÚЯSÑ`Çú?ì쉌‹þAv"zÊ.[+|}‰L(ñì R´kðâ´›&Z½‘ ¼­»ëÈÄe‘Rr»ŽdâÂ2ï¯V˽ÉÁ]aÀ¸ó¬Ê]šd„dDÓsuÆŽLt쯻d×]9-[wçøãA"¥]wž‘‰GAåc80n™a É‘ à„Lxåv¸Ñ ï/ïH¤Þ•Uu…³ˆÎK2ñÆRè¼+P¬Ý;ïºTdcz~îsT2¸½«%#¹w1‚ºw4 2±éþÞ»™ˆ5,.J½;GµÑègLï.PJï"]`ôï%Œòùa)Lx­.˜°»3 w¦`â06êó΃ +/qÑ‚‰w•Wýˆõyg%Åü‚µáÎ5˜(aïέntÞéUBÚt—0ʵ_¢X\¾Ä>½Ä›)¼I£îHÙQ¼„´Ê÷tW½…—X>—ž»LvîfFPcºsð9»ß%&¤;wµî´w‰¬¶;BIÿîxEäݵDÞ=ˆK ÜöNò–Èä;Øl‰kß­ª%àíwYh‰ð¿˜%.Bà ‘% "xb‰˜ÁÃ%.ç®ÄE‘¾ìVâä+¼7 Þá*S/¾U"6â¡Z%n'ÞŠ*~Å‹JD0úSâÓx›ðr¼ÚR"Ûã$%Ž7l”D#/Ð(–<QâLˆeÄ«ÑáôÅÓJ„ƒø~‡ô$zKï:‰XœÄC*TB1—<‰$ñ¨ó/‰¡¼- ÙV/”ĶM –<(Iâ“$p ¨,‡’Äet»s]IBìtNÓÒ ‘ÈŒ#14ç‰ “+#¾ä¹šHLî™HXÅ!' Ô!KO޼– ‰É]«rE‹õBžðu;’A‰5þâÈ#7?™CCùËôGqÚìôõãŽ8òãÿ’G½#v•¢qXrâ5DG_kE½0yÈ›ÌO¶F€Óp„“0}#¸Ó¨eª›çA”G"#¾„X©¸œl‘K# tñшÛil·Ê+zs'¨‘žâÎE'F<*ŒX0¢/âлˆþ(«¹ˆU +MÃn÷Uíkg aSÀQ Ë"6Õj6Ê»°ƒòÉQþÝ VDÙâS¾<åA’Ôä kÑZË «P„iö‰8¤N„ℚÐTiC¡„Z"¢D”Xš¼ÂWá_ ´x6’ˆ/·xãQ0"R¹."Pü¦N¶ˆ ID̤ý=ŒìÃ…¿ÛúЗú`JúpÉßS Íá|P¾|˜¹4C9º÷«ÌÖ}o/ù·¿wËþ÷:õ÷\æßË&p$ø#N>„ùïµé¾7òÃïÅ3ÀçÀ·Ò³ÊVð5ÊÀÿŸ¼”7Á‡º O>ôðñ58¼ãÁJÕzžvøHŇcâ#>L_|C~ãSÛÁgg‚å\¾Ö0“e¾à }7_æéÎǃ`ú* O‰ÀÌ/$úÔà‚“¾4à`pú§ÛºÔ‡™æ;@ã°ï¦àƒo.Â'ºÓéËR»¯Êzï³ì€Ÿ°ðó |¦c»>Ü:~#Á‡¢Éo®à +̨œ_¶…~"B>ÐÒ/`\žÇÏøPvýJ“§ÎõíGrÃûa¿h窟§“¿4à“óî—îÒðaßõ·¢·?AÀ‡=øwÉ£(/ðï—“—¿Sé_oÿ*Nþ‹í?•í?, ¥¢±€˜hÞ;€FM€ý~»¾kÀNìþ= ª4|¬)0ð_ö¢p|ÀÍÐø"È€´‰‡/èîÈ®´mù!Ò•_!àTàžOÞG‡¥ØÚ+b××¢ó{XZë9æ=¼¨{ЪÀ.ÜÃ|x¶óùsûÙÃ’±‡ùë¶õð]\=¬Vôà¶±Ôä*ðZeæŸæ“{ý ‹Úˆö…þRô@7D‡zéÐ=W1´Uãáø†jyh-ʃɃ»* «‚S¬³ñàØâáHø]úé*PYOw‡®ø$x ûª„(ó;¸ +¾Cèy‡Ó8ÞÞ«;üfî°î°E+A"`W AØ+°9סóÙA ¤–æÐjì𞱃Fz–ã:$Öáš ´¯AE³ê®S+ÒÔaÙ¨Ãÿx:ðr¬M£Ãè˜Co‹¡t°wœ?:x·@¶è°·¡ƒ5A{û°WžƒÙ7ƒ‘ÒÁ9lͳ½à5×d9s˜¡¼ânXȳâ©, ŸÊÁ¦ ÎL‘(ÊäŠClFC rxéq8Ç:4¶[àÎ8Xl—Ç-îU6¶&ÜC²%ö¾u8ðÌá0 Ãáñ ‡AeÕiVÅ“TWSp`-pxN€Ã!Ãv>Þ0¿Âìa­=´2ÚPQعox)Ž“o¨²ÛZ[Â(}‘Éôª@¹Ý`VÞB¹PºAŠ^Á>®š[ #hru8Ì‹-°Cqì+m(ñ60³ÒÛ†¦Ùm×ïZ ¥Úð™‚×Q˜àèMÚ,ðÚ!gD ˜ wx' d¥=6D}T±¡× Ê ‚ òk›×à^]ƒ~¸¶iŸ5ØY൱3Jõ\ËËQ3 ²}|ÏÛËa†Ë­J{5@,/^ Jí䈎#½ÚiïlÁÝ«Ýè…Ð\^ $­X`Q¦\‰6†qÒÉßÑ99/ t£d4a÷ÀÖX`úˆ]ýJ£›HÀ÷ŸÊ?üÂcæ¸Ü²«á樒Âm*#HB}®PWCµs5,¶CöÛ4‹«]Sè+(’yê +ŒXjuû +D´+Ðb+PÚá·–‘Ñ0ÔZ[T3,àjÀ¾E] ;³üšîjÀÄ +D¦‹V ç®@Û}Z÷rª¸k¨h»^uº¬†M>E†„S5œ2àJªTCûˆK §`©Á¯+p*5(^J ´¶#HÊF¶Ç+5pG l‹VàÊ«HänÏ +¬P,5ŒJ©áÄlj)„`Á +tfᤇ¹Ïo"4$J š¬MjàïM¥ÎRCø¶aH[¯_†J ËáƒRÁªâxåS&à…–ÌÒC*°› ¢ÅuVj0 +:ÔmêRÿ‡Eß§ +lR¦†•Rµ“ +ÙRSƒf¨½˜¦ž=S-à"Œ…çódCÔàðPCSÈÄOÃÞ§gø¹Nh:NšN“kFb6³4$Ò0x¤¡®Y|4t¬ÑðÁ¢!9¢!¦NCÃq+Ð"4'ä +„¾_Ǭîq÷Ï·Õg8ȱg˜Žg8×Î ãÇ+𭟯@ Ñæ¡Jä J5·ÍÐÞšá"Íp"73Ô+$3$%føÄ ¹3ìü2œ»Ý×eÈ>®@¤-C³e¸–á(PÅ>]ÄW 22 õ]Z §þ¾ÂwÂൃ;ÿ õ÷ þ" Ápè ¼¡û/øè/à®_Gü‚7û‚Wì_à) +}• k”Oüì‡ï{¡U{A8Ö ‚úËè…7v0PvEÕ¼° ò‚30/p¡ÿ.¼éîÂvÜ.pË.X¬ë‚~ª Ò``–.l]Ð;è‚xœ ’— 6X.:.¸À@Å…È¢iKœÁÀ˜V~ p¡l<ÇŒ [¸ \p‰vmKl‚¸‰•'TõfðþçtàÇ^QÌKàB!àÂàNÅ•~Uˆ& lDàBà+.?8å[€(Cá-D¢S#%"Qð¹òÊÀ¾¸\º…ßo ¼ðÝFÿg¢•ÂÚÛ6|[`½ „¿¶ðCç˜-VlAËkÁKiè³¾0"›ظ¬…(ý5Jµ ÄKÝ Ç´€=Z01´àLŸõš ŸI¡fáË Ü5 ò‡Ô,4ùÑ|ËÀžuÍB3¶!v»–F,Ì@¡6 `W« ºe`[›<3ß,Ì,Ü.é¾ %NÆ9©]ª2p~Ìe!YsîIvØSvY ¢ RbÇÀHrÄËeCi©ª‚>¯Û>ÆÖè,Ÿ6D0 !/ÄE!…YÀÁ€â <`üÏ@š:B¥0 v–Ñ@‹ º²)f!:šf¹SB}õÄ,´Ã,…eÁ¾‰Ý“ FÎz,Ðh,Ü_±0š "ØhX8!‚Á‚~,Ø&À þœê+,Ù+H?^árÖ®€’h‚ˆ.é +^Ï €ˆrýà +XÜ +Z¿V°™Vðí¬ MYÁìb`}yä^¤““W5³ +v4Ð×U!K‘ªÂ3ø¥ +Ÿý UpÌ©0XÉÊqR¢e +4HßQá $)*€6°Z¨€™@…Õ| +\á)ÿœ‚7M5å˜)8º äl3Í0Ç |¯KTD@E.,Ý)q<)n`r%… #oo R¸)HÁ*‚48 +°œQ0nàêEÁîn`³¤ŠB™2QXDDa¬óPàÝÀ˜¡§BaÚD(¨ÜÀfPXAÁº +b˜œ…Mý@íŸ ðm a¸šËý p˜Ÿ ¦>á Â'|Ÿ nózÂ3ç Æo<^ñ-y'ØŸ`nu‚ÓQ /t‚@˜fN8!äýà r¿ òÔMбM`Œl‚Ó­ ¾m &5ṈIÆnàh‚Ü?d› ÞÀe-žÚÁ°,n#¾Ö˜@1áC˜pÒ ¼½Ùv Ò"—Ï-ÁgZ‚ÛÛ«¢R–U4³Ê‰`J–€=ÊDYžYÔ9º7°O¿±,Kˆ‡þ„ÛRYBòÈ8 ¬7pw¼,¡çsÔ³4ʸÆäú\£žJ–%[̶òºykÞ7Ю7PÏ,áëßÀ/k–e f öö7Pœ e4]–À­,a,8l›Ë +>°àê/K°c™²Xá °†Kó­dãJ°ƒõ*!œ©ñˆ~¡”àº(aTPÂå tž„þà$ÀžI8Ý@ÉKBwU,LNo ?$¡áq”줌ýÈš"AQ‘`p!aé !¤5HX&pr@Â’Ìô?ßÀr>uÊP8ú±ÜÚû~„˜ý=›˜È8°±6N'†û§~˜%¹=óÛG¸Ø*~÷D`›Uv<À°4*3~ËoÆîêGø—7o‹cÙq¼›Ù qOÔZÎV~âîÀ\YŸ±}ý Ømêfw F® +ÜÐß*>ðáüuéG8‰Õc?Â:î¨P +Í÷ÀG`x„׺ö@¼u„ 0éçÅØ!Á>{yh¡¢á/˜{ Iµ]\ÀÚNq>OP’¡Pµ:zþs:@㜶há4ÌaƒíøÔL•™™YQÃS…ùoáo§Þ.|ª9ö_™ŒH)¥”RJªVC†Ö…#@Ѷ n»hÛgÜœgínÚ½šý¬W˜UmûSe›¯Ç»ílÌÍ×kßßÚ¶×m×·ÿí[WÛ¯^ÖŸ*ës~;?ëE¶sãóSÇ !‚'ÿ]Û4ßÝÜíÿ{}Ï~íWO쵇©«ïíÆ·ÏoÜká[篿ÎÅëWß宿»­2òw#«ôžõ}¶ðùå2ÿ»>ótæe¬îê~×[ºÚ–?^¯´Ô]+5_Åû{í®;W—"*«¢¡:rÚºÚº1û2ëZ®¦1k2·w2ó²c.ó[.æyªÞϺ½ó-ã÷4ïÓum+Ï”mù­-Ýæ]Ÿ*¸þ^7s}Yb£.ËÔ>sM´äOWÇô3·tÜWKÌ^Ÿx¸®õÏQõÏ—ãjçë;^¿Ìvzëֺ˶óõk—¬Žv¿r០+ê.teDCîõE\CO¼[ù†½ÚpQ ×p‘{ÅÕ´µûÔ0™»?-Ï—e*Z®æû[úÚ½³õˆwg«oûŽs×r_¶Û.³q-[NóÚ«Ÿ¶’YQ1ß5—Ñîûõ±-=5Ó=Ó“9×ÿVòñÛ¯­ì_ëm]²s"fçRÝÔÜÝ_{ëܼå×ÚyÏÜ[ÿSÕžŸk¹ã7æ²ûU{¼^ɺð3÷Ïîš—ý¯üT­_öýgת¶íò›QÓîÒùÕßV®{oE~{O峕Ÿ*µ•Ù»òósݽíã7æzìîKëN·e~nëSµ’}Q׿]íÞ×÷ÙV=séúê<;Å…v}‡›ŽëñŒ?“Æ®ñÖÓ8Ï8ó?U¨¹¾¢².Ý”ÿ´QñV{W=uÉØûhËíüËRŸ{ û¶U 7—á)Zâ§ÊR—z/S]Aü̧Áç¶ÃOU†ñB„Jê;?Qý/õµméBûÖµï™Ê©°såïSeýŽKU!D¤`‘ZªMÔ\·e§¹«qómsóÓ99‘s—¶>v®Ïµ¹4ׯd®ÏO×užoxú»j燆š¨wªªªkÈŠªø¬ªÂn¨jˆš½LÝR%WÏVU}ßVUQõõSÕš«;­uß´×z­µ5?UÙêÚŽl®æª®¾ìæúú©z]Ú|»v×ÓÖí©íÚ¼åM»Õ{[DCîÅC[{»ˆ¸Ÿ*5ÜMËýTÉ»üÍÕ[jºûkº«‡ºº¶Ûj«·kï¾ížï¯é[¯¾Úò.¢ÞZ/.·²­îªéú.æe·øn}±ÝzSÖ;¶Ý;dt´äåwÉ«Wt-ó|•™?UÊŠw—hš™{¸LyÙ*¿òßò¾Ÿm¢g㟯߳i¯eªÜŒÉ̺2-Óј9“Ù˜×j󦛲nã¯OÞ¦ißv«­V^ ¯×öšµ—±s»m/¯eöÚlþÅw¾L[ùÚ×k¾­g@GQ=7xãS4E ¢'daÃ’T¨*ЭVà Q:ÁÈ“r„HY©DŠ +› ¥¢'£¨£(5DL.ì-½ðB§884yÑÓƒ‰LŽNptAyaÇѪ'G¨"MÈ "å„ ¤™CžPÔôX( Pƒò… –¨^¼` +¬àÛB >Èü =½ü9­À ²Z5<9@ +.ð,d[dø¡EP|xiŠaƒ +endstream endobj 18 0 obj <>stream +&0@>’døQ¢¹!´BÁ‡(x±¡ÉÅ ¡‡2=˜°ì-éÜ@zªù!ÂC'hÉ…§èI‡¤°¸ÒÔ-3üPb&HÒÊL¥6BL77ŒœfìY© ¤òòCiÅÌ‘“‰—R$à‚†%,#‡ .Ðòà "K'nfXRb&<ààzjÁÆ&5=–,0C)ï PD˜Q¨¹¡ œÜxaŠ bJ +ÁˆH‰±A´š )$b‚šJ€ÑAiŒ¤/4Q nB ?´èéDD’Zè%±°3D‰ÅGˆR ‘¦?CN.ô aBÁÆÇ5tp2€påæç¨ FN‘ +!% ¼üH"áB¤i…$¨6CJ-l‚4YãÃÉ +;? Ä QšjbAgˆ”$X„áˆë)XvXF¤ÔS¾R †Ej¥0C¥h+ÅB(°H™hq‚ŠKKLË „©K=À!Dä¸ìè°¤áÖZê +{w§T1Mõf„Ô!>vÛúú}®k³[ºë¯._UÅõ¦éfûî­îÙãnë+-R¸wݽº;Õ¼n»gRøª‰Þ½–½v§Cˆ˜Ábo¶\~«^ô¼Uj¹-ŸÝ·®F +3¼¹ºS‰î"|R&R¯Ëª!bEmmwj1ݽU"NHiÊ'µh+%“ºT‰Ô…a"Å©ÅÎ_)jBˆXi]9ïC7åîT_j‡åDjFM -8‰@ø"V4:M£{³±›÷gsšö +ÓôÂuä£ù[Ý\tËå½Õã´\åÖ¥ºª·²4—²¦®žfžŸ%gr.z¢% ^r"7ZÞq&_cnÞÊþ¶Nå5MÕEmG7ÝËï´sWTCÿôf_9^ötugçu÷fo÷Dcs_Æíë~›ŸªFsægg]{÷Ó³÷¶wß³µþÝöÛÖñÒ·ïÕÛõ×°‘Ÿóù•?™ÑõSÅúÌ ×YùZúÏ×ÿж×:þþõÿ|ÓÝõÿtóõÿT鿲)ê­¥*ÛO¾µËQ›Ó6÷W{õ~¯&fYÒ5è@aÜÀdÅMГŸ!R*ð2ƒ@‚!ì €P¡¡CRb„0PóCi…žD±@ ¡’Ñ20ƒÃ’ ¢¤ ÈøÐA`ÌÐCËðÑ4„V-lŠLqqCô´¢fˆi€€ñ!JÒ±i“㇓;B¢4`€X€Š|hQC”ăÇÑrr A™ 3ƒ%(ÁX¸!jÒhpb„6ѲcätósdŠ H;°¡Ã*¦çÈÉ#«žJ p~¢HÔè‘‚ ÜÀ'V d—š1(RØ¡ 0ƒ"´! ‰˜!Q"ТG!h  ÌE XpŽ˜<°c¨x$ʹQdIÇ#%!¦ ¸ibaCô$ãsä$³ƒ$*‡'?˜‘ƒdÊÍ#';Žœxì@‚zá)Zšá9òDJ¢dè%­È IAA¦HIÆÇ( + +:€Ô$C GžLƒ’)2°c‡¨8”<àžF°CITÆ c¡†$1n˜fzŽ<õÜ@òDcÓO’• $N;9Ššdp ‘"Ã' +Px =ñà8z¢ù1zš±aÊ¥§hãcEFSŠC+ ¡':@–TÔA±°9ŠbaSÊE”Š›L)n€HYq#´äÂSdµI¢bà‘$Êæç¨IÆF&$(ìPƒFP6@DM- +¹Æ0*@@Nñé†XSPãðÑÎLìbE” ùÇÞ„vÆx‰<\ÿñîÆ®yº°Í>MNa¬¶¥UF½œqÍåS¹ÝkîÃݲš‹äDšØtx 7mS¶â*úCˆÝ~Õ7-Ðæå½p;ðj››<š{M홀ÂzJ šàw°îÿ^d¿àyqNŠ<àôG]›¦Ý•-Ì|—´¬+*™óy Ik¶œR®ˆLØÑÖ+ù ’îâY‰|—n|¡Ð¤ÖÍà…ì¿ÓôÁÕjš ¶=;dŠeIð"Ó}È~ÞYöœ‚*+z%„©™zΪ#^†šFfbµÎîx¤f…Q¸ØØlq œÕ²ö`¨¼›MBæêò©Å4ObD¬™Ž fØÎ`3§™ÛG7°Ãºè& +¬´3 ‡Ž¯ì$"Ä +¦íüç +{ž%3"Q'}¨çág(Ñ[sq#Ñ6{!7MË€&¦(à æ>\¼ öG’ÂÖM´<›{ðÛ΂êŽ4<®662 öÈ(° R«IKóÔ&É0Ò!…š…v9Q¶­>0¶nZ4 ‘ì:¼’-j,\CˆV0ÇhO +³°0rÞ7Œ›ÆAhU˜­bß«;Kºsñq±#OºÚêLâ^¡É·÷BI‰ã³¶ÁwÎÌÖV¢‘Í¢ð?`n²¨“nWU-d¤ÒtÇ¥³l 0¡ÊÎø7{;!øF† F LÏÔðM×µ6ßtE +”ÒOÚíýi-é{±z¯%¼ÔƒL´À;Z—æ7I^&zO5éSëy{0æ d’¥F{ûIÂC›^‚ ÝW0ë¢ùÔ­ìBg )¾É€cZ‡e” bUgšª-˜%GVžJDÜü|eS¤Z0©YLo¡\T$K:¢Ž8&$0Ûüµ\ñ,Óåêµfó>LÞ¹Ž¢Ê»-ÝÐ=à#®î‡Ð]À­`5ðĹýšˆÔ5=ÿªWGUü=ÄûJ ¬7HòE0›v¤ˆöÔGÇÃRÐ!‘ê¥Ð-ƹó\} ¸‘ZŠƒÂn#•SŠÓPá3¯Cp[‹§wƒ^ñ´SËÉæòYELèßî'ÃyL0Üšy”¥ƒiz{nYmûÁŒ1Í ¹Zï›]Yißr¸‘”ždQ²Û)æi¤; Zßþ(H3õ +`ÐÓ`ŽÅr{}^Í{Ðä»_ïÙ«{3€_}Àä÷Î>›¶Ñy÷ã„ÃãúFµx ý¾q®Ê eÈÒ+çè1ü‡¢ÅêØt:@O–KíÄ£œUÞ/b|6kŽŸ<Z’Ñ•=ÝÞ(ÔÑë~Z˜r?ãL!ßܸ„iEô¶HœPĦ`ûã^ÄC»Š.N!ºA‹›©›ú:MhXª¢QES¦L&x&Jþ9ÁÆ4¹´˜d¢Œ/gÊâ±1¡ø]t*t¡Ìû…’!fm!1ŒïŠ\ìjäp§¨,HÒѲÜ`Ì3ñß=ÒÀ*\9ô‘àN¸›VýßÙ¡€ÖÚ-x•ZkxÆ÷‹¿TÙÃRäGÑq€³d BÍÿíݼ;Ö’Šè5ŒW'Ëãök‚}ÄÂÕ°Adø~*Ê'—Š‹ +M´Ÿ.çÙ¬sØ× [.ßg…¦¿¡Ñæ–+<5ÂtP’Q³zQ5¸ «T^¸úͨ«;À\ÞHÝ'DÅ›,ÔȾ¯nT¼¨ .+UË– €fcˆ€Ø„€“?p„š§è¶{Å;­çßñL +"S¥½WÇ;emÿ¦€‘&“@Ȧ‹2ÆYÙ¾®¸ºûÉ]œA“ $®JÈ3fªOš<ì¯mÄ%ó,‹ê1êáußF–Í>kÁà"¶¯¸¸Þ«×¡”Öj›œGÖ zÒ‘ÞÁµOë™c%Ò+Uú^’W¦ò¸}\”ѹ‰ÌrjÊ +)Ú££ç½SÍyŸv·.W!ö{]ÀW=ûK;O×a+‘Ôho®ªQHëQcó®q‡JA‚:ôw·`CÏÔÞ¥/2§øiœDåÒ°žÈ´^§–=Ɔûkÿ `OƒàA»u¤Ä_¤‘iC¢}jd} i#öì=:o;ÊŽFVÁH`tH9*Caz#÷*—bsDã¥S° ‚¿cd0a”¶$¶ûî†Ï©ÕùkGÐE ²+¬ÌN¨%o–†¾UœB±7yáò[’u޶ñP0Š|ñ¶BP8˜"KNx lz7Ç’Dè] yÚ+vä5Ežê•o §ö>.ÓÐÑõâXȺP[œLVš;ò–W9¯MÔ +”U(Õw +¾' Øà‡µ¶û’ÉÖÎ h`â€Ò—öv €3ÿ’Nƒ54 —úß źŽ@Ÿ°0¨99‘‹{Zÿ>ýÿ Ç®£š)¢èUF(Üü‘Öœþ¤Ôé˜F%Ï/×¹3ÈÐj~h¾Õl>öÑ6Vóô|àa@’ë[cÚK]˜íN Å?­Ùª´?ÜÚÅÀ–e³ù@Y5–ŶUpÑê€K©”Ë9Èûî°·d‹ì€º¹ì3h*t,èd…)Í`hD¯{‚ôÈ{]ø$sý„£‡t6ëU;½Y^Ž!úó˜!Çüž®û›µZ¬Ùo!%ß„2yöœ¾¼÷ʓЀ÷ÖG1]YgƒÓÉèPŸÑDÑ6øŠL^ Qêc[ÿ`I´q-ê;ÙsÑ^w,â³À•]±)êÓ‹1 ì£Ñ3¢²Ö°”< ¨ˆÁ0.ôÏ]È[@Wöˆn:=®9ƈýÑj`â ƒ·y6CKzè1¹7È…údyø[Ž Pã,:¿J€4˜w±dï0{÷\èWcF²’Žu6ùª}aÈ÷ –¥ŠÞÃ%ÒiwZÁkbÁIyÏÒ“”~%§‚Äeì)Öþ#:;SÏ D7_šHØ2‰ç²k?M Œë3Gí=ŠŸÒÅðµo§ˆs¿Yy‰Çìâ*ÃÞMÕ”éîú®u‰åã3‚Ó•u8bT„ …–¦`;ºný¾hÎ(Ç{Õ|«¥%Äš"_*ÇM[%&±ÃóꌪÚQØÝŒÖeÈèø,H»ßD;˜0Ëlþtùmò̽Ÿp)Ä\E¡5½¤šÓAÎoͳ,ƒ&wšR´xWÄ2å®ÏhåÂå¶ K•üQ^‰ý£RUî)í#Ëd66tDdtÏ +“$­#vL_ös”þ8ì‡à†õˆ¯8Ã…bp¬›Æ3£‹ÚÖmø¢nƒŒ„Øv€½÷·ùh¦Œ¶H–ÒYȺÛó{¼ ?ÿ|çÏ…:ö§¥0KåP‚røƒà㉿\€Öy¼²(4dà&˜»nazâ#JvSq§z×s:KB—uŒ*>Îu\°:Î>Ʀ*oÛf^gpuÈZÕÞô ¼êç;ËÙUÜ8Ð%±Ç:̤Š>Ù!Ž5¶Å &ăª&#q©Üa¦ ++ÑòsDK¹gíhrÀuæA|•pDämµº¢Õ|` D*Fh8°öm +…QŒ‚—Â~atamB#ð+Äâî´¦d˜Ì2Hô­ƒ(± B‘&t~˜²’LB™‘¶‰:áê׺º_…Õ«ûçÔoÛ0mÊE.9;,ecæ¡,µ21ùÕ5µ-.í¬ô¹)Öü9$6Š™C6öI¯ôÊþ;¥&ŽÝýëmîqù›ktë C}j¾BÚOÅ¥™YsÞs +Ÿå‚dXÕÂj0¹S;Ù¦m1>ŸDä9Š.á <UB^PÒ(L:v3!úÇ¢ÉÝ›AÐM†1&æŽ +Ûàûÿq(uᢲž'[еG¸ÐÓÓU¸h_mJ…¢u È 5¡(E. +›=Ã|ÄÅaë°Í°œÀËiù™¡7z§Ž› @šDzm†žx±†-RÖ´µ0¡õÈë´R8çëÁºÆiÛE©è½=V§‘÷ê2–f€<!d¦HÖpoˆDö §Û{É?\'Å +‘è×qíAéâªß!°³¿ý´ +H¾)6Â-¯1¥8Ò“Ø´7#pmoÑqõsMj—7’Žü»€ nƒe¿˜’×½UUÀYDôŽi’µY ý»>R°ü³¥×øn—²„Æ…:^ÌŒP'µ¶Vˆ€¡y3sõ{`.³iÚ™ :qžÝ e8ð¶ŸšÀÄ)’kO7pfáñ g£è~‹¸¾’ø©UÅŒVõüÔê?*ðƒQ[wÒ )ÅñáàL…<½;‡,”D^ s  ®ž.[…î»Ydãz·Õ"A¥°±ü­f'®6y„`2t+´Å«"Ü/ /9¢ÄäyrØìfxùÂd­@9à å«q²1‹¨/Öu37¸C€×X*Õʼn¹ TtåtG^ +±ÏÛ”ïÏŽ)/n4ÅôÓíô¹Ül)nìà‚ÞMæá'}qÉ6^|؈Âñ·”4[Ž ©pâŽ5¹„|†ÿ¯>²29=¾JÅÙµn:9Øé`tÑ¡–Ö›Ò² âÅË×Gî€ä3ÑÆ5*òrµŠènPF/©@q¹Fkþ-¡›³’4òâä)±5%ÝÞÐFç¶õ|3Èä $ûòoÍC‘ Úä‘Y1€%}Û c!³ôn‰.Snb×^²ú]À©h™ÉAù.ÜØ[¤Ä:{·"Ü{{2­ï;Áz¤ú[8MòØ.aÓ©ÿã '·= hLynÈèù‰ÑñpdAçÛ,o/P—à ¾6*¹×=Nb½¸‡—4#'„O…3²f’ÿáÍÐbx–ÖÙ©ÌÇ\íÄ4b Cõ\q ÛÉY6šækÁ6LKØÿÁˆ†ÕÐëS«‰>¿TýPœk¿bÜËñŽ2xú’â¸+F#*§Ì%˜I©>"ú3wÁ;#ÖҌϹmÆ[À”•ó„Iãø f\äªtDžO7L/×.ƒøž0œ l¼P<´{Aç!ðä’Ѷbª€ÎÓ´]hÚ¨PÎê‹vPAÍTUòÚÜHƒÏ˜q¢ _¶PEYVf”a–rZ¦Éâòü¹* ìù 25l÷à´²lXý“gTØ2Ý%Šp£b ÛU‰‡„Щ=Î÷ù”9?0â>ïEBÍ8†¾iMbŠÿaÝ@.6›×ÝqoZV*xKÌŒ~ˆPМÇTëáÎ_DpݾIQ˜Ö!”Êù†ñ0ïÎ9«†™Â{‹ÿ˜,†»ˆÒk Ò´´ÐÜn¡•³K:3rÔáKÁš}¬-Æx­ë,o“ÏB³‹’ÿrýEñÄb«­Bδä†Å`âëÔ+âªÅñûFº]jžD%v?OµD­aiˆ79ðx7eèž3WE\KÞ›:QG(m4¼Ô<ß_êŸÙàøÄ}ñ‘RpÉðÌj%džS–ã à %thXvŒþ"ìvÛL9°¾U$Âã-p¶¹÷„Éûgðí\Á¯G½L½ˆö÷¨‹‰‹nR¹kçìÆ"ˆ~M¾ ÆŠEÑg rÏ+Ë–P·O>7 ù‹öŸšE¹#ô4‚ϯ µ~,9“5¾7,F —wã?‘B( hÄGÐî}B£J¢} LÉ„mvK“ù1Y_d܆Z‘›ÞN` †¶aî¡GAÉœ¡çÙ‡ÄUxç  Î€øÀh‡“t_ŠU «Ü0šÈ:ð=q›| ß(÷ƒ¨]V™1¡¸€á(a® sb’†ç/TT€¥Ë#/\Ê)‘ƒ@&òŠèw‹Rð]á]ð6„SPhÙèåTÖÖº ~xÒ¡þ2S¶Ÿ0‰—Ô'b§?2eKÈ)÷Y“–*SÃÔ᫊|:ÅNÙ©R}/;o<Í΃2,¢N§õÓÀÉ{dA“¾’Ý@ç“I·ÂI ‚ܬ¼§£Ô1§f02!øŸê}Ì2è¤?ìo眻Ò;:‡!…‘éeEâ¦ÌBƒ­Gí„M»®›Çh¿Ï«ìì<žjÎðÝNEîgâßÜ)#tç/\)؉ªÃ¢étÑö¹«wtá›c>þP­lŸ êÔï}ÁŒ&Ïõ2/"Ågƒ¦;¥ã:K.`ªM4÷²zEœØ)ú›ÝqpôñŠÊt½E›îø˜NŸßÀ™Ã²¯î +:]ÒYD#wÇ4Øþ„ò”!&²ft¿9¨žðßJûË˨ۂB—h}^[»9ÀmäeRÉ$ŒZwüð2ýÊÑÓ^å×§µ\`Gì`iv3Ü—´·á¬~‰F]‘«ã;áÜwÊ.@¨N—»6b¨½F¥H¾”?Y?¹ßÄY²&G ’r`•W ! +^RìÜœ¦Óã_k0R’íGOJ¨‹òyy–€¼MÏ!"L› TPß½GìÊ?° ‰3±ë2Öâ$o°ˆãÖ‰ZŽ~”ÿwÎ\·ÝÀÚû2¥ÃDá)ÿÙ6‹GY#Úã+ŽÍèp”’X˜s­Ù„VêâÕÊѵjþаˆŽ‚±Ë`°÷º[ôÚ¨‰´¯¼wb¢¬ º|YJZ´F §_›)B¾W›,â³d?‡^ ¥ß‡Ä»Þz•Ù` õ‘>BàäÌp-x‘Kë-Tuù²ÒŒ.›vp@ÿ€zºâ|ãD¯®&òÚ¸SemÛ,(CCœ:ÙÑ»& +Ü[çÉ-zÃ(ÜŽÞn‘AÀ‹ÔEî±ú'éLŒÇÐWrƒ+§cê´ÕMyC¿úôŒ=œo 7 +XG׿¾ èÔ+|z,Q'¸.Ç5¶XdDzŠëí°3U­ 9HYŒ›‡©‚ý…{ÆÑ¹a%ØÊa¤æY;šìx|œªÎË?p‡zæ.ìšÒHµ¬W–âñ Á8HW)dȵ‹Új1´äo¦° øiïðC½À$ñ/zŠÌœéËaPèš—H>zv꓾p6G.½6³ÅOêû4-‡)wÚ +Ž”³¶3„áTLsUæÏÛE_…¥*t8E+Ëj µ•;åê/Và ·0t˜ud·€Ž¯Æ$zRY‰ˆçQ…“ç¾(ÁAèÅ·xdª›QÍb2eØd|}Y.Wë~Æ8¶á{TîØ'"¯?`Z™$Î^ƒeŒû Àñ‚•„¾…²NÙî@ˆ“êÒÿ+-ÝtL5Ù´G!*ÜÿGïŽI{bJŠÚÍav× +ùšµQ1u`zQã³W‚l[ßÔEÁºrÿ'çgGÆ>xv m€¹GÍƒßÆ¥³Ùǰ3mµý_Ò† +f"8¦ÝÛh¯[F‰ŒT®´ñ&nVŸA‹ºøjí–ý(M&vP\ÌE–„€dUFåómÁ…á\sigѺïœÎ9©mËÂñÄL»5KDkó#_t0ÃÆ¡ïõ® +üнÌN#KåØj£»t#K%híá%©…¶ÒÏ â„›J„\k•é,”¸Zq "ã;4þßø·'ÈEÞo‡‰º6¬åI#¡ÃÐÆöØø²Nª¿˜QV#ð÷øðÚ~x¿†qûºœ¾«ŽÜÀἦã¦Àƒ}"Õ'~V)8I怂Àz¬“0¾iUû‚ã2Q;çÃl.¶{¾bW,gjƒn—¥F6³·ëƒgŒ«x~ÔxÕÂÐ vÿ9¢¦uÌyË|6Y¬ iPE¯ËO&‡ŽÒ¼4 +“D¡Fˆì«l… .Ñv 7{ß/ !mÚÛ0Fvz?tFr˜.cÍÉÆày2Å•:Aøô;c¤Å©ÙEy¿Y‘ÿ%xž²ŽäàG„¥ç(AÄL/jnFV%ñ­xÌÍ.œæoQ:Q³ôkÂØo·ä¢EÄ2hu¨ÓÚUåép%­ËÙt‰Ÿúú$…iæ=¼”Mòo¯ž +T6ljLñV Ò‚ºÒXÿg×f©`l÷SFN¯™mq˜½ ¬.µý²Ä +œYÞ»" E¯ñ²}Åó¼?–zK!Èœ•Oæ Þ&† SÈñ#¨)Ñ» `8“f˜jÄCˆ‡þU­sßè'û š‘óZ%âo›yÓ`(ÈΉm•ªƒ{fqwáæ:«H'J²¡Ð Æ&Eˆ£0#$~+ÍÒ£ÜÚ² ç–9_k^|Ç3w¯¡ì¦YŒI³$ú6×] ëc‚J_|ÃíÚƒa…ÎP:!ZÜ6jg¤Ò3%™Áo?ªT„ÇJ0r¯ÚF'yø ¼_iù (7@LÝBÊÚ´ŸG!1 [‹¼Â4oÔGª¼iD ®PÃÓ Mtw+`|‰Ž8P&mµ߉šÍF’še•f¥mM6’ûxR))œÚ¿ú¬ Q|$ÄŠ2rwq霾øœvš?ì%#ª|Ô6¢*V9~ê•8 _ÎÖYœ´–lLÅ.zmFÏŒDvpÿ€‚©§Š÷7¾IZ^Õ‘Î{$:ñÁ*…ÇKjþEß^}ùæsPædR+§þ¤þ:+3ÈWÒ\aõ9•©¿õ¾J¥ÍW°…x‚Œ$P<ÎA 8óÜ[n΢™"L#æñ5ž¾^Ƙûð2QYÅ’iØ·ÓáL¨—R”ŽÕ gL«·)†û=á;ØÚG”,ˆ¤%Uð¼sZÜy€3‡ÐPዹµ@vr|`8+Ýßèæ—ªi•:Ý"Ð;»ìÏf„§5.õN–Ј¢Þßѧ–² SMålÄ|“oýl­ßëБ^’wšRˆa{%  + )øãwFf˜Ö…‡^"ž™TíÌè@/ Ø ý±ªÐTÙ.†/ ˆfg[~ G.`»|æ‚ÛfO”@i¸€ãJv.56UMi}å6b¼ÅMÕð½ó°(¢×惂kmE +Í@Б:üý…>òPú½(sP1‚o×ÔtŸQòvÿ +U;þÈé·´;:M”`œÿÔcn™^µ`4ÑPßöFF©XÂ>€Iâ‚®±0 ¹—¤Ë<+ Ñ<¨œÎO$å” ìÑy§æ¢Cñžm hÇ÷YD±‚ÙÑ _`¸¶¶2dpóõçö*5"6P2ZÂXÄh,×ÄFøä¿):qâ¾Õ5Æ)¹­ë°ÛA仡pb¸\/¼3ÁÙ Àpôþy0S{\8PíÙÓˆSˆ$#¾Ï ¶åÂX.A «4 YÇFf…>,Zrë7cz·Â(^~«jÛh1)d 1e{¹h>ü„Èà•Ø’ëù§&ö-œŸBë{≠F>CÙîyH3–,û $¼ö(³ƒ3ñ7 jQ ãNu~ûÛ +·ƒ0¼Ûoí”^$RíWJ¶ÞÕÿ° @0¿B# ëž²Ø<ÄÓâ­ïd°†ô”CZ—-¢q½=S žØV¥Mã?Z-˜_.âµ3°jÖ¡„âSÛ ;Ösr\jO?М ¼'pk¶'e…;.Tyª_”ÛÕ:|!—mRDÎ<1ŒÊYJÃV”÷q,ëµÈ9Œ¢­ø3‡O“­`Hp^¤lø'ZP²†A3Ãø¿ð]ahØó¿ø;ÏʈÇsZG‰¼‰5Ši­z:ž Q."ìÂ…Ô~œëZ$‚_¸‚¥Š\í +3÷‚ç Õó$FÇ^QK¬«^/8šò–FÏȲ:gAc<¢igyØtP©ôуÀ½tõ#ì£)`Jxß6_/:Ú‰6A9æ£p=Ô’™näælmQelÕ*±º.uEÇŠ@ÏŽ7| üXêwjþ?ù³·åÅÓóÚãθìnURS€<¤#º¯(«@äÃŽ"ãý8]!˜ÑŠ+ı¹J8†Þ!i®:<…CÂcÆK%/9NÚ~£ð@>XßMöÃÑl㿟&øâ[G"$Ž<+߻՘Ìȇ#uß;¢Î°Ræc°]9ÿ®_8ãtQߤe©è:éjlù™²<%U¬iÍUbj]¹hÀº×s’ +èò¤¨±éت·ƒÍ?Æ‹.6á0ÍWS¹KÙ‚¤á/˜6Äd¸šx…²š¸+‹‘žŸvñ4¨Ôòåo¨„zíC­ «osš›c1‚”ãYK¶x¤¡k­aV w/ȶnóÐ\Ýq+e©ÿLN厩¨¡Š«¥»Åð.™èÀ +.p F”‹œÊàPÊÚÛ°Jg²N‘ν¸~É–õ›<@ÁÿÊæ“m“ãE‹éW¹8 W…—s!¬|æÐÂÆÅ\ +§ê1;­ º­27 HƒõQ±•…™Ô„.ߤ4ÎyÑ<·œDXs+(þ&N£§¥šð+¹Pe¤:ÒÔ‰“‚ ¡ïv5È;˜»¯©Ùm^‹d½Y 1™\€žë»&¢àÌ*hte2ØÈþQÙÞO8n«Ik­õ!ϾÆÍü~; ¬»ì¡ËßRñ™m!û‘m“BwCX±eüIVW‹Â¼þ}â »*j‚bEªUº0,f&©ïôÜ!õƒ%zqv÷´X ²øRK®‰rÏhLtYù›ÎñxSë_J½1÷ R‘‚&Í }¹$ +ƒ 6}Ó}°¸¬uFb1²8D¸®"ü¸wø×Nm01Ø+@í1ŸýIèȪ8Ÿk!tÖ³ôŽŠöœ‚Ö\8>ž*Ь6liHÑMlâÚø¾o„¨(@4´®qwÙÐN¡ÐòjM?ŠÍUÚ¨x02>Üäû CY“'Õ¨52;LèÎJº;‘€²²üY£…ÒÂÐŽT8’Íà^4Ž[ˆ¾ À™è²ì&€>v•Ì+î^Æ!òÓ‡Ð8…êz00­¿W§« +§H­C +AEðuf^®hD‰‡_kÑ‘N(lÅ3ÒŸª´ßùÛ£.ú›×²¥_•Íic-Ýev _tÍ,ÙUƒ½ò©rBTKb1fÄr5/Ë•*CÚ tÆ~¢¢ˆ4EhKˆ²ú²¸Û\÷ò›$•±Ð’i×á¨SÄ;^i|*OapÔ¹V×´úÿ Û!Eqïá´~^˜Qº^CÔŽ[‡–¡‹Œ+,%½dÅ'@…ŠŠ¾"´GéÝwÒHì–ÓKZìcAF™lTì>?Í¢ÈôCçÐkî¼wÂCʹÙáóþM~âåÓ€ª<Ñ¿ŒÅ{/šÿ{ÅIÞí&•ƒŽÆÇ BC ž.Hy`v€*OL§’îîÆ4ÅÃnB0$4á¦Ê—Ø‹~ÌœÔãûo"H"0kŸ²µ«”F¼x“[…\Ån˜1f_¬«¨_k +°¨è]®­!Ä–ª6q¬  E‹KÀŠqGg +KEDÆnæ¬4¡ì©û¨Ÿ“sžœ‘ßœÛiSâ.ñ²™ÍÜÝ8Âa[hAV>ð™èŒ¥$‹µbC‚f±9冒ke0í ·fG”LµDDÖeb à‘ N œ-ÍôϼGÅß\ŠESÛëÖI>v½wBUÐTZ.Bºgè6¤w „Šê¡}Ÿä©jpj¥Æø[= +¯hgALå÷R£bWãšùFíqÇàÍä5 Ÿ_- ăæ®XQYh_21ñÖ gŸn.zŒ7Æc=Aah­Nmv¢”C3ž„sl¨/­=}#–½—(¿™É ;\i…¹®Á &§Ø²x«£ql¾¾ÈLÈŠ€Øõõ‚…jÒ"!–2“±§…ÝCjïÉ_U®ÒÊ’AŒ€Dˆ¶5”>-‡K‡§é5B*ù×åà ÛÑà "aDG6…#F@ ÈŽé‚Â/¡]!4‰„¶AâªøšÅl‰Ú·v B§„ˆd©»¼.G9{±AÙçÔð7(²tÒ…f&‡h‹'E2víÆ Á{¤2!ªQCƒnÞ·}F~eª‚œ³ŠL$áNý,R6WR‡>‰ÖûF/‡™1ûÐ+2Ê›âÄd’éqqÓEÜ=¤úÐ"ÊÝ*!¹»dg2U¶@ÌjeÿE:Œ£o/sP•õ­Ÿ˜¨NZq—ãáV^ËL5sZpÂ%5ÈI€­"–øýaÆ«ƒqWý[×ÇÚáw"v@-,&þàêúÃ'ä炆H_Ñ)>ª–$9x239ü(§PJÆüB,JxÕi7ílsÖKP¢¿°YâU=¬ðÍÀîuËš%.ƒÑ˜ú©™Ä¯è3€y‚Ö̺)¬úÐðÈêÌÀÒÏ>µTÁ¼#݉<@Ô‡ Ðpô·‰(ˆ-í>C.¿bŽïæ{¹û1bhA'Æ®QDõhû(žÝ?ü:ßÙÞ)ü´oÜ‹ì:€íPóÆ“Ž/8‰¬é1ÿ^÷´´;¦Ã¼ê´Iß1)ÜOÇœÖÒSe޹\Ufdú\FóÄG C¨HlµÚøí µ×@ñ§OF«ì»àQÞ\:è®LòX(áHPÅQÚØUR¼íDG¾ìAŽòÞœ5L-ÆÃ¹öL7YŠñZB5I 6U¦fÄê[…" ’ß ªbÄ@¬Ü_1ѵ×Ú³#ãàMºö `­Í’b“ÛÔH¤Ty£ [ïr,·õ’…NÅñßÂ%ªrläæ /Ñ®ýs]™¹=»,€ËI³Û;âs…ß'…ÿ«×pŸ¤r'EýöÚÜø +Qê[jL¬b«žÜ¤»íqзÊ1\²a-2é øò0Ñ<©7…ŽQU¨¡tÉζ‡v/sLÏyˆqUPã+Á.C_Þ‹E—’/½EY6ÃF/¿âq¾‰–ÌÁ}¯‹.ÿ_‰Ñ…zQVVí +o,¾ªSoïN¤¿ÑÁÔß™œ…RΈ0©Ý+6”# +³f=‘_æþE…yÅÏA«ÿT-?Ö!'"[YÐÔ–ã²3D¢ùîÈŠÈQ1š²-`É<LÖ‹j2çÍÉêÙA>™;CegƒB™ÏSZæüVûE”ßçØÒ޲r]/e°oT†¿7c-U†¸2È +®*;ÅOØS6g§lÍÎðzl8eäKe¡Á,v† +N™l!\*3©LoTF$RT6œµd|æô⸦¬>OÊrLS¥Ä”L0;Nv†UÛeÝáÎfgì,•µã*;­Tv—SvšêlIÄT²ƒvÆ\#ŒòÑà”ViÉR=%Ãß”a’Êp[e€)“F¶²v’W™&€°²éò¯2Õe§Ôçae1T©$ÊÛ,v›#¹’9v)\ ¬¬KX¤©°2—Š••Õ•ý®X™|S]™[ÀÛÃ.›sÃÖ\ä¸3“„¥Ì`޲£‘س¸)+”y%#ˆ9çÎ`¦s”I»3L­4‡£n{gœøRVѶ”é`4§ýΨ7ÊL¾3Ò¾˜©”=×âmÜ8OÙíì”ña*c‘NeÌǸUvi#¯ÞÎÏò;„ÓÜxv§Ê$¾3œeeËH•ÙD„1g ÷R•I£ £mø¥ÊjVv9B´²q£:o•½¥zÿÒ&Ë߉ÀWVô± Cçu³–1û[†]FÈx™ú2BÌ|f0¯bæã1ô“Ù˜™6ýùœ…Ÿ»riæ”pÀØÌ˜ÍfÙ ðŒW|›eÁ3ÜðfïΘ¢8#wr†âqÎYKgn„DBÎõnÖò;ˉÏ6—JKri‚3fázÕ³2î¶ß³IŸäáçUyg?â³ §ä,êAh¹Rh@Í\šAci">M4–ZÑx}јÃ3”P¢.΃ð€@”£I‚göhžSHÛg˜È+^Œe,<£KÍž1•J³SÒf¨4è)-‹)¸¯´ZpiÀÓ:Y—i&­¦E€§d¯SÚ@ˆîЊ ÏÐÔºò/ ›¨íösZÎ’šx†û.µ9¼©é‚:Ï  šìQª-3UW-tv¼àV«ó®–üW» ÏØQ»6 +lÆkÓÔ(àË^ó+À©ø«iDZ¿3ƽæ¤Ê(‰{gÛk +ùcøÎ`Ëdº$‹N^¯{-œúÚiè1ea4÷¯ÕwÉwÆ K-GÙsi÷ö;c—;aPÉ ì×0ïúµ\TLk`|-&䱦šðŒ_¾Yçñ5åßêŠRN©ß1WDå¼|mè?PÜ~MÛXXƒ-±½<.lä[ý ÎK™®zÁ¦T­Y¾¹v_ª"¬Œù­Ù†°í9‚-&lò–'6ÝØx¸5]…ÿ5FÁ3D¶hÿ51;Ùn“`{Zp¦`«™U\^°!]ÀFŸx†ÒÓžMi,»ìÇtö‚Ít¶?ô°±ÅöÇŦžá„Ûl ;ž)ØD·ðõ%ëqtEW°…`à›l8ïkÞîµÏ]ðŒyy-$#Á¹×Ö侯ž!)øØ¤S€M4<—î…SÀ¶ lfÀ=lºlÊz±œú…-G%°7ØXßxðÙ ¢ød°q«@`óV{g0>7vvy§Ù rÃuÀ¶wNŠÀ–›°w†Qaû½\ÄÂV[N6ê6Á°…ûÁ–˲ÝÁ;#ùÝgÝI)¦’áÔ_[Î_Ô¹3 }l™x¿öÇ1’Ài[fëÎ8lwoÛ›;cwÆÚomr[¡ìع3ظUYKΘåº3†0›^l˜‹a‹âÜW…¹Û¶ulÚ0l{b³VÅö«;CFàÎ,ﱕ»3B#¤'[¸_Ù2‘Âl¹5[¹s¶óòÙ¶î k…¶mw†_8G[ðM‡iCZðÂBmY2ñ»|Õf`Z[m¯ 2mþžmD`ÛønCTÝf?oãÔ! ¿­¤7ôîŒâ ·k\Ü$ù¸…åFIÌ­›pH‡n:L7Ì"Õ D×­‰²[\f·›DñÙMzÝŽ€ð´àn‡¼3ÖðnÑÀ[ÌÞ´Å›ø)oÛw†M;oëï W¦·òÖC²½éù½Ðä›®¤oÈ@·oq7~óÂ~{ÏCþ΀¯o&pã p“ï û¸U\8WpÐ¥ÁíÓƒzgx3Â¥å ‡òQ;˜Ê‡~g(,œ* O¸÷qŽÞ§©½3€LBÜ‚wnóÈ‹åu ÔpQ]ážÞ 'Óp¼r8ôpÐó òEžS±ìÄÑbŠ»óÇPæ©xg”ŒWWÆiÜyܸ³å¸ò»ã¾3Œ{ÜW¹Ù‡#‚qh´>aýŽ‹ÿ®.HÀÑÇ;Æv†z*––m3þÞ]7^ÃEöðœUÀ+ð\À‹šŒAøïHQ‘œpjg4ý;ùwg÷w›Ä!MÓÎXoêïdí ¡sãÙùÙ)Z"‚òwEVв<Âîα3Fx6ZÚ{>%8!5—6C’Ä:;ìÈÒ΀ԑqí”ÞÝ”ßhíŒØ«½s©igx¨v†MïÈ;nÇ;h€!è]‘-ØÎhÜá¼Ãóz§ÜÎp¾ >f'ÔFJjF*ê îbž=±,bždžOgtæEú3o:óD7W•yTè)OÑðuF¬¤ÎxkSÀ÷åÕUÖ€ûò±‘œ )Oý>¹§Î°ß—w]4äèª3F1/Ç$§ÔÑEuÆq¿¼iªº Íc¤a6ïu† pž³éÕy0r˜ç鯀òÓRî#TgØ]ôÖçéÿÚMé-’é ñž2Q/í‚ìF½ê¬7VgXg½ê ?zë­3àõ,U׉Yö‡1b¯pFâ`x=ö® ‡Ñ¹Õ3ÆÎrµgóa+m‹šFa Oã^òxî‡Ý;.¼wÍΘˆzÏF;#æ{³3Bð46(·¦ >çì ÉàKò +I_RRÊ2<ï­{â Œï¦Îaâó²3nbgì’}T)ò7ÿ08d°ìŒ._dv?ñù¦ø¢O|§ƒìŒ'(¾¨Ø~Šoz!> x+>;C^Å—ùÂŒ/2ÒøžØŒwßCá¯_Ëú’ÁCý!£þÈ÷å›÷,TÃ|»D ›Ia†>y³3¸*}Æ2 …éK’õ=fô;©ê;õB7ëó}'õèõå´3œ4öÈ9×ß³ÏrÞ¾ÝÞîË„Êjg(c´3Êû¼ñè_Ð[ù­\ó;vvF¥)h£dgä£_-vF õÓ‚a­ßÖ±_¶ŸÜÉØôu?¸ðD|uôc(;CÑÃ_AþLÅÈüi^ô—=·ú;“¿ß8½¿=;ÃhÙø·BÀÍíù—¢Q±àþggЩÿÆê¿w›ÿqigÿ¯V@q€­º ÌÊ*@Àf³ØóŽö0<‰‘T&œs 8Ïΰ¢¶s²3˜(NRDu>ÆÎ6 -Ñ… Ü‚ïXÑkš +<*TÙMÄPqìdÒ*ÐÅ%ž3qÝÖ‹8ÃE²¿»D3fÅ¥‡3®„UN¨%ÙÀÏŒ`ÆøŒ +.x8f°“¤h3W้3¶q$à¿ Æ+0Î°Š RÄ1®@8õ˜ú°ÀžBƇ£Óý•§ØŠu +E±Œâ€‡Äëˆ3>¾ÏôqGâŒþ£QÔ²[àí*37à:ÅØXÂ׃ tD¥)•ñ0S{J/ÁZ1¸@ [à¥*Nœa—_‚Œ3f*ÁU³Ó=š`Ö¤žd€ÆLYb#§‘àÛÎ0a!“s\ ¨âHò8c Mø-ðEÎàÍ&ÎHu“3À¤BV¡x4-0i*g„PÕšq1 œSÎÐ:±Ó—M ü'g´ù; ÅšêÑãgéÎñ' ôÜ&' D›Y9£Þ )‡Í·B9.Ò®yÝyåŒk²À¸1…Q ×}\±Y LÛl Ä„ÒTɉ_=ˆq,Ð7½5Ê45Eá7 ŒÁÇ +À®¤åŒÃ"î‹ +©r® +ô?¯@áÀjrÂÚp¸iºésÆø +4BAêeX¹¯ÀÁÕ+O*ÍäD,УÐN¿Í]«pÒœ1äNÛ¸ë +—>€ÌÒ;.g m9Ã8—3€;ÌŒ›9ƒ±hˆVrªüX°@òL^|Øõ\‘TFÆ À~–9CØ‚½ó +!”š3Ïr!sR•9ctJŠWÒ‹æVà³ s†M½×¨s»ÍÐmFD2g<ìæ ëõ.€C) vâ©æ Á¡™3X¾œ¡ ¹GÌ5F³·+0fÎð ¡À›¾ÑC‡íµaˆSÎ#’`ª7€}óMŽ9ÃÔ#…:(RE,g¤äWárÆVêrò#™&glxŒÃÀŸ.QÎ8 uR0y· +\ ¾Ô“3FAŠEV ¯UÊ;˜W NÁ‡b“>8*g`/ #œÄWàô´Â*ºÀØ'2=Ñ -gü¯À@·Ï*g0V9M¿Få`3@(îŲoÞ ±ÀØ.,ÐA¬öÆ DhÏùC•K=xq¸£¼†É,p1}ƒ´À–®H'2òt9#ÜHü;‘¶¼¬1?0øþn°œë4—3ؾ)v â=à85>˜3F6ƒ+3g0ÆœáÀøå áMFÈY©åŒ˜ç¼œÑ‚``èFåûåŒ{%Âa œ—ˆs†˜š¾XA¿œ1û 9CVܵ“|mˆ…/gÜ ‡´Œb%u“®nÄ#f²Óžl!Ì«ÕjÀMO&”ϒ˲õ¯ˆI1gÄË@Å3_•x9cÔÎrF¿…eà3þr†ß-g\­œAla¤é +05,g0 á8æÓå ²ñ–3v¢E'põ2\ÎxšÑr†øÒ¾œÁÇòQfào9ã¯ÍÀt"y€ˆrÆÆf ±fFçz¤ÌÀ è“3Àf E|fà!'çå»2СÀ-9ÃKLnÿžœ¡SmµIHÖd ÿϱä z  •½‘3¦E­^U 4pâ Ïþg „€â3>ÎØ :Îø40o¡3ˆ4¸RA4ðJJåО3²I£eÎGÎã ØÎU¢¡Í¸(äŒCá°a3ÎG@=xó_3PD%rF|Kõ2ÚiDÈ9ãÁÓÀ-ã’È%9¡äŒ."gÄQ_^±Õ¤Y‡œñÃî;rF Pº4°îÓÀ½ÇŠ<, <%1 Y¶ äb}¯äà t$9Ù“3Ú t¤$$ÜE¸À1¤œÁÛ®œ±éz ßÀ‡]¾˜»ÅÅr]å ©Ú8=”3ä¹n 6ƒœ‘4]q”3 ÂØø¹a@åŒqðÆ€”3>4~qr†Þæ!á%g¬q“34VÍ œj7°<ó +å7Ùë†N’3è 5}SÎP*}ËGwÄ>lÓÝ?K5xOÎ0$›"¬f°(gXerúíãÕ(áÈ7”œ-„€%YF vNß@åÊí t&ÉÈ£‰ŠDÎ8NÈÓÝ@»áô0QäŒ HäáÊÂ|OHöxrÆzø›zœÜ”BÎ0 Ì "gl’3à'Î~ÅÄp f©9Åbô:‘8£Bű„ªx $à†›gÀ9ãŒÁ:¼þx#ã 4*âø¨¾q†‚pgÀAðý›߀3–4B˱`vœáÞ‘(9ª(gï­à ³“«Z„@"[É‚{Á!3ìÁÀ²ƒ36pW4–z’ý ˆb4£½ôŠÂdàœ¼á €w8ƒãT¹¢NÔp°´0qƤPœ:úf‰3p”Š3BГÄbÛ´(Ü`Ný‚<ÆPÊ ­Y‹v,¡E+ÆpStÖ¹r­¥(­Ú ¸½/È@™•°ÁR3Seæbˆ¥æ‘ÔrQ^µ}à¹0AV}È +iZÍKü änÚ(€Tjd†Üj†Ú&ˆJòI£7´éMäùZ›rÏ|C¬µ=o}#gœ“ÕÆèe÷0r¹%µà;7(œ_±tr0»Òh a<±š–[¬bÓ€åG]!¦è]ÂgåF‚ÄZ b¿uã–š‹aÚð +Ö#³^}NuëÍd©µ¶ÁÅê¬&iÎ?¯ã¼‡cÓ,b¬+L/½ÃLQº$.‚X˜lËr˜Ì4` rÃøi±ý–Xc ¬¨Ùª  +wè\¥M¹†]À¢?`ÑŽ)Há›Z©u½àxRñ†Ï‰Ìè–ŠžW[K’ÌßYŠ÷%¿®†«-…T-ä(†÷0†ÙKÝ{DZ«m†9¾õ¼í^ÜÁ¨èm{Òpý(ïsœYn/ŠVlE¬¶Ž$V +bSY R;創†æ' Oy„Pi,™íÙí˜ñjßV–]g%~SóÅ,´ 5œgÁKR¿&]œ^:‰ª6 ZzÔ¨lËfxÒ"t€Òɤ¶›µöQD›ðòüª %v‹œALzÃNR|&Úåó좗øQ¥ ­cþÏ +†WdšCñ!sP3”ÖÆí@Œ¤VP£>œPg Í&2 +9?唥–Z‰£y^ü¢(yz]ƒ%gÐRô®@Ãwq”ÛÁj©íh¹Ü¬A&齂X•vsý‚Sn¿ù½%x‰¥·ˆÞ™›#¸…›$xŠ`•ZŠÞÔZ#Y°,Ù¯ ᑚÅIu¦€f%=_ E±º +àV]©X!G«N–ZvŒÚ#„Oïª·î² «o°©’£ÃÞR´@¥}0‘b» #›–àcé5áeˆý@¤í@‡¶ŒÂìª_(a^%°Á$9aeÛE1„2C”Jë ³$× ƒÔfA„"{™f­í`·Ú68¡ŠapyŠŸÍr&Fr\ˆQ ÿÂ¨ÕÆq´Jcar¹Á0V©‘øEÍ9ȹ@ñ£J`‘jÃÎQÛD +í„ÐJ̓¯‰ì„Љ¬¤‰Å†!é„A R BÈ5lÀ‡§¤ ^A@r KI‚СBÑ›Bƒ¼R 9j±m0Ҝ°r­ªÀ5V@†žSBÔü,ãHÅKOCLÏY O¸ƒx•¦!æ:@5^ªX¸dÅp § H‰v5bgÀ‰*Sñûz‹jÓv"¼mú€ /„°ØÁŽÈ‰2‹ ÓËgX(\4!SðK/ V¨ÝgœPð@¢cÁHLÃNѼæ×U/,®]\\»'†N𞵋/q +`ƒ2j´X%ŠJq ½£¸…¢ö†_¹…’È Â—±cE&à ç-@ñY?8éAs´¶P£ÿ°Suö∕†síb£™†Ñ¡Ü2¿‰ýöIä½1Äü°3Ô8¡EˆY2‘sÕ£4÷Cä ±7¼hÃ^†Pð>+64Lñ<¨³;Pj'vªÜBŒß|Zö³_|­7DÍO8ÄÏiNÁI¡¥h®KÒ‚Žk˜é÷LÚÕú¶ûéAûC†]oh²ÐZäT¡=à"É%Iôû¹•Á‰r«ƒ.„ %_öp±uÈ!B ¢èt!eHÌR4óWø¾à6à(Á9bK`R/à¡ä²àDúåaÄRëpC´>ÀCIÓBÍv,B¸$Ÿp#Ä~s{­UŸÈ*äü¬M˜Uht€ÐÌ\Á&zNf0„Ý=žÙ„šŸ´#vŒâ–[#÷†$7 +`Ú'Üq‰`T™ ô«ÍIE†Aç¨ÍÍϹƒ/É푼R#‘U֨Ŷ"˜µ6æ§¢—/ñk"ÓÀ3‚—:møµOš^o(Jo§Y¶‡»Ò(€Ñcæ@d*mƒ ‡™¦±9Ukj¢ÐBèL©Å4Áþ +'Õ°D¼\%€ñÄ‚D +6¡Æ®AÌÐú˺NQ»ºÕö«zï<šYD´\)z\mXŒÞ°¥3XáŠ%H™†=xáŽ#Ø µA”ZkC«4 F–W +€›"Ìh¿h‚ÐpàpŠÞ!~Oe/Vi+’LðÌ¥8*=f&@çb˜æt¨ÐBô¬ÒR³Øb µØBšXl‚Jñ'ÕMU ŽË‘‚«×ÄŽÓœÄin‚UVÒÌ‚+!”:SA¤Jë€çãî`GêMALšCxá¢5ˆñQcÈA"«`“TæagjÅ î†Ú½‹4›Ì\{Ð1ŒNs B¸ìV·*(©†?èD±Ah r3@’ÜÚ€¦FÒÌZƒ †ŽS”d0X°!K°N¦b¬pÉVzμ©K™Þ-P/z,Ù€ L´` ¼f9²ü¢+n åùÅ€‰ÓË’ªÃÍS¼CXŦ‰¡\‹8€é1O@’[P2¤†B´î#e£ØÅ¦´®ç`ˆ[u \—^˜bþ™§³(Hó 1Xmd²Ô.Évcü¤äWmzÎL”ˆA#D^YŠíCä@E€)rS Qšƒ.ÍU$™äJkŸ¼–÷+Mï½X=ϱ Ëq0‚Þ¼‰¬¶?pþ#8ÞGhIŠ/Ã&!ÃÕÆAE¦!Æ‚=%D’]|(Á(È©[œ\l>>e½J“Kmãøä~nÁØpž_z T¸e7Os 1Eð +\¸ên˜Ì:ìH™•(½Þh¤]<Œ¡”YiX¿¦ dxÈ´XŬ\ÃȱAô¦ÐN˜_uæÖ[±Jæ¿0½÷"Õ° 3Cì TxÊ€dÃ$|XnÆnÞÃV'Ivïä¹9Wh.ŒOr V¢Z ˆ©)^1`Âã`ÆgÍQÜz;Q~ó#tœæBˆNlŠÚ˜dËÀü¨!ÐlϰdÅ p²ÐFˆe}rú–#RÑõª˜ð +¦{·Ø.Pá–Mü°Ø*Ð,ÍGø¨ÖV ¯ÜX±è&Ê/}ŒaU‡¥y‰à” +á›ßTÚ…¤9žTÙGÑËMG*Ö?­l:¡Ø½B‹ÓX%@è VŠÖnœæp¨ÎNø¶ÚP³ÖZ½à6†\n+Ê0ú#ذ T|Èȵ5˜j_ÀióX^©Í`³Øˆ<_ôŽe• t«M¥éE‡€"´Öà ¢'u–"ˆ¥ö¢¸ÅVÂü¢ãDÃðÊ+¸¿œBƒ!Üj뀦èmÁ‹¶lÉÝA‡*탎Û*5 :IsgÔÙÆoh AåÚÅ`Uö@èý`ÅçMJ»• 7‡(²¨—öG¼bÁìjŒà(‚Un%xQn`”Î:˜b›pS7A|k¤:[yzÝMœXx ,Ô01’V zNd`zÎÄ­Kü¬ÔR§ÎX¢_o3R0»‹óËnb'‰ È- +FªÞ :EnB§³ +9Dp :Eï c•Š Ù”#%Ы<•X±ÌzP"”–àUÖ!ÇŠeù½7­í¹—e÷þ¡&i¢·Õöन½A SÙ†,6>1Þ‰îÿžl9às—2«¯X¹r­2ÁO¯Ø8€r?Háš5Ü<™…èI¥yè1(·Ôt¤dºŠÎ÷lßu0Jr_CÍTZ%=æ 2Qr:\m!r¸ÞDÔ|ÑgŠr:Wh@ŒQ$lˆÔhŽÆY‚I`r[°IŠ·0N¡™R™áL»ô  2Ÿ÷üº{ìDÍsžg9#^ÂLQ\B‘|ƒŽÓœÅPkæ)Þ©å¸?¤7›ž± à”Y"w/?è9Sf0„Ýú±ë ‘Ëͦiæß,Éy0Fc”¤W‹âU "–[DZ«¾1ä‚Azë-Lp^‚MϹ«X8V¯‹£S¼‘*­"x.W³+W󙢶ž•Ú†(³Ç«· +2Cn8 _´­7ä8™èI™Øábë‚ñ7NtÆ~ãMÉø&V-ÃxÅ6ÁfèçiŒ “\…ËmËÍ„éuwq~÷!È.úIÓ Î„0 +-ÃÎÒ<ƒÎÒÃÍ‘|ÂLRœƒÍTqzî«åýL“œ¯až÷C({®ù½ÿ é8a´MÇ’4óEŒ`¼ +Ò¼—Y¢ýÄéYîqËÍ…)¦1rÕ=ð¢Î*à ÅE›Æ^(¡Ê<–Ug=¬Žê#ޯཊŸV› ²{'Q†ÙAŽÝº‹ }øEƒµ¶¡¦êŒƒVWZÕ2\ô¨Ö$HÉŠ‘ðIÅUüÂì(x_ö;[ô9Wm$I0»‰² Æ"ˆ¥6á…‰¬C¶ӃȡZá»RƒaÄR“y~í¾ªXíZóUÅì.rªÔ0A‚Sp¡b³PãD¶¢h•æÂx•&’üªs¿î-~Uj t–à¨X½l½f¢ä"zUi1Ž[o'M/:‹3Ì~ ïI”]täÝEñÊ-°‰lIµ¸Tv‚ø„v‚ètvÂØD6"•BqN¥uPó£îà ÂW¥v¸ÇBÈUaÌrki~ñ1N±Jæs Ãì%F-·Á(´À,¶”#º?£dÏ¡Ë{Ž Øf‰–S^Í}‘%ÖÙ ”Ù†“œÄoª¬D F_azï'Ê®Ýåéµÿ¦é|ÓúžCNÙsŰú + Üš¦91KjÁ®4"oB\Ïñ”gH1’ù&H¯:ɱ›— s$g DÙáEK–`Côî€W‡aÔZË‘ŽïKì™Oží|ÏuŸE9æã8Ñu$Än>‚Ì‘[‚ ÒšЫíeiîïDÍ~•ÜŸŠå[–á|  Û‰ß±k1ôÚ[Ãè(H2Ÿ¦‰îK­o:¬v-盆ïG¯5–¦ÿÒ ó_˜a}L³ÌߦãJ£Ê0ì±G“Ü1Ó®¶ª÷Ž‚øDÆaGiî"˜õb'ꌃŽÔ™žÚF1«ÎAGi,‚ 9Eï + äf÷MÉ}bXů ŽƒV?Q‚í<¨šîY`… ¶OA”RÁ›2Ë€5fâ‡Õ¶"¸õ‚«ƒÃê!È0{°*Þ³0½àX «ÐH’[m'K0;ÇÐ nDÎVÚ1li’ñ:ÐóžIuËU­cw<¨ZNz}ÛU±p»eµMg%ë…RöÜÎs=‡¢ ç?ˆb÷a´mÇ{¦ëV½Ú4è@Í9ð¢È*Ü ½;ðœä1Pï1û½³á=ÌS /¤žãr¦á=KS,¢Çõ‡ NM›¬5cX/Œ¦ïFØP©] 2t&1z©‘èq½i°±RëpcÅÆÁ&ë-…ïëÞAìâS–^ü‰²{‡!ôªû¤è:'YÎQËMÑJ …ð*-ä(fçEÏþßõkÿ]½p%ůýoÌáó7èD¡}øA•}ðE‘‘ø]©}Åð4Íó +³{Ÿ`”þãôA†Áy$¹è Ê®º‹aVŠÖȱK9zé3O2¿ÃÈõ¦ P™„©u¢är{aÌr«€C¿°s÷`Z­±H»àHœWlH­·¿)4@¬¶Æ.ûáÓ‡ñ‹ž’çsœiHœÿáq×ÝLÁàR˜ao0~`» ñÝÄN}ůK/1’÷)̰·j˜[ñÆ“<­Î¦[r^Ësæ#±æ|±ŠæÏ<Çý$Õ}gµ’€8eÓ} ¿è@©yN†ùÕoµÈ8”[s”¥Åxö{Éü‘"y¿Ó|ÛÙ,Ýv)zYkp|ÐÍ)4H©3D'²G­´”¤˜³LëÎx*§«Q²ã’Ò¸Œ"mقͳþ°«fR,ßi˜kÿôÜORÛwBiû.ø”  †©Ž{Qžû+I3¿%iÞŸÉødù΢,Û“Vu_8Eã•Öu¾Yu÷‹Ôµ?zuÓíDÏþ昄¾ëFŠb½ ¡×Û .'Jæû¦f¿Õ{Ç™Šå[˜`ý‰RL¯B¨Õ¶Aô¢› Ã}•d˜ãóÓ5’Ú¾ãfãw4M1ßŰ ů놉ŽFÝ3„Q÷lžå¹åϲçIbõ b› + — +’œ!«ÁyèÙù/Îp}ºEó›Ù28Mûg˜f= +RŒOIŠ÷(È1f‰ö£r;àóm狦ãž×¶]޳ÌVÏ~ç•]笾eÄ(Óq/Éõð鮣a¦ãXiþIñœÿŠñ&vºÜBèh±±v¹‰$½Þp¤`½ô«RÍr;Tq‡î{½àRá=IqÌ!†÷3L³Èð»Ç0sÅ'‹ ' +ÞN}Ãà^–dÊÑ,·ôêOðÂî)v¾z@qiŽãIÍs%ɯzœ&xˆ²ËMÙ­« Íü’bYo‚ãQø¸ÔTøÀØTŽh¿É1ÌOÌjûà‹"Àó46Â‡ÅæA»¯$Ë}d˜Dp* äøåã ã]±ØPš`öŽ£—ÛÇñ NÆ)Ö¯$Í{™%:nÄ(–W´2C^ÍöhyÿQÃk°™ZÓàI¾!‡êŒ£ÈÕöòÃ{»xÁ¬µd׎b(¥¦¡—ç(víD°þ%©Ž>á2®×±Tl|îyuó‰Ð·Ü‡PÌŽâ§…v·•v‚÷åÖ¢,ç‡Ô´¿H]ÏU±q»)²;( ¹ÜϘÏXÝOjŽÃq¢ëVŽh¹"Ú/büâƒÑ5ÝÓ +¿Ûfçv,O°5ž”œ?RÙq$Ç.]å8Îóží¸£TNw”ÂçR·Ôdš`8.›?ô“æ—(ÃÒt¢ä7â}·i¦óЩَÐ1;ct¬Îˆ;—kú‰û¥W÷hëÑÎçržè~²-ƒtÏå,árXk™÷j&c)ÓA­ï¸"x_f™®¿(Ñw¦Û?£tó©Ö±º"ž¹]œnˆ'^GźéªWùÝ:¿¦óÁoyŽ>ç¸YÂïŠO¹Ýêöç<Ñù"Ÿ÷4«žJ×tA§|0Ê4Ý ³¼ÿIÕrL*üÎz-³»bãuÌj[ÎIßùœð»šfZNç¹®Fá3Xj‹±-—r<ëYšbnÈêO”¶ãnœè¹”cy¿Ñ#Ûe’í¸¡Ôç¼ºãªØxPŠæ§è=ëž1ŠÙOŒe~Ͳ=tÎï˜O3¼Áø¢܇ñ‹~´žû@\8ÝÏ\F2:&€9c~ ß7ÿ’4û³×ù Ó±P뻎šeÏ5±ç9—¦w¯ÁÆ +í„Ü 3=Ç{¶eÀ0Ë}å÷Þ‹žûÑêü.:-2:Ÿ£LËÁŠá_Ãî!F1|M-7Ã<Ç%§n»­6.€äm‡ÂìÖY”ã; Rׂ¶{Éy§Ùo¤ªéxÒ3ßx5ïAŒ`nd¤à¬8©=ˆbp+I³þE‰ÖÉy"yßBøÕ6’üZsy~é1†^zGQÌ.bãU”b½Jr¼1zë/Ͱ~GJæC³ë8'6ÍZÇy™'X߃ªéhšè¸e™Ÿ‚,ïƒÒõÎgÃTÓ­Ótf¦Ò8à\­•ði±q½vŽ¡XžäÖ«,ÁzBª4ãÖ‹ WÛß•ÇPÌ~³„×£q»äô-G½Æã’xÊì’zÜqFj™NÃ<Ûm”l¿ÍÒ-£\ói–l¯)¿“RÇd,qÑî¼€Öì¾Dg2‚xàvËi\†°)¿ :ç2~Ï6]oÉž6ÛqËé;ŽªEó‘zâuH=cwÚ­Úßôž«^åsÏê\9…Çé4Õûž,”OY“\N8M»e¹ó^¥õ^zU÷S„ì>Î'„ÂåzÍöžÉg.7N‚óÝMî½’\ó<ã{Ív°§“^ásG[³»kÕìŽèœÏñÈãzzÎu—eùí÷\ëŸTx]¯Ÿ›VËê¶Ø²º%3;(³;)³;¨ž3ÛëÙŒ¦´lΕßÉ(Ùu-Çv]NÒL9I3DçѶŒ. +(>×´®ãžÔxÝöìÆ/z2¬-ÆIÎÿ¢j¹+5M†÷ìnˆ;¯ BÝq=§[î(uÓ¥ïºßÓ]×,Ó=~é<Žr~§¤Âç²Z·j…Ïí8ÛqÇjzoÃdÏÁ Ýt9N¶Ÿ(mÇñ\Í@½Æë”Õu»mÇi¹jÿóºŽFÝt$Bvœ ³~¨w„“§÷LÒÜ¿jÛtAÜ8Ý5ë–ã=Õ}b[Îåè¦k9¢û.Hó^§ÉöqátWDï9+"·Ý TÌ'!~ï1ȳ_f™Žë9ßu3K´_%)Î÷ é8îõŒÜëÙÑø å9ŽeIæ¯0¿ö“eîE‰æc3 Ó2mˠݶe¯e½{ÎÓ$¿Ú68I2Ÿí9«v-ƒŠm˘Y’ñ;Ïô^%9¾¯ðq¥}³ÌŠÙ¯½$)öö¢,ßY’c<ËR£“(»ÖL˜`j.Ì1½Móa–äãtƨÜNIuËa±ò9%³;-¡2:êÕï9Ûø¢íX”:¯›I¾ý7Ë·¯¿SNávI\2»'ž2:Ÿì;ŽI}ÛM­smÏ +ÀÍ’ à†©î“Éx ùžÃt÷zâr@<î~Ïöí‚ûÑNk¼ÏîÏbçsÖëÜN9Ïõ`Ïì~°fvF\2º!îfjçÛSæ{ñÚm QVÆ„ŽÍ iÇê”Óvÿˆ;—û*‚÷ÃŽÞü¤øþ‡ëî3ùÈëx¶p:i¶íÿÑ–ÙaÏî„°fvWAó¹vÞyuë‘|àr><í¹å˜Þ¤ÊýZ«YÝÒ6mF÷LvŒîh[V‡´E»3Ò¢ÕiÍd,¥ðºáó]÷Œ¢ @*U#@Öz6cH[v‡„Æçt˜ð9¦tŒ.‰§¬hŠÐ,|Tn›§9œ¾í¦Ô3?Ù²ºíÝ“— ÒÊë†zÞvÓ,{ŽimËÁ$Ùù¢z/“tÏÍ0Ëx˜%n}Çýœð8Ÿž5Ÿ}ßí,ã2’R¹]rꎻ^ÇìŠÒ¶_†y¶©ì½SP;.‹^ÇÕÂíF„iþKÑ-Ç!ürsÜj{YŠ÷½¨™O”®ùÍ*\Ž»mó…¸rº ´-7B4çK†è¼S:&Ch+·KòyÓ ù´ë’Ösˆë¦ãjßv6δßYÛE¯î»f9FIöã,Ñþ–¢¹¿r<ûsžê¹cU=—3×Uœ`i8NõùD#°9vŽÍ€^ßwÖì»ÎºU÷m–]¸5Xd\­|5{®ƒYŽõ&rÂÒD‚é:ÏÉö¥è>”+ÎsÆy¦ØQjÆ?±j9œæš.¯«mïêlcø¥†¤²û@\¸ÓÊ–‹ašñP«;h¿‹bÙ2|Órœ/ºî§mþõ:6”=“¡½šÝA«ò¹§.×¼²ãšÕ7Qê–FÝqDi[N¦YÎ÷¤ä=3[ŽkbÓq7Ðr~ǹž :åwHê;Nieó}Ò4GZÞ7¯iÿÕœî'[&C‹£ÛbÇ芶ewS,|ÿ´ºõAÛ¸ÿ¬÷?ýÄçˆÒ÷\´*¿Ûa¾ë:„^:G0ÌmåhÆÏ,Õüž~לÎ@Ä%#ÀW>„†ë-ã2n’r¿'|NHMÓ‹UsÛOœß%Tg^rç‡xÞü#ùܶLF¨|N‰{v·ÄcvׄvGŸã*‚Ë-©õ2P±µšeùíj›+FÙ|•举Ó|ã¡Õ¹ÿŠ•û‡zà}1RÜ5äæóð°ù>ÛøÕ +Ã^åþmÞ¯jÙ{íÖÍ_ró»ŽØý%¡tœL3ìfÍÂùËj{ƒ4×i’o:Ÿ+Ú’Í •Ñu¡Ý iÇê¶ÙyWN÷¬¾ýKéœNJ5“Á½ž @ -»cFÏf£r¹ŸmüϪ̄–ö´¾é¢V¸ÝÕZvÇä3F'—›š×ñ°ç‚Òs¿¦yæóhßtÛ,¼.ÆIÖ¯4¿õ“ä·)öÆsºå˜Ó±»&Õ='Œ¶é²Ø¸Œ n\Ë܆ó\¿ñ k: MJÙû!õl‡^Ùüa´íç9Ýý(u-‚¦Hmáe茢§¥¦E÷‹Ò÷;¯³*Zï•|Þs¼f[®Fé–[FËdÈ(Ñûgº/Ŷ阀ÜwTCï;§Ÿ¸5Ë–!†íÑ*¼N«Mß©À‰b£ÐBE¶ñûÖ=€å}Mò]·¤¾ï¦ÙöÜÏ*~‹jÍpH>ï9à3^G„ŽÝ!¡e8JåwCh{. ¦“¿u£”MÇÄž!£ì‚SÁã:6Õxe4>—ÅÊíˆStXÛ¡Z4Þ©-ß¡ˆÒ|-=gb$ïg’iÿÎr·óLû—Õ¶œ»žûáiß ñ¼í¨‚ävK=ò;â4-Gœ¦ùAZ²»'u~§”Æç ×·j•Ïõ`Íì˜zÈꔄÖqÐë{Î÷tÇ£ñºiu>ƒ›ßqãw?Ü÷ ÓŒWRÛþ î|F¿NÕyá4mŸ^ásBiE÷ƒÒuÜÓúž“Q‚í(|[j½§Úß³}ËPjßqÓsçÙïr4ï]”f¾5릣^×s+|]úˆ·ZçsGÛ³Z+Ù]µ:V׬¾çŽS·œO¶L–L¾§[.}Ç£lÿ ¯“VÇì‚´e2²Ø¹Ô +ŸÃfár\m<ÎG;·CNÙr'hÀpÕêØ”ÏØÝRÏœn›•Ï5õ”Ýýný Þ÷5ãþçt.ד“Ë +"£³"»+JÝ}¡X­ç\óQŽcûÆï+-柫9ÎëxÌ· Ò×ăF í\†Ïéž«VËd0§ó¹¤î‡RçsAس»/ 5h¡ÝqÉèzæqè¤y\9)>¤ÓÙ Éâ‚ͱ9$œd’Ñe«g3z°cvÄ(Û³Lï•Ó¸œ÷=§¤ºåŒÒvœ ò¬áÁùAX4:­¡yÕЛoó<¿IµjzËÞwôÀp3Í0ÜoZ¾ã@Ëùk¶]ç·{ZÏ ¥d¼ +±\wAžõ'pÂô1az Þyo|– -@tj6«U~·ÕÆç–zærV?gvÐ)ÙÏÙöóœíý1*Ÿ“Zßu[lüj}Ë€ZßwÛm[.«¨íÏnÕû¡tçÁ’Í€RÉfè0Ýq7Jw\MRíBÛrÅ*ºOÍ®åŽS6‰/½ÅØ>£L÷ŸTøÝ’ª¦K1‚ÙIŠÝú4»öO¥å‚Ö¯EI~»ZÉâˆxârÉi[® ·ûèµãX”༯êÕïL¿ø!5Ç‚4ëK‚iýM2>—ŒŽÍ(Bç3xË1ø˜c3tšo:Þ'âÎé„Ñ4ßä8Æ×0ËûßsG½Âí†Ðs\/ nFiæ« µÚ~Pq]D8ƨá‚;¡VQ¦ýÇ)»NÆ8Ž3ÓUÇÐÒEoVßsRkÜî8Þ£ØéÖ‘SwŽÒ"&k ÊÓ\ÅN\‘šîûüœýزŸÄÌq]ßbçvÐë›NyÖÃø…í#Å0\L“lÏnÛtØm›§‚§uF”²çfã> °ú…­41_û‹tÿfÉ®óáºg­`ý‰à™Ì’ ×£•×ùšé¾‹Þ× …¸ÖŸò:©ngÄ3·³bßs3Ì´Þ)5«»ZÍî~´e2¢VøÜ ñŒ·QºûHi|ÎG;§ âÎë¬W9´ +—;FßtZAe3¦€Æd qçsP>fvR?ew!dÄh1Byÿ)%«ËZÇ舶dtܬ»ß¤¶ûF)¼Œºí>[w\ËücÈUæ”Îé R³Òj™ ætn÷äc6£G+¯[VÝr\l™ à3î×bçsF\²»&Ÿ1»* 1»#ž1º îœ.kHN§f‚ûÅŒäs=Ù¹\SJ¤•ûEˆá¶ ß×MÅhÞÇ$Ùr7̵Ÿ÷d÷{²sº#Ÿ÷\’ +Ÿë=ßr8K÷œ‰Ð½§VÇü?[ù>zuÛ‘Tw>©GÞÏ^ßý<1ÜŒR½FÛs1I´g©–[NÛtÌj›®(mÓe³pºèõ¬O!žï*BvŽR>'9—q2dÇÁÛtÂg\FöJ&C‰‡¬îˆG.GÄ£CòyËi¹nþóÚ–“Y–÷:Í5]0ʾ3RÛuMAm9¯’Z¿´Öù¬ñWCð9fÕ-G£dócí8`™Ïbd÷“Õµœ4«–;VÕr-Jò~Šî§ê¸aÔ-÷‚T˹àó!BòÞ8M÷­K’Üçjã3p˜â> +›.73\l!D1Þe ~£zßžÚsÜŠ2ìöƒ²ó«ö§è½–lk%£SJçtCè[Ž…ÈÞ™ó¹iµìH;f´•×õlçvM>cw>\·Rê¦sVárIew'Et÷Z6W­ÆçH„gûêî3§ð9çt^”5“Ô3ŸÛ*jû§[24‹®?ýÄër”k9˜£šÿ´¾åŽxÈêŽxÈì’zÆì’zÆîX–ã¶«6]_jû×uŸŠ}ËñÄåŒzârG=ð:¶ÜóÚæ#§ð½Ñ¶L®{äæ¡j|‰qL·ižùÄèû.9×5«q9-V.Ǽ¢ñGª»Ÿ”Îë¤Ö¹] ¡Y0ºÆW±ñþû¾qåqP?cs>Û·_(eû•ÕöŠñ{ÏÃÕ6<ûNù]:&#)ßiµo¹  ô>Ëe÷‡xàu4Ês‡—p$Èöûšò»áS.ã†Éö¡o?rúæKÉå’€Úü¡Ÿu>ªEëÓ6]Ê1œç r¹¥,½t­¶Íg +rûŸ‚Þ~*¢ö~ŠhÝ߉šï=Z¹ÝÔÚžñáEil ˜šÉ1\wi~ëÊ+:Îh=ó|Ò}åÕ¬·a²ùDi›ÎäXæƒ Íû?1ýeó}xÚrYHg¾•Ò8/õ²1«ê¼Ïö-C¸Ä~œš‹Ø±:+¡ó寋šõSEkWÚOe”ŽËò¤å–Ô·ò9—1d–ÍHFËd\±ñºh6ÍGZÏý+gÔÞ[óÅ6‚ÆûÆBlß½à™û+Æ´ßE)ÞÃ,Åû,—m§åYÛA¯m:ã´-ç´²ëb–Ḽ­º(5 5Oc.~`n9Ïsûž±´žãdœa}´,ƒfwaŠñ/Mp]*Æs{Òs×-›®yeÇI±nºeµ='¥’ Z}À¥éÅw·Îd `û t¬oi‚ï3N³žΛV©¹v­í@Ïý”å÷®²ßCap,Ëð}X=ûƒÕòžºMó£ÚóY]ó…S´¿æ9æs½ì"r¸ÊX’ã·a/^ËxŸ­Ü¤-«ÃZËîz®g3¢ÔyïÙî÷ k~/šÖ_±ð¹ îüîég.CŠUËÙ,ÛtY«™¶V¸\ñ¹Ö Ÿoÿ’|.*('Ä÷³Y9ŸÉGGµÂë‚Ðöœ ½_!Æå´[7ŸË¨½G/ÁýP@î8‘`˜-Y†»*bÏñhÙsSk¼NImÏ%©n9 -ÝÐØÜ\îŠ×e±ñºçŒììhMïT¹ŸûÙÊå´W¹Ü›/Ä—ãrÙþ›iœ +àUÙŠRlç=×z%Õ½çÙºù[CcsS@r¹©6Íç(v¥æ»ñ  f“ašßfšf·%µÍÏjßtL>rÅh[®f©îópÙw2Qo=±«B,¿¥ïþP\® èÝŠÓ5§q»œ%|ÎXMû}Ór¿…9Îç8×rÏ阌í˜ ®œÎ™M㛄Öz.#w_kh~·á…è\‡ÔÊcˆEµÂé–Òx]ÏÙöÿ m¿Qúž BÕ}¤ž¸Œ$õÛ·ÀD/IÄV¦´²å’ÕõÜ6¿RÑûgO^Íyêµí/VÇ{¤VZΓ¼§Zå2‚²d3²Ù7]O:ÆÃ(^•)¯äzV‘[ŽŠ »OÀÁ¥Y"gŠÌ›Šõ:Q±ýŽÔ›onÇ{è¶Ì—i†ñ%F1Ý)ÈMWÍŠû/€\k*Æs]Y]Ïõ¤g~pŠös¹l:èõÜ÷–á|Ë1:•âù.ƒL–Û +^ø>¢|ïà¹å´Ú÷ÝóºžÓqª÷2ËôÝh+¿KÑÂDMVÃL% Öã4Ïr;O³M“ì/á»*ËyŠÕ±=å»gÞHU÷—Õu]ʱ‹AUÖÂæ2,Óc”jý/ºîG­q»’ÞTšJ+¾¨´ÐJÖó¤f~ͳ¬·iªû2MsE†ãIÉv*ÏXn’)X‰ñKmH=û{ÒñžyM˯f>3{Î#±ç<wìîfÙ­_¨Qj«è…¡å8ÕùdµÝ7^Ï{ u|JÙü¦Ô¬®'k&È[6c¥ù}É’íÅjšOž劸óºl6NW½Êíp˜ë¾É1œ§YªãFŠbo8L2kÛ=ýŒÙa¹èº’ N£ú×®ˆÖx¡UÙ +*2f{ŽØ4€ϼŽ*HNçä3¯#òi÷‘T6½ è­ÿá ÷7xT»^ˆáºõ:¿ÃZËîx²ev@ÜùœwN§ÄCfÄ…ÏÅDÁÒˆÖp7>W£l÷‡ÐwÜr:§»IÊå¬X¸ÜS\*èMÇ‹‚ï n ÚÄiºŸÅŽÉèÑÎí´Ù·œõêŽ3JÙ|e¹þ‹žëO+/bôªñšèz´*÷_­fu<ز;£T½7N×r½g[ŽI…×ùüœë`(©ÆP”ahJ*{/ͲýG>q9i–½¯fß~ lÙÝ’ÏØ‘ZN™÷‰U³_ŘîÃàõ<&œ.‹»;ê‘ÓQÅ綆ätXBó»šfbüR#RËx§Zã—ÎËáqÌhÙPmEܹŒ"®\†Òzžó(^¥UyÈx 5œwi†ñCé:NiMïƒxØü¦ w×;îh-çT±]šU˱Áô½®š‹Ò¬WI’ñ:OsþJ(>–ÄŽÓö€ûZ¸Þ’£X‰ÐË.AÄç,A…èÜâ»ïLÅüœ'¹œ²ýß&t_Hj“ð2dÞAªëÆ):.Ì(ö¦ãdûqšl¿Ð—ËZÑ ÃTÛay‚ë0Ù}â¹Ï‚7¾¿,ÉyÞSí'BßrÒê¼®Jè=c¤‡4céÔÑÛŠ°¡Z»À2e¦¢×­›Åû–dy¤¦é„Ó±œŠžKRl§Y’ýXžÊ"ˆ´6qÓu{AªùÃè›®iu×a³q*Ĭ·$Ñ/;TëcØ› + V ó gó<çw ç<0ºÞs¹l?Ñxî”k(¶†Bß1ÀP‘¥$Çú¤5-çÃ}×ýð¼ë”zÆfà,¹Þ0Сw˜e·ßÔ¼aŠí¾éy´¢ùE)<:5»ûÉ–Éâ‰ß™,ÃÔš[q}èG—¬ªûL+»Ïƒ²÷9N6ǹîoÐyr÷ hü’ºî7©m9d´W”ªõC+¹ÍÉó=“B"³y•ÌtžQY…“ú(uÓ5©ñ×,ü‹•ÛE­rº"w’›¿E—#BÅû> H~ajÒkœÎj-»ëÉ’ÙEÍç°‚Êê–zÈê~¸ð¹f6­úIï‘€Öþ¥zŒÂåz°ewSª™Œ­ü®‡Û– âqÏY·k9ßô[obÏqD©›ÎIÓñ¢ê}ê–>åt:ÌxÜ6—kV×øœç¹îäö_±p¹#´¬Žϵ$ÍwçÚoŒÎëžVx”Kæs(±âÃ)ÙÍšmóƒÕ²=¨çÇåºý@7ÄßM³í9ìví¿n×þ¦ùs|û£Ò´P§ihFËîˆÐøœ1 +ŸFÙrÇ«™Ÿt$Þ?·cþ/Šî¥n9+6.gÔ÷?½å¢ˆØrÃéÿÓ“Î'±çNˆa88]³™ešÏƒ®ã–Õ¶ÜO;ËcÞ©`ý +aVšOzæ—»ü >ŽÞTšÚ7Os_yM×E³ë»«¶-c(HìGaJµ‰àAÅ£Õu¾…)†ç`£u†BÇË6Œ¾å–Ըݴ:&C{-€’Ú®CA‚µ5«î¹‘!ønbl †iÞ;­î:,V.(U>ƒIE×y¹î t¨Î^–່©42[k,Hs(Ußå<Ñu @¯>M–›…˜©³˜åŸÃ,û;€‰2»su–ãDÏ¡m5ÊuɬI’ù+Ë®ÞÄêŒ$ ÖÆèզ⧕ö“ŽïÔ,;îªmÓ=­n:iVå û[«Ðn˜j¾‡Ï[¿Ð’•¦óLËA±ë:¬¶m7Í®çŽTuœŽT,âÜbÃrÏz¦X^Ä®©ì8í¶M×´¶åŒÓv\ôÚ¦›fÙt7ÓpݹÛ{|Ò~(9/źýPë;ÎYuË]µnº§Oú ŠÃ…½l,H³j}÷¹ŽÖx/“™Þ¥tÆ ™ó9QoÛrjÆsµo;•å—®#%ë™×µW^—5$¿ƒŠÛ qåv4Ë´ßö–-ßÒ´þj%³CâžÍ`ê!£ãjá~T­—bßq\®[nªHíÿ.¥ã¦V¹]–ìn‰§ìNm÷{ϵßEYÎË4Ëøí¶M%ä®{VÓs,rÄê*C4žšuÇeµq;-vls*·kVßr6ÍôýHUãÃJl>VÛöç4Ýü¥t¬îçŠ6€i•l†´:&Ã÷\ûK”]¶œ©˜Ò»OÕªùË«ZÿÃ}Ëõlás×ì[.«…×Å,Ëúfº/œ®åžÙt\ν7NÛþî{nhK6#‹»[VÛsÊi¼Ž››AÄ3¿ÓjátÌë:IeÇmµñº#nÙŒçt¬®Ç³«QÂår–q9ætn׳…ÛMµè8¥5GžçŽzât?izñ˪»?Ä•Ó!õÀ弎ÚrPBm:äôM—Ólë‹ÒöÜÝašó Æ®ÛÉQ\WI’ñ6Ís_¨Ç=YEÛÁ‚ÙEŒ^¸æ•mwÓ4ûc–e¿ +2ÌG¡ãUç`ƒÕVRß|ÚsÁ)ÙCø¥ï4Õ|®nGÃ<ós˜n9!Ô-7žíx¶n;*v]·ÑÛb+‘Ó•†¤ºë„Ò5] ²ì7aÞsˆÛoñâcüÂzgÖL§# ûkšæ¾±ª¦ƒi†ý)x]ø NžÌ,°lµ… Ç{!Ý7RÓs'r²ØRô¸ÖzÓ±¿cØÅ°é‚ã@å*-¬·y–ãt¤c[–Û™Šù¾é˜ïÓ“ž›fÓt'H±º -µ8_l)G´Š–£fÛ2zOóœÇP ¿¼¢ç:‚_p$r²ÖL’]8–§·M§ú¥·_üOPÙ?óôî?†Þzrê¦3RÑr#Èî[Ç0ì2Óg˜é~3«ŽÛö¤ýÔmÚO´šù\­|.›Ë%«m¿/ŠÞ[µñk(4þÊ(Í^Ùq>[x]˜|NÊýÒ]¤\iÆ®Îò½?ê™Óu É@êyßY@Ä•"ÇŠmœ®ûJ+;Nj•×M«du<Ø2»íü‰gn×ÃÃö#«ë¾;f—½–Ýñ˜ó9`s¬Žk&Cê‡ìn +h^÷Ÿ£^ás/JtÞz…ËñÌëŽT·1ꦻY²ã†ÒvÜ–ÛžKúiÓ%§ë¸>q½8¦Sµk9'šß¢<ïkšë>’Úöoµñ¹#¸\×.WÅ®÷(GòÛï ÷Ÿpº&|n‡)§ËaÂå†OyÝ‘Oœn«NǬ¦õ/ÌrPª¶¿(Óùã9Ó\û“R¹ñI6c&ÉŽKIŠë/K3Z•×e¯cwÎj¼Š]ÇñlãuÊé{F‰î÷šó»—b™:vW%¿{‚Û)ùÀí”xÆîŒ¸dw×ëÜ.ùî› ×û:è}‰óž¥ÈöW¯p¹( x\õ*Ÿ;NÛ{ìuLŽJ5£3JÓýe8ob߅е¿éGN‡¬žù-„^h*G3]9…ÓY­cÀ^ÉP”¶å„S³?H=Ç ©f?óŠ–CNÍrj¶Ð\ìxÝ\eþ‹ò,ײ$ËÉ4Åþ¦Xÿ¢ ëM’]º5›îï8Åy7bûLòMgŒÆï–Ô6]Qª–³Š÷&Hð}癎ƒZßw)Fôœ0M<סÈ÷AÔˆÝ;‚`<‘š–«qžû½(Ú¬ªç<Šap#D3¿E/¬?¡ãÅ“Èù¢Ã†ÕU’d?‰Qì·i¢éPð®Ö.01Z›ÈÑb›qŽåX”b¹#Øý䨵ƒ¿ÞZ˜a¼Îœ¿ò˜çFŒ]o+|ak'Æ1Þfɦ:ç°Y¶ëXŽg¿0œß@£u†ÓT÷Gät­¥àuÝÓ¶ÜN¶‹meŠ…fC £óª^ýJò»ôÒ…R¶ !Ö†(7JrÌæ‹®óÈé{ÇÞ»õbø^‚Ûa”æ;R +—£iªõ¿hz/F’ÏY¥÷Ìë8ã$ï}¸m»­vÝ?9Šë/Ès~9uË)mÏꢀætL?ð:,ö}wR4Ó}O¶~(eǹ,Ëùæ;n)Óe¯s: ­œÎŠ}ÏU³ï9®6^G´%“Á½žÉ>årÖ*™ÝöZf'´%«[ò‘×!ñÙa­g2‚N¸œÕ*ŸãÑÎé‚ÑvÜÏÉžã‚é3L´>YeËí@Ñü¤9ß1ÓWf|Òº–ƒYžù'G³>mÏ=«o:åš¿Ãl÷¡TyÝr*§sFÉêœR³»gÛ­ÊçS8Ý0 +§>ÝsNë[.ˆ¯«^ßrÉi{ŸÅÆåh”m¿L’íBãuOêÜ®øœß‰Íø7_g Ã2œÌR­oIžó3Môžy]÷zàtB<ð:löm'¥–  æ˜&ß²ì.)eÇÙ,Ñ}äÔm·ÅÎgiÉ€œ¶ãl’î=2§[1ªå8|hÿJQ×k²ýÄ(Üÿ¬Îë‚xÞqI=s¹ ÎDxÖ«È ß]Žë¸'5NÄ}×á8Ç{@.4š%šî“%“±¤¾í†Qw] G9šñÊ*›»UÛ9±è¹ŸÔWÓ<÷§V¸ŒÞSÜ‘Ã4Wä‚#ÁÓrÃà$©=B§‹ÍÆyî3¯k9ä×¾‚Dóošë9—ä¹C襻†Á™ Ãxå/Ó$ëišç¸âšn€ *µ N˜Úh¸ÖJìxµ½,ÍúÞ³MGŒºë|ѳé¥ç4Ùq?0þ –†˜¬59]n,I³¿¦‰¦ã9×2Lä\±YXIb·$Ãê%Ê*º.>j X„ÖX–ÞZ®Ê\iþ±ŠŽ‹jÍr!tšà2Ê3\ÒªŽsIŠù$lÂê$lÄø2_ú/\ œ®´ã´-g¢ô¾‘ ½mT«\ÆG‘ë­ƒŽ”¼Åp MDùõ¦¢ãW’âç[J%³êqËýð´åœÒ³º©õM—b\ǹ Ûr1J´¾†©îƒÃy£ø^¤²÷Z-¼ÎUÇý m:^N—Ódû{OuœKŒÿŠáUå~‘ª¦ãÙ¾Ðç(þ€Š" +Ÿ– áW½ƒª36]m C0¾%IÖ¿0Çúß´'2ôbë0#Õ6±ã•Ö1üâCŠ`üñK1Ší,I´ß×ŒËø5áˆ@2„æÀDiÜÂ÷¥“Ð {‹ßE‚潋±º _Îä8Ƨî9–£y/çQŠä>‹_X=¤øÅ‹¿ù_¿ ß$»w^UŒ¯Á¥ +NÅÐhBLÒ„NÕ™Š^ØŒ2íwQ’ó1˱þŰ«mImûyQñ^ÄÎUš„–+48ä<ðÌ'¢û0KtÿHU˵4ÅàV˜Þ¶£n×Á •Ùœ¬±dØZô‹¿’û0K2EÖŸèU™½Rµ{Xoˆ1l Œ—Z.59ãü ’M—óDËí@Ñq0Kt¿Uó‰€Ðý,Sí#:¿½’Àg €›®'5ߥXöKH>ç—BÝ}%›ŸbDïCˆc¼‡p¬Ÿa¢ãnœj9eºO­ÊçˆÑ·_}û´ó;#î\Fqºæë@ÑùhuN—´EÀÕP¼né>7„ºùS*™TjFW“œûO²:îõLFÖì‰gÌnÉG^§¤¾çPäûÎóœ—bÛ~‘"ùþ’T÷Kˆæ½‹Þÿ²<ó‡S´?Ë]Ûù´ïŠÓurÊžÛq²å`”i>1 +—cJÉêªÖ²»"îÜî«HN—ä¦êiÓ1«î9bô-­Îë¤Ô²;(•LÖLY,™ *N·¬ºãz¶pÐvŒ®I•Ó%¥sºžóÝoI¦ñ+Èt~f©ÞSµl9¡w\ÒÏ;.¨§í·fáuÍ*¼mÏÍ,ÙsÂò>ÅøNâ&Œ?qƒöÛ Ë`¥š  ¨.•%Ø›G0üf“”×ýšcwÏi™`ï¸Þs-'œªãzxØqVFé¹›f:®fÉŽ >ßsÄç¼.èŒßŸñ»gÚ/Ó$ç{Pµ?jߥn:•$Ùþ1É Çw—cznÅÈ®Ûy¦çªÛ´Œ£QY$ŠÜ@¯³ !×Û„—¨³.Rg`¨ÎH耽½,Í{gÖ<çAIMHX .4ÁðÞŌ߂í4Kµ\ЗAŒÂeŸðÂ/7›¦¸Mç™æ¿øó)tÄù5b}ˆ™pÞÅιßbtÏ ¡o:çºÏ¤ºéV”Þ;*² 6Zh#r¾Ú`¿y“¤Ø^x ÷Ø0¾#Ê­:ð¤'x[óã׌â—Û ²Œ!’ï(ƳÞ]Ïñð¸gô¤a> _Õ  \Œ2§‚,ëGˆæ “Ü?^Í÷ìÏØ>ós )†é7Í´f¹¦kA¦éZðÀx"9¯’,çyÓ2^;äµmËêœÕ÷ MCøµwÈÁ‚ã8Óx&Ÿ9•<Žˆ'>ÄË%ñŒÝ¥n:B0·7_n(lÎþ–ãznI…ÓY¯ð:çtLÆõ:6ãÈ^‚üB{Aô2{I¢ïÂæÜîåÈöà Õ~¡Y¿£$«{ê9»ãÉŽÑU«duHÛ3>(›ŸÓlï‘T·_8UóÓö³ê®Ër×qQ./³,ߣָ]“M÷Dûg–j¹$•m§¤ªéxQ´ßEyÖ£j?Ê‘Œç5átÊèØ3:¿kJç2’Òö‰qœFÙsÛl¼Nê‡LRŸƒRÇêªÕ2Ûk™ 'u^WÃTïPw\Ðv^Ç“•ËM­r¹huLÎhkVפÆåzO¶ÿE™æã4Ù~bÝGVÕ}çy£Tó©Õ2\¯dxVã26|Ý» /µ 4-gB÷-¨xë;ì8’ ÜnåȾÃq¦íŠÔµ/ª–«i¦ûÁh[®×tËA«ñ:­~WźéžVvÍÓÌF×q5ͳ¾ä®oø¾u 1]kT°Ð^ôÀt+ömGÄó–ᛎó$ÇïZ˦s^Ñt3M1Ÿ•&¹Df 2Th(O.üGr‹mD fW!ÌZ#ÁÛb“q†ý)~\õ7Zo.|aõä7O’ «³0½ôhø>Ó4ësœê8•ã™2,ë[ôÆø`šÏ[ŽÍ`Vá2¢[´yMÇ%­k:§Õ]‡ãTËÅ(×r-Hµ?ŒÇaºã¬Yw]OšNä˜ÕFBkNÃD÷]–ã=ˆ1̾1ô¢»v–åWßqÄr‹q¤2‹QÄZ³`³o!Ô2‹bÝ~ßSíg9–÷2ÊsœJr܇q†ù+Í®ýMÇÁ(z±½n8δ>zu×U³ì;šäYƯÏøœgy¯¼¢ãfœaõ.Dbcxmç9§#%ÇÕ<É{¤5Ýf×q[n{nŠmÓÙ4Õr8Ìv R]WÃ\×q Ãê(~Xi(L/¸/Ò».d(¥vA…éÝb§Û–rDãaŽk¾MRÍW)–ï;M6ߊ}û™~âtÃhzœžñ<¨:®DØ–Q£lÛé@Ñü™åºt¢€Z-#À{ŽæùeËyŽé&E2œ‰Ý6ãs¿¦Ü®Åè¦S)ºãŽS¶ž‡ëî[Íë¨~ÊîŠQxœR—Ëbåu½(º¿Ó\÷g”f½M³ŒJÓû¡ž7]”PÛÎfÖkéZ[±#ÆŸÛt&öÜN§ãTû‡RvÌòœ'Bãu-tÈu5ä:G/Íßà¥ý-xã<ŒR-·¤ºéŒzâuDÛ2;$îÙ¶¬NH[V7´×±Ãô"˜ )ÇA­qºí]–ŒŽ;&·¤ÂãˆTuyM÷‰T5yEóŸXu_(U÷™TxÝOö¬Öë|†rú¶kÁ»ŸÇwžž4]MÓË1fù½ëN„p0H÷Œ#•=€¦u}·EÇå<Õ|mVN·Ô3v½¾å~Qu_F¹Ž›Vç2¬XøV¿ûAÕ}¤¸ŽÓTûWŠj9Žš¥˜¦óè…ÙSØX©mÁÞ~Ñô^I=Ë©Àq’WxI:{¨©"‹pâÿ0Óõ6Rûaµì1ŒZpH.7©×>Äzé-ȵ)ZK౑óõfó,Ç ­e µ[ÿQËøé6׃žù*Dv_&Ù–;!®ý2H¸Ý 2‡E÷•Ø´_ËeÏ ù´é’×´ß'Eó}R´fyöë,ßtt>=a; s*þ‚XÿÁÎåªÕöž%³-«l8ž“×i®÷Ã'»ÏŒ²ûϪ»ï‘ä*Û8NÉc `oDì/¢¤2³Àò¼ò°½ZAr¥yx +gH¡N¹,©Þ1ˆRcH´_ 1Jn¿-6æ8Oœšó=Ûõž)hÝïé1ëµY¶G°ÛVRáoÿ0úŽó=Ùüb“Ý?>Õü"ÖY)Ü.JP +~3í‘ÀáJ#QÆæÁæêL„¯ ÎAÔJû(j­å@½ø ¥¹Æ#^&¨4£DðˆÚDŠV¨¸ñ‘àÅ1ª‘i*=e<¥8ŒåÓ 5KŽ#щ’«ìd¸µ¦bgªŒÆ)Þ'­é8$ùŒ%U]Ç’ôÚe˜â| +Ÿ—‰Ñëö¼¦ãÓs\/Úåæ“~ë¿&šïH…ÖäŠ]ªFí 5=b"xVpŽáÚÆpjNrÌR+aó$¡#%gÌBÓÀ%=ÂgĆZ©eà]ÃèL»†CéG¥·È“* D‰åv#ýâS‚Gí/h²#x=R.S/2 u 'Ų÷=ÛwŸªˆ­÷:•áÔSe» +Ï(ž@„’àqŠüä!Û‡V2ßEï ÎCÎTY¦8(X1 Vz¾ G­´)N«dàØÁ †ú¤Ht–`CÔÖÐKSAœJ#if­ÍP½Ú¨>b;$P’*|Mh'¸mІKRßwŸÔÜö¼ºùN?sº²’›O¤më[„`fDçømÇÊeVÅb­c5¤u¼†Õªá€¶q¼’Ï;ïãS~cAlZ?P©~¡§Ü[nZo¬’ï9\j+nÀÔ^øÂÐX’aiV®Z?Ͷ÷ 1A\€Àƒ‘%“ŒQŒ†Õ/Ô8•5À"çH" 6S®j—<Û3ncaL$ŸÎ>>hº÷?^Íôi¸íF^;^Ët¡Ÿs]Hü†Bf»E‚76Ó[KIzµm¥ÆZ _i!H,²ǨøÆòéͲÔ"sZÍ94Ÿ&´\³b`o&¿ª5a–›  nªýÒ‰Ú°5èöË&$ëPr½ò#ô%³«õšo½1êîû˜j¾ñ¹æ©j=‹#•›…:5Ç©V¡Å ¡b…° +«`"µÂ€c)ÕâWuÓëC”[k/Ò¬4”(Z +#”C„B qÇk.~Iæ ;@a6Õ°1’%W|h5Û‡~Öû/$öݬôΛ™Øwp’[/Õ"»™~•!ý¼÷B?뻹ÍWý¢ÕD¿jÇkù‰5Ó•S¯šÓOôÃÞ«4ÁÖ\ü´Öt’ä»TêÖS«í½ÒšÞ#§ê}‹0l킎¤”‹« FÍѹƒ®X6IqFSRŠO!~@à›©mª-Óc YdP­×™–’Žˆ»±d8göLâiã“V´ýÊ5Û±=ä:˱J΃rÁ‰~Ð÷™fÖŒäÔ»W ¯½8¿Ô^œ_m'L07h¸¾Ñƒ‚Wðl +aÔ=^ÍöænC¨¥&'ŠÌe ~#òaëÃŽÜú+!yÜ/†FT¦P#ȯ8﹆“VçüšåÙ^ãÛ™VõÞ‰-׃„ÈzŸÕj-2Ù3JbH©YŸb‡* ˆÖ¼AGó‹‚¼% +Ac7™¨TûÄ(¼¢(õÎPÖ@åêU¢5j·ÚB–Ló +8ˆP¼8:µÔ:ôšÌ*è±#ˆAãã@6|ìø •‘X°µiVZ6Gê“c˜ÒzÖ#«è}ˆP ?âf‹þ†çپfflâtVCoºd˜ÂÆë¬F©öq»˜%98U¶Â×$§ósæ è«âÜ2 a“4w`…TÌ‚?å/Np¿-5”¤®é…[Yvé7Dl<œ<H!ÅÀÛ5àÍ1~Lr†Ô(Í/¶åVì–$”Æï4ÃêV€¾$I®³a•ÜD ††# ¯ ý¨ëTCî½4{Æ«bkQžq$Ùô4*—0¹Ô4ع˜<½* AZIP©rY€ùO@¢¬‚@ÄgôezS BO`9Rƒ¹Ú\žap,P¯ú³ËmHßw ^7£ÜfĆë@?æ;ÔÐ:Ô†ïÈì8¿íAó‡zÒy"7?YUç}Q´¾'%ç»Es»ì–샕†¹V½·=kü RìÍD UܤvöñSK9~Ý\˜_7 ¶š-çyÕ¬ø‘ûEÖ K«“´>±C%ç~¥± Åt£3lÇ€EOˆ-Q=¦5‹³ -…z%ÁfÁU¤[òá5LêQÇý ÷ÛŸq݆*†öTv; +J׉|Ø{›h˜-G +fSbÑô$öLú‰ë}¸è:‰±Ê]£C Òºù:Q/ÛFq +Na¦ÈÜâw5v¢ì¶õ¦à:‘yͦó-M±óªÎG³i>:¾û¨c¸ßÔ\'âÇ}1•ïÛ!o›ð +f‹bÙv±!³¸& tþÊCÎïHÉöŽ£×Y‡œ(w‡'÷J2ŒíyEëA¼pÁ* qNµøIÉ5¸±'ð¸‚+(á9»8J­ÍX·à:HÉ~AØ(½(¥â"xJê9K뾨· ²ëÌhWZ繌Ü|¦6ˆÛÞ#±óEëîG5á$»k1GôýF©Öï8Ó{ u ÷䊹¹Ø úV Òt:©Bµ‘Û°6g\„“ª×#G§çù üå‰eF’,r?øÀÚåØt‡® D¸4JRªq‰Ýä~߆‚Êx)w\Ïò ó4R¯ÛÑšÖ§í¹ ´}Œºï|ÍóžDø¥¿zÝBŠbn>è˜-:uË¥ÐÁJ{€â–PÞøy­}»o"G18Ÿ5\‘~½¥4»ÞŠÖ2#x•v"øôna´"« “ô® dMA)Þ¢•änÕ5xIf)¨¬äÚ4äéRëe»gÎmù-ŠuËM³é¸¥uœ_a‚µY³l¿{¾'ý´óRAn¾WÝçAÉu›§ùž²ì¾8¹ÐV”Wh +˜ø% ƒËu 2[N• XÃ4xÑ–Y •Ȇ?VuH$ø^ÒäøåvaÆiŒLRœ…pk «Uó-ä½K”\lC>ëþQÜÏUï3¹`;/ûE—‘v½‰Øy‚‹ÉöœeœÎ9Ïx +rËè"¹å¨ZqÈRŠm²Ì"ëÑÆç8r¬Ì0ÑÌJ 5+ŒØKpÍWFÝþ©!·¿Xí²}ØA› »ä=Ù±º”b\ š£s‹™£1‹*ø"Hi D˜Ø/vÂÜVäDÉ3h!ý(}ý°ai$C«±>¦1Á(3¤–TìMx ³I©ë +(G¤=³;:år#Ãpý„/Ë †0ËlÃh5öÁœz£0›ÖLžM¨pµ4´pÅ8(©‚mÈI‚àµOŽQdNU8”`ÁÅ †›žn %•YSêŒå©µ–-ç—ÔuŸg»îÿð¬ûM¬ù®åIç­@æ~MÓ ÷ÀŠçÔ&RŒ#•ZEéµ£èeÁqˆz‹€ÁŠSÈT¿ «<ÐdÁ6ˆKî 7Ó­¦šG¯ §k;ïÉÆC¯k¾u»ŽËr×~¨!¶œ[¾+­ê{0оÇ0Ãôãw-&©ÞŸn9¦U·ñƒš'°B 5!…Ìuf"8µ¶a&il‚ +÷Ì‡È Â7ô¦€#„ñs‚»(j­­f­™»ô%½®õ6M08¨vl÷éIë…|Ð÷mÙž4d¶[}Âw’f•™ +Õ|Ø|ûP²Íé[F;öK³æ}3{¾?µg{VËæ©à¶ Õç©Þ5aÔ|_1žñ p¾Ø\ø¾õ¾­´åÕ³§ 7㜫@y4ìEÊE—óþ@„‰ÁÆNÑÁ%>~OŒ›:ˆAFQèe½*Q-³_¶K—~½qðÀÖZ쀱½(ÅõæU­úYóŸ†Öû­Ï9/åžó?>kÿVû®ó=át(Åt%)¶Ã4ÃÔJšXñ(U›$Æ6¼†¥m£Ô<)¸­f™ÞÓ4Íø¦VŒ_j¿vD¬2Ш +/Ï$“'UZåÙÅæ!ç)m§@È0ÂÆè‚–©ÊÓ*M&šÕ¦Š3*Æ‘Ê,ã4³Í0Óu”£Î8eï¹[·Ü‘Ï{n«è-7ô£æÿô¬÷>]¡ûh;fǦÊlƒ.y Ñ›Å0‹ H%ï…zØ}-"x\‡•&S‰—lÕõºÎiÏdÆëZìd¥apAjgp±*»CEÖÂWU¦Ý¦÷Îiº/a…)^‚Å >¢SE6¤zñ;S0¿ä–ÿV©Mx¹Šmx±rÕ,¯ÆTŠVePª^ A*µÅ-·À)3Â)´:Rc%E±7hYckÃrÅtšh×™¶‡jû­Ø¸ŸŠuïU´ýÆ– XJ²j,y×5qVi`ÂÓ5Q^±ùª^÷൫VÇy&ÖŒy~©½0&¥Ü0µ¨÷mDŠ,É¥öÌ–õPCk9¨¡õÜ‹æw ½Ö:€bjh¸>¬ŽíÏl9ÿÌžù"t”æx—@’Vð ¡&„SLŒÒdªæ#zVcÆ«˜Ædæg1…õ¿«×› 4ìü¾i r£Ál¼'úþ´²ùSlÛ¿¼¦÷VnšO²ä:ã0f•É,Ñy•"»ß!æJm‚J»ƒÌ|ÅŽ›„!5 ^Ó;&ºÅv'ë…`„éÔÆH¬!æ'LAÊÓ šè²‡ b5z{H—Ú¾,˜Ð¦ÖÂ85¿ÃÄö ~­¡lÔ +Ÿ3ZËyä•|7bÅõe¶l'òi÷W’^j#ÆïšNÑü$Îd –6¼ŠéWŸð]§êu«™‚•5µf:έÿPcg´aj•8µÊp°Xf=Ÿ©²ÞOÕ™ §R[ðÉMBÌRCq³$‡ÐÂcÆÀ3zwð¹Y ¥ÊF’[g×2œÎ4ÌöÒ»ý m½ÒªÎs¹î8îö=×ÃuÇU¹ýUEk½’ZU„Æ«i» Rüƒø¥ÃÈ…&’ìJIv¡±^·)–Ù…$2MS¬MÅØE¯ÐÂtfAæéLO +-EPÊlãxu棆é¼è˜žâô2£rËn €hñ¹ÀãHÕ"ˆµbìÖešb|ôúæõ¬õÇlwmèÇüfĕӹÈéjûðBuöôÞu¢ã½Òª–ƒ^Ñ~¦vÜLôkÇ'ÜօĶõÀç. Qbo@’´&!³¥ÆBLûi’j¹èu=Ç$´ž{QV©=âÆ§7 «%iÏ@2ì¢KPr%'ÃÙU „j8HjšÆ¦[²^ºßM—Ô¼«×­DéÕf¡Æ¨} vÜALѺ5ë‰xäuCº%ëµ<è~Š ”¼e–VÕª÷/K±û,ª`t -i‚wñj³ŠÁM·gúŽÔ›¶aÌûMË÷(óÜr›‰Z¡Å0"Å+¸P¿ˆ(µ @™v¡8¹Î:|Pn +0<ÝI¦õ†jŒEq +íÉå&óã¡Ùtܺ%ÔŽcFÇùÀªøóоCÉ餀âuI?l?³Š¶'§h»óо§é;óºÖ7±ê<òz¾ëHÅô˜æ÷^r«§f¡ ½ÊŽ×óä˜Å&¡Å(.Çj­ƒ©4\”æ!É­5¬™¿óôZáKÓ<¿hb€Ð6M/8Eócšc; 3\N×}a´íWRÝý¯¡±}Vî7Šï7ËõUšFæ÷þ¢—Õö¡F*­cøUGVÑú²ÒfbÃ%«bmlŒÌ?)˜^Ä×Y¯q;ô¼^ÛrN¬º#8eöá†ÊL}ÏÅ»v6®ß6Od!¾-·ŸW}EN=ƒ ¢t—hÖ/R- VŒn{c!œ*«y†Á¥c=ÎsŒ7NÑýŸŽCŒTP¾C ¹ç¬Xu¿Å/ŒíEï+MeX¦¿,É÷eÖÜבŽõ0Íï]ɵ†œªë<¤ü´A…§€ L8xJj’à(|_o½è¹ßósöó¤Þz r Í™Ókžcü‰LŸqŽïÐ+{ÎG+—¡¼¢û¿iob‡iŒÅ(ýÔ~ï2Í.ú$R±8°h!(±CÄÁÉ™„ÎÖZTì­‰EóC~Oq6¼ðe`òYRÅ7Ü$µ)0ñ1;0RËpÓ$ï(‚¹ñ¨û>éØîÒô¶!«h|6û–kák#±£¥fb -ŽZÇЋ-hŸãjÝs XŒÈ)zTì¤õ¼7VÑs.˱œ +œ£1 )M­ ++×.,‡–£óJÑ«fݪãd˜^ô3Tl 8ziH @„ïhƒ#5O:îoÔüˆ ±Òô€³ÕJyV­]0R”b@…Ì–¢ +8\±C)²bVZ¯*vïPBYØ B—0³Ð\ž`opšÆ$¼$Å'Ä0Á;°ab÷¦ä»ÒÏÛ®)ˆMçÍJ+Yz¥Å,Çû>,·¼$ù&÷ˆœ§w%öGÑk ¨Gb‡)nÁ 7<Áeè CÈõB§‰LCœ„©å–SÕ¢gÙ‚;xÁj­8½Îi†= " “t6Q~Á%µa=’ûgÜvµ “Ô,D.9ÒJƃ·ÔDèlÕ Ûý§4>wŒÂç„ѵßx%ëƒX1úÈój,xõ¦aµi~ÇÐ ÎÃÌÓ\ƒ­·ƒ¦9)Aì RzÎ G,5œ¨V…ò†¦øSk¦ÚõFĆõG,¹¯åAó‹Ö,²Ÿ²gúeZËpM«»O£4ÛUÝ5%¸í'-Óožå6¢ío4ïûše:ŒQ¬ÎrïOŠåþ “m×{ªýÎ+Z/¬Žé&M/3œ©›k¶§èü†%7XpŒ˜Ûªîk³k¿POÛϬ®û/jžÞD®YJ[4*=®4Ô°”Z Â¨%‰uœA +šωŒG ã[¢_l7Ö°´jOÙí%ÓGäh¥¡Øér{áƒF×t×mZNȧM÷¢üJ“‘fÁ³ŽÔwcô¬‡°õ2‚—D „N™pj¾o±ë>†:<˜°B†DØ´žq~ý^ŽÈð€‚Ž1h‚“ØÉjë5Ñz'4X°bxTbÅ*…ÍžñQk;nΖZ&@l B|Ô`¨Ê€|Ð{d” +-ƒ(N"¨p‘‰n•¡¡Î>̽9xÙ’3‘z%HIr=`‰†© .½‘Ü-ú l8B +t«HýÞ•Ur\ÈñJ‘ÊŒEÑê,iMó§‚âsÚ¬Y¡EÛÍ@#NfÇù!¬‡ÑËRkÁãB~é^¤Æ   µƒQ4_å¸ÔžͲ ƒÄvQƒÅ"&ýáfhíÒü²[·i»Ÿ’üáQGɤRƒ`âüBÀÄ †‰”j)Ê,Ã&9Nì­¨(¬¿±f¹aØR—:ÁGüœÞ +°h^i€‚ôFáÓj»zë\ŸsÜ3köû¦`}Œô« Ës¾ó–Ý;Ï0^¯,È8Å9‚]k4Í0·-÷ÌÏrËûD(xˆòjìWõÒ;Ü0É7xBkðòs¶PC¤Ö&è,a&éý¼:;b½xt@‘r𒽂¼š‹Ø2» 3äþÀs;1”*arM³í>Ó«-èL⼊kµn9$õ¼OA‚µy ¿Îh b7g—M¥ÙmêYó‘T°Ÿ˜¡µ&ܰ Jxº)zVib”â°©M–Yk 8Ei6°41(Áf]˜1bc !RÇ0j­‘,ÁÞ ÚpÝȧ½çò íÊìø Ë=×_˜ß6¢·í$Ùm1‚­©h½5«¾/õ¸óG=ïüÐOû~^ró¯Øsþ„¯J.B c;A~ë>iy_¬ž÷ÇêŸÝ²÷.ÏîÚŠ³»ƒ˜e&"ô¾¹,Çõf¸ƒè¥vr ×c»o0H2žé.·”²ã& $±!€ü”IÜ`¥u»vŽáÃL“<ÔX +³[Ÿ™†¹U{ÄoFDe·Ÿ¶{æós¾ñ¬ûÁéØN¼ŠáªÜsh%ç©Ú5Ÿ‰5Ó…zØwaUŒíE)ž!謂(eö¡¼B3Iz±‘(ÁÞ<ŽXiH©¹ûõfrüî'¼4¡iÐB4GÑÃzCI~õ/M±ž÷Dóuœè½OZÆ õ´å°ÛtŸº=ëÔt_Uω½÷fYõÂÙ8±ÚB–Sf6T.4â´ŒÀ!„F€²Êѯ T¶è/[4œtJ3«ì'[ÆwðP6Y!Õ8Ãà$ ð ‘ô@Èt‹CÎÓØ•ǬW +2׫ÚrC(5?Qn½0¿Ú:˜yŠoà¡´Ö€ÕöÐIë;rÒ};_nZmÚÏ1£í>°e¹A%[u”žãZìhµ©èm¹¥ðuÑ'Ùšðx~E áñ +µ]h'xAk5Ó¯F¡u +äÙGRk E1Êl…qªŒÄ‰…fÒÔj;ar½¹(V¡YÀ9B¹Òp â~ËÌ'v½i˜9ŠCPr ?Âg©šÿpßsÉ(xÏÁ†è=¢÷$Ÿ‰vé;Po]§)Vçr©m¨r³RÁ—?\l9M§9.„K T¹.héùN 9RƒøA•±(R©‰,«ÒL–UkØ`Ã"Ò'8Í5KMC ›QDo)žâÔRSnÃtí;I=ï_œ`¸+Ù »-ïOü°ÎRøªÈ8ˆZg@*¹¼~ß–Û0½Ihí§`r¼J C˰ƒ‹Ëü†‚W¥ÆÁ)Nâç„f"•ÖB(µ&‚—'у³€„§Üjbì½8ÅøäÕ¬¯‰‚ïÆ¬¸>D4®ƒ9‘ë(O&uŠ Û +†ã V•u¯Ì@^i(ǰ“ÚÎKÉûe%¸?I%ß=ŒYó­VŸi‚é&Ç07£¸~‚ »õÄýÔl:¬ŠáŒV3åè•Ö‡ ý¢ØUæ’×‹ÏøÜ鎫I¦÷6Lò}ňÎÛ$×z¦t½WI‚±¡VÍGŒ`m A®6;Qe#K­·½"6 _QÙ†úUV$t¦ûøë+Ì®2’d—YÔ›Oä³î «d;JR¬-$ÙU–¼’ßš†Ô÷åTË KÔÉE1ŠÍa¬k!¼BcQ‚íÀi?ݦù6T0¸Ä­·¿¬¶D.8¤8CØ…ã(~µÁ†µ} ÅpÌj»?Ô㎣jÑû¤¶?*è-gÓüÂi¨rs¸‰’s±Ö^ð æÃé—ÞT¶ÿl×ý:Wh?«5Ž VÝ ·¤¸ ã•ÙMìÆåYç…zÐxè6\¯™vë`†ÔTxÂ.zTf.†Zl!É®6G«ø Ô«VͶýKlZ_b¼šà9¡‹Ó2]ªEë“Ñ8Ÿ·lçGˆ]i8O1zTœ/1z¹©bbgJ­ÃSYµ»_ijÁ} ­ØŽÙðFêE'azµéHÃt›hxÿÜšõ=Câ{Ò’÷í«„vi^½[šaj vœà1„Zi:M³~Ë]«q¿PY†ƒR×ü)vÝ÷áAç±×ó] Ó:„N™ˆl÷9×ú%Ÿ1¹¥Ÿ¸ŸÛ“Æ õ°ï(Æ/µ<(6 Tìö¬Êér”m¿Šïš‹œ/Ê‘\ÇYªóU«ÜOÄÇÝ0¿o+„SrgØÛk-ÄMÒX +¡“Z 5 ›#5 +óKí&ê•ÖÒä:CYz¡I±ç;ÒÏz [cqv×R’à·á”lGòió½ˆâr0ɨ7)b˜6O®÷k¾w«ÐHŒ\j5N0\PjÆË@ÅàF”]n0ΰ:IòëmƒèÅæ"èµfâ·…Æâ×eó’í=¨Zoͺå’|àvU@c3„|Ô}œ(ØÍÙU[9zÛŠUòþˆ ã­[5ßGõ¾ý¤ä:QZÆõœãVŽ[w J¬dB©2æ×ZJÓËäÃÎ3 ©ó\Ÿs~Ê=ó}S1ûˆ2kÍDéõ ƒëEÁu˜¥×-*®?±ë}:~³y†¡!§Þ5%Õk %©¤^i†•­(½i%xRò#XPŠæ3­l9+WÝÇnÙý Ô¼ïEÉýf˜žÅðªM„¯*-†‘kíF +¾«ØŠ›ø–Ê'È,² +6GgäšH²ÛÆÂ×]”`ºÎœaŽû(ÉðH ·I™íÌ+øŽb'j …Í™G0l!–÷#Å1% ¦ï@Éö*víB¿tgõœoÑóZÓð"%÷‚¹áDÅø¡UlObÅÜxÓ¯· %Ä©8tÔp—Ä/O¯7<+6 +R|Ö´ø¤9ˆRG˜bkè½IœYo$E*¶ XØd_‘ÊT~ÆĨz™Ð¹SQ’ë;Q³=«m÷«‚æt'>«y„’m•Ͳ[¶å®e”È¡JÓ@Õæ`cçpc5Æbhuv# {ÃjÑ)ø€’…ÀƒÉôbX5Öòô¢{µà6è4™•(¹ì-Î/<¯*¦çþŒå<ŒIp¿$óR vkÔrëIË{ •Œ^Çö r½{ÄÆ[¹eú{¾7õÈët–ë¾JÑ\?žé*p¾Ì†Rs>ˆç-ç=ŠËÅ¡ÔÀh>õœå<ë–ÃfãqÍ«¤–át¢ã7e5m'BßqÛm:?EÄÖmÍdôžkó¹Îs¯l<”‡L§rËuåÛFpKÍC®£ë~ÉoЬj” õ‹ Ujž3FÙt-Kp¾›&ù…š¦÷L3¬Mj¨½W +:×u¨agÇk™~;ý>Z9ÝëŽã9ÅôR~ÂÀd»Û.›LÓÊlæV,Cçï5”d¸~Ä’óSîXô“Ž+^ÇyŽäÖÙs mpÊmâ§E6ƒDç•¶ewJžžÕKnåšï*Ên½cè}zÝLˆa¸§¹N¤Î/­û6FªyÅ¡Æ*wJÒû¦¢×cœáº°Z¾ñRžïÛF²I#kk1ÔB{AäBsüjkÑ çOŽeÿÔì:ç}~ÈpR-Õ¦ó?>ç½K4lÍée†ÂSkqvÛ¦Yô^Šhgu”î ¥õ3Q/±*¶÷®aöl—›Ç²jÌã¨5ÆâôJãQ½ê3̪2™¨ÎEkMÌÓXˆ*5‘$× Ô n#I•æ‘Ôzc~ÝOž[p2Ô)´7+í㘅&“üÞc–伊’L?Qz×P’^¶¡TÊÊçˆÒ2=iEãƒRuÝ­µ:Þ7•b9£4û—Ù²´ܧ‰jÙ'@³½Ãc‚ÜR¡ÃT¦Ì{—$² 4Wn.€`w'Ö,Ä#ž‹à1”‚ÐqRÅÖˆ´cH⎠@:Ï`Bç3 Ò¹ÝMôÛ&Ä~ѨŠÖõ´Ò{Ï‹’뼨ÙN´%“ë +šÇ5ù¬õÍ+_å–ñV®y?²ìJ#RÕýšg¸Y_bËpBl4ß³¿k!Á®Ïö=Í®ù.ͯ5g˜zÞß8Ñ|¡”-§´¦û$Ê­59Gi:Ve)Gñ~º5ó“‚Òþ´¬Y–í,LðÛÑzÎcµm¿ òëÆ{žóUíÚ_ô£Ö#¯`¶ìØûS†Ó¹‚¡¯â7+¢vœ±ê¥‡èEÍ}Ðt?‡©öÛ,Õ|,6.WÔãæoµç½‹²kmÃM‘7‡ú-ãMÉw”ä®Ã¦V ¿åP¿oM®øî#4Ö+ õB§·%³Ër ‚f+MMÔX‹ ‹ÌMxõ¶ýô¤óVDìýtÛe‹¡”j¿D¿ÈZ–bm,p¸Ô`¿ÖFŒ`8"øme~;n¿mVíÛ R*BŸ©ZtK¶£`¸åÎô §cíº±á{–‹– JAXQ6q,“ÂF®N™ûE\uÀ©4(ݸƒ;Jë“~Üs=*2#—Ntl‡i†é/M²ÛÑÖŒN›Ë«æ|OÛÏ“Ûé<Õs4Msˆ¬^‚g…fhe’üjóPf­­H·Ô:ðŠÔ^xÂxRrŪ4F/¸ä7/ͪýICd>ÍÔÉl¦úô^¿pKXýj÷GLÿY½m=<í¸cTG«ß,Ë|e×­ÅðŠLÅëŒ=ߟŒÊyiÖš +¢Õ¼…~KZÑø¢µ|ïM¿p9R¯›Ïêm³öŒí[3žË]ï9‚_h#Å,³Þl§öˆóCAd|¶‡|/ZÃn+†Oæ(w܆„Öã(Åõ BšÚ-tºØd”罎sÝjÕ|ªÏ¸íéºÁ‡È$Æ ¯ËÓ Åð +íNT˜¦· ~K2ןŽÈ÷¦!´þ刅V‚&›¥#Õj¯á7eך + ×Z ž–Ú óËú®O¥óM@í¸"Û01H`§X[‰ò+ÍdéM³yŽ×®Û6ŸÛ“ös!¥÷_¥õÞG%ïg âûoJÆŸ$½p2Mqý:®“(ÁØHšZizHæ¼§³ËÒÛ¢‡Ôar©­8½ôul‡B"Ó¥–Àõ*§o +©œOâ“Á»*CáËBCQŠÑ_–c»4/ZÑu-wgbÏpD¬ÍjNÇfÛt7Rm2JhA.²)ù-ªEçy¸k~Pœ.Èô®µ°9 +ƒb¿EùŒÅÁ½nˆôˆIP²õjáÓš©eûzF‚ë—ÔoÚèkªÍRùœñ+džæ:°bXˆÐ¬4ÅAÔT¡èi¡)­èûuËî¯`<+ÖÇ@»p0†Yf/~_o0~]< 1¬GúYë·ŠÞzâ2Ë}Áe;Uõ!£M·â´âTl‚´Bo­äl”Ô1ŽTò¥¡³=Hýº•FÅ] ]gÊ혬ŽñD«OÕ®õV­:Ÿ# ³9¹õè¥÷~©‡·Q’ÝŽ~Øz¬"6«Eã…ÙîgÚuËD¿o`O˜:ë <§r­4Œì`S ƒ¼6Õ/5©¸^œªý:Ï2?9mË1­ì8é}òiו×2\ÍSü¶¤¶ù=Ø3FܲÖ­Úå¦ùÇ©:cý¢ƒ¾æ6Ü,7Èóª]ú’E5…É¢”ÆeKEä1)¢õ›RPÚþÜ~Ù–Ú1Ü;Åø¥s°¹: )zápžà7g˜šQz†³‚ßäÄÞl|žÞ+Ø©õ+ÆvÂìJcy†©(¹È@–\c½«7gìÆc +"דÚðÛÕ‡|ŸöŒï7X-4ök ‡*ææ£’ëŪ¸.U„æw•Òþ¡žuFÙu£òˆó@í×›I”jl‡«U–ê:#mͳH^fY$¯3‘g•¼cIe&Ò¼bkqz½U}Æõ*PWͨ +3jÁjLî·¾sC*ÛyTp[ŠR,÷<çišfýNõk*Û·@ã;·'í×Ij™Á$½ÆB\e-ˆXò—§XZñ*Vúi뛈Ò|/¥´þké|'fÃuà5Üô£Æ­c{ TÌmæù}û8v¥… ¿ÖT˜^iÏìØ~Ävñ¼à‘à yI˜]h-NoÛ³¬ÖD†{"Jã½Lè»—ÐÙÜQ+íÄêmÔvÕ¢Ü2=E‘Ê ciÅif¹O¢\íäQWùê´Q}cX•º'BIa#áâUsvó1S“qÁs~¦Ä#=aˆÄ$ p|A¤Ò'D<['GD\N)©ï– +‹¬s%æM½ex¢æ'Õ¨øÒ§kFýùž!¹Þ²!¢ðÚ”—DFÿY¿Úl¤_7jO™î#4Ö ±bú‘(ÕÙˆ*>4²rgŸ¶æ>SZr§.¸ ÖéìQm* ‹®ÚH °·0û• ³bcJnXÍwõ¢±ã5# õx) ‡ýÃí`¿ÒŽ\ïZõçû +k{e™]¬Ê„JLñ +;̧ ­V e’D*åVuÉ£D`eÖ!±3$$0÷І3ZÉwb¶›6ä©bs@±V~H TfŠ”p¢‘…¬P 3!>tPBÄG12G †Ì Ó¥®è;æT^[nÅn3O1ÜûÞñ´ù.|Oî `´ÝÄ"q åêBq¸€g=À„ä%‚’“3%1àÐ B,Тƒ—a0:`(¡¢d#„dÐI–ÉÛ ““D£Ô ˆIæê–ïê]cötÛ¦A_m¬Õ†“(l^Pº N*NtðáÂÄ€#(J|htÈ€"&bH°¢â‹ÀÅÅ8A LóN–ÂR‰dÁi…¡N?˜Uä¡5lväãÎ/ýÀ÷]Eoýu‹¾Ç@½l@ê— +„'É:› ì¨PcEãC„ , F` !B*B¸0Ä…Ê( 4z:H Å(ш'Vɶ)Œ$ºZÿx¶È€Ù0¶`6l Ûe†ƒí2*ò²I…¦à.¦Ú®SkÔ¤ +á3<à  ˜@ƒÃ1HthŒàÀ€%^0ðò’!¹ä–Yñ„°ÈØ ±÷ÇlòIï¸d=ñ*Fǹ‚­A{Âp/šLnÃ+Þïª@Í Ž+,´0Ña€ *˜Ðx ÁX@A£Ã(qrQZAÚâP½2™˜r½:±^ àd+PòØ`­ØE0µ#Owíæê…}r·p‹Ê%’Ä% lVœ¸q¢‘40°à‚Æ`ÐøÀÅ/8 Șøf–8‡W¡Ÿ&’!.h„B¤ y‚CVe§‘V{Ô5—þ|Ѧ=áµä•Y_”¼di5o¡‰G‹N¨¨H#0AIFðÒ¢t`FgÞoåLti¤Á1´ÁPøbZ…²j1eêJÁV}=br¡1ÛOÐÎÇ ·ìé¢QºÌžMQk TPw„ˆZ5Áoæ9ÁNJ±|*Å Rá+ÓIç‘iƒµÅÁ Ú*1ýÙúà ÒR±^™7€1*»:±1¸$hy‚Š„ *hhÀA 4ð ñ€h p@"|Ð"D#„‘:|@HÉP™­…¢6«Èý’ ‰Óš=ݲçÖìfœ¦ï@[¸œˆ±ÊŒaNp€ Øà¸Ñˆ Á |ÐÀ0A„Æ T ÁÀhPPAH A£*Р ‚ 4*L(¡Ax€€a¼çÒóÉÜ…Z‡8£Þ?Aà7.’—Z –J®‚94~’’DÆ  lÐÈÀ 2Р!Áh<Ð@T@AC4H  ¨@> h˜ Á€1p,à D(‰¼ø†ÄJ˜]e?*™®¼¦ïVmOÕªó=é—þ!ƪ‰0`ØÐ¡h@ð*ÐÀà  0Æx@Cƒ :h„¢1b„‰Æ‰)ptØD€óã‘€œBQ0V­X4—Ô)ŽLnI+²¤–Ù ´ëÖdz_`bÓ!D @1"Dc 2hHð@<è@ ÐX€ +44Рƒˆ%*œÐØb"&9G T¡,ªÔ¸æê5oqzÙ<ä4¹]­â6RðÚ Ul­áÖ{ÀLT£ˆ PЀð` *ˆ AAhl`Á XhX!„ÆTÐÈB Btàò‚|Hôq çç³@Œ¯gƒ¡ +Eˆk†;¥F©RÍI SsÆ!t†™ßQ&1€&°ÐÀ 4@à +(Ø@ãÁ4$x°Ah<¨€‚†PhtØÐBãC ÐÐ-P0*"ü¨O-ªFâQ!1ˆd˜…ò ]⬂k¸±vm bl¢à +>|àA„ˆ†tÐH€ +4(\8¡¡C $ˆÐÐ@.Z +b24€äEIAï´"+„%#æùh±w²]ó"– gÓM ›Þ-–‚<à ‘Àh\PÁ $ qÀh4Ѐ(¸ÐØ€0è ±ÃG0>‚èXQJÐôÙ`ÇZ•!Xôe™n·bn'TBž®H§·ˆ`Sé¥V‚·5ÆASÓst~Ðñ:` 04€ *° €$Ð`@ 4.€àAã 4$lðÐ`Á1ÔX#XÀÆG0&-MxÅ"ÊŸ­“)Õ©§åDÁpdŽÒ"t¬à&D2›±kB8$F „«1¢ÅŒÆPÐЈ  4,¸À‚„ >htðP¢1¢‰/"B” ÂEMT^¢üˆFˆH% †Ç¤PŸ.,“¸ø³5/‘ZÍO›Þp¦_PÁAÔ€°A  à@ã€&ÐÐЀFP ñ`(ÄÐÀH@A£B'J¤hllÄ ’"d`熡élZa©2¹3{ÆèXÁ.øˆÈ"ˆGé@j~ +ÐÀÂFCƒ (à€JhXð¢Áƒ .´Ð(bFƒÃ‡`hPࣀ ;X‘™*Т£u`ÆXÔ¡Ùƒõ¡];©^¥[±Ô;Q4½ÆYÞGˆá!KÀòK*`D‹ +`h<(À€ÆPÐ°à‚ HAc48„àÐð¹ €ÌMT!;Ï% FŸ,«ÜŠë&!ì|nÅH5—à‚õ^p"í‚rÃu Ä +šX„(™ñy„…*á„Çà òâ8¯Æj¦\hA+øM'J¾—$ÅÜLš[dÌ-x­‡G}JÝü%Iå0Tð—ã¸Î­ŽÕmÛq/r´]|`A£A4pàF ` ‘@€á#+PRf¶¼àðt@&›€*Uðñ„82¡9œRîÃ%ô‡P‹ …S{ƒH5Vså:‹òŒá˜Z1ý¤Yu¦É 0Fˆ +xÁR€`@Q”ç&ÊRxa€bÅN$PØ8€BÓ“"éc.a:sp³ à9µežb8&­/ZÅõ&ZK”+Í©-ã×qý'ße†Ró2X®PMb˜@ à ƒ<À ±A°ˆ¡s ;xÐp#¼$£6«]% Û0Ï r gÒÇê¥ö±Ì2[!ä:ë(~•(Ã̦YtÝ8ÓQð¤8ÔF E‡R"ÌTp ÀÐAä€ ÅÄX™BPÒC +!¼†Q·åÃíxB°ÚÍÀgõr™bɵ>e<ÏÉu¦&è;Ø”Æy~׆PµmãV2}cHD¦pÅj CEj€„84"˜`‚Æp0‡Ž/:Fä§$UL­ zǪ pŒQŒR-Y q Ð;E3é¼ÁŒR ·`fS ®[ËņBm’[ðl*€Ã + .ÀЀ@¡…Æ ˆ €!K8V´è±`EŽĨ¤LÐÁ²x\¢0lF}hòtO°Ol—«ÕÙ†òišïP½ØP¤Tf‚Üo(Â"`~Gt°AD£ ¸`YÀÅÈS‘•+,/Aˆ”\ ˆ1âÀ‹"/8<ôŽMŽT¬ B-˜†cP˜æQ—ÄÑI,ó ¯I¯p9éÕM'r¬BÛ ÆÚ]À„ɲ€ +"œÐ@à 4 @X0Aƒ‚…#@´ ¢E/BŽ  Ôp¨A.UÐsFp‰©X¥â0ŽTcJj{?R ·ah‰z[Qb‡øÀÞ„ÐqQFf9¨"4ÝI“ê̇ k+òió·Ùv¤èu³ ä¶C$þr•)§ï½|ÿ…ľ_yÈmÀ©6LòKÍ*H>'V4&çƒuïKÐ4¹5¼¥5Ø(±GÔJ¢uªXƒÎUüÁlšs,«Êb±Ð@Vh&M§±C%7Kt MÉ#öÖ#$ƳFÍ%€QõÊ Ï·ø½ó¦cæjÒÜcÚD–¢™o±|Š›H«æ¼-׳Çû† +ë]œ_k$~TðC¬±Â¥÷ÉJÍCú3Ç`§ØAŽÓ5?¨ æW‡¥µ¼Ai-otv#øª`F%7 V+í æ–ßO’[k%G±6 7Ni ´\·bÛþ›¥÷-æ¶6üR+r­¡øM™Í8½jJ<ñ¼ Î/xØ‘¤Ö«]ï¶ð¸¨5·Š©M¹a5 rSP{ÔSæß©â8Ì.2‘"XÙ‡¦ôˆ˜%õÆÎÕ˜ÈRK%:•†µbãU¿è<–]|L󨛒Gì­*䥻8·ÒV_n8ͳŸÄÇ¥(½ÁÈ5ljX$Zñ)4©S£çPÅêͬ¿´†ï/Å-7¾©5b¸dC'yËó +MèÝ¿`ƒ„¦q†¹qyÔq;Ïq~E û‚Jøƒ SûÄ ­ÄøÕÆåQó}|Ð{¨Û„ŸpÈPê ¤†ëÑ,y/“œJ¡s4¯p3äîÐRCµá¼‘ê,ÅÏÊ qKí7-ëu bõâUZ‹ ‹³Km˜[K*"¯= µé@é¹n’ü²‘ ½l%Ê/6 5Œ'^Áø'UY +^’:$ +§þ„õ.I¯z"Bi'Go8Yn)t´è(‚Um¿«>ˆ£ÛXÁÚpª]7¢•L>Éôa˜œ(9Š®µ<®6¤×nå9ÏIã&¨ìR ÝñCjg`¡†]@òìªIuAŠ4,BÍ–¬2Šc‹ºl)Ò§2 -HìeXß‹šý+É/7 VY+´:[oA±ûÛŽ&yôŽ ‡(Ъ…üÉr3½MØhÃ\¤a8·"´ ­[©ÐŒ[¯„ŽœÂË|ÄMÔH±ëÊ-Ë «]t‘cSŽ˜BИ¤i?ò€­…$ŸÈ.ìü GžQ󜫛Œ ®¤Iå¶"ÉT–A‡‡ü‰QÉ¥ª•ÂÄZƒÌR[Yzáj¤bpÄk¿3£ÛL»à|Õn>0jlDoªm´–߀Xp]¥™Õ²„Jc‘\"K‘L’Óh©Ö˜EVuÂéXƒ¤Œ¥ÄY…–ÍbÓ©ví@ì×þä’ñA>i>K2LOÑ‹jm×|­{NƒÊ‘Z‚J“ÛLUÙ…§¸Ô‰õª!™í,B„@6p´0¹Æ°Zöž÷$×Sü¨â-ˆZd;T°Pùm I½wB³Ö&0Aƒ-áb}BVÍo&Æ06•£÷Mù…ó8f¥y&½E›ÈV_nÛì{Îã(I^ÉSì$™9ЩAüžÌN˜_oA¬} +$Fò€á¶>æ}ÑÞOpB;CúŒ§„’-øÄ ÕÈЋ?)~Ùa ¯ÔX `m;P´=„èm qSu"g +„ÍÓ<äȵ&¼~éK-¸ÎåÆŠ¹«ã»Gñ‹‘l•Ÿ±¨±bX=%é­³¹ÚNŒVi$|Io¨›’ &ª…&²Ì2Ó@“ôŽÐRÄNñ›:‹v¹í4»õ%×®„•ŸðŒÓK‡qvé r’Ú¼•%Ä©Eø¤Î~Ôo é\_ +BÓ?Š]f>*Žº5ëV0^dɵfÒäZáCZcp"D6iv±íTÁè ȬµA«4@)3‘ã×Äèí°iB[ñk" 9BÍg¦[iPðý¹%ßG„ß¶8^h:Ð/Xów¦`=ÊRˤH•¦IõË&ÓSúŒ)×%ˆN„PÁ$”L¿øhvqÓc^fU}Æö6Œ~¢kóEÕq(űžÂ +T|ƒM”|¤F§a’û6ÌtÜ +Þ—°áŠ¡0 +±4ŸÈhaŒJ€…ñÉ‚‘*X-˜Y  µ=Š\m?ë!' ý‘¼"{yvï.€Uj(lšÊ.¬¥)¡zY€‚óÐCZ×X¹Úh®TiT”U„ RÒ*|NpX´ã 8Kd(„Sk'†Pf"†HimÖÙ‰Ë,FÆF¬ž÷0M¯¥8Ö{€¹BÓ0³$7á³jÁ£2“i~Û€|Öxª×ŠßÕÙˆ¬´'™/ »ãX¹êFŸ,| û‚ˤ%XYHÒ«m£ˆµvÂôzKfÇûŸ´?)Hí'q³•†Ã4ç­~ÊdT«n:9\m– `Q>ÐÑÌrôjÃqžù"Rx¼¸ Ò A~­­à}Ù!ˆ<¡Iðy…Á n ^X²Šî_µë: +^“$ˆAdƒÄA“•Ã'¦?)†ý+v’à)€=fÆ!µ–H«Íˆhì/Qsä¶ Ã$7Qc¥æA)ŽAȶÜáÆŠ­$voÌr›€¤g쨕†ÂwÅfÁIL¬`PÃTüªØ` ]¿HóŠNCí²—(½àJ–]oÓí9nfÚåV!†‡A iX0´a J†Ö*x\ôiƒÌ¬ >`¢R$ŠMo 5Lg ¸H‚U€’—ðI‘‘,¹ÞZ ^ô¾¥y1‚L¤<§6ŠQdr–Ê<àP©­øyÁ•àU¥‰àE•…Ðq’Ó@»ô \¬Þ H²bh¦Î6pÀîd´ÞDìh¹Å(zÁ0¹àBü Ê\ ^öàÇA³g ‘*£@(MAÈúBLY‹¡Ö[ "ÖZ¥ø-yãuæ)e–ÂE†ALj a†+Þ`Ƨ<Á&HM"¨Ô6QJ¥1ƒùUPùƒÍÕš‰®·#ŠòKGA†ïV–ä$H±û +ókÏy–÷J«:95ï)¸ ½?À@•±Ë~%{®Å(Æ×É÷¤šÓ,ïP¯[O:ïÄS& B‚ØR Ð\ÐXµ ›çºæ>€¬5Ýâß×/ýØuFlžíÅ%ÜßKÔX#Ej¼/8–d˜¯’ìÞ¹Ö±;äÓ=‡‚æ Ž¦(Í{žýhœÊ討Haô² :>‘cÅ–ÓLÓ1§p”`áñ*AÄI(j¬.~^l|VY0b³ð]±y ÁìIé[†Õ—ÑS†óPØhQБ]ˆgÿ¬6L–È.¬L ÅùeÚob$óÓu‹¥t”!ñNsçÂçÅ{°¹‚û@cÅADhMbgŠlÆ)¶ §çýÊÒkM“iÖ‰©·Ó¼¯YžçBÄXµiy"û UV¢gµRœ2«‰ŠáSø¦Î((ù!"ãp„žàÅó+‘myC …—¨3 /JrŽ"Ù«Åaƨ-ÁÅiÌCÊ”™†.µ`˜^”²ýP«[¿¦3“c“<æÙ…+9Šïœ É%@¡-OÊA +¨ÖÊÑ .ØÜjK1Z¥Á^©¥(»ØT`u5Nf ¨BA0rƒ€$êÕ€‡²jÃL“»çTû-¬™èhjyÈY‚‡Åø#p¢Ô28Ñž#ð°Š#ðJc "”æ(Z¡E·dÿD¨ .=_E06b˜ÃLTZ!ö,T°=)Xì,&ÁKœVm"lŒÚhà&€Uj.‚Xj?+´A©3G+7 ½£¶Gʽ‚uö@è} +ѻà –ZŒŸ8ï‚LÏÍ,Ñu4M/Ÿ¨” ¨ðÌs\WYz÷À¨~¼šÀƒKÆPe6‚W¥öÂÓëDÃ};Nñ¢ÖÙGPÜw¡3žS!†çLŠZn*I0¾Ù½·J¥¯_¾ +¢Ó3<â ;JmÂ+5:Uj'€XlJ,µéVýCiÌãxµÆÕz+„‹ Ct†°r„.¡ãõö‚¦Š¬e ÎÃ0Ãy&X£ãAˆ^kE®³%U‡^ÝûB¯¶6Te(p´ÒZˆg9ž+¸ˆârÝ#7~ˆîÏQ¦ýÅè[Κmó±Vó}cç ƒK’»…ïê,Û«Ø÷Ü“*—ë)Ûý:Uf3L2fiΓ½t8Rd)p¼Ø:|cûŠÑ¬NÉùéµÌ¿ ÃOQS…Vc÷SädÁ‰˜:{qsÅ&Â…il„vñ£B[1†ÕIŒ`= +›§²gXÿ›–û@®78Xm%v¨ÖbµÜdœÝzw‡"üjà %§9’÷Ni\:MtÌRÜQŽ÷*nºØHÐl©­ØáJ;FÝqf˜Üb–Þbœä*jªÎj˜aûN”|ïv©V•½(VÁ‘Ù±›Ï*ö£¸ÕvÆjmç«V7I†Ý¡Y´\/jæ£èIÉ3`Ñvý¢h¼Ë¬÷pãD&a¥ˆ-âfJÍDN¤øÝÛD½ê9R«µ 9Lñ9Rc/Iò^)F‡i‚áv æ{0Êž[VÑuÇl÷͘Ã(¿Ø^”Ý»Œ2¼?9’û&p¾xJoAè -Jpœg¸ßÓƒ®áA‘9BÈ”A‰kh•VâGÕvÂWµb «¿vµmôªÌP†Vg0O/:¢¶"=g <´c #Cì/Rh/‚Xm-N¯ºµ«·àCøä ü¢—56A Yƒ”žô/”[ ¸0^9ð‚ùuÁIÏF îqJm‚ ¡Ò¦5†›&¸„#5” 2…—¢5_Ù‹¢ÖZ°*¾ßPÃê(~Zl!D¯ý…Æ—$»u9\nV¤Î ”<‘™ÐÉJûIÉûèx/¢U–¡†ÉâæI¾Ñ«B#1~÷/~ax2Sih¨ÒZ¹Ø~ÕnÝÄxå¦Á‰ú­¹‚Ÿ² ^\ÎÓ,ÇäŠçˆZ/üˆ`’„ÏHMÒ¼B;!¬Jë 3e¦!çĩÏIÞò »«@»ê:ׯ|ˆé—+~@ xLëÃ-·=.úÏ5í.d赋¸©b ‘3¥öGÊlojÌFÚE3òßxÞu¨w­(×užc»ï™æË$ÃõdÕL§f×ôž-|_DfgÔóæ¯a6ª· œ.·:]o@¦:îz]ûwŽ`û —&¶ +™§÷  îš}Ëå<Ñúd˜žì¶ÑÕý—!ÛßR,ã}Î0ÞdHE&RüZ“JßrÛªÙ -QeZ–ÆFÀD¥eHIš“Åö7P³Üº¶+9~ñ3Ðo¦ æö‚ˆ…fÂ7e"ôª·êÆ-¸¢uŒ—fÃw£šŠ`ÙçÃmÏ¡(½õŽ!œ +R¬'á‰ÙU„ã<ͲœON×þ<«2B¯µb÷í ® ¿Ö>Š`m/€^k4˯h×€Ðø'Ø›Kôk-kßýšì»¡ßQärkYvá„Q¶¿÷,çMŽ\f¼é˜n² s9n­õšà{ˬgñ ³»à}Õ-¬ ©-ıYø°Ònšà;ˆ+ Fq‹Œ™=Ã1­j{L?!³µöqÌ"+b¿nYp½Êë}Óq¦9Æã$Õq)TºØbàx￯~cË dÇi¾Á“"»€‚ÝF¡k àûÒ‹Ž²ìÖiœã<ñ«H-ë³\µÜ‹Ó ΤT)\1½(2cØ=äØÍo ³ÚJø ÊD’Zm#˧¹°*Fïà]=0’õŠ,±ÌNôžæj”ä¸Í/P!z›øY±} ¹ÚB~Qp¤–Ùš¢ó‰Þ“Û¥Ù…cA¬:ëà[z—èM•…ÁÜl¤_{Îs¬JÏü¥–™‹"V‹^–Ú™©²5[k(H1~Æ ¶³,Åà<ˆ[h9ѯ5çvŒïUÃöc—þ¡fË-ƒ(3 /Xl3J´V«¾Áb¢(’0Šœ+µ•¤X³ ïS”]uA¤ø SK ‰íÒ‹[¯»*U°?)ø†±ªÌcIe†Âô¢ƒ$±ÚX¢\õ *Ï­ G¢•¨U S îBÍS™ØZ\ ÓÜŸQ‚õF¨™Ï”ªûIªÏ»†¡³bfÅ-xÌȈlUtVsyjµ;ZoèWíªUÃ=ýÄñbFrüÕ¤†×d¤_dÚ,𾽯ë‚ÐöN3íAcEFEJž¦ª,fæ6¤…ËQõ¬ÍXNáücUM‡ê)ó í½*2 +,Eë )Eo:YhE>stream +aZ Ÿ%IÖ[{Æ÷°(ðÛ¶è‹ÌÉ•f¹nƒKXb+APaŽDX‚?S‚DW3c6(Pm*4>ëqê‹IXbâQVæ‡ÊëñcdE²”ä¼¢šÚÚêrD‹¸BªH_0¦¸ D(¦œšÝ–”Òc_bá°™,)£WH<1¸Ž²0À‚žÝ ç ¦§Ð£È(Ãfõ]z;¸„ª,VOF”?Iìp™:¤LY>¡-±u ßþœÕ®=e¶iØY‰â‘ØÈõž-}ÄÊ>Þ±+×»DÒ( ‡IëJ +Öå S-½p%%á`A1·¦šr¸ šH–˜œBŠ”¤FŽª`– °ªW^\AZ^\Ô§-ï +UKý³÷‡´gtVëXœ3»¾/ºl!—·ÆéêÊÅŠj‰¦›¤Ñ4UZè)úPP='c£êÒO‡QMV‘’KXÒΗ iG êéD5‰ÊÆg ­ò–Ý\·Èd¢`h(„Sn©•›æ))l…Ö”C±ÈAÍKI[”Ð`©°A'.k¢bÃúû®S³Ì2$l³=%$‚„„4òãD-·§Ú4ÎÓ‹6ÃC#VÇoÀžª³P¸™^Z!~)˜ò¡D 4Ó‘@ÐK zX8°I@’ãB-!dC\<8z ÑàUît“*?(e·/„ŽŽŒPZX?W^aOY^b%§îšhíÎWà´æ5‰ß¦N_dP­©pVÕÇÓ’‘‹$%"ޤŸMO¦†¥%ò‘²¸ÁIÊL¡ÅÝ€!Åd)5½H5A!«°®®V[\/>QÝ̦q‰“Ël¤¹U–¢s«išñ;Ðò†Ú%£Y‚ÓÙB’Z±âö´Èr.%L!‰¨œÉ „ˆF|%#’|3&ÄÓ!‹H‹–謀}ROž’–SY\6<[f¿(´…™!o‰ ÓY¹¿=5…ͤ¼²ÒS±$/IÖuë ˜3¡‡¥Äæ‡ ¶. ¤ˆ:¬–Å XPf °žk‰—¨'æ‹TtÃÕäÄÔ²ª"êÒúBÊÚ +7ƒÂÈŠÑ/\ÎÔ8FS‘ ¢%¡H +x&6hà\à@#„‚ +ðè@(” ÄŽ5ÎLcØ"Œ3TÇÜäC%W! uiiUÀØ<>æ6f7 ÅŽüªõžV…­g«%0ìPƒU²EÃy:#¡¼|¡Ài†c£˜0F ³Aƒ¦*.T0TÒ"‚“N + °kqÃ֙ +HkÓõ¤#¥ÔòS4årÅ2“8³Ø+O¯ùÊt ¾-úŽ“´ÊD&­ïMÓ•ÖFOŠ/ìÑ… Tѽ)dcN,`aF*Õ˜`€êÅ`zCPe§¢¦R[Zê :)KeSý|±¬ F`æ§ 7ýÊU»õ²ß1á—Y†zû¹’ÀŠ/݈<(‚é@ g壀â  +Sd€ T2AKùƒðÌÑ IÇ…²fC®%²¬A]äEØY[,ðË)Jè$õu‚YÄ•CõšÕ\¹æ1FN`VQžˆ^ZB)à¸Â„ +hÜ`ˆ ! ‘A#¦B.,P`è…$.̓nÐæƒ¼ÊƒqcRæÀŸ²5e¦%WUUŒV«Ê½QG%EMQ!Ú(/×Ëì #ézÑH [ò+•Ŷ¨ªCSZAjG‡‚+ȆÏ ¡l05c’€O Šʇ üPdX §D…1¢ZJ¢†++D,t¦Š‚TTW*Y«°‰´ê\2µZºcШ¬ð¯Ë(Š…Ñ  ŠÖ; *hŒˆ@T0<€óÃQ‘ ð¤t@À*ÚˆP_!s ©Œûˆ‹\C»¢št˜¢°ž@Þ9“i‹La¹2〲ÃE<&¸  $( êb„Î4Š#4ÀED1 Ìk$N÷Ò'â\U¾¼‰¸3ç!¡ªŸ¥œ¢)ñ Õ‹L$ùUfå~ÇV¦~’2Hñ^8óJ˜Zé0€Yâ€.0Ài‚‚ƈ æ +9,hô8\Ðx¦QÀ–£…Ô+ЊÀ€ ªF%Ú•ˆRF45IiGLY{@X¤:žRdœ+ØüÆKÍͺò +ÇJO-ì!žj)ñ˜ÎÉM(*Àv€8Àé„D=hð’ôÓda‹Xt Ëqë +}˜(À'$…†QD`4¢+<píh¡‘£¡‚Í +4¦HbáxÀÛ[‰ ,|٠ݤ)I#Ia ¢˜hŠªºz–ÀÒHMݱ-ؼ%õmñ*bzðsSä‰ 4MlÐ8–ð áÒ(&ÐÈ!Aƒê±>'#D?`h]œ€ˇb¤ †õ4H k$IŠÚ •| Þ)©'UU…ç)<²Ó`M}˜‚^@‚ˆh X€ !,AƒÊ¡BcC, ñB‚ÆÆ LK< šp<0¥ƒ‚aímÌyš*p¢k˜“QT*«ë˜ 5ºh5Ú ) +%ð>B"€–”4pƒ¢…J88¾Mä±ô‰K™¼àåD–¼}¬$ íØ˜àMþJâ?ÕçÜÉHˆ\eÅÓ´5>rÅàKGå1%«/rÔüäô¡«\ÀTABcGCP9PhœD€ ’Á8 8(À4“òPÌ +1>€3BĬ^މ65i¡ê§ª‡3¢leά“zŽd'¦§”ÔØVWäøôfàEr*šçTW(ÓIÔtɂˋ82xPÀøQ‚A“å†eJMX˜áè3EwÚÓ¢ëúC"æ#ô4SJŠª-!×JFÆtÝÄ”öÕ]W‘Ó®ÈpËlXšOÑ×Ìê‹ë­ô2úAÝyZXšÄ<0“‚D£…„¤ˆ`aëŠK©âÒD—4»âê‰eÁEÝ®´}~BÊ´W“3Ÿ+ðÚB «U ûÅ\IÑM…=yÄcLo\$©Hk‚“°IAŒŒ<'4>8À€‡Q! +X®¡‘bƒŠ(D ÀäÂò@UÍLL1. ¹ @怈O)æÚ¤M| Û¾¢ê‘Úƒ´ÔA.w’X-ŠËkÍS!Eè…˜vxh¤T  A#ƒI0+0ÁÐ\`3#¡I‡*¸¤Àe„ZØ">%l •ÐÏdˆWÚ‚ª²]æ(¢$3VÕ–· <5æ^"e­MŠŒ´:à*· $M`À9€” +hQdX@JfÅ®‰ +B 0IV(`ê3!L{$ÈÒ%N‘v,êH;¦’:âÚòþ‰Ë¤ˆÚxo›> új“`ŸÀL‚ À:†€ªB€¢˜YPX<ª%,F[&)$©¦Õ”Õ „4ŽS)¡ÕºJî·/¤xg ÇCýŒõƒzÚö)y­ +iͦd…%ŽB aÑõP¥Èþ@qptBA™Ù@H²²¡™Rãa*3Ü0lÑqA:AŒœZQÏ,‡Ö¨æë(餪(I¦ÊÉÉÊ¥¥õ#õE®©‚Ákž^dW°šuHlnMkÿ¤¼0|®K®CªΖ\PÀ ñâB°ª {¢âÀÍÌZƇ¯³ÙâkꣂUõIѪòÐt}Œš^P\Ô(.q¨km²ÜŠçDÃfÚŸòYϑػGÊ‹Œ²tÔ¥ÂgùÃA¸’!yó`øABYÒBáÙr£"Ê ]áú! +IŠödÀþœ¤˜W^ )¦ëÊÅ©©«÷h«Dˆ‰ étF6a}°®ÄÀ*øF±I SÅ"kÉN½³H^hV¥«ø P–‹ƒ)ÑhÉH\" +’`g§ºÄÅ;ªB9½¤ºÔD`Sã“%žª??T-HIZZ,+°[k,RßUŒal*v²Ê¨U¶~jè—::» %uÓ¸VQñŽbrŠ@ É!Ї!¨‹"îTïéé éÊK$õ%'"I‘Q”޲t²š²T_4áÏV\Gˆ¨ +EÒÆ9ÈM„`ƒ¤`³C“ôÚbªçÇ#jˆ‰çå}êÚ*Gu±ÀO\[ç¦O¸,‡:63bÉiO,º-yE·õ¬a3£6\6õ!—-yÄhU£°1£ÒÙ‘(†Sô¦Ô•åbÃfE…í01…—¢Ä2GKÝ–¨¡ªåÕÔ—¯èŠ,sí’Ÿ(¿ÎxV¯²çkv“å‚ëU™C[p!OØÔŒ¶ý!¿½@­ä(Ë'6I´iý¡ä½Án¡ÅX©æ"Ð$²Ê5 + ÌzÓŠ†ÈmÚ£°øRSxBõa ă¥2 ÏÀ’ØoGhÉ”6Ê&‹g*ÖôfE¾_™•^L^•&!¬TWP•VÚ×%fó¤äU|Šú‰²Ô[Náµ*¦°[”Rø„j—&†ëèÄ©'k„©‡ ʼn¨{c$ÅÞéñ;nÇoBDâzБV Û­À4"q$ýD ¯˜¸”QTb)Ü©ïŠ5 -í!«E­ë[Fj}ˆñ'Œ‚éÓåÄ$„uE²‚÷’ à>GãÕ 0n“ÙU5/>%­CðL«J¢‚¨_Jaͬ'ñ‘‰ +Md4VkZÙö ´]úQÛ£‚àu­™ zE¯eËôÑ*œÎ“†ç!M,5NŒ¬ª]×~Øô«¢5Ý7õKyj½Á’ØoWDm;³º¶Ã(Íp4ÎñZT›~ úQÃA­á”ŠÐiHì· æ &÷ñ)£E ¡Õ¼ŠÞpbHð{NÙÓõ.fÃfJm9 (ÈÜ6â¬bwPÂ!Ö'1O ÖŽnËh-J¯±ãYõꆑÙÇIïú‘›ÞĮ݊Ö2Ú‘»þ4´®[¥éPIⶬSÄ“§ksÄîHú¡Q¢ºQjúBròzo1Õ²žÀdHNaí-Ñw ǹ¦§î»ÕçìfsåzËL»cÖmºÍJHn+’Û™‚ÚnUDn·§–û›¬‰V(LéékìGéKnüùr·aó"O˜|ÇGKm…²:sÀæ-ŠIb/ŠLà Ÿ´½æ^ë0v¹@ÃÐxØ.š’œFå¢Ý–‚Úô¦ vžDi]!§Ç[Õ"‹jÉp2M05 7AãÅ&6q¦FDf#B+]•O†”¼B¶F^hP™Ð¸ ‰«Å8ÁgGjšnÝ®óSFé<PNÄ¥F‰b¹}W14"VÜÖÜŽÛ”Z0¯öVAg(=•rW‡Â΀گ¹ +‹ý»zÑv¢b8Þ”l÷YÁo2Õ¬2)Ù0f3¥á˜ˆÐùäµ|ÿAÕø7`f(É-8öŒìÇi+ ›ÔåÖ<²2; * +/£žÄ¤´¸Ö¬ÄÞw“Öz¨"´žE Íê-ƒnÏk¼©øŒåÙ±â²&!5”Pij¶s{ÌmX³Û  >ÄrÅ¿Ik:2ûM#VÇlW,œ&dWÔã¾7³c·œim8%³‰èUµ[§ÔJ>h7㵜–C“1µeµ¥µì¦C #ƒfÕn==kz µ‹ìÉ'DJôôÁb«D±Ø4ÓîØ±J^ëÙºíT@ó:×ÐŽJþä£vóáÂá¾Gr|•Çìöä’Û¶>è7ä•L_av¡0·ÈŽYqZqˆ‹Ý¥u¶²úrÿDU±‰?]ò¢{)ôÕföxÇ®=å¶ãö«FƒÝšyÂÌ ˆÖô­Ï˜m¹;;n¿g-Ó.wS{FÃúœ×€‚Ìn¿hÀŸ 0Ñ%¤ rÚ–Ñ:䃮ÃHµÆB Rî•æWÐú]£ò„ÕªÎmÚŸòu‹~kjÉöÞÔû¶Â§UfaÅjÌOì­ÃÈ¥–"ˆEæâì®%±b¸_ÕË6²ì*‹1Äš×<ÃpÓk:?劥EÄÊ”?añ¥¤oY”’XMKäMCú„‘-¹á3n[Ÿ¤¾ý@hz\z¡ÝL­â6Õ-²j™Î›†é%|Sp 8Eâ¿§õF1Ë,Å*ÞíZ iJÍÌL­Z¨RåfOØÙ‹d|„¯Jž¢—Uæ[›QšõJ«Úߥd¦ ™éElÙm¨çŸú!›;bËlÆ-øLº%»­è;͕ˌäê„þd½S¹_"„A] Î)³/Z^ÓbÛ÷æ5üvԂת@à4­x­GhÜ܆¡y0±Þ(N-8s;f“rÉn>Oæ½’w8¡Ö)–KäåXÙ µªyäÕ0Òz©jÁŸ>_¸k“<äZDÖñ¹z“dÌB¡,ôÓ¨‹M¥$N«J¯9‘ß~~Ðq^¬ÞÀ¤¯p ff3ý²‘ËoSž2\Ò’wM[vÌ‚¡u4¥Ü%ŽGdÆ °›m|éÓeö|¡!uåá&3]Ièl¿þ|Ù¸>å:ŒcÕÜÄ0IýBèÄ~A´+Iz¡e½ýHDâ·âY •›†gŠÝóc†óñA߇zÒø¨Ÿ÷žJ(îïÉ㮄äs;NòšI“ëí•JÇ€B¡u¢b5"4 wäÓ¾7 ¥é¾ë·lÍfe¤nsJ¿­`g4P°3œ¨WMÆ)vƒ‰‚I}Äj+I)õ4×®cV¬VզݔX²ðú+¯ç5©6 ¬’ÙˆzÜö¬!ù¾™=Ãñ°ïLAmý•‹¶ «bm2P/´iw ¸ +‚êb;My¹aL‡¼<.èè;¦êΉZ¯ùÌ”K>cå*S©^Éo°]d?Bá7$Q™Äè õSûQ¿l6În0:n;VÇj@)X­ÅÍRød8u^"*· {¾Êr¨bh)ʯ4¦\>—´Ö¡éK®Ú•G|¶ä®«ß¶Å'7Œl­† ®ó füÌ3 Ã$ßÑ´ÞDÉ…öØÔ¾‰Žé:P4Þ%)¦Åp(Å1œôÊÖOÅû\Ep¾ ÕÊ“*%yǘˆÐnÉhÚ.Ò[ïWÜœõNšÖ#vœØ8Q±6æõ|ï2¡=†OhUìFRìB3¡C%Ás‚ƒ¸AZoÀ "cø Ü®²›+VY +¤S;åùeVÄŽé̬_´’ï>ª¸n´–á¨Û4½™M¿ý¨é>?â¶Ÿ¶KֻЕý¦âµa•üÖÆ±-{¼p=¬×Û&N˜”±'O,s°ZV+9vÑZü¸ÒP–^¶›jͨ «%µ`µÖ›†Ì’×x€Ìl[¡ðÙóÇ[V#í®exy‚_Ö€ÓÄf‰r¡­<•Òˆèp!Ä0‰R¨Uç!V¬MGöv”:Û0 +¡w¸Zs UÚe…ö!I§G_î(ؘ‘ë%û 2¿õ®_i;ׯµ•§ÙËS -y=ÓW-yKõé¼r­R¿H·ÊT›Ø)”Lì’¨ÕØ vËLÈ Sr»iÈŸ¯1eWYάìg£%¯f8 B–Zp,µ(0Éz?ÜLÍGŠÝ·%.|®…8ôuaÄb‘¢Ö@!+¹Î3ŒÍ% ö2 £¿ÓynV.Çôó–#*«âv’ÀJ©qï'+Ý<ÂRÙ–|æü( xŸ'í¢ùªß3(!vÝçg¼öËvÉF¢Tlg̳›v ¿±0¿Öb˜^iD©ù4Z1ñ*vZÅm3V/ùÌ+ÜŠÓ¨Úô'úmãIÁmÁ(¹þòô²=±h;u‹Æóª_·’¦Öس*~SýZûm¿Ð²I^dÔ¢.2I#±Ë4ë¯ÁX­Ú Ò¨óÈ ®"Í* FÉk®]fÊž06B s 9Ê#†cYŠÁy·ÒTšai6Ôî¼ÚCf«rÑôm®hèÜöã‚‘YyÐuí¶íRËw`Õ«†Sí"ëaÁÎ~Ú/3—+žõ»ù¬Þµ©2+®+³d{L MQŠ]¢'?IzÝ@’Zi+ŠSó'6½×žï*ʯ[N3FÝþã”­GNÍt+–­¤b»P£ÊFIbfUž1[ _šo½Ÿ!Æé`”d<Ðú}[bÏ÷äÕ\Ó¦¡†«Å«~ÝFà,­¨øˆ‘СÛ £ä–0ó3Fdj¶ÒP¦RrH&õ/ vSÍ2Srµ@»j:Ó°Û6ûæÿpã| ž8šUçSð‚Äp¬Zí«¹ªUÛ‰Õ2‡æ†SýrÛ©Šá1 qN… ñÉ"avÁ=’]qex &9¾¿ÖLø¨à%IïÙKS¼V ³9·g·*Ϙ­eŠåæe¿æKìî¾kxiŠwà)½c ¡ÈHüŠÔ„ ‹:¨±BÙ`·æÆ®¶:Xip Ì °ôœY¤Ze\&.9Q˜$EîY{7%Ó„ŠÂjQ ®™ ”ËÌdéµö‚¸uÆ‹’ëE«ø‡',˜§“ KÕJÛP³õJ€¡vUˆÙ†M—Ú.R/µßܶsí¦¥P.™i¬[pkϹMiEãØXv3 )bsð¼ÔœRöþ‰ÇL.(j~ÃÀŒ8 hQa>•7È©)°±9„^v¤Ú® ÛmÍd4¡bplØ i`DŠÐ„HUæö°ëY®Ú.bÔ’¿4»j-Ìn›  Õ²šÖÇü Ü8|D¨ @_qæÖ #¶ˆš ²&Z±#Y²£83Dñš%›†™¨ ¢OWË– +Ýí*cÌ"ë`& +Þá¦jŽr ׉St¾G ÷Û,¿ÖDWc>*.gê] i6µEœQsC'øÒ:oi ³³¹ñéZ@òb‘$ê¡z¡M¨ÑŠ' 1NeÍ:”’S°9jc¸az ¡j¿ +Ÿ•Z ßÒºåÉwöˆÕ–[±5žLÍÅÉu&‚ÌšŸ0¿Ì°Y·ŸY%çM¤Uo§q +“y;õ>‰>ÁQ‰Î´\Å ŒD¹2Ø¡O–Ykp¸`z=[+”Nä&•ÜeÊuöRÍ:»¹z©éTÃÔH”_g*Lo[±Š¾×X»g3Ô°1”'W±w°`hÁ¬—­d¦vãLÓ¥$Çùæ—rÔJk!¤*!^™yXyZq1*ù˜a7 .Ve5ÅtI›6 hM†×(Þï½ýOh—íBˆ 6OkÜo¥šÍHÁ뺽 ÅpÅiù®å¦ý?=k¹,C'ˆ,A‘d"V–7N3\Ûo\|ðÐSÂðUÖ¡†* ÃŒš ßWæ'À L0p£4QfÉ yba°A2»k/G²=Z}û•|æqL>qº*Û0 +@¼DIÔ<É-xñÔ*`ƒŠ5,~NHzÂD)2ã¶K'ZËw(S®(¸è‘€Éj}ˆ!zÀAå,[Z ¡b·Òv¤â½PZö+©h¹D¤TøP|ñ[‹"°á&(‚¬+Cí5Th×kœî©«_0!“5€DÇÎÇ5éŒÁ§í:ãwT@)UH ¿.á¦+¬­AŠZnbà iL°A 6T‚0T«µˆ¤6 Ç*`ø–xA”²`%¨ÜÁLÔØ†/ì-§ù¥!æ÷Ãj +g•¸Æn¢ao,~Wf!|Sð 8Rl¼+9Z΋ Áz' !½`2y§D`ó"Ú µ‹ìc9åá3RO b¼Rà„ +–‚Ì”ªBŽOùAMòêBëÝJ«HÁ=–HoDŸ0ãs«Bð™¥ØãeBB·T©à&G_S'ï ×ÊÌÃ~™íT¿Ø¬>a:”ëe›™z™õü ñM-ù>{ƒ‘´* Tj¯0FÉOš_i6O3ËMË‘$±ÔP¡â¿+¸ú…¡CU¶ R{‹{cæ&3õZÓuÙd¨UeV|È+†Nòf”Y‰á™›-y…q©}ò¬šÃTµÖ(Èð„¥½g)G±[‰1ܦ¬¢÷>\ö>jh‡*Jß«=ã·É(tGÒJ Ô“®c¹ãz¦‡¹Ô0@ñc°"”~âS>ñƒz'y¼o.–LqÌ£rÉ”Jþ)u¶ ’[˜#öœ%÷ˆó +MG»µvýÛm¨Wf)Ô©´ªî«V™F‘‰.Í9ì(ÉOüžÆp á½7~׳}ÏÕ8ÃpK x(±`ü’Þ*Í®¶žõËí¦zuVâ¼*‹V•¡“ÐÐ-˜Êê,CKõË!\š{¯Òb˜^û‡ñÉÌË4¬‚µëARêƒ ô)Fp +®ó*BÇ6löÖ’ç‡ÐöœõŸƒJËü&Î*Z¼8q¦`mˆPÅØ€C4¡Åt+Æ  ¡—=*-EÙÇáä©7tÜPSžVó^,»b'Éç *\2£÷ T,÷,;HeB|ì´D­Ü/I*² @¬b ½Q­ÐLš[jÚmº/´eÏaàø1@CÈư‰,óÜRÓÃ#Î „IÅÀ dT/ž\¼`n=«AI´Ê ®)È pO|¼ô4°Â£™@ e%@˜¸(™ã…‹ŒôêÃÙÄî fø¤@‡Š‘C’+µU +g€¡nEiV•à1Á?ô’Þp„ÌI¬˜½±(†ÑtRƒ@à2Õ­¶™é×›ÈQ‹MDù$·€³ýrè •]¢]j)†NíD+¹ "ÖÍôK­Ä™…fB(DV܆™•-8YVÅ@Y¬Nó +¼ëŸ‘E¥ b¸]e–Šóª gúm1~¡í8ËnPBm~Q›ï$´ÎC³äz1~û]¿kÎìù-ËUãGðšÒr¬Ü!EïZÊÑ‹­Dp +-Ž™ àÔØŒU+ÍCºôŽéiZÏp¥ä|Gê 9Jé=)9ˆ+³½¨±F%¶ŠtjÌD‘ˆÜñL‹i‚ír|È)Lo•èIsk ú­ï@Ï}*¶MÄã–Ûn×úl6—yvÑ–Õ4¾‰Mï³[v?«UçM±5clj‚ßhžblÎ*[ŸÄS6׋–ï&ʯ6âW›‡KmCaz¡e¯r9$Uwq´š¿@ÁÖZ¢Zrh—œDùµ¶‚‡•6!$È BÊL…‰¥V´‚Ñw¦_<ŒãԜ˓Æ¥c· ZOz®KµjûO~ã^m×|/Ö.@¥¦Ô”Lib¡¹HBÍAšSeË«3•h™öªì ôµän­Õh«Î@[kL)³B*´À&² +&Q0 +^8³JŽZmBª˜½¤xU&!FˆŒrôRƒ^Ûr;NuŸmÇí4×{ tÝ¿Y†±½0›ÒK­¸¾U¶¦I>"üÖG€ç}†§ù-¤_€\Ã^­ÖB~Fh”e‘ùdE€;F”h»½*³'X}E±©,EQûÅNTœ%8õ.!ÃŒš‘v­‰¨AjO°AÓ@uÆÒìÚa¢]mÈ©O„Žó*h†ÒJ W(I­¹Gp«MÆ©0Ôü8°ñÌŠ B”ÖpU¶áÆÈ!§èm@‡¡Tœ c‡Ç #l4`0ÑØ@D (P¨¸$³8ˆq‚YÈù)“ *Á#X!Ò4  5X) 6BäJøœñcº£ô±S…¶áFjŒ§ô‚s€… +u,LB¢/SI¾â7´æ0ÃW@"‹À£øI´«NR{é=AŒšì† 0E'öGRiÁ†+¶‡pÉ:C´8R°¢—4Æ +Fa¥Ø´@L•›eÓƒèÕ1>a9Fm¥ Õk†¶Vå9×™†ÒwôÝ™=×_žblHl™nå9Û{zØú žv¤x5¶!Ü"Ë’ëÆ+9bøT–Ëš û£YUæ1e‚ë5Ácz˜â‚AçÈ'5Hk „ïIŽÁËÏÙ¬·ÂN¸ƒˆ|£¥bWArgÈAjÛT»Òp®]i(Ò,2,Oºͪù×íZn È-—5ô–ãr×xj ÇTæ‰~©©D·Ì|WïY0êEË^Ýû+ 1?•ÏYœ÷lNMÓ¯Ùöžg»îÃ8ÁÚŠÙñ… –Æ"x%'!†ÛX–b8‘e×Ù TÌ-J ‚¼r?±è=JŒ®!§)þÀÅÚ•ÀDiU!fîM¿xeVìVå¦ïLë:_Œ¦õMk[¿Äšë9Ð0œ‰_Ô<%ù•¶Óc{RÅn>?fº2K†“zßvª]:ÍuKm£%§dYµAŠtëD‘©=2…Š¬Ì¤F[h9W/5¦öKïñ)óyѯ=…ЊŒcIEÖåJ‹qv¡É8½Ð€×ðÛ ” §²·E¯ëýOV.—œ¦ó0Êï[° +~k™n‘5¯è<÷¼†ÛP’_¶’Ÿ×M䆫M„LÙ†›!3‰«ÖÆ1H Cù$× ze’„z±àºK ·1Ü:k±3U¶Ñ»B«q~é@G_oD,X[ǰ+—<ó]µÚB’]l)„RsÁ.µ”£¸>ãçk a;•§œÿAË|5Yi$:[jE-µ <%x#R0TØ -Áãx–ê—,‡ ó%L¦ ´°ù© „iEËÓ«ŸÏgX%É- T ] FzJÀhaR¸£0Óô.Q3…æRüº¥å¸¢tM'Œªç~ůz20!£Qˆ +-\¯>”]¡Ã€¾& :¸ä N´ä5Gqg¸¿âF‰,"É2ÙnÆ©DÄð(#YAåÇœ…hÁ ùN’¼…InÁ£FR<Б>U#ýZ†ðé€2A€0±L›à0S¯5¬OnëC®³8·Èl¦_dGm¸§G_rÅÖjª_e)K¯3¥—Z ´ûö1ŒŠOh©f±0B±Q’]m(~TizIî ;Dj 4O.)=¦D€Pn|¾,’Qñ À"5í—™«·‚˜,xÂθȣ5&âë­ÏkçIÇx“ç”|é•NVëm¢•Ö@3/ÑË:‹q†ëÓ«›/õ3æ'âºñà Lˆ˜jÔ–knƒò)£ÓqŽé2P¯ ²»öÂÆ6“¿ ñ¼ý6ʯ´ T|ºMž¯[5»ÞÇ Çv8Mn¼¤t5Ch @²_^\½Zbn3?*x#P’´89®P>©=Š^n$|Wj'~Xi*„Yf&Iñ›QÚæw¡Ý‰ŸÚpzÂt¨aiIløíXMï“QuGIÆ‹½mÔë[. %óC„@ÑÑk¡jÝ8Ïy¡·Î¦ˆmÁ Së€<§H’XD+ùSQù£›ðùxé`¿Êf¨\j'Î,3œiWÎŒ-G*¦Oµêý”<Ž›×Iô–Òl†Àd|¾/M®´éâi÷{²çüIR‹L¸ížQ¹Ýµ!›ÃÒ9ƒ¢S"R˜ ”X‰^ÀÙz©B]¶ž"o0¶–‚ņZÙyßÓŒWá››3T6b™¯ä;w>'ÕsvRôZKQ”zÏH½Ð–XôýÆI®«VÉG_j%t¦È0À¥§<â{«…†JriƒècE–bg©¬Â‰í@ ¢U‰› t ^PÛ‹":ÆqªlBÍ–­Ø‚¨×-ŠV ´@^U˜!Bçl­Òdª[j.Ð/´#¶|ZÃw%˜›‡ìmcØÅ#foñ›j)>¥•(¹à2à$Å[©ØFŒÞ¼ÌR]×Ñóâo€2‘Cµ6‚ìòOžYtœë^DÏH^aæ½ÂØ”6b¬bûà9™‰A’KˆéYSá¦/Pq~YBlr‘D‚O²äj`„™eÁK¶¼Á šYuƳ†Á=¹a:ËòjlÂK6ëj ĆצZ´¹S‹‰jÉ;Š]g¾hyÿÔŽù1v‚Î ¬m°Q +¯ðM‘Eà"Y¥aĸ€‹çU#~N¨p"M „͈àQó:¾«èu¡‘½n½.6 <¦]Ñ‚}@Äè„!FˆŒ‚fÉýñ»*Û™Šé1n’Î x 96 ¢jòÌ"û 5×€ã$Q¼J+Qf©Õ@ÅõßÔ|ßjÙqZzÆX®[Èê·¨Ç×{›à5ïPƒ…F„®ûCÛ±:&”¼ïðBG›À…*=kXŽsœ·Àb7 Ã 8¼l#ØXjU`JûžäûWL§°¢¬`EËæéeV¡d+~0²KˆIrà]¡™$¿öŸ­çjãt'J¦U˜Yþ¤`µŸóž‰-ïU¤4½E|ðˆE€íR Òó­‘‚©½…À€øàq Â ªvá6Äø ˆ©4Øl¿ I(yÇ1ŠlcXeóô¶MýÌãZ’Xen€Â!xLlç9oÓ<ëÏ5Ÿ]ë‹Ô4þGÓ_™Ò"xDb1P±4–åÖÙK3¬ÍãØõÖ¬Rãq±ÖLžJî&N©š*UÜ·¥:s‘T’w3ävÅN"h|"èH^iÈ)jÏ\³ÔBƒÊÌX½J˜VcE/7 ^€ÐD»$(ÑŠð-½[¤ZhX ðÛ0 ¶ÆâHwizß‚Ssÿ$ æÖBƒ;~ó7Lq_äèEoq~µMyÆúU|7AŽë-r²Ú@°<•} ÁbAU¶¢E6‚ÜjƒA¼BZ½ØxV0º…¡s)¦]^l¿V‚ÒV¶ã-So†^v|"Ø“À +í!A£A#ö†ßœCy•ö¡ÌZ‹‰†¹M{È÷&LÇ©zÙf¢`6¦Ÿ·‹ÈÝ÷Ù²ù,E0^Œ r-<â9Qc.†Ug4±@âf+Á f“‡š¦¸„—!¹&T²(̯?nƒ"•'\ª°H¯ 1³U€ãAÆ' ãüb› £ùUš"Rì8eÀ‚Ã0ÁÞvšal!¾©¶¯¦Ë(ÁöÁ.œ s­oRáùm¾Wê‰ûÅHq9¬Ø.gJnžÙmÍ舶c}#ž5=«ý¦!§e{ Lm„MV‹ÑûF!†‘É 0|¸ÀùlZÃ<¿Ðn¤^7‘ãT™‡ ó*W0(jˆ0@r‘4§äv‚ÂÉ)¸ æ–œBcYn­¥4ÁØ>ŽWg¼ø”=ŠTcÖ-Z”šñ t®ÈNì`¡‰½ô*Ö´Óa¯nº“Þ“{£Æ'LYõ­È1:CPáŠ/if‘€ +{ü¨Ð8ŠYl.˰6¢ôKç Â„*áb­rY‚éD²â/Cë `Öš SŒŸfÑq׬[îg;¿+1’õÊàÍ“X³¥Ý·8Or X™)áÌš`…5¬‚ Gêu»9:½5xQsQÃsuRôÖ@q¼2`BÈR.W Fª] 3Eð 9Le'Ê/¶"m"e Õ ©ˆ"²MÍ?)¦ù&ÄußÉî'§p9e•í7AãÓm@$DĆÓz~ÎzbÕÌw!är[áƒ"3áRc¸ñ)wÐar¥]mNzGFvz6ŠLe`„LÏ8MЙŽR{ Õkƒl·ÎϘƪe¶â5çà+JoÐñƒÐ!:¯(J‘­H·Ò¬>c|T;ÆÏD»Ô Z²Þ™5ÇÁ V™Y`irc`ÉBC±ö6‚£7µeüµ‡œZÃpÄ©ù­‰%çEZmj”Ú„`Á.@é¿~±í@ÍùiϘî³~ÝHŠ\g(D-´f}cˆåFá…[ž`¤(Õ€ ™ž:xI€ü–@ì`Ã>ÔzD꘩×Û 4̾3ç¥\³þÇGÝ·nÑ|ç5­OúyûµÚv¿&©Þ‡ˆ£XÉjË ”¶°âSövµ•$¯Öx)4¤›‡qjΡ¦ˆìB˜…&‚‡¥¶b<÷“Qxœ™œ—¨Ì5ôÖC µùË«ÄhEF”M@Ï©¾¿rÅS­Þ-J/ð‰¾·ðq™qµäÄç×Y8z`€!‚†'lÃËœÁ ÞÐ?$X« ™††ØðI5@r´Êà䨴À*PBj„È Jm€Òc†AÜj³i‚í C¬³&6|ÿ2ïe¢Ý5e—ÒšÞ ©h> Sl cãzÛ8„bnÌ©[Ì“ + 4tLàFÙ•j¿R•qð‘”zC¸TÉVLBŒ9F±êÌ8Eëu¤a»ŠÞØGå2ƒbÓz¢•Œ_úqÏý¢ä:ÌRüfRìÒw˜`nT­ÙÏÑ‹*£€D+Öƒ~íC¨—΢ôÒO”ap0Ñ/ºÒª-ƒNz' +ÆVBì²Sòsæ@„ÇËa æœ:ƒa‚ÝÕ/߉=û…Э3L 8!`Ñ"ý £´)†ï3ɶ\ñI&ckM#ךV€¦µ-w’´ƒA<óÂ*ogjìÁˆRú‚$4+žV¨øˆk˜_:Q)¦WÀBŒd(¤Ù2‘OôŠÚ¨8·¬8µØ 2àDpIJ, +4Ah!¬MÂŽ”˂㑠äP—à %çð3rÇ@^™Í<ÁöŸôÜßþ˜óMCh>Lrê Dï(-ãür‹I’õ6Móžæ)Æ{³ÎX§æ5P/›Ñ›obS„®€L”Ã6+…I5gaf¡¹@ÁÚ^œ]7£WÚ íW¿1yÀp"L'84>b.Úï…Ÿq-\2"K®?¡õŒvjíÓhαtkòˆí‡Ùï>ÇÚµó®bp=>h}”;î (N—ݲóHkŽYe߯U¸\4›ž«©rÑO¡Ì,¼,¹5Ø,Á3È0¹UäLÁ_œ]83=ç:FîáÓY ª6Dªa@’[ÄhË0–Ne/U-5 ·Ë ¸ {sò„íO„Q\¢T+‚Hæ+Cd4Te2Ì1¿HUËñdåuMk;î©-ç™Zq‡fÖÜŠÙ^šÝ5–æ·M†)¦ç<Ñz&zßsª÷Ä'Z?ûAˆ§å’ +"<Å) +Ci9Wh+E1¿E*mƒ'Eæc¦ù$®5 <”1´T§Hø°Æ\ŽåúRÏX]ôªÆ?¯j»ÒªÖk³ð¹‘ß× \°_–ܘ Ó{T0ýãØµFâEöá—4÷4zo›âH«9ÿ +Ÿ2„ô\Ü ‰Ù0¿ö)>æ T€Ð`â t¢Èl¦^·+X}*I¼?fÅèY¬ÜŽJ%›¡³dó[’éûŠñ|'±c_Q†­-±å”X084Df 4HèŽbšÌWó$óY˜bö'ØRü¢KxBs :‹¯Ú óãÀÆÎP8\pˆÓ‰¬Erémˆäq>•±[p¨0­2XA"ið }=ü”Ú.ˆVh)Ê0z 3Œ§yŽ÷Zžtܛބ&è,‡Q)XÛEÜT•]"¡å¦Y’õÇ+øîóc΃ •Ùi‰v9¡…Ë‹íŒb'÷"O© H¨Xj¢âE±7¨˜¬†ëx(ˆ±ƒ5q^Í;ŽUlbxÜÀPÅ~Gnħ²p’ä¥S˜\g%E°¶¥X}$F/Y~Õa §Ô 0™z¡0­Æp¦Yn€¹€dZ¸$Ê“kÃÏÈ-â¼:ÃÁz±ÁT»ÔzY°5“œ£°ÈPË E/ËL¥(¦#£ð¾rʾ'qÏ쀴ð9¤sêm„Šéb®ä(Á/[ÑûŽå)«õ¨á´ßt¬†Õ®áxÌqš²9NóážÝ:ŒPê 6Fe¾)÷‹óûfãüµ¿o=(¯Ä’ß„V0Ì,Í%ÙYî/I£`øŒ"ˆÀñÑÀD¯¨@¦D”Y'†Iíç”)|ÀàèA{ @e PP±óx<Çãñx<Çãñx<Çãñx<Çãñx<Çãñx<Çãñx<Çãñx<Çãñx<Çãñx<Çãñx<Çãñx<Çãñx<÷ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÏûÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿçýÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ—hƒÅ¦‡PO®^žÆŒR·Ì\ÿÐ{š£(»÷§ºîË8ʲ (Kf‡R ï Ãw(uŒŽŠ‡mïxæGð¢G¼ÁSÄWÖ« ÙuÙë°×¶]HokÍÄïʬE0ë¬(]ûqšh¾‰žˆ­59at§t.€%îÙ¬×6]ŒÓË“iW à•¼©§ì®zeÓ½àÑ#ðxŠK8Ñj1ÞƒÑrWBñºjOXÛ‰£’9$Ù5惦õ#Âs~Åÿá«-‚î¹#G|ïÁšÝaµk>‹`ÙÑzÎù¬ã˜Øs…¯ûÖâçmËq¦÷A[²:#2¹§6}rÍxí¶ÝgRßqÜìXk6ø|Óq¨¡B‹À"e6Ç ÎDÙ½ÛH¿y‘dX›É1 Œ¢ñÔë{ŽŠ…ß §jÿN”Œ1zÛvžë8êõ}'½ºï^šc{‹Ò¼O9¦ãjšé¹)Ùo ë[žbvå—Û-‡³|ËH!¾ï0È\¡m°Á:CA’õ2Ìtœ‘ºžRÍzÀ¯´c˜î´ºg@³l:Ð1ŸE ®˜«4 7Rd'K°;ï™®‹àA´N€„s+„M—یNj¢ã¦Øwך6ç”ìn‰Æg«hð5Ý2HätÕ%b?€bÆÐeCèÍÿžn:ŸlÙ  tíJÕ~¡í\†›ž‹ìÚ)¸T¡m˜ébóAÓz¢žx]Ñ»iUûašåzë®S^Ñw,K°ƒ Ö…•(2¡˜]I}ÓY«c3HÔˆÕ3éJûà"®· ÝtæYzN·:ŽXj,†Ze#Éîš/šÆ?«q:ç™ßaK §8Td Ä1ß'5÷³\öÜÊÒkoìÖI†k¹•¢».ç™–ÑòìîU–á= ³—AGõëEjÞÌžë@ŠYt,Jl9å: qLnè,›Ñ´Âë²Aá;LTk­Åp MFÉŽÛð™ý?µÉPM7ÃDÓå8×v8O´/z¶‹1 ³kxébKÀÐɇ” ™´\ÊMG„Îe,©ð:–%ØÛ +b•ÙÎÍWQŠïÁ®µÖ0$¨d™áyÅe€™ˆM†TÚö_ˆ©š—ÁôlM†tj6€ŸWŸ í9 C)‘à×þœÊe¥ï:¿07œ¦Ú¥ž `k5ÀÏyö‡€iŠC€‚‰A$+fÂWu†œžñFé9O¢%—Àò4á©ã„˳ø–cp9ºgüžå¸d—bgJÎAôJSáûZûŽñÄæ\Fµ:f€åÚÎè׊F€atÍ÷€#FÕýbÝÿ(†¹¹zߊеßhKvç“%»SRÕþäønrÓ™Öô^©gnw¤ªû+ʰ}#FðÁ4ç äjm„7Ÿó4Ï ¥j9$ص²ûषßg»žk±ÃÅæ¡ ­ƒMÖ™ .5š&zó<óIÜDÁ;†]µ#•íÇfßuQmz®ωìÁ ´‹ƒ™mX±Ê¬ÊEÏ=·â=ŠRÌnRã•Ѹ )•¬Eè{FÑ näFW1ÄKqz™³`;‰S+íE1 ÍÃÕš-6¼,µåÕ,g;€"$û3ÄX¥‘Çû T=G çe˜fýð9·#Bãu4Ku?k€‰±«'±“Õ†rüêyÎ2]”,·EËá4Ûq7ÍõÞY…Ï mÇîš|ÆdÌD¿öŽaýÄNכЖãéIË¥b¿J²‹aŠõD«9Oý çÙ°| +¡Õ(ù…“+4’ᘯ¤¶éœÖwÝK·³t×M¯o»`4í‡!ü²c y2s ƒg졆Ke)¶ËDÁoÀ*9Ÿ²üÚYì|ï`Àù5ã½KrM'Ó$ëw¦äûOŠö÷¢h¹å4.ÃF¹¦ã ã„öÀ+ž°ÂôöŠÝKŽaöéwÿÂôêCìP¥¡Øéb›Aºç|J´O¨š„α(ɰÝdé…{i‚éBéºïÁæk-†/Ýÿžãh˜iºt-ÃG%×Aµg2M1ßN<)uûwœd|JòK÷(vÝ>„ãú“ŸCâ™Û¥h¾Íó[ß0j™ ÃtdüŽ—»»NÍì¤Ð±:–âŸÓ<ë§Ô¸Ürúö£î½ÚîÇÓr&nÀî%pÀê?§{N…(¶w½o0I4¿ˆGn·ÅÂçXŽcûÆÏ«ML×IÏ[¿ažý6Ì4]KÑ[/9zµá@Éy¤íÙŒ¢¬™B~`»§1 +)Lh`Šà,Dr¿)Ï`Nßv%Gp=›eû¥~ÈîŠÐv 1¸ t?/ͧQ®ãjšhÿK2½ÿŠé+Irj•ÓÕ$Íx—ãøŽâ¦k ÂFyEXc§Ìç‚ñéX£xEã{ëá²çžÖø &ûîCøÝ·èyñ$Cò‡éö;«p¿ôºî«BUX)Zsè€Áýšð;å»nF¹ž#!†÷ZŒÚC0¶hnFÚMsa¬«ríJðˆr±è=™ù¤âþp:îÓ4Ãì Æ.7iö¬—Q–ó$tºÜ6°\©aàÈÜôâoœbx˜¨•YÊ4j^ÒäR^Ãu$–¬'VÍ|a—Â&‹m…¯‹Þ²ó}Ò³ÿUË}½ö"WÛqÚžƒRç3‚Ï6] R¬Çi¢ã^ü¤Ò6xцg¤Ve7Ó.: ž•\§‰¾;«o9dTNç”Êë¦ÔxÝóºŽKiz¥]yÎ}éÖÜŸ‘vÛzÕ/]×Û­µc™/Óüº¯H¡Î<ü~ÐhŒÒǪZN(UË…½õ:Rd)É0Þ'MÇ9¯ì9'vÓßI^: nDŽ×ÛŠžBã(»ô5|·–õÃi»§¹¶ šã>Ä€Ù1‚¸ñJÓy¦ã¶Z¸]Qêž3)ŠõJŽÈ"±5_P2;1võ=*8nÆî£ Ã{&xßó¶3JÝu;ËøÝ +1N·‘ãŽkÁ3ëeœãûPë…^Åu䘾ó\Ïñ êº&>£×TÛÅö3̳ܚžëÉ’Ù1§è{…› q aT\G:¶»(Íw—à÷m¤& +®á„¨橌EÐ ®e®û¤èú/º¦ûœêüÊðÌg–ãŽÐ7v:·:ÕýœgZo½Êç°Ö¹Ý‹ž×털­d˜Þ·Ð ÓYè|é@g;. =çI„ݶ9\hЩ[.‰{&£mÇ•½t2_u2Qh0€WhLëY&:»#r•m˜aJw³Ì¦Ör¿ó_ÐP‘xAb‹À™*Ëq¦ù„ã>HÑ›7Á£bà óTæ†ëmE9ö+±e9 ¶ÝÝBãv?§ü®è,ÀÆŽ÷Î!†©-‚ç´6ñ£z×4Ï÷ë–M·¼¦énžg? ¯7:`¼L²M×´¶ïRxao.p¤È4x :‡µÐjžäºÇðë¶¡Ej>Á ¬ ¶‹œ/ü SÜyzé1Q¯šPº®'qÍêªÔ²;`Sn—bã[Šk:˜£z®(eû™zÈìšR¶Ü 06:b¸a³ìnƯÛà‘ó¼î›‰œ¯6:Ý7âÿ³uÏ)ý¸ãŒÓuÿ…XίôÒrBhÚîæIÖ¥è|TÚŒ9UràS[ʦûï'Á.µ(Eç/IíŽ×Ï™Žû9Óý–äØÞ²¯y ‘Í-ñŒÙ¡n¹àØÞ!{K9vë2M°Ý7-ë—Tw\N“ÍgRÛ~!®¼®)«’é!Á0ý…NØÛ Ø› aÖÉÑêl'*ÆÆ´²÷<[ø\V §Û¢ûGê:îÇà©ý#rÀê*ŠMd3U¬5–§WIñ w£,ãwœi~0Êž;AcåæŠhØ'Gî Ø›OjÖû•óCl8OããWŽ]8“¡]eȦÙó1 ,½AÜXÍcœd|Pº¦s±ã½?ùIOÙ’3°½7„YopŽÚƨøs+-&*ö6´–ï-É2Ÿ…N}ÂIÒB‰ÒÆïkI¦çtœé9•嗾춭ÑýcyorôÂuü°ÔHÜH‘}»oOkœnšeûŸÙ²½xÃ}ü¼Ô>z]8<0z‹Xý(f/!Ãuæ!ü²%±f{O›ß³…Ë¥k9 +QgNPÁ b ÎBŠ_ùã—Þωl¥ùÕ¶ä‚ë6Ó®ÛFÐk-ÃËÔüDÍÛÍ’=çÔrKQ#%çn™½4Ãõ—¤XbóIŒ_< ó{?ZÏþ&wÕ¶éž×öôڦÑŠñ#Ç/}DÍÎE‰æ§m:ªul”:ŸñÂ4ï;ˆ^ºœ+µ4Yk%n¼w¤ØOÓûqœfïÙ–³^Éd\¯c3ŠQ¸ F”æ ¼à!O@2d¾P#õžq–ïØ­»®šuß ¥ëº£¹DûK†j9˜$ZîGZ‚ +SÜÏ ÇyÖ¿0Çu¾.µžRÝ72Ïüš$Zn¤8ö‡à­1@Yf¸Š¡o¹¨ž4;iž—i–ß~xÌû¢µ\vÛž;VÍù:YjV¤È0ÈTÁ$Çø ,ÙŒÀ087Wh,Å2?'ù®;>å2|Î7 2Œ?)zá`’g¼ðéî[­d2lœä|L“ŒÿA×ý¡lÚ°Vy6›îS·h~R+¶+§h~Ðu´uÛý¤æ¹ 0Gn^X[3:&£;V'õ3F§ßkœã»Ï5îGâ‘Ë]·ë¾*¾ ¹ØxÌùœsjf7Ä#§+òqËI­r:¨µíçѺéb”ä>•¢5*Dk TŽØ0„]jOž±ÝÙ®±â; +³ëF¬šóPjÜÎÅÈžcÁ÷;˜9Š[Ù~[ ©ÆjžåzVËæ£,ÃÐX˜ß7`xßQÓ½ÛÑs5Ê5]Œà×~ó4ïyR2~Ë“æ3±ã|Ou\ 0z*´+Wi+ÈðEû‡Ó5]Œ`¹Å¶Ì‚ûĪ8ÎÉ×€Õ ƒ1a×ZÎ4|GjÁp0ŠYgl¦æ!½®µ›$™ß{®ëRŠå8 )Kr 4K휨ÏݾíV–`j&€XñŸfHæÛ$×s8`pV¦Æ:`z»$ÁpLB鸫v-ç¢,ó7Èl±mh³›ˆÛQ†kþË’œ—Yšñ¨»ß¬¾å’Qõ\ŒRÜ_aŠí[·èb¤Ö$ ÅAŽ[n4S/¸—§îæ)¶£d=NÝO9žù|p× +Œ€~M8aZÃ,Ëùcu-·Eûešå½K3|q†ïÁ)ÚߣŽõJ1:”KƯb»Œ“|ÿŽñ4Mt?YuÓ%©nº4í·yžû8N´ŸE˵,ÉýAp~…¯‹'v‡ñ ãз\õ:&ƒzËBáw'@±ßDΜ…©³ 6UeC°5â”='½¾eH±î;äÔm'R,çGˆç}ŒrM§Å®õ?§ØY‹kîBçª ÍÖZI‘œZãu6K³žÄWÚF0 ®ãØõöÂÃK§dØJáu9LñÝ$ÙeÛžéK@è< ¤”üÅ‘jŽrübKñ­ã N4aå@FË|ä—[ à[Œb×[0ºž+‘#æV2LãyMv¿]÷“Ð÷Ü0ÊîO¯n?œ®)•ÏùhçtÜì{®F¶‡Áö à·>Rßcœ`û/jÞ+õÌe õÄï˜X´Ÿgûž«^áwÑ©|N’M"Ã}Á؈Ôs~+èL®I]çgž`7ª6­7òiÇM©ct;Ív¿E)¶¿j±‘ÀÉR>Ízg•¬'á{‚ƒ$¹Òv¢`ýͳ‹‰j±‰,±ÔFô®Ò2Èh­Ep™"Kqr­ý¬Þ»Çò +ídÙÕVÃ$ïSŒb÷ä÷®5ã{zÖù©6mêqï©€ÆèˆS´¾e)®· Ëû9]¼KǼ®ýS-z”†í4Í2›uÇ%ý¼åp”b½!Hî D’Þ+vºÜjžå~ÒzößLÃê4T0ºñJæç@É|%¹2ìâ#´Á#¬ ©Q±ØD’\m>?eýñ:æw»ô<0¸À/ûIòë>Óüª©ßúÍôËæ“–ß”zæ~îÖÍgQŽí@œä!ZªÌbüÄì(Åpþ' çw¦ázôëv”Þý¸í~ϵßÅOìM…ŽîD˜æï0×qBh9Ÿ¤–õF,YÏÔ’ï똤žñ4O±¾Â ‘›Â +’{„8ÞÓ4ÁwÞT¬7a‚½É8Çt'šr$óa¿÷¿ržã‡Þ§Ó{#5×ÌšãX˜ßz0º¦;AzídÎ,‚[c5ѱ½æiΩe¾ËÓKOQ†ë5Îó>¦IΡj¹æ¹?Ãïqžç¸'XO¬¢çxÑs‹Sìn‚ßc”ë8 S># 9uÓ©0½wãÜ‹ X›‹`WÚÎ3ÝÏqšûÃ.œ +Ò¬_I–ï7O³~HEËQXÁzÀD‹U5E@°d/Xw¥šî•×Á¨©šk¢ýâ=×q0˲~…¾wÜd•Y`ab§Ð¹2;9†µ¥l½×ÌŽ5Û…Rô½iËF€¤rnDZ5Ö!ÄÇl÷¬@‹gX/Ls–åï³…Óµ×y%Ô­·‚÷»ŒØz+vÍ/JÓzœ¥_ò#çQÔ„­1§ð8eÙ¾¡†ª E(Æûžh¿pzîÿ¤ã}“ú¶£Váw?Úø]O|nKh.Œ¦û,Êq¾ÅHÞû”fýrªæW¯p¹ìU>ÇAôZ3I‚­m·ì=4KƳ,Çô£ù®B,çE„aö;Xk:̲^$¨uö@åG,$Ù¥–‚&éý`#™EÉ4ÌBÍRÜè­¯Íý¡—þ»zé)ά4B%vïúÕf”–ù0` âV’Ø!Än›4»Îý°óB?j¼u«Î—(ÃÔ”Tõ=ʧl2Ú@Œ!\K³k1víT æA0¶,:/å’ëÄ/¶7Ý·_ïïC„b}ˆš)³ 4Ms£V[ñJî×DÁyA¬4¾*´;Uj"C±{ËRÌWa‚ÑWq^¥ Ö6¬’óÏ+{®&θ©RÃ#eæØÅ6ó×¥Yu¾ªE×_œÞ³g˜mjÏ­è~ +2ŒåhÝ¢çŶ̞ó\!1}ëéëvÓ[ž^µ¥Wíh=ßyO´~„NÙ§8 á×Î3¬¯‘r¥ÙX¹Æv¬_4inÄèõ62ÀÁZƒ  · J¡™<·Ú„Øð›[®ëPÁn8R17ß­×aÂé`’é>ÇË DÍ|¥)fçIÍþ(¹ObƒSYzßhžâ; X[HQŒ¬Ž÷C)[Ž9›tÆïDÔxá@Ì|ë?3ÿ÷„Ë@Avë%ů6åNDùå&‚ìÂÙ0Ùs9ËöÝŠ›°·¾0}¦yæÇ8Çy§šŒ®û4Íóþ…OŒŽ!F+ DXÞË(×r2J´?H5ûˆ€Åð‚95BÓÏ)~ù¼å{Èh|Ƴ÷‘³ufÁäÇ­ÎëFŠ`n`Ø\–Ø.Á/\T—Ó^ÇêšÓøÜϵ¬9}ï“Ó÷žË6€$Lí"ÔI âXõaʼnìCKÓœDVNÏ~'Ÿy] +ïûdçqJ=ï>,ÍÅŽ÷ …¨î‹Óû8e}Œ18«.'„¢ñ&GoÛ\»Mûc˜_p$rªÒ8|ã½I±ìßy¢ç„xÞrI=î}Ìr 狦ñ@[ø•ê¶ :Çù›%Y/"ß[¹Ö‚Ós~Šm÷;ŽTd/̯۵J&#JËFÛtD*ZŽ-û7z\l´8½]”_;ŽÙƒM/V¸a=(¹ÓªöK¯ì¹gÜо‡¹Ô<èLÉ‹Õ0Þ† ÆOñS(ùÃ$Áum|nËeÇ §å¼É°ë&b'ËLUãÁ†Ìd §èº!ÖZŒó‹§YžãXØxë1€àûÚŽ+RÙþ'Ø„¶ý¼&[îÅo¬7¡Ó­‡¨‰:»àò4ÆÂ×åÖ“–ý8RñžÅ0+ Eùå†ó,ï?Š^8‘£—Ž"ˆ…¶²üÖUžamÈkY/”¢ý,Ì/ÞFyö» Í~äx/‚ s“q‚ßH’ai,†Zc0Oïšvëæ ­å:Mó gÔJ«YŽñÀª\¯šU¼bÍu¬ai+ϰ³›éwͨ¿É<Ám D.4˜¤˜=% æg˜q›@Cd\J¿D»j.O17œ)ØÎÒ»_ˆqš_X)J§N¡4µÚvªß7âuL7r»lAF_¸mZ÷5M4¿ÃçõbÆi,æÆçDÉ|à=wó4÷ažbô™è—bk[Q~í7Òp(Mû‡Ñ7]2:6f¸Ž«1ÆïbŽïº£:nÃŒÕY§w ß×ZJ3 îf +®ï@Ó|”"y/‚¦kͦÃ0ÉúŽ![Iñ 'œ¦÷ÊêzE׉ ÁüŽ ™ß$ó[ø¾xœ§¹oÂ{s:Ñfh§m6Ý|“¤˜[ #Z1ŒÍ†‰ÞK¥ó¹ªŸ³AèØbÔJ‹VÙsPÜ6m}Éð˶b§Ë&ƒlïRyÜQ*‹Vås´0½7\žäÃ#™_Œ¶ån¦_¶hø­$Ùe{Q’í7L7Ÿ{5³sJáth¶Ø\†ì9-5­VëÜ.j}û£ÖvôÊö÷¢ç:OZn³jëG‚Weð„/¸@•é(ÛwÃ'|ÆPÊ®{^Ù}äRüFA…ì%>ÒÊé0°\¥uxñz –ý=åÛ9M÷¯Yø\Ô¯+ñsŠßH»kC¨z¯b§Š †pKÍeÞƒ½úÂn¥æç4¿w$J¨NàhMŒRjbUlO9‚Á yš_`2¤uÖÂ×…ƒñ ß±Zu]²šŽÛašõP«Y¯å®åH|^ú«³4]m^¶ØNätéÊ(œŽˆG~çÒƒSAlr?µg=Vn‡ŒÎï^”é~2~‡³”ßíLÉx'V½wQ–ï$Å1=û‡~ÎtB©Ùï ãK’Þû«45Uf7L0¾‰E÷I¡Ø,ϰ²™'®Ä(ÆØÁ2;¡óõ¦&k-BŠÓøtÏ!«k?ÊRì …k E ¦“ ¿o&J±7˜'¸~ãW˜`8á4§bßq;Ò±]EÐj>‚'õIr™É<Ãn¼©ÙŽ×?Œ^k%É.[‹Æk·í9dÏáFjŽâWeÖaÜZ“yŠó$ǯÝï*íÎTÙI² §²üÖ[ ¹ÖDø¨È<ˆ]7e×M§*gýßX1½æi®?¯n¹­ömG¤–åF”`o#É.܉ò{1zí1Я½wÓ‹Üî›’Æ·4Ãx˜æ8ÿ‹®ý=[ù]R\ƲʦSY‚í#G0]d¾[p±Bã€åiN(5×¹†­a}Êv¬Ï8ßä‚ñ8Ô/㸥¢752üº-¯kÿvû¶ÛnÛàIËt3Ls\š–»q¢ãD„a|Šq~éD°8®{páùr!l: §é<П»Ižó*Æ®‹1l§^ásZn;îÈç=÷kŠáb½Î:‚a·æ[ŽZ-«û¹ªÉ˜RËê†Óô~ç©Þ7qÑ Õ£F€$ÎC©%ϊזÒ÷¾J-›µ–Ùq«h°Q’ñhˆÂFZ3;a“-ç1ô• ½l)D1~eHæK©cvF9uû¹[ø\GÐkm„ÖаŒ?>ÇîžR²ô”f¾JqŒ79Žó!Ç.}‡Öví!çy×0·¥v ÔÓö;«è~K2Œ§q‚í:Í0þÃŽÙ‡±K­‡gG¼‚ï!J®5Dª²Ä.¶;b{;byšey¢ìjã &»å«~ÏÔu^DM–¬3àx\×½Ðñæ[æ>MÓ¼_Ôsy~Ù0Óqh¸Ø>à`¥Á~ï.xbü˜¯µ8`kG꺢ô2;RÓt¤¹²jîsÃè'tÂÞNètß2´l­aX±"»y’éAjßâôÒo¤âºKÓ[÷víT²Ø8@¹Zãà„* ƒ’¤7Íò{RÏ}™gØþò«Ÿ,»ô?.¶@1»±¬7AŽëƪzÿ¼²ýÉ+šÿ"{“‘‚Áu±Ö6è¹+Ô­+Ü0ÅWµÎh¢bo=é™_óëa bt^5 ·ÜŽïHmØžCýÖw¦ã{ñZ¾ó¢ã| +­µ7Sc,ŒUc.N¯Û’+ $iE¦åR«™Š½ÍHÅÜp¦a¸¥•Ýw^Ù}¨NGZ¾×<ÃwâUlrÉw`U|WI†ñÒ'”´jA*/ðaå ‚s$¾RÍfÀ Ù~’`¸NSDï©O4l©ewϪYõÖ'Ô™Uˆ^6­ÕL†/ªîó¤e{PªÆ7«î=RÊÞ Ÿq9¤4N×s®ã:†bp<©X×И¿©‡lÎ×TïW’aú +²ŒwQ–ñ0J1ÜPv‡¢gU¦áFjLiÓ½ˆârYëÜ®èlϽ°ÑJƒY†ïLëzßÃ}ûƒzÎ÷;?_%†Od”§zMÃY«crajLNÚÍ“ŒbÙr"ɰ6™'ø>¬’ùN­Y®éå«Øá¢‹¸©R3±£ÕÆ¢hE´‚Õ‚Ô1ÜɲÛÝžýE?ìA<ðô fº:`õ=±¼‰0ú 3ío9¢åZøÀÞXŽã¼Ï ¿:ç3Nˆj?pl?N×q'Ì®4¢ž¶= +ÞGIváNèt­Í×~¦4n7Œºçlšé>“œ÷ †Á…Åè¼§ºŸ¢ÇõÖæªÃIÔÌ®rÇ•Åô;Qrœ V‰ß™ cÚ‡Ÿ“<ÄŽ•ŒŸ×®b4ËÉ0Ñq9R1>GJο<»ôçÖZÐ*Ök2S†õÈüAgêlCøåÆ¢,ßWè} ŸVÇ‘‹¤ÉµCýjs™rµu ·Ö^ ÁÚLa8j¶íofÓ~à6¬^"­2 Yn¥¹^™èEÉKü®Ì`»Ðt¦á7â•\WbÏøöëvSc{v×Fü¤ä"Ë.5)ØZ¯®7±é~ÎÑ-G’Ó}K!suÆqÓÄ®JÓz«xÊл&¥’Õ1eÝ  \Ž à‹UÚˆ¤w*¶8WhÏhœŽ‰‹6€–e—ÚK”kŒÛƒ®ÿpÛzn.Wâ3÷[ðÂê¿°úq|—bÑv·©(Áo¾¦Zï”ÂãžT¸Üï¹æ?«k¾‰Ò+E±jÌ(üÆí»ù gû Ò¬g!·³dÏ)§ï9çµg£œj/ðAd§ÄŽ•3èëD„~óIÅm½éØ7à ©ç=óºÖ¯b7>¥q.>[Ó+\_Ä#¯3NÇù 5Lï BÚ&n¶ÖJŠâ?f» “«Œ +†Ûq†ïÄ'º_|Æe|ˆáb‹ÁóÖ{δ?ŠM÷¹J…ßùšì:e8Ÿbüzû ãÔÞ‚Û^±Ô8Ä,½9 ü„Q€Yh ;_t¾.·–å÷.ÃëGbpÍkºoÔ·k^ÍsfšÈLàd¹½Øá¢oôÀî/Ï.ý¨ýº¹4»ÒR«äFCf~;îã0Ç|’â7/¢F‹mã×Å ÁûbÔ}'Ã,ïS”_¸aÔ=‡"ÃoðºØRìtßDà|­í@Íü Uœ×rÓy.OZ_ƒÃ’ñM©\†Ð©Žk9Ší'Ær|qóõÆâ×}cVÛu)Ê0< òËž%û‹Öó\‹Ü÷~Ý7‚]ö&Dl 6TrÇ­4@©¹Ë2LZÙuD)ú.Æïª­NR[äÖ£ØÅ¢5–#ã;€^o`¤Ê6xVi7Ð0|N”̧išõ>°½ƒMœˆ®78VhD.¶–èWý…1‹M䨥·,Éøâ”‡ëUžZl'†KðG+³—h˜› £Õœ&øßÕ•µÜ²ÛGO*>Ad{¶ ƒ E;·tßaÓೕ×åH½Ò6ðŒÈ,Ë/4'ž´Xë¼NFiÆ—ØÑBKáëJ[IŽí8Ð2¾‡ËîÛL¿k@ì7­§g籚 àDÞ¿ØájÓ£Ô&“¤Nc–Ij‘)¹`i.TªwJTk¼†×ˆÕsFiÖ‡ qšcpYj¨‘z§ÃÎxâr'Ì«³E&7Lm¨\ÓÁÏr&Ç/Ç)¶ã8Ëz"X[ÎӬϒí$HïÛ ß÷ã÷uóAÏü›hØnÔzߢ=àºÊS«l™Ãõô¤÷>j¸.bôÒ!ŒD‘ˆÑb3!’ù4Í3¿'+§Óbßq0„Zf$G/¶¡žöRšö“ÅîJœÊ$¤@™u˜¹Zëp35÷Q¿nzEç ¼¢3S*ÎƇ¹Þ0@ÁÌš „òj‚ITÙ +`W›°¶#©áú + U|ÆÙµ6Ŧã¨ÖøŒ°»)†RJ¶Þ6Tg'€YhÜŸ²þÅ ÖÖQ k1~éE©Úoã$óGŽbw£˜ÝÃØe‹aší1Æ3ÿÁ )‡™¥÷ s¬×qš÷@izÎD(öŸ°érû‚µ³á:vÛö“ðÄ성18QRwÅu•ã™Ïc®çxÏsœŽTÜoLRsÈêîHÃt`XýŸ³„$7Ñ»÷pµƒÈõ#{K‰n¡5µe{u›ö‹ü´Üà@ŒzÀÅtËEðÊlæ ¾Ÿ »u©F +סÌRñ~µ5¹_¼Š›(ù!Cá +@˜Öœt½ax ÃKh±R3ÑÛbù‚ÙYªXl8×/·h9ß!fê ‰[îxW/-Gê“f—šI³kmƒ¸¥†’ ×M’aõ:Iq -Yp„®Xƒšò…%6гk +Ö¦3ã}Rt‹r¼¯^ásÄi¸N”Ží.I1JmO񨃯£3úIãIðžÒ"Ãñö:6­ÂûEçÙ^“×UìP¥Ux)’o˜¡R+~Ý€Í8ÇNØîBë‘RöÝð¹Žc1Ší!D°7TŽÚ^Ü%xPs4\ßfåu7ϲ>%)VŸQžùEÚyÝ×ì.:uËùšhþ…&4Èðê]Ä×+§í~(2bÙs<Ç‘Ãz*•¬<æynE/ªŒ˜jÉëS3ÑŠÙ`ìtÛ\à`­Ãz^S=Ç£}ÏÐi†Ý?è µW§Æ°Ù¶ÿ†YÖ›ða¥}¸‰" QCEÆüÖGŠß{Ž“¼ïÀÄÊ5È2 +FÙm{Vãt,t¼Ú"€¡õjð ƒìj JÏù)¶íWNÁõ3?`Žaœ›…×eËd@§ï¹‘á\ Ѽ7JÛqD*ZÏÓæƒ©äp”Ì)‚Wó&YŸãûCzSi^zÀh´^ X¸d 3Hk˜¦X=†¹•–áfÉMRìÒ_e¿ŒÑ<ƒ»·©ÐB¼üŒ#øˆVmÆöèv¼/A†ó fºÞ0t¥5¤0ÉSð¸ÞDŽ`t¡t¼ÿ8zµù¤d<ÌÓ çâX%_Q¤’‡»ÔZü°ÌHboA¨ÛO|ÊéZüÀÜ„Öo Ý' +*ãW˜Þ74aôF È0¬D‘™$»pCª9/2üÚAäh©¥,»mÏíy¬ªý5OqÞO‹íÍ“ !Ô†RÊÝ»vá^¿àLŒá;M³Ì/I†åKø¨Üœ\Éf~È#M®³"V\§vßR «ÐX«Òv®^nBHÝûÔ§{ï ƒÔ¦@„û5áËZ#Q‚Ño°\kCm—.Âf‰]AÅ|"Çkn|Î0s\€N—þƒ Ó¨º´ß£i>H1Ì-ÇYÆÏ »t:Sfp’Ò5Õ.3š*רÌÌ ˆûæûlÛqAiyoçO’]¼ ¬6 +(Djâ³K§0#46A†±E¯í8fU·BôÚaèd±©Ð¹Z‹DÖ°b4ö=Ïx˜¥øâ&+í例脹ñšjÿñ¹î§»ôŸÖ…±A(öOP™>㯑¿j/v¬È^a<’ºŽKVÑ}d5Œ÷`CTž äIÕ‚•VÉu 5Ið +8š]¤ø%IÀ±¬‚@b´V¡Fï=Ïq$jx rŠÄr¤`úqkM2"Û²/˜[F®b<+¶¡UÌñ5Í=È‘MžVsÞT|GacÅÆÁHP‚I:…Ï«CöÖ‹’õ+N/· ¾ ² +t í% ö¦¢ÆIþAÇ©Ìä®×,ÙýÁ0·"ö[/"ßg¢ZeJ­yòоÛ4Ñþ5\mR˜ä j¶Ö@Üh¥e°¡»y~ë¾ê×~ÒüZƒq~Ùn˜j¿†(4 T$© ÄPF…È1bw½Þ~V0ý†Ú¥–‚8U6¢WÅ&‚åB‡)­ÃKÑÄ û…Ñ +íò*-†Ê¥fê2i‘ádµÎJ†\k*r¸Þ@äP±yÀq*k1œ2[‰b©ÅT»Ô|\/3%PØYjõ¼÷0Í/4™f˜.ŒžõC(Ú¯£|Ëø‚ñ0K0>1k ƒ.X¦æFÝžù*K/·*Fë +,Iñ3Ti"A¯ÝFiÎ3«n?GpëŒNTÜ÷\ËÁø}µ¥ØéJëèá@ÐL‘©Åzãxß‹ŠíXŸqÑ‹ Å8~»^ásÅçzŽE(vWq3U&Â&©}!©}A¦é²üZky‚±eÀ² ËPST†!´2ûr½…ÀÙzë “¥¦"'‹mB —üø´~i~µM¨!:_ ‚õÂða±qèdÑMÜL¹m µì*Ë®{#U1:–V&Ï)x̳ûÖAË’\‚HQ{…LÕY +r¬¿y’ù5O°žDÒ›‚Md©Åæ¡æi, ³‹VÛŠö7¥ò;ä8O‚ÌJ+9b¡©^•m±Æœ\2 3|çð25¶ÈѺ„MXÅŽ—› +ךJ²[Oñ³JS!œŠ«å7¤Ô .9 À¤8øŠ00*o»Ü|Ö/ý„yE梘e¶¢ë[©è Dǘà9]@ÂvQ¬JëX^¥y8©ÆD¢Sî“êT[ØÃuvå¦ãRˆß¾Óoͯ(?i¼%øÇËL¸Kû93û9 +K£‰n±…ô¦ÎL̽OèP,»àTš]m.L°=çyÖûhç2†Ó²¿„ï ƒ‰Q{KÓ;E¯«mcV—qŠ÷'É®=ñë-zîÇ4É}=°:˜«³:^l2Nq]™-ߥÛ3~ÅùÅvµšÍqÉúEBe:NÕë¬FêEÛZÉæhŠè¼ÇÖÇWš l¶åp’_m@[p½Ê#F'Yv¹(ÅmT*œÏtfWõCV§Í²ûÅèÚ?œªãJœXg/ש8HkÎBÅ’Ã@»l@)9¥²ãˆ´ó;fTn÷cºçDŽ]·”fZVËöÏ,Áp"G/PJÎ#¥æ¼RjÖ+¥ç>/:Ϋð9½'Øü|¥Y°ÙÏ»"Çi‹ä^€lÅp”Ü3M¯5£žxÜH²ë ˆëŽ[â«cNáu/za».µ 4Oò ZŽÚ*~UfE*8ƒfû•ð½RJ½nÍizî†)î§Ãè®4™eÙžÓ<ãwœâ;J2kmÂÌy¥n3ºšÝ]«ë9‰+3ÞW[ ˜‰.´dù>½¾éPäl±q€E†á%j eè׫‡ÅðG*ÛÎ Ç@ŒžÐŠà‘ø†ê}I†Á•ða©ÀÉRÛðuÁ¡àa¹•Åð!r Æ*Xé « 6½‹Ø1Ÿ$øíK 1ŠW¢%_ ²5WPÂcöP#5V¤ž÷?k¿ ßѵÿIÖo˜ar›èe©m˜™B‹ C;†Ðƒ »Þ@†apÂîÛÛžë5½ö)² \1 +B°] 2Qs¼®µiø¸õ²•8¹ÎZœ`k6Ï0ÞäÖ·‚ÕIìd­A@ J?09Š“ÈsZÕ}¦_AŠV ÅïÉ b”"s1¤J ±cuÆ‚·¥fA*N"ô¾M³fº7Id <»`´â£܇!öD( +B”UÌ1è(µO”ZhÇ«¹ïÂÇGÁˆVŒA +ÏXƒÍÓ˜ÞÙŠ —ɱˆ²Ä*ûPBÁyV¯¶kÐ7Ü‚áCèT©m€òd¦aæjíE° ‡‚à ¥l}L\/irµùª`|HÑ‹OÁëê;Ìxá9Ôdµ‰à]©¡f©Ñ4Íxç9³çOŒ]8¦X}ÆIÞ‹(·Ú` ©Ì<”YhOê»oÃ4Ñ ÃØ`³Ê¦Ø³ç4Û;àT‘u°‘š¿Íw+ÚŒë4>…¦÷X*[ÎMO˜„ ’kuï…²ñ>ŠqL‡áûZû Ó‡Áû‚ƒa’ý Î+4œìY +£ÑƒjLT«ÌÉÓ{Ôp[Hq+­ƒŒ\ÅŽW›H\NÑy!µëö" ÅÞ±z϶ÛvßUóG„^¸6Tf¸µ#q£!Dêõƒ–ópœÚ tšÚ1Ìp¾ÇlË a’û,ÊnýD F?Izë1Ï.œz¯åžó$|Qo£—Ú“Ú–>Õþ™æXï›’ó>)øŽ¢¥§[ae»EÝší!G0{ à×ÝD ÖÈ0Ì.t–÷JhY½šù+†Nðd~¾5ÉoÏu~G!&i­Á¹ƒ’$µŠ¯·á˜|®ãªWùI2¬M…PêmͪãžSôœÉÐ{ï0c…vÁEjLD(ÎçDÍr¾k·žä†Á­ø •/èy•WôþHeËÉ,¿x 2Lób¤Ò<ØX­¡àiµE³è¸"U|…/ +óK+NÍú–¤w?RôîSŽå~qê–›ò˜ùWHfü”Ñ9ï"X%§@ƒd¦~íÆë8Æùí—V­¡Z©µv¹‰½p\®{n%ùÕV‚gUV‚&ë,†Ðëí:æ£$¿weØÛ +b“[C/ìå*;1zë pdÉTŒØnªÎ6€]o-Ë0ÿ&:æó¢æþH±K R #dŠWh™r1Ðtò€35&2ç[è8£”-ç²ôæ#ÈÅ;è4ÁÔqž”ΰ@ÐE°ÈÃ8µFCõºÛPÁî3T0û-­´=°5bùÎc®ïVð´è(v¬ÖJŠbx 1Ch:Ef`\¿q’÷!v¨Ì8ä<ÅSø°ÒJŒ_|ŽTìþ³v±ÍL±ÎB‘Ò"ˬ²½ª³ 4NpÀ-²eXš 4L/RÓübô¬‡VÓ~B0:ʦ“NÍ ð¡åjMƒT/,ª]*xVe0Mqž(MïxÆêl˜]8 <ŠK,È®³#5gâ Ó˜¹Jûø}ázMwÌRLR»nT­x¿"G áåÈLc\÷oŽr»“ߨÃÆ‰,†ŽFpé}b§(rœ‚+±f= â[ŠŸVZŒ`ÖH±ËîAÄz+Ifµñ¨];+R«2×'ÞÔ Î‚ôZÓ@ÓD6ÇjMÅXæ[­cwU®¹Ï¶g¾õD§÷Š`”›fêÕ6SÝj«‘zï'È/{ Ÿ”ZŠÖ sŒo^ÓûF¬2¤Ú͓̿ÐtÞPÃäÁÃ:CñÓZÓÀ…H­A ÷‹’ÜBÓy†õ”P»"zSfF/¸¥>ÅŽUÚŠàšIòkgIšûÄ/;LÓ«1„¾@ãó¥‘ví4ÏpÿäÞ»ðÑGè`­•àu½mÃÜ‚ÒtßÃΓ ¢•šKìnÂ×t"ÇGm"§(>'iÞáI~AKÄ85†²ÔbãFH­'©-‚ôjÛ‰Š÷+K.»Š¡TÛŠ ¯ÒìÚ;Ž^l×m:®£…vÉ AHLHÐDÍ•ZŠ_V›ˆŸT™Ô['a~­©e{JÞ‹È‘:³€dh=yÄ• ,7 TŽÚ'zVf~Kð¤—NBüæcÁèÁ/8™(ØØQŠ~ûÑÂóVëúÞ[žó˜,ÅUØT1¥p¹š$šŠ¡y£(Ñ›"“1†Õ‹Ð´ÿÇ4ãO·Y~S9’Ý~Ð5?ÇYΛÁv 6–Yx0¹Lè8Á<»õ!Vl¯r•…h±RU q2å8¿n(bÒ”p¿nœà-x`ô/Pf/pªÒ@†_8å—Û„–ª×‹(u2úŽ›9žå,œµ/ØprE@:_°y2kAœ2Ë‘~í$Z‚¾TxÀJ_m5O±¾EùÕ{˜I‚sP’›ÐtF¤*‹‘z±IX¡‚=ðB˜"§IL¬žë;Ó°½'ã‰Pñ>DÊ ƒ‹RÜ¥XæÏÏý"Hë 1z¾ L„Æîµ§£ôÂé4ÅàDŽ[mNª^À§œ‘Jîci2ãCuÖá ßq˜í9*¶-WÕ¢åxSo„ŽÒ{„ª­ŒÎï\Œl:-Tl ˜PbMRÛ@Ó_YvéÕ­º_œšù$zXh Ư¶^|~`òô å©ÅAçÇìa|‚¥VpèWšˆ©1b˜}È<ÇE§ñS*ÜNDÇ(}‚Ej£‡„Qf©1¯æ<´Kß8V™ÕD¿ôœ'øNBçèBgHí¢%)‚±±f©(ÃÜdœ`=H¬dŽÎ&J/5ß4Ìï€CµfâwµVÂìjë8F‘M0bd2ij©¹à@ä\±i ™:sÔbÛ–ý8Íô +œ÷MË~#•Y %ÓçÊ÷˜ÕÖ1ìÖG„ß| Ž% ¶×8Ëøc5Ýÿ\Š,­Ð^š_u L¬`Püšx1»`¤M!¦þAçiLF +V9V¡q0C´6in©¹<»t¦Xݹå¶&híqÔzc1Ìjû0vá®Â5Ÿ cÔ~`"¤®pÂ$'QsµŒ’õ;M¯·<˜D5€@±°b•zI~éd”ÞRxаµ30ùiW`9’—Å~ Ò+:à¨ÑpÓÓ 4®ÐÒÖ@DÚŠd'Cgb×þ’$÷yÑpÞÄKL‚f Sl÷~ÕAÐ<•¨y"ë@„(žÁŠmšÂIS RÌÏA‚Ñ-YJY€Bå"Qñûº‡È‘Z[á«R;3E–¥ÊLƒ VÚÌrÌon娄AÇ,D/(œB¸çY½ö¬XïÒÜZÑ›³nÑrZ´S¬þJnÈ´K‚#Tˆ$v:ŽÓò¤åd–c} _VˆÑË6rìJÛ& æ`Æ*¶Á WìâæÃ$ëm ãýˆ2 îÁ‹µ ²”r+¹à·£ö»— cê`ù•ÁJ6|7äNa.Å™Üî}ÃW¥VBKÍæIÞ ½àb·Ú8Ø<‘i°”±#E¶ÂHEÆR½šïp­ÔH•Ü-Э3âuìÑK‚w¸ ÀAB·b± ^¥©0»ô¥÷>áeh½ƈbÔ¢»8³ì/ŠRl#v Ì6Ô ±5hÑŠ!ÄüŒq¨ß7¡Öš¨¹+3 ++BèE­¶Ä,7‘c×Þ£‚û"xJdtŒÞÀª˜~C8g‡Öü ¨|FjÌÂR|‚ Q»y•&¼‚õ1–Vf.ѯ7˜&˜bôêEìX±±n¹‘$»ve—ÛŽ”¬'Yz½µ0V¥¥øQ¡™Ëø .Pó8Zj8Iv\Òù¶ÑüdóŒÏI–ëRŠÈ)Vz¼¼­´ +8ŒÎ˜4±Yˆb;P §{FÇfH¥d3ŽP9K1\÷ “¤bµÈ¢Ôs>F¯*îᆉmbEÈ|ÁãíäzJË}¬U]"l2‹@Åhá+ÖÒì¾}½Þ.”½+À zsx©jã ~Á%­f½5«î£ ½ô 6HltlÏy’ó%zYk`ä°µ30zcˆ‰Z;1~µè)©+à™E_l!Do]ƒ‹’{¨'Ù/Ž£– ^SY‹^ÔX +`™)Cæ àÖZoÞû¤e9˜#xÿ‘3eöá³J;óôŽ@Á+Bcàñ;jÀcÈÄ¡†iý¢×¥fRôÖSŒ^tcX¥ØÕ6b‡)Â×ω‚í¨ø¨0BˆEÁ‹ìLׄ‹Ä —§YžóàÂ;€ÂŠ?@®µT<Ÿ€ÃAŠe—†§²:av–äØ/³,ÏUÐGï€ 7j€ÀBä,©9Ü0É+Ð,Y "äÞ€å(NB³õ¬íJÄ\½Äàø5‘‘Ôr?dG n +TÚƒ=ì Pät­%é9›Áê„,© œ8¡>ŒWsÁ§9Ÿr™£·…™¤±Lðš ã3RŒrû¦^n'€Ck 7Jî\˜âfšÆHŸÎxÕ+8œéÝ…‹£øÅvåóY—ÜzE周ÔFñŠ ¯ĩÎÐZ„+C)4^qlZÏL½Ö8UinŠÒpŽÐ*€Ue.‚Xl-ŽOc3Q°7”dW›(Õ°˜)XýE° m)øÊ,R ©$ðhv9ÐÁ욀 >qn¡} £äTzº'H¯³a5ì7QrÑIð¢Ð.èà_@Â#>!„2»¡†Õ~Öq$tžÒ&Ä ¹7ˆ]k-Ï0ú +¡šš!µ¥÷ÆPëL¤¹UÆ»zá:ŽVk~Qcl–à$zTg"H°º ô«7^Éû(ø.’kÓ‰Žó+I1þDÙ­'­h¿sœ·àâ4×`2U–‚Ì ÅM˜Û’-'­ÎgÄ(Åx½.5Ÿ“|ÒŽÕÑ$Óz>079\lAò݆™æëLÁÖÛ.Û ÂÉu+k,Ø$›1"† ŽÊϺ ½Á O;D/Hà4Y@"ÊÑ_³ÌŠÐ¸ cºÅLÖ‰™§y‹#t‡m8‹viUf¬Žß8d¶]¸ØéIÑÓZ+¡CÕVBgªMƒË<‚¢U$R.¾*²hY¿ "Ò-|C fz¾$p”Ú$|Sh(€Kó8Bæ D’P”<¯N–[j?j·~‚Çô¶“䮢ohJ{ »t—%yßñ£:£@N,l¸Å-47SfF€Ô ¬ÈŠ%bWP´–ð2äŽQ¬Z£q~óhŠÜ\~Ò*Æ®}d(ægx9zs ²c bKˆéA{ÈBÓ8·ÔL]n€<½Vì,Éa–_÷—%ØŸâÆŠV› Þ×}‚H²JBIHƒ ð„#³I‹ËÍ…¯ËøuoAzí:ʯ^B ¦$^¨+Ç(øŠ«µ :¶ãb ±Eˆ,‘‘ Ñª_x‰bë`fHÎq„b»À™õÀ +¡¨÷+ŽU“ô$[–ÐÂd¦áÅÉ CK‘¦ fwQãc>EK–/éüFï f*-ƒ”£·„¢õ ŸÚ ¡ÖÛŒS¼×izÁI°‚çGOK2]bc°¢-'C¹•ÀƱ*'zH¬à y¨*‡¯Î6Hfe€B‚aÄ+s䆰1”’`#çGƒ©…¢t,=äiÝ|Ì­ +GçÄ­7<'5^€à° ½=ì@‘­øAÍ5È‘7„VehŠÜ´ ±+8 ZSÀBû@2„F1|2›¡vÑ‘Xò¾“©W uë£YE6— ¢ 'àâ(µÀ‹%„–#4 ¢ÕØMõËÍ' A¦ +EÂä2+QsäÎâSîÃ$Üj3Izí F±ºLs¬ß`óTæâôÞ}Ó±¾ÄŒÑ¹E¦¤º¿ÃTÇy»ô ÷ƒFßr±Ñ4Çyª ¸ÜrzÆŸØÉ;ÁãJKÁ ƒC!ž÷Ø«\FÚ?”ösø¾Þ,È,¹gŽdü3Š6(JðT„Ö*\Þ6Oi"dÆ<¼ É=Ø,És aü‡¬ÍËx!£Õ¶@Šê÷2.¢_¬`rY`b§8»Ölœ_7 É% JÌL[Šà|#Uq(Õ0!ÕoÓ05Jl—¥×Žã4û€¡E +Ї…¹e¦‡éAÈ–ü@ÇÒ 9L€`ÑV@¬2Qzµ‘±Ò(Ø"u abƒ½ÞTü¤ÎZ«ÒJÈ0ÉGÐ8•=¡z%ÀpÁGkXOgI® +º„Ë™–©5VŽâlä)r”æd”âh˜æ+É/úM .ƒ ‘y‹ZLÚBÍÏZ‚•éXDÏȽŒ"{Qt’[È!*ÿ®_m>(W[‡™£¶…¦ù—¨4 1Yu@©6%” +¡ÕYJ2ì-»]Ï¡4½è)v Î.° ±'¨ ­KÜl½ÅøiÁ}‘äÐ!¬zš­™…°Inó ïc˜ä¹;\ö >¶êNð¢.ˆ!œ’ðr$Aã4¦‚ÇEw Å1+‚+8DŽÕÛ›*61Ne l Èdœ^=ˆ‰lB +3ëÅQjîâ§ÅÖAŒ”ÙŽ× Q‹ÅÙE1fÁ}µÜHØ8‘U#z•¡åºEBÈ-#àbGÉæ-?ä)Dì#Ö¯"u + Ô˜–ª×¬V^“{)Ø h‚8‘ãóGó* ÛÎÙ µËnBǽÀ ãŠ^”Fqj­‚“¬šŽ©¸<ç +DÜ)~Yl&Ì/:H’Ë ƒ– õ›§²;Xm)x\ôÁ0<‹âÔZ ä”Z ŒA…KÎPæPb¡U°jS°rc°’ýNxá‚;ì4ÁS§Æ<–UgÌL½0QÁNÁ0„2 p©?e ,QeE±;K’¼QŠó#p¾ð6ÐqG:æ· AR;ðaæJ|®ùHxÂl¸1‚à…<¡eÊŒ%Ù¥qÙ|qQˆïI ©Ñ·)GœïÐù²› ‘B;QCµ6!¥Jí}kÛ=©éþ%Ô¯3Id§4Î?FÛV¨µ¥ |Ê)dc;a)HÊNˆ0 ‚ ‚ B ¬IFøxmC¤Ä(Õ‚;ÊÉ0šv:~  »1FÓ™Áhº™ž¦y)/F +3I·í§“d?.VÈɼ))ÍŸ˜R¹„Œîœ“ÑPD%/@¦PËëåHXå*@Áä*†Eâ*2v_|¹Nh +x¼ _ý‡gP…ãÜASŒ¬\>‘ÔVˆÞQÏÅ:-ìì@ODÚoÅPs‚Û ¶[°'"]‡íت‚žõ2¼ᆠµ2ÐßÀÞD[ÛípW{3j˸=„MÜJ°m½é>l÷á öF´—ðÖ mØAßö"Ú²˜®‡ºØ›hKâ­nZpkƒvô‡¨ëa» ·T #}†·&Ü`áÖûØ›Q«Çú-ìêÀ^D[kÅPsƒ[ ¶Y°7¢]‡í~تƒþõ2¼ᆠµ2ÐßÀÞD[ÛípW{3j˸=„MÜJ°m½é>l÷á öF´—ðÖ mØAߎ uÅ é´ 2ùÚÄdy8d164180-d04d-45a3-8d39-deecbfdc5c06404-da2b-4a24-9c64-4b13b70fd7c9-7818977687548l56.20960237lh +WQ48=Á„Q­«HXÕ6Gµú•¸0éâz`¯è†Q æhŒÊix0éuP·Gv`Q½#*Ô +7)?r ³ߎ°h5[Ý»cƒ£QnÜ,ö˜®š¨õZQM[%1ªC»À +— ¦—âÉÁ,7b16bcfec-f6ca-4114-8b1c-e82243383f278bed7e99-581b-4ed0-be5d-3ecfc7a74f2e65773682Aÿ£:‡ªp ÕzF<ÚPãR í@¤…jáh¤ È.$3<,RMP^ÔAh ©ƒ:HÕ$å˜Ô¡ƒ—Q=C¨Æ@"ª5¸Õ$5Á¶hD°<&Û(7 $ܸ¨ž  ¦Çúêà +¤$X98ad9584-ea08-4334-b68b-0584cb1e06cfc-2e6a-4d26-bda4-a560b2266e112797358.550353050281.54962977384=z£:‡ª,¨ƒ +À &ìšÂ¢mÙé "¼àhDáT<ƒ:t )€å[bý÷EñŒ¢vúnE‘ð(">©¦NE3Q´Å¢v¯Ä³ÙÝ´wJ@£60ú¼àhœ4ŽÚaP t |‹÷yàâÙà#ÁŸ3º|QI¡Åç’™\~…^–Jd†øƒ¡Ï!FTÊ`´tŠŸ=ß3(íA+ɨ²Ä +.¢ÈžÔçŒB7¡Q_Ñ …öJ@‘ÑgЩ :È"ñçâ§ "£>g&Xí9" $’=e¸T‚—Jd’*Ü.UPRhD0ð@ +"E‘™—$’+V 8ñKBEOH"ø#1bˆ½=½%N€ö~=#P¬@QâDPXÂÄŠ@(z,L¬ð@¡Bè¡BEŠ F”ð‘±bDŠ%XôNüE`Ñ"°çìU‡Kä’Èt.SNT§K`ø‚ Jƒ'H”.UH Áh0I„½'HŒ aÂÄñ-"{Чrùüõ„Î(‰PeP¹dRCžÄi ç¹ü@"«Ðgtåd>«$ªÖ%@XGŒ ¨²¸d +I@‰Ã"г‡Œþ‚Ì— .IŸBáJPX”A€Ð§¯ gé¡ìŸÏhoäĉgq©‚ìA=§ÐaDô4ú–ÓiXÜÙ)éG R1Œ ™Ke±HdöœAfÐYD2Ÿ%\¤ËdÐI.F” €‚#F” 0bD (HPQ +$H¨ØP‚ÄN +àÒâ šH‘B¹¢$á\.?P€ØPÂ÷ûýHü~¿¿ßï÷ûýVü~'P P.•Ñdô÷ëõ‚Ê"2å‡ìý‚NiZU–Ð%4¹tZƒA§‰, +G ƒ>%€ÕÞÙ+uö Ï “D²¨ì‘ 0"iâÄ E'´—â\"—JT]~AdðT*{Ή§Ï„ f/ª &ƒ¿’ù,‚”@Q¢„Ïçë!AgQÄÒ” á1‚‚Š#?eT¤„ ‰Ÿ2*"|*{N¨2¨$ãŒ"=˜ÉåÄÊÕžsdC #H 1bÄ&>ž-ªÐâ¯Ç\Rpqüõ>àr‰—K¤ÈˆbÚƒ¾ì”t„bDµ„ +V¤%JŒ A‚Ĉ#‚NHÀÒ 2¸"š,Z{EeϹt :]@ƒÈeQêb9,•EÁ(ÒçB :‡.¦K$2XE|F…Â"ˆ‹%(Œ(á…(ª=$ 2H-²ü€Ê¢0TK€@{„ô¨#\š!š‘$)ÔéÓH R”f›,yR€ÀA¡áP@$†‚¢P ‚@`` Á€0 DZ‰­Ù•Ñ9 0(rÚKû¢Wf2žèžÄä‹9"ø¶“-: >¿QÕâ¢4J¬q®"q<Ÿ/S²f¯åL~Qɤèöw{¨Ž©;hF\KÇ8jʤ àŠ%'7cü’›¦1fL< «ÛœaÌbùÍ29YBWf›¶ª¸8ò¿"UKƒF¨ÃŽF FÄ–2+‰}Ï(?įT¡áµÔÓ8Ý è%ëà¡Þ± À¾]:‚ßÀ«Ú‡œÑ7½¾Ôâ|(¯ß;­¬•^Læ6‚އ,*–yÿz·¸¢=òŒŒntiP°÷ÆaÂD bÁczXËs 9Í5¶˜8“—£¤­ËRK'Réàš†b½o«òâ&)¦9ZðT·ôÝd„†‹ néáîö„]ÒXõqëÒÚÆ]?yRO«j™KœÎøÉbˆ•JìnóöBúøen ÑVvâjcg¸3?,Ž]oy!i¯2èÝ¿¨mw†rfÑ,±d²ÍΕ€rJº%ÕçO-ÅØO"9¦W÷Lè\…õ²H”AâB£GPŸ\Ë1Ó†ÈÉÜNšÂgi0ÒädlmF4~ÐK̤‘ -½ õçÙ3ûs_ö™ks_ÆVk2º8 "„M4Q¾ÑœVñïLwd8\ÙB¢ÈV ´ú{ÞoöXÌ 72.T!õôFÄ3Ýã{„{*õÆ•zvÍ&çÑQ×BÈßTQ„”-w\” ­ %I¼^×™´KYœIð"æ²trT4†fŽŸ–€Ò%–\ «”ÄÉÓéÃbøÜì_S‚½31ÍrXE†f¦Qä«Â'ÅNÄGÍÕ,$ñ¯3êº&ìv³PêLuôüH9w˜îYã‰S4Ïê;Ÿí¦Hbø, k‚vy8ïãéZâ úÉû³6œæÔ¡@^,$Yeê*TÍØßøi¼Üˆè‚D éò’(>r#3i‹sìo3Í’å‹Uñ±:ÈÙÆ“ȹD—s_\¤ÉÀÃó„ùEfO/óÚÛÀp†pFQÏ8–¸†}ðóô‰¬°º·@·´ø E|c‚mä·mðÅT̹-Ú[~eªo̯æx¶èZ-éolÐb'±K̬ç` Éc7ú³H0M7.ÏÂûd\‘óß<çj¼æ5«+ö“3{žÁÆ6k%˜â€5i+Å>•oC^Þ ÂæVõøâe–ŒYG¿0¯‡yRƒÌß«"Lì ÃAf1ßg“œ¡³93%¤[,P`±üÛgÉ6ŽêŠI܇–ð#  ê¿û‹€=ôÉé>¡î •³D±} ÝN•æO¼3°Ð{HpŽ\–³Ã‹%¶-|%ÿÑÅ.J=šB$Ø<66nÄÊ2F^.ÂüÂ Ì™êøƒ!ÉPi–Žq¡Óªøm[Pã £žÕØ(¡Ò› #ªåK¢°a¹^ë[qßÃØÜ·ûõ¸á «:‰˜ÅU*|PÖ‘á8xSÆÙ µý±Y…Z£¿KÈ‘VÇôΣ ‘*èp|fùê±5 /à+{3AÖ_Ïr":¾ú^Ò÷ŒC[+—Ì$obyˆ¸ãŠ~‹ð…V)Bn©0cêD¿¥Š~.èFW¡îœp\3Ï÷PŸ-ÇU÷x‘*žÄð½¬ÈÆÍ#jqâ Œº¡¿È¡ÁˆB…Öc%x˜/n¶ÓnrN‡=M<.ò0¿1idAlk_è°òUÞ+¯„{¿ªV‹I3§åÓÉ`ŃB‹ïFOS›ÇU¤M‡A¬¦¶éYâ4F +â*ñBœBÚK3÷¥-XÍÄþ†D¢{ +M ˆQÁɇ(/;C±7MÍØÉEfÀ޼öføDÝ<ô‘2Œ"E7vT"&Ma¬qt?C}ôäß­Ñà™ø;j{sm\•h + +Ùàtø4í÷Ü ¿ìéðt‡¦M¦@~É5è÷‚ÞŽapµLÅÓ,o¦l +`Z˜ÑK.€С×\ +ÊÁ¼ݳÙ{w6¦{ÓÝœ`A5>üå ÈÔ™ ²äëì]†Ÿ'Y¢a"›3ë¦Þæ°#Ç÷óÓ&4;©FpÀJîˆÚñ]³V¢œ°¬à˜õ€ÕzÑÃI«¿±O–çž1œ7,j¢H¢Q¢w6²øˆ ¬k³O6ã ogÚÁlÚa\À¯®ÍK»C ÃÔ–Ø)X$wö£Q©öovÓמ^íØ`h,…†úv4‡‰çžN¼™Ômê(Hu6)wÔl FÒ–¤'sÐ^ĸ0¦âiú4@¶…Ð*j¾J{ Ë×Íþ³ j.¦ätÁ“ØM­‚ˆ-k ›@éÌg¦g]Âûj!³Õ}Õ‘ dìZÛÈT"P# 1-¯”vµ‰ ¸i +q@BU€¡jÊ]„UÀäœÁxIv$T‘•i ƒôQžšOÈÍÅaE™aH@º‚¡ÜFïC±ÅXh§ðò’dŸg¬©ÅŠßçJ…ú]òèP`A˜}Fh[{ÏÒü¥Q}é3= Òü^\Jš®œ¯á(0Ò»ƒ(ØÊq$LÿRPy::Œ×¹È-[[ìE:†²eÀ,Œƒ¢*J¹ˆùÊG `©xCY!F0´›Ö³6D#¤ñ)Zó +Ϊ‘‚ÊÈ p‹5ö¾¦žbbú%¦ŒG&ƹkK +†Âp°nÕ{º&ÎáT+àÌ ÕŸ#v§$ H¯vmAß©=0¶›4Iâêv8ÊÒFþ$ipQª¥FÖ±‡ZÓÐfº÷NTÑ)ñs¡’ ê`Cý5ÆU².æê«ÂÇIŽ8’ÊÜ×<èÔä[QCÒYÄÊÍëÔBœD)ÌÊ4 +‘OÊ>LÈz‘µeVÆ?ÏEÀ«µ!"­§–ðóY{°@ˆ›#}»\ÐCÒ˜å#Ùä®å·¡@óåêcŠ[ÍÕq"-¡ Ð Ã ^+ÄÓþ+\^¬ˆsC á¤R½¯ Sµœt÷â͉ñƒµ¬GB²ânty€û²TcU¿ˆÿ|açƒ~Ðy„„©:#/udœÕ=Z@z:ÊTéè#$-weJ,ÂLÔ ŒìµjàÈWîYzékt”ÞºÕ Äé÷œ¦ %‘ÜÞÈE +y@k¹Ò ßVôá„…ì²nϼ—vEìÏþw¡ämÜÓyØþßn ö¸„@E©(?\5gmEJ\DË’=6À†vµ”myD gG6Ýá¾6vÁ1¶%ê…„Ÿ÷¾6k¡Ôær±G{©É"G-k¤6È›X#Mkõ»r7bù2®Ž6SÈ2öNõ¥Vø¨¿éj;[¨SBgÀŠÆµEM5^õÖtÅ»•û6AJŸ[Ì—Äô9ªò ‘nÐPQø:ÜÚ«Šz0@tªMù3ëíP¸ñ :y6‘©•/’áaß»ø6¯¹Û§)¥•p‡qOSXPeÆ”›OKo±ƒž K¨MÆFÙ¼½‚hÿGô »Æ³’ë½çÎ.©Ç¯™Ï®9‰Û$S~Å:½4וn éqµá&rÍÐâ½NÏì;ŠÁÁ +~eëÈjªÏFiéy° B%þ`1}¤PÜÁÐÞÇ0 u éIÊ"éâ É¤òò¨ôN‹ÿâ"p–xÔa7¥9Ôš2Ê­Ÿz'P0¸R»× z½^D;Ž.—£…©”IÛhÍ:YŒ¢ÃJQò0i¸hQh”£3ÛÉCV0C¨ËN›°LWLb,.*jT0ÐhŠ(ðŒÁì£ä×X‹~ë¡T‹Z~hªá¸’ì&«ƒ.ANÛrõÄ/½²¤ª;Ïî!·E^^Y¦Í`(TêTtX;jwÎ]„†ˆ¢SÄøÇéûÓYêb'&®—¯åÕ#/ýO‰vœß®šL;¡wŸ]ùbÛ1˜¥Mãšì®iš-Þ¦8ŸjtKQ±iÔ‹]›fdmlĨi±5 ZnÓ0˜F%[Ó0˜æÿ*ýÝ6êzKVdFf0k'ƒ‰pjËÆÅî×7ÖZÍ`"޵nãOkMØÚ®Ø4•|ÑhÔÁ4¯l¾]¸¥ÎµŸ¬ïƒ‰8ƒ¹p[Ó@Ç&¥RKÅé¾L¤ÓëÊ̆‹í£]¥F»úÔµ¤vo_ 7vƒzwöÕxµ~xõìŸÊ] ‘+~fV“Þ—·¹T©If.Oä)%ÔÍÆ(™Wú#ú¾HÜÿ•R¥”mù0qÓ¬ñq£Q­­n„§ÚX×::â,íjEÚ¦µÞ¦˜ŽêØMÝ‘Ö#µMÆuèyîYšzÚÉÔ›ë»Ü7«¾iì´yÕÓ—bqJËÂMIÍÑ£ÝÜÄþŠžÒUßÕjsÑh:=ß7¨£dÙèÚ°ýÿ/LwûWF¦HõO»qÈè™íYcUDÜüvWÔ 23ZÌUÄ(!EIÆèT)Êm UR>l º‹FBÍ`Û~ü¦šv‘Ì‹ž½3Ì^8v¨%âtq4.t]Ÿ³tÑò&Ï,Mn‰,ùì‘Á4š|«y陌ÑK¨NŽª#õ껓i!¢GôÆ &By2r˜.ƒ‰T¯Ûî2ǃ‰PýúŸ‹ æÂá@Eɶ•Õe>f½£ G£º‘u!3÷r©ž±"4Îì»H{É1˜¦a0Mc®¬lW«§Ù•ß ÆÑ FânäÁPt_%eÏ+Tsñ™•œÌ©Ø­Y|ÅyÅ\Í`Xï刕šFìLÃZΔY›Øâ«a*Än4–çá®*æwJË. ‘ÁD°ú ³RñÖ&Ó°/ÍTILFLæ˜i_^ÿk[¶‹ù c„Ëôœ¬Ó2 e–â|,Íì·÷ÂOCTÊç¥ÜÖåÿè÷﬿R“†øˆÁD¾¾%˜b)b=b,åtMg_µÃDkDkÿˆ{Û‘6v{cqb1£bÄHöb¥FÝ´TûåýÊ)õì·:ݼÐí2&T©xõk•±Ô&F¸‰J¨Ñ[:²Ÿù2ï‰êuý²±%¢„›¨Ò6=¢JÈ%ôˆLÑrýÐ#>?*d0,¡#G¾î6o„ +b0”ˆ\•ãÚå#Ó0˜F/ß©¡ÂF ÆaŽ +Ý-í3ÂF &‚žú-ÒôË;ŠQ¥FÜEŠÿ4¡DkˆÓQ=îîg5§^9'C㸄jÓc=*ïOôK‡D¨†ˆLDŽˆ°"×”ðìÔ:EεFµßXÚš0µ*¾ÜV¢r÷DõË`"•ŽŽ+t=5/í+Þm6/÷W;´/LWÉKýjÁ88Ù•Ÿyñ™·]¥;sCÙÏ®ôPí—_¹]!2˜F¡Ýá)ÖªG¡*vSoCT›è“ªÚ¢j„ˆPå£ÂEõˆ +•¿3J˜‡êªÏFŒÈëÝM94LD³6G¢â$°À`LHˆ8|h@À<*“ 5Xœ˜™™×˜™™Ó˜¹á3æfô¼m+ÿ“zu»uo붺»­+~þ=®¶n‹6µ.*º¦C[äMÞÝetU}<[éc~ê!^~Z6çï“i3m&ôDËCùü©¦M«›–91##´›~m;íïÚþÚþnþæïþ¢zNŒÒ¦N¶›i{SÚM«§l›6í&Þ=Ok»)-ªooÛeÝt„TUõUÿM?ñÙeÎÅç°±U¹=1mnokÚ&?ýyžHq·™½»ûð®í£ÿfnîîò®­í¦;wÒݧù”˜‹œéËÉø¨'¦;?É=]±Ó[]}M³“qsÙ}ÕÝ4ÛqQ¥ãuïä˜Z¿¯—ß_ÿqQ÷Os¿ýù9ÓOõÓ±ö­í›>kª>jf§í;ª]ÆDùŸ×Mu=ñ÷oºýÜÔ­ ?±v¿fvò38P D¡6&>!JfB|GlDUd]M´=}DˆÁX¨+ª;L §<(Õ„ Ä”…BåÑ " +Œ…Xq. ÿÙõéWÎ¥ÏØm‡Üœõ9¥^o^ïSMÑŽÓ¢þ[2ÜtéÓ’-Z”Rw."ßFGvTOŠÙÿר±û” ñÒ§·ÆÊ¤IÕ­±Þ Õ^Sõ8Óna~+6&RôÙ†oèŠÝù¿w¾c6Â~Gž%ªÌnUÍZkL×®L(‡ šË£ÃѰ°À„ËãÁ„Äy6Û-XL£ìjPuª%給×ÇþBÕæN´x¾›ý†šøÔ=埻aeq?>2˜&á&#>×3zT´vˆ’‰„;V‚€Ü3¿–AR`·Co´üèýQÿ)û'¼÷¤¿ÖÈv '8$ãž;ä?¢¦gL\Í1¹Ãb!ïé›f!?[R^t\:ì’Á4P¥g5>Ô¿§Bò¸4„š€X$à<ÉE `àR™P*  ˜’‰¤A …iPXTž]éñ-hs4ʬ ¦šQ?Ð@¯º¥ÆÛÇEvLøh>?ÿ43Ý£Þ½Ú!T—Ú˜ú˜üŒ#{˜›ú© ?=S³}¡§”Ž/=íÊá=;ÙbaãpêùæœU"Ä +‡ÂTWÈ`$®Ñ¡õ1·õ]M8—‡±xžFÍtt¬¥Ã1í³º<Ç–c'Û_[Utåìþ{åܽ,GvbR[GJäÀT˶_ÄÛÍ—5-T.¶sð:r+×ц‡"ˆÔ)ú5, XWWÅÀpuÅÐÅP¹À`,0˜V "¢"‰³ (“Ű âL¸<…êyLšÊcB£&4ŠáòxT@žÇ…ƒ² ¥ ª ‹ „² ¥¸ªTœ‰Šƒª8É£AM°XTâmŸêsê”CyL°Ô„Ģÿ:iùåfRÅWãdæîwLùJÉöž»¦ê (N{;u¹1%23˜F&ï¶%#ë¢FÊ»¥Ë`¦‹x‹ÜšþwLÕѾ Ùý[³½?y¢Ÿzn§O›Ú==1µ^Õ•QËÑVU[9µV•?u½öOŸ‘O{9U«?"¿¶fk}¯òv·¾e'½íò½íê^ïþTöõ¿DUtÄ”´Óºû7jò§löw|Õ¿T 3½%¯äwöýô™>9¶û—qwòÞ.÷åF–JmØø¨W{§F|}\Mv‡ÊéžÕ3ÑSÑ*ë§ÞT|ß.æÏÔxȵóÏR²-äÛÅ6´'ƒ‰|µê6ÞÞ®ÝWç¥÷z{Rw÷Wg0 ¯ßöÊ¿äÈÛ‘vâíbD¶]É+q+Ï·³š.Wbs.LØþ‰<[»‹u]Ï?}oï·’zí!oÚ-ªõÒEžé•ëUÞ»È--²öÒäM¹¶ÌÖ^¯ÚÆŒ*{}3òÆçôËG¿ÖK½Ý‰³9ÿŸ«ÛRr}#g”–÷ì«?ªÜdy‹ê7ÛRjnäBôœ Èö¿²ByÐ + B$ˆÊã¡ÐLžÈäb±h°TIò‚É©ð¸<8%ò°àâ"åâ@8ÄRy\àãò˜x\œHŠ@€…• Èåñ8] .É(GYà<4<‰ªL.s*Uq(êð¡ÁçÂqÔÈó°0@UH ç’*”Šsá Êbq*ŠD9>4\(GS!8à@"xÿó8FýBN@ɤÊDŒ@ñ)s;— +›š×;¢ t).¸¸?iËb–°ÜSÍkºs6?|Æò )•]¥¨M¿%„Êvó7UY†Pv.véOª +8”ã¡ hÔû°):íφè’IšxšZgN±l‰‰Ç³nWý#:vX-k:ÆiÆgR¿ ñ¢k°Ýy¬ØL°äÕ’¯aoàAsã‰7\ÛðUNº±ä‹ãyÓ¨Gr5x÷²bÖÌX®Gï×ùS‹ÕMYNQ<ï‚ËrÎéÔÒBV¼Ðh›eRÀ:…dÛìZFCÀ™.6/u‘%ORfn]«Zóœ‹Zþï6–FE«KÑ,aå(÷+*̯ؓ-gs˜~kIKP5«ôÊbk/#¤,_ »,r‘‘Ðiz|œÑ¢KË¡,سø¼£WÃìRÊ%Œ—’æþHt¡ +“KTGʳïïRWËxe÷ÒWbWŸÎì2ÅmZ½åVdû(À7ç©ØFJg.Ðá׿ãU˜);{ùÆv[P¯ ,z·O™]ƒæ†zñ]o@„¨|Ç9ZÜ–ÓGsù¸¤`$Û©ÕãZK¨æ|s·M¯Û^…@X{>'±œeü*«D•%ªEsc{9.‘åÑ£!WèŒ~®N^D × ÎŽr´D©»Ã´„bZQ­Tïð`‡½^¯”ÛÃÁ<˜Ell.¦Þ¦[°àÔî̆wGUªþn~ÃAAôåÙw9ÿ£V-温nsùôŠAŠózè*F¡µ’¬³êá”´ùá÷^2]ê¨Yî`×”d¨í¼Ôz§Q@jû‚QÄwx+¸ð³öåbë\ªMObb×t/íkd+h­ó ðŒÌ‹Ðÿ¿z‘mºN3[ßB(ã¦)-ý²ðÕë^ð© ÉËêøn±¬óÛn:xñ`âvpÛ§u3¨ž"²½ú­ŒE³µL˸£ðsO8ºåhMö Ø#1Wä`5 ª˜m©²Ü¿ ÁÁÔ~žÍMKgÁbNC€D!$Db苤ú(Ï6?·‡Tü’$DÞº÷_øŽ¬Øã]öR"5½½4hLþ (ʾUÛ Fp1ÉD† ðø§,aóGè²GØa´ý² +²Ï4< RPià0Mòã]¾.ˆæI8Wÿñ´ª[;'ÁQ»%øÈx„–¤Úq4Òô#d2,N­Í·.f Ïbdˆ;¬Úo;¡¢¤L00PCUÐY—6ðSq»iþöšÈ£¦+Bs‰°;,žÓ®D¬ o­4äÏ"£ËŠÐY?xœÝs£Q¥^üd9µ¸&n²B2lª¹™ Îê©©Ýzœm-î¡Ño;±sþ\‹ ñ4k«ô*51;aR{.ÂY5õ=ÌÁþBÔçÝ¡ö½´|!êŠàä}w©¢‰žng§÷ãòÕ(¦•ƒô ¸ÐŽ‘—6ôx l[#ûâVÍwjˆüpp¬[!—9ŲÍTÄ¢~ {Elf6TSðçÊ)ÜÕf @¶ýŸÖ°e–B¯œ|ILCy²Õ"ñûÐäÉ y—zjÕ ŽÈe±Pc):ä‹{ÜÕ)Ì€@¡¹;6ˆ=F¥ zü$™¢ÒÛÇDÕÉÑÌO ïŠBŽåî×XzLQNªWSáÖhF6+. eNÆ7˜<X:·1¾·ynÇçB?W•S*ž{é'ù[ߺ +b²3ùÞGc¼«ü¼žòÅBÂD?M¾ì•ÂŽ[ܨ# ÏÖô/Yt ÌõýÞË™ÐÇp¹’Þ(€Oë&3„°(Q‰öFMl™+þØ&å–K£¡œ…¯M8Í%ºpl— 'H˱ŒîAõYZþõt ô¡ZD†Â¾Œž­XÎ@ ü­*§1¬/6`úûÉQ"7.BžÔ%c&ôŒ„Ä5r ß_Ç^kĄ̃Û\9ïkLîk‚|ÿ12@ä×[\YvqʲŠ#– úpÙÔ ’a%ÄIˆCQ‰XÜH8ÒÙµ¥mâˆf»Ð(9ÞÀLK {«‚ÿ‘&×N IsÓ%¹ä¿>˜q»å‘+äÚðG.!†…B=Èu„±H"ÏÃ-ÿ-|¯­ù p¿Näóô7ýÇ«¿’µ´ou/¯‡ +š.Ykµ­µC˜IÁÜ  =|I³ª-ëg#GDÈÙ&rTΨc±$s4V©¤9°j%&d8Ò^$Œ:į"º|£FïQÐ~ˆ@ƒê.Šiø«OÛÿýðÈØm÷?@¹=ˆ.‚QÖWY±`ª1Îå‰ÒþŽK¬J8³3i¹³§ËW + +çêÚci´ƒ›”’…/^²(@àùg? ·’T r¯ÀŠÆæ6Ä*õQ\&_ÙòÔ/¶SGBaÛ­³ÔÏhš•ÓÊ€® c¡Τn«j¨@dÛÍÇ™\´½Ãèçà«X ÷Å.ø ê!zÕöL"ÎeDi­'ƒ»:'¨e[fUÏÊôá <»y9‡„ß/|KÿYøRifè Ü0ðxbn9J O¡LóªÊ”¨ÞK{|£¨ñ)jj5)À2€ÐKò8ö+KSØpN,Ã’™É|…‰Z"R ÉiþÄh›£ÿßNC€.g::?^«’²¾›Ê“ ›ÚµKê½3XÝv¾b÷,óû-ÆíÏÓÄ[/<]íeýÍ|íŽØ :V¶{f‚uV‹äÖm88bcyÏtA/ Loï;?iÙUz§Žh{ñøf¯ˆ†½èýgzymýà¼ò¶Ìù:ÌÆ\Ì+çS°Ør3¤ œå€‚3p¢8e¡d ‘Óza;Å6é›Â<±éˆú†3[4‡´Ô)] „“Lïkm?e,‰_$ÖU˜è‘pJ©ä†Vß0p¥ÍÓ nnh®¥gaHª:ì«¡u£ë3ÚÁ[±AJGS³2€÷ò†H9>\wˆJB`‰©Ð.dÇ[¨{ü{ÕrWläjÄæî‰Í4ÿÖãÎëŸ,æ#60z3ŠG`¹"êô²da@_C$¨c›Ö†C¹HÈðá÷úFÛ « Øš7mGûoâe.òÇw¬°¡^/] b“?„½ ù¾œ£7ÂÇ 7=î¦ùO¡¹µ—ËãÅNìn½.ÝÝcó€ü¯ÏÛÝ6Wášœ—}K÷7)Pf?G!6ÜøÔ¥Eµ‰\ˆ#7tÙ¡Œ¡9¿FPw½´Zñ7˯¨}É¡ìTi8}}Ô)±1®„~öìpºé/ܼñSÈ ¨¢7„ÕÍZ»Naú•c²ÍC+TìѬWµ÷J8åyG²Wµ&} +9ógøàé-ª(þæÁ7¦gpfl¢×ðÇ$\¡skK9œ**§TÇ5}0ÑÊ/™^6ŽöáÇŠF +ïÝÐÒD·vuœ€ÁÁx]Ü !BáÓ+7+Ðû@ëÚKƒ¸ `um£ºŠÿä ñeäèá[ýÁi3oAÄü@ßwQîyã3^†œ«‘,Î;5KïÛÒøñÜNÎcÝ¥6½ÍÙ‘m2É:ý[¥{úîE[mÂÎ50¬ðgf1«hb#vf.Å+â…ƒé3\Í5­ÄEƒ+œ@@”»áŽ5Uhæsøv¹r>4{ã½êUOµ"ГÍг׎„´^¼ÏyjŸ <ü¢ãìcޝnGß2Á?nB;´LýW5‚j뫹xÏ'ýgfúäRÒ5»„v'ÿT\ "d¥³ˆ£mß^œK…L J #øBû€8À¼Hc¹FbeT„véP»®‰h|¯ Ë¡nàÒ|õQÚ@«£XÙ£õos@-Ü#Ë|Ã{³ø(:ƒºž”ªƒ|N¾BGõ·µËÜú…“^ƒuÿàΕ +÷Ï ,ÿ²·ßíßnÚuÞ5Äê:AßþÆi’µªrþËðñ_Và /þŸ¡ ‰çŸÜÏÀ¡•÷t·è´ ¥×à|¯ˆ2†C¢wp\ ~™î%ȶõC¹m„›!%Ü“S§-š w .”âÓM‰&X׫µn¡iÊûx_Ç€Û”xÿ—!<ä}n„ÈRš¿0‘Öf€º>®ÛöhD ê pZÑ‹½ ;ÈÚí’Så1ÑÎS˶©B]Ýò@y®«êÈÝå”þCŸDGUWGwP°ªËåHsVÄev¼pàÁS’x†ãº`Ý‚¼]wå|TTm 6IýØ}HUº{ª²öTÉ1ö"]œ½2·ñó¡¦àw2hi‡‡ñ•!Ös´5²^„ê¿ +‹ƒîSgð4èZ¢¶¨“û›éáÌ Okküm,ÜñQÌê]AUMö'¤ïêq™¢_¤„î^9 ´ÐÙZ“<öÌ&°~ïÜ6ðÃÐPDÙôç¡]ßhÞ¢’XÖŠ½ Àó(æ?ŠÚyØ!¶`˜Øƒúˆì +š%?ç=F=—Áô-ú6º£ ß "¼ba/Òñ¯×DÚx„wÿ›8o]Ü8[%÷äè‘]V…GöaF[r‡ä Q_DCpH΀·Øúq1œ ½ÙÞéç’a5ÂhÚ¬æ%ˆž£×d^8F·ó}D£°mÇüŒÎ„âo·ÔN—©€œ´7Îçl=Ã[d{ËxÓTÏZCAN°qEØî£â)(‚PP)¨F~4†’q]!ÜE}P)¤XS›ÇZÂØ%ÜWꌜ‘˜‚¾ }°ý©‹ºu©‹)Ú34Ë¿gö?¨Loà×t„€õƒìAŠì€¸"]Dswuïó<¨ê"UƒEÀUŒYìà¾ôÈDºß]騇h¹38BòY»Gÿð ¡‹íR•¬úмl­à[,Qz ¦6ÓnõGQ‹“\BD| gxÉ€•!,C¹Ú2˜.ªÅW£˜Ïôöªdªµä ËEz^g),ûåoRšsE$ ^PH°VŠrÿÐvÙVyf|«xhç¾ ùF±Äî@‰¸ƒ† êè* °•5ë<áâLáøUw:°¥3¹KJú¯ë úál±Ní¶Öôš8‹ïIÈZëz°O 6gv1ø"¹cíéq9J`©A+¹ºJá ý–R¼Q< +Âe,ÔÀŠÁŸüG‹rŸK*@‚y/8ƒ–Yþ„l) ‚†ºyiÝh¨Fe'ÄbõçòI ÔìÀÆ’~æÍ$_°³P'ŽsË0§ÅÁõøâ…¼&W~°ŒŽ8, z>á^)Ë«}|ÂÛÁYÞ”rˆBÄ!î:sYý&Ò@o¯{Ñé°3€~ˆikS8ß~t‡ü™[v/BÖf­T#'ð=‡® +7-©sꊒÎÞB4¾i”:a¤¯2À{ªZë¬zæ«ë‰xzƒTª'°èJ¾>n¦Ki®j~ʶÆÊ¾ãT'OÆmÍÿ ŒÇfÁ„(h27ÐÂ5OA¹ª=s¼ìûmWÌq¿ „Þ}邟ÿ?‚xÝ9îšfMqŸ Hˆx6€‘À„DÞæ[­â +&ÚÊ Óy-gäSP8ïÞŠ pY ÀO2›Ò^Žþ(½ {`ðĆ=I3‚~ózLدµ9ÙYnÞ¦@Úè±a¡4<ó÷Ñ\øß–Ìêí$_Êo¦<¢†L¸lÅ^.”ÿ±CûǬ_¸‚L-oþ3u˜á<„ûíŒ{À™× Tƒ_ÁC(´¡gÁ-Ä¨Ï œdɶž†óäÜ3=nM´žÍ•î³ •gM!Tižª_Ï/Äïf¸{$œ°“©× +_®KÀÐWqäŒb!=ÜÑg¾Ù‚¸»P@Š}%0Šƒ’…U'T­½?›Îh¹Š¤Æ¨udѵôH£' a©"@´¿WQ½I€Òpå&Gè„Ê“œCÖSð›.m8„IhÞÂGÊZ¹|u‹v³_“qŽeØHÂ…8º½…;Ô=kYú˜¦H#‰wæìÖéc}$¤B +XÈ}ôš}u«Cã)¼>™<60¤ÆdXo©‹EªEР&ñ|…Z I]Õ™¾¡9 ¤Í=1²ò·c‡©? Àzž+IhnÍsAMÂÁœg©p9;jžAàBüˆKppV +‚ÿ,biÙ#¡¹ß^”|#Å6dz§Ÿˆ?Å 4ò@˜º2¬h°A‰º.bç²i}¿rÿáÁ+çÑŽ&ø¿ÅÍ“¼€ÉÁ*[Æ^í¡pÈ)UâGê‚Ó130@NàÄRs:mËT6àn6,k€:…ÇÕ…Œ —‹nMîŸLÿÖr¿j¸.4õ|©÷ÀÌË>ès›çd^OhÐÊÅÐfÇûygù‘F¯tÇ‚H¢€PÚ—Òï¦kHnÃ¥*ŽseóŸÌ×ôÃ{Ñ Õ±µÈ[ÔŸú^½²ohWÁå*„9i€º9 ¼ó£˜(=i Äh§šƒšNÿžrä*ŽLijE†'‰{¨Fá¦Úø©ðÕ¾S°o@‚•%0Ã}²Ù¡ÏÄ,RåC¢Ðxa|fb«pÑš2à5|p©bF?)úñ[ãk~y²!*ØöWlšHW.ÊCEÜ¢eÉñ]m³{p0 át©«þ°ÅÇÊQµ‰€¸V—üi4&þj'QBpÍXSáŸáäþ²£SùL€ÑtRqN!4Ì€0»J@ä1ðAýBSXëÒrϽ?ž8Œ‚eM©rÄ ü\Xi$ðo`;;]ú=E/†ŸS€×üy}#l;¿ŠÌÀ¤Hy (å¹P‡ÿø5ÔçÀ1¾}¡n"².žòØ¥xªûÿH”Óʽ +R‡¦Â:ZŸº”KWûdîg¾zìyLÞ†‹±oöý §Yiý˜Ó.!h•È y MRd"äV˜ôN‘ ¡8ôÅ%…Þéà@'gŠ´ó¼Éú¥:+´ä‘M´âùø¶M¥“¿ÎÎÁ/ª©šŸ+Kçžõä“ïóœÆ‡ÖL°6u—¬é +±Å"C)êd†H^eè‚H̰¿wj¢:õZBÉC¿1ËCämïÕ?4¬béƒÿ.ôËbYYi/y\ÖÞÊ67þ­ +˜Ð- +šñ‚I™üty;-üZPédùNÍAá=Å·ÏÐQ·¢¢´÷ÚðË=àà)ÃA}ª@s|JÊ`þ7üü+·:¼áí§Ùžw¼Ž¸¤Ç †±Pâ*©4$@®rS[¸dóÔ ¢JT±¬“Ï—h7tp­ØŸB;bù›h´ØSÊ­à›³š:\Ëì êƒ3„Hbã¤Ü?YÌ|¡fòÌyõ³úûÅù1d l‹žQõ.‚„š]ÞWoÑ‚ªËŸµÖCø†™ÛÆÑ¹Òß±k;ƒ +ÔÃ¥©¡ðyU—DûºxT•ýÿ¢§Æh"2R¿£Ã~ªH.(8–RË{x©‡wÜŠåß%o4G*áÞšQT®”äA‘ 4H‘=…–EˆÙäp:LDY³p3Élÿ2ÂwGŒâ1# ¹ t¼T¹àô´ù^ù˜õçry+ìǘ‡=F†+•îÜ1Z½§ßn:'J[Aj±,0'­¹ßŰh¨Ù¦¦£˜KÿèÚgb±§¦ÅÁ›Æ•½/˜Ä#0×oðóV|ñ( gÀVGK ß ºÌå KõÎÂñÛ®/C¯™ e"×â´à=@BBÙ…S¡[uãW- ^4¦Ð?`»Bv«BR×@HÛ]ânØì;qö¾mT7lrØÌå’ÊÛ +Ø‹ ”’ýg/Åõž<¬O‘ETBB&Ò”“v‚+FºQ›Ýœ%ÞÄx&u½PºO'²Ó| ×R˜™” b2=]ºw-cЗ‘ýqàa….€Uº=s´¢ÔL/@$ˆõ®wÙ¼Õé$@¿@\:¸)¯hq¦û ļ=¯* +$ Fïv í©§à·›lÞU€•GB¼4cqx1ãÐ(&u3iM%òZ(ÿ:BN¬rÉ•¤+³7‘n—i³{\$s¤W¾BÉ=)ÌÚ©,NEÜ}#l(rP‘p@üÈ-HXò1šu&àØlï ¾ÙÀ þ¯$ÃîÜ¹í„ÆÃ¸ÇWÔö·¶yáÿ=qÁÌØ€`Ê‹(FÝàÝzþy‰©~ó°ÿV’GÓ‰ÉÂ\kNh,³Æøú—A~Á¯ZAÙË$®2!xóÊðE=J³lU +ó­y¹ÜH¥©!â… DдVa¢°_mkû‚,î8¶È‰ äëðÙ„ëóý¬€i±–xð"ž—å&û¦!EŸ¾öbøîÜܠͦA²E]%X5 țʾ¶2sÆò`(Ž¡drsKÄ M6¥÷ C­Ã >‰ó®6M-J§ÍB÷YÅ•œ•s/~Ÿ×¥Ò³¹x=„Ts!€;ÄЀ@ØMnçŠùãp¾àZ–aÂÉð²ƒ8æ…h"Û#…rI—`ýªŽkz^'7Ó–ªv¦›Z{)ô ÎÔ4€»ûβ´k!&3Ä:ýú~5fõ¬SwMD—5á¿áÛ‹E'AomFUT rgÃt›Ô×:Ëý5d¿M¶C†¨gÞ¦ vÑëpe)p¯Xࢲa¾ Ö<ëç~•oŒ•{¨°ð#vǘò +ZkLî-jüTº”2—¿½k—FÑ· ~AW²¢ºëö]MI¯þ‡deÒ `­§ënœ¸èö˼ äÖG¬Ç°²ùºø + Ö(uƒÀ¸!ÂÈ(|y™„4Œ=‘e0æ]ÁRa:ädNNŸhŒ[~úÅÙ¥àþ‚Ö'¨ÅÚsH5nüU^¼t2•4ÍùœttC†ªÿ¦“ÏñqÈðò"$y¼pë$ò£Ê9td{Bá³iÞÿ(â›:Å,üÍó@ƒnV2¡ø +`ÕúNBG"^\AiU¯$`jÜB uY¡…¼k¬÷@‰å|Ö|Ëβõ"‹YcöåíQ~‚"ÀÀÛì °¡6p:2’ ²[àÅÒUvéb 1rdagÓHRtˆ¾š™ñà[r;;gi9C>Їñt¢· vp ÀæxÅr‚¿‹ñõš‰©œÚr ΈÄ<²bÙW³ {#!uŸ"óçI?hô×»Ïq½ºÐºÉG°ÖåÞ`;}ý3Ù÷_p(î¾?#L-­W@ß«šuª_"3#D&Ãà btó¶­UïwÕ½Wñ€&ëç ôÏ#*/ØæWc}ßÿKßBO2³<-ý.•2²‹“óí•Øñ3:÷¹zœ¶¯eUÇGI\ÆÔ¨zŸŸÚmþÈÜÅžçä¯×dób”˜?“åv‚\”ȧÆöÂ@ªZ»ú“•]g< Aåȶ†‡.h'W×l0%%CrMüæ÷rÍ$ì)©vEmHjàŠV‘~¬¥COÖ^ä%N˜û2px¤4BBÚ—§j¦ýù"ô03#XRÛ¶˜#Á³h% ÛtŸ¿|Ù¡[ü›`WAižAåthcµ0æ^ó,ÈaJ%‡Ñ¿*­±0Pús™NO¢TÃ;ôÙï;V Ø]£åM¦)Ftë +É+ÿgÌ4€m± »Þ„Ržà±{¸½÷¬,[âÍ@Åsõo¹„™Àª‘}9pã2ÕZŽ)$(!:Y7÷ ®Qw ºœװѺŒ‡©¼ ú;©²QåÀJ†ØŽe`z¦L¨¢¬]›é tGôÞ%|±u÷º‹¡³è6}Ê¥(eà @û;HQægÉ$¾rËtJ»}DázÍ­Xzî$ƒ Óê0Õ f¾1Ä4–q\ ¨U/ì!\Ä~j +ç0€¾“à!,³¤>jéWG÷eõ\»m©þ –ǔڱ¿ääjð´ûyÄînx`²š½uo4G²ãëL÷Ï,)(YÂE&Ž»Ê'”Ϋ/5äfG.ÌÑ#w²Õ1&¯„‡úšqhyûO—˜^˜FhÿúÛ·R ¶;Z)àýL— hæË½DM +¨€˜³ÆlÚÓ"êN|Œ½¦zg²0WÙj¤ê†§Ùfˆ±Y‚Ä.¹øÌ¢ý0 èá…s\v3Ê+W`V8Û!ì˜Mbr¤ƒŒ-k§£}*‚q© žà [OG³#ºtS‘b +—± ÁºsÂÊþ ímtÈÓkšZ>ÜØG´Zœ€É&Ýí=˜C'ê'+;°þˆkWø³8輫ð63¸~½CÃÇw.j莌R>'Lïc¶H”Q]øä‚ðxEvŸAûb²ï%”ĵe¨vÆqOþ•gßæK” bîÁ“|:Y33­´ï¶a× W5 ÿF1Å{ÉL é–g‡ärsñˆ0¦¤Îy°4pGÀçš ^ª®&ÄO5öìîÑMôÿ"öòS'ÏðµxøLðåBÎN‚?h›U ÔxvÌ"eÆç7Kû® aòLÊ€6¢¼så‡ìV[KŒ3´ÃêS=&û§(ùdéö–|ÎàL®­²±_Ç6Ó†+RÑ8. ¾~“Ñj™Èìýv>)üG™#.èaÄ2Gq\4w3Sñæ.ËLwCꆶµ-gJú@+H0Ðè+g\Ñj# g݉°šö‘—D¯}$áéL|ÚЇkO8v |«+ˆ€}§¶ê2II9 êµÉ'9ê÷7‹µ’øRauÞìò™ç ih øôb íÇ:BD˜Q$W×›‘M̾Ȧ¿ÀÑHcºîééžiå4%`ù(N–ðÇȃãsµëct£Ö82ç©Z¢ÈÑtC@R‘–Ô°'ƒðTq¢(•Xâ†ÔXÑD%„ÎŽ.ÝÞ3!™l¯ÂÐþVœ`…”¬èŽy¿‹õÍRº(H9.UøÁÆ6›óሗ& +Å +H¤YkÔ˜·QZqxÊ?DÀÜÿr~WíÜxƒ‰_øôéÎ;õñ¹åIõýÂÞ-†UGYܶu¼&t‘Qñ]pãÙÕ¦ñlp¥þpL¹r<›ËøQ‘Út••Æ7HÛ–E*.VÚÌ›°Ä&ŠÞŽN¤u¦Óm!V”OoÔpãÞ¦¥-ÑHs·†}°*y=id;zyù+7©éÊòþM#.Ý_S +‘Ú¹´dɦÌ;ÁÛ_«%CäžöÜ.,Ýe`æ¶|b³Yúè©FÁçmɨiXFw¢ÄY±·¡mŒ"޳1Ñ¥ž¼‰¾¬³[LJ˜Ò͈Ü„>“•´Û2’==FH¢?ôÛBÃls=…°M§MY6«âP@:Õ’ƒŽWŒv;G®Æ¨ÐLJ^•ì¡édo? +,î@翳„\fµ0ÎñˆœÅA@lg°v#kE´RD±`§˜OتÆü;ºûÕ˜­Óú9Ѫs¹aÙ" LëÈ7l_Ši [M¤æÐ˜MFç¥WC=¼¤…îe(Ç¢·Ú&CÇnq†Q:Fh4:£è•ÄüˆÖð•‡P¨Ø‚Jƃîì²3¬µÓùþn³Úä&”}mq18cÅ•a.’¡`0I×Yõ ¨àÜ¢ ѹjN8.—…ùRc{z|2ú–˜Kšh\Âô™¾É"î®Oªl,ÛÊD7ê.VAµºÎÙ¨×~¯âzÜø…v)sQˆÍÓ©Èp¬êÑÔû¢í‘(AF×õ8• lŒÌë§aŒ9xðO!(dŒ¡]ÝV˜a [ìË”‰~·ÍQ´§Ò‘³Ÿn£]Ù•n婜¥pPî÷Ù‡-ð‘|e³ÄÎ^LâEï³ÌÑ©ŒÔzï‹Ì»S)¿ÇLPfÕÁlN9OôX¶œÈfïmª¶†ÅžÊ¶ü¹®¨S)#îi,þfÔ jê ¤% c1æº÷gŸù/ŽâY–3q@âTxqìì—ôCF“²G¹%¨¹ªl°©Qö TÙIÒïÂlx… ê2íð \‚aæûèŽÍSAÆžÌ"<Åp$$ä9êTÜu¿Í<î-¡ÏF æxô‹xî•,|53ð@H]¹”·­^»äÞæ×@|Ò@rOß&½ßå³<ÔjÝý-Àqb_…-sÇÔl>Þò 1'÷ +žÄqŸ0b˰*7$,§*ì( >dy(xd‡¤ª½ìª²Ï,ˆ7ËÔl;ÉùQŒ-·OnÁ}¸ìúf&›}|{Ë-ÛÇ© 7yÞ¿~XÆoÿ™Ë&¬òÖžÆAöeAj÷‰S~c¤…~[ÌŠP œ`ç—šyEC„C5ÃßÀeV™ä6„“òRÓÏ VÍ¥Âý‰°P.«ü4Z¹G·=:¹Ì­’tnœS[®ËaÖ•Wõ&Ž+Çnþ&‰o3ñ=5”Gî{o@P.”NáLRýÁ– +bÕÒ3̬ÃÜ1[N´Ê„€:Ýëù¹±ÄÝË„Z%ÏäF—(µJ­ì£v ĨIî3‚Z¦ œÖ¦Vyàü¦_òfH:D.$› +s€yPëí°#…bQ“"óÜ'v¨]3{‹!J"vÒýôö–°R¨i"«%3U>èVY |ã`ßÇî*rÊ„¦do‰ä6YÑ@–‚ÆíÚvì7™?§˜*¦¥ÿàNxÝ3™|vm.DÕàUa‡iØ ðœÌ +œ¾W˜g¬Ee5>ŒBo$®E@âœI›,/¼JvÕQ|Â=ˆ‰Çƒžn­“]çâŒS[SEÉÀ†¼MŒPö¤<‰çÞk9¶mÇùO2éѳ½.~ð|^ìû„öã]`#2ã­ˆe´7ä{O¬¿ô(ßvøÝAH3ÖͪtÇÛ2ÖrÅvŒ}’Kt4šõ9Ž’ö¡žFÚªøMŸú%÷»ógáK1q¡÷þ4 dñòQz¤¦nb+Ê[,Ðʳ©e÷n…Ã0;2™!³ø·7‰±¤J -ÎDc˜ ¼ØõF[üi«9½Œ Ý 5}4³α:txH“DYÙq§ÓeWpZ^åeßÃþ²ƒ‚ÍeïXý²/fX÷ИÌRê~¥pµL6¶cì.çlÙ­§5%–ä-{“ñä ‰åŽ:Ò)gëy{£¤ãˆ9Á¨{†–ݲ"˾π–ƒÎú}Ù}Ë¡eF'pÄX`J1»Û3º:êþ!.»j±ª©7:zAâOšrý˜}•_̾!/0»Ù_fvæ fvˆÉJÏìkKDgö:ÛS¿V‹mç­oÎ0)Ÿd)·HÒ[v„Uºù–ó÷bQ=$.4ñéI¯C3Å^ê^@…†Î×±.»xqí‚ï²{<\ü{Ñ}}E‚l¨ŽÖ{•~|£ÒQÐÇÞ¥]õÖl¢ëï“§&;Ë̸EnÒ]B ~4ï…N3öЏ*1an ÖYškG‹¼ÚG]XŒ}͆Õ|3Rþ©³|# æ/qmÕžègÐu0ö#Xˆc)b3ÉØ¹îZ4ªhYùçFc˜›¤æ×Q•W½˜£"3§Âé5ˆ•9“)].0ÿÀSø.O@¢§ùwo«ÜxxØ——=Á›‹â Ô5¥ Œªóªä2ß™˜V7>lxû>®Ó˜üöVu<õS´$À“Ýé + ë|› ¾‘bï¦ J¸a<š†»!'·ø•^o Á³ZË2@õl[{Ñ:QdÝš¾ˆÁFÕ(•»'€—烻ñY B¼AQ˜ã™né˃ƒ%×ú÷cöC*]d&i€‡H,dòöy³î¹÷;d!Iï¾®Œ N;ÞçaC•i©("\T@WªjùÎÃÙýˆÙ Êš±XkR®<ÌdÿÎ~Éà +šÄYºtyõ'Ø–%et,)bÿª•Ö#O;Øê¤¿Šð%­ç6¤|, ðrì +ÜÎñׯÑéý×tØNƒ:O…c£¦ÆK›õ©ÚcÔÂKÐeŽ +-x]*Àƒ|yÝ8}6T³ˆß÷Ò—û ÄS—•…50Õ¬ž)ÊBë¤Û¿êW×/V” +-÷²M¤‹óB'Åkp&ÌÂQ<‹ã¿;‡þx*µ (»Í“}²âéoÒÁæ±OfJh¼†¡‰€–ŒQ¤cíóR)Ã*ë.7Ô7@ø,ú í`T‰/*‹Îb?ÚÆØò‘}´r’ùÙbÊŽ7ù‰Š¸ŒJŸ9„oé·{ ¾Ø#1"ð!YŒ£ÌTY5Ƹ0;ù dd.©‹í­üUØ&„°uÇèÔ(ÿgå½=TÒ”»Ä°@x‚ÆT +Í|ÝÀ6±í†ú™âÞ\o=••Ô²²ª¯:¼¹¡Ï¦¨¨d½ +ÕcTÆjT!?­âi"×Á¥]@=Ë#D¸…,9À`‰¥*o>ž¾mPÖº¸‰B:8ürõB:€g}¹)Mm#°kR¥\²PáFˆ=E èÌNŠhÀžCE笮Â;¬eÊÅ…Ÿ—.[;/(\BMú6ùÍ&‡è ó@ÏŽÕä$3¥=ãmE N³ÝÛ¹;§a‚+¢,Y{# XD»|Å’?Ý +««˜¼H¼ ®S¨ˆ#† (/»W¼Ç4°ð“+Nµ‘Ù™.!CQ䥤K×ç›Ñ\™ð£®8kš2COkD)dÐíɈ·žC ¼>°¢3,$Eèý¹þsy³ã€YТTŽÇÏb/´IK[Ç Û¼YSÎ.󜽔#ŸáÍΠ/íÞÊZ,ü„¿©àRþEé3œS_»\~WÛNއx1ÕeQû¬êD‚ ²tÓgD¿’ý£`ƒž·Ò+Åca½ÉgÉÏTÐÛÄ)*ELp»Ó?£œÛ›¥ê9èÍì8¨ö&ÉÍ~rÚY‡ -Ï[Y°‰¤ªBºšÐb{g¥&>ã,ÍûÜj9¬›«Só2½QO»XÖ%K"Õ +Ì€æ=ýx‰u–~ŸFˆ­QeÌnb¶Gõ[–X6ªª\ÙK¦ŒªK_Êa­ÕQU>ŠjÁ®×Å‚{NšžqîîjZ‹e 6€ž¨>Yn5Q5²Ò+ŽÉëLDÕÃÓù¢†l¿úìÌ`Q¥Ñò]+éÎ…‚Dõhþe1WÞ|ÞôË®ÿï©™¬&KªÍð¶PGhÝ<%Ñ»¼‡Å1e¬IÚ¨¾a¡’'ô-´ôÇwŽz €‰ØŒjÈâØ×ØFUΫ×òn‰QM"„Hu™‡¾~ÓV?jI±ž#‡‘0ö/¯"Õ’Gá©òwAB7 `¶7 C¶§qõí]ZB†6‹\ªr›þ­åA4/¥RÕ˜‹¥Ù,Õ’ÒGˆPªåßlšT—w6Ò벉7ZýWùÎ9ªr©GAŠ*péÿzŒl‰ªŒœæDµÌW˜’é+<òg è‡0¹_¸"(ªªG^/à PÕŽçXÛÕçC ¶bqvæ,ÃM]‘&CÖ§ï¨ÎŒ6ÂêÑ«Y˜'ö¿(å½AàK*U EøâÓŠ UXƒÂÍPèGoá%Ú1^qRµÂ¦D +#L’<õ“lª¡n%þ S—Y™ý-^ZF3l ´‡Hüƒ’:Çp™Mç`×í÷»4èÀ—» ü/lÁê²—‚×Q% ,VØŸ®ë›y© ^ï:ÄcêÐÖøäX© œ61}khßÝߦªía?Lé¤îá 4¢`‰YHnÌuƒ +ñ8`Ñø‚û¥nw`ê©@UÔTŸ<êËDÒx³hTÈÀ‚ÉÀ­ý>@Á vì<‘®¬žô§Áü º ñäÀx½Ñ |ýºŸyÏ’‹±Zdç»ÈØ^†ËB¬ÌözQá7…6dñ5 “Aÿ~Ïü±Åœã*´‹oÄ +. iiD`pUën8O lNt·˜g<ý ÉF8T‡’Úqƒ‡1",]Ȉ6:;qXé«Öë᜺¯üåÊ™í“?ד@Ä´ÙääJ šEÿ:LqÈ!ƒzZ›oÈŒÉሮd`u¶%øjõG(¼A”š@ǹn]ÀɲTYAÜ÷¢xR2Ø#åÒ·)¢!»{W&àpAÿ lhEÏ¢M·ŠªfÀ/à§µ¢å +] ×`<œ«Û«'Î+Œ6¢«f\`B¿@Ò9õMO¢š¶ +UfžanmM-îý¸O2ÄÙAëHiŸ°)3ÂJ&ïûõÌ ’ÑSâãgÕ"TâNÆ´MâÁ¦ja^àSy¹™XAª—þmpEZ¿þ­ˆúÙyŽ­ÆÍ`í踄¨nF‡ Ø–›t{¦¡…x¸Ð„£Ž¿.ý§jhaf‹°z;+Íak·'À:“èÚ ÓÙ ØU£ØøÉ\) =©–U¾Ýߦ†Uu×AÖÍÃÉ×õèÔžˆ·³x˜ÀS»ßuƒ'î<Ý—5¦ݽx–‹ TÖ™}¾b@ ^,àHÈ}ð`„š§|ÆÃWèŒö¹ÿÉž~Ën¹´Çï@å þÓÔ­’Æ Q˜jé–aÞs¥ìÊÀâ»Áê†Ó4Õó `˜¿†Í\ ÆpU2âG}d2i÷¯©dS%IBX:éÄ Ô"¸b©±ëVüY‘fÈRú=&UZŽŒw繿BټNj±ïº#`•›íµïw§Ü±N­h+ ±Z¿h¸¶ÒŒy^¹ª fxM"+1i`ˆÃtƆß»¤-söþ¹gÇî +Ãȃß=˜hkÛ$h\»¶øFr–.@³ ú{_sï „†V“Ñ ÛŽÕÎåeS=eXóW³{ï$c‡U‡3àëLWòËgÛ¬/$²Åþ7Åt¡z~Õ!Á‹çÙúªñíâíe¹`Ú€B¼žuœÂÌ£ÒrÈ>EtAd‡1ónm®÷K$w½[—½eà%»3œ¯!ð_§„÷;´øÛ§1—Ä”‚,ˆÚÀÀBŠÉÿQ1ÈÉ÷ŠUµ¾+ ¤ï o½º3úM¼vqJŒ•¤ØïUID±C<Œû¹eæbÑ=‰k`‘±´¨æÁ gÖž›¨÷bBÈ肬]ø’mÉ 1>~*Å ÖÓI˜Uq­ – R·[ÚdúEä§2Ç=ø/Ø"Jìé‡<í3z ÕØ¿ÞÐÕ9Àý«c‰·”TIéJ¾X¡”Ú„”ž$–~ÚŸ5ŽþôÜ ßÌQLÛWè¬ÏŽß®ÐÞmÍ4ߘ C¸¤€³™ÑáÈ}”dêâ“ ¤ïµ=ý{à >ÉÖ3´ æÒK¸¥â„> šÔ <Óà2­ŒOî•ê¡M/IϾ»¸M-Te‘û€kA´ÏÔàýÜ›Žë±9ìáñD!lÈÖ NCwoíÐJ­p5H"¸× ¡„è©Üà“s‚Á†{ÉÒPc» +÷Ïšg¦ h cÍ^ã[¸Œ,–r`3{°ô5 V[¯€@›û®¢‘£ŽÌÿº>£¿3g"w±À6‰VÓ«5è;­·HHb7=­Î­ ˆ’‚À %ìæø`AH q[¡ÇÞ W^‘=Q¥ ã–2¶zXÚžÅêá‰åHÃH#Û} ˜-T2º™¬½„,½Öí§ýªG“a ƒ›HcœìíWm(Ž{г|oUð/°n&[†¦ažX(î…î®_.³Ê/‘c•i¹…=L‚ÝnåÕY`žV©õÁ™ýöa÷µ¤ëmŇ²X'¬#B?¡¡ˆï:å³KÍiÛdã‘ÕÃbéYX_‚=”,§¦ 1Y_Ê‹ìÙ:oìµµàCÓ¡rT‘…}Wð_ÜÁ¹ª ¦…ß× žjIª—±RæÎ‡êôËöŒí¸KŸc¤ißLã, §Ãcw±¶6ØÛ¢ˆ‹dIѸ¯Þ´ ØŒyøàÜxÖ âBßáŸßæ;8[©Œ?ëñYbôôº”äa? V0²Þ`³ÅŒ!26.W ¦~‰9”{bÞë,”Ïâó•£ÚÖf¯bZ0)øÐDø^ 4.!iºüH²)T«X ìMF;¶Ìi"TÛd3h´ý\["#¨£‚ÅñlN^vÑH³¢ÆBÐ/”7;›ˆ¯$‡aô醸`/Kúó;«;5N÷c®“µáZŠÐX#þ—&™ÑàÒo&eNŸ¬“¼Í×áÓQbǵh껄<ôºþl-¿Œ­ vß%*€èìÑãÕï"§= B1æïÃ4^V§ÜQfˆ&"‰–¿½îЧü<°ÁÜö\zFá²%þ¶oÛß•R¾m HƒAWQÞU„*7ƒÒóiºNMÐñ«UÄÂõá|Ê›¦Óó1|wåÛbºAßݘ þ†à»(ÁTøÚÁÀŸ²§û|Dzn +hÿ¿S2Áɬi̘JÖyŽûÛXŘ)è’âž%”O"Xÿ"ª²Ø¦³{5x¯‰‰©{ƒ©g}à“Ó–µ>”Ù\r‚FˆˆwÙ2Û"nØ2¸õ5¢ÎŠL%C!1'˜14ô‰ÉlÔ\ë¶Àá©DØÕ"Pª Px‡°®ŸåfîB‚ ÖÞ¼ðãpèYÿê}L†ajN±qÌý¦ ëw°¿$ø<7€2ÜŠ=8(]ñïìÊy‡…‚¸ðw¨­˜1Um¢! &m*8 y—þzhI+úÖŠÒɲ¢r2€Q)¥Ë†ÙiNScMkµ!/Ù(ær«ýUƒïìÜÒ"°ÔÓQF!Eòa[~ÛC„§Ûhü5ôǬøè*g×ÙébëÃUÒU^¤Ë´a„Æ0Úé(žd{R.ŸüNMÃÆÒÖêò9”r$´7Î?|`ã+­†üGÊY¤ÿ*y]¦e¯ØI¥CAÉ®Óý£+†âE`n`È9A‹Èè¥òš4¿,˜é›»ýÊkO2jlbÎ9žØKú+idqMž³ì¿Pú+ QÈöS~G@¥EŽ5Ðýx`Y¼®†AÛeeP¬ó¼ßÀñ)éfN^·m˜Ô׌¶º ë» +(Sƒ‰Êpf Rìl>R†ËS]å¸EÊ\œµ[ÃÆÈˆN+&sg"é˜û_@´àùy àyN,œ©’%¤ô{`ëÄHý6Ô][ÌZýÀ„²ñ²0ÎßÛMˆÓS“­€ÛGo€1j0Á.°n>˜ŸÃb=]¡{½ýH +Šü;:ðíÂq%ó$ÅÏ?¡ŠÀ4¬­~·/›RN2[#ä7YÙ``]¹ ê]`8+'|g5È+sÛE+ïDãvt}¢²ÿHlEþ[~½DƒaúJµÍ‹{kÿ$óTÀ•„K¨¿¸9‰Ï‹ñz-Ãú€Ñ2ž‰TEº,ÿEm°xï¡þˆ8{î÷ »ûä'ÎÜêç=ònÞËü\™Jå¼ï‰uaâí|yÉ„*ÞbÀ²”xræMþ˜³VøÏäy‡aÉwN$I>ÜYäïK +endstream endobj 20 0 obj <>stream +iqýûcìlgw}"ÎKaéås‡_m],JÐÿ±Î¤øK10 ¡¯—Í{:Jn‚hœ¬Ã‡±Baèþá¢Ázc ÊŽ Eí ¯âÜžùÕ¦4ËUô^…Y0Züq(ÓÊ!‘“-¦‘jÒІ’ß>)¸«\R¹—€—QŸ ÅÜAù:›cWje`a}Tw)kÊ£‡çƒBÄxZÁÀ¾X¢<”æã1@žaò®‡› «ßå ´PùA“(AÂ`žÒu¯ÊÒàä@|^˜Dkwõžj“ÙÒo+‡ùMª£$%k+yJÛ +s‘m6d#@¿½)o% #±Ÿç›¿ÂJ²YÇ7'G¾#bOyæQN‹éA Z:L¡^âº×Û瀢‰†üÃ¥ùqט~ê® +õ«c€ã}Ë¢HÃŒ3ÙàC­P¢aF6¢+×°ÌUð½IÓ;ú´èî—"žïl=ÆèBÐþÜ|° ÚÒ‚ï–¾ •ê $†u¹lo *ૺ"%h‰‘ +Œ:â +ˆ2£³óÖó + ²†éL,º¤u>Æì¸Á+ñh¶6Jc‡ïG…ß[xXL¼mY¨ ýhó î£Vg-”B`؆ ªú¶7ÅAËvqrN^º:o5Ï«G„%e³ Hsúƒ³ª™Î© 0Kä'S”Ïa‡VäųÙÑÀ©|äí69J2\Òð}:W\ã¯Áôöú¹¤ï(í\*Ž=7N˜fÖ‚Ôï1v¨—*&`[€}1”³Bèµtñi‘­+7Bð¾þ` 'HºFÓ¶ö[E7Àžž“¼Wãºn3fƒ+é­´þÈS7”U-?÷~RÕÅ*Bɺ.GøŒòA!»É5ÿ°¾¬öŽQEàT!µØt}Þý ý_ÐÕVü¸$4È`ÁŒ ÐFA úÖÜæ* +ö¥ô§õøõ69¶G@Ãr”žkf©Xp7è‡S5–+¥ ý¦n{ßì“A>Ês*ÿI!ª0´©\õlÏEÿ:Pk ’‡m)‘ÙÅkµµTà™½á‡qÖ"œŽÿ§˜VH>/ÈçÈ݃q ¿!?69g\²üó[E0®‚¹- +5á}ÛØÞå3èÔ +ýBïJÁZo‘x"'ÕY—6°Ú²„cO°Í(ÖJí²ý§ ¼<Ó²ER¢j?X$uŸ¿ñe¢Šõ÷ÃT±„ó÷4*µ>¹‚¤N›ô,öÀôWÌGŽ“½µŽÁ¶©ÃÀ·‰æ>äèÖên¦“Þ=ÈÄd]çÜ"À#ví#CⶺEÙê‰Ç&áKðoÊV߯™^„£€cæ\ãÕXN·k6½?ùëãTç© ·®kÁº¢Z²ÂcÛ뿨ÀhÑ´jRJôm)€¢éžÁQýË‹’C>pöè3€!ØÙ +bóüfÝo®ãç`3‹›$V`™ÌÁR]5”Œ}²a R +p¼.¤c’ýÈnŠ \CµÓºu´hX>ªw™ýãtÝvը䮂BXAßË—©Y… QB™=°š!²ÚzW2Ùª_µ;q¦þ[©s7åv.F‚äÀ 8‘*–/e*VŸìFšæ5eGnßx, \ÕpÇìè›*„(’Má0œGÌe85À]ÄšõŒiK‡L´JÐ?j^]³Ã;ÜTáЮüÓ¢ræa5Þ =KVÓwiCÄ‹º]õŒŒòäó„|Ez3=S‘À +Fz϶Mˆ^âxÀP¡êŸ* "¸kÁjÈöŽÎÿØ“€µÏ·ÔDAGÀX›´b®+fÞ@óW–ÁoI°˜½¦e»øHâ{iÞ + G¯µW(qÉÏqÂój=èh©Å@²ßi[4(M×ÎôZ†ög§ã¤·åUÓ#‹BK»Ñå­#ä"ÆníoWÙy}¡¥îtïZ'pËkè—A_EîÈ“D뎾b¦)¿ÞüéÇ_œF!¢>¶7¸ +R*дRzÁÈC|Ç•E¿ð~!¬.z¯ê£åÙ7ÜsvD/ÿdY1L1ç07=Sˆk˜»è†³ÛŒµí`åÀ! $Ê9k#1Öcý`I©n"ž Ťէj¤T¦æwïU´ý—ÄÓz+ÓŒT`‹ƒ•è³¼å 8k7«i^ù@hQVG£m}¼Üc¿=†WÙ¹{NÖŠhSìy b¹æfí÷–x’‡žÃS¡Þ|«ÞÿZì [.Ì.÷ù!&VA %5õåðHJ2”>íœZ='ç#¦Òˆ¼aD^&b dÑK…ŒÛç;$q§HÊlù.SzèU ÜIH\%·ÆHK ¶´ªx´ŒÝNèŸBÖÀ¿s€ùlÕª +w’­¾P¥¶ 9ZGÕGMcGªChµæK®GÓzÿcæ„ú”|PÖ,Â)`ÏìÏòÔ‹æãʃ«–ï˜í…Âi‡$‰)vQ)&áþ’{¦´ˆ¬öþ¡CÊêR7ë2ËÙµ5B÷Ùt¨ñ!”v'Ö=• &ض^ö$ÉVžè74wTNTÅ4tzJ ´Êë¦ýz91¸Dı¯{63³™Çz‹±Vâ ˆ¯RR.†UkÖäÖÂÒEÆûA0Ø\7‰ó‚ÞÄé-XðéH÷ÁHR!N8·­”’€Ú; ®v'úØZ„‰ñ°=EU’Ì0>€k %T’Ì`šÈÒ¬=n§³‘dXD¥ì½. +‰2ER§ÿc‡Ù;3#×%,„¡ýð±gÁzƒ^–/,ß§"‹ŸJ/.Þ5нZ™ ÿñ ÝàÃëgݹüŸ“DM/ÌPê¯f?ëx,‹ÀXš‹–!¹Œ•…\‚OVìYу\‡óÎJ‹“òÿg¸÷ X¨Í‚Y“. •„çí辿٣芔GŽ|U«‡€Wý'€ä¿\©¢yŸ4¡cqA'ôÞ<{ú.¦òMZL+Š‚§¢•"È…d€Ú}˱•tñˆ³aò<”-ýíĵlnÍ›»Ùªt;3xAI®3‹" ¸#¶’/©âî_SóMA(« M …Ñ,°û®9‘s¶v*zíU$$z 9Œö,U#,ÃîQŒd~ÛPW{ž9dpè"Ì@fÂmXBM\€ÓÇ¢™0pÆŽg–ú×#àAZW[Á¸Á§hן€j‚¿¥râÂ4Åv¬Qäot7Õ' Gf„daµÕb5¾'< ¥¹ÅfþÓШ,„$ß< + €P¶N?N4 h5 °ž«„œ§jmâh!öæj0œÚuì2ßÓ!.†Qˆ¡çÑQ:E÷éàKÖåæ=ZOySê‚n*ˆ“\à@NCi:ìÖ©Wåö™"1¹ÑÂjØ-HìavÅùìÜù‹q‡úó›QvÇk‘8ßj‹iÓhŒåý@ gh§Gô|烷êEqüQº%mßâíÕ¼C A&Lx¯«N¼–»'„!G=†)ŒwAh£q!Šó"P”“^lªÏÝ0D±’S Ou‡{ãPäAž(uÜðN·'øÌ˜Ø@+–~ÑàÀínÜ$û6ý6ÿ'²¡@}šPS EnMeD7„”hçˆÚÚ`À¡^è 97]Ôõ䥎Ž@ôsNÉ–pçV×£Šp¼4"¼“S}mE¥DR•R Rû#zÕÑ;5ØZ hh—ÚÔú&o‘/’œÄ•>#ƒwGB  LşöB˜KÊ É°Ï +fÉ~wýZLv‰:^¾ýäu/†tÍ ‘aÕTºÄFzþ1Ź ĵ"‡‰ê9²ìÒ~pžÁk±±a>×^(h-pÁäS+F/àÔ"ŸÄÝìðÍd)y²)Šñ(YèŠLÅW6ˆÿQncgÆ#üEp:á… Bɺ†þŸúšk²s „iw ˜ñØVO·ùC<ùMfPS¼lFÑšc8ICò£BTJ Èó¦·³¬«úÓúdÜ託 ’g`ÓÎ ŠäëòD%R‰­¼¶ ñ°U1–ž ¡X1PˆÚôh=Kcq«ƒ +Y8÷'’ ‹²z['•õ§ïÓýÙÀÂzó(¨Ú_YÏ̸[Ä.éAºSb̯8¸[œÉ„¹ ê¡•dN0})C¼‰®*Ús~ðŠ\Øga—©_pÔÿ 6ÿ¶ßý(¤t5aÄ?m&U΀ ûÙH@3CÎ%‡û$…e=4MþáÜÆ"‹Û4xâ&Ê*ÏxìƒO¹¦;‡+S) ”ÒdÕ¯7 Œ† ïÌŽX‹ŸÅ ¡ËÉðìJj`…ÔtܴƬ=HÆJ³FÝà±í¬qR‹¾${y%–þü)WWC1ñ-'aÇ4Í:Œ‚šsm·qc‚ …Š^å¥ñ/6£Üæd4„ 3»;·Ñ9pr“môè±òÇV&|Ü–ÈT¶'aËYÎÁV“l ø±mkb˜î=÷(¸|x\€J¥På¿=+ûC^ÉœwØÓÑÔ§eϰy†A¯£ +¤HÆ—ì² UU“rg:pWí’`j‚ÃZãæ?áX&ML]Á¦ž+ !.ð|øIôR'–ÍþžbÀ%Ùˆ‰ÙY^ù<Ê.š×þŠÛæ ) ª—1Èq¦æãUê¥9Åeð´‹uäèÍÏŸaL +Jãl“³ô!+*¨xƒÓàÏrm½º4Þ'0UÆ8 i:(K]qcìðSÐ`Ià +ä5%þÓ'srËþô,F¼ˆÍ±0F;ñØÐ©6öÔÅQô6™"Q68Íx«UN´‰éBH®6“Ör?@È™— ¸xµšvÅ3r¡=H¬#H&Èa)ŽOÌ4]ú›©sК&Ó•OÍÓ8üùðhjý|HLåÀŠÖ~‘Oy¨W5ƒçN%óxFe-§ê›*¸2"<žf²ÌuF.ÕãM÷+7¥³S”åÇÑ_¹4YK²5ƒ^°/êùs<¹äIàg‡‹È¶ð¤¡å-Ùäì‡Ë*8Ü#:ÐþZÕ÷O!CŽÜ2¼u³ þio`ìF2§?$ p/ò"Žurëì³k (ÊA9»60BÔWd:Ižu±·òBR!¿ €aqžf."Ÿ¿Ð 3`©‹´éNcþÀ4´Ðo²ªé¬´VüRËïH!%œ‘MÜBj‹RœRF¹(‰Ú´dœîY¤¼ +o©ÕZ.HP… +th…îz‚"× 6u†lk ?XD¼ÂÜ¥ž˜”ÂÌd‹—'\#ìÍ"t-‰® Ñ…2S,“ß)ÙCyzPçé\qnÔ²YšçàVdêV`J“êÉÖy°v½$—BU¯RJ j”N©s[˜zýà  µ#Ú\(€(>wŒ@µ#Pì–j VjVêðè”°îXŽ|àŒ{jåEÝ*Ba3s]¾Y™v•ø~d'?Ô¥×Cæ'Àç×òPFuVÀÊFxeô¨)Ü?ýŽ þa¡çèå§ülP­ÁÅKãôó}äÿãâ| Oæ"#2ÀÇÐÃU:#KÆ0˜Ýzù*y%¾UÙ_¥l4š8OQ3+ÞÈð%¢sÕÜeœZÄùâ|á9j*ÕCmO r2¸!åÆö` +l#oD+ÔHý®&çžÜÍÄúL}Zb_‚ÆUê&Ë'C^"·½tp£*”ÑÇ!ãu0_zŒ)eÉÉOþ~½RŒ 2”ÌŽŸ»^Póh4ÌÌ!ß—s‘ß``j)€¡€¦Góþà=y¡šý3ëó}õ'˜Š8é-à†C¡V`á+C¾³…Nâ4r.,EShn­*ÔäâÖ!"[iM WÝy4¹P‡_QS<È«:¡9®¤ûÉ7Ž™ösJÛ¬µ½ZḃZ‹qdp9 †ªÖæ_ÕžÈ×3oŠ2iÉj›ÉÑŠh&…—%, ´½$‡É&<±¾ŽÈáY!ÄÓÎØy3èôo9ÿ*¥æI:Ÿ¤²o‘X5,ÔCºKä§e@Øß0#WòÁ WéY\ªç +çRÆ& +XÞnôH˜í¢Zî´Ò€AýÆA#`¡æà=;¡eÁ*º]_íïBðͺW椆pOÂ*À4”0&øõÏEë¥Tùáo©gU^( ò1FÙˆ21åi º_狴݉Zý¡Oï"TBÓÄßF7wÓ³„xðãP?›óxv7‰M4ØÒÀÎê†})"Ïy0´ ¶°Ø4¦ëbê15§°†ÇòJFhœRuƒ ›¹ûuíÁà_N4دûà÷ÌRp€ÂÕ6VWÒcb/*Í:öW8Êþ‹SÙi‡º“:WØ{%”GÌJ4Ï~än©·üò[h +;ˆŒ?^ $¼.°Ö‹Üù¤|¶%Ũ˜h@?;a(GLťєh¶9D +ú¢C;ÍÎEb¬mÊZá_O¹Î'AÒ\VÂß_-pÞ‚¯‹’ÅWpò雬֪uv&¢ê§ª½Ó¨g—̬zUÿ8þúM{ØAyj¤çÎq'š"d£È.yŸ€]ïßbn+‚ôÃpO!=\£þ2ñ)?© 5ð3ØõÈÙ4K©ïÍV÷»:½…Iø©R ½rªVw£ôx£$(Ðì/_œÞŠßZÞ$øgƸC¥òøöPGÕ=©Ê¬Ç%ò£ÉŸb\¡b»ª”òBüÆ®OAÄD)êÜÛ'\0|~g±œ­Ÿ%›@ä°ª!£l©ŽëxôkÉî)\ñ§ó?¯ÓD â¼J-‘ò¤]FŸ¤¥k)T[00–x¤IÇ&X≀C úp‹%ßExBîŸ8 ›¥ŒìÆL3y:°MóRäÓ„PGIͤM'ê_çÈ™êVÚnÖ¶ª‰D[6ÓQ‚ÙI?•·OZéè—ü4 ,ƒ!^²2Ù˵2¡Ñ±ì£Â_ëß”1âýƒÎVyàN<ùåÖÔ£qý®žV…I÷Hš-¥„çßeóó$ž_n¸î›ö¶1íröãì…îý…ÍVæ¾úI³%%—çÛI”ÎÓâžRªn=¦ïÕ*t{µÑx-ÏD=Ž£ªl+su7¡g<¥éFuôϵ¿Ê#½]&?3!úˆšÑ¹¥ÿ–óN¯D™©²;X«ã i¿´BÂÖØP5ÔÎÔ;þ}.¡™Å¨D1¥•î)‹·êû`—D¥U•3zÎN¨ìÑGFÌ0«s/ðŠ1²9uæð]ËÔw—’$ @iTšüq™ºr/šR?_±œ´®rì'“n3¥ˆ&÷i]ލô¥ÜL£ó§šFO[/Ñ[py+7Ï/Í2eMäcŒÈ^{¸/æ&O[–2oÿGbZÇ&°&r+Ö0£•0œl^ªÉ¾½‚Pé}Q\ +ùèE]JEnáûHÁçÚÆóúz½²„-¶Fð/rF Uj˜Ä{Aç~PRH[ƒç³8|öjúè>˜ª ‚B.BµQ—åÂ~ ‹ÏÃtÕþ©‚Ei’Ò;¶¿sž{Añ„‡}ä¼3®úo\õ@8hÕL”Å6>¯—ÒÊ Ê1¬#÷¬á–û y4,D(žÓ®—UºSëa®gð{ùµøŸ¯–«hF`²Æ^Ggs0í¦ñî;šÑŠŠÉåßËP8hsQ&À½½ª+ ·>¯™3×T&Öšö áÛßlY.H„†2åk}iù 9Î2^«xy"ýÑ WAFc\%@cõEXÚ§fÑ –f© ‘y í‰}khŸ$%ǰÛPgû¿vñ·$&úoaD†3±y2ë÷Èô÷iÙÔ†XKŠøÖìN[Yì-Œ¯š²í÷“ML®#9ͶNKªØ³ÒôFé³Ã{~<­<{cÙäã\ãƒdN¼&“1kØhi­ j¢åØ'G ƒ­q©ðæôç½Jô e¸)Ñó±ð;!†ÃÈòµw;`ú­%;ØÚgv¨Z3±Lƒ.85óhüEý7m6r‘Î%€ºu L9 w;”Ë’°?Oêœrv’²P¼EÎw±¼¾ˆBK^ÑA˘R倊X>—Xà±—e:Ê‚.˜ +Œ6•0rßUãoÃð”¬Bf¨‚NZ î¯ZÚBW‚22¦Ð6E‚1°åÿ§‘à™Zî[68`©:µ{”ÔYÓx¨Ü +! +íù´6<Ã,Ã’”B!G²¥ +6»Vîíˆ0Dm¨n™pMÔéý(÷ iHR1$Ce'~dŒ¤IÒ`úÏøŽ@!Òc;S¤B÷€,8UBKû¢šóhô@>gÌ$t÷´dšCó}ÚyA÷îÖI|‚G¡CÀ€““ +].–×çu›6+m¸…8T”ÿ÷¸‰ç 2Ñ"¤e$'býé4>xòÚï8%ê&èÕA8dçӭ R4㽺˜ 5Þ4rŸ\gñDX2>pã‚^yƒRÙ–ñÕò·+«ì*lò)§²I‘‚÷ù˜›b¤{Cµ6¥Ÿ°ÙæmFóA™ŽÉÿ #-s–7,a__ï¼e_y¨Cü(ó å—¤²ppƒ8üL•¾ürXT7n—4¨ªvð˜§&«ðÛÑÓ™µa(©}Fuû¤:`Ngê#*W&˜ÈÁŠ|©¼iÉŸkV¶ô‡ñhEdh€ª¨ÿ°G{vÒ–¦àÙ ¤ÔF0A$Äš—"µ{ÍY2_´×ùÖ*-䥨W,àAåYÂǬÎS¢zÁ/4éÂC©ÿ¬F‰ÓɪÉ_BU˜F<¹PÇ ½2^èÊP»µú¬\*ú=„@ö¼´kòÛô§wT¼¯*i\7v·Erº½„LQ R?§‰Ð•ÙS”tV[Åø#yïöòc\lT½¾gXJ²ÊTšùq?®ãhöYƒE…Ž,?_*«®/ÃÅ@~Àئ_­ßº8âOpU|Ì»mEçQ&[DÇõH!¦_qŠöâ£]Rd¸¦ì\$bCjÊ,«ó.ž|‘Õ9;$”Þ­ÔkE[s#OƒMªZ“e¨7;Ÿ!*l⥚•ú%+–|JðŒ)W ׆ȟeþKwýè6*F@?×ô;žl¨ Ö7ú•eöá3×вl#T#L:h=#æ üK)V-°¬"eÜ'Ë34^ï5üDt²ØÀ¬Aì”r$5Â_Œ“Êœïþ{ÑF Ÿ4^A¥G&PKûïñ6礥’@œïƒœÏF./>ôA¥1¯?õaŸé`ʹm†.žZâ—©v†íÕ½”¬ú˜o>RæM.ð#Àž4Ÿ¼ÏÕ‘†iŠg›¨@€„m§}“‚—nú¦< wâ+¥š0ÍtùÏ.†Dæ˜l\ÓDdï,ƒ¯í~~H¤J9¾DRaÐØÄ÷­1±0»~Ï%Õ4°8ðìׇr>G›õ¹¡–îCq‘øºÔÿ‡mD¦"Ÿ>²F·›ó<'o~–úð§÷´×3ÚàF/kÁw5»vB‰YS9^X|Ä–C×JÁCF~¼ŒiO2CQ %>?Ò‡ÞÓA²s€ÿ|vðNw@4‡­9žljž,Ÿh +¼}îa”¢Ž}çåpV*ŠäD/ßÁ®#”ø EWÂJ®{Þ¡}‘Dñs¡¥*ÔŠwä}mƒ =@jš4à`ìxixÊÜUœµÈG P°«íˆ:ŽÈ•Xèkӡ†9牳ã!h3[»%¼ûÓÔÿ|€ „@N _©‰Èv‚NŒÑ*ÍÍbGKÄûèÔA÷ÈIÎ7<ñkÂxaV·™  >7h0‰ Ë^©!#½¥ G„ž1¯øÜGLŒèE B뾃9ï‰ðxç\¾lð"ÙÙEç8LÄ@u@uöÇ”!A™Àð9s…þK|–Èc^˜z ÄaD\ãnK +'zÊ‚n±â„Nn’㇂–è2ÃQR F»&·ziS©1Ù…$œ:âOZŸ¢©ÅA „ÿQãš7 hŒxtÎ󔨭¸å†7 w;b`Ǩ}>–5)ƒU™Y* Ô‡ï›Å†'VÂCdO2Á_Õ%Hà !»ø» +À‡ˆÅC$F ŒçÀ\` bŸ÷ÄM40.tPÝ´yAÜEô^+K½‡‘m¡méþÌ·a,23ûã·žj¢¥³lÊ=LlÐkÂ0úmöñDPúáâwÃÝL#/P¥òÍi¿×nlc¤+uä÷~#%- +Ážé<× hR¢ðÂ÷„zgÖ–]6òzŠŠÌŒìÝ_‰¯“¹ýø^Ϻò¢7µª”qk…é1 +ˆ~p/9Í_©sýáí-OòÂ>ln +}ó²&Di>ÀÃðèZ‘ €€ªªJ€B™ªJU%ä$@²N &  ´ìîÙvwUdWE¾pd ÒÜ]zËј4w7ÕvwUdúb(»«"§Ã–Q5 +¹!9¬ ¿eTs  ·‡fT³³ &ä&„r—ŸYš=¼êñPTÉiøˆ)f¯fFµíò hÁÜàÔ|¸¾GÁC fK×Ù|¸À[Q0ó‡7¨òЗ½žÊ‰u¨ÓÈièPå! F£šŽ€ód!ØS±<äød©<ô·€Àýt§Ž¿žJ‹†°$§áìúÕvŸSAÆi ªlNiªlvâ´®»SŸS²"ÍﻆÔ4º¿šF÷7K>ÉŠ”¦ÈŠT^íF÷ÁÙHž‰ÝoéšÓdY‚•†?hA/ŸäFS•_2¨ý|f©ÌÈì¾ÆÛ`4¨E”°*g¿ç°6Ü‚PÔ…§ýw -% ¯;êôk«JîîÈéø‚`"ßbçåÔsç>’Ä‚ªcf0!í,ôa‘'JÝïf#‡‚•†0GVl\줡EÂ` +‚·€àCº¨€‘ ôr‚=lÃÊíjì»o«Rj¬ÊAw#68@óåÔØS×òñÑ‹>#zB³ ß˜DÜàôÏ]¡öïÇ^[Un¯­*Û[Yзt9ywºm磷t½^n®’†p6šûÆ‘æ^ÉÈŠ”õjr¾9¬ýNô]Sób(»£«Ýw9²"ÝC§Qö–ÁÐð³(Hê[@Ð]³l€3\¬4º_0 iœa d’ kÉŠ²yùPGŽ“Þ‰a#* HÜÉ:„>Cë£zŸê4qÑåŽ;õVyábø4FKN‘%G—ñänÞñ ßP'ôшá {Ü=JšáœÏ€ã3N£ìÝ+!);M;“V:B¾c¥ÑýN«“DXХƪ$t„wvÿƒ8qEÕwÆics Õw .›ðneëzÖ‹iÌ眸Oÿ~dχֺàÜ%?¨*vŽa’ƒÚ~µVO7LØ$}DäçÝЭæ^¾]HË]#ÇKWk¡8ÚßÀqÒó,«i5p\hžædÙlG@§ +u”MÈâ ÇŽâ ñ9µ&6·€à†*¡Î`LجsMÆ_æ¦+€3Cx”¨èÉø™_# f%#spGâÛ^Ø€md\7 Wã1"c +ê wˆ òq  +="†>ª÷yÏ$ŽZAA ƒ<ìfé: ƒ|v†a$Ô!9áá€,ds žÔ'd²sQøËrÍDß‚@I„†Ïf†«C– êHŸl´9±‡1vsöƒ+…³ŒzÌáŠk ,¤,2^N@Š2ù0”P7€ [@°‘±£XR7,i#Ò|jd5oMßHK.å ÌG4‰S)u™"[@àtšî¶4Y¨£‹L´O- ÜF/ýû°îˆµ®pPÒ·€à`!°ylœð'ÒWÇcöVär ¼±“†³D§EDnwêmE¨`lI€…Êã¥Æ ¬)»#ò’œÌDù¢)YÛ"9=‡âê¸æR RX÷ܬà× ÍðI¦µ;ŸÁã__ãö&ä’Ù!FáÉp|B„›‹>9<æ{Ì2CȰ_Eó†ð\bA¯*5¸ÙuÔÕÁ [ ãþL,NtpYî'¸cøá0›Pqß‚ÊÂ|ñ §Ú¸{:?' pˆ|F¢ %¯@’fø +t97`à8‹Ý†9‘—äøM"ÿcMJnF á¤- ÀY¦å|™åsµóå¹SÑ?0xB9‘»öÈ»Ê.y¿ÎÉ8¾y¤Dê̾œä?7pšœ†³DÄ$ Ÿ„«tc’ÃÚð£†Áâ”}õ4)÷YDô[@0f\߇D6 륓’ÒÅJ_ÿ.ÉvZÉþR€4ÂCK×®ã»SNòv¸Sg½…Y‘¶ä3 ïÏÕN*b’`G¼6-G¼ ±G­5´BÍ 5™~E iD ᆥô21ÙQ›¬Ÿ¨mš‰9MtCN Nó˜F¢F‰¿¨ºrÔþ×AMu !çäÝ)pø¾$gOª:Ñ;:33"Y‘Â*gzFÙ vÔ0*QëcbÔ4êeÔ¶€€ì'OKcr¨=4 ‚²Øì¾”3e¡—ãË)ªß‘÷[„mRè¥oÁ#Üx_v\k^4äÝD$!Þ”­éyFáNÚj N.ªoŠr ÁF6Š ˆfµ5yßÈépéB  + ª¶ãkìdßây¬veÃèJGPÿx!XлØÙ@v²· É¤s‡î4+©Œ½VLªá- à>5 0ûr—Ý Á6|£QyV!œ +¬”rÇD­¹;2&Fm1°„Ú„4…ÚæŽ‰Z÷<¡ö8D-6´Bmõ<¡6¡_1¿[”NsöwÁÓû]›IÅJ8ulª·ä·€ ŸÝ’’@±É?IGèš‹8íwÁѵdP[@àðöÿQ\veÒr >G¤äÇÏù²^¹«hú-7KÃ"b’TM92›Ð96À\,Þ9Ó-W N˜ìêŽÐs ¡Òf–…+ìEÞ!ÈôêX­ëÞ„CÂL´æ7ŠË>ºL›Ù•,Ø-ò«á¬¹¥Wåâ$š|G*ÐbG¦ßA¤ó|ãÐZ¡´¯7ï=QøzH Íý%Ù:²wVè·€€¼ÊŽk‘Åj°Ê~ÁmªrŽ‘±ÊXÞìÂ>Çë,0ìÈDªáÒëš(áæPïXf¬Eäç•bz?ÁÓÀñ÷µÑ¹õ /†0R–0‹£¸ƒÏ°5Æé4+ÎÅ+w…­ Ø^[UŽ BzÒÜIX'å8f/žmâ{7&ùÇqm(ûêm}ëó•Ëñ²%[ýª2à ‘‹aG¯k¢ Œ®…ÂG Í}aÀHÊ- HOT×°8eïHš¨‰8þi3G"j'“µÔdGíQã–P£»rÔ"¨¡Æ7‰¿¨µ¤)ÔVÒ¤ðL>í ;SóŲfó£KLœˆ‡⣿""ºteD%?é¸\ìÃ#~vàñ”ÿØÙ¨s+'»Ð7 &f5ÒÄp‹34ÃMOÚ©EØ‚YJuæ%‰Ú ˜áCPÍ>‡ãƒÚ²g´‚‰ãœ 1Š©6É…ŽQ$ܼHœÛJšÅæ©iÈÊ‚›'Íðí¶˜XÅ(âYh'Jç£e])ªSRíÅÞ0SèÕLR¾N ÕaË„ô{ìóY0Ôž–¬([ZáÚèˆy‚`ƒì¹S›aI»JŒ GÓ3H R7>—ø«b<BÅîjñ·6#ѺCºX +ÔPíMÈ?2t†;8XŽBlŽwãÇ?ƒÔ7$õ×èu) u‹êoIÝôÂãÖô˜hºêÕiú©é­:ºô³[\ú9(é&Ï'Ò?-"Òé™(÷9Šû ++ânÞ¸w*H&\ñF¶hkJ.è×,¨Åí4âµi^'”IÛßÐ6íÞ‚U9sÒšð×Húû­\ã=ÄÚÌÖ…IJB¢¥b?‡xa)¦ãý\Âå‘hÑ0Šo·ë†iˆ º™—̼$wHg{5ºïz¨‡¢ú÷PÒCEEuW2¨KÉ ö’Aíc 9äh3ð¨pàQýîh8\{×uÉX‡êš•Û=~˜ðu‘_Ù|]ä‹ìÖµÝÇQmw4w·#æÞ™{ƒÜ_#£š²ùŒjšÔ,¨:[Is) +æCQ0g¯B¼j>\ˆ§EC†âøN•ÊÐ}ØS_yè;ÈRÊSÙOeéüSFL1bþ95§òT–âƒù}/5ò)„E«-øJÂ¸Ê û0®òþ÷ÓUÞÏûïÆU^ak"ŸG·òE@ TD –Ža æ„ü™ÀË$aŸTv„Ã``®x:„ƒkÁIOšáÆ"¢âòÍqÅ(HÂÁÒbâ^žâ§c€iŒ TŠiVPKâ£1æDk»/g†²u]ÙºÌafWö¼„ŠÙ¼*Iy¨QMÎÜ‚†IJ,…¦Û‚ð‡¤Ú‹}EDÞodD%¯Â /É™†£‰ÈKyI&]TQÂævn³)؃ڻßu•GõïÄX‡cêîÈ©FÃq€`ïÞ¦ù&L“á|N†ãÆ ηAlÕÔ,(äæLÍ‚ª ªBTÕ¶ŒjÊ*¨ú8cŠÂìᮇ¢ðpu-˜¯>\Ü-˜’¥(˜[@ ÊCN8íÏÓ§ýsêçé¦Êül~92¨=ì—`,‚a‘¬H9ÁlÂ"±#A†H_° ' ôïgÆUÒ÷ÃU`¨‹«l¬Ñ ×›@à£ù4}Fôœ#ˆ™¤h—ë’¦dm„=‡âžŠ;7¸YAÕI¯–DHct/Ðì#Ì ³ƒËò©ÉÑha¾ +”C‹âA>](yª³—õ²`ôA*§ÑÅ€æ4µ‹H#jú5¿€€ÚhLŒZQ =ȉ@°ôŸ+%“¾ZqæÌ,%>­ ïWx!I90á²gSÙo8ŠËž—ä´Ã‘é ÓþÃIº(ÒEõ–®;¤‹IÕI%=”Ãáà#ÙCQ3~¤ûÁ¾—ä ‚½Û¡îÎÝÑÄ:ëP_\° ËÊa9…id˜FN3œ•Ûýcåv7ÝÍåNÝu=‘;õîÕ¶i~£Úœ^8Iš»kvæá2<\âÕG¢³ñêc .Òà©*9™Cözjަ²QžÊ^9 瓈NÍ$Ñ'}/ú¤?`qÚ¯š;œö'XOà –¼³„|’3îß Vì—$ƒÚÌR×±_º=\¾ Ø‹XÄÁ„±“†0­Á¾¥k±#4„sXk¢oÁ‚þý,@Ð+5Våâ{?`ÜUÒð…IÄÿ~¼YìòX úVuR8°(F8¼\3‘ëäq?…C«F8hi&Ç»H< 5† +áÙÝhH¢!C¢ï¢ “®ø Ò ÿ 8þqb霠máÒ.†SÇ`=ǹ‚"b’ú5—~E2@%vXi¨ÁŠÇ¨‰LvdyZÊ;Í6³b k‡Åx±Žî³™3Žˆ.%¡„ÉÇâ(³²QÉc2¶ã{÷£H–rÄi¿[’.ªG ^ ;_‡Óá.*/å%ÒCQÉNX`5ºOP5ºïj¥F÷g³”†N(â#θ‰b (Úp¥Aí]wÆÔ~àQ=ÊKáÝÑp® +‚}‡ê[@ðcª÷X‡êwGÖpÂ/à -˜¦i2Z…½»EXл#+‡id˜F_— +Úv·ì«æøþzg/wê2[NÃS2¨}øê¢W|œ9?5LÈÜ©k-9 5,Ž·`A_¶¦ˆª¤!•hM…›­äODöÜ'™×Ùs°B]g"*v?´0kÂt¤ä¿Guþ„fdqÊ®á¬é•Vå¤9SÂ9>ïgétR~$äΈÞôÕ$Õ4¼¤?Ÿ*«¢ÒßM¬4á©ˆØ +>Zö1——2j+«l93«|6ÞO› »:>êõRúŽ|ü¾·‘ÓœœiHIY†C¬•CVùÝÅPð0 š•NïÓ•ç +{ÄÏFH ûfÒI©¡0«C®«ŽZgçpP„¤–s~1!oQ™3K—RkÂáÅnX>U'úëP}üfZÐ’ôzGž®&Au„!‚êp¦³*%0È™†kô[×Ëþð}ÙèLÃÍ«‹ž ¬J‰ +rfâ@Î^Æàœ‰ðd¡ÿè#TWSî^LÈÂC æ-{ïï’ÇU¥4ìˆdEz_~lýu…©JD,}5Ãzt3Æi_ß—ÙªèÄ4Þk«J2ôÞQªrcRúbgÙ€¨äÛùè;¨½;ëÌ +‰†n³éi¿ #ýœÓèþ*Šˆ~uEP]‘ùœ×¥U)@ÎôFµÝÃobuGõœP·cÒ!Ÿ êm·š<­qÄÖY…ým”NJÙcUò±ÁIú³vBúxIü¬Ì†%GExš,æ„ÆQ·NÐ8SqN#øñ4E*» "áp-B+•±d±ü…³b*Vá#p¦Á”†VÍb¥W)g‰p•]ÒDw©tQi: ”ÁC fÞIÃÙ $c©:"Üæ”:œQgÆâÈT¼ë¼4ZKfuRSG2wWg€k0XÌU  ]áŒ*7¨2Sq@øHæ€8î“4mö·€àÓiq¸„iœ™$Ky·>æ„QÇR™„bò¤¾(f ‰N÷óhÉÄ?àÀ¦”ÝÏ>‹‚0a•LÀ€ A¾ö“ì|šB6 jú ’ÆØ@ç!½Ž{²²Ç.böû’LÃYLÃ1ÁþOÄ4üÝÅ0sóÌBaÀ]u ïá™\EŠ ÇEeà¸k‡¸å¶òØ= l¼ÄNþÏpÈìÞ QTïTõ£3PqUrdÅ®O Ò_(Uƒg*5`}÷Ñ.¤k¡•ìe‘ìÑ[^¶{Á@¢KÄ™üÌÂI<+FEÿÉÁÒ ˆg5kô÷»INÃG +EõE$"ûw=ýýǦlÍFŒÓ~‡ºaM5 #úGÎ9.uhpý¼ŸV¬L‚UÖȤe­³t”3LbÍÙh%ú:`Äš+*®ÊÇH¿ÿQᨬÊ塚§ô BºŸ«’ÓÚ¾™ò ýýxÙįr4¨sm?²GÏ<‰ÇG!ÏÂb]váöHÑŸ…Yšˆ2Ö$óµUe"¦(˜Uª@NßÜ©Ë3þ#΂eÁr³×èÏTïË$Kþ- € #Ïâ.LRPïÃ:œÉG´É—žŒ°ÊÞÖ®èý†ÌW$’=I˜=[@ÐÒu½~vs˜ äC³©vzÿ[XG_EÀ$¥…ÄÖÖÀŸYÜŽ?–­˜†²ë.y5ve¿ƒ<“Y·L)ñ0ÇCõô.˜ü¼ªHØÕ Û]ëä¤,¬ ‡«ÉA£Èaö*â\•Ñ'}™Â +½·ìÜÌü0aõÎÕ°¿GI\JJzÍÇ*¬ôT¤F:(ûˆOŸ5À(n…ôœ¼;-?¤Ã¢HÉ' &ü;WäN=YH&ŒÎa=:+Š”ü¡F pOV£û ’Lœ™¢V¬×)ïŸßWÃ÷ãAºÛ†‘~ÿÚœ¹@3ªi™œ¾¿¦PT?øŒèÓÕËmœfßÐéª|(2¤ éoÁ«ÑßOx´`Ò-œ3]s}Â=˜|#RY•È™Šöôþ™Â +ý¢üjÈÆ%»Ç…Óû?.ŽýÁ £:&€þ¬+ÄHÊÈ*©¬[@°€ec•Tlê¬ +˜×ÞLä³Ù°æÛiP]ÁyYSŽÅUùPaÎTsX‹Kçš¹WË»à²AäßÎÙgsŽÈû/ÑáRN*'[ µ‹é–¾Â‹«ò1n£ÿHK§‘9yw:dvOc/{Ä÷ÕÐÑI“‡ë‚ÉoÁÇ%+ÒÕ¨­¬ƒèû~¢BW\ñ:ý¸ýEˆIJÈl’þÚ!LÞûêg= Q~ÊCßfY$wÖ Ò°œœiX¢·ìÇÉ™†#)’}8rÙÕG‡1owoÑ; gªÒÙKG*® T{E=ïÔɧýÜ×gŸ9åPdEJºgÙÇYlœ¥ÈÊmoTÛ½†7ªÙOô£*/îƒ6¥ì/ Wª‰· =ºrÔTVjŒÄ[Ð^Vjš®5Äñi\¬ôÙBúWlxv8ÓõkÃÊÒò¤Ä¬xÊ72¨Žç­Ñ§•׌"1Í'išXièIgvzÁšæ–QMÓ!t†ò£#òg*6 )– F b‘~`¬‘†YÙct£ûÿäkYÙ½Õ˾‹d&’#+{‚hµ”ø rQŸÈ>¸X[LB™šÈ<±ÒˆÚý’ˆõa•VÙGš% '³.•öŠô‹JŸRç”Ê^fJe ¤¹”’BVϽ6Ô²+b,¼„Qëûã9²Ÿ/ÆîÖXN(,‰Ç§ˆ|÷5¨½"ò-Y‘z˜gºW +åuùŽÒé”ÝEr§N`Ò0Äœih².’ÒüTÊ.s) +&˜©”½Oô%¥Rvœ2¨}"òsC¢ÔX•­ ‚=H Í]Œ+e­•²Ï´ŒjzZ.û, ýÄi?(r'GÃ-Ô^tå…wA6dOaS‹‚Úl ,ÄFˆFS !gZËâ9Ó0!ùpìÒ²··F5A› D‡%I’®8Ÿi(<ªƒó™† +·»×ÍgI Í=éHGœöŸF÷!Ÿoƒ\…Ú;D›Mb•yŠˆI*HS¨,¯QK[«Oqå¨U¬tPžÆÙH8*Q›Å!P„Š‹Y]#9ÑlZøŒ>nœùæžÍ”Ñ餼˜bïiƒôÛè¶»¬A¬Ô“$­äŽÿx]ÎcPÑ&¼è ãP˸ø’` +ÅÄà8ZmÁe“ð쥼OßåZx£R’rž¡èJé† Ë¬ Ëg«™Û ÷»² ÌÜ‚- Ø|†²à¸ ©m+»U“—9J¡Ÿ9`’òs08³R™CÓ²âD¼¸Z$n+F˜‚[@àuùh +µÆéyÂHüEMó87zz³bM‰ çL؈ýþ¬„:×- €sÏfFæÄ¥ôNþãÀ°bmu bt¶1ÈBÕD.í&¤ÜÉa 0›ðÎ +hJTòеFBý\†Î£çÐf¾`·¤ŒAÄì»áÅNN.JòÐUƒã¢úç²¼ß[88pl¤F“÷4ŽÚÇ- ¨E¢÷>(¤{â"½p˜Ïl7(„ÉŽÚú‰²N–ˆÙ¡Ê²Ëšºžèeך‘ %4[Š[ò +Ÿ0yG +…tÂK6G¨;ÔÐØª–Ã< -ßV\"wê1͙ƨǵQ, +È`XH«4òs +ò×Û;„P¹2»ó¹ˆÓ¢.þªÝø>ÚÊõº- cuÙÒ ¨[l ¶Xlu˜YJâr·€€?ó0!LHmË8Ììz8[@Áù+ŠÓèw/ü^ÝÉ‹ÒcTGÅÂêèˆIéQ`Ö +¿-ßR±œ‡¡Ù‡)ö>€N•|A^U¬êa’’K¨–µò‚_ì8ÀЬ·’–Á™‘xÄZ)‰Ch¾T!gÞwaô“Uªb·€ ¤—òcL±ù©6è*ŠâH Í/ ÖÀ?Š0yq 'ìŠ.\JРӬŽSƒ®ÖE³2AÂ^¸“3WóùMtCÝ‚Ä(ÔÉæD„lH¢[ÖÊŠˆèò±ÊS^6ëd²‚+aÀôNŠlÁëÝ‚e ¶€ «HXi’°Kw®Ž`#¦Æš+ +“””‹vaß$ý·@¿ŸÜ‚EFA[‚ ÅwFöôB~!>:êa’²À‰Î5‚š~a“ýjãú¬îñ!«9 öG¸¥Gw ¯ÓwQÜ’dÄIé±&èªQ)+v b[@@bdÂg9 ÚšÑKnɧÜ]ΜʷyDôïAÿL]y?zȳN HŸê:õ}O%5+db­÷ÇêÄ|±‹P|tÙEIÊ‚ü­D^ìê©bðÃÌnA˜qÀÔêaÅžv¯p³t1àŽ‡²eÅšŽ¾~ÿ+&¬¹Ö(Ν¨®ÄGªï†ž3;Ÿ±çÁ¥9×9…ô<'% RUVÇäô}Ws˜¼lw°Pò~N€ˆ×¦oá2&FMö ,NÙÝX¹1ZˆgqB.°ÃÌ&pnФf‹­„qÊ"¾#·ÙÈ]B tUÁÓèo«#~6uK¡/üCk½ ©mã1ìôÊ”A:Vg³_ƒVÐá´ÿ#lÁçÊŸï5ãiÿ‰ôÑo®è!¯.úX*£¹>—ó™†R${2¦(˜ë|¦a×pÚÚlæŽÌI« V%éVJ™E^ï +çÌZ²ûé’•]#ãøK„¯ÛÑb‹!t¦¡!%áÌïCgz›NöЙ†òqfˆ¦/M_¬¢O!ÂÛ¥uðœ¬ë5=+Ñ'yO÷œ¥Ç4=g\ øÌÍ™†°ßœiø…JiØ7åæLÃÒµ¼ã¡¾Œ)ê”ä1göÊɯ +³ ›JxB²]¨Èζ±|ŒxþþA™*,˜"[-½XÕïcÎ4 ã÷ ¦åLC3c1YÎ4L8T“/-gúÆhò­DLQDÁd9Ó S%ËI«³ŸœihÆãì×ÂìÉ“!%{‡cöbqRò22keïðî-úPœ†Ö4„† ©U„"1³³óÐïÖ3DώБª<ôÅÓ<ú#‹ó²)ÞFN·€ JÈ…ª;ÔmôÞP×sU^žkV>EkžùýpC\•ˆÉ™b&"{5âeÞ²ïF÷ÅW}þb¥!™r§Nø_ ž,ô®üeÛWCPí¢çªì.¥Ä…Ó‹\ÙÇê÷AùÃÏ*Ñoî„Õ1' ‹›8±»0z™¤e­îzNʰ´¶V‡ÇÀúRKk% \ï·X—rtÅ¡™Ö¤·í¹B -k•‘ ÛˆÁw§àidÍá´Ä‡Âi1›ôi#11j“•¨¹æSiUvZÒg¬ÊÖ„t5Qñ«¡Z‹d+6¬AÛ¾a€¬¹.>5|V“‡@pÖü2wêí]0ùG+ñ/ƒÚçv% Å”ý7Œ —†3 å,  ÒÜÕäePídŠêîç.yÒCGxD˜<…S´&ú™½Ÿ•V¥C5Kƒ¡,5@¶CfÃXë„ÔžkÚ(…þþë¤|b%Ÿ£–ÖŠ¿‡us9•'GH#Nª»ãéûžÙ*iOßO9"Ù#r™&Ä€¿AÃiÿ©á¬9UVe¥Ñ}“}ˆêPxÄ‹³%6ßøœ”˜wÓ¬0‰ éwŒ¥bèȳ½á̃„yÚóýE©Ê³Õu©§µr®†ý?ê\U-&úYyt¹.¼¿EIJÒ.ìå{‰ß‚T‡8îÏp–.;ÀîÈópv@°h#Ñ3DnÊCõöžGÿlGfP½+v„•F÷ÃË»bãk¡òûö`Y_§”è]Rè_ÉM—Ðþ,{L¾ì8Ž2~¿£š +X"eÖ6¦ìÿ]V+¨­µÛÄì”Tòì½XÛŽ«ÎÄ +ïÇñ[RRÒQfuÅR {1q³¬;Ð §#æ.Ú”²[H' k¦(aUVZ3{@áûmá´™2%”aC~ô5f…ž!j}߈«b9 Ђ)›Åi˜Ø2ª9v*iX®žÑ”%Ñ‚9›ÅiâÈŠ´$Sˆ>â*­J³3ží'$”8Euï‘ò>ˆ¢gÙÿ›Ð¤-œ3e|âûjXAMH_帨Þ-„”µšùœÉ¢„UÙqÎ<1b’g˜R"¨Î-:œ)yy(#?› ¥è>Ý%o9&ìdር[@@@]ïï¤H»ðPTGICÀKZÓUù¹AB¢¨†•Ë~_@ÖkÉãÅ>N(Ê$Ñå€9s^Q¼w”4ÍÊ4 Í¤lJ“‡ùìrwZ'ñ4’Òà´ñCá4Ëh +µ-  ã/j¦Ä[Ðèüƒˆ³Œx¢ïXy‡öNsòüÉ‚VÁÈýi]ïoÔê» ÕÙ3窌(ÈOgU†ªúÑ?Ïž,èYïcä +-Bˆœ¦Tô’0)¿RcUv‡jòŠ ¥*GvP{±Òè~¥Óˆþû¤¹Ë0ÒDep¦aÐ!Ù“ý} SçL'¶$è:Ù£QOß¿%˜Ê XS†ß’2µ•õehœIð<Þ?I´âD‚(U>ÖTÖ§p)GȦY’ÝÛ€ûuÂ%¿=F•µåŒŸnoÚ+î/ö`z09sV³_[UÎ 3YNÑš,h‚NÞþ*÷Óf¢åWà ƒþþ«ÐÀïˆ «2Òñde¿ƒÚg`(§Q±û9:ÞÿR¼ìň7Hç.áAΔÅ);WIçÙj«#ª{ö ·óèÝ\ú†銈žA§¼¿0JX•⨶; '…‘ìÜB ç“+û’[$4öX¶¦Ëé¬ÊÔ¥áL S•¤CC·‹¼ÎÞ¡YóÌQHo kZ¼“}GžeÈ┽3¨üK§ÑuQÔþDä²²ƒtÊû÷…dSÂN·&éãÆ™³-UYÓnr¦L›°ºÛi¬éÊ.å#±Ö- ï ªŸ«+zÇ‚¦YH}R±°GmXcIŠ.çe1ʬ_þØ‚HÅp«X“aW¥ëPqU‚% zoNeDÔ+àÑUô\•ô„Á™Þ+àÑSGº*‰F5ñ}y²â̇¹Îž×ÙwvPû™´¨tU•ÁD’1‡˜™Œ¶³H  ôùæ5E4*P@L*0&(FCaX  ÃÂ8)ˆ¢P*©$;AP“fÖÕz D$…ÅÞQ§U®V/©}‡U¾ŸéHUsÀ+BŸ«3Pñ:'ÈÍ +' +è4jKD¿³Ã¦¥¨–)3}.ó~Þâ³HmÒÄ¿6GÅâ§Ö¼AßU2¡à˜ï·K‹ÿ„1oÜoØãN­nI¥‹aÝ:‡Ùβu@W–’Þç·ñeTs™&*QÔ¸ÿß²·ˆãºÀ_ÿÊÝPÛýïH¸ÉAÒ+È!o„™Ý ãB±Kûß) =$¹—75I$7™à ˜qMà£pTŒü½9ÞÅþûr9›aŠªo=*¡? uH­½äa'¢†ßçŠø†v=aüûêKí¢JâÎ<” +ÜÅÚ1b‘n%ré:‰@¬y§‘mì&;E} ÷ßô¹æ]ûmû„%‘ÓòŒÝ!¡í£±&’…Þçw½EÞn9UÅ6P3Óoƒ¶OëˆCk”ÔòôQ6êsÂÇ¥3g­¸®VûHÖÛ>)GByxC\\é8Ÿdаà…q}.е6ÂåCÇXé,wÛ'XTW—,=nÕ+$L~ùPë–¤{—éJQÛÇ¡r­dº(®f¹²ƒ¤ÏÕé(óDYO*¨œÖ Mw…ÝÎ Zš +Þïs-¦‚˜ø1i”ÇARþ€·Š¥…ì +¹·öbà‡YP»*Ú Ù“ùelCüUòs?×v]b÷(åV ™"–Ìf–­^³°vi›XðlÕÂ,H-]‚1÷?V\yï$€.„ÖMO?IÛU°©Ïeð1Nÿ}„p#8¯žÎr ž º¸R"P¾T÷†°}QÈ3ZÝa gì?'–¢Ðhn·×¾8 +x‚™Ûç:Ƽø&*WPÔº‘Z¾ÑwJ[íOŒïf8@K™­¿´€V@Wì=ú\ô:S*¦Bè‚V꛸»ÒáAGí6d©!{ÖaÎâi@w’~8Œ.°Aoqk’X +!²v6œ`åC!Í—6 +1¯@2qc—ŠWÊ2ßâqKUÝ6ªbb®³È-_Òüš*&ø†}Ÿ+ +êøí´&ž ¦XGhèZcmTÄUι>ö.Ó …Ôz @WyÙCt³¥§dqÑ{Á±_¼½+1z¶Q Þu•MÌׄfµJUÝz'¹ã[â‚Úç +N‡ }ƒª‰ÓH¡’©ZVßcñ„lƒ+½\·t Ñ"bâ*`Ž… +oÚ&w™-z‡ K&[²X3O‡À¶dH½lºâÈê@ˆÉtÓÈÄ€7áS&*ÍÌ™9I’pU©v…É aûŽ(Pï|Ë6ÅStµ/å@žã¶ØÍigºúðæ>— ÞÐE®_ã õ ÷p¸5Ž‚v»ÏUŽâ9fÜ[“¥ñÚ¸@@‰Ì€.¿­EÒ^ès•|”væéæ´·…ùSC3w½ú\Ô4;Yqu"÷"¿Ù¾g žæïs­áÂ÷ÊŽj¹Ñ‹9µÖ}w eXÞœSŽññ¿º—gnèt¥Ôõ +=°€ÝÀsGÿPÕdÖޥʵšV¨;Ì%Mf‰mŒeCoȳ׊²Šx3æ}¤È÷¹´ÿèTƒ¸¾- ”j©B1¤~ÀÜí_oö¢bˆ€…ýLÛ™5w5îL®fÍd|!µiï¨(ÈÙ6~IÌÉ›ñMÂigÊY|i~~ª7¼˜1DoîÇÀ3øq@ªø#îsaÁ  YÝ^eèsôÐ6ï Ãò‘‚ç™t­û§—D7&àPqÏ!ÆØÆšÓç*ÐÅoðý’ú\$JŽ)ú0÷¹÷“‡±ª—#^Ìç¢ï@Û•eƺj`ß‚ˆ•’Ÿª«µZXÊÍßU÷{GãÅÀl†Ö¾S”÷£BÃ{¹ÏEâÝuý0ˆL´‡Lº:ï8v“ˆ™ãP¬Uf·º#í*;2É¿WŸMh?}®:À´r¹+2Ö°‹ª4ãRxíÍ÷+ŽEb¢ú\ûæúteá¢vZj‡KuæßM]DÜYŸk·`H’#  –ÝPþ?$Á}®…‚ñ{{€F‹ì’ìÄ”‡Èa£]­w ÑKlj×o4¤½äí2Á'ãžÛq¸LhŨˆèm +"ÕÿlF»hH1Ê]¬‚Ã(­i‘> ¶Ô}‹x/™‚iÂÇmÏø‚am¦£¯|µ­H—9¤g{n*yªÅýO«³˜–æ`®³ñè–Ÿe$9ŒrXâê£Ù¨þ½F»ðü†_ê%Nx=Øñú•ÜÀX{Ö"G'¡âÞÈ¿w}G ]Ž©½ä}¢;YÇÓÅ™ ‰UekýjTD¡Q  ,cX&©ÑI +x +GbÒ92µ©Î·\’ó­½:0±0ç s:åP7ógjñüèxQáÃ?:K¡˜åÀò¦U„ùœ†°ø`°ËB­ylÔ9°Âåj‡VüíN>¾¢þBl4b)€¡¼¢u%X­Ø\ýók”¥¬³ý᫺Fî‡QˆÒ$X * ù,Ë>¸êý¥Ò]è\Fj€€ +¦ÒCð ß!S ˆ–¤=Úà‘ÞÁaÞŒnîÓµµpØc‚!‰ó‡”°[ ‘Fg'Ùgz÷pPx Ô?Š¢/mS¬Û›hušÓAéuÑo´š?ÿÄ/?é ¥ˆ£r¤ð[÷°“l¦œKh2·º=sŒŠô9C#ºI>¦ü4.ǺVNîá9)3:Ë®¢«&Ö¢³åÍtù|Byoj^XZJ®¹ò@QŒ¹À´Âò5[=¢âßCöœ2ÌMž¼aB7-À 0§ùý/¡`7Ð?ŸHZ> þÄ¡5eÔ|‚É÷'[J¸è +tõZ-$ßlèÞŸ-\Äq¼Ÿºo ¢‹tD©ÚêpðÔƒ¾(L®üIÃfè‹c*¡…{&óÇhç1Ê#¶LM#zJ€Àû®ÙBÔ)¥W ážP#é’S¢¸ÅdœÅ./$`1²‰? à /t&ðˆÿ…ÕjH|Øûnê +Ž8l—Ëd1âDÏ“|@Fðv¨f¡B}u&#¤¨G€?›P¶K•v$î­ÖÝ8'°tàLýø} G¬;3ü™‡F¯œ’]·«ÇÆ…Ð:b£(À€ç‡–dE¢‹ôécRÅk_’pÝN…7Ôöé“F\æ0!O<}¿.¬€w*‹<“'6SŠ|œwš3yX3LUþïµ²Y$î|Å.‚tùŸaYüÞ]‡>Cˆ¿|›±òy Õ¨%÷„Ù@(Ö._2gñŒ F·4Xäá¼}Ç ëºdíbÍäõyÔu‹¾œÒ‘åI)ƒ¡™K~£œ’‰È’ÚÏÍMŒ÷KÐÖ»ÐÑ‘¼î§Ýˆ¢Pwë]2@Žs!2”ofõè×”Ö¸¦?ßF}éÈ oM§”C7`ó°åç’•¬ÆuUúKiûe8iõD …m0‚ùû‘ó1+W+*h¤›{…_Ìu !‰ža—º# x¦Ò‡ Ò!lÞ øWjÏØ­¼™ª.¥)`òÅK˜)ÿÆ>‘}sà°Œ¨Xˆ1¿¹+T +ÿ°½Üy+”v¡³|¤+d*hê~f°B:YmË«©®<=zI¹¬+ZF¦ÂVƒ}sÈõ+$f¢]W(N_!;@NÏÓ¥ì^¡‰öFÇ¿Ý~…NûEcVè:`ÈSæÿ.0T.~¨—Ðô!„¢Â–íétvŒ(tæS‡†ßä•_‰`­³®Jêè¨×¹ä-¦D$($Á²ö_nÓ¤¼`=)œ×“Qhˆý’ +ñŒ^¤FË”ÎJo³`†]T¯LC}.¯ŽÂsˆ±z¯t8HŽ3w\9H” +ÍDüâqüý“;Cnöˆ <à>;H 5\ê³xFþÀÜ3ËÞsÇ „àcP dì¸Áµ§{ªzM‚O‚:×;¨±·%ÓTú4TUæ²)M®`/9û1.™Ð{0÷8ŠÊ¯·Ò™H‰Û‘€ñÞŠ;ËÎÉZÖ“’ù¢(H7xÃjjñF»ãgnÑ?TËlçÄJAˇ±¡½…¯×nzŘøi3¹å+ÌÌ©Ia-ߨ-h0¡q7·æX?4Ý-Ì:z\ÀlDøäÜàÏzöꩨ _Ñ%(8t¾0¨Ñ•ê’ȧ5(µîGDÜ)t=Š`m²ÈCèÀ#Áë ë¬:‡”?þ1E¨&Cöƒ‘ ⎙ÞoxÕðvÉ—5pÉݸð½HsUpàX§ü2­ß!SnÇýÖÏæ*å~„ 7øŸ_Ô'©hÉó!.“Ê*s`ä»NªT¢…Aá‡uÞ·½‘¡ 5ÏPrþ»aw—Ë!ž€¡ºm(yø)ƒhÝ—œH¢Ìœ£ƒL²æ—*-Ó=`ÝaÊ8ݘi.Ö-ù¬L›d÷õ»š½&Ãp2ÒY¬nÍg+tø¯Íމ Ù3bã4Ü¥[þ– q±*}TЇ‘S·«ÚSÓÂ<©ECÁjv|*î´–¶DÊc­ãW}˜Ði<û\Á­7ÚÙ8þ³«æ—ÇÙH€Ín¡:(º6kœÜð»÷¹Œ|pVäðE9 ¹H¡•8‹š}+ÊÔû†æ{QVÍfOq¨…!OˆÉè“>OƒmBæP—!¤MÔE,…!ERo”ÐÎSpq’Crc‰Þ.TXLÐþòñ‡S ÁS²î¡¨ï0;êdÀú/—ÕSÈ<1Â{^ùu§0QÆOjÄmÔ=?‘Ⱥrlשf°ö¼¶%¼¤±„;ÿ¨ÿGtg§•ª@¾ðõ %†È!ŠQ›‰y"#—‹AZ–˜˜K&+SŒ¶„[&”®¨êáóPšLKrÛË –ØI;:Ÿešw«ÈJKªÓi fBXÙ´[÷éÁ c3Ÿ’ÁÐlƒ¨Á,©\6cÀÍÜóÎ1θ…ec_uœŠ$Ãon!±$ØcÃΗÿ׊CX +ìC— -L—#¤ñ-8K´±0| “A”ÜîáDdN“‰–Ǽ/[‡8÷š1’¾ŠÿIW ¤'`Mx×ì æS«› M'},Ÿ´ìá ¨D’&”˜€™ê¨µˆ@вQ=¿ß9‚OL<׃øõì‚=ý;DLL’ÇþA‡Å ” +ÄBã`힢}cšhDe°÷ùÚXÕ|ÿËh»Rþ€•+¦3#1ŒYh=É·xœ(ÊÛÅ- ç½úqG‡“˜"·ÅOvü^“´.[pbR¤Í4;QáãFîò$ˆXŠ™³H¡U–«>ÇÁ£ ”²‡0Þ½ÚÑ{•·MßCA¢6àp'Áì¤Ð¯¬@,a {ÁŸ #'ûB]7´”¿¡ë`å{Y4;6Cˆ– š+vì T¡ÐÞ¾Zò[þ—e<@3³Zùüãmªü ßsp¯¼_üû\|ˆJ±.áGƒH¨Bi£÷8é[êÒ&RðGjÆ«”998ÝÜ(ûU[Î5þË·à8^Y‚±žð= bHÔn‚"']#Pì^±"‡›Ó1žÚVìøæe€žSØz JÓ&¿]SÓÕ}<‡þŸ‘ÄHÈ¿6’#_ÃæŸãèë§{Q«²OCédSC™0­þH“Dµzƒif‹GŸ2!@I7iÃX苪— N¡̨®lHÕΜùG³>ƒC‰/‰Ë,î¢jîW¬Þ”ÿt×Ézj}¥¶NΣ²ÚcŠz‡Üîi·ßÅï½!`9ꊓ´a}ž…bº â •«±Å˜\â K•!9„ÛlÝMpÛçøš¤}|Æ‘Wz¼bTlÈ¥ŒÌ_ùJœjŽC“1!@¸×í ~£BäÞv¡éÃYÉÛs‡ãa¥&n'Qå©ç0ËFª´ÍŽÕØ·VP-[îPÝqr! Ýá’|”J–éÏ¢@A*ÌAww«²}Œn›²$Ð4@XjöÛ÷ ¡r‰5ë¦)¨r^³€"jfö²Ð{oq h Ô~Š"s¶–.@»=ß–%ˆµ£ Å¡'$éÀÄ;‡ho •F¸RhÉ.ío”ƒ¼ø†O[„òü³ƒC°ú=‚ÒÕúü¨¹nC­r-Q!r[ ®ÿ¦'òæù3ì¼»î)àš~^˜Šw™ÀXÛN¤ÇÉ>Pv´`°±òǵVÈÕ ê{¦%ÕkŸÑ§ƒÁÑà,ddznûÈ‹h'¸FA}L„ÁE;à@sdˆ‰ûŠàæe ™ë—yrÕת(x’\*åQAÛ>ªnf8XÕ§h ”o…À”Z0ˆà¯¡Ô>å“Ñ3ø.ÎGr ŒiSòV*Wb£B+\‡9†Jý²$¬…?2T욤»;WYÊ:3%‚Ø(i¿þtÁC"ôÚBNwÔ/ès­OÛ\Mh¬ u3Àìº]wl”5tcᬠ +\Ü<±¦@×N}AŽHNã$8k‰Õ¯ÖdÉó]Pzyñž¬ ìi0n·@ÖøDÇ=¨O€¾¿MLÍ'ƒ|>úúEÄ×às`ùö¯ªq)>|ßÃ32ÓŽ1ˆñÈf#ŽÅ±G'}œrœÔrRt MèVHŒí\¢Ps5w§­'|ÝÂHwÜyá²àNOeoö;m-ø¸hÌs;V\JÖé©É[|‡ÛLPoÁÌåÇÁ扴1«;€^vš‚÷T‰C^/n;‘ð gônÈàóÂÍ–.²Ñg´²÷D‘ßäû6ÊjØ]5:®°qµ=´ûô/äòê¼M‚æ€ÑÙû‡‘õ*… ÝɹPÜ -éãÎVm™#I‡È¼|ÆÃ +ÅqŽ”\Ãz¢GÑÚõŠO—ȃžÃU—OYιsóÊGíæ3OA—GµŸ›¯©‡³ˆ·Ë7T GÿsÉ×|UV‡õáòpñJ¤‚»Ò/ãkd‚Åz _¨/Sê°à(½ª%Ãx|‰ Á!n•Üt»S¾‚>o—óFöãå,>ÉCuû²8‚šêŽ%T@%E|·ú”„9CzFœ©Ç¦"±öNÉuö*QÄŽ‹ðê¹ öTbÌÁäŸÔb†D-ŽdÄ6m¢Ijù“¸]º°H¨ˆíû̾æG Q¡QÑ¢ƒ?ë¶>—'@œà[Ñ íÒ¬'Uøóš$R:X•¡e`~±qÚ°ÔBû^å¸$5÷üëÕlKªë›¸÷Ì›ÅÍ9pfñŒaˆKft¬›Î¿8Ø‚]kËm7B²%ïóè2½çþôT«–ßò±ÁOMi“µLi3-æ3¨ß„,-¿ú9„ÍÙ q Ÿ÷8¼ß +6æƒ%¤!ÆÛµ¼C}vü‚l\´ÍBÖŸ¼¾‹Ž< ^>?€”‘ _=øÙT˜|#/—ž‚CŠ2§‚§›&432:^½òÙ5z²`hèrI\¤ÄOøLÄlº•&DóÊìXBœÈ¹¨êÔ Ëzt7©2/ñRôDÀÇphÚs %s ·¥g+È Úõ˜5<þþ@ë‹gD“ÂÉA…؉[ö*nÁ/¨ˆ%‘:—ù§¦fÝ0@ÕëÈË\jö¶hÙS&´›œâûÞ[Ÿ]ްIrxVvà+‡?'jÞú}¶ ò» Æ‹ë¾÷¢6‘ˆdž#Þ:Xm +÷€?Ù "aöÓó­5Škt äk~kÃtÁ€ŠCò¾Ceëj,i‘\.h^‘*Æj‘4Zsp€äNÖJk58yv…}– ¤Úc(ð ø>ÚÀ'AÅAæ*5HüôêI×Y*ιÂkëF$’Øçã_âAèô w²P!°’÷yu9°Ô;—| ‰ÄIþÁ”æ•Óˆ<ã¾dk7TØÃ¨Ñu+ Ï¸×E1Ѿ¢É(\¹$ÿ#vdÚlMŸ™%‰­Š?ù£>Ó¯‡Ÿ×ζJ’†²7šÖ€Û·ÎlhÔ€ÒnÅ‹Ôdñd¦¾õ.»¨•èÄw´†²ú`;°ø[‘zb: x:2õ½r Λxyf#9’÷ö)IkñLÆÉ²ˆͳ›o§«c»Ú NAÓ¯õ¡ˆ©†h‹ +î*àn¸–Æû}§0?q<ý2G²ø$•ÓÝ®z$¶_FyþÚka. 4t +9é×&nÊt^f>Eß–Åy…˜¨­FºÞ9)¡àÿÝD‘|.7K!Œý÷6—š£óï•ý¦JøÅš…KàŽiÊ›Ï.9þû%ŒðNé$‘·ÊçÕ&Sùn‘2ôê§~:¼éاÈÿ€$vž¸-àòÏf üOŒB°¾Î¬@ëY>wúÅQfH8ðö¿-@è0’/aŠ„†ÿþýÕ­,‚%6ðŽñß ÀÀMá÷-…§Äî›û¼e;ìÎ1Ö4k)€Pd,é{ÌÈÁ2^Aí.v“&‘ È=hãþT*(b’¾Y«ò "ÐöS…ä³pSÉe»;‰ tÂ&¬K^î™›‰^€/’7læÆ8¢ zM’Wù† +¦¶¬ +s*…• „Å+u,ó³ËW*—}5ˆhÁaþçaé:dwª`ÿ›«8Û¤Ký clUxÄvߤ ^m–ÝæÜ­zø#¤ñ+ªøÛCžÆÙÕÕƒ §ñ¡Š^!JÌÜî¼ó›©m‘2Ôâ¼$5/„Ëm€ùÈH.¤¢Hs/ŒÂ+[¥¼T8N%!²¹mK"OXÜ'x©x­ç$ai;zBðöÏ, Ä]Ú ¶°èlŽ%Û¼¶ŸìÝ·ÒÔqÌ‚6ˆÚmÑ•Y{äѪ2Yû£ÆT¶AvA²p×l% Å*ÎEB% ŒÉš?µîIÍt3øãóÑD¬&C¯¥ç bK™í$šÛ:ûÿ“vƒn!”½‡AäðìŒ'sH-‰Oc×Å?èßwÂÙ¼5íxQ+ãm6 ‘xA‡w‘dÄkó3²ôh^McšÇ )£çbÿû’ßE*À€ëŸÔ¸"·‚}8š´xåÙõߪ¬#cs|3yéCE×k .-ê¬D†I8Kt«Cˆƒù¡!~-<òZˆ2oÁ–­Ško½@¬aé'ÁÅs^¼[—e¢¤‹Mt>Çü6¤·Äãíy4ý6RP°SF‹ kQ@¡º+àСWSHþÃ5‰¢¥Ç@4†'0a^{d›ÜÐ +ö ÞÉ[ßv¸£Þ'bCæüø#´+` ¢¡¾qýv¤ÍLïôÊIúR› §¤R©É Þ·è.BE3Ѝ¸šï%Ù.&Þ…ŒŠ“w·i±ØPLéð¦-šÖáÌW|–Þzð=NrçlÃÝ ‰dBÚƒÂ0ÂÌ6!ùP‘&±ì%TA7í6 1 +s!±\p]©‘w)>/¦58ò ©òBŸV|òNö[!o$¨‰o\Âd0P¡jĸ†E–X¢\ ¥rÙEàõ<ƒ +ˆ™Ý¤æÛhœE¡XÐ$Í« yÙ"èPãbE­¢haÖß…»HÈÉÇJòC“êt6LGU‰¤PäˆmoiŸ×ÒPJ‚¬Ýq •þ3¶¸ûz„R’ˆ(GÀAºfܸ¡ÚmŒÇÛÀœ`+ÙÓÏ?¯‚àºÏ¸-Ê€ksS ã¾*86\‡,¹å´øµ¦I‰¨b`¯]ÕGáÈ6™#‡”Ø£rÚO/RÈ=©êʾEÐ`8ó•œKÜOÈêY~`Ë}ú ÝIÔ;‰—VÞn®ñ‘QëRÌB´±Cr‡íÆyÅ7Gl äu “ÈŠò/B²Õ’r4ÕˆŠ˜š:·û­øãR«Tãq?Á3§s»ºù qä¦Y35GT«ãï‡H‰<4цDíÜ-#î*äóìVóæTsçmʃœPKVåÊ-¨,#º;ƒ‚¿YЀ†cËaÙÇâí¢|Šô°—P"Â<¥iìr J¨mÁ‹üÿÜŃ˜cU-™›ÄË%Š?s6šEi†#yûJF–_—¸l%Âüÿã—"îËv]ÚUvǶàcAD8¢gl„®jgÞGœAüÞB®7›ÍAn± ƒÍ¥¾!”¶ríŽæY$´‡Eòí ÿçø´Žf?EêÀx©XÁ€OínãWÈ!D·’®Ý×àðQó¢Øîr¯šä/±neÛá›Í³Ü’žÆ¿àŸ´™Å6‡Š|w( 6¹fm4ôùÍ=aƺ½oŸT*|ûèðTÎ@€«qm†‘¤p)ÒøÂ¿^ùiÄÕWhåž±àœ/8Ìf“!‚jE‘m¸Ë]‹ô‹àÜ—“Y,žÖÅé0çŬ.À™àzs°¾Qö1$"O͹F›¡–UH¦?ƒ)ÍçJ7“¤›Þž¬ˆóLØ,õúÁ`tßM÷aÚ€#Ú](´—,3„¶Qz ~s¨ÁkþÉBä½Èhu¨«b)Þ°6”ºÁ4P÷ÅW´v2v¦ÓªX%¥AʼSì¼Øí´fœ³Ö€ºÁÌ!ù’âÛÌ ¾ÑfJ2 Â(î†Ê°¤´†Ïb‡c +Kª õùúX˜^RCs_о¹…cÇÀTA ßä´úp;*§”%ebˆS\~V×VV[Ø“[ÍlA*.˜1508¯ºT4À—0M6þoá<Í*Ø[É;Ü Ñ@~& €†T:±rªOÁÈ™Kî–Ô3qv¬ô–Ÿ"pò’#ŠBöh€M"*ý²DÌ$ï$‡? n;R@!T(àˆÆÆ*/Dˆ!£:(º"U‹@SVõ°Œñ‡ï_r‰…(›6Âg5ÁÙº•àe“ Œµr'à +êÅ4¼DõÉ\â^Ю‚ZÉæÀ¯wTµ(Õ§2øötà¦cè#Luþ••ÔÕnðŒ“ÝËJF*=ÍA²‰ÁÝÜ*=}r†Ìü ø"¨J2ú±Úcž,NEô`ïß‹&Þd דšðèk©˜ý´†Ë697åM“RHQ` UÐý·&ÏPY`epL2MêÈ€œ˜«òdÖ ‘äÓǤ–.šÿØl jñôà#- &iÂñ1©Ï(ö6Ô,r4í’º u•„̪OôwêJ­y mnÜDÌL5å…þ„àDª%iÏ}SŸÃ‚ (iÎùÁZRT…l¸¸ hu#a´ãñ¥ÙÒŠ9èžÙWÆÜר”ŒizÔ2Šrú¨ô¿Ýý‚:Œ)g®6±/j¸>|]U8~®ðžà l ºC‘<¦vŠê8ÁAÊ +áˆþ 0œÕ.*–Y*ü Z‘f:j•9 ‹|Kb ä©a?P†P®ìxD ”GG¥ËÁÚª®BZγÑZ\Ç·tOÃè ÷»-––g}©t€5︑ˆ‹÷z5§´r„ªºsi< ¾P|7"_€sɵϥ‚ºaäw=Ù\W}øHåa[0yXá/˜}åo§ûõðÃ1zíEîÞßn¥®^œÚ™jÔˆ|îtg*h­==¿¹ß¿\cÈG +у1Mçüªsñ0ý]ƃ¦BŽ·+mðâþÙ7ñ«ØßU–—`‘A>š0sµ«Í’´@‚ wVÓ™Ad¸³Vð–“Š!| ˆ`œ-ٹوøYx¹Þç;Çž.¬^Ž¥V|‹úĶ' èë£6%^C”bż™ŽÁ >ŰyšžÊjìõì»tkš¼‚ÖP¨ý£æÏG”ÿ&¬ž÷c2¤6wíâŽèÄ 81½¶eÚM+¤gt¤kˆV ¥Ë tsš•Ï%0J¹Òå éG†Mò›¦^.Ë%"õsVõ:=³6DE ñ.ñ0‚¨Càç=ùf{î´æñêü'8ÌS*øåír5ø8Dó4õx™'ŒêÍ(¢àà5ŒYàÅš’ͨîoa0À^Ê“Þs‹5iuÑã•…@ÚOZ¡u÷äm>{±i^äš×Qå¬÷è©Iw/ŸÙÓhz:ܧI¢Y¨4¿ý%©¹‚y)ÖG¨î#QÁH”Œ§kÀQqLEãÓ'¢Øé3°€Òßš¤îc6ÖkÁ/GÊ>‚H“·Cœp­m®»ý„˜n|ˆ1*&à¥)m:ë2–ˆÚÄz"!®ÂÆ «(šc. !V Zç…Ÿ"qŠÊ´i\m‡Ø×06SÌ©×ÅÂqˆIKGbð¤v²x„ø¯–@Ì_„›À—ÀÏÇ ýqâƒA“”Y…çsò!>C°ÊE:¤·)Îè{sˆgሠ!>ðquC‡xA3ª„8Q#¹ù›Ã!!vn~6a”Cì*obõŒÙ^ê·IÈΗÂÀuÉ%jŽóô#c&—q5sÄÑV:Tçraë½?ë´Á#H]È2êT̹—XÞ¤T}-åµ±»ÀÚ&¯ø xd%Ð ±ÍÝ35Y {( -—YÁk†¬¡œÒêE©Zñ}Ñj +µ\Ü‘†R7 –ÆJ¥Ú_L9Ĭ.ŠHV5+Xºš-[Xrêìͨ[ÿò\x=IáÊ<:Ô´G‘›jŒ02Âlœˆ¢/Ú?^Ù¦ïIZúÓ_ÑnÆV“ˆÐ ¶MPÔJP¯±?çËè\§‚ò>I˜ÞÈ%ZN$â* IÚù·—š×À·2Îc¦Ù®ŒqMË÷G¬’˜dt#¿Î.*;=Œ‰âÛQ¶èeÔø}­QYb0?6 T +›fX–JÝyÙA²³<ÅnZØëû–jù‘ÑÎÝ ÷^„I4ÈdõN4ÁtøWÚ•LÎ`>=Œb<®»£ÖÂö&,]"Ú©™¦Ž9&Pv­¡Å±v‰Îà´Í3š˜d¡ÖØ‘,¢°>ªÖã¨iY1ë?Õµä +Å#ÐÖ +4×d§æõ³ZÎàŠKG“;ŽJ Búg0øâB:`24°¥k€oȉ۟‹ú & §¦R´Ä38S6á¶q‚,QgsL9ƒÿi1‚÷ý/Ïà,M„`#Í%@Ì5yÎàv(ÌqÈ™9ytÝZa;ò‹C7¹fb>k²;©g ÷ê„ñ%OÙ¥¹#…3øš‹-Š?G¬]ßÇ@Ñ$akmí¥FW÷sÍ*[I ûœTª°:sëCq֑츢rï‚H’3 3›Í tYm*’ŒyíV±Þ8X¢õ6Å‘Œ|#í éý¦R8ÿ˜^á04$g]Ë¥';£N¥m¥ Nö+šN;6ðÂ_=šš¤ÑäFë"‘Ôô *rØ,!>ùïº>kÁ}aNžWŸÄÄ1žÌù©»•„OÈD˺!açǰÈ|anAÌ}ççÀ¸ï‚œÈÉú ÆÄ9¾ØÉ%’O¾DÇL†[)œ«’€Ý1%é«%jÓÀa ‰Y†3°i“SÙªJ—éßPh|´W§T<â—rüÙN0¹>AVJ,4qÓÄ ›ú+hLŠ<)¶õ 9,[9†l0·ø_=ætÓþ.† Ξ]¡em×ncƒñwºó]Ï?ó3³7˜VWÖÂZ‘ܵ¢-,ßX¸bß™;»TújÊ=ðÄüz-JM7¬Æ¤J|¼Ááq?¾YüBÆŽÇhƒ F£Þà™Ûˆ7lpò‡Èú­.•ß<Ùà•#åáâÎr|dñ€KeÜ´ÝX +ßà­_»÷Û/ɦ\åýl©wœ'ã(ÂañJ@ð÷P_™gÐð|Û\»î'þ©Sù᱋D]”þ ª·tÆÛ‘¦Öš øb|õjZÅœÚÕVÍݪh¾ G’°%•zy'(-Cï¨nܨ\E÷Ë+9ª…—ˆ®r`Z<ïäέªa|ž$Æ1p§ 4Sš|ý’o ¤uŠYÈå³["Òí£T³ÿÌ ~þ‹GK7õ¦*¯®Ö¿(~H¯bQçS3Y/Q6Úì÷[q…?w ø¸´¤JtË-v`Óï¡…™©w)g…§)§…RÄ!çWøÝ¾;xŠQG¿.{÷¦â÷ûwg8O! õŰÊP¢>S]bžšvpEBy“¢6‘c+£úîtil³ûÉZªXzr‡×ƒ0Èÿ¿|ú¥Ãޤ"ûàÎ' àb æ­ô˜:~ aöƒ(•˜Œîˆ0 ¿ =ödDÑà é"_JVýv̈7‡Ú:’<¬<Šx+ µLœÊ›Š² +8¥°­ ­{áÊëq1ÈÕmü¹¹XAÈãV‰"»ÁÞ1fI|åH~¡ŒÒ[tÄ´ÌŸªóðr·–fø lYh7=Zá«Sà 2ÞEGžáz+ðöuQk‚3@Ï„Ç÷ï½f‡çÑ]}Æ‹ö@bÞ'?·Ay‹¦§³Û°Ÿ0YÒb† øišâɆ”†}ý·B4gSã_ êô¿ª¿_ˆIÛ{î¶~©ö©–EÀÉÖǹ`ú%™ê¢ +Ô$ryþ&ñs²õÜJšˆÀá—˺v…)"U{8ê×Ñ +=P[ ‘­)13R¯Žnœ˜ÎéI³..ÚãÁÌ&x3çøú´Š°SÉ P¬S·bˆI¼d¸ ÔCËÔ7hbƒÖcí@µ#5ÂRŒN„\ :x=5 +J?ÿA-’êëgÑZ4”±Õ¸§¸Ô5sèF6 +G¨LÁ{…ºR’t”“Ÿ†ßÇÚTQ.Ûø-}…Ò¯¶mÔÈ*!áùv•r5Zú ñ&Ý€FúîðÅ…·û|×ðk,¤ï`Paµ ‰ ”ã }QZ}~¡÷óŧÍÜJ_ðkam é;LkIÇ,Ô»–J»ÂîáJ{Úü!#8>óÌà|ÿÅôÏ4ñ8oƒéXËtµ•’m¦ž“‹›”d†WJ¯©i6HpL¯-nØW–|Vvç/Úd;¹WCÊÐC&‹Ë1wA.¨#åŒÉ‰ÆI4ä.åzC09‰ä$”ù5 +öX›0áè²äŠ‘ ›Šn"mñŽ3±-JK«B*Öý%Î# ±ã ºÈmätð»P‡L»!Rî’€°ñt[±b{²*¾â ƒè£«¯YxMtš¨p\fÃ2÷ªÉ„1J2¼FÝ©ÑebEq¼*Z˜öp\`9°V¶' }‹£ˆ_›`#U]QdíCjü©naN²“ ±À2ûuT‹|=/²|ö§¾B®¿¾mJ‘ú"…ËV®ïŠaä;é –x¯/ýYvÇ©nÎÁ¨ïüýúæÝJ©$¸¾SU#Ë€@9SÞëKŽúÄ¿ëûãó¬B}Wuz}7W¡ûø¬>IÔ7¦éÖ¨²1òÓ»²*dÄüÉL;DχŠí÷h€`l¿éý$¤¨ÖÒø±YwxSFØ…ÿÊ8æJ]e>“ ŒÙŸ‚ +-Œàw3–éÏóå­-<¨:8Õ_óØ'9‘„•kž$ÞyÒ& G×®âû4샞m\p´¡ñÏ.¶‡#›A¯l€Ý_xiCk°ê°d$þ+vo¤eãR»ã’½€ÄŸsï[m­ÈNé$dÐÕú@3¤ÜmæÒ`5:v„â‰}þ³ã¢µhXrÔaŒ¬yó{‡[”æùüšõþišWzfå Á}¬®]p‚£}|œ,Vˆ=‹ÑmL½§¨¢”'p/ŸŠ*2”»æ³1™ ˆW¥bñìä}ƒ¿šŸgžÊá,d›È 0¾ýJW™ ŽBŠZÏ/.ÁoçuÌÔ%ý¬žGÐúû¬ß^nÊŸÙ€`[s¿H;‚¥#x‡cVƒú:¨\nÅk†SRôc'A›#ºÊnX”|JìÐ’Õš’P-#ÒÒgÉ¡ÿpêRaHUÄìÊhÚãJ…ØÕ†¦¸»¦æöï¿°ãË‘™ +ðšØ®ev©²í9/C­N–N×µêèDÕúŠø³×K_ÎgÉgpîß’Q„?ëõNäð˜7žÁˆhŽÂÒ€œÀ3†é¡äÀ;ÔÎú²™ÎÕ¯Oø% ë± õŠN§¨õE§IԌĘ£Æ€`‘¸ŒO³Ü0YUÿ(vkºMʳK×g»gâ=ÛMN^,ɲCj—,|­ce£{i0<Žé>Š 8ü{e0Úçj÷2™Õ%˜aËÔvpRO@Dÿݱ szÜØÿ—$‡TçÙlP#™tÐ<æzàŃhT-š{‡>ܲ¿¹rt‚ï¨GÕ49 ¡oÎW 9)t™0·¼ÿë ®6|Q­Ãî×8› †u6n5A]d\ü’zD{íˆÛ¥œ<†g°…­v„xZݨ%†“<ß­ v´7ÕäÞUFÌxyf@Áq-,w–ßX­š1`K5œýÓË…]dÊŸ“2ñ‹0OÓë‘|g‘‹\Mk“@™H³ 3vˆ}ôö†i뉩—ðÏÒþʸ- Œ +çM±ä¨º½ÌçÖïeÌIP1†Áj„0—(ïxÿ]•ìþ.K¹^…Ü^S<+1:ŒŠêzô-wßq#ñtÉö7£6£Wª¢û ó–FâNÀ~b!^, ·LÀ§CÙQRãÍóTêžO}}ãÃ. n5/mñp»ÂÃÈQÈvà`<÷ úØ[¿±“Ű›èРP¡ø‹ z>©«,M6qÞh~”Ð*Š ¬T-¼¾˜ Ó(îPUBé–àZf~Åžn;‹!R³înâÉ“(ÔQ m \,k@e‚M‡Á1ÃR ¾ÄD‡ÿ:]ZYÃb›G"I:L¥¹LŒ2~úÕdhAä¥ + +?å >Å×9œhÆ æŽÞ(Ǹ‰ME„t3‡›\´€´²á]É„ÃÍš1ÀÁ—%ÔAƺ+l¤…úmqédÁ‰®&úÛÉADäöź,ÊY**G¶ìÙØÝyÌ vïáZ´ò›,2fñ*ï'wµó\püøôñ{VbœOæ¶-Vèÿ¶½.¶ôa¦ÌªNDþÈ ¢´Öõȵ¨¢zptG"ÑmyðXó ël%’¼íWøl o¦¡¸)¸Êá¬E‹ì^CuæÔr† ë]EfzXê’})Ä:8öÃYoùÄ:&œhösZtC‘F³µžÚ8V{IüÁ£Çì$ +ò‘Çìr¸v+…\ü&[8NBßJ®{‡3’«0 ‚d'ÝÇù6-×;~WZ=-ã3ÓmÑg¥ïÇ 9eÂðFiµÁ’½Ü-š„5HS"ÔÜ(?c]@õÍ0X‰ˆ'†‘7¢"Ì d¤k ÿ@ïÔ•܆ôͪZ•TãÖcŽêÛÄjbxÀ{g†HÛWžq»°ç|§zÍ0¸Ü)êvÊP3l9¡k¶ÿ2 ÐÓTàNYõ*(,¤xV•ã|í‡è†ù +ùYòzx|ðF‘ÍQÅI„÷²4 û:uí!gvëQ$šN’&Q¶œMÑÐUb1‰&`'b¥g"ÚBjsi]æ¦e¶Ÿspìú%¸2r‹ 2ÔªÜ,G!ØͺpøÔ6Êp\>Šw$þá–ƒxIV2j Ù׃ aEF8ëQ*±¶DW‰±eÕ™Ÿ•>ÚoÙ/8?€ïñÑ’ÌPBlÞ†£¹´/lžM{æõÐôv«Š"gT°µqzP}v>6)wÖ<Ä\<$ÿ'½Ðõù +ûÅŽÍܾ#\@t¤y©Wò¹#–Ÿw5‚‹•ݲs—Lm¡YEJà3Ï g­[® Äå.ñ±IÇjâè<Ðh¥¤m™†5ëÊk[Ë™«AÙ’*¢Ì¦-e0m)£Ñ™†ú—5 WäcràžZsˆpäL þ‚q¢ÙY8ZMø‚xEúlpDîÑ{–!Þ;äÐ 9iÛè|ú- j;¦ûq k²<á ÞmÈè}u³Õ©ñ +„¬ypùÒADü Óo™©>?ÂQáJHg9}Ì’À8鸨l ÿ§–š©:6~Ø5ŸœÀô ã`®ûM&&4‰×90?y[V#ÅÝ¿CÊó<^NF,àatÄ.¥¸ÙßÉÊS¾WÄÑR„éˆùýä̼Á5Üð}É#¢±Þ6ÁÜc.Ô—Ë£ª'Î(žÇàÈåý¦y¸æZ~‡¨dq©/¶ RÍ[X89y3Ã>×}—áä# è]”KÁåUöÕ Áà(µ Ü›‰}òûí` Ôi§ã…Û*D9¿ø×„tQ†#ÏzμT=|˜^scØ73¬£x0n)¯YN²vÄg‡C +‰ ™\Sƒðë!¹?Њ¦‚Ý<÷7[ÀdsÀOåz!Ríþæ·ÅŠÞ‚&³ªõ•Y ­/¸2VȽ,Bû¼š~À»%ŠsXT{]k–R‘ßš&úBù$']¾ó3" Ôk ¡çƒ|¸¼ÙÛöÀ÷üw å¾MÄÃ{Àñþ°Àêó¨sÝþdøaZrqW^šÕHíp'³3‰ñÚZHuìbU•Ü.ºì[1q»ÅÁ§ä©Ï=œ©Z_¬ÔVPÙ§"„vÝx$φÆÓöIq»˜!¾8ÿzH÷eÏI¨ÏÊÈÃwã'?ñy¨ùfYèÉéBAã¼Í ÷HDÊYšJ&†Ü8Ú>ìB­ ¼j5œN47£Clq„‰E +ÀuU0_¨ÂW‰LŸÜWNª"´.§°úçD5ÿü™‚0\©Ó«c܅ᶉnXø[­©4ÂX~–Ÿ.¡ÿìrÇ uHm.fgUŸ¤(¸–н˜‡br1;s; So¦lfËø`†ÖUJß LÂÌ Ün*5žhÖźã”±‘I%¦‰¯Kg®$x Pêò¶”„Ç)¸ +™wÍm +gž¢e:"¶”GhÊñpªL§!~õûÕ§:Þ-ÞÅ•Ðû!šæÈXmššÅt)1ë\#-cVªœ_$º£/tÕ寷õé”ðòF8®Lý43‡\$&Ê‹Jì#ÆZËU;ŽÝT>BuÛÅS[iÈL²šŸÝÌÔ ÑdȬu'ËJªn¹2M“:.š«:íÃZ‘îÍB$#ÖmËHC§ ‰oUvª¬Bëë84F‘;ç%ÿKrúŽ:®“²_¿Xz’RýÅâeJRžŠÊ¬ZFB‹Ç¶ªÐ‰ÍYioitB§˜Tº×±4*F(5"©Æ–!ñtŠæ¨ÃŽØ”C¬áiŽäU±òPÕÈM¤"{/—ó~ž*š@d0w,S绋ˆ˜Ó!¢©‰Ù;7Tc#EÛÜ„×!ß™‰¼"K…W5Ô!Z8ž—]ñÙ¹$ ¥ŽŽÆí$ÙE£ÓÑÌY®0\\ï2¥»òÈ•3ÇK)çæädä .„­§+»ÓÐoÉÐÐ8û†‹1Rn£ý=1Ö½g¢õÆÄ—›­GoÍ‘kïKDÒÒHíS%µañJŒ„¯WsD2dû ñì +"ǬÈÊL¸Žªäüð=“d~˜ÔˆU‡P`AgÔɬtØw=¡Üst™TË‚ +#> øA2 ‚Ø ‚‚,2p`† 0„`‘A2È›ÁÊ W*Œ`,D8 .`á +>Ðâ°E5\ÀBÄÏ¢-`ƒp”4\ÀàÁâ9œ $ð€ˆð`Øâ@A8¤0A‰FtM`¢+°‚@h¸€ÁƒØ…ûPÁ ƒD‡ˆ@ 4t8Á$¨ðˆ@ p‚†x8á‚*Tà …„€àC œQBÅ ¨˜Eh8¸ Eˆ(ÑÁ¬Ð ,à†Â XáPÐ<@@.(Q!¢´à!< “`N”AðLa…ºDˆ +éÀC!8Tˆ +9! ,lPBEh¡ƒƒD¤ˆx xHáÈ…xa#Œ ,TÈc0‚8Ѐpø´àaC,à"ph )D0bÀ€Œ@>$àP>@0 +TX$À\A`‚T<àÀ3#ÂFx€€SZ4”àÀ$ Dïà!¼+hˆR˜¸h , <€Ž#:p8€…Xô8!Á„p“`B…„‚ ‚%ã„ rB¨`-tPÓ€ ða €À„‚E 6@Á¡p:8`œ0Bƒ( $@pàÄDp‚䄆 *2à`\À‡ +8¨£=A f *„!¬ÐA% † *ÀÀ z¢D…xøˆ” JX”¨ +PÂ0Àƒˆ (!!*ä"s€ŠP¡‚" ŒÀ¡Ä P€ %¨Â!,¨à ÃÁD( 0 0€† ."(a9@ < Á‚ + 0< ¢ƒS¢bˆAB&ˆpÄ +p°`N€`¡+@`.`ha”0bXP‚ +¸ D0P‘¢#JP…R@:´p•€(1”° á†¦)©Ëo˜Pñ¨fÃlóëFö²G®ÎæèÆÚuU’)…æä´«¡z<2¬#,M]¨dììã+¡Öcv}éŠ>6f$÷9¿:S IŽ|gÔ”unÙ¼Töø¹{å$÷+e›„½ØÂº_môšõæ¬pîu›’—L©ôõòê%Tt‘ª4}HD¼’gj)èØ2‰UsVŸuË…¬ìbê {lò[Ã9OqT™êW¥w–+yYƒì#«"šÊÜ 2íŠtTã ŒÍU-e¦çÄN&r¦‹$ÿbM¬„¬$5C[†Ý1•SÑWÅöbvgª„è[jNnØr¦vij÷·suL|¡)ú°­yÇþ¥C'æœõlô»jYÇIÆÊcÏißÇ}ô¸YfS=™¢š3T%C43m¦ ’’Ñ¡õêsdnRï8Oë*ËdØÅÖe íÛîŠ<Äaé¸Ônã1ùXrE»NJc>#›wòJk>L)×7$¢a;·2÷˜Æ_õŽùföÜk*·jý„ȧ‘µ—•éÔ¢âXŒæêÜqº)³"Ç­dÜnøæ%㯆él¡ÚÝê·MñÔµ™´&;fåÅ#ÏùHb*þϨºßÌìÎÒ{e§ëÚ(©N[óùɨWî¡Íš[{ÓÐíòí,¥RícVƒHLŽŠÄÈA¼«—ˆBFí•ë½±×°ü»='²[Föèé53n¿†Š*GÂRÆOä´¶ó¶&¯Îhxæ¦iI½Dó±:ß>ÖÃV9«-¶Û£¹G†¯'"þD¿KcGu—óQj\C»¢òù1V¡ÚÏŒÆt_:3âw Íɽخ2¥mæì¨–‹b!³ö½:Þ¤äb7ú‘¡S#7Ý>DFÖÅ6W1 M¡R¦ó:*"S¼Ž6ºxæfFR’##WE‹ fæùÆÜ5Ö) Sd~ˆh„. ã«23Rt/ªø.uvQö7ÕžJÞ¹Ù“XN†æ¿afpN\hÆay)ý}Û© «ÖsM[“¹LhL¦™yŒRßõG¼Ü-¤oª<%Ù\o¥«Ër?ÝFC|RýâópÌ\þ3Ž^§xùu"ö+FSG¯¯æJû²·ÆÌåŸ|Òsû€ÏkØér¶+–&5º¢9ßû1?WÜ0T ÑÝ™®¤>bƒob}CËÙ«0T ƒ±îNä̆âÏëUô™”‘Nndæ„>_,Å‹ßê§‹Â1²³,Öل׎±þÌÈ´)ÿ‘†\öÊIÓtµ‡T2™°§ÍuüÖÏ¥¢Í)‡Ä!_<6_À€b\5±/¨lOìW,µ&÷«Ü­[•_À€‚C‹ÏEWImòw>еèRÑ>&öå¤ÒZ»A$scráã¥T'9Òm5æü®ò¢°ô¨†~Säªè%ÖÛ:DäÜl¼°ñGsD3é.f_1žür§FFƆƊ̪ňØr\çrdO×A‘ª¢"Ñ•ÈÕî°³Ü?gbs$ŸÖ)­'³´¬,¿E‰4H¡º1îÌVs1㎖댑tFSyVc\ù˜k|˸nv kø2’߆JefDž©’U^¶Ô¢1¾×•mŒÏÄ,¾[.üœ¦n +âûfðC$$¯ººäªHý0»:¹ë +; •è§žeœëLFÍ%¯ç‹7¡éØŒ•F§Éyº±ºúkâ³îÕ¡´«¹Ü0ßXkÚßݵÓ{‹HU­ÉHk†"­¹Ò"Ãìf~%¯oÌ3ÊæÏÞÑèTåÞë,Fç2••¥ŸQæme—YbFÛIC‰Sù'*2ÓlZh:tw™)ÄÕ:’xv&ÈH4Ÿ~V3Œ¤c¥mj%SkjU97U'vD¥§èoTm¼'2L8¾¼æ³ª31IªŽf¤îJU!NÇ®¢š¡“¸®úIfÏ8‹§d¬ªã\wt e\mžä$ô1o—\žÎæŒj/šaGs:²Äegûjš³±’W•”½ê$´»¤Êͨιó¢;ª•ì¦×+4u‡¤öºÒ¶!ù¦Ø8—ü,ŠÏ¹ùñ5sÞåWó²×&Õøÿºäv±ríz­—ôGˆˆ%zß"™ñ[Ù%TÅ›Ê=é™]U툔K‘çää•HoÃïïê® õ­9eÐë™ëÕ’d6ÊOa¿ß´¾µñß͆ü®ã¸ ÉÞ¹:‘Þ¬$Öó~£bRóÎHÊŽÅa~ŒD3 Y™Žc,èZ^±Ë«ômQSU/#Ur~I7è3÷¯ šNGƒþKÌ-Mª2†•1“ëjfˆl¹ñªì†ÇÊ-7ÚÎS³“ƒ–±ûÝmªŒî eZbçA×§l×}?{J¡¹\–›±©MƒþÍJ<KÇ +qJ眘§õÖµ˜Õ´ŠÙ5t+ÇœRxn¬’ÒÊq>ët…F"¯IÏø!ét7¡åSšc +‹ªsÜáK³_ŸÒäWìÈè~ÎëK±g·Uµ,=3홇J~%w ‡hw·óðrVds4^xÓÝ•}Ø¥ôü«1תÔᲞIjÅ©1 +™È4g³å%6FNuºÒ˜S‘ÇêéM)«uÌL‘f2æ¶¹ž¥zº?¶üÎÊט5ª›šÆhÄ„¥­¨n°NÓ–Lklh™Ði°^‘ûˆGH÷]*!ÇÕ"Ÿ´­!õ¢TëzSñe¼¥z÷ }°L–VMf¦.r4”Ö°%ƒ%7¬~®®VDzÙ±$žÁk­UrIFĬ*3R™/#×ÌJê>aO!;#žPmš?O =2صD7ÄE÷æµÆŽ:.û¥*äÉ¿6GækhÞck/wÜíªêîF’knbáÔ •wn=ÇSÈsrãÆ¤ãJ:wíIÆ©HÆÚq6±âɉQ„ã<Ì#d–¢™§3u÷’a%ÖßùË0¡^ÉéµF¹"D5¿«£\ÓŽ²‘™˜ ²…6%!i99 eÆBó2_Û¸o†ÈÕ™Ù&~ÜC×ݾ㌻èîi'&DÙbú,8NQs†ùÆUûF/}qEß87ý¤(בimhg¾QzÊÕª­L³»ÏpÉ[òâÉ¡ägÏ埯»Ó,Ö£]Êå¨NäÆ ÙÿzKD.¡]n<Ùª>ì÷øãÔE¥žQ„HC¡ûÕV+oG먈'©™Ú¾]×Ññü^éÑv…ï”=Ê–L´ñ š‡(w}Ñu¥±Š%e£"ÆÛlué\­M‘Êõ’·íŒý*diŸ¢C"ö™£ŽnW©…Lí×äªë$S'DCWÆúä\ë¼U³—E¤¤ŒŽÎKgzu)þ›š“²Î=¾l%F¢!Õ¾2VœòI®uªß2Ÿç¿˜]Wlo߯Üëú:;s•~¯®sÅZÒ_Œ&9ŽWïP]ñêRvCVÕ[Ë©Õpµ-zM É´DXÄÞɇ=\V’¹¿ WËçgÊ£ÏE¤#ãi‡66ªÒ>wähõWÕ1þÎ,¯?¹•Ь–¯“‰ÛŽ.dœši^F=žìöºŸœæj¤,¡+É«Zó!Eñ²üR2V•Sæî%­ŽmFño”§¼Ïi%ÓÊÙ²£‘")e®¬ ¿•·m“¢JûE +ïÚúdÞ«(þ-¥!§Káï~8ò™¡òÓ?MÏbw×Ü#žŠÙFeؾ̆f¾¬|•Rjnì:*3¡9GEd8$×NQ/¤²gZ7(V!gêë¬.””y?w ÙehPææÊЭ_çÂzU^£j¥†¯Ó²>#çØeì §|‘»œÈ!2#Ç㼤-Ußš›û™\ãH+F6㨌êRïôŽ"$"÷šv¤L<´¹ÔMÙÇñjêáÑô¼©‹P¦L3eÿÝÔÕT:¾ÈÇWUÕ1¹³*eì{j·R]o:%eKf¬,ÃZ¬úYÅN©ß¸6+"ª‹“¤Ó”ÕXk4$Fccå ©g=Óš¥|Û MsÊÓ“Í[y|¡#óøWÊZF¼PYgÆfå‰õÓàgÌgmm–´U—”X‘ey÷¹«}x<ËÇË,£²mvc•ßùêÆÇd\ȶþu\×ËV¦¡ÓæãŸ"¨¤e™G%dE’(Sp dR±@QSÐ)~B",  + (2DV“%1‡Œ@ Àɶd’6SÒ´=ñ¤!7fQí¢+“Å/]”1ÃDò—ã©(ÀâãÉÐÔýB¡…µ¸CnëíaɽVàóæŠðl´“@“܈Yôͱà%èa,™ˆ·¼Û8q‚´ ™h>®lÞ]ùH°D·þø»§%}3LÑ`Bk?å_a–EÌEÀpY„)»ä)†Œ¼'´Bò^ò_œIöÎËüÔAû´D¦,4ÈC æó}d2<ÊV·¼š£>xO€•%° ñ€Å¸¥38‚QA!𹇠 l…Áì˶n êØ +!šq´B+•f¹——Rß¡†­/#ˆ¼Á©I<=°Û +>é²:Kø›`E£|&Žˆopž$÷B·¦ZqSßøà&Ëa”­àD—bwê7)M‡­Px‚åÙ4^!3 3ÔŠüÂz‚v»K­–]F pÔ®UÜ æGOèÝüŠ]†Âq¦Ër…Y°KØ3ÍSu;Rs® Ör “©“*xEK‚ìcXÊW§& ‰Åy¡ru»õ»t{\ ž ±Á™`+¶rns¡|U. ýç +%½G¤çIêÉI¡¿±¯k‚Á¤ä +æH0yÒ”¾N iâ+ Ë* ¸˜GúySðË+B!íÒû/’6Lrö–§mÛ¿Ý(|ĪյžüR Kù¼$Š¿òw©Xåa—8èÄ/'|šî~„²ÙAÐGü‘§5V±FW½ÞÆRJ~W*=OSYO<Æö,ž®m°)7ƒ†çt×]ÈTþDÇâ§Ug»ÝΡ§ ·£AÑF¿¿ÌÙL3šL¼Rs⊠PJWIÖuBÏÆ±/1!ÇŒ8!JÙ4g·®1Dî¿‹]9úWé„ÊR:/%DÃK¼Òü!ÔÌp5"ERnÌ`ÓÌ@BÄ9”xÛ¾0Ui =D§Ž>Sœ±Þ™òÄÖÄX”u,rÐA­/¦VS.rØ,¶~à{|/mâB'|¾/LZÈ( -s3b:Øt@B‘e3‘*±d,˪öýLáêyýMÞÍ‚¾@ØQe-åHé8f +<üM$¹9Û*y¡çƒÙOȵª/âÞ-17RŠ!•€Ö¤`¬nIDÆiøà œ¢m@»úüéL$‹ôùá|Æ™æ\§1² Q€jç†i+õô.<‹ðf4ûkh1& +Hñ¶ÛS1w_sN×åy®†ÌÈ1•ÃEL]rHí(ú ÀÖŠø÷ÓI+à@ñ>†š‚Iô7·¡>“¸~O,M:|­4óë7ø0°æŒ#K‰±.z‰3î¤ödªW¤+ߥ\¬®h?‚EíD¼¨Z²,¥´KÒ,ºŠóÞ W@²GÓùìá0ÞÜrÿ_´[Y•9ŒNÁEIÝ´:íØˆH'±l¨ðÀŠsehŒõ;u t”“åHyx†®ø!˜[@œ€'–(€Ðjh¤$,¨¿ÀŠÀ0 +¯ÿÄK"–çÜ«ê£gÑ(4‰Õ¾N†ã¤Dû(¤)Ó½Ñì @厄çù )FˆÀ|=AËNMpA8ÄæXÂ0•ó#S_°˜~Íl¸¢•^³¡? Oy .ãˆ#%\¢xiiðÁ7…"ðº" YI^&™†§ÍÖ.“âèr“L}¾7¹í +½ð"Õ@ªÛ+R þpW?± +0±a«BN¤ä¦í·iCf±#MVhÅ3>ñfÄ‹ŠéV:£2ñc€E©Xÿf¢)â°ÉN¬d¤7<$Q˜@‹˜<×þ?EÃ÷÷ç2z‹%8>KrѾ +Ç@Fs dIbÅÞyz2€2Á µö|1“jJÐü©ŒAªcJY,JÒN{,» ²³üºœ%¦Š~$ Îa]*9Z +;q‡>‘3C¾É„POëH-…¡É‚øêÅ®ËÄî¡c/éš­ ü­0A1¥"4°T@gL2X?¨ÕwE°›æ?=û-螌p…áÕæç!„Yœ³=Ðöà26×ø-LJö–FålIÒ~‚ðT¸¡ äÝùZ¦ânèŒÉ}.êÖ sðÇœ›ÿ˜½b¡‹óÖV +H­ºñi4TNŠ?j7çÖ±RRuLuhx¦ÒÞ°î'¶¢ŒG?1‚zXÿÔ;‰)LÌ?X;t’ÁªR¬¤º^ ¸ósà¸à#!Fü¿F9Êè²JFpU×ö +01N:…e‚ ={ºƒ`ÍÖ0'îg… +koçRvb¡8¥Ü?ˆ;Ú ŽÔYVH- +,T r'Ë¢YÜQ +ƃA1ý3§K·3Úºü=54è{?äЂÃ>½…_ž‘òÍû +>ÖS˜DB²ßâ(ÅÒ»*sv -æ­&&ŽY»)zhìŽ>´Dà8è%î°•ÏÛŠf-¢átcÂU-Ôÿéí\4}¢¦æÉªÒÆÐ´NP¦`Cx 'Ã|>›¨Æ=3‰ÍÃwub'Ý£O®#ðˆ§Q9¹ƒn['ÖE¦JZ.B©m²â$jìÁ 6\·{׳‚Ç!]“§ £êƒñ‰¡|-ä‚*œÍÂ’y•³s5Rc¶pn™OÉB£_e c2Äòý§ÐGR\+{ÚP¬Pdða5NHwHÁüø–A>–´R³ôâO€ˆcþàL­nŒG´Ùî t‘ºµÂÚFRš´„´Õ9ý4á9KuÚÏ’ëfZ0†°ºî\ùÐU´™µÒ5¶ü£:ÆÏ壈qØ!,¼?a³S$«BÿHi‹øìgªÙ[ÀX·NÕgL»©…yÊ?šcÛŸçê–ð#ŒbAuùè…§ˆÞÀc{ëÕv ô±i!y(É­>¨¥èeh® 9‰Br€ö óŸ +i 3Þñ< wg"-PøÃO:Öß|h£màN•á³þ“j/³‹ þÂ=æÝ”$exD×A5hbƒj3p?jèÖ_j?­(ß jFþ#¿ü§›ü§j=Ö)ÃOµÏ`™v«½Juäáæ‡¡üß ò†cAÈFR¾V;o•12Ï IïÙ°Ñjb¤Ô›¸%Ò‡V]«$c;H RóË*†íëgÓB0„µ#—¬ÃL0á¦I8càÑgZ'¸_ÑQ‰FÚC¤bp%]¯O¦}‰eâˆô´¹÷µ9¡% VàNá…‰¯­µôµclôüÚ +;ÏÙ¸/ ¿nÜ”:z!?ƒú2r:JÀg×iè‘öm’*ƒ»ˆò4œ¿l-Ë]Ý1Œzܾ"@ΜFE}JîÊdøô p¤ª†“®yáè}óÏgÚZÎÂ6ɶðáØââÀ€Û˜ª–vgdÑ‚Ùg-š Éòô"É!ã»Ûê„÷5H¶‰APÓÐ…t:¬^Z*ªI³‹ÑѶêÍ'òzH×¥ÃéjNQºãGJ´Ó§»´=æ±ð(Á›ÎŽ]ú›[Ñž”·©;™Î…Hù#`¸ŽF%ܬeU +x4‚6^w)-J…o8sÉëÕ×2h·ÅÎ@ùÓÉ¢Æso530=ðB4É3C΃Ô;©ˆQ$Ⱥ +°}j*óžÛXð=c›Œod#U5é‚ ®n{ó ä7wÝ+–Ç¥;ÆøiÓhδ4º‘ÑÜö ú£ât?ËmxÍ\Ħ©hŒÆe‰›¯,#4¶b)€aN;Ì Aé]C"‘za´Ma‰€eç“Õ·ÝfRô³2ivAxŠæAg,€¨ðb0ÓÂZâ$usFð«[ËNn?‚RàÜSë%²ßê¡zÒâô®˜QxzhQ&TJ¨†‘A ±$ŽŠÑRhzvrËØœõ@*x‰r‘.úüð”h$ û%c}ln-ïÍ|~n¹ªéè6‹+­½‹IÁ3n†I6-(iÀÉý¦w@·CBºµº·†ƒ.}CYÎYÍ€}¼ã¶R /h^ÞÙ²å‰(Åz¡fˆ>W"\5F»Îõ¦² pí™þ#•ˆcÂ#…Ú2+Úvƒi€.¤ Qçç´Ë¨ÃZcÏS’åõ –0Ì=—yrŽ uãý#By6Úµ0E è"D&ýäüÅGðQF`¤†Å’WÉBEþ«+§©7.ˆÐ†)í°*Ú¸=cbË/µx¨§ÊæÎèRÜ%´™K,«ò!ðf4 '?TáœüðÄ"Û6bí‚ÛÎKJ:Òû@}•éG 9QŒŠZ¯€Äádªhîó"ÅíëEèK1ÍOÉ}‹ŒQ0õÝX‰#"ûP¸UÄ^t! +»á§w€i–Š``¦ES]W|°`•—W…ªVå{E•3¹‚K*½LÛßNò9+ ñ”~¾ÐQ²ZË2 +œYíúîhþPBЙî±+^z°·!Œ°òUs(‰^ï¢ú‰» +zŸ ‹)€â’LVØöŠ7ºžUÿÌ:Êc"Pù»y¿ägn”—CšeŠ,x‡à¤¦²ÆC}† 9ĤUT‡dÉõ Òݪ†Á0ÀCÐsgÃ$–F74)84\~¼8„DÉîÕ‰3“˜·„iw}O°ÛÄïX P´Ií‹jÀû:»!³©”iÂÝ|Å5R´ù EA0´¾´)•a¦W`~?ÁÂNNÞYÞ½æ5¥màǤ’m]kt1-Ê~pÇØ×`®g”η+–Ø*úŽ{Ð2XýÎ׈KÜЗÃ`!™[B +”Hbý\-²ÂНÂ7‰á±àÇ—Aiá3¢ÁNÈu!f#A°œ‚!›cr1¾æ{!ÜBùÈá·¤h™§*³qÞYNBÌÑ¥CE¹u+ )2Y(—‘Ü':ýî†3“•î&± ½‹xÍOÏÛ§ *9NnE„z ¹5L(m.6ÍtGœ§s–¡mŠ!U\¬Oè*:’X, š~‡ÖŸ®EÕM®ç‚b•Ô‰dˆxzØ´=ã0åÒèhçÈc,qDÄÆ–cÉ\?ådó»ï§îgùôÙ!­ÇW±‹Zí#¹ H:³Íƒe÷>–¼—N% ’ €cd—˜6"l¥ß.#”Ëúžÿú†˜ŠóΡðbeK(Ð=&–ùw•»PKªMÛö«Whöó¬ K~®“HwŸ5ð«Ô©;¤»ƒãÅÏôÓØK!0ÉV{A¨‹Í‹L1£pgí‹ð4ÇØ\`9?L‚¾¼SÞ:éFÕÉ3ôzy·gòi›–™õ^$%ÆÝŠ˜÷JQÒÀ”ÆŠœ±ºBÁ¤ã÷H¥eB"²'O Bl =ûb YJz‹‘ñ±Ô¢$ÐkKh ¢ÒgÝÎæªÀé]Ó³žbØ‚Cƒµr;%¼œ +{IYÒáîÏ0-µÍ`¥vK©€Nj) Ií Kh &Õ@„¾IŠ©eâÂsŒêeÕ$BFºûk€àHûrspä³AˆYZŠ)²É…[ûÙ™Ÿ`È6¹ò˜•®î‚¨«tZ3³ ˆŒZŸN–BÌàÖ.QûÞçÿ¤Öå&GÁFOÝø\ K`GlÅÒ Ú.þ"͈~Ô6¼iÔ«.c¡DÏr ¢ë:þHÈÊ.¼oûi®g¤æN¥±a»+u ÞœìHI%zŽß¶®…&…wI5@¹þB„`R·R›æŽ…ñ“ €scÂG”ŽºŠ_¼REÂIÇÜÈ)}É‹`ލóC,Æùiqu*È0$©ßØøËCs³”³Eðžrû|`T–P¶hÌ[‡Âþ`Õ(2AcÂÀÍ€&³ˆ[ÏEž2™ü²Ÿ­ƒîu!´E¸ëóÞIMÍEâÁA@F¤#æüƒþMj2Q&u‰Ÿ3ðŽŒòežûE$´H4H͘PÍÂI@ªwÝa;1Zƒ˜•W­! 6yÓÙJ´_j ¦°B 7»‰HÉ5Óüø1?f³su˜\ÇOXhtQÅÞF< ÚnŒxãç…¢ðZ$G +eB§³FÉÐ\b7þnÉ+§Ï8»töš(HH0Éú"¸~nΦ+5â¬Ù«àâQsKmÎO}¦ßî“$ˆQB * {í;5€}yŽ¡Aei”Czú­ÎB:vUÁ—§_xÏq„Ê,p\\)¥iÿ…ìªiŠ&½ã÷,_n´›è´Xâµ5‚G¨Þ2 +ÀX’Ô‘0²q–Þ(’Y&q¨Ñ/³÷DT¬ô©Z!{Ó„²j ª¦ücUÙ”&ÚF ǽ%O‡ë¢Iy£–ΨâÝ­áDG£z,A +Nïæ(/r–¹…7饅¢pm¼ÉISºø”1Z¡î‰†åÓ—MSà§Å?7lª‰s7pï#5¥ûñt>úO‘—ˆw–ÇÕ±Ó˜ª>MZkg +tR+u™†)“iP¼ÌOU@MM‘*§Ð[Þ³5F è"~?¼„i1\!é6Ò;Hc)2 wúÓ¤’*¸nef¨ +¿­T¡ìȨ¥ÉaÝTgkNOc×øË2¯ÙgŒÛµøˆÅØ–ÓE ’Ø`‹¡ç‚uÃH!ÈkQ‘¹Ôu³¬ ˆ_¶±×ý×ÁÛvÙò¢!ÿ›z§4!Ì™ÖQÎß%z²h¹ˆðó‡‰.Ú c^„`©ÌéQ:âðG±„ÿœôR)Î-9E°åÎÆu$…oþÑêzý£ÛÚâ“BM'Žs{†Ó¢å†”˜_ΛÑ!žX™Š¨ö¹¯J± J.måãÅp‰)ÖÎ ã~z•Õð½b:kXóì“ÁÝ _=Š lƒ±Ô_K°‡b’(A€Q¶áS€‰Úô±ºø½E1—4Km`ƒÇ/Q±?,Ö¿y¶ótxÖK +0ÉaD‰6 +FúˆLrÿþ¬2þU[ð± Ä|œ]Ù8UžD¾©É~ú¯Jš¾VAl†IF6vl—p‡ØS`×b>äÓÙG)Ù]M–ðÞÇ„6ÖçMC»ÇÀ›é…Í…&ËKKwŠ]$žWœ5Љ;ñ³»îæÛoH:žs +¾&ããû9`³X_õh1<íc&g¼…Š>(ÜK;©3Ùd%1H X((ÄsžN€ŽÄw91ª¢Â;³"ªHn\B¨¬SÛ 4 ¾Ë²ÈÀR«h}›A ¤<'YòØÅÓ•†…$ªÆ÷Ϊýã}Ýï-æJËAZû‚¶tœ¼¬/ü!Ò ª[\¸˜@˜”J—ö*Ì”EÝSV&HÅ駪=ó`ÏÿóŸ?‚¡@IÓí2ŽK ¨”ÙUõ[±›è.óvÜCõÌã¦|cŠF¶[¡¬Ë*ÅžA{ -ûRa­W#¿>OÃË—]M„¡ƒO>×e öýS$å¾QÄ(3Ò—×þ‘Lÿ +âXo¿éãd¨ï‹cZ—ã4|¾¡W—‡¸îê bN?ÂûÉYyÔLfœÎ÷gÐÎJï@O™eƒ@ Äüb@ë2‚?ˆyð7ÞøGˆ‘ ÷ +.I1]ŠÒËÈkÑÑÊ„6OásÂÀ”\‘QÞâZóÜorAú0W´§8ý‡q‘BLä !½|—°øy’ñd¸léÀ¿mPj¡jRûsÁ2Í«ÞõâP%à‰´ºJLìÏDæ^ÛôiÇl¼OÈß3†öÆé~#16Mw`iÀ`ûæ—Pk±[>#ÜyKa%«§ÖÈ.>4êDóým˜ $MSÓ² FËѲ1¬%„ƿ焛nKÙÅÝÄÄ 7‹Wò“€¥´`åœk¦JμÇäŠA¥cˆòRª~ÞAí˜Éc„qµpµžÁ\ö4ê[À¦MC·J6Õ¯µ>ƒ( P¹’rC`#ò:@Ê¡§,áT‰ÄIa*|RQ3l õá„t€© aHpM_¹lÁéügcÂA«ßgrcª „KÔ^²#V=©?ä ³_Eº ê%¼!½f#XdÙ7@#ò‰\BÀ „€DÒ!h@ET©(gŠ[q$DŽŒõ–¶€þaÂè]×¢B´AÛºG¹מ×vAÍ@Ë©èÙ}­ÔšøpŸ”›€Œ€%,ÏPD(áÇ)Ù‡Ü]A(Ïþ‰W …äF‹MÙ!.H("¾ÄÓ4\I”ÊÝ‹dÓÆNh­jZzuGzzä4³²lWÖ¤ ¢ù? 1Éx*A?› Ž:$ ½_¬Jb¹p­ÕzAqúü.K˜ÊBzMKÞÓ>#ÊÅDRš¨…Òi¼´/ãŽéÄu]Ÿ æ‹cZß4º…´¿¨#¶Ü1Ö¯¤8©‚)ˆá2 +Æ@™J´¿-Zóæâ§€ŽÐtA¤d×9)$EÐe5ÇE9QÎþ~Äd'½¼TÚ7ã‰ï!|1o2ö픃v7½Ñ1äÍåH¼çM[QG°Bóq1ô¹Ë ž–ôÐÇA]ôìð¨ýÍÖ€ÿ0>³¸Dì¸e]¤D0«Ø ”³è2p-g1®Sl€oüþ­”S«Ù5Šñ€Geñ“r¹‚¬]ǧãÍoÖ)ŠòI7˜Pĵ>ô“…¾fZô°×KA†šXÛ\]?î€"ÛqK|HÞ&6NcÈõP^[fF&bFžŠ¤·‰Ûò`%FžòHàœŸ{½h4¿àšœ@äC¢¯Ô” ÎÏ6»sO‡î$D…ÔÎ §ãkœhF>ÁÇ<|¢´ø°‹á?"r4ÍXªìmáDA:Cl;ù‚C¤ ´qiw# “WÓé¼ {=*n³#"Üî”Î.S|¸Œ<ò¬Ãlµ+¾‰Ñ±„ó?FR™ú;"‘Û8ÒÃȽ\aì®ÉŸ+€ÿàüúSù£,¥Ð@ º‹ÿÊ9ìycŸÿìsž²æì²q•” ÐèÒù°ô³ž×f{¡ý­cÅè÷´îs‘4YüDJÉ_Ü.#ÎL>Ê+—]cŒK¨®VÔï˜KWÄ —҈ЪvS0ŠIR` À#:`­ž RÆÆL¨6Áú$]ÆV|ö,¶ ÜpP5\H%ä… LZE&ÝærPßÙ¼CosL4Þ¹¢dIñ‹Ãýцo'šR^”õ=¡Ó6}~SùªQ‚á! +[…¨LÍߌw¶ÒðO$ ü1ÆxEp.:æ!¢­"~4ÂÓè$26Rg†]#B‰×GAÑyÖ˜w–=!=躂=íßTLŠè˜¹ ÃÁ#¯›Ê8¨Síøe ¥ó¯ß3¯¨bV–öÿ“§s¾ÞÜ} íIÎ¥Òð[OZ,ÑÓ{7ŒõP¯" ³÷Fèn3ùÓR¯ZèCÛè0…E½,žbGdÖSÙ¿ˆ6_žöب6íK˜Evۆ뱅{„ñ/÷Ò-$n&•iô)åÄhpš´‚?§Ì-5bÞ:¬…«äçÀеƒÊ3ñ À¶º[Ë£%Ãä–½GħIn¨g]Sqý☹kò]ºá0%iU«R¬6MòÛBNÝ7¤SøoøQýkñ’³Q/A”oV¿ ôtàLéŸO$tCq ÉXûmŽTG½^øÉdZµ¸U)"Ø÷’æµ&:?Ò—l’,>ð dzŸ9Uѯ²¥"dI’ßõ'Ôîü™Ý¾¶·r;ƒUžLŒâ ÎÌS¦“,ih"”—˜Æàc¸k[=t¯Kn‘Ð?€ÊÛ]vÆ ‹b$ºE:Ýp~m° ˜¹b}{±åȯÿ õ—Oõ5 „<¹ÊKS8½¢·qûš6pLâAØ\3 ¾ÿ“Uí¨º™ŒjPgã›Tz)`åûFè,.8‚˜¡jJ¤Ùô¼Ô`¶äæ)Ð×xô4d¦·,ÊÁX«'µ‹䀚ö˜"‰8çã~‹9R¤–´µ_Ø\·>v§ÇºÏJƒàµ“GEÌ=L£%“)F,F»u/DŠô<$Ny¼” +nFˆ` Ä@Ò!lèØøÄÏ_öS,&€¬µaC"o‚ýc«#¡ÐO÷)¥øÏ)?„äõøSH¨_q +…¯×v3¦>"¯[ü»ñ +4‡¿ûy)FÂG…^·*ºê}¿b…J å~ ÛŠ½åÝ7PS®¦¿LaOg½ ."¶È%g„—èœÕ˜ …µ³2i,½ FNV[dÞ"ABÇg X uQÑÁŽ ûÀ²Ðf­^ë|øi²Çª&M·T©6.óéJ¿ÈW:¥:²h¤Ô͸~°aê#]"[{IñÔ^w%uÖ„„ø= ]ƈrv¸î¶dÒL]Ð"WœWšèfÆçS·XœŸmÔÇ6n”‡Þi¶1×v½V ^óIØ–†:­ôÎì#drGv½moðá5‚&VÏá‘4ì–²­B×OzC¨îÇvQ4jp‚91šLõ Y0õ~}7-úŠ0ƒŒ]«ÚC¿I"_Ê"rµo¼BKm$}/z'”¢×è=È«eÓž3üö÷ŽôPk¬~J¢Ši•¢ŒÉ¾Åræ%Áme€§ÄSô6Kgl?‡©‡rd¢JxbK÷«ÐQøó®0Z4°ºn'FýN(*ÓÐ JÊ+wo…ä&c{ŠùP¤$q¸=…GHÖökKk†¹æÙݵdR?7ÈŽÕ[3"jè„PèÂ'Cgv§U¨l…EÐР%¦6;æ¹]|>¥?i2Ueá€ãâæ.‹™mlŽL{Æeéi”X?¾Áy¬fÚÿÎ<-éÙ®Aʈ'Tp(^<ã›Ñ,úp)O ‰G†ztE ßÒ߈ëå#öAó¥cQ@72üàQv?ªÄgâM´.ÛDG –éÕ^°XX'ËÃdúÕ8lªòLÕŽNùžáº²^U"³#jcÝs•‰RªßÇöUɪtLÅÈ¢Vå©E‚«ÅM,wnúm­+nŽÍ%Þmµõ”ÿ”G¶EaoÚé%ÿ&÷WFMãu|ü”1…yÇ/ᜫSêä_Œ*b„ú^b 5nYr{—ÓŠÍN É'Ûó¤g>çógÿ Ê‘Ö⊠+¢g!¯¾¶3i%±ˆõÐÊì'Ò€ûu¡”¯ßã‹.ôÙr¸÷àsr^o¤óë¦Äp÷„Õð…d5ôÊÑY~MˆlÊg2”| ˆ´ŽÃH,=kg@v¹n¨=nKý—].=9¦J×O™Ê½c»výRt1ø]/[ »C?[7`~² Ü}ÊTPªÉ1§\×Ë}¹ —îš v¹„¬Q—MÀTÄ!P?L§•Í’Jç7éy¥@FoyÙ¾ÍAêF,ƒífèeâ$Tž”Kÿ‘÷?a±‡Û²ãdvþdܯiÙla¨) vÅ^'—-ÐÈCÿˆ­'Õ¡œÐcë‚U-›eäA˜=!LïO>yIpuÚdtåŽth zGhž&Ú÷<»2EBµ1ÓˆT¼NÙpÛ%Nj 2­hš4I+ š©ü“–šnÇÒmé‘O¾äÒ:[380ü@Å_íóøÔ•`mv!p±³oLWo4ÿ©BOÕJøí¯y–XI/H L!®3Úûk´eÚtòIéãsCî×{›v‰r®zà ÒtLù‡¾¶E4L“xsæ å3óœÄØ”Q ø·ÅkÓª²“°…- ¸ Š–ð¤9‹B¡ùÃI”#| +d•ül^W>¨´”×.õ"ŸkYy:äÆ$뻌Ppd쮾v¾ ‘$,â­: +ÃâøÞ`âÛ'Bˆà«Œ¤P›š›cóG‹‘K€º±>ßw™Rɪ´õ[ ˆvHDž“4ç6 d„ET¤ôLŠès$4O +€*Ô’ÅWœu”_½mÅa¢µÐœ²JU(!O[F À0åOК˜$C ˆ_(?¾AN,ºêá&“O„´3üs›%Çw›£FSX…SëŸI=OW·ßÄ™r;8~¥nçýØ}X?³̪<ÙA»¿ÑÃhýa)d`ôNäpN€RÈÁŒuƒß(câªeì­'‚^"£6v¯°1>kJŽ%þ)€qY´ÏZ´»úÕ{o°vl#j Zè£ao‚Lj˜j +ÐÙĆÜûŒ5 |ƒ¦rõ¶?©©üL–Å–žÿÔô7ò@,„D¤̣褸õÄ"F }×íæmó®Õ© 9UÀ»–ÒvNÚ6<õtF(E3èHw__‘%©TƒvmOˆqù•ï-«û0Tß{Y(±ÈBÂfDˆ‘0o †<#ˆÌ+ðRÉ€ƒd ñ6»Ø­X¨Wû=XW̓æ¶ÇŒ+³È#¹£>¼q N>Y°o´‡“ÂZòØàrfÁÖhc +?Ûp¨¶F¨ÏÚM•^, z¨ë ´ÿm†g¼Eq(f\pî0Zo¥6ùž•¾Ê*+¯+ü¬5b=­ ÒdkQÿDò.ídüiÆì÷ø+?i©ðÄ¥ûÄ lÀk²ªf–Ö4Ì!ôp”"×ø f¾8ÚOKã‹póÆÇO’€x'm âXƒ±qÚ­PO½9ì'Ø“KðQ<K9¥Z±¾ж©Ž¶òiMÉšž !`0%/¼Œ”÷„ò$X=ˆ£®ãWmö´Eg3õVbaï ’VÃm{¶'…Å,ÊΟçjå¬&|·Œ¥íí¸ q.à–H[¨’· X–K<„Ùé·¢xžT9‹C­óˆ(t¸»äÂÁžNT$­¡å¨±u§Y™šbZ‚@†.ÈdºCL’£IÛ.6£1˜ÄB£F7ºÛÍlãM«‰ŸA(²Ÿ;úUG…S€LªdÚ‡ºHDÂ_ Á‹ì;9oXÅGÜÎŽÓß­q×M)]Ÿ0§M, +$ÒóUßšŒi¡-ñ&G¡=˜IhÖ´~:‘í#c/ösñí¨ÁbÐAÊñ +¢H iâîp©o'í¸Jêø*k@U$·“³Ù°PÝhV¤WÚž}¼™9ˆ‘$y8IÁñ£/îåÍŒ®Osþf÷ÁÑñœj>·¡—ÐÀ#D»Ož.®b¢Xl¬Áà I÷­FÄ_,DÆ5’7„EV~ñÉK•¥Œ}x!ÕŽ½EÀÕP™•›¦¨) k ¢%<'MRmm²›”´IŠ1ß{¯"¿%lÖ¯0÷ÃI + šÄø{è_†'3ݬiõı³Ü˜_æÌ vßÂhb:C›?„TZœÃÀ¬¬&™Š1[ØAŠœd¶Ž©U|gc‰CyoOr±k4Åô?zåM‰M \ánäEHbó ÞÙ§Ïådüx=ØP ”vêÕ¬žÑ‘—:•§^†ƒ$É`·±Æ€>îibÓZbl9™å$B†Z:M(K…y‡þXRÂ[)\âæI%ütIŠ–›üsVõ•Dî=œ¹Jé(v¸ÒçÈ +z« iVØä-öû¶>Ig†SÏÑM%¾ê~¸—<ŸD!ñi)eñ™Áe;4dˤ•‰ BgõáøC×S¥'´À÷æD—~.H¥ktr¦¿ (M9d3Õ-9C±2gÜ;JØ'ñ ¬ºí&\­Íc(deøt¨.èJæ_N úõ®f§O¡@ÝÆ·Zô¸;Y+RŽu” +Oˆ$ËÈ£“qvñÑÇ 0¢ˆ¬œ:ëœcòîç0 798ñbJŠÛ¾&Þ²há{ÊsmŽX'“d@ü‹ï´lÂE&ö„Däpi`bðRÆxì3t“ÞäCºæ"hzq?i@ ®O¥'¹O}A‘¤Ú;®Ñ¯ù³?Ø 'Æ©ÏÚ'}‰jïޔ üLË>Ü}÷ŽN'‘"©½9E!I0ÈvŸvO«~ƒOææ¶° Mô{ÒHªylj.< +’ø«áR¥)Q`ÏW*’¥†âìWwa +þ=ÑßT×1©ªsINr~ Èœ‚ Q=ÚßÊkÂò"|h6¨î½R±‡iÞÁÁç_6*0~"ü¿Ê3·`œøúuú¿îf9þà QÞ8išÒ£bä>–úŠcdÓp\·¥´uû™@»Ëñ©ŒÙPg*®°b~Šþ€þ„Å!ºfÙka4ž{…Ø ·›÷§‡Ôis¢ýuMmº!÷,|ÒÄ—-;z–0ì•Bn™T@¢·A«¢!(9õEƒ–°ß¡þÊ€sAOþ_;á„ÆÉ=2Á !zA‡qßG ‚Äx&›Cû #œêÐïR"¼rœ°È‘ž¼ÇÄóæÊZp!„4¶ :_Ÿ¡"»ŒòH¡µê +*m52ƒ@ ©£h2CÁá’'Ñ©²F‰¿Dm \úeòGÚLì„ ÑÊ +ŒuØo¸[ò'†¹xQxùÉÌòqúøô–ÌìzI/•Š©Zçí¦ôE–0lú`õÚpÆS[0ÞHž)6"k Y>t0 >kѨ(€6î +¤ÁDq3_âfç3‰íãkÓµΚÁ~;±ÀÈ[Â7‡¬Fj £_«ö‡(uÜEÀ¸íXË ¡ËdŽ7Ú ¦ÁØS}±bÌ 0Ÿ51d¿þ¥R|é»|V‹PrÒ'þ>ˆÓppê0Ýa)v!r!V¨ˆhg)—ƒø™ù.iœx’ïíâ¼Ü09IKžÄ¤^ —pÀç’Tè…×áßJxkžŠáãï=ާuLpÆAEŒßF:°K@¨2lKë1IT4Õ¢Âû`È¡­'G’H:—Uí%V˜¬Ã vÖÅ)r<6/ *L»…~j¹æãNãXakˆ¼pì,9%³BÛ‚û^ 3ú·€Æ%-àó»oˆÓÑMÉlT¹FL…+ÉÚ³p - +¡rÐÜÅ:­(â éT;!x³‘½’‚fh¿¯ˆxþÎùiÆ›y+¹t_÷!P^l–üÓ„gQYò5 ù_˜ƒ ;ß#à`€ ÿëuw¸‚ø­€¡j؉ÍÛ"Ê; ¶ðR\§»ËÆ— -uÓ_þ¥+ ÞÎWÎ-·¿xR•(x*‚†ÏNÑ/è¶:ОñHo¦‡MÇùwˆà¦ÔUMiÎ ³€Ä Òç¡á·ìn³õä@„ÒÜu­( a$CÐÞƒÛ3wÜACr¢«8 Üå¥Q`'ÙDRŸ9q÷e÷‹<3Ôæ¡ûf¹úù.œÀ‹øzV§8vÉôªJ¤$â¤-õ´£pàŠ¢ ¦%¡¼^eÅ/úg]nà- +™ÉXª|þSzÛ¦'†´™ë¦ëŠ~ÄYMg3=SÜ·>i¤i·³5·Å +º}wÀn8ñXXÑåvÍó0;¢¼¾'ùCÌê€W2*/SØ*=u;üðmÈKŠ$?p-¨'ÑêŸâö½É›ºU{šz²å_ξƒ97T}W!„ ŒNÇÖB„ÂÕÖpÞ½êÉÀ¹r%æÇ¿:eüÖª§jŽ“L=‡Tlj©é—JInYlœ*"­aÄ-¼­άÝ=¥cdIÄÛ‡.‰lÚ[ìh>„)‘ìøùÝ»V=y.cµõUÆ)öäZ½IÈž œfsÝqÞ^ •ûm[Ù%ÒD/Ÿé>ãóÇÊ\á éXDƲMsò†8!ÑðDºrAPÒä5Y%ï5–Š9EeKÜeŠ• †ø+×J•z¿üV<’lxMûn´›“1?B[Æy‡´pè±Wvl0¹±óÁª¾ð?r˜èã¸ïtÆSA‹Ð [ÓeŒŽžUÃ{ófN ­ +Û† +=³P®†h¢muñ]IKY ++ ;޶ÊNz yR{$¥%£&6³DY«³'[¥!ų)zðÛ€MûI7!H +™])1Q¢(ú™(OÕÓ¡÷‰5 0Ù¼¾0ýjŒ=eƼÊÄ#b6_©2 õêm áu§ç,•­ÚÎ)½ÂQ\½s%°KÓë+'œHSØ ”‘¤¾%ìØ Ì¶PÄÚD]“.lD!¬IgÀ#¯‰yç-rV_“"Jay+;·¤Ã•eÒùÉWã¾XKE7•\ÝÚhHðÇâ<'Ì({•x»¢yH¢i³–œasqñÐT…4ž|ÉÝ1ÂpprÄM‚iÇÀ7ŠjR¹{M—d +l Æ3Ñ’1?E?}‹Érl`].…ìíɳ6ê¡l¡IÊq;¢0Fyà´ªXÓщ-OšA,Žk@çw|_>µW”m¢aD\Pƒ]d¾¢«c¨ ¶QÙ­ ™'ÚAÝ\¬Â§ûÇ‹ãžYU{@@54J‰„§êTýÌ›„ëŽ@›e]R†t‹'Ø©bw"ü$"@Èa]f,†¾É9˜T1¦H·7Ö[éP<,è5¤‰ +¹Õp[úZ=^à ctt­Üê{œŒÏÙô> +¾"ÄQæ„uÒæÝ”­„–üɨ/Óc¦}ÐáÓ/Ã/ƒ©Ïf2…#¯¹ài“³lÚ40 ³DI˜V óún‰‡{JY­Â7§+³’jÔhÙ° +I¸ ¼ýåÁ­vêîÑòV®Dk­é„óQÉ‚÷ª¬4MwÆþ²‰ nùò EÍÚÏ®[ŒŒ."¯«|!ÆÝˆ òUƒ¢hú£oÄìØßðvtO(ÌÕ;ð .8¬ÇÁ>€çà/¡S¡ÉýéÂ~ìªv†¤:Öå[ Ïpæ£T7” w²yÀˆ£oA·J]–r·•(Q¦sÆÚ ö‹É¡˜ÿTDm:8µ™ØKÚPQ¢+宄ZéqƒÍÀË$meW: Ùþ@,)z¸j·‡ö}¾û ÑÓ¥C!<­Ùåk®ããÜ‚ìÃ&:öƒ{-v=ðTu ý#ïm6ôÙM»ó~ê‰vTÓ’‰„=æ™ÐkQÝt±C¯šk¬BÓ›;”M›j=§†wµœÞF -¿¶ïÛbU“ƒ»ÞLÑhÇœwؼXwf á˜‹$ð¶¤M#ü¤DÝ:ù68 •EœÔŠdùÐ.Š* Úh(ˆðœb×üîŠ=UpÂtAò x&a +9ã¶ÊÅzòÈ$Ë$Pà}aßu4FïŠÞ^éDãêÝ@¤ýáØÕöŸgË6©ÝL‰V¡~TÉn!ê/?}"Έpq¶©S:©œÛ’líõÐï>[”ÞW6[Ç(OâWl¾Žò$%PE]xÂw¸«wë³âžu‡ÙÜ9«øJ‚øíSjz"£m¾Áä¢%@­Ú»Þ«ˆ’s <«žGé~~XA6-ÊF'dÑ,‡Û„ël.—QA À`¨>‹±:ý ‰µpb+Ùímñ/2q¸!k?XZöþê=1`WeD«9”äÔ"¯Cfh锉aÑ–IhiJ3êÚ0_ÿjŸhÑS1YðÞl]nöŒD¦^ãõQ~jÔ‰¥0rÑŒÓåã‹mhVÝDfe|­ÐW Aå"!Ψóˆ#Ñ*htRF%S„¡˜o¹u¹‚DÞê¦sx̺òY¢Çˆ†“^šzP*ÎÒÚt| ç—[m]żꉼ`¥5«yÁ+=,ô)«„Ï–=ŸGxÍÛ=Uý óêáTW–²æ !kWÓ׬(œ UÙ"/£–+L2†ƒb•!Á™þèÈÏP ÍB«R`ƒ« NÉi_(¢1p+*¨„~øs›Z(«¿½ìB«%úBC¶¿8ý­î|¬l€ATF¥‘Ñ ±`j„FSWD0Ð.r¤ýò…,„%³¢-B_¿ð~K8hg&ËófüÉtôÏ%Í4b`ÇÕ¬ÔW„’–Æ©e¬/#´Âk¯ ¹µ¤zoiVÜ—©®­DŸFÎeøçlW—‰ïš¢ŒÍ„G¶È÷Ô=Ë€RTÏBt‹ hÅÀ !>5ê[y[5)®ë +30R¨J£j3¬Ú—\¬ÙÛÊëÖ¤¦Ix¬xÑ®Q +$"qog6ÂÖsÑ´L7²l†o‰«¤IŽdµ5m÷%.I"Þ¦ jeŸÀäÍ_’€ü¿# ¶`ÃtëRÆŒPL³<¦Ã¾¸#;:"µ"M,Dá@%-mþ™½ÊŸŸ×_.a“=‹*Ì8Œ ÊN¸®7Òj¹F‘0ÛÒd+1m'κá"š#8óíaôLÇÔÁЬä Â,ú7 ™›[dý®×»iJ‹A4ŽÞ5L‹¨Á-|A³ü×6\Sqã7í皆 kгKÍHP‹ÓtûǪS‰xÈ/µ¶â±2ÄM¬…&HõuZyñ—ÆD0þäOdQòlÐZ9Ž“R72¡Ã•—¤!8‰KJžwмt01œCÙ.ˆ¤]û½‚ØP²EÁ[dWZszIBÀ`µÝêÒHЏâ5fŒe2&¸d/¹Þm?¹P'/–ñ`vâÔw ™Ìgë˜Ï¦¯_~Ö‹Hèõ¿|+P³Ê=ç}aÜhrÌëÎ0e%ÓO ”¢3c~VË2û…Ö@œ,˜dO¡>ÓžF->ð#] ¡ZWp:Ö±2Œb‹F­ÄA!+¾™“e4(“sÆ9Fjþí‡;*ÀÂ2‰FÒõ‚{_¨ÊK–0yCšZasM‚™ã$Ý4²­L¶x ª³ó4.<ÒQ†u ²/‘ð$cG ú`Bú/[MîÄ”ê¨y{Bmù°Â +j~R +Êß<>ã¼ÆÈ°ƒTC“ç|I ½·žódߌ]KšA"Ù'Ì ÃÆÅõí¶ïc§DRvu`„–šFñfð“êM @·ÑK)0…è‚7 ¾|ûóˤdeú[gɇ L\¤C¦³‰z;#¡®!Àá!·š1ÀÙe ’αe #Wkk +€ ©Ÿkp¼y•’°’àíÈ%^16i˜¿A×”l%ì5LM¤µÍ–h×£S·+“ C=:§2¯ o(‚Ós;jþ%Á¨Í¤‹H¶·‰|+•pUl(²©“˜Ãùi`Pª -éŠY›‡$ªÆßG²H*f€•¶+Øo7V1GòЧM¼¹ØoåWÇÐ'ZGª‚ð an,%.уhw1ÀããY±0¹\åéÈ’íh×À鵚¿’ Õ–é>’áÇDÞJÜu@»ßA"¹XÄäQñ䆶;؆›R%^Îrj +~)Âô‹Á—4$üA’Âæ'W»V²¢&½™µ,ú£sŒJF´É°Ê8O˜Q÷ Mîtô…BwvhôêÐë/Üv(9GTZc³"aâÌ0 )d–±„¯x¡yM©ÖŠk|PäuÔ¦Œ"·MõF)²"U«÷r’wAT¢5 fìG5@™wT¬ˆ ’7eIRH Aq¾–UÆqæ-V³Lþ(ª…–Åδ*ô…ïH½õ¼“ø°®Áè%†÷§S¶ `Ù#­&¡È ®í|–Êš mrª6»¤`ºÆÐ™òú,)xþ†W;e¾Kb¶Sk ó•$îmøá:J–šÊ(LV¯+–)ž¯ãÜÛD‰:àú5Ô{ë‡R* +i’{¿¹‚%÷°—\zlÌä/â‚/³Î–ÿá!2²b3ŸñL*•¼·ŠÓÜ–W•‘ùF…ÙÇþ÷‹²µ³Ce·)M|£[MFC#†ð•»CL^~¸y¿BIYT“ûzX`£ÉàG)¶ôg#ÚZœhx÷W"±g]¸^¡˜Œ!;ñ B]#[µžìx~€”Ó‚*' -r!Í»v“õì¾êÝ¡¶Þ<=Ô[›“?ß]é&w#`Ë®^ÎmÕnðY‚xÁÌÎ +Œ?¸àÐàd"Ó¶¸ÃÕm¹y©°9ò‚-ƒË²‚Óµ4(Áàmìò„ÙçÌú‚ï Á ‘ Ü;´PŸŸ›„ŸÏã)ë<Á™@™ú—ãF«Z$zEj0%0´aÁ…ŽÑ*S$6º;=hsì,¢Ô¡¤M + íž?L1 + Ö,Yê6M2N’Ô^M#SæêNú«w2šµÞÒ„šÛöA#³lx"C äCßÙü×n$…f%kÔ%´æ%ûŽùu>Z­MÖÊ8Íšsí¨•dŽŒ¿þª4]¶ÂŠz$Ôà³xA“Pc|šÛŒË1ß!äÒAäJŸ"Èí& +²ÇžN¦V‰x˜òÍOô<?& ¸•Šò8Y_l †xLJѤž¼ðLT20+ÿi—,Ä9ÂÇïýD(Þ- §²f8³´VÿØ#±ú;ðø(zh&ù?+·ú 9Rg.•aRP ?F =¼g´mLñÒùRqGQ_•5`Gï‚Ô›¬Õƶ¨t7˜¬r\½Ô¯¨Ò]xNý!¬7hˆÉ`é:ÏÎë4œCŸ…Šñ%BS0E%ä?àÚ®)93ÃŒèç}Q­*ÂÆ> iÚŒiQþeCºgZ6Aɉl£NuR§‘6qríu +½c­ áíÃ#î‘ú"¢}šåK>ŒŸ˜È[Ø£Íiƒ2ÑbTåO´Dcè˰h1›»¥Dgþ馯¤h³¥aJÅ·" zS#‹ë1tuù®p&E*hY2†EúD*‹·³É!Åf›A3lq:YSÒcKøe|ºptV +X§›zð‡Ÿ¶IñòÇ[ô-5É÷ÀÇüV*0†A Ú¸\Ë£¡”à |_Õ&Åô¯ Ò¸ˆöÚL®šCjD‡=+¤] ™,½·H›È!q{ÔãVÑ“+1˜c€„«wñ—5À‘#§n¶µýs>áQ ÌpìF úÂsq_P™!¤ºÆcLòªg{_8dÀÂdS÷¿£K+*’>‹-CÌØç“9èÛs( +ÖÖ¥á¦1W-6qŠN8‘15%Q½Ã[V»ÛæØD +1i·òÁè8;£‡]áZ×T@TÊ|àÛy ËKH®ÕFônö ÷-øÃ8`Ø +à+¢¦™µ{QýÕ*x”£œ‘£nìeýû|v6áªðš1‘­XÆ@˜o©LODÿÐ<2Å$ôˆ6aŠ®°kãðzÈâÖ‹¡ÂS<ŠëJ®Lca4,ª0Õ®üRHbþ©8ƒð¡Z™xyDûˆÏã¥nj§Å\AËŒüû\̃̌ŠOr¹€0Ó>¢í!ùÙ[ENˆ ‘@lXßoxÓ—šnr(!±xJîS%¬tŸ=åÓ?–d¿øb)öÕvïªc@ucŽtÅWݱ¦=¡ èíÚþ Ã¼ú8Y?üIÛ)9|˜w,ψ×?"èŠ^"® ˆë@¼ùot@†ixÝ”(âÕùã'<"u¿DÁ+Gñ{Ö‹7K—7Q¢±F ÖH&óQLR=‚åx|W"*@mÿáF:$ÑO0d8Ä]Di™•”·œZÖ]h-&%$|'¤ˆuÇjç+›tø¤!ÜÚ pÙ…þóƒGä Fÿ ,k§_¸GQ—ùís|SÇ„A\¿,¢©kZÆÕEÇMƒ'õrg¾¹42£ÝJ ŽçL6Ù`( +Ž5äÀë…0í£­‹êUP~'×gpÒWbi òiŸIQeE¬[[¥U>õZPyo +Vz‰Á@BcŒÞxD³› Ù mhXoù)ªq,ÜW·¯íª§î @o™Ô±û­±¦ìºÌúX“{A¹3uœ¢”Ä–Ì]GGx†Úß+ž}÷#%¬ª63šö˜&H)ƒO°ÀÚ_?µd-¼ŽÆÂEhjGM Ç—¹…”L6‰Þ˜èy¾Uüµ~Øø¼î†ÌVÅ?`¥Í™þóÁ­ÝiÎ:_y¾TÄ«¸|Etea÷š¿0ËH¼©+Øtí⤫q+CËà›úšÙæ,àŠæ²ìÒXŸ¨€¦Œ^ m<#›š!‘Jo “³2€Õ©¢²‚…WÕÉ«\/ªgi9™ ûZgŽk|Ê…ˆ&«[Xó,/HFïOo]k|¿K7‘hbòõÙ%øó˜»"Š˜;uE!àuvÑç €.d_ÛÉésý +Ð¥ýD–gÓçBz]ów +êsI)”êÿƒ]¶V‰€. ,Ídú\ý ë'wØÁ1IŸ+®ÌÞ&–žk&mŸhÍþ¼ï`*uýpõJlW®ü R™5hŸ²±ë)Ͷ­tµýˆ¥!êF°…á*y™ÛÇ>WGЛ`x yuÅp\¸—/ŽýèÎÜï²wPpüuäÿPÜ´X/¼îW_Ç +`ñ­üý­1zà}„ííY ã—Vèô¹r‰dƒ–ö0³º¾}.µù‡îmÝ5}®‘Ÿ}>]Ê^Aác~Ü3/ɾíeäKÙ00jš}_ _þЧùAÇ_¶ûSÜ÷åÑôSª®HìjFŽìÊ›>øhs`¼oGذ¢¯ÑV§)Hö޾ÏUÜ œ4B˜Hó7)á~\}Én9•HíFôÉ{æ 0eü6V{оâá…ÖV座’lzu@´ewÚÛçj~Ä~Mâ†ÐWì9šé|lèýû\¸›8×!,îî§íÇ1ñÇ|ÇâûÓNŸøÐŠ$>¨w+Ø"%¸-$³oñUO}¶¢æ Ú$hŽöÄ÷E- ôõêŸá.€%i茌Ib()‰2Iƒyiïæâc׋ѡ Um6U_­qÏÑŠªc •cˆ-™J" —=Jщ xþQSdBSÏ„‰Øç—0™Ú4Ì|ÆSä8M¡m'ÚHºFo4zh°dñ  ‰ƒŒ&· òÆÈ©-/ÂM«U§d&’Wt&V¨PQ”¡ó‹ÂD¡˜“wå´/B‰©À §HÝ¢6b».ž}y${‹¦¦¶Í(Œj& +ÃF6|Y"ªuŠFQb +¡0I6‡†—±2¬²…ó:»K¤ébô‹BlTÁžJ!&R–*‹p±R@(LÇ2ˆü§o—“…E)ôB¡ÏH9ôíÑ¢DtSa¨Í,‹`„ª´Û ™Ú‹¤•ZBûÙhÒb$P JÁÂì×ÓK*Ìe{ðej:±ñ<›éä Ñ"¸bÑÿ®‚3 4D#yцTB®ÚI”02»Ñ÷%FP¦„Ô ó]‹‡TA„±"ÙŠ‹påAÖsŠt•&1 ›¢ —Ÿ6AHèÔK©jØ™Q¸ùÚ7béïBâCÌÉÃ2&•gèXäïIF…^ˆê’¸GÚ…ßÔ¦’åòË+ñT@A—ºÑÄxÙB/M1„L5nB˜ú‰Ë¤€þª Àa⇚ ª&b=m©EsjEr¥wDY6TÐñØ)˜pˆ‡>ÝòªŸ „ˆUì×µø`öT3hÙ"ç…è(Å•)•+.­¢Ðˆ4¾ +zÍüLžJ})³%S“ID~ ýÞ>9þOŒˆÇçÊ$ÝLo™8ɹÆŸ“òèTéh$òÕ÷YçÅyEª®â¯“vͧäR†ò‰œ$'Ëëjä·á ÑDx [% NE{§õ’)\,%äJÆAá1Dî›âó!Ú=Šø + E vÞlup=u¢Áâò‚󹨄q^d4®ym%Áu7›ˆGwñxcTEÈ-=§šуûŠ ¤„:KIL‹F ¨ò2—@­q´¦°® µˆTàÖ3ví—Ñ© +ôâó‹Ô•B"8~²¯ÕP¹ðGF +··0q$z‹ý Ö„>stream +Q]G)¢, Ê/¡œLPBM^•¾‰/ÔYg‹‚jùÅÒœ‰Q„'ü´Hx\ÖpŠ vnï ·:öÌ¥F"¨ ¤Ñ„œMŸóŸ$ +>|R^Bú´¨¸´ÖqñJ·‘¦Aä¨+‰ѼUž4aNÏÙ áœsáœõÎ=t9»Vy$çÌæS¹á çÈY$"áJNjœw3»l•-1Jâ^ Z”PpÉQô Âê™»!m°–ê)òÂÊ(ÄĸŒ˜:Ùy òž<1÷CD äH±3»T (?ûV»Ø3L;MJ1‰×xîñÂ?ð5d™o¨eu\±ÍþÄq~¨2õФôÄr_wlB2¡j¦\¨Ÿ¯šT¢†WBlùŸº¥¦!J‰E«Ö”AöqȬm¤J$£Ã*³^Ô ±|¤h?¼ÓŠ"tæÄÄ $Õ6šá|™ÄJä é¤^!EÑ»l ìLHV·H˰;Ó-ŒÀÒTyÁ‡µTÐU‹„5Øœá4¹üðW‰ü6U•„Ó¸ò@˜ZëÄJ•MÉF©‡SÃ[[IOÃu!ÊgV­1T¥­„t£ŒOAOB•‚HB•»Œcè ¡2:ªðTC׊ 9”Áðzr¢D¸ý5P‡jFA½ëWtÑ[ˆïܦ’ðF$sÅL©ø’[8¤Û(Ñâõê­ÇŸIp¥#ÝY(âaçò”ïvÛ55R'Q’jT+¸² ŽžåÿM×ü¥U™XUCSµ¡ÀŒ7ë‘ sï(S‹H"„· +žÞˆô‰~bEjM+=|h>ˆŠCÆó˜4Ú1Fav¤ Ù$Ì#ÃÜQИ}EG )"в`„´Â¤­fä-gU] 9²R á™Yˆ¦jO¯nÝ#¡&¤¦6%2ÛL͸0‡:Ê4†ãô²‰k‹¦ž[-"k™GI¼ZÃÚ‰bò†¶4joÊC¾QÎ~˜)Zv˜ízBØŽ™¯ÿ!™h ¡TŒ¼f³˜ôê²"'ÂOT|jÈ¥p­5Òý µ#_ØÚtÃÈé¸âÕpäPÑä•0¶.õ¡¬eÕsB­_…çP :.±Vž'Hþ0Ôˆ¬½" "Rµª›—扅±#‰ÆÕ'Ô’™å —Ê¢iN›Äˆå1­³‘BÈbÈJ†½*,k„Tk O,+Œ‘O,¶0]* “`Øø3vÒû£Xqâ\323‰ÍPf¨(Z?;Qµ‚*ßXjœyü; +‡/^¾7¦*B’ÔÅ/£PVÏÈe _ð ;&Âw +µ‰r(ƒ­Šæ TL ¦Òü¬Óto…ʈLÒ¡‹i*ƒÓÓ\"➇_шʳ߼?Za‰DÙË2ò|jÅ•†ÊT¡¼£·å ¥`%1ìI†#±2Hª:ìZyÌ&µW¹áV:> ?bÃK[ƒhÚÓìiÔn‰¼ ++S+¯Û‹­DT½A2â‰L=ù4dµfR{„‰/†ëf¨¬ -_‘¶¹*G(‰{—;ä†|\&Æœ¨H~…V"H£¸iȑؤr,ΡrRpÉŽƒÁ5…ÂN5¸Ó3¸¤N8‚eX®,N"=L_±03T¶® ïËAJ×B +‘ ¥GUØ‘Bk‡HéÁ¡ÀÒŠ÷%°Sâ's2ª#5܉Ð3u'ÑiÙ3E׉FÝX©bHtˆS¡´›+3epÜÒù»º ®üÒ—U­)×—[aê!>]J%H×'Ìj͎ǦtE7 Ó8y†‘G˜ÎGB%¡©Ï¸™yMXÞÔG,H‰ÞòÚrÌÒqh]"¢ØG[/ÎJŒl[WCZÕj?:%Öâ!¡{¨t95L%«M³˜L€€L*F²ª„à d80 &<@hn«Œb‡BhC#ÂiÙõ½ýùLr—ô%âDéæb­$ÜÆT=â5JÿoOÊŒˆAQÓfÝ„úì¢c^tFDd¼Ëÿ8M©÷8ûª€ÔÿH·†LÔ14DÁ%F @»º e©Jj‡7`Ø„œ£n;¦j¶m ¶ûscJDÍ„od“8LÞ2Lñùr4i8áÜÁo{³qþC;üz©Ä„©z÷k]D¤Ø˜ªRƒ:£ô‚b Á¨²TLM˜C#’†¾‘û=ZeG2yhꈴÌT)Wx½Z6ÅßÂ_£Ó”\\ óSWL!žOü˜åð®aZS-Æï. +Ì:wjŒ©× ›É‰Ž)<©Ÿí“á›cŠôÏy2‡(âÜ=L唽ajÐyEw0u\Ë…Ï7¢kr3¯ª*œµ Ä‘”2²/#©¬£±í•©Ë¯5é B„ú:2¿bºæ±žBOÄ|ã©ãך0":Ûüm‚¨;b"W•Öe¨Ìw™õeÛuU%šK•ôĥū×*‘Ô7%]eƒª\{;iá?<œ»_ +^:_â“\Â1‰KºghÓÎHÍC +LX©ÆKϼ§Æ‘$v¼”óRe écÌÓ_9¼­)p”s#ÃÃ>×–‰Ö}%³­ý¹†44,ÿ}o ¿Ï»¦ôõ†ˆ\%H¤‰„0‰¶)Ê$7trÆ’_hL]BÆ$‚WpÿceLºÜ¡:‘ ÿÓÚ…'R·LúuÑ𠘄úpøó}óinåÅ!&€,ñŒ9þ*Cj +œgÆ»ƒóÔ ^gy§QSjU‘ÃûÍ“Žc:ånƒ‚¥…ËæùAËM9Ó‹¬ýjƒï~‚rÓ:JYØ‹$ñl€¨ +vS€o ’ÛÛ^7ã›ð<|·ÊBéå +&Ϋî&¹cŠç]DÚHé¿Y;“`E;Xs\ü)Wœ5Á«°E“De-^hi> U’ü„,Ø〫ñ%ðò~·Iº#TMFRpÓ“‘úÈôÓîÁ¼ºŸR^@È= ¨¢ìùäT켊O’š$ÁR––e´o~ýM‚´­žŒÜ;áþuIëV¾µYmT„œ± â²oæãž†":BxZÚõËÛw½¨}÷Ç >—lo’,Òb)N +Pc3[v“H<DÚï@ JZòÒƒÍ8æËò »Du©Š·Œ¨LЉÒÐ>ý=«ryÙ†õI5ÕáÓ…ÆÚ¾ÿP¦=M™t–§aÀ˜$Îe¢I ëÿäMeu­Àße™) WA(ûKY¤í¨í[¸ö½%xùÈÄ·–ňŒïÒ*¦‚4Tb!1¦ó’gܵñ>Å•§ñ i‰¥NmD#Öø¤Ùñ$ÏÏV ëÃXfg%Ì®È]`J›s§÷žµÇ1³`<ªz÷Yß«8&u/AkXÜwT™’‰óVð³}ØK]ï³²7/'Šâ¾p,¤óÜGåÍÜ:"¦!N¤Àïòëæz¿¢0êj¥k¯GN£x”.áM\€‰á°JMÏ÷qBÓJbsñwF!””¸“ÒûX!c³ë&ü kïbSý’äÔóDVï9 ŠFæÙs`5³#¯ ˆšx}Æè8ï%›²€¡ý’Grp^0ºÿÆýKÞîW; ¸ +™{x,˜þy?ÜŽd¨Ð:ãÕ‰¤z—ªÁÈ ´ ÏT`6ÛgŸQT%‘ɼ̲ñ» ªðçËY+C,^€§6>Ô¥’ñ=U¿U^ZŒ)©œAÚÝŠ—ïÊG2$üò”‚ͪO`‰ÿÓYÑ¿EÅ®Sº(8š%>˜¹„o­!÷DÆýr=%÷îÔ^Zâ‚6­7‘Fã²Ïûo½–Öc4áýý¿Úe°  ¢Úð. ú +âh ìWl >š øßY…̸½ó ¨ìBøá‡IgýA‹ÆÀÖÔJùe˜×Ûô¡4%ιër0±©£š"Ág½õÐZ(–~jžiÈœ½¨t‚k£mU$¤Û¾ÙuùØ6SùñÝÐ "–r7gx\0Öă +• —$Q¹ËUàûjä0¾/gp|×úô›¡Ewçcº’”õ,<ð"Ipâ…ãûît'õGB ¥:M‘‡K²¢K¸é˜[`ØE£wÎÒdzÅ®œ(/ÍÝ8ªS8ÛN˜°Qõ«J‰( úoAwIÉœ <ŒÅP]Ö¡9•w¶+&uO‘NÈõXWçÔ“e[™n¥™´3Íg+ù·y«^(Ë‘TA­ô]™iì’¹M©ÄX@U¦¯Ùt|8þ§@åW=Ã]ƒ÷s šIl3Ѫ/uM ͓/»Ü}&¿Ý_lmRbi )€cà +@%ébá.1Kk¡!€h¼ÿ[Ê)Ä!Ù(—„bSÅlTdÌ#Nö0Ïòì8DÓ‘ªƒ E­ÉᢠRSYÏDwS½èýØ…„ž°0w„\>›˵‘3QFZrBzÔŸ‡˜Ìª¯‘3ùR|TÑ… 0!؆‰áEqˆ + + Â°È—M¬Ë’wàœÕÌDÐvé˜"ÙZ¡®zèˆ<ƒ ‰HdÔP„Ä)‘ù¤ @%PS_Ñ +ÊŸ +÷«~“"•^ù{¬èFˆF€ˆºiJòp=Ì÷´4×}»ÅÓlª^MSt_ck‘Þùµ¹0’‘Î}\àüaÛŸ4itÚêäd^izz +ƒõó”àùWr¼ƒ˜r0Ø”²ª€QMJkšv²¢T,å„Ghwtá# ËÑÐQL:¸= +x$ý^í`>‡Qz´¯›b½’8D½†a!¡ó;åãZÕˆüSÁEo.Ï »b¶Z¦w‘†ƒ ¦çáõ©‘%µ êðû–¦ ÷ÿ´„¹™)÷Ïý©aj-.¹1$øØÌÉ?òˆiýï³’NèÌâߤ²}¬Ÿßçý©»âm´éjG6MI¶®¼úÃÝR°1 È߉?EÂuÙ÷Ü fóÇÍFÑVƶl*“ï«”¤6½ 츚à ^‡yei]~Y¿l±‘z–ÍòòŒ50•óêÄve 6&©dïçX-ˆÍ?ÿS‡MqËgŽd´dÜ ð/j’m1u¹¡Æ:8êÔZÌV‘¥è§¤hìŸ'1ÙJ™§‚4YÉãNði,5£sžW¸ÚŒ{gof,K·œqû)YaŸü àLE?ÅwÃȲ„ûOq¤½"ÄW.ý41º"‹Hwf™dAâ jM¿v 7©F' +ú-œÎ\æEƒ£8Õõ ¨N,Zsô£Ó{\ƒäÂÈäTÈiœ]°„ÆsMêöPÁ&wL¾Neh´ƒ+(þÊæ7¯ðI‘„•"æeHæêú.á¤æÈ«|væÈH%(Wé:ûTK)&6BÞ]×ã6%³¬à6BfÜÅä)–VØÙâ²€^'ðƒ;{›Ï0úf÷ñ—žÞº˜?¦oz‘§*ë—¼íI±}•E›J=jõg¤o“~@«S‡á˜=Ó «…ñA}Œ'#qÓ˜Ži}!öâô*§ô–(ºÞphAIU?kÉsïOEB*%”¸Q>¢í'fÚ']ŒˆéÏÍ‹‰ˆk­±ìü·J¥Åï0DÉ.#=6£ÛÔo JykþÈ~â»G& ì®v·)¸žˆ)"éÎÇ:©ûS#$ô™4rÆZòŒÔ$M+&ŠÁÇ f—¦‡?%ù.à…ây½…á3Ь%E8W¦¬Qû\•ÖyK4¡”ÿN¯"’I¶s{.Ù5ÍqF0=þßï=†8OKÄQ$<3~¢ždËRŽÿD µO-¡¨Tö@Û&%ž‚.šÇ»|ßî;*ŽçYïìJÐ!ƒþ"!ˆt£±?û,«ô•õ§*í[—’„Â%övߌŠèŒT‹–úR¯V±ÐÒ+|IµEŽ[ÚB7‡,žþ*þIeð˜C`õ R9 +zµãiM“ýMot1©ŒÎ8ôIºÇ¡_¾#»Ôv>CC½°bxô&+áï*ó¬r`SþVÈ·€Öø ˜5p/)§Ýˆ7Rh3$ãØEr'´`ß5½« HÊTKAgÓnO 9\œPÂáŸ·Ž æ4BH!Lº-]îÌê½µ×'qà +ëELÚä “WirÌÅȆ“K,¢¯¶Çß2‡Ž¦ƒ­7 +O…¹ýRÝ$·Z¯ºØ°â! K&ùúW‘aÏò–ßú˜`Š\Ы0Õ”{}--ðÕ“cRµ/½ªè!¤IbþöõD¶{¾š¨©ް] P –Es/–œ‹Eƒ= 3ÜõcTŒOQÈÎEî¸z2€]ô"†B}[«+sYð¸d+|ÉÿFƬä̰òh•:–61½áÃÍìxò$¦n‡½IÝ!Zý«—Ø8T4ZgŠ»¡çÃþìKUªƒ1ÜTÜ ´R‰ûrãÇ4×°ðêë®Ý'oDº€ ‹ æÔy¾=àòؾØLUv¬„Ô‹n<­©eŠÖ˜@ð®¾H5Y3›$½-iÄ×K=€½™IU9Xæ‹ò«s.:N¦ ‹šÎÀ%y[É›³Á‹Aj ǘݾ¾h²mƒšCÔŒ}1êÈÇf÷€‰-ã +X. 4zLAÎÈ…“·OÔVž©è˜ó¼UBiÿ’ŒÀ¶0lèÖTÒýM@2Nb›"W¦”×ÀFH´Þ¼ÅcV$± H÷^TÆ5‹œR˜ŠÚlkVȾ§xš4‰WfͶª ¥ÃëeŠã_è†cgQ P½ðnÖÈc>OÎ+dÇ>H&Ùq·§V‘$¦bO-v(-`I‡;@Û¡Фƒä…àÈÏ¡²à0Ëᥧª¥"jÑÎý™-xB¯–Ô mS2ª#»qúŸµ1ÄtƒÝ`§òF?à] 3‹¥€Ú˜Ô¡æxb×Í×ÇΨPÕô?¬MÌŽqÞ¢hxWÓÓBTo¢¬Î5¯:qss©w½ÿ:¨ ’¢m9¨Üºßy`ϸ>Ú, ŸÆ™+ÿþ óѰýòT5ÉÀ×`&i§È`ðÙJÂÙk"ƒhMc­µyþéa˜¥“²‹ŒCÛÔ©³!6íA:¨dèu*Soß-ˆhÛ 9ì?ží¢¬wo£ï(zŽ–­2ìÐX6Êz… `ù¢AàภӃâĤ«/Úȉªðcú+h"ss!|””¿kk¬m.ñ—¬®÷D¯€€rk‹ÀÚˆ;[8v •M ˆV“ +ë•›ÆöŸöñ§iW€´S=¦NwbE·J â005Îûv®KJ8PTƒU¼pghò’“’-'Àše1 à[C‡† +d9†@Î`ÀH¹œ>¯šØ’l~]PF +$=¶LîÉX:`·V‰ã$ +§$qœ|Ä1€˜,RÙ€çR6³ž¾Z¦Ié þ‘íY-7å¥C«xCkqͮ󆋫i³,€q8³ä¯õ½õ°‹?ä˜ Ñð“rðÄfjÜ6ŽÏ9>e;‚p!^Ç:#Žˆ<Ôx"Š_É0Ÿ`ZTäÂ-ùÁb¥ ¼x¼ŽŒm÷¹+Šf%ä­/ND¢ºŠ(“ý)ó¶n§ÁÏ+ÁÙ„Äã ptÃ8Ja™43Ü â¬%COûlš‡QÝŽÀb¬r j§%®¸!³VN_ÈÙÇ­”a¥&ɬഅ[ŒCs ‘JÍVn*Ù`¸Ì7°|ùWW›‰qpzà +PÛ%ýp¬œôMsqH,3{¤O©C<4m^£±@›ÑC™<ÈËlBh + ¢¯„‘Â;4ÀÝkË<$HЮ¶¹;&Ç–ÂCb؉t­~Ž0Â``!$‘í#Ð+vµµ¿uy’U£dû_û¸Ä}Mà%<$ú$Ý" ¸Ô‚˜y^M‘²‡]à1|Æd‡2YÒò‹týEéy`ñÌE ^™?€ŒÙ¥÷²½¿¿é5‡+ÇCëkùE‘.?9ìÌ“ý—„…¤Ñ&öà ª—ÅHkòžSÇouqµŠ èúÆ„H1‰%’Ã`øª:á$ÁóË6õ}\>MIyÁÐrœS‚cx~Úä$aÙÓs9˜À•oWPpSö¢ˆeÈõ®]Òî‰Ð‹—ì,·™LãŒP ô¿:ô³ùT/Æ·O-ÁP×¢ÈѦ$§Œ@÷ÎGƪ˜¡âü™CÖ+¡špõ!°;KÑízñðQ¢–W7H4ï7¢’†&¬üܵÏÐ~‚+KÉõi² +eâ©»„0öE´ÏÙRÁ;=_K° +©ˆ~ùowŽˆ¨Xl•A Çe¼óPÍ-JM‚A8)ýkTsÅ×ÂÔÌG†ö~±?ñ-Øal_>¦'pI7_ØF0àÏ®8C<¯tâÀ¤¯§ßëIÇ8Œ³ æ?c·Ó*×34ú¯ý¦¬¬ù†îUÓjŽ¿'*Ëôz\‹Æ|læá}S <ˆüL4ß.å@Îô•Ó–R娮 Y(½¶**XCÖ®2ReT—$ÖÎuéñËt˜KÖ&Z ¢1:‡vPCOm¢§»&rÑ$ÔyO15ëJé15/ÒW]æÉC2˜K(‡ãÉrøÅQW“>»Ëã*ODá~¼Ç`§-bÀœó“ÛË0Ë¿×U䣳èÓŽÍŠI ,0 )½qEW429DŸ`îæ’ÐÖÔqr¬þ»»À BÍ]¬ÓתQÓi¸d<¼ïðßí|£$šÏñ¯öÛRáíHâw‘6zPâ~¶š>ÏñćėŸuó¹ð=9èG/oô>ÓŽuÚ](tÐîGÀ•;G,£ë]`èüµÊÄ ï¼'’+0Ú%¯ü5{ã¥(Ó¡¬çìGoNQFkó%·Þ$;š-s.ÒÎ.7H%0-XÕ“sÒrÎÚ˘¢‹…€áKòPŽî RÄlDÀYÛot7XxRÜѼF¸¼¦Rj½È°5ÐdS Ýœ-;¹¦îŠT9(ù)öwwT|ìêJ?õ6ñþÈGÈa-ÏG!ã´¯û´“å89…ÑF_]B¡·í«$³Z2z‡¨-²Â§µuôëÄòÅJü~P®‹¥÷ʇ+€ã*³5ï>i Kúþ'û™0Á£ð¢?¹vÚ0¡Zk»„¬?µ ›ï^;¡ââTÖ¬DL±AÒPWÃw:§vqóïÞq Óf…e€X®ã¯ ]‚µ*ïz\z+]J‚Ï[ØRÐ? >d’FÚ·—¹»ì’ Atú¾Uõ"C…ìüŸ%!@—n‹6Ÿ¹~}öU,LOÿÍr˜OdêÇŒ2ÏE T×膙U4ÈjsXfáæµnP¦K”qÐ6›Rã-žªÒYuçüCšŠ÷±©CÑg1.®Tôjn«R²ºf }ÿ$:, Vòx#ÍjJ`;Ô¥¥ã±¶û9§ª^¬{Ý?ßã$åa&:MüCizDïx ^ õ£›±ÆXE0Ä\7ïö&l¨Åy‰a¢ßSGK“˜ ÅöÁ¢Ç—È$(@Íìà ÖáªÛ ž~*‰ËÕ·h«<Ò€™¬x‰ŒøËûZ$CÏ(&VóamC_ÔÃ{"ì9KúÄÅìbˆ>S¬Uð…æq,Ùý6ÖI@A¥[4&ñÇœ€S/ÈšVçNÉœ¶;zº¨¯B)ñÏÓe™$:x‘ËpW®’ÔQ&ñ?3˜$®ÂµAç§¼K™D³„7X»ê†$[%e/ (ÐìB\ms8¸³¾$‡íÐUæa?ö¾çú±ž(úöH ’ó¥HÛ"ø é$eå㟦ã¿Þ*sæŒØTÒDÖñrÚXÇÀ§U+Ú+vš@ìJÝÆÒfÆæ˜ö÷êXˆ z{ªÃ´3£N]î¡Ñ©|Ç‹3cŒkS–ë•_ŽG¯“3{°gH\Øb +š˜_0ÀEŒÊ1V-XlŠã[¯Œã”¸|L¶xrð©À’WÛöm¸­‘H ‚¦ ÛjV&MÄ3 eszBÒh*WïNHbÉJI8ØðI¶'iÓøuÐÀ¦ô²6Çej¶#—Lü>¤Ýv=)–ö‰ì•Å +:÷XgZ©‹ðŒÄžØw)7ª…pD(< +Ñf,!1°é$2lù¬ϸ™¿­¸4Úªï9ÙªA`Îå,ݵØ4àµózÞu…I¦”p½Q® äbƒ[ý=G0‘\ì¥YT0«ŸWT~åI׋Ì«£¡iðlýhOÊ +çb±‹¦Ò§<Á/3°ý@à_iRrƒ[µ3Žèo¶±®AoZ…yFöE´307EiÃ|¼¤~% +[eÃ…-ñpI{wä´š~UHÏòÈÂeþ¼D5–(ÊäHÚZÊoüdºr'H9NÎW®Ø¾¾ÌЉM‰ÊoɲyXS‹/ÒJLDIMVÙZâæDijFFTn€í*W”ˆ (M{ê{Ä&eÄÖ^Ía­¡2ùñ÷ Ji™NVD$]¤æa—í_Oºi*¡·–AFÑäO”üÿÇÛLþðÅ6w°jò“ŸÆI¹ >f]Ð$¦á¸T#‰„)}{‰~÷v¼k‡D¬i§ “6ZöÕçUí …æ9Þ%')3;:Z—,-¨Ù)É­Æ`bòbð+Ä]ŽP k¦qÓ(ø ¡(ô;S•Nó”ªÃgB^qï.¬ýŸq´'Ý-í•¢¡ãÈÃÎ ˆø¶fK:Š[ëÓ™ÕѺf¹r@Nz?òVæÇ×#ívï¢BåСˆ“&ÀÑ„©éÚ¨C?}h‚°S&Ë]ëÓ$DÛN;z~ðþt?ˆÎG$¿Q³˜b2éƒ=Õ`îÖ ÷¦ C·ƒ¤áÛ\Qøü¡µ‹èt6Ò·Ù†ª1EÙ|Çÿ+O´šM9dϧ´®Õ»Äÿ¿Ë6€F–†ÞÚ©1èÿµ6“öʪ)÷ð¿º&öRfžÕxà-ÄØ‘˜>7¨Wv9\J†,÷ÝÑŒ¡#%}F‰0¥L_ÛÈ—Ñc%ZÙðIðõÚv[ à+¥•¥eOÓ]M eÏê­Bß´gh¼»l_ÈY,Cõî§Ò_…`§ƒÓA-@Ê-·ºg›XtÖ‚nǼ¥c~#—Ât«ò5=ÆÅ„Í>+Ô[˜)ød?ƒ3~ùÌyø+9,b ÛG ¼b´·I=}JÃCHC«sñצìØGµH.#ðEUS«?¥11 DäÚh@{fò °ní÷ÒÞV­!h}¯.ÚÕkÃ×KR£˜!Lc ú0£&bM3û·#èøA/®ñV(«h¸ú[^´‘¸™Ø‹xÁnuX†‚©…Ì>R°íËJ¾NþNô2zë$·‚›eÁæ9g°Ö¾3ðÓoá…áLȾìvÁNú6,uOÙdKã%;g°§F¼3Ây¹Ý-‡ÎàŒµ{Go66Ât1q©.]/&J±—¸‘‡DÑ$³·Ž’ÝQÙ¥©ÞÒw‰¤üÂîæÄ+ˆ $¾e²ÒgqMŸ ‹“;Xv|•ž¨ÙÜ_!JŠÝEhì8¢/]¦|   ’¬‚ÿé /" ±Ø~ðu¸L@¶_ + Ñ¡QO+X¸È¨óHåy•JÄž¨š?êéßH8ø\IÕ‡ÌR±Øä⮦Üù›"Šc ª{a)Ê-åÀëõ‰Mp“Lƒ{á]3œ6Gv÷öº]icÏô¨øta3änÌv)|i°àˆLƒ¡Si Ø^–ìtv‹iqÇR¬¾zíóù;ÙLw†ñ³MIÓ€Øq|¨Åá‚4 àëÀÊù¦üT['b9ÙëŽg14v8¬×üÙ ¦LÄ6øäpÁã2a“xÉÜxCD$S0É6ÐßÖl¡åÆ"lp,¹[ @¹r»¡nnÕ˜¦MÜîdx7Änœ©a(ÿŽ…bÝUŽÓ)G½Ã)Æ…š5“üAR¸NeS‡'øsƒm}H·CŽóóâ8Hu¿ÔòrNPƒ'ð9q“ü¡k«3÷yþSóVõ^n ³ ‡àEc"£ƒó³˜HÎ Ôå!¤o7ðB»û_mH ~HÐXI@ëŒøÅ•i.Z«1Ìó‰5”ŠÓp°@e÷çÏ3ž5åðtTFÏœ–‹¦¦Â7v±Íâ?Ù~ÁÁžµòÆÉN|TXãÜ÷)Fõn¥ÿjÚó ÍFô0'8/L΃s¹J,J*°¢Óˆ¥¸ã6#£x“³ãŠÏš ^àƒff(Ÿ'ôó훋6wöù 1p¥44^:êÏϯÍLûŽ0qOíIc2™esó°`K7âJüÑI®ÅfšWWvì+1ƒ +±Œª#Ϥ˜EûäûÐÈNìàHdîûùÑàá6q• TS•$8'Nn´¯?B›ä€»W¦Rñ¯3"ùZþßÈ%áЈ*'¶O¨ {ºªl+&v’˜’ƒŸ?μ²ž(.Uõ‡br<$1ÏýwE¥‰­Îäo +?öÈA›Êø/-H¹²üDï88+ÈYpÞï\•’UÍIÖxì’¦?ñk6)€²žYØÆ„À½QÖŽrYÿïo䀼WÚü.èoÈRÖßîëÉle=XÒJöÊóÑ5î)BƒýL©rÕ76jr-1^ΰêî‹* ÀƬ¿iÃðØ4P‡Ñ#¥þªÔú‹³ì‰^àB{«%ÏÁÁáÈzcš.q ˜°[yB¥nò TUmB|Á÷r}ßúÑ4£)\ý»\[Ûuhi,CA!šC^ž”‹ÖI,;¤24°/sbœãí”K=öàgê`"­ÿ|ñTè?Ûÿâv»ú{›Ø3Lz‰Å ’ Ðiû“vÕnÂà^½í%¹¢3•=Ï|W…iµ+%†´:J‡Ü§î¦mªÆ¡j |C[ä7(-½ B—V#rï| +Ž2e¨nÒaüþ Úf <#y\šõPMø|íÂ,Lä1¸ãi¨*‹|<\REjŠ|z-¾£ûÜó>rï©›¶iXש‹1§ðÿ!U­ækN'ïM5ù‰HÁb ìN|ÎO¸‰9Ép•ö’:.¯„1I¼8LáL»œèKå6(Ø$Y Cmv]¸¾«{Ë_)O +‡Œ…¥"—ü{>ég(QÍCÑ]+­ôzxTq!>ˆâ)s[«Ð¸Ä¦†zC;< q(†ÚÌ=A5r‹—Ç= «ŒÕ¹Ü¹‡Ææ^ãØŠÐI¶Óé gå&½³÷ Lÿ…j¿?êeöDv‰ï¡(iJx˜ÆŽ×5#F^5Ö–,õ…Ó´ä»,XÙš“| A“ŠCœ_L¨JP,rPˆißæ)’™Mü3ép¤g+Âzëó­Õà +=TE„×JHO¡Å%¹zÐÓQgݦ³È¼õ$%`5(j«1hPJL›°æßÂ^R¤YGTƒœJ5x$âkM]¢ÁD¯Ô]qf–ŒéÎõøQ§ú½%½9ÙˆA(½w‡˜ßCPUžUh0U§5",™»Ú0<Žä „å öIñÙ +›ç:£^ÖøÂÌ ß÷ˆ-K÷¢‰$îê0³ì|Ô]Õ2Ã@9á\™PÛKŸ¸,B¦×V1ÏlÜ*­USzÿµÁcxùÛíÈMl4ÿí®–ø´ï)&ÛË¿ËÕaZò—WÏïB•<ð^ÄÝÙ"6 ‹* ¨à]UI`þûº$“záè®$ˆîœöFi#ÿ¡o àÊînÆ ƒçW‹†ïtÓDg’¨™˜ê±¦q¢áÉm,EoŠm"V_`âøuÔMA¦B@Aì Ì4xÛ? W”ŽŽ7ç4$PAËJÅïÊÆ¨{ßfcvHKÕ3_êd©Óž‹ãÔéqbl"‡XŸ~é°…ú‹ â$¡É+!ljv`üÉVqF:.âˈ!VY¥ Ķ‘¿\G/%²Bê×÷çå_¢õ’Àμl±4ÿ^þ Í›t€Ó1Q N×TÕu¡„B'ê9îõõ-¦ÑVþúI@5ž`22”â/QId$')ZØ0¢F…¼uO;à»d2’Vý£6õxuòø“zÜÚFi.2!ôIIÊQ¤_€‰™€Oç® 4Z*Zú–å8¥ùœƒÉËÖ>öÇ—£4€@ÞdÞˆOL'Ý·`(ï-,!+A>()üѪ +Ø8‡Š¤1ßÌ5²na°žy8ÕÃ%¡´)±ƒÖŠN~Ž00QÈôKjÂpݤHøí[ýR Ms¬¹WÂ(k¾áÁ´‚z–!OzÀ@Þ"D)…G3ÑeÏ d.â˜Fðò\~@‚#hšYˆÖu½ôkÊO(.Ïö\yÌäHcÙ +x÷â2êedÙþ¨1…ac)\ÄÔ?Ǧ×!ƒ|ò¬iò1ô ºË1}à„c¼É®Gz¾,Ø0ç\*gãŠIðwÉ{Pmœè_Ú²ª/»š÷ µpsÊA“^Dα"©{›Pô8#Þú IýŠH~V¬Ä´”£ŒÒQ{~Îìš‹ì-û˜œÏK¾:GX7JO¢„Çñ†ÿJº‚<$Ç|nÉ4§’8\æ\rå+wñÂ|ýŸbÍ_꟱½ÞÍåÙù²OÔ¦Óµuʾ”Ñ•ñŸí«>‘š-ƒ»Æv¨æ»ÑÙ’Õ.’hˆõI“Gü'ßïRvê6m鯝£áy ê–*¥ÇaÚÓ0~ûi‘YÑ/:'·øÑöÂãш†WóržÊÑ>eãÒ~-~ÕÁº¦õ¬2³Á4ÂçÑÊ߸W n[Y*Óœ+©1jý<ʽu· AZ®H‹žúz!†Ã'=AÁ‹'ïS‚•B$@!Yü®Á'Ô+Wψ¢RóB¬ÙÈ?)½TPtæ¾m—ÚŽÒ>‘êgį  ”¡šäÎdµ}›„v뜗 y¯qO +‡í}øÝЯñ”/[SÊ™.† 3ä6ŽÁ¶U!s=V¸ôh“è~HEæ%lwyh¬ÈxœUŽ%­ˆ{¼ÝT]hYÒ—zÖ?Ö’b£ž„yø† y RIK/¥ÖÛ–@ÝÃø±.k£iŸÜ±Â´ )òÕóáSMµŸé©–žˆçdj2*W½[*ŒBJÁÛ9^¬‰…p3‡ @ˆöÒxÒh!‡Òüú;+úúdƒ<ÊM? \YÌ%C1,ŸôÙc”!GÚIC±:mJ’”¨¸€Â,ïufA䞟ub=àšîõáI%(`ßËý%‹È“5GMJï}Rê–=¢fÕEphíÌûiÈcƒá/Dê Ý$ÂÏ*Ll?æH78¼ ]dA&ä~‰@ýðo¼„ÍŽà`­E¨Å%ÀT÷ îÅH( Äß/£QÏøμMêšOk½W½‰ÿõ+{Sºu½!ŸÒ-¸¼ƒP- ž¬åS ÃåjBý¦É–“™&'ÙöÅbl´Ø}žÄ›¡ä­Îõr‰ax ³Y4ÜW }ñrð,ýÚ0ÛÈyç"#bÛ 3–Šä]â$ez`ëäú¿·x +îLc +Éh-R…ºªï¸ÇäðkB(Œ£ ¹lÇÕC½â3< Eݹ›ƒQ²cg%»­ÄCºKŸYÁgpä\ôU¤bBRïŠöX6ëÉ,„Âüš0R~É"Ö¸v—4¢.ßBLq9¹FJòoÌ2RwòÜo¤1²ï¨Z|/¬2u!Þç ‹‰<9 ²Åj\h1+ý%t5䩽·˜¢òeå Ø¬7C.¿ØÐ¦ÍÛ2ˆ†”H 1ó,´{è|Y£ÓíŽpÑYÊ‹±]³‚Ì׌íÉÃk÷DñEkJln~Z¾Ì;^a‘Æ„– #µ-U‚ãÌM|iÄÔì³£kß^‘R¾°†FÅõÞOÛÞÌ(qssà‹^ÜsÙ‘G!Pš=¯ÕdÕÔÛ· ÓOŠ:Á! &KWÄËø_ÒiëoÒõ7¡ µQ¸rSzAPIþsv"lK¨ù (”˜ ¥¤W + Lä>f þ‚uȆiKm%Äs?ÑT7 #±+ƒ¶× º»&Š£Þc]÷ RÒ7\ôWòiÒ™ˆý2ÝF$4KV²†¦%IDluŒÅd^¢ ’ÕEE`¢"qLœ|—䡤‘g÷+—žàÏý5ñ?eÉ\B¼ò‡õ˜{Y¸¿Ü¿EßÀFј[CÊ‚•Žîįtƒ +j&:RàZÝšý±,ÿ¶¬ÄE†|k ¤ îèì©q)ŠÙ¢>ô\dß-ç9MGÝ÷ŽÃt„<µ'¸¥¡–ÛG»­Æ“¼¥lлյà®Úàú2ìK2iÒM'#oùWˆ•ÊúÔ¦Õd±ÄÕ¥à@‰ ^pÅm“D܈SË3þà,ˆc@ª•Ñ:b4¸ƒÓÜÔ Þ‚Vg7xÙŽ|ÉïðTð€Ã‹=ùþ2&B[’uö=œê’D͇ÐFÙHK×PJdJîvÒÕ´fS³ 9Ú§&ñ¥PÕ·šÜ€äó\3ICJ6ÿø¥qA•+'S”ºDŽ…=éN07%¤¦éòuÖ7·"©Ø*GD2Ñs+Es±#+˜ú%éÆeSµÚ¬KîñøœËc³Ðš,ÔÉã9#!hæ,Ú1Ó<ªÛGv·=ÿ˜¡Õ¦[(HWÁF)ÃÚ¦MLz‘÷<µªÛ‰$ú|ÀÄJÛK…Eˆ½“æ,-‰dSûŠªZ‚КL;ñt6Eq&Œ`Òÿ\Qµ¦O…jya=Úîy7ùpÓh¡F@C§ 9…y5 -,ß6®rÏá~µNã!÷]É©y¢ˆ†ùTÿå¬>“_JA’.vâqVþ0ÏÄ0÷þBé´åŸÐˆCj+uý­ãYÒQW‡\¤VÞ%CXgÍÇ¸É +h:(ð²ÜÛ+÷ @L”„ ×ݺ·ImsØîòî/Ÿ«DQ@C˜•$»$qÕïtñÃL.6_&·Š`¶é9;Ÿ AÅa+Ù,˜dËx$á>Ñ×kŽ‘Ýo¶[~à<íŒ3$¼åtãCƒ”û“ñ’*R˜ê¥Ä®[ š³~xó‰sxDTJBwK{vêFe!=[#ôeSã +ª<Àè¤^„="³{€2êwS£³he`kt]?1†cô¹,EvÓ¹R“ÔÛI¦I«P‡·ô'ƒtª¦Ù8B! Ìr-‘ÕfOj—7ºz`„¹­Þ‚fW3‘æÆÿîódȰÀN (Ì­Àízvg?¢³1–,ÔZ,Ï +–ReÝ7X®‹ÞŠ`ÒõËšÐÄß-ÁûgÁ¸EͶ+ZoiÇšNÂzš­p8ªNix¥93^š'7Øsîê5u:qÕóH»²Ø˜ÀÁEÿM`ÁOdчÁ<™æÆTG:é!¢B±˜KÃX7±N´-£H4qÄõ™&?±ä 9¥DãóU×ÐöÉf§|_ ÄGØÈ=@-¢áþVYçâÈdŠ2''ùð{ßÖ”°ˆåÉ–ñ3úÚä¨N4LÕÌ¡YENQ=Fõ”bÓ»ZÓͨ^vÃŒsߣšK„äú*‚r‰ÔÇ_iœ€Uj!°ÒϦµA2 Cq9\ÐéMê~íñæS 5iº™°Õqܽ҉9x°n?ÃÃúGt{^ΘÑõ¬ò“–iFˆ¼SU5hV|é}ÀöŒ%þ´ÎsÉ*9˜;ÿÖÒCäú;Àóád‡Ôõš`b¹§Óz§ Ù¶60ÈÌ:õ߉¥¤>`sŒTj—/ñˇ©ò?V.‘ ¢|÷†EFçÌîC0»Ø”¯;=‡J¦!s Gwðrà‹{ŠöÓÖOõ`ìÈ'i@ƒC‘¬ždaÚ +SºÚê ÚŠRœÉU¸å +í=Xéh¦uŠþ3™*ðF›d¦s6ý…I5cJæ™pÕF&“žYÖ[{ÛŸ­è¡e…»°'BŸžÍn …}Yè[¹qG&ÈfŸ +²x;-@Üfd=+Ú‰ÄôC*ªd&f˜k íÒø‚€Eûx¦½Gˆ Ô'bvÎöòÆ…-:z§AÕ(¥ûk5Ì,:)2Ò ÐÆÀñçãÀú•Ôô¢^ 'aÐMmý;âp×r ¢á¹“cJ]Ú/UééLt \®L]èCâ„òâÒ'uÛ›n†‚~˜Ž?-»Á*ÝœÎô©Îòر‰jÁå h„µ,‚ ÚøÑ¾„óÏ©]jTñøM¨Î>nŒ’ˆ8½{ß;ï7«wáX/AÿŠÈ›(ä,s(pe¤¨ +æ@ƒªsCçò† •aÄÞ*øßx5ÎèeÔÙ€ +šJ&Ó£/F1w£åŠJQ$•pgó2ÔüpzsšI‹é¬ù®¦ ò¹ÓËjõܘӋšWF—´°%Cö¤£€wcšjŽŸîå /O*í2CÚ†CW4Üä¥`’`;ÙŸ…–’TçâcD³±p65ÚÚ¬];&v‘Fäu_¼Ð%-ÿ3¨rÖ'¬Q€fm£\MÒ‹JY:ºŠœ×ŠÝZõµˆy¹³e†Çx ÷¬7Š)klí¦ˆAÂ0ÿ(ZpæcÁ‰‚Hmë· ø4«¯RóçJVø UçzÂ3¶ÙD·Å‰ÔBY)xó,%²ÔZ˜ˆ«†\«´M{WKyrתë:ÿ;óOkz¡8às éUðD(~ç¥,žÄJ]4¹u‹‹ôË•”. ¦:fÌ5fÓM,Ï]p¦Uj fÛŠ4÷êog€ÈÙ\CC€îïÔËùûÝ*ätúgÙ—:“ñÝPY~7¬·?¯b¡ƒ´Ð0­r8G±“d)65ë%Fœü’›žß10e9k÷LKè¤sðÚB"+›¾¼îrŠéV?­Z2º$–2`þÒÃI‹‘ØKû°ô?‡ˆñ=b3¹[þ+¡B.Uøý:œz.*nèî0³~×ôa’\®¶Ì00“qSÉV>ï¨É¨y–¿¯\YÙÂnFDàœ³çëLˆFÿy냛HÝsåkÔß[U_µkç¶ë¼Ô“é›,ƒƒ«NY„ À‚}dׂ©:üø‰ Úyn²b¬xÛ4ÛÁ¼ë$FV‡K¹W2¼¢À™.ë3† ‘B¬¬)Wűë«B;~Qœ¬Iu :\;K0xqM‚-f |îþÂLJ¬öï¸rÒMŽW#1‰ "Z;Ú=~ÁÉ~¶bÑG¹;¤¦«Û.?«”$Á:ûå8|­ûÛãðd8ö埨o:|‰åŸ­zŠxùQÚÑAÅDaT °(]ÉI a×Û4z’& SKú D‰µ¡¤`Ô+Ad2×ñFd dPì9^wTº’)’y(RCìë=]HE:3À]¸ +Û¸CË«Dõtý™Eb5¢!ÒùôŒûK½´ÒæÈÀ":Õ>td ,ľÛÊñd)YŒ1w‘ÌoÕqÜܹ­ã%ƒ=¦G£¢³$Ég3N?Ø÷ë…^|èK îò'éwcÈA«— Çz_¦1¶í13µB0¸xãunÃ88vèÀM›ìâ@:”€ôÝóý”äS¡àA¬­ûûe&çâ—‡7‹É†2Ø€ HÆM„Né?ºoÇHÐCô^–§Ñ +Á,Å\—‡åܳç¿6îCiêfœü#N•Ó×·åI²=X…SÁÇ3š¨%^6¶¹5¹Ÿ@ý…íBÄø€n@½·!3ªŸÌTÆVf§MèßùÒâUÞ–©qÀ=qí_:åíf¬‚°OJžÖrºÒÁÇö•€U¢-©#ò[Piÿ%ÄB0¨N¯ö‘:ÇSµBÈCÞ*@a£ŽK-8B2šª²,Ä–8´î¦…. ó—o¿y„ ò„=wÜÚË>ß÷YOOFæ{½ +UîÖÊìˆà«5exÁmK)šÞΠÒl¾+ö.  R9´ùñt y¨\u¬ZˆžÊkB·*l±lÀàd_¿ôW…Úä‡"-JÆ£ÊÄ©œ3@zð'ó,å«Bfúìyí$‡ÅÆiü…Íî-˜P-ó& r>!ÿ¤œ§ÔØ^«pÛæ$Ù°Ôè"³\BIµF]ÞÖqn¾õ¾-ô‘d¦PŒÂ£%ÓP‰Æg` +%÷Rgáæ²:ÄÿÓ²»×ÿLU»žú ++dŽÜœÌ9<]Á À(Öæo,04 +ÝÙÛÛ3eÆŸ6­ÁÇû÷Â)r&Âå!§Ä4;Ô1ã)V±ôŸ:NQ +b±‚´Û½À +/‰è½ó]Õ"ñÌ4)dË3ÄžÞFÏ(£XÁÒ› ¦7Œô,zT¯¤é„Û"V ¤“ÀkV Çà‹Úþ’¨cþ–»-¬¦ì–\ýàš¥­C†÷U›­²Ù¿I`ç7”\ˆàèIV§,tV㳂lnÁßøT*çÞ6´õ=™xŸ“ê +-†î"'›BÌP +rD8½ >6 ¸f¸¢o:Ñ€¤¿±£þ1EQÝbÌh•Ì=f\%ƒá@”A‘“ÈØ™ö93Ø øŸÌ +–Ù°A™2ò6 +P®W—È"û.ò9”„ÀØ„¸CNj¯D.¹³4ËâB:÷Œô6õCiÊèVfýY¡X¥ðpìMw¥w¹tú]C + +¿k°WÏ4+LÆjlZJŒ<̯³Ù»(Ö$üŽé'PS:_ÔV¸NÂw¦Öm6V¡DXE…¶HYÞj•’&û*éX£ $ØJYl ¶ÕJ¾°§Ð«úˆg«ÇY»ððèNŒ+EÛ»ð¨ È©{ bƒˆãsêZ…ñ!&±)̨˜ßGÅA)‚Hõ“Ô 8ÎN{Ò˜ËCì3‡3Nɨ$«×Añ1”mÅ ÒpV”JØç×)…“*QI“Áü=’å:÷h„eÀIÅ÷ýf8|¤«£Š?Ã9î -‘4‰E„>%Â3¼ ¥§0ÚBM¦ù¹ƒBЉ°¦#¡1h÷ÔôI*"[*†T¶‹Á‡j§Ýj¤2ͽòì#zdv=+Høõ‘]¦bÎ'-ˆl¾]µXa¾ès Õâdl3-Öˆôí„™·…iBÙ•™o¨™D½æ:TõPbÅ„„4ó„Â4BJ2Žs¨Φôvø +žTRÍŒ´u,9&Ìc¦ª¦J¢hHuÉÂÂÉØ²‘̓ +‰Øx‡]¼¤Œâ3³«„‚b>äéD©òÞÝ#{‚̈áÍhaKwÆc4×*SYФåÛâsJ<Å2‘‰“¢ËPdS¯³QUGl Æ'L¼®8|hÄîë:êJ“ m•ò4¾„j>wD‘=T"¿Œ”1JxØ›ãb„Tp±!5£[ÝŸgKEÖ9>à QÁ\áDtº ®XYQªÁTÜàn8AR"ŠUECj ¡ãEþžØÎiÉ<}oÈ©âU¶Ç“ÀØf×-yøÿ¾‘R¥­VŒdËKªh‘q‰xU±¹†œ ×kCÖN&.RžIO*ûx‰œL¨:BS¥€pð ,pð p±+u×L«Þ ƒ4ªÐ×*ðÔŠÀÁ |àdp.€€8Á˜€`ð€hà +p€D  J`@ >ЈàLÀÂt8 Á$àBÂàh‚ °À#(À 0¸ @Ï[k&’·AZ›ÚàS‰ò¯ PÁÌ‚¾ E¿$PAȃ ZôI¿¾ê+$¨2u 9DrÆdZŽa9Ô¨ÕQ5㚊œN3IüÁE(Ž YDÌ7¢ØÏG¦CG¨\ÆfG¨#,}%/)‰/“2\NKÂ/ú£8ç_ñ9¬˜D—„¬ë¨ˆyˆ–©Lxê¢âØ[ƒÌ®6žŠj”³ _lpuc͸ó¡"Vˆ¦Jõ"ƒ,B#a ñC"3£"ŸSa '¼/O„FŽ*URB‘G’|æt’-”¦Jã\hŠD4RzÐÏy ¤@²Ê5õÇ:+ÎL´RnQ+ŠÔ9Cª–>óJ̉Ô×$ÃÅû†©c¢tò%\H +îÂÁíŠÎ© ­´¬—eÚSq¡…VȕоâºDhÝ \é̋‚¾!¥¦<µ_65q†ÃÔ½FÍtˆyS™Êý28Ãk{04~ìjyt§(æ5ÜŒfmà´ï\ä#wØÜ±?V~…r㞥UóþBÃÍ‹u"Ë', tª`XÜüo@僦Ç#$ö>Šè©I±H€8@' +P èØ€ƒË©»ÀTj6³”Ö€ª<T€ À PÁR `(p 4ÀAˆ` ÐÀ*àÀ`€ +° ‚'ÏDü¢?hTƒ;£BÒîÁ² ‰bÉtšÖÈ[’l^“ÆŽ\m£}l1&µñƨp+#å@Á•]!J†òn'¡‡º†±SE1A‚DÓàUN\¿PBOB-Sm ‡Ñô.ߣ`8YV#±XV÷±!dbÿTƒ}óGƒG*$̘å¨q‰ï"ªáýDªÔ4>,i}ªQ‰^èÙEêmT±‚´g¶shÎÐD0¤X1‰šJš+JKÿEaï˜3ÉCJXW‚ôÀ­"**hiU!²‡êñõ …¨ÀÅY¿§$X¤üÁ§0éžJ‘ÙnXˆ6~ê$5ót +î„1ÖaEzl<ê¿E×’_á^TšsV#ê„VM•… L$¥Ád4zâÄHˆÎ8ªlÖbáß|ä˜GYøf¼wΧul¨;U(ËDá"‰Imú³…JwL…þñaRÕ ¤%•à±@ ù*cÖ7°pá«ÁOžCTDu¨2:uȸJ¥ñzÕÀU–,$aƯAX L³ Q6²ŸRÊŽ„ŠÐÜ’@ZlV]X0QÔ›½Ó +$ˆC.@cÃ4 pU¨DE9 +™Ñè3À) Éãñ0O´%z u2"  +JNX F¡UŒ@šJuÀþ»Ÿ:›ô§j •ø 8ªóÿ8hÿ£ä—ÆñfO2…ìêKµX€¨ŽqîEz¶Ý­\µ\Úˆƒ„ S`ƒOÅaÜ‘]ES +W_:“'j¸T.jó#CHÂå›){bg2d+š(…*Ë+½'@HÈM¬f“¤¨ëÝSæTl‚ç{t rÂkYdGÎûÃ¥Û¤Ú^kÑàI §ƒ—ÁÙê7“%ó_™Ó×âg×h_†ADxG8ªaD©Ælí ¶£ˆâ mI"„ÂÁWðK×ù„ö1L#â~ëŸæI@{yJpvR,jq¢›j`r†éŒò¬|¢pp¯³–M-éüEv6±ÌRJÎ]4((‹’nœpXºB]ãU'LÂÒ -«¿ «Óöƒž•Ø™S9ê  _¹ŠÓy]äþöþÒ&š,-ÊB± pÔä4)>PØDWü¬–@@}¯ƒÈ¸¯½"vàXñ!·4T-$OËš?ëÃܬ¥/Õ Žyï{ì_ñªì —®ÖjOEq' ÈÁ¹êųäRbZ""”ïOsP bãHzK‡ÿ½ôiÚGÿ½—7šÏ{B†¯ h9ÈÌ̪ýª‰óå>^¶ý¥:.TM$ñp(”Üß \5Uºüýʳ÷Q¢ðÁ1M„€F×mû8¸ØÕ¾%“f–D«Ä¹ÈÖ6¥ô"ì¢f<'r§àc ýP‚G dzPk (Z„„-ó¹6§c½uå{ߨiµRœGoe?ŒGßl&Ã3­ŒŸ®üÃÍkÊ|„8Œº¦!‘‡âX¦€þ± j5˜Pk’¤±R¿‡ßñ›Z +;@ä~ã,Ë¢ƆßÅmÈk% µACˆ8¡™Bóç7vqGúSSpNwàBe3Á×¼®Kµ!¯Í@² +E}îÝÆ7p+³ÛíR¶Rƈ„‡SºF‚Af÷6K~%¦³ &‰Z5É7QôªÂIªªj]£"-A$æ„üHo«}¤ÏÅ:q|Jî.þVôªõx+'.×ÄòÍA=¶’ù£fX (7€ÌòYx~Ü£½kMMv^i>©bÕ¸RÞ>Ô+³×yza7˜RÀµíAÉ>tC9`@ é†.WÄ“T{ƒ•ý§“Åô@ò¬ ójÒNLZŽááQª”t'þøLùC›˜IZƒ¾%ã<’~ƒâîG½ß·yp&ùbMRäÑÖ/ëÆjtüó†4;žœ‡¹¢y¬BŒ¢e%Ú1zͬšDxë;Îk²l“AM!FRÛPIpOÓñ‘K}NpàÇœu^¥v”Hnó³Ø]$Σ“pHLé§á>âʆI¡¸úGB´«þyìF_á}^H_ƒKu%Ô†è¸Ï ÁÀI¿(w«á?Z.¤öÑv@ÇXɾѕљÉè6 ì«.d í°¹Rb iŸ6’Ђ Íí\~$éïtpšÂ>ŽŸõêõRÙL,\¨¹> ¬!ȸ„î/<&õóô7râ=yá|agð2§Öв‚’j§/ªDÔH®y¸UõTOElByTíOp‰q‰Àfý‘¨ŒwE ÎÂm(سŒ{Rÿñ“6Ñð$á<£§ …ÖlÁ¦ØGÄÃ,l"i-+*H^‚@9&ó»E£L^25´Ô—ñåÑ`¨ßx‡æŠ[NNóê@•Ȧ˜ +>"+Ië¨- öެëŒÀߨiG\aYtÀ $ù$-ìò Öñ€€d`í(»§·…2=`ŒÓ:i CV$[Ghª+b,ãÚ¬Ù}‘ ²l3Ñ’€#¶E®JŽñyØ!¥ˆ +oâϯ¨XH 7#³üZ; +c4aŸ ˜ñLN!…‰vÙí ¶âïl^ÉPvs¤n=fÝé…ë¿ÒN¯#B~ dÖ#úõo<1lôhŠŽ¬oƒû½‚HpFÎødz—1žã‘`¾|\eíWÏÐ?=e*‘Æ·Þ†”$K5„TI"#—ÛZ>=l÷ãøX!muQ~I*üítêòž¶e0J,á“€<5믎§! "ÎtÆY`¡³›Q&VÈœZ#[S§qÄæ}0CÜpb¶9‰›ØŠÖ+’"Ø%ï.0ÿÇÙˆX/VL¥}90‘}™èQ«:D) Ë ¼"Ðx…f@Ã~E¼Ô¯Ö0/=ÅÙ7Ã×#Ã膤è»ëÍüW+i] ¸Ok·»Vš,bü—‰¿ÞÂ-艦ô 8ÅÔ Ñ5çâë“ôò;¯…HE‰ Š ûoÚ‘Þ‹¿¦ÞŠeIða5øb?Žž×¶4ý( ¶98 jæŒÞ "{—Œ\% ,I¨#u“9‡:þdG]ü“~Ÿtˆß#+´›øÜÇJº!‡B#kLÒá±O Ýl‰ŸÐ§¡Àkè•7j3a2N æMŽIÿ, ãï<^êè½S¡´2ÛF Ø!Óümo4÷÷DÕ×Û¨ëFå#¹@m²¨¡Ho5ÞÉ~£ Ø¡¹b™Ðž6Î oKnƒqÔØ=1‹m A¬ÄGŽðçÌ_„DÅLˆPU3ÚáYé'Zj¦p³å9Ÿs0™i º„ñD+Àñ: ºqQÒbM„,ÂâzçÆW‘#šN;=-od¢NV›ÖwÞ¨ÙÄDø?añÐÆSϲ>íR "“IW7Î’u ‘,À©î† À0îOíÝ͘L͉€¬avÑE!0ž®¿þtµëÒQ¶Ra‰I¦¤"*ÌJÇÉN'‘|Ç«»ÒUâ­#^B¡Ó„¯k;#þ6ö9ªW¤©êÙ d„ãWËH8XJ{jO!ÇAumZ>|{:=¼ðŽ gaà WÏOBèø•»Åã\­CÉl ?Õôp$€Âye@ßH’kÔÉGÇ•UËBÒÈ~5rU”4–E©‚6·ª U&Â2lÕ%K7¬&þ´Tù ˜ÃdÅUü¨©"î—ý +ч38}&bü¹aÒJGMeL$ÂDøèø¶:R;¾‰²­Há™ã¯íkŒœ`?>PÌ.±j¡è¥ã‘ÚlÃG„£1jº&ˆtŒ©^?åSƒpbížðÆú€v[†-¡ä™Üñd~‰¯O êºäóT’k:ó‰‚õ"$•œ7ä24Ñ]â(€×ßF¾¸wÔn‘ÊŽÚ+•¨$KmÁN Á#­ÚY‰§Îc•rn©gÌ4Z”_Æ<Áš®óèÉ6aøJø*£¦k‚à]F›a>"!v­i“Yh‰¢ãa¦“¬&,ÇnžYmQÙÜ|c"b”ѺÅ45¬ãáQlËXr>$¶’G4ª7cÓè8/b½ Õ‘[YuŠEÓj´"Š=FI@VD™d é»Qnìz #¼õgÚ YI¶e8T¦¿Ø $öM#†R´9òlð­”­“d zìZPÆbøÄ½”S„žzÂ…â¿xç¼-v-ŸÒ½ñˆáÐøýÌh*>56ÖlR ŸìÈ[¤ç óÀBNiÄq +‰òÁæO*lƒÆ>ªà|¢)ª D4b/\Â]ê§Õiôäš ü!üŒÑÓ5Aò‚"j¤Œ}¼§Â*µs—V°0%“#¯¬|æuÒÈíPŒ4¼„³Õ ÃRÒ&—ÖN£.Â,TzTU%fKzÅZÃ9©•Rì‘ò²s°Wsu‚ÉcÒkn‘\ıÄÚM‚j:ǮϣЙ~É]7F¶G$I.kðâˆzl½TnN3#yë=zÚ&6<%œetéB„÷ÛPaGÒç’æQ2nOc¥@fÊM§›^EqouÝKT{ijé--õæS‘ú+ BH.Ô舟òߦdI +\9F ÎÊ9ˆÌsê˜ô·°ƒÍq&[P +›¯hÏ1ÿ®^þ¦s'GïÑ{—!ìE#*N=Gµ,\b˜/mé ì +Ì˪qøÄ“ªÙ!ŒrˆÊкc?îÊéÿL†Šš :œ+#?á;¥rÁ’Nžû¥åº¤hêâ•}ÑÏ-òý‰±¥b’ReÛc¯¿/Bû£Äȯä0JœÚ®€ëÇ0-hÌ)[`H…$Ûë2`£é{þT®[¶yÒ™ìg»!­ÅE<Òo»bâ·åîÎÎûTÊ4²clˆˆâ}d‡ú)N ”r@Nͤˆ;Ì—b‰Ëyè`ÊÍ.¬é–+n·ª:wóhadf¯æTXq3# ŸºCž¹.ú]¨z¿¯ï'ne!ʰtà+·Uƒ‹{³À°ìÙºb’LË Se €ýv5Qb_•¡+pcDùÄØ6Ñ*] ;øÌµ—Äw‚Ú¥Ïä˸¾ýY&½É”¬cÌ2ÿ„vˆÞ46B®VµðFïuE˜Ð²ŒÓ¸RD69æÐ6? *3„æÁ¿2mA5Ì]­:Ô]‘€aÃJ2N“—\×ÙÒé\™ŠIT¨åøáD!l‰ÑäiJmó. 9Ô‡g-m@ +A`³R“êTƒÆîÚç¿Uò37ˆE ŠGÈLå'Õ Qo o’‘M8Aod£<KšÙ ÎP•'7Ìjã ^nÌMB¶"$¯o®JWÌ ž.ÍF—FyZlÆÒ<šfãÐ/ôù'Ç¥ñg¯tÅm³ãÌ¢xŠö¬Ï’Ê†Þ Ô‚‹©;ÏQÖr ×½‹UMøV8áÌøÉ;F@aJ +¤‘ ‘t56îi[;ïÑ +a; ´91ű+zäážåƒ©7±ãöðÐMòÄæXŸŠ\é)ôXCÒ¡–=÷`ÀvOi[iÅ!ãñxåÖSå–‹ãFK—fÑË3t’ËcÐÆS1ÄÇü2hOüæäCøx*NYìzÞo’ä#ÕxPçf áÓ&Mgñ!‹&Eìåšš#2eá7ˆ®{OíÉè™}²]µ‰óJÉF×°È;ö@Ù>* +zZ‡ÃEÿ€•Yöµø”]LøS6„†[D˜ÈgPtÐ{\¤ìµUŸZLù‚nÚÜBI”n;­­¹K)£˜È‘ ÐkcHX›¤9"I/@.±QöÇC«§ SÞ€o“Îþã¡ITg 5(©Úå2±a6Ìê³ão›=ãÏÇ +³]Öõj+¾_´ò¤2Y2&/ ‰i÷º¯ §+‡{Î}PCW¾ÑÉ¿œ™bƒúü’\ƒ5Ë„›_D¯£¹j.7¨¸'#?lw<¢ +ú9Û™L/ßÑÃ7òÃÉpˆ)1útÜà;ZYòµ2k>†£–Ò¢ÃåœA´È£EOGÂ…¸H¤¡ÚÄ¢ˆzd›ô­Ùd O5Ó¸¼5–yžvÏHÚ»ŽNJo+gÌKøœñ9J¨˜[}¹Cb¨¯3,(å@9ðu"¬å“NwÉÈñ–SŽQ‰èô  ¹jäù‰T¥‘•×W)iµˆ®…RmZòíMZ±´¿Ùš˜¤•v©#/›½Ìnb©Qç lE¯Ã‡ºN]‚˜åª¬»«ÕO/ùo +é·Q ‡-´j¿Ô\XO'+V}5Ý×ÒGR«Sr³´ÊŠ +U®?ˆçŽåäŽLí.àÕ,OT˼ •d©BŸ«T Shϱ]ÒØN + Jœëƒã˜Õª\éäo{ +ÌõKˆôI{é~WÒ&O1ãGkt—µãÂ肋÷!ä?1auãiFg#?ò-ë‹{}8" 0×R Æ«vWòõ+ýŒƒ¾‘­ìQáîuŠßÙ±…n¸’+Ãþ#–w€®‹Ø%ÙicT©0lšpVÆù¿ë΄Þ{ Ò—oyXÊ™k[8­1éNâ¹fí-pÐIÚ•©?˜‹FBÊeW.É”•ͱ\<©äsÆ_aºšWÿìŸ35ZÊ–¶¿<¸ + +½V‹ nxŒ/Þdwu˜²áhhr!4ƒ÷ºh[‡2‘"NQ¼ñs¯¹‡Ø©øâãÞThwÔXœuÙ}Ѿ (Q¾ É!¡Û¦Éî÷åË -ÁŠkÆ—â]úÐm®lg»åH:~§Á¹Âo…:™'δ6B¾ÀÆ/¥¥(L#/»$šÕðLmÉuú¥’4¦9‚É:(zŒŸ‡XYòŠMå@ô@’™?AXòŸ´˜ðî꾨aÞW¹Ð xÓ#T$„8t ù§ÌêI0CÿWÇqh8lÙ6öœó:˜aëâ«©ÍoÉP‰: %»Y‹>‡ÃÙÓÙ± :Wé|¦™¹Ï¥Ñ{Òø )¬£ªc7‚ój!/²ùâèæ:Öà{¿•-ɵ‹+;jJÌœÐ>îÈŒ\Ez¶Šµέv]jQ®{b)dµ–f“‚1mª… Ù2Ðx%ϧ%lcujùój³Ïh€ÎoXo*ø©PÆoE63oëŠH³}à(Ž^Ì~!;_éñîrµÔÃçd¦õ…§;é4‚G\Ø~±¾yÁb g4Á,¥qåÀ@¹±ÌèÚ­ø™$¥‰ÙênâÜ/è˜\Š@O;þEÝz§ÐjƒXê·üd¡ðÌn1Ç’$éµ:Ü×&žáñn‚æÁS†K•¼»ÖŽÑ$Æ2Š8ωB*‘—Lµ?Kê¨Ð¸dz.UóîkN+(EüD38Zð™!!g¼ ˜ó¡4¬ó)0Å[?™sèÅ øn¥òîXk²?$ç}˜A‡§¦Ó%£þÐ +ä/I6œÉ’îÏ! Ò‹S $Ù:Ðõ½Jg»êïã}š’‹ÒíöþZËÅÞÐ÷÷ÓôùÐùwr»H6§XÐn‹Ã©˜>)Ë”|@O*ØP¤ªKí +’—ꎕ,òù=t‘wúßs4<‹É,™llYÇInq*ÔU > %EH•H}ä¨ç5Òo³1&E”;òfÁ¨I´BÔi'ÅyMVjñ7ê¢Dê8–ií£¶$‹@%|hoå2Œ±Ëåµ ''ùYñ“ªt›æ¯ë€ù¶‘È ÷@áÓTÖÁð.B]5¸þøàUÀöT+ÃT%þ”o²*„–;G >¡:äºj¥ªœ©íSu[M’þ ÕÌ +¢‰ZÛK445ÿ×ßç†ö;hUì=È>÷)›žME´–Nú4·8[|éÖ@ÏõI– è÷ò0LrÛ£gmPË&ºÉpNÚ¸m[‚ŒQ›B¯Œ<:5y­Š‘ÞjÒlÓyX3dº¬,»EŽª8oÌyâtÌ(º&ÛØû÷–KÔ…½`€µ:¿ø0OUÙI»ÒÎÜÀŸXþ3ÕH~Fˆ L µ½"ŹŽÃÀZwè‚¢Dêy6¢s×È6é6§ªÏ=ÚV»(w‡€•µ&{ë•í|‡z´3¨å¢H Œ×.ÜØ¢ñ–Dñ4•FÖ +x†`+`†ü$e–˜U ÿ“[•e- ‡þìíV÷cuÎúŸ øN°Ïþ”<övSñ†Já!l"íl[åNå­ú+HIä¼vèÊ:‹-|ÿIôÿé-“¹<™å#Љؙú +Óµ’ŠdhbÚÃH’«US$VHØUD¢>ÿÉ£›°ë+Òú*×@T•Dÿl¬qïŽYÍgNæ¼ÄHUƒH–9˜V£¯ÄP¯äµ#¦É|Ëzí;“ô8CWa`ûªõ3>¨óºZ2’4Â]–mç‰ ¸3›“ÕR×brÄ©û4˜òL,l£¢ ®r9øÇ²ÍçËÌùg ´›/ÓÎ5X?ë‰%€BòI¢I'³FD¸ê}Ü ÃA®ž’ Gƒ´{T˜”ƒKÇYR%tátPSZA:¦À ñÖyÏså§ÜUY…5S÷U’ÁÎP 3¸yá(™@€ZÅ­vAzºˆSÀ³º„{5åô)ã5 ܄޳?%õ—$³À¿PB[drÈ¡X‘ƒ‹—cxG ú$Ôã†$†5,)±?2h/+îÐA-'YÞáïôõg,ÿs)Ø¿¨Vjÿ!=Aff3NI2ÃÁÈ›ß]¬†&ö’ÜänQí8:Œªá„Z¹Ïµ5Ôaëð¹f5;™)­“Ÿ;ÙŠ4¯¬#y”Ùé1}÷ðç Y´$rWÁ9gT’ÌçWÖ—|+6´¦ï"õg32r³jÊï XÎ@K,šôœ·`6 !ç]2ûkŒ[=|MâŠ0¼d Á€IPn£IÂÄ€ò +4"„üÚ‡è£Hòe94ÓÐA*…ºG ÞCI}ÄK­rˆ2ðÙßU^rs4!´q |ñxÉ~I+±á 8 I× ™F  Ä«öÑ Ø4Z®š‘ÑZÅA¢{ÖÃ@Ôꬢ kªŠ€a• ±–$²¬ˆ›BÁ`*ü·’alGg£Û!©eà“sCàÆeuQJÀ鮕ûqË`Y[8g˜Ç]4÷ûúØ©¥´äwˆ­‘[Ú^Í„‹˜ï€¹¾Ý¹T”»S6…{Ì“ zC6¦M,¿50ȳÁ™öÉz騾ɨ°¨ÝLþ>4&ƒ [íP?Ž™³‚D.ùÉÐpÖu~„¥Ê–’Ã,èíï¾’5´uT÷냯ë(+Ë“pìP“‘Œ¥LBz&ž<¦Ÿê Ì`2HM®˜2BŸsÒÆý먲™_N}Nžq›íÌ ¶1î”{’šåèý¯qÏNjkÝ“”Nþ¸zY³çdœ¿¶xô3…øjˆ¿0;’íz™n•¸dùªe¿KûÄT=CÏ‹"%E†Ã•ör÷š=å1ºSoä‚ÔŠ/=tÃ_šwtn㑘L7â¨U Óf2çäŒP|à{¯Ç7p¤i5dé˜,÷t]Hqû‚WMMܹä#¢Ó­‚î¸b:Äꎇþ5²LßpÝYÖ”ãiÒò&zÓMRî†ã0€|̴䩎a¢ˆ‘îr +¼gkv@€´öôadñÚ¤’Á)%†„nÄt¸6QçvºŠZ˜¶ŽùcåÉ÷“¯?ᩈpÕûcý…azÓ6KIÖ–›¡ªø+X,ðXî^ýe2Ò_?ME*¼7 ¸;$=oÄ,5aVU✿Và5.ÌWž‹Tïw \éM°t˜…Ñ‹zF'RO™ëÍœ¼\Ê`1ÈCÈ×UwnÀþn ¯ÔÞÙ_ÛÇhåµ·k¬üäð2ºñ¯Ú½…½ìà°¿®p;°ï7×U”忟¹1YuÙ¶«X‘:y«Ò—8*uÓ¼InYÛ¾Úœ©6(û×e¡WÛÛÝ3FlFRCn]kãÓGÜ/ùëip¦/ïm&?'9PuÐ4܆²±~¥m» SQçµa¤P©ß?"qÞ‚­-ÇÈr_4V=÷ÅDûÎpu1n¡W“0úp…Ç·ë!ÁŽx†©üáˆ"u`pа*®Æ1Ál3Ýÿ’jí o4?Æý¦ÅŸkgüÇä˜1¹™’l^D½LZQû¯ª‚\‚"¥ÃD’xÊ•§ï¾ÿæ•+ú¯Ó‘9O:¾Å~eâ¢Ìÿ¯ÿîâÊÛ9á÷d¢" 2D{LI Úê,½gåf‘$c„ãÔ2ÂÅHËfõY“‘qKñ +0Ä»•îO‡z ¬»ãÚ¡I‘cc2·±¦‚8ŸÛÓÌ:hžR¦oöÚG>`º©Êñ87sžeü¢­tç·Vð7Ó±(èV±`¬§—¿±½I®T¬à°#:KM(ü®Ý«MáÕÜ^g q+e«!ôª“K àìH¯G-ÄNkvM(µ€‘Jõ »rͪŒ‘În]ÜŠ·gG‹ôESÄ"™Dæ_ðÇ­ËETÞ÷@J¬•ìºåÌõqSù)à)ŒÔœöR…Bm¸À ¦à6.ýjŠýË¡S¾×æ°ö²Eùb¦ª8½½ëõc°’aò>+VÃS©Ùƒˆ®'R+¦D…ÎTõ^ ° \RÔÐÆìvÖ£}x¦«©¬ì$WÅAAW[ì­k’äМ)%ØS¼Îa+òO1Ö÷ÏtŸò›)Ì‚üˆ“úû1À§¿uËQ™e +È-t àÞê.š;Ý`"K G1«Ã*n¡µ÷R‚~Í0š7•_bV(­j_pvò€ŒnÝQ24\ô­ÄÉ0PdôjùÀÓMXɤÈ$„(4¤,[ ‹rü +£—qøb\-wP$_½ÿ3¢˜H,w’ê ¶G®·¡:€NyÖ=¢‘壟ÀïÓ§§«ë›ô” öd"&wTæÁ‘—zšöh‹,ÈÒ„˜õIüðþõú•ä!° my€4Þ€SóÒsTÑ”ÞíöÈ •õ¶x“Æž„¯Tш<É6‡[ðÁó®éÃU\x“çoMoÀÛ@@½‰œß÷…^’޽†3kž9 [C’¬+žúá €N\}>¥Qå²CÁ²)¼g_×ð7Ü!ž2àŒDopz&Ai¢0NÞ²þ1£:w øt^§CA­ŽB´HžBˆ8NY˜$&ì+ç0L•¾ †éaj/†£ž÷JQ*3w³r‰pÕ'Ù„ý¾`³¸`{U²¢€.#N”A?$¦Æ9E[³&9áî +#.68”£ºÅæhnlM1ÒlM‰þ,Bz`ð^²O´›XZ[Î0[p³z=Àtôö¡†b—’/Ùë+5ºÒ#Ñ +% /®Ï$º ÷Hò±… ñ¹uß­LæÊF=['ôÓ*ç[ T6ØüvæÅ¡JUÖ@ê*+7 àmå4@Œ2>ùwªBTíÂ~GqŒ×cCÄ- ×øñ]¨Ak“E÷4]|ìŠS;æ Óo‘ò;$#–tRñôݰɧw„ZŸ ©ÈvÙ’c* %ï~KUW¢9-‹ê†,ÄÝÍ·íÇ|wŒ‚§q«upz7fÍ~AÏJˆ>õTbŸ§5çi´§Ð©uoW7EݾíôœÄ˜Ê]j"–ÆQƒsN‰·ë¸JkŒ ÿÜIÈ©/R@¾$õÓdjZ¶¢HAÁÊüv)3æí÷ሓ@%UU~ƒ:qÿßÑ>Û€ifA}_Ëë‘P…¡  R3ñ£6”àŠ“Ì÷6B1zWIt¤d)4tgkÒ #+2y¸þHmâÄ·¡€º‚Z ¦’vˆUøè•]þ›HR“Ô›Lš®ïè¡|x¤ ˜yÛM~p*ókPv3­~Ñ󆫤Q&||ì6Cf©qoD÷£bD +ÇD-Jeá>Õ@”ð¤ƒãèí ì¼ %~¥‚}¡ÙZ2W”»Ù+M UõmBB¤:);rQ +5%|Ÿº2ó,ÃsP"5PuÍ‹E^¥ÛlßK¶L÷×§œÿˆTvìòY¹7§&ÄN +ç V °@AØÄÖ$¤G +…ÒDb+sHº’Ò¡Šúí¥bÐÑ B90P}ªRʄŖR§p¥ó€ž†Â‡sŽ}œB,0gÓßÚ:á(tNm¸c É|Ûüú´ò‡ZžÐäÝQÌU +¶Úݸ‹Z‚³)ÁÖ³]Þ” ûT]"7A¶´žÞ2_( N×{1  øj‹ÓÓ1Ó›)Æž3lP$v–ëƒ1èG–ÃÅ€I8âÓVàÚQ;€{ÅHϰÄhSýO èL?û?\3”8Ÿ!·UŒ|«š7Ž£Éw¢žj‡¶…ÆàjpþqsÔ­ÓTÜ´.<ê¥'¡z‰ ê{ fÒãÚë 91ÆyúV™3†Wã‚…ˆ =º N›õn¢±™¬b!n5ÿIB¹N¤ƒ!„ߨ%pÖáJ!ï×’šø—+#r#í¢Š[Wk +ÄG&þqWìüΟ !¯ØÇÙ^$Ù)B*4´ÙîÈ#«j¾&¹Ïù©©ž‰wâϽ?ƒÒ¢ú#B +&*e×ñí/Þª¡äïd€ð¸ÿ¾×µ8´<¤ÏR–O»x{_ž›Áâ­‡;P· ½×Ó>…tË“ˆŸéöR®ºƒVÿ,fþDÊØ¦+&.A_³N˜qŸF Ø\ŸV3®NªJ¹Côrf›\ÆÈtàâ©Ü+t®ŽT›²4M‡„=<®:œ*ðŽIì"Cï0ÒY+5``®ò†‘æ€é°Û3œ—Õ‰”ú¼zM!„‚Z2%ðÔÈÞ!=fÛzUÙ+Ýè­#0ɦª]™Šh(*ö–q þ8ìà™ î +¶3yÙlÑ ß|Ó¸¬€ØZ…*œÍg¡b"ˆžxåÖ +Âeißç¶gäƒIFC.ÎãðûEr§A´ºšY­Ð8#·¤±4FødëžS8’¯c‡³ˆª£¡Š¢¹Èj•"Ìõ#ÞDƒ©Â·õà‹ŽÙåSÎ)&ž¿pÂRûLò}<*mT"Ùsô͘ÉÚD F‘ºµ3ùf­[V©Ú…} C/ÔòòŸP5¡ÿ«c[ÜÈýPS=uAu§ªµ…_=Ùø@,ñº0fDÔTûÌ"Å=•ý‚שUvN¸LÊãã\¢$"7vù=Š—¶þ½@Á¢z¼=²£1·dµHŒ‚<ý¢@<þž‹î›„F—õN宯*/2ÂG9 GIq…>¥êò+ Ö¤‡ë õ´M`gÚ©ultÒ>ðbm ꀆM‹d\¼ùŒãæx¾Ž»dÿMÔÏŒàW”‹€áþûÁ(äØ9OcAVäªüŒ\Ë-f£Hó4íBÄs²´ñcæÔorÇwi »xŒÇŒ›‚„YËèâ]î XÖ.Fý³M-Ç K]W §0æOéÕzhçg4þÏW»h ºÍÄÔ²I÷##$霅¼ûüyÜ—¡Mñõ3¹NNS‚nla`øUœFT’¤zo:  )V6z^û )=3à1Ø;|]tnnäÚϽf¡L˜öŸVèƒR&´P¥„ç€Hšnï%º¿äÆ™h¸\×}Œ¹ác”†á ¾8É +‹j G°"÷œÏiñJ eû°¥’·uÊ ÍÛÉ…,’äà\¯ú·k7Ù†ró¶§]…SU–¯Hr»ÞTN&m,ÉÛ¾ÄDï^UÌËù=dáH‡ܾ€Œ2C,R¯·<Ùì³»K^|bìÏg6_Õ&2wH—¶@sŽiGõ“ÈÌÉYm[—t‡ˆ³G;Ÿa›/‡“g1i`H.)I·T“E"hòè© K ãÒ6ï’3—âñ_ˆ u³‰Ý +á¤Y7DNTò 8)¥ÀÎ,|¹ÁŠ;MSÞ>ÿ‚ÆÀi’å:svµq’ƒãX`bq™ä;YDO^u +ñdjÓlaœlÌR4ù11ºLâüš¨j\߸œ I9{0¶ú•ëónCy&®‹bT‚£pàd#ý™'x<±~µß¤x‡Š¯dh F*Ñbº©˜äQÚäJ0¿8B!íÈLå‘×”àiÔµ’| Š;Ef2´Òå~bM2#þòƒHˆÖržý13(är¬k¦þ™Hþè5c*äNÇ÷“>ê£DÞâ&ÊŸ ÅÌ® –òܶ,ÌÁÖÿ»¶¦ Å:`íf)e-qê_Ö˜¥n¶”º¨F%4X…ËdWÐÍÁÖ¥G'©ðÔ‘R\ÂFì (ÈzoH1„×x¾“o¯t$3àÞC¤1:Ù߆(Oܰôºñõ7u‚¢•ë´ëL²kÇËJHi>€u&/ø¨§C¸ ‰–x“‘ëè7µÌ±•«?ìv= VgÒÌÆ¥LŠÒö>ÓštèÂçhôMÞÁý©‰çý¤e´0ŸØ¿ûI™ç€*~8Q¦™Ù²‹Î!i£Â œ$v––&ŽvJߟI×Ö|$%ènPº'ýRI©iˆPÕj Ø8zAk^Žî†¸‹i8)ùœ +?õ±¦Ôÿ )M©P˜€–¸pæ %rª68Ð>œ”?»?¸êDÈõz:T?ïMˆôÚäÓ7ÂŒ=þ׉¬v@ïW±QPw¿1O†ù ßN¢eBOîýgb8±“÷—gg[$<¾¡4ÞÉä¶É …Æ„Ñì$qbZf9vX$» Ov?),ºª–AÆG.þœÝ4>™Tå#`#ÒŒþœ€TÂÎg9à¢ô[{ˆïžÂ¤u=d4f¸G÷Åw|ˆ Œ€c)ѲÁbÀäËãçó'e:y|2ØOÖ hVDþ`;ãÓíß•u‘%}*$exOúÓÍxýzc +ºÍ–J{ vÖ 8¹VÞfuÞÞ]R˜ÿÛ•dô³õ ˜€“Ž ¬Ë+zòá/˜H õá”ý½†@ð&Š…IO7¢¹B…Ìäé5šÚ3‰]:†@8"­k‚bG•`.Æ´fS¦ ¡ÇcÝ“¾§ 5¬R“oR©]ûøP“!ßMíÎx7ãáöá]R£]¯¥œYpt."˜b¬Ðn>˜L|¡  F—.Lft€ÏÇ3=¤`Èë9¦­évI‹„š úÆ8ò!6–úpðúñ¦”'è×ÎZ³~¢­D&ˆÌ)_J õÈ‘ÛÉþB¼eGâI]ëÆ;ªÞä«Xfµ +tzo#ªÏ1)&ƒ7A“š~C˜ìIXüËéÅø|™òôï’bP"¯ú€· ÕE7Ž!ÙäƒâuÍk[!êÖu÷>˜ Øsùz;®çž/KjRƒ’‹,»#ÁàžfOÇO¡4'?UF†r ÎËç1rQBï÷.®@2•÷}º˜ª~¾2™ÈùC˜ˆ¢lÔÏÓž6Ä3㳤 +;à©’%çù¹f©#©|P{g?²J·-:&z$õÙ¹§@.JñpÛÓtkSMºj~=ä—”ÇÿèoÃ¥RÈ$KÛ^دI}Wæ{ÎÎÀ|òZ–£Mwùå eúu  p9çºz<ñbÆ|Ÿyø¾¬¼NêþÿcX"0#7ŠÕ%cRyÊbÛJ÷*É9D0f Èþ$ 3‰|§éQ~+fëÊE³…„ôm~@P +ǯ8'ýö÷¤Ü<‰O¾¹Ñ‚møÔ·Ïlph9ÇQµIJ"š—üÚœpÝlÀ¸ÉŽ(fÝ6ÀËGâ;ù+)`ªs_ã%S Fnw>—7BR ]¸óq`HMÜj”lÑA7„^~‰% h|Þdûôª°I^&ö*½î×ýÚ5ÓÎŽ…×­¥ Þƒ(Îà)´%Uè?Ò˜ä¸Úã¥O†°XòÇòÉßýÒ?Þ~wFRÅ,Ù²C˜€ÔÍ¢øñ9"€f·EVÈÕðByGnÛ„Émw~17mŸûO¯vA—‰„XfÍ(FÈ!É}†ë‚ßAäÛ› Q1ªìQ mhæt¡2 ùƒÂkšùÐ,ûv¶sOo&O¿lþjÃl+&–‘s®lòÉ)pÆd%§l±fÞõÉIQ/úÚaòZf<ø,'M6 …È3+ÁÓuŒøŒIQ<9ÇL“¦4L†”ª¾¤i`¢äŸÒÏüÌÉO*â³°9 ¦¨³@?“žtVÞ”$´ª?{þ[³+äºKB a¾ rŽ#frê>SÌdÛ÷sÍäµÑ#Ñ&þêN%™a ÇÄ-[—ðƒ¥2“Ve2¹©6Ñ‚bÞ·h$ IyQ¬ïàñcaƒ¬ÆK”}Kâ ºn0.ÏKY'˜ØÖP×7hÉË©×]½ãs—O\Ù V¡Ž +;t‘§§ªr­Æ½¿¼™î~âŽúAð‰ Ïát ³{TÈÿ,µkq”§ÜŸM¼q‘e[IK=ÜpI±É¦ÚÒ/訾‰·HºVo—‘â™>i[æuÞNTmRx¨hfT/û³Éš=gú‘´­:›ô’§Ú¤A—:Nd±»cô²XyÚ)ÐÅsã¡»-ÇäulkçlÒÈ‘W`FŽ(šˆ9}¤y5W¹ Y–ü则®“œ—'½ŽÉæ(;ôo‘Íë½äÂÓMϺdbHœv™’„(Ñåaº½{s Œƶóàn±„ôd¢²&öÉ8ïx‘З$„*²C\ Ø'¼Ä–µz’ÀÐücûïB‡añOØGzÒ’ Ê3ñ1$cìËUÒÚS9KÑ:ôb ŽrƒV%)sOŸÙ[]›Ú$ŸÒ“æÔ´ h_ Ó’•¤SOF(o^„$…2‡­ÁèÉaArE! +I|fäúåØœŠêI©eÖõõŠ­Ó£È®:¥™°Ó̳èûÑ£&óžiöû@èJŠ q%©ª sõ5¸”\ä&Oƒ|Êù¡ÛŸµ%ƒˆÞðì4Èaá]î²´')?Ç:»ãÒ3ņY–!ÔÜ)u@ßmF1¸'GóRËcž”F# ÷&?®þß ZÊ|.«_œçDÙïßþ‡[Ъ~àæ6A§t„TIÞRÔ3‘ z“DëÊsLy.ŠHâYö »If° /Äèö¦ò“‘L‘ ßæ,LnBÂ:ÀÁvXAoeDƒkÀ—C)=ꡟ:·’+¹—¨™!eÁ©ù©ãè{@Úz®/^æâ5S`r5_²yc—Û”Y¬€R|¬1Pš+ËŬkLb˜k‘ŒupžÅ¨ô)?ǵôY‰fH`Q“0”ùÀ•â¦`T0w¿0ô…Þr¯Ù•Ÿ‡ JUûrß…eQ–Í9@v§I“Á…®@)$‡ßâ1V“bwªXAI=¶ïB0•ü©8Ï«¿îŽìX–%P…· +¿™-J÷åÝ­~‡ +ÊóÉuý#ûïRâ†[Ίóì\"ƒŒìˆR AiûÆÂ,m G±ʇó0n`‰Y…!(˦ô]ÀPRTPÆ@f6ãôû[X#Q‡J=$y÷ à „”þâ•QG–ðɱo¤îwõ.¥œî î¹I´]1©e¨ç¨Öj¸žeOÒ— êWP®Ú$¢8å°D–Ãâ.åÎèï“£<±¾[®Ä÷ h +üáenñopÚxÓ÷29‘Çþ¹hˆ:ž3Oìãdr–®Gïõé áÒIi4žýü=‹t=z Ôe>£P)–R¼¹ ô5.® >m¶µ]\ß6“!_õªž-/A°øjΔŽö1¯½‹K)á«§%ÉzÉ .qùs¤Ù›Xß —l$M®ÓRó,;þåi±Ñˆ1óí™Ò•ëoÇKcòtÏÞ(ÉàE›Ê¨d ’`ýZ)ÜÅ e±´à¶-U7‡O%ZomùÞÔ„„IÛ“3û#^ä^ÁD/»9P4$"ùЊLÓ†®–åïZ yÜCJ,Ó8ŠÓøÌ²èMêiyX‡œ½È‰ìMÊá[‘ø¶)þu,û8žC9ëVèÚè×Qü×ö£Ž,,KàNÄÄÅE”A¸<´€² –?0jhOã[ú'Y°ãæÌðÁy`Ë.±eQ…­L–7¡äXdž¶Q* « ºÙSRËîC ¸—Áõü´°±\ròU>RÆÁŠCa½gYÊqìÒ®‰‚#Èà|A‘Z/ÖžC5ÿüÕo^2Xד¬0‘(ÌtH‡.xŠ"àòUѬ`ÎcOUºàÐDäÝÌSIÖùb‘½ðƒl ,ëb +©R¼&XG¶S¥Ólñr8µz· +·iïò¤åLº¡‘Là\ü8•XàÚ3ùV(LiưÖóÚZ7yŠ õÏ +Òã=8è#ú³{ßòS2wÔ/|©È³ôõ_©Â¾œÆtÑ™-”Ü‘"™“— J%†ÁPGæ@ò°iíÅžÁ6±ò/k¬õ*ìýç¤a¶¶pláf˜£ƒäøn¢Ž -~õã$ÙÃôí¢…;·µÃ4áO‘µØô%XÉ¥¾èšµúׯPÖdíV§ˆ¤-%Ðm8ÑÓ´ã+°Ë´Ìa© œ¸|ª2H¹ ®6uìÔ¡kñ ÈyÚzÌ q4ü&jÝ$E­p¥â*Îβ"ÞçrW–ó1Eä:®~]x² 0,1®^Íä ¿ˆS²ÜÀo¶·[bH.×lzi‘‡]B>×$Ü)ÜÝOafnr¸´´ váÓ)#ßHŸ¬Ä'X™Œû=¦ Ãçtj-XTÒßB}¶d±€ZÕçRqïÒ6*Žä¶Ñ« AÏ—–ú¼%æÆÏ7Ì#x´¤Éÿn3ÁEsŸxþ:É/YD[o +ŸR´úàǹç}E}Ìscí^[ÞÜ£ñÖšBà´êç-”ùj‘éG~XËøÒi²F'“Ë.  Ù +‡“—ákÆäžH±9kõŽj +_IµÄ‚Ɖ~ŒÜLøŸË+½= #åëmS 4[j™ó”z÷ÿú4.SîÎ ÂJè®d¿î<}¡}°‘){ÅsO¼×åý~¼J½~c%a´À¢´€ Í,&¥+ °Ys?sýxª\ò”8‰$QÄ]ÛÆ•`=Ògd‘;DÙËÚ:²H*«Ï逵q´[{ëò2g– ³¼†ì›{l¬J–¬‡º¾ 4=T/²±„–c·húEÒ¤Írzîô]‡^ °çoú•Þk¡CVì¸Âv…(Ø¢ŠŽSŠË@PQ¥’Èÿü®IŠï€!k8†xJPª Ã’⣎7Ü$µ@y¦%!Oʃˆ)gžèbG‹BK×ÜL*‡²3Užù¢0æõf™yÚêµ*÷·@1¯Ú5èíÜÐJXleoM*ÖH#øç^Åf  ããŽ|wp—_’gÆè+;í¯Mäö#î;ÛVI^ñïQ>ꪒ0.ÉŽ¶ Í ÏºÊÞÓÚ¥Ùh[ø ,b‘rή$Ï/úbæPÔ†}ÜìLM,6Wtln–Xü™ÿ Òø”ˆ« £qÄ;69ù%¼Ü ÷}·×HYÆÔQmZqíS¥¬+·Mð¡-‹üñ[ŠØßü7Ûù‘«L jრ­pð;p˜?ô•Lºh †µ™$gŸ\kg¢„.t„Óo;šÉKÓlGöÒœ°â.ÎK»˜€;qƒB¸Zo0v÷?uY®œjÁA¢·lµ„£ò› ©6`Øls5f8R«vÿŒ0“¸ˆ„ÀWÏn *²í„κߡ`˜ÜœÁ³§<ØIrÿÓîû}œ› ›;~ÂÕ e†~ŒuƒHE`úÒÈ<ã‹úl¤(½Ñ‘ýà›K˜¾$ÚÉvçB©E‚G6* +ŸkIÅûµ„qi@÷àÒ-vQ<« žùç+|L½uX3q§ð¨Ê¯f,g=¬¾ù×¼ÃUNüÇ5cÚˆ°k3õÉæ^›¬úíó +B%L-z¡Ý|¾ÄŘô( +™V?m £@s—8ùÒî=évàZ6xºj–óaŒúFåþ4þ(ÓHÏŸý-Æ“pÄìGá¤2FRþëìÉÀ'GŒª,¯üxza;ƒþÀ}ѧÝé1¨µÂÊD¾Ž›©(Q­-/yfXñ)êâû‘Ô(zÍžC¼¦—MŠ,²Q"äa™C×"%µà¶AQ+Ev•¤9ƒË&¸ðBüxX†#½R;š:Ñk}ÑùcB¬²#ßRBgD²RÇBQÂI¢‚ ²˜‡ÁÔp«·¬u?­k8 +â€g™²ÄÖné|²MÛu³`!³¥ º“SŠÓ}µU|«ccsvN€*µ•¹¦åèÞ û%2¤Y–î$_G%<~îÿµí§b‡¢(4ÈÃ-UWòàxØyÊ{--ä7ùÝ•–ÄlFVB‚r\ûÅ¿U<\RüÇð?‡¬Ÿ ñùïM¾Ë€ïú˜Ä)o›bÌdø0æ7iæ±ÝC˜/Øfew÷Τ&nßP2^G-ƒ&»ú=¾Â²`a±m8¶ñ4ý‚ìEÖC´aˆ4h•s`ý\i…•t¯GÛ£*ÇÒhx1ý9 JŽY‡!”œ!ö]©)A…$„ ˆ  `!€Å„¢²Œ„uyHy;¶/`AÁW†×Nw¾ÖC\ÂÆíà°­ +rXI3CÔ~ˆ’Jã ]Wý.ûL`€`© (H.€X ÝF§¨šdUH¦…VÐ)¨ZÃ_Ùc+¿Fʵ7­Ôuø…ù§ªŽå)DÁ(šuaÞ襣×áiÊ|TÕ9å­/Í®oNQUÚl³–—Cfts3¾®Q¬ñùÁ¸ iïOºÍ,Í´ëÙÚ†ilC4Yî½Æ¢B{ØåZ•å!‰C:ªfªÙÞõ‘ÄWï¥[äÅQ"]ó—ðµ@£•uRŒý.ín{/ÚzO·µt!ó‡vG#´2¢+w“Ê£ÛôaŽÕîjÓ +<½Í²9”T +{âø.ŠX`P.ð\~ž%œËsžwsšãä©M]9±À ¨ëMaøð¦–FÌëÄSIa\{Ù=0 0Ú²°ðÎ;õNºkJúWGÅOQ!Zª™™%$-eK翉=-Í=vkóõ¾»Î»ÓŽnTµÎ¿Íª:Õ9¤¸´2Ñ”8¯—uÍi¾¯ìñž%’]‰_æ–ên~ÕH‰4.ŽG‡¥Õ´š0ÜZ—+ÓwºÞªÓÕÛCVj5æí,IB›,uÜ ‚Ë&Èb9¬I”¤Gƒ0]•V˜PéAe=£5š+\f¥`*—,ˆ³bH9¨"‹î:JnÓŠºH×Ò–lîu:[{v nÝâ~ÚÇ{žnKÖe—p±LCSÄy†(v8sÉb[œñu$¡™¦yZ›¬ï’ïRÿÃC¯Wù®7­nóé„Öº¾w7¸§5TÇÄSÙ5í¬bÜMÖYeíÑU’k꘨‹´—a·ê»ï*-SDÄœ:­ßÌ£Dêiõ JÍt­ÛR?sÒ׺î¹Nø},ðµWø_êùfºp£Ž²†üÒô”ú{zæ.ašˆõ9"çP™ íø¤M2ᑼ¦÷ÔOuÐ'eT]çÐÔ”KjKõ³ýl?viIK¶**ÚnJöØ/Ñá}ZZ×<¤ÄÝšñÎôUjÒUíú×™S_Òõ¢&‘åãäÛS¶2ô4÷[kiDç[i¡Ù쯉"išðzA{$âyŠ¡Hʳ:è}Í +š+#yAË¥¡.àŒ™^ŠE¿ÁÇ_…IMç{®ÝPâ¾æéÛqÏwd‘eËÙHRŒLé¦2²}3LÑû²ÓN ¥ÇÝ–òû[fVÜ5eá™ÃÀf¿Zµý9ó' +”qÇÇçÔ‹æ®ìÒYɘ;¿ý/€˜¥–cbˆìÆÚAõhÞÖ©—t %Uíá¨Ûz˜$“·mÑf$#Ìí˜Õ¹mÿî4Ç­±1pv.Œ +c~·ÁkÇ)Cqr²çšÛ½ozé¯Ä>{Zpº‚ãemI¬ƒ/ +þjqžŒ®à]Ä„u3S¼C +ì'0Û°¦&Ï”$®!XÕdÄvá}¹9G^ mɽ·ÿ·®çù¿³eÀ|Íp!"=ÝïO¨AÑsq~Éö í”Åä‹™½+úÅ¿DÞ—jëg%Lîµömv‰¯kfn”í…Oý¾Í鯶¬qã;äIjŽŒúWVn2û3é:çìbíoÀw6y§›~goÕñÔé:­Sû_9¹Í~xÚ˜ÙD5a:2GFÄ¿ër Èg·çGÞ^g]Ö߯M`¯*o½Ÿ^òa!0f5ujˆâÿÒ"ÑÒ¸ð{XÑxt-üà§2çzÇ?>5t]áä#„-?™“Š{ô]Ÿ’,óNÁ"?°7Ò8+”Mš¸Ñ¤u×Ú÷?ô;&ìí01Æ=ŠN,ÖiÖÖ{¤¥~눺„ÞôçØ½[2‘£ "HBã}æì~‘ÔåVkùŒªÉ>=빿ü¢È'yØ;÷€!‚‹Fs"A™=çvP<ÛÔÓ³ñ—Ÿ®™¯úÚ +Qq=ìË3²¡ÓYª£bå^ÌU’Ü ëàxEz‡€¹ê¦*ð4s—÷f¢f¢v©Ïĸ\—/h•|÷gBvÜf46‚{KZeâÀšKffzê+¸ÉDâS,¿Ê¨xw"ò±2tÿ†ês§ +*ªÐn'ˆs@…¦±%ç”Àpiˆ‡ÃÖnK ÔŽ0nuÉïY¬VÍ«3Ä«¾/í]ÛÉùP$û_eëË<ÂÌS³'È¢$,„¬"ú¶ePÏç^@²¤:kP3a’…ÿ BZþ ÃK˜ÏIZqDRG"‰Ó¹ ‚|!-0ãJT¢‡*z¡çøÎŸ4ƒw­úÏ#:-š\=åXÖAÄ.§¢â…ãÚßµ1Õ˜)êºðfÚOGX–fBV2Ô •9ó™`%ŸfUþˆél5„{BŒ»$!¾äNÜÒGï”JzHÆŒZ†Ðn¼_îL$ð}Iæÿ'J~9sg`•FÃMn¢Â„¥ÇÑéS_Í@òÈéÐÃ)òÿÁéV¢AÝljß#§ZÃ/¯2+䈤.EÒÈ·C Ñ"™&ÖêD‰äHÆ×õPÞÀtY¼³•)Ñ⊧Üq¶Ê0ܵäd­%`Õ!¿O¾i°ù1uê˜ø6¢òŽñ–ÜžŸân8¥¹B…¿v®eÖLÕÖ+v@±kˆ 6¹ÆÌƒ–Iz›ªËË;²^°Ga¥tLÖ‘¨«¦az¼¨)(RíÃ,Rj½r»ã±ß¤`CR³ð¬€«“\ºiÛê5TÉ“/W0nŽY¾$Ãä‹]ÖÎ¥Ͳ@ˆÐìHï8ÿˆë’2êƒ?r ª:³Â@eC:S¨„tBܪ@fp$?´# 3-@xO®#„/â ¾úŽ*s{µpÍøˆÎ8;\pÕ½…he @É `np =¯Ñ" |öñ*M¿òhè+øÍÉŸа…áã ú(®ÙNßdû›‡'Ÿi™¿ߦøÊãÇ=Oa¢³ p¦…ˆ™b_² fí¾K T^hí'úmêšEôþ <þ¿Í‚ +´´¥_óMñ <]úÅ •~‘OehEýÍ üK¤aè©ãŸu‚ûåËi~,‘gû&"‰)¹‚e""²,ñ%ö‚Ât4S_ÌøŒY±«Ÿ±#K­ ¬¸ñVOTåd(…Ú¢œ1U:J§‘k®t!çØ/R¼&£ƒ7{êºù‰Óû.%“lµNiEÑD‹ÚןH1ž÷äÝ'Øð÷$žõ±SGúz×çÓIu?Q5ï˜zµPz{íÆQé9œW¶cN©ÓZÓIqØî ^­MíV‰Æâ£Ïˆñ&¤¡{ït–LP¯ˆ:–»,Éžk»¹—¨5´¶Äý¦Ü´:5IYs=‚æÑ'pJÈ„1œ-À o„DÞF®â‚ÙŒbn‚°ã㛡I‘¨“Á O +!¨ˆŠ?q*I ÁA6NÊ÷Û’ +Ó„p3•!aÒˆéÍ«q¬ºP$㦺ìEt *®ˆ«>I6~¥æw>­5U˜‹d9ûLu‰mPÔ]†ØR¤… @÷¼²ƒ£Wƒó±¢•¥Ÿ„zq ÕN†—s“êüá—78IrÀUê e¼xî=ì`×jd5Ó|áõ‰ø’´TNÑš}E}PÜL¢ Òs}º¯+UÕ/úPj¤>@Ii:˜®ût&€ …¦Ç'׉ècÉû‡R­R%@Õ¶A×ëXHœPsDPoǺx)ÃÓ¬Êt•DRÔbâê‚MºjE\ŠØÀ”ÑaD»xî‡mÛ|‚}öÒ³×’RKŸ€Ö‘p1àí¿â"ÈT6ö#F2²Èu*|•3/KázgøG½Õ´IBýRORñnltJˆ÷œÒ&ë/¿ž¾)ˆ'<á!‘¼VƒOúHªµ¾Ýg€\ £À ’ÒïVÅ’#ddM€:+Ù ‹¢1B¢nrEɬ"ˬ„7×ùúVÝÌaY9GsÇñ6±ˆP‚ß@àJ€¤„Ð*ÆVÅ^ª‚ׄіHµ«‹)2Hï=`¸í°&'G§rUÒ›¬ïVº‰.ã1¯ç±È‹’•Ë⬷‘ = »n‹äa¢*“aß’µ^O!8—ã[}H!w™ôK‰ ¹¾7§w$n}÷f¹Æû·Ý+÷±Ru“-™ +âCî³ÙÇ)C™zýªýÇfrE5Š‘"eþçCQÃ…Ÿë7ˆ÷™w"n; –ª„AÖyXÙ” E·äìÒE(£Ö®¼ŠpV× F¸_Y]bï󻌑sƒÔÀ”6•~WÅÁ®gÉÕë3µ8nsPæëuôU—ì¡zªs@#w³çò±rj˜æÚÊ·ÆŒL+°ÀÓQõÚ&î*³uØ&Kº¢’™q¬Rñáø%E‰ô.saVâ_¼è®ÈŠH«9ñw¥ú´Ä˜ZÓ²›P‘ÍÓ#]„¤Z‰¨ì1­’Í`Ë(—1=IC­âf}äÍÓîG+ãuû‡‘4ALÔ‚`å‚H¸ÕÖÊeUà~ܪöuó+ç +¶ 6`ó²»Íh¡O©kScN@l÷{”›ðÔíò‘nI7>ëÅÆÈSàU5¢©ÛËHJkëîE›J[Ï¢ztÝÚ¿8¶Âu—Ä3ÄbÄ–L4V»kGþÉÌýGÃwdJ$Í¥7›x·*2¢x¢éì–ùÆE%Ž}n%>­/âËÖÓ½C´x¹,4­þK6¹geZÅ‹6®Ãa¸·T©8ÿ®€rH“1Ÿ é,¡õR´ìýÁmcúѾF9v>ißwnìCåhŸn×Ñ9Büž o¦)¿6_û^¸ütrß…m=‚Ap‰í#$’ïÖ|&×·¨‚¯Äk`ø8ätZIß©|Û"'å|Gd~¯ˆÌò¤Úƒ|"¿»Æù|§¦×ÒK ŽdnYË«ûey ø ¦«ÇÞóL[ŠÇm×`× ÎJì˜f£yY·¹~ª.^›pÔ<ªŒÀ§zøå=‹Qî—“Cy6âß~~^¯—7šþÀÙ±éѹSo,_Æ%¹’ÒŽ9ŽT@2ë”´ÒïÁ àkõ½å©žTµè¦PgšŽÈ£ý•°|A_é=ìÆ!ï3oÅPõùü»6øÙ†´; ÛDÌù +ìúSn?jÄaË?QÓL/MãZZûÈÜÉg>I ôM?¾aÐúƒaú*Ê9£ùœ$9âi+„µí_e Ÿ’hƒD6&|ûCîØ}»tà¹ÌǤ“ªÎ4ôJ3©ØŸÑ÷Ná¼¼)¶Ð á­k©$›ªÝÝÓés„RK°`Ží“a ÔsX‹#¸(JybÄþÓLßÝø¹Mg'žiòb ]3±ëò )Ù ¾¤f*r¬ÝÀÒdU¾ÖMý ÇIE4?HLG*´B†±¡ˆÆé(„@ дr + ˜Ù¸g1”ñ <ðó¥Öä¡YF%ÈiÕ&ý^¡@JŽ›×èz²[³pš¸ð'c²Ö¦ I‰ßÂ%¢r#@Åö羜R$\ýmî¼D|+=Æ~v)þ-ÅÂ9¸F“nꎌÎP˜)JâØö”f?Own‹Ï…zØÇLÌ3úÔâg|e ±[ƒÉ(éY­˜’L3Ìð·ŸÎ²»D¯ùeË0Q$‹0Ï1LçB+U8ªXJÏøÚ›F6װͳyŸãDuj¸o‡zåÀ¥Àô‰©ÐbûP<ÁºÖúêSÎeØXŠ£Î ,4:•>Wt!Hi"ûå) +ÚÆ¬wg7æRé³,`Àá„z‡¶<·CN˜³IDdÚŸ%9@…{µ Š|²'R¾S?lªÃ«È~ØöÞ̇_I¤JÒè+Ä&òAê+ +endstream endobj 13 0 obj [/Indexed/DeviceRGB 255 22 0 R] endobj 22 0 obj <>stream +8;X]O>EqN@%''O_@%e@?J;%+8(9e>X=MR6S?i^YgA3=].HDXF.R$lIL@"pJ+EP(%0 +b]6ajmNZn*!='OQZeQ^Y*,=]?C.B+\Ulg9dhD*"iC[;*=3`oP1[!S^)?1)IZ4dup` +E1r!/,*0[*9.aFIR2&b-C#soRZ7Dl%MLY\.?d>Mn +6%Q2oYfNRF$$+ON<+]RUJmC0InDZ4OTs0S!saG>GGKUlQ*Q?45:CI&4J'_2j$XKrcYp0n+Xl_nU*O( +l[$6Nn+Z_Nq0]s7hs]`XX1nZ8&94a\~> +endstream endobj 6 0 obj <> endobj 23 0 obj [/View/Design] endobj 24 0 obj <>>> endobj 5 0 obj <> endobj 25 0 obj <> endobj 26 0 obj <>stream +H‰|SiTW®¢©j\NE©Sºµª1F aQhAeÅ ´E…¸ÐÒ­4²¥$8 # tc̸TÜ@ٔͣƒ z (*›bbԜə[íÃs¦0æ×¼÷¼ïÞwï}ß]pÌÒÃqÜ.ðïáA+ƒ¾\·O«QªBµ .Õ{’c•Ú)#ÇKqÞÖ’Ÿ3“A‹éýû÷Á´}f×Í™fYàøàËå ‰‚ïžè$Ù¢¥Kݧ¤ü£ôr–¹/\¸ð£”ËT »Ô2Å>]’:N'[• MLÐ*“Ô*WY@l¬ìcL«Ö©µú)å_?’it2µ&)Z­•)ãà¯U«dIZ¥J§Ôî•%LYþîþ?©dšx™K¯™BŠ$A©“)ãUnB”„Y¢’ã“´µÎÕm¥bÓ¾Dµl‰L¥Þ Çfb6£1³Áì°yØgؘ+¶óÀäØRl9ˆ­ÄÖbë±PLmÂ6c[±Ø¡ÎØ:A•Œ°>Ü߆×YxY´àE”è¨ßÒÛ²ÀòwbÑEÚ“›ÉûâYâqµYí¶ªvÈiæ_7゜ß,ʱä³Ì¡“Y$˜ÐùÁ÷LH†n10&‰'Éïà‡Lò7™©šBÔ¤-uä´´ãP|OÅü%e }èÑ{pôíHb +]‡ƒxäˆÊ •Y 9b*³›¿ÒWBѨ +ÌN ²uA3Q<‡ö‡Ñ  ¥0(ø¢|Bs¹oW1/jç!9Z9o‘÷–ßÀ[_ pTÎCþäCøQió5Å7o0lG^ÃLÉDèoHæ” ÞÁ^\Gœ+k*k“¾¾¼~ —íäï…–!÷•«mÃÄ”@#ðô=Ç Æ@óTÄÏ·ÀòŽÎbT?éAl€(FÈfŒbð€¯‹Ê +/–ÔØ™Hƒ&[£‘ 8R/Ôtƒ×#Ìc">ÐÌ2è©D„©ôR^µlZC¼r9ùа%¡›K +ÙäÕDJy{J¯ìßý +ô²uë%®4*üD¸T·ß`HçÎ7¹$•y¯ë°®_ûtÏÖŽÑcð}&³^÷1~{ÙeÎ$¦×\hk‘< DÖˆ”ÎW”+ú4lnAyk"6,•8-ƒ9¬ñ³$üN—‰û¹¶¹ÿ ;ªmQûHVoðaé\¾Ž,Û¥HåüK"*;%­×n°ƒùµNèOc»/„ÃG›h"³ª¢K\‹½ +6œHµ'÷Ÿÿ¦3ùÕ7=±7¶Y™Ä½¥­mc’›©×5el2äWiHð·wr#뙼ü²¼:éËìµ\âºÕ•u')Ù>þF_LŠuë(ÄÑuW]Uoj§<ÆÿýfC "8ת]å’ë•-/ï6¦dœaéÆÒ^‚ø!.¼p¥}*÷çܽ,TÜ‹èª=Á’U[¶¹‡l,)U±Tü_ :ljøz´Þ€ž¤r×F¦Å¦FÙe‘ûªR+´ îàn»€„4Œv¡WÄ[ò 8V¶W_špZufwåÆaädKÅfö¨õ¼oìM±~8U£t:|nC7å=&LdPUkb0À‡!€‡\Ï·h¦ÔWËà¶|rˆ¤Ó# †öT0ù¦“Æãìý¢ÖÚv髿%_ptmòw ÚZw757œ8!¡ödöªô¼ßƒ©„5cpi”nâÌ ª3ˆ¯&‡WHÑtG´8—CãŽ0m°­ö§ ¬QH”çE ’YW²›ê%üØc2ÙŸ‘•ÁÒMk¾ S…J¿zòû~zü¢ëÆvÅ)Δ™›ž)¡tƒO|Ö×<ƒÏEü.Ð3¹ÿ4æIÆ”À!wd¿‰Ñ´`Ì œnæ—³éÄþuf°ÔãoM0ÃÀåv0w]“¾)•+²9jÒâ´žOMùpëŸw¥'`± Ÿê1™*¦ß5˜½˜½IºØ¸3ºòÊ3¥eÙ\¹¾4†¥à‚“w_¦Pæaˆ†ØaúÉC›ah$ ŒGO± ù×Z¤÷+~ª†›âBSaÞI¶¾àju³´·BáÊ¡ ÃP#纠í{3’ãÙ”ôT}z¢•¼­¿¶Fê½#r{"—EÒMG~!üHSTî®p µ5³‹ŸÞ… ¥þq\åü!Iì‘'ry÷%| +Ó`Ö/° +]Þýãþû‰Ió´#9ûL<75NÛõç¸ëóû¥ vø0Þ€w§wÔâÈÔâ÷–š™—Í—·ºÉ—”Љ”˜Þȃ„ŒPVbJu‡¨ˆê>Ž^ŒZRû`Ìø +ÍÀß÷ಢw­¼~À÷ÍÇàÓ`µ7«L£n³¯¨©¿¸®{ž¡Ë›p`™Z#LK=Q´[âlÌs¤tacmkK_]œqZ€ÔbvøxwÑã÷|ã¸ørøx3û½{ˆ{†~d{bbP;oÉç÷ 3û¯û>æa×á¾¾²¢x<Ùˆ±Š·½÷‹ß÷Æé‹wùS°øx÷&üxÛÙ÷zМ¿š½—Å—R™[œUÕû{Û÷0øx4Fû‡{R~XƒZˆ€¼}¾yÅ@÷†A<û‹{W{W€Zˆ‚½~½}ÁK÷Ї÷cΠÍ¼ÆøÇ÷÷fÇ¡¤¯¯°vtº°kЯ³ÉŲ÷†OTŠzngff£Xð«Hk˜aFUX'—øx—÷.———£—ûf—Ø— b_ ‹ Î +ã ã ø•øì :ù +endstream endobj 10 0 obj <> endobj 7 0 obj [6 0 R] endobj 27 0 obj <> endobj xref +0 28 +0000000000 65535 f +0000000016 00000 n +0000000144 00000 n +0000059305 00000 n +0000000000 00000 f +0000472483 00000 n +0000472297 00000 n +0000475994 00000 n +0000059356 00000 n +0000059771 00000 n +0000475881 00000 n +0000089002 00000 n +0000089812 00000 n +0000471735 00000 n +0000089886 00000 n +0000090166 00000 n +0000092070 00000 n +0000157659 00000 n +0000223248 00000 n +0000288837 00000 n +0000354426 00000 n +0000420015 00000 n +0000471783 00000 n +0000472367 00000 n +0000472398 00000 n +0000472886 00000 n +0000473246 00000 n +0000476017 00000 n +trailer +<<54E4F66DACD5774EBAA4FA59E797944E>]>> +startxref +476200 +%%EOF diff --git a/IOBox/Backup/v1.1.0/cJSON.c b/IOBox/Backup/v1.1.0/cJSON.c new file mode 100644 index 0000000..61483d9 --- /dev/null +++ b/IOBox/Backup/v1.1.0/cJSON.c @@ -0,0 +1,3143 @@ +/* + 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. +*/ + +/* cJSON */ +/* JSON parser in C. */ + +/* disable warnings about old C89 functions in MSVC */ +#if !defined(_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) +#define _CRT_SECURE_NO_DEPRECATE +#endif + +#ifdef __GNUC__ +#pragma GCC visibility push(default) +#endif +#if defined(_MSC_VER) +#pragma warning (push) +/* disable warning about single line comments in system headers */ +#pragma warning (disable : 4001) +#endif + +#include +#include +#include +#include +#include +#include +#include + +#ifdef ENABLE_LOCALES +#include +#endif + +#if defined(_MSC_VER) +#pragma warning (pop) +#endif +#ifdef __GNUC__ +#pragma GCC visibility pop +#endif + +#include "cJSON.h" + +/* define our own boolean type */ +#ifdef true +#undef true +#endif +#define true ((cJSON_bool)1) + +#ifdef false +#undef false +#endif +#define false ((cJSON_bool)0) + +/* define isnan and isinf for ANSI C, if in C99 or above, isnan and isinf has been defined in math.h */ +#ifndef isinf +#define isinf(d) (isnan((d - d)) && !isnan(d)) +#endif +#ifndef isnan +#define isnan(d) (d != d) +#endif + +#ifndef NAN +#ifdef _WIN32 +#define NAN sqrt(-1.0) +#else +#define NAN 0.0/0.0 +#endif +#endif + +typedef struct { + const unsigned char *json; + size_t position; +} error; +static error global_error = { NULL, 0 }; + +CJSON_PUBLIC(const char *) cJSON_GetErrorPtr(void) +{ + return (const char*) (global_error.json + global_error.position); +} + +CJSON_PUBLIC(char *) cJSON_GetStringValue(const cJSON * const item) +{ + if (!cJSON_IsString(item)) + { + return NULL; + } + + return item->valuestring; +} + +CJSON_PUBLIC(double) cJSON_GetNumberValue(const cJSON * const item) +{ + if (!cJSON_IsNumber(item)) + { + return (double) NAN; + } + + return item->valuedouble; +} + +/* This is a safeguard to prevent copy-pasters from using incompatible C and header files */ +#if (CJSON_VERSION_MAJOR != 1) || (CJSON_VERSION_MINOR != 7) || (CJSON_VERSION_PATCH != 18) + #error cJSON.h and cJSON.c have different versions. Make sure that both have the same. +#endif + +CJSON_PUBLIC(const char*) cJSON_Version(void) +{ + static char version[15]; + sprintf(version, "%i.%i.%i", CJSON_VERSION_MAJOR, CJSON_VERSION_MINOR, CJSON_VERSION_PATCH); + + return version; +} + +/* Case insensitive string comparison, doesn't consider two NULL pointers equal though */ +static int case_insensitive_strcmp(const unsigned char *string1, const unsigned char *string2) +{ + if ((string1 == NULL) || (string2 == NULL)) + { + return 1; + } + + if (string1 == string2) + { + return 0; + } + + for(; tolower(*string1) == tolower(*string2); (void)string1++, string2++) + { + if (*string1 == '\0') + { + return 0; + } + } + + return tolower(*string1) - tolower(*string2); +} + +typedef struct internal_hooks +{ + void *(CJSON_CDECL *allocate)(size_t size); + void (CJSON_CDECL *deallocate)(void *pointer); + void *(CJSON_CDECL *reallocate)(void *pointer, size_t size); +} internal_hooks; + +#if defined(_MSC_VER) +/* work around MSVC error C2322: '...' address of dllimport '...' is not static */ +static void * CJSON_CDECL internal_malloc(size_t size) +{ + return malloc(size); +} +static void CJSON_CDECL internal_free(void *pointer) +{ + free(pointer); +} +static void * CJSON_CDECL internal_realloc(void *pointer, size_t size) +{ + return realloc(pointer, size); +} +#else +#define internal_malloc malloc +#define internal_free free +#define internal_realloc realloc +#endif + +/* strlen of character literals resolved at compile time */ +#define static_strlen(string_literal) (sizeof(string_literal) - sizeof("")) + +static internal_hooks global_hooks = { internal_malloc, internal_free, internal_realloc }; + +static unsigned char* cJSON_strdup(const unsigned char* string, const internal_hooks * const hooks) +{ + size_t length = 0; + unsigned char *copy = NULL; + + if (string == NULL) + { + return NULL; + } + + length = strlen((const char*)string) + sizeof(""); + copy = (unsigned char*)hooks->allocate(length); + if (copy == NULL) + { + return NULL; + } + memcpy(copy, string, length); + + return copy; +} + +CJSON_PUBLIC(void) cJSON_InitHooks(cJSON_Hooks* hooks) +{ + if (hooks == NULL) + { + /* Reset hooks */ + global_hooks.allocate = malloc; + global_hooks.deallocate = free; + global_hooks.reallocate = realloc; + return; + } + + global_hooks.allocate = malloc; + if (hooks->malloc_fn != NULL) + { + global_hooks.allocate = hooks->malloc_fn; + } + + global_hooks.deallocate = free; + if (hooks->free_fn != NULL) + { + global_hooks.deallocate = hooks->free_fn; + } + + /* use realloc only if both free and malloc are used */ + global_hooks.reallocate = NULL; + if ((global_hooks.allocate == malloc) && (global_hooks.deallocate == free)) + { + global_hooks.reallocate = realloc; + } +} + +/* Internal constructor. */ +static cJSON *cJSON_New_Item(const internal_hooks * const hooks) +{ + cJSON* node = (cJSON*)hooks->allocate(sizeof(cJSON)); + if (node) + { + memset(node, '\0', sizeof(cJSON)); + } + + return node; +} + +/* Delete a cJSON structure. */ +CJSON_PUBLIC(void) cJSON_Delete(cJSON *item) +{ + cJSON *next = NULL; + while (item != NULL) + { + next = item->next; + if (!(item->type & cJSON_IsReference) && (item->child != NULL)) + { + cJSON_Delete(item->child); + } + if (!(item->type & cJSON_IsReference) && (item->valuestring != NULL)) + { + global_hooks.deallocate(item->valuestring); + item->valuestring = NULL; + } + if (!(item->type & cJSON_StringIsConst) && (item->string != NULL)) + { + global_hooks.deallocate(item->string); + item->string = NULL; + } + global_hooks.deallocate(item); + item = next; + } +} + +/* get the decimal point character of the current locale */ +static unsigned char get_decimal_point(void) +{ +#ifdef ENABLE_LOCALES + struct lconv *lconv = localeconv(); + return (unsigned char) lconv->decimal_point[0]; +#else + return '.'; +#endif +} + +typedef struct +{ + const unsigned char *content; + size_t length; + size_t offset; + size_t depth; /* How deeply nested (in arrays/objects) is the input at the current offset. */ + internal_hooks hooks; +} parse_buffer; + +/* check if the given size is left to read in a given parse buffer (starting with 1) */ +#define can_read(buffer, size) ((buffer != NULL) && (((buffer)->offset + size) <= (buffer)->length)) +/* check if the buffer can be accessed at the given index (starting with 0) */ +#define can_access_at_index(buffer, index) ((buffer != NULL) && (((buffer)->offset + index) < (buffer)->length)) +#define cannot_access_at_index(buffer, index) (!can_access_at_index(buffer, index)) +/* get a pointer to the buffer at the position */ +#define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset) + +/* Parse the input text to generate a number, and populate the result into item. */ +static cJSON_bool parse_number(cJSON * const item, parse_buffer * const input_buffer) +{ + double number = 0; + unsigned char *after_end = NULL; + unsigned char number_c_string[64]; + unsigned char decimal_point = get_decimal_point(); + size_t i = 0; + + if ((input_buffer == NULL) || (input_buffer->content == NULL)) + { + return false; + } + + /* copy the number into a temporary buffer and replace '.' with the decimal point + * of the current locale (for strtod) + * This also takes care of '\0' not necessarily being available for marking the end of the input */ + for (i = 0; (i < (sizeof(number_c_string) - 1)) && can_access_at_index(input_buffer, i); i++) + { + switch (buffer_at_offset(input_buffer)[i]) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '+': + case '-': + case 'e': + case 'E': + number_c_string[i] = buffer_at_offset(input_buffer)[i]; + break; + + case '.': + number_c_string[i] = decimal_point; + break; + + default: + goto loop_end; + } + } +loop_end: + number_c_string[i] = '\0'; + + number = strtod((const char*)number_c_string, (char**)&after_end); + if (number_c_string == after_end) + { + return false; /* parse_error */ + } + + item->valuedouble = number; + + /* use saturation in case of overflow */ + if (number >= INT_MAX) + { + item->valueint = INT_MAX; + } + else if (number <= (double)INT_MIN) + { + item->valueint = INT_MIN; + } + else + { + item->valueint = (int)number; + } + + item->type = cJSON_Number; + + input_buffer->offset += (size_t)(after_end - number_c_string); + return true; +} + +/* don't ask me, but the original cJSON_SetNumberValue returns an integer or double */ +CJSON_PUBLIC(double) cJSON_SetNumberHelper(cJSON *object, double number) +{ + if (number >= INT_MAX) + { + object->valueint = INT_MAX; + } + else if (number <= (double)INT_MIN) + { + object->valueint = INT_MIN; + } + else + { + object->valueint = (int)number; + } + + return object->valuedouble = number; +} + +/* Note: when passing a NULL valuestring, cJSON_SetValuestring treats this as an error and return NULL */ +CJSON_PUBLIC(char*) cJSON_SetValuestring(cJSON *object, const char *valuestring) +{ + char *copy = NULL; + /* if object's type is not cJSON_String or is cJSON_IsReference, it should not set valuestring */ + if ((object == NULL) || !(object->type & cJSON_String) || (object->type & cJSON_IsReference)) + { + return NULL; + } + /* return NULL if the object is corrupted or valuestring is NULL */ + if (object->valuestring == NULL || valuestring == NULL) + { + return NULL; + } + if (strlen(valuestring) <= strlen(object->valuestring)) + { + strcpy(object->valuestring, valuestring); + return object->valuestring; + } + copy = (char*) cJSON_strdup((const unsigned char*)valuestring, &global_hooks); + if (copy == NULL) + { + return NULL; + } + if (object->valuestring != NULL) + { + cJSON_free(object->valuestring); + } + object->valuestring = copy; + + return copy; +} + +typedef struct +{ + unsigned char *buffer; + size_t length; + size_t offset; + size_t depth; /* current nesting depth (for formatted printing) */ + cJSON_bool noalloc; + cJSON_bool format; /* is this print a formatted print */ + internal_hooks hooks; +} printbuffer; + +/* realloc printbuffer if necessary to have at least "needed" bytes more */ +static unsigned char* ensure(printbuffer * const p, size_t needed) +{ + unsigned char *newbuffer = NULL; + size_t newsize = 0; + + if ((p == NULL) || (p->buffer == NULL)) + { + return NULL; + } + + if ((p->length > 0) && (p->offset >= p->length)) + { + /* make sure that offset is valid */ + return NULL; + } + + if (needed > INT_MAX) + { + /* sizes bigger than INT_MAX are currently not supported */ + return NULL; + } + + needed += p->offset + 1; + if (needed <= p->length) + { + return p->buffer + p->offset; + } + + if (p->noalloc) { + return NULL; + } + + /* calculate new buffer size */ + if (needed > (INT_MAX / 2)) + { + /* overflow of int, use INT_MAX if possible */ + if (needed <= INT_MAX) + { + newsize = INT_MAX; + } + else + { + return NULL; + } + } + else + { + newsize = needed * 2; + } + + if (p->hooks.reallocate != NULL) + { + /* reallocate with realloc if available */ + newbuffer = (unsigned char*)p->hooks.reallocate(p->buffer, newsize); + if (newbuffer == NULL) + { + p->hooks.deallocate(p->buffer); + p->length = 0; + p->buffer = NULL; + + return NULL; + } + } + else + { + /* otherwise reallocate manually */ + newbuffer = (unsigned char*)p->hooks.allocate(newsize); + if (!newbuffer) + { + p->hooks.deallocate(p->buffer); + p->length = 0; + p->buffer = NULL; + + return NULL; + } + + memcpy(newbuffer, p->buffer, p->offset + 1); + p->hooks.deallocate(p->buffer); + } + p->length = newsize; + p->buffer = newbuffer; + + return newbuffer + p->offset; +} + +/* calculate the new length of the string in a printbuffer and update the offset */ +static void update_offset(printbuffer * const buffer) +{ + const unsigned char *buffer_pointer = NULL; + if ((buffer == NULL) || (buffer->buffer == NULL)) + { + return; + } + buffer_pointer = buffer->buffer + buffer->offset; + + buffer->offset += strlen((const char*)buffer_pointer); +} + +/* securely comparison of floating-point variables */ +static cJSON_bool compare_double(double a, double b) +{ + double maxVal = fabs(a) > fabs(b) ? fabs(a) : fabs(b); + return (fabs(a - b) <= maxVal * DBL_EPSILON); +} + +/* Render the number nicely from the given item into a string. */ +static cJSON_bool print_number(const cJSON * const item, printbuffer * const output_buffer) +{ + unsigned char *output_pointer = NULL; + double d = item->valuedouble; + int length = 0; + size_t i = 0; + unsigned char number_buffer[26] = {0}; /* temporary buffer to print the number into */ + unsigned char decimal_point = get_decimal_point(); + double test = 0.0; + + if (output_buffer == NULL) + { + return false; + } + + /* This checks for NaN and Infinity */ + if (isnan(d) || isinf(d)) + { + length = sprintf((char*)number_buffer, "null"); + } + else if(d == (double)item->valueint) + { + length = sprintf((char*)number_buffer, "%d", item->valueint); + } + else + { + /* Try 15 decimal places of precision to avoid nonsignificant nonzero digits */ + length = sprintf((char*)number_buffer, "%1.15g", d); + + /* Check whether the original double can be recovered */ + if ((sscanf((char*)number_buffer, "%lg", &test) != 1) || !compare_double((double)test, d)) + { + /* If not, print with 17 decimal places of precision */ + length = sprintf((char*)number_buffer, "%1.17g", d); + } + } + + /* sprintf failed or buffer overrun occurred */ + if ((length < 0) || (length > (int)(sizeof(number_buffer) - 1))) + { + return false; + } + + /* reserve appropriate space in the output */ + output_pointer = ensure(output_buffer, (size_t)length + sizeof("")); + if (output_pointer == NULL) + { + return false; + } + + /* copy the printed number to the output and replace locale + * dependent decimal point with '.' */ + for (i = 0; i < ((size_t)length); i++) + { + if (number_buffer[i] == decimal_point) + { + output_pointer[i] = '.'; + continue; + } + + output_pointer[i] = number_buffer[i]; + } + output_pointer[i] = '\0'; + + output_buffer->offset += (size_t)length; + + return true; +} + +/* parse 4 digit hexadecimal number */ +static unsigned parse_hex4(const unsigned char * const input) +{ + unsigned int h = 0; + size_t i = 0; + + for (i = 0; i < 4; i++) + { + /* parse digit */ + if ((input[i] >= '0') && (input[i] <= '9')) + { + h += (unsigned int) input[i] - '0'; + } + else if ((input[i] >= 'A') && (input[i] <= 'F')) + { + h += (unsigned int) 10 + input[i] - 'A'; + } + else if ((input[i] >= 'a') && (input[i] <= 'f')) + { + h += (unsigned int) 10 + input[i] - 'a'; + } + else /* invalid */ + { + return 0; + } + + if (i < 3) + { + /* shift left to make place for the next nibble */ + h = h << 4; + } + } + + return h; +} + +/* converts a UTF-16 literal to UTF-8 + * A literal can be one or two sequences of the form \uXXXX */ +static unsigned char utf16_literal_to_utf8(const unsigned char * const input_pointer, const unsigned char * const input_end, unsigned char **output_pointer) +{ + long unsigned int codepoint = 0; + unsigned int first_code = 0; + const unsigned char *first_sequence = input_pointer; + unsigned char utf8_length = 0; + unsigned char utf8_position = 0; + unsigned char sequence_length = 0; + unsigned char first_byte_mark = 0; + + if ((input_end - first_sequence) < 6) + { + /* input ends unexpectedly */ + goto fail; + } + + /* get the first utf16 sequence */ + first_code = parse_hex4(first_sequence + 2); + + /* check that the code is valid */ + if (((first_code >= 0xDC00) && (first_code <= 0xDFFF))) + { + goto fail; + } + + /* UTF16 surrogate pair */ + if ((first_code >= 0xD800) && (first_code <= 0xDBFF)) + { + const unsigned char *second_sequence = first_sequence + 6; + unsigned int second_code = 0; + sequence_length = 12; /* \uXXXX\uXXXX */ + + if ((input_end - second_sequence) < 6) + { + /* input ends unexpectedly */ + goto fail; + } + + if ((second_sequence[0] != '\\') || (second_sequence[1] != 'u')) + { + /* missing second half of the surrogate pair */ + goto fail; + } + + /* get the second utf16 sequence */ + second_code = parse_hex4(second_sequence + 2); + /* check that the code is valid */ + if ((second_code < 0xDC00) || (second_code > 0xDFFF)) + { + /* invalid second half of the surrogate pair */ + goto fail; + } + + + /* calculate the unicode codepoint from the surrogate pair */ + codepoint = 0x10000 + (((first_code & 0x3FF) << 10) | (second_code & 0x3FF)); + } + else + { + sequence_length = 6; /* \uXXXX */ + codepoint = first_code; + } + + /* encode as UTF-8 + * takes at maximum 4 bytes to encode: + * 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx */ + if (codepoint < 0x80) + { + /* normal ascii, encoding 0xxxxxxx */ + utf8_length = 1; + } + else if (codepoint < 0x800) + { + /* two bytes, encoding 110xxxxx 10xxxxxx */ + utf8_length = 2; + first_byte_mark = 0xC0; /* 11000000 */ + } + else if (codepoint < 0x10000) + { + /* three bytes, encoding 1110xxxx 10xxxxxx 10xxxxxx */ + utf8_length = 3; + first_byte_mark = 0xE0; /* 11100000 */ + } + else if (codepoint <= 0x10FFFF) + { + /* four bytes, encoding 1110xxxx 10xxxxxx 10xxxxxx 10xxxxxx */ + utf8_length = 4; + first_byte_mark = 0xF0; /* 11110000 */ + } + else + { + /* invalid unicode codepoint */ + goto fail; + } + + /* encode as utf8 */ + for (utf8_position = (unsigned char)(utf8_length - 1); utf8_position > 0; utf8_position--) + { + /* 10xxxxxx */ + (*output_pointer)[utf8_position] = (unsigned char)((codepoint | 0x80) & 0xBF); + codepoint >>= 6; + } + /* encode first byte */ + if (utf8_length > 1) + { + (*output_pointer)[0] = (unsigned char)((codepoint | first_byte_mark) & 0xFF); + } + else + { + (*output_pointer)[0] = (unsigned char)(codepoint & 0x7F); + } + + *output_pointer += utf8_length; + + return sequence_length; + +fail: + return 0; +} + +/* Parse the input text into an unescaped cinput, and populate item. */ +static cJSON_bool parse_string(cJSON * const item, parse_buffer * const input_buffer) +{ + const unsigned char *input_pointer = buffer_at_offset(input_buffer) + 1; + const unsigned char *input_end = buffer_at_offset(input_buffer) + 1; + unsigned char *output_pointer = NULL; + unsigned char *output = NULL; + + /* not a string */ + if (buffer_at_offset(input_buffer)[0] != '\"') + { + goto fail; + } + + { + /* calculate approximate size of the output (overestimate) */ + size_t allocation_length = 0; + size_t skipped_bytes = 0; + while (((size_t)(input_end - input_buffer->content) < input_buffer->length) && (*input_end != '\"')) + { + /* is escape sequence */ + if (input_end[0] == '\\') + { + if ((size_t)(input_end + 1 - input_buffer->content) >= input_buffer->length) + { + /* prevent buffer overflow when last input character is a backslash */ + goto fail; + } + skipped_bytes++; + input_end++; + } + input_end++; + } + if (((size_t)(input_end - input_buffer->content) >= input_buffer->length) || (*input_end != '\"')) + { + goto fail; /* string ended unexpectedly */ + } + + /* This is at most how much we need for the output */ + allocation_length = (size_t) (input_end - buffer_at_offset(input_buffer)) - skipped_bytes; + output = (unsigned char*)input_buffer->hooks.allocate(allocation_length + sizeof("")); + if (output == NULL) + { + goto fail; /* allocation failure */ + } + } + + output_pointer = output; + /* loop through the string literal */ + while (input_pointer < input_end) + { + if (*input_pointer != '\\') + { + *output_pointer++ = *input_pointer++; + } + /* escape sequence */ + else + { + unsigned char sequence_length = 2; + if ((input_end - input_pointer) < 1) + { + goto fail; + } + + switch (input_pointer[1]) + { + case 'b': + *output_pointer++ = '\b'; + break; + case 'f': + *output_pointer++ = '\f'; + break; + case 'n': + *output_pointer++ = '\n'; + break; + case 'r': + *output_pointer++ = '\r'; + break; + case 't': + *output_pointer++ = '\t'; + break; + case '\"': + case '\\': + case '/': + *output_pointer++ = input_pointer[1]; + break; + + /* UTF-16 literal */ + case 'u': + sequence_length = utf16_literal_to_utf8(input_pointer, input_end, &output_pointer); + if (sequence_length == 0) + { + /* failed to convert UTF16-literal to UTF-8 */ + goto fail; + } + break; + + default: + goto fail; + } + input_pointer += sequence_length; + } + } + + /* zero terminate the output */ + *output_pointer = '\0'; + + item->type = cJSON_String; + item->valuestring = (char*)output; + + input_buffer->offset = (size_t) (input_end - input_buffer->content); + input_buffer->offset++; + + return true; + +fail: + if (output != NULL) + { + input_buffer->hooks.deallocate(output); + output = NULL; + } + + if (input_pointer != NULL) + { + input_buffer->offset = (size_t)(input_pointer - input_buffer->content); + } + + return false; +} + +/* Render the cstring provided to an escaped version that can be printed. */ +static cJSON_bool print_string_ptr(const unsigned char * const input, printbuffer * const output_buffer) +{ + const unsigned char *input_pointer = NULL; + unsigned char *output = NULL; + unsigned char *output_pointer = NULL; + size_t output_length = 0; + /* numbers of additional characters needed for escaping */ + size_t escape_characters = 0; + + if (output_buffer == NULL) + { + return false; + } + + /* empty string */ + if (input == NULL) + { + output = ensure(output_buffer, sizeof("\"\"")); + if (output == NULL) + { + return false; + } + strcpy((char*)output, "\"\""); + + return true; + } + + /* set "flag" to 1 if something needs to be escaped */ + for (input_pointer = input; *input_pointer; input_pointer++) + { + switch (*input_pointer) + { + case '\"': + case '\\': + case '\b': + case '\f': + case '\n': + case '\r': + case '\t': + /* one character escape sequence */ + escape_characters++; + break; + default: + if (*input_pointer < 32) + { + /* UTF-16 escape sequence uXXXX */ + escape_characters += 5; + } + break; + } + } + output_length = (size_t)(input_pointer - input) + escape_characters; + + output = ensure(output_buffer, output_length + sizeof("\"\"")); + if (output == NULL) + { + return false; + } + + /* no characters have to be escaped */ + if (escape_characters == 0) + { + output[0] = '\"'; + memcpy(output + 1, input, output_length); + output[output_length + 1] = '\"'; + output[output_length + 2] = '\0'; + + return true; + } + + output[0] = '\"'; + output_pointer = output + 1; + /* copy the string */ + for (input_pointer = input; *input_pointer != '\0'; (void)input_pointer++, output_pointer++) + { + if ((*input_pointer > 31) && (*input_pointer != '\"') && (*input_pointer != '\\')) + { + /* normal character, copy */ + *output_pointer = *input_pointer; + } + else + { + /* character needs to be escaped */ + *output_pointer++ = '\\'; + switch (*input_pointer) + { + case '\\': + *output_pointer = '\\'; + break; + case '\"': + *output_pointer = '\"'; + break; + case '\b': + *output_pointer = 'b'; + break; + case '\f': + *output_pointer = 'f'; + break; + case '\n': + *output_pointer = 'n'; + break; + case '\r': + *output_pointer = 'r'; + break; + case '\t': + *output_pointer = 't'; + break; + default: + /* escape and print as unicode codepoint */ + sprintf((char*)output_pointer, "u%04x", *input_pointer); + output_pointer += 4; + break; + } + } + } + output[output_length + 1] = '\"'; + output[output_length + 2] = '\0'; + + return true; +} + +/* Invoke print_string_ptr (which is useful) on an item. */ +static cJSON_bool print_string(const cJSON * const item, printbuffer * const p) +{ + return print_string_ptr((unsigned char*)item->valuestring, p); +} + +/* Predeclare these prototypes. */ +static cJSON_bool parse_value(cJSON * const item, parse_buffer * const input_buffer); +static cJSON_bool print_value(const cJSON * const item, printbuffer * const output_buffer); +static cJSON_bool parse_array(cJSON * const item, parse_buffer * const input_buffer); +static cJSON_bool print_array(const cJSON * const item, printbuffer * const output_buffer); +static cJSON_bool parse_object(cJSON * const item, parse_buffer * const input_buffer); +static cJSON_bool print_object(const cJSON * const item, printbuffer * const output_buffer); + +/* Utility to jump whitespace and cr/lf */ +static parse_buffer *buffer_skip_whitespace(parse_buffer * const buffer) +{ + if ((buffer == NULL) || (buffer->content == NULL)) + { + return NULL; + } + + if (cannot_access_at_index(buffer, 0)) + { + return buffer; + } + + while (can_access_at_index(buffer, 0) && (buffer_at_offset(buffer)[0] <= 32)) + { + buffer->offset++; + } + + if (buffer->offset == buffer->length) + { + buffer->offset--; + } + + return buffer; +} + +/* skip the UTF-8 BOM (byte order mark) if it is at the beginning of a buffer */ +static parse_buffer *skip_utf8_bom(parse_buffer * const buffer) +{ + if ((buffer == NULL) || (buffer->content == NULL) || (buffer->offset != 0)) + { + return NULL; + } + + if (can_access_at_index(buffer, 4) && (strncmp((const char*)buffer_at_offset(buffer), "\xEF\xBB\xBF", 3) == 0)) + { + buffer->offset += 3; + } + + return buffer; +} + +CJSON_PUBLIC(cJSON *) cJSON_ParseWithOpts(const char *value, const char **return_parse_end, cJSON_bool require_null_terminated) +{ + size_t buffer_length; + + if (NULL == value) + { + return NULL; + } + + /* Adding null character size due to require_null_terminated. */ + buffer_length = strlen(value) + sizeof(""); + + return cJSON_ParseWithLengthOpts(value, buffer_length, return_parse_end, require_null_terminated); +} + +/* Parse an object - create a new root, and populate. */ +CJSON_PUBLIC(cJSON *) cJSON_ParseWithLengthOpts(const char *value, size_t buffer_length, const char **return_parse_end, cJSON_bool require_null_terminated) +{ + parse_buffer buffer = { 0, 0, 0, 0, { 0, 0, 0 } }; + cJSON *item = NULL; + + /* reset error position */ + global_error.json = NULL; + global_error.position = 0; + + if (value == NULL || 0 == buffer_length) + { + goto fail; + } + + buffer.content = (const unsigned char*)value; + buffer.length = buffer_length; + buffer.offset = 0; + buffer.hooks = global_hooks; + + item = cJSON_New_Item(&global_hooks); + if (item == NULL) /* memory fail */ + { + goto fail; + } + + if (!parse_value(item, buffer_skip_whitespace(skip_utf8_bom(&buffer)))) + { + /* parse failure. ep is set. */ + goto fail; + } + + /* if we require null-terminated JSON without appended garbage, skip and then check for a null terminator */ + if (require_null_terminated) + { + buffer_skip_whitespace(&buffer); + if ((buffer.offset >= buffer.length) || buffer_at_offset(&buffer)[0] != '\0') + { + goto fail; + } + } + if (return_parse_end) + { + *return_parse_end = (const char*)buffer_at_offset(&buffer); + } + + return item; + +fail: + if (item != NULL) + { + cJSON_Delete(item); + } + + if (value != NULL) + { + error local_error; + local_error.json = (const unsigned char*)value; + local_error.position = 0; + + if (buffer.offset < buffer.length) + { + local_error.position = buffer.offset; + } + else if (buffer.length > 0) + { + local_error.position = buffer.length - 1; + } + + if (return_parse_end != NULL) + { + *return_parse_end = (const char*)local_error.json + local_error.position; + } + + global_error = local_error; + } + + return NULL; +} + +/* Default options for cJSON_Parse */ +CJSON_PUBLIC(cJSON *) cJSON_Parse(const char *value) +{ + return cJSON_ParseWithOpts(value, 0, 0); +} + +CJSON_PUBLIC(cJSON *) cJSON_ParseWithLength(const char *value, size_t buffer_length) +{ + return cJSON_ParseWithLengthOpts(value, buffer_length, 0, 0); +} + +#define cjson_min(a, b) (((a) < (b)) ? (a) : (b)) + +static unsigned char *print(const cJSON * const item, cJSON_bool format, const internal_hooks * const hooks) +{ + static const size_t default_buffer_size = 256; + printbuffer buffer[1]; + unsigned char *printed = NULL; + + memset(buffer, 0, sizeof(buffer)); + + /* create buffer */ + buffer->buffer = (unsigned char*) hooks->allocate(default_buffer_size); + buffer->length = default_buffer_size; + buffer->format = format; + buffer->hooks = *hooks; + if (buffer->buffer == NULL) + { + goto fail; + } + + /* print the value */ + if (!print_value(item, buffer)) + { + goto fail; + } + update_offset(buffer); + + /* check if reallocate is available */ + if (hooks->reallocate != NULL) + { + printed = (unsigned char*) hooks->reallocate(buffer->buffer, buffer->offset + 1); + if (printed == NULL) { + goto fail; + } + buffer->buffer = NULL; + } + else /* otherwise copy the JSON over to a new buffer */ + { + printed = (unsigned char*) hooks->allocate(buffer->offset + 1); + if (printed == NULL) + { + goto fail; + } + memcpy(printed, buffer->buffer, cjson_min(buffer->length, buffer->offset + 1)); + printed[buffer->offset] = '\0'; /* just to be sure */ + + /* free the buffer */ + hooks->deallocate(buffer->buffer); + buffer->buffer = NULL; + } + + return printed; + +fail: + if (buffer->buffer != NULL) + { + hooks->deallocate(buffer->buffer); + buffer->buffer = NULL; + } + + if (printed != NULL) + { + hooks->deallocate(printed); + printed = NULL; + } + + return NULL; +} + +/* Render a cJSON item/entity/structure to text. */ +CJSON_PUBLIC(char *) cJSON_Print(const cJSON *item) +{ + return (char*)print(item, true, &global_hooks); +} + +CJSON_PUBLIC(char *) cJSON_PrintUnformatted(const cJSON *item) +{ + return (char*)print(item, false, &global_hooks); +} + +CJSON_PUBLIC(char *) cJSON_PrintBuffered(const cJSON *item, int prebuffer, cJSON_bool fmt) +{ + printbuffer p = { 0, 0, 0, 0, 0, 0, { 0, 0, 0 } }; + + if (prebuffer < 0) + { + return NULL; + } + + p.buffer = (unsigned char*)global_hooks.allocate((size_t)prebuffer); + if (!p.buffer) + { + return NULL; + } + + p.length = (size_t)prebuffer; + p.offset = 0; + p.noalloc = false; + p.format = fmt; + p.hooks = global_hooks; + + if (!print_value(item, &p)) + { + global_hooks.deallocate(p.buffer); + p.buffer = NULL; + return NULL; + } + + return (char*)p.buffer; +} + +CJSON_PUBLIC(cJSON_bool) cJSON_PrintPreallocated(cJSON *item, char *buffer, const int length, const cJSON_bool format) +{ + printbuffer p = { 0, 0, 0, 0, 0, 0, { 0, 0, 0 } }; + + if ((length < 0) || (buffer == NULL)) + { + return false; + } + + p.buffer = (unsigned char*)buffer; + p.length = (size_t)length; + p.offset = 0; + p.noalloc = true; + p.format = format; + p.hooks = global_hooks; + + return print_value(item, &p); +} + +/* Parser core - when encountering text, process appropriately. */ +static cJSON_bool parse_value(cJSON * const item, parse_buffer * const input_buffer) +{ + if ((input_buffer == NULL) || (input_buffer->content == NULL)) + { + return false; /* no input */ + } + + /* parse the different types of values */ + /* null */ + if (can_read(input_buffer, 4) && (strncmp((const char*)buffer_at_offset(input_buffer), "null", 4) == 0)) + { + item->type = cJSON_NULL; + input_buffer->offset += 4; + return true; + } + /* false */ + if (can_read(input_buffer, 5) && (strncmp((const char*)buffer_at_offset(input_buffer), "false", 5) == 0)) + { + item->type = cJSON_False; + input_buffer->offset += 5; + return true; + } + /* true */ + if (can_read(input_buffer, 4) && (strncmp((const char*)buffer_at_offset(input_buffer), "true", 4) == 0)) + { + item->type = cJSON_True; + item->valueint = 1; + input_buffer->offset += 4; + return true; + } + /* string */ + if (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == '\"')) + { + return parse_string(item, input_buffer); + } + /* number */ + if (can_access_at_index(input_buffer, 0) && ((buffer_at_offset(input_buffer)[0] == '-') || ((buffer_at_offset(input_buffer)[0] >= '0') && (buffer_at_offset(input_buffer)[0] <= '9')))) + { + return parse_number(item, input_buffer); + } + /* array */ + if (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == '[')) + { + return parse_array(item, input_buffer); + } + /* object */ + if (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == '{')) + { + return parse_object(item, input_buffer); + } + + return false; +} + +/* Render a value to text. */ +static cJSON_bool print_value(const cJSON * const item, printbuffer * const output_buffer) +{ + unsigned char *output = NULL; + + if ((item == NULL) || (output_buffer == NULL)) + { + return false; + } + + switch ((item->type) & 0xFF) + { + case cJSON_NULL: + output = ensure(output_buffer, 5); + if (output == NULL) + { + return false; + } + strcpy((char*)output, "null"); + return true; + + case cJSON_False: + output = ensure(output_buffer, 6); + if (output == NULL) + { + return false; + } + strcpy((char*)output, "false"); + return true; + + case cJSON_True: + output = ensure(output_buffer, 5); + if (output == NULL) + { + return false; + } + strcpy((char*)output, "true"); + return true; + + case cJSON_Number: + return print_number(item, output_buffer); + + case cJSON_Raw: + { + size_t raw_length = 0; + if (item->valuestring == NULL) + { + return false; + } + + raw_length = strlen(item->valuestring) + sizeof(""); + output = ensure(output_buffer, raw_length); + if (output == NULL) + { + return false; + } + memcpy(output, item->valuestring, raw_length); + return true; + } + + case cJSON_String: + return print_string(item, output_buffer); + + case cJSON_Array: + return print_array(item, output_buffer); + + case cJSON_Object: + return print_object(item, output_buffer); + + default: + return false; + } +} + +/* Build an array from input text. */ +static cJSON_bool parse_array(cJSON * const item, parse_buffer * const input_buffer) +{ + cJSON *head = NULL; /* head of the linked list */ + cJSON *current_item = NULL; + + if (input_buffer->depth >= CJSON_NESTING_LIMIT) + { + return false; /* to deeply nested */ + } + input_buffer->depth++; + + if (buffer_at_offset(input_buffer)[0] != '[') + { + /* not an array */ + goto fail; + } + + input_buffer->offset++; + buffer_skip_whitespace(input_buffer); + if (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == ']')) + { + /* empty array */ + goto success; + } + + /* check if we skipped to the end of the buffer */ + if (cannot_access_at_index(input_buffer, 0)) + { + input_buffer->offset--; + goto fail; + } + + /* step back to character in front of the first element */ + input_buffer->offset--; + /* loop through the comma separated array elements */ + do + { + /* allocate next item */ + cJSON *new_item = cJSON_New_Item(&(input_buffer->hooks)); + if (new_item == NULL) + { + goto fail; /* allocation failure */ + } + + /* attach next item to list */ + if (head == NULL) + { + /* start the linked list */ + current_item = head = new_item; + } + else + { + /* add to the end and advance */ + current_item->next = new_item; + new_item->prev = current_item; + current_item = new_item; + } + + /* parse next value */ + input_buffer->offset++; + buffer_skip_whitespace(input_buffer); + if (!parse_value(current_item, input_buffer)) + { + goto fail; /* failed to parse value */ + } + buffer_skip_whitespace(input_buffer); + } + while (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == ',')); + + if (cannot_access_at_index(input_buffer, 0) || buffer_at_offset(input_buffer)[0] != ']') + { + goto fail; /* expected end of array */ + } + +success: + input_buffer->depth--; + + if (head != NULL) { + head->prev = current_item; + } + + item->type = cJSON_Array; + item->child = head; + + input_buffer->offset++; + + return true; + +fail: + if (head != NULL) + { + cJSON_Delete(head); + } + + return false; +} + +/* Render an array to text */ +static cJSON_bool print_array(const cJSON * const item, printbuffer * const output_buffer) +{ + unsigned char *output_pointer = NULL; + size_t length = 0; + cJSON *current_element = item->child; + + if (output_buffer == NULL) + { + return false; + } + + /* Compose the output array. */ + /* opening square bracket */ + output_pointer = ensure(output_buffer, 1); + if (output_pointer == NULL) + { + return false; + } + + *output_pointer = '['; + output_buffer->offset++; + output_buffer->depth++; + + while (current_element != NULL) + { + if (!print_value(current_element, output_buffer)) + { + return false; + } + update_offset(output_buffer); + if (current_element->next) + { + length = (size_t) (output_buffer->format ? 2 : 1); + output_pointer = ensure(output_buffer, length + 1); + if (output_pointer == NULL) + { + return false; + } + *output_pointer++ = ','; + if(output_buffer->format) + { + *output_pointer++ = ' '; + } + *output_pointer = '\0'; + output_buffer->offset += length; + } + current_element = current_element->next; + } + + output_pointer = ensure(output_buffer, 2); + if (output_pointer == NULL) + { + return false; + } + *output_pointer++ = ']'; + *output_pointer = '\0'; + output_buffer->depth--; + + return true; +} + +/* Build an object from the text. */ +static cJSON_bool parse_object(cJSON * const item, parse_buffer * const input_buffer) +{ + cJSON *head = NULL; /* linked list head */ + cJSON *current_item = NULL; + + if (input_buffer->depth >= CJSON_NESTING_LIMIT) + { + return false; /* to deeply nested */ + } + input_buffer->depth++; + + if (cannot_access_at_index(input_buffer, 0) || (buffer_at_offset(input_buffer)[0] != '{')) + { + goto fail; /* not an object */ + } + + input_buffer->offset++; + buffer_skip_whitespace(input_buffer); + if (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == '}')) + { + goto success; /* empty object */ + } + + /* check if we skipped to the end of the buffer */ + if (cannot_access_at_index(input_buffer, 0)) + { + input_buffer->offset--; + goto fail; + } + + /* step back to character in front of the first element */ + input_buffer->offset--; + /* loop through the comma separated array elements */ + do + { + /* allocate next item */ + cJSON *new_item = cJSON_New_Item(&(input_buffer->hooks)); + if (new_item == NULL) + { + goto fail; /* allocation failure */ + } + + /* attach next item to list */ + if (head == NULL) + { + /* start the linked list */ + current_item = head = new_item; + } + else + { + /* add to the end and advance */ + current_item->next = new_item; + new_item->prev = current_item; + current_item = new_item; + } + + if (cannot_access_at_index(input_buffer, 1)) + { + goto fail; /* nothing comes after the comma */ + } + + /* parse the name of the child */ + input_buffer->offset++; + buffer_skip_whitespace(input_buffer); + if (!parse_string(current_item, input_buffer)) + { + goto fail; /* failed to parse name */ + } + buffer_skip_whitespace(input_buffer); + + /* swap valuestring and string, because we parsed the name */ + current_item->string = current_item->valuestring; + current_item->valuestring = NULL; + + if (cannot_access_at_index(input_buffer, 0) || (buffer_at_offset(input_buffer)[0] != ':')) + { + goto fail; /* invalid object */ + } + + /* parse the value */ + input_buffer->offset++; + buffer_skip_whitespace(input_buffer); + if (!parse_value(current_item, input_buffer)) + { + goto fail; /* failed to parse value */ + } + buffer_skip_whitespace(input_buffer); + } + while (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == ',')); + + if (cannot_access_at_index(input_buffer, 0) || (buffer_at_offset(input_buffer)[0] != '}')) + { + goto fail; /* expected end of object */ + } + +success: + input_buffer->depth--; + + if (head != NULL) { + head->prev = current_item; + } + + item->type = cJSON_Object; + item->child = head; + + input_buffer->offset++; + return true; + +fail: + if (head != NULL) + { + cJSON_Delete(head); + } + + return false; +} + +/* Render an object to text. */ +static cJSON_bool print_object(const cJSON * const item, printbuffer * const output_buffer) +{ + unsigned char *output_pointer = NULL; + size_t length = 0; + cJSON *current_item = item->child; + + if (output_buffer == NULL) + { + return false; + } + + /* Compose the output: */ + length = (size_t) (output_buffer->format ? 2 : 1); /* fmt: {\n */ + output_pointer = ensure(output_buffer, length + 1); + if (output_pointer == NULL) + { + return false; + } + + *output_pointer++ = '{'; + output_buffer->depth++; + if (output_buffer->format) + { + *output_pointer++ = '\n'; + } + output_buffer->offset += length; + + while (current_item) + { + if (output_buffer->format) + { + size_t i; + output_pointer = ensure(output_buffer, output_buffer->depth); + if (output_pointer == NULL) + { + return false; + } + for (i = 0; i < output_buffer->depth; i++) + { + *output_pointer++ = '\t'; + } + output_buffer->offset += output_buffer->depth; + } + + /* print key */ + if (!print_string_ptr((unsigned char*)current_item->string, output_buffer)) + { + return false; + } + update_offset(output_buffer); + + length = (size_t) (output_buffer->format ? 2 : 1); + output_pointer = ensure(output_buffer, length); + if (output_pointer == NULL) + { + return false; + } + *output_pointer++ = ':'; + if (output_buffer->format) + { + *output_pointer++ = '\t'; + } + output_buffer->offset += length; + + /* print value */ + if (!print_value(current_item, output_buffer)) + { + return false; + } + update_offset(output_buffer); + + /* print comma if not last */ + length = ((size_t)(output_buffer->format ? 1 : 0) + (size_t)(current_item->next ? 1 : 0)); + output_pointer = ensure(output_buffer, length + 1); + if (output_pointer == NULL) + { + return false; + } + if (current_item->next) + { + *output_pointer++ = ','; + } + + if (output_buffer->format) + { + *output_pointer++ = '\n'; + } + *output_pointer = '\0'; + output_buffer->offset += length; + + current_item = current_item->next; + } + + output_pointer = ensure(output_buffer, output_buffer->format ? (output_buffer->depth + 1) : 2); + if (output_pointer == NULL) + { + return false; + } + if (output_buffer->format) + { + size_t i; + for (i = 0; i < (output_buffer->depth - 1); i++) + { + *output_pointer++ = '\t'; + } + } + *output_pointer++ = '}'; + *output_pointer = '\0'; + output_buffer->depth--; + + return true; +} + +/* Get Array size/item / object item. */ +CJSON_PUBLIC(int) cJSON_GetArraySize(const cJSON *array) +{ + cJSON *child = NULL; + size_t size = 0; + + if (array == NULL) + { + return 0; + } + + child = array->child; + + while(child != NULL) + { + size++; + child = child->next; + } + + /* FIXME: Can overflow here. Cannot be fixed without breaking the API */ + + return (int)size; +} + +static cJSON* get_array_item(const cJSON *array, size_t index) +{ + cJSON *current_child = NULL; + + if (array == NULL) + { + return NULL; + } + + current_child = array->child; + while ((current_child != NULL) && (index > 0)) + { + index--; + current_child = current_child->next; + } + + return current_child; +} + +CJSON_PUBLIC(cJSON *) cJSON_GetArrayItem(const cJSON *array, int index) +{ + if (index < 0) + { + return NULL; + } + + return get_array_item(array, (size_t)index); +} + +static cJSON *get_object_item(const cJSON * const object, const char * const name, const cJSON_bool case_sensitive) +{ + cJSON *current_element = NULL; + + if ((object == NULL) || (name == NULL)) + { + return NULL; + } + + current_element = object->child; + if (case_sensitive) + { + while ((current_element != NULL) && (current_element->string != NULL) && (strcmp(name, current_element->string) != 0)) + { + current_element = current_element->next; + } + } + else + { + while ((current_element != NULL) && (case_insensitive_strcmp((const unsigned char*)name, (const unsigned char*)(current_element->string)) != 0)) + { + current_element = current_element->next; + } + } + + if ((current_element == NULL) || (current_element->string == NULL)) { + return NULL; + } + + return current_element; +} + +CJSON_PUBLIC(cJSON *) cJSON_GetObjectItem(const cJSON * const object, const char * const string) +{ + return get_object_item(object, string, false); +} + +CJSON_PUBLIC(cJSON *) cJSON_GetObjectItemCaseSensitive(const cJSON * const object, const char * const string) +{ + return get_object_item(object, string, true); +} + +CJSON_PUBLIC(cJSON_bool) cJSON_HasObjectItem(const cJSON *object, const char *string) +{ + return cJSON_GetObjectItem(object, string) ? 1 : 0; +} + +/* Utility for array list handling. */ +static void suffix_object(cJSON *prev, cJSON *item) +{ + prev->next = item; + item->prev = prev; +} + +/* Utility for handling references. */ +static cJSON *create_reference(const cJSON *item, const internal_hooks * const hooks) +{ + cJSON *reference = NULL; + if (item == NULL) + { + return NULL; + } + + reference = cJSON_New_Item(hooks); + if (reference == NULL) + { + return NULL; + } + + memcpy(reference, item, sizeof(cJSON)); + reference->string = NULL; + reference->type |= cJSON_IsReference; + reference->next = reference->prev = NULL; + return reference; +} + +static cJSON_bool add_item_to_array(cJSON *array, cJSON *item) +{ + cJSON *child = NULL; + + if ((item == NULL) || (array == NULL) || (array == item)) + { + return false; + } + + child = array->child; + /* + * To find the last item in array quickly, we use prev in array + */ + if (child == NULL) + { + /* list is empty, start new one */ + array->child = item; + item->prev = item; + item->next = NULL; + } + else + { + /* append to the end */ + if (child->prev) + { + suffix_object(child->prev, item); + array->child->prev = item; + } + } + + return true; +} + +/* Add item to array/object. */ +CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToArray(cJSON *array, cJSON *item) +{ + return add_item_to_array(array, item); +} + +#if defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ > 5)))) + #pragma GCC diagnostic push +#endif +#ifdef __GNUC__ +#pragma GCC diagnostic ignored "-Wcast-qual" +#endif +/* helper function to cast away const */ +static void* cast_away_const(const void* string) +{ + return (void*)string; +} +#if defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ > 5)))) + #pragma GCC diagnostic pop +#endif + + +static cJSON_bool add_item_to_object(cJSON * const object, const char * const string, cJSON * const item, const internal_hooks * const hooks, const cJSON_bool constant_key) +{ + char *new_key = NULL; + int new_type = cJSON_Invalid; + + if ((object == NULL) || (string == NULL) || (item == NULL) || (object == item)) + { + return false; + } + + if (constant_key) + { + new_key = (char*)cast_away_const(string); + new_type = item->type | cJSON_StringIsConst; + } + else + { + new_key = (char*)cJSON_strdup((const unsigned char*)string, hooks); + if (new_key == NULL) + { + return false; + } + + new_type = item->type & ~cJSON_StringIsConst; + } + + if (!(item->type & cJSON_StringIsConst) && (item->string != NULL)) + { + hooks->deallocate(item->string); + } + + item->string = new_key; + item->type = new_type; + + return add_item_to_array(object, item); +} + +CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item) +{ + return add_item_to_object(object, string, item, &global_hooks, false); +} + +/* Add an item to an object with constant string as key */ +CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item) +{ + return add_item_to_object(object, string, item, &global_hooks, true); +} + +CJSON_PUBLIC(cJSON_bool) cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item) +{ + if (array == NULL) + { + return false; + } + + return add_item_to_array(array, create_reference(item, &global_hooks)); +} + +CJSON_PUBLIC(cJSON_bool) cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item) +{ + if ((object == NULL) || (string == NULL)) + { + return false; + } + + return add_item_to_object(object, string, create_reference(item, &global_hooks), &global_hooks, false); +} + +CJSON_PUBLIC(cJSON*) cJSON_AddNullToObject(cJSON * const object, const char * const name) +{ + cJSON *null = cJSON_CreateNull(); + if (add_item_to_object(object, name, null, &global_hooks, false)) + { + return null; + } + + cJSON_Delete(null); + return NULL; +} + +CJSON_PUBLIC(cJSON*) cJSON_AddTrueToObject(cJSON * const object, const char * const name) +{ + cJSON *true_item = cJSON_CreateTrue(); + if (add_item_to_object(object, name, true_item, &global_hooks, false)) + { + return true_item; + } + + cJSON_Delete(true_item); + return NULL; +} + +CJSON_PUBLIC(cJSON*) cJSON_AddFalseToObject(cJSON * const object, const char * const name) +{ + cJSON *false_item = cJSON_CreateFalse(); + if (add_item_to_object(object, name, false_item, &global_hooks, false)) + { + return false_item; + } + + cJSON_Delete(false_item); + return NULL; +} + +CJSON_PUBLIC(cJSON*) cJSON_AddBoolToObject(cJSON * const object, const char * const name, const cJSON_bool boolean) +{ + cJSON *bool_item = cJSON_CreateBool(boolean); + if (add_item_to_object(object, name, bool_item, &global_hooks, false)) + { + return bool_item; + } + + cJSON_Delete(bool_item); + return NULL; +} + +CJSON_PUBLIC(cJSON*) cJSON_AddNumberToObject(cJSON * const object, const char * const name, const double number) +{ + cJSON *number_item = cJSON_CreateNumber(number); + if (add_item_to_object(object, name, number_item, &global_hooks, false)) + { + return number_item; + } + + cJSON_Delete(number_item); + return NULL; +} + +CJSON_PUBLIC(cJSON*) cJSON_AddStringToObject(cJSON * const object, const char * const name, const char * const string) +{ + cJSON *string_item = cJSON_CreateString(string); + if (add_item_to_object(object, name, string_item, &global_hooks, false)) + { + return string_item; + } + + cJSON_Delete(string_item); + return NULL; +} + +CJSON_PUBLIC(cJSON*) cJSON_AddRawToObject(cJSON * const object, const char * const name, const char * const raw) +{ + cJSON *raw_item = cJSON_CreateRaw(raw); + if (add_item_to_object(object, name, raw_item, &global_hooks, false)) + { + return raw_item; + } + + cJSON_Delete(raw_item); + return NULL; +} + +CJSON_PUBLIC(cJSON*) cJSON_AddObjectToObject(cJSON * const object, const char * const name) +{ + cJSON *object_item = cJSON_CreateObject(); + if (add_item_to_object(object, name, object_item, &global_hooks, false)) + { + return object_item; + } + + cJSON_Delete(object_item); + return NULL; +} + +CJSON_PUBLIC(cJSON*) cJSON_AddArrayToObject(cJSON * const object, const char * const name) +{ + cJSON *array = cJSON_CreateArray(); + if (add_item_to_object(object, name, array, &global_hooks, false)) + { + return array; + } + + cJSON_Delete(array); + return NULL; +} + +CJSON_PUBLIC(cJSON *) cJSON_DetachItemViaPointer(cJSON *parent, cJSON * const item) +{ + if ((parent == NULL) || (item == NULL)) + { + return NULL; + } + + if (item != parent->child) + { + /* not the first element */ + item->prev->next = item->next; + } + if (item->next != NULL) + { + /* not the last element */ + item->next->prev = item->prev; + } + + if (item == parent->child) + { + /* first element */ + parent->child = item->next; + } + else if (item->next == NULL) + { + /* last element */ + parent->child->prev = item->prev; + } + + /* make sure the detached item doesn't point anywhere anymore */ + item->prev = NULL; + item->next = NULL; + + return item; +} + +CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromArray(cJSON *array, int which) +{ + if (which < 0) + { + return NULL; + } + + return cJSON_DetachItemViaPointer(array, get_array_item(array, (size_t)which)); +} + +CJSON_PUBLIC(void) cJSON_DeleteItemFromArray(cJSON *array, int which) +{ + cJSON_Delete(cJSON_DetachItemFromArray(array, which)); +} + +CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObject(cJSON *object, const char *string) +{ + cJSON *to_detach = cJSON_GetObjectItem(object, string); + + return cJSON_DetachItemViaPointer(object, to_detach); +} + +CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObjectCaseSensitive(cJSON *object, const char *string) +{ + cJSON *to_detach = cJSON_GetObjectItemCaseSensitive(object, string); + + return cJSON_DetachItemViaPointer(object, to_detach); +} + +CJSON_PUBLIC(void) cJSON_DeleteItemFromObject(cJSON *object, const char *string) +{ + cJSON_Delete(cJSON_DetachItemFromObject(object, string)); +} + +CJSON_PUBLIC(void) cJSON_DeleteItemFromObjectCaseSensitive(cJSON *object, const char *string) +{ + cJSON_Delete(cJSON_DetachItemFromObjectCaseSensitive(object, string)); +} + +/* Replace array/object items with new ones. */ +CJSON_PUBLIC(cJSON_bool) cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newitem) +{ + cJSON *after_inserted = NULL; + + if (which < 0 || newitem == NULL) + { + return false; + } + + after_inserted = get_array_item(array, (size_t)which); + if (after_inserted == NULL) + { + return add_item_to_array(array, newitem); + } + + if (after_inserted != array->child && after_inserted->prev == NULL) { + /* return false if after_inserted is a corrupted array item */ + return false; + } + + newitem->next = after_inserted; + newitem->prev = after_inserted->prev; + after_inserted->prev = newitem; + if (after_inserted == array->child) + { + array->child = newitem; + } + else + { + newitem->prev->next = newitem; + } + return true; +} + +CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemViaPointer(cJSON * const parent, cJSON * const item, cJSON * replacement) +{ + if ((parent == NULL) || (parent->child == NULL) || (replacement == NULL) || (item == NULL)) + { + return false; + } + + if (replacement == item) + { + return true; + } + + replacement->next = item->next; + replacement->prev = item->prev; + + if (replacement->next != NULL) + { + replacement->next->prev = replacement; + } + if (parent->child == item) + { + if (parent->child->prev == parent->child) + { + replacement->prev = replacement; + } + parent->child = replacement; + } + else + { /* + * To find the last item in array quickly, we use prev in array. + * We can't modify the last item's next pointer where this item was the parent's child + */ + if (replacement->prev != NULL) + { + replacement->prev->next = replacement; + } + if (replacement->next == NULL) + { + parent->child->prev = replacement; + } + } + + item->next = NULL; + item->prev = NULL; + cJSON_Delete(item); + + return true; +} + +CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem) +{ + if (which < 0) + { + return false; + } + + return cJSON_ReplaceItemViaPointer(array, get_array_item(array, (size_t)which), newitem); +} + +static cJSON_bool replace_item_in_object(cJSON *object, const char *string, cJSON *replacement, cJSON_bool case_sensitive) +{ + if ((replacement == NULL) || (string == NULL)) + { + return false; + } + + /* replace the name in the replacement */ + if (!(replacement->type & cJSON_StringIsConst) && (replacement->string != NULL)) + { + cJSON_free(replacement->string); + } + replacement->string = (char*)cJSON_strdup((const unsigned char*)string, &global_hooks); + if (replacement->string == NULL) + { + return false; + } + + replacement->type &= ~cJSON_StringIsConst; + + return cJSON_ReplaceItemViaPointer(object, get_object_item(object, string, case_sensitive), replacement); +} + +CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInObject(cJSON *object, const char *string, cJSON *newitem) +{ + return replace_item_in_object(object, string, newitem, false); +} + +CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInObjectCaseSensitive(cJSON *object, const char *string, cJSON *newitem) +{ + return replace_item_in_object(object, string, newitem, true); +} + +/* Create basic types: */ +CJSON_PUBLIC(cJSON *) cJSON_CreateNull(void) +{ + cJSON *item = cJSON_New_Item(&global_hooks); + if(item) + { + item->type = cJSON_NULL; + } + + return item; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateTrue(void) +{ + cJSON *item = cJSON_New_Item(&global_hooks); + if(item) + { + item->type = cJSON_True; + } + + return item; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateFalse(void) +{ + cJSON *item = cJSON_New_Item(&global_hooks); + if(item) + { + item->type = cJSON_False; + } + + return item; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateBool(cJSON_bool boolean) +{ + cJSON *item = cJSON_New_Item(&global_hooks); + if(item) + { + item->type = boolean ? cJSON_True : cJSON_False; + } + + return item; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateNumber(double num) +{ + cJSON *item = cJSON_New_Item(&global_hooks); + if(item) + { + item->type = cJSON_Number; + item->valuedouble = num; + + /* use saturation in case of overflow */ + if (num >= INT_MAX) + { + item->valueint = INT_MAX; + } + else if (num <= (double)INT_MIN) + { + item->valueint = INT_MIN; + } + else + { + item->valueint = (int)num; + } + } + + return item; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateString(const char *string) +{ + cJSON *item = cJSON_New_Item(&global_hooks); + if(item) + { + item->type = cJSON_String; + item->valuestring = (char*)cJSON_strdup((const unsigned char*)string, &global_hooks); + if(!item->valuestring) + { + cJSON_Delete(item); + return NULL; + } + } + + return item; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateStringReference(const char *string) +{ + cJSON *item = cJSON_New_Item(&global_hooks); + if (item != NULL) + { + item->type = cJSON_String | cJSON_IsReference; + item->valuestring = (char*)cast_away_const(string); + } + + return item; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateObjectReference(const cJSON *child) +{ + cJSON *item = cJSON_New_Item(&global_hooks); + if (item != NULL) { + item->type = cJSON_Object | cJSON_IsReference; + item->child = (cJSON*)cast_away_const(child); + } + + return item; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateArrayReference(const cJSON *child) { + cJSON *item = cJSON_New_Item(&global_hooks); + if (item != NULL) { + item->type = cJSON_Array | cJSON_IsReference; + item->child = (cJSON*)cast_away_const(child); + } + + return item; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateRaw(const char *raw) +{ + cJSON *item = cJSON_New_Item(&global_hooks); + if(item) + { + item->type = cJSON_Raw; + item->valuestring = (char*)cJSON_strdup((const unsigned char*)raw, &global_hooks); + if(!item->valuestring) + { + cJSON_Delete(item); + return NULL; + } + } + + return item; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateArray(void) +{ + cJSON *item = cJSON_New_Item(&global_hooks); + if(item) + { + item->type=cJSON_Array; + } + + return item; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateObject(void) +{ + cJSON *item = cJSON_New_Item(&global_hooks); + if (item) + { + item->type = cJSON_Object; + } + + return item; +} + +/* Create Arrays: */ +CJSON_PUBLIC(cJSON *) cJSON_CreateIntArray(const int *numbers, int count) +{ + size_t i = 0; + cJSON *n = NULL; + cJSON *p = NULL; + cJSON *a = NULL; + + if ((count < 0) || (numbers == NULL)) + { + return NULL; + } + + a = cJSON_CreateArray(); + + for(i = 0; a && (i < (size_t)count); i++) + { + n = cJSON_CreateNumber(numbers[i]); + if (!n) + { + cJSON_Delete(a); + return NULL; + } + if(!i) + { + a->child = n; + } + else + { + suffix_object(p, n); + } + p = n; + } + + if (a && a->child) { + a->child->prev = n; + } + + return a; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateFloatArray(const float *numbers, int count) +{ + size_t i = 0; + cJSON *n = NULL; + cJSON *p = NULL; + cJSON *a = NULL; + + if ((count < 0) || (numbers == NULL)) + { + return NULL; + } + + a = cJSON_CreateArray(); + + for(i = 0; a && (i < (size_t)count); i++) + { + n = cJSON_CreateNumber((double)numbers[i]); + if(!n) + { + cJSON_Delete(a); + return NULL; + } + if(!i) + { + a->child = n; + } + else + { + suffix_object(p, n); + } + p = n; + } + + if (a && a->child) { + a->child->prev = n; + } + + return a; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateDoubleArray(const double *numbers, int count) +{ + size_t i = 0; + cJSON *n = NULL; + cJSON *p = NULL; + cJSON *a = NULL; + + if ((count < 0) || (numbers == NULL)) + { + return NULL; + } + + a = cJSON_CreateArray(); + + for(i = 0; a && (i < (size_t)count); i++) + { + n = cJSON_CreateNumber(numbers[i]); + if(!n) + { + cJSON_Delete(a); + return NULL; + } + if(!i) + { + a->child = n; + } + else + { + suffix_object(p, n); + } + p = n; + } + + if (a && a->child) { + a->child->prev = n; + } + + return a; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateStringArray(const char *const *strings, int count) +{ + size_t i = 0; + cJSON *n = NULL; + cJSON *p = NULL; + cJSON *a = NULL; + + if ((count < 0) || (strings == NULL)) + { + return NULL; + } + + a = cJSON_CreateArray(); + + for (i = 0; a && (i < (size_t)count); i++) + { + n = cJSON_CreateString(strings[i]); + if(!n) + { + cJSON_Delete(a); + return NULL; + } + if(!i) + { + a->child = n; + } + else + { + suffix_object(p,n); + } + p = n; + } + + if (a && a->child) { + a->child->prev = n; + } + + return a; +} + +/* Duplication */ +CJSON_PUBLIC(cJSON *) cJSON_Duplicate(const cJSON *item, cJSON_bool recurse) +{ + cJSON *newitem = NULL; + cJSON *child = NULL; + cJSON *next = NULL; + cJSON *newchild = NULL; + + /* Bail on bad ptr */ + if (!item) + { + goto fail; + } + /* Create new item */ + newitem = cJSON_New_Item(&global_hooks); + if (!newitem) + { + goto fail; + } + /* Copy over all vars */ + newitem->type = item->type & (~cJSON_IsReference); + newitem->valueint = item->valueint; + newitem->valuedouble = item->valuedouble; + if (item->valuestring) + { + newitem->valuestring = (char*)cJSON_strdup((unsigned char*)item->valuestring, &global_hooks); + if (!newitem->valuestring) + { + goto fail; + } + } + if (item->string) + { + newitem->string = (item->type&cJSON_StringIsConst) ? item->string : (char*)cJSON_strdup((unsigned char*)item->string, &global_hooks); + if (!newitem->string) + { + goto fail; + } + } + /* If non-recursive, then we're done! */ + if (!recurse) + { + return newitem; + } + /* Walk the ->next chain for the child. */ + child = item->child; + while (child != NULL) + { + newchild = cJSON_Duplicate(child, true); /* Duplicate (with recurse) each item in the ->next chain */ + if (!newchild) + { + goto fail; + } + if (next != NULL) + { + /* If newitem->child already set, then crosswire ->prev and ->next and move on */ + next->next = newchild; + newchild->prev = next; + next = newchild; + } + else + { + /* Set newitem->child and move to it */ + newitem->child = newchild; + next = newchild; + } + child = child->next; + } + if (newitem && newitem->child) + { + newitem->child->prev = newchild; + } + + return newitem; + +fail: + if (newitem != NULL) + { + cJSON_Delete(newitem); + } + + return NULL; +} + +static void skip_oneline_comment(char **input) +{ + *input += static_strlen("//"); + + for (; (*input)[0] != '\0'; ++(*input)) + { + if ((*input)[0] == '\n') { + *input += static_strlen("\n"); + return; + } + } +} + +static void skip_multiline_comment(char **input) +{ + *input += static_strlen("/*"); + + for (; (*input)[0] != '\0'; ++(*input)) + { + if (((*input)[0] == '*') && ((*input)[1] == '/')) + { + *input += static_strlen("*/"); + return; + } + } +} + +static void minify_string(char **input, char **output) { + (*output)[0] = (*input)[0]; + *input += static_strlen("\""); + *output += static_strlen("\""); + + + for (; (*input)[0] != '\0'; (void)++(*input), ++(*output)) { + (*output)[0] = (*input)[0]; + + if ((*input)[0] == '\"') { + (*output)[0] = '\"'; + *input += static_strlen("\""); + *output += static_strlen("\""); + return; + } else if (((*input)[0] == '\\') && ((*input)[1] == '\"')) { + (*output)[1] = (*input)[1]; + *input += static_strlen("\""); + *output += static_strlen("\""); + } + } +} + +CJSON_PUBLIC(void) cJSON_Minify(char *json) +{ + char *into = json; + + if (json == NULL) + { + return; + } + + while (json[0] != '\0') + { + switch (json[0]) + { + case ' ': + case '\t': + case '\r': + case '\n': + json++; + break; + + case '/': + if (json[1] == '/') + { + skip_oneline_comment(&json); + } + else if (json[1] == '*') + { + skip_multiline_comment(&json); + } else { + json++; + } + break; + + case '\"': + minify_string(&json, (char**)&into); + break; + + default: + into[0] = json[0]; + json++; + into++; + } + } + + /* and null-terminate. */ + *into = '\0'; +} + +CJSON_PUBLIC(cJSON_bool) cJSON_IsInvalid(const cJSON * const item) +{ + if (item == NULL) + { + return false; + } + + return (item->type & 0xFF) == cJSON_Invalid; +} + +CJSON_PUBLIC(cJSON_bool) cJSON_IsFalse(const cJSON * const item) +{ + if (item == NULL) + { + return false; + } + + return (item->type & 0xFF) == cJSON_False; +} + +CJSON_PUBLIC(cJSON_bool) cJSON_IsTrue(const cJSON * const item) +{ + if (item == NULL) + { + return false; + } + + return (item->type & 0xff) == cJSON_True; +} + + +CJSON_PUBLIC(cJSON_bool) cJSON_IsBool(const cJSON * const item) +{ + if (item == NULL) + { + return false; + } + + return (item->type & (cJSON_True | cJSON_False)) != 0; +} +CJSON_PUBLIC(cJSON_bool) cJSON_IsNull(const cJSON * const item) +{ + if (item == NULL) + { + return false; + } + + return (item->type & 0xFF) == cJSON_NULL; +} + +CJSON_PUBLIC(cJSON_bool) cJSON_IsNumber(const cJSON * const item) +{ + if (item == NULL) + { + return false; + } + + return (item->type & 0xFF) == cJSON_Number; +} + +CJSON_PUBLIC(cJSON_bool) cJSON_IsString(const cJSON * const item) +{ + if (item == NULL) + { + return false; + } + + return (item->type & 0xFF) == cJSON_String; +} + +CJSON_PUBLIC(cJSON_bool) cJSON_IsArray(const cJSON * const item) +{ + if (item == NULL) + { + return false; + } + + return (item->type & 0xFF) == cJSON_Array; +} + +CJSON_PUBLIC(cJSON_bool) cJSON_IsObject(const cJSON * const item) +{ + if (item == NULL) + { + return false; + } + + return (item->type & 0xFF) == cJSON_Object; +} + +CJSON_PUBLIC(cJSON_bool) cJSON_IsRaw(const cJSON * const item) +{ + if (item == NULL) + { + return false; + } + + return (item->type & 0xFF) == cJSON_Raw; +} + +CJSON_PUBLIC(cJSON_bool) cJSON_Compare(const cJSON * const a, const cJSON * const b, const cJSON_bool case_sensitive) +{ + if ((a == NULL) || (b == NULL) || ((a->type & 0xFF) != (b->type & 0xFF))) + { + return false; + } + + /* check if type is valid */ + switch (a->type & 0xFF) + { + case cJSON_False: + case cJSON_True: + case cJSON_NULL: + case cJSON_Number: + case cJSON_String: + case cJSON_Raw: + case cJSON_Array: + case cJSON_Object: + break; + + default: + return false; + } + + /* identical objects are equal */ + if (a == b) + { + return true; + } + + switch (a->type & 0xFF) + { + /* in these cases and equal type is enough */ + case cJSON_False: + case cJSON_True: + case cJSON_NULL: + return true; + + case cJSON_Number: + if (compare_double(a->valuedouble, b->valuedouble)) + { + return true; + } + return false; + + case cJSON_String: + case cJSON_Raw: + if ((a->valuestring == NULL) || (b->valuestring == NULL)) + { + return false; + } + if (strcmp(a->valuestring, b->valuestring) == 0) + { + return true; + } + + return false; + + case cJSON_Array: + { + cJSON *a_element = a->child; + cJSON *b_element = b->child; + + for (; (a_element != NULL) && (b_element != NULL);) + { + if (!cJSON_Compare(a_element, b_element, case_sensitive)) + { + return false; + } + + a_element = a_element->next; + b_element = b_element->next; + } + + /* one of the arrays is longer than the other */ + if (a_element != b_element) { + return false; + } + + return true; + } + + case cJSON_Object: + { + cJSON *a_element = NULL; + cJSON *b_element = NULL; + cJSON_ArrayForEach(a_element, a) + { + /* TODO This has O(n^2) runtime, which is horrible! */ + b_element = get_object_item(b, a_element->string, case_sensitive); + if (b_element == NULL) + { + return false; + } + + if (!cJSON_Compare(a_element, b_element, case_sensitive)) + { + return false; + } + } + + /* doing this twice, once on a and b to prevent true comparison if a subset of b + * TODO: Do this the proper way, this is just a fix for now */ + cJSON_ArrayForEach(b_element, b) + { + a_element = get_object_item(a, b_element->string, case_sensitive); + if (a_element == NULL) + { + return false; + } + + if (!cJSON_Compare(b_element, a_element, case_sensitive)) + { + return false; + } + } + + return true; + } + + default: + return false; + } +} + +CJSON_PUBLIC(void *) cJSON_malloc(size_t size) +{ + return global_hooks.allocate(size); +} + +CJSON_PUBLIC(void) cJSON_free(void *object) +{ + global_hooks.deallocate(object); + object = NULL; +} diff --git a/IOBox/Backup/v1.1.0/cJSON.h b/IOBox/Backup/v1.1.0/cJSON.h new file mode 100644 index 0000000..88cf0bc --- /dev/null +++ b/IOBox/Backup/v1.1.0/cJSON.h @@ -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 + +/* 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 diff --git a/IOBox/Backup/v1.1.0/cJSON_Utils.c b/IOBox/Backup/v1.1.0/cJSON_Utils.c new file mode 100644 index 0000000..63651df --- /dev/null +++ b/IOBox/Backup/v1.1.0/cJSON_Utils.c @@ -0,0 +1,1481 @@ +/* + 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. +*/ + +/* disable warnings about old C89 functions in MSVC */ +#if !defined(_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) +#define _CRT_SECURE_NO_DEPRECATE +#endif + +#ifdef __GNUCC__ +#pragma GCC visibility push(default) +#endif +#if defined(_MSC_VER) +#pragma warning (push) +/* disable warning about single line comments in system headers */ +#pragma warning (disable : 4001) +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +#if defined(_MSC_VER) +#pragma warning (pop) +#endif +#ifdef __GNUCC__ +#pragma GCC visibility pop +#endif + +#include "cJSON_Utils.h" + +/* define our own boolean type */ +#ifdef true +#undef true +#endif +#define true ((cJSON_bool)1) + +#ifdef false +#undef false +#endif +#define false ((cJSON_bool)0) + +static unsigned char* cJSONUtils_strdup(const unsigned char* const string) +{ + size_t length = 0; + unsigned char *copy = NULL; + + length = strlen((const char*)string) + sizeof(""); + copy = (unsigned char*) cJSON_malloc(length); + if (copy == NULL) + { + return NULL; + } + memcpy(copy, string, length); + + return copy; +} + +/* string comparison which doesn't consider NULL pointers equal */ +static int compare_strings(const unsigned char *string1, const unsigned char *string2, const cJSON_bool case_sensitive) +{ + if ((string1 == NULL) || (string2 == NULL)) + { + return 1; + } + + if (string1 == string2) + { + return 0; + } + + if (case_sensitive) + { + return strcmp((const char*)string1, (const char*)string2); + } + + for(; tolower(*string1) == tolower(*string2); (void)string1++, string2++) + { + if (*string1 == '\0') + { + return 0; + } + } + + return tolower(*string1) - tolower(*string2); +} + +/* securely comparison of floating-point variables */ +static cJSON_bool compare_double(double a, double b) +{ + double maxVal = fabs(a) > fabs(b) ? fabs(a) : fabs(b); + return (fabs(a - b) <= maxVal * DBL_EPSILON); +} + + +/* Compare the next path element of two JSON pointers, two NULL pointers are considered unequal: */ +static cJSON_bool compare_pointers(const unsigned char *name, const unsigned char *pointer, const cJSON_bool case_sensitive) +{ + if ((name == NULL) || (pointer == NULL)) + { + return false; + } + + for (; (*name != '\0') && (*pointer != '\0') && (*pointer != '/'); (void)name++, pointer++) /* compare until next '/' */ + { + if (*pointer == '~') + { + /* check for escaped '~' (~0) and '/' (~1) */ + if (((pointer[1] != '0') || (*name != '~')) && ((pointer[1] != '1') || (*name != '/'))) + { + /* invalid escape sequence or wrong character in *name */ + return false; + } + else + { + pointer++; + } + } + else if ((!case_sensitive && (tolower(*name) != tolower(*pointer))) || (case_sensitive && (*name != *pointer))) + { + return false; + } + } + if (((*pointer != 0) && (*pointer != '/')) != (*name != 0)) + { + /* one string has ended, the other not */ + return false;; + } + + return true; +} + +/* calculate the length of a string if encoded as JSON pointer with ~0 and ~1 escape sequences */ +static size_t pointer_encoded_length(const unsigned char *string) +{ + size_t length; + for (length = 0; *string != '\0'; (void)string++, length++) + { + /* character needs to be escaped? */ + if ((*string == '~') || (*string == '/')) + { + length++; + } + } + + return length; +} + +/* copy a string while escaping '~' and '/' with ~0 and ~1 JSON pointer escape codes */ +static void encode_string_as_pointer(unsigned char *destination, const unsigned char *source) +{ + for (; source[0] != '\0'; (void)source++, destination++) + { + if (source[0] == '/') + { + destination[0] = '~'; + destination[1] = '1'; + destination++; + } + else if (source[0] == '~') + { + destination[0] = '~'; + destination[1] = '0'; + destination++; + } + else + { + destination[0] = source[0]; + } + } + + destination[0] = '\0'; +} + +CJSON_PUBLIC(char *) cJSONUtils_FindPointerFromObjectTo(const cJSON * const object, const cJSON * const target) +{ + size_t child_index = 0; + cJSON *current_child = 0; + + if ((object == NULL) || (target == NULL)) + { + return NULL; + } + + if (object == target) + { + /* found */ + return (char*)cJSONUtils_strdup((const unsigned char*)""); + } + + /* recursively search all children of the object or array */ + for (current_child = object->child; current_child != NULL; (void)(current_child = current_child->next), child_index++) + { + unsigned char *target_pointer = (unsigned char*)cJSONUtils_FindPointerFromObjectTo(current_child, target); + /* found the target? */ + if (target_pointer != NULL) + { + if (cJSON_IsArray(object)) + { + /* reserve enough memory for a 64 bit integer + '/' and '\0' */ + unsigned char *full_pointer = (unsigned char*)cJSON_malloc(strlen((char*)target_pointer) + 20 + sizeof("/")); + /* check if conversion to unsigned long is valid + * This should be eliminated at compile time by dead code elimination + * if size_t is an alias of unsigned long, or if it is bigger */ + if (child_index > ULONG_MAX) + { + cJSON_free(target_pointer); + cJSON_free(full_pointer); + return NULL; + } + sprintf((char*)full_pointer, "/%lu%s", (unsigned long)child_index, target_pointer); /* / */ + cJSON_free(target_pointer); + + return (char*)full_pointer; + } + + if (cJSON_IsObject(object)) + { + unsigned char *full_pointer = (unsigned char*)cJSON_malloc(strlen((char*)target_pointer) + pointer_encoded_length((unsigned char*)current_child->string) + 2); + full_pointer[0] = '/'; + encode_string_as_pointer(full_pointer + 1, (unsigned char*)current_child->string); + strcat((char*)full_pointer, (char*)target_pointer); + cJSON_free(target_pointer); + + return (char*)full_pointer; + } + + /* reached leaf of the tree, found nothing */ + cJSON_free(target_pointer); + return NULL; + } + } + + /* not found */ + return NULL; +} + +/* non broken version of cJSON_GetArrayItem */ +static cJSON *get_array_item(const cJSON *array, size_t item) +{ + cJSON *child = array ? array->child : NULL; + while ((child != NULL) && (item > 0)) + { + item--; + child = child->next; + } + + return child; +} + +static cJSON_bool decode_array_index_from_pointer(const unsigned char * const pointer, size_t * const index) +{ + size_t parsed_index = 0; + size_t position = 0; + + if ((pointer[0] == '0') && ((pointer[1] != '\0') && (pointer[1] != '/'))) + { + /* leading zeroes are not permitted */ + return 0; + } + + for (position = 0; (pointer[position] >= '0') && (pointer[0] <= '9'); position++) + { + parsed_index = (10 * parsed_index) + (size_t)(pointer[position] - '0'); + + } + + if ((pointer[position] != '\0') && (pointer[position] != '/')) + { + return 0; + } + + *index = parsed_index; + + return 1; +} + +static cJSON *get_item_from_pointer(cJSON * const object, const char * pointer, const cJSON_bool case_sensitive) +{ + cJSON *current_element = object; + + if (pointer == NULL) + { + return NULL; + } + + /* follow path of the pointer */ + while ((pointer[0] == '/') && (current_element != NULL)) + { + pointer++; + if (cJSON_IsArray(current_element)) + { + size_t index = 0; + if (!decode_array_index_from_pointer((const unsigned char*)pointer, &index)) + { + return NULL; + } + + current_element = get_array_item(current_element, index); + } + else if (cJSON_IsObject(current_element)) + { + current_element = current_element->child; + /* GetObjectItem. */ + while ((current_element != NULL) && !compare_pointers((unsigned char*)current_element->string, (const unsigned char*)pointer, case_sensitive)) + { + current_element = current_element->next; + } + } + else + { + return NULL; + } + + /* skip to the next path token or end of string */ + while ((pointer[0] != '\0') && (pointer[0] != '/')) + { + pointer++; + } + } + + return current_element; +} + +CJSON_PUBLIC(cJSON *) cJSONUtils_GetPointer(cJSON * const object, const char *pointer) +{ + return get_item_from_pointer(object, pointer, false); +} + +CJSON_PUBLIC(cJSON *) cJSONUtils_GetPointerCaseSensitive(cJSON * const object, const char *pointer) +{ + return get_item_from_pointer(object, pointer, true); +} + +/* JSON Patch implementation. */ +static void decode_pointer_inplace(unsigned char *string) +{ + unsigned char *decoded_string = string; + + if (string == NULL) { + return; + } + + for (; *string; (void)decoded_string++, string++) + { + if (string[0] == '~') + { + if (string[1] == '0') + { + decoded_string[0] = '~'; + } + else if (string[1] == '1') + { + decoded_string[1] = '/'; + } + else + { + /* invalid escape sequence */ + return; + } + + string++; + } + } + + decoded_string[0] = '\0'; +} + +/* non-broken cJSON_DetachItemFromArray */ +static cJSON *detach_item_from_array(cJSON *array, size_t which) +{ + cJSON *c = array->child; + while (c && (which > 0)) + { + c = c->next; + which--; + } + if (!c) + { + /* item doesn't exist */ + return NULL; + } + if (c != array->child) + { + /* not the first element */ + c->prev->next = c->next; + } + if (c->next) + { + c->next->prev = c->prev; + } + if (c == array->child) + { + array->child = c->next; + } + else if (c->next == NULL) + { + array->child->prev = c->prev; + } + /* make sure the detached item doesn't point anywhere anymore */ + c->prev = c->next = NULL; + + return c; +} + +/* detach an item at the given path */ +static cJSON *detach_path(cJSON *object, const unsigned char *path, const cJSON_bool case_sensitive) +{ + unsigned char *parent_pointer = NULL; + unsigned char *child_pointer = NULL; + cJSON *parent = NULL; + cJSON *detached_item = NULL; + + /* copy path and split it in parent and child */ + parent_pointer = cJSONUtils_strdup(path); + if (parent_pointer == NULL) { + goto cleanup; + } + + child_pointer = (unsigned char*)strrchr((char*)parent_pointer, '/'); /* last '/' */ + if (child_pointer == NULL) + { + goto cleanup; + } + /* split strings */ + child_pointer[0] = '\0'; + child_pointer++; + + parent = get_item_from_pointer(object, (char*)parent_pointer, case_sensitive); + decode_pointer_inplace(child_pointer); + + if (cJSON_IsArray(parent)) + { + size_t index = 0; + if (!decode_array_index_from_pointer(child_pointer, &index)) + { + goto cleanup; + } + detached_item = detach_item_from_array(parent, index); + } + else if (cJSON_IsObject(parent)) + { + detached_item = cJSON_DetachItemFromObject(parent, (char*)child_pointer); + } + else + { + /* Couldn't find object to remove child from. */ + goto cleanup; + } + +cleanup: + if (parent_pointer != NULL) + { + cJSON_free(parent_pointer); + } + + return detached_item; +} + +/* sort lists using mergesort */ +static cJSON *sort_list(cJSON *list, const cJSON_bool case_sensitive) +{ + cJSON *first = list; + cJSON *second = list; + cJSON *current_item = list; + cJSON *result = list; + cJSON *result_tail = NULL; + + if ((list == NULL) || (list->next == NULL)) + { + /* One entry is sorted already. */ + return result; + } + + while ((current_item != NULL) && (current_item->next != NULL) && (compare_strings((unsigned char*)current_item->string, (unsigned char*)current_item->next->string, case_sensitive) < 0)) + { + /* Test for list sorted. */ + current_item = current_item->next; + } + if ((current_item == NULL) || (current_item->next == NULL)) + { + /* Leave sorted lists unmodified. */ + return result; + } + + /* reset pointer to the beginning */ + current_item = list; + while (current_item != NULL) + { + /* Walk two pointers to find the middle. */ + second = second->next; + current_item = current_item->next; + /* advances current_item two steps at a time */ + if (current_item != NULL) + { + current_item = current_item->next; + } + } + if ((second != NULL) && (second->prev != NULL)) + { + /* Split the lists */ + second->prev->next = NULL; + second->prev = NULL; + } + + /* Recursively sort the sub-lists. */ + first = sort_list(first, case_sensitive); + second = sort_list(second, case_sensitive); + result = NULL; + + /* Merge the sub-lists */ + while ((first != NULL) && (second != NULL)) + { + cJSON *smaller = NULL; + if (compare_strings((unsigned char*)first->string, (unsigned char*)second->string, case_sensitive) < 0) + { + smaller = first; + } + else + { + smaller = second; + } + + if (result == NULL) + { + /* start merged list with the smaller element */ + result_tail = smaller; + result = smaller; + } + else + { + /* add smaller element to the list */ + result_tail->next = smaller; + smaller->prev = result_tail; + result_tail = smaller; + } + + if (first == smaller) + { + first = first->next; + } + else + { + second = second->next; + } + } + + if (first != NULL) + { + /* Append rest of first list. */ + if (result == NULL) + { + return first; + } + result_tail->next = first; + first->prev = result_tail; + } + if (second != NULL) + { + /* Append rest of second list */ + if (result == NULL) + { + return second; + } + result_tail->next = second; + second->prev = result_tail; + } + + return result; +} + +static void sort_object(cJSON * const object, const cJSON_bool case_sensitive) +{ + if (object == NULL) + { + return; + } + object->child = sort_list(object->child, case_sensitive); +} + +static cJSON_bool compare_json(cJSON *a, cJSON *b, const cJSON_bool case_sensitive) +{ + if ((a == NULL) || (b == NULL) || ((a->type & 0xFF) != (b->type & 0xFF))) + { + /* mismatched type. */ + return false; + } + switch (a->type & 0xFF) + { + case cJSON_Number: + /* numeric mismatch. */ + if ((a->valueint != b->valueint) || (!compare_double(a->valuedouble, b->valuedouble))) + { + return false; + } + else + { + return true; + } + + case cJSON_String: + /* string mismatch. */ + if (strcmp(a->valuestring, b->valuestring) != 0) + { + return false; + } + else + { + return true; + } + + case cJSON_Array: + for ((void)(a = a->child), b = b->child; (a != NULL) && (b != NULL); (void)(a = a->next), b = b->next) + { + cJSON_bool identical = compare_json(a, b, case_sensitive); + if (!identical) + { + return false; + } + } + + /* array size mismatch? (one of both children is not NULL) */ + if ((a != NULL) || (b != NULL)) + { + return false; + } + else + { + return true; + } + + case cJSON_Object: + sort_object(a, case_sensitive); + sort_object(b, case_sensitive); + for ((void)(a = a->child), b = b->child; (a != NULL) && (b != NULL); (void)(a = a->next), b = b->next) + { + cJSON_bool identical = false; + /* compare object keys */ + if (compare_strings((unsigned char*)a->string, (unsigned char*)b->string, case_sensitive)) + { + /* missing member */ + return false; + } + identical = compare_json(a, b, case_sensitive); + if (!identical) + { + return false; + } + } + + /* object length mismatch (one of both children is not null) */ + if ((a != NULL) || (b != NULL)) + { + return false; + } + else + { + return true; + } + + default: + break; + } + + /* null, true or false */ + return true; +} + +/* non broken version of cJSON_InsertItemInArray */ +static cJSON_bool insert_item_in_array(cJSON *array, size_t which, cJSON *newitem) +{ + cJSON *child = array->child; + while (child && (which > 0)) + { + child = child->next; + which--; + } + if (which > 0) + { + /* item is after the end of the array */ + return 0; + } + if (child == NULL) + { + cJSON_AddItemToArray(array, newitem); + return 1; + } + + /* insert into the linked list */ + newitem->next = child; + newitem->prev = child->prev; + child->prev = newitem; + + /* was it at the beginning */ + if (child == array->child) + { + array->child = newitem; + } + else + { + newitem->prev->next = newitem; + } + + return 1; +} + +static cJSON *get_object_item(const cJSON * const object, const char* name, const cJSON_bool case_sensitive) +{ + if (case_sensitive) + { + return cJSON_GetObjectItemCaseSensitive(object, name); + } + + return cJSON_GetObjectItem(object, name); +} + +enum patch_operation { INVALID, ADD, REMOVE, REPLACE, MOVE, COPY, TEST }; + +static enum patch_operation decode_patch_operation(const cJSON * const patch, const cJSON_bool case_sensitive) +{ + cJSON *operation = get_object_item(patch, "op", case_sensitive); + if (!cJSON_IsString(operation)) + { + return INVALID; + } + + if (strcmp(operation->valuestring, "add") == 0) + { + return ADD; + } + + if (strcmp(operation->valuestring, "remove") == 0) + { + return REMOVE; + } + + if (strcmp(operation->valuestring, "replace") == 0) + { + return REPLACE; + } + + if (strcmp(operation->valuestring, "move") == 0) + { + return MOVE; + } + + if (strcmp(operation->valuestring, "copy") == 0) + { + return COPY; + } + + if (strcmp(operation->valuestring, "test") == 0) + { + return TEST; + } + + return INVALID; +} + +/* overwrite and existing item with another one and free resources on the way */ +static void overwrite_item(cJSON * const root, const cJSON replacement) +{ + if (root == NULL) + { + return; + } + + if (root->string != NULL) + { + cJSON_free(root->string); + } + if (root->valuestring != NULL) + { + cJSON_free(root->valuestring); + } + if (root->child != NULL) + { + cJSON_Delete(root->child); + } + + memcpy(root, &replacement, sizeof(cJSON)); +} + +static int apply_patch(cJSON *object, const cJSON *patch, const cJSON_bool case_sensitive) +{ + cJSON *path = NULL; + cJSON *value = NULL; + cJSON *parent = NULL; + enum patch_operation opcode = INVALID; + unsigned char *parent_pointer = NULL; + unsigned char *child_pointer = NULL; + int status = 0; + + path = get_object_item(patch, "path", case_sensitive); + if (!cJSON_IsString(path)) + { + /* malformed patch. */ + status = 2; + goto cleanup; + } + + opcode = decode_patch_operation(patch, case_sensitive); + if (opcode == INVALID) + { + status = 3; + goto cleanup; + } + else if (opcode == TEST) + { + /* compare value: {...} with the given path */ + status = !compare_json(get_item_from_pointer(object, path->valuestring, case_sensitive), get_object_item(patch, "value", case_sensitive), case_sensitive); + goto cleanup; + } + + /* special case for replacing the root */ + if (path->valuestring[0] == '\0') + { + if (opcode == REMOVE) + { + static const cJSON invalid = { NULL, NULL, NULL, cJSON_Invalid, NULL, 0, 0, NULL}; + + overwrite_item(object, invalid); + + status = 0; + goto cleanup; + } + + if ((opcode == REPLACE) || (opcode == ADD)) + { + value = get_object_item(patch, "value", case_sensitive); + if (value == NULL) + { + /* missing "value" for add/replace. */ + status = 7; + goto cleanup; + } + + value = cJSON_Duplicate(value, 1); + if (value == NULL) + { + /* out of memory for add/replace. */ + status = 8; + goto cleanup; + } + + overwrite_item(object, *value); + + /* delete the duplicated value */ + cJSON_free(value); + value = NULL; + + /* the string "value" isn't needed */ + if (object->string != NULL) + { + cJSON_free(object->string); + object->string = NULL; + } + + status = 0; + goto cleanup; + } + } + + if ((opcode == REMOVE) || (opcode == REPLACE)) + { + /* Get rid of old. */ + cJSON *old_item = detach_path(object, (unsigned char*)path->valuestring, case_sensitive); + if (old_item == NULL) + { + status = 13; + goto cleanup; + } + cJSON_Delete(old_item); + if (opcode == REMOVE) + { + /* For Remove, this job is done. */ + status = 0; + goto cleanup; + } + } + + /* Copy/Move uses "from". */ + if ((opcode == MOVE) || (opcode == COPY)) + { + cJSON *from = get_object_item(patch, "from", case_sensitive); + if (from == NULL) + { + /* missing "from" for copy/move. */ + status = 4; + goto cleanup; + } + + if (opcode == MOVE) + { + value = detach_path(object, (unsigned char*)from->valuestring, case_sensitive); + } + if (opcode == COPY) + { + value = get_item_from_pointer(object, from->valuestring, case_sensitive); + } + if (value == NULL) + { + /* missing "from" for copy/move. */ + status = 5; + goto cleanup; + } + if (opcode == COPY) + { + value = cJSON_Duplicate(value, 1); + } + if (value == NULL) + { + /* out of memory for copy/move. */ + status = 6; + goto cleanup; + } + } + else /* Add/Replace uses "value". */ + { + value = get_object_item(patch, "value", case_sensitive); + if (value == NULL) + { + /* missing "value" for add/replace. */ + status = 7; + goto cleanup; + } + value = cJSON_Duplicate(value, 1); + if (value == NULL) + { + /* out of memory for add/replace. */ + status = 8; + goto cleanup; + } + } + + /* Now, just add "value" to "path". */ + + /* split pointer in parent and child */ + parent_pointer = cJSONUtils_strdup((unsigned char*)path->valuestring); + if (parent_pointer) { + child_pointer = (unsigned char*)strrchr((char*)parent_pointer, '/'); + } + if (child_pointer != NULL) + { + child_pointer[0] = '\0'; + child_pointer++; + } + parent = get_item_from_pointer(object, (char*)parent_pointer, case_sensitive); + decode_pointer_inplace(child_pointer); + + /* add, remove, replace, move, copy, test. */ + if ((parent == NULL) || (child_pointer == NULL)) + { + /* Couldn't find object to add to. */ + status = 9; + goto cleanup; + } + else if (cJSON_IsArray(parent)) + { + if (strcmp((char*)child_pointer, "-") == 0) + { + cJSON_AddItemToArray(parent, value); + value = NULL; + } + else + { + size_t index = 0; + if (!decode_array_index_from_pointer(child_pointer, &index)) + { + status = 11; + goto cleanup; + } + + if (!insert_item_in_array(parent, index, value)) + { + status = 10; + goto cleanup; + } + value = NULL; + } + } + else if (cJSON_IsObject(parent)) + { + if (case_sensitive) + { + cJSON_DeleteItemFromObjectCaseSensitive(parent, (char*)child_pointer); + } + else + { + cJSON_DeleteItemFromObject(parent, (char*)child_pointer); + } + cJSON_AddItemToObject(parent, (char*)child_pointer, value); + value = NULL; + } + else /* parent is not an object */ + { + /* Couldn't find object to add to. */ + status = 9; + goto cleanup; + } + +cleanup: + if (value != NULL) + { + cJSON_Delete(value); + } + if (parent_pointer != NULL) + { + cJSON_free(parent_pointer); + } + + return status; +} + +CJSON_PUBLIC(int) cJSONUtils_ApplyPatches(cJSON * const object, const cJSON * const patches) +{ + const cJSON *current_patch = NULL; + int status = 0; + + if (!cJSON_IsArray(patches)) + { + /* malformed patches. */ + return 1; + } + + if (patches != NULL) + { + current_patch = patches->child; + } + + while (current_patch != NULL) + { + status = apply_patch(object, current_patch, false); + if (status != 0) + { + return status; + } + current_patch = current_patch->next; + } + + return 0; +} + +CJSON_PUBLIC(int) cJSONUtils_ApplyPatchesCaseSensitive(cJSON * const object, const cJSON * const patches) +{ + const cJSON *current_patch = NULL; + int status = 0; + + if (!cJSON_IsArray(patches)) + { + /* malformed patches. */ + return 1; + } + + if (patches != NULL) + { + current_patch = patches->child; + } + + while (current_patch != NULL) + { + status = apply_patch(object, current_patch, true); + if (status != 0) + { + return status; + } + current_patch = current_patch->next; + } + + return 0; +} + +static void compose_patch(cJSON * const patches, const unsigned char * const operation, const unsigned char * const path, const unsigned char *suffix, const cJSON * const value) +{ + cJSON *patch = NULL; + + if ((patches == NULL) || (operation == NULL) || (path == NULL)) + { + return; + } + + patch = cJSON_CreateObject(); + if (patch == NULL) + { + return; + } + cJSON_AddItemToObject(patch, "op", cJSON_CreateString((const char*)operation)); + + if (suffix == NULL) + { + cJSON_AddItemToObject(patch, "path", cJSON_CreateString((const char*)path)); + } + else + { + size_t suffix_length = pointer_encoded_length(suffix); + size_t path_length = strlen((const char*)path); + unsigned char *full_path = (unsigned char*)cJSON_malloc(path_length + suffix_length + sizeof("/")); + + sprintf((char*)full_path, "%s/", (const char*)path); + encode_string_as_pointer(full_path + path_length + 1, suffix); + + cJSON_AddItemToObject(patch, "path", cJSON_CreateString((const char*)full_path)); + cJSON_free(full_path); + } + + if (value != NULL) + { + cJSON_AddItemToObject(patch, "value", cJSON_Duplicate(value, 1)); + } + cJSON_AddItemToArray(patches, patch); +} + +CJSON_PUBLIC(void) cJSONUtils_AddPatchToArray(cJSON * const array, const char * const operation, const char * const path, const cJSON * const value) +{ + compose_patch(array, (const unsigned char*)operation, (const unsigned char*)path, NULL, value); +} + +static void create_patches(cJSON * const patches, const unsigned char * const path, cJSON * const from, cJSON * const to, const cJSON_bool case_sensitive) +{ + if ((from == NULL) || (to == NULL)) + { + return; + } + + if ((from->type & 0xFF) != (to->type & 0xFF)) + { + compose_patch(patches, (const unsigned char*)"replace", path, 0, to); + return; + } + + switch (from->type & 0xFF) + { + case cJSON_Number: + if ((from->valueint != to->valueint) || !compare_double(from->valuedouble, to->valuedouble)) + { + compose_patch(patches, (const unsigned char*)"replace", path, NULL, to); + } + return; + + case cJSON_String: + if (strcmp(from->valuestring, to->valuestring) != 0) + { + compose_patch(patches, (const unsigned char*)"replace", path, NULL, to); + } + return; + + case cJSON_Array: + { + size_t index = 0; + cJSON *from_child = from->child; + cJSON *to_child = to->child; + unsigned char *new_path = (unsigned char*)cJSON_malloc(strlen((const char*)path) + 20 + sizeof("/")); /* Allow space for 64bit int. log10(2^64) = 20 */ + + /* generate patches for all array elements that exist in both "from" and "to" */ + for (index = 0; (from_child != NULL) && (to_child != NULL); (void)(from_child = from_child->next), (void)(to_child = to_child->next), index++) + { + /* check if conversion to unsigned long is valid + * This should be eliminated at compile time by dead code elimination + * if size_t is an alias of unsigned long, or if it is bigger */ + if (index > ULONG_MAX) + { + cJSON_free(new_path); + return; + } + sprintf((char*)new_path, "%s/%lu", path, (unsigned long)index); /* path of the current array element */ + create_patches(patches, new_path, from_child, to_child, case_sensitive); + } + + /* remove leftover elements from 'from' that are not in 'to' */ + for (; (from_child != NULL); (void)(from_child = from_child->next)) + { + /* check if conversion to unsigned long is valid + * This should be eliminated at compile time by dead code elimination + * if size_t is an alias of unsigned long, or if it is bigger */ + if (index > ULONG_MAX) + { + cJSON_free(new_path); + return; + } + sprintf((char*)new_path, "%lu", (unsigned long)index); + compose_patch(patches, (const unsigned char*)"remove", path, new_path, NULL); + } + /* add new elements in 'to' that were not in 'from' */ + for (; (to_child != NULL); (void)(to_child = to_child->next), index++) + { + compose_patch(patches, (const unsigned char*)"add", path, (const unsigned char*)"-", to_child); + } + cJSON_free(new_path); + return; + } + + case cJSON_Object: + { + cJSON *from_child = NULL; + cJSON *to_child = NULL; + sort_object(from, case_sensitive); + sort_object(to, case_sensitive); + + from_child = from->child; + to_child = to->child; + /* for all object values in the object with more of them */ + while ((from_child != NULL) || (to_child != NULL)) + { + int diff; + if (from_child == NULL) + { + diff = 1; + } + else if (to_child == NULL) + { + diff = -1; + } + else + { + diff = compare_strings((unsigned char*)from_child->string, (unsigned char*)to_child->string, case_sensitive); + } + + if (diff == 0) + { + /* both object keys are the same */ + size_t path_length = strlen((const char*)path); + size_t from_child_name_length = pointer_encoded_length((unsigned char*)from_child->string); + unsigned char *new_path = (unsigned char*)cJSON_malloc(path_length + from_child_name_length + sizeof("/")); + + sprintf((char*)new_path, "%s/", path); + encode_string_as_pointer(new_path + path_length + 1, (unsigned char*)from_child->string); + + /* create a patch for the element */ + create_patches(patches, new_path, from_child, to_child, case_sensitive); + cJSON_free(new_path); + + from_child = from_child->next; + to_child = to_child->next; + } + else if (diff < 0) + { + /* object element doesn't exist in 'to' --> remove it */ + compose_patch(patches, (const unsigned char*)"remove", path, (unsigned char*)from_child->string, NULL); + + from_child = from_child->next; + } + else + { + /* object element doesn't exist in 'from' --> add it */ + compose_patch(patches, (const unsigned char*)"add", path, (unsigned char*)to_child->string, to_child); + + to_child = to_child->next; + } + } + return; + } + + default: + break; + } +} + +CJSON_PUBLIC(cJSON *) cJSONUtils_GeneratePatches(cJSON * const from, cJSON * const to) +{ + cJSON *patches = NULL; + + if ((from == NULL) || (to == NULL)) + { + return NULL; + } + + patches = cJSON_CreateArray(); + create_patches(patches, (const unsigned char*)"", from, to, false); + + return patches; +} + +CJSON_PUBLIC(cJSON *) cJSONUtils_GeneratePatchesCaseSensitive(cJSON * const from, cJSON * const to) +{ + cJSON *patches = NULL; + + if ((from == NULL) || (to == NULL)) + { + return NULL; + } + + patches = cJSON_CreateArray(); + create_patches(patches, (const unsigned char*)"", from, to, true); + + return patches; +} + +CJSON_PUBLIC(void) cJSONUtils_SortObject(cJSON * const object) +{ + sort_object(object, false); +} + +CJSON_PUBLIC(void) cJSONUtils_SortObjectCaseSensitive(cJSON * const object) +{ + sort_object(object, true); +} + +static cJSON *merge_patch(cJSON *target, const cJSON * const patch, const cJSON_bool case_sensitive) +{ + cJSON *patch_child = NULL; + + if (!cJSON_IsObject(patch)) + { + /* scalar value, array or NULL, just duplicate */ + cJSON_Delete(target); + return cJSON_Duplicate(patch, 1); + } + + if (!cJSON_IsObject(target)) + { + cJSON_Delete(target); + target = cJSON_CreateObject(); + } + + patch_child = patch->child; + while (patch_child != NULL) + { + if (cJSON_IsNull(patch_child)) + { + /* NULL is the indicator to remove a value, see RFC7396 */ + if (case_sensitive) + { + cJSON_DeleteItemFromObjectCaseSensitive(target, patch_child->string); + } + else + { + cJSON_DeleteItemFromObject(target, patch_child->string); + } + } + else + { + cJSON *replace_me = NULL; + cJSON *replacement = NULL; + + if (case_sensitive) + { + replace_me = cJSON_DetachItemFromObjectCaseSensitive(target, patch_child->string); + } + else + { + replace_me = cJSON_DetachItemFromObject(target, patch_child->string); + } + + replacement = merge_patch(replace_me, patch_child, case_sensitive); + if (replacement == NULL) + { + cJSON_Delete(target); + return NULL; + } + + cJSON_AddItemToObject(target, patch_child->string, replacement); + } + patch_child = patch_child->next; + } + return target; +} + +CJSON_PUBLIC(cJSON *) cJSONUtils_MergePatch(cJSON *target, const cJSON * const patch) +{ + return merge_patch(target, patch, false); +} + +CJSON_PUBLIC(cJSON *) cJSONUtils_MergePatchCaseSensitive(cJSON *target, const cJSON * const patch) +{ + return merge_patch(target, patch, true); +} + +static cJSON *generate_merge_patch(cJSON * const from, cJSON * const to, const cJSON_bool case_sensitive) +{ + cJSON *from_child = NULL; + cJSON *to_child = NULL; + cJSON *patch = NULL; + if (to == NULL) + { + /* patch to delete everything */ + return cJSON_CreateNull(); + } + if (!cJSON_IsObject(to) || !cJSON_IsObject(from)) + { + return cJSON_Duplicate(to, 1); + } + + sort_object(from, case_sensitive); + sort_object(to, case_sensitive); + + from_child = from->child; + to_child = to->child; + patch = cJSON_CreateObject(); + if (patch == NULL) + { + return NULL; + } + while (from_child || to_child) + { + int diff; + if (from_child != NULL) + { + if (to_child != NULL) + { + diff = strcmp(from_child->string, to_child->string); + } + else + { + diff = -1; + } + } + else + { + diff = 1; + } + + if (diff < 0) + { + /* from has a value that to doesn't have -> remove */ + cJSON_AddItemToObject(patch, from_child->string, cJSON_CreateNull()); + + from_child = from_child->next; + } + else if (diff > 0) + { + /* to has a value that from doesn't have -> add to patch */ + cJSON_AddItemToObject(patch, to_child->string, cJSON_Duplicate(to_child, 1)); + + to_child = to_child->next; + } + else + { + /* object key exists in both objects */ + if (!compare_json(from_child, to_child, case_sensitive)) + { + /* not identical --> generate a patch */ + cJSON_AddItemToObject(patch, to_child->string, cJSONUtils_GenerateMergePatch(from_child, to_child)); + } + + /* next key in the object */ + from_child = from_child->next; + to_child = to_child->next; + } + } + if (patch->child == NULL) + { + /* no patch generated */ + cJSON_Delete(patch); + return NULL; + } + + return patch; +} + +CJSON_PUBLIC(cJSON *) cJSONUtils_GenerateMergePatch(cJSON * const from, cJSON * const to) +{ + return generate_merge_patch(from, to, false); +} + +CJSON_PUBLIC(cJSON *) cJSONUtils_GenerateMergePatchCaseSensitive(cJSON * const from, cJSON * const to) +{ + return generate_merge_patch(from, to, true); +} diff --git a/IOBox/Backup/v1.1.0/cJSON_Utils.h b/IOBox/Backup/v1.1.0/cJSON_Utils.h new file mode 100644 index 0000000..a970c65 --- /dev/null +++ b/IOBox/Backup/v1.1.0/cJSON_Utils.h @@ -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 diff --git a/IOBox/Backup/v1.1.0/flow_chart.jpg b/IOBox/Backup/v1.1.0/flow_chart.jpg new file mode 100644 index 0000000..2cc4c98 Binary files /dev/null and b/IOBox/Backup/v1.1.0/flow_chart.jpg differ diff --git a/IOBox/Backup/v1.1.0/iobox_api.cpp b/IOBox/Backup/v1.1.0/iobox_api.cpp new file mode 100644 index 0000000..700516b --- /dev/null +++ b/IOBox/Backup/v1.1.0/iobox_api.cpp @@ -0,0 +1,1304 @@ +#include "iobox_api.h" +#include "cJSON.h" + +namespace ANSCENTER { + iobox_api::iobox_api(std::string ip_mcast, int port_mcast) + { + this->ip_mcast = ip_mcast; + 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& vec, const std::string& str) { + try { + for (const auto& item : vec) { + if (item.find(str) != std::string::npos) { + std::cout << "Found partial match: " << str << " in " << item << std::endl; + return true; + } + } + // 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(); + } + catch (const std::exception& e) { + std::cerr << e.what() << std::endl; + return false; + } + } + + void printBufferAsHex(const char* buffer, size_t length) { + try { + for (size_t i = 0; i < length; ++i) { + printf("%02X ", static_cast(buffer[i])); + if ((i + 1) % 16 == 0) { + printf("\n"); + } + } + printf("\n"); + } + catch (const std::exception& e) { + std::cerr << e.what() << std::endl; + } + } + void printStringAsHex(const std::string& str) { + try { + for (size_t i = 0; i < str.size(); ++i) { + printf("%02X ", static_cast(str[i])); + if ((i + 1) % 16 == 0) { + printf("\n"); + } + } + printf("\n"); + } + catch (const std::exception& e) { + std::cerr << e.what() << std::endl; + } + } + bool isValidIp(const std::string& ip) { + struct sockaddr_in sa; + return inet_pton(AF_INET, ip.c_str(), &(sa.sin_addr)) != 0; + } + + std::string hostNameToIp(std::string hostName) { + struct hostent* host; + struct in_addr addr; + if ((host = gethostbyname(hostName.c_str())) == NULL) { + std::cerr << "Failed to get host by name: " << hostName << std::endl; + return ""; + } + addr.s_addr = *(u_long*)host->h_addr_list[0]; + return inet_ntoa(addr); + } + std::string checkIpFromRemote(const std::string& remote) { + std::string ip; + if (!isValidIp(remote)) { + std::cout << "Host name address: " << remote << std::endl; + ip = hostNameToIp(remote); + if (ip == "") { + std::cerr << "Failed to get ip from host name: " << remote << std::endl; + return ""; + } + return ip; + } + else return remote; + } + + + iobox_info_t parseIoboxResponseObj(cJSON* responseObj) { + try { + iobox_info_t info; + cJSON* model = cJSON_GetObjectItem(responseObj, "Model"); + if (model != nullptr) { + info.model = model->valuestring; + } + cJSON* serial = cJSON_GetObjectItem(responseObj, "Serial"); + if (serial != nullptr) { + //info.serial_number = serial->valuestring; + } + cJSON* hwVer = cJSON_GetObjectItem(responseObj, "HwVer"); + if (hwVer != nullptr) { + info.hardware_version = hwVer->valuestring; + } + cJSON* fwVer = cJSON_GetObjectItem(responseObj, "FwVer"); + if (fwVer != nullptr) { + info.firmware_version = fwVer->valuestring; + } + cJSON* macAddr = cJSON_GetObjectItem(responseObj, "macAddr"); + if (macAddr != nullptr) { + info.mac_address = macAddr->valuestring; + info.serial_number = macAddr->valuestring; + } + cJSON* localIp = cJSON_GetObjectItem(responseObj, "localIp"); + if (localIp != nullptr) { + info.ip_address = localIp->valuestring; + } + return info; + } + catch (const std::exception& e) { + std::cerr << e.what() << std::endl; + return iobox_info_t(); + } + } + iobox_info_t parseIoboxResponse(const std::string& response) { + try{ + //exp: {"response": { "Model":"ANS IOBOX","Serial":"IO123","HwVer":"11", "FwVer":"22","macAddr":"a2c3d4e5f6","localIp":"192.168.110.121"}} + iobox_info_t info; + cJSON* root = cJSON_Parse(response.c_str()); + if (root == nullptr) { + std::cerr << "Failed to parse JSON" << std::endl; + return info; + } + cJSON* responseObj = cJSON_GetObjectItem(root, "response"); + if (responseObj == nullptr) { + std::cerr << "Failed to get response object" << std::endl; + cJSON_Delete(root); + return info; + } + info = parseIoboxResponseObj(responseObj); + cJSON_Delete(root); + + std::cout << "Parsed IOBox Info:" << std::endl; + std::cout << " Model: " << info.model << std::endl; + std::cout << " Serial Number: " << info.serial_number << std::endl; + std::cout << " Hardware Version: " << info.hardware_version << std::endl; + std::cout << " Firmware Version: " << info.firmware_version << std::endl; + std::cout << " MAC Address: " << info.mac_address << std::endl; + std::cout << " IP Address: " << info.ip_address << std::endl; + std::cout << " Public IP Address: " << info.ip_public_address << std::endl; + return info; + } + catch (const std::exception& e) { + std::cerr << e.what() << std::endl; + return iobox_info_t(); + } + } + void show_info_iobox(iobox_info_t iobox_info) { + std::cout << " IP Address: " << iobox_info.ip_address << std::endl; + } + void iobox_api::show_profile_iobox(std::string remote) { + try { + std::string ip = checkIpFromRemote(remote); + if (ip == "") { + std::cerr << "Failed to get ip from remote: " << remote << std::endl; + return; + } + iobox_profile_t* profile = findProfileByIp(ip); + if (profile == nullptr) { + std::cerr << "IP address not found: " << ip << std::endl; + return; + } + show_profile_iobox(*profile); + } + catch (const std::exception& e) { + std::cerr << e.what() << std::endl; + } + } + void iobox_api::show_profile_iobox(iobox_profile_t profile) { + try { + // 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 << " Is connected: " << profile.is_connected << std::endl; + std::cout << " Is anthenticated: " << profile.is_anthenticated << std::endl; + std::cout << " TCP Socket: " << profile.sock_tcp << std::endl; + std::cout << " Counting get: " << profile.counting_get << std::endl; + std::cout << " Model: " << profile.iobox_info.model << std::endl; + std::cout << " Serial Number: " << profile.iobox_info.serial_number << std::endl; + std::cout << " Hardware Version: " << profile.iobox_info.hardware_version << std::endl; + std::cout << " Firmware Version: " << profile.iobox_info.firmware_version << std::endl; + std::cout << " MAC Address: " << profile.iobox_info.mac_address << std::endl; + std::cout << " IP Address: " << profile.iobox_info.ip_address << std::endl; + std::cout << " Public IP Address: " << profile.iobox_info.ip_public_address << std::endl; + } + catch (const std::exception& e) { + std::cerr << e.what() << std::endl; + } + } + void iobox_api::show_profile_ioboxs() { + try { + 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); + } + } + catch (const std::exception& e) { + std::cerr << e.what() << std::endl; + } + } + void iobox_api::save_info_iobox(iobox_info_t iobox_info) { + try { + iobox_profile_t profile; + profile.counting_get = 0; + profile.is_connected = false; + profile.is_anthenticated = false; + profile.sock_tcp = INVALID_SOCKET; + profile.iobox_info = iobox_info; + this->iobox_profiles.push_back(profile); + std::cout << "Save iobox, num device current: " << this->iobox_profiles.size() << std::endl; + } + catch (const std::exception& e) { + std::cerr << e.what() << std::endl; + } + } + void iobox_api::remove_last_info_iobox() { + try { + if (this->iobox_profiles.size() == 0) { + std::cout << "No iobox profiles" << std::endl; + return; + } + this->iobox_profiles.pop_back(); + std::cout << "Remove last iobox, num device current: " << this->iobox_profiles.size() << std::endl; + } + catch (const std::exception& e) { + std::cerr << e.what() << std::endl; + } + } + bool iobox_api::sendTcpMessage(const std::string& ip, const char* buffer, size_t length, bool needCheckAuthen) { + try { + for (auto& profile : this->iobox_profiles) { + if ((profile.iobox_info.ip_address == ip || profile.iobox_info.ip_public_address == ip) && profile.is_connected && profile.sock_tcp != INVALID_SOCKET) { + if (needCheckAuthen && !profile.is_anthenticated) { + std::cerr << "Please anthenticate before send message" << std::endl; + return false; + } + 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; + std::cout << "Message: " << buffer << std::endl; + // printBufferAsHex(buffer, length); + return true; + } + } + std::cerr << "IP address not found or not connected: " << ip << std::endl; + return false; + } + catch (const std::exception& e) { + std::cerr << e.what() << std::endl; + return false; + } + } + + bool iobox_api::receiveTcpMessage(const std::string& ip, char* buffer, size_t& length) { + try { + for (auto& profile : this->iobox_profiles) { + if ((profile.iobox_info.ip_address == ip || profile.iobox_info.ip_public_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; + buffer[length] = '\0'; + std::cout << "Received message: " << length << " bytes" << std::endl; + std::cout << "Message: " << buffer << 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; + } + catch (const std::exception& e) { + std::cerr << e.what() << std::endl; + return false; + } + } + + void iobox_api::sendMulticastMessage(const std::string& message) { + try { + 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); + } + catch (const std::exception& e) { + std::cerr << e.what() << std::endl; + } + } + void iobox_api::setSocketTimeout(SOCKET sock, int timeout) { + try + { + 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; + } + } + catch (const std::exception& e) { + std::cerr << e.what() << std::endl; + } + } + std::string createAliasName(const std::string& serial, const std::string& hwVer, const std::string& fwVer, uint16_t index) { + return "SN" + serial + "H" + hwVer + "F" + fwVer + "I" + std::to_string(index); + } + std::string createMulticastAlias(const std::string& aliasName, const std::string& model, const std::string& serial, const std::string& ip) + { + //exp: Alias-Model-SN-IP + return aliasName + "-" + model + "-" + serial + "-" + ip; + } + + uint16_t iobox_api::getIndexIoboxFromIp(const std::string& ip) { + try { + for (const auto& profile : this->iobox_profiles) { + if (profile.iobox_info.ip_address == ip || profile.iobox_info.ip_public_address == ip) { + return &profile - &this->iobox_profiles[0] + 1; + } + } + return -1; + } + catch (const std::exception& e) { + std::cerr << e.what() << std::endl; + return -1; + } + } + std::vector iobox_api::scanNetworkDevicesMulticast(int timeout) { + std::lock_guard lock(_mutex); + try { + std::vector 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 << "(public: " << item.iobox_info.ip_public_address << ") " << "befor new scan" << std::endl; + if (!item.iobox_info.ip_public_address.empty()) + { + disconnectToIobox(item.iobox_info.ip_public_address); + } + else + { + disconnectToIobox(item.iobox_info.ip_address); + } + } + } + //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 = "{\"request\":\"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 aliasName = createAliasName(info.serial_number, info.hardware_version, info.firmware_version, devices.size() + 1); + std::string multicastAlias = createMulticastAlias(aliasName, info.model, info.serial_number, info.ip_address); + std::cout << "multicast alias: " << multicastAlias << std::endl; + devices.push_back(multicastAlias); + 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; + } + catch (const std::exception& e) { + std::cerr << e.what() << std::endl; + return std::vector(); + } + } + + bool parseResponeCommon(const std::string& response, const std::string& action, std::string& getResult, std::string& getReason, iobox_info_t& iobox_info) { + try { + cJSON* root = cJSON_Parse(response.c_str()); + if (root == nullptr) { + std::cerr << "Failed to parse JSON" << std::endl; + return false; + } + cJSON* responseObj = cJSON_GetObjectItem(root, "response"); + if (responseObj == nullptr) { + std::cerr << "Failed to get response object" << std::endl; + cJSON_Delete(root); + return false; + } + cJSON* actionResponse = cJSON_GetObjectItem(responseObj, "action"); + if (actionResponse == nullptr || strcmp(actionResponse->valuestring, action.c_str()) != 0) { + std::cerr << "Action mismatch or not found" << std::endl; + cJSON_Delete(root); + return false; + } + cJSON* resultResponse = cJSON_GetObjectItem(responseObj, "result"); + if (resultResponse == nullptr) { + std::cerr << "Failed to get result" << std::endl; + cJSON_Delete(root); + return false; + } + if (resultResponse->type == cJSON_Array) { + char* result = cJSON_PrintUnformatted(resultResponse); + std::cout << "Result: " << result << std::endl; + std::string resultStr(result); + cJSON_free(result); + getResult = resultStr; + } + else if (resultResponse->type == cJSON_String) { + getResult = resultResponse->valuestring; + } + if (cJSON_HasObjectItem(responseObj, "info")) + { + cJSON* infoResponse = cJSON_GetObjectItem(responseObj, "info"); + if (infoResponse == nullptr) { + std::cerr << "Failed to get info" << std::endl; + cJSON_Delete(root); + return false; + } + iobox_info = parseIoboxResponseObj(infoResponse); + } + cJSON* reasonResponse = cJSON_GetObjectItem(responseObj, "reason"); + if (reasonResponse == nullptr) { + // std::cerr << "Failed to get reason" << std::endl; + cJSON_Delete(root); + return true; + } + getReason = reasonResponse->valuestring; + + cJSON_Delete(root); + return true; + } + catch (const std::exception& e) { + std::cerr << e.what() << std::endl; + return false; + } + } + + std::string iobox_api::connectToIobox(const std::string& remote, 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; + std::string aliasConnect = ""; + bool is_onlyAuthen = false; + std::lock_guard lock(this->_mutex); + std::string ip = checkIpFromRemote(remote); + if (ip == "") { + std::cerr << "Failed to get ip from remote: " << remote << std::endl; + return aliasConnect; + } + std::cout << "IP address: " << ip << std::endl; + try { + for (auto& profile : this->iobox_profiles) { + if (profile.iobox_info.ip_address == ip || profile.iobox_info.ip_public_address == ip) { + is_exist = true; + item = &profile; + if (item->is_connected && item->is_anthenticated) { + std::cout << "Ip is already connected and anthenticated: " << ip << std::endl; + uint16_t idx = getIndexIoboxFromIp(ip); + std::string aliasName = createAliasName(item->iobox_info.serial_number, item->iobox_info.hardware_version, item->iobox_info.firmware_version, idx); + aliasConnect = createMulticastAlias(aliasName, item->iobox_info.model, item->iobox_info.serial_number, item->iobox_info.ip_public_address == "" ? item->iobox_info.ip_address : item->iobox_info.ip_public_address); + return aliasConnect; + } + else if (item->is_connected && !item->is_anthenticated) { + std::cout << "Ip is already connected but not anthenticated: " << ip << std::endl; + // std::cout << "Please disconnect before reconnect" << std::endl; + // return aliasConnect; + is_onlyAuthen = true; + } + break; + } + } + if (is_exist == false) { + std::cout << "Ip is not exist in list scan, now retry connect to this ip and append it to profile: " << 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 = 3000; + 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; + // } + if (is_onlyAuthen == false) + { + sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); + if (sock == INVALID_SOCKET) { + std::cerr << "socket failed with error: " << WSAGetLastError() << std::endl; + // WSACleanup(); + return aliasConnect; + } + + 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 aliasConnect; + } + } + else { + sock = item->sock_tcp; + } + + setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (const char*)&tv, sizeof(tv)); + + std::string action = "auth"; + //{"request":{"action":"auth","username":"","password":""}} + std::string authMessage = "{\"request\":{\"action\":\"" + action + "\",\"username\":\"" + username + "\",\"password\":\"" + password + "\"}}"; + + int sendLen = send(sock, authMessage.c_str(), authMessage.length(), 0); + if (sendLen == SOCKET_ERROR) { + std::cerr << "send failed with error: " << WSAGetLastError() << std::endl; + closesocket(sock); + // WSACleanup(); + return aliasConnect; + } + //{"response":{"action":"auth","result":"","reason":""}} + iobox_info_t info; + + recvLen = recv(sock, recvBuf, sizeof(recvBuf) - 1, 0); + if (recvLen > 0) { + recvBuf[recvLen] = '\0'; + std::cout << "Received message: " << recvBuf << std::endl; + + std::string response(recvBuf); + std::string result; + std::string reason; + if (parseResponeCommon(response, action, result, reason, info)) { + std::cout << "Parse response success" << std::endl; + if (result == "success") { + std::cout << "Authentication success" << std::endl; + } + else { + std::cerr << "Authentication failed" << std::endl; + std::cerr << "Reason: " << reason << std::endl; + closesocket(sock); + // WSACleanup(); + return aliasConnect; + } + } + else { + std::cerr << "Parse response failed" << std::endl; + closesocket(sock); + // WSACleanup(); + return aliasConnect; + } + } + else { + std::cerr << "recv failed with error: " << WSAGetLastError() << std::endl; + closesocket(sock); + // WSACleanup(); + return aliasConnect; + } + + // closesocket(sock); + // WSACleanup(); + if (item == nullptr) { + if (info.ip_address == "") { + std::cerr << "Failed to get info from response" << std::endl; + closesocket(sock); + return aliasConnect; + } + if (info.ip_address != ip) { + info.ip_public_address = ip; + } + save_info_iobox(info); + for (auto& profile : this->iobox_profiles) { + if (profile.iobox_info.ip_address == ip || profile.iobox_info.ip_public_address == ip) { + item = &profile; + break; + } + } + } + if (item == nullptr) return aliasConnect; + uint16_t idx = getIndexIoboxFromIp(ip); + std::string aliasName = createAliasName(item->iobox_info.serial_number, item->iobox_info.hardware_version, item->iobox_info.firmware_version, idx); + aliasConnect = createMulticastAlias(aliasName, item->iobox_info.model, item->iobox_info.serial_number, item->iobox_info.ip_public_address == "" ? item->iobox_info.ip_address : item->iobox_info.ip_public_address); + std::cout << "alias: " << aliasConnect << std::endl; + item->sock_tcp = sock; + item->is_connected = true; + item->is_anthenticated = true; + return aliasConnect; + } + catch (const std::exception& e) { + std::cerr << e.what() << std::endl; + return aliasConnect; + } + } + + + bool iobox_api::connectToIoboxWithoutAuthen(const std::string& remote, int port) { + // check ip is already in iobox_profiles + bool is_exist = false; + iobox_profile_t* item = nullptr; + + std::lock_guard lock(this->_mutex); + std::string ip = checkIpFromRemote(remote); + if (ip == "") { + std::cerr << "Failed to get ip from remote: " << remote << std::endl; + return false; + } + try { + for (auto& profile : this->iobox_profiles) { + if (profile.iobox_info.ip_address == ip || profile.iobox_info.ip_public_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 = 3000; + 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; + } + + // closesocket(sock); + // WSACleanup(); + item->sock_tcp = sock; + item->is_connected = true; + item->is_anthenticated = false; + return true; + } + catch (const std::exception& e) { + std::cerr << e.what() << std::endl; + return false; + } + } + + + bool iobox_api::disconnectToIobox(const std::string& remote) { + std::lock_guard lock(this->_mutex); + std::string ip = checkIpFromRemote(remote); + if (ip == "") { + std::cerr << "Failed to get ip from remote: " << remote << std::endl; + return false; + } + try { + // 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 || profile.iobox_info.ip_public_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; + item->is_anthenticated = false; + closesocket(item->sock_tcp); + item->sock_tcp = INVALID_SOCKET; + // WSACleanup(); + std::cout << "Disconnected" << std::endl; + return true; + } + catch (const std::exception& e) { + std::cerr << e.what() << std::endl; + return false; + } + } + + bool iobox_api::setAuthenticationIobox(const std::string& remote, const std::string& username, const std::string& password) { + std::lock_guard lock(this->_mutex); + std::string ip = checkIpFromRemote(remote); + if (ip == "") { + std::cerr << "Failed to get ip from remote: " << remote << std::endl; + return false; + } + try { + iobox_profile_t* profile = findProfileByIp(ip); + if (profile == nullptr) { + std::cerr << "IP address not found: " << ip << std::endl; + return false; + } + + std::string action = "change_auth"; + //{"request": {"action":"change_auth","username":"","password":""}} + std::string authMessage = "{\"request\":{\"action\":\"" + action + "\",\"username\":\"" + username + "\",\"password\":\"" + password + "\"}}"; + if (!sendTcpMessage(ip, authMessage.c_str(), authMessage.length(), true)) { + return false; + } + + //{"response":{"action":"change_auth","result":"","reason":""}} + char revBuf[256]; + size_t responseLength = sizeof(revBuf); + if (!receiveTcpMessage(ip, revBuf, responseLength)) { + return false; + } + revBuf[responseLength] = '\0'; + std::string response(revBuf); + std::string result; + std::string reason; + iobox_info_t info; + if (parseResponeCommon(response, action, result, reason, info)) { + std::cout << "Parse response success" << std::endl; + if (result == "success") { + std::cout << "Change auth success" << std::endl; + } + else { + std::cerr << "Change auth failed" << std::endl; + std::cerr << "Reason: " << reason << std::endl; + return false; + } + } + else { + std::cerr << "Parse response failed" << std::endl; + return false; + } + + return true; + } + catch (const std::exception& e) { + std::cerr << e.what() << std::endl; + return false; + } + + } + std::string iobox_api::generateToken(const std::string& remote) + { + std::lock_guard lock(_mutex); + try { + std::string ip = checkIpFromRemote(remote); + if (ip == "") { + std::cerr << "Failed to get ip from remote: " << remote << std::endl; + return ""; + } + iobox_profile_t* profile = findProfileByIp(ip); + if (profile == nullptr) { + std::cerr << "IP address not found: " << ip << std::endl; + return ""; + } + //may be change this later + return profile->iobox_info.serial_number + profile->iobox_info.model; + } + catch (const std::exception& e) { + std::cerr << e.what() << std::endl; + return ""; + } + + } + bool iobox_api::resetAuthenticationIobox(const std::string& remote, const std::string& token) + { + std::lock_guard lock(this->_mutex); + std::string ip = checkIpFromRemote(remote); + if (ip == "") { + std::cerr << "Failed to get ip from remote: " << remote << std::endl; + return false; + } + try { + bool needRemove = false; + iobox_profile_t* profile = findProfileByIp(ip); + if (profile == nullptr) { + std::cerr << "IP address not found: " << ip << std::endl; + // return false; + // need temporary save iobox_info + iobox_info_t info; + info.ip_address = ip; + save_info_iobox(info); + profile = findProfileByIp(ip); + needRemove = true; + } + if (connectToIoboxWithoutAuthen(ip, DEVICE_TCP_PORT) == false) { + if (needRemove) remove_last_info_iobox(); + return false; + } + //{"request": {"action":"factory_reset","token":""}} + std::string action = "factory_reset"; + std::string resetMessage = "{\"request\":{\"action\":\"" + action + "\",\"token\":\"" + token + "\"}}"; + if (!sendTcpMessage(ip, resetMessage.c_str(), resetMessage.length(), false)) { + if (profile->is_anthenticated == false) + { + disconnectToIobox(ip); + if (needRemove) remove_last_info_iobox(); + } + return false; + } + char revBuf[256]; + size_t responseLength = sizeof(revBuf); + if (!receiveTcpMessage(ip, revBuf, responseLength)) { + if (profile->is_anthenticated == false) + { + disconnectToIobox(ip); + if (needRemove) remove_last_info_iobox(); + } + return false; + } + revBuf[responseLength] = '\0'; + std::string response(revBuf); + std::string result; + std::string reason; + iobox_info_t info; + if (parseResponeCommon(response, action, result, reason, info)) { + std::cout << "Parse response success" << std::endl; + if (result == "success") { + std::cout << "Factory reset success" << std::endl; + if (profile->is_anthenticated == false) + { + disconnectToIobox(ip); + if (needRemove) remove_last_info_iobox(); + } + return true; + } + else { + std::cerr << "Factory reset failed" << std::endl; + std::cerr << "Reason: " << reason << std::endl; + if (profile->is_anthenticated == false) + { + disconnectToIobox(ip); + if (needRemove) remove_last_info_iobox(); + } + return false; + } + } + else { + std::cerr << "Parse response failed" << std::endl; + if (profile->is_anthenticated == false) + { + disconnectToIobox(ip); + if (needRemove) remove_last_info_iobox(); + } + return false; + } + } + catch (const std::exception& e) { + std::cerr << e.what() << std::endl; + return false; + } + + } + + + bool iobox_api::resetIobox(const std::string& remote, const std::string& token) + { + std::lock_guard lock(this->_mutex); + std::string ip = checkIpFromRemote(remote); + if (ip == "") { + std::cerr << "Failed to get ip from remote: " << remote << std::endl; + return false; + } + try { + bool needRemove = false; + iobox_profile_t* profile = findProfileByIp(ip); + if (profile == nullptr) { + std::cerr << "IP address not found: " << ip << std::endl; + // return false; + // need temporary save iobox_info + iobox_info_t info; + info.ip_address = ip; + save_info_iobox(info); + profile = findProfileByIp(ip); + needRemove = true; + } + if (connectToIoboxWithoutAuthen(ip, DEVICE_TCP_PORT) == false) { + if (needRemove) remove_last_info_iobox(); + return false; + } + //{"request": {"action":"restart","token":""}} + std::string action = "restart"; + std::string resetMessage = "{\"request\":{\"action\":\"" + action + "\",\"token\":\"" + token + "\"}}"; + if (!sendTcpMessage(ip, resetMessage.c_str(), resetMessage.length(), false)) { + if (profile->is_anthenticated == false) + { + disconnectToIobox(ip); + if (needRemove) remove_last_info_iobox(); + } + return false; + } + char revBuf[256]; + size_t responseLength = sizeof(revBuf); + if (!receiveTcpMessage(ip, revBuf, responseLength)) { + if (profile->is_anthenticated == false) + { + disconnectToIobox(ip); + if (needRemove) remove_last_info_iobox(); + } + return false; + } + revBuf[responseLength] = '\0'; + std::string response(revBuf); + std::string result; + std::string reason; + iobox_info_t info; + if (parseResponeCommon(response, action, result, reason, info)) { + std::cout << "Parse response success" << std::endl; + if (result == "success") { + std::cout << "Restart success" << std::endl; + } + else { + std::cerr << "Restart failed" << std::endl; + std::cerr << "Reason: " << reason << std::endl; + if (profile->is_anthenticated == false) + { + disconnectToIobox(ip); + if (needRemove) remove_last_info_iobox(); + } + return false; + } + } + else { + std::cerr << "Parse response failed" << std::endl; + if (profile->is_anthenticated == false) + { + disconnectToIobox(ip); + if (needRemove) remove_last_info_iobox(); + } + return false; + } + disconnectToIobox(ip); + if (needRemove) remove_last_info_iobox(); + + return true; + } + catch (const std::exception& e) { + std::cerr << e.what() << std::endl; + return false; + } + } + + iobox_profile_t* iobox_api::findProfileByIp(const std::string& ip) { + std::lock_guard lock(_mutex); + try { + iobox_profile_t* profile = nullptr; + for (auto& item : this->iobox_profiles) { + if (item.iobox_info.ip_address == ip || item.iobox_info.ip_public_address == ip) { + profile = &item; + } + } + return profile; + } + catch (const std::exception& e) { + std::cerr << e.what() << std::endl; + return nullptr; + } + } + + std::string iobox_api::getValueDataStringIoboxFromChannelName(const std::string& remote, const std::string& channelName) { + std::lock_guard lock(this->_mutex); + std::string ip = checkIpFromRemote(remote); + if (ip == "") { + std::cerr << "Failed to get ip from remote: " << remote << std::endl; + return ""; + } + try { + iobox_profile_t* profile = findProfileByIp(ip); + if (profile == nullptr) { + std::cerr << "IP address not found: " << ip << std::endl; + return ""; + } + //{"request": {"action":"getValue","channel":""}} + std::string action = "getValue"; + std::string getValueMessage = "{\"request\":{\"action\":\"" + action + "\",\"channel\":\"" + channelName + "\"}}"; + if (!sendTcpMessage(ip, getValueMessage.c_str(), getValueMessage.length(), true)) { + return ""; + } + char revBuf[256]; + size_t responseLength = sizeof(revBuf); + if (!receiveTcpMessage(ip, revBuf, responseLength)) { + return ""; + } + revBuf[responseLength] = '\0'; + std::string response(revBuf); + std::string result; + std::string reason; + iobox_info_t info; + if (parseResponeCommon(response, action, result, reason, info)) { + std::cout << "Parse response success" << std::endl; + return result; + } + else { + std::cerr << "Parse response failed" << std::endl; + return ""; + } + } + catch (const std::exception& e) { + std::cerr << e.what() << std::endl; + return ""; + } + + } + bool iobox_api::setValueDataStringIoboxFromChannelName(const std::string& remote, const std::string& channelName, const std::string& value) { + std::lock_guard lock(this->_mutex); + std::string ip = checkIpFromRemote(remote); + if (ip == "") { + std::cerr << "Failed to get ip from remote: " << remote << std::endl; + return false; + } + try { + iobox_profile_t* profile = findProfileByIp(ip); + if (profile == nullptr) { + std::cerr << "IP address not found: " << ip << std::endl; + return false; + } + + //not check valid channel name here + + //{"request": {"action":"setValue", "channel":"","value":""}} + std::string action = "setValue"; + std::string setValueMessage = "{\"request\":{\"action\":\"" + action + "\",\"channel\":\"" + channelName + "\",\"value\":\"" + value + "\"}}"; + if (!sendTcpMessage(ip, setValueMessage.c_str(), setValueMessage.length(), true)) { + return false; + } + char revBuf[256]; + size_t responseLength = sizeof(revBuf); + if (!receiveTcpMessage(ip, revBuf, responseLength)) { + return false; + } + revBuf[responseLength] = '\0'; + std::string response(revBuf); + std::string result; + std::string reason; + iobox_info_t info; + if (parseResponeCommon(response, action, result, reason, info)) { + std::cout << "Parse response success" << std::endl; + if (result == "success") { + std::cout << "Set value success" << std::endl; + } + else { + std::cerr << "Set value failed" << std::endl; + std::cerr << "Reason: " << reason << std::endl; + return false; + } + } + else { + std::cerr << "Parse response failed" << std::endl; + return false; + } + + return true; + } + catch (const std::exception& e) { + std::cerr << e.what() << std::endl; + return false; + } + } + + std::vector iobox_api::getDeviceChannelNames(const std::string& remote) + { + bool needRemove = false; + std::vector channelNames; + std::lock_guard lock(this->_mutex); + std::string ip = checkIpFromRemote(remote); + if (ip == "") { + std::cerr << "Failed to get ip from remote: " << remote << std::endl; + return channelNames; + } + try { + iobox_profile_t* profile = findProfileByIp(ip); + if (profile == nullptr) { + std::cerr << "IP address not found: " << ip << std::endl; + // return channelNames; + // need temporary save iobox_info + iobox_info_t info; + info.ip_address = ip; + save_info_iobox(info); + profile = findProfileByIp(ip); + needRemove = true; + } + if (connectToIoboxWithoutAuthen(ip, DEVICE_TCP_PORT) == false) { + if (needRemove) remove_last_info_iobox(); + return channelNames; + } + //{"request": {"action":"channelList"}} + std::string action = "channelList"; + std::string channelListMessage = "{\"request\":{\"action\":\"" + action + "\"}}"; + if (!sendTcpMessage(ip, channelListMessage.c_str(), channelListMessage.length(), false)) { + disconnectToIobox(ip); + if (needRemove) remove_last_info_iobox(); + return channelNames; + } + char revBuf[1024]; + size_t responseLength = sizeof(revBuf); + if (!receiveTcpMessage(ip, revBuf, responseLength)) { + disconnectToIobox(ip); + if (needRemove) remove_last_info_iobox(); + return channelNames; + } + revBuf[responseLength] = '\0'; + std::string response(revBuf); + std::string result; + std::string reason; + iobox_info_t info; + if (parseResponeCommon(response, action, result, reason, info)) { + std::cout << "Parse response success" << std::endl; + + cJSON* root = cJSON_Parse(result.c_str()); + if (root == nullptr) { + std::cerr << "Failed to parse JSON" << std::endl; + disconnectToIobox(ip); + if (needRemove) remove_last_info_iobox(); + return channelNames; + } + if (root->type != cJSON_Array) { + std::cerr << "Failed to get array" << std::endl; + cJSON_Delete(root); + disconnectToIobox(ip); + if (needRemove) remove_last_info_iobox(); + return channelNames; + } + cJSON* channelList = root; + if (info.ip_address != ip) + { + info.ip_public_address = ip; + } + profile->iobox_info = info; + int arraySize = cJSON_GetArraySize(channelList); + for (int i = 0; i < arraySize; ++i) { + cJSON* channel = cJSON_GetArrayItem(channelList, i); + if (channel != nullptr && channel->type == cJSON_String) { + uint16_t idx = getIndexIoboxFromIp(ip); + std::string aliasName = createAliasName(info.serial_number, info.hardware_version, info.firmware_version, idx); + std::string multicastAlias = createMulticastAlias(aliasName, info.model, info.serial_number, info.ip_public_address == "" ? info.ip_address : info.ip_public_address); + std::string channelName = multicastAlias + "-" + channel->valuestring; + + channelNames.push_back(channelName); + } + } + cJSON_Delete(root); + + // disconnectToIobox(ip); + //not need remove + return channelNames; + } + else { + std::cerr << "Parse response failed" << std::endl; + disconnectToIobox(ip); + if (needRemove) remove_last_info_iobox(); + return channelNames; + } + } + catch (const std::exception& e) { + std::cerr << e.what() << std::endl; + return channelNames; + } + } + bool iobox_api::openRS232(const std::string& ip, const std::string& port, int baudrate, int databits, int stopbits, int parity) { + return false; + } + bool iobox_api::closeRS232(const std::string& ip) { return false; } + bool iobox_api::writeRS232(const std::string& ip, std::string dataToSend, int timeout) { return false; } + bool iobox_api::readRS232(const std::string& ip, std::string& receivedData, const std::string& terminateString, int timeout) { return false; } + bool iobox_api::readRS232Bytes(const std::string& ip, std::string& receivedData, int numBytes, int timeout) { return false; } + + +} \ No newline at end of file diff --git a/IOBox/Backup/v1.1.0/iobox_api.h b/IOBox/Backup/v1.1.0/iobox_api.h new file mode 100644 index 0000000..c4d01ee --- /dev/null +++ b/IOBox/Backup/v1.1.0/iobox_api.h @@ -0,0 +1,101 @@ +#ifndef _IO_BOX_API_H_ +#define _IO_BOX_API_H_ +#define ANSIO_API __declspec(dllexport) +#include "extcode.h" +#include +#include +#include +#include +#include +#include +#include +#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 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_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 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 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 + + diff --git a/IOBox/Backup/v1.1.0/main.cpp b/IOBox/Backup/v1.1.0/main.cpp new file mode 100644 index 0000000..9f16cce --- /dev/null +++ b/IOBox/Backup/v1.1.0/main.cpp @@ -0,0 +1,111 @@ + +#include "iobox_api.h" +#include + +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 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 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; +} diff --git a/IOBox/Backup/v1.1.0/readme.md b/IOBox/Backup/v1.1.0/readme.md new file mode 100644 index 0000000..9fa54bc --- /dev/null +++ b/IOBox/Backup/v1.1.0/readme.md @@ -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 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 + + + + diff --git a/IOBox/banve.pdf b/IOBox/banve.pdf new file mode 100644 index 0000000..dbbc378 --- /dev/null +++ b/IOBox/banve.pdf @@ -0,0 +1,2590 @@ +%PDF-1.6 %âãÏÓ +1 0 obj <>/OCGs[6 0 R]>>/Pages 3 0 R/Type/Catalog>> endobj 2 0 obj <>stream + + + + + application/pdf + + + banve + + + 2024-11-29T16:15:02+07:00 + 2024-11-29T16:15:02+07:00 + 2024-11-29T16:15:02+08:00 + Adobe Illustrator 27.5 (Windows) + + + + 156 + 256 + JPEG + /9j/4AAQSkZJRgABAgEASABIAAD/7QAsUGhvdG9zaG9wIDMuMAA4QklNA+0AAAAAABAASAAAAAEA AQBIAAAAAQAB/+4ADkFkb2JlAGTAAAAAAf/bAIQABgQEBAUEBgUFBgkGBQYJCwgGBggLDAoKCwoK DBAMDAwMDAwQDA4PEA8ODBMTFBQTExwbGxscHx8fHx8fHx8fHwEHBwcNDA0YEBAYGhURFRofHx8f Hx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8f/8AAEQgBAACcAwER AAIRAQMRAf/EAaIAAAAHAQEBAQEAAAAAAAAAAAQFAwIGAQAHCAkKCwEAAgIDAQEBAQEAAAAAAAAA AQACAwQFBgcICQoLEAACAQMDAgQCBgcDBAIGAnMBAgMRBAAFIRIxQVEGE2EicYEUMpGhBxWxQiPB UtHhMxZi8CRygvElQzRTkqKyY3PCNUQnk6OzNhdUZHTD0uIIJoMJChgZhJRFRqS0VtNVKBry4/PE 1OT0ZXWFlaW1xdXl9WZ2hpamtsbW5vY3R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo+Ck5SVlpeYmZ qbnJ2en5KjpKWmp6ipqqusra6voRAAICAQIDBQUEBQYECAMDbQEAAhEDBCESMUEFURNhIgZxgZEy obHwFMHR4SNCFVJicvEzJDRDghaSUyWiY7LCB3PSNeJEgxdUkwgJChgZJjZFGidkdFU38qOzwygp 0+PzhJSktMTU5PRldYWVpbXF1eX1RlZmdoaWprbG1ub2R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo +DlJWWl5iZmpucnZ6fkqOkpaanqKmqq6ytrq+v/aAAwDAQACEQMRAD8A9U4qldhYRTxSyyy3Bc3F wNridQAs7gAAOAAAKADMnJkIIAA5DoO4eThYcIkCSZfVL+KX84+aI/RNr/Pcf9JNx/1UyvxpeX+l j+pt/LR75f6aX63fom1/nuP+km4/6qY+NLy/0sf1L+Wj3y/00v1pfoeg6fBazekZ053Vyz0ubgVb 13Wp/edaKMv1GokZC6+mP8I7h5OLo9FjjE1xbyl/FL+cfNfrmj2b6LfqzTlTby1BuZyD8B6gvQ4N PnkMkeXMfwj9TLWaWBwzB4vpP8Uu73oqHRLCGFIYjcJFEoSNBc3FAqigH954ZVLUSJs1f9WP6m6G jhECI4qH9KX60Fqug6dPc6YJfXcJdc1rc3BoyQyspHx7EEZdh1EwJVX09w7x5OPqdFjlLHfEanf1 S/my80w/RNr/AD3H/STcf9VMo8aXl/pY/qcr8tHvl/ppfrWafH6N5eRK8jRqYyokkeSlV3oXLEYc puMT7+lIwx4ZSFmtuZJ+9j35r3slh5NuL2O7u7NoJIyJLKT0XJdvTAdgrtwq9Tx3ykOSxnzFPewa 75T9HVLqJNQ0u49bTfWpBILezY8vT9RPirKCTwfoOnXJaPnD/NR2kdsv+d+l6tkUuxV2KuxV2Kux V2KuxV2KoPSf95X/AOYi5/6iJMtzfV8I/wC5Dj6b6T/Wl/uijMqchI/MWqahBPb2ljHKRIrTX1zA iyywwKQvKOJvtuzNts2wPwsaDFUpXWltB9Y0W+l1mzgLz6qrCIwxRkmSZhKiRlZxUsIt/AqoIYSk SebGMREUPxe6I1bVJZ7+6hvpJbHy7D/o8l7CEKvLxBl+sSMGaGIBwoYKBUNycCgLEkGxzWcRIEHk V2na5PFeoRLNe6Fc81ttQnCBjKkbzfuuCoZYDHE1JGHWnEurVUMkEdThZYbjzQ1zZ3d0yvpcVtLK ISZAeEMDW/Bnn4tRlk3J5cPgrQgkMTEGr6Kw1rzRFC2lmD1NVldHtXdovUW0kWV+UvECL11+rsgo PT5MlTTlgZKYuxIWj8v3N3N5iQr9chu2bgh6gXyMOEStT4fRUFhulVw2eTERANpb+a0dtq35f22r TSta2aeldSxGBbksl1GYfTZGlgSn7/4q1+WBkkXmKHT7XzT5Vup7yJZ9Q0l4bezeNTKTb2knxLJu 4r6/y2w6LnD/ADWPafLL/nfpexZFk7FXYq7FXYq7FXYq7FWI+c9VuIbqG0SxvNSjHogabYssb3Mt wZeCyyu8SxwxpbOz8nAYlQf5WVSWHzdZJqlpDpWgalpF+sn+5W0ntXt7WO3AHNpGTlayMxosbRuW 5U348hhRVPSMCUj8w6VqNxNBd2Esi8FaG9tonEUk1uxDcYpT/dyArsajYt8SmjKqlKaQmox+jo9h LolpKzwanLygVJY0dopo/RjabnK3Er6p4kfa5MBxJVEa3pjWd1d6hdRS6loRDXc+mo0YCTRoOTtG 5jWaMiPlxL7PU8WqCiqrp2hXEmqrcNA+n6Pb8ng0mRo5A1xIjRtJxT1EiQJIw4K5DE8qKR8SqDh0 l9KYWeo2J143fKzsbqRomb0QjSLBLHLwWNQkXxNHy5kcmFcVVW8o6obF5Yr5oNXWVZLRg7SxwxIr oLYSSKXZSk8n7xl5BmrSihcVUhYPc/6BpultpWp2dOWqtLG5iM3xM6uGkkuS1ORWZQH/AGt8VSP8 7oNH0/8ALOOyuJJ4oIZbWCzMU8kTck+FQ5jILjgp2IIrQ9qgKl2v6VqEvmryrfW+lyyWkOjTLe6s jTGNKWknpxuoAjG7Heu9d+2S0fOH+ax7T5Zf879L17IsnYq7FXYq7FXYq7FXYql2oaddPcpf6fKs N8i+m4kUtFNFXlwkClWBU14MPs1OxBIKqEt49Q1nhJfCK3sre4atpCzStJLazFVZ5WWOiCSPlxCV NBVqVUxhKxfv+w02ZcfAa8gfmAf0p5kmt2KpdoH+8Mv/ADGXv/UZLirvMv8Ayjmq/wDMHcf8mmxV McVS7Vf97tG/5jH/AOoO4xVMcVS2w/47Oqf88P8Ak2cVTLFUmX/lDR/2zv8AmRh0XOH+avan+V/z /wBKc4FdirsVdirsVdirsVdirsVS/Q/94pP+Yu8/6ipcqw8vjL7y5Oq+sf1Yf7iKYZa4zsVS7QP9 4Zf+Yy9/6jJcVd5l/wCUc1X/AJg7j/k02KpjiqXar/vdo3/MY/8A1B3GKpjiqW2H/HZ1T/nh/wAm ziqZYqky/wDKGj/tnf8AMjDoucP81e1P8r/n/pTnArsVdirsVdirsVdirsVdiqBGjWILlTOnN2kZ UuJ0Xk7F2IVXAFWJO2VeFHz+Zcj8zPy/0senwb/RFp/vy5/6Srn/AKqYfCHn8z+tH5iXdH/Sx/U7 9EWn+/Ln/pKuf+qmPhDz+Z/Wv5iXdH/Sx/Ul+haVatZSEvcV+t3g2ubgdLuUdnHhj4Q8/mf1r+Yl 3R/0sf1JUmg6dZ+TdXW2E0aJ+kyqC4nK/DLMBVS9D03r1yrBhiB15nqe9y9drMk53LhJ4Yfwx/mj yTHzToGnXHlvU4p/Xkj+rSsUa5uCKohZagydmAwZ8UeA8+XeV0GrnHPAjhB4h/DH9S/UtJtEvNIR XuOJumXe5uDQC0nO1ZNunbLhiHn8z+txDqZH+b/pY/qU7jy9pjeZ7C4b1zMlndBZDc3HID1INgfU /wAo5ScMfEHPkep8nMhrMg08o+muOP8ADHul5KllpVqdX1JS9xRfQpS5uAd0PUh6n6cu8IefzP63 D/MS7o/6WP6kdoXL6gys7ycLm6RWkdpG4pcyKoLOWY0AoN8GH6fifvLLV/X/AJsfL+EIZf8AlDR/ 2zv+ZGXaLnD/ADXG7U/yv+f+lOcCuxV2KuxV2KuxV2KuxV2KuxV2KuxVLtA/3hl/5jL3/qMlxVL7 j/lD9Z+Wqf8AJ6fKsPL4y+8uTqvqH9WH+4imPmH/AI4Gp/8AMJP/AMm2xz/RL3FdH/fQ/rR+9rVf 97tG/wCYx/8AqDuMtcZuf/jv2X/MJdf8nLfKj9Y9x/3rkx/uZf1o/dNbYf8AHZ1T/nh/ybOWuMu0 P/eKT/mLvP8AqKlyrDy+MvvLk6r6x/Vh/uIoZf8AlDR/2zv+ZGXaLnD/ADXG7U/yv+f+lOcCuxV2 KuxV2KuxV2KuxVhvlnRbrU9Egv7vWtSa4nMrSFJwi19VhsqoFUbdAKeGKVvmHQbi0GmiDW9UX6zf wQS/6T1RiSR9n/JxVBTXFnHdtGNV1RoFIHP61JyPIclK0hMXxr8SKZQzLuBiqK8x6PfWUGnyadq9 7NLc3sEIW4upPRdHqfiMXB6Gn7JxVC2Vn5ggAt4buxuC95cRTGK+vyIpG9W5ZZOMmzKBQg7+OKoa Sy1iTS5rePUdPeyvIbyY34vr0wKpkAerCThsZ+/hvkIRofE/e2ZcnGb8gPkAP0Im/h1qS3uLe4vr CC2mt4+N3JfXwiYXfqIgUvLxavDbxxnHiiR3rhycE4y7iD8m3sfMFxNYtLd2NvKt1OlvDJe34eV4 RLAwQNLU9S3w70ybWpSDXOEOoNdWQuVsJLpLE3196zQuEkLAGXlQenSo2yBj6gfL9TYMlQMe8g/K /wBaobLX4Ly8aO8sZ7gyW0Vxbx3t+ZIjKyxpzAl5CvOvxfRk2t1tb65FEqwXthcRSXU8cssd9fFY 5KSXDhystAVAoa79zkIRofE/e2ZcnGb8gPkAFI2+rppcMJ1DT/0fLZyMNQF9e+gI4uERPL1PToTJ 8sng9HD/AEa+xr1f73j6cV/artNrqTXEcs1uggJ/e/WNVaNgIBcEq6uV+wSaVrtiq/8A52P/AD/T mKtSSa/HG0kjBI0BZ3Y62AABUkk9AMVUXj1ibU4oJr6a3jWsbPZzXwDOLy3t3Ba55RtxEjfZ74qj dbt7bTJVgOr6m87KJCrXMlAh5CtIoZ3P2DX4OI7kbVVQqWbXWraMlvrWqLFdfWUuo/rNRVIklSh4 jswYGlaHsajFWRf4T/7XOqf9JP8Azbihjn+5b6x+h/0xe/VvV9X1ecfr0/Sn1b0/W4c+HDfrXtXj 8OKU28nXF3JoNnZ2ZjjkjjeWaaVS6hXnlVFVFZKk8GqeW3vXZVU166knXS0lUJcW+sW0U6qary4l wVPgVcH26Yq1L5I5XvqR3pis+SOLcKaholVInDB/7yNUUI9NuIry3qrap5vFpbWujIzLb20eo2yg 8vTVUUN0NRSgGKsFsfIGi6daPZv5ktbpr5PqbXCRxRqkUdvOsRnj9V0dV5qnEcFILV+J2Yqr18ka dDarYxeabdL2eWa+l1ONEEf1gi3jLPC0zD1H4NIG5ji4UqAqKoVWz+QtCkhtNNg16whg0+Bk4vEk tpKl1czzywLEZ1dVWqptKW9MsjEhziq8+RdEvUsefmO3jgs4WsJ4Z1ikklSC6maGdJPVjKSUlLrU MvPhJx5IpxVbP5S0ueVtdfXrYN9Uilj00KgnjnjsUt2CzCUGsnpKrBoyePJFKh35Kqv+CtFtr+8v 5PMkNybuRoYjCUhuY4Lq8jlcNMJXD+mecnLgCXPJq8VCqqMXkTSbWxntG8x2MtxqcsHq3UMEKQp9 UiuGiMtu00sbx/vFhMfwr6YCddyqvuPJGkm0tNNh8yWsU4nuL+TUFRGQzOkED1Vp2cSSoHkMgl5+ pV1pSgVZH5Y0/wAradpU+kT39rJbw3Rkh4yrBH+8gTksSK/wwrzaNU5EBfhJNMVZR+n9C/6uVr/y Oj/5qxQtl1vy7LG8Ut/ZyRSAq6NLEVZSKEEE0IIxVJdQu9FN9p1tp01sUSnGG3aOgLX1oxoqHvuc Uo/XvLLaldx3lvdGzu40EYnVSWVQWPwEMpUnma+I223xQlyaPBpOueXbWHj1vGcqvBSRbqgotWp8 KgdST1JJxSm7anffVJNUURfo+JWk9Eq3qvClayB+QVSVHJUKexIr8KhjP/TRf5/9XzFKa+T7BZvL NhNHNJbXCiVfWi48inrOeLB1dSK9Kjbt1OKqnmK1itotGjSprqtuzu27MzcizMfE4qyPFCTebJ4r fSlnfT4NSlFzaw21vckJGJbqdLVXL+nMV4ic7hCabd8VSS9j1SzETS+VtFKyMy/BdSuRwieU/Cun Fj8MZ2UE1xVC6Rf3Grw2s9h5X0d7e9iee3llmubfkkZQcuE+mRvRvVBU8aEYqg/M/mOPyynqav5a 0eOI8FRoprics0iTyBeMWmuw+G1ckkUHjilObW11e5iaRPK2hgLJJEQbx+sUjRk/8c/xXFCQ3Pmu C2vrXT5fLOk/X7yy/SEMCy3DL6RillUPMNNMKuy28nFS9TxPtilPrq11e2iWR/K2hkNJHEALx+ss ixg/8c/xbFCUaPr41i5ubew8r6U72d62m3Jme6twtwkJmYD19Mj5AKOq17diDiqbra6u15Lajyto fOKOOVm+uPQiRnUAf7j/APis4q6C11eaW4jXytoYNtIInJvH3JjSSo/3H+EgxVW/Retf9SvoX/SZ J/3j8Vd+i9a/6lfQv+kyT/vH4q3pyPH5htdP1Dy/plo8tvPeW11aS+uytayQIRR7W241+s1DBu2K sqxVIdY/5Sry9/0ef8mRiqPbR4WaRfWlFpKzPLZVX0mZyWap4+pRmNSoeh8KEjFWJf8ATRf5/wDV 8xSn3kX/AJRWx/56/wDJ58UF3mz/AKU3/bUtv+NsVT7FUj85f8ci3/7aelf91K3xV5Z5K8z3uveR tclu7pLt7O81C3Fw7XcqELps5YH1zPyRGJUGMfEo3QNWqlJvKXHRfyHd9Pv/AKslpBqjLf2zvEyK uoQc2R42X4uNfsSUY7cxXZVBfmMP0n+VnlIape+tNMNMupLy8MrO8scF/KOTSLzDE7Hq3ZQ/dVmP mXWb+1/NPybp8GqS28F5dX3q6fHLcqkoW8m5NLHERHToFLqwJ2PDqVUl8z2FrJ+bnlO+eSNbmDyw 8UURH7xlkstRLGtK0HD5DepUlQ6hkq6/cz/nVr2iG9llgtLfT5vqJlmaCLlcWRRlj/ulkcvJz78e JXq+KpD+TS6fperebbozxvEmvT3F16EchKcLe95fAFqdl2UDlX9kbVUvQ9O/MTytcaPe+czPJDoA tIWM8kT+pxju7m3r6SBpN3XYUr4gb4oYB5z85y3vm7yLd+XtRuo7TXNUeSK2jmntY7pFh088LiNE bmoUsKPQUJxVINK/Ojzn5jby241JLW3vr66tbw2MaJGyJ6ADP6qzS0DzNEvpOtaqa8hilB/ld+au ueXtD0vSI0tb+XVb29JqkyFFt44eIhULHG3JPjdmKVJLfExNVXrPkTzbqHmrVdI1a+s4rCV7LVY0 t4JhcIEWfTyp9UBeRNf5Vp0p3xQ9FxVIdY/5Sry9/wBHn/JkYqn2KsD/AOmi/wA/+r5ilPvIv/KK 2P8Az1/5PPigu82f9Kb/ALalt/xtiqfYqkvm+FJtHiievFr/AE2vFmRttQgOzKQw+g4qvi8p6HDx 9GKaLg5lX07m4T4ypQt8Mg34sRircnlbRpAFkSZ0VGjCG5uSvBypZePqUoSgxVyeVtGQgoky0CKo Fzc0AiJaOg9Sg4liRirQ8p6GJEl9KYyxszxyG5uCys7F2KsZKirMTirZ8q6MbcW5W4MKxG3VfrV1 tEwAKA+pWhCjFWn8p6G8zTtHMZ3Kl5vrNwHPpsrLVhJU0KL92Kqh8t6UXV/9IDq5lDC6uQeZQoW2 k3PE0xVbJ5Y0iQyGRZ39ZQkoa6uWDKpZgCDJTq5OKqa+TvL6OjrBKGjbnGfrFx8DBVSqfvPh+FFG 3hiq+DytotuoWCOWJVJZQlxcKATSpFJPYYq1/hPQqxn0ZKwljEfrE/wFjVuPx7VO5piqGGnW1r5w 01ojKT+jr9R6k0soA9ez6CRmp07YqyDFUh1j/lKvL3/R5/yZGKp9irA/+mi/z/6vmKU+8i/8orY/ 89f+Tz4oLvNn/Sm/7alt/wAbYqn2KpR5p/45kP8AzH6b/wBR8GKpvirsVdirsVdirsVdirsVdirs VdiqUXX/AClum/8AMBf/APJ6zxVN8VSHWP8AlKvL3/R5/wAmRiqfYqwP/pov8/8Aq+YpT7yL/wAo rY/89f8Ak8+KC7zZ/wBKb/tqW3/G2Kp9iqUeaf8AjmQ/8x+m/wDUfBiqb4q7FXYq7FXYq7FXYq7F XYq7FXYqlF1/ylum/wDMBf8A/J6zxVN8VSHWP+Uq8vf9Hn/JkYqn2KsD/wCmi/z/AOr5ilPvIv8A yitj/wA9f+Tz4oLvNn/Sm/7alt/xtiqfYqlHmn/jmQ/8x+m/9R8GKpvirsVdirsVeda/+Z2o6f53 uNBgtY2soxZW8d1JHMa3s1zbevCZAVjJFnerIijcFSW2oMVSbRfze8x3vli71eWOwN5Fo2oanJp0 UcgksZrJkWBbvlMeSXSuZUH7v4R8JcVcKoab85/M66fa3EMOnSXspjVNJKS/WLpZEkkSaD05pgqT yRLaR7SL6zg83HFXKvVfLOoy6n5d03UZpYZpry2inkktlZIS0iBjwVyzgVP7Rr44FTLFXYq7FUou v+Ut03/mAv8A/k9Z4qm+KpDrH/KVeXv+jz/kyMVT7FWB/wDTRf5/9XzFKfeRf+UVsf8Anr/yefFB d5s/6U3/AG1Lb/jbFU+xVKPNP/HMh/5j9N/6j4MVTfFXYq7FXYq7FXYq7FXYq7FXYq7FUouv+Ut0 3/mAv/8Ak9Z4qm+KpDrH/KVeXv8Ao8/5MjFU+xVgf/TRf5/9XzFKfeRf+UVsf+ev/J58UF3mz/pT f9tS2/42xVPsVSjzT/xzIf8AmP03/qPgxVN8VdirsVdirsVdirsVdirsVdirsVSi6/5S3Tf+YC// AOT1niqb4qkOsf8AKVeXv+jz/kyMVT7FWB/9NF/n/wBXzFKfeRf+UVsf+ev/ACefFBd5s/6U3/bU tv8AjbFU+xVKPNP/ABzIf+Y/Tf8AqPgxVN8VdirsVdirsVdirsVdirsVdirsVSi6/wCUt03/AJgL /wD5PWeKpviqQ6x/ylXl7/o8/wCTIxVPsVYH/wBNF/n/ANXzFKfeRf8AlFbH/nr/AMnnxQXebP8A pTf9tS2/42xVPsVSLznz/QsQRzGzajpaiRaEry1G3FRyDCu/cYqwbyh+Zd1rmiahq11dXFrDo97d W14IhBKzw2trLcF1Q268WPp04hm+fgpZP5c14eYbOw1Ox1S8j068hu3PrLZcla0nSBvijjkjK8uW 6sQRQg4oTUQ3o1G4gk1a4WGKGCRWK2o+KV5VNSYf+KxTFWrFLqWEmfWJ0kM9xHGtLVSVinaJaAw7 7BfpxVQ/3Kf4Y/SX6UuPrP1L6z9i248/S59PR6VxVFajbahb26SR6rc8mngjNUtT8MsyRt/un+Vj irHPL/nSx8xI0+natexW9revaXrXKWa0VLaSfmGWN1A+EV5EMN+QGKq3mDzXZ6DZXeq3Ws3NxpkC Wwia2FixeWeeWEqHeNIhQx7lmAFDU4qmegT3GsWr30GrXZtJTFJaEx2yMYpraKZeSmCoP73FUz/R t5/1dbr/AIG1/wCqGKu/Rt5/1dbr/gbX/qhiqWGG4g866Ysl3Lcq+m6iaSiIUKz2PT00j/m74qyL FUh1j/lKvL3/AEef8mRiqfYqwP8A6aL/AD/6vmKU+8i/8orY/wDPX/k8+KC7zZ/0pv8AtqW3/G2K p9iqR+cv+ORb/wDbT0r/ALqVvirz/wAufl/r+k6DrumXFlYWl1reoXz2EUE9xNCVn06aOP1Wk+MD l1pv19sUpdeflb5k/wCVS6T5FSCxOpx290ssaqjQCI38U1V9ZXHq+mwJbrzqQ3cqEf8AmD5C80eY /LGk6NaRWh1bT4tMlvY2ESwAxW97DIIxw4KPUkFOKCg+yBiqI1zyLr2s+fvLev2kcDaZpF3cm7Zy glqL6Z/hqjN8IoRQ79NuuKVknlXzGPMaeY44rP8AQTeXhbzyGKD616i2rgESmMzDdgDRwCOvQDFU z0vyZrGj+bvMutXX1I6frN5p8ll9WQJPUXaep9YPAFj9mhDkddsUJF5Q/K/XdE8q6xoN+mnxXGu3 179Xa3DvERcadPEDMX+Nl5E0XqF29gpUZ/ys8wS/lVceSPSsH1dIIGkRSy2h56hdzsYuKwkfC9QC B4HxxQzKLTvNtl5LvNO0N7aLzHa/UYEdABbhora0Wf0xItAvpq/DkvhiqTajY/nypi+oahaPEQxm Eq2/qhvrM3AKwiVKfVvR5VX7fKm22KUFp9j/AM5I/WLBNS1HTRaerTUJLZYvW9MkklPUiKdCO3Y9 dsUMy0yPVo9c8tJrEom1YaLffpCRQoU3Bl08y8eCoOIeoXbpirK8VSHWP+Uq8vf9Hn/JkYqn2KsD /wCmi/z/AOr5ilG+ThLc6PZ2bzPBbrC8oEZ4NKxuJQ3xj4qRcVJ4n9octjQqquszTSJpqSuZhBrU ESXBABkCgkkhQFqrEoad1+jFWVYoY954vVt9MtoZLKLUIL67htJrSaJJw/q19OkckkMZPqhPtOAB U9cVY1LoNnFJCj+SrINO5ji/3GaaasEZ/wDlv/lQ4pc2g2a3KW58lWXqyI8iD9Gab9mMqG3+v+Lj FXLoNm1y9uPJVl6saJI4/Rmm/ZkLBd/r/ihxV1voNnPGXi8lWRUO8Z/3GaaPijco3/H/APzKcVUv 0Rp36O/SH+C7L6r6P1jl+jNNr6fHnWn1+v2cVVbjQbOCMPL5KsgpdIx/uM00/FI4Rf8Aj/8A5mGK ul0GzikhR/JVkGncxxf7jNNNWCM//Lf/ACocVcug2bXL248lWXqxokjj9Gab9mQsF3+v+KHFWotB s5ZJkTyVZFoHEcv+4zTBRiiv/wAt/wDK4xVV/wAMwf8AUk2X/cN0z/svxV3+GYP+pJsv+4bpn/Zf iqrpiro+s20dv5dtNKnulpJMlna27NB68EMirJbXVw1ec8Z4stDTrUDFWe4oSHWP+Uq8vf8AR5/y ZGKukmuTplxqwuZFuoPVItgR6StEzD6uyUoxJXizda/ZNDiqQ/8ATRf5/wDV8xSnHk+ys7vynYJd QR3CKZSqyorgH1XFQGBxVU80Rxxx6JHGoSNNTtVRFAAAAYAADoBihiV2Z/00PrAb9Kc4q8PT9XgV Uz8eXxet6nIQf5FKbccUp7+YLyR6Jo73k8drKup2BuLlTSONufxOC/7KnccvpxV59p+jPY2N1A/m nSEutQZVAhv2kgd4oLhS8pPpyxerGVikdWaRiWcuW4hVVQ6UItFj0uHzHo31ySW5unt3vVexpItu jwiiKqIZVa4SIQ+mGopVl5EpUbrtS0i1uLbT9Og8xaVcRWNusdxbXeov6ZjknmkjWK5HqOXt0AhV zGG4MSvptSgVfcaal7caVMvmzTHWxBilu570R3KXEN3Mxu4lXmreqsnNk5JzKoGZkqpKqP1KFtQO uSeZNM+qpYj0FS8C3XBrH0pLaSEDg681XgOYC/E3EyNyAVXttOFpd6rd3HmzTBJegWtvdW16Glfn eQyQ3U8R4KJoaSMW5ts3FeCIASqla6YlppNxanzDosF1f3MMiWsF+8lkGgin5h94ZES4i9OCSlWY DkzOzHFVo0eP9DTaTH5j0gTGa2uXtpL5WtfRZbiOaJH4cK+pIblF+r+kkhA9PiBii2beSda8u6Tp s9jd6/YSSxTCjfXFkUKYIuMaSSuZJFiH7tXf4mC1O+Ksh/xh5S/6vdh/0lQ/81Yq7/GHlL/q92H/ AElQ/wDNWKpJqutaPqPmPTF0++t7xo4XMgt5UlKg6hp9OXAmlaYpU/PXL9IQ/XQTpPpDlTjz9Xk/ 93yp34c6b8emKhbpRvjqfl363x+1d+jwIKcfq0fIIR+z6vPjT4afY+DjirMG07T3uRdNaxNdChE5 jUyAgUHxUrihhf8A00X+f/V8xSnNp5HtbOAW9rqupw26ljHEtyaKGYtxFVJoK9zXFC278i292IhN q+qH0JUniP1no8ZqDuv0Yqr/AOE/+1zqn/ST/wA24qhtQ8g2eoRJFd6pqU0aSLKEedXHJDUbMjDF NpfYfl1okv1jlPcj053QUaPoKf5GVYuvvb8/8P8AVCHb8v8ARv8ADRvPWufV+p+tTknHl6XL+StK 5drNjP8AznH7MN+F/m/oRGo/lzokVujrPckmeBN2j6PMiH9jwbKsvL4j7w36f6j/AFZf7kuuPy60 RL60iE9zxl9TkS0dfhWop8GCf1R+Kcf93L4Ok/LnRBqdvD69zxeCZyeUdao8QH7H+WcJ+se4/oRH +6l/Wj90nad+XOiS27s09yCJ7hNmj6JM6D9jwXJRcTEdvifvLen/AJc6JLAzNPcgiadNmj6JM6j9 jwGX5hv8I/cGGmPpP9aX+6KGX8v9G/w0Lz1rn1fqXrU5Jx5ely/krSuR031R94a8h/wc/wBT9CZf 8q00L/f91/wcf/VPIOZbDXt/L6NGjrMJJVhZY1kuZWBuU9SJCYdPlTmy9FDHGkWpp/hdwpDyhWXm HZrxU4c/T5ljpoULz+HkTSu2NLbK9N/L/SbqKO8S7vrO4ilkicQTpQmCejLy9JeS+pAGGwO3bFbT r/Cf/a51T/pJ/wCbcVUJfItvLd293Jq+qGa1DiE/WenqABj9ivQUxVX/AMJ/9rnVP+kn/m3FVH/A WlfV+H1u/wDrPq+r9e+sv6/996/D+Thz7cff7W+KskxV2KuxV2KoHSv+Pz/mJk/hlWLr7y5Go/h/ qhLnklk8u2un28ZkubuwHEDjQIBFHIfiZByCzVUVFadRmRqo8UpDvJcPQT4YY5DoIlX1S4vpo0tb e19S8iNtczx81CKObOAHbjX95BxJpsDyAP2cqlGw3wnwm/Ij5il80t1caxCLeHlDZSNFcSMQAC8S P41pxcUoDU7HiPixMbIPcsZ1EjvdHPdXOrwXEMFbKNbi3eVmUEOJeL/DUn7UC8fEMSacaM8O9qJ1 Ex7yD8r/AFojR/8AeST/AJibr/qJkxi4+Hl8T95b0n/eV/8AmIuf+oiTL831fCP+5DDTfSf60v8A dFBL/wAoaP8Atnf8yMGm+uPvDXk/xY/1P0JzlbmMA8v+WBqUS3gu3t3hbTpFRVVh6ltYxNGTy/4z NUYULtT8gQ2Oh3ci6hLItrYzRhGRByjSQ3agkD/fo6+GNqyzQP8AeGX/AJjL3/qMlwJTHFXYq7FX Yq7FXYq7FXYqgdK/4/P+YmT+GVYuvvLkaj+H+qEt/wBKt9HsdTtgrNaafxZGFfhf0WZgKpXikTGn IVPcZmZYk5SB1l+l1unmI4Ik8hAfcr6i2qWj/X4YonmuFtbaWEsSqtzkGzfBUGSZV5U2FW4mnE48 pU5kIGRoef2brmbULTWljjSOS21GZpZHJIZBHBGlPvjr3r7dcBkAQO9IgSCe51qdQtNSiseMb2s/ 1m5aTcMOUzOfu9WMUpvUmo4gMeLekCB4TLoP0/2IrR/95JP+Ym6/6iZMEWjDy+J+8t6T/vK//MRc /wDURJl+b6vhH/chhpvpP9aX+6KCX/lDR/2zv+ZGDTfXH3hryf4sf6n6ETrstxFp4NvM0EslxbRe qgRmVZbiON6B1dfsseoytzHnukzeaLby89oGY3P1lEnUm1jmC2skdu6LLHfW3+6ren2Vr498KEXB ca/IdSt5PUjsr22SCk8kE5BPqiQxiTVZuB4uu/fbbbFU6/L6XVzYhNSnklkmt4r/AIyCEFWvJ7ly f3KqvxKqmm9MSlluBXYq7FXYq7FXYq7FXYqgdK/4/P8AmKk/hlWLr7y5Go/h/qhC/wDTH/8Abv8A +ZGZ/wDl/wDP/S6j/kJ/yT/3qL1f/eSP/mJtf+omPMHLy+I+8O20/wBR/qy/3Jau/wDjp2H/AD2/ 4gME/rj8U4/7uXw+9uX/AI7Vr/zDXP8Aycgwn6x7j+hEf7qX9aP3Sdo/+8kn/MTdf9RMmSi4eHl8 T95b0n/eV/8AmIuf+oiTL831fCP+5DDTfSf60v8AdFBL/wAoaP8Atnf8yMGm+uPvDXk/xY/1P0K3 mJgmmCRto4rm0lkbsqR3Ubux9lUEnK3MRj6fYOxd7aJnY1Ziikk+5IxVb+jNN/5ZIf8AkWv9MVQl kyPr+pNFQxwQ2ts9Oiyp6spT6I54z9OKppirsVdirsVdirsVdirsVSDR7bXVm1NjfwPC97K0CPbE mNCFonJZU5U8SMxcQnctx9R6ftdjqZ4SIek3wC/Vz8/pKn6Wrf4Ur9Zg9L6h9n0H5cfR6cvW6+9M 2AE/H5j6+7z97pjLF+V2jL+7/nD+b/VRWq6Z5ivLZIoNSt7d1mhlLi1ZqiKRZCtGmPXjmFPHOQqx 8v2u20+fBCVmEjsR9XeK/mtXWneZJdSsbmO/tUgtvV9eM2z1fmvFaH1uxwSxzMgbG3l+1cebAMco mMrlVeodP81SntvMJ8x2cgv7YQi0uQYfqrbn1Id6+tX/AD+4GM+Mbjkenu82cJ4fAkOGV8Ud+Lyl /RVtJi1j6q/G6twPrFz1t3O/1iSv+7h3ycRPvHy/a4OKWKvplzP8Q7z/AEVmnS6lC1ssk0Lwz3l1 G6rEyNs071DGRx9pPDLcxmJxsjeun9H3lGmGOWORiJAgy5kH+Ov5o716/wDKGj/tnf8AMjLdN9cf eHByf4sf6n6E3liimieKVA8UilJEYVDKwoQQexGVuYlekvPZXTaNcsZVRDLp9wxLM9upClHJ/bhL qpP7SlT15UVV9Yv57WCOK0QSX92/o2iNXgGILNI9P2I1UsfHoNyMVVdM0+Kws1t0ZpGqXmmf7ckj nk8jU7sxr4DoNsVRWKuxV2KuxV2KuxV2KrJ43kjKJK8LH/diBSw/4NXX8MEhfWmUJAGyL/HlST6P a6gLi6Wa4kRYpwXVXhkEjMiSNX/R4ioo1NjhlpxCjGUje/Id/wCxENZLIZCWOEeH0ijI9AfLv81/ /TH/APbv/wCZGZX+X/z/ANLr/wDkJ/yT/wB6nGYrnuxVBS/8dq1/5hrn/k5BlZ+se4/ob4/3Uv60 fuk7R/8AeST/AJibr/qJkyUXDw8vifvKDh62H/bRu/1XOT1X1x+H+4bdD/d5P87/AKaOX/lDR/2z v+ZGT031x94cPJ/ix/qfoTnK3MSbX3vrJxrFtDFcR2NpdetDJK0RIb05KqVjlr/ckb0xVRsJdav9 WWS8tba1XTJJIpvRuJJyzywxuvHlBDtxkFa98VT/ABV2KuxV2KuxV2KuxV2KuxVB2P8AvVqP/MQv /UPFluT6Y+7/AHxcfD9U/wCt/vYoP/pj/wDt3/8AMjLf8v8A5/6Wj/kJ/wAk/wDepxmK57sVeU/m wt7b3mraraWtlezWWnaeiW97apcEtPd3KBkdxJ6fGhqPTblt0pXGk2yzyfYWthrGuW1pGkVvW1lW ONI4kBkiLGiRLGu2w+zWg3qcUMF/MQXVsdZ1e3hsLmWxtoFSG/t45QTPqd6nJJJA4j4gEkcG5bdK Vy3MPUPdH/cho0pIgf60v92WY2um2em3PmG2soo4IX0m2nKRRxxJzle+qeMSxr9lVWtKkKKk44P7 yPvCNV/cy/qn7mZ5U5CXeZf+Uc1X/mDuP+TTYq7Sv97tZ/5jE/6g7fFUxxV2KuxV2KuxV2KuxV2K uxVB2P8AvVqP/MQv/UPFluT6Y+7/AHxcfD9U/wCt/vYoP/pj/wDt3/8AMjLf8v8A5/6Wj/kJ/wAk /wDepxmK57sVeW/m+JW07zHHFZrfGSy0ZTA8QnFDfXXx+kQeYQ7t0otTXbFWYeXiD5h1sjpwsaUH Ef3B7dsVYH+ZIlbRPM8cVmt8ZItPUwPEJxQ6tffH6RB5hDu3Si1NdstzfV8I/wC5DRpvpP8AWl/u izSUg6jrpHT9B2VKDiPtX3btjg/vI+8Lqv7qf9U/cyrKm9LvMv8Ayjmq/wDMHcf8mmxV2lf73az/ AMxif9QdviqY4q7FXYq7FXYq7FXYq7FXYqg7H/erUf8AmIX/AKh4styfTH3f74uPh+qf9b/exQf/ AEx//bv/AOZGW/5f/P8A0tH/ACE/5J/71OMxXPdiqSX+halLq8upWGqGxae3htpovQjmBEDyurAs QQf35xVV0TRLmwub27u71r66vmjMkhjWIARLxUBVxVAW2kaz9fudS02+trf6xztpYrm1e4/3nu7l 1ZWS4t6V+sEEEHplub6vhH/cho030n+tL/dFUl0rUILfWdQ1C7hubm5sVtwLeBreNY7cTOvwvLOS xM7VPLw2xwf3kfeF1f8AdT/qn7mQ5U3rJ4Ip4JIJlDwyqUkQ9CrChB+YxVTs7G2s0dIA37xucjSO 8rs1AtWeQsx+FQNz0xVXxV2KuxV2KuxV2KuxV2KuxVLIr2K2u9QEsc/xTK6skEzqV9CIVDIjA7gj bMg4zKMarl3jvPm4UcwhOdiX1fzZH+GPcEnHmPSj5I+sBpjB9R9P1Pq8/HkE9OnLhT7e1emZf5Wf 5itr4u8d997gfyhi/JcW/DwVfDLuru70/Gr2hAIS4odx/o1x/wBU8wfBl5f6aP63aDUx7pf6WX6n fpa1/kuP+ka4/wCqePgy8v8ATR/Wv5mPdL/Sy/U79LWv8lx/0jXH/VPHwZeX+mj+tfzMe6X+ll+p 36Wtf5Lj/pGuP+qePgy8v9NH9a/mY90v9LL9SX6Hr2nzW04i9dzFdXKSUtrg8W9ZmoaJ1owy/Uaa YIut4x6ju97i6PW45RNcW05D6Zfzj5K+qahDNpl3FHFcNJJDIiL9WuN2ZCAPsZDDiImCSOY/iH62 zUZxLHIASsxP8Mu73JrmM5zsVdirsVdirsVdirsVf//Z + + + + uuid:b669ec92-ee21-4cae-a6c0-341b4db91c0d + xmp.did:fb14a6d0-01ba-364b-a85d-47a68f01d1d2 + uuid:5D20892493BFDB11914A8590D31508C8 + proof:pdf + + uuid:45cefb37-329e-4b33-b86c-322853ca0ab6 + xmp.did:eedf3116-2fd9-a546-98d1-3c864bf140f0 + uuid:5D20892493BFDB11914A8590D31508C8 + default + + + + + saved + xmp.iid:eedf3116-2fd9-a546-98d1-3c864bf140f0 + 2024-11-29T15:35:04+07:00 + Adobe Illustrator 27.5 (Windows) + / + + + saved + xmp.iid:fb14a6d0-01ba-364b-a85d-47a68f01d1d2 + 2024-11-29T16:14:59+07:00 + Adobe Illustrator 27.5 (Windows) + / + + + + Print + Adobe Illustrator + False + False + 1 + + 297.000024 + 209.999994 + Millimeters + + + + + MyriadPro-Regular + Myriad Pro + Regular + Open Type + Version 2.106;PS 2.000;hotconv 1.0.70;makeotf.lib2.5.58329 + False + MyriadPro-Regular.otf + + + + + + Cyan + Magenta + Yellow + Black + + + + + + Default Swatch Group + 0 + + + + White + CMYK + PROCESS + 0.000000 + 0.000000 + 0.000000 + 0.000000 + + + Black + CMYK + PROCESS + 0.000000 + 0.000000 + 0.000000 + 100.000000 + + + CMYK Red + CMYK + PROCESS + 0.000000 + 100.000000 + 100.000000 + 0.000000 + + + CMYK Yellow + CMYK + PROCESS + 0.000000 + 0.000000 + 100.000000 + 0.000000 + + + CMYK Green + CMYK + PROCESS + 100.000000 + 0.000000 + 100.000000 + 0.000000 + + + CMYK Cyan + CMYK + PROCESS + 100.000000 + 0.000000 + 0.000000 + 0.000000 + + + CMYK Blue + CMYK + PROCESS + 100.000000 + 100.000000 + 0.000000 + 0.000000 + + + CMYK Magenta + CMYK + PROCESS + 0.000000 + 100.000000 + 0.000000 + 0.000000 + + + C=15 M=100 Y=90 K=10 + CMYK + PROCESS + 15.000000 + 100.000000 + 90.000000 + 10.000000 + + + C=0 M=90 Y=85 K=0 + CMYK + PROCESS + 0.000000 + 90.000000 + 85.000000 + 0.000000 + + + C=0 M=80 Y=95 K=0 + CMYK + PROCESS + 0.000000 + 80.000000 + 95.000000 + 0.000000 + + + C=0 M=50 Y=100 K=0 + CMYK + PROCESS + 0.000000 + 50.000000 + 100.000000 + 0.000000 + + + C=0 M=35 Y=85 K=0 + CMYK + PROCESS + 0.000000 + 35.000000 + 85.000000 + 0.000000 + + + C=5 M=0 Y=90 K=0 + CMYK + PROCESS + 5.000000 + 0.000000 + 90.000000 + 0.000000 + + + C=20 M=0 Y=100 K=0 + CMYK + PROCESS + 20.000000 + 0.000000 + 100.000000 + 0.000000 + + + C=50 M=0 Y=100 K=0 + CMYK + PROCESS + 50.000000 + 0.000000 + 100.000000 + 0.000000 + + + C=75 M=0 Y=100 K=0 + CMYK + PROCESS + 75.000000 + 0.000000 + 100.000000 + 0.000000 + + + C=85 M=10 Y=100 K=10 + CMYK + PROCESS + 85.000000 + 10.000000 + 100.000000 + 10.000000 + + + C=90 M=30 Y=95 K=30 + CMYK + PROCESS + 90.000000 + 30.000000 + 95.000000 + 30.000000 + + + C=75 M=0 Y=75 K=0 + CMYK + PROCESS + 75.000000 + 0.000000 + 75.000000 + 0.000000 + + + C=80 M=10 Y=45 K=0 + CMYK + PROCESS + 80.000000 + 10.000000 + 45.000000 + 0.000000 + + + C=70 M=15 Y=0 K=0 + CMYK + PROCESS + 70.000000 + 15.000000 + 0.000000 + 0.000000 + + + C=85 M=50 Y=0 K=0 + CMYK + PROCESS + 85.000000 + 50.000000 + 0.000000 + 0.000000 + + + C=100 M=95 Y=5 K=0 + CMYK + PROCESS + 100.000000 + 95.000000 + 5.000000 + 0.000000 + + + C=100 M=100 Y=25 K=25 + CMYK + PROCESS + 100.000000 + 100.000000 + 25.000000 + 25.000000 + + + C=75 M=100 Y=0 K=0 + CMYK + PROCESS + 75.000000 + 100.000000 + 0.000000 + 0.000000 + + + C=50 M=100 Y=0 K=0 + CMYK + PROCESS + 50.000000 + 100.000000 + 0.000000 + 0.000000 + + + C=35 M=100 Y=35 K=10 + CMYK + PROCESS + 35.000000 + 100.000000 + 35.000000 + 10.000000 + + + C=10 M=100 Y=50 K=0 + CMYK + PROCESS + 10.000000 + 100.000000 + 50.000000 + 0.000000 + + + C=0 M=95 Y=20 K=0 + CMYK + PROCESS + 0.000000 + 95.000000 + 20.000000 + 0.000000 + + + C=25 M=25 Y=40 K=0 + CMYK + PROCESS + 25.000000 + 25.000000 + 40.000000 + 0.000000 + + + C=40 M=45 Y=50 K=5 + CMYK + PROCESS + 40.000000 + 45.000000 + 50.000000 + 5.000000 + + + C=50 M=50 Y=60 K=25 + CMYK + PROCESS + 50.000000 + 50.000000 + 60.000000 + 25.000000 + + + C=55 M=60 Y=65 K=40 + CMYK + PROCESS + 55.000000 + 60.000000 + 65.000000 + 40.000000 + + + C=25 M=40 Y=65 K=0 + CMYK + PROCESS + 25.000000 + 40.000000 + 65.000000 + 0.000000 + + + C=30 M=50 Y=75 K=10 + CMYK + PROCESS + 30.000000 + 50.000000 + 75.000000 + 10.000000 + + + C=35 M=60 Y=80 K=25 + CMYK + PROCESS + 35.000000 + 60.000000 + 80.000000 + 25.000000 + + + C=40 M=65 Y=90 K=35 + CMYK + PROCESS + 40.000000 + 65.000000 + 90.000000 + 35.000000 + + + C=40 M=70 Y=100 K=50 + CMYK + PROCESS + 40.000000 + 70.000000 + 100.000000 + 50.000000 + + + C=50 M=70 Y=80 K=70 + CMYK + PROCESS + 50.000000 + 70.000000 + 80.000000 + 70.000000 + + + AutoCAD Color 3 + PROCESS + 100.000000 + CMYK + 74.972147 + 67.919427 + 67.049664 + 90.145719 + + + AutoCAD Color 5 + PROCESS + 100.000000 + CMYK + 0.000000 + 99.334705 + 100.000000 + 0.000000 + + + AutoCAD Color 2 + PROCESS + 100.000000 + CMYK + 73.534751 + 0.000000 + 100.000000 + 0.000000 + + + AutoCAD Color + PROCESS + 100.000000 + CMYK + 62.658119 + 0.000000 + 100.000000 + 0.000000 + + + + + + Grays + 1 + + + + C=0 M=0 Y=0 K=100 + CMYK + PROCESS + 0.000000 + 0.000000 + 0.000000 + 100.000000 + + + C=0 M=0 Y=0 K=90 + CMYK + PROCESS + 0.000000 + 0.000000 + 0.000000 + 89.999400 + + + C=0 M=0 Y=0 K=80 + CMYK + PROCESS + 0.000000 + 0.000000 + 0.000000 + 79.998800 + + + C=0 M=0 Y=0 K=70 + CMYK + PROCESS + 0.000000 + 0.000000 + 0.000000 + 69.999700 + + + C=0 M=0 Y=0 K=60 + CMYK + PROCESS + 0.000000 + 0.000000 + 0.000000 + 59.999100 + + + C=0 M=0 Y=0 K=50 + CMYK + PROCESS + 0.000000 + 0.000000 + 0.000000 + 50.000000 + + + C=0 M=0 Y=0 K=40 + CMYK + PROCESS + 0.000000 + 0.000000 + 0.000000 + 39.999400 + + + C=0 M=0 Y=0 K=30 + CMYK + PROCESS + 0.000000 + 0.000000 + 0.000000 + 29.998800 + + + C=0 M=0 Y=0 K=20 + CMYK + PROCESS + 0.000000 + 0.000000 + 0.000000 + 19.999700 + + + C=0 M=0 Y=0 K=10 + CMYK + PROCESS + 0.000000 + 0.000000 + 0.000000 + 9.999100 + + + C=0 M=0 Y=0 K=5 + CMYK + PROCESS + 0.000000 + 0.000000 + 0.000000 + 4.998800 + + + + + + Brights + 1 + + + + C=0 M=100 Y=100 K=0 + CMYK + PROCESS + 0.000000 + 100.000000 + 100.000000 + 0.000000 + + + C=0 M=75 Y=100 K=0 + CMYK + PROCESS + 0.000000 + 75.000000 + 100.000000 + 0.000000 + + + C=0 M=10 Y=95 K=0 + CMYK + PROCESS + 0.000000 + 10.000000 + 95.000000 + 0.000000 + + + C=85 M=10 Y=100 K=0 + CMYK + PROCESS + 85.000000 + 10.000000 + 100.000000 + 0.000000 + + + C=100 M=90 Y=0 K=0 + CMYK + PROCESS + 100.000000 + 90.000000 + 0.000000 + 0.000000 + + + C=60 M=90 Y=0 K=0 + CMYK + PROCESS + 60.000000 + 90.000000 + 0.003100 + 0.003100 + + + + + + + Adobe PDF library 17.00 + + + + + + + + + + + + + + + + + + + + + + + + + +endstream endobj 3 0 obj <> endobj 8 0 obj <>/Font<>/ProcSet[/PDF/Text]/Properties<>>>/Thumb 11 0 R/TrimBox[0.0 0.0 841.89 595.276]/Type/Page/PieceInfo<>>> endobj 9 0 obj <>stream +H‰ìWË®ä¶Ý߯Ð:9|?¶™bAàE>`ÄpÆ’,üû©âa‘TKêÛíñÂhîѹR‘U§ÞŸþòyûôçÏfûý>ooFç¸rm¿–~«±ÛwüÂÔíçÍn?ÒÿÚÞ>ýñ{³ýóoÿ!hè?»¹\u1&mÁ’ Û—ŸÞøÿ*ç’v%m_ß¾ûë*UœöÙmÁYí¼+{!oupõ äMÔцúÜUÞmJòÏÝ% +ÚÂæ7…\5:2GG¡ÂVŽy +ÅØt;ÊD›uŠ9ŸÉd]¿#Sê”P¶˜ûß]éþž„÷œµ2›‹:÷—2ždö·Ü‘ÉÚ˾Dl‰;רd´;1Ïܽ¦ÉøÊ´¿ç=goeÞáÌQtšº~µ þTæ;Ò!Ü^¡óiE>=øx™º#åˆKWí‰sÔµ~#pÎS眸!t$®å[»ëÒª#ôú4¢­Ú!ÛŒ6û[èûp¬ƒ„óúqaŽݺ•EÊiÅ Ãí2ß„h›nbçnB³!ö‘„Žù²tªËÚ4"ú¡2ø:ÍÏ‹jÃeå$¡‹Â3‡²'Ñ©®‹ôzJ?¡ïýè/‘üîrÚJ°\Ÿ•àÿþýíoÛ¿ë\I—Íj-…Z3¿|¹j¿Æa× 'T»3/U»ìÁ¿ä¸;>ì§Ag­ÖNºn¿Ïsv'ôŸUë:]é5Ÿ¥ÖCÔݳÂíɳî4ҽǞ(‰Éç1¹cZí{¢é«‡äŽžLݳÏs›lýÒ¸ƒS=MïqSÔiSÚ²6| þÁïJ:šðéÚþÒ†Ö”»\G¦}‡g%¯ ¦v‡ªq*nìØˆ”iGýp[`j•qé8&x#›^rÙR«È +ÿà—®ª¤ˆ@e]›”!ÕÔdzÂȨÝjœˆÛ:6]æ\wïˆtNÏ3ö©Ž0cVSöÒBø¿tQÒ‘ºEWt ÐešæxTýDÔî<5ä«:2"r¥¸å“ü©â–fÇØŠž¯Ä¥£· +ÿà—n¢õa¼Q]HXkæÁ'xÑ$Ôî45ŽÃU‘¹R½G| ^r[©?VÄŸm!%âÏØÿ¦øo;âcÚ\U™ñ1}Üiv·W¥ò·ñ1çx†ùp5~Dü‡­ñ#â?`ÿÑjüˆøRãÎÑ)·ßTè·Ô²}GobÊÛÏÛÍŽPK |¦ (:ã—­2W2GÅ×~n´v/Í‹PôW_"q™w©WÛEHteuB¬ë¢e2P‚*£ËóÚ3¥KNô«NÎ,×ZO—Úô˜Ò)jÓ²ѽ†BŸÔªáþõÕ›°¹È1Mù±³:ÒÒNwÆÀQÆB.¹t¸•sªGºl"6ÒS—‘yäUÊŧ„Rц~ºt+ò3BfºØ|iŽrw8¼uá"T¨EëÎÌâÒþ€iåÞ×]Èyr6«Nb5·.×ÍËaiwÔMrv”[¦”£¦‰êxµùœDhˆ˜5wŸ;³ÊzRà_ê¨Cøä¤ñÔ‚H€%MŠå\ò$|¦æÅ$Àük%©pÜS€& +H¿£‰ñµ=YW婿þä"×k$žÑTâ/)}JXPŠˆdI)ër¬ª.§xÇJVS¨•`ÞDÎãK¾i¢è„¬nˆ&rÁ-ˆ%DUç€ú™Á»ñ@4Qjó*t!DDL”cJ[òPQÔ/Æ:*ÕnÐB¨„A £9–©Î”A{`ô2?éNS—Óyd=(ÕM_Gf?¹¤MfáËQ¨2'ÌÌ×7þ;Ëûòìšõ±…š'ç†EçVTü‚R´ j®ÆLˆ<×f®͘-NâæfRhsƒŽÃ=¡](´„îV¸‡ÐäO@£64‹«e€ââp¡V8‘>9¼ã +CÉPò‚„‘ÛÿHNAH_ Þ ˆ”žpUHÎrvÊ¥ + ¹@äþ€ˆ;X¦¦Õr + +‰ØéR{^Õ$½CNLñÁ +ˆç²m€]½@öªšÀ" +‘š¯`‡*¤°D”B·X³íÔÔC .cVuï"f'jŸÔÎa×W áqä .È µMAŠŒºC=N˜Ä#'1§G(n4ˆûDp ˆH4ó©Δ„@…6ó:Ö\BFÞ"è >&*­pÁÂÆÜ̱d¼1½ —äZR +B«hij~Ü…ê&JQåËv¨:8QnÁlA ÕT8ÈÕQw…X Áÿ€ë·j9®Ä¹jª °†Â0´ñvB—Vˆ“ѱƽBI@ƒ§Æ7´µ½ŠA.-¨±/—Ç6n 48F^OäþQ+&BH„ìˆ ’œo$$ñø7aˆaPBHöù©yÌ ÕÕ"Òa?ßî$Zµò$ή„ÎR*ŒÔ‘X‡­£ªX©"&P‘@è[míµ üŽÙEÈK=íJ,Ð&)½0MžY‘Q¯aѨæØÉY¸@fcôp¥ædÈDŽæ–Õœ7Ù#jަæ9îì#îBüâ’é:Ù6Åë#(~xûÇïöKLegUOz%#â~‰‘ÑCõÞ‹ª31òŠðð”S2>ÀŠå룲$dß.|- ¯%áµ$¼–„o[ì°ìµ$|ë’`G /Ô¾–„×’ðZ^K¸ù—;ˆXákIXá;KFå_}IH¤‡-•–„Èã_9]È0ëPpf$d/äSG=ïB?™!%¢£º™ó‘4Â’æ•5iöHhÏ­XÔÆ[A(ò% ÒD¬îDØ$ö[† ý$ºô]E_mÀÆ#ÖÅõ•„€pg¶ #o‡Ì6ÝâÊîíeV|ŠuENí3î¨îú\ï–Õµé­Fú±º­ïroÔ莠ÑwöÎðû§¾g ‡ +*m£B^Ê.!(·½L6ÛךØö9y‡Ýe ¶ù òm=Ôv#¹+Ô ²è—v‰8Z½¦ÅäÞè±¢(A²ˆÅõÕÚpo‘äÐÚ‹÷­xæ2ôÔŽ|j‘Õ +šëÿ4!Î0ö²”‹v ‹ +Û‹סP¬`¾”ÞQ˜¦*)Û¶ÏÐbeëjp‘_ ÷l4‹Þ¥©(Ó÷Ê$eÖò¢†½WßÌk‰hæS fŒ1R!&bV'bR1úHEšˆ<¿ŒuÙ®‹¬\^¹{Ú´xOÝÓ¶¾6_!Dƒ#Ð*ä‚FaÞ.K.žá œ³|Õ€çM©"Z·ê[›ãJŸ69öñ7I­‰8íð…dkË0Iëxb€KÃ\5& c;EY’KPÎ&BÕ¾iøê‡âžâ/,(63J/³¼ê‰ÁXCæR˜g,úî×¹ÖŸ‚À5 ñƒ Ô»Ð.2N²S +Ò@¶/cmÖEA´.ŠRuÉ"„ZÒWJbLòŸKÇ-ž•çv¤©Ôv É#MdF—‘fLÇs–ÞõI™yMkò½é® H:·ô”ô€d +Dù#bCë8¹Ÿ5—A´Õ¨9£ÎQ•o éuÉæÔçyxS²Ã¶^VdË3È ÐD¬‚§lF0•¯µ+Zž± ÙŒdp÷3<ì.<0j,‹D›êö(Ä^œL]œ$ËÊ~1jh<©ýþ¤öËÕÉŽSvËõ·+ù?ûå’,»ѹWq7@‡ø‘DîÈ{ÿÓ&HR•#"a—‹JÜ 4Ï+PÕ èʨº™ðX;.Dl¸Q¬mBÕk¾×¤=P§Ïlã„÷­Œ+‚c“I÷W[N˜ÛÄû@9šKæë°Œ8ÕÆâ©FE–´Ê´uòeÑ Ô½ÜÐ^˜h“æËUŒž*aۈǕEuµw¤94„øÑm´ò£¹‰dJB¡¿¸Øùkk;výÞI™[¶’‹õ÷/=)9}búØm•ÝÆR¾oÞ?Õ¹ièC‹ß¿øø~Î= êsn鸎÷99ô˜O¤\‘º-: a  +IâSêcÖÔ˜mû9Çf“ÓÌŸ~ÝûÞ»¨_ó“Žù¯þdÚG,®ñ+ØQÅþq°ÏÌM¿¹Û… +”Û-Zq÷}}ŸÉ÷”rÙw¹÷}}ÿ÷LFî|&þ]3¹þü;”ÿÊ_†rõ!òïTþÛ§r÷tþ£¦rÿ_žÊýç6•ëÏs,ßûãh{,ïõr÷c”±Ë¶pöl|Gi +"µ€„Ó’p§5á–xÃi¯s*¢ê&Ñý é­ã`4ÙoÔüm¼%èÌ_Éá‚äàAr)¼¨øì€yž“(Íq“f +5äÙè¯ +3R“„Y„¿,ˆvÎDx §!Ýüaí^Ê.ѨúO‡D¿‘zÅv=‡f»žcrÚs18Ñ”…ÓÑ ßp=ôÜè²Qø3èÇ/I"á~ó€K` œfHÇ´€Ñ Á„ÜÖ*0(—µ¬ éô{g{ó0=WH­Ñ“SÄ€'Á¨à,ÑöFÇåc‚bæt¬®rVuù‰N¡à!Ù‰¦?ÚÎî"-'êQm˜#<$m¥´Ùl,Ì)mìu\ɸš©5s:“W¤>}&Å\°¢ja¹YbÃfs Ñvÿ­Æ>ëÞËxø›Ð›8D—’‹«°çqéÃQâg«±ÍÐt ó/0äY$þ_p O\¡’;B¹çãÇ9é…Õ‚Š(‘wEfÐgßi8 +_Zø§£p8ÇxnuXl8{Þ£Pêùü±m„Odü9Ö3•nË#ïòâ?ÙNwlû!ÛéØ)®5ßc?¿sNÄt•ÃL‰:$}â1¦8êž{l4w”çnÇ-s>¶ ç†ÄU +S`ô•Ô•„qr†¶žWŒô Ø2*¦Ø+6#•–Ô´ÙïËÃk$Êßœ‘{ÞöÍës ¥’ëµrç¦&èá†mWó›D^Œl&¡¦™A›æ=}矼Õ”ŸhÛQ³^þö¦Äð¶ÝGÎ]\øåJZª-· +g„ܾđÐ$”¸e¼?–ÁƒÓ1ÃUó!¤>Ñ|¥Ë˜,~%±^i^ez i‚Å ”pȆ‡ÍsŒDši2ê”Ô…¹ßڨlDEVÊ +Šûœ¬­6of›¬µö6<·²x+“8<1t9<1tѼ³6r¯0l²—ÍŸ™ºcÖiå.;¶nò31KMpH¶û]ð^FØöHSïCRK„pt“²t “ŽË$<[¶MzhˆÓЪD†Ô£5Ìc!’ãשF’óm¼>Õ+²¸W¹z~´ÊI›ŸtÌîeBBA‘Pˆ ¯YǺ2¡Üóƒ¼7ÑHÚf8ž·+nYž!(´w;Zvàº=x%b©-J§QZ=|Ü&ØŒ2“ª(ÏÄU &½ÐÄ£"¶¥'œÕ†ü>iánàvf'Ë.‘”dA'³^ Z™¥P‚›‘@`+~8ΑQŸ -÷÷꩘Îqíw˜^—W»<3X£±¼J[Ž#ËxøïX¥NëNÔÙÇWŒXš¯3ŽM}$¡_4) t£± 6]—K'€ªÖi"Õf’DÿM|Š#Q]Ä£ÀY’êJgVÀݺٺseÐîçR‚ø¼V’I.¨%qŽ5¨ç†‹ÉÂÔF¹ŽLL|ßw€oÄygäÆ1a^ˆÒräü»QZwíœ>¢JÌóÏh$G®2éÊs –XeFºâ`Ý¢Ä`ì–˜…ºPêRdcK5¥RצYL(Ù¤1…V9f0mZæYÔqjÇÅÕ­¸ù4“¸pÕiŽòžq@š§G¿’Ó«!*• !Cò ÎÍMã’sÝB¹PÆ–B<ðÞ#›DGsµÉþ&ŸœütTñÇ6v²Lî÷k³uÜ­’£Fêaô é Ã>‚è-A8£Ó‰èQmûh=ÓŒ­6¬¯,s±üa7y‘­\*ewlcI ñ·Aò– 3%‡ ç™H.åñyÃcW}.Æ­–»Œ„—!ÙÒ —‡úp•;\Ó~û¥ø¶ýGBýe±@à $¼ƒ„Ónþ°êÈÐr5D^¢òMÙ>ñ¶çÊ (R÷¥ý4Í„1µRg7Z9²Wy3øpÇCîe +5Èv¹ +’H„¨œ+.Aºkþîž $Þ|"B$1áìX8¬²[—ðÞöÙÔt¾>CÜñwoBLœѪf÷ÙöFN+§Ž×ȶÚÕïPc~œ“^X-¨ˆy?ZšC¾‘<§ùÚöæÐÂQ¸3vì'õ{ßäØAñQ'ÅT‚x={KÜÇL×µ‚»ßóH-– ¤.8É™-+&¸øÞÕ˜•}~¿ÊÚÆbí¡~ÉéÆk¨sÅ4“ô@”‹5}ì!ízÛ_Q÷Ù{«ûK~Õþã9Úµ+oM è6ýPj`Á^S°UXý£‡llÍŸÌ;™ÛtóÇï_ü5ä£mM©£k ·QS &2‡YWP] Ì7Pf8Q÷—/Gb‹ v:ZÔž†Ö3œ¾8Ï{'³Ð˜ª(PÚ'of½—&ÓêjëHS%çPÅMËŒ¿:5 +6Á†®‰r8^+*›×Û¦ÒЩÊIŒ2lªy8½'À¼YCÃpÚÿ0_.iê: žŸUÔèH€°£39ûŸ^bI–©îÜYýÝUø!Ë)Ú‰ØuóË_Xß’¢íö ¿œ'ZŠÇnkç•7KYN¼·3£°h¼åæ¶)bØë¾‘c&¨â¿ÝKV +b™”uá¦)ãªÈµT#;« ®ÚÑ[Q㉱“ˆë +¯ûõßq¾^tãB@Œþ‚m+7jÑvÏ~øöí)Áªö$cs\›vÞ/”å¸K†º²‹ü=xßÎnG:5’{4Ôö7è>]EÆý¬¸Ñ Ûë¿(f™K¬‡OKTáÏ‹–¶˜!)örÔæD ³Ï;µè`-S¨dþû;XµÔ¼Q› +•ý¯›Ýø`ÖKZZö¼1f]ºpçh1k¸~Uö´=ì–"!UËxÂY é„ýz|˜°õ׃wQ2,¤fëŒTtc#Þ‡“B—å”Q(6íëíi¦rN*þÐÌjåÁë´AÉT®Òdxă¹cÊ (0ßSÞQÁ)à´”èh”ÅžiÛ‹£q²Ž9­ËX·¾®n°?œâ“Äë˜Nñ©Üõ9G:EÜ´Œà‰°›ü’¡/Â2cW¨Ÿ-š}ÚÕ7ù[ù)³Ã÷ glsð¬_—j÷øiíùñÿ¹M„ëéñç Ó¦Ï(¿Io‰ÜeÐGµyD97VŠœ›0Mz™ÞÐÔ…Ê΂t‘Í'æXÌ®HÖ6Ôï«»±¾zHxA:QRñöBª«…àFGñübãæ +Ò[¢ÁÒ= +gW”A$tcâÝ+~ûÅýeÙÇ2Ò> +éq#l¨yýGjiW(â+Ш9þM=ÿl¬­–c{ËGË*xç«@V)DKåeÜÏŠ¨EôsVªÛ[mbé[ó~(Ÿ›#Š9‰'ƒ“‰ÛBŒt‰ëÛÈàd0Òó º +îúk«´¶ópÅÞ(:¯iÆ”²3L¤OÙíáîDûø¸¶c+4+ê]}&(kÒ~ÞE]èó®þwk˜æÌ1­aVÕq3h¥9Ã2ŠŽûã6žYqÇO=°:ÌrùEdQ*3%(¨&Q¤!‡”JÈf)YôHÙ êcÚ¿ÿ°ð…ÿŒ'q +­"‰ ÛXŸ;—¥A¬“o}MC<^S²SøßÓ”“—S¹}<°sIˆaž£ýרߢ‹U&&Á\¶Ïk!x/ßV¥XF·ða"š (¼Ýñ™o£DCE‚ÙÒö#&º ²,.„ÖeQív³@4? $La' êèËüAGCûéðŸéTÛÊ·ÊrÂÓ"&ò»"8cŽ¥dÎÁºè1†É(:ÂÌ&Åœ!Õ"ÌÂ2 -õz=ÆB¡’ôþòµ=þê‰y”yy„5BX:ÓŠô<äø 8®X14WAœUc?2= o&Iywl;m\…ЄÇϺÙœ"´/(‡p"ZÚX~º 9 ½â¥e&Ñû‰šÉóf‹oMœ}¨ ,vçm½D\8S9¨h%Ä,ï˜TÆ™ÕŃ •B{! a8¸fÒT¶¼-ZÁ0Ì.CR|5)žãU". +Wâ­4<‹C ']IÖîç •$:¥/T‚åÁΣâ—C“ èO,8ùF¹<\¦^7O®’Æ%¿©vi&ì[¸aÃJ%˜1V!¦ùèBûYh¦<Š{/T†ZËwAÝt(7:hº`—÷³B5UŒ“ö;uWeüëw—ò R‰ç.>‚ðîq1ZGý׸ŸñdL¬|o" \?ZÍtÚ"¨ôR¡ˆ¾^~„ÝHÊ£¯M­ÄZaBI&¡$ISôüU%)ÚÎb|P„4D"%”$ýS€>ddh†ËOˆ|¾û&D\¤SÑî!Y‰H% 8¥b•ŽwÞ5Ue“R$r§ÚŠÏ7†¶RËß”Hþ´àzZOW-`‰Û)éÅÕô™Ê +½¶ç¾¶®¸glÆØ4#ÒÏËÆ2¡áÃíÀ~3v [Sâe»›aH¤Å-/)qê´™(ëfÅo‡~=ÊÔÇýiç9ÕªC÷‘ëå}óååcÓZÁ ýÍб‡¹®_ÿÿâ¿7‰ó~üè6ž¯å÷1YòµÜ88QE̘«ˆ…Z+/å ²™ ŠT—Åâ.W`™8Õ¬k*±˜’¯ŽýúZ6 +Ñ2Ôåc±ã¾órÀnÒ— Î··‰AפÔy"º@xÅa¨8zÅ÷“ËŸÛAÁs-7ÂDËëcø-Þn\amŽSõãzçÜýÈlË*xý« Nþ,/c(hâF ×Qõý^gÑó‹Y¤oÁ[è |þnÿ·ïσïÐ%à;tßœ FÙÔ°c!¸p!…b­Q°©åN R† O„íOÙ¹7í£,[¬a¢5¶Z}&,½I±9Õ¢.ôyWÿ»5LSÜMóÊî8lÙœÛ]è¸?nã™wüÔ«Ã,—_D!A¥2S‚RjE/+‰R²è­ÅÚˆ¨Yhÿþ³ÈkÌ/üg̉rÙJ‰ðL ë‚­S‡IĹ9ÓRûñ5jQÜRîÊÅ7¥É½à4[ìm[$Sâ¥Ï:>³%4MyhxHCÑÓ¼.ŠQ9…º1ù¨ZŠöº=E:ª[–eÿi}dÝ™ŽòyÓ4öú«ûð7qÓî ã¹ÂóèvõŸq¶«. ¹3ÐöxmØ>ukØÊÄÄl퇗:Ï]Ø,h@n1ÉsÊÇäª~à›ÞÎ!iôb1 œ¶ó›ÚE!–ZT!²;[¸0$¿7Áü$õ°I¢£|†ÑJª0b,¤[>ÈSÚÛY}]\îoÏ·ÇXÀåfçùâ2Ž2œGQûÇpžW1±¤ÍFU ‚‰eîàv5°äÆL·]¶ÝÕ‚Í6¶=ÑÈsèÛYLþÝÕjl¿º2Œ¾ý;¥:DþêhX\Ú¸êôÀ-ú« úÏ]æ,(eçi¡qZuÄþ&<_Ôï2KzSÞy^–£`šõв×ôÒàk/¬¦g¯Ó eóx‹~Ô98£ž dN3T²WÖÄÐ˲b/TÜÍòôÏÙOn¦Æ‹c~\/ÜÏ,ÊÌê7+Ž~hßþÇ}Ù$ÉŽÛ@xïSÔÔ!‰¤(ÞÈ›wÿ­Id&©zÂã•#fW_w•Dâ'‘ˆ?¯~P% W‚V©îÐcz¦ Ô[øvKS@3 „1AèƒVèYéw°WNf½D+ã±–¬¨‡È®”¿ IœóZ’woÎÉ }3w–)ðá¢× ïžQ€}†ûã^¸dBöÝ’j…'!Íb¿=ÊA+‰¢¯øÅ@¶™ã^¼ëÐ Av'¶à•bé‰aÖt/€ «pUŸ`[  4¡ûŽjŠÑ¥hà×Ñ4n·£Â'f‹jäæŽ¥]Òº§ü¦Ì§‰Êù²µöŸzmz‹öSyi·h© ÑŠà ù7Ô +÷¶ÄpÊ€aŸ[¨ iEŽþ½'ãºbA’…߇ï÷zø\þJ›A?Ž8ü†×.µáG|ØË7ÓŽú÷Ÿ\¼§Ì½¾°êiXßì™ôOß·¹ËºîýÛm›?;bb£ÈŸ?ƒ×߸ãŃz«ç ý§Ÿw›g˜±/³|â Ô5Dl}”÷ßà1^øûju}é…%ž>êK»ú>÷˜÷>Û?¤ÆlÅ»ýE!ØàasìI}Øî¡FY˜žÿqa¢N½d‹'¤ +©ŽwÍg‹Ohœö¤žGÓ‹ö$Ñ_(ý#ö'%£6M1®ž¯¡Æ/¿Pð÷ù¨éù­¯±‹«¾‘ˆ ¤Ð¢ãÜb¸³{*vÏÑîÉÛ} `QÔò¶Îûç/ö5§»'jf°D;ßáã_$‹#‚ýÁ,5¶‹È&ÀD‰žv«ef»ˆüÛ.‰€ÀÊÙ!œIþÉcˆ–ÝâWDäÕQçÞ5£ÎL”³!"dþ^5Žçýpp‰€{ÀÝ[Ð¥%ôrWBWÔøíÞTêáUè΂qYñGÔ¦ž3Mb¬/ {ñ\`ò,a\yJ±C)ß%6›4xøêÚh2«_Ò†š&á}%g©3qléøT{l_6tí#JA +>5ÿðË7Zô7Ï›9÷Ѱ™yêàQ#×TÝߨJƒýùàñÀ%8N…µy±<9¥ã1žµyfÇý—#ºí3 +mü›„äÎrAÿ›-BWªÙ‰ÃµýúÓÌý3 Q;fKÖY$ÿOg\ʪ·‹Ò]KœƒØÇ7è " ‹ä.PbBH¢ãGã<´ \ÔzXø¯ÕAáóÖÃbw%QBVìcë]oJdË… ¨ù²^äe½'æÉúõ, º€kø‘5ÜEÍ¢ +aùsZÇ‹Yû4\9¥aAd`Ož¤8ÃÈÈÄ!áL@™£U\e‹ÑtfKG„+ñ/¿0¿e“Ÿù2¡6åŸr+=E8 â8.ÂjÑÚb°Í¿*b°oì5[Âa¿=ëÀŸÞ…ÆFxcI, ¥6øvØá +œF-˜’ >DxÁ¥8âºÂ>ÿ½¯Ç‹.,–ׄåH7*Öx ¯Úâö«ÙS¨ÊLÆq-2K/DN&¦ Ueù›8Fd·"2϶Å&Ѹ¢ŠÏ+#ê3°<þ‹bƃ÷øDRÙT(.^›Ên%µ’l¢õ)B§ža¾£¿ËÒqW‚Ba÷„H@ð» • õ ÞD½:3?㦥Õ:CŠWí¯*…º~€>[ÐM(!°"Œ”jçy’„yæËï&½ëšÍ¢×¦_iYR0))™ÈB2çb­®d O¾#*ÅÒå¨Ç +Gõ·,oÆ'¡dŽP2וÌQ¥?°S¨1VL¼Å¾-’°"í^©FÕL©ºXúõl±¬T©Þ=Jt‚övÜÔ¨óŒ~œè㎕]hš°ä,*Tn¹ÈÀ—z{i/ÏÁ~Ù±6©[¬ª°•;cíÚGÆR>qD¡ ±ª­3RÓ¯äþ} :Ç¥ÅLæzÄ›t˜^9ÌQþ§•ºYL3„k˜¹8J\Ôv0éQa|Ñ¡\Àbèí< +;ÚÝŒe,èFç˘dˆç'3q`ÉÒá Éîa„«2ʦoT„ãx<êíZ·Mù21IžÜÄéZp£iSJ‹ëÏv§IÛÑ•W ]ˆøÕÝ)NLû o*ŽªàIÔ*V¶5ŽÊ+ð¼2¢çÌn5*¸Ç'³HßZψG€üù¶Á ˜x2XY‰ÃL‡.qœ±«.S †^DWÁ¡ïG¦½|"ÝöÑÚe#e—-:¢Úû'²[ÍbˆÎûup´#Ѫ¨gõ]æMœÎñyu¢Ï³úŸ­´t/h¯y\AKÍi¾EÔFÚ WV¢ã—¤]sÔo¢ ‹R™%A®@9‰"$ø½õ®R +Ñ#ql€¨^hÿþ;_øˆÿo°Yr¸Žxª# Ö†Y¥ó8âèN­+³›«M¡CT7Fö×f7PÌÉ} /¬Ž8ÐlN têB:u½•N½P™ÍzñÀ4mNf÷B +*Î+4çªa.3Pñ£Âì°eˆ=ÌSÃÛ’àÑ«±DœÉs½¤ów9¥SuµåVšb]º ví6Öl£ðoIêÉèÄàž†ŠW°+â4„lD}~ÝîYasã+ýž_Ÿ×yn‰Æ«??‡†ù|P|Ë?yz»í2nxÖ÷¥ö¾†Àù)Wû©w¾ÔNKº_±DÚÚ€ŠJÜXu¿-Ñ1>¨6m´«xÐc°\nÇÌ_ÈÆÁ|ÈýÁ¨ 9œ.¼`Õ¬ oJd3làg˜aèH¼hEÑà4#ú‘G½éš¿j…Õ+ö³Q­ãéâçÚk¾ûꡃ3­vØly“âÏê¶FК{A[ÏVp-5§éјÉA®¬Dǯy¼æìßÄA‚,jʬä('Q„¿]ï*¥z$® ç£Úß?ì|á_ þ†Àá™"¨«‚E¥Ã8âÜGÖ}ÙJ +TQÜÒ‚g*‹Jj³à4’¢ì,m@ÇS'ÞŽ·Û'öèfEr]±Ï¤qÿ uÝØÎëh˜nL¾¶º…BCÚÕÀ*P +ë^Aãó”Aמ5G|Ç Z'Ú¯«ÛxŽ[õ°úWçE§‡V[QÓ-1GLEsKQ•í88·kçíÙ„8EF» é–#‘ i”Àb…I¯˜'£xöÏÓ'j„ŠdWvÂù§ä‰2‚B¹IQC¢;QÚT¾ß6¶šÚñ¼ü%œÐºc,?HGű*,ê†á/q“ßáû¶·òhKKíÑ$ •sªsD…òeµ„ÎEQ•¨1Ûëb ZõZR יŵi s’Þ¾ÃçšÆI˜2]H™®·R¦7ŽeÓ]<0›“i½çšlŒ©a3Pñã„Ù É{N0O k¬¤G¡þÅšàLžÏKÊ~§”©>mi)PSå¥Tƒ}vk±qð—4êÉèÄà3VŠ¿£/+á´€l;}~3 uiÖoÓpÝ_¿/ó4 ãBGº,7ôêjsŒµn³Ba' ê1þ5‚Žâ‰§CJ»è6™-) .õ yŽ˜Hº‹ ò¹a?ÚA1âc#cÉ‹†ér'[ù"¤Z„µþ‰¥[K¯Ç†K”’Þ½Û_cù´ú‡©<„¥3­HÏM?—éinIĵ{íÃÓ³:5L–·÷4ãÖ®3špüluxsŠÐ¾ ׎héÀôÓ‚æL!Ž—&yADï;J^¬›•¸5qõ¡‚PBD3F?âZ"èÄÕ˜ÊAÆX*“%K7peµDØF¥P) ¨}Æq}’ºÉ‚²<ÕfBÓ7Ì.Å“}ÕÉž#©Ø¸D&°Kʯ­ÐLA&©<¹*I}/T‚%'‘ñ%6¥LMÎÆ'œ$°+HbY¯['WIã’oê#g¬#nØà+Æê d#h=:Ñ~$Ú­)G2"‰ÒRkþ.L7 +TÇÇ :¡ü÷#B‚iª;íÓç® òø;æï–ô R‰ç–8‚pöŒ¸U°þ¸ñdl,¯# Ü>r™:måÔ@ˆz)‘E_/&7œ<Æèë –âY„’tBI’Ö@Òó7•¤¨Iø )ˆDJ(Iê'}ðÈP×§Ÿù<|÷Iˆ¸H§¢ÎD²‘Jz ŽŠMsdL¿«O•ªIáH{X“e ´ÙÊY†øúˆäOnGÌÓM^Ò±½¸š>s²b^‡}8ë7ÜÓŒP !í·&R†æ‹´|htBošM +iJrEÜ%‰RŠ¡·%e#â|ôBûû§Hj¬/ü ô…r†’á™"èÕÓ©Ã8âÜ\i>ûñ5ª(n)í„rQ ¦´¸ NSͶVK> “㩯:Þ»ÅfšrÓ;MñZ×E1*§˜nL>ª–C{ ºÝ‡´U·Ë~oÞËë.h¤Ïë˜Aמ5G|Ç Z'Ú¯«ÛxŽýgô°úWçE§ë*˜º%æˆ"€‰£è`n)ª0¨O/ûEÉö&ŠŒ6vÒ y¡†S_Âð©lD¨)YC´”l#ªQS–„¾éTúò¨Fþ)¹U¢l©ðimeS‰zQï§2FS;žáp}kᎱü¤}ĪD°¨†¼DÄW¦ŠζDmi©=šô®rNy¨‚°MêÕ²>¢ŒPT%jÌöú£ƒV½–TÃuRk ˜]§® +ˈóMã$Ì`r(вoµØ ©»x`*6'Óz1 +:Î+4ÙSÃ$f âÇ ³A“!ö’ôJ k¬¤·C´}±&8“çóÒôI§çÃÑì5U^J5Øg·±› þ’F=|ÆJñâwô¥Bûé ȶÓçÿ¬Í9~F½Ÿö²68 ý–õaå¯>3n½of4ÚÓ +Ê:y4›²Õþß’íÑoÊ6³ã|Øñ\첨…UXC53«òÍ(µÄ•Ç?s­ùÄàöl²¬¥.¯1@²wëOëqó’T›ns)b×FŠlÿ²‹Öä^7nÏ„¿WÂu—SÝÇírÇO¿zv¹”½ÛQÙjÕf}Tš¨%}pwF=>ß²«ÎŠÚZÛøÕÑÊu.ùLÆH*BãHaB!rN^€Å‰ŠÁ›ÙªœøV%’…±ðåU:øªŸ~dü:hX΋òy¶DëxºxåÚDßï>NPå*FO#áoRœW¨B´®ûxzÊœm:mcœ×ׯ㚳éË/Ìo)¡›‰XÎ8QAt\+Â36„jÔqZ +>)¹]î¿*bGÿ Ï›)!ÆÎžò’ð˜ÑwÜŽæ½ÐV©4&CÂ*AØ7N«‰• õ!<ÐÿŽÇ™ñœÿ^ÇãE’Tá’¶šnÔ¬ñ˜B¸½+„jͰquMôÂPA]ÙEþnœ3²Û‘Χˆ,fŒæñxÄýÈèòØÿ•´4=Ÿ\c¢©¤)×á⹩ìVšV3®ˆŽú¡SCª¿ïMØc”56 g$DDª_´²/™¹ÞÄy5uf~ÆMµ»u†&^·¿ªúúúlÁiƒV„õÒí!±A¸÷½f, +ˆ‰Ñ÷YRpSšd" Éø©½û$yòQ)Ž]Žz¬pvËO|2“Ì“ ÇõIæ¨ÒŸýʱbRÂi]¹=iïôÎi4XÍUK¿ï#Ôl×Ô»f‹NÑ`ÇI³oô‚)áX­ëm&ÀF¸Û¡XoPÀÒõng:ûÅF‘s+ð€'ÚD ì烶™±õǃwQhƒXÈ©V„ŽGH‹³Ç:÷˺‹©\Yt1ÛŒ}fã‚D»¨ L›+;¨•%)žÊMSzÃqp%wì…» x7%;…Us¥Šª349ý‘Æ0ýêØ‘û:-ö˜°[4Ø/jñ>ãq§÷/Ïíz* {Ø.¡xe±A”~ài¥„.Ó¡¤¦ePâ¢æ5—Ј +ã‹uç8Ci{…'Úݼшh$Lé€U@bâ¡ø]á É®a„Öæ?ÂË%Kv†¡ó¬¢6à>¶%ë³£7Hö?E$íêœÌêvUÛ? (”M!T„ã|<êíZ·Mù21IžÜÄéZp£Û¦”+®ÏK¡òý‹v!â_Two¤8y™)Ï.^O¢V± +4°­qT^gˈZäöªJîñ‰Å,Ò¯Ö3â ¾m0(f'ž –@Vâ0Ó¡K\#†ǃáƒÑUpïÐ÷#Ó^>‘‡nû‹¨õ唲f‹Ž¨öþ‰ìV³¢s|¢ŽëH´*êY}Aͼ‰Ó9?Ï¢NôyVÿ³5‚–îí5¯‚+h©9Í·ˆ®™6È••èø¥iלõ›($È¢TfI+PN¢ ~o½«”BôH ê£ÚŸ¿ØøÁ?ø~ƒÍ’ÃuÄSa°6Ì*ÇGßpj]™Ý¤Xm +¢ºá™JdžY%ùáEèÔô¹ìïÛ}Õ²Baƒ’#!ü_ÐÊNP·Å Óô[ z²ÀT(;óÃ{j²ÕÇ’Sí¯*…ŠUfý|A·•+Âd‚~’„™Ë)ï&½a¯¢wÝÖíòÈŠ‚›’’‰,$×ÏQ«+È“ïˆJq„t9ê±ÂYý-ËùðÉD(™#” Çu%sTés«PcPCÐb¾U( +ÒÞéZ2.V3¥ª±ôëy優7f‰N€FyÇÝužÑ7zÁl°ÖÞõ¦ K΢B7³èZü¶µ¥/í+ûŤHHÝ +4Í 4E ¬ýAûÌXêãÁ'Ž(4!RµuFjzàšÒºg….Ë9£Pp(1jœg +)'¥â%ð츧ìíá*§,UY~”xq$Ód¢(ÜdBàÃdÒ(ÉUÒEåEïË6Ò(¢ŽÃ7b^¿|#vûÅ,^?ý¼ÍÒïÿìûHn19Œ¼š¬?%³A”àiå„nÓ A_‡¶ ÄEד{¶€FT_t¨[|Ç™]:ó(ìh_Yú>2q­1GÚðüd&lA +¤ÃA’ÝÃWe$”M!T„ã¬ß®å|Ø”/“äÉMŒ®7ºm +6.\ÿnwš´]9qÚ…ˆQݽ‘âÄ´¿pPqTO¢V± +4°­qT^gˈZ¼göU£R{|b1‹ô«20œz"¾m0(f'ž –@Vâ0Ó¡K\#†ǃáƒÑUpïÐ÷#Ó^>‘‡nû‹¨õ唲f‹Ž¨öþ‰ìV³¢s|¢ŽëH´*êY}Aͼ‰Ó9?Ï¢NôyVÿ³5‚–îí5¯‚+h©9Í·ˆ®™6È••èø¥iלõ›($È¢TfI+PN¢ ~o½«”BôH ê£ÚŸ¿ØøÁ?ø !ƒ+Â3EpW•ãˆso8²îËVR 6Å !ÝðLåbà’ÛÜpYQv–& c׉÷övÿÄÝ­Hƈy&ƒø­ëÆt^Gƒº1ùšêX‰´»UáÖ½‚®ÏÓR3ÿ×¼â—8NÐ:AÐ9¬nã9nkT¯€Õ¿:/:=¼ÚŠšn Q 8ŠtKQÕÚѨ[ÍÚùEg^Bœ"£…݆tk#Ñ:“”`Å + ’?^1O‹b¯Ÿçž( iM\Ù‰µÐÈ?¥¨EP¨m‹¨C¢o¢\Sù~›ØjjÇ>ü[lBëŽ1ü`Äj‹`Ñ7\ð-"nö;ö¾ Ó[y´¡¥ö(²†Ê9ݹ +â€óeµ„ÏEQmQc6×Å´êuK5|Ìl®Ík ˜“õ6ìŽ8Ðç.*%–FQéEÉ*×K©¨tYjÎÍŽçΕMc¯.Ù0!2³ÅÞŒ¾I|ðø=7ŽË³S´7±1ª'fãÀ»Õçuóò‡›j"±«?WŠl…yfP"Ñõ´yâï¥Poý¹ãw–ÛTÏ2_•°·ƒšqü‚N3äF-åXä„°ùTY¡kdÔ"tÀDqÕšê…5a ¤N-y G&6©ls-aOg„}#.th€:bºÂÃ:"ŽÆç4¢ +Üã­ÀAoq”–iöDþ6ó$°8è}ìvú¥Þ‡€û™í¾¦GÑaE/à,ØDX'i›Ü¹?аlèHX6´^ÜM¯mr͵ ." ÏÎòUÀœê_"ªóP¹pB¢ žFH„— ‡×‹ÍèoØMK}`EiaÝ¥ŒŒ µ$ì¨á€tl5£‰Ÿ°¨'…¹Šº'.êºJûÅ®{a¡W«WŠL±gxÜd•àŸXà"dPvEÈ<^ï¡~ŠÊÎj«<ꮨî¦bŸ­Ì¥Ï3¸òóHÄ¿ì—Krì:Dç½ +o@Q¤>\PGôäMzÿƒ™Xö +:<ºu®«$ß̤ë®»¼çD–Фá]¦gZ)$q"Ô“‹bû$\uùIh”p–,Hs›"šdScÛüSp†ÆšõÀ~…¦×ž”c§}õ–¸Ä”m†91d(Jίµ¾àÍרi +ÚY›oMàá6ηé†N_=§62΢ÏvÌøüŒølWÓgxÈXùPxFn£×ã¸:æºÎŒÿÕ…ð ]’G‘±·*h? +°è¡¡¸¼šW‚Xƒ~Ï'š^È·=kžyÔ˜n‡jDPµñÙƒs¥×JžëÈæIz<AWýÛôÈOÚ IB¶ƒf¼c ÉF„ªÝb0éö»¤±m‘5¸^å©3Ûäq.Ïcâ?¸›‘Å—®;2%ÂÔÜþ˜"LƒágRëW!ô°#–Ÿb&b)&.„á¨÷Q¾œåJ´_Ÿ¸}èU„&Œ¢Zÿ¯;’S¢nyÜ2u®ø%º¹ +B°Ã^„›37HÁ6Ózp½æGné¬bßákù—/_0Â8; N@Õ‘èE§§€ÑÝ(vròÐ"Lhøˆ!¦A¸‹¶š G™ z8,ÎúÍÑ‹?$*8KyéÈèH‹ja—>ðJi¸«~÷bwVˆÈm‚¢H‘86aGØ>‘¢}²&èðv¹S:¼]n6y–œpÁE|ØgéÑõ¿0=aØ#D¿ð®Í ¿ôÉ7~Îlß@L¡íÃ]%C$na·ús/ŒÑ‘Œ9#IQ>rRÑ öq¾qj¯-=ß\GQ¡pÿûoûÒêa¯ÃLì° ½·ª&ö­î+·ö‹Ï”Íñð?´D}ùF¿_4ÂcVL‘°¥â b›baÄ/±1±2"JHab+GÔž‹¥§•§ƒWËY½á&…‡ãl««üé@$äåVc¿ïFSk«vçy¾Ò–A¦ 0ð¤ç€ˆ‘–~mæçjõLõ‘4àÎÔ"Iç(„Ž_$>á¹[©ûÅÒÒÀ?ˆÜfäòH‡ÓgÏ…‡ +Ç#'zç–JÏsÁ{Êô¨Ñæ¨8x‚»Ô@_+„‹TÚ±«$$BXÒ+±¨Û@ ¯@ȧÀsë©xËW¯¹¼møð²~D춸ò×síYhÐÔÞ * 2^ð¢Âð'zPïqd¶=—Xû‘iÔLÔA¢¯H[IÜ­³Jð­‚ö†‚® ÀCI$ú—½-B„$Ý-¨×xrCÍóÌÓi@ví'å‚x³,¹ü.­]ÂÝuVÖ&ö¢”l|ÐÁð¥·yŒOž8u¤ßGó²|D3÷žMÁ°&žhŠ›£ £¡„ÇJmV¬ÍF=–øÌ^Ñ‚º­ÎmKËwÕ[¢±¶j·t‘ã-­Qn”(«J<àÜ&^Ä¥g (‹8 jˆgU…á'*½ Ô,o­vŽ¿¢9(T¢…É6]©~æ;Þ©ú'þÀŸøàëOèãŸøÿ×ÛÝÀý=Ž·6V€Hmã=déUñ{ß[ì.ŒOþ] %êÛ?qŽ÷Ýï/þ”»õÚ{,û„ oŸ:Eˆ-’÷ýØïØ-¨ l‡”Ö)@’ý-ªÔ t×»'Þ4¥T±‹ZªñÍó±ë¥¦Q1Xz%{™”/e’•¨FÄ{ wbe¡Øñ¬ðQ¨v $;ÂZCYý§Ç$¨|¶_eÓØíp¨­£Ÿ‘:œD{ð [·BÉ5ÁJãD¼ä"; £ÈÉÈ&è«è°Æ¡9õHá³|Y¯ÿ”t)-ê3¤Òd«ÙḚ̈løßPtø_kÃ?!á +^#4¢^²à‘«‚×Áyƒ¸ß˜åxê“‚Ó?÷ÑùŒŠG;*öÑ*Ú|(xö§â…‹^Ë—Ü4ðZÞ;gù«íž²Òàp³W´+ïý¶K¦6ŽŒ'”In´·ùDJOyÁ;³*‚ßgE©;/‹¹$ÿ©u|ÅâÎËAEˆ +lsùk£¼#B÷ü_³7æ3@è‰ÁfEˆt4R^±¨Û;^ð´bHpJ·â*¬³m±á –ê•4¿§fÛK³¥À½Žã+ÅðkZ¥šoŸáÒ×Ïc£iaÚƒ2í¤†oNJJ:aòß{;#®/==2 ÂÅAÛOôÜ¢:ë“¢”‘[œ!Ê0ðÎÃG±ãžÑD/¢Ñq£Žj´­("~9°®…nV:'Òê¥á †á‹*IûÔŽŠ>ÞÉE.ƒØ®j]h0„½ÍŠ®1õbd%ÒÀØp6&¸«À}Vì£Ua.îEOY’3ú!;ßÊŸsŒ÷æíXÕ´Þ¿EéM·‹ûò±s Icr¨ü47Ëß?øwÕžß}Îë=§eçÔ^ðc®¨q%ê´¸ DK„ )ÒSÚ²mÚ²n@ÈK§ŠŸìmRøÕs½Ç¼ï¡å¦$³®…\B£”Žï»Ÿ±?`c“ÌÅJõ£ íóAÖx×%X[%í¾Ç¤ì¬Q¤å,¡úl–!>Ç'ìÇÔšùxÑîÇ–=±—ä&D>ÆòtùAÕqç¬pdÈd†Â6ùD¦ò³A²[–à•²+kºE( x@ˆ]JÂ&ÜÓ¤±2ú+íCòþ•­MýŸm2)öÃéo…ô·SÕ­ˆÍ. ˆx$z°6ÙED9Ñó±Uc¹)Ø¿›ì)&ë&'û<|kóZÂTæÄ’èBÈr ÛõsX€¸5ðJÛ/ +"Áj%É"¡½äH°°$Y-ºíÕ£X­B÷(dÕ›tÍú;‹AÒsÔ§<³²xˆÐ‰I®@êåÔI60tu “O:ž˜:Óop<1¿R!ؾØ9=MÄ(‘<Ú®ýzs"›TBh +˜žÞô²c–‘t`sÏ>ꚲ_åªkZMS +f𠙤_l‰¥Dr õHá³|Y¯'ÆÙvY–ÊÒŠ¢I9î[ ÒTÚ;¥¼«sµµ»6*"Yñ)~›ü”ðLÜd½„¤¯”@±w4‚ -Ž¡@’è¦%Ñ-M¢ûŸDwG‰×~-x-_~pÓÀky¯Û°Uðª˜}–°-ç–›=Ý›Î0çØó#ž0•êV:Ο¨¡·ÏïÌ"hÛ:ÃXp¶±X^ºü§1‰^gå ¢ Ô”$¢¾Y®¸ç§øš½1ŸBOü>¢u4Róó‹–_¤<úSNñÞæ +qÖÙŠZ…ÃS½’æ×à4Ãl{iö˜‰ãm‰\…ÃÌ'*jxs¨d†k'¥]¤Õg”i'5|sŽT"-ÂYtâù½·3âúÒÓ#"\´ýDÏ] ª#°>)J)¹Å¢ ï<|;îMô"º7êhñ¨FÛŠ"âÇQ‘ëZèf¥sÒ)­^Ú’ªl°ÔMÞ¸¨5y!›‰>¤á ¤*Ú0‘úƒè*Øíâ‰÷ S/FV¢Ï7 Á˜‰>9 î³bÇ…„® 4XÐ'¶ÞËážè{ •¯/Ý·)®wÅ)WÐsî¼íÊu™Ö j™zʆH¤¹Iº K¢.P¾*”z”! +m²¥þ"Ê»6,H)7!ý*€™º¥G%J¡¾¶ð¤EOY’3ú§½Þb~ÞquŒ÷æí½z²ñþ-JÏJΟX>v®¡ímc+ßO†y™µ±üýƒ÷_ÏyÎ÷¶»ÓÎ2Žsj/ø1WÔ¸uzР¿ô> =¥-Û¦-넼tªøÉÞ&±yÿÇ~ÙäÈŽã@ø*u$K–í5ð6o3÷_´È`”+f×3o—_U¦-ñ7B2À¹ÞÃ긖G˜‚ÄÃ%R R‚d­¾T±MËHÕ6L˵dv]@SƒGªºÇ¨ì¤Q¨å$¡ü,–Á?û'ìÇКñxRÕcӞȊ RB#y‚waÇO†#BF3ä¶Iï@•¢Ý’ï]™ÓMBaÀ²hHÖ¥FØ„5üHx)Ó‡ÿ5ûà…\¿¢³¹©%˺~ø;ÏvÄ0;X·$kvZ@Ä#PƒUöj>J6–…)Àþ-´§˜¬…Nö¾í­Mk SÙ&EB]®«@d[¯”ýr³ ä¤A î% @€„%Hj1Ñ%¯Éj%ºF"©Þ ùäßI ‚î#?E´dă„N :p£žN1$ƒWÇ0yÓqûÔqxôÇíó+2€íÛ-Õ¦§ˆ&‚‡Ûu©!,—Md‘JM¢ÓS›žvL2ì©Ñç]3’]S–Ïp Ù5í¦)³™ 𤶄ž¨ÁezUßЮ³k.².{á^™Z¦Ü8-2”yîkíúé3Á$Š¤ÂŒÇ• (S:è0/@mÆc‰8:1,9cÑÅÆÑàÕ²yNvTÏt{2«å‰®–#¸$dŽ­?ÅAÂ.AaáÙ¼**%Qú,¿b€ðDf½™QÅPl–gLéfõa³YÏü&›Öæ9™eͪ¡¥8TÿhžÈGïíË|½¡Ÿ­ªÈ’l¸P¦V$=&ÇUc³AK»š”WuÎÖ2íΊHfœ#Äo£Ÿ"ž¡“­qBúR ${gæ‚ð@‹c(˜ TÓ¨–&PýO º£ÀYç†sûò›:Îí½jÃbTÁ«böuøXÎ-5{¼·9ØcÎxÂT²[ÍqþD½úlxEAû ,ûtca³ÍŠeÑÔŸúP4Ô:(¥#§¤!ê;ðx2•k|ò¯Éã ôÄçÍ£å9O1¿iùMÊ£o15áïíÙÁ¯bu¶#WáÐTïÄù5lša¶-zºÏıZ"Váó‰ŠÚ,™!ÖÍW‰«O(ÒnÔðÍg„ú#q>I'žßµ×Ew÷ pqPù‰š;GT‡c~’—’#r‹3x:^qx/vÜÓ›h!º7òhѨzÛ’<âÇ‘ÑÖÜè²J·IÇ´jiSªZƒ…nÒÆE•°ÉÉÔù@ !•Q† ÕDWÂ.”¸L=Y:ß0}6êäLXŸŒ"¸QbBØ|¯ ÷@Ý¡|u¡ð¾qEpl7™8µÅå´ÅÜvÞ„vµuÖqj™jzJôާY(]Ð%^(_ JÝË à…‰6)¡¿ é]$•Ñüª!:3µ„G5¤>4„ø*îI“žH²$fô!{·±Ôã1ÖÍÛºz²þþâ¥'%§OL»­¡²ÚXÊ÷Íp ‹­6êëÿ/®ŸÏ9t$CŽ2Ž×1¹ô”;rZ‘ºYÐ0{:Íú€ø”¶-›¶mÒÒMÄ?ÖÚFÖ»’ŽõNÇ¥<¢$.‘*hT| Ëlµ¥jm’8FŠ~ta"8® j´éš:RÕ5Fa'}B)'ùägq þÙ?a=†ÔŒçÀ"ª›îD6\zÚÉCä(î|22z!wMz’ˆühDÝ–$x§hÊœn +EC²&5Â"¬aGŠH™>ü¯¹/äúÍEý+9ÖõÃßx¶#„ÑÁº%Y¯Ó"¬²‡¿ëJš˜¶Á“ýç/ùRÞvëTcEíèÏJàÌËŽ–4zŸ6#lÆØ<±Ùt²y”8¸ÞºO?ÎÜ!&œŒ–˜~BMcó•„¶çDÅ€à´Õ´r,cÐ#‘\}Ž´ HÇ8a•8é®|‘= ˆ„%EÂúÂYP…A—Î&ê’Beó²hI†ŠDƒ²Ä´‘w„­ß=ÖºÒÂñü‘Š}íþ:“.Ø•€©„™ ZÃÚÉÆu·Š(ÚM:U8i“Ðߤëö¢ƒÏÔ£x=ú)QJû`¢õJCÿÊëŽïØèC_Ȱ K,´èI#`>i\gø9çÁ}œž ¡K*¦ƒÑÿ=§¤¼ßW"ôṚýôþ$¡ƒA­š]˜~ZП 1dðÒBÕàÈñeˆÊÃÍJ\ÛPZ‘Q(1@W¼ÊØQ7”Þd2 +0u€ ±•\'”´–¨ùIA© M¶ƒd´ ‹YR%-Œ¦Oå6‘JL(E«JÇ‹6H¿ê¤Ï ÅÝ™¤t’ŲJ¡ÕªêÈdu¢{ãú޹Æd‚5 L¿#ŠÃ•¬ñÉ +Ïd‘òR‹×a5¢¤qÉ7Ñ9=:HYtjä$Æì d#¨§îê¶uHfÍŒ°­œÒ^ëþ.Œ7 +’†ÇÇ º4@¸6 !Á8eŒŽÇ/ òø;æï–ô R‰ç–8ñq1lÿoà13âÉXZþ^GX¿¨>yÚfS?!"è¥D}¾üœw&1ú:¨§øcV¡$P’F2Ü ±$I-ôõ—i"Òá2ß%”?xdÐê%ýÄО‡ï“x*OnåˆæöôÌ•sä|ü®>U'…#j M¨³Õfâë#Ò~šJö´‹ë!¶ÉÑ‹«ñ³Äç5näÓ<°âžÒ… %¾#«âPéËQ.!9%#%Ô©áŠ×Ãàh*7>¥$RgvÓ³Œ¢0}Œë»õ¹‘ö%ä¤JˆdâÜdÅK ÕçQ€>ë"+ ÓC-QRP?õOR^Ð}eä°>s=”T£wzI ™Õ›ŠØ…æÙÐ9[¦è«FJ´6s„ JæCç&œŒ¬gŠ¥w¤«¥ÓÑé4‡¯°¬•02Є®•^èÒé¼£'åhŸ””aʼnÿAXiá²jÊoÊ|*¨œŸ¢éXºÎñoMÇÕçÜEÉѤ_>—ÄëèõiY4y¸Ëºûq|d=tñùŠä-îØoF®…s)”Î䣎7l”Y±‘Ì.V±ÌŠ Öò.Xê¾ÉŠMi Oýú\2«cúÉõ;7;þ•eéìôábó!h¯•€ŠÝt‚¬ínƒÇî>è€,6Ck!b70,²C_™zïŒÅÏ9¼5 ë§Rïó^R8koÍv¿Jeî»2c(…È‘¶ µJâS ®Ñ;NwK”w3oëd­#M̾ +-Ý“€|ú‘è¾²¸¼UcVas‡(EÇ’¤©CÚŽ+ ]HÔþf¿Zv9Žà_Áã.Œn×#ëu”$CØ€aø`k°–,ÖE¿ïÈÊʪj²93,¬m€‡]vpX]ùŒŒÔ¾w3 ˆêUdœ»RÒm8WÁ­³9çþ$b=ôpKðB^´ñ@•ŸÄjÉÃ@²{(Ç27BÖ×™Æî¾úй>Î«Ž ]ƒ8Á[4Ñþ”nEºvqÏkÑ(ÒMN€>³ÇB7ôÈPç1º^èŠãÓiQÑÁ°±±B1HZ®÷aC/u…k-Ý¡tü6äÖ|,º†j +ÓèºÙˆHÜé<%žˆ0¬û…KÏ÷)å‰û¢=5™µ~5ë¼™e-ˆØÒ8:¼ŒÌC–¸'”øjª¡’M!ˆ«w Xæsƒ²›ß’Ëüއ"éÄœ¸ÐŸ¬ˆ C]2¹D.wÖé T\îü¥1÷-2’|Ë€iìÉãV);¥®b2Û´dK’ÐLh¬œc ËÓ*(‹ØØ­J¥8]žI¿RÓöRØ™2!éWj;ô$m6E®­*VµªÛ|Ý`íÚ6È|âÚuUöžÖ/ÉžuÑq|Y£qy–uQ¤‡4£@˜í¹z§?”>Ô!0žÇˆâT] ñ«þ´Háé…VÕ Ô€¼ëZ«š„PC=øc€o¸} ðÇã·þà¿Á'ËÛ®Lr9Àû …ž±´nG˜¿ °¨…=,],i€]ìfžø=ÜÚ\’صÁÒfiotI9ãØþÎýºhR_[tÑ” «yRLKow)»EKh‘ʘ1÷ç +˜°mæ§<½ÞkVÙøÚÅ#KT+diDÕsÚ|£„á;­ŽÜªt7bGk˜"Kõ’‘ªF,m ­Ag!ÝÍyGõ€ÊWW(=TÏù¡z¶ªgŒà‡êy¨ž—U{¨ž‡êù T/©°oS=P#¸™Cï˸iÔI#HCØÞý +4Ôx£ñRc–Æ`ÊD2蔳åÖ |~pô®ò °é)JÓwTù@™VÈB‘ + +íºÁÞe\ò¶[“c;UX¸ $ÓGQ˜žeru4pzuÎó5u0é¬5yž¼24¹ZÍâ7Û<ÍeòJˆÐª>÷`bšÇ1b:²±·±&HW“'ͪüTøoa"*u¼-“ Ä3¯¢Z•Џ‘µªÐÈ6öú“¶6½m-EQŸãP†ß×P·â5TÓXeKáõ¶Ûö¤¦ ÂqâA]s«Õ† +´e†qƒHVÔz«I•;îŒitºÈ28J–‚0<„UÝPºHì¿AgQä¸è‰z×Û}•Q¶ãì-CcºY^·½¤©k)‰®Q=‘F<Û2 WZþ€.öªìy“î ÕmÎMSޝ¹!´¤YâFÒº“&ÓËd¨’D ”&_Ó4@¨$(òGB?‡~BµôGzBÓ °md4iV£>h–S~‰Ä!EJÏ2 ”º)­K÷˜h'¤¿œ;KQ“„2„Æõ +sš¡Î€ÖgMvV?zaˆ“l}Ç\­á™ —²©%&Qˆ30¡ÑW퇶6ëÐøÞuÒ éô-ÃVíÈ>ŠCËAkIDËØ)ØùÞ„šeLÜ2–ë5ìëCÈ£';dÓtà.ÓÎÐà´4,cæÎ+e°ŒEaäwÊüT £ršìš‚,ëD† —»ìYj6Ã1 +$·~¢œPQ±ý¯àM—úIA†&í{9³yaŸÜ&д¦¾ãÓéûƇ€1‡½l<]|l§ÿ³ñ†Pk¼é òÖ‡´5žVg¸¨¶‡¼Ob¼‡–²ÍÓ!›JUüf÷P.¼ ذ’ÚÜTÖì¯Î›@g¬ìùL„ÈgVcR=Wª¦¸Ì R‘ykzûeD s$ò®31à p9Cöꌻß ‡a[G™¹ö´Ùã±t}(s„Ð;^a’Ñ«žÕ§â&#K1l¥·×°óâ•\¦ƒ´¦äú8¹04B—ð>ñjøA9Öž=Ï—¢õLàÍ”/ qº´±Î-7]†òÈöþƒÆ³ûRadéÆÁôûA·&¼ãd¨D­ÆÚôÊIÃ=³ T¯¡ë´^ÖÐEˆ=e›mF ´Óœ(ÓsSææÜ|€–‚ŒööuB­S?)¨Òœ<¶ïåÌæMý}r›@ÓìÓœ§M6t^”™æÀªŒ‹‚Û«JLNÝ1½^§ûNX&è >ƒ~’ƒÍw;œNé˜^ç¯s¸Ûk2húʺGôºd¬~tW“ÅöŠ?¤×dñ[2ö~¯]\m½ãd°«Ã½b«‰î•“;²Þ¾=C9Ñ‘z†e}ÁX€ñ-‚ Ü!ë}Á¾xH¯!ëKæŒßë5t=vÇô¾äx¿ÓÐõdaÀ!†®/…¹öN¯Y×c´­¡ëKI÷·5ëzr.Òk²n5ÆßßÖ¬ëÉåc¶5¹¯‹½ßk{òÇdpò™EÏ;ÚºŽçcz ¥bœ¹ŸÂY×ÄÜ1½†‚5.¾µ­÷t=·Á`»†I£s_ûïö´p+%À¼æ˜.!ÿŽ Sœaëf`(×à¯pýiX¢úÈ&þéôõSµ€ûéôû'ûw~zz>Y ‚* +"ƒ¤ÓùéçÓ_?|õÍ7ß¿þî#øªœ?üåãßž¾=ýáéô_¼,ll0'“]3¥ø—N>ÿçÄïçpü±ÊWsþÿ¾Ýî>Ø/BIg›Gv.‡w†kå<μNju1 ¹±g%¶ÆTÿÇO Ḭ̀Góea“ÝÚÄcÌÅL° ç³ ÛÝþeþ0>r)z¬õƒ¡Ì<òmû_i.õ“‚jÙÊcû^Îl^Øß'· 4íÀí,ƇÚþXÆ,~(c޼µt±¢b¥4Z¯V–G%–@E*Ëø·TÖ8Ø¡ðÙ+ ²0Dî¬,ÿ¹“ãß•œnü]•õ…ŸxDD÷Y*+3Å{Weõ3¯VÖÞ!—P.sÄù‹‰Ú§3>®X¹Î’º87ùiX³Ÿß³—ÓYÌ–â ß-6Z7Íkµ—!šcytƒÅƒ¥â6z³:_¼›Ö„ÿvîÆñ‘ ´#00X=ô˜EãÎG +?¿#?zÖóZ %»=”×ìuPvÑœS½½~Q=ÐG,®NiDð‰¹:5;6†ìNöºu%®¶Ä-?`œƒšnÚv}‹Ayæ´wÆmïx“Êu ºi¡¡.‡î +½ðÞâàÂr­_¨þ:<Ø8êñ]dœ°·!FÇóÝø#Žy–ÖÑ.Že •‹wI§ŸÞcek +ºãÕ#‡nF™ÆÙî™Ø)”üÊ/„þ^t7 +?Y–ȨêÀ¡!0²C+ž‘Kg }«Øvç_ÿõËG–¸ç?œiq°æ+•Ü{½5ä0ú$[ã¯F å)×ÇËZ":ÒBñ—h71(p-‡yˆõ¦ +€ñ~÷ñéÇ“]#/W«ÁŠôôÏÓ‡…¿|ãºp3È›ôë~Œ +L…lï 8%¸“óYš'½7àÄEŽ›9bž6c)0Øs¯WÞ¦(ìp™çN£u7E”‘ç÷S„Xô-t›"_Ö@HQ̘¾Ÿ%E- ?mØ=®Cد@h +f Î-óKäeuóîp éØ¿ö˜&©d„²ê£|/g6oêï«— 2í÷BEÏo"•ãø³'ÒAfG0ýù¨†_o­i ÔÊ…ŒO_®éÏG5ü2æL¨ýò«åù vÚ¨¦Ÿ6›@Z½KözãøÒ|x¾¡ûŽãÁ×È.r_¾áÏÇ4ûzÏ‚Äã%ô‹·üù vÿúòçq¢xïOáò®ˆµ³ÿ·ä §+€HˆNâBˆŽÏÎo־Ď“]Q¼öÎîì›Ù™÷¾ B¯÷{rK³írS:)•϶ʥʙ‡GdŽ8Õjld8övlê¬/ÍHNu=ZË +ÃÃð÷Ø]Ë,¨îã0{:ÚÎÝÏä侕ÈÖb÷$$*Ftýaý¦îíº$ãG4ˆª„ñ 4d}…¤U­¹rH»ÂÕ“ 5nÛ`hí* VQÕáƒÍîE¿f FÛý†AïÍç¦ÍUÂçLÜ‘ŸÉuÙ•'œ2‹†^ùâ9k99C¥Šœ˜L@YÙ“3 ÉHT +X•Î%¡§vIФó"Â!A˜ØO,Ý¥¥«&[¦a°Tí 1 £Kšÿ ¡Ëx·ûbÑhÀÁ|Õk4<÷³½õvËöûcÓ©^ÎwÅ9®’F ûÝ!„ìs`åÀo.WJɱÚ7¾z+,ƒÉ˜.H˜[zÂSŠçòÑ'Ru•|'2·Éä¬FD±Fç–ebE«•¯˜9Iél°3u#p=Ô0¥1 ÿØdr +ì¤`§bÂ`{Ã’9hbSK–e‚MÍñ^ \Á(ŒSæ4ØÞDê©Õhóù`S<¼8/•Ô†tØZ½=R°}”eVNÝEÓçg¦bž µCê$üQ¨m²g#í9GHEÚæ|V !­-P·Ú¤¤ç¥uìiÎöK¡Ç@‘@RbêÅahl®x’°FBûŽÂïCÏü,0B…“hß!2¹¤çGæMs³nœ._rý@–9ƒ¯°r° ˜èzÞÙvý­¹ú{½þÚ¼Z7?A"ÔPÄ6Óü³’‚aL÷{ß~oIEôaût‹~úÃÿW~¯ÛI‹ †6e²#r/âo%¢TãfïÒÒDãzÐÄÙ™…‡.Yí ‡-LŽsI©ÒîlËÍC ¹©„ÖOo63À ïÈV#“é*6•#½;"Aw›B}\,G-‰N\ŒÀ͉ÎMÕä-Ç«–šä4m7¤§¶¢6┿Olr>°ÏSßR èä8$¼Tæ|ì8œ(d !Þ§0ƒða²'%ܲðÜþÒDΞ8[Žã³Æ›(rÔßË÷|³P¿gˆSÄ£».ßõÍRï1ßu¿1«7”iÚ±–ùäöXßEb3:Âí20§ù‘erZ€ë›¥:>gûPì:çâ]ß,Õñæ¾^ ^B¯kÇì‰w•€£’ËÎ%ˆÜÊ+â;ŸôRU( +$ ßÙQª4«Æ€ð!>\Ý]«^j¯~Üúý«}ûÎç°ºöíÕ‹ëë×éŒj [™ôúþÈü›:ÑñêîeÛü`Nù¦ +endstream endobj 11 0 obj <>stream +8;Z]"6-A4A%#'sH%T'AQi*CQ%Jo,=)+KP.F8XeIhmT7Ur./Sm$aIATq@WGuh6jPVI +WdReGLj1jb=8rEj\n4&b3""A^#.hcNrAfHL=YPe#,eM?2lGs%7UG>l0WM:NPd9E&" +$38I$Wf!e?XCaMI$YLcN&g6VDQ9Y,U>X/Nm5@&X`4s23&EZpll!R^A5k)og[`K.*D +4_J=sm('[g8H,n?duYB%Bq072=^(_g^GmE]7h^!T\ou&F!ZWeYX5bf)?TFQt'FhXu +dB'*gKCq#EU5lBXmfKW^eBpKH?W]hGVtW-aO4F?Cll)[D'/#rI\fgW^EnT'tWqCMo +go2X#9tOi)^WP5o")):V0@Y0Flb65i/Y060!1JK=?FB#^QBrkBANVgY:V[+L;-S3X +RhXNUi]"o.dR_K%FEeaN7P,i0_\"WD4?MUP@F'oQQ(B5P>qf_@;NN'TLSM?8%!*[! +8((1"@mWhUP<'0iuhkcP`-S"#WZY@Oe@^93$LXT2l'536K-9+3G"41ifs2X$Kn&`Xts-<=3/:N*W?4CQ8MYEZ/p?3B;EFqr5p% +2dq\8~> +endstream endobj 12 0 obj <> endobj 14 0 obj <> endobj 15 0 obj <>stream +%!PS-Adobe-3.0 +%%Creator: Adobe Illustrator(R) 24.0 +%%AI8_CreatorVersion: 27.5.0 +%%For: (T\772 Nguyn) () +%%Title: (banve.ai) +%%CreationDate: 11/29/2024 4:15 PM +%%Canvassize: 16383 +%%BoundingBox: 156 -677 453 -187 +%%HiResBoundingBox: 156.139119401079 -676.330513890378 452.56206653168 -187.405308756865 +%%DocumentProcessColors: Cyan Magenta Yellow Black +%AI5_FileFormat 14.0 +%AI12_BuildNumber: 695 +%AI3_ColorUsage: Color +%AI7_ImageSettings: 0 +%%CMYKProcessColor: 0.626581192016602 0 1 0 (AutoCAD Color) +%%+ 0.735347509384155 0 1 0 (AutoCAD Color 2) +%%+ 0.749721467494965 0.679194271564484 0.670496642589569 0.901457190513611 (AutoCAD Color 3) +%%+ 0 0.993347048759461 1 0 (AutoCAD Color 5) +%%+ 1 1 1 1 ([Registration]) +%AI3_Cropmarks: -123.30712890625 -718.58270263675 718.58270263675 -123.30712890625 +%AI3_TemplateBox: 298.5 -421.5 298.5 -421.5 +%AI3_TileBox: -98.3622131347502 -726.944915771499 693.637786865249 -114.9449157715 +%AI3_DocumentPreview: None +%AI5_ArtSize: 14400 14400 +%AI5_RulerUnits: 1 +%AI24_LargeCanvasScale: 1 +%AI9_ColorModel: 2 +%AI5_ArtFlags: 0 0 0 1 0 0 1 0 0 +%AI5_TargetResolution: 800 +%AI5_NumLayers: 1 +%AI17_Begin_Content_if_version_gt:24 4 +%AI10_OpenToVie: -73.3034482758603 -151.986206896553 3.02083333333333 0 8066.48275862069 8094.95172413793 1503 1028 18 0 0 96 108 0 0 0 1 1 0 1 1 0 1 +%AI17_Alternate_Content +%AI9_OpenToView: -73.3034482758603 -151.986206896553 3.02083333333333 1503 1028 18 0 0 96 108 0 0 0 1 1 0 1 1 0 1 +%AI17_End_Versioned_Content +%AI5_OpenViewLayers: 7 +%AI17_Begin_Content_if_version_gt:24 4 +%AI17_Alternate_Content +%AI17_End_Versioned_Content +%%PageOrigin:-8 -817 +%AI7_GridSettings: 72 8 72 8 1 0 0.800000011920929 0.800000011920929 0.800000011920929 0.899999976158142 0.899999976158142 0.899999976158142 +%AI9_Flatten: 1 +%AI12_CMSettings: 00.MS +%%EndComments + +endstream endobj 16 0 obj <>stream +%AI24_ZStandard_Data(µ/ýXüÁ 0°Ñ&mk¥qØ…®õ› P2?ö.<ìÛÿ?µ™Ùݽ¹˜”KÊ áOéËU7vÀm +¨  † ÄP"8P$Š’ ….P€B.(.(T° +YX”‹à@‘\ˆ,6 ²(ÁÁïèç¤Yµ’¸¥÷ر¨î¬]îR_yTÄÉs¡Ðàðy @0)EâP$ 2á€A|³!3}ÙP•,¤±¢sΊm³dÁœ=m]ZÃ!"E¢HФÁøC½`(’ãëXd¢ ½¼ƒØÉZ¨H¾©H‰‰C‹Í{œe)EÒØ«RSï÷î{>gƒaq4 |4¨g†"IEò8Ȫ"±R$†"És,R‘<ʱÐ,ÈÃÑ`¬š)HB Wû‘u§f4¦D˜´d´-q×gv§›ýˆxŠäáh0«yФ ãêÁx8Šd5ñI©b)’áH +²H,Eâh0_U$U$fEH#É™AŽcqM<+CèÓIÄDºÒK22CÔS¥²íPÑôâ!o‡Êùô7Tð|([h‘LCU«„„Ze›"¹Ú–Ï«YnÐ⚨H´ò^¶±º¡’¦4©XCÅ…†V5¤‡zW–ÝÒ±òª&Ý<P$ŽÆâ‰&*Üz(’US$xU$?+’S$5S$g»\ÆC‘9×wŠDo­Šä†Ã’¡HE‚©«H¬H +õ EÒpX‘(£ñ 2Ìu¹m7)•ò¾S«òN‘, Émø-ȃ±XEbÈÃÁX|5ÏÊŒÅÉ~5ñ¬ D‘À‚¿6‡ŠõNËnƒ‹´Ç±P$ŠÄŠ„ê¡H¬ñ{ä••ù ãÌkz<É¡HN‘4‹W$»ªsÅ\²( ŒôÙÏTñ¤H¬H‰âY); Y(4R$#I5®HN‘ø ÄÖPKÙ÷:ˆA'=ER†<Š„±xž9_E¢Žt$šÃez4 GcÑXl6P‘\à a< cÁX0ŽŠD! ͤ„$"áãŠdOéæ0FÚAÊQŒ¬«*ª‡^x>—ÉjЂ–’ŽŠ +™‰¦6TÒ¥C¥|I9—ÅVÛ-•{Í5¯rC£¡¢—*GB3³1+Y¬H‰"y4Ë`ã‰!cÁX<iöp4‹¯&òP$ŠäaŽGãÁP$Œd C‘(’øŠd5­¬H¾ŠgV$+’T$ j(CUQñ‰i™ŽÆâš‰V”T$|ࣱÈ+´"QKCÃ2?Ê¡Š¤ î|WDëüP±½B*j‹Jç¬*ë¯i•Í«ªS{cJië¡yñ~¢ +àC‘0ÏC‘•"¢gŠŠä FÃñ€˜ + H‰"Y,‹ÆÂA 3ŠaŒc #ÊXÆ ãÁ€0¨áF5¬q Ür˜ãèH‡:öa\† ªKE²0ÃᕯPÏp")33Ô3u†—?E²h<Rhˆ˜ÇEãºÄÍ3T§¨ºŠd¡‹ÆƒêtwáØî+EâxX‘¸ìЊ©Kdi—Ky¯êu\©”x|}*­„j‰^ͳÍ^U‘Žo‹\èb_4FÃÑx4 HƒvXo,Œ†")„ÉÃÑP$ŒÅW‘hZ™ÈT¤HŒŽ’”–N bPƒô ‘í²ùŒN«×÷ 7ìðÃS¹ª¬®°²´¶^‹R$Œj”£)2[™ÙZšÚÚma k˜Ã1:_Ý^žÞÞoqŒkœã9Bc¡"1›Ëe› ¡9¨A bЂNKJIHGFE&"D‘XëXÇw, ÃÑp4‡Ãñp<ÄAzøáG=êa{ÜøÈG>ô¡}ìã?E²x0ŒGãÑx8Çãy@!ˆ!†¤ 1ÈA‚„$D! +YÈB9dY@¤i@äy@ [ÛZ/-DêІ2t¡×UÕTÔSÓR+)$éÈF2r‘ÏMÍLÌKËJ§"¡„àØ@.𸨘ˆxXh$„Üã×8Æ-î·§—‡wgW磃ØÃÖ0†-ì¶VŠ$ÕÁ`,g,CÉ@Æ1ŒQ 3ˆY<Ž…"i,‹Åâ‹]è"¸¸…-já- ÜñÆ_üßëóø{ݧCö±Žm,cûÝÕÍŽU$g¤H +@Šäб}ä÷P$ö¨‡ô€8‡£á`8Ž;Ö¡Žt ãæ(‡ä€4 G£ÑX4ÞØ†6²kX£nPÂx0ŒƒÁP$P$‰¤H +€…Š"` + L€x8ŠÄC‘X`Dp H(`DpPˆ\KÑP¡rCE‚ÁA±"1€"!R$P$¤HnH‘ìÐF©BE‘@°A(( &4@(& "$Á(T`…È„… (ˆ\`¡¡Â‰ˆEÒððà0!"""aƒ­Ë… + ‘‰ " &$"$"\°±   *X¸ðƒ"¡á Á!!¡¡ĈDD‚"‚A`À0ñÐ ÁBÄC©K¡Bä‚ d!aÓŠD¢ÁˆH"$,`ÈtÙ@DDB₆K—ˆ„† ,0 "‡ `8º8X°y˜ˆ˜À‰°À H2 ÑP!2¡Ab‚!2áÁa¢B„  " ‘‡‡ L`@ÁAB‘L\yÀsyHÀ0qAäáÁሉ 0L€h°p!ƒ ‰H ˆ<\Pá‚  LˆP Ð0A‘Xp°ÃÃCÄ‚ 0D,4X@æ!qáÁ°åÑ A‚C¾D(@8XˆLD\ÐÃM‘T@‘dpa"B…ˆ‡‰ (D,L@D*TˆhL€x8p H(`À1 ¡ " :/:õ¯ÓÎ–Ò ˆ Þe@€p à !A„BÃtà„H„  <2Ñ!™xXDP/¹ä×e‹\ŒÐÅ®æ+5~î´åI5™´…Š-CÌoRå~Œ~PŒrQkïŒlLDTÉ@‚ä+W&(DÐ Â& ""Œj‰È ¨p¡;qá!ÂBÄ + Pix€Tð™Á€G$P¡ Ѱ€W.,L8@<@"òpÁDwLH,"`"¢Â"DÎ~P~…¹¹ª–cÏòŸUÑ¿ûdéƒR6W¥ÍþÁƒŽëœ}E&2¨©  ¦e‘Öâ¬õAÁJú–•l¬ü @°‰† +DH@pˆ +Tà£óŽºGzfÿP±b§éV<ӇʿX—ù£Û»DkÝ}Í¡‚ùûižKU}k'Ô34*p,*.TŠ2Mu{1+‡ +L€Á‡‰‰ + "ˆ B„Bƒ…D° > ‰ˆ.4`ƒÃF„r —‰† +ȃ$F°˜™‰4@¢áá…ˆDHL0¡ÁAb& " ÐðÀ(ˆxxˆL 4L@D(40 @4lÐ(,HDx4ù‚W´]{ÏzôwÊ.J¹™[6-llþ>®)VZ¦Khc%éîËSF´ÃÄ´áÍ6×| ‘¬§W¸{Ò5{ Ÿ¶.¬ÌôsËè£FÜÔçšqÍWÒµ1­Ðº6ÅY²eéÞ®çÏèîtK‹F‹ºWhãßæú¥Fx–K…vµ˜¹ZæÙBºË¥;4Ä’ñ[f¹iÓøÐl•·ƒ†ø“åîýñá uwwóp*sñ¹úkâšâת‹GüÍ’ÒˆYg´èDßU÷ò;¤˜j=\üiPqó…kX4µHI‰k\'¥^qmª©Ä¼åâQ“¼N\L²y"¢¢&îÝ>™Xßuî’uòpÕîgC‰W‰k™4OD#®âæ5§ÏNçyG}TµåVî!îÔ¡-¦U®¯vîPƒ“y)7I?„øÜ££"60“Nq ñæÍÔ숾|V.¢qìð°L™›»6dx¶¨‹s£e.RM­›yšZú’tï’¦Œªw‘®é˜1﹈¥“Fó!Ym7d¼£ª$D"TëjjŽâU—p¯&Î\›Ña]©+W¿8xxUõauq—ÌsIJÍ×G“2ÉðÉÏ=£ZჅˆG²\Z¥©Ã­%Ê-玡׸wŠøË4.Úzt÷¥T¸¸x—„›U5>¢%’–‘!–¢«ò‰NÅ£káÞ–N­u qý»)ÍKŸpo•ÆUŸ.’®mâÔqO ·’>µ˜Š„&ëoëèsÇ=¬Ã½A+Fy¨·µ{‹º²›ûß:kÇŽY3³~ßЬɣ­èýnKïcƒFY2S‡Ê¤>ÎíïÌY. G±ø–¾5ä,jdCZìyùÛµzðh/IëZ¢,§µY-™•{»äš‹úÆ®TÝoì«×h.úm¥vW27Íž²‚5‹4tåLæß¸ë1+Vd][½¼YÃó¬•Üú´rÊÊ•QÑm┽ÊåÚk‹I;t[·³U6w}¶eiº;Z%5IÉöò<¤Yo¬Šíæî*ÕøÐºÞ¬rÍ¥­¥ÕS«×nå55g­ µ–l7³X9ÕJd[šååšµRfsš¥“Vìÿn­î —¦®dékËìÛ:zem†¶%ÔLCúè•ßjišg¯Xíñ:t¥ç•yÚ1–ÛíÖ­ù>®,Y9yåÛ»ÝlaÙüÊ]õn¦Ï1+ÖÕ¶Hq|Y0ϳX|8v‡7•ÅŒGµÝÕ‚¾),–×\ÛÅÅYËb÷œÂrK»:«:£qï켟Òª·¾Ý;š¬,F[sÌ5ÍÓ’>´Å¬èÖmsnY¬EñlUç[0qÏX>S×s +^_wù~Mù£Ø®U™•ªøK«*GË^?C´½†Œå¥pÍh#—¦=@1Sn}öRË‘ÞNü}tMEÚ˺”»ÝÑO¹˜sÔ(‰7橞¾ÆêAŠ„£¸ÞMÖ–\Ä¡¬[ñƒBŧXÇk®Ç¹>zP @³€ÑÐ4ÓÊ+’™.®qLXÒ•z7v.…X¤ºk×IóÚåNYê%Ÿ^¾Jqn.·Dt]<ý¬^±§¡å‹š’­nÞ:F-M]4ýè^ÙsbåMT³ç²'Õ:Ymï»ÒíjÝŽéy]ÊvÏ»Ï+¥yuþ´jŒ.gY_Ý{Ö\¯¬ºŠòë¼Qt±Þ´º¶¸S{ß+Êß¡"m©¦ÚP5UwË5·WNsoÅœU«£®=¾é¬v[ÝUµñ^¹²«Ã¯–Çx„ºK–s¿b´X‹7´L—¢LDݲâÔo3ïxÞPº\×nºY¦ù¯è:Kñ¹êyºìUíéâtxMëx]j-_ºTºS¤öªÉ"¥ñ¯¤*ê• ï¦[ºŸý•MÃ;üÞkh].õY£³£¦Ž¦‹é*–Þ´ˆòf«Ù½Ò]D#,{wwër]ò²nÝ[ý$’-¿y”™o”;M³{^=WjëRáç„厨ð®VŸt•$ósfýaÞÓRÇ®²©?ËU;ûR•4çW‰l±ªù÷]³1U)Ô¹,+]§õæîR{¼Ä%£šM,¸y´÷JÌAª’©øÄµ²šL,ú¥ãnϹŠÒ•JÙýv÷>ÇUe«ÊœKˆŸ=,›˜X÷34Ý%µ\U¹áùnÊ4CBÌZC³Û‘ÎCWÅH³0WÅ­Êm¸˜{7w1·Š>Dk[wC­Éªr»!榳¦ ÚÏÈc²Ì\³ûhaA­+ºëNÖVi®SqPO[k¿³Í]3i¼ëí¶²+ê5§Ìè;ªqlµ¹vÊqÙ´ewùª¢¹Ees…åô,ëN´4ZUJ]Ï%#5–³Û|'Ýš²*Æ"$]£sÊhïí‹X³Ve¼¤6nŠä‚ S<3|񾆼ìË +sñôÆ P~k>Én®.ÿÚY}6|íÞດÒ-7«tög×å¸d•«„4xXö6D£¢å’ ÄŸáΩZ£Xå\ºäÖÚåêmæE<•?§..Z¼\\¤IâëZÃ/^§Ö%ý!S]—MÓÒÜËÛ`e ”Ž(Dp Hà€‘‡ +"P€pÈ€„F„,( †â „²DD„ÄG¤ô|U¦Íêž“¦­g¯Á¥ÙÙ6ª©Ú.õ÷êËÁtÖ ¦&éuÌjŽiSyJ9Ϭßg¯kÓ±L¯òÞdÛáX¯vƒW3UÒimªÖoíîî¥ùWÒù +éU¥ù²kuó¸´ƒeÓSË/â]ÒÙV<çÓ|Jgyçgâ¥å=uñê­ü¡õôç=Ã$¤2£Tôu3÷™ëUÌ´íåXúVõ*¿çïÑ*žó…6“Öúv÷­TT¬LMÓ!9IoNeï›Öè32ÄõÝz?•¡Ý ǪÒgu.5ß­TwÌÊ6©îUeóª¤Å´»Ui½îwÓd•öênþ-™úÈʰn´Ê¾´»SÕÉz§JDÓ©ák]¨N5¥“P»NT»W‹ðFt”uvHF|g¡ª•vº9¤Î­#»ý:KÛ馞î‰'5¾ÖµwøµgÄ«š¯›Ÿ§ohÊ+º ëL7ªêÛ½ÂûlGë5TµáýNuï^sǨìuJw®ô¼“ëкw=ÑÑaÞÉ•c×Ýu2R{Ýì•1K§®ê–Y¹wYmUÕé^•½,±Ô¾WOjW^_ýW5¥>+[;Úæ2ç –v¤ô&ÝjÖ½7˜ÞÂ3-:çIW§Ð?¤"»ÃŸÓªšN½ÔÄ[½æBÄÛ&Mªí:{W°Í¾©öžU®B½Êßü><ÞxM4¨ÎÊL¼Õvéěީ¯ÿáªÕx½‰ÊV§*U#}“TYÏÒûªo¥‹zW*ÿÊ™öE—“Êi.tžñž[Iõ½û]Õ¥"ÞÑ……t»WUÞ¥UV[•÷òÖ$•>-÷nT…eC3/áÝ/=üýÞ“ég*›úpï¥Ï1*Û®ô¾Tª{‹ç*ûNÕTmºT´»]ÛÃ$¼:§–¥êÝëJ3þkS†X¦ZI©VX^ÛwÕÊúp+õ4û+4‘¥^Ú®óú 8íp³¾¥VÂ%wóŒ>­Êßéîõ5VKï5OiX¾54˲Ëg§,ÛóžÝh4‹õ¼[Ú±ªŒ>;UæP–Ö–a–ViYâ}öʽ¡¬_‘ÑžXF%µ_!ÖÝoµ'g¯ ¯ÖŽ^^ùl]wú×ÕÜ•én¥Vû^ý©¾Ñ•÷hUj‡tG+´úñvY¡i­î«K³U.±ˆ0!2ÑÉ â€"hœ~qiL/ýYÒ(ÙÞ}çô%½7-Ïú²åí˜ÿEë—ò¦ŒéóœëLµH­Jz´I¿ ×Þêqnš†{µKµÂ[¼U×Nž/¦:WóŒºÆ%Zœ\33ãRþfWÉN„H¸NÊ;!Õ®ÚÉloŸy£çyw,H¤še¿<Òó«‡SfD¶Gi¿ï>écå½Õ¿,MÓ;7%çYíÞ¢±¨¡}Œör&žŽeÿV~žTiªüMÙ­3o•|c§ 7 Ï\ÖU«Hi—öÚ9?(&¢oþÎoV""]e^§Êˆ +ªÖÞt#ݹD-hK?£á‘éƒbÅ©ôÜ#>(›ö«ªm’gëA©ŸÛD|ð§U£˜Ù§I¨•j¶DåK¢á}UQoÕ¢˦õê™f‹eªvÕ¼É+#ùv5Ò˜Î÷Ò¤_ÔÒò¾2qˆ£‰¥h·ng{Ѝˆk¯´»*÷f‹ÒSWÅ’h}åíxú»E5#Z;+L´žéÎhä;•o̪œ¦á⒙ݡï—7ë­ÆÕÌOî½÷Üê¾~Ý ñèÕ~QÕ¦é©h”wßÙ]ow¬ª(™Rq7ÇKúudÛÜ¥üÐUÀ]¢Ë-z@jɈ S‹î/µhç/}€•—vcfK˜Sÿæš»:ÉôIDvj*Zˆóë~ðy¬:½eÑL«™ÞK7H{ãZ¯V7¶™Uééü9•–•^8'ÄÅ´þ¾žr);Ë:f<›’ÞŽ;èE­²þð;f G†ˆTôEÄӵ݊†{EÃ]ųÅCT4Ò3\LEÝÂEºM-ž¶¨p)OmѶpjÑø|aíÚ]ˆk½swtÑŠwñ{Ý©¼"Ë'"!šZ–i÷vŸº™j´ß;4µÄ¼]Ѥ¹èm¥éüK˜k.{¾<^êØÐÊŠùÓÒAÃÓ[µÛ|Y.m>+k/µ\¶Ð§·‹DvæÔ<Õ•kó’ì%E=½Ö&–˪Íòv)Ë­šëM§NRÖÓårG¿²)Y7oå’‰—ªzÒòVV@JÌšµ,ó¨ý±þc$Ð}ÒrÌgB£êÔïÖ–N÷Önö·dº¶·)ÂÂܲnÚ8'D¥}®3mиëëÚ±VQ=ôtÙi‹6¶d;³=¦ [ûík¨£Vd»cUÞ騦ì}ï¨YST¸Ey›QÕg6z—:õêý.q’ê´nwWÝ­ñž¶Ô;•ñäôØ­¤§U +÷©š¾Dk]™tÂ/šÍÝš¸ø»nÁ+áÑäÑsÍJ‘õ.Û»aâ•âó;Ë{G*¥Û«Ò»ÉŸ%´}îœJÞÏÖ ªÔË»]LO†Ÿ¢ÊÓ)ÍoÜzþ~ÿÖtýnªDÂïfÞåhè.:*<îí|­þ©ð_ç]˜E†¯»®oo…Ï­›]Ûþ…ODš\WÞ’r®F+âQwµáq] + Ëð¨HƒkR4ħúHÏ?üªšâÍLgSUòy·“h¼Ýãí¬¼ž÷ŽßUÒÙNÞb•âËeót–Ñ&žîR—ÓÙÎzÕ˜yºá” ž×B9h,]W½9?[ÞñfëUj¥²¦Yßz™nÚîäü¡÷–?Sæíßœí1-…;vv:ó‡_µÝÅ +U¿óÎÞº».¼Öä]Ž»g|Ýþ!þp=©>é`º8gDÓüLÆ:>lœ.•ÇES[É𘩃k¼ŸÚÕK³hÓ.¶M·|åsê\¬6ù­ú˜}Pó‰–³uµ¥™§$[9×åå×òsóÓG„“¥eÍ´I°’ý¾¥¹ˆ“÷­±÷Ý–®vÉJw™ùªRÍ´MÑf¿?>•ˆ¾w8x¢ç!M]5_ô[¤=•Ö©ªi‘Œn»¥¦H/ÅÝR¤›.™ÌD·ŸÑÍüoÓì[uìu;¯T¥Z4;›‘•V¦]iÏ«£™zÊv~ÚS[Xµ:J©Å›Y§5tÚ6NiÎôý£½¦‡L/}3ÚÂTóÙÎÖ|ªº®dô÷ŽŒ‡›O3Òלּ[¡Ë° +O›i{S£Ióä§ùŒò˜§;%<2ßY¹ò•®–O3½\ÍC“_…9ˆf›”®µ1Ú2ùNÅ\*§çÌ—tg6¡3͒ȯݟ%&~ÐÌK–¦•º6Sº³ÖÔ‹ôZ,¤Ÿž¿Tki~–u<›jyÓt6ZíÒ‡z_m5Z/QZ¦iºOwžR;_ÖÙIÖËo"™*ªkM†tjKªÖøÿüÎ×2ÑÈk/º­)]·èÖ*õed¸Xj·iô\ÓŲ£«UгI=D§åf™d›ù뺫ýàMËÞ¿¶_¶–fyù®äò’mÎÆ%óœIÇ*¥2ÏÝ´Ô™Ñæ¾´’\/T+;,Ò:R$—ÛÓ’Ý3«ñi&R²¡]ZÕ™³N>îq +íÈt{ÏÊ®WÎ3½ÙNYÏTéTon†s3§Ÿ”x¼×6h³»È†TéSÙ/ÍÒTj-K£zºjÐf²]ÌuÛ|"ª´Ýݦ_v‰vç5³5–Ïl´_úvJôñHsfvö m­”lh˜”v†j§—šÎb‘Ñ–¾vÓìü*]Ó’nk¸ŠštÜÓ<-›tC«¥á*Ò½¸jW£"¼4¦ª–4U¨_5â Ý~‹ŽèLÏÛàÍWÎ_o¶î—èˆNæÏÝÌ.2ßYô,ãàšéºf.Z³3•Ñmͦæ5ýw­‚åM½ßº7©ò¶Žµ“`¹Æz¾¦^Ú( t]]TÚ¹î]ÔÃBÚ5ºO©„ĵÝãÕX]Ó»Tj³yl¯>zš¡ùÐÈkVG§+ÍG£j5§F{ôº·‚c4h¤Ê;ü¥¥êª­Íí=}ÚµÞÙóñÒîvOón¼Õ==÷œKzÝ-õ¤žš¢+ów +Ï¿wo—ZUõͺ[;w}¸{T8†‡WgfwK¹5‰‡µk«ËÃÛUÛij¼T¬ÝË+*ͳŸz7ï4›‡¦yíšyW÷zÞµ^ÙM5OåÕí.ÞíËfñÔ‹xCy´‡W”Ò˜û»»DšßYZeîì]±Mz!~ÍgÍ¥+ù£ÿ—R‘.æk¿ZÇ):ýêi®¿uµëDùì3î×l:¦Û=$²ßz¿´FctëÒ>T§v»Šˆ»†§x¾ÛÕ_Þ Þ–)wU]c<ÓeÖí;Wwk3~‰Êƒ>Óš¥SûVúcvxÔÝ»óW‰¾TåA»Óq³F]Þ¯ÑMÒü¢â7ÕrÊ·‰»ãº<£Ó'ÝÞÒ6_Ä,ú&®÷E¿5Õ,ÝÑí—ôÊ©·_ÓÙ«\…e¢ÛZ¦ÿµ&Ýê9¸&º}×T¤kVÿŽÛ0íþ(ÕŠžOÚ4ÔJ:R¥/Õ%ËnHmÕTéf£§‘ͦ½îµtLÓXÚöÕÚ¡!e‘of5ˆF”¤¦Aã +ÏŽõ"¥­[D̹«úˆÌn³]ý®èhHvDýœÖëªûÚü¢eedëÿþÚ:iÓôë{ó2š×JOÍÖ‰hUdÇÛªiêÚÖÕ7íöåé®þª¯.Ùê™Çñ+)óY¿+­u]OitqsjÉŽv›Ôªã^ë¦Iƒ{d¦X7ÜõêU¹£¯úS¯¾Zg£¯¼Â:ÙüZýHkLVÔÖ«úéw’¬êª”¬JÉÊÖuõ—QÚ¹NøÙ +ñ´êgï ™%gÉ\WïÙlï“ÍF}º9.S²-×‘Ìø½!ù~Þ4×¹KêÓ.¯d¨«x>ÞÛÜ^—¾¼ÍÔ_³_æÙeéü®î]ö:Ñze6ô¡ïe§[”Š^»+‰yD§Ÿ•¾ÓDˆÇ“ËC飜Dcªš|^ïF#¯×1¢bbél–V8Ú¨"©WÏ«µZ6z^;Wå}®à£ÐP»Õ~òêv_å׈î‡h£V®!+›Ý¯ÊìîTõÃC×ÀcÝ^/L»±4ØgUƒ®ŽªôJO›_åúrwœuuV·vc•¯NW¤YyÇ+riÐ8-N@Â$Ðíø4°çГ ›Ò¥³1[yì+ŽRÖÜç”ɨ”lïÕÞ\Þ~o0q qNóô£Js¹¾9­¬±jís2mÛ¹,û8GmïŠ|“hZõ/yèç5SS#û_»Öà‹Æî¼•ôhãWŸ¿dù¼¦k¨¼—gHjÌ%t97¯œ×[´%7­òIKú£ÄA#éYfŸrÞjWÝaÖ&–Ê'•ËTzz¢ਔq¨SrÇ1¥”AŠA‘  € ( Ärñlë>uV4V:$‰D‚áÉu”"QB 333äB`åÖµ2: ¶ˆ«D,ð¦/§\b öXþ#ýy¤jla¤Œ“¶ÁTââG¸ˆÒEpôƒ;‘{>žI¾7Їj‚ Z ‰[ƒ¾ñe +Êþ& ÁE¾ž,¸¯[4ŒENb·ÿpû´¨ýýmq 4e†oÓï¼ÅÚ€Ãò[Ô 9¹„<„o‡XྭPìØ•àAðmʶ^Èj-Ú~ÕȳeµBȵòMpM6Cêµ`£À/JŸŠ/šß¸;ªžâé3óò}2ZÌw±º%þýWÀ0êÙÌt9Ü-™y{&…z¡wæE€YÄ ††—þ/&îKk’V÷ø·}ˆ°ñhs~0Qp‰]{ `SÓ¼d‡ËϲHBhƒ_?…‚Œ©Ú™çÄ\±‘Æǰ°pæ„'à@/U‚%ŸaŸÓê™­ÐÇñÍô8è:_Þ<+û +4¯ŽçRK©‹Ö•ŽÔG£q~?eX°¼·wعWÛpRX+ k]Ø øž)*!àÁ\ɨ·Á îÿºÖ¸ ±§ŠžjªôaŒ+†“Fò•nkcT¿´PlÏVÍG‹Ä¢Úta‰ÎPa[ª¡G­sWão·Š)²Þƒ…DN°†úpdÐZ&ÆSdkì´‹O•¬ŽyãEîI5Í}~)*ÕኀKENçþHÁÞæì$Àd–.òº®Ú}6„UÈ zº9«}Í‚¿öY²I½ÄÝOZ¾Ï¯[ ¥ÄubÝà(“€"èKÚðå6Q²Œ/i[T>–`ïèh‹ )gÒÃeo™sc»8 ðÀIêGŽèt~6œ´Š›3;®-•Ã,á¤SD’=ÇŠVõ|jú‘¨IBPl5㨜€àËöù1òjÿÜ:”d¯¬#®ôá¤&«(‡ëpÒ~CzœIW°M8‘–™Ò) Ô,9ë’N_ÀchfRLBÔ«Kz("Ôn¿s#èfª ?%ÅuÝ´÷I¤²à³sûÀ*ûø²Aû÷m¾rEÙ¤E8ù1ÝT@Š:§P°l¡Œ|kqö•W×]íIoF +îý×z/´y9‘[²¤ÙGïhÆf®×ª3ªäSeIj&µœXÙ›œ ˜TŸiLûˆYd킎0óŽò’ #rc´°Ñfd¾L†˜/ë¨÷0ªôÍø.j|í¤gz'¨Ã…cÛ ';ΆÉELÔl']:@Û ]ØNjçÓ‡½µÐbÁPçFîvÒ!ÓÑEšhc5"ëàN~[aÝqaT¹ÍTÜIîåµÞ ͦèþºªwÒäëNgÎæŸ£³vFÚ¹^éØÁ“£d‰oExB2cí‚ðdìG7á q HÚmÆÁ+öN: +OºFA× OúÜ âOømÙê‚+òx¢ßNàeŽ'ôtµ•x—'‚R?`cžÔ€Õk‰×†󈦛RÃ6?9JH¾‘ޝžb–LqžÊ’ƒôÑ &v@ìºFIz÷òžŽ¦}Œ‰9á•,_ˆ:êè§ÍA+6ê×IÇ3*éËt‰”éÊqyGÃ;7¿ÂÉð$'zö@aö ÖÝÌ“¼o“l£˜väl°uÍÑ"ÃXë3×”mŒb.`)D¸ëRBC#öt,4å}å«5Ê9ìÆG­8üšoÓ*F=|ÂíË—mѶ"RV©¤¦¥­oÝÎ’Œ¢5P‚ªE-ub´‹ ‰YˆQÒŠ i”C@\öô–èÎØœWEäQÙBma úäØZ‚ZéÕݸÀQʽ'åSå@´—ô›ùBcò‘ÕJSO­˜n"ÛD_J0 ¨>2ì»'؇Iµ¬ªaIæz½°[©[i +­™ÙÈ8UÓϳsK³t1$‚ öPodf/¤L®Œ¡/3:u‘c‘¡£NÍŒ>^ºŽ¸F2º»}(`žç¯F7H…äBå­y…@uPL_ŠÀ?’X "Vz Bøs Øá¸áÞÊ@jè$«€màÑ"<첓¤ñLªp‡q ¿©»ýÿ ¨¾hû}y¶ýð C !ùO*nŸ²ŒéŠ2¿Ÿ¼Ä0ZfàY£h¨p¢¼BlÝ04h¨Y÷ \‡ÙgÙ 4|–ÉÕŸÜG›}¢4…›mOîðM*yâynCÜI×j3‡Mõ,k(b”nГ ^¿›:š:hHbcàìiÀÍ]îˆo OÞCŽ•ns.ð†µ_[ +"ÿljôóýØVëm lr²;À[GLWéØvS݆4*–#ä¿(?†I¤ l×Uu•ÃÙ +|zb0REг{›£M(ÕSÍ¢)m¯Ìü28ÙûÐ$Œ6L+6’+X¼h[ž4å†ÝAdÂt³‡ +Ö£±:€Ñ_qêü, Æ—6$>ÔÈ£n9 ÂE —OÃÃâoNEð¸m\‡°Ö´`«u´:Ïs¾™¥ËW¨«ïòâÉZ5‡ÕHk`’!½·`3Í£dj`õ²DA]Õ\àšföŽxQØH@. ¦{‹Æ<£¿o©£Vj³(UOtôÈ¿­"zºÅÐi À²œ¾Ï€I仢‘ë’rDÙ8Í´ ì¥^€ðÑøçü8V¸»* +Ji‹n`À︲ˆ+ÎB§‡œ¬¶Ft)©ûïÊ+ºBq/O*dh|]wE7ÞÓ?ÿ®¨¾>ï´AåY®ï5F|E+' fmšïÅM‚ÖòÀMêQ8¼)¡E]löT´þз-š[“*Qƒið;Á±ØþTtWH›0)û튒RÅ^lTìí0DÕ¾v\3|$´’1z´[Q†Ù#îü­uƒŽìF·"ÖÍœhO!4YmVZÆŒØùíæ•¨±åíIÊ]pȧqäò:¨p†-‹ÖD™ÓàÓSŸ”6ºÚéæÌ­Eó—hH§XTqYŒ®¬lû3T¢‹Ecãö;û?l²¢ùwçÉ´Oy…£ÍµãÙ6tÍ!ÈGÒ¼Äp+‘”ùwf!}Ž—/CÜšðWØè'm‹vvš±o@ÔÍ`ÛPžøú,]6av5S½o,j†žO„ ÚOµg%¾K~hik¯f;Uþc‘9 øË² Öðs¥VAèeB妌—§}ö+5Ý®«P[2ÑìáŽ,½ÊDÕÛµìIÏAÈDÜ|½–uä§‘•œ’Dx'ê¾éBLVÍt£7%Êjèxø”¨¯—d[JÔ©.HsË ÞžìLJ”½V eP?“/þ9]|bÞzˆi%!xôt³‰ªG{ª¦3S<¢ÎÜ£6ΙTëñïäãt™Þl2·hC¤:!¤ŽGtØÍ(ÎmfaÅ)#eÆ +³hZ¾”i(?:dSÇ1VÆ—LF E[¢Ì„C–,"W⬾*¨’@ÆK])D× †²\RuÂÖú™¤3ZüŠM² +Š$ _F¢&WÛ"’ãXÑIH”UeIæOÙ@(ê0µiyf¤4׈úwP:eºAQ¹žC#ã69.(Ò™©n0òB/±â"jV©™€>MæBЂq>‘sQX"¢gô)TÅòÍ¡ãCŠàs8†ZVÃ9$€6Ñß~,ií»L6ÄLˆ:èzaD÷Â~†ñ:õüŒ…ç§/þµHÌËg¿Z…ö ¶fYŸñ$M}Æ€3bû ˜LFo¿¨-F'>C/||„ó"wÏHáòmÏÜOæY4ÂÀ¯àÖ3 W™Æ^¨oÊ%êEš(ô O,˜Cf‚Zž±ÌJ\És¯"ñgn˜\Ýå"šðLøƒ]ßÿh­[ýQ»séÚÿ[ºM®ü±¡[ î‡tnÛÓK²sU¾Ÿr *ü~Èm×îzëÜ g¯„¸UNuþăÓñÐÿ¶¡1w¯·Å}| :Ü‹ÜV3þðÎY ÕÿMÛ$Zú•íô>~lkàH¨œN6¬õÇçü©mF1¨U»+/TºóÑæ”1HœØ„ˆšgç†uYÎ~`tÍ,.óqH ù ™ÐÉ|Ì›©µ#PÊî:¢+ùuÌ"ÕÒæí]»GÜ ›nE°ßfØ`«; E‰5³Ì§þÅ/¤ÃTt> ·ÂøÂDÇ>xÅÌÛ®™M,‰Ö±RM°i<Ãf&-_¼™¬)Võrg˘.i0Ò`¶¶fý¶PdÍb–«¢Š®B˜v8 ¥ƒ\KŽ +Ç!I­RsÞLü£mµ Á£½ÒÛiܦ™#çËÞ´^â\ñ³Jt¨M˜‡_&iÒ ÙÃåEÙh]¼ô„%áËã6-[KvRB£N—{®®]¾#>ÉŒ°gj&VîN·3[6È™zG•ï,P´¶.Í*G/“™‘ÇWòfÎŒ’s)¦`ú• +±ƒRoý¨ŽŽz©þ™/ +ÏûÎØ}µØˆ$Ó_¤;µŸD¦7Ù {¶V¨O$&Ñ6&K½8à"æ$6ÅÝšˆýÙ Y™Šyýil=%fÈ»ƒwg1%7±8^J•Ã,ÄÅÒ’k¥šYkŸ€au+pÒàIQ‡Ói<´ÚJÌ^J’ é½\^X‘¸ +³ ˜C•µ´"æ%4Í6 £‰ŠHÏTê3hTR õ‹fëŵÍ–YËÔž—¬ ˇí/ µ‹——4d¤ IÜú©UX]ÒîƒØ‰ƒ,¶œþmÔ®ž«KGEsé ôÛMF.árÕ/òÏüÕ,çKÕëËß²Xê#A(]:|…P–âLAÈ7m±-c½ØÒòH*¹#k™a¡–ÄŽ¶„Û›é×u´”y>Ë¿féôÆäÄ%› +–eË ŽÀê²?oäÙZˆÕXÄòÇjÓ¼GÚ$LXú5u6mÖHvÚÎ ÙÙØ—ö…—ª95_)¤úJë!/ç3Jð–GR‡¿Œƒ’½7ÉL$¡ ®4½H•†úÑ8ZvÓ¥1Ãô£Ëv¢ M¶›ô£$¥±’DÆÕv)dè]èGõU7ç]?Zø¹%‘s&´ 1RgB •¿+„“‘K‚káC ¹uDˆA }È.r½¡ÒXNÞ3ݰ+¤p<~ûZH[7 yÔe§Sàñ3õVHU"W2¾ +)Eù”WHS !§¢(¤ìÑßtãÈà3Hùí/| RËÚF‚3H­*ZˆÀÜK©ˆ@êzBþ†Òí±œþnƒtx/¢I M9î~–!j­BðF ñÈMš5î∣ð:}Füí_ÓøËMØ¢u]þ¨ã–¿h•>R¨­7½,ŒvfJŒ»;÷Åò E B½O3¶lÚ:ŸR/÷±pÝ›cüÀßXŒº4½:뺨hŒY% “ú…&uÎÂf6‹…Y¸1µY8VV%É´KN!ÞËÂèi>­6–”_Æ@aOÞôŒb0êѰ6<áZ'|u§uU“s¢NX 0uÂ[Ê!ás›£y~>o'ŒXŒ†Z«ÞgÝ},óÂ@”0º^̵ -C|'|‡IDH0ªplŠ‹¦P\¿Ÿ »'aÚY.áî™8OÂh>ÈÈ$̢׋ñ¶¶ÂN]0FàÇ3Œróû€ —ªmzSoKЉIôƧÒÉÓ(T*n±ÕŒ‘Ô îîÈßÄÇ’Ø -°ogž ²Å>ÎÝTŠGiÊ$NÙ’»O +ö£=^85òú%Œ&…gû<¤9 +Žß8×ùß3X€6È–ðpA‡"؇-è^l !cs]Eç=d¼Ê “CFÀÖKݶ_iIM]×Iö´SÁɽáOÕœËÚ;-6U¨Þ&Ý™î?&q¨ÁE…´ñ8ûu £¦º¯/€wäÂ5Ý‚Ü:$œo¹ÏÜ5ewÆUq&ÙaÊf O<&’û(âr›Š±M!QFÛa-Ð|+öc­ámÍ€áÞ|i8§!YJ^KÜø%žÔ÷K7¼§&Mû +ù7½el…œòm’8Bþ+>?Ø¢¸~èi§­½À¯'pÜûfŒµ¥#Heßã·4Ñl‡qŒ×O“‰ ¦ÃÀÙê-¨¡Рr.·K"™‘^WT´yì^Ôôßñw\VTò=AÖzŽK‹uq¨Iè›Á]:Q +ö©ƒàB·¯¤kÔå©U›p‰²vgu\P!T"B5}‹Úx FnHDÝúÚÐÍEúr’­·Ôù !ûE^'£­à·6oð²çØànÃDR»ºýiÄœQ|Q2Žº( ;E&ÄpÚá( +œ–¢/99ž†®"NZûQ¥èÜ1Rñ£®gkB€ÖéÕ„t÷˜¿ÜÃ=;pýaâ9©ÖX¦líxTmeÒpI{]S÷"<Ç'¢Ëωñ=R‡`͙̂=©àÇI¾w0_ÝÍV8v%f+Le|SP&3â´h‘v"§eJ,p¢¦ø [ 4h2ýô;•oaѵǙRÄ”ÍUdù‹h¾P4Ûxæ.e—•¯SÓ C §(ÌaÀ©0¸öÓ¯F +ˆåþðX$[,Ù§Ènã*g½½Y°žÚºa?à´–Ëz–Lk;逽˜)ôTX"“’¶“3@ÒØŒ8ewÎËø“«ÚxAu-|kõ›¬&a¡úURœÊïWuµøSqjº^¤,¨$ÆEiE7ää !NËÔ±û@_%¤ªÃÁÏQ¦~Æü5ÿeå eå¦ rb(tï‡ÿI.qyAÈžb¨JÖUFQÄé” +Xk“p aniÚaoe² +áZcÐ xÉ CÜlŠV®PZ¸Àƒ/3œ g·f&£Þœ‹Ã'øÃíÖEr™ æ6ø+U|àÆBÏõ´N m™Ä}¬ Eñ7Ñ퀺Ñ6¼}p¨pÕ¶Áh´~vása°;!‘Xû€=¡ôˆAÿ;‘( +@µNÀ:Ž ðeШÜWÄŸOâ’ ÙíXɃÜBÝݹ…uÃF@Í9Àô3N•y¤ÎçêtÛAÛ•²ÿ´lM«•ØnºFSÚ*fg Cvù»>ú²ž©&¦'•`fšÞ[ëÔ­“;ºkiFéŒ5¯‡¥¶~CÂ7UÕ3Œ5%ž¼~E'fˆOy“MC¾ŒsÉõ–¹Nn¬.>~[OxèŶ›qùN ¸;C­‰) Jq¨q› Ôkµíoɹ†wʾ´gÑ̤¬èe¾£¿ÖúÕͺU Ü”¾óSäús¡—.Ã=] x~Žh䜓PŠæÍ!ó\aMƒæ`‚3Çfc²×L#00›0•±€måq£\-SæŠåOšsäóKf$NHjg‡ò2 3Jóã~+îÄX'3yp\/ˆë¡Ñý ãáÖ“9¡¼).|ÁL´¿BÄËXЇTï;Î øžPÁð'äÕB¡“ØÕáy¢‹w¤vîWœàä3¡›ÃÖÌž¬´Ÿþ£`òãÍ´Ÿ¦»Û>8íRv¾ÿØJà÷ü/¬èëžêéyT*ú%ƨ¦½x’;!…½mD³z·-Î…egV“BnÜ +‡wÖz÷<Ê +èÍ‘}¸%åNÅCIÕªš¢„P?«=BGÓ|VFÕD»§§Ÿ-'aüfïì°o—ù°BkÉŽlƒ¡Žfðô,6ÊÿrÍþ‚Ù¾ÿ~Íšºúz›¼®»²øË©ær†,ÑnK´Ék¥§9„¡•Ü#ÊrÀð°(ßëü¼J n€Zå™ ±«üjA¸©èï©8 JÀhšÊ›&å£rE J]…Š‚Ç>ëSº%øÕÉSDã•ø|ŒÐ$z3{í½!KMëQšÉ4 IêÌãÖ µ×Ó£9š\+Ku¨Î›5&"F!u¡T†zN„„×IlZT™€R r±ŸG¦-2é𡵞~al)dzäÈbÇFb¬eWH<ª™%ç"k<»*ƒpþ;ü•èÆÃÒ˜Ù5`i`Tãå°¿Ÿ²_òÎ H—…¯¦é}f!G3Ë +k–øf5d5ÃUŒg×àíƒxÖŒ¶·¶LTÂÀ.¡ ñ— ÇÂÝ(mX©EK^e‘¥]ö˜ AHÚfaooy˜ÚZUµ„N¯VÇ7 É[ËHQàxûm/æv>ñQ`oâ¶—]æ×®‹[³]·gB†Âijy74Ǥ{ KŒ’œqm›*Ö·ì£]ëw6^¾d¾·Õ註Fxëôß ß¶¡ƒ°ÔŒ–£ï»’ˆäÛ²+@ïpŒÂ5—¦ÂPΦ³MC7\Éá+]À" ë•î »Q§ˆ†VºÃ'€[®.¹ey<(Zô6!ƒ¬²*ÖFâ3H1+­úî ÈgÙ“ú/И­t1o$«Õ²‘a¬KœÿjêTú›°Â– óä¼¹oŠ0ƒ û ¯¨¼›¥ûæºxö|½T«|UŒö$«ÌjU”2Ü]e|¢?ÎM™zu:`¨~ó/o6ëIõê|…ªj†­ CHf®aÂ%©™{¥ÕGLµ{ePiy}«H +Ê~çJ(Pj¹ ¿žûˆׯo0öŽhË¥©Îb¡Wð@×¹²õçBo tC$±T¬ó@ ú9Ÿ±ôê…‹àx“(|®\ºæ=ÊD± M«@cžNœeTG—Ap®0¬Ī•S^I•^¼4]~-NÜÄ>Ys9 kD]H£ÒO&ÁC©Þ&òº³Iu?Œqæ¾ðLGGÍ^tfß™[¡}úfRA{ä¿É³Ž<{JA·QÜ3·¦q‘å‚A.ž+÷Û¹½´~‹¤:wsë +Å$1¡8Ò¼%áuM«Õ„¨é"UÃïp¸©ÁýAçê|#êèI +Ÿ>OsÍ1)ZÆq§¹Qð ()j 6Æk„g¡Ðó{l-óŸ a7©¹:3¿æ‘r~Ç÷Ô0ç”7û¨ç;Î¥+!Ó|g:˜)ˈ;ù«/•Õt®QÙ*ØÞt®å-òUôÄJÜyWDPàØ!A–Π®N[j˜¾É±$'íA—|P^Æ\I ‡ÚaU˜;àçh‹$G‰~¥Xkn†èûí³S¸}"ªL¿Q;iz7'!rRŸª5·èpyÙZsÓ¯kh©Øó¦s5qug:×⎑eîÒѹK¸d%Céÿl°¿J4UÎEgï ­|zz‹û%Øm¥Èwàèšå•Ñdäv}e“ã ê‡ ‡9ÅO—gy,סõãôŒÿËEåØN +Ý(VØ»Ih³t³@]?ãb×,Ó:\aÙ̲FfW‡f9~+.³lGs!º4Ë/#¶ÊôfÉšh½YÎ#Ú°ˆ>fæs³YŸ=—‡±‹W³üdªRf¹Ÿ5pŽYÞYãFóY:²{k<4´tË~‰-ƒ§Ú]»q-wT‘÷Òü@Ëw¼a²isÁ5XŒ,Ý}LÙ‚e—‚w1|˜ðl¡B%ö¯gz¡RÁ•Þj¶v›ð*z`¹Îmd¬è„#TÐÿ^Ø£ð"Ž¿‹…·Ã‰—£Ï&‚ /D§2)Q¼à…°lüô’¡Ž·éSè€Âðˆ®]æï[]-†iã`éxñ(Ç;sViçxEÉsáx£æˆ¦¯øÙV¦¥ ¨çxéç¿b'Ç«\‰@âÆ+  èÆKQBÒy9U{wDÈÆÛƒB­~Ýx±lVÎÛxeÉ÷™ÞÓx‰è^HOã=Bsš_ä)à§﹟ó€}FãMåA¹/ÛñößiëE{õ¶‘Ãx÷þ毚+Œòðj‰«=ÈNq°Ð1ì:2"À€®e„‘£VÏàk“ecCSùùÌF´Ä…&Œ¯YÆÌlE¤j„‘ˆzgïÊ_˜F¸ËEÒá› +061®¶Óƒ|$cÀè‡0Ó3¾8d8AT­|QùÑš:ã°øâN:ê"â‹£P }1„7` ø_¾˜6 K!Q€Qoú„ÇJòWbäà‰Qv-1ʔУ'c߸S—ÓCÎäL™°Äh§*$yi‰QžÒm‰QŽ,¦é$å‘uI/ã}þSVn¼Uãe[Œ¨Ý7¾Öžb€æÑÆÖÏ1Iµ‚ŠBÏÊxin bdÊq€"属G4µ¦î⦬; ‹èÀ8²”óÛ BÛ~&‡nIå(Þ:€)I·0\êå:Ê ö‹…¡W°þÂ|¾+f1µª“Ô•ÏK?ƒ8¶Ù•ŽdÛãD Áq©TÉÈB-éÚö‰‡>7±%fê,ñôWÓD¶˜îò<áGÂ;ar' ˆ=ø‚¾9˜¶Ï4±Àê<%­¢æ"íÇӥücÕ d5uÕsQ4A¿ N…^Ÿf­Z¿ +x3Ä"rŒáÂG°W›­S“`«U‘U lи„hêüå=£ +$«ÉóÝ ‡ƒY«³¸ +ã©K&¿²BO!ï8)KìÑ>~—‡û…š9}ÐLd)ï—e7T»™ >Ã\Õ_´ð\‹ZgókÙt=©JýÐMD£ªª¶Š÷ê¶§ÝêV*»òwî&þ²¸÷6¹fÝ¬Ô H…¶»ô±®'›“J¤¡7º¿Ý"IÅIQ±‡ ì0 z•%9ú¶À_jzçÁJ0cXS­II–)/fEw…W–¸¸KcJ¦t—fBÄšÚo +¡;•W:dJ* ž4}TÝgÈA³#t™¢{æTålVúXA@êç³to4¹î@%懣Î.ÈH®éœ¶âîT,3:Ô ,…<”®4¨V=–Í%îm™~¶œ5ü{wТãɆ›+QÆ3ïùs¿1Tî°Ñ°f°,ûÛLþ¯Uõ%3-a5˜@3›ã‡Én“.¸šèdø—·(ç\ãwLØÿ!ãÒp1Cô&kb#Ö®ÉLÝ_Ò5¹óxƒ¿¾©á$ –µw¼/Ï®R²¼£ + ÉÕÁ!øËcAîœõgÞ&–kº‡ ¹Ê8Á\Ú,Œ†éƒV_µ~¯ƒEisi¾~é; †+)–ú+5E]6QnµÑƒgý]4"ÕýóÑÖæy(Ĩ j–Ñ„›AOÏ +š\« õAƒÆEñìÐ)ÄÁÞ ÔÝÈáŠh ,'gïsbÆzÛ ä¨SÏ4 ±‡/|ünO( 3 +Ô3Ȱ[Ån5ÍQKì?Å„Cÿ ~73нŽ6rM'Å—q·Ý +ŠQ“Œ*µ|ÂaÈ´É¥ÛîôXwŒ6rÓ ¡Ó/ž*„R``dˆ#yÖ<êU‚æ*:h5ó ‰iË€\™Ž`d B˜‡ÇI #\Ø“ u”ññk%ªŒV“7J Üp9n+LÚÿ8æÞ™¶ë0wÑ3Gx„i퀻ޘ~·ôô÷ŸRÙá‹$ +0-‚+ƒ8&)# nâÂ3¥À^·Ueýz»ß“Fõ‹>H¦º6…ðBäŸÀt>S…‡ð.¾ãÑ%t㥃sBt¼‹°…o2:ÒR˜G‰±(ôFWÊɳpbJ+³M¡Aoî§5â*‰³é¢õJ~ØÐÑ¢2+YæEa_ǦE3°µ¨5NˆÔŠõuvï‚^TSÆWCQÆ~;|dü+5®DT@ †Ê†Ï +”´ç~„¶ÏžÒïX“´ÀPS¤ÿ™¥²L•ÉâU¸ÚãÐð‚G¢m¢Ba÷.›@ † bK±7ƒÚ 1ξ¦3cêoD¬‰.Ièƒàª¯Toì^ðo¯-Œ)FÁਗ,\°…vÔ“TÀÐÌ[É"ÑÚm†@°©Z¿b!ƒÊ+?”ŒvUM$ì;§A6H¬ø?€|˜¦lïg +Ç¡|uÌ(ö Yè›ù+Ð3锾(æt Wçš‹›WºÞ'ºp6nŒ'hw ×DÖUZ·{v +U †®¬­tù±ÿ'ʧÁ3:$ Dµ`p•yÙ¼ìà_üSZ7ϧé@ý@V?|ƒ¡|} ‘ÚΧ÷‘eÜP;åû³vÒvj»…»mû8¦wÀö¢2¤ŸøM§ÇóD ž±.mBPAe^#Çä‹Iw{yÓP¶Á´xêýôT{\Ü.Òòmñ©ÎøWȵ¡ô¶Uw!ûæ9ɨi?¦Ut##Âó|4˜&5rc–‡Ù¢·#)–X° }„Äj,,ƒÂŒ+ðúZä|Dÿ[x§¿Ït|Â×Bà:=è°5>¼ÚDƒx»„,™ ê +¶Ÿæ’ÈuǹXdÇT§åf<(êÌV!2Ai5`"U´ +ÁÔY>#ÈS•‘g%Œeçä„ÞÖù"îËýérÁ.ÛªO }$HÚþªÜàÃ*´aT•µ†TL\r(+÷à<±Ê©g2P¼±t_®Ð±$ÁxÿìÍ2zM2¹1öU¿ø² ”o{YИi¸îIˆ2’ððøÂ‚+¢žûEÑ–(Þ8„ÚiÎ'Ë„ÃòaFÙ(é.$aø³´sO ­B7gSlCÀ©=1b¬õ/¹h +[/@‹©?)2k&©[‡Ò࣡w´ª£Bš‘·aÌVªa†áFzÆ-h2( ÅÄ„P¢ðÂ*D§O¼CÑ“†šX×…Ê<ŒQ +žEäjWЧ…hDÊ DÑ€R‚Ã7Ÿÿûæ%FüÆÝÉ¢ÃñSîN=ý]O<­ Õ´›RÁרÿ€õi2·/ú†ÄG~íª÷hY«-XÚª]ÛPSVTó¨‹Iï;ØÞyvñö˜7«ñHqÌÅÃ>ì*´¢\‚iª]±û¯e³ý´Ø/Iã]ø}{®6¾;TGßè QatŠ’/ºÓtѦÑç UÎ+×°cma¿ô>”ãµh#šä ’ëCE‹ŒG&j6ÂXÃÑ×Ñy€RÈσõ­ äaX"ž‹LlQ&Ìc-ÇÌvˆ¤†&g­­ÉW¨ó¹Íþl³ +·ôÔflÆV!$ÃX Ákm»*Õ½vÊþ´ELï1tEB†‡ØsÜ5ÅÆ"¯ ßÄÖ›9L{òŽ2·ªÖ{mc-ò75pzü¦@"¡J ‡³ï„ÜòéÜÒ¨:Û¥y9†ÁÔÖäDeŠ+X +|¡û`ÜW4ž5Ž'F‘Ä¡^ªOd³½ÒÈaȼ,ƒÆKG¹Uø†U.øþþäC pP Í¼äÊÀ²%äÃýÜ +¿›Ö'šRzgíp‰Š«óSYnuãæd7UååDÑO„)fU.7FyšÈhîBá¼íûZÇjí®Û}ùlC̼ҳ”d>éªä,¸¹KyÄ»0|(F"üG±Qcó]eo÷,ƒS¨;¢ÿLôßÐ ¿IŠdbY=A +‘ +û´ô—/I!'†Âjx±@xDxeh¦¯<¬o–‘‡ÏÒ1Jpê£0Êc‚4]ß—ò @ÓÅ)Ü D*Y;×Pûw›¬>Bƒû¥TNo-hZï‘pa=Ç®1å1z+«)ÿ¦ÒìD­{-O+O[ ¼Ÿãy!ïm2ìaÿU/­¢j¸HjH38|Ñ.I’‹ãy¡¶àÿ-¸ êVî2#rÈ~¹¬ªeu’àúý;&ç"»S9Ø,ÊnŒ¸=jƒ°‹Ù€ˆã½r`q„Øê A0NØ!&o°SÜGMÜÙBÍgä…{ƒ™ü•r™Âè&?æüðXÕ,iž›ÿÈ£ÏRôõX9ÿ…ŽFštð¥ ÆwA+×T«Ò‡ÍÄ÷Ê­^×3­Ë“”NI2ÐýŸ>Ÿ&Å~E¦ìE)&˜¡A÷OÙÒMùúíÈcì(Í1Éàx¢†´æjÌL&¬¨ÆÅ›žHE ÓR$vôÄË„PÏÜÁƱkûE.é8R]Ð$Ù矀>$⪻͂u¼6øåÈd%VJð^…*Àýû1Oë\/Èû@4ï>tô/9e/Y씃Ñkz:ˆ¹Î8Gm;®DÙ‡MQÏ~3;x9=¹%dVX²¥.ámUU*šRo†ž¨'´v¿F£Éø1·`Æa$_‘ƒ5Û-A^&{§*½0Ã\’IY(04§—ô +NV8C·$äM$ëáQ£ô‘KG ˜23uP¼âÒb$T®Ezho$îZÎí¶˜!l8pj—5ùâÑ1åÜ žÏÁ:|?và¢Iº#º‘ÚÅäSß ÇnhÛ™šlS È@›d‘gÓà3*£ï§Ð ! ]õYx´Ò&²(šá7¦¥îqJ‚vcÀp¢ÅìnÒì¶>6Ç +πɆEq:"W1 €•xØjÆàÅ0ã[ =…£jZäJ$°²¢ï,'l°2±¾í²[îFcö‰tò²¯PÌ* ¶Þ÷r´Re¶•<»õ¦]éx£VüÚ6LЪ¨åUjwDWŒ5›rÕ‹­,³¬|W6hœ˜™Î˜~˜Ä.ÐDÑÁ¥ÇYˆÕš†dmx¯<7D³•Xz»g•ô+ì×½ŽB“Ìýu=}*‘‚û9+ íh/ijWÍ Ó®E¬—æp¤Ha™K<Кè1¾>ô Gì ë^7Ö˵ª§×9ªghä¥Ô!KíôÄGXId,¯"ÄÖrøV¸•E⃟C7uæ9{_¶Eïzã XQÔ +|~+lŸ,+_†‡†Ãa›YmnMðëР"ÛK È̤ÕâAõâU•–¡¥(‹—äŸXA2În¡~QõHk&ÖÁy<ò€ IýŽAô™1êTRm:»¸}àÂÞÿŨÌO€â£ÙºÚŒ†à.à#1u†9«ç樆Ì5øŸ~$3n·iEe®÷xð½¶Ã=}§­}„“m°ELP‰0Mï]6=hŒyÿ‚ÛôGw{®×”±*¹mß§ÀÅØ‹œ&`ˆ×3>1¹%Ø;pï-8ªz„Ý]š™¡Qž•ömA¯ %½vÃú\PæØ¼—tXû‘²XƒË-'ëˆ>ùÿ£Öãì¿À‚ΊЉöQ…Ê:>îí¬±ì…ïFº ŒEÖÉ56ŠäÖü„PýkjhͳëDŒô¼¾qaî17›Í0½¸wµ~+¾Ì¦ÊM&Ós±³Hð¯ÅèšCFQŸÎ@œúÄ5m˜e?ƒNÜÀ¿D߶ᙢ‚ÀB[ÿÑ‚ ‚ÂI#‡ŽŠj^jz P¼÷q™ê7¾L#¯m.Ùoá~ÓƒLIÔ²0ôLRŠ7\dF±LîMf€¼7VÄ¿Å[`Y¶Q…}§•gkñÕÍØZŒZ >ÙŒ QoÛZ£¡Ö‰(žDöIHÓðdº4[]²†i(h–’èÒ žÂûjü,\Aç á7JI’>Ÿñª°‰úEC(t˜Xð›ù3@š™V_ŸSF­ÜÌ„ØÈ^‰´Q"¥øv")cm0$u_FRBâºò Fh)Üú3h]³ [ñ&°>ž@WÆ'uÑ^s g¤ À@«âìôEÏ$@už´ºSKÿayv¿Ý²%¸ë÷ +ä· ¿È;/w6œyUñ{Ùizeݹ¶Åk‡MŠ@ßø FÙ¤_ +ͦ¥[WJ=ŠêßD€›ÝN¬àœÔFñY@à[ÈxRv)OÌ1OqIž'Ž¢çƒzÖ®®5rÕ-°Ü•‡öTgÜó‚“5ó=¹þ3Ýýé‡w~¦þ>#5.€”dEʧœùXJÒÎ{Í׋¡Oƒ +Ç|ìXCíT‘u´O=Ñå°%#ËNyŸºbD¶¡;ó÷Õïc&ïH|Aä(‰¥%èˆ_[ºÜÏ'rqwøÛ;(X-Møó…ÏäsHöžˆµŸQ;/(܃ çàÆ…ÖàØ½®/ý<Ï–‰¦u]ü€JÁ¿o®'Ñ™ö‡èÐf¶È‡Áü ÿ” +EÊ>Ù|ŽJ^qô©Øµ4XnžÊ;›à|x%9Á‰mv”Ïyñ³g=ú,õgómÕ 1E 9+ÚÔkþ²,XÿÙhæ;Ë2ï34~’’«Y¶Ó›3„Ñ'Ê ~%Ó4}Bòð±)ßì‘&p’KXIz³Ö³#飂‰l¼dRÉÆåŸ4O£ýë^Kje%<…gƒN(­ç&ÌÁ·¶âdˆ7l€šû”@IJÖ®·Q<:嫼tE¨ˆ^‚!Ê-0C¦†?€žWùFŸ, ZòàL ˜¶ öÑnaLF/´×…<¾pÓV¦,ÊõÒ%DΩ–ø\ï%÷¼Ø>¾Ï8‘É·wÎb(™˜´ÁÐ,c1}°ý”`«rÛd³Ý¤¢„oœ æ›jʼº>–¿¼Õ¥É»`~IÆ#™]däøÈ©Kb49ݤÃI®øÄªM.lÞeLÝy}à9cã;§ +°×zb€¼ÖbäûÈ×"‹É¼%’€“—àoeEâúOPÛ! Û0àÌž­€uÂ!îUz¤Æ±“tÖ_‚_‹„`ä¡ Í¶0­º—2ÈÚq˜w‡s<¿sö~9 `v|J0ïݳ¢=çÌ +’ŽG‡TtBmøåŽ|¹‚Êâå¾?ê&¨³>²µØDÃ[9Þ‚®Qfr°iŸŸ<l£¥Îü?Lúrb)»l+‹ÞYêÕ¿‚BS{`üÒw”k7¬òù{ÎJ“ó÷¦¼S$ѦÝXˆ+KE*{º„uïx‹Gîás±–ýº:n˨ª³€;Dq¹¤›Éç˜O\Õn®q˜ûUDZßÅ‹ùªäÚÆ¸ÊK=seŽß^›et4#ÀÜ +˜2Ö Ì¯nÈ “¦ª[&Ó@ÉÌr“„Ù³0ÑK1LÆû¡s˜Ê¦ „I³B¡›•ÛR_§[ãt'ý¨µÄèe(º¨6 >ûµÆñ–yÐüc‚”z¬xMn˜ÿÒ’7Ó–ÆÒâRÖ¥Áö.öôtáè½L9ïÐñÂb|‡>–Ñ-Ù%|ëó„Ê+4àÓ1[ cV†:à9,Så)cÐ_JSwdÊ—õ©pv\{º>Z=0†IËIæú“ÇY¼9‰îßBÊë\¡…rÔÜ2DJ·Ù5åcGÅá¸`©½OL’Qžj…Šªå>Gw¢™y¶ìЭ®[^zLÖ +ÿÛù\Ø9D#³Í´"‘>*’±k“Œì{€ö'8÷ÄE-6^ÞœÙ7fGÁmèR#êä—ç/\.;¾ 9cU‰dOR¡0}K3PaúBµeV1ŸÿØŠñqL,àiçŽLü¤ETËbÃÈQõk»f;[6 ¯o(ŸC½=YµhFÜ×¢hu!@ñ0¥‘`8XÓHn¬8óÐ*¼Ä-#€H¾×Þº˜°³ªK*BiÉ>1%å¦!Í&T\-,B9GD&s¬¦÷ªü˜UãMÒ 3VÍ¿$9Ä#ÉÊ‘€Qþ•É·j ž»4ÉŸiÖÁœJÕeIÌÔ1 ùÜèRÁg‡' ÿ8H‰‚ËÊEâìoÜϱÁnÖU-Ó²îrC¢Zð8¨) ó` ‡H+)¶¶°Ùj]œÞ0ýçnàyÔ. „¹¡7Áß*$жÀÉVàFM’÷¡9›ðYÝÈÉÜ(ÚyÀxÛ. +–L<³BÚÄrûpˆ]!l. +½¿eƒ0A»4$²4Z„*fÍö=GÜd÷¸˜øHìÉ"@L 2 >¦Œ_IñEReÀïUDÍ5’vC +Å+4 R£FA* + +sí +È“ +ÆE@AALÃýww=A€'0í)ºcYË s»5^sn‘™€íeb‚B´±¼Uø¤AøS'æQˆC +rÐÊÃOË@ZÔ…É4=µ+qZMîgßcš;·Œ¦*¡iwRë4¡Sj}8ö4ÝæÝ'?2³Sšj(@áÂE@'‘>` ôáÒ“UÆ*¾7Ð ª'¯¢ÛsÓ,¤TÖÌ’$¨KØ7$Üà/uÿçîÃηÞä™”16¹D$M…ɵZI¸ÔŽ®§ãŽÛ‹X$Íúõ]Z]–؇;”ΤÁ7é±bõƒÐkÅØ–V(-~Ð/­øÇãAWVð+ø½ÝoǨtM¡:TÒñ3é)œÉ1ïO¾P‘ álI“j¨Í†¨Š¥”0Ky†pH‘47ô -¨¡B13))‡ÌÐ"2"†ª¦ *½P”±²IŒ€V 0Ïf Jøü8—§F„Úê%íû2¯~•>‚jÆbxA ŒQ”²pŒF®º¸‘ªé÷¸¯‡íôpØõ·­}x@^ë<_gnKŠŽ1Ú&Ç]v²õ™kYÝ ¦XËôNµ©ÕÀâ´£aúVÙh™–®1H¯p6G‰I¿BÒ÷Or¿²íñ‰!Y¢§@6ç=D±Éû1¬mˆx"Éæ†ï…Ä+ õ‰$—ʪÞÓÒÄR`Vº:Aä8]b›®Í†3¼d)Ÿ–2ëFUÜ×bL¥doZ5åfæÉÈ)Vƒ %£=VÿV?.9³ʨ@ª–Ù§ï‘ù@W1 Od.œ†c3‡;M1ÕH !ØCÞÕArÁ‚/gy) }äÌjO$h&djòÿ¦•„|ÁÔM!-½#ãÊ4ÒD+Ú‹È#IæBþà'DÈ•é' „Z83¨Ð3wA#-i‚š0¬ižlbÂMYànœÑÚH«vê`3¨>‘1Šlia¡Ü÷×}ûãHÅü«Ô¿œ÷Ý¿ ½Ügßÿª™RTtv•Â&ÇÕˆVëJª<×+ÁºÑ%*ô²Þš‹Vð›øÍÔ_?øÂ9Ôtï”O¥î!á:a¯ð‘A´N_ó¦:ÛÙTðçkFMq-ª¢ˆ?v0 Ÿmb‡˜.a?­$m¯½i4ìåö|gtõЧ^Ü—¢ÀTmFLG…~^.wž¯5Rµ™—3 ¨ ºµ>¶Æ+2®ÖÊÌZâ üb7Uäû.³\Y]ú\‘Ò!ù× Eî1³rÄÓ›ò H??øÝ_Åý&ª‰“ke£ŸÐ/ãÃa@ãòºgO\þçÒ ¬Oå§“°mÁ«X‘ò‚p%"ŠÅÀ® +1NëqXµYžÔpGÍœ¡àùÀ£›50Þà§y‡FKŠX×Ð`¢4úz£Å´WLIÑhŸ +œ¢X°ò¸O‘RJ¡1*;ã—Wm½NETqCUj="i·•w%ÈSq,:€IX¬]ú#—‹è#uº`:YÐi±s?ZÛAÊ*Ф“‡Æ)ëPg +± U¦¡ö2; Õv¡þ,²Ïèå3$®/Õq†Ä6êXýÅ€ÍøæÕ˜`’n|÷ú`‡šo:Ë_%›QÖðÚ q[}ÄrúìøÊÌÝ8•‚—-eºrçn{ßçw‚φ¯Ç»äé÷4º|¢s©ÂÌ%[MEõÀ9\…&Høz‡ÚUR¬Ó¬x_ˆÙp¨FÇ Xf¬ç–9EhcNúMÀ?¸)í¿ñþ`ídJ2ÛŸMΛ þiÿÏ¿Ïú÷™†r@†a“KwŒÒb_Adˆ`B`3mÀ¢Ur÷Ië½á feÑÀz"ËžîOÆæñ¦O>¶zØñ™`”¦ç`1·_ÉQ—r0®}çr'ø=<xÎ@€bC¥5]_EÙBxyy¥­w³Ê‰‰…-#rx‹c'ÃŒ¤äràÛäÒ “0-.’ê/©ý^lø½‹;|õÝÉ9uò¥‰E4ÀÙ–Ö`¬\ê=QfˆrAyQ佯ñ:Qá%ù.ïëî"îBa»zÑÎ=£!Iº‘´q¤Žëïy¬cz;þõ޶/íqõUúc©%â(™#øÿ•ý–ë4+åÕâ³Oëf}[UÝ .<ŸÖÒwÌ}¾cᯈdÕ¢êÎd‘’7¹ƒ•ÆFaê˜ó·Ç`JŽ:/Ó1Xb–zÿ H|yÈ´ Bÿ(“cšàa +­ý™¤©Ï¹’crºRåtÿÓªñµFGAMÊ8>GHMM&6 ÈoiPô³‹R”'ëFß(`ϵÀH>çðu”hÉ7†lc¥Ô>ÉÞ"ó4dü?ÆùŽQü…„]†­ß•ƒ% äõ2™¯J×D}Ü·€t^Ð £x ðƒ†umŠªÚ+¯ÒúʨW.W…ûêÊdó§‰9!K¬{GÔ"s g_j$G±ïaÆi=ku?$W¾R»GEõs¤ñBÈ´… |šŠ h#¶BÓI|^ÂÌLx9Aü¿mN’EìÔ>¹üÚ@ y%&«^ç4zÕ“óæ¦Ôâ! ïÕï_à $$?¾Q1¨n*ÐY¼Ðe¢ÃýU— ŸIðf5šx0¢Ple Ҝɫþc¦gQŸâãâïf]’ÄoúQCOYN,+6¶;@‘C­sšÞVŽÜ‘ÔéêuŠ@AƒÁT¶bÀ˜çø!Å‚%eUOp6yãg"• }`ò‰S‘=#ïõ×Añb\Ðm”Â3@ö:z%8ê8[¶ƒ €«è?ó© +½ ™8g÷1 MI&“LÿÔšª_ ¶Ñ·ab™j‘´ülF|Á{KµSi¦ÿ›í•‚²ã†À'k8µ i£Ñ8šïœ…2¬ØGa,?6VÀý +|“¢n{!sðÒ‚+¤ÒÈFÞ;¨•8ç5~…ÅQ h_EÒ¯uÿÓDj~³&s"+42dW®÷«ŒÉz'ƒƒÉ:nFØÙËNn<&¥sÜ?Am¢›ØQ‰  —vº¿þf„XG(#ýø3W¤¿Eá„<‹qÃÑ1ï1G”ôÄ 1Ìâ5€eK ¶¬¢mÖÑâMþTù« eèé+ñkÎc »UZN æiÅ!~jJ`ÍÜß +`®é©`ðóyÁû:¢Š©S–!R*|Wá$“VBDÚ˜h¤[)h¥w§[æ9R–_ pb@<ÃNï4lÑ‹>0¶§i¼ÛÀ:Úµdôô³6“*T¾¯L4xƒ,Ðí¦7z­ºÐ&¿Ý¡¬Âÿ­Zà0”5@ǤÿèAWÒ¬Át†Oxw%’CUÎ"Èf—tÛ« »½×¿¨`†ü*:ÞŽ•þêÉFwÛíxü7íã˜8Pàîúß.S2jœËÉŸàÀôN]DëÆ…ÖbK¶v®Óõ˜ Wk=¾Ü@%{[ñ”-Æoû?Ÿ·¶÷qºL'vL0Oã9ˆx,·8[²…̘7:®qO~í·+Änõ÷d|’Áï=.å•;Xx¾lCæ(ã.ïªâ>?Já,…ìßþפ=QàíìÕóø€ó¸Òì|°¸Z Ý{? ”ÍxßÍ&sY\ñ ÄaîJ¹`Øì€iA¤ÄŠ3iþAKz÷¤…[ê—Äeñúz‹ô8p›”þ/$'W4ÎÄKlá Á‘ÖÿàûšØkÑÿ™"ÿUÏï2Ü4_ôP¯Iô”ÊþÒDÚ!WRé&¾mŒ÷é…Oå–&„”¤L)I%ê0j@¨T ´!¥ME­‘Ò v“|±h<^IbUùH&\ŒÍu€ÁAñ›0%²N;±ix0¶Yû M4 +$vCs3†µ9‹GN•­ç@¤òòhÁŽÛ£¼Ö“I:‹§Ês® ³x‚:fö, Cr” H¾X–d†W¬˜P“Æ›%‘-Õ85Nßæê "h‘|žbKhÖo*6ÖÍ*—ªÚn)9r®7åT+Ñf&žML}ªb(¬Dª&ñÃfà +Q, +4[哵\º•sói¯Â­ÅÚȤxsG&ãÆ¬Ht^­l˜‚gôo[k³}™K:;¸\¶‰á2Ç„ËJhFöÄTæ’É|æÔm™ÇªòWÈʆFCÙœb‹‡ÐÜ1Î…jΙRs;ìÏ«~bÑœ¤îéÜ3 ôŽ?´R¸!bªyæªí%l­±Àòx>w^bº«’—þ©ó<²)¹ÌcAš¹ ÷P*Öe³Z-J< 5›èlÖØÁÎKb¡?`½þ¼f\"“ÒœÅØt[LeÓØÁŠf5wPXEì3tzæ ù„ù&”ÕÁ÷îëÚb¿’ŃÔ?ÙÔJ5ÜZü›Ðì§î½˜õMˆ{¹·eZCtején¦j#¢¨ï ’„Ò,fDBm>¯;ÓÜã~Á9ø´5fKDS ¾£ÙCˆÑlì\f!cœ3²!û>2¾â7£ÏH“j6_L*T’Ɔ1š…é‰r°G|ŠÇFiÕÇó™øÙ\”®h^K=5õL㞊 +«™™æóšòŒ}îbìœqÌd3_å3rr/d.«Ó²ŽŽÆ(/Í„¯ÄÁ•¥ÝÈ3Hzæeб‰ˆ4£),mTî­¤Ö +GïÿÓR^& …q³|Cym—*Q(j(ßlÎhE®¹\º~,Af'h=Sò–O^œá\Óª|$Ÿy^I#jn«B={F4O¹ói0ìSž_ÈóÖxè‘×V +õÍ|:(f—OEIN™"©¼[ý%ç¬uK7¯âåU­`‰I9#‡ÑÅ‹ªR"?G#29dÚ˜Çß°Èí‘p2&‰‚äq—⦠MÑç$µ +µTõqK–S”ÔE!1Þ¬,Ò¨>JV3*ÉA Q™éñÏêSÓ—9;àI·75w”nÄRºj £ñÆZ–¸½žd’Ú§æç„(—ŠòJPÙô9R=‘â~•ÝwHUåcÅ[¢GýÁµõ×á( sf¤l¡±Ð¢q»BùÐK¨§Ý’Å™(]-ºï|¥ÚSF §LŒV57)G8)È}õsY ’ÕõTE{‘ù²‰'¿SPIˆ0èE«S•~‡ìà›Ù‘»Áowÿ bNg£wÇД~.ѲÑGßGyh©Á)1âÛJ®ìÒX(øò3D‰y’sPÖü7Ñ$ÐW®—š`§ ’*2bFß­—ú¢'"EìE¯Ó˜‚œËúx©yÄ|亙"ßì…(± +ºI”ˆ¸×‰+úF¥y8~,v‹YìÞH•£YA»‡ + +!Úó‘aN«%³Q˜/yCc採ƒÊ‘¸DÑÈÈa‡«l#ÊÄã™ÃR,j‰hÆ61f‘*‘܉’—·Ä(LJM’fºÈ ¶ì` Ñi³‡ü{Zj\/Izy0È7·;)>&·Œe*=!5»J/OÎÁÈ8ÈÞ81óÉ!EŒ‘ž«#X1ÔO/bŠÖeC·ŒÐCÜÐ +Y¤}(Ü“ˆéòú*ÅŒB)Dz'‹’¡±E1‘‹…‚EçÌ¥L¥GIÌGC–jê„þ X, öb¡Ù“P—Ë“)Ù-åa.­këË•ýK¨Æ3*– Qs06‰”*ÛE}l>\„_B¶¦x@¾0æ-a…jÂU)1Ù3%¼ /¨Æ#´©ŠjÊ3´K1Ÿð°á¢Me‹{?Ezm鋯R-jFVAQíÿahïÀµ™sr³f6$UÂÛB©¹9&‰I¤—7²³±êI¢¦–P9UmÅ{HE!4UUÉEY®ªË"BÝG,»­eÈ2ñ !{R)²,¼]#½ ¹etImU]n«òñ4˜RÙ$×{ »e q qJbÜiöKAª‰B‰¨ SÒõ±¨QE¥^HHêRí©TG¨ö”ÜÚS’2o…”¦î’©Q÷Ao×çµXYf ?QÙR‡Ô0^B!OøZsnäŽË¯É35¨ÒR«¹HÓŠA4âjÄAä¶%5O¤hu²cÕÄÿàŸÝyƺœžªbUF¤uºm7ª¾¬‰Sg kBä2áDÎ/}h Œ¨W6ŽÜþ‚ZôapG>ƒkH꣙È!JÒ*‹Ìùœ‘5y<­úL©þgÑæ»]A‡Zugý #܃ü `IºLâöGS:dÜéüøxÿÒÁ¢Ä7Ó²Û£U!]KNNjê4‰à—F5<•ãNÌ5!NÝ-Ã>(âÏ»Žà:`(fašºì#Aê`6W ~ ßž­<¨ hu;#K>¥ƒ +EÉía9Jq¹ÊœVùdJ5•ûC1YTE#$ÿÒÉàŠq¬É¢‰²ƒ13‡òÇUM :˜è¼T1Ä< V k öAE‰Ë4ãºÂIt¡õpZT_ÑÚÂRõÁˆ¨âö@È«ÈAQìŸ"¹NÈ…JÄI9pÝùßt¦>œ˜ƒ½‚È!r3$«Èdƒ ÕÀÉÁJ9ÙäiÓÁ”ˆëZ³ƒz|îàu¡‘ÇòëÄ;ûØ45ªNÉ£ylðqça]E48 mCÔUœ"e×Hxô€|àYƒZ´ä +4«¾È3Å!’8Ó UB4kAFJ5}|BÉ„êÉ£M]86]¨#y¹ã“d'IhåÖ$:e¢Ìgeòåá=Q°”\†PˆëC,Gƒ‹VŽðŠÚ`æS'pãÚ$ÈÖey¬Œ8L&—Y ¸¬”§Lù+BS.ÑH •bHRv´N¬¢‰Ÿ0mDŽ…{B•L#ÖF„ŠÕˆ çÆE!%e ÈbY¹ÑÐØ9jE®²KiCìÀÅ6¢ C#äÅ%œ†*!w”PÄÅc<Â-<µ˜Íœb!W„Ë%d6¸%ä©M(6x8ßÐ&„v®Å iÀ*vl’ùu‘é9Q¡hÊbÏARbõ v÷5(Bécxx$Φ’VgxÕ›j;B¤Þ”¨2á3Ègbî¡…ŽÃ8¥Js<#YÄÜ5õîi%ÄÔˆ…ÄLuiš) 54D(ãzU•p(hž[gy0.fšÐñD(¦ʃ¶e+Ì-j|‹s†Å$H±PT½„¦žÀšQÿÀ¾©wˆ\xÎgê¦àY}˸¦\-üÀ™ˆ÷;xpö†´f\%¿é;ø/$jnJáTaSü¥$Èø¶Ì{S’ÀqÔ·ê {ERðì ¼j9ö$VQ†½Ú08 ‡Ì“L勳JàYB#š…Ë ?it½Q ?ЊÆei¨³øµòœ&^ùŲ?b™ÎO]ŽXiè2dœÐ³ZG·—¥ÅHªC•ªÊLNÉT›*×AìØÎŠFì”kéT™u×Љ„*ÎhɲYá‰Á䢌.3‰PÁñ½à;CÝ*ª³…<ê2®5„Vô¡!ÖŠÎ’™ËÉ$üe#5ÅÕ¿MuV4|73:1ü¸2 MÊ|¼èIò¡TÑJ/y„ªºÎ +ÃÅg÷Cr Q„áD¤R}´uÏQþZ^©˜[j±é4È1ª§,Îâø‚ A#‘¢Í‚üo¦†‚„*fâ¦U…¦ b…>•XÐKÚ°á5ãÒéA¡—W“!gí5ÆE6LqЇ"‘F+¸{¥Fíß•‚O«î„hH¦ÏHÕ?)ê×ñï2taÇEA£¯¤b˜„‹šŠ"’¹|GQ–¡º5&Æ÷^L%š iH¹W%µXŸƒŒAÔÀ‰9†£=‰¸¢X…èÛ²SIÎö/MIwåw)¤~ˆdt”g½î +vp@ú*rš¨Wë\¦ 0€˜à `@\! Ø€J‚ 4Á p >p€è\à€ ¤@0¸À@ ”à@€J T€s’H¨£à‚(à‚˜  ¸€A +6Ѐ `Á .`Á‚ F€ „àÁ.  \P`è|` ¸À@ð H‘DàÝ€R0 „à‚”à%Ø€6„€8 “œ”™‰#M5©D:1ΤšyTŒ¬_8Ç‹t¨àÀr™-uP²®› b´f¢&è½¢cÁj øXÀ€‘t€ ,°@ƒœ€-ЀAÔ5r·@ƒ±€,®¬‚™˜­JñŒfÐ)áÉ• Z¿ðlNÔûX{'i ½³Ñ¿V2X¸\í´p¨‘ˆH) ¡“ÅñQcv‘ȳqŒX%âŠhu +­f'9 +‰îAÕÅhe +ÅëѱUõjG,„º³cƃÞ.hsoÅ"Ò6Ÿ66>QTí5“p.³—¸CV qÞ,¨L‚Û2 )б-Ry¨1²¹Ôt® +½‚E9 3TáÓ:ËûG"ÕiPTM¡XJ^(OH)ªðD‡Pq*‹H†KÇ㸩àeAÖÔGaãy‘)Ùf„— $Ä¥'ÆÄ¶±%(«¥¤ú)O¬Š'ùÂÞ +µÔаBÃ`/Öô%)þÁÏú'Èj¨Ó:x£m°âÌ!ŽŸÓ*FÊü~bì¢ô±`.»í1JZ 핾›ÞjD†Omò@æ«2I‹ÙÞ)¦„wÊ&ò • Kx¾÷r`)_‹TøD|Fˆl2È6ø¦â¬OHPLH¹Äó´Q²ª†¢ƒ©éN(RS–£Ž;êžÑ2Ü™£>uŒð2cqZUSÏ[ãb¨v Õy?)‡{0sà(§C³¬’5,KÕPU¶hª¨EºJB±U #ëV°UÓ©i ±ÃžcŠŽX˜ÐPép=ª +BåA4ªb F‘0xZ +JÕ!¡z‘^!!?$¯”\!…“CV2 +K^ïGU‰‹Ô•§SGšMž9]Æ*öÂzÝö€ªê·1cIÌ^S샢š Z;>øÅ10ø!ò˜µ“ã¡ü±L±¨Þ•D Um¬8ºMÄ‹•tX$•x¬6qx´hÛŸº”}`*K¤K$Lö[•ãœ8±^”¼R!“­=ŠL/Oé©W«(QbMj%ö8$z¤Z~ÉǯÇS¢«Ú +¿,t58F…Gd$ÊÂz™*¤QDTãŠ*×¼Ô-Eå1QE•+Þ@&M[5G¤‚Êa9…ÅŠàf<¡Mº%Ñ„s‰&a¯ö*—"§egØUHÅEbVµœ¦Ã®(+Ë\<$²šˆK‰]U–ºˆc5¿D]L#îœdä@5#ê$ý'–~¢P%¢(ÁÛ§SeîO5q?PzPZ'T1å’Ë´‘ƒ•œ“Ñ©ô|J¨l)£$lV?©1Øe³¹“fî*Ncú˜j’1…|~?ûe}~¥L³=,|D4SUh¢ä˜C§xæ:ä";U[‘†Šf¥¡…§ü2ĦùH£ˆÈAš˜hØÅÊZGY®›F4ÛÄ92ªy¬‹—ËÞ°"ÈR¡ GÍ`øHÆLä35—¢c1SQ$Æ«&› Mwà"Ÿâ.~¬ª IÅ%Öé¶}ºÖälHí`BjèŠ ÂƒQ˜Žý§fyÃ|§¼zcjŒ Š CeA Eo@U–’™›Ž„&:>UŽ“j~°Á<ðN1ic^u¥Z\¼À¢?B<^Oè§NÁƒ?ˆ¡Ñ™‹L÷धB²Î;¬â)nºt‹i¬VÑÁN´šˆÔªæèí=¡E_9Ki :(‹'áAðBæM?Œz Y^«æï>rÃU„û0ao +ÿ ZO©y‹°B eÑ]†át@E¶ÐÓƒúeÎ0Ø®©ês¸tF|/ G6h2²êUó€&—¤ò¤°Ö˜Ds0B%ªôæòÚÁƒÄÂp8·p~Ïf,öû Ãýövü®F¼5AnÇàÚÂ#Õ¤¾°xâ <ê`¼&$ݸ!¦ÂxíàÄã¤} X—Ž"ô|Üô±a IlrÇ6 ÷‘;‚¤ÈHìÛ*5‘;ƨr]>CßnúŒð%1EÿH§Dº‡Ò Í“ŠE†å©hM¾ÞN3‹ˆ˜H]¡o¨Í´ª³SDOû3LGA{Ä&j…´ØS”ì±0;Žc–æÓÚ%‹{¦Y'nv¦ +Kå7­Øð¢Ý®±E)î¶?¶SGý”ª[1'uE˪H¶ú÷û¼J$¶£$V+!…¼¯JåÎÐŒi}}Ê8z>„î’&H Eijè[Z&u²|rj–ˆÇ= +›É%¢gPDïÇD¥º—d6#eÒÃPñ¼:B=ASwÐQ—RIÿE,ñ}rÿñ_ü(Yüþ*êQ\Äoo (Lñ ±V¸iª<Ššò~SeŸ¦ì˜wdá=˜ò"¼Ÿ ã´s1:x'Ê“°¤5Xaè`ëƒ& Ž 0$¶ÉÈA±ÛiåM«‚y0""3Ss +Ð`ö’w +‰˜¬Ãï;5®BØòaÓù¥Úˆzb8É‘‚HóQD¬Š""Ï'V“8Hˆü'Dþ„ÅÈdÚ<ß)y뜎ˆW6HöJ¾Ä —![’š)•GuC­ì­#:d³®~…RØz[ÜÌ®Ýv.R‚„OYò hI$mOå!éù +yb!~¥RV"˜¤Š¬ôTO1©R¹PÈf]é…4«sž]»ÔêëbÏË„Mމ¨«=à„4ó +T ò¨6÷—|Þ42Y*‰ÓCÊF#bÛ—©ÂAœ +ªºX‡YW´.7H$m¹%j‰ƒHtäxgª4‡Ë?‚^$²toCÕ©tÅE™Ÿ “’.ª˜'J$žõ\Ä£Ú¨0ÒÕŒ«¨,e»¨*†¦¨†¢<2ã¡ýT£ÊTp‚,ž(ó­)-ˆ/f‹ ð€Ø®x™ë!9õ5ÛƒVKj«SŽÊƒØö`3ÇäðúùÌé2Õ(GÍ,RoQÊ.å`uO1R)‡˜0iK®«Ð¶(JMkÊ›¢œTѸÆbŸè-¯sÙÚ¹J£½\òëÞÆuÓ­UÛMè +¡èJKpfdÆbŒÆi™ÏÈЃ©Š¶–ŠH‚^u™¢JåG0D‚ZâV¹¯FÜ3B!Äw?YMqþÓTræ%b«$äq~œ‘êaBU¡÷ó KT+¡¨”"ÅÐJKfóJ±1ü¢/Š'É51C×LxüyÕÄp1šÏg·M. +Éüªy=U#"›¿Q5sý¯ÌJHBÄ*„±·ÆcÒ=v íïÓù>Ý+4B®ŽÕCsùL†îS3"ûÔŒ.W’ªxТžÏSÏÇsÏxb÷¦*{ŌԼ‰ìS#²OÍ+ûÔÈ>5›¡šÝ41CûhæBÓ IIоÎ[ÝÙ‰‘‰Â%#†<1O›àO ñdÆ£O›éõ§îÔ©±voš"%úU8n²àÐÌ[œÐ=QÛ)æìE{idbèU3´ùÄÊÆ¬tƒl̼1֞Ƀ ‘O¥i‹ñ)J±a¼VNèy‹ËHQE1N²Ùân´&—ËxÕ*ÛÛ)g¶bAŽ£SMÍcʼnÆÇÝ•ÈÏUEâcÙÔ•mFªÔ7J Š<:Ú宕Tr¡gD.È)&!òé¼×CNµÕô!—:I#F›„¶˜œe«Ò*¨†,u”­&îó嵌–«¡Ç«›øjœ8y'W-^#L{hõ9éâó†'^,N]¹øxEýqlŽ _<¼áÄɳCDâò'~ƒ¢q 9B6ç”áwŽ=8˜çݤsúL¦Ô9u:ÿÌë!¥5vÑ¥µ}h¸MuJÙã·´µŠ–@ÎPIÞ2´ Mƒµið¤)Mºq|7”š™Î?!eCzŸ—ó ÏxH3ÃW…l#>6+>6±i á"~›X”öN?/9g§1šyk3§Å"j>ÅhLËI›¼f3Ûä³E”Égóœj6ÚFA*9ÍJƱœ³-ä—ý²|M}¼œ5v–oFå˾àÔÈlL›O6|gj›žÿ….õ)Yz!VÂR¶/™…Ä iYÚËWÎJKÌ%Z¹"}\ºKwÙå1ÒÊÈ.SÑ^æb ¬µH-ÓSH Q0ˆŠqÌİCìL¡êH¼Æd̘Œ~N,΃Û0ŠF¼§ª{Ôì¤ÙnO ÏØ^šŠí¤ùp„3{p¾ç˜à‚(€\ "ÀÀH“  +ö/G§ØâÞJ}çvCÜ4Y|žŒ&(u0#ž7ɪƒÞÍÁchäÁ‹©8΄Èe< Šδ3æHq‹Qâ8xümÍéJƒ0ƒ61átu³Ú*V¦;XS'¿FH©hŒb×T Iè¤JJ‹ˆ1™Ÿ +2AFˆLÄ…OÑE5$%Žã¢y½f.ž«¨¤d~UTÚ¢U³)MµHB†ª:aJ™Ñ!ª© )‡ƒ(8*¨Šj–jTU-"¶VãÂERÒZ|Ê‹RùÓ! E="yKlGÆDdð%%õÓ-ž=b‰ì÷¸8<2 ©q˜µz¹ü‘ÍKËéíš”U’ÚŠí+JVìOõî}±"Þ}ÍÔk>!ö!á{R6\•¸·õl¹1Q^oâ+âsŠ™£¸J«‚CÓ_¥KòjΘn Uÿú|ú›Ô$©þúæ`}Dü("SÛº‡Ö¿~œh4yeâ¬'‡ÍÓÛýS«ŒJ¡‡Ð!¾|šïw-£ÒèãgFôPhšè€$N°ùÑGò%äÑGÿSô|†DrS±»exÓ±áÔLJƒ¶ÏÜõ-kñŠ©[jçWrHoŽÈ K~’ÜS"¤Ælõ2÷¿Ê¼Ì!]¯:Qí„WåÇqÙeìWåiQ4ùª¨Â-(ãÔk–‚ñ]¢fr‹„”Ö0Κ ÍŒWƒƒ—íDì7*4Å.é$‘¢8±K’:3qUf:Í*gGä&§Ò mœ +"úœ2""ZÅ”mP‰ç·6©„´¨èP· ÍO.í¦°BÓ yÔ¨z%Vº&9(D{“<×LÅäœp'Q¸VÞ=ãi*;U©)†Ú YÂRšV½ûh¥CW¦Sk5úF½D» ‹<êZ³ýjdŽö´“5ò«ÿ¼F­øÙI¦µ—ËûEÉåV,ĸ7EÑŒ ª©5qx $–)B¹SKB¦¾-y£éJ…ö@†­¨Ô¯ÈFÃ$‡¢ãPX …ƒ¢AÙpDóÐ2Ha0(•ÔeˆIK·‹&ÌÃû‹–ÜZ2ÐåÖX¢<âÃGL’éòˆ°1­áø‡5úôþæßEŠ„N>)üÃêµ1Y¶Ñö~I©±XPÇhÆ^ÿå¼ñÖ$jP>€XÜQœEL/ëkçd{ Áäë¼ïUJúaSò!e+kûaEÊÎ;fR•Éë% ¨|Fø©þ°Dò¯H©ðˇŠ=ÝûaU4õ(T3ŠNûdØ~X`Ì6Ô<Ǧôùa& AtæÃúÌm…ÝQÚåÊ A‹†Ëft•à¢J`‹°Ó9åÛêå‹Ê€!È “éÀÏò6ÑÝ1‡ò3–2¯›–¦ŽÄ"4œü ¶=,ã jC{XB¼<±&îøß.1Ñ5>î˜ÞχÅ%!1ÅT±Ëu ‹”ÏŒ˜¤íÝii¥Å¹/ˆÂ×<{IW –††xpéÃê[If +ÅùûÔÙ‡%*³Æ3M*>¬þœŠqe¦_ƒãÙ¤ÝÂ/>£a½`8Ïp¤Ë*ž•”>,ÚãR‘-xX^yËZýÎÝÉÃú: –Hod¯Ãš#pwù»c‘:,çF*¢›Ý«1¹ëé°üêR_BhÖatìÑÊü+ˆäõØ@Ol¿%Ó¬!–÷–wŸ¿¾lÚË7«­38Äcë6VRµ"„X~þË”û;H›îk­B'ï«b•®C,prI󭉳ôx +±:˜¹l$8é¤qlåj*yºVX?ÂT;,õ)Œµ…º*Hf8.ë_E,Bq±4¡¦y[áÒr«§¹±E,ºöùh±¨cÄhUjÙ.bI‡¶° àA« @/:u’´ˆ…‚‰ä9ärh†HÄÂûeÆjlõ,‹N¤i€SD«e0’‘}?žD¬Jê–`ë¡Jc›Xø/×1ôß ›˜(M¬·Æ:÷1 ô{ËV,Äþ£_•·f+–@¢¤O+%• xr€ +†ks‘·y ›-–fé,=<ǧ"-–ÂHþÞYe‹5RJæËV Á0ßb¹¥"[ëT™¾Òn±âM瘧íÑ;d„-–ŽÕŠUs@¢bW[¬Éñ†d ªn +‡·%&Maô“².¦X.Ó…GuK‚%ÂÄÏXÂL™ð[¬@º¯7Aé-á¸-Vœ²‚=y'Cù¦¿Årž+j˜úªB~Ó’ËÁèðˆuíV<æwNŸõ;Œ[¬Ç‰»\¬@».ãDŸYˆ Žx±Œƒyvày4H#•Å]¬®Ìá`5Hr±tâ°J±.+ܪ}OÉÅ +¢Â]¥Nò²åb¡½±C¢Þ|+Qm±*ñ+þ¦ž5²“û-VL3ƒÍÌ#Íá ÌþÅs ïJê-V\–äÎn6±Ùg[‚QÀm¡Ûb…€ÇÑWp‹õ|öéÊ?Bre¨ÖæFDdû¨*±Þl9(ï[Æê¨Zç24ÖØºó†ãÊç†×Ôñ‰ÆÂ¼¨R‡Æº ´åüLcEæ­ððhô4–’ÓJçf+íÀÒX ‡ >à/ûß ÷Å‚þ§ŠûÎp{PË!Œ›Ær#áX ^‚îMÖ ÷ª–S KÁ£±ÛhðŒ–am¬íAA”`rI¸‡h¬ÄæÒ¼–ɦ½_¨y1Å‚Xü¤íXHýMÊ  *,ðÜg¬òR'…š±v„ÜOÖ°Ädµ@È•::ï«ÑLî76CfÆŠMvwø2 +LfY Ü:Ž dBÇŒ…ŠkÁ¤Ð  «Þý¸XHœu-4ca]6‡ƒ>£ž±ÌžkŒeØ V©‚Uû6|Óbè)ÖK›Hª+]iµ,2ÝŒ…·¥øÑŒeÃD£ +O:åÒ0˜TVÌXá û¸ÝãÞí½€wým«‰¼þa&VÆB<ù×GðÉÝá݈ñ&e,\0Ž ¨(¤·A ØüvËXpèö~Vκ°kÆŠí{c)€"®Ê°ÔùŬ ¯0ÀcUX¦ÐϾ†!Ø–]îv,VŒ•l§F,r1–È gU)Ycôƒ‡ßÔ{ ¼mÛ;;ÌËX8ï–†þÎ.zQe¬Ziûe,>›CDuÛQô²_V®Œ•z4Ћ#cðXêÐH¥è•±B㞸¹³‰de¬M—£=jÃ?ŒÏB‘Â:ÆŒ•Uºݧ†²µ¬HÒÅ8«ê[·¿¿°0çìó5|`Éêf¬òð¿˜ÍXrƒî ¬”73ËÜ@Æ>øÔ“܌žÑNÀÇ€TÆLf,Ù,U-dµŽõP·ŠoõÈX1ý4šŸ¤ˆl—äHÒ{¯p[)PÆŠú:6AÊjo€*b×(ücG}Ügb¹Pâ·fÒâXÈÌŒ“Å PÝ¢ŒEdY'9ÝânÅŽÄçLÍ›–±6šòJ)"‡p¬’¼Ô‚½D2UÇ&ÝŒeïãy‰K}5¼<°5ArƲ1½´Qñwß‹Lh1¿´$üˆfoª°%‡ 5ö“X&0¶ÿÂÈ®!Ä«`²m‰ëŒ5iD:ˆlºÖ,¯½±Í˜±po Bé6åìv3Ö¦­qUhîà2–å­à’Qõ¬«‹¸å26"'iÆkd|l]Æ¢yAv—ÀiÊù‚Ã&P:¸Œ…ì­Ãk?"nÚŒ¥]ô…O ö7c¡õ8Sý f¬À¿ÂJx:»X‹Ë9¡‹gEI3b0°]¼`Q´+3h€¾­ˆ¥Ûš±(UœcáÚîLY'ð•°Êê<¥+ÇRaÿ0j:X4ûÞæ‚`I‚’¸š±^b½+Z˜±v´ÊìK2$>̓ •ÒÃïº@4c•®´eJ÷ýjIL¿±¢‰$³³Æ÷ªîÇ|‡X]•UÛ08ÖÁ©Žg,E8½XÎ&DÞöQWÖ•Òb (0í,ŠÃqb™U¬U?Ã’¨:gJ(‚2hy(€º$ªX =ÜõH²c=¨ö¿‘S«X6¦ ¿O›Ft÷N—¯¨Xßý@.2,‚Àuý× +™‘Š¥3=ˆ ÷ý°—Sñ©ˆ]+}D,¿z߆,1miuÄ)Þìb T“E…M€ÛÏÈ€¢ž0‘5¤êäq¿•´ À¦‹¥šÐÄ!DQ+|ó½‹%<+å°”ÃY¨XYÞÅÚJí¢ô #Ÿ.Öª¢œçO½v»ÐTÔ¼‹Õ·=¨!·-ÖÅj +;T¯ê·"0t±º†štƒÈ¿¤G-ºXe÷mâRûKìbqÊjðx½E»XR>b˜‰K]¬*_Fpû×ãfþ£‹õø_›ÄS£VÁ®]¬˜„rÿÍGhÙ¿‹z þ¥´‹¥V•YÐp±¢ûž‚L ’}« 5P±ÓB¨.V:¶H(¾œ/h‹Û±Ð¦6‚ ½8û|±‹uÜ1}üºYþsSib-ÿ¸çÄo\òpEŸj×…:³›ÃÊ P ®—‚;^/½¾­ßƒu¦AiS+ù:þž¼…“e˜ž¸i¤¢s¤Eú‡wŠ›š‰í5·LÞ}OÊia95—iéat[›„a “`fæNwãïI¡Í|uÌצÿј¡±IÆJEÅ… gï#ˆNÉÒ!‘<–¦ž nJ¾&¥ðXš¾DoûP†ñ–cØn"ÊdÞ¬Y籞Ž/†‚] ]E÷ÕÁ\Ab¥oMŽYd ˆ?ŸÎ&žÏ".Hþ=‹€‚'\º?<â#¯ÒÁÍe.^©6Œöoéy´*§írØcàl‹¹ºT à 5mä!ïTßèÝå^ÉÝáSùhˆL—ÐH’”$|-чyÈÓí ptørQ•’;cñIJ3”í¶üȦhļ"‘ÿ4ë#ã®±¾³eµ˜¦i|“‚øí`J= -ý¢&Ì_꣙•mZ}° +9‘8+Q¬CWhlU!LJ欒}Ôš¶§ˆ}“óT0¤l‰öŒéQ/k“Û*|òÁ*6׿g?æž;Vu+%¿²f ?>æ-Ø;íBòÑŸøa< Ûª„\¦ à^þh[&ÀB6¸«„a/¨à‡¶Zéò‰bGVR­å…´YúÌ!À9,mð‹ã«sÈ4uÔˆñè©,¿°„ îÔõ­“¡ŽÃ#?ÑÀ\Ö/£)åÚÔÕü åG …q^Ç ø²öö54#´)6[MÄX!¯Ê-Á3˜žI}Ç.¬–† pÍ fþK>E^u€rnUH¡ÉFº>Å´Ú‰·éÊÛYšåù."Tfþh |윅3ˆ,Ø‘‡d¸ƒSÝlø#×´a¬ï$æ„\³€˜Lr\­úRök¨²‡Ës§œ¶&¨ÈiHr2?´üàxš7ìFÉ£7ãþø^Æ/FxÝaDÞ,"LóËÕ•ho}¶;$£Äø +ŠÃäK= !ÌO`E`¢œk[¼ 36¬GF4’6âã‹,‡aÝ5úÞ1йuáýZÃÍ(ÑÿƒÆRß'_ÍútÉÃZvîGq–ÒE°ûƒJ¦ÑíU +¨XfãÅòÕáÏíÚæ¹ÍwTlMš¢ä‚^ÓNéT%'¸%f ëêa«X…%#‡ &ÂPæÊ²°ÏK¦v~›%¢J1pIŸiØÈØ +äk¡#õVõeÊÖ Žë”wôñƒžPXNþ(vö•A>¨/:žÆúÎÓœ+ÍÞUÞ;±D¨¸°^1[Já©õ3]0¸âQZ”2·ü+G Ik”0,°›r|²Ñ\‹·^ÆÓ”©ûÊPªõÓL{²¦”PjŸ¤*Ï©ÀþÁ3g·ú#…‡çÕ£#G,Í¡dØKD8Ó…£¤hET:Þ-¬×‚  X©ŸÇQ»’–Á븣á™g/èd^ºl÷¤Iq¬Zž>uÈAsQñmp†µs)£ÄD#4ݨ¶ÌÊy©­b8–`I +xï_Îxøž´"£E+#GølUÕ½d°~ap3¢óÞ •o0 %aocNkKâ1©~ØÁLÃ0yñædÀâ4ã7©Ä?ßÈe"äëÛ;F8£F­±˜Æs;\0÷žFåh}I06 ”*”F`V@\ ð®±(.º¸ôe Ô$Öx 9-Ú Ä‹ÿä 4ºf9+¿÷‹<’ÀUXAy0ޘ⑛ñÍaxÜ0ogo°=X¡ÂL²Ï*ïA¥ÜíÅË+És´IŠçnû”ë/ÜŽ6”îæÍÊÃúNšñvPαÄö³15CõOA ÿöwsäEpÙî~ñúžV2–5H»ë˜ÚQ¤Bñ{>ýʰ‡BBŸ±ÝA§‘´íà.ÆjJëêÃýÁöcn´ý…Ÿå?%íÇ'ÌŽ +v–Êú´Á¼£‡í8ž¢R¾£g5µÆ*Y©ÞÓŠ +XÎFT;ÒF„éeÏ$Ü‚5,x6bÉ®Û ³ina$—6P?Å­«d¶e"mâý\ºÂt».—ÛõIÔ%‹îsXÆQB’ÚéXX$>×ÍMr!H>猌oE@ÔèÓ`ó,Z<åÙ^Âz ‡‡hkO&Šã^жخÇqÏÊ AdͱƫBoEð\ñü†ä¤tô™öcØkujÌJDúe°!µÓC›Ì1WaËRÊ©dD èërÕÉ•ÊAotª¯˜å:Ñ7ng_‡dLqtœS±€ðó(v»MvÍÌ È³ÌxHs=á#WNõa–ÂÛ†‡{ñd?OCSšÛ¾ÀÓ&ÂcÃ.Õjç£Çf…Õãîäž-"ž¿ˆv4 +ˆn~—œOåˆ05x9VU®2V±¨Á"zk4¤^ +<®é¡ÏøO”Ùì[°hߨÃ1po]†ŠL¾áâÈ õ}ÉXà†VÛ¦§ã gh- +7YùêbýW‘ ­¡~/´AÏy»øxý °NB¸û±Á`N"•Võ]i‚ÑF+³šÄã’{²‡Ëóæ2~árø./ÿ„k×‚í¥¾mƒƒáªðjöE£ß€ºNÔlKÂHJD\d×0i&¿"jFÿŒòÌ21&–0€5°{ŒñPaö{L3—‘$š8·ê@/TæžîF„i»|N‰Ôðæ ¥÷œ6Ñ[æ`J”NI!ÍiL€e",š±ã»ÎOü„òT+# ñ0ݲ6Y@¨2|ü+¬íó«SÐáîü®?˰}I»ån¾zÈuǵ-²[½yh¤¤ÿ‡®ÒÌ%{q:­çUY¡Ý›Eeu¼Í–æçÕH/ äàÊ­‚˜ýyóiÇå_ Öw$œFÒÕâ\E5¾Å¥€•šÐQ܆’­5N,T%(QÓ“JZ{iгà´xrËÕúaÚÐ6h…šB7^ûΨ´ÅµP]"Ħ»PªÖ}ò«ÙÅ^WZ;­˜Ñvä#b°1´&°=E÷.¡I ªRŒôe—Ù¦ ¬q3òrn0_¸wDÍ×A§, û;yÏÙmÍã)Ær>Ö4jó +ç<ëó®^4äÓå%CxÞ ‹ìE.ujá€E_QŸÓWT»¦æsoߺ_{'£•膰;pŠ×xZ¨¦©®GÏ +Ï€TÖ*òqÀgä¨.q°//ZiÍE"Ášr]¹§Döusöȸeëμ%œ–l)š¸<`j_ý÷C‚¾’«x°Ô.Ñu!+|y÷ýú/É++1ÖCçEPš3“­-Ž–FMÝÃvÕZ,䃸,Ù†”pE†%» X"Á=U®DŠ toÏÔÊ 6üß>_8 þ é­ð™[á\úK–ÿì4Š·àKéâq#ÒfÅs—=éøÌ—àîØ¦ ù )Ö)·„1ƒõ‰¨Ç^¨bI#[ŸU¹6¸–¢£‹¶—\³ i)ªª¬“ Òk"8xÓ©üÛ"ö¼«M 0-CdU +KˆQ«pCi$‘˜®ÏŸhÕP»ò¥yä,ûókñˆ‰z7šÐ}ûºånQÙ5•„DвnáR¨* ZUØÄ^/0h«vêªËh]Šä‹y–“hn›Ä,«¾ù©³Ì»Dñ¥rUK¸7Wñª õ«•‚äo÷¤dCAÑUcTSƒî@YBû¯Ví pYVL{°Ps÷·Ý;®¥^ L!`¬Í°ñô€»À³ò<(ø˜^JÕ6-Óf…"¼uU’P~ÊBÊ”ö,‚˜~h€‰ÊÕ5a ÁUòÑôóÓ‚VŒyJìëÿ/ñIã8‹½°(þ0º¤rž"PW–ß"pêÅPIÕß™øeùÒgè:7©ÔˆV˜%cîs +6аVC†*ûr92`ªÈJ% +0á©Ð™4ðËíÓ•‹‹{KÍ•w{(ÃVüÃͨaæè2 +Ãs«ùÃùÖbÑokï9ßÃúCs%¶~Å?´ d®É ‘5•ËÙ%ä»-Š@9‘á’ÕnþÖŽ@ñózÌr7Þ®‰0šÎt° ¢,|(ÙE/P×ÚgËYL,˜m¿(o[ È„áµBc×wbì…ÐÙÙùÔs(ŠšûEÉå8[ .½0½È–ÂZ„¬É¼í9eî§gZq–°µúÚu4h댣]p-yœÌoÂf¹Ë“D†T•‘­BÇjZS¦ƒ16Ui®-PõÜ‚®D-‹zO÷ý‘Ð!uÇ‹æëD[ŸªZ^mR:.è‚b’iÿ¹¯~õm™+E.¶÷*Ví%%©¾hO3@ì\¯C»&ÕŸòD"f”æ0÷°p–hNŠºqøUÂÒR?µr5N#——Å‘«¸Ÿ6)µz΀lâ\¹°ìruÞøë§ŠeˆW+ß‘MôŸýˆÛfºm)ˤÜQ‘ÌñçòÎÃG}ʼn{WV-41ç ƒø€£—[…ãGjе!̯)¡)d# +òY`ÛYÆ"â3c ½>Ek)¨§k)·…ä“ıºÅ/éõ”U°C 'YÁX:9œ==|–áM¥ + +‰BÈ–ï¢TÒ®JïœÖœ=eX8ÁG¡Å_ˆ%‚/HËc" ƒ“[¬ç°õi«†É±ù,^ïΠ¬5ç〃L¬jD)#:ÜJ0îy¡ìòq+F™:+òž#¢ƒÆ®ffŽ…Fô›rê?A&FŒÃ¼úŸÙäk ¨¼ +NðÿsYúÖ›‘lBKNÈnÈè §^í;cØg7©¬X/¨ÈQù¨˜§&0qÄ[~ù×§TR}+™T4Ý¿c¿#U÷††«+ÆyÛ à)Tñ6u!@Sp¬K-4:úx +Õàˆ%˜idOîßîŸCD@ltL¡z+{rìËeb»9¿\;£• µA"8±¸×…Ú‹Þ©»®{ä¬=îÍ„ÄÔ>&©ØŽÐ¤,n•ºž Ce@ù\Ç“ŒÉAZÆð ÜT&'£e›—ü0&ËÂp53‚B*Œ Ü*ÀŠÞø —M +Û‚+îQaSÊó ØžK/¤JµÉp‰L1. ‰'x|ÊP #T °î¢àLí+F'G˜îó:<ÍüËY©EõùÝš¢_†ÕPßëš„e$-˜hò‡âk¢â œ¿çÚ‰ªLTjшT´û-ÈíjùòWGv"¿ûpK²Ï O;Â²ÌØMH.k¨ÊAtÆâyçÂáÛÓEúª'ò¢Dðÿ@òøR›tÊU„Ö…f[ ü™œŒñLs‡¶Êk÷v'ÛŠ?³Å©Æ7l¯•µQàYí®´™èò$:MÃkAu¥·øÓ’£9$aÌÁ0Ì Ò^·÷d©à hµ·&ú¹0g”úLO_ £"iÔ“ºIIJœ×|z7Aì%Gá"ÌpCñ„=‡ˆÅ=ˆà¸]9u#z ¨¥ÓÀ1mz!En?Éy‹—¸cð-<ÒV-`ÚÝ%6:J* à8µïG½'† +ü„iê¿»†ÚºTêTC[¾f–=Ò|iä|¡æ!¾, þ‡ÛT*“L`<Á[ŠŸ¤4¾¼–K'\Ѫ~‘m2 ÚW>F ²èUTÞØâG¾ÃU»õñÍY Ëþ2ÓŠ 1"V6¯þr¸\…Uø&_$Ô]„å¢:*ÇpÒðö/‹áë|M šú“£(yžÌ…E2Y²®…˜VaÏ úÆ4ͤ Ôžn¹V¼Â’â-®­ÙÒ¶eÑ¢W.ÿTü|<•$ýÖ|[‹†c'×{d{‰ñ®³Oí‚m9ð¾!üÛ6›8Û#—àð'wâ^ˆó`æ)`ô„ë噜C'§Éi1Ÿê¯Ð@lMÀí[ºG·zm¹1çi(l—öɃÚ"¤@;a}¯¹íº‚ŸGûäÌÖà :*yˆ&Ø}ÈAú?‘âP`f/¼Ë‹+ñ2 +zùð,íMˆB/ЙÈÞìMÞö­ì€ÿ"bÌXëI¯ º)øÑÃß Šb.H€Ž‡Mñf^; éaaÊx¥h[úyxÊÀ’!N +¯4¯õî”PpU\c ºk©îcÄt…°ß.$ö¦ Í´Xz7£.’_T3G†õ2Ÿ_{ I –³R¶í¥ËQ)vS„3ÞaPãÕÓgïò§«¼c´‡«F/¨=êÃDè5¾úBN—òÓV_Cj,xÁ–¢U˜Mi~Ûð€>õ:Ž¢Y‡_¸”d†°ñ–ïÉ¥öë Ÿ„. 2›àé­I¥óãV¼Ib+ÍqQUçh™È æ¦å•©åw“ßý’LmØ­¹ :]qyéþ§©!3saH[Åï$¡B8ã%åÐòLçh¸ôÖ"†³Áب9f´  Þµu·‚A¯° üÌG‡:£P”Ùá¿íà÷²Ñ¤^¢GYá-U}”–Žºú÷ZÖX¡¼C6kÇ †ZÿAz'ñ»ð3ºæ¹¹« lsŠHsüŠx]`(øµÖI$´……¸¢in¶ÿÐf(a9pXæº^ÑO0äD•+Ànn3‰6˜è«¦ìP¨Wpð³6ô‰ìG@Y¾— +QÀ ZÄS5kŸFp¤!¦MS:AÊð²ÕläB+â›Z°qØMp¡÷²ï@«Éf |ހЂ“¦ù’ûðñÂÆø °àPÿy)\ŒÝK«¦ôÝQnšHV^ŒXJ8Ý£3'Ò3‚ªr³ºMeZ |K+r§Ÿ8d*n|c‚‰Œ=”ïGf(5£"ÿ2-&ŽÕÁ¤“ÔeEnðà¦ÖJ jüJ^ulº…¢­¥¨ä6®*¼•ÞIS+"O’6ü%âÌ. J |vÔ‘ø0ÉqMŸ “±~»käPkÓ²ZÖøü 4n ~³IòÔ¾3ØŸK ¼ Ñ!‘h,©RH)hÓ"OG9ˆo’¶8€ùO­1ÝLÛÒ:ùzàªOj¿_‹¨Kö?¢ØcUJ½²Ê™#ýsP 5²³7Ö zb»sbZÂ)_*r{çŸ1+éâ; + +#Hy6Q;kÜ« +)q6ŠZÓFÖS€P‚ÏÀ…,MGå†(ÛX¦ØÆì‹ÖÍ0{ ¢°aXºtÈ„ØøI|N˜€…Zé÷Ì/¯B¸>ÐQäÁj}Þ$]>”qi==o[ù¢‘Ý«š‡$õ0–@AÀvkˆX¾°EoÐC­Awæ3”KDËéñàÂø=¹bÓHÉš|Paꎘ‚åöáWBRȶªÇx!}ƒ »%§…PDzž|Šò”«ê>j,ÇÛË`>`N#t»Ösˆ>ðYH’:UÜ—9ØÞ8kȽãoÆíƒøB&0†z#-bEêIpDÀç0%IjWÜ£éKÅjØœ#>8Á¦ÿ:TL¼$Öo¦Q\4U1ôAñÁ¤Œ;Æ|d-º`'J_cëük‡RLì–l%bc·¨†JP! ¨u¡6…fQ ÈB¸0?wó¦i·  wܲÑ,?GÌN›s‰Oe.4EȶÆ$Ú<#«¢;_ø ­Û0æ¼,j)øMÆ Ãɺ¿=5v®xη§}O;ÂC.µÅ/©(œ%Cã©> ÂÍÕJ!h–uÿq¤k Ñü&%¿/akà–Äõ¬6q*@[ôqzí¨ÔþM‘zú÷õ’B?ô€Â)ËͳITø9ã|)o¦®Ç=SöÍè>È‚¥,‰ÃQ¨*dñòÁˆ®邇ڑ¢sü`q_¨„ø Nç‹Çá*WÑ ¥`á4"F„ç¹Ü0nýU Ûp j‘‡m†Œ@åy„…yô§Š³÷Ìï7ïìKO×ÄOʳø¤­‡Ï•€ˆ¸Å&°º¨<ß'ìùž fÜ ìB×¢l^ó‹’³ SlÍô%hÉÍëº6¼„”pŠ’/2‡Ç­}Z-3ã¦#%B›@©8´ôø“Š hˆ[NÜÿòÀӸǀQýŸÈ—]q·lÅ›g§sÊéŠ(Ð4 ”ËáF8tÝwC‰OójÆ}ÂkÎp}¡ôBrd·Kü‚²Ò{‹®…ã.]«Ø(°3bYXlÙý‡Ÿýàjå­Ë¦ÕR-r©¤¨¬Aâ›àb,ˆ’G.bóägaÒÃÅ9L¿’B¸¹¼ G¹b³Ê5sz gRz)°9xÆÎ3H0éUÂú«ìÏMÏØDÅŠþ,=ñí8ó2a³päÜŠ™ƒ«n PàìPÚèjèôK*Þlªƒš}¬QOëšW î“`Üvq¥HÃÁ$ÍY©Q¸B—¨hòøíl!?¢,*·"_[¿[R•O¸AÝròµÛâ ÿ +)g«É!Ý%Bx#ÑWÏ83@ S÷Gü¶É´`ämhŸ¡caÖI2øS^P¾E¹o-"ÆJ.cÐ,ßðÎ×.£wÆPù×N!…~%n~’¨72>ü«/ú‡¢{ÀQAg鳺;³€›•4¦€Ã* +åÉ®ƒu—„,63h²?…¸5H›†MŠà,èRÜ»Ðóþìhî]‹‚èdý/ƒjD+…‚pÀ¿TèÓ]YÄ*~ŸÂ ÿ¤Ó¡øt3qÜvn;/Å$‡¼à-²ÎÇ.êÈŒôÑD²'Žò™.ŠßÆÂåÑ…\LwÊon>”•_ÀžœÉÐu“GˆYýÃ’Ÿ,í(%i¸Â<‰&A“Tž9œ¹Yýs"¸®W«¡‘oêåƒÇø[¯`ꙊDÂ…i›r[Ñ?‡Æ2\E:»…r5>|ë°µëßJ²Î †bÎ÷ªÊŸa NÓ›úö•TTʲ\*ÌÁ&²Áª˜†²}0˜cÐÊE9b‹FÒ®€övV$XÅz„ž#(C9äoó4ÈE™=d®­iŠ0ôá27Ž ¾ +Ý 2X£\Â{Ïj²c\ÓŽ;u((3V«3ò«MMÆå/Ù.©Î6ý' Hßç£H +>кØöã«™´G’aºi6§ùR²`6dòh êeÜP*aðfØgs(y2-,©Ùï9Osœòxá¬É´n¤A±`a½Dò»*4Äê‡!Ťžþ·ƒB»ÍÍsœüÉüEÌpÀ«À„ˆ…9©BÅzw£. Ï2X¯®Blç,zl ‘AjXà Í‚ƒA×g#F’O2È[HÍÓH益nrÆE8•¾™úv»I‚ãDoØF‚;fÀ¬AuFm¼çögÍ¿ï·ã°qŃøªRàïMjžµä穨)¤ŽÏ)-»b³À‚ä°BP¢ð=p?ªÂÇ’GlV¨å¾÷ä›Û,=¶–غù…®nõ(ôYjªM«¬{%¨˜}î˜;ßó÷~vË|<þ£cãõÄÀ¡Ú2˜æ«J×ÕnG+Õ' E^A‹ ì"7 Á@ªî•`Hîƒñ’ÈBý((%!…öûߢŠUèa„ cÂé¤ ÆÕº‰žJ“à}¢Ž"Mür·Îù$¥ÃÑÃU &ÉH Ý/ÍO÷q[Fä!iа”ÅÛ>a$Ú¼½M—÷ø…,ãÖ‹5]ÄbÊ#ÿ‘Ì)Á¤¸2Û +®xýCé#A7È z ¾†$Ñ9‰”Ü£=žõuÂR„Rè¤{»ËoQÅÈb‹¸×º]Y¬lod¶ݹp4«[ãia"%0·¸ˆ2¯¸6èL¬ä  +¼Ú– +²˜1 ×zhH:VRý¦ñCÔÇ*<Ë}`³xÑS^q>'`é]c©’AÄâ-ŸÌ§DïGA;~ò™í2>$Ȳ˜€sW1Jyg\;˜<Ñô|âfàÿµ—÷êºÉÄFÄÁ†â<Ñ"Ò‹Òï àG±‡3˜ø¤`Tc+M'AÖæeõo\vz q’ônß]UÓ]õFNB‘&È-²!áA®Ü™U±Û™ë¦ü»õ™ÆÒŽýq†#‘CžØe¼B,p)§ÒÛ…jzÔÁŒm†¸+Z]ÿ¨oªæ å÷y×5‚2ºbYuΫ¯ž¹FÖÂåôéi‘Ž#ëêy:-ÅóQrŒ‹ÊGåoË``WÉéãË–û€%û%Gš<ƒ­P=rvXÄQ´Qø¦ 2a%-°«ÕHâåœ($ï=„²W?5v¶óÜ:ØÐJOÀão #×¾ äÆ4Wä$/ UJ–ß_¥=ºÜåDóL„ÐED‘µ!"%3¥šðL¤Dm2$„åu}U€œ(¿Â*eN9Çh¤©SÕâ‘F_WÄxWÀ ˆ$XSüsD-¤.¤q\ãaF­&ÆòÄ+¯²)BÔ†GkƒšÉ2RÍ[8I‘ÕáÒÁX™›E&‰œ«žßz4ÏCl>FHƒÉhÀ}Y#ú@pàZÇž1)ƒ +¨/òý¥!f‚&…UÕ‡¥rTÃÄÒlt9Tö·k z¬A +ûã…–@ž tMÿ?Mù Ò +Kc$c^Ë EkÎÕPœl•“¾U@/´É1íd6®ìä0u@èÕ¯ƒž~ñœ{|†_¨šÐ?36Í +ÜR"6h†js¬Ã‰)õ +ü Šc™Ç¢ ù÷¯bó*£‰ô_%ƒÞ‰ª0ÕaÐ"ÂP@–¨÷Šÿå€YCžIõ ¦§Ó SÚžOo«4¡£=Q‘Üé¼fOa^žZ'GQ·ØæXY<‚×å!ˆYóu6ÿì,7‹¥† ŸeœkSPµ=Ã!¹wK»ÌÅ™°] +liAè-$Ù&5‹>*\—‰Z®¢m¶¤†¶Q’”{Jš>ú}ŨCõ1Jj¡«\“FJýfTtq¹,kaL^)*¿u(†}5bâR­Óa³Ü:9:Ãä¿Bo£¤‘-Qƒðï”…ú7]àe†#½¥ EÂo±Yž“ö%‹]"LÍRâSyO*s€Í"¾R®5O݆¤÷Õó%’žÞxÄ]ƒ–°¾?UnkUÊ\÷Mö¼ëÇݸÿ.«‘¤``BÉË‘E©r¨þÄ †SV)6i¿@{Yæšú¢i;p~È¿çMͯT*|.ØB´(³.ˆ§x#gFC¿À‹‘L}Å>¿Ù7  +ð™ò®U®)J´3,ç¦táÏàͺ*Õi´žÒJ3r"HÊ&…L–·?(Ódê±<ÀB<øVƒøÀÏ\awyœ/†±qލöÀ?ôV©ÛÏ÷@B+Ñ9|)%3u +¢@–ah!7 b»MÎ.F +¡þDHpÂMEbòÛ^LÕï%9…:Zu]Â#ÈÐèy­‹y2ÞŽˆÂÑüï1ü? i”åËÙ³84–•"…/«áÙ-ìÈ+øÒX"IòÏÏÏœ^öŒ=ÊIç/bîHÜ$OÒ};f²Ãƒ,™ü+áO‰ÙÈ[çÿBÙĉÿ-oa'r}࢜å$q-‹øüQÒ¶mvX¼-<øO°Öú'ŒPú¶P!@ú'ªîØ€Ìуì/Ô‹Q±[cQädðý9USxF)ç“0u_4™Ñ„Ø’-)vz¼@±—?·/¨/ÀYªâÊ„š#€P8'1&ˆ?JÂaZF oâ+Œ’fAj‹TV°AȲÉÎzІ^$!±ùÚ”T« +G¶F»!-2¥Þ6,uË|vfÍ úÅHÖ-Uu9“™ÅWϵe‚¾K ÒfA^ÐÀÓ¦N0Êq‘&­ÀmÅϸ ʦ¾yv˜Ã&¼ŽM!òŽ)$û/Å´ F¯#*îlûAkrxÂÏCr)fù»†²›Ì<:örñ#?8ß?²náUÃNëÞ(‘L¢en0R}5B2ŠB\Æ%ô:®–Ù¦Ä#¢¢pÊÁûTìZwÇ/¾ÅLÁø`ÿ;!T‡^8}¢h¬^¿´eèù0ç"fÙ¹À˜ºÕêÚ8 {}ûX˜["ö¬j|þ’«à´ ãÕüS¹5“Dƒ¤P9¤Eüó×ÝóYöòá§òã Ìó7«8dbmíµ”xV§í¤5¨hëXvxމÃb6EÑí¤¡#؄ˌ€\^QÂÅ +ò AW‘q¡a²%ªWTÛíËþ¡ŠˆÕöS@ + žññ<¤âƒ”ê• áPW(è.­ü(æ¯DI¶›@äLß#˜›å7çlóo¸!QåY»‹øS€,û ˜!ÅÑ×µ¡–GØó¢ûr2`;9…}B1jòõŽžñµ;å½±æîÞ.Ðû(A¼F¹èXANÒTu}ï> Ü„õ| ¥ËïBel"krB(U²è0°Ö§%N þþïÂ_ËDk„Vœ&»/,€ÔI€F[‘óÿaïmSªiÖÁÂu±ÈJÖì†çB‰‹&T͸Hü! e×Åxå·š¥é5µæ[Ü¹Þ “Ø‘Lëçm=XkJâÉ>)4ÁÖb bXaCZ ^bVBÒš3ÀÀóö¨NO¿†`yWX +oÙã¹G«ùicÊàÀBªFŽ̓.“ur\AÂ)SØo…Yá¯G_|îÉ|‡•Õä—S²*â|zÃ-Ÿ‹#r@„··iWÇ §¾¥âÚZ?´¸·Äc‘ƒ[ʳÙ*ñä©ÄñSîûÑŠ¥Ò’nàTØ`·’NGŽÎµYh§5Ü›Yµ=×rß.Á—çšé…ã;>ËW®2V2ó7ƒa§‚˜™ß˜ücsŒùÓ"-©¥ÙtÔAÕ` +Ç)HËrEIƒÇ:æËs–í-î8èUû‹h½x@}¯ÚA÷5ðön †Àªú÷:¹–ÓÑ¥øàȳ™c‹+Ôÿ•uÑŒ×c”¯1›ý§\[ããÐ-*ÖQš®Îs‡mJ'`f6gE°ŒÆý6:ôãŽ6Ä}—3*Ó÷!ظÁ˜ } +‘Ãq¸Yp_0/¾œ„¯©á5p{tY‹íþAàVF˜ô{œ¡#ÛR[­Û£|sbÑ£Mlä—IB%Ÿú^ñç^Agþt0ðœC(5UÇ0Ó„õ¾óû’-ÎKËj¼ý3ı{¢MÉÄ ÂRó¶ø5Îä" D›ØL\bvîÞõ"¯$ÎLª¸³—[êàÉÏݨ]þ6=áOëèÄ8¡Í³™‰»)ÔP¬¿&²9ÀÐã¨ãòiX…»z›wÞP]‡"ÖNbצÕjšÏaÌE¤\:f ó‘¥4DŠNÄ¡(_?ïŠjv-t¢`¼À¨?!èò÷ +hfÉöŒHœ‡€·^€Í{7‡ì`Ü×Ì ꮢKO3»Â£ÕÂÏ0IÈ@W¯–e¹XHÍe.£{DfK§†óåqSÅð%¶b±‚Údä`u³_DUO˜i+LËf2' ·ˆW˾^d'ʃhRODT¯È -Ä”žÙﳬ¥†‡ðÞ \ÞkËy—¸FòhÈuR0`önŒ®æ‡Áßæ0@»2e.;Q$ß«MRRn®í8\¦! ë]6Ç]ÂX78•E\Þ„¹o¶TGò‚°€‚D)姪@B„ ÇPÞp_@®òËiBÅGa_õ|å‡hÉvPˆø|¢VS´2¯õ6e’ ¼²ꥀPˆ¯¹¿¯/•¥‚¡ý4¸Bè2`ô¡ÝÍÕÇ&0éá€æIÌF:¢ÎƒÑñ±ïq¿ÿœPØ÷ŒWLFØ^Ì× ¢Sm>à*VIø õmßô—!e÷z¼†¶Ø…\i«°O5åôâ0AŒžvlèaªv|—`1‚KÉWuy1 T”U*`øðTw˜ì¾‹ÎnÎ×ÙYˆÜ–¡¥ ãMÎ3Ô¼²YeåÏÝüGß=v˜#9$^Ãá%?Á¦yÞ䓬6åGr‚² ]}°0ÿ«   Á·LÖáV+°è5Ñ>mcÐp6ög°¯qzË=ÁH µ„ÿÐtÄÙÛl°ÍŠ5—€ÉM¢ÇEÇûºÀ±`âkA>Xðc”ßGŠ)@‚óožŽZ|²ære>nk£î”üo^pq¢ ™‹ÇQÉÃ’Ãä¸X ?‚¬†Ìé)0U¡åNwÝl¸¯äd/?¸ab$;ÛáÃÆÁE«xÖ}>,Jâܧ»޲?Y™ 8ÙóÝã ̰ÐYà ƒî‡À]nÂ|Õ1m0tûç;ÂïP+²BúÄÿÂìó¤|Ýw™ú{„+¦Zû]µ¯žQªÂqñ¡‚öö^Å­£Ç 8ø ñPÒJ’Å!Y³oÑ'w 6e¶e„JÔâ¯Ï¤øOEð7Á·u—L }k(·ô<¹ÃßB”ÆmmÀHñOõ?ýûζ§^Ò¡a…Ê»œ{‚X| é L΃+"¶êÑŸØ>é ¥7ûæ5‰–È,„$ µ/simÒ(¯É\Ùù¤*$rV ä}¯H¥Fþçì§e²­äíEWäòî"HHÔD‘'~Ü= ÛGì²ÕÕrSÈ:¤"æ ™Þ©»“Å^˜ÒSÀÄàAfä õÅÉ \¹"ŽÙLÒÏ;õGP¾>V’ÀŒG}t^Ðú#j«PÐ +b±Tˆ¥é…wÆøA¢ºïê Äç<4í KÞwH%0~Ǩé'û¾¨”=ÆH ¬.¾s­}+-ô¸@‚NH®ÈÍï&J@Ú·^Ù<µ÷ßÜ_•hÖIɰøýФY7-V“kß•ëQ* {T³†žÅ@'bÅQH‰mwØ×’º}ãŠ)#Ûw‹áßQDgÏUÈf}¢^g Çý¦™-­³œ?‚±3±âg EÁ·R <ýYÇ0jgãÝ‘´F?9Ñš‚>¬hÝÚ!I´—šBVªï!‰ö¤5pr0…¡*­CÄ-­73óTZ»"E`im¼A¢ˆ5à®!{i-­uÕ!ÌÄ4‹~˜ÊÁÿba.{æ‘>`=ù3àR—Ý3¬àîYÓª2œ¼gϪ\9÷kŸA8ÇõJ[«Üï|ÆbUîß!<;…j•9˜qø*WÃÆcåMžÖœ +/ ´ù ˆ¯±²…<1«¯C‡q æ³d¯rq’ÈËg1Õ*—_eC…ϸ=¬¤å3»ZeËà™5Ó’YÊàY„š”›§ÓÕ}=ðÈàaK‹ýâð‚Â…Ï);"PØÑÙšXÝHbo“€åˆŒßöÌ7j¤#áÅ/[Ýi6,…lG²Ë +èD^#«SRÏ^V]ø‘Õ9ËkþÅ*zXq(i2jÔèõ%©,\šÿ ’ßáeèÁªt v^bÓÐ"¨n²Å©K¶ì¥~Ó@ SWfAÐ4–è +rªâª0è h +p½‚­1uqœß4ÁR§nFW­§ J<¦(B ÕíI5µJâÖ€E§³ã„5]éÕ÷剹ŬBw.^ò¹¢OžVs¡GF5×N€Æ\w÷ÂJo¹aS®‹ÕH³’«T£ä2Õdìçä‰wRRÕî5uç9#kˆ»‡‚£GƒûqÍP½‚ëz28àº÷bø¹ß€}0ȵå Iâ-]“¹z‡êPB½>:[A­©&ªc8)”¤ÛåîiEu»èˆS]ÇeÂ{“ãÑC穎iÅÕC„4zê¶4‹Q+Û15Ò(”¨~÷Ò0´è 2‚ÉÈ”¡ Ãc¼1˜æ”5¨…„e1Œ+õ–wqHœ*5¸08ú¼@³ŠW—“3Sÿø!úkÖ6´å°ÇüˆÕ ˜‘IºsÓÕe¥­ƒ´ÝS2Êþ§öÁ&Š:…•ÄÍŒ¬’Ñ5Å&Ñ¢ ë+7 LºçO‚-êŽÜÝ*øIB`“_pàzYŠ„ú~ÓY²Ê¯ïȈ¤¥7 ið>Û,öv 2„Jt§ð„Åx‚†š·B Š„ÓÕY"@V‚¤xU2¡®.%‰<ÀAà±î9.ÖH8Ì€¨“Ì=ê´ él@Ñù€:Iê¼ Ø˜ç°Î¥¤ Î(ÿg#tÃµíª»=š:kwùëRVﯗxÈÀÞcšßD§ô"OŽZ$šá׈ºŸ„ëïÚà€t7ÈoÕT¹‚”E— ›€¿Ù5àPùI>¿6fÁAå—=]rä—.ˆnè#¤»TñÉ}6ÑUg7¬-è&o ]ω‹×´ãœŽ­î«æDíN·†¹ö9ºR,gòŸA¹NlHN`N!« åŠrÜâþQ¬7Íh`„²¤  ñ*EÏc„À +¡B(OºzØ2A9=”¬‰|vÀËœ%bØ ÒQ¢¶5'‰KhðUE¾‘ ÇbDœ.@¨ˆ›ÉB‰‘Ql2DMRÈ !¦Â¬Dk\€1ÐO  Ãghãç­ oU?šb,ãú1g™ÁÓ p)°í •lÄÓµW…œöDsÌ ÓÉTŒë¬ìó‚âô{4ØgZøo½TçO¶@R*ebúr¬¤«ûN'IqØ2[væVÍ™öud÷¬ôNý '"¥Y[åÉHI\IvFLwsо¼! ª˜¯h_pºc¾°äulY߯QëÔ¢6u#˜4ΚۓyaÁ¯¿FÑY©ë-úÌjZ¦+{Bä¶RŽ†Î‰F¤´X¯Èy—dš ²³ÔcŽ0Ú‡E‡8 5 A‘¿PHL[á +ôƒ{Â-2ŸØNk=šÎ¼ðÜîÛ½YpøÓ/K˽悉)jþüàü@hÇM:̦ÿl.o(óûs(•Û—î1{òÔ·sPD]q: +ﯕ_Õ;â)ï}ÉÝÁbºØ@G×M£”šæùç@f¦ª¬åö°ÆI¯–aÒ;¿Ýiª[Œ)¥¨Óʵ*ã@*ÕÀ eG:ºkØ5›‹KA¡1”¼éb/Ó•¬æšK}A¼ `Èæ-´°¦cvúÕt 350¸ + +Ót@8…f‹"kì fÒt2i`2+ºÕ@™nLSÕi7\´b[CHWNšöã®äÏ?øã#šè4¢!ƒ(7<è B¬€,G°©ChšŽâG$ï¢ÿÀ€F®D4¨Ëtìx, ¥=¨ + ×£@={<€Nàg¦+*K „‰î·Š7&ëÁÆø>ÕA°ã/~q.]QÍÀEUvsaé<¥`Ò¼ŽO@\ÜA. „fÄå”áÒÁb*¹tÍî. 6¹à¬LËÐÛUÅÿøÎYöGê&ºtÀñJmŠVÜqé„öûG›½íô«Éoý@¹t‡>å=¿T¬+Ÿ’ªŒ?B+Ÿ‚¥ M|ÿŸÒÓÜŸPé–uyép©ÅMÐy­ÿ +~S§>‹ßÓÝ¥çöo +ý—?Ûk糸8¾ëP»ü«»•Ï$Õà”<ÿ€Ò„ÿí”Ên‡éî‚íT¡ÑÅÐ ´ÅÈ>YI;ïz¸õ{Ö‘ø{Õ1?éHêÔ¥–Ó»:9éPP:Bý~άå=ï†ÅÉ1ëu eAöÑqë’y9NLŒ;ã†)¢^–0ÉF§Š1:÷nJñî[½žfŸ‰Û"¬‡èT:pI8‘%º?ÓÆº~S4jK¦oÁ˜ý—ÚbÓ:ûó%‡BwÎlFÉiX\7cL%1t3SCYžÜ¾Y<ÄM9)m¼·ÕOF«Ámk$$¾ØFV~jkmÚÝ9K›ÐÜ|°³5âÌà.›FWÈöFXàNlú²g‚­ÈH2]ym@D×ÈìxHkê±.¾kb°Äì­ZSèð<§f£Ÿ éÈúÿ ˜üišÔ>nš£Pqó–FŸâ7&iǽY +Uø›‹lI¡Å­3[ô쳺)ȳ ß©Q(ÝfQID±]3IùLó7CÃU2“{èfäÜ0Õ[vEܬ£tÎNc©¬Þ¦e÷gn“½*^6J²Fž¨ò¥"ôKð2ŠÕèoJwð¥cO{Fõ6ÖÝX&Gcù \§\Øq„QÊí¡bVLrh8Ö;½4*1þ()Ä–RîÎ3¹¼ê]ê’“ЉTr0¤0“ý‘sœ£JÃÁdäÉSM°ALÓ“M]ö¬GQÆ ý˪^³_.j¤ ø%µmÎ } !IY¾— O¨Xý¦ø½ì 9)É«“Ó¼ºÎF¹wuÇ ØÕy](=]Õ¼?²çRÖ à–«{ðA™ãªÚzí›áÊn3›ú–ãEþRI%Ë_|YRl)ĈAkµ[ ‘û¨=ϱÿhÙº}’"LÄèeäD-‹> +0Éj£ÑÚ5E@GX?ÜuÄAˆù€KÄÑ<=ô'}¥1<àýÃ!v ØÃ•ôÄípá8Ð|­ÐÅ7´tÃI¨ À¨áHe 2\1 +Áp€Ô 0.’¡ñ£Êý2k*èÿíHÕƒxA3E…ák‚ŠA´Pµ'X€)Ç +°³ØT ‚NÆ:]µ”ô U¥l¬ è­¤¨þmHeã#ZwHG±¾؉QœM„VQT«R8C¢Âœ€pÅ Åäð ªâ;˜×‚ÒhäŸÈà J®O?O ÜžT/8ó7¦<+ ÚÝo-æ‚/õb½üÆ‘ ‚~„ÓHŸ#¹I¶%6uÀà.ç…Àú&H?’í@mó@7àFŽIÈÀ+|C$^#½T9).9“T%×—GYlô‘7´“•¨7•‹éMúèùy[m`â’8ؼ!$À-o˜€b’7‘xÿÚÆÛûÜ_èiæöº^áíêß¼-¾ùŸ‡Ž¸2ñëÞÝnÍû¢a£!Ñ>" ÑG[}Lj˜¤_$™Î—j‹~å+Ö-fñ¡–¢›<øÀ>?Þ{ˆ³D–{ ÑíÔ^*…h4{$}èGµž$:D’ÔÁ I ¥7À =$èÅÇ ÍGy+t·d^ÁMhQ*wúp‘g7À84> +kÐûæE· eá2AïŠàáò@dãwU лlô3†«û€)OäŒÕ§~Œç‰×®fí™xÿz¶¨ÛCñts™q´pƒf€´E!{‰7îƒÌ a¢Õ–·ÎåÙLEÌVÔö¿µni1ˆÀ¿P,È%nÑD↮»áÖ¶^Âm”6ŽÍnþ € Ù)/Ö’‚mäζ°yp“®#³›ÿj€GѶzpãñc8¸W¸“ ti ²7žÍ»fxÄÕÕ^ðyø“>™©ÞdÏÃé«ÀÚâUŽÉ:s‡É¤y‚²R†¯h°×ü×ˈ¢„¤£¦†B9bb.ñ]"dŒÚC`²Ž¥ÁѰ $# B¸Çç¹ KÄ!*»çW»tÌÌf'îq…ßèRÚa(6qÒ°@õÀúã¹à}9-ÏT6sT[™ÝRÑÒ¥)r~ìÁ5 ˆÌ¨.^tm4ðàh:°l´°îs:¹ÝÐo)éAw¸^%åTŒÊÙukС[øæÑÔDNÀ¬*4p{ÆÆân†ÿ(TcTãA9Lz‚™0ü¢ß6HX 2‘îÁ<Õ¹Ó4½Y€¯Z\y~d‚Ô赋  ÝÇC”íKÒZ&Öø,éìb{-cuG¼ñœcE«´X¢9’Âc¶òÙ)'ÛkQ¶Œ\B’f)û°lº&šy{çòª·*dÓ.«¨(\ …çûJØ +F*DÇOìÎÌ£p³í*³d!Ít/ó —õ˜)ŸômÇÚGÕiÞ!EfmP‚€šzvóñ×'õcú¿È­×t ¿*¦Óö²ÌÝÓǦk+I/mºc°õL·m¸>š¶æœM.ýpä?o—P‡H“¯N`‘ÐÉ1léY‰4´$ XJ–eYºnlxÛóH.ÕEözñ` +ÚÔÒ¨ödƒꥅ*hi°µeEpÐÖN|u44Ʉ„PWµt¢¨méÒê-]*걓ÿMÁºõ·¥k…4²¤Dä/-­Àw?_º¶¤‘ßH´K—é[8A!ªf—2Î¥ÕÝ% çrÿcÜ[x·ÉùòWÎç`qh[;zçX)9O{`–ØÊ‹˜/s½»ãMòŒÇ7Áp»àÕì‘`²œ—jìÀœDYù¸§Ãí3לÏU°²»3ÎÍœ[—ƒ á\sGuI¹¹áÒas!EìúHÐiÞYš3Svöâ:j.§=6Gc…íó= QgœÓ¼™=sõ^¨ÓܧÃ+¥qôxü×<­>r“i.¨FAL`Ç–©ë@ged݈›¦[Õè:äðö¨ßDÎ2{`Ô—¬É—K}Ù_„“6õ1q²®£pêçQýÇI¯8³dxƒRtê{ÊâDõ¿dì1!Õ樓¼€PÀ³ú¥„5kR}ôôš¼…¸úHÕÏÆ¢!ÀU-ñä)Agdz.ŸÕ÷Ûn[ËU? ™H¨O,}‘?’h õcÀ¬€˜þSsGÀé§[f<ú:EHï ÇvCî†÷©m; }@³Í,$І>O‡±ˆC?"òmLú·—èVøˆpè7 +C>Ä?UîîCßH_¢áèÁ cèÃв|m¡Ÿ¢fÐ. ú³<ìó¡åôùxœM ýé[+ }X_¬†?xÁB”2w¸Ð§ øÌ?Rè{<ÑúÌ%›ýµÐßø~òb6 ý ð mœmK¡?Ô2oá%Ù)ôÑCÝŠrwæÃøwÔŒBMjVga­f7à“©™8YR.4æ.G‹-äT“¦×aZè¬Mã +6%§ <•MÓb‚¼4#c‹SgØŒEQ%MÅÊêF°5'ª_yšæ¾òGM­ZRu¶*É SSÈaƒ@#d ¨¯R3•‡í¨4>)¯‰Èn g¥¾³äú¦û÷üx Ô Ñ­”Lü&ËÚ„ØNQ¿ì€‡9ý…Bp'êþCÉ +Ý›³ÞàSÞ55ð0g¿3tº’^e©H`³3—c,”ZÞˆñ*0.›A9)ÁÖÈ¡fu€Ï™Ke•¬iJÒƒ"…ŠÔôùpQÞ4ãqíëh½¨ý/“€Š±\«1‹ŽdÊì:)­BF0Kº3àeÎv® ì´S+;ª™©²ž¨$kSûvèÅý¯ÈSÄ’#—аw’¨¨ßoeÃÚE 3| ͳ.³d4¢¥¸ Ò(“Õ=oM¾ˆÛ^’­mª†þº¨âknÝ•xðÆôKé}ÂH¸œ3˯í¨bÚ¨ÏýÁV¡¯-¯úÆ».Ï.IÚ„Q˜¡ö¦½´m/´¿@Þ]œk2Þ@í>JȤlñ5%« +ïpIYÒˆ¼â‘Ñ= Ø9†ñ’(9$ÑÄ;üÀ3g35|#A¦,è”.uÃÄÁã“SÐZZU0h¨;!Uí¯d!³4P¬|ÊaÅ/.ÿd‘lÖ6<0QÚUST·ñm +ÒiCº>¡$ì˜ïíîÿk|w٠뢈3ð¦m‡µx7B¨A"öÂÑz\‹¿ÆFApdÚ“¦aˆ[zzwÿÌÙ!‡Qm®ŸÙ¢¬Ï¯†¥¿ ¨Ú>÷ÏÓÔµªV•YdD÷(ŽÞþ«{GÂÞûÑW«8^Ò³)¶ààfÉz ++²_å´GÃPX¶Nt/’õØuw×ýn°§›„Í™j +üƒ›®ʧøã0Pq†Ã×ÖÙ 5}纇 Õ2– Íz4C)‰÷Ï7¢°…uØS¤f,¼ ÜÒju:—EO˜Ùަ™ïêÀ¢bLE•Ñ·]ÎN_åžÔŒž"|‹ÇЗÀÑî(áUüh “h@s‚ÌU˜øZæNJ3¸LöúSÙЪð  +"=£øÐêUf=0Ý‹ÑàR×òlpÃy töˆ< ÷*kTÍií`¿æÏ§¤D8»‡íIێ΀‰@ ]Ä{¾))®§±ð[+ÓGî½iï`MdŸî.¯®¼„^§¨ÀÔÔ¾žc•Š£vV-VIš|@î´¸ü¢"€)ðDÄTt І]޼þTa0jSY×Ìb#à&eÌÖªž•›Íì@׋ú#}tB³¹ORƒ€à…0¯L&ÍÇ8•JÍ…°TCí³WxlO2´„.Du.uÓˆ†R¢êú˜‹³Å†ïòõîp‡3KÂlÞ-æV>Å/|pŒ›¡ÎFD…ó?þ¦ùMçS| ßá¿D,zði>¿kå5éY¿ÛaÛ÷Ja¤Nœ©¯Û·àÝð8ûü« BfØ2ÕñZ¶^à%%Ñ]³‹dL!‹Ù`D&G‚A<}¶©ÂßÕËÝŠí¯¥™p$Dë6 ß Ï¸"[ö +þ›k‘3ÝUÊY¢Ê¾9˜¥ïÎØ=ZˆÍ1çŸ l…Á<„mÒÉ×kš=>=\+¾ÜCɈ¶EAÀK‹ðCu²È—T`Qà: ኇ6XQ6 :½¡á±§Xô1@·‚á):ë‚æ¡8eYþ‰×ª°g'–Dá8n¢z™p*1ABV—øùS‰&ý†™Äö;p;$¶½AŸ‘"3(¹¼€9*b€kÄE%Šôhš$‘0Ÿƒ@:A`ÇáxÃ0>stream +#¡“-ÃÖy5Ðkx?ÓtÇ(ü´SÌDíO¹—9·©’rÎtVQñ¹ÎÃB +xúÁ?¶ÅéÖ*gjb(x7à6ÿéÐ(¬éãöÝäGT·œk Å÷p.ÀE‘8#¿'¥Ù?·šòü Çö “L!Ý‚ƒ•5n;^ýdF@ÓìzÂ"~‰mJѦ#”×§qÙ˜ÙÊØY¾)Ê ½œdU¸%êðÜVåA”hånü1ôjlI‡5 +ÛJ²ñÄÑq\¨Å7÷Om°tH!Õè½yñÒü ™"ÞÌ N+| “ðº®R6?t6ž´TE˜(hN”/z_8]b3Š`­ïÈËw€žQØ›ñ2¯=æKÁ“•ŠÇÑsiÅÓeID`iÌ“0SíŒE¬zVqÅØgð1W5#˜1J +7Ì ¦†Ëe´´ðO“Sï¦d ôIQ®ôŽý‡—3 âšvö’º]5˜9vŠdwaUn»Öâ\’tØÁŠ•¾ Dµi×®Ô´štõÔ?’ª´0&NI®dî%ùEþÈÿ&­ŸamC†@¸›Úã3yxzàœÿJ*Œ–„,˜.=3Ó¯´_K¨•ÿÁZ÷ +¦•œŽhI´̈8‘¬A=Úq†Mã¶‹¨Gm»r”'Ô4¬jG;ÉȆÍ".KœwÙdeÁp 5.O°ãb×õ‰u•*î{¦»å=×ÀøîR;-C¸¨p'Ü$.¨%«·‰Ñ¢£ÝÆ®¦L’+)†p²¬Xg5VSû‹ £M1¸ÂÈž [.D‰9êÒXg¬ÿ+h¨ݲÆÊfk€ î_kŸXÆÅPÀä7ZD£û ++LÑ„\”“-ÄSØMç¢Æ›™ Ü<£™Pt¶JÒF×J¡?¼:ö‚1—Çò·Š7ƒ"µãÂ6msÇ ÿ¿ _sË¥Ïö_ñæ@BÚP÷YëGCmØä7é‘iš:!` ¬Bp²Ëâᤆ ™Q›¥;6 ‘ÿZ¢7¥Í…%(É#¼n1$V‹þ‰)Åe‹¸ÐÆ}¼³ê $(àÌ` !- _ +6˜`ôvþüYÔöø€vØW“²UT*²ÍÅÞrò¹gö:§§ò +(×Þ"¤Õàrl0Ó2Ô»YTë•NÇ2H¢lò›íx•xÞÍŸÊp—*ë-9)oÛãÔ¡N %@±~ß7d9þ|ór­¼Ô %j”LîÕHª*;¢ïìŽÅ5ëZ8¸ÝéD à~ÚÃF‰ÓÚ(?СUj-CeÅ(ƒC㲕î»Om¥pÄQÆÜ†Ž;P@Žz;15l¹ÏéèB…š¨¹¨8¢Ê6Öç9÷éÖÉB1Ì÷K:@Ä…kåBFÂ÷™KJS6¡yÑÈÊ㓲¥è[AŠ—®s^M$±$5/VÄM è1×vžƒ9x¥Qùâl¥ŒçM_o·,M·hOþÒµ0eóe…0Eoó‰Ò­Ö€—Ø +Ú¤š˜©€¨e‹—ÖQ5ÙŸé £B]FAøWKIe såq\ÛÈx¯:Á7Ù(‘D™VþèÇZáî=EVˆcÛ¾±È¦dw>žã8¸ò ›²LI“ï~ˆs\. +•° +tÔ?Æil‚m=ZãT¸©X¶õ’p²9F5Qî8#S÷|Zö/@wp³9¼v°N ÿêeF‡F]«®6b‚àft"²òìŒnØm DÄ?ž˜$XyNsœ«‘=*'k³CBj‘ɘF©xÎõøwAx3Ó‚’î•ÌK¶“ñs°‡‰ò-ZʺÓ0¬ K»r&Ä@ &1SÎ#·*\ªL­;òÜR‰ô£QìÈà¡Àª®‰õéu#m×+c’p¿8¹)㪟R«§—›Y:Ãýµ¥H™ÖeãÖ÷ÒÈ-ºüofŸ¸’QÊ"Š1˜«ðeU,Fœxkî\#Ta-ˤ'd‰Hжè”)4ëï °]i¹úAϵÉ%_›âÈV'”‚þwÛrXªÉ9a.m5¾(·I!†^*JÅå%/Ré¬_l°¶]ñ®¢à<Ù¬‘+J°ùÅÔ‘êuú×ZÓápì³ cÛ=ààïéE!…ÅV`ÈÓ3) +4Û·@Œ®3fù;`%‘µ—ª{(Ü+Ñê‡$ +Ü­c±hÁ¨XäÈMQc½È¤ÈÍCNÛÙaNeÂäö4Sþ¹ÜòZ‰éQY·åL6'~I U.•øÀgb# +è=Á[ŒãŽE9iA^ˆšÊ=<^A]Þp2ª:ÒF¦å¹ä&XíE•¥^‰J76qÎÙ›ùÆp?Y€M{zL©”ÙÔ÷ñé oõ {[Ë¢OèóíVÂÃBdþÂ^G`Ù‘Ôðľ9&ß糕eÖ‚cO!Íô&nâ€Ç[ª£É+;h‹ûð×G‚2Bß=c€%©á½LËÎð )õ~ê /ÄÂxpª\Çð8É‹F[²ÅÕ!óF´!…N9û øÝŸƒxÞ”¿»@p5,èF‰ù;é°«ÄÁÞ}¨†÷¡ÍETÄoož ¢ÿŽYU³—dÈß™Ûböô •›röïL¨²“N‰ì¿£vàÉ- uÀ¥ß=¨Xƒu'Ì_w¹åÆ®zäèÕ˜½~™BÝJSkoÞº ýËîñµ´çZwØ“`Õ­-Íß-}N4Ä“mg%"9sÓÒòžüB 4Zî~îåT 1‹ÛtÛMHÞßö(õHåºwÃH^`uµ޼l’”|‡P/T­KVÖ$ä{†Çn/=lK +ªu…æ +ãÚþJ]R°i®gìvAøÛù> Âi•k‰Ö®«£»êM¨ã3®ñª«sk œ«¾&Éê¯Q&lÕçG Ûq;¡Uæt? œ´1ûª£Ì,¡5Î Òª±íg[Y‹ˆ¢ê8óœÎîš´ªã‚Ý@USŸŽTu€F#ƒmÉTæràAÕÒz#‡XÕOM¾RÕÁÊu2asÖí×Y—·=ðº\h¢áJÀ›#¯ƒÌíà›×_–[ÒxÝô dy I¤» ïŸトó·ÛdüçùÇ ðÀÝl˜?Z£äï˜+ºMµò§8]ãzþÀÞÀógÌÇÉ à4—Î ùëËQ_œ‡ógJè‚»ØVrþPL/žoàò7n\ÿ¨úË«ëµ6¿^žv»ýÖáÆÑGÎ9¿ìnün~æÁ²ðñoþTç²ð-ùGĺ=…@‰ú þ>)Mÿ~›¼$üŠ4,{x‘IÖÅY±1¸døMìÊ«‚𫃄ì€i¿yÒëîC¿í‘¤Ÿ…ÄòÅÏr²3L±üø«È/ºÞ«wámùiߨºgå÷r +ÕYcÔòk뙸þy¾yE¨ÿî å°Ã->àùÃ>”~¾¢æÆuêR¦†_¥@„˜;¡›ïôªGÙªy™”º†‰'œ ²k¬s'›JUE4Ê~?FêM{h*ºw`/:ܨ¡UÏ_«ÞñØÖá* â>ü¥k€[½?ˆ;°.Bó¢“ ‘åíç§C5éìݬ‹†ìgÖ´#„ý–ÎAÕ˜u¯.xüSá‚òØ&öóá ªÇÚöÃlfm7íÒÛEÁÃ~±T”6ø~|ŽŒ˜ûá|;È}óm>ê¿PÕ'Ø}S„ê;‘vNÑ0û}ûybxƒ2‡kÿ}N9y=ó¾,–?óç°R`È9'ÃÊì:zUиuƒ ¿jºØ(À¡H…>ĸÿ>7kx›Oä­ ÝäÁR=LöŸt3­oФÙˆÓs¸0hñElX2ƒ\õŒÊ]Î'¬O¸~ì`/f‡äÛHÃÆ€ÄDãË-S—aв$†Lý8ŠÀ.6¿úÙÓ +æMb\ܱð°¦uIÆqaÜr£­Áô+QPäV´JéÑ'1£æjP&uw|PLg»üK羸°ƒoü¹…›±±h«vŒ¿< +ûoq~ôLX@‰æ³ïÝF¨¢;ïŽ 7Æ,õiÿ öëlƒsмZÿäÀ?~‰tïvwæ"áäeó75DPPÕÜ/èÆJ³Û. "'Šë¯ýë3¨ÓÄ(åÁGï©,ì=µÛ†¿ú³žKZNGæ¦`æ¡°e£æ[<15ûÝÉÿóÚb<’UC¨¨|YŒ¹ê7Iÿi’ý̸áiÉ_ø›”ð(Æg>š4¾9,—ßhGû®·aíWÒöö„ Û]ËÜ0La[„„Ó«I÷⯂ˇñߢ¦Š¤s„»ÿ£õÃw8kv£&üvúkT$I—Í}Bõ$¥”)%¹Q¯» #dCÓÅýRLM׉ƒ6ñQé23ÒŠ™ø§#Câ’b’8ç$#޶Fˆ_:Q“´È³‘nÎté…Ff­ÝlI/9áÔì¼–o[ ñÌ{ĈÈL+MßN ZK¢u§õëæŒÍJïnÌ[,®ôUF¥hý2>Ö•{ÌÂ23¾¦›ñ±v ~Ö¿{k±@úY¯ y§¶έH¬#²KÑø,çíÁ’ö© +£èY´¦n´'WqÔξ–VoÅÎU2ÉTö¹µUHWÛï[J)§2Ó™R|¦/Åg:MC×ÚîÐtŸKíD$O5\¿ªgQ·æ)¦‘ÃqФ= G‹š›°;ñËdd×(E÷§…ªIÎW5I±æLÄšQÍRÞÕ%"3?Fº0Ç«šÅZOÂ(.N£õ19=….šúpÐfâ GåVe^¡Ìô’H2㙇§ÂþÂòíMÒú ND¤r%ò=BÏI}™ä-®˜¡ÏéWsêÅ,ò‚þLUˆi¤iª¡‰î9æ<#Ù5RèKR›#uIOLc½qü [¾Q‰ÆF*•òŒÏè>©ñÖJT«ÙÏÎ{±’Ù%ú!’êQœ¦#ñR'Þé• gLŽh:Óš—B„ÕÏã$ý¤¯i‡Ûeô¡Gê¥Î¡òu™‰#š®^yG9ežNúdúœrW0ú!®_͵%kD<%Ùê’Éæ×W5zÏ‘Þí¯e†ŠÒ REÝ]ÅV¼Ó`9¬é‰%1÷âWUDq¼U‰æŒÆ¤–™H¯šÚ~}î6Ó'<¯ŽÛsÏcæ°:y:·tþšW˜ó˜å!2Û5Ïãÿ¼Œ¸ß»Ê_øWtø¿Þ"¿Å÷kñªF¼o<ªA6‡(.ÓG¶[¶í™ìUÉ!Ž™¸'RØ{µó«%“¸5¦E-òRúEš^_,OQÇtã…ç*áø­›àNlC¯EÓQ[Ù¶OÚ‘8l‰ªñ¨V<™xPiê~‚âšJ¼ê·…õ¡–©fñ¢ŽÐÉÕÎP\¦qF½i™â•’ QœÑ‰ U|ÓI+¦Ÿë•’O)ŽêxQ…jjg!ÔU-3%æs[FâB]TeU-3MžV®ŽléÜî´sË5ÊílèR¾rj6tY”ÓÉÚËÖìgGJ¦.K­C^Ä×H6î+ÊWT¢®ôã­UØ×N)ý«4g'ÊÓzß'bò"nMû°²·Å+ik±£e/-•Ý®TѸ“+ãNî^î$ȵÄöè¸ÙÙOÑ€PyBÄ<ä¢â9Ɔ<É mfÃó”(ÚQäHIé}Á:ª“û$Íß"éÄÓðm„I’;‰Š_‘ćô#,oBÒ ~fòÇÁi•R5oŠÔ.ÒÖ*ŽªQež¢,ÁXù,k³²QV°\‘ùxC#3áFAû&g³<{äpöų)“ö(ž1HÚï_º¯¡ûN?rK(ö7?âïÞåætCý˜’Øß®*õeÒ„Lš· qEBýÌ#é(’ÉLBªøHÛž„$"’š¶#g‰™Z×ÐC’´Ìņø)Ö8þEšªþD +/Q®°ËzIö\Žor O#bsÆS.§8õHÇæX☣£ãÛ±ÃeŒŸã\­žÃ¢ô#tßá,x·ï´ÒÔ•™ûÖ]ÄbÚs8›´}‡²4îKØIˆ´ï°úÖèD%žˆSTÄK‘#YE_bKCa…¦¡égõÑ"nÑ ±ˆûy"RÈ‹R¤A^L1‡îWVاtTâ¨zæÍ VÇu<2³ÆÙi)r&”9'Dß'"ö|f¡+É +—ÅEBjV3“¼5#©…VKM!jµÜ5{%ÖCÔì­d³7NÊÏçÉifT .¢› †èÌšS¸uÂU)­yźÃ7Ï£Ûèô±åìy…DÍh³ÒcbD1¦Çì²ãçË¡¦Kž@í?¡­*‡±*ÌHÊó¦„j•"øjŒ+LW—$bPØBÐ*Sy¨Xd,/1XDj±¥¦VóÅŠnS‹q{)EÛˆD,†R’µXU ¬(©Ò„( +-ª*j@¨aENcG&(ˆ*PÍHkÍ$:‹BŽÆ‹NˆL}¥bôÉÍÌÏ)Á< r…1=ÄÅ A܇ººpCUær ó_Âüü^{ùME’ðúüê„Æ´øD¬Qšiöãyä áÇôˆù·cºxûL®” ŠO³¡éÂ9Ä&-i“mžœ/E¨i؄͌§¨V¡ˆdd8Eå 3A&ÈX.Å +C£¼¦QÜ%jp{ÉkÛˆ ÍR´h||]æ«ùçeA’óþÈׄ$Šv…sª^…¼¾±rÓ„ƒ$(j¢×S 99ä+òJò¢ñßPï=£ä©#;uÊÑFf¢iûãŒ5d e=g‚—uäÑcu¤Òt§üv5꣊ø2jqUA +jG”¨ñMQ·_¡°%c禑ó"ùRl˜àüE±råR³D„œÆ Æ-¡hžÓ/ ‘³h"Ò|¥qˆÂ銤’_3›!¹\µÇì‹”|‡B«èÈ…6­‘Y>Ÿ´Ïž«cæÂYnsWÍÀ#:ÑLèP'(Ìx‚ÂÌ„‡™N%†µà +ñ·¤Ç¦ÞÏ9Ž"A[·®iMD¶Õ:ŽqÜ@ŸÐÓ7sS1ÔÖ‘½Ü¥¶±„ü˜—>k„Ì\bÚQµ.t¨XÍ&¯TÒÅÔl¢æSá0Ü£æŽÁòj&¢ö2]Ì=¤. [÷6–>µˆð—|+‘t£šöŒQ­„‚ÞŠ Ã-&H„K£KWzÔìÒ'±Öô-6yˆXÐë34MøÄt>áCsÚ'øó?¤ rwè9ä®(CÄJ É=ÑjƒtJË„é:Œy2¯Žž’/ÚHi¤¥¶ªÔÚ—ˆ25qâ—F!W¢ˆBXtÝ3NHˆñ§"ñŸ £¸Êˆà±jBŒ.‡íÍ¥<ùu)¿¬ +V”œnÃYp3 »ÝËI¾™ˆ<”ë\dAyi7KBÅSŸÊ§ÅÐâçkAjÿ*ŸÔÈ]DDLä[•[¹k&¸ö™)rÒ$<òš‘@²AÆ8¦|Eµ/ršr0Fõ™%¬&§)…øLRa‚S¤±¿1Ž„DÍ´âŸ1!R…ÔľDñÅ3ÆITGüz-ÈH‰ÚEĹ!(?fÝ¥VšÚ§*ÃGÖŸ‰ƒÉ®ô CÊÈDWÝ£iŽ íŠ3vŒr1â¤!#]bAÞ= ¼ú0EWjBÍý¡Pã™P#c ¡Mø”2'¢RDØœ ?t‚g:a¦Á%BÚö »ØIŒ´\™á]ï:F-@d²³ªW™DlÎ ŠçÌV V /ŽÖ ”,e/‰©™çQ–ËM/XI>¬ÀáÂC¡2z¬nB0"‚±PÃV°Ã0dva† ÃPJpéò„ªêj yè†bñ(PùÞ;B=Ô9n ‡¡D¢ ²Èå¢væ’rÔ—IªŒëv{W{VŒ¸¨bû8-ú!Öœ1uMM¸ŽL7cQÜ ·“nº¹]]žÉ´aÏÙ­ôvÐNS®´‘.ËÓ=]2*¥”åÜ!dË„n°ø•‰+K;”Õ«”×V[^CV¶†3Ñ›H‹!´Žã÷#-1A³¹ŽXdQ(§œâ¨p('K\…r2¢ä 9Ñr©\4Há0†¢Ï¸5ÛÜdEWQ½i%qL$‹©DE÷u*Yœ§3ËÍ,½pëù1$ šñYšæëõJúxËìÂÓ*GÆJ©Z¥ˆÿ-E¥`‡”ª‘‹® ‘jS¥ej.Ê”§CÕCu\pZὃ~1($œ-„$¬1ƒ¶Ç:ª$Å<˜¤ÙÔ‰š¬HÉ\Rê9œ¢8ë‹ÉAHbZo’ßšÄdY9¹:•&®:,‰¸ðb»æå·Æ¾Ê™DU„|Ûè5È ¹|“‰¢Å.'kÜJ&Å¢S²è˜KÕ‘¦.û£ÐßL;ÓøEAE!ŸU4†ø3õKZ Ÿ„æ¦MùR†81šéa,ªøF¾QÍдyQ6Ó)jͯ©*R2tE†ßhB>A¤×±{Œ•tßu«%èÕÿ›õålmÍa®Ü¸U/7îÆeLK­bÍ'2(k@¥OŒ„䜔šªáœB +Ka]6J+}'3;»iÛ™ÎV"‘ÔJ"Ç7ê÷Qö}©ˆk/—âøhõÚéMØ&,M£ý§]JV5¯”¢sŽªÉ¢«,]ô23‹¾Œè[uaàHÎNÍÄ(ØÃ oÇj,VûüBEèd¡Í¦.ñ'çÈu˹ÚÁ¨Ì„z|A2¤µ.ªj£ó“jˆ44k”žÜá&'?yg2ÚFV>µª1uèTs‚¼Û,Æ\LM³§.æQÏ Uv!"õüeŸÎ©ŸPO":ÿëød›—…uBL†-OQ«OCHØFŸ·rª‚ç¸b´¨6î?"k6a¡U•¬:ªSE;ÇBÞcɳÚÔˆ±‰zÙ>U™ê–3 Q¢hHLJ*BãK&r™Nèt\hUq+)†Æ‚_CR/»'®Õr…–TUp½ÎW ML‰‹ÿM*S+–K¸H¸¬ÂåB%¤ad„„JJ‚í‰Ìt$#³Yá‘°xž;:Åð8!­:%YeDF• ?2µä"ò7AF…3fMøFxâ~}S;ºøòñ‚õGNR2Ç"ÔUý¬f%Ábƒdñ>—N‚Æd²;"aÅÎy&Åfhò‚#¤ˆ(Ÿb8\¨Zfwž†T±Y=4 zÐF»× ³¢õÄoöLJyŤ©Çð‹¦¡¸8‰RZD&RúEBj׳=…£…aŠpª4{ :È5;‹#d"*i’Ʀ!ÖéÅ¯Ê ñ‚<‘Eµ6)#_dlü"މ!­3 Ⱦc¼A% ×Ú°1.ƒk´Mî˜D8d@ÚÁ„M¨!Ú‹>Ú†ãvÛwvçâ‘÷"m\#r +M„e»á݉¹,¹´k¾ÇéÈàk¹Wl—xeÍ—xü>äKÄ¿Äú°ÁÖ}Ö÷ÍÒÏÌ¥*¿ þVL®­4™Pß*å]dün¼<†œxn‰?:O +úg} –ʯÙ™† +JÇ/¢¾ŒA%y6Æãª\j5]Æ“4˜u‘;„Á´ˆ‰ˆ‘—´ +B+éj&±ãe3U}Ç|#‹KàÌŽbõ5{B“Шi¦ÊŠ> ¨–bä:–Ãï/ºeAôVɪ͛ìé„SDa$¡9ÞhWÞZiˆ*5ÙfÊ V€€í¢7nŸˆÅ¤‘H²’e\š—Âä +e,šáDK†:$òj³-·²®´M•,¾‡½DùħX½j%5ª·ÆºLâRMT¦Ñ¢¢¼."ìÈZ•v†áQ‰ˆZâ°¨µð¢8“iO!SÆÞ wñŸù+ô_a*ÅTœ¤…ô©Î/ÚQÂODD*>C=™ÛÐÑ(RqŠU¼pÈ1Â9Ûº”Ž2Œ“Å—§¨ãrèž Í8YrB:!á¡Ìƒ¤1ŽÆÞêPÄ c"½W.ýœÝ‰pãÌæº›Û³”]ÕƒVÏ8[+ óuwôf¤<Æ%Rq&¼”o‘' ë$«ø5kÆËŒ±Î8c¬£Ñ4’ëB +”Ufš:ÛŒˆŒò+ƒÉx6ø±<ÝêÇm5µf²¶4™´Þ”=^K¼†x"^´³h{ –|‘$‡&in›oÖMjŒqÐQF™_ AUµ ªu v¢twƒóèlä#¸X‹yƒ~é¦Óе"8ížÕx“ñ¨]Éäð¨ è…α‚U®¨Æ«~I³2d|£É·)ÊTQjJ\S” +)NL±¢AŸ€¬•æ¹–ˆSDk³˜ZĽúe9(mLc’`I£d‰Y%®¸=²a—é!T¡,:•QpH® xÆ ).©æÅåjsCឺ‘Ë ïZ?\*™ì£ÍŠ EˆæóvÙØ·d±N}±(Zëá?d}JÁà[‘!Q°ë¤~7Ö£ºFVJµ}}Yó}ü=_­£ÕÌfŸkdƒ$GšÈ‰–{rÅ­õÐýP*CZƒ¸‘Ös¸¶f bÐ*ì ¿­&‘s1ˆ¤œÛ¡t(¥V´¢ÓŠ–XÑSý‚BýÚ…?£xÖ0•+FôV‘;[$<,™è«ShÔDö²óžÔöD)Ò\‰¼7_#”`Ùh _”QÐÉ +NttÑE²ŠSD"QÎáë$ê cøË0ÎrQ®´Ö°ÙZo¯ãQÛrä+­¬”u,rpHz bÕ¼Šrð|;V‚HóçT)}PH$qÑYDkªñ¨iwçb ‰H‰ÈÈ/"Åo¬gq8RväP«â¡ÊZ_eÆS<íFn$û=IOæT)Qá»Y]–/i‚»Åž‰2CDñ¢ùCtˆ‡n5GY®yqc8LÙªÒ !œ~ª*P8ÝÍ H)‚2ŠT–’Š<9ô2’Á-Êqœ¬õ šf‚(`8ŠAS33ç4³Ù<>ëÔŽ*‚e öwŒýf¾¢‹Ùç‰'Ž'º'-Á™¤(}´þa©‘¢Ð†ÝöQ<®­ª­Üoåv„ŠT˜8N„W^œÝ‘Å«ŒŸIfY§ vëTl:5¥ŠM¿©DpH–HEw¢"µ§b¬>‡4"qJ‹=h*6õt4‰O2%yôTµáöSN\âìUΕŒ-­u%FÐgÐH«U+i$ØÛ3Z µ`ÇbÍiy }ÎQ\ñ%e´¥µ±L1S©Ô´rÁF#5²k½ZvÚiœ°E–h'G"ÊŒvgýhÝXFã­ü¢Ê%8ùm2-±á¨Dô7’=u6c°Ð ‚¡Ä\ü€Ðd"Ê¡`PÖTÎI$H"ŒÜFV­Éx–ÞnH¨ æC9ÂcVë³6| RÇJnüï;šBD!P†ˆL5$Iè÷À”Bq>kCÂíõ–#rg–£žÂ3Gx ¥¼,.ù%F9G@åxŽ`îAü à #пºïï±¢#x¨Ð@ðž#8 ?PZ«˜xù»×`'å…û•"¢)Þhý@I¾à8G¦ž#àN‡Ž`¨rHki†ÓñØÐ:äèàKTº  +³áǬæC ˆ²Å‘`Ó~`..¼¥ò ­ÐÅÄ `Uäà1Ù;» ë.a5Z˜~\`ûÐ@0¡Ô&©A#/B§j×Ã%TáÀqFT©&#¨Ì'” ú@p—‚úÉÁº)#iu©žŒa•zÄpÄ'A¥·2Âpknb«&ÁÒŒ/\߯EXólQtQ@Ðb±A"e´iÀDiJ‹°¢}.°@0Az…"+ã<Ö6¤„¡ŒnÏ"ü1Á ¶náZApI•AÐ +=´yDPéLž%œVá­£œÓÀS&‚_ˆ”$:)#BôÁUˆõå ‚>ò‚!D{»Bà@p$‡Ð÷n‚Ä"¡afCÀ^ è !ÖÐx3»p™Ô1º|¾¬òk! VÒ(j¯¢œ@ BÒÀˆ áå%ÂÝ‚¯°#Á@0ZáUàƒàŠ@ПƒPÀªAB=éYBA/BWjÄ#s’ÐÂʯ€¡ÍÁ‹Ø¸@@‚ÐàÄ ÏÁr¿p@ðHu@€¸ªŠ,Ø7-?xvùZÑáü™óïA‹÷ƒØÐV? R?à2Y~P—JøÁÇ‚×Ä_Mâ Ÿ¤PR»E{ð›¶|PËo|ðÈ2-{ª{Pn´‡¿¤üq°ÉÕxS…=À3‘XäÅÓƒ&L§…à*zš%×®<$ügX•ÂP+ ÁtRÅù$w@Z¹þf<øù ®©ÀA¡ +A[UBD%m覸Á˜¸C–ÔÙ’˜øÀ?!èq~\vàÒYëW†6œA’ +·´@êÎÁƒbn`BA™eÏå  mÊÁŸQrð. rçãÀX¾!Tw™B +ÁŒwƒMÆâ“ÂôOu +æeMšò«…¥ñ@‹7‚ ì|)-ƒ¡F蘄 +¶SìàÄÖ¶" ¶ÃÚ ¦mpìƒàz³A d²Ql@!èl€€ÆkœÞø…0k ãº ¬T Ç–D¡NAêLöpÒ@Aõh`hÑ€l4 b/HÓ; M’œ˜Îâ/œ€¼JÁfðÁ=3¸MŒ„÷2“iœ·Š†V$ýE@5øØHÀˆ ²ÁùƒÔÉŽxA¬AŒJÆåßbàINŠÒ Ib y'«êTI†¿ÀIc€㲃 §` I”ïhJm^ÑÂ/°¨:_€z/Õ œãÌ þÁnà b +‚ÈÝš&d4:© Þôc ‰`ŒV[°]a¨\ 4R¡(Á¸ Žd8¸À¿Šj‡•(³`…þZÐ;ãµ N0A®Zð†fZ76-@‡và9"³@:‚SYP`‰,ÀÆÎX`W‚X?8…û+ð±ë8v5Ç… >„ ª­ öŠV ç² Xñ ˜ºUpPüy€9š:^š­ +¦|iAÿ"PŠ® +øŠ½*N©a¾„ }5öJy¦AYÏÔr ‚ú° +€ªÏK²º5¯ĹʫÔ Á¦©âÔ©@€Q*ðqLL Kn{)62ŠÖ¢¸.89‚íÄD°øÔ &*ØG‘ ¢UQAqPì?0æGÁ¨1S¢‚„mÁÉ–A"[PT¥iQ…=г¥ƒÌ¨Õ¨€Í•7ËDÓz Ý¢‚ˆ‚% 5^°Š +–8¬üQt‚)Z™ Á¥a wˆ +L8êr¢‚¢‚[ïPÓÛPÉUMä„5®`pT 7`¼j$dô6‡ + +ïb6%DÕDÆäPþ@üŸeh§à¼vKókm +6~CU{ò³c'+Á¡²BG ×0ùnò‹‚9tšµM!b™ „^ÞIÀfp*4Ép’ñÆ­e 7#\MaªP\´¥@3Ni)ÞR +ÞƒórÔ¸:MR®À>ñÁw`3 ý'oÌT¡ê¸š.ïó¹(ð%@"u"ÌZ¢ s<„ųÃ\ÙÄCAŽƒ4ÏÜ—l…‚}¶«z6ÄM`n©¼8¹I&PPïr Dk÷üùß3u‚SGp£’é ²ÇB°óM}¡»µ­-O0îRs™'h¿®µa¤²›l-/»ý§ÄM‚š"^|Nørß1 $¹Å'ik7ބꜛŠeK†Âù—Û_Â&€¶@Ê×ÁâO`§ &*O=<>æÊ|zHæ¥YŒ ¨bgB•p)Uç `•ÁvE[–9Ï-Éâ‚;æÕÝÓ]¬Á4 jë +úÑD QGÈ5zï'ÈÎÎ[%Uv(Œ• ‚0[ˆ „Š;ЉQ²zQ‚Ëtè±m9W7ô$Èü­áKZ_y£Iðk¼™‚Ò™¶RÁ+ BÎõ>‰$ø¾|ÙÑ +€D´á&¾½ât‚w¦Âd=@Z`ÃB#¨4Œ„?úö2Ÿ\òY`xÇrmw›cX˜ûA}«^G ÊÌý# %IyZALß‘ÿù6ô8ƲÐÞ¥PE*cå A!íqS^ŽD¹ÛìÝ… ¸¨ªK{,|˜«éjˆ4d®£’:âi”%ÖWEó|ÖèEP*Âຉ -¥ã‹”U?|¡"‰T-Íœò<Ã}£Ö…IpŸhE~ˆ Üske'Ø£K÷C@;ÃØ¥¿’Z‡€»·Š$ê_aC°‰©¤ÎÚÇxGq’#@ÈÂŒ“°FÃGÜùßáèõð0ê’Qä$™ª¡?¨ƒ$åÁ²A€Dò¦RÛÑ‚ ê’£wx_­^:1² BÁŒr{‚QâÁ÷°ØsTJ¦ýÿXŸ:™ÓØ‘hDÆÖÚ'¸»ñ¿À>Výr„Ú¼é¤Ö&6ûdu¬ l[{ÔxA‹]? £@½Œ‰d€«Ž!IågÊä{V•ó­9>{¹ÏøÀ)©O‰U5Mzdœ¢iS›.ÑÈŸ.rk7‹«JÈ)@—-z §j“À¨ørSɈì©Ë-…&´pdúi©‹Ê<û hÇŒóÀ¥jøx€TÒŽ;¥ÓѕͷÈe V>ˆ°Ó¾î+ËôÚ1´!À¡,Bb5€Æ2ìsa8­wîÀHŸm¨ÚÛ7®Ú¡wˆMCØ[¶É9wÑ‚fX€b ~Ñ„xz¾Ég’ÚÊëtÒöi:#+]èqàÔîÿdTSh˜Ìì0f{Я(s õ†:Í`5î9‹£¬¾/‹9€i` ã‚yrË· |^óq€i¡\rÎÍ .ê}Ë> |c´ð¿ýÉô¶Ü9P)ãh(¿!ñ +–¶)! ÕdÙÈÿC@ê ¯€Ñ>ƒóŠyy†Z—ŸŠ[æ@­ÛkŠxxº³±¦p}¯*ˆó»c§pü›EŸì¼Ð·òÚ€¬ µT_ÎèMŒÅÒf†wtƒ1)^Wt°ØÌ&ÛÑY,¸+SOý¤1FÕÀp¸$¹Êjà9J³wLi:!%“ýG½°zòš0¦§†zX kÿ¾2ÒKŸ—çr÷ÆH©–ÎÀ0A& Sçœé`$Þ:ò‰Cû˜ZâJ 5À[Y· ðæîú+’8.e€C=¡Ye6âõM&ˆNú;?½æÈ@^Pä℆-n T¯Ÿé"À3”¾] \-®€Z²g(1jÔ¯Nì¡ã0þ“[Y¦ÎÝ“n| ¨EGœŸâ¤_„’ß+›ûBôª¢Ì‚éÿÐQ*$[ëdº\ˆqÐü/:01Gç^Ò-ŇÞ؈VÃḊç5Ë”Ó UäyE¯è“è‡öâ0jß‹zÂ*{¸Ö™G›ºÙ0À +f °ÎópH‹èTàNE¾í.‡º»[/l?É+µa]! DêÄ]0{Ϫ¾@Woƒ¦'iBk,ä ,%7&æ ~xåÒ†1=Š•4:Õ?¯a€Â!6Ù¦PèKWÒbέNý 4®âßL„|‡øµ†]3ö!~7À5 ÐBÌ»¿/@JÓ0 ï‰uŽh'pPG­Pü­m@€†ƒØ +804KKÃÀJ™w`ŠC¤4„•ÈRÿŸ† +êZKç¨;ô ºWògă†Gúh«j¼R4 èÌHsv†ýfíÅ •Ô5Là’ò¶œd£)ÛË Ã¶32.Hn÷m/N˜ñUDóŽtYEµâÌ4„†XFÒQ¿ÊÁIàáÓ”ÅL¡5 ÿ¯,L“›bÄœJ& mÅ.A·ÉldRn~.س¾Rà0q(²©ù «!ÐÛ²‘À~ꢛaÀ‰÷áGlÐT†yq<í< \,0 ä#!ð ´.ÏÏ… ÁNÌAíÂãnǽ7¡Cé³\Ó×jq±+íëÒÒÛíñÂÐ,FV®¼Z/{Š…5äu¹p{¬mŸ&§Hk@ËNTlHàW¾…—çÅ€/hCTå±XPp %ðµ0 â^&Q‘î¿-S ®óFú¬‡ã¥ýý>|è +qkÑkaà¦MLeµ0`+ 梩ŽP4¥qÉGënŸâ­tJ<:H‹¬ìØ]6]P}³!œ§Ü€šÎ4ÊÓ7™]M. 0E€†®ú¹•!ÇD9êyà ý€;#÷…õzÀc¸Ý#F¸C˜ej^—\Zjð¹wL«Þ”ð%ƒèî@gÅFÐ0pÞtÂÒ#ÐÅ£w¼ÇHÒþ¬»Ô]s Æ›…o¤|é!>˜k ,f‰Ëg;ÐßAV‡º4 X“…ƒíGÍ¿vIi@Á¬°n‚ŠO.r5 «ø•Ý,±› ´` ]ÅÅqd±”-ˆqÂê‘)þ_àA$j,S!åŠÿÒÜd¥3ûθ<õ(â°-Ðø´W œ/H”S;ç !ºåø™ ü,He6¨“.çîHZÚ–.ÀÖnÉôn+$¢Û¡ê ©8¶'çà«/ÐbLz~Å`}˜‹Á fµùµ¯/°‚¡¬ƒR¬/p't©TÅ37@´õ\f- ëáS0®jþr §¾€…Liz½\‹ ›/Ðqè(Lò7¤­É1vRÀ渫:¼§ýáÿE«‚t7oõÊ Rð†Yr²dIùn%ÄT˜¨úklW¾º±_柔/`ã бe`{Œâp¸‹l*Ôñ0IÀÏÈÁÀ÷˜p‚RØX³Ýªæ  kqÅ‹k(WoÈs`Ë(G¾€ ‚¢ØuÂkŒjœ/À3QÀ2ŽÆ|ê‹Jê D1‘[0–>ÚŽËHãÃé hû°D"Óˆo\@ŠÁ)ø*¥Ýíº'W’çôði²VhŠä2À-¡7ìœBÌÆÅŽÐÃô¶DRŒk˜F<©/PáÚ%Ó)ï.ÇÄBªÝE²“ð)QY‹VD5˜¦…Q«´õ–_3ëv°5ÐSÙñÕ˜»ÁÁÕ‘ñþ2Vu`ñ©ÛW²y9Ú +ΜÖtHX·–ãßž£ÇXü)±4>➬ÿ´¾>9= ];x×è_)A}j†ÉþðÛåɉ¾€—ˆ.€ ;ü`šÙñfŠúè Ý?¢!š9ínuÎÙ©Š ÓØÔØk©*êó‡ê«±†«®Ã–y /`üÔgy¥/ ^°RÌÊUWÔv¯~Û‘óÐN#6_«)n- Ьîœ/Õ:ì œ.‚–‡šy„e_ Bú@Òî Ô‹6!“:˜ òñXÏìñZ>î \z€*¨ÙNðî lÒ/‹4Ûeñ¾ÀõÝP‚æŽ_=»WLR÷@cÉ/»ËiµÜ\ ü?Üüsñ¨œv/}ò °™§$π僷É2•Š—e¦58Q.,øxÎB_%˜´¾ŽØ×Y­/üO»‡D‚ªŒZEè2:ð LÝ_XÇ +ÍŸú ý¨Ã­L&Pà _€J‹²glUÎ øÞ„–Ù`^ q4Ý#-QðHµv8 úp´w“–º€¦ ¦ š2*¸ +Í-í+‡LÊòNš&?‘áà¼îªÈ™dçq Ð +¬Mo¶ªz k{œ×8ÇAYˆ9\§ilVÿšu7¤V˜: 4ræªõçbIYÀÈé‡ü “šÞ¿X@ñ€¥ÇÑuJ°À¹8v£„´Ç¯¡Q-¯@j.ФzmsW zo ÐÆÅóÀ5+ÐìiTë,‚m®«ÀæçŒª@ª~¾Ó©ä,-˜ôûã12æ}˜… + ïÈ­ªJFes +Ĺa¸†¿ä#³RD~»â¸W÷[\3<–‚÷¸Yf ’†IEâ1Lžâµ¦+ı˜ô¯èo§¥äÄ'úƒ¦"ŠÃФj2:ÿZc(°hj™ÛË~œˆâ²”ÚßIÜ+O,Rò]½"9ã pPËÓj;ôʸj£dËžØß!Äæø$àÓã }é&À*¸T âØê0]a¨ °+ZÎw•0’GÌTÔ1è¿Ãý„åË·ŽK™ÃoYð7Ô@ªŽ—Ïå4å?Œ’ð mÙ‚ûÎýZ³ßIà\Ó3˜+( <Êh’Hlx§:»72)B‘Íg_…à., 2S‚ ðŠG`¿p©ZºÚÇo®†ô…ôU£üÍ€ŽÇŒóÐn^¾‹À"ÿTÌT=QØ'IêX"àôºžVu'D C7Zšl»®‡ ÖwÞ9*ƒ­XJ‚B7(ÎamœtaXCà5ÙíbdCŒ#•W| ¼Î)§†ß!p&{aI¡W€@Vê]²2ˆ@@âúÊŧªs^ëÿø¤ ¨Tok?,Ž&–ð)Ö©ÕwHÔÅZò‹nÞ“ aàÓlH…zѼ•r.Ø@•;‚¦(ÇKpRK‘ »:©Ê}=§z~p&(º ‹ÛÚ´9V\ÐA¹µø¹ÏX$À-Þ"““GÐlð7@E¬c‹(9@qÁ‰0¸¯é"VÐbV[‡úÀtè+nQ·˜€»ÇÓ´-Ô8ÚmÀŽ­¼ˆq¨Å (°FÆ/&¬ld5®‚€aTÃíòL D¹ôýµ|1s¥·÷ýÖN6h€p>è8N~y>|Â`c¬âo¶&P.‚M°VÔжµÑÛò¨Tò2€zsëØ.1Žæ/ÌV|•ܚʧòq˜4Ðè°øÇ€¨¥³˜J)Å=p²²v¶`¡ òÑH$þ½‚H`ÀÙœ¶>_@dÔ·¦ämy¼­ïÒmrÿì8ê퇹p ©è§]oß,>»ƒ³!j-€Å‹*sAÎ,_yuÉãÙ_MJØ@,À@ùÓ„é©FW¼dËP2 +¼¹h‘³P \P+QÙŸU»ª€ÒçÀÎÞPG‚E‚ +8}­‚r)`‰÷0ýö1‚½Ž¾û®é½¥]1W(À'03Cxœ$>ˆ´rµØW *ts8€ B¬®œjưΓTô&àÏìáˆS '­† 8<Èc3Vp±SÊyTà£9Ð@¼Òt‹~Ä *42_1Œˆ†A‘]ÔøâÓåQ.-Ó·˜ÄÝžâP¢$ÖigòÀa€F{4w›K0è<°¨_8&@?sÑQÉ£U̼^nUаV¯J9ˆ ø&*€¥tU‰ü,ZDs>1šæÏæ·µ¡íÑúÐzÞ`”m±Jî“ј¡&VÚ†PuÞ‡ +— L@²¾¸‹GÒ¬¼Hi¶aŒ¡VsoFk[aÓT˜€ÅÉÆRvm +@èµ¾sç‘a$³`u +è÷&`îƒBØLL2h?„tî{•àÍŸ¤»rõ°â)õy˜m+="aã†E/L@ +¨(øIõ¾ÜIÃ<ùôJËá”VXrßÈ•m¿"2Ÿˆ2 »=l™™&O™4=zr ð¥Ñåa]{r­áñ»I†‘€AL¿c3JÍXêQìÎ…";ðŽDc{ñФ„>æëð* +Æu!<Š”½Z®`¿u€€âIAÀ‰²„iê0ªa¶µ¥= +sñäÖ«­j $ªdŸø“[Œ°d1´ö<aù(„{ŸxË 'm vpÏ·ÅÄÚ5ÇåüÎ _ÿ‰¦j¹rÐS½ZƳÓzÙćb‰C(/[ohäŽQFdD€g´‘ä–òHQ Ää&GHª¦À2ø *—'krµŒ'ÛÊnî äÄèÚt‚ß ÍìbH9Ào_½Ïë•*SÀÚíÞÛT 3n%Š’ÂÔ +ЙxÕljÿ´ µÏÌ}¯ÇàòæNU¨½¾9Dèu‰ÉD²àbÍ*4ußåÅ6$äæá×vÊÜ£h˜ÚŬκN;˜¼fºCÁÎa¨8@;¯Ð7Ãì –(Å|±y“é:¨îâyóðn$‚³HßË,Þ&º^ õŠ„ +Æs?¦ÅžG\µ‘¿xÄøQž‰Ô+lòö° Þ16î€s U¸€äu<†¸¤ß @Öð ÁÖI¹@T¯5XÞ†©ío¦­tÞ€[iYˆåî뼌†p^P‰ ëiË'²ÖŠn[è„7X FäA”Óûq8iU ‚ÈjÞyb&òé ã} Q¡ ÃÙ*'ÚàÉ}ÑÈ¥•\«Ha¹™«Î̺Upù `w~¦Êª¼4´Ê+ìPgÛV?Л+iø€C’7>v=†9o}OPYªç•âÚ¥‡GÀžK¢Ÿ6;GgFl”¿,-f¤k,eg’~à-7$½fðýoÈS§â®#Þ8qá­‘ t׌nõmŒYÚsò»àØ¿T*ƒ<£pH§ÁhÖÀY.Û"3³Á° 4tˆ¨PøÁ¸dWPÓ˜U…ït ¤±¯”yË%› 8@ôìk¡´” Ý РÀ=xƒÓt‚®þ§4EUÁÀÐnÖ |@èM™, +Mp€.1$aÌ]F ߯ò@[/µ…¼ @œahp¡ÊÖ®Ô9tþc5Ø,½ÉybɪcHk€YÿüËçbõ¥ޏ8տɖ4gl ä”}Æ7¾n2À¾äªãä3W%r+¨:õ†•™> ^0€JU2çkç‘qó8¸ºMÊàNôBÒ 㜠‡/Wl©8 Â…mØ`à3¬\Hrç]jH$ò$¨¬EÀײ{|¼DfºO:Qœža´üF(U ø¨É¢YN€ü“‚‚$]Ãg¦Ô&äð§)•aJžRð¶–è¤F's>H€§SJà64.dÁ)|q¾æòíÃkKšYª®[Èð¼ÉÁªð¨“@§"îyÀ·F—÷‡&uG§Þ'ä?Ò†hÉ+0‘<Ä‹Øèp3£ÑI׋ZPOÏýœg#Ü]§•þTyóç—V}UþØI)D\ñÝ€m%^ú XŸ+NøÛDNÿçz‡}´d1‡ý/7 T&µ|ö ÏmÏÿ}/$\ŸÄ>Ó!Æ÷þ“2CÝZÐTÚÿrÓ £BXiõ¤0ú/ÅcÚq«/æƒûæ(„é7—| ùߢpÜ žt#ñÿ–X™fà¿S0Ök§âýmÔ‚wÿ_ª, ôL>ovûŸÇ*_ø²ÿ‘;wdé‹ÇõŸÖﳂ .§ù>Oýkò£C©+ÅêÂlVIoÒ¿a} Ehw}Äh…Aï«ñó_Óêα°¿‡ÏæÿuÕùž®££ ­Ò3-ÿ ¾úä•S¸g¹ä¿MX’ÛtjŸù¸œaãßz:ín‰É·¥³ž›Té^áßä9ˆ ÿ× ŸFBüó©±Ýe‚êÒÇ÷ïHÙ‰uÉ\‰ÕwÿFûIsÎAÁœˆ¹]àÏšMO»ýƒÃVe£ìz¨ý÷5mËþVàé@Ìq¨ù°ÿþI™§[J]ÿŽúh·[+úXØBJG*€8””OTÿ¶ß¹§bˆ¼Â˜ŠTôéíºOÿÚÃâ‘I7Téß^΀=%Ù„t £è‹þ¬ƒ£[תH𢉄 ?D:¬ÒYDóü/£¦ÂêÒÎ×Û-ˆWÌgþ–œ*w"°/ëå/wé¼wÊÃÏJïþOÑŒ¶kœæÁošÉŸ¢+¿ißÏífÂ8äßu÷—<ìø§Æ¶öJÆ¿ œµ*†Hဃ¬ÀpGb)þÓ;WA\ú©§@›ÿN„âŸsZ«<Õ¥]î”2C²*³’íâŸüÉ:&‰/åˆâÿ„ñÖ…\+ô¤øâá­ü@Èq»Šÿ@ (•!Hèânä9«øW +àç¿A¡Šö7£âÖÇÂȹž—¹æ¤tˆ4«*þ‡$ÂZj”¥â/ˆoŠE·˜F½Ãÿu µ\ýåøTücñ~…¦JÂ¥Þ‹´¨ËB¿ï´WèO ò/à=ÿÌÅø÷(‹”–Í{"\¦"F¹M·hö6ÐFÌ +Xñ¬paO›âÑd”UâʶÏ!:¡m[ $z¤',WLñ]<›SÞª™æ¥¦)yUü‡‡ç±ÚyUüõ©½ô®[†÷Í«<@9$¤Ï¿Üƒ "ÔTØ?¡ 5OèÊF7Ú‘óÛŠ?™¶Á>!wck6Q9z$4½â⑇çSÜgµ +FaçB/DÅ=­2ó¨\¹%‡FŠ?h÷ÝЪ4y ÅŸ«²8•»¶¶*A¥hîË/ügÿáZ†j”`ŸƒÿËS[ebð¤ÀKþkÞ΃¿¿J5÷Ewh˜Ç|ÿâÒ@$=ø$z¿Aذ÷9ñ Qx*àÆü¶“àc÷„²¦ç~2®eW8Sí›|÷„Ú‘ Þ„îí?Ô&‹Œ6+iûÿL›GÅuuµß“Šs³šíogE^T8¦jún,Eeµ –:²ÿÇÕcðØ/ž)%býö‹ ŽÍÏwÁÏîü°íÚ_ÿ`Ô`rYyaµë·SíôÂ.r‡¶þuÍøzÄëÀ(̇Vñþ$¬®X?*aÌÌ^;‘É×gí%aýï~y…#Ú L¬þÏV–_QÄêgóÉ^)r‰Vÿh¯Íçô°Z~T Fh]ia°úgp\ûɸ¬þ¹²dã»Ó6gõ7‡|£¹Ц˜ÎH×j„g!éëa„C«µo¢…ÏoZýùÎ{Øp1uµ‚D88eõ7˜X^óȘ¨U¿È¡ÕËMzl†*¨jAÍ;kGMF»/Zõ÷<-¿Õ¯êo˜¥¬‰züª~Ž=(^EdÜUõcù䃨6K—ÃØco9_C˜ÛWõ×C5'WýÒ½s ÈùY÷Cy:w"9ElSˆÀìðt?[KžðªšÕ/\h›ïó:£B}µúQyI£“É&Çý»FÂèxÿZý6Ë#„ý‡1½v‘´úm‚ +k7J%äNOXýÀ˜“P^=üXý{V½b1ß&"G—fCbQnà Xý¥òg¾®ÞÁ¨%+fïÕ@ƒàb‘®÷ú~V¿-qßÅíw«G«±˜«IÞZý+¹²‡V¸ÅC‚ "°…C&H^«ßeY‹¸«Vÿ&=îF+­~yçìT ¸Û»V¿3Ü\/þ`õ'hýòš|ó + +ÿ»5Å”´Iz÷ÎyXý3Faó( ³úé|Ä1lGÚ‚=aÑ©Õ?ªÜ3Öˆ„Vÿˆº¼ýÖKZ‡2«ŸU.tè,zá‰-Àb3ÿÓÈúÃG'„~úÛÜŽVYÞ8ZŦ¿ÎÂ9¬¦?húGÉåÉ‹60;ªüšˆeH eȰó‹WQVú×r+F›ö†£TJÓèXð|G,ÅkF=ŸÓçŸ"¥Ÿ‹»æXr+Dó3¡ô_øíɾÁÚKrÉ3²í¹JÿS7Nˆoê+Ï(ý +!…C{R¢¾÷ýƒ@?.Æ¥fçîú—C]%WŠd>£xSú¥R°„›¶¥?£QǬ¬Ö·‘Ñztn,àážúíR+«_3B¤°Ð/Û¢Ï#i鯮úøçežmÇ8‹Õ*a[Çàz³#x}é¯÷ú£·lÛÒOàÇ„³šóZú§Yñï%a¹¹µBާê[ú­•Ê]ú;J_Ü'8Ÿ—þÉm0ýlÍl.eÜN§ƒpGƽŒTqóK‚aúÏe?¤–3?ÿoÊ\8óh ï+&Ä#:¨d)ÁôçPSëcÁ­aý…™ÚSiIj^XLÿ$Q‘݌韨.h-¹Ïªü¨|Aƒw.+á¨øWh…ÀÄž=Ë´fö1¦¬d8_ò™;Èür#§€Î¿L%ÃúI¿êñê®Ú ¢­kâòèÿG<»Ìv¤(¼ÂÅŠGsó6h½ñè«ÔBd]ˆ»‘pJÓçË@mNªÔ«¬I¥Ÿ?„škèß„4¾ùƒ ßim;UbÑìóÇýº-:ßïuY–çŽHU_|ˆ|Îì­7±À=¸e§?}'›ß¡‘"H†IÀ22ãÄó×Vé„zÒDÈ—ît›‚u:ÏÿAZ•ç73LOHïP¡ ¤I×^’+úáx7p1•ᘣL• Ÿ Š®­‰™= ÇAâÜówk‚fõøÿÊmYù‡{Í!¾L°©eè—|‹ð¿7ƪ}tàóï’ͧÑ ¥#ǨánÅtÂ: +×UÆØ$Z~FyÏÑõ™{•ßÙb ¤*ªÓ(¿Jº| 7(Mþ'èüs€¢î#ùûßæ6£öwˆüòÙEÊü!®#@G<~G¾oј,ßøã'tœ(ÑäcÆ?>Èõ×GØ!Ç‹…!Z—Áß?’aUü\hà¿N2…Çx?Š$’\3ÄIä„ß°C!~’ ñçš^e,¿8üì\¦ñ¸fµ^ø#5Û-n•þµU›âÊ~ +\ÈLNJ(¯~¯<,X®&Àºø{Ž“¹ãsÀ?’2Šs”ëøû·†÷û©ÌoÛïAE“/Ì£ƒîáaØÖ¾O«6lÖ#’ï;x£Ø´HkȱAÿxæâŽ73cñ¥÷¬~:ö†q™øjò~^±}?GïÁLc:fuKy|Ž<>âyáí;T_M÷Í +~ç~±t Å–€Êeœr¿¾ å”ñ¹¸o\1ï³]pߊ¼…F<JÞ~Žõ Oèí[1[ííï|Óí;ýÁñ¶qŽs÷:âÕ§§‹ÝùÿPmß˜Š£¼ÒQÙw±9*2Â'Ö¾sÉ*Ëð}Ïœ²K¨ŸöYó¬a Ní;í³à8ßYìÙïH#ÔÅ9þE€ˆ# 3³ä´Ë uÅ*ûãÄïþ3 b!û¯ ׸ו±?"šÀÁË·J_WF÷Z ߃}Ÿ«©ë©¤z}¸s• »>.]¡'¨)˼e\_:  ÷Ò—½C[¿PµA°È3ø85zÉÀfp¡õ=þõÝëàP²>ð™»Izù˜7OÒ<‹`hX%¦èwwgßê»Îi}’ +hjWýõV}(iÃÐüfÜ)¥‰IõGVï›úâÊ¡¤¾ÈÂd¹Ê%!Q?¿Ç!ŒÞý£G«¿£1W™9Ëdù–kÀ1á/¤?aÒ¦Ÿ‚¤e³@”Lߟ‘}À[úUµ)Á Ùä_€Qã§:ÆKQ60¦âMî!p—}9ú¡‰Œþ¡v¡,Æý¸\ÓÐŽ„1x¹æRöލ&/eâqùã™"´í|yƒ7fõí Ñ) /ù¶cý|Hè9Øë…Zñù«0[xI*Ëtèù–N í*hجÈ*ä;ßèn;TIëü–°–*\u^™5T¬šó8B˜í•$Ο1>ïÂó4¸wóu(§ISxl4m‘Íï½ümÜgED/z‡èMÍ?%f$an±èD: é2ßžù ì„ÍÛ jž?° ³R6gÚŒžÛT„Cw;×#=ùŠ[¾m«XY¾×sÇð©t¹òù˜{mîc°[NúÞ2=Y%ÿ-ÿßV‘§™‹Ð”a.r<(_]ÊlÀVyŸ°™ãäÜÔµÀJ?°#|Éo¢Šg$š6bÈ_åÚ½ôxÉoÁT€Ê ÖɯÕSA_ÃuÊ·¡&¡!yQˆ–Ïyä+8ÉK tVäãeÝb@ ÿK(Š|Ç#‘Ž–s!Ÿák†.ýÝÂìs²‚Ķâ©éÑ+>>¹—i¸ê‹ã›’<¾ +¼hÛ­tüÕ=yÔà$Úù5Ço,×ø¦‚\}y=Þ|íŒO.|•£»Ý¿ßïºY/>θñE³øu9šEô©Çœ*¾›ÿàOÖz…ŠO/b¯‡73† ©ÑNxa”=âǘgÌ‘q¸Ðž*Ïâ‹kÌ–ÕÐQþ¸ä߇6íÀÞz·¾:üeX˜>Õy×løœÜAhöBÂ&Å>›¬óC >î©[ï/ü ­•X¾@¤®²C$üÊ®)ùIýý:þFµÏ +qGèmtƒO]»?ÄZ!}Då‚\n3B%øÞ/ü¤¶·äˆŸB ¨CŸ»°øÃ-æROG?"YÒ½Ÿ+ +À÷Ù,–ù÷œ5Ħ¿¹ þ^°I*ƒ™²Ò8^ÎïOó®¼§ˆ€Êû~KÛ©_ü‚¬¾ßY9ÞpîJ©t¡÷Ì÷JKF–†ïƒºñÇ„hˆL÷^/’ÑsR=[ݬ{¯}þ\B½¯²FbÌHY»ÜÝŒž™Œö–÷´¡Ø<èu÷!Ô|áýV Ë½åÆ|÷önUNÀ<°©zîk!Ni»ãú·­žyðe$ÿ pÒMؽXW¼ +Á6rȽ̨ö.:ïØþtïúէLwŸŒî3¨i‰P`zî7=åèK3“æÞjSåÂx.Úåʽ'¸—^6B9‹ÜK¸x ú4îÝÞ.£õdú>‘'Œ¸© »€÷øž+Â})€‹(‡2“+¶ÎFsƒA’d{Æ +½½ÿŸ½G Z·G7\Š,ÂSã#Åí?ÁeG«™ÆP2;cj0Â-+J/ÐL3lb®]í+MÅ0¨Âêkµ9»]Þï¦×þÍÒ¿ÃèÉ}cGií»ÔKÔìƒNݪýIîe×J"£ö;ŽJô;C +ަ½Kéû‘[þ‘ö|K÷§âÍúD{Þ?˜!ö«0ÇãàÙã†>Lñ›ýMáaf_¹³c^ðºì]SúAÍÉ•±ì@…¼’þû”ýù3Kö_03Å· ÙW ›T¼Æ$'9ö:8潷ƪ@‘Q\†Ý䉽/±öžbÒÄÙgÄzËžùicw#v:åÝ­ë³” I{ê2™_M}Ä1ÿf°/‡æ@x6MÕ¸‹}m*…SS0Ñ öÅC¯Îål;žƒ½ï-zÏÿŽ”{p̸U¨­õ¾`{2ùGE{¢ö”D[‡!µGáÔ J=nøqìU“ͳœ®5¦ ­ºoö/Ï„,×,Å•Af c˜ìË}°¤Ÿª^¶ƒýúBð°Õ†\ üŠBÎ7 €öóóâòI `IÈ2á-öÜ oM ‚¿~=tíè&$9_?æÎVIW2vèk>F5´-x«×»)zÜoËלzýV ¼úµª×3ù§†ÊEk¯õzÒ•>½~už§v¥€¸MÊ-­C³þË+y>¬ôú^“(ÀN@ ²ph⵨Ȉfz~ öhJ[42^_]²2•Îëk~1Oyâè +Á Íõ±ÒËóúýɽ^Ž÷øÌ¤×‡¡ fZŸlëLOwÌz*ÈG/fÝÒëËA}¿ž»‡z=ÌáÞ²Ío8 ®×?6ú?6'{ýÐZÛ ‚ƒr‹êõNžÚˆ½œ¼¬D½^<#tcí‚·‡f©×O°o$ó²½h/¾…ÏõÓëQK‚‰ñ›^ ä3[ª¨[…Ô˜÷°ž×°ÂÀ?$mÝµÿ0ßÂ3zý'*CØ{¤º ZA¥®èõåc4€ï~^Oä&6dUé¹²gªF¯/Ô|>%p^O¸ÉTy}_Y¸FCÃë]¢c®¼žRU7¯ÿQ‚Æn7çJóú—@íy´’šãEH·ì1ÀjÛ0¯¿`MÔ÷i”<Ä@¼~f‡¡l^ßû…(– ïøn×׫iE„‚ÍëË;Ìg’y}º-Ò”2¯¿g¼Õ‚Fðóúr´UU; ÄRp¸ì–LڠדΆ>9¯7xðáÜf‹:y×ã*¹êz‘¼¯ÓÇÛÉ\_¸rIø·äþšº^’?’þ~˜JwAñùï%•O=À+ÑÚ©ŽŒÌ vV•–I”ÛL—Ž+‡l ˜[&-žž+l›±Î*.f~~°€UU×Á±í Ôr¹ûv`gÿœD2£ÏÁN‚¦U2“áIxÇ;Ív5WËöt¼ƒßØtÅÇ,´õXèPSÁÛI?$áô¤¥/ì?Þq/«ïMÅGt°Íõ eï,lÀƶí«(aït¿¾ŸÀü;6´L.ÏY5(íAD´92%P’Ðv" ÿN*M­†dBqìßA%pþ¨üØ/=Šë„Ѿڦýß‹Á*Þœ4˜‰G*ñõï ÐèïèWø;i½T!üÇ•´>m›£Áªr!ÔЯ¼ú¯Ù‡¸ù±y$ßÜàS¿#ˆØ9«æx¹Ëf‘¦n‘æ©ø¶õ;œorà¾ß9mëwÒs©cÀ“ÒÙÓˆ|¶x” /<|ra€'Š]ÀÓöì9úÀ3J (­¨ø#(<ÇÛ][!:ËDøµßiͺŸlVi¯d¸ß¡¬lñ ¥z/úAØ9x&]) !V¢Žö•sx¤/.Þ¦M(ùCr°-P”‚Rû®ÖÞYûìò\ïï°n%¤H[©¿SX:ÅxÔaM9îï °ƒ ¤^¢7ýû Y‡H4S'[°qD¡”ÏAM`¯?ØÊ}çîƒð8ETòãÄ*J‰(,n.“#×)”¬±,”’ä€èÜ.<†Ð ™ ‘”© •—6JÛáh\z£/V¡WŠ}íc¡+dá¡áÅžYÁ¦Á;ÇN[Hyç ‡amã{àéSåzÀ<Ž=Ì;Âó—@êúVƒ&àC¹]¥ÍlõDÎUc”iaKü‚G œeÏÏ”eÁCQšÈ.àtÉ"äj‰ Oiíô|.žÜ?ûâðøðRâ…-Cç=ŒÕİê­ÇŒ¸…ÆC„ëñÜ>¿ÞÈc¸)îÉ3Ú¨“›)Ò$Î:oJºG;›E¾S:÷À‡äœGAºœèÊçyšYhGÊ Å©ÃŽ7;ÖÀ!”™Æçýo÷lŸoà„0‘¾ü>¼—ž{‡5#5(œ±ìçz·È–„B—bŸ)ÇäB"®~Žü=ÞÓ~ÜŸŠ½ŸsÈV±õW‰½„þu¶½·, ýy§* ~ü#Ї`ºcÚ,¼ +ë%­áEïÒÒÙ©nG"Q·½HñÀÞ¥S>¨ Ðêrò”Mchìæ–£“ºˆr‡m;³) 3÷Ì€’T+.Ö„­²»8Ä>L—¹:ù0¦ƒN“-9[˜î‘ÿ-ÆrôLhÙè³ +$©8]i ÆÈô•‘Érb9™ã¨%™YœN™0¬]¦s;Õ +`·2ñ\œÃ2õÜW£Æ‚òfèë.T 3åtÜÖê´ÌDŸšéOdsa5Ⱦ=ŽòUuƒÒv0ïLÚåÇ æä!òs0~ÓÉ+Ħӄ÷焦ª¢¢¬¢,Ñô-rìšßh"-ǼGÈMÝQ/ å„“ZÓ´Ú¡T7!¡*zÔD +8O¯Ò™aΉ™Ò÷ɲ©Ìo3ïPI«É=ÓW^÷K¶J¡ÇWs¢g-®Pp£š+Êëaù‰ÔdFÕm¥OøÀ IWÙÇ’ê ‡ö`š&û´ý4qæÛc3 +þ$IcÓkòhýBBÂYkiò³$kGÃ"g“ÝŠ€ÝÓ˜„Ô’ÈÉN-MœS|äpCòóŽ$M½n²!ƒètɃºÄ~gLBïBr,{cz bA§kFü²4%Þ hóØëy;”TœqzG(Oß0¤¬ªÁR9ШÔE•¤ª—5ÇJ“jй?˪ªú—øJ%;‹KÒ k4Ñd5% òÔ¡Xdg4%¬Í|ae¤ÏýR„¿Yè`·.&øŒªƒ†èEHÚGâÀ”!ŠÐY^?Y°ÉAªÉDm¯ò–j¢ö÷}\0RM&j3ßµ…À´…&u‰³™)4U—ÒÅÛÈT¦ªRÛ¥‘6QMQÂ4'ܬΘBÖb£"Ò¨nQMÒ*Ê?^‚ƒ +ó¿(µÉ›Ãɯ$T•pÂ~‘èI{\ H¢*K¡[@ÉÎÙÖ¥Ðt·ß‰§#ª‰àzè#5õi˜Aª5©Il.hŸï±ØrDjJ^m¿¶¿¾™Ï„B’D•W*›®PèKÕ¯uŽ×pj*ôÑ/“©)Ô"De¤&ë’† É…l„B’Ð `󂃂BCÓh¥šh5ù7?ƒG@TUŸùmpåФR=hoÐq…”dó‡‚ÂZV»ÄÿŽj6&”–¢`ýœ 183­P¹ g‹ÎÞk…œìmZ´B"$c[‹ïŸi…´S*ÉÏ’ Ò1Ó +é…ZÔIb?˜×[{ô‘¬ÐUæ©%°˜‹t‡JˆqÍj Ÿž§zéK9,¨Ê¦q"›†§v¬i‹ì…:¦Y¡hÈàI‡DY¡éëÃ̺[¾¼AßòóY¡„§óº±Bƒ;眛¨¥Î5)øºD–)jÓ5°BеGs^í/d:4¡bwÌ3¢íP®è]×&„‰@Û95ÈQR¼µ¡Br=z«©ÜyC‡VSëÊHÑÛ]öýÚ¿þ'Œ¼Œ8Pk@ ™pãö€!@…ÐE©!Ë0T«I4žö4ý@¸g¨PhZ‹>O¡,Æ›ZÒCþ®€V“OPNñŽ6’œ!·š†ù4†®9¶ä$7mK˜'$óÞBA…Rf–å™À>+dLû,ŠtÙA‡ó0-$âú's!–8HùB â›+ÃþÛÞC¹5-÷…t 2„|¢C«Ûd®³âõV¡ì€Ã×gH·D(Ë.oS#lÄ÷iW›½ =š¹TùaÕé24ErRšXíUi›n~|Fæ2ä8 !«fZÏÛ¢ù3ÇÈç´*/f¥ùH"oS¦Ï6‹x*Þ¦•¤G’¼MÜžA¦ôä› 96÷üÚÒÜ:”ˆ‰‡š€rKÛdë¿ñ=V›iø~x»O´I?™Mqï+‹6õz±Ñ·Ç•n MÞöåÈò´©I+”Ì +x´åBG+Ð&[°sO{;ð…À,…áñ]¥6ÍPãÓÜ£;nS›FÇ%÷*ì¾Çãl/äijàÖ·„]ú´Ii†¬‰Ãmk.º¹ÐEÓÛPE± ‘hV—M†YÖr|³r›¨Ð-iò’™“cŠ 7ýR€ò©âè‰u¢•Iªg°P\Ívúå) ¥jÇ&³`n·PrÙÓ§…ØS꽄•âê~GçB„¨àØ”pÏf¬Ä®^©L åtºâÂiÔ‰c“îšr• m–­,D|Ð]Šbr¡ðÁÄ=Q"_6uÅ!¤ÁqˆÂ˜Ä+ŒÜ0-Ä÷Ç“F ¦´Ý±‰š2Ìœ’{!…n(½™ÿ›|Žo3ͽ+-$köÖÂT+-$ + #ØÊöH§…8»Î僚¹ëi!Ýl¤°ÑBr#jÔˆKÏa´ÐÓ#N (\“Õ˜"%–i!úFˆn €_*<6Y7‹{:œ§´ÐôžPYú¾¼ÐB(“µŽu#~Ä®¢…>j€2(Ç&ŽD¥bÐÐBq7µn¡…l´‚½ÿ'ÃA ý°¢ÃÏñØ×—9£…k]ª›Èöæl?´lL Õ¥Œ3:0ñØfà,ç€M‰:{cÐÌ2tgh!cèøjL-$D>² `c´PIFI(À˜h`÷±i<ÛaÏ£…4¯{ÙúØôЧ%1¼B…”m©ÀEŠQÜ+DìvÄ ‘Ã&g¤¤ªð‰úšƨ]º&‘qñ¸«ö­5Éò–«‚Ø5 …„#Gœ“®fUˆžÛ6‰•O@+"è°NZ«Q4z…>Ú³Íá+$p@ƒÌPÙï  +äÍ\sR² ,D©‡í4OZ´#6 [—ªÒ.î' ¢Æ1¹†ÙTa]ÀB +%žQý5¾C ,ÔGaû+Ðú,Ħ 7|àË…¼¡Þ2 ”Þ‹…¾@F+øŽ‹ ›7~ez>‰MH·Ï.nES M~—oÈ+×b!éœS&± ÑB²I4hZXc⪪…€Šákú5Ô ÙtTtñ»µ+ùgБMŽwØL¦Û³‘MËwèV{ÄB¸¯êÓp±Ð sqÌiºÊJ¤¬ôõ¹:ÍÃBˆÇüûÒ–SÂBsÍû!9,¤E~a!¶[õ’ŽÁbBW qZ»¦;qJXHú@ëÜCÞêa!e“ª A&•ư©º%zD3囤ŸGã%$0:a!]jÆ\‡daÓ쥾éͬZX(9ï#”–IR,$8„-Uù ‘ 9SµZÝê\ÈCß÷0&È “ºŠ«Ì&B±ÕÙRgÒ…FI]Âàñ¼Ó­ ð°&÷~¦ØÌ¦3V&[Š’î&± ³iHƒ†8φ ›mÔRh¯ãSŠèÊsØ„qCá=T‹“Ã&¸¤mÔÚ`{Ø$ÕÞãÔÊ­3VÃ&Ð… Q«Å[!”×A.%’•7øQØäÞežPaO¦U\^©°i~1~O'þ¶i…4áœr +ËìI°êö¬{èP¯ÊùUD—ÓZä4})+ÔZé¹z‚tFfº˜N‡¬v U7‹µXhxÛûF-–. a&w§Äù`ÂÐëF6?™*"›8tز@¡éŒ,|Öþ²P[j´}m®d“Dh-P"2# áZŽ{ Ù”ºÏÃ( Ù´òE|4G_¡e,dtB±«6l,¤=PÁ"•b!©ù +ÆXÈ âÇ+´n½{,dLH.¿r‰-¤÷ ‡ã‘œ©*¸­ôò?[諱caœ(nT3›¶}Ü3mÜšM~9ùv’ë£Mf­Å缓m!‹t%žªÆ m M¥÷ÈìpØ$uj yk®°[šZD³‰áó‡t:ͦ¢Ž§Y_}Ó6:²Éö™‘¶Rã.Ø…„)*xÿB„ÂR:³bF %7L‘!n†ÖÆóé"ÒUÜŠ]ò+©?§0³´ax‰ +<ú꿉Ü:½/ÿ¨òàµjN!ü§+öòfìC–ÿ=– + AtØ•º²$DŽrKÙ¶w< +ˆrzÚoÎêŸ f8"‘È<P?".cà/H¢«6Â0ìŽ7ÊVKt9«•1äüë/DL§dü%­Î1ÉEìElÞ'êoöf:ü‘ëzŸù¸T oLÑᦠ+~F´þ\á¡")‰–Ô,^èñàN +gçÇŒ¸ÙÁBa¤íŠ€Êšýâ Ui‹˜EKŒ¾ÊÀS±]݃ÔU¿ƒ™üNâêú¤r—š8GÀßäÂ+êCó;]ë,Bÿ=¾åð$êú>ê¾E•/äéVå)•û´æiÆl„`ôat袧Ÿ@ܶ§)ÈËÿÃŽ‘ûzÊ(65W‡öôYqOq"Ø-XV#÷gò³ ‘yå!h¥Ñp]#”S#tk*=¦ÏèíCmT6B#]u9×WHÞþ§á÷©åU tôJŽô¡Û›¿9B´:IG‡ +t­ud²…1»ý‰Òv¾Ý’ìÁ›\ÔíOŒ$³  ús²ÿE>‹Ñ˶£¹G—[Ê¥@ö§)u3‡Ôf‚°ோà[Õ¤zü©ÎÄ6P èõT¤£½$Ûd ,„ž‡™ëùÔ= $|ýù pàSìfìÍ‘Pk#ïæè"¸qxâm[QÃøÌ¯9ÒºÕ&ŽŽ½ÝP’7Sµ#ݘ‘uý¹Ÿ®rà¸a@b‚ÑørRwì‘_øèV|Üèé€ý¤?¼SìP:{àH³›äqDÖ‚DüRDâ½ +ɘ4U¿å€jƒ¦ƒ:‹Þ!ÒÏåe"á'á¦ÁU¤#}‘|Ž  ôäV²/dYea©Ñ"Åùs‰Q˜Jbó0HjX7†òB³¨o6FW’|4|õ$]§„v†CÙ¼>hJ‚žÈPãWR8p‹‡KRïÑ“† 'ôe’j’ää\”þ¸Ý¤_ °ç›“q¢SàdlV¿d¢ÀÖ¯XÜIk:J!(N"QÔ÷+:H”(½«¨oÚ÷k^UâuRb¤¥ôùkyôFKé Cñpñå- +GŒÂ %ï?ï­Ø³,pbîŽ1oQü-!8ÊNÛŽ‹’®Ô³%Pm§îœÂ7%C]Ç@ùÔž¼)yddë&.¥õI„“kå'o¿ò± ™&Úã YÔ~¹×´=>͢Λqý,pI»¢êí(ýøH©»xxTZWTÁ®Þ ½¨¢ü£óÇsbîO£Dú\c ÌÚJ4J^ä.à0A‡ŒFi‚Ø:ÒŸ«Â@RFQvÙò´2ú ìKª¨ýWÌ +öh©¢Ì2ì6»wzðj”6“@3U>É(íª,²Š”Œß5ô,ªÀÍîAQe¡*eJbl§¡–Ó»(nKG›¨´cÝ^À_ÔáBSiÖ4 ¥dTƒMVô±øf±þ/Ö¤QóÊͶ¸RQ.ÚŠ^ékcGç7 +%5ry±4éuò¢,±vJÀFgIqÝL‚Œµ/öZÒÆôu4ÐGMßõŽ~Æ)Rm uíÏ8]JÅVkîH ?R"WètîÒ†¼$7!îR¤êô%n))RÈŽZ¯ƒÕdß/¤†'¤‰±¦©KCƒÄjp«.¥Ê9p©‘üDu)ñÞ!Î}olÆß ÃÕ4ôi„3«K3Ú55ª5c]²þãÙOGMþAª9(X¨^Y]ò+žë™ðƒT.+> +™Y¨b>öñ„ð¹Ñ,—P·ÌÓNêR + ‡„™Á¾î9¥ +†ÿ¨ƒ!‘ ÄÔðUÄzƒM1õªÛ‹ºG±…æ]=ê’e~ZtêA|¥¿ª÷š>Ѩ{2þÔ©Kšú‘ywÉ,ô|Z«3/ᥠ̛ ¢æ%ËC𹯦;¤È¦¹<¿Dk6ýà N:áÛXß]âÌǼdÞ`R¡J¶†©Õ";“„ï!5iûªäÓÔÉ»¤4[&ÓDKŠ=¤ˆåvïà<¾R$svÐ3$ìD ëЦ¤©¦”áØ¬Ý]‚:‡¦­ïÒ‡GŠ*NbxÞ¥µ­¸‰”ëÉ(M&RWâÖ¾yш‰™L¤ÖŠØG``©ò§æ‚dyéÝ}b÷RuHÛŠRÔ½¤ï6ÆA ¨ä^¤tB6lØà0•l/ýèoXÃ*&¦U!{Ij+òÍ&ì%9–ÈíUž¬AÎEÊ€r‰©dl‘ú¨]Ƥ4õ%¨'ï_jmè I)bª¼(@’âßœí>4`HR¡5‚ì#óÀ”ÌÆÐ"ÛýKˆD7#6BDd#IÕ„ˆ()¨©7±Õ¢D0ym…A#½†²\RRÝÌu<)^J +«5wku‰Pš]RRgÑaoá*õGJª9;™µ…Êí¿tÖ²­Ðš~’Ôò0È|Ðû/9ª›]™qƒ´X%IJãÊà EÞeø/ÑÃÖ D3‰ûîÔÿR-x}X°¯þKK÷nöÂ5H +ìÿK 6Y©çúÉ>’ÂöbÖŸÅx êKTªzK l6çéKÇÓ_*`/¬ù¢.}ÖÔr±Ó'Q)|  ÷LÈ +Ý I•Hj%ë¦1ŒÍƒý%¾Ð¥"$,€÷—Œ†Ò@‚9§Ü"YRÂÕ*‡òsYúR,©4ÌŽ$VàÊ@ 8#Iu]È9ÜÚ^ÞëKò"ÿù8)gõ¥¨¸Zˆ@“Õ‚ìŸ üZ_zµ {éç½¹8ˆa‰:u<’ZÕj¬¤†œW_B£ŒÅˆÀÔ¢J_Êœƒo6ºrywüŽ'?áoLWL?Ú#åÎξðã–cz¤š¹kÏ­OõH=ݯ?/Ëy—z S˜)®'¾¬Æô=V쥙?})6Ú•4»ÛK}éË«€ÕXo„IÑ—ÖŽ—ìÝû}L•žv‰{úX÷•8ÿbîSÔd,CMJâÞ8ÿèj +<Õþ’"á—‰ßq©¦¬¿…;›ºM‘mlŒ ª¶d +S=eØSfL.,ž0c¦X– l«3Êä©1.ÓD¢õe&ÏÇ—ÁRª“ïLjŽçfkH¦¥t…¦WZN:š|l;Ð¥éä°šÀcù š2g~b¬©w±Û«kÚ‰Mç ØšMÚÎH°6±Èa© #üÖÉДÝd`oÊnŸÖåã·)5åß–eŠw+Ÿoš3Ö” ù÷‰t6¯–)NVz›š§=­BࡎÁNÝÕðxÓ)„Ñ:”RÛJDø–Ô/!§¨~ÕœŠ²Áì¥1Gý8E’Ü;ò8 !§zøü‰ÙMlNü›Õ=ÞX³9‰„sA¢‰VÙæä¯9Û˜JÃæ$G§g‰€:6§ÈÂéž[KàqÊaãLèúZŠ@|ºqð‚p(|¥ê]©rçs¾‰sóÃðeê”âÙŠë䣹à„Bët‘ Îl^Ëã\¼äð L'~˜Î•a•HT¬Re'±½E cjç³ì¤³S¼ä[úôÈÞ)ÔfÀn ¸d'‡D ê*‚&;iuBã%;¥ÂlµK¨½SŸnjphR€nöôd§(.“¯oók²Ó½Xs¤¡ßG;uÂ4AÿÆNB“>Ù)Víwjó …øxª8úäõ,S×éc>¯p$5×éÒEŠu¶÷Tæ @¤§6cmRufçœÞŒGS½Æ)8Ÿ¼r_߬Oj­Dð÷IlÉÒÑOd4­ÂŽÉ½õúÐêôú'IïGÙP¾d’ºVÒ?[:D¤*"U/²i×özåuó‚žíæFg„²GÊ_”až–L2qI2ªÇ§Éû¨šãšUnÚŒ_)ZôFTD Ú?Ä`R·Æ÷@¡úŽZ:¨™eRŸ¡£€À +)ÌI¨xüvßDñô ªbð?HŒ½A X +`8Fu›Ï6N=P‡Îs¡MÀ¼ô>ªÒìÐË/xA°ï%˜‚ÿ +×Cm:Š4ÿ@)€æÃÅWéóaU¸j@Õ3 ˜œ3:˜úãêËo}?}þ>M6ÐÁ¢i¸áß usSˆõÙ-P°i̤Q××︺寙]r¼¦Àü¨d¤æò<øÞ<'¦Ù#6õÔpX&ðÂ+µVÛƒ:öƒbÁ*ÿmöL–%„Ü?P˛ڑ&FbH‚ÐÄdûBåÔÌUø•1·wsvp¥×`ßÖ˜÷ºT¬uwÞ,ÊA!ÝBþKTPz óÃéî*¨‡ialâTA³¬…GW]J@²TPÀänû®8x²NöâÁÎGùh2ÚÒ¬( ’ +ò Ç ¡.àð¤³Jäc#¬…¨”Tßc™ ÓÓÏ žã})ù6Ô̸ÿŒ’U°Tõãö>۹ͭTW¡•ÿ®&qžöUjÃ[€¹O`Ñ®VPô‚ Ï8Ä€%·MPyý©ÞLÔàªÃß½•àsNB¤ÂK«*Íþذúë֫θx¯#“®Á ¨É}Ï”éx°Æ›ÓAå»b%Ô´:VŽs.ôø*)™HÝöI5û:·!ªFBR±žR]JíW£`FTkRUT±D蓼:Py¤úÑ+SÁÇl™3À±ä½lfÓ!ÕÖV#ä^”·!© A7нèQƒ¥ÑDÏNÈ#tÇ(¢qN aAA«÷ÑV!©ö ev ª sÐtVã{¨@Î=&(kLÈ£©N4 € ÌRÚŒÎøgxÛþžEM”Ô' Ì(+× Ð7(¹•WŸåºS*)™ +²¬ÛWp R^Ä%3Hò¸îò{Té¤ZiÑ$Œÿ8PÿÑ! k¤5•É/¾ Š“ãcâ’¨&J +±nô0†(¤²†¨ðtz›‰ùjgÿ¸8BÿêHˆyg4PçÍÂ&¨g +ßÄä'ЍðRó] ï@µ¦ DlËÏv è ÿð»S;èŒ(èòª-` =ü¨¦­ù¬Zöu^h— © “ÁT&UÝÏÅ8‰Ôùj«ˆ E–“k£P©F7;Í»ÏN32õ¯:ÙPërN³UKxƒÊTÓtˆ +ø4àÅ^½@?UcAUvÊZ §Åªµ¨\A <¾¨iûIŠ2©BÄ£ð}©"Š5&Å©ÒqþÌÖ¨½\Þ¨”Œß ŸÍdePU@€ö<"Æ(9¥Ž}âô/êHy8—fzrºÛHRúÚ†¾iIe•í\Ü&UT>—zÿ¤ðRŠóˆÈ¨Ô`ŠÚ°´ÉŽÀFD%ðêª#ÅU0n¤Z*#<´æR ù¢àKéUœÀã~*öqq„§',âêR5š€ ´ð¬…©!ÊW5ˆ]þïòNq„©[é"Áš~ ó¼ªêà8 ó󪯇DÓZðÁü^*²‡‚$ª‰êáäÔ—€ùÈÖ½«Š4ƒ²Ü»ª$jÝ|)"§W™j`£>º•ÔÃT“½O)LÙ„5ë3†©ÍŽÔ¬6ô^Α SHøx~Îd¯ÒèS¥ôÀ&Oâù—rÎ8¥ª>0Áêz•ÊÏÆ†BœY¯Bå[ïĒ諪! +Õ‹ñÌ™‚iÕáãôW™Ûê`TÐU25æ‚Ü€.®‘©¥‡®B‰?ä#S´È$'9á`}USç½h>32¥t TB]™¢»¾KëÊÒWÁ™+5SB¹ã¡hœšÃyaÍ +mG©/U^3ÅuÜ‹è‚üWA§6‚Á +áNUy¸j¹¦¸ùL=nS|CãÿMBuDï/Ì>]jee±‚s.$S,uè‘•ñóÏQ·§r&·wûš3À}láü§´¼(ŸAµk½ùBguÈ&òFëÖH¡ªÑêK¹à_=‡h%ÙH+—‚ù[TÀæQaIÅ©Æ}Y.ã1.Ï£ºAïkeCM;jlÖ©ÅE[ÑD/¨Ï^'ª <$’åV»˜½ˆ»Use/U%Ú®¨á¿•è9u áŠ[ªªÄUs×ôÖ²qµ?2ùæürOHÕ¤iÕ%ì¦ÁW²eSr¿îñ,·Êƒ·ÖÊU¦APšÏ¨£®VG4ëXMã¥ìˆ'Hj¥ÝÍG˜pÝU)ßSô>TÑ8cÎáÕFOð¾lVK"[ó³BªîÌsŸ^DZaWUW«W¥+«g¯ËZ«¯êÀ­üžwZ4¾*N`ØÏW#DXö[ÐÒs6ˆ«¡:†ÎL“;犓u1ñÿŠlÏGYfè½w `!tõ¶öìsñòƒ·+óÕâU« x%O^u„Ç¥WÛ"h°zT¢ö +Cã»B ¯0Ü‚ öÕ ÁF ½ î—ª‚¯R «Æ7g,ñ‰” Ù6šë¯Ö/*Ým:ÀÒV=š³“yÐä[ _RjѲ`äöY+²°V¸08”ÿVk¸LajT¥ÝöX)ͺ.æY•’o> +,¨ÞÑq¤ýE± e,K²ŠLT$n4±±‹ÒñR¥FOµ­kÕ&a¶L‡ÊÓ<<%°`DýsàküO.`0Ç:<ÍÖÏK’̬ˆKóÑ?¶>7™ÐΚù:å„DrKsoަ&TBX•R ×–Á®¢ Úôô?PXê×?e¾_@φ%ÎÑCÒX ½òîÐäç*-…xR`Éz!-°˜@ʞν‘Gp–`«~µë‰l«1Â<,œÆ÷ðÝÀòîð·¥ Ö>5°¼ ¬ v~¥<Û1gÖ€é4ÎÃÆ¨pHIúßk0ÐuÙ ¬½€d+]­Å¾i\Ujµª=Í'¾ó¦òVŽÁ¹ÎtZGô öÊ­à´ûVbCÈoOBŒ•ýiƒhEI>u +1X’§.áDvƬªø‹ØSÜ–kO7Å/¡ø×_UóækÞNÿƒ%‰ã@iÏ/( –jý ¾ÿŠÐk¸jÁòòIì?¢7 Ûêg˜õÏpkÁê†$á¬J”íy z>÷’â¬ξÏU° Q¸ýDȡɧ4¯­ŸÎŽW°Â°y’3H•Ê‹û¡Þò+ñèC©û•2#áL²šµÚ:œz‡Ø^ûójs.ê,Êy'D +ÌÜe0Œ¹0doLŽ1Zéö«`Á…ÇN ”KxFG±¤wVåöxÜ,éOá9ŽÐ‚ ],œ70¬œÇ‚%1a)±±â²`ýt><´¡ki –%•G,[ Qƒy¬LãZÄ"›]ÉN›º1^xª‡®köjX3 +ÖŠVgxä Öß1{kêi~,X¤JÀå wV VRù—B,2òX°Ú[擊ö®ON\3x[)+,¯Âàþ¤Y?Gg°H –æ\Ôµ^]¯ÅTXû™Ïä4¢vaÁRø+všÏ-XºËÏdñ|ZÀ‚•iöGoÉ8Ò Ç ¸U俲øX‹ˆgLéb˜ 3Ùkí+Ù2[°š èNô†yj#åŸb [WÜnÁ’¨²hYÒÐqÄG@¦%è2 ¿Âvø©‘"˜Ä¾šß~GXß»¶T°%X)¡²9ʾ“¾N2…ÅWBŠÕŸ V*öÛo 9è?‰_ñ8ÁúÒþÈXDIr€¸åKoñù„6‚|õÌq¬Öc©ož‚Écd)l,Ñ÷;*¶àKNi”ÞóÒœ«€ŽÙôS½¨’`­Ú¤‰dS ŽÛ÷œ#XÉR¦-q"X|„jŒ†ìì`wèéᨵ ym¬›LE9NÚ¡.O‚2o$n VÊYÖìó´K° +U "XJù&=ñiè—ëº&Lð+¯®q^ÞÁÂWÙçðpç÷k‰NçU.:«é XÊ^±ïŒCñÆí,KtÏz7ÔXŠ^?JÏân¡–Û,§˜&'5Ø=–Ãð¨L&§o!X™*ÚtôA°œBþÿÒ‹’Âõ}M°YnÖH€ }» ©LÇd1ËÀráÐå„1\Eú3Ték'D`ï`GèWÏm]Ãg™¸ä}ŒaRò"u`É8W¼Õùúë ÂÞ8òdñ¾Xí%-ZgNVæÛ2e^ +¹…¨\ÔÅ »8Wóô,è ¬†õf‘X ,ãJ°©ÜX´ì1–o– F(…kŠR‰úVö«ßfk·Ž>A«^`ÔÊBʽlEt¤ÿÍmBÿ²¨WVîçWÆaC%‹á8,=É>ò]¾… +°¦ü[Ê(àªR]`‘s0Û+{F`5팪—ó›.°ŽgÿÈŸxÿUU`µ­šº6èY'‘-Aµ 8ÏY°.! %0UOæôµÄ¬¬þ\dX1VHlºY„¤°Ù0…ä/—oMQSÅcF™Z2ã9^uöPKu•жÜ|ð!{ËN!±ÈÊ8-fM`½~Óþ²‚0×K€7O`9’ûçÒã”°¨aš~>ùXGi$œ«ýžsîh ,ÛsáȆ¤ÀZFÇ© ƒV¸*’È:,½ÈÈ© +¬ÜјI¥ÀZUj9\'Xäîð(°” vˆT­ +¬QæÊS`B2 +d`0¡ÉÀò+l?´È¶ ,ÒߘÕE9(|”e =, î1ͨF¤‚xíVD„ç–ÏÝ”äÓs­û4i`1ã·Ä\Ô¦ÈØh`yà‚3 +ü€.a—`%ÜUÿ:—(¢Õã«Uö“Ípï8Íq“áøùj`ÍdÛ½%‚ôwNn`½™N>;;°¬jä©- –mÂé1šéÀR€—pv;°ôtï`›‚n-'#Ò + [¿ÂGgÆÜ+XÞ)TËv`…ê5<Ÿ­ù\á’(ù A:3êXŒ€É–!¼½\f€7°€A8Àh`H¿Œ !ðXâ£t,,4r`}š©‡é‡T•:Ù£æ¬t`YÄé,ub€‘,•°}ÀNì<°ŒpDƒƒ;„¨-*c¡ô–Ñê\ÐÖqDx4–t9ñþÞæX!æù<.°Ç öG‘”™\†á„jÿ•–uªê†#‚oèô“sÓÏÓ½ˆ`Brá^¡óI krÜ(ØÞÀá6'‚•—Ò@õñ«]¬eP»-ó!|ÐC‡à§ª?b”Œc¾˜W5ÉŒUÁòÖ”¹ÁJ‡¢ÅÂok‚ƒßõwU#Áº§ryÊ;d‚e_[ú% RÛGB…¾t’! +©¸s°¤W£‰ËÔ&r°‘¬4 +ÐeiBU~û—µ é`m¿FwµôÄ—,ÿ‡G§ª»"I–†=ã—¯ƒ^9gö­ª8[ø°}j/ýÂVyåV<Üv°ˆ+GÓ|,¯«fKyõ…jg©®˜µ£AJ ·ëäÅýê}ë¡s•QSùßÅ¿,¯Ê\ w°œ§É0øé`™ñômôì`‘_Ú9ÜÒ‡tÙ›±.}5±ýƒõãµgàim2×ÖI5/…䌄õlø YÂjßgÅ+êC«™h:ìa¥±þ74јl[ ‚JˆV`΋&n“|°’’§6Nÿ È<‰Cö'xb$-~°Ä¡ãðD€¨vñÁ2îHTƒb>Xè*Èr{9ކµoÉäЂ%ëë&p@ +ë‚?'–Ñxç9”ŒÈðÜœ°º&és/ +²Jþ ¼Á«ÝëÍ-Z„˜ž°È N–¹AñÂj'~Ã*¨!Ý(¬@*zg®…u2®bÆüâÀÖÞ©( +kÃ~;Ä@tIä~U¦§4- +‹'lžj³8"…Å+ô .ö;ý °:‘&**O(,wù(¼™¢XHQX_ùô¢°LbƯ@È@a™.ʼ&›ÏGyP+#•£°„Ã#Âï‚«0UÖ0ô±3¬sÓiA$‚ÎJVàö µLÏŸ Àèç !(¬iý‰)ô!°ÅUQX_Ì,[36ܬCꮲ¡°Dºr »&›Z/PXøXê×$ôRHæ§)Ž^¼·c=‡Â²t¡~$: +ëì‘0È +«®L°mcI…4¤°Î P‡j|j ),')åéZrp•),ßx‚‰/âMa™ÑdY¤D)¬ÍŽ™qV¥°.%…7˜ï¬Tª°€YeÅYìȲU…õp)ñdQ£Ó±üÜÕ²"…e‡æ…ÕÛ‹±w5…¥yÂx‰ÀwÔóLa-WŸæA·k[õí°•ÂÊIÁ»}F†v +KǹHVaÑ}³éQqµkSaA`KõØŠ¼vxÄ*¬ÅmÔö˜*]…Å5ûó/I1Q…e_=ðKËl¸¨°\MÔz'ÂG¢*,™/ºlou…5ÅZ] Cz´D p1b’ÊWX¢Œ‰$ž°+¬AU¨H> +V!ÿÌ1¨Îèi…õ ÷t……r2ï!ÇÈů°æ"Aò"ë^1ýÖ‚D=‹GucD»R5»I_ª÷ +«wÒ ¸£]a‰ÚMYÓ´pæ_aá±ñòÍækW‰‘h…E}ŽrKäq©°ºn PÄ]BˆWaa)VßþÁþ¨°‘{ù›µ©°r‰/ã¹Ð×X…‡ÍÚÖÎh]¬Ââ ÅS2ø+,™Ãýv‹Z•à ++­ß|RV…%¾Õfš!%©°´GÅÛWX®èÇ6TXœM¡`„£íB U˜¤ÂzÃ+ìÖ¦RaIxÀD.'VX3Êû½ñVX›ß-BºX¸ïèkRaç÷ç©]•Ga-(ô“(¬X5¶Öœ©ð€Â²øÄ^Ë=¨ÖÒêÈ EaÝúÕ°öEè ¾8 º¹²¹úF¹ª¶ôü'¬:? $ò„Ezå`ô³Ÿ°ÄÝš™…•Ü*¨ý ¼4¢°¸ìÀ/û VK*»àZ£€ZQX¬ß0 ¸'²¢°Ò¯Š'˜ _ +K!‹È´åî„¥XŠª<EMn)^/E›°\°G,D]ÕD¢fyaÙÚÃü…•†DfôDV ºo£I +G4ÇKƒ­Òe?D-,[¿?…F¥R k¼®ÿx§„ º`…×u!L¶ˆ Œã@«ovU×_pNLøÂÂȱ ZâEÓ<‚‚…ÐíÜe»¬ þi5Ï„¿°¼Â5v°‹P9¾°ToŽ k 2>>åùY²–À.¢#îôÂÊb yX/¬Ðÿ2©Ñ£ÃòIb¤»`60¬Æœ²‹»$x/,oW|Á[fûÊ(¤ðÜ;ŽT‘ò›¯,5 +5ˆªÏ°ì1¹‚/î)Ì «X5Ù-ÜÎ'q–ð¬ÄŠTÅP–™9¨FåÜØ„aI™B]Dõ_ÛaXηúý=7ïÙ`XÀR@¶t;fyàŠÎ†z-½Ì:V‘‹–à1 `XßfÜÀC.laXu¶"aX¬ÌŠà~RdF&20¬¶é0m,¶Öñ’Arf +Càiíxû1¬•_Ñy³Íé$k´LÛ1¬£«ú/¸Óˆa1u€)øÍÁ$ž–¼ôøÎ,ìð¸=‡6°¶;yJ®í­’' A>h[V9 +¶æþ3`X£éò$AG0¬˜ShÅY¿¯‘R:{†Å߯£€L¿rÎäç(À°8cdéZ%°ފ5§çð(w|€FÞÉú|*¹ëRkNm: ‹¶­žE„\Æ&/ùÖrâ—†UGª¦VÂæL`X¹r„˜ +?aX&¹j%-È>ñáÍí8ùJ0¬”gè«Ãò( D0¬œ2‡ÅÂöX“«L[‘*{ˆk˜áRwTE¹Ñ9 VšÜÚä3Ða™_€ŽYÞbbk×aÂÚÛiÌç‹J‡yÅCÁ*¼¹Ãò¹]©yÒ{î°”6°iõ<µ;,Iþìd¡—Û]Xî° ]@mhc߬ÊÀ=,Jæ:XôÚ=S\;ÊËiíëÉ~Û+–ý8þ+xñFvV +Ü6EèÙ<,/ (¢”?ùèèˆÆ*®Û†L ¾ ‚žKêâÁ¢½#ÄÃÂígE¾=vXÍðÑL2¯K"@ÚÀVŸpEðdE‡/ 6Ԯ밆ñIÕäз«ò)¯è…¦ÃZÖJÔd ìl§ä=®½ÐauœÐ›D~¢]+ã»°Á¤»žÃJM#”«Wóʆš¡9™Ã¢u®¸H8Æ%Ìa­Š•ò +K#|rXnÊ„`ÙÕÆÐÉ+ å°®®0Ú­ÒÍaq¿`ºÀ©uX‘Jwc_³2h®Ãb›×Ða-À$3ŒÔÁAÈ +ÖÇå ²˜Zž‹¾ƒ˜áè°ô<ì±>+tX®‹ØX2%Ê»ÃÚ Ãkþ/®>xÁÏͲÝÿ`•¸”µ¶§µ˜|†]ewq ô°bø)%h‹¥ÇÂÖPPÎrüÒ‹¯1=,•ùöj°Ñ}‹¯Ž*ÚÃòaãÔJ‹_y‹$n¦‡eÊ|͘ÜÞ’}6\õ°LëKižÅš ÛÕë(9 5ßR¹‡å­ä~éa­ÛÛz—' ¤îüèc‡¹‡¥óÍö`•µ¤÷ÅU3{Xñ"ƒßa=¬ººÄNä”C’yÊ–ÛF*]~Âsam•HÐBZ©izXŽ A(  +‡³Së²Dê-ízT¨î&‹=¬$ïßÞ ®Úê°:Ï÷ áûéÀg Èl8G8Ò¤ÜzX ëŒÝ€¯“]šwÞÍy>,kÙ¤!±Ò¾æÃÂdG8l3‡û°ÔÎh5ÃV”Ǿ²-sG‹äÆ´‡å(Çw …(£¥“ ¶ãçaõ2Ðm†–<¬ãµ/ª!xƒÂhW»ÉÎ;¬Ž(%Þ¼wB¡UIAóœs‘Öcd›.p 7VbØ>âKVÊ!E²JK’I,x檖®Þ{Xá­Ýzöc—뻃ºîaí+ +KööM{XCu qÇôõ°ÄH3äûN>`ÖŠñ°¦õ°ví¤d-å›´© ÇLô°ª‡&ÓÝÃÂþFn=¬æiM˜CÈû°ö+¨Úîa©‹òz<ÉxÓ÷aÙK[ýK’Cõ‡å ÿ[,Æê=Àr¯¿Ñ¥Ü”iK«bëÙÙ±_†‚d(ûe(”Ø/Cñ°¤´Nÿ‡â‚"¤7XÈð +B à¸`lÁ:p*Vhò€ŠhËl¢ð :œ¢'á!,„ %\Ìq‚®,\„r&2#¸— Ã,U8ºnã(:ŠuóçRl„÷è3…™Â4((î=e˜üM§ kQ¢ …nïƒa29B’B·ÃB¡É®I¡TàÕ”|°‹ªÞ$Ÿ$š° ÎO^´ý1ü[Ú±zÊ’#®ƒšØ(2ÑpF;ºÎ—ÊxŽû”þö+Ò‡Ómê³G`xEÔK`+íøÁ߃súgÞâ?lÇÿiû<9â˜\ ßÑÁÓÿ + ?Æg6ü«egøWKSHu’±üˆ®oø4ï¡è¾œÁ¯)'¿øÃ”Q42‘!Xþ éi0¤j‡æ’UøÆ(ÃgjÎ…>…y0"q­íqrì_tø‚Â=ʽ!ñQÎÈ—}„ qØ„ÅB +ß,,ᑨͳ™ÂlÓ¦™öæEUOf)’pÏAªêöDÒ +Ú7|ÌPŠfÁjL?·PÓñRkkŒ¸Z“1-ÒK(„ŒèŸå1›‹A+%:ﯓ~ÿÞ×Ù`?œÓ Rh:lr`{Öo ÈøêfΙ>G(óèü?ɘ†Â9†—Œð1Ä"+ü=Jc'P£QûCœzÖMÕÿ£÷óoÉo.C¨Ð²¯±ËetøœóùÌ‘óÎE*¶O4‚z‚œ BòÚí/åü&ÿ‘a~Êÿ!ze½Æ—ö8±Èÿ!Â,‹ˆ‚ÂcÜ(M’ºäŸa(þÊßáW-4ÂNÉR£ÿ–ž¾Óà´Rþ.ÿP©xß&Ïžó/S&X)>UªA|ª¢žUH§ŒÐ©ÆðÃrËãŒàã~œÁw°úÅ”ÔLñ0êAï" cÃóŸ”Kìœî‚â!|¾g$õÂl›6 Ú¦Õ›a‚Ô½àQÁ 1E%d’P!›f»!ìâCWaxϘ‡‡¾6+Ì#rìÄ=—…F´ á› c…Cø„‘dˆàëá;â!H‘RiÂÓ¦….bhr‰îQ®Î"EÐá[˜¤0j%ŸÑÛóIC2󆙗&ÆÃÀß!S_¢OŸÀJ”²…V|ªAý'Z'4!…y + ž?jÐ;z1ÛlëãqqŽÆgx¸è{âEÏ7¦ç¨z$yVpÀ€8l–õ y*\ + >^!£0Zˆ2‚ŠoBP¥m×:üÄÃÙM„`ôTœá½0"øA:[ „%‚¦$‚K” 8C3 ‹3>Vœ1Ù +˜9‰3Cœ1ÜïpÂp†àòÉ4{ z8Â7ã3#Îð¥§Ìµ¬…ŽˆÚ×Ä2Š3fËfMœLŠâ i¢A~ŠÅe%Íf¡Êý8‰3üü°Äë¸`”fl åõ&¢Îh®@6¥utJ¬f‡k=h|a,%–J”“ÃPØX¢qÌã7`/£ÖòjàB\+FQÄç6†· §=}Qç—Ughaúgø¡ PÒŠ˜í¡ÓøŠ}°Q BFÄ”ÃÛþ¨²2ΈÇ/KÖÃB™=dIp8ˆfW²_1œ7I!Uþ†w0CëøpˆdïY¾]NGOx~¯A²]jèœ(Àø’Õ¹v¹«PÁN•%$¡éA1µ²ËÇ,=e3æíD&Ñ“ÚFÄ€ªVˆ3ÎÀ>€@DzŽ8¦Í…xþq6!Î(ª¾#=¿0•gjô`3ÝCÁàKÖ^nÖøu3”d”ÈWˆ3h{ +mµjªPTÅ"í¯È ÍqŒ½¿ènø‘ÊK˜0Y£î0Œs¸HÃGŸZÉ<ÎÐW¿¸?¾IU‡¹A¨îWa8£ƒ!4—ê4Fbž¥‡3  Öv0¥g€ÛÑìmC•xÊÐUF‡0®Ú½.Mq…4p|ÆfÏc6ˆ3¶`ëF™•æg 3®¦ÃÆãb£U‹8ãË<Ò¢½&QÞï/ob•3Ê24M±LÌñšd aÄ Î`‚§o°™¨e BœqUØ©Jôb…8#$aâÃ/þÐ@cæõ(‘ƒ%Eq†¬ëärJi—¼³ÅíÊ^¦€8Ãyõ)8œ@œ‘X¨ü:É×)yfjù`5\XÆ””zúïËw\ʨ2¥‡‹½¦ ¦ôçžûÈÐ0Þ¦¸?Œ'‰3 OÌ*æù¼;üÜC&¥$ΘÛ#ÇH’Ù‘ˆ{èdxxOòSˆFâ-θÞ~}÷nI“Ù\œñ¬^êï™(ƒ½O‡î¦ß§œÔ¿`!nÿçEq: v„R4D;ä ¢ç{‘„—¾Ã ÓéRƒ)‹6?`·»Qƒœ?˜$$gÄãí XÒ–ëýC–tØ`4q4#‹’3¨M7­/ŠËUåèÀîŠq'£Å„ù bRG)g‰ôèlãe’”3ìŒ_Hã„á‹@bv9WzÊl»^šwfÊ”)#(J C̪ I ”DØ*O!9ã#Àc6Úƒù6>ûOþ‘·oL¦(gÈ:‰³GT‹Gàwž‡žœÁÝÿ¦NùE€K&nKNÎðC*àáž(‹5‡Ëf¦ÛG^´Ç\h“udEZ—b œaý_è€B…L9ãã° áòRκviÄ|k(æ`i@{­>WÎHw£ù¡Œ€Y•3^MÈÆyÙ˜›5Z*ÊIï.ضn¾wO•3yˆ OÚ`ºUÎ`àËe ΘDV9C½2FÇ/8àvJå ë'“‹ØmüÆš—ž˜×ÜvFçîÝ-•ŠùºŽV+Ñ2 ¬œáÉ`UºŸó¨óÊ'ÍÜ=®ºÛUÎzu$¡¾’£ú÷B5;Ò®œ1€#ÖÒD<6U‘%«’²,k Óí S·!|x>oƒ57©Hþ7Š’ò&Öì#Í4†)e,¨‡Ö î×ÊÑ´„˜™':¬œ1¡KÅúTzm“`Í!¦â“ Å}ã™™€Êˆ*Ñö×\ž¨·buŒR 8™¨ü¬9tÈê[Ì\•3–+sæ“ÀB=H\Î9¨8DÍŽ¬0g5¾^eŠ20;è»ÒnA¯ùe5{/“)+Fª”åxY6„ËÐQX.^Ú,ÒÎærFžtjÂù²r‰®Í˶”A)h%ôîÕ{EIþrFy/–ôr†u+ØÉrËŽCŒ]PЉN üGpø¹ uÞ¢œ9#”Pë–õ¸0ά9ÜYíLÛ‘„¤+ê‚;ËÇjïÍRDJ·x KºJÔv3Â`ò +ÐL² +¢” Ì為‚õ#_bÆ AæŒgMXªwf¶r³—s^!a +hk¬9(öéZÄ8J!æŒÄ}$ӧⵜqÿ¶­Ô¶ -g¤G2†ða±Eˬ9L+åH|;ÑAVÎ “·æ-J$ÿrFÑf‚YÌü&‰æªÏ¡ŽJßöSnØhiaå¸ë%¤–q +Gvþ5C“œ1gÈeúcæý<»j+Ѽæ€j©slˆ9Cìü xk¨ÜMÄœñF­0M‰Äï»ðÞ?ƒ9cVÅ™æPQº"+ÁÚ™œT]è¨ÁA2ƒ®¨°"æ ^¦ÝÙ€Xi00g¤ñ­ìðŽ]¿ð’dÎÀ"aO×:»bf„¶s‰9Di_£~¨þٓ«átªIlª3gDé ómyg¨V„äuésƽÌAsÐ\˜3æÅ­ºaMÌa™åt¤Éò"’ùrLTÅ#¹ù]ÎÀ!TÖvÅD)]ÎØÚ“whL,rAó¢s9cÑa ·ôU˜éŸ ˆgæÄ,ÒV·7Œ Ì.ùQðÉÎõøBIIz˜ƒPª.2%µpƒIÌ—®2.ËÝ]ÂþÅ#w˜Ã"ì¯'}üp™h‡9¬xºX6…S„«K0g & ?Zº¢ÿç»”¹¼°²Ámš3hú +ØÌjÎE¸[+UE —hΘú+Z¥_Ø9£óÀÕ6¦‡71äbTïÖèLô6æyd^,­œ,Ï,Q(nŒ3Ú3gHUlwQÝ3{Ò´ES— ^oƒ©1ÉxÃcåi·¼GI€9#ùË2Ù?Œ.Å×r/ä£V¶´—3/ÛvtcU#q9ƒ€E¨L^h:'24Ävî0Š(X>ç–¼U-1Ù.…àRÓy¢Èª˜3 @ÄÒÿÆ®hÒÄоŒìbd1ù ÒìæŒÍ¥¤½˜3lÃüžxˆ9}d5‘*H‰6òîrž¡àÚëæHl§õ„ÝærF¥’EM¬Hì +e«5õ.L‰9@e# ›"8.g´}öàïs—l°rU_@¸28˜ýÙŠ—ß’ŸÓ sÍ3³Åxž‰9,Ö9ìÌeá.°@mɽœ±ÚUÑ@Š™—38Pö”sø¼CÀɽœ¼è,'gy9#‡@–ˆ,¬ÊÄîW'(ÍÙÓ.gI òØ…¿™q9£ҠyžìÆØˆœ•Pø[@JzMy/gDÍð;1]ßÊî™3 š/Eu¶7CεB/¬V'¸FMVÎ`¹ ÍP[”à›yEcïòB&üK¬âosˆÐ*ŸÙ‘ÅÚsàOÁ™¶y´XôD”3`¸GZòcSÎx"+]z‡îÀ—bÊ_j°ãåD÷4—„˜ƒêQü)gD©+T`ˆÅ†¦œaXk~RÔàØKÎ`[:SHÎø%‡AŒ:ýEs 2Ç`9¸…ŸœÁ1¶¤ÏSÄJ9C¸ÝëšÇÙQÎð¶yØCˆpÕGIðŸ Ô§œáÒW+Z{`ô±Šs>c*‹[‡‚C "‰UÎðeE P@âpVΨV÷+«ÄÅ*gln]nMÈrá•3J§»°ßØÕëTâÐ2 vƒ†«oo(æÊ'Ðf)½•¸•3î;{"×-m7¶$#<'VΘ®¦„ùÊÅ "Á.³¦çÃÙ ãW¤ÐÆŠÜŸiòæd–Ôâ”3<+â[ðÓð·†p@žåŒÁ' ,•'¬^:ƒ=˜Ïm¾åŒýÙ$ÅJŸD>¢Þ‡Ê±g@Õǽ;8|ŒÛnYÎØI ŠÇϰ|Áù7ÀVÃqb·ÂßÍ=Ö‡m'ÐH¹tVõ]l6rQy̆WÔrF͉@þ…¯&hê.:¸úe†´³|Ò¦ ßÈ-g°ÊUN©{Bˆ-Ìr†æX¸ œ.¾b @x‚Í Ð_¹å _ÑQ<±&¾× m9ãxó0$C{±¸O™‰ +ÛßXÎàÌHò`$ÌQ0Zvgý¶º"T.­E7J9·œñø˜eé5pybïü´DelZI$/,NÜr¡ó>±‡²œÑ”×!JíúĦr˜°›îÕ¡´íõZ*j çËWlþÓFœÄ ŠÏYÿ‚–=n ®°bÎA Wΰþ$|È®™ZÇ*gJù¥ã~” TÎè^±•\–äC†•3ÒP²ôÖIæ¸mÈÄF@@r •3Ð8!¥³Ø„ÏZÊ6ä;,”•D«®Ó$7^vPzÆî^Eªµ),T¼©+g!:XÎ@·Õð™=…-^ÌÉAoÆW‰"¦4EѵÁé9õÃaS¹Ž¿œT™K×ÚýŽØ°ìrFh+È©Å$bÎN®þD¸øhür†C’y\•6±Ÿ$ Å !sFž7‹íí›a/$‘³¡óOïNQm`ÄØi6p;ìÖ½,üz³á äµ#Uóz\Ù@¸NþÜÅܪ5’¤d[ÇI‹ïR9®ô;-…°Êt7 ÖbE„³ƒã+´Êù¬HrYhåŒåªKNɾ[ÎxêÑ̶ïœÂrÆÓY’ÛöªzxLBÁ_ä¾öþ5ÐûêРɌ°"^Î8ó$³Ú1ûÞõ5à³>ÂT«¹œqŠy<×g+œVëkxi*rÇŒ»œÁ3Dôr†ÒÏR3IÑÖU_ä{p”—3˜Ó"bÎΈõ‡ËF'0*IÐcø¹ík¸ÄÍiŸÞ¨1Ò cP§F ‰$­¯”ߘeH­Ÿ·íkxìS¦+äúL ¶¯Adl˜À‰îûûãÆ(o` +w¹Ý'{¿e²×À¿m)¥»&O²¯Áeu?å@UsaeóLy£} ¶#¡«¶V¶¯Í瓌ÞŸ:ÀlÁzörFØ…”D¢9+ò§¥¾ôw À¡‡4ßx9C6tO’=ÂðePêk¦»_Jg)®༜1à<I»¬å–¾"¨ Nà:¹²·½Ê¼œq>Î<,÷Ä\±[Ç +OÍaÈŸA”?%þ]OJ4:ÐÙ•²XÎ žyåLj¥œfOZL¢6} À5Ö‚çMaË(°åËðÇrF͇¾¨•»’ï?i9ƒo?‡ýï¯J¼†ú=ÃÁôw7(o†·’­v Ö\|QDxßMöÖ>!~:çœ\—3N MÎ3_i×àÛ00‘³C@(í´fÜ(´kh‘„i9c—­]L èºÒ®FìKá¬å E‡yÇþ.Ï5Ðë“ÇÉö¥ ¡áãÉ  x˺E©ÙjåŒØ›B8áÊ95%ø‘†ˆ]̉«f° k­Ka"Š4ÖQ¸•3ð™ò ?Uâ(©<®a¹Éìó¨$L•3Äñ/´éLé +gDDÛ]Wþz=DåŒ +4êBÂÊ›L™Þ>¼îmÐ19Ѳ¹wÌ:ÁrÒ–Ç„xµ¡—®rÆJP¹Uྟ*oŠ–3Ê8ß,×òh0ªtFϯÂÙb9#Ïõ¯N•ªˆ·œöž‘Sži,'9á?o!ëÄÊWËÒ@Ä|\0G ¬ÒEÛ¾÷¡ög°¯‚a¾\T¯· “y«aU~)gVCj¾c×ìODmìÞr†r´/êÌ®¦Ôhö“å iõEbˆÿ‚ÍŠÉrFM$µŒS=,[ ˜Ž«Û=Ó”ch®bƒ$yÄr†å£;œà¸j˜åVÑ6˜>¬œ‘›h1í¯Tå hf‹Ô¤†WÞçªÁ€³ùJÀøiå 3¸rh—EÒK +Éd¢³›œaþ­åóÕ¬ …« †rÜ43’t»?\5X#˜·.+]ÌQµ 9ãY—AÎQ¦E`Sa¹j K¼¨uáÓ—œÑ]Jï¤ße–œa#ÓŒò„Ÿ,Hλ'êBö°.³>r†Ç¹#wàAzÔb”W©«àœËcøY{ä 8” F ŠÒ…%rÁ8$›¤‘’ý;rò¨ô€ìôq;2"g<µMêèx¾Ló4jtO l9ƒ  ÇçA¶ ¥¼u$g ¬T’ +BJ5 ¿üžép_¥¼¾Ð¨° ù‘3Ä;„©¢åG´?r†>ÃÇÉôâ U‡R I´ó Ç‘3Ö«ê…° sþ%9#nƒ6wY"‡aìä~óù]Ô¡û/²ª¡ŠÎ[7úöl³•ø‘3ÐkÙòŸz·˜…œÑìaS¶4T 9ƒVb¿jÁã 2üæ*Õ@+üÖ†¿Òd¼·R ñ=£3X;S‚Ķu=Û’ú‡ I@ÄN¤T†tx(ÕÈQ„ +K9Cp²ZÎXdøÙº‚Ü‹œq ÞË)èOV¿cÒsôWOb#gÀŽÖŸBþíúµÓ’x Ð¥`2”%i¶Ão-*\>)‘À-n£øRŒ?9cŒ Ê£ÚÉGÓ˜ÙXÀâQÃÏ'gDïEÓ<Þ~nOx:bÙcPeŽÿ“¥ÞrÎkɲ´.$(ì=-Á€t‰ÇSd%gtñJi,¾‡ä~'g:»gY¾ .î@Üú ƒhøé¢òoz.Ñ$M'n ¦ÿíbFXË”žœ CœÚi¼Ï‚°“œQìR]!¾Ë¥„º9äŒ$L ¬T=Ÿì‰œ‘ ª–c”þ'r.UצêÑØ…í#g˜J0(…Àã–÷LƒU="g8ctXØÅ²ú‘‡ƒ[4Oõø0 +2ÈœD‘3ª~‘ é)Þ g¨?ϵ 9c;Uê8Dz{7Õ‘WKçè¡ý™{CJÚ‡#g ^ÓËù`ú·7|:n Ÿ‚:X6ˆÓ½ßl…ŽOÊMíÀ›Hë©.{Èò Å‘=…œáÆ{ýŽ1Ü»ƒg$û1ÌÕÀm ,ÚU!”ªrFJ¤–V’ÖÃ\¾ð!g˜jÊí3®8â]Ïm g*5>ò:Ü{œ‘(˜<Ð1ëqÆÌ®Çý¼×¾ +Ü€"mÓã ïjv36>à6†Îž™ˆÛf¸_3±³­š×ò6†ŽZ èÇÎæãQ£_ŸbèŽH0§¿c즠ãÛh¢÷ýiq€”=¡:WÔÛÔ )œÁ˜ì™C/ôõm²º{߯  +x\ˆ ++n (4öO>û“ûÎg@bܪ[F¯â`-'¤h!ÎÈ{IÐDK;s'θÒñ çåå+– <“H”q†uðC^¢ªZ†PLzñÊé³â t£>ßQ@q†®nFþ$PãqF¾OFÚk â8¯±bu4á?Â~OœÑ†’y‚R…ÅT_tIеa4ZúÇ l 8C¦P äDÍ-±2®t¸‘4“³”¶æŒc(`G^}_¨Wð‹3.§5àâê–À]ŠO9<‡a;)ná3ãŒ\­2O±º¬Ê8Ãy¾¡ÂûûŸbPGo—~‘„ÒRgè5žø‹¡D~#Å2θ€YF]Ôðã U9-DÓUÊJ „Laö_‹3\ZnZI¾LIQ©g´É«[Øl’ä1Äג̳¿íB#o«¯q†Kö{§º‘¤´q”ȵ ¡Ä‡¡ß÷–È€%—.À»1--Üh:ÖqÆ^ªËE±<ÿívg¼TÛA؃yŠîã H× Àiß ïqF)ü>—¶ZµJƒŠ„IÝȾ>΀ày‘Œ:ÄâÈaèѬßvìP \ÿ*t8‹3Ö‘šA3+ÝFãŒÝ +C¶¡Ur"‡á(Í0À‚D‹ØÝi¬(9 B\¸ÀcwZÄa¸œY->dzœ¡ê\%ñ’8 X¬±(é±B…‡áà×/yËK>`DY=Îð©q|a¬ÒVœ?rQ :Hf+#gø©eþ.rFÀ<7«8JÎ|ÐKÎpŠžàõçý’32ê e ý "gX™i0‚o£°ÈО¨ù +#L§èø9c„_ÅÁ[ìÅ3Ô²2B¸º¯Rÿš’Ã3o4ÙÈ©ƒ‡$,Èa€‘ôŽFªø~l‹+™>NB9 Ðä"€ gèUâ»,Òþ:ÎÀÀ1…è†ÎëFµî8£òÎY7À4Ÿ])²l¡qœük$s`ÎäΟhœqdOŸ._³Ÿÿ3"ܹmš=NýÆ„Žl$®£¤Ü1©Éax)㮊d.“ÃÐ01¼ßg, rD©¹Îï g˜ÔŽ*oìøÚð鳲͗d‰ÃàÀΡ- GÏiœmŽ-… £7ã |ÑF·óUõÒ°½¾ßEq´\BŒcfœÑ·pOÊ=Έ”Á·™å<É£g ¶§²SótŒÃðeÑ‹~ÉâÌÔg0\ Ðã0(D´s»—iÆãL{©¼™qÆ_ɵ]Vˆ_*1½ú§Ô>h¿•ØÝIªW‘㌒Ÿä«¸z}y±™ÆapÖ5ÞQµ"ã Äö‘è|tltÖס&Wuúq +ý¥Ñ4aMû?W2Î@¿j5´»nCýÝ8ƒ(<¸ús“‚LT}ˆB*–q©ª4/–<ê.ì±±(h9oÂZÁ}Hgh†ªégœ1\åUg\SgÈq·3:sÖã :—¢(T ‘ÛªA†C3 4λ¡|U}…,9£L4Ï–¿äŒŸeoÎÈêø"9#Ù2*D£"na¸AÑÌ4òrÊÒ®ýÚ‘3ÊZ6üÔT3-ðˆ„×u3 ÏìžôÚ£/¤¼…ÁsÏÔ/»fGèT¥¸~â!gèðHŸ&^%µ8ªä- ÖYOI +rÛ·BÀÛÈåÔè—S8NÇmî­^AΨcX«naè#ƒ7é?äŒèо[¬­CÎ@ª6®ežä ›òŠÖužL)E(âv*0Lu,S„¦j¶÷·0D†³Y}™üãŒ&æ|(Õu˨@…—`TâöžØ$¥ðspSÎCÚF3¾B7ÎÀ`œáÛ|§Vxg”¾˜o1„ ÃjYu«OÛfÜUø7êý­Ýö Â\,΀á³uŽšoüäÏÅZÉ…qFt—G&Ý8c ˜C "Q„Ëæd§óîÎÏÈqFx6xU6_år}V¢ B¡^/ð)"ªmFQu—¤*Kvœ†ù° Ú† +§‰ +ÝÙsð[o::e5© +-C’£3qaà‹Í`X.ÎÙ¸0de¶¼Ú€ ƒr¯n1%âŠ,Ɇ C43EB… ÃQQ9âÂà"@ÿö5t¶0œÙ÷³¯×÷ ¸0ũȺԺîSIÅ"µsÿÝz½Wœ±BŽÌ ÎK*ÔâàRøÚÀ/ÙjòÙNq†Ö¼6õ0—16i Z>ME.*žÄ4´¼¨4Š0 ®ëð5*%»@h&!¬ @gT»×6ESãN®ÚŒ–8ƒ@5¹ëzÃÁc³­í¤n†Ižÿ[ 8ò²¬àd$ ¹ûŸÌÆš‹8C—eIœ$Wu!$EÄ«°hÈ›à›ƒò·Ùë{?KÄà [îˆûö(ÈÂO¥ÇŠw0ÔÜòZY-E0œ±)ƒÃ᪠50¿+# øë}x¢ÝôFÈó6CÀ“&†ñÄÀå¾ÈgÜ`Rƒàï]èxÃgåçÏ0øä¡1ű¬ÕðÁV­gœ`Яüb² _‰—_<O‡EqÆØoÊ¡Œ¡ w‚s¥Û&q}»˜jÐÝÓ¼ÓH• …ðƒc}"‰p[à nUü>ËãŒw¨Õ %Û7×VåÅŒÚJ·œÅÒéúg€š19™cS$g”&¸Ç"0äDIgrÎÒlsJê[K¯p‚Ô²8cãôi‹;m¬åÃåý­\%ûê8Á@Ñ\="Ûà^œ`¨÷ú“Ú‹3<(£zO÷¥­ÅþWGÈ8ãå ± gø r'£ø,Îøpëг8ƒúô°‹ØÕ¦µ8ã +ìãg´KÚ  œÂå×ðøê°8cpC”BÉÿ"áü¢ŸàbôíSHœ‘ÎÝËÊ8Ãùž-ß^ˆŒ¿ œ±Gs§Ú‰J\Z"§øg =ü<Ú™¾GÎÒ"ÎÀ"ȸâ!W@œ¬Át¹ÎÌDœqRŠNé]Óq®¾° ±ì÷ZG(9¢/˜5¸²`+ßÀ$pR®‰3œêÕÎR¿‘_<ˆÄÄüc4‚+~‰©}±/ìï0 ‰3®Ù)нÛž9ÜŸ-jÏDʽi3m«pD½†⌳_Ü.÷6nœì»w âŒíL§)ÓDœ±Oº5=ÄËû·lŒŠÍób]¡±8&äÐÏŒÀé"ÎpˆÌg\“› ˆqMqF‚³AFå¢0/ö™)ùp%ƒPœ$0Lš·Ú§(Í3¿ùÖ[©8éBŸ«£úô8‚ò&xÉI‚¬Ð#ßoš‡rNÑ0sõðô×c”Í€PèË8CŒqæÌ#/ò÷ÙaÝEA‘z7³€ÃØ…Kü.kJ¯ÈAµ†±å{jlÍj¼-È%iˆqÆhªf¯l3örÆY¤¢/Šÿ†qFü²I0U1^ö/bѾ4$oµõ¥Â8ðî 1{ ñ\"‡ÃË+Esf$fœ¡ãS¼±7kÏ8ÃÈž³÷w¿ +ʰ\ïï×" wä‚¿ÂÈà$²ôt††AÅïŸÆJvå°[l¤¤d¬ø’ŒI7#ZÅAŠ3(ƒˆæßñ8ÐÀ†-´ÆŸ dn"+$Ýh”Ô)΀–‚èý¦Šâ-„/ _ìzšÌéâ¦eø &Îzå…³®¿Â¾ š1%öˆ3œ‚2œãŽ@9¾ÚΣƒ6M×"ˆ†xØŽ# +`Ä”q¶…¾$¸3#S6àiÖbtàŒò©y©áÚòcœQäùô?‹>$g g«• †“à ˆE©'Tí#yÚ2=×p¾|g™”i0C3P*´ü\Y¡ ˜èò#pEt!Ÿwý]eÎHäì@а¯há–+¿¡6ðÛgüú^€ë¾¡U ôm^¤CùƒÜ +jTÍ©«þ8QÌß PÚ¤æ~3 òÒ­/–*›kivZ³à '™e_¶ãFæ¡’‚úðïæß 4ÕHÉr ²’("ŠÅ¯—…¢Ü°e$/áß „ª[‡ùÆÂ3R7…”JC͆3¸ ÀL˜Y¼Û Â¿ÂXeÀÏW’IÁnX¨Á«,dèãz 4a×Ãàñõ%ô͘­<¬Âø…ßf“ͪäD.­üzfÔ†@2€QGaR±o†²ÛØâuT8²pÝr˜ìÈÙ}}3’·š] G÷o.øK1伡³Âæ›1æÃêmKRUc¡S* [ŠbX^ᾺÛBWl|3"„D¿@ncÝFê1œJ`†‰é7ÙÐÅî7CºÆG)¢~¶ipÂxÂSô›¡zTÄ p ó›ÑT’ŸTE!€[~3Hµ,»¬0/ ÉoÀ«Z—_Xð'#ô¯ÂoôY–LéDjx_a +G©–ð Yí›Ax|®ÆC,x¯Pƒ}aû?ãç³¶Hâz}ž|÷ÏéúoFÄ€ñ¼’?£ûÍò>艜g6ç(?æ7Cf©s+?Øt×o†a–àt3é7¬dŒË`ïœcºŸ£&yIè6<¯eìoFuý׬ñ»Iß +‹¨šþ fWæûÛ%Ô¢L;xW§lwsÏõùÍÀðqŒZÁb­Úíj¾Å0JRÀÖ‡R|PÛá¤nÚ!*O›?›•œ¡ÞDè·àŒ±%¢Í- ÇnÖ‘œñÒr¡+²¼“PÞUæoư2b;«¬¸Æüþ›!ç¥Ñ¦.¡RÝEÞ.n{cð'ûºé%Áð‘áëlÒ·\ fh ‹È…[£«`ÞXš¯»àŒ·c ‰©ÿUbU@—‹ý½Qô|z«êz0à OhGy»ðoÆ4+C|¬¥5RpÆ1Žó#­ƒ30Ö]K­±ðÉl©Áàé3î+š.Q΢,j)"¤ÚTø%FÓ¢þ²(Œ£S¨é³z)µáœ9íHo[ú|@ßÛ—aéPÍÓ ˆêá$âŒ}Ò,&GúÏKà¨æ0úl‰3+„‹\²øÇSQT𙓓>ƒ_€-E½¥¨*˜-pcþðž¹ .lǼ‰õ;"!_ÄÌúL•ß ¶z> +užõEá…Ø2AUØ«°»ÞV²QrWTbUÆ%wg¼šª’™CêäÏk^()]ŒºÃ·xr8Ù¸‡3@ortã…Ô‡3\ï0o!SÓ!|a25e8CZQˆC/‰$M Ò­-aoZ8!†“™Â¿‘—, +hQ md +1y1ÙyÝÒݵ‘)¨Oýèt\™Â¢êè&‹Áá 3o×j6œaN¿yÅ!è-Æ€6øTP÷1ýhÓ+¹¿¿ed +-Ó¦ˆRb2b„á ™x:¢$-έ´Ã-»á ­Ûö£ƒÊ •Lá’¸›m°n†3€<¶x€T¶Ò|d“ð’)ðÕM;.UHÎC\[?G†ÑØáŒbH0°ÊÝi¯d +=š–3ë !™Â%ÛÒñ§×]»`X4GûB °y`àñ”‚8CµêvXBh,$᥀b5ßSå S[žÈ&%é’Ò[ +ð.L[/Ú›?ôè[ +Óq{r5:GºÄ?Z¡Ÿ6ºÄÞR¸‘M)8G½¶œq¿‡Õ4êÃ'ü¶r8K&9s¿ùta)C© sѽs½Çœ×]òCŸ’þúOAvu½Eœ‘tú…ÅT'ÎX)RK£¶ÚR +íè57š;·Œ<‹z­‹½nÆmKÇß#*S/x0új(ªl¼(÷ëigl•tâŒð¾5®¯In<g¤ ¸:þYùJªÒuk-…|³Åe ËÄíÏiMÛ¨Rqp]l¤þ#Îà5¸vÇ Cœ!_á* OȰò¼–‚³0èc]Gó9å^KA%L¨-ñÂÒy-…»#ùÜN­š¡öÃdÆ/íÜ=©YÄþCgŒGFõ;Hi¯PP_oÄpF"J.ÑM;RÔyþ†3ÜÈði>¢ÙóÞN™Ú{ à‰N¹ð :‚¬θ ƒÙ¸oFRÓÍ€„ÉÚŒ»ÛŠÍh]d{Ö D™?ÔŒ $£G3®ÆË½fK}f4KÉn730.3N´ÉŒ¥cÆœŸê·]FÛ–Œ,0ã—$ЂÝþ2¶ø—!'“e-$µÉÖfd'û¿2ÚMæ¬mžKËX–,ã XÿV†xW6KeH°“åU%W'[‚%ÓÉ>%Ú“M  ÉÜ ÉÉð8»É\F“QóK†ÍJ†Ÿ&29Y%’1¼#Ó=¯ŠrôdD ›'ËôÙ B<ÕAÆ#sŒì d¸ïǸ £šc'c1J“é:FÚRƹÑñRÓ3˜ÃÉ3Ò¦‘Ôó’1žJ4ÆÁeŒ–cŒç +c\{2Å#%”ñ\ŒsO6j1 r²‹U²X14̈à)ÆR‘¡QŒoUî‚c°œlúa´T%S‰ºäCbĤÈ*0b˜8ÙN'z²µÂÐAÙ$Æé1ÌÞ‡‘”‡q4O‡q/”¡à0þø†á eÀÆf¾P¶ðمaÚ³/ ƒÂPöXN…£ÂÀE¾Æ—¬|š‹' ´Šú1”EÞÒBsFÏPv„ñw(C©zg _ÙZˆæˆÃvæœ3Šf0ÎDs¡ Æ/CႱÅQßPÖ)Ì\n%Š£€#l¹,Œà Œ[si#ØcÁR¥#0Ê­-Ù†Ìa./À8@ƒ¹‘ÉŠ À˜AáEøØœ¿à{¿°d²§ú…2Ì/$†_|›lu_ =öÅ‚úâîóÅ!–/ü/<›l _iLöø^PB÷Âí…7±’fM–W;ê„ÎÆ\½?æxËuô"÷y!~Óõt²HÎÜ9ÙsødšJŸL–'ûÉ$eRó"U§y1p,Ê\þ“‰5/Vjlæ„Þ2gõr€i^È€2­*ô%ÞÄô'ç‰²Ê P”é(ŸÓA™2u¢Á †dÞ-™9J™Š²ÎÍ ´ +aÓXe +®V¦_ËcYi -ãL¶l‰¸Ìk¬Ë|L/“"Ñ~™°ÌÜÌ v³ß†+ÆÌs!3÷wÂ0S!ÏLÓ$ó"Y4Ã1/&§™W³n6óyÚl"€–›9a^ÌÞlH„AÆzÓ̽r¦”3µg93 TøŠAK@§l«3½ºÚ™ýÎ(^EÁó/93//Jä³ïÿ–•û¸ÿ3±¬ê}æk4h2ÐͽÕtí¯¡1ɇ +æÅÄüH4Jæ…æQ4»ESU`ô‚Ih¡é™/ýÑè*Æ~´Æ>Z>ËPH{êHÓ3/þ—4’u`f“˜|bUÕƒNˆ*/ ÊªLC^ü>Ú@ªÙb¼(¯iŸ‡>tˆÃ‹Ãé´‰^”JÙzïÓà 2Aí»v ¡†¢±ÒðâÏ¢öL 5½1¥æ®LëZ6!ªÁ¼©6dUÍ8¼xõª^à³ZCƒ«…C^Í*krÜbÍ=”5ѵxÀ´æÙkí3Üš÷‹_yCIø,©ðµ\3†¯3áš,¼`çÖ>rˆáÅ2°µpx1>­Íýˆ–ð¬-*kÑpuµá—[ÏZ€‘†+kΫÆ%. +fÉÄÍygÎáÅÆn0Öþpk䌲¦¹:kÏQýWŒ@`·5¼|Z£X7ØÏ)¨ÜZXºøð¢K¸f!¹¶LŠÚ© ^œ'®­¤NLâÅ.B3\ë2¬:âEÌ®KhÌ/Éxáâ¿‹Ùì]lG˜ÝCÍJ7´pmcwñº\Æ]µ]\E»ø…ìÂï×…§®ÍÖ…äZ]ÀºX6] Ö‘t!–®µ]<ô]HŽþ\ÈŒ®UعؖIÕæ¢T‡ÌÅtË…¼”‹#Œ¿-Ñ5‹‘¡pÔà—Y¸÷< »=;Rë‰Þî.=ʇó¤'òB¶yârÄ$OÀ—¸’x"€âÀ×TÜpw.‹kn'¢¿–y©K5 +1nã:ÜŒ¡:‘^ãÐÒ‰78†ŠO¸<Î.tb÷qo>AN›†œqµÈ©Ô¹vyä,ÉI®&…NpåävÊPNÆ0å¤W•cÚ+WFÎr4ÁåB‚—C'¾s&£˜Ó…N¼˜Ì)3çØIiÎyášÃU݆NðB­úš#)-è:¡ i.lgÎÂØfNW¶C'Ú#lú1-%s¦Gæ‚×ÌiD'ÍùQ5çÏæÞªD'ž7·Éç,ý8B9×9PÏ5KzN7t¢äs—Ð Äös> k7ƒŽåWè–÷Ð u¢atzè„‘£{DHg ˆM‹u»ÀAÆùf²aN8žœ(PéC'Ž*2œH2逃ú&î&âM$‡nBs²w›è[›À¶ÙÄ‚ØD安ÝBÙÛ¬‰hHǨš8&Ý5ÔL4&hCWP¥s¡‰]>â{&˜@âŽWñ`Ò™bU:k𯙍r&®^ºéU:ᥓ[¥óæLl›Ë™è~6­t¤¦"¯Ò o& +)‹6¸¸™Èué ÎÌL§7:Ëtp\2ÝgÂý64v:ÇÎ傜‰ãŸn7&6ít;ü§+/”¬Ì™˜C@jŠf¤5ÎÄ"£*Žæwº”3‘½O›ÎŠM—mët4ßN—‚/«9¨N‡€éq&¶Øt­œ‰Uä“çL`œæ@%]õS Ì„ï6Z,ȱ蓉­6s21•”xéW"›î L4«™€`ü¯Ø‰**uÓõ2Eç'Óix¬=©0áY ÁAE6óTrŠ(ðD\ÈD¸Nÿùé\ß´4ØT©³‡Wø^`zU7 …Êת Î¦C­3àºu¬3×yé]×–Ù÷ÚЯSÑ`Çú?ì쉌‹þAv"zÊ.[+|}‰L(ñì R´kðâ´›&Z½‘ ¼­»ëÈÄe‘Rr»ŽdâÂ2ï¯V˽ÉÁ]aÀ¸ó¬Ê]šd„dDÓsuÆŽLt쯻d×]9-[wçøãA"¥]wž‘‰GAåc80n™a É‘ à„Lxåv¸Ñ ï/ïH¤Þ•Uu…³ˆÎK2ñÆRè¼+P¬Ý;ïºTdcz~îsT2¸½«%#¹w1‚ºw4 2±éþÞ»™ˆ5,.J½;GµÑègLï.PJï"]`ôï%Œòùa)Lx­.˜°»3 w¦`â06êó΃ +/qÑ‚‰w•Wýˆõyg%Åü‚µáÎ5˜(aïέntÞéUBÚt—0ʵ_¢X\¾Ä>½Ä›)¼I£îHÙQ¼„´Ê÷tW½…—X>—ž»LvîfFPcºsð9»ß%&¤;wµî´w‰¬¶;BIÿîxEäݵDÞ=ˆK ÜöNò–Èä;Øl‰kß­ª%àíwYh‰ð¿˜%.Bà ‘% "xb‰˜ÁÃ%.ç®ÄE‘¾ìVâä+¼7 Þá*S/¾U"6â¡Z%n'ÞŠ*~Å‹JD0úSâÓx›ðr¼ÚR"Ûã$%Ž7l”D#/Ð(–<QâLˆeÄ«ÑáôÅÓJ„ƒø~‡ô$zKï:‰XœÄC*TB1—<‰$ñ¨ó/‰¡¼- ÙV/”ĶM –<(Iâ“$p ¨,‡’Äet»s]IBìtNÓÒ ‘ÈŒ#14ç‰ “+#¾ä¹šHLî™HXÅ!' Ô!KO޼– ‰É]«rE‹õBžðu;’A‰5þâÈ#7?™CCùËôGqÚìôõãŽ8òãÿ’G½#v•¢qXrâ5DG_kE½0yÈ›ÌO¶F€Óp„“0}#¸Ó¨eª›çA”G"#¾„X©¸œl‘K# tñшÛil·Ê+zs'¨‘žâÎE'F<*ŒX0¢/âлˆþ(«¹ˆU +MÃn÷Uíkg aSÀQ Ë"6Õj6Ê»°ƒòÉQþÝ VDÙâS¾<åA’Ôä kÑZË «P„iö‰8¤N„ℚÐTiC¡„Z"¢D”Xš¼ÂWá_ ´x6’ˆ/·xãQ0"R¹."Pü¦N¶ˆ ID̤ý=ŒìÃ…¿ÛúЗú`JúpÉßS Íá|P¾|˜¹4C9º÷«ÌÖ}o/ù·¿wËþ÷:õ÷\æßË&p$ø#N>„ùïµé¾7òÃïÅ3ÀçÀ·Ò³ÊVð5ÊÀÿŸ¼”7Á‡º O>ôðñ58¼ãÁJÕzžvøHŇcâ#>L_|C~ãSÛÁgg‚å\¾Ö0“e¾à }7_æéÎǃ`ú* O‰ÀÌ/$úÔà‚“¾4à`pú§ÛºÔ‡™æ;@ã°ï¦àƒo.Â'ºÓéËR»¯Êzï³ì€Ÿ°ðó |¦c»>Ü:~#Á‡¢Éo®à +̨œ_¶…~"B>ÐÒ/`\žÇÏøPvýJ“§ÎõíGrÃûa¿h窟§“¿4à“óî—îÒðaßõ·¢·?AÀ‡=øwÉ£(/ðï—“—¿Sé_oÿ*Nþ‹í?•í?, ¥¢±€˜hÞ;€FM€ý~»¾kÀNìþ= ª4|¬)0ð_ö¢p|ÀÍÐø"È€´‰‡/èîÈ®´mù!Ò•_!àTàžOÞG‡¥ØÚ+b××¢ó{XZë9æ=¼¨{ЪÀ.ÜÃ|x¶óùsûÙÃ’±‡ùë¶õð]\=¬Vôà¶±Ôä*ðZeæŸæ“{ý ‹Úˆö…þRô@7D‡zéÐ=W1´Uãáø†jyh-ʃɃ»* «‚S¬³ñàØâáHø]úé*PYOw‡®ø$x ûª„(ó;¸ +¾Cèy‡Ó8ÞÞ«;üfî°î°E+A"`W AØ+°9סóÙA ¤–æÐjì𞱃Fz–ã:$Öáš ´¯AE³ê®S+ÒÔaÙ¨Ãÿx:ðr¬M£Ãè˜Co‹¡t°wœ?:x·@¶è°·¡ƒ5A{û°WžƒÙ7ƒ‘ÒÁ9lͳ½à5×d9s˜¡¼ânXȳâ©, ŸÊÁ¦ ÎL‘(ÊäŠClFC rxéq8Ç:4¶[àÎ8Xl—Ç-îU6¶&ÜC²%ö¾u8ðÌá0 Ãáñ ‡AeÕiVÅ“TWSp`-pxN€Ã!Ãv>Þ0¿Âìa­=´2ÚPQعox)Ž“o¨²ÛZ[Â(}‘Éôª@¹Ý`VÞB¹PºAŠ^Á>®š[ #hru8Ì‹-°Cqì+m(ñ60³ÒÛ†¦Ùm×ïZ ¥Úð™‚×Q˜àèMÚ,ðÚ!gD ˜ wx' d¥=6D}T±¡× Ê ‚ òk›×à^]ƒ~¸¶iŸ5ØY൱3Jõ\ËËQ3 ²}|ÏÛËa†Ë­J{5@,/^ Jí䈎#½ÚiïlÁÝ«Ýè…Ð\^ $­X`Q¦\‰6†qÒÉßÑ99/ t£d4a÷ÀÖX`úˆ]ýJ£›HÀ÷ŸÊ?üÂcæ¸Ü²«á樒Âm*#HB}®PWCµs5,¶CöÛ4‹«]Sè+(’yê +ŒXjuû +D´+Ðb+PÚá·–‘Ñ0ÔZ[T3,àjÀ¾E] ;³üšîjÀÄ +D¦‹V ç®@Û}Z÷rª¸k¨h»^uº¬†M>E†„S5œ2àJªTCûˆK §`©Á¯+p*5(^J ´¶#HÊF¶Ç+5pG l‹VàÊ«HänÏ +¬P,5ŒJ©áÄlj)„`Á +tfᤇ¹Ïo"4$J š¬MjàïM¥ÎRCø¶aH[¯_†J ËáƒRÁªâxåS&à…–ÌÒC*°› ¢ÅuVj0 +:ÔmêRÿ‡Eß§ +lR¦†•Rµ“ +ÙRSƒf¨½˜¦ž=S-à"Œ…çódCÔàðPCSÈÄOÃÞ§gø¹Nh:NšN“kFb6³4$Ò0x¤¡®Y|4t¬ÑðÁ¢!9¢!¦NCÃq+Ð"4'ä +„¾_Ǭîq÷Ï·Õg8ȱg˜Žg8×Î ãÇ+𭟯@ Ñæ¡Jä J5·ÍÐÞšá"Íp"73Ô+$3$%føÄ ¹3ìü2œ»Ý×eÈ>®@¤-C³e¸–á(PÅ>]ÄW 22 õ]Z §þ¾ÂwÂൃ;ÿ õ÷ þ" Ápè ¼¡û/øè/à®_Gü‚7û‚Wì_à) +}• k”Oüì‡ï{¡U{A8Ö ‚úËè…7v0PvEÕ¼° ò‚30/p¡ÿ.¼éîÂvÜ.pË.X¬ë‚~ª Ò``–.l]Ð;è‚xœ ’— 6X.:.¸À@Å…È¢iKœÁÀ˜V~ p¡l<ÇŒ [¸ \p‰vmKl‚¸‰•'TõfðþçtàÇ^QÌKàB!àÂàNÅ•~Uˆ& lDàBà+.?8å[€(Cá-D¢S#%"Qð¹òÊÀ¾¸\º…ßo ¼ðÝFÿg¢•ÂÚÛ6|[`½ „¿¶ðCç˜-VlAËkÁKiè³¾0"›ظ¬…(ý5Jµ ÄKÝ Ç´€=Z01´àLŸõš ŸI¡fáË Ü5 ò‡Ô,4ùÑ|ËÀžuÍB3¶!v»–F,Ì@¡6 `W« ºe`[›<3ß,Ì,Ü.é¾ %NÆ9©]ª2p~Ìe!YsîIvØSvY ¢ RbÇÀHrÄËeCi©ª‚>¯Û>ÆÖè,Ÿ6D0 !/ÄE!…YÀÁ€â <`üÏ@š:B¥0 v–Ñ@‹ º²)f!:šf¹SB}õÄ,´Ã,…eÁ¾‰Ý“ FÎz,Ðh,Ü_±0š "ØhX8!‚Á‚~,Ø&À þœê+,Ù+H?^árÖ®€’h‚ˆ.é +^Ï €ˆrýà +XÜ +Z¿V°™Vðí¬ MYÁìb`}yä^¤““W5³ +v4Ð×U!K‘ªÂ3ø¥ +Ÿý UpÌ©0XÉÊqR¢e +4HßQá $)*€6°Z¨€™@…Õ| +\á)ÿœ‚7M5å˜)8º äl3Í0Ç |¯KTD@E.,Ý)q<)n`r%… #oo R¸)HÁ*‚48 +°œQ0nàêEÁîn`³¤ŠB™2QXDDa¬óPàÝÀ˜¡§BaÚD(¨ÜÀfPXAÁº +b˜œ…Mý@íŸ ðm a¸šËý p˜Ÿ ¦>á Â'|Ÿ nózÂ3ç Æo<^ñ-y'ØŸ`nu‚ÓQ /t‚@˜fN8!äýà r¿ òÔMбM`Œl‚Ó­ ¾m &5ṈIÆnàh‚Ü?d› ÞÀe-žÚÁ°,n#¾Ö˜@1áC˜pÒ ¼½Ùv Ò"—Ï-ÁgZ‚ÛÛ«¢R–U4³Ê‰`J–€=ÊDYžYÔ9º7°O¿±,Kˆ‡þ„ÛRYBòÈ8 ¬7pw¼,¡çsÔ³4ʸÆäú\£žJ–%[̶òºykÞ7Ю7PÏ,áëßÀ/k–e f öö7Pœ e4]–À­,a,8l›Ë +>°àê/K°c™²Xá °†Kó­dãJ°ƒõ*!œ©ñˆ~¡”àº(aTPÂå tž„þà$ÀžI8Ý@ÉKBwU,LNo ?$¡áq”줌ýÈš"AQ‘`p!aé !¤5HX&pr@Â’Ìô?ßÀr>uÊP8ú±ÜÚû~„˜ý=›˜È8°±6N'†û§~˜%¹=óÛG¸Ø*~÷D`›Uv<À°4*3~ËoÆîêGø—7o‹cÙq¼›Ù qOÔZÎV~âîÀ\YŸ±}ý Ømêfw F® +ÜÐß*>ðáüuéG8‰Õc?Â:î¨P +Í÷ÀG`x„׺ö@¼u„ 0éçÅØ!Á>{yh¡¢á/˜{ Iµ]\ÀÚNq>OP’¡Pµ:zþs:@㜶há4ÌaƒíøÔL•™™YQÃS…ùoáo§Þ.|ª9ö_™ŒH)¥”RJªVC†Ö…#@Ѷ n»hÛgÜœgínÚ½šý¬W˜UmûSe›¯Ç»ílÌÍ×kßßÚ¶×m×·ÿí[WÛ¯^ÖŸ*ës~;?ëE¶sãóSÇ !‚'ÿ]Û4ßÝÜíÿ{}Ï~íWO쵇©«ïíÆ·ÏoÜká[篿ÎÅëWß宿»­2òw#«ôžõ}¶ðùå2ÿ»>ótæe¬îê~×[ºÚ–?^¯´Ô]+5_Åû{í®;W—"*«¢¡:rÚºÚº1û2ëZ®¦1k2·w2ó²c.ó[.æyªÞϺ½ó-ã÷4ïÓum+Ï”mù­-Ýæ]Ÿ*¸þ^7s}Yb£.ËÔ>sM´äOWÇô3·tÜWKÌ^Ÿx¸®õÏQõÏ—ãjçë;^¿Ìvzëֺ˶óõk—¬Žv¿r០+ê.teDCîõE\CO¼[ù†½ÚpQ ×p‘{ÅÕ´µûÔ0™»?-Ï—e*Z®æû[úÚ½³õˆwg«oûŽs×r_¶Û.³q-[NóÚ«Ÿ¶’YQ1ß5—Ñîûõ±-=5Ó=Ó“9×ÿVòñÛ¯­ì_ëm]²s"fçRÝÔÜÝ_{ëܼå×ÚyÏÜ[ÿSÕžŸk¹ã7æ²ûU{¼^ɺð3÷Ïîš—ý¯üT­_öýgת¶íò›QÓîÒùÕßV®{oE~{O峕Ÿ*µ•Ù»òósݽíã7æzìîKëN·e~nëSµ’}Q׿]íÞ×÷ÙV=séúê<;Å…v}‡›ŽëñŒ?“Æ®ñÖÓ8Ï8ó?U¨¹¾¢².Ý”ÿ´QñV{W=uÉØûhËíüËRŸ{ û¶U 7—á)Zâ§ÊR—z/S]Aü̧Áç¶ÃOU†ñB„Jê;?Qý/õµméBûÖµï™Ê©°såïSeýŽKU!D¤`‘ZªMÔ\·e§¹«qómsóÓ99‘s—¶>v®Ïµ¹4ׯd®ÏO×užoxú»j燆š¨wªªªkÈŠªø¬ªÂn¨jˆš½LÝR%WÏVU}ßVUQõõSÕš«;­uß´×z­µ5?UÙêÚŽl®æª®¾ìæúú©z]Ú|»v×ÓÖí©íÚ¼åM»Õ{[DCîÅC[{»ˆ¸Ÿ*5ÜMËýTÉ»üÍÕ[jºûkº«‡ºº¶Ûj«·kï¾ížï¯é[¯¾Úò.¢ÞZ/.·²­îªéú.æe·øn}±ÝzSÖ;¶Ý;dt´äåwÉ«Wt-ó|•™?UÊŠw—hš™{¸LyÙ*¿òßò¾Ÿm¢g㟯߳i¯eªÜŒÉ̺2-Óј9“Ù˜×j󦛲nã¯OÞ¦ißv«­V^ ¯×öšµ—±s»m/¯eöÚlþÅw¾L[ùÚ×k¾­g@GQ=7xãS4E ¢'daÃ’T¨*ЭVà Q:ÁÈ“r„HY©DŠ +› ¥¢'£¨£(5DL.ì-½ðB§884yÑÓƒ‰LŽNptAyaÇѪ'G¨"MÈ "å„ ¤™CžPÔôX( Pƒò… –¨^¼` +¬àÛB >Èü =½ü9­À ²Z5<9@ +.ð,d[dø¡EP|xiŠaƒ +endstream endobj 18 0 obj <>stream +&0@>’døQ¢¹!´BÁ‡(x±¡ÉÅ ¡‡2=˜°ì-éÜ@zªù!ÂC'hÉ…§èI‡¤°¸ÒÔ-3üPb&HÒÊL¥6BL77ŒœfìY© ¤òòCiÅÌ‘“‰—R$à‚†%,#‡ .Ðòà "K'nfXRb&<ààzjÁÆ&5=–,0C)ï PD˜Q¨¹¡ œÜxaŠ bJ +ÁˆH‰±A´š )$b‚šJ€ÑAiŒ¤/4Q nB ?´èéDD’Zè%±°3D‰ÅGˆR ‘¦?CN.ô aBÁÆÇ5tp2€påæç¨ FN‘ +!% ¼üH"áB¤i…$¨6CJ-l‚4YãÃÉ +;? Ä QšjbAgˆ”$X„áˆë)XvXF¤ÔS¾R †Ej¥0C¥h+ÅB(°H™hq‚ŠKKLË „©K=À!Dä¸ìè°¤áÖZê +{w§T1Mõf„Ô!>vÛúú}®k³[ºë¯._UÅõ¦éfûî­îÙãnë+-R¸wݽº;Õ¼n»gRøª‰Þ½–½v§Cˆ˜Ábo¶\~«^ô¼Uj¹-ŸÝ·®F +3¼¹ºS‰î"|R&R¯Ëª!bEmmwj1ݽU"NHiÊ'µh+%“ºT‰Ô…a"Å©ÅÎ_)jBˆXi]9ïC7åîT_j‡åDjFM -8‰@ø"V4:M£{³±›÷gsšö +ÓôÂuä£ù[Ý\tËå½Õã´\åÖ¥ºª·²4—²¦®žfžŸ%gr.z¢% ^r"7ZÞq&_cnÞÊþ¶Nå5MÕEmG7ÝËï´sWTCÿôf_9^ötugçu÷fo÷Dcs_Æíë~›ŸªFsægg]{÷Ó³÷¶wß³µþÝöÛÖñÒ·ïÕÛõ×°‘Ÿóù•?™ÑõSÅúÌ ×YùZúÏ×ÿж×:þþõÿ|ÓÝõÿtóõÿT鿲)ê­¥*ÛO¾µËQ›Ó6÷W{õ~¯&fYÒ5è@aÜÀdÅMГŸ!R*ð2ƒ@‚!ì €P¡¡CRb„0PóCi…žD±@ ¡’Ñ20ƒÃ’ ¢¤ ÈøÐA`ÌÐCËðÑ4„V-lŠLqqCô´¢fˆi€€ñ!JÒ±i“㇓;B¢4`€X€Š|hQC”ăÇÑrr A™ 3ƒ%(ÁX¸!jÒhpb„6ѲcätósdŠ H;°¡Ã*¦çÈÉ#«žJ p~¢HÔè‘‚ ÜÀ'V d—š1(RØ¡ 0ƒ"´! ‰˜!Q"ТG!h  ÌE XpŽ˜<°c¨x$ʹQdIÇ#%!¦ ¸ibaCô$ãsä$³ƒ$*‡'?˜‘ƒdÊÍ#';Žœxì@‚zá)Zšá9òDJ¢dè%­È IAA¦HIÆÇ( + +:€Ô$C GžLƒ’)2°c‡¨8”<àžF°CITÆ c¡†$1n˜fzŽ<õÜ@òDcÓO’• $N;9Ššdp ‘"Ã' +Px =ñà8z¢ù1zš±aÊ¥§hãcEFSŠC+ ¡':@–TÔA±°9ŠbaSÊE”Š›L)n€HYq#´äÂSdµI¢bà‘$Êæç¨IÆF&$(ìPƒFP6@DM- +¹Æ0*@@Nñé†XSPãðÑÎLìbE” ùÇÞ„vÆx‰<\ÿñîÆ®yº°Í>MNa¬¶¥UF½œqÍåS¹ÝkîÃݲš‹äDšØtx 7mS¶â*úCˆÝ~Õ7-Ðæå½p;ðj››<š{M홀ÂzJ šàw°îÿ^d¿àyqNŠ<àôG]›¦Ý•-Ì|—´¬+*™óy Ik¶œR®ˆLØÑÖ+ù ’îâY‰|—n|¡Ð¤ÖÍà…ì¿ÓôÁÕjš ¶=;dŠeIð"Ó}È~ÞYöœ‚*+z%„©™zΪ#^†šFfbµÎîx¤f…Q¸ØØlq œÕ²ö`¨¼›MBæêò©Å4ObD¬™Ž fØÎ`3§™ÛG7°Ãºè& +¬´3 ‡Ž¯ì$"Ä +¦íüç +{ž%3"Q'}¨çág(Ñ[sq#Ñ6{!7MË€&¦(à æ>\¼ öG’ÂÖM´<›{ðÛ΂êŽ4<®662 öÈ(° R«IKóÔ&É0Ò!…š…v9Q¶­>0¶nZ4 ‘ì:¼’-j,\CˆV0ÇhO +³°0rÞ7Œ›ÆAhU˜­bß«;Kºsñq±#OºÚêLâ^¡É·÷BI‰ã³¶ÁwÎÌÖV¢‘Í¢ð?`n²¨“nWU-d¤ÒtÇ¥³l 0¡ÊÎø7{;!øF† F LÏÔðM×µ6ßtE +”ÒOÚíýi-é{±z¯%¼ÔƒL´À;Z—æ7I^&zO5éSëy{0æ d’¥F{ûIÂC›^‚ ÝW0ë¢ùÔ­ìBg )¾É€cZ‡e” bUgšª-˜%GVžJDÜü|eS¤Z0©YLo¡\T$K:¢Ž8&$0Ûüµ\ñ,Óåêµfó>LÞ¹Ž¢Ê»-ÝÐ=à#®î‡Ð]À­`5ðĹýšˆÔ5=ÿªWGUü=ÄûJ ¬7HòE0›v¤ˆöÔGÇÃRÐ!‘ê¥Ð-ƹó\} ¸‘ZŠƒÂn#•SŠÓPá3¯Cp[‹§wƒ^ñ´SËÉæòYELèßî'ÃyL0Üšy”¥ƒiz{nYmûÁŒ1Í ¹Zï›]Yißr¸‘”ždQ²Û)æi¤; Zßþ(H3õ +`ÐÓ`ŽÅr{}^Í{Ðä»_ïÙ«{3€_}Àä÷Î>›¶Ñy÷ã„ÃãúFµx ý¾q®Ê eÈÒ+çè1ü‡¢ÅêØt:@O–KíÄ£œUÞ/b|6kŽŸ<Z’Ñ•=ÝÞ(ÔÑë~Z˜r?ãL!ßܸ„iEô¶HœPĦ`ûã^ÄC»Š.N!ºA‹›©›ú:MhXª¢QES¦L&x&Jþ9ÁÆ4¹´˜d¢Œ/gÊâ±1¡ø]t*t¡Ìû…’!fm!1ŒïŠ\ìjäp§¨,HÒѲÜ`Ì3ñß=ÒÀ*\9ô‘àN¸›VýßÙ¡€ÖÚ-x•ZkxÆ÷‹¿TÙÃRäGÑq€³d BÍÿíݼ;Ö’Šè5ŒW'Ëãök‚}ÄÂÕ°Adø~*Ê'—Š‹ +M´Ÿ.çÙ¬sØ× [.ßg…¦¿¡Ñæ–+<5ÂtP’Q³zQ5¸ «T^¸úͨ«;À\ÞHÝ'DÅ›,ÔȾ¯nT¼¨ .+UË– €fcˆ€Ø„€“?p„š§è¶{Å;­çßñL +"S¥½WÇ;emÿ¦€‘&“@Ȧ‹2ÆYÙ¾®¸ºûÉ]œA“ $®JÈ3fªOš<ì¯mÄ%ó,‹ê1êáußF–Í>kÁà"¶¯¸¸Þ«×¡”Öj›œGÖ zÒ‘ÞÁµOë™c%Ò+Uú^’W¦ò¸}\”ѹ‰ÌrjÊ +)Ú££ç½SÍyŸv·.W!ö{]ÀW=ûK;O×a+‘Ôho®ªQHëQcó®q‡JA‚:ôw·`CÏÔÞ¥/2§øiœDåÒ°žÈ´^§–=Ɔûkÿ `OƒàA»u¤Ä_¤‘iC¢}jd} i#öì=:o;ÊŽFVÁH`tH9*Caz#÷*—bsDã¥S° ‚¿cd0a”¶$¶ûî†Ï©ÕùkGÐE ²+¬ÌN¨%o–†¾UœB±7yáò[’u޶ñP0Š|ñ¶BP8˜"KNx lz7Ç’Dè] yÚ+vä5Ežê•o §ö>.ÓÐÑõâXȺP[œLVš;ò–W9¯MÔ +”U(Õw +¾' Øà‡µ¶û’ÉÖÎ h`â€Ò—öv €3ÿ’Nƒ54 —úß źŽ@Ÿ°0¨99‘‹{Zÿ>ýÿ Ç®£š)¢èUF(Üü‘Öœþ¤Ôé˜F%Ï/×¹3ÈÐj~h¾Õl>öÑ6Vóô|àa@’ë[cÚK]˜íN Å?­Ùª´?ÜÚÅÀ–e³ù@Y5–ŶUpÑê€K©”Ë9Èûî°·d‹ì€º¹ì3h*t,èd…)Í`hD¯{‚ôÈ{]ø$sý„£‡t6ëU;½Y^Ž!úó˜!Çüž®û›µZ¬Ùo!%ß„2yöœ¾¼÷ʓЀ÷ÖG1]YgƒÓÉèPŸÑDÑ6øŠL^ Qêc[ÿ`I´q-ê;ÙsÑ^w,â³À•]±)êÓ‹1 ì£Ñ3¢²Ö°”< ¨ˆÁ0.ôÏ]È[@Wöˆn:=®9ƈýÑj`â ƒ·y6CKzè1¹7È…údyø[Ž Pã,:¿J€4˜w±dï0{÷\èWcF²’Žu6ùª}aÈ÷ –¥ŠÞÃ%ÒiwZÁkbÁIyÏÒ“”~%§‚Äeì)Öþ#:;SÏ D7_šHØ2‰ç²k?M Œë3Gí=ŠŸÒÅðµo§ˆs¿Yy‰Çìâ*ÃÞMÕ”éîú®u‰åã3‚Ó•u8bT„ …–¦`;ºný¾hÎ(Ç{Õ|«¥%Äš"_*ÇM[%&±ÃóꌪÚQØÝŒÖeÈèø,H»ßD;˜0Ëlþtùmò̽Ÿp)Ä\E¡5½¤šÓAÎoͳ,ƒ&wšR´xWÄ2å®ÏhåÂå¶ K•üQ^‰ý£RUî)í#Ëd66tDdtÏ +“$­#vL_ös”þ8ì‡à†õˆ¯8Ã…bp¬›Æ3£‹ÚÖmø¢nƒŒ„Øv€½÷·ùh¦Œ¶H–ÒYȺÛó{¼ ?ÿ|çÏ…:ö§¥0KåP‚røƒà㉿\€Öy¼²(4dà&˜»nazâ#JvSq§z×s:KB—uŒ*>Îu\°:Î>Ʀ*oÛf^gpuÈZÕÞô ¼êç;ËÙUÜ8Ð%±Ç:̤Š>Ù!Ž5¶Å &ăª&#q©Üa¦ ++ÑòsDK¹gíhrÀuæA|•pDämµº¢Õ|` D*Fh8°öm +…QŒ‚—Â~atamB#ð+Äâî´¦d˜Ì2Hô­ƒ(± B‘&t~˜²’LB™‘¶‰:áê׺º_…Õ«ûçÔoÛ0mÊE.9;,ecæ¡,µ21ùÕ5µ-.í¬ô¹)Öü9$6Š™C6öI¯ôÊþ;¥&ŽÝýëmîqù›ktë C}j¾BÚOÅ¥™YsÞs +Ÿå‚dXÕÂj0¹S;Ù¦m1>ŸDä9Š.á <UB^PÒ(L:v3!úÇ¢ÉÝ›AÐM†1&æŽ +Ûàûÿq(uᢲž'[еG¸ÐÓÓU¸h_mJ…¢u È 5¡(E. +›=Ã|ÄÅaë°Í°œÀËiù™¡7z§Ž› @šDzm†žx±†-RÖ´µ0¡õÈë´R8çëÁºÆiÛE©è½=V§‘÷ê2–f€<!d¦HÖpoˆDö §Û{É?\'Å +‘è×qíAéâªß!°³¿ý´ +H¾)6Â-¯1¥8Ò“Ø´7#pmoÑqõsMj—7’Žü»€ nƒe¿˜’×½UUÀYDôŽi’µY ý»>R°ü³¥×øn—²„Æ…:^ÌŒP'µ¶Vˆ€¡y3sõ{`.³iÚ™ :qžÝ e8ð¶ŸšÀÄ)’kO7pfáñ g£è~‹¸¾’ø©UÅŒVõüÔê?*ðƒQ[wÒ )ÅñáàL…<½;‡,”D^ s  ®ž.[…î»Ydãz·Õ"A¥°±ü­f'®6y„`2t+´Å«"Ü/ /9¢ÄäyrØìfxùÂd­@9à å«q²1‹¨/Öu37¸C€×X*Õʼn¹ TtåtG^ +±ÏÛ”ïÏŽ)/n4ÅôÓíô¹Ül)nìà‚ÞMæá'}qÉ6^|؈Âñ·”4[Ž ©pâŽ5¹„|†ÿ¯>²29=¾JÅÙµn:9Øé`tÑ¡–Ö›Ò² âÅË×Gî€ä3ÑÆ5*òrµŠènPF/©@q¹Fkþ-¡›³’4òâä)±5%ÝÞÐFç¶õ|3Èä $ûòoÍC‘ Úä‘Y1€%}Û c!³ôn‰.Snb×^²ú]À©h™ÉAù.ÜØ[¤Ä:{·"Ü{{2­ï;Áz¤ú[8MòØ.aÓ©ÿã '·= hLynÈèù‰ÑñpdAçÛ,o/P—à ¾6*¹×=Nb½¸‡—4#'„O…3²f’ÿáÍÐbx–ÖÙ©ÌÇ\íÄ4b Cõ\q ÛÉY6šækÁ6LKØÿÁˆ†ÕÐëS«‰>¿TýPœk¿bÜËñŽ2xú’â¸+F#*§Ì%˜I©>"ú3wÁ;#ÖҌϹmÆ[À”•ó„Iãø f\äªtDžO7L/×.ƒøž0œ l¼P<´{Aç!ðä’Ѷbª€ÎÓ´]hÚ¨PÎê‹vPAÍTUòÚÜHƒÏ˜q¢ _¶PEYVf”a–rZ¦Éâòü¹* ìù 25l÷à´²lXý“gTØ2Ý%Šp£b ÛU‰‡„Щ=Î÷ù”9?0â>ïEBÍ8†¾iMbŠÿaÝ@.6›×ÝqoZV*xKÌŒ~ˆPМÇTëáÎ_DpݾIQ˜Ö!”Êù†ñ0ïÎ9«†™Â{‹ÿ˜,†»ˆÒk Ò´´ÐÜn¡•³K:3rÔáKÁš}¬-Æx­ë,o“ÏB³‹’ÿrýEñÄb«­Bδä†Å`âëÔ+âªÅñûFº]jžD%v?OµD­aiˆ79ðx7eèž3WE\KÞ›:QG(m4¼Ô<ß_êŸÙàøÄ}ñ‘RpÉðÌj%džS–ã à %thXvŒþ"ìvÛL9°¾U$Âã-p¶¹÷„Éûgðí\Á¯G½L½ˆö÷¨‹‰‹nR¹kçìÆ"ˆ~M¾ ÆŠEÑg rÏ+Ë–P·O>7 ù‹öŸšE¹#ô4‚ϯ µ~,9“5¾7,F —wã?‘B( hÄGÐî}B£J¢} LÉ„mvK“ù1Y_d܆Z‘›ÞN` †¶aî¡GAÉœ¡çÙ‡ÄUxç  Î€øÀh‡“t_ŠU «Ü0šÈ:ð=q›| ß(÷ƒ¨]V™1¡¸€á(a® sb’†ç/TT€¥Ë#/\Ê)‘ƒ@&òŠèw‹Rð]á]ð6„SPhÙèåTÖÖº ~xÒ¡þ2S¶Ÿ0‰—Ô'b§?2eKÈ)÷Y“–*SÃÔ᫊|:ÅNÙ©R}/;o<Í΃2,¢N§õÓÀÉ{dA“¾’Ý@ç“I·ÂI ‚ܬ¼§£Ô1§f02!øŸê}Ì2è¤?ìo眻Ò;:‡!…‘éeEâ¦ÌBƒ­Gí„M»®›Çh¿Ï«ìì<žjÎðÝNEîgâßÜ)#tç/\)؉ªÃ¢étÑö¹«wtá›c>þP­lŸ êÔï}ÁŒ&Ïõ2/"Ågƒ¦;¥ã:K.`ªM4÷²zEœØ)ú›ÝqpôñŠÊt½E›îø˜NŸßÀ™Ã²¯î +:]ÒYD#wÇ4Øþ„ò”!&²ft¿9¨žðßJûË˨ۂB—h}^[»9ÀmäeRÉ$ŒZwüð2ýÊÑÓ^å×§µ\`Gì`iv3Ü—´·á¬~‰F]‘«ã;áÜwÊ.@¨N—»6b¨½F¥H¾”?Y?¹ßÄY²&G ’r`•W ! +^RìÜœ¦Óã_k0R’íGOJ¨‹òyy–€¼MÏ!"L› TPß½GìÊ?° ‰3±ë2Öâ$o°ˆãÖ‰ZŽ~”ÿwÎ\·ÝÀÚû2¥ÃDá)ÿÙ6‹GY#Úã+ŽÍèp”’X˜s­Ù„VêâÕÊѵjþаˆŽ‚±Ë`°÷º[ôÚ¨‰´¯¼wb¢¬ º|YJZ´F §_›)B¾W›,â³d?‡^ ¥ß‡Ä»Þz•Ù` õ‘>BàäÌp-x‘Kë-Tuù²ÒŒ.›vp@ÿ€zºâ|ãD¯®&òÚ¸SemÛ,(CCœ:ÙÑ»& +Ü[çÉ-zÃ(ÜŽÞn‘AÀ‹ÔEî±ú'éLŒÇÐWrƒ+§cê´ÕMyC¿úôŒ=œo 7 +XG׿¾ èÔ+|z,Q'¸.Ç5¶XdDzŠëí°3U­ 9HYŒ›‡©‚ý…{ÆÑ¹a%ØÊa¤æY;šìx|œªÎË?p‡zæ.ìšÒHµ¬W–âñ Á8HW)dȵ‹Új1´äo¦° øiïðC½À$ñ/zŠÌœéËaPèš—H>zv꓾p6G.½6³ÅOêû4-‡)wÚ +Ž”³¶3„áTLsUæÏÛE_…¥*t8E+Ëj µ•;åê/Và ·0t˜ud·€Ž¯Æ$zRY‰ˆçQ…“ç¾(ÁAèÅ·xdª›QÍb2eØd|}Y.Wë~Æ8¶á{TîØ'"¯?`Z™$Î^ƒeŒû Àñ‚•„¾…²NÙî@ˆ“êÒÿ+-ÝtL5Ù´G!*ÜÿGïŽI{bJŠÚÍav× +ùšµQ1u`zQã³W‚l[ßÔEÁºrÿ'çgGÆ>xv m€¹GÍƒßÆ¥³Ùǰ3mµý_Ò† +f"8¦ÝÛh¯[F‰ŒT®´ñ&nVŸA‹ºøjí–ý(M&vP\ÌE–„€dUFåómÁ…á\sigѺïœÎ9©mËÂñÄL»5KDkó#_t0ÃÆ¡ïõ® +üнÌN#KåØj£»t#K%híá%©…¶ÒÏ â„›J„\k•é,”¸Zq "ã;4þßø·'ÈEÞo‡‰º6¬åI#¡ÃÐÆöØø²Nª¿˜QV#ð÷øðÚ~x¿†qûºœ¾«ŽÜÀἦã¦Àƒ}"Õ'~V)8I怂Àz¬“0¾iUû‚ã2Q;çÃl.¶{¾bW,gjƒn—¥F6³·ëƒgŒ«x~ÔxÕÂÐ vÿ9¢¦uÌyË|6Y¬ iPE¯ËO&‡ŽÒ¼4 +“D¡Fˆì«l… .Ñv 7{ß/ !mÚÛ0Fvz?tFr˜.cÍÉÆày2Å•:Aøô;c¤Å©ÙEy¿Y‘ÿ%xž²ŽäàG„¥ç(AÄL/jnFV%ñ­xÌÍ.œæoQ:Q³ôkÂØo·ä¢EÄ2hu¨ÓÚUåép%­ËÙt‰Ÿúú$…iæ=¼”Mòo¯ž +T6ljLñV Ò‚ºÒXÿg×f©`l÷SFN¯™mq˜½ ¬.µý²Ä +œYÞ»" E¯ñ²}Åó¼?–zK!Èœ•Oæ Þ&† SÈñ#¨)Ñ» `8“f˜jÄCˆ‡þU­sßè'û š‘óZ%âo›yÓ`(ÈΉm•ªƒ{fqwáæ:«H'J²¡Ð Æ&Eˆ£0#$~+ÍÒ£ÜÚ² ç–9_k^|Ç3w¯¡ì¦YŒI³$ú6×] ëc‚J_|ÃíÚƒa…ÎP:!ZÜ6jg¤Ò3%™Áo?ªT„ÇJ0r¯ÚF'yø ¼_iù (7@LÝBÊÚ´ŸG!1 [‹¼Â4oÔGª¼iD ®PÃÓ Mtw+`|‰Ž8P&mµ߉šÍF’še•f¥mM6’ûxR))œÚ¿ú¬ Q|$ÄŠ2rwq霾øœvš?ì%#ª|Ô6¢*V9~ê•8 _ÎÖYœ´–lLÅ.zmFÏŒDvpÿ€‚©§Š÷7¾IZ^Õ‘Î{$:ñÁ*…ÇKjþEß^}ùæsPædR+§þ¤þ:+3ÈWÒ\aõ9•©¿õ¾J¥ÍW°…x‚Œ$P<ÎA 8óÜ[n΢™"L#æñ5ž¾^Ƙûð2QYÅ’iØ·ÓáL¨—R”ŽÕ gL«·)†û=á;ØÚG”,ˆ¤%Uð¼sZÜy€3‡ÐPዹµ@vr|`8+Ýßèæ—ªi•:Ý"Ð;»ìÏf„§5.õN–Ј¢Þßѧ–² SMålÄ|“oýl­ßëБ^’wšRˆa{%  + )øãwFf˜Ö…‡^"ž™TíÌè@/ Ø ý±ªÐTÙ.†/ ˆfg[~ G.`»|æ‚ÛfO”@i¸€ãJv.56UMi}å6b¼ÅMÕð½ó°(¢×惂kmE +Í@Б:üý…>òPú½(sP1‚o×ÔtŸQòvÿ +U;þÈé·´;:M”`œÿÔcn™^µ`4ÑPßöFF©XÂ>€Iâ‚®±0 ¹—¤Ë<+ Ñ<¨œÎO$å” ìÑy§æ¢Cñžm hÇ÷YD±‚ÙÑ _`¸¶¶2dpóõçö*5"6P2ZÂXÄh,×ÄFøä¿):qâ¾Õ5Æ)¹­ë°ÛA仡pb¸\/¼3ÁÙ Àpôþy0S{\8PíÙÓˆSˆ$#¾Ï ¶åÂX.A «4 YÇFf…>,Zrë7cz·Â(^~«jÛh1)d 1e{¹h>ü„Èà•Ø’ëù§&ö-œŸBë{≠F>CÙîyH3–,û $¼ö(³ƒ3ñ7 jQ ãNu~ûÛ +·ƒ0¼Ûoí”^$RíWJ¶ÞÕÿ° @0¿B# ëž²Ø<ÄÓâ­ïd°†ô”CZ—-¢q½=S žØV¥Mã?Z-˜_.âµ3°jÖ¡„âSÛ ;Ösr\jO?М ¼'pk¶'e…;.Tyª_”ÛÕ:|!—mRDÎ<1ŒÊYJÃV”÷q,ëµÈ9Œ¢­ø3‡O“­`Hp^¤lø'ZP²†A3Ãø¿ð]ahØó¿ø;ÏʈÇsZG‰¼‰5Ši­z:ž Q."ìÂ…Ô~œëZ$‚_¸‚¥Š\í +3÷‚ç Õó$FÇ^QK¬«^/8šò–FÏȲ:gAc<¢igyØtP©ôуÀ½tõ#ì£)`Jxß6_/:Ú‰6A9æ£p=Ô’™näælmQelÕ*±º.uEÇŠ@ÏŽ7| üXêwjþ?ù³·åÅÓóÚãθìnURS€<¤#º¯(«@äÃŽ"ãý8]!˜ÑŠ+ı¹J8†Þ!i®:<…CÂcÆK%/9NÚ~£ð@>XßMöÃÑl㿟&øâ[G"$Ž<+߻՘Ìȇ#uß;¢Î°Ræc°]9ÿ®_8ãtQߤe©è:éjlù™²<%U¬iÍUbj]¹hÀº×s’ +èò¤¨±éت·ƒÍ?Æ‹.6á0ÍWS¹KÙ‚¤á/˜6Äd¸šx…²š¸+‹‘žŸvñ4¨Ôòåo¨„zíC­ «osš›c1‚”ãYK¶x¤¡k­aV w/ȶnóÐ\Ýq+e©ÿLN厩¨¡Š«¥»Åð.™èÀ +.p F”‹œÊàPÊÚÛ°Jg²N‘ν¸~É–õ›<@ÁÿÊæ“m“ãE‹éW¹8 W…—s!¬|æÐÂÆÅ\ +§ê1;­ º­27 HƒõQ±•…™Ô„.ߤ4ÎyÑ<·œDXs+(þ&N£§¥šð+¹Pe¤:ÒÔ‰“‚ ¡ïv5È;˜»¯©Ùm^‹d½Y 1™\€žë»&¢àÌ*hte2ØÈþQÙÞO8n«Ik­õ!ϾÆÍü~; ¬»ì¡ËßRñ™m!û‘m“BwCX±eüIVW‹Â¼þ}â »*j‚bEªUº0,f&©ïôÜ!õƒ%zqv÷´X ²øRK®‰rÏhLtYù›ÎñxSë_J½1÷ R‘‚&Í }¹$ +ƒ 6}Ó}°¸¬uFb1²8D¸®"ü¸wø×Nm01Ø+@í1ŸýIèȪ8Ÿk!tÖ³ôŽŠöœ‚Ö\8>ž*Ь6liHÑMlâÚø¾o„¨(@4´®qwÙÐN¡ÐòjM?ŠÍUÚ¨x02>Üäû CY“'Õ¨52;LèÎJº;‘€²²üY£…ÒÂÐŽT8’Íà^4Ž[ˆ¾ À™è²ì&€>v•Ì+î^Æ!òÓ‡Ð8…êz00­¿W§« +§H­C +AEðuf^®hD‰‡_kÑ‘N(lÅ3ÒŸª´ßùÛ£.ú›×²¥_•Íic-Ýev _tÍ,ÙUƒ½ò©rBTKb1fÄr5/Ë•*CÚ tÆ~¢¢ˆ4EhKˆ²ú²¸Û\÷ò›$•±Ð’i×á¨SÄ;^i|*OapÔ¹V×´úÿ Û!Eqïá´~^˜Qº^CÔŽ[‡–¡‹Œ+,%½dÅ'@…ŠŠ¾"´GéÝwÒHì–ÓKZìcAF™lTì>?Í¢ÈôCçÐkî¼wÂCʹÙáóþM~âåÓ€ª<Ñ¿ŒÅ{/šÿ{ÅIÞí&•ƒŽÆÇ BC ž.Hy`v€*OL§’îîÆ4ÅÃnB0$4á¦Ê—Ø‹~ÌœÔãûo"H"0kŸ²µ«”F¼x“[…\Ån˜1f_¬«¨_k +°¨è]®­!Ä–ª6q¬  E‹KÀŠqGg +KEDÆnæ¬4¡ì©û¨Ÿ“sžœ‘ßœÛiSâ.ñ²™ÍÜÝ8Âa[hAV>ð™èŒ¥$‹µbC‚f±9冒ke0í ·fG”LµDDÖeb à‘ N œ-ÍôϼGÅß\ŠESÛëÖI>v½wBUÐTZ.Bºgè6¤w „Šê¡}Ÿä©jpj¥Æø[= +¯hgALå÷R£bWãšùFíqÇàÍä5 Ÿ_- ăæ®XQYh_21ñÖ gŸn.zŒ7Æc=Aah­Nmv¢”C3ž„sl¨/­=}#–½—(¿™É ;\i…¹®Á &§Ø²x«£ql¾¾ÈLÈŠ€Øõõ‚…jÒ"!–2“±§…ÝCjïÉ_U®ÒÊ’AŒ€Dˆ¶5”>-‡K‡§é5B*ù×åà ÛÑà "aDG6…#F@ ÈŽé‚Â/¡]!4‰„¶AâªøšÅl‰Ú·v B§„ˆd©»¼.G9{±AÙçÔð7(²tÒ…f&‡h‹'E2víÆ Á{¤2!ªQCƒnÞ·}F~eª‚œ³ŠL$áNý,R6WR‡>‰ÖûF/‡™1ûÐ+2Ê›âÄd’éqqÓEÜ=¤úÐ"ÊÝ*!¹»dg2U¶@ÌjeÿE:Œ£o/sP•õ­Ÿ˜¨NZq—ãáV^ËL5sZpÂ%5ÈI€­"–øýaÆ«ƒqWý[×ÇÚáw"v@-,&þàêúÃ'ä炆H_Ñ)>ª–$9x239ü(§PJÆüB,JxÕi7ílsÖKP¢¿°YâU=¬ðÍÀîuËš%.ƒÑ˜ú©™Ä¯è3€y‚Ö̺)¬úÐðÈêÌÀÒÏ>µTÁ¼#݉<@Ô‡ Ðpô·‰(ˆ-í>C.¿bŽïæ{¹û1bhA'Æ®QDõhû(žÝ?ü:ßÙÞ)ü´oÜ‹ì:€íPóÆ“Ž/8‰¬é1ÿ^÷´´;¦Ã¼ê´Iß1)ÜOÇœÖÒSe޹\Ufdú\FóÄG C¨HlµÚøí µ×@ñ§OF«ì»àQÞ\:è®LòX(áHPÅQÚØUR¼íDG¾ìAŽòÞœ5L-ÆÃ¹öL7YŠñZB5I 6U¦fÄê[…" ’ß ªbÄ@¬Ü_1ѵ×Ú³#ãàMºö `­Í’b“ÛÔH¤Ty£ [ïr,·õ’…NÅñßÂ%ªrläæ /Ñ®ýs]™¹=»,€ËI³Û;âs…ß'…ÿ«×pŸ¤r'EýöÚÜø +Qê[jL¬b«žÜ¤»íqзÊ1\²a-2é øò0Ñ<©7…ŽQU¨¡tÉζ‡v/sLÏyˆqUPã+Á.C_Þ‹E—’/½EY6ÃF/¿âq¾‰–ÌÁ}¯‹.ÿ_‰Ñ…zQVVí +o,¾ªSoïN¤¿ÑÁÔß™œ…RΈ0©Ý+6”# +³f=‘_æþE…yÅÏA«ÿT-?Ö!'"[YÐÔ–ã²3D¢ùîÈŠÈQ1š²-`É<LÖ‹j2çÍÉêÙA>™;CegƒB™ÏSZæüVûE”ßçØÒ޲r]/e°oT†¿7c-U†¸2È +®*;ÅOØS6g§lÍÎðzl8eäKe¡Á,v† +N™l!\*3©LoTF$RT6œµd|æô⸦¬>OÊrLS¥Ä”L0;Nv†UÛeÝáÎfgì,•µã*;­Tv—SvšêlIÄT²ƒvÆ\#ŒòÑà”ViÉR=%Ãß”a’Êp[e€)“F¶²v’W™&€°²éò¯2Õe§Ôçae1T©$ÊÛ,v›#¹’9v)\ ¬¬KX¤©°2—Š••Õ•ý®X™|S]™[ÀÛÃ.›sÃÖ\ä¸3“„¥Ì`޲£‘س¸)+”y%#ˆ9çÎ`¦s”I»3L­4‡£n{gœøRVѶ”é`4§ýΨ7ÊL¾3Ò¾˜©”=×âmÜ8OÙíì”ña*c‘NeÌǸUvi#¯ÞÎÏò;„ÓÜxv§Ê$¾3œeeËH•ÙD„1g ÷R•I£ £mø¥ÊjVv9B´²q£:o•½¥zÿÒ&Ë߉ÀWVô± Cçu³–1û[†]FÈx™ú2BÌ|f0¯bæã1ô“Ù˜™6ýùœ…Ÿ»riæ”pÀØÌ˜ÍfÙ ðŒW|›eÁ3ÜðfïΘ¢8#wr†âqÎYKgn„DBÎõnÖò;ˉÏ6—JKri‚3fázÕ³2î¶ß³IŸäáçUyg?â³ §ä,êAh¹Rh@Í\šAci">M4–ZÑx}јÃ3”P¢.΃ð€@”£I‚göhžSHÛg˜È+^Œe,<£KÍž1•J³SÒf¨4è)-‹)¸¯´ZpiÀÓ:Y—i&­¦E€§d¯SÚ@ˆîЊ ÏÐÔºò/ ›¨íösZÎ’šx†û.µ9¼©é‚:Ï  šìQª-3UW-tv¼àV«ó®–üW» ÏØQ»6 +lÆkÓÔ(àË^ó+À©ø«iDZ¿3ƽæ¤Ê(‰{gÛk +ùcøÎ`Ëdº$‹N^¯{-œúÚiè1ea4÷¯ÕwÉwÆ K-GÙsi÷ö;c—;aPÉ ì×0ïúµ\TLk`|-&䱦šðŒ_¾Yçñ5åßêŠRN©ß1WDå¼|mè?PÜ~MÛXXƒ-±½<.lä[ý ÎK™®zÁ¦T­Y¾¹v_ª"¬Œù­Ù†°í9‚-&lò–'6ÝØx¸5]…ÿ5FÁ3D¶hÿ51;Ùn“`{Zp¦`«™U\^°!]ÀFŸx†ÒÓžMi,»ìÇtö‚Ít¶?ô°±ÅöÇŦžá„Ûl ;ž)ØD·ðõ%ëqtEW°…`à›l8ïkÞîµÏ]ðŒyy-$#Á¹×Ö侯ž!)øØ¤S€M4<—î…SÀ¶ lfÀ=lºlÊz±œú…-G%°7ØXßxðÙ ¢ød°q«@`óV{g0>7vvy§Ù rÃuÀ¶wNŠÀ–›°w†Qaû½\ÄÂV[N6ê6Á°…ûÁ–˲ÝÁ;#ùÝgÝI)¦’áÔ_[Î_Ô¹3 }l™x¿öÇ1’Ài[fëÎ8lwoÛ›;cwÆÚomr[¡ìع3ظUYKΘåº3†0›^l˜‹a‹âÜW…¹Û¶ulÚ0l{b³VÅö«;CFàÎ,ﱕ»3B#¤'[¸_Ù2‘Âl¹5[¹s¶óòÙ¶î k…¶mw†_8G[ðM‡iCZðÂBmY2ñ»|Õf`Z[m¯ 2mþžmD`ÛønCTÝf?oãÔ! ¿­¤7ôîŒâ ·k\Ü$ù¸…åFIÌ­›pH‡n:L7Ì"Õ D×­‰²[\f·›DñÙMzÝŽ€ð´àn‡¼3ÖðnÑÀ[ÌÞ´Å›ø)oÛw†M;oëï W¦·òÖC²½éù½Ðä›®¤oÈ@·oq7~óÂ~{ÏCþ΀¯o&pã p“ï û¸U\8WpÐ¥ÁíÓƒzgx3Â¥å ‡òQ;˜Ê‡~g(,œ* O¸÷qŽÞ§©½3€LBÜ‚wnóÈ‹åu ÔpQ]ážÞ 'Óp¼r8ôpÐó òEžS±ìÄÑbŠ»óÇPæ©xg”ŒWWÆiÜyܸ³å¸ò»ã¾3Œ{ÜW¹Ù‡#‚qh´>aýŽ‹ÿ®.HÀÑÇ;Æv†z*––m3þÞ]7^ÃEöðœUÀ+ð\À‹šŒAøïHQ‘œpjg4ý;ùwg÷w›Ä!MÓÎXoêïdí ¡sãÙùÙ)Z"‚òwEVв<Âîα3Fx6ZÚ{>%8!5—6C’Ä:;ìÈÒ΀ԑqí”ÞÝ”ßhíŒØ«½s©igx¨v†MïÈ;nÇ;h€!è]‘-ØÎhÜá¼Ãóz§ÜÎp¾ >f'ÔFJjF*ê îbž=±,bždžOgtæEú3o:óD7W•yTè)OÑðuF¬¤ÎxkSÀ÷åÕUÖ€ûò±‘œ )Oý>¹§Î°ß—w]4äèª3F1/Ç$§ÔÑEuÆq¿¼iªº Íc¤a6ïu† pž³éÕy0r˜ç鯀òÓRî#TgØ]ôÖçéÿÚMé-’é ñž2Q/í‚ìF½ê¬7VgXg½ê ?zë­3àõ,U׉Yö‡1b¯pFâ`x=ö® ‡Ñ¹Õ3ÆÎrµgóa+m‹šFa Oã^òxî‡Ý;.¼wÍΘˆzÏF;#æ{³3Bð46(·¦ >çì ÉàKò +I_RRÊ2<ï­{â Œï¦Îaâó²3nbgì’}T)ò7ÿ08d°ìŒ._dv?ñù¦ø¢O|§ƒìŒ'(¾¨Ø~Šoz!> x+>;C^Å—ùÂŒ/2ÒøžØŒwßCá¯_Ëú’ÁCý!£þÈ÷å›÷,TÃ|»D ›Ia†>y³3¸*}Æ2 …éK’õ=fô;©ê;õB7ëó}'õèõå´3œ4öÈ9×ß³ÏrÞ¾ÝÞîË„Êjg(c´3Êû¼ñè_Ð[ù­\ó;vvF¥)h£dgä£_-vF õÓ‚a­ßÖ±_¶ŸÜÉØôu?¸ðD|uôc(;CÑÃ_AþLÅÈüi^ô—=·ú;“¿ß8½¿=;ÃhÙø·BÀÍíù—¢Q±àþggЩÿÆê¿w›ÿqigÿ¯V@q€­º ÌÊ*@Àf³ØóŽö0<‰‘T&œs 8Ïΰ¢¶s²3˜(NRDu>ÆÎ6 -Ñ… Ü‚ïXÑkš +<*TÙMÄPqìdÒ*ÐÅ%ž3qÝÖ‹8ÃE²¿»D3fÅ¥‡3®„UN¨%ÙÀÏŒ`ÆøŒ +.x8f°“¤h3W้3¶q$à¿ Æ+0Î°Š RÄ1®@8õ˜ú°ÀžBƇ£Óý•§ØŠu +E±Œâ€‡Äëˆ3>¾ÏôqGâŒþ£QÔ²[àí*37à:ÅØXÂ׃ tD¥)•ñ0S{J/ÁZ1¸@ [à¥*Nœa—_‚Œ3f*ÁU³Ó=š`Ö¤žd€ÆLYb#§‘àÛÎ0a!“s\ ¨âHò8c Mø-ðEÎàÍ&ÎHu“3À¤BV¡x4-0i*g„PÕšq1 œSÎÐ:±Ó—M ü'g´ù; ÅšêÑãgéÎñ' ôÜ&' D›Y9£Þ )‡Í·B9.Ò®yÝyåŒk²À¸1…Q ×}\±Y LÛl Ä„ÒTɉ_=ˆq,Ð7½5Ê45Eá7 ŒÁÇ +À®¤åŒÃ"î‹ +©r® +ô?¯@áÀjrÂÚp¸iºésÆø +4BAêeX¹¯ÀÁÕ+O*ÍäD,УÐN¿Í]«pÒœ1äNÛ¸ë +—>€ÌÒ;.g m9Ã8—3€;ÌŒ›9ƒ±hˆVrªüX°@òL^|Øõ\‘TFÆ À~–9CØ‚½ó +!”š3Ïr!sR•9ctJŠWÒ‹æVà³ s†M½×¨s»ÍÐmFD2g<ìæ ëõ.€C) vâ©æ Á¡™3X¾œ¡ ¹GÌ5F³·+0fÎð ¡À›¾ÑC‡íµaˆSÎ#’`ª7€}óMŽ9ÃÔ#…:(RE,g¤äWárÆVêrò#™&glxŒÃÀŸ.QÎ8 uR0y· +\ ¾Ô“3FAŠEV ¯UÊ;˜W NÁ‡b“>8*g`/ #œÄWàô´Â*ºÀØ'2=Ñ -gü¯À@·Ï*g0V9M¿Få`3@(îŲoÞ ±ÀØ.,ÐA¬öÆ DhÏùC•K=xq¸£¼†É,p1}ƒ´À–®H'2òt9#ÜHü;‘¶¼¬1?0øþn°œë4—3ؾ)v â=à85>˜3F6ƒ+3g0ÆœáÀøå áMFÈY©åŒ˜ç¼œÑ‚``èFåûåŒ{%Âa œ—ˆs†˜š¾XA¿œ1û 9CVܵ“|mˆ…/gÜ ‡´Œb%u“®nÄ#f²Óžl!Ì«ÕjÀMO&”ϒ˲õ¯ˆI1gÄË@Å3_•x9cÔÎrF¿…eà3þr†ß-g\­œAla¤é +05,g0 á8æÓå ²ñ–3v¢E'põ2\ÎxšÑr†øÒ¾œÁÇòQfào9ã¯ÍÀt"y€ˆrÆÆf ±fFçz¤ÌÀ è“3Àf E|fà!'çå»2СÀ-9ÃKLnÿžœ¡SmµIHÖd ÿϱä z  •½‘3¦E­^U 4pâ Ïþg „€â3>ÎØ :Îø40o¡3ˆ4¸RA4ðJJåО3²I£eÎGÎã ØÎU¢¡Í¸(äŒCá°a3ÎG@=xó_3PD%rF|Kõ2ÚiDÈ9ãÁÓÀ-ã’È%9¡äŒ."gÄQ_^±Õ¤Y‡œñÃî;rF Pº4°îÓÀ½ÇŠ<, <%1 Y¶ äb}¯äà t$9Ù“3Ú t¤$$ÜE¸À1¤œÁÛ®œ±éz ßÀ‡]¾˜»ÅÅr]å ©Ú8=”3ä¹n 6ƒœ‘4]q”3 ÂØø¹a@åŒqðÆ€”3>4~qr†Þæ!á%g¬q“34VÍ œj7°<ó +å7Ùë†N’3è 5}SÎP*}ËGwÄ>lÓÝ?K5xOÎ0$›"¬f°(gXerúíãÕ(áÈ7”œ-„€%YF vNß@åÊí t&ÉÈ£‰ŠDÎ8NÈÓÝ@»áô0QäŒ HäáÊÂ|OHöxrÆzø›zœÜ”BÎ0 Ì "gl’3à'Î~ÅÄp f©9Åbô:‘8£Bű„ªx $à†›gÀ9ãŒÁ:¼þx#ã 4*âø¨¾q†‚pgÀAðý›߀3–4B˱`vœáÞ‘(9ª(gï­à ³“«Z„@"[É‚{Á!3ìÁÀ²ƒ36pW4–z’ý ˆb4£½ôŠÂdàœ¼á €w8ƒãT¹¢NÔp°´0qƤPœ:úf‰3p”Š3BГÄbÛ´(Ü`Ný‚<ÆPÊ ­Y‹v,¡E+ÆpStÖ¹r­¥(­Ú ¸½/È@™•°ÁR3Seæbˆ¥æ‘ÔrQ^µ}à¹0AV}È +iZÍKü änÚ(€Tjd†Üj†Ú&ˆJòI£7´éMäùZ›rÏ|C¬µ=o}#gœ“ÕÆèe÷0r¹%µà;7(œ_±tr0»Òh a<±š–[¬bÓ€åG]!¦è]ÂgåF‚ÄZ b¿uã–š‹aÚð +Ö#³^}NuëÍd©µ¶ÁÅê¬&iÎ?¯ã¼‡cÓ,b¬+L/½ÃLQº$.‚X˜lËr˜Ì4` rÃøi±ý–Xc ¬¨Ùª  +wè\¥M¹†]À¢?`ÑŽ)Há›Z©u½àxRñ†Ï‰Ìè–ŠžW[K’ÌßYŠ÷%¿®†«-…T-ä(†÷0†ÙKÝ{DZ«m†9¾õ¼í^ÜÁ¨èm{Òpý(ïsœYn/ŠVlE¬¶Ž$V +bSY R;創†æ' Oy„Pi,™íÙí˜ñjßV–]g%~SóÅ,´ 5œgÁKR¿&]œ^:‰ª6 ZzÔ¨lËfxÒ"t€Òɤ¶›µöQD›ðòüª %v‹œALzÃNR|&Úåó좗øQ¥ ­cþÏ +†WdšCñ!sP3”ÖÆí@Œ¤VP£>œPg Í&2 +9?唥–Z‰£y^ü¢(yz]ƒ%gÐRô®@Ãwq”ÛÁj©íh¹Ü¬A&齂X•vsý‚Sn¿ù½%x‰¥·ˆÞ™›#¸…›$xŠ`•ZŠÞÔZ#Y°,Ù¯ ᑚÅIu¦€f%=_ E±º +àV]©X!G«N–ZvŒÚ#„Oïª·î² «o°©’£ÃÞR´@¥}0‘b» #›–àcé5áeˆý@¤í@‡¶ŒÂìª_(a^%°Á$9aeÛE1„2C”Jë ³$× ƒÔfA„"{™f­í`·Ú68¡ŠapyŠŸÍr&Fr\ˆQ ÿÂ¨ÕÆq´Jcar¹Á0V©‘øEÍ9ȹ@ñ£J`‘jÃÎQÛD +í„ÐJ̓¯‰ì„Љ¬¤‰Å†!é„A R BÈ5lÀ‡§¤ ^A@r KI‚СBÑ›Bƒ¼R 9j±m0Ҝ°r­ªÀ5V@†žSBÔü,ãHÅKOCLÏY O¸ƒx•¦!æ:@5^ªX¸dÅp § H‰v5bgÀ‰*Sñûz‹jÓv"¼mú€ /„°ØÁŽÈ‰2‹ ÓËgX(\4!SðK/ V¨ÝgœPð@¢cÁHLÃNѼæ×U/,®]\\»'†N𞵋/q +`ƒ2j´X%ŠJq ½£¸…¢ö†_¹…’È Â—±cE&à ç-@ñY?8éAs´¶P£ÿ°Suö∕†síb£™†Ñ¡Ü2¿‰ýöIä½1Äü°3Ô8¡EˆY2‘sÕ£4÷Cä ±7¼hÃ^†Pð>+64Lñ<¨³;Pj'vªÜBŒß|Zö³_|­7DÍO8ÄÏiNÁI¡¥h®KÒ‚Žk˜é÷LÚÕú¶ûéAûC†]oh²ÐZäT¡=à"É%Iôû¹•Á‰r«ƒ.„ %_öp±uÈ!B ¢èt!eHÌR4óWø¾à6à(Á9bK`R/à¡ä²àDúåaÄRëpC´>ÀCIÓBÍv,B¸$Ÿp#Ä~s{­UŸÈ*äü¬M˜Uht€ÐÌ\Á&zNf0„Ý=žÙ„šŸ´#vŒâ–[#÷†$7 +`Ú'Üq‰`T™ ô«ÍIE†Aç¨ÍÍϹƒ/É푼R#‘U֨Ŷ"˜µ6æ§¢—/ñk"ÓÀ3‚—:møµOš^o(Jo§Y¶‡»Ò(€Ñcæ@d*mƒ ‡™¦±9Ukj¢ÐBèL©Å4Áþ +'Õ°D¼\%€ñÄ‚D +6¡Æ®AÌÐú˺NQ»ºÕö«zï<šYD´\)z\mXŒÞ°¥3XáŠ%H™†=xáŽ#Ø µA”ZkC«4 F–W +€›"Ìh¿h‚ÐpàpŠÞ!~Oe/Vi+’LðÌ¥8*=f&@çb˜æt¨ÐBô¬ÒR³Øb µØBšXl‚Jñ'ÕMU ŽË‘‚«×ÄŽÓœÄin‚UVÒÌ‚+!”:SA¤Jë€çãî`GêMALšCxá¢5ˆñQcÈA"«`“TæagjÅ î†Ú½‹4›Ì\{Ð1ŒNs B¸ìV·*(©†?èD±Ah r3@’ÜÚ€¦FÒÌZƒ †ŽS”d0X°!K°N¦b¬pÉVzμ©K™Þ-P/z,Ù€ L´` ¼f9²ü¢+n åùÅ€‰ÓË’ªÃÍS¼CXŦ‰¡\‹8€é1O@’[P2¤†B´î#e£ØÅ¦´®ç`ˆ[u \—^˜bþ™§³(Hó 1Xmd²Ô.Évcü¤äWmzÎL”ˆA#D^YŠíCä@E€)rS Qšƒ.ÍU$™äJkŸ¼–÷+Mï½X=ϱ Ëq0‚Þ¼‰¬¶?pþ#8ÞGhIŠ/Ã&!ÃÕÆAE¦!Æ‚=%D’]|(Á(È©[œ\l>>e½J“Kmãøä~nÁØpž_z T¸e7Os 1Eð +\¸ên˜Ì:ìH™•(½Þh¤]<Œ¡”YiX¿¦ dxÈ´XŬ\ÃȱAô¦ÐN˜_uæÖ[±Jæ¿0½÷"Õ° 3Cì TxÊ€dÃ$|XnÆnÞÃV'Ivïä¹9Wh.ŒOr V¢Z ˆ©)^1`Âã`ÆgÍQÜz;Q~ó#tœæBˆNlŠÚ˜dËÀü¨!ÐlϰdÅ p²ÐFˆe}rú–#RÑõª˜ð +¦{·Ø.Pá–Mü°Ø*Ð,ÍGø¨ÖV ¯ÜX±è&Ê/}ŒaU‡¥y‰à” +á›ßTÚ…¤9žTÙGÑËMG*Ö?­l:¡Ø½B‹ÓX%@è VŠÖnœæp¨ÎNø¶ÚP³ÖZ½à6†\n+Ê0ú#ذ T|Èȵ5˜j_ÀióX^©Í`³Øˆ<_ôŽe• t«M¥éE‡€"´Öà ¢'u–"ˆ¥ö¢¸ÅVÂü¢ãDÃðÊ+¸¿œBƒ!Üj뀦èmÁ‹¶lÉÝA‡*탎Û*5 :IsgÔÙÆoh AåÚÅ`Uö@èý`ÅçMJ»• 7‡(²¨—öG¼bÁìjŒà(‚Un%xQn`”Î:˜b›pS7A|k¤:[yzÝMœXx ,Ô01’V zNd`zÎÄ­Kü¬ÔR§ÎX¢_o3R0»‹óËnb'‰ È- +FªÞ :EnB§³ +9Dp :Eï c•Š Ù”#%Ы<•X±ÌzP"”–àUÖ!ÇŠeù½7­í¹—e÷þ¡&i¢·Õöन½A SÙ†,6>1Þ‰îÿžl9às—2«¯X¹r­2ÁO¯Ø8€r?Háš5Ü<™…èI¥yè1(·Ôt¤dºŠÎ÷lßu0Jr_CÍTZ%=æ 2Qr:\m!r¸ÞDÔ|ÑgŠr:Wh@ŒQ$lˆÔhŽÆY‚I`r[°IŠ·0N¡™R™áL»ô  2Ÿ÷üº{ìDÍsžg9#^ÂLQ\B‘|ƒŽÓœÅPkæ)Þ©å¸?¤7›ž± à”Y"w/?è9Sf0„Ýú±ë ‘Ëͦiæß,Éy0Fc”¤W‹âU "–[DZ«¾1ä‚Azë-Lp^‚MϹ«X8V¯‹£S¼‘*­"x.W³+W󙢶ž•Ú†(³Ç«· +2Cn8 _´­7ä8™èI™Øábë‚ñ7NtÆ~ãMÉø&V-ÃxÅ6ÁfèçiŒ “\…ËmËÍ„éuwq~÷!È.úIÓ Î„0 +-ÃÎÒ<ƒÎÒÃÍ‘|ÂLRœƒÍTqzî«åýL“œ¯až÷C({®ù½ÿ é8a´MÇ’4óEŒ`¼ +Ò¼—Y¢ýÄéYîqËÍ…)¦1rÕ=ð¢Î*à ÅE›Æ^(¡Ê<–Ug=¬Žê#ޯཊŸV› ²{'Q†ÙAŽÝº‹ }øEƒµ¶¡¦êŒƒVWZÕ2\ô¨Ö$HÉŠ‘ðIÅUüÂì(x_ö;[ô9Wm$I0»‰² Æ"ˆ¥6á…‰¬C¶ӃȡZá»RƒaÄR“y~í¾ªXíZóUÅì.rªÔ0A‚Sp¡b³PãD¶¢h•æÂx•&’üªs¿î-~Uj t–à¨X½l½f¢ä"zUi1Ž[o'M/:‹3Ì~ ïI”]täÝEñÊ-°‰lIµ¸Tv‚ø„v‚ètvÂØD6"•BqN¥uPó£îà ÂW¥v¸ÇBÈUaÌrki~ñ1N±Jæs Ãì%F-·Á(´À,¶”#º?£dÏ¡Ë{Ž Øf‰–S^Í}‘%ÖÙ ”Ù†“œÄoª¬D F_azï'Ê®Ýåéµÿ¦é|ÓúžCNÙsŰú + Üš¦91KjÁ®4"oB\Ïñ”gH1’ù&H¯:ɱ›— s$g DÙáEK–`Côî€W‡aÔZË‘ŽïKì™Oží|ÏuŸE9æã8Ñu$Än>‚Ì‘[‚ ÒšЫíeiîïDÍ~•ÜŸŠå[–á|  Û‰ß±k1ôÚ[Ãè(H2Ÿ¦‰îK­o:¬v-盆ïG¯5–¦ÿÒ ó_˜a}L³ÌߦãJ£Ê0ì±G“Ü1Ó®¶ª÷Ž‚øDÆaGiî"˜õb'ꌃŽÔ™žÚF1«ÎAGi,‚ 9Eï + äf÷MÉ}bXů ŽƒV?Q‚í<¨šîY`… ¶OA”RÁ›2Ë€5fâ‡Õ¶"¸õ‚«ƒÃê!È0{°*Þ³0½àX «ÐH’[m'K0;ÇÐ nDÎVÚ1li’ñ:ÐóžIuËU­cw<¨ZNz}ÛU±p»eµMg%ë…RöÜÎs=‡¢ ç?ˆb÷a´mÇ{¦ëV½Ú4è@Í9ð¢È*Ü ½;ðœä1Pï1û½³á=ÌS /¤žãr¦á=KS,¢Çõ‡ NM›¬5cX/Œ¦ïFØP©] 2t&1z©‘èq½i°±RëpcÅÆÁ&ë-…ïëÞAìâS–^ü‰²{‡!ôªû¤è:'YÎQËMÑJ …ð*-ä(fçEÏþßõkÿ]½p%ůýoÌáó7èD¡}øA•}ðE‘‘ø]©}Åð4Íó +³{Ÿ`”þãôA†Áy$¹è Ê®º‹aVŠÖȱK9zé3O2¿ÃÈõ¦ P™„©u¢är{aÌr«€C¿°s÷`Z­±H»àHœWlH­·¿)4@¬¶Æ.ûáÓ‡ñ‹ž’çsœiHœÿáq×ÝLÁàR˜ao0~`» ñÝÄN}ůK/1’÷)̰·j˜[ñÆ“<­Î¦[r^Ësæ#±æ|±ŠæÏ<Çý$Õ}gµ’€8eÓ} ¿è@©yN†ùÕoµÈ8”[s”¥Åxö{Éü‘"y¿Ó|ÛÙ,Ýv)zYkp|ÐÍ)4H©3D'²G­´”¤˜³LëÎx*§«Q²ã’Ò¸Œ"mقͳþ°«fR,ßi˜kÿôÜORÛwBiû.ø”  †©Ž{Qžû+I3¿%iÞŸÉødù΢,Û“Vu_8Eã•Öu¾Yu÷‹Ôµ?zuÓíDÏþ昄¾ëFŠb½ ¡×Û .'Jæû¦f¿Õ{Ç™Šå[˜`ý‰RL¯B¨Õ¶Aô¢› Ã}•d˜ãóÓ5’Ú¾ãfãw4M1ßŰ ů놉ŽFÝ3„Q÷lžå¹åϲçIbõ b› + — +’œ!«ÁyèÙù/Îp}ºEó›Ù28Mûg˜f= +RŒOIŠ÷(È1f‰ö£r;àóm狦ãž×¶]޳ÌVÏ~ç•]笾eÄ(Óq/Éõð鮣a¦ãXiþIñœÿŠñ&vºÜBèh±±v¹‰$½Þp¤`½ô«RÍr;Tq‡î{½àRá=IqÌ!†÷3L³Èð»Ç0sÅ'‹ ' +ÞN}Ãà^–dÊÑ,·ôêOðÂî)v¾z@qiŽãIÍs%ɯzœ&xˆ²ËMÙ­« Íü’bYo‚ãQø¸ÔTøÀØTŽh¿É1ÌOÌjûà‹"Àó46Â‡ÅæA»¯$Ë}d˜Dp* äøåã ã]±ØPš`öŽ£—ÛÇñ NÆ)Ö¯$Í{™%:nÄ(–W´2C^ÍöhyÿQÃk°™ZÓàI¾!‡êŒ£ÈÕöòÃ{»xÁ¬µd׎b(¥¦¡—ç(víD°þ%©Ž>á2®×±Tl|îyuó‰Ð·Ü‡PÌŽâ§…v·•v‚÷åÖ¢,ç‡Ô´¿H]ÏU±q»)²;( ¹ÜϘÏXÝOjŽÃq¢ëVŽh¹"Ú/büâƒÑ5ÝÓ +¿Ûfçv,O°5ž”œ?RÙq$Ç.]å8Îóží¸£TNw”ÂçR·Ôdš`8.›?ô“æ—(ÃÒt¢ä7â}·i¦óЩَÐ1;ct¬Îˆ;—kú‰û¥W÷hëÑÎçržè~²-ƒtÏå,árXk™÷j&c)ÓA­ï¸"x_f™®¿(Ñw¦Û?£tó©Ö±º"ž¹]œnˆ'^GźéªWùÝ:¿¦óÁoyŽ>ç¸YÂïŠO¹Ýêöç<Ñù"Ÿ÷4«žJ×tA§|0Ê4Ý ³¼ÿIÕrL*üÎz-³»bãuÌj[ÎIßùœð»šfZNç¹®Fá3Xj‹±-—r<ëYšbnÈêO”¶ãnœè¹”cy¿Ñ#Ûe’í¸¡Ôç¼ºãªØxPŠæ§è=ëž1ŠÙOŒe~Ͳ=tÎï˜O3¼Áø¢܇ñ‹~´žû@\8ÝÏ\F2:&€9c~ ß7ÿ’4û³×ù Ó±P뻎šeÏ5±ç9—¦w¯ÁÆ +í„Ü 3=Ç{¶eÀ0Ë}å÷Þ‹žûÑêü.:-2:Ÿ£LËÁŠá_Ãî!F1|M-7Ã<Ç%§n»­6.€äm‡ÂìÖY”ã; Rׂ¶{Éy§Ùo¤ªéxÒ3ßx5ïAŒ`nd¤à¬8©=ˆbp+I³þE‰ÖÉy"yßBøÕ6’üZsy~é1†^zGQÌ.bãU”b½Jr¼1zë/Ͱ~GJæC³ë8'6ÍZÇy™'X߃ªéhšè¸e™Ÿ‚,ïƒÒõÎgÃTÓ­Ótf¦Ò8à\­•ði±q½vŽ¡XžäÖ«,ÁzBª4ãÖ‹ WÛß•ÇPÌ~³„×£q»äô-G½Æã’xÊì’zÜqFj™NÃ<Ûm”l¿ÍÒ-£\ói–l¯)¿“RÇd,qÑî¼€Öì¾Dg2‚xàvËi\†°)¿ :ç2~Ï6]oÉž6ÛqËé;ŽªEó‘zâuH=cwÚ­Úßôž«^åsÏê\9…Çé4Õûž,”OY“\N8M»e¹ó^¥õ^zU÷S„ì>Î'„ÂåzÍöžÉg.7N‚óÝMî½’\ó<ã{Ív°§“^ásG[³»kÕìŽèœÏñÈãzzÎu—eùí÷\ëŸTx]¯Ÿ›VËê¶Ø²º%3;(³;)³;¨ž3ÛëÙŒ¦´lΕßÉ(Ùu-Çv]NÒL9I3DçѶŒ. +(>×´®ãžÔxÝöìÆ/z2¬-ÆIÎÿ¢j¹+5M†÷ìnˆ;¯ BÝq=§[î(uÓ¥ïºßÓ]×,Ó=~é<Žr~§¤Âç²Z·j…Ïí8ÛqÇjzoÃdÏÁ Ýt9N¶Ÿ(mÇñ\Í@½Æë”Õu»mÇi¹jÿóºŽFÝt$Bvœ ³~¨w„“§÷LÒÜ¿jÛtAÜ8Ý5ë–ã=Õ}b[Îåè¦k9¢û.Hó^§ÉöqátWDï9+"·Ý TÌ'!~ï1ȳ_f™Žë9ßu3K´_%)Î÷ é8îõŒÜëÙÑø å9ŽeIæ¯0¿ö“eîE‰æc3 Ó2mˠݶe¯e½{ÎÓ$¿Ú68I2Ÿí9«v-ƒŠm˘Y’ñ;Ïô^%9¾¯ðq¥}³ÌŠÙ¯½$)öö¢,ßY’c<ËR£“(»ÖL˜`j.Ì1½Móa–äãtƨÜNIuËa±ò9%³;-¡2:êÕï9Ûø¢íX”:¯›I¾ý7Ë·¯¿SNávI\2»'ž2:Ÿì;ŽI}ÛM­smÏ +ÀÍ’ à†©î“Éx ùžÃt÷zâr@<î~Ïöí‚ûÑNk¼ÏîÏbçsÖëÜN9Ïõ`Ïì~°fvF\2º!îfjçÛSæ{ñÚm QVÆ„ŽÍ iÇê”Óvÿˆ;—û*‚÷ÃŽÞü¤øþ‡ëî3ùÈëx¶p:i¶íÿÑ–ÙaÏî„°fvWAó¹vÞyuë‘|àr><í¹å˜Þ¤ÊýZ«YÝÒ6mF÷LvŒîh[V‡´E»3Ò¢ÕiÍd,¥ðºáó]÷Œ¢ @*U#@Öz6cH[v‡„Æçt˜ð9¦tŒ.‰§¬hŠÐ,|Tn›§9œ¾í¦Ô3?Ù²ºíÝ“— ÒÊë†zÞvÓ,{ŽimËÁ$Ùù¢z/“tÏÍ0Ëx˜%n}Çýœð8Ÿž5Ÿ}ßí,ã2’R¹]rꎻ^ÇìŠÒ¶_†y¶©ì½SP;.‹^ÇÕÂíF„iþKÑ-Ç!ürsÜj{YŠ÷½¨™O”®ùÍ*\Ž»mó…¸rº ´-7B4çK†è¼S:&Ch+·KòyÓ ù´ë’Ösˆë¦ãjßv6δßYÛE¯î»f9FIöã,Ñþ–¢¹¿r<ûsžê¹cU=—3×Uœ`i8NõùD#°9vŽÍ€^ßwÖì»ÎºU÷m–]¸5Xd\­|5{®ƒYŽõ&rÂÒD‚é:ÏÉö¥è>”+ÎsÆy¦ØQjÆ?±j9œæš.¯«mïêlcø¥†¤²û@\¸ÓÊ–‹ašñP«;h¿‹bÙ2|Órœ/ºî§mþõ:6”=“¡½šÝA«ò¹§.×¼²ãšÕ7Qê–FÝqDi[N¦YÎ÷¤ä=3[ŽkbÓq7Ðr~ǹž :åwHê;Nieó}Ò4GZÞ7¯iÿÕœî'[&C‹£ÛbÇ芶ewS,|ÿ´ºõAÛ¸ÿ¬÷?ýÄçˆÒ÷\´*¿Ûa¾ë:„^:G0ÌmåhÆÏ,Õüž~לÎ@Ä%#ÀW>„†ë-ã2n’r¿'|NHMÓ‹UsÛOœß%Tg^rç‡xÞü#ùܶLF¨|N‰{v·ÄcvׄvGŸã*‚Ë-©õ2P±µšeùíj›+FÙ|•举Ó|ã¡Õ¹ÿŠ•û‡zà}1RÜ5äæóð°ù>ÛøÕ +Ã^åþmÞ¯jÙ{íÖÍ_ró»ŽØý%¡tœL3ìfÍÂùËj{ƒ4×i’o:Ÿ+Ú’Í •Ñu¡Ý iÇê¶ÙyWN÷¬¾ýKéœNJ5“Á½ž @ -»cFÏf£r¹ŸmüϪ̄–ö´¾é¢V¸ÝÕZvÇä3F'—›š×ñ°ç‚Òs¿¦yæóhßtÛ,¼.ÆIÖ¯4¿õ“ä·)öÆsºå˜Ó±»&Õ='Œ¶é²Ø¸Œ n\Ë܆ó\¿ñ k: MJÙû!õl‡^Ùüa´íç9Ýý(u-‚¦Hmáe茢§¥¦E÷‹Ò÷;¯³*Zï•|Þs¼f[®Fé–[FËdÈ(Ñûgº/Ŷ阀ÜwTCï;§Ÿ¸5Ë–!†íÑ*¼N«Mß©À‰b£ÐBE¶ñûÖ=€å}Mò]·¤¾ï¦ÙöÜÏ*~‹jÍpH>ï9à3^G„ŽÝ!¡e8JåwCh{. ¦“¿u£”MÇÄž!£ì‚SÁã:6Õxe4>—ÅÊíˆStXÛ¡Z4Þ©-ß¡ˆÒ|-=gb$ïg’iÿÎr·óLû—Õ¶œ»žûáiß ñ¼í¨‚ävK=ò;â4-Gœ¦ùAZ²»'u~§”Æç ×·j•Ïõ`Íì˜zÈꔄÖqÐë{Î÷tÇ£ñºiu>ƒ›ßqãw?Ü÷ ÓŒWRÛþ î|F¿NÕyá4mŸ^ásBiE÷ƒÒuÜÓúž“Q‚í(|[j½§Úß³}ËPjßqÓsçÙïr4ï]”f¾5릣^×s+|]úˆ·ZçsGÛ³Z+Ù]µ:V׬¾çŽS·œO¶L–L¾§[.}Ç£lÿ ¯“VÇì‚´e2²Ø¹Ô +ŸÃfár\m<ÎG;·CNÙr'hÀpÕêØ”ÏØÝRÏœn›•Ï5õ”Ýýný Þ÷5ãþçt.ד“Ë +"£³"»+JÝ}¡X­ç\óQŽcûÆï+-柫9ÎëxÌ· Ò×ăF í\†Ïéž«VËd0§ó¹¤î‡RçsAس»/ 5h¡ÝqÉèzæqè¤y\9)>¤ÓÙ Éâ‚ͱ9$œd’Ñe«g3z°cvÄ(Û³Lï•Ó¸œ÷=§¤ºåŒÒvœ ò¬áÁùAX4:­¡yÕЛoó<¿IµjzËÞwôÀp3Í0ÜoZ¾ã@Ëùk¶]ç·{ZÏ ¥d¼ +±\wAžõ'pÂô1az Þyo|– -@tj6«U~·ÕÆç–zærV?gvÐ)ÙÏÙöóœíý1*Ÿ“Zßu[lüj}Ë€ZßwÛm[.«¨íÏnÕû¡tçÁ’Í€RÉfè0Ýq7Jw\MRíBÛrÅ*ºOÍ®åŽS6‰/½ÅØ>£L÷ŸTøÝ’ª¦K1‚ÙIŠÝú4»öO¥å‚Ö¯EI~»ZÉâˆxârÉi[® ·ûèµãX”༯êÕïL¿ø!5Ç‚4ëK‚iýM2>—ŒŽÍ(Bç3xË1ø˜c3tšo:Þ'âÎé„Ñ4ßä8Æ×0ËûßsG½Âí†Ðs\/ nFiæ« µÚ~Pq]D8ƨá‚;¡VQ¦ýÇ)»NÆ8Ž3ÓUÇÐÒEoVßsRkÜî8Þ£ØéÖ‘SwŽÒ"&k ÊÓ\ÅN\‘šîûüœýزŸÄÌq]ßbçvÐë›NyÖÃø…í#Å0\L“lÏnÛtØm›§‚§uF”²çfã> °ú…­41_û‹tÿfÉ®óáºg­`ý‰à™Ì’ ×£•×ùšé¾‹Þ× …¸ÖŸò:©ngÄ3·³bßs3Ì´Þ)5«»ZÍî~´e2¢VøÜ ñŒ·QºûHi|ÎG;§ âÎë¬W9´ +—;FßtZAe3¦€Æd qçsP>fvR?ew!dÄh1Byÿ)%«ËZÇ舶dtܬ»ß¤¶ûF)¼Œºí>[w\ËücÈUæ”Îé R³Òj™ ætn÷äc6£G+¯[VÝr\l™ à3î×bçsF\²»&Ÿ1»* 1»#ž1º îœ.kHN§f‚ûÅŒäs=Ù¹\SJ¤•ûEˆá¶ ß×MÅhÞÇ$Ùr7̵Ÿ÷d÷{²sº#Ÿ÷\’ +Ÿë=ßr8K÷œ‰Ð½§VÇü?[ù>zuÛ‘Tw>©GÞÏ^ßý<1ÜŒR½FÛs1I´g©–[NÛtÌj›®(mÓe³pºèõ¬O!žï*BvŽR>'9—q2dÇÁÛtÂg\FöJ&C‰‡¬îˆG.GÄ£CòyËi¹nþóÚ–“Y–÷:Í5]0ʾ3RÛuMAm9¯’Z¿´Öù¬ñWCð9fÕ-G£dócí8`™Ïbd÷“Õµœ4«–;VÕr-Jò~Šî§ê¸aÔ-÷‚T˹àó!BòÞ8M÷­K’Üçjã3p˜â> +›.73\l!D1Þe ~£zßžÚsÜŠ2ìöƒ²ó«ö§è½–lk%£SJçtCè[Ž…ÈÞ™ó¹iµìH;f´•×õlçvM>cw>\·Rê¦sVárIew'Et÷Z6W­ÆçH„gûêî3§ð9çt^”5“Ô3ŸÛ*jû§[24‹®?ýÄër”k9˜£šÿ´¾åŽxÈêŽxÈì’zÆì’zÆîX–ã¶«6]_jû×uŸŠ}ËñÄåŒzârG=ð:¶ÜóÚæ#§ð½Ñ¶L®{äæ¡j|‰qL·ižùÄèû.9×5«q9-V.Ǽ¢ñGª»Ÿ”Îë¤Ö¹] ¡Y0ºÆW±ñþû¾qåqP?cs>Û·_(eû•ÕöŠñ{ÏÃÕ6<ûNù]:&#)ßiµo¹  ô>Ëe÷‡xàu4Ês‡—p$Èöûšò»áS.ã†Éö¡o?rúæKÉå’€Úü¡Ÿu>ªEëÓ6]Ê1œç r¹¥,½t­¶Íg +rûŸ‚Þ~*¢ö~ŠhÝ߉šï=Z¹ÝÔÚžñáEil ˜šÉ1\wi~ëÊ+:Îh=ó|Ò}åÕ¬·a²ùDi›ÎäXæƒ Íû?1ýeó}xÚrYHg¾•Ò8/õ²1«ê¼Ïö-C¸Ä~œš‹Ø±:+¡ó寋šõSEkWÚOe”ŽËò¤å–Ô·ò9—1d–ÍHFËd\±ñºh6ÍGZÏý+gÔÞ[óÅ6‚ÆûÆBlß½à™û+Æ´ßE)ÞÃ,Åû,—m§åYÛA¯m:ã´-ç´²ëb–Ḽ­º(5 5Oc.~`n9Ïsûž±´žãdœa}´,ƒfwaŠñ/Mp]*Æs{Òs×-›®yeÇI±nºeµ='¥’ Z}À¥éÅw·Îd `û t¬oi‚ï3N³žΛV©¹v­í@Ïý”å÷®²ßCap,Ëð}X=ûƒÕòžºMó£ÚóY]ó…S´¿æ9æs½ì"r¸ÊX’ã·a/^ËxŸ­Ü¤-«ÃZËîz®g3¢ÔyïÙî÷ k~/šÖ_±ð¹ îüîég.CŠUËÙ,ÛtY«™¶V¸\ñ¹Ö Ÿoÿ’|.*('Ä÷³Y9ŸÉGGµÂë‚Ðöœ ½_!Æå´[7ŸË¨½G/ÁýP@î8‘`˜-Y†»*bÏñhÙsSk¼NImÏ%©n9 -ÝÐØÜ\îŠ×e±ñºçŒììhMïT¹ŸûÙÊå´W¹Ü›/Ä—ãrÙþ›iœ +àUÙŠRlç=×z%Õ½çÙºù[CcsS@r¹©6Íç(v¥æ»ñ  f“ašßfšf·%µÍÏjßtL>rÅh[®f©îópÙw2Qo=±«B,¿¥ïþP\® èÝŠÓ5§q»œ%|ÎXMû}Ór¿…9Îç8×rÏ阌í˜ ®œÎ™M㛄Öz.#w_kh~·á…è\‡ÔÊcˆEµÂé–Òx]ÏÙöÿ m¿Qúž BÕ}¤ž¸Œ$õÛ·ÀD/IÄV¦´²å’ÕõÜ6¿RÑûgO^Íyêµí/VÇ{¤VZΓ¼§Zå2‚²d3²Ù7]O:ÆÃ(^•)¯äzV‘[ŽŠ »OÀÁ¥Y"gŠÌ›Šõ:Q±ýŽÔ›onÇ{è¶Ì—i†ñ%F1Ý)ÈMWÍŠû/€\k*Æs]Y]Ïõ¤g~pŠös¹l:èõÜ÷–á|Ë1:•âù.ƒL–Û +^ø>¢|ïà¹å´Ú÷ÝóºžÓqª÷2ËôÝh+¿KÑÂDMVÃL% Öã4Ïr;O³M“ì/á»*ËyŠÕ±=å»gÞHU÷—Õu]ʱ‹AUÖÂæ2,Óc”jý/ºîG­q»’ÞTšJ+¾¨´ÐJÖó¤f~ͳ¬·iªû2MsE†ãIÉv*ÏXn’)X‰ñKmH=û{ÒñžyM˯f>3{Î#±ç<wìîfÙ­_¨Qj«è…¡å8ÕùdµÝ7^Ï{ u|JÙü¦Ô¬®'k&È[6c¥ù}É’íÅjšOž劸óºl6NW½Êíp˜ë¾É1œ§YªãFŠbo8L2kÛ=ýŒÙa¹èº’ N£ú×®ˆÖx¡UÙ +*2f{ŽØ4€ϼŽ*HNçä3¯#òi÷‘T6½ è­ÿá ÷7xT»^ˆáºõ:¿ÃZËîx²ev@ÜùœwN§ÄCfÄ…ÏÅDÁÒˆÖp7>W£l÷‡ÐwÜr:§»IÊå¬X¸ÜS\*èMÇ‹‚ï n ÚÄiºŸÅŽÉèÑÎí´Ù·œõêŽ3JÙ|e¹þ‹žëO+/bôªñšèz´*÷_­fu<ز;£T½7N×r½g[ŽI…×ùüœë`(©ÆP”ahJ*{/ͲýG>q9i–½¯fß~ lÙÝ’ÏØ‘ZN™÷‰U³_ŘîÃàõ<&œ.‹»;ê‘ÓQÅ綆ätXBó»šfbüR#RËx§Zã—ÎËáqÌhÙPmEܹŒ"®\†Òzžó(^¥UyÈx 5œwi†ñCé:NiMïƒxØü¦ w×;îh-çT±]šU˱Áô½®š‹Ò¬WI’ñ:OsþJ(>–ÄŽÓö€ûZ¸Þ’£X‰ÐË.AÄç,A…èÜâ»ïLÅüœ'¹œ²ýß&t_Hj“ð2dÞAªëÆ):.Ì(ö¦ãdûqšl¿Ð—ËZÑ ÃTÛay‚ë0Ù}â¹Ï‚7¾¿,ÉyÞSí'BßrÒê¼®Jè=c¤‡4céÔÑÛŠ°¡Z»À2e¦¢×­›Åû–dy¤¦é„Ó±œŠžKRl§Y’ýXžÊ"ˆ´6qÓu{AªùÃè›®iu×a³q*Ĭ·$Ñ/;TëcØ› + V ó gó<çw ç<0ºÞs¹l?Ñxî”k(¶†Bß1ÀP‘¥$Çú¤5-çÃ}×ýð¼ë”zÆfà,¹Þ0Сw˜e·ßÔ¼aŠí¾éy´¢ùE)<:5»ûÉ–Éâ‰ß™,ÃÔš[q}èG—¬ªûL+»Ïƒ²÷9N6ǹîoÐyr÷ hü’ºî7©m9d´W”ªõC+¹ÍÉó=“B"³y•ÌtžQY…“ú(uÓ5©ñ×,ü‹•ÛE­rº"w’›¿E—#BÅû> H~ajÒkœÎj-»ëÉ’ÙEÍç°‚Êê–zÈê~¸ð¹f6­úIï‘€Öþ¥zŒÂåz°ewSª™Œ­ü®‡Û– âqÏY·k9ßô[obÏqD©›ÎIÓñ¢ê}ê–>åt:ÌxÜ6—kV×øœç¹îäö_±p¹#´¬Žϵ$ÍwçÚoŒÎëžVx”Kæs(±âÃ)ÙÍšmóƒÕ²=¨çÇåºý@7ÄßM³í9ìví¿n×þ¦ùs|û£Ò´P§ihFËîˆÐøœ1 +ŸFÙrÇ«™Ÿt$Þ?·cþ/Šî¥n9+6.gÔ÷?½å¢ˆØrÃéÿÓ“Î'±çNˆa88]³™ešÏƒ®ã–Õ¶ÜO;ËcÞ©`ý +aVšOzæ—»ü >ŽÞTšÚ7Os_yM×E³ë»«¶-c(HìGaJµ‰àAÅ£Õu¾…)†ç`£u†BÇË6Œ¾å–Ըݴ:&C{-€’Ú®CA‚µ5«î¹‘!ønbl †iÞ;­î:,V.(U>ƒIE×y¹î t¨Î^–່©42[k,Hs(Ußå<Ñu @¯>M–›…˜©³˜åŸÃ,û;€‰2»su–ãDÏ¡m5ÊuɬI’ù+Ë®ÞÄêŒ$ ÖÆèզ⧕ö“ŽïÔ,;îªmÓ=­n:iVå û[«Ðn˜j¾‡Ï[¿Ð’•¦óLËA±ë:¬¶m7Í®çŽTuœŽT,âÜbÃrÏz¦X^Ä®©ì8í¶M×´¶åŒÓv\ôÚ¦›fÙt7ÓpݹÛ{|Ò~(9/źýPë;ÎYuË]µnº§Oú ŠÃ…½l,H³j}÷¹ŽÖx/“™Þ¥tÆ ™ó9QoÛrjÆsµo;•å—®#%ë™×µW^—5$¿ƒŠÛ qåv4Ë´ßö–-ßÒ´þj%³CâžÍ`ê!£ãjá~T­—bßq\®[nªHíÿ.¥ã¦V¹]–ìn‰§ìNm÷{ϵßEYÎË4Ëøí¶M%ä®{VÓs,rÄê*C4žšuÇeµq;-vls*·kVßr6ÍôýHUãÃJl>VÛöç4Ýü¥t¬îçŠ6€i•l†´:&Ã÷\ûK”]¶œ©˜Ò»OÕªùË«ZÿÃ}Ëõlás×ì[.«…×Å,Ëúfº/œ®åžÙt\ν7NÛþî{nhK6#‹»[VÛsÊi¼Ž››AÄ3¿ÓjátÌë:IeÇmµñº#nÙŒçt¬®Ç³«QÂår–q9ætn׳…ÛMµè8¥5GžçŽzât?izñ˪»?Ä•Ó!õÀ弎ÚrPBm:äôM—Ólë‹ÒöÜÝašó Æ®ÛÉQ\WI’ñ6Ís_¨Ç=YEÛÁ‚ÙEŒ^¸æ•mwÓ4ûc–e¿ +2ÌG¡ãUç`ƒÕVRß|ÚsÁ)ÙCø¥ï4Õ|®nGÃ<ós˜n9!Ô-7žíx¶n;*v]·ÑÛb+‘Ó•†¤ºë„Ò5] ²ì7aÞsˆÛoñâcüÂzgÖL§# ûkšæ¾±ª¦ƒi†ý)x]ø NžÌ,°lµ… Ç{!Ý7RÓs'r²ØRô¸ÖzÓ±¿cØÅ°é‚ã@å*-¬·y–ãt¤c[–Û™Šù¾é˜ïÓ“ž›fÓt'H±º -µ8_l)G´Š–£fÛ2zOóœÇP ¿¼¢ç:‚_p$r²ÖL’]8–§·M§ú¥·_üOPÙ?óôî?†Þzrê¦3RÑr#Èî[Ç0ì2Óg˜é~3«ŽÛö¤ýÔmÚO´šù\­|.›Ë%«m¿/ŠÞ[µñk(4þÊ(Í^Ùq>[x]˜|NÊýÒ]¤\iÆ®Îò½?ê™Óu É@êyßY@Ä•"ÇŠmœ®ûJ+;Nj•×M«du<Ø2»íü‰gn×ÃÃö#«ë¾;f—½–Ýñ˜ó9`s¬Žk&Cê‡ìn +h^÷Ÿ£^ás/JtÞz…ËñÌëŽT·1ꦻY²ã†ÒvÜ–ÛžKúiÓ%§ë¸>q½8¦Sµk9'šß¢<ïkšë>’Úöoµñ¹#¸\×.WÅ®÷(GòÛï ÷Ÿpº&|n‡)§ËaÂå†OyÝ‘Oœn«NǬ¦õ/ÌrPª¶¿(Óùã9Ó\û“R¹ñI6c&ÉŽKIŠë/K3Z•×e¯cwÎj¼Š]ÇñlãuÊé{F‰î÷šó»—b™:vW%¿{‚Û)ùÀí”xÆîŒ¸dw×ëÜ.ùî› ×û:è}‰óž¥ÈöW¯p¹( x\õ*Ÿ;NÛ{ìuLŽJ5£3JÓýe8ob߅е¿éGN‡¬žù-„^h*G3]9…ÓY­cÀ^ÉP”¶å„S³?H=Ç ©f?óŠ–CNÍrj¶Ð\ìxÝ\eþ‹ò,ײ$ËÉ4Åþ¦Xÿ¢ ëM’]º5›îï8Åy7bûLòMgŒÆï–Ô6]Qª–³Š÷&Hð}癎ƒZßw)Fôœ0M<סÈ÷AÔˆÝ;‚`<‘š–«qžû½(Ú¬ªç<Šap#D3¿E/¬?¡ãÅ“Èù¢Ã†ÕU’d?‰Qì·i¢éPð®Ö.01Z›ÈÑb›qŽåX”b¹#Øý䨵ƒ¿ÞZ˜a¼Îœ¿ò˜çFŒ]o+|ak'Æ1Þfɦ:ç°Y¶ëXŽg¿0œß@£u†ÓT÷Gät­¥àuÝÓ¶ÜN¶‹meŠ…fC £óª^ýJò»ôÒ…R¶ !Ö†(7JrÌæ‹®óÈé{ÇÞ»õbø^‚Ûa”æ;R +—£iªõ¿hz/F’ÏY¥÷Ìë8ã$ï}¸m»­vÝ?9Šë/Ès~9uË)mÏꢀætL?ð:,ö}wR4Ó}O¶~(eǹ,Ëùæ;n)Óe¯s: ­œÎŠ}ÏU³ï9®6^G´%“Á½žÉ>årÖ*™ÝöZf'´%«[ò‘×!ñÙa­g2‚N¸œÕ*ŸãÑÎé‚ÑvÜÏÉžã‚é3L´>YeËí@Ñü¤9ß1ÓWf|Òº–ƒYžù'G³>mÏ=«o:åš¿Ãl÷¡TyÝr*§sFÉêœR³»gÛ­ÊçS8Ý0 +§>ÝsNë[.ˆ¯«^ßrÉi{ŸÅÆåh”m¿L’íBãuOêÜ®øœß‰Íø7_g Ã2œÌR­oIžó3Môžy]÷zàtB<ð:löm'¥–  æ˜&ß²ì.)eÇÙ,Ñ}äÔm·ÅÎgiÉ€œ¶ãl’î=2§[1ªå8|hÿJQ×k²ýÄ(Üÿ¬Îë‚xÞqI=s¹ ÎDxÖ«È ß]Žë¸'5NÄ}×á8Ç{@.4š%šî“%“±¤¾í†Qw] G9šñÊ*›»UÛ9±è¹ŸÔWÓ<÷§V¸ŒÞSÜ‘Ã4Wä‚#ÁÓrÃà$©=B§‹ÍÆyî3¯k9ä×¾‚Dóošë9—ä¹C襻†Á™ Ãxå/Ó$ëišç¸âšn€ *µ N˜Úh¸ÖJìxµ½,ÍúÞ³MGŒºë|ѳé¥ç4Ùq?0þ –†˜¬59]n,I³¿¦‰¦ã9×2Lä\±YXIb·$Ãê%Ê*º.>j X„ÖX–ÞZ®Ê\iþ±ŠŽ‹jÍr!tšà2Ê3\ÒªŽsIŠù$lÂê$lÄø2_ú/\ œ®´ã´-g¢ô¾‘ ½mT«\ÆG‘ë­ƒŽ”¼Åp MDùõ¦¢ãW’âç[J%³êqËýð´åœÒ³º©õM—b\ǹ Ûr1J´¾†©îƒÃy£ø^¤²÷Z-¼ÎUÇý m:^N—Ódû{OuœKŒÿŠáUå~‘ª¦ãÙ¾Ðç(þ€Š" +Ÿ– áW½ƒª36]m C0¾%IÖ¿0Çúß´'2ôbë0#Õ6±ã•Ö1üâCŠ`üñK1Ší,I´ß×ŒËø5áˆ@2„æÀDiÜÂ÷¥“Ð {‹ßE‚潋±º _Îä8Ƨî9–£y/çQŠä>‹_X=¤øÅ‹¿ù_¿ ß$»w^UŒ¯Á¥ +NÅÐhBLÒ„NÕ™Š^ØŒ2íwQ’ó1˱þŰ«mImûyQñ^ÄÎUš„–+48ä<ðÌ'¢û0KtÿHU˵4ÅàV˜Þ¶£n×Á •Ùœ¬±dØZô‹¿’û0K2EÖŸèU™½Rµ{Xoˆ1l Œ—Z.59ãü ’M—óDËí@Ñq0Kt¿Uó‰€Ðý,Sí#:¿½’Àg €›®'5ߥXöKH>ç—BÝ}%›ŸbDïCˆc¼‡p¬Ÿa¢ãnœj9eºO­ÊçˆÑ·_}û´ó;#î\Fqºæë@ÑùhuN—´EÀÕP¼né>7„ºùS*™TjFW“œûO²:îõLFÖì‰gÌnÉG^§¤¾çPäûÎóœ—bÛ~‘"ùþ’T÷Kˆæ½‹Þÿ²<ó‡S´?Ë]Ûù´ïŠÓurÊžÛq²å`”i>1 +—cJÉêªÖ²»"îÜî«HN—ä¦êiÓ1«î9bô-­Îë¤Ô²;(•LÖLY,™ *N·¬ºãz¶pÐvŒ®I•Ó%¥sºžóÝoI¦ñ+Èt~f©ÞSµl9¡w\ÒÏ;.¨§í·fáuÍ*¼mÏÍ,ÙsÂò>ÅøNâ&Œ?qƒöÛ Ë`¥š  ¨.•%Ø›G0üf“”×ýšcwÏi™`ï¸Þs-'œªãzxØqVFé¹›f:®fÉŽ >ßsÄç¼.èŒßŸñ»gÚ/Ó$ç{Pµ?jߥn:•$Ùþ1É Çw—cznÅÈ®Ûy¦çªÛ´Œ£QY$ŠÜ@¯³ !×Û„—¨³.Rg`¨ÎH耽½,Í{gÖ<çAIMHX .4ÁðÞŌ߂í4Kµ\ЗAŒÂeŸðÂ/7›¦¸Mç™æ¿øó)tÄù5b}ˆ™pÞÅιßbtÏ ¡o:çºÏ¤ºéV”Þ;*² 6Zh#r¾Ú`¿y“¤Ø^x ÷Ø0¾#Ê­:ð¤'x[óã׌â—Û ²Œ!’ï(ƳÞ]Ïñð¸gô¤a> _Õ  \Œ2§‚,ëGˆæ “Ü?^Í÷ìÏØ>ós )†é7Í´f¹¦kA¦éZðÀx"9¯’,çyÓ2^;äµmËêœÕ÷ MCøµwÈÁ‚ã8Óx&Ÿ9•<Žˆ'>ÄË%ñŒÝ¥n:B0·7_n(lÎþ–ãznI…ÓY¯ð:çtLÆõ:6ãÈ^‚üB{Aô2{I¢ïÂæÜîåÈöà Õ~¡Y¿£$«{ê9»ãÉŽÑU«duHÛ3>(›ŸÓlï‘T·_8UóÓö³ê®Ër×qQ./³,ߣָ]“M÷Dûg–j¹$•m§¤ªéxQ´ßEyÖ£j?Ê‘Œç5átÊèØ3:¿kJç2’Òö‰qœFÙsÛl¼Nê‡LRŸƒRÇêªÕ2Ûk™ 'u^WÃTïPw\Ðv^Ç“•ËM­r¹huLÎhkVפÆåzO¶ÿE™æã4Ù~bÝGVÕ}çy£Tó©Õ2\¯dxVã26|Ý» /µ 4-gB÷-¨xë;ì8’ ÜnåȾÃq¦íŠÔµ/ª–«i¦ûÁh[®×tËA«ñ:­~WźéžVvÍÓÌF×q5ͳ¾ä®oø¾u 1]kT°Ð^ôÀt+ömGÄó–ᛎó$ÇïZ˦s^Ñt3M1Ÿ•&¹Df 2Th(O.üGr‹mD fW!ÌZ#ÁÛb“q†ý)~\õ7Zo.|aõä7O’ «³0½ôhø>Ó4ësœê8•ã™2,ë[ôÆø`šÏ[ŽÍ`Vá2¢[´yMÇ%­k:§Õ]‡ãTËÅ(×r-Hµ?ŒÇaºã¬Yw]OšNä˜ÕFBkNÃD÷]–ã=ˆ1̾1ô¢»v–åWßqÄr‹q¤2‹QÄZ³`³o!Ô2‹bÝ~ßSíg9–÷2ÊsœJr܇q†ù+Í®ýMÇÁ(z±½n8δ>zu×U³ì;šäYƯÏøœgy¯¼¢ãfœaõ.Dbcxmç9§#%ÇÕ<É{¤5Ýf×q[n{nŠmÓÙ4Õr8Ìv R]WÃ\×q Ãê(~Xi(L/¸/Ò».d(¥vA…éÝb§Û–rDãaŽk¾MRÍW)–ï;M6ߊ}û™~âtÃhzœžñ<¨:®DØ–Q£lÛé@Ñü™åºt¢€Z-#À{ŽæùeËyŽé&E2œ‰Ý6ãs¿¦Ü®Åè¦S)ºãŽS¶ž‡ëî[Íë¨~ÊîŠQxœR—Ëbåu½(º¿Ó\÷g”f½M³ŒJÓû¡ž7]”PÛÎfÖkéZ[±#ÆŸÛt&öÜN§ãTû‡RvÌòœ'Bãu-tÈu5ä:G/Íßà¥ý-xã<ŒR-·¤ºéŒzâuDÛ2;$îÙ¶¬NH[V7´×±Ãô"˜ )ÇA­qºí]–ŒŽ;&·¤ÂãˆTuyM÷‰T5yEóŸXu_(U÷™TxÝOö¬Öë|†rú¶kÁ»ŸÇwžž4]MÓË1fù½ëN„p0H÷Œ#•=€¦u}·EÇå<Õ|mVN·Ô3v½¾å~Qu_F¹Ž›Vç2¬XøV¿ûAÕ}¤¸ŽÓTûWŠj9Žš¥˜¦óè…ÙSØX©mÁÞ~Ñô^I=Ë©Àq’WxI:{¨©"‹pâÿ0Óõ6Rûaµì1ŒZpH.7©×>Äzé-ȵ)ZK౑óõfó,Ç ­e µ[ÿQËøé6׃žù*Dv_&Ù–;!®ý2H¸Ý 2‡E÷•Ø´_ËeÏ ù´é’×´ß'Eó}R´fyöë,ßtt>=a; s*þ‚XÿÁÎåªÕöž%³-«l8ž“×i®÷Ã'»ÏŒ²ûϪ»ï‘ä*Û8NÉc `oDì/¢¤2³Àò¼ò°½ZAr¥yx +gH¡N¹,©Þ1ˆRcH´_ 1Jn¿-6æ8Oœšó=Ûõž)hÝïé1ëµY¶G°ÛVRáoÿ0úŽó=Ùüb“Ý?>Õü"ÖY)Ü.JP +~3í‘ÀáJ#QÆæÁæêL„¯ ÎAÔJû(j­å@½ø ¥¹Æ#^&¨4£DðˆÚDŠV¨¸ñ‘àÅ1ª‘i*=e<¥8ŒåÓ 5KŽ#щ’«ìd¸µ¦bgªŒÆ)Þ'­é8$ùŒ%U]Ç’ôÚe˜â| +Ÿ—‰Ñëö¼¦ãÓs\/Úåæ“~ë¿&šïH…ÖäŠ]ªFí 5=b"xVpŽáÚÆpjNrÌR+aó$¡#%gÌBÓÀ%=ÂgĆZ©eà]ÃèL»†CéG¥·È“* D‰åv#ýâS‚Gí/h²#x=R.S/2 u 'Ų÷=ÛwŸªˆ­÷:•áÔSe» +Ï(ž@„’àqŠüä!Û‡V2ßEï ÎCÎTY¦8(X1 Vz¾ G­´)N«dàØÁ †ú¤Ht–`CÔÖÐKSAœJ#if­ÍP½Ú¨>b;$P’*|Mh'¸mІKRßwŸÔÜö¼ºùN?sº²’›O¤më[„`fDçømÇÊeVÅb­c5¤u¼†Õªá€¶q¼’Ï;ïãS~cAlZ?P©~¡§Ü[nZo¬’ï9\j+nÀÔ^øÂÐX’aiV®Z?Ͷ÷ 1A\€Àƒ‘%“ŒQŒ†Õ/Ô8•5À"çH" 6S®j—<Û3ncaL$ŸÎ>>hº÷?^Íôi¸íF^;^Ët¡Ÿs]Hü†Bf»E‚76Ó[KIzµm¥ÆZ _i!H,²ǨøÆòéͲÔ"sZÍ94Ÿ&´\³b`o&¿ª5a–›  nªýÒ‰Ú°5èöË&$ëPr½ò#ô%³«õšo½1êîû˜j¾ñ¹æ©j=‹#•›…:5Ç©V¡Å ¡b…° +«`"µÂ€c)ÕâWuÓëC”[k/Ò¬4”(Z +#”C„B qÇk.~Iæ ;@a6Õ°1’%W|h5Û‡~Öû/$öݬôΛ™Øwp’[/Õ"»™~•!ý¼÷B?뻹ÍWý¢ÕD¿jÇkù‰5Ó•S¯šÓOôÃÞ«4ÁÖ\ü´Öt’ä»TêÖS«í½ÒšÞ#§ê}‹0l킎¤”‹« FÍѹƒ®X6IqFSRŠO!~@à›©mª-Óc YdP­×™–’Žˆ»±d8göLâiã“V´ýÊ5Û±=ä:˱J΃rÁ‰~Ð÷™fÖŒäÔ»W ¯½8¿Ô^œ_m'L07h¸¾Ñƒ‚Wðl +aÔ=^ÍöænC¨¥&'ŠÌe ~#òaëÃŽÜú+!yÜ/†FT¦P#ȯ8﹆“VçüšåÙ^ãÛ™VõÞ‰-׃„ÈzŸÕj-2Ù3JbH©YŸb‡* ˆÖ¼AGó‹‚¼% +Ac7™¨TûÄ(¼¢(õÎPÖ@åêU¢5j·ÚB–Ló +8ˆP¼8:µÔ:ôšÌ*è±#ˆAãã@6|ìø •‘X°µiVZ6Gê“c˜ÒzÖ#«è}ˆP ?âf‹þ†çپfflâtVCoºd˜ÂÆë¬F©öq»˜%98U¶Â×$§ósæ è«âÜ2 a“4w`…TÌ‚?å/Np¿-5”¤®é…[Yvé7Dl<œ<H!ÅÀÛ5àÍ1~Lr†Ô(Í/¶åVì–$”Æï4ÃêV€¾$I®³a•ÜD ††# ¯ ý¨ëTCî½4{Æ«bkQžq$Ùô4*—0¹Ô4ع˜<½* AZIP©rY€ùO@¢¬‚@ÄgôezS BO`9Rƒ¹Ú\žap,P¯ú³ËmHßw ^7£ÜfĆë@?æ;ÔÐ:Ô†ïÈì8¿íAó‡zÒy"7?YUç}Q´¾'%ç»Es»ì–샕†¹V½·=kü RìÍD UܤvöñSK9~Ý\˜_7 ¶š-çyÕ¬ø‘ûEÖ K«“´>±C%ç~¥± Åt£3lÇ€EOˆ-Q=¦5‹³ -…z%ÁfÁU¤[òá5LêQÇý ÷ÛŸq݆*†öTv; +J׉|Ø{›h˜-G +fSbÑô$öLú‰ë}¸è:‰±Ê]£C Òºù:Q/ÛFq +Na¦ÈÜâw5v¢ì¶õ¦à:‘yͦó-M±óªÎG³i>:¾û¨c¸ßÔ\'âÇ}1•ïÛ!o›ð +f‹bÙv±!³¸& tþÊCÎïHÉöŽ£×Y‡œ(w‡'÷J2ŒíyEëA¼pÁ* qNµøIÉ5¸±'ð¸‚+(á9»8J­ÍX·à:HÉ~AØ(½(¥â"xJê9K뾨· ²ëÌhWZ繌Ü|¦6ˆÛÞ#±óEëîG5á$»k1GôýF©Öï8Ó{ u ÷䊹¹Ø úV Òt:©Bµ‘Û°6g\„“ª×#G§çù üå‰eF’,r?øÀÚåØt‡® D¸4JRªq‰Ýä~߆‚Êx)w\Ïò ó4R¯ÛÑšÖ§í¹ ´}Œºï|ÍóžDø¥¿zÝBŠbn>è˜-:uË¥ÐÁJ{€â–PÞøy­}»o"G18Ÿ5\‘~½¥4»ÞŠÖ2#x•v"øôna´"« “ô® dMA)Þ¢•änÕ5xIf)¨¬äÚ4äéRëe»gÎmù-ŠuËM³é¸¥uœ_a‚µY³l¿{¾'ý´óRAn¾WÝçAÉu›§ùž²ì¾8¹ÐV”Wh +˜ø% ƒËu 2[N• XÃ4xÑ–Y •Ȇ?VuH$ø^ÒäøåvaÆiŒLRœ…pk «Uó-ä½K”\lC>ëþQÜÏUï3¹`;/ûE—‘v½‰Øy‚‹ÉöœeœÎ9Ïx +rËè"¹å¨ZqÈRŠm²Ì"ëÑÆç8r¬Ì0ÑÌJ 5+ŒØKpÍWFÝþ©!·¿Xí²}ØA› »ä=Ù±º”b\ š£s‹™£1‹*ø"Hi D˜Ø/vÂÜVäDÉ3h!ý(}ý°ai$C«±>¦1Á(3¤–TìMx ³I©ë +(G¤=³;:år#Ãpý„/Ë †0ËlÃh5öÁœz£0›ÖLžM¨pµ4´pÅ8(©‚mÈI‚àµOŽQdNU8”`ÁÅ †›žn %•YSêŒå©µ–-ç—ÔuŸg»îÿð¬ûM¬ù®åIç­@æ~MÓ ÷ÀŠçÔ&RŒ#•ZEéµ£èeÁqˆz‹€ÁŠSÈT¿ «<ÐdÁ6ˆKî 7Ó­¦šG¯ §k;ïÉÆC¯k¾u»ŽËr×~¨!¶œ[¾+­ê{0оÇ0Ãôãw-&©ÞŸn9¦U·ñƒš'°B 5!…Ìuf"8µ¶a&il‚ +÷Ì‡È Â7ô¦€#„ñs‚»(j­­f­™»ô%½®õ6M08¨vl÷éIë…|Ð÷mÙž4d¶[}Âw’f•™ +Õ|Ø|ûP²Íé[F;öK³æ}3{¾?µg{VËæ©à¶ Õç©Þ5aÔ|_1žñ p¾Ø\ø¾õ¾­´åÕ³§ 7㜫@y4ìEÊE—óþ@„‰ÁÆNÑÁ%>~OŒ›:ˆAFQèe½*Q-³_¶K—~½qðÀÖZ쀱½(ÅõæU­úYóŸ†Öû­Ï9/åžó?>kÿVû®ó=át(Åt%)¶Ã4ÃÔJšXñ(U›$Æ6¼†¥m£Ô<)¸­f™ÞÓ4Íø¦VŒ_j¿vD¬2Ш +/Ï$“'UZåÙÅæ!ç)m§@È0ÂÆè‚–©ÊÓ*M&šÕ¦Š3*Æ‘Ê,ã4³Í0Óu”£Î8eï¹[·Ü‘Ï{n«è-7ô£æÿô¬÷>]¡ûh;fǦÊlƒ.y Ñ›Å0‹ H%ï…zØ}-"x\‡•&S‰—lÕõºÎiÏdÆëZìd¥apAjgp±*»CEÖÂWU¦Ý¦÷Îiº/a…)^‚Å >¢SE6¤zñ;S0¿ä–ÿV©Mx¹Šmx±rÕ,¯ÆTŠVePª^ A*µÅ-·À)3Â)´:Rc%E±7hYckÃrÅtšh×™¶‡jû­Ø¸ŸŠuïU´ýÆ– XJ²j,y×5qVi`ÂÓ5Q^±ùª^÷൫VÇy&ÖŒy~©½0&¥Ü0µ¨÷mDŠ,É¥öÌ–õPCk9¨¡õÜ‹æw ½Ö:€bjh¸>¬ŽíÏl9ÿÌžù"t”æx—@’Vð ¡&„SLŒÒdªæ#zVcÆ«˜Ædæg1…õ¿«×› 4ìü¾i r£Ál¼'úþ´²ùSlÛ¿¼¦÷VnšO²ä:ã0f•É,Ñy•"»ß!æJm‚J»ƒÌ|ÅŽ›„!5 ^Ó;&ºÅv'ë…`„éÔÆH¬!æ'LAÊÓ šè²‡ b5z{H—Ú¾,˜Ð¦ÖÂ85¿ÃÄö ~­¡lÔ +Ÿ3ZËyä•|7bÅõe¶l'òi÷W’^j#ÆïšNÑü$Îd –6¼ŠéWŸð]§êu«™‚•5µf:έÿPcg´aj•8µÊp°Xf=Ÿ©²ÞOÕ™ §R[ðÉMBÌRCq³$‡ÐÂcÆÀ3zwð¹Y ¥ÊF’[g×2œÎ4ÌöÒ»ý m½ÒªÎs¹î8îö=×ÃuÇU¹ýUEk½’ZU„Æ«i» Rüƒø¥ÃÈ…&’ìJIv¡±^·)–Ù…$2MS¬MÅØE¯ÐÂtfAæéLO +-EPÊlãxu棆é¼è˜žâô2£rËn €hñ¹ÀãHÕ"ˆµbìÖešb|ôúæõ¬õÇlwmèÇüfĕӹÈéjûðBuöôÞu¢ã½Òª–ƒ^Ñ~¦vÜLôkÇ'ÜօĶõÀç. Qbo@’´&!³¥ÆBLûi’j¹èu=Ç$´ž{QV©=âÆ§7 «%iÏ@2ì¢KPr%'ÃÙU „j8HjšÆ¦[²^ºßM—Ô¼«×­DéÕf¡Æ¨} vÜALѺ5ë‰xäuCº%ëµ<è~Š ”¼e–VÕª÷/K±û,ª`t -i‚wñj³ŠÁM·gúŽÔ›¶aÌûMË÷(óÜr›‰Z¡Å0"Å+¸P¿ˆ(µ @™v¡8¹Î:|Pn +0<ÝI¦õ†jŒEq +íÉå&óã¡Ùtܺ%ÔŽcFÇùÀªøóоCÉ餀âuI?l?³Š¶'§h»óо§é;óºÖ7±ê<òz¾ëHÅô˜æ÷^r«§f¡ ½ÊŽ×óä˜Å&¡Å(.Çj­ƒ©4\”æ!É­5¬™¿óôZáKÓ<¿hb€Ð6M/8Eócšc; 3\N×}a´íWRÝý¯¡±}Vî7Šï7ËõUšFæ÷þ¢—Õö¡F*­cøUGVÑú²ÒfbÃ%«bmlŒÌ?)˜^Ä×Y¯q;ô¼^ÛrN¬º#8eöá†ÊL}ÏÅ»v6®ß6Od!¾-·ŸW}EN=ƒ ¢t—hÖ/R- VŒn{c!œ*«y†Á¥c=ÎsŒ7NÑýŸŽCŒTP¾C ¹ç¬Xu¿Å/ŒíEï+MeX¦¿,É÷eÖÜבŽõ0Íï]ɵ†œªë<¤ü´A…§€ L8xJj’à(|_o½è¹ßósöó¤Þz r Í™Ókžcü‰LŸqŽïÐ+{ÎG+—¡¼¢û¿iob‡iŒÅ(ýÔ~ï2Í.ú$R±8°h!(±CÄÁÉ™„ÎÖZTì­‰EóC~Oq6¼ðe`òYRÅ7Ü$µ)0ñ1;0RËpÓ$ï(‚¹ñ¨û>éØîÒô¶!«h|6û–kák#±£¥fb -ŽZÇЋ-hŸãjÝs XŒÈ)zTì¤õ¼7VÑs.˱œ +œ£1 )M­ ++×.,‡–£óJÑ«fݪãd˜^ô3Tl 8ziH @„ïhƒ#5O:îoÔüˆ ±Òô€³ÕJyV­]0R”b@…Ì–¢ +8\±C)²bVZ¯*vïPBYØ B—0³Ð\ž`opšÆ$¼$Å'Ä0Á;°ab÷¦ä»ÒÏÛ®)ˆMçÍJ+Yz¥Å,Çû>,·¼$ù&÷ˆœ§w%öGÑk ¨Gb‡)nÁ 7<Áeè CÈõB§‰LCœ„©å–SÕ¢gÙ‚;xÁj­8½Îi†= " “t6Q~Á%µa=’ûgÜvµ “Ô,D.9ÒJƃ·ÔDèlÕ Ûý§4>wŒÂç„ѵßx%ëƒX1úÈój,xõ¦aµi~ÇÐ ÎÃÌÓ\ƒ­·ƒ¦9)Aì RzÎ G,5œ¨V…ò†¦øSk¦ÚõFĆõG,¹¯åAó‹Ö,²Ÿ²gúeZËpM«»O£4ÛUÝ5%¸í'-Óožå6¢ío4ïûše:ŒQ¬ÎrïOŠåþ “m×{ªýÎ+Z/¬Žé&M/3œ©›k¶§èü†%7XpŒ˜Ûªîk³k¿POÛϬ®û/jžÞD®YJ[4*=®4Ô°”Z Â¨%‰uœA +šωŒG ã[¢_l7Ö°´jOÙí%ÓGäh¥¡Øér{áƒF×t×mZNȧM÷¢üJ“‘fÁ³ŽÔwcô¬‡°õ2‚—D „N™pj¾o±ë>†:<˜°B†DØ´žq~ý^ŽÈð€‚Ž1h‚“ØÉjë5Ñz'4X°bxTbÅ*…ÍžñQk;nΖZ&@l B|Ô`¨Ê€|Ð{d” +-ƒ(N"¨p‘‰n•¡¡Î>̽9xÙ’3‘z%HIr=`‰†© .½‘Ü-ú l8B +t«HýÞ•Ur\ÈñJ‘ÊŒEÑê,iMó§‚âsÚ¬Y¡EÛÍ@#NfÇù!¬‡ÑËRkÁãB~é^¤Æ   µƒQ4_å¸ÔžͲ ƒÄvQƒÅ"&ýáfhíÒü²[·i»Ÿ’üáQGɤRƒ`âüBÀÄ †‰”j)Ê,Ã&9Nì­¨(¬¿±f¹aØR—:ÁGüœÞ +°h^i€‚ôFáÓj»zë\ŸsÜ3köû¦`}Œô« Ës¾ó–Ý;Ï0^¯,È8Å9‚]k4Í0·-÷ÌÏrËûD(xˆòjìWõÒ;Ü0É7xBkðòs¶PC¤Ö&è,a&éý¼:;b½xt@‘r𒽂¼š‹Ø2» 3äþÀs;1”*arM³í>Ó«-èL⼊kµn9$õ¼OA‚µy ¿Îh b7g—M¥ÙmêYó‘T°Ÿ˜¡µ&ܰ Jxº)zVib”â°©M–Yk 8Ei6°41(Áf]˜1bc !RÇ0j­‘,ÁÞ ÚpÝȧ½çò íÊìø Ë=×_˜ß6¢·í$Ùm1‚­©h½5«¾/õ¸óG=ïüÐOû~^ró¯Øsþ„¯J.B c;A~ë>iy_¬ž÷ÇêŸÝ²÷.ÏîÚŠ³»ƒ˜e&"ô¾¹,Çõf¸ƒè¥vr ×c»o0H2žé.·”²ã& $±!€ü”IÜ`¥u»vŽáÃL“<ÔX +³[Ÿ™†¹U{ÄoFDe·Ÿ¶{æós¾ñ¬ûÁéØN¼ŠáªÜsh%ç©Ú5Ÿ‰5Ó…zØwaUŒíE)ž!謂(eö¡¼B3Iz±‘(ÁÞ<ŽXiH©¹ûõfrüî'¼4¡iÐB4GÑÃzCI~õ/M±ž÷Dóuœè½OZÆ õ´å°ÛtŸº=ëÔt_Uω½÷fYõÂÙ8±ÚB–Sf6T.4â´ŒÀ!„F€²Êѯ T¶è/[4œtJ3«ì'[ÆwðP6Y!Õ8Ãà$ ð ‘ô@Èt‹CÎÓØ•ǬW +2׫ÚrC(5?Qn½0¿Ú:˜yŠoà¡´Ö€ÕöÐIë;rÒ};_nZmÚÏ1£í>°e¹A%[u”žãZìhµ©èm¹¥ðuÑ'Ùšðx~E áñ +µ]h'xAk5Ó¯F¡u +äÙGRk E1Êl…qªŒÄ‰…fÒÔj;ar½¹(V¡YÀ9B¹Òp â~ËÌ'v½i˜9ŠCPr ?Âg©šÿpßsÉ(xÏÁ†è=¢÷$Ÿ‰vé;Po]§)Vçr©m¨r³RÁ—?\l9M§9.„K T¹.héùN 9RƒøA•±(R©‰,«ÒL–UkØ`Ã"Ò'8Í5KMC ›QDo)žâÔRSnÃtí;I=ï_œ`¸+Ù »-ïOü°ÎRøªÈ8ˆZg@*¹¼~ß–Û0½Ihí§`r¼J C˰ƒ‹Ëü†‚W¥ÆÁ)Nâç„f"•ÖB(µ&‚—'у³€„§Üjbì½8ÅøäÕ¬¯‰‚ïÆ¬¸>D4®ƒ9‘ë(O&uŠ Û +†ã V•u¯Ì@^i(ǰ“ÚÎKÉûe%¸?I%ß=ŒYó­VŸi‚é&Ç07£¸~‚ »õÄýÔl:¬ŠáŒV3åè•Ö‡ ý¢ØUæ’×‹ÏøÜ鎫I¦÷6Lò}ňÎÛ$×z¦t½WI‚±¡VÍGŒ`m A®6;Qe#K­·½"6 _QÙ†úUV$t¦ûøë+Ì®2’d—YÔ›Oä³î «d;JR¬-$ÙU–¼’ßš†Ô÷åTË KÔÉE1ŠÍa¬k!¼BcQ‚íÀi?ݦù6T0¸Ä­·¿¬¶D.8¤8CØ…ã(~µÁ†µ} ÅpÌj»?Ô㎣jÑû¤¶?*è-gÓüÂi¨rs¸‰’s±Ö^ð æÃé—ÞT¶ÿl×ý:Wh?«5Ž VÝ ·¤¸ ã•ÙMìÆåYç…zÐxè6\¯™vë`†ÔTxÂ.zTf.†Zl!É®6G«ø Ô«VͶýKlZ_b¼šà9¡‹Ó2]ªEë“Ñ8Ÿ·lçGˆ]i8O1zTœ/1z¹©bbgJ­ÃSYµ»_ijÁ} ­ØŽÙðFêE'azµéHÃt›hxÿÜšõ=Câ{Ò’÷í«„vi^½[šaj vœà1„Zi:M³~Ë]«q¿PY†ƒR×ü)vÝ÷áAç±×ó] Ó:„N™ˆl÷9×ú%Ÿ1¹¥Ÿ¸ŸÛ“Æ õ°ï(Æ/µ<(6 Tìö¬Êér”m¿Šïš‹œ/Ê‘\ÇYªóU«ÜOÄÇÝ0¿o+„SrgØÛk-ÄMÒX +¡“Z 5 ›#5 +óKí&ê•ÖÒä:CYz¡I±ç;ÒÏz [cqv×R’à·á”lGòió½ˆâr0ɨ7)b˜6O®÷k¾w«ÐHŒ\j5N0\PjÆË@ÅàF”]n0ΰ:IòëmƒèÅæ"èµfâ·…Æâ×eó’í=¨Zoͺå’|àvU@c3„|Ô}œ(ØÍÙU[9zÛŠUòþˆ ã­[5ßGõ¾ý¤ä:QZÆõœãVŽ[w J¬dB©2æ×ZJÓËäÃÎ3 ©ó\Ÿs~Ê=ó}S1ûˆ2kÍDéõ ƒëEÁu˜¥×-*®?±ë}:~³y†¡!§Þ5%Õk %©¤^i†•­(½i%xRò#XPŠæ3­l9+WÝÇnÙý Ô¼ïEÉýf˜žÅðªM„¯*-†‘kíF +¾«ØŠ›ø–Ê'È,² +6GgäšH²ÛÆÂ×]”`ºÎœaŽû(ÉðH ·I™íÌ+øŽb'j …Í™G0l!–÷#Å1% ¦ï@Éö*víB¿tgõœoÑóZÓð"%÷‚¹áDÅø¡UlObÅÜxÓ¯· %Ä©8tÔp—Ä/O¯7<+6 +R|Ö´ø¤9ˆRG˜bkè½IœYo$E*¶ XØd_‘ÊT~ÆĨz™Ð¹SQ’ë;Q³=«m÷«‚æt'>«y„’m•Ͳ[¶å®e”È¡JÓ@Õæ`cçpc5Æbhuv# {ÃjÑ)ø€’…ÀƒÉôbX5Öòô¢{µà6è4™•(¹ì-Î/<¯*¦çþŒå<ŒIp¿$óR vkÔrëIË{ •Œ^Çö r½{ÄÆ[¹eú{¾7õÈët–ë¾JÑ\?žé*p¾Ì†Rs>ˆç-ç=ŠËÅ¡ÔÀh>õœå<ë–ÃfãqÍ«¤–át¢ã7e5m'BßqÛm:?EÄÖmÍdôžkó¹Îs¯l<”‡L§rËuåÛFpKÍC®£ë~ÉoЬj” õ‹ Ujž3FÙt-Kp¾›&ù…š¦÷L3¬Mj¨½W +:×u¨agÇk™~;ý>Z9ÝëŽã9ÅôR~ÂÀd»Û.›LÓÊlæV,Cçï5”d¸~Ä’óSîXô“Ž+^ÇyŽäÖÙs mpÊmâ§E6ƒDç•¶ewJžžÕKnåšï*Ên½cè}zÝLˆa¸§¹N¤Î/­û6FªyÅ¡Æ*wJÒû¦¢×cœáº°Z¾ñRžïÛF²I#kk1ÔB{AäBsüjkÑ çOŽeÿÔì:ç}~ÈpR-Õ¦ó?>ç½K4lÍée†ÂSkqvÛ¦Yô^Šhgu”î ¥õ3Q/±*¶÷®aöl—›Ç²jÌã¨5ÆâôJãQ½ê3̪2™¨ÎEkMÌÓXˆ*5‘$× Ô n#I•æ‘Ôzc~ÝOž[p2Ô)´7+í㘅&“üÞc–伊’L?Qz×P’^¶¡TÊÊçˆÒ2=iEãƒRuÝ­µ:Þ7•b9£4û—Ù²´ܧ‰jÙ'@³½Ãc‚ÜR¡ÃT¦Ì{—$² 4Wn.€`w'Ö,Ä#ž‹à1”‚ÐqRÅÖˆ´cH⎠@:Ï`Bç3 Ò¹ÝMôÛ&Ä~ѨŠÖõ´Ò{Ï‹’뼨ÙN´%“ë +šÇ5ù¬õÍ+_å–ñV®y?²ìJ#RÕýšg¸Y_bËpBl4ß³¿k!Á®Ïö=Í®ù.ͯ5g˜zÞß8Ñ|¡”-§´¦û$Ê­59Gi:Ve)Gñ~º5ó“‚Òþ´¬Y–í,LðÛÑzÎcµm¿ òëÆ{žóUíÚ_ô£Ö#¯`¶ìØûS†Ó¹‚¡¯â7+¢vœ±ê¥‡èEÍ}Ðt?‡©öÛ,Õ|,6.WÔãæoµç½‹²kmÃM‘7‡ú-ãMÉw”ä®Ã¦V ¿åP¿oM®øî#4Ö+ õB§·%³Ër ‚f+MMÔX‹ ‹ÌMxõ¶ýô¤óVDìýtÛe‹¡”j¿D¿ÈZ–bm,p¸Ô`¿ÖFŒ`8"øme~;n¿mVíÛ R*BŸ©ZtK¶£`¸åÎô §cíº±á{–‹– JAXQ6q,“ÂF®N™ûE\uÀ©4(ݸƒ;Jë“~Üs=*2#—Ntl‡i†é/M²ÛÑÖŒN›Ë«æ|OÛÏ“Ûé<Õs4Msˆ¬^‚g…fhe’üjóPf­­H·Ô:ðŠÔ^xÂxRrŪ4F/¸ä7/ͪýICd>ÍÔÉl¦úô^¿pKXýj÷GLÿY½m=<í¸cTG«ß,Ë|e×­ÅðŠLÅëŒ=ߟŒÊyiÖš +¢Õ¼…~KZÑø¢µ|ïM¿p9R¯›Ïêm³öŒí[3žË]ï9‚_h#Å,³Þl§öˆóCAd|¶‡|/ZÃn+†Oæ(w܆„Öã(Åõ BšÚ-tºØd”罎sÝjÕ|ªÏ¸íéºÁ‡È$Æ ¯ËÓ Åð +íNT˜¦· ~K2ןŽÈ÷¦!´þ刅V‚&›¥#Õj¯á7eך + ×Z ž–Ú óËú®O¥óM@í¸"Û01H`§X[‰ò+ÍdéM³yŽ×®Û6ŸÛ“ös!¥÷_¥õÞG%ïg âûoJÆŸ$½p2Mqý:®“(ÁØHšZizHæ¼§³ËÒÛ¢‡Ôar©­8½ôul‡B"Ó¥–Àõ*§o +©œOâ“Á»*CáËBCQŠÑ_–c»4/ZÑu-wgbÏpD¬ÍjNÇfÛt7Rm2JhA.²)ù-ªEçy¸k~Pœ.Èô®µ°9 +ƒb¿EùŒÅÁ½nˆôˆIP²õjáÓš©eûzF‚ë—ÔoÚèkªÍRùœñ+džæ:°bXˆÐ¬4ÅAÔT¡èi¡)­èûuËî¯`<+ÖÇ@»p0†Yf/~_o0~]< 1¬GúYë·ŠÞzâ2Ë}Áe;Uõ!£M·â´âTl‚´Bo­äl”Ô1ŽTò¥¡³=Hýº•FÅ] ]gÊ혬ŽñD«OÕ®õV­:Ÿ# ³9¹õè¥÷~©‡·Q’ÝŽ~Øz¬"6«Eã…ÙîgÚuËD¿o`O˜:ë <§r­4Œì`S ƒ¼6Õ/5©¸^œªý:Ï2?9mË1­ì8é}òiו×2\ÍSü¶¤¶ù=Ø3FܲÖ­Úå¦ùÇ©:cý¢ƒ¾æ6Ü,7Èóª]ú’E5…É¢”ÆeKEä1)¢õ›RPÚþÜ~Ù–Ú1Ü;Åø¥s°¹: )zápžà7g˜šQz†³‚ßäÄÞl|žÞ+Ø©õ+ÆvÂìJcy†©(¹È@–\c½«7gìÆc +"דÚðÛÕ‡|ŸöŒï7X-4ök ‡*ææ£’ëŪ¸.U„æw•Òþ¡žuFÙu£òˆó@í×›I”jl‡«U–ê:#mͳH^fY$¯3‘g•¼cIe&Ò¼bkqz½U}Æõ*PWͨ +3jÁjLî·¾sC*ÛyTp[ŠR,÷<çišfýNõk*Û·@ã;·'í×Ij™Á$½ÆB\e-ˆXò—§XZñ*Vúi뛈Ò|/¥´þké|'fÃuà5Üô£Æ­c{ TÌmæù}û8v¥… ¿ÖT˜^iÏìØ~Ävñ¼à‘à yI˜]h-NoÛ³¬ÖD†{"Jã½Lè»—ÐÙÜQ+íÄêmÔvÕ¢Ü2=E‘Ê ciÅif¹O¢\íäQWùê´Q}cX•º'BIa#áâUsvó1S“qÁs~¦Ä#=aˆÄ$ p|A¤Ò'D<['GD\N)©ï– +‹¬s%æM½ex¢æ'Õ¨øÒ§kFýùž!¹Þ²!¢ðÚ”—DFÿY¿Úl¤_7jO™î#4Ö ±bú‘(ÕÙˆ*>4²rgŸ¶æ>SZr§.¸ ÖéìQm* ‹®ÚH °·0û• ³bcJnXÍwõ¢±ã5# õx) ‡ýÃí`¿ÒŽ\ïZõçû +k{e™]¬Ê„JLñ +;̧ ­V e’D*åVuÉ£D`eÖ!±3$$0÷І3ZÉwb¶›6ä©bs@±V~H TfŠ”p¢‘…¬P 3!>tPBÄG12G †Ì Ó¥®è;æT^[nÅn3O1ÜûÞñ´ù.|Oî `´ÝÄ"q åêBq¸€g=À„ä%‚’“3%1àÐ B,Тƒ—a0:`(¡¢d#„dÐI–ÉÛ ““D£Ô ˆIæê–ïê]cötÛ¦A_m¬Õ†“(l^Pº N*NtðáÂÄ€#(J|htÈ€"&bH°¢â‹ÀÅÅ8A LóN–ÂR‰dÁi…¡N?˜Uä¡5lväãÎ/ýÀ÷]Eoýu‹¾Ç@½l@ê— +„'É:› ì¨PcEãC„ , F` !B*B¸0Ä…Ê( 4z:H Å(ш'Vɶ)Œ$ºZÿx¶È€Ù0¶`6l Ûe†ƒí2*ò²I…¦à.¦Ú®SkÔ¤ +á3<à  ˜@ƒÃ1HthŒàÀ€%^0ðò’!¹ä–Yñ„°ÈØ ±÷ÇlòIï¸d=ñ*Fǹ‚­A{Âp/šLnÃ+Þïª@Í Ž+,´0Ña€ *˜Ðx ÁX@A£Ã(qrQZAÚâP½2™˜r½:±^ àd+PòØ`­ØE0µ#Owíæê…}r·p‹Ê%’Ä% lVœ¸q¢‘40°à‚Æ`ÐøÀÅ/8 Șøf–8‡W¡Ÿ&’!.h„B¤ y‚CVe§‘V{Ô5—þ|Ѧ=áµä•Y_”¼di5o¡‰G‹N¨¨H#0AIFðÒ¢t`FgÞoåLti¤Á1´ÁPøbZ…²j1eêJÁV}=br¡1ÛOÐÎÇ ·ìé¢QºÌžMQk TPw„ˆZ5Áoæ9ÁNJ±|*Å Rá+ÓIç‘iƒµÅÁ Ú*1ýÙúà ÒR±^™7€1*»:±1¸$hy‚Š„ *hhÀA 4ð ñ€h p@"|Ð"D#„‘:|@HÉP™­…¢6«Èý’ ‰Óš=ݲçÖìfœ¦ï@[¸œˆ±ÊŒaNp€ Øà¸Ñˆ Á |ÐÀ0A„Æ T ÁÀhPPAH A£*Р ‚ 4*L(¡Ax€€a¼çÒóÉÜ…Z‡8£Þ?Aà7.’—Z –J®‚94~’’DÆ  lÐÈÀ 2Р!Áh<Ð@T@AC4H  ¨@> h˜ Á€1p,à D(‰¼ø†ÄJ˜]e?*™®¼¦ïVmOÕªó=é—þ!ƪ‰0`ØÐ¡h@ð*ÐÀà  0Æx@Cƒ :h„¢1b„‰Æ‰)ptØD€óã‘€œBQ0V­X4—Ô)ŽLnI+²¤–Ù ´ëÖdz_`bÓ!D @1"Dc 2hHð@<è@ ÐX€ +44Рƒˆ%*œÐØb"&9G T¡,ªÔ¸æê5oqzÙ<ä4¹]­â6RðÚ Ul­áÖ{ÀLT£ˆ PЀð` *ˆ AAhl`Á XhX!„ÆTÐÈB Btàò‚|Hôq çç³@Œ¯gƒ¡ +Eˆk†;¥F©RÍI SsÆ!t†™ßQ&1€&°ÐÀ 4@à +(Ø@ãÁ4$x°Ah<¨€‚†PhtØÐBãC ÐÐ-P0*"ü¨O-ªFâQ!1ˆd˜…ò ]⬂k¸±vm bl¢à +>|àA„ˆ†tÐH€ +4(\8¡¡C $ˆÐÐ@.Z +b24€äEIAï´"+„%#æùh±w²]ó"– gÓM ›Þ-–‚<à ‘Àh\PÁ $ qÀh4Ѐ(¸ÐØ€0è ±ÃG0>‚èXQJÐôÙ`ÇZ•!Xôe™n·bn'TBž®H§·ˆ`Sé¥V‚·5ÆASÓst~Ðñ:` 04€ *° €$Ð`@ 4.€àAã 4$lðÐ`Á1ÔX#XÀÆG0&-MxÅ"ÊŸ­“)Õ©§åDÁpdŽÒ"t¬à&D2›±kB8$F „«1¢ÅŒÆPÐЈ  4,¸À‚„ >htðP¢1¢‰/"B” ÂEMT^¢üˆFˆH% †Ç¤PŸ.,“¸ø³5/‘ZÍO›Þp¦_PÁAÔ€°A  à@ã€&ÐÐЀFP ñ`(ÄÐÀH@A£B'J¤hllÄ ’"d`熡élZa©2¹3{ÆèXÁ.øˆÈ"ˆGé@j~ +ÐÀÂFCƒ (à€JhXð¢Áƒ .´Ð(bFƒÃ‡`hPࣀ ;X‘™*Т£u`ÆXÔ¡Ùƒõ¡];©^¥[±Ô;Q4½ÆYÞGˆá!KÀòK*`D‹ +`h<(À€ÆPÐ°à‚ HAc48„àÐð¹ €ÌMT!;Ï% FŸ,«ÜŠë&!ì|nÅH5—à‚õ^p"í‚rÃu Ä +šX„(™ñy„…*á„Çà òâ8¯Æj¦\hA+øM'J¾—$ÅÜLš[dÌ-x­‡G}JÝü%Iå0Tð—ã¸Î­ŽÕmÛq/r´]|`A£A4pàF ` ‘@€á#+PRf¶¼àðt@&›€*Uðñ„82¡9œRîÃ%ô‡P‹ …S{ƒH5Vså:‹òŒá˜Z1ý¤Yu¦É 0Fˆ +xÁR€`@Q”ç&ÊRxa€bÅN$PØ8€BÓ“"éc.a:sp³ à9µežb8&­/ZÅõ&ZK”+Í©-ã×qý'ße†Ró2X®PMb˜@ à ƒ<À ±A°ˆ¡s ;xÐp#¼$£6«]% Û0Ï r gÒÇê¥ö±Ì2[!ä:ë(~•(Ã̦YtÝ8ÓQð¤8ÔF E‡R"ÌTp ÀÐAä€ ÅÄX™BPÒC +!¼†Q·åÃíxB°ÚÍÀgõr™bɵ>e<ÏÉu¦&è;Ø”Æy~׆PµmãV2}cHD¦pÅj CEj€„84"˜`‚Æp0‡Ž/:Fä§$UL­ zǪ pŒQŒR-Y q Ð;E3é¼ÁŒR ·`fS ®[ËņBm’[ðl*€Ã + .ÀЀ@¡…Æ ˆ €!K8V´è±`EŽĨ¤LÐÁ²x\¢0lF}hòtO°Ol—«ÕÙ†òišïP½ØP¤Tf‚Üo(Â"`~Gt°AD£ ¸`YÀÅÈS‘•+,/Aˆ”\ ˆ1âÀ‹"/8<ôŽMŽT¬ B-˜†cP˜æQ—ÄÑI,ó ¯I¯p9éÕM'r¬BÛ ÆÚ]À„ɲ€ +"œÐ@à 4 @X0Aƒ‚…#@´ ¢E/BŽ  Ôp¨A.UÐsFp‰©X¥â0ŽTcJj{?R ·ah‰z[Qb‡øÀÞ„ÐqQFf9¨"4ÝI“ê̇ k+òió·Ùv¤èu³ ä¶C$þr•)§ï½|ÿ…ľ_yÈmÀ©6LòKÍ*H>'V4&çƒuïKÐ4¹5¼¥5Ø(±GÔJ¢uªXƒÎUüÁlšs,«Êb±Ð@Vh&M§±C%7Kt MÉ#öÖ#$ƳFÍ%€QõÊ Ï·ø½ó¦cæjÒÜcÚD–¢™o±|Š›H«æ¼-׳Çû† +ë]œ_k$~TðC¬±Â¥÷ÉJÍCú3Ç`§ØAŽÓ5?¨ æW‡¥µ¼Ai-otv#øª`F%7 V+í æ–ßO’[k%G±6 7Ni ´\·bÛþ›¥÷-æ¶6üR+r­¡øM™Í8½jJ<ñ¼ Î/xØ‘¤Ö«]ï¶ð¸¨5·Š©M¹a5 rSP{ÔSæß©â8Ì.2‘"XÙ‡¦ôˆ˜%õÆÎÕ˜ÈRK%:•†µbãU¿è<–]|L󨛒Gì­*䥻8·ÒV_n8ͳŸÄÇ¥(½ÁÈ5ljX$Zñ)4©S£çPÅêͬ¿´†ï/Å-7¾©5b¸dC'yËó +MèÝ¿`ƒ„¦q†¹qyÔq;Ïq~E û‚Jøƒ SûÄ ­ÄøÕÆåQó}|Ð{¨Û„ŸpÈPê ¤†ëÑ,y/“œJ¡s4¯p3äîÐRCµá¼‘ê,ÅÏÊ qKí7-ëu bõâUZ‹ ‹³Km˜[K*"¯= µé@é¹n’ü²‘ ½l%Ê/6 5Œ'^Áø'UY +^’:$ +§þ„õ.I¯z"Bi'Go8Yn)t´è(‚Um¿«>ˆ£ÛXÁÚpª]7¢•L>Éôa˜œ(9Š®µ<®6¤×nå9ÏIã&¨ìR ÝñCjg`¡†]@òìªIuAŠ4,BÍ–¬2Šc‹ºl)Ò§2 -HìeXß‹šý+É/7 VY+´:[oA±ûÛŽ&yôŽ ‡(Ъ…üÉr3½MØhÃ\¤a8·"´ ­[©ÐŒ[¯„ŽœÂË|ÄMÔH±ëÊ-Ë «]t‘cSŽ˜BИ¤i?ò€­…$ŸÈ.ìü GžQ󜫛Œ ®¤Iå¶"ÉT–A‡‡ü‰QÉ¥ª•ÂÄZƒÌR[Yzáj¤bpÄk¿3£ÛL»à|Õn>0jlDoªm´–߀Xp]¥™Õ²„Jc‘\"K‘L’Óh©Ö˜EVuÂéXƒ¤Œ¥ÄY…–ÍbÓ©ví@ì×þä’ñA>i>K2LOÑ‹jm×|­{NƒÊ‘Z‚J“ÛLUÙ…§¸Ô‰õª!™í,B„@6p´0¹Æ°Zöž÷$×Sü¨â-ˆZd;T°Pùm I½wB³Ö&0Aƒ-áb}BVÍo&Æ06•£÷Mù…ó8f¥y&½E›ÈV_nÛì{Îã(I^ÉSì$™9ЩAüžÌN˜_oA¬} +$Fò€á¶>æ}ÑÞOpB;CúŒ§„’-øÄ ÕÈЋ?)~Ùa ¯ÔX `m;P´=„èm qSu"g +„ÍÓ<äȵ&¼~éK-¸ÎåÆŠ¹«ã»Gñ‹‘l•Ÿ±¨±bX=%é­³¹ÚNŒVi$|Io¨›’ &ª…&²Ì2Ó@“ôŽÐRÄNñ›:‹v¹í4»õ%×®„•ŸðŒÓK‡qvé r’Ú¼•%Ä©Eø¤Î~Ôo é\_ +BÓ?Š]f>*Žº5ëV0^dɵfÒäZáCZcp"D6iv±íTÁè ȬµA«4@)3‘ã×Äèí°iB[ñk" 9BÍg¦[iPðý¹%ßG„ß¶8^h:Ð/Xów¦`=ÊRˤH•¦IõË&ÓSúŒ)×%ˆN„PÁ$”L¿øhvqÓc^fU}Æö6Œ~¢kóEÕq(űžÂ +T|ƒM”|¤F§a’û6ÌtÜ +Þ—°áŠ¡0 +±4ŸÈhaŒJ€…ñÉ‚‘*X-˜Y  µ=Š\m?ë!' ý‘¼"{yvï.€Uj(lšÊ.¬¥)¡zY€‚óÐCZ×X¹Úh®TiT”U„ RÒ*|NpX´ã 8Kd(„Sk'†Pf"†HimÖÙ‰Ë,FÆF¬ž÷0M¯¥8Ö{€¹BÓ0³$7á³jÁ£2“i~Û€|Öxª×ŠßÕÙˆ¬´'™/ »ãX¹êFŸ,| û‚ˤ%XYHÒ«m£ˆµvÂôzKfÇûŸ´?)Hí'q³•†Ã4ç­~ÊdT«n:9\m– `Q>ÐÑÌrôjÃqžù"Rx¼¸ Ò A~­­à}Ù!ˆ<¡Iðy…Á n ^X²Šî_µë: +^“$ˆAdƒÄA“•Ã'¦?)†ý+v’à)€=fÆ!µ–H«Íˆhì/Qsä¶ Ã$7Qc¥æA)ŽAȶÜáÆŠ­$voÌr›€¤g쨕†ÂwÅfÁIL¬`PÃTüªØ` ]¿HóŠNCí²—(½àJ–]oÓí9nfÚåV!†‡A iX0´a J†Ö*x\ôiƒÌ¬ >`¢R$ŠMo 5Lg ¸H‚U€’—ðI‘‘,¹ÞZ ^ô¾¥y1‚L¤<§6ŠQdr–Ê<àP©­øyÁ•àU¥‰àE•…Ðq’Ó@»ô \¬Þ H²bh¦Î6pÀîd´ÞDìh¹Å(zÁ0¹àBü Ê\ ^öàÇA³g ‘*£@(MAÈúBLY‹¡Ö[ "ÖZ¥ø-yãuæ)e–ÂE†ALj a†+Þ`Ƨ<Á&HM"¨Ô6QJ¥1ƒùUPùƒÍÕš‰®·#ŠòKGA†ïV–ä$H±û +ókÏy–÷J«:95ï)¸ ½?À@•±Ë~%{®Å(Æ×É÷¤šÓ,ïP¯[O:ïÄS& B‚ØR Ð\ÐXµ ›çºæ>€¬5Ýâß×/ýØuFlžíÅ%ÜßKÔX#Ej¼/8–d˜¯’ìÞ¹Ö±;äÓ=‡‚æ Ž¦(Í{žýhœÊ討Haô² :>‘cÅ–ÓLÓ1§p”`áñ*AÄI(j¬.~^l|VY0b³ð]±y ÁìIé[†Õ—ÑS†óPØhQБ]ˆgÿ¬6L–È.¬L ÅùeÚob$óÓu‹¥t”!ñNsçÂçÅ{°¹‚û@cÅADhMbgŠlÆ)¶ §çýÊÒkM“iÖ‰©·Ó¼¯YžçBÄXµiy"û UV¢gµRœ2«‰ŠáSø¦Î((ù!"ãp„žàÅó+‘myC …—¨3 /JrŽ"Ù«Åaƨ-ÁÅiÌCÊ”™†.µ`˜^”²ýP«[¿¦3“c“<æÙ…+9Šïœ É%@¡-OÊA +¨ÖÊÑ .ØÜjK1Z¥Á^©¥(»ØT`u5Nf ¨BA0rƒ€$êÕ€‡²jÃL“»çTû-¬™èhjyÈY‚‡Åø#p¢Ô28Ñž#ð°Š#ðJc "”æ(Z¡E·dÿD¨ .=_E06b˜ÃLTZ!ö,T°=)Xì,&ÁKœVm"lŒÚhà&€Uj.‚Xj?+´A©3G+7 ½£¶Gʽ‚uö@è} +ѻà –ZŒŸ8ï‚LÏÍ,Ñu4M/Ÿ¨” ¨ðÌs\WYz÷À¨~¼šÀƒKÆPe6‚W¥öÂÓëDÃ};Nñ¢ÖÙGPÜw¡3žS!†çLŠZn*I0¾Ù½·J¥¯_¾ +¢Ó3<â ;JmÂ+5:Uj'€XlJ,µéVýCiÌãxµÆÕz+„‹ Ct†°r„.¡ãõö‚¦Š¬e ÎÃ0Ãy&X£ãAˆ^kE®³%U‡^ÝûB¯¶6Te(p´ÒZˆg9ž+¸ˆârÝ#7~ˆîÏQ¦ýÅè[Κmó±Vó}cç ƒK’»…ïê,Û«Ø÷Ü“*—ë)Ûý:Uf3L2fiΓ½t8Rd)p¼Ø:|cûŠÑ¬NÉùéµÌ¿ ÃOQS…Vc÷SädÁ‰˜:{qsÅ&Â…il„vñ£B[1†ÕIŒ`= +›§²gXÿ›–û@®78Xm%v¨ÖbµÜdœÝzw‡"üjà %§9’÷Ni\:MtÌRÜQŽ÷*nºØHÐl©­ØáJ;FÝqf˜Üb–Þbœä*jªÎj˜aûN”|ïv©V•½(VÁ‘Ù±›Ï*ö£¸ÕvÆjmç«V7I†Ý¡Y´\/jæ£èIÉ3`Ñvý¢h¼Ë¬÷pãD&a¥ˆ-âfJÍDN¤øÝÛD½ê9R«µ 9Lñ9Rc/Iò^)F‡i‚áv æ{0Êž[VÑuÇl÷͘Ã(¿Ø^”Ý»Œ2¼?9’û&p¾xJoAè -Jpœg¸ßÓƒ®áA‘9BÈ”A‰kh•VâGÕvÂWµb «¿vµmôªÌP†Vg0O/:¢¶"=g <´c #Cì/Rh/‚Xm-N¯ºµ«·àCøä ü¢—56A Yƒ”žô/”[ ¸0^9ð‚ùuÁIÏF îqJm‚ ¡Ò¦5†›&¸„#5” 2…—¢5_Ù‹¢ÖZ°*¾ßPÃê(~Zl!D¯ý…Æ—$»u9\nV¤Î ”<‘™ÐÉJûIÉûèx/¢U–¡†ÉâæI¾Ñ«B#1~÷/~ax2Sih¨ÒZ¹Ø~ÕnÝÄxå¦Á‰ú­¹‚Ÿ² ^\ÎÓ,ÇäŠçˆZ/üˆ`’„ÏHMÒ¼B;!¬Jë 3e¦!çĩÏIÞò »«@»ê:ׯ|ˆé—+~@ xLëÃ-·=.úÏ5í.d赋¸©b ‘3¥öGÊlojÌFÚE3òßxÞu¨w­(×užc»ï™æË$ÃõdÕL§f×ôž-|_DfgÔóæ¯a6ª· œ.·:]o@¦:îz]ûwŽ`û —&¶ +™§÷  îš}Ëå<Ñúd˜žì¶ÑÕý—!ÛßR,ã}Î0ÞdHE&RüZ“JßrÛªÙ -QeZ–ÆFÀD¥eHIš“Åö7P³Üº¶+9~ñ3Ðo¦ æö‚ˆ…fÂ7e"ôª·êÆ-¸¢uŒ—fÃw£šŠ`ÙçÃmÏ¡(½õŽ!œ +R¬'á‰ÙU„ã<ͲœON×þ<«2B¯µb÷í ® ¿Ö>Š`m/€^k4˯h×€Ðø'Ø›Kôk-kßýšì»¡ßQärkYvá„Q¶¿÷,çMŽ\f¼é˜n² s9n­õšà{ˬgñ ³»à}Õ-¬ ©-ıYø°Ònšà;ˆ+ Fq‹Œ™=Ã1­j{L?!³µöqÌ"+b¿nYp½Êë}Óq¦9Æã$Õq)TºØbàx￯~cË dÇi¾Á“"»€‚ÝF¡k àûÒ‹Ž²ìÖiœã<ñ«H-ë³\µÜ‹Ó ΤT)\1½(2cØ=äØÍo ³ÚJø ÊD’Zm#˧¹°*Fïà]=0’õŠ,±ÌNôžæj”ä¸Í/P!z›øY±} ¹ÚB~Qp¤–Ùš¢ó‰Þ“Û¥Ù…cA¬:ëà[z—èM•…ÁÜl¤_{Îs¬JÏü¥–™‹"V‹^–Ú™©²5[k(H1~Æ ¶³,Åà<ˆ[h9ѯ5çvŒïUÃöc—þ¡fË-ƒ(3 /Xl3J´V«¾Áb¢(’0Šœ+µ•¤X³ ïS”]uA¤ø SK ‰íÒ‹[¯»*U°?)ø†±ªÌcIe†Âô¢ƒ$±ÚX¢\õ *Ï­ G¢•¨U S îBÍS™ØZ\ ÓÜŸQ‚õF¨™Ï”ªûIªÏ»†¡³bfÅ-xÌȈlUtVsyjµ;ZoèWíªUÃ=ýÄñbFrüÕ¤†×d¤_dÚ,𾽯ë‚ÐöN3íAcEFEJž¦ª,fæ6¤…ËQõ¬ÍXNáücUM‡ê)ó í½*2 +,Eë )Eo:YhE>stream +aZ Ÿ%IÖ[{Æ÷°(ðÛ¶è‹ÌÉ•f¹nƒKXb+APaŽDX‚?S‚DW3c6(Pm*4>ëqê‹IXbâQVæ‡ÊëñcdE²”ä¼¢šÚÚêrD‹¸BªH_0¦¸ D(¦œšÝ–”Òc_bá°™,)£WH<1¸Ž²0À‚žÝ ç ¦§Ð£È(Ãfõ]z;¸„ª,VOF”?Iìp™:¤LY>¡-±u ßþœÕ®=e¶iØY‰â‘ØÈõž-}ÄÊ>Þ±+×»DÒ( ‡IëJ +Öå S-½p%%á`A1·¦šr¸ šH–˜œBŠ”¤FŽª`– °ªW^\AZ^\Ô§-ï +UKý³÷‡´gtVëXœ3»¾/ºl!—·ÆéêÊÅŠj‰¦›¤Ñ4UZè)úPP='c£êÒO‡QMV‘’KXÒΗ iG êéD5‰ÊÆg ­ò–Ý\·Èd¢`h(„Sn©•›æ))l…Ö”C±ÈAÍKI[”Ð`©°A'.k¢bÃúû®S³Ì2$l³=%$‚„„4òãD-·§Ú4ÎÓ‹6ÃC#VÇoÀžª³P¸™^Z!~)˜ò¡D 4Ó‘@ÐK zX8°I@’ãB-!dC\<8z ÑàUît“*?(e·/„ŽŽŒPZX?W^aOY^b%§îšhíÎWà´æ5‰ß¦N_dP­©pVÕÇÓ’‘‹$%"ޤŸMO¦†¥%ò‘²¸ÁIÊL¡ÅÝ€!Åd)5½H5A!«°®®V[\/>QÝ̦q‰“Ël¤¹U–¢s«išñ;Ðò†Ú%£Y‚ÓÙB’Z±âö´Èr.%L!‰¨œÉ „ˆF|%#’|3&ÄÓ!‹H‹–謀}ROž’–SY\6<[f¿(´…™!o‰ ÓY¹¿=5…ͤ¼²ÒS±$/IÖuë ˜3¡‡¥Äæ‡ ¶. ¤ˆ:¬–Å XPf °žk‰—¨'æ‹TtÃÕäÄÔ²ª"êÒúBÊÚ +7ƒÂÈŠÑ/\ÎÔ8FS‘ ¢%¡H +x&6hà\à@#„‚ +ðè@(” ÄŽ5ÎLcØ"Œ3TÇÜäC%W! uiiUÀØ<>æ6f7 ÅŽüªõžV…­g«%0ìPƒU²EÃy:#¡¼|¡Ài†c£˜0F ³Aƒ¦*.T0TÒ"‚“N + °kqÃ֙ +HkÓõ¤#¥ÔòS4årÅ2“8³Ø+O¯ùÊt ¾-úŽ“´ÊD&­ïMÓ•ÖFOŠ/ìÑ… Tѽ)dcN,`aF*Õ˜`€êÅ`zCPe§¢¦R[Zê :)KeSý|±¬ F`æ§ 7ýÊU»õ²ß1á—Y†zû¹’ÀŠ/݈<(‚é@ g壀â  +Sd€ T2AKùƒðÌÑ IÇ…²fC®%²¬A]äEØY[,ðË)Jè$õu‚YÄ•CõšÕ\¹æ1FN`VQžˆ^ZB)à¸Â„ +hÜ`ˆ ! ‘A#¦B.,P`è…$.̓nÐæƒ¼ÊƒqcRæÀŸ²5e¦%WUUŒV«Ê½QG%EMQ!Ú(/×Ëì #ézÑH [ò+•Ŷ¨ªCSZAjG‡‚+ȆÏ ¡l05c’€O Šʇ üPdX §D…1¢ZJ¢†++D,t¦Š‚TTW*Y«°‰´ê\2µZºcШ¬ð¯Ë(Š…Ñ  ŠÖ; *hŒˆ@T0<€óÃQ‘ ð¤t@À*ÚˆP_!s ©Œûˆ‹\C»¢št˜¢°ž@Þ9“i‹La¹2〲ÃE<&¸  $( êb„Î4Š#4ÀED1 Ìk$N÷Ò'â\U¾¼‰¸3ç!¡ªŸ¥œ¢)ñ Õ‹L$ùUfå~ÇV¦~’2Hñ^8óJ˜Zé0€Yâ€.0Ài‚‚ƈ æ +9,hô8\Ðx¦QÀ–£…Ô+ЊÀ€ ªF%Ú•ˆRF45IiGLY{@X¤:žRdœ+ØüÆKÍͺò +ÇJO-ì!žj)ñ˜ÎÉM(*Àv€8Àé„D=hð’ôÓda‹Xt Ëqë +}˜(À'$…†QD`4¢+<píh¡‘£¡‚Í +4¦HbáxÀÛ[‰ ,|٠ݤ)I#Ia ¢˜hŠªºz–ÀÒHMݱ-ؼ%õmñ*bzðsSä‰ 4MlÐ8–ð áÒ(&ÐÈ!Aƒê±>'#D?`h]œ€ˇb¤ †õ4H k$IŠÚ •| Þ)©'UU…ç)<²Ó`M}˜‚^@‚ˆh X€ !,AƒÊ¡BcC, ñB‚ÆÆ LK< šp<0¥ƒ‚aímÌyš*p¢k˜“QT*«ë˜ 5ºh5Ú ) +%ð>B"€–”4pƒ¢…J88¾Mä±ô‰K™¼àåD–¼}¬$ íØ˜àMþJâ?ÕçÜÉHˆ\eÅÓ´5>rÅàKGå1%«/rÔüäô¡«\ÀTABcGCP9PhœD€ ’Á8 8(À4“òPÌ +1>€3BĬ^މ65i¡ê§ª‡3¢leά“zŽd'¦§”ÔØVWäøôfàEr*šçTW(ÓIÔtɂˋ82xPÀøQ‚A“å†eJMX˜áè3EwÚÓ¢ëúC"æ#ô4SJŠª-!×JFÆtÝÄ”öÕ]W‘Ó®ÈpËlXšOÑ×Ìê‹ë­ô2úAÝyZXšÄ<0“‚D£…„¤ˆ`aëŠK©âÒD—4»âê‰eÁEÝ®´}~BÊ´W“3Ÿ+ðÚB «U ûÅ\IÑM…=yÄcLo\$©Hk‚“°IAŒŒ<'4>8À€‡Q! +X®¡‘bƒŠ(D ÀäÂò@UÍLL1. ¹ @怈O)æÚ¤M| Û¾¢ê‘Úƒ´ÔA.w’X-ŠËkÍS!Eè…˜vxh¤T  A#ƒI0+0ÁÐ\`3#¡I‡*¸¤Àe„ZØ">%l •ÐÏdˆWÚ‚ª²]æ(¢$3VÕ–· <5æ^"e­MŠŒ´:à*· $M`À9€” +hQdX@JfÅ®‰ +B 0IV(`ê3!L{$ÈÒ%N‘v,êH;¦’:âÚòþ‰Ë¤ˆÚxo›> új“`ŸÀL‚ À:†€ªB€¢˜YPX<ª%,F[&)$©¦Õ”Õ „4ŽS)¡ÕºJî·/¤xg ÇCýŒõƒzÚö)y­ +iͦd…%ŽB aÑõP¥Èþ@qptBA™Ù@H²²¡™Rãa*3Ü0lÑqA:AŒœZQÏ,‡Ö¨æë(餪(I¦ÊÉÉÊ¥¥õ#õE®©‚Ákž^dW°šuHlnMkÿ¤¼0|®K®CªΖ\PÀ ñâB°ª {¢âÀÍÌZƇ¯³ÙâkꣂUõIѪòÐt}Œš^P\Ô(.q¨km²ÜŠçDÃfÚŸòYϑػGÊ‹Œ²tÔ¥ÂgùÃA¸’!yó`øABYÒBáÙr£"Ê ]áú! +IŠödÀþœ¤˜W^ )¦ëÊÅ©©«÷h«Dˆ‰ étF6a}°®ÄÀ*øF±I SÅ"kÉN½³H^hV¥«ø P–‹ƒ)ÑhÉH\" +’`g§ºÄÅ;ªB9½¤ºÔD`Sã“%žª??T-HIZZ,+°[k,RßUŒal*v²Ê¨U¶~jè—::» %uÓ¸VQñŽbrŠ@ É!Ї!¨‹"îTïéé éÊK$õ%'"I‘Q”޲t²š²T_4áÏV\Gˆ¨ +EÒÆ9ÈM„`ƒ¤`³C“ôÚbªçÇ#jˆ‰çå}êÚ*Gu±ÀO\[ç¦O¸,‡:63bÉiO,º-yE·õ¬a3£6\6õ!—-yÄhU£°1£ÒÙ‘(†Sô¦Ô•åbÃfE…í01…—¢Ä2GKÝ–¨¡ªåÕÔ—¯èŠ,sí’Ÿ(¿ÎxV¯²çkv“å‚ëU™C[p!OØÔŒ¶ý!¿½@­ä(Ë'6I´iý¡ä½Án¡ÅX©æ"Ð$²Ê5 + ÌzÓŠ†ÈmÚ£°øRSxBõa ă¥2 ÏÀ’ØoGhÉ”6Ê&‹g*ÖôfE¾_™•^L^•&!¬TWP•VÚ×%fó¤äU|Šú‰²Ô[Náµ*¦°[”Rø„j—&†ëèÄ©'k„©‡ ʼn¨{c$ÅÞéñ;nÇoBDâzБV Û­À4"q$ýD ¯˜¸”QTb)Ü©ïŠ5 -í!«E­ë[Fj}ˆñ'Œ‚éÓåÄ$„uE²‚÷’ à>GãÕ 0n“ÙU5/>%­CðL«J¢‚¨_Jaͬ'ñ‘‰ +Md4VkZÙö ´]úQÛ£‚àu­™ zE¯eËôÑ*œÎ“†ç!M,5NŒ¬ª]×~Øô«¢5Ý7õKyj½Á’ØoWDm;³º¶Ã(Íp4ÎñZT›~ úQÃA­á”ŠÐiHì· æ &÷ñ)£E ¡Õ¼ŠÞpbHð{NÙÓõ.fÃfJm9 (ÈÜ6â¬bwPÂ!Ö'1O ÖŽnËh-J¯±ãYõꆑÙÇIïú‘›ÞĮ݊Ö2Ú‘»þ4´®[¥éPIⶬSÄ“§ksÄîHú¡Q¢ºQjúBròzo1Õ²žÀdHNaí-Ñw ǹ¦§î»ÕçìfsåzËL»cÖmºÍJHn+’Û™‚ÚnUDn·§–û›¬‰V(LéékìGéKnüùr·aó"O˜|ÇGKm…²:sÀæ-ŠIb/ŠLà Ÿ´½æ^ë0v¹@ÃÐxØ.š’œFå¢Ý–‚Úô¦ vžDi]!§Ç[Õ"‹jÉp2M05 7AãÅ&6q¦FDf#B+]•O†”¼B¶F^hP™Ð¸ ‰«Å8ÁgGjšnÝ®óSFé<PNÄ¥F‰b¹}W14"VÜÖÜŽÛ”Z0¯öVAg(=•rW‡Â΀گ¹ +‹ý»zÑv¢b8Þ”l÷YÁo2Õ¬2)Ù0f3¥á˜ˆÐùäµ|ÿAÕø7`f(É-8öŒìÇi+ ›ÔåÖ<²2; * +/£žÄ¤´¸Ö¬ÄÞw“Öz¨"´žE Íê-ƒnÏk¼©øŒåÙ±â²&!5”Pij¶s{ÌmX³Û  >ÄrÅ¿Ik:2ûM#VÇlW,œ&dWÔã¾7³c·œim8%³‰èUµ[§ÔJ>h7㵜–C“1µeµ¥µì¦C #ƒfÕn==kz µ‹ìÉ'DJôôÁb«D±Ø4ÓîØ±J^ëÙºíT@ó:×ÐŽJþä£vóáÂá¾Gr|•Çìöä’Û¶>è7ä•L_av¡0·ÈŽYqZqˆ‹Ý¥u¶²úrÿDU±‰?]ò¢{)ôÕföxÇ®=å¶ãö«FƒÝšyÂÌ ˆÖô­Ï˜m¹;;n¿g-Ó.wS{FÃúœ×€‚Ìn¿hÀŸ 0Ñ%¤ rÚ–Ñ:䃮ÃHµÆB Rî•æWÐú]£ò„ÕªÎmÚŸòu‹~kjÉöÞÔû¶Â§UfaÅjÌOì­ÃÈ¥–"ˆEæâì®%±b¸_ÕË6²ì*‹1Äš×<ÃpÓk:?劥EÄÊ”?añ¥¤oY”’XMKäMCú„‘-¹á3n[Ÿ¤¾ý@hz\z¡ÝL­â6Õ-²j™Î›†é%|Sp 8Eâ¿§õF1Ë,Å*ÞíZ iJÍÌL­Z¨RåfOØÙ‹d|„¯Jž¢—Uæ[›QšõJ«Úߥd¦ ™éElÙm¨çŸú!›;bËlÆ-øLº%»­è;͕ˌäê„þd½S¹_"„A] Î)³/Z^ÓbÛ÷æ5üvԂת@à4­x­GhÜ܆¡y0±Þ(N-8s;f“rÉn>Oæ½’w8¡Ö)–KäåXÙ µªyäÕ0Òz©jÁŸ>_¸k“<äZDÖñ¹z“dÌB¡,ôÓ¨‹M¥$N«J¯9‘ß~~Ðq^¬ÞÀ¤¯p ff3ý²‘ËoSž2\Ò’wM[vÌ‚¡u4¥Ü%ŽGdÆ °›m|éÓeö|¡!uåá&3]Ièl¿þ|Ù¸>å:ŒcÕÜÄ0IýBèÄ~A´+Iz¡e½ýHDâ·âY •›†gŠÝóc†óñA߇zÒø¨Ÿ÷žJ(îïÉ㮄äs;NòšI“ëí•JÇ€B¡u¢b5"4 wäÓ¾7 ¥é¾ë·lÍfe¤nsJ¿­`g4P°3œ¨WMÆ)vƒ‰‚I}Äj+I)õ4×®cV¬VզݔX²ðú+¯ç5©6 ¬’ÙˆzÜö¬!ù¾™=Ãñ°ïLAmý•‹¶ «bm2P/´iw ¸ +‚êb;My¹aL‡¼<.èè;¦êΉZ¯ùÌ”K>cå*S©^Éo°]d?Bá7$Q™Äè õSûQ¿l6În0:n;VÇj@)X­ÅÍRød8u^"*· {¾Êr¨bh)ʯ4¦\>—´Ö¡éK®Ú•G|¶ä®«ß¶Å'7Œl­† ®ó füÌ3 Ã$ßÑ´ÞDÉ…öØÔ¾‰Žé:P4Þ%)¦Åp(Å1œôÊÖOÅû\Ep¾ ÕÊ“*%yǘˆÐnÉhÚ.Ò[ïWÜœõNšÖ#vœØ8Q±6æõ|ï2¡=†OhUìFRìB3¡C%Ás‚ƒ¸AZoÀ "cø Ü®²›+VY +¤S;åùeVÄŽé̬_´’ï>ª¸n´–á¨Û4½™M¿ý¨é>?â¶Ÿ¶KֻЕý¦âµa•üÖÆ±-{¼p=¬×Û&N˜”±'O,s°ZV+9vÑZü¸ÒP–^¶›jͨ «%µ`µÖ›†Ì’×x€Ìl[¡ðÙóÇ[V#í®exy‚_Ö€ÓÄf‰r¡­<•Òˆèp!Ä0‰R¨Uç!V¬MGöv”:Û0 +¡w¸Zs UÚe…ö!I§G_î(ؘ‘ë%û 2¿õ®_i;ׯµ•§ÙËS -y=ÓW-yKõé¼r­R¿H·ÊT›Ø)”Lì’¨ÕØ vËLÈ Sr»iÈŸ¯1eWYάìg£%¯f8 B–Zp,µ(0Éz?ÜLÍGŠÝ·%.|®…8ôuaÄb‘¢Ö@!+¹Î3ŒÍ% ö2 £¿ÓynV.Çôó–#*«âv’ÀJ©qï'+Ý<ÂRÙ–|æü( xŸ'í¢ùªß3(!vÝçg¼öËvÉF¢Tlg̳›v ¿±0¿Öb˜^iD©ù4Z1ñ*vZÅm3V/ùÌ+ÜŠÓ¨Úô'úmãIÁmÁ(¹þòô²=±h;u‹Æóª_·’¦Öس*~SýZûm¿Ð²I^dÔ¢.2I#±Ë4ë¯ÁX­Ú Ò¨óÈ ®"Í* FÉk®]fÊž06B s 9Ê#†cYŠÁy·ÒTšai6Ôî¼ÚCf«rÑôm®hèÜöã‚‘YyÐuí¶íRËw`Õ«†Sí"ëaÁÎ~Ú/3—+žõ»ù¬Þµ©2+®+³d{L MQŠ]¢'?IzÝ@’Zi+ŠSó'6½×žï*ʯ[N3FÝþã”­GNÍt+–­¤b»P£ÊFIbfUž1[ _šo½Ÿ!Æé`”d<Ðú}[bÏ÷äÕ\Ó¦¡†«Å«~ÝFà,­¨øˆ‘СÛ £ä–0ó3Fdj¶ÒP¦RrH&õ/ vSÍ2Srµ@»j:Ó°Û6ûæÿpã| ž8šUçSð‚Äp¬Zí«¹ªUÛ‰Õ2‡æ†SýrÛ©Šá1 qN… ñÉ"avÁ=’]qex &9¾¿ÖLø¨à%IïÙKS¼V ³9·g·*Ϙ­eŠåæe¿æKìî¾kxiŠwà)½c ¡ÈHüŠÔ„ ‹:¨±BÙ`·æÆ®¶:Xip Ì °ôœY¤Ze\&.9Q˜$EîY{7%Ó„ŠÂjQ ®™ ”ËÌdéµö‚¸uÆ‹’ëE«ø‡',˜§“ KÕJÛP³õJ€¡vUˆÙ†M—Ú.R/µßܶsí¦¥P.™i¬[pkϹMiEãØXv3 )bsð¼ÔœRöþ‰ÇL.(j~ÃÀŒ8 hQa>•7È©)°±9„^v¤Ú® ÛmÍd4¡bplØ i`DŠÐ„HUæö°ëY®Ú.bÔ’¿4»j-Ìn›  Õ²šÖÇü Ü8|D¨ @_qæÖ #¶ˆš ²&Z±#Y²£83Dñš%›†™¨ ¢OWË– +Ýí*cÌ"ë`& +Þá¦jŽr ׉St¾G ÷Û,¿ÖDWc>*.gê] i6µEœQsC'øÒ:oi ³³¹ñéZ@òb‘$ê¡z¡M¨ÑŠ' 1NeÍ:”’S°9jc¸az ¡j¿ +Ÿ•Z ßÒºåÉwöˆÕ–[±5žLÍÅÉu&‚ÌšŸ0¿Ì°Y·ŸY%çM¤Uo§q +“y;õ>‰>ÁQ‰Î´\Å ŒD¹2Ø¡O–Ykp¸`z=[+”Nä&•ÜeÊuöRÍ:»¹z©éTÃÔH”_g*Lo[±Š¾×X»g3Ô°1”'W±w°`hÁ¬—­d¦vãLÓ¥$Çùæ—rÔJk!¤*!^™yXyZq1*ù˜a7 .Ve5ÅtI›6 hM†×(Þï½ýOh—íBˆ 6OkÜo¥šÍHÁ뺽 ÅpÅiù®å¦ý?=k¹,C'ˆ,A‘d"V–7N3\Ûo\|ðÐSÂðUÖ¡†* ÃŒš ßWæ'À L0p£4QfÉ yba°A2»k/G²=Z}û•|æqL>qº*Û0 +@¼DIÔ<É-xñÔ*`ƒŠ5,~NHzÂD)2ã¶K'ZËw(S®(¸è‘€Éj}ˆ!zÀAå,[Z ¡b·Òv¤â½PZö+©h¹D¤TøP|ñ[‹"°á&(‚¬+Cí5Th×kœî©«_0!“5€DÇÎÇ5éŒÁ§í:ãwT@)UH ¿.á¦+¬­AŠZnbà iL°A 6T‚0T«µˆ¤6 Ç*`ø–xA”²`%¨ÜÁLÔØ†/ì-§ù¥!æ÷Ãj +g•¸Æn¢ao,~Wf!|Sð 8Rl¼+9Z΋ Áz' !½`2y§D`ó"Ú µ‹ìc9åá3RO b¼Rà„ +–‚Ì”ªBŽOùAMòêBëÝJ«HÁ=–HoDŸ0ãs«Bð™¥ØãeBB·T©à&G_S'ï ×ÊÌÃ~™íT¿Ø¬>a:”ëe›™z™õü ñM-ù>{ƒ‘´* Tj¯0FÉOš_i6O3ËMË‘$±ÔP¡â¿+¸ú…¡CU¶ R{‹{cæ&3õZÓuÙd¨UeV|È+†Nòf”Y‰á™›-y…q©}ò¬šÃTµÖ(Èð„¥½g)G±[‰1ܦ¬¢÷>\ö>jh‡*Jß«=ã·É(tGÒJ Ô“®c¹ãz¦‡¹Ô0@ñc°"”~âS>ñƒz'y¼o.–LqÌ£rÉ”Jþ)u¶ ’[˜#öœ%÷ˆó +MG»µvýÛm¨Wf)Ô©´ªî«V™F‘‰.Í9ì(ÉOüžÆp á½7~׳}ÏÕ8ÃpK x(±`ü’Þ*Í®¶žõËí¦zuVâ¼*‹V•¡“ÐÐ-˜Êê,CKõË!\š{¯Òb˜^û‡ñÉÌË4¬‚µëARêƒ ô)Fp +®ó*BÇ6löÖ’ç‡ÐöœõŸƒJËü&Î*Z¼8q¦`mˆPÅØ€C4¡Åt+Æ  ¡—=*-EÙÇáä©7tÜPSžVó^,»b'Éç *\2£÷ T,÷,;HeB|ì´D­Ü/I*² @¬b ½Q­ÐLš[jÚmº/´eÏaàø1@CÈư‰,óÜRÓÃ#Î „IÅÀ dT/ž\¼`n=«AI´Ê ®)È pO|¼ô4°Â£™@ e%@˜¸(™ã…‹ŒôêÃÙÄî fø¤@‡Š‘C’+µU +g€¡nEiV•à1Á?ô’Þp„ÌI¬˜½±(†ÑtRƒ@à2Õ­¶™é×›ÈQ‹MDù$·€³ýrè •]¢]j)†NíD+¹ "ÖÍôK­Ä™…fB(DV܆™•-8YVÅ@Y¬Nó +¼ëŸ‘E¥ b¸]e–Šóª gúm1~¡í8ËnPBm~Q›ï$´ÎC³äz1~û]¿kÎìù-ËUãGðšÒr¬Ü!EïZÊÑ‹­Dp +-Ž™ àÔØŒU+ÍCºôŽéiZÏp¥ä|Gê 9Jé=)9ˆ+³½¨±F%¶ŠtjÌD‘ˆÜñL‹i‚ír|È)Lo•èIsk ú­ï@Ï}*¶MÄã–Ûn×úl6—yvÑ–Õ4¾‰Mï³[v?«UçM±5clj‚ßhžblÎ*[ŸÄS6׋–ï&ʯ6âW›‡KmCaz¡e¯r9$Uwq´š¿@ÁÖZ¢Zrh—œDùµ¶‚‡•6!$È BÊL…‰¥V´‚Ñw¦_<ŒãԜ˓Æ¥c· ZOz®KµjûO~ã^m×|/Ö.@¥¦Ô”Lib¡¹HBÍAšSeË«3•h™öªì ôµän­Õh«Î@[kL)³B*´À&² +&Q0 +^8³JŽZmBª˜½¤xU&!FˆŒrôRƒ^Ûr;NuŸmÇí4×{ tÝ¿Y†±½0›ÒK­¸¾U¶¦I>"üÖG€ç}†§ù-¤_€\Ã^­ÖB~Fh”e‘ùdE€;F”h»½*³'X}E±©,EQûÅNTœ%8õ.!ÃŒš‘v­‰¨AjO°AÓ@uÆÒìÚa¢]mÈ©O„Žó*h†ÒJ W(I­¹Gp«MÆ©0Ôü8°ñÌŠ B”ÖpU¶áÆÈ!§èm@‡¡Tœ c‡Ç #l4`0ÑØ@D (P¨¸$³8ˆq‚YÈù)“ *Á#X!Ò4  5X) 6BäJøœñcº£ô±S…¶áFjŒ§ô‚s€… +u,LB¢/SI¾â7´æ0ÃW@"‹À£øI´«NR{é=AŒšì† 0E'öGRiÁ†+¶‡pÉ:C´8R°¢—4Æ +Fa¥Ø´@L•›eÓƒèÕ1>a9Fm¥ Õk†¶Vå9×™†ÒwôÝ™=×_žblHl™nå9Û{zØú žv¤x5¶!Ü"Ë’ëÆ+9bøT–Ëš û£YUæ1e‚ë5Ácz˜â‚AçÈ'5Hk „ïIŽÁËÏÙ¬·ÂN¸ƒˆ|£¥bWArgÈAjÛT»Òp®]i(Ò,2,Oºͪù×íZn È-—5ô–ãr×xj ÇTæ‰~©©D·Ì|WïY0êEË^Ýû+ 1?•ÏYœ÷lNMÓ¯Ùöžg»îÃ8ÁÚŠÙñ… –Æ"x%'!†ÛX–b8‘e×Ù TÌ-J ‚¼r?±è=JŒ®!§)þÀÅÚ•ÀDiU!fîM¿xeVìVå¦ïLë:_Œ¦õMk[¿Äšë9Ð0œ‰_Ô<%ù•¶Óc{RÅn>?fº2K†“zßvª]:ÍuKm£%§dYµAŠtëD‘©=2…Š¬Ì¤F[h9W/5¦öKïñ)óyѯ=…ЊŒcIEÖåJ‹qv¡É8½Ð€×ðÛ ” §²·E¯ëýOV.—œ¦ó0Êï[° +~k™n‘5¯è<÷¼†ÛP’_¶’Ÿ×M䆫M„LÙ†›!3‰«ÖÆ1H Cù$× ze’„z±àºK ·1Ü:k±3U¶Ñ»B«q~é@G_oD,X[ǰ+—<ó]µÚB’]l)„RsÁ.µ”£¸>ãçk a;•§œÿAË|5Yi$:[jE-µ <%x#R0TØ -Áãx–ê—,‡ ó%L¦ ´°ù© „iEËÓ«ŸÏgX%É- T ] FzJÀhaR¸£0Óô.Q3…æRüº¥å¸¢tM'Œªç~ůz20!£Qˆ +-\¯>”]¡Ã€¾& :¸ä N´ä5Gqg¸¿âF‰,"É2ÙnÆ©DÄð(#YAåÇœ…hÁ ùN’¼…InÁ£FR<Б>U#ýZ†ðé€2A€0±L›à0S¯5¬OnëC®³8·Èl¦_dGm¸§G_rÅÖjª_e)K¯3¥—Z ´ûö1ŒŠOh©f±0B±Q’]m(~TizIî ;Dj 4O.)=¦D€Pn|¾,’Qñ À"5í—™«·‚˜,xÂθȣ5&âë­ÏkçIÇx“ç”|é•NVëm¢•Ö@3/ÑË:‹q†ëÓ«›/õ3æ'âºñà Lˆ˜jÔ–knƒò)£ÓqŽé2P¯ ²»öÂÆ6“¿ ñ¼ý6ʯ´ T|ºMž¯[5»ÞÇ Çv8Mn¼¤t5Ch @²_^\½Zbn3?*x#P’´89®P>©=Š^n$|Wj'~Xi*„Yf&Iñ›QÚæw¡Ý‰ŸÚpzÂt¨aiIløíXMï“QuGIÆ‹½mÔë[. %óC„@ÑÑk¡jÝ8Ïy¡·Î¦ˆmÁ Së€<§H’XD+ùSQù£›ðùxé`¿Êf¨\j'Î,3œiWÎŒ-G*¦Oµêý”<Ž›×Iô–Òl†Àd|¾/M®´éâi÷{²çüIR‹L¸ížQ¹Ýµ!›ÃÒ9ƒ¢S"R˜ ”X‰^ÀÙz©B]¶ž"o0¶–‚ņZÙyßÓŒWá››3T6b™¯ä;w>'ÕsvRôZKQ”zÏH½Ð–XôýÆI®«VÉG_j%t¦È0À¥§<â{«…†JriƒècE–bg©¬Â‰í@ ¢U‰› t ^PÛ‹":ÆqªlBÍ–­Ø‚¨×-ŠV ´@^U˜!Bçl­Òdª[j.Ð/´#¶|ZÃw%˜›‡ìmcØÅ#foñ›j)>¥•(¹à2à$Å[©ØFŒÞ¼ÌR]×Ñóâo€2‘Cµ6‚ìòOžYtœë^DÏH^aæ½ÂØ”6b¬bûà9™‰A’KˆéYSá¦/Pq~YBlr‘D‚O²äj`„™eÁK¶¼Á šYuƳ†Á=¹a:ËòjlÂK6ëj ĆצZ´¹S‹‰jÉ;Š]g¾hyÿÔŽù1v‚Î ¬m°Q +¯ðM‘Eà"Y¥aĸ€‹çU#~N¨p"M „͈àQó:¾«èu¡‘½n½.6 <¦]Ñ‚}@Äè„!FˆŒ‚fÉýñ»*Û™Šé1n’Î x 96 ¢jòÌ"û 5×€ã$Q¼J+Qf©Õ@ÅõßÔ|ßjÙqZzÆX®[Èê·¨Ç×{›à5ïPƒ…F„®ûCÛ±:&”¼ïðBG›À…*=kXŽsœ·Àb7 Ã 8¼l#ØXjU`JûžäûWL§°¢¬`EËæéeV¡d+~0²KˆIrà]¡™$¿öŸ­çjãt'J¦U˜Yþ¤`µŸóž‰-ïU¤4½E|ðˆE€íR Òó­‘‚©½…À€øàq Â ªvá6Äø ˆ©4Øl¿ I(yÇ1ŠlcXeóô¶MýÌãZ’Xen€Â!xLlç9oÓ<ëÏ5Ÿ]ë‹Ô4þGÓ_™Ò"xDb1P±4–åÖÙK3¬ÍãØõÖ¬Rãq±ÖLžJî&N©š*UÜ·¥:s‘T’w3ävÅN"h|"èH^iÈ)jÏ\³ÔBƒÊÌX½J˜VcE/7 ^€ÐD»$(ÑŠð-½[¤ZhX ðÛ0 ¶ÆâHwizß‚Ssÿ$ æÖBƒ;~ó7Lq_äèEoq~µMyÆúU|7AŽë-r²Ú@°<•} ÁbAU¶¢E6‚ÜjƒA¼BZ½ØxV0º…¡s)¦]^l¿V‚ÒV¶ã-So†^v|"Ø“À +í!A£A#ö†ßœCy•ö¡ÌZ‹‰†¹M{È÷&LÇ©zÙf¢`6¦Ÿ·‹ÈÝ÷Ù²ù,E0^Œ r-<â9Qc.†Ug4±@âf+Á f“‡š¦¸„—!¹&T²(̯?nƒ"•'\ª°H¯ 1³U€ãAÆ' ãüb› £ùUš"Rì8eÀ‚Ã0ÁÞvšal!¾©¶¯¦Ë(ÁöÁ.œ s­oRáùm¾Wê‰ûÅHq9¬Ø.gJnžÙmÍ舶c}#ž5=«ý¦!§e{ Lm„MV‹ÑûF!†‘É 0|¸ÀùlZÃ<¿Ðn¤^7‘ãT™‡ ó*W0(jˆ0@r‘4§äv‚ÂÉ)¸ æ–œBcYn­¥4ÁØ>ŽWg¼ø”=ŠTcÖ-Z”šñ t®ÈNì`¡‰½ô*Ö´Óa¯nº“Þ“{£Æ'LYõ­È1:CPáŠ/if‘€ +{ü¨Ð8ŠYl.˰6¢ôKç Â„*áb­rY‚éD²â/Cë `Öš SŒŸfÑq׬[îg;¿+1’õÊàÍ“X³¥Ý·8Or X™)áÌš`…5¬‚ Gêu»9:½5xQsQÃsuRôÖ@q¼2`BÈR.W Fª] 3Eð 9Le'Ê/¶"m"e Õ ©ˆ"²MÍ?)¦ù&ÄußÉî'§p9e•í7AãÓm@$DĆÓz~ÎzbÕÌw!är[áƒ"3áRc¸ñ)wÐar¥]mNzGFvz6ŠLe`„LÏ8MЙŽR{ Õkƒl·ÎϘƪe¶â5çà+JoÐñƒÐ!:¯(J‘­H·Ò¬>c|T;ÆÏD»Ô Z²Þ™5ÇÁ V™Y`irc`ÉBC±ö6‚£7µeüµ‡œZÃpÄ©ù­‰%çEZmj”Ú„`Á.@é¿~±í@ÍùiϘî³~ÝHŠ\g(D-´f}cˆåFá…[ž`¤(Õ€ ™ž:xI€ü–@ì`Ã>ÔzD꘩×Û 4̾3ç¥\³þÇGÝ·nÑ|ç5­OúyûµÚv¿&©Þ‡ˆ£XÉjË ”¶°âSövµ•$¯Öx)4¤›‡qjΡ¦ˆìB˜…&‚‡¥¶b<÷“Qxœ™œ—¨Ì5ôÖC µùË«ÄhEF”M@Ï©¾¿rÅS­Þ-J/ð‰¾·ðq™qµäÄç×Y8z`€!‚†'lÃËœÁ ÞÐ?$X« ™††ØðI5@r´Êà䨴À*PBj„È Jm€Òc†AÜj³i‚í C¬³&6|ÿ2ïe¢Ý5e—ÒšÞ ©h> Sl cãzÛ8„bnÌ©[Ì“ + 4tLàFÙ•j¿R•qð‘”zC¸TÉVLBŒ9F±êÌ8Eëu¤a»ŠÞØGå2ƒbÓz¢•Œ_úqÏý¢ä:ÌRüfRìÒw˜`nT­ÙÏÑ‹*£€D+Öƒ~íC¨—΢ôÒO”ap0Ñ/ºÒª-ƒNz' +ÆVBì²Sòsæ@„ÇËa æœ:ƒa‚ÝÕ/߉=û…Э3L 8!`Ñ"ý £´)†ï3ɶ\ñI&ckM#ךV€¦µ-w’´ƒA<óÂ*ogjìÁˆRú‚$4+žV¨øˆk˜_:Q)¦WÀBŒd(¤Ù2‘OôŠÚ¨8·¬8µØ 2àDpIJ, +4Ah!¬MÂŽ”˂㑠äP—à %çð3rÇ@^™Í<ÁöŸôÜßþ˜óMCh>Lrê Dï(-ãür‹I’õ6Móžæ)Æ{³ÎX§æ5P/›Ñ›obS„®€L”Ã6+…I5gaf¡¹@ÁÚ^œ]7£WÚ íW¿1yÀp"L'84>b.Úï…Ÿq-\2"K®?¡õŒvjíÓhαtkòˆí‡Ùï>ÇÚµó®bp=>h}”;î (N—ݲóHkŽYe߯U¸\4›ž«©rÑO¡Ì,¼,¹5Ø,Á3È0¹UäLÁ_œ]83=ç:FîáÓY ª6Dªa@’[ÄhË0–Ne/U-5 ·Ë ¸ {sò„íO„Q\¢T+‚Hæ+Cd4Te2Ì1¿HUËñdåuMk;î©-ç™Zq‡fÖÜŠÙ^šÝ5–æ·M†)¦ç<Ñz&zßsª÷Ä'Z?ûAˆ§å’ +"<Å) +Ci9Wh+E1¿E*mƒ'Eæc¦ù$®5 <”1´T§Hø°Æ\ŽåúRÏX]ôªÆ?¯j»ÒªÖk³ð¹‘ß× \°_–ܘ Ó{T0ýãØµFâEöá—4÷4zo›âH«9ÿ +Ÿ2„ô\Ü ‰Ù0¿ö)>æ T€Ð`â t¢Èl¦^·+X}*I¼?fÅèY¬ÜŽJ%›¡³dó[’éûŠñ|'±c_Q†­-±å”X084Df 4HèŽbšÌWó$óY˜bö'ØRü¢KxBs :‹¯Ú óãÀÆÎP8\pˆÓ‰¬Erémˆäq>•±[p¨0­2XA"ið }=ü”Ú.ˆVh)Ê0z 3Œ§yŽ÷Zžtܛބ&è,‡Q)XÛEÜT•]"¡å¦Y’õÇ+øîóc΃ •Ùi‰v9¡…Ë‹íŒb'÷"O© H¨Xj¢âE±7¨˜¬†ëx(ˆ±ƒ5q^Í;ŽUlbxÜÀPÅ~Gnħ²p’ä¥S˜\g%E°¶¥X}$F/Y~Õa §Ô 0™z¡0­Æp¦Yn€¹€dZ¸$Ê“kÃÏÈ-â¼:ÃÁz±ÁT»ÔzY°5“œ£°ÈPË E/ËL¥(¦#£ð¾rʾ'qÏ쀴ð9¤sêm„Šéb®ä(Á/[ÑûŽå)«õ¨á´ßt¬†Õ®áxÌqš²9NóážÝ:ŒPê 6Fe¾)÷‹óûfãüµ¿o=(¯Ä’ß„V0Ì,Í%ÙYî/I£`øŒ"ˆÀñÑÀD¯¨@¦D”Y'†Iíç”)|ÀàèA{ @e PP±óx<Çãñx<Çãñx<Çãñx<Çãñx<Çãñx<Çãñx<Çãñx<Çãñx<Çãñx<Çãñx<Çãñx<Çãñx<÷ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÏûÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿçýÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ—hƒÅ¦‡PO®^žÆŒR·Ì\ÿÐ{š£(»÷§ºîË8ʲ (Kf‡R ï Ãw(uŒŽŠ‡mïxæGð¢G¼ÁSÄWÖ« ÙuÙë°×¶]HokÍÄïʬE0ë¬(]ûqšh¾‰žˆ­59at§t.€%îÙ¬×6]ŒÓË“iW à•¼©§ì®zeÓ½àÑ#ðxŠK8Ñj1ÞƒÑrWBñºjOXÛ‰£’9$Ù5惦õ#Âs~Åÿá«-‚î¹#G|ïÁšÝaµk>‹`ÙÑzÎù¬ã˜Øs…¯ûÖâçmËq¦÷A[²:#2¹§6}rÍxí¶ÝgRßqÜìXk6ø|Óq¨¡B‹À"e6Ç ÎDÙ½ÛH¿y‘dX›É1 Œ¢ñÔë{ŽŠ…ß §jÿN”Œ1zÛvžë8êõ}'½ºï^šc{‹Ò¼O9¦ãjšé¹)Ùo ë[žbvå—Û-‡³|ËH!¾ï0È\¡m°Á:CA’õ2Ìtœ‘ºžRÍzÀ¯´c˜î´ºg@³l:Ð1ŸE ®˜«4 7Rd'K°;ï™®‹àA´N€„s+„M—یNj¢ã¦Øwך6ç”ìn‰Æg«hð5Ý2HätÕ%b?€bÆÐeCèÍÿžn:ŸlÙ  tíJÕ~¡í\†›ž‹ìÚ)¸T¡m˜ébóAÓz¢žx]Ñ»iUûašåzë®S^Ñw,K°ƒ Ö…•(2¡˜]I}ÓY«c3HÔˆÕ3éJûà"®· ÝtæYzN·:ŽXj,†Ze#Éîš/šÆ?«q:ç™ßaK §8Td Ä1ß'5÷³\öÜÊÒkoìÖI†k¹•¢».ç™–ÑòìîU–á= ³—AGõëEjÞÌžë@ŠYt,Jl9å: qLnè,›Ñ´Âë²Aá;LTk­Åp MFÉŽÛð™ý?µÉPM7ÃDÓå8×v8O´/z¶‹1 ³kxébKÀÐɇ” ™´\ÊMG„Îe,©ð:–%ØÛ +b•ÙÎÍWQŠïÁ®µÖ0$¨d™áyÅe€™ˆM†TÚö_ˆ©š—ÁôlM†tj6€ŸWŸ í9 C)‘à×þœÊe¥ï:¿07œ¦Ú¥ž `k5ÀÏyö‡€iŠC€‚‰A$+fÂWu†œžñFé9O¢%—Àò4á©ã„˳ø–cp9ºgüžå¸d—bgJÎAôJSáûZûŽñÄæ\Fµ:f€åÚÎè׊F€atÍ÷€#FÕýbÝÿ(†¹¹zߊеßhKvç“%»SRÕþäønrÓ™Öô^©gnw¤ªû+ʰ}#FðÁ4ç äjm„7Ÿó4Ï ¥j9$ص²ûषßg»žk±ÃÅæ¡ ­ƒMÖ™ .5š&zó<óIÜDÁ;†]µ#•íÇfßuQmz®ωìÁ ´‹ƒ™mX±Ê¬ÊEÏ=·â=ŠRÌnRã•Ѹ )•¬Eè{FÑ näFW1ÄKqz™³`;‰S+íE1 ÍÃÕš-6¼,µåÕ,g;€"$û3ÄX¥‘Çû T=G çe˜fýð9·#Bãu4Ku?k€‰±«'±“Õ†rüêyÎ2]”,·EËá4Ûq7ÍõÞY…Ï mÇîš|ÆdÌD¿öŽaýÄNכЖãéIË¥b¿J²‹aŠõD«9Oý çÙ°| +¡Õ(ù…“+4’ᘯ¤¶éœÖwÝK·³t×M¯o»`4í‡!ü²c y2s ƒg졆Ke)¶ËDÁoÀ*9Ÿ²üÚYì|ï`Àù5ã½KrM'Ó$ëw¦äûOŠö÷¢h¹å4.ÃF¹¦ã ã„öÀ+ž°ÂôöŠÝKŽaöéwÿÂôêCìP¥¡Øéb›Aºç|J´O¨š„α(ɰÝdé…{i‚éBéºïÁæk-†/Ýÿžãh˜iºt-ÃG%×Aµg2M1ßN<)uûwœd|JòK÷(vÝ>„ãú“ŸCâ™Û¥h¾Íó[ß0j™ ÃtdüŽ—»»NÍì¤Ð±:–âŸÓ<ë§Ô¸Ürúö£î½ÚîÇÓr&nÀî%pÀê?§{N…(¶w½o0I4¿ˆGn·ÅÂçXŽcûÆÏ«ML×IÏ[¿ažý6Ì4]KÑ[/9zµá@Éy¤íÙŒ¢¬™B~`»§1 +)Lh`Šà,Dr¿)Ï`Nßv%Gp=›eû¥~ÈîŠÐv 1¸ t?/ͧQ®ãjšhÿK2½ÿŠé+Irj•ÓÕ$Íx—ãøŽâ¦k ÂFyEXc§Ìç‚ñéX£xEã{ëá²çžÖø &ûîCøÝ·èyñ$Cò‡éö;«p¿ôºî«BUX)Zsè€Áýšð;å»nF¹ž#!†÷ZŒÚC0¶hnFÚMsa¬«ríJðˆr±è=™ù¤âþp:îÓ4Ãì Æ.7iö¬—Q–ó$tºÜ6°\©aàÈÜôâoœbx˜¨•YÊ4j^ÒäR^Ãu$–¬'VÍ|a—Â&‹m…¯‹Þ²ó}Ò³ÿUË}½ö"WÛqÚžƒRç3‚Ï6] R¬Çi¢ã^ü¤Ò6xцg¤Ve7Ó.: ž•\§‰¾;«o9dTNç”Êë¦ÔxÝóºŽKiz¥]yÎ}éÖÜŸ‘vÛzÕ/]×Û­µc™/Óüº¯H¡Î<ü~ÐhŒÒǪZN(UË…½õ:Rd)É0Þ'MÇ9¯ì9'vÓßI^: nDŽ×ÛŠžBã(»ô5|·–õÃi»§¹¶ šã>Ä€Ù1‚¸ñJÓy¦ã¶Z¸]Qêž3)ŠõJŽÈ"±5_P2;1võ=*8nÆî£ Ã{&xßó¶3JÝu;ËøÝ +1N·‘ãŽkÁ3ëeœãûPë…^Åu䘾ó\Ïñ êº&>£×TÛÅö3̳ܚžëÉ’Ù1§è{…› q aT\G:¶»(Íw—à÷m¤& +®á„¨橌EÐ ®e®û¤èú/º¦ûœêüÊðÌg–ãŽÐ7v:·:ÕýœgZo½Êç°Ö¹Ý‹ž×털­d˜Þ·Ð ÓYè|é@g;. =çI„ݶ9\hЩ[.‰{&£mÇ•½t2_u2Qh0€WhLëY&:»#r•m˜aJw³Ì¦Ör¿ó_ÐP‘xAb‹À™*Ëq¦ù„ã>HÑ›7Á£bà óTæ†ëmE9ö+±e9 ¶ÝÝBãv?§ü®è,ÀÆŽ÷Î!†©-‚ç´6ñ£z×4Ï÷ë–M·¼¦énžg? ¯7:`¼L²M×´¶ïRxao.p¤È4x :‡µÐjžäºÇðë¶¡Ej>Á ¬ ¶‹œ/ü SÜyzé1Q¯šPº®'qÍêªÔ²;`Sn—bã[Šk:˜£z®(eû™zÈìšR¶Ü 06:b¸a³ìnƯÛà‘ó¼î›‰œ¯6:Ý7âÿ³uÏ)ý¸ãŒÓuÿ…XίôÒrBhÚîæIÖ¥è|TÚŒ9UràS[ʦûï'Á.µ(Eç/IíŽ×Ï™Žû9Óý–äØÞ²¯y ‘Í-ñŒÙ¡n¹àØÞ!{K9vë2M°Ý7-ë—Tw\N“ÍgRÛ~!®¼®)«’é!Á0ý…NØÛ Ø› aÖÉÑêl'*ÆÆ´²÷<[ø\V §Û¢ûGê:îÇà©ý#rÀê*ŠMd3U¬5–§WIñ w£,ãwœi~0Êž;AcåæŠhØ'Gî Ø›OjÖû•óCl8OããWŽ]8“¡]eȦÙó1 ,½AÜXÍcœd|Pº¦s±ã½?ùIOÙ’3°½7„YopŽÚƨøs+-&*ö6´–ï-É2Ÿ…N}ÂIÒB‰ÒÆïkI¦çtœé9•嗾춭ÑýcyorôÂuü°ÔHÜH‘}»oOkœnšeûŸÙ²½xÃ}ü¼Ô>z]8<0z‹Xý(f/!Ãuæ!ü²%±f{O›ß³…Ë¥k9 +QgNPÁ b ÎBŠ_ùã—Þωl¥ùÕ¶ä‚ë6Ó®ÛFÐk-ÃËÔüDÍÛÍ’=çÔrKQ#%çn™½4Ãõ—¤XbóIŒ_< ó{?ZÏþ&wÕ¶éž×öôڦÑŠñ#Ç/}DÍÎE‰æ§m:ªul”:ŸñÂ4ï;ˆ^ºœ+µ4Yk%n¼w¤ØOÓûqœfïÙ–³^Éd\¯c3ŠQ¸ F”æ ¼à!O@2d¾P#õžq–ïØ­»®šuß ¥ëº£¹DûK†j9˜$ZîGZ‚ +SÜÏ ÇyÖ¿0Çu¾.µžRÝ72Ïüš$Zn¤8ö‡à­1@Yf¸Š¡o¹¨ž4;iž—i–ß~xÌû¢µ\vÛž;VÍù:YjV¤È0ÈTÁ$Çø ,ÙŒÀ087Wh,Å2?'ù®;>å2|Î7 2Œ?)zá`’g¼ðéî[­d2lœä|L“ŒÿA×ý¡lÚ°Vy6›îS·h~R+¶+§h~Ðu´uÛý¤æ¹ 0Gn^X[3:&£;V'õ3F§ßkœã»Ï5îGâ‘Ë]·ë¾*¾ ¹ØxÌùœsjf7Ä#§+òqËI­r:¨µíçѺéb”ä>•¢5*Dk TŽØ0„]jOž±ÝÙ®±â; +³ëF¬šóPjÜÎÅÈžcÁ÷;˜9Š[Ù~[ ©ÆjžåzVËæ£,ÃÐX˜ß7`xßQÓ½ÛÑs5Ê5]Œà×~ó4ïyR2~Ë“æ3±ã|Ou\ 0z*´+Wi+ÈðEû‡Ó5]Œ`¹Å¶Ì‚ûĪ8ÎÉ×€Õ ƒ1a×ZÎ4|GjÁp0ŠYgl¦æ!½®µ›$™ß{®ëRŠå8 )Kr 4K휨ÏݾíV–`j&€XñŸfHæÛ$×s8`pV¦Æ:`z»$ÁpLB鸫v-ç¢,ó7Èl±mh³›ˆÛQ†kþË’œ—Yšñ¨»ß¬¾å’Qõ\ŒRÜ_aŠí[·èb¤Ö$ ÅAŽ[n4S/¸—§îæ)¶£d=NÝO9žù|p× +Œ€~M8aZÃ,Ëùcu-·Eûešå½K3|q†ïÁ)ÚߣŽõJ1:”KƯb»Œ“|ÿŽñ4Mt?YuÓ%©nº4í·yžû8N´ŸE˵,ÉýAp~…¯‹'v‡ñ ãз\õ:&ƒzËBáw'@±ßDΜ…©³ 6UeC°5â”='½¾eH±î;äÔm'R,çGˆç}ŒrM§Å®õ?§ØY‹kîBçª ÍÖZI‘œZãu6K³žÄWÚF0 ®ãØõöÂÃK§dØJáu9LñÝ$ÙeÛžéK@è< ¤”üÅ‘jŽrübKñ­ã N4aå@FË|ä—[ à[Œb×[0ºž+‘#æV2LãyMv¿]÷“Ð÷Ü0ÊîO¯n?œ®)•ÏùhçtÜì{®F¶‡Áö à·>Rßcœ`û/jÞ+õÌe õÄï˜X´Ÿgûž«^áwÑ©|N’M"Ã}Á؈Ôs~+èL®I]çgž`7ª6­7òiÇM©ct;Ív¿E)¶¿j±‘ÀÉR>Ízg•¬'á{‚ƒ$¹Òv¢`ýͳ‹‰j±‰,±ÔFô®Ò2Èh­Ep™"Kqr­ý¬Þ»Çò +ídÙÕVÃ$ïSŒb÷ä÷®5ã{zÖù©6mêqï©€ÆèˆS´¾e)®· Ëû9]¼KǼ®ýS-z”†í4Í2›uÇ%ý¼åp”b½!Hî D’Þ+vºÜjžå~ÒzößLÃê4T0ºñJæç@É|%¹2ìâ#´Á#¬ ©Q±ØD’\m>?eýñ:æw»ô<0¸À/ûIòë>Óüª©ßúÍôËæ“–ß”zæ~îÖÍgQŽí@œä!ZªÌbüÄì(Åpþ' çw¦ázôëv”Þý¸í~ϵßÅOìM…ŽîD˜æï0×qBh9Ÿ¤–õF,YÏÔ’ï똤žñ4O±¾Â ‘›Â +’{„8ÞÓ4ÁwÞT¬7a‚½É8Çt'šr$óa¿÷¿ržã‡Þ§Ó{#5×ÌšãX˜ßz0º¦;AzídÎ,‚[c5ѱ½æiΩe¾ËÓKOQ†ë5Îó>¦IΡj¹æ¹?Ãïqžç¸'XO¬¢çxÑs‹Sìn‚ßc”ë8 S># 9uÓ©0½wãÜ‹ X›‹`WÚÎ3ÝÏqšûÃ.œ +Ò¬_I–ï7O³~HEËQXÁzÀD‹U5E@°d/Xw¥šî•×Á¨©šk¢ýâ=×q0˲~…¾wÜd•Y`ab§Ð¹2;9†µ¥l½×ÌŽ5Û…Rô½iËF€¤rnDZ5Ö!ÄÇl÷¬@‹gX/Ls–åï³…Óµ×y%Ô­·‚÷»ŒØz+vÍ/JÓzœ¥_ò#çQÔ„­1§ð8eÙ¾¡†ª E(Æûžh¿pzîÿ¤ã}“ú¶£Váw?Úø]O|nKh.Œ¦û,Êq¾ÅHÞû”fýrªæW¯p¹ìU>ÇAôZ3I‚­m·ì=4KƳ,Çô£ù®B,çE„aö;Xk:̲^$¨uö@åG,$Ù¥–‚&éý`#™EÉ4ÌBÍRÜè­¯Íý¡—þ»zé)ά4B%vïúÕf”–ù0` âV’Ø!Än›4»Îý°óB?j¼u«Î—(ÃÔ”Tõ=ʧl2Ú@Œ!\K³k1víT æA0¶,:/å’ëÄ/¶7Ý·_ïïC„b}ˆš)³ 4Ms£V[ñJî×DÁyA¬4¾*´;Uj"C±{ËRÌWa‚ÑWq^¥ Ö6¬’óÏ+{®&θ©RÃ#eæØÅ6ó×¥Yu¾ªE×_œÞ³g˜mjÏ­è~ +2ŒåhÝ¢çŶ̞ó\!1}ëéëvÓ[ž^µ¥Wíh=ßyO´~„NÙ§8 á×Î3¬¯‘r¥ÙX¹Æv¬_4inÄèõ62ÀÁZƒ  · J¡™<·Ú„Øð›[®ëPÁn8R17ß­×aÂé`’é>ÇË DÍ|¥)fçIÍþ(¹ObƒSYzßhžâ; X[HQŒ¬Ž÷C)[Ž9›tÆïDÔxá@Ì|ë?3ÿ÷„Ë@Avë%ů6åNDùå&‚ìÂÙ0Ùs9ËöÝŠ›°·¾0}¦yæÇ8Çy§šŒ®û4Íóþ…OŒŽ!F+ DXÞË(×r2J´?H5ûˆ€Åð‚95BÓÏ)~ù¼å{Èh|Ƴ÷‘³ufÁäÇ­ÎëFŠ`n`Ø\–Ø.Á/\T—Ó^ÇêšÓøÜϵ¬9}ï“Ó÷žË6€$Lí"ÔI âXõaʼnìCKÓœDVNÏ~'Ÿy] +ïûdçqJ=ï>,ÍÅŽ÷ …¨î‹Óû8e}Œ18«.'„¢ñ&GoÛ\»Mûc˜_p$rªÒ8|ã½I±ìßy¢ç„xÞrI=î}Ìr 狦ñ@[ø•ê¶ :Çù›%Y/"ß[¹Ö‚Ós~Šm÷;ŽTd/̯۵J&#JËFÛtD*ZŽ-û7z\l´8½]”_;ŽÙƒM/V¸a=(¹ÓªöK¯ì¹gÜо‡¹Ô<èLÉ‹Õ0Þ† ÆOñS(ùÃ$Áum|nËeÇ §å¼É°ë&b'ËLUãÁ†Ìd §èº!ÖZŒó‹§YžãXØxë1€àûÚŽ+RÙþ'Ø„¶ý¼&[îÅo¬7¡Ó­‡¨‰:»àò4ÆÂ×åÖ“–ý8RñžÅ0+ Eùå†ó,ï?Š^8‘£—Ž"ˆ…¶²üÖUžamÈkY/”¢ý,Ì/ÞFyö» Í~äx/‚ s“q‚ßH’ai,†Zc0Oïšvëæ ­å:Mó gÔJ«YŽñÀª\¯šU¼bÍu¬ai+ϰ³›éwͨ¿É<Ám D.4˜¤˜=% æg˜q›@Cd\J¿D»j.O17œ)ØÎÒ»_ˆqš_X)J§N¡4µÚvªß7âuL7r»lAF_¸mZ÷5M4¿ÃçõbÆi,æÆçDÉ|à=wó4÷ažbô™è—bk[Q~í7Òp(Mû‡Ñ7]2:6f¸Ž«1ÆïbŽïº£:nÃŒÕY§w ß×ZJ3 îf +®ï@Ó|”"y/‚¦kͦÃ0ÉúŽ![Iñ 'œ¦÷ÊêzE׉ ÁüŽ ™ß$ó[ø¾xœ§¹oÂ{s:Ñfh§m6Ý|“¤˜[ #Z1ŒÍ†‰ÞK¥ó¹ªŸ³AèØbÔJ‹VÙsPÜ6m}Éð˶b§Ë&ƒlïRyÜQ*‹Vås´0½7\žäÃ#™_Œ¶ån¦_¶hø­$Ùe{Q’í7L7Ÿ{5³sJáth¶Ø\†ì9-5­VëÜ.j}û£ÖvôÊö÷¢ç:OZn³jëG‚Weð„/¸@•é(ÛwÃ'|ÆPÊ®{^Ù}äRüFA…ì%>ÒÊé0°\¥uxñz –ý=åÛ9M÷¯Yø\Ô¯+ñsŠßH»kC¨z¯b§Š †pKÍeÞƒ½úÂn¥æç4¿w$J¨NàhMŒRjbUlO9‚Á yš_`2¤uÖÂ×…ƒñ ß±Zu]²šŽÛašõP«Y¯å®åH|^ú«³4]m^¶ØNätéÊ(œŽˆG~çÒƒSAlr?µg=Vn‡ŒÎï^”é~2~‡³”ßíLÉx'V½wQ–ï$Å1=û‡~ÎtB©Ùï ãK’Þû«45Uf7L0¾‰E÷I¡Ø,ϰ²™'®Ä(ÆØÁ2;¡óõ¦&k-BŠÓøtÏ!«k?ÊRì …k E ¦“ ¿o&J±7˜'¸~ãW˜`8á4§bßq;Ò±]EÐj>‚'õIr™É<Ãn¼©ÙŽ×?Œ^k%É.[‹Æk·í9dÏáFjŽâWeÖaÜZ“yŠó$ǯÝï*íÎTÙI² §²üÖ[ ¹ÖDø¨È<ˆ]7e×M§*gýßX1½æi®?¯n¹­ömG¤–åF”`o#É.܉ò{1zí1Я½wÓ‹Üî›’Æ·4Ãx˜æ8ÿ‹®ý=[ù]R\ƲʦSY‚í#G0]d¾[p±Bã€åiN(5×¹†­a}Êv¬Ï8ßä‚ñ8Ô/㸥¢752üº-¯kÿvû¶ÛnÛàIËt3Ls\š–»q¢ãD„a|Šq~éD°8®{páùr!l: §é<П»Ižó*Æ®‹1l§^ásZn;îÈç=÷kŠáb½Î:‚a·æ[ŽZ-«û¹ªÉ˜RËê†Óô~ç©Þ7qÑ Õ£F€$ÎC©%ϊזÒ÷¾J-›µ–Ùq«h°Q’ñhˆÂFZ3;a“-ç1ô• ½l)D1~eHæK©cvF9uû¹[ø\GÐkm„ÖаŒ?>ÇîžR²ô”f¾JqŒ79Žó!Ç.}‡Öví!çy×0·¥v ÔÓö;«è~K2Œ§q‚í:Í0þÃŽÙ‡±K­‡gG¼‚ï!J®5Dª²Ä.¶;b{;byšey¢ìjã &»å«~ÏÔu^DM–¬3àx\×½Ðñæ[æ>MÓ¼_Ôsy~Ù0Óqh¸Ø>à`¥Á~ï.xbü˜¯µ8`kG꺢ô2;RÓt¤¹²jîsÃè'tÂÞNètß2´l­aX±"»y’éAjßâôÒo¤âºKÓ[÷víT²Ø8@¹Zãà„* ƒ’¤7Íò{RÏ}™gØþò«Ÿ,»ô?.¶@1»±¬7AŽëƪzÿ¼²ýÉ+šÿ"{“‘‚Áu±Ö6è¹+Ô­+Ü0ÅWµÎh¢bo=é™_óëa bt^5 ·ÜŽïHmØžCýÖw¦ã{ñZ¾ó¢ã| +­µ7Sc,ŒUc.N¯Û’+ $iE¦åR«™Š½ÍHÅÜp¦a¸¥•Ýw^Ù}¨NGZ¾×<ÃwâUlrÉw`U|WI†ñÒ'”´jA*/ðaå ‚s$¾RÍfÀ Ù~’`¸NSDï©O4l©ewϪYõÖ'Ô™Uˆ^6­ÕL†/ªîó¤e{PªÆ7«î=RÊÞ Ÿq9¤4N×s®ã:†bp<©X×И¿©‡lÎ×TïW’aú +²ŒwQ–ñ0J1ÜPv‡¢gU¦áFjLiÓ½ˆârYëÜ®èlϽ°ÑJƒY†ïLëzßÃ}ûƒzÎ÷;?_%†Od”§zMÃY«crajLNÚÍ“ŒbÙr"ɰ6™'ø>¬’ùN­Y®éå«Øá¢‹¸©R3±£ÕÆ¢hE´‚Õ‚Ô1ÜɲÛÝžýE?ìA<ðô fº:`õ=±¼‰0ú 3ío9¢åZøÀÞXŽã¼Ï ¿:ç3Nˆj?pl?N×q'Ì®4¢ž¶= +ÞGIváNèt­Í×~¦4n7Œºçlšé>“œ÷ †Á…Åè¼§ºŸ¢ÇõÖæªÃIÔÌ®rÇ•Åô;Qrœ V‰ß™ cÚ‡Ÿ“<ÄŽ•ŒŸ×®b4ËÉ0Ñq9R1>GJο<»ôçÖZÐ*Ök2S†õÈüAgêlCøåÆ¢,ßWè} ŸVÇ‘‹¤ÉµCýjs™rµu ·Ö^ ÁÚLa8j¶íofÓ~à6¬^"­2 Yn¥¹^™èEÉKü®Ì`»Ðt¦á7â•\WbÏøöëvSc{v×Fü¤ä"Ë.5)ØZ¯®7±é~ÎÑ-G’Ó}K!suÆqÓÄ®JÓz«xÊл&¥’Õ1eÝ  \Ž à‹UÚˆ¤w*¶8WhÏhœŽ‰‹6€–e—ÚK”kŒÛƒ®ÿpÛzn.Wâ3÷[ðÂê¿°úq|—bÑv·©(Áo¾¦Zï”ÂãžT¸Üï¹æ?«k¾‰Ò+E±jÌ(üÆí»ù gû Ò¬g!·³dÏ)§ï9çµg£œj/ðAd§ÄŽ•3èëD„~óIÅm½éØ7à ©ç=óºÖ¯b7>¥q.>[Ó+\_Ä#¯3NÇù 5Lï BÚ&n¶ÖJŠâ?f» “«Œ +†Ûq†ïÄ'º_|Æe|ˆáb‹ÁóÖ{δ?ŠM÷¹J…ßùšì:e8Ÿbüzû ãÔÞ‚Û^±Ô8Ä,½9 ü„Q€Yh ;_t¾.·–å÷.ÃëGbpÍkºoÔ·k^ÍsfšÈLàd¹½Øá¢oôÀî/Ï.ý¨ýº¹4»ÒR«äFCf~;îã0Ç|’â7/¢F‹mã×Å ÁûbÔ}'Ã,ïS”_¸aÔ=‡"ÃoðºØRìtßDà|­í@Íü Uœ×rÓy.OZ_ƒÃ’ñM©\†Ð©Žk9Ší'Ær|qóõÆâ×}cVÛu)Ê0< òËž%û‹Öó\‹Ü÷~Ý7‚]ö&Dl 6TrÇ­4@©¹Ë2LZÙuD)ú.Æïª­NR[äÖ£ØÅ¢5–#ã;€^o`¤Ê6xVi7Ð0|N”̧išõ>°½ƒMœˆ®78VhD.¶–èWý…1‹M䨥·,Éøâ”‡ëUžZl'†KðG+³—h˜› £Õœ&øßÕ•µÜ²ÛGO*>Ad{¶ ƒ E;·tßaÓೕ×åH½Ò6ðŒÈ,Ë/4'ž´Xë¼NFiÆ—ØÑBKáëJ[IŽí8Ð2¾‡ËîÛL¿k@ì7­§g籚 àDÞ¿ØájÓ£Ô&“¤Nc–Ij‘)¹`i.TªwJTk¼†×ˆÕsFiÖ‡ qšcpYj¨‘z§ÃÎxâr'Ì«³E&7Lm¨\ÓÁÏr&Ç/Ç)¶ã8Ëz"X[ÎӬϒí$HïÛ ß÷ã÷uóAÏü›hØnÔzߢ=àºÊS«l™Ãõô¤÷>j¸.bôÒ!ŒD‘ˆÑb3!’ù4Í3¿'+§Óbßq0„Zf$G/¶¡žöRšö“ÅîJœÊ$¤@™u˜¹Zëp35÷Q¿nzEç ¼¢3S*ÎƇ¹Þ0@ÁÌš „òj‚ITÙ +`W›°¶#©áú + U|ÆÙµ6Ŧã¨ÖøŒ°»)†RJ¶Þ6Tg'€YhÜŸ²þÅ ÖÖQ k1~éE©Úoã$óGŽbw£˜ÝÃØe‹aší1Æ3ÿÁ )‡™¥÷ s¬×qš÷@izÎD(öŸ°érû‚µ³á:vÛö“ðÄ성18QRwÅu•ã™Ïc®çxÏsœŽTÜoLRsÈêîHÃt`XýŸ³„$7Ñ»÷pµƒÈõ#{K‰n¡5µe{u›ö‹ü´Üà@ŒzÀÅtËEðÊlæ ¾Ÿ »u©F +סÌRñ~µ5¹_¼Š›(ù!Cá +@˜Öœt½ax ÃKh±R3ÑÛbù‚ÙYªXl8×/·h9ß!fê ‰[îxW/-Gê“f—šI³kmƒ¸¥†’ ×M’aõ:Iq -Yp„®Xƒšò…%6гk +Ö¦3ã}Rt‹r¼¯^ásÄi¸N”Ží.I1JmO񨃯£3úIãIðžÒ"Ãñö:6­ÂûEçÙ^“×UìP¥Ux)’o˜¡R+~Ý€Í8ÇNØîBë‘RöÝð¹Žc1Ší!D°7TŽÚ^Ü%xPs4\ßfåu7ϲ>%)VŸQžùEÚyÝ×ì.:uËùšhþ…&4Èðê]Ä×+§í~(2bÙs<Ç‘Ãz*•¬<æynE/ªŒ˜jÉëS3ÑŠÙ`ìtÛ\à`­Ãz^S=Ç£}ÏÐi†Ý?è µW§Æ°Ù¶ÿ†YÖ›ða¥}¸‰" QCEÆüÖGŠß{Ž“¼ïÀÄÊ5È2 +FÙm{Vãt,t¼Ú"€¡õjð ƒìj JÏù)¶íWNÁõ3?`Žaœ›…×eËd@§ï¹‘á\ Ѽ7JÛqD*ZÏÓæƒ©äp”Ì)‚Wó&YŸãûCzSi^zÀh´^ X¸d 3Hk˜¦X=†¹•–áfÉMRìÒ_e¿ŒÑ<ƒ»·©ÐB¼üŒ#øˆVmÆöèv¼/A†ó fºÞ0t¥5¤0ÉSð¸ÞDŽ`t¡t¼ÿ8zµù¤d<ÌÓ çâX%_Q¤’‡»ÔZü°ÌHboA¨ÛO|ÊéZüÀÜ„Öo Ý' +*ãW˜Þ74aôF È0¬D‘™$»pCª9/2üÚAäh©¥,»mÏíy¬ªý5OqÞO‹íÍ“ !Ô†RÊÝ»vá^¿àLŒá;M³Ì/I†åKø¨Üœ\Éf~È#M®³"V\§vßR «ÐX«Òv®^nBHÝûÔ§{ï ƒÔ¦@„û5áËZ#Q‚Ño°\kCm—.Âf‰]AÅ|"Çkn|Î0s\€N—þƒ Ó¨º´ß£i>H1Ì-ÇYÆÏ »t:Sfp’Ò5Õ.3š*רÌÌ ˆûæûlÛqAiyoçO’]¼ ¬6 +(Djâ³K§0#46A†±E¯í8fU·BôÚaèd±©Ð¹Z‹DÖ°b4ö=Ïx˜¥øâ&+í例脹ñšjÿñ¹î§»ôŸÖ…±A(öOP™>㯑¿j/v¬È^a<’ºŽKVÑ}d5Œ÷`CTž äIÕ‚•VÉu 5Ið +8š]¤ø%IÀ±¬‚@b´V¡Fï=Ïq$jx rŠÄr¤`úqkM2"Û²/˜[F®b<+¶¡UÌñ5Í=È‘MžVsÞT|GacÅÆÁHP‚I:…Ï«CöÖ‹’õ+N/· ¾ ² +t í% ö¦¢ÆIþAÇ©Ìä®×,ÙýÁ0·"ö[/"ßg¢ZeJ­yòоÛ4Ñþ5\mR˜ä j¶Ö@Üh¥e°¡»y~ë¾ê×~ÒüZƒq~Ùn˜j¿†(4 T$© ÄPF…È1bw½Þ~V0ý†Ú¥–‚8U6¢WÅ&‚åB‡)­ÃKÑÄ û…Ñ +íò*-†Ê¥fê2i‘ádµÎJ†\k*r¸Þ@äP±yÀq*k1œ2[‰b©ÅT»Ô|\/3%PØYjõ¼÷0Í/4™f˜.ŒžõC(Ú¯£|Ëø‚ñ0K0>1k ƒ.X¦æFÝžù*K/·*Fë +,Iñ3Ti"A¯ÝFiÎ3«n?GpëŒNTÜ÷\ËÁø}µ¥ØéJëèá@ÐL‘©Åzãxß‹ŠíXŸqÑ‹ Å8~»^ásÅçzŽE(vWq3U&Â&©}!©}A¦é²üZky‚±eÀ² ËPST†!´2ûr½…ÀÙzë “¥¦"'‹mB —üø´~i~µM¨!:_ ‚õÂða±qèdÑMÜL¹m µì*Ë®{#U1:–V&Ï)x̳ûÖAË’\‚HQ{…LÕY +r¬¿y’ù5O°žDÒ›‚Md©Åæ¡æi, ³‹VÛŠö7¥ò;ä8O‚ÌJ+9b¡©^•m±Æœ\2 3|çð25¶ÈѺ„MXÅŽ—› +ךJ²[Oñ³JS!œŠ«å7¤Ô .9 À¤8øŠ00*o»Ü|Ö/ý„yE梘e¶¢ë[©è Dǘà9]@ÂvQ¬JëX^¥y8©ÆD¢Sî“êT[ØÃuvå¦ãRˆß¾Óoͯ(?i¼%øÇËL¸Kû93û9 +K£‰n±…ô¦ÎL̽OèP,»àTš]m.L°=çyÖûhç2†Ó²¿„ï ƒ‰Q{KÓ;E¯«mcV—qŠ÷'É®=ñë-zîÇ4É}=°:˜«³:^l2Nq]™-ߥÛ3~ÅùÅvµšÍqÉúEBe:NÕë¬FêEÛZÉæhŠè¼ÇÖÇWš l¶åp’_m@[p½Ê#F'Yv¹(ÅmT*œÏtfWõCV§Í²ûÅèÚ?œªãJœXg/ש8HkÎBÅ’Ã@»l@)9¥²ãˆ´ó;fTn÷cºçDŽ]·”fZVËöÏ,Áp"G/PJÎ#¥æ¼RjÖ+¥ç>/:Ϋð9½'Øü|¥Y°ÙÏ»"Çi‹ä^€lÅp”Ü3M¯5£žxÜH²ë ˆëŽ[â«cNáu/za».µ 4Oò ZŽÚ*~UfE*8ƒfû•ð½RJ½nÍizî†)î§Ãè®4™eÙžÓ<ãwœâ;J2kmÂÌy¥n3ºšÝ]«ë9‰+3ÞW[ ˜‰.´dù>½¾éPäl±q€E†á%j eè׫‡ÅðG*ÛÎ Ç@ŒžÐŠà‘ø†ê}I†Á•ða©ÀÉRÛðuÁ¡àa¹•Åð!r Æ*Xé « 6½‹Ø1Ÿ$øíK 1ŠW¢%_ ²5WPÂcöP#5V¤ž÷?k¿ ßѵÿIÖo˜ar›èe©m˜™B‹ C;†Ðƒ »Þ@†apÂîÛÛžë5½ö)² \1 +B°] 2Qs¼®µiø¸õ²•8¹ÎZœ`k6Ï0ÞäÖ·‚ÕIìd­A@ J?09Š“ÈsZÕ}¦_AŠV ÅïÉ b”"s1¤J ±cuÆ‚·¥fA*N"ô¾M³fº7Id <»`´â£܇!öD( +B”UÌ1è(µO”ZhÇ«¹ïÂÇGÁˆVŒA +ÏXƒÍÓ˜ÞÙŠ —ɱˆ²Ä*ûPBÁyV¯¶kÐ7Ü‚áCèT©m€òd¦aæjíE° ‡‚à ¥l}L\/irµùª`|HÑ‹OÁëê;Ìxá9Ôdµ‰à]©¡f©Ñ4Íxç9³çOŒ]8¦X}ÆIÞ‹(·Ú` ©Ì<”YhOê»oÃ4Ñ ÃØ`³Ê¦Ø³ç4Û;àT‘u°‘š¿Íw+ÚŒë4>…¦÷X*[ÎMO˜„ ’kuï…²ñ>ŠqL‡áûZû Ó‡Áû‚ƒa’ý Î+4œìY +£ÑƒjLT«ÌÉÓ{Ôp[Hq+­ƒŒ\ÅŽW›H\NÑy!µëö" ÅÞ±z϶ÛvßUóG„^¸6Tf¸µ#q£!Dêõƒ–ópœÚ tšÚ1Ìp¾ÇlË a’û,ÊnýD F?Izë1Ï.œz¯åžó$|Qo£—Ú“Ú–>Õþ™æXï›’ó>)øŽ¢¥§[ae»EÝší!G0{ à×ÝD ÖÈ0Ì.t–÷JhY½šù+†Nðd~¾5ÉoÏu~G!&i­Á¹ƒ’$µŠ¯·á˜|®ãªWùI2¬M…PêmͪãžSôœÉÐ{ï0c…vÁEjLD(ÎçDÍr¾k·žä†Á­ø •/èy•WôþHeËÉ,¿x 2Lób¤Ò<ØX­¡àiµE³è¸"U|…/ +óK+NÍú–¤w?RôîSŽå~qê–›ò˜ùWHfü”Ñ9ï"X%§@ƒd¦~íÆë8Æùí—V­¡Z©µv¹‰½p\®{n%ùÕV‚gUV‚&ë,†Ðëí:æ£$¿weØÛ +b“[C/ìå*;1zë pdÉTŒØnªÎ6€]o-Ë0ÿ&:æó¢æþH±K R #dŠWh™r1Ðtò€35&2ç[è8£”-ç²ôæ#ÈÅ;è4ÁÔqž”ΰ@ÐE°ÈÃ8µFCõºÛPÁî3T0û-­´=°5bùÎc®ïVð´è(v¬ÖJŠbx 1Ch:Ef`\¿q’÷!v¨Ì8ä<ÅSø°ÒJŒ_|ŽTìþ³v±ÍL±ÎB‘Ò"ˬ²½ª³ 4NpÀ-²eXš 4L/RÓübô¬‡VÓ~B0:ʦ“NÍ ð¡åjMƒT/,ª]*xVe0Mqž(MïxÆêl˜]8 <ŠK,È®³#5gâ Ó˜¹Jûø}ázMwÌRLR»nT­x¿"G áåÈLc\÷oŽr»“ߨÃÆ‰,†ŽFpé}b§(rœ‚+±f= â[ŠŸVZŒ`ÖH±ËîAÄz+Ifµñ¨];+R«2×'ÞÔ Î‚ôZÓ@ÓD6ÇjMÅXæ[­cwU®¹Ï¶g¾õD§÷Š`”›fêÕ6SÝj«‘zï'È/{ Ÿ”ZŠÖ sŒo^ÓûF¬2¤Ú͓̿ÐtÞPÃäÁÃ:CñÓZÓÀ…H­A ÷‹’ÜBÓy†õ”P»"zSfF/¸¥>ÅŽUÚŠàšIòkgIšûÄ/;LÓ«1„¾@ãó¥‘ví4ÏpÿäÞ»ðÑGè`­•àu½mÃÜ‚ÒtßÃΓ ¢•šKìnÂ×t"ÇGm"§(>'iÞáI~AKÄ85†²ÔbãFH­'©-‚ôjÛ‰Š÷+K.»Š¡TÛŠ ¯ÒìÚ;Ž^l×m:®£…vÉ AHLHÐDÍ•ZŠ_V›ˆŸT™Ô['a~­©e{JÞ‹È‘:³€dh=yÄ• ,7 TŽÚ'zVf~Kð¤—NBüæcÁèÁ/8™(ØØQŠ~ûÑÂóVëúÞ[žó˜,ÅUØT1¥p¹š$šŠ¡y£(Ñ›"“1†Õ‹Ð´ÿÇ4ãO·Y~S9’Ý~Ð5?ÇYΛÁv 6–Yx0¹Lè8Á<»õ!Vl¯r•…h±RU q2å8¿n(bÒ”p¿nœà-x`ô/Pf/pªÒ@†_8å—Û„–ª×‹(u2úŽ›9žå,œµ/ØprE@:_°y2kAœ2Ë‘~í$Z‚¾TxÀJ_m5O±¾EùÕ{˜I‚sP’›ÐtF¤*‹‘z±IX¡‚=ðB˜"§IL¬žë;Ó°½'ã‰Pñ>DÊ ƒ‹RÜ¥XæÏÏý"Hë 1z¾ L„Æîµ§£ôÂé4ÅàDŽ[mNª^À§œ‘Jîci2ãCuÖá ßq˜í9*¶-WÕ¢åxSo„ŽÒ{„ª­ŒÎï\Œl:-Tl ˜PbMRÛ@Ó_YvéÕ­º_œšù$zXh Ư¶^|~`òô å©ÅAçÇìa|‚¥VpèWšˆ©1b˜}È<ÇE§ñS*ÜNDÇ(}‚Ej£‡„Qf©1¯æ<´Kß8V™ÕD¿ôœ'øNBçèBgHí¢%)‚±±f©(ÃÜdœ`=H¬dŽÎ&J/5ß4Ìï€CµfâwµVÂìjë8F‘M0bd2ij©¹à@ä\±i ™:sÔbÛ–ý8Íô +œ÷MË~#•Y %ÓçÊ÷˜ÕÖ1ìÖG„ß| Ž% ¶×8Ëøc5Ýÿ\Š,­Ð^š_u L¬`Püšx1»`¤M!¦þAçiLF +V9V¡q0C´6in©¹<»t¦Xݹå¶&híqÔzc1Ìjû0vá®Â5Ÿ cÔ~`"¤®pÂ$'QsµŒ’õ;M¯·<˜D5€@±°b•zI~éd”ÞRxаµ30ùiW`9’—Å~ Ò+:à¨ÑpÓÓ 4®ÐÒÖ@DÚŠd'Cgb×þ’$÷yÑpÞÄKL‚f Sl÷~ÕAÐ<•¨y"ë@„(žÁŠmšÂIS RÌÏA‚Ñ-YJY€Bå"Qñûº‡È‘Z[á«R;3E–¥ÊLƒ VÚÌrÌon娄AÇ,D/(œB¸çY½ö¬XïÒÜZÑ›³nÑrZ´S¬þJnÈ´K‚#Tˆ$v:ŽÓò¤åd–c} _VˆÑË6rìJÛ& æ`Æ*¶Á WìâæÃ$ëm ãýˆ2 îÁ‹µ ²”r+¹à·£ö»— cê`ù•ÁJ6|7äNa.Å™Üî}ÃW¥VBKÍæIÞ ½àb·Ú8Ø<‘i°”±#E¶ÂHEÆR½šïp­ÔH•Ü-Э3âuìÑK‚w¸ ÀAB·b± ^¥©0»ô¥÷>áeh½ƈbÔ¢»8³ì/ŠRl#v Ì6Ô ±5hÑŠ!ÄüŒq¨ß7¡Öš¨¹+3 ++BèE­¶Ä,7‘c×Þ£‚û"xJdtŒÞÀª˜~C8g‡Öü ¨|FjÌÂR|‚ Q»y•&¼‚õ1–Vf.ѯ7˜&˜bôêEìX±±n¹‘$»ve—ÛŽ”¬'Yz½µ0V¥¥øQ¡™Ëø .Pó8Zj8Iv\Òù¶ÑüdóŒÏI–ëRŠÈ)Vz¼¼­´ +8ŒÎ˜4±Yˆb;P §{FÇfH¥d3ŽP9K1\÷ “¤bµÈ¢Ôs>F¯*îᆉmbEÈ|ÁãíäzJË}¬U]"l2‹@Åhá+ÖÒì¾}½Þ.”½+À zsx©jã ~Á%­f½5«î£ ½ô 6HltlÏy’ó%zYk`ä°µ30zcˆ‰Z;1~µè)©+à™E_l!Do]ƒ‹’{¨'Ù/Ž£– ^SY‹^ÔX +`™)Cæ àÖZoÞû¤e9˜#xÿ‘3eöá³J;óôŽ@Á+Bcàñ;jÀcÈÄ¡†iý¢×¥fRôÖSŒ^tcX¥ØÕ6b‡)Â×ω‚í¨ø¨0BˆEÁ‹ìLׄ‹Ä —§YžóàÂ;€ÂŠ?@®µT<Ÿ€ÃAŠe—†§²:av–äØ/³,ÏUÐGï€ 7j€ÀBä,©9Ü0É+Ð,Y "äÞ€å(NB³õ¬íJÄ\½Äàø5‘‘Ôr?dG n +TÚƒ=ì Pät­%é9›Áê„,© œ8¡>ŒWsÁ§9Ÿr™£·…™¤±Lðš ã3RŒrû¦^n'€Ck 7Jî\˜âfšÆHŸÎxÕ+8œéÝ…‹£øÅvåóY—ÜzE周ÔFñŠ ¯ĩÎÐZ„+C)4^qlZÏL½Ö8UinŠÒpŽÐ*€Ue.‚Xl-ŽOc3Q°7”dW›(Õ°˜)XýE° m)øÊ,R ©$ðhv9ÐÁ욀 >qn¡} £äTzº'H¯³a5ì7QrÑIð¢Ð.èà_@Â#>!„2»¡†Õ~Öq$tžÒ&Ä ¹7ˆ]k-Ï0ú +¡šš!µ¥÷ÆPëL¤¹UÆ»zá:ŽVk~Qcl–à$zTg"H°º ô«7^Éû(ø.’kÓ‰Žó+I1þDÙ­'­h¿sœ·àâ4×`2U–‚Ì ÅM˜Û’-'­ÎgÄ(Åx½.5Ÿ“|ÒŽÕÑ$Óz>079\lAò݆™æëLÁÖÛ.Û ÂÉu+k,Ø$›1"† ŽÊϺ ½Á O;D/Hà4Y@"ÊÑ_³ÌŠÐ¸ cºÅLÖ‰™§y‹#t‡m8‹viUf¬Žß8d¶]¸ØéIÑÓZ+¡CÕVBgªMƒË<‚¢U$R.¾*²hY¿ "Ò-|C fz¾$p”Ú$|Sh(€Kó8Bæ D’P”<¯N–[j?j·~‚Çô¶“䮢ohJ{ »t—%yßñ£:£@N,l¸Å-47SfF€Ô ¬ÈŠ%bWP´–ð2äŽQ¬Z£q~óhŠÜ\~Ò*Æ®}d(ægx9zs ²c bKˆéA{ÈBÓ8·ÔL]n€<½Vì,Éa–_÷—%ØŸâÆŠV› Þ×}‚H²JBIHƒ ð„#³I‹ËÍ…¯ËøuoAzí:ʯ^B ¦$^¨+Ç(øŠ«µ :¶ãb ±Eˆ,‘‘ Ñª_x‰bë`fHÎq„b»À™õÀ +¡¨÷+ŽU“ô$[–ÐÂd¦áÅÉ CK‘¦ fwQãc>EK–/éüFï f*-ƒ”£·„¢õ ŸÚ ¡ÖÛŒS¼×izÁI°‚çGOK2]bc°¢-'C¹•ÀƱ*'zH¬à y¨*‡¯Î6Hfe€B‚aÄ+s䆰1”’`#çGƒ©…¢t,=äiÝ|Ì­ +GçÄ­7<'5^€à° ½=ì@‘­øAÍ5È‘7„VehŠÜ´ ±+8 ZSÀBû@2„F1|2›¡vÑ‘Xò¾“©W uë£YE6— ¢ 'àâ(µÀ‹%„–#4 ¢ÕØMõËÍ' A¦ +EÂä2+QsäÎâSîÃ$Üj3Izí F±ºLs¬ß`óTæâôÞ}Ó±¾ÄŒÑ¹E¦¤º¿ÃTÇy»ô ÷ƒFßr±Ñ4Çyª ¸ÜrzÆŸØÉ;ÁãJKÁ ƒC!ž÷Ø«\FÚ?”ösø¾Þ,È,¹gŽdü3Š6(JðT„Ö*\Þ6Oi"dÆ<¼ É=Ø,És aü‡¬ÍËx!£Õ¶@Šê÷2.¢_¬`rY`b§8»Ölœ_7 É% JÌL[Šà|#Uq(Õ0!ÕoÓ05Jl—¥×Žã4û€¡E +Ї…¹e¦‡éAÈ–ü@ÇÒ 9L€`ÑV@¬2Qzµ‘±Ò(Ø"u abƒ½ÞTü¤ÎZ«ÒJÈ0ÉGÐ8•=¡z%ÀpÁGkXOgI® +º„Ë™–©5VŽâlä)r”æd”âh˜æ+É/úM .ƒ ‘y‹ZLÚBÍÏZ‚•éXDÏȽŒ"{Qt’[È!*ÿ®_m>(W[‡™£¶…¦ù—¨4 1Yu@©6%” +¡ÕYJ2ì-»]Ï¡4½è)v Î.° ±'¨ ­KÜl½ÅøiÁ}‘äÐ!¬zš­™…°Inó ïc˜ä¹;\ö >¶êNð¢.ˆ!œ’ðr$Aã4¦‚ÇEw Å1+‚+8DŽÕÛ›*61Ne l Èdœ^=ˆ‰lB +3ëÅQjîâ§ÅÖAŒ”ÙŽ× Q‹ÅÙE1fÁ}µÜHØ8‘U#z•¡åºEBÈ-#àbGÉæ-?ä)Dì#Ö¯"u + Ô˜–ª×¬V^“{)Ø h‚8‘ãóGó* ÛÎÙ µËnBǽÀ ãŠ^”Fqj­‚“¬šŽ©¸<ç +DÜ)~Yl&Ì/:H’Ë ƒ– õ›§²;Xm)x\ôÁ0<‹âÔZ ä”Z ŒA…KÎPæPb¡U°jS°rc°’ýNxá‚;ì4ÁS§Æ<–UgÌL½0QÁNÁ0„2 p©?e ,QeE±;K’¼QŠó#p¾ð6ÐqG:æ· AR;ðaæJ|®ùHxÂl¸1‚à…<¡eÊŒ%Ù¥qÙ|qQˆïI ©Ñ·)GœïÐù²› ‘B;QCµ6!¥Jí}kÛ=©éþ%Ô¯3Id§4Î?FÛV¨µ¥ |Ê)dc;a)HÊNˆ0 ‚ ‚ B ¬IFøxmC¤Ä(Õ‚;ÊÉ0šv:~  »1FÓ™Áhº™ž¦y)/F +3I·í§“d?.VÈɼ))ÍŸ˜R¹„Œîœ“ÑPD%/@¦PËëåHXå*@Áä*†Eâ*2v_|¹Nh +x¼ _ý‡gP…ãÜASŒ¬\>‘ÔVˆÞQÏÅ:-ìì@ODÚoÅPs‚Û ¶[°'"]‡íت‚žõ2¼ᆠµ2ÐßÀÞD[ÛípW{3j˸=„MÜJ°m½é>l÷á öF´—ðÖ mØAßö"Ú²˜®‡ºØ›hKâ­nZpkƒvô‡¨ëa» ·T #}†·&Ü`áÖûØ›Q«Çú-ìêÀ^D[kÅPsƒ[ ¶Y°7¢]‡í~تƒþõ2¼ᆠµ2ÐßÀÞD[ÛípW{3j˸=„MÜJ°m½é>l÷á öF´—ðÖ mØAߎ uÅ é´ 2ùÚÄdy8d164180-d04d-45a3-8d39-deecbfdc5c06404-da2b-4a24-9c64-4b13b70fd7c9-7818977687548l56.20960237lh +WQ48=Á„Q­«HXÕ6Gµú•¸0éâz`¯è†Q æhŒÊix0éuP·Gv`Q½#*Ô +7)?r ³ߎ°h5[Ý»cƒ£QnÜ,ö˜®š¨õZQM[%1ªC»À +— ¦—âÉÁ,7b16bcfec-f6ca-4114-8b1c-e82243383f278bed7e99-581b-4ed0-be5d-3ecfc7a74f2e65773682Aÿ£:‡ªp ÕzF<ÚPãR í@¤…jáh¤ È.$3<,RMP^ÔAh ©ƒ:HÕ$å˜Ô¡ƒ—Q=C¨Æ@"ª5¸Õ$5Á¶hD°<&Û(7 $ܸ¨ž  ¦Çúêà +¤$X98ad9584-ea08-4334-b68b-0584cb1e06cfc-2e6a-4d26-bda4-a560b2266e112797358.550353050281.54962977384=z£:‡ª,¨ƒ +À &ìšÂ¢mÙé "¼àhDáT<ƒ:t )€å[bý÷EñŒ¢vúnE‘ð(">©¦NE3Q´Å¢v¯Ä³ÙÝ´wJ@£60ú¼àhœ4ŽÚaP t |‹÷yàâÙà#ÁŸ3º|QI¡Åç’™\~…^–Jd†øƒ¡Ï!FTÊ`´tŠŸ=ß3(íA+ɨ²Ä +.¢ÈžÔçŒB7¡Q_Ñ …öJ@‘ÑgЩ :È"ñçâ§ "£>g&Xí9" $’=e¸T‚—Jd’*Ü.UPRhD0ð@ +"E‘™—$’+V 8ñKBEOH"ø#1bˆ½=½%N€ö~=#P¬@QâDPXÂÄŠ@(z,L¬ð@¡Bè¡BEŠ F”ð‘±bDŠ%XôNüE`Ñ"°çìU‡Kä’Èt.SNT§K`ø‚ Jƒ'H”.UH Áh0I„½'HŒ aÂÄñ-"{Чrùüõ„Î(‰PeP¹dRCžÄi ç¹ü@"«Ðgtåd>«$ªÖ%@XGŒ ¨²¸d +I@‰Ã"г‡Œþ‚Ì— .IŸBáJPX”A€Ð§¯ gé¡ìŸÏhoäĉgq©‚ìA=§ÐaDô4ú–ÓiXÜÙ)éG R1Œ ™Ke±HdöœAfÐYD2Ÿ%\¤ËdÐI.F” €‚#F” 0bD (HPQ +$H¨ØP‚ÄN +àÒâ šH‘B¹¢$á\.?P€ØPÂ÷ûýHü~¿¿ßï÷ûýVü~'P P.•Ñdô÷ëõ‚Ê"2å‡ìý‚NiZU–Ð%4¹tZƒA§‰, +G ƒ>%€ÕÞÙ+uö Ï “D²¨ì‘ 0"iâÄ E'´—â\"—JT]~AdðT*{Ή§Ï„ f/ª &ƒ¿’ù,‚”@Q¢„Ïçë!AgQÄÒ” á1‚‚Š#?eT¤„ ‰Ÿ2*"|*{N¨2¨$ãŒ"=˜ÉåÄÊÕžsdC #H 1bÄ&>ž-ªÐâ¯Ç\Rpqüõ>àr‰—K¤ÈˆbÚƒ¾ì”t„bDµ„ +V¤%JŒ A‚Ĉ#‚NHÀÒ 2¸"š,Z{EeϹt :]@ƒÈeQêb9,•EÁ(ÒçB :‡.¦K$2XE|F…Â"ˆ‹%(Œ(á…(ª=$ 2H-²ü€Ê¢0TK€@{„ô¨#\š!š‘$)ÔéÓH R”f›,yR€ÀA¡áP@$†‚¢P ‚@`` Á€0 DZ‰­Ù•Ñ9 0(rÚKû¢Wf2žèžÄä‹9"ø¶“-: >¿QÕâ¢4J¬q®"q<Ÿ/S²f¯åL~Qɤèöw{¨Ž©;hF\KÇ8jʤ àŠ%'7cü’›¦1fL< «ÛœaÌbùÍ29YBWf›¶ª¸8ò¿"UKƒF¨ÃŽF FÄ–2+‰}Ï(?įT¡áµÔÓ8Ý è%ëà¡Þ± À¾]:‚ßÀ«Ú‡œÑ7½¾Ôâ|(¯ß;­¬•^Læ6‚އ,*–yÿz·¸¢=òŒŒntiP°÷ÆaÂD bÁczXËs 9Í5¶˜8“—£¤­ËRK'Réàš†b½o«òâ&)¦9ZðT·ôÝd„†‹ néáîö„]ÒXõqëÒÚÆ]?yRO«j™KœÎøÉbˆ•JìnóöBúøen ÑVvâjcg¸3?,Ž]oy!i¯2èÝ¿¨mw†rfÑ,±d²ÍΕ€rJº%ÕçO-ÅØO"9¦W÷Lè\…õ²H”AâB£GPŸ\Ë1Ó†ÈÉÜNšÂgi0ÒädlmF4~ÐK̤‘ -½ õçÙ3ûs_ö™ks_ÆVk2º8 "„M4Q¾ÑœVñïLwd8\ÙB¢ÈV ´ú{ÞoöXÌ 72.T!õôFÄ3Ýã{„{*õÆ•zvÍ&çÑQ×BÈßTQ„”-w\” ­ %I¼^×™´KYœIð"æ²trT4†fŽŸ–€Ò%–\ «”ÄÉÓéÃbøÜì_S‚½31ÍrXE†f¦Qä«Â'ÅNÄGÍÕ,$ñ¯3êº&ìv³PêLuôüH9w˜îYã‰S4Ïê;Ÿí¦Hbø, k‚vy8ïãéZâ úÉû³6œæÔ¡@^,$Yeê*TÍØßøi¼Üˆè‚D éò’(>r#3i‹sìo3Í’å‹Uñ±:ÈÙÆ“ȹD—s_\¤ÉÀÃó„ùEfO/óÚÛÀp†pFQÏ8–¸†}ðóô‰¬°º·@·´ø E|c‚mä·mðÅT̹-Ú[~eªo̯æx¶èZ-éolÐb'±K̬ç` Éc7ú³H0M7.ÏÂûd\‘óß<çj¼æ5«+ö“3{žÁÆ6k%˜â€5i+Å>•oC^Þ ÂæVõøâe–ŒYG¿0¯‡yRƒÌß«"Lì ÃAf1ßg“œ¡³93%¤[,P`±üÛgÉ6ŽêŠI܇–ð#  ê¿û‹€=ôÉé>¡î •³D±} ÝN•æO¼3°Ð{HpŽ\–³Ã‹%¶-|%ÿÑÅ.J=šB$Ø<66nÄÊ2F^.ÂüÂ Ì™êøƒ!ÉPi–Žq¡Óªøm[Pã £žÕØ(¡Ò› #ªåK¢°a¹^ë[qßÃØÜ·ûõ¸á «:‰˜ÅU*|PÖ‘á8xSÆÙ µý±Y…Z£¿KÈ‘VÇôΣ ‘*èp|fùê±5 /à+{3AÖ_Ïr":¾ú^Ò÷ŒC[+—Ì$obyˆ¸ãŠ~‹ð…V)Bn©0cêD¿¥Š~.èFW¡îœp\3Ï÷PŸ-ÇU÷x‘*žÄð½¬ÈÆÍ#jqâ Œº¡¿È¡ÁˆB…Öc%x˜/n¶ÓnrN‡=M<.ò0¿1idAlk_è°òUÞ+¯„{¿ªV‹I3§åÓÉ`ŃB‹ïFOS›ÇU¤M‡A¬¦¶éYâ4F +â*ñBœBÚK3÷¥-XÍÄþ†D¢{ +M ˆQÁɇ(/;C±7MÍØÉEfÀ޼öføDÝ<ô‘2Œ"E7vT"&Ma¬qt?C}ôäß­Ñà™ø;j{sm\•h + +Ùàtø4í÷Ü ¿ìéðt‡¦M¦@~É5è÷‚ÞŽapµLÅÓ,o¦l +`Z˜ÑK.€С×\ +ÊÁ¼ݳÙ{w6¦{ÓÝœ`A5>üå ÈÔ™ ²äëì]†Ÿ'Y¢a"›3ë¦Þæ°#Ç÷óÓ&4;©FpÀJîˆÚñ]³V¢œ°¬à˜õ€ÕzÑÃI«¿±O–çž1œ7,j¢H¢Q¢w6²øˆ ¬k³O6ã ogÚÁlÚa\À¯®ÍK»C ÃÔ–Ø)X$wö£Q©öovÓמ^íØ`h,…†úv4‡‰çžN¼™Ômê(Hu6)wÔl FÒ–¤'sÐ^ĸ0¦âiú4@¶…Ð*j¾J{ Ë×Íþ³ j.¦ätÁ“ØM­‚ˆ-k ›@éÌg¦g]Âûj!³Õ}Õ‘ dìZÛÈT"P# 1-¯”vµ‰ ¸i +q@BU€¡jÊ]„UÀäœÁxIv$T‘•i ƒôQžšOÈÍÅaE™aH@º‚¡ÜFïC±ÅXh§ðò’dŸg¬©ÅŠßçJ…ú]òèP`A˜}Fh[{ÏÒü¥Q}é3= Òü^\Jš®œ¯á(0Ò»ƒ(ØÊq$LÿRPy::Œ×¹È-[[ìE:†²eÀ,Œƒ¢*J¹ˆùÊG `©xCY!F0´›Ö³6D#¤ñ)Zó +Ϊ‘‚ÊÈ p‹5ö¾¦žbbú%¦ŒG&ƹkK +†Âp°nÕ{º&ÎáT+àÌ ÕŸ#v§$ H¯vmAß©=0¶›4Iâêv8ÊÒFþ$ipQª¥FÖ±‡ZÓÐfº÷NTÑ)ñs¡’ ê`Cý5ÆU².æê«ÂÇIŽ8’ÊÜ×<èÔä[QCÒYÄÊÍëÔBœD)ÌÊ4 +‘OÊ>LÈz‘µeVÆ?ÏEÀ«µ!"­§–ðóY{°@ˆ›#}»\ÐCÒ˜å#Ùä®å·¡@óåêcŠ[ÍÕq"-¡ Ð Ã ^+ÄÓþ+\^¬ˆsC á¤R½¯ Sµœt÷â͉ñƒµ¬GB²ânty€û²TcU¿ˆÿ|açƒ~Ðy„„©:#/udœÕ=Z@z:ÊTéè#$-weJ,ÂLÔ ŒìµjàÈWîYzékt”ÞºÕ Äé÷œ¦ %‘ÜÞÈE +y@k¹Ò ßVôá„…ì²nϼ—vEìÏþw¡ämÜÓyØþßn ö¸„@E©(?\5gmEJ\DË’=6À†vµ”myD gG6Ýá¾6vÁ1¶%ê…„Ÿ÷¾6k¡Ôær±G{©É"G-k¤6È›X#Mkõ»r7bù2®Ž6SÈ2öNõ¥Vø¨¿éj;[¨SBgÀŠÆµEM5^õÖtÅ»•û6AJŸ[Ì—Äô9ªò ‘nÐPQø:ÜÚ«Šz0@tªMù3ëíP¸ñ :y6‘©•/’áaß»ø6¯¹Û§)¥•p‡qOSXPeÆ”›OKo±ƒž K¨MÆFÙ¼½‚hÿGô »Æ³’ë½çÎ.©Ç¯™Ï®9‰Û$S~Å:½4וn éqµá&rÍÐâ½NÏì;ŠÁÁ +~eëÈjªÏFiéy° B%þ`1}¤PÜÁÐÞÇ0 u éIÊ"éâ É¤òò¨ôN‹ÿâ"p–xÔa7¥9Ôš2Ê­Ÿz'P0¸R»× z½^D;Ž.—£…©”IÛhÍ:YŒ¢ÃJQò0i¸hQh”£3ÛÉCV0C¨ËN›°LWLb,.*jT0ÐhŠ(ðŒÁì£ä×X‹~ë¡T‹Z~hªá¸’ì&«ƒ.ANÛrõÄ/½²¤ª;Ïî!·E^^Y¦Í`(TêTtX;jwÎ]„†ˆ¢SÄøÇéûÓYêb'&®—¯åÕ#/ýO‰vœß®šL;¡wŸ]ùbÛ1˜¥Mãšì®iš-Þ¦8ŸjtKQ±iÔ‹]›fdmlĨi±5 ZnÓ0˜F%[Ó0˜æÿ*ýÝ6êzKVdFf0k'ƒ‰pjËÆÅî×7ÖZÍ`"޵nãOkMØÚ®Ø4•|ÑhÔÁ4¯l¾]¸¥ÎµŸ¬ïƒ‰8ƒ¹p[Ó@Ç&¥RKÅé¾L¤ÓëÊ̆‹í£]¥F»úÔµ¤vo_ 7vƒzwöÕxµ~xõìŸÊ] ‘+~fV“Þ—·¹T©If.Oä)%ÔÍÆ(™Wú#ú¾HÜÿ•R¥”mù0qÓ¬ñq£Q­­n„§ÚX×::â,íjEÚ¦µÞ¦˜ŽêØMÝ‘Ö#µMÆuèyîYšzÚÉÔ›ë»Ü7«¾iì´yÕÓ—bqJËÂMIÍÑ£ÝÜÄþŠžÒUßÕjsÑh:=ß7¨£dÙèÚ°ýÿ/LwûWF¦HõO»qÈè™íYcUDÜüvWÔ 23ZÌUÄ(!EIÆèT)Êm UR>l º‹FBÍ`Û~ü¦šv‘Ì‹ž½3Ì^8v¨%âtq4.t]Ÿ³tÑò&Ï,Mn‰,ùì‘Á4š|«y陌ÑK¨NŽª#õ껓i!¢GôÆ &By2r˜.ƒ‰T¯Ûî2ǃ‰PýúŸ‹ æÂá@Eɶ•Õe>f½£ G£º‘u!3÷r©ž±"4Îì»H{É1˜¦a0Mc®¬lW«§Ù•ß ÆÑ FânäÁPt_%eÏ+Tsñ™•œÌ©Ø­Y|ÅyÅ\Í`Xï刕šFìLÃZΔY›Øâ«a*Än4–çá®*æwJË. ‘ÁD°ú ³RñÖ&Ó°/ÍTILFLæ˜i_^ÿk[¶‹ù c„Ëôœ¬Ó2 e–â|,Íì·÷ÂOCTÊç¥ÜÖåÿè÷﬿R“†øˆÁD¾¾%˜b)b=b,åtMg_µÃDkDkÿˆ{Û‘6v{cqb1£bÄHöb¥FÝ´TûåýÊ)õì·:ݼÐí2&T©xõk•±Ô&F¸‰J¨Ñ[:²Ÿù2ï‰êuý²±%¢„›¨Ò6=¢JÈ%ôˆLÑrýÐ#>?*d0,¡#G¾î6o„ +b0”ˆ\•ãÚå#Ó0˜F/ß©¡ÂF ÆaŽ +Ý-í3ÂF &‚žú-ÒôË;ŠQ¥FÜEŠÿ4¡DkˆÓQ=îîg5§^9'C㸄jÓc=*ïOôK‡D¨†ˆLDŽˆ°"×”ðìÔ:EεFµßXÚš0µ*¾ÜV¢r÷DõË`"•ŽŽ+t=5/í+Þm6/÷W;´/LWÉKýjÁ88Ù•Ÿyñ™·]¥;sCÙÏ®ôPí—_¹]!2˜F¡Ýá)ÖªG¡*vSoCT›è“ªÚ¢j„ˆPå£ÂEõˆ +•¿3J˜‡êªÏFŒÈëÝM94LD³6G¢â$°À`LHˆ8|h@À<*“ 5Xœ˜™™×˜™™Ó˜¹á3æfô¼m+ÿ“zu»uo붺»­+~þ=®¶n‹6µ.*º¦C[äMÞÝetU}<[éc~ê!^~Z6çï“i3m&ôDËCùü©¦M«›–91##´›~m;íïÚþÚþnþæïþ¢zNŒÒ¦N¶›i{SÚM«§l›6í&Þ=Ok»)-ªooÛeÝt„TUõUÿM?ñÙeÎÅç°±U¹=1mnokÚ&?ýyžHq·™½»ûð®í£ÿfnîîò®­í¦;wÒݧù”˜‹œéËÉø¨'¦;?É=]±Ó[]}M³“qsÙ}ÕÝ4ÛqQ¥ãuïä˜Z¿¯—ß_ÿqQ÷Os¿ýù9ÓOõÓ±ö­í›>kª>jf§í;ª]ÆDùŸ×Mu=ñ÷oºýÜÔ­ ?±v¿fvò38P D¡6&>!JfB|GlDUd]M´=}DˆÁX¨+ª;L §<(Õ„ Ä”…BåÑ " +Œ…Xq. ÿÙõéWÎ¥ÏØm‡Üœõ9¥^o^ïSMÑŽÓ¢þ[2ÜtéÓ’-Z”Rw."ßFGvTOŠÙÿר±û” ñÒ§·ÆÊ¤IÕ­±Þ Õ^Sõ8Óna~+6&RôÙ†oèŠÝù¿w¾c6Â~Gž%ªÌnUÍZkL×®L(‡ šË£ÃѰ°À„ËãÁ„Äy6Û-XL£ìjPuª%給×ÇþBÕæN´x¾›ý†šøÔ=埻aeq?>2˜&á&#>×3zT´vˆ’‰„;V‚€Ü3¿–AR`·Co´üèýQÿ)û'¼÷¤¿ÖÈv '8$ãž;ä?¢¦gL\Í1¹Ãb!ïé›f!?[R^t\:ì’Á4P¥g5>Ô¿§Bò¸4„š€X$à<ÉE `àR™P*  ˜’‰¤A …iPXTž]éñ-hs4ʬ ¦šQ?Ð@¯º¥ÆÛÇEvLøh>?ÿ43Ý£Þ½Ú!T—Ú˜ú˜üŒ#{˜›ú© ?=S³}¡§”Ž/=íÊá=;ÙbaãpêùæœU"Ä +‡ÂTWÈ`$®Ñ¡õ1·õ]M8—‡±xžFÍtt¬¥Ã1í³º<Ç–c'Û_[Utåìþ{åܽ,GvbR[GJäÀT˶_ÄÛÍ—5-T.¶sð:r+×ц‡"ˆÔ)ú5, XWWÅÀpuÅÐÅP¹À`,0˜V "¢"‰³ (“Ű âL¸<…êyLšÊcB£&4ŠáòxT@žÇ…ƒ² ¥ ª ‹ „² ¥¸ªTœ‰Šƒª8É£AM°XTâmŸêsê”CyL°Ô„Ģÿ:iùåfRÅWãdæîwLùJÉöž»¦ê (N{;u¹1%23˜F&ï¶%#ë¢FÊ»¥Ë`¦‹x‹ÜšþwLÕѾ Ùý[³½?y¢Ÿzn§O›Ú==1µ^Õ•QËÑVU[9µV•?u½öOŸ‘O{9U«?"¿¶fk}¯òv·¾e'½íò½íê^ïþTöõ¿DUtÄ”´Óºû7jò§löw|Õ¿T 3½%¯äwöýô™>9¶û—qwòÞ.÷åF–JmØø¨W{§F|}\Mv‡ÊéžÕ3ÑSÑ*ë§ÞT|ß.æÏÔxȵóÏR²-äÛÅ6´'ƒ‰|µê6ÞÞ®ÝWç¥÷z{Rw÷Wg0 ¯ßöÊ¿äÈÛ‘vâíbD¶]É+q+Ï·³š.Wbs.LØþ‰<[»‹u]Ï?}oï·’zí!oÚ-ªõÒEžé•ëUÞ»È--²öÒäM¹¶ÌÖ^¯ÚÆŒ*{}3òÆçôËG¿ÖK½Ý‰³9ÿŸ«ÛRr}#g”–÷ì«?ªÜdy‹ê7ÛRjnäBôœ Èö¿²ByÐ + B$ˆÊã¡ÐLžÈäb±h°TIò‚É©ð¸<8%ò°àâ"åâ@8ÄRy\àãò˜x\œHŠ@€…• Èåñ8] .É(GYà<4<‰ªL.s*Uq(êð¡ÁçÂqÔÈó°0@UH ç’*”Šsá Êbq*ŠD9>4\(GS!8à@"xÿó8FýBN@ɤÊDŒ@ñ)s;— +›š×;¢ t).¸¸?iËb–°ÜSÍkºs6?|Æò )•]¥¨M¿%„Êvó7UY†Pv.véOª +8”ã¡ hÔû°):íφè’IšxšZgN±l‰‰Ç³nWý#:vX-k:ÆiÆgR¿ ñ¢k°Ýy¬ØL°äÕ’¯aoàAsã‰7\ÛðUNº±ä‹ãyÓ¨Gr5x÷²bÖÌX®Gï×ùS‹ÕMYNQ<ï‚ËrÎéÔÒBV¼Ðh›eRÀ:…dÛìZFCÀ™.6/u‘%ORfn]«Zóœ‹Zþï6–FE«KÑ,aå(÷+*̯ؓ-gs˜~kIKP5«ôÊbk/#¤,_ »,r‘‘Ðiz|œÑ¢KË¡,سø¼£WÃìRÊ%Œ—’æþHt¡ +“KTGʳïïRWËxe÷ÒWbWŸÎì2ÅmZ½åVdû(À7ç©ØFJg.Ðá׿ãU˜);{ùÆv[P¯ ,z·O™]ƒæ†zñ]o@„¨|Ç9ZÜ–ÓGsù¸¤`$Û©ÕãZK¨æ|s·M¯Û^…@X{>'±œeü*«D•%ªEsc{9.‘åÑ£!WèŒ~®N^D × ÎŽr´D©»Ã´„bZQ­Tïð`‡½^¯”ÛÃÁ<˜Ell.¦Þ¦[°àÔî̆wGUªþn~ÃAAôåÙw9ÿ£V-温nsùôŠAŠózè*F¡µ’¬³êá”´ùá÷^2]ê¨Yî`×”d¨í¼Ôz§Q@jû‚QÄwx+¸ð³öåbë\ªMObb×t/íkd+h­ó ðŒÌ‹Ðÿ¿z‘mºN3[ßB(ã¦)-ý²ðÕë^ð© ÉËêøn±¬óÛn:xñ`âvpÛ§u3¨ž"²½ú­ŒE³µL˸£ðsO8ºåhMö Ø#1Wä`5 ª˜m©²Ü¿ ÁÁÔ~žÍMKgÁbNC€D!$Db苤ú(Ï6?·‡Tü’$DÞº÷_øŽ¬Øã]öR"5½½4hLþ (ʾUÛ Fp1ÉD† ðø§,aóGè²GØa´ý² +²Ï4< RPià0Mòã]¾.ˆæI8Wÿñ´ª[;'ÁQ»%øÈx„–¤Úq4Òô#d2,N­Í·.f Ïbdˆ;¬Úo;¡¢¤L00PCUÐY—6ðSq»iþöšÈ£¦+Bs‰°;,žÓ®D¬ o­4äÏ"£ËŠÐY?xœÝs£Q¥^üd9µ¸&n²B2lª¹™ Îê©©Ýzœm-î¡Ño;±sþ\‹ ñ4k«ô*51;aR{.ÂY5õ=ÌÁþBÔçÝ¡ö½´|!êŠàä}w©¢‰žng§÷ãòÕ(¦•ƒô ¸ÐŽ‘—6ôx l[#ûâVÍwjˆüpp¬[!—9ŲÍTÄ¢~ {Elf6TSðçÊ)ÜÕf @¶ýŸÖ°e–B¯œ|ILCy²Õ"ñûÐäÉ y—zjÕ ŽÈe±Pc):ä‹{ÜÕ)Ì€@¡¹;6ˆ=F¥ zü$™¢ÒÛÇDÕÉÑÌO ïŠBŽåî×XzLQNªWSáÖhF6+. eNÆ7˜<X:·1¾·ynÇçB?W•S*ž{é'ù[ߺ +b²3ùÞGc¼«ü¼žòÅBÂD?M¾ì•ÂŽ[ܨ# ÏÖô/Yt ÌõýÞË™ÐÇp¹’Þ(€Oë&3„°(Q‰öFMl™+þØ&å–K£¡œ…¯M8Í%ºpl— 'H˱ŒîAõYZþõt ô¡ZD†Â¾Œž­XÎ@ ü­*§1¬/6`úûÉQ"7.BžÔ%c&ôŒ„Ä5r ß_Ç^kĄ̃Û\9ïkLîk‚|ÿ12@ä×[\YvqʲŠ#– úpÙÔ ’a%ÄIˆCQ‰XÜH8ÒÙµ¥mâˆf»Ð(9ÞÀLK {«‚ÿ‘&×N IsÓ%¹ä¿>˜q»å‘+äÚðG.!†…B=Èu„±H"ÏÃ-ÿ-|¯­ù p¿Näóô7ýÇ«¿’µ´ou/¯‡ +š.Ykµ­µC˜IÁÜ  =|I³ª-ëg#GDÈÙ&rTΨc±$s4V©¤9°j%&d8Ò^$Œ:į"º|£FïQÐ~ˆ@ƒê.Šiø«OÛÿýðÈØm÷?@¹=ˆ.‚QÖWY±`ª1Îå‰ÒþŽK¬J8³3i¹³§ËW + +çêÚci´ƒ›”’…/^²(@àùg? ·’T r¯ÀŠÆæ6Ä*õQ\&_ÙòÔ/¶SGBaÛ­³ÔÏhš•ÓÊ€® c¡Τn«j¨@dÛÍÇ™\´½Ãèçà«X ÷Å.ø ê!zÕöL"ÎeDi­'ƒ»:'¨e[fUÏÊôá <»y9‡„ß/|KÿYøRifè Ü0ðxbn9J O¡LóªÊ”¨ÞK{|£¨ñ)jj5)À2€ÐKò8ö+KSØpN,Ã’™É|…‰Z"R ÉiþÄh›£ÿßNC€.g::?^«’²¾›Ê“ ›ÚµKê½3XÝv¾b÷,óû-ÆíÏÓÄ[/<]íeýÍ|íŽØ :V¶{f‚uV‹äÖm88bcyÏtA/ Loï;?iÙUz§Žh{ñøf¯ˆ†½èýgzymýà¼ò¶Ìù:ÌÆ\Ì+çS°Ør3¤ œå€‚3p¢8e¡d ‘Óza;Å6é›Â<±éˆú†3[4‡´Ô)] „“Lïkm?e,‰_$ÖU˜è‘pJ©ä†Vß0p¥ÍÓ nnh®¥gaHª:ì«¡u£ë3ÚÁ[±AJGS³2€÷ò†H9>\wˆJB`‰©Ð.dÇ[¨{ü{ÕrWläjÄæî‰Í4ÿÖãÎëŸ,æ#60z3ŠG`¹"êô²da@_C$¨c›Ö†C¹HÈðá÷úFÛ « Øš7mGûoâe.òÇw¬°¡^/] b“?„½ ù¾œ£7ÂÇ 7=î¦ùO¡¹µ—ËãÅNìn½.ÝÝcó€ü¯ÏÛÝ6Wášœ—}K÷7)Pf?G!6ÜøÔ¥Eµ‰\ˆ#7tÙ¡Œ¡9¿FPw½´Zñ7˯¨}É¡ìTi8}}Ô)±1®„~öìpºé/ܼñSÈ ¨¢7„ÕÍZ»Naú•c²ÍC+TìѬWµ÷J8åyG²Wµ&} +9ógøàé-ª(þæÁ7¦gpfl¢×ðÇ$\¡skK9œ**§TÇ5}0ÑÊ/™^6ŽöáÇŠF +ïÝÐÒD·vuœ€ÁÁx]Ü !BáÓ+7+Ðû@ëÚKƒ¸ `um£ºŠÿä ñeäèá[ýÁi3oAÄü@ßwQîyã3^†œ«‘,Î;5KïÛÒøñÜNÎcÝ¥6½ÍÙ‘m2É:ý[¥{úîE[mÂÎ50¬ðgf1«hb#vf.Å+â…ƒé3\Í5­ÄEƒ+œ@@”»áŽ5Uhæsøv¹r>4{ã½êUOµ"ГÍг׎„´^¼ÏyjŸ <ü¢ãìcޝnGß2Á?nB;´LýW5‚j뫹xÏ'ýgfúäRÒ5»„v'ÿT\ "d¥³ˆ£mß^œK…L J #øBû€8À¼Hc¹FbeT„véP»®‰h|¯ Ë¡nàÒ|õQÚ@«£XÙ£õos@-Ü#Ë|Ã{³ø(:ƒºž”ªƒ|N¾BGõ·µËÜú…“^ƒuÿàΕ +÷Ï ,ÿ²·ßíßnÚuÞ5Äê:AßþÆi’µªrþËðñ_Và /þŸ¡ ‰çŸÜÏÀ¡•÷t·è´ ¥×à|¯ˆ2†C¢wp\ ~™î%ȶõC¹m„›!%Ü“S§-š w .”âÓM‰&X׫µn¡iÊûx_Ç€Û”xÿ—!<ä}n„ÈRš¿0‘Öf€º>®ÛöhD ê pZÑ‹½ ;ÈÚí’Så1ÑÎS˶©B]Ýò@y®«êÈÝå”þCŸDGUWGwP°ªËåHsVÄev¼pàÁS’x†ãº`Ý‚¼]wå|TTm 6IýØ}HUº{ª²öTÉ1ö"]œ½2·ñó¡¦àw2hi‡‡ñ•!Ös´5²^„ê¿ +‹ƒîSgð4èZ¢¶¨“û›éáÌ Okküm,ÜñQÌê]AUMö'¤ïêq™¢_¤„î^9 ´ÐÙZ“<öÌ&°~ïÜ6ðÃÐPDÙôç¡]ßhÞ¢’XÖŠ½ Àó(æ?ŠÚyØ!¶`˜Øƒúˆì +š%?ç=F=—Áô-ú6º£ ß "¼ba/Òñ¯×DÚx„wÿ›8o]Ü8[%÷äè‘]V…GöaF[r‡ä Q_DCpH΀·Øúq1œ ½ÙÞéç’a5ÂhÚ¬æ%ˆž£×d^8F·ó}D£°mÇüŒÎ„âo·ÔN—©€œ´7Îçl=Ã[d{ËxÓTÏZCAN°qEØî£â)(‚PP)¨F~4†’q]!ÜE}P)¤XS›ÇZÂØ%ÜWꌜ‘˜‚¾ }°ý©‹ºu©‹)Ú34Ë¿gö?¨Loà×t„€õƒìAŠì€¸"]Dswuïó<¨ê"UƒEÀUŒYìà¾ôÈDºß]騇h¹38BòY»Gÿð ¡‹íR•¬úмl­à[,Qz ¦6ÓnõGQ‹“\BD| gxÉ€•!,C¹Ú2˜.ªÅW£˜Ïôöªdªµä ËEz^g),ûåoRšsE$ ^PH°VŠrÿÐvÙVyf|«xhç¾ ùF±Äî@‰¸ƒ† êè* °•5ë<áâLáøUw:°¥3¹KJú¯ë úál±Ní¶Öôš8‹ïIÈZëz°O 6gv1ø"¹cíéq9J`©A+¹ºJá ý–R¼Q< +Âe,ÔÀŠÁŸüG‹rŸK*@‚y/8ƒ–Yþ„l) ‚†ºyiÝh¨Fe'ÄbõçòI ÔìÀÆ’~æÍ$_°³P'ŽsË0§ÅÁõøâ…¼&W~°ŒŽ8, z>á^)Ë«}|ÂÛÁYÞ”rˆBÄ!î:sYý&Ò@o¯{Ñé°3€~ˆikS8ß~t‡ü™[v/BÖf­T#'ð=‡® +7-©sꊒÎÞB4¾i”:a¤¯2À{ªZë¬zæ«ë‰xzƒTª'°èJ¾>n¦Ki®j~ʶÆÊ¾ãT'OÆmÍÿ ŒÇfÁ„(h27ÐÂ5OA¹ª=s¼ìûmWÌq¿ „Þ}邟ÿ?‚xÝ9îšfMqŸ Hˆx6€‘À„DÞæ[­â +&ÚÊ Óy-gäSP8ïÞŠ pY ÀO2›Ò^Žþ(½ {`ðĆ=I3‚~ózLدµ9ÙYnÞ¦@Úè±a¡4<ó÷Ñ\øß–Ìêí$_Êo¦<¢†L¸lÅ^.”ÿ±CûǬ_¸‚L-oþ3u˜á<„ûíŒ{À™× Tƒ_ÁC(´¡gÁ-Ä¨Ï œdɶž†óäÜ3=nM´žÍ•î³ •gM!Tižª_Ï/Äïf¸{$œ°“©× +_®KÀÐWqäŒb!=ÜÑg¾Ù‚¸»P@Š}%0Šƒ’…U'T­½?›Îh¹Š¤Æ¨udѵôH£' a©"@´¿WQ½I€Òpå&Gè„Ê“œCÖSð›.m8„IhÞÂGÊZ¹|u‹v³_“qŽeØHÂ…8º½…;Ô=kYú˜¦H#‰wæìÖéc}$¤B +XÈ}ôš}u«Cã)¼>™<60¤ÆdXo©‹EªEР&ñ|…Z I]Õ™¾¡9 ¤Í=1²ò·c‡©? Àzž+IhnÍsAMÂÁœg©p9;jžAàBüˆKppV +‚ÿ,biÙ#¡¹ß^”|#Å6dz§Ÿˆ?Å 4ò@˜º2¬h°A‰º.bç²i}¿rÿáÁ+çÑŽ&ø¿ÅÍ“¼€ÉÁ*[Æ^í¡pÈ)UâGê‚Ó130@NàÄRs:mËT6àn6,k€:…ÇÕ…Œ —‹nMîŸLÿÖr¿j¸.4õ|©÷ÀÌË>ès›çd^OhÐÊÅÐfÇûygù‘F¯tÇ‚H¢€PÚ—Òï¦kHnÃ¥*ŽseóŸÌ×ôÃ{Ñ Õ±µÈ[ÔŸú^½²ohWÁå*„9i€º9 ¼ó£˜(=i Äh§šƒšNÿžrä*ŽLijE†'‰{¨Fá¦Úø©ðÕ¾S°o@‚•%0Ã}²Ù¡ÏÄ,RåC¢Ðxa|fb«pÑš2à5|p©bF?)úñ[ãk~y²!*ØöWlšHW.ÊCEÜ¢eÉñ]m³{p0 át©«þ°ÅÇÊQµ‰€¸V—üi4&þj'QBpÍXSáŸáäþ²£SùL€ÑtRqN!4Ì€0»J@ä1ðAýBSXëÒrϽ?ž8Œ‚eM©rÄ ü\Xi$ðo`;;]ú=E/†ŸS€×üy}#l;¿ŠÌÀ¤Hy (å¹P‡ÿø5ÔçÀ1¾}¡n"².žòØ¥xªûÿH”Óʽ +R‡¦Â:ZŸº”KWûdîg¾zìyLÞ†‹±oöý §Yiý˜Ó.!h•È y MRd"äV˜ôN‘ ¡8ôÅ%…Þéà@'gŠ´ó¼Éú¥:+´ä‘M´âùø¶M¥“¿ÎÎÁ/ª©šŸ+Kçžõä“ïóœÆ‡ÖL°6u—¬é +±Å"C)êd†H^eè‚H̰¿wj¢:õZBÉC¿1ËCämïÕ?4¬béƒÿ.ôËbYYi/y\ÖÞÊ67þ­ +˜Ð- +šñ‚I™üty;-üZPédùNÍAá=Å·ÏÐQ·¢¢´÷ÚðË=àà)ÃA}ª@s|JÊ`þ7üü+·:¼áí§Ùžw¼Ž¸¤Ç †±Pâ*©4$@®rS[¸dóÔ ¢JT±¬“Ï—h7tp­ØŸB;bù›h´ØSÊ­à›³š:\Ëì êƒ3„Hbã¤Ü?YÌ|¡fòÌyõ³úûÅù1d l‹žQõ.‚„š]ÞWoÑ‚ªËŸµÖCø†™ÛÆÑ¹Òß±k;ƒ +ÔÃ¥©¡ðyU—DûºxT•ýÿ¢§Æh"2R¿£Ã~ªH.(8–RË{x©‡wÜŠåß%o4G*áÞšQT®”äA‘ 4H‘=…–EˆÙäp:LDY³p3Élÿ2ÂwGŒâ1# ¹ t¼T¹àô´ù^ù˜õçry+ìǘ‡=F†+•îÜ1Z½§ßn:'J[Aj±,0'­¹ßŰh¨Ù¦¦£˜KÿèÚgb±§¦ÅÁ›Æ•½/˜Ä#0×oðóV|ñ( gÀVGK ß ºÌå KõÎÂñÛ®/C¯™ e"×â´à=@BBÙ…S¡[uãW- ^4¦Ð?`»Bv«BR×@HÛ]ânØì;qö¾mT7lrØÌå’ÊÛ +Ø‹ ”’ýg/Åõž<¬O‘ETBB&Ò”“v‚+FºQ›Ýœ%ÞÄx&u½PºO'²Ó| ×R˜™” b2=]ºw-cЗ‘ýqàa….€Uº=s´¢ÔL/@$ˆõ®wÙ¼Õé$@¿@\:¸)¯hq¦û ļ=¯* +$ Fïv í©§à·›lÞU€•GB¼4cqx1ãÐ(&u3iM%òZ(ÿ:BN¬rÉ•¤+³7‘n—i³{\$s¤W¾BÉ=)ÌÚ©,NEÜ}#l(rP‘p@üÈ-HXò1šu&àØlï ¾ÙÀ þ¯$ÃîÜ¹í„ÆÃ¸ÇWÔö·¶yáÿ=qÁÌØ€`Ê‹(FÝàÝzþy‰©~ó°ÿV’GÓ‰ÉÂ\kNh,³Æøú—A~Á¯ZAÙË$®2!xóÊðE=J³lU +ó­y¹ÜH¥©!â… DдVa¢°_mkû‚,î8¶È‰ äëðÙ„ëóý¬€i±–xð"ž—å&û¦!EŸ¾öbøîÜܠͦA²E]%X5 țʾ¶2sÆò`(Ž¡drsKÄ M6¥÷ C­Ã >‰ó®6M-J§ÍB÷YÅ•œ•s/~Ÿ×¥Ò³¹x=„Ts!€;ÄЀ@ØMnçŠùãp¾àZ–aÂÉð²ƒ8æ…h"Û#…rI—`ýªŽkz^'7Ó–ªv¦›Z{)ô ÎÔ4€»ûβ´k!&3Ä:ýú~5fõ¬SwMD—5á¿áÛ‹E'AomFUT rgÃt›Ô×:Ëý5d¿M¶C†¨gÞ¦ vÑëpe)p¯Xࢲa¾ Ö<ëç~•oŒ•{¨°ð#vǘò +ZkLî-jüTº”2—¿½k—FÑ· ~AW²¢ºëö]MI¯þ‡deÒ `­§ënœ¸èö˼ äÖG¬Ç°²ùºø + Ö(uƒÀ¸!ÂÈ(|y™„4Œ=‘e0æ]ÁRa:ädNNŸhŒ[~úÅÙ¥àþ‚Ö'¨ÅÚsH5nüU^¼t2•4ÍùœttC†ªÿ¦“ÏñqÈðò"$y¼pë$ò£Ê9td{Bá³iÞÿ(â›:Å,üÍó@ƒnV2¡ø +`ÕúNBG"^\AiU¯$`jÜB uY¡…¼k¬÷@‰å|Ö|Ëβõ"‹YcöåíQ~‚"ÀÀÛì °¡6p:2’ ²[àÅÒUvéb 1rdagÓHRtˆ¾š™ñà[r;;gi9C>Їñt¢· vp ÀæxÅr‚¿‹ñõš‰©œÚr ΈÄ<²bÙW³ {#!uŸ"óçI?hô×»Ïq½ºÐºÉG°ÖåÞ`;}ý3Ù÷_p(î¾?#L-­W@ß«šuª_"3#D&Ãà btó¶­UïwÕ½Wñ€&ëç ôÏ#*/ØæWc}ßÿKßBO2³<-ý.•2²‹“óí•Øñ3:÷¹zœ¶¯eUÇGI\ÆÔ¨zŸŸÚmþÈÜÅžçä¯×dób”˜?“åv‚\”ȧÆöÂ@ªZ»ú“•]g< Aåȶ†‡.h'W×l0%%CrMüæ÷rÍ$ì)©vEmHjàŠV‘~¬¥COÖ^ä%N˜û2px¤4BBÚ—§j¦ýù"ô03#XRÛ¶˜#Á³h% ÛtŸ¿|Ù¡[ü›`WAižAåthcµ0æ^ó,ÈaJ%‡Ñ¿*­±0Pús™NO¢TÃ;ôÙï;V Ø]£åM¦)Ftë +É+ÿgÌ4€m± »Þ„Ržà±{¸½÷¬,[âÍ@Åsõo¹„™Àª‘}9pã2ÕZŽ)$(!:Y7÷ ®Qw ºœװѺŒ‡©¼ ú;©²QåÀJ†ØŽe`z¦L¨¢¬]›é tGôÞ%|±u÷º‹¡³è6}Ê¥(eà @û;HQægÉ$¾rËtJ»}DázÍ­Xzî$ƒ Óê0Õ f¾1Ä4–q\ ¨U/ì!\Ä~j +ç0€¾“à!,³¤>jéWG÷eõ\»m©þ –ǔڱ¿ääjð´ûyÄînx`²š½uo4G²ãëL÷Ï,)(YÂE&Ž»Ê'”Ϋ/5äfG.ÌÑ#w²Õ1&¯„‡úšqhyûO—˜^˜FhÿúÛ·R ¶;Z)àýL— hæË½DM +¨€˜³ÆlÚÓ"êN|Œ½¦zg²0WÙj¤ê†§Ùfˆ±Y‚Ä.¹øÌ¢ý0 èá…s\v3Ê+W`V8Û!ì˜Mbr¤ƒŒ-k§£}*‚q© žà [OG³#ºtS‘b +—± ÁºsÂÊþ ímtÈÓkšZ>ÜØG´Zœ€É&Ýí=˜C'ê'+;°þˆkWø³8輫ð63¸~½CÃÇw.j莌R>'Lïc¶H”Q]øä‚ðxEvŸAûb²ï%”ĵe¨vÆqOþ•gßæK” bîÁ“|:Y33­´ï¶a× W5 ÿF1Å{ÉL é–g‡ärsñˆ0¦¤Îy°4pGÀçš ^ª®&ÄO5öìîÑMôÿ"öòS'ÏðµxøLðåBÎN‚?h›U ÔxvÌ"eÆç7Kû® aòLÊ€6¢¼så‡ìV[KŒ3´ÃêS=&û§(ùdéö–|ÎàL®­²±_Ç6Ó†+RÑ8. ¾~“Ñj™Èìýv>)üG™#.èaÄ2Gq\4w3Sñæ.ËLwCꆶµ-gJú@+H0Ðè+g\Ñj# g݉°šö‘—D¯}$áéL|ÚЇkO8v |«+ˆ€}§¶ê2II9 êµÉ'9ê÷7‹µ’øRauÞìò™ç ih øôb íÇ:BD˜Q$W×›‘M̾Ȧ¿ÀÑHcºîééžiå4%`ù(N–ðÇȃãsµëct£Ö82ç©Z¢ÈÑtC@R‘–Ô°'ƒðTq¢(•Xâ†ÔXÑD%„ÎŽ.ÝÞ3!™l¯ÂÐþVœ`…”¬èŽy¿‹õÍRº(H9.UøÁÆ6›óሗ& +Å +H¤YkÔ˜·QZqxÊ?DÀÜÿr~WíÜxƒ‰_øôéÎ;õñ¹åIõýÂÞ-†UGYܶu¼&t‘Qñ]pãÙÕ¦ñlp¥þpL¹r<›ËøQ‘Út••Æ7HÛ–E*.VÚÌ›°Ä&ŠÞŽN¤u¦Óm!V”OoÔpãÞ¦¥-ÑHs·†}°*y=id;zyù+7©éÊòþM#.Ý_S +‘Ú¹´dɦÌ;ÁÛ_«%CäžöÜ.,Ýe`æ¶|b³Yúè©FÁçmɨiXFw¢ÄY±·¡mŒ"޳1Ñ¥ž¼‰¾¬³[LJ˜Ò͈Ü„>“•´Û2’==FH¢?ôÛBÃls=…°M§MY6«âP@:Õ’ƒŽWŒv;G®Æ¨ÐLJ^•ì¡édo? +,î@翳„\fµ0ÎñˆœÅA@lg°v#kE´RD±`§˜OتÆü;ºûÕ˜­Óú9Ѫs¹aÙ" LëÈ7l_Ši [M¤æÐ˜MFç¥WC=¼¤…îe(Ç¢·Ú&CÇnq†Q:Fh4:£è•ÄüˆÖð•‡P¨Ø‚Jƃîì²3¬µÓùþn³Úä&”}mq18cÅ•a.’¡`0I×Yõ ¨àÜ¢ ѹjN8.—…ùRc{z|2ú–˜Kšh\Âô™¾É"î®Oªl,ÛÊD7ê.VAµºÎÙ¨×~¯âzÜø…v)sQˆÍÓ©Èp¬êÑÔû¢í‘(AF×õ8• lŒÌë§aŒ9xðO!(dŒ¡]ÝV˜a [ìË”‰~·ÍQ´§Ò‘³Ÿn£]Ù•n婜¥pPî÷Ù‡-ð‘|e³ÄÎ^LâEï³ÌÑ©ŒÔzï‹Ì»S)¿ÇLPfÕÁlN9OôX¶œÈfïmª¶†ÅžÊ¶ü¹®¨S)#îi,þfÔ jê ¤% c1æº÷gŸù/ŽâY–3q@âTxqìì—ôCF“²G¹%¨¹ªl°©Qö TÙIÒïÂlx… ê2íð \‚aæûèŽÍSAÆžÌ"<Åp$$ä9êTÜu¿Í<î-¡ÏF æxô‹xî•,|53ð@H]¹”·­^»äÞæ×@|Ò@rOß&½ßå³<ÔjÝý-Àqb_…-sÇÔl>Þò 1'÷ +žÄqŸ0b˰*7$,§*ì( >dy(xd‡¤ª½ìª²Ï,ˆ7ËÔl;ÉùQŒ-·OnÁ}¸ìúf&›}|{Ë-ÛÇ© 7yÞ¿~XÆoÿ™Ë&¬òÖžÆAöeAj÷‰S~c¤…~[ÌŠP œ`ç—šyEC„C5ÃßÀeV™ä6„“òRÓÏ VÍ¥Âý‰°P.«ü4Z¹G·=:¹Ì­’tnœS[®ËaÖ•Wõ&Ž+Çnþ&‰o3ñ=5”Gî{o@P.”NáLRýÁ– +bÕÒ3̬ÃÜ1[N´Ê„€:Ýëù¹±ÄÝË„Z%ÏäF—(µJ­ì£v ĨIî3‚Z¦ œÖ¦Vyàü¦_òfH:D.$› +s€yPëí°#…bQ“"óÜ'v¨]3{‹!J"vÒýôö–°R¨i"«%3U>èVY |ã`ßÇî*rÊ„¦do‰ä6YÑ@–‚ÆíÚvì7™?§˜*¦¥ÿàNxÝ3™|vm.DÕàUa‡iØ ðœÌ +œ¾W˜g¬Ee5>ŒBo$®E@âœI›,/¼JvÕQ|Â=ˆ‰Çƒžn­“]çâŒS[SEÉÀ†¼MŒPö¤<‰çÞk9¶mÇùO2éѳ½.~ð|^ìû„öã]`#2ã­ˆe´7ä{O¬¿ô(ßvøÝAH3ÖͪtÇÛ2ÖrÅvŒ}’Kt4šõ9Ž’ö¡žFÚªøMŸú%÷»ógáK1q¡÷þ4 dñòQz¤¦nb+Ê[,Ðʳ©e÷n…Ã0;2™!³ø·7‰±¤J -ÎDc˜ ¼ØõF[üi«9½Œ Ý 5}4³α:txH“DYÙq§ÓeWpZ^åeßÃþ²ƒ‚ÍeïXý²/fX÷ИÌRê~¥pµL6¶cì.çlÙ­§5%–ä-{“ñä ‰åŽ:Ò)gëy{£¤ãˆ9Á¨{†–ݲ"˾π–ƒÎú}Ù}Ë¡eF'pÄX`J1»Û3º:êþ!.»j±ª©7:zAâOšrý˜}•_̾!/0»Ù_fvæ fvˆÉJÏìkKDgö:ÛS¿V‹mç­oÎ0)Ÿd)·HÒ[v„Uºù–ó÷bQ=$.4ñéI¯C3Å^ê^@…†Î×±.»xqí‚ï²{<\ü{Ñ}}E‚l¨ŽÖ{•~|£ÒQÐÇÞ¥]õÖl¢ëï“§&;Ë̸EnÒ]B ~4ï…N3öЏ*1an ÖYškG‹¼ÚG]XŒ}͆Õ|3Rþ©³|# æ/qmÕžègÐu0ö#Xˆc)b3ÉØ¹îZ4ªhYùçFc˜›¤æ×Q•W½˜£"3§Âé5ˆ•9“)].0ÿÀSø.O@¢§ùwo«ÜxxØ——=Á›‹â Ô5¥ Œªóªä2ß™˜V7>lxû>®Ó˜üöVu<õS´$À“Ýé + ë|› ¾‘bï¦ J¸a<š†»!'·ø•^o Á³ZË2@õl[{Ñ:QdÝš¾ˆÁFÕ(•»'€—烻ñY B¼AQ˜ã™né˃ƒ%×ú÷cöC*]d&i€‡H,dòöy³î¹÷;d!Iï¾®Œ N;ÞçaC•i©("\T@WªjùÎÃÙýˆÙ Êš±XkR®<ÌdÿÎ~Éà +šÄYºtyõ'Ø–%et,)bÿª•Ö#O;Øê¤¿Šð%­ç6¤|, ðrì +ÜÎñׯÑéý×tØNƒ:O…c£¦ÆK›õ©ÚcÔÂKÐeŽ +-x]*Àƒ|yÝ8}6T³ˆß÷Ò—û ÄS—•…50Õ¬ž)ÊBë¤Û¿êW×/V” +-÷²M¤‹óB'Åkp&ÌÂQ<‹ã¿;‡þx*µ (»Í“}²âéoÒÁæ±OfJh¼†¡‰€–ŒQ¤cíóR)Ã*ë.7Ô7@ø,ú í`T‰/*‹Îb?ÚÆØò‘}´r’ùÙbÊŽ7ù‰Š¸ŒJŸ9„oé·{ ¾Ø#1"ð!YŒ£ÌTY5Ƹ0;ù dd.©‹í­üUØ&„°uÇèÔ(ÿgå½=TÒ”»Ä°@x‚ÆT +Í|ÝÀ6±í†ú™âÞ\o=••Ô²²ª¯:¼¹¡Ï¦¨¨d½ +ÕcTÆjT!?­âi"×Á¥]@=Ë#D¸…,9À`‰¥*o>ž¾mPÖº¸‰B:8ürõB:€g}¹)Mm#°kR¥\²PáFˆ=E èÌNŠhÀžCE笮Â;¬eÊÅ…Ÿ—.[;/(\BMú6ùÍ&‡è ó@ÏŽÕä$3¥=ãmE N³ÝÛ¹;§a‚+¢,Y{# XD»|Å’?Ý +««˜¼H¼ ®S¨ˆ#† (/»W¼Ç4°ð“+Nµ‘Ù™.!CQ䥤K×ç›Ñ\™ð£®8kš2COkD)dÐíɈ·žC ¼>°¢3,$Eèý¹þsy³ã€YТTŽÇÏb/´IK[Ç Û¼YSÎ.󜽔#ŸáÍΠ/íÞÊZ,ü„¿©àRþEé3œS_»\~WÛNއx1ÕeQû¬êD‚ ²tÓgD¿’ý£`ƒž·Ò+Åca½ÉgÉÏTÐÛÄ)*ELp»Ó?£œÛ›¥ê9èÍì8¨ö&ÉÍ~rÚY‡ -Ï[Y°‰¤ªBºšÐb{g¥&>ã,ÍûÜj9¬›«Só2½QO»XÖ%K"Õ +Ì€æ=ýx‰u–~ŸFˆ­QeÌnb¶Gõ[–X6ªª\ÙK¦ŒªK_Êa­ÕQU>ŠjÁ®×Å‚{NšžqîîjZ‹e 6€ž¨>Yn5Q5²Ò+ŽÉëLDÕÃÓù¢†l¿úìÌ`Q¥Ñò]+éÎ…‚Dõhþe1WÞ|ÞôË®ÿï©™¬&KªÍð¶PGhÝ<%Ñ»¼‡Å1e¬IÚ¨¾a¡’'ô-´ôÇwŽz €‰ØŒjÈâØ×ØFUΫ×òn‰QM"„Hu™‡¾~ÓV?jI±ž#‡‘0ö/¯"Õ’Gá©òwAB7 `¶7 C¶§qõí]ZB†6‹\ªr›þ­åA4/¥RÕ˜‹¥Ù,Õ’ÒGˆPªåßlšT—w6Ò벉7ZýWùÎ9ªr©GAŠ*péÿzŒl‰ªŒœæDµÌW˜’é+<òg è‡0¹_¸"(ªªG^/à PÕŽçXÛÕçC ¶bqvæ,ÃM]‘&CÖ§ï¨ÎŒ6ÂêÑ«Y˜'ö¿(å½AàK*U EøâÓŠ UXƒÂÍPèGoá%Ú1^qRµÂ¦D +#L’<õ“lª¡n%þ S—Y™ý-^ZF3l ´‡Hüƒ’:Çp™Mç`×í÷»4èÀ—» ü/lÁê²—‚×Q% ,VØŸ®ë›y© ^ï:ÄcêÐÖøäX© œ61}khßÝߦªía?Lé¤îá 4¢`‰YHnÌuƒ +ñ8`Ñø‚û¥nw`ê©@UÔTŸ<êËDÒx³hTÈÀ‚ÉÀ­ý>@Á vì<‘®¬žô§Áü º ñäÀx½Ñ |ýºŸyÏ’‹±Zdç»ÈØ^†ËB¬ÌözQá7…6dñ5 “Aÿ~Ïü±Åœã*´‹oÄ +. iiD`pUën8O lNt·˜g<ý ÉF8T‡’Úqƒ‡1",]Ȉ6:;qXé«Öë᜺¯üåÊ™í“?ד@Ä´ÙääJ šEÿ:LqÈ!ƒzZ›oÈŒÉሮd`u¶%øjõG(¼A”š@ǹn]ÀɲTYAÜ÷¢xR2Ø#åÒ·)¢!»{W&àpAÿ lhEÏ¢M·ŠªfÀ/à§µ¢å +] ×`<œ«Û«'Î+Œ6¢«f\`B¿@Ò9õMO¢š¶ +UfžanmM-îý¸O2ÄÙAëHiŸ°)3ÂJ&ïûõÌ ’ÑSâãgÕ"TâNÆ´MâÁ¦ja^àSy¹™XAª—þmpEZ¿þ­ˆúÙyŽ­ÆÍ`í踄¨nF‡ Ø–›t{¦¡…x¸Ð„£Ž¿.ý§jhaf‹°z;+Íak·'À:“èÚ ÓÙ ØU£ØøÉ\) =©–U¾Ýߦ†Uu×AÖÍÃÉ×õèÔžˆ·³x˜ÀS»ßuƒ'î<Ý—5¦ݽx–‹ TÖ™}¾b@ ^,àHÈ}ð`„š§|ÆÃWèŒö¹ÿÉž~Ën¹´Çï@å þÓÔ­’Æ Q˜jé–aÞs¥ìÊÀâ»Áê†Ó4Õó `˜¿†Í\ ÆpU2âG}d2i÷¯©dS%IBX:éÄ Ô"¸b©±ëVüY‘fÈRú=&UZŽŒw繿BټNj±ïº#`•›íµïw§Ü±N­h+ ±Z¿h¸¶ÒŒy^¹ª fxM"+1i`ˆÃtƆß»¤-söþ¹gÇî +Ãȃß=˜hkÛ$h\»¶øFr–.@³ ú{_sï „†V“Ñ ÛŽÕÎåeS=eXóW³{ï$c‡U‡3àëLWòËgÛ¬/$²Åþ7Åt¡z~Õ!Á‹çÙúªñíâíe¹`Ú€B¼žuœÂÌ£ÒrÈ>EtAd‡1ónm®÷K$w½[—½eà%»3œ¯!ð_§„÷;´øÛ§1—Ä”‚,ˆÚÀÀBŠÉÿQ1ÈÉ÷ŠUµ¾+ ¤ï o½º3úM¼vqJŒ•¤ØïUID±C<Œû¹eæbÑ=‰k`‘±´¨æÁ gÖž›¨÷bBÈ肬]ø’mÉ 1>~*Å ÖÓI˜Uq­ – R·[ÚdúEä§2Ç=ø/Ø"Jìé‡<í3z ÕØ¿ÞÐÕ9Àý«c‰·”TIéJ¾X¡”Ú„”ž$–~ÚŸ5ŽþôÜ ßÌQLÛWè¬ÏŽß®ÐÞmÍ4ߘ C¸¤€³™ÑáÈ}”dêâ“ ¤ïµ=ý{à >ÉÖ3´ æÒK¸¥â„> šÔ <Óà2­ŒOî•ê¡M/IϾ»¸M-Te‘û€kA´ÏÔàýÜ›Žë±9ìáñD!lÈÖ NCwoíÐJ­p5H"¸× ¡„è©Üà“s‚Á†{ÉÒPc» +÷Ïšg¦ h cÍ^ã[¸Œ,–r`3{°ô5 V[¯€@›û®¢‘£ŽÌÿº>£¿3g"w±À6‰VÓ«5è;­·HHb7=­Î­ ˆ’‚À %ìæø`AH q[¡ÇÞ W^‘=Q¥ ã–2¶zXÚžÅêá‰åHÃH#Û} ˜-T2º™¬½„,½Öí§ýªG“a ƒ›HcœìíWm(Ž{г|oUð/°n&[†¦ažX(î…î®_.³Ê/‘c•i¹…=L‚ÝnåÕY`žV©õÁ™ýöa÷µ¤ëmŇ²X'¬#B?¡¡ˆï:å³KÍiÛdã‘ÕÃbéYX_‚=”,§¦ 1Y_Ê‹ìÙ:oìµµàCÓ¡rT‘…}Wð_ÜÁ¹ª ¦…ß× žjIª—±RæÎ‡êôËöŒí¸KŸc¤ißLã, §Ãcw±¶6ØÛ¢ˆ‹dIѸ¯Þ´ ØŒyøàÜxÖ âBßáŸßæ;8[©Œ?ëñYbôôº”äa? V0²Þ`³ÅŒ!26.W ¦~‰9”{bÞë,”Ïâó•£ÚÖf¯bZ0)øÐDø^ 4.!iºüH²)T«X ìMF;¶Ìi"TÛd3h´ý\["#¨£‚ÅñlN^vÑH³¢ÆBÐ/”7;›ˆ¯$‡aô醸`/Kúó;«;5N÷c®“µáZŠÐX#þ—&™ÑàÒo&eNŸ¬“¼Í×áÓQbǵh껄<ôºþl-¿Œ­ vß%*€èìÑãÕï"§= B1æïÃ4^V§ÜQfˆ&"‰–¿½îЧü<°ÁÜö\zFá²%þ¶oÛß•R¾m HƒAWQÞU„*7ƒÒóiºNMÐñ«UÄÂõá|Ê›¦Óó1|wåÛbºAßݘ þ†à»(ÁTøÚÁÀŸ²§û|Dzn +hÿ¿S2Áɬi̘JÖyŽûÛXŘ)è’âž%”O"Xÿ"ª²Ø¦³{5x¯‰‰©{ƒ©g}à“Ó–µ>”Ù\r‚FˆˆwÙ2Û"nØ2¸õ5¢ÎŠL%C!1'˜14ô‰ÉlÔ\ë¶Àá©DØÕ"Pª Px‡°®ŸåfîB‚ ÖÞ¼ðãpèYÿê}L†ajN±qÌý¦ ëw°¿$ø<7€2ÜŠ=8(]ñïìÊy‡…‚¸ðw¨­˜1Um¢! &m*8 y—þzhI+úÖŠÒɲ¢r2€Q)¥Ë†ÙiNScMkµ!/Ù(ær«ýUƒïìÜÒ"°ÔÓQF!Eòa[~ÛC„§Ûhü5ôǬøè*g×ÙébëÃUÒU^¤Ë´a„Æ0Úé(žd{R.ŸüNMÃÆÒÖêò9”r$´7Î?|`ã+­†üGÊY¤ÿ*y]¦e¯ØI¥CAÉ®Óý£+†âE`n`È9A‹Èè¥òš4¿,˜é›»ýÊkO2jlbÎ9žØKú+idqMž³ì¿Pú+ QÈöS~G@¥EŽ5Ðýx`Y¼®†AÛeeP¬ó¼ßÀñ)éfN^·m˜Ô׌¶º ë» +(Sƒ‰Êpf Rìl>R†ËS]å¸EÊ\œµ[ÃÆÈˆN+&sg"é˜û_@´àùy àyN,œ©’%¤ô{`ëÄHý6Ô][ÌZýÀ„²ñ²0ÎßÛMˆÓS“­€ÛGo€1j0Á.°n>˜ŸÃb=]¡{½ýH +Šü;:ðíÂq%ó$ÅÏ?¡ŠÀ4¬­~·/›RN2[#ä7YÙ``]¹ ê]`8+'|g5È+sÛE+ïDãvt}¢²ÿHlEþ[~½DƒaúJµÍ‹{kÿ$óTÀ•„K¨¿¸9‰Ï‹ñz-Ãú€Ñ2ž‰TEº,ÿEm°xï¡þˆ8{î÷ »ûä'ÎÜêç=ònÞËü\™Jå¼ï‰uaâí|yÉ„*ÞbÀ²”xræMþ˜³VøÏäy‡aÉwN$I>ÜYäïK +endstream endobj 20 0 obj <>stream +iqýûcìlgw}"ÎKaéås‡_m],JÐÿ±Î¤øK10 ¡¯—Í{:Jn‚hœ¬Ã‡±Baèþá¢Ázc ÊŽ Eí ¯âÜžùÕ¦4ËUô^…Y0Züq(ÓÊ!‘“-¦‘jÒІ’ß>)¸«\R¹—€—QŸ ÅÜAù:›cWje`a}Tw)kÊ£‡çƒBÄxZÁÀ¾X¢<”æã1@žaò®‡› «ßå ´PùA“(AÂ`žÒu¯ÊÒàä@|^˜Dkwõžj“ÙÒo+‡ùMª£$%k+yJÛ +s‘m6d#@¿½)o% #±Ÿç›¿ÂJ²YÇ7'G¾#bOyæQN‹éA Z:L¡^âº×Û瀢‰†üÃ¥ùqט~ê® +õ«c€ã}Ë¢HÃŒ3ÙàC­P¢aF6¢+×°ÌUð½IÓ;ú´èî—"žïl=ÆèBÐþÜ|° ÚÒ‚ï–¾ •ê $†u¹lo *ૺ"%h‰‘ +Œ:â +ˆ2£³óÖó + ²†éL,º¤u>Æì¸Á+ñh¶6Jc‡ïG…ß[xXL¼mY¨ ýhó î£Vg-”B`؆ ªú¶7ÅAËvqrN^º:o5Ï«G„%e³ Hsúƒ³ª™Î© 0Kä'S”Ïa‡VäųÙÑÀ©|äí69J2\Òð}:W\ã¯Áôöú¹¤ï(í\*Ž=7N˜fÖ‚Ôï1v¨—*&`[€}1”³Bèµtñi‘­+7Bð¾þ` 'HºFÓ¶ö[E7Àžž“¼Wãºn3fƒ+é­´þÈS7”U-?÷~RÕÅ*Bɺ.GøŒòA!»É5ÿ°¾¬öŽQEàT!µØt}Þý ý_ÐÕVü¸$4È`ÁŒ ÐFA úÖÜæ* +ö¥ô§õøõ69¶G@Ãr”žkf©Xp7è‡S5–+¥ ý¦n{ßì“A>Ês*ÿI!ª0´©\õlÏEÿ:Pk ’‡m)‘ÙÅkµµTà™½á‡qÖ"œŽÿ§˜VH>/ÈçÈ݃q ¿!?69g\²üó[E0®‚¹- +5á}ÛØÞå3èÔ +ýBïJÁZo‘x"'ÕY—6°Ú²„cO°Í(ÖJí²ý§ ¼<Ó²ER¢j?X$uŸ¿ñe¢Šõ÷ÃT±„ó÷4*µ>¹‚¤N›ô,öÀôWÌGŽ“½µŽÁ¶©ÃÀ·‰æ>äèÖên¦“Þ=ÈÄd]çÜ"À#ví#CⶺEÙê‰Ç&áKðoÊV߯™^„£€cæ\ãÕXN·k6½?ùëãTç© ·®kÁº¢Z²ÂcÛ뿨ÀhÑ´jRJôm)€¢éžÁQýË‹’C>pöè3€!ØÙ +bóüfÝo®ãç`3‹›$V`™ÌÁR]5”Œ}²a R +p¼.¤c’ýÈnŠ \CµÓºu´hX>ªw™ýãtÝvը䮂BXAßË—©Y… QB™=°š!²ÚzW2Ùª_µ;q¦þ[©s7åv.F‚äÀ 8‘*–/e*VŸìFšæ5eGnßx, \ÕpÇìè›*„(’Má0œGÌe85À]ÄšõŒiK‡L´JÐ?j^]³Ã;ÜTáЮüÓ¢ræa5Þ =KVÓwiCÄ‹º]õŒŒòäó„|Ez3=S‘À +Fz϶Mˆ^âxÀP¡êŸ* "¸kÁjÈöŽÎÿØ“€µÏ·ÔDAGÀX›´b®+fÞ@óW–ÁoI°˜½¦e»øHâ{iÞ + G¯µW(qÉÏqÂój=èh©Å@²ßi[4(M×ÎôZ†ög§ã¤·åUÓ#‹BK»Ñå­#ä"ÆníoWÙy}¡¥îtïZ'pËkè—A_EîÈ“D뎾b¦)¿ÞüéÇ_œF!¢>¶7¸ +R*дRzÁÈC|Ç•E¿ð~!¬.z¯ê£åÙ7ÜsvD/ÿdY1L1ç07=Sˆk˜»è†³ÛŒµí`åÀ! $Ê9k#1Öcý`I©n"ž Ťէj¤T¦æwïU´ý—ÄÓz+ÓŒT`‹ƒ•è³¼å 8k7«i^ù@hQVG£m}¼Üc¿=†WÙ¹{NÖŠhSìy b¹æfí÷–x’‡žÃS¡Þ|«ÞÿZì [.Ì.÷ù!&VA %5õåðHJ2”>íœZ='ç#¦Òˆ¼aD^&b dÑK…ŒÛç;$q§HÊlù.SzèU ÜIH\%·ÆHK ¶´ªx´ŒÝNèŸBÖÀ¿s€ùlÕª +w’­¾P¥¶ 9ZGÕGMcGªChµæK®GÓzÿcæ„ú”|PÖ,Â)`ÏìÏòÔ‹æãʃ«–ï˜í…Âi‡$‰)vQ)&áþ’{¦´ˆ¬öþ¡CÊêR7ë2ËÙµ5B÷Ùt¨ñ!”v'Ö=• &ض^ö$ÉVžè74wTNTÅ4tzJ ´Êë¦ýz91¸Dı¯{63³™Çz‹±Vâ ˆ¯RR.†UkÖäÖÂÒEÆûA0Ø\7‰ó‚ÞÄé-XðéH÷ÁHR!N8·­”’€Ú; ®v'úØZ„‰ñ°=EU’Ì0>€k %T’Ì`šÈÒ¬=n§³‘dXD¥ì½. +‰2ER§ÿc‡Ù;3#×%,„¡ýð±gÁzƒ^–/,ß§"‹ŸJ/.Þ5нZ™ ÿñ ÝàÃëgݹüŸ“DM/ÌPê¯f?ëx,‹ÀXš‹–!¹Œ•…\‚OVìYу\‡óÎJ‹“òÿg¸÷ X¨Í‚Y“. •„çí辿٣芔GŽ|U«‡€Wý'€ä¿\©¢yŸ4¡cqA'ôÞ<{ú.¦òMZL+Š‚§¢•"È…d€Ú}˱•tñˆ³aò<”-ýíĵlnÍ›»Ùªt;3xAI®3‹" ¸#¶’/©âî_SóMA(« M …Ñ,°û®9‘s¶v*zíU$$z 9Œö,U#,ÃîQŒd~ÛPW{ž9dpè"Ì@fÂmXBM\€ÓÇ¢™0pÆŽg–ú×#àAZW[Á¸Á§hן€j‚¿¥râÂ4Åv¬Qäot7Õ' Gf„daµÕb5¾'< ¥¹ÅfþÓШ,„$ß< + €P¶N?N4 h5 °ž«„œ§jmâh!öæj0œÚuì2ßÓ!.†Qˆ¡çÑQ:E÷éàKÖåæ=ZOySê‚n*ˆ“\à@NCi:ìÖ©Wåö™"1¹ÑÂjØ-HìavÅùìÜù‹q‡úó›QvÇk‘8ßj‹iÓhŒåý@ gh§Gô|烷êEqüQº%mßâíÕ¼C A&Lx¯«N¼–»'„!G=†)ŒwAh£q!Šó"P”“^lªÏÝ0D±’S Ou‡{ãPäAž(uÜðN·'øÌ˜Ø@+–~ÑàÀínÜ$û6ý6ÿ'²¡@}šPS EnMeD7„”hçˆÚÚ`À¡^è 97]Ôõ䥎Ž@ôsNÉ–pçV×£Šp¼4"¼“S}mE¥DR•R Rû#zÕÑ;5ØZ hh—ÚÔú&o‘/’œÄ•>#ƒwGB  LşöB˜KÊ É°Ï +fÉ~wýZLv‰:^¾ýäu/†tÍ ‘aÕTºÄFzþ1Ź ĵ"‡‰ê9²ìÒ~pžÁk±±a>×^(h-pÁäS+F/àÔ"ŸÄÝìðÍd)y²)Šñ(YèŠLÅW6ˆÿQncgÆ#üEp:á… Bɺ†þŸúšk²s „iw ˜ñØVO·ùC<ùMfPS¼lFÑšc8ICò£BTJ Èó¦·³¬«úÓúdÜ託 ’g`ÓÎ ŠäëòD%R‰­¼¶ ñ°U1–ž ¡X1PˆÚôh=Kcq«ƒ +Y8÷'’ ‹²z['•õ§ïÓýÙÀÂzó(¨Ú_YÏ̸[Ä.éAºSb̯8¸[œÉ„¹ ê¡•dN0})C¼‰®*Ús~ðŠ\Øga—©_pÔÿ 6ÿ¶ßý(¤t5aÄ?m&U΀ ûÙH@3CÎ%‡û$…e=4MþáÜÆ"‹Û4xâ&Ê*ÏxìƒO¹¦;‡+S) ”ÒdÕ¯7 Œ† ïÌŽX‹ŸÅ ¡ËÉðìJj`…ÔtܴƬ=HÆJ³FÝà±í¬qR‹¾${y%–þü)WWC1ñ-'aÇ4Í:Œ‚šsm·qc‚ …Š^å¥ñ/6£Üæd4„ 3»;·Ñ9pr“môè±òÇV&|Ü–ÈT¶'aËYÎÁV“l ø±mkb˜î=÷(¸|x\€J¥På¿=+ûC^ÉœwØÓÑÔ§eϰy†A¯£ +¤HÆ—ì² UU“rg:pWí’`j‚ÃZãæ?áX&ML]Á¦ž+ !.ð|øIôR'–ÍþžbÀ%Ùˆ‰ÙY^ù<Ê.š×þŠÛæ ) ª—1Èq¦æãUê¥9Åeð´‹uäèÍÏŸaL +Jãl“³ô!+*¨xƒÓàÏrm½º4Þ'0UÆ8 i:(K]qcìðSÐ`Ià +ä5%þÓ'srËþô,F¼ˆÍ±0F;ñØÐ©6öÔÅQô6™"Q68Íx«UN´‰éBH®6“Ör?@È™— ¸xµšvÅ3r¡=H¬#H&Èa)ŽOÌ4]ú›©sК&Ó•OÍÓ8üùðhjý|HLåÀŠÖ~‘Oy¨W5ƒçN%óxFe-§ê›*¸2"<žf²ÌuF.ÕãM÷+7¥³S”åÇÑ_¹4YK²5ƒ^°/êùs<¹äIàg‡‹È¶ð¤¡å-Ùäì‡Ë*8Ü#:ÐþZÕ÷O!CŽÜ2¼u³ þio`ìF2§?$ p/ò"Žurëì³k (ÊA9»60BÔWd:Ižu±·òBR!¿ €aqžf."Ÿ¿Ð 3`©‹´éNcþÀ4´Ðo²ªé¬´VüRËïH!%œ‘MÜBj‹RœRF¹(‰Ú´dœîY¤¼ +o©ÕZ.HP… +th…îz‚"× 6u†lk ?XD¼ÂÜ¥ž˜”ÂÌd‹—'\#ìÍ"t-‰® Ñ…2S,“ß)ÙCyzPçé\qnÔ²YšçàVdêV`J“êÉÖy°v½$—BU¯RJ j”N©s[˜zýà  µ#Ú\(€(>wŒ@µ#Pì–j VjVêðè”°îXŽ|àŒ{jåEÝ*Ba3s]¾Y™v•ø~d'?Ô¥×Cæ'Àç×òPFuVÀÊFxeô¨)Ü?ýŽ þa¡çèå§ülP­ÁÅKãôó}äÿãâ| Oæ"#2ÀÇÐÃU:#KÆ0˜Ýzù*y%¾UÙ_¥l4š8OQ3+ÞÈð%¢sÕÜeœZÄùâ|á9j*ÕCmO r2¸!åÆö` +l#oD+ÔHý®&çžÜÍÄúL}Zb_‚ÆUê&Ë'C^"·½tp£*”ÑÇ!ãu0_zŒ)eÉÉOþ~½RŒ 2”ÌŽŸ»^Póh4ÌÌ!ß—s‘ß``j)€¡€¦Góþà=y¡šý3ëó}õ'˜Š8é-à†C¡V`á+C¾³…Nâ4r.,EShn­*ÔäâÖ!"[iM WÝy4¹P‡_QS<È«:¡9®¤ûÉ7Ž™ösJÛ¬µ½ZḃZ‹qdp9 †ªÖæ_ÕžÈ×3oŠ2iÉj›ÉÑŠh&…—%, ´½$‡É&<±¾ŽÈáY!ÄÓÎØy3èôo9ÿ*¥æI:Ÿ¤²o‘X5,ÔCºKä§e@Øß0#WòÁ WéY\ªç +çRÆ& +XÞnôH˜í¢Zî´Ò€AýÆA#`¡æà=;¡eÁ*º]_íïBðͺW椆pOÂ*À4”0&øõÏEë¥Tùáo©gU^( ò1FÙˆ21åi º_狴݉Zý¡Oï"TBÓÄßF7wÓ³„xðãP?›óxv7‰M4ØÒÀÎê†})"Ïy0´ ¶°Ø4¦ëbê15§°†ÇòJFhœRuƒ ›¹ûuíÁà_N4دûà÷ÌRp€ÂÕ6VWÒcb/*Í:öW8Êþ‹SÙi‡º“:WØ{%”GÌJ4Ï~än©·üò[h +;ˆŒ?^ $¼.°Ö‹Üù¤|¶%Ũ˜h@?;a(GLťєh¶9D +ú¢C;ÍÎEb¬mÊZá_O¹Î'AÒ\VÂß_-pÞ‚¯‹’ÅWpò雬֪uv&¢ê§ª½Ó¨g—̬zUÿ8þúM{ØAyj¤çÎq'š"d£È.yŸ€]ïßbn+‚ôÃpO!=\£þ2ñ)?© 5ð3ØõÈÙ4K©ïÍV÷»:½…Iø©R ½rªVw£ôx£$(Ðì/_œÞŠßZÞ$øgƸC¥òøöPGÕ=©Ê¬Ç%ò£ÉŸb\¡b»ª”òBüÆ®OAÄD)êÜÛ'\0|~g±œ­Ÿ%›@ä°ª!£l©ŽëxôkÉî)\ñ§ó?¯ÓD â¼J-‘ò¤]FŸ¤¥k)T[00–x¤IÇ&X≀C úp‹%ßExBîŸ8 ›¥ŒìÆL3y:°MóRäÓ„PGIͤM'ê_çÈ™êVÚnÖ¶ª‰D[6ÓQ‚ÙI?•·OZéè—ü4 ,ƒ!^²2Ù˵2¡Ñ±ì£Â_ëß”1âýƒÎVyàN<ùåÖÔ£qý®žV…I÷Hš-¥„çßeóó$ž_n¸î›ö¶1íröãì…îý…ÍVæ¾úI³%%—çÛI”ÎÓâžRªn=¦ïÕ*t{µÑx-ÏD=Ž£ªl+su7¡g<¥éFuôϵ¿Ê#½]&?3!úˆšÑ¹¥ÿ–óN¯D™©²;X«ã i¿´BÂÖØP5ÔÎÔ;þ}.¡™Å¨D1¥•î)‹·êû`—D¥U•3zÎN¨ìÑGFÌ0«s/ðŠ1²9uæð]ËÔw—’$ @iTšüq™ºr/šR?_±œ´®rì'“n3¥ˆ&÷i]ލô¥ÜL£ó§šFO[/Ñ[py+7Ï/Í2eMäcŒÈ^{¸/æ&O[–2oÿGbZÇ&°&r+Ö0£•0œl^ªÉ¾½‚Pé}Q\ +ùèE]JEnáûHÁçÚÆóúz½²„-¶Fð/rF Uj˜Ä{Aç~PRH[ƒç³8|öjúè>˜ª ‚B.BµQ—åÂ~ ‹ÏÃtÕþ©‚Ei’Ò;¶¿sž{Añ„‡}ä¼3®úo\õ@8hÕL”Å6>¯—ÒÊ Ê1¬#÷¬á–û y4,D(žÓ®—UºSëa®gð{ùµøŸ¯–«hF`²Æ^Ggs0í¦ñî;šÑŠŠÉåßËP8hsQ&À½½ª+ ·>¯™3×T&Öšö áÛßlY.H„†2åk}iù 9Î2^«xy"ýÑ WAFc\%@cõEXÚ§fÑ –f© ‘y í‰}khŸ$%ǰÛPgû¿vñ·$&úoaD†3±y2ë÷Èô÷iÙÔ†XKŠøÖìN[Yì-Œ¯š²í÷“ML®#9ͶNKªØ³ÒôFé³Ã{~<­<{cÙäã\ãƒdN¼&“1kØhi­ j¢åØ'G ƒ­q©ðæôç½Jô e¸)Ñó±ð;!†ÃÈòµw;`ú­%;ØÚgv¨Z3±Lƒ.85óhüEý7m6r‘Î%€ºu L9 w;”Ë’°?Oêœrv’²P¼EÎw±¼¾ˆBK^ÑA˘R倊X>—Xà±—e:Ê‚.˜ +Œ6•0rßUãoÃð”¬Bf¨‚NZ î¯ZÚBW‚22¦Ð6E‚1°åÿ§‘à™Zî[68`©:µ{”ÔYÓx¨Ü +! +íù´6<Ã,Ã’”B!G²¥ +6»Vîíˆ0Dm¨n™pMÔéý(÷ iHR1$Ce'~dŒ¤IÒ`úÏøŽ@!Òc;S¤B÷€,8UBKû¢šóhô@>gÌ$t÷´dšCó}ÚyA÷îÖI|‚G¡CÀ€““ +].–×çu›6+m¸…8T”ÿ÷¸‰ç 2Ñ"¤e$'býé4>xòÚï8%ê&èÕA8dçӭ R4㽺˜ 5Þ4rŸ\gñDX2>pã‚^yƒRÙ–ñÕò·+«ì*lò)§²I‘‚÷ù˜›b¤{Cµ6¥Ÿ°ÙæmFóA™ŽÉÿ #-s–7,a__ï¼e_y¨Cü(ó å—¤²ppƒ8üL•¾ürXT7n—4¨ªvð˜§&«ðÛÑÓ™µa(©}Fuû¤:`Ngê#*W&˜ÈÁŠ|©¼iÉŸkV¶ô‡ñhEdh€ª¨ÿ°G{vÒ–¦àÙ ¤ÔF0A$Äš—"µ{ÍY2_´×ùÖ*-䥨W,àAåYÂǬÎS¢zÁ/4éÂC©ÿ¬F‰ÓɪÉ_BU˜F<¹PÇ ½2^èÊP»µú¬\*ú=„@ö¼´kòÛô§wT¼¯*i\7v·Erº½„LQ R?§‰Ð•ÙS”tV[Åø#yïöòc\lT½¾gXJ²ÊTšùq?®ãhöYƒE…Ž,?_*«®/ÃÅ@~Àئ_­ßº8âOpU|Ì»mEçQ&[DÇõH!¦_qŠöâ£]Rd¸¦ì\$bCjÊ,«ó.ž|‘Õ9;$”Þ­ÔkE[s#OƒMªZ“e¨7;Ÿ!*l⥚•ú%+–|JðŒ)W ׆ȟeþKwýè6*F@?×ô;žl¨ Ö7ú•eöá3×вl#T#L:h=#æ üK)V-°¬"eÜ'Ë34^ï5üDt²ØÀ¬Aì”r$5Â_Œ“Êœïþ{ÑF Ÿ4^A¥G&PKûïñ6礥’@œïƒœÏF./>ôA¥1¯?õaŸé`ʹm†.žZâ—©v†íÕ½”¬ú˜o>RæM.ð#Àž4Ÿ¼ÏÕ‘†iŠg›¨@€„m§}“‚—nú¦< wâ+¥š0ÍtùÏ.†Dæ˜l\ÓDdï,ƒ¯í~~H¤J9¾DRaÐØÄ÷­1±0»~Ï%Õ4°8ðìׇr>G›õ¹¡–îCq‘øºÔÿ‡mD¦"Ÿ>²F·›ó<'o~–úð§÷´×3ÚàF/kÁw5»vB‰YS9^X|Ä–C×JÁCF~¼ŒiO2CQ %>?Ò‡ÞÓA²s€ÿ|vðNw@4‡­9žljž,Ÿh +¼}îa”¢Ž}çåpV*ŠäD/ßÁ®#”ø EWÂJ®{Þ¡}‘Dñs¡¥*ÔŠwä}mƒ =@jš4à`ìxixÊÜUœµÈG P°«íˆ:ŽÈ•Xèkӡ†9牳ã!h3[»%¼ûÓÔÿ|€ „@N _©‰Èv‚NŒÑ*ÍÍbGKÄûèÔA÷ÈIÎ7<ñkÂxaV·™  >7h0‰ Ë^©!#½¥ G„ž1¯øÜGLŒèE B뾃9ï‰ðxç\¾lð"ÙÙEç8LÄ@u@uöÇ”!A™Àð9s…þK|–Èc^˜z ÄaD\ãnK +'zÊ‚n±â„Nn’㇂–è2ÃQR F»&·ziS©1Ù…$œ:âOZŸ¢©ÅA „ÿQãš7 hŒxtÎ󔨭¸å†7 w;b`Ǩ}>–5)ƒU™Y* Ô‡ï›Å†'VÂCdO2Á_Õ%Hà !»ø» +À‡ˆÅC$F ŒçÀ\` bŸ÷ÄM40.tPÝ´yAÜEô^+K½‡‘m¡méþÌ·a,23ûã·žj¢¥³lÊ=LlÐkÂ0úmöñDPúáâwÃÝL#/P¥òÍi¿×nlc¤+uä÷~#%- +Ážé<× hR¢ðÂ÷„zgÖ–]6òzŠŠÌŒìÝ_‰¯“¹ýø^Ϻò¢7µª”qk…é1 +ˆ~p/9Í_©sýáí-OòÂ>ln +}ó²&Di>ÀÃðèZ‘ €€ªªJ€B™ªJU%ä$@²N &  ´ìîÙvwUdWE¾pd ÒÜ]zËј4w7ÕvwUdúb(»«"§Ã–Q5 +¹!9¬ ¿eTs  ·‡fT³³ &ä&„r—ŸYš=¼êñPTÉiøˆ)f¯fFµíò hÁÜàÔ|¸¾GÁC fK×Ù|¸À[Q0ó‡7¨òЗ½žÊ‰u¨ÓÈièPå! F£šŽ€ód!ØS±<äød©<ô·€Àýt§Ž¿žJ‹†°$§áìúÕvŸSAÆi ªlNiªlvâ´®»SŸS²"ÍﻆÔ4º¿šF÷7K>ÉŠ”¦ÈŠT^íF÷ÁÙHž‰ÝoéšÓdY‚•†?hA/ŸäFS•_2¨ý|f©ÌÈì¾ÆÛ`4¨E”°*g¿ç°6Ü‚PÔ…§ýw -% ¯;êôk«JîîÈéø‚`"ßbçåÔsç>’Ä‚ªcf0!í,ôa‘'JÝïf#‡‚•†0GVl\줡EÂ` +‚·€àCº¨€‘ ôr‚=lÃÊíjì»o«Rj¬ÊAw#68@óåÔØS×òñÑ‹>#zB³ ß˜DÜàôÏ]¡öïÇ^[Un¯­*Û[Yзt9ywºm磷t½^n®’†p6šûÆ‘æ^ÉÈŠ”õjr¾9¬ýNô]Sób(»£«Ýw9²"ÝC§Qö–ÁÐð³(Hê[@Ð]³l€3\¬4º_0 iœa d’ kÉŠ²yùPGŽ“Þ‰a#* HÜÉ:„>Cë£zŸê4qÑåŽ;õVyábø4FKN‘%G—ñänÞñ ßP'ôшá {Ü=JšáœÏ€ã3N£ìÝ+!);M;“V:B¾c¥ÑýN«“DXХƪ$t„wvÿƒ8qEÕwÆics Õw .›ðneëzÖ‹iÌ眸Oÿ~dχֺàÜ%?¨*vŽa’ƒÚ~µVO7LØ$}DäçÝЭæ^¾]HË]#ÇKWk¡8ÚßÀqÒó,«i5p\hžædÙlG@§ +u”MÈâ ÇŽâ ñ9µ&6·€à†*¡Î`LجsMÆ_æ¦+€3Cx”¨èÉø™_# f%#spGâÛ^Ø€md\7 Wã1"c +ê wˆ òq  +="†>ª÷yÏ$ŽZAA ƒ<ìfé: ƒ|v†a$Ô!9áá€,ds žÔ'd²sQøËrÍDß‚@I„†Ïf†«C– êHŸl´9±‡1vsöƒ+…³ŒzÌáŠk ,¤,2^N@Š2ù0”P7€ [@°‘±£XR7,i#Ò|jd5oMßHK.å ÌG4‰S)u™"[@àtšî¶4Y¨£‹L´O- ÜF/ýû°îˆµ®pPÒ·€à`!°ylœð'ÒWÇcöVär ¼±“†³D§EDnwêmE¨`lI€…Êã¥Æ ¬)»#ò’œÌDù¢)YÛ"9=‡âê¸æR RX÷ܬà× ÍðI¦µ;ŸÁã__ãö&ä’Ù!FáÉp|B„›‹>9<æ{Ì2CȰ_Eó†ð\bA¯*5¸ÙuÔÕÁ [ ãþL,NtpYî'¸cøá0›Pqß‚ÊÂ|ñ §Ú¸{:?' pˆ|F¢ %¯@’fø +t97`à8‹Ý†9‘—äøM"ÿcMJnF á¤- ÀY¦å|™åsµóå¹SÑ?0xB9‘»öÈ»Ê.y¿ÎÉ8¾y¤Dê̾œä?7pšœ†³DÄ$ Ÿ„«tc’ÃÚð£†Áâ”}õ4)÷YDô[@0f\߇D6 륓’ÒÅJ_ÿ.ÉvZÉþR€4ÂCK×®ã»SNòv¸Sg½…Y‘¶ä3 ïÏÕN*b’`G¼6-G¼ ±G­5´BÍ 5™~E iD ᆥô21ÙQ›¬Ÿ¨mš‰9MtCN Nó˜F¢F‰¿¨ºrÔþ×AMu !çäÝ)pø¾$gOª:Ñ;:33"Y‘Â*gzFÙ vÔ0*QëcbÔ4êeÔ¶€€ì'OKcr¨=4 ‚²Øì¾”3e¡—ãË)ªß‘÷[„mRè¥oÁ#Üx_v\k^4äÝD$!Þ”­éyFáNÚj N.ªoŠr ÁF6Š ˆfµ5yßÈépéB  + ª¶ãkìdßây¬veÃèJGPÿx!XлØÙ@v²· É¤s‡î4+©Œ½VLªá- à>5 0ûr—Ý Á6|£QyV!œ +¬”rÇD­¹;2&Fm1°„Ú„4…ÚæŽ‰Z÷<¡ö8D-6´Bmõ<¡6¡_1¿[”NsöwÁÓû]›IÅJ8ulª·ä·€ ŸÝ’’@±É?IGèš‹8íwÁѵdP[@àðöÿQ\veÒr >G¤äÇÏù²^¹«hú-7KÃ"b’TM92›Ð96À\,Þ9Ó-W N˜ìêŽÐs ¡Òf–…+ìEÞ!ÈôêX­ëÞ„CÂL´æ7ŠË>ºL›Ù•,Ø-ò«á¬¹¥Wåâ$š|G*ÐbG¦ßA¤ó|ãÐZ¡´¯7ï=QøzH Íý%Ù:²wVè·€€¼ÊŽk‘Åj°Ê~ÁmªrŽ‘±ÊXÞìÂ>Çë,0ìÈDªáÒëš(áæPïXf¬Eäç•bz?ÁÓÀñ÷µÑ¹õ /†0R–0‹£¸ƒÏ°5Æé4+ÎÅ+w…­ Ø^[UŽ BzÒÜIX'å8f/žmâ{7&ùÇqm(ûêm}ëó•Ëñ²%[ýª2à ‘‹aG¯k¢ Œ®…ÂG Í}aÀHÊ- HOT×°8eïHš¨‰8þi3G"j'“µÔdGíQã–P£»rÔ"¨¡Æ7‰¿¨µ¤)ÔVÒ¤ðL>í ;SóŲfó£KLœˆ‡⣿""ºteD%?é¸\ìÃ#~vàñ”ÿØÙ¨s+'»Ð7 &f5ÒÄp‹34ÃMOÚ©EØ‚YJuæ%‰Ú ˜áCPÍ>‡ãƒÚ²g´‚‰ãœ 1Š©6É…ŽQ$ܼHœÛJšÅæ©iÈÊ‚›'Íðí¶˜XÅ(âYh'Jç£e])ªSRíÅÞ0SèÕLR¾N ÕaË„ô{ìóY0Ôž–¬([ZáÚèˆy‚`ƒì¹S›aI»JŒ GÓ3H R7>—ø«b<BÅîjñ·6#ѺCºX +ÔPíMÈ?2t†;8XŽBlŽwãÇ?ƒÔ7$õ×èu) u‹êoIÝôÂãÖô˜hºêÕiú©é­:ºô³[\ú9(é&Ï'Ò?-"Òé™(÷9Šû ++ânÞ¸w*H&\ñF¶hkJ.è×,¨Åí4âµi^'”IÛßÐ6íÞ‚U9sÒšð×Húû­\ã=ÄÚÌÖ…IJB¢¥b?‡xa)¦ãý\Âå‘hÑ0Šo·ë†iˆ º™—̼$wHg{5ºïz¨‡¢ú÷PÒCEEuW2¨KÉ ö’Aíc 9äh3ð¨pàQýîh8\{×uÉX‡êš•Û=~˜ðu‘_Ù|]ä‹ìÖµÝÇQmw4w·#æÞ™{ƒÜ_#£š²ùŒjšÔ,¨:[Is) +æCQ0g¯B¼j>\ˆ§EC†âøN•ÊÐ}ØS_yè;ÈRÊSÙOeéüSFL1bþ95§òT–âƒù}/5ò)„E«-øJÂ¸Ê û0®òþ÷ÓUÞÏûïÆU^ak"ŸG·òE@ TD –Ža æ„ü™ÀË$aŸTv„Ã``®x:„ƒkÁIOšáÆ"¢âòÍqÅ(HÂÁÒbâ^žâ§c€iŒ TŠiVPKâ£1æDk»/g†²u]ÙºÌafWö¼„ŠÙ¼*Iy¨QMÎÜ‚†IJ,…¦Û‚ð‡¤Ú‹}EDÞodD%¯Â /É™†£‰ÈKyI&]TQÂævn³)؃ڻßu•GõïÄX‡cêîÈ©FÃq€`ïÞ¦ù&L“á|N†ãÆ ηAlÕÔ,(äæLÍ‚ª ªBTÕ¶ŒjÊ*¨ú8cŠÂìᮇ¢ðpu-˜¯>\Ü-˜’¥(˜[@ ÊCN8íÏÓ§ýsêçé¦Êül~92¨=ì—`,‚a‘¬H9ÁlÂ"±#A†H_° ' ôïgÆUÒ÷ÃU`¨‹«l¬Ñ ×›@à£ù4}Fôœ#ˆ™¤h—ë’¦dm„=‡âžŠ;7¸YAÕI¯–DHct/Ðì#Ì ³ƒËò©ÉÑha¾ +”C‹âA>](yª³—õ²`ôA*§ÑÅ€æ4µ‹H#jú5¿€€ÚhLŒZQ =ȉ@°ôŸ+%“¾ZqæÌ,%>­ ïWx!I90á²gSÙo8ŠËž—ä´Ã‘é ÓþÃIº(ÒEõ–®;¤‹IÕI%=”Ãáà#ÙCQ3~¤ûÁ¾—ä ‚½Û¡îÎÝÑÄ:ëP_\° ËÊa9…id˜FN3œ•Ûýcåv7ÝÍåNÝu=‘;õîÕ¶i~£Úœ^8Iš»kvæá2<\âÕG¢³ñêc .Òà©*9™Cözjަ²QžÊ^9 瓈NÍ$Ñ'}/ú¤?`qÚ¯š;œö'XOà –¼³„|’3îß Vì—$ƒÚÌR×±_º=\¾ Ø‹XÄÁ„±“†0­Á¾¥k±#4„sXk¢oÁ‚þý,@Ð+5Våâ{?`ÜUÒð…IÄÿ~¼YìòX úVuR8°(F8¼\3‘ëäq?…C«F8hi&Ç»H< 5† +áÙÝhH¢!C¢ï¢ “®ø Ò ÿ 8þqb霠máÒ.†SÇ`=ǹ‚"b’ú5—~E2@%vXi¨ÁŠÇ¨‰LvdyZÊ;Í6³b k‡Åx±Žî³™3Žˆ.%¡„ÉÇâ(³²QÉc2¶ã{÷£H–rÄi¿[’.ªG ^ ;_‡Óá.*/å%ÒCQÉNX`5ºOP5ºïj¥F÷g³”†N(â#θ‰b (Úp¥Aí]wÆÔ~àQ=ÊKáÝÑp® +‚}‡ê[@ðcª÷X‡êwGÖpÂ/à -˜¦i2Z…½»EXл#+‡id˜F_— +Úv·ì«æøþzg/wê2[NÃS2¨}øê¢W|œ9?5LÈÜ©k-9 5,Ž·`A_¶¦ˆª¤!•hM…›­äODöÜ'™×Ùs°B]g"*v?´0kÂt¤ä¿Guþ„fdqÊ®á¬é•Vå¤9SÂ9>ïgétR~$äΈÞôÕ$Õ4¼¤?Ÿ*«¢ÒßM¬4á©ˆØ +>Zö1——2j+«l93«|6ÞO› »:>êõRúŽ|ü¾·‘ÓœœiHIY†C¬•CVùÝÅPð0 š•NïÓ•ç +{ÄÏFH ûfÒI©¡0«C®«ŽZgçpP„¤–s~1!oQ™3K—RkÂáÅnX>U'úëP}üfZÐ’ôzGž®&Au„!‚êp¦³*%0È™†kô[×Ëþð}ÙèLÃÍ«‹ž ¬J‰ +rfâ@Î^Æàœ‰ðd¡ÿè#TWSî^LÈÂC æ-{ïï’ÇU¥4ìˆdEz_~lýu…©JD,}5Ãzt3Æi_ß—ÙªèÄ4Þk«J2ôÞQªrcRúbgÙ€¨äÛùè;¨½;ëÌ +‰†n³éi¿ #ýœÓèþ*Šˆ~uEP]‘ùœ×¥U)@ÎôFµÝÃobuGõœP·cÒ!Ÿ êm·š<­qÄÖY…ým”NJÙcUò±ÁIú³vBúxIü¬Ì†%GExš,æ„ÆQ·NÐ8SqN#øñ4E*» "áp-B+•±d±ü…³b*Vá#p¦Á”†VÍb¥W)g‰p•]ÒDw©tQi: ”ÁC fÞIÃÙ $c©:"Üæ”:œQgÆâÈT¼ë¼4ZKfuRSG2wWg€k0XÌU  ]áŒ*7¨2Sq@øHæ€8î“4mö·€àÓiq¸„iœ™$Ky·>æ„QÇR™„bò¤¾(f ‰N÷óhÉÄ?àÀ¦”ÝÏ>‹‚0a•LÀ€ A¾ö“ì|šB6 jú ’ÆØ@ç!½Ž{²²Ç.böû’LÃYLÃ1ÁþOÄ4üÝÅ0sóÌBaÀ]u ïá™\EŠ ÇEeà¸k‡¸å¶òØ= l¼ÄNþÏpÈìÞ QTïTõ£3PqUrdÅ®O Ò_(Uƒg*5`}÷Ñ.¤k¡•ìe‘ìÑ[^¶{Á@¢KÄ™üÌÂI<+FEÿÉÁÒ ˆg5kô÷»INÃG +EõE$"ûw=ýýǦlÍFŒÓ~‡ºaM5 #úGÎ9.uhpý¼ŸV¬L‚UÖȤe­³t”3LbÍÙh%ú:`Äš+*®ÊÇH¿ÿQᨬÊ塚§ô BºŸ«’ÓÚ¾™ò ýýxÙįr4¨sm?²GÏ<‰ÇG!ÏÂb]váöHÑŸ…Yšˆ2Ö$óµUe"¦(˜Uª@NßÜ©Ë3þ#΂eÁr³×èÏTïË$Kþ- € #Ïâ.LRPïÃ:œÉG´É—žŒ°ÊÞÖ®èý†ÌW$’=I˜=[@ÐÒu½~vs˜ äC³©vzÿ[XG_EÀ$¥…ÄÖÖÀŸYÜŽ?–­˜†²ë.y5ve¿ƒ<“Y·L)ñ0ÇCõô.˜ü¼ªHØÕ Û]ëä¤,¬ ‡«ÉA£Èaö*â\•Ñ'}™Â +½·ìÜÌü0aõÎÕ°¿GI\JJzÍÇ*¬ôT¤F:(ûˆOŸ5À(n…ôœ¼;-?¤Ã¢HÉ' &ü;WäN=YH&ŒÎa=:+Š”ü¡F pOV£û ’Lœ™¢V¬×)ïŸßWÃ÷ãAºÛ†‘~ÿÚœ¹@3ªi™œ¾¿¦PT?øŒèÓÕËmœfßÐéª|(2¤ éoÁ«ÑßOx´`Ò-œ3]s}Â=˜|#RY•È™Šöôþ™Â +ý¢üjÈÆ%»Ç…Óû?.ŽýÁ £:&€þ¬+ÄHÊÈ*©¬[@°€ec•Tlê¬ +˜×ÞLä³Ù°æÛiP]ÁyYSŽÅUùPaÎTsX‹Kçš¹WË»à²AäßÎÙgsŽÈû/ÑáRN*'[ µ‹é–¾Â‹«ò1n£ÿHK§‘9yw:dvOc/{Ä÷ÕÐÑI“‡ë‚ÉoÁÇ%+ÒÕ¨­¬ƒèû~¢BW\ñ:ý¸ýEˆIJÈl’þÚ!LÞûêg= Q~ÊCßfY$wÖ Ò°œœiX¢·ìÇÉ™†#)’}8rÙÕG‡1owoÑ; gªÒÙKG*® T{E=ïÔɧýÜ×gŸ9åPdEJºgÙÇYlœ¥ÈÊmoTÛ½†7ªÙOô£*/îƒ6¥ì/ Wª‰· =ºrÔTVjŒÄ[Ð^Vjš®5Äñi\¬ôÙBúWlxv8ÓõkÃÊÒò¤Ä¬xÊ72¨Žç­Ñ§•׌"1Í'išXièIgvzÁšæ–QMÓ!t†ò£#òg*6 )– F b‘~`¬‘†YÙct£ûÿäkYÙ½Õ˾‹d&’#+{‚hµ”ø rQŸÈ>¸X[LB™šÈ<±ÒˆÚý’ˆõa•VÙGš% '³.•öŠô‹JŸRç”Ê^fJe ¤¹”’BVϽ6Ô²+b,¼„Qëûã9²Ÿ/ÆîÖXN(,‰Ç§ˆ|÷5¨½"ò-Y‘z˜gºW +åuùŽÒé”ÝEr§N`Ò0Äœih².’ÒüTÊ.s) +&˜©”½Oô%¥Rvœ2¨}"òsC¢ÔX•­ ‚=H Í]Œ+e­•²Ï´ŒjzZ.û, ýÄi?(r'GÃ-Ô^tå…wA6dOaS‹‚Úl ,ÄFˆFS !gZËâ9Ó0!ùpìÒ²··F5A› D‡%I’®8Ÿi(<ªƒó™† +·»×ÍgI Í=éHGœöŸF÷!Ÿoƒ\…Ú;D›Mb•yŠˆI*HS¨,¯QK[«Oqå¨U¬tPžÆÙH8*Q›Å!P„Š‹Y]#9ÑlZøŒ>nœùæžÍ”Ñ餼˜bïiƒôÛè¶»¬A¬Ô“$­äŽÿx]ÎcPÑ&¼è ãP˸ø’` +ÅÄà8ZmÁe“ð쥼OßåZx£R’rž¡èJé† Ë¬ Ëg«™Û ÷»² ÌÜ‚- Ø|†²à¸ ©m+»U“—9J¡Ÿ9`’òs08³R™CÓ²âD¼¸Z$n+F˜‚[@àuùh +µÆéyÂHüEMó87zz³bM‰ çL؈ýþ¬„:×- €sÏfFæÄ¥ôNþãÀ°bmu bt¶1ÈBÕD.í&¤ÜÉa 0›ðÎ +hJTòеFBý\†Î£çÐf¾`·¤ŒAÄì»áÅNN.JòÐUƒã¢úç²¼ß[88pl¤F“÷4ŽÚÇ- ¨E¢÷>(¤{â"½p˜Ïl7(„ÉŽÚú‰²N–ˆÙ¡Ê²Ëšºžèeך‘ %4[Š[ò +Ÿ0yG +…tÂK6G¨;ÔÐØª–Ã< -ßV\"wê1͙ƨǵQ, +È`XH«4òs +ò×Û;„P¹2»ó¹ˆÓ¢.þªÝø>ÚÊõº- cuÙÒ ¨[l ¶Xlu˜YJâr·€€?ó0!LHmË8Ììz8[@Áù+ŠÓèw/ü^ÝÉ‹ÒcTGÅÂêèˆIéQ`Ö +¿-ßR±œ‡¡Ù‡)ö>€N•|A^U¬êa’’K¨–µò‚_ì8ÀЬ·’–Á™‘xÄZ)‰Ch¾T!gÞwaô“Uªb·€ ¤—òcL±ù©6è*ŠâH Í/ ÖÀ?Š0yq 'ìŠ.\JРӬŽSƒ®ÖE³2AÂ^¸“3WóùMtCÝ‚Ä(ÔÉæD„lH¢[ÖÊŠˆèò±ÊS^6ëd²‚+aÀôNŠlÁëÝ‚e ¶€ «HXi’°Kw®Ž`#¦Æš+ +“””‹vaß$ý·@¿ŸÜ‚EFA[‚ ÅwFöôB~!>:êa’²À‰Î5‚š~a“ýjãú¬îñ!«9 öG¸¥Gw ¯ÓwQÜ’dÄIé±&èªQ)+v b[@@bdÂg9 ÚšÑKnɧÜ]ΜʷyDôïAÿL]y?zȳN HŸê:õ}O%5+db­÷ÇêÄ|±‹P|tÙEIÊ‚ü­D^ìê©bðÃÌnA˜qÀÔêaÅžv¯p³t1àŽ‡²eÅšŽ¾~ÿ+&¬¹Ö(Ν¨®ÄGªï†ž3;Ÿ±çÁ¥9×9…ô<'% RUVÇäô}Ws˜¼lw°Pò~N€ˆ×¦oá2&FMö ,NÙÝX¹1ZˆgqB.°ÃÌ&pnФf‹­„qÊ"¾#·ÙÈ]B tUÁÓèo«#~6uK¡/üCk½ ©mã1ìôÊ”A:Vg³_ƒVÐá´ÿ#lÁçÊŸï5ãiÿ‰ôÑo®è!¯.úX*£¹>—ó™†R${2¦(˜ë|¦a×pÚÚlæŽÌI« V%éVJ™E^ï +çÌZ²ûé’•]#ãøK„¯ÛÑb‹!t¦¡!%áÌïCgz›NöЙ†òqfˆ¦/M_¬¢O!ÂÛ¥uðœ¬ë5=+Ñ'yO÷œ¥Ç4=g\ øÌÍ™†°ßœiø…JiØ7åæLÃÒµ¼ã¡¾Œ)ê”ä1göÊɯ +³ ›JxB²]¨Èζ±|ŒxþþA™*,˜"[-½XÕïcÎ4 ã÷ ¦åLC3c1YÎ4L8T“/-gúÆhò­DLQDÁd9Ó S%ËI«³ŸœihÆãì×ÂìÉ“!%{‡cöbqRò22keïðî-úPœ†Ö4„† ©U„"1³³óÐïÖ3DώБª<ôÅÓ<ú#‹ó²)ÞFN·€ JÈ…ª;ÔmôÞP×sU^žkV>EkžùýpC\•ˆÉ™b&"{5âeÞ²ïF÷ÅW}þb¥!™r§Nø_ ž,ô®üeÛWCPí¢çªì.¥Ä…Ó‹\ÙÇê÷AùÃÏ*Ñoî„Õ1' ‹›8±»0z™¤e­îzNʰ´¶V‡ÇÀúRKk% \ï·X—rtÅ¡™Ö¤·í¹B -k•‘ ÛˆÁw§àidÍá´Ä‡Âi1›ôi#11j“•¨¹æSiUvZÒg¬ÊÖ„t5Qñ«¡Z‹d+6¬AÛ¾a€¬¹.>5|V“‡@pÖü2wêí]0ùG+ñ/ƒÚçv% Å”ý7Œ —†3 å,  ÒÜÕäePídŠêîç.yÒCGxD˜<…S´&ú™½Ÿ•V¥C5Kƒ¡,5@¶CfÃXë„ÔžkÚ(…þþë¤|b%Ÿ£–ÖŠ¿‡us9•'GH#Nª»ãéûžÙ*iOßO9"Ù#r™&Ä€¿AÃiÿ©á¬9UVe¥Ñ}“}ˆêPxÄ‹³%6ßøœ”˜wÓ¬0‰ éwŒ¥bèȳ½á̃„yÚóýE©Ê³Õu©§µr®†ý?ê\U-&úYyt¹.¼¿EIJÒ.ìå{‰ß‚T‡8îÏp–.;ÀîÈópv@°h#Ñ3DnÊCõöžGÿlGfP½+v„•F÷ÃË»bãk¡òûö`Y_§”è]Rè_ÉM—Ðþ,{L¾ì8Ž2~¿£š +X"eÖ6¦ìÿ]V+¨­µÛÄì”Tòì½XÛŽ«ÎÄ +ïÇñ[RRÒQfuÅR {1q³¬;Ð §#æ.Ú”²[H' k¦(aUVZ3{@áûmá´™2%”aC~ô5f…ž!j}߈«b9 Ђ)›Åi˜Ø2ª9v*iX®žÑ”%Ñ‚9›ÅiâÈŠ´$Sˆ>â*­J³3ží'$”8Euï‘ò>ˆ¢gÙÿ›Ð¤-œ3e|âûjXAMH_帨Þ-„”µšùœÉ¢„UÙqÎ<1b’g˜R"¨Î-:œ)yy(#?› ¥è>Ý%o9&ìdር[@@@]ïï¤H»ðPTGICÀKZÓUù¹AB¢¨†•Ë~_@ÖkÉãÅ>N(Ê$Ñå€9s^Q¼w”4ÍÊ4 Í¤lJ“‡ùìrwZ'ñ4’Òà´ñCá4Ëh +µ-  ã/j¦Ä[Ðèüƒˆ³Œx¢ïXy‡öNsòüÉ‚VÁÈýi]ïoÔê» ÕÙ3窌(ÈOgU†ªúÑ?Ïž,èYïcä +-Bˆœ¦Tô’0)¿RcUv‡jòŠ ¥*GvP{±Òè~¥Óˆþû¤¹Ë0ÒDep¦aÐ!Ù“ý} SçL'¶$è:Ù£QOß¿%˜Ê XS†ß’2µ•õehœIð<Þ?I´âD‚(U>ÖTÖ§p)GȦY’ÝÛ€ûuÂ%¿=F•µåŒŸnoÚ+î/ö`z09sV³_[UÎ 3YNÑš,h‚NÞþ*÷Óf¢åWà ƒþþ«ÐÀïˆ «2Òñde¿ƒÚg`(§Q±û9:ÞÿR¼ìň7Hç.áAΔÅ);WIçÙj«#ª{ö ·óèÝ\ú†銈žA§¼¿0JX•⨶; '…‘ìÜB ç“+û’[$4öX¶¦Ëé¬ÊÔ¥áL S•¤CC·‹¼ÎÞ¡YóÌQHo kZ¼“}GžeÈ┽3¨üK§ÑuQÔþDä²²ƒtÊû÷…dSÂN·&éãÆ™³-UYÓnr¦L›°ºÛi¬éÊ.å#±Ö- ï ªŸ«+zÇ‚¦YH}R±°GmXcIŠ.çe1ʬ_þØ‚HÅp«X“aW¥ëPqU‚% zoNeDÔ+àÑUô\•ô„Á™Þ+àÑSGº*‰F5ñ}y²â̇¹Îž×ÙwvPû™´¨tU•ÁD’1‡˜™Œ¶³H  ôùæ5E4*P@L*0&(FCaX  ÃÂ8)ˆ¢P*©$;AP“fÖÕz D$…ÅÞQ§U®V/©}‡U¾ŸéHUsÀ+BŸ«3Pñ:'ÈÍ +' +è4jKD¿³Ã¦¥¨–)3}.ó~Þâ³HmÒÄ¿6GÅâ§Ö¼AßU2¡à˜ï·K‹ÿ„1oÜoØãN­nI¥‹aÝ:‡Ùβu@W–’Þç·ñeTs™&*QÔ¸ÿß²·ˆãºÀ_ÿÊÝPÛýïH¸ÉAÒ+È!o„™Ý ãB±Kûß) =$¹—75I$7™à ˜qMà£pTŒü½9ÞÅþûr9›aŠªo=*¡? uH­½äa'¢†ßçŠø†v=aüûêKí¢JâÎ<” +ÜÅÚ1b‘n%ré:‰@¬y§‘mì&;E} ÷ßô¹æ]ûmû„%‘ÓòŒÝ!¡í£±&’…Þçw½EÞn9UÅ6P3Óoƒ¶OëˆCk”ÔòôQ6êsÂÇ¥3g­¸®VûHÖÛ>)GByxC\\é8Ÿdаà…q}.е6ÂåCÇXé,wÛ'XTW—,=nÕ+$L~ùPë–¤{—éJQÛÇ¡r­dº(®f¹²ƒ¤ÏÕé(óDYO*¨œÖ Mw…ÝÎ Zš +Þïs-¦‚˜ø1i”ÇARþ€·Š¥…ì +¹·öbà‡YP»*Ú Ù“ùelCüUòs?×v]b÷(åV ™"–Ìf–­^³°vi›XðlÕÂ,H-]‚1÷?V\yï$€.„ÖMO?IÛU°©Ïeð1Nÿ}„p#8¯žÎr ž º¸R"P¾T÷†°}QÈ3ZÝa gì?'–¢Ðhn·×¾8 +x‚™Ûç:Ƽø&*WPÔº‘Z¾ÑwJ[íOŒïf8@K™­¿´€V@Wì=ú\ô:S*¦Bè‚V꛸»ÒáAGí6d©!{ÖaÎâi@w’~8Œ.°Aoqk’X +!²v6œ`åC!Í—6 +1¯@2qc—ŠWÊ2ßâqKUÝ6ªbb®³È-_Òüš*&ø†}Ÿ+ +êøí´&ž ¦XGhèZcmTÄUι>ö.Ó …Ôz @WyÙCt³¥§dqÑ{Á±_¼½+1z¶Q Þu•MÌׄfµJUÝz'¹ã[â‚Úç +N‡ }ƒª‰ÓH¡’©ZVßcñ„lƒ+½\·t Ñ"bâ*`Ž… +oÚ&w™-z‡ K&[²X3O‡À¶dH½lºâÈê@ˆÉtÓÈÄ€7áS&*ÍÌ™9I’pU©v…É aûŽ(Pï|Ë6ÅStµ/å@žã¶ØÍigºúðæ>— ÞÐE®_ã õ ÷p¸5Ž‚v»ÏUŽâ9fÜ[“¥ñÚ¸@@‰Ì€.¿­EÒ^ès•|”væéæ´·…ùSC3w½ú\Ô4;Yqu"÷"¿Ù¾g žæïs­áÂ÷ÊŽj¹Ñ‹9µÖ}w eXÞœSŽññ¿º—gnèt¥Ôõ +=°€ÝÀsGÿPÕdÖޥʵšV¨;Ì%Mf‰mŒeCoȳ׊²Šx3æ}¤È÷¹´ÿèTƒ¸¾- ”j©B1¤~ÀÜí_oö¢bˆ€…ýLÛ™5w5îL®fÍd|!µiï¨(ÈÙ6~IÌÉ›ñMÂigÊY|i~~ª7¼˜1DoîÇÀ3øq@ªø#îsaÁ  YÝ^eèsôÐ6ï Ãò‘‚ç™t­û§—D7&àPqÏ!ÆØÆšÓç*ÐÅoðý’ú\$JŽ)ú0÷¹÷“‡±ª—#^Ìç¢ï@Û•eƺj`ß‚ˆ•’Ÿª«µZXÊÍßU÷{GãÅÀl†Ö¾S”÷£BÃ{¹ÏEâÝuý0ˆL´‡Lº:ï8v“ˆ™ãP¬Uf·º#í*;2É¿WŸMh?}®:À´r¹+2Ö°‹ª4ãRxíÍ÷+ŽEb¢ú\ûæúteá¢vZj‡KuæßM]DÜYŸk·`H’#  –ÝPþ?$Á}®…‚ñ{{€F‹ì’ìÄ”‡Èa£]­w ÑKlj×o4¤½äí2Á'ãžÛq¸LhŨˆèm +"ÕÿlF»hH1Ê]¬‚Ã(­i‘> ¶Ô}‹x/™‚iÂÇmÏø‚am¦£¯|µ­H—9¤g{n*yªÅýO«³˜–æ`®³ñè–Ÿe$9ŒrXâê£Ù¨þ½F»ðü†_ê%Nx=Øñú•ÜÀX{Ö"G'¡âÞÈ¿w}G ]Ž©½ä}¢;YÇÓÅ™ ‰UekýjTD¡Q  ,cX&©ÑI +x +GbÒ92µ©Î·\’ó­½:0±0ç s:åP7ógjñüèxQáÃ?:K¡˜åÀò¦U„ùœ†°ø`°ËB­ylÔ9°Âåj‡VüíN>¾¢þBl4b)€¡¼¢u%X­Ø\ýók”¥¬³ý᫺Fî‡QˆÒ$X * ù,Ë>¸êý¥Ò]è\Fj€€ +¦ÒCð ß!S ˆ–¤=Úà‘ÞÁaÞŒnîÓµµpØc‚!‰ó‡”°[ ‘Fg'Ùgz÷pPx Ô?Š¢/mS¬Û›hušÓAéuÑo´š?ÿÄ/?é ¥ˆ£r¤ð[÷°“l¦œKh2·º=sŒŠô9C#ºI>¦ü4.ǺVNîá9)3:Ë®¢«&Ö¢³åÍtù|Byoj^XZJ®¹ò@QŒ¹À´Âò5[=¢âßCöœ2ÌMž¼aB7-À 0§ùý/¡`7Ð?ŸHZ> þÄ¡5eÔ|‚É÷'[J¸è +tõZ-$ßlèÞŸ-\Äq¼Ÿºo ¢‹tD©ÚêpðÔƒ¾(L®üIÃfè‹c*¡…{&óÇhç1Ê#¶LM#zJ€Àû®ÙBÔ)¥W ážP#é’S¢¸ÅdœÅ./$`1²‰? à /t&ðˆÿ…ÕjH|Øûnê +Ž8l—Ëd1âDÏ“|@Fðv¨f¡B}u&#¤¨G€?›P¶K•v$î­ÖÝ8'°tàLýø} G¬;3ü™‡F¯œ’]·«ÇÆ…Ð:b£(À€ç‡–dE¢‹ôécRÅk_’pÝN…7Ôöé“F\æ0!O<}¿.¬€w*‹<“'6SŠ|œwš3yX3LUþïµ²Y$î|Å.‚tùŸaYüÞ]‡>Cˆ¿|›±òy Õ¨%÷„Ù@(Ö._2gñŒ F·4Xäá¼}Ç ëºdíbÍäõyÔu‹¾œÒ‘åI)ƒ¡™K~£œ’‰È’ÚÏÍMŒ÷KÐÖ»ÐÑ‘¼î§Ýˆ¢Pwë]2@Žs!2”ofõè×”Ö¸¦?ßF}éÈ oM§”C7`ó°åç’•¬ÆuUúKiûe8iõD …m0‚ùû‘ó1+W+*h¤›{…_Ìu !‰ža—º# x¦Ò‡ Ò!lÞ øWjÏØ­¼™ª.¥)`òÅK˜)ÿÆ>‘}sà°Œ¨Xˆ1¿¹+T +ÿ°½Üy+”v¡³|¤+d*hê~f°B:YmË«©®<=zI¹¬+ZF¦ÂVƒ}sÈõ+$f¢]W(N_!;@NÏÓ¥ì^¡‰öFÇ¿Ý~…NûEcVè:`ÈSæÿ.0T.~¨—Ðô!„¢Â–íétvŒ(tæS‡†ßä•_‰`­³®Jêè¨×¹ä-¦D$($Á²ö_nÓ¤¼`=)œ×“Qhˆý’ +ñŒ^¤FË”ÎJo³`†]T¯LC}.¯ŽÂsˆ±z¯t8HŽ3w\9H” +ÍDüâqüý“;Cnöˆ <à>;H 5\ê³xFþÀÜ3ËÞsÇ „àcP dì¸Áµ§{ªzM‚O‚:×;¨±·%ÓTú4TUæ²)M®`/9û1.™Ð{0÷8ŠÊ¯·Ò™H‰Û‘€ñÞŠ;ËÎÉZÖ“’ù¢(H7xÃjjñF»ãgnÑ?TËlçÄJAˇ±¡½…¯×nzŘøi3¹å+ÌÌ©Ia-ߨ-h0¡q7·æX?4Ý-Ì:z\ÀlDøäÜàÏzöꩨ _Ñ%(8t¾0¨Ñ•ê’ȧ5(µîGDÜ)t=Š`m²ÈCèÀ#Áë ë¬:‡”?þ1E¨&Cöƒ‘ ⎙ÞoxÕðvÉ—5pÉݸð½HsUpàX§ü2­ß!SnÇýÖÏæ*å~„ 7øŸ_Ô'©hÉó!.“Ê*s`ä»NªT¢…Aá‡uÞ·½‘¡ 5ÏPrþ»aw—Ë!ž€¡ºm(yø)ƒhÝ—œH¢Ìœ£ƒL²æ—*-Ó=`ÝaÊ8ݘi.Ö-ù¬L›d÷õ»š½&Ãp2ÒY¬nÍg+tø¯Íމ Ù3bã4Ü¥[þ– q±*}TЇ‘S·«ÚSÓÂ<©ECÁjv|*î´–¶DÊc­ãW}˜Ði<û\Á­7ÚÙ8þ³«æ—ÇÙH€Ín¡:(º6kœÜð»÷¹Œ|pVäðE9 ¹H¡•8‹š}+ÊÔû†æ{QVÍfOq¨…!OˆÉè“>OƒmBæP—!¤MÔE,…!ERo”ÐÎSpq’Crc‰Þ.TXLÐþòñ‡S ÁS²î¡¨ï0;êdÀú/—ÕSÈ<1Â{^ùu§0QÆOjÄmÔ=?‘Ⱥrlשf°ö¼¶%¼¤±„;ÿ¨ÿGtg§•ª@¾ðõ %†È!ŠQ›‰y"#—‹AZ–˜˜K&+SŒ¶„[&”®¨êáóPšLKrÛË –ØI;:Ÿešw«ÈJKªÓi fBXÙ´[÷éÁ c3Ÿ’ÁÐlƒ¨Á,©\6cÀÍÜóÎ1θ…ec_uœŠ$Ãon!±$ØcÃΗÿ׊CX +ìC— -L—#¤ñ-8K´±0| “A”ÜîáDdN“‰–Ǽ/[‡8÷š1’¾ŠÿIW ¤'`Mx×ì æS«› M'},Ÿ´ìá ¨D’&”˜€™ê¨µˆ@вQ=¿ß9‚OL<׃øõì‚=ý;DLL’ÇþA‡Å ” +ÄBã`힢}cšhDe°÷ùÚXÕ|ÿËh»Rþ€•+¦3#1ŒYh=É·xœ(ÊÛÅ- ç½úqG‡“˜"·ÅOvü^“´.[pbR¤Í4;QáãFîò$ˆXŠ™³H¡U–«>ÇÁ£ ”²‡0Þ½ÚÑ{•·MßCA¢6àp'Áì¤Ð¯¬@,a {ÁŸ #'ûB]7´”¿¡ë`å{Y4;6Cˆ– š+vì T¡ÐÞ¾Zò[þ—e<@3³Zùüãmªü ßsp¯¼_üû\|ˆJ±.áGƒH¨Bi£÷8é[êÒ&RðGjÆ«”998ÝÜ(ûU[Î5þË·à8^Y‚±žð= bHÔn‚"']#Pì^±"‡›Ó1žÚVìøæe€žSØz JÓ&¿]SÓÕ}<‡þŸ‘ÄHÈ¿6’#_ÃæŸãèë§{Q«²OCédSC™0­þH“Dµzƒif‹GŸ2!@I7iÃX苪— N¡̨®lHÕΜùG³>ƒC‰/‰Ë,î¢jîW¬Þ”ÿt×Ézj}¥¶NΣ²ÚcŠz‡Üîi·ßÅï½!`9ꊓ´a}ž…bº â •«±Å˜\â K•!9„ÛlÝMpÛçøš¤}|Æ‘Wz¼bTlÈ¥ŒÌ_ùJœjŽC“1!@¸×í ~£BäÞv¡éÃYÉÛs‡ãa¥&n'Qå©ç0ËFª´ÍŽÕØ·VP-[îPÝqr! Ýá’|”J–éÏ¢@A*ÌAww«²}Œn›²$Ð4@XjöÛ÷ ¡r‰5ë¦)¨r^³€"jfö²Ð{oq h Ô~Š"s¶–.@»=ß–%ˆµ£ Å¡'$éÀÄ;‡ho •F¸RhÉ.ío”ƒ¼ø†O[„òü³ƒC°ú=‚ÒÕúü¨¹nC­r-Q!r[ ®ÿ¦'òæù3ì¼»î)àš~^˜Šw™ÀXÛN¤ÇÉ>Pv´`°±òǵVÈÕ ê{¦%ÕkŸÑ§ƒÁÑà,ddznûÈ‹h'¸FA}L„ÁE;à@sdˆ‰ûŠàæe ™ë—yrÕת(x’\*åQAÛ>ªnf8XÕ§h ”o…À”Z0ˆà¯¡Ô>å“Ñ3ø.ÎGr ŒiSòV*Wb£B+\‡9†Jý²$¬…?2T욤»;WYÊ:3%‚Ø(i¿þtÁC"ôÚBNwÔ/ès­OÛ\Mh¬ u3Àìº]wl”5tcᬠ +\Ü<±¦@×N}AŽHNã$8k‰Õ¯ÖdÉó]Pzyñž¬ ìi0n·@ÖøDÇ=¨O€¾¿MLÍ'ƒ|>úúEÄ×às`ùö¯ªq)>|ßÃ32ÓŽ1ˆñÈf#ŽÅ±G'}œrœÔrRt MèVHŒí\¢Ps5w§­'|ÝÂHwÜyá²àNOeoö;m-ø¸hÌs;V\JÖé©É[|‡ÛLPoÁÌåÇÁ扴1«;€^vš‚÷T‰C^/n;‘ð gônÈàóÂÍ–.²Ñg´²÷D‘ßäû6ÊjØ]5:®°qµ=´ûô/äòê¼M‚æ€ÑÙû‡‘õ*… ÝɹPÜ -éãÎVm™#I‡È¼|ÆÃ +ÅqŽ”\Ãz¢GÑÚõŠO—ȃžÃU—OYιsóÊGíæ3OA—GµŸ›¯©‡³ˆ·Ë7T GÿsÉ×|UV‡õáòpñJ¤‚»Ò/ãkd‚Åz _¨/Sê°à(½ª%Ãx|‰ Á!n•Üt»S¾‚>o—óFöãå,>ÉCuû²8‚šêŽ%T@%E|·ú”„9CzFœ©Ç¦"±öNÉuö*QÄŽ‹ðê¹ öTbÌÁäŸÔb†D-ŽdÄ6m¢Ijù“¸]º°H¨ˆíû̾æG Q¡QÑ¢ƒ?ë¶>—'@œà[Ñ íÒ¬'Uøóš$R:X•¡e`~±qÚ°ÔBû^å¸$5÷üëÕlKªë›¸÷Ì›ÅÍ9pfñŒaˆKft¬›Î¿8Ø‚]kËm7B²%ïóè2½çþôT«–ßò±ÁOMi“µLi3-æ3¨ß„,-¿ú9„ÍÙ q Ÿ÷8¼ß +6æƒ%¤!ÆÛµ¼C}vü‚l\´ÍBÖŸ¼¾‹Ž< ^>?€”‘ _=øÙT˜|#/—ž‚CŠ2§‚§›&432:^½òÙ5z²`hèrI\¤ÄOøLÄlº•&DóÊìXBœÈ¹¨êÔ Ëzt7©2/ñRôDÀÇphÚs %s ·¥g+È Úõ˜5<þþ@ë‹gD“ÂÉA…؉[ö*nÁ/¨ˆ%‘:—ù§¦fÝ0@ÕëÈË\jö¶hÙS&´›œâûÞ[Ÿ]ްIrxVvà+‡?'jÞú}¶ ò» Æ‹ë¾÷¢6‘ˆdž#Þ:Xm +÷€?Ù "aöÓó­5Škt äk~kÃtÁ€ŠCò¾Ceëj,i‘\.h^‘*Æj‘4Zsp€äNÖJk58yv…}– ¤Úc(ð ø>ÚÀ'AÅAæ*5HüôêI×Y*ιÂkëF$’Øçã_âAèô w²P!°’÷yu9°Ô;—| ‰ÄIþÁ”æ•Óˆ<ã¾dk7TØÃ¨Ñu+ Ï¸×E1Ѿ¢É(\¹$ÿ#vdÚlMŸ™%‰­Š?ù£>Ó¯‡Ÿ×ζJ’†²7šÖ€Û·ÎlhÔ€ÒnÅ‹Ôdñd¦¾õ.»¨•èÄw´†²ú`;°ø[‘zb: x:2õ½r Λxyf#9’÷ö)IkñLÆÉ²ˆͳ›o§«c»Ú NAÓ¯õ¡ˆ©†h‹ +î*àn¸–Æû}§0?q<ý2G²ø$•ÓÝ®z$¶_FyþÚka. 4t +9é×&nÊt^f>Eß–Åy…˜¨­FºÞ9)¡àÿÝD‘|.7K!Œý÷6—š£óï•ý¦JøÅš…KàŽiÊ›Ï.9þû%ŒðNé$‘·ÊçÕ&Sùn‘2ôê§~:¼éاÈÿ€$vž¸-àòÏf üOŒB°¾Î¬@ëY>wúÅQfH8ðö¿-@è0’/aŠ„†ÿþýÕ­,‚%6ðŽñß ÀÀMá÷-…§Äî›û¼e;ìÎ1Ö4k)€Pd,é{ÌÈÁ2^Aí.v“&‘ È=hãþT*(b’¾Y«ò "ÐöS…ä³pSÉe»;‰ tÂ&¬K^î™›‰^€/’7læÆ8¢ zM’Wù† +¦¶¬ +s*…• „Å+u,ó³ËW*—}5ˆhÁaþçaé:dwª`ÿ›«8Û¤Ký clUxÄvߤ ^m–ÝæÜ­zø#¤ñ+ªøÛCžÆÙÕÕƒ §ñ¡Š^!JÌÜî¼ó›©m‘2Ôâ¼$5/„Ëm€ùÈH.¤¢Hs/ŒÂ+[¥¼T8N%!²¹mK"OXÜ'x©x­ç$ai;zBðöÏ, Ä]Ú ¶°èlŽ%Û¼¶ŸìÝ·ÒÔqÌ‚6ˆÚmÑ•Y{äѪ2Yû£ÆT¶AvA²p×l% Å*ÎEB% ŒÉš?µîIÍt3øãóÑD¬&C¯¥ç bK™í$šÛ:ûÿ“vƒn!”½‡AäðìŒ'sH-‰Oc×Å?èßwÂÙ¼5íxQ+ãm6 ‘xA‡w‘dÄkó3²ôh^McšÇ )£çbÿû’ßE*À€ëŸÔ¸"·‚}8š´xåÙõߪ¬#cs|3yéCE×k .-ê¬D†I8Kt«Cˆƒù¡!~-<òZˆ2oÁ–­Ško½@¬aé'ÁÅs^¼[—e¢¤‹Mt>Çü6¤·Äãíy4ý6RP°SF‹ kQ@¡º+àСWSHþÃ5‰¢¥Ç@4†'0a^{d›ÜÐ +ö ÞÉ[ßv¸£Þ'bCæüø#´+` ¢¡¾qýv¤ÍLïôÊIúR› §¤R©É Þ·è.BE3Ѝ¸šï%Ù.&Þ…ŒŠ“w·i±ØPLéð¦-šÖáÌW|–Þzð=NrçlÃÝ ‰dBÚƒÂ0ÂÌ6!ùP‘&±ì%TA7í6 1 +s!±\p]©‘w)>/¦58ò ©òBŸV|òNö[!o$¨‰o\Âd0P¡jĸ†E–X¢\ ¥rÙEàõ<ƒ +ˆ™Ý¤æÛhœE¡XÐ$Í« yÙ"èPãbE­¢haÖß…»HÈÉÇJòC“êt6LGU‰¤PäˆmoiŸ×ÒPJ‚¬Ýq •þ3¶¸ûz„R’ˆ(GÀAºfܸ¡ÚmŒÇÛÀœ`+ÙÓÏ?¯‚àºÏ¸-Ê€ksS ã¾*86\‡,¹å´øµ¦I‰¨b`¯]ÕGáÈ6™#‡”Ø£rÚO/RÈ=©êʾEÐ`8ó•œKÜOÈêY~`Ë}ú ÝIÔ;‰—VÞn®ñ‘QëRÌB´±Cr‡íÆyÅ7Gl äu “ÈŠò/B²Õ’r4ÕˆŠ˜š:·û­øãR«Tãq?Á3§s»ºù qä¦Y35GT«ãï‡H‰<4цDíÜ-#î*äóìVóæTsçmʃœPKVåÊ-¨,#º;ƒ‚¿YЀ†cËaÙÇâí¢|Šô°—P"Â<¥iìr J¨mÁ‹üÿÜŃ˜cU-™›ÄË%Š?s6šEi†#yûJF–_—¸l%Âüÿã—"îËv]ÚUvǶàcAD8¢gl„®jgÞGœAüÞB®7›ÍAn± ƒÍ¥¾!”¶ríŽæY$´‡Eòí ÿçø´Žf?EêÀx©XÁ€OínãWÈ!D·’®Ý×àðQó¢Øîr¯šä/±neÛá›Í³Ü’žÆ¿àŸ´™Å6‡Š|w( 6¹fm4ôùÍ=aƺ½oŸT*|ûèðTÎ@€«qm†‘¤p)ÒøÂ¿^ùiÄÕWhåž±àœ/8Ìf“!‚jE‘m¸Ë]‹ô‹àÜ—“Y,žÖÅé0çŬ.À™àzs°¾Qö1$"O͹F›¡–UH¦?ƒ)ÍçJ7“¤›Þž¬ˆóLØ,õúÁ`tßM÷aÚ€#Ú](´—,3„¶Qz ~s¨ÁkþÉBä½Èhu¨«b)Þ°6”ºÁ4P÷ÅW´v2v¦ÓªX%¥AʼSì¼Øí´fœ³Ö€ºÁÌ!ù’âÛÌ ¾ÑfJ2 Â(î†Ê°¤´†Ïb‡c +Kª õùúX˜^RCs_о¹…cÇÀTA ßä´úp;*§”%ebˆS\~V×VV[Ø“[ÍlA*.˜1508¯ºT4À—0M6þoá<Í*Ø[É;Ü Ñ@~& €†T:±rªOÁÈ™Kî–Ô3qv¬ô–Ÿ"pò’#ŠBöh€M"*ý²DÌ$ï$‡? n;R@!T(àˆÆÆ*/Dˆ!£:(º"U‹@SVõ°Œñ‡ï_r‰…(›6Âg5ÁÙº•àe“ Œµr'à +êÅ4¼DõÉ\â^Ю‚ZÉæÀ¯wTµ(Õ§2øötà¦cè#Luþ••ÔÕnðŒ“ÝËJF*=ÍA²‰ÁÝÜ*=}r†Ìü ø"¨J2ú±Úcž,NEô`ïß‹&Þd דšðèk©˜ý´†Ë697åM“RHQ` UÐý·&ÏPY`epL2MêÈ€œ˜«òdÖ ‘äÓǤ–.šÿØl jñôà#- &iÂñ1©Ï(ö6Ô,r4í’º u•„̪OôwêJ­y mnÜDÌL5å…þ„àDª%iÏ}SŸÃ‚ (iÎùÁZRT…l¸¸ hu#a´ãñ¥ÙÒŠ9èžÙWÆÜר”ŒizÔ2Šrú¨ô¿Ýý‚:Œ)g®6±/j¸>|]U8~®ðžà l ºC‘<¦vŠê8ÁAÊ +áˆþ 0œÕ.*–Y*ü Z‘f:j•9 ‹|Kb ä©a?P†P®ìxD ”GG¥ËÁÚª®BZγÑZ\Ç·tOÃè ÷»-––g}©t€5︑ˆ‹÷z5§´r„ªºsi< ¾P|7"_€sɵϥ‚ºaäw=Ù\W}øHåa[0yXá/˜}åo§ûõðÃ1zíEîÞßn¥®^œÚ™jÔˆ|îtg*h­==¿¹ß¿\cÈG +у1Mçüªsñ0ý]ƃ¦BŽ·+mðâþÙ7ñ«ØßU–—`‘A>š0sµ«Í’´@‚ wVÓ™Ad¸³Vð–“Š!| ˆ`œ-ٹوøYx¹Þç;Çž.¬^Ž¥V|‹úĶ' èë£6%^C”bż™ŽÁ >ŰyšžÊjìõì»tkš¼‚ÖP¨ý£æÏG”ÿ&¬ž÷c2¤6wíâŽèÄ 81½¶eÚM+¤gt¤kˆV ¥Ë tsš•Ï%0J¹Òå éG†Mò›¦^.Ë%"õsVõ:=³6DE ñ.ñ0‚¨Càç=ùf{î´æñêü'8ÌS*øåír5ø8Dó4õx™'ŒêÍ(¢àà5ŒYàÅš’ͨîoa0À^Ê“Þs‹5iuÑã•…@ÚOZ¡u÷äm>{±i^äš×Qå¬÷è©Iw/ŸÙÓhz:ܧI¢Y¨4¿ý%©¹‚y)ÖG¨î#QÁH”Œ§kÀQqLEãÓ'¢Øé3°€Òßš¤îc6ÖkÁ/GÊ>‚H“·Cœp­m®»ý„˜n|ˆ1*&à¥)m:ë2–ˆÚÄz"!®ÂÆ «(šc. !V Zç…Ÿ"qŠÊ´i\m‡Ø×06SÌ©×ÅÂqˆIKGbð¤v²x„ø¯–@Ì_„›À—ÀÏÇ ýqâƒA“”Y…çsò!>C°ÊE:¤·)Îè{sˆgሠ!>ðquC‡xA3ª„8Q#¹ù›Ã!!vn~6a”Cì*obõŒÙ^ê·IÈΗÂÀuÉ%jŽóô#c&—q5sÄÑV:Tçraë½?ë´Á#H]È2êT̹—XÞ¤T}-åµ±»ÀÚ&¯ø xd%Ð ±ÍÝ35Y {( -—YÁk†¬¡œÒêE©Zñ}Ñj +µ\Ü‘†R7 –ÆJ¥Ú_L9Ĭ.ŠHV5+Xºš-[Xrêìͨ[ÿò\x=IáÊ<:Ô´G‘›jŒ02Âlœˆ¢/Ú?^Ù¦ïIZúÓ_ÑnÆV“ˆÐ ¶MPÔJP¯±?çËè\§‚ò>I˜ÞÈ%ZN$â* IÚù·—š×À·2Îc¦Ù®ŒqMË÷G¬’˜dt#¿Î.*;=Œ‰âÛQ¶èeÔø}­QYb0?6 T +›fX–JÝyÙA²³<ÅnZØëû–jù‘ÑÎÝ ÷^„I4ÈdõN4ÁtøWÚ•LÎ`>=Œb<®»£ÖÂö&,]"Ú©™¦Ž9&Pv­¡Å±v‰Îà´Í3š˜d¡ÖØ‘,¢°>ªÖã¨iY1ë?Õµä +Å#ÐÖ +4×d§æõ³ZÎàŠKG“;ŽJ Búg0øâB:`24°¥k€oȉ۟‹ú & §¦R´Ä38S6á¶q‚,QgsL9ƒÿi1‚÷ý/Ïà,M„`#Í%@Ì5yÎàv(ÌqÈ™9ytÝZa;ò‹C7¹fb>k²;©g ÷ê„ñ%OÙ¥¹#…3øš‹-Š?G¬]ßÇ@Ñ$akmí¥FW÷sÍ*[I ûœTª°:sëCq֑츢rï‚H’3 3›Í tYm*’ŒyíV±Þ8X¢õ6Å‘Œ|#í éý¦R8ÿ˜^á04$g]Ë¥';£N¥m¥ Nö+šN;6ðÂ_=šš¤ÑäFë"‘Ôô *rØ,!>ùïº>kÁ}aNžWŸÄÄ1žÌù©»•„OÈD˺!açǰÈ|anAÌ}ççÀ¸ï‚œÈÉú ÆÄ9¾ØÉ%’O¾DÇL†[)œ«’€Ý1%é«%jÓÀa ‰Y†3°i“SÙªJ—éßPh|´W§T<â—rüÙN0¹>AVJ,4qÓÄ ›ú+hLŠ<)¶õ 9,[9†l0·ø_=ætÓþ.† Ξ]¡em×ncƒñwºó]Ï?ó3³7˜VWÖÂZ‘ܵ¢-,ßX¸bß™;»TújÊ=ðÄüz-JM7¬Æ¤J|¼Ááq?¾YüBÆŽÇhƒ F£Þà™Ûˆ7lpò‡Èú­.•ß<Ùà•#åáâÎr|dñ€KeÜ´ÝX +ßà­_»÷Û/ɦ\åýl©wœ'ã(ÂañJ@ð÷P_™gÐð|Û\»î'þ©Sù᱋D]”þ ª·tÆÛ‘¦Öš øb|õjZÅœÚÕVÍݪh¾ G’°%•zy'(-Cï¨nܨ\E÷Ë+9ª…—ˆ®r`Z<ïäέªa|ž$Æ1p§ 4Sš|ý’o ¤uŠYÈå³["Òí£T³ÿÌ ~þ‹GK7õ¦*¯®Ö¿(~H¯bQçS3Y/Q6Úì÷[q…?w ø¸´¤JtË-v`Óï¡…™©w)g…§)§…RÄ!çWøÝ¾;xŠQG¿.{÷¦â÷ûwg8O! õŰÊP¢>S]bžšvpEBy“¢6‘c+£úîtil³ûÉZªXzr‡×ƒ0Èÿ¿|ú¥Ãޤ"ûàÎ' àb æ­ô˜:~ aöƒ(•˜Œîˆ0 ¿ =ödDÑà é"_JVýv̈7‡Ú:’<¬<Šx+ µLœÊ›Š² +8¥°­ ­{áÊëq1ÈÕmü¹¹XAÈãV‰"»ÁÞ1fI|åH~¡ŒÒ[tÄ´ÌŸªóðr·–fø lYh7=Zá«Sà 2ÞEGžáz+ðöuQk‚3@Ï„Ç÷ï½f‡çÑ]}Æ‹ö@bÞ'?·Ay‹¦§³Û°Ÿ0YÒb† øišâɆ”†}ý·B4gSã_ êô¿ª¿_ˆIÛ{î¶~©ö©–EÀÉÖǹ`ú%™ê¢ +Ô$ryþ&ñs²õÜJšˆÀá—˺v…)"U{8ê×Ñ +=P[ ‘­)13R¯Žnœ˜ÎéI³..ÚãÁÌ&x3çøú´Š°SÉ P¬S·bˆI¼d¸ ÔCËÔ7hbƒÖcí@µ#5ÂRŒN„\ :x=5 +J?ÿA-’êëgÑZ4”±Õ¸§¸Ô5sèF6 +G¨LÁ{…ºR’t”“Ÿ†ßÇÚTQ.Ûø-}…Ò¯¶mÔÈ*!áùv•r5Zú ñ&Ý€FúîðÅ…·û|×ðk,¤ï`Paµ ‰ ”ã }QZ}~¡÷óŧÍÜJ_ðkam é;LkIÇ,Ô»–J»ÂîáJ{Úü!#8>óÌà|ÿÅôÏ4ñ8oƒéXËtµ•’m¦ž“‹›”d†WJ¯©i6HpL¯-nØW–|Vvç/Úd;¹WCÊÐC&‹Ë1wA.¨#åŒÉ‰ÆI4ä.åzC09‰ä$”ù5 +öX›0áè²äŠ‘ ›Šn"mñŽ3±-JK«B*Öý%Î# ±ã ºÈmätð»P‡L»!Rî’€°ñt[±b{²*¾â ƒè£«¯YxMtš¨p\fÃ2÷ªÉ„1J2¼FÝ©ÑebEq¼*Z˜öp\`9°V¶' }‹£ˆ_›`#U]QdíCjü©naN²“ ±À2ûuT‹|=/²|ö§¾B®¿¾mJ‘ú"…ËV®ïŠaä;é –x¯/ýYvÇ©nÎÁ¨ïüýúæÝJ©$¸¾SU#Ë€@9SÞëKŽúÄ¿ëûãó¬B}Wuz}7W¡ûø¬>IÔ7¦éÖ¨²1òÓ»²*dÄüÉL;DχŠí÷h€`l¿éý$¤¨ÖÒø±YwxSFØ…ÿÊ8æJ]e>“ ŒÙŸ‚ +-Œàw3–éÏóå­-<¨:8Õ_óØ'9‘„•kž$ÞyÒ& G×®âû4샞m\p´¡ñÏ.¶‡#›A¯l€Ý_xiCk°ê°d$þ+vo¤eãR»ã’½€ÄŸsï[m­ÈNé$dÐÕú@3¤ÜmæÒ`5:v„â‰}þ³ã¢µhXrÔaŒ¬yó{‡[”æùüšõþišWzfå Á}¬®]p‚£}|œ,Vˆ=‹ÑmL½§¨¢”'p/ŸŠ*2”»æ³1™ ˆW¥bñìä}ƒ¿šŸgžÊá,d›È 0¾ýJW™ ŽBŠZÏ/.ÁoçuÌÔ%ý¬žGÐúû¬ß^nÊŸÙ€`[s¿H;‚¥#x‡cVƒú:¨\nÅk†SRôc'A›#ºÊnX”|JìÐ’Õš’P-#ÒÒgÉ¡ÿpêRaHUÄìÊhÚãJ…ØÕ†¦¸»¦æöï¿°ãË‘™ +ðšØ®ev©²í9/C­N–N×µêèDÕúŠø³×K_ÎgÉgpîß’Q„?ëõNäð˜7žÁˆhŽÂÒ€œÀ3†é¡äÀ;ÔÎú²™ÎÕ¯Oø% ë± õŠN§¨õE§IԌĘ£Æ€`‘¸ŒO³Ü0YUÿ(vkºMʳK×g»gâ=ÛMN^,ɲCj—,|­ce£{i0<Žé>Š 8ü{e0Úçj÷2™Õ%˜aËÔvpRO@Dÿݱ szÜØÿ—$‡TçÙlP#™tÐ<æzàŃhT-š{‡>ܲ¿¹rt‚ï¨GÕ49 ¡oÎW 9)t™0·¼ÿë ®6|Q­Ãî×8› †u6n5A]d\ü’zD{íˆÛ¥œ<†g°…­v„xZݨ%†“<ß­ v´7ÕäÞUFÌxyf@Áq-,w–ßX­š1`K5œýÓË…]dÊŸ“2ñ‹0OÓë‘|g‘‹\Mk“@™H³ 3vˆ}ôö†i뉩—ðÏÒþʸ- Œ +çM±ä¨º½ÌçÖïeÌIP1†Áj„0—(ïxÿ]•ìþ.K¹^…Ü^S<+1:ŒŠêzô-wßq#ñtÉö7£6£Wª¢û ó–FâNÀ~b!^, ·LÀ§CÙQRãÍóTêžO}}ãÃ. n5/mñp»ÂÃÈQÈvà`<÷ úØ[¿±“Ű›èРP¡ø‹ z>©«,M6qÞh~”Ð*Š ¬T-¼¾˜ Ó(îPUBé–àZf~Åžn;‹!R³înâÉ“(ÔQ m \,k@e‚M‡Á1ÃR ¾ÄD‡ÿ:]ZYÃb›G"I:L¥¹LŒ2~úÕdhAä¥ + +?å >Å×9œhÆ æŽÞ(Ǹ‰ME„t3‡›\´€´²á]É„ÃÍš1ÀÁ—%ÔAƺ+l¤…úmqédÁ‰®&úÛÉADäöź,ÊY**G¶ìÙØÝyÌ vïáZ´ò›,2fñ*ï'wµó\püøôñ{VbœOæ¶-Vèÿ¶½.¶ôa¦ÌªNDþÈ ¢´Öõȵ¨¢zptG"ÑmyðXó ël%’¼íWøl o¦¡¸)¸Êá¬E‹ì^CuæÔr† ë]EfzXê’})Ä:8öÃYoùÄ:&œhösZtC‘F³µžÚ8V{IüÁ£Çì$ +ò‘Çìr¸v+…\ü&[8NBßJ®{‡3’«0 ‚d'ÝÇù6-×;~WZ=-ã3ÓmÑg¥ïÇ 9eÂðFiµÁ’½Ü-š„5HS"ÔÜ(?c]@õÍ0X‰ˆ'†‘7¢"Ì d¤k ÿ@ïÔ•܆ôͪZ•TãÖcŽêÛÄjbxÀ{g†HÛWžq»°ç|§zÍ0¸Ü)êvÊP3l9¡k¶ÿ2 ÐÓTàNYõ*(,¤xV•ã|í‡è†ù +ùYòzx|ðF‘ÍQÅI„÷²4 û:uí!gvëQ$šN’&Q¶œMÑÐUb1‰&`'b¥g"ÚBjsi]æ¦e¶Ÿspìú%¸2r‹ 2ÔªÜ,G!ØͺpøÔ6Êp\>Šw$þá–ƒxIV2j Ù׃ aEF8ëQ*±¶DW‰±eÕ™Ÿ•>ÚoÙ/8?€ïñÑ’ÌPBlÞ†£¹´/lžM{æõÐôv«Š"gT°µqzP}v>6)wÖ<Ä\<$ÿ'½Ðõù +ûÅŽÍܾ#\@t¤y©Wò¹#–Ÿw5‚‹•ݲs—Lm¡YEJà3Ï g­[® Äå.ñ±IÇjâè<Ðh¥¤m™†5ëÊk[Ë™«AÙ’*¢Ì¦-e0m)£Ñ™†ú—5 WäcràžZsˆpäL þ‚q¢ÙY8ZMø‚xEúlpDîÑ{–!Þ;äÐ 9iÛè|ú- j;¦ûq k²<á ÞmÈè}u³Õ©ñ +„¬ypùÒADü Óo™©>?ÂQáJHg9}Ì’À8鸨l ÿ§–š©:6~Ø5ŸœÀô ã`®ûM&&4‰×90?y[V#ÅÝ¿CÊó<^NF,àatÄ.¥¸ÙßÉÊS¾WÄÑR„éˆùýä̼Á5Üð}É#¢±Þ6ÁÜc.Ô—Ë£ª'Î(žÇàÈåý¦y¸æZ~‡¨dq©/¶ RÍ[X89y3Ã>×}—áä# è]”KÁåUöÕ Áà(µ Ü›‰}òûí` Ôi§ã…Û*D9¿ø×„tQ†#ÏzμT=|˜^scØ73¬£x0n)¯YN²vÄg‡C +‰ ™\Sƒðë!¹?Њ¦‚Ý<÷7[ÀdsÀOåz!Ríþæ·ÅŠÞ‚&³ªõ•Y ­/¸2VȽ,Bû¼š~À»%ŠsXT{]k–R‘ßš&úBù$']¾ó3" Ôk ¡çƒ|¸¼ÙÛöÀ÷üw å¾MÄÃ{Àñþ°Àêó¨sÝþdøaZrqW^šÕHíp'³3‰ñÚZHuìbU•Ü.ºì[1q»ÅÁ§ä©Ï=œ©Z_¬ÔVPÙ§"„vÝx$φÆÓöIq»˜!¾8ÿzH÷eÏI¨ÏÊÈÃwã'?ñy¨ùfYèÉéBAã¼Í ÷HDÊYšJ&†Ü8Ú>ìB­ ¼j5œN47£Clq„‰E +ÀuU0_¨ÂW‰LŸÜWNª"´.§°úçD5ÿü™‚0\©Ó«c܅ᶉnXø[­©4ÂX~–Ÿ.¡ÿìrÇ uHm.fgUŸ¤(¸–н˜‡br1;s; So¦lfËø`†ÖUJß LÂÌ Ün*5žhÖźã”±‘I%¦‰¯Kg®$x Pêò¶”„Ç)¸ +™wÍm +gž¢e:"¶”GhÊñpªL§!~õûÕ§:Þ-ÞÅ•Ðû!šæÈXmššÅt)1ë\#-cVªœ_$º£/tÕ寷õé”ðòF8®Lý43‡\$&Ê‹Jì#ÆZËU;ŽÝT>BuÛÅS[iÈL²šŸÝÌÔ ÑdȬu'ËJªn¹2M“:.š«:íÃZ‘îÍB$#ÖmËHC§ ‰oUvª¬Bëë84F‘;ç%ÿKrúŽ:®“²_¿Xz’RýÅâeJRžŠÊ¬ZFB‹Ç¶ªÐ‰ÍYioitB§˜Tº×±4*F(5"©Æ–!ñtŠæ¨ÃŽØ”C¬áiŽäU±òPÕÈM¤"{/—ó~ž*š@d0w,S绋ˆ˜Ó!¢©‰Ù;7Tc#EÛÜ„×!ß™‰¼"K…W5Ô!Z8ž—]ñÙ¹$ ¥ŽŽÆí$ÙE£ÓÑÌY®0\\ï2¥»òÈ•3ÇK)çæädä .„­§+»ÓÐoÉÐÐ8û†‹1Rn£ý=1Ö½g¢õÆÄ—›­GoÍ‘kïKDÒÒHíS%µañJŒ„¯WsD2dû ñì +"ǬÈÊL¸Žªäüð=“d~˜ÔˆU‡P`AgÔɬtØw=¡Üst™TË‚ +#> øA2 ‚Ø ‚‚,2p`† 0„`‘A2È›ÁÊ W*Œ`,D8 .`á +>Ðâ°E5\ÀBÄÏ¢-`ƒp”4\ÀàÁâ9œ $ð€ˆð`Øâ@A8¤0A‰FtM`¢+°‚@h¸€ÁƒØ…ûPÁ ƒD‡ˆ@ 4t8Á$¨ðˆ@ p‚†x8á‚*Tà …„€àC œQBÅ ¨˜Eh8¸ Eˆ(ÑÁ¬Ð ,à†Â XáPÐ<@@.(Q!¢´à!< “`N”AðLa…ºDˆ +éÀC!8Tˆ +9! ,lPBEh¡ƒƒD¤ˆx xHáÈ…xa#Œ ,TÈc0‚8Ѐpø´àaC,à"ph )D0bÀ€Œ@>$àP>@0 +TX$À\A`‚T<àÀ3#ÂFx€€SZ4”àÀ$ Dïà!¼+hˆR˜¸h , <€Ž#:p8€…Xô8!Á„p“`B…„‚ ‚%ã„ rB¨`-tPÓ€ ða €À„‚E 6@Á¡p:8`œ0Bƒ( $@pàÄDp‚䄆 *2à`\À‡ +8¨£=A f *„!¬ÐA% † *ÀÀ z¢D…xøˆ” JX”¨ +PÂ0Àƒˆ (!!*ä"s€ŠP¡‚" ŒÀ¡Ä P€ %¨Â!,¨à ÃÁD( 0 0€† ."(a9@ < Á‚ + 0< ¢ƒS¢bˆAB&ˆpÄ +p°`N€`¡+@`.`ha”0bXP‚ +¸ D0P‘¢#JP…R@:´p•€(1”° á†¦)©Ëo˜Pñ¨fÃlóëFö²G®ÎæèÆÚuU’)…æä´«¡z<2¬#,M]¨dììã+¡Öcv}éŠ>6f$÷9¿:S IŽ|gÔ”unÙ¼Töø¹{å$÷+e›„½ØÂº_môšõæ¬pîu›’—L©ôõòê%Tt‘ª4}HD¼’gj)èØ2‰UsVŸuË…¬ìbê {lò[Ã9OqT™êW¥w–+yYƒì#«"šÊÜ 2íŠtTã ŒÍU-e¦çÄN&r¦‹$ÿbM¬„¬$5C[†Ý1•SÑWÅöbvgª„è[jNnØr¦vij÷·suL|¡)ú°­yÇþ¥C'æœõlô»jYÇIÆÊcÏißÇ}ô¸YfS=™¢š3T%C43m¦ ’’Ñ¡õêsdnRï8Oë*ËdØÅÖe íÛîŠ<Äaé¸Ônã1ùXrE»NJc>#›wòJk>L)×7$¢a;·2÷˜Æ_õŽùföÜk*·jý„ȧ‘µ—•éÔ¢âXŒæêÜqº)³"Ç­dÜnøæ%㯆él¡ÚÝê·MñÔµ™´&;fåÅ#ÏùHb*þϨºßÌìÎÒ{e§ëÚ(©N[óùɨWî¡Íš[{ÓÐíòí,¥RícVƒHLŽŠÄÈA¼«—ˆBFí•ë½±×°ü»='²[Föèé53n¿†Š*GÂRÆOä´¶ó¶&¯Îhxæ¦iI½Dó±:ß>ÖÃV9«-¶Û£¹G†¯'"þD¿KcGu—óQj\C»¢òù1V¡ÚÏŒÆt_:3âw Íɽخ2¥mæì¨–‹b!³ö½:Þ¤äb7ú‘¡S#7Ý>DFÖÅ6W1 M¡R¦ó:*"S¼Ž6ºxæfFR’##WE‹ fæùÆÜ5Ö) Sd~ˆh„. ã«23Rt/ªø.uvQö7ÕžJÞ¹Ù“XN†æ¿afpN\hÆay)ý}Û© «ÖsM[“¹LhL¦™yŒRßõG¼Ü-¤oª<%Ù\o¥«Ër?ÝFC|RýâópÌ\þ3Ž^§xùu"ö+FSG¯¯æJû²·ÆÌåŸ|Òsû€ÏkØér¶+–&5º¢9ßû1?WÜ0T ÑÝ™®¤>bƒob}CËÙ«0T ƒ±îNä̆âÏëUô™”‘Nndæ„>_,Å‹ßê§‹Â1²³,Öل׎±þÌÈ´)ÿ‘†\öÊIÓtµ‡T2™°§ÍuüÖÏ¥¢Í)‡Ä!_<6_À€b\5±/¨lOìW,µ&÷«Ü­[•_À€‚C‹ÏEWImòw>еèRÑ>&öå¤ÒZ»A$scráã¥T'9Òm5æü®ò¢°ô¨†~Säªè%ÖÛ:DäÜl¼°ñGsD3é.f_1žür§FFƆƊ̪ňØr\çrdO×A‘ª¢"Ñ•ÈÕî°³Ü?gbs$ŸÖ)­'³´¬,¿E‰4H¡º1îÌVs1㎖댑tFSyVc\ù˜k|˸nv kø2’߆JefDž©’U^¶Ô¢1¾×•mŒÏÄ,¾[.üœ¦n +âûfðC$$¯ººäªHý0»:¹ë +; •è§žeœëLFÍ%¯ç‹7¡éØŒ•F§Éyº±ºúkâ³îÕ¡´«¹Ü0ßXkÚßݵÓ{‹HU­ÉHk†"­¹Ò"Ãìf~%¯oÌ3ÊæÏÞÑèTåÞë,Fç2••¥ŸQæme—YbFÛIC‰Sù'*2ÓlZh:tw™)ÄÕ:’xv&ÈH4Ÿ~V3Œ¤c¥mj%SkjU97U'vD¥§èoTm¼'2L8¾¼æ³ª31IªŽf¤îJU!NÇ®¢š¡“¸®úIfÏ8‹§d¬ªã\wt e\mžä$ô1o—\žÎæŒj/šaGs:²Äegûjš³±’W•”½ê$´»¤Êͨιó¢;ª•ì¦×+4u‡¤öºÒ¶!ù¦Ø8—ü,ŠÏ¹ùñ5sÞåWó²×&Õøÿºäv±ríz­—ôGˆˆ%zß"™ñ[Ù%TÅ›Ê=é™]U툔K‘çää•HoÃïïê® õ­9eÐë™ëÕ’d6ÊOa¿ß´¾µñß͆ü®ã¸ ÉÞ¹:‘Þ¬$Öó~£bRóÎHÊŽÅa~ŒD3 Y™Žc,èZ^±Ë«ômQSU/#Ur~I7è3÷¯ šNGƒþKÌ-Mª2†•1“ëjfˆl¹ñªì†ÇÊ-7ÚÎS³“ƒ–±ûÝmªŒî eZbçA×§l×}?{J¡¹\–›±©MƒþÍJ<KÇ +qJ眘§õÖµ˜Õ´ŠÙ5t+ÇœRxn¬’ÒÊq>ët…F"¯IÏø!ét7¡åSšc +‹ªsÜáK³_ŸÒäWìÈè~ÎëK±g·Uµ,=3홇J~%w ‡hw·óðrVds4^xÓÝ•}Ø¥ôü«1תÔᲞIjÅ©1 +™È4g³å%6FNuºÒ˜S‘ÇêéM)«uÌL‘f2æ¶¹ž¥zº?¶üÎÊט5ª›šÆhÄ„¥­¨n°NÓ–Lklh™Ði°^‘ûˆGH÷]*!ÇÕ"Ÿ´­!õ¢TëzSñe¼¥z÷ }°L–VMf¦.r4”Ö°%ƒ%7¬~®®VDzÙ±$žÁk­UrIFĬ*3R™/#×ÌJê>aO!;#žPmš?O =2صD7ÄE÷æµÆŽ:.û¥*äÉ¿6GækhÞck/wÜíªêîF’knbáÔ •wn=ÇSÈsrãÆ¤ãJ:wíIÆ©HÆÚq6±âɉQ„ã<Ì#d–¢™§3u÷’a%ÖßùË0¡^ÉéµF¹"D5¿«£\ÓŽ²‘™˜ ²…6%!i99 eÆBó2_Û¸o†ÈÕ™Ù&~ÜC×ݾ㌻èîi'&DÙbú,8NQs†ùÆUûF/}qEß87ý¤(בimhg¾QzÊÕª­L³»ÏpÉ[òâÉ¡ägÏ埯»Ó,Ö£]Êå¨NäÆ ÙÿzKD.¡]n<Ùª>ì÷øãÔE¥žQ„HC¡ûÕV+oG먈'©™Ú¾]×Ññü^éÑv…ï”=Ê–L´ñ š‡(w}Ñu¥±Š%e£"ÆÛlué\­M‘Êõ’·íŒý*diŸ¢C"ö™£ŽnW©…Lí×äªë$S'DCWÆúä\ë¼U³—E¤¤ŒŽÎKgzu)þ›š“²Î=¾l%F¢!Õ¾2VœòI®uªß2Ÿç¿˜]Wlo߯Üëú:;s•~¯®sÅZÒ_Œ&9ŽWïP]ñêRvCVÕ[Ë©Õpµ-zM É´DXÄÞɇ=\V’¹¿ WËçgÊ£ÏE¤#ãi‡66ªÒ>wähõWÕ1þÎ,¯?¹•Ь–¯“‰ÛŽ.dœši^F=žìöºŸœæj¤,¡+É«Zó!Eñ²üR2V•Sæî%­ŽmFño”§¼Ïi%ÓÊÙ²£‘")e®¬ ¿•·m“¢JûE +ïÚúdÞ«(þ-¥!§Káï~8ò™¡òÓ?MÏbw×Ü#žŠÙFeؾ̆f¾¬|•Rjnì:*3¡9GEd8$×NQ/¤²gZ7(V!gêë¬.””y?w ÙehPææÊЭ_çÂzU^£j¥†¯Ó²>#çØeì §|‘»œÈ!2#Ç㼤-Ußš›û™\ãH+F6㨌êRïôŽ"$"÷šv¤L<´¹ÔMÙÇñjêáÑô¼©‹P¦L3eÿÝÔÕT:¾ÈÇWUÕ1¹³*eì{j·R]o:%eKf¬,ÃZ¬úYÅN©ß¸6+"ª‹“¤Ó”ÕXk4$Fccå ©g=Óš¥|Û MsÊÓ“Í[y|¡#óøWÊZF¼PYgÆfå‰õÓàgÌgmm–´U—”X‘ey÷¹«}x<ËÇË,£²mvc•ßùêÆÇd\ȶþu\×ËV¦¡ÓæãŸ"¨¤e™G%dE’(Sp dR±@QSÐ)~B",  + (2DV“%1‡Œ@ Àɶd’6SÒ´=ñ¤!7fQí¢+“Å/]”1ÃDò—ã©(ÀâãÉÐÔýB¡…µ¸CnëíaɽVàóæŠðl´“@“܈Yôͱà%èa,™ˆ·¼Û8q‚´ ™h>®lÞ]ùH°D·þø»§%}3LÑ`Bk?å_a–EÌEÀpY„)»ä)†Œ¼'´Bò^ò_œIöÎËüÔAû´D¦,4ÈC æó}d2<ÊV·¼š£>xO€•%° ñ€Å¸¥38‚QA!𹇠 l…Áì˶n êØ +!šq´B+•f¹——Rß¡†­/#ˆ¼Á©I<=°Û +>é²:Kø›`E£|&Žˆopž$÷B·¦ZqSßøà&Ëa”­àD—bwê7)M‡­Px‚åÙ4^!3 3ÔŠüÂz‚v»K­–]F pÔ®UÜ æGOèÝüŠ]†Âq¦Ër…Y°KØ3ÍSu;Rs® Ör “©“*xEK‚ìcXÊW§& ‰Åy¡ru»õ»t{\ ž ±Á™`+¶rns¡|U. ýç +%½G¤çIêÉI¡¿±¯k‚Á¤ä +æH0yÒ”¾N iâ+ Ë* ¸˜GúySðË+B!íÒû/’6Lrö–§mÛ¿Ý(|ĪյžüR Kù¼$Š¿òw©Xåa—8èÄ/'|šî~„²ÙAÐGü‘§5V±FW½ÞÆRJ~W*=OSYO<Æö,ž®m°)7ƒ†çt×]ÈTþDÇâ§Ug»ÝΡ§ ·£AÑF¿¿ÌÙL3šL¼Rs⊠PJWIÖuBÏÆ±/1!ÇŒ8!JÙ4g·®1Dî¿‹]9úWé„ÊR:/%DÃK¼Òü!ÔÌp5"ERnÌ`ÓÌ@BÄ9”xÛ¾0Ui =D§Ž>Sœ±Þ™òÄÖÄX”u,rÐA­/¦VS.rØ,¶~à{|/mâB'|¾/LZÈ( -s3b:Øt@B‘e3‘*±d,˪öýLáêyýMÞÍ‚¾@ØQe-åHé8f +<üM$¹9Û*y¡çƒÙOȵª/âÞ-17RŠ!•€Ö¤`¬nIDÆiøà œ¢m@»úüéL$‹ôùá|Æ™æ\§1² Q€jç†i+õô.<‹ðf4ûkh1& +Hñ¶ÛS1w_sN×åy®†ÌÈ1•ÃEL]rHí(ú ÀÖŠø÷ÓI+à@ñ>†š‚Iô7·¡>“¸~O,M:|­4óë7ø0°æŒ#K‰±.z‰3î¤ödªW¤+ߥ\¬®h?‚EíD¼¨Z²,¥´KÒ,ºŠóÞ W@²GÓùìá0ÞÜrÿ_´[Y•9ŒNÁEIÝ´:íØˆH'±l¨ðÀŠsehŒõ;u t”“åHyx†®ø!˜[@œ€'–(€Ðjh¤$,¨¿ÀŠÀ0 +¯ÿÄK"–çÜ«ê£gÑ(4‰Õ¾N†ã¤Dû(¤)Ó½Ñì @厄çù )FˆÀ|=AËNMpA8ÄæXÂ0•ó#S_°˜~Íl¸¢•^³¡? Oy .ãˆ#%\¢xiiðÁ7…"ðº" YI^&™†§ÍÖ.“âèr“L}¾7¹í +½ð"Õ@ªÛ+R þpW?± +0±a«BN¤ä¦í·iCf±#MVhÅ3>ñfÄ‹ŠéV:£2ñc€E©Xÿf¢)â°ÉN¬d¤7<$Q˜@‹˜<×þ?EÃ÷÷ç2z‹%8>KrѾ +Ç@Fs dIbÅÞyz2€2Á µö|1“jJÐü©ŒAªcJY,JÒN{,» ²³üºœ%¦Š~$ Îa]*9Z +;q‡>‘3C¾É„POëH-…¡É‚øêÅ®ËÄî¡c/éš­ ü­0A1¥"4°T@gL2X?¨ÕwE°›æ?=û-螌p…áÕæç!„Yœ³=Ðöà26×ø-LJö–FålIÒ~‚ðT¸¡ äÝùZ¦ânèŒÉ}.êÖ sðÇœ›ÿ˜½b¡‹óÖV +H­ºñi4TNŠ?j7çÖ±RRuLuhx¦ÒÞ°î'¶¢ŒG?1‚zXÿÔ;‰)LÌ?X;t’ÁªR¬¤º^ ¸ósà¸à#!Fü¿F9Êè²JFpU×ö +01N:…e‚ ={ºƒ`ÍÖ0'îg… +koçRvb¡8¥Ü?ˆ;Ú ŽÔYVH- +,T r'Ë¢YÜQ +ƃA1ý3§K·3Úºü=54è{?äЂÃ>½…_ž‘òÍû +>ÖS˜DB²ßâ(ÅÒ»*sv -æ­&&ŽY»)zhìŽ>´Dà8è%î°•ÏÛŠf-¢átcÂU-Ôÿéí\4}¢¦æÉªÒÆÐ´NP¦`Cx 'Ã|>›¨Æ=3‰ÍÃwub'Ý£O®#ðˆ§Q9¹ƒn['ÖE¦JZ.B©m²â$jìÁ 6\·{׳‚Ç!]“§ £êƒñ‰¡|-ä‚*œÍÂ’y•³s5Rc¶pn™OÉB£_e c2Äòý§ÐGR\+{ÚP¬Pdða5NHwHÁüø–A>–´R³ôâO€ˆcþàL­nŒG´Ùî t‘ºµÂÚFRš´„´Õ9ý4á9KuÚÏ’ëfZ0†°ºî\ùÐU´™µÒ5¶ü£:ÆÏ壈qØ!,¼?a³S$«BÿHi‹øìgªÙ[ÀX·NÕgL»©…yÊ?šcÛŸçê–ð#ŒbAuùè…§ˆÞÀc{ëÕv ô±i!y(É­>¨¥èeh® 9‰Br€ö óŸ +i 3Þñ< wg"-PøÃO:Öß|h£màN•á³þ“j/³‹ þÂ=æÝ”$exD×A5hbƒj3p?jèÖ_j?­(ß jFþ#¿ü§›ü§j=Ö)ÃOµÏ`™v«½Juäáæ‡¡üß ò†cAÈFR¾V;o•12Ï IïÙ°Ñjb¤Ô›¸%Ò‡V]«$c;H RóË*†íëgÓB0„µ#—¬ÃL0á¦I8càÑgZ'¸_ÑQ‰FÚC¤bp%]¯O¦}‰eâˆô´¹÷µ9¡% VàNá…‰¯­µôµclôüÚ +;ÏÙ¸/ ¿nÜ”:z!?ƒú2r:JÀg×iè‘öm’*ƒ»ˆò4œ¿l-Ë]Ý1Œzܾ"@ΜFE}JîÊdøô p¤ª†“®yáè}óÏgÚZÎÂ6ɶðáØââÀ€Û˜ª–vgdÑ‚Ùg-š Éòô"É!ã»Ûê„÷5H¶‰APÓÐ…t:¬^Z*ªI³‹ÑѶêÍ'òzH×¥ÃéjNQºãGJ´Ó§»´=æ±ð(Á›ÎŽ]ú›[Ñž”·©;™Î…Hù#`¸ŽF%ܬeU +x4‚6^w)-J…o8sÉëÕ×2h·ÅÎ@ùÓÉ¢Æso530=ðB4É3C΃Ô;©ˆQ$Ⱥ +°}j*óžÛXð=c›Œod#U5é‚ ®n{ó ä7wÝ+–Ç¥;ÆøiÓhδ4º‘ÑÜö ú£ât?ËmxÍ\Ħ©hŒÆe‰›¯,#4¶b)€aN;Ì Aé]C"‘za´Ma‰€eç“Õ·ÝfRô³2ivAxŠæAg,€¨ðb0ÓÂZâ$usFð«[ËNn?‚RàÜSë%²ßê¡zÒâô®˜QxzhQ&TJ¨†‘A ±$ŽŠÑRhzvrËØœõ@*x‰r‘.úüð”h$ û%c}ln-ïÍ|~n¹ªéè6‹+­½‹IÁ3n†I6-(iÀÉý¦w@·CBºµº·†ƒ.}CYÎYÍ€}¼ã¶R /h^ÞÙ²å‰(Åz¡fˆ>W"\5F»Îõ¦² pí™þ#•ˆcÂ#…Ú2+Úvƒi€.¤ Qçç´Ë¨ÃZcÏS’åõ –0Ì=—yrŽ uãý#By6Úµ0E è"D&ýäüÅGðQF`¤†Å’WÉBEþ«+§©7.ˆÐ†)í°*Ú¸=cbË/µx¨§ÊæÎèRÜ%´™K,«ò!ðf4 '?TáœüðÄ"Û6bí‚ÛÎKJ:Òû@}•éG 9QŒŠZ¯€Äádªhîó"ÅíëEèK1ÍOÉ}‹ŒQ0õÝX‰#"ûP¸UÄ^t! +»á§w€i–Š``¦ES]W|°`•—W…ªVå{E•3¹‚K*½LÛßNò9+ ñ”~¾ÐQ²ZË2 +œYíúîhþPBЙî±+^z°·!Œ°òUs(‰^ï¢ú‰» +zŸ ‹)€â’LVØöŠ7ºžUÿÌ:Êc"Pù»y¿ägn”—CšeŠ,x‡à¤¦²ÆC}† 9ĤUT‡dÉõ Òݪ†Á0ÀCÐsgÃ$–F74)84\~¼8„DÉîÕ‰3“˜·„iw}O°ÛÄïX P´Ií‹jÀû:»!³©”iÂÝ|Å5R´ù EA0´¾´)•a¦W`~?ÁÂNNÞYÞ½æ5¥màǤ’m]kt1-Ê~pÇØ×`®g”η+–Ø*úŽ{Ð2XýÎ׈KÜЗÃ`!™[B +”Hbý\-²ÂНÂ7‰á±àÇ—Aiá3¢ÁNÈu!f#A°œ‚!›cr1¾æ{!ÜBùÈá·¤h™§*³qÞYNBÌÑ¥CE¹u+ )2Y(—‘Ü':ýî†3“•î&± ½‹xÍOÏÛ§ *9NnE„z ¹5L(m.6ÍtGœ§s–¡mŠ!U\¬Oè*:’X, š~‡ÖŸ®EÕM®ç‚b•Ô‰dˆxzØ´=ã0åÒèhçÈc,qDÄÆ–cÉ\?ådó»ï§îgùôÙ!­ÇW±‹Zí#¹ H:³Íƒe÷>–¼—N% ’ €cd—˜6"l¥ß.#”Ëúžÿú†˜ŠóΡðbeK(Ð=&–ùw•»PKªMÛö«Whöó¬ K~®“HwŸ5ð«Ô©;¤»ƒãÅÏôÓØK!0ÉV{A¨‹Í‹L1£pgí‹ð4ÇØ\`9?L‚¾¼SÞ:éFÕÉ3ôzy·gòi›–™õ^$%ÆÝŠ˜÷JQÒÀ”ÆŠœ±ºBÁ¤ã÷H¥eB"²'O Bl =ûb YJz‹‘ñ±Ô¢$ÐkKh ¢ÒgÝÎæªÀé]Ó³žbØ‚Cƒµr;%¼œ +{IYÒáîÏ0-µÍ`¥vK©€Nj) Ií Kh &Õ@„¾IŠ©eâÂsŒêeÕ$BFºûk€àHûrspä³AˆYZŠ)²É…[ûÙ™Ÿ`È6¹ò˜•®î‚¨«tZ3³ ˆŒZŸN–BÌàÖ.QûÞçÿ¤Öå&GÁFOÝø\ K`GlÅÒ Ú.þ"͈~Ô6¼iÔ«.c¡DÏr ¢ë:þHÈÊ.¼oûi®g¤æN¥±a»+u ÞœìHI%zŽß¶®…&…wI5@¹þB„`R·R›æŽ…ñ“ €scÂG”ŽºŠ_¼REÂIÇÜÈ)}É‹`ލóC,Æùiqu*È0$©ßØøËCs³”³Eðžrû|`T–P¶hÌ[‡Âþ`Õ(2AcÂÀÍ€&³ˆ[ÏEž2™ü²Ÿ­ƒîu!´E¸ëóÞIMÍEâÁA@F¤#æüƒþMj2Q&u‰Ÿ3ðŽŒòežûE$´H4H͘PÍÂI@ªwÝa;1Zƒ˜•W­! 6yÓÙJ´_j ¦°B 7»‰HÉ5Óüø1?f³su˜\ÇOXhtQÅÞF< ÚnŒxãç…¢ðZ$G +eB§³FÉÐ\b7þnÉ+§Ï8»töš(HH0Éú"¸~nΦ+5â¬Ù«àâQsKmÎO}¦ßî“$ˆQB * {í;5€}yŽ¡Aei”Czú­ÎB:vUÁ—§_xÏq„Ê,p\\)¥iÿ…ìªiŠ&½ã÷,_n´›è´Xâµ5‚G¨Þ2 +ÀX’Ô‘0²q–Þ(’Y&q¨Ñ/³÷DT¬ô©Z!{Ó„²j ª¦ücUÙ”&ÚF ǽ%O‡ë¢Iy£–ΨâÝ­áDG£z,A +Nïæ(/r–¹…7饅¢pm¼ÉISºø”1Z¡î‰†åÓ—MSà§Å?7lª‰s7pï#5¥ûñt>úO‘—ˆw–ÇÕ±Ó˜ª>MZkg +tR+u™†)“iP¼ÌOU@MM‘*§Ð[Þ³5F è"~?¼„i1\!é6Ò;Hc)2 wúÓ¤’*¸nef¨ +¿­T¡ìȨ¥ÉaÝTgkNOc×øË2¯ÙgŒÛµøˆÅØ–ÓE ’Ø`‹¡ç‚uÃH!ÈkQ‘¹Ôu³¬ ˆ_¶±×ý×ÁÛvÙò¢!ÿ›z§4!Ì™ÖQÎß%z²h¹ˆðó‡‰.Ú c^„`©ÌéQ:âðG±„ÿœôR)Î-9E°åÎÆu$…oþÑêzý£ÛÚâ“BM'Žs{†Ó¢å†”˜_ΛÑ!žX™Š¨ö¹¯J± J.måãÅp‰)ÖÎ ã~z•Õð½b:kXóì“ÁÝ _=Š lƒ±Ô_K°‡b’(A€Q¶áS€‰Úô±ºø½E1—4Km`ƒÇ/Q±?,Ö¿y¶ótxÖK +0ÉaD‰6 +FúˆLrÿþ¬2þU[ð± Ä|œ]Ù8UžD¾©É~ú¯Jš¾VAl†IF6vl—p‡ØS`×b>äÓÙG)Ù]M–ðÞÇ„6ÖçMC»ÇÀ›é…Í…&ËKKwŠ]$žWœ5Љ;ñ³»îæÛoH:žs +¾&ããû9`³X_õh1<íc&g¼…Š>(ÜK;©3Ùd%1H X((ÄsžN€ŽÄw91ª¢Â;³"ªHn\B¨¬SÛ 4 ¾Ë²ÈÀR«h}›A ¤<'YòØÅÓ•†…$ªÆ÷Ϊýã}Ýï-æJËAZû‚¶tœ¼¬/ü!Ò ª[\¸˜@˜”J—ö*Ì”EÝSV&HÅ駪=ó`ÏÿóŸ?‚¡@IÓí2ŽK ¨”ÙUõ[±›è.óvÜCõÌã¦|cŠF¶[¡¬Ë*ÅžA{ -ûRa­W#¿>OÃË—]M„¡ƒO>×e öýS$å¾QÄ(3Ò—×þ‘Lÿ +âXo¿éãd¨ï‹cZ—ã4|¾¡W—‡¸îê bN?ÂûÉYyÔLfœÎ÷gÐÎJï@O™eƒ@ Äüb@ë2‚?ˆyð7ÞøGˆ‘ ÷ +.I1]ŠÒËÈkÑÑÊ„6OásÂÀ”\‘QÞâZóÜorAú0W´§8ý‡q‘BLä !½|—°øy’ñd¸léÀ¿mPj¡jRûsÁ2Í«ÞõâP%à‰´ºJLìÏDæ^ÛôiÇl¼OÈß3†öÆé~#16Mw`iÀ`ûæ—Pk±[>#ÜyKa%«§ÖÈ.>4êDóým˜ $MSÓ² FËѲ1¬%„ƿ焛nKÙÅÝÄÄ 7‹Wò“€¥´`åœk¦JμÇäŠA¥cˆòRª~ÞAí˜Éc„qµpµžÁ\ö4ê[À¦MC·J6Õ¯µ>ƒ( P¹’rC`#ò:@Ê¡§,áT‰ÄIa*|RQ3l õá„t€© aHpM_¹lÁéügcÂA«ßgrcª „KÔ^²#V=©?ä ³_Eº ê%¼!½f#XdÙ7@#ò‰\BÀ „€DÒ!h@ET©(gŠ[q$DŽŒõ–¶€þaÂè]×¢B´AÛºG¹מ×vAÍ@Ë©èÙ}­ÔšøpŸ”›€Œ€%,ÏPD(áÇ)Ù‡Ü]A(Ïþ‰W …äF‹MÙ!.H("¾ÄÓ4\I”ÊÝ‹dÓÆNh­jZzuGzzä4³²lWÖ¤ ¢ù? 1Éx*A?› Ž:$ ½_¬Jb¹p­ÕzAqúü.K˜ÊBzMKÞÓ>#ÊÅDRš¨…Òi¼´/ãŽéÄu]Ÿ æ‹cZß4º…´¿¨#¶Ü1Ö¯¤8©‚)ˆá2 +Æ@™J´¿-Zóæâ§€ŽÐtA¤d×9)$EÐe5ÇE9QÎþ~Äd'½¼TÚ7ã‰ï!|1o2ö픃v7½Ñ1äÍåH¼çM[QG°Bóq1ô¹Ë ž–ôÐÇA]ôìð¨ýÍÖ€ÿ0>³¸Dì¸e]¤D0«Ø ”³è2p-g1®Sl€oüþ­”S«Ù5Šñ€Geñ“r¹‚¬]ǧãÍoÖ)ŠòI7˜Pĵ>ô“…¾fZô°×KA†šXÛ\]?î€"ÛqK|HÞ&6NcÈõP^[fF&bFžŠ¤·‰Ûò`%FžòHàœŸ{½h4¿àšœ@äC¢¯Ô” ÎÏ6»sO‡î$D…ÔÎ §ãkœhF>ÁÇ<|¢´ø°‹á?"r4ÍXªìmáDA:Cl;ù‚C¤ ´qiw# “WÓé¼ {=*n³#"Üî”Î.S|¸Œ<ò¬Ãlµ+¾‰Ñ±„ó?FR™ú;"‘Û8ÒÃȽ\aì®ÉŸ+€ÿàüúSù£,¥Ð@ º‹ÿÊ9ìycŸÿìsž²æì²q•” ÐèÒù°ô³ž×f{¡ý­cÅè÷´îs‘4YüDJÉ_Ü.#ÎL>Ê+—]cŒK¨®VÔï˜KWÄ —҈ЪvS0ŠIR` À#:`­ž RÆÆL¨6Áú$]ÆV|ö,¶ ÜpP5\H%ä… LZE&ÝærPßÙ¼CosL4Þ¹¢dIñ‹Ãýцo'šR^”õ=¡Ó6}~SùªQ‚á! +[…¨LÍߌw¶ÒðO$ ü1ÆxEp.:æ!¢­"~4ÂÓè$26Rg†]#B‰×GAÑyÖ˜w–=!=躂=íßTLŠè˜¹ ÃÁ#¯›Ê8¨Síøe ¥ó¯ß3¯¨bV–öÿ“§s¾ÞÜ} íIÎ¥Òð[OZ,ÑÓ{7ŒõP¯" ³÷Fèn3ùÓR¯ZèCÛè0…E½,žbGdÖSÙ¿ˆ6_žöب6íK˜Evۆ뱅{„ñ/÷Ò-$n&•iô)åÄhpš´‚?§Ì-5bÞ:¬…«äçÀеƒÊ3ñ À¶º[Ë£%Ãä–½GħIn¨g]Sqý☹kò]ºá0%iU«R¬6MòÛBNÝ7¤SøoøQýkñ’³Q/A”oV¿ ôtàLéŸO$tCq ÉXûmŽTG½^øÉdZµ¸U)"Ø÷’æµ&:?Ò—l’,>ð dzŸ9Uѯ²¥"dI’ßõ'Ôîü™Ý¾¶·r;ƒUžLŒâ ÎÌS¦“,ih"”—˜Æàc¸k[=t¯Kn‘Ð?€ÊÛ]vÆ ‹b$ºE:Ýp~m° ˜¹b}{±åȯÿ õ—Oõ5 „<¹ÊKS8½¢·qûš6pLâAØ\3 ¾ÿ“Uí¨º™ŒjPgã›Tz)`åûFè,.8‚˜¡jJ¤Ùô¼Ô`¶äæ)Ð×xô4d¦·,ÊÁX«'µ‹䀚ö˜"‰8çã~‹9R¤–´µ_Ø\·>v§ÇºÏJƒàµ“GEÌ=L£%“)F,F»u/DŠô<$Ny¼” +nFˆ` Ä@Ò!lèØøÄÏ_öS,&€¬µaC"o‚ýc«#¡ÐO÷)¥øÏ)?„äõøSH¨_q +…¯×v3¦>"¯[ü»ñ +4‡¿ûy)FÂG…^·*ºê}¿b…J å~ ÛŠ½åÝ7PS®¦¿LaOg½ ."¶È%g„—èœÕ˜ …µ³2i,½ FNV[dÞ"ABÇg X uQÑÁŽ ûÀ²Ðf­^ë|øi²Çª&M·T©6.óéJ¿ÈW:¥:²h¤Ô͸~°aê#]"[{IñÔ^w%uÖ„„ø= ]ƈrv¸î¶dÒL]Ð"WœWšèfÆçS·XœŸmÔÇ6n”‡Þi¶1×v½V ^óIØ–†:­ôÎì#drGv½moðá5‚&VÏá‘4ì–²­B×OzC¨îÇvQ4jp‚91šLõ Y0õ~}7-úŠ0ƒŒ]«ÚC¿I"_Ê"rµo¼BKm$}/z'”¢×è=È«eÓž3üö÷ŽôPk¬~J¢Ši•¢ŒÉ¾Åræ%Áme€§ÄSô6Kgl?‡©‡rd¢JxbK÷«ÐQøó®0Z4°ºn'FýN(*ÓÐ JÊ+wo…ä&c{ŠùP¤$q¸=…GHÖökKk†¹æÙݵdR?7ÈŽÕ[3"jè„PèÂ'Cgv§U¨l…EÐР%¦6;æ¹]|>¥?i2Ueá€ãâæ.‹™mlŽL{Æeéi”X?¾Áy¬fÚÿÎ<-éÙ®Aʈ'Tp(^<ã›Ñ,úp)O ‰G†ztE ßÒ߈ëå#öAó¥cQ@72üàQv?ªÄgâM´.ÛDG –éÕ^°XX'ËÃdúÕ8lªòLÕŽNùžáº²^U"³#jcÝs•‰RªßÇöUɪtLÅÈ¢Vå©E‚«ÅM,wnúm­+nŽÍ%Þmµõ”ÿ”G¶EaoÚé%ÿ&÷WFMãu|ü”1…yÇ/ᜫSêä_Œ*b„ú^b 5nYr{—ÓŠÍN É'Ûó¤g>çógÿ Ê‘Ö⊠+¢g!¯¾¶3i%±ˆõÐÊì'Ò€ûu¡”¯ßã‹.ôÙr¸÷àsr^o¤óë¦Äp÷„Õð…d5ôÊÑY~MˆlÊg2”| ˆ´ŽÃH,=kg@v¹n¨=nKý—].=9¦J×O™Ê½c»výRt1ø]/[ »C?[7`~² Ü}ÊTPªÉ1§\×Ë}¹ —îš v¹„¬Q—MÀTÄ!P?L§•Í’Jç7éy¥@FoyÙ¾ÍAêF,ƒífèeâ$Tž”Kÿ‘÷?a±‡Û²ãdvþdܯiÙla¨) vÅ^'—-ÐÈCÿˆ­'Õ¡œÐcë‚U-›eäA˜=!LïO>yIpuÚdtåŽth zGhž&Ú÷<»2EBµ1ÓˆT¼NÙpÛ%Nj 2­hš4I+ š©ü“–šnÇÒmé‘O¾äÒ:[380ü@Å_íóøÔ•`mv!p±³oLWo4ÿ©BOÕJøí¯y–XI/H L!®3Úûk´eÚtòIéãsCî×{›v‰r®zà ÒtLù‡¾¶E4L“xsæ å3óœÄØ”Q ø·ÅkÓª²“°…- ¸ Š–ð¤9‹B¡ùÃI”#| +d•ül^W>¨´”×.õ"ŸkYy:äÆ$뻌Ppd쮾v¾ ‘$,â­: +ÃâøÞ`âÛ'Bˆà«Œ¤P›š›cóG‹‘K€º±>ßw™Rɪ´õ[ ˆvHDž“4ç6 d„ET¤ôLŠès$4O +€*Ô’ÅWœu”_½mÅa¢µÐœ²JU(!O[F À0åOК˜$C ˆ_(?¾AN,ºêá&“O„´3üs›%Çw›£FSX…SëŸI=OW·ßÄ™r;8~¥nçýØ}X?³̪<ÙA»¿ÑÃhýa)d`ôNäpN€RÈÁŒuƒß(câªeì­'‚^"£6v¯°1>kJŽ%þ)€qY´ÏZ´»úÕ{o°vl#j Zè£ao‚Lj˜j +ÐÙĆÜûŒ5 |ƒ¦rõ¶?©©üL–Å–žÿÔô7ò@,„D¤̣褸õÄ"F }×íæmó®Õ© 9UÀ»–ÒvNÚ6<õtF(E3èHw__‘%©TƒvmOˆqù•ï-«û0Tß{Y(±ÈBÂfDˆ‘0o †<#ˆÌ+ðRÉ€ƒd ñ6»Ø­X¨Wû=XW̓æ¶ÇŒ+³È#¹£>¼q N>Y°o´‡“ÂZòØàrfÁÖhc +?Ûp¨¶F¨ÏÚM•^, z¨ë ´ÿm†g¼Eq(f\pî0Zo¥6ùž•¾Ê*+¯+ü¬5b=­ ÒdkQÿDò.ídüiÆì÷ø+?i©ðÄ¥ûÄ lÀk²ªf–Ö4Ì!ôp”"×ø f¾8ÚOKã‹póÆÇO’€x'm âXƒ±qÚ­PO½9ì'Ø“KðQ<K9¥Z±¾ж©Ž¶òiMÉšž !`0%/¼Œ”÷„ò$X=ˆ£®ãWmö´Eg3õVbaï ’VÃm{¶'…Å,ÊΟçjå¬&|·Œ¥íí¸ q.à–H[¨’· X–K<„Ùé·¢xžT9‹C­óˆ(t¸»äÂÁžNT$­¡å¨±u§Y™šbZ‚@†.ÈdºCL’£IÛ.6£1˜ÄB£F7ºÛÍlãM«‰ŸA(²Ÿ;úUG…S€LªdÚ‡ºHDÂ_ Á‹ì;9oXÅGÜÎŽÓß­q×M)]Ÿ0§M, +$ÒóUßšŒi¡-ñ&G¡=˜IhÖ´~:‘í#c/ösñí¨ÁbÐAÊñ +¢H iâîp©o'í¸Jêø*k@U$·“³Ù°PÝhV¤WÚž}¼™9ˆ‘$y8IÁñ£/îåÍŒ®Osþf÷ÁÑñœj>·¡—ÐÀ#D»Ož.®b¢Xl¬Áà I÷­FÄ_,DÆ5’7„EV~ñÉK•¥Œ}x!ÕŽ½EÀÕP™•›¦¨) k ¢%<'MRmm²›”´IŠ1ß{¯"¿%lÖ¯0÷ÃI + šÄø{è_†'3ݬiõı³Ü˜_æÌ vßÂhb:C›?„TZœÃÀ¬¬&™Š1[ØAŠœd¶Ž©U|gc‰CyoOr±k4Åô?zåM‰M \ánäEHbó ÞÙ§Ïådüx=ØP ”vêÕ¬žÑ‘—:•§^†ƒ$É`·±Æ€>îibÓZbl9™å$B†Z:M(K…y‡þXRÂ[)\âæI%ütIŠ–›üsVõ•Dî=œ¹Jé(v¸ÒçÈ +z« iVØä-öû¶>Ig†SÏÑM%¾ê~¸—<ŸD!ñi)eñ™Áe;4dˤ•‰ BgõáøC×S¥'´À÷æD—~.H¥ktr¦¿ (M9d3Õ-9C±2gÜ;JØ'ñ ¬ºí&\­Íc(deøt¨.èJæ_N úõ®f§O¡@ÝÆ·Zô¸;Y+RŽu” +Oˆ$ËÈ£“qvñÑÇ 0¢ˆ¬œ:ëœcòîç0 798ñbJŠÛ¾&Þ²há{ÊsmŽX'“d@ü‹ï´lÂE&ö„Däpi`bðRÆxì3t“ÞäCºæ"hzq?i@ ®O¥'¹O}A‘¤Ú;®Ñ¯ù³?Ø 'Æ©ÏÚ'}‰jïޔ üLË>Ü}÷ŽN'‘"©½9E!I0ÈvŸvO«~ƒOææ¶° Mô{ÒHªylj.< +’ø«áR¥)Q`ÏW*’¥†âìWwa +þ=ÑßT×1©ªsINr~ Èœ‚ Q=ÚßÊkÂò"|h6¨î½R±‡iÞÁÁç_6*0~"ü¿Ê3·`œøúuú¿îf9þà QÞ8išÒ£bä>–úŠcdÓp\·¥´uû™@»Ëñ©ŒÙPg*®°b~Šþ€þ„Å!ºfÙka4ž{…Ø ·›÷§‡Ôis¢ýuMmº!÷,|ÒÄ—-;z–0ì•Bn™T@¢·A«¢!(9õEƒ–°ß¡þÊ€sAOþ_;á„ÆÉ=2Á !zA‡qßG ‚Äx&›Cû #œêÐïR"¼rœ°È‘ž¼ÇÄóæÊZp!„4¶ :_Ÿ¡"»ŒòH¡µê +*m52ƒ@ ©£h2CÁá’'Ñ©²F‰¿Dm \úeòGÚLì„ ÑÊ +ŒuØo¸[ò'†¹xQxùÉÌòqúøô–ÌìzI/•Š©Zçí¦ôE–0lú`õÚpÆS[0ÞHž)6"k Y>t0 >kѨ(€6î +¤ÁDq3_âfç3‰íãkÓµΚÁ~;±ÀÈ[Â7‡¬Fj £_«ö‡(uÜEÀ¸íXË ¡ËdŽ7Ú ¦ÁØS}±bÌ 0Ÿ51d¿þ¥R|é»|V‹PrÒ'þ>ˆÓppê0Ýa)v!r!V¨ˆhg)—ƒø™ù.iœx’ïíâ¼Ü09IKžÄ¤^ —pÀç’Tè…×áßJxkžŠáãï=ާuLpÆAEŒßF:°K@¨2lKë1IT4Õ¢Âû`È¡­'G’H:—Uí%V˜¬Ã vÖÅ)r<6/ *L»…~j¹æãNãXakˆ¼pì,9%³BÛ‚û^ 3ú·€Æ%-àó»oˆÓÑMÉlT¹FL…+ÉÚ³p - +¡rÐÜÅ:­(â éT;!x³‘½’‚fh¿¯ˆxþÎùiÆ›y+¹t_÷!P^l–üÓ„gQYò5 ù_˜ƒ ;ß#à`€ ÿëuw¸‚ø­€¡j؉ÍÛ"Ê; ¶ðR\§»ËÆ— -uÓ_þ¥+ ÞÎWÎ-·¿xR•(x*‚†ÏNÑ/è¶:ОñHo¦‡MÇùwˆà¦ÔUMiÎ ³€Ä Òç¡á·ìn³õä@„ÒÜu­( a$CÐÞƒÛ3wÜACr¢«8 Üå¥Q`'ÙDRŸ9q÷e÷‹<3Ôæ¡ûf¹úù.œÀ‹øzV§8vÉôªJ¤$â¤-õ´£pàŠ¢ ¦%¡¼^eÅ/úg]nà- +™ÉXª|þSzÛ¦'†´™ë¦ëŠ~ÄYMg3=SÜ·>i¤i·³5·Å +º}wÀn8ñXXÑåvÍó0;¢¼¾'ùCÌê€W2*/SØ*=u;üðmÈKŠ$?p-¨'ÑêŸâö½É›ºU{šz²å_ξƒ97T}W!„ ŒNÇÖB„ÂÕÖpÞ½êÉÀ¹r%æÇ¿:eüÖª§jŽ“L=‡Tlj©é—JInYlœ*"­aÄ-¼­άÝ=¥cdIÄÛ‡.‰lÚ[ìh>„)‘ìøùÝ»V=y.cµõUÆ)öäZ½IÈž œfsÝqÞ^ •ûm[Ù%ÒD/Ÿé>ãóÇÊ\á éXDƲMsò†8!ÑðDºrAPÒä5Y%ï5–Š9EeKÜeŠ• †ø+×J•z¿üV<’lxMûn´›“1?B[Æy‡´pè±Wvl0¹±óÁª¾ð?r˜èã¸ïtÆSA‹Ð [ÓeŒŽžUÃ{ófN ­ +Û† +=³P®†h¢muñ]IKY ++ ;޶ÊNz yR{$¥%£&6³DY«³'[¥!ų)zðÛ€MûI7!H +™])1Q¢(ú™(OÕÓ¡÷‰5 0Ù¼¾0ýjŒ=eƼÊÄ#b6_©2 õêm áu§ç,•­ÚÎ)½ÂQ\½s%°KÓë+'œHSØ ”‘¤¾%ìØ Ì¶PÄÚD]“.lD!¬IgÀ#¯‰yç-rV_“"Jay+;·¤Ã•eÒùÉWã¾XKE7•\ÝÚhHðÇâ<'Ì({•x»¢yH¢i³–œasqñÐT…4ž|ÉÝ1ÂpprÄM‚iÇÀ7ŠjR¹{M—d +l Æ3Ñ’1?E?}‹Érl`].…ìíɳ6ê¡l¡IÊq;¢0Fyà´ªXÓщ-OšA,Žk@çw|_>µW”m¢aD\Pƒ]d¾¢«c¨ ¶QÙ­ ™'ÚAÝ\¬Â§ûÇ‹ãžYU{@@54J‰„§êTýÌ›„ëŽ@›e]R†t‹'Ø©bw"ü$"@Èa]f,†¾É9˜T1¦H·7Ö[éP<,è5¤‰ +¹Õp[úZ=^à ctt­Üê{œŒÏÙô> +¾"ÄQæ„uÒæÝ”­„–üɨ/Óc¦}ÐáÓ/Ã/ƒ©Ïf2…#¯¹ài“³lÚ40 ³DI˜V óún‰‡{JY­Â7§+³’jÔhÙ° +I¸ ¼ýåÁ­vêîÑòV®Dk­é„óQÉ‚÷ª¬4MwÆþ²‰ nùò EÍÚÏ®[ŒŒ."¯«|!ÆÝˆ òUƒ¢hú£oÄìØßðvtO(ÌÕ;ð .8¬ÇÁ>€çà/¡S¡ÉýéÂ~ìªv†¤:Öå[ Ïpæ£T7” w²yÀˆ£oA·J]–r·•(Q¦sÆÚ ö‹É¡˜ÿTDm:8µ™ØKÚPQ¢+宄ZéqƒÍÀË$meW: Ùþ@,)z¸j·‡ö}¾û ÑÓ¥C!<­Ùåk®ããÜ‚ìÃ&:öƒ{-v=ðTu ý#ïm6ôÙM»ó~ê‰vTÓ’‰„=æ™ÐkQÝt±C¯šk¬BÓ›;”M›j=§†wµœÞF -¿¶ïÛbU“ƒ»ÞLÑhÇœwؼXwf á˜‹$ð¶¤M#ü¤DÝ:ù68 •EœÔŠdùÐ.Š* Úh(ˆðœb×üîŠ=UpÂtAò x&a +9ã¶ÊÅzòÈ$Ë$Pà}aßu4FïŠÞ^éDãêÝ@¤ýáØÕöŸgË6©ÝL‰V¡~TÉn!ê/?}"Έpq¶©S:©œÛ’líõÐï>[”ÞW6[Ç(OâWl¾Žò$%PE]xÂw¸«wë³âžu‡ÙÜ9«øJ‚øíSjz"£m¾Áä¢%@­Ú»Þ«ˆ’s <«žGé~~XA6-ÊF'dÑ,‡Û„ël.—QA À`¨>‹±:ý ‰µpb+Ùímñ/2q¸!k?XZöþê=1`WeD«9”äÔ"¯Cfh锉aÑ–IhiJ3êÚ0_ÿjŸhÑS1YðÞl]nöŒD¦^ãõQ~jÔ‰¥0rÑŒÓåã‹mhVÝDfe|­ÐW Aå"!Ψóˆ#Ñ*htRF%S„¡˜o¹u¹‚DÞê¦sx̺òY¢Çˆ†“^šzP*ÎÒÚt| ç—[m]żꉼ`¥5«yÁ+=,ô)«„Ï–=ŸGxÍÛ=Uý óêáTW–²æ !kWÓ׬(œ UÙ"/£–+L2†ƒb•!Á™þèÈÏP ÍB«R`ƒ« NÉi_(¢1p+*¨„~øs›Z(«¿½ìB«%úBC¶¿8ý­î|¬l€ATF¥‘Ñ ±`j„FSWD0Ð.r¤ýò…,„%³¢-B_¿ð~K8hg&ËófüÉtôÏ%Í4b`ÇÕ¬ÔW„’–Æ©e¬/#´Âk¯ ¹µ¤zoiVÜ—©®­DŸFÎeøçlW—‰ïš¢ŒÍ„G¶È÷Ô=Ë€RTÏBt‹ hÅÀ !>5ê[y[5)®ë +30R¨J£j3¬Ú—\¬ÙÛÊëÖ¤¦Ix¬xÑ®Q +$"qog6ÂÖsÑ´L7²l†o‰«¤IŽdµ5m÷%.I"Þ¦ jeŸÀäÍ_’€ü¿# ¶`ÃtëRÆŒPL³<¦Ã¾¸#;:"µ"M,Dá@%-mþ™½ÊŸŸ×_.a“=‹*Ì8Œ ÊN¸®7Òj¹F‘0ÛÒd+1m'κá"š#8óíaôLÇÔÁЬä Â,ú7 ™›[dý®×»iJ‹A4ŽÞ5L‹¨Á-|A³ü×6\Sqã7í皆 kгKÍHP‹ÓtûǪS‰xÈ/µ¶â±2ÄM¬…&HõuZyñ—ÆD0þäOdQòlÐZ9Ž“R72¡Ã•—¤!8‰KJžwмt01œCÙ.ˆ¤]û½‚ØP²EÁ[dWZszIBÀ`µÝêÒHЏâ5fŒe2&¸d/¹Þm?¹P'/–ñ`vâÔw ™Ìgë˜Ï¦¯_~Ö‹Hèõ¿|+P³Ê=ç}aÜhrÌëÎ0e%ÓO ”¢3c~VË2û…Ö@œ,˜dO¡>ÓžF->ð#] ¡ZWp:Ö±2Œb‹F­ÄA!+¾™“e4(“sÆ9Fjþí‡;*ÀÂ2‰FÒõ‚{_¨ÊK–0yCšZasM‚™ã$Ý4²­L¶x ª³ó4.<ÒQ†u ²/‘ð$cG ú`Bú/[MîÄ”ê¨y{Bmù°Â +j~R +Êß<>ã¼ÆÈ°ƒTC“ç|I ½·žódߌ]KšA"Ù'Ì ÃÆÅõí¶ïc§DRvu`„–šFñfð“êM @·ÑK)0…è‚7 ¾|ûóˤdeú[gɇ L\¤C¦³‰z;#¡®!Àá!·š1ÀÙe ’αe #Wkk +€ ©Ÿkp¼y•’°’àíÈ%^16i˜¿A×”l%ì5LM¤µÍ–h×£S·+“ C=:§2¯ o(‚Ós;jþ%Á¨Í¤‹H¶·‰|+•pUl(²©“˜Ãùi`Pª -éŠY›‡$ªÆßG²H*f€•¶+Øo7V1GòЧM¼¹ØoåWÇÐ'ZGª‚ð an,%.уhw1ÀããY±0¹\åéÈ’íh×À鵚¿’ Õ–é>’áÇDÞJÜu@»ßA"¹XÄäQñ䆶;؆›R%^Îrj +~)Âô‹Á—4$üA’Âæ'W»V²¢&½™µ,ú£sŒJF´É°Ê8O˜Q÷ Mîtô…BwvhôêÐë/Üv(9GTZc³"aâÌ0 )d–±„¯x¡yM©ÖŠk|PäuÔ¦Œ"·MõF)²"U«÷r’wAT¢5 fìG5@™wT¬ˆ ’7eIRH Aq¾–UÆqæ-V³Lþ(ª…–Åδ*ô…ïH½õ¼“ø°®Áè%†÷§S¶ `Ù#­&¡È ®í|–Êš mrª6»¤`ºÆÐ™òú,)xþ†W;e¾Kb¶Sk ó•$îmøá:J–šÊ(LV¯+–)ž¯ãÜÛD‰:àú5Ô{ë‡R* +i’{¿¹‚%÷°—\zlÌä/â‚/³Î–ÿá!2²b3ŸñL*•¼·ŠÓÜ–W•‘ùF…ÙÇþ÷‹²µ³Ce·)M|£[MFC#†ð•»CL^~¸y¿BIYT“ûzX`£ÉàG)¶ôg#ÚZœhx÷W"±g]¸^¡˜Œ!;ñ B]#[µžìx~€”Ó‚*' -r!Í»v“õì¾êÝ¡¶Þ<=Ô[›“?ß]é&w#`Ë®^ÎmÕnðY‚xÁÌÎ +Œ?¸àÐàd"Ó¶¸ÃÕm¹y©°9ò‚-ƒË²‚Óµ4(Áàmìò„ÙçÌú‚ï Á ‘ Ü;´PŸŸ›„ŸÏã)ë<Á™@™ú—ãF«Z$zEj0%0´aÁ…ŽÑ*S$6º;=hsì,¢Ô¡¤M + íž?L1 + Ö,Yê6M2N’Ô^M#SæêNú«w2šµÞÒ„šÛöA#³lx"C äCßÙü×n$…f%kÔ%´æ%ûŽùu>Z­MÖÊ8Íšsí¨•dŽŒ¿þª4]¶ÂŠz$Ôà³xA“Pc|šÛŒË1ß!äÒAäJŸ"Èí& +²ÇžN¦V‰x˜òÍOô<?& ¸•Šò8Y_l †xLJѤž¼ðLT20+ÿi—,Ä9ÂÇïýD(Þ- §²f8³´VÿØ#±ú;ðø(zh&ù?+·ú 9Rg.•aRP ?F =¼g´mLñÒùRqGQ_•5`Gï‚Ô›¬Õƶ¨t7˜¬r\½Ô¯¨Ò]xNý!¬7hˆÉ`é:ÏÎë4œCŸ…Šñ%BS0E%ä?àÚ®)93ÃŒèç}Q­*ÂÆ> iÚŒiQþeCºgZ6Aɉl£NuR§‘6qríu +½c­ áíÃ#î‘ú"¢}šåK>ŒŸ˜È[Ø£Íiƒ2ÑbTåO´Dcè˰h1›»¥Dgþ馯¤h³¥aJÅ·" zS#‹ë1tuù®p&E*hY2†EúD*‹·³É!Åf›A3lq:YSÒcKøe|ºptV +X§›zð‡Ÿ¶IñòÇ[ô-5É÷ÀÇüV*0†A Ú¸\Ë£¡”à |_Õ&Åô¯ Ò¸ˆöÚL®šCjD‡=+¤] ™,½·H›È!q{ÔãVÑ“+1˜c€„«wñ—5À‘#§n¶µýs>áQ ÌpìF úÂsq_P™!¤ºÆcLòªg{_8dÀÂdS÷¿£K+*’>‹-CÌØç“9èÛs( +ÖÖ¥á¦1W-6qŠN8‘15%Q½Ã[V»ÛæØD +1i·òÁè8;£‡]áZ×T@TÊ|àÛy ËKH®ÕFônö ÷-øÃ8`Ø +à+¢¦™µ{QýÕ*x”£œ‘£nìeýû|v6áªðš1‘­XÆ@˜o©LODÿÐ<2Å$ôˆ6aŠ®°kãðzÈâÖ‹¡ÂS<ŠëJ®Lca4,ª0Õ®üRHbþ©8ƒð¡Z™xyDûˆÏã¥nj§Å\AËŒüû\̃̌ŠOr¹€0Ó>¢í!ùÙ[ENˆ ‘@lXßoxÓ—šnr(!±xJîS%¬tŸ=åÓ?–d¿øb)öÕvïªc@ucŽtÅWݱ¦=¡ èíÚþ Ã¼ú8Y?üIÛ)9|˜w,ψ×?"èŠ^"® ˆë@¼ùot@†ixÝ”(âÕùã'<"u¿DÁ+Gñ{Ö‹7K—7Q¢±F ÖH&óQLR=‚åx|W"*@mÿáF:$ÑO0d8Ä]Di™•”·œZÖ]h-&%$|'¤ˆuÇjç+›tø¤!ÜÚ pÙ…þóƒGä Fÿ ,k§_¸GQ—ùís|SÇ„A\¿,¢©kZÆÕEÇMƒ'õrg¾¹42£ÝJ ŽçL6Ù`( +Ž5äÀë…0í£­‹êUP~'×gpÒWbi òiŸIQeE¬[[¥U>õZPyo +Vz‰Á@BcŒÞxD³› Ù mhXoù)ªq,ÜW·¯íª§î @o™Ô±û­±¦ìºÌúX“{A¹3uœ¢”Ä–Ì]GGx†Úß+ž}÷#%¬ª63šö˜&H)ƒO°ÀÚ_?µd-¼ŽÆÂEhjGM Ç—¹…”L6‰Þ˜èy¾Uüµ~Øø¼î†ÌVÅ?`¥Í™þóÁ­ÝiÎ:_y¾TÄ«¸|Etea÷š¿0ËH¼©+Øtí⤫q+CËà›úšÙæ,àŠæ²ìÒXŸ¨€¦Œ^ m<#›š!‘Jo “³2€Õ©¢²‚…WÕÉ«\/ªgi9™ ûZgŽk|Ê…ˆ&«[Xó,/HFïOo]k|¿K7‘hbòõÙ%øó˜»"Š˜;uE!àuvÑç €.d_ÛÉésý +Ð¥ýD–gÓçBz]ów +êsI)”êÿƒ]¶V‰€. ,Ídú\ý ë'wØÁ1IŸ+®ÌÞ&–žk&mŸhÍþ¼ï`*uýpõJlW®ü R™5hŸ²±ë)Ͷ­tµýˆ¥!êF°…á*y™ÛÇ>WGЛ`x yuÅp\¸—/ŽýèÎÜï²wPpüuäÿPÜ´X/¼îW_Ç +`ñ­üý­1zà}„ííY ã—Vèô¹r‰dƒ–ö0³º¾}.µù‡îmÝ5}®‘Ÿ}>]Ê^Aác~Ü3/ɾíeäKÙ00jš}_ _þЧùAÇ_¶ûSÜ÷åÑôSª®HìjFŽìÊ›>øhs`¼oGذ¢¯ÑV§)Hö޾ÏUÜ œ4B˜Hó7)á~\}Én9•HíFôÉ{æ 0eü6V{оâá…ÖV座’lzu@´ewÚÛçj~Ä~Mâ†ÐWì9šé|lèýû\¸›8×!,îî§íÇ1ñÇ|ÇâûÓNŸøÐŠ$>¨w+Ø"%¸-$³oñUO}¶¢æ Ú$hŽöÄ÷E- ôõêŸá.€%i茌Ib()‰2Iƒyiïæâc׋ѡ Um6U_­qÏÑŠªc •cˆ-™J" —=Jщ xþQSdBSÏ„‰Øç—0™Ú4Ì|ÆSä8M¡m'ÚHºFo4zh°dñ  ‰ƒŒ&· òÆÈ©-/ÂM«U§d&’Wt&V¨PQ”¡ó‹ÂD¡˜“wå´/B‰©À §HÝ¢6b».ž}y${‹¦¦¶Í(Œj& +ÃF6|Y"ªuŠFQb +¡0I6‡†—±2¬²…ó:»K¤ébô‹BlTÁžJ!&R–*‹p±R@(LÇ2ˆü§o—“…E)ôB¡ÏH9ôíÑ¢DtSa¨Í,‹`„ª´Û ™Ú‹¤•ZBûÙhÒb$P JÁÂì×ÓK*Ìe{ðej:±ñ<›éä Ñ"¸bÑÿ®‚3 4D#yцTB®ÚI”02»Ñ÷%FP¦„Ô ó]‹‡TA„±"ÙŠ‹påAÖsŠt•&1 ›¢ —Ÿ6AHèÔK©jØ™Q¸ùÚ7béïBâCÌÉÃ2&•gèXäïIF…^ˆê’¸GÚ…ßÔ¦’åòË+ñT@A—ºÑÄxÙB/M1„L5nB˜ú‰Ë¤€þª Àa⇚ ª&b=m©EsjEr¥wDY6TÐñØ)˜pˆ‡>ÝòªŸ „ˆUì×µø`öT3hÙ"ç…è(Å•)•+.­¢Ðˆ4¾ +zÍüLžJ})³%S“ID~ ýÞ>9þOŒˆÇçÊ$ÝLo™8ɹÆŸ“òèTéh$òÕ÷YçÅyEª®â¯“vͧäR†ò‰œ$'Ëëjä·á ÑDx [% NE{§õ’)\,%äJÆAá1Dî›âó!Ú=Šø + E vÞlup=u¢Áâò‚󹨄q^d4®ym%Áu7›ˆGwñxcTEÈ-=§šуûŠ ¤„:KIL‹F ¨ò2—@­q´¦°® µˆTàÖ3ví—Ñ© +ôâó‹Ô•B"8~²¯ÕP¹ðGF +··0q$z‹ý Ö„>stream +Q]G)¢, Ê/¡œLPBM^•¾‰/ÔYg‹‚jùÅÒœ‰Q„'ü´Hx\ÖpŠ vnï ·:öÌ¥F"¨ ¤Ñ„œMŸóŸ$ +>|R^Bú´¨¸´ÖqñJ·‘¦Aä¨+‰ѼUž4aNÏÙ áœsáœõÎ=t9»Vy$çÌæS¹á çÈY$"áJNjœw3»l•-1Jâ^ Z”PpÉQô Âê™»!m°–ê)òÂÊ(ÄĸŒ˜:Ùy òž<1÷CD äH±3»T (?ûV»Ø3L;MJ1‰×xîñÂ?ð5d™o¨eu\±ÍþÄq~¨2õФôÄr_wlB2¡j¦\¨Ÿ¯šT¢†WBlùŸº¥¦!J‰E«Ö”AöqȬm¤J$£Ã*³^Ô ±|¤h?¼ÓŠ"tæÄÄ $Õ6šá|™ÄJä é¤^!EÑ»l ìLHV·H˰;Ó-ŒÀÒTyÁ‡µTÐU‹„5Øœá4¹üðW‰ü6U•„Ó¸ò@˜ZëÄJ•MÉF©‡SÃ[[IOÃu!ÊgV­1T¥­„t£ŒOAOB•‚HB•»Œcè ¡2:ªðTC׊ 9”Áðzr¢D¸ý5P‡jFA½ëWtÑ[ˆïܦ’ðF$sÅL©ø’[8¤Û(Ñâõê­ÇŸIp¥#ÝY(âaçò”ïvÛ55R'Q’jT+¸² ŽžåÿM×ü¥U™XUCSµ¡ÀŒ7ë‘ sï(S‹H"„· +žÞˆô‰~bEjM+=|h>ˆŠCÆó˜4Ú1Fav¤ Ù$Ì#ÃÜQИ}EG )"в`„´Â¤­fä-gU] 9²R á™Yˆ¦jO¯nÝ#¡&¤¦6%2ÛL͸0‡:Ê4†ãô²‰k‹¦ž[-"k™GI¼ZÃÚ‰bò†¶4joÊC¾QÎ~˜)Zv˜ízBØŽ™¯ÿ!™h ¡TŒ¼f³˜ôê²"'ÂOT|jÈ¥p­5Òý µ#_ØÚtÃÈé¸âÕpäPÑä•0¶.õ¡¬eÕsB­_…çP :.±Vž'Hþ0Ôˆ¬½" "Rµª›—扅±#‰ÆÕ'Ô’™å —Ê¢iN›Äˆå1­³‘BÈbÈJ†½*,k„Tk O,+Œ‘O,¶0]* “`Øø3vÒû£Xqâ\323‰ÍPf¨(Z?;Qµ‚*ßXjœyü; +‡/^¾7¦*B’ÔÅ/£PVÏÈe _ð ;&Âw +µ‰r(ƒ­Šæ TL ¦Òü¬Óto…ʈLÒ¡‹i*ƒÓÓ\"➇_шʳ߼?Za‰DÙË2ò|jÅ•†ÊT¡¼£·å ¥`%1ìI†#±2Hª:ìZyÌ&µW¹áV:> ?bÃK[ƒhÚÓìiÔn‰¼ ++S+¯Û‹­DT½A2â‰L=ù4dµfR{„‰/†ëf¨¬ -_‘¶¹*G(‰{—;ä†|\&Æœ¨H~…V"H£¸iȑؤr,ΡrRpÉŽƒÁ5…ÂN5¸Ó3¸¤N8‚eX®,N"=L_±03T¶® ïËAJ×B +‘ ¥GUØ‘Bk‡HéÁ¡ÀÒŠ÷%°Sâ's2ª#5܉Ð3u'ÑiÙ3E׉FÝX©bHtˆS¡´›+3epÜÒù»º ®üÒ—U­)×—[aê!>]J%H×'Ìj͎ǦtE7 Ó8y†‘G˜ÎGB%¡©Ï¸™yMXÞÔG,H‰ÞòÚrÌÒqh]"¢ØG[/ÎJŒl[WCZÕj?:%Öâ!¡{¨t95L%«M³˜L€€L*F²ª„à d80 &<@hn«Œb‡BhC#ÂiÙõ½ýùLr—ô%âDéæb­$ÜÆT=â5JÿoOÊŒˆAQÓfÝ„úì¢c^tFDd¼Ëÿ8M©÷8ûª€ÔÿH·†LÔ14DÁ%F @»º e©Jj‡7`Ø„œ£n;¦j¶m ¶ûscJDÍ„od“8LÞ2Lñùr4i8áÜÁo{³qþC;üz©Ä„©z÷k]D¤Ø˜ªRƒ:£ô‚b Á¨²TLM˜C#’†¾‘û=ZeG2yhꈴÌT)Wx½Z6ÅßÂ_£Ó”\\ óSWL!žOü˜åð®aZS-Æï. +Ì:wjŒ©× ›É‰Ž)<©Ÿí“á›cŠôÏy2‡(âÜ=L唽ajÐyEw0u\Ë…Ï7¢kr3¯ª*œµ Ä‘”2²/#©¬£±í•©Ë¯5é B„ú:2¿bºæ±žBOÄ|ã©ãך0":Ûüm‚¨;b"W•Öe¨Ìw™õeÛuU%šK•ôĥū×*‘Ô7%]eƒª\{;iá?<œ»_ +^:_â“\Â1‰KºghÓÎHÍC +LX©ÆKϼ§Æ‘$v¼”óRe écÌÓ_9¼­)p”s#ÃÃ>×–‰Ö}%³­ý¹†44,ÿ}o ¿Ï»¦ôõ†ˆ\%H¤‰„0‰¶)Ê$7trÆ’_hL]BÆ$‚WpÿceLºÜ¡:‘ ÿÓÚ…'R·LúuÑ𠘄úpøó}óinåÅ!&€,ñŒ9þ*Cj +œgÆ»ƒóÔ ^gy§QSjU‘ÃûÍ“Žc:ånƒ‚¥…ËæùAËM9Ó‹¬ýjƒï~‚rÓ:JYØ‹$ñl€¨ +vS€o ’ÛÛ^7ã›ð<|·ÊBéå +&Ϋî&¹cŠç]DÚHé¿Y;“`E;Xs\ü)Wœ5Á«°E“De-^hi> U’ü„,Ø〫ñ%ðò~·Iº#TMFRpÓ“‘úÈôÓîÁ¼ºŸR^@È= ¨¢ìùäT켊O’š$ÁR––e´o~ýM‚´­žŒÜ;áþuIëV¾µYmT„œ± â²oæãž†":BxZÚõËÛw½¨}÷Ç >—lo’,Òb)N +Pc3[v“H<DÚï@ JZòÒƒÍ8æËò »Du©Š·Œ¨LЉÒÐ>ý=«ryÙ†õI5ÕáÓ…ÆÚ¾ÿP¦=M™t–§aÀ˜$Îe¢I ëÿäMeu­Àße™) WA(ûKY¤í¨í[¸ö½%xùÈÄ·–ňŒïÒ*¦‚4Tb!1¦ó’gܵñ>Å•§ñ i‰¥NmD#Öø¤Ùñ$ÏÏV ëÃXfg%Ì®È]`J›s§÷žµÇ1³`<ªz÷Yß«8&u/AkXÜwT™’‰óVð³}ØK]ï³²7/'Šâ¾p,¤óÜGåÍÜ:"¦!N¤Àïòëæz¿¢0êj¥k¯GN£x”.áM\€‰á°JMÏ÷qBÓJbsñwF!””¸“ÒûX!c³ë&ü kïbSý’äÔóDVï9 ŠFæÙs`5³#¯ ˆšx}Æè8ï%›²€¡ý’Grp^0ºÿÆýKÞîW; ¸ +™{x,˜þy?ÜŽd¨Ð:ãÕ‰¤z—ªÁÈ ´ ÏT`6ÛgŸQT%‘ɼ̲ñ» ªðçËY+C,^€§6>Ô¥’ñ=U¿U^ZŒ)©œAÚÝŠ—ïÊG2$üò”‚ͪO`‰ÿÓYÑ¿EÅ®Sº(8š%>˜¹„o­!÷DÆýr=%÷îÔ^Zâ‚6­7‘Fã²Ïûo½–Öc4áýý¿Úe°  ¢Úð. ú +âh ìWl >š øßY…̸½ó ¨ìBøá‡IgýA‹ÆÀÖÔJùe˜×Ûô¡4%ιër0±©£š"Ág½õÐZ(–~jžiÈœ½¨t‚k£mU$¤Û¾ÙuùØ6SùñÝÐ "–r7gx\0Öă +• —$Q¹ËUàûjä0¾/gp|×úô›¡Ewçcº’”õ,<ð"Ipâ…ãûît'õGB ¥:M‘‡K²¢K¸é˜[`ØE£wÎÒdzÅ®œ(/ÍÝ8ªS8ÛN˜°Qõ«J‰( úoAwIÉœ <ŒÅP]Ö¡9•w¶+&uO‘NÈõXWçÔ“e[™n¥™´3Íg+ù·y«^(Ë‘TA­ô]™iì’¹M©ÄX@U¦¯Ùt|8þ§@åW=Ã]ƒ÷s šIl3Ѫ/uM ͓/»Ü}&¿Ý_lmRbi )€cà +@%ébá.1Kk¡!€h¼ÿ[Ê)Ä!Ù(—„bSÅlTdÌ#Nö0Ïòì8DÓ‘ªƒ E­ÉᢠRSYÏDwS½èýØ…„ž°0w„\>›˵‘3QFZrBzÔŸ‡˜Ìª¯‘3ùR|TÑ… 0!؆‰áEqˆ + + Â°È—M¬Ë’wàœÕÌDÐvé˜"ÙZ¡®zèˆ<ƒ ‰HdÔP„Ä)‘ù¤ @%PS_Ñ +ÊŸ +÷«~“"•^ù{¬èFˆF€ˆºiJòp=Ì÷´4×}»ÅÓlª^MSt_ck‘Þùµ¹0’‘Î}\àüaÛŸ4itÚêäd^izz +ƒõó”àùWr¼ƒ˜r0Ø”²ª€QMJkšv²¢T,å„Ghwtá# ËÑÐQL:¸= +x$ý^í`>‡Qz´¯›b½’8D½†a!¡ó;åãZÕˆüSÁEo.Ï »b¶Z¦w‘†ƒ ¦çáõ©‘%µ êðû–¦ ÷ÿ´„¹™)÷Ïý©aj-.¹1$øØÌÉ?òˆiýï³’NèÌâߤ²}¬Ÿßçý©»âm´éjG6MI¶®¼úÃÝR°1 È߉?EÂuÙ÷Ü fóÇÍFÑVƶl*“ï«”¤6½ 츚à ^‡yei]~Y¿l±‘z–ÍòòŒ50•óêÄve 6&©dïçX-ˆÍ?ÿS‡MqËgŽd´dÜ ð/j’m1u¹¡Æ:8êÔZÌV‘¥è§¤hìŸ'1ÙJ™§‚4YÉãNði,5£sžW¸ÚŒ{gof,K·œqû)YaŸü àLE?ÅwÃȲ„ûOq¤½"ÄW.ý41º"‹Hwf™dAâ jM¿v 7©F' +ú-œÎ\æEƒ£8Õõ ¨N,Zsô£Ó{\ƒäÂÈäTÈiœ]°„ÆsMêöPÁ&wL¾Neh´ƒ+(þÊæ7¯ðI‘„•"æeHæêú.á¤æÈ«|væÈH%(Wé:ûTK)&6BÞ]×ã6%³¬à6BfÜÅä)–VØÙâ²€^'ðƒ;{›Ï0úf÷ñ—žÞº˜?¦oz‘§*ë—¼íI±}•E›J=jõg¤o“~@«S‡á˜=Ó «…ñA}Œ'#qÓ˜Ži}!öâô*§ô–(ºÞphAIU?kÉsïOEB*%”¸Q>¢í'fÚ']ŒˆéÏÍ‹‰ˆk­±ìü·J¥Åï0DÉ.#=6£ÛÔo JykþÈ~â»G& ì®v·)¸žˆ)"éÎÇ:©ûS#$ô™4rÆZòŒÔ$M+&ŠÁÇ f—¦‡?%ù.à…ây½…á3Ь%E8W¦¬Qû\•ÖyK4¡”ÿN¯"’I¶s{.Ù5ÍqF0=þßï=†8OKÄQ$<3~¢ždËRŽÿD µO-¡¨Tö@Û&%ž‚.šÇ»|ßî;*ŽçYïìJÐ!ƒþ"!ˆt£±?û,«ô•õ§*í[—’„Â%övߌŠèŒT‹–úR¯V±ÐÒ+|IµEŽ[ÚB7‡,žþ*þIeð˜C`õ R9 +zµãiM“ýMot1©ŒÎ8ôIºÇ¡_¾#»Ôv>CC½°bxô&+áï*ó¬r`SþVÈ·€Öø ˜5p/)§Ýˆ7Rh3$ãØEr'´`ß5½« HÊTKAgÓnO 9\œPÂáŸ·Ž æ4BH!Lº-]îÌê½µ×'qà +ëELÚä “WirÌÅȆ“K,¢¯¶Çß2‡Ž¦ƒ­7 +O…¹ýRÝ$·Z¯ºØ°â! K&ùúW‘aÏò–ßú˜`Š\Ы0Õ”{}--ðÕ“cRµ/½ªè!¤IbþöõD¶{¾š¨©ް] P –Es/–œ‹Eƒ= 3ÜõcTŒOQÈÎEî¸z2€]ô"†B}[«+sYð¸d+|ÉÿFƬä̰òh•:–61½áÃÍìxò$¦n‡½IÝ!Zý«—Ø8T4ZgŠ»¡çÃþìKUªƒ1ÜTÜ ´R‰ûrãÇ4×°ðêë®Ý'oDº€ ‹ æÔy¾=àòؾØLUv¬„Ô‹n<­©eŠÖ˜@ð®¾H5Y3›$½-iÄ×K=€½™IU9Xæ‹ò«s.:N¦ ‹šÎÀ%y[É›³Á‹Aj ǘݾ¾h²mƒšCÔŒ}1êÈÇf÷€‰-ã +X. 4zLAÎÈ…“·OÔVž©è˜ó¼UBiÿ’ŒÀ¶0lèÖTÒýM@2Nb›"W¦”×ÀFH´Þ¼ÅcV$± H÷^TÆ5‹œR˜ŠÚlkVȾ§xš4‰WfͶª ¥ÃëeŠã_è†cgQ P½ðnÖÈc>OÎ+dÇ>H&Ùq·§V‘$¦bO-v(-`I‡;@Û¡Фƒä…àÈÏ¡²à0Ëᥧª¥"jÑÎý™-xB¯–Ô mS2ª#»qúŸµ1ÄtƒÝ`§òF?à] 3‹¥€Ú˜Ô¡æxb×Í×ÇΨPÕô?¬MÌŽqÞ¢hxWÓÓBTo¢¬Î5¯:qss©w½ÿ:¨ ’¢m9¨Üºßy`ϸ>Ú, ŸÆ™+ÿþ óѰýòT5ÉÀ×`&i§È`ðÙJÂÙk"ƒhMc­µyþéa˜¥“²‹ŒCÛÔ©³!6íA:¨dèu*Soß-ˆhÛ 9ì?ží¢¬wo£ï(zŽ–­2ìÐX6Êz… `ù¢AàภӃâĤ«/Úȉªðcú+h"ss!|””¿kk¬m.ñ—¬®÷D¯€€rk‹ÀÚˆ;[8v •M ˆV“ +ë•›ÆöŸöñ§iW€´S=¦NwbE·J â005Îûv®KJ8PTƒU¼pghò’“’-'Àše1 à[C‡† +d9†@Î`ÀH¹œ>¯šØ’l~]PF +$=¶LîÉX:`·V‰ã$ +§$qœ|Ä1€˜,RÙ€çR6³ž¾Z¦Ié þ‘íY-7å¥C«xCkqͮ󆋫i³,€q8³ä¯õ½õ°‹?ä˜ Ñð“rðÄfjÜ6ŽÏ9>e;‚p!^Ç:#Žˆ<Ôx"Š_É0Ÿ`ZTäÂ-ùÁb¥ ¼x¼ŽŒm÷¹+Šf%ä­/ND¢ºŠ(“ý)ó¶n§ÁÏ+ÁÙ„Äã ptÃ8Ja™43Ü â¬%COûlš‡QÝŽÀb¬r j§%®¸!³VN_ÈÙÇ­”a¥&ɬഅ[ŒCs ‘JÍVn*Ù`¸Ì7°|ùWW›‰qpzà +PÛ%ýp¬œôMsqH,3{¤O©C<4m^£±@›ÑC™<ÈËlBh + ¢¯„‘Â;4ÀÝkË<$HЮ¶¹;&Ç–ÂCb؉t­~Ž0Â``!$‘í#Ð+vµµ¿uy’U£dû_û¸Ä}Mà%<$ú$Ý" ¸Ô‚˜y^M‘²‡]à1|Æd‡2YÒò‹týEéy`ñÌE ^™?€ŒÙ¥÷²½¿¿é5‡+ÇCëkùE‘.?9ìÌ“ý—„…¤Ñ&öà ª—ÅHkòžSÇouqµŠ èúÆ„H1‰%’Ã`øª:á$ÁóË6õ}\>MIyÁÐrœS‚cx~Úä$aÙÓs9˜À•oWPpSö¢ˆeÈõ®]Òî‰Ð‹—ì,·™LãŒP ô¿:ô³ùT/Æ·O-ÁP×¢ÈѦ$§Œ@÷ÎGƪ˜¡âü™CÖ+¡špõ!°;KÑízñðQ¢–W7H4ï7¢’†&¬üܵÏÐ~‚+KÉõi² +eâ©»„0öE´ÏÙRÁ;=_K° +©ˆ~ùowŽˆ¨Xl•A Çe¼óPÍ-JM‚A8)ýkTsÅ×ÂÔÌG†ö~±?ñ-Øal_>¦'pI7_ØF0àÏ®8C<¯tâÀ¤¯§ßëIÇ8Œ³ æ?c·Ó*×34ú¯ý¦¬¬ù†îUÓjŽ¿'*Ëôz\‹Æ|læá}S <ˆüL4ß.å@Îô•Ó–R娮 Y(½¶**XCÖ®2ReT—$ÖÎuéñËt˜KÖ&Z ¢1:‡vPCOm¢§»&rÑ$ÔyO15ëJé15/ÒW]æÉC2˜K(‡ãÉrøÅQW“>»Ëã*ODá~¼Ç`§-bÀœó“ÛË0Ë¿×U䣳èÓŽÍŠI ,0 )½qEW429DŸ`îæ’ÐÖÔqr¬þ»»À BÍ]¬ÓתQÓi¸d<¼ïðßí|£$šÏñ¯öÛRáíHâw‘6zPâ~¶š>ÏñćėŸuó¹ð=9èG/oô>ÓŽuÚ](tÐîGÀ•;G,£ë]`èüµÊÄ ï¼'’+0Ú%¯ü5{ã¥(Ó¡¬çìGoNQFkó%·Þ$;š-s.ÒÎ.7H%0-XÕ“sÒrÎÚ˘¢‹…€áKòPŽî RÄlDÀYÛot7XxRÜѼF¸¼¦Rj½È°5ÐdS Ýœ-;¹¦îŠT9(ù)öwwT|ìêJ?õ6ñþÈGÈa-ÏG!ã´¯û´“å89…ÑF_]B¡·í«$³Z2z‡¨-²Â§µuôëÄòÅJü~P®‹¥÷ʇ+€ã*³5ï>i Kúþ'û™0Á£ð¢?¹vÚ0¡Zk»„¬?µ ›ï^;¡ââTÖ¬DL±AÒPWÃw:§vqóïÞq Óf…e€X®ã¯ ]‚µ*ïz\z+]J‚Ï[ØRÐ? >d’FÚ·—¹»ì’ Atú¾Uõ"C…ìüŸ%!@—n‹6Ÿ¹~}öU,LOÿÍr˜OdêÇŒ2ÏE T×膙U4ÈjsXfáæµnP¦K”qÐ6›Rã-žªÒYuçüCšŠ÷±©CÑg1.®Tôjn«R²ºf }ÿ$:, Vòx#ÍjJ`;Ô¥¥ã±¶û9§ª^¬{Ý?ßã$åa&:MüCizDïx ^ õ£›±ÆXE0Ä\7ïö&l¨Åy‰a¢ßSGK“˜ ÅöÁ¢Ç—È$(@Íìà ÖáªÛ ž~*‰ËÕ·h«<Ò€™¬x‰ŒøËûZ$CÏ(&VóamC_ÔÃ{"ì9KúÄÅìbˆ>S¬Uð…æq,Ùý6ÖI@A¥[4&ñÇœ€S/ÈšVçNÉœ¶;zº¨¯B)ñÏÓe™$:x‘ËpW®’ÔQ&ñ?3˜$®ÂµAç§¼K™D³„7X»ê†$[%e/ (ÐìB\ms8¸³¾$‡íÐUæa?ö¾çú±ž(úöH ’ó¥HÛ"ø é$eå㟦ã¿Þ*sæŒØTÒDÖñrÚXÇÀ§U+Ú+vš@ìJÝÆÒfÆæ˜ö÷êXˆ z{ªÃ´3£N]î¡Ñ©|Ç‹3cŒkS–ë•_ŽG¯“3{°gH\Øb +š˜_0ÀEŒÊ1V-XlŠã[¯Œã”¸|L¶xrð©À’WÛöm¸­‘H ‚¦ ÛjV&MÄ3 eszBÒh*WïNHbÉJI8ØðI¶'iÓøuÐÀ¦ô²6Çej¶#—Lü>¤Ýv=)–ö‰ì•Å +:÷XgZ©‹ðŒÄžØw)7ª…pD(< +Ñf,!1°é$2lù¬ϸ™¿­¸4Úªï9ÙªA`Îå,ݵØ4àµózÞu…I¦”p½Q® äbƒ[ý=G0‘\ì¥YT0«ŸWT~åI׋Ì«£¡iðlýhOÊ +çb±‹¦Ò§<Á/3°ý@à_iRrƒ[µ3Žèo¶±®AoZ…yFöE´307EiÃ|¼¤~% +[eÃ…-ñpI{wä´š~UHÏòÈÂeþ¼D5–(ÊäHÚZÊoüdºr'H9NÎW®Ø¾¾ÌЉM‰ÊoɲyXS‹/ÒJLDIMVÙZâæDijFFTn€í*W”ˆ (M{ê{Ä&eÄÖ^Ía­¡2ùñ÷ Ji™NVD$]¤æa—í_Oºi*¡·–AFÑäO”üÿÇÛLþðÅ6w°jò“ŸÆI¹ >f]Ð$¦á¸T#‰„)}{‰~÷v¼k‡D¬i§ “6ZöÕçUí …æ9Þ%')3;:Z—,-¨Ù)É­Æ`bòbð+Ä]ŽP k¦qÓ(ø ¡(ô;S•Nó”ªÃgB^qï.¬ýŸq´'Ý-í•¢¡ãÈÃÎ ˆø¶fK:Š[ëÓ™ÕѺf¹r@Nz?òVæÇ×#ívï¢BåСˆ“&ÀÑ„©éÚ¨C?}h‚°S&Ë]ëÓ$DÛN;z~ðþt?ˆÎG$¿Q³˜b2éƒ=Õ`îÖ ÷¦ C·ƒ¤áÛ\Qøü¡µ‹èt6Ò·Ù†ª1EÙ|Çÿ+O´šM9dϧ´®Õ»Äÿ¿Ë6€F–†ÞÚ©1èÿµ6“öʪ)÷ð¿º&öRfžÕxà-ÄØ‘˜>7¨Wv9\J†,÷ÝÑŒ¡#%}F‰0¥L_ÛÈ—Ñc%ZÙðIðõÚv[ à+¥•¥eOÓ]M eÏê­Bß´gh¼»l_ÈY,Cõî§Ò_…`§ƒÓA-@Ê-·ºg›XtÖ‚nǼ¥c~#—Ât«ò5=ÆÅ„Í>+Ô[˜)ød?ƒ3~ùÌyø+9,b ÛG ¼b´·I=}JÃCHC«sñצìØGµH.#ðEUS«?¥11 DäÚh@{fò °ní÷ÒÞV­!h}¯.ÚÕkÃ×KR£˜!Lc ú0£&bM3û·#èøA/®ñV(«h¸ú[^´‘¸™Ø‹xÁnuX†‚©…Ì>R°íËJ¾NþNô2zë$·‚›eÁæ9g°Ö¾3ðÓoá…áLȾìvÁNú6,uOÙdKã%;g°§F¼3Ây¹Ý-‡ÎàŒµ{Go66Ât1q©.]/&J±—¸‘‡DÑ$³·Ž’ÝQÙ¥©ÞÒw‰¤üÂîæÄ+ˆ $¾e²ÒgqMŸ ‹“;Xv|•ž¨ÙÜ_!JŠÝEhì8¢/]¦|   ’¬‚ÿé /" ±Ø~ðu¸L@¶_ + Ñ¡QO+X¸È¨óHåy•JÄž¨š?êéßH8ø\IÕ‡ÌR±Øä⮦Üù›"Šc ª{a)Ê-åÀëõ‰Mp“Lƒ{á]3œ6Gv÷öº]icÏô¨øta3änÌv)|i°àˆLƒ¡Si Ø^–ìtv‹iqÇR¬¾zíóù;ÙLw†ñ³MIÓ€Øq|¨Åá‚4 àëÀÊù¦üT['b9ÙëŽg14v8¬×üÙ ¦LÄ6øäpÁã2a“xÉÜxCD$S0É6ÐßÖl¡åÆ"lp,¹[ @¹r»¡nnÕ˜¦MÜîdx7Änœ©a(ÿŽ…bÝUŽÓ)G½Ã)Æ…š5“üAR¸NeS‡'øsƒm}H·CŽóóâ8Hu¿ÔòrNPƒ'ð9q“ü¡k«3÷yþSóVõ^n ³ ‡àEc"£ƒó³˜HÎ Ôå!¤o7ðB»û_mH ~HÐXI@ëŒøÅ•i.Z«1Ìó‰5”ŠÓp°@e÷çÏ3ž5åðtTFÏœ–‹¦¦Â7v±Íâ?Ù~ÁÁžµòÆÉN|TXãÜ÷)Fõn¥ÿjÚó ÍFô0'8/L΃s¹J,J*°¢Óˆ¥¸ã6#£x“³ãŠÏš ^àƒff(Ÿ'ôó훋6wöù 1p¥44^:êÏϯÍLûŽ0qOíIc2™esó°`K7âJüÑI®ÅfšWWvì+1ƒ +±Œª#Ϥ˜EûäûÐÈNìàHdîûùÑàá6q• TS•$8'Nn´¯?B›ä€»W¦Rñ¯3"ùZþßÈ%áЈ*'¶O¨ {ºªl+&v’˜’ƒŸ?μ²ž(.Uõ‡br<$1ÏýwE¥‰­Îäo +?öÈA›Êø/-H¹²üDï88+ÈYpÞï\•’UÍIÖxì’¦?ñk6)€²žYØÆ„À½QÖŽrYÿïo䀼WÚü.èoÈRÖßîëÉle=XÒJöÊóÑ5î)BƒýL©rÕ76jr-1^ΰêî‹* ÀƬ¿iÃðØ4P‡Ñ#¥þªÔú‹³ì‰^àB{«%ÏÁÁáÈzcš.q ˜°[yB¥nò TUmB|Á÷r}ßúÑ4£)\ý»\[Ûuhi,CA!šC^ž”‹ÖI,;¤24°/sbœãí”K=öàgê`"­ÿ|ñTè?Ûÿâv»ú{›Ø3Lz‰Å ’ Ðiû“vÕnÂà^½í%¹¢3•=Ï|W…iµ+%†´:J‡Ü§î¦mªÆ¡j |C[ä7(-½ B—V#rï| +Ž2e¨nÒaüþ Úf <#y\šõPMø|íÂ,Lä1¸ãi¨*‹|<\REjŠ|z-¾£ûÜó>rï©›¶iXש‹1§ðÿ!U­ækN'ïM5ù‰HÁb ìN|ÎO¸‰9Ép•ö’:.¯„1I¼8LáL»œèKå6(Ø$Y Cmv]¸¾«{Ë_)O +‡Œ…¥"—ü{>ég(QÍCÑ]+­ôzxTq!>ˆâ)s[«Ð¸Ä¦†zC;< q(†ÚÌ=A5r‹—Ç= «ŒÕ¹Ü¹‡Ææ^ãØŠÐI¶Óé gå&½³÷ Lÿ…j¿?êeöDv‰ï¡(iJx˜ÆŽ×5#F^5Ö–,õ…Ó´ä»,XÙš“| A“ŠCœ_L¨JP,rPˆißæ)’™Mü3ép¤g+Âzëó­Õà +=TE„×JHO¡Å%¹zÐÓQgݦ³È¼õ$%`5(j«1hPJL›°æßÂ^R¤YGTƒœJ5x$âkM]¢ÁD¯Ô]qf–ŒéÎõøQ§ú½%½9ÙˆA(½w‡˜ßCPUžUh0U§5",™»Ú0<Žä „å öIñÙ +›ç:£^ÖøÂÌ ß÷ˆ-K÷¢‰$îê0³ì|Ô]Õ2Ã@9á\™PÛKŸ¸,B¦×V1ÏlÜ*­USzÿµÁcxùÛíÈMl4ÿí®–ø´ï)&ÛË¿ËÕaZò—WÏïB•<ð^ÄÝÙ"6 ‹* ¨à]UI`þûº$“záè®$ˆîœöFi#ÿ¡o àÊînÆ ƒçW‹†ïtÓDg’¨™˜ê±¦q¢áÉm,EoŠm"V_`âøuÔMA¦B@Aì Ì4xÛ? W”ŽŽ7ç4$PAËJÅïÊÆ¨{ßfcvHKÕ3_êd©Óž‹ãÔéqbl"‡XŸ~é°…ú‹ â$¡É+!ljv`üÉVqF:.âˈ!VY¥ Ķ‘¿\G/%²Bê×÷çå_¢õ’Àμl±4ÿ^þ Í›t€Ó1Q N×TÕu¡„B'ê9îõõ-¦ÑVþúI@5ž`22”â/QId$')ZØ0¢F…¼uO;à»d2’Vý£6õxuòø“zÜÚFi.2!ôIIÊQ¤_€‰™€Oç® 4Z*Zú–å8¥ùœƒÉËÖ>öÇ—£4€@ÞdÞˆOL'Ý·`(ï-,!+A>()üѪ +Ø8‡Š¤1ßÌ5²na°žy8ÕÃ%¡´)±ƒÖŠN~Ž00QÈôKjÂpݤHøí[ýR Ms¬¹WÂ(k¾áÁ´‚z–!OzÀ@Þ"D)…G3ÑeÏ d.â˜Fðò\~@‚#hšYˆÖu½ôkÊO(.Ïö\yÌäHcÙ +x÷â2êedÙþ¨1…ac)\ÄÔ?Ǧ×!ƒ|ò¬iò1ô ºË1}à„c¼É®Gz¾,Ø0ç\*gãŠIðwÉ{Pmœè_Ú²ª/»š÷ µpsÊA“^Dα"©{›Pô8#Þú IýŠH~V¬Ä´”£ŒÒQ{~Îìš‹ì-û˜œÏK¾:GX7JO¢„Çñ†ÿJº‚<$Ç|nÉ4§’8\æ\rå+wñÂ|ýŸbÍ_꟱½ÞÍåÙù²OÔ¦Óµuʾ”Ñ•ñŸí«>‘š-ƒ»Æv¨æ»ÑÙ’Õ.’hˆõI“Gü'ßïRvê6m鯝£áy ê–*¥ÇaÚÓ0~ûi‘YÑ/:'·øÑöÂãш†WóržÊÑ>eãÒ~-~ÕÁº¦õ¬2³Á4ÂçÑÊ߸W n[Y*Óœ+©1jý<ʽu· AZ®H‹žúz!†Ã'=AÁ‹'ïS‚•B$@!Yü®Á'Ô+Wψ¢RóB¬ÙÈ?)½TPtæ¾m—ÚŽÒ>‘êgį  ”¡šäÎdµ}›„v뜗 y¯qO +‡í}øÝЯñ”/[SÊ™.† 3ä6ŽÁ¶U!s=V¸ôh“è~HEæ%lwyh¬ÈxœUŽ%­ˆ{¼ÝT]hYÒ—zÖ?Ö’b£ž„yø† y RIK/¥ÖÛ–@ÝÃø±.k£iŸÜ±Â´ )òÕóáSMµŸé©–žˆçdj2*W½[*ŒBJÁÛ9^¬‰…p3‡ @ˆöÒxÒh!‡Òüú;+úúdƒ<ÊM? \YÌ%C1,ŸôÙc”!GÚIC±:mJ’”¨¸€Â,ïufA䞟ub=àšîõáI%(`ßËý%‹È“5GMJï}Rê–=¢fÕEphíÌûiÈcƒá/Dê Ý$ÂÏ*Ll?æH78¼ ]dA&ä~‰@ýðo¼„ÍŽà`­E¨Å%ÀT÷ îÅH( Äß/£QÏøμMêšOk½W½‰ÿõ+{Sºu½!ŸÒ-¸¼ƒP- ž¬åS ÃåjBý¦É–“™&'ÙöÅbl´Ø}žÄ›¡ä­Îõr‰ax ³Y4ÜW }ñrð,ýÚ0ÛÈyç"#bÛ 3–Šä]â$ez`ëäú¿·x +îLc +Éh-R…ºªï¸ÇäðkB(Œ£ ¹lÇÕC½â3< Eݹ›ƒQ²cg%»­ÄCºKŸYÁgpä\ôU¤bBRïŠöX6ëÉ,„Âüš0R~É"Ö¸v—4¢.ßBLq9¹FJòoÌ2RwòÜo¤1²ï¨Z|/¬2u!Þç ‹‰<9 ²Åj\h1+ý%t5䩽·˜¢òeå Ø¬7C.¿ØÐ¦ÍÛ2ˆ†”H 1ó,´{è|Y£ÓíŽpÑYÊ‹±]³‚Ì׌íÉÃk÷DñEkJln~Z¾Ì;^a‘Æ„– #µ-U‚ãÌM|iÄÔì³£kß^‘R¾°†FÅõÞOÛÞÌ(qssà‹^ÜsÙ‘G!Pš=¯ÕdÕÔÛ· ÓOŠ:Á! &KWÄËø_ÒiëoÒõ7¡ µQ¸rSzAPIþsv"lK¨ù (”˜ ¥¤W + Lä>f þ‚uȆiKm%Äs?ÑT7 #±+ƒ¶× º»&Š£Þc]÷ RÒ7\ôWòiÒ™ˆý2ÝF$4KV²†¦%IDluŒÅd^¢ ’ÕEE`¢"qLœ|—䡤‘g÷+—žàÏý5ñ?eÉ\B¼ò‡õ˜{Y¸¿Ü¿EßÀFј[CÊ‚•Žîįtƒ +j&:RàZÝšý±,ÿ¶¬ÄE†|k ¤ îèì©q)ŠÙ¢>ô\dß-ç9MGÝ÷ŽÃt„<µ'¸¥¡–ÛG»­Æ“¼¥lлյà®Úàú2ìK2iÒM'#oùWˆ•ÊúÔ¦Õd±ÄÕ¥à@‰ ^pÅm“D܈SË3þà,ˆc@ª•Ñ:b4¸ƒÓÜÔ Þ‚Vg7xÙŽ|ÉïðTð€Ã‹=ùþ2&B[’uö=œê’D͇ÐFÙHK×PJdJîvÒÕ´fS³ 9Ú§&ñ¥PÕ·šÜ€äó\3ICJ6ÿø¥qA•+'S”ºDŽ…=éN07%¤¦éòuÖ7·"©Ø*GD2Ñs+Es±#+˜ú%éÆeSµÚ¬KîñøœËc³Ðš,ÔÉã9#!hæ,Ú1Ó<ªÛGv·=ÿ˜¡Õ¦[(HWÁF)ÃÚ¦MLz‘÷<µªÛ‰$ú|ÀÄJÛK…Eˆ½“æ,-‰dSûŠªZ‚КL;ñt6Eq&Œ`Òÿ\Qµ¦O…jya=Úîy7ùpÓh¡F@C§ 9…y5 -,ß6®rÏá~µNã!÷]É©y¢ˆ†ùTÿå¬>“_JA’.vâqVþ0ÏÄ0÷þBé´åŸÐˆCj+uý­ãYÒQW‡\¤VÞ%CXgÍÇ¸É +h:(ð²ÜÛ+÷ @L”„ ×ݺ·ImsØîòî/Ÿ«DQ@C˜•$»$qÕïtñÃL.6_&·Š`¶é9;Ÿ AÅa+Ù,˜dËx$á>Ñ×kŽ‘Ýo¶[~à<íŒ3$¼åtãCƒ”û“ñ’*R˜ê¥Ä®[ š³~xó‰sxDTJBwK{vêFe!=[#ôeSã +ª<Àè¤^„="³{€2êwS£³he`kt]?1†cô¹,EvÓ¹R“ÔÛI¦I«P‡·ô'ƒtª¦Ù8B! Ìr-‘ÕfOj—7ºz`„¹­Þ‚fW3‘æÆÿîódȰÀN (Ì­Àízvg?¢³1–,ÔZ,Ï +–ReÝ7X®‹ÞŠ`ÒõËšÐÄß-ÁûgÁ¸EͶ+ZoiÇšNÂzš­p8ªNix¥93^š'7Øsîê5u:qÕóH»²Ø˜ÀÁEÿM`ÁOdчÁ<™æÆTG:é!¢B±˜KÃX7±N´-£H4qÄõ™&?±ä 9¥DãóU×ÐöÉf§|_ ÄGØÈ=@-¢áþVYçâÈdŠ2''ùð{ßÖ”°ˆåÉ–ñ3úÚä¨N4LÕÌ¡YENQ=Fõ”bÓ»ZÓͨ^vÃŒsߣšK„äú*‚r‰ÔÇ_iœ€Uj!°ÒϦµA2 Cq9\ÐéMê~íñæS 5iº™°Õqܽ҉9x°n?ÃÃúGt{^ΘÑõ¬ò“–iFˆ¼SU5hV|é}ÀöŒ%þ´ÎsÉ*9˜;ÿÖÒCäú;Àóád‡Ôõš`b¹§Óz§ Ù¶60ÈÌ:õ߉¥¤>`sŒTj—/ñˇ©ò?V.‘ ¢|÷†EFçÌîC0»Ø”¯;=‡J¦!s Gwðrà‹{ŠöÓÖOõ`ìÈ'i@ƒC‘¬ždaÚ +SºÚê ÚŠRœÉU¸å +í=Xéh¦uŠþ3™*ðF›d¦s6ý…I5cJæ™pÕF&“žYÖ[{ÛŸ­è¡e…»°'BŸžÍn …}Yè[¹qG&ÈfŸ +²x;-@Üfd=+Ú‰ÄôC*ªd&f˜k íÒø‚€Eûx¦½Gˆ Ô'bvÎöòÆ…-:z§AÕ(¥ûk5Ì,:)2Ò ÐÆÀñçãÀú•Ôô¢^ 'aÐMmý;âp×r ¢á¹“cJ]Ú/UééLt \®L]èCâ„òâÒ'uÛ›n†‚~˜Ž?-»Á*ÝœÎô©Îòر‰jÁå h„µ,‚ ÚøÑ¾„óÏ©]jTñøM¨Î>nŒ’ˆ8½{ß;ï7«wáX/AÿŠÈ›(ä,s(pe¤¨ +æ@ƒªsCçò† •aÄÞ*øßx5ÎèeÔÙ€ +šJ&Ó£/F1w£åŠJQ$•pgó2ÔüpzsšI‹é¬ù®¦ ò¹ÓËjõܘӋšWF—´°%Cö¤£€wcšjŽŸîå /O*í2CÚ†CW4Üä¥`’`;ÙŸ…–’TçâcD³±p65ÚÚ¬];&v‘Fäu_¼Ð%-ÿ3¨rÖ'¬Q€fm£\MÒ‹JY:ºŠœ×ŠÝZõµˆy¹³e†Çx ÷¬7Š)klí¦ˆAÂ0ÿ(ZpæcÁ‰‚Hmë· ø4«¯RóçJVø UçzÂ3¶ÙD·Å‰ÔBY)xó,%²ÔZ˜ˆ«†\«´M{WKyrתë:ÿ;óOkz¡8às éUðD(~ç¥,žÄJ]4¹u‹‹ôË•”. ¦:fÌ5fÓM,Ï]p¦Uj fÛŠ4÷êog€ÈÙ\CC€îïÔËùûÝ*ätúgÙ—:“ñÝPY~7¬·?¯b¡ƒ´Ð0­r8G±“d)65ë%Fœü’›žß10e9k÷LKè¤sðÚB"+›¾¼îrŠéV?­Z2º$–2`þÒÃI‹‘ØKû°ô?‡ˆñ=b3¹[þ+¡B.Uøý:œz.*nèî0³~×ôa’\®¶Ì00“qSÉV>ï¨É¨y–¿¯\YÙÂnFDàœ³çëLˆFÿy냛HÝsåkÔß[U_µkç¶ë¼Ô“é›,ƒƒ«NY„ À‚}dׂ©:üø‰ Úyn²b¬xÛ4ÛÁ¼ë$FV‡K¹W2¼¢À™.ë3† ‘B¬¬)Wűë«B;~Qœ¬Iu :\;K0xqM‚-f |îþÂLJ¬öï¸rÒMŽW#1‰ "Z;Ú=~ÁÉ~¶bÑG¹;¤¦«Û.?«”$Á:ûå8|­ûÛãðd8ö埨o:|‰åŸ­zŠxùQÚÑAÅDaT °(]ÉI a×Û4z’& SKú D‰µ¡¤`Ô+Ad2×ñFd dPì9^wTº’)’y(RCìë=]HE:3À]¸ +Û¸CË«Dõtý™Eb5¢!ÒùôŒûK½´ÒæÈÀ":Õ>td ,ľÛÊñd)YŒ1w‘ÌoÕqÜܹ­ã%ƒ=¦G£¢³$Ég3N?Ø÷ë…^|èK îò'éwcÈA«— Çz_¦1¶í13µB0¸xãunÃ88vèÀM›ìâ@:”€ôÝóý”äS¡àA¬­ûûe&çâ—‡7‹É†2Ø€ HÆM„Né?ºoÇHÐCô^–§Ñ +Á,Å\—‡åܳç¿6îCiêfœü#N•Ó×·åI²=X…SÁÇ3š¨%^6¶¹5¹Ÿ@ý…íBÄø€n@½·!3ªŸÌTÆVf§MèßùÒâUÞ–©qÀ=qí_:åíf¬‚°OJžÖrºÒÁÇö•€U¢-©#ò[Piÿ%ÄB0¨N¯ö‘:ÇSµBÈCÞ*@a£ŽK-8B2šª²,Ä–8´î¦…. ó—o¿y„ ò„=wÜÚË>ß÷YOOFæ{½ +UîÖÊìˆà«5exÁmK)šÞΠÒl¾+ö.  R9´ùñt y¨\u¬ZˆžÊkB·*l±lÀàd_¿ôW…Úä‡"-JÆ£ÊÄ©œ3@zð'ó,å«Bfúìyí$‡ÅÆiü…Íî-˜P-ó& r>!ÿ¤œ§ÔØ^«pÛæ$Ù°Ôè"³\BIµF]ÞÖqn¾õ¾-ô‘d¦PŒÂ£%ÓP‰Æg` +%÷Rgáæ²:ÄÿÓ²»×ÿLU»žú ++dŽÜœÌ9<]Á À(Öæo,04 +ÝÙÛÛ3eÆŸ6­ÁÇû÷Â)r&Âå!§Ä4;Ô1ã)V±ôŸ:NQ +b±‚´Û½À +/‰è½ó]Õ"ñÌ4)dË3ÄžÞFÏ(£XÁÒ› ¦7Œô,zT¯¤é„Û"V ¤“ÀkV Çà‹Úþ’¨cþ–»-¬¦ì–\ýàš¥­C†÷U›­²Ù¿I`ç7”\ˆàèIV§,tV㳂lnÁßøT*çÞ6´õ=™xŸ“ê +-†î"'›BÌP +rD8½ >6 ¸f¸¢o:Ñ€¤¿±£þ1EQÝbÌh•Ì=f\%ƒá@”A‘“ÈØ™ö93Ø øŸÌ +–Ù°A™2ò6 +P®W—È"û.ò9”„ÀØ„¸CNj¯D.¹³4ËâB:÷Œô6õCiÊèVfýY¡X¥ðpìMw¥w¹tú]C + +¿k°WÏ4+LÆjlZJŒ<̯³Ù»(Ö$üŽé'PS:_ÔV¸NÂw¦Öm6V¡DXE…¶HYÞj•’&û*éX£ $ØJYl ¶ÕJ¾°§Ð«úˆg«ÇY»ððèNŒ+EÛ»ð¨ È©{ bƒˆãsêZ…ñ!&±)̨˜ßGÅA)‚Hõ“Ô 8ÎN{Ò˜ËCì3‡3Nɨ$«×Añ1”mÅ ÒpV”JØç×)…“*QI“Áü=’å:÷h„eÀIÅ÷ýf8|¤«£Š?Ã9î -‘4‰E„>%Â3¼ ¥§0ÚBM¦ù¹ƒBЉ°¦#¡1h÷ÔôI*"[*†T¶‹Á‡j§Ýj¤2ͽòì#zdv=+Høõ‘]¦bÎ'-ˆl¾]µXa¾ès Õâdl3-Öˆôí„™·…iBÙ•™o¨™D½æ:TõPbÅ„„4ó„Â4BJ2Žs¨Φôvø +žTRÍŒ´u,9&Ìc¦ª¦J¢hHuÉÂÂÉØ²‘̓ +‰Øx‡]¼¤Œâ3³«„‚b>äéD©òÞÝ#{‚̈áÍhaKwÆc4×*SYФåÛâsJ<Å2‘‰“¢ËPdS¯³QUGl Æ'L¼®8|hÄîë:êJ“ m•ò4¾„j>wD‘=T"¿Œ”1JxØ›ãb„Tp±!5£[ÝŸgKEÖ9>à QÁ\áDtº ®XYQªÁTÜàn8AR"ŠUECj ¡ãEþžØÎiÉ<}oÈ©âU¶Ç“ÀØf×-yøÿ¾‘R¥­VŒdËKªh‘q‰xU±¹†œ ×kCÖN&.RžIO*ûx‰œL¨:BS¥€pð ,pð p±+u×L«Þ ƒ4ªÐ×*ðÔŠÀÁ |àdp.€€8Á˜€`ð€hà +p€D  J`@ >ЈàLÀÂt8 Á$àBÂàh‚ °À#(À 0¸ @Ï[k&’·AZ›ÚàS‰ò¯ PÁÌ‚¾ E¿$PAȃ ZôI¿¾ê+$¨2u 9DrÆdZŽa9Ô¨ÕQ5㚊œN3IüÁE(Ž YDÌ7¢ØÏG¦CG¨\ÆfG¨#,}%/)‰/“2\NKÂ/ú£8ç_ñ9¬˜D—„¬ë¨ˆyˆ–©Lxê¢âØ[ƒÌ®6žŠj”³ _lpuc͸ó¡"Vˆ¦Jõ"ƒ,B#a ñC"3£"ŸSa '¼/O„FŽ*URB‘G’|æt’-”¦Jã\hŠD4RzÐÏy ¤@²Ê5õÇ:+ÎL´RnQ+ŠÔ9Cª–>óJ̉Ô×$ÃÅû†©c¢tò%\H +îÂÁíŠÎ© ­´¬—eÚSq¡…VȕоâºDhÝ \é̋‚¾!¥¦<µ_65q†ÃÔ½FÍtˆyS™Êý28Ãk{04~ìjyt§(æ5ÜŒfmà´ï\ä#wØÜ±?V~…r㞥UóþBÃÍ‹u"Ë', tª`XÜüo@僦Ç#$ö>Šè©I±H€8@' +P èØ€ƒË©»ÀTj6³”Ö€ª<T€ À PÁR `(p 4ÀAˆ` ÐÀ*àÀ`€ +° ‚'ÏDü¢?hTƒ;£BÒîÁ² ‰bÉtšÖÈ[’l^“ÆŽ\m£}l1&µñƨp+#å@Á•]!J†òn'¡‡º†±SE1A‚DÓàUN\¿PBOB-Sm ‡Ñô.ߣ`8YV#±XV÷±!dbÿTƒ}óGƒG*$̘å¨q‰ï"ªáýDªÔ4>,i}ªQ‰^èÙEêmT±‚´g¶shÎÐD0¤X1‰šJš+JKÿEaï˜3ÉCJXW‚ôÀ­"**hiU!²‡êñõ …¨ÀÅY¿§$X¤üÁ§0éžJ‘ÙnXˆ6~ê$5ót +î„1ÖaEzl<ê¿E×’_á^TšsV#ê„VM•… L$¥Ád4zâÄHˆÎ8ªlÖbáß|ä˜GYøf¼wΧul¨;U(ËDá"‰Imú³…JwL…þñaRÕ ¤%•à±@ ù*cÖ7°pá«ÁOžCTDu¨2:uȸJ¥ñzÕÀU–,$aƯAX L³ Q6²ŸRÊŽ„ŠÐÜ’@ZlV]X0QÔ›½Ó +$ˆC.@cÃ4 pU¨DE9 +™Ñè3À) Éãñ0O´%z u2"  +JNX F¡UŒ@šJuÀþ»Ÿ:›ô§j •ø 8ªóÿ8hÿ£ä—ÆñfO2…ìêKµX€¨ŽqîEz¶Ý­\µ\Úˆƒ„ S`ƒOÅaÜ‘]ES +W_:“'j¸T.jó#CHÂå›){bg2d+š(…*Ë+½'@HÈM¬f“¤¨ëÝSæTl‚ç{t rÂkYdGÎûÃ¥Û¤Ú^kÑàI §ƒ—ÁÙê7“%ó_™Ó×âg×h_†ADxG8ªaD©Ælí ¶£ˆâ mI"„ÂÁWðK×ù„ö1L#â~ëŸæI@{yJpvR,jq¢›j`r†éŒò¬|¢pp¯³–M-éüEv6±ÌRJÎ]4((‹’nœpXºB]ãU'LÂÒ -«¿ «Óöƒž•Ø™S9ê  _¹ŠÓy]äþöþÒ&š,-ÊB± pÔä4)>PØDWü¬–@@}¯ƒÈ¸¯½"vàXñ!·4T-$OËš?ëÃܬ¥/Õ Žyï{ì_ñªì —®ÖjOEq' ÈÁ¹êųäRbZ""”ïOsP bãHzK‡ÿ½ôiÚGÿ½—7šÏ{B†¯ h9ÈÌ̪ýª‰óå>^¶ý¥:.TM$ñp(”Üß \5Uºüýʳ÷Q¢ðÁ1M„€F×mû8¸ØÕ¾%“f–D«Ä¹ÈÖ6¥ô"ì¢f<'r§àc ýP‚G dzPk (Z„„-ó¹6§c½uå{ߨiµRœGoe?ŒGßl&Ã3­ŒŸ®üÃÍkÊ|„8Œº¦!‘‡âX¦€þ± j5˜Pk’¤±R¿‡ßñ›Z +;@ä~ã,Ë¢ƆßÅmÈk% µACˆ8¡™Bóç7vqGúSSpNwàBe3Á×¼®Kµ!¯Í@² +E}îÝÆ7p+³ÛíR¶Rƈ„‡SºF‚Af÷6K~%¦³ &‰Z5É7QôªÂIªªj]£"-A$æ„üHo«}¤ÏÅ:q|Jî.þVôªõx+'.×ÄòÍA=¶’ù£fX (7€ÌòYx~Ü£½kMMv^i>©bÕ¸RÞ>Ô+³×yza7˜RÀµíAÉ>tC9`@ é†.WÄ“T{ƒ•ý§“Åô@ò¬ ójÒNLZŽááQª”t'þøLùC›˜IZƒ¾%ã<’~ƒâîG½ß·yp&ùbMRäÑÖ/ëÆjtüó†4;žœ‡¹¢y¬BŒ¢e%Ú1zͬšDxë;Îk²l“AM!FRÛPIpOÓñ‘K}NpàÇœu^¥v”Hnó³Ø]$Σ“pHLé§á>âʆI¡¸úGB´«þyìF_á}^H_ƒKu%Ô†è¸Ï ÁÀI¿(w«á?Z.¤öÑv@ÇXɾѕљÉè6 ì«.d í°¹Rb iŸ6’Ђ Íí\~$éïtpšÂ>ŽŸõêõRÙL,\¨¹> ¬!ȸ„î/<&õóô7râ=yá|agð2§Öв‚’j§/ªDÔH®y¸UõTOElByTíOp‰q‰Àfý‘¨ŒwE ÎÂm(سŒ{Rÿñ“6Ñð$á<£§ …ÖlÁ¦ØGÄÃ,l"i-+*H^‚@9&ó»E£L^25´Ô—ñåÑ`¨ßx‡æŠ[NNóê@•Ȧ˜ +>"+Ië¨- öެëŒÀߨiG\aYtÀ $ù$-ìò Öñ€€d`í(»§·…2=`ŒÓ:i CV$[Ghª+b,ãÚ¬Ù}‘ ²l3Ñ’€#¶E®JŽñyØ!¥ˆ +oâϯ¨XH 7#³üZ; +c4aŸ ˜ñLN!…‰vÙí ¶âïl^ÉPvs¤n=fÝé…ë¿ÒN¯#B~ dÖ#úõo<1lôhŠŽ¬oƒû½‚HpFÎødz—1žã‘`¾|\eíWÏÐ?=e*‘Æ·Þ†”$K5„TI"#—ÛZ>=l÷ãøX!muQ~I*üítêòž¶e0J,á“€<5믎§! "ÎtÆY`¡³›Q&VÈœZ#[S§qÄæ}0CÜpb¶9‰›ØŠÖ+’"Ø%ï.0ÿÇÙˆX/VL¥}90‘}™èQ«:D) Ë ¼"Ðx…f@Ã~E¼Ô¯Ö0/=ÅÙ7Ã×#Ã膤è»ëÍüW+i] ¸Ok·»Vš,bü—‰¿ÞÂ-艦ô 8ÅÔ Ñ5çâë“ôò;¯…HE‰ Š ûoÚ‘Þ‹¿¦ÞŠeIða5øb?Žž×¶4ý( ¶98 jæŒÞ "{—Œ\% ,I¨#u“9‡:þdG]ü“~Ÿtˆß#+´›øÜÇJº!‡B#kLÒá±O Ýl‰ŸÐ§¡Àkè•7j3a2N æMŽIÿ, ãï<^êè½S¡´2ÛF Ø!Óümo4÷÷DÕ×Û¨ëFå#¹@m²¨¡Ho5ÞÉ~£ Ø¡¹b™Ðž6Î oKnƒqÔØ=1‹m A¬ÄGŽðçÌ_„DÅLˆPU3ÚáYé'Zj¦p³å9Ÿs0™i º„ñD+Àñ: ºqQÒbM„,ÂâzçÆW‘#šN;=-od¢NV›ÖwÞ¨ÙÄDø?añÐÆSϲ>íR "“IW7Î’u ‘,À©î† À0îOíÝ͘L͉€¬avÑE!0ž®¿þtµëÒQ¶Ra‰I¦¤"*ÌJÇÉN'‘|Ç«»ÒUâ­#^B¡Ó„¯k;#þ6ö9ªW¤©êÙ d„ãWËH8XJ{jO!ÇAumZ>|{:=¼ðŽ gaà WÏOBèø•»Åã\­CÉl ?Õôp$€Âye@ßH’kÔÉGÇ•UËBÒÈ~5rU”4–E©‚6·ª U&Â2lÕ%K7¬&þ´Tù ˜ÃdÅUü¨©"î—ý +ч38}&bü¹aÒJGMeL$ÂDøèø¶:R;¾‰²­Há™ã¯íkŒœ`?>PÌ.±j¡è¥ã‘ÚlÃG„£1jº&ˆtŒ©^?åSƒpbížðÆú€v[†-¡ä™Üñd~‰¯O êºäóT’k:ó‰‚õ"$•œ7ä24Ñ]â(€×ßF¾¸wÔn‘ÊŽÚ+•¨$KmÁN Á#­ÚY‰§Îc•rn©gÌ4Z”_Æ<Áš®óèÉ6aøJø*£¦k‚à]F›a>"!v­i“Yh‰¢ãa¦“¬&,ÇnžYmQÙÜ|c"b”ѺÅ45¬ãáQlËXr>$¶’G4ª7cÓè8/b½ Õ‘[YuŠEÓj´"Š=FI@VD™d é»Qnìz #¼õgÚ YI¶e8T¦¿Ø $öM#†R´9òlð­”­“d zìZPÆbøÄ½”S„žzÂ…â¿xç¼-v-ŸÒ½ñˆáÐøýÌh*>56ÖlR ŸìÈ[¤ç óÀBNiÄq +‰òÁæO*lƒÆ>ªà|¢)ª D4b/\Â]ê§Õiôäš ü!üŒÑÓ5Aò‚"j¤Œ}¼§Â*µs—V°0%“#¯¬|æuÒÈíPŒ4¼„³Õ ÃRÒ&—ÖN£.Â,TzTU%fKzÅZÃ9©•Rì‘ò²s°Wsu‚ÉcÒkn‘\ıÄÚM‚j:ǮϣЙ~É]7F¶G$I.kðâˆzl½TnN3#yë=zÚ&6<%œetéB„÷ÛPaGÒç’æQ2nOc¥@fÊM§›^EqouÝKT{ijé--õæS‘ú+ BH.Ô舟òߦdI +\9F ÎÊ9ˆÌsê˜ô·°ƒÍq&[P +›¯hÏ1ÿ®^þ¦s'GïÑ{—!ìE#*N=Gµ,\b˜/mé ì +Ì˪qøÄ“ªÙ!ŒrˆÊкc?îÊéÿL†Šš :œ+#?á;¥rÁ’Nžû¥åº¤hêâ•}ÑÏ-òý‰±¥b’ReÛc¯¿/Bû£Äȯä0JœÚ®€ëÇ0-hÌ)[`H…$Ûë2`£é{þT®[¶yÒ™ìg»!­ÅE<Òo»bâ·åîÎÎûTÊ4²clˆˆâ}d‡ú)N ”r@Nͤˆ;Ì—b‰Ëyè`ÊÍ.¬é–+n·ª:wóhadf¯æTXq3# ŸºCž¹.ú]¨z¿¯ï'ne!ʰtà+·Uƒ‹{³À°ìÙºb’LË Se €ýv5Qb_•¡+pcDùÄØ6Ñ*] ;øÌµ—Äw‚Ú¥Ïä˸¾ýY&½É”¬cÌ2ÿ„vˆÞ46B®VµðFïuE˜Ð²ŒÓ¸RD69æÐ6? *3„æÁ¿2mA5Ì]­:Ô]‘€aÃJ2N“—\×ÙÒé\™ŠIT¨åøáD!l‰ÑäiJmó. 9Ô‡g-m@ +A`³R“êTƒÆîÚç¿Uò37ˆE ŠGÈLå'Õ Qo o’‘M8Aod£<KšÙ ÎP•'7Ìjã ^nÌMB¶"$¯o®JWÌ ž.ÍF—FyZlÆÒ<šfãÐ/ôù'Ç¥ñg¯tÅm³ãÌ¢xŠö¬Ï’Ê†Þ Ô‚‹©;ÏQÖr ×½‹UMøV8áÌøÉ;F@aJ +¤‘ ‘t56îi[;ïÑ +a; ´91ű+zäážåƒ©7±ãöðÐMòÄæXŸŠ\é)ôXCÒ¡–=÷`ÀvOi[iÅ!ãñxåÖSå–‹ãFK—fÑË3t’ËcÐÆS1ÄÇü2hOüæäCøx*NYìzÞo’ä#ÕxPçf áÓ&Mgñ!‹&Eìåšš#2eá7ˆ®{OíÉè™}²]µ‰óJÉF×°È;ö@Ù>* +zZ‡ÃEÿ€•Yöµø”]LøS6„†[D˜ÈgPtÐ{\¤ìµUŸZLù‚nÚÜBI”n;­­¹K)£˜È‘ ÐkcHX›¤9"I/@.±QöÇC«§ SÞ€o“Îþã¡ITg 5(©Úå2±a6Ìê³ão›=ãÏÇ +³]Öõj+¾_´ò¤2Y2&/ ‰i÷º¯ §+‡{Î}PCW¾ÑÉ¿œ™bƒúü’\ƒ5Ë„›_D¯£¹j.7¨¸'#?lw<¢ +ú9Û™L/ßÑÃ7òÃÉpˆ)1útÜà;ZYòµ2k>†£–Ò¢ÃåœA´È£EOGÂ…¸H¤¡ÚÄ¢ˆzd›ô­Ùd O5Ó¸¼5–yžvÏHÚ»ŽNJo+gÌKøœñ9J¨˜[}¹Cb¨¯3,(å@9ðu"¬å“NwÉÈñ–SŽQ‰èô  ¹jäù‰T¥‘•×W)iµˆ®…RmZòíMZ±´¿Ùš˜¤•v©#/›½Ìnb©Qç lE¯Ã‡ºN]‚˜åª¬»«ÕO/ùo +é·Q ‡-´j¿Ô\XO'+V}5Ý×ÒGR«Sr³´ÊŠ +U®?ˆçŽåäŽLí.àÕ,OT˼ •d©BŸ«T Shϱ]ÒØN + Jœëƒã˜Õª\éäo{ +ÌõKˆôI{é~WÒ&O1ãGkt—µãÂ肋÷!ä?1auãiFg#?ò-ë‹{}8" 0×R Æ«vWòõ+ýŒƒ¾‘­ìQáîuŠßÙ±…n¸’+Ãþ#–w€®‹Ø%ÙicT©0lšpVÆù¿ë΄Þ{ Ò—oyXÊ™k[8­1éNâ¹fí-pÐIÚ•©?˜‹FBÊeW.É”•ͱ\<©äsÆ_aºšWÿìŸ35ZÊ–¶¿<¸ + +½V‹ nxŒ/Þdwu˜²áhhr!4ƒ÷ºh[‡2‘"NQ¼ñs¯¹‡Ø©øâãÞThwÔXœuÙ}Ѿ (Q¾ É!¡Û¦Éî÷åË -ÁŠkÆ—â]úÐm®lg»åH:~§Á¹Âo…:™'δ6B¾ÀÆ/¥¥(L#/»$šÕðLmÉuú¥’4¦9‚É:(zŒŸ‡XYòŠMå@ô@’™?AXòŸ´˜ðî꾨aÞW¹Ð xÓ#T$„8t ù§ÌêI0CÿWÇqh8lÙ6öœó:˜aëâ«©ÍoÉP‰: %»Y‹>‡ÃÙÓÙ± :Wé|¦™¹Ï¥Ñ{Òø )¬£ªc7‚ój!/²ùâèæ:Öà{¿•-ɵ‹+;jJÌœÐ>îÈŒ\Ez¶Šµέv]jQ®{b)dµ–f“‚1mª… Ù2Ðx%ϧ%lcujùój³Ïh€ÎoXo*ø©PÆoE63oëŠH³}à(Ž^Ì~!;_éñîrµÔÃçd¦õ…§;é4‚G\Ø~±¾yÁb g4Á,¥qåÀ@¹±ÌèÚ­ø™$¥‰ÙênâÜ/è˜\Š@O;þEÝz§ÐjƒXê·üd¡ðÌn1Ç’$éµ:Ü×&žáñn‚æÁS†K•¼»ÖŽÑ$Æ2Š8ωB*‘—Lµ?Kê¨Ð¸dz.UóîkN+(EüD38Zð™!!g¼ ˜ó¡4¬ó)0Å[?™sèÅ øn¥òîXk²?$ç}˜A‡§¦Ó%£þÐ +ä/I6œÉ’îÏ! Ò‹S $Ù:Ðõ½Jg»êïã}š’‹ÒíöþZËÅÞÐ÷÷ÓôùÐùwr»H6§XÐn‹Ã©˜>)Ë”|@O*ØP¤ªKí +’—ꎕ,òù=t‘wúßs4<‹É,™llYÇInq*ÔU > %EH•H}ä¨ç5Òo³1&E”;òfÁ¨I´BÔi'ÅyMVjñ7ê¢Dê8–ií£¶$‹@%|hoå2Œ±Ëåµ ''ùYñ“ªt›æ¯ë€ù¶‘È ÷@áÓTÖÁð.B]5¸þøàUÀöT+ÃT%þ”o²*„–;G >¡:äºj¥ªœ©íSu[M’þ ÕÌ +¢‰ZÛK445ÿ×ßç†ö;hUì=È>÷)›žME´–Nú4·8[|éÖ@ÏõI– è÷ò0LrÛ£gmPË&ºÉpNÚ¸m[‚ŒQ›B¯Œ<:5y­Š‘ÞjÒlÓyX3dº¬,»EŽª8oÌyâtÌ(º&ÛØû÷–KÔ…½`€µ:¿ø0OUÙI»ÒÎÜÀŸXþ3ÕH~Fˆ L µ½"ŹŽÃÀZwè‚¢Dêy6¢s×È6é6§ªÏ=ÚV»(w‡€•µ&{ë•í|‡z´3¨å¢H Œ×.ÜØ¢ñ–Dñ4•FÖ +x†`+`†ü$e–˜U ÿ“[•e- ‡þìíV÷cuÎúŸ øN°Ïþ”<övSñ†Já!l"íl[åNå­ú+HIä¼vèÊ:‹-|ÿIôÿé-“¹<™å#Љؙú +Óµ’ŠdhbÚÃH’«US$VHØUD¢>ÿÉ£›°ë+Òú*×@T•Dÿl¬qïŽYÍgNæ¼ÄHUƒH–9˜V£¯ÄP¯äµ#¦É|Ëzí;“ô8CWa`ûªõ3>¨óºZ2’4Â]–mç‰ ¸3›“ÕR×brÄ©û4˜òL,l£¢ ®r9øÇ²ÍçËÌùg ´›/ÓÎ5X?ë‰%€BòI¢I'³FD¸ê}Ü ÃA®ž’ Gƒ´{T˜”ƒKÇYR%tátPSZA:¦À ñÖyÏså§ÜUY…5S÷U’ÁÎP 3¸yá(™@€ZÅ­vAzºˆSÀ³º„{5åô)ã5 ܄޳?%õ—$³À¿PB[drÈ¡X‘ƒ‹—cxG ú$Ôã†$†5,)±?2h/+îÐA-'YÞáïôõg,ÿs)Ø¿¨Vjÿ!=Aff3NI2ÃÁÈ›ß]¬†&ö’ÜänQí8:Œªá„Z¹Ïµ5Ôaëð¹f5;™)­“Ÿ;ÙŠ4¯¬#y”Ùé1}÷ðç Y´$rWÁ9gT’ÌçWÖ—|+6´¦ï"õg32r³jÊï XÎ@K,šôœ·`6 !ç]2ûkŒ[=|MâŠ0¼d Á€IPn£IÂÄ€ò +4"„üÚ‡è£Hòe94ÓÐA*…ºG ÞCI}ÄK­rˆ2ðÙßU^rs4!´q |ñxÉ~I+±á 8 I× ™F  Ä«öÑ Ø4Z®š‘ÑZÅA¢{ÖÃ@Ôꬢ kªŠ€a• ±–$²¬ˆ›BÁ`*ü·’alGg£Û!©eà“sCàÆeuQJÀ鮕ûqË`Y[8g˜Ç]4÷ûúØ©¥´äwˆ­‘[Ú^Í„‹˜ï€¹¾Ý¹T”»S6…{Ì“ zC6¦M,¿50ȳÁ™öÉz騾ɨ°¨ÝLþ>4&ƒ [íP?Ž™³‚D.ùÉÐpÖu~„¥Ê–’Ã,èíï¾’5´uT÷냯ë(+Ë“pìP“‘Œ¥LBz&ž<¦Ÿê Ì`2HM®˜2BŸsÒÆý먲™_N}Nžq›íÌ ¶1î”{’šåèý¯qÏNjkÝ“”Nþ¸zY³çdœ¿¶xô3…øjˆ¿0;’íz™n•¸dùªe¿KûÄT=CÏ‹"%E†Ã•ör÷š=å1ºSoä‚ÔŠ/=tÃ_šwtn㑘L7â¨U Óf2çäŒP|à{¯Ç7p¤i5dé˜,÷t]Hqû‚WMMܹä#¢Ó­‚î¸b:Äꎇþ5²LßpÝYÖ”ãiÒò&zÓMRî†ã0€|̴䩎a¢ˆ‘îr +¼gkv@€´öôadñÚ¤’Á)%†„nÄt¸6QçvºŠZ˜¶ŽùcåÉ÷“¯?ᩈpÕûcý…azÓ6KIÖ–›¡ªø+X,ðXî^ýe2Ò_?ME*¼7 ¸;$=oÄ,5aVU✿Và5.ÌWž‹Tïw \éM°t˜…Ñ‹zF'RO™ëÍœ¼\Ê`1ÈCÈ×UwnÀþn ¯ÔÞÙ_ÛÇhåµ·k¬üäð2ºñ¯Ú½…½ìà°¿®p;°ï7×U”忟¹1YuÙ¶«X‘:y«Ò—8*uÓ¼InYÛ¾Úœ©6(û×e¡WÛÛÝ3FlFRCn]kãÓGÜ/ùëip¦/ïm&?'9PuÐ4܆²±~¥m» SQçµa¤P©ß?"qÞ‚­-ÇÈr_4V=÷ÅDûÎpu1n¡W“0úp…Ç·ë!ÁŽx†©üáˆ"u`pа*®Æ1Ál3Ýÿ’jí o4?Æý¦ÅŸkgüÇä˜1¹™’l^D½LZQû¯ª‚\‚"¥ÃD’xÊ•§ï¾ÿæ•+ú¯Ó‘9O:¾Å~eâ¢Ìÿ¯ÿîâÊÛ9á÷d¢" 2D{LI Úê,½gåf‘$c„ãÔ2ÂÅHËfõY“‘qKñ +0Ä»•îO‡z ¬»ãÚ¡I‘cc2·±¦‚8ŸÛÓÌ:hžR¦oöÚG>`º©Êñ87sžeü¢­tç·Vð7Ó±(èV±`¬§—¿±½I®T¬à°#:KM(ü®Ý«MáÕÜ^g q+e«!ôª“K àìH¯G-ÄNkvM(µ€‘Jõ »rͪŒ‘În]ÜŠ·gG‹ôESÄ"™Dæ_ðÇ­ËETÞ÷@J¬•ìºåÌõqSù)à)ŒÔœöR…Bm¸À ¦à6.ýjŠýË¡S¾×æ°ö²Eùb¦ª8½½ëõc°’aò>+VÃS©Ùƒˆ®'R+¦D…ÎTõ^ ° \RÔÐÆìvÖ£}x¦«©¬ì$WÅAAW[ì­k’äМ)%ØS¼Îa+òO1Ö÷ÏtŸò›)Ì‚üˆ“úû1À§¿uËQ™e +È-t àÞê.š;Ý`"K G1«Ã*n¡µ÷R‚~Í0š7•_bV(­j_pvò€ŒnÝQ24\ô­ÄÉ0PdôjùÀÓMXɤÈ$„(4¤,[ ‹rü +£—qøb\-wP$_½ÿ3¢˜H,w’ê ¶G®·¡:€NyÖ=¢‘壟ÀïÓ§§«ë›ô” öd"&wTæÁ‘—zšöh‹,ÈÒ„˜õIüðþõú•ä!° my€4Þ€SóÒsTÑ”ÞíöÈ •õ¶x“Æž„¯Tш<É6‡[ðÁó®éÃU\x“çoMoÀÛ@@½‰œß÷…^’޽†3kž9 [C’¬+žúá €N\}>¥Qå²CÁ²)¼g_×ð7Ü!ž2àŒDopz&Ai¢0NÞ²þ1£:w øt^§CA­ŽB´HžBˆ8NY˜$&ì+ç0L•¾ †éaj/†£ž÷JQ*3w³r‰pÕ'Ù„ý¾`³¸`{U²¢€.#N”A?$¦Æ9E[³&9áî +#.68”£ºÅæhnlM1ÒlM‰þ,Bz`ð^²O´›XZ[Î0[p³z=Àtôö¡†b—’/Ùë+5ºÒ#Ñ +% /®Ï$º ÷Hò±… ñ¹uß­LæÊF=['ôÓ*ç[ T6ØüvæÅ¡JUÖ@ê*+7 àmå4@Œ2>ùwªBTíÂ~GqŒ×cCÄ- ×øñ]¨Ak“E÷4]|ìŠS;æ Óo‘ò;$#–tRñôݰɧw„ZŸ ©ÈvÙ’c* %ï~KUW¢9-‹ê†,ÄÝÍ·íÇ|wŒ‚§q«upz7fÍ~AÏJˆ>õTbŸ§5çi´§Ð©uoW7EݾíôœÄ˜Ê]j"–ÆQƒsN‰·ë¸JkŒ ÿÜIÈ©/R@¾$õÓdjZ¶¢HAÁÊüv)3æí÷ሓ@%UU~ƒ:qÿßÑ>Û€ifA}_Ëë‘P…¡  R3ñ£6”àŠ“Ì÷6B1zWIt¤d)4tgkÒ #+2y¸þHmâÄ·¡€º‚Z ¦’vˆUøè•]þ›HR“Ô›Lš®ïè¡|x¤ ˜yÛM~p*ókPv3­~Ñ󆫤Q&||ì6Cf©qoD÷£bD +ÇD-Jeá>Õ@”ð¤ƒãèí ì¼ %~¥‚}¡ÙZ2W”»Ù+M UõmBB¤:);rQ +5%|Ÿº2ó,ÃsP"5PuÍ‹E^¥ÛlßK¶L÷×§œÿˆTvìòY¹7§&ÄN +ç V °@AØÄÖ$¤G +…ÒDb+sHº’Ò¡Šúí¥bÐÑ B90P}ªRʄŖR§p¥ó€ž†Â‡sŽ}œB,0gÓßÚ:á(tNm¸c É|Ûüú´ò‡ZžÐäÝQÌU +¶Úݸ‹Z‚³)ÁÖ³]Þ” ûT]"7A¶´žÞ2_( N×{1  øj‹ÓÓ1Ó›)Æž3lP$v–ëƒ1èG–ÃÅ€I8âÓVàÚQ;€{ÅHϰÄhSýO èL?û?\3”8Ÿ!·UŒ|«š7Ž£Éw¢žj‡¶…ÆàjpþqsÔ­ÓTÜ´.<ê¥'¡z‰ ê{ fÒãÚë 91ÆyúV™3†Wã‚…ˆ =º N›õn¢±™¬b!n5ÿIB¹N¤ƒ!„ߨ%pÖáJ!ï×’šø—+#r#í¢Š[Wk +ÄG&þqWìüΟ !¯ØÇÙ^$Ù)B*4´ÙîÈ#«j¾&¹Ïù©©ž‰wâϽ?ƒÒ¢ú#B +&*e×ñí/Þª¡äïd€ð¸ÿ¾×µ8´<¤ÏR–O»x{_ž›Áâ­‡;P· ½×Ó>…tË“ˆŸéöR®ºƒVÿ,fþDÊØ¦+&.A_³N˜qŸF Ø\ŸV3®NªJ¹Côrf›\ÆÈtàâ©Ü+t®ŽT›²4M‡„=<®:œ*ðŽIì"Cï0ÒY+5``®ò†‘æ€é°Û3œ—Õ‰”ú¼zM!„‚Z2%ðÔÈÞ!=fÛzUÙ+Ýè­#0ɦª]™Šh(*ö–q þ8ìà™ î +¶3yÙlÑ ß|Ó¸¬€ØZ…*œÍg¡b"ˆžxåÖ +Âeißç¶gäƒIFC.ÎãðûEr§A´ºšY­Ð8#·¤±4FødëžS8’¯c‡³ˆª£¡Š¢¹Èj•"Ìõ#ÞDƒ©Â·õà‹ŽÙåSÎ)&ž¿pÂRûLò}<*mT"Ùsô͘ÉÚD F‘ºµ3ùf­[V©Ú…} C/ÔòòŸP5¡ÿ«c[ÜÈýPS=uAu§ªµ…_=Ùø@,ñº0fDÔTûÌ"Å=•ý‚שUvN¸LÊãã\¢$"7vù=Š—¶þ½@Á¢z¼=²£1·dµHŒ‚<ý¢@<þž‹î›„F—õN宯*/2ÂG9 GIq…>¥êò+ Ö¤‡ë õ´M`gÚ©ultÒ>ðbm ꀆM‹d\¼ùŒãæx¾Ž»dÿMÔÏŒàW”‹€áþûÁ(äØ9OcAVäªüŒ\Ë-f£Hó4íBÄs²´ñcæÔorÇwi »xŒÇŒ›‚„YËèâ]î XÖ.Fý³M-Ç K]W §0æOéÕzhçg4þÏW»h ºÍÄÔ²I÷##$霅¼ûüyÜ—¡Mñõ3¹NNS‚nla`øUœFT’¤zo:  )V6z^û )=3à1Ø;|]tnnäÚϽf¡L˜öŸVèƒR&´P¥„ç€Hšnï%º¿äÆ™h¸\×}Œ¹ác”†á ¾8É +‹j G°"÷œÏiñJ eû°¥’·uÊ ÍÛÉ…,’äà\¯ú·k7Ù†ró¶§]…SU–¯Hr»ÞTN&m,ÉÛ¾ÄDï^UÌËù=dáH‡ܾ€Œ2C,R¯·<Ùì³»K^|bìÏg6_Õ&2wH—¶@sŽiGõ“ÈÌÉYm[—t‡ˆ³G;Ÿa›/‡“g1i`H.)I·T“E"hòè© K ãÒ6ï’3—âñ_ˆ u³‰Ý +á¤Y7DNTò 8)¥ÀÎ,|¹ÁŠ;MSÞ>ÿ‚ÆÀi’å:svµq’ƒãX`bq™ä;YDO^u +ñdjÓlaœlÌR4ù11ºLâüš¨j\߸œ I9{0¶ú•ëónCy&®‹bT‚£pàd#ý™'x<±~µß¤x‡Š¯dh F*Ñbº©˜äQÚäJ0¿8B!íÈLå‘×”àiÔµ’| Š;Ef2´Òå~bM2#þòƒHˆÖržý13(är¬k¦þ™Hþè5c*äNÇ÷“>ê£DÞâ&ÊŸ ÅÌ® –òܶ,ÌÁÖÿ»¶¦ Å:`íf)e-qê_Ö˜¥n¶”º¨F%4X…ËdWÐÍÁÖ¥G'©ðÔ‘R\ÂFì (ÈzoH1„×x¾“o¯t$3àÞC¤1:Ù߆(Oܰôºñõ7u‚¢•ë´ëL²kÇËJHi>€u&/ø¨§C¸ ‰–x“‘ëè7µÌ±•«?ìv= VgÒÌÆ¥LŠÒö>ÓštèÂçhôMÞÁý©‰çý¤e´0ŸØ¿ûI™ç€*~8Q¦™Ù²‹Î!i£Â œ$v––&ŽvJߟI×Ö|$%ènPº'ýRI©iˆPÕj Ø8zAk^Žî†¸‹i8)ùœ +?õ±¦Ôÿ )M©P˜€–¸pæ %rª68Ð>œ”?»?¸êDÈõz:T?ïMˆôÚäÓ7ÂŒ=þ׉¬v@ïW±QPw¿1O†ù ßN¢eBOîýgb8±“÷—gg[$<¾¡4ÞÉä¶É …Æ„Ñì$qbZf9vX$» Ov?),ºª–AÆG.þœÝ4>™Tå#`#ÒŒþœ€TÂÎg9à¢ô[{ˆïžÂ¤u=d4f¸G÷Åw|ˆ Œ€c)ѲÁbÀäËãçó'e:y|2ØOÖ hVDþ`;ãÓíß•u‘%}*$exOúÓÍxýzc +ºÍ–J{ vÖ 8¹VÞfuÞÞ]R˜ÿÛ•dô³õ ˜€“Ž ¬Ë+zòá/˜H õá”ý½†@ð&Š…IO7¢¹B…Ìäé5šÚ3‰]:†@8"­k‚bG•`.Æ´fS¦ ¡ÇcÝ“¾§ 5¬R“oR©]ûøP“!ßMíÎx7ãáöá]R£]¯¥œYpt."˜b¬Ðn>˜L|¡  F—.Lft€ÏÇ3=¤`Èë9¦­évI‹„š úÆ8ò!6–úpðúñ¦”'è×ÎZ³~¢­D&ˆÌ)_J õÈ‘ÛÉþB¼eGâI]ëÆ;ªÞä«Xfµ +tzo#ªÏ1)&ƒ7A“š~C˜ìIXüËéÅø|™òôï’bP"¯ú€· ÕE7Ž!ÙäƒâuÍk[!êÖu÷>˜ Øsùz;®çž/KjRƒ’‹,»#ÁàžfOÇO¡4'?UF†r ÎËç1rQBï÷.®@2•÷}º˜ª~¾2™ÈùC˜ˆ¢lÔÏÓž6Ä3㳤 +;à©’%çù¹f©#©|P{g?²J·-:&z$õÙ¹§@.JñpÛÓtkSMºj~=ä—”ÇÿèoÃ¥RÈ$KÛ^دI}Wæ{ÎÎÀ|òZ–£Mwùå eúu  p9çºz<ñbÆ|Ÿyø¾¬¼NêþÿcX"0#7ŠÕ%cRyÊbÛJ÷*É9D0f Èþ$ 3‰|§éQ~+fëÊE³…„ôm~@P +ǯ8'ýö÷¤Ü<‰O¾¹Ñ‚møÔ·Ïlph9ÇQµIJ"š—üÚœpÝlÀ¸ÉŽ(fÝ6ÀËGâ;ù+)`ªs_ã%S Fnw>—7BR ]¸óq`HMÜj”lÑA7„^~‰% h|Þdûôª°I^&ö*½î×ýÚ5ÓÎŽ…×­¥ Þƒ(Îà)´%Uè?Ò˜ä¸Úã¥O†°XòÇòÉßýÒ?Þ~wFRÅ,Ù²C˜€ÔÍ¢øñ9"€f·EVÈÕðByGnÛ„Émw~17mŸûO¯vA—‰„XfÍ(FÈ!É}†ë‚ßAäÛ› Q1ªìQ mhæt¡2 ùƒÂkšùÐ,ûv¶sOo&O¿lþjÃl+&–‘s®lòÉ)pÆd%§l±fÞõÉIQ/úÚaòZf<ø,'M6 …È3+ÁÓuŒøŒIQ<9ÇL“¦4L†”ª¾¤i`¢äŸÒÏüÌÉO*â³°9 ¦¨³@?“žtVÞ”$´ª?{þ[³+äºKB a¾ rŽ#frê>SÌdÛ÷sÍäµÑ#Ñ&þêN%™a ÇÄ-[—ðƒ¥2“Ve2¹©6Ñ‚bÞ·h$ IyQ¬ïàñcaƒ¬ÆK”}Kâ ºn0.ÏKY'˜ØÖP×7hÉË©×]½ãs—O\Ù V¡Ž +;t‘§§ªr­Æ½¿¼™î~âŽúAð‰ Ïát ³{TÈÿ,µkq”§ÜŸM¼q‘e[IK=ÜpI±É¦ÚÒ/訾‰·HºVo—‘â™>i[æuÞNTmRx¨hfT/û³Éš=gú‘´­:›ô’§Ú¤A—:Nd±»cô²XyÚ)ÐÅsã¡»-ÇäulkçlÒÈ‘W`FŽ(šˆ9}¤y5W¹ Y–ü则®“œ—'½ŽÉæ(;ôo‘Íë½äÂÓMϺdbHœv™’„(Ñåaº½{s Œƶóàn±„ôd¢²&öÉ8ïx‘З$„*²C\ Ø'¼Ä–µz’ÀÐücûïB‡añOØGzÒ’ Ê3ñ1$cìËUÒÚS9KÑ:ôb ŽrƒV%)sOŸÙ[]›Ú$ŸÒ“æÔ´ h_ Ó’•¤SOF(o^„$…2‡­ÁèÉaArE! +I|fäúåØœŠêI©eÖõõŠ­Ó£È®:¥™°Ó̳èûÑ£&óžiöû@èJŠ q%©ª sõ5¸”\ä&Oƒ|Êù¡ÛŸµ%ƒˆÞðì4Èaá]î²´')?Ç:»ãÒ3ņY–!ÔÜ)u@ßmF1¸'GóRËcž”F# ÷&?®þß ZÊ|.«_œçDÙïßþ‡[Ъ~àæ6A§t„TIÞRÔ3‘ z“DëÊsLy.ŠHâYö »If° /Äèö¦ò“‘L‘ ßæ,LnBÂ:ÀÁvXAoeDƒkÀ—C)=ꡟ:·’+¹—¨™!eÁ©ù©ãè{@Úz®/^æâ5S`r5_²yc—Û”Y¬€R|¬1Pš+ËŬkLb˜k‘ŒupžÅ¨ô)?ǵôY‰fH`Q“0”ùÀ•â¦`T0w¿0ô…Þr¯Ù•Ÿ‡ JUûrß…eQ–Í9@v§I“Á…®@)$‡ßâ1V“bwªXAI=¶ïB0•ü©8Ï«¿îŽìX–%P…· +¿™-J÷åÝ­~‡ +ÊóÉuý#ûïRâ†[Ίóì\"ƒŒìˆR AiûÆÂ,m G±ʇó0n`‰Y…!(˦ô]ÀPRTPÆ@f6ãôû[X#Q‡J=$y÷ à „”þâ•QG–ðɱo¤îwõ.¥œî î¹I´]1©e¨ç¨Öj¸žeOÒ— êWP®Ú$¢8å°D–Ãâ.åÎèï“£<±¾[®Ä÷ h +üáenñopÚxÓ÷29‘Çþ¹hˆ:ž3Oìãdr–®Gïõé áÒIi4žýü=‹t=z Ôe>£P)–R¼¹ ô5.® >m¶µ]\ß6“!_õªž-/A°øjΔŽö1¯½‹K)á«§%ÉzÉ .qùs¤Ù›Xß —l$M®ÓRó,;þåi±Ñˆ1óí™Ò•ëoÇKcòtÏÞ(ÉàE›Ê¨d ’`ýZ)ÜÅ e±´à¶-U7‡O%ZomùÞÔ„„IÛ“3û#^ä^ÁD/»9P4$"ùЊLÓ†®–åïZ yÜCJ,Ó8ŠÓøÌ²èMêiyX‡œ½È‰ìMÊá[‘ø¶)þu,û8žC9ëVèÚè×Qü×ö£Ž,,KàNÄÄÅE”A¸<´€² –?0jhOã[ú'Y°ãæÌðÁy`Ë.±eQ…­L–7¡äXdž¶Q* « ºÙSRËîC ¸—Áõü´°±\ròU>RÆÁŠCa½gYÊqìÒ®‰‚#Èà|A‘Z/ÖžC5ÿüÕo^2Xד¬0‘(ÌtH‡.xŠ"àòUѬ`ÎcOUºàÐDäÝÌSIÖùb‘½ðƒl ,ëb +©R¼&XG¶S¥Ólñr8µz· +·iïò¤åLº¡‘Là\ü8•XàÚ3ùV(LiưÖóÚZ7yŠ õÏ +Òã=8è#ú³{ßòS2wÔ/|©È³ôõ_©Â¾œÆtÑ™-”Ü‘"™“— J%†ÁPGæ@ò°iíÅžÁ6±ò/k¬õ*ìýç¤a¶¶pláf˜£ƒäøn¢Ž -~õã$ÙÃôí¢…;·µÃ4áO‘µØô%XÉ¥¾èšµúׯPÖdíV§ˆ¤-%Ðm8ÑÓ´ã+°Ë´Ìa© œ¸|ª2H¹ ®6uìÔ¡kñ ÈyÚzÌ q4ü&jÝ$E­p¥â*Îβ"ÞçrW–ó1Eä:®~]x² 0,1®^Íä ¿ˆS²ÜÀo¶·[bH.×lzi‘‡]B>×$Ü)ÜÝOafnr¸´´ váÓ)#ßHŸ¬Ä'X™Œû=¦ Ãçtj-XTÒßB}¶d±€ZÕçRqïÒ6*Žä¶Ñ« AÏ—–ú¼%æÆÏ7Ì#x´¤Éÿn3ÁEsŸxþ:É/YD[o +ŸR´úàǹç}E}Ìscí^[ÞÜ£ñÖšBà´êç-”ùj‘éG~XËøÒi²F'“Ë.  Ù +‡“—ákÆäžH±9kõŽj +_IµÄ‚Ɖ~ŒÜLøŸË+½= #åëmS 4[j™ó”z÷ÿú4.SîÎ ÂJè®d¿î<}¡}°‘){ÅsO¼×åý~¼J½~c%a´À¢´€ Í,&¥+ °Ys?sýxª\ò”8‰$QÄ]ÛÆ•`=Ògd‘;DÙËÚ:²H*«Ï逵q´[{ëò2g– ³¼†ì›{l¬J–¬‡º¾ 4=T/²±„–c·húEÒ¤Írzîô]‡^ °çoú•Þk¡CVì¸Âv…(Ø¢ŠŽSŠË@PQ¥’Èÿü®IŠï€!k8†xJPª Ã’⣎7Ü$µ@y¦%!Oʃˆ)gžèbG‹BK×ÜL*‡²3Užù¢0æõf™yÚêµ*÷·@1¯Ú5èíÜÐJXleoM*ÖH#øç^Åf  ããŽ|wp—_’gÆè+;í¯Mäö#î;ÛVI^ñïQ>ꪒ0.ÉŽ¶ Í ÏºÊÞÓÚ¥Ùh[ø ,b‘rή$Ï/úbæPÔ†}ÜìLM,6Wtln–Xü™ÿ Òø”ˆ« £qÄ;69ù%¼Ü ÷}·×HYÆÔQmZqíS¥¬+·Mð¡-‹üñ[ŠØßü7Ûù‘«L jრ­pð;p˜?ô•Lºh †µ™$gŸ\kg¢„.t„Óo;šÉKÓlGöÒœ°â.ÎK»˜€;qƒB¸Zo0v÷?uY®œjÁA¢·lµ„£ò› ©6`Øls5f8R«vÿŒ0“¸ˆ„ÀWÏn *²í„κߡ`˜ÜœÁ³§<ØIrÿÓîû}œ› ›;~ÂÕ e†~ŒuƒHE`úÒÈ<ã‹úl¤(½Ñ‘ýà›K˜¾$ÚÉvçB©E‚G6* +ŸkIÅûµ„qi@÷àÒ-vQ<« žùç+|L½uX3q§ð¨Ê¯f,g=¬¾ù×¼ÃUNüÇ5cÚˆ°k3õÉæ^›¬úíó +B%L-z¡Ý|¾ÄŘô( +™V?m £@s—8ùÒî=évàZ6xºj–óaŒúFåþ4þ(ÓHÏŸý-Æ“pÄìGá¤2FRþëìÉÀ'GŒª,¯üxza;ƒþÀ}ѧÝé1¨µÂÊD¾Ž›©(Q­-/yfXñ)êâû‘Ô(zÍžC¼¦—MŠ,²Q"äa™C×"%µà¶AQ+Ev•¤9ƒË&¸ðBüxX†#½R;š:Ñk}ÑùcB¬²#ßRBgD²RÇBQÂI¢‚ ²˜‡ÁÔp«·¬u?­k8 +â€g™²ÄÖné|²MÛu³`!³¥ º“SŠÓ}µU|«ccsvN€*µ•¹¦åèÞ û%2¤Y–î$_G%<~îÿµí§b‡¢(4ÈÃ-UWòàxØyÊ{--ä7ùÝ•–ÄlFVB‚r\ûÅ¿U<\RüÇð?‡¬Ÿ ñùïM¾Ë€ïú˜Ä)o›bÌdø0æ7iæ±ÝC˜/Øfew÷Τ&nßP2^G-ƒ&»ú=¾Â²`a±m8¶ñ4ý‚ìEÖC´aˆ4h•s`ý\i…•t¯GÛ£*ÇÒhx1ý9 JŽY‡!”œ!ö]©)A…$„ ˆ  `!€Å„¢²Œ„uyHy;¶/`AÁW†×Nw¾ÖC\ÂÆíà°­ +rXI3CÔ~ˆ’Jã ]Wý.ûL`€`© (H.€X ÝF§¨šdUH¦…VÐ)¨ZÃ_Ùc+¿Fʵ7­Ôuø…ù§ªŽå)DÁ(šuaÞ襣×áiÊ|TÕ9å­/Í®oNQUÚl³–—Cfts3¾®Q¬ñùÁ¸ iïOºÍ,Í´ëÙÚ†ilC4Yî½Æ¢B{ØåZ•å!‰C:ªfªÙÞõ‘ÄWï¥[äÅQ"]ó—ðµ@£•uRŒý.ín{/ÚzO·µt!ó‡vG#´2¢+w“Ê£ÛôaŽÕîjÓ +<½Í²9”T +{âø.ŠX`P.ð\~ž%œËsžwsšãä©M]9±À ¨ëMaøð¦–FÌëÄSIa\{Ù=0 0Ú²°ðÎ;õNºkJúWGÅOQ!Zª™™%$-eK翉=-Í=vkóõ¾»Î»ÓŽnTµÎ¿Íª:Õ9¤¸´2Ñ”8¯—uÍi¾¯ìñž%’]‰_æ–ên~ÕH‰4.ŽG‡¥Õ´š0ÜZ—+ÓwºÞªÓÕÛCVj5æí,IB›,uÜ ‚Ë&Èb9¬I”¤Gƒ0]•V˜PéAe=£5š+\f¥`*—,ˆ³bH9¨"‹î:JnÓŠºH×Ò–lîu:[{v nÝâ~ÚÇ{žnKÖe—p±LCSÄy†(v8sÉb[œñu$¡™¦yZ›¬ï’ïRÿÃC¯Wù®7­nóé„Öº¾w7¸§5TÇÄSÙ5í¬bÜMÖYeíÑU’k꘨‹´—a·ê»ï*-SDÄœ:­ßÌ£Dêiõ JÍt­ÛR?sÒ׺î¹Nø},ðµWø_êùfºp£Ž²†üÒô”ú{zæ.ašˆõ9"çP™ íø¤M2ᑼ¦÷ÔOuÐ'eT]çÐÔ”KjKõ³ýl?viIK¶**ÚnJöØ/Ñá}ZZ×<¤ÄÝšñÎôUjÒUíú×™S_Òõ¢&‘åãäÛS¶2ô4÷[kiDç[i¡Ù쯉"išðzA{$âyŠ¡Hʳ:è}Í +š+#yAË¥¡.àŒ™^ŠE¿ÁÇ_…IMç{®ÝPâ¾æéÛqÏwd‘eËÙHRŒLé¦2²}3LÑû²ÓN ¥ÇÝ–òû[fVÜ5eá™ÃÀf¿Zµý9ó' +”qÇÇçÔ‹æ®ìÒYɘ;¿ý/€˜¥–cbˆìÆÚAõhÞÖ©—t %Uíá¨Ûz˜$“·mÑf$#Ìí˜Õ¹mÿî4Ç­±1pv.Œ +c~·ÁkÇ)Cqr²çšÛ½ozé¯Ä>{Zpº‚ãemI¬ƒ/ +þjqžŒ®à]Ä„u3S¼C +ì'0Û°¦&Ï”$®!XÕdÄvá}¹9G^ mɽ·ÿ·®çù¿³eÀ|Íp!"=ÝïO¨AÑsq~Éö í”Åä‹™½+úÅ¿DÞ—jëg%Lîµömv‰¯kfn”í…Oý¾Í鯶¬qã;äIjŽŒúWVn2û3é:çìbíoÀw6y§›~goÕñÔé:­Sû_9¹Í~xÚ˜ÙD5a:2GFÄ¿ër Èg·çGÞ^g]Ö߯M`¯*o½Ÿ^òa!0f5ujˆâÿÒ"ÑÒ¸ð{XÑxt-üà§2çzÇ?>5t]áä#„-?™“Š{ô]Ÿ’,óNÁ"?°7Ò8+”Mš¸Ñ¤u×Ú÷?ô;&ìí01Æ=ŠN,ÖiÖÖ{¤¥~눺„ÞôçØ½[2‘£ "HBã}æì~‘ÔåVkùŒªÉ>=빿ü¢È'yØ;÷€!‚‹Fs"A™=çvP<ÛÔÓ³ñ—Ÿ®™¯úÚ +Qq=ìË3²¡ÓYª£bå^ÌU’Ü ëàxEz‡€¹ê¦*ð4s—÷f¢f¢v©Ïĸ\—/h•|÷gBvÜf46‚{KZeâÀšKffzê+¸ÉDâS,¿Ê¨xw"ò±2tÿ†ês§ +*ªÐn'ˆs@…¦±%ç”Àpiˆ‡ÃÖnK ÔŽ0nuÉïY¬VÍ«3Ä«¾/í]ÛÉùP$û_eëË<ÂÌS³'È¢$,„¬"ú¶ePÏç^@²¤:kP3a’…ÿ BZþ ÃK˜ÏIZqDRG"‰Ó¹ ‚|!-0ãJT¢‡*z¡çøÎŸ4ƒw­úÏ#:-š\=åXÖAÄ.§¢â…ãÚßµ1Õ˜)êºðfÚOGX–fBV2Ô •9ó™`%ŸfUþˆél5„{BŒ»$!¾äNÜÒGï”JzHÆŒZ†Ðn¼_îL$ð}Iæÿ'J~9sg`•FÃMn¢Â„¥ÇÑéS_Í@òÈéÐÃ)òÿÁéV¢AÝljß#§ZÃ/¯2+䈤.EÒÈ·C Ñ"™&ÖêD‰äHÆ×õPÞÀtY¼³•)Ñ⊧Üq¶Ê0ܵäd­%`Õ!¿O¾i°ù1uê˜ø6¢òŽñ–ÜžŸân8¥¹B…¿v®eÖLÕÖ+v@±kˆ 6¹ÆÌƒ–Iz›ªËË;²^°Ga¥tLÖ‘¨«¦az¼¨)(RíÃ,Rj½r»ã±ß¤`CR³ð¬€«“\ºiÛê5TÉ“/W0nŽY¾$Ãä‹]ÖÎ¥Ͳ@ˆÐìHï8ÿˆë’2êƒ?r ª:³Â@eC:S¨„tBܪ@fp$?´# 3-@xO®#„/â ¾úŽ*s{µpÍøˆÎ8;\pÕ½…he @É `np =¯Ñ" |öñ*M¿òhè+øÍÉŸа…áã ú(®ÙNßdû›‡'Ÿi™¿ߦøÊãÇ=Oa¢³ p¦…ˆ™b_² fí¾K T^hí'úmêšEôþ <þ¿Í‚ +´´¥_óMñ <]úÅ •~‘OehEýÍ üK¤aè©ãŸu‚ûåËi~,‘gû&"‰)¹‚e""²,ñ%ö‚Ât4S_ÌøŒY±«Ÿ±#K­ ¬¸ñVOTåd(…Ú¢œ1U:J§‘k®t!çØ/R¼&£ƒ7{êºù‰Óû.%“lµNiEÑD‹ÚןH1ž÷äÝ'Øð÷$žõ±SGúz×çÓIu?Q5ï˜zµPz{íÆQé9œW¶cN©ÓZÓIqØî ^­MíV‰Æâ£Ïˆñ&¤¡{ït–LP¯ˆ:–»,Éžk»¹—¨5´¶Äý¦Ü´:5IYs=‚æÑ'pJÈ„1œ-À o„DÞF®â‚ÙŒbn‚°ã㛡I‘¨“Á O +!¨ˆŠ?q*I ÁA6NÊ÷Û’ +Ó„p3•!aÒˆéÍ«q¬ºP$㦺ìEt *®ˆ«>I6~¥æw>­5U˜‹d9ûLu‰mPÔ]†ØR¤… @÷¼²ƒ£Wƒó±¢•¥Ÿ„zq ÕN†—s“êüá—78IrÀUê e¼xî=ì`×jd5Ó|áõ‰ø’´TNÑš}E}PÜL¢ Òs}º¯+UÕ/úPj¤>@Ii:˜®ût&€ …¦Ç'׉ècÉû‡R­R%@Õ¶A×ëXHœPsDPoǺx)ÃÓ¬Êt•DRÔbâê‚MºjE\ŠØÀ”ÑaD»xî‡mÛ|‚}öÒ³×’RKŸ€Ö‘p1àí¿â"ÈT6ö#F2²Èu*|•3/KázgøG½Õ´IBýRORñnltJˆ÷œÒ&ë/¿ž¾)ˆ'<á!‘¼VƒOúHªµ¾Ýg€\ £À ’ÒïVÅ’#ddM€:+Ù ‹¢1B¢nrEɬ"ˬ„7×ùúVÝÌaY9GsÇñ6±ˆP‚ß@àJ€¤„Ð*ÆVÅ^ª‚ׄіHµ«‹)2Hï=`¸í°&'G§rUÒ›¬ïVº‰.ã1¯ç±È‹’•Ë⬷‘ = »n‹äa¢*“aß’µ^O!8—ã[}H!w™ôK‰ ¹¾7§w$n}÷f¹Æû·Ý+÷±Ru“-™ +âCî³ÙÇ)C™zýªýÇfrE5Š‘"eþçCQÃ…Ÿë7ˆ÷™w"n; –ª„AÖyXÙ” E·äìÒE(£Ö®¼ŠpV× F¸_Y]bï󻌑sƒÔÀ”6•~WÅÁ®gÉÕë3µ8nsPæëuôU—ì¡zªs@#w³çò±rj˜æÚÊ·ÆŒL+°ÀÓQõÚ&î*³uØ&Kº¢’™q¬Rñáø%E‰ô.saVâ_¼è®ÈŠH«9ñw¥ú´Ä˜ZÓ²›P‘ÍÓ#]„¤Z‰¨ì1­’Í`Ë(—1=IC­âf}äÍÓîG+ãuû‡‘4ALÔ‚`å‚H¸ÕÖÊeUà~ܪöuó+ç +¶ 6`ó²»Íh¡O©kScN@l÷{”›ðÔíò‘nI7>ëÅÆÈSàU5¢©ÛËHJkëîE›J[Ï¢ztÝÚ¿8¶Âu—Ä3ÄbÄ–L4V»kGþÉÌýGÃwdJ$Í¥7›x·*2¢x¢éì–ùÆE%Ž}n%>­/âËÖÓ½C´x¹,4­þK6¹geZÅ‹6®Ãa¸·T©8ÿ®€rH“1Ÿ é,¡õR´ìýÁmcúѾF9v>ißwnìCåhŸn×Ñ9Büž o¦)¿6_û^¸ütrß…m=‚Ap‰í#$’ïÖ|&×·¨‚¯Äk`ø8ätZIß©|Û"'å|Gd~¯ˆÌò¤Úƒ|"¿»Æù|§¦×ÒK ŽdnYË«ûey ø ¦«ÇÞóL[ŠÇm×`× ÎJì˜f£yY·¹~ª.^›pÔ<ªŒÀ§zøå=‹Qî—“Cy6âß~~^¯—7šþÀÙ±éѹSo,_Æ%¹’ÒŽ9ŽT@2ë”´ÒïÁ àkõ½å©žTµè¦PgšŽÈ£ý•°|A_é=ìÆ!ï3oÅPõùü»6øÙ†´; ÛDÌù +ìúSn?jÄaË?QÓL/MãZZûÈÜÉg>I ôM?¾aÐúƒaú*Ê9£ùœ$9âi+„µí_e Ÿ’hƒD6&|ûCîØ}»tà¹ÌǤ“ªÎ4ôJ3©ØŸÑ÷Ná¼¼)¶Ð á­k©$›ªÝÝÓés„RK°`Ží“a ÔsX‹#¸(JybÄþÓLßÝø¹Mg'žiòb ]3±ëò )Ù ¾¤f*r¬ÝÀÒdU¾ÖMý ÇIE4?HLG*´B†±¡ˆÆé(„@ дr + ˜Ù¸g1”ñ <ðó¥Öä¡YF%ÈiÕ&ý^¡@JŽ›×èz²[³pš¸ð'c²Ö¦ I‰ßÂ%¢r#@Åö羜R$\ýmî¼D|+=Æ~v)þ-ÅÂ9¸F“nꎌÎP˜)JâØö”f?Own‹Ï…zØÇLÌ3úÔâg|e ±[ƒÉ(éY­˜’L3Ìð·ŸÎ²»D¯ùeË0Q$‹0Ï1LçB+U8ªXJÏøÚ›F6װͳyŸãDuj¸o‡zåÀ¥Àô‰©ÐbûP<ÁºÖúêSÎeØXŠ£Î ,4:•>Wt!Hi"ûå) +ÚÆ¬wg7æRé³,`Àá„z‡¶<·CN˜³IDdÚŸ%9@…{µ Š|²'R¾S?lªÃ«È~ØöÞ̇_I¤JÒè+Ä&òAê+ +endstream endobj 13 0 obj [/Indexed/DeviceRGB 255 22 0 R] endobj 22 0 obj <>stream +8;X]O>EqN@%''O_@%e@?J;%+8(9e>X=MR6S?i^YgA3=].HDXF.R$lIL@"pJ+EP(%0 +b]6ajmNZn*!='OQZeQ^Y*,=]?C.B+\Ulg9dhD*"iC[;*=3`oP1[!S^)?1)IZ4dup` +E1r!/,*0[*9.aFIR2&b-C#soRZ7Dl%MLY\.?d>Mn +6%Q2oYfNRF$$+ON<+]RUJmC0InDZ4OTs0S!saG>GGKUlQ*Q?45:CI&4J'_2j$XKrcYp0n+Xl_nU*O( +l[$6Nn+Z_Nq0]s7hs]`XX1nZ8&94a\~> +endstream endobj 6 0 obj <> endobj 23 0 obj [/View/Design] endobj 24 0 obj <>>> endobj 5 0 obj <> endobj 25 0 obj <> endobj 26 0 obj <>stream +H‰|SiTW®¢©j\NE©Sºµª1F aQhAeÅ ´E…¸ÐÒ­4²¥$8 # tc̸TÜ@ٔͣƒ z (*›bbԜə[íÃs¦0æ×¼÷¼ïÞwï}ß]pÌÒÃqÜ.ðïáA+ƒ¾\·O«QªBµ .Õ{’c•Ú)#ÇKqÞÖ’Ÿ3“A‹éýû÷Á´}f×Í™fYàøàËå ‰‚ïžè$Ù¢¥Kݧ¤ü£ôr–¹/\¸ð£”ËT »Ô2Å>]’:N'[• MLÐ*“Ô*WY@l¬ìcL«Ö©µú)å_?’it2µ&)Z­•)ãà¯U«dIZ¥J§Ôî•%LYþîþ?©dšx™K¯™BŠ$A©“)ãUnB”„Y¢’ã“´µÎÕm¥bÓ¾Dµl‰L¥Þ Çfb6£1³Áì°yØgؘ+¶óÀäØRl9ˆ­ÄÖbë±PLmÂ6c[±Ø¡ÎØ:A•Œ°>Ü߆×YxY´àE”è¨ßÒÛ²ÀòwbÑEÚ“›ÉûâYâqµYí¶ªvÈiæ_7゜ß,ʱä³Ì¡“Y$˜ÐùÁ÷LH†n10&‰'Éïà‡Lò7™©šBÔ¤-uä´´ãP|OÅü%e }èÑ{pôíHb +]‡ƒxäˆÊ •Y 9b*³›¿ÒWBѨ +ÌN ²uA3Q<‡ö‡Ñ  ¥0(ø¢|Bs¹oW1/jç!9Z9o‘÷–ßÀ[_ pTÎCþäCøQió5Å7o0lG^ÃLÉDèoHæ” ÞÁ^\Gœ+k*k“¾¾¼~ —íäï…–!÷•«mÃÄ”@#ðô=Ç Æ@óTÄÏ·ÀòŽÎbT?éAl€(FÈfŒbð€¯‹Ê +/–ÔØ™Hƒ&[£‘ 8R/Ôtƒ×#Ìc">ÐÌ2è©D„©ôR^µlZC¼r9ùа%¡›K +ÙäÕDJy{J¯ìßý +ô²uë%®4*üD¸T·ß`HçÎ7¹$•y¯ë°®_ûtÏÖŽÑcð}&³^÷1~{ÙeÎ$¦×\hk‘< DÖˆ”ÎW”+ú4lnAyk"6,•8-ƒ9¬ñ³$üN—‰û¹¶¹ÿ ;ªmQûHVoðaé\¾Ž,Û¥HåüK"*;%­×n°ƒùµNèOc»/„ÃG›h"³ª¢K\‹½ +6œHµ'÷Ÿÿ¦3ùÕ7=±7¶Y™Ä½¥­mc’›©×5el2äWiHð·wr#뙼ü²¼:éËìµ\âºÕ•u')Ù>þF_LŠuë(ÄÑuW]Uoj§<ÆÿýfC "8ת]å’ë•-/ï6¦dœaéÆÒ^‚ø!.¼p¥}*÷çܽ,TÜ‹èª=Á’U[¶¹‡l,)U±Tü_ :ljøz´Þ€ž¤r×F¦Å¦FÙe‘ûªR+´ îàn»€„4Œv¡WÄ[ò 8V¶W_špZufwåÆaädKÅfö¨õ¼oìM±~8U£t:|nC7å=&LdPUkb0À‡!€‡\Ï·h¦ÔWËà¶|rˆ¤Ó# †öT0ù¦“Æãìý¢ÖÚv髿%_ptmòw ÚZw757œ8!¡ödöªô¼ßƒ©„5cpi”nâÌ ª3ˆ¯&‡WHÑtG´8—CãŽ0m°­ö§ ¬QH”çE ’YW²›ê%üØc2ÙŸ‘•ÁÒMk¾ S…J¿zòû~zü¢ëÆvÅ)Δ™›ž)¡tƒO|Ö×<ƒÏEü.Ð3¹ÿ4æIÆ”À!wd¿‰Ñ´`Ì œnæ—³éÄþuf°ÔãoM0ÃÀåv0w]“¾)•+²9jÒâ´žOMùpëŸw¥'`± Ÿê1™*¦ß5˜½˜½IºØ¸3ºòÊ3¥eÙ\¹¾4†¥à‚“w_¦Pæaˆ†ØaúÉC›ah$ ŒGO± ù×Z¤÷+~ª†›âBSaÞI¶¾àju³´·BáÊ¡ ÃP#纠í{3’ãÙ”ôT}z¢•¼­¿¶Fê½#r{"—EÒMG~!üHSTî®p µ5³‹ŸÞ… ¥þq\åü!Iì‘'ry÷%| +Ó`Ö/° +]Þýãþû‰Ió´#9ûL<75NÛõç¸ëóû¥ vø0Þ€w§wÔâÈÔâ÷–š™—Í—·ºÉ—”Љ”˜Þȃ„ŒPVbJu‡¨ˆê>Ž^ŒZRû`Ìø +ÍÀß÷ಢw­¼~À÷ÍÇàÓ`µ7«L£n³¯¨©¿¸®{ž¡Ë›p`™Z#LK=Q´[âlÌs¤tacmkK_]œqZ€ÔbvøxwÑã÷|ã¸ørøx3û½{ˆ{†~d{bbP;oÉç÷ 3û¯û>æa×á¾¾²¢x<Ùˆ±Š·½÷‹ß÷Æé‹wùS°øx÷&üxÛÙ÷zМ¿š½—Å—R™[œUÕû{Û÷0øx4Fû‡{R~XƒZˆ€¼}¾yÅ@÷†A<û‹{W{W€Zˆ‚½~½}ÁK÷Ї÷cΠÍ¼ÆøÇ÷÷fÇ¡¤¯¯°vtº°kЯ³ÉŲ÷†OTŠzngff£Xð«Hk˜aFUX'—øx—÷.———£—ûf—Ø— b_ ‹ Î +ã ã ø•øì :ù +endstream endobj 10 0 obj <> endobj 7 0 obj [6 0 R] endobj 27 0 obj <> endobj xref +0 28 +0000000000 65535 f +0000000016 00000 n +0000000144 00000 n +0000059305 00000 n +0000000000 00000 f +0000472483 00000 n +0000472297 00000 n +0000475994 00000 n +0000059356 00000 n +0000059771 00000 n +0000475881 00000 n +0000089002 00000 n +0000089812 00000 n +0000471735 00000 n +0000089886 00000 n +0000090166 00000 n +0000092070 00000 n +0000157659 00000 n +0000223248 00000 n +0000288837 00000 n +0000354426 00000 n +0000420015 00000 n +0000471783 00000 n +0000472367 00000 n +0000472398 00000 n +0000472886 00000 n +0000473246 00000 n +0000476017 00000 n +trailer +<<54E4F66DACD5774EBAA4FA59E797944E>]>> +startxref +476200 +%%EOF diff --git a/IOBox/cJSON.c b/IOBox/cJSON.c new file mode 100644 index 0000000..61483d9 --- /dev/null +++ b/IOBox/cJSON.c @@ -0,0 +1,3143 @@ +/* + 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. +*/ + +/* cJSON */ +/* JSON parser in C. */ + +/* disable warnings about old C89 functions in MSVC */ +#if !defined(_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) +#define _CRT_SECURE_NO_DEPRECATE +#endif + +#ifdef __GNUC__ +#pragma GCC visibility push(default) +#endif +#if defined(_MSC_VER) +#pragma warning (push) +/* disable warning about single line comments in system headers */ +#pragma warning (disable : 4001) +#endif + +#include +#include +#include +#include +#include +#include +#include + +#ifdef ENABLE_LOCALES +#include +#endif + +#if defined(_MSC_VER) +#pragma warning (pop) +#endif +#ifdef __GNUC__ +#pragma GCC visibility pop +#endif + +#include "cJSON.h" + +/* define our own boolean type */ +#ifdef true +#undef true +#endif +#define true ((cJSON_bool)1) + +#ifdef false +#undef false +#endif +#define false ((cJSON_bool)0) + +/* define isnan and isinf for ANSI C, if in C99 or above, isnan and isinf has been defined in math.h */ +#ifndef isinf +#define isinf(d) (isnan((d - d)) && !isnan(d)) +#endif +#ifndef isnan +#define isnan(d) (d != d) +#endif + +#ifndef NAN +#ifdef _WIN32 +#define NAN sqrt(-1.0) +#else +#define NAN 0.0/0.0 +#endif +#endif + +typedef struct { + const unsigned char *json; + size_t position; +} error; +static error global_error = { NULL, 0 }; + +CJSON_PUBLIC(const char *) cJSON_GetErrorPtr(void) +{ + return (const char*) (global_error.json + global_error.position); +} + +CJSON_PUBLIC(char *) cJSON_GetStringValue(const cJSON * const item) +{ + if (!cJSON_IsString(item)) + { + return NULL; + } + + return item->valuestring; +} + +CJSON_PUBLIC(double) cJSON_GetNumberValue(const cJSON * const item) +{ + if (!cJSON_IsNumber(item)) + { + return (double) NAN; + } + + return item->valuedouble; +} + +/* This is a safeguard to prevent copy-pasters from using incompatible C and header files */ +#if (CJSON_VERSION_MAJOR != 1) || (CJSON_VERSION_MINOR != 7) || (CJSON_VERSION_PATCH != 18) + #error cJSON.h and cJSON.c have different versions. Make sure that both have the same. +#endif + +CJSON_PUBLIC(const char*) cJSON_Version(void) +{ + static char version[15]; + sprintf(version, "%i.%i.%i", CJSON_VERSION_MAJOR, CJSON_VERSION_MINOR, CJSON_VERSION_PATCH); + + return version; +} + +/* Case insensitive string comparison, doesn't consider two NULL pointers equal though */ +static int case_insensitive_strcmp(const unsigned char *string1, const unsigned char *string2) +{ + if ((string1 == NULL) || (string2 == NULL)) + { + return 1; + } + + if (string1 == string2) + { + return 0; + } + + for(; tolower(*string1) == tolower(*string2); (void)string1++, string2++) + { + if (*string1 == '\0') + { + return 0; + } + } + + return tolower(*string1) - tolower(*string2); +} + +typedef struct internal_hooks +{ + void *(CJSON_CDECL *allocate)(size_t size); + void (CJSON_CDECL *deallocate)(void *pointer); + void *(CJSON_CDECL *reallocate)(void *pointer, size_t size); +} internal_hooks; + +#if defined(_MSC_VER) +/* work around MSVC error C2322: '...' address of dllimport '...' is not static */ +static void * CJSON_CDECL internal_malloc(size_t size) +{ + return malloc(size); +} +static void CJSON_CDECL internal_free(void *pointer) +{ + free(pointer); +} +static void * CJSON_CDECL internal_realloc(void *pointer, size_t size) +{ + return realloc(pointer, size); +} +#else +#define internal_malloc malloc +#define internal_free free +#define internal_realloc realloc +#endif + +/* strlen of character literals resolved at compile time */ +#define static_strlen(string_literal) (sizeof(string_literal) - sizeof("")) + +static internal_hooks global_hooks = { internal_malloc, internal_free, internal_realloc }; + +static unsigned char* cJSON_strdup(const unsigned char* string, const internal_hooks * const hooks) +{ + size_t length = 0; + unsigned char *copy = NULL; + + if (string == NULL) + { + return NULL; + } + + length = strlen((const char*)string) + sizeof(""); + copy = (unsigned char*)hooks->allocate(length); + if (copy == NULL) + { + return NULL; + } + memcpy(copy, string, length); + + return copy; +} + +CJSON_PUBLIC(void) cJSON_InitHooks(cJSON_Hooks* hooks) +{ + if (hooks == NULL) + { + /* Reset hooks */ + global_hooks.allocate = malloc; + global_hooks.deallocate = free; + global_hooks.reallocate = realloc; + return; + } + + global_hooks.allocate = malloc; + if (hooks->malloc_fn != NULL) + { + global_hooks.allocate = hooks->malloc_fn; + } + + global_hooks.deallocate = free; + if (hooks->free_fn != NULL) + { + global_hooks.deallocate = hooks->free_fn; + } + + /* use realloc only if both free and malloc are used */ + global_hooks.reallocate = NULL; + if ((global_hooks.allocate == malloc) && (global_hooks.deallocate == free)) + { + global_hooks.reallocate = realloc; + } +} + +/* Internal constructor. */ +static cJSON *cJSON_New_Item(const internal_hooks * const hooks) +{ + cJSON* node = (cJSON*)hooks->allocate(sizeof(cJSON)); + if (node) + { + memset(node, '\0', sizeof(cJSON)); + } + + return node; +} + +/* Delete a cJSON structure. */ +CJSON_PUBLIC(void) cJSON_Delete(cJSON *item) +{ + cJSON *next = NULL; + while (item != NULL) + { + next = item->next; + if (!(item->type & cJSON_IsReference) && (item->child != NULL)) + { + cJSON_Delete(item->child); + } + if (!(item->type & cJSON_IsReference) && (item->valuestring != NULL)) + { + global_hooks.deallocate(item->valuestring); + item->valuestring = NULL; + } + if (!(item->type & cJSON_StringIsConst) && (item->string != NULL)) + { + global_hooks.deallocate(item->string); + item->string = NULL; + } + global_hooks.deallocate(item); + item = next; + } +} + +/* get the decimal point character of the current locale */ +static unsigned char get_decimal_point(void) +{ +#ifdef ENABLE_LOCALES + struct lconv *lconv = localeconv(); + return (unsigned char) lconv->decimal_point[0]; +#else + return '.'; +#endif +} + +typedef struct +{ + const unsigned char *content; + size_t length; + size_t offset; + size_t depth; /* How deeply nested (in arrays/objects) is the input at the current offset. */ + internal_hooks hooks; +} parse_buffer; + +/* check if the given size is left to read in a given parse buffer (starting with 1) */ +#define can_read(buffer, size) ((buffer != NULL) && (((buffer)->offset + size) <= (buffer)->length)) +/* check if the buffer can be accessed at the given index (starting with 0) */ +#define can_access_at_index(buffer, index) ((buffer != NULL) && (((buffer)->offset + index) < (buffer)->length)) +#define cannot_access_at_index(buffer, index) (!can_access_at_index(buffer, index)) +/* get a pointer to the buffer at the position */ +#define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset) + +/* Parse the input text to generate a number, and populate the result into item. */ +static cJSON_bool parse_number(cJSON * const item, parse_buffer * const input_buffer) +{ + double number = 0; + unsigned char *after_end = NULL; + unsigned char number_c_string[64]; + unsigned char decimal_point = get_decimal_point(); + size_t i = 0; + + if ((input_buffer == NULL) || (input_buffer->content == NULL)) + { + return false; + } + + /* copy the number into a temporary buffer and replace '.' with the decimal point + * of the current locale (for strtod) + * This also takes care of '\0' not necessarily being available for marking the end of the input */ + for (i = 0; (i < (sizeof(number_c_string) - 1)) && can_access_at_index(input_buffer, i); i++) + { + switch (buffer_at_offset(input_buffer)[i]) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '+': + case '-': + case 'e': + case 'E': + number_c_string[i] = buffer_at_offset(input_buffer)[i]; + break; + + case '.': + number_c_string[i] = decimal_point; + break; + + default: + goto loop_end; + } + } +loop_end: + number_c_string[i] = '\0'; + + number = strtod((const char*)number_c_string, (char**)&after_end); + if (number_c_string == after_end) + { + return false; /* parse_error */ + } + + item->valuedouble = number; + + /* use saturation in case of overflow */ + if (number >= INT_MAX) + { + item->valueint = INT_MAX; + } + else if (number <= (double)INT_MIN) + { + item->valueint = INT_MIN; + } + else + { + item->valueint = (int)number; + } + + item->type = cJSON_Number; + + input_buffer->offset += (size_t)(after_end - number_c_string); + return true; +} + +/* don't ask me, but the original cJSON_SetNumberValue returns an integer or double */ +CJSON_PUBLIC(double) cJSON_SetNumberHelper(cJSON *object, double number) +{ + if (number >= INT_MAX) + { + object->valueint = INT_MAX; + } + else if (number <= (double)INT_MIN) + { + object->valueint = INT_MIN; + } + else + { + object->valueint = (int)number; + } + + return object->valuedouble = number; +} + +/* Note: when passing a NULL valuestring, cJSON_SetValuestring treats this as an error and return NULL */ +CJSON_PUBLIC(char*) cJSON_SetValuestring(cJSON *object, const char *valuestring) +{ + char *copy = NULL; + /* if object's type is not cJSON_String or is cJSON_IsReference, it should not set valuestring */ + if ((object == NULL) || !(object->type & cJSON_String) || (object->type & cJSON_IsReference)) + { + return NULL; + } + /* return NULL if the object is corrupted or valuestring is NULL */ + if (object->valuestring == NULL || valuestring == NULL) + { + return NULL; + } + if (strlen(valuestring) <= strlen(object->valuestring)) + { + strcpy(object->valuestring, valuestring); + return object->valuestring; + } + copy = (char*) cJSON_strdup((const unsigned char*)valuestring, &global_hooks); + if (copy == NULL) + { + return NULL; + } + if (object->valuestring != NULL) + { + cJSON_free(object->valuestring); + } + object->valuestring = copy; + + return copy; +} + +typedef struct +{ + unsigned char *buffer; + size_t length; + size_t offset; + size_t depth; /* current nesting depth (for formatted printing) */ + cJSON_bool noalloc; + cJSON_bool format; /* is this print a formatted print */ + internal_hooks hooks; +} printbuffer; + +/* realloc printbuffer if necessary to have at least "needed" bytes more */ +static unsigned char* ensure(printbuffer * const p, size_t needed) +{ + unsigned char *newbuffer = NULL; + size_t newsize = 0; + + if ((p == NULL) || (p->buffer == NULL)) + { + return NULL; + } + + if ((p->length > 0) && (p->offset >= p->length)) + { + /* make sure that offset is valid */ + return NULL; + } + + if (needed > INT_MAX) + { + /* sizes bigger than INT_MAX are currently not supported */ + return NULL; + } + + needed += p->offset + 1; + if (needed <= p->length) + { + return p->buffer + p->offset; + } + + if (p->noalloc) { + return NULL; + } + + /* calculate new buffer size */ + if (needed > (INT_MAX / 2)) + { + /* overflow of int, use INT_MAX if possible */ + if (needed <= INT_MAX) + { + newsize = INT_MAX; + } + else + { + return NULL; + } + } + else + { + newsize = needed * 2; + } + + if (p->hooks.reallocate != NULL) + { + /* reallocate with realloc if available */ + newbuffer = (unsigned char*)p->hooks.reallocate(p->buffer, newsize); + if (newbuffer == NULL) + { + p->hooks.deallocate(p->buffer); + p->length = 0; + p->buffer = NULL; + + return NULL; + } + } + else + { + /* otherwise reallocate manually */ + newbuffer = (unsigned char*)p->hooks.allocate(newsize); + if (!newbuffer) + { + p->hooks.deallocate(p->buffer); + p->length = 0; + p->buffer = NULL; + + return NULL; + } + + memcpy(newbuffer, p->buffer, p->offset + 1); + p->hooks.deallocate(p->buffer); + } + p->length = newsize; + p->buffer = newbuffer; + + return newbuffer + p->offset; +} + +/* calculate the new length of the string in a printbuffer and update the offset */ +static void update_offset(printbuffer * const buffer) +{ + const unsigned char *buffer_pointer = NULL; + if ((buffer == NULL) || (buffer->buffer == NULL)) + { + return; + } + buffer_pointer = buffer->buffer + buffer->offset; + + buffer->offset += strlen((const char*)buffer_pointer); +} + +/* securely comparison of floating-point variables */ +static cJSON_bool compare_double(double a, double b) +{ + double maxVal = fabs(a) > fabs(b) ? fabs(a) : fabs(b); + return (fabs(a - b) <= maxVal * DBL_EPSILON); +} + +/* Render the number nicely from the given item into a string. */ +static cJSON_bool print_number(const cJSON * const item, printbuffer * const output_buffer) +{ + unsigned char *output_pointer = NULL; + double d = item->valuedouble; + int length = 0; + size_t i = 0; + unsigned char number_buffer[26] = {0}; /* temporary buffer to print the number into */ + unsigned char decimal_point = get_decimal_point(); + double test = 0.0; + + if (output_buffer == NULL) + { + return false; + } + + /* This checks for NaN and Infinity */ + if (isnan(d) || isinf(d)) + { + length = sprintf((char*)number_buffer, "null"); + } + else if(d == (double)item->valueint) + { + length = sprintf((char*)number_buffer, "%d", item->valueint); + } + else + { + /* Try 15 decimal places of precision to avoid nonsignificant nonzero digits */ + length = sprintf((char*)number_buffer, "%1.15g", d); + + /* Check whether the original double can be recovered */ + if ((sscanf((char*)number_buffer, "%lg", &test) != 1) || !compare_double((double)test, d)) + { + /* If not, print with 17 decimal places of precision */ + length = sprintf((char*)number_buffer, "%1.17g", d); + } + } + + /* sprintf failed or buffer overrun occurred */ + if ((length < 0) || (length > (int)(sizeof(number_buffer) - 1))) + { + return false; + } + + /* reserve appropriate space in the output */ + output_pointer = ensure(output_buffer, (size_t)length + sizeof("")); + if (output_pointer == NULL) + { + return false; + } + + /* copy the printed number to the output and replace locale + * dependent decimal point with '.' */ + for (i = 0; i < ((size_t)length); i++) + { + if (number_buffer[i] == decimal_point) + { + output_pointer[i] = '.'; + continue; + } + + output_pointer[i] = number_buffer[i]; + } + output_pointer[i] = '\0'; + + output_buffer->offset += (size_t)length; + + return true; +} + +/* parse 4 digit hexadecimal number */ +static unsigned parse_hex4(const unsigned char * const input) +{ + unsigned int h = 0; + size_t i = 0; + + for (i = 0; i < 4; i++) + { + /* parse digit */ + if ((input[i] >= '0') && (input[i] <= '9')) + { + h += (unsigned int) input[i] - '0'; + } + else if ((input[i] >= 'A') && (input[i] <= 'F')) + { + h += (unsigned int) 10 + input[i] - 'A'; + } + else if ((input[i] >= 'a') && (input[i] <= 'f')) + { + h += (unsigned int) 10 + input[i] - 'a'; + } + else /* invalid */ + { + return 0; + } + + if (i < 3) + { + /* shift left to make place for the next nibble */ + h = h << 4; + } + } + + return h; +} + +/* converts a UTF-16 literal to UTF-8 + * A literal can be one or two sequences of the form \uXXXX */ +static unsigned char utf16_literal_to_utf8(const unsigned char * const input_pointer, const unsigned char * const input_end, unsigned char **output_pointer) +{ + long unsigned int codepoint = 0; + unsigned int first_code = 0; + const unsigned char *first_sequence = input_pointer; + unsigned char utf8_length = 0; + unsigned char utf8_position = 0; + unsigned char sequence_length = 0; + unsigned char first_byte_mark = 0; + + if ((input_end - first_sequence) < 6) + { + /* input ends unexpectedly */ + goto fail; + } + + /* get the first utf16 sequence */ + first_code = parse_hex4(first_sequence + 2); + + /* check that the code is valid */ + if (((first_code >= 0xDC00) && (first_code <= 0xDFFF))) + { + goto fail; + } + + /* UTF16 surrogate pair */ + if ((first_code >= 0xD800) && (first_code <= 0xDBFF)) + { + const unsigned char *second_sequence = first_sequence + 6; + unsigned int second_code = 0; + sequence_length = 12; /* \uXXXX\uXXXX */ + + if ((input_end - second_sequence) < 6) + { + /* input ends unexpectedly */ + goto fail; + } + + if ((second_sequence[0] != '\\') || (second_sequence[1] != 'u')) + { + /* missing second half of the surrogate pair */ + goto fail; + } + + /* get the second utf16 sequence */ + second_code = parse_hex4(second_sequence + 2); + /* check that the code is valid */ + if ((second_code < 0xDC00) || (second_code > 0xDFFF)) + { + /* invalid second half of the surrogate pair */ + goto fail; + } + + + /* calculate the unicode codepoint from the surrogate pair */ + codepoint = 0x10000 + (((first_code & 0x3FF) << 10) | (second_code & 0x3FF)); + } + else + { + sequence_length = 6; /* \uXXXX */ + codepoint = first_code; + } + + /* encode as UTF-8 + * takes at maximum 4 bytes to encode: + * 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx */ + if (codepoint < 0x80) + { + /* normal ascii, encoding 0xxxxxxx */ + utf8_length = 1; + } + else if (codepoint < 0x800) + { + /* two bytes, encoding 110xxxxx 10xxxxxx */ + utf8_length = 2; + first_byte_mark = 0xC0; /* 11000000 */ + } + else if (codepoint < 0x10000) + { + /* three bytes, encoding 1110xxxx 10xxxxxx 10xxxxxx */ + utf8_length = 3; + first_byte_mark = 0xE0; /* 11100000 */ + } + else if (codepoint <= 0x10FFFF) + { + /* four bytes, encoding 1110xxxx 10xxxxxx 10xxxxxx 10xxxxxx */ + utf8_length = 4; + first_byte_mark = 0xF0; /* 11110000 */ + } + else + { + /* invalid unicode codepoint */ + goto fail; + } + + /* encode as utf8 */ + for (utf8_position = (unsigned char)(utf8_length - 1); utf8_position > 0; utf8_position--) + { + /* 10xxxxxx */ + (*output_pointer)[utf8_position] = (unsigned char)((codepoint | 0x80) & 0xBF); + codepoint >>= 6; + } + /* encode first byte */ + if (utf8_length > 1) + { + (*output_pointer)[0] = (unsigned char)((codepoint | first_byte_mark) & 0xFF); + } + else + { + (*output_pointer)[0] = (unsigned char)(codepoint & 0x7F); + } + + *output_pointer += utf8_length; + + return sequence_length; + +fail: + return 0; +} + +/* Parse the input text into an unescaped cinput, and populate item. */ +static cJSON_bool parse_string(cJSON * const item, parse_buffer * const input_buffer) +{ + const unsigned char *input_pointer = buffer_at_offset(input_buffer) + 1; + const unsigned char *input_end = buffer_at_offset(input_buffer) + 1; + unsigned char *output_pointer = NULL; + unsigned char *output = NULL; + + /* not a string */ + if (buffer_at_offset(input_buffer)[0] != '\"') + { + goto fail; + } + + { + /* calculate approximate size of the output (overestimate) */ + size_t allocation_length = 0; + size_t skipped_bytes = 0; + while (((size_t)(input_end - input_buffer->content) < input_buffer->length) && (*input_end != '\"')) + { + /* is escape sequence */ + if (input_end[0] == '\\') + { + if ((size_t)(input_end + 1 - input_buffer->content) >= input_buffer->length) + { + /* prevent buffer overflow when last input character is a backslash */ + goto fail; + } + skipped_bytes++; + input_end++; + } + input_end++; + } + if (((size_t)(input_end - input_buffer->content) >= input_buffer->length) || (*input_end != '\"')) + { + goto fail; /* string ended unexpectedly */ + } + + /* This is at most how much we need for the output */ + allocation_length = (size_t) (input_end - buffer_at_offset(input_buffer)) - skipped_bytes; + output = (unsigned char*)input_buffer->hooks.allocate(allocation_length + sizeof("")); + if (output == NULL) + { + goto fail; /* allocation failure */ + } + } + + output_pointer = output; + /* loop through the string literal */ + while (input_pointer < input_end) + { + if (*input_pointer != '\\') + { + *output_pointer++ = *input_pointer++; + } + /* escape sequence */ + else + { + unsigned char sequence_length = 2; + if ((input_end - input_pointer) < 1) + { + goto fail; + } + + switch (input_pointer[1]) + { + case 'b': + *output_pointer++ = '\b'; + break; + case 'f': + *output_pointer++ = '\f'; + break; + case 'n': + *output_pointer++ = '\n'; + break; + case 'r': + *output_pointer++ = '\r'; + break; + case 't': + *output_pointer++ = '\t'; + break; + case '\"': + case '\\': + case '/': + *output_pointer++ = input_pointer[1]; + break; + + /* UTF-16 literal */ + case 'u': + sequence_length = utf16_literal_to_utf8(input_pointer, input_end, &output_pointer); + if (sequence_length == 0) + { + /* failed to convert UTF16-literal to UTF-8 */ + goto fail; + } + break; + + default: + goto fail; + } + input_pointer += sequence_length; + } + } + + /* zero terminate the output */ + *output_pointer = '\0'; + + item->type = cJSON_String; + item->valuestring = (char*)output; + + input_buffer->offset = (size_t) (input_end - input_buffer->content); + input_buffer->offset++; + + return true; + +fail: + if (output != NULL) + { + input_buffer->hooks.deallocate(output); + output = NULL; + } + + if (input_pointer != NULL) + { + input_buffer->offset = (size_t)(input_pointer - input_buffer->content); + } + + return false; +} + +/* Render the cstring provided to an escaped version that can be printed. */ +static cJSON_bool print_string_ptr(const unsigned char * const input, printbuffer * const output_buffer) +{ + const unsigned char *input_pointer = NULL; + unsigned char *output = NULL; + unsigned char *output_pointer = NULL; + size_t output_length = 0; + /* numbers of additional characters needed for escaping */ + size_t escape_characters = 0; + + if (output_buffer == NULL) + { + return false; + } + + /* empty string */ + if (input == NULL) + { + output = ensure(output_buffer, sizeof("\"\"")); + if (output == NULL) + { + return false; + } + strcpy((char*)output, "\"\""); + + return true; + } + + /* set "flag" to 1 if something needs to be escaped */ + for (input_pointer = input; *input_pointer; input_pointer++) + { + switch (*input_pointer) + { + case '\"': + case '\\': + case '\b': + case '\f': + case '\n': + case '\r': + case '\t': + /* one character escape sequence */ + escape_characters++; + break; + default: + if (*input_pointer < 32) + { + /* UTF-16 escape sequence uXXXX */ + escape_characters += 5; + } + break; + } + } + output_length = (size_t)(input_pointer - input) + escape_characters; + + output = ensure(output_buffer, output_length + sizeof("\"\"")); + if (output == NULL) + { + return false; + } + + /* no characters have to be escaped */ + if (escape_characters == 0) + { + output[0] = '\"'; + memcpy(output + 1, input, output_length); + output[output_length + 1] = '\"'; + output[output_length + 2] = '\0'; + + return true; + } + + output[0] = '\"'; + output_pointer = output + 1; + /* copy the string */ + for (input_pointer = input; *input_pointer != '\0'; (void)input_pointer++, output_pointer++) + { + if ((*input_pointer > 31) && (*input_pointer != '\"') && (*input_pointer != '\\')) + { + /* normal character, copy */ + *output_pointer = *input_pointer; + } + else + { + /* character needs to be escaped */ + *output_pointer++ = '\\'; + switch (*input_pointer) + { + case '\\': + *output_pointer = '\\'; + break; + case '\"': + *output_pointer = '\"'; + break; + case '\b': + *output_pointer = 'b'; + break; + case '\f': + *output_pointer = 'f'; + break; + case '\n': + *output_pointer = 'n'; + break; + case '\r': + *output_pointer = 'r'; + break; + case '\t': + *output_pointer = 't'; + break; + default: + /* escape and print as unicode codepoint */ + sprintf((char*)output_pointer, "u%04x", *input_pointer); + output_pointer += 4; + break; + } + } + } + output[output_length + 1] = '\"'; + output[output_length + 2] = '\0'; + + return true; +} + +/* Invoke print_string_ptr (which is useful) on an item. */ +static cJSON_bool print_string(const cJSON * const item, printbuffer * const p) +{ + return print_string_ptr((unsigned char*)item->valuestring, p); +} + +/* Predeclare these prototypes. */ +static cJSON_bool parse_value(cJSON * const item, parse_buffer * const input_buffer); +static cJSON_bool print_value(const cJSON * const item, printbuffer * const output_buffer); +static cJSON_bool parse_array(cJSON * const item, parse_buffer * const input_buffer); +static cJSON_bool print_array(const cJSON * const item, printbuffer * const output_buffer); +static cJSON_bool parse_object(cJSON * const item, parse_buffer * const input_buffer); +static cJSON_bool print_object(const cJSON * const item, printbuffer * const output_buffer); + +/* Utility to jump whitespace and cr/lf */ +static parse_buffer *buffer_skip_whitespace(parse_buffer * const buffer) +{ + if ((buffer == NULL) || (buffer->content == NULL)) + { + return NULL; + } + + if (cannot_access_at_index(buffer, 0)) + { + return buffer; + } + + while (can_access_at_index(buffer, 0) && (buffer_at_offset(buffer)[0] <= 32)) + { + buffer->offset++; + } + + if (buffer->offset == buffer->length) + { + buffer->offset--; + } + + return buffer; +} + +/* skip the UTF-8 BOM (byte order mark) if it is at the beginning of a buffer */ +static parse_buffer *skip_utf8_bom(parse_buffer * const buffer) +{ + if ((buffer == NULL) || (buffer->content == NULL) || (buffer->offset != 0)) + { + return NULL; + } + + if (can_access_at_index(buffer, 4) && (strncmp((const char*)buffer_at_offset(buffer), "\xEF\xBB\xBF", 3) == 0)) + { + buffer->offset += 3; + } + + return buffer; +} + +CJSON_PUBLIC(cJSON *) cJSON_ParseWithOpts(const char *value, const char **return_parse_end, cJSON_bool require_null_terminated) +{ + size_t buffer_length; + + if (NULL == value) + { + return NULL; + } + + /* Adding null character size due to require_null_terminated. */ + buffer_length = strlen(value) + sizeof(""); + + return cJSON_ParseWithLengthOpts(value, buffer_length, return_parse_end, require_null_terminated); +} + +/* Parse an object - create a new root, and populate. */ +CJSON_PUBLIC(cJSON *) cJSON_ParseWithLengthOpts(const char *value, size_t buffer_length, const char **return_parse_end, cJSON_bool require_null_terminated) +{ + parse_buffer buffer = { 0, 0, 0, 0, { 0, 0, 0 } }; + cJSON *item = NULL; + + /* reset error position */ + global_error.json = NULL; + global_error.position = 0; + + if (value == NULL || 0 == buffer_length) + { + goto fail; + } + + buffer.content = (const unsigned char*)value; + buffer.length = buffer_length; + buffer.offset = 0; + buffer.hooks = global_hooks; + + item = cJSON_New_Item(&global_hooks); + if (item == NULL) /* memory fail */ + { + goto fail; + } + + if (!parse_value(item, buffer_skip_whitespace(skip_utf8_bom(&buffer)))) + { + /* parse failure. ep is set. */ + goto fail; + } + + /* if we require null-terminated JSON without appended garbage, skip and then check for a null terminator */ + if (require_null_terminated) + { + buffer_skip_whitespace(&buffer); + if ((buffer.offset >= buffer.length) || buffer_at_offset(&buffer)[0] != '\0') + { + goto fail; + } + } + if (return_parse_end) + { + *return_parse_end = (const char*)buffer_at_offset(&buffer); + } + + return item; + +fail: + if (item != NULL) + { + cJSON_Delete(item); + } + + if (value != NULL) + { + error local_error; + local_error.json = (const unsigned char*)value; + local_error.position = 0; + + if (buffer.offset < buffer.length) + { + local_error.position = buffer.offset; + } + else if (buffer.length > 0) + { + local_error.position = buffer.length - 1; + } + + if (return_parse_end != NULL) + { + *return_parse_end = (const char*)local_error.json + local_error.position; + } + + global_error = local_error; + } + + return NULL; +} + +/* Default options for cJSON_Parse */ +CJSON_PUBLIC(cJSON *) cJSON_Parse(const char *value) +{ + return cJSON_ParseWithOpts(value, 0, 0); +} + +CJSON_PUBLIC(cJSON *) cJSON_ParseWithLength(const char *value, size_t buffer_length) +{ + return cJSON_ParseWithLengthOpts(value, buffer_length, 0, 0); +} + +#define cjson_min(a, b) (((a) < (b)) ? (a) : (b)) + +static unsigned char *print(const cJSON * const item, cJSON_bool format, const internal_hooks * const hooks) +{ + static const size_t default_buffer_size = 256; + printbuffer buffer[1]; + unsigned char *printed = NULL; + + memset(buffer, 0, sizeof(buffer)); + + /* create buffer */ + buffer->buffer = (unsigned char*) hooks->allocate(default_buffer_size); + buffer->length = default_buffer_size; + buffer->format = format; + buffer->hooks = *hooks; + if (buffer->buffer == NULL) + { + goto fail; + } + + /* print the value */ + if (!print_value(item, buffer)) + { + goto fail; + } + update_offset(buffer); + + /* check if reallocate is available */ + if (hooks->reallocate != NULL) + { + printed = (unsigned char*) hooks->reallocate(buffer->buffer, buffer->offset + 1); + if (printed == NULL) { + goto fail; + } + buffer->buffer = NULL; + } + else /* otherwise copy the JSON over to a new buffer */ + { + printed = (unsigned char*) hooks->allocate(buffer->offset + 1); + if (printed == NULL) + { + goto fail; + } + memcpy(printed, buffer->buffer, cjson_min(buffer->length, buffer->offset + 1)); + printed[buffer->offset] = '\0'; /* just to be sure */ + + /* free the buffer */ + hooks->deallocate(buffer->buffer); + buffer->buffer = NULL; + } + + return printed; + +fail: + if (buffer->buffer != NULL) + { + hooks->deallocate(buffer->buffer); + buffer->buffer = NULL; + } + + if (printed != NULL) + { + hooks->deallocate(printed); + printed = NULL; + } + + return NULL; +} + +/* Render a cJSON item/entity/structure to text. */ +CJSON_PUBLIC(char *) cJSON_Print(const cJSON *item) +{ + return (char*)print(item, true, &global_hooks); +} + +CJSON_PUBLIC(char *) cJSON_PrintUnformatted(const cJSON *item) +{ + return (char*)print(item, false, &global_hooks); +} + +CJSON_PUBLIC(char *) cJSON_PrintBuffered(const cJSON *item, int prebuffer, cJSON_bool fmt) +{ + printbuffer p = { 0, 0, 0, 0, 0, 0, { 0, 0, 0 } }; + + if (prebuffer < 0) + { + return NULL; + } + + p.buffer = (unsigned char*)global_hooks.allocate((size_t)prebuffer); + if (!p.buffer) + { + return NULL; + } + + p.length = (size_t)prebuffer; + p.offset = 0; + p.noalloc = false; + p.format = fmt; + p.hooks = global_hooks; + + if (!print_value(item, &p)) + { + global_hooks.deallocate(p.buffer); + p.buffer = NULL; + return NULL; + } + + return (char*)p.buffer; +} + +CJSON_PUBLIC(cJSON_bool) cJSON_PrintPreallocated(cJSON *item, char *buffer, const int length, const cJSON_bool format) +{ + printbuffer p = { 0, 0, 0, 0, 0, 0, { 0, 0, 0 } }; + + if ((length < 0) || (buffer == NULL)) + { + return false; + } + + p.buffer = (unsigned char*)buffer; + p.length = (size_t)length; + p.offset = 0; + p.noalloc = true; + p.format = format; + p.hooks = global_hooks; + + return print_value(item, &p); +} + +/* Parser core - when encountering text, process appropriately. */ +static cJSON_bool parse_value(cJSON * const item, parse_buffer * const input_buffer) +{ + if ((input_buffer == NULL) || (input_buffer->content == NULL)) + { + return false; /* no input */ + } + + /* parse the different types of values */ + /* null */ + if (can_read(input_buffer, 4) && (strncmp((const char*)buffer_at_offset(input_buffer), "null", 4) == 0)) + { + item->type = cJSON_NULL; + input_buffer->offset += 4; + return true; + } + /* false */ + if (can_read(input_buffer, 5) && (strncmp((const char*)buffer_at_offset(input_buffer), "false", 5) == 0)) + { + item->type = cJSON_False; + input_buffer->offset += 5; + return true; + } + /* true */ + if (can_read(input_buffer, 4) && (strncmp((const char*)buffer_at_offset(input_buffer), "true", 4) == 0)) + { + item->type = cJSON_True; + item->valueint = 1; + input_buffer->offset += 4; + return true; + } + /* string */ + if (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == '\"')) + { + return parse_string(item, input_buffer); + } + /* number */ + if (can_access_at_index(input_buffer, 0) && ((buffer_at_offset(input_buffer)[0] == '-') || ((buffer_at_offset(input_buffer)[0] >= '0') && (buffer_at_offset(input_buffer)[0] <= '9')))) + { + return parse_number(item, input_buffer); + } + /* array */ + if (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == '[')) + { + return parse_array(item, input_buffer); + } + /* object */ + if (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == '{')) + { + return parse_object(item, input_buffer); + } + + return false; +} + +/* Render a value to text. */ +static cJSON_bool print_value(const cJSON * const item, printbuffer * const output_buffer) +{ + unsigned char *output = NULL; + + if ((item == NULL) || (output_buffer == NULL)) + { + return false; + } + + switch ((item->type) & 0xFF) + { + case cJSON_NULL: + output = ensure(output_buffer, 5); + if (output == NULL) + { + return false; + } + strcpy((char*)output, "null"); + return true; + + case cJSON_False: + output = ensure(output_buffer, 6); + if (output == NULL) + { + return false; + } + strcpy((char*)output, "false"); + return true; + + case cJSON_True: + output = ensure(output_buffer, 5); + if (output == NULL) + { + return false; + } + strcpy((char*)output, "true"); + return true; + + case cJSON_Number: + return print_number(item, output_buffer); + + case cJSON_Raw: + { + size_t raw_length = 0; + if (item->valuestring == NULL) + { + return false; + } + + raw_length = strlen(item->valuestring) + sizeof(""); + output = ensure(output_buffer, raw_length); + if (output == NULL) + { + return false; + } + memcpy(output, item->valuestring, raw_length); + return true; + } + + case cJSON_String: + return print_string(item, output_buffer); + + case cJSON_Array: + return print_array(item, output_buffer); + + case cJSON_Object: + return print_object(item, output_buffer); + + default: + return false; + } +} + +/* Build an array from input text. */ +static cJSON_bool parse_array(cJSON * const item, parse_buffer * const input_buffer) +{ + cJSON *head = NULL; /* head of the linked list */ + cJSON *current_item = NULL; + + if (input_buffer->depth >= CJSON_NESTING_LIMIT) + { + return false; /* to deeply nested */ + } + input_buffer->depth++; + + if (buffer_at_offset(input_buffer)[0] != '[') + { + /* not an array */ + goto fail; + } + + input_buffer->offset++; + buffer_skip_whitespace(input_buffer); + if (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == ']')) + { + /* empty array */ + goto success; + } + + /* check if we skipped to the end of the buffer */ + if (cannot_access_at_index(input_buffer, 0)) + { + input_buffer->offset--; + goto fail; + } + + /* step back to character in front of the first element */ + input_buffer->offset--; + /* loop through the comma separated array elements */ + do + { + /* allocate next item */ + cJSON *new_item = cJSON_New_Item(&(input_buffer->hooks)); + if (new_item == NULL) + { + goto fail; /* allocation failure */ + } + + /* attach next item to list */ + if (head == NULL) + { + /* start the linked list */ + current_item = head = new_item; + } + else + { + /* add to the end and advance */ + current_item->next = new_item; + new_item->prev = current_item; + current_item = new_item; + } + + /* parse next value */ + input_buffer->offset++; + buffer_skip_whitespace(input_buffer); + if (!parse_value(current_item, input_buffer)) + { + goto fail; /* failed to parse value */ + } + buffer_skip_whitespace(input_buffer); + } + while (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == ',')); + + if (cannot_access_at_index(input_buffer, 0) || buffer_at_offset(input_buffer)[0] != ']') + { + goto fail; /* expected end of array */ + } + +success: + input_buffer->depth--; + + if (head != NULL) { + head->prev = current_item; + } + + item->type = cJSON_Array; + item->child = head; + + input_buffer->offset++; + + return true; + +fail: + if (head != NULL) + { + cJSON_Delete(head); + } + + return false; +} + +/* Render an array to text */ +static cJSON_bool print_array(const cJSON * const item, printbuffer * const output_buffer) +{ + unsigned char *output_pointer = NULL; + size_t length = 0; + cJSON *current_element = item->child; + + if (output_buffer == NULL) + { + return false; + } + + /* Compose the output array. */ + /* opening square bracket */ + output_pointer = ensure(output_buffer, 1); + if (output_pointer == NULL) + { + return false; + } + + *output_pointer = '['; + output_buffer->offset++; + output_buffer->depth++; + + while (current_element != NULL) + { + if (!print_value(current_element, output_buffer)) + { + return false; + } + update_offset(output_buffer); + if (current_element->next) + { + length = (size_t) (output_buffer->format ? 2 : 1); + output_pointer = ensure(output_buffer, length + 1); + if (output_pointer == NULL) + { + return false; + } + *output_pointer++ = ','; + if(output_buffer->format) + { + *output_pointer++ = ' '; + } + *output_pointer = '\0'; + output_buffer->offset += length; + } + current_element = current_element->next; + } + + output_pointer = ensure(output_buffer, 2); + if (output_pointer == NULL) + { + return false; + } + *output_pointer++ = ']'; + *output_pointer = '\0'; + output_buffer->depth--; + + return true; +} + +/* Build an object from the text. */ +static cJSON_bool parse_object(cJSON * const item, parse_buffer * const input_buffer) +{ + cJSON *head = NULL; /* linked list head */ + cJSON *current_item = NULL; + + if (input_buffer->depth >= CJSON_NESTING_LIMIT) + { + return false; /* to deeply nested */ + } + input_buffer->depth++; + + if (cannot_access_at_index(input_buffer, 0) || (buffer_at_offset(input_buffer)[0] != '{')) + { + goto fail; /* not an object */ + } + + input_buffer->offset++; + buffer_skip_whitespace(input_buffer); + if (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == '}')) + { + goto success; /* empty object */ + } + + /* check if we skipped to the end of the buffer */ + if (cannot_access_at_index(input_buffer, 0)) + { + input_buffer->offset--; + goto fail; + } + + /* step back to character in front of the first element */ + input_buffer->offset--; + /* loop through the comma separated array elements */ + do + { + /* allocate next item */ + cJSON *new_item = cJSON_New_Item(&(input_buffer->hooks)); + if (new_item == NULL) + { + goto fail; /* allocation failure */ + } + + /* attach next item to list */ + if (head == NULL) + { + /* start the linked list */ + current_item = head = new_item; + } + else + { + /* add to the end and advance */ + current_item->next = new_item; + new_item->prev = current_item; + current_item = new_item; + } + + if (cannot_access_at_index(input_buffer, 1)) + { + goto fail; /* nothing comes after the comma */ + } + + /* parse the name of the child */ + input_buffer->offset++; + buffer_skip_whitespace(input_buffer); + if (!parse_string(current_item, input_buffer)) + { + goto fail; /* failed to parse name */ + } + buffer_skip_whitespace(input_buffer); + + /* swap valuestring and string, because we parsed the name */ + current_item->string = current_item->valuestring; + current_item->valuestring = NULL; + + if (cannot_access_at_index(input_buffer, 0) || (buffer_at_offset(input_buffer)[0] != ':')) + { + goto fail; /* invalid object */ + } + + /* parse the value */ + input_buffer->offset++; + buffer_skip_whitespace(input_buffer); + if (!parse_value(current_item, input_buffer)) + { + goto fail; /* failed to parse value */ + } + buffer_skip_whitespace(input_buffer); + } + while (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == ',')); + + if (cannot_access_at_index(input_buffer, 0) || (buffer_at_offset(input_buffer)[0] != '}')) + { + goto fail; /* expected end of object */ + } + +success: + input_buffer->depth--; + + if (head != NULL) { + head->prev = current_item; + } + + item->type = cJSON_Object; + item->child = head; + + input_buffer->offset++; + return true; + +fail: + if (head != NULL) + { + cJSON_Delete(head); + } + + return false; +} + +/* Render an object to text. */ +static cJSON_bool print_object(const cJSON * const item, printbuffer * const output_buffer) +{ + unsigned char *output_pointer = NULL; + size_t length = 0; + cJSON *current_item = item->child; + + if (output_buffer == NULL) + { + return false; + } + + /* Compose the output: */ + length = (size_t) (output_buffer->format ? 2 : 1); /* fmt: {\n */ + output_pointer = ensure(output_buffer, length + 1); + if (output_pointer == NULL) + { + return false; + } + + *output_pointer++ = '{'; + output_buffer->depth++; + if (output_buffer->format) + { + *output_pointer++ = '\n'; + } + output_buffer->offset += length; + + while (current_item) + { + if (output_buffer->format) + { + size_t i; + output_pointer = ensure(output_buffer, output_buffer->depth); + if (output_pointer == NULL) + { + return false; + } + for (i = 0; i < output_buffer->depth; i++) + { + *output_pointer++ = '\t'; + } + output_buffer->offset += output_buffer->depth; + } + + /* print key */ + if (!print_string_ptr((unsigned char*)current_item->string, output_buffer)) + { + return false; + } + update_offset(output_buffer); + + length = (size_t) (output_buffer->format ? 2 : 1); + output_pointer = ensure(output_buffer, length); + if (output_pointer == NULL) + { + return false; + } + *output_pointer++ = ':'; + if (output_buffer->format) + { + *output_pointer++ = '\t'; + } + output_buffer->offset += length; + + /* print value */ + if (!print_value(current_item, output_buffer)) + { + return false; + } + update_offset(output_buffer); + + /* print comma if not last */ + length = ((size_t)(output_buffer->format ? 1 : 0) + (size_t)(current_item->next ? 1 : 0)); + output_pointer = ensure(output_buffer, length + 1); + if (output_pointer == NULL) + { + return false; + } + if (current_item->next) + { + *output_pointer++ = ','; + } + + if (output_buffer->format) + { + *output_pointer++ = '\n'; + } + *output_pointer = '\0'; + output_buffer->offset += length; + + current_item = current_item->next; + } + + output_pointer = ensure(output_buffer, output_buffer->format ? (output_buffer->depth + 1) : 2); + if (output_pointer == NULL) + { + return false; + } + if (output_buffer->format) + { + size_t i; + for (i = 0; i < (output_buffer->depth - 1); i++) + { + *output_pointer++ = '\t'; + } + } + *output_pointer++ = '}'; + *output_pointer = '\0'; + output_buffer->depth--; + + return true; +} + +/* Get Array size/item / object item. */ +CJSON_PUBLIC(int) cJSON_GetArraySize(const cJSON *array) +{ + cJSON *child = NULL; + size_t size = 0; + + if (array == NULL) + { + return 0; + } + + child = array->child; + + while(child != NULL) + { + size++; + child = child->next; + } + + /* FIXME: Can overflow here. Cannot be fixed without breaking the API */ + + return (int)size; +} + +static cJSON* get_array_item(const cJSON *array, size_t index) +{ + cJSON *current_child = NULL; + + if (array == NULL) + { + return NULL; + } + + current_child = array->child; + while ((current_child != NULL) && (index > 0)) + { + index--; + current_child = current_child->next; + } + + return current_child; +} + +CJSON_PUBLIC(cJSON *) cJSON_GetArrayItem(const cJSON *array, int index) +{ + if (index < 0) + { + return NULL; + } + + return get_array_item(array, (size_t)index); +} + +static cJSON *get_object_item(const cJSON * const object, const char * const name, const cJSON_bool case_sensitive) +{ + cJSON *current_element = NULL; + + if ((object == NULL) || (name == NULL)) + { + return NULL; + } + + current_element = object->child; + if (case_sensitive) + { + while ((current_element != NULL) && (current_element->string != NULL) && (strcmp(name, current_element->string) != 0)) + { + current_element = current_element->next; + } + } + else + { + while ((current_element != NULL) && (case_insensitive_strcmp((const unsigned char*)name, (const unsigned char*)(current_element->string)) != 0)) + { + current_element = current_element->next; + } + } + + if ((current_element == NULL) || (current_element->string == NULL)) { + return NULL; + } + + return current_element; +} + +CJSON_PUBLIC(cJSON *) cJSON_GetObjectItem(const cJSON * const object, const char * const string) +{ + return get_object_item(object, string, false); +} + +CJSON_PUBLIC(cJSON *) cJSON_GetObjectItemCaseSensitive(const cJSON * const object, const char * const string) +{ + return get_object_item(object, string, true); +} + +CJSON_PUBLIC(cJSON_bool) cJSON_HasObjectItem(const cJSON *object, const char *string) +{ + return cJSON_GetObjectItem(object, string) ? 1 : 0; +} + +/* Utility for array list handling. */ +static void suffix_object(cJSON *prev, cJSON *item) +{ + prev->next = item; + item->prev = prev; +} + +/* Utility for handling references. */ +static cJSON *create_reference(const cJSON *item, const internal_hooks * const hooks) +{ + cJSON *reference = NULL; + if (item == NULL) + { + return NULL; + } + + reference = cJSON_New_Item(hooks); + if (reference == NULL) + { + return NULL; + } + + memcpy(reference, item, sizeof(cJSON)); + reference->string = NULL; + reference->type |= cJSON_IsReference; + reference->next = reference->prev = NULL; + return reference; +} + +static cJSON_bool add_item_to_array(cJSON *array, cJSON *item) +{ + cJSON *child = NULL; + + if ((item == NULL) || (array == NULL) || (array == item)) + { + return false; + } + + child = array->child; + /* + * To find the last item in array quickly, we use prev in array + */ + if (child == NULL) + { + /* list is empty, start new one */ + array->child = item; + item->prev = item; + item->next = NULL; + } + else + { + /* append to the end */ + if (child->prev) + { + suffix_object(child->prev, item); + array->child->prev = item; + } + } + + return true; +} + +/* Add item to array/object. */ +CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToArray(cJSON *array, cJSON *item) +{ + return add_item_to_array(array, item); +} + +#if defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ > 5)))) + #pragma GCC diagnostic push +#endif +#ifdef __GNUC__ +#pragma GCC diagnostic ignored "-Wcast-qual" +#endif +/* helper function to cast away const */ +static void* cast_away_const(const void* string) +{ + return (void*)string; +} +#if defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ > 5)))) + #pragma GCC diagnostic pop +#endif + + +static cJSON_bool add_item_to_object(cJSON * const object, const char * const string, cJSON * const item, const internal_hooks * const hooks, const cJSON_bool constant_key) +{ + char *new_key = NULL; + int new_type = cJSON_Invalid; + + if ((object == NULL) || (string == NULL) || (item == NULL) || (object == item)) + { + return false; + } + + if (constant_key) + { + new_key = (char*)cast_away_const(string); + new_type = item->type | cJSON_StringIsConst; + } + else + { + new_key = (char*)cJSON_strdup((const unsigned char*)string, hooks); + if (new_key == NULL) + { + return false; + } + + new_type = item->type & ~cJSON_StringIsConst; + } + + if (!(item->type & cJSON_StringIsConst) && (item->string != NULL)) + { + hooks->deallocate(item->string); + } + + item->string = new_key; + item->type = new_type; + + return add_item_to_array(object, item); +} + +CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item) +{ + return add_item_to_object(object, string, item, &global_hooks, false); +} + +/* Add an item to an object with constant string as key */ +CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item) +{ + return add_item_to_object(object, string, item, &global_hooks, true); +} + +CJSON_PUBLIC(cJSON_bool) cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item) +{ + if (array == NULL) + { + return false; + } + + return add_item_to_array(array, create_reference(item, &global_hooks)); +} + +CJSON_PUBLIC(cJSON_bool) cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item) +{ + if ((object == NULL) || (string == NULL)) + { + return false; + } + + return add_item_to_object(object, string, create_reference(item, &global_hooks), &global_hooks, false); +} + +CJSON_PUBLIC(cJSON*) cJSON_AddNullToObject(cJSON * const object, const char * const name) +{ + cJSON *null = cJSON_CreateNull(); + if (add_item_to_object(object, name, null, &global_hooks, false)) + { + return null; + } + + cJSON_Delete(null); + return NULL; +} + +CJSON_PUBLIC(cJSON*) cJSON_AddTrueToObject(cJSON * const object, const char * const name) +{ + cJSON *true_item = cJSON_CreateTrue(); + if (add_item_to_object(object, name, true_item, &global_hooks, false)) + { + return true_item; + } + + cJSON_Delete(true_item); + return NULL; +} + +CJSON_PUBLIC(cJSON*) cJSON_AddFalseToObject(cJSON * const object, const char * const name) +{ + cJSON *false_item = cJSON_CreateFalse(); + if (add_item_to_object(object, name, false_item, &global_hooks, false)) + { + return false_item; + } + + cJSON_Delete(false_item); + return NULL; +} + +CJSON_PUBLIC(cJSON*) cJSON_AddBoolToObject(cJSON * const object, const char * const name, const cJSON_bool boolean) +{ + cJSON *bool_item = cJSON_CreateBool(boolean); + if (add_item_to_object(object, name, bool_item, &global_hooks, false)) + { + return bool_item; + } + + cJSON_Delete(bool_item); + return NULL; +} + +CJSON_PUBLIC(cJSON*) cJSON_AddNumberToObject(cJSON * const object, const char * const name, const double number) +{ + cJSON *number_item = cJSON_CreateNumber(number); + if (add_item_to_object(object, name, number_item, &global_hooks, false)) + { + return number_item; + } + + cJSON_Delete(number_item); + return NULL; +} + +CJSON_PUBLIC(cJSON*) cJSON_AddStringToObject(cJSON * const object, const char * const name, const char * const string) +{ + cJSON *string_item = cJSON_CreateString(string); + if (add_item_to_object(object, name, string_item, &global_hooks, false)) + { + return string_item; + } + + cJSON_Delete(string_item); + return NULL; +} + +CJSON_PUBLIC(cJSON*) cJSON_AddRawToObject(cJSON * const object, const char * const name, const char * const raw) +{ + cJSON *raw_item = cJSON_CreateRaw(raw); + if (add_item_to_object(object, name, raw_item, &global_hooks, false)) + { + return raw_item; + } + + cJSON_Delete(raw_item); + return NULL; +} + +CJSON_PUBLIC(cJSON*) cJSON_AddObjectToObject(cJSON * const object, const char * const name) +{ + cJSON *object_item = cJSON_CreateObject(); + if (add_item_to_object(object, name, object_item, &global_hooks, false)) + { + return object_item; + } + + cJSON_Delete(object_item); + return NULL; +} + +CJSON_PUBLIC(cJSON*) cJSON_AddArrayToObject(cJSON * const object, const char * const name) +{ + cJSON *array = cJSON_CreateArray(); + if (add_item_to_object(object, name, array, &global_hooks, false)) + { + return array; + } + + cJSON_Delete(array); + return NULL; +} + +CJSON_PUBLIC(cJSON *) cJSON_DetachItemViaPointer(cJSON *parent, cJSON * const item) +{ + if ((parent == NULL) || (item == NULL)) + { + return NULL; + } + + if (item != parent->child) + { + /* not the first element */ + item->prev->next = item->next; + } + if (item->next != NULL) + { + /* not the last element */ + item->next->prev = item->prev; + } + + if (item == parent->child) + { + /* first element */ + parent->child = item->next; + } + else if (item->next == NULL) + { + /* last element */ + parent->child->prev = item->prev; + } + + /* make sure the detached item doesn't point anywhere anymore */ + item->prev = NULL; + item->next = NULL; + + return item; +} + +CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromArray(cJSON *array, int which) +{ + if (which < 0) + { + return NULL; + } + + return cJSON_DetachItemViaPointer(array, get_array_item(array, (size_t)which)); +} + +CJSON_PUBLIC(void) cJSON_DeleteItemFromArray(cJSON *array, int which) +{ + cJSON_Delete(cJSON_DetachItemFromArray(array, which)); +} + +CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObject(cJSON *object, const char *string) +{ + cJSON *to_detach = cJSON_GetObjectItem(object, string); + + return cJSON_DetachItemViaPointer(object, to_detach); +} + +CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObjectCaseSensitive(cJSON *object, const char *string) +{ + cJSON *to_detach = cJSON_GetObjectItemCaseSensitive(object, string); + + return cJSON_DetachItemViaPointer(object, to_detach); +} + +CJSON_PUBLIC(void) cJSON_DeleteItemFromObject(cJSON *object, const char *string) +{ + cJSON_Delete(cJSON_DetachItemFromObject(object, string)); +} + +CJSON_PUBLIC(void) cJSON_DeleteItemFromObjectCaseSensitive(cJSON *object, const char *string) +{ + cJSON_Delete(cJSON_DetachItemFromObjectCaseSensitive(object, string)); +} + +/* Replace array/object items with new ones. */ +CJSON_PUBLIC(cJSON_bool) cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newitem) +{ + cJSON *after_inserted = NULL; + + if (which < 0 || newitem == NULL) + { + return false; + } + + after_inserted = get_array_item(array, (size_t)which); + if (after_inserted == NULL) + { + return add_item_to_array(array, newitem); + } + + if (after_inserted != array->child && after_inserted->prev == NULL) { + /* return false if after_inserted is a corrupted array item */ + return false; + } + + newitem->next = after_inserted; + newitem->prev = after_inserted->prev; + after_inserted->prev = newitem; + if (after_inserted == array->child) + { + array->child = newitem; + } + else + { + newitem->prev->next = newitem; + } + return true; +} + +CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemViaPointer(cJSON * const parent, cJSON * const item, cJSON * replacement) +{ + if ((parent == NULL) || (parent->child == NULL) || (replacement == NULL) || (item == NULL)) + { + return false; + } + + if (replacement == item) + { + return true; + } + + replacement->next = item->next; + replacement->prev = item->prev; + + if (replacement->next != NULL) + { + replacement->next->prev = replacement; + } + if (parent->child == item) + { + if (parent->child->prev == parent->child) + { + replacement->prev = replacement; + } + parent->child = replacement; + } + else + { /* + * To find the last item in array quickly, we use prev in array. + * We can't modify the last item's next pointer where this item was the parent's child + */ + if (replacement->prev != NULL) + { + replacement->prev->next = replacement; + } + if (replacement->next == NULL) + { + parent->child->prev = replacement; + } + } + + item->next = NULL; + item->prev = NULL; + cJSON_Delete(item); + + return true; +} + +CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem) +{ + if (which < 0) + { + return false; + } + + return cJSON_ReplaceItemViaPointer(array, get_array_item(array, (size_t)which), newitem); +} + +static cJSON_bool replace_item_in_object(cJSON *object, const char *string, cJSON *replacement, cJSON_bool case_sensitive) +{ + if ((replacement == NULL) || (string == NULL)) + { + return false; + } + + /* replace the name in the replacement */ + if (!(replacement->type & cJSON_StringIsConst) && (replacement->string != NULL)) + { + cJSON_free(replacement->string); + } + replacement->string = (char*)cJSON_strdup((const unsigned char*)string, &global_hooks); + if (replacement->string == NULL) + { + return false; + } + + replacement->type &= ~cJSON_StringIsConst; + + return cJSON_ReplaceItemViaPointer(object, get_object_item(object, string, case_sensitive), replacement); +} + +CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInObject(cJSON *object, const char *string, cJSON *newitem) +{ + return replace_item_in_object(object, string, newitem, false); +} + +CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInObjectCaseSensitive(cJSON *object, const char *string, cJSON *newitem) +{ + return replace_item_in_object(object, string, newitem, true); +} + +/* Create basic types: */ +CJSON_PUBLIC(cJSON *) cJSON_CreateNull(void) +{ + cJSON *item = cJSON_New_Item(&global_hooks); + if(item) + { + item->type = cJSON_NULL; + } + + return item; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateTrue(void) +{ + cJSON *item = cJSON_New_Item(&global_hooks); + if(item) + { + item->type = cJSON_True; + } + + return item; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateFalse(void) +{ + cJSON *item = cJSON_New_Item(&global_hooks); + if(item) + { + item->type = cJSON_False; + } + + return item; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateBool(cJSON_bool boolean) +{ + cJSON *item = cJSON_New_Item(&global_hooks); + if(item) + { + item->type = boolean ? cJSON_True : cJSON_False; + } + + return item; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateNumber(double num) +{ + cJSON *item = cJSON_New_Item(&global_hooks); + if(item) + { + item->type = cJSON_Number; + item->valuedouble = num; + + /* use saturation in case of overflow */ + if (num >= INT_MAX) + { + item->valueint = INT_MAX; + } + else if (num <= (double)INT_MIN) + { + item->valueint = INT_MIN; + } + else + { + item->valueint = (int)num; + } + } + + return item; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateString(const char *string) +{ + cJSON *item = cJSON_New_Item(&global_hooks); + if(item) + { + item->type = cJSON_String; + item->valuestring = (char*)cJSON_strdup((const unsigned char*)string, &global_hooks); + if(!item->valuestring) + { + cJSON_Delete(item); + return NULL; + } + } + + return item; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateStringReference(const char *string) +{ + cJSON *item = cJSON_New_Item(&global_hooks); + if (item != NULL) + { + item->type = cJSON_String | cJSON_IsReference; + item->valuestring = (char*)cast_away_const(string); + } + + return item; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateObjectReference(const cJSON *child) +{ + cJSON *item = cJSON_New_Item(&global_hooks); + if (item != NULL) { + item->type = cJSON_Object | cJSON_IsReference; + item->child = (cJSON*)cast_away_const(child); + } + + return item; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateArrayReference(const cJSON *child) { + cJSON *item = cJSON_New_Item(&global_hooks); + if (item != NULL) { + item->type = cJSON_Array | cJSON_IsReference; + item->child = (cJSON*)cast_away_const(child); + } + + return item; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateRaw(const char *raw) +{ + cJSON *item = cJSON_New_Item(&global_hooks); + if(item) + { + item->type = cJSON_Raw; + item->valuestring = (char*)cJSON_strdup((const unsigned char*)raw, &global_hooks); + if(!item->valuestring) + { + cJSON_Delete(item); + return NULL; + } + } + + return item; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateArray(void) +{ + cJSON *item = cJSON_New_Item(&global_hooks); + if(item) + { + item->type=cJSON_Array; + } + + return item; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateObject(void) +{ + cJSON *item = cJSON_New_Item(&global_hooks); + if (item) + { + item->type = cJSON_Object; + } + + return item; +} + +/* Create Arrays: */ +CJSON_PUBLIC(cJSON *) cJSON_CreateIntArray(const int *numbers, int count) +{ + size_t i = 0; + cJSON *n = NULL; + cJSON *p = NULL; + cJSON *a = NULL; + + if ((count < 0) || (numbers == NULL)) + { + return NULL; + } + + a = cJSON_CreateArray(); + + for(i = 0; a && (i < (size_t)count); i++) + { + n = cJSON_CreateNumber(numbers[i]); + if (!n) + { + cJSON_Delete(a); + return NULL; + } + if(!i) + { + a->child = n; + } + else + { + suffix_object(p, n); + } + p = n; + } + + if (a && a->child) { + a->child->prev = n; + } + + return a; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateFloatArray(const float *numbers, int count) +{ + size_t i = 0; + cJSON *n = NULL; + cJSON *p = NULL; + cJSON *a = NULL; + + if ((count < 0) || (numbers == NULL)) + { + return NULL; + } + + a = cJSON_CreateArray(); + + for(i = 0; a && (i < (size_t)count); i++) + { + n = cJSON_CreateNumber((double)numbers[i]); + if(!n) + { + cJSON_Delete(a); + return NULL; + } + if(!i) + { + a->child = n; + } + else + { + suffix_object(p, n); + } + p = n; + } + + if (a && a->child) { + a->child->prev = n; + } + + return a; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateDoubleArray(const double *numbers, int count) +{ + size_t i = 0; + cJSON *n = NULL; + cJSON *p = NULL; + cJSON *a = NULL; + + if ((count < 0) || (numbers == NULL)) + { + return NULL; + } + + a = cJSON_CreateArray(); + + for(i = 0; a && (i < (size_t)count); i++) + { + n = cJSON_CreateNumber(numbers[i]); + if(!n) + { + cJSON_Delete(a); + return NULL; + } + if(!i) + { + a->child = n; + } + else + { + suffix_object(p, n); + } + p = n; + } + + if (a && a->child) { + a->child->prev = n; + } + + return a; +} + +CJSON_PUBLIC(cJSON *) cJSON_CreateStringArray(const char *const *strings, int count) +{ + size_t i = 0; + cJSON *n = NULL; + cJSON *p = NULL; + cJSON *a = NULL; + + if ((count < 0) || (strings == NULL)) + { + return NULL; + } + + a = cJSON_CreateArray(); + + for (i = 0; a && (i < (size_t)count); i++) + { + n = cJSON_CreateString(strings[i]); + if(!n) + { + cJSON_Delete(a); + return NULL; + } + if(!i) + { + a->child = n; + } + else + { + suffix_object(p,n); + } + p = n; + } + + if (a && a->child) { + a->child->prev = n; + } + + return a; +} + +/* Duplication */ +CJSON_PUBLIC(cJSON *) cJSON_Duplicate(const cJSON *item, cJSON_bool recurse) +{ + cJSON *newitem = NULL; + cJSON *child = NULL; + cJSON *next = NULL; + cJSON *newchild = NULL; + + /* Bail on bad ptr */ + if (!item) + { + goto fail; + } + /* Create new item */ + newitem = cJSON_New_Item(&global_hooks); + if (!newitem) + { + goto fail; + } + /* Copy over all vars */ + newitem->type = item->type & (~cJSON_IsReference); + newitem->valueint = item->valueint; + newitem->valuedouble = item->valuedouble; + if (item->valuestring) + { + newitem->valuestring = (char*)cJSON_strdup((unsigned char*)item->valuestring, &global_hooks); + if (!newitem->valuestring) + { + goto fail; + } + } + if (item->string) + { + newitem->string = (item->type&cJSON_StringIsConst) ? item->string : (char*)cJSON_strdup((unsigned char*)item->string, &global_hooks); + if (!newitem->string) + { + goto fail; + } + } + /* If non-recursive, then we're done! */ + if (!recurse) + { + return newitem; + } + /* Walk the ->next chain for the child. */ + child = item->child; + while (child != NULL) + { + newchild = cJSON_Duplicate(child, true); /* Duplicate (with recurse) each item in the ->next chain */ + if (!newchild) + { + goto fail; + } + if (next != NULL) + { + /* If newitem->child already set, then crosswire ->prev and ->next and move on */ + next->next = newchild; + newchild->prev = next; + next = newchild; + } + else + { + /* Set newitem->child and move to it */ + newitem->child = newchild; + next = newchild; + } + child = child->next; + } + if (newitem && newitem->child) + { + newitem->child->prev = newchild; + } + + return newitem; + +fail: + if (newitem != NULL) + { + cJSON_Delete(newitem); + } + + return NULL; +} + +static void skip_oneline_comment(char **input) +{ + *input += static_strlen("//"); + + for (; (*input)[0] != '\0'; ++(*input)) + { + if ((*input)[0] == '\n') { + *input += static_strlen("\n"); + return; + } + } +} + +static void skip_multiline_comment(char **input) +{ + *input += static_strlen("/*"); + + for (; (*input)[0] != '\0'; ++(*input)) + { + if (((*input)[0] == '*') && ((*input)[1] == '/')) + { + *input += static_strlen("*/"); + return; + } + } +} + +static void minify_string(char **input, char **output) { + (*output)[0] = (*input)[0]; + *input += static_strlen("\""); + *output += static_strlen("\""); + + + for (; (*input)[0] != '\0'; (void)++(*input), ++(*output)) { + (*output)[0] = (*input)[0]; + + if ((*input)[0] == '\"') { + (*output)[0] = '\"'; + *input += static_strlen("\""); + *output += static_strlen("\""); + return; + } else if (((*input)[0] == '\\') && ((*input)[1] == '\"')) { + (*output)[1] = (*input)[1]; + *input += static_strlen("\""); + *output += static_strlen("\""); + } + } +} + +CJSON_PUBLIC(void) cJSON_Minify(char *json) +{ + char *into = json; + + if (json == NULL) + { + return; + } + + while (json[0] != '\0') + { + switch (json[0]) + { + case ' ': + case '\t': + case '\r': + case '\n': + json++; + break; + + case '/': + if (json[1] == '/') + { + skip_oneline_comment(&json); + } + else if (json[1] == '*') + { + skip_multiline_comment(&json); + } else { + json++; + } + break; + + case '\"': + minify_string(&json, (char**)&into); + break; + + default: + into[0] = json[0]; + json++; + into++; + } + } + + /* and null-terminate. */ + *into = '\0'; +} + +CJSON_PUBLIC(cJSON_bool) cJSON_IsInvalid(const cJSON * const item) +{ + if (item == NULL) + { + return false; + } + + return (item->type & 0xFF) == cJSON_Invalid; +} + +CJSON_PUBLIC(cJSON_bool) cJSON_IsFalse(const cJSON * const item) +{ + if (item == NULL) + { + return false; + } + + return (item->type & 0xFF) == cJSON_False; +} + +CJSON_PUBLIC(cJSON_bool) cJSON_IsTrue(const cJSON * const item) +{ + if (item == NULL) + { + return false; + } + + return (item->type & 0xff) == cJSON_True; +} + + +CJSON_PUBLIC(cJSON_bool) cJSON_IsBool(const cJSON * const item) +{ + if (item == NULL) + { + return false; + } + + return (item->type & (cJSON_True | cJSON_False)) != 0; +} +CJSON_PUBLIC(cJSON_bool) cJSON_IsNull(const cJSON * const item) +{ + if (item == NULL) + { + return false; + } + + return (item->type & 0xFF) == cJSON_NULL; +} + +CJSON_PUBLIC(cJSON_bool) cJSON_IsNumber(const cJSON * const item) +{ + if (item == NULL) + { + return false; + } + + return (item->type & 0xFF) == cJSON_Number; +} + +CJSON_PUBLIC(cJSON_bool) cJSON_IsString(const cJSON * const item) +{ + if (item == NULL) + { + return false; + } + + return (item->type & 0xFF) == cJSON_String; +} + +CJSON_PUBLIC(cJSON_bool) cJSON_IsArray(const cJSON * const item) +{ + if (item == NULL) + { + return false; + } + + return (item->type & 0xFF) == cJSON_Array; +} + +CJSON_PUBLIC(cJSON_bool) cJSON_IsObject(const cJSON * const item) +{ + if (item == NULL) + { + return false; + } + + return (item->type & 0xFF) == cJSON_Object; +} + +CJSON_PUBLIC(cJSON_bool) cJSON_IsRaw(const cJSON * const item) +{ + if (item == NULL) + { + return false; + } + + return (item->type & 0xFF) == cJSON_Raw; +} + +CJSON_PUBLIC(cJSON_bool) cJSON_Compare(const cJSON * const a, const cJSON * const b, const cJSON_bool case_sensitive) +{ + if ((a == NULL) || (b == NULL) || ((a->type & 0xFF) != (b->type & 0xFF))) + { + return false; + } + + /* check if type is valid */ + switch (a->type & 0xFF) + { + case cJSON_False: + case cJSON_True: + case cJSON_NULL: + case cJSON_Number: + case cJSON_String: + case cJSON_Raw: + case cJSON_Array: + case cJSON_Object: + break; + + default: + return false; + } + + /* identical objects are equal */ + if (a == b) + { + return true; + } + + switch (a->type & 0xFF) + { + /* in these cases and equal type is enough */ + case cJSON_False: + case cJSON_True: + case cJSON_NULL: + return true; + + case cJSON_Number: + if (compare_double(a->valuedouble, b->valuedouble)) + { + return true; + } + return false; + + case cJSON_String: + case cJSON_Raw: + if ((a->valuestring == NULL) || (b->valuestring == NULL)) + { + return false; + } + if (strcmp(a->valuestring, b->valuestring) == 0) + { + return true; + } + + return false; + + case cJSON_Array: + { + cJSON *a_element = a->child; + cJSON *b_element = b->child; + + for (; (a_element != NULL) && (b_element != NULL);) + { + if (!cJSON_Compare(a_element, b_element, case_sensitive)) + { + return false; + } + + a_element = a_element->next; + b_element = b_element->next; + } + + /* one of the arrays is longer than the other */ + if (a_element != b_element) { + return false; + } + + return true; + } + + case cJSON_Object: + { + cJSON *a_element = NULL; + cJSON *b_element = NULL; + cJSON_ArrayForEach(a_element, a) + { + /* TODO This has O(n^2) runtime, which is horrible! */ + b_element = get_object_item(b, a_element->string, case_sensitive); + if (b_element == NULL) + { + return false; + } + + if (!cJSON_Compare(a_element, b_element, case_sensitive)) + { + return false; + } + } + + /* doing this twice, once on a and b to prevent true comparison if a subset of b + * TODO: Do this the proper way, this is just a fix for now */ + cJSON_ArrayForEach(b_element, b) + { + a_element = get_object_item(a, b_element->string, case_sensitive); + if (a_element == NULL) + { + return false; + } + + if (!cJSON_Compare(b_element, a_element, case_sensitive)) + { + return false; + } + } + + return true; + } + + default: + return false; + } +} + +CJSON_PUBLIC(void *) cJSON_malloc(size_t size) +{ + return global_hooks.allocate(size); +} + +CJSON_PUBLIC(void) cJSON_free(void *object) +{ + global_hooks.deallocate(object); + object = NULL; +} diff --git a/IOBox/cJSON.h b/IOBox/cJSON.h new file mode 100644 index 0000000..88cf0bc --- /dev/null +++ b/IOBox/cJSON.h @@ -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 + +/* 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 diff --git a/IOBox/cJSON_Utils.c b/IOBox/cJSON_Utils.c new file mode 100644 index 0000000..63651df --- /dev/null +++ b/IOBox/cJSON_Utils.c @@ -0,0 +1,1481 @@ +/* + 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. +*/ + +/* disable warnings about old C89 functions in MSVC */ +#if !defined(_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) +#define _CRT_SECURE_NO_DEPRECATE +#endif + +#ifdef __GNUCC__ +#pragma GCC visibility push(default) +#endif +#if defined(_MSC_VER) +#pragma warning (push) +/* disable warning about single line comments in system headers */ +#pragma warning (disable : 4001) +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +#if defined(_MSC_VER) +#pragma warning (pop) +#endif +#ifdef __GNUCC__ +#pragma GCC visibility pop +#endif + +#include "cJSON_Utils.h" + +/* define our own boolean type */ +#ifdef true +#undef true +#endif +#define true ((cJSON_bool)1) + +#ifdef false +#undef false +#endif +#define false ((cJSON_bool)0) + +static unsigned char* cJSONUtils_strdup(const unsigned char* const string) +{ + size_t length = 0; + unsigned char *copy = NULL; + + length = strlen((const char*)string) + sizeof(""); + copy = (unsigned char*) cJSON_malloc(length); + if (copy == NULL) + { + return NULL; + } + memcpy(copy, string, length); + + return copy; +} + +/* string comparison which doesn't consider NULL pointers equal */ +static int compare_strings(const unsigned char *string1, const unsigned char *string2, const cJSON_bool case_sensitive) +{ + if ((string1 == NULL) || (string2 == NULL)) + { + return 1; + } + + if (string1 == string2) + { + return 0; + } + + if (case_sensitive) + { + return strcmp((const char*)string1, (const char*)string2); + } + + for(; tolower(*string1) == tolower(*string2); (void)string1++, string2++) + { + if (*string1 == '\0') + { + return 0; + } + } + + return tolower(*string1) - tolower(*string2); +} + +/* securely comparison of floating-point variables */ +static cJSON_bool compare_double(double a, double b) +{ + double maxVal = fabs(a) > fabs(b) ? fabs(a) : fabs(b); + return (fabs(a - b) <= maxVal * DBL_EPSILON); +} + + +/* Compare the next path element of two JSON pointers, two NULL pointers are considered unequal: */ +static cJSON_bool compare_pointers(const unsigned char *name, const unsigned char *pointer, const cJSON_bool case_sensitive) +{ + if ((name == NULL) || (pointer == NULL)) + { + return false; + } + + for (; (*name != '\0') && (*pointer != '\0') && (*pointer != '/'); (void)name++, pointer++) /* compare until next '/' */ + { + if (*pointer == '~') + { + /* check for escaped '~' (~0) and '/' (~1) */ + if (((pointer[1] != '0') || (*name != '~')) && ((pointer[1] != '1') || (*name != '/'))) + { + /* invalid escape sequence or wrong character in *name */ + return false; + } + else + { + pointer++; + } + } + else if ((!case_sensitive && (tolower(*name) != tolower(*pointer))) || (case_sensitive && (*name != *pointer))) + { + return false; + } + } + if (((*pointer != 0) && (*pointer != '/')) != (*name != 0)) + { + /* one string has ended, the other not */ + return false;; + } + + return true; +} + +/* calculate the length of a string if encoded as JSON pointer with ~0 and ~1 escape sequences */ +static size_t pointer_encoded_length(const unsigned char *string) +{ + size_t length; + for (length = 0; *string != '\0'; (void)string++, length++) + { + /* character needs to be escaped? */ + if ((*string == '~') || (*string == '/')) + { + length++; + } + } + + return length; +} + +/* copy a string while escaping '~' and '/' with ~0 and ~1 JSON pointer escape codes */ +static void encode_string_as_pointer(unsigned char *destination, const unsigned char *source) +{ + for (; source[0] != '\0'; (void)source++, destination++) + { + if (source[0] == '/') + { + destination[0] = '~'; + destination[1] = '1'; + destination++; + } + else if (source[0] == '~') + { + destination[0] = '~'; + destination[1] = '0'; + destination++; + } + else + { + destination[0] = source[0]; + } + } + + destination[0] = '\0'; +} + +CJSON_PUBLIC(char *) cJSONUtils_FindPointerFromObjectTo(const cJSON * const object, const cJSON * const target) +{ + size_t child_index = 0; + cJSON *current_child = 0; + + if ((object == NULL) || (target == NULL)) + { + return NULL; + } + + if (object == target) + { + /* found */ + return (char*)cJSONUtils_strdup((const unsigned char*)""); + } + + /* recursively search all children of the object or array */ + for (current_child = object->child; current_child != NULL; (void)(current_child = current_child->next), child_index++) + { + unsigned char *target_pointer = (unsigned char*)cJSONUtils_FindPointerFromObjectTo(current_child, target); + /* found the target? */ + if (target_pointer != NULL) + { + if (cJSON_IsArray(object)) + { + /* reserve enough memory for a 64 bit integer + '/' and '\0' */ + unsigned char *full_pointer = (unsigned char*)cJSON_malloc(strlen((char*)target_pointer) + 20 + sizeof("/")); + /* check if conversion to unsigned long is valid + * This should be eliminated at compile time by dead code elimination + * if size_t is an alias of unsigned long, or if it is bigger */ + if (child_index > ULONG_MAX) + { + cJSON_free(target_pointer); + cJSON_free(full_pointer); + return NULL; + } + sprintf((char*)full_pointer, "/%lu%s", (unsigned long)child_index, target_pointer); /* / */ + cJSON_free(target_pointer); + + return (char*)full_pointer; + } + + if (cJSON_IsObject(object)) + { + unsigned char *full_pointer = (unsigned char*)cJSON_malloc(strlen((char*)target_pointer) + pointer_encoded_length((unsigned char*)current_child->string) + 2); + full_pointer[0] = '/'; + encode_string_as_pointer(full_pointer + 1, (unsigned char*)current_child->string); + strcat((char*)full_pointer, (char*)target_pointer); + cJSON_free(target_pointer); + + return (char*)full_pointer; + } + + /* reached leaf of the tree, found nothing */ + cJSON_free(target_pointer); + return NULL; + } + } + + /* not found */ + return NULL; +} + +/* non broken version of cJSON_GetArrayItem */ +static cJSON *get_array_item(const cJSON *array, size_t item) +{ + cJSON *child = array ? array->child : NULL; + while ((child != NULL) && (item > 0)) + { + item--; + child = child->next; + } + + return child; +} + +static cJSON_bool decode_array_index_from_pointer(const unsigned char * const pointer, size_t * const index) +{ + size_t parsed_index = 0; + size_t position = 0; + + if ((pointer[0] == '0') && ((pointer[1] != '\0') && (pointer[1] != '/'))) + { + /* leading zeroes are not permitted */ + return 0; + } + + for (position = 0; (pointer[position] >= '0') && (pointer[0] <= '9'); position++) + { + parsed_index = (10 * parsed_index) + (size_t)(pointer[position] - '0'); + + } + + if ((pointer[position] != '\0') && (pointer[position] != '/')) + { + return 0; + } + + *index = parsed_index; + + return 1; +} + +static cJSON *get_item_from_pointer(cJSON * const object, const char * pointer, const cJSON_bool case_sensitive) +{ + cJSON *current_element = object; + + if (pointer == NULL) + { + return NULL; + } + + /* follow path of the pointer */ + while ((pointer[0] == '/') && (current_element != NULL)) + { + pointer++; + if (cJSON_IsArray(current_element)) + { + size_t index = 0; + if (!decode_array_index_from_pointer((const unsigned char*)pointer, &index)) + { + return NULL; + } + + current_element = get_array_item(current_element, index); + } + else if (cJSON_IsObject(current_element)) + { + current_element = current_element->child; + /* GetObjectItem. */ + while ((current_element != NULL) && !compare_pointers((unsigned char*)current_element->string, (const unsigned char*)pointer, case_sensitive)) + { + current_element = current_element->next; + } + } + else + { + return NULL; + } + + /* skip to the next path token or end of string */ + while ((pointer[0] != '\0') && (pointer[0] != '/')) + { + pointer++; + } + } + + return current_element; +} + +CJSON_PUBLIC(cJSON *) cJSONUtils_GetPointer(cJSON * const object, const char *pointer) +{ + return get_item_from_pointer(object, pointer, false); +} + +CJSON_PUBLIC(cJSON *) cJSONUtils_GetPointerCaseSensitive(cJSON * const object, const char *pointer) +{ + return get_item_from_pointer(object, pointer, true); +} + +/* JSON Patch implementation. */ +static void decode_pointer_inplace(unsigned char *string) +{ + unsigned char *decoded_string = string; + + if (string == NULL) { + return; + } + + for (; *string; (void)decoded_string++, string++) + { + if (string[0] == '~') + { + if (string[1] == '0') + { + decoded_string[0] = '~'; + } + else if (string[1] == '1') + { + decoded_string[1] = '/'; + } + else + { + /* invalid escape sequence */ + return; + } + + string++; + } + } + + decoded_string[0] = '\0'; +} + +/* non-broken cJSON_DetachItemFromArray */ +static cJSON *detach_item_from_array(cJSON *array, size_t which) +{ + cJSON *c = array->child; + while (c && (which > 0)) + { + c = c->next; + which--; + } + if (!c) + { + /* item doesn't exist */ + return NULL; + } + if (c != array->child) + { + /* not the first element */ + c->prev->next = c->next; + } + if (c->next) + { + c->next->prev = c->prev; + } + if (c == array->child) + { + array->child = c->next; + } + else if (c->next == NULL) + { + array->child->prev = c->prev; + } + /* make sure the detached item doesn't point anywhere anymore */ + c->prev = c->next = NULL; + + return c; +} + +/* detach an item at the given path */ +static cJSON *detach_path(cJSON *object, const unsigned char *path, const cJSON_bool case_sensitive) +{ + unsigned char *parent_pointer = NULL; + unsigned char *child_pointer = NULL; + cJSON *parent = NULL; + cJSON *detached_item = NULL; + + /* copy path and split it in parent and child */ + parent_pointer = cJSONUtils_strdup(path); + if (parent_pointer == NULL) { + goto cleanup; + } + + child_pointer = (unsigned char*)strrchr((char*)parent_pointer, '/'); /* last '/' */ + if (child_pointer == NULL) + { + goto cleanup; + } + /* split strings */ + child_pointer[0] = '\0'; + child_pointer++; + + parent = get_item_from_pointer(object, (char*)parent_pointer, case_sensitive); + decode_pointer_inplace(child_pointer); + + if (cJSON_IsArray(parent)) + { + size_t index = 0; + if (!decode_array_index_from_pointer(child_pointer, &index)) + { + goto cleanup; + } + detached_item = detach_item_from_array(parent, index); + } + else if (cJSON_IsObject(parent)) + { + detached_item = cJSON_DetachItemFromObject(parent, (char*)child_pointer); + } + else + { + /* Couldn't find object to remove child from. */ + goto cleanup; + } + +cleanup: + if (parent_pointer != NULL) + { + cJSON_free(parent_pointer); + } + + return detached_item; +} + +/* sort lists using mergesort */ +static cJSON *sort_list(cJSON *list, const cJSON_bool case_sensitive) +{ + cJSON *first = list; + cJSON *second = list; + cJSON *current_item = list; + cJSON *result = list; + cJSON *result_tail = NULL; + + if ((list == NULL) || (list->next == NULL)) + { + /* One entry is sorted already. */ + return result; + } + + while ((current_item != NULL) && (current_item->next != NULL) && (compare_strings((unsigned char*)current_item->string, (unsigned char*)current_item->next->string, case_sensitive) < 0)) + { + /* Test for list sorted. */ + current_item = current_item->next; + } + if ((current_item == NULL) || (current_item->next == NULL)) + { + /* Leave sorted lists unmodified. */ + return result; + } + + /* reset pointer to the beginning */ + current_item = list; + while (current_item != NULL) + { + /* Walk two pointers to find the middle. */ + second = second->next; + current_item = current_item->next; + /* advances current_item two steps at a time */ + if (current_item != NULL) + { + current_item = current_item->next; + } + } + if ((second != NULL) && (second->prev != NULL)) + { + /* Split the lists */ + second->prev->next = NULL; + second->prev = NULL; + } + + /* Recursively sort the sub-lists. */ + first = sort_list(first, case_sensitive); + second = sort_list(second, case_sensitive); + result = NULL; + + /* Merge the sub-lists */ + while ((first != NULL) && (second != NULL)) + { + cJSON *smaller = NULL; + if (compare_strings((unsigned char*)first->string, (unsigned char*)second->string, case_sensitive) < 0) + { + smaller = first; + } + else + { + smaller = second; + } + + if (result == NULL) + { + /* start merged list with the smaller element */ + result_tail = smaller; + result = smaller; + } + else + { + /* add smaller element to the list */ + result_tail->next = smaller; + smaller->prev = result_tail; + result_tail = smaller; + } + + if (first == smaller) + { + first = first->next; + } + else + { + second = second->next; + } + } + + if (first != NULL) + { + /* Append rest of first list. */ + if (result == NULL) + { + return first; + } + result_tail->next = first; + first->prev = result_tail; + } + if (second != NULL) + { + /* Append rest of second list */ + if (result == NULL) + { + return second; + } + result_tail->next = second; + second->prev = result_tail; + } + + return result; +} + +static void sort_object(cJSON * const object, const cJSON_bool case_sensitive) +{ + if (object == NULL) + { + return; + } + object->child = sort_list(object->child, case_sensitive); +} + +static cJSON_bool compare_json(cJSON *a, cJSON *b, const cJSON_bool case_sensitive) +{ + if ((a == NULL) || (b == NULL) || ((a->type & 0xFF) != (b->type & 0xFF))) + { + /* mismatched type. */ + return false; + } + switch (a->type & 0xFF) + { + case cJSON_Number: + /* numeric mismatch. */ + if ((a->valueint != b->valueint) || (!compare_double(a->valuedouble, b->valuedouble))) + { + return false; + } + else + { + return true; + } + + case cJSON_String: + /* string mismatch. */ + if (strcmp(a->valuestring, b->valuestring) != 0) + { + return false; + } + else + { + return true; + } + + case cJSON_Array: + for ((void)(a = a->child), b = b->child; (a != NULL) && (b != NULL); (void)(a = a->next), b = b->next) + { + cJSON_bool identical = compare_json(a, b, case_sensitive); + if (!identical) + { + return false; + } + } + + /* array size mismatch? (one of both children is not NULL) */ + if ((a != NULL) || (b != NULL)) + { + return false; + } + else + { + return true; + } + + case cJSON_Object: + sort_object(a, case_sensitive); + sort_object(b, case_sensitive); + for ((void)(a = a->child), b = b->child; (a != NULL) && (b != NULL); (void)(a = a->next), b = b->next) + { + cJSON_bool identical = false; + /* compare object keys */ + if (compare_strings((unsigned char*)a->string, (unsigned char*)b->string, case_sensitive)) + { + /* missing member */ + return false; + } + identical = compare_json(a, b, case_sensitive); + if (!identical) + { + return false; + } + } + + /* object length mismatch (one of both children is not null) */ + if ((a != NULL) || (b != NULL)) + { + return false; + } + else + { + return true; + } + + default: + break; + } + + /* null, true or false */ + return true; +} + +/* non broken version of cJSON_InsertItemInArray */ +static cJSON_bool insert_item_in_array(cJSON *array, size_t which, cJSON *newitem) +{ + cJSON *child = array->child; + while (child && (which > 0)) + { + child = child->next; + which--; + } + if (which > 0) + { + /* item is after the end of the array */ + return 0; + } + if (child == NULL) + { + cJSON_AddItemToArray(array, newitem); + return 1; + } + + /* insert into the linked list */ + newitem->next = child; + newitem->prev = child->prev; + child->prev = newitem; + + /* was it at the beginning */ + if (child == array->child) + { + array->child = newitem; + } + else + { + newitem->prev->next = newitem; + } + + return 1; +} + +static cJSON *get_object_item(const cJSON * const object, const char* name, const cJSON_bool case_sensitive) +{ + if (case_sensitive) + { + return cJSON_GetObjectItemCaseSensitive(object, name); + } + + return cJSON_GetObjectItem(object, name); +} + +enum patch_operation { INVALID, ADD, REMOVE, REPLACE, MOVE, COPY, TEST }; + +static enum patch_operation decode_patch_operation(const cJSON * const patch, const cJSON_bool case_sensitive) +{ + cJSON *operation = get_object_item(patch, "op", case_sensitive); + if (!cJSON_IsString(operation)) + { + return INVALID; + } + + if (strcmp(operation->valuestring, "add") == 0) + { + return ADD; + } + + if (strcmp(operation->valuestring, "remove") == 0) + { + return REMOVE; + } + + if (strcmp(operation->valuestring, "replace") == 0) + { + return REPLACE; + } + + if (strcmp(operation->valuestring, "move") == 0) + { + return MOVE; + } + + if (strcmp(operation->valuestring, "copy") == 0) + { + return COPY; + } + + if (strcmp(operation->valuestring, "test") == 0) + { + return TEST; + } + + return INVALID; +} + +/* overwrite and existing item with another one and free resources on the way */ +static void overwrite_item(cJSON * const root, const cJSON replacement) +{ + if (root == NULL) + { + return; + } + + if (root->string != NULL) + { + cJSON_free(root->string); + } + if (root->valuestring != NULL) + { + cJSON_free(root->valuestring); + } + if (root->child != NULL) + { + cJSON_Delete(root->child); + } + + memcpy(root, &replacement, sizeof(cJSON)); +} + +static int apply_patch(cJSON *object, const cJSON *patch, const cJSON_bool case_sensitive) +{ + cJSON *path = NULL; + cJSON *value = NULL; + cJSON *parent = NULL; + enum patch_operation opcode = INVALID; + unsigned char *parent_pointer = NULL; + unsigned char *child_pointer = NULL; + int status = 0; + + path = get_object_item(patch, "path", case_sensitive); + if (!cJSON_IsString(path)) + { + /* malformed patch. */ + status = 2; + goto cleanup; + } + + opcode = decode_patch_operation(patch, case_sensitive); + if (opcode == INVALID) + { + status = 3; + goto cleanup; + } + else if (opcode == TEST) + { + /* compare value: {...} with the given path */ + status = !compare_json(get_item_from_pointer(object, path->valuestring, case_sensitive), get_object_item(patch, "value", case_sensitive), case_sensitive); + goto cleanup; + } + + /* special case for replacing the root */ + if (path->valuestring[0] == '\0') + { + if (opcode == REMOVE) + { + static const cJSON invalid = { NULL, NULL, NULL, cJSON_Invalid, NULL, 0, 0, NULL}; + + overwrite_item(object, invalid); + + status = 0; + goto cleanup; + } + + if ((opcode == REPLACE) || (opcode == ADD)) + { + value = get_object_item(patch, "value", case_sensitive); + if (value == NULL) + { + /* missing "value" for add/replace. */ + status = 7; + goto cleanup; + } + + value = cJSON_Duplicate(value, 1); + if (value == NULL) + { + /* out of memory for add/replace. */ + status = 8; + goto cleanup; + } + + overwrite_item(object, *value); + + /* delete the duplicated value */ + cJSON_free(value); + value = NULL; + + /* the string "value" isn't needed */ + if (object->string != NULL) + { + cJSON_free(object->string); + object->string = NULL; + } + + status = 0; + goto cleanup; + } + } + + if ((opcode == REMOVE) || (opcode == REPLACE)) + { + /* Get rid of old. */ + cJSON *old_item = detach_path(object, (unsigned char*)path->valuestring, case_sensitive); + if (old_item == NULL) + { + status = 13; + goto cleanup; + } + cJSON_Delete(old_item); + if (opcode == REMOVE) + { + /* For Remove, this job is done. */ + status = 0; + goto cleanup; + } + } + + /* Copy/Move uses "from". */ + if ((opcode == MOVE) || (opcode == COPY)) + { + cJSON *from = get_object_item(patch, "from", case_sensitive); + if (from == NULL) + { + /* missing "from" for copy/move. */ + status = 4; + goto cleanup; + } + + if (opcode == MOVE) + { + value = detach_path(object, (unsigned char*)from->valuestring, case_sensitive); + } + if (opcode == COPY) + { + value = get_item_from_pointer(object, from->valuestring, case_sensitive); + } + if (value == NULL) + { + /* missing "from" for copy/move. */ + status = 5; + goto cleanup; + } + if (opcode == COPY) + { + value = cJSON_Duplicate(value, 1); + } + if (value == NULL) + { + /* out of memory for copy/move. */ + status = 6; + goto cleanup; + } + } + else /* Add/Replace uses "value". */ + { + value = get_object_item(patch, "value", case_sensitive); + if (value == NULL) + { + /* missing "value" for add/replace. */ + status = 7; + goto cleanup; + } + value = cJSON_Duplicate(value, 1); + if (value == NULL) + { + /* out of memory for add/replace. */ + status = 8; + goto cleanup; + } + } + + /* Now, just add "value" to "path". */ + + /* split pointer in parent and child */ + parent_pointer = cJSONUtils_strdup((unsigned char*)path->valuestring); + if (parent_pointer) { + child_pointer = (unsigned char*)strrchr((char*)parent_pointer, '/'); + } + if (child_pointer != NULL) + { + child_pointer[0] = '\0'; + child_pointer++; + } + parent = get_item_from_pointer(object, (char*)parent_pointer, case_sensitive); + decode_pointer_inplace(child_pointer); + + /* add, remove, replace, move, copy, test. */ + if ((parent == NULL) || (child_pointer == NULL)) + { + /* Couldn't find object to add to. */ + status = 9; + goto cleanup; + } + else if (cJSON_IsArray(parent)) + { + if (strcmp((char*)child_pointer, "-") == 0) + { + cJSON_AddItemToArray(parent, value); + value = NULL; + } + else + { + size_t index = 0; + if (!decode_array_index_from_pointer(child_pointer, &index)) + { + status = 11; + goto cleanup; + } + + if (!insert_item_in_array(parent, index, value)) + { + status = 10; + goto cleanup; + } + value = NULL; + } + } + else if (cJSON_IsObject(parent)) + { + if (case_sensitive) + { + cJSON_DeleteItemFromObjectCaseSensitive(parent, (char*)child_pointer); + } + else + { + cJSON_DeleteItemFromObject(parent, (char*)child_pointer); + } + cJSON_AddItemToObject(parent, (char*)child_pointer, value); + value = NULL; + } + else /* parent is not an object */ + { + /* Couldn't find object to add to. */ + status = 9; + goto cleanup; + } + +cleanup: + if (value != NULL) + { + cJSON_Delete(value); + } + if (parent_pointer != NULL) + { + cJSON_free(parent_pointer); + } + + return status; +} + +CJSON_PUBLIC(int) cJSONUtils_ApplyPatches(cJSON * const object, const cJSON * const patches) +{ + const cJSON *current_patch = NULL; + int status = 0; + + if (!cJSON_IsArray(patches)) + { + /* malformed patches. */ + return 1; + } + + if (patches != NULL) + { + current_patch = patches->child; + } + + while (current_patch != NULL) + { + status = apply_patch(object, current_patch, false); + if (status != 0) + { + return status; + } + current_patch = current_patch->next; + } + + return 0; +} + +CJSON_PUBLIC(int) cJSONUtils_ApplyPatchesCaseSensitive(cJSON * const object, const cJSON * const patches) +{ + const cJSON *current_patch = NULL; + int status = 0; + + if (!cJSON_IsArray(patches)) + { + /* malformed patches. */ + return 1; + } + + if (patches != NULL) + { + current_patch = patches->child; + } + + while (current_patch != NULL) + { + status = apply_patch(object, current_patch, true); + if (status != 0) + { + return status; + } + current_patch = current_patch->next; + } + + return 0; +} + +static void compose_patch(cJSON * const patches, const unsigned char * const operation, const unsigned char * const path, const unsigned char *suffix, const cJSON * const value) +{ + cJSON *patch = NULL; + + if ((patches == NULL) || (operation == NULL) || (path == NULL)) + { + return; + } + + patch = cJSON_CreateObject(); + if (patch == NULL) + { + return; + } + cJSON_AddItemToObject(patch, "op", cJSON_CreateString((const char*)operation)); + + if (suffix == NULL) + { + cJSON_AddItemToObject(patch, "path", cJSON_CreateString((const char*)path)); + } + else + { + size_t suffix_length = pointer_encoded_length(suffix); + size_t path_length = strlen((const char*)path); + unsigned char *full_path = (unsigned char*)cJSON_malloc(path_length + suffix_length + sizeof("/")); + + sprintf((char*)full_path, "%s/", (const char*)path); + encode_string_as_pointer(full_path + path_length + 1, suffix); + + cJSON_AddItemToObject(patch, "path", cJSON_CreateString((const char*)full_path)); + cJSON_free(full_path); + } + + if (value != NULL) + { + cJSON_AddItemToObject(patch, "value", cJSON_Duplicate(value, 1)); + } + cJSON_AddItemToArray(patches, patch); +} + +CJSON_PUBLIC(void) cJSONUtils_AddPatchToArray(cJSON * const array, const char * const operation, const char * const path, const cJSON * const value) +{ + compose_patch(array, (const unsigned char*)operation, (const unsigned char*)path, NULL, value); +} + +static void create_patches(cJSON * const patches, const unsigned char * const path, cJSON * const from, cJSON * const to, const cJSON_bool case_sensitive) +{ + if ((from == NULL) || (to == NULL)) + { + return; + } + + if ((from->type & 0xFF) != (to->type & 0xFF)) + { + compose_patch(patches, (const unsigned char*)"replace", path, 0, to); + return; + } + + switch (from->type & 0xFF) + { + case cJSON_Number: + if ((from->valueint != to->valueint) || !compare_double(from->valuedouble, to->valuedouble)) + { + compose_patch(patches, (const unsigned char*)"replace", path, NULL, to); + } + return; + + case cJSON_String: + if (strcmp(from->valuestring, to->valuestring) != 0) + { + compose_patch(patches, (const unsigned char*)"replace", path, NULL, to); + } + return; + + case cJSON_Array: + { + size_t index = 0; + cJSON *from_child = from->child; + cJSON *to_child = to->child; + unsigned char *new_path = (unsigned char*)cJSON_malloc(strlen((const char*)path) + 20 + sizeof("/")); /* Allow space for 64bit int. log10(2^64) = 20 */ + + /* generate patches for all array elements that exist in both "from" and "to" */ + for (index = 0; (from_child != NULL) && (to_child != NULL); (void)(from_child = from_child->next), (void)(to_child = to_child->next), index++) + { + /* check if conversion to unsigned long is valid + * This should be eliminated at compile time by dead code elimination + * if size_t is an alias of unsigned long, or if it is bigger */ + if (index > ULONG_MAX) + { + cJSON_free(new_path); + return; + } + sprintf((char*)new_path, "%s/%lu", path, (unsigned long)index); /* path of the current array element */ + create_patches(patches, new_path, from_child, to_child, case_sensitive); + } + + /* remove leftover elements from 'from' that are not in 'to' */ + for (; (from_child != NULL); (void)(from_child = from_child->next)) + { + /* check if conversion to unsigned long is valid + * This should be eliminated at compile time by dead code elimination + * if size_t is an alias of unsigned long, or if it is bigger */ + if (index > ULONG_MAX) + { + cJSON_free(new_path); + return; + } + sprintf((char*)new_path, "%lu", (unsigned long)index); + compose_patch(patches, (const unsigned char*)"remove", path, new_path, NULL); + } + /* add new elements in 'to' that were not in 'from' */ + for (; (to_child != NULL); (void)(to_child = to_child->next), index++) + { + compose_patch(patches, (const unsigned char*)"add", path, (const unsigned char*)"-", to_child); + } + cJSON_free(new_path); + return; + } + + case cJSON_Object: + { + cJSON *from_child = NULL; + cJSON *to_child = NULL; + sort_object(from, case_sensitive); + sort_object(to, case_sensitive); + + from_child = from->child; + to_child = to->child; + /* for all object values in the object with more of them */ + while ((from_child != NULL) || (to_child != NULL)) + { + int diff; + if (from_child == NULL) + { + diff = 1; + } + else if (to_child == NULL) + { + diff = -1; + } + else + { + diff = compare_strings((unsigned char*)from_child->string, (unsigned char*)to_child->string, case_sensitive); + } + + if (diff == 0) + { + /* both object keys are the same */ + size_t path_length = strlen((const char*)path); + size_t from_child_name_length = pointer_encoded_length((unsigned char*)from_child->string); + unsigned char *new_path = (unsigned char*)cJSON_malloc(path_length + from_child_name_length + sizeof("/")); + + sprintf((char*)new_path, "%s/", path); + encode_string_as_pointer(new_path + path_length + 1, (unsigned char*)from_child->string); + + /* create a patch for the element */ + create_patches(patches, new_path, from_child, to_child, case_sensitive); + cJSON_free(new_path); + + from_child = from_child->next; + to_child = to_child->next; + } + else if (diff < 0) + { + /* object element doesn't exist in 'to' --> remove it */ + compose_patch(patches, (const unsigned char*)"remove", path, (unsigned char*)from_child->string, NULL); + + from_child = from_child->next; + } + else + { + /* object element doesn't exist in 'from' --> add it */ + compose_patch(patches, (const unsigned char*)"add", path, (unsigned char*)to_child->string, to_child); + + to_child = to_child->next; + } + } + return; + } + + default: + break; + } +} + +CJSON_PUBLIC(cJSON *) cJSONUtils_GeneratePatches(cJSON * const from, cJSON * const to) +{ + cJSON *patches = NULL; + + if ((from == NULL) || (to == NULL)) + { + return NULL; + } + + patches = cJSON_CreateArray(); + create_patches(patches, (const unsigned char*)"", from, to, false); + + return patches; +} + +CJSON_PUBLIC(cJSON *) cJSONUtils_GeneratePatchesCaseSensitive(cJSON * const from, cJSON * const to) +{ + cJSON *patches = NULL; + + if ((from == NULL) || (to == NULL)) + { + return NULL; + } + + patches = cJSON_CreateArray(); + create_patches(patches, (const unsigned char*)"", from, to, true); + + return patches; +} + +CJSON_PUBLIC(void) cJSONUtils_SortObject(cJSON * const object) +{ + sort_object(object, false); +} + +CJSON_PUBLIC(void) cJSONUtils_SortObjectCaseSensitive(cJSON * const object) +{ + sort_object(object, true); +} + +static cJSON *merge_patch(cJSON *target, const cJSON * const patch, const cJSON_bool case_sensitive) +{ + cJSON *patch_child = NULL; + + if (!cJSON_IsObject(patch)) + { + /* scalar value, array or NULL, just duplicate */ + cJSON_Delete(target); + return cJSON_Duplicate(patch, 1); + } + + if (!cJSON_IsObject(target)) + { + cJSON_Delete(target); + target = cJSON_CreateObject(); + } + + patch_child = patch->child; + while (patch_child != NULL) + { + if (cJSON_IsNull(patch_child)) + { + /* NULL is the indicator to remove a value, see RFC7396 */ + if (case_sensitive) + { + cJSON_DeleteItemFromObjectCaseSensitive(target, patch_child->string); + } + else + { + cJSON_DeleteItemFromObject(target, patch_child->string); + } + } + else + { + cJSON *replace_me = NULL; + cJSON *replacement = NULL; + + if (case_sensitive) + { + replace_me = cJSON_DetachItemFromObjectCaseSensitive(target, patch_child->string); + } + else + { + replace_me = cJSON_DetachItemFromObject(target, patch_child->string); + } + + replacement = merge_patch(replace_me, patch_child, case_sensitive); + if (replacement == NULL) + { + cJSON_Delete(target); + return NULL; + } + + cJSON_AddItemToObject(target, patch_child->string, replacement); + } + patch_child = patch_child->next; + } + return target; +} + +CJSON_PUBLIC(cJSON *) cJSONUtils_MergePatch(cJSON *target, const cJSON * const patch) +{ + return merge_patch(target, patch, false); +} + +CJSON_PUBLIC(cJSON *) cJSONUtils_MergePatchCaseSensitive(cJSON *target, const cJSON * const patch) +{ + return merge_patch(target, patch, true); +} + +static cJSON *generate_merge_patch(cJSON * const from, cJSON * const to, const cJSON_bool case_sensitive) +{ + cJSON *from_child = NULL; + cJSON *to_child = NULL; + cJSON *patch = NULL; + if (to == NULL) + { + /* patch to delete everything */ + return cJSON_CreateNull(); + } + if (!cJSON_IsObject(to) || !cJSON_IsObject(from)) + { + return cJSON_Duplicate(to, 1); + } + + sort_object(from, case_sensitive); + sort_object(to, case_sensitive); + + from_child = from->child; + to_child = to->child; + patch = cJSON_CreateObject(); + if (patch == NULL) + { + return NULL; + } + while (from_child || to_child) + { + int diff; + if (from_child != NULL) + { + if (to_child != NULL) + { + diff = strcmp(from_child->string, to_child->string); + } + else + { + diff = -1; + } + } + else + { + diff = 1; + } + + if (diff < 0) + { + /* from has a value that to doesn't have -> remove */ + cJSON_AddItemToObject(patch, from_child->string, cJSON_CreateNull()); + + from_child = from_child->next; + } + else if (diff > 0) + { + /* to has a value that from doesn't have -> add to patch */ + cJSON_AddItemToObject(patch, to_child->string, cJSON_Duplicate(to_child, 1)); + + to_child = to_child->next; + } + else + { + /* object key exists in both objects */ + if (!compare_json(from_child, to_child, case_sensitive)) + { + /* not identical --> generate a patch */ + cJSON_AddItemToObject(patch, to_child->string, cJSONUtils_GenerateMergePatch(from_child, to_child)); + } + + /* next key in the object */ + from_child = from_child->next; + to_child = to_child->next; + } + } + if (patch->child == NULL) + { + /* no patch generated */ + cJSON_Delete(patch); + return NULL; + } + + return patch; +} + +CJSON_PUBLIC(cJSON *) cJSONUtils_GenerateMergePatch(cJSON * const from, cJSON * const to) +{ + return generate_merge_patch(from, to, false); +} + +CJSON_PUBLIC(cJSON *) cJSONUtils_GenerateMergePatchCaseSensitive(cJSON * const from, cJSON * const to) +{ + return generate_merge_patch(from, to, true); +} diff --git a/IOBox/cJSON_Utils.h b/IOBox/cJSON_Utils.h new file mode 100644 index 0000000..a970c65 --- /dev/null +++ b/IOBox/cJSON_Utils.h @@ -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 diff --git a/IOBox/flow_chart.jpg b/IOBox/flow_chart.jpg new file mode 100644 index 0000000..2cc4c98 Binary files /dev/null and b/IOBox/flow_chart.jpg differ diff --git a/IOBox/iobox_api.cpp b/IOBox/iobox_api.cpp new file mode 100644 index 0000000..fe1fd3c --- /dev/null +++ b/IOBox/iobox_api.cpp @@ -0,0 +1,3354 @@ +#include "iobox_api.h" +#include "cJSON.h" +#include +#include +#include "mbedtls/sha256.h" +#include "mbedtls/aes.h" +#include "mbedtls/base64.h" +#include +#include +#include +#include +// Implementation: +#include +#include +#include + +namespace ANSCENTER { + iobox_api::iobox_api(const std::string& ip_mcast, int port_mcast) + { + macToIpMap.clear(); + ipToDeviceMap.clear(); + this->ip_mcast = ip_mcast; + this->port_mcast = port_mcast; + _username = "admin"; + _password = "1234"; + _port = 502; + WSADATA wsaData; + if (WSAStartup(MAKEWORD(2, 2), &wsaData) != 0) { + this->_logger.LogError("iobox_api::iobox_api. WSAStartup failed with error: ", std::to_string(WSAGetLastError()), __FILE__, __LINE__); + return; + } + } + iobox_api::~iobox_api() noexcept + { + // Cancel all active toggle operations before destroying + // This prevents detached threads from accessing a destroyed object + { + std::lock_guard mapLock(toggleMapMutex); + for (auto& pair : activeToggles) { + auto toggleInfo = pair.second; + if (toggleInfo) { + std::lock_guard infoLock(toggleInfo->mtx); + toggleInfo->cancelled = true; + toggleInfo->active = false; + toggleInfo->cv.notify_one(); + } + } + activeToggles.clear(); + } + + // Close all open TCP sockets before clearing profiles + { + std::lock_guard lock(this->_mutex); + for (auto& profile : this->iobox_profiles) { + if (profile.sock_tcp != INVALID_SOCKET) { + closesocket(profile.sock_tcp); + profile.sock_tcp = INVALID_SOCKET; + } + } + this->iobox_profiles.clear(); + } + + macToIpMap.clear(); + ipToDeviceMap.clear(); + WSACleanup(); + } + + bool isStringExistInVectorString(const std::vector& vec, const std::string& str) { + try { + for (const auto& item : vec) { + if (item.find(str) != std::string::npos) { + std::cout << "Found partial match: " << str << " in " << item << std::endl; + return true; + } + } + return false; + } + catch (const std::exception& e) { + std::cerr << e.what() << std::endl; + return false; + } + } + + void printBufferAsHex(const char* buffer, size_t length) { + try { + for (size_t i = 0; i < length; ++i) { + printf("%02X ", static_cast(buffer[i])); + if ((i + 1) % 16 == 0) { + printf("\n"); + } + } + printf("\n"); + } + catch (const std::exception& e) { + std::cerr << e.what() << std::endl; + } + } + void printStringAsHex(const std::string& str) { + try { + for (size_t i = 0; i < str.size(); ++i) { + printf("%02X ", static_cast(str[i])); + if ((i + 1) % 16 == 0) { + printf("\n"); + } + } + printf("\n"); + } + catch (const std::exception& e) { + std::cerr << e.what() << std::endl; + } + } + + std::string messageEncrypt(char* input, size_t input_len, const char* key) { +#if MESSAGE_CRYPT_ENABLE == 0 + return std::string(input, input_len); +#else + mbedtls_aes_context aes; + char iv[17] = "1234567890123456"; + + size_t padding_len = 16 - (input_len % 16); + if (padding_len == 0) { + padding_len = 16; + } + size_t padded_len = input_len + padding_len; + std::vector padded_input(padded_len); + memcpy(padded_input.data(), input, input_len); + for (size_t i = input_len; i < padded_len; ++i) { + padded_input[i] = static_cast(padding_len); + } + //init vector to hold data output + std::vector output(padded_len); + std::string base64_output; + + mbedtls_aes_init(&aes); + if (mbedtls_aes_setkey_enc(&aes, (const unsigned char*)key, 128) != 0) { + std::cerr << "Failed to set key" << std::endl; + mbedtls_aes_free(&aes); + //return empty vector + return base64_output; + } + + if (mbedtls_aes_crypt_cbc(&aes, MBEDTLS_AES_ENCRYPT, padded_len, (unsigned char*)iv, (const unsigned char*)padded_input.data(), (unsigned char*)output.data()) != 0) { + std::cerr << "Failed to encrypt" << std::endl; + mbedtls_aes_free(&aes); + return base64_output; + } + mbedtls_aes_free(&aes); + //encode to base64 + base64_output.resize(output.size() * 2); + size_t base64_len = 0; + if (mbedtls_base64_encode((unsigned char*)base64_output.data(), base64_output.size(), &base64_len, (const unsigned char*)output.data(), output.size()) != 0) { + std::cerr << "Failed to encode to base64" << std::endl; + return base64_output; + } + base64_output.resize(base64_len); + // std::cout << "Base64 output: " << base64_output << std::endl; + + return base64_output; +#endif + } + std::string messageDecrypt(char* input, size_t input_len, const char* key) { +#if MESSAGE_CRYPT_ENABLE == 0 + return std::string(input, input_len); +#else + mbedtls_aes_context aes; + //base64 decode + std::vector base64_decoded(input_len); + size_t base64_decoded_len = 0; + if (mbedtls_base64_decode((unsigned char*)base64_decoded.data(), base64_decoded.size(), &base64_decoded_len, (const unsigned char*)input, input_len) != 0) { + std::cerr << "Failed to decode base64" << std::endl; + return std::string(); + } + base64_decoded.resize(base64_decoded_len); + // std::cout << "Base64 decoded: " << base64_decoded.size() << std::endl; + + + char iv[17] = "1234567890123456"; + if (base64_decoded_len % 16 != 0) { + std::cerr << "Invalid input length" << std::endl; + return std::string(); + } + std::vector output(base64_decoded_len); + mbedtls_aes_init(&aes); + if (mbedtls_aes_setkey_dec(&aes, (const unsigned char*)key, 128) != 0) { + std::cerr << "Failed to set key" << std::endl; + mbedtls_aes_free(&aes); + return std::string(); + } + + if (mbedtls_aes_crypt_cbc(&aes, MBEDTLS_AES_DECRYPT, base64_decoded_len, (unsigned char*)iv, (const unsigned char*)base64_decoded.data(), (unsigned char*)output.data()) != 0) { + std::cerr << "Failed to decrypt" << std::endl; + mbedtls_aes_free(&aes); + return std::string(); + } + mbedtls_aes_free(&aes); + + // Remove PKCS5 padding + unsigned char padding_len = output.back(); + if (padding_len > 0 && padding_len <= 16) { + // std::cout << "Padding length: " << (int)padding_len << std::endl; + // printBufferAsHex(output.data(), output.size()); + output.resize(output.size() - padding_len); + } + else { + std::cerr << "Invalid padding length" << std::endl; + return std::string();; + } + //copy to string + std::string output_str(output.data(), output.size()); + // std::cout << "Decrypted: " << output_str << std::endl; + return output_str; +#endif + } + std::string stringToHexString(const std::string& str) { + // std::stringstream ss; + // for (size_t i = 0; i < str.length(); ++i) { + // ss << std::hex << std::setw(2) << std::setfill('0') << (int)str[i]; + // } + // return ss.str(); + const char* hex_chars = "0123456789ABCDEF"; + std::string hex_str; + hex_str.reserve(str.length() * 2); + for (unsigned char c : str) { + hex_str.push_back(hex_chars[c >> 4]); + hex_str.push_back(hex_chars[c & 0x0F]); + } + return hex_str; + } + bool isValidIp(const std::string& ip) { + struct sockaddr_in sa; + return inet_pton(AF_INET, ip.c_str(), &(sa.sin_addr)) != 0; + } + + std::string hostNameToIp(std::string hostName) { + struct hostent* host; + struct in_addr addr; + if ((host = gethostbyname(hostName.c_str())) == NULL) { + std::cerr << "Failed to get host by name: " << hostName << std::endl; + return ""; + } + addr.s_addr = *(u_long*)host->h_addr_list[0]; + return inet_ntoa(addr); + } + std::string checkIpFromRemote(const std::string& remote) { + std::string ip; + if (!isValidIp(remote)) { + std::cout << "Host name address: " << remote << std::endl; + ip = hostNameToIp(remote); + if (ip == "") { + std::cerr << "Failed to get ip from host name: " << remote << std::endl; + return ""; + } + return ip; + } + else return remote; + } + + + iobox_info_t parseIoboxResponseObj(cJSON* responseObj) { + try { + iobox_info_t info; + cJSON* model = cJSON_GetObjectItem(responseObj, "Model"); + if (model != nullptr) { + info.model = model->valuestring; + } + cJSON* serial = cJSON_GetObjectItem(responseObj, "Serial"); + if (serial != nullptr) { + info.serial_number = serial->valuestring; + } + cJSON* hwVer = cJSON_GetObjectItem(responseObj, "HwVer"); + if (hwVer != nullptr) { + info.hardware_version = hwVer->valuestring; + } + cJSON* fwVer = cJSON_GetObjectItem(responseObj, "FwVer"); + if (fwVer != nullptr) { + info.firmware_version = fwVer->valuestring; + } + cJSON* macAddr = cJSON_GetObjectItem(responseObj, "macAddr"); + if (macAddr != nullptr) { + info.mac_address = macAddr->valuestring; + } + cJSON* localIp = cJSON_GetObjectItem(responseObj, "localIp"); + if (localIp != nullptr) { + info.ip_address = localIp->valuestring; + } + return info; + } + catch (const std::exception& e) { + std::cerr << e.what() << std::endl; + return iobox_info_t(); + } + } + iobox_info_t parseIoboxResponse(const std::string& response) { + try { + //exp: {"response": { "Model":"ANS IOBOX","Serial":"IO123","HwVer":"11", "FwVer":"22","macAddr":"a2c3d4e5f6","localIp":"192.168.110.121"}} + iobox_info_t info; + cJSON* root = cJSON_Parse(response.c_str()); + if (root == nullptr) { + std::cerr << "Failed to parse JSON" << std::endl; + return info; + } + cJSON* responseObj = cJSON_GetObjectItem(root, "response"); + if (responseObj == nullptr) { + std::cerr << "Failed to get response object" << std::endl; + cJSON_Delete(root); + return info; + } + info = parseIoboxResponseObj(responseObj); + cJSON_Delete(root); + + std::cout << "Parsed IOBox Info:" << std::endl; + std::cout << " Model: " << info.model << std::endl; + std::cout << " Serial Number: " << info.serial_number << std::endl; + std::cout << " Hardware Version: " << info.hardware_version << std::endl; + std::cout << " Firmware Version: " << info.firmware_version << std::endl; + std::cout << " MAC Address: " << info.mac_address << std::endl; + std::cout << " IP Address: " << info.ip_address << std::endl; + std::cout << " Public IP Address: " << info.ip_public_address << std::endl; + return info; + } + catch (const std::exception& e) { + std::cerr << e.what() << std::endl; + return iobox_info_t(); + } + } + void show_info_iobox(iobox_info_t iobox_info) { + std::cout << " IP Address: " << iobox_info.ip_address << std::endl; + } + void iobox_api::show_profile_iobox(const std::string& remote) { + try { + std::string ip = checkIpFromRemote(remote); + if (ip == "") { + this->_logger.LogError("iobox_api::show_profile_iobox. Failed to get ip from remote: ", remote, __FILE__, __LINE__); + return; + } + iobox_profile_t* profile = findProfileByIp(ip); + if (profile == nullptr) { + this->_logger.LogError("iobox_api::show_profile_iobox. IP address not found: ", ip, __FILE__, __LINE__); + return; + } + show_profile_iobox(*profile); + } + catch (const std::exception& e) { + this->_logger.LogFatal("iobox_api::show_profile_iobox. ", e.what(), __FILE__, __LINE__); + } + } + void iobox_api::show_profile_iobox(const iobox_profile_t& profile) { + try { + // 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 << " Is connected: " << profile.is_connected << std::endl; + std::cout << " Is anthenticated: " << profile.is_anthenticated << std::endl; + std::cout << " TCP Socket: " << profile.sock_tcp << std::endl; + std::cout << " Counting get: " << profile.counting_get << std::endl; + std::cout << " Model: " << profile.iobox_info.model << std::endl; + std::cout << " Serial Number: " << profile.iobox_info.serial_number << std::endl; + std::cout << " Hardware Version: " << profile.iobox_info.hardware_version << std::endl; + std::cout << " Firmware Version: " << profile.iobox_info.firmware_version << std::endl; + std::cout << " MAC Address: " << profile.iobox_info.mac_address << std::endl; + std::cout << " IP Address: " << profile.iobox_info.ip_address << std::endl; + std::cout << " Public IP Address: " << profile.iobox_info.ip_public_address << std::endl; + } + catch (const std::exception& e) { + this->_logger.LogFatal("iobox_api::show_profile_iobox. ", e.what(), __FILE__, __LINE__); + } + } + void iobox_api::show_profile_ioboxs() { + try { + if (this->iobox_profiles.size() == 0) { + this->_logger.LogError("iobox_api::show_profile_iobox. ", "No iobox profiles", __FILE__, __LINE__); + return; + } + for (const auto& profile : this->iobox_profiles) { + std::cout << "* Index: " << &profile - &this->iobox_profiles[0] << std::endl; + show_profile_iobox(profile); + } + } + catch (const std::exception& e) { + this->_logger.LogFatal("iobox_api::show_profile_ioboxs. ", e.what(), __FILE__, __LINE__); + } + } + void iobox_api::save_info_iobox(const iobox_info_t& iobox_info) { + try { + iobox_profile_t profile; + profile.counting_get = 0; + profile.is_connected = false; + profile.is_anthenticated = false; + profile.sock_tcp = INVALID_SOCKET; + profile.iobox_info = iobox_info; + this->iobox_profiles.push_back(profile); + std::cout << "Save iobox, num device current: " << this->iobox_profiles.size() << std::endl; + } + catch (const std::exception& e) { + this->_logger.LogFatal("iobox_api::save_info_iobox. ", e.what(), __FILE__, __LINE__); + } + } + void iobox_api::remove_last_info_iobox() { + try { + if (this->iobox_profiles.size() == 0) { + this->_logger.LogError("iobox_api::remove_last_info_iobox. ", "No iobox profiles", __FILE__, __LINE__); + return; + } + this->iobox_profiles.pop_back(); + std::cout << "Remove last iobox, num device current: " << this->iobox_profiles.size() << std::endl; + } + catch (const std::exception& e) { + this->_logger.LogFatal("iobox_api::remove_last_info_iobox. ", e.what(), __FILE__, __LINE__); + } + } + bool iobox_api::sendTcpMessage(const std::string& ip, const char* buffer, size_t length, bool needCheckAuthen) { + try { + for (auto& profile : this->iobox_profiles) { + if ((profile.iobox_info.ip_address == ip || profile.iobox_info.ip_public_address == ip) && profile.is_connected && profile.sock_tcp != INVALID_SOCKET) { + if (needCheckAuthen && !profile.is_anthenticated) { + this->_logger.LogError("iobox_api::sendTcpMessage. ", "Please anthenticate before send message", __FILE__, __LINE__); + return false; + } + std::string encrypted = messageEncrypt((char*)buffer, length, this->aes_key); + if (encrypted.size() == 0) { + this->_logger.LogError("iobox_api::sendTcpMessage. ", "Failed to encrypt message", __FILE__, __LINE__); + return false; + } + char buffer_read[1024]; + setSocketTimeout(profile.sock_tcp, 10); + int result_read; + do { + result_read = recv(profile.sock_tcp, buffer_read, sizeof(buffer_read), 0); + } while (result_read > 0); + + if (result_read == SOCKET_ERROR && WSAGetLastError() != WSAEWOULDBLOCK) { + // std::cerr << "recv failed with error: " << WSAGetLastError() << std::endl; + } + else if (result_read == 0) { + this->_logger.LogError("iobox_api::sendTcpMessage. Connection closed by peer: ", ip, __FILE__, __LINE__); + return false; + } + else { + std::cout << "Cleared TCP receiver buffer for IP: " << ip << std::endl; + } + int result = send(profile.sock_tcp, encrypted.data(), (int)encrypted.size(), 0); + if (result == SOCKET_ERROR) { + int wsaErr = WSAGetLastError(); + if (wsaErr == WSAECONNRESET || wsaErr == WSAENOTCONN) { + this->_logger.LogError("iobox_api::sendTcpMessage. Connection reset or not connected: ", ip, __FILE__, __LINE__); + } + else { + this->_logger.LogError("iobox_api::sendTcpMessage. Send failed with error: ", std::to_string(wsaErr), __FILE__, __LINE__); + } + return false; + } + std::cout << "Sent " << length << " bytes message to " << ip << std::endl; + std::cout << "Message: " << buffer << std::endl; + std::cout << "Sent encrypt " << encrypted.size() << " bytes message to " << ip << std::endl; + std::cout << "Message encrypt: " << encrypted.data() << std::endl; + // printBufferAsHex(buffer, length); + return true; + } + } + this->_logger.LogError("iobox_api::sendTcpMessage. IP address not found or not connected: ", ip, __FILE__, __LINE__); + return false; + } + catch (const std::exception& e) { + this->_logger.LogFatal("iobox_api::sendTcpMessage. ", e.what(), __FILE__, __LINE__); + return false; + } + } + + bool iobox_api::receiveTcpMessage(const std::string& ip, char* buffer, size_t& length, int timeout) { + try { + if (length == 0) { + this->_logger.LogError("iobox_api::receiveTcpMessage. ", "Buffer length is zero", __FILE__, __LINE__); + return false; + } + size_t bufferCapacity = length; // Save original buffer capacity + for (auto& profile : this->iobox_profiles) { + if ((profile.iobox_info.ip_address == ip || profile.iobox_info.ip_public_address == ip) && profile.is_connected && profile.sock_tcp != INVALID_SOCKET) { + setSocketTimeout(profile.sock_tcp, timeout); + // Reserve 1 byte for null terminator to prevent buffer overflow + int recvLen = recv(profile.sock_tcp, buffer, (int)(bufferCapacity - 1), 0); + if (recvLen > 0) { + length = recvLen; + buffer[length] = '\0'; + std::cout << "Received message: " << length << " bytes" << std::endl; + std::cout << "Message: " << buffer << std::endl; + // printBufferAsHex(buffer, recvLen); + std::string decrypted = messageDecrypt(buffer, length, this->aes_key); + if (decrypted.empty()) { + this->_logger.LogError("iobox_api::receiveTcpMessage. ", "Failed to decrypt message", __FILE__, __LINE__); + return false; + } + // Ensure decrypted data fits in buffer before copying + if (decrypted.size() >= bufferCapacity) { + this->_logger.LogError("iobox_api::receiveTcpMessage. ", "Decrypted message too large for buffer", __FILE__, __LINE__); + return false; + } + //copy decrypted data to buffer + memcpy(buffer, decrypted.data(), decrypted.size()); + length = decrypted.size(); + buffer[length] = '\0'; + std::cout << "Decrypt length: " << length << " bytes" << std::endl; + std::cout << "Decrypt message: " << decrypted << std::endl; + return true; + } + else if (recvLen == 0) { + this->_logger.LogError("iobox_api::receiveTcpMessage. Connection closed by peer: ", ip, __FILE__, __LINE__); + return false; + } + else if (recvLen == SOCKET_ERROR && WSAGetLastError() == WSAETIMEDOUT) { + this->_logger.LogError("iobox_api::receiveTcpMessage. Recv timeout: ", ip, __FILE__, __LINE__); + return false; + } + else { + this->_logger.LogError("iobox_api::receiveTcpMessage. Recv failed with error: ", std::to_string(WSAGetLastError()), __FILE__, __LINE__); + return false; + } + } + } + this->_logger.LogError("iobox_api::receiveTcpMessage. IP address not found or not connected: ", ip, __FILE__, __LINE__); + return false; + } + catch (const std::exception& e) { + this->_logger.LogFatal("iobox_api::receiveTcpMessage. ", e.what(), __FILE__, __LINE__); + return false; + } + } + void iobox_api::sendUnicastMessage(SOCKET sock, const char* ip, const std::string& message) { + struct sockaddr_in unicastAddr; + memset(&unicastAddr, 0, sizeof(unicastAddr)); + unicastAddr.sin_family = AF_INET; + unicastAddr.sin_addr.s_addr = inet_addr(ip); + unicastAddr.sin_port = htons(this->port_mcast); + + if (sendto(sock, message.c_str(), message.length(), 0, (struct sockaddr*)&unicastAddr, sizeof(unicastAddr)) == SOCKET_ERROR) { + this->_logger.LogError("iobox_api::sendUnicastMessage. Sendto failed with error: ", std::to_string(WSAGetLastError()), __FILE__, __LINE__); + } + else { + std::cout << "Sent message: " << message << std::endl; + } + } + void iobox_api::sendMulticastMessage(const std::string& message) { + try { + SOCKET sock = INVALID_SOCKET; + struct sockaddr_in multicastAddr; + + sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); + if (sock == INVALID_SOCKET) { + this->_logger.LogError("iobox_api::sendMulticastMessage. Socket failed with error: ", std::to_string(WSAGetLastError()), __FILE__, __LINE__); + // 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) { + this->_logger.LogError("iobox_api::sendMulticastMessage. Sendto failed with error: ", std::to_string(WSAGetLastError()), __FILE__, __LINE__); + } + else { + std::cout << "Sent message: " << message << std::endl; + } + + closesocket(sock); + } + catch (const std::exception& e) { + this->_logger.LogFatal("iobox_api::sendMulticastMessage. ", e.what(), __FILE__, __LINE__); + } + } + void iobox_api::setSocketTimeout(SOCKET sock, int timeout) { + try + { + // On Windows, SO_RCVTIMEO expects a DWORD value in milliseconds, not struct timeval. + // Callers already pass millisecond values (e.g., 3000 = 3s, 10000 = 10s). + DWORD timeoutMs = static_cast(timeout); + if (setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (const char*)&timeoutMs, sizeof(timeoutMs)) < 0) { + this->_logger.LogError("iobox_api::setSocketTimeout. Setsockopt failed with error: ", std::to_string(WSAGetLastError()), __FILE__, __LINE__); + } + } + catch (const std::exception& e) { + this->_logger.LogFatal("iobox_api::setSocketTimeout. ", e.what(), __FILE__, __LINE__); + } + } + std::string toUpperCase(const std::string& str) { + std::string result = str; + std::transform(result.begin(), result.end(), result.begin(), + [](unsigned char c) { return std::toupper(c); }); + return result; + } + std::string createAliasName(const std::string& serial, const std::string& hwVer, const std::string& fwVer, uint16_t index) { + return "SN" + toUpperCase(serial) + "H" + hwVer + "F" + fwVer + "I" + std::to_string(index); + } + std::string createMulticastAlias(const std::string& aliasName, const std::string& model, const std::string& serial, const std::string& ip) + { + //exp: Alias-Model-SN-IP + return aliasName + "-" + model + "-" + toUpperCase(serial) + "-" + ip; + } + + uint16_t iobox_api::getIndexIoboxFromIp(const std::string& ip) { + try { + for (const auto& profile : this->iobox_profiles) { + if (profile.iobox_info.ip_address == ip || profile.iobox_info.ip_public_address == ip) { + return &profile - &this->iobox_profiles[0] + 1; + } + } + return -1; + } + catch (const std::exception& e) { + std::cerr << e.what() << std::endl; + return -1; + } + } + void logNetworkAdapters(network_adapter_t adapter) { + std::cout << "Adapter Index: " << adapter.adapter_index << std::endl; + std::cout << "Adapter Name: " << adapter.adapter_name << std::endl; + std::cout << "Adapter Description: " << adapter.adapter_description << std::endl; + std::cout << "Adapter MAC: " << adapter.adapter_mac << std::endl; + std::cout << "Adapter IP: " << adapter.adapter_ip << std::endl; + std::cout << "Adapter Subnet: " << adapter.adapter_subnet << std::endl; + std::cout << "Adapter Gateway: " << adapter.adapter_gateway << std::endl; + } + std::vector iobox_api::getNetworkAdapters() { + std::vector adapters; + PIP_ADAPTER_INFO pAdapterInfo; + PIP_ADAPTER_INFO pAdapter = NULL; + ULONG ulOutBufLen = sizeof(IP_ADAPTER_INFO); + DWORD dwRetVal = 0; + + pAdapterInfo = (IP_ADAPTER_INFO*)malloc(sizeof(IP_ADAPTER_INFO)); + if (pAdapterInfo == NULL) { + this->_logger.LogError("iobox_api::getNetworkAdapters. ", "Error allocating memory needed to call GetAdaptersinfo", __FILE__, __LINE__); + return adapters; + } + if (GetAdaptersInfo(pAdapterInfo, &ulOutBufLen) == ERROR_BUFFER_OVERFLOW) { + free(pAdapterInfo); + pAdapterInfo = (IP_ADAPTER_INFO*)malloc(ulOutBufLen); + if (pAdapterInfo == NULL) { + this->_logger.LogError("iobox_api::getNetworkAdapters. ", "Error allocating memory needed to call GetAdaptersinfo", __FILE__, __LINE__); + return adapters; + } + } + if ((dwRetVal = GetAdaptersInfo(pAdapterInfo, &ulOutBufLen)) == NO_ERROR) { + pAdapter = pAdapterInfo; + while (pAdapter) { + if (strcmp(pAdapter->IpAddressList.IpAddress.String, "0.0.0.0") == 0) { + pAdapter = pAdapter->Next; + continue; + } + network_adapter_t adapter; + adapter.adapter_index = std::to_string(pAdapter->Index); + adapter.adapter_name = pAdapter->AdapterName; + adapter.adapter_description = pAdapter->Description; + std::string mac((char*)pAdapter->Address, pAdapter->AddressLength); + adapter.adapter_mac = stringToHexString(mac); + adapter.adapter_ip = pAdapter->IpAddressList.IpAddress.String; + adapter.adapter_subnet = pAdapter->IpAddressList.IpMask.String; + adapter.adapter_gateway = pAdapter->GatewayList.IpAddress.String; + adapters.push_back(adapter); + pAdapter = pAdapter->Next; + } + } + else { + this->_logger.LogError("iobox_api::getNetworkAdapters. GetAdaptersInfo failed with error", std::to_string(dwRetVal), __FILE__, __LINE__); + } + if (pAdapterInfo) { + free(pAdapterInfo); + } + for (const auto& adapter : adapters) { + logNetworkAdapters(adapter); + } + return adapters; + } + + std::vector iobox_api::CreateDeviceChannel(const std::string& multicastInfo) { + // We manually create the device channels based on the multicastInfo + std::vector devices; + std::string DO1Channel = multicastInfo + "-DO1"; + std::string DO2Channel = multicastInfo + "-DO2"; + std::string DO3Channel = multicastInfo + "-DO3"; + std::string DO4Channel = multicastInfo + "-DO4"; + devices.push_back(DO1Channel); + devices.push_back(DO2Channel); + devices.push_back(DO3Channel); + devices.push_back(DO4Channel); + + std::string DI1Channel = multicastInfo + "-DI1"; + std::string DI2Channel = multicastInfo + "-DI2"; + std::string DI3Channel = multicastInfo + "-DI3"; + std::string DI4Channel = multicastInfo + "-DI4"; + devices.push_back(DI1Channel); + devices.push_back(DI2Channel); + devices.push_back(DI3Channel); + devices.push_back(DI4Channel); + + std::string AI1Channel = multicastInfo + "-AI1"; + std::string AI2Channel = multicastInfo + "-AI2"; + devices.push_back(AI1Channel); + devices.push_back(AI2Channel); + return devices; + } + + std::vector iobox_api::scanNetworkDevicesMulticast(int timeout) { + std::lock_guard lock(_mutex); + try { + std::vector 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 << "(public: " << item.iobox_info.ip_public_address << ") " << "befor new scan" << std::endl; + // return devices; + if (!item.iobox_info.ip_public_address.empty()) + { + disconnectToIobox(item.iobox_info.ip_public_address); + } + else + { + disconnectToIobox(item.iobox_info.ip_address); + } + } + } + //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 = "{\"request\":\"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) { + this->_logger.LogError("iobox_api::scanNetworkDevicesMulticast. Socket failed with error:", std::to_string(WSAGetLastError()), __FILE__, __LINE__); + // 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) { + this->_logger.LogError("iobox_api::scanNetworkDevicesMulticast. Bind failed with error:", std::to_string(WSAGetLastError()), __FILE__, __LINE__); + 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 aliasName = createAliasName(info.serial_number, info.hardware_version, info.firmware_version, devices.size() + 1); + std::string multicastAlias = createMulticastAlias(aliasName, info.model, info.serial_number, info.ip_address); + std::cout << "multicast alias: " << multicastAlias << std::endl; + devices.push_back(multicastAlias); + save_info_iobox(info); + // add to macToIpMap + std::string mac = info.serial_number; + std::string ip = info.ip_address; + if (macToIpMap.find(mac) == macToIpMap.end()) { + macToIpMap[mac] = ip; + std::cout << "Added: " << mac << " -> " << ip << std::endl; + } + else { + std::cout << "MAC already exists. Skipping insert.\n"; + } + + std::vector deviceChannels = CreateDeviceChannel(multicastAlias); + // add to ipToDeviceMap + if (ipToDeviceMap.find(ip) == ipToDeviceMap.end()) { + ipToDeviceMap[ip] = deviceChannels; + } + else { + std::cout << "ip already exists. Skipping insert.\n"; + } + + } + } + 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(); + + // Check if there are any devices foun. Otherwise, use unicast scan + if (devices.empty()) + { + std::cout << "No devices found using multicast scan. Trying unicast scan..." << std::endl; + return scanNetworkDevicesManually(timeout); + } + return devices; + } + catch (const std::exception& e) { + this->_logger.LogFatal("iobox_api::scanNetworkDevicesMulticast. ", e.what(), __FILE__, __LINE__); + return std::vector(); + } + } + std::vector iobox_api::scanNetworkDevicesManuallyOnNetworkAdapter(network_adapter_t adapter, int timeout) + { + std::vector 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 << " (public: " << item.iobox_info.ip_public_address << ") " << "befor new scan" << std::endl; + // return devices; + if (!item.iobox_info.ip_public_address.empty()) + { + disconnectToIobox(item.iobox_info.ip_public_address); + } + else + { + disconnectToIobox(item.iobox_info.ip_address); + } + } + } + //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 unicastAddress; + struct ip_mreq multicastRequest; + char recvBuf[1024]; + struct sockaddr_in recvAddr; + int recvAddrLen = sizeof(recvAddr); + std::string message = "{\"request\":\"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(&unicastAddress, 0, sizeof(unicastAddress)); + unicastAddress.sin_family = AF_INET; + unicastAddress.sin_addr.s_addr = htonl(INADDR_ANY); + unicastAddress.sin_port = htons(this->port_mcast); + if (bind(sock, (struct sockaddr*)&unicastAddress, sizeof(unicastAddress)) == SOCKET_ERROR) { + this->_logger.LogError("iobox_api::scanNetworkDevicesManuallyOnNetworkAdapter. Bind failed with error:", std::to_string(WSAGetLastError()), __FILE__, __LINE__); + closesocket(sock); + // WSACleanup(); + return devices; + } + setSocketTimeout(sock, 10); + auto start = std::chrono::steady_clock::now(); + + // Calculate the network address and broadcast address + struct in_addr ip_addr, subnet_mask, network_addr, broadcast_addr; + inet_pton(AF_INET, adapter.adapter_ip.c_str(), &ip_addr); + inet_pton(AF_INET, adapter.adapter_subnet.c_str(), &subnet_mask); + + network_addr.s_addr = ip_addr.s_addr & subnet_mask.s_addr; + broadcast_addr.s_addr = network_addr.s_addr | ~subnet_mask.s_addr; + std::cout << "Network address: " << inet_ntoa(network_addr) << std::endl; + std::cout << "Broadcast address: " << inet_ntoa(broadcast_addr) << std::endl; + // Iterate over all possible host addresses in the subnet + SOCKET sockSend = INVALID_SOCKET; + + sockSend = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); + if (sockSend == INVALID_SOCKET) { + this->_logger.LogError("iobox_api::scanNetworkDevicesManuallyOnNetworkAdapter. Socket failed with error:", std::to_string(WSAGetLastError()), __FILE__, __LINE__); + closesocket(sock); + // WSACleanup(); + return devices; + } + + for (uint32_t host = ntohl(network_addr.s_addr) + 1; host < ntohl(broadcast_addr.s_addr); ++host) { + struct in_addr host_addr; + host_addr.s_addr = htonl(host); + std::string host_ip = inet_ntoa(host_addr); + if (host_ip == adapter.adapter_ip) { + continue; + } + // Send unicast message to each host + sendUnicastMessage(sockSend, host_ip.c_str(), message); + if (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 aliasName = createAliasName(info.serial_number, info.hardware_version, info.firmware_version, devices.size() + 1); + std::string multicastAlias = createMulticastAlias(aliasName, info.model, info.serial_number, info.ip_address); + std::cout << "unicast alias: " << multicastAlias << std::endl; + devices.push_back(multicastAlias); + save_info_iobox(info); + + // add to macToIpMap + std::string mac = info.serial_number; + std::string ip = info.ip_address; + if (macToIpMap.find(mac) == macToIpMap.end()) { + macToIpMap[mac] = ip; + std::cout << "Added: " << mac << " -> " << ip << std::endl; + } + else { + std::cout << "MAC already exists. Skipping insert.\n"; + } + + std::vector deviceChannels = CreateDeviceChannel(multicastAlias); + // add to ipToDeviceMap + if (ipToDeviceMap.find(ip) == ipToDeviceMap.end()) { + ipToDeviceMap[ip] = deviceChannels; + } + else { + std::cout << "ip already exists. Skipping insert.\n"; + } + } + continue; + } + else { + std::cout << "timeout for IP: " << host_ip << ", scan next" << std::endl; + continue; + // std::cerr << "recvfrom failed with error: " << WSAGetLastError() << std::endl; + // sendMulticastMessage(message); + } + } + else { + break; + } + } + closesocket(sockSend); + + closesocket(sock); + // WSACleanup(); + return devices; + } + std::vector iobox_api::scanNetworkDevicesManually(int timeout) + { + std::vector adapters; + adapters = getNetworkAdapters(); + if (adapters.size() == 0) { + std::cerr << "Failed to get network adapters" << std::endl; + this->_logger.LogError("iobox_api::scanNetworkDevicesManually.", "Failed to get network adapters", __FILE__, __LINE__); + return std::vector(); + } + std::vector devices; + for (const auto& adapter : adapters) { + std::cout << "\nAdapter: " << adapter.adapter_name << std::endl; + std::vector devices_adapter = scanNetworkDevicesManuallyOnNetworkAdapter(adapter, timeout); + devices.insert(devices.end(), devices_adapter.begin(), devices_adapter.end()); + } + for (const auto& device : devices) { + std::cout << "Device: " << device << std::endl; + } + return devices; + } + bool parseResponeCommon(const std::string& response, const std::string& action, std::string& getResult, std::string& getReason, iobox_info_t& iobox_info) { + try { + cJSON* root = cJSON_Parse(response.c_str()); + if (root == nullptr) { + std::cerr << "Failed to parse JSON" << std::endl; + return false; + } + cJSON* responseObj = cJSON_GetObjectItem(root, "response"); + if (responseObj == nullptr) { + std::cerr << "Failed to get response object" << std::endl; + cJSON_Delete(root); + return false; + } + cJSON* actionResponse = cJSON_GetObjectItem(responseObj, "action"); + if (actionResponse == nullptr || strcmp(actionResponse->valuestring, action.c_str()) != 0) { + std::cerr << "Action mismatch or not found" << std::endl; + cJSON_Delete(root); + return false; + } + cJSON* resultResponse = cJSON_GetObjectItem(responseObj, "result"); + if (resultResponse == nullptr) { + std::cerr << "Failed to get result" << std::endl; + cJSON_Delete(root); + return false; + } + if (resultResponse->type == cJSON_Array) { + char* result = cJSON_PrintUnformatted(resultResponse); + std::cout << "Result: " << result << std::endl; + std::string resultStr(result); + cJSON_free(result); + getResult = resultStr; + } + else if (resultResponse->type == cJSON_String) { + getResult = resultResponse->valuestring; + } + if (cJSON_HasObjectItem(responseObj, "info")) + { + cJSON* infoResponse = cJSON_GetObjectItem(responseObj, "info"); + if (infoResponse == nullptr) { + std::cerr << "Failed to get info" << std::endl; + cJSON_Delete(root); + return false; + } + iobox_info = parseIoboxResponseObj(infoResponse); + } + cJSON* reasonResponse = cJSON_GetObjectItem(responseObj, "reason"); + if (reasonResponse == nullptr) { + // std::cerr << "Failed to get reason" << std::endl; + cJSON_Delete(root); + return true; + } + getReason = reasonResponse->valuestring; + + cJSON_Delete(root); + return true; + } + catch (const std::exception& e) { + std::cerr << e.what() << std::endl; + return false; + } + } + + std::string iobox_api::connectToIobox(const std::string& remote, 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; + std::string aliasConnect = ""; + bool is_onlyAuthen = false; + std::lock_guard lock(this->_mutex); + std::string ip = checkIpFromRemote(remote); + if (ip == "") { + this->_logger.LogError("iobox_api::connectToIobox. Failed to get ip from remote: ", remote, __FILE__, __LINE__); + return aliasConnect; + } + std::cout << "IP address: " << ip << std::endl; + try { + if (!username.empty())_username = username; + if (!password.empty())_password = password; + if (port > 0)_port = port; + for (auto& profile : this->iobox_profiles) { + if (profile.iobox_info.ip_address == ip || profile.iobox_info.ip_public_address == ip) { + is_exist = true; + item = &profile; + if (item->is_connected && item->is_anthenticated) { + std::cout << "Ip is already connected and anthenticated: " << ip << std::endl; + uint16_t idx = getIndexIoboxFromIp(ip); + std::string aliasName = createAliasName(item->iobox_info.serial_number, item->iobox_info.hardware_version, item->iobox_info.firmware_version, idx); + aliasConnect = createMulticastAlias(aliasName, item->iobox_info.model, item->iobox_info.serial_number, item->iobox_info.ip_public_address == "" ? item->iobox_info.ip_address : item->iobox_info.ip_public_address); + return aliasConnect; + } + else if (item->is_connected && !item->is_anthenticated) { + std::cout << "Ip is already connected but not anthenticated: " << ip << std::endl; + // std::cout << "Please disconnect before reconnect" << std::endl; + // return aliasConnect; + is_onlyAuthen = true; + } + break; + } + } + if (is_exist == false) { + this->_logger.LogWarn("iobox_api::connectToIobox. Ip is not exist in list scan, now retry connect to this ip and append it to profile: ", ip, __FILE__, __LINE__); + // return false; + } + + // WSADATA wsaData; + SOCKET sock = INVALID_SOCKET; + struct sockaddr_in serverAddr; + char recvBuf[1024]; + int recvLen = 0; + struct timeval tv; + tv.tv_sec = 3000; + tv.tv_usec = 0; + if (is_onlyAuthen == false) + { + sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); + if (sock == INVALID_SOCKET) { + this->_logger.LogError("iobox_api::connectToIobox. Socket failed with error", std::to_string(WSAGetLastError()), __FILE__, __LINE__); + // WSACleanup(); + return aliasConnect; + } + + 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) { + this->_logger.LogError("iobox_api::connectToIobox. Connect failed with error", std::to_string(WSAGetLastError()), __FILE__, __LINE__); + closesocket(sock); + // WSACleanup(); + return aliasConnect; + } + } + else { + sock = item->sock_tcp; + } + + setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (const char*)&tv, sizeof(tv)); + + std::string action = "auth"; + //{"request":{"action":"auth","username":"","password":""}} + std::string authMessage = "{\"request\":{\"action\":\"" + action + "\",\"username\":\"" + _username + "\",\"password\":\"" + _password + "\"}}"; + + int sendLen = send(sock, authMessage.c_str(), authMessage.length(), 0); + if (sendLen == SOCKET_ERROR) { + this->_logger.LogError("iobox_api::connectToIobox. Send failed with error", std::to_string(WSAGetLastError()), __FILE__, __LINE__); + closesocket(sock); + // WSACleanup(); + return aliasConnect; + } + //{"response":{"action":"auth","result":"","reason":""}} + iobox_info_t info; + + recvLen = recv(sock, recvBuf, sizeof(recvBuf) - 1, 0); + if (recvLen > 0) { + recvBuf[recvLen] = '\0'; + std::cout << "Received message: " << recvBuf << std::endl; + + std::string response(recvBuf); + std::string result; + std::string reason; + if (parseResponeCommon(response, action, result, reason, info)) { + std::cout << "Parse response success" << std::endl; + if (result == "success") { + std::cout << "Authentication success" << std::endl; + } + else { + this->_logger.LogError("iobox_api::connectToIobox. Authentication failed: ", reason, __FILE__, __LINE__); + closesocket(sock); + // WSACleanup(); + return aliasConnect; + } + } + else { + this->_logger.LogError("iobox_api::connectToIobox. Parse failed: ", response, __FILE__, __LINE__); + closesocket(sock); + // WSACleanup(); + return aliasConnect; + } + } + else { + this->_logger.LogError("iobox_api::connectToIobox. recv failed with error", std::to_string(WSAGetLastError()), __FILE__, __LINE__); + closesocket(sock); + // WSACleanup(); + return aliasConnect; + } + + // closesocket(sock); + // WSACleanup(); + if (item == nullptr) { + if (info.ip_address == "") { + this->_logger.LogError("iobox_api::connectToIobox. ", "Failed to get info from response", __FILE__, __LINE__); + closesocket(sock); + return aliasConnect; + } + if (info.ip_address != ip) { + info.ip_public_address = ip; + } + save_info_iobox(info); + for (auto& profile : this->iobox_profiles) { + if (profile.iobox_info.ip_address == ip || profile.iobox_info.ip_public_address == ip) { + item = &profile; + break; + } + } + } + if (item == nullptr) return aliasConnect; + uint16_t idx = getIndexIoboxFromIp(ip); + std::string aliasName = createAliasName(item->iobox_info.serial_number, item->iobox_info.hardware_version, item->iobox_info.firmware_version, idx); + aliasConnect = createMulticastAlias(aliasName, item->iobox_info.model, item->iobox_info.serial_number, item->iobox_info.ip_public_address == "" ? item->iobox_info.ip_address : item->iobox_info.ip_public_address); + std::cout << "alias: " << aliasConnect << std::endl; + item->sock_tcp = sock; + item->is_connected = true; + item->is_anthenticated = true; + return aliasConnect; + } + catch (const std::exception& e) { + this->_logger.LogFatal("iobox_api::connectToIobox. ", e.what(), __FILE__, __LINE__); + return aliasConnect; + } + } + + bool iobox_api::connectToIoboxWithoutAuthen(const std::string& remote, int port) { + // check ip is already in iobox_profiles + bool is_exist = false; + iobox_profile_t* item = nullptr; + if (port > 0)_port = port; + std::lock_guard lock(this->_mutex); + std::string ip = checkIpFromRemote(remote); + if (ip == "") { + this->_logger.LogError("iobox_api::connectToIobox. Failed to get ip from remote: ", remote, __FILE__, __LINE__); + return false; + } + try { + for (auto& profile : this->iobox_profiles) { + if (profile.iobox_info.ip_address == ip || profile.iobox_info.ip_public_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) { + this->_logger.LogWarn("iobox_api::connectToIobox. Ip is not exist in list scan: ", ip, __FILE__, __LINE__); + return false; + } + + // WSADATA wsaData; + SOCKET sock = INVALID_SOCKET; + struct sockaddr_in serverAddr; + char recvBuf[1024]; + int recvLen = 0; + struct timeval tv; + tv.tv_sec = 3000; + 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) { + this->_logger.LogError("iobox_api::connectToIobox. Socket failed with error: ", std::to_string(WSAGetLastError()), __FILE__, __LINE__); + // WSACleanup(); + return false; + } + + serverAddr.sin_family = AF_INET; + serverAddr.sin_addr.s_addr = inet_addr(ip.c_str()); + serverAddr.sin_port = htons(_port); + + // // Bật keep-alive + // int optval = 1; + // int optlen = sizeof(optval); + // if (setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, (char*)&optval, optlen) == SOCKET_ERROR) { + // std::cerr << "setsockopt for keep-alive failed: " << WSAGetLastError() << std::endl; + // closesocket(sock); + // WSACleanup(); + // return false; + // } + + // // Optional: Adjust Keep-Alive parameters (requires platform-specific APIs). + // tcp_keepalive kaSettings = { 1, 5000, 1000 }; // Enable, Idle time 5s, Interval 1s + // DWORD bytesReturned; + // WSAIoctl(sock, SIO_KEEPALIVE_VALS, &kaSettings, sizeof(kaSettings), NULL, 0, &bytesReturned, NULL, NULL); + + if (connect(sock, (struct sockaddr*)&serverAddr, sizeof(serverAddr)) < 0) { + this->_logger.LogError("iobox_api::connectToIobox. Connect failed with error: ", std::to_string(WSAGetLastError()), __FILE__, __LINE__); + closesocket(sock); + // WSACleanup(); + return false; + } + + // closesocket(sock); + // WSACleanup(); + item->sock_tcp = sock; + item->is_connected = true; + item->is_anthenticated = false; + return true; + } + catch (const std::exception& e) { + this->_logger.LogFatal("iobox_api::connectToIobox. ", e.what(), __FILE__, __LINE__); + return false; + } + } + + bool iobox_api::disconnectToIoboxWithResetOutputs(const std::string& remote) { + return disconnectToIobox(remote); + //std::lock_guard lock(this->_mutex); + //std::string ip = checkIpFromRemote(remote); + //if (ip == "") { + // this->_logger.LogError("iobox_api::disconnectToIobox. Failed to get ip from remote: ", remote, __FILE__, __LINE__); + // return false; + //} + ////// Reset all outputs to 0 or off before disconnect + ////setValue(remote, "DO1", "0"); + ////setValue(remote, "DO2", "0"); + ////setValue(remote, "DO3", "0"); + ////setValue(remote, "DO4", "0"); + //try { + // // 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 || profile.iobox_info.ip_public_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) { + // this->_logger.LogError("iobox_api::disconnectToIobox. Ip is not exist in list scan: ", ip, __FILE__, __LINE__); + // return false; + // } + // item->counting_get = 0; + // item->is_connected = false; + // item->is_anthenticated = false; + // closesocket(item->sock_tcp); + // item->sock_tcp = INVALID_SOCKET; + // // WSACleanup(); + // std::cout << "Disconnected" << std::endl; + // return true; + //} + //catch (const std::exception& e) { + // this->_logger.LogFatal("iobox_api::disconnectToIobox. ", e.what(), __FILE__, __LINE__); + // return false; + //} + } + + bool iobox_api::disconnectToIobox(const std::string& remote) { + std::lock_guard lock(this->_mutex); + std::string ip = checkIpFromRemote(remote); + if (ip == "") { + this->_logger.LogError("iobox_api::disconnectToIobox. Failed to get ip from remote: ", remote, __FILE__, __LINE__); + return false; + } + try { + // 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 || profile.iobox_info.ip_public_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) { + this->_logger.LogWarn("iobox_api::disconnectToIobox. Ip is not exist in list scan: ", ip, __FILE__, __LINE__); + return false; + } + item->counting_get = 0; + item->is_connected = false; + item->is_anthenticated = false; + closesocket(item->sock_tcp); + item->sock_tcp = INVALID_SOCKET; + // WSACleanup(); + std::cout << "Disconnected" << std::endl; + return true; + } + catch (const std::exception& e) { + this->_logger.LogFatal("iobox_api::disconnectToIobox. ", e.what(), __FILE__, __LINE__); + return false; + } + } + + bool iobox_api::setAuthenticationIobox(const std::string& remote, const std::string& username, const std::string& password) { + std::lock_guard lock(this->_mutex); + std::string ip = checkIpFromRemote(remote); + if (ip == "") { + this->_logger.LogError("iobox_api::setAuthenticationIobox. Failed to get ip from remote: ", remote, __FILE__, __LINE__); + return false; + } + try { + iobox_profile_t* profile = findProfileByIp(ip); + if (profile == nullptr) { + std::cerr << "IP address not found: " << ip << std::endl; + return false; + } + if (!username.empty())_username = username; + if (!password.empty())_password = password; + + std::string action = "change_auth"; + //{"request": {"action":"change_auth","username":"","password":""}} + std::string authMessage = "{\"request\":{\"action\":\"" + action + "\",\"username\":\"" + _username + "\",\"password\":\"" + _password + "\"}}"; + if (!sendTcpMessage(ip, authMessage.c_str(), authMessage.length(), true)) { + return false; + } + + //{"response":{"action":"change_auth","result":"","reason":""}} + char revBuf[256]; + size_t responseLength = sizeof(revBuf); + if (!receiveTcpMessage(ip, revBuf, responseLength)) { + return false; + } + revBuf[responseLength] = '\0'; + std::string response(revBuf); + std::string result; + std::string reason; + iobox_info_t info; + if (parseResponeCommon(response, action, result, reason, info)) { + std::cout << "Parse response success" << std::endl; + if (result == "success") { + std::cout << "Change auth success" << std::endl; + } + else { + this->_logger.LogError("iobox_api::setAuthenticationIobox. Change auth failed: ", reason, __FILE__, __LINE__); + + return false; + } + } + else { + this->_logger.LogError("iobox_api::setAuthenticationIobox. Parse response failed: ", response, __FILE__, __LINE__); + return false; + } + + return true; + } + catch (const std::exception& e) { + this->_logger.LogFatal("iobox_api::setAuthenticationIobox. ", e.what(), __FILE__, __LINE__); + return false; + } + } + std::string iobox_api::generateToken(const std::string& remote) + { + std::lock_guard lock(_mutex); + try { + std::string ip = checkIpFromRemote(remote); + if (ip == "") { + this->_logger.LogError("iobox_api::generateToken. Failed to get ip from remote: ", remote, __FILE__, __LINE__); + return ""; + } + iobox_profile_t* profile = findProfileByIp(ip); + if (profile == nullptr) { + this->_logger.LogError("iobox_api::generateToken. IP address not found: ", ip, __FILE__, __LINE__); + return ""; + } + //may be change this later + return profile->iobox_info.serial_number + profile->iobox_info.model; + } + catch (const std::exception& e) { + this->_logger.LogFatal("iobox_api::generateToken. ", e.what(), __FILE__, __LINE__); + return ""; + } + + } + bool iobox_api::resetAuthenticationIobox(const std::string& remote, const std::string& token) + { + std::lock_guard lock(this->_mutex); + std::string ip = checkIpFromRemote(remote); + if (ip == "") { + this->_logger.LogError("iobox_api::resetAuthenticationIobox. Failed to get ip from remote: ", remote, __FILE__, __LINE__); + return false; + } + try { + bool needRemove = false; + iobox_profile_t* profile = findProfileByIp(ip); + if (profile == nullptr) { + this->_logger.LogError("iobox_api::resetAuthenticationIobox. IP address not found: ", ip, __FILE__, __LINE__); + // return false; + // need temporary save iobox_info + iobox_info_t info; + info.ip_address = ip; + save_info_iobox(info); + profile = findProfileByIp(ip); + needRemove = true; + } + if (connectToIoboxWithoutAuthen(ip, DEVICE_TCP_PORT) == false) { + if (needRemove) remove_last_info_iobox(); + return false; + } + //{"request": {"action":"factory_reset","token":""}} + std::string action = "factory_reset"; + std::string resetMessage = "{\"request\":{\"action\":\"" + action + "\",\"token\":\"" + token + "\"}}"; + if (!sendTcpMessage(ip, resetMessage.c_str(), resetMessage.length(), false)) { + if (profile->is_anthenticated == false) + { + disconnectToIobox(ip); + if (needRemove) remove_last_info_iobox(); + } + return false; + } + char revBuf[256]; + size_t responseLength = sizeof(revBuf); + if (!receiveTcpMessage(ip, revBuf, responseLength)) { + if (profile->is_anthenticated == false) + { + disconnectToIobox(ip); + if (needRemove) remove_last_info_iobox(); + } + return false; + } + revBuf[responseLength] = '\0'; + std::string response(revBuf); + std::string result; + std::string reason; + iobox_info_t info; + if (parseResponeCommon(response, action, result, reason, info)) { + std::cout << "Parse response success" << std::endl; + if (result == "success") { + std::cout << "Factory reset success" << std::endl; + if (profile->is_anthenticated == false) + { + disconnectToIobox(ip); + if (needRemove) remove_last_info_iobox(); + } + return true; + } + else { + this->_logger.LogError("iobox_api::resetAuthenticationIobox. Factory reset failed: ", reason, __FILE__, __LINE__); + if (profile->is_anthenticated == false) + { + disconnectToIobox(ip); + if (needRemove) remove_last_info_iobox(); + } + return false; + } + } + else { + this->_logger.LogError("iobox_api::resetAuthenticationIobox. Parse response failed: ", response, __FILE__, __LINE__); + if (profile->is_anthenticated == false) + { + disconnectToIobox(ip); + if (needRemove) remove_last_info_iobox(); + } + return false; + } + } + catch (const std::exception& e) { + this->_logger.LogFatal("iobox_api::resetAuthenticationIobox. ", e.what(), __FILE__, __LINE__); + return false; + } + } + + bool iobox_api::resetIobox(const std::string& remote, const std::string& token) + { + std::lock_guard lock(this->_mutex); + std::string ip = checkIpFromRemote(remote); + if (ip == "") { + this->_logger.LogError("iobox_api::resetIobox. Failed to get ip from remote: ", remote, __FILE__, __LINE__); + return false; + } + try { + bool needRemove = false; + iobox_profile_t* profile = findProfileByIp(ip); + if (profile == nullptr) { + this->_logger.LogError("iobox_api::resetIobox. IP address not found: ", ip, __FILE__, __LINE__); + // return false; + // need temporary save iobox_info + iobox_info_t info; + info.ip_address = ip; + save_info_iobox(info); + profile = findProfileByIp(ip); + needRemove = true; + } + if (connectToIoboxWithoutAuthen(ip, DEVICE_TCP_PORT) == false) { + if (needRemove) remove_last_info_iobox(); + return false; + } + //{"request": {"action":"restart","token":""}} + std::string action = "restart"; + std::string resetMessage = "{\"request\":{\"action\":\"" + action + "\",\"token\":\"" + token + "\"}}"; + if (!sendTcpMessage(ip, resetMessage.c_str(), resetMessage.length(), false)) { + if (profile->is_anthenticated == false) + { + disconnectToIobox(ip); + if (needRemove) remove_last_info_iobox(); + } + return false; + } + char revBuf[256]; + size_t responseLength = sizeof(revBuf); + if (!receiveTcpMessage(ip, revBuf, responseLength)) { + if (profile->is_anthenticated == false) + { + disconnectToIobox(ip); + if (needRemove) remove_last_info_iobox(); + } + return false; + } + revBuf[responseLength] = '\0'; + std::string response(revBuf); + std::string result; + std::string reason; + iobox_info_t info; + if (parseResponeCommon(response, action, result, reason, info)) { + std::cout << "Parse response success" << std::endl; + if (result == "success") { + std::cout << "Restart success" << std::endl; + } + else { + this->_logger.LogError("iobox_api::resetIobox. Restart failed: ", reason, __FILE__, __LINE__); + + if (profile->is_anthenticated == false) + { + disconnectToIobox(ip); + if (needRemove) remove_last_info_iobox(); + } + return false; + } + } + else { + this->_logger.LogError("iobox_api::resetIobox. Parse response failed: ", response, __FILE__, __LINE__); + if (profile->is_anthenticated == false) + { + disconnectToIobox(ip); + if (needRemove) remove_last_info_iobox(); + } + return false; + } + disconnectToIobox(ip); + if (needRemove) remove_last_info_iobox(); + + return true; + } + catch (const std::exception& e) { + this->_logger.LogFatal("iobox_api::resetIobox. ", e.what(), __FILE__, __LINE__); + return false; + } + } + iobox_profile_t* iobox_api::findProfileByIp(const std::string& ip) { + std::lock_guard lock(_mutex); + try { + iobox_profile_t* profile = nullptr; + for (auto& item : this->iobox_profiles) { + if (item.iobox_info.ip_address == ip || item.iobox_info.ip_public_address == ip) { + profile = &item; + } + } + return profile; + } + catch (const std::exception& e) { + this->_logger.LogFatal("iobox_api::findProfileByIp. ", e.what(), __FILE__, __LINE__); + return nullptr; + } + } + + bool iobox_api::performSetValue(const std::string& ip, const std::string& channelName, const std::string& value) { + const std::string action = "setValue"; + const std::string setValueMessage = "{\"request\":{\"action\":\"" + action + "\",\"channel\":\"" + channelName + "\",\"value\":\"" + value + "\"}}"; + + if (!sendTcpMessage(ip, setValueMessage.c_str(), setValueMessage.length(), true)) { + this->_logger.LogError("iobox_api::performSetValue.", " Failed to send TCP message", __FILE__, __LINE__); + return false; + } + + constexpr size_t BUFFER_SIZE = 512; // Increased buffer size + char revBuf[BUFFER_SIZE]; + size_t responseLength = BUFFER_SIZE - 1; // Leave space for null terminator + + if (!receiveTcpMessage(ip, revBuf, responseLength)) { + this->_logger.LogError("iobox_api::performSetValue. ", "Failed to receive TCP message", __FILE__, __LINE__); + return false; + } + + // Ensure null termination + revBuf[responseLength] = '\0'; + std::string response(revBuf); + + std::string result, reason; + iobox_info_t info; + + if (!parseResponeCommon(response, action, result, reason, info)) { + this->_logger.LogError("iobox_api::performSetValue. Failed to parse response:", response, __FILE__, __LINE__); + return false; + } + + if (result != "success") { + //this->_logger.LogError("iobox_api::performSetValue. Set operation failed. Reason:", reason, __FILE__, __LINE__); + return false; + } + + return true; + } + + bool iobox_api::performGetValue(const std::string& ip, const std::string& channelName, std::string& outValue) { + const std::string action = "getValue"; + const std::string getValueMessage = "{\"request\":{\"action\":\"" + action + "\",\"channel\":\"" + channelName + "\"}}"; + + if (!sendTcpMessage(ip, getValueMessage.c_str(), getValueMessage.length(), true)) { + this->_logger.LogError("iobox_api::performGetValue.", " Failed to send TCP message", __FILE__, __LINE__); + return false; + } + + constexpr size_t BUFFER_SIZE = 512; // Increased buffer size + char revBuf[BUFFER_SIZE]; + size_t responseLength = BUFFER_SIZE - 1; // Leave space for null terminator + + if (!receiveTcpMessage(ip, revBuf, responseLength)) { + this->_logger.LogError("iobox_api::performGetValue.", "Failed to receive TCP message", __FILE__, __LINE__); + return false; + } + + // Ensure null termination + revBuf[responseLength] = '\0'; + std::string response(revBuf); + + std::string result, reason; + iobox_info_t info; + + if (!parseResponeCommon(response, action, result, reason, info)) { + this->_logger.LogError("iobox_api::performGetValue. Failed to parse response:", response, __FILE__, __LINE__); + return false; + } + outValue = result; + if (result == "fail") { + //this->_logger.LogError("iobox_api::performGetValue. Get operation failed. Result:", result, __FILE__, __LINE__); + return false; + } + return true; + } + + bool iobox_api::getValueDataStringIoboxFromChannelName(const std::string& remote, const std::string& channelName, std::string& outValue) { + std::lock_guard lock(this->_mutex); + // Clear output parameter + outValue.clear(); + // Validate input parameters + if (remote.empty() || channelName.empty()) { + this->_logger.LogError("iobox_api::getValueDataStringIoboxFromChannelName.", "Invalid parameters - remote or channelName is empty", __FILE__, __LINE__); + return false; + } + std::string ip = checkIpFromRemote(remote); + if (ip.empty()) { + this->_logger.LogError("iobox_api::getValueDataStringIoboxFromChannelName. Failed to get ip from remote:", remote, __FILE__, __LINE__); + return false; + } + // Check if we has connected to iobox + if (!checkTcpConnectStatus(remote)) { + disconnectToIobox(remote); // Ensure any previous connection is closed + connectToIobox(remote, 0, "", ""); + } + if (!checkTcpConnectStatus(remote))return false; + try { + iobox_profile_t* profile = findProfileByIp(ip); + if (profile == nullptr) { + this->_logger.LogError("iobox_api::getValueDataStringIoboxFromChannelName. IP address not found:", ip, __FILE__, __LINE__); + return false; + } + if (!performGetValue(ip, channelName, outValue)) { + return false; + } + this->_logger.LogDebug("iobox_api::getValueDataStringIoboxFromChannelName. Successfully retrieved value for channel:", channelName, __FILE__, __LINE__); + return true; + } + catch (const std::exception& e) { + this->_logger.LogFatal("iobox_api::getValueDataStringIoboxFromChannelName. Exception:", e.what(), __FILE__, __LINE__); + return false; + } + } + + bool iobox_api::setValueDataStringIoboxFromChannelName(const std::string& remote, const std::string& channelName, const std::string& value) { + std::lock_guard lock(this->_mutex); + + // Validate input parameters + if (remote.empty() || channelName.empty()) { + this->_logger.LogError("iobox_api::setValueDataStringIoboxFromChannelName.", "Invalid parameters - remote or channelName is empty", __FILE__, __LINE__); + return false; + } + + std::string ip = checkIpFromRemote(remote); + if (ip.empty()) { + this->_logger.LogError("iobox_api::setValueDataStringIoboxFromChannelName. Failed to get ip from remote:", remote, __FILE__, __LINE__); + return false; + } + // Check if we has connected to iobox + if (!checkTcpConnectStatus(remote)) { + disconnectToIobox(remote); // Ensure any previous connection is closed + connectToIobox(remote, 0, "", ""); + } + if (!checkTcpConnectStatus(remote))return false; + try { + iobox_profile_t* profile = findProfileByIp(ip); + if (profile == nullptr) { + this->_logger.LogError("iobox_api::setValueDataStringIoboxFromChannelName. IP address not found:", ip, __FILE__, __LINE__); + return false; + } + + // Step 1: Set the value + if (!performSetValue(ip, channelName, value)) { + return false; + } + + // Step 2: Read back and verify the value + std::string readValue; + if (!performGetValue(ip, channelName, readValue)) { + return false; + } + + // Step 3: Compare values + if (readValue != value) { + this->_logger.LogError("iobox_api::setValueDataStringIoboxFromChannelName. Value verification failed. Expected:", value, __FILE__, __LINE__); + this->_logger.LogError("iobox_api::setValueDataStringIoboxFromChannelName. Value verification failed. Got:", readValue, __FILE__, __LINE__); + + return false; + } + + this->_logger.LogDebug("iobox_api::setValueDataStringIoboxFromChannelName. Value set and verified successfully for channel:", channelName, __FILE__, __LINE__); + return true; + } + catch (const std::exception& e) { + this->_logger.LogFatal("iobox_api::setValueDataStringIoboxFromChannelName. Exception:", e.what(), __FILE__, __LINE__); + return false; + } + } + + + std::vector iobox_api::getDeviceChannelNames(const std::string& remote) + { + bool needRemove = false; + std::vector channelNames; + std::lock_guard lock(this->_mutex); + std::string ip = checkIpFromRemote(remote); + if (ip == "") { + this->_logger.LogError("iobox_api::getDeviceChannelNames. Failed to get ip from remote:", remote, __FILE__, __LINE__); + return channelNames; + } + try { + iobox_profile_t* profile = findProfileByIp(ip); + if (profile == nullptr) { + this->_logger.LogError("iobox_api::getDeviceChannelNames. IP address not found:", ip, __FILE__, __LINE__); + iobox_info_t info; + info.ip_address = ip; + save_info_iobox(info); + profile = findProfileByIp(ip); + needRemove = true; + } + if (connectToIoboxWithoutAuthen(ip, DEVICE_TCP_PORT) == false) { + if (needRemove) remove_last_info_iobox(); + return channelNames; + } + //{"request": {"action":"channelList"}} + std::string action = "channelList"; + std::string channelListMessage = "{\"request\":{\"action\":\"" + action + "\"}}"; + if (!sendTcpMessage(ip, channelListMessage.c_str(), channelListMessage.length(), false)) { + disconnectToIobox(ip); + if (needRemove) remove_last_info_iobox(); + return channelNames; + } + char revBuf[1024]; + size_t responseLength = sizeof(revBuf); + if (!receiveTcpMessage(ip, revBuf, responseLength)) { + disconnectToIobox(ip); + if (needRemove) remove_last_info_iobox(); + return channelNames; + } + revBuf[responseLength] = '\0'; + std::string response(revBuf); + std::string result; + std::string reason; + iobox_info_t info; + if (parseResponeCommon(response, action, result, reason, info)) { + std::cout << "Parse response success" << std::endl; + + cJSON* root = cJSON_Parse(result.c_str()); + if (root == nullptr) { + this->_logger.LogError("iobox_api::getDeviceChannelNames. Failed to parse JSON:", result, __FILE__, __LINE__); + disconnectToIobox(ip); + if (needRemove) remove_last_info_iobox(); + return channelNames; + } + if (root->type != cJSON_Array) { + this->_logger.LogError("iobox_api::getDeviceChannelNames. Failed to parse JSON:", "Failed to get array", __FILE__, __LINE__); + cJSON_Delete(root); + disconnectToIobox(ip); + if (needRemove) remove_last_info_iobox(); + return channelNames; + } + cJSON* channelList = root; + if (info.ip_address != ip) + { + info.ip_public_address = ip; + } + profile->iobox_info = info; + int arraySize = cJSON_GetArraySize(channelList); + for (int i = 0; i < arraySize; ++i) { + cJSON* channel = cJSON_GetArrayItem(channelList, i); + if (channel != nullptr && channel->type == cJSON_String) { + uint16_t idx = getIndexIoboxFromIp(ip); + std::string aliasName = createAliasName(info.serial_number, info.hardware_version, info.firmware_version, idx); + std::string multicastAlias = createMulticastAlias(aliasName, info.model, info.serial_number, info.ip_public_address == "" ? info.ip_address : info.ip_public_address); + std::string channelName = multicastAlias + "-" + channel->valuestring; + channelNames.push_back(channelName); + } + } + cJSON_Delete(root); + // disconnectToIobox(ip); + //not need remove + return channelNames; + } + else { + this->_logger.LogError("iobox_api::getDeviceChannelNames. Parse response failed:", response, __FILE__, __LINE__); + //disconnectToIobox(ip); + if (needRemove) remove_last_info_iobox(); + return channelNames; + } + } + catch (const std::exception& e) { + this->_logger.LogFatal("iobox_api::getDeviceChannelNames.", e.what(), __FILE__, __LINE__); + return channelNames; + } + } + + + + bool iobox_api::openRs232Port(const std::string& remote, int baudrate, int dataBits, int stopBits, int parityBits) { + std::lock_guard lock(this->_mutex); + std::string ip = checkIpFromRemote(remote); + if (ip == "") { + std::cerr << "Failed to get ip from remote: " << remote << std::endl; + return false; + } + try { + iobox_profile_t* profile = findProfileByIp(ip); + if (profile == nullptr) { + std::cerr << "IP address not found: " << ip << std::endl; + return false; + } + //{"request":{"action":"openRs232","dataBits":,"stopBit":,"parityBit":"","baud": }} + + std::string action = "openRs232"; + std::string parityStr = "none"; + if (parityBits == 1) { + parityStr = "odd"; + } + else if (parityBits == 2) { + parityStr = "even"; + } + std::string openRs232Message = "{\"request\":{\"action\":\"" + action + "\",\"dataBits\":" + std::to_string(dataBits) + ",\"stopBit\":" + std::to_string(stopBits) + ",\"parityBit\":\"" + parityStr + "\",\"baud\":" + std::to_string(baudrate) + "}}"; + if (!sendTcpMessage(ip, openRs232Message.c_str(), openRs232Message.length(), true)) { + return false; + } + char revBuf[256]; + size_t responseLength = sizeof(revBuf); + if (!receiveTcpMessage(ip, revBuf, responseLength)) { + return false; + } + revBuf[responseLength] = '\0'; + std::string response(revBuf); + std::string result; + std::string reason; + iobox_info_t info; + if (parseResponeCommon(response, action, result, reason, info)) { + std::cout << "Parse response success" << std::endl; + if (result == "success") { + std::cout << "Open RS232 port success" << std::endl; + } + else { + std::cerr << "Open RS232 port failed" << std::endl; + std::cerr << "Reason: " << reason << std::endl; + return false; + } + } + else { + std::cerr << "Parse response failed" << std::endl; + return false; + } + return true; + } + catch (const std::exception& e) { + std::cerr << e.what() << std::endl; + return false; + } + } + bool iobox_api::closeRs232Port(const std::string& remote) { + std::lock_guard lock(this->_mutex); + std::string ip = checkIpFromRemote(remote); + if (ip == "") { + std::cerr << "Failed to get ip from remote: " << remote << std::endl; + return false; + } + try { + iobox_profile_t* profile = findProfileByIp(ip); + if (profile == nullptr) { + std::cerr << "IP address not found: " << ip << std::endl; + return false; + } + //{"request":{"action":"closeRs232"}} + + std::string action = "closeRs232"; + std::string openRs232Message = "{\"request\":{\"action\":\"" + action + "\"}}"; + if (!sendTcpMessage(ip, openRs232Message.c_str(), openRs232Message.length(), true)) { + return false; + } + char revBuf[256]; + size_t responseLength = sizeof(revBuf); + if (!receiveTcpMessage(ip, revBuf, responseLength)) { + return false; + } + revBuf[responseLength] = '\0'; + std::string response(revBuf); + std::string result; + std::string reason; + iobox_info_t info; + if (parseResponeCommon(response, action, result, reason, info)) { + std::cout << "Parse response success" << std::endl; + if (result == "success") { + std::cout << "Close RS232 port success" << std::endl; + } + else { + std::cerr << "Close RS232 port failed" << std::endl; + std::cerr << "Reason: " << reason << std::endl; + return false; + } + } + else { + std::cerr << "Parse response failed" << std::endl; + return false; + } + return true; + } + catch (const std::exception& e) { + std::cerr << e.what() << std::endl; + return false; + } + } + bool iobox_api::writeRs232Port(const std::string& remote, const std::string& data, int timeout_ms) { + std::lock_guard lock(this->_mutex); + std::string ip = checkIpFromRemote(remote); + if (ip == "") { + std::cerr << "Failed to get ip from remote: " << remote << std::endl; + return false; + } + try { + iobox_profile_t* profile = findProfileByIp(ip); + if (profile == nullptr) { + std::cerr << "IP address not found: " << ip << std::endl; + return false; + } + //{"request":{"action":"writeRs232","dataType":"","data":""}} + std::string action = "writeRs232"; + std::string hexStringData = stringToHexString(data); + size_t maxChunkSize = 64 * 2; // 64 bytes in hex + size_t dataSize = hexStringData.size(); + size_t offset = 0; + auto start = std::chrono::steady_clock::now(); + + while (offset < dataSize) { + if (std::chrono::steady_clock::now() - start > std::chrono::milliseconds(timeout_ms)) { + std::cerr << "Write RS232 port timeout" << std::endl; + return false; + } + size_t chunkSize = min(maxChunkSize, dataSize - offset); + std::string chunk = hexStringData.substr(offset, chunkSize); + std::string writeRs232Message = "{\"request\":{\"action\":\"" + action + "\",\"dataType\":\"hexstring\",\"data\":\"" + chunk + "\"}}"; + + if (!sendTcpMessage(ip, writeRs232Message.c_str(), writeRs232Message.length(), true)) { + return false; + } + char revBuf[256]; + size_t responseLength = sizeof(revBuf); + if (!receiveTcpMessage(ip, revBuf, responseLength)) { + return false; + } + revBuf[responseLength] = '\0'; + std::string response(revBuf); + std::string result; + std::string reason; + iobox_info_t info; + if (parseResponeCommon(response, action, result, reason, info)) { + std::cout << "Parse response success" << std::endl; + if (result == "success") { + std::cout << "Write RS232 port success" << std::endl; + } + else { + std::cerr << "Write RS232 port failed" << std::endl; + std::cerr << "Reason: " << reason << std::endl; + return false; + } + } + else { + std::cerr << "Parse response failed" << std::endl; + return false; + } + offset += chunkSize; + } + + return true; + } + catch (const std::exception& e) { + std::cerr << e.what() << std::endl; + return false; + } + } + std::string iobox_api::readRs232Port(const std::string& remote, const std::string& terminatorString, int lenExpect, int timeout_ms) { + if (terminatorString == "" && lenExpect == 0) { + std::cerr << "terminatorString and lenExpect cannot be empty at the same time" << std::endl; + return ""; + } + std::lock_guard lock(this->_mutex); + std::string ip = checkIpFromRemote(remote); + if (ip == "") { + std::cerr << "Failed to get ip from remote: " << remote << std::endl; + return ""; + } + try { + iobox_profile_t* profile = findProfileByIp(ip); + if (profile == nullptr) { + std::cerr << "IP address not found: " << ip << std::endl; + return ""; + } + //{"request":{"action":"readRs232","terminatorType":"","timeout": }} + std::string action = "readRs232"; + if (terminatorString != "") { + std::string readRs232Message = "{\"request\":{\"action\":\"" + action + "\",\"terminatorType\":\"characters\",\"terminator\":\"" + terminatorString + "\",\"timeout\":" + std::to_string(timeout_ms) + "}}"; + if (!sendTcpMessage(ip, readRs232Message.c_str(), readRs232Message.length(), true)) { + return ""; + } + } + else if (lenExpect > 0) + { + std::string readRs232Message = "{\"request\":{\"action\":\"" + action + "\",\"terminatorType\":\"len\",\"terminator\":\"" + std::to_string(lenExpect) + "\",\"timeout\":" + std::to_string(timeout_ms) + "}}"; + if (!sendTcpMessage(ip, readRs232Message.c_str(), readRs232Message.length(), true)) { + return ""; + } + } + char revBuf[1024]; + size_t responseLength = sizeof(revBuf); + if (!receiveTcpMessage(ip, revBuf, responseLength, timeout_ms)) { + return ""; + } + revBuf[responseLength] = '\0'; + std::string response(revBuf); + std::string result; + std::string reason; + iobox_info_t info; + if (parseResponeCommon(response, action, result, reason, info)) { + std::cout << "Parse response success" << std::endl; + //may be revBuf is normal buffer or cstring, so need to pass responseLength + if (result == "") + { + std::cerr << "Read RS232 port failed" << std::endl; + std::cerr << "Reason: " << reason << std::endl; + return ""; + } + else { + if (reason == "string") + { + return result; + } + else if (reason == "hexstring") + { + std::string hexString = result; + std::string data; + for (size_t i = 0; i < hexString.length(); i += 2) { + std::string byteString = hexString.substr(i, 2); + char byte = (char)strtol(byteString.c_str(), nullptr, 16); + data.push_back(byte); + } + return data; + } + else { + return ""; + } + } + return result; + } + else { + std::cerr << "Parse response failed" << std::endl; + return ""; + } + + } + catch (const std::exception& e) { + std::cerr << e.what() << std::endl; + return ""; + } + + } + std::string ota_hash256OfFile(const std::string& filename) { + std::ifstream file(filename, std::ios::binary); + if (!file.is_open()) { + std::cerr << "Failed to open file: " << filename << std::endl; + return ""; + } + std::vector buffer(1024); + std::vector hashBuffer(32); + mbedtls_sha256_context ctx; + mbedtls_sha256_init(&ctx); + mbedtls_sha256_starts(&ctx, 0); + while (!file.eof()) { + file.read((char*)buffer.data(), buffer.size()); + size_t bytesRead = file.gcount(); + if (bytesRead > 0) { + mbedtls_sha256_update(&ctx, buffer.data(), bytesRead); + } + } + mbedtls_sha256_finish(&ctx, hashBuffer.data()); + mbedtls_sha256_free(&ctx); + file.close(); + std::stringstream ss; + for (uint8_t byte : hashBuffer) { + ss << std::hex << std::setw(2) << std::setfill('0') << (int)byte; + } + return ss.str(); + } + + + bool iobox_api::otaFirmwareDevice(const std::string& remote, const std::string& filename, const std::string& type) { + if (type != "esp" && type != "mcu") { + this->_logger.LogFatal("iobox_api::otaFirmwareDevice.", "OTA type must be esp or mcu", __FILE__, __LINE__); + return false; + } + std::lock_guard lock(this->_mutex); + + //check file name valid + if (filename == "") { + this->_logger.LogFatal("iobox_api::otaFirmwareDevice.", "Filename cannot be empty", __FILE__, __LINE__); + return false; + } + //get len of file + std::ifstream file(filename, std::ios::binary | std::ios::ate); + if (!file.is_open()) { + this->_logger.LogFatal("iobox_api::otaFirmwareDevice. Failed to open file:", filename, __FILE__, __LINE__); + return false; + } + size_t lenBytes = file.tellg(); + file.close(); + if (lenBytes == 0) { + this->_logger.LogFatal("iobox_api::otaFirmwareDevice. File is empty:", filename, __FILE__, __LINE__); + return false; + } + std::cout << "File size: " << lenBytes << " bytes" << std::endl; + std::string hash256 = ota_hash256OfFile(filename); + if (hash256 == "") { + this->_logger.LogFatal("iobox_api::otaFirmwareDevice. Failed to calculate hash of file:", filename, __FILE__, __LINE__); + return false; + } + std::cout << "Hash: " << hash256 << std::endl; + + std::string ip = checkIpFromRemote(remote); + if (ip == "") { + this->_logger.LogFatal("iobox_api::otaFirmwareDevice. Failed to get ip from remote:", remote, __FILE__, __LINE__); + return false; + } + try { + iobox_profile_t* profile = findProfileByIp(ip); + if (profile == nullptr) { + this->_logger.LogError("iobox_api::otaFirmwareDevice. IP address not found:", ip, __FILE__, __LINE__); + return false; + } + //{"request":{"action":"ota_start","otaType":","hash":""}} + std::string action = "ota_start"; + std::string otaStartMessage = "{\"request\":{\"action\":\"" + action + "\",\"otaType\":\"" + type + "\",\"otaTotalLen\":" + std::to_string(lenBytes) + ",\"hash\":\"" + hash256 + "\"}}"; + if (!sendTcpMessage(ip, otaStartMessage.c_str(), otaStartMessage.length(), true)) { + return false; + } + char revBuf[256]; + size_t responseLength = sizeof(revBuf); + if (!receiveTcpMessage(ip, revBuf, responseLength, 10000)) { + return false; + } + revBuf[responseLength] = '\0'; + std::string response(revBuf); + std::string result; + std::string reason; + iobox_info_t info; + if (parseResponeCommon(response, action, result, reason, info)) { + std::cout << "Parse response success" << std::endl; + if (result == "success") { + std::cout << "OTA start success" << std::endl; + } + else { + this->_logger.LogError("iobox_api::otaFirmwareDevice. OTA start failed:", result, __FILE__, __LINE__); + return false; + } + } + else { + this->_logger.LogError("iobox_api::otaFirmwareDevice. Parse response failed:", response, __FILE__, __LINE__); + return false; + } + + //{"request":{"action":"ota_running","otaDataPackage":"","otaCurrentLen": }} + std::ifstream otaFile(filename, std::ios::binary); + if (!otaFile.is_open()) { + this->_logger.LogError("iobox_api::otaFirmwareDevice. Failed to open file :", filename, __FILE__, __LINE__); + return false; + } + + size_t maxChunkSize = 256; + std::vector buffer(maxChunkSize); + size_t totalBytesSent = 0; + + while (!otaFile.eof()) { + otaFile.read(buffer.data(), maxChunkSize); + size_t bytesRead = otaFile.gcount(); + std::cout << "Read " << bytesRead << " bytes" << std::endl; + if (bytesRead > 0) { + std::string hexStringData = stringToHexString(std::string(buffer.data(), bytesRead)); + std::string otaRunningMessage = "{\"request\":{\"action\":\"ota_running\",\"otaDataPackage\":\"" + hexStringData + "\",\"otaCurrentLen\":" + std::to_string(totalBytesSent + bytesRead) + "}}"; + + if (!sendTcpMessage(ip, otaRunningMessage.c_str(), otaRunningMessage.length(), true)) { + otaFile.close(); + return false; + } + + char revBuf[256]; + size_t responseLength = sizeof(revBuf); + if (!receiveTcpMessage(ip, revBuf, responseLength)) { + otaFile.close(); + return false; + } + + revBuf[responseLength] = '\0'; + std::string response(revBuf); + std::string result; + std::string reason; + iobox_info_t info; + if (!parseResponeCommon(response, "ota_running", result, reason, info) || result != "success") { + this->_logger.LogError("iobox_api::otaFirmwareDevice. OTA running failed :", result, __FILE__, __LINE__); + otaFile.close(); + return false; + } + + totalBytesSent += bytesRead; + std::cout << "TotalBytesSent " << totalBytesSent << " bytes" << std::endl; + + } + } + otaFile.close(); + + //{"request":{"action":"ota_end"}} + std::string otaEndMessage = "{\"request\":{\"action\":\"ota_end\"}}"; + if (!sendTcpMessage(ip, otaEndMessage.c_str(), otaEndMessage.length(), true)) { + return false; + } + char revBufEnd[256]; + size_t responseLengthEnd = sizeof(revBufEnd); + if (!receiveTcpMessage(ip, revBufEnd, responseLengthEnd, 22000)) { + return false; + } + revBufEnd[responseLengthEnd] = '\0'; + std::string responseEnd(revBufEnd); + std::string resultEnd; + std::string reasonEnd; + iobox_info_t infoEnd; + if (parseResponeCommon(responseEnd, "ota_end", resultEnd, reasonEnd, infoEnd)) { + std::cout << "Parse response success" << std::endl; + if (resultEnd == "success") { + std::cout << "OTA end success" << std::endl; + } + else { + this->_logger.LogError("iobox_api::otaFirmwareDevice. OTA end failed :", reasonEnd, __FILE__, __LINE__); + return false; + } + } + else { + this->_logger.LogError("iobox_api::otaFirmwareDevice. Parse response failed :", responseEnd, __FILE__, __LINE__); + return false; + } + + + std::cout << "OTA update completed successfully" << std::endl; + + + return true; + } + catch (const std::exception& e) { + this->_logger.LogFatal("iobox_api::otaFirmwareDevice.", e.what(), __FILE__, __LINE__); + return false; + } + } + + + + bool iobox_api::checkTcpConnectStatus(const std::string& remote) { + try { + std::lock_guard lock(this->_mutex); + std::string ip = checkIpFromRemote(remote); + if (ip == "") { + this->_logger.LogWarn("iobox_api::checkTcpConnectStatus. Failed to get ip from remote:", remote, __FILE__, __LINE__); + return false; + } + iobox_profile_t* profile = findProfileByIp(ip); + if (profile == nullptr) { + this->_logger.LogWarn("iobox_api::checkTcpConnectStatus. IP address not found:", ip, __FILE__, __LINE__); + return false; + } + if (profile->sock_tcp == INVALID_SOCKET) { + this->_logger.LogWarn("iobox_api::checkTcpConnectStatus.", "Socket is invalid", __FILE__, __LINE__); + return false; + } + std::string action = "ping"; + std::string mid = std::to_string(rand()); + std::string pingMessage = "{\"request\":{\"action\":\"" + action + "\",\"mid\":\"" + mid + "\"}}"; + if (!sendTcpMessage(ip, pingMessage.c_str(), pingMessage.length(), false)) { + disconnectToIobox(ip); + this->_logger.LogWarn("iobox_api::checkTcpConnectStatus.", "Please retry connect", __FILE__, __LINE__); + return false; + } + char revBuf[256]; + size_t responseLength = sizeof(revBuf); + if (!receiveTcpMessage(ip, revBuf, responseLength)) { + disconnectToIobox(ip); + this->_logger.LogWarn("iobox_api::checkTcpConnectStatus.", "Please retry connect", __FILE__, __LINE__); + return false; + } + revBuf[responseLength] = '\0'; + std::string response(revBuf); + std::string result; + std::string reason; + iobox_info_t info; + if (parseResponeCommon(response, action, result, reason, info)) { + std::cout << "Parse response success" << std::endl; + if (result == mid) { + std::cout << "Ping success" << std::endl; + return true; + } + else { + this->_logger.LogError("iobox_api::checkTcpConnectStatus. Ping failed:", reason, __FILE__, __LINE__); + // disconnectToIobox(ip); + std::cout << "Please retry connect" << std::endl; + return false; + } + } + else { + this->_logger.LogError("iobox_api::checkTcpConnectStatus. Parse response failed:", response, __FILE__, __LINE__); + // disconnectToIobox(ip); + std::cout << "Please retry connect" << std::endl; + return false; + } + return true; + } + catch (const std::exception& e) { + this->_logger.LogFatal("iobox_api::checkTcpConnectStatus.", e.what(), __FILE__, __LINE__); + return false; + } + } + std::vector iobox_api::advancedConnectToIobox(const std::string& remote, int port, const std::string& macAddress, const std::string& username, const std::string& password) { + std::lock_guard lock(this->_mutex); + std::vector result; + std::string macAddressInUppercase = toUpperCase(macAddress); + bool needToScan = false; // We will scan for list of SN -> IP (store in map) + // 1. Check if we do need to scan for IP + std::string ip = remote; + if (!ip.empty()) { + ip = checkIpFromRemote(remote); + } + if ((ip == "") || (ip.empty())) { // we need to check if any mac address is valid + if (macAddress.empty() || (macAddress == "")) + { + this->_logger.LogError("iobox_api::advancedConnectToIobox. Failed to get ip from remote:", remote, __FILE__, __LINE__); + return result; + } + else { + // we check if we can find ip address from mac address from map otherwise we need to scan + if (!macToIpMap.empty()) { + auto it = macToIpMap.find(macAddressInUppercase); + if (it != macToIpMap.end()) { + ip = it->second; + } + else { + needToScan = true; // we need to scan for list of SN -> IP (store in map) + } + } + else { + needToScan = true; // we need to scan for list of SN -> IP (store in map) + } + } + } + //2. We will need to find valid IP address + std::string validIp = ip; + if (needToScan) { + // 2.1 We will use multcast to find valid IP address + std::vector multiCastResults = scanNetworkDevicesMulticast(5); + if (multiCastResults.empty()) { + // We will manual scan for IP address + std::vector uniCastResults = scanNetworkDevicesManually(5); + if (uniCastResults.empty()) { + this->_logger.LogError("iobox_api::advancedConnectToIobox. ", "Failed to find any iobox devices", __FILE__, __LINE__); + return result; + } + } + if (macToIpMap.empty()) { + this->_logger.LogError("iobox_api::advancedConnectToIobox. ", "Failed to find any iobox devices", __FILE__, __LINE__); + return result; + } + // 2.2 Find valid IP address from mac + auto it = macToIpMap.find(macAddressInUppercase); + if (it != macToIpMap.end()) { + validIp = it->second; + } + else { + this->_logger.LogError("iobox_api::advancedConnectToIobox. ", "MAC address not found.", __FILE__, __LINE__); + return result; + } + + } + // 3. We will connect to iobox + std::string deviceInfo = connectToIobox(validIp, port, username, password); + if (deviceInfo.empty()) { + // We try a second time to rescan + // 3.1 We will use multcast to find valid IP address + std::vector multiCastResults = scanNetworkDevicesMulticast(5); + if (multiCastResults.empty()) { + // We will manual scan for IP address + std::vector uniCastResults = scanNetworkDevicesManually(5); + if (uniCastResults.empty()) { + this->_logger.LogError("iobox_api::advancedConnectToIobox. ", "Failed to find any iobox devices", __FILE__, __LINE__); + return result; + } + } + if (macToIpMap.empty()) { + this->_logger.LogError("iobox_api::advancedConnectToIobox. ", "Failed to find any iobox devices", __FILE__, __LINE__); + return result; + } + // 3.2 Find valid IP address from mac + auto it = macToIpMap.find(macAddressInUppercase); + if (it != macToIpMap.end()) { + validIp = it->second; + } + else { + this->_logger.LogError("iobox_api::advancedConnectToIobox. ", "MAC address not found.", __FILE__, __LINE__); + return result; + } + deviceInfo = connectToIobox(validIp, port, username, password); + if (deviceInfo.empty()) { + this->_logger.LogError("iobox_api::advancedConnectToIobox. ", "Failed to connect to iobox", __FILE__, __LINE__); + return result; + } + } + + // 4. Get device info + std::vector deviceInfos; + // 4.1 Search for device infos from ipToDeviceMap + auto it = ipToDeviceMap.find(validIp); + if (it != ipToDeviceMap.end()) { + deviceInfos = it->second; + } + if (!deviceInfos.empty()) { + if (!macAddress.empty()) { + std::string firstInfoRecord = deviceInfos[0]; + // Split the record into parts + std::vector parts; + std::stringstream ss(firstInfoRecord); + std::string segment; + while (std::getline(ss, segment, '-')) { + parts.push_back(segment); + } + // Validate structure + if (parts.size() >= 4) { + std::string macAddressFromRecord = parts[2]; // 3rd element: MacAddress + if (toUpperCase(macAddressFromRecord) == macAddressInUppercase) { + result = deviceInfos; + return result; + } + } + } + else { + result = deviceInfos; + return result; + } + } + // 4.2 If not found, we will get device info from iobox + result = getDeviceChannelNames(validIp); + if (!result.empty()) { + if (ipToDeviceMap.find(validIp) == ipToDeviceMap.end()) { + ipToDeviceMap[validIp] = result; + } + } + return result; + } + std::vector iobox_api::advancedScan(int timeout) { + std::lock_guard lock(this->_mutex); + std::vector result; + // 1. We will use multcast to find valid IP address + std::vector multiCastResults = scanNetworkDevicesMulticast(timeout); + if (multiCastResults.empty()) { + // We will manual scan for IP address + std::vector uniCastResults = scanNetworkDevicesManually(timeout); + } + // 2. By now we do have ip address and mac map + if (!macToIpMap.empty()) { + // we go throught ip address found this the list by checking each map element + for (const auto& pair : macToIpMap) { + std::string macAddress = toUpperCase(pair.first); + std::string ipAddress = pair.second; + std::vector deviceInfos; + auto it = ipToDeviceMap.find(ipAddress); + if (it != ipToDeviceMap.end()) { + deviceInfos = it->second; + } + if (!deviceInfos.empty()) { + for (auto& deviceInfo : deviceInfos) { + result.push_back(deviceInfo); + } + } + } + } + else { + this->_logger.LogError("iobox_api::advancedScan. ", "Failed to find any iobox devices", __FILE__, __LINE__); + } + return result; + } + bool iobox_api::setValue(const std::string& remote, const std::string& channelName, const std::string& value) { + // Validate inputs + if (remote.empty() || channelName.empty()) { + this->_logger.LogError("iobox_api::setValue. ", "Invalid parameters - remote or channelName is empty", __FILE__, __LINE__); + return false; + } + try { + auto startTime = std::chrono::steady_clock::now(); + auto timeoutDuration = std::chrono::milliseconds(IoboxConfig::TOTAL_TIMEOUT_MS); + + for (int attempt = 1; attempt <= IoboxConfig::MAX_RETRIES; ++attempt) { + // Check if we've exceeded the total timeout + auto elapsed = std::chrono::steady_clock::now() - startTime; + if (elapsed >= timeoutDuration) { + this->_logger.LogError("iobox_api::setValue. Total timeout exceeded after", + std::to_string(std::chrono::duration_cast(elapsed).count()), __FILE__, __LINE__); + break; + } + + bool result = setValueDataStringIoboxFromChannelName(remote, channelName, value); + if (result) { + if (attempt > 1) { + this->_logger.LogDebug("iobox_api::setValue. Succeeded on attempt", std::to_string(attempt), __FILE__, __LINE__); + } + return true; + } + + // Log retry attempt (but not on first failure to avoid spam) + if (attempt == 2) { + this->_logger.LogWarn("iobox_api::setValue. First attempt failed, starting retries for channel:", + channelName, __FILE__, __LINE__); + } + else if (attempt % 10 == 0) { + this->_logger.LogWarn("iobox_api::setValue. Attempt", std::to_string(attempt), __FILE__, __LINE__); + } + + // Don't sleep on the last attempt + if (attempt < IoboxConfig::MAX_RETRIES) { + std::this_thread::sleep_for(std::chrono::milliseconds(IoboxConfig::RETRY_DELAY_MS)); + } + } + + this->_logger.LogError("iobox_api::setValue. All retry attempts failed for channel after retries:", std::to_string(IoboxConfig::MAX_RETRIES), __FILE__, __LINE__); + return false; + } + catch (const std::exception& e) { + this->_logger.LogFatal("iobox_api::setValue. Exception:", e.what(), __FILE__, __LINE__); + return false; + } + catch (...) { + this->_logger.LogFatal("iobox_api::setValue.", "Unknown exception occurred", __FILE__, __LINE__); + return false; + } + } + bool iobox_api::getValue(const std::string& remote, const std::string& channelName, std::string& outValue) { + // Clear output parameter + outValue.clear(); + + // Validate inputs + if (remote.empty() || channelName.empty()) { + this->_logger.LogError("iobox_api::getValue. Invalid parameters - ", "remote or channelName is empty", __FILE__, __LINE__); + return false; + } + + try { + auto startTime = std::chrono::steady_clock::now(); + auto timeoutDuration = std::chrono::milliseconds(IoboxConfig::TOTAL_TIMEOUT_MS); + + for (int attempt = 1; attempt <= IoboxConfig::MAX_RETRIES; ++attempt) { + // Check if we've exceeded the total timeout + auto elapsed = std::chrono::steady_clock::now() - startTime; + if (elapsed >= timeoutDuration) { + this->_logger.LogError("iobox_api::getValue. Total timeout exceeded after", + std::to_string(std::chrono::duration_cast(elapsed).count()), __FILE__, __LINE__); + break; + } + + // Use the improved version based on which option you chose earlier + std::string tempValue; + bool result = false; + + // Option 1: If using the output parameter version + result = getValueDataStringIoboxFromChannelName(remote, channelName, tempValue); + + // Option 2: If using the std::optional version (uncomment if you chose this) + /* + auto optionalResult = getValueDataStringIoboxFromChannelName(remote, channelName); + if (optionalResult.has_value()) { + tempValue = *optionalResult; + result = true; + } + */ + + // Option 3: If using the IoboxResult version (uncomment if you chose this) + /* + auto resultEx = getValueDataStringIoboxFromChannelNameEx(remote, channelName); + if (resultEx.isSuccess()) { + tempValue = resultEx.value; + result = true; + } + */ + + if (result && !tempValue.empty()) { + outValue = tempValue; + if (attempt > 1) { + this->_logger.LogDebug("iobox_api::getValue. Succeeded, value: ", outValue, __FILE__, __LINE__); + } + return true; + } + + // Log retry attempt (but not on first failure to avoid spam) + if (attempt == 2) { + this->_logger.LogWarn("iobox_api::getValue. First attempt failed, starting retries for channel:", + channelName, __FILE__, __LINE__); + } + else if (attempt % 10 == 0) { + this->_logger.LogWarn("iobox_api::getValue. Attempt", std::to_string(attempt), __FILE__, __LINE__); + } + + // Don't sleep on the last attempt + if (attempt < IoboxConfig::MAX_RETRIES) { + std::this_thread::sleep_for(std::chrono::milliseconds(IoboxConfig::RETRY_DELAY_MS)); + } + } + + this->_logger.LogError("iobox_api::getValue. All retry attempts failed for channel:", std::to_string(IoboxConfig::MAX_RETRIES), __FILE__, __LINE__); + return false; + } + catch (const std::exception& e) { + this->_logger.LogFatal("iobox_api::getValue. Exception:", e.what(), __FILE__, __LINE__); + return false; + } + catch (...) { + this->_logger.LogFatal("iobox_api::getValue.", "Unknown exception occurred", __FILE__, __LINE__); + return false; + } + } + bool iobox_api::toggleIobox(const std::string& remote, const std::string& channelName, + int timeOut, bool revertFlag, bool resetFlag, bool asyncMode) { + // Validate inputs + if (timeOut < 0) { + this->_logger.LogError("iobox_api::toggleIobox. Invalid timeout value", std::to_string(timeOut), __FILE__, __LINE__); + return false; + } + + if (remote.empty() || channelName.empty()) { + this->_logger.LogError("iobox_api::toggleIobox. Invalid parameters", "", __FILE__, __LINE__); + return false; + } + + std::string key = remote + ":" + channelName; + std::shared_ptr toggleInfo; + bool isNewOperation = false; + + // Critical section for map access + { + std::lock_guard mapLock(toggleMapMutex); + + auto it = activeToggles.find(key); + if (it != activeToggles.end()) { + // Existing operation found for this channel + if (!resetFlag) { + this->_logger.LogWarn("iobox_api::toggleIobox. Toggle already active", channelName, __FILE__, __LINE__); + return false; // Reject new call when resetFlag is false + } + + // Reset the timeout for existing operation + toggleInfo = it->second; + { + std::lock_guard infoLock(toggleInfo->mtx); + toggleInfo->endTime = std::chrono::steady_clock::now() + std::chrono::milliseconds(timeOut); + toggleInfo->cancelled = false; // Reset cancellation flag + toggleInfo->cv.notify_one(); + } + this->_logger.LogDebug("iobox_api::toggleIobox. Reset timeout", channelName, __FILE__, __LINE__); + return true; // Reset successful + } + else { + // Create new operation for this channel + toggleInfo = std::make_shared(); + toggleInfo->endTime = std::chrono::steady_clock::now() + std::chrono::milliseconds(timeOut); + toggleInfo->revertFlag = revertFlag; + toggleInfo->active = true; + toggleInfo->cancelled = false; + + // Get original state before starting toggle using retry logic + bool getResult = getValue(remote, channelName, toggleInfo->originalState); + if (!getResult || toggleInfo->originalState.empty()) { + this->_logger.LogError("iobox_api::toggleIobox. Failed to read current state", channelName, __FILE__, __LINE__); + return false; // Failed to read current state + } + + activeToggles[key] = toggleInfo; + isNewOperation = true; + this->_logger.LogDebug("iobox_api::toggleIobox. Started new toggle operation", channelName, __FILE__, __LINE__); + } + } + + // Only new operations continue from here + if (!isNewOperation) return true; + + // For async mode, start operation in separate thread and return immediately + if (asyncMode) { + std::thread asyncWorker([this, remote, channelName, toggleInfo, key]() { + this->executeToggleOperation(remote, channelName, toggleInfo, key); + }); + asyncWorker.detach(); // Detach thread to run independently + this->_logger.LogDebug("iobox_api::toggleIobox. Started async toggle", channelName, __FILE__, __LINE__); + return true; // Return immediately for async mode + } + + // For sync mode, execute operation in current thread + return executeToggleOperation(remote, channelName, toggleInfo, key); + } + + // Enhanced helper function with comprehensive verification + bool iobox_api::executeToggleOperation(const std::string& remote, const std::string& channelName, + std::shared_ptr toggleInfo, const std::string& key) { + + // RAII cleanup helper + auto cleanup = [this, &key, &channelName]() { + std::lock_guard mapLock(toggleMapMutex); + activeToggles.erase(key); + this->_logger.LogDebug("iobox_api::executeToggleOperation. Cleaned up toggle", channelName, __FILE__, __LINE__); + }; + + try { + // Define ON/OFF states (make these configurable if needed) + const std::string onState = "1"; + const std::string offState = "0"; + + // Determine toggle states - create complete toggle cycle regardless of current state + std::string firstState, secondState; + + if (toggleInfo->revertFlag) { + // Revert mode: go to OFF first, then back to ON + firstState = offState; // Always go to OFF first + secondState = onState; // Then revert to ON + this->_logger.LogDebug("iobox_api::executeToggleOperation. Revert mode OFF-ON", channelName, __FILE__, __LINE__); + } + else { + // Normal mode: go to ON first, then to OFF + firstState = onState; // Always go to ON first + secondState = offState; // Then go to OFF (complete the toggle cycle) + this->_logger.LogDebug("iobox_api::executeToggleOperation. Normal mode ON-OFF", channelName, __FILE__, __LINE__); + } + + // Phase 1: Set the initial toggle state with verification + this->_logger.LogDebug("iobox_api::executeToggleOperation. Setting initial state", firstState, __FILE__, __LINE__); + + if (!setValue(remote, channelName, firstState)) { + this->_logger.LogError("iobox_api::executeToggleOperation. Failed to set initial state", channelName, __FILE__, __LINE__); + cleanup(); + return false; + } + + // Verify the initial state was set correctly using getValue (which includes retries) + std::string verifyValue; + if (!getValue(remote, channelName, verifyValue)) { + this->_logger.LogError("iobox_api::executeToggleOperation. Failed to verify initial state", channelName, __FILE__, __LINE__); + cleanup(); + return false; + } + + if (verifyValue != firstState) { + this->_logger.LogError("iobox_api::executeToggleOperation. Initial state verification failed", firstState, __FILE__, __LINE__); + cleanup(); + return false; + } + + this->_logger.LogDebug("iobox_api::executeToggleOperation. Initial state verified", channelName, __FILE__, __LINE__); + + // Phase 2: Wait for timeout with possible resets from other threads + auto waitStartTime = std::chrono::steady_clock::now(); + { + std::unique_lock lock(toggleInfo->mtx); + while (toggleInfo->active && !toggleInfo->cancelled && + std::chrono::steady_clock::now() < toggleInfo->endTime) { + + auto waitResult = toggleInfo->cv.wait_until(lock, toggleInfo->endTime); + + // Check if we were cancelled + if (toggleInfo->cancelled) { + this->_logger.LogDebug("iobox_api::executeToggleOperation. Toggle cancelled", channelName, __FILE__, __LINE__); + cleanup(); + return false; + } + + // Log if timeout was extended + if (waitResult == std::cv_status::no_timeout) { + this->_logger.LogDebug("iobox_api::executeToggleOperation. Timeout extended", channelName, __FILE__, __LINE__); + } + } + } + + auto waitDuration = std::chrono::steady_clock::now() - waitStartTime; + auto waitMs = std::chrono::duration_cast(waitDuration).count(); + this->_logger.LogDebug("iobox_api::executeToggleOperation. Wait completed", channelName, __FILE__, __LINE__); + + // Phase 3: Set final state (always execute for complete toggle cycle) + this->_logger.LogDebug("iobox_api::executeToggleOperation. Setting final state", secondState, __FILE__, __LINE__); + + if (!setValue(remote, channelName, secondState)) { + this->_logger.LogError("iobox_api::executeToggleOperation. Failed to set final state", channelName, __FILE__, __LINE__); + cleanup(); + return false; + } + + // Verify the final state was set correctly + if (!getValue(remote, channelName, verifyValue)) { + this->_logger.LogError("iobox_api::executeToggleOperation. Failed to verify final state", channelName, __FILE__, __LINE__); + cleanup(); + return false; + } + + if (verifyValue != secondState) { + this->_logger.LogError("iobox_api::executeToggleOperation. Final state verification failed", secondState, __FILE__, __LINE__); + cleanup(); + return false; + } + + // Mark as inactive and cleanup + toggleInfo->active = false; + cleanup(); + + this->_logger.LogDebug("iobox_api::executeToggleOperation. Toggle completed successfully", channelName, __FILE__, __LINE__); + return true; + + } + catch (const std::exception& e) { + this->_logger.LogFatal("iobox_api::executeToggleOperation. Exception", e.what(), __FILE__, __LINE__); + cleanup(); + return false; + } + catch (...) { + this->_logger.LogFatal("iobox_api::executeToggleOperation. Unknown exception", "", __FILE__, __LINE__); + cleanup(); + return false; + } + } + + // Optional: Add a method to cancel active toggles + bool iobox_api::cancelToggle(const std::string& remote, const std::string& channelName) { + std::string key = remote + ":" + channelName; + + std::lock_guard mapLock(toggleMapMutex); + auto it = activeToggles.find(key); + if (it != activeToggles.end()) { + auto toggleInfo = it->second; + { + std::lock_guard infoLock(toggleInfo->mtx); + toggleInfo->cancelled = true; + toggleInfo->active = false; + toggleInfo->cv.notify_one(); + } + this->_logger.LogDebug("iobox_api::cancelToggle. Cancelled toggle for channel", channelName, __FILE__, __LINE__); + return true; + } + + this->_logger.LogWarn("iobox_api::cancelToggle. No active toggle found for channel", channelName, __FILE__, __LINE__); + return false; + } + + // Optional: Get status of active toggles + std::vector iobox_api::getActiveToggleChannels() { + std::vector activeChannels; + std::lock_guard mapLock(toggleMapMutex); + + for (const auto& pair : activeToggles) { + activeChannels.push_back(pair.first); // key is "remote:channelName" + } + + return activeChannels; + } + + // Optional: Get detailed status of a specific toggle + bool iobox_api::getToggleStatus(const std::string& remote, const std::string& channelName, + int& remainingTimeMs, std::string& currentPhase) { + std::string key = remote + ":" + channelName; + + std::lock_guard mapLock(toggleMapMutex); + auto it = activeToggles.find(key); + if (it != activeToggles.end()) { + auto toggleInfo = it->second; + std::lock_guard infoLock(toggleInfo->mtx); + + auto now = std::chrono::steady_clock::now(); + if (now < toggleInfo->endTime) { + auto remaining = toggleInfo->endTime - now; + remainingTimeMs = static_cast(std::chrono::duration_cast(remaining).count()); + currentPhase = toggleInfo->revertFlag ? "waiting_to_revert" : "toggle_active"; + return true; + } + else { + remainingTimeMs = 0; + currentPhase = "completing"; + return true; + } + } + + remainingTimeMs = 0; + currentPhase = "not_active"; + return false; + } + + + // More function + //{ + // "request": {"action":"getStaticIpconfig", + // } + //} + + //{ + // "response":{"action":"getStaticIpconfig", + // "result" : {"enable":true / false, + // "ip" : "192.168.1.2", + // "gw" : "", + // "nm" : ""} + // } + //} + std::vector iobox_api::getStaticIpConfig(const std::string& remote) { + std::vector ipConfig; + std::lock_guard lock(this->_mutex); + std::string ip = checkIpFromRemote(remote); + if (ip == "") { + this->_logger.LogError("iobox_api::getStaticIpConfig. Failed to get ip from remote: ", remote, __FILE__, __LINE__); + return ipConfig; + } + try { + iobox_profile_t* profile = findProfileByIp(ip); + if (profile == nullptr) { + this->_logger.LogError("iobox_api::getStaticIpConfig.", "IP address not found.", __FILE__, __LINE__); + return ipConfig; + } + //{"request": {"action":"getStaticIpconfig"}} + std::string action = "getStaticIpconfig"; + std::string getStaticIpConfigMessage = "{\"request\":{\"action\":\"" + action + "\"}}"; + if (!sendTcpMessage(ip, getStaticIpConfigMessage.c_str(), getStaticIpConfigMessage.length(), true)) { + return ipConfig; + } + char revBuf[512]; + size_t responseLength = sizeof(revBuf); + if (!receiveTcpMessage(ip, revBuf, responseLength)) { + return ipConfig; + } + revBuf[responseLength] = '\0'; + std::string response(revBuf); + std::string result; + std::string reason; + iobox_info_t info; + if (parseResponeCommon(response, action, result, reason, info)) { + std::cout << "Parse response success" << std::endl; + cJSON* root = cJSON_Parse(result.c_str()); + if (root == nullptr) { + this->_logger.LogError("iobox_api::getStaticIpConfig.", "Failed to parse JSON", __FILE__, __LINE__); + return ipConfig; + } + if (root->type != cJSON_Object) { + this->_logger.LogError("iobox_api::getStaticIpConfig.", "Failed to get object", __FILE__, __LINE__); + cJSON_Delete(root); + return ipConfig; + } + cJSON* enableItem = cJSON_GetObjectItem(root, "enable"); + cJSON* ipItem = cJSON_GetObjectItem(root, "ip"); + cJSON* gwItem = cJSON_GetObjectItem(root, "gw"); + cJSON* nmItem = cJSON_GetObjectItem(root, "nm"); + if (enableItem == nullptr || enableItem->type != cJSON_True && enableItem->type != cJSON_False) { + this->_logger.LogError("iobox_api::getStaticIpConfig.", "Failed to get enable", __FILE__, __LINE__); + cJSON_Delete(root); + return ipConfig; + } + if (ipItem == nullptr || ipItem->type != cJSON_String) { + this->_logger.LogError("iobox_api::getStaticIpConfig.", "Failed to get ip", __FILE__, __LINE__); + cJSON_Delete(root); + return ipConfig; + } + if (gwItem == nullptr || gwItem->type != cJSON_String) { + this->_logger.LogError("iobox_api::getStaticIpConfig.", "Failed to get gw", __FILE__, __LINE__); + cJSON_Delete(root); + return ipConfig; + } + if (nmItem == nullptr || nmItem->type != cJSON_String) { + this->_logger.LogError("iobox_api::getStaticIpConfig.", "Failed to get nm", __FILE__, __LINE__); + cJSON_Delete(root); + return ipConfig; + } + ipConfig.push_back(enableItem->type == cJSON_True ? "staticIpEnable:true" : "staticIpEnable:false"); + ipConfig.push_back("ip:" + std::string(ipItem->valuestring)); + ipConfig.push_back("gw:" + std::string(gwItem->valuestring)); + ipConfig.push_back("nm:" + std::string(nmItem->valuestring)); + cJSON_Delete(root); + return ipConfig; + + } + else { + this->_logger.LogError("iobox_api::getStaticIpConfig.", "Parse response failed", __FILE__, __LINE__); + return ipConfig; + } + } + catch (const std::exception& e) { + std::cerr << e.what() << std::endl; + this->_logger.LogFatal("iobox_api::getStaticIpConfig.", e.what(), __FILE__, __LINE__); + return ipConfig; + + } + } + //{"request": {"action":"setStaticIpconfig", + // "enable":true/false, + // "ip":"", + // "gw":"", + // "nm":"" + // + // } + //} + // + //{"response":{"action":"setStaticIpconfig", + // "result":"", + // "reason":"" + // } + //} + + bool iobox_api::setStaticIpConfig(const std::string& remote, bool enable, const std::string& ip, const std::string& gw, const std::string& nm) + { + std::lock_guard lock(this->_mutex); + std::string ipRemote = checkIpFromRemote(remote); + if (ipRemote == "") { + this->_logger.LogError("iobox_api::setStaticIpConfig. Failed to get ip from remote: ", remote, __FILE__, __LINE__); + return false; + } + if (ip != "" && !isValidIp(ip)) { + std::cerr << "Invalid ip address: " << ip << std::endl; + this->_logger.LogError("iobox_api::setStaticIpConfig. Invalid ip address: ", ip, __FILE__, __LINE__); + return false; + } + if (gw != "" && !isValidIp(gw)) { + this->_logger.LogError("iobox_api::setStaticIpConfig. Invalid gateway address: ", gw, __FILE__, __LINE__); + return false; + } + if (nm != "" && !isValidIp(nm)) { + this->_logger.LogError("iobox_api::setStaticIpConfig. Invalid netmask address: ", nm, __FILE__, __LINE__); + return false; + } + try { + iobox_profile_t* profile = findProfileByIp(ipRemote); + if (profile == nullptr) { + this->_logger.LogError("iobox_api::setStaticIpConfig. IP address not found: ", ipRemote, __FILE__, __LINE__); + return false; + } + //{"request": {"action":"setStaticIpconfig","enable":true/false,"ip":"","gw":"","nm":""}} + std::string action = "setStaticIpconfig"; + std::string enableStr = enable ? "true" : "false"; + std::string setStaticIpConfigMessage = "{\"request\":{\"action\":\"" + action + "\",\"enable\":" + enableStr + ",\"ip\":\"" + ip + "\",\"gw\":\"" + gw + "\",\"nm\":\"" + nm + "\"}}"; + if (!sendTcpMessage(ipRemote, setStaticIpConfigMessage.c_str(), setStaticIpConfigMessage.length(), true)) { + return false; + } + char revBuf[256]; + size_t responseLength = sizeof(revBuf); + if (!receiveTcpMessage(ipRemote, revBuf, responseLength)) { + return false; + } + revBuf[responseLength] = '\0'; + std::string response(revBuf); + std::string result; + std::string reason; + iobox_info_t info; + if (parseResponeCommon(response, action, result, reason, info)) { + std::cout << "Parse response success" << std::endl; + if (result == "success") { + std::cout << "Set static ip config success" << std::endl; + } + else { + this->_logger.LogError("iobox_api::setStaticIpConfig. Set static ip config failed: ", reason, __FILE__, __LINE__); + return false; + } + } + else { + this->_logger.LogError("iobox_api::setStaticIpConfig. ", "Parse response failed", __FILE__, __LINE__); + return false; + } + return true; + } + catch (const std::exception& e) { + this->_logger.LogError("iobox_api::setStaticIpConfig. Exception: ", e.what(), __FILE__, __LINE__); + return false; + } + } + + std::string iobox_api::getValueDataStringIoboxFromChannelName(const std::string& remote, const std::string& channelName) { + std::lock_guard lock(this->_mutex); + std::string ip = checkIpFromRemote(remote); + if (ip == "") { + this->_logger.LogError("iobox_api::getValueDataStringIoboxFromChannelName. Failed to get ip from remote: ", remote, __FILE__, __LINE__); + return ""; + } + try { + iobox_profile_t* profile = findProfileByIp(ip); + if (profile == nullptr) { + this->_logger.LogError("iobox_api::getValueDataStringIoboxFromChannelName. IP address not found: ", ip, __FILE__, __LINE__); + return ""; + } + //{"request": {"action":"getValue","channel":""}} + std::string action = "getValue"; + std::string getValueMessage = "{\"request\":{\"action\":\"" + action + "\",\"channel\":\"" + channelName + "\"}}"; + if (!sendTcpMessage(ip, getValueMessage.c_str(), getValueMessage.length(), true)) { + return ""; + } + char revBuf[256]; + size_t responseLength = sizeof(revBuf); + if (!receiveTcpMessage(ip, revBuf, responseLength)) { + return ""; + } + revBuf[responseLength] = '\0'; + std::string response(revBuf); + std::string result; + std::string reason; + iobox_info_t info; + if (parseResponeCommon(response, action, result, reason, info)) { + std::cout << "Parse response success" << std::endl; + return result; + } + else { + this->_logger.LogError("iobox_api::getValueDataStringIoboxFromChannelName.", " Parse response failed.", __FILE__, __LINE__); + + return ""; + } + } + catch (const std::exception& e) { + this->_logger.LogError("iobox_api::getValueDataStringIoboxFromChannelName.", e.what(), __FILE__, __LINE__); + return ""; + } + } + + bool iobox_api::toggleDigitalOutput(const std::string& remote, const std::string& channelName, const std::string& milliseconds, bool invert, bool reset) { + + std::lock_guard lock(this->_mutex); + std::string ip = checkIpFromRemote(remote); + if (ip == "") { + this->_logger.LogError("iobox_api::toggleDigitalOutput. Failed to get ip from remote: ", remote, __FILE__, __LINE__); + return false; + } + try { + iobox_profile_t* profile = findProfileByIp(ip); + if (profile == nullptr) { + this->_logger.LogError("iobox_api::toggleDigitalOutput. IP address not found: ", ip, __FILE__, __LINE__); + return false; + } + + //not check valid channel name here + + //{"request": {"action":"toggleDO", "channel":"","milliseconds":"","invert":true/false,"reset":true/false}} + std::string action = "toggleDO"; + std::string toggleDOMessage = "{\"request\":{\"action\":\"" + action + "\",\"channel\":\"" + channelName + "\",\"milliseconds\":\"" + milliseconds + "\",\"invert\":" + (invert ? "true" : "false") + ",\"reset\":" + (reset ? "true" : "false") + "}}"; + if (!sendTcpMessage(ip, toggleDOMessage.c_str(), toggleDOMessage.length(), true)) { + return false; + } + char revBuf[256]; + size_t responseLength = sizeof(revBuf); + if (!receiveTcpMessage(ip, revBuf, responseLength)) { + return false; + } + revBuf[responseLength] = '\0'; + std::string response(revBuf); + std::string result; + std::string reason; + iobox_info_t info; + if (parseResponeCommon(response, action, result, reason, info)) { + std::cout << "Parse response success" << std::endl; + if (result == "success") { + std::cout << "Toggle digital output success" << std::endl; + } + else { + this->_logger.LogError("iobox_api::toggleDigitalOutput. Toggle digital output failed: ", reason, __FILE__, __LINE__); + return false; + } + } + else { + this->_logger.LogError("iobox_api::toggleDigitalOutput. ", "Parse response failed", __FILE__, __LINE__); + return false; + } + + return true; + } + catch (const std::exception& e) { + this->_logger.LogFatal("iobox_api::toggleDigitalOutput. Exception: ", e.what(), __FILE__, __LINE__); + return false; + } + } + bool iobox_api::setAIBValueDataStringIoboxFromChannelName(const std::string& remote, const std::string& channelName, const std::string& value) { + std::lock_guard lock(this->_mutex); + std::string ip = checkIpFromRemote(remote); + if (ip == "") { + this->_logger.LogError("iobox_api::setAIBValueDataStringIoboxFromChannelName. Failed to get ip from remote: ", remote, __FILE__, __LINE__); + return false; + } + try { + iobox_profile_t* profile = findProfileByIp(ip); + if (profile == nullptr) { + this->_logger.LogError("iobox_api::setAIBValueDataStringIoboxFromChannelName. IP address not found: ", ip, __FILE__, __LINE__); + return false; + } + + //not check valid channel name here + + //{"request": {"action":"setAIB", "channel":"","value":""}} + std::string action = "setAIB"; + std::string setValueMessage = "{\"request\":{\"action\":\"" + action + "\",\"channel\":\"" + channelName + "\",\"value\":\"" + value + "\"}}"; + if (!sendTcpMessage(ip, setValueMessage.c_str(), setValueMessage.length(), true)) { + return false; + } + char revBuf[256]; + size_t responseLength = sizeof(revBuf); + if (!receiveTcpMessage(ip, revBuf, responseLength)) { + return false; + } + revBuf[responseLength] = '\0'; + std::string response(revBuf); + std::string result; + std::string reason; + iobox_info_t info; + if (parseResponeCommon(response, action, result, reason, info)) { + std::cout << "Parse response success" << std::endl; + if (result == "success") { + std::cout << "Set value success" << std::endl; + } + else { + this->_logger.LogError("iobox_api::setAIBValueDataStringIoboxFromChannelName. Set value failed: ", reason, __FILE__, __LINE__); + return false; + } + } + else { + this->_logger.LogError("iobox_api::setAIBValueDataStringIoboxFromChannelName. ","Parse response failed", __FILE__, __LINE__); + return false; + } + + return true; + } + catch (const std::exception& e) { + this->_logger.LogFatal("iobox_api::setAIBValueDataStringIoboxFromChannelName. Exception: ", e.what(), __FILE__, __LINE__); + return false; + } + } + +} \ No newline at end of file diff --git a/IOBox/iobox_api.h b/IOBox/iobox_api.h new file mode 100644 index 0000000..e497c22 --- /dev/null +++ b/IOBox/iobox_api.h @@ -0,0 +1,215 @@ +#ifndef _IO_BOX_API_H_ +#define _IO_BOX_API_H_ +#define ANSIO_API __declspec(dllexport) +#include "LabVIEWHeader/extcode.h" +#include +#include +#include +#include +#include +#include +#include // For PIP_ADAPTER_INFO +#include +#include +#include +#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 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 macToIpMap; + // Define unordered_map to store IP address and device information (std:vector) + std::unordered_map> 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_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 scanNetworkDevicesManuallyOnNetworkAdapter(network_adapter_t adapter, int timeout); + std::vector 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 active{ true }; + std::atomic cancelled{ false }; + std::mutex mtx; + std::condition_variable cv; + + // Constructor for better initialization + ToggleInfo(bool revert = false) : revertFlag(revert) {} + }; + + std::unordered_map> activeToggles; + std::mutex toggleMapMutex; + + bool executeToggleOperation(const std::string& remote, const std::string& channelName, + std::shared_ptr 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 scanNetworkDevicesMulticast(int timeout); + [[nodiscard]] std::vector scanNetworkDevicesManually(int timeout); + [[nodiscard]] std::vector 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 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 advancedConnectToIobox(const std::string& remote, int port, const std::string& macAddress, const std::string& username, const std::string& password); + [[nodiscard]] std::vector 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 getActiveToggleChannels(); + bool getToggleStatus(const std::string& remote, const std::string& channelName,int& remainingTimeMs, std::string& currentPhase); + + // new functions + [[nodiscard]] std::vector 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 + + diff --git a/IOBox/main.cpp b/IOBox/main.cpp new file mode 100644 index 0000000..9f16cce --- /dev/null +++ b/IOBox/main.cpp @@ -0,0 +1,111 @@ + +#include "iobox_api.h" +#include + +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 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 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; +} diff --git a/IOBox/mbedtls/aes.c b/IOBox/mbedtls/aes.c new file mode 100644 index 0000000..0f86910 --- /dev/null +++ b/IOBox/mbedtls/aes.c @@ -0,0 +1,1490 @@ +/* + * FIPS-197 compliant AES 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 AES block cipher was designed by Vincent Rijmen and Joan Daemen. + * + * http://csrc.nist.gov/encryption/aes/rijndael/Rijndael.pdf + * http://csrc.nist.gov/publications/fips/fips197/fips-197.pdf + */ + + #if !defined(MBEDTLS_CONFIG_FILE) + #include "config.h" + #else + #include MBEDTLS_CONFIG_FILE + #endif + + #if defined(MBEDTLS_AES_C) + + #include + + #include "aes.h" + #if defined(MBEDTLS_PADLOCK_C) + #include "padlock.h" + #endif + #if defined(MBEDTLS_AESNI_C) + #include "aesni.h" + #endif + + #if defined(MBEDTLS_SELF_TEST) + #if defined(MBEDTLS_PLATFORM_C) + #include "platform.h" + #else + #include + #define mbedtls_printf printf + #endif /* MBEDTLS_PLATFORM_C */ + #endif /* MBEDTLS_SELF_TEST */ + + #if !defined(MBEDTLS_AES_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 (little endian) + */ + #ifndef GET_UINT32_LE + #define GET_UINT32_LE(n,b,i) \ + { \ + (n) = ( (uint32_t) (b)[(i) ] ) \ + | ( (uint32_t) (b)[(i) + 1] << 8 ) \ + | ( (uint32_t) (b)[(i) + 2] << 16 ) \ + | ( (uint32_t) (b)[(i) + 3] << 24 ); \ + } + #endif + + #ifndef PUT_UINT32_LE + #define PUT_UINT32_LE(n,b,i) \ + { \ + (b)[(i) ] = (unsigned char) ( ( (n) ) & 0xFF ); \ + (b)[(i) + 1] = (unsigned char) ( ( (n) >> 8 ) & 0xFF ); \ + (b)[(i) + 2] = (unsigned char) ( ( (n) >> 16 ) & 0xFF ); \ + (b)[(i) + 3] = (unsigned char) ( ( (n) >> 24 ) & 0xFF ); \ + } + #endif + + #if defined(MBEDTLS_PADLOCK_C) && \ + ( defined(MBEDTLS_HAVE_X86) || defined(MBEDTLS_PADLOCK_ALIGN16) ) + static int aes_padlock_ace = -1; + #endif + + #if defined(MBEDTLS_AES_ROM_TABLES) + /* + * Forward S-box + */ + static const unsigned char FSb[256] = + { + 0x63, 0x7C, 0x77, 0x7B, 0xF2, 0x6B, 0x6F, 0xC5, + 0x30, 0x01, 0x67, 0x2B, 0xFE, 0xD7, 0xAB, 0x76, + 0xCA, 0x82, 0xC9, 0x7D, 0xFA, 0x59, 0x47, 0xF0, + 0xAD, 0xD4, 0xA2, 0xAF, 0x9C, 0xA4, 0x72, 0xC0, + 0xB7, 0xFD, 0x93, 0x26, 0x36, 0x3F, 0xF7, 0xCC, + 0x34, 0xA5, 0xE5, 0xF1, 0x71, 0xD8, 0x31, 0x15, + 0x04, 0xC7, 0x23, 0xC3, 0x18, 0x96, 0x05, 0x9A, + 0x07, 0x12, 0x80, 0xE2, 0xEB, 0x27, 0xB2, 0x75, + 0x09, 0x83, 0x2C, 0x1A, 0x1B, 0x6E, 0x5A, 0xA0, + 0x52, 0x3B, 0xD6, 0xB3, 0x29, 0xE3, 0x2F, 0x84, + 0x53, 0xD1, 0x00, 0xED, 0x20, 0xFC, 0xB1, 0x5B, + 0x6A, 0xCB, 0xBE, 0x39, 0x4A, 0x4C, 0x58, 0xCF, + 0xD0, 0xEF, 0xAA, 0xFB, 0x43, 0x4D, 0x33, 0x85, + 0x45, 0xF9, 0x02, 0x7F, 0x50, 0x3C, 0x9F, 0xA8, + 0x51, 0xA3, 0x40, 0x8F, 0x92, 0x9D, 0x38, 0xF5, + 0xBC, 0xB6, 0xDA, 0x21, 0x10, 0xFF, 0xF3, 0xD2, + 0xCD, 0x0C, 0x13, 0xEC, 0x5F, 0x97, 0x44, 0x17, + 0xC4, 0xA7, 0x7E, 0x3D, 0x64, 0x5D, 0x19, 0x73, + 0x60, 0x81, 0x4F, 0xDC, 0x22, 0x2A, 0x90, 0x88, + 0x46, 0xEE, 0xB8, 0x14, 0xDE, 0x5E, 0x0B, 0xDB, + 0xE0, 0x32, 0x3A, 0x0A, 0x49, 0x06, 0x24, 0x5C, + 0xC2, 0xD3, 0xAC, 0x62, 0x91, 0x95, 0xE4, 0x79, + 0xE7, 0xC8, 0x37, 0x6D, 0x8D, 0xD5, 0x4E, 0xA9, + 0x6C, 0x56, 0xF4, 0xEA, 0x65, 0x7A, 0xAE, 0x08, + 0xBA, 0x78, 0x25, 0x2E, 0x1C, 0xA6, 0xB4, 0xC6, + 0xE8, 0xDD, 0x74, 0x1F, 0x4B, 0xBD, 0x8B, 0x8A, + 0x70, 0x3E, 0xB5, 0x66, 0x48, 0x03, 0xF6, 0x0E, + 0x61, 0x35, 0x57, 0xB9, 0x86, 0xC1, 0x1D, 0x9E, + 0xE1, 0xF8, 0x98, 0x11, 0x69, 0xD9, 0x8E, 0x94, + 0x9B, 0x1E, 0x87, 0xE9, 0xCE, 0x55, 0x28, 0xDF, + 0x8C, 0xA1, 0x89, 0x0D, 0xBF, 0xE6, 0x42, 0x68, + 0x41, 0x99, 0x2D, 0x0F, 0xB0, 0x54, 0xBB, 0x16 + }; + + /* + * Forward tables + */ + #define FT \ + \ + V(A5,63,63,C6), V(84,7C,7C,F8), V(99,77,77,EE), V(8D,7B,7B,F6), \ + V(0D,F2,F2,FF), V(BD,6B,6B,D6), V(B1,6F,6F,DE), V(54,C5,C5,91), \ + V(50,30,30,60), V(03,01,01,02), V(A9,67,67,CE), V(7D,2B,2B,56), \ + V(19,FE,FE,E7), V(62,D7,D7,B5), V(E6,AB,AB,4D), V(9A,76,76,EC), \ + V(45,CA,CA,8F), V(9D,82,82,1F), V(40,C9,C9,89), V(87,7D,7D,FA), \ + V(15,FA,FA,EF), V(EB,59,59,B2), V(C9,47,47,8E), V(0B,F0,F0,FB), \ + V(EC,AD,AD,41), V(67,D4,D4,B3), V(FD,A2,A2,5F), V(EA,AF,AF,45), \ + V(BF,9C,9C,23), V(F7,A4,A4,53), V(96,72,72,E4), V(5B,C0,C0,9B), \ + V(C2,B7,B7,75), V(1C,FD,FD,E1), V(AE,93,93,3D), V(6A,26,26,4C), \ + V(5A,36,36,6C), V(41,3F,3F,7E), V(02,F7,F7,F5), V(4F,CC,CC,83), \ + V(5C,34,34,68), V(F4,A5,A5,51), V(34,E5,E5,D1), V(08,F1,F1,F9), \ + V(93,71,71,E2), V(73,D8,D8,AB), V(53,31,31,62), V(3F,15,15,2A), \ + V(0C,04,04,08), V(52,C7,C7,95), V(65,23,23,46), V(5E,C3,C3,9D), \ + V(28,18,18,30), V(A1,96,96,37), V(0F,05,05,0A), V(B5,9A,9A,2F), \ + V(09,07,07,0E), V(36,12,12,24), V(9B,80,80,1B), V(3D,E2,E2,DF), \ + V(26,EB,EB,CD), V(69,27,27,4E), V(CD,B2,B2,7F), V(9F,75,75,EA), \ + V(1B,09,09,12), V(9E,83,83,1D), V(74,2C,2C,58), V(2E,1A,1A,34), \ + V(2D,1B,1B,36), V(B2,6E,6E,DC), V(EE,5A,5A,B4), V(FB,A0,A0,5B), \ + V(F6,52,52,A4), V(4D,3B,3B,76), V(61,D6,D6,B7), V(CE,B3,B3,7D), \ + V(7B,29,29,52), V(3E,E3,E3,DD), V(71,2F,2F,5E), V(97,84,84,13), \ + V(F5,53,53,A6), V(68,D1,D1,B9), V(00,00,00,00), V(2C,ED,ED,C1), \ + V(60,20,20,40), V(1F,FC,FC,E3), V(C8,B1,B1,79), V(ED,5B,5B,B6), \ + V(BE,6A,6A,D4), V(46,CB,CB,8D), V(D9,BE,BE,67), V(4B,39,39,72), \ + V(DE,4A,4A,94), V(D4,4C,4C,98), V(E8,58,58,B0), V(4A,CF,CF,85), \ + V(6B,D0,D0,BB), V(2A,EF,EF,C5), V(E5,AA,AA,4F), V(16,FB,FB,ED), \ + V(C5,43,43,86), V(D7,4D,4D,9A), V(55,33,33,66), V(94,85,85,11), \ + V(CF,45,45,8A), V(10,F9,F9,E9), V(06,02,02,04), V(81,7F,7F,FE), \ + V(F0,50,50,A0), V(44,3C,3C,78), V(BA,9F,9F,25), V(E3,A8,A8,4B), \ + V(F3,51,51,A2), V(FE,A3,A3,5D), V(C0,40,40,80), V(8A,8F,8F,05), \ + V(AD,92,92,3F), V(BC,9D,9D,21), V(48,38,38,70), V(04,F5,F5,F1), \ + V(DF,BC,BC,63), V(C1,B6,B6,77), V(75,DA,DA,AF), V(63,21,21,42), \ + V(30,10,10,20), V(1A,FF,FF,E5), V(0E,F3,F3,FD), V(6D,D2,D2,BF), \ + V(4C,CD,CD,81), V(14,0C,0C,18), V(35,13,13,26), V(2F,EC,EC,C3), \ + V(E1,5F,5F,BE), V(A2,97,97,35), V(CC,44,44,88), V(39,17,17,2E), \ + V(57,C4,C4,93), V(F2,A7,A7,55), V(82,7E,7E,FC), V(47,3D,3D,7A), \ + V(AC,64,64,C8), V(E7,5D,5D,BA), V(2B,19,19,32), V(95,73,73,E6), \ + V(A0,60,60,C0), V(98,81,81,19), V(D1,4F,4F,9E), V(7F,DC,DC,A3), \ + V(66,22,22,44), V(7E,2A,2A,54), V(AB,90,90,3B), V(83,88,88,0B), \ + V(CA,46,46,8C), V(29,EE,EE,C7), V(D3,B8,B8,6B), V(3C,14,14,28), \ + V(79,DE,DE,A7), V(E2,5E,5E,BC), V(1D,0B,0B,16), V(76,DB,DB,AD), \ + V(3B,E0,E0,DB), V(56,32,32,64), V(4E,3A,3A,74), V(1E,0A,0A,14), \ + V(DB,49,49,92), V(0A,06,06,0C), V(6C,24,24,48), V(E4,5C,5C,B8), \ + V(5D,C2,C2,9F), V(6E,D3,D3,BD), V(EF,AC,AC,43), V(A6,62,62,C4), \ + V(A8,91,91,39), V(A4,95,95,31), V(37,E4,E4,D3), V(8B,79,79,F2), \ + V(32,E7,E7,D5), V(43,C8,C8,8B), V(59,37,37,6E), V(B7,6D,6D,DA), \ + V(8C,8D,8D,01), V(64,D5,D5,B1), V(D2,4E,4E,9C), V(E0,A9,A9,49), \ + V(B4,6C,6C,D8), V(FA,56,56,AC), V(07,F4,F4,F3), V(25,EA,EA,CF), \ + V(AF,65,65,CA), V(8E,7A,7A,F4), V(E9,AE,AE,47), V(18,08,08,10), \ + V(D5,BA,BA,6F), V(88,78,78,F0), V(6F,25,25,4A), V(72,2E,2E,5C), \ + V(24,1C,1C,38), V(F1,A6,A6,57), V(C7,B4,B4,73), V(51,C6,C6,97), \ + V(23,E8,E8,CB), V(7C,DD,DD,A1), V(9C,74,74,E8), V(21,1F,1F,3E), \ + V(DD,4B,4B,96), V(DC,BD,BD,61), V(86,8B,8B,0D), V(85,8A,8A,0F), \ + V(90,70,70,E0), V(42,3E,3E,7C), V(C4,B5,B5,71), V(AA,66,66,CC), \ + V(D8,48,48,90), V(05,03,03,06), V(01,F6,F6,F7), V(12,0E,0E,1C), \ + V(A3,61,61,C2), V(5F,35,35,6A), V(F9,57,57,AE), V(D0,B9,B9,69), \ + V(91,86,86,17), V(58,C1,C1,99), V(27,1D,1D,3A), V(B9,9E,9E,27), \ + V(38,E1,E1,D9), V(13,F8,F8,EB), V(B3,98,98,2B), V(33,11,11,22), \ + V(BB,69,69,D2), V(70,D9,D9,A9), V(89,8E,8E,07), V(A7,94,94,33), \ + V(B6,9B,9B,2D), V(22,1E,1E,3C), V(92,87,87,15), V(20,E9,E9,C9), \ + V(49,CE,CE,87), V(FF,55,55,AA), V(78,28,28,50), V(7A,DF,DF,A5), \ + V(8F,8C,8C,03), V(F8,A1,A1,59), V(80,89,89,09), V(17,0D,0D,1A), \ + V(DA,BF,BF,65), V(31,E6,E6,D7), V(C6,42,42,84), V(B8,68,68,D0), \ + V(C3,41,41,82), V(B0,99,99,29), V(77,2D,2D,5A), V(11,0F,0F,1E), \ + V(CB,B0,B0,7B), V(FC,54,54,A8), V(D6,BB,BB,6D), V(3A,16,16,2C) + + #define V(a,b,c,d) 0x##a##b##c##d + static const uint32_t FT0[256] = { FT }; + #undef V + + #define V(a,b,c,d) 0x##b##c##d##a + static const uint32_t FT1[256] = { FT }; + #undef V + + #define V(a,b,c,d) 0x##c##d##a##b + static const uint32_t FT2[256] = { FT }; + #undef V + + #define V(a,b,c,d) 0x##d##a##b##c + static const uint32_t FT3[256] = { FT }; + #undef V + + #undef FT + + /* + * Reverse S-box + */ + static const unsigned char RSb[256] = + { + 0x52, 0x09, 0x6A, 0xD5, 0x30, 0x36, 0xA5, 0x38, + 0xBF, 0x40, 0xA3, 0x9E, 0x81, 0xF3, 0xD7, 0xFB, + 0x7C, 0xE3, 0x39, 0x82, 0x9B, 0x2F, 0xFF, 0x87, + 0x34, 0x8E, 0x43, 0x44, 0xC4, 0xDE, 0xE9, 0xCB, + 0x54, 0x7B, 0x94, 0x32, 0xA6, 0xC2, 0x23, 0x3D, + 0xEE, 0x4C, 0x95, 0x0B, 0x42, 0xFA, 0xC3, 0x4E, + 0x08, 0x2E, 0xA1, 0x66, 0x28, 0xD9, 0x24, 0xB2, + 0x76, 0x5B, 0xA2, 0x49, 0x6D, 0x8B, 0xD1, 0x25, + 0x72, 0xF8, 0xF6, 0x64, 0x86, 0x68, 0x98, 0x16, + 0xD4, 0xA4, 0x5C, 0xCC, 0x5D, 0x65, 0xB6, 0x92, + 0x6C, 0x70, 0x48, 0x50, 0xFD, 0xED, 0xB9, 0xDA, + 0x5E, 0x15, 0x46, 0x57, 0xA7, 0x8D, 0x9D, 0x84, + 0x90, 0xD8, 0xAB, 0x00, 0x8C, 0xBC, 0xD3, 0x0A, + 0xF7, 0xE4, 0x58, 0x05, 0xB8, 0xB3, 0x45, 0x06, + 0xD0, 0x2C, 0x1E, 0x8F, 0xCA, 0x3F, 0x0F, 0x02, + 0xC1, 0xAF, 0xBD, 0x03, 0x01, 0x13, 0x8A, 0x6B, + 0x3A, 0x91, 0x11, 0x41, 0x4F, 0x67, 0xDC, 0xEA, + 0x97, 0xF2, 0xCF, 0xCE, 0xF0, 0xB4, 0xE6, 0x73, + 0x96, 0xAC, 0x74, 0x22, 0xE7, 0xAD, 0x35, 0x85, + 0xE2, 0xF9, 0x37, 0xE8, 0x1C, 0x75, 0xDF, 0x6E, + 0x47, 0xF1, 0x1A, 0x71, 0x1D, 0x29, 0xC5, 0x89, + 0x6F, 0xB7, 0x62, 0x0E, 0xAA, 0x18, 0xBE, 0x1B, + 0xFC, 0x56, 0x3E, 0x4B, 0xC6, 0xD2, 0x79, 0x20, + 0x9A, 0xDB, 0xC0, 0xFE, 0x78, 0xCD, 0x5A, 0xF4, + 0x1F, 0xDD, 0xA8, 0x33, 0x88, 0x07, 0xC7, 0x31, + 0xB1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xEC, 0x5F, + 0x60, 0x51, 0x7F, 0xA9, 0x19, 0xB5, 0x4A, 0x0D, + 0x2D, 0xE5, 0x7A, 0x9F, 0x93, 0xC9, 0x9C, 0xEF, + 0xA0, 0xE0, 0x3B, 0x4D, 0xAE, 0x2A, 0xF5, 0xB0, + 0xC8, 0xEB, 0xBB, 0x3C, 0x83, 0x53, 0x99, 0x61, + 0x17, 0x2B, 0x04, 0x7E, 0xBA, 0x77, 0xD6, 0x26, + 0xE1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0C, 0x7D + }; + + /* + * Reverse tables + */ + #define RT \ + \ + V(50,A7,F4,51), V(53,65,41,7E), V(C3,A4,17,1A), V(96,5E,27,3A), \ + V(CB,6B,AB,3B), V(F1,45,9D,1F), V(AB,58,FA,AC), V(93,03,E3,4B), \ + V(55,FA,30,20), V(F6,6D,76,AD), V(91,76,CC,88), V(25,4C,02,F5), \ + V(FC,D7,E5,4F), V(D7,CB,2A,C5), V(80,44,35,26), V(8F,A3,62,B5), \ + V(49,5A,B1,DE), V(67,1B,BA,25), V(98,0E,EA,45), V(E1,C0,FE,5D), \ + V(02,75,2F,C3), V(12,F0,4C,81), V(A3,97,46,8D), V(C6,F9,D3,6B), \ + V(E7,5F,8F,03), V(95,9C,92,15), V(EB,7A,6D,BF), V(DA,59,52,95), \ + V(2D,83,BE,D4), V(D3,21,74,58), V(29,69,E0,49), V(44,C8,C9,8E), \ + V(6A,89,C2,75), V(78,79,8E,F4), V(6B,3E,58,99), V(DD,71,B9,27), \ + V(B6,4F,E1,BE), V(17,AD,88,F0), V(66,AC,20,C9), V(B4,3A,CE,7D), \ + V(18,4A,DF,63), V(82,31,1A,E5), V(60,33,51,97), V(45,7F,53,62), \ + V(E0,77,64,B1), V(84,AE,6B,BB), V(1C,A0,81,FE), V(94,2B,08,F9), \ + V(58,68,48,70), V(19,FD,45,8F), V(87,6C,DE,94), V(B7,F8,7B,52), \ + V(23,D3,73,AB), V(E2,02,4B,72), V(57,8F,1F,E3), V(2A,AB,55,66), \ + V(07,28,EB,B2), V(03,C2,B5,2F), V(9A,7B,C5,86), V(A5,08,37,D3), \ + V(F2,87,28,30), V(B2,A5,BF,23), V(BA,6A,03,02), V(5C,82,16,ED), \ + V(2B,1C,CF,8A), V(92,B4,79,A7), V(F0,F2,07,F3), V(A1,E2,69,4E), \ + V(CD,F4,DA,65), V(D5,BE,05,06), V(1F,62,34,D1), V(8A,FE,A6,C4), \ + V(9D,53,2E,34), V(A0,55,F3,A2), V(32,E1,8A,05), V(75,EB,F6,A4), \ + V(39,EC,83,0B), V(AA,EF,60,40), V(06,9F,71,5E), V(51,10,6E,BD), \ + V(F9,8A,21,3E), V(3D,06,DD,96), V(AE,05,3E,DD), V(46,BD,E6,4D), \ + V(B5,8D,54,91), V(05,5D,C4,71), V(6F,D4,06,04), V(FF,15,50,60), \ + V(24,FB,98,19), V(97,E9,BD,D6), V(CC,43,40,89), V(77,9E,D9,67), \ + V(BD,42,E8,B0), V(88,8B,89,07), V(38,5B,19,E7), V(DB,EE,C8,79), \ + V(47,0A,7C,A1), V(E9,0F,42,7C), V(C9,1E,84,F8), V(00,00,00,00), \ + V(83,86,80,09), V(48,ED,2B,32), V(AC,70,11,1E), V(4E,72,5A,6C), \ + V(FB,FF,0E,FD), V(56,38,85,0F), V(1E,D5,AE,3D), V(27,39,2D,36), \ + V(64,D9,0F,0A), V(21,A6,5C,68), V(D1,54,5B,9B), V(3A,2E,36,24), \ + V(B1,67,0A,0C), V(0F,E7,57,93), V(D2,96,EE,B4), V(9E,91,9B,1B), \ + V(4F,C5,C0,80), V(A2,20,DC,61), V(69,4B,77,5A), V(16,1A,12,1C), \ + V(0A,BA,93,E2), V(E5,2A,A0,C0), V(43,E0,22,3C), V(1D,17,1B,12), \ + V(0B,0D,09,0E), V(AD,C7,8B,F2), V(B9,A8,B6,2D), V(C8,A9,1E,14), \ + V(85,19,F1,57), V(4C,07,75,AF), V(BB,DD,99,EE), V(FD,60,7F,A3), \ + V(9F,26,01,F7), V(BC,F5,72,5C), V(C5,3B,66,44), V(34,7E,FB,5B), \ + V(76,29,43,8B), V(DC,C6,23,CB), V(68,FC,ED,B6), V(63,F1,E4,B8), \ + V(CA,DC,31,D7), V(10,85,63,42), V(40,22,97,13), V(20,11,C6,84), \ + V(7D,24,4A,85), V(F8,3D,BB,D2), V(11,32,F9,AE), V(6D,A1,29,C7), \ + V(4B,2F,9E,1D), V(F3,30,B2,DC), V(EC,52,86,0D), V(D0,E3,C1,77), \ + V(6C,16,B3,2B), V(99,B9,70,A9), V(FA,48,94,11), V(22,64,E9,47), \ + V(C4,8C,FC,A8), V(1A,3F,F0,A0), V(D8,2C,7D,56), V(EF,90,33,22), \ + V(C7,4E,49,87), V(C1,D1,38,D9), V(FE,A2,CA,8C), V(36,0B,D4,98), \ + V(CF,81,F5,A6), V(28,DE,7A,A5), V(26,8E,B7,DA), V(A4,BF,AD,3F), \ + V(E4,9D,3A,2C), V(0D,92,78,50), V(9B,CC,5F,6A), V(62,46,7E,54), \ + V(C2,13,8D,F6), V(E8,B8,D8,90), V(5E,F7,39,2E), V(F5,AF,C3,82), \ + V(BE,80,5D,9F), V(7C,93,D0,69), V(A9,2D,D5,6F), V(B3,12,25,CF), \ + V(3B,99,AC,C8), V(A7,7D,18,10), V(6E,63,9C,E8), V(7B,BB,3B,DB), \ + V(09,78,26,CD), V(F4,18,59,6E), V(01,B7,9A,EC), V(A8,9A,4F,83), \ + V(65,6E,95,E6), V(7E,E6,FF,AA), V(08,CF,BC,21), V(E6,E8,15,EF), \ + V(D9,9B,E7,BA), V(CE,36,6F,4A), V(D4,09,9F,EA), V(D6,7C,B0,29), \ + V(AF,B2,A4,31), V(31,23,3F,2A), V(30,94,A5,C6), V(C0,66,A2,35), \ + V(37,BC,4E,74), V(A6,CA,82,FC), V(B0,D0,90,E0), V(15,D8,A7,33), \ + V(4A,98,04,F1), V(F7,DA,EC,41), V(0E,50,CD,7F), V(2F,F6,91,17), \ + V(8D,D6,4D,76), V(4D,B0,EF,43), V(54,4D,AA,CC), V(DF,04,96,E4), \ + V(E3,B5,D1,9E), V(1B,88,6A,4C), V(B8,1F,2C,C1), V(7F,51,65,46), \ + V(04,EA,5E,9D), V(5D,35,8C,01), V(73,74,87,FA), V(2E,41,0B,FB), \ + V(5A,1D,67,B3), V(52,D2,DB,92), V(33,56,10,E9), V(13,47,D6,6D), \ + V(8C,61,D7,9A), V(7A,0C,A1,37), V(8E,14,F8,59), V(89,3C,13,EB), \ + V(EE,27,A9,CE), V(35,C9,61,B7), V(ED,E5,1C,E1), V(3C,B1,47,7A), \ + V(59,DF,D2,9C), V(3F,73,F2,55), V(79,CE,14,18), V(BF,37,C7,73), \ + V(EA,CD,F7,53), V(5B,AA,FD,5F), V(14,6F,3D,DF), V(86,DB,44,78), \ + V(81,F3,AF,CA), V(3E,C4,68,B9), V(2C,34,24,38), V(5F,40,A3,C2), \ + V(72,C3,1D,16), V(0C,25,E2,BC), V(8B,49,3C,28), V(41,95,0D,FF), \ + V(71,01,A8,39), V(DE,B3,0C,08), V(9C,E4,B4,D8), V(90,C1,56,64), \ + V(61,84,CB,7B), V(70,B6,32,D5), V(74,5C,6C,48), V(42,57,B8,D0) + + #define V(a,b,c,d) 0x##a##b##c##d + static const uint32_t RT0[256] = { RT }; + #undef V + + #define V(a,b,c,d) 0x##b##c##d##a + static const uint32_t RT1[256] = { RT }; + #undef V + + #define V(a,b,c,d) 0x##c##d##a##b + static const uint32_t RT2[256] = { RT }; + #undef V + + #define V(a,b,c,d) 0x##d##a##b##c + static const uint32_t RT3[256] = { RT }; + #undef V + + #undef RT + + /* + * Round constants + */ + static const uint32_t RCON[10] = + { + 0x00000001, 0x00000002, 0x00000004, 0x00000008, + 0x00000010, 0x00000020, 0x00000040, 0x00000080, + 0x0000001B, 0x00000036 + }; + + #else /* MBEDTLS_AES_ROM_TABLES */ + + /* + * Forward S-box & tables + */ + static unsigned char FSb[256]; + static uint32_t FT0[256]; + static uint32_t FT1[256]; + static uint32_t FT2[256]; + static uint32_t FT3[256]; + + /* + * Reverse S-box & tables + */ + static unsigned char RSb[256]; + static uint32_t RT0[256]; + static uint32_t RT1[256]; + static uint32_t RT2[256]; + static uint32_t RT3[256]; + + /* + * Round constants + */ + static uint32_t RCON[10]; + + /* + * Tables generation code + */ + #define ROTL8(x) ( ( x << 8 ) & 0xFFFFFFFF ) | ( x >> 24 ) + #define XTIME(x) ( ( x << 1 ) ^ ( ( x & 0x80 ) ? 0x1B : 0x00 ) ) + #define MUL(x,y) ( ( x && y ) ? pow[(log[x]+log[y]) % 255] : 0 ) + + static int aes_init_done = 0; + + static void aes_gen_tables( void ) + { + int i, x, y, z; + int pow[256]; + int log[256]; + + /* + * compute pow and log tables over GF(2^8) + */ + for( i = 0, x = 1; i < 256; i++ ) + { + pow[i] = x; + log[x] = i; + x = ( x ^ XTIME( x ) ) & 0xFF; + } + + /* + * calculate the round constants + */ + for( i = 0, x = 1; i < 10; i++ ) + { + RCON[i] = (uint32_t) x; + x = XTIME( x ) & 0xFF; + } + + /* + * generate the forward and reverse S-boxes + */ + FSb[0x00] = 0x63; + RSb[0x63] = 0x00; + + for( i = 1; i < 256; i++ ) + { + x = pow[255 - log[i]]; + + y = x; y = ( ( y << 1 ) | ( y >> 7 ) ) & 0xFF; + x ^= y; y = ( ( y << 1 ) | ( y >> 7 ) ) & 0xFF; + x ^= y; y = ( ( y << 1 ) | ( y >> 7 ) ) & 0xFF; + x ^= y; y = ( ( y << 1 ) | ( y >> 7 ) ) & 0xFF; + x ^= y ^ 0x63; + + FSb[i] = (unsigned char) x; + RSb[x] = (unsigned char) i; + } + + /* + * generate the forward and reverse tables + */ + for( i = 0; i < 256; i++ ) + { + x = FSb[i]; + y = XTIME( x ) & 0xFF; + z = ( y ^ x ) & 0xFF; + + FT0[i] = ( (uint32_t) y ) ^ + ( (uint32_t) x << 8 ) ^ + ( (uint32_t) x << 16 ) ^ + ( (uint32_t) z << 24 ); + + FT1[i] = ROTL8( FT0[i] ); + FT2[i] = ROTL8( FT1[i] ); + FT3[i] = ROTL8( FT2[i] ); + + x = RSb[i]; + + RT0[i] = ( (uint32_t) MUL( 0x0E, x ) ) ^ + ( (uint32_t) MUL( 0x09, x ) << 8 ) ^ + ( (uint32_t) MUL( 0x0D, x ) << 16 ) ^ + ( (uint32_t) MUL( 0x0B, x ) << 24 ); + + RT1[i] = ROTL8( RT0[i] ); + RT2[i] = ROTL8( RT1[i] ); + RT3[i] = ROTL8( RT2[i] ); + } + } + + #endif /* MBEDTLS_AES_ROM_TABLES */ + + void mbedtls_aes_init( mbedtls_aes_context *ctx ) + { + memset( ctx, 0, sizeof( mbedtls_aes_context ) ); + } + + void mbedtls_aes_free( mbedtls_aes_context *ctx ) + { + if( ctx == NULL ) + return; + + mbedtls_zeroize( ctx, sizeof( mbedtls_aes_context ) ); + } + + /* + * AES key schedule (encryption) + */ + #if !defined(MBEDTLS_AES_SETKEY_ENC_ALT) + int mbedtls_aes_setkey_enc( mbedtls_aes_context *ctx, const unsigned char *key, + unsigned int keybits ) + { + unsigned int i; + uint32_t *RK; + + #if !defined(MBEDTLS_AES_ROM_TABLES) + if( aes_init_done == 0 ) + { + aes_gen_tables(); + aes_init_done = 1; + + } + #endif + + switch( keybits ) + { + case 128: ctx->nr = 10; break; + case 192: ctx->nr = 12; break; + case 256: ctx->nr = 14; break; + default : return( MBEDTLS_ERR_AES_INVALID_KEY_LENGTH ); + } + + #if defined(MBEDTLS_PADLOCK_C) && defined(MBEDTLS_PADLOCK_ALIGN16) + if( aes_padlock_ace == -1 ) + aes_padlock_ace = mbedtls_padlock_has_support( MBEDTLS_PADLOCK_ACE ); + + if( aes_padlock_ace ) + ctx->rk = RK = MBEDTLS_PADLOCK_ALIGN16( ctx->buf ); + else + #endif + ctx->rk = RK = ctx->buf; + + #if defined(MBEDTLS_AESNI_C) && defined(MBEDTLS_HAVE_X86_64) + if( mbedtls_aesni_has_support( MBEDTLS_AESNI_AES ) ) + return( mbedtls_aesni_setkey_enc( (unsigned char *) ctx->rk, key, keybits ) ); + #endif + + for( i = 0; i < ( keybits >> 5 ); i++ ) + { + GET_UINT32_LE( RK[i], key, i << 2 ); + } + + switch( ctx->nr ) + { + case 10: + + for( i = 0; i < 10; i++, RK += 4 ) + { + RK[4] = RK[0] ^ RCON[i] ^ + ( (uint32_t) FSb[ ( RK[3] >> 8 ) & 0xFF ] ) ^ + ( (uint32_t) FSb[ ( RK[3] >> 16 ) & 0xFF ] << 8 ) ^ + ( (uint32_t) FSb[ ( RK[3] >> 24 ) & 0xFF ] << 16 ) ^ + ( (uint32_t) FSb[ ( RK[3] ) & 0xFF ] << 24 ); + + RK[5] = RK[1] ^ RK[4]; + RK[6] = RK[2] ^ RK[5]; + RK[7] = RK[3] ^ RK[6]; + } + break; + + case 12: + + for( i = 0; i < 8; i++, RK += 6 ) + { + RK[6] = RK[0] ^ RCON[i] ^ + ( (uint32_t) FSb[ ( RK[5] >> 8 ) & 0xFF ] ) ^ + ( (uint32_t) FSb[ ( RK[5] >> 16 ) & 0xFF ] << 8 ) ^ + ( (uint32_t) FSb[ ( RK[5] >> 24 ) & 0xFF ] << 16 ) ^ + ( (uint32_t) FSb[ ( RK[5] ) & 0xFF ] << 24 ); + + RK[7] = RK[1] ^ RK[6]; + RK[8] = RK[2] ^ RK[7]; + RK[9] = RK[3] ^ RK[8]; + RK[10] = RK[4] ^ RK[9]; + RK[11] = RK[5] ^ RK[10]; + } + break; + + case 14: + + for( i = 0; i < 7; i++, RK += 8 ) + { + RK[8] = RK[0] ^ RCON[i] ^ + ( (uint32_t) FSb[ ( RK[7] >> 8 ) & 0xFF ] ) ^ + ( (uint32_t) FSb[ ( RK[7] >> 16 ) & 0xFF ] << 8 ) ^ + ( (uint32_t) FSb[ ( RK[7] >> 24 ) & 0xFF ] << 16 ) ^ + ( (uint32_t) FSb[ ( RK[7] ) & 0xFF ] << 24 ); + + RK[9] = RK[1] ^ RK[8]; + RK[10] = RK[2] ^ RK[9]; + RK[11] = RK[3] ^ RK[10]; + + RK[12] = RK[4] ^ + ( (uint32_t) FSb[ ( RK[11] ) & 0xFF ] ) ^ + ( (uint32_t) FSb[ ( RK[11] >> 8 ) & 0xFF ] << 8 ) ^ + ( (uint32_t) FSb[ ( RK[11] >> 16 ) & 0xFF ] << 16 ) ^ + ( (uint32_t) FSb[ ( RK[11] >> 24 ) & 0xFF ] << 24 ); + + RK[13] = RK[5] ^ RK[12]; + RK[14] = RK[6] ^ RK[13]; + RK[15] = RK[7] ^ RK[14]; + } + break; + } + + return( 0 ); + } + #endif /* !MBEDTLS_AES_SETKEY_ENC_ALT */ + + /* + * AES key schedule (decryption) + */ + #if !defined(MBEDTLS_AES_SETKEY_DEC_ALT) + int mbedtls_aes_setkey_dec( mbedtls_aes_context *ctx, const unsigned char *key, + unsigned int keybits ) + { + int i, j, ret; + mbedtls_aes_context cty; + uint32_t *RK; + uint32_t *SK; + + mbedtls_aes_init( &cty ); + + #if defined(MBEDTLS_PADLOCK_C) && defined(MBEDTLS_PADLOCK_ALIGN16) + if( aes_padlock_ace == -1 ) + aes_padlock_ace = mbedtls_padlock_has_support( MBEDTLS_PADLOCK_ACE ); + + if( aes_padlock_ace ) + ctx->rk = RK = MBEDTLS_PADLOCK_ALIGN16( ctx->buf ); + else + #endif + ctx->rk = RK = ctx->buf; + + /* Also checks keybits */ + if( ( ret = mbedtls_aes_setkey_enc( &cty, key, keybits ) ) != 0 ) + goto exit; + + ctx->nr = cty.nr; + + #if defined(MBEDTLS_AESNI_C) && defined(MBEDTLS_HAVE_X86_64) + if( mbedtls_aesni_has_support( MBEDTLS_AESNI_AES ) ) + { + mbedtls_aesni_inverse_key( (unsigned char *) ctx->rk, + (const unsigned char *) cty.rk, ctx->nr ); + goto exit; + } + #endif + + SK = cty.rk + cty.nr * 4; + + *RK++ = *SK++; + *RK++ = *SK++; + *RK++ = *SK++; + *RK++ = *SK++; + + for( i = ctx->nr - 1, SK -= 8; i > 0; i--, SK -= 8 ) + { + for( j = 0; j < 4; j++, SK++ ) + { + *RK++ = RT0[ FSb[ ( *SK ) & 0xFF ] ] ^ + RT1[ FSb[ ( *SK >> 8 ) & 0xFF ] ] ^ + RT2[ FSb[ ( *SK >> 16 ) & 0xFF ] ] ^ + RT3[ FSb[ ( *SK >> 24 ) & 0xFF ] ]; + } + } + + *RK++ = *SK++; + *RK++ = *SK++; + *RK++ = *SK++; + *RK++ = *SK++; + + exit: + mbedtls_aes_free( &cty ); + + return( ret ); + } + #endif /* !MBEDTLS_AES_SETKEY_DEC_ALT */ + + #define AES_FROUND(X0,X1,X2,X3,Y0,Y1,Y2,Y3) \ + { \ + X0 = *RK++ ^ FT0[ ( Y0 ) & 0xFF ] ^ \ + FT1[ ( Y1 >> 8 ) & 0xFF ] ^ \ + FT2[ ( Y2 >> 16 ) & 0xFF ] ^ \ + FT3[ ( Y3 >> 24 ) & 0xFF ]; \ + \ + X1 = *RK++ ^ FT0[ ( Y1 ) & 0xFF ] ^ \ + FT1[ ( Y2 >> 8 ) & 0xFF ] ^ \ + FT2[ ( Y3 >> 16 ) & 0xFF ] ^ \ + FT3[ ( Y0 >> 24 ) & 0xFF ]; \ + \ + X2 = *RK++ ^ FT0[ ( Y2 ) & 0xFF ] ^ \ + FT1[ ( Y3 >> 8 ) & 0xFF ] ^ \ + FT2[ ( Y0 >> 16 ) & 0xFF ] ^ \ + FT3[ ( Y1 >> 24 ) & 0xFF ]; \ + \ + X3 = *RK++ ^ FT0[ ( Y3 ) & 0xFF ] ^ \ + FT1[ ( Y0 >> 8 ) & 0xFF ] ^ \ + FT2[ ( Y1 >> 16 ) & 0xFF ] ^ \ + FT3[ ( Y2 >> 24 ) & 0xFF ]; \ + } + + #define AES_RROUND(X0,X1,X2,X3,Y0,Y1,Y2,Y3) \ + { \ + X0 = *RK++ ^ RT0[ ( Y0 ) & 0xFF ] ^ \ + RT1[ ( Y3 >> 8 ) & 0xFF ] ^ \ + RT2[ ( Y2 >> 16 ) & 0xFF ] ^ \ + RT3[ ( Y1 >> 24 ) & 0xFF ]; \ + \ + X1 = *RK++ ^ RT0[ ( Y1 ) & 0xFF ] ^ \ + RT1[ ( Y0 >> 8 ) & 0xFF ] ^ \ + RT2[ ( Y3 >> 16 ) & 0xFF ] ^ \ + RT3[ ( Y2 >> 24 ) & 0xFF ]; \ + \ + X2 = *RK++ ^ RT0[ ( Y2 ) & 0xFF ] ^ \ + RT1[ ( Y1 >> 8 ) & 0xFF ] ^ \ + RT2[ ( Y0 >> 16 ) & 0xFF ] ^ \ + RT3[ ( Y3 >> 24 ) & 0xFF ]; \ + \ + X3 = *RK++ ^ RT0[ ( Y3 ) & 0xFF ] ^ \ + RT1[ ( Y2 >> 8 ) & 0xFF ] ^ \ + RT2[ ( Y1 >> 16 ) & 0xFF ] ^ \ + RT3[ ( Y0 >> 24 ) & 0xFF ]; \ + } + + /* + * AES-ECB block encryption + */ + #if !defined(MBEDTLS_AES_ENCRYPT_ALT) + void mbedtls_aes_encrypt( mbedtls_aes_context *ctx, + const unsigned char input[16], + unsigned char output[16] ) + { + int i; + uint32_t *RK, X0, X1, X2, X3, Y0, Y1, Y2, Y3; + + RK = ctx->rk; + + GET_UINT32_LE( X0, input, 0 ); X0 ^= *RK++; + GET_UINT32_LE( X1, input, 4 ); X1 ^= *RK++; + GET_UINT32_LE( X2, input, 8 ); X2 ^= *RK++; + GET_UINT32_LE( X3, input, 12 ); X3 ^= *RK++; + + for( i = ( ctx->nr >> 1 ) - 1; i > 0; i-- ) + { + AES_FROUND( Y0, Y1, Y2, Y3, X0, X1, X2, X3 ); + AES_FROUND( X0, X1, X2, X3, Y0, Y1, Y2, Y3 ); + } + + AES_FROUND( Y0, Y1, Y2, Y3, X0, X1, X2, X3 ); + + X0 = *RK++ ^ \ + ( (uint32_t) FSb[ ( Y0 ) & 0xFF ] ) ^ + ( (uint32_t) FSb[ ( Y1 >> 8 ) & 0xFF ] << 8 ) ^ + ( (uint32_t) FSb[ ( Y2 >> 16 ) & 0xFF ] << 16 ) ^ + ( (uint32_t) FSb[ ( Y3 >> 24 ) & 0xFF ] << 24 ); + + X1 = *RK++ ^ \ + ( (uint32_t) FSb[ ( Y1 ) & 0xFF ] ) ^ + ( (uint32_t) FSb[ ( Y2 >> 8 ) & 0xFF ] << 8 ) ^ + ( (uint32_t) FSb[ ( Y3 >> 16 ) & 0xFF ] << 16 ) ^ + ( (uint32_t) FSb[ ( Y0 >> 24 ) & 0xFF ] << 24 ); + + X2 = *RK++ ^ \ + ( (uint32_t) FSb[ ( Y2 ) & 0xFF ] ) ^ + ( (uint32_t) FSb[ ( Y3 >> 8 ) & 0xFF ] << 8 ) ^ + ( (uint32_t) FSb[ ( Y0 >> 16 ) & 0xFF ] << 16 ) ^ + ( (uint32_t) FSb[ ( Y1 >> 24 ) & 0xFF ] << 24 ); + + X3 = *RK++ ^ \ + ( (uint32_t) FSb[ ( Y3 ) & 0xFF ] ) ^ + ( (uint32_t) FSb[ ( Y0 >> 8 ) & 0xFF ] << 8 ) ^ + ( (uint32_t) FSb[ ( Y1 >> 16 ) & 0xFF ] << 16 ) ^ + ( (uint32_t) FSb[ ( Y2 >> 24 ) & 0xFF ] << 24 ); + + PUT_UINT32_LE( X0, output, 0 ); + PUT_UINT32_LE( X1, output, 4 ); + PUT_UINT32_LE( X2, output, 8 ); + PUT_UINT32_LE( X3, output, 12 ); + } + #endif /* !MBEDTLS_AES_ENCRYPT_ALT */ + + /* + * AES-ECB block decryption + */ + #if !defined(MBEDTLS_AES_DECRYPT_ALT) + void mbedtls_aes_decrypt( mbedtls_aes_context *ctx, + const unsigned char input[16], + unsigned char output[16] ) + { + int i; + uint32_t *RK, X0, X1, X2, X3, Y0, Y1, Y2, Y3; + + RK = ctx->rk; + + GET_UINT32_LE( X0, input, 0 ); X0 ^= *RK++; + GET_UINT32_LE( X1, input, 4 ); X1 ^= *RK++; + GET_UINT32_LE( X2, input, 8 ); X2 ^= *RK++; + GET_UINT32_LE( X3, input, 12 ); X3 ^= *RK++; + + for( i = ( ctx->nr >> 1 ) - 1; i > 0; i-- ) + { + AES_RROUND( Y0, Y1, Y2, Y3, X0, X1, X2, X3 ); + AES_RROUND( X0, X1, X2, X3, Y0, Y1, Y2, Y3 ); + } + + AES_RROUND( Y0, Y1, Y2, Y3, X0, X1, X2, X3 ); + + X0 = *RK++ ^ \ + ( (uint32_t) RSb[ ( Y0 ) & 0xFF ] ) ^ + ( (uint32_t) RSb[ ( Y3 >> 8 ) & 0xFF ] << 8 ) ^ + ( (uint32_t) RSb[ ( Y2 >> 16 ) & 0xFF ] << 16 ) ^ + ( (uint32_t) RSb[ ( Y1 >> 24 ) & 0xFF ] << 24 ); + + X1 = *RK++ ^ \ + ( (uint32_t) RSb[ ( Y1 ) & 0xFF ] ) ^ + ( (uint32_t) RSb[ ( Y0 >> 8 ) & 0xFF ] << 8 ) ^ + ( (uint32_t) RSb[ ( Y3 >> 16 ) & 0xFF ] << 16 ) ^ + ( (uint32_t) RSb[ ( Y2 >> 24 ) & 0xFF ] << 24 ); + + X2 = *RK++ ^ \ + ( (uint32_t) RSb[ ( Y2 ) & 0xFF ] ) ^ + ( (uint32_t) RSb[ ( Y1 >> 8 ) & 0xFF ] << 8 ) ^ + ( (uint32_t) RSb[ ( Y0 >> 16 ) & 0xFF ] << 16 ) ^ + ( (uint32_t) RSb[ ( Y3 >> 24 ) & 0xFF ] << 24 ); + + X3 = *RK++ ^ \ + ( (uint32_t) RSb[ ( Y3 ) & 0xFF ] ) ^ + ( (uint32_t) RSb[ ( Y2 >> 8 ) & 0xFF ] << 8 ) ^ + ( (uint32_t) RSb[ ( Y1 >> 16 ) & 0xFF ] << 16 ) ^ + ( (uint32_t) RSb[ ( Y0 >> 24 ) & 0xFF ] << 24 ); + + PUT_UINT32_LE( X0, output, 0 ); + PUT_UINT32_LE( X1, output, 4 ); + PUT_UINT32_LE( X2, output, 8 ); + PUT_UINT32_LE( X3, output, 12 ); + } + #endif /* !MBEDTLS_AES_DECRYPT_ALT */ + + /* + * AES-ECB block encryption/decryption + */ + int mbedtls_aes_crypt_ecb( mbedtls_aes_context *ctx, + int mode, + const unsigned char input[16], + unsigned char output[16] ) + { + #if defined(MBEDTLS_AESNI_C) && defined(MBEDTLS_HAVE_X86_64) + if( mbedtls_aesni_has_support( MBEDTLS_AESNI_AES ) ) + return( mbedtls_aesni_crypt_ecb( ctx, mode, input, output ) ); + #endif + + #if defined(MBEDTLS_PADLOCK_C) && defined(MBEDTLS_HAVE_X86) + if( aes_padlock_ace ) + { + if( mbedtls_padlock_xcryptecb( ctx, mode, input, output ) == 0 ) + return( 0 ); + + // If padlock data misaligned, we just fall back to + // unaccelerated mode + // + } + #endif + + if( mode == MBEDTLS_AES_ENCRYPT ) + mbedtls_aes_encrypt( ctx, input, output ); + else + mbedtls_aes_decrypt( ctx, input, output ); + + return( 0 ); + } + + #if defined(MBEDTLS_CIPHER_MODE_CBC) + /* + * AES-CBC buffer encryption/decryption + */ + 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 ) + { + int i; + unsigned char temp[16]; + + if( length % 16 ) + return( MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH ); + + #if defined(MBEDTLS_PADLOCK_C) && defined(MBEDTLS_HAVE_X86) + if( aes_padlock_ace ) + { + if( mbedtls_padlock_xcryptcbc( ctx, mode, length, iv, input, output ) == 0 ) + return( 0 ); + + // If padlock data misaligned, we just fall back to + // unaccelerated mode + // + } + #endif + + if( mode == MBEDTLS_AES_DECRYPT ) + { + while( length > 0 ) + { + memcpy( temp, input, 16 ); + mbedtls_aes_crypt_ecb( ctx, mode, input, output ); + + for( i = 0; i < 16; i++ ) + output[i] = (unsigned char)( output[i] ^ iv[i] ); + + memcpy( iv, temp, 16 ); + + input += 16; + output += 16; + length -= 16; + } + } + else + { + while( length > 0 ) + { + for( i = 0; i < 16; i++ ) + output[i] = (unsigned char)( input[i] ^ iv[i] ); + + mbedtls_aes_crypt_ecb( ctx, mode, output, output ); + memcpy( iv, output, 16 ); + + input += 16; + output += 16; + length -= 16; + } + } + + return( 0 ); + } + #endif /* MBEDTLS_CIPHER_MODE_CBC */ + + #if defined(MBEDTLS_CIPHER_MODE_CFB) + /* + * AES-CFB128 buffer encryption/decryption + */ + 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 ) + { + int c; + size_t n = *iv_off; + + if( mode == MBEDTLS_AES_DECRYPT ) + { + while( length-- ) + { + if( n == 0 ) + mbedtls_aes_crypt_ecb( ctx, MBEDTLS_AES_ENCRYPT, iv, iv ); + + c = *input++; + *output++ = (unsigned char)( c ^ iv[n] ); + iv[n] = (unsigned char) c; + + n = ( n + 1 ) & 0x0F; + } + } + else + { + while( length-- ) + { + if( n == 0 ) + mbedtls_aes_crypt_ecb( ctx, MBEDTLS_AES_ENCRYPT, iv, iv ); + + iv[n] = *output++ = (unsigned char)( iv[n] ^ *input++ ); + + n = ( n + 1 ) & 0x0F; + } + } + + *iv_off = n; + + return( 0 ); + } + + /* + * AES-CFB8 buffer encryption/decryption + */ + 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 ) + { + unsigned char c; + unsigned char ov[17]; + + while( length-- ) + { + memcpy( ov, iv, 16 ); + mbedtls_aes_crypt_ecb( ctx, MBEDTLS_AES_ENCRYPT, iv, iv ); + + if( mode == MBEDTLS_AES_DECRYPT ) + ov[16] = *input; + + c = *output++ = (unsigned char)( iv[0] ^ *input++ ); + + if( mode == MBEDTLS_AES_ENCRYPT ) + ov[16] = c; + + memcpy( iv, ov + 1, 16 ); + } + + return( 0 ); + } + #endif /*MBEDTLS_CIPHER_MODE_CFB */ + + #if defined(MBEDTLS_CIPHER_MODE_CTR) + /* + * AES-CTR buffer encryption/decryption + */ + 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 ) + { + int c, i; + size_t n = *nc_off; + + while( length-- ) + { + if( n == 0 ) { + mbedtls_aes_crypt_ecb( ctx, MBEDTLS_AES_ENCRYPT, nonce_counter, stream_block ); + + for( i = 16; i > 0; i-- ) + if( ++nonce_counter[i - 1] != 0 ) + break; + } + c = *input++; + *output++ = (unsigned char)( c ^ stream_block[n] ); + + n = ( n + 1 ) & 0x0F; + } + + *nc_off = n; + + return( 0 ); + } + #endif /* MBEDTLS_CIPHER_MODE_CTR */ + + #endif /* !MBEDTLS_AES_ALT */ + + #if defined(MBEDTLS_SELF_TEST) + /* + * AES test vectors from: + * + * http://csrc.nist.gov/archive/aes/rijndael/rijndael-vals.zip + */ + static const unsigned char aes_test_ecb_dec[3][16] = + { + { 0x44, 0x41, 0x6A, 0xC2, 0xD1, 0xF5, 0x3C, 0x58, + 0x33, 0x03, 0x91, 0x7E, 0x6B, 0xE9, 0xEB, 0xE0 }, + { 0x48, 0xE3, 0x1E, 0x9E, 0x25, 0x67, 0x18, 0xF2, + 0x92, 0x29, 0x31, 0x9C, 0x19, 0xF1, 0x5B, 0xA4 }, + { 0x05, 0x8C, 0xCF, 0xFD, 0xBB, 0xCB, 0x38, 0x2D, + 0x1F, 0x6F, 0x56, 0x58, 0x5D, 0x8A, 0x4A, 0xDE } + }; + + static const unsigned char aes_test_ecb_enc[3][16] = + { + { 0xC3, 0x4C, 0x05, 0x2C, 0xC0, 0xDA, 0x8D, 0x73, + 0x45, 0x1A, 0xFE, 0x5F, 0x03, 0xBE, 0x29, 0x7F }, + { 0xF3, 0xF6, 0x75, 0x2A, 0xE8, 0xD7, 0x83, 0x11, + 0x38, 0xF0, 0x41, 0x56, 0x06, 0x31, 0xB1, 0x14 }, + { 0x8B, 0x79, 0xEE, 0xCC, 0x93, 0xA0, 0xEE, 0x5D, + 0xFF, 0x30, 0xB4, 0xEA, 0x21, 0x63, 0x6D, 0xA4 } + }; + + #if defined(MBEDTLS_CIPHER_MODE_CBC) + static const unsigned char aes_test_cbc_dec[3][16] = + { + { 0xFA, 0xCA, 0x37, 0xE0, 0xB0, 0xC8, 0x53, 0x73, + 0xDF, 0x70, 0x6E, 0x73, 0xF7, 0xC9, 0xAF, 0x86 }, + { 0x5D, 0xF6, 0x78, 0xDD, 0x17, 0xBA, 0x4E, 0x75, + 0xB6, 0x17, 0x68, 0xC6, 0xAD, 0xEF, 0x7C, 0x7B }, + { 0x48, 0x04, 0xE1, 0x81, 0x8F, 0xE6, 0x29, 0x75, + 0x19, 0xA3, 0xE8, 0x8C, 0x57, 0x31, 0x04, 0x13 } + }; + + static const unsigned char aes_test_cbc_enc[3][16] = + { + { 0x8A, 0x05, 0xFC, 0x5E, 0x09, 0x5A, 0xF4, 0x84, + 0x8A, 0x08, 0xD3, 0x28, 0xD3, 0x68, 0x8E, 0x3D }, + { 0x7B, 0xD9, 0x66, 0xD5, 0x3A, 0xD8, 0xC1, 0xBB, + 0x85, 0xD2, 0xAD, 0xFA, 0xE8, 0x7B, 0xB1, 0x04 }, + { 0xFE, 0x3C, 0x53, 0x65, 0x3E, 0x2F, 0x45, 0xB5, + 0x6F, 0xCD, 0x88, 0xB2, 0xCC, 0x89, 0x8F, 0xF0 } + }; + #endif /* MBEDTLS_CIPHER_MODE_CBC */ + + #if defined(MBEDTLS_CIPHER_MODE_CFB) + /* + * AES-CFB128 test vectors from: + * + * http://csrc.nist.gov/publications/nistpubs/800-38a/sp800-38a.pdf + */ + static const unsigned char aes_test_cfb128_key[3][32] = + { + { 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, + 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C }, + { 0x8E, 0x73, 0xB0, 0xF7, 0xDA, 0x0E, 0x64, 0x52, + 0xC8, 0x10, 0xF3, 0x2B, 0x80, 0x90, 0x79, 0xE5, + 0x62, 0xF8, 0xEA, 0xD2, 0x52, 0x2C, 0x6B, 0x7B }, + { 0x60, 0x3D, 0xEB, 0x10, 0x15, 0xCA, 0x71, 0xBE, + 0x2B, 0x73, 0xAE, 0xF0, 0x85, 0x7D, 0x77, 0x81, + 0x1F, 0x35, 0x2C, 0x07, 0x3B, 0x61, 0x08, 0xD7, + 0x2D, 0x98, 0x10, 0xA3, 0x09, 0x14, 0xDF, 0xF4 } + }; + + static const unsigned char aes_test_cfb128_iv[16] = + { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F + }; + + static const unsigned char aes_test_cfb128_pt[64] = + { + 0x6B, 0xC1, 0xBE, 0xE2, 0x2E, 0x40, 0x9F, 0x96, + 0xE9, 0x3D, 0x7E, 0x11, 0x73, 0x93, 0x17, 0x2A, + 0xAE, 0x2D, 0x8A, 0x57, 0x1E, 0x03, 0xAC, 0x9C, + 0x9E, 0xB7, 0x6F, 0xAC, 0x45, 0xAF, 0x8E, 0x51, + 0x30, 0xC8, 0x1C, 0x46, 0xA3, 0x5C, 0xE4, 0x11, + 0xE5, 0xFB, 0xC1, 0x19, 0x1A, 0x0A, 0x52, 0xEF, + 0xF6, 0x9F, 0x24, 0x45, 0xDF, 0x4F, 0x9B, 0x17, + 0xAD, 0x2B, 0x41, 0x7B, 0xE6, 0x6C, 0x37, 0x10 + }; + + static const unsigned char aes_test_cfb128_ct[3][64] = + { + { 0x3B, 0x3F, 0xD9, 0x2E, 0xB7, 0x2D, 0xAD, 0x20, + 0x33, 0x34, 0x49, 0xF8, 0xE8, 0x3C, 0xFB, 0x4A, + 0xC8, 0xA6, 0x45, 0x37, 0xA0, 0xB3, 0xA9, 0x3F, + 0xCD, 0xE3, 0xCD, 0xAD, 0x9F, 0x1C, 0xE5, 0x8B, + 0x26, 0x75, 0x1F, 0x67, 0xA3, 0xCB, 0xB1, 0x40, + 0xB1, 0x80, 0x8C, 0xF1, 0x87, 0xA4, 0xF4, 0xDF, + 0xC0, 0x4B, 0x05, 0x35, 0x7C, 0x5D, 0x1C, 0x0E, + 0xEA, 0xC4, 0xC6, 0x6F, 0x9F, 0xF7, 0xF2, 0xE6 }, + { 0xCD, 0xC8, 0x0D, 0x6F, 0xDD, 0xF1, 0x8C, 0xAB, + 0x34, 0xC2, 0x59, 0x09, 0xC9, 0x9A, 0x41, 0x74, + 0x67, 0xCE, 0x7F, 0x7F, 0x81, 0x17, 0x36, 0x21, + 0x96, 0x1A, 0x2B, 0x70, 0x17, 0x1D, 0x3D, 0x7A, + 0x2E, 0x1E, 0x8A, 0x1D, 0xD5, 0x9B, 0x88, 0xB1, + 0xC8, 0xE6, 0x0F, 0xED, 0x1E, 0xFA, 0xC4, 0xC9, + 0xC0, 0x5F, 0x9F, 0x9C, 0xA9, 0x83, 0x4F, 0xA0, + 0x42, 0xAE, 0x8F, 0xBA, 0x58, 0x4B, 0x09, 0xFF }, + { 0xDC, 0x7E, 0x84, 0xBF, 0xDA, 0x79, 0x16, 0x4B, + 0x7E, 0xCD, 0x84, 0x86, 0x98, 0x5D, 0x38, 0x60, + 0x39, 0xFF, 0xED, 0x14, 0x3B, 0x28, 0xB1, 0xC8, + 0x32, 0x11, 0x3C, 0x63, 0x31, 0xE5, 0x40, 0x7B, + 0xDF, 0x10, 0x13, 0x24, 0x15, 0xE5, 0x4B, 0x92, + 0xA1, 0x3E, 0xD0, 0xA8, 0x26, 0x7A, 0xE2, 0xF9, + 0x75, 0xA3, 0x85, 0x74, 0x1A, 0xB9, 0xCE, 0xF8, + 0x20, 0x31, 0x62, 0x3D, 0x55, 0xB1, 0xE4, 0x71 } + }; + #endif /* MBEDTLS_CIPHER_MODE_CFB */ + + #if defined(MBEDTLS_CIPHER_MODE_CTR) + /* + * AES-CTR test vectors from: + * + * http://www.faqs.org/rfcs/rfc3686.html + */ + + static const unsigned char aes_test_ctr_key[3][16] = + { + { 0xAE, 0x68, 0x52, 0xF8, 0x12, 0x10, 0x67, 0xCC, + 0x4B, 0xF7, 0xA5, 0x76, 0x55, 0x77, 0xF3, 0x9E }, + { 0x7E, 0x24, 0x06, 0x78, 0x17, 0xFA, 0xE0, 0xD7, + 0x43, 0xD6, 0xCE, 0x1F, 0x32, 0x53, 0x91, 0x63 }, + { 0x76, 0x91, 0xBE, 0x03, 0x5E, 0x50, 0x20, 0xA8, + 0xAC, 0x6E, 0x61, 0x85, 0x29, 0xF9, 0xA0, 0xDC } + }; + + static const unsigned char aes_test_ctr_nonce_counter[3][16] = + { + { 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }, + { 0x00, 0x6C, 0xB6, 0xDB, 0xC0, 0x54, 0x3B, 0x59, + 0xDA, 0x48, 0xD9, 0x0B, 0x00, 0x00, 0x00, 0x01 }, + { 0x00, 0xE0, 0x01, 0x7B, 0x27, 0x77, 0x7F, 0x3F, + 0x4A, 0x17, 0x86, 0xF0, 0x00, 0x00, 0x00, 0x01 } + }; + + static const unsigned char aes_test_ctr_pt[3][48] = + { + { 0x53, 0x69, 0x6E, 0x67, 0x6C, 0x65, 0x20, 0x62, + 0x6C, 0x6F, 0x63, 0x6B, 0x20, 0x6D, 0x73, 0x67 }, + + { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, + 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F }, + + { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, + 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, + 0x20, 0x21, 0x22, 0x23 } + }; + + static const unsigned char aes_test_ctr_ct[3][48] = + { + { 0xE4, 0x09, 0x5D, 0x4F, 0xB7, 0xA7, 0xB3, 0x79, + 0x2D, 0x61, 0x75, 0xA3, 0x26, 0x13, 0x11, 0xB8 }, + { 0x51, 0x04, 0xA1, 0x06, 0x16, 0x8A, 0x72, 0xD9, + 0x79, 0x0D, 0x41, 0xEE, 0x8E, 0xDA, 0xD3, 0x88, + 0xEB, 0x2E, 0x1E, 0xFC, 0x46, 0xDA, 0x57, 0xC8, + 0xFC, 0xE6, 0x30, 0xDF, 0x91, 0x41, 0xBE, 0x28 }, + { 0xC1, 0xCF, 0x48, 0xA8, 0x9F, 0x2F, 0xFD, 0xD9, + 0xCF, 0x46, 0x52, 0xE9, 0xEF, 0xDB, 0x72, 0xD7, + 0x45, 0x40, 0xA4, 0x2B, 0xDE, 0x6D, 0x78, 0x36, + 0xD5, 0x9A, 0x5C, 0xEA, 0xAE, 0xF3, 0x10, 0x53, + 0x25, 0xB2, 0x07, 0x2F } + }; + + static const int aes_test_ctr_len[3] = + { 16, 32, 36 }; + #endif /* MBEDTLS_CIPHER_MODE_CTR */ + + /* + * Checkup routine + */ + int mbedtls_aes_self_test( int verbose ) + { + int ret = 0, i, j, u, v; + unsigned char key[32]; + unsigned char buf[64]; + unsigned char iv[16]; + #if defined(MBEDTLS_CIPHER_MODE_CBC) + unsigned char prv[16]; + #endif + #if defined(MBEDTLS_CIPHER_MODE_CTR) || defined(MBEDTLS_CIPHER_MODE_CFB) + size_t offset; + #endif + #if defined(MBEDTLS_CIPHER_MODE_CTR) + int len; + unsigned char nonce_counter[16]; + unsigned char stream_block[16]; + #endif + mbedtls_aes_context ctx; + + memset( key, 0, 32 ); + mbedtls_aes_init( &ctx ); + + /* + * ECB mode + */ + for( i = 0; i < 6; i++ ) + { + u = i >> 1; + v = i & 1; + + if( verbose != 0 ) + mbedtls_printf( " AES-ECB-%3d (%s): ", 128 + u * 64, + ( v == MBEDTLS_AES_DECRYPT ) ? "dec" : "enc" ); + + memset( buf, 0, 16 ); + + if( v == MBEDTLS_AES_DECRYPT ) + { + mbedtls_aes_setkey_dec( &ctx, key, 128 + u * 64 ); + + for( j = 0; j < 10000; j++ ) + mbedtls_aes_crypt_ecb( &ctx, v, buf, buf ); + + if( memcmp( buf, aes_test_ecb_dec[u], 16 ) != 0 ) + { + if( verbose != 0 ) + mbedtls_printf( "failed\n" ); + + ret = 1; + goto exit; + } + } + else + { + mbedtls_aes_setkey_enc( &ctx, key, 128 + u * 64 ); + + for( j = 0; j < 10000; j++ ) + mbedtls_aes_crypt_ecb( &ctx, v, buf, buf ); + + if( memcmp( buf, aes_test_ecb_enc[u], 16 ) != 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" ); + + #if defined(MBEDTLS_CIPHER_MODE_CBC) + /* + * CBC mode + */ + for( i = 0; i < 6; i++ ) + { + u = i >> 1; + v = i & 1; + + if( verbose != 0 ) + mbedtls_printf( " AES-CBC-%3d (%s): ", 128 + u * 64, + ( v == MBEDTLS_AES_DECRYPT ) ? "dec" : "enc" ); + + memset( iv , 0, 16 ); + memset( prv, 0, 16 ); + memset( buf, 0, 16 ); + + if( v == MBEDTLS_AES_DECRYPT ) + { + mbedtls_aes_setkey_dec( &ctx, key, 128 + u * 64 ); + + for( j = 0; j < 10000; j++ ) + mbedtls_aes_crypt_cbc( &ctx, v, 16, iv, buf, buf ); + + if( memcmp( buf, aes_test_cbc_dec[u], 16 ) != 0 ) + { + if( verbose != 0 ) + mbedtls_printf( "failed\n" ); + + ret = 1; + goto exit; + } + } + else + { + mbedtls_aes_setkey_enc( &ctx, key, 128 + u * 64 ); + + for( j = 0; j < 10000; j++ ) + { + unsigned char tmp[16]; + + mbedtls_aes_crypt_cbc( &ctx, v, 16, iv, buf, buf ); + + memcpy( tmp, prv, 16 ); + memcpy( prv, buf, 16 ); + memcpy( buf, tmp, 16 ); + } + + if( memcmp( prv, aes_test_cbc_enc[u], 16 ) != 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" ); + #endif /* MBEDTLS_CIPHER_MODE_CBC */ + + #if defined(MBEDTLS_CIPHER_MODE_CFB) + /* + * CFB128 mode + */ + for( i = 0; i < 6; i++ ) + { + u = i >> 1; + v = i & 1; + + if( verbose != 0 ) + mbedtls_printf( " AES-CFB128-%3d (%s): ", 128 + u * 64, + ( v == MBEDTLS_AES_DECRYPT ) ? "dec" : "enc" ); + + memcpy( iv, aes_test_cfb128_iv, 16 ); + memcpy( key, aes_test_cfb128_key[u], 16 + u * 8 ); + + offset = 0; + mbedtls_aes_setkey_enc( &ctx, key, 128 + u * 64 ); + + if( v == MBEDTLS_AES_DECRYPT ) + { + memcpy( buf, aes_test_cfb128_ct[u], 64 ); + mbedtls_aes_crypt_cfb128( &ctx, v, 64, &offset, iv, buf, buf ); + + if( memcmp( buf, aes_test_cfb128_pt, 64 ) != 0 ) + { + if( verbose != 0 ) + mbedtls_printf( "failed\n" ); + + ret = 1; + goto exit; + } + } + else + { + memcpy( buf, aes_test_cfb128_pt, 64 ); + mbedtls_aes_crypt_cfb128( &ctx, v, 64, &offset, iv, buf, buf ); + + if( memcmp( buf, aes_test_cfb128_ct[u], 64 ) != 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" ); + #endif /* MBEDTLS_CIPHER_MODE_CFB */ + + #if defined(MBEDTLS_CIPHER_MODE_CTR) + /* + * CTR mode + */ + for( i = 0; i < 6; i++ ) + { + u = i >> 1; + v = i & 1; + + if( verbose != 0 ) + mbedtls_printf( " AES-CTR-128 (%s): ", + ( v == MBEDTLS_AES_DECRYPT ) ? "dec" : "enc" ); + + memcpy( nonce_counter, aes_test_ctr_nonce_counter[u], 16 ); + memcpy( key, aes_test_ctr_key[u], 16 ); + + offset = 0; + mbedtls_aes_setkey_enc( &ctx, key, 128 ); + + if( v == MBEDTLS_AES_DECRYPT ) + { + len = aes_test_ctr_len[u]; + memcpy( buf, aes_test_ctr_ct[u], len ); + + mbedtls_aes_crypt_ctr( &ctx, len, &offset, nonce_counter, stream_block, + buf, buf ); + + if( memcmp( buf, aes_test_ctr_pt[u], len ) != 0 ) + { + if( verbose != 0 ) + mbedtls_printf( "failed\n" ); + + ret = 1; + goto exit; + } + } + else + { + len = aes_test_ctr_len[u]; + memcpy( buf, aes_test_ctr_pt[u], len ); + + mbedtls_aes_crypt_ctr( &ctx, len, &offset, nonce_counter, stream_block, + buf, buf ); + + if( memcmp( buf, aes_test_ctr_ct[u], len ) != 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" ); + #endif /* MBEDTLS_CIPHER_MODE_CTR */ + + ret = 0; + + exit: + mbedtls_aes_free( &ctx ); + + return( ret ); + } + + #endif /* MBEDTLS_SELF_TEST */ + + #endif /* MBEDTLS_AES_C */ \ No newline at end of file diff --git a/IOBox/mbedtls/aes.h b/IOBox/mbedtls/aes.h new file mode 100644 index 0000000..1a9c66d --- /dev/null +++ b/IOBox/mbedtls/aes.h @@ -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 +#include + +/* 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 */ \ No newline at end of file diff --git a/IOBox/mbedtls/base64.c b/IOBox/mbedtls/base64.c new file mode 100644 index 0000000..ebe7489 --- /dev/null +++ b/IOBox/mbedtls/base64.c @@ -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 + + #if defined(MBEDTLS_SELF_TEST) + #include + #if defined(MBEDTLS_PLATFORM_C) + #include "platform.h" + #else + #include + #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 */ \ No newline at end of file diff --git a/IOBox/mbedtls/base64.h b/IOBox/mbedtls/base64.h new file mode 100644 index 0000000..ef22787 --- /dev/null +++ b/IOBox/mbedtls/base64.h @@ -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 + +#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 */ \ No newline at end of file diff --git a/IOBox/mbedtls/check_config.h b/IOBox/mbedtls/check_config.h new file mode 100644 index 0000000..c4a6b03 --- /dev/null +++ b/IOBox/mbedtls/check_config.h @@ -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 + #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 */ \ No newline at end of file diff --git a/IOBox/mbedtls/config.h b/IOBox/mbedtls/config.h new file mode 100644 index 0000000..551ad8d --- /dev/null +++ b/IOBox/mbedtls/config.h @@ -0,0 +1,2511 @@ +/** + * \file config.h + * + * \brief Configuration options (set of defines) + * + * This set of compile-time options may be used to enable + * or disable features selectively, and reduce the global + * memory footprint. + * + * 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_CONFIG_H + #define MBEDTLS_CONFIG_H + + #if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) + #define _CRT_SECURE_NO_DEPRECATE 1 + #endif + + /** + * \name SECTION: System support + * + * This section sets system specific settings. + * \{ + */ + + /** + * \def MBEDTLS_HAVE_ASM + * + * The compiler has support for asm(). + * + * Requires support for asm() in compiler. + * + * Used in: + * library/timing.c + * library/padlock.c + * include/mbedtls/bn_mul.h + * + * Comment to disable the use of assembly code. + */ + #define MBEDTLS_HAVE_ASM + + /** + * \def MBEDTLS_HAVE_SSE2 + * + * CPU supports SSE2 instruction set. + * + * Uncomment if the CPU supports SSE2 (IA-32 specific). + */ + //#define MBEDTLS_HAVE_SSE2 + + /** + * \def MBEDTLS_HAVE_TIME + * + * System has time.h and time(). + * The time does not need to be correct, only time differences are used, + * by contrast with MBEDTLS_HAVE_TIME_DATE + * + * Comment if your system does not support time functions + */ + #define MBEDTLS_HAVE_TIME + + /** + * \def MBEDTLS_HAVE_TIME_DATE + * + * System has time.h and time(), gmtime() and the clock is correct. + * The time needs to be correct (not necesarily very accurate, but at least + * the date should be correct). This is used to verify the validity period of + * X.509 certificates. + * + * Comment if your system does not have a correct clock. + */ + #define MBEDTLS_HAVE_TIME_DATE + + /** + * \def MBEDTLS_PLATFORM_MEMORY + * + * Enable the memory allocation layer. + * + * By default mbed TLS uses the system-provided calloc() and free(). + * This allows different allocators (self-implemented or provided) to be + * provided to the platform abstraction layer. + * + * Enabling MBEDTLS_PLATFORM_MEMORY without the + * MBEDTLS_PLATFORM_{FREE,CALLOC}_MACROs will provide + * "mbedtls_platform_set_calloc_free()" allowing you to set an alternative calloc() and + * free() function pointer at runtime. + * + * Enabling MBEDTLS_PLATFORM_MEMORY and specifying + * MBEDTLS_PLATFORM_{CALLOC,FREE}_MACROs will allow you to specify the + * alternate function at compile time. + * + * Requires: MBEDTLS_PLATFORM_C + * + * Enable this layer to allow use of alternative memory allocators. + */ + //#define MBEDTLS_PLATFORM_MEMORY + + /** + * \def MBEDTLS_PLATFORM_NO_STD_FUNCTIONS + * + * Do not assign standard functions in the platform layer (e.g. calloc() to + * MBEDTLS_PLATFORM_STD_CALLOC and printf() to MBEDTLS_PLATFORM_STD_PRINTF) + * + * This makes sure there are no linking errors on platforms that do not support + * these functions. You will HAVE to provide alternatives, either at runtime + * via the platform_set_xxx() functions or at compile time by setting + * the MBEDTLS_PLATFORM_STD_XXX defines, or enabling a + * MBEDTLS_PLATFORM_XXX_MACRO. + * + * Requires: MBEDTLS_PLATFORM_C + * + * Uncomment to prevent default assignment of standard functions in the + * platform layer. + */ + //#define MBEDTLS_PLATFORM_NO_STD_FUNCTIONS + + /** + * \def MBEDTLS_PLATFORM_EXIT_ALT + * + * MBEDTLS_PLATFORM_XXX_ALT: Uncomment a macro to let mbed TLS support the + * function in the platform abstraction layer. + * + * Example: In case you uncomment MBEDTLS_PLATFORM_PRINTF_ALT, mbed TLS will + * provide a function "mbedtls_platform_set_printf()" that allows you to set an + * alternative printf function pointer. + * + * All these define require MBEDTLS_PLATFORM_C to be defined! + * + * \note MBEDTLS_PLATFORM_SNPRINTF_ALT is required on Windows; + * it will be enabled automatically by check_config.h + * + * \warning MBEDTLS_PLATFORM_XXX_ALT cannot be defined at the same time as + * MBEDTLS_PLATFORM_XXX_MACRO! + * + * Uncomment a macro to enable alternate implementation of specific base + * platform function + */ + //#define MBEDTLS_PLATFORM_EXIT_ALT + //#define MBEDTLS_PLATFORM_FPRINTF_ALT + //#define MBEDTLS_PLATFORM_PRINTF_ALT + //#define MBEDTLS_PLATFORM_SNPRINTF_ALT + + /** + * \def MBEDTLS_DEPRECATED_WARNING + * + * Mark deprecated functions so that they generate a warning if used. + * Functions deprecated in one version will usually be removed in the next + * version. You can enable this to help you prepare the transition to a new + * major version by making sure your code is not using these functions. + * + * This only works with GCC and Clang. With other compilers, you may want to + * use MBEDTLS_DEPRECATED_REMOVED + * + * Uncomment to get warnings on using deprecated functions. + */ + //#define MBEDTLS_DEPRECATED_WARNING + + /** + * \def MBEDTLS_DEPRECATED_REMOVED + * + * Remove deprecated functions so that they generate an error if used. + * Functions deprecated in one version will usually be removed in the next + * version. You can enable this to help you prepare the transition to a new + * major version by making sure your code is not using these functions. + * + * Uncomment to get errors on using deprecated functions. + */ + //#define MBEDTLS_DEPRECATED_REMOVED + + /* \} name SECTION: System support */ + + /** + * \name SECTION: mbed TLS feature support + * + * This section sets support for features that are or are not needed + * within the modules that are enabled. + * \{ + */ + + /** + * \def MBEDTLS_TIMING_ALT + * + * Uncomment to provide your own alternate implementation for mbedtls_timing_hardclock(), + * mbedtls_timing_get_timer(), mbedtls_set_alarm(), mbedtls_set/get_delay() + * + * Only works if you have MBEDTLS_TIMING_C enabled. + * + * You will need to provide a header "timing_alt.h" and an implementation at + * compile time. + */ + //#define MBEDTLS_TIMING_ALT + + /** + * \def MBEDTLS_AES_ALT + * + * MBEDTLS__MODULE_NAME__ALT: Uncomment a macro to let mbed TLS use your + * alternate core implementation of a symmetric crypto or hash module (e.g. + * platform specific assembly optimized implementations). Keep in mind that + * the function prototypes should remain the same. + * + * This replaces the whole module. If you only want to replace one of the + * functions, use one of the MBEDTLS__FUNCTION_NAME__ALT flags. + * + * Example: In case you uncomment MBEDTLS_AES_ALT, mbed TLS will no longer + * provide the "struct mbedtls_aes_context" definition and omit the base function + * declarations and implementations. "aes_alt.h" will be included from + * "aes.h" to include the new function definitions. + * + * Uncomment a macro to enable alternate implementation of the corresponding + * module. + */ + //#define MBEDTLS_AES_ALT + //#define MBEDTLS_ARC4_ALT + //#define MBEDTLS_BLOWFISH_ALT + //#define MBEDTLS_CAMELLIA_ALT + //#define MBEDTLS_DES_ALT + //#define MBEDTLS_XTEA_ALT + //#define MBEDTLS_MD2_ALT + //#define MBEDTLS_MD4_ALT + //#define MBEDTLS_MD5_ALT + //#define MBEDTLS_RIPEMD160_ALT + //#define MBEDTLS_SHA1_ALT + //#define MBEDTLS_SHA256_ALT + //#define MBEDTLS_SHA512_ALT + + /** + * \def MBEDTLS_MD2_PROCESS_ALT + * + * MBEDTLS__FUNCTION_NAME__ALT: Uncomment a macro to let mbed TLS use you + * alternate core implementation of symmetric crypto or hash function. Keep in + * mind that function prototypes should remain the same. + * + * This replaces only one function. The header file from mbed TLS is still + * used, in contrast to the MBEDTLS__MODULE_NAME__ALT flags. + * + * Example: In case you uncomment MBEDTLS_SHA256_PROCESS_ALT, mbed TLS will + * no longer provide the mbedtls_sha1_process() function, but it will still provide + * the other function (using your mbedtls_sha1_process() function) and the definition + * of mbedtls_sha1_context, so your implementation of mbedtls_sha1_process must be compatible + * with this definition. + * + * Note: if you use the AES_xxx_ALT macros, then is is recommended to also set + * MBEDTLS_AES_ROM_TABLES in order to help the linker garbage-collect the AES + * tables. + * + * Uncomment a macro to enable alternate implementation of the corresponding + * function. + */ + //#define MBEDTLS_MD2_PROCESS_ALT + //#define MBEDTLS_MD4_PROCESS_ALT + //#define MBEDTLS_MD5_PROCESS_ALT + //#define MBEDTLS_RIPEMD160_PROCESS_ALT + //#define MBEDTLS_SHA1_PROCESS_ALT + //#define MBEDTLS_SHA256_PROCESS_ALT + //#define MBEDTLS_SHA512_PROCESS_ALT + //#define MBEDTLS_DES_SETKEY_ALT + //#define MBEDTLS_DES_CRYPT_ECB_ALT + //#define MBEDTLS_DES3_CRYPT_ECB_ALT + //#define MBEDTLS_AES_SETKEY_ENC_ALT + //#define MBEDTLS_AES_SETKEY_DEC_ALT + //#define MBEDTLS_AES_ENCRYPT_ALT + //#define MBEDTLS_AES_DECRYPT_ALT + + /** + * \def MBEDTLS_ENTROPY_HARDWARE_ALT + * + * Uncomment this macro to let mbed TLS use your own implementation of a + * hardware entropy collector. + * + * Your function must be called \c mbedtls_hardware_poll(), have the same + * prototype as declared in entropy_poll.h, and accept NULL as first argument. + * + * Uncomment to use your own hardware entropy collector. + */ + //#define MBEDTLS_ENTROPY_HARDWARE_ALT + + /** + * \def MBEDTLS_AES_ROM_TABLES + * + * Store the AES tables in ROM. + * + * Uncomment this macro to store the AES tables in ROM. + */ + //#define MBEDTLS_AES_ROM_TABLES + + /** + * \def MBEDTLS_CAMELLIA_SMALL_MEMORY + * + * Use less ROM for the Camellia implementation (saves about 768 bytes). + * + * Uncomment this macro to use less memory for Camellia. + */ + //#define MBEDTLS_CAMELLIA_SMALL_MEMORY + + /** + * \def MBEDTLS_CIPHER_MODE_CBC + * + * Enable Cipher Block Chaining mode (CBC) for symmetric ciphers. + */ + #define MBEDTLS_CIPHER_MODE_CBC + + /** + * \def MBEDTLS_CIPHER_MODE_CFB + * + * Enable Cipher Feedback mode (CFB) for symmetric ciphers. + */ + //#define MBEDTLS_CIPHER_MODE_CFB + + /** + * \def MBEDTLS_CIPHER_MODE_CTR + * + * Enable Counter Block Cipher mode (CTR) for symmetric ciphers. + */ + //#define MBEDTLS_CIPHER_MODE_CTR + + /** + * \def MBEDTLS_CIPHER_NULL_CIPHER + * + * Enable NULL cipher. + * Warning: Only do so when you know what you are doing. This allows for + * encryption or channels without any security! + * + * Requires MBEDTLS_ENABLE_WEAK_CIPHERSUITES as well to enable + * the following ciphersuites: + * MBEDTLS_TLS_ECDH_ECDSA_WITH_NULL_SHA + * MBEDTLS_TLS_ECDH_RSA_WITH_NULL_SHA + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_NULL_SHA + * MBEDTLS_TLS_ECDHE_RSA_WITH_NULL_SHA + * MBEDTLS_TLS_ECDHE_PSK_WITH_NULL_SHA384 + * MBEDTLS_TLS_ECDHE_PSK_WITH_NULL_SHA256 + * MBEDTLS_TLS_ECDHE_PSK_WITH_NULL_SHA + * MBEDTLS_TLS_DHE_PSK_WITH_NULL_SHA384 + * MBEDTLS_TLS_DHE_PSK_WITH_NULL_SHA256 + * MBEDTLS_TLS_DHE_PSK_WITH_NULL_SHA + * MBEDTLS_TLS_RSA_WITH_NULL_SHA256 + * MBEDTLS_TLS_RSA_WITH_NULL_SHA + * MBEDTLS_TLS_RSA_WITH_NULL_MD5 + * MBEDTLS_TLS_RSA_PSK_WITH_NULL_SHA384 + * MBEDTLS_TLS_RSA_PSK_WITH_NULL_SHA256 + * MBEDTLS_TLS_RSA_PSK_WITH_NULL_SHA + * MBEDTLS_TLS_PSK_WITH_NULL_SHA384 + * MBEDTLS_TLS_PSK_WITH_NULL_SHA256 + * MBEDTLS_TLS_PSK_WITH_NULL_SHA + * + * Uncomment this macro to enable the NULL cipher and ciphersuites + */ + //#define MBEDTLS_CIPHER_NULL_CIPHER + + /** + * \def MBEDTLS_CIPHER_PADDING_PKCS7 + * + * MBEDTLS_CIPHER_PADDING_XXX: Uncomment or comment macros to add support for + * specific padding modes in the cipher layer with cipher modes that support + * padding (e.g. CBC) + * + * If you disable all padding modes, only full blocks can be used with CBC. + * + * Enable padding modes in the cipher layer. + */ + #define MBEDTLS_CIPHER_PADDING_PKCS7 + //#define MBEDTLS_CIPHER_PADDING_ONE_AND_ZEROS + //#define MBEDTLS_CIPHER_PADDING_ZEROS_AND_LEN + //#define MBEDTLS_CIPHER_PADDING_ZEROS + + /** + * \def MBEDTLS_ENABLE_WEAK_CIPHERSUITES + * + * Enable weak ciphersuites in SSL / TLS. + * Warning: Only do so when you know what you are doing. This allows for + * channels with virtually no security at all! + * + * This enables the following ciphersuites: + * MBEDTLS_TLS_RSA_WITH_DES_CBC_SHA + * MBEDTLS_TLS_DHE_RSA_WITH_DES_CBC_SHA + * + * Uncomment this macro to enable weak ciphersuites + */ + //#define MBEDTLS_ENABLE_WEAK_CIPHERSUITES + + /** + * \def MBEDTLS_REMOVE_ARC4_CIPHERSUITES + * + * Remove RC4 ciphersuites by default in SSL / TLS. + * This flag removes the ciphersuites based on RC4 from the default list as + * returned by mbedtls_ssl_list_ciphersuites(). However, it is still possible to + * enable (some of) them with mbedtls_ssl_conf_ciphersuites() by including them + * explicitly. + * + * Uncomment this macro to remove RC4 ciphersuites by default. + */ + #define MBEDTLS_REMOVE_ARC4_CIPHERSUITES + + /** + * \def MBEDTLS_ECP_DP_SECP192R1_ENABLED + * + * MBEDTLS_ECP_XXXX_ENABLED: Enables specific curves within the Elliptic Curve + * module. By default all supported curves are enabled. + * + * Comment macros to disable the curve and functions for it + */ + //#define MBEDTLS_ECP_DP_SECP192R1_ENABLED + //#define MBEDTLS_ECP_DP_SECP224R1_ENABLED + #define MBEDTLS_ECP_DP_SECP256R1_ENABLED + #define MBEDTLS_ECP_DP_SECP384R1_ENABLED + //#define MBEDTLS_ECP_DP_SECP521R1_ENABLED + //#define MBEDTLS_ECP_DP_SECP192K1_ENABLED + //#define MBEDTLS_ECP_DP_SECP224K1_ENABLED + //#define MBEDTLS_ECP_DP_SECP256K1_ENABLED + //#define MBEDTLS_ECP_DP_BP256R1_ENABLED + //#define MBEDTLS_ECP_DP_BP384R1_ENABLED + //#define MBEDTLS_ECP_DP_BP512R1_ENABLED + #define MBEDTLS_ECP_DP_CURVE25519_ENABLED + + /** + * \def MBEDTLS_ECP_NIST_OPTIM + * + * Enable specific 'modulo p' routines for each NIST prime. + * Depending on the prime and architecture, makes operations 4 to 8 times + * faster on the corresponding curve. + * + * Comment this macro to disable NIST curves optimisation. + */ + #define MBEDTLS_ECP_NIST_OPTIM + + /** + * \def MBEDTLS_ECDSA_DETERMINISTIC + * + * Enable deterministic ECDSA (RFC 6979). + * Standard ECDSA is "fragile" in the sense that lack of entropy when signing + * may result in a compromise of the long-term signing key. This is avoided by + * the deterministic variant. + * + * Requires: MBEDTLS_HMAC_DRBG_C + * + * Comment this macro to disable deterministic ECDSA. + */ + #define MBEDTLS_ECDSA_DETERMINISTIC + + /** + * \def MBEDTLS_KEY_EXCHANGE_PSK_ENABLED + * + * Enable the PSK based ciphersuite modes in SSL / TLS. + * + * This enables the following ciphersuites (if other requisites are + * enabled as well): + * MBEDTLS_TLS_PSK_WITH_AES_256_GCM_SHA384 + * MBEDTLS_TLS_PSK_WITH_AES_256_CBC_SHA384 + * MBEDTLS_TLS_PSK_WITH_AES_256_CBC_SHA + * MBEDTLS_TLS_PSK_WITH_CAMELLIA_256_GCM_SHA384 + * MBEDTLS_TLS_PSK_WITH_CAMELLIA_256_CBC_SHA384 + * MBEDTLS_TLS_PSK_WITH_AES_128_GCM_SHA256 + * MBEDTLS_TLS_PSK_WITH_AES_128_CBC_SHA256 + * MBEDTLS_TLS_PSK_WITH_AES_128_CBC_SHA + * MBEDTLS_TLS_PSK_WITH_CAMELLIA_128_GCM_SHA256 + * MBEDTLS_TLS_PSK_WITH_CAMELLIA_128_CBC_SHA256 + * MBEDTLS_TLS_PSK_WITH_3DES_EDE_CBC_SHA + * MBEDTLS_TLS_PSK_WITH_RC4_128_SHA + */ + #define MBEDTLS_KEY_EXCHANGE_PSK_ENABLED + + /** + * \def MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED + * + * Enable the DHE-PSK based ciphersuite modes in SSL / TLS. + * + * Requires: MBEDTLS_DHM_C + * + * This enables the following ciphersuites (if other requisites are + * enabled as well): + * MBEDTLS_TLS_DHE_PSK_WITH_AES_256_GCM_SHA384 + * MBEDTLS_TLS_DHE_PSK_WITH_AES_256_CBC_SHA384 + * MBEDTLS_TLS_DHE_PSK_WITH_AES_256_CBC_SHA + * MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_256_GCM_SHA384 + * MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 + * MBEDTLS_TLS_DHE_PSK_WITH_AES_128_GCM_SHA256 + * MBEDTLS_TLS_DHE_PSK_WITH_AES_128_CBC_SHA256 + * MBEDTLS_TLS_DHE_PSK_WITH_AES_128_CBC_SHA + * MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_128_GCM_SHA256 + * MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 + * MBEDTLS_TLS_DHE_PSK_WITH_3DES_EDE_CBC_SHA + * MBEDTLS_TLS_DHE_PSK_WITH_RC4_128_SHA + */ + //#define MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED + + /** + * \def MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED + * + * Enable the ECDHE-PSK based ciphersuite modes in SSL / TLS. + * + * Requires: MBEDTLS_ECDH_C + * + * This enables the following ciphersuites (if other requisites are + * enabled as well): + * MBEDTLS_TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA384 + * MBEDTLS_TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA + * MBEDTLS_TLS_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 + * MBEDTLS_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256 + * MBEDTLS_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA + * MBEDTLS_TLS_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 + * MBEDTLS_TLS_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA + * MBEDTLS_TLS_ECDHE_PSK_WITH_RC4_128_SHA + */ + #define MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED + + /** + * \def MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED + * + * Enable the RSA-PSK based ciphersuite modes in SSL / TLS. + * + * Requires: MBEDTLS_RSA_C, MBEDTLS_PKCS1_V15, + * MBEDTLS_X509_CRT_PARSE_C + * + * This enables the following ciphersuites (if other requisites are + * enabled as well): + * MBEDTLS_TLS_RSA_PSK_WITH_AES_256_GCM_SHA384 + * MBEDTLS_TLS_RSA_PSK_WITH_AES_256_CBC_SHA384 + * MBEDTLS_TLS_RSA_PSK_WITH_AES_256_CBC_SHA + * MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_256_GCM_SHA384 + * MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384 + * MBEDTLS_TLS_RSA_PSK_WITH_AES_128_GCM_SHA256 + * MBEDTLS_TLS_RSA_PSK_WITH_AES_128_CBC_SHA256 + * MBEDTLS_TLS_RSA_PSK_WITH_AES_128_CBC_SHA + * MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_128_GCM_SHA256 + * MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256 + * MBEDTLS_TLS_RSA_PSK_WITH_3DES_EDE_CBC_SHA + * MBEDTLS_TLS_RSA_PSK_WITH_RC4_128_SHA + */ + //#define MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED + + /** + * \def MBEDTLS_KEY_EXCHANGE_RSA_ENABLED + * + * Enable the RSA-only based ciphersuite modes in SSL / TLS. + * + * Requires: MBEDTLS_RSA_C, MBEDTLS_PKCS1_V15, + * MBEDTLS_X509_CRT_PARSE_C + * + * This enables the following ciphersuites (if other requisites are + * enabled as well): + * MBEDTLS_TLS_RSA_WITH_AES_256_GCM_SHA384 + * MBEDTLS_TLS_RSA_WITH_AES_256_CBC_SHA256 + * MBEDTLS_TLS_RSA_WITH_AES_256_CBC_SHA + * MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_GCM_SHA384 + * MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_CBC_SHA256 + * MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_CBC_SHA + * MBEDTLS_TLS_RSA_WITH_AES_128_GCM_SHA256 + * MBEDTLS_TLS_RSA_WITH_AES_128_CBC_SHA256 + * MBEDTLS_TLS_RSA_WITH_AES_128_CBC_SHA + * MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_GCM_SHA256 + * MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_CBC_SHA256 + * MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_CBC_SHA + * MBEDTLS_TLS_RSA_WITH_3DES_EDE_CBC_SHA + * MBEDTLS_TLS_RSA_WITH_RC4_128_SHA + * MBEDTLS_TLS_RSA_WITH_RC4_128_MD5 + */ + //#define MBEDTLS_KEY_EXCHANGE_RSA_ENABLED + + /** + * \def MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED + * + * Enable the DHE-RSA based ciphersuite modes in SSL / TLS. + * + * Requires: MBEDTLS_DHM_C, MBEDTLS_RSA_C, MBEDTLS_PKCS1_V15, + * MBEDTLS_X509_CRT_PARSE_C + * + * This enables the following ciphersuites (if other requisites are + * enabled as well): + * MBEDTLS_TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 + * MBEDTLS_TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 + * MBEDTLS_TLS_DHE_RSA_WITH_AES_256_CBC_SHA + * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_256_GCM_SHA384 + * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256 + * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA + * MBEDTLS_TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 + * MBEDTLS_TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 + * MBEDTLS_TLS_DHE_RSA_WITH_AES_128_CBC_SHA + * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_128_GCM_SHA256 + * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 + * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA + * MBEDTLS_TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA + */ + //#define MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED + + /** + * \def MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED + * + * Enable the ECDHE-RSA based ciphersuite modes in SSL / TLS. + * + * Requires: MBEDTLS_ECDH_C, MBEDTLS_RSA_C, MBEDTLS_PKCS1_V15, + * MBEDTLS_X509_CRT_PARSE_C + * + * This enables the following ciphersuites (if other requisites are + * enabled as well): + * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 + * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 + * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA + * MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_256_GCM_SHA384 + * MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384 + * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 + * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 + * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA + * MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_128_GCM_SHA256 + * MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 + * MBEDTLS_TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA + * MBEDTLS_TLS_ECDHE_RSA_WITH_RC4_128_SHA + */ + #define MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED + + /** + * \def MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED + * + * Enable the ECDHE-ECDSA based ciphersuite modes in SSL / TLS. + * + * Requires: MBEDTLS_ECDH_C, MBEDTLS_ECDSA_C, MBEDTLS_X509_CRT_PARSE_C, + * + * This enables the following ciphersuites (if other requisites are + * enabled as well): + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_GCM_SHA384 + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_GCM_SHA256 + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_RC4_128_SHA + */ + #define MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED + + /** + * \def MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED + * + * Enable the ECDH-ECDSA based ciphersuite modes in SSL / TLS. + * + * Requires: MBEDTLS_ECDH_C, MBEDTLS_X509_CRT_PARSE_C + * + * This enables the following ciphersuites (if other requisites are + * enabled as well): + * MBEDTLS_TLS_ECDH_ECDSA_WITH_RC4_128_SHA + * MBEDTLS_TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA + * MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA + * MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA + * MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256 + * MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384 + * MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256 + * MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384 + * MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 + * MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 + * MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_128_GCM_SHA256 + * MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_256_GCM_SHA384 + */ + //#define MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED + + /** + * \def MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED + * + * Enable the ECDH-RSA based ciphersuite modes in SSL / TLS. + * + * Requires: MBEDTLS_ECDH_C, MBEDTLS_X509_CRT_PARSE_C + * + * This enables the following ciphersuites (if other requisites are + * enabled as well): + * MBEDTLS_TLS_ECDH_RSA_WITH_RC4_128_SHA + * MBEDTLS_TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA + * MBEDTLS_TLS_ECDH_RSA_WITH_AES_128_CBC_SHA + * MBEDTLS_TLS_ECDH_RSA_WITH_AES_256_CBC_SHA + * MBEDTLS_TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256 + * MBEDTLS_TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384 + * MBEDTLS_TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256 + * MBEDTLS_TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384 + * MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_128_CBC_SHA256 + * MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_256_CBC_SHA384 + * MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_128_GCM_SHA256 + * MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_256_GCM_SHA384 + */ + //#define MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED + + /** + * \def MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED + * + * Enable the ECJPAKE based ciphersuite modes in SSL / TLS. + * + * \warning This is currently experimental. EC J-PAKE support is based on the + * Thread v1.0.0 specification; incompatible changes to the specification + * might still happen. For this reason, this is disabled by default. + * + * Requires: MBEDTLS_ECJPAKE_C + * MBEDTLS_SHA256_C + * MBEDTLS_ECP_DP_SECP256R1_ENABLED + * + * This enables the following ciphersuites (if other requisites are + * enabled as well): + * MBEDTLS_TLS_ECJPAKE_WITH_AES_128_CCM_8 + */ + //#define MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED + + /** + * \def MBEDTLS_PK_PARSE_EC_EXTENDED + * + * Enhance support for reading EC keys using variants of SEC1 not allowed by + * RFC 5915 and RFC 5480. + * + * Currently this means parsing the SpecifiedECDomain choice of EC + * parameters (only known groups are supported, not arbitrary domains, to + * avoid validation issues). + * + * Disable if you only need to support RFC 5915 + 5480 key formats. + */ + //#define MBEDTLS_PK_PARSE_EC_EXTENDED + + /** + * \def MBEDTLS_ERROR_STRERROR_DUMMY + * + * Enable a dummy error function to make use of mbedtls_strerror() in + * third party libraries easier when MBEDTLS_ERROR_C is disabled + * (no effect when MBEDTLS_ERROR_C is enabled). + * + * You can safely disable this if MBEDTLS_ERROR_C is enabled, or if you're + * not using mbedtls_strerror() or error_strerror() in your application. + * + * Disable if you run into name conflicts and want to really remove the + * mbedtls_strerror() + */ + #define MBEDTLS_ERROR_STRERROR_DUMMY + + /** + * \def MBEDTLS_GENPRIME + * + * Enable the prime-number generation code. + * + * Requires: MBEDTLS_BIGNUM_C + */ + //#define MBEDTLS_GENPRIME + + /** + * \def MBEDTLS_FS_IO + * + * Enable functions that use the filesystem. + */ + //#define MBEDTLS_FS_IO + + /** + * \def MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES + * + * Do not add default entropy sources. These are the platform specific, + * mbedtls_timing_hardclock and HAVEGE based poll functions. + * + * This is useful to have more control over the added entropy sources in an + * application. + * + * Uncomment this macro to prevent loading of default entropy functions. + */ + //#define MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES + + /** + * \def MBEDTLS_NO_PLATFORM_ENTROPY + * + * Do not use built-in platform entropy functions. + * This is useful if your platform does not support + * standards like the /dev/urandom or Windows CryptoAPI. + * + * Uncomment this macro to disable the built-in platform entropy functions. + */ + //#define MBEDTLS_NO_PLATFORM_ENTROPY + + /** + * \def MBEDTLS_ENTROPY_FORCE_SHA256 + * + * Force the entropy accumulator to use a SHA-256 accumulator instead of the + * default SHA-512 based one (if both are available). + * + * Requires: MBEDTLS_SHA256_C + * + * On 32-bit systems SHA-256 can be much faster than SHA-512. Use this option + * if you have performance concerns. + * + * This option is only useful if both MBEDTLS_SHA256_C and + * MBEDTLS_SHA512_C are defined. Otherwise the available hash module is used. + */ + //#define MBEDTLS_ENTROPY_FORCE_SHA256 + + /** + * \def MBEDTLS_MEMORY_DEBUG + * + * Enable debugging of buffer allocator memory issues. Automatically prints + * (to stderr) all (fatal) messages on memory allocation issues. Enables + * function for 'debug output' of allocated memory. + * + * Requires: MBEDTLS_MEMORY_BUFFER_ALLOC_C + * + * Uncomment this macro to let the buffer allocator print out error messages. + */ + //#define MBEDTLS_MEMORY_DEBUG + + /** + * \def MBEDTLS_MEMORY_BACKTRACE + * + * Include backtrace information with each allocated block. + * + * Requires: MBEDTLS_MEMORY_BUFFER_ALLOC_C + * GLIBC-compatible backtrace() an backtrace_symbols() support + * + * Uncomment this macro to include backtrace information + */ + //#define MBEDTLS_MEMORY_BACKTRACE + + /** + * \def MBEDTLS_PK_RSA_ALT_SUPPORT + * + * Support external private RSA keys (eg from a HSM) in the PK layer. + * + * Comment this macro to disable support for external private RSA keys. + */ + #define MBEDTLS_PK_RSA_ALT_SUPPORT + + /** + * \def MBEDTLS_PKCS1_V15 + * + * Enable support for PKCS#1 v1.5 encoding. + * + * Requires: MBEDTLS_RSA_C + * + * This enables support for PKCS#1 v1.5 operations. + */ + #define MBEDTLS_PKCS1_V15 + + /** + * \def MBEDTLS_PKCS1_V21 + * + * Enable support for PKCS#1 v2.1 encoding. + * + * Requires: MBEDTLS_MD_C, MBEDTLS_RSA_C + * + * This enables support for RSAES-OAEP and RSASSA-PSS operations. + */ + #define MBEDTLS_PKCS1_V21 + + /** + * \def MBEDTLS_RSA_NO_CRT + * + * Do not use the Chinese Remainder Theorem for the RSA private operation. + * + * Uncomment this macro to disable the use of CRT in RSA. + * + */ + //#define MBEDTLS_RSA_NO_CRT + + /** + * \def MBEDTLS_SELF_TEST + * + * Enable the checkup functions (*_self_test). + */ + #define MBEDTLS_SELF_TEST + + /** + * \def MBEDTLS_SHA256_SMALLER + * + * Enable an implementation of SHA-256 that has lower ROM footprint but also + * lower performance. + * + * The default implementation is meant to be a reasonnable compromise between + * performance and size. This version optimizes more aggressively for size at + * the expense of performance. Eg on Cortex-M4 it reduces the size of + * mbedtls_sha256_process() from ~2KB to ~0.5KB for a performance hit of about + * 30%. + * + * Uncomment to enable the smaller implementation of SHA256. + */ + //#define MBEDTLS_SHA256_SMALLER + + /** + * \def MBEDTLS_SSL_AEAD_RANDOM_IV + * + * Generate a random IV rather than using the record sequence number as a + * nonce for ciphersuites using and AEAD algorithm (GCM or CCM). + * + * Using the sequence number is generally recommended. + * + * Uncomment this macro to always use random IVs with AEAD ciphersuites. + */ + //#define MBEDTLS_SSL_AEAD_RANDOM_IV + + /** + * \def MBEDTLS_SSL_ALL_ALERT_MESSAGES + * + * Enable sending of alert messages in case of encountered errors as per RFC. + * If you choose not to send the alert messages, mbed TLS can still communicate + * with other servers, only debugging of failures is harder. + * + * The advantage of not sending alert messages, is that no information is given + * about reasons for failures thus preventing adversaries of gaining intel. + * + * Enable sending of all alert messages + */ + #define MBEDTLS_SSL_ALL_ALERT_MESSAGES + + /** + * \def MBEDTLS_SSL_DEBUG_ALL + * + * Enable the debug messages in SSL module for all issues. + * Debug messages have been disabled in some places to prevent timing + * attacks due to (unbalanced) debugging function calls. + * + * If you need all error reporting you should enable this during debugging, + * but remove this for production servers that should log as well. + * + * Uncomment this macro to report all debug messages on errors introducing + * a timing side-channel. + * + */ + //#define MBEDTLS_SSL_DEBUG_ALL + + /** \def MBEDTLS_SSL_ENCRYPT_THEN_MAC + * + * Enable support for Encrypt-then-MAC, RFC 7366. + * + * This allows peers that both support it to use a more robust protection for + * ciphersuites using CBC, providing deep resistance against timing attacks + * on the padding or underlying cipher. + * + * This only affects CBC ciphersuites, and is useless if none is defined. + * + * Requires: MBEDTLS_SSL_PROTO_TLS1 or + * MBEDTLS_SSL_PROTO_TLS1_1 or + * MBEDTLS_SSL_PROTO_TLS1_2 + * + * Comment this macro to disable support for Encrypt-then-MAC + */ + #define MBEDTLS_SSL_ENCRYPT_THEN_MAC + + /** \def MBEDTLS_SSL_EXTENDED_MASTER_SECRET + * + * Enable support for Extended Master Secret, aka Session Hash + * (draft-ietf-tls-session-hash-02). + * + * This was introduced as "the proper fix" to the Triple Handshake familiy of + * attacks, but it is recommended to always use it (even if you disable + * renegotiation), since it actually fixes a more fundamental issue in the + * original SSL/TLS design, and has implications beyond Triple Handshake. + * + * Requires: MBEDTLS_SSL_PROTO_TLS1 or + * MBEDTLS_SSL_PROTO_TLS1_1 or + * MBEDTLS_SSL_PROTO_TLS1_2 + * + * Comment this macro to disable support for Extended Master Secret. + */ + #define MBEDTLS_SSL_EXTENDED_MASTER_SECRET + + /** + * \def MBEDTLS_SSL_FALLBACK_SCSV + * + * Enable support for FALLBACK_SCSV (draft-ietf-tls-downgrade-scsv-00). + * + * For servers, it is recommended to always enable this, unless you support + * only one version of TLS, or know for sure that none of your clients + * implements a fallback strategy. + * + * For clients, you only need this if you're using a fallback strategy, which + * is not recommended in the first place, unless you absolutely need it to + * interoperate with buggy (version-intolerant) servers. + * + * Comment this macro to disable support for FALLBACK_SCSV + */ + //#define MBEDTLS_SSL_FALLBACK_SCSV + + /** + * \def MBEDTLS_SSL_HW_RECORD_ACCEL + * + * Enable hooking functions in SSL module for hardware acceleration of + * individual records. + * + * Uncomment this macro to enable hooking functions. + */ + //#define MBEDTLS_SSL_HW_RECORD_ACCEL + + /** + * \def MBEDTLS_SSL_CBC_RECORD_SPLITTING + * + * Enable 1/n-1 record splitting for CBC mode in SSLv3 and TLS 1.0. + * + * This is a countermeasure to the BEAST attack, which also minimizes the risk + * of interoperability issues compared to sending 0-length records. + * + * Comment this macro to disable 1/n-1 record splitting. + */ + //#define MBEDTLS_SSL_CBC_RECORD_SPLITTING + + /** + * \def MBEDTLS_SSL_RENEGOTIATION + * + * Disable support for TLS renegotiation. + * + * The two main uses of renegotiation are (1) refresh keys on long-lived + * connections and (2) client authentication after the initial handshake. + * If you don't need renegotiation, it's probably better to disable it, since + * it has been associated with security issues in the past and is easy to + * misuse/misunderstand. + * + * Comment this to disable support for renegotiation. + */ + #define MBEDTLS_SSL_RENEGOTIATION + + /** + * \def MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO + * + * Enable support for receiving and parsing SSLv2 Client Hello messages for the + * SSL Server module (MBEDTLS_SSL_SRV_C). + * + * Uncomment this macro to enable support for SSLv2 Client Hello messages. + */ + //#define MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO + + /** + * \def MBEDTLS_SSL_SRV_RESPECT_CLIENT_PREFERENCE + * + * Pick the ciphersuite according to the client's preferences rather than ours + * in the SSL Server module (MBEDTLS_SSL_SRV_C). + * + * Uncomment this macro to respect client's ciphersuite order + */ + //#define MBEDTLS_SSL_SRV_RESPECT_CLIENT_PREFERENCE + + /** + * \def MBEDTLS_SSL_MAX_FRAGMENT_LENGTH + * + * Enable support for RFC 6066 max_fragment_length extension in SSL. + * + * Comment this macro to disable support for the max_fragment_length extension + */ + #define MBEDTLS_SSL_MAX_FRAGMENT_LENGTH + + /** + * \def MBEDTLS_SSL_PROTO_SSL3 + * + * Enable support for SSL 3.0. + * + * Requires: MBEDTLS_MD5_C + * MBEDTLS_SHA1_C + * + * Comment this macro to disable support for SSL 3.0 + */ + //#define MBEDTLS_SSL_PROTO_SSL3 + + /** + * \def MBEDTLS_SSL_PROTO_TLS1 + * + * Enable support for TLS 1.0. + * + * Requires: MBEDTLS_MD5_C + * MBEDTLS_SHA1_C + * + * Comment this macro to disable support for TLS 1.0 + */ + //#define MBEDTLS_SSL_PROTO_TLS1 + + /** + * \def MBEDTLS_SSL_PROTO_TLS1_1 + * + * Enable support for TLS 1.1 (and DTLS 1.0 if DTLS is enabled). + * + * Requires: MBEDTLS_MD5_C + * MBEDTLS_SHA1_C + * + * Comment this macro to disable support for TLS 1.1 / DTLS 1.0 + */ + //#define MBEDTLS_SSL_PROTO_TLS1_1 + + /** + * \def MBEDTLS_SSL_PROTO_TLS1_2 + * + * Enable support for TLS 1.2 (and DTLS 1.2 if DTLS is enabled). + * + * Requires: MBEDTLS_SHA1_C or MBEDTLS_SHA256_C or MBEDTLS_SHA512_C + * (Depends on ciphersuites) + * + * Comment this macro to disable support for TLS 1.2 / DTLS 1.2 + */ + #define MBEDTLS_SSL_PROTO_TLS1_2 + + /** + * \def MBEDTLS_SSL_PROTO_DTLS + * + * Enable support for DTLS (all available versions). + * + * Enable this and MBEDTLS_SSL_PROTO_TLS1_1 to enable DTLS 1.0, + * and/or this and MBEDTLS_SSL_PROTO_TLS1_2 to enable DTLS 1.2. + * + * Requires: MBEDTLS_SSL_PROTO_TLS1_1 + * or MBEDTLS_SSL_PROTO_TLS1_2 + * + * Comment this macro to disable support for DTLS + */ + #define MBEDTLS_SSL_PROTO_DTLS + + /** + * \def MBEDTLS_SSL_ALPN + * + * Enable support for RFC 7301 Application Layer Protocol Negotiation. + * + * Comment this macro to disable support for ALPN. + */ + #define MBEDTLS_SSL_ALPN + + /** + * \def MBEDTLS_SSL_DTLS_ANTI_REPLAY + * + * Enable support for the anti-replay mechanism in DTLS. + * + * Requires: MBEDTLS_SSL_TLS_C + * MBEDTLS_SSL_PROTO_DTLS + * + * \warning Disabling this is often a security risk! + * See mbedtls_ssl_conf_dtls_anti_replay() for details. + * + * Comment this to disable anti-replay in DTLS. + */ + #define MBEDTLS_SSL_DTLS_ANTI_REPLAY + + /** + * \def MBEDTLS_SSL_DTLS_HELLO_VERIFY + * + * Enable support for HelloVerifyRequest on DTLS servers. + * + * This feature is highly recommended to prevent DTLS servers being used as + * amplifiers in DoS attacks against other hosts. It should always be enabled + * unless you know for sure amplification cannot be a problem in the + * environment in which your server operates. + * + * \warning Disabling this can ba a security risk! (see above) + * + * Requires: MBEDTLS_SSL_PROTO_DTLS + * + * Comment this to disable support for HelloVerifyRequest. + */ + #define MBEDTLS_SSL_DTLS_HELLO_VERIFY + + /** + * \def MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE + * + * Enable server-side support for clients that reconnect from the same port. + * + * Some clients unexpectedly close the connection and try to reconnect using the + * same source port. This needs special support from the server to handle the + * new connection securely, as described in section 4.2.8 of RFC 6347. This + * flag enables that support. + * + * Requires: MBEDTLS_SSL_DTLS_HELLO_VERIFY + * + * Comment this to disable support for clients reusing the source port. + */ + #define MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE + + /** + * \def MBEDTLS_SSL_DTLS_BADMAC_LIMIT + * + * Enable support for a limit of records with bad MAC. + * + * See mbedtls_ssl_conf_dtls_badmac_limit(). + * + * Requires: MBEDTLS_SSL_PROTO_DTLS + */ + #define MBEDTLS_SSL_DTLS_BADMAC_LIMIT + + /** + * \def MBEDTLS_SSL_SESSION_TICKETS + * + * Enable support for RFC 5077 session tickets in SSL. + * Client-side, provides full support for session tickets (maintainance of a + * session store remains the responsibility of the application, though). + * Server-side, you also need to provide callbacks for writing and parsing + * tickets, including authenticated encryption and key management. Example + * callbacks are provided by MBEDTLS_SSL_TICKET_C. + * + * Comment this macro to disable support for SSL session tickets + */ + #define MBEDTLS_SSL_SESSION_TICKETS + + /** + * \def MBEDTLS_SSL_EXPORT_KEYS + * + * Enable support for exporting key block and master secret. + * This is required for certain users of TLS, e.g. EAP-TLS. + * + * Comment this macro to disable support for key export + */ + #define MBEDTLS_SSL_EXPORT_KEYS + + /** + * \def MBEDTLS_SSL_SERVER_NAME_INDICATION + * + * Enable support for RFC 6066 server name indication (SNI) in SSL. + * + * Requires: MBEDTLS_X509_CRT_PARSE_C + * + * Comment this macro to disable support for server name indication in SSL + */ + #define MBEDTLS_SSL_SERVER_NAME_INDICATION + + /** + * \def MBEDTLS_SSL_TRUNCATED_HMAC + * + * Enable support for RFC 6066 truncated HMAC in SSL. + * + * Comment this macro to disable support for truncated HMAC in SSL + */ + //#define MBEDTLS_SSL_TRUNCATED_HMAC + + /** + * \def MBEDTLS_THREADING_ALT + * + * Provide your own alternate threading implementation. + * + * Requires: MBEDTLS_THREADING_C + * + * Uncomment this to allow your own alternate threading implementation. + */ + //#define MBEDTLS_THREADING_ALT + + /** + * \def MBEDTLS_THREADING_PTHREAD + * + * Enable the pthread wrapper layer for the threading layer. + * + * Requires: MBEDTLS_THREADING_C + * + * Uncomment this to enable pthread mutexes. + */ + //#define MBEDTLS_THREADING_PTHREAD + + /** + * \def MBEDTLS_VERSION_FEATURES + * + * Allow run-time checking of compile-time enabled features. Thus allowing users + * to check at run-time if the library is for instance compiled with threading + * support via mbedtls_version_check_feature(). + * + * Requires: MBEDTLS_VERSION_C + * + * Comment this to disable run-time checking and save ROM space + */ + #define MBEDTLS_VERSION_FEATURES + + /** + * \def MBEDTLS_X509_ALLOW_EXTENSIONS_NON_V3 + * + * If set, the X509 parser will not break-off when parsing an X509 certificate + * and encountering an extension in a v1 or v2 certificate. + * + * Uncomment to prevent an error. + */ + //#define MBEDTLS_X509_ALLOW_EXTENSIONS_NON_V3 + + /** + * \def MBEDTLS_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION + * + * If set, the X509 parser will not break-off when parsing an X509 certificate + * and encountering an unknown critical extension. + * + * \warning Depending on your PKI use, enabling this can be a security risk! + * + * Uncomment to prevent an error. + */ + //#define MBEDTLS_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION + + /** + * \def MBEDTLS_X509_CHECK_KEY_USAGE + * + * Enable verification of the keyUsage extension (CA and leaf certificates). + * + * Disabling this avoids problems with mis-issued and/or misused + * (intermediate) CA and leaf certificates. + * + * \warning Depending on your PKI use, disabling this can be a security risk! + * + * Comment to skip keyUsage checking for both CA and leaf certificates. + */ + #define MBEDTLS_X509_CHECK_KEY_USAGE + + /** + * \def MBEDTLS_X509_CHECK_EXTENDED_KEY_USAGE + * + * Enable verification of the extendedKeyUsage extension (leaf certificates). + * + * Disabling this avoids problems with mis-issued and/or misused certificates. + * + * \warning Depending on your PKI use, disabling this can be a security risk! + * + * Comment to skip extendedKeyUsage checking for certificates. + */ + #define MBEDTLS_X509_CHECK_EXTENDED_KEY_USAGE + + /** + * \def MBEDTLS_X509_RSASSA_PSS_SUPPORT + * + * Enable parsing and verification of X.509 certificates, CRLs and CSRS + * signed with RSASSA-PSS (aka PKCS#1 v2.1). + * + * Comment this macro to disallow using RSASSA-PSS in certificates. + */ + //#define MBEDTLS_X509_RSASSA_PSS_SUPPORT + + /** + * \def MBEDTLS_ZLIB_SUPPORT + * + * If set, the SSL/TLS module uses ZLIB to support compression and + * decompression of packet data. + * + * \warning TLS-level compression MAY REDUCE SECURITY! See for example the + * CRIME attack. Before enabling this option, you should examine with care if + * CRIME or similar exploits may be a applicable to your use case. + * + * \note Currently compression can't be used with DTLS. + * + * Used in: library/ssl_tls.c + * library/ssl_cli.c + * library/ssl_srv.c + * + * This feature requires zlib library and headers to be present. + * + * Uncomment to enable use of ZLIB + */ + //#define MBEDTLS_ZLIB_SUPPORT + /* \} name SECTION: mbed TLS feature support */ + + /** + * \name SECTION: mbed TLS modules + * + * This section enables or disables entire modules in mbed TLS + * \{ + */ + + /** + * \def MBEDTLS_AESNI_C + * + * Enable AES-NI support on x86-64. + * + * Module: library/aesni.c + * Caller: library/aes.c + * + * Requires: MBEDTLS_HAVE_ASM + * + * This modules adds support for the AES-NI instructions on x86-64 + */ + //#define MBEDTLS_AESNI_C + + /** + * \def MBEDTLS_AES_C + * + * Enable the AES block cipher. + * + * Module: library/aes.c + * Caller: library/ssl_tls.c + * library/pem.c + * library/ctr_drbg.c + * + * This module enables the following ciphersuites (if other requisites are + * enabled as well): + * MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA + * MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA + * MBEDTLS_TLS_ECDH_RSA_WITH_AES_128_CBC_SHA + * MBEDTLS_TLS_ECDH_RSA_WITH_AES_256_CBC_SHA + * MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256 + * MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384 + * MBEDTLS_TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256 + * MBEDTLS_TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384 + * MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256 + * MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384 + * MBEDTLS_TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256 + * MBEDTLS_TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384 + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 + * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 + * MBEDTLS_TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 + * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 + * MBEDTLS_TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA + * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA + * MBEDTLS_TLS_DHE_RSA_WITH_AES_256_CBC_SHA + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 + * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 + * MBEDTLS_TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 + * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 + * MBEDTLS_TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA + * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA + * MBEDTLS_TLS_DHE_RSA_WITH_AES_128_CBC_SHA + * MBEDTLS_TLS_DHE_PSK_WITH_AES_256_GCM_SHA384 + * MBEDTLS_TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA384 + * MBEDTLS_TLS_DHE_PSK_WITH_AES_256_CBC_SHA384 + * MBEDTLS_TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA + * MBEDTLS_TLS_DHE_PSK_WITH_AES_256_CBC_SHA + * MBEDTLS_TLS_DHE_PSK_WITH_AES_128_GCM_SHA256 + * MBEDTLS_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256 + * MBEDTLS_TLS_DHE_PSK_WITH_AES_128_CBC_SHA256 + * MBEDTLS_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA + * MBEDTLS_TLS_DHE_PSK_WITH_AES_128_CBC_SHA + * MBEDTLS_TLS_RSA_WITH_AES_256_GCM_SHA384 + * MBEDTLS_TLS_RSA_WITH_AES_256_CBC_SHA256 + * MBEDTLS_TLS_RSA_WITH_AES_256_CBC_SHA + * MBEDTLS_TLS_RSA_WITH_AES_128_GCM_SHA256 + * MBEDTLS_TLS_RSA_WITH_AES_128_CBC_SHA256 + * MBEDTLS_TLS_RSA_WITH_AES_128_CBC_SHA + * MBEDTLS_TLS_RSA_PSK_WITH_AES_256_GCM_SHA384 + * MBEDTLS_TLS_RSA_PSK_WITH_AES_256_CBC_SHA384 + * MBEDTLS_TLS_RSA_PSK_WITH_AES_256_CBC_SHA + * MBEDTLS_TLS_RSA_PSK_WITH_AES_128_GCM_SHA256 + * MBEDTLS_TLS_RSA_PSK_WITH_AES_128_CBC_SHA256 + * MBEDTLS_TLS_RSA_PSK_WITH_AES_128_CBC_SHA + * MBEDTLS_TLS_PSK_WITH_AES_256_GCM_SHA384 + * MBEDTLS_TLS_PSK_WITH_AES_256_CBC_SHA384 + * MBEDTLS_TLS_PSK_WITH_AES_256_CBC_SHA + * MBEDTLS_TLS_PSK_WITH_AES_128_GCM_SHA256 + * MBEDTLS_TLS_PSK_WITH_AES_128_CBC_SHA256 + * MBEDTLS_TLS_PSK_WITH_AES_128_CBC_SHA + * + * PEM_PARSE uses AES for decrypting encrypted keys. + */ + #define MBEDTLS_AES_C + + /** + * \def MBEDTLS_ARC4_C + * + * Enable the ARCFOUR stream cipher. + * + * Module: library/arc4.c + * Caller: library/ssl_tls.c + * + * This module enables the following ciphersuites (if other requisites are + * enabled as well): + * MBEDTLS_TLS_ECDH_ECDSA_WITH_RC4_128_SHA + * MBEDTLS_TLS_ECDH_RSA_WITH_RC4_128_SHA + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_RC4_128_SHA + * MBEDTLS_TLS_ECDHE_RSA_WITH_RC4_128_SHA + * MBEDTLS_TLS_ECDHE_PSK_WITH_RC4_128_SHA + * MBEDTLS_TLS_DHE_PSK_WITH_RC4_128_SHA + * MBEDTLS_TLS_RSA_WITH_RC4_128_SHA + * MBEDTLS_TLS_RSA_WITH_RC4_128_MD5 + * MBEDTLS_TLS_RSA_PSK_WITH_RC4_128_SHA + * MBEDTLS_TLS_PSK_WITH_RC4_128_SHA + */ + //#define MBEDTLS_ARC4_C + + /** + * \def MBEDTLS_ASN1_PARSE_C + * + * Enable the generic ASN1 parser. + * + * Module: library/asn1.c + * Caller: library/x509.c + * library/dhm.c + * library/pkcs12.c + * library/pkcs5.c + * library/pkparse.c + */ + #define MBEDTLS_ASN1_PARSE_C + + /** + * \def MBEDTLS_ASN1_WRITE_C + * + * Enable the generic ASN1 writer. + * + * Module: library/asn1write.c + * Caller: library/ecdsa.c + * library/pkwrite.c + * library/x509_create.c + * library/x509write_crt.c + * library/mbedtls_x509write_csr.c + */ + #define MBEDTLS_ASN1_WRITE_C + + /** + * \def MBEDTLS_BASE64_C + * + * Enable the Base64 module. + * + * Module: library/base64.c + * Caller: library/pem.c + * + * This module is required for PEM support (required by X.509). + */ + #define MBEDTLS_BASE64_C + + /** + * \def MBEDTLS_BIGNUM_C + * + * Enable the multi-precision integer library. + * + * Module: library/bignum.c + * Caller: library/dhm.c + * library/ecp.c + * library/ecdsa.c + * library/rsa.c + * library/ssl_tls.c + * + * This module is required for RSA, DHM and ECC (ECDH, ECDSA) support. + */ + #define MBEDTLS_BIGNUM_C + + /** + * \def MBEDTLS_BLOWFISH_C + * + * Enable the Blowfish block cipher. + * + * Module: library/blowfish.c + */ + //#define MBEDTLS_BLOWFISH_C + + /** + * \def MBEDTLS_CAMELLIA_C + * + * Enable the Camellia block cipher. + * + * Module: library/camellia.c + * Caller: library/ssl_tls.c + * + * This module enables the following ciphersuites (if other requisites are + * enabled as well): + * MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 + * MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 + * MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_128_CBC_SHA256 + * MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_256_CBC_SHA384 + * MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_128_GCM_SHA256 + * MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_256_GCM_SHA384 + * MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_128_GCM_SHA256 + * MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_256_GCM_SHA384 + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_GCM_SHA384 + * MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_256_GCM_SHA384 + * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_256_GCM_SHA384 + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 + * MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384 + * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256 + * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_GCM_SHA256 + * MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_128_GCM_SHA256 + * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_128_GCM_SHA256 + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 + * MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 + * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 + * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA + * MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_256_GCM_SHA384 + * MBEDTLS_TLS_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 + * MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 + * MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_128_GCM_SHA256 + * MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 + * MBEDTLS_TLS_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 + * MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_GCM_SHA384 + * MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_CBC_SHA256 + * MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_CBC_SHA + * MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_GCM_SHA256 + * MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_CBC_SHA256 + * MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_CBC_SHA + * MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_256_GCM_SHA384 + * MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384 + * MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_128_GCM_SHA256 + * MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256 + * MBEDTLS_TLS_PSK_WITH_CAMELLIA_256_GCM_SHA384 + * MBEDTLS_TLS_PSK_WITH_CAMELLIA_256_CBC_SHA384 + * MBEDTLS_TLS_PSK_WITH_CAMELLIA_128_GCM_SHA256 + * MBEDTLS_TLS_PSK_WITH_CAMELLIA_128_CBC_SHA256 + */ + //#define MBEDTLS_CAMELLIA_C + + /** + * \def MBEDTLS_CCM_C + * + * Enable the Counter with CBC-MAC (CCM) mode for 128-bit block cipher. + * + * Module: library/ccm.c + * + * Requires: MBEDTLS_AES_C or MBEDTLS_CAMELLIA_C + * + * This module enables the AES-CCM ciphersuites, if other requisites are + * enabled as well. + */ + #define MBEDTLS_CCM_C + + /** + * \def MBEDTLS_CERTS_C + * + * Enable the test certificates. + * + * Module: library/certs.c + * Caller: + * + * This module is used for testing (ssl_client/server). + */ + #define MBEDTLS_CERTS_C + + /** + * \def MBEDTLS_CIPHER_C + * + * Enable the generic cipher layer. + * + * Module: library/cipher.c + * Caller: library/ssl_tls.c + * + * Uncomment to enable generic cipher wrappers. + */ + #define MBEDTLS_CIPHER_C + + /** + * \def MBEDTLS_CTR_DRBG_C + * + * Enable the CTR_DRBG AES-256-based random generator. + * + * Module: library/ctr_drbg.c + * Caller: + * + * Requires: MBEDTLS_AES_C + * + * This module provides the CTR_DRBG AES-256 random number generator. + */ + #define MBEDTLS_CTR_DRBG_C + + /** + * \def MBEDTLS_DEBUG_C + * + * Enable the debug functions. + * + * Module: library/debug.c + * Caller: library/ssl_cli.c + * library/ssl_srv.c + * library/ssl_tls.c + * + * This module provides debugging functions. + */ + #define MBEDTLS_DEBUG_C + + /** + * \def MBEDTLS_DES_C + * + * Enable the DES block cipher. + * + * Module: library/des.c + * Caller: library/pem.c + * library/ssl_tls.c + * + * This module enables the following ciphersuites (if other requisites are + * enabled as well): + * MBEDTLS_TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA + * MBEDTLS_TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA + * MBEDTLS_TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA + * MBEDTLS_TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA + * MBEDTLS_TLS_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA + * MBEDTLS_TLS_DHE_PSK_WITH_3DES_EDE_CBC_SHA + * MBEDTLS_TLS_RSA_WITH_3DES_EDE_CBC_SHA + * MBEDTLS_TLS_RSA_PSK_WITH_3DES_EDE_CBC_SHA + * MBEDTLS_TLS_PSK_WITH_3DES_EDE_CBC_SHA + * + * PEM_PARSE uses DES/3DES for decrypting encrypted keys. + */ + //#define MBEDTLS_DES_C + + /** + * \def MBEDTLS_DHM_C + * + * Enable the Diffie-Hellman-Merkle module. + * + * Module: library/dhm.c + * Caller: library/ssl_cli.c + * library/ssl_srv.c + * + * This module is used by the following key exchanges: + * DHE-RSA, DHE-PSK + */ + //#define MBEDTLS_DHM_C + + /** + * \def MBEDTLS_ECDH_C + * + * Enable the elliptic curve Diffie-Hellman library. + * + * Module: library/ecdh.c + * Caller: library/ssl_cli.c + * library/ssl_srv.c + * + * This module is used by the following key exchanges: + * ECDHE-ECDSA, ECDHE-RSA, DHE-PSK + * + * Requires: MBEDTLS_ECP_C + */ + #define MBEDTLS_ECDH_C + + /** + * \def MBEDTLS_ECDSA_C + * + * Enable the elliptic curve DSA library. + * + * Module: library/ecdsa.c + * Caller: + * + * This module is used by the following key exchanges: + * ECDHE-ECDSA + * + * Requires: MBEDTLS_ECP_C, MBEDTLS_ASN1_WRITE_C, MBEDTLS_ASN1_PARSE_C + */ + #define MBEDTLS_ECDSA_C + + /** + * \def MBEDTLS_ECJPAKE_C + * + * Enable the elliptic curve J-PAKE library. + * + * \warning This is currently experimental. EC J-PAKE support is based on the + * Thread v1.0.0 specification; incompatible changes to the specification + * might still happen. For this reason, this is disabled by default. + * + * Module: library/ecjpake.c + * Caller: + * + * This module is used by the following key exchanges: + * ECJPAKE + * + * Requires: MBEDTLS_ECP_C, MBEDTLS_MD_C + */ + //#define MBEDTLS_ECJPAKE_C + + /** + * \def MBEDTLS_ECP_C + * + * Enable the elliptic curve over GF(p) library. + * + * Module: library/ecp.c + * Caller: library/ecdh.c + * library/ecdsa.c + * library/ecjpake.c + * + * Requires: MBEDTLS_BIGNUM_C and at least one MBEDTLS_ECP_DP_XXX_ENABLED + */ + #define MBEDTLS_ECP_C + + /** + * \def MBEDTLS_ENTROPY_C + * + * Enable the platform-specific entropy code. + * + * Module: library/entropy.c + * Caller: + * + * Requires: MBEDTLS_SHA512_C or MBEDTLS_SHA256_C + * + * This module provides a generic entropy pool + */ + #define MBEDTLS_ENTROPY_C + + /** + * \def MBEDTLS_ERROR_C + * + * Enable error code to error string conversion. + * + * Module: library/error.c + * Caller: + * + * This module enables mbedtls_strerror(). + */ + #define MBEDTLS_ERROR_C + + /** + * \def MBEDTLS_GCM_C + * + * Enable the Galois/Counter Mode (GCM) for AES. + * + * Module: library/gcm.c + * + * Requires: MBEDTLS_AES_C or MBEDTLS_CAMELLIA_C + * + * This module enables the AES-GCM and CAMELLIA-GCM ciphersuites, if other + * requisites are enabled as well. + */ + #define MBEDTLS_GCM_C + + /** + * \def MBEDTLS_HAVEGE_C + * + * Enable the HAVEGE random generator. + * + * Warning: the HAVEGE random generator is not suitable for virtualized + * environments + * + * Warning: the HAVEGE random generator is dependent on timing and specific + * processor traits. It is therefore not advised to use HAVEGE as + * your applications primary random generator or primary entropy pool + * input. As a secondary input to your entropy pool, it IS able add + * the (limited) extra entropy it provides. + * + * Module: library/havege.c + * Caller: + * + * Requires: MBEDTLS_TIMING_C + * + * Uncomment to enable the HAVEGE random generator. + */ + //#define MBEDTLS_HAVEGE_C + + /** + * \def MBEDTLS_HMAC_DRBG_C + * + * Enable the HMAC_DRBG random generator. + * + * Module: library/hmac_drbg.c + * Caller: + * + * Requires: MBEDTLS_MD_C + * + * Uncomment to enable the HMAC_DRBG random number geerator. + */ + #define MBEDTLS_HMAC_DRBG_C + + /** + * \def MBEDTLS_MD_C + * + * Enable the generic message digest layer. + * + * Module: library/mbedtls_md.c + * Caller: + * + * Uncomment to enable generic message digest wrappers. + */ + #define MBEDTLS_MD_C + + /** + * \def MBEDTLS_MD2_C + * + * Enable the MD2 hash algorithm. + * + * Module: library/mbedtls_md2.c + * Caller: + * + * Uncomment to enable support for (rare) MD2-signed X.509 certs. + */ + //#define MBEDTLS_MD2_C + + /** + * \def MBEDTLS_MD4_C + * + * Enable the MD4 hash algorithm. + * + * Module: library/mbedtls_md4.c + * Caller: + * + * Uncomment to enable support for (rare) MD4-signed X.509 certs. + */ + //#define MBEDTLS_MD4_C + + /** + * \def MBEDTLS_MD5_C + * + * Enable the MD5 hash algorithm. + * + * Module: library/mbedtls_md5.c + * Caller: library/mbedtls_md.c + * library/pem.c + * library/ssl_tls.c + * + * This module is required for SSL/TLS and X.509. + * PEM_PARSE uses MD5 for decrypting encrypted keys. + */ + //#define MBEDTLS_MD5_C + + /** + * \def MBEDTLS_MEMORY_BUFFER_ALLOC_C + * + * Enable the buffer allocator implementation that makes use of a (stack) + * based buffer to 'allocate' dynamic memory. (replaces calloc() and free() + * calls) + * + * Module: library/memory_buffer_alloc.c + * + * Requires: MBEDTLS_PLATFORM_C + * MBEDTLS_PLATFORM_MEMORY (to use it within mbed TLS) + * + * Enable this module to enable the buffer memory allocator. + */ + //#define MBEDTLS_MEMORY_BUFFER_ALLOC_C + + /** + * \def MBEDTLS_NET_C + * + * Enable the TCP/IP networking routines. + * + * Module: library/net.c + * + * This module provides TCP/IP networking routines. + */ + //#define MBEDTLS_NET_C + + /** + * \def MBEDTLS_OID_C + * + * Enable the OID database. + * + * Module: library/oid.c + * Caller: library/asn1write.c + * library/pkcs5.c + * library/pkparse.c + * library/pkwrite.c + * library/rsa.c + * library/x509.c + * library/x509_create.c + * library/mbedtls_x509_crl.c + * library/mbedtls_x509_crt.c + * library/mbedtls_x509_csr.c + * library/x509write_crt.c + * library/mbedtls_x509write_csr.c + * + * This modules translates between OIDs and internal values. + */ + #define MBEDTLS_OID_C + + /** + * \def MBEDTLS_PADLOCK_C + * + * Enable VIA Padlock support on x86. + * + * Module: library/padlock.c + * Caller: library/aes.c + * + * Requires: MBEDTLS_HAVE_ASM + * + * This modules adds support for the VIA PadLock on x86. + */ + //#define MBEDTLS_PADLOCK_C + + /** + * \def MBEDTLS_PEM_PARSE_C + * + * Enable PEM decoding / parsing. + * + * Module: library/pem.c + * Caller: library/dhm.c + * library/pkparse.c + * library/mbedtls_x509_crl.c + * library/mbedtls_x509_crt.c + * library/mbedtls_x509_csr.c + * + * Requires: MBEDTLS_BASE64_C + * + * This modules adds support for decoding / parsing PEM files. + */ + #define MBEDTLS_PEM_PARSE_C + + /** + * \def MBEDTLS_PEM_WRITE_C + * + * Enable PEM encoding / writing. + * + * Module: library/pem.c + * Caller: library/pkwrite.c + * library/x509write_crt.c + * library/mbedtls_x509write_csr.c + * + * Requires: MBEDTLS_BASE64_C + * + * This modules adds support for encoding / writing PEM files. + */ + //#define MBEDTLS_PEM_WRITE_C + + /** + * \def MBEDTLS_PK_C + * + * Enable the generic public (asymetric) key layer. + * + * Module: library/pk.c + * Caller: library/ssl_tls.c + * library/ssl_cli.c + * library/ssl_srv.c + * + * Requires: MBEDTLS_RSA_C or MBEDTLS_ECP_C + * + * Uncomment to enable generic public key wrappers. + */ + #define MBEDTLS_PK_C + + /** + * \def MBEDTLS_PK_PARSE_C + * + * Enable the generic public (asymetric) key parser. + * + * Module: library/pkparse.c + * Caller: library/mbedtls_x509_crt.c + * library/mbedtls_x509_csr.c + * + * Requires: MBEDTLS_PK_C + * + * Uncomment to enable generic public key parse functions. + */ + #define MBEDTLS_PK_PARSE_C + + /** + * \def MBEDTLS_PK_WRITE_C + * + * Enable the generic public (asymetric) key writer. + * + * Module: library/pkwrite.c + * Caller: library/x509write.c + * + * Requires: MBEDTLS_PK_C + * + * Uncomment to enable generic public key write functions. + */ + #define MBEDTLS_PK_WRITE_C + + /** + * \def MBEDTLS_PKCS5_C + * + * Enable PKCS#5 functions. + * + * Module: library/pkcs5.c + * + * Requires: MBEDTLS_MD_C + * + * This module adds support for the PKCS#5 functions. + */ + //#define MBEDTLS_PKCS5_C + + /** + * \def MBEDTLS_PKCS11_C + * + * Enable wrapper for PKCS#11 smartcard support. + * + * Module: library/pkcs11.c + * Caller: library/pk.c + * + * Requires: MBEDTLS_PK_C + * + * This module enables SSL/TLS PKCS #11 smartcard support. + * Requires the presence of the PKCS#11 helper library (libpkcs11-helper) + */ + //#define MBEDTLS_PKCS11_C + + /** + * \def MBEDTLS_PKCS12_C + * + * Enable PKCS#12 PBE functions. + * Adds algorithms for parsing PKCS#8 encrypted private keys + * + * Module: library/pkcs12.c + * Caller: library/pkparse.c + * + * Requires: MBEDTLS_ASN1_PARSE_C, MBEDTLS_CIPHER_C, MBEDTLS_MD_C + * Can use: MBEDTLS_ARC4_C + * + * This module enables PKCS#12 functions. + */ + //#define MBEDTLS_PKCS12_C + + /** + * \def MBEDTLS_PLATFORM_C + * + * Enable the platform abstraction layer that allows you to re-assign + * functions like calloc(), free(), snprintf(), printf(), fprintf(), exit(). + * + * Enabling MBEDTLS_PLATFORM_C enables to use of MBEDTLS_PLATFORM_XXX_ALT + * or MBEDTLS_PLATFORM_XXX_MACRO directives, allowing the functions mentioned + * above to be specified at runtime or compile time respectively. + * + * \note This abstraction layer must be enabled on Windows (including MSYS2) + * as other module rely on it for a fixed snprintf implementation. + * + * Module: library/platform.c + * Caller: Most other .c files + * + * This module enables abstraction of common (libc) functions. + */ + #define MBEDTLS_PLATFORM_C + + /** + * \def MBEDTLS_RIPEMD160_C + * + * Enable the RIPEMD-160 hash algorithm. + * + * Module: library/mbedtls_ripemd160.c + * Caller: library/mbedtls_md.c + * + */ + //#define MBEDTLS_RIPEMD160_C + + /** + * \def MBEDTLS_RSA_C + * + * Enable the RSA public-key cryptosystem. + * + * Module: library/rsa.c + * Caller: library/ssl_cli.c + * library/ssl_srv.c + * library/ssl_tls.c + * library/x509.c + * + * This module is used by the following key exchanges: + * RSA, DHE-RSA, ECDHE-RSA, RSA-PSK + * + * Requires: MBEDTLS_BIGNUM_C, MBEDTLS_OID_C + */ + #define MBEDTLS_RSA_C + + /** + * \def MBEDTLS_SHA1_C + * + * Enable the SHA1 cryptographic hash algorithm. + * + * Module: library/mbedtls_sha1.c + * Caller: library/mbedtls_md.c + * library/ssl_cli.c + * library/ssl_srv.c + * library/ssl_tls.c + * library/x509write_crt.c + * + * This module is required for SSL/TLS and SHA1-signed certificates. + */ + //#define MBEDTLS_SHA1_C + + /** + * \def MBEDTLS_SHA256_C + * + * Enable the SHA-224 and SHA-256 cryptographic hash algorithms. + * + * Module: library/mbedtls_sha256.c + * Caller: library/entropy.c + * library/mbedtls_md.c + * library/ssl_cli.c + * library/ssl_srv.c + * library/ssl_tls.c + * + * This module adds support for SHA-224 and SHA-256. + * This module is required for the SSL/TLS 1.2 PRF function. + */ + #define MBEDTLS_SHA256_C + + /** + * \def MBEDTLS_SHA512_C + * + * Enable the SHA-384 and SHA-512 cryptographic hash algorithms. + * + * Module: library/mbedtls_sha512.c + * Caller: library/entropy.c + * library/mbedtls_md.c + * library/ssl_cli.c + * library/ssl_srv.c + * + * This module adds support for SHA-384 and SHA-512. + */ + #define MBEDTLS_SHA512_C + + /** + * \def MBEDTLS_SSL_CACHE_C + * + * Enable simple SSL cache implementation. + * + * Module: library/ssl_cache.c + * Caller: + * + * Requires: MBEDTLS_SSL_CACHE_C + */ + #define MBEDTLS_SSL_CACHE_C + + /** + * \def MBEDTLS_SSL_COOKIE_C + * + * Enable basic implementation of DTLS cookies for hello verification. + * + * Module: library/ssl_cookie.c + * Caller: + */ + #define MBEDTLS_SSL_COOKIE_C + + /** + * \def MBEDTLS_SSL_TICKET_C + * + * Enable an implementation of TLS server-side callbacks for session tickets. + * + * Module: library/ssl_ticket.c + * Caller: + * + * Requires: MBEDTLS_CIPHER_C + */ + #define MBEDTLS_SSL_TICKET_C + + /** + * \def MBEDTLS_SSL_CLI_C + * + * Enable the SSL/TLS client code. + * + * Module: library/ssl_cli.c + * Caller: + * + * Requires: MBEDTLS_SSL_TLS_C + * + * This module is required for SSL/TLS client support. + */ + #define MBEDTLS_SSL_CLI_C + + /** + * \def MBEDTLS_SSL_SRV_C + * + * Enable the SSL/TLS server code. + * + * Module: library/ssl_srv.c + * Caller: + * + * Requires: MBEDTLS_SSL_TLS_C + * + * This module is required for SSL/TLS server support. + */ + #define MBEDTLS_SSL_SRV_C + + /** + * \def MBEDTLS_SSL_TLS_C + * + * Enable the generic SSL/TLS code. + * + * Module: library/ssl_tls.c + * Caller: library/ssl_cli.c + * library/ssl_srv.c + * + * Requires: MBEDTLS_CIPHER_C, MBEDTLS_MD_C + * and at least one of the MBEDTLS_SSL_PROTO_XXX defines + * + * This module is required for SSL/TLS. + */ + #define MBEDTLS_SSL_TLS_C + + /** + * \def MBEDTLS_THREADING_C + * + * Enable the threading abstraction layer. + * By default mbed TLS assumes it is used in a non-threaded environment or that + * contexts are not shared between threads. If you do intend to use contexts + * between threads, you will need to enable this layer to prevent race + * conditions. + * + * Module: library/threading.c + * + * This allows different threading implementations (self-implemented or + * provided). + * + * You will have to enable either MBEDTLS_THREADING_ALT or + * MBEDTLS_THREADING_PTHREAD. + * + * Enable this layer to allow use of mutexes within mbed TLS + */ + //#define MBEDTLS_THREADING_C + + /** + * \def MBEDTLS_TIMING_C + * + * Enable the portable timing interface. + * + * Module: library/timing.c + * Caller: library/havege.c + * + * This module is used by the HAVEGE random number generator. + */ + //#define MBEDTLS_TIMING_C + + /** + * \def MBEDTLS_VERSION_C + * + * Enable run-time version information. + * + * Module: library/version.c + * + * This module provides run-time version information. + */ + #define MBEDTLS_VERSION_C + + /** + * \def MBEDTLS_X509_USE_C + * + * Enable X.509 core for using certificates. + * + * Module: library/x509.c + * Caller: library/mbedtls_x509_crl.c + * library/mbedtls_x509_crt.c + * library/mbedtls_x509_csr.c + * + * Requires: MBEDTLS_ASN1_PARSE_C, MBEDTLS_BIGNUM_C, MBEDTLS_OID_C, + * MBEDTLS_PK_PARSE_C + * + * This module is required for the X.509 parsing modules. + */ + #define MBEDTLS_X509_USE_C + + /** + * \def MBEDTLS_X509_CRT_PARSE_C + * + * Enable X.509 certificate parsing. + * + * Module: library/mbedtls_x509_crt.c + * Caller: library/ssl_cli.c + * library/ssl_srv.c + * library/ssl_tls.c + * + * Requires: MBEDTLS_X509_USE_C + * + * This module is required for X.509 certificate parsing. + */ + #define MBEDTLS_X509_CRT_PARSE_C + + /** + * \def MBEDTLS_X509_CRL_PARSE_C + * + * Enable X.509 CRL parsing. + * + * Module: library/mbedtls_x509_crl.c + * Caller: library/mbedtls_x509_crt.c + * + * Requires: MBEDTLS_X509_USE_C + * + * This module is required for X.509 CRL parsing. + */ + #define MBEDTLS_X509_CRL_PARSE_C + + /** + * \def MBEDTLS_X509_CSR_PARSE_C + * + * Enable X.509 Certificate Signing Request (CSR) parsing. + * + * Module: library/mbedtls_x509_csr.c + * Caller: library/x509_crt_write.c + * + * Requires: MBEDTLS_X509_USE_C + * + * This module is used for reading X.509 certificate request. + */ + //#define MBEDTLS_X509_CSR_PARSE_C + + /** + * \def MBEDTLS_X509_CREATE_C + * + * Enable X.509 core for creating certificates. + * + * Module: library/x509_create.c + * + * Requires: MBEDTLS_BIGNUM_C, MBEDTLS_OID_C, MBEDTLS_PK_WRITE_C + * + * This module is the basis for creating X.509 certificates and CSRs. + */ + //#define MBEDTLS_X509_CREATE_C + + /** + * \def MBEDTLS_X509_CRT_WRITE_C + * + * Enable creating X.509 certificates. + * + * Module: library/x509_crt_write.c + * + * Requires: MBEDTLS_X509_CREATE_C + * + * This module is required for X.509 certificate creation. + */ + //#define MBEDTLS_X509_CRT_WRITE_C + + /** + * \def MBEDTLS_X509_CSR_WRITE_C + * + * Enable creating X.509 Certificate Signing Requests (CSR). + * + * Module: library/x509_csr_write.c + * + * Requires: MBEDTLS_X509_CREATE_C + * + * This module is required for X.509 certificate request writing. + */ + //#define MBEDTLS_X509_CSR_WRITE_C + + /** + * \def MBEDTLS_XTEA_C + * + * Enable the XTEA block cipher. + * + * Module: library/xtea.c + * Caller: + */ + //#define MBEDTLS_XTEA_C + + /* \} name SECTION: mbed TLS modules */ + + /** + * \name SECTION: Module configuration options + * + * This section allows for the setting of module specific sizes and + * configuration options. The default values are already present in the + * relevant header files and should suffice for the regular use cases. + * + * Our advice is to enable options and change their values here + * only if you have a good reason and know the consequences. + * + * Please check the respective header file for documentation on these + * parameters (to prevent duplicate documentation). + * \{ + */ + + /* MPI / BIGNUM options */ + //#define MBEDTLS_MPI_WINDOW_SIZE 6 /**< Maximum windows size used. */ + //#define MBEDTLS_MPI_MAX_SIZE 1024 /**< Maximum number of bytes for usable MPIs. */ + + /* CTR_DRBG options */ + //#define MBEDTLS_CTR_DRBG_ENTROPY_LEN 48 /**< Amount of entropy used per seed by default (48 with SHA-512, 32 with SHA-256) */ + //#define MBEDTLS_CTR_DRBG_RESEED_INTERVAL 10000 /**< Interval before reseed is performed by default */ + //#define MBEDTLS_CTR_DRBG_MAX_INPUT 256 /**< Maximum number of additional input bytes */ + //#define MBEDTLS_CTR_DRBG_MAX_REQUEST 1024 /**< Maximum number of requested bytes per call */ + //#define MBEDTLS_CTR_DRBG_MAX_SEED_INPUT 384 /**< Maximum size of (re)seed buffer */ + + /* HMAC_DRBG options */ + //#define MBEDTLS_HMAC_DRBG_RESEED_INTERVAL 10000 /**< Interval before reseed is performed by default */ + //#define MBEDTLS_HMAC_DRBG_MAX_INPUT 256 /**< Maximum number of additional input bytes */ + //#define MBEDTLS_HMAC_DRBG_MAX_REQUEST 1024 /**< Maximum number of requested bytes per call */ + //#define MBEDTLS_HMAC_DRBG_MAX_SEED_INPUT 384 /**< Maximum size of (re)seed buffer */ + + /* ECP options */ + //#define MBEDTLS_ECP_MAX_BITS 521 /**< Maximum bit size of groups */ + //#define MBEDTLS_ECP_WINDOW_SIZE 6 /**< Maximum window size used */ + //#define MBEDTLS_ECP_FIXED_POINT_OPTIM 1 /**< Enable fixed-point speed-up */ + + /* Entropy options */ + //#define MBEDTLS_ENTROPY_MAX_SOURCES 20 /**< Maximum number of sources supported */ + //#define MBEDTLS_ENTROPY_MAX_GATHER 128 /**< Maximum amount requested from entropy sources */ + + /* Memory buffer allocator options */ + //#define MBEDTLS_MEMORY_ALIGN_MULTIPLE 4 /**< Align on multiples of this value */ + + /* Platform options */ + //#define MBEDTLS_PLATFORM_STD_MEM_HDR /**< Header to include if MBEDTLS_PLATFORM_NO_STD_FUNCTIONS is defined. Don't define if no header is needed. */ + //#define MBEDTLS_PLATFORM_STD_CALLOC calloc /**< Default allocator to use, can be undefined */ + //#define MBEDTLS_PLATFORM_STD_FREE free /**< Default free to use, can be undefined */ + //#define MBEDTLS_PLATFORM_STD_EXIT exit /**< Default exit to use, can be undefined */ + //#define MBEDTLS_PLATFORM_STD_FPRINTF fprintf /**< Default fprintf to use, can be undefined */ + //#define MBEDTLS_PLATFORM_STD_PRINTF printf /**< Default printf to use, can be undefined */ + /* Note: your snprintf must correclty zero-terminate the buffer! */ + //#define MBEDTLS_PLATFORM_STD_SNPRINTF snprintf /**< Default snprintf to use, can be undefined */ + + /* To Use Function Macros MBEDTLS_PLATFORM_C must be enabled */ + /* MBEDTLS_PLATFORM_XXX_MACRO and MBEDTLS_PLATFORM_XXX_ALT cannot both be defined */ + //#define MBEDTLS_PLATFORM_CALLOC_MACRO calloc /**< Default allocator macro to use, can be undefined */ + //#define MBEDTLS_PLATFORM_FREE_MACRO free /**< Default free macro to use, can be undefined */ + //#define MBEDTLS_PLATFORM_EXIT_MACRO exit /**< Default exit macro to use, can be undefined */ + //#define MBEDTLS_PLATFORM_FPRINTF_MACRO fprintf /**< Default fprintf macro to use, can be undefined */ + //#define MBEDTLS_PLATFORM_PRINTF_MACRO printf /**< Default printf macro to use, can be undefined */ + /* Note: your snprintf must correclty zero-terminate the buffer! */ + //#define MBEDTLS_PLATFORM_SNPRINTF_MACRO snprintf /**< Default snprintf macro to use, can be undefined */ + + /* SSL Cache options */ + //#define MBEDTLS_SSL_CACHE_DEFAULT_TIMEOUT 86400 /**< 1 day */ + //#define MBEDTLS_SSL_CACHE_DEFAULT_MAX_ENTRIES 50 /**< Maximum entries in cache */ + + /* SSL options */ + //#define MBEDTLS_SSL_MAX_CONTENT_LEN 16384 /**< Maxium fragment length in bytes, determines the size of each of the two internal I/O buffers */ + //#define MBEDTLS_SSL_DEFAULT_TICKET_LIFETIME 86400 /**< Lifetime of session tickets (if enabled) */ + //#define MBEDTLS_PSK_MAX_LEN 32 /**< Max size of TLS pre-shared keys, in bytes (default 256 bits) */ + //#define MBEDTLS_SSL_COOKIE_TIMEOUT 60 /**< Default expiration delay of DTLS cookies, in seconds if HAVE_TIME, or in number of cookies issued */ + + /** + * Complete list of ciphersuites to use, in order of preference. + * + * \warning No dependency checking is done on that field! This option can only + * be used to restrict the set of available ciphersuites. It is your + * responsibility to make sure the needed modules are active. + * + * Use this to save a few hundred bytes of ROM (default ordering of all + * available ciphersuites) and a few to a few hundred bytes of RAM. + * + * The value below is only an example, not the default. + */ + //#define MBEDTLS_SSL_CIPHERSUITES MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 + + /* X509 options */ + //#define MBEDTLS_X509_MAX_INTERMEDIATE_CA 8 /**< Maximum number of intermediate CAs in a verification chain. */ + + /* \} name SECTION: Module configuration options */ + + #if defined(TARGET_LIKE_MBED) + #include "mbedtls/target_config.h" + #endif + + /* + * Allow user to override any previous default. + * + * Use two macro names for that, as: + * - with yotta the prefix YOTTA_CFG_ is forced + * - without yotta is looks weird to have a YOTTA prefix. + */ + #if defined(YOTTA_CFG_MBEDTLS_USER_CONFIG_FILE) + #include YOTTA_CFG_MBEDTLS_USER_CONFIG_FILE + #elif defined(MBEDTLS_USER_CONFIG_FILE) + #include MBEDTLS_USER_CONFIG_FILE + #endif + + #include "check_config.h" + + #endif /* MBEDTLS_CONFIG_H */ \ No newline at end of file diff --git a/IOBox/mbedtls/platform.h b/IOBox/mbedtls/platform.h new file mode 100644 index 0000000..f1534e6 --- /dev/null +++ b/IOBox/mbedtls/platform.h @@ -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 +#include +#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 +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 +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 */ \ No newline at end of file diff --git a/IOBox/mbedtls/sha256.c b/IOBox/mbedtls/sha256.c new file mode 100644 index 0000000..81441f7 --- /dev/null +++ b/IOBox/mbedtls/sha256.c @@ -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 + + #if defined(MBEDTLS_SELF_TEST) + #if defined(MBEDTLS_PLATFORM_C) + #include "platform.h" + #else + #include + #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 */ \ No newline at end of file diff --git a/IOBox/mbedtls/sha256.h b/IOBox/mbedtls/sha256.h new file mode 100644 index 0000000..98e7380 --- /dev/null +++ b/IOBox/mbedtls/sha256.h @@ -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 +#include + +#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 */ \ No newline at end of file diff --git a/IOBox/readme.md b/IOBox/readme.md new file mode 100644 index 0000000..9fa54bc --- /dev/null +++ b/IOBox/readme.md @@ -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 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 + + + + diff --git a/MediaClient/HttpFlvTest/HttpFlvTest.cpp b/MediaClient/HttpFlvTest/HttpFlvTest.cpp new file mode 100644 index 0000000..c4d677d --- /dev/null +++ b/MediaClient/HttpFlvTest/HttpFlvTest.cpp @@ -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; +} + + + diff --git a/MediaClient/HttpFlvTest/HttpFlvTest.vcxproj b/MediaClient/HttpFlvTest/HttpFlvTest.vcxproj new file mode 100644 index 0000000..17548a3 --- /dev/null +++ b/MediaClient/HttpFlvTest/HttpFlvTest.vcxproj @@ -0,0 +1,175 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {23D7CA2E-F808-4986-BFB4-F349355222E9} + Win32Proj + RtmpTest + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + $(SolutionDir)$(Platform)\$(Configuration)\ + + + true + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + + + false + + + + + + Level1 + Disabled + WIN32;_DEBUG;_CONSOLE;HT_STATIC;ZLIB_WINAPI;%(PreprocessorDefinitions) + true + ..\MediaClient;..\MediaClient\bm;..\MediaClient\http;..\MediaClient\rtp;..\MediaClient\rtmp;..\MediaClient\librtmp;..\MediaClient\media;%(AdditionalIncludeDirectories) + 4996 + + + Console + true + ../MediaClient/openssl/lib/x86;../MediaClient/zlib/lib/x86;$(OutDir);%(AdditionalLibraryDirectories) + libcrypto.lib;libssl.lib;zlibwapi.lib;winmm.lib;HttpFlvClientLibrary.lib;%(AdditionalDependencies) + + + + + + + Level3 + Disabled + _DEBUG;_CONSOLE;HT_STATIC;ZLIB_WINAPI;%(PreprocessorDefinitions) + true + ..\MediaClient;..\MediaClient\bm;..\MediaClient\http;..\MediaClient\rtp;..\MediaClient\rtmp;..\MediaClient\librtmp;..\MediaClient\media;%(AdditionalIncludeDirectories) + 4996 + + + Console + true + ../MediaClient/openssl/lib/x64;../MediaClient/zlib/lib/x64;$(OutDir);%(AdditionalLibraryDirectories) + libcrypto.lib;libssl.lib;zlibwapi.lib;winmm.lib;HttpFlvClientLibrary.lib;%(AdditionalDependencies) + + + + + Level1 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;HT_STATIC;ZLIB_WINAPI;%(PreprocessorDefinitions) + true + ..\MediaClient;..\MediaClient\bm;..\MediaClient\http;..\MediaClient\rtp;..\MediaClient\rtmp;..\MediaClient\librtmp;..\MediaClient\media;%(AdditionalIncludeDirectories) + 4996 + + + Console + true + true + true + ../MediaClient/openssl/lib/x86;../MediaClient/zlib/lib/x86;$(OutDir);%(AdditionalLibraryDirectories) + libcrypto.lib;libssl.lib;zlibwapi.lib;winmm.lib;HttpFlvClientLibrary.lib;%(AdditionalDependencies) + + + + + Level1 + + + MaxSpeed + true + true + NDEBUG;_CONSOLE;HT_STATIC;ZLIB_WINAPI;%(PreprocessorDefinitions) + true + ..\MediaClient;..\MediaClient\bm;..\MediaClient\http;..\MediaClient\rtp;..\MediaClient\rtmp;..\MediaClient\librtmp;..\MediaClient\media;%(AdditionalIncludeDirectories) + 4996 + + + Console + true + true + true + ../MediaClient/openssl/lib/x64;../MediaClient/zlib/lib/x64;$(OutDir);%(AdditionalLibraryDirectories) + libcrypto.lib;libssl.lib;zlibwapi.lib;winmm.lib;HttpFlvClientLibrary.lib;%(AdditionalDependencies) + + + + + + + + + + + + \ No newline at end of file diff --git a/MediaClient/HttpFlvTest/HttpFlvTest.vcxproj.filters b/MediaClient/HttpFlvTest/HttpFlvTest.vcxproj.filters new file mode 100644 index 0000000..3379542 --- /dev/null +++ b/MediaClient/HttpFlvTest/HttpFlvTest.vcxproj.filters @@ -0,0 +1,25 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + + + + Source Files + + + \ No newline at end of file diff --git a/MediaClient/HttpFlvTest/mac.mk b/MediaClient/HttpFlvTest/mac.mk new file mode 100644 index 0000000..f39f783 --- /dev/null +++ b/MediaClient/HttpFlvTest/mac.mk @@ -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 + diff --git a/MediaClient/HttpMjpegTest/HttpMjpegTest.cpp b/MediaClient/HttpMjpegTest/HttpMjpegTest.cpp new file mode 100644 index 0000000..881f5f6 --- /dev/null +++ b/MediaClient/HttpMjpegTest/HttpMjpegTest.cpp @@ -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; +} + + + diff --git a/MediaClient/HttpMjpegTest/HttpMjpegTest.vcxproj b/MediaClient/HttpMjpegTest/HttpMjpegTest.vcxproj new file mode 100644 index 0000000..97ad779 --- /dev/null +++ b/MediaClient/HttpMjpegTest/HttpMjpegTest.vcxproj @@ -0,0 +1,175 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {E0552D9D-040B-4D00-AD37-6DC6E6942693} + Win32Proj + RtmpTest + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + $(SolutionDir)$(Platform)\$(Configuration)\ + + + true + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + + + false + + + + + + Level1 + Disabled + WIN32;_DEBUG;_CONSOLE;HT_STATIC;ZLIB_WINAPI;%(PreprocessorDefinitions) + true + ..\MediaClient;..\MediaClient\bm;..\MediaClient\http;..\MediaClient\rtp;..\MediaClient\rtmp;..\MediaClient\librtmp;..\MediaClient\media;%(AdditionalIncludeDirectories) + 4996 + + + Console + true + ../MediaClient/openssl/lib/x86;../MediaClient/zlib/lib/x86;$(OutDir);%(AdditionalLibraryDirectories) + libcrypto.lib;libssl.lib;zlibwapi.lib;winmm.lib;HttpMjpegClientLibrary.lib;%(AdditionalDependencies) + + + + + + + Level3 + Disabled + _DEBUG;_CONSOLE;HT_STATIC;ZLIB_WINAPI;%(PreprocessorDefinitions) + true + ..\MediaClient;..\MediaClient\bm;..\MediaClient\http;..\MediaClient\rtp;..\MediaClient\rtmp;..\MediaClient\librtmp;..\MediaClient\media;%(AdditionalIncludeDirectories) + 4996 + + + Console + true + ../MediaClient/openssl/lib/x64;../MediaClient/zlib/lib/x64;$(OutDir);%(AdditionalLibraryDirectories) + libcrypto.lib;libssl.lib;zlibwapi.lib;winmm.lib;HttpMjpegClientLibrary.lib;%(AdditionalDependencies) + + + + + Level1 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;HT_STATIC;ZLIB_WINAPI;%(PreprocessorDefinitions) + true + ..\MediaClient;..\MediaClient\bm;..\MediaClient\http;..\MediaClient\rtp;..\MediaClient\rtmp;..\MediaClient\librtmp;..\MediaClient\media;%(AdditionalIncludeDirectories) + 4996 + + + Console + true + true + true + ../MediaClient/openssl/lib/x86;../MediaClient/zlib/lib/x86;$(OutDir);%(AdditionalLibraryDirectories) + libcrypto.lib;libssl.lib;zlibwapi.lib;winmm.lib;HttpMjpegClientLibrary.lib;%(AdditionalDependencies) + + + + + Level1 + + + MaxSpeed + true + true + NDEBUG;_CONSOLE;HT_STATIC;ZLIB_WINAPI;%(PreprocessorDefinitions) + true + ..\MediaClient;..\MediaClient\bm;..\MediaClient\http;..\MediaClient\rtp;..\MediaClient\rtmp;..\MediaClient\librtmp;..\MediaClient\media;%(AdditionalIncludeDirectories) + 4996 + + + Console + true + true + true + ../MediaClient/openssl/lib/x64;../MediaClient/zlib/lib/x64;$(OutDir);%(AdditionalLibraryDirectories) + libcrypto.lib;libssl.lib;zlibwapi.lib;winmm.lib;HttpMjpegClientLibrary.lib;%(AdditionalDependencies) + + + + + + + + + + + + \ No newline at end of file diff --git a/MediaClient/HttpMjpegTest/HttpMjpegTest.vcxproj.filters b/MediaClient/HttpMjpegTest/HttpMjpegTest.vcxproj.filters new file mode 100644 index 0000000..d5c64f5 --- /dev/null +++ b/MediaClient/HttpMjpegTest/HttpMjpegTest.vcxproj.filters @@ -0,0 +1,25 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + + + + Source Files + + + \ No newline at end of file diff --git a/MediaClient/HttpMjpegTest/mac.mk b/MediaClient/HttpMjpegTest/mac.mk new file mode 100644 index 0000000..7be422f --- /dev/null +++ b/MediaClient/HttpMjpegTest/mac.mk @@ -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 + diff --git a/MediaClient/MediaClient.sln b/MediaClient/MediaClient.sln new file mode 100644 index 0000000..0b62ac1 --- /dev/null +++ b/MediaClient/MediaClient.sln @@ -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 diff --git a/MediaClient/MediaClient/HttpFlvClientLibrary-android.mk b/MediaClient/MediaClient/HttpFlvClientLibrary-android.mk new file mode 100644 index 0000000..98da7bc --- /dev/null +++ b/MediaClient/MediaClient/HttpFlvClientLibrary-android.mk @@ -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 + diff --git a/MediaClient/MediaClient/HttpFlvClientLibrary-ios.mk b/MediaClient/MediaClient/HttpFlvClientLibrary-ios.mk new file mode 100644 index 0000000..3988b8a --- /dev/null +++ b/MediaClient/MediaClient/HttpFlvClientLibrary-ios.mk @@ -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 + diff --git a/MediaClient/MediaClient/HttpFlvClientLibrary-mac.mk b/MediaClient/MediaClient/HttpFlvClientLibrary-mac.mk new file mode 100644 index 0000000..c73bd7c --- /dev/null +++ b/MediaClient/MediaClient/HttpFlvClientLibrary-mac.mk @@ -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 + diff --git a/MediaClient/MediaClient/HttpFlvClientLibrary-static.mk b/MediaClient/MediaClient/HttpFlvClientLibrary-static.mk new file mode 100644 index 0000000..0852e66 --- /dev/null +++ b/MediaClient/MediaClient/HttpFlvClientLibrary-static.mk @@ -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 + diff --git a/MediaClient/MediaClient/HttpFlvClientLibrary.mk b/MediaClient/MediaClient/HttpFlvClientLibrary.mk new file mode 100644 index 0000000..3304c8b --- /dev/null +++ b/MediaClient/MediaClient/HttpFlvClientLibrary.mk @@ -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 + diff --git a/MediaClient/MediaClient/HttpFlvClientLibrary.vcxproj b/MediaClient/MediaClient/HttpFlvClientLibrary.vcxproj new file mode 100644 index 0000000..e831616 --- /dev/null +++ b/MediaClient/MediaClient/HttpFlvClientLibrary.vcxproj @@ -0,0 +1,178 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {71F6F67D-3FF2-4BA6-A871-E9704753F27D} + Win32Proj + RtmpClientLibrary + 10.0 + + + + StaticLibrary + true + v143 + Unicode + + + StaticLibrary + false + v143 + true + Unicode + + + StaticLibrary + true + v143 + Unicode + + + StaticLibrary + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + $(Configuration)\$(ProjectName)\ + $(SolutionDir)$(Platform)\$(Configuration)\ + + + $(Configuration)\$(ProjectName)\ + $(SolutionDir)$(Platform)\$(Configuration)\ + + + $(Platform)\$(Configuration)\$(ProjectName)\ + + + $(Platform)\$(Configuration)\$(ProjectName)\ + + + + + + Level1 + Disabled + WIN32;_DEBUG;_LIB;HT_STATIC;%(PreprocessorDefinitions) + true + .;./bm;./media;./rtp;./librtmp;./rtmp;./openssl/include;./zlib/include;%(AdditionalIncludeDirectories) + 4996 + + + Windows + + + + + + + Level3 + Disabled + _DEBUG;_LIB;HT_STATIC;ZLIB_WINAPI;%(PreprocessorDefinitions) + true + .;./bm;./media;./rtp;./librtmp;./rtmp;./openssl/include;./zlib/include;%(AdditionalIncludeDirectories) + 4996;4267;4244;4018 + + + Windows + + + + + Level1 + + + MaxSpeed + true + true + WIN32;NDEBUG;_LIB;HT_STATIC;ZLIB_WINAPI;%(PreprocessorDefinitions) + true + .;./bm;./media;./rtp;./librtmp;./rtmp;./openssl/include;./zlib/include;%(AdditionalIncludeDirectories) + 4996 + + + Windows + true + true + + + + + Level1 + + + MaxSpeed + true + true + NDEBUG;_LIB;HT_STATIC;ZLIB_WINAPI;%(PreprocessorDefinitions) + true + .;./bm;./media;./rtp;./librtmp;./rtmp;./openssl/include;./zlib/include;%(AdditionalIncludeDirectories) + 4996;4267;4244;4018 + + + Windows + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MediaClient/MediaClient/HttpFlvClientLibrary.vcxproj.filters b/MediaClient/MediaClient/HttpFlvClientLibrary.vcxproj.filters new file mode 100644 index 0000000..0bb205c --- /dev/null +++ b/MediaClient/MediaClient/HttpFlvClientLibrary.vcxproj.filters @@ -0,0 +1,73 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {f3e33128-2d95-4289-aa78-ee61da2270c6} + + + + + + + + bm + + + bm + + + bm + + + bm + + + bm + + + bm + + + bm + + + bm + + + bm + + + bm + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + bm + + + \ No newline at end of file diff --git a/MediaClient/MediaClient/HttpMjpegClientLibrary-android.mk b/MediaClient/MediaClient/HttpMjpegClientLibrary-android.mk new file mode 100644 index 0000000..7fc1e4e --- /dev/null +++ b/MediaClient/MediaClient/HttpMjpegClientLibrary-android.mk @@ -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 + diff --git a/MediaClient/MediaClient/HttpMjpegClientLibrary-ios.mk b/MediaClient/MediaClient/HttpMjpegClientLibrary-ios.mk new file mode 100644 index 0000000..da1e46e --- /dev/null +++ b/MediaClient/MediaClient/HttpMjpegClientLibrary-ios.mk @@ -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 + diff --git a/MediaClient/MediaClient/HttpMjpegClientLibrary-mac.mk b/MediaClient/MediaClient/HttpMjpegClientLibrary-mac.mk new file mode 100644 index 0000000..3cb3ec6 --- /dev/null +++ b/MediaClient/MediaClient/HttpMjpegClientLibrary-mac.mk @@ -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 + diff --git a/MediaClient/MediaClient/HttpMjpegClientLibrary-static.mk b/MediaClient/MediaClient/HttpMjpegClientLibrary-static.mk new file mode 100644 index 0000000..938ff67 --- /dev/null +++ b/MediaClient/MediaClient/HttpMjpegClientLibrary-static.mk @@ -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 + diff --git a/MediaClient/MediaClient/HttpMjpegClientLibrary.mk b/MediaClient/MediaClient/HttpMjpegClientLibrary.mk new file mode 100644 index 0000000..20bd726 --- /dev/null +++ b/MediaClient/MediaClient/HttpMjpegClientLibrary.mk @@ -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 + diff --git a/MediaClient/MediaClient/HttpMjpegClientLibrary.vcxproj b/MediaClient/MediaClient/HttpMjpegClientLibrary.vcxproj new file mode 100644 index 0000000..4ae1ded --- /dev/null +++ b/MediaClient/MediaClient/HttpMjpegClientLibrary.vcxproj @@ -0,0 +1,176 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {A084CA49-A838-491A-8351-7AB117455480} + Win32Proj + RtmpClientLibrary + 10.0 + + + + StaticLibrary + true + v143 + Unicode + + + StaticLibrary + false + v143 + true + Unicode + + + StaticLibrary + true + v143 + Unicode + + + StaticLibrary + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + $(Configuration)\$(ProjectName)\ + $(SolutionDir)$(Platform)\$(Configuration)\ + + + $(Configuration)\$(ProjectName)\ + $(SolutionDir)$(Platform)\$(Configuration)\ + + + $(Platform)\$(Configuration)\$(ProjectName)\ + + + $(Platform)\$(Configuration)\$(ProjectName)\ + + + + + + Level1 + Disabled + WIN32;_DEBUG;_LIB;HT_STATIC;%(PreprocessorDefinitions) + true + .;./bm;./media;./rtp;./librtmp;./rtmp;./openssl/include;./zlib/include;%(AdditionalIncludeDirectories) + 4996 + + + Windows + + + + + + + Level3 + Disabled + _DEBUG;_LIB;HT_STATIC;ZLIB_WINAPI;%(PreprocessorDefinitions) + true + .;./bm;./media;./rtp;./librtmp;./rtmp;./openssl/include;./zlib/include;%(AdditionalIncludeDirectories) + 4996;4267;4244;4018 + + + Windows + + + + + Level1 + + + MaxSpeed + true + true + WIN32;NDEBUG;_LIB;HT_STATIC;ZLIB_WINAPI;%(PreprocessorDefinitions) + true + .;./bm;./media;./rtp;./librtmp;./rtmp;./openssl/include;./zlib/include;%(AdditionalIncludeDirectories) + 4996 + + + Windows + true + true + + + + + Level1 + + + MaxSpeed + true + true + NDEBUG;_LIB;HT_STATIC;ZLIB_WINAPI;%(PreprocessorDefinitions) + true + .;./bm;./media;./rtp;./librtmp;./rtmp;./openssl/include;./zlib/include;%(AdditionalIncludeDirectories) + 4996;4267;4244;4018 + + + Windows + true + true + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MediaClient/MediaClient/HttpMjpegClientLibrary.vcxproj.filters b/MediaClient/MediaClient/HttpMjpegClientLibrary.vcxproj.filters new file mode 100644 index 0000000..f0f24d5 --- /dev/null +++ b/MediaClient/MediaClient/HttpMjpegClientLibrary.vcxproj.filters @@ -0,0 +1,67 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {f3e33128-2d95-4289-aa78-ee61da2270c6} + + + + + + + + bm + + + bm + + + bm + + + bm + + + bm + + + bm + + + bm + + + bm + + + bm + + + bm + + + Source Files + + + Source Files + + + bm + + + Source Files + + + \ No newline at end of file diff --git a/MediaClient/MediaClient/MediaClient.css b/MediaClient/MediaClient/MediaClient.css new file mode 100644 index 0000000..c15bc63 --- /dev/null +++ b/MediaClient/MediaClient/MediaClient.css @@ -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 } + + + diff --git a/MediaClient/MediaClient/MediaClient.ico b/MediaClient/MediaClient/MediaClient.ico new file mode 100644 index 0000000..a9ff873 Binary files /dev/null and b/MediaClient/MediaClient/MediaClient.ico differ diff --git a/MediaClient/MediaClient/MediaClient.pro b/MediaClient/MediaClient/MediaClient.pro new file mode 100644 index 0000000..0f98973 --- /dev/null +++ b/MediaClient/MediaClient/MediaClient.pro @@ -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 diff --git a/MediaClient/MediaClient/MediaClient.qrc b/MediaClient/MediaClient/MediaClient.qrc new file mode 100644 index 0000000..d6fd0d3 --- /dev/null +++ b/MediaClient/MediaClient/MediaClient.qrc @@ -0,0 +1,31 @@ + + + Resources/help.png + Resources/1.png + Resources/4.png + Resources/6.png + Resources/9.png + Resources/16.png + Resources/custom.png + Resources/full.png + Resources/stopall.png + Resources/btn_close.png + Resources/btn_max.png + Resources/btn_max_hot.png + Resources/btn_min.png + Resources/main.png + Resources/btn_pause.png + Resources/btn_play.png + Resources/btn_stop.png + Resources/mic.png + Resources/mute.png + Resources/snapshot.png + Resources/stop_record.png + Resources/video_record.png + Resources/volume.png + Resources/stopmic.png + Resources/config.png + Resources/browse_folder.png + Resources/open_folder.png + + diff --git a/MediaClient/MediaClient/MediaClient.rc b/MediaClient/MediaClient/MediaClient.rc new file mode 100644 index 0000000..083a8f9 --- /dev/null +++ b/MediaClient/MediaClient/MediaClient.rc @@ -0,0 +1,2 @@ +IDI_ICON1 ICON DISCARDABLE "MediaClient.ico" + diff --git a/MediaClient/MediaClient/MediaClient.vcxproj b/MediaClient/MediaClient/MediaClient.vcxproj new file mode 100644 index 0000000..eb6f84a --- /dev/null +++ b/MediaClient/MediaClient/MediaClient.vcxproj @@ -0,0 +1,390 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {6814DE1C-B652-4384-B27E-59B9F964B6BF} + QtVS_v304 + 10.0 + 10.0 + 10.0 + 10.0 + $(MSBuildProjectDirectory)\QtMsBuild + + + + Application + v143 + + + Application + v143 + + + Application + v143 + + + Application + v143 + + + + + + + msvc2017 + core;gui;widgets;winextras + debug + + + 6.5.1_msvc2019_64 + core;gui;widgets + debug + + + msvc2017 + core;gui;widgets;winextras + release + + + 6.5.1_msvc2019_64 + core;gui;widgets + release + + + + + + + + + + + + + + + + + + + + + + + + + $(SolutionDir)$(Platform)\$(Configuration)\ + + + + $(SolutionDir)$(Platform)\$(Configuration)\ + + + false + + + + .\;.\bm;.\rtp;.\rtsp;.\http;.\media;.\rtmp;.\librtmp;.\srt;.\formClass;.\libsrt\include;.\ffmpeg\include;.\directx\include;.\openssl\include;.\zlib\include;%(AdditionalIncludeDirectories) + 4819;4005;%(DisableSpecificWarnings) + HT_STATIC;HTTPS;ZLIB_WINAPI;BACKCHANNEL;REPLAY;OVER_HTTP;OVER_WEBSOCKET;%(PreprocessorDefinitions) + + + .\directx\lib\x86;.\ffmpeg\lib\x86;.\openssl\lib\x86;.\zlib\lib\x86;.\libsrt\lib\x86;%(AdditionalLibraryDirectories) + 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) + false + + + lupdate + + + + + .\;.\bm;.\rtp;.\rtsp;.\http;.\media;.\rtmp;.\librtmp;.\srt;.\formClass;.\libsrt\include;.\ffmpeg\include;.\directx\include;.\openssl\include;.\zlib\include;%(AdditionalIncludeDirectories) + 4819;4005;%(DisableSpecificWarnings) + HT_STATIC;HTTPS;ZLIB_WINAPI;BACKCHANNEL;REPLAY;OVER_HTTP;OVER_WEBSOCKET;%(PreprocessorDefinitions) + + + .\directx\lib\x64;.\ffmpeg\lib\x64;.\openssl\lib\x64;.\zlib\lib\x64;.\libsrt\lib\x64;%(AdditionalLibraryDirectories) + 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) + false + + + lupdate + + + + + 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) + .\directx\lib\x86;.\ffmpeg\lib\x86;.\openssl\lib\x86;.\zlib\lib\x86;.\libsrt\lib\x86;%(AdditionalLibraryDirectories) + false + RequireAdministrator + + + .\;.\bm;.\rtp;.\rtsp;.\http;.\media;.\rtmp;.\librtmp;.\srt;.\formClass;.\libsrt\include;.\ffmpeg\include;.\directx\include;.\openssl\include;.\zlib\include;%(AdditionalIncludeDirectories) + HT_STATIC;HTTPS;ZLIB_WINAPI;BACKCHANNEL;REPLAY;OVER_HTTP;OVER_WEBSOCKET;%(PreprocessorDefinitions) + 4819;4005;%(DisableSpecificWarnings) + + + false + + + + + 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) + .\directx\lib\x64;.\ffmpeg\lib\x64;.\openssl\lib\x64;.\zlib\lib\x64;.\libsrt\lib\x64;%(AdditionalLibraryDirectories) + false + RequireAdministrator + + + .\;.\bm;.\rtp;.\rtsp;.\http;.\media;.\rtmp;.\librtmp;.\srt;.\formClass;.\libsrt\include;.\ffmpeg\include;.\directx\include;.\openssl\include;.\zlib\include;%(AdditionalIncludeDirectories) + HT_STATIC;HTTPS;ZLIB_WINAPI;BACKCHANNEL;REPLAY;OVER_HTTP;OVER_WEBSOCKET;%(PreprocessorDefinitions) + 4819;4005;%(DisableSpecificWarnings) + + + lupdate + + + + + true + true + ProgramDatabase + Disabled + MultiThreadedDebugDLL + + + Windows + true + + + + + true + true + ProgramDatabase + Disabled + MultiThreadedDebugDLL + + + Windows + true + + + + + true + true + None + MaxSpeed + MultiThreadedDLL + + + Windows + false + + + + + true + true + None + MaxSpeed + MultiThreadedDLL + + + Windows + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MediaClient/MediaClient/MediaClient.vcxproj.filters b/MediaClient/MediaClient/MediaClient.vcxproj.filters new file mode 100644 index 0000000..fcfe1cd --- /dev/null +++ b/MediaClient/MediaClient/MediaClient.vcxproj.filters @@ -0,0 +1,516 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + qrc;rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {99349809-55BA-4b9d-BF79-8FDBB0286EB3} + ui + + + {639EADAA-A684-42e4-A9AD-28FC9BCB8F7C} + ts + + + {f9efb1b7-44e1-465c-a185-398493b71a75} + + + {f4059e3a-5bfc-4ed0-9dcc-c48fbf2fe657} + + + {17cf4518-ba24-472b-a927-a12116d8a1c0} + + + {99d8fe9c-bb92-40fd-816a-6db62f0bbb29} + + + {8e528862-850e-458a-ac31-84b0f3ff2a9e} + + + {13c7c9b7-c60f-4cbe-89a4-5a4e8ecb67e7} + + + {b8a8f0a1-bd04-4666-960d-d25d257a62a0} + + + {debd2512-967d-4028-a2d9-d02d3debf1de} + + + {9edf4b63-c6cf-4a94-8814-85d37816af01} + + + + + Resource Files + + + + + Source Files + + + formClass + + + Source Files + + + Source Files + + + bm + + + bm + + + bm + + + bm + + + bm + + + bm + + + bm + + + bm + + + bm + + + bm + + + bm + + + formClass + + + formClass + + + formClass + + + formClass + + + formClass + + + formClass + + + formClass + + + formClass + + + formClass + + + media + + + media + + + media + + + media + + + rtp + + + rtp + + + rtp + + + rtp + + + rtp + + + rtp + + + rtp + + + rtp + + + rtp + + + rtp + + + rtp + + + media + + + rtsp + + + rtsp + + + rtsp + + + rtsp + + + rtsp + + + media + + + media + + + media + + + media + + + media + + + media + + + media + + + media + + + http + + + http + + + formClass + + + librtmp + + + librtmp + + + librtmp + + + librtmp + + + librtmp + + + rtmp + + + media + + + media + + + media + + + media + + + rtp + + + http + + + media + + + http + + + formClass + + + media + + + media + + + srt + + + rtp + + + media + + + rtsp + + + bm + + + media + + + http + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + media + + + media + + + Header Files + + + media + + + media + + + media + + + Header Files + + + media + + + media + + + + + Form Files + + + Form Files + + + Form Files + + + Form Files + + + Form Files + + + Form Files + + + Form Files + + + + + bm + + + bm + + + bm + + + bm + + + bm + + + bm + + + bm + + + bm + + + bm + + + bm + + + bm + + + rtp + + + rtp + + + rtsp + + + rtsp + + + rtsp + + + rtsp + + + rtsp + + + media + + + media + + + media + + + media + + + media + + + media + + + media + + + media + + + http + + + http + + + http + + + librtmp + + + librtmp + + + librtmp + + + librtmp + + + librtmp + + + librtmp + + + librtmp + + + librtmp + + + librtmp + + + rtmp + + + media + + + media + + + + + Resource Files + + + + + Translation Files + + + \ No newline at end of file diff --git a/MediaClient/MediaClient/Resources/1.png b/MediaClient/MediaClient/Resources/1.png new file mode 100644 index 0000000..ba60b41 Binary files /dev/null and b/MediaClient/MediaClient/Resources/1.png differ diff --git a/MediaClient/MediaClient/Resources/16.png b/MediaClient/MediaClient/Resources/16.png new file mode 100644 index 0000000..7f3805d Binary files /dev/null and b/MediaClient/MediaClient/Resources/16.png differ diff --git a/MediaClient/MediaClient/Resources/4.png b/MediaClient/MediaClient/Resources/4.png new file mode 100644 index 0000000..a427034 Binary files /dev/null and b/MediaClient/MediaClient/Resources/4.png differ diff --git a/MediaClient/MediaClient/Resources/6.png b/MediaClient/MediaClient/Resources/6.png new file mode 100644 index 0000000..7889284 Binary files /dev/null and b/MediaClient/MediaClient/Resources/6.png differ diff --git a/MediaClient/MediaClient/Resources/9.png b/MediaClient/MediaClient/Resources/9.png new file mode 100644 index 0000000..d62194a Binary files /dev/null and b/MediaClient/MediaClient/Resources/9.png differ diff --git a/MediaClient/MediaClient/Resources/browse_folder.png b/MediaClient/MediaClient/Resources/browse_folder.png new file mode 100644 index 0000000..ab06920 Binary files /dev/null and b/MediaClient/MediaClient/Resources/browse_folder.png differ diff --git a/MediaClient/MediaClient/Resources/btn_close.png b/MediaClient/MediaClient/Resources/btn_close.png new file mode 100644 index 0000000..c392dca Binary files /dev/null and b/MediaClient/MediaClient/Resources/btn_close.png differ diff --git a/MediaClient/MediaClient/Resources/btn_max.png b/MediaClient/MediaClient/Resources/btn_max.png new file mode 100644 index 0000000..8e03506 Binary files /dev/null and b/MediaClient/MediaClient/Resources/btn_max.png differ diff --git a/MediaClient/MediaClient/Resources/btn_max_hot.png b/MediaClient/MediaClient/Resources/btn_max_hot.png new file mode 100644 index 0000000..e1ca8dd Binary files /dev/null and b/MediaClient/MediaClient/Resources/btn_max_hot.png differ diff --git a/MediaClient/MediaClient/Resources/btn_min.png b/MediaClient/MediaClient/Resources/btn_min.png new file mode 100644 index 0000000..c16a24c Binary files /dev/null and b/MediaClient/MediaClient/Resources/btn_min.png differ diff --git a/MediaClient/MediaClient/Resources/btn_pause.png b/MediaClient/MediaClient/Resources/btn_pause.png new file mode 100644 index 0000000..1796a02 Binary files /dev/null and b/MediaClient/MediaClient/Resources/btn_pause.png differ diff --git a/MediaClient/MediaClient/Resources/btn_play.png b/MediaClient/MediaClient/Resources/btn_play.png new file mode 100644 index 0000000..79429b9 Binary files /dev/null and b/MediaClient/MediaClient/Resources/btn_play.png differ diff --git a/MediaClient/MediaClient/Resources/btn_stop.png b/MediaClient/MediaClient/Resources/btn_stop.png new file mode 100644 index 0000000..8113491 Binary files /dev/null and b/MediaClient/MediaClient/Resources/btn_stop.png differ diff --git a/MediaClient/MediaClient/Resources/config.png b/MediaClient/MediaClient/Resources/config.png new file mode 100644 index 0000000..bbb3090 Binary files /dev/null and b/MediaClient/MediaClient/Resources/config.png differ diff --git a/MediaClient/MediaClient/Resources/custom.png b/MediaClient/MediaClient/Resources/custom.png new file mode 100644 index 0000000..8bd5f4b Binary files /dev/null and b/MediaClient/MediaClient/Resources/custom.png differ diff --git a/MediaClient/MediaClient/Resources/full.png b/MediaClient/MediaClient/Resources/full.png new file mode 100644 index 0000000..c6f6079 Binary files /dev/null and b/MediaClient/MediaClient/Resources/full.png differ diff --git a/MediaClient/MediaClient/Resources/help.png b/MediaClient/MediaClient/Resources/help.png new file mode 100644 index 0000000..2383a8c Binary files /dev/null and b/MediaClient/MediaClient/Resources/help.png differ diff --git a/MediaClient/MediaClient/Resources/main.png b/MediaClient/MediaClient/Resources/main.png new file mode 100644 index 0000000..feaed74 Binary files /dev/null and b/MediaClient/MediaClient/Resources/main.png differ diff --git a/MediaClient/MediaClient/Resources/mic.png b/MediaClient/MediaClient/Resources/mic.png new file mode 100644 index 0000000..97fc2f5 Binary files /dev/null and b/MediaClient/MediaClient/Resources/mic.png differ diff --git a/MediaClient/MediaClient/Resources/mute.png b/MediaClient/MediaClient/Resources/mute.png new file mode 100644 index 0000000..e7198ae Binary files /dev/null and b/MediaClient/MediaClient/Resources/mute.png differ diff --git a/MediaClient/MediaClient/Resources/open_folder.png b/MediaClient/MediaClient/Resources/open_folder.png new file mode 100644 index 0000000..0710b94 Binary files /dev/null and b/MediaClient/MediaClient/Resources/open_folder.png differ diff --git a/MediaClient/MediaClient/Resources/snapshot.png b/MediaClient/MediaClient/Resources/snapshot.png new file mode 100644 index 0000000..209701f Binary files /dev/null and b/MediaClient/MediaClient/Resources/snapshot.png differ diff --git a/MediaClient/MediaClient/Resources/stop_record.png b/MediaClient/MediaClient/Resources/stop_record.png new file mode 100644 index 0000000..639105e Binary files /dev/null and b/MediaClient/MediaClient/Resources/stop_record.png differ diff --git a/MediaClient/MediaClient/Resources/stopall.png b/MediaClient/MediaClient/Resources/stopall.png new file mode 100644 index 0000000..de3c84f Binary files /dev/null and b/MediaClient/MediaClient/Resources/stopall.png differ diff --git a/MediaClient/MediaClient/Resources/stopmic.png b/MediaClient/MediaClient/Resources/stopmic.png new file mode 100644 index 0000000..097059b Binary files /dev/null and b/MediaClient/MediaClient/Resources/stopmic.png differ diff --git a/MediaClient/MediaClient/Resources/video_record.png b/MediaClient/MediaClient/Resources/video_record.png new file mode 100644 index 0000000..fb6396e Binary files /dev/null and b/MediaClient/MediaClient/Resources/video_record.png differ diff --git a/MediaClient/MediaClient/Resources/volume.png b/MediaClient/MediaClient/Resources/volume.png new file mode 100644 index 0000000..8a061a4 Binary files /dev/null and b/MediaClient/MediaClient/Resources/volume.png differ diff --git a/MediaClient/MediaClient/RtmpClientLibrary-android.mk b/MediaClient/MediaClient/RtmpClientLibrary-android.mk new file mode 100644 index 0000000..0517969 --- /dev/null +++ b/MediaClient/MediaClient/RtmpClientLibrary-android.mk @@ -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 + diff --git a/MediaClient/MediaClient/RtmpClientLibrary-ios.mk b/MediaClient/MediaClient/RtmpClientLibrary-ios.mk new file mode 100644 index 0000000..2100b32 --- /dev/null +++ b/MediaClient/MediaClient/RtmpClientLibrary-ios.mk @@ -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 + diff --git a/MediaClient/MediaClient/RtmpClientLibrary-mac.mk b/MediaClient/MediaClient/RtmpClientLibrary-mac.mk new file mode 100644 index 0000000..7f27419 --- /dev/null +++ b/MediaClient/MediaClient/RtmpClientLibrary-mac.mk @@ -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 + diff --git a/MediaClient/MediaClient/RtmpClientLibrary-static.mk b/MediaClient/MediaClient/RtmpClientLibrary-static.mk new file mode 100644 index 0000000..d201bf1 --- /dev/null +++ b/MediaClient/MediaClient/RtmpClientLibrary-static.mk @@ -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 + diff --git a/MediaClient/MediaClient/RtmpClientLibrary.mk b/MediaClient/MediaClient/RtmpClientLibrary.mk new file mode 100644 index 0000000..ceca873 --- /dev/null +++ b/MediaClient/MediaClient/RtmpClientLibrary.mk @@ -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 + diff --git a/MediaClient/MediaClient/RtmpClientLibrary.vcxproj b/MediaClient/MediaClient/RtmpClientLibrary.vcxproj new file mode 100644 index 0000000..031edc4 --- /dev/null +++ b/MediaClient/MediaClient/RtmpClientLibrary.vcxproj @@ -0,0 +1,181 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {4C15B47A-6C99-4D48-AF7D-5566E0CCDD91} + Win32Proj + RtmpClientLibrary + 10.0 + + + + StaticLibrary + true + v143 + Unicode + + + StaticLibrary + false + v143 + true + Unicode + + + StaticLibrary + true + v143 + Unicode + + + StaticLibrary + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + $(Configuration)\$(ProjectName)\ + $(SolutionDir)$(Platform)\$(Configuration)\ + + + $(Configuration)\$(ProjectName)\ + $(SolutionDir)$(Platform)\$(Configuration)\ + + + $(Platform)\$(Configuration)\$(ProjectName)\ + + + $(Platform)\$(Configuration)\$(ProjectName)\ + + + + + + Level1 + Disabled + WIN32;_DEBUG;_LIB;HT_STATIC;ZLIB_WINAPI;%(PreprocessorDefinitions) + true + .;./bm;./media;./rtp;./librtmp;./rtmp;./openssl/include;./zlib/include;%(AdditionalIncludeDirectories) + 4996 + + + Windows + + + + + + + Level3 + Disabled + _DEBUG;_LIB;HT_STATIC;ZLIB_WINAPI;%(PreprocessorDefinitions) + true + .;./bm;./media;./rtp;./librtmp;./rtmp;./openssl/include;./zlib/include;%(AdditionalIncludeDirectories) + 4996;4267;4244;4018 + + + Windows + + + + + Level1 + + + MaxSpeed + true + true + WIN32;NDEBUG;_LIB;HT_STATIC;ZLIB_WINAPI;%(PreprocessorDefinitions) + true + .;./bm;./media;./rtp;./librtmp;./rtmp;./openssl/include;./zlib/include;%(AdditionalIncludeDirectories) + 4996 + + + Windows + true + true + + + + + Level1 + + + MaxSpeed + true + true + NDEBUG;_LIB;HT_STATIC;ZLIB_WINAPI;%(PreprocessorDefinitions) + true + .;./bm;./media;./rtp;./librtmp;./rtmp;./openssl/include;./zlib/include;%(AdditionalIncludeDirectories) + 4996;4267;4244;4018 + + + Windows + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MediaClient/MediaClient/RtmpClientLibrary.vcxproj.filters b/MediaClient/MediaClient/RtmpClientLibrary.vcxproj.filters new file mode 100644 index 0000000..abed9f2 --- /dev/null +++ b/MediaClient/MediaClient/RtmpClientLibrary.vcxproj.filters @@ -0,0 +1,84 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {303d1179-4c4e-4a8a-a343-9d6ff1c7b5a3} + + + {8fb30d92-8832-4917-a41a-adcabf591201} + + + {f3e33128-2d95-4289-aa78-ee61da2270c6} + + + + + + + + rtmp + + + bm + + + bm + + + bm + + + bm + + + bm + + + bm + + + bm + + + bm + + + bm + + + bm + + + librtmp + + + librtmp + + + librtmp + + + librtmp + + + librtmp + + + + + rtmp + + + \ No newline at end of file diff --git a/MediaClient/MediaClient/RtspClientLibrary-android.mk b/MediaClient/MediaClient/RtspClientLibrary-android.mk new file mode 100644 index 0000000..60cd16c --- /dev/null +++ b/MediaClient/MediaClient/RtspClientLibrary-android.mk @@ -0,0 +1,114 @@ +################OPTION################### +OUTPUT = librtspclient.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 +COMPILEOPTION += -DEPOLL +COMPILEOPTION += -DMETADATA +COMPILEOPTION += -DREPLAY +COMPILEOPTION += -DOVER_HTTP +COMPILEOPTION += -DOVER_WEBSOCKET +#COMPILEOPTION += -DHTTPS +LINKOPTION = -shared -o $(OUTPUT) +INCLUDEDIR += -I. +INCLUDEDIR += -I./bm +INCLUDEDIR += -I./http +INCLUDEDIR += -I./media +INCLUDEDIR += -I./rtp +INCLUDEDIR += -I./rtsp +INCLUDEDIR += -I./ffmpeg/include +INCLUDEDIR += -I./openssl/include +LIBDIRS = +OBJS += bm/base64.o +OBJS += bm/hqueue.o +OBJS += bm/linked_list.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_parse.o +OBJS += rtp/aac_rtp_rx.o +OBJS += rtp/h264_rtp_rx.o +OBJS += rtp/h265_rtp_rx.o +OBJS += rtp/mjpeg_rtp_rx.o +OBJS += rtp/mjpeg_tables.o +OBJS += rtp/mpeg4.o +OBJS += rtp/mpeg4_rtp_rx.o +OBJS += rtp/pcm_rtp_rx.o +OBJS += rtp/rtp.o +OBJS += rtp/rtp_rx.o +OBJS += rtsp/rtsp_cln.o +OBJS += rtsp/rtsp_parse.o +OBJS += rtsp/rtsp_rcua.o +OBJS += rtsp/rtsp_util.o + +ifneq ($(findstring OVER_WEBSOCKET, $(COMPILEOPTION)),) +OBJS += rtsp/rtsp_ws.o +endif + +ifneq ($(findstring BACKCHANNEL, $(COMPILEOPTION)),) +OBJS += media/alsa.o +OBJS += media/audio_capture.o +OBJS += media/audio_capture_linux.o +OBJS += media/audio_encoder.o +OBJS += media/avcodec_mutex.o +OBJS += media/media_codec.o +OBJS += rtsp/rtsp_backchannel.o +endif + +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 + diff --git a/MediaClient/MediaClient/RtspClientLibrary-ios.mk b/MediaClient/MediaClient/RtspClientLibrary-ios.mk new file mode 100644 index 0000000..668d211 --- /dev/null +++ b/MediaClient/MediaClient/RtspClientLibrary-ios.mk @@ -0,0 +1,100 @@ +################OPTION################### +OUTPUT = librtspclient.a +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 +COMPILEOPTION += -DMETADATA +COMPILEOPTION += -DREPLAY +COMPILEOPTION += -DOVER_HTTP +COMPILEOPTION += -DOVER_WEBSOCKET +#COMPILEOPTION += -DHTTPS +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./media +INCLUDEDIR += -I./rtp +INCLUDEDIR += -I./rtsp +INCLUDEDIR += -I./ffmpeg/include +INCLUDEDIR += -I./openssl/include +LIBDIRS = +OBJS += bm/base64.o +OBJS += bm/hqueue.o +OBJS += bm/linked_list.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_parse.o +OBJS += rtp/aac_rtp_rx.o +OBJS += rtp/h264_rtp_rx.o +OBJS += rtp/h265_rtp_rx.o +OBJS += rtp/mjpeg_rtp_rx.o +OBJS += rtp/mjpeg_tables.o +OBJS += rtp/mpeg4.o +OBJS += rtp/mpeg4_rtp_rx.o +OBJS += rtp/pcm_rtp_rx.o +OBJS += rtp/rtp.o +OBJS += rtp/rtp_rx.o +OBJS += rtsp/rtsp_cln.o +OBJS += rtsp/rtsp_parse.o +OBJS += rtsp/rtsp_rcua.o +OBJS += rtsp/rtsp_util.o + +ifneq ($(findstring OVER_WEBSOCKET, $(COMPILEOPTION)),) +OBJS += rtsp/rtsp_ws.o +endif + +ifneq ($(findstring BACKCHANNEL, $(COMPILEOPTION)),) +OBJS += rtsp/rtsp_backchannel.o +endif + +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 + diff --git a/MediaClient/MediaClient/RtspClientLibrary-mac.mk b/MediaClient/MediaClient/RtspClientLibrary-mac.mk new file mode 100644 index 0000000..21aebf2 --- /dev/null +++ b/MediaClient/MediaClient/RtspClientLibrary-mac.mk @@ -0,0 +1,93 @@ +################OPTION################### +OUTPUT = librtspclient.so +CCOMPILE = gcc +CPPCOMPILE = g++ +COMPILEOPTION += -c -O3 -fPIC -Wall +COMPILEOPTION += -DIOS +COMPILEOPTION += -DMETADATA +COMPILEOPTION += -DREPLAY +COMPILEOPTION += -DOVER_HTTP +COMPILEOPTION += -DOVER_WEBSOCKET +#COMPILEOPTION += -DHTTPS +LINK = g++ +LINKOPTION = -shared -o $(OUTPUT) +INCLUDEDIR += -I. +INCLUDEDIR += -I./bm +INCLUDEDIR += -I./http +INCLUDEDIR += -I./media +INCLUDEDIR += -I./rtp +INCLUDEDIR += -I./rtsp +INCLUDEDIR += -I./ffmpeg/include +INCLUDEDIR += -I./openssl/include +LIBDIRS = +OBJS += bm/base64.o +OBJS += bm/hqueue.o +OBJS += bm/linked_list.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_parse.o +OBJS += rtp/aac_rtp_rx.o +OBJS += rtp/h264_rtp_rx.o +OBJS += rtp/h265_rtp_rx.o +OBJS += rtp/mjpeg_rtp_rx.o +OBJS += rtp/mjpeg_tables.o +OBJS += rtp/mpeg4.o +OBJS += rtp/mpeg4_rtp_rx.o +OBJS += rtp/pcm_rtp_rx.o +OBJS += rtp/rtp.o +OBJS += rtp/rtp_rx.o +OBJS += rtsp/rtsp_cln.o +OBJS += rtsp/rtsp_parse.o +OBJS += rtsp/rtsp_rcua.o +OBJS += rtsp/rtsp_util.o + +ifneq ($(findstring OVER_WEBSOCKET, $(COMPILEOPTION)),) +OBJS += rtsp/rtsp_ws.o +endif + +ifneq ($(findstring BACKCHANNEL, $(COMPILEOPTION)),) +OBJS += rtsp/rtsp_backchannel.o +endif + +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 + diff --git a/MediaClient/MediaClient/RtspClientLibrary-static.mk b/MediaClient/MediaClient/RtspClientLibrary-static.mk new file mode 100644 index 0000000..d24c70f --- /dev/null +++ b/MediaClient/MediaClient/RtspClientLibrary-static.mk @@ -0,0 +1,99 @@ +################OPTION################### +OUTPUT = librtspclient.a +CCOMPILE = gcc +CPPCOMPILE = g++ +COMPILEOPTION += -c -O3 -fPIC -Wall +COMPILEOPTION += -DEPOLL +COMPILEOPTION += -DMETADATA +COMPILEOPTION += -DREPLAY +COMPILEOPTION += -DOVER_HTTP +COMPILEOPTION += -DOVER_WEBSOCKET +#COMPILEOPTION += -DHTTPS +LINK = ar +LINKOPTION = cr $(OUTPUT) +INCLUDEDIR += -I. +INCLUDEDIR += -I./bm +INCLUDEDIR += -I./http +INCLUDEDIR += -I./media +INCLUDEDIR += -I./rtp +INCLUDEDIR += -I./rtsp +INCLUDEDIR += -I./ffmpeg/include +INCLUDEDIR += -I./openssl/include +LIBDIRS = +OBJS += bm/base64.o +OBJS += bm/hqueue.o +OBJS += bm/linked_list.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_parse.o +OBJS += rtp/aac_rtp_rx.o +OBJS += rtp/h264_rtp_rx.o +OBJS += rtp/h265_rtp_rx.o +OBJS += rtp/mjpeg_rtp_rx.o +OBJS += rtp/mjpeg_tables.o +OBJS += rtp/mpeg4.o +OBJS += rtp/mpeg4_rtp_rx.o +OBJS += rtp/pcm_rtp_rx.o +OBJS += rtp/rtp.o +OBJS += rtp/rtp_rx.o +OBJS += rtsp/rtsp_cln.o +OBJS += rtsp/rtsp_parse.o +OBJS += rtsp/rtsp_rcua.o +OBJS += rtsp/rtsp_util.o + +ifneq ($(findstring OVER_WEBSOCKET, $(COMPILEOPTION)),) +OBJS += rtsp/rtsp_ws.o +endif + +ifneq ($(findstring BACKCHANNEL, $(COMPILEOPTION)),) +OBJS += media/alsa.o +OBJS += media/audio_capture.o +OBJS += media/audio_capture_linux.o +OBJS += media/audio_encoder.o +OBJS += media/avcodec_mutex.o +OBJS += media/media_codec.o +OBJS += rtsp/rtsp_backchannel.o +endif + +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 + diff --git a/MediaClient/MediaClient/RtspClientLibrary.mk b/MediaClient/MediaClient/RtspClientLibrary.mk new file mode 100644 index 0000000..82a5eae --- /dev/null +++ b/MediaClient/MediaClient/RtspClientLibrary.mk @@ -0,0 +1,99 @@ +################OPTION################### +OUTPUT = librtspclient.so +CCOMPILE = gcc +CPPCOMPILE = g++ +COMPILEOPTION += -c -O3 -fPIC -Wall +COMPILEOPTION += -DEPOLL +COMPILEOPTION += -DMETADATA +COMPILEOPTION += -DREPLAY +COMPILEOPTION += -DOVER_HTTP +COMPILEOPTION += -DOVER_WEBSOCKET +#COMPILEOPTION += -DHTTPS +LINK = g++ +LINKOPTION = -shared -o $(OUTPUT) +INCLUDEDIR += -I. +INCLUDEDIR += -I./bm +INCLUDEDIR += -I./http +INCLUDEDIR += -I./media +INCLUDEDIR += -I./rtp +INCLUDEDIR += -I./rtsp +INCLUDEDIR += -I./ffmpeg/include +INCLUDEDIR += -I./openssl/include +LIBDIRS = +OBJS += bm/base64.o +OBJS += bm/hqueue.o +OBJS += bm/linked_list.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_parse.o +OBJS += rtp/aac_rtp_rx.o +OBJS += rtp/h264_rtp_rx.o +OBJS += rtp/h265_rtp_rx.o +OBJS += rtp/mjpeg_rtp_rx.o +OBJS += rtp/mjpeg_tables.o +OBJS += rtp/mpeg4.o +OBJS += rtp/mpeg4_rtp_rx.o +OBJS += rtp/pcm_rtp_rx.o +OBJS += rtp/rtp.o +OBJS += rtp/rtp_rx.o +OBJS += rtsp/rtsp_cln.o +OBJS += rtsp/rtsp_parse.o +OBJS += rtsp/rtsp_rcua.o +OBJS += rtsp/rtsp_util.o + +ifneq ($(findstring OVER_WEBSOCKET, $(COMPILEOPTION)),) +OBJS += rtsp/rtsp_ws.o +endif + +ifneq ($(findstring BACKCHANNEL, $(COMPILEOPTION)),) +OBJS += media/alsa.o +OBJS += media/audio_capture.o +OBJS += media/audio_capture_linux.o +OBJS += media/audio_encoder.o +OBJS += media/avcodec_mutex.o +OBJS += media/media_codec.o +OBJS += rtsp/rtsp_backchannel.o +endif + +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 + diff --git a/MediaClient/MediaClient/RtspClientLibrary.vcxproj b/MediaClient/MediaClient/RtspClientLibrary.vcxproj new file mode 100644 index 0000000..6fd4bb8 --- /dev/null +++ b/MediaClient/MediaClient/RtspClientLibrary.vcxproj @@ -0,0 +1,240 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {B50838F1-DCE1-4728-927E-EC591EB4A84E} + Win32Proj + rtspclient + 10.0 + + + + StaticLibrary + true + Unicode + v143 + + + StaticLibrary + true + Unicode + v143 + + + StaticLibrary + false + true + Unicode + v143 + + + StaticLibrary + false + true + Unicode + v143 + + + + + + + + + + + + + + + + + + + true + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Configuration)\$(ProjectName)\ + + + true + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\$(ProjectName)\ + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Configuration)\$(ProjectName)\ + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\$(ProjectName)\ + + + + + + Level3 + Disabled + _DEBUG;_CONSOLE;HT_STATIC;METADATA;REPLAY;OVER_HTTP;OVER_WEBSOCKET;%(PreprocessorDefinitions) + .\;.\bm;.\http;.\rtp;.\rtsp;.\media;.\openssl\include;%(AdditionalIncludeDirectories) + 4996 + + + Console + true + + + $(OutDir)\$(ProjectName).lib + + + + + + + Level3 + Disabled + _DEBUG;_CONSOLE;HT_STATIC;METADATA;REPLAY;OVER_HTTP;OVER_WEBSOCKET;%(PreprocessorDefinitions) + .\;.\bm;.\http;.\rtp;.\rtsp;.\media;.\openssl\include;%(AdditionalIncludeDirectories) + 4996;4267;4244 + + + Console + true + + + $(OutDir)\$(ProjectName).lib + + + + + Level3 + + + MaxSpeed + true + true + NDEBUG;_CONSOLE;HT_STATIC;METADATA;REPLAY;OVER_HTTP;OVER_WEBSOCKET;%(PreprocessorDefinitions) + .\;.\bm;.\http;.\rtp;.\rtsp;.\media;.\openssl\include;%(AdditionalIncludeDirectories) + 4996 + + + Console + true + true + true + + + $(OutDir)\$(ProjectName).lib + + + + + Level3 + + + MaxSpeed + true + true + NDEBUG;_CONSOLE;HT_STATIC;METADATA;REPLAY;OVER_HTTP;OVER_WEBSOCKET;%(PreprocessorDefinitions) + .\;.\bm;.\http;.\rtp;.\rtsp;.\media;.\openssl\include;%(AdditionalIncludeDirectories) + 4996;4244;4267 + + + Console + true + true + true + + + $(OutDir)\$(ProjectName).lib + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MediaClient/MediaClient/RtspClientLibrary.vcxproj.filters b/MediaClient/MediaClient/RtspClientLibrary.vcxproj.filters new file mode 100644 index 0000000..b82a80a --- /dev/null +++ b/MediaClient/MediaClient/RtspClientLibrary.vcxproj.filters @@ -0,0 +1,210 @@ + + + + + bm + + + bm + + + bm + + + bm + + + bm + + + bm + + + bm + + + bm + + + bm + + + bm + + + bm + + + rtsp + + + rtsp + + + rtsp + + + rtsp + + + rtsp + + + rtp + + + rtp + + + rtp + + + rtp + + + rtp + + + rtp + + + rtp + + + rtp + + + rtp + + + http + + + http + + + rtp + + + rtsp + + + bm + + + + + {8e8dae7f-b02d-4adc-9b0a-e29361fe1fc2} + + + {89022a3a-a8b6-4b71-8626-84f6fcb9f97b} + + + {fa2d64eb-f945-4bc6-90b9-ef0083884aaf} + + + {07f2e07e-9bd9-4aa8-adf9-92e26935530e} + + + + + bm + + + bm + + + bm + + + bm + + + bm + + + bm + + + bm + + + bm + + + bm + + + bm + + + bm + + + rtsp + + + rtsp + + + rtsp + + + rtsp + + + rtsp + + + rtsp + + + rtp + + + rtp + + + rtp + + + rtp + + + rtp + + + rtp + + + rtp + + + rtp + + + rtp + + + rtp + + + rtp + + + rtp + + + rtp + + + http + + + http + + + http + + + \ No newline at end of file diff --git a/MediaClient/MediaClient/SrtClientLibrary-android.mk b/MediaClient/MediaClient/SrtClientLibrary-android.mk new file mode 100644 index 0000000..2a4f4ef --- /dev/null +++ b/MediaClient/MediaClient/SrtClientLibrary-android.mk @@ -0,0 +1,78 @@ +################OPTION################### +OUTPUT = libsrtclient.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./media +INCLUDEDIR += -I./rtp +INCLUDEDIR += -I./srt +INCLUDEDIR += -I./libsrt/include +LIBDIRS = +OBJS += bm/base64.o +OBJS += bm/hqueue.o +OBJS += bm/linked_list.o +OBJS += bm/ppstack.o +OBJS += bm/rfc_md5.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 += media/media_util.o +OBJS += rtp/ts_parser.o +OBJS += srt/srt_cln.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 + diff --git a/MediaClient/MediaClient/SrtClientLibrary-ios.mk b/MediaClient/MediaClient/SrtClientLibrary-ios.mk new file mode 100644 index 0000000..75dea5c --- /dev/null +++ b/MediaClient/MediaClient/SrtClientLibrary-ios.mk @@ -0,0 +1,71 @@ +################OPTION################### +OUTPUT = libsrtclient.a +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./media +INCLUDEDIR += -I./rtp +INCLUDEDIR += -I./srt +INCLUDEDIR += -I./libsrt/include +LIBDIRS = +OBJS += bm/base64.o +OBJS += bm/hqueue.o +OBJS += bm/linked_list.o +OBJS += bm/ppstack.o +OBJS += bm/rfc_md5.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 += media/media_util.o +OBJS += rtp/ts_parser.o +OBJS += srt/srt_cln.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 + diff --git a/MediaClient/MediaClient/SrtClientLibrary-mac.mk b/MediaClient/MediaClient/SrtClientLibrary-mac.mk new file mode 100644 index 0000000..63c238f --- /dev/null +++ b/MediaClient/MediaClient/SrtClientLibrary-mac.mk @@ -0,0 +1,64 @@ +################OPTION################### +OUTPUT = libsrtclient.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./media +INCLUDEDIR += -I./rtp +INCLUDEDIR += -I./srt +INCLUDEDIR += -I./libsrt/include +LIBDIRS = -L/usr/local/lib +OBJS += bm/base64.o +OBJS += bm/hqueue.o +OBJS += bm/linked_list.o +OBJS += bm/ppstack.o +OBJS += bm/rfc_md5.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 += media/media_util.o +OBJS += rtp/ts_parser.o +OBJS += srt/srt_cln.o + +SHAREDLIB += -lsrt + +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 + diff --git a/MediaClient/MediaClient/SrtClientLibrary-static.mk b/MediaClient/MediaClient/SrtClientLibrary-static.mk new file mode 100644 index 0000000..56b3cde --- /dev/null +++ b/MediaClient/MediaClient/SrtClientLibrary-static.mk @@ -0,0 +1,64 @@ +################OPTION################### +OUTPUT = libsrtclient.a +CCOMPILE = gcc +CPPCOMPILE = g++ +COMPILEOPTION += -c -O3 -fPIC -Wall +LINK = ar +LINKOPTION = cr $(OUTPUT) +INCLUDEDIR += -I. +INCLUDEDIR += -I./bm +INCLUDEDIR += -I./media +INCLUDEDIR += -I./rtp +INCLUDEDIR += -I./srt +INCLUDEDIR += -I./libsrt/include +LIBDIRS = +OBJS += bm/base64.o +OBJS += bm/hqueue.o +OBJS += bm/linked_list.o +OBJS += bm/ppstack.o +OBJS += bm/rfc_md5.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 += media/media_util.o +OBJS += rtp/ts_parser.o +OBJS += srt/srt_cln.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 + diff --git a/MediaClient/MediaClient/SrtClientLibrary.mk b/MediaClient/MediaClient/SrtClientLibrary.mk new file mode 100644 index 0000000..72ef265 --- /dev/null +++ b/MediaClient/MediaClient/SrtClientLibrary.mk @@ -0,0 +1,64 @@ +################OPTION################### +OUTPUT = libsrtclient.so +CCOMPILE = gcc +CPPCOMPILE = g++ +COMPILEOPTION += -c -O3 -fPIC -Wall +LINK = g++ +LINKOPTION = -shared -o $(OUTPUT) +INCLUDEDIR += -I. +INCLUDEDIR += -I./bm +INCLUDEDIR += -I./media +INCLUDEDIR += -I./rtp +INCLUDEDIR += -I./srt +INCLUDEDIR += -I./libsrt/include +LIBDIRS = +OBJS += bm/base64.o +OBJS += bm/hqueue.o +OBJS += bm/linked_list.o +OBJS += bm/ppstack.o +OBJS += bm/rfc_md5.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 += media/media_util.o +OBJS += rtp/ts_parser.o +OBJS += srt/srt_cln.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 + diff --git a/MediaClient/MediaClient/SrtClientLibrary.vcxproj b/MediaClient/MediaClient/SrtClientLibrary.vcxproj new file mode 100644 index 0000000..0a15a04 --- /dev/null +++ b/MediaClient/MediaClient/SrtClientLibrary.vcxproj @@ -0,0 +1,202 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {E2643523-9ABC-4B3A-8710-BD9EB8E44A5D} + Win32Proj + srtclient + 10.0 + + + + StaticLibrary + true + Unicode + v143 + + + StaticLibrary + true + Unicode + v143 + + + StaticLibrary + false + true + Unicode + v143 + + + StaticLibrary + false + true + Unicode + v143 + + + + + + + + + + + + + + + + + + + true + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Configuration)\$(ProjectName)\ + + + true + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\$(ProjectName)\ + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Configuration)\$(ProjectName)\ + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\$(ProjectName)\ + + + + + + Level3 + Disabled + _DEBUG;_CONSOLE;HT_STATIC;%(PreprocessorDefinitions) + .\;.\bm;.\rtp;.\srt;.\media;.\libsrt\include;%(AdditionalIncludeDirectories) + 4996;4244 + + + Console + true + + + $(OutDir)\$(ProjectName).lib + + + + + + + Level3 + Disabled + _DEBUG;_CONSOLE;HT_STATIC;%(PreprocessorDefinitions) + .\;.\bm;.\rtp;.\srt;.\media;.\libsrt\include;%(AdditionalIncludeDirectories) + 4996;4267;4244 + + + Console + true + + + $(OutDir)\$(ProjectName).lib + + + + + Level3 + + + MaxSpeed + true + true + NDEBUG;_CONSOLE;HT_STATIC;%(PreprocessorDefinitions) + .\;.\bm;.\rtp;.\srt;.\media;.\libsrt\include;%(AdditionalIncludeDirectories) + 4996;4244 + + + Console + true + true + true + + + $(OutDir)\$(ProjectName).lib + + + + + Level3 + + + MaxSpeed + true + true + NDEBUG;_CONSOLE;HT_STATIC;%(PreprocessorDefinitions) + .\;.\bm;.\rtp;.\srt;.\media;.\libsrt\include;%(AdditionalIncludeDirectories) + 4996;4244;4267 + + + Console + true + true + true + + + $(OutDir)\$(ProjectName).lib + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MediaClient/MediaClient/SrtClientLibrary.vcxproj.filters b/MediaClient/MediaClient/SrtClientLibrary.vcxproj.filters new file mode 100644 index 0000000..19e76bb --- /dev/null +++ b/MediaClient/MediaClient/SrtClientLibrary.vcxproj.filters @@ -0,0 +1,96 @@ + + + + + bm + + + bm + + + bm + + + bm + + + bm + + + bm + + + bm + + + bm + + + bm + + + bm + + + bm + + + rtp + + + srt + + + media + + + + + {8e8dae7f-b02d-4adc-9b0a-e29361fe1fc2} + + + {89022a3a-a8b6-4b71-8626-84f6fcb9f97b} + + + {bbeab1c5-1c77-4d15-bf46-a29278851420} + + + {59d290fe-3c75-4b4b-b2ed-0d76c97dd8b0} + + + + + bm + + + bm + + + bm + + + bm + + + bm + + + bm + + + bm + + + bm + + + bm + + + bm + + + bm + + + \ No newline at end of file diff --git a/MediaClient/MediaClient/bm/base64.cpp b/MediaClient/MediaClient/bm/base64.cpp new file mode 100644 index 0000000..6f4cb4c --- /dev/null +++ b/MediaClient/MediaClient/bm/base64.cpp @@ -0,0 +1,181 @@ +/*************************************************************************************** + * + * 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 "base64.h" + + +const char *BASE64_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + +void base64_encode_triple(uint8 triple[3], char result[4]) +{ + int tripleValue, i; + + tripleValue = triple[0]; + tripleValue *= 256; + tripleValue += triple[1]; + tripleValue *= 256; + tripleValue += triple[2]; + + for (i=0; i<4; i++) + { + result[3-i] = BASE64_CHARS[tripleValue % 64]; + tripleValue /= 64; + } +} + +/** + * encode an array of bytes using Base64 (RFC 3548) + * + * @param source the source buffer + * @param sourcelen the length of the source buffer + * @param target the target buffer + * @param targetlen the length of the target buffer + * @return 1 on success, 0 otherwise + */ +HT_API int base64_encode(uint8 *source, uint32 sourcelen, char *target, uint32 targetlen) +{ + /* check if the result will fit in the target buffer */ + if ((sourcelen+2)/3*4 > targetlen-1) + { + return 0; + } + + /* encode all full triples */ + while (sourcelen >= 3) + { + base64_encode_triple(source, target); + sourcelen -= 3; + source += 3; + target += 4; + } + + /* encode the last one or two characters */ + if (sourcelen > 0) + { + uint8 temp[3]; + memset(temp, 0, sizeof(temp)); + memcpy(temp, source, sourcelen); + base64_encode_triple(temp, target); + target[3] = '='; + + if (sourcelen == 1) + { + target[2] = '='; + } + + target += 4; + } + + /* terminate the string */ + target[0] = 0; + + return 1; +} + +/** + * decode base64 encoded data + * + * @param source the encoded data (zero terminated) + * @param target pointer to the target buffer + * @param targetlen length of the target buffer + * @return length of converted data on success, -1 otherwise + */ +HT_API int base64_decode(const char *source, uint32 sourcelen, uint8 *target, uint32 targetlen) +{ + const char *cur; + const char *max_src; + uint8 *dest, *max_dest; + int d, dlast, phase; + uint8 c; + static int table[256] = { + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* 00-0F */ + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* 10-1F */ + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,63, /* 20-2F */ + 52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-1,-1,-1, /* 30-3F */ + -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14, /* 40-4F */ + 15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1, /* 50-5F */ + -1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40, /* 60-6F */ + 41,42,43,44,45,46,47,48,49,50,51,-1,-1,-1,-1,-1, /* 70-7F */ + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* 80-8F */ + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* 90-9F */ + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* A0-AF */ + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* B0-BF */ + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* C0-CF */ + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* D0-DF */ + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* E0-EF */ + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 /* F0-FF */ + }; + + d = dlast = phase = 0; + dest = target; + max_dest = dest+targetlen; + max_src = source + sourcelen; + + for (cur = source; *cur != '\0' && curqueue_mode = queue_mode; + phq->unit_size = unit_size; + phq->unit_num = unit_num; + phq->front = 0; + phq->rear = 0; + phq->count_put_full = 0; + phq->queue_buffer = sizeof(HQUEUE); + + if (queue_mode & HQ_NO_EVENT) + { + phq->queue_nnulEvent = NULL; + phq->queue_nfulEvent = NULL; + phq->queue_putMutex = NULL; + } + else + { + phq->queue_nnulEvent = sys_os_create_sig(); + phq->queue_nfulEvent = sys_os_create_sig(); + phq->queue_putMutex = sys_os_create_mutex(); + } + + return phq; +} + +HT_API void hqDelete(HQUEUE * phq) +{ + if (phq == NULL) + { + return; + } + + if (phq->queue_mode & HQ_NO_EVENT) + { + } + else + { + sys_os_destroy_sig_mutex(phq->queue_nnulEvent); + sys_os_destroy_sig_mutex(phq->queue_nfulEvent); + sys_os_destroy_sig_mutex(phq->queue_putMutex); + } + + free(phq); +} + +/***************************************************************************************/ +void hqPutMutexEnter(HQUEUE * phq) +{ + if ((phq->queue_mode & HQ_NO_EVENT) == 0) + { + sys_os_mutex_enter(phq->queue_putMutex); + } +} + +void hqPutMutexLeave(HQUEUE * phq) +{ + if ((phq->queue_mode & HQ_NO_EVENT) == 0) + { + sys_os_mutex_leave(phq->queue_putMutex); + } +} + +HT_API BOOL hqBufPut(HQUEUE * phq, char * buf) +{ + uint32 real_rear, queue_count; + char * ptr; + + if (phq == NULL || buf == NULL) + { + return FALSE; + } + + hqPutMutexEnter(phq); + +hqBufPut_start: + + queue_count = phq->rear - phq->front; + + if (queue_count == (phq->unit_num - 1)) + { + if ((phq->queue_mode & HQ_NO_EVENT) == 0) + { + if (phq->queue_mode & HQ_PUT_WAIT) + { + sys_os_sig_wait(phq->queue_nfulEvent); + goto hqBufPut_start; + } + else + { + phq->count_put_full++; + hqPutMutexLeave(phq); + + // log_print(HT_LOG_ERR, "%s, queue_count=%d,full!!!\r\n", __FUNCTION__, queue_count); + return FALSE; + } + } + else + { + hqPutMutexLeave(phq); + return FALSE; + } + } + + real_rear = phq->rear % phq->unit_num; + ptr = ((char *)phq) + phq->queue_buffer + real_rear*phq->unit_size; + memcpy((char *)ptr, buf, phq->unit_size); + phq->rear++; + + if ((phq->queue_mode & HQ_NO_EVENT) == 0) + { + sys_os_sig_sign(phq->queue_nnulEvent); + } + + hqPutMutexLeave(phq); + + return TRUE; +} + +HT_API BOOL hqBufGet(HQUEUE * phq, char * buf) +{ + uint32 real_front; + + if (phq == NULL || buf == NULL) + { + return FALSE; + } + +hqBufGet_start: + + if (phq->front == phq->rear) + { + if ((phq->queue_mode & HQ_NO_EVENT) == 0) + { + if (phq->queue_mode & HQ_GET_WAIT) + { + sys_os_sig_wait(phq->queue_nnulEvent); + goto hqBufGet_start; + } + else + { + return FALSE; + } + } + else + { + return FALSE; + } + } + + real_front = phq->front % phq->unit_num; + memcpy(buf, ((char *)phq) + phq->queue_buffer + real_front*phq->unit_size, phq->unit_size); + phq->front++; + + if ((phq->queue_mode & HQ_NO_EVENT) == 0) + { + sys_os_sig_sign(phq->queue_nfulEvent); + } + + return TRUE; +} + +HT_API BOOL hqBufIsEmpty(HQUEUE * phq) +{ + if (phq == NULL) + { + return TRUE; + } + + if (phq->front == phq->rear) + { + return TRUE; + } + + return FALSE; +} + +HT_API BOOL hqBufIsFull(HQUEUE * phq) +{ + uint32 queue_count; + + if (phq == NULL) + { + return FALSE; + } + + queue_count = phq->rear - phq->front; + + if (queue_count == (phq->unit_num - 1)) + { + return TRUE; + } + + return FALSE; +} + +HT_API char * hqBufGetWait(HQUEUE * phq) +{ + uint32 real_front; + char * ptr = NULL; + + if (phq == NULL) + { + return NULL; + } + +hqBufGet_start: + + if (phq->front == phq->rear) + { + if ((phq->queue_mode & HQ_NO_EVENT) == 0) + { + if (phq->queue_mode & HQ_GET_WAIT) + { + sys_os_sig_wait(phq->queue_nnulEvent); + goto hqBufGet_start; + } + else + { + return NULL; + } + } + else + { + return NULL; + } + } + + real_front = phq->front % phq->unit_num; + + ptr = ((char *)phq) + phq->queue_buffer + real_front*phq->unit_size; + return ptr; +} + +HT_API void hqBufGetWaitPost(HQUEUE * phq) +{ + if (phq == NULL) + { + return; + } + + phq->front++; + + if ((phq->queue_mode & HQ_NO_EVENT) == 0) + { + sys_os_sig_sign(phq->queue_nfulEvent); + } +} + +HT_API char * hqBufPutPtrWait(HQUEUE * phq) +{ + uint32 real_rear,queue_count; + char * ptr; + + if (phq == NULL) + { + return NULL; + } + + hqPutMutexEnter(phq); + +hqBufPutPtr_start: + + queue_count = phq->rear - phq->front; + + if (queue_count == (phq->unit_num - 1)) + { + if ((phq->queue_mode & HQ_NO_EVENT) == 0) + { + if (phq->queue_mode & HQ_PUT_WAIT) + { + sys_os_sig_wait(phq->queue_nfulEvent); + goto hqBufPutPtr_start; + } + else + { + phq->count_put_full++; + hqPutMutexLeave(phq); + return FALSE; + } + } + else + { + hqPutMutexLeave(phq); + return FALSE; + } + } + + real_rear = phq->rear % phq->unit_num; + ptr = ((char *)phq) + phq->queue_buffer + real_rear*phq->unit_size; + + return ptr; +} + +HT_API void hqBufPutPtrWaitPost(HQUEUE * phq, BOOL bPutFinish) +{ + if (phq == NULL) + { + return; + } + + if (bPutFinish) + { + phq->rear++; + } + + if ((phq->queue_mode & HQ_NO_EVENT) == 0) + { + sys_os_sig_sign(phq->queue_nnulEvent); + } + + hqPutMutexLeave(phq); +} + +HT_API BOOL hqBufPeek(HQUEUE * phq, char * buf) +{ + uint32 real_front; + + if (phq == NULL || buf == NULL) + { + return FALSE; + } + +hqBufPeek_start: + + if (phq->front == phq->rear) + { + if ((phq->queue_mode & HQ_NO_EVENT) == 0) + { + if (phq->queue_mode & HQ_GET_WAIT) + { + sys_os_sig_wait(phq->queue_nnulEvent); + goto hqBufPeek_start; + } + else + { + return FALSE; + } + } + else + { + return FALSE; + } + } + + real_front = phq->front % phq->unit_num; + memcpy(buf, ((char *)phq) + phq->queue_buffer + real_front*phq->unit_size, phq->unit_size); + + return TRUE; +} + + + + diff --git a/MediaClient/MediaClient/bm/hqueue.h b/MediaClient/MediaClient/bm/hqueue.h new file mode 100644 index 0000000..eae000f --- /dev/null +++ b/MediaClient/MediaClient/bm/hqueue.h @@ -0,0 +1,74 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef HQUEUE_H +#define HQUEUE_H + + +/***********************************************************/ +#define HQ_PUT_WAIT 0x00000001 +#define HQ_GET_WAIT 0x00000002 +#define HQ_NO_EVENT 0x00000004 + +/***********************************************************/ +typedef struct h_queue +{ + uint32 queue_mode; + uint32 unit_num; + uint32 unit_size; + uint32 front; + uint32 rear; + uint32 queue_buffer; + uint32 count_put_full; + + void * queue_putMutex; + void * queue_nnulEvent; + void * queue_nfulEvent; +} HQUEUE; + + +#ifdef __cplusplus +extern "C" { +#endif + +/***********************************************************/ +HT_API HQUEUE * hqCreate(uint32 unit_num, uint32 unit_size, uint32 queue_mode); +HT_API void hqDelete(HQUEUE * phq); + +HT_API BOOL hqBufPut(HQUEUE * phq,char * buf); +HT_API BOOL hqBufGet(HQUEUE * phq,char * buf); + +HT_API BOOL hqBufIsEmpty(HQUEUE * phq); +HT_API BOOL hqBufIsFull(HQUEUE * phq); + +HT_API char * hqBufGetWait(HQUEUE * phq); +HT_API void hqBufGetWaitPost(HQUEUE * phq); + +HT_API char * hqBufPutPtrWait(HQUEUE * phq); +HT_API void hqBufPutPtrWaitPost(HQUEUE * phq, BOOL bPutFinish); +HT_API BOOL hqBufPeek(HQUEUE * phq,char * buf); + +#ifdef __cplusplus +} +#endif + +#endif // HQUEUE_H + + + diff --git a/MediaClient/MediaClient/bm/linked_list.cpp b/MediaClient/MediaClient/bm/linked_list.cpp new file mode 100644 index 0000000..acc2c64 --- /dev/null +++ b/MediaClient/MediaClient/bm/linked_list.cpp @@ -0,0 +1,632 @@ +/*************************************************************************************** + * + * 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 "linked_list.h" + + +/************************************************************************************/ +HT_API LINKED_LIST * h_list_create(BOOL bNeedMutex) +{ + LINKED_LIST * p_linked_list; + + p_linked_list = (LINKED_LIST*) malloc(sizeof(LINKED_LIST)); + if (p_linked_list == NULL) + { + return NULL; + } + + p_linked_list->p_first_node = NULL; + p_linked_list->p_last_node = NULL; + + if (bNeedMutex) + { + p_linked_list->list_semMutex = sys_os_create_mutex(); + } + else + { + p_linked_list->list_semMutex = NULL; + } + + return p_linked_list; +} + +/************************************************************************************/ +HT_API void h_list_get_ownership(LINKED_LIST * p_linked_list) +{ + if (p_linked_list->list_semMutex) + { + sys_os_mutex_enter(p_linked_list->list_semMutex); + } +} + +HT_API void h_list_giveup_ownership(LINKED_LIST * p_linked_list) +{ + if (p_linked_list->list_semMutex) + { + sys_os_mutex_leave(p_linked_list->list_semMutex); + } +} + +/************************************************************************************/ +HT_API void h_list_free_container(LINKED_LIST * p_linked_list) +{ + LINKED_NODE * p_node; + LINKED_NODE * p_next_node; + + if (p_linked_list == NULL) + { + return; + } + + h_list_get_ownership(p_linked_list); + + p_node = p_linked_list->p_first_node; + + while (p_node != NULL) + { + void * p_free; + + p_next_node = p_node->p_next; + + p_free = p_node->p_data; + + if (p_free != NULL) + { + free(p_free); + } + + free (p_node); + + p_node = p_next_node; + } + + h_list_giveup_ownership(p_linked_list); + + if (p_linked_list->list_semMutex) + { + sys_os_destroy_sig_mutex(p_linked_list->list_semMutex); + } + + free (p_linked_list); +} + +/************************************************************************************/ +HT_API void h_list_free_all_node(LINKED_LIST * p_linked_list) +{ + LINKED_NODE * p_node; + LINKED_NODE * p_next_node; + + if (p_linked_list == NULL) + { + return; + } + + h_list_get_ownership(p_linked_list); + + p_node = p_linked_list->p_first_node; + + while (p_node != NULL) + { + p_next_node = p_node->p_next; + + if (p_node->p_data != NULL) + { + free(p_node->p_data); + } + + free (p_node); + + p_node = p_next_node; + } + + p_linked_list->p_first_node = NULL; + p_linked_list->p_last_node = NULL; + + h_list_giveup_ownership(p_linked_list); +} + +/************************************************************************************/ +HT_API BOOL h_list_add_at_front(LINKED_LIST * p_linked_list, void * p_item) +{ + LINKED_NODE * p_node; + LINKED_NODE * p_next_node; + + if (p_linked_list == NULL) + { + return FALSE; + } + + if (p_item == NULL) + { + return FALSE; + } + + p_node = (LINKED_NODE*) malloc(sizeof(LINKED_NODE)); + if (p_node == NULL) + { + return FALSE; + } + + p_node->p_next = NULL; + p_node->p_previous = NULL; + p_node->p_data = p_item; + + h_list_get_ownership(p_linked_list); + + if (p_linked_list->p_first_node == NULL) + { + p_linked_list->p_first_node = p_node; + p_linked_list->p_last_node = p_node; + + p_node->p_previous = NULL; + p_node->p_next = NULL; + } + else + { + p_next_node = p_linked_list->p_first_node; + + p_node->p_next = p_next_node; + p_node->p_previous = NULL; + + p_next_node->p_previous = p_node; + p_linked_list->p_first_node = p_node; + } + + h_list_giveup_ownership(p_linked_list); + + return TRUE; +} + +/************************************************************************************/ +HT_API void h_list_remove_from_front(LINKED_LIST * p_linked_list) +{ + LINKED_NODE * p_node_to_remove; + + if (p_linked_list == NULL) + { + return; + } + + h_list_get_ownership(p_linked_list); + + p_node_to_remove = p_linked_list->p_first_node; + + if (p_node_to_remove == NULL) + { + h_list_giveup_ownership(p_linked_list); + return; + } + + if (p_linked_list->p_first_node == p_linked_list->p_last_node) + { + p_linked_list->p_first_node = NULL; + p_linked_list->p_last_node = NULL; + } + else + { + p_linked_list->p_first_node = p_node_to_remove->p_next; + p_linked_list->p_first_node->p_previous = NULL; + } + + free(p_node_to_remove); + + h_list_giveup_ownership(p_linked_list); +} + +HT_API void h_list_remove_from_front_no_lock(LINKED_LIST * p_linked_list) +{ + LINKED_NODE * p_node_to_remove; + + if (p_linked_list == NULL) + { + return; + } + + p_node_to_remove = p_linked_list->p_first_node; + + if (p_node_to_remove == NULL) + { + return; + } + + if (p_linked_list->p_first_node == p_linked_list->p_last_node) + { + p_linked_list->p_first_node = NULL; + p_linked_list->p_last_node = NULL; + } + else + { + p_linked_list->p_first_node = p_node_to_remove->p_next; + p_linked_list->p_first_node->p_previous = NULL; + } + + free (p_node_to_remove); +} + +/************************************************************************************/ +HT_API BOOL h_list_add_at_back(LINKED_LIST * p_linked_list, void * p_item) +{ + LINKED_NODE * p_node; + LINKED_NODE * p_previous_node; + + if (p_linked_list == NULL) + { + return FALSE; + } + + if (p_item == NULL) + { + return FALSE; + } + + p_node = (LINKED_NODE*) malloc(sizeof(LINKED_NODE)); + if (p_node == NULL) + { + return FALSE; + } + + p_node->p_next = NULL; + p_node->p_previous = NULL; + p_node->p_data = (void*) p_item; + + h_list_get_ownership(p_linked_list); + + if (p_linked_list->p_last_node == NULL) + { + p_linked_list->p_last_node = p_node; + p_linked_list->p_first_node = p_node; + + p_node->p_next = NULL; + p_node->p_previous = NULL; + } + else + { + p_previous_node = p_linked_list->p_last_node; + + p_node->p_next = NULL; + p_node->p_previous = p_previous_node; + + p_previous_node->p_next = p_node; + + p_linked_list->p_last_node = p_node; + } + + h_list_giveup_ownership(p_linked_list); + + return TRUE; +} + +/************************************************************************************/ +HT_API void h_list_remove_from_back(LINKED_LIST * p_linked_list) +{ + LINKED_NODE * p_node_to_remove; + + if (p_linked_list == NULL) + { + return; + } + + h_list_get_ownership(p_linked_list); + + if (p_linked_list->p_last_node == NULL) + { + h_list_giveup_ownership(p_linked_list); + return; + } + + if (p_linked_list->p_first_node == p_linked_list->p_last_node) + { + p_node_to_remove = p_linked_list->p_first_node; + + p_linked_list->p_first_node = NULL; + p_linked_list->p_last_node = NULL; + + free(p_node_to_remove); + + h_list_giveup_ownership(p_linked_list); + return; + } + + p_node_to_remove = p_linked_list->p_last_node; + + p_linked_list->p_last_node = p_node_to_remove->p_previous; + + p_linked_list->p_last_node->p_next = NULL; + + free(p_node_to_remove); + + p_node_to_remove = NULL; + + h_list_giveup_ownership(p_linked_list); +} + +HT_API BOOL h_list_remove(LINKED_LIST * p_linked_list, LINKED_NODE * p_node) +{ + LINKED_NODE * p_previous_node; + LINKED_NODE * p_next_node; + + if ((p_linked_list == NULL) || (p_node == NULL)) + { + return FALSE; + } + + p_previous_node = p_node->p_previous; + + p_next_node = p_node->p_next; + + if (p_previous_node != NULL) + { + p_previous_node->p_next = p_next_node; + } + else + { + p_linked_list->p_first_node = p_next_node; + } + + if (p_next_node != NULL) + { + p_next_node->p_previous = p_previous_node; + } + else + { + p_linked_list->p_last_node = p_previous_node; + } + + free (p_node); + + return TRUE; +} + +HT_API BOOL h_list_remove_data(LINKED_LIST * p_linked_list, void * p_data) +{ + LINKED_NODE * p_previous_node; + LINKED_NODE * p_next_node; + LINKED_NODE * p_node; + + if ((p_linked_list == NULL) || (p_data == NULL)) + { + return FALSE; + } + + h_list_get_ownership(p_linked_list); + + p_node = p_linked_list->p_first_node; + + while (p_node != NULL) + { + if (p_data == p_node->p_data) + { + break; + } + + p_node = p_node->p_next; + } + + if (p_node == NULL) + { + h_list_giveup_ownership(p_linked_list); + return FALSE; + } + + p_previous_node = p_node->p_previous; + + p_next_node = p_node->p_next; + + if (p_previous_node != NULL) + { + p_previous_node->p_next = p_next_node; + } + else + { + p_linked_list->p_first_node = p_next_node; + } + + if (p_next_node != NULL) + { + p_next_node->p_previous = p_previous_node; + } + else + { + p_linked_list->p_last_node = p_previous_node; + } + + free(p_node); + + h_list_giveup_ownership(p_linked_list); + + return TRUE; +} + +/************************************************************************************/ +HT_API uint32 h_list_get_number_of_nodes(LINKED_LIST * p_linked_list) +{ + uint32 number_of_nodes; + LINKED_NODE * p_node; + + if (NULL == p_linked_list) + { + return 0; + } + + h_list_get_ownership(p_linked_list); + + p_node = p_linked_list->p_first_node; + + number_of_nodes = 0; + + while (p_node != NULL) + { + ++ number_of_nodes; + p_node = p_node->p_next; + } + + h_list_giveup_ownership(p_linked_list); + + return number_of_nodes; +} + +/************************************************************************************/ +HT_API BOOL h_list_insert(LINKED_LIST * p_linked_list, LINKED_NODE * p_pre_node, void *p_item) +{ + if ((p_linked_list == NULL) || (p_item == NULL)) + { + return FALSE; + } + + if (p_pre_node == NULL) + { + h_list_add_at_front(p_linked_list, p_item); + } + else + { + if (p_pre_node->p_next == NULL) + { + h_list_add_at_back(p_linked_list, p_item); + } + else + { + LINKED_NODE * p_node = (LINKED_NODE *)malloc(sizeof(LINKED_NODE)); + if (NULL == p_node) + { + return FALSE; + } + + h_list_get_ownership(p_linked_list); + + p_node->p_data = p_item; + p_node->p_next = p_pre_node->p_next; + p_node->p_previous = p_pre_node; + p_pre_node->p_next->p_previous = p_node; + p_pre_node->p_next = p_node; + + h_list_giveup_ownership(p_linked_list); + } + } + + return TRUE; +} + +/***********************************************************************/ +HT_API LINKED_NODE * h_list_lookup_start(LINKED_LIST * p_linked_list) +{ + if (p_linked_list == NULL) + { + return NULL; + } + + h_list_get_ownership(p_linked_list); + + if (p_linked_list->p_first_node) + { + return p_linked_list->p_first_node; + } + + return NULL; +} + +HT_API LINKED_NODE * h_list_lookup_next(LINKED_LIST * p_linked_list, LINKED_NODE * p_node) +{ + if (p_node == NULL) + { + return NULL; + } + + return p_node->p_next; +} + +HT_API void h_list_lookup_end(LINKED_LIST * p_linked_list) +{ + if (p_linked_list == NULL) + { + return; + } + + h_list_giveup_ownership(p_linked_list); +} + +HT_API LINKED_NODE * h_list_lookback_start(LINKED_LIST * p_linked_list) +{ + if (p_linked_list == NULL) + { + return NULL; + } + + h_list_get_ownership(p_linked_list); + + if (p_linked_list->p_last_node) + { + return p_linked_list->p_last_node; + } + + return NULL; +} + +HT_API LINKED_NODE * h_list_lookback_next(LINKED_LIST * p_linked_list, LINKED_NODE * p_node) +{ + if (p_node == NULL) + { + return NULL; + } + + return p_node->p_previous; +} + +HT_API void h_list_lookback_end(LINKED_LIST * p_linked_list) +{ + if (p_linked_list == NULL) + { + return; + } + + h_list_giveup_ownership(p_linked_list); +} + +HT_API LINKED_NODE * h_list_get_from_front(LINKED_LIST * p_list) +{ + if (p_list == NULL) + { + return NULL; + } + + return p_list->p_first_node; +} + +HT_API LINKED_NODE * h_list_get_from_back(LINKED_LIST * p_list) +{ + if (p_list == NULL) + { + return NULL; + } + + return p_list->p_last_node; +} + +HT_API BOOL h_list_is_empty(LINKED_LIST * p_list) +{ + if (p_list == NULL) + { + return TRUE; + } + + return (p_list->p_first_node == NULL); +} + + + diff --git a/MediaClient/MediaClient/bm/linked_list.h b/MediaClient/MediaClient/bm/linked_list.h new file mode 100644 index 0000000..798bef9 --- /dev/null +++ b/MediaClient/MediaClient/bm/linked_list.h @@ -0,0 +1,83 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef LINKED_LIST_H +#define LINKED_LIST_H + +/************************************************************************************/ +typedef struct LINKED_NODE +{ + struct LINKED_NODE * p_next; + struct LINKED_NODE * p_previous; + void * p_data; +} LINKED_NODE; + +/************************************************************************************/ +typedef struct LINKED_LIST +{ + LINKED_NODE * p_first_node; + LINKED_NODE * p_last_node; + void * list_semMutex; +} LINKED_LIST; + + +#ifdef __cplusplus +extern "C" { +#endif + +HT_API LINKED_LIST* h_list_create(BOOL bNeedMutex); +HT_API void h_list_free_container(LINKED_LIST * p_linked_list); +HT_API void h_list_free_all_node(LINKED_LIST * p_linked_list); + +HT_API void h_list_get_ownership(LINKED_LIST * p_linked_list); +HT_API void h_list_giveup_ownership(LINKED_LIST * p_linked_list); + +HT_API BOOL h_list_remove(LINKED_LIST * p_linked_list, LINKED_NODE * p_node); +HT_API BOOL h_list_remove_data(LINKED_LIST * p_linked_list, void * p_data); + +HT_API void h_list_remove_from_front(LINKED_LIST * p_linked_list); +HT_API void h_list_remove_from_front_no_lock(LINKED_LIST * p_linked_list); +HT_API void h_list_remove_from_back(LINKED_LIST * p_linked_list); + +HT_API BOOL h_list_add_at_front(LINKED_LIST * p_linked_list, void * p_item); +HT_API BOOL h_list_add_at_back(LINKED_LIST * p_linked_list, void * p_item); + +HT_API uint32 h_list_get_number_of_nodes(LINKED_LIST * p_linked_list); + +HT_API BOOL h_list_insert(LINKED_LIST * p_linked_list, LINKED_NODE * p_pre_node, void * p_item); + +HT_API LINKED_NODE* h_list_lookup_start(LINKED_LIST * p_linked_list); +HT_API LINKED_NODE* h_list_lookup_next(LINKED_LIST * p_linked_list, LINKED_NODE * p_node); +HT_API void h_list_lookup_end(LINKED_LIST * p_linked_list); + +HT_API LINKED_NODE* h_list_lookback_start(LINKED_LIST * p_linked_list); +HT_API LINKED_NODE* h_list_lookback_next(LINKED_LIST * p_linked_list, LINKED_NODE * p_node); +HT_API void h_list_lookback_end(LINKED_LIST * p_linked_list); + +HT_API BOOL h_list_is_empty(LINKED_LIST * p_list); +HT_API LINKED_NODE* h_list_get_from_front(LINKED_LIST * p_list); +HT_API LINKED_NODE* h_list_get_from_back(LINKED_LIST * p_list); + +#ifdef __cplusplus +} +#endif + +#endif // LINKED_LIST_H + + diff --git a/MediaClient/MediaClient/bm/ppstack.cpp b/MediaClient/MediaClient/bm/ppstack.cpp new file mode 100644 index 0000000..d2e12e0 --- /dev/null +++ b/MediaClient/MediaClient/bm/ppstack.cpp @@ -0,0 +1,1109 @@ +/*************************************************************************************** + * + * 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 "ppstack.h" + +/***************************************************************************************/ +HT_API PPSN_CTX * pps_ctx_fl_init_assign(char * mem_addr, unsigned long mem_len, unsigned long node_num, unsigned long content_size, BOOL bNeedMutex) +{ + PPSN_CTX * ctx_ptr; + uint32 i = 0; + unsigned long unit_len = content_size + sizeof(PPSN); + unsigned long content_len = node_num * unit_len; + + if (mem_len < (content_len + sizeof(PPSN_CTX))) + { + log_print(HT_LOG_ERR, "%s, assign mem len too short!!!\r\n", __FUNCTION__); + return NULL; + } + + ctx_ptr = (PPSN_CTX *)mem_addr; + memset(ctx_ptr, 0, sizeof(PPSN_CTX)); + memset((char *)(mem_addr+sizeof(PPSN_CTX)), 0, content_len); + + for (; ihead_node == 0) + { + ctx_ptr->head_node = offset; + ctx_ptr->tail_node = offset; + } + else + { + PPSN * p_prev_node = (PPSN *)(mem_addr + ctx_ptr->tail_node); + p_prev_node->next_node = offset; + p_node->prev_node = ctx_ptr->tail_node; + ctx_ptr->tail_node = offset; + } + + p_node->node_flag = 1; + + (ctx_ptr->node_num)++; + } + + if (bNeedMutex) + { + ctx_ptr->ctx_mutex = sys_os_create_mutex(); + } + else + { + ctx_ptr->ctx_mutex = 0; + } + + ctx_ptr->fl_base = (char *)ctx_ptr; + ctx_ptr->low_offset = sizeof(PPSN_CTX) + sizeof(PPSN); + ctx_ptr->high_offset = sizeof(PPSN_CTX) + content_len - unit_len + sizeof(PPSN); + ctx_ptr->unit_size = unit_len; + + return ctx_ptr; +} + +HT_API PPSN_CTX * pps_ctx_fl_init(unsigned long node_num, unsigned long content_size, BOOL bNeedMutex) +{ + unsigned long unit_len = content_size + sizeof(PPSN); + unsigned long content_len = node_num * unit_len; + char * content_ptr; + PPSN_CTX * ctx_ptr; + + content_ptr = (char *)malloc(content_len + sizeof(PPSN_CTX)); + if (content_ptr == NULL) + { + log_print(HT_LOG_ERR, "%s, memory malloc failed,len = %d\r\n", __FUNCTION__, content_len); + return NULL; + } + + ctx_ptr = pps_ctx_fl_init_assign(content_ptr, content_len+sizeof(PPSN_CTX), node_num, content_size, bNeedMutex); + + return ctx_ptr; +} + +HT_API void pps_fl_free(PPSN_CTX * fl_ctx) +{ + if (fl_ctx == NULL) + { + return; + } + + if (fl_ctx->ctx_mutex) + { + sys_os_destroy_sig_mutex(fl_ctx->ctx_mutex); + } + + free(fl_ctx); +} + +/***************************************************************************************/ +HT_API void pps_fl_reinit(PPSN_CTX * fl_ctx) +{ + uint32 i = 0; + char * mem_addr; + char * content_start; + char * content_end; + unsigned long content_len; + + if (fl_ctx == NULL) + { + return; + } + + mem_addr = (char *)fl_ctx; + + pps_wait_mutex(fl_ctx); + + content_start = (char *)(mem_addr + fl_ctx->low_offset - sizeof(PPSN)); + content_end = (char *)(mem_addr + fl_ctx->high_offset - sizeof(PPSN) + fl_ctx->unit_size); + + content_len = (unsigned long)(content_end - content_start); + fl_ctx->node_num = content_len / fl_ctx->unit_size; + fl_ctx->head_node = 0; + fl_ctx->tail_node = 0; + + memset(content_start, 0, content_len); + + for (; inode_num; i++) + { + uint32 offset = sizeof(PPSN_CTX) + fl_ctx->unit_size * i; + PPSN * p_node = (PPSN *)(mem_addr + offset); + + if (fl_ctx->head_node == 0) + { + fl_ctx->head_node = offset; + fl_ctx->tail_node = offset; + } + else + { + PPSN * p_prev_node = (PPSN *)(mem_addr + fl_ctx->tail_node); + p_prev_node->next_node = offset; + p_node->prev_node = fl_ctx->tail_node; + fl_ctx->tail_node = offset; + } + + p_node->node_flag = 1; + } + + pps_post_mutex(fl_ctx); +} + +HT_API BOOL pps_fl_push(PPSN_CTX * pps_ctx, void * content_ptr) +{ + PPSN * p_node; + unsigned long offset; + + if (pps_ctx == NULL || content_ptr == NULL) + { + return FALSE; + } + + if (pps_safe_node(pps_ctx, content_ptr) == FALSE) + { + log_print(HT_LOG_WARN, "%s, unit ptr error!!!\r\n", __FUNCTION__); + return FALSE; + } + + p_node = (PPSN *)(((char *)content_ptr) - sizeof(PPSN)); + + offset = (unsigned long)((char *)p_node - pps_ctx->fl_base); + + pps_wait_mutex(pps_ctx); + + if (p_node->node_flag == 1) + { + log_print(HT_LOG_WARN, "%s, unit node %d already in freelist !!!\r\n", __FUNCTION__, pps_get_index(pps_ctx, content_ptr)); + + pps_post_mutex(pps_ctx); + return FALSE; + } + + p_node->prev_node = 0; + p_node->node_flag = 1; + + if (pps_ctx->head_node == 0) + { + pps_ctx->head_node = offset; + pps_ctx->tail_node = offset; + p_node->next_node = 0; + } + else + { + PPSN * p_prev = (PPSN *)(pps_ctx->head_node + (char *)pps_ctx->fl_base); + p_prev->prev_node = offset; + p_node->next_node = pps_ctx->head_node; + pps_ctx->head_node = offset; + } + + pps_ctx->node_num++; + pps_ctx->push_cnt++; + + pps_post_mutex(pps_ctx); + + return TRUE; +} + +HT_API BOOL pps_fl_push_tail(PPSN_CTX * pps_ctx, void * content_ptr) +{ + PPSN * p_node; + unsigned long offset; + + if (pps_ctx == NULL || content_ptr == NULL) + { + return FALSE; + } + + if (pps_safe_node(pps_ctx, content_ptr) == FALSE) + { + log_print(HT_LOG_WARN, "%s, unit ptr error!!!\r\n", __FUNCTION__); + return FALSE; + } + + p_node = (PPSN *)(((char *)content_ptr) - sizeof(PPSN)); + + offset = (unsigned long)((char *)p_node - pps_ctx->fl_base); + + pps_wait_mutex(pps_ctx); + + if (p_node->node_flag == 1) + { + log_print(HT_LOG_WARN, "%s, unit node %d already in freelist !!!\r\n", __FUNCTION__, pps_get_index(pps_ctx, content_ptr)); + + pps_post_mutex(pps_ctx); + return FALSE; + } + + p_node->prev_node = 0; + p_node->next_node = 0; + p_node->node_flag = 1; + + if (pps_ctx->tail_node == 0) + { + pps_ctx->head_node = offset; + pps_ctx->tail_node = offset; + } + else + { + PPSN * p_prev; + + p_node->prev_node = pps_ctx->tail_node; + p_prev = (PPSN *)(pps_ctx->tail_node + (char *)pps_ctx); + p_prev->next_node = offset; + pps_ctx->tail_node = offset; + } + + pps_ctx->node_num++; + pps_ctx->push_cnt++; + + pps_post_mutex(pps_ctx); + + return TRUE; +} + +HT_API void * pps_fl_pop(PPSN_CTX * pps_ctx) +{ + PPSN * p_node; + + if (pps_ctx == NULL) + { + return NULL; + } + + pps_wait_mutex(pps_ctx); + + if (pps_ctx->head_node == 0) + { + pps_post_mutex(pps_ctx); + return NULL; + } + + p_node = (PPSN *)(pps_ctx->fl_base + pps_ctx->head_node); + + pps_ctx->head_node = p_node->next_node; + + if (pps_ctx->head_node == 0) + { + pps_ctx->tail_node = 0; + } + else + { + PPSN * p_new_head = (PPSN *)(pps_ctx->fl_base + pps_ctx->head_node); + p_new_head->prev_node = 0; + } + + (pps_ctx->node_num)--; + (pps_ctx->pop_cnt)++; + + pps_post_mutex(pps_ctx); + + memset(p_node, 0, sizeof(PPSN)); + + return (void *)(((char *)p_node) + sizeof(PPSN)); +} + +void pps_ctx_fl_show(PPSN_CTX * pps_ctx) +{ + uint32 offset; + unsigned long ctx_count = 0; + + if (pps_ctx == NULL) + { + return; + } + + pps_wait_mutex(pps_ctx); + + log_print(HT_LOG_DBG, "PPSN_CTX[0x%p]::unit size = %d,unit num = %d,head = %d,tail = %d\r\n", + pps_ctx->fl_base, pps_ctx->unit_size, pps_ctx->node_num, pps_ctx->head_node, pps_ctx->tail_node); + + offset = pps_ctx->head_node; + + while (offset != 0) + { + PPSN * p_node = (PPSN *)(pps_ctx->fl_base + offset); + + log_print(HT_LOG_DBG, "0x%p == FLAG: %d next: 0x%08x prev: 0x%08x\r\n", + p_node, p_node->node_flag, p_node->next_node, p_node->prev_node); + + ctx_count++; + + if (ctx_count > pps_ctx->node_num) + { + log_print(HT_LOG_WARN, "\r\n!!!FreeList Error,Linked item count[%u] > real item count[%u]\r\n", ctx_count, pps_ctx->node_num); + break; + } + + offset = p_node->next_node; + } + + log_print(HT_LOG_INFO, "\r\nFreeList Linked item count[%d]\r\n", ctx_count); + + pps_post_mutex(pps_ctx); +} + +/***************************************************************************************/ +HT_API BOOL pps_ctx_ul_init_assign(PPSN_CTX * ul_ctx, PPSN_CTX * fl_ctx, BOOL bNeedMutex) +{ + if (ul_ctx == NULL || fl_ctx == NULL) + { + return FALSE; + } + + memset(ul_ctx, 0, sizeof(PPSN_CTX)); + + ul_ctx->fl_base = fl_ctx->fl_base; + ul_ctx->high_offset = fl_ctx->high_offset; + ul_ctx->low_offset = fl_ctx->low_offset; + ul_ctx->unit_size = fl_ctx->unit_size; + + if (bNeedMutex) + { + ul_ctx->ctx_mutex = sys_os_create_mutex(); + } + else + { + ul_ctx->ctx_mutex = 0; + } + + return TRUE; +} + +HT_API PPSN_CTX * pps_ctx_ul_init(PPSN_CTX * fl_ctx, BOOL bNeedMutex) +{ + PPSN_CTX * ctx_ptr; + + if (fl_ctx == NULL) + { + return NULL; + } + + ctx_ptr = (PPSN_CTX *)malloc(sizeof(PPSN_CTX)); + if (ctx_ptr == NULL) + { + return NULL; + } + + memset(ctx_ptr, 0, sizeof(PPSN_CTX)); + + ctx_ptr->fl_base = fl_ctx->fl_base; + ctx_ptr->high_offset = fl_ctx->high_offset; // + fl_ctx->fl_base; + ctx_ptr->low_offset = fl_ctx->low_offset; // + fl_ctx->fl_base; + ctx_ptr->unit_size = fl_ctx->unit_size; + + if (bNeedMutex) + { + ctx_ptr->ctx_mutex = sys_os_create_mutex(); + } + else + { + ctx_ptr->ctx_mutex = 0; + } + + return ctx_ptr; +} + +HT_API BOOL pps_ctx_ul_init_nm(PPSN_CTX * fl_ctx, PPSN_CTX * ul_ctx) +{ + return pps_ctx_ul_init_assign(ul_ctx, fl_ctx, FALSE); +} + +/***************************************************************************************/ +HT_API void pps_ul_reinit(PPSN_CTX * ul_ctx) +{ + if (ul_ctx == NULL) + { + return; + } + + ul_ctx->node_num = 0; + ul_ctx->head_node = 0; + ul_ctx->tail_node = 0; + + pps_wait_mutex(ul_ctx); + pps_post_mutex(ul_ctx); + + if (ul_ctx->ctx_mutex) + { + sys_os_destroy_sig_mutex(ul_ctx->ctx_mutex); + } +} + +HT_API void pps_ul_free(PPSN_CTX * ul_ctx) +{ + if (ul_ctx == NULL) + { + return; + } + + if (ul_ctx->ctx_mutex) + { + sys_os_destroy_sig_mutex(ul_ctx->ctx_mutex); + } + + free(ul_ctx); +} + +HT_API BOOL pps_ctx_ul_del(PPSN_CTX * ul_ctx, void * content_ptr) +{ + PPSN * p_node; + + if (pps_used_node(ul_ctx, content_ptr) == FALSE) + { + return FALSE; + } + + p_node = (PPSN *)(((char *)content_ptr) - sizeof(PPSN)); + + pps_wait_mutex(ul_ctx); + + if (p_node->prev_node == 0) + { + ul_ctx->head_node = p_node->next_node; + } + else + { + ((PPSN *)(ul_ctx->fl_base + p_node->prev_node))->next_node = p_node->next_node; + } + + if (p_node->next_node == 0) + { + ul_ctx->tail_node = p_node->prev_node; + } + else + { + ((PPSN *)(ul_ctx->fl_base + p_node->next_node))->prev_node = p_node->prev_node; + } + + (ul_ctx->node_num)--; + + pps_post_mutex(ul_ctx); + + memset(p_node, 0, sizeof(PPSN)); + + return TRUE; +} + +HT_API PPSN * pps_ctx_ul_del_node_unlock(PPSN_CTX * ul_ctx, PPSN * p_node) +{ + if (p_node->node_flag != 2) + { + log_print(HT_LOG_WARN, "%s, unit not in used list!!!\r\n", __FUNCTION__); + return NULL; + } + + if (ul_ctx->head_node == 0) + { + log_print(HT_LOG_WARN, "%s, used list is empty!!!\r\n", __FUNCTION__); + return NULL; + } + + if (p_node->prev_node == 0) + { + ul_ctx->head_node = p_node->next_node; + } + else + { + ((PPSN *)(ul_ctx->fl_base + p_node->prev_node))->next_node = p_node->next_node; + } + + if (p_node->next_node == 0) + { + ul_ctx->tail_node = p_node->prev_node; + } + else + { + ((PPSN *)(ul_ctx->fl_base + p_node->next_node))->prev_node = p_node->prev_node; + } + + (ul_ctx->node_num)--; + + if (p_node->next_node == 0) + { + return NULL; + } + else + { + return (PPSN *)(ul_ctx->fl_base + p_node->next_node); + } +} + +HT_API void * pps_ctx_ul_del_unlock(PPSN_CTX * ul_ctx, void * content_ptr) +{ + PPSN * p_node; + PPSN * p_ret; + + if (pps_used_node(ul_ctx, content_ptr) == FALSE) + { + return FALSE; + } + + p_node = (PPSN *)(((char *)content_ptr) - sizeof(PPSN)); + + p_ret = pps_ctx_ul_del_node_unlock(ul_ctx, p_node); + if (p_ret == NULL) + { + return NULL; + } + else + { + void * ret_ptr = (void *)(((char *)p_ret) + sizeof(PPSN)); + return ret_ptr; + } +} + +HT_API BOOL pps_ctx_ul_add(PPSN_CTX * ul_ctx, void * content_ptr) +{ + PPSN * p_node; + uint32 offset; + + if (pps_safe_node(ul_ctx, content_ptr) == FALSE) + { + return FALSE; + } + + p_node = (PPSN *)(((char *)content_ptr) - sizeof(PPSN)); + if (p_node->node_flag != 0) + { + return FALSE; + } + + pps_wait_mutex(ul_ctx); + + p_node->next_node = 0; + p_node->node_flag = 2; + + offset = (unsigned long)((char *)p_node - ul_ctx->fl_base); + + if (ul_ctx->tail_node == 0) + { + ul_ctx->tail_node = offset; + ul_ctx->head_node = offset; + p_node->prev_node = 0; + } + else + { + PPSN * p_tail = (PPSN *)(ul_ctx->fl_base + ul_ctx->tail_node); + p_tail->next_node = offset; + p_node->prev_node = ul_ctx->tail_node; + ul_ctx->tail_node = offset; + } + + (ul_ctx->node_num)++; + + pps_post_mutex(ul_ctx); + + return TRUE; +} + +HT_API BOOL pps_ctx_ul_add_head(PPSN_CTX * ul_ctx, void * content_ptr) +{ + PPSN * p_node; + uint32 offset; + + if (pps_safe_node(ul_ctx, content_ptr) == FALSE) + { + return FALSE; + } + + p_node = (PPSN *)(((char *)content_ptr) - sizeof(PPSN)); + if(p_node->node_flag != 0) + { + return FALSE; + } + + pps_wait_mutex(ul_ctx); + + offset = (unsigned long)((char *)p_node - ul_ctx->fl_base); + p_node->node_flag = 2; + p_node->prev_node = 0; + + if (ul_ctx->head_node == 0) + { + ul_ctx->tail_node = offset; + ul_ctx->head_node = offset; + p_node->next_node = 0; + } + else + { + PPSN * p_head = (PPSN *)(ul_ctx->fl_base + ul_ctx->head_node); + p_head->prev_node = offset; + p_node->next_node = ul_ctx->head_node; + ul_ctx->head_node = offset; + } + + (ul_ctx->node_num)++; + + pps_post_mutex(ul_ctx); + + return TRUE; +} + + +PPSN * _pps_node_head_start(PPSN_CTX * pps_ctx) +{ + if (pps_ctx == NULL) + { + return NULL; + } + + pps_wait_mutex(pps_ctx); + + if (pps_ctx->head_node == 0) + { + return NULL; + } + else + { + return (PPSN *)(pps_ctx->fl_base + pps_ctx->head_node); + } +} + +PPSN * _pps_node_tail_start(PPSN_CTX * pps_ctx) +{ + if (pps_ctx == NULL) + { + return NULL; + } + + pps_wait_mutex(pps_ctx); + + if (pps_ctx->tail_node == 0) + { + return NULL; + } + else + { + return (PPSN *)(pps_ctx->fl_base + pps_ctx->tail_node); + } +} + +PPSN * _pps_node_next(PPSN_CTX * pps_ctx, PPSN * p_node) +{ + char * ctx_ptr; + + if (pps_ctx == NULL || p_node == NULL) + { + return NULL; + } + + ctx_ptr = ((char *)p_node) + sizeof(PPSN); + + if (ctx_ptr < (pps_ctx->fl_base + pps_ctx->low_offset) || + ctx_ptr > (pps_ctx->fl_base + pps_ctx->high_offset)) + { + log_print(HT_LOG_WARN, "%s, unit ptr error!!!!!!\r\n", __FUNCTION__); + return NULL; + } + + if (p_node->next_node == 0) + { + return NULL; + } + else + { + return (PPSN *)(p_node->next_node + pps_ctx->fl_base); + } +} + +PPSN * _pps_node_prev(PPSN_CTX * pps_ctx, PPSN * p_node) +{ + char * ctx_ptr; + + if (pps_ctx == NULL || p_node == NULL) + { + return NULL; + } + + ctx_ptr = ((char *)p_node) + sizeof(PPSN); + + if (ctx_ptr < (pps_ctx->low_offset+pps_ctx->fl_base) || + ctx_ptr > (pps_ctx->high_offset+pps_ctx->fl_base)) + { + log_print(HT_LOG_WARN, "%s, unit ptr error!!!!!!\r\n", __FUNCTION__); + return NULL; + } + + if (p_node->prev_node == 0) + { + return NULL; + } + else + { + return (PPSN *)(pps_ctx->fl_base + p_node->prev_node); + } +} + +void _pps_node_end(PPSN_CTX * pps_ctx) +{ + pps_post_mutex(pps_ctx); +} + +HT_API void * pps_lookup_start(PPSN_CTX * pps_ctx) +{ + if (pps_ctx == NULL) + { + return NULL; + } + + pps_wait_mutex(pps_ctx); + + if (pps_ctx->head_node) + { + void * ret_ptr = (void *)(pps_ctx->fl_base + pps_ctx->head_node + sizeof(PPSN)); + return ret_ptr; + } + + return NULL; +} + +HT_API void * pps_lookup_next(PPSN_CTX * pps_ctx, void * ctx_ptr) +{ + PPSN * p_node; + + if (pps_ctx == NULL || ctx_ptr == NULL) + { + return NULL; + } + + if ((char *)ctx_ptr < (pps_ctx->fl_base + pps_ctx->low_offset) || + (char *)ctx_ptr > (pps_ctx->fl_base + pps_ctx->high_offset)) + { + log_print(HT_LOG_WARN, "%s, unit ptr error!!!\r\n", __FUNCTION__); + return NULL; + } + + p_node = (PPSN *)(((char *)ctx_ptr) - sizeof(PPSN)); + + if (p_node->next_node == 0) + { + return NULL; + } + else + { + void * ret_ptr = (void *)(pps_ctx->fl_base + p_node->next_node + sizeof(PPSN)); + return ret_ptr; + } +} + +HT_API void pps_lookup_end(PPSN_CTX * pps_ctx) +{ + pps_post_mutex(pps_ctx); +} + +HT_API void * pps_lookback_start(PPSN_CTX * pps_ctx) +{ + if (pps_ctx == NULL) + { + return NULL; + } + + pps_wait_mutex(pps_ctx); + + if (pps_ctx->tail_node) + { + void * ret_ptr = (void *)(pps_ctx->tail_node + sizeof(PPSN)+pps_ctx->fl_base); + return ret_ptr; + } + + return NULL; +} + +HT_API void * pps_lookback_next(PPSN_CTX * pps_ctx, void * ctx_ptr) +{ + PPSN * p_node; + + if (pps_ctx == NULL || ctx_ptr == NULL) + { + return NULL; + } + + if ((char *)ctx_ptr < (pps_ctx->low_offset+pps_ctx->fl_base) || + (char *)ctx_ptr > (pps_ctx->high_offset+pps_ctx->fl_base)) + { + log_print(HT_LOG_WARN, "%s, unit ptr error!!!\r\n", __FUNCTION__); + return NULL; + } + + p_node = (PPSN *)(((char *)ctx_ptr) - sizeof(PPSN)); + + if (p_node->prev_node == 0) + { + return NULL; + } + else + { + void * ret_ptr = (void *)(p_node->prev_node + sizeof(PPSN)+pps_ctx->fl_base); + return ret_ptr; + } +} + +HT_API void pps_lookback_end(PPSN_CTX * pps_ctx) +{ + pps_post_mutex(pps_ctx); +} + +HT_API uint32 pps_get_index(PPSN_CTX * pps_ctx, void * content_ptr) +{ + uint32 index; + uint32 offset; + + if (pps_ctx == NULL || content_ptr == NULL) + { + return 0xFFFFFFFF; + } + + if ((char *)content_ptr < (pps_ctx->low_offset+pps_ctx->fl_base) || + (char *)content_ptr > (pps_ctx->high_offset+pps_ctx->fl_base)) + { + log_print(HT_LOG_WARN, "%s, unit ptr error!!!\r\n", __FUNCTION__); + return 0xFFFFFFFF; + } + + index = (uint32)((char *)content_ptr - pps_ctx->low_offset - pps_ctx->fl_base); + offset = index % pps_ctx->unit_size; + if (offset != 0) + { + index = index /pps_ctx->unit_size; + + log_print(HT_LOG_WARN, "%s, unit ptr error,pps_ctx[0x%08x],ptr[0x%08x],low_offset[0x%08x],offset[0x%08x],like entry[%u]\r\n", + __FUNCTION__, pps_ctx, content_ptr, pps_ctx->low_offset, offset,index); + return 0xFFFFFFFF; + } + + index = index / pps_ctx->unit_size; + + return index; +} + +HT_API void * pps_get_node_by_index(PPSN_CTX * pps_ctx, unsigned long index) +{ + unsigned long content_offset; + + if (pps_ctx == NULL) + { + return NULL; + } + + content_offset = pps_ctx->low_offset + index * pps_ctx->unit_size; + + if (content_offset > pps_ctx->high_offset) + { + if (index != 0xFFFFFFFF) + { + log_print(HT_LOG_WARN, "%s, index [%u]error!!!\r\n", __FUNCTION__, index); + } + return NULL; + } + + return (void *)(content_offset + pps_ctx->fl_base); +} + +HT_API void pps_wait_mutex(PPSN_CTX * pps_ctx) +{ + if (pps_ctx == NULL) + { + log_print(HT_LOG_WARN, "%s, pps_ctx == NULL!!!\r\n", __FUNCTION__); + return; + } + + if (pps_ctx->ctx_mutex) + { + sys_os_mutex_enter (pps_ctx->ctx_mutex); + } +} + +HT_API void pps_post_mutex(PPSN_CTX * pps_ctx) +{ + if (pps_ctx == NULL) + { + log_print(HT_LOG_WARN, "%s, pps_ctx == NULL!!!\r\n", __FUNCTION__); + return; + } + + if (pps_ctx->ctx_mutex) + { + sys_os_mutex_leave (pps_ctx->ctx_mutex); + } +} + +HT_API BOOL pps_safe_node(PPSN_CTX * pps_ctx, void * content_ptr) +{ + uint32 index; + uint32 offset; + + if (pps_ctx == NULL || content_ptr == NULL) + { + return FALSE; + } + + if ((char *)content_ptr < (pps_ctx->low_offset + pps_ctx->fl_base) || + (char *)content_ptr > (pps_ctx->high_offset + pps_ctx->fl_base)) + { + // log_print(HT_LOG_WARN, "%s, unit ptr error!!!\r\n", __FUNCTION__); + return FALSE; + } + + index = (unsigned long)((char *)content_ptr - pps_ctx->low_offset - pps_ctx->fl_base); + offset = index % pps_ctx->unit_size; + + if (offset != 0) + { + index = index / pps_ctx->unit_size; + + log_print(HT_LOG_WARN, "%s, unit ptr error,pps_ctx[0x%08x],ptr[0x%08x],low_offset[0x%08x],offset[0x%08x],like entry[%u]\r\n", + __FUNCTION__, pps_ctx, content_ptr, pps_ctx->low_offset, offset, index); + return FALSE; + } + + return TRUE; +} + +HT_API BOOL pps_idle_node(PPSN_CTX * pps_ctx, void * content_ptr) +{ + PPSN * p_node; + + if (pps_safe_node(pps_ctx, content_ptr) == FALSE) + { + return FALSE; + } + + p_node = (PPSN *)(((char *)content_ptr) - sizeof(PPSN)); + + return (p_node->node_flag == 1); +} + +HT_API BOOL pps_exist_node(PPSN_CTX * pps_ctx, void * content_ptr) +{ + PPSN * p_node; + + if (pps_safe_node(pps_ctx, content_ptr) == FALSE) + { + return FALSE; + } + + p_node = (PPSN *)(((char *)content_ptr) - sizeof(PPSN)); + + return (p_node->node_flag != 1); +} + +HT_API BOOL pps_used_node(PPSN_CTX * pps_ctx, void * content_ptr) +{ + PPSN * p_node; + + if (pps_safe_node(pps_ctx, content_ptr) == FALSE) + { + return FALSE; + } + + if (pps_ctx->head_node == 0) + { + log_print(HT_LOG_WARN, "%s, used list is empty!!!\r\n", __FUNCTION__); + return FALSE; + } + + p_node = (PPSN *)(((char *)content_ptr) - sizeof(PPSN)); + + return (p_node->node_flag == 2); +} + +void * _pps_node_get_data(PPSN * p_node) +{ + if (p_node == NULL) + { + return NULL; + } + + return (void *)(((char *)p_node) + sizeof(PPSN)); +} + +PPSN * _pps_data_get_node(void * p_data) +{ + PPSN * p_node; + + if (p_data == NULL) + { + return NULL; + } + + p_node = (PPSN *)(((char *)p_data) - sizeof(PPSN)); + + return p_node; +} + +HT_API int pps_node_count(PPSN_CTX * pps_ctx) +{ + if (pps_ctx == NULL) + { + return 0; + } + + return pps_ctx->node_num; +} + +HT_API void * pps_get_head_node(PPSN_CTX * pps_ctx) +{ + if (pps_ctx == NULL) + { + return NULL; + } + + //pps_wait_mutex(pps_ctx); + + if (pps_ctx->head_node) + { + void * ret_ptr = (void *)(pps_ctx->head_node + sizeof(PPSN)); + return ret_ptr; + } + + return NULL; +} + +HT_API void * pps_get_tail_node(PPSN_CTX * pps_ctx) +{ + if (pps_ctx == NULL) + { + return NULL; + } + + //pps_wait_mutex(pps_ctx); + + if (pps_ctx->tail_node) + { + void * ret_ptr = (void *)(pps_ctx->tail_node + sizeof(PPSN)); + return ret_ptr; + } + + return NULL; +} + +HT_API void * pps_get_next_node(PPSN_CTX * pps_ctx, void * content_ptr) +{ + PPSN * p_node = _pps_data_get_node(content_ptr); + p_node = _pps_node_next(pps_ctx, p_node); + return _pps_node_get_data(p_node); +} + +HT_API void * pps_get_prev_node(PPSN_CTX * pps_ctx, void * content_ptr) +{ + PPSN * p_node = _pps_data_get_node(content_ptr); + p_node = _pps_node_prev(pps_ctx, p_node); + return _pps_node_get_data(p_node); +} + + diff --git a/MediaClient/MediaClient/bm/ppstack.h b/MediaClient/MediaClient/bm/ppstack.h new file mode 100644 index 0000000..3a4ed0b --- /dev/null +++ b/MediaClient/MediaClient/bm/ppstack.h @@ -0,0 +1,110 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef PPSTACK_H +#define PPSTACK_H + + +/***************************************************************************************/ + +typedef struct PPSN // ppstack_node +{ + unsigned long prev_node; + unsigned long next_node; + unsigned long node_flag; // 0:idle 1:in FreeList 2:in UsedList +} PPSN; + +typedef struct PPSN_CTX +{ + char * fl_base; + uint32 head_node; + uint32 tail_node; + uint32 node_num; + uint32 low_offset; + uint32 high_offset; + uint32 unit_size; + void * ctx_mutex; + uint32 pop_cnt; + uint32 push_cnt; +} PPSN_CTX; + +#ifdef __cplusplus +extern "C" { +#endif + +/***************************************************************************************/ + +HT_API PPSN_CTX * pps_ctx_fl_init(unsigned long node_num, unsigned long content_size, BOOL bNeedMutex); +HT_API PPSN_CTX * pps_ctx_fl_init_assign(char * mem_addr, unsigned long mem_len, unsigned long node_num, unsigned long content_size, BOOL bNeedMutex); + +HT_API void pps_fl_free(PPSN_CTX * fl_ctx); +HT_API void pps_fl_reinit(PPSN_CTX * fl_ctx); + +HT_API BOOL pps_fl_push(PPSN_CTX * pps_ctx, void * content_ptr); +HT_API BOOL pps_fl_push_tail(PPSN_CTX * pps_ctx, void * content_ptr); +HT_API void * pps_fl_pop(PPSN_CTX * pps_ctx); + +HT_API PPSN_CTX * pps_ctx_ul_init(PPSN_CTX * fl_ctx, BOOL bNeedMutex); +HT_API BOOL pps_ctx_ul_init_assign(PPSN_CTX * ul_ctx, PPSN_CTX * fl_ctx, BOOL bNeedMutex); +HT_API BOOL pps_ctx_ul_init_nm(PPSN_CTX * fl_ctx, PPSN_CTX * ul_ctx); + +HT_API void pps_ul_reinit(PPSN_CTX * ul_ctx); +HT_API void pps_ul_free(PPSN_CTX * ul_ctx); + +HT_API BOOL pps_ctx_ul_del(PPSN_CTX * ul_ctx, void * content_ptr); +HT_API PPSN * pps_ctx_ul_del_node_unlock(PPSN_CTX * ul_ctx, PPSN * p_node); +HT_API void * pps_ctx_ul_del_unlock(PPSN_CTX * ul_ctx, void * content_ptr); + +HT_API BOOL pps_ctx_ul_add(PPSN_CTX * ul_ctx, void * content_ptr); +HT_API BOOL pps_ctx_ul_add_head(PPSN_CTX * ul_ctx, void * content_ptr); + +HT_API uint32 pps_get_index(PPSN_CTX * pps_ctx, void * content_ptr); +HT_API void * pps_get_node_by_index(PPSN_CTX * pps_ctx, unsigned long index); + +/***************************************************************************************/ +HT_API void * pps_lookup_start(PPSN_CTX * pps_ctx); +HT_API void * pps_lookup_next(PPSN_CTX * pps_ctx, void * ct_ptr); +HT_API void pps_lookup_end(PPSN_CTX * pps_ctx); + +HT_API void * pps_lookback_start(PPSN_CTX * pps_ctx); +HT_API void * pps_lookback_next(PPSN_CTX * pps_ctx, void * ct_ptr); +HT_API void pps_lookback_end(PPSN_CTX * pps_ctx); + +HT_API void pps_wait_mutex(PPSN_CTX * pps_ctx); +HT_API void pps_post_mutex(PPSN_CTX * pps_ctx); + +HT_API BOOL pps_safe_node(PPSN_CTX * pps_ctx, void * content_ptr); +HT_API BOOL pps_idle_node(PPSN_CTX * pps_ctx, void * content_ptr); +HT_API BOOL pps_exist_node(PPSN_CTX * pps_ctx, void * content_ptr); +HT_API BOOL pps_used_node(PPSN_CTX * pps_ctx, void * content_ptr); + +/***************************************************************************************/ +HT_API int pps_node_count(PPSN_CTX * pps_ctx); +HT_API void * pps_get_head_node(PPSN_CTX * pps_ctx); +HT_API void * pps_get_tail_node(PPSN_CTX * pps_ctx); +HT_API void * pps_get_next_node(PPSN_CTX * pps_ctx, void * content_ptr); +HT_API void * pps_get_prev_node(PPSN_CTX * pps_ctx, void * content_ptr); + +#ifdef __cplusplus +} +#endif + +#endif // PPSTACK_H + + diff --git a/MediaClient/MediaClient/bm/rfc_md5.cpp b/MediaClient/MediaClient/bm/rfc_md5.cpp new file mode 100644 index 0000000..2d82c07 --- /dev/null +++ b/MediaClient/MediaClient/bm/rfc_md5.cpp @@ -0,0 +1,245 @@ +/*************************************************************************************** + * + * 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 "rfc_md5.h" + + +#define GET_UINT32(n,b,i) \ +{ \ + (n) = ( (uint32) (b)[(i) ] ) \ + | ( (uint32) (b)[(i) + 1] << 8 ) \ + | ( (uint32) (b)[(i) + 2] << 16 ) \ + | ( (uint32) (b)[(i) + 3] << 24 ); \ +} + +#define PUT_UINT32(n,b,i) \ +{ \ + (b)[(i) ] = (uint8) ( (n) ); \ + (b)[(i) + 1] = (uint8) ( (n) >> 8 ); \ + (b)[(i) + 2] = (uint8) ( (n) >> 16 ); \ + (b)[(i) + 3] = (uint8) ( (n) >> 24 ); \ +} + +HT_API void md5_starts(md5_context *ctx) +{ + ctx->total[0] = 0; + ctx->total[1] = 0; + + ctx->state[0] = 0x67452301; + ctx->state[1] = 0xEFCDAB89; + ctx->state[2] = 0x98BADCFE; + ctx->state[3] = 0x10325476; +} + +void md5_process(md5_context *ctx, uint8 data[64]) +{ + uint32 X[16], A, B, C, D; + + GET_UINT32( X[0], data, 0 ); + GET_UINT32( X[1], data, 4 ); + GET_UINT32( X[2], data, 8 ); + GET_UINT32( X[3], data, 12 ); + GET_UINT32( X[4], data, 16 ); + GET_UINT32( X[5], data, 20 ); + GET_UINT32( X[6], data, 24 ); + GET_UINT32( X[7], data, 28 ); + GET_UINT32( X[8], data, 32 ); + GET_UINT32( X[9], data, 36 ); + GET_UINT32( X[10], data, 40 ); + GET_UINT32( X[11], data, 44 ); + GET_UINT32( X[12], data, 48 ); + GET_UINT32( X[13], data, 52 ); + GET_UINT32( X[14], data, 56 ); + GET_UINT32( X[15], data, 60 ); + +#define S(x,n) ((x << n) | ((x & 0xFFFFFFFF) >> (32 - n))) + +#define P(a,b,c,d,k,s,t) \ +{ \ + a += F(b,c,d) + X[k] + t; a = S(a,s) + b; \ +} + + A = ctx->state[0]; + B = ctx->state[1]; + C = ctx->state[2]; + D = ctx->state[3]; + +#define F(x,y,z) (z ^ (x & (y ^ z))) + + P( A, B, C, D, 0, 7, 0xD76AA478 ); + P( D, A, B, C, 1, 12, 0xE8C7B756 ); + P( C, D, A, B, 2, 17, 0x242070DB ); + P( B, C, D, A, 3, 22, 0xC1BDCEEE ); + P( A, B, C, D, 4, 7, 0xF57C0FAF ); + P( D, A, B, C, 5, 12, 0x4787C62A ); + P( C, D, A, B, 6, 17, 0xA8304613 ); + P( B, C, D, A, 7, 22, 0xFD469501 ); + P( A, B, C, D, 8, 7, 0x698098D8 ); + P( D, A, B, C, 9, 12, 0x8B44F7AF ); + P( C, D, A, B, 10, 17, 0xFFFF5BB1 ); + P( B, C, D, A, 11, 22, 0x895CD7BE ); + P( A, B, C, D, 12, 7, 0x6B901122 ); + P( D, A, B, C, 13, 12, 0xFD987193 ); + P( C, D, A, B, 14, 17, 0xA679438E ); + P( B, C, D, A, 15, 22, 0x49B40821 ); + +#undef F + +#define F(x,y,z) (y ^ (z & (x ^ y))) + + P( A, B, C, D, 1, 5, 0xF61E2562 ); + P( D, A, B, C, 6, 9, 0xC040B340 ); + P( C, D, A, B, 11, 14, 0x265E5A51 ); + P( B, C, D, A, 0, 20, 0xE9B6C7AA ); + P( A, B, C, D, 5, 5, 0xD62F105D ); + P( D, A, B, C, 10, 9, 0x02441453 ); + P( C, D, A, B, 15, 14, 0xD8A1E681 ); + P( B, C, D, A, 4, 20, 0xE7D3FBC8 ); + P( A, B, C, D, 9, 5, 0x21E1CDE6 ); + P( D, A, B, C, 14, 9, 0xC33707D6 ); + P( C, D, A, B, 3, 14, 0xF4D50D87 ); + P( B, C, D, A, 8, 20, 0x455A14ED ); + P( A, B, C, D, 13, 5, 0xA9E3E905 ); + P( D, A, B, C, 2, 9, 0xFCEFA3F8 ); + P( C, D, A, B, 7, 14, 0x676F02D9 ); + P( B, C, D, A, 12, 20, 0x8D2A4C8A ); + +#undef F + +#define F(x,y,z) (x ^ y ^ z) + + P( A, B, C, D, 5, 4, 0xFFFA3942 ); + P( D, A, B, C, 8, 11, 0x8771F681 ); + P( C, D, A, B, 11, 16, 0x6D9D6122 ); + P( B, C, D, A, 14, 23, 0xFDE5380C ); + P( A, B, C, D, 1, 4, 0xA4BEEA44 ); + P( D, A, B, C, 4, 11, 0x4BDECFA9 ); + P( C, D, A, B, 7, 16, 0xF6BB4B60 ); + P( B, C, D, A, 10, 23, 0xBEBFBC70 ); + P( A, B, C, D, 13, 4, 0x289B7EC6 ); + P( D, A, B, C, 0, 11, 0xEAA127FA ); + P( C, D, A, B, 3, 16, 0xD4EF3085 ); + P( B, C, D, A, 6, 23, 0x04881D05 ); + P( A, B, C, D, 9, 4, 0xD9D4D039 ); + P( D, A, B, C, 12, 11, 0xE6DB99E5 ); + P( C, D, A, B, 15, 16, 0x1FA27CF8 ); + P( B, C, D, A, 2, 23, 0xC4AC5665 ); + +#undef F + +#define F(x,y,z) (y ^ (x | ~z)) + + P( A, B, C, D, 0, 6, 0xF4292244 ); + P( D, A, B, C, 7, 10, 0x432AFF97 ); + P( C, D, A, B, 14, 15, 0xAB9423A7 ); + P( B, C, D, A, 5, 21, 0xFC93A039 ); + P( A, B, C, D, 12, 6, 0x655B59C3 ); + P( D, A, B, C, 3, 10, 0x8F0CCC92 ); + P( C, D, A, B, 10, 15, 0xFFEFF47D ); + P( B, C, D, A, 1, 21, 0x85845DD1 ); + P( A, B, C, D, 8, 6, 0x6FA87E4F ); + P( D, A, B, C, 15, 10, 0xFE2CE6E0 ); + P( C, D, A, B, 6, 15, 0xA3014314 ); + P( B, C, D, A, 13, 21, 0x4E0811A1 ); + P( A, B, C, D, 4, 6, 0xF7537E82 ); + P( D, A, B, C, 11, 10, 0xBD3AF235 ); + P( C, D, A, B, 2, 15, 0x2AD7D2BB ); + P( B, C, D, A, 9, 21, 0xEB86D391 ); + +#undef F + + ctx->state[0] += A; + ctx->state[1] += B; + ctx->state[2] += C; + ctx->state[3] += D; +} + +HT_API void md5_update(md5_context *ctx, uint8 *input, uint32 length) +{ + uint32 left, fill; + + if (!length) + { + return; + } + + left = ctx->total[0] & 0x3F; + fill = 64 - left; + + ctx->total[0] += length; + ctx->total[0] &= 0xFFFFFFFF; + + if (ctx->total[0] < length) + { + ctx->total[1]++; + } + + if (left && length >= fill) + { + memcpy((void *) (ctx->buffer + left), (void *) input, fill); + md5_process(ctx, ctx->buffer); + length -= fill; + input += fill; + left = 0; + } + + while (length >= 64) + { + md5_process(ctx, input); + length -= 64; + input += 64; + } + + if (length) + { + memcpy((void *) (ctx->buffer + left), (void *) input, length); + } +} + +HT_API void md5_finish(md5_context *ctx, uint8 digest[16]) +{ + uint32 last, padn; + uint32 high, low; + uint8 msglen[8]; + uint8 padding[64]; + + high = (ctx->total[0] >> 29) | (ctx->total[1] << 3); + low = (ctx->total[0] << 3); + + PUT_UINT32(low, msglen, 0); + PUT_UINT32(high, msglen, 4); + + last = ctx->total[0] & 0x3F; + padn = (last < 56) ? (56 - last) : (120 - last); + + memset(padding, 0, sizeof(padding)); + padding[0] = 0x80; + + md5_update(ctx, padding, padn); + md5_update(ctx, msglen, 8); + + PUT_UINT32(ctx->state[0], digest, 0); + PUT_UINT32(ctx->state[1], digest, 4); + PUT_UINT32(ctx->state[2], digest, 8); + PUT_UINT32(ctx->state[3], digest, 12); +} + + + diff --git a/MediaClient/MediaClient/bm/rfc_md5.h b/MediaClient/MediaClient/bm/rfc_md5.h new file mode 100644 index 0000000..2cf5103 --- /dev/null +++ b/MediaClient/MediaClient/bm/rfc_md5.h @@ -0,0 +1,46 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef RFC_MD5_H +#define RFC_MD5_H + +typedef struct +{ + uint32 total[2]; + uint32 state[4]; + uint8 buffer[64]; +} md5_context; + + +#ifdef __cplusplus +extern "C"{ +#endif + +HT_API void md5_starts(md5_context *ctx); +HT_API void md5_update(md5_context *ctx, uint8 *input, uint32 length); +HT_API void md5_finish(md5_context *ctx, uint8 digest[16]); + +#ifdef __cplusplus +} +#endif + +#endif + + + diff --git a/MediaClient/MediaClient/bm/sha1.cpp b/MediaClient/MediaClient/bm/sha1.cpp new file mode 100644 index 0000000..dfb4606 --- /dev/null +++ b/MediaClient/MediaClient/bm/sha1.cpp @@ -0,0 +1,280 @@ +/*************************************************************************************** + * + * 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 "sha1.h" + + +#define GET_UINT32(n,b,i) \ +{ \ + (n) = ( (uint32) (b)[(i) ] << 24 ) \ + | ( (uint32) (b)[(i) + 1] << 16 ) \ + | ( (uint32) (b)[(i) + 2] << 8 ) \ + | ( (uint32) (b)[(i) + 3] ); \ +} + +#define PUT_UINT32(n,b,i) \ +{ \ + (b)[(i) ] = (uint8) ( (n) >> 24 ); \ + (b)[(i) + 1] = (uint8) ( (n) >> 16 ); \ + (b)[(i) + 2] = (uint8) ( (n) >> 8 ); \ + (b)[(i) + 3] = (uint8) ( (n) ); \ +} + +HT_API void sha1_starts(sha1_context * ctx) +{ + ctx->total[0] = 0; + ctx->total[1] = 0; + + ctx->state[0] = 0x67452301; + ctx->state[1] = 0xEFCDAB89; + ctx->state[2] = 0x98BADCFE; + ctx->state[3] = 0x10325476; + ctx->state[4] = 0xC3D2E1F0; +} + +void sha1_process(sha1_context * ctx, uint8 data[64]) +{ + uint32 temp, W[16], A, B, C, D, E; + + GET_UINT32( W[0], data, 0 ); + GET_UINT32( W[1], data, 4 ); + GET_UINT32( W[2], data, 8 ); + GET_UINT32( W[3], data, 12 ); + GET_UINT32( W[4], data, 16 ); + GET_UINT32( W[5], data, 20 ); + GET_UINT32( W[6], data, 24 ); + GET_UINT32( W[7], data, 28 ); + GET_UINT32( W[8], data, 32 ); + GET_UINT32( W[9], data, 36 ); + GET_UINT32( W[10], data, 40 ); + GET_UINT32( W[11], data, 44 ); + GET_UINT32( W[12], data, 48 ); + GET_UINT32( W[13], data, 52 ); + GET_UINT32( W[14], data, 56 ); + GET_UINT32( W[15], data, 60 ); + +#define S(x,n) ((x << n) | ((x & 0xFFFFFFFF) >> (32 - n))) + +#define R(t) \ +( \ + temp = W[(t - 3) & 0x0F] ^ W[(t - 8) & 0x0F] ^ \ + W[(t - 14) & 0x0F] ^ W[ t & 0x0F], \ + ( W[t & 0x0F] = S(temp,1) ) \ +) + +#define P(a,b,c,d,e,x) \ +{ \ + e += S(a,5) + F(b,c,d) + K + x; b = S(b,30); \ +} + + A = ctx->state[0]; + B = ctx->state[1]; + C = ctx->state[2]; + D = ctx->state[3]; + E = ctx->state[4]; + +#define F(x,y,z) (z ^ (x & (y ^ z))) +#define K 0x5A827999 + + P( A, B, C, D, E, W[0] ); + P( E, A, B, C, D, W[1] ); + P( D, E, A, B, C, W[2] ); + P( C, D, E, A, B, W[3] ); + P( B, C, D, E, A, W[4] ); + P( A, B, C, D, E, W[5] ); + P( E, A, B, C, D, W[6] ); + P( D, E, A, B, C, W[7] ); + P( C, D, E, A, B, W[8] ); + P( B, C, D, E, A, W[9] ); + P( A, B, C, D, E, W[10] ); + P( E, A, B, C, D, W[11] ); + P( D, E, A, B, C, W[12] ); + P( C, D, E, A, B, W[13] ); + P( B, C, D, E, A, W[14] ); + P( A, B, C, D, E, W[15] ); + P( E, A, B, C, D, R(16) ); + P( D, E, A, B, C, R(17) ); + P( C, D, E, A, B, R(18) ); + P( B, C, D, E, A, R(19) ); + +#undef K +#undef F + +#define F(x,y,z) (x ^ y ^ z) +#define K 0x6ED9EBA1 + + P( A, B, C, D, E, R(20) ); + P( E, A, B, C, D, R(21) ); + P( D, E, A, B, C, R(22) ); + P( C, D, E, A, B, R(23) ); + P( B, C, D, E, A, R(24) ); + P( A, B, C, D, E, R(25) ); + P( E, A, B, C, D, R(26) ); + P( D, E, A, B, C, R(27) ); + P( C, D, E, A, B, R(28) ); + P( B, C, D, E, A, R(29) ); + P( A, B, C, D, E, R(30) ); + P( E, A, B, C, D, R(31) ); + P( D, E, A, B, C, R(32) ); + P( C, D, E, A, B, R(33) ); + P( B, C, D, E, A, R(34) ); + P( A, B, C, D, E, R(35) ); + P( E, A, B, C, D, R(36) ); + P( D, E, A, B, C, R(37) ); + P( C, D, E, A, B, R(38) ); + P( B, C, D, E, A, R(39) ); + +#undef K +#undef F + +#define F(x,y,z) ((x & y) | (z & (x | y))) +#define K 0x8F1BBCDC + + P( A, B, C, D, E, R(40) ); + P( E, A, B, C, D, R(41) ); + P( D, E, A, B, C, R(42) ); + P( C, D, E, A, B, R(43) ); + P( B, C, D, E, A, R(44) ); + P( A, B, C, D, E, R(45) ); + P( E, A, B, C, D, R(46) ); + P( D, E, A, B, C, R(47) ); + P( C, D, E, A, B, R(48) ); + P( B, C, D, E, A, R(49) ); + P( A, B, C, D, E, R(50) ); + P( E, A, B, C, D, R(51) ); + P( D, E, A, B, C, R(52) ); + P( C, D, E, A, B, R(53) ); + P( B, C, D, E, A, R(54) ); + P( A, B, C, D, E, R(55) ); + P( E, A, B, C, D, R(56) ); + P( D, E, A, B, C, R(57) ); + P( C, D, E, A, B, R(58) ); + P( B, C, D, E, A, R(59) ); + +#undef K +#undef F + +#define F(x,y,z) (x ^ y ^ z) +#define K 0xCA62C1D6 + + P( A, B, C, D, E, R(60) ); + P( E, A, B, C, D, R(61) ); + P( D, E, A, B, C, R(62) ); + P( C, D, E, A, B, R(63) ); + P( B, C, D, E, A, R(64) ); + P( A, B, C, D, E, R(65) ); + P( E, A, B, C, D, R(66) ); + P( D, E, A, B, C, R(67) ); + P( C, D, E, A, B, R(68) ); + P( B, C, D, E, A, R(69) ); + P( A, B, C, D, E, R(70) ); + P( E, A, B, C, D, R(71) ); + P( D, E, A, B, C, R(72) ); + P( C, D, E, A, B, R(73) ); + P( B, C, D, E, A, R(74) ); + P( A, B, C, D, E, R(75) ); + P( E, A, B, C, D, R(76) ); + P( D, E, A, B, C, R(77) ); + P( C, D, E, A, B, R(78) ); + P( B, C, D, E, A, R(79) ); + +#undef K +#undef F + + ctx->state[0] += A; + ctx->state[1] += B; + ctx->state[2] += C; + ctx->state[3] += D; + ctx->state[4] += E; +} + +HT_API void sha1_update(sha1_context * ctx, uint8 * input, uint32 length) +{ + uint32 left, fill; + + if (!length) + { + return; + } + + left = ctx->total[0] & 0x3F; + fill = 64 - left; + + ctx->total[0] += length; + ctx->total[0] &= 0xFFFFFFFF; + + if (ctx->total[0] < length) + { + ctx->total[1]++; + } + + if (left && length >= fill) + { + memcpy((void *) (ctx->buffer + left), (void *) input, fill); + sha1_process(ctx, ctx->buffer); + length -= fill; + input += fill; + left = 0; + } + + while (length >= 64) + { + sha1_process(ctx, input); + length -= 64; + input += 64; + } + + if (length) + { + memcpy((void *) (ctx->buffer + left), (void *) input, length); + } +} + +HT_API void sha1_finish(sha1_context * ctx, uint8 digest[20]) +{ + uint32 last, padn; + uint32 high, low; + uint8 msglen[8]; + uint8 padding[64]; + + high = (ctx->total[0] >> 29) | (ctx->total[1] << 3); + low = (ctx->total[0] << 3); + + PUT_UINT32(high, msglen, 0); + PUT_UINT32(low, msglen, 4); + + last = ctx->total[0] & 0x3F; + padn = (last < 56) ? (56 - last) : (120 - last); + + memset(padding, 0, sizeof(padding)); + padding[0] = 0x80; + + sha1_update(ctx, padding, padn); + sha1_update(ctx, msglen, 8); + + PUT_UINT32(ctx->state[0], digest, 0); + PUT_UINT32(ctx->state[1], digest, 4); + PUT_UINT32(ctx->state[2], digest, 8); + PUT_UINT32(ctx->state[3], digest, 12); + PUT_UINT32(ctx->state[4], digest, 16); +} + + + + diff --git a/MediaClient/MediaClient/bm/sha1.h b/MediaClient/MediaClient/bm/sha1.h new file mode 100644 index 0000000..f2217ca --- /dev/null +++ b/MediaClient/MediaClient/bm/sha1.h @@ -0,0 +1,44 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef _SHA1_H_ +#define _SHA1_H_ + +typedef struct +{ + uint32 total[2]; + uint32 state[5]; + uint8 buffer[64]; +} sha1_context; + +#ifdef __cplusplus +extern "C" { +#endif + +HT_API void sha1_starts(sha1_context * ctx); +HT_API void sha1_update(sha1_context * ctx, uint8 * input, uint32 length); +HT_API void sha1_finish(sha1_context * ctx, uint8 digest[20]); + +#ifdef __cplusplus +} +#endif + +#endif // _SHA1_H_ + + diff --git a/MediaClient/MediaClient/bm/sha256.cpp b/MediaClient/MediaClient/bm/sha256.cpp new file mode 100644 index 0000000..f788c73 --- /dev/null +++ b/MediaClient/MediaClient/bm/sha256.cpp @@ -0,0 +1,262 @@ +/*************************************************************************************** + * + * 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 "sha256.h" + + +#define GET_UINT32(n,b,i) \ +{ \ + (n) = ( (uint32) (b)[(i) ] << 24 ) \ + | ( (uint32) (b)[(i) + 1] << 16 ) \ + | ( (uint32) (b)[(i) + 2] << 8 ) \ + | ( (uint32) (b)[(i) + 3] ); \ +} + +#define PUT_UINT32(n,b,i) \ +{ \ + (b)[(i) ] = (uint8) ( (n) >> 24 ); \ + (b)[(i) + 1] = (uint8) ( (n) >> 16 ); \ + (b)[(i) + 2] = (uint8) ( (n) >> 8 ); \ + (b)[(i) + 3] = (uint8) ( (n) ); \ +} + +HT_API void sha256_starts(sha256_context *ctx) +{ + ctx->total[0] = 0; + ctx->total[1] = 0; + + 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; +} + +void sha256_process(sha256_context *ctx, uint8 data[64]) +{ + uint32 temp1, temp2, W[64]; + uint32 A, B, C, D, E, F, G, H; + + GET_UINT32( W[0], data, 0 ); + GET_UINT32( W[1], data, 4 ); + GET_UINT32( W[2], data, 8 ); + GET_UINT32( W[3], data, 12 ); + GET_UINT32( W[4], data, 16 ); + GET_UINT32( W[5], data, 20 ); + GET_UINT32( W[6], data, 24 ); + GET_UINT32( W[7], data, 28 ); + GET_UINT32( W[8], data, 32 ); + GET_UINT32( W[9], data, 36 ); + GET_UINT32( W[10], data, 40 ); + GET_UINT32( W[11], data, 44 ); + GET_UINT32( W[12], data, 48 ); + GET_UINT32( W[13], data, 52 ); + GET_UINT32( W[14], data, 56 ); + GET_UINT32( W[15], data, 60 ); + +#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; \ +} + + A = ctx->state[0]; + B = ctx->state[1]; + C = ctx->state[2]; + D = ctx->state[3]; + E = ctx->state[4]; + F = ctx->state[5]; + G = ctx->state[6]; + H = ctx->state[7]; + + P( A, B, C, D, E, F, G, H, W[ 0], 0x428A2F98 ); + P( H, A, B, C, D, E, F, G, W[ 1], 0x71374491 ); + P( G, H, A, B, C, D, E, F, W[ 2], 0xB5C0FBCF ); + P( F, G, H, A, B, C, D, E, W[ 3], 0xE9B5DBA5 ); + P( E, F, G, H, A, B, C, D, W[ 4], 0x3956C25B ); + P( D, E, F, G, H, A, B, C, W[ 5], 0x59F111F1 ); + P( C, D, E, F, G, H, A, B, W[ 6], 0x923F82A4 ); + P( B, C, D, E, F, G, H, A, W[ 7], 0xAB1C5ED5 ); + P( A, B, C, D, E, F, G, H, W[ 8], 0xD807AA98 ); + P( H, A, B, C, D, E, F, G, W[ 9], 0x12835B01 ); + P( G, H, A, B, C, D, E, F, W[10], 0x243185BE ); + P( F, G, H, A, B, C, D, E, W[11], 0x550C7DC3 ); + P( E, F, G, H, A, B, C, D, W[12], 0x72BE5D74 ); + P( D, E, F, G, H, A, B, C, W[13], 0x80DEB1FE ); + P( C, D, E, F, G, H, A, B, W[14], 0x9BDC06A7 ); + P( B, C, D, E, F, G, H, A, W[15], 0xC19BF174 ); + P( A, B, C, D, E, F, G, H, R(16), 0xE49B69C1 ); + P( H, A, B, C, D, E, F, G, R(17), 0xEFBE4786 ); + P( G, H, A, B, C, D, E, F, R(18), 0x0FC19DC6 ); + P( F, G, H, A, B, C, D, E, R(19), 0x240CA1CC ); + P( E, F, G, H, A, B, C, D, R(20), 0x2DE92C6F ); + P( D, E, F, G, H, A, B, C, R(21), 0x4A7484AA ); + P( C, D, E, F, G, H, A, B, R(22), 0x5CB0A9DC ); + P( B, C, D, E, F, G, H, A, R(23), 0x76F988DA ); + P( A, B, C, D, E, F, G, H, R(24), 0x983E5152 ); + P( H, A, B, C, D, E, F, G, R(25), 0xA831C66D ); + P( G, H, A, B, C, D, E, F, R(26), 0xB00327C8 ); + P( F, G, H, A, B, C, D, E, R(27), 0xBF597FC7 ); + P( E, F, G, H, A, B, C, D, R(28), 0xC6E00BF3 ); + P( D, E, F, G, H, A, B, C, R(29), 0xD5A79147 ); + P( C, D, E, F, G, H, A, B, R(30), 0x06CA6351 ); + P( B, C, D, E, F, G, H, A, R(31), 0x14292967 ); + P( A, B, C, D, E, F, G, H, R(32), 0x27B70A85 ); + P( H, A, B, C, D, E, F, G, R(33), 0x2E1B2138 ); + P( G, H, A, B, C, D, E, F, R(34), 0x4D2C6DFC ); + P( F, G, H, A, B, C, D, E, R(35), 0x53380D13 ); + P( E, F, G, H, A, B, C, D, R(36), 0x650A7354 ); + P( D, E, F, G, H, A, B, C, R(37), 0x766A0ABB ); + P( C, D, E, F, G, H, A, B, R(38), 0x81C2C92E ); + P( B, C, D, E, F, G, H, A, R(39), 0x92722C85 ); + P( A, B, C, D, E, F, G, H, R(40), 0xA2BFE8A1 ); + P( H, A, B, C, D, E, F, G, R(41), 0xA81A664B ); + P( G, H, A, B, C, D, E, F, R(42), 0xC24B8B70 ); + P( F, G, H, A, B, C, D, E, R(43), 0xC76C51A3 ); + P( E, F, G, H, A, B, C, D, R(44), 0xD192E819 ); + P( D, E, F, G, H, A, B, C, R(45), 0xD6990624 ); + P( C, D, E, F, G, H, A, B, R(46), 0xF40E3585 ); + P( B, C, D, E, F, G, H, A, R(47), 0x106AA070 ); + P( A, B, C, D, E, F, G, H, R(48), 0x19A4C116 ); + P( H, A, B, C, D, E, F, G, R(49), 0x1E376C08 ); + P( G, H, A, B, C, D, E, F, R(50), 0x2748774C ); + P( F, G, H, A, B, C, D, E, R(51), 0x34B0BCB5 ); + P( E, F, G, H, A, B, C, D, R(52), 0x391C0CB3 ); + P( D, E, F, G, H, A, B, C, R(53), 0x4ED8AA4A ); + P( C, D, E, F, G, H, A, B, R(54), 0x5B9CCA4F ); + P( B, C, D, E, F, G, H, A, R(55), 0x682E6FF3 ); + P( A, B, C, D, E, F, G, H, R(56), 0x748F82EE ); + P( H, A, B, C, D, E, F, G, R(57), 0x78A5636F ); + P( G, H, A, B, C, D, E, F, R(58), 0x84C87814 ); + P( F, G, H, A, B, C, D, E, R(59), 0x8CC70208 ); + P( E, F, G, H, A, B, C, D, R(60), 0x90BEFFFA ); + P( D, E, F, G, H, A, B, C, R(61), 0xA4506CEB ); + P( C, D, E, F, G, H, A, B, R(62), 0xBEF9A3F7 ); + P( B, C, D, E, F, G, H, A, R(63), 0xC67178F2 ); + + ctx->state[0] += A; + ctx->state[1] += B; + ctx->state[2] += C; + ctx->state[3] += D; + ctx->state[4] += E; + ctx->state[5] += F; + ctx->state[6] += G; + ctx->state[7] += H; +} + +HT_API void sha256_update(sha256_context *ctx, uint8 *input, uint32 length) +{ + uint32 left, fill; + + if (!length) + { + return; + } + + left = ctx->total[0] & 0x3F; + fill = 64 - left; + + ctx->total[0] += length; + ctx->total[0] &= 0xFFFFFFFF; + + if (ctx->total[0] < length) + { + ctx->total[1]++; + } + + if (left && length >= fill) + { + memcpy((void *) (ctx->buffer + left), (void *) input, fill); + sha256_process(ctx, ctx->buffer); + length -= fill; + input += fill; + left = 0; + } + + while (length >= 64) + { + sha256_process(ctx, input); + length -= 64; + input += 64; + } + + if (length) + { + memcpy((void *) (ctx->buffer + left), (void *) input, length); + } +} + +HT_API void sha256_finish(sha256_context *ctx, uint8 digest[32]) +{ + uint32 last, padn; + uint32 high, low; + uint8 msglen[8]; + uint8 padding[64]; + + high = (ctx->total[0] >> 29) | (ctx->total[1] << 3); + low = (ctx->total[0] << 3); + + PUT_UINT32(high, msglen, 0); + PUT_UINT32(low, msglen, 4); + + last = ctx->total[0] & 0x3F; + padn = (last < 56) ? (56 - last) : (120 - last); + + memset(padding, 0, sizeof(padding)); + padding[0] = 0x80; + + sha256_update(ctx, padding, padn); + sha256_update(ctx, msglen, 8); + + PUT_UINT32(ctx->state[0], digest, 0); + PUT_UINT32(ctx->state[1], digest, 4); + PUT_UINT32(ctx->state[2], digest, 8); + PUT_UINT32(ctx->state[3], digest, 12); + PUT_UINT32(ctx->state[4], digest, 16); + PUT_UINT32(ctx->state[5], digest, 20); + PUT_UINT32(ctx->state[6], digest, 24); + PUT_UINT32(ctx->state[7], digest, 28); +} + + + + diff --git a/MediaClient/MediaClient/bm/sha256.h b/MediaClient/MediaClient/bm/sha256.h new file mode 100644 index 0000000..fa17f8a --- /dev/null +++ b/MediaClient/MediaClient/bm/sha256.h @@ -0,0 +1,44 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef _SHA256_H_ +#define _SHA256_H_ + +typedef struct +{ + uint32 total[2]; + uint32 state[8]; + uint8 buffer[64]; +} sha256_context; + +#ifdef __cplusplus +extern "C" { +#endif + +HT_API void sha256_starts(sha256_context *ctx); +HT_API void sha256_update(sha256_context *ctx, uint8 *input, uint32 length); +HT_API void sha256_finish(sha256_context *ctx, uint8 digest[32]); + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/MediaClient/MediaClient/bm/sys_buf.cpp b/MediaClient/MediaClient/bm/sys_buf.cpp new file mode 100644 index 0000000..25ac8c9 --- /dev/null +++ b/MediaClient/MediaClient/bm/sys_buf.cpp @@ -0,0 +1,201 @@ +/*************************************************************************************** + * + * 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 "sys_buf.h" +/***************************************************************************************/ +PPSN_CTX * net_buf_fl = NULL; +PPSN_CTX * hdrv_buf_fl = NULL; +static int net_buffer_init_count = 0; +static int hdrv_buf_init_count = 0; +/***************************************************************************************/ +HT_API BOOL net_buf_init(int num, int size) +{ + net_buffer_init_count++; + if (net_buf_fl) + { + return TRUE; + } + + net_buf_fl = pps_ctx_fl_init(num, size, TRUE); + if (net_buf_fl == NULL) + { + return FALSE; + } + log_print(HT_LOG_INFO, "%s, num = %lu\r\n", __FUNCTION__, net_buf_fl->node_num); + return TRUE; +} +HT_API char * net_buf_get_idle() +{ + return (char *)pps_fl_pop(net_buf_fl); +} +HT_API void net_buf_free(char * rbuf) +{ + if (rbuf == NULL) + { + return; + } + + if (pps_safe_node(net_buf_fl, rbuf)) + { + pps_fl_push_tail(net_buf_fl, rbuf); + } + else + { + free(rbuf); + } +} +HT_API uint32 net_buf_get_size() +{ + if (net_buf_fl == NULL) + { + return 0; + } + + return (net_buf_fl->unit_size - sizeof(PPSN)); +} +HT_API uint32 net_buf_idle_num() +{ + if (net_buf_fl == NULL) + { + return 0; + } + + return net_buf_fl->node_num; +} +HT_API void net_buf_deinit() +{ + net_buffer_init_count--; + if (net_buffer_init_count == 0) { + if (net_buf_fl) + { + pps_fl_free(net_buf_fl); + net_buf_fl = NULL; + } + } + if (net_buffer_init_count < 0)net_buffer_init_count=0;//Reset +} + +HT_API BOOL hdrv_buf_init(int num) +{ + hdrv_buf_init_count++; + if (hdrv_buf_fl) + { + return TRUE; + } + + hdrv_buf_fl = pps_ctx_fl_init(num, sizeof(HDRV), TRUE); + if (hdrv_buf_fl == NULL) + { + return FALSE; + } + + log_print(HT_LOG_INFO, "%s, num = %lu\r\n", __FUNCTION__, hdrv_buf_fl->node_num); + + return TRUE; +} +HT_API void hdrv_buf_deinit() +{ + hdrv_buf_init_count--; + if (hdrv_buf_init_count == 0) { + if (hdrv_buf_fl) + { + pps_fl_free(hdrv_buf_fl); + hdrv_buf_fl = NULL; + } + } + if (hdrv_buf_init_count < 0)hdrv_buf_init_count = 0; + + +} +HT_API HDRV * hdrv_buf_get_idle() +{ + HDRV * p_ret = (HDRV *)pps_fl_pop(hdrv_buf_fl); + + return p_ret; +} +HT_API void hdrv_buf_free(HDRV * pHdrv) +{ + if (pHdrv == NULL) + { + return; + } + + pHdrv->header[0] = '\0'; + pHdrv->value_string = NULL; + + pps_fl_push(hdrv_buf_fl, pHdrv); +} +HT_API uint32 hdrv_buf_idle_num() +{ + if (NULL == hdrv_buf_fl) + { + return 0; + } + + return hdrv_buf_fl->node_num; +} +HT_API void hdrv_ctx_ul_init(PPSN_CTX * ul_ctx) +{ + pps_ctx_ul_init_nm(hdrv_buf_fl, ul_ctx); +} +HT_API void hdrv_ctx_free(PPSN_CTX * p_ctx) +{ + HDRV * p_free; + + if (p_ctx == NULL) + { + return; + } + + p_free = (HDRV *)pps_lookup_start(p_ctx); + while (p_free != NULL) + { + HDRV * p_next = (HDRV *)pps_lookup_next(p_ctx, p_free); + + pps_ctx_ul_del(p_ctx, p_free); + hdrv_buf_free(p_free); + + p_free = p_next; + } + pps_lookup_end(p_ctx); +} +HT_API BOOL sys_buf_init(int nums) +{ + if (net_buf_init(nums, 2048) == FALSE) + { + log_print(HT_LOG_ERR, "%s, net_buf_init failed!!!\r\n", __FUNCTION__); + return FALSE; + } + + if (hdrv_buf_init(8*nums) == FALSE) + { + log_print(HT_LOG_ERR, "%s, hdrv_buf_init failed!!!\r\n", __FUNCTION__); + return FALSE; + } + + return TRUE; +} +HT_API void sys_buf_deinit() +{ + net_buf_deinit(); + hdrv_buf_deinit(); +} + + diff --git a/MediaClient/MediaClient/bm/sys_buf.h b/MediaClient/MediaClient/bm/sys_buf.h new file mode 100644 index 0000000..3c06fec --- /dev/null +++ b/MediaClient/MediaClient/bm/sys_buf.h @@ -0,0 +1,116 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef SYS_BUF_H +#define SYS_BUF_H + +/***************************************************************************************/ +#define MAX_AVN 8 +#define MAX_AVDESCLEN 500 +#define MAX_USRL 64 +#define MAX_PWDL 32 +#define MAX_NUML 64 +#define MAX_UA_ALT_NUM 8 + + +/***************************************************************************************/ +typedef struct header_value +{ + char header[32]; + char * value_string; +} HDRV; + +typedef struct ua_rtp_info +{ + int rtp_cnt; + uint32 rtp_ssrc; + uint32 rtp_ts; + uint8 rtp_pt; +} UA_RTP_INFO; + +typedef struct +{ + /* rtcp sender statistics */ + + int64 last_rtcp_ntp_time; + int64 first_rtcp_ntp_time; + uint32 packet_count; + uint32 octet_count; + uint32 last_octet_count; + int first_packet; + char cname[64]; +} UA_RTCP_INFO; + +typedef struct http_digest_auth_info +{ + char auth_name[MAX_USRL]; + char auth_pwd[64]; + char auth_uri[256]; + char auth_qop[32]; + char auth_nonce[128]; + char auth_cnonce[128]; + char auth_realm[128]; + char auth_algorithm[32]; + int auth_opaque_flag; + char auth_opaque[128]; + int auth_nc; + char auth_ncstr[12]; + char auth_response[100]; +} HD_AUTH_INFO; + +#ifdef __cplusplus +extern "C" { +#endif + +extern HT_API PPSN_CTX * hdrv_buf_fl; + +/***********************************************************************/ +HT_API BOOL net_buf_init(int num, int size); +HT_API void net_buf_deinit(); + +HT_API char * net_buf_get_idle(); +HT_API void net_buf_free(char * rbuf); +HT_API uint32 net_buf_get_size(); +HT_API uint32 net_buf_idle_num(); + +/***********************************************************************/ +HT_API BOOL hdrv_buf_init(int num); +HT_API void hdrv_buf_deinit(); + +HT_API HDRV * hdrv_buf_get_idle(); +HT_API void hdrv_buf_free(HDRV * pHdrv); +HT_API uint32 hdrv_buf_idle_num(); + +HT_API void hdrv_ctx_ul_init(PPSN_CTX * ul_ctx); +HT_API void hdrv_ctx_free(PPSN_CTX * p_ctx); + +/***********************************************************************/ +HT_API BOOL sys_buf_init(int nums); +HT_API void sys_buf_deinit(); +/***********************************************************************/ + + +#ifdef __cplusplus +} +#endif + +#endif // SYS_BUF_H + + + diff --git a/MediaClient/MediaClient/bm/sys_inc.h b/MediaClient/MediaClient/bm/sys_inc.h new file mode 100644 index 0000000..58d3617 --- /dev/null +++ b/MediaClient/MediaClient/bm/sys_inc.h @@ -0,0 +1,185 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef __SYS_INC_H__ +#define __SYS_INC_H__ + +#if defined(_WIN32) || defined(_WIN64) +#define __WINDOWS_OS__ 1 +#define __LINUX_OS__ 0 +#else +#define __WINDOWS_OS__ 0 +#define __LINUX_OS__ 1 +#endif + +#if __WINDOWS_OS__ + #ifdef HT_EXPORTS + #define HT_API __declspec(dllexport) + #else + #define HT_API __declspec(dllimport) + #endif + + #ifdef HT_STATIC + #undef HT_API + #define HT_API + #endif +#else + #define HT_API +#endif + +/***************************************************************************************/ +//typedef int int32; +typedef unsigned int uint32; +typedef unsigned short uint16; +typedef unsigned char uint8; + +/***************************************************************************************/ +#if __WINDOWS_OS__ + +#include "stdafx.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include /* _beginthread, _endthread */ +#include +#include + +#define sleep(x) Sleep((x) * 1000) +#define usleep(x) Sleep((x) / 1000) + +#define strcasecmp _stricmp +#define strncasecmp _strnicmp +#define snprintf _snprintf + +#define pthread_t DWORD + +typedef __int64 int64; +typedef unsigned __int64 uint64; + +#pragma comment(lib, "iphlpapi.lib") +#pragma comment(lib, "ws2_32.lib") + +#elif __LINUX_OS__ + +#include +#include + +#ifndef ANDROID +#include +#endif + +#include +#include +#include +#include + +#ifndef IOS +#include +#include +#include +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef IOS +#include +#endif + +typedef signed char BOOL; +typedef int SOCKET; + +typedef int64_t int64; +typedef uint64_t uint64; + +#define TRUE 1 +#define FALSE 0 + +#define closesocket close + +#endif + +/*************************************************************************/ +#include "sys_log.h" +#include "ppstack.h" +#include "word_analyse.h" +#include "sys_buf.h" +#include "util.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +HT_API void * sys_os_create_mutex(); +HT_API void * sys_os_create_sig(); + +HT_API void sys_os_destroy_sig_mutex(void * ptr); + +HT_API int sys_os_mutex_enter(void * p_sem); +HT_API void sys_os_mutex_leave(void * p_sem); + +HT_API int sys_os_sig_wait(void * p_sig); +HT_API int sys_os_sig_wait_timeout(void * p_sig, uint32 ms); +HT_API void sys_os_sig_sign(void * p_sig); + +HT_API pthread_t sys_os_create_thread(void * thread_func, void * argv); + +HT_API uint32 sys_os_get_ms(); +HT_API uint32 sys_os_get_uptime(); +HT_API char * sys_os_get_socket_error(); +HT_API int sys_os_get_socket_error_num(); + +#ifdef __cplusplus +} +#endif + +#endif // __SYS_INC_H__ + + + diff --git a/MediaClient/MediaClient/bm/sys_log.cpp b/MediaClient/MediaClient/bm/sys_log.cpp new file mode 100644 index 0000000..ab1183b --- /dev/null +++ b/MediaClient/MediaClient/bm/sys_log.cpp @@ -0,0 +1,447 @@ +/*************************************************************************************** + * + * 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 "sys_log.h" + +/***************************************************************************************/ + +HT_LOG_CTX g_log_ctx = { + NULL, + NULL, + HT_LOG_ERR, // default log level + 0, + 1024, // Maximum file size in KB + 0, + 3, // Maximum file indexes + 1, // Loop write log flag + 0 +}; + +static const char * g_log_level_str[] = +{ + "TRACE", + "DEBUG", + "INFO", + "WARN", + "ERROR", + "FATAL" +}; + +/***************************************************************************************/ + +void log_get_name(const char * log_fname, char * name, int size) +{ + const char * p; + + p = strrchr(log_fname, '.'); + if (p) + { + char fname[256] = {'\0'}; + int len = p - log_fname; + + len = (len <= size ? len : size); + + strncpy(fname, log_fname, len); + + p++; + + if (*p == '\0') + { + p = "log"; + } + + snprintf(name, size, "%s-%d.%s", fname, g_log_ctx.cur_idx+1, p); + } + else + { + snprintf(name, size, "%s-%d.log", log_fname, g_log_ctx.cur_idx+1); + } + + if (++g_log_ctx.cur_idx >= g_log_ctx.max_idx) + { + g_log_ctx.cur_idx = 0; + } +} + +HT_API int log_init(const char * log_fname) +{ + char name[256] = {'\0'}; + + log_close(); + + if (g_log_ctx.rewind) + { + log_get_name(log_fname, name, sizeof(name)-1); + } + else + { + strncpy(name, log_fname, sizeof(name)-1); + } + + g_log_ctx.fp = fopen(name, "w+"); + if (g_log_ctx.fp == NULL) + { + printf("log init fopen[%s] failed[%s]\r\n", name, strerror(errno)); + return -1; + } + + g_log_ctx.cur_size = 0; + + g_log_ctx.mutex = sys_os_create_mutex(); + if (g_log_ctx.mutex == NULL) + { + printf("log init mutex failed[%s]\r\n", strerror(errno)); + return -1; + } + + if (!g_log_ctx.time_init) + { + strncpy(g_log_ctx.name, log_fname, sizeof(g_log_ctx.name)-1); + } + + return 0; +} + +HT_API int log_time_init(const char * fname_prev) +{ + char fpath[256]; + time_t time_now = time(NULL); + struct tm * st = localtime(&(time_now)); + + snprintf(fpath, sizeof(fpath), + "%s-%04d%02d%02d_%02d%02d%02d.log", + fname_prev, + st->tm_year+1900, st->tm_mon+1, st->tm_mday, + st->tm_hour, st->tm_min, st->tm_sec); + + g_log_ctx.rewind = 0; + g_log_ctx.time_init = 1; + + strncpy(g_log_ctx.name, fname_prev, sizeof(g_log_ctx.name)-1); + + return log_init(fpath); +} + +HT_API int log_reinit(const char * log_fname) +{ + int ret = 0; + char name[256] = {'\0'}; + + sys_os_mutex_enter(g_log_ctx.mutex); + + if (g_log_ctx.fp) + { + fclose(g_log_ctx.fp); + g_log_ctx.fp = NULL; + } + + if (g_log_ctx.rewind) + { + log_get_name(log_fname, name, sizeof(name)-1); + } + else + { + strncpy(name, log_fname, sizeof(name)-1); + } + + g_log_ctx.fp = fopen(name, "w+"); + if (g_log_ctx.fp == NULL) + { + printf("log init fopen[%s] failed[%s]\r\n", name, strerror(errno)); + ret = -1; + } + + g_log_ctx.cur_size = 0; + + if (!g_log_ctx.time_init) + { + strncpy(g_log_ctx.name, log_fname, sizeof(g_log_ctx.name)-1); + } + + sys_os_mutex_leave(g_log_ctx.mutex); + + return ret; +} + +HT_API int log_time_reinit(const char * fname_prev) +{ + char fpath[256]; + time_t time_now = time(NULL); + struct tm * st = localtime(&(time_now)); + + snprintf(fpath, sizeof(fpath), + "%s-%04d%02d%02d_%02d%02d%02d.log", + fname_prev, + st->tm_year+1900, st->tm_mon+1, st->tm_mday, + st->tm_hour, st->tm_min, st->tm_sec); + + g_log_ctx.rewind = 0; + g_log_ctx.time_init = 1; + + strncpy(g_log_ctx.name, fname_prev, sizeof(g_log_ctx.name)-1); + + return log_reinit(fpath); +} + +HT_API void log_close() +{ + sys_os_mutex_enter(g_log_ctx.mutex); + + if (g_log_ctx.fp) + { + fclose(g_log_ctx.fp); + g_log_ctx.fp = NULL; + } + + sys_os_mutex_leave(g_log_ctx.mutex); + + if (g_log_ctx.mutex) + { + sys_os_destroy_sig_mutex(g_log_ctx.mutex); + g_log_ctx.mutex = NULL; + } +} + +void log_switch() +{ + if (g_log_ctx.cur_size >= g_log_ctx.max_size * 1024) + { + if (g_log_ctx.time_init) + { + log_time_reinit(g_log_ctx.name); + } + else + { + log_reinit(g_log_ctx.name); + } + } +} + +int log_print_ex(int level, const char *fmt, va_list argptr) +{ + int slen = 0; + time_t time_now; + struct tm * st; + + if (g_log_ctx.fp == NULL || g_log_ctx.mutex == NULL) + { + return 0; + } + + time_now = time(NULL); + st = localtime(&(time_now)); + + sys_os_mutex_enter(g_log_ctx.mutex); + + if (g_log_ctx.fp) + { + slen = fprintf(g_log_ctx.fp, + "[%04d-%02d-%02d %02d:%02d:%02d] : [%s] ", + st->tm_year+1900, st->tm_mon+1, st->tm_mday, + st->tm_hour, st->tm_min, st->tm_sec, + g_log_level_str[level]); + + if (slen > 0) + { + g_log_ctx.cur_size += slen; + } + + slen = vfprintf(g_log_ctx.fp, fmt, argptr); + fflush(g_log_ctx.fp); + + if (slen > 0) + { + g_log_ctx.cur_size += slen; + } + } + + sys_os_mutex_leave(g_log_ctx.mutex); + + log_switch(); + + return slen; +} + +#ifndef IOS + +HT_API int log_print(int level, const char * fmt,...) +{ + if (level < g_log_ctx.level || level > HT_LOG_FATAL) + { + return 0; + } + else + { + int slen; + va_list argptr; + + va_start(argptr, fmt); + + slen = log_print_ex(level, fmt, argptr); + + va_end(argptr); + + return slen; + } +} + +#else + +HT_API int log_ios_print(int level, const char * fmt,...) +{ + if (level < g_log_ctx.level || level > HT_LOG_FATAL) + { + return 0; + } + else + { + int slen; + va_list argptr; + + va_start(argptr, fmt); + + slen = log_print_ex(level, fmt, argptr); + + va_end(argptr); + + return slen; + } + + return 0; +} + +#endif + +static int log_lock_print_ex(const char *fmt, va_list argptr) +{ + int slen; + + if (g_log_ctx.fp == NULL || g_log_ctx.mutex == NULL) + { + return 0; + } + + slen = vfprintf(g_log_ctx.fp, fmt, argptr); + + fflush(g_log_ctx.fp); + + if (slen > 0) + { + g_log_ctx.cur_size += slen; + } + + return slen; +} + +HT_API int log_lock_start(const char * fmt,...) +{ + int slen = 0; + va_list argptr; + + if (g_log_ctx.fp == NULL || g_log_ctx.mutex == NULL) + { + return 0; + } + + va_start(argptr,fmt); + + sys_os_mutex_enter(g_log_ctx.mutex); + + slen = log_lock_print_ex(fmt,argptr); + + va_end(argptr); + + return slen; +} + +HT_API int log_lock_print(const char * fmt,...) +{ + int slen; + + va_list argptr; + va_start(argptr,fmt); + + slen = log_lock_print_ex(fmt, argptr); + + va_end(argptr); + + return slen; +} + +HT_API int log_lock_end(const char * fmt,...) +{ + int slen; + + va_list argptr; + va_start(argptr,fmt); + + slen = log_lock_print_ex(fmt, argptr); + + va_end(argptr); + + sys_os_mutex_leave(g_log_ctx.mutex); + + log_switch(); + + return slen; +} + +HT_API void log_set_level(int level) +{ + g_log_ctx.level = level; +} + +HT_API int log_get_level() +{ + return g_log_ctx.level; +} + +HT_API void log_set_rewind(int rewind) +{ + g_log_ctx.rewind = rewind; +} + +HT_API int log_get_rewind() +{ + return g_log_ctx.rewind; +} + +HT_API void log_set_max_size(int max_size) +{ + g_log_ctx.max_size = max_size; +} + +HT_API int log_get_max_size() +{ + return g_log_ctx.max_size; +} + +HT_API void log_set_max_idx(int max_idx) +{ + g_log_ctx.max_idx = max_idx; +} + +HT_API int log_get_max_idx() +{ + return g_log_ctx.max_idx; +} + + + diff --git a/MediaClient/MediaClient/bm/sys_log.h b/MediaClient/MediaClient/bm/sys_log.h new file mode 100644 index 0000000..fcb46b6 --- /dev/null +++ b/MediaClient/MediaClient/bm/sys_log.h @@ -0,0 +1,81 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef __H_SYS_LOG_H__ +#define __H_SYS_LOG_H__ + +// log level + +#define HT_LOG_TRC 0 +#define HT_LOG_DBG 1 +#define HT_LOG_INFO 2 +#define HT_LOG_WARN 3 +#define HT_LOG_ERR 4 +#define HT_LOG_FATAL 5 + +typedef struct +{ + FILE * fp; // Log file pointer + void * mutex; // read-write lock + int level; // Log level + uint32 cur_size; // The current write length of the log + uint32 max_size; // Maximum file size in KB + int cur_idx; // Current log file index + int max_idx; // Maximum file indexes + int rewind; // Loop write log flag + int time_init; // Initialize log file names using system time + char name[256]; // Log file name +} HT_LOG_CTX; + +#ifdef __cplusplus +extern "C" { +#endif + +HT_API int log_init(const char * log_fname); +HT_API int log_time_init(const char * fname_prev); +HT_API int log_reinit(const char * log_fname); +HT_API int log_time_reinit(const char * fname_prev); +HT_API void log_close(); +HT_API void log_set_level(int level); +HT_API int log_get_level(); +HT_API void log_set_rewind(int rewind); +HT_API int log_get_rewind(); +HT_API void log_set_max_size(int max_size); +HT_API int log_get_max_size(); +HT_API void log_set_max_idx(int max_idx); +HT_API int log_get_max_idx(); +HT_API int log_lock_start(const char * fmt,...); +HT_API int log_lock_print(const char * fmt,...); +HT_API int log_lock_end(const char * fmt,...); + +#ifdef IOS +HT_API int log_ios_print(int level, const char * fmt,...); +#define log_print log_ios_print +#else +HT_API int log_print(int level, const char * fmt,...); +#endif + +#ifdef __cplusplus +} +#endif + +#endif + + + diff --git a/MediaClient/MediaClient/bm/sys_os.cpp b/MediaClient/MediaClient/bm/sys_os.cpp new file mode 100644 index 0000000..9768845 --- /dev/null +++ b/MediaClient/MediaClient/bm/sys_os.cpp @@ -0,0 +1,448 @@ +/*************************************************************************************** + * + * 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" + + +/***************************************************************************************/ +HT_API void * sys_os_create_mutex() +{ + void * p_mutex = NULL; + +#ifdef IOS + + static int index = 0; + char name[32] = {'\0'}; + snprintf(name, sizeof(name), "testmutex%u", (uint32)time(NULL)+index++); + + p_mutex = sem_open(name, O_CREAT, 0644, 1); + if (p_mutex == SEM_FAILED) + { + log_print(HT_LOG_ERR, "%s, sem_open failed. name=%s\r\n", __FUNCTION__, name); + return NULL; + } + +#elif __WINDOWS_OS__ + + p_mutex = CreateMutex(NULL, FALSE, NULL); + +#elif __LINUX_OS__ + + int ret; + + p_mutex = (sem_t *)malloc(sizeof(sem_t)); + ret = sem_init((sem_t *)p_mutex, 0, 1); + if (ret != 0) + { + free(p_mutex); + return NULL; + } + +#endif + + return p_mutex; +} + +HT_API void * sys_os_create_sig() +{ + void * p_sig = NULL; + +#ifdef IOS + + static int index = 0; + char name[32] = {'\0'}; + snprintf(name, sizeof(name), "testsig%u", (uint32)time(NULL)+index++); + + p_sig = sem_open(name, O_CREAT, 0644, 1); + if (p_sig == SEM_FAILED) + { + log_print(HT_LOG_ERR, "%s, sem_open failed. name=%s\r\n", __FUNCTION__, name); + return NULL; + } + +#elif __WINDOWS_OS__ + + p_sig = CreateEvent(NULL, FALSE, FALSE, NULL); + +#elif __LINUX_OS__ + + int ret; + + p_sig = malloc(sizeof(sem_t)); + ret = sem_init((sem_t *)p_sig, 0, 0); + if (ret != 0) + { + free(p_sig); + return NULL; + } + +#endif + + return p_sig; +} + +HT_API void sys_os_destroy_sig_mutex(void * ptr) +{ + if (ptr == NULL) + { + return; + } + +#ifdef IOS + + sem_close((sem_t *)ptr); + +#elif __WINDOWS_OS__ + + CloseHandle(ptr); + +#elif __LINUX_OS__ + + sem_destroy((sem_t *)ptr); + free(ptr); + +#endif +} + +HT_API int sys_os_mutex_enter(void * p_sem) +{ + int ret; + + if (p_sem == NULL) + { + return -1; + } + +#if __LINUX_OS__ + + ret = sem_wait((sem_t *)p_sem); + if (ret != 0) + { + return -1; + } + +#elif __WINDOWS_OS__ + + ret = WaitForSingleObject(p_sem, INFINITE); + if (ret == WAIT_FAILED) + { + return -1; + } + +#endif + + return 0; +} + +HT_API void sys_os_mutex_leave(void * p_sem) +{ + if (p_sem == NULL) + { + return; + } + +#if __LINUX_OS__ + + sem_post((sem_t *)p_sem); + +#elif __WINDOWS_OS__ + + ReleaseMutex(p_sem); + +#endif +} + +HT_API int sys_os_sig_wait(void * p_sig) +{ + int ret; + + if (p_sig == NULL) + { + return -1; + } + +#if __LINUX_OS__ + + ret = sem_wait((sem_t *)p_sig); + if (ret != 0) + { + return -1; + } + +#elif __WINDOWS_OS__ + + ret = WaitForSingleObject(p_sig, INFINITE); + if (ret == WAIT_FAILED) + { + return -1; + } + +#endif + + return 0; +} + +HT_API int sys_os_sig_wait_timeout(void * p_sig, uint32 ms) +{ +#ifdef IOS + + if (p_sig == NULL) + { + return -1; + } + + while (ms > 0) + { + if (sem_trywait((sem_t *)p_sig) == 0) + { + return 0; + } + + usleep(1000); + + ms -= 1; + } + + return -1; + +#elif __LINUX_OS__ + + int ret; + struct timespec ts; + struct timeval tt; + + if (p_sig == NULL) + { + return -1; + } + + gettimeofday(&tt,NULL); + + tt.tv_sec = tt.tv_sec + ms / 1000; + tt.tv_usec = tt.tv_usec + (ms % 1000) * 1000; + tt.tv_sec += tt.tv_usec / (1000 * 1000); + tt.tv_usec = tt.tv_usec % (1000 * 1000); + + ts.tv_sec = tt.tv_sec; + ts.tv_nsec = tt.tv_usec * 1000; + + ret = sem_timedwait((sem_t *)p_sig, &ts); + if (ret == -1 && errno == ETIMEDOUT) + { + return -1; + } + else + { + return 0; + } + +#elif __WINDOWS_OS__ + + DWORD ret; + + if (p_sig == NULL) + { + return -1; + } + + ret = WaitForSingleObject(p_sig, ms); + if (ret == WAIT_FAILED) + { + return -1; + } + else if (ret == WAIT_TIMEOUT) + { + return -1; + } + +#endif + + return 0; +} + +HT_API void sys_os_sig_sign(void * p_sig) +{ + if (p_sig == NULL) + { + return; + } + +#if __LINUX_OS__ + + sem_post((sem_t *)p_sig); + +#elif __WINDOWS_OS__ + + SetEvent(p_sig); + +#endif +} + +HT_API pthread_t sys_os_create_thread(void * thread_func, void * argv) +{ + pthread_t tid = 0; + +#if __LINUX_OS__ + + int ret = pthread_create(&tid, NULL, (void *(*)(void *))thread_func, argv); + if (ret != 0) + { + log_print(HT_LOG_ERR, "%s, pthread_create failed, ret = %d\r\n", __FUNCTION__, ret); + } + + pthread_detach(tid); + +#elif __WINDOWS_OS__ + + HANDLE hret = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)thread_func, argv, 0, &tid); + if (hret == NULL || tid == 0) + { + log_print(HT_LOG_ERR, "%s, CreateThread hret=%u, tid=%u, err=%u\r\n", __FUNCTION__, hret, tid, GetLastError()); + } + + CloseHandle(hret); + +#endif + + return tid; +} + +HT_API uint32 sys_os_get_ms() +{ + uint32 ms = 0; + +#if __LINUX_OS__ + + struct timeval tv; + gettimeofday(&tv, NULL); + + ms = tv.tv_sec * 1000 + tv.tv_usec/1000; + +#elif __WINDOWS_OS__ + + ms = GetTickCount(); + +#endif + + return ms; +} + +HT_API uint32 sys_os_get_uptime() +{ + uint32 upt = 0; + +#ifdef ANDROID + + upt = (uint32)time(NULL); + +#elif __LINUX_OS__ + + int rlen; + char bufs[512]; + char * ptr; + FILE * file; + + file = fopen("/proc/uptime", "rb"); + if (NULL == file) + { + return (uint32)time(NULL); + } + + rlen = fread(bufs, 1, sizeof(bufs)-1, file); + fclose(file); + + if (rlen <= 0) + { + return (uint32)time(NULL); + } + + bufs[rlen] = '\0'; + ptr = bufs; + + while (*ptr != '\0' && *ptr != ' ' && *ptr != '\r' && *ptr != '\n') + { + ptr++; + } + + if (*ptr == ' ') + { + *ptr = '\0'; + } + else + { + return (uint32)time(NULL); + } + + upt = (uint32)strtod(bufs, NULL); + +#elif __WINDOWS_OS__ + + LARGE_INTEGER freq; + LARGE_INTEGER cur; + + QueryPerformanceFrequency(&freq); + QueryPerformanceCounter(&cur); + + upt = (uint32) (cur.QuadPart / freq.QuadPart); + +#endif + + return upt; +} + +HT_API char * sys_os_get_socket_error() +{ + char * p_estr = NULL; + +#if __LINUX_OS__ + + p_estr = strerror(errno); + +#elif __WINDOWS_OS__ + + int err = WSAGetLastError(); + static char err_buf[24]; + snprintf(err_buf, sizeof(err_buf), "WSAE-%d", err); + p_estr = err_buf; + +#endif + + return p_estr; +} + +HT_API int sys_os_get_socket_error_num() +{ + int sockerr; + +#if __LINUX_OS__ + + sockerr = errno; + +#elif __WINDOWS_OS__ + + sockerr = WSAGetLastError(); + +#endif + + return sockerr; +} + + + diff --git a/MediaClient/MediaClient/bm/util.cpp b/MediaClient/MediaClient/bm/util.cpp new file mode 100644 index 0000000..ed45bfc --- /dev/null +++ b/MediaClient/MediaClient/bm/util.cpp @@ -0,0 +1,1687 @@ +/*************************************************************************************** + * + * 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 "util.h" + +/***************************************************************************************/ +HT_API int get_if_nums() +{ +#if __WINDOWS_OS__ + + char ipt_buf[512]; + MIB_IPADDRTABLE * ipt = (MIB_IPADDRTABLE *)ipt_buf; + ULONG ipt_len = sizeof(ipt_buf); + DWORD fr = GetIpAddrTable(ipt, &ipt_len, FALSE); + if (fr != NO_ERROR) + { + return 0; + } + + return ipt->dwNumEntries; + +#elif defined(IOS) + + int count = 0; + struct ifaddrs *if_addrs = NULL; + struct ifaddrs *if_addr = NULL; + + if (0 == getifaddrs(&if_addrs)) + { + for (if_addr = if_addrs; if_addr != NULL; if_addr = if_addr->ifa_next) + { + if (NULL == if_addr->ifa_addr || if_addr->ifa_addr->sa_family != AF_INET) + { + continue; + } + + count++; + } + + freeifaddrs(if_addrs); + if_addrs = NULL; + } + + return count; + +#elif __LINUX_OS__ + + SOCKET socket_fd; + struct ifreq *ifr; + struct ifconf conf; + char buff[BUFSIZ]; + int i, num, count = 0; + + socket_fd = socket(AF_INET, SOCK_DGRAM, 0); + if (socket_fd <= 0) + { + return 0; + } + + conf.ifc_len = BUFSIZ; + conf.ifc_buf = buff; + + ioctl(socket_fd, SIOCGIFCONF, &conf); + + num = conf.ifc_len / sizeof(struct ifreq); + ifr = conf.ifc_req; + + for (i=0; iifr_addr.sa_family == AF_INET) + { + count++; + } + + ifr++; + } + + closesocket(socket_fd); + + return count; + +#endif + + return 0; +} + +HT_API uint32 get_if_ip(int index) +{ +#if __WINDOWS_OS__ + + char ipt_buf[1024]; + DWORD i; + MIB_IPADDRTABLE * ipt = (MIB_IPADDRTABLE *)ipt_buf; + ULONG ipt_len = sizeof(ipt_buf); + DWORD fr = GetIpAddrTable(ipt, &ipt_len, FALSE); + if (fr != NO_ERROR) + { + return 0; + } + + for (i=0; idwNumEntries; i++) + { + if (i == index) + { + return ipt->table[i].dwAddr; + } + } + +#elif defined(IOS) + + int count = 0; + struct ifaddrs *if_addrs = NULL; + struct ifaddrs *if_addr = NULL; + struct sockaddr_in * sin; + uint32 ip_addr = 0; + + if (0 == getifaddrs(&if_addrs)) + { + for (if_addr = if_addrs; if_addr != NULL; if_addr = if_addr->ifa_next) + { + if (NULL == if_addr->ifa_addr || if_addr->ifa_addr->sa_family != AF_INET) + { + continue; + } + + if (count++ == index) + { + sin = (struct sockaddr_in *)if_addr->ifa_addr; + ip_addr = sin->sin_addr.s_addr; + + break; + } + } + + freeifaddrs(if_addrs); + if_addrs = NULL; + } + + return ip_addr; + +#elif __LINUX_OS__ + + int i; + SOCKET socket_fd; + struct ifreq *ifr; + struct ifconf conf; + char buff[BUFSIZ]; + int num, count = 0; + uint32 ip_addr = 0; + + socket_fd = socket(AF_INET, SOCK_DGRAM, 0); + + conf.ifc_len = BUFSIZ; + conf.ifc_buf = buff; + + ioctl(socket_fd, SIOCGIFCONF, &conf); + + num = conf.ifc_len / sizeof(struct ifreq); + ifr = conf.ifc_req; + + for (i=0; iifr_addr.sa_family != AF_INET) + { + ifr++; + continue; + } + + if (count++ == index) + { + struct sockaddr_in *sin = (struct sockaddr_in *)(&ifr->ifr_addr); + ip_addr = sin->sin_addr.s_addr; + + break; + } + + ifr++; + } + + closesocket(socket_fd); + + return ip_addr; + +#endif + + return 0; +} + +HT_API uint32 get_route_if_ip(uint32 dst_ip) +{ +#if __WINDOWS_OS__ + + DWORD i; + DWORD dwIfIndex,fr; + char ipt_buf[1024]; + MIB_IPADDRTABLE *ipt; + ULONG ipt_len; + + fr = GetBestInterface(dst_ip, &dwIfIndex); + if (fr != NO_ERROR) + { + return 0; + } + + ipt = (MIB_IPADDRTABLE *)ipt_buf; + ipt_len = sizeof(ipt_buf); + fr = GetIpAddrTable(ipt, &ipt_len, FALSE); + if (fr != NO_ERROR) + { + return 0; + } + + for (i=0; idwNumEntries; i++) + { + if (ipt->table[i].dwIndex == dwIfIndex) + { + return ipt->table[i].dwAddr; + } + } + +#elif defined(IOS) + + struct ifaddrs *if_addrs = NULL; + struct ifaddrs *if_addr = NULL; + struct sockaddr_in * sin; + uint32 ip_addr = 0; + + if (0 == getifaddrs(&if_addrs)) + { + for (if_addr = if_addrs; if_addr != NULL; if_addr = if_addr->ifa_next) + { + if (NULL == if_addr->ifa_addr || if_addr->ifa_addr->sa_family != AF_INET) + { + continue; + } + + sin = (struct sockaddr_in *)if_addr->ifa_addr; + + if (((if_addr->ifa_flags & IFF_LOOPBACK) == 0) && (if_addr->ifa_flags & IFF_UP)) + { + ip_addr = sin->sin_addr.s_addr; + break; + } + } + + freeifaddrs(if_addrs); + if_addrs = NULL; + } + + return ip_addr; + +#elif __LINUX_OS__ + + int i; + SOCKET socket_fd; + struct ifreq *ifr; + struct ifconf conf; + char buff[BUFSIZ]; + int num; + uint32 ip_addr = 0; + + socket_fd = socket(AF_INET, SOCK_DGRAM, 0); + + conf.ifc_len = BUFSIZ; + conf.ifc_buf = buff; + + ioctl(socket_fd, SIOCGIFCONF, &conf); + + num = conf.ifc_len / sizeof(struct ifreq); + ifr = conf.ifc_req; + + for (i=0; iifr_addr.sa_family != AF_INET) + { + ifr++; + continue; + } + + ioctl(socket_fd, SIOCGIFFLAGS, ifr); + + if (((ifr->ifr_flags & IFF_LOOPBACK) == 0) && (ifr->ifr_flags & IFF_UP)) + { + struct sockaddr_in *sin = (struct sockaddr_in *)(&ifr->ifr_addr); + ip_addr = sin->sin_addr.s_addr; + break; + } + + ifr++; + } + + closesocket(socket_fd); + + return ip_addr; + +#endif + + return 0; +} + +HT_API uint32 get_default_if_ip() +{ + uint32 ip = get_route_if_ip(0); + + if (ip != 0) + { + return ip; + } + else + { + int i; + int nums = get_if_nums(); + + for (i = 0; i < nums; i++) + { + ip = get_if_ip(i); + if (ip != 0 && ip != inet_addr("127.0.0.l")) + { + return ip; + } + } + } + + return 0; +} + +HT_API const char * get_local_ip() +{ + uint32 ip = get_default_if_ip(); + if (ip != 0) + { + return get_ip_str(ip); + } + + return "127.0.0.1"; +} + +HT_API uint32 get_if_mask(int index) +{ +#if __WINDOWS_OS__ + + char ipt_buf[1024]; + DWORD i; + MIB_IPADDRTABLE * ipt = (MIB_IPADDRTABLE *)ipt_buf; + ULONG ipt_len = sizeof(ipt_buf); + DWORD fr = GetIpAddrTable(ipt, &ipt_len, FALSE); + if (fr != NO_ERROR) + { + return inet_addr("255.255.255.255"); + } + + for (i=0; idwNumEntries; i++) + { + if (i == index) + { + return ipt->table[i].dwMask; + } + } + +#elif defined(IOS) + + int count = 0; + struct ifaddrs *if_addrs = NULL; + struct ifaddrs *if_addr = NULL; + struct sockaddr_in * sin; + uint32 mask = inet_addr("255.255.255.255"); + + if (0 == getifaddrs(&if_addrs)) + { + for (if_addr = if_addrs; if_addr != NULL; if_addr = if_addr->ifa_next) + { + if (NULL == if_addr->ifa_addr || if_addr->ifa_addr->sa_family != AF_INET) + { + continue; + } + + if (count++ == index) + { + sin = (struct sockaddr_in *)if_addr->ifa_netmask; + mask = sin->sin_addr.s_addr; + + break; + } + } + + freeifaddrs(if_addrs); + if_addrs = NULL; + } + + return mask; + +#elif __LINUX_OS__ + + int i; + SOCKET socket_fd; + struct ifreq *ifr; + struct ifconf conf; + char buff[BUFSIZ]; + int num, count = 0; + uint32 mask = inet_addr("255.255.255.255"); + + socket_fd = socket(AF_INET, SOCK_DGRAM, 0); + + conf.ifc_len = BUFSIZ; + conf.ifc_buf = buff; + + ioctl(socket_fd, SIOCGIFCONF, &conf); + + num = conf.ifc_len / sizeof(struct ifreq); + ifr = conf.ifc_req; + + for (i=0; iifr_addr.sa_family != AF_INET) + { + ifr++; + continue; + } + + if (count++ == index) + { + struct sockaddr_in *sin = (struct sockaddr_in *)(&ifr->ifr_netmask); + + ioctl(socket_fd, SIOCGIFNETMASK, ifr); + + mask = sin->sin_addr.s_addr; + + break; + } + + ifr++; + } + + closesocket(socket_fd); + + return mask; + +#endif + + return inet_addr("255.255.255.255"); +} + +HT_API uint32 get_route_if_mask(uint32 dst_ip) +{ +#if __WINDOWS_OS__ + + DWORD i; + DWORD dwIfIndex,fr; + char ipt_buf[1024]; + MIB_IPADDRTABLE *ipt; + ULONG ipt_len; + + fr = GetBestInterface(dst_ip, &dwIfIndex); + if (fr != NO_ERROR) + { + return inet_addr("255.255.255.255"); + } + + ipt = (MIB_IPADDRTABLE *)ipt_buf; + ipt_len = sizeof(ipt_buf); + fr = GetIpAddrTable(ipt,&ipt_len,FALSE); + if (fr != NO_ERROR) + { + return inet_addr("255.255.255.255"); + } + + for (i=0; idwNumEntries; i++) + { + if (ipt->table[i].dwIndex == dwIfIndex) + { + return ipt->table[i].dwMask; + } + } + +#elif defined(IOS) + + struct ifaddrs *if_addrs = NULL; + struct ifaddrs *if_addr = NULL; + struct sockaddr_in * sin; + uint32 mask = inet_addr("255.255.255.255"); + + if (0 == getifaddrs(&if_addrs)) + { + for (if_addr = if_addrs; if_addr != NULL; if_addr = if_addr->ifa_next) + { + if (NULL == if_addr->ifa_addr || if_addr->ifa_addr->sa_family != AF_INET) + { + continue; + } + + sin = (struct sockaddr_in *)if_addr->ifa_netmask; + + if (((if_addr->ifa_flags & IFF_LOOPBACK) == 0) && (if_addr->ifa_flags & IFF_UP)) + { + mask = sin->sin_addr.s_addr; + break; + } + } + + freeifaddrs(if_addrs); + if_addrs = NULL; + } + + return mask; + +#elif __LINUX_OS__ + + int i; + SOCKET socket_fd; + struct ifreq *ifr; + struct ifconf conf; + char buff[BUFSIZ]; + int num; + uint32 mask = inet_addr("255.255.255.255"); + + socket_fd = socket(AF_INET, SOCK_DGRAM, 0); + + conf.ifc_len = BUFSIZ; + conf.ifc_buf = buff; + + ioctl(socket_fd, SIOCGIFCONF, &conf); + + num = conf.ifc_len / sizeof(struct ifreq); + ifr = conf.ifc_req; + + for (i=0; iifr_addr.sa_family != AF_INET) + { + ifr++; + continue; + } + + ioctl(socket_fd, SIOCGIFFLAGS, ifr); + + if (((ifr->ifr_flags & IFF_LOOPBACK) == 0) && (ifr->ifr_flags & IFF_UP)) + { + struct sockaddr_in *sin = (struct sockaddr_in *)(&ifr->ifr_netmask); + + ioctl(socket_fd, SIOCGIFNETMASK, ifr); + + mask = sin->sin_addr.s_addr; + break; + } + + ifr++; + } + + closesocket(socket_fd); + + return mask; + +#endif + + return inet_addr("255.255.255.255"); +} + +HT_API uint32 get_default_if_mask() +{ + return get_route_if_mask(0); +} + +HT_API int is_local_if_net(uint32 destip) +{ + int i; + int nums; + + if (destip == inet_addr("127.0.0.1")) + { + return 1; + } + + nums = get_if_nums(); + + for (i = 0; i < nums; i++) + { + uint32 ip = get_if_ip(i); + uint32 mask = get_if_mask(i); + + if ((ip & mask) == (destip & mask)) + { + return 1; + } + } + + return 0; +} + +HT_API int get_default_if_mac(uint8 * mac) +{ +#ifdef IOS + +#elif __WINDOWS_OS__ + + IP_ADAPTER_INFO AdapterInfo[16]; // Allocate information for up to 16 NICs + DWORD dwBufLen = sizeof(AdapterInfo); // Save the memory size of buffer + + DWORD dwStatus = GetAdaptersInfo( // Call GetAdapterInfo + AdapterInfo, // [out] buffer to receive data + &dwBufLen); // [in] size of receive data buffer + + PIP_ADAPTER_INFO pAdapterInfo = AdapterInfo;// Contains pointer to current adapter info + if (pAdapterInfo) + { + memcpy(mac, pAdapterInfo->Address, 6); + return 0; + } + +#elif __LINUX_OS__ + + int i; + SOCKET socket_fd; + struct ifreq *ifr; + struct ifreq ifreq; + struct ifconf conf; + char buff[BUFSIZ]; + int num; + + socket_fd = socket(AF_INET, SOCK_DGRAM, 0); + + conf.ifc_len = BUFSIZ; + conf.ifc_buf = buff; + + ioctl(socket_fd, SIOCGIFCONF, &conf); + + num = conf.ifc_len / sizeof(struct ifreq); + ifr = conf.ifc_req; + + for (i=0; iifr_addr.sa_family != AF_INET) + { + ifr++; + continue; + } + + ioctl(socket_fd, SIOCGIFFLAGS, ifr); + + if ((ifr->ifr_flags & IFF_LOOPBACK) != 0) + { + ifr++; + continue; + } + + strcpy(ifreq.ifr_name, ifr->ifr_name); + + if (ioctl(socket_fd, SIOCGIFHWADDR, &ifreq) < 0) + { + ifr++; + continue; + } + + memcpy(mac, &ifreq.ifr_hwaddr.sa_data, 6); + + close(socket_fd); + + return 0; + } + + close(socket_fd); +#endif + + return -1; +} + +HT_API const char * get_default_gateway() +{ + static char gateway[32]; + +#if __WINDOWS_OS__ + + IP_ADAPTER_INFO AdapterInfo[16]; // Allocate information for up to 16 NICs + DWORD dwBufLen = sizeof(AdapterInfo); // Save the memory size of buffer + + DWORD dwStatus = GetAdaptersInfo( // Call GetAdapterInfo + AdapterInfo, // [out] buffer to receive data + &dwBufLen); // [in] size of receive data buffer + + PIP_ADAPTER_INFO pAdapterInfo = AdapterInfo;// Contains pointer to current adapter info + if (NULL == pAdapterInfo) + { + return NULL; + } + + memset(gateway, 0, sizeof(gateway)); + + while (pAdapterInfo) + { + if (strcmp(pAdapterInfo->GatewayList.IpAddress.String, "0.0.0.0")) + { + strncpy(gateway, pAdapterInfo->GatewayList.IpAddress.String, sizeof(gateway)-1); + break; + } + + pAdapterInfo = pAdapterInfo->Next; + } + +#elif __LINUX_OS__ + + char line[100], *p, *c, *g, *saveptr; + int ret = 0; + + FILE *fp = fopen("/proc/net/route" , "r"); + if (NULL == fp) + { + return NULL; + } + + memset(gateway, 0, sizeof(gateway)); + + while (fgets(line, 100, fp)) + { + p = strtok_r(line, " \t", &saveptr); + c = strtok_r(NULL, " \t", &saveptr); + g = strtok_r(NULL, " \t", &saveptr); + + if (p != NULL && c != NULL) + { + if (strcmp(c, "00000000") == 0) + { + if (g) + { + char *p_end; + int gw = strtol(g, &p_end, 16); + + struct in_addr addr; + addr.s_addr = gw; + + strcpy(gateway, inet_ntoa(addr)); + ret = 1; + } + + break; + } + } + } + + fclose(fp); + + if (ret == 0) + { + return NULL; + } + +#endif + + return gateway; +} + +HT_API const char * get_dns_server() +{ + static char dns[32] = {'\0'}; + +#if __WINDOWS_OS__ + + IP_ADAPTER_ADDRESSES addr[16], *paddr; + DWORD len = sizeof(addr); + + memset(dns, 0, sizeof(dns)); + + if (NO_ERROR == GetAdaptersAddresses(AF_INET, 0, 0, addr, &len) && len >= sizeof(IP_ADAPTER_ADDRESSES)) + { + paddr = addr; + + while (paddr) + { + PIP_ADAPTER_DNS_SERVER_ADDRESS p_ipaddr; + + if (paddr->IfType & IF_TYPE_SOFTWARE_LOOPBACK) + { + paddr = paddr->Next; + continue; + } + + p_ipaddr = paddr->FirstDnsServerAddress; + if (p_ipaddr) + { + struct sockaddr_in * p_inaddr = (struct sockaddr_in *)p_ipaddr->Address.lpSockaddr; + strcpy(dns, inet_ntoa(p_inaddr->sin_addr)); + + break; + } + + paddr = paddr->Next; + } + } + +#elif __LINUX_OS__ + + uint32 i; + char line[100] = {'\0'}; + char * p; + FILE * fp; + + memset(dns, 0, sizeof(dns)); + + fp = fopen("/etc/resolv.conf" , "r"); + if (NULL == fp) + { + log_print(HT_LOG_ERR, "open file /etc/resolv.conf failed\r\n"); + return dns; + } + + while (fgets(line, 100, fp)) + { + p = line; + + while (*p == ' ') p++; // skip space + + if (strncasecmp(p, "nameserver", 10) != 0) + { + continue; + } + + p += 10; + + while (*p == ' ') p++; // skip space + + i = 0; + + while (*p != '\0') + { + if (*p == ' ' || *p == '\n') + { + break; + } + + if (i < sizeof(dns) - 1) + { + dns[i++] = *p++; + } + else + { + break; + } + } + + dns[i] = '\0'; + + if (is_ip_address(dns)) + { + break; + } + else + { + dns[0] = '\0'; + } + } +#endif + + return dns; +} + +HT_API const char * get_mask_by_prefix_len(int len) +{ + int i; + static char mask_str[32] = {'\0'}; + uint32 mask = 0; + + len = (len > 32 ? 32 : len); + + for (i = 0; i < len; i++) + { + mask |= (1 << (31 - i)); + } + + memset(mask_str, 0, sizeof(mask_str)); + snprintf(mask_str, sizeof(mask_str), "%u.%u.%u.%u", (mask & 0xFF000000) >> 24, (mask & 0x00FF0000) >> 16, + (mask & 0x0000FF00) >> 8, (mask & 0x000000FF)); + + return mask_str; +} + +HT_API int get_prefix_len_by_mask(const char * mask) +{ + int i; + int len = 0; + uint32 n = inet_addr(mask); + + n = ntohl(n); + + for (i = 0; i < 32; i++) + { + if (n & ((uint32)1 << (31 - i))) + { + len++; + } + else + { + break; + } + } + + return len; +} + +HT_API const char * get_ip_str(uint32 ipaddr /* network byte order */) +{ + struct in_addr addr; + + addr.s_addr = ipaddr; + + return inet_ntoa(addr); +} + +HT_API uint32 get_address_by_name(const char * host_name) +{ + uint32 addr = 0; + + if (is_ip_address(host_name)) + { + addr = inet_addr(host_name); + } + else + { + struct hostent * remoteHost = gethostbyname(host_name); + if (remoteHost) + { + addr = *(unsigned long *)(remoteHost->h_addr); + } + } + + return addr; +} + +HT_API char * lowercase(char * str) +{ + uint32 i; + + for (i = 0; i < strlen(str); ++i) + { + str[i] = tolower(str[i]); + } + + return str; +} + +HT_API char * uppercase(char * str) +{ + uint32 i; + + for (i = 0; i < strlen(str); ++i) + { + str[i] = toupper(str[i]); + } + + return str; +} + + +HT_API int unicode(char ** dst, char * src) +{ + char *ret; + int l, i; + + if (!src) + { + *dst = NULL; + return 0; + } + + l = MIN(64, (int)strlen(src)); + ret = (char *)malloc(2*l); + if (NULL == ret) + { + *dst = NULL; + return 0; + } + + for (i = 0; i < l; ++i) + { + ret[2*i] = src[i]; + ret[2*i+1] = '\0'; + } + + *dst = ret; + + return 2*l; +} + +HT_API BOOL bin_to_hex_str(uint8 * bin, int binlen, char * hex, int hexlen) +{ + uint16 i; + uint8 j; + + if (hexlen <= binlen*2) + { + return FALSE; + } + + for (i = 0; i < binlen; i++) + { + j = (bin[i] >> 4) & 0xf; + + if (j <= 9) + { + hex[i*2] = (j + '0'); + } + else + { + hex[i*2] = (j + 'a' - 10); + } + + j = bin[i] & 0xf; + + if (j <= 9) + { + hex[i*2+1] = (j + '0'); + } + else + { + hex[i*2+1] = (j + 'a' - 10); + } + }; + + hex[binlen*2] = '\0'; + + return TRUE; +}; + +HT_API int hex_str_to_bin(char * hex, int hexlen, uint8 * bin, int binlen) +{ + int i; + + if (binlen < hexlen/2) + { + return 0; + } + + for (i=0; i= '0' && hex[i*2] <= '9') + { + bin[i] = (hex[i*2] - '0') << 4; + } + else if (hex[i*2] >= 'a' && hex[i*2] <= 'z') + { + bin[i] = (hex[i*2] - 'a' + 10) << 4; + } + else if (hex[i*2] >= 'A' && hex[i*2] <= 'Z') + { + bin[i] = (hex[i*2] - 'A' + 10) << 4; + } + else + { + return 0; + } + + if (hex[i*2+1] >= '0' && hex[i*2+1] <= '9') + { + bin[i] |= (hex[i*2+1] - '0'); + } + else if (hex[i*2+1] >= 'a' && hex[i*2+1] <= 'z') + { + bin[i] |= hex[i*2+1] - 'a' + 10; + } + else if (hex[i*2+1] >= 'A' && hex[i*2+1] <= 'Z') + { + bin[i] |= hex[i*2+1] - 'A' + 10; + } + else + { + return 0; + } + } + + return i; +} + +static char hextab[17] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 0}; + +HT_API int url_encode(const char * src, const int srcsize, char * dst, const int dstsize) +{ + int i; + int j; + char ch; + + if ((NULL == src) || (NULL == dst) || (srcsize <= 0) || (dstsize <= 0)) + { + return 0; + } + + for (i = 0, j = 0; i < srcsize && j < dstsize; ++i) + { + ch = src[i]; + + if (((ch >= 'A') && (ch <= 'Z')) || + ((ch >= 'a') && (ch <= 'z')) || + ((ch >= '0') && (ch <= '9')) || + ch == '.' || ch == '-' || ch == '_' || ch == '*') + { + dst[j++] = ch; + } + else if (ch == ' ') + { + dst[j++] = '+'; + } + else + { + if (j+3 < dstsize) + { + dst[j] = '%'; + dst[j+1] = hextab[ch >> 4]; + dst[j+2] = hextab[ch & 15]; + + j+=3; + } + else + { + return 0; + } + } + } + + dst[j] = '\0'; + + return j; +} + +HT_API int url_decode(char * dst, char const * src, uint32 len) +{ + char * p_dst = dst; + const char * p_src = src; + + while (len > 0) + { + int before = 0; + int after = 0; + + if (*p_src == '+') + { + ++p_src; + --len; + *p_dst++ = ' '; + } + else if (*p_src == '%' && len >= 3 && sscanf(p_src+1, "%n%2hhx%n", &before, p_dst, &after) == 1) + { + uint32 size = after - before; // should be 1 or 2 + + ++p_dst; + p_src += (1 + size); + len -= (1 + size); + } + else + { + *p_dst++ = *p_src++; + --len; + } + } + + *p_dst = '\0'; + + return (int)(p_dst - dst); +} + +void url_split(char const* url, char *proto, int proto_size, + char *user, int user_size, + char *pass, int pass_size, + char *host, int host_size, + int *port, char *path, int path_size) +{ + uint32 len; + const char *p, *ls, *ls2, *at, *col, *brk; + + if (port) + *port = -1; + if (proto_size > 0) + proto[0] = 0; + if (user_size > 0) + user[0] = 0; + if (pass_size > 0) + pass[0] = 0; + if (host_size > 0) + host[0] = 0; + if (path_size > 0) + path[0] = 0; + + /* parse protocol */ + if ((p = strchr(url, ':'))) + { + if (proto) + { + len = MIN(proto_size - 1, p - url); + strncpy(proto, url, len); + proto[len] = '\0'; + } + + p++; /* skip ':' */ + if (*p == '/') + p++; + if (*p == '/') + p++; + } + else if (path) + { + /* no protocol means plain filename */ + len = MIN(path_size - 1, (int)strlen(url)); + strncpy(path, url, len); + path[len] = '\0'; + return; + } + + if (NULL == p) + { + return; + } + + /* separate path from hostname */ + ls = strchr(p, '/'); + ls2 = strchr(p, '?'); + if (!ls) + ls = ls2; + else if (ls2) + ls = MIN(ls, ls2); + + if (ls) + { + if (path) + { + len = MIN(path_size - 1, (int)strlen(ls)); + strncpy(path, ls, len); + path[len] = '\0'; + } + } + else + { + ls = &p[strlen(p)]; // XXX + } + + /* the rest is hostname, use that to parse auth/port */ + if (ls != p) + { + /* authorization (user[:pass]@hostname) */ + + while ((at = strchr(p, '@')) && at < ls) + { + if ((brk = strchr(p, ':')) && brk < ls) + { + if (user) + { + url_decode(user, p, MIN(user_size-1, brk - p)); + } + + if (pass) + { + url_decode(pass, brk + 1, MIN(pass_size-1, at - brk - 1)); + } + } + + p = at + 1; /* skip '@' */ + } + + if (*p == '[' && (brk = strchr(p, ']')) && brk < ls) + { + /* [host]:port */ + if (host) + { + len = MIN(host_size - 1, brk - 1 - p); + strncpy(host, p + 1, len); + host[len] = '\0'; + } + + if (brk[1] == ':' && port) + { + *port = atoi(brk + 2); + } + } + else if ((col = strchr(p, ':')) && col < ls) + { + if (host) + { + len = MIN(host_size - 1, col - p); + strncpy(host, p, len); + host[len] = '\0'; + } + + if (port) + { + *port = atoi(col + 1); + } + } + else if (host) + { + len = MIN(host_size - 1, ls - p); + strncpy(host, p, len); + host[len] = '\0'; + } + } +} + +HT_API time_t get_time_by_string(char * p_time_str) +{ + char * ptr_s; + struct tm st; + + memset(&st, 0, sizeof(struct tm)); + + ptr_s = p_time_str; + + while (*ptr_s == ' ' || *ptr_s == '\t') + { + ptr_s++; + } + + sscanf(ptr_s, "%04d-%02d-%02d %02d:%02d:%02d", + &st.tm_year, &st.tm_mon, &st.tm_mday, + &st.tm_hour, &st.tm_min, &st.tm_sec); + + st.tm_year -= 1900; + st.tm_mon -= 1; + + return mktime(&st); +} + +HT_API void get_time_str(char * buff, int len) +{ + time_t nowtime; + struct tm *t1; + + time(&nowtime); + t1 = localtime(&nowtime); + + snprintf(buff, len, "%04d-%02d-%02d %02d:%02d:%02d", + t1->tm_year+1900, t1->tm_mon+1, t1->tm_mday, + t1->tm_hour, t1->tm_min, t1->tm_sec); +} + +HT_API void get_time_str_day_off(time_t nt, char * buff, int len, int dayoff) +{ + struct tm *t1; + time_t nt1 = nt + dayoff * 24 * 3600; + + t1 = localtime(&nt1); + + snprintf(buff, len, "%04d-%02d-%02d %02d:%02d:%02d", + t1->tm_year+1900, t1->tm_mon+1, t1->tm_mday, + t1->tm_hour, t1->tm_min, t1->tm_sec); +} + +HT_API void get_time_str_mon_off(time_t nt, char * buff, int len, int moffset) +{ + struct tm *t1; + int year; + + int day_of_month[12] = {31,28,31,30,31,30,31,31,30,31,30,31}; + + t1 = localtime(&nt); + + t1->tm_mon += moffset; + + t1->tm_year += t1->tm_mon / 12; + t1->tm_mon = t1->tm_mon % 12; + + year = t1->tm_year + 1900; + + if ((year % 400) == 0 || ((year % 100) != 0 && (year % 4) == 0)) + { + day_of_month[1] = 29; + } + + if (t1->tm_mday > day_of_month[t1->tm_mon]) + { + t1->tm_mday = day_of_month[t1->tm_mon]; + } + + snprintf(buff, len, "%04d-%02d-%02d %02d:%02d:%02d", + t1->tm_year+1900, t1->tm_mon+1, t1->tm_mday, + t1->tm_hour, t1->tm_min, t1->tm_sec); +} + +HT_API time_t get_time_by_tstring(const char * p_time_str) +{ + const char * ptr_s; + struct tm st; + + memset(&st, 0, sizeof(struct tm)); + + ptr_s = p_time_str; + + while (*ptr_s == ' ' || *ptr_s == '\t') + { + ptr_s++; + } + + sscanf(ptr_s, "%04d-%02d-%02dT%02d:%02d:%02d", + &st.tm_year, &st.tm_mon, &st.tm_mday, + &st.tm_hour, &st.tm_min, &st.tm_sec); + + st.tm_year -= 1900; + st.tm_mon -= 1; + + return mktime(&st); +} + +HT_API void get_tstring_by_time(time_t t, char * buff, int len) +{ + struct tm *t1; + + t1 = localtime(&t); + + snprintf(buff, len, "%04d-%02d-%02dT%02d:%02d:%02d", + t1->tm_year+1900, t1->tm_mon+1, t1->tm_mday, + t1->tm_hour, t1->tm_min, t1->tm_sec); +} + +HT_API SOCKET tcp_connect(const char * hostname, int port, int timeout) +{ + int ret; + SOCKET fd; + char portstr[10]; + struct timeval tv; + struct addrinfo hints, *ai, *cur_ai; + + hints.ai_family = AF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + + snprintf(portstr, sizeof(portstr), "%d", port); + + ret = getaddrinfo(hostname, portstr, &hints, &ai); + if (ret) + { + log_print(HT_LOG_ERR, "Failed to resolve hostname %s\r\n", hostname); + return -1; + } + + fd = -1; + + for (cur_ai = ai; cur_ai; cur_ai = cur_ai->ai_next) + { + fd = socket(cur_ai->ai_family, cur_ai->ai_socktype, cur_ai->ai_protocol); + if (fd <= 0) + { + continue; + } + + tv.tv_sec = timeout/1000; + tv.tv_usec = (timeout%1000) * 1000; + + setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, (char*)&tv, sizeof(tv)); + + if (connect(fd, cur_ai->ai_addr, (int)(cur_ai->ai_addrlen)) < 0) + { + closesocket(fd); + fd = -1; + + log_print(HT_LOG_ERR, "Connect hostname %s failed\r\n", hostname); + continue; + } + + break; /* okay we got one */ + } + + freeaddrinfo(ai); + + return fd; +} + +HT_API SOCKET tcp_connect_timeout(uint32 rip, int port, int timeout) +{ + SOCKET cfd; + struct sockaddr_in addr; + +#if __LINUX_OS__ + uint32 starttime = sys_os_get_ms(); + struct timeval tv; +#elif __WINDOWS_OS__ + int flag = 0; + unsigned long ul = 1; +#endif + + cfd = socket(AF_INET, SOCK_STREAM, 0); + if (cfd <= 0) + { + log_print(HT_LOG_ERR, "%s, socket failed\n", __FUNCTION__); + return 0; + } + + addr.sin_family = AF_INET; + addr.sin_addr.s_addr = rip; + addr.sin_port = htons((uint16)port); + +#if __LINUX_OS__ + + tv.tv_sec = timeout/1000; + tv.tv_usec = (timeout%1000) * 1000; + + setsockopt(cfd, SOL_SOCKET, SO_SNDTIMEO, (char*)&tv, sizeof(tv)); + + while (connect(cfd, (struct sockaddr *)&addr, sizeof(addr)) == -1 && errno != EISCONN) + { + if (sys_os_get_ms() > starttime + timeout) + { + closesocket(cfd); + return -1; + } + + if (errno != EINTR) + { + closesocket(cfd); + return -1; + } + } + + return cfd; + +#elif __WINDOWS_OS__ + + ioctlsocket(cfd, FIONBIO, &ul); + + if (connect(cfd, (struct sockaddr *)&addr, sizeof(addr)) != 0) + { + fd_set set; + struct timeval tv; + + tv.tv_sec = timeout/1000; + tv.tv_usec = (timeout%1000) * 1000; + + FD_ZERO(&set); + FD_SET(cfd, &set); + + if (select((int)(cfd+1), NULL, &set, NULL, &tv) > 0) + { + int err = 0, len = sizeof(int); + + getsockopt(cfd, SOL_SOCKET, SO_ERROR, (char *)&err, (socklen_t*) &len); + + if (err == 0) + { + flag = 1; + } + } + } + else + { + flag = 1; + } + + ul = 0; + ioctlsocket(cfd, FIONBIO, &ul); + + if (flag == 1) + { + return cfd; + } + else + { + closesocket(cfd); + return 0; + } + +#endif +} +static int callCount = 0; +HT_API void network_init() { + callCount++; + log_print(HT_LOG_INFO, "Number of network_init called: %d,\n", callCount); + + if (callCount == 1) { // Only initialize Winsock on the first call + log_print(HT_LOG_INFO, "Initialise network: %d,\n", callCount); + WSADATA wsaData; + if (WSAStartup(MAKEWORD(2, 2), &wsaData) != 0) { + // Handle initialization failure + log_print(HT_LOG_ERR, "%s, network_init failed\n", __FUNCTION__);//HT_LOG_INFO + } + } +} +// Function to deinitialize network resources (e.g., Winsock) +HT_API void network_deinit() { + if (callCount > 0) { // Ensure network has been initialized before deinitialization + callCount--; + log_print(HT_LOG_INFO, "Number of network_deinit called: %d,\n", callCount); + + if (callCount == 0) { // Deinitialize Winsock if it's the last deinitialization + log_print(HT_LOG_INFO, "Deinitialize network\n"); + if (WSACleanup() != 0) { + // Handle deinitialization failure + log_print(HT_LOG_ERR, "%s, network_deinit failed\n", __FUNCTION__); + } + } + } +} +HT_API int daemon_init() +{ +#if __LINUX_OS__ + + pid_t pid; + + pid = fork(); + + if (pid == -1) + { + return -1; + } + else if (pid > 0) + { + exit(0); + } + + setsid(); + +#endif + + return 0; +} + +#if __WINDOWS_OS__ + +#include + +// used to make sure that static variables in gettimeofday() aren't +// initialized simultaneously by multiple threads +static long g_gettimeofday_lock = 0; + +HT_API int gettimeofday(struct timeval * tp, int * tz) +{ + static LARGE_INTEGER tickFrequency, epochOffset; + + static BOOL isInitialized = FALSE; + + LARGE_INTEGER tickNow; + + QueryPerformanceCounter(&tickNow); + + if (!isInitialized) + { + if (1 == InterlockedIncrement(&g_gettimeofday_lock)) + { + // For our first call, use "ftime()", so that we get a time with a proper epoch. + // For subsequent calls, use "QueryPerformanceCount()", because it's more fine-grain. + struct timeb tb; + ftime(&tb); + + tp->tv_sec = (long)tb.time; + tp->tv_usec = 1000*tb.millitm; + + // Also get our counter frequency: + QueryPerformanceFrequency(&tickFrequency); + + // compute an offset to add to subsequent counter times, so we get a proper epoch: + epochOffset.QuadPart = tp->tv_sec * tickFrequency.QuadPart + (tp->tv_usec * tickFrequency.QuadPart) / 1000000L - tickNow.QuadPart; + + // next caller can use ticks for time calculation + isInitialized = TRUE; + + return 0; + } + else + { + InterlockedDecrement(&g_gettimeofday_lock); + + // wait until first caller has initialized static values + while (!isInitialized) + { + Sleep(1); + } + } + } + + // adjust our tick count so that we get a proper epoch: + tickNow.QuadPart += epochOffset.QuadPart; + + tp->tv_sec = (long)(tickNow.QuadPart / tickFrequency.QuadPart); + tp->tv_usec = (long)(((tickNow.QuadPart % tickFrequency.QuadPart) * 1000000L) / tickFrequency.QuadPart); + + return 0; +} + +#endif + + diff --git a/MediaClient/MediaClient/bm/util.h b/MediaClient/MediaClient/bm/util.h new file mode 100644 index 0000000..3778ef2 --- /dev/null +++ b/MediaClient/MediaClient/bm/util.h @@ -0,0 +1,94 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef __H_UTIL_H__ +#define __H_UTIL_H__ + + +/*************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +/*************************************************************************/ + +#define MIN(a, b) ((a) < (b) ? (a) : (b)) +#define MAX(a, b) ((a) > (b) ? (a) : (b)) + +#define ARRAY_SIZE(ary) (sizeof(ary) / sizeof(ary[0])) + +/*************************************************************************/ +HT_API int get_if_nums(); +HT_API uint32 get_if_ip(int index); +HT_API uint32 get_route_if_ip(uint32 dst_ip); +HT_API uint32 get_default_if_ip(); +HT_API const char * get_local_ip(); +HT_API uint32 get_if_mask(int index); +HT_API uint32 get_route_if_mask(uint32 dst_ip); +HT_API uint32 get_default_if_mask(); +HT_API int is_local_if_net(uint32 destip); +HT_API int get_default_if_mac(uint8 * mac); +HT_API uint32 get_address_by_name(const char * host_name); +HT_API const char * get_default_gateway(); +HT_API const char * get_dns_server(); +HT_API const char * get_mask_by_prefix_len(int len); +HT_API int get_prefix_len_by_mask(const char * mask); +HT_API const char * get_ip_str(uint32 ipaddr /* network byte order */); + + +/*************************************************************************/ +HT_API char * lowercase(char * str); +HT_API char * uppercase(char * str); +HT_API int unicode(char ** dst, char * src); + +HT_API BOOL bin_to_hex_str(uint8 * bin, int binlen, char * hex, int hexlen); +HT_API int hex_str_to_bin(char * hex, int hexlen, uint8 * bin, int binlen); + +HT_API int url_encode(const char * src, const int srcsize, char * dst, const int dstsize); +HT_API int url_decode(char * dst, char const * src, uint32 len); +HT_API void url_split(char const* url, char *proto, int proto_size, char *user, int user_size, char *pass, int pass_size, char *host, int host_size, int *port, char *path, int path_size); + +/*************************************************************************/ +HT_API time_t get_time_by_string(char * p_time_str); +HT_API void get_time_str(char * buff, int len); +HT_API void get_time_str_day_off(time_t nt, char * buff, int len, int dayoff); +HT_API void get_time_str_mon_off(time_t nt, char * buff, int len, int moffset); +HT_API time_t get_time_by_tstring(const char * p_time_str); +HT_API void get_tstring_by_time(time_t t, char * buff, int len); + +HT_API SOCKET tcp_connect_timeout(uint32 rip, int port, int timeout); + +/*************************************************************************/ +HT_API void network_init(); +HT_API void network_deinit(); +HT_API int daemon_init(); + +#if __WINDOWS_OS__ +HT_API int gettimeofday(struct timeval* tp, int* tz); +#endif + +#ifdef __cplusplus +} +#endif + +#endif // __H_UTIL_H__ + + + diff --git a/MediaClient/MediaClient/bm/word_analyse.cpp b/MediaClient/MediaClient/bm/word_analyse.cpp new file mode 100644 index 0000000..393e65f --- /dev/null +++ b/MediaClient/MediaClient/bm/word_analyse.cpp @@ -0,0 +1,566 @@ +/*************************************************************************************** + * + * 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 "word_analyse.h" + +/***************************************************************************************/ +HT_API BOOL is_char(char ch) +{ + if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch == '#') || (ch == '@') || (ch == '/')) + { + return TRUE; + } + + return FALSE; +} + +HT_API BOOL is_num(char ch) +{ + if (ch >= '0' && ch <= '9') + { + return TRUE; + } + + return FALSE; +} + +static char separator[] = {' ','\t','\r','\n',',',':','{','}','(',')','\0','\'','"','?','<','>','=',';'}; + +HT_API BOOL is_separator(char ch) +{ + uint32 i; + + for (i=0; i 15) + { + return FALSE; + } + + for (i=0; i<4; i++) + { + if ((address[index] < '0') || (address[index] > '9')) + { + return FALSE; + } + + if (((address[index +1] < '0') || (address[index +1] > '9')) && (address[index +1] != '.')) + { + if ((address[index +1] == '\0') && (i == 3)) + { + return TRUE; + } + + return FALSE; + } + + if (address[index +1] == '.') + { + index+=2; + continue; + } + + if (((address[index +2] < '0') || (address[index +2] > '9')) && (address[index +2] != '.')) + { + if ((address[index +2] == '\0') && (i == 3)) + { + return TRUE; + } + + return FALSE; + } + + if (address[index +2] == '.') + { + index+=3; + continue; + } + + if (i < 3) + { + if (address[index +3] != '.') + { + return FALSE; + } + } + + byte_value = (address[index] - '0') *100 + (address[index +1] -'0') *10 + (address[index +2] - '0'); + + if (byte_value > 255) + { + return FALSE; + } + + if (i < 3) + { + index += 4; + } + else + { + index += 3; + } + } + + if (index != total_len) + { + return FALSE; + } + + return TRUE; +} + + +HT_API BOOL is_integer(char * p_str) +{ + int i; + int len = (int)strlen(p_str); + + for (i=0; i= buf_len) + { + return bHaveNextWord; + } + + *next_word_offset = cur_word_offset + len; + + if ((*next_word_offset >= line_max_len) || (line[*next_word_offset] == '\0')) + { + bHaveNextWord = FALSE; + } + + switch (w_t) + { + case WORD_TYPE_NULL: + break; + + case WORD_TYPE_STRING: + if (len == 0 && is_separator(*ptr_end)) + { + (*next_word_offset)++; + word_buf[0] = *ptr_end; + word_buf[1] = '\0'; + + return bHaveNextWord; + } + break; + + case WORD_TYPE_NUM: + { + char * ptr; + for (ptr=ptr_start; ptr value_len) + { + len = value_len - 1; + } + + memcpy(value, value_start, len); + value[len] = '\0'; + + return TRUE; + } + else + { + char * ptr = text_buf + next_offset; + + while((*ptr == ' ' || *ptr == '\t') && (next_offset +#endif // #ifndef COM_NO_WINDOWS_H +#include +#include +#include +#include +#include +#ifndef D2D_NO_INCLUDE_D3D10 +#include +#endif // #ifndef D2D_NO_INCLUDE_D3D10 + +#ifndef D2D_USE_C_DEFINITIONS + +// +// We use the 'C' definitions if C++ is not defined +// +#ifndef __cplusplus +#define D2D_USE_C_DEFINITIONS +#endif + +#endif // #ifndef D2D_USE_C_DEFINITIONS + +#ifndef D2D1_DECLARE_INTERFACE +#define D2D1_DECLARE_INTERFACE(X) DECLSPEC_UUID(X) DECLSPEC_NOVTABLE +#endif + +// +// Forward declarations here +// + +typedef interface IDWriteTextFormat IDWriteTextFormat; +typedef interface IDWriteTextLayout IDWriteTextLayout; +typedef interface IDWriteRenderingParams IDWriteRenderingParams; +typedef interface IDXGISurface IDXGISurface; +typedef interface IWICBitmap IWICBitmap; +typedef interface IWICBitmapSource IWICBitmapSource; + +typedef struct DWRITE_GLYPH_RUN DWRITE_GLYPH_RUN; + +#ifndef D2D_USE_C_DEFINITIONS + +interface ID2D1Factory; +interface ID2D1RenderTarget; +interface ID2D1BitmapRenderTarget; +interface ID2D1SimplifiedGeometrySink; +interface ID2D1TessellationSink; +interface ID2D1Geometry; +interface ID2D1Brush; + +#else + +typedef interface ID2D1Factory ID2D1Factory; +typedef interface ID2D1RenderTarget ID2D1RenderTarget; +typedef interface ID2D1BitmapRenderTarget ID2D1BitmapRenderTarget; +typedef interface ID2D1SimplifiedGeometrySink ID2D1SimplifiedGeometrySink;; +typedef interface ID2D1TessellationSink ID2D1TessellationSink; +typedef interface ID2D1Geometry ID2D1Geometry; +typedef interface ID2D1Brush ID2D1Brush; + +#endif + +#define D2D1_INVALID_TAG ULONGLONG_MAX +#define D2D1_DEFAULT_FLATTENING_TOLERANCE (0.25f) + +//+----------------------------------------------------------------------------- +// +// Enum: +// D2D1_ALPHA_MODE +// +// Synopsis: +// Qualifies how alpha is to be treated in a bitmap or render target containing +// alpha. +// +//------------------------------------------------------------------------------ +typedef enum D2D1_ALPHA_MODE +{ + + // + // Alpha mode should be determined implicitly. Some target surfaces do not supply + // or imply this information in which case alpha must be specified. + // + D2D1_ALPHA_MODE_UNKNOWN = 0, + + // + // Treat the alpha as premultipled. + // + D2D1_ALPHA_MODE_PREMULTIPLIED = 1, + + // + // Opacity is in the 'A' component only. + // + D2D1_ALPHA_MODE_STRAIGHT = 2, + + // + // Ignore any alpha channel information. + // + D2D1_ALPHA_MODE_IGNORE = 3, + D2D1_ALPHA_MODE_FORCE_DWORD = 0xffffffff + +} D2D1_ALPHA_MODE; + + +//+----------------------------------------------------------------------------- +// +// Enum: +// D2D1_GAMMA +// +// Synopsis: +// This determines what gamma is used for interpolation/blending. +// +//------------------------------------------------------------------------------ +typedef enum D2D1_GAMMA +{ + + // + // Colors are manipulated in 2.2 gamma color space. + // + D2D1_GAMMA_2_2 = 0, + + // + // Colors are manipulated in 1.0 gamma color space. + // + D2D1_GAMMA_1_0 = 1, + D2D1_GAMMA_FORCE_DWORD = 0xffffffff + +} D2D1_GAMMA; + + +//+----------------------------------------------------------------------------- +// +// Enum: +// D2D1_OPACITY_MASK_CONTENT +// +// Synopsis: +// Specifies what the contents are of an opacity mask. +// +//------------------------------------------------------------------------------ +typedef enum D2D1_OPACITY_MASK_CONTENT +{ + + // + // The mask contains geometries or bitmaps. + // + D2D1_OPACITY_MASK_CONTENT_GRAPHICS = 0, + + // + // The mask contains text rendered using one of the natural text modes. + // + D2D1_OPACITY_MASK_CONTENT_TEXT_NATURAL = 1, + + // + // The mask contains text rendered using one of the GDI compatible text modes. + // + D2D1_OPACITY_MASK_CONTENT_TEXT_GDI_COMPATIBLE = 2, + D2D1_OPACITY_MASK_CONTENT_FORCE_DWORD = 0xffffffff + +} D2D1_OPACITY_MASK_CONTENT; + + +//+----------------------------------------------------------------------------- +// +// Enum: +// D2D1_EXTEND_MODE +// +// Synopsis: +// Enum which descibes how to sample from a source outside it's base tile. +// +//------------------------------------------------------------------------------ +typedef enum D2D1_EXTEND_MODE +{ + + // + // Extend the edges of the source out by clamping sample points outside the source + // to the edges. + // + D2D1_EXTEND_MODE_CLAMP = 0, + + // + // The base tile is drawn untransformed and the remainder are filled by repeating + // the base tile. + // + D2D1_EXTEND_MODE_WRAP = 1, + + // + // The same as wrap, but alternate tiles are flipped The base tile is drawn + // untransformed. + // + D2D1_EXTEND_MODE_MIRROR = 2, + D2D1_EXTEND_MODE_FORCE_DWORD = 0xffffffff + +} D2D1_EXTEND_MODE; + + +//+----------------------------------------------------------------------------- +// +// Enum: +// D2D1_ANTIALIAS_MODE +// +// Synopsis: +// Enum which descibes the manner in which we render edges of non-text primitives. +// +//------------------------------------------------------------------------------ +typedef enum D2D1_ANTIALIAS_MODE +{ + + // + // The edges of each primitive are antialiased sequentially. + // + D2D1_ANTIALIAS_MODE_PER_PRIMITIVE = 0, + + // + // Each pixel is rendered if its pixel center is contained by the geometry. + // + D2D1_ANTIALIAS_MODE_ALIASED = 1, + D2D1_ANTIALIAS_MODE_FORCE_DWORD = 0xffffffff + +} D2D1_ANTIALIAS_MODE; + + +//+----------------------------------------------------------------------------- +// +// Enum: +// D2D1_TEXT_ANTIALIAS_MODE +// +//------------------------------------------------------------------------------ +typedef enum D2D1_TEXT_ANTIALIAS_MODE +{ + + // + // Render text using the current system setting. + // + D2D1_TEXT_ANTIALIAS_MODE_DEFAULT = 0, + + // + // Render text using ClearType. + // + D2D1_TEXT_ANTIALIAS_MODE_CLEARTYPE = 1, + + // + // Render text using gray-scale. + // + D2D1_TEXT_ANTIALIAS_MODE_GRAYSCALE = 2, + + // + // Render text aliased. + // + D2D1_TEXT_ANTIALIAS_MODE_ALIASED = 3, + D2D1_TEXT_ANTIALIAS_MODE_FORCE_DWORD = 0xffffffff + +} D2D1_TEXT_ANTIALIAS_MODE; + + +//+----------------------------------------------------------------------------- +// +// Enum: +// D2D1_BITMAP_INTERPOLATION_MODE +// +//------------------------------------------------------------------------------ +typedef enum D2D1_BITMAP_INTERPOLATION_MODE +{ + + // + // Nearest Neighbor filtering. Also known as nearest pixel or nearest point + // sampling. + // + D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR = 0, + + // + // Linear filtering. + // + D2D1_BITMAP_INTERPOLATION_MODE_LINEAR = 1, + D2D1_BITMAP_INTERPOLATION_MODE_FORCE_DWORD = 0xffffffff + +} D2D1_BITMAP_INTERPOLATION_MODE; + + +//+----------------------------------------------------------------------------- +// +// Flag: +// D2D1_DRAW_TEXT_OPTIONS +// +// Synopsis: +// Modifications made to the draw text call that influence how the text is +// rendered. +// +//------------------------------------------------------------------------------ +typedef enum D2D1_DRAW_TEXT_OPTIONS +{ + + // + // Do not snap the baseline of the text vertically. + // + D2D1_DRAW_TEXT_OPTIONS_NO_SNAP = 0x00000001, + + // + // Clip the text to the content bounds. + // + D2D1_DRAW_TEXT_OPTIONS_CLIP = 0x00000002, + D2D1_DRAW_TEXT_OPTIONS_NONE = 0x00000000, + D2D1_DRAW_TEXT_OPTIONS_FORCE_DWORD = 0xffffffff + +} D2D1_DRAW_TEXT_OPTIONS; + +DEFINE_ENUM_FLAG_OPERATORS(D2D1_DRAW_TEXT_OPTIONS); + + +//+----------------------------------------------------------------------------- +// +// Struct: +// D2D1_PIXEL_FORMAT +// +//------------------------------------------------------------------------------ +typedef struct D2D1_PIXEL_FORMAT +{ + DXGI_FORMAT format; + D2D1_ALPHA_MODE alphaMode; + +} D2D1_PIXEL_FORMAT; + +typedef D2D_POINT_2U D2D1_POINT_2U; +typedef D2D_POINT_2F D2D1_POINT_2F; +typedef D2D_RECT_F D2D1_RECT_F; +typedef D2D_RECT_U D2D1_RECT_U; +typedef D2D_SIZE_F D2D1_SIZE_F; +typedef D2D_SIZE_U D2D1_SIZE_U; +typedef D2D_COLOR_F D2D1_COLOR_F; +typedef D2D_MATRIX_3X2_F D2D1_MATRIX_3X2_F; +typedef UINT64 D2D1_TAG; + +//+----------------------------------------------------------------------------- +// +// Struct: +// D2D1_BITMAP_PROPERTIES +// +//------------------------------------------------------------------------------ +typedef struct D2D1_BITMAP_PROPERTIES +{ + D2D1_PIXEL_FORMAT pixelFormat; + FLOAT dpiX; + FLOAT dpiY; + +} D2D1_BITMAP_PROPERTIES; + + +//+----------------------------------------------------------------------------- +// +// Struct: +// D2D1_GRADIENT_STOP +// +//------------------------------------------------------------------------------ +typedef struct D2D1_GRADIENT_STOP +{ + FLOAT position; + D2D1_COLOR_F color; + +} D2D1_GRADIENT_STOP; + + +//+----------------------------------------------------------------------------- +// +// Struct: +// D2D1_BRUSH_PROPERTIES +// +//------------------------------------------------------------------------------ +typedef struct D2D1_BRUSH_PROPERTIES +{ + FLOAT opacity; + D2D1_MATRIX_3X2_F transform; + +} D2D1_BRUSH_PROPERTIES; + + +//+----------------------------------------------------------------------------- +// +// Struct: +// D2D1_BITMAP_BRUSH_PROPERTIES +// +//------------------------------------------------------------------------------ +typedef struct D2D1_BITMAP_BRUSH_PROPERTIES +{ + D2D1_EXTEND_MODE extendModeX; + D2D1_EXTEND_MODE extendModeY; + D2D1_BITMAP_INTERPOLATION_MODE interpolationMode; + +} D2D1_BITMAP_BRUSH_PROPERTIES; + + +//+----------------------------------------------------------------------------- +// +// Struct: +// D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES +// +//------------------------------------------------------------------------------ +typedef struct D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES +{ + D2D1_POINT_2F startPoint; + D2D1_POINT_2F endPoint; + +} D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES; + + +//+----------------------------------------------------------------------------- +// +// Struct: +// D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES +// +//------------------------------------------------------------------------------ +typedef struct D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES +{ + D2D1_POINT_2F center; + D2D1_POINT_2F gradientOriginOffset; + FLOAT radiusX; + FLOAT radiusY; + +} D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES; + + +//+----------------------------------------------------------------------------- +// +// Enum: +// D2D1_ARC_SIZE +// +// Synopsis: +// Differentiates which of the two possible arcs could match the given arc +// parameters. +// +//------------------------------------------------------------------------------ +typedef enum D2D1_ARC_SIZE +{ + D2D1_ARC_SIZE_SMALL = 0, + D2D1_ARC_SIZE_LARGE = 1, + D2D1_ARC_SIZE_FORCE_DWORD = 0xffffffff + +} D2D1_ARC_SIZE; + + +//+----------------------------------------------------------------------------- +// +// Enum: +// D2D1_CAP_STYLE +// +// Synopsis: +// Enum which descibes the drawing of the ends of a line. +// +//------------------------------------------------------------------------------ +typedef enum D2D1_CAP_STYLE +{ + + // + // Flat line cap. + // + D2D1_CAP_STYLE_FLAT = 0, + + // + // Square line cap. + // + D2D1_CAP_STYLE_SQUARE = 1, + + // + // Round line cap. + // + D2D1_CAP_STYLE_ROUND = 2, + + // + // Triangle line cap. + // + D2D1_CAP_STYLE_TRIANGLE = 3, + D2D1_CAP_STYLE_FORCE_DWORD = 0xffffffff + +} D2D1_CAP_STYLE; + + +//+----------------------------------------------------------------------------- +// +// Enum: +// D2D1_DASH_STYLE +// +//------------------------------------------------------------------------------ +typedef enum D2D1_DASH_STYLE +{ + D2D1_DASH_STYLE_SOLID = 0, + D2D1_DASH_STYLE_DASH = 1, + D2D1_DASH_STYLE_DOT = 2, + D2D1_DASH_STYLE_DASH_DOT = 3, + D2D1_DASH_STYLE_DASH_DOT_DOT = 4, + D2D1_DASH_STYLE_CUSTOM = 5, + D2D1_DASH_STYLE_FORCE_DWORD = 0xffffffff + +} D2D1_DASH_STYLE; + + +//+----------------------------------------------------------------------------- +// +// Enum: +// D2D1_LINE_JOIN +// +// Synopsis: +// Enum which descibes the drawing of the corners on the line. +// +//------------------------------------------------------------------------------ +typedef enum D2D1_LINE_JOIN +{ + + // + // Miter join. + // + D2D1_LINE_JOIN_MITER = 0, + + // + // Bevel join. + // + D2D1_LINE_JOIN_BEVEL = 1, + + // + // Round join. + // + D2D1_LINE_JOIN_ROUND = 2, + + // + // Miter/Bevel join. + // + D2D1_LINE_JOIN_MITER_OR_BEVEL = 3, + D2D1_LINE_JOIN_FORCE_DWORD = 0xffffffff + +} D2D1_LINE_JOIN; + + +//+----------------------------------------------------------------------------- +// +// Enum: +// D2D1_COMBINE_MODE +// +// Synopsis: +// This enumeration describes the type of combine operation to be performed. +// +//------------------------------------------------------------------------------ +typedef enum D2D1_COMBINE_MODE +{ + + // + // Produce a geometry representing the set of points contained in either + // the first or the second geometry. + // + D2D1_COMBINE_MODE_UNION = 0, + + // + // Produce a geometry representing the set of points common to the first + // and the second geometries. + // + D2D1_COMBINE_MODE_INTERSECT = 1, + + // + // Produce a geometry representing the set of points contained in the + // first geometry or the second geometry, but not both. + // + D2D1_COMBINE_MODE_XOR = 2, + + // + // Produce a geometry representing the set of points contained in the + // first geometry but not the second geometry. + // + D2D1_COMBINE_MODE_EXCLUDE = 3, + D2D1_COMBINE_MODE_FORCE_DWORD = 0xffffffff + +} D2D1_COMBINE_MODE; + + +//+----------------------------------------------------------------------------- +// +// Enum: +// D2D1_GEOMETRY_RELATION +// +//------------------------------------------------------------------------------ +typedef enum D2D1_GEOMETRY_RELATION +{ + + // + // The relation between the geometries couldn't be determined. This value is never + // returned by any D2D method. + // + D2D1_GEOMETRY_RELATION_UNKNOWN = 0, + + // + // The two geometries do not intersect at all. + // + D2D1_GEOMETRY_RELATION_DISJOINT = 1, + + // + // The passed in geometry is entirely contained by the object. + // + D2D1_GEOMETRY_RELATION_IS_CONTAINED = 2, + + // + // The object entirely contains the passed in geometry. + // + D2D1_GEOMETRY_RELATION_CONTAINS = 3, + + // + // The two geometries overlap but neither completely contains the other. + // + D2D1_GEOMETRY_RELATION_OVERLAP = 4, + D2D1_GEOMETRY_RELATION_FORCE_DWORD = 0xffffffff + +} D2D1_GEOMETRY_RELATION; + + +//+----------------------------------------------------------------------------- +// +// Enum: +// D2D1_GEOMETRY_SIMPLIFICATION_OPTION +// +// Synopsis: +// Specifies how simple the output of a simplified geometry sink should be. +// +//------------------------------------------------------------------------------ +typedef enum D2D1_GEOMETRY_SIMPLIFICATION_OPTION +{ + D2D1_GEOMETRY_SIMPLIFICATION_OPTION_CUBICS_AND_LINES = 0, + D2D1_GEOMETRY_SIMPLIFICATION_OPTION_LINES = 1, + D2D1_GEOMETRY_SIMPLIFICATION_OPTION_FORCE_DWORD = 0xffffffff + +} D2D1_GEOMETRY_SIMPLIFICATION_OPTION; + + +//+----------------------------------------------------------------------------- +// +// Enum: +// D2D1_FIGURE_BEGIN +// +// Synopsis: +// Indicates whether the given figure is filled or hollow. +// +//------------------------------------------------------------------------------ +typedef enum D2D1_FIGURE_BEGIN +{ + D2D1_FIGURE_BEGIN_FILLED = 0, + D2D1_FIGURE_BEGIN_HOLLOW = 1, + D2D1_FIGURE_BEGIN_FORCE_DWORD = 0xffffffff + +} D2D1_FIGURE_BEGIN; + + +//+----------------------------------------------------------------------------- +// +// Enum: +// D2D1_FIGURE_END +// +// Synopsis: +// Indicates whether the figure ir open or closed on its end point. +// +//------------------------------------------------------------------------------ +typedef enum D2D1_FIGURE_END +{ + D2D1_FIGURE_END_OPEN = 0, + D2D1_FIGURE_END_CLOSED = 1, + D2D1_FIGURE_END_FORCE_DWORD = 0xffffffff + +} D2D1_FIGURE_END; + + +//+----------------------------------------------------------------------------- +// +// Struct: +// D2D1_BEZIER_SEGMENT +// +// Synopsis: +// Describes a cubic bezier in a path. +// +//------------------------------------------------------------------------------ +typedef struct D2D1_BEZIER_SEGMENT +{ + D2D1_POINT_2F point1; + D2D1_POINT_2F point2; + D2D1_POINT_2F point3; + +} D2D1_BEZIER_SEGMENT; + + +//+----------------------------------------------------------------------------- +// +// Struct: +// D2D1_TRIANGLE +// +// Synopsis: +// Describes a triangle. +// +//------------------------------------------------------------------------------ +typedef struct D2D1_TRIANGLE +{ + D2D1_POINT_2F point1; + D2D1_POINT_2F point2; + D2D1_POINT_2F point3; + +} D2D1_TRIANGLE; + + +//+----------------------------------------------------------------------------- +// +// Flag: +// D2D1_PATH_SEGMENT +// +// Synopsis: +// Indicates whether the given segment should be stroked, or, if the join between +// this segment and the previous one should be smooth. +// +//------------------------------------------------------------------------------ +typedef enum D2D1_PATH_SEGMENT +{ + D2D1_PATH_SEGMENT_NONE = 0x00000000, + D2D1_PATH_SEGMENT_FORCE_UNSTROKED = 0x00000001, + D2D1_PATH_SEGMENT_FORCE_ROUND_LINE_JOIN = 0x00000002, + D2D1_PATH_SEGMENT_FORCE_DWORD = 0xffffffff + +} D2D1_PATH_SEGMENT; + +DEFINE_ENUM_FLAG_OPERATORS(D2D1_PATH_SEGMENT); + + +//+----------------------------------------------------------------------------- +// +// Enum: +// D2D1_SWEEP_DIRECTION +// +//------------------------------------------------------------------------------ +typedef enum D2D1_SWEEP_DIRECTION +{ + D2D1_SWEEP_DIRECTION_COUNTER_CLOCKWISE = 0, + D2D1_SWEEP_DIRECTION_CLOCKWISE = 1, + D2D1_SWEEP_DIRECTION_FORCE_DWORD = 0xffffffff + +} D2D1_SWEEP_DIRECTION; + + +//+----------------------------------------------------------------------------- +// +// Enum: +// D2D1_FILL_MODE +// +//------------------------------------------------------------------------------ +typedef enum D2D1_FILL_MODE +{ + D2D1_FILL_MODE_ALTERNATE = 0, + D2D1_FILL_MODE_WINDING = 1, + D2D1_FILL_MODE_FORCE_DWORD = 0xffffffff + +} D2D1_FILL_MODE; + + +//+----------------------------------------------------------------------------- +// +// Struct: +// D2D1_ARC_SEGMENT +// +// Synopsis: +// Describes an arc that is defined as part of a path. +// +//------------------------------------------------------------------------------ +typedef struct D2D1_ARC_SEGMENT +{ + D2D1_POINT_2F point; + D2D1_SIZE_F size; + FLOAT rotationAngle; + D2D1_SWEEP_DIRECTION sweepDirection; + D2D1_ARC_SIZE arcSize; + +} D2D1_ARC_SEGMENT; + + +//+----------------------------------------------------------------------------- +// +// Struct: +// D2D1_QUADRATIC_BEZIER_SEGMENT +// +//------------------------------------------------------------------------------ +typedef struct D2D1_QUADRATIC_BEZIER_SEGMENT +{ + D2D1_POINT_2F point1; + D2D1_POINT_2F point2; + +} D2D1_QUADRATIC_BEZIER_SEGMENT; + + +//+----------------------------------------------------------------------------- +// +// Struct: +// D2D1_ELLIPSE +// +//------------------------------------------------------------------------------ +typedef struct D2D1_ELLIPSE +{ + D2D1_POINT_2F point; + FLOAT radiusX; + FLOAT radiusY; + +} D2D1_ELLIPSE; + + +//+----------------------------------------------------------------------------- +// +// Struct: +// D2D1_ROUNDED_RECT +// +//------------------------------------------------------------------------------ +typedef struct D2D1_ROUNDED_RECT +{ + D2D1_RECT_F rect; + FLOAT radiusX; + FLOAT radiusY; + +} D2D1_ROUNDED_RECT; + + +//+----------------------------------------------------------------------------- +// +// Struct: +// D2D1_STROKE_STYLE_PROPERTIES +// +// Synopsis: +// Properties, aside from the width, that allow geometric penning to be specified. +// +//------------------------------------------------------------------------------ +typedef struct D2D1_STROKE_STYLE_PROPERTIES +{ + D2D1_CAP_STYLE startCap; + D2D1_CAP_STYLE endCap; + D2D1_CAP_STYLE dashCap; + D2D1_LINE_JOIN lineJoin; + FLOAT miterLimit; + D2D1_DASH_STYLE dashStyle; + FLOAT dashOffset; + +} D2D1_STROKE_STYLE_PROPERTIES; + + +//+----------------------------------------------------------------------------- +// +// Flag: +// D2D1_LAYER_OPTIONS +// +// Synopsis: +// Specified options that can be applied when a layer resource is applied to create +// a layer. +// +//------------------------------------------------------------------------------ +typedef enum D2D1_LAYER_OPTIONS +{ + D2D1_LAYER_OPTIONS_NONE = 0x00000000, + + // + // The layer will render correctly for ClearType text. If the render target was set + // to ClearType previously, the layer will continue to render ClearType. If the + // render target was set to ClearType and this option is not specified, the render + // target will be set to render gray-scale until the layer is popped. The caller + // can override this default by calling SetTextAntialiasMode while within the + // layer. This flag is slightly slower than the default. + // + D2D1_LAYER_OPTIONS_INITIALIZE_FOR_CLEARTYPE = 0x00000001, + D2D1_LAYER_OPTIONS_FORCE_DWORD = 0xffffffff + +} D2D1_LAYER_OPTIONS; + +DEFINE_ENUM_FLAG_OPERATORS(D2D1_LAYER_OPTIONS); + + +//+----------------------------------------------------------------------------- +// +// Struct: +// D2D1_LAYER_PARAMETERS +// +//------------------------------------------------------------------------------ +typedef struct D2D1_LAYER_PARAMETERS +{ + + // + // The rectangular clip that will be applied to the layer. The clip is affected by + // the world transform. Content outside of the content bounds will not render. + // + D2D1_RECT_F contentBounds; + + // + // A general mask that can be optionally applied to the content. Content not inside + // the fill of the mask will not be rendered. + // + __field_ecount_opt(1) ID2D1Geometry *geometricMask; + + // + // Specifies whether the mask should be aliased or antialiased. + // + D2D1_ANTIALIAS_MODE maskAntialiasMode; + + // + // An additional transform that may be applied to the mask in addition to the + // current world transform. + // + D2D1_MATRIX_3X2_F maskTransform; + + // + // The opacity with which all of the content in the layer will be blended back to + // the target when the layer is popped. + // + FLOAT opacity; + + // + // An additional brush that can be applied to the layer. Only the opacity channel + // is sampled from this brush and multiplied both with the layer content and the + // over-all layer opacity. + // + __field_ecount_opt(1) ID2D1Brush *opacityBrush; + + // + // Specifies if ClearType will be rendered into the layer. + // + D2D1_LAYER_OPTIONS layerOptions; + +} D2D1_LAYER_PARAMETERS; + + +//+----------------------------------------------------------------------------- +// +// Flag: +// D2D1_WINDOW_STATE +// +//------------------------------------------------------------------------------ +typedef enum D2D1_WINDOW_STATE +{ + D2D1_WINDOW_STATE_NONE = 0x0000000, + D2D1_WINDOW_STATE_OCCLUDED = 0x0000001, + D2D1_WINDOW_STATE_FORCE_DWORD = 0xffffffff + +} D2D1_WINDOW_STATE; + +DEFINE_ENUM_FLAG_OPERATORS(D2D1_WINDOW_STATE); + + +//+----------------------------------------------------------------------------- +// +// Enum: +// D2D1_RENDER_TARGET_TYPE +// +//------------------------------------------------------------------------------ +typedef enum D2D1_RENDER_TARGET_TYPE +{ + + // + // D2D is free to choose the render target type for the caller. + // + D2D1_RENDER_TARGET_TYPE_DEFAULT = 0, + + // + // The render target will render using the CPU. + // + D2D1_RENDER_TARGET_TYPE_SOFTWARE = 1, + + // + // The render target will render using the GPU. + // + D2D1_RENDER_TARGET_TYPE_HARDWARE = 2, + D2D1_RENDER_TARGET_TYPE_FORCE_DWORD = 0xffffffff + +} D2D1_RENDER_TARGET_TYPE; + + +//+----------------------------------------------------------------------------- +// +// Enum: +// D2D1_FEATURE_LEVEL +// +//------------------------------------------------------------------------------ +typedef enum D2D1_FEATURE_LEVEL +{ + + // + // The caller does not require a particular underlying D3D device level. + // + D2D1_FEATURE_LEVEL_DEFAULT = 0, + + // + // The D3D device level is DX9 compatible. + // + D2D1_FEATURE_LEVEL_9 = D3D10_FEATURE_LEVEL_9_1, + + // + // The D3D device level is DX10 compatible. + // + D2D1_FEATURE_LEVEL_10 = D3D10_FEATURE_LEVEL_10_0, + D2D1_FEATURE_LEVEL_FORCE_DWORD = 0xffffffff + +} D2D1_FEATURE_LEVEL; + + +//+----------------------------------------------------------------------------- +// +// Flag: +// D2D1_RENDER_TARGET_USAGE +// +//------------------------------------------------------------------------------ +typedef enum D2D1_RENDER_TARGET_USAGE +{ + D2D1_RENDER_TARGET_USAGE_NONE = 0x00000000, + + // + // Rendering will occur locally, if a terminal-services session is established, the + // bitmap updates will be sent to the terminal services client. + // + D2D1_RENDER_TARGET_USAGE_FORCE_BITMAP_REMOTING = 0x00000001, + + // + // The render target will allow a call to GetDC on the IGdiInteropRenderTarget + // interface. Rendering will also occur locally. + // + D2D1_RENDER_TARGET_USAGE_GDI_COMPATIBLE = 0x00000002, + D2D1_RENDER_TARGET_USAGE_FORCE_DWORD = 0xffffffff + +} D2D1_RENDER_TARGET_USAGE; + +DEFINE_ENUM_FLAG_OPERATORS(D2D1_RENDER_TARGET_USAGE); + + +//+----------------------------------------------------------------------------- +// +// Flag: +// D2D1_PRESENT_OPTIONS +// +// Synopsis: +// Describes how present should behave. +// +//------------------------------------------------------------------------------ +typedef enum D2D1_PRESENT_OPTIONS +{ + D2D1_PRESENT_OPTIONS_NONE = 0x00000000, + + // + // Keep the target contents intact through present. + // + D2D1_PRESENT_OPTIONS_RETAIN_CONTENTS = 0x00000001, + + // + // Do not wait for display refresh to commit changes to display. + // + D2D1_PRESENT_OPTIONS_IMMEDIATELY = 0x00000002, + D2D1_PRESENT_OPTIONS_FORCE_DWORD = 0xffffffff + +} D2D1_PRESENT_OPTIONS; + +DEFINE_ENUM_FLAG_OPERATORS(D2D1_PRESENT_OPTIONS); + + +//+----------------------------------------------------------------------------- +// +// Struct: +// D2D1_RENDER_TARGET_PROPERTIES +// +//------------------------------------------------------------------------------ +typedef struct D2D1_RENDER_TARGET_PROPERTIES +{ + D2D1_RENDER_TARGET_TYPE type; + D2D1_PIXEL_FORMAT pixelFormat; + FLOAT dpiX; + FLOAT dpiY; + D2D1_RENDER_TARGET_USAGE usage; + D2D1_FEATURE_LEVEL minLevel; + +} D2D1_RENDER_TARGET_PROPERTIES; + + +//+----------------------------------------------------------------------------- +// +// Struct: +// D2D1_HWND_RENDER_TARGET_PROPERTIES +// +//------------------------------------------------------------------------------ +typedef struct D2D1_HWND_RENDER_TARGET_PROPERTIES +{ + HWND hwnd; + D2D1_SIZE_U pixelSize; + D2D1_PRESENT_OPTIONS presentOptions; + +} D2D1_HWND_RENDER_TARGET_PROPERTIES; + + +//+----------------------------------------------------------------------------- +// +// Flag: +// D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS +// +//------------------------------------------------------------------------------ +typedef enum D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS +{ + D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_NONE = 0x00000000, + + // + // The compatible render target will allow a call to GetDC on the + // IGdiInteropRenderTarget interface. This can be specified even if the parent + // render target is not GDI compatible. + // + D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_GDI_COMPATIBLE = 0x00000001, + D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_FORCE_DWORD = 0xffffffff + +} D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS; + +DEFINE_ENUM_FLAG_OPERATORS(D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS); + + +//+----------------------------------------------------------------------------- +// +// Struct: +// D2D1_DRAWING_STATE_DESCRIPTION +// +// Synopsis: +// Allows the drawing state to be atomically created. This also specifies the +// drawing state that is saved into an IDrawingStateBlock object. +// +//------------------------------------------------------------------------------ +typedef struct D2D1_DRAWING_STATE_DESCRIPTION +{ + D2D1_ANTIALIAS_MODE antialiasMode; + D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode; + D2D1_TAG tag1; + D2D1_TAG tag2; + D2D1_MATRIX_3X2_F transform; + +} D2D1_DRAWING_STATE_DESCRIPTION; + + +//+----------------------------------------------------------------------------- +// +// Enum: +// D2D1_DC_INITIALIZE_MODE +// +//------------------------------------------------------------------------------ +typedef enum D2D1_DC_INITIALIZE_MODE +{ + + // + // The contents of the D2D render target will be copied to the DC. + // + D2D1_DC_INITIALIZE_MODE_COPY = 0, + + // + // The contents of the DC will be cleared. + // + D2D1_DC_INITIALIZE_MODE_CLEAR = 1, + D2D1_DC_INITIALIZE_MODE_FORCE_DWORD = 0xffffffff + +} D2D1_DC_INITIALIZE_MODE; + + +//+----------------------------------------------------------------------------- +// +// Enum: +// D2D1_DEBUG_LEVEL +// +// Synopsis: +// Indicates the debug level to be outputed by the debug layer. +// +//------------------------------------------------------------------------------ +typedef enum D2D1_DEBUG_LEVEL +{ + D2D1_DEBUG_LEVEL_NONE = 0, + D2D1_DEBUG_LEVEL_ERROR = 1, + D2D1_DEBUG_LEVEL_WARNING = 2, + D2D1_DEBUG_LEVEL_INFORMATION = 3, + D2D1_DEBUG_LEVEL_FORCE_DWORD = 0xffffffff + +} D2D1_DEBUG_LEVEL; + + +//+----------------------------------------------------------------------------- +// +// Enum: +// D2D1_FACTORY_TYPE +// +// Synopsis: +// Specifies the threading model of the created factory and all of its derived +// resources. +// +//------------------------------------------------------------------------------ +typedef enum D2D1_FACTORY_TYPE +{ + + // + // The resulting factory and derived resources may only be invoked serially. + // Reference counts on resources are interlocked, however, resource and render + // target state is not protected from multi-threaded access. + // + D2D1_FACTORY_TYPE_SINGLE_THREADED = 0, + + // + // The resulting factory may be invoked from multiple threads. Returned resources + // use interlocked reference counting and their state is protected. + // + D2D1_FACTORY_TYPE_MULTI_THREADED = 1, + D2D1_FACTORY_TYPE_FORCE_DWORD = 0xffffffff + +} D2D1_FACTORY_TYPE; + + +//+----------------------------------------------------------------------------- +// +// Struct: +// D2D1_FACTORY_OPTIONS +// +// Synopsis: +// Allows additional parameters for factory creation. +// +//------------------------------------------------------------------------------ +typedef struct D2D1_FACTORY_OPTIONS +{ + + // + // Requests a certain level of debugging information from the debug layer. This + // parameter is ignored if the debug layer DLL is not present. + // + D2D1_DEBUG_LEVEL debugLevel; + +} D2D1_FACTORY_OPTIONS; + + +#ifndef D2D_USE_C_DEFINITIONS + + + +//+----------------------------------------------------------------------------- +// +// Interface: +// ID2D1Resource +// +// Synopsis: +// The root interface for all resources in D2D. +// +//------------------------------------------------------------------------------ +interface D2D1_DECLARE_INTERFACE("2cd90691-12e2-11dc-9fed-001143a055f9") ID2D1Resource : public IUnknown +{ + + + // + // Retrieve the factory associated with this resource. + // + STDMETHOD_(void, GetFactory)( + __deref_out ID2D1Factory **factory + ) CONST PURE; +}; // interface ID2D1Resource + + + +//+----------------------------------------------------------------------------- +// +// Interface: +// ID2D1Bitmap +// +// Synopsis: +// Root bitmap resource, linearly scaled on a draw call. +// +//------------------------------------------------------------------------------ +interface D2D1_DECLARE_INTERFACE("a2296057-ea42-4099-983b-539fb6505426") ID2D1Bitmap : public ID2D1Resource +{ + + + // + // Returns the size of the bitmap in resolution independent units. + // + STDMETHOD_(D2D1_SIZE_F, GetSize)( + ) CONST PURE; + + + // + // Returns the size of the bitmap in resolution dependent units, (pixels). + // + STDMETHOD_(D2D1_SIZE_U, GetPixelSize)( + ) CONST PURE; + + + // + // Retrieve the format of the bitmap. + // + STDMETHOD_(D2D1_PIXEL_FORMAT, GetPixelFormat)( + ) CONST PURE; + + + // + // Return the DPI of the bitmap. + // + STDMETHOD_(void, GetDpi)( + __out FLOAT *dpiX, + __out FLOAT *dpiY + ) CONST PURE; + + STDMETHOD(CopyFromBitmap)( + __in_opt CONST D2D1_POINT_2U *destPoint, + __in ID2D1Bitmap *bitmap, + __in_opt CONST D2D1_RECT_U *srcRect + ) PURE; + + STDMETHOD(CopyFromRenderTarget)( + __in_opt CONST D2D1_POINT_2U *destPoint, + __in ID2D1RenderTarget *renderTarget, + __in_opt CONST D2D1_RECT_U *srcRect + ) PURE; + + STDMETHOD(CopyFromMemory)( + __in_opt CONST D2D1_RECT_U *dstRect, + __in CONST void *srcData, + UINT32 pitch + ) PURE; +}; // interface ID2D1Bitmap + + + +//+----------------------------------------------------------------------------- +// +// Interface: +// ID2D1GradientStopCollection +// +// Synopsis: +// Represents an collection of gradient stops that can then be the source resource +// for either a linear or radial gradient brush. +// +//------------------------------------------------------------------------------ +interface D2D1_DECLARE_INTERFACE("2cd906a7-12e2-11dc-9fed-001143a055f9") ID2D1GradientStopCollection : public ID2D1Resource +{ + + + // + // Returns the number of stops in the gradient. + // + STDMETHOD_(UINT32, GetGradientStopCount)( + ) CONST PURE; + + + // + // Copies the gradient stops from the collection into the caller's interface. + // + STDMETHOD_(void, GetGradientStops)( + __out_ecount(gradientStopsCount) D2D1_GRADIENT_STOP *gradientStops, + UINT gradientStopsCount + ) CONST PURE; + + + // + // Returns whether the interpolation occurs with 1.0 or 2.2 gamma. + // + STDMETHOD_(D2D1_GAMMA, GetColorInterpolationGamma)( + ) CONST PURE; + + STDMETHOD_(D2D1_EXTEND_MODE, GetExtendMode)( + ) CONST PURE; +}; // interface ID2D1GradientStopCollection + + + +//+----------------------------------------------------------------------------- +// +// Interface: +// ID2D1Brush +// +// Synopsis: +// The root brush interface. All brushes can be used to fill or pen a geometry. +// +//------------------------------------------------------------------------------ +interface D2D1_DECLARE_INTERFACE("2cd906a8-12e2-11dc-9fed-001143a055f9") ID2D1Brush : public ID2D1Resource +{ + + + // + // Sets the opacity for when the brush is drawn over the entire fill of the brush. + // + STDMETHOD_(void, SetOpacity)( + FLOAT opacity + ) PURE; + + + // + // Sets the transform that applies to everything drawn by the brush. + // + STDMETHOD_(void, SetTransform)( + __in CONST D2D1_MATRIX_3X2_F *transform + ) PURE; + + STDMETHOD_(FLOAT, GetOpacity)( + ) CONST PURE; + + STDMETHOD_(void, GetTransform)( + __out D2D1_MATRIX_3X2_F *transform + ) CONST PURE; + + void + SetTransform( + CONST D2D1_MATRIX_3X2_F &transform + ) + { + SetTransform(&transform); + } +}; // interface ID2D1Brush + + + +//+----------------------------------------------------------------------------- +// +// Interface: +// ID2D1BitmapBrush +// +// Synopsis: +// A bitmap brush allows a bitmap to be used to fill a geometry. +// +//------------------------------------------------------------------------------ +interface D2D1_DECLARE_INTERFACE("2cd906aa-12e2-11dc-9fed-001143a055f9") ID2D1BitmapBrush : public ID2D1Brush +{ + + + // + // Sets how the bitmap is to be treated outside of its natural extent on the X + // axis. + // + STDMETHOD_(void, SetExtendModeX)( + D2D1_EXTEND_MODE extendModeX + ) PURE; + + + // + // Sets how the bitmap is to be treated outside of its natural extent on the X + // axis. + // + STDMETHOD_(void, SetExtendModeY)( + D2D1_EXTEND_MODE extendModeY + ) PURE; + + + // + // Sets the interpolation mode used when this brush is used. + // + STDMETHOD_(void, SetInterpolationMode)( + D2D1_BITMAP_INTERPOLATION_MODE interpolationMode + ) PURE; + + + // + // Sets the bitmap associated as the source of this brush. + // + STDMETHOD_(void, SetBitmap)( + __in ID2D1Bitmap *bitmap + ) PURE; + + STDMETHOD_(D2D1_EXTEND_MODE, GetExtendModeX)( + ) CONST PURE; + + STDMETHOD_(D2D1_EXTEND_MODE, GetExtendModeY)( + ) CONST PURE; + + STDMETHOD_(D2D1_BITMAP_INTERPOLATION_MODE, GetInterpolationMode)( + ) CONST PURE; + + STDMETHOD_(void, GetBitmap)( + __deref_out ID2D1Bitmap **bitmap + ) CONST PURE; +}; // interface ID2D1BitmapBrush + + + +//+----------------------------------------------------------------------------- +// +// Interface: +// ID2D1SolidColorBrush +// +//------------------------------------------------------------------------------ +interface D2D1_DECLARE_INTERFACE("2cd906a9-12e2-11dc-9fed-001143a055f9") ID2D1SolidColorBrush : public ID2D1Brush +{ + + STDMETHOD_(void, SetColor)( + __in CONST D2D1_COLOR_F *color + ) PURE; + + STDMETHOD_(D2D1_COLOR_F, GetColor)( + ) CONST PURE; + + void + SetColor( + CONST D2D1_COLOR_F &color + ) + { + SetColor(&color); + } +}; // interface ID2D1SolidColorBrush + + + +//+----------------------------------------------------------------------------- +// +// Interface: +// ID2D1LinearGradientBrush +// +//------------------------------------------------------------------------------ +interface D2D1_DECLARE_INTERFACE("2cd906ab-12e2-11dc-9fed-001143a055f9") ID2D1LinearGradientBrush : public ID2D1Brush +{ + + STDMETHOD_(void, SetStartPoint)( + D2D1_POINT_2F startPoint + ) PURE; + + + // + // Sets the end point of the gradient in local coordinate space. This is not + // influenced by the geometry being filled. + // + STDMETHOD_(void, SetEndPoint)( + D2D1_POINT_2F endPoint + ) PURE; + + STDMETHOD_(D2D1_POINT_2F, GetStartPoint)( + ) CONST PURE; + + STDMETHOD_(D2D1_POINT_2F, GetEndPoint)( + ) CONST PURE; + + STDMETHOD_(void, GetGradientStopCollection)( + __deref_out ID2D1GradientStopCollection **gradientStopCollection + ) CONST PURE; +}; // interface ID2D1LinearGradientBrush + + + +//+----------------------------------------------------------------------------- +// +// Interface: +// ID2D1RadialGradientBrush +// +//------------------------------------------------------------------------------ +interface D2D1_DECLARE_INTERFACE("2cd906ac-12e2-11dc-9fed-001143a055f9") ID2D1RadialGradientBrush : public ID2D1Brush +{ + + + // + // Sets the center of the radial gradient. This will be in local coordinates and + // will not depend on the geometry being filled. + // + STDMETHOD_(void, SetCenter)( + D2D1_POINT_2F center + ) PURE; + + + // + // Sets offset of the origin relative to the radial gradient center. + // + STDMETHOD_(void, SetGradientOriginOffset)( + D2D1_POINT_2F gradientOriginOffset + ) PURE; + + STDMETHOD_(void, SetRadiusX)( + FLOAT radiusX + ) PURE; + + STDMETHOD_(void, SetRadiusY)( + FLOAT radiusY + ) PURE; + + STDMETHOD_(D2D1_POINT_2F, GetCenter)( + ) CONST PURE; + + STDMETHOD_(D2D1_POINT_2F, GetGradientOriginOffset)( + ) CONST PURE; + + STDMETHOD_(FLOAT, GetRadiusX)( + ) CONST PURE; + + STDMETHOD_(FLOAT, GetRadiusY)( + ) CONST PURE; + + STDMETHOD_(void, GetGradientStopCollection)( + __deref_out ID2D1GradientStopCollection **gradientStopCollection + ) CONST PURE; +}; // interface ID2D1RadialGradientBrush + + + +//+----------------------------------------------------------------------------- +// +// Interface: +// ID2D1StrokeStyle +// +// Synopsis: +// Resource interface that holds pen style properties. +// +//------------------------------------------------------------------------------ +interface D2D1_DECLARE_INTERFACE("2cd9069d-12e2-11dc-9fed-001143a055f9") ID2D1StrokeStyle : public ID2D1Resource +{ + + STDMETHOD_(D2D1_CAP_STYLE, GetStartCap)( + ) CONST PURE; + + STDMETHOD_(D2D1_CAP_STYLE, GetEndCap)( + ) CONST PURE; + + STDMETHOD_(D2D1_CAP_STYLE, GetDashCap)( + ) CONST PURE; + + STDMETHOD_(FLOAT, GetMiterLimit)( + ) CONST PURE; + + STDMETHOD_(D2D1_LINE_JOIN, GetLineJoin)( + ) CONST PURE; + + STDMETHOD_(FLOAT, GetDashOffset)( + ) CONST PURE; + + STDMETHOD_(D2D1_DASH_STYLE, GetDashStyle)( + ) CONST PURE; + + STDMETHOD_(UINT32, GetDashesCount)( + ) CONST PURE; + + + // + // Returns the dashes from the object into a user allocated array. The user must + // call GetDashesCount to retrieve the required size. + // + STDMETHOD_(void, GetDashes)( + __out_ecount(dashesCount) FLOAT *dashes, + UINT dashesCount + ) CONST PURE; +}; // interface ID2D1StrokeStyle + + + +//+----------------------------------------------------------------------------- +// +// Interface: +// ID2D1Geometry +// +//------------------------------------------------------------------------------ +interface D2D1_DECLARE_INTERFACE("2cd906a1-12e2-11dc-9fed-001143a055f9") ID2D1Geometry : public ID2D1Resource +{ + + + // + // Retrieve the bounds of the geometry, with an optional applied transform. + // + STDMETHOD(GetBounds)( + __in_opt CONST D2D1_MATRIX_3X2_F *worldTransform, + __out D2D1_RECT_F *bounds + ) CONST PURE; + + + // + // Get the bounds of the corresponding geometry after it has been widened or have + // an optional pen style applied. + // + STDMETHOD(GetWidenedBounds)( + FLOAT strokeWidth, + __in_opt ID2D1StrokeStyle *strokeStyle, + __in_opt CONST D2D1_MATRIX_3X2_F *worldTransform, + FLOAT flatteningTolerance, + __out D2D1_RECT_F *bounds + ) CONST PURE; + + + // + // Checks to see whether the corresponding penned and widened geometry contains the + // given point. + // + STDMETHOD(StrokeContainsPoint)( + D2D1_POINT_2F point, + FLOAT strokeWidth, + __in_opt ID2D1StrokeStyle *strokeStyle, + __in_opt CONST D2D1_MATRIX_3X2_F *worldTransform, + FLOAT flatteningTolerance, + __out BOOL *contains + ) CONST PURE; + + + // + // Test whether the given fill of this geometry would contain this point. + // + STDMETHOD(FillContainsPoint)( + D2D1_POINT_2F point, + __in_opt CONST D2D1_MATRIX_3X2_F *worldTransform, + FLOAT flatteningTolerance, + __out BOOL *contains + ) CONST PURE; + + + // + // Compare how one geometry intersects or contains another geometry. + // + STDMETHOD(CompareWithGeometry)( + __in ID2D1Geometry *inputGeometry, + __in_opt CONST D2D1_MATRIX_3X2_F *inputGeometryTransform, + FLOAT flatteningTolerance, + __out D2D1_GEOMETRY_RELATION *relation + ) CONST PURE; + + + // + // Converts a geometry to a simplified geometry that has arcs and quadratic beziers + // removed. + // + STDMETHOD(Simplify)( + D2D1_GEOMETRY_SIMPLIFICATION_OPTION simplificationOption, + __in_opt CONST D2D1_MATRIX_3X2_F *worldTransform, + FLOAT flatteningTolerance, + __in ID2D1SimplifiedGeometrySink *geometrySink + ) CONST PURE; + + + // + // Tessellates a geometry into triangles. + // + STDMETHOD(Tessellate)( + __in_opt CONST D2D1_MATRIX_3X2_F *worldTransform, + FLOAT flatteningTolerance, + __in ID2D1TessellationSink *tessellationSink + ) CONST PURE; + + + // + // Performs a combine operation between the two geometries to produce a resulting + // geometry. + // + STDMETHOD(CombineWithGeometry)( + __in ID2D1Geometry *inputGeometry, + D2D1_COMBINE_MODE combineMode, + __in_opt CONST D2D1_MATRIX_3X2_F *inputGeometryTransform, + FLOAT flatteningTolerance, + __in ID2D1SimplifiedGeometrySink *geometrySink + ) CONST PURE; + + + // + // Computes the outline of the geometry. The result is written back into a + // simplified geometry sink. + // + STDMETHOD(Outline)( + __in_opt CONST D2D1_MATRIX_3X2_F *worldTransform, + FLOAT flatteningTolerance, + __in ID2D1SimplifiedGeometrySink *geometrySink + ) CONST PURE; + + + // + // Computes the area of the geometry. + // + STDMETHOD(ComputeArea)( + __in_opt CONST D2D1_MATRIX_3X2_F *worldTransform, + FLOAT flatteningTolerance, + __out FLOAT *area + ) CONST PURE; + + + // + // Computes the length of the geometry. + // + STDMETHOD(ComputeLength)( + __in_opt CONST D2D1_MATRIX_3X2_F *worldTransform, + FLOAT flatteningTolerance, + __out FLOAT *length + ) CONST PURE; + + + // + // Computes the point and tangent a given distance along the path. + // + STDMETHOD(ComputePointAtLength)( + FLOAT length, + __in_opt CONST D2D1_MATRIX_3X2_F *worldTransform, + FLOAT flatteningTolerance, + __out_opt D2D1_POINT_2F *point, + __out_opt D2D1_POINT_2F *unitTangentVector + ) CONST PURE; + + + // + // Get the geometry and widen it as well as apply an optional pen style. + // + STDMETHOD(Widen)( + FLOAT strokeWidth, + __in_opt ID2D1StrokeStyle *strokeStyle, + __in_opt CONST D2D1_MATRIX_3X2_F *worldTransform, + FLOAT flatteningTolerance, + __in ID2D1SimplifiedGeometrySink *geometrySink + ) CONST PURE; + + + // + // Retrieve the bounds of the geometry, with an optional applied transform. + // + HRESULT + GetBounds( + CONST D2D1_MATRIX_3X2_F &worldTransform, + __out D2D1_RECT_F *bounds + ) CONST + { + return GetBounds(&worldTransform, bounds); + } + + + // + // Get the bounds of the corresponding geometry after it has been widened or have + // an optional pen style applied. + // + HRESULT + GetWidenedBounds( + FLOAT strokeWidth, + __in_opt ID2D1StrokeStyle *strokeStyle, + CONST D2D1_MATRIX_3X2_F &worldTransform, + FLOAT flatteningTolerance, + __out D2D1_RECT_F *bounds + ) CONST + { + return GetWidenedBounds(strokeWidth, strokeStyle, &worldTransform, flatteningTolerance, bounds); + } + + + // + // Get the bounds of the corresponding geometry after it has been widened or have + // an optional pen style applied. + // + HRESULT + GetWidenedBounds( + FLOAT strokeWidth, + __in_opt ID2D1StrokeStyle *strokeStyle, + __in_opt CONST D2D1_MATRIX_3X2_F *worldTransform, + __out D2D1_RECT_F *bounds + ) CONST + { + return GetWidenedBounds(strokeWidth, strokeStyle, worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, bounds); + } + + + // + // Get the bounds of the corresponding geometry after it has been widened or have + // an optional pen style applied. + // + HRESULT + GetWidenedBounds( + FLOAT strokeWidth, + __in_opt ID2D1StrokeStyle *strokeStyle, + CONST D2D1_MATRIX_3X2_F &worldTransform, + __out D2D1_RECT_F *bounds + ) CONST + { + return GetWidenedBounds(strokeWidth, strokeStyle, &worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, bounds); + } + + HRESULT + StrokeContainsPoint( + D2D1_POINT_2F point, + FLOAT strokeWidth, + __in_opt ID2D1StrokeStyle *strokeStyle, + CONST D2D1_MATRIX_3X2_F &worldTransform, + FLOAT flatteningTolerance, + __out BOOL *contains + ) CONST + { + return StrokeContainsPoint(point, strokeWidth, strokeStyle, &worldTransform, flatteningTolerance, contains); + } + + + // + // Checks to see whether the corresponding penned and widened geometry contains the + // given point. + // + HRESULT + StrokeContainsPoint( + D2D1_POINT_2F point, + FLOAT strokeWidth, + __in_opt ID2D1StrokeStyle *strokeStyle, + __in_opt CONST D2D1_MATRIX_3X2_F *worldTransform, + __out BOOL *contains + ) CONST + { + return StrokeContainsPoint(point, strokeWidth, strokeStyle, worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, contains); + } + + HRESULT + StrokeContainsPoint( + D2D1_POINT_2F point, + FLOAT strokeWidth, + __in_opt ID2D1StrokeStyle *strokeStyle, + CONST D2D1_MATRIX_3X2_F &worldTransform, + __out BOOL *contains + ) CONST + { + return StrokeContainsPoint(point, strokeWidth, strokeStyle, &worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, contains); + } + + HRESULT + FillContainsPoint( + D2D1_POINT_2F point, + CONST D2D1_MATRIX_3X2_F &worldTransform, + FLOAT flatteningTolerance, + __out BOOL *contains + ) CONST + { + return FillContainsPoint(point, &worldTransform, flatteningTolerance, contains); + } + + + // + // Test whether the given fill of this geometry would contain this point. + // + HRESULT + FillContainsPoint( + D2D1_POINT_2F point, + __in_opt CONST D2D1_MATRIX_3X2_F *worldTransform, + __out BOOL *contains + ) CONST + { + return FillContainsPoint(point, worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, contains); + } + + HRESULT + FillContainsPoint( + D2D1_POINT_2F point, + CONST D2D1_MATRIX_3X2_F &worldTransform, + __out BOOL *contains + ) CONST + { + return FillContainsPoint(point, &worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, contains); + } + + + // + // Compare how one geometry intersects or contains another geometry. + // + HRESULT + CompareWithGeometry( + __in ID2D1Geometry *inputGeometry, + CONST D2D1_MATRIX_3X2_F &inputGeometryTransform, + FLOAT flatteningTolerance, + __out D2D1_GEOMETRY_RELATION *relation + ) CONST + { + return CompareWithGeometry(inputGeometry, &inputGeometryTransform, flatteningTolerance, relation); + } + + + // + // Compare how one geometry intersects or contains another geometry. + // + HRESULT + CompareWithGeometry( + __in ID2D1Geometry *inputGeometry, + __in_opt CONST D2D1_MATRIX_3X2_F *inputGeometryTransform, + __out D2D1_GEOMETRY_RELATION *relation + ) CONST + { + return CompareWithGeometry(inputGeometry, inputGeometryTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, relation); + } + + + // + // Compare how one geometry intersects or contains another geometry. + // + HRESULT + CompareWithGeometry( + __in ID2D1Geometry *inputGeometry, + CONST D2D1_MATRIX_3X2_F &inputGeometryTransform, + __out D2D1_GEOMETRY_RELATION *relation + ) CONST + { + return CompareWithGeometry(inputGeometry, &inputGeometryTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, relation); + } + + + // + // Converts a geometry to a simplified geometry that has arcs and quadratic beziers + // removed. + // + HRESULT + Simplify( + D2D1_GEOMETRY_SIMPLIFICATION_OPTION simplificationOption, + CONST D2D1_MATRIX_3X2_F &worldTransform, + FLOAT flatteningTolerance, + __in ID2D1SimplifiedGeometrySink *geometrySink + ) CONST + { + return Simplify(simplificationOption, &worldTransform, flatteningTolerance, geometrySink); + } + + + // + // Converts a geometry to a simplified geometry that has arcs and quadratic beziers + // removed. + // + HRESULT + Simplify( + D2D1_GEOMETRY_SIMPLIFICATION_OPTION simplificationOption, + __in_opt CONST D2D1_MATRIX_3X2_F *worldTransform, + __in ID2D1SimplifiedGeometrySink *geometrySink + ) CONST + { + return Simplify(simplificationOption, worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, geometrySink); + } + + + // + // Converts a geometry to a simplified geometry that has arcs and quadratic beziers + // removed. + // + HRESULT + Simplify( + D2D1_GEOMETRY_SIMPLIFICATION_OPTION simplificationOption, + CONST D2D1_MATRIX_3X2_F &worldTransform, + __in ID2D1SimplifiedGeometrySink *geometrySink + ) CONST + { + return Simplify(simplificationOption, &worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, geometrySink); + } + + + // + // Tessellates a geometry into triangles. + // + HRESULT + Tessellate( + CONST D2D1_MATRIX_3X2_F &worldTransform, + FLOAT flatteningTolerance, + __in ID2D1TessellationSink *tessellationSink + ) CONST + { + return Tessellate(&worldTransform, flatteningTolerance, tessellationSink); + } + + + // + // Tessellates a geometry into triangles. + // + HRESULT + Tessellate( + __in_opt CONST D2D1_MATRIX_3X2_F *worldTransform, + __in ID2D1TessellationSink *tessellationSink + ) CONST + { + return Tessellate(worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, tessellationSink); + } + + + // + // Tessellates a geometry into triangles. + // + HRESULT + Tessellate( + CONST D2D1_MATRIX_3X2_F &worldTransform, + __in ID2D1TessellationSink *tessellationSink + ) CONST + { + return Tessellate(&worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, tessellationSink); + } + + + // + // Performs a combine operation between the two geometries to produce a resulting + // geometry. + // + HRESULT + CombineWithGeometry( + __in ID2D1Geometry *inputGeometry, + D2D1_COMBINE_MODE combineMode, + CONST D2D1_MATRIX_3X2_F &inputGeometryTransform, + FLOAT flatteningTolerance, + __in ID2D1SimplifiedGeometrySink *geometrySink + ) CONST + { + return CombineWithGeometry(inputGeometry, combineMode, &inputGeometryTransform, flatteningTolerance, geometrySink); + } + + + // + // Performs a combine operation between the two geometries to produce a resulting + // geometry. + // + HRESULT + CombineWithGeometry( + __in ID2D1Geometry *inputGeometry, + D2D1_COMBINE_MODE combineMode, + __in_opt CONST D2D1_MATRIX_3X2_F *inputGeometryTransform, + __in ID2D1SimplifiedGeometrySink *geometrySink + ) CONST + { + return CombineWithGeometry(inputGeometry, combineMode, inputGeometryTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, geometrySink); + } + + + // + // Performs a combine operation between the two geometries to produce a resulting + // geometry. + // + HRESULT + CombineWithGeometry( + __in ID2D1Geometry *inputGeometry, + D2D1_COMBINE_MODE combineMode, + CONST D2D1_MATRIX_3X2_F &inputGeometryTransform, + __in ID2D1SimplifiedGeometrySink *geometrySink + ) CONST + { + return CombineWithGeometry(inputGeometry, combineMode, &inputGeometryTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, geometrySink); + } + + + // + // Computes the outline of the geometry. The result is written back into a + // simplified geometry sink. + // + HRESULT + Outline( + CONST D2D1_MATRIX_3X2_F &worldTransform, + FLOAT flatteningTolerance, + __in ID2D1SimplifiedGeometrySink *geometrySink + ) CONST + { + return Outline(&worldTransform, flatteningTolerance, geometrySink); + } + + + // + // Computes the outline of the geometry. The result is written back into a + // simplified geometry sink. + // + HRESULT + Outline( + __in_opt CONST D2D1_MATRIX_3X2_F *worldTransform, + __in ID2D1SimplifiedGeometrySink *geometrySink + ) CONST + { + return Outline(worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, geometrySink); + } + + + // + // Computes the outline of the geometry. The result is written back into a + // simplified geometry sink. + // + HRESULT + Outline( + CONST D2D1_MATRIX_3X2_F &worldTransform, + __in ID2D1SimplifiedGeometrySink *geometrySink + ) CONST + { + return Outline(&worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, geometrySink); + } + + + // + // Computes the area of the geometry. + // + HRESULT + ComputeArea( + CONST D2D1_MATRIX_3X2_F &worldTransform, + FLOAT flatteningTolerance, + __out FLOAT *area + ) CONST + { + return ComputeArea(&worldTransform, flatteningTolerance, area); + } + + + // + // Computes the area of the geometry. + // + HRESULT + ComputeArea( + __in_opt CONST D2D1_MATRIX_3X2_F *worldTransform, + __out FLOAT *area + ) CONST + { + return ComputeArea(worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, area); + } + + + // + // Computes the area of the geometry. + // + HRESULT + ComputeArea( + CONST D2D1_MATRIX_3X2_F &worldTransform, + __out FLOAT *area + ) CONST + { + return ComputeArea(&worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, area); + } + + + // + // Computes the length of the geometry. + // + HRESULT + ComputeLength( + CONST D2D1_MATRIX_3X2_F &worldTransform, + FLOAT flatteningTolerance, + __out FLOAT *length + ) CONST + { + return ComputeLength(&worldTransform, flatteningTolerance, length); + } + + + // + // Computes the length of the geometry. + // + HRESULT + ComputeLength( + __in_opt CONST D2D1_MATRIX_3X2_F *worldTransform, + __out FLOAT *length + ) CONST + { + return ComputeLength(worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, length); + } + + + // + // Computes the length of the geometry. + // + HRESULT + ComputeLength( + CONST D2D1_MATRIX_3X2_F &worldTransform, + __out FLOAT *length + ) CONST + { + return ComputeLength(&worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, length); + } + + + // + // Computes the point and tangent a given distance along the path. + // + HRESULT + ComputePointAtLength( + FLOAT length, + CONST D2D1_MATRIX_3X2_F &worldTransform, + FLOAT flatteningTolerance, + __out_opt D2D1_POINT_2F *point, + __out_opt D2D1_POINT_2F *unitTangentVector + ) CONST + { + return ComputePointAtLength(length, &worldTransform, flatteningTolerance, point, unitTangentVector); + } + + + // + // Computes the point and tangent a given distance along the path. + // + HRESULT + ComputePointAtLength( + FLOAT length, + __in_opt CONST D2D1_MATRIX_3X2_F *worldTransform, + __out_opt D2D1_POINT_2F *point, + __out_opt D2D1_POINT_2F *unitTangentVector + ) CONST + { + return ComputePointAtLength(length, worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, point, unitTangentVector); + } + + + // + // Computes the point and tangent a given distance along the path. + // + HRESULT + ComputePointAtLength( + FLOAT length, + CONST D2D1_MATRIX_3X2_F &worldTransform, + __out_opt D2D1_POINT_2F *point, + __out_opt D2D1_POINT_2F *unitTangentVector + ) CONST + { + return ComputePointAtLength(length, &worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, point, unitTangentVector); + } + + + // + // Get the geometry and widen it as well as apply an optional pen style. + // + HRESULT + Widen( + FLOAT strokeWidth, + __in_opt ID2D1StrokeStyle *strokeStyle, + CONST D2D1_MATRIX_3X2_F &worldTransform, + FLOAT flatteningTolerance, + __in ID2D1SimplifiedGeometrySink *geometrySink + ) CONST + { + return Widen(strokeWidth, strokeStyle, &worldTransform, flatteningTolerance, geometrySink); + } + + + // + // Get the geometry and widen it as well as apply an optional pen style. + // + HRESULT + Widen( + FLOAT strokeWidth, + __in_opt ID2D1StrokeStyle *strokeStyle, + __in_opt CONST D2D1_MATRIX_3X2_F *worldTransform, + __in ID2D1SimplifiedGeometrySink *geometrySink + ) CONST + { + return Widen(strokeWidth, strokeStyle, worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, geometrySink); + } + + + // + // Get the geometry and widen it as well as apply an optional pen style. + // + HRESULT + Widen( + FLOAT strokeWidth, + __in_opt ID2D1StrokeStyle *strokeStyle, + CONST D2D1_MATRIX_3X2_F &worldTransform, + __in ID2D1SimplifiedGeometrySink *geometrySink + ) CONST + { + return Widen(strokeWidth, strokeStyle, &worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, geometrySink); + } +}; // interface ID2D1Geometry + + + +//+----------------------------------------------------------------------------- +// +// Interface: +// ID2D1RectangleGeometry +// +//------------------------------------------------------------------------------ +interface D2D1_DECLARE_INTERFACE("2cd906a2-12e2-11dc-9fed-001143a055f9") ID2D1RectangleGeometry : public ID2D1Geometry +{ + + STDMETHOD_(void, GetRect)( + __out D2D1_RECT_F *rect + ) CONST PURE; +}; // interface ID2D1RectangleGeometry + + + +//+----------------------------------------------------------------------------- +// +// Interface: +// ID2D1RoundedRectangleGeometry +// +//------------------------------------------------------------------------------ +interface D2D1_DECLARE_INTERFACE("2cd906a3-12e2-11dc-9fed-001143a055f9") ID2D1RoundedRectangleGeometry : public ID2D1Geometry +{ + + STDMETHOD_(void, GetRoundedRect)( + __out D2D1_ROUNDED_RECT *roundedRect + ) CONST PURE; +}; // interface ID2D1RoundedRectangleGeometry + + + +//+----------------------------------------------------------------------------- +// +// Interface: +// ID2D1EllipseGeometry +// +//------------------------------------------------------------------------------ +interface D2D1_DECLARE_INTERFACE("2cd906a4-12e2-11dc-9fed-001143a055f9") ID2D1EllipseGeometry : public ID2D1Geometry +{ + + STDMETHOD_(void, GetEllipse)( + __out D2D1_ELLIPSE *ellipse + ) CONST PURE; +}; // interface ID2D1EllipseGeometry + + + +//+----------------------------------------------------------------------------- +// +// Interface: +// ID2D1GeometryGroup +// +//------------------------------------------------------------------------------ +interface D2D1_DECLARE_INTERFACE("2cd906a6-12e2-11dc-9fed-001143a055f9") ID2D1GeometryGroup : public ID2D1Geometry +{ + + STDMETHOD_(D2D1_FILL_MODE, GetFillMode)( + ) CONST PURE; + + STDMETHOD_(UINT32, GetSourceGeometryCount)( + ) CONST PURE; + + STDMETHOD_(void, GetSourceGeometries)( + __out_ecount(geometriesCount) ID2D1Geometry **geometries, + UINT geometriesCount + ) CONST PURE; +}; // interface ID2D1GeometryGroup + + + +//+----------------------------------------------------------------------------- +// +// Interface: +// ID2D1TransformedGeometry +// +//------------------------------------------------------------------------------ +interface D2D1_DECLARE_INTERFACE("2cd906bb-12e2-11dc-9fed-001143a055f9") ID2D1TransformedGeometry : public ID2D1Geometry +{ + + STDMETHOD_(void, GetSourceGeometry)( + __deref_out ID2D1Geometry **sourceGeometry + ) CONST PURE; + + STDMETHOD_(void, GetTransform)( + __out D2D1_MATRIX_3X2_F *transform + ) CONST PURE; +}; // interface ID2D1TransformedGeometry + + + +//+----------------------------------------------------------------------------- +// +// Interface: +// ID2D1SimplifiedGeometrySink +// +//------------------------------------------------------------------------------ +interface D2D1_DECLARE_INTERFACE("2cd9069e-12e2-11dc-9fed-001143a055f9") ID2D1SimplifiedGeometrySink : public IUnknown +{ + + STDMETHOD_(void, SetFillMode)( + D2D1_FILL_MODE fillMode + ) PURE; + + STDMETHOD_(void, SetSegmentFlags)( + D2D1_PATH_SEGMENT vertexFlags + ) PURE; + + STDMETHOD_(void, BeginFigure)( + D2D1_POINT_2F startPoint, + D2D1_FIGURE_BEGIN figureBegin + ) PURE; + + STDMETHOD_(void, AddLines)( + __in_ecount(pointsCount) CONST D2D1_POINT_2F *points, + UINT pointsCount + ) PURE; + + STDMETHOD_(void, AddBeziers)( + __in_ecount(beziersCount) CONST D2D1_BEZIER_SEGMENT *beziers, + UINT beziersCount + ) PURE; + + STDMETHOD_(void, EndFigure)( + D2D1_FIGURE_END figureEnd + ) PURE; + + STDMETHOD(Close)( + ) PURE; +}; // interface ID2D1SimplifiedGeometrySink + + + +//+----------------------------------------------------------------------------- +// +// Interface: +// ID2D1GeometrySink +// +//------------------------------------------------------------------------------ +interface D2D1_DECLARE_INTERFACE("2cd9069f-12e2-11dc-9fed-001143a055f9") ID2D1GeometrySink : public ID2D1SimplifiedGeometrySink +{ + + STDMETHOD_(void, AddLine)( + D2D1_POINT_2F point + ) PURE; + + STDMETHOD_(void, AddBezier)( + __in CONST D2D1_BEZIER_SEGMENT *bezier + ) PURE; + + STDMETHOD_(void, AddQuadraticBezier)( + __in CONST D2D1_QUADRATIC_BEZIER_SEGMENT *bezier + ) PURE; + + STDMETHOD_(void, AddQuadraticBeziers)( + __in_ecount(beziersCount) CONST D2D1_QUADRATIC_BEZIER_SEGMENT *beziers, + UINT beziersCount + ) PURE; + + STDMETHOD_(void, AddArc)( + __in CONST D2D1_ARC_SEGMENT *arc + ) PURE; + + void + AddBezier( + CONST D2D1_BEZIER_SEGMENT &bezier + ) + { + AddBezier(&bezier); + } + + void + AddQuadraticBezier( + CONST D2D1_QUADRATIC_BEZIER_SEGMENT &bezier + ) + { + AddQuadraticBezier(&bezier); + } + + void + AddArc( + CONST D2D1_ARC_SEGMENT &arc + ) + { + AddArc(&arc); + } +}; // interface ID2D1GeometrySink + + + +//+----------------------------------------------------------------------------- +// +// Interface: +// ID2D1TessellationSink +// +//------------------------------------------------------------------------------ +interface D2D1_DECLARE_INTERFACE("2cd906c1-12e2-11dc-9fed-001143a055f9") ID2D1TessellationSink : public IUnknown +{ + + STDMETHOD_(void, AddTriangles)( + __in_ecount(trianglesCount) CONST D2D1_TRIANGLE *triangles, + UINT trianglesCount + ) PURE; + + STDMETHOD(Close)( + ) PURE; +}; // interface ID2D1TessellationSink + + + +//+----------------------------------------------------------------------------- +// +// Interface: +// ID2D1PathGeometry +// +//------------------------------------------------------------------------------ +interface D2D1_DECLARE_INTERFACE("2cd906a5-12e2-11dc-9fed-001143a055f9") ID2D1PathGeometry : public ID2D1Geometry +{ + + + // + // Opens a geometry sink that will be used to create this path geometry. + // + STDMETHOD(Open)( + __deref_out ID2D1GeometrySink **geometrySink + ) PURE; + + + // + // Retrieve the contents of this geometry. The caller passes an implementation of a + // ID2D1GeometrySink interface to receive the data. + // + STDMETHOD(Stream)( + __in ID2D1GeometrySink *geometrySink + ) CONST PURE; + + STDMETHOD(GetSegmentCount)( + __out UINT32 *count + ) CONST PURE; + + STDMETHOD(GetFigureCount)( + __out UINT32 *count + ) CONST PURE; +}; // interface ID2D1PathGeometry + + + +//+----------------------------------------------------------------------------- +// +// Interface: +// ID2D1Mesh +// +//------------------------------------------------------------------------------ +interface D2D1_DECLARE_INTERFACE("2cd906c2-12e2-11dc-9fed-001143a055f9") ID2D1Mesh : public ID2D1Resource +{ + + + // + // Opens the mesh for population. + // + STDMETHOD(Open)( + __deref_out ID2D1TessellationSink **tessellationSink + ) PURE; +}; // interface ID2D1Mesh + + + +//+----------------------------------------------------------------------------- +// +// Interface: +// ID2D1Layer +// +//------------------------------------------------------------------------------ +interface D2D1_DECLARE_INTERFACE("2cd9069b-12e2-11dc-9fed-001143a055f9") ID2D1Layer : public ID2D1Resource +{ + + STDMETHOD_(D2D1_SIZE_F, GetSize)( + ) CONST PURE; +}; // interface ID2D1Layer + + + +//+----------------------------------------------------------------------------- +// +// Interface: +// ID2D1DrawingStateBlock +// +//------------------------------------------------------------------------------ +interface D2D1_DECLARE_INTERFACE("28506e39-ebf6-46a1-bb47-fd85565ab957") ID2D1DrawingStateBlock : public ID2D1Resource +{ + + + // + // Retrieves the state currently contained within this state block resource. + // + STDMETHOD_(void, GetDescription)( + __out D2D1_DRAWING_STATE_DESCRIPTION *stateDescription + ) CONST PURE; + + + // + // Sets the state description of this state block resource. + // + STDMETHOD_(void, SetDescription)( + __in CONST D2D1_DRAWING_STATE_DESCRIPTION *stateDescription + ) PURE; + + + // + // Sets the text rendering parameters of this state block resource. + // + STDMETHOD_(void, SetTextRenderingParams)( + __in_opt IDWriteRenderingParams *textRenderingParams = NULL + ) PURE; + + + // + // Retrieves the text rendering parameters contained within this state block + // resource. If a NULL text rendering parameter was specified, NULL will be + // returned. + // + STDMETHOD_(void, GetTextRenderingParams)( + __deref_out_opt IDWriteRenderingParams **textRenderingParams + ) CONST PURE; + + void + SetDescription( + CONST D2D1_DRAWING_STATE_DESCRIPTION &stateDescription + ) + { + SetDescription(&stateDescription); + } +}; // interface ID2D1DrawingStateBlock + + + +//+----------------------------------------------------------------------------- +// +// Interface: +// ID2D1RenderTarget +// +//------------------------------------------------------------------------------ +interface D2D1_DECLARE_INTERFACE("2cd90694-12e2-11dc-9fed-001143a055f9") ID2D1RenderTarget : public ID2D1Resource +{ + + + // + // Create a D2D bitmap by copying from memory, or create uninitialized. + // + STDMETHOD(CreateBitmap)( + D2D1_SIZE_U size, + __in_opt CONST void *srcData, + UINT32 pitch, + __in CONST D2D1_BITMAP_PROPERTIES *bitmapProperties, + __deref_out ID2D1Bitmap **bitmap + ) PURE; + + + // + // Create a D2D bitmap by copying a WIC bitmap. + // + STDMETHOD(CreateBitmapFromWicBitmap)( + __in IWICBitmapSource *wicBitmapSource, + __in_opt CONST D2D1_BITMAP_PROPERTIES *bitmapProperties, + __deref_out ID2D1Bitmap **bitmap + ) PURE; + + + // + // Create a D2D bitmap by sharing bits from another resource. The bitmap must be + // compatible with the render target for the call to succeed. + // For example, an IWICBitmap can be shared with a software target, or a DXGI + // surface can be shared with a DXGI render target. + // + STDMETHOD(CreateSharedBitmap)( + __in REFIID riid, + __inout void *data, + __in_opt CONST D2D1_BITMAP_PROPERTIES *bitmapProperties, + __deref_out ID2D1Bitmap **bitmap + ) PURE; + + + // + // Creates a bitmap brush. The bitmap is scaled, rotated, skewed or tiled to fill + // or pen a geometry. + // + STDMETHOD(CreateBitmapBrush)( + __in ID2D1Bitmap *bitmap, + __in_opt CONST D2D1_BITMAP_BRUSH_PROPERTIES *bitmapBrushProperties, + __in_opt CONST D2D1_BRUSH_PROPERTIES *brushProperties, + __deref_out ID2D1BitmapBrush **bitmapBrush + ) PURE; + + STDMETHOD(CreateSolidColorBrush)( + __in CONST D2D1_COLOR_F *color, + __in_opt CONST D2D1_BRUSH_PROPERTIES *brushProperties, + __deref_out ID2D1SolidColorBrush **solidColorBrush + ) PURE; + + + // + // A gradient stop collection represents a set of stops in an ideal unit length. + // This is the source resource for a linear gradient and radial gradient brush. + // + STDMETHOD(CreateGradientStopCollection)( + __in_ecount(gradientStopsCount) CONST D2D1_GRADIENT_STOP *gradientStops, + __range(>=,1) UINT gradientStopsCount, + + // + // Specifies which space the color interpolation occurs in. + // + D2D1_GAMMA colorInterpolationGamma, + + // + // Specifies how the gradient will be extended outside of the unit length. + // + D2D1_EXTEND_MODE extendMode, + __deref_out ID2D1GradientStopCollection **gradientStopCollection + ) PURE; + + STDMETHOD(CreateLinearGradientBrush)( + __in CONST D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES *linearGradientBrushProperties, + __in_opt CONST D2D1_BRUSH_PROPERTIES *brushProperties, + __in ID2D1GradientStopCollection *gradientStopCollection, + __deref_out ID2D1LinearGradientBrush **linearGradientBrush + ) PURE; + + STDMETHOD(CreateRadialGradientBrush)( + __in CONST D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES *radialGradientBrushProperties, + __in_opt CONST D2D1_BRUSH_PROPERTIES *brushProperties, + __in ID2D1GradientStopCollection *gradientStopCollection, + __deref_out ID2D1RadialGradientBrush **radialGradientBrush + ) PURE; + + + // + // Creates a bitmap render target whose bitmap can be used as a source for + // rendering in the API. + // + STDMETHOD(CreateCompatibleRenderTarget)( + + // + // The requested size of the target in DIPs. If the pixel size is not specified, + // the DPI is inherited from the parent target. However, the render target will + // never contain a fractional number of pixels. + // + __in_opt CONST D2D1_SIZE_F *desiredSize, + + // + // The requested size of the render target in pixels. If the DIP size is also + // specified, the DPI is calculated from these two values. If the desired size is + // not specified, the DPI is inherited from the parent render target. If neither + // value is specified, the compatible render target will be the same size and have + // the same DPI as the parent target. + // + __in_opt CONST D2D1_SIZE_U *desiredPixelSize, + + // + // The desired pixel format. The format must be compatible with the parent render + // target type. If the format is not specified, it will be inherited from the + // parent render target. + // + __in_opt CONST D2D1_PIXEL_FORMAT *desiredFormat, + + // + // Allows the caller to retrieve a GDI compatible render target. + // + D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS options, + + // + // The returned bitmap render target. + // + __deref_out ID2D1BitmapRenderTarget **bitmapRenderTarget + ) PURE; + + + // + // Creates a layer resource that can be used on any target and which will resize + // under the covers if necessary. + // + STDMETHOD(CreateLayer)( + + // + // The resolution independent minimum size hint for the layer resource. Specify + // this to prevent unwanted reallocation of the layer backing store. The size is in + // DIPs, but, it is unaffected by the current world transform. If the size is + // unspecified, the returned resource is a placeholder and the backing store will + // be allocated to be the minimum size that can hold the content when the layer is + // pushed. + // + __in_opt CONST D2D1_SIZE_F *size, + __deref_out ID2D1Layer **layer + ) PURE; + + + // + // Create a D2D mesh. + // + STDMETHOD(CreateMesh)( + __deref_out ID2D1Mesh **mesh + ) PURE; + + STDMETHOD_(void, DrawLine)( + D2D1_POINT_2F point0, + D2D1_POINT_2F point1, + __in ID2D1Brush *brush, + FLOAT strokeWidth = 1.0f, + __in_opt ID2D1StrokeStyle *strokeStyle = NULL + ) PURE; + + STDMETHOD_(void, DrawRectangle)( + __in CONST D2D1_RECT_F *rect, + __in ID2D1Brush *brush, + FLOAT strokeWidth = 1.0f, + __in_opt ID2D1StrokeStyle *strokeStyle = NULL + ) PURE; + + STDMETHOD_(void, FillRectangle)( + __in CONST D2D1_RECT_F *rect, + __in ID2D1Brush *brush + ) PURE; + + STDMETHOD_(void, DrawRoundedRectangle)( + __in CONST D2D1_ROUNDED_RECT *roundedRect, + __in ID2D1Brush *brush, + FLOAT strokeWidth = 1.0f, + __in_opt ID2D1StrokeStyle *strokeStyle = NULL + ) PURE; + + STDMETHOD_(void, FillRoundedRectangle)( + __in CONST D2D1_ROUNDED_RECT *roundedRect, + __in ID2D1Brush *brush + ) PURE; + + STDMETHOD_(void, DrawEllipse)( + __in CONST D2D1_ELLIPSE *ellipse, + __in ID2D1Brush *brush, + FLOAT strokeWidth = 1.0f, + __in_opt ID2D1StrokeStyle *strokeStyle = NULL + ) PURE; + + STDMETHOD_(void, FillEllipse)( + __in CONST D2D1_ELLIPSE *ellipse, + __in ID2D1Brush *brush + ) PURE; + + STDMETHOD_(void, DrawGeometry)( + __in ID2D1Geometry *geometry, + __in ID2D1Brush *brush, + FLOAT strokeWidth = 1.0f, + __in_opt ID2D1StrokeStyle *strokeStyle = NULL + ) PURE; + + STDMETHOD_(void, FillGeometry)( + __in ID2D1Geometry *geometry, + __in ID2D1Brush *brush, + + // + // An optionally specified opacity brush. Only the alpha channel of the + // corresponding brush will be sampled and will be applied to the entire fill of + // the geometry. If this brush is specified, the fill brush must be a bitmap brush + // with an extend mode of D2D1_EXTEND_MODE_CLAMP. + // + __in_opt ID2D1Brush *opacityBrush = NULL + ) PURE; + + + // + // Fill a mesh. Since meshes can only render aliased content, the render target + // antialiasing mode must be set to aliased. + // + STDMETHOD_(void, FillMesh)( + __in ID2D1Mesh *mesh, + __in ID2D1Brush *brush + ) PURE; + + + // + // Fill using the opacity channel of the supplied bitmap as a mask. The alpha + // channel of the bitmap is used to represent the coverage of the geometry at each + // pixel, and this is filled appropriately with the brush. The render target + // antialiasing mode must be set to aliased. + // + STDMETHOD_(void, FillOpacityMask)( + __in ID2D1Bitmap *opacityMask, + __in ID2D1Brush *brush, + D2D1_OPACITY_MASK_CONTENT content, + __in_opt CONST D2D1_RECT_F *destinationRectangle = NULL, + __in_opt CONST D2D1_RECT_F *sourceRectangle = NULL + ) PURE; + + STDMETHOD_(void, DrawBitmap)( + __in ID2D1Bitmap *bitmap, + __in_opt CONST D2D1_RECT_F *destinationRectangle = NULL, + FLOAT opacity = 1.0f, + D2D1_BITMAP_INTERPOLATION_MODE interpolationMode = D2D1_BITMAP_INTERPOLATION_MODE_LINEAR, + __in_opt CONST D2D1_RECT_F *sourceRectangle = NULL + ) PURE; + + + // + // Draws the text within the given layout rectangle and by default also snaps and + // clips it to the content bounds. + // + STDMETHOD_(void, DrawText)( + __in_ecount(stringLength) CONST WCHAR *string, + UINT stringLength, + __in IDWriteTextFormat *textFormat, + __in CONST D2D1_RECT_F *layoutRect, + __in ID2D1Brush *defaultForegroundBrush, + D2D1_DRAW_TEXT_OPTIONS options = D2D1_DRAW_TEXT_OPTIONS_NONE, + DWRITE_MEASURING_MODE measuringMode = DWRITE_MEASURING_MODE_NATURAL + ) PURE; + + + // + // Draw a snapped text layout object. Since the layout is not subsequently changed, + // this can be more effecient than DrawText when drawing the same layout + // repeatedly. + // + STDMETHOD_(void, DrawTextLayout)( + D2D1_POINT_2F origin, + __in IDWriteTextLayout *textLayout, + __in ID2D1Brush *defaultForegroundBrush, + + // + // The specified text options. NOTE: By default the text is clipped to the layout + // bounds. This is derived from the origin and the layout bounds of the + // corresponding IDWriteTextLayout object. + // + D2D1_DRAW_TEXT_OPTIONS options = D2D1_DRAW_TEXT_OPTIONS_NONE + ) PURE; + + STDMETHOD_(void, DrawGlyphRun)( + D2D1_POINT_2F baselineOrigin, + __in CONST DWRITE_GLYPH_RUN *glyphRun, + __in ID2D1Brush *foregroundBrush, + DWRITE_MEASURING_MODE measuringMode = DWRITE_MEASURING_MODE_NATURAL + ) PURE; + + STDMETHOD_(void, SetTransform)( + __in CONST D2D1_MATRIX_3X2_F *transform + ) PURE; + + STDMETHOD_(void, GetTransform)( + __out D2D1_MATRIX_3X2_F *transform + ) CONST PURE; + + STDMETHOD_(void, SetAntialiasMode)( + D2D1_ANTIALIAS_MODE antialiasMode + ) PURE; + + STDMETHOD_(D2D1_ANTIALIAS_MODE, GetAntialiasMode)( + ) CONST PURE; + + STDMETHOD_(void, SetTextAntialiasMode)( + D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode + ) PURE; + + STDMETHOD_(D2D1_TEXT_ANTIALIAS_MODE, GetTextAntialiasMode)( + ) CONST PURE; + + STDMETHOD_(void, SetTextRenderingParams)( + __in_opt IDWriteRenderingParams *textRenderingParams = NULL + ) PURE; + + + // + // Retrieve the text render parameters. NOTE: If NULL is specified to + // SetTextRenderingParameters, NULL will be returned. + // + STDMETHOD_(void, GetTextRenderingParams)( + __deref_out_opt IDWriteRenderingParams **textRenderingParams + ) CONST PURE; + + + // + // Set a tag to correspond to the succeeding primitives. If an error occurs + // rendering a primtive, the tags can be returned from the Flush or EndDraw call. + // + STDMETHOD_(void, SetTags)( + D2D1_TAG tag1, + D2D1_TAG tag2 + ) PURE; + + + // + // Retrieves the currently set tags. This does not retrieve the tags corresponding + // to any primitive that is in error. + // + STDMETHOD_(void, GetTags)( + __out_opt D2D1_TAG *tag1 = NULL, + __out_opt D2D1_TAG *tag2 = NULL + ) CONST PURE; + + + // + // Start a layer of drawing calls. The way in which the layer must be resolved is + // specified first as well as the logical resource that stores the layer + // parameters. The supplied layer resource might grow if the specified content + // cannot fit inside it. The layer will grow monitonically on each axis. + // + STDMETHOD_(void, PushLayer)( + __in CONST D2D1_LAYER_PARAMETERS *layerParameters, + __in ID2D1Layer *layer + ) PURE; + + + // + // Ends a layer that was defined with particular layer resources. + // + STDMETHOD_(void, PopLayer)( + ) PURE; + + STDMETHOD(Flush)( + __out_opt D2D1_TAG *tag1 = NULL, + __out_opt D2D1_TAG *tag2 = NULL + ) PURE; + + + // + // Gets the current drawing state and saves it into the supplied + // IDrawingStatckBlock. + // + STDMETHOD_(void, SaveDrawingState)( + __inout ID2D1DrawingStateBlock *drawingStateBlock + ) CONST PURE; + + + // + // Copies the state stored in the block interface. + // + STDMETHOD_(void, RestoreDrawingState)( + __in ID2D1DrawingStateBlock *drawingStateBlock + ) PURE; + + + // + // Pushes a clip. The clip can be antialiased. The clip must be axis aligned. If + // the current world transform is not axis preserving, then the bounding box of the + // transformed clip rect will be used. The clip will remain in effect until a + // PopAxisAligned clip call is made. + // + STDMETHOD_(void, PushAxisAlignedClip)( + __in CONST D2D1_RECT_F *clipRect, + D2D1_ANTIALIAS_MODE antialiasMode + ) PURE; + + STDMETHOD_(void, PopAxisAlignedClip)( + ) PURE; + + STDMETHOD_(void, Clear)( + __in_opt CONST D2D1_COLOR_F *clearColor = NULL + ) PURE; + + + // + // Start drawing on this render target. Draw calls can only be issued between a + // BeginDraw and EndDraw call. + // + STDMETHOD_(void, BeginDraw)( + ) PURE; + + + // + // Ends drawing on the render target, error results can be retrieved at this time, + // or when calling flush. + // + STDMETHOD(EndDraw)( + __out_opt D2D1_TAG *tag1 = NULL, + __out_opt D2D1_TAG *tag2 = NULL + ) PURE; + + STDMETHOD_(D2D1_PIXEL_FORMAT, GetPixelFormat)( + ) CONST PURE; + + + // + // Sets the DPI on the render target. This results in the render target being + // interpretted to a different scale. Neither DPI can be negative. If zero is + // specified for both, the system DPI is chosen. If one is zero and the other + // unspecified, the DPI is not changed. + // + STDMETHOD_(void, SetDpi)( + FLOAT dpiX, + FLOAT dpiY + ) PURE; + + + // + // Return the current DPI from the target. + // + STDMETHOD_(void, GetDpi)( + __out FLOAT *dpiX, + __out FLOAT *dpiY + ) CONST PURE; + + + // + // Returns the size of the render target in DIPs. + // + STDMETHOD_(D2D1_SIZE_F, GetSize)( + ) CONST PURE; + + + // + // Returns the size of the render target in pixels. + // + STDMETHOD_(D2D1_SIZE_U, GetPixelSize)( + ) CONST PURE; + + + // + // Returns the maximum bitmap and render target size that is guaranteed to be + // supported by the render target. + // + STDMETHOD_(UINT32, GetMaximumBitmapSize)( + ) CONST PURE; + + + // + // Returns true if the given properties are supported by this render target. The + // DPI is ignored. NOTE: If the render target type is software, then neither + // D2D1_FEATURE_LEVEL_9 nor D2D1_FEATURE_LEVEL_10 will be considered to be + // supported. + // + STDMETHOD_(BOOL, IsSupported)( + __in CONST D2D1_RENDER_TARGET_PROPERTIES *renderTargetProperties + ) CONST PURE; + + HRESULT + CreateBitmap( + D2D1_SIZE_U size, + __in_opt CONST void *srcData, + UINT32 pitch, + CONST D2D1_BITMAP_PROPERTIES &bitmapProperties, + __deref_out ID2D1Bitmap **bitmap + ) + { + return CreateBitmap(size, srcData, pitch, &bitmapProperties, bitmap); + } + + HRESULT + CreateBitmap( + D2D1_SIZE_U size, + CONST D2D1_BITMAP_PROPERTIES &bitmapProperties, + __deref_out ID2D1Bitmap **bitmap + ) + { + return CreateBitmap(size, NULL, 0, &bitmapProperties, bitmap); + } + + + // + // Create a D2D bitmap by copying a WIC bitmap. + // + HRESULT + CreateBitmapFromWicBitmap( + __in IWICBitmapSource *wicBitmapSource, + CONST D2D1_BITMAP_PROPERTIES &bitmapProperties, + __deref_out ID2D1Bitmap **bitmap + ) + { + return CreateBitmapFromWicBitmap(wicBitmapSource, &bitmapProperties, bitmap); + } + + + // + // Create a D2D bitmap by copying a WIC bitmap. + // + HRESULT + CreateBitmapFromWicBitmap( + __in IWICBitmapSource *wicBitmapSource, + __deref_out ID2D1Bitmap **bitmap + ) + { + return CreateBitmapFromWicBitmap(wicBitmapSource, NULL, bitmap); + } + + + // + // Creates a bitmap brush. The bitmap is scaled, rotated, skewed or tiled to fill + // or pen a geometry. + // + HRESULT + CreateBitmapBrush( + __in ID2D1Bitmap *bitmap, + __deref_out ID2D1BitmapBrush **bitmapBrush + ) + { + return CreateBitmapBrush(bitmap, NULL, NULL, bitmapBrush); + } + + + // + // Creates a bitmap brush. The bitmap is scaled, rotated, skewed or tiled to fill + // or pen a geometry. + // + HRESULT + CreateBitmapBrush( + __in ID2D1Bitmap *bitmap, + CONST D2D1_BITMAP_BRUSH_PROPERTIES &bitmapBrushProperties, + __deref_out ID2D1BitmapBrush **bitmapBrush + ) + { + return CreateBitmapBrush(bitmap, &bitmapBrushProperties, NULL, bitmapBrush); + } + + + // + // Creates a bitmap brush. The bitmap is scaled, rotated, skewed or tiled to fill + // or pen a geometry. + // + HRESULT + CreateBitmapBrush( + __in ID2D1Bitmap *bitmap, + CONST D2D1_BITMAP_BRUSH_PROPERTIES &bitmapBrushProperties, + CONST D2D1_BRUSH_PROPERTIES &brushProperties, + __deref_out ID2D1BitmapBrush **bitmapBrush + ) + { + return CreateBitmapBrush(bitmap, &bitmapBrushProperties, &brushProperties, bitmapBrush); + } + + HRESULT + CreateSolidColorBrush( + CONST D2D1_COLOR_F &color, + __deref_out ID2D1SolidColorBrush **solidColorBrush + ) + { + return CreateSolidColorBrush(&color, NULL, solidColorBrush); + } + + HRESULT + CreateSolidColorBrush( + CONST D2D1_COLOR_F &color, + CONST D2D1_BRUSH_PROPERTIES &brushProperties, + __deref_out ID2D1SolidColorBrush **solidColorBrush + ) + { + return CreateSolidColorBrush(&color, &brushProperties, solidColorBrush); + } + + HRESULT + CreateGradientStopCollection( + __in_ecount(gradientStopsCount) CONST D2D1_GRADIENT_STOP *gradientStops, + UINT gradientStopsCount, + __deref_out ID2D1GradientStopCollection **gradientStopCollection + ) + { + return CreateGradientStopCollection(gradientStops, gradientStopsCount, D2D1_GAMMA_2_2, D2D1_EXTEND_MODE_CLAMP, gradientStopCollection); + } + + HRESULT + CreateLinearGradientBrush( + CONST D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES &linearGradientBrushProperties, + __in ID2D1GradientStopCollection *gradientStopCollection, + __deref_out ID2D1LinearGradientBrush **linearGradientBrush + ) + { + return CreateLinearGradientBrush(&linearGradientBrushProperties, NULL, gradientStopCollection, linearGradientBrush); + } + + HRESULT + CreateLinearGradientBrush( + CONST D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES &linearGradientBrushProperties, + CONST D2D1_BRUSH_PROPERTIES &brushProperties, + __in ID2D1GradientStopCollection *gradientStopCollection, + __deref_out ID2D1LinearGradientBrush **linearGradientBrush + ) + { + return CreateLinearGradientBrush(&linearGradientBrushProperties, &brushProperties, gradientStopCollection, linearGradientBrush); + } + + HRESULT + CreateRadialGradientBrush( + CONST D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES &radialGradientBrushProperties, + __in ID2D1GradientStopCollection *gradientStopCollection, + __deref_out ID2D1RadialGradientBrush **radialGradientBrush + ) + { + return CreateRadialGradientBrush(&radialGradientBrushProperties, NULL, gradientStopCollection, radialGradientBrush); + } + + HRESULT + CreateRadialGradientBrush( + CONST D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES &radialGradientBrushProperties, + CONST D2D1_BRUSH_PROPERTIES &brushProperties, + __in ID2D1GradientStopCollection *gradientStopCollection, + __deref_out ID2D1RadialGradientBrush **radialGradientBrush + ) + { + return CreateRadialGradientBrush(&radialGradientBrushProperties, &brushProperties, gradientStopCollection, radialGradientBrush); + } + + HRESULT + CreateCompatibleRenderTarget( + __deref_out ID2D1BitmapRenderTarget **bitmapRenderTarget + ) + { + return CreateCompatibleRenderTarget(NULL, NULL, NULL, D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_NONE, bitmapRenderTarget); + } + + HRESULT + CreateCompatibleRenderTarget( + D2D1_SIZE_F desiredSize, + __deref_out ID2D1BitmapRenderTarget **bitmapRenderTarget + ) + { + return CreateCompatibleRenderTarget(&desiredSize, NULL, NULL, D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_NONE, bitmapRenderTarget); + } + + HRESULT + CreateCompatibleRenderTarget( + D2D1_SIZE_F desiredSize, + D2D1_SIZE_U desiredPixelSize, + __deref_out ID2D1BitmapRenderTarget **bitmapRenderTarget + ) + { + return CreateCompatibleRenderTarget(&desiredSize, &desiredPixelSize, NULL, D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_NONE, bitmapRenderTarget); + } + + HRESULT + CreateCompatibleRenderTarget( + D2D1_SIZE_F desiredSize, + D2D1_SIZE_U desiredPixelSize, + D2D1_PIXEL_FORMAT desiredFormat, + __deref_out ID2D1BitmapRenderTarget **bitmapRenderTarget + ) + { + return CreateCompatibleRenderTarget(&desiredSize, &desiredPixelSize, &desiredFormat, D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_NONE, bitmapRenderTarget); + } + + HRESULT + CreateCompatibleRenderTarget( + D2D1_SIZE_F desiredSize, + D2D1_SIZE_U desiredPixelSize, + D2D1_PIXEL_FORMAT desiredFormat, + D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS options, + __deref_out ID2D1BitmapRenderTarget **bitmapRenderTarget + ) + { + return CreateCompatibleRenderTarget(&desiredSize, &desiredPixelSize, &desiredFormat, options, bitmapRenderTarget); + } + + HRESULT + CreateLayer( + D2D1_SIZE_F size, + __deref_out ID2D1Layer **layer + ) + { + return CreateLayer(&size, layer); + } + + HRESULT + CreateLayer( + __deref_out ID2D1Layer **layer + ) + { + return CreateLayer(NULL, layer); + } + + void + DrawRectangle( + CONST D2D1_RECT_F &rect, + __in ID2D1Brush *brush, + FLOAT strokeWidth = 1.0f, + __in_opt ID2D1StrokeStyle *strokeStyle = NULL + ) + { + DrawRectangle(&rect, brush, strokeWidth, strokeStyle); + } + + void + FillRectangle( + CONST D2D1_RECT_F &rect, + __in ID2D1Brush *brush + ) + { + FillRectangle(&rect, brush); + } + + void + DrawRoundedRectangle( + CONST D2D1_ROUNDED_RECT &roundedRect, + __in ID2D1Brush *brush, + FLOAT strokeWidth = 1.0f, + __in_opt ID2D1StrokeStyle *strokeStyle = NULL + ) + { + DrawRoundedRectangle(&roundedRect, brush, strokeWidth, strokeStyle); + } + + void + FillRoundedRectangle( + CONST D2D1_ROUNDED_RECT &roundedRect, + __in ID2D1Brush *brush + ) + { + FillRoundedRectangle(&roundedRect, brush); + } + + void + DrawEllipse( + CONST D2D1_ELLIPSE &ellipse, + __in ID2D1Brush *brush, + FLOAT strokeWidth = 1.0f, + __in_opt ID2D1StrokeStyle *strokeStyle = NULL + ) + { + DrawEllipse(&ellipse, brush, strokeWidth, strokeStyle); + } + + void + FillEllipse( + CONST D2D1_ELLIPSE &ellipse, + __in ID2D1Brush *brush + ) + { + FillEllipse(&ellipse, brush); + } + + void + FillOpacityMask( + __in ID2D1Bitmap *opacityMask, + __in ID2D1Brush *brush, + D2D1_OPACITY_MASK_CONTENT content, + CONST D2D1_RECT_F &destinationRectangle, + CONST D2D1_RECT_F &sourceRectangle + ) + { + FillOpacityMask(opacityMask, brush, content, &destinationRectangle, &sourceRectangle); + } + + void + DrawBitmap( + __in ID2D1Bitmap *bitmap, + CONST D2D1_RECT_F &destinationRectangle, + FLOAT opacity = 1.0f, + D2D1_BITMAP_INTERPOLATION_MODE interpolationMode = D2D1_BITMAP_INTERPOLATION_MODE_LINEAR, + __in_opt CONST D2D1_RECT_F *sourceRectangle = NULL + ) + { + DrawBitmap(bitmap, &destinationRectangle, opacity, interpolationMode, sourceRectangle); + } + + void + DrawBitmap( + __in ID2D1Bitmap *bitmap, + CONST D2D1_RECT_F &destinationRectangle, + FLOAT opacity, + D2D1_BITMAP_INTERPOLATION_MODE interpolationMode, + CONST D2D1_RECT_F &sourceRectangle + ) + { + DrawBitmap(bitmap, &destinationRectangle, opacity, interpolationMode, &sourceRectangle); + } + + void + SetTransform( + CONST D2D1_MATRIX_3X2_F &transform + ) + { + SetTransform(&transform); + } + + void + PushLayer( + CONST D2D1_LAYER_PARAMETERS &layerParameters, + __in ID2D1Layer *layer + ) + { + PushLayer(&layerParameters, layer); + } + + void + PushAxisAlignedClip( + CONST D2D1_RECT_F &clipRect, + D2D1_ANTIALIAS_MODE antialiasMode + ) + { + return PushAxisAlignedClip(&clipRect, antialiasMode); + } + + void + Clear( + CONST D2D1_COLOR_F &clearColor + ) + { + return Clear(&clearColor); + } + + + // + // Draws the text within the given layout rectangle and by default also snaps and + // clips it. + // + void + DrawText( + __in_ecount(stringLength) CONST WCHAR *string, + UINT stringLength, + __in IDWriteTextFormat *textFormat, + CONST D2D1_RECT_F &layoutRect, + __in ID2D1Brush *defaultForegroundBrush, + D2D1_DRAW_TEXT_OPTIONS options = D2D1_DRAW_TEXT_OPTIONS_NONE, + DWRITE_MEASURING_MODE measuringMode = DWRITE_MEASURING_MODE_NATURAL + ) + { + return DrawText(string, stringLength, textFormat, &layoutRect, defaultForegroundBrush, options, measuringMode); + } + + BOOL + IsSupported( + CONST D2D1_RENDER_TARGET_PROPERTIES &renderTargetProperties + ) CONST + { + return IsSupported(&renderTargetProperties); + } +}; // interface ID2D1RenderTarget + + + +//+----------------------------------------------------------------------------- +// +// Interface: +// ID2D1BitmapRenderTarget +// +//------------------------------------------------------------------------------ +interface D2D1_DECLARE_INTERFACE("2cd90695-12e2-11dc-9fed-001143a055f9") ID2D1BitmapRenderTarget : public ID2D1RenderTarget +{ + + STDMETHOD(GetBitmap)( + __deref_out ID2D1Bitmap **bitmap + ) PURE; +}; // interface ID2D1BitmapRenderTarget + + + +//+----------------------------------------------------------------------------- +// +// Interface: +// ID2D1HwndRenderTarget +// +//------------------------------------------------------------------------------ +interface D2D1_DECLARE_INTERFACE("2cd90698-12e2-11dc-9fed-001143a055f9") ID2D1HwndRenderTarget : public ID2D1RenderTarget +{ + + STDMETHOD_(D2D1_WINDOW_STATE, CheckWindowState)( + ) PURE; + + + // + // Resize the buffer underlying the render target. This operation might fail if + // there is insufficent video memory or system memory, or if the render target is + // resized beyond the maximum bitmap size. If the method fails, the render target + // will be placed in a zombie state and D2DERR_RECREATE_TARGET will be returned + // from it when EndDraw is called. In addition an appropriate failure result will + // be returned from Resize. + // + STDMETHOD(Resize)( + __in CONST D2D1_SIZE_U *pixelSize + ) PURE; + + STDMETHOD_(HWND, GetHwnd)( + ) CONST PURE; + + HRESULT + Resize( + CONST D2D1_SIZE_U &pixelSize + ) + { + return Resize(&pixelSize); + } +}; // interface ID2D1HwndRenderTarget + + + +//+----------------------------------------------------------------------------- +// +// Interface: +// ID2D1GdiInteropRenderTarget +// +//------------------------------------------------------------------------------ +interface D2D1_DECLARE_INTERFACE("e0db51c3-6f77-4bae-b3d5-e47509b35838") ID2D1GdiInteropRenderTarget : public IUnknown +{ + + STDMETHOD(GetDC)( + D2D1_DC_INITIALIZE_MODE mode, + __out HDC *hdc + ) PURE; + + STDMETHOD(ReleaseDC)( + __in_opt CONST RECT *update + ) PURE; +}; // interface ID2D1GdiInteropRenderTarget + + + +//+----------------------------------------------------------------------------- +// +// Interface: +// ID2D1DCRenderTarget +// +//------------------------------------------------------------------------------ +interface D2D1_DECLARE_INTERFACE("1c51bc64-de61-46fd-9899-63a5d8f03950") ID2D1DCRenderTarget : public ID2D1RenderTarget +{ + + STDMETHOD(BindDC)( + __in CONST HDC hDC, + __in CONST RECT *pSubRect + ) PURE; +}; // interface ID2D1DCRenderTarget + + + +//+----------------------------------------------------------------------------- +// +// Interface: +// ID2D1Factory +// +// Synopsis: +// The root factory interface for all of D2D's objects. +// +//------------------------------------------------------------------------------ +interface D2D1_DECLARE_INTERFACE("06152247-6f50-465a-9245-118bfd3b6007") ID2D1Factory : public IUnknown +{ + + + // + // Cause the factory to refresh any system metrics that it might have been snapped + // on factory creation. + // + STDMETHOD(ReloadSystemMetrics)( + ) PURE; + + + // + // Retrieves the current desktop DPI. To refresh this, call ReloadSystemMetrics. + // + STDMETHOD_(void, GetDesktopDpi)( + __out FLOAT *dpiX, + __out FLOAT *dpiY + ) PURE; + + STDMETHOD(CreateRectangleGeometry)( + __in CONST D2D1_RECT_F *rectangle, + __deref_out ID2D1RectangleGeometry **rectangleGeometry + ) PURE; + + STDMETHOD(CreateRoundedRectangleGeometry)( + __in CONST D2D1_ROUNDED_RECT *roundedRectangle, + __deref_out ID2D1RoundedRectangleGeometry **roundedRectangleGeometry + ) PURE; + + STDMETHOD(CreateEllipseGeometry)( + __in CONST D2D1_ELLIPSE *ellipse, + __deref_out ID2D1EllipseGeometry **ellipseGeometry + ) PURE; + + + // + // Create a geometry which holds other geometries. + // + STDMETHOD(CreateGeometryGroup)( + D2D1_FILL_MODE fillMode, + __in_ecount(geometriesCount) ID2D1Geometry **geometries, + UINT geometriesCount, + __deref_out ID2D1GeometryGroup **geometryGroup + ) PURE; + + STDMETHOD(CreateTransformedGeometry)( + __in ID2D1Geometry *sourceGeometry, + __in CONST D2D1_MATRIX_3X2_F *transform, + __deref_out ID2D1TransformedGeometry **transformedGeometry + ) PURE; + + + // + // Returns an initially empty path geometry interface. A geometry sink is created + // off the interface to populate it. + // + STDMETHOD(CreatePathGeometry)( + __deref_out ID2D1PathGeometry **pathGeometry + ) PURE; + + + // + // Allows a non-default stroke style to be specified for a given geometry at draw + // time. + // + STDMETHOD(CreateStrokeStyle)( + __in CONST D2D1_STROKE_STYLE_PROPERTIES *strokeStyleProperties, + __in_ecount_opt(dashesCount) CONST FLOAT *dashes, + UINT dashesCount, + __deref_out ID2D1StrokeStyle **strokeStyle + ) PURE; + + + // + // Creates a new drawing state block, this can be used in subsequent + // SaveDrawingState and RestoreDrawingState operations on the render target. + // + STDMETHOD(CreateDrawingStateBlock)( + __in_opt CONST D2D1_DRAWING_STATE_DESCRIPTION *drawingStateDescription, + __in_opt IDWriteRenderingParams *textRenderingParams, + __deref_out ID2D1DrawingStateBlock **drawingStateBlock + ) PURE; + + + // + // Creates a render target which is a source of bitmaps. + // + STDMETHOD(CreateWicBitmapRenderTarget)( + __in IWICBitmap *target, + __in CONST D2D1_RENDER_TARGET_PROPERTIES *renderTargetProperties, + __deref_out ID2D1RenderTarget **renderTarget + ) PURE; + + + // + // Creates a render target that appears on the display. + // + STDMETHOD(CreateHwndRenderTarget)( + __in CONST D2D1_RENDER_TARGET_PROPERTIES *renderTargetProperties, + __in CONST D2D1_HWND_RENDER_TARGET_PROPERTIES *hwndRenderTargetProperties, + __deref_out ID2D1HwndRenderTarget **hwndRenderTarget + ) PURE; + + + // + // Creates a render target that draws to a DXGI Surface. The device that owns the + // surface is used for rendering. + // + STDMETHOD(CreateDxgiSurfaceRenderTarget)( + __in IDXGISurface *dxgiSurface, + __in CONST D2D1_RENDER_TARGET_PROPERTIES *renderTargetProperties, + __deref_out ID2D1RenderTarget **renderTarget + ) PURE; + + + // + // Creates a render target that draws to a GDI device context. + // + STDMETHOD(CreateDCRenderTarget)( + __in CONST D2D1_RENDER_TARGET_PROPERTIES *renderTargetProperties, + __deref_out ID2D1DCRenderTarget **dcRenderTarget + ) PURE; + + HRESULT + CreateRectangleGeometry( + CONST D2D1_RECT_F &rectangle, + __deref_out ID2D1RectangleGeometry **rectangleGeometry + ) + { + return CreateRectangleGeometry(&rectangle, rectangleGeometry); + } + + HRESULT + CreateRoundedRectangleGeometry( + CONST D2D1_ROUNDED_RECT &roundedRectangle, + __deref_out ID2D1RoundedRectangleGeometry **roundedRectangleGeometry + ) + { + return CreateRoundedRectangleGeometry(&roundedRectangle, roundedRectangleGeometry); + } + + HRESULT + CreateEllipseGeometry( + CONST D2D1_ELLIPSE &ellipse, + __deref_out ID2D1EllipseGeometry **ellipseGeometry + ) + { + return CreateEllipseGeometry(&ellipse, ellipseGeometry); + } + + HRESULT + CreateTransformedGeometry( + __in ID2D1Geometry *sourceGeometry, + CONST D2D1_MATRIX_3X2_F &transform, + __deref_out ID2D1TransformedGeometry **transformedGeometry + ) + { + return CreateTransformedGeometry(sourceGeometry, &transform, transformedGeometry); + } + + HRESULT + CreateStrokeStyle( + CONST D2D1_STROKE_STYLE_PROPERTIES &strokeStyleProperties, + __in_ecount(dashesCount) CONST FLOAT *dashes, + UINT dashesCount, + __deref_out ID2D1StrokeStyle **strokeStyle + ) + { + return CreateStrokeStyle(&strokeStyleProperties, dashes, dashesCount, strokeStyle); + } + + HRESULT + CreateDrawingStateBlock( + CONST D2D1_DRAWING_STATE_DESCRIPTION &drawingStateDescription, + __deref_out ID2D1DrawingStateBlock **drawingStateBlock + ) + { + return CreateDrawingStateBlock(&drawingStateDescription, NULL, drawingStateBlock); + } + + HRESULT + CreateDrawingStateBlock( + __deref_out ID2D1DrawingStateBlock **drawingStateBlock + ) + { + return CreateDrawingStateBlock(NULL, NULL, drawingStateBlock); + } + + HRESULT + CreateWicBitmapRenderTarget( + __in IWICBitmap *target, + CONST D2D1_RENDER_TARGET_PROPERTIES &renderTargetProperties, + __deref_out ID2D1RenderTarget **renderTarget + ) + { + return CreateWicBitmapRenderTarget(target, &renderTargetProperties, renderTarget); + } + + HRESULT + CreateHwndRenderTarget( + CONST D2D1_RENDER_TARGET_PROPERTIES &renderTargetProperties, + CONST D2D1_HWND_RENDER_TARGET_PROPERTIES &hwndRenderTargetProperties, + __deref_out ID2D1HwndRenderTarget **hwndRenderTarget + ) + { + return CreateHwndRenderTarget(&renderTargetProperties, &hwndRenderTargetProperties, hwndRenderTarget); + } + + HRESULT + CreateDxgiSurfaceRenderTarget( + __in IDXGISurface *dxgiSurface, + CONST D2D1_RENDER_TARGET_PROPERTIES &renderTargetProperties, + __deref_out ID2D1RenderTarget **renderTarget + ) + { + return CreateDxgiSurfaceRenderTarget(dxgiSurface, &renderTargetProperties, renderTarget); + } +}; // interface ID2D1Factory + + + +#endif + + +EXTERN_C CONST IID IID_ID2D1Resource; +EXTERN_C CONST IID IID_ID2D1Bitmap; +EXTERN_C CONST IID IID_ID2D1GradientStopCollection; +EXTERN_C CONST IID IID_ID2D1Brush; +EXTERN_C CONST IID IID_ID2D1BitmapBrush; +EXTERN_C CONST IID IID_ID2D1SolidColorBrush; +EXTERN_C CONST IID IID_ID2D1LinearGradientBrush; +EXTERN_C CONST IID IID_ID2D1RadialGradientBrush; +EXTERN_C CONST IID IID_ID2D1StrokeStyle; +EXTERN_C CONST IID IID_ID2D1Geometry; +EXTERN_C CONST IID IID_ID2D1RectangleGeometry; +EXTERN_C CONST IID IID_ID2D1RoundedRectangleGeometry; +EXTERN_C CONST IID IID_ID2D1EllipseGeometry; +EXTERN_C CONST IID IID_ID2D1GeometryGroup; +EXTERN_C CONST IID IID_ID2D1TransformedGeometry; +EXTERN_C CONST IID IID_ID2D1SimplifiedGeometrySink; +EXTERN_C CONST IID IID_ID2D1GeometrySink; +EXTERN_C CONST IID IID_ID2D1TessellationSink; +EXTERN_C CONST IID IID_ID2D1PathGeometry; +EXTERN_C CONST IID IID_ID2D1Mesh; +EXTERN_C CONST IID IID_ID2D1Layer; +EXTERN_C CONST IID IID_ID2D1DrawingStateBlock; +EXTERN_C CONST IID IID_ID2D1RenderTarget; +EXTERN_C CONST IID IID_ID2D1BitmapRenderTarget; +EXTERN_C CONST IID IID_ID2D1HwndRenderTarget; +EXTERN_C CONST IID IID_ID2D1GdiInteropRenderTarget; +EXTERN_C CONST IID IID_ID2D1DCRenderTarget; +EXTERN_C CONST IID IID_ID2D1Factory; + + +#ifdef D2D_USE_C_DEFINITIONS + + +typedef interface ID2D1Resource ID2D1Resource; + +typedef struct ID2D1ResourceVtbl +{ + + IUnknownVtbl Base; + + + STDMETHOD_(void, GetFactory)( + ID2D1Resource *This, + __deref_out ID2D1Factory **factory + ) PURE; +} ID2D1ResourceVtbl; + +interface ID2D1Resource +{ + CONST struct ID2D1ResourceVtbl *lpVtbl; +}; + + +#define ID2D1Resource_QueryInterface(This, riid, ppv) \ + ((This)->lpVtbl->Base.QueryInterface((IUnknown *)This, riid, ppv)) + +#define ID2D1Resource_AddRef(This) \ + ((This)->lpVtbl->Base.AddRef((IUnknown *)This)) + +#define ID2D1Resource_Release(This) \ + ((This)->lpVtbl->Base.Release((IUnknown *)This)) + +#define ID2D1Resource_GetFactory(This, factory) \ + ((This)->lpVtbl->GetFactory(This, factory)) + +typedef interface ID2D1Bitmap ID2D1Bitmap; + +typedef struct ID2D1BitmapVtbl +{ + + ID2D1ResourceVtbl Base; + + + STDMETHOD_(D2D1_SIZE_F, GetSize)( + ID2D1Bitmap *This + ) PURE; + + STDMETHOD_(D2D1_SIZE_U, GetPixelSize)( + ID2D1Bitmap *This + ) PURE; + + STDMETHOD_(D2D1_PIXEL_FORMAT, GetPixelFormat)( + ID2D1Bitmap *This + ) PURE; + + STDMETHOD_(void, GetDpi)( + ID2D1Bitmap *This, + __out FLOAT *dpiX, + __out FLOAT *dpiY + ) PURE; + + STDMETHOD(CopyFromBitmap)( + ID2D1Bitmap *This, + __in_opt CONST D2D1_POINT_2U *destPoint, + __in ID2D1Bitmap *bitmap, + __in_opt CONST D2D1_RECT_U *srcRect + ) PURE; + + STDMETHOD(CopyFromRenderTarget)( + ID2D1Bitmap *This, + __in_opt CONST D2D1_POINT_2U *destPoint, + __in ID2D1RenderTarget *renderTarget, + __in_opt CONST D2D1_RECT_U *srcRect + ) PURE; + + STDMETHOD(CopyFromMemory)( + ID2D1Bitmap *This, + __in_opt CONST D2D1_RECT_U *dstRect, + __in CONST void *srcData, + UINT32 pitch + ) PURE; +} ID2D1BitmapVtbl; + +interface ID2D1Bitmap +{ + CONST struct ID2D1BitmapVtbl *lpVtbl; +}; + + +#define ID2D1Bitmap_QueryInterface(This, riid, ppv) \ + ((This)->lpVtbl->Base.Base.QueryInterface((IUnknown *)This, riid, ppv)) + +#define ID2D1Bitmap_AddRef(This) \ + ((This)->lpVtbl->Base.Base.AddRef((IUnknown *)This)) + +#define ID2D1Bitmap_Release(This) \ + ((This)->lpVtbl->Base.Base.Release((IUnknown *)This)) + +#define ID2D1Bitmap_GetFactory(This, factory) \ + ((This)->lpVtbl->Base.GetFactory((ID2D1Resource *)This, factory)) + +#define ID2D1Bitmap_GetSize(This) \ + ((This)->lpVtbl->GetSize(This)) + +#define ID2D1Bitmap_GetPixelSize(This) \ + ((This)->lpVtbl->GetPixelSize(This)) + +#define ID2D1Bitmap_GetPixelFormat(This) \ + ((This)->lpVtbl->GetPixelFormat(This)) + +#define ID2D1Bitmap_GetDpi(This, dpiX, dpiY) \ + ((This)->lpVtbl->GetDpi(This, dpiX, dpiY)) + +#define ID2D1Bitmap_CopyFromBitmap(This, destPoint, bitmap, srcRect) \ + ((This)->lpVtbl->CopyFromBitmap(This, destPoint, bitmap, srcRect)) + +#define ID2D1Bitmap_CopyFromRenderTarget(This, destPoint, renderTarget, srcRect) \ + ((This)->lpVtbl->CopyFromRenderTarget(This, destPoint, renderTarget, srcRect)) + +#define ID2D1Bitmap_CopyFromMemory(This, dstRect, srcData, pitch) \ + ((This)->lpVtbl->CopyFromMemory(This, dstRect, srcData, pitch)) + +typedef interface ID2D1GradientStopCollection ID2D1GradientStopCollection; + +typedef struct ID2D1GradientStopCollectionVtbl +{ + + ID2D1ResourceVtbl Base; + + + STDMETHOD_(UINT32, GetGradientStopCount)( + ID2D1GradientStopCollection *This + ) PURE; + + STDMETHOD_(void, GetGradientStops)( + ID2D1GradientStopCollection *This, + __out_ecount(gradientStopsCount) D2D1_GRADIENT_STOP *gradientStops, + UINT gradientStopsCount + ) PURE; + + STDMETHOD_(D2D1_GAMMA, GetColorInterpolationGamma)( + ID2D1GradientStopCollection *This + ) PURE; + + STDMETHOD_(D2D1_EXTEND_MODE, GetExtendMode)( + ID2D1GradientStopCollection *This + ) PURE; +} ID2D1GradientStopCollectionVtbl; + +interface ID2D1GradientStopCollection +{ + CONST struct ID2D1GradientStopCollectionVtbl *lpVtbl; +}; + + +#define ID2D1GradientStopCollection_QueryInterface(This, riid, ppv) \ + ((This)->lpVtbl->Base.Base.QueryInterface((IUnknown *)This, riid, ppv)) + +#define ID2D1GradientStopCollection_AddRef(This) \ + ((This)->lpVtbl->Base.Base.AddRef((IUnknown *)This)) + +#define ID2D1GradientStopCollection_Release(This) \ + ((This)->lpVtbl->Base.Base.Release((IUnknown *)This)) + +#define ID2D1GradientStopCollection_GetFactory(This, factory) \ + ((This)->lpVtbl->Base.GetFactory((ID2D1Resource *)This, factory)) + +#define ID2D1GradientStopCollection_GetGradientStopCount(This) \ + ((This)->lpVtbl->GetGradientStopCount(This)) + +#define ID2D1GradientStopCollection_GetGradientStops(This, gradientStops, gradientStopsCount) \ + ((This)->lpVtbl->GetGradientStops(This, gradientStops, gradientStopsCount)) + +#define ID2D1GradientStopCollection_GetColorInterpolationGamma(This) \ + ((This)->lpVtbl->GetColorInterpolationGamma(This)) + +#define ID2D1GradientStopCollection_GetExtendMode(This) \ + ((This)->lpVtbl->GetExtendMode(This)) + +typedef interface ID2D1Brush ID2D1Brush; + +typedef struct ID2D1BrushVtbl +{ + + ID2D1ResourceVtbl Base; + + + STDMETHOD_(void, SetOpacity)( + ID2D1Brush *This, + FLOAT opacity + ) PURE; + + STDMETHOD_(void, SetTransform)( + ID2D1Brush *This, + __in CONST D2D1_MATRIX_3X2_F *transform + ) PURE; + + STDMETHOD_(FLOAT, GetOpacity)( + ID2D1Brush *This + ) PURE; + + STDMETHOD_(void, GetTransform)( + ID2D1Brush *This, + __out D2D1_MATRIX_3X2_F *transform + ) PURE; +} ID2D1BrushVtbl; + +interface ID2D1Brush +{ + CONST struct ID2D1BrushVtbl *lpVtbl; +}; + + +#define ID2D1Brush_QueryInterface(This, riid, ppv) \ + ((This)->lpVtbl->Base.Base.QueryInterface((IUnknown *)This, riid, ppv)) + +#define ID2D1Brush_AddRef(This) \ + ((This)->lpVtbl->Base.Base.AddRef((IUnknown *)This)) + +#define ID2D1Brush_Release(This) \ + ((This)->lpVtbl->Base.Base.Release((IUnknown *)This)) + +#define ID2D1Brush_GetFactory(This, factory) \ + ((This)->lpVtbl->Base.GetFactory((ID2D1Resource *)This, factory)) + +#define ID2D1Brush_SetOpacity(This, opacity) \ + ((This)->lpVtbl->SetOpacity(This, opacity)) + +#define ID2D1Brush_SetTransform(This, transform) \ + ((This)->lpVtbl->SetTransform(This, transform)) + +#define ID2D1Brush_GetOpacity(This) \ + ((This)->lpVtbl->GetOpacity(This)) + +#define ID2D1Brush_GetTransform(This, transform) \ + ((This)->lpVtbl->GetTransform(This, transform)) + +typedef interface ID2D1BitmapBrush ID2D1BitmapBrush; + +typedef struct ID2D1BitmapBrushVtbl +{ + + ID2D1BrushVtbl Base; + + + STDMETHOD_(void, SetExtendModeX)( + ID2D1BitmapBrush *This, + D2D1_EXTEND_MODE extendModeX + ) PURE; + + STDMETHOD_(void, SetExtendModeY)( + ID2D1BitmapBrush *This, + D2D1_EXTEND_MODE extendModeY + ) PURE; + + STDMETHOD_(void, SetInterpolationMode)( + ID2D1BitmapBrush *This, + D2D1_BITMAP_INTERPOLATION_MODE interpolationMode + ) PURE; + + STDMETHOD_(void, SetBitmap)( + ID2D1BitmapBrush *This, + __in ID2D1Bitmap *bitmap + ) PURE; + + STDMETHOD_(D2D1_EXTEND_MODE, GetExtendModeX)( + ID2D1BitmapBrush *This + ) PURE; + + STDMETHOD_(D2D1_EXTEND_MODE, GetExtendModeY)( + ID2D1BitmapBrush *This + ) PURE; + + STDMETHOD_(D2D1_BITMAP_INTERPOLATION_MODE, GetInterpolationMode)( + ID2D1BitmapBrush *This + ) PURE; + + STDMETHOD_(void, GetBitmap)( + ID2D1BitmapBrush *This, + __deref_out ID2D1Bitmap **bitmap + ) PURE; +} ID2D1BitmapBrushVtbl; + +interface ID2D1BitmapBrush +{ + CONST struct ID2D1BitmapBrushVtbl *lpVtbl; +}; + + +#define ID2D1BitmapBrush_QueryInterface(This, riid, ppv) \ + ((This)->lpVtbl->Base.Base.Base.QueryInterface((IUnknown *)This, riid, ppv)) + +#define ID2D1BitmapBrush_AddRef(This) \ + ((This)->lpVtbl->Base.Base.Base.AddRef((IUnknown *)This)) + +#define ID2D1BitmapBrush_Release(This) \ + ((This)->lpVtbl->Base.Base.Base.Release((IUnknown *)This)) + +#define ID2D1BitmapBrush_GetFactory(This, factory) \ + ((This)->lpVtbl->Base.Base.GetFactory((ID2D1Resource *)This, factory)) + +#define ID2D1BitmapBrush_SetOpacity(This, opacity) \ + ((This)->lpVtbl->Base.SetOpacity((ID2D1Brush *)This, opacity)) + +#define ID2D1BitmapBrush_SetTransform(This, transform) \ + ((This)->lpVtbl->Base.SetTransform((ID2D1Brush *)This, transform)) + +#define ID2D1BitmapBrush_GetOpacity(This) \ + ((This)->lpVtbl->Base.GetOpacity((ID2D1Brush *)This)) + +#define ID2D1BitmapBrush_GetTransform(This, transform) \ + ((This)->lpVtbl->Base.GetTransform((ID2D1Brush *)This, transform)) + +#define ID2D1BitmapBrush_SetExtendModeX(This, extendModeX) \ + ((This)->lpVtbl->SetExtendModeX(This, extendModeX)) + +#define ID2D1BitmapBrush_SetExtendModeY(This, extendModeY) \ + ((This)->lpVtbl->SetExtendModeY(This, extendModeY)) + +#define ID2D1BitmapBrush_SetInterpolationMode(This, interpolationMode) \ + ((This)->lpVtbl->SetInterpolationMode(This, interpolationMode)) + +#define ID2D1BitmapBrush_SetBitmap(This, bitmap) \ + ((This)->lpVtbl->SetBitmap(This, bitmap)) + +#define ID2D1BitmapBrush_GetExtendModeX(This) \ + ((This)->lpVtbl->GetExtendModeX(This)) + +#define ID2D1BitmapBrush_GetExtendModeY(This) \ + ((This)->lpVtbl->GetExtendModeY(This)) + +#define ID2D1BitmapBrush_GetInterpolationMode(This) \ + ((This)->lpVtbl->GetInterpolationMode(This)) + +#define ID2D1BitmapBrush_GetBitmap(This, bitmap) \ + ((This)->lpVtbl->GetBitmap(This, bitmap)) + +typedef interface ID2D1SolidColorBrush ID2D1SolidColorBrush; + +typedef struct ID2D1SolidColorBrushVtbl +{ + + ID2D1BrushVtbl Base; + + + STDMETHOD_(void, SetColor)( + ID2D1SolidColorBrush *This, + __in CONST D2D1_COLOR_F *color + ) PURE; + + STDMETHOD_(D2D1_COLOR_F, GetColor)( + ID2D1SolidColorBrush *This + ) PURE; +} ID2D1SolidColorBrushVtbl; + +interface ID2D1SolidColorBrush +{ + CONST struct ID2D1SolidColorBrushVtbl *lpVtbl; +}; + + +#define ID2D1SolidColorBrush_QueryInterface(This, riid, ppv) \ + ((This)->lpVtbl->Base.Base.Base.QueryInterface((IUnknown *)This, riid, ppv)) + +#define ID2D1SolidColorBrush_AddRef(This) \ + ((This)->lpVtbl->Base.Base.Base.AddRef((IUnknown *)This)) + +#define ID2D1SolidColorBrush_Release(This) \ + ((This)->lpVtbl->Base.Base.Base.Release((IUnknown *)This)) + +#define ID2D1SolidColorBrush_GetFactory(This, factory) \ + ((This)->lpVtbl->Base.Base.GetFactory((ID2D1Resource *)This, factory)) + +#define ID2D1SolidColorBrush_SetOpacity(This, opacity) \ + ((This)->lpVtbl->Base.SetOpacity((ID2D1Brush *)This, opacity)) + +#define ID2D1SolidColorBrush_SetTransform(This, transform) \ + ((This)->lpVtbl->Base.SetTransform((ID2D1Brush *)This, transform)) + +#define ID2D1SolidColorBrush_GetOpacity(This) \ + ((This)->lpVtbl->Base.GetOpacity((ID2D1Brush *)This)) + +#define ID2D1SolidColorBrush_GetTransform(This, transform) \ + ((This)->lpVtbl->Base.GetTransform((ID2D1Brush *)This, transform)) + +#define ID2D1SolidColorBrush_SetColor(This, color) \ + ((This)->lpVtbl->SetColor(This, color)) + +#define ID2D1SolidColorBrush_GetColor(This) \ + ((This)->lpVtbl->GetColor(This)) + +typedef interface ID2D1LinearGradientBrush ID2D1LinearGradientBrush; + +typedef struct ID2D1LinearGradientBrushVtbl +{ + + ID2D1BrushVtbl Base; + + + STDMETHOD_(void, SetStartPoint)( + ID2D1LinearGradientBrush *This, + D2D1_POINT_2F startPoint + ) PURE; + + STDMETHOD_(void, SetEndPoint)( + ID2D1LinearGradientBrush *This, + D2D1_POINT_2F endPoint + ) PURE; + + STDMETHOD_(D2D1_POINT_2F, GetStartPoint)( + ID2D1LinearGradientBrush *This + ) PURE; + + STDMETHOD_(D2D1_POINT_2F, GetEndPoint)( + ID2D1LinearGradientBrush *This + ) PURE; + + STDMETHOD_(void, GetGradientStopCollection)( + ID2D1LinearGradientBrush *This, + __deref_out ID2D1GradientStopCollection **gradientStopCollection + ) PURE; +} ID2D1LinearGradientBrushVtbl; + +interface ID2D1LinearGradientBrush +{ + CONST struct ID2D1LinearGradientBrushVtbl *lpVtbl; +}; + + +#define ID2D1LinearGradientBrush_QueryInterface(This, riid, ppv) \ + ((This)->lpVtbl->Base.Base.Base.QueryInterface((IUnknown *)This, riid, ppv)) + +#define ID2D1LinearGradientBrush_AddRef(This) \ + ((This)->lpVtbl->Base.Base.Base.AddRef((IUnknown *)This)) + +#define ID2D1LinearGradientBrush_Release(This) \ + ((This)->lpVtbl->Base.Base.Base.Release((IUnknown *)This)) + +#define ID2D1LinearGradientBrush_GetFactory(This, factory) \ + ((This)->lpVtbl->Base.Base.GetFactory((ID2D1Resource *)This, factory)) + +#define ID2D1LinearGradientBrush_SetOpacity(This, opacity) \ + ((This)->lpVtbl->Base.SetOpacity((ID2D1Brush *)This, opacity)) + +#define ID2D1LinearGradientBrush_SetTransform(This, transform) \ + ((This)->lpVtbl->Base.SetTransform((ID2D1Brush *)This, transform)) + +#define ID2D1LinearGradientBrush_GetOpacity(This) \ + ((This)->lpVtbl->Base.GetOpacity((ID2D1Brush *)This)) + +#define ID2D1LinearGradientBrush_GetTransform(This, transform) \ + ((This)->lpVtbl->Base.GetTransform((ID2D1Brush *)This, transform)) + +#define ID2D1LinearGradientBrush_SetStartPoint(This, startPoint) \ + ((This)->lpVtbl->SetStartPoint(This, startPoint)) + +#define ID2D1LinearGradientBrush_SetEndPoint(This, endPoint) \ + ((This)->lpVtbl->SetEndPoint(This, endPoint)) + +#define ID2D1LinearGradientBrush_GetStartPoint(This) \ + ((This)->lpVtbl->GetStartPoint(This)) + +#define ID2D1LinearGradientBrush_GetEndPoint(This) \ + ((This)->lpVtbl->GetEndPoint(This)) + +#define ID2D1LinearGradientBrush_GetGradientStopCollection(This, gradientStopCollection) \ + ((This)->lpVtbl->GetGradientStopCollection(This, gradientStopCollection)) + +typedef interface ID2D1RadialGradientBrush ID2D1RadialGradientBrush; + +typedef struct ID2D1RadialGradientBrushVtbl +{ + + ID2D1BrushVtbl Base; + + + STDMETHOD_(void, SetCenter)( + ID2D1RadialGradientBrush *This, + D2D1_POINT_2F center + ) PURE; + + STDMETHOD_(void, SetGradientOriginOffset)( + ID2D1RadialGradientBrush *This, + D2D1_POINT_2F gradientOriginOffset + ) PURE; + + STDMETHOD_(void, SetRadiusX)( + ID2D1RadialGradientBrush *This, + FLOAT radiusX + ) PURE; + + STDMETHOD_(void, SetRadiusY)( + ID2D1RadialGradientBrush *This, + FLOAT radiusY + ) PURE; + + STDMETHOD_(D2D1_POINT_2F, GetCenter)( + ID2D1RadialGradientBrush *This + ) PURE; + + STDMETHOD_(D2D1_POINT_2F, GetGradientOriginOffset)( + ID2D1RadialGradientBrush *This + ) PURE; + + STDMETHOD_(FLOAT, GetRadiusX)( + ID2D1RadialGradientBrush *This + ) PURE; + + STDMETHOD_(FLOAT, GetRadiusY)( + ID2D1RadialGradientBrush *This + ) PURE; + + STDMETHOD_(void, GetGradientStopCollection)( + ID2D1RadialGradientBrush *This, + __deref_out ID2D1GradientStopCollection **gradientStopCollection + ) PURE; +} ID2D1RadialGradientBrushVtbl; + +interface ID2D1RadialGradientBrush +{ + CONST struct ID2D1RadialGradientBrushVtbl *lpVtbl; +}; + + +#define ID2D1RadialGradientBrush_QueryInterface(This, riid, ppv) \ + ((This)->lpVtbl->Base.Base.Base.QueryInterface((IUnknown *)This, riid, ppv)) + +#define ID2D1RadialGradientBrush_AddRef(This) \ + ((This)->lpVtbl->Base.Base.Base.AddRef((IUnknown *)This)) + +#define ID2D1RadialGradientBrush_Release(This) \ + ((This)->lpVtbl->Base.Base.Base.Release((IUnknown *)This)) + +#define ID2D1RadialGradientBrush_GetFactory(This, factory) \ + ((This)->lpVtbl->Base.Base.GetFactory((ID2D1Resource *)This, factory)) + +#define ID2D1RadialGradientBrush_SetOpacity(This, opacity) \ + ((This)->lpVtbl->Base.SetOpacity((ID2D1Brush *)This, opacity)) + +#define ID2D1RadialGradientBrush_SetTransform(This, transform) \ + ((This)->lpVtbl->Base.SetTransform((ID2D1Brush *)This, transform)) + +#define ID2D1RadialGradientBrush_GetOpacity(This) \ + ((This)->lpVtbl->Base.GetOpacity((ID2D1Brush *)This)) + +#define ID2D1RadialGradientBrush_GetTransform(This, transform) \ + ((This)->lpVtbl->Base.GetTransform((ID2D1Brush *)This, transform)) + +#define ID2D1RadialGradientBrush_SetCenter(This, center) \ + ((This)->lpVtbl->SetCenter(This, center)) + +#define ID2D1RadialGradientBrush_SetGradientOriginOffset(This, gradientOriginOffset) \ + ((This)->lpVtbl->SetGradientOriginOffset(This, gradientOriginOffset)) + +#define ID2D1RadialGradientBrush_SetRadiusX(This, radiusX) \ + ((This)->lpVtbl->SetRadiusX(This, radiusX)) + +#define ID2D1RadialGradientBrush_SetRadiusY(This, radiusY) \ + ((This)->lpVtbl->SetRadiusY(This, radiusY)) + +#define ID2D1RadialGradientBrush_GetCenter(This) \ + ((This)->lpVtbl->GetCenter(This)) + +#define ID2D1RadialGradientBrush_GetGradientOriginOffset(This) \ + ((This)->lpVtbl->GetGradientOriginOffset(This)) + +#define ID2D1RadialGradientBrush_GetRadiusX(This) \ + ((This)->lpVtbl->GetRadiusX(This)) + +#define ID2D1RadialGradientBrush_GetRadiusY(This) \ + ((This)->lpVtbl->GetRadiusY(This)) + +#define ID2D1RadialGradientBrush_GetGradientStopCollection(This, gradientStopCollection) \ + ((This)->lpVtbl->GetGradientStopCollection(This, gradientStopCollection)) + +typedef interface ID2D1StrokeStyle ID2D1StrokeStyle; + +typedef struct ID2D1StrokeStyleVtbl +{ + + ID2D1ResourceVtbl Base; + + + STDMETHOD_(D2D1_CAP_STYLE, GetStartCap)( + ID2D1StrokeStyle *This + ) PURE; + + STDMETHOD_(D2D1_CAP_STYLE, GetEndCap)( + ID2D1StrokeStyle *This + ) PURE; + + STDMETHOD_(D2D1_CAP_STYLE, GetDashCap)( + ID2D1StrokeStyle *This + ) PURE; + + STDMETHOD_(FLOAT, GetMiterLimit)( + ID2D1StrokeStyle *This + ) PURE; + + STDMETHOD_(D2D1_LINE_JOIN, GetLineJoin)( + ID2D1StrokeStyle *This + ) PURE; + + STDMETHOD_(FLOAT, GetDashOffset)( + ID2D1StrokeStyle *This + ) PURE; + + STDMETHOD_(D2D1_DASH_STYLE, GetDashStyle)( + ID2D1StrokeStyle *This + ) PURE; + + STDMETHOD_(UINT32, GetDashesCount)( + ID2D1StrokeStyle *This + ) PURE; + + STDMETHOD_(void, GetDashes)( + ID2D1StrokeStyle *This, + __out_ecount(dashesCount) FLOAT *dashes, + UINT dashesCount + ) PURE; +} ID2D1StrokeStyleVtbl; + +interface ID2D1StrokeStyle +{ + CONST struct ID2D1StrokeStyleVtbl *lpVtbl; +}; + + +#define ID2D1StrokeStyle_QueryInterface(This, riid, ppv) \ + ((This)->lpVtbl->Base.Base.QueryInterface((IUnknown *)This, riid, ppv)) + +#define ID2D1StrokeStyle_AddRef(This) \ + ((This)->lpVtbl->Base.Base.AddRef((IUnknown *)This)) + +#define ID2D1StrokeStyle_Release(This) \ + ((This)->lpVtbl->Base.Base.Release((IUnknown *)This)) + +#define ID2D1StrokeStyle_GetFactory(This, factory) \ + ((This)->lpVtbl->Base.GetFactory((ID2D1Resource *)This, factory)) + +#define ID2D1StrokeStyle_GetStartCap(This) \ + ((This)->lpVtbl->GetStartCap(This)) + +#define ID2D1StrokeStyle_GetEndCap(This) \ + ((This)->lpVtbl->GetEndCap(This)) + +#define ID2D1StrokeStyle_GetDashCap(This) \ + ((This)->lpVtbl->GetDashCap(This)) + +#define ID2D1StrokeStyle_GetMiterLimit(This) \ + ((This)->lpVtbl->GetMiterLimit(This)) + +#define ID2D1StrokeStyle_GetLineJoin(This) \ + ((This)->lpVtbl->GetLineJoin(This)) + +#define ID2D1StrokeStyle_GetDashOffset(This) \ + ((This)->lpVtbl->GetDashOffset(This)) + +#define ID2D1StrokeStyle_GetDashStyle(This) \ + ((This)->lpVtbl->GetDashStyle(This)) + +#define ID2D1StrokeStyle_GetDashesCount(This) \ + ((This)->lpVtbl->GetDashesCount(This)) + +#define ID2D1StrokeStyle_GetDashes(This, dashes, dashesCount) \ + ((This)->lpVtbl->GetDashes(This, dashes, dashesCount)) + +typedef interface ID2D1Geometry ID2D1Geometry; + +typedef struct ID2D1GeometryVtbl +{ + + ID2D1ResourceVtbl Base; + + + STDMETHOD(GetBounds)( + ID2D1Geometry *This, + __in_opt CONST D2D1_MATRIX_3X2_F *worldTransform, + __out D2D1_RECT_F *bounds + ) PURE; + + STDMETHOD(GetWidenedBounds)( + ID2D1Geometry *This, + FLOAT strokeWidth, + __in_opt ID2D1StrokeStyle *strokeStyle, + __in_opt CONST D2D1_MATRIX_3X2_F *worldTransform, + FLOAT flatteningTolerance, + __out D2D1_RECT_F *bounds + ) PURE; + + STDMETHOD(StrokeContainsPoint)( + ID2D1Geometry *This, + D2D1_POINT_2F point, + FLOAT strokeWidth, + __in_opt ID2D1StrokeStyle *strokeStyle, + __in_opt CONST D2D1_MATRIX_3X2_F *worldTransform, + FLOAT flatteningTolerance, + __out BOOL *contains + ) PURE; + + STDMETHOD(FillContainsPoint)( + ID2D1Geometry *This, + D2D1_POINT_2F point, + __in_opt CONST D2D1_MATRIX_3X2_F *worldTransform, + FLOAT flatteningTolerance, + __out BOOL *contains + ) PURE; + + STDMETHOD(CompareWithGeometry)( + ID2D1Geometry *This, + __in ID2D1Geometry *inputGeometry, + __in_opt CONST D2D1_MATRIX_3X2_F *inputGeometryTransform, + FLOAT flatteningTolerance, + __out D2D1_GEOMETRY_RELATION *relation + ) PURE; + + STDMETHOD(Simplify)( + ID2D1Geometry *This, + D2D1_GEOMETRY_SIMPLIFICATION_OPTION simplificationOption, + __in_opt CONST D2D1_MATRIX_3X2_F *worldTransform, + FLOAT flatteningTolerance, + __in ID2D1SimplifiedGeometrySink *geometrySink + ) PURE; + + STDMETHOD(Tessellate)( + ID2D1Geometry *This, + __in_opt CONST D2D1_MATRIX_3X2_F *worldTransform, + FLOAT flatteningTolerance, + __in ID2D1TessellationSink *tessellationSink + ) PURE; + + STDMETHOD(CombineWithGeometry)( + ID2D1Geometry *This, + __in ID2D1Geometry *inputGeometry, + D2D1_COMBINE_MODE combineMode, + __in_opt CONST D2D1_MATRIX_3X2_F *inputGeometryTransform, + FLOAT flatteningTolerance, + __in ID2D1SimplifiedGeometrySink *geometrySink + ) PURE; + + STDMETHOD(Outline)( + ID2D1Geometry *This, + __in_opt CONST D2D1_MATRIX_3X2_F *worldTransform, + FLOAT flatteningTolerance, + __in ID2D1SimplifiedGeometrySink *geometrySink + ) PURE; + + STDMETHOD(ComputeArea)( + ID2D1Geometry *This, + __in_opt CONST D2D1_MATRIX_3X2_F *worldTransform, + FLOAT flatteningTolerance, + __out FLOAT *area + ) PURE; + + STDMETHOD(ComputeLength)( + ID2D1Geometry *This, + __in_opt CONST D2D1_MATRIX_3X2_F *worldTransform, + FLOAT flatteningTolerance, + __out FLOAT *length + ) PURE; + + STDMETHOD(ComputePointAtLength)( + ID2D1Geometry *This, + FLOAT length, + __in_opt CONST D2D1_MATRIX_3X2_F *worldTransform, + FLOAT flatteningTolerance, + __out_opt D2D1_POINT_2F *point, + __out_opt D2D1_POINT_2F *unitTangentVector + ) PURE; + + STDMETHOD(Widen)( + ID2D1Geometry *This, + FLOAT strokeWidth, + __in_opt ID2D1StrokeStyle *strokeStyle, + __in_opt CONST D2D1_MATRIX_3X2_F *worldTransform, + FLOAT flatteningTolerance, + __in ID2D1SimplifiedGeometrySink *geometrySink + ) PURE; +} ID2D1GeometryVtbl; + +interface ID2D1Geometry +{ + CONST struct ID2D1GeometryVtbl *lpVtbl; +}; + + +#define ID2D1Geometry_QueryInterface(This, riid, ppv) \ + ((This)->lpVtbl->Base.Base.QueryInterface((IUnknown *)This, riid, ppv)) + +#define ID2D1Geometry_AddRef(This) \ + ((This)->lpVtbl->Base.Base.AddRef((IUnknown *)This)) + +#define ID2D1Geometry_Release(This) \ + ((This)->lpVtbl->Base.Base.Release((IUnknown *)This)) + +#define ID2D1Geometry_GetFactory(This, factory) \ + ((This)->lpVtbl->Base.GetFactory((ID2D1Resource *)This, factory)) + +#define ID2D1Geometry_GetBounds(This, worldTransform, bounds) \ + ((This)->lpVtbl->GetBounds(This, worldTransform, bounds)) + +#define ID2D1Geometry_GetWidenedBounds(This, strokeWidth, strokeStyle, worldTransform, flatteningTolerance, bounds) \ + ((This)->lpVtbl->GetWidenedBounds(This, strokeWidth, strokeStyle, worldTransform, flatteningTolerance, bounds)) + +#define ID2D1Geometry_StrokeContainsPoint(This, point, strokeWidth, strokeStyle, worldTransform, flatteningTolerance, contains) \ + ((This)->lpVtbl->StrokeContainsPoint(This, point, strokeWidth, strokeStyle, worldTransform, flatteningTolerance, contains)) + +#define ID2D1Geometry_FillContainsPoint(This, point, worldTransform, flatteningTolerance, contains) \ + ((This)->lpVtbl->FillContainsPoint(This, point, worldTransform, flatteningTolerance, contains)) + +#define ID2D1Geometry_CompareWithGeometry(This, inputGeometry, inputGeometryTransform, flatteningTolerance, relation) \ + ((This)->lpVtbl->CompareWithGeometry(This, inputGeometry, inputGeometryTransform, flatteningTolerance, relation)) + +#define ID2D1Geometry_Simplify(This, simplificationOption, worldTransform, flatteningTolerance, geometrySink) \ + ((This)->lpVtbl->Simplify(This, simplificationOption, worldTransform, flatteningTolerance, geometrySink)) + +#define ID2D1Geometry_Tessellate(This, worldTransform, flatteningTolerance, tessellationSink) \ + ((This)->lpVtbl->Tessellate(This, worldTransform, flatteningTolerance, tessellationSink)) + +#define ID2D1Geometry_CombineWithGeometry(This, inputGeometry, combineMode, inputGeometryTransform, flatteningTolerance, geometrySink) \ + ((This)->lpVtbl->CombineWithGeometry(This, inputGeometry, combineMode, inputGeometryTransform, flatteningTolerance, geometrySink)) + +#define ID2D1Geometry_Outline(This, worldTransform, flatteningTolerance, geometrySink) \ + ((This)->lpVtbl->Outline(This, worldTransform, flatteningTolerance, geometrySink)) + +#define ID2D1Geometry_ComputeArea(This, worldTransform, flatteningTolerance, area) \ + ((This)->lpVtbl->ComputeArea(This, worldTransform, flatteningTolerance, area)) + +#define ID2D1Geometry_ComputeLength(This, worldTransform, flatteningTolerance, length) \ + ((This)->lpVtbl->ComputeLength(This, worldTransform, flatteningTolerance, length)) + +#define ID2D1Geometry_ComputePointAtLength(This, length, worldTransform, flatteningTolerance, point, unitTangentVector) \ + ((This)->lpVtbl->ComputePointAtLength(This, length, worldTransform, flatteningTolerance, point, unitTangentVector)) + +#define ID2D1Geometry_Widen(This, strokeWidth, strokeStyle, worldTransform, flatteningTolerance, geometrySink) \ + ((This)->lpVtbl->Widen(This, strokeWidth, strokeStyle, worldTransform, flatteningTolerance, geometrySink)) + +typedef interface ID2D1RectangleGeometry ID2D1RectangleGeometry; + +typedef struct ID2D1RectangleGeometryVtbl +{ + + ID2D1GeometryVtbl Base; + + + STDMETHOD_(void, GetRect)( + ID2D1RectangleGeometry *This, + __out D2D1_RECT_F *rect + ) PURE; +} ID2D1RectangleGeometryVtbl; + +interface ID2D1RectangleGeometry +{ + CONST struct ID2D1RectangleGeometryVtbl *lpVtbl; +}; + + +#define ID2D1RectangleGeometry_QueryInterface(This, riid, ppv) \ + ((This)->lpVtbl->Base.Base.Base.QueryInterface((IUnknown *)This, riid, ppv)) + +#define ID2D1RectangleGeometry_AddRef(This) \ + ((This)->lpVtbl->Base.Base.Base.AddRef((IUnknown *)This)) + +#define ID2D1RectangleGeometry_Release(This) \ + ((This)->lpVtbl->Base.Base.Base.Release((IUnknown *)This)) + +#define ID2D1RectangleGeometry_GetFactory(This, factory) \ + ((This)->lpVtbl->Base.Base.GetFactory((ID2D1Resource *)This, factory)) + +#define ID2D1RectangleGeometry_GetBounds(This, worldTransform, bounds) \ + ((This)->lpVtbl->Base.GetBounds((ID2D1Geometry *)This, worldTransform, bounds)) + +#define ID2D1RectangleGeometry_GetWidenedBounds(This, strokeWidth, strokeStyle, worldTransform, flatteningTolerance, bounds) \ + ((This)->lpVtbl->Base.GetWidenedBounds((ID2D1Geometry *)This, strokeWidth, strokeStyle, worldTransform, flatteningTolerance, bounds)) + +#define ID2D1RectangleGeometry_StrokeContainsPoint(This, point, strokeWidth, strokeStyle, worldTransform, flatteningTolerance, contains) \ + ((This)->lpVtbl->Base.StrokeContainsPoint((ID2D1Geometry *)This, point, strokeWidth, strokeStyle, worldTransform, flatteningTolerance, contains)) + +#define ID2D1RectangleGeometry_FillContainsPoint(This, point, worldTransform, flatteningTolerance, contains) \ + ((This)->lpVtbl->Base.FillContainsPoint((ID2D1Geometry *)This, point, worldTransform, flatteningTolerance, contains)) + +#define ID2D1RectangleGeometry_CompareWithGeometry(This, inputGeometry, inputGeometryTransform, flatteningTolerance, relation) \ + ((This)->lpVtbl->Base.CompareWithGeometry((ID2D1Geometry *)This, inputGeometry, inputGeometryTransform, flatteningTolerance, relation)) + +#define ID2D1RectangleGeometry_Simplify(This, simplificationOption, worldTransform, flatteningTolerance, geometrySink) \ + ((This)->lpVtbl->Base.Simplify((ID2D1Geometry *)This, simplificationOption, worldTransform, flatteningTolerance, geometrySink)) + +#define ID2D1RectangleGeometry_Tessellate(This, worldTransform, flatteningTolerance, tessellationSink) \ + ((This)->lpVtbl->Base.Tessellate((ID2D1Geometry *)This, worldTransform, flatteningTolerance, tessellationSink)) + +#define ID2D1RectangleGeometry_CombineWithGeometry(This, inputGeometry, combineMode, inputGeometryTransform, flatteningTolerance, geometrySink) \ + ((This)->lpVtbl->Base.CombineWithGeometry((ID2D1Geometry *)This, inputGeometry, combineMode, inputGeometryTransform, flatteningTolerance, geometrySink)) + +#define ID2D1RectangleGeometry_Outline(This, worldTransform, flatteningTolerance, geometrySink) \ + ((This)->lpVtbl->Base.Outline((ID2D1Geometry *)This, worldTransform, flatteningTolerance, geometrySink)) + +#define ID2D1RectangleGeometry_ComputeArea(This, worldTransform, flatteningTolerance, area) \ + ((This)->lpVtbl->Base.ComputeArea((ID2D1Geometry *)This, worldTransform, flatteningTolerance, area)) + +#define ID2D1RectangleGeometry_ComputeLength(This, worldTransform, flatteningTolerance, length) \ + ((This)->lpVtbl->Base.ComputeLength((ID2D1Geometry *)This, worldTransform, flatteningTolerance, length)) + +#define ID2D1RectangleGeometry_ComputePointAtLength(This, length, worldTransform, flatteningTolerance, point, unitTangentVector) \ + ((This)->lpVtbl->Base.ComputePointAtLength((ID2D1Geometry *)This, length, worldTransform, flatteningTolerance, point, unitTangentVector)) + +#define ID2D1RectangleGeometry_Widen(This, strokeWidth, strokeStyle, worldTransform, flatteningTolerance, geometrySink) \ + ((This)->lpVtbl->Base.Widen((ID2D1Geometry *)This, strokeWidth, strokeStyle, worldTransform, flatteningTolerance, geometrySink)) + +#define ID2D1RectangleGeometry_GetRect(This, rect) \ + ((This)->lpVtbl->GetRect(This, rect)) + +typedef interface ID2D1RoundedRectangleGeometry ID2D1RoundedRectangleGeometry; + +typedef struct ID2D1RoundedRectangleGeometryVtbl +{ + + ID2D1GeometryVtbl Base; + + + STDMETHOD_(void, GetRoundedRect)( + ID2D1RoundedRectangleGeometry *This, + __out D2D1_ROUNDED_RECT *roundedRect + ) PURE; +} ID2D1RoundedRectangleGeometryVtbl; + +interface ID2D1RoundedRectangleGeometry +{ + CONST struct ID2D1RoundedRectangleGeometryVtbl *lpVtbl; +}; + + +#define ID2D1RoundedRectangleGeometry_QueryInterface(This, riid, ppv) \ + ((This)->lpVtbl->Base.Base.Base.QueryInterface((IUnknown *)This, riid, ppv)) + +#define ID2D1RoundedRectangleGeometry_AddRef(This) \ + ((This)->lpVtbl->Base.Base.Base.AddRef((IUnknown *)This)) + +#define ID2D1RoundedRectangleGeometry_Release(This) \ + ((This)->lpVtbl->Base.Base.Base.Release((IUnknown *)This)) + +#define ID2D1RoundedRectangleGeometry_GetFactory(This, factory) \ + ((This)->lpVtbl->Base.Base.GetFactory((ID2D1Resource *)This, factory)) + +#define ID2D1RoundedRectangleGeometry_GetBounds(This, worldTransform, bounds) \ + ((This)->lpVtbl->Base.GetBounds((ID2D1Geometry *)This, worldTransform, bounds)) + +#define ID2D1RoundedRectangleGeometry_GetWidenedBounds(This, strokeWidth, strokeStyle, worldTransform, flatteningTolerance, bounds) \ + ((This)->lpVtbl->Base.GetWidenedBounds((ID2D1Geometry *)This, strokeWidth, strokeStyle, worldTransform, flatteningTolerance, bounds)) + +#define ID2D1RoundedRectangleGeometry_StrokeContainsPoint(This, point, strokeWidth, strokeStyle, worldTransform, flatteningTolerance, contains) \ + ((This)->lpVtbl->Base.StrokeContainsPoint((ID2D1Geometry *)This, point, strokeWidth, strokeStyle, worldTransform, flatteningTolerance, contains)) + +#define ID2D1RoundedRectangleGeometry_FillContainsPoint(This, point, worldTransform, flatteningTolerance, contains) \ + ((This)->lpVtbl->Base.FillContainsPoint((ID2D1Geometry *)This, point, worldTransform, flatteningTolerance, contains)) + +#define ID2D1RoundedRectangleGeometry_CompareWithGeometry(This, inputGeometry, inputGeometryTransform, flatteningTolerance, relation) \ + ((This)->lpVtbl->Base.CompareWithGeometry((ID2D1Geometry *)This, inputGeometry, inputGeometryTransform, flatteningTolerance, relation)) + +#define ID2D1RoundedRectangleGeometry_Simplify(This, simplificationOption, worldTransform, flatteningTolerance, geometrySink) \ + ((This)->lpVtbl->Base.Simplify((ID2D1Geometry *)This, simplificationOption, worldTransform, flatteningTolerance, geometrySink)) + +#define ID2D1RoundedRectangleGeometry_Tessellate(This, worldTransform, flatteningTolerance, tessellationSink) \ + ((This)->lpVtbl->Base.Tessellate((ID2D1Geometry *)This, worldTransform, flatteningTolerance, tessellationSink)) + +#define ID2D1RoundedRectangleGeometry_CombineWithGeometry(This, inputGeometry, combineMode, inputGeometryTransform, flatteningTolerance, geometrySink) \ + ((This)->lpVtbl->Base.CombineWithGeometry((ID2D1Geometry *)This, inputGeometry, combineMode, inputGeometryTransform, flatteningTolerance, geometrySink)) + +#define ID2D1RoundedRectangleGeometry_Outline(This, worldTransform, flatteningTolerance, geometrySink) \ + ((This)->lpVtbl->Base.Outline((ID2D1Geometry *)This, worldTransform, flatteningTolerance, geometrySink)) + +#define ID2D1RoundedRectangleGeometry_ComputeArea(This, worldTransform, flatteningTolerance, area) \ + ((This)->lpVtbl->Base.ComputeArea((ID2D1Geometry *)This, worldTransform, flatteningTolerance, area)) + +#define ID2D1RoundedRectangleGeometry_ComputeLength(This, worldTransform, flatteningTolerance, length) \ + ((This)->lpVtbl->Base.ComputeLength((ID2D1Geometry *)This, worldTransform, flatteningTolerance, length)) + +#define ID2D1RoundedRectangleGeometry_ComputePointAtLength(This, length, worldTransform, flatteningTolerance, point, unitTangentVector) \ + ((This)->lpVtbl->Base.ComputePointAtLength((ID2D1Geometry *)This, length, worldTransform, flatteningTolerance, point, unitTangentVector)) + +#define ID2D1RoundedRectangleGeometry_Widen(This, strokeWidth, strokeStyle, worldTransform, flatteningTolerance, geometrySink) \ + ((This)->lpVtbl->Base.Widen((ID2D1Geometry *)This, strokeWidth, strokeStyle, worldTransform, flatteningTolerance, geometrySink)) + +#define ID2D1RoundedRectangleGeometry_GetRoundedRect(This, roundedRect) \ + ((This)->lpVtbl->GetRoundedRect(This, roundedRect)) + +typedef interface ID2D1EllipseGeometry ID2D1EllipseGeometry; + +typedef struct ID2D1EllipseGeometryVtbl +{ + + ID2D1GeometryVtbl Base; + + + STDMETHOD_(void, GetEllipse)( + ID2D1EllipseGeometry *This, + __out D2D1_ELLIPSE *ellipse + ) PURE; +} ID2D1EllipseGeometryVtbl; + +interface ID2D1EllipseGeometry +{ + CONST struct ID2D1EllipseGeometryVtbl *lpVtbl; +}; + + +#define ID2D1EllipseGeometry_QueryInterface(This, riid, ppv) \ + ((This)->lpVtbl->Base.Base.Base.QueryInterface((IUnknown *)This, riid, ppv)) + +#define ID2D1EllipseGeometry_AddRef(This) \ + ((This)->lpVtbl->Base.Base.Base.AddRef((IUnknown *)This)) + +#define ID2D1EllipseGeometry_Release(This) \ + ((This)->lpVtbl->Base.Base.Base.Release((IUnknown *)This)) + +#define ID2D1EllipseGeometry_GetFactory(This, factory) \ + ((This)->lpVtbl->Base.Base.GetFactory((ID2D1Resource *)This, factory)) + +#define ID2D1EllipseGeometry_GetBounds(This, worldTransform, bounds) \ + ((This)->lpVtbl->Base.GetBounds((ID2D1Geometry *)This, worldTransform, bounds)) + +#define ID2D1EllipseGeometry_GetWidenedBounds(This, strokeWidth, strokeStyle, worldTransform, flatteningTolerance, bounds) \ + ((This)->lpVtbl->Base.GetWidenedBounds((ID2D1Geometry *)This, strokeWidth, strokeStyle, worldTransform, flatteningTolerance, bounds)) + +#define ID2D1EllipseGeometry_StrokeContainsPoint(This, point, strokeWidth, strokeStyle, worldTransform, flatteningTolerance, contains) \ + ((This)->lpVtbl->Base.StrokeContainsPoint((ID2D1Geometry *)This, point, strokeWidth, strokeStyle, worldTransform, flatteningTolerance, contains)) + +#define ID2D1EllipseGeometry_FillContainsPoint(This, point, worldTransform, flatteningTolerance, contains) \ + ((This)->lpVtbl->Base.FillContainsPoint((ID2D1Geometry *)This, point, worldTransform, flatteningTolerance, contains)) + +#define ID2D1EllipseGeometry_CompareWithGeometry(This, inputGeometry, inputGeometryTransform, flatteningTolerance, relation) \ + ((This)->lpVtbl->Base.CompareWithGeometry((ID2D1Geometry *)This, inputGeometry, inputGeometryTransform, flatteningTolerance, relation)) + +#define ID2D1EllipseGeometry_Simplify(This, simplificationOption, worldTransform, flatteningTolerance, geometrySink) \ + ((This)->lpVtbl->Base.Simplify((ID2D1Geometry *)This, simplificationOption, worldTransform, flatteningTolerance, geometrySink)) + +#define ID2D1EllipseGeometry_Tessellate(This, worldTransform, flatteningTolerance, tessellationSink) \ + ((This)->lpVtbl->Base.Tessellate((ID2D1Geometry *)This, worldTransform, flatteningTolerance, tessellationSink)) + +#define ID2D1EllipseGeometry_CombineWithGeometry(This, inputGeometry, combineMode, inputGeometryTransform, flatteningTolerance, geometrySink) \ + ((This)->lpVtbl->Base.CombineWithGeometry((ID2D1Geometry *)This, inputGeometry, combineMode, inputGeometryTransform, flatteningTolerance, geometrySink)) + +#define ID2D1EllipseGeometry_Outline(This, worldTransform, flatteningTolerance, geometrySink) \ + ((This)->lpVtbl->Base.Outline((ID2D1Geometry *)This, worldTransform, flatteningTolerance, geometrySink)) + +#define ID2D1EllipseGeometry_ComputeArea(This, worldTransform, flatteningTolerance, area) \ + ((This)->lpVtbl->Base.ComputeArea((ID2D1Geometry *)This, worldTransform, flatteningTolerance, area)) + +#define ID2D1EllipseGeometry_ComputeLength(This, worldTransform, flatteningTolerance, length) \ + ((This)->lpVtbl->Base.ComputeLength((ID2D1Geometry *)This, worldTransform, flatteningTolerance, length)) + +#define ID2D1EllipseGeometry_ComputePointAtLength(This, length, worldTransform, flatteningTolerance, point, unitTangentVector) \ + ((This)->lpVtbl->Base.ComputePointAtLength((ID2D1Geometry *)This, length, worldTransform, flatteningTolerance, point, unitTangentVector)) + +#define ID2D1EllipseGeometry_Widen(This, strokeWidth, strokeStyle, worldTransform, flatteningTolerance, geometrySink) \ + ((This)->lpVtbl->Base.Widen((ID2D1Geometry *)This, strokeWidth, strokeStyle, worldTransform, flatteningTolerance, geometrySink)) + +#define ID2D1EllipseGeometry_GetEllipse(This, ellipse) \ + ((This)->lpVtbl->GetEllipse(This, ellipse)) + +typedef interface ID2D1GeometryGroup ID2D1GeometryGroup; + +typedef struct ID2D1GeometryGroupVtbl +{ + + ID2D1GeometryVtbl Base; + + + STDMETHOD_(D2D1_FILL_MODE, GetFillMode)( + ID2D1GeometryGroup *This + ) PURE; + + STDMETHOD_(UINT32, GetSourceGeometryCount)( + ID2D1GeometryGroup *This + ) PURE; + + STDMETHOD_(void, GetSourceGeometries)( + ID2D1GeometryGroup *This, + __out_ecount(geometriesCount) ID2D1Geometry **geometries, + UINT geometriesCount + ) PURE; +} ID2D1GeometryGroupVtbl; + +interface ID2D1GeometryGroup +{ + CONST struct ID2D1GeometryGroupVtbl *lpVtbl; +}; + + +#define ID2D1GeometryGroup_QueryInterface(This, riid, ppv) \ + ((This)->lpVtbl->Base.Base.Base.QueryInterface((IUnknown *)This, riid, ppv)) + +#define ID2D1GeometryGroup_AddRef(This) \ + ((This)->lpVtbl->Base.Base.Base.AddRef((IUnknown *)This)) + +#define ID2D1GeometryGroup_Release(This) \ + ((This)->lpVtbl->Base.Base.Base.Release((IUnknown *)This)) + +#define ID2D1GeometryGroup_GetFactory(This, factory) \ + ((This)->lpVtbl->Base.Base.GetFactory((ID2D1Resource *)This, factory)) + +#define ID2D1GeometryGroup_GetBounds(This, worldTransform, bounds) \ + ((This)->lpVtbl->Base.GetBounds((ID2D1Geometry *)This, worldTransform, bounds)) + +#define ID2D1GeometryGroup_GetWidenedBounds(This, strokeWidth, strokeStyle, worldTransform, flatteningTolerance, bounds) \ + ((This)->lpVtbl->Base.GetWidenedBounds((ID2D1Geometry *)This, strokeWidth, strokeStyle, worldTransform, flatteningTolerance, bounds)) + +#define ID2D1GeometryGroup_StrokeContainsPoint(This, point, strokeWidth, strokeStyle, worldTransform, flatteningTolerance, contains) \ + ((This)->lpVtbl->Base.StrokeContainsPoint((ID2D1Geometry *)This, point, strokeWidth, strokeStyle, worldTransform, flatteningTolerance, contains)) + +#define ID2D1GeometryGroup_FillContainsPoint(This, point, worldTransform, flatteningTolerance, contains) \ + ((This)->lpVtbl->Base.FillContainsPoint((ID2D1Geometry *)This, point, worldTransform, flatteningTolerance, contains)) + +#define ID2D1GeometryGroup_CompareWithGeometry(This, inputGeometry, inputGeometryTransform, flatteningTolerance, relation) \ + ((This)->lpVtbl->Base.CompareWithGeometry((ID2D1Geometry *)This, inputGeometry, inputGeometryTransform, flatteningTolerance, relation)) + +#define ID2D1GeometryGroup_Simplify(This, simplificationOption, worldTransform, flatteningTolerance, geometrySink) \ + ((This)->lpVtbl->Base.Simplify((ID2D1Geometry *)This, simplificationOption, worldTransform, flatteningTolerance, geometrySink)) + +#define ID2D1GeometryGroup_Tessellate(This, worldTransform, flatteningTolerance, tessellationSink) \ + ((This)->lpVtbl->Base.Tessellate((ID2D1Geometry *)This, worldTransform, flatteningTolerance, tessellationSink)) + +#define ID2D1GeometryGroup_CombineWithGeometry(This, inputGeometry, combineMode, inputGeometryTransform, flatteningTolerance, geometrySink) \ + ((This)->lpVtbl->Base.CombineWithGeometry((ID2D1Geometry *)This, inputGeometry, combineMode, inputGeometryTransform, flatteningTolerance, geometrySink)) + +#define ID2D1GeometryGroup_Outline(This, worldTransform, flatteningTolerance, geometrySink) \ + ((This)->lpVtbl->Base.Outline((ID2D1Geometry *)This, worldTransform, flatteningTolerance, geometrySink)) + +#define ID2D1GeometryGroup_ComputeArea(This, worldTransform, flatteningTolerance, area) \ + ((This)->lpVtbl->Base.ComputeArea((ID2D1Geometry *)This, worldTransform, flatteningTolerance, area)) + +#define ID2D1GeometryGroup_ComputeLength(This, worldTransform, flatteningTolerance, length) \ + ((This)->lpVtbl->Base.ComputeLength((ID2D1Geometry *)This, worldTransform, flatteningTolerance, length)) + +#define ID2D1GeometryGroup_ComputePointAtLength(This, length, worldTransform, flatteningTolerance, point, unitTangentVector) \ + ((This)->lpVtbl->Base.ComputePointAtLength((ID2D1Geometry *)This, length, worldTransform, flatteningTolerance, point, unitTangentVector)) + +#define ID2D1GeometryGroup_Widen(This, strokeWidth, strokeStyle, worldTransform, flatteningTolerance, geometrySink) \ + ((This)->lpVtbl->Base.Widen((ID2D1Geometry *)This, strokeWidth, strokeStyle, worldTransform, flatteningTolerance, geometrySink)) + +#define ID2D1GeometryGroup_GetFillMode(This) \ + ((This)->lpVtbl->GetFillMode(This)) + +#define ID2D1GeometryGroup_GetSourceGeometryCount(This) \ + ((This)->lpVtbl->GetSourceGeometryCount(This)) + +#define ID2D1GeometryGroup_GetSourceGeometries(This, geometries, geometriesCount) \ + ((This)->lpVtbl->GetSourceGeometries(This, geometries, geometriesCount)) + +typedef interface ID2D1TransformedGeometry ID2D1TransformedGeometry; + +typedef struct ID2D1TransformedGeometryVtbl +{ + + ID2D1GeometryVtbl Base; + + + STDMETHOD_(void, GetSourceGeometry)( + ID2D1TransformedGeometry *This, + __deref_out ID2D1Geometry **sourceGeometry + ) PURE; + + STDMETHOD_(void, GetTransform)( + ID2D1TransformedGeometry *This, + __out D2D1_MATRIX_3X2_F *transform + ) PURE; +} ID2D1TransformedGeometryVtbl; + +interface ID2D1TransformedGeometry +{ + CONST struct ID2D1TransformedGeometryVtbl *lpVtbl; +}; + + +#define ID2D1TransformedGeometry_QueryInterface(This, riid, ppv) \ + ((This)->lpVtbl->Base.Base.Base.QueryInterface((IUnknown *)This, riid, ppv)) + +#define ID2D1TransformedGeometry_AddRef(This) \ + ((This)->lpVtbl->Base.Base.Base.AddRef((IUnknown *)This)) + +#define ID2D1TransformedGeometry_Release(This) \ + ((This)->lpVtbl->Base.Base.Base.Release((IUnknown *)This)) + +#define ID2D1TransformedGeometry_GetFactory(This, factory) \ + ((This)->lpVtbl->Base.Base.GetFactory((ID2D1Resource *)This, factory)) + +#define ID2D1TransformedGeometry_GetBounds(This, worldTransform, bounds) \ + ((This)->lpVtbl->Base.GetBounds((ID2D1Geometry *)This, worldTransform, bounds)) + +#define ID2D1TransformedGeometry_GetWidenedBounds(This, strokeWidth, strokeStyle, worldTransform, flatteningTolerance, bounds) \ + ((This)->lpVtbl->Base.GetWidenedBounds((ID2D1Geometry *)This, strokeWidth, strokeStyle, worldTransform, flatteningTolerance, bounds)) + +#define ID2D1TransformedGeometry_StrokeContainsPoint(This, point, strokeWidth, strokeStyle, worldTransform, flatteningTolerance, contains) \ + ((This)->lpVtbl->Base.StrokeContainsPoint((ID2D1Geometry *)This, point, strokeWidth, strokeStyle, worldTransform, flatteningTolerance, contains)) + +#define ID2D1TransformedGeometry_FillContainsPoint(This, point, worldTransform, flatteningTolerance, contains) \ + ((This)->lpVtbl->Base.FillContainsPoint((ID2D1Geometry *)This, point, worldTransform, flatteningTolerance, contains)) + +#define ID2D1TransformedGeometry_CompareWithGeometry(This, inputGeometry, inputGeometryTransform, flatteningTolerance, relation) \ + ((This)->lpVtbl->Base.CompareWithGeometry((ID2D1Geometry *)This, inputGeometry, inputGeometryTransform, flatteningTolerance, relation)) + +#define ID2D1TransformedGeometry_Simplify(This, simplificationOption, worldTransform, flatteningTolerance, geometrySink) \ + ((This)->lpVtbl->Base.Simplify((ID2D1Geometry *)This, simplificationOption, worldTransform, flatteningTolerance, geometrySink)) + +#define ID2D1TransformedGeometry_Tessellate(This, worldTransform, flatteningTolerance, tessellationSink) \ + ((This)->lpVtbl->Base.Tessellate((ID2D1Geometry *)This, worldTransform, flatteningTolerance, tessellationSink)) + +#define ID2D1TransformedGeometry_CombineWithGeometry(This, inputGeometry, combineMode, inputGeometryTransform, flatteningTolerance, geometrySink) \ + ((This)->lpVtbl->Base.CombineWithGeometry((ID2D1Geometry *)This, inputGeometry, combineMode, inputGeometryTransform, flatteningTolerance, geometrySink)) + +#define ID2D1TransformedGeometry_Outline(This, worldTransform, flatteningTolerance, geometrySink) \ + ((This)->lpVtbl->Base.Outline((ID2D1Geometry *)This, worldTransform, flatteningTolerance, geometrySink)) + +#define ID2D1TransformedGeometry_ComputeArea(This, worldTransform, flatteningTolerance, area) \ + ((This)->lpVtbl->Base.ComputeArea((ID2D1Geometry *)This, worldTransform, flatteningTolerance, area)) + +#define ID2D1TransformedGeometry_ComputeLength(This, worldTransform, flatteningTolerance, length) \ + ((This)->lpVtbl->Base.ComputeLength((ID2D1Geometry *)This, worldTransform, flatteningTolerance, length)) + +#define ID2D1TransformedGeometry_ComputePointAtLength(This, length, worldTransform, flatteningTolerance, point, unitTangentVector) \ + ((This)->lpVtbl->Base.ComputePointAtLength((ID2D1Geometry *)This, length, worldTransform, flatteningTolerance, point, unitTangentVector)) + +#define ID2D1TransformedGeometry_Widen(This, strokeWidth, strokeStyle, worldTransform, flatteningTolerance, geometrySink) \ + ((This)->lpVtbl->Base.Widen((ID2D1Geometry *)This, strokeWidth, strokeStyle, worldTransform, flatteningTolerance, geometrySink)) + +#define ID2D1TransformedGeometry_GetSourceGeometry(This, sourceGeometry) \ + ((This)->lpVtbl->GetSourceGeometry(This, sourceGeometry)) + +#define ID2D1TransformedGeometry_GetTransform(This, transform) \ + ((This)->lpVtbl->GetTransform(This, transform)) + +typedef interface ID2D1SimplifiedGeometrySink ID2D1SimplifiedGeometrySink; + +typedef struct ID2D1SimplifiedGeometrySinkVtbl +{ + + IUnknownVtbl Base; + + + STDMETHOD_(void, SetFillMode)( + ID2D1SimplifiedGeometrySink *This, + D2D1_FILL_MODE fillMode + ) PURE; + + STDMETHOD_(void, SetSegmentFlags)( + ID2D1SimplifiedGeometrySink *This, + D2D1_PATH_SEGMENT vertexFlags + ) PURE; + + STDMETHOD_(void, BeginFigure)( + ID2D1SimplifiedGeometrySink *This, + D2D1_POINT_2F startPoint, + D2D1_FIGURE_BEGIN figureBegin + ) PURE; + + STDMETHOD_(void, AddLines)( + ID2D1SimplifiedGeometrySink *This, + __in_ecount(pointsCount) CONST D2D1_POINT_2F *points, + UINT pointsCount + ) PURE; + + STDMETHOD_(void, AddBeziers)( + ID2D1SimplifiedGeometrySink *This, + __in_ecount(beziersCount) CONST D2D1_BEZIER_SEGMENT *beziers, + UINT beziersCount + ) PURE; + + STDMETHOD_(void, EndFigure)( + ID2D1SimplifiedGeometrySink *This, + D2D1_FIGURE_END figureEnd + ) PURE; + + STDMETHOD(Close)( + ID2D1SimplifiedGeometrySink *This + ) PURE; +} ID2D1SimplifiedGeometrySinkVtbl; + +interface ID2D1SimplifiedGeometrySink +{ + CONST struct ID2D1SimplifiedGeometrySinkVtbl *lpVtbl; +}; + + +#define ID2D1SimplifiedGeometrySink_QueryInterface(This, riid, ppv) \ + ((This)->lpVtbl->Base.QueryInterface((IUnknown *)This, riid, ppv)) + +#define ID2D1SimplifiedGeometrySink_AddRef(This) \ + ((This)->lpVtbl->Base.AddRef((IUnknown *)This)) + +#define ID2D1SimplifiedGeometrySink_Release(This) \ + ((This)->lpVtbl->Base.Release((IUnknown *)This)) + +#define ID2D1SimplifiedGeometrySink_SetFillMode(This, fillMode) \ + ((This)->lpVtbl->SetFillMode(This, fillMode)) + +#define ID2D1SimplifiedGeometrySink_SetSegmentFlags(This, vertexFlags) \ + ((This)->lpVtbl->SetSegmentFlags(This, vertexFlags)) + +#define ID2D1SimplifiedGeometrySink_BeginFigure(This, startPoint, figureBegin) \ + ((This)->lpVtbl->BeginFigure(This, startPoint, figureBegin)) + +#define ID2D1SimplifiedGeometrySink_AddLines(This, points, pointsCount) \ + ((This)->lpVtbl->AddLines(This, points, pointsCount)) + +#define ID2D1SimplifiedGeometrySink_AddBeziers(This, beziers, beziersCount) \ + ((This)->lpVtbl->AddBeziers(This, beziers, beziersCount)) + +#define ID2D1SimplifiedGeometrySink_EndFigure(This, figureEnd) \ + ((This)->lpVtbl->EndFigure(This, figureEnd)) + +#define ID2D1SimplifiedGeometrySink_Close(This) \ + ((This)->lpVtbl->Close(This)) + +typedef interface ID2D1GeometrySink ID2D1GeometrySink; + +typedef struct ID2D1GeometrySinkVtbl +{ + + ID2D1SimplifiedGeometrySinkVtbl Base; + + + STDMETHOD_(void, AddLine)( + ID2D1GeometrySink *This, + D2D1_POINT_2F point + ) PURE; + + STDMETHOD_(void, AddBezier)( + ID2D1GeometrySink *This, + __in CONST D2D1_BEZIER_SEGMENT *bezier + ) PURE; + + STDMETHOD_(void, AddQuadraticBezier)( + ID2D1GeometrySink *This, + __in CONST D2D1_QUADRATIC_BEZIER_SEGMENT *bezier + ) PURE; + + STDMETHOD_(void, AddQuadraticBeziers)( + ID2D1GeometrySink *This, + __in_ecount(beziersCount) CONST D2D1_QUADRATIC_BEZIER_SEGMENT *beziers, + UINT beziersCount + ) PURE; + + STDMETHOD_(void, AddArc)( + ID2D1GeometrySink *This, + __in CONST D2D1_ARC_SEGMENT *arc + ) PURE; +} ID2D1GeometrySinkVtbl; + +interface ID2D1GeometrySink +{ + CONST struct ID2D1GeometrySinkVtbl *lpVtbl; +}; + + +#define ID2D1GeometrySink_QueryInterface(This, riid, ppv) \ + ((This)->lpVtbl->Base.Base.QueryInterface((IUnknown *)This, riid, ppv)) + +#define ID2D1GeometrySink_AddRef(This) \ + ((This)->lpVtbl->Base.Base.AddRef((IUnknown *)This)) + +#define ID2D1GeometrySink_Release(This) \ + ((This)->lpVtbl->Base.Base.Release((IUnknown *)This)) + +#define ID2D1GeometrySink_SetFillMode(This, fillMode) \ + ((This)->lpVtbl->Base.SetFillMode((ID2D1SimplifiedGeometrySink *)This, fillMode)) + +#define ID2D1GeometrySink_SetSegmentFlags(This, vertexFlags) \ + ((This)->lpVtbl->Base.SetSegmentFlags((ID2D1SimplifiedGeometrySink *)This, vertexFlags)) + +#define ID2D1GeometrySink_BeginFigure(This, startPoint, figureBegin) \ + ((This)->lpVtbl->Base.BeginFigure((ID2D1SimplifiedGeometrySink *)This, startPoint, figureBegin)) + +#define ID2D1GeometrySink_AddLines(This, points, pointsCount) \ + ((This)->lpVtbl->Base.AddLines((ID2D1SimplifiedGeometrySink *)This, points, pointsCount)) + +#define ID2D1GeometrySink_AddBeziers(This, beziers, beziersCount) \ + ((This)->lpVtbl->Base.AddBeziers((ID2D1SimplifiedGeometrySink *)This, beziers, beziersCount)) + +#define ID2D1GeometrySink_EndFigure(This, figureEnd) \ + ((This)->lpVtbl->Base.EndFigure((ID2D1SimplifiedGeometrySink *)This, figureEnd)) + +#define ID2D1GeometrySink_Close(This) \ + ((This)->lpVtbl->Base.Close((ID2D1SimplifiedGeometrySink *)This)) + +#define ID2D1GeometrySink_AddLine(This, point) \ + ((This)->lpVtbl->AddLine(This, point)) + +#define ID2D1GeometrySink_AddBezier(This, bezier) \ + ((This)->lpVtbl->AddBezier(This, bezier)) + +#define ID2D1GeometrySink_AddQuadraticBezier(This, bezier) \ + ((This)->lpVtbl->AddQuadraticBezier(This, bezier)) + +#define ID2D1GeometrySink_AddQuadraticBeziers(This, beziers, beziersCount) \ + ((This)->lpVtbl->AddQuadraticBeziers(This, beziers, beziersCount)) + +#define ID2D1GeometrySink_AddArc(This, arc) \ + ((This)->lpVtbl->AddArc(This, arc)) + +typedef interface ID2D1TessellationSink ID2D1TessellationSink; + +typedef struct ID2D1TessellationSinkVtbl +{ + + IUnknownVtbl Base; + + + STDMETHOD_(void, AddTriangles)( + ID2D1TessellationSink *This, + __in_ecount(trianglesCount) CONST D2D1_TRIANGLE *triangles, + UINT trianglesCount + ) PURE; + + STDMETHOD(Close)( + ID2D1TessellationSink *This + ) PURE; +} ID2D1TessellationSinkVtbl; + +interface ID2D1TessellationSink +{ + CONST struct ID2D1TessellationSinkVtbl *lpVtbl; +}; + + +#define ID2D1TessellationSink_QueryInterface(This, riid, ppv) \ + ((This)->lpVtbl->Base.QueryInterface((IUnknown *)This, riid, ppv)) + +#define ID2D1TessellationSink_AddRef(This) \ + ((This)->lpVtbl->Base.AddRef((IUnknown *)This)) + +#define ID2D1TessellationSink_Release(This) \ + ((This)->lpVtbl->Base.Release((IUnknown *)This)) + +#define ID2D1TessellationSink_AddTriangles(This, triangles, trianglesCount) \ + ((This)->lpVtbl->AddTriangles(This, triangles, trianglesCount)) + +#define ID2D1TessellationSink_Close(This) \ + ((This)->lpVtbl->Close(This)) + +typedef interface ID2D1PathGeometry ID2D1PathGeometry; + +typedef struct ID2D1PathGeometryVtbl +{ + + ID2D1GeometryVtbl Base; + + + STDMETHOD(Open)( + ID2D1PathGeometry *This, + __deref_out ID2D1GeometrySink **geometrySink + ) PURE; + + STDMETHOD(Stream)( + ID2D1PathGeometry *This, + __in ID2D1GeometrySink *geometrySink + ) PURE; + + STDMETHOD(GetSegmentCount)( + ID2D1PathGeometry *This, + __out UINT32 *count + ) PURE; + + STDMETHOD(GetFigureCount)( + ID2D1PathGeometry *This, + __out UINT32 *count + ) PURE; +} ID2D1PathGeometryVtbl; + +interface ID2D1PathGeometry +{ + CONST struct ID2D1PathGeometryVtbl *lpVtbl; +}; + + +#define ID2D1PathGeometry_QueryInterface(This, riid, ppv) \ + ((This)->lpVtbl->Base.Base.Base.QueryInterface((IUnknown *)This, riid, ppv)) + +#define ID2D1PathGeometry_AddRef(This) \ + ((This)->lpVtbl->Base.Base.Base.AddRef((IUnknown *)This)) + +#define ID2D1PathGeometry_Release(This) \ + ((This)->lpVtbl->Base.Base.Base.Release((IUnknown *)This)) + +#define ID2D1PathGeometry_GetFactory(This, factory) \ + ((This)->lpVtbl->Base.Base.GetFactory((ID2D1Resource *)This, factory)) + +#define ID2D1PathGeometry_GetBounds(This, worldTransform, bounds) \ + ((This)->lpVtbl->Base.GetBounds((ID2D1Geometry *)This, worldTransform, bounds)) + +#define ID2D1PathGeometry_GetWidenedBounds(This, strokeWidth, strokeStyle, worldTransform, flatteningTolerance, bounds) \ + ((This)->lpVtbl->Base.GetWidenedBounds((ID2D1Geometry *)This, strokeWidth, strokeStyle, worldTransform, flatteningTolerance, bounds)) + +#define ID2D1PathGeometry_StrokeContainsPoint(This, point, strokeWidth, strokeStyle, worldTransform, flatteningTolerance, contains) \ + ((This)->lpVtbl->Base.StrokeContainsPoint((ID2D1Geometry *)This, point, strokeWidth, strokeStyle, worldTransform, flatteningTolerance, contains)) + +#define ID2D1PathGeometry_FillContainsPoint(This, point, worldTransform, flatteningTolerance, contains) \ + ((This)->lpVtbl->Base.FillContainsPoint((ID2D1Geometry *)This, point, worldTransform, flatteningTolerance, contains)) + +#define ID2D1PathGeometry_CompareWithGeometry(This, inputGeometry, inputGeometryTransform, flatteningTolerance, relation) \ + ((This)->lpVtbl->Base.CompareWithGeometry((ID2D1Geometry *)This, inputGeometry, inputGeometryTransform, flatteningTolerance, relation)) + +#define ID2D1PathGeometry_Simplify(This, simplificationOption, worldTransform, flatteningTolerance, geometrySink) \ + ((This)->lpVtbl->Base.Simplify((ID2D1Geometry *)This, simplificationOption, worldTransform, flatteningTolerance, geometrySink)) + +#define ID2D1PathGeometry_Tessellate(This, worldTransform, flatteningTolerance, tessellationSink) \ + ((This)->lpVtbl->Base.Tessellate((ID2D1Geometry *)This, worldTransform, flatteningTolerance, tessellationSink)) + +#define ID2D1PathGeometry_CombineWithGeometry(This, inputGeometry, combineMode, inputGeometryTransform, flatteningTolerance, geometrySink) \ + ((This)->lpVtbl->Base.CombineWithGeometry((ID2D1Geometry *)This, inputGeometry, combineMode, inputGeometryTransform, flatteningTolerance, geometrySink)) + +#define ID2D1PathGeometry_Outline(This, worldTransform, flatteningTolerance, geometrySink) \ + ((This)->lpVtbl->Base.Outline((ID2D1Geometry *)This, worldTransform, flatteningTolerance, geometrySink)) + +#define ID2D1PathGeometry_ComputeArea(This, worldTransform, flatteningTolerance, area) \ + ((This)->lpVtbl->Base.ComputeArea((ID2D1Geometry *)This, worldTransform, flatteningTolerance, area)) + +#define ID2D1PathGeometry_ComputeLength(This, worldTransform, flatteningTolerance, length) \ + ((This)->lpVtbl->Base.ComputeLength((ID2D1Geometry *)This, worldTransform, flatteningTolerance, length)) + +#define ID2D1PathGeometry_ComputePointAtLength(This, length, worldTransform, flatteningTolerance, point, unitTangentVector) \ + ((This)->lpVtbl->Base.ComputePointAtLength((ID2D1Geometry *)This, length, worldTransform, flatteningTolerance, point, unitTangentVector)) + +#define ID2D1PathGeometry_Widen(This, strokeWidth, strokeStyle, worldTransform, flatteningTolerance, geometrySink) \ + ((This)->lpVtbl->Base.Widen((ID2D1Geometry *)This, strokeWidth, strokeStyle, worldTransform, flatteningTolerance, geometrySink)) + +#define ID2D1PathGeometry_Open(This, geometrySink) \ + ((This)->lpVtbl->Open(This, geometrySink)) + +#define ID2D1PathGeometry_Stream(This, geometrySink) \ + ((This)->lpVtbl->Stream(This, geometrySink)) + +#define ID2D1PathGeometry_GetSegmentCount(This, count) \ + ((This)->lpVtbl->GetSegmentCount(This, count)) + +#define ID2D1PathGeometry_GetFigureCount(This, count) \ + ((This)->lpVtbl->GetFigureCount(This, count)) + +typedef interface ID2D1Mesh ID2D1Mesh; + +typedef struct ID2D1MeshVtbl +{ + + ID2D1ResourceVtbl Base; + + + STDMETHOD(Open)( + ID2D1Mesh *This, + __deref_out ID2D1TessellationSink **tessellationSink + ) PURE; +} ID2D1MeshVtbl; + +interface ID2D1Mesh +{ + CONST struct ID2D1MeshVtbl *lpVtbl; +}; + + +#define ID2D1Mesh_QueryInterface(This, riid, ppv) \ + ((This)->lpVtbl->Base.Base.QueryInterface((IUnknown *)This, riid, ppv)) + +#define ID2D1Mesh_AddRef(This) \ + ((This)->lpVtbl->Base.Base.AddRef((IUnknown *)This)) + +#define ID2D1Mesh_Release(This) \ + ((This)->lpVtbl->Base.Base.Release((IUnknown *)This)) + +#define ID2D1Mesh_GetFactory(This, factory) \ + ((This)->lpVtbl->Base.GetFactory((ID2D1Resource *)This, factory)) + +#define ID2D1Mesh_Open(This, tessellationSink) \ + ((This)->lpVtbl->Open(This, tessellationSink)) + +typedef interface ID2D1Layer ID2D1Layer; + +typedef struct ID2D1LayerVtbl +{ + + ID2D1ResourceVtbl Base; + + + STDMETHOD_(D2D1_SIZE_F, GetSize)( + ID2D1Layer *This + ) PURE; +} ID2D1LayerVtbl; + +interface ID2D1Layer +{ + CONST struct ID2D1LayerVtbl *lpVtbl; +}; + + +#define ID2D1Layer_QueryInterface(This, riid, ppv) \ + ((This)->lpVtbl->Base.Base.QueryInterface((IUnknown *)This, riid, ppv)) + +#define ID2D1Layer_AddRef(This) \ + ((This)->lpVtbl->Base.Base.AddRef((IUnknown *)This)) + +#define ID2D1Layer_Release(This) \ + ((This)->lpVtbl->Base.Base.Release((IUnknown *)This)) + +#define ID2D1Layer_GetFactory(This, factory) \ + ((This)->lpVtbl->Base.GetFactory((ID2D1Resource *)This, factory)) + +#define ID2D1Layer_GetSize(This) \ + ((This)->lpVtbl->GetSize(This)) + +typedef interface ID2D1DrawingStateBlock ID2D1DrawingStateBlock; + +typedef struct ID2D1DrawingStateBlockVtbl +{ + + ID2D1ResourceVtbl Base; + + + STDMETHOD_(void, GetDescription)( + ID2D1DrawingStateBlock *This, + __out D2D1_DRAWING_STATE_DESCRIPTION *stateDescription + ) PURE; + + STDMETHOD_(void, SetDescription)( + ID2D1DrawingStateBlock *This, + __in CONST D2D1_DRAWING_STATE_DESCRIPTION *stateDescription + ) PURE; + + STDMETHOD_(void, SetTextRenderingParams)( + ID2D1DrawingStateBlock *This, + __in_opt IDWriteRenderingParams *textRenderingParams + ) PURE; + + STDMETHOD_(void, GetTextRenderingParams)( + ID2D1DrawingStateBlock *This, + __deref_out_opt IDWriteRenderingParams **textRenderingParams + ) PURE; +} ID2D1DrawingStateBlockVtbl; + +interface ID2D1DrawingStateBlock +{ + CONST struct ID2D1DrawingStateBlockVtbl *lpVtbl; +}; + + +#define ID2D1DrawingStateBlock_QueryInterface(This, riid, ppv) \ + ((This)->lpVtbl->Base.Base.QueryInterface((IUnknown *)This, riid, ppv)) + +#define ID2D1DrawingStateBlock_AddRef(This) \ + ((This)->lpVtbl->Base.Base.AddRef((IUnknown *)This)) + +#define ID2D1DrawingStateBlock_Release(This) \ + ((This)->lpVtbl->Base.Base.Release((IUnknown *)This)) + +#define ID2D1DrawingStateBlock_GetFactory(This, factory) \ + ((This)->lpVtbl->Base.GetFactory((ID2D1Resource *)This, factory)) + +#define ID2D1DrawingStateBlock_GetDescription(This, stateDescription) \ + ((This)->lpVtbl->GetDescription(This, stateDescription)) + +#define ID2D1DrawingStateBlock_SetDescription(This, stateDescription) \ + ((This)->lpVtbl->SetDescription(This, stateDescription)) + +#define ID2D1DrawingStateBlock_SetTextRenderingParams(This, textRenderingParams) \ + ((This)->lpVtbl->SetTextRenderingParams(This, textRenderingParams)) + +#define ID2D1DrawingStateBlock_GetTextRenderingParams(This, textRenderingParams) \ + ((This)->lpVtbl->GetTextRenderingParams(This, textRenderingParams)) + +typedef interface ID2D1RenderTarget ID2D1RenderTarget; + +typedef struct ID2D1RenderTargetVtbl +{ + + ID2D1ResourceVtbl Base; + + + STDMETHOD(CreateBitmap)( + ID2D1RenderTarget *This, + D2D1_SIZE_U size, + __in_opt CONST void *srcData, + UINT32 pitch, + __in CONST D2D1_BITMAP_PROPERTIES *bitmapProperties, + __deref_out ID2D1Bitmap **bitmap + ) PURE; + + STDMETHOD(CreateBitmapFromWicBitmap)( + ID2D1RenderTarget *This, + __in IWICBitmapSource *wicBitmapSource, + __in_opt CONST D2D1_BITMAP_PROPERTIES *bitmapProperties, + __deref_out ID2D1Bitmap **bitmap + ) PURE; + + STDMETHOD(CreateSharedBitmap)( + ID2D1RenderTarget *This, + __in REFIID riid, + __inout void *data, + __in_opt CONST D2D1_BITMAP_PROPERTIES *bitmapProperties, + __deref_out ID2D1Bitmap **bitmap + ) PURE; + + STDMETHOD(CreateBitmapBrush)( + ID2D1RenderTarget *This, + __in ID2D1Bitmap *bitmap, + __in_opt CONST D2D1_BITMAP_BRUSH_PROPERTIES *bitmapBrushProperties, + __in_opt CONST D2D1_BRUSH_PROPERTIES *brushProperties, + __deref_out ID2D1BitmapBrush **bitmapBrush + ) PURE; + + STDMETHOD(CreateSolidColorBrush)( + ID2D1RenderTarget *This, + __in CONST D2D1_COLOR_F *color, + __in_opt CONST D2D1_BRUSH_PROPERTIES *brushProperties, + __deref_out ID2D1SolidColorBrush **solidColorBrush + ) PURE; + + STDMETHOD(CreateGradientStopCollection)( + ID2D1RenderTarget *This, + __in_ecount(gradientStopsCount) CONST D2D1_GRADIENT_STOP *gradientStops, + __range(>=,1) UINT gradientStopsCount, + D2D1_GAMMA colorInterpolationGamma, + D2D1_EXTEND_MODE extendMode, + __deref_out ID2D1GradientStopCollection **gradientStopCollection + ) PURE; + + STDMETHOD(CreateLinearGradientBrush)( + ID2D1RenderTarget *This, + __in CONST D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES *linearGradientBrushProperties, + __in_opt CONST D2D1_BRUSH_PROPERTIES *brushProperties, + __in ID2D1GradientStopCollection *gradientStopCollection, + __deref_out ID2D1LinearGradientBrush **linearGradientBrush + ) PURE; + + STDMETHOD(CreateRadialGradientBrush)( + ID2D1RenderTarget *This, + __in CONST D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES *radialGradientBrushProperties, + __in_opt CONST D2D1_BRUSH_PROPERTIES *brushProperties, + __in ID2D1GradientStopCollection *gradientStopCollection, + __deref_out ID2D1RadialGradientBrush **radialGradientBrush + ) PURE; + + STDMETHOD(CreateCompatibleRenderTarget)( + ID2D1RenderTarget *This, + __in_opt CONST D2D1_SIZE_F *desiredSize, + __in_opt CONST D2D1_SIZE_U *desiredPixelSize, + __in_opt CONST D2D1_PIXEL_FORMAT *desiredFormat, + D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS options, + __deref_out ID2D1BitmapRenderTarget **bitmapRenderTarget + ) PURE; + + STDMETHOD(CreateLayer)( + ID2D1RenderTarget *This, + __in_opt CONST D2D1_SIZE_F *size, + __deref_out ID2D1Layer **layer + ) PURE; + + STDMETHOD(CreateMesh)( + ID2D1RenderTarget *This, + __deref_out ID2D1Mesh **mesh + ) PURE; + + STDMETHOD_(void, DrawLine)( + ID2D1RenderTarget *This, + D2D1_POINT_2F point0, + D2D1_POINT_2F point1, + __in ID2D1Brush *brush, + FLOAT strokeWidth, + __in_opt ID2D1StrokeStyle *strokeStyle + ) PURE; + + STDMETHOD_(void, DrawRectangle)( + ID2D1RenderTarget *This, + __in CONST D2D1_RECT_F *rect, + __in ID2D1Brush *brush, + FLOAT strokeWidth, + __in_opt ID2D1StrokeStyle *strokeStyle + ) PURE; + + STDMETHOD_(void, FillRectangle)( + ID2D1RenderTarget *This, + __in CONST D2D1_RECT_F *rect, + __in ID2D1Brush *brush + ) PURE; + + STDMETHOD_(void, DrawRoundedRectangle)( + ID2D1RenderTarget *This, + __in CONST D2D1_ROUNDED_RECT *roundedRect, + __in ID2D1Brush *brush, + FLOAT strokeWidth, + __in_opt ID2D1StrokeStyle *strokeStyle + ) PURE; + + STDMETHOD_(void, FillRoundedRectangle)( + ID2D1RenderTarget *This, + __in CONST D2D1_ROUNDED_RECT *roundedRect, + __in ID2D1Brush *brush + ) PURE; + + STDMETHOD_(void, DrawEllipse)( + ID2D1RenderTarget *This, + __in CONST D2D1_ELLIPSE *ellipse, + __in ID2D1Brush *brush, + FLOAT strokeWidth, + __in_opt ID2D1StrokeStyle *strokeStyle + ) PURE; + + STDMETHOD_(void, FillEllipse)( + ID2D1RenderTarget *This, + __in CONST D2D1_ELLIPSE *ellipse, + __in ID2D1Brush *brush + ) PURE; + + STDMETHOD_(void, DrawGeometry)( + ID2D1RenderTarget *This, + __in ID2D1Geometry *geometry, + __in ID2D1Brush *brush, + FLOAT strokeWidth, + __in_opt ID2D1StrokeStyle *strokeStyle + ) PURE; + + STDMETHOD_(void, FillGeometry)( + ID2D1RenderTarget *This, + __in ID2D1Geometry *geometry, + __in ID2D1Brush *brush, + __in_opt ID2D1Brush *opacityBrush + ) PURE; + + STDMETHOD_(void, FillMesh)( + ID2D1RenderTarget *This, + __in ID2D1Mesh *mesh, + __in ID2D1Brush *brush + ) PURE; + + STDMETHOD_(void, FillOpacityMask)( + ID2D1RenderTarget *This, + __in ID2D1Bitmap *opacityMask, + __in ID2D1Brush *brush, + D2D1_OPACITY_MASK_CONTENT content, + __in_opt CONST D2D1_RECT_F *destinationRectangle, + __in_opt CONST D2D1_RECT_F *sourceRectangle + ) PURE; + + STDMETHOD_(void, DrawBitmap)( + ID2D1RenderTarget *This, + __in ID2D1Bitmap *bitmap, + __in_opt CONST D2D1_RECT_F *destinationRectangle, + FLOAT opacity, + D2D1_BITMAP_INTERPOLATION_MODE interpolationMode, + __in_opt CONST D2D1_RECT_F *sourceRectangle + ) PURE; + + STDMETHOD_(void, DrawText)( + ID2D1RenderTarget *This, + __in_ecount(stringLength) CONST WCHAR *string, + UINT stringLength, + __in IDWriteTextFormat *textFormat, + __in CONST D2D1_RECT_F *layoutRect, + __in ID2D1Brush *defaultForegroundBrush, + D2D1_DRAW_TEXT_OPTIONS options, + DWRITE_MEASURING_MODE measuringMode + ) PURE; + + STDMETHOD_(void, DrawTextLayout)( + ID2D1RenderTarget *This, + D2D1_POINT_2F origin, + __in IDWriteTextLayout *textLayout, + __in ID2D1Brush *defaultForegroundBrush, + D2D1_DRAW_TEXT_OPTIONS options + ) PURE; + + STDMETHOD_(void, DrawGlyphRun)( + ID2D1RenderTarget *This, + D2D1_POINT_2F baselineOrigin, + __in CONST DWRITE_GLYPH_RUN *glyphRun, + __in ID2D1Brush *foregroundBrush, + DWRITE_MEASURING_MODE measuringMode + ) PURE; + + STDMETHOD_(void, SetTransform)( + ID2D1RenderTarget *This, + __in CONST D2D1_MATRIX_3X2_F *transform + ) PURE; + + STDMETHOD_(void, GetTransform)( + ID2D1RenderTarget *This, + __out D2D1_MATRIX_3X2_F *transform + ) PURE; + + STDMETHOD_(void, SetAntialiasMode)( + ID2D1RenderTarget *This, + D2D1_ANTIALIAS_MODE antialiasMode + ) PURE; + + STDMETHOD_(D2D1_ANTIALIAS_MODE, GetAntialiasMode)( + ID2D1RenderTarget *This + ) PURE; + + STDMETHOD_(void, SetTextAntialiasMode)( + ID2D1RenderTarget *This, + D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode + ) PURE; + + STDMETHOD_(D2D1_TEXT_ANTIALIAS_MODE, GetTextAntialiasMode)( + ID2D1RenderTarget *This + ) PURE; + + STDMETHOD_(void, SetTextRenderingParams)( + ID2D1RenderTarget *This, + __in_opt IDWriteRenderingParams *textRenderingParams + ) PURE; + + STDMETHOD_(void, GetTextRenderingParams)( + ID2D1RenderTarget *This, + __deref_out_opt IDWriteRenderingParams **textRenderingParams + ) PURE; + + STDMETHOD_(void, SetTags)( + ID2D1RenderTarget *This, + D2D1_TAG tag1, + D2D1_TAG tag2 + ) PURE; + + STDMETHOD_(void, GetTags)( + ID2D1RenderTarget *This, + __out_opt D2D1_TAG *tag1, + __out_opt D2D1_TAG *tag2 + ) PURE; + + STDMETHOD_(void, PushLayer)( + ID2D1RenderTarget *This, + __in CONST D2D1_LAYER_PARAMETERS *layerParameters, + __in ID2D1Layer *layer + ) PURE; + + STDMETHOD_(void, PopLayer)( + ID2D1RenderTarget *This + ) PURE; + + STDMETHOD(Flush)( + ID2D1RenderTarget *This, + __out_opt D2D1_TAG *tag1, + __out_opt D2D1_TAG *tag2 + ) PURE; + + STDMETHOD_(void, SaveDrawingState)( + ID2D1RenderTarget *This, + __inout ID2D1DrawingStateBlock *drawingStateBlock + ) PURE; + + STDMETHOD_(void, RestoreDrawingState)( + ID2D1RenderTarget *This, + __in ID2D1DrawingStateBlock *drawingStateBlock + ) PURE; + + STDMETHOD_(void, PushAxisAlignedClip)( + ID2D1RenderTarget *This, + __in CONST D2D1_RECT_F *clipRect, + D2D1_ANTIALIAS_MODE antialiasMode + ) PURE; + + STDMETHOD_(void, PopAxisAlignedClip)( + ID2D1RenderTarget *This + ) PURE; + + STDMETHOD_(void, Clear)( + ID2D1RenderTarget *This, + __in_opt CONST D2D1_COLOR_F *clearColor + ) PURE; + + STDMETHOD_(void, BeginDraw)( + ID2D1RenderTarget *This + ) PURE; + + STDMETHOD(EndDraw)( + ID2D1RenderTarget *This, + __out_opt D2D1_TAG *tag1, + __out_opt D2D1_TAG *tag2 + ) PURE; + + STDMETHOD_(D2D1_PIXEL_FORMAT, GetPixelFormat)( + ID2D1RenderTarget *This + ) PURE; + + STDMETHOD_(void, SetDpi)( + ID2D1RenderTarget *This, + FLOAT dpiX, + FLOAT dpiY + ) PURE; + + STDMETHOD_(void, GetDpi)( + ID2D1RenderTarget *This, + __out FLOAT *dpiX, + __out FLOAT *dpiY + ) PURE; + + STDMETHOD_(D2D1_SIZE_F, GetSize)( + ID2D1RenderTarget *This + ) PURE; + + STDMETHOD_(D2D1_SIZE_U, GetPixelSize)( + ID2D1RenderTarget *This + ) PURE; + + STDMETHOD_(UINT32, GetMaximumBitmapSize)( + ID2D1RenderTarget *This + ) PURE; + + STDMETHOD_(BOOL, IsSupported)( + ID2D1RenderTarget *This, + __in CONST D2D1_RENDER_TARGET_PROPERTIES *renderTargetProperties + ) PURE; +} ID2D1RenderTargetVtbl; + +interface ID2D1RenderTarget +{ + CONST struct ID2D1RenderTargetVtbl *lpVtbl; +}; + + +#define ID2D1RenderTarget_QueryInterface(This, riid, ppv) \ + ((This)->lpVtbl->Base.Base.QueryInterface((IUnknown *)This, riid, ppv)) + +#define ID2D1RenderTarget_AddRef(This) \ + ((This)->lpVtbl->Base.Base.AddRef((IUnknown *)This)) + +#define ID2D1RenderTarget_Release(This) \ + ((This)->lpVtbl->Base.Base.Release((IUnknown *)This)) + +#define ID2D1RenderTarget_GetFactory(This, factory) \ + ((This)->lpVtbl->Base.GetFactory((ID2D1Resource *)This, factory)) + +#define ID2D1RenderTarget_CreateBitmap(This, size, srcData, pitch, bitmapProperties, bitmap) \ + ((This)->lpVtbl->CreateBitmap(This, size, srcData, pitch, bitmapProperties, bitmap)) + +#define ID2D1RenderTarget_CreateBitmapFromWicBitmap(This, wicBitmapSource, bitmapProperties, bitmap) \ + ((This)->lpVtbl->CreateBitmapFromWicBitmap(This, wicBitmapSource, bitmapProperties, bitmap)) + +#define ID2D1RenderTarget_CreateSharedBitmap(This, riid, data, bitmapProperties, bitmap) \ + ((This)->lpVtbl->CreateSharedBitmap(This, riid, data, bitmapProperties, bitmap)) + +#define ID2D1RenderTarget_CreateBitmapBrush(This, bitmap, bitmapBrushProperties, brushProperties, bitmapBrush) \ + ((This)->lpVtbl->CreateBitmapBrush(This, bitmap, bitmapBrushProperties, brushProperties, bitmapBrush)) + +#define ID2D1RenderTarget_CreateSolidColorBrush(This, color, brushProperties, solidColorBrush) \ + ((This)->lpVtbl->CreateSolidColorBrush(This, color, brushProperties, solidColorBrush)) + +#define ID2D1RenderTarget_CreateGradientStopCollection(This, gradientStops, gradientStopsCount, colorInterpolationGamma, extendMode, gradientStopCollection) \ + ((This)->lpVtbl->CreateGradientStopCollection(This, gradientStops, gradientStopsCount, colorInterpolationGamma, extendMode, gradientStopCollection)) + +#define ID2D1RenderTarget_CreateLinearGradientBrush(This, linearGradientBrushProperties, brushProperties, gradientStopCollection, linearGradientBrush) \ + ((This)->lpVtbl->CreateLinearGradientBrush(This, linearGradientBrushProperties, brushProperties, gradientStopCollection, linearGradientBrush)) + +#define ID2D1RenderTarget_CreateRadialGradientBrush(This, radialGradientBrushProperties, brushProperties, gradientStopCollection, radialGradientBrush) \ + ((This)->lpVtbl->CreateRadialGradientBrush(This, radialGradientBrushProperties, brushProperties, gradientStopCollection, radialGradientBrush)) + +#define ID2D1RenderTarget_CreateCompatibleRenderTarget(This, desiredSize, desiredPixelSize, desiredFormat, options, bitmapRenderTarget) \ + ((This)->lpVtbl->CreateCompatibleRenderTarget(This, desiredSize, desiredPixelSize, desiredFormat, options, bitmapRenderTarget)) + +#define ID2D1RenderTarget_CreateLayer(This, size, layer) \ + ((This)->lpVtbl->CreateLayer(This, size, layer)) + +#define ID2D1RenderTarget_CreateMesh(This, mesh) \ + ((This)->lpVtbl->CreateMesh(This, mesh)) + +#define ID2D1RenderTarget_DrawLine(This, point0, point1, brush, strokeWidth, strokeStyle) \ + ((This)->lpVtbl->DrawLine(This, point0, point1, brush, strokeWidth, strokeStyle)) + +#define ID2D1RenderTarget_DrawRectangle(This, rect, brush, strokeWidth, strokeStyle) \ + ((This)->lpVtbl->DrawRectangle(This, rect, brush, strokeWidth, strokeStyle)) + +#define ID2D1RenderTarget_FillRectangle(This, rect, brush) \ + ((This)->lpVtbl->FillRectangle(This, rect, brush)) + +#define ID2D1RenderTarget_DrawRoundedRectangle(This, roundedRect, brush, strokeWidth, strokeStyle) \ + ((This)->lpVtbl->DrawRoundedRectangle(This, roundedRect, brush, strokeWidth, strokeStyle)) + +#define ID2D1RenderTarget_FillRoundedRectangle(This, roundedRect, brush) \ + ((This)->lpVtbl->FillRoundedRectangle(This, roundedRect, brush)) + +#define ID2D1RenderTarget_DrawEllipse(This, ellipse, brush, strokeWidth, strokeStyle) \ + ((This)->lpVtbl->DrawEllipse(This, ellipse, brush, strokeWidth, strokeStyle)) + +#define ID2D1RenderTarget_FillEllipse(This, ellipse, brush) \ + ((This)->lpVtbl->FillEllipse(This, ellipse, brush)) + +#define ID2D1RenderTarget_DrawGeometry(This, geometry, brush, strokeWidth, strokeStyle) \ + ((This)->lpVtbl->DrawGeometry(This, geometry, brush, strokeWidth, strokeStyle)) + +#define ID2D1RenderTarget_FillGeometry(This, geometry, brush, opacityBrush) \ + ((This)->lpVtbl->FillGeometry(This, geometry, brush, opacityBrush)) + +#define ID2D1RenderTarget_FillMesh(This, mesh, brush) \ + ((This)->lpVtbl->FillMesh(This, mesh, brush)) + +#define ID2D1RenderTarget_FillOpacityMask(This, opacityMask, brush, content, destinationRectangle, sourceRectangle) \ + ((This)->lpVtbl->FillOpacityMask(This, opacityMask, brush, content, destinationRectangle, sourceRectangle)) + +#define ID2D1RenderTarget_DrawBitmap(This, bitmap, destinationRectangle, opacity, interpolationMode, sourceRectangle) \ + ((This)->lpVtbl->DrawBitmap(This, bitmap, destinationRectangle, opacity, interpolationMode, sourceRectangle)) + +#define ID2D1RenderTarget_DrawText(This, string, stringLength, textFormat, layoutRect, defaultForegroundBrush, options, measuringMode) \ + ((This)->lpVtbl->DrawText(This, string, stringLength, textFormat, layoutRect, defaultForegroundBrush, options, measuringMode)) + +#define ID2D1RenderTarget_DrawTextLayout(This, origin, textLayout, defaultForegroundBrush, options) \ + ((This)->lpVtbl->DrawTextLayout(This, origin, textLayout, defaultForegroundBrush, options)) + +#define ID2D1RenderTarget_DrawGlyphRun(This, baselineOrigin, glyphRun, foregroundBrush, measuringMode) \ + ((This)->lpVtbl->DrawGlyphRun(This, baselineOrigin, glyphRun, foregroundBrush, measuringMode)) + +#define ID2D1RenderTarget_SetTransform(This, transform) \ + ((This)->lpVtbl->SetTransform(This, transform)) + +#define ID2D1RenderTarget_GetTransform(This, transform) \ + ((This)->lpVtbl->GetTransform(This, transform)) + +#define ID2D1RenderTarget_SetAntialiasMode(This, antialiasMode) \ + ((This)->lpVtbl->SetAntialiasMode(This, antialiasMode)) + +#define ID2D1RenderTarget_GetAntialiasMode(This) \ + ((This)->lpVtbl->GetAntialiasMode(This)) + +#define ID2D1RenderTarget_SetTextAntialiasMode(This, textAntialiasMode) \ + ((This)->lpVtbl->SetTextAntialiasMode(This, textAntialiasMode)) + +#define ID2D1RenderTarget_GetTextAntialiasMode(This) \ + ((This)->lpVtbl->GetTextAntialiasMode(This)) + +#define ID2D1RenderTarget_SetTextRenderingParams(This, textRenderingParams) \ + ((This)->lpVtbl->SetTextRenderingParams(This, textRenderingParams)) + +#define ID2D1RenderTarget_GetTextRenderingParams(This, textRenderingParams) \ + ((This)->lpVtbl->GetTextRenderingParams(This, textRenderingParams)) + +#define ID2D1RenderTarget_SetTags(This, tag1, tag2) \ + ((This)->lpVtbl->SetTags(This, tag1, tag2)) + +#define ID2D1RenderTarget_GetTags(This, tag1, tag2) \ + ((This)->lpVtbl->GetTags(This, tag1, tag2)) + +#define ID2D1RenderTarget_PushLayer(This, layerParameters, layer) \ + ((This)->lpVtbl->PushLayer(This, layerParameters, layer)) + +#define ID2D1RenderTarget_PopLayer(This) \ + ((This)->lpVtbl->PopLayer(This)) + +#define ID2D1RenderTarget_Flush(This, tag1, tag2) \ + ((This)->lpVtbl->Flush(This, tag1, tag2)) + +#define ID2D1RenderTarget_SaveDrawingState(This, drawingStateBlock) \ + ((This)->lpVtbl->SaveDrawingState(This, drawingStateBlock)) + +#define ID2D1RenderTarget_RestoreDrawingState(This, drawingStateBlock) \ + ((This)->lpVtbl->RestoreDrawingState(This, drawingStateBlock)) + +#define ID2D1RenderTarget_PushAxisAlignedClip(This, clipRect, antialiasMode) \ + ((This)->lpVtbl->PushAxisAlignedClip(This, clipRect, antialiasMode)) + +#define ID2D1RenderTarget_PopAxisAlignedClip(This) \ + ((This)->lpVtbl->PopAxisAlignedClip(This)) + +#define ID2D1RenderTarget_Clear(This, clearColor) \ + ((This)->lpVtbl->Clear(This, clearColor)) + +#define ID2D1RenderTarget_BeginDraw(This) \ + ((This)->lpVtbl->BeginDraw(This)) + +#define ID2D1RenderTarget_EndDraw(This, tag1, tag2) \ + ((This)->lpVtbl->EndDraw(This, tag1, tag2)) + +#define ID2D1RenderTarget_GetPixelFormat(This) \ + ((This)->lpVtbl->GetPixelFormat(This)) + +#define ID2D1RenderTarget_SetDpi(This, dpiX, dpiY) \ + ((This)->lpVtbl->SetDpi(This, dpiX, dpiY)) + +#define ID2D1RenderTarget_GetDpi(This, dpiX, dpiY) \ + ((This)->lpVtbl->GetDpi(This, dpiX, dpiY)) + +#define ID2D1RenderTarget_GetSize(This) \ + ((This)->lpVtbl->GetSize(This)) + +#define ID2D1RenderTarget_GetPixelSize(This) \ + ((This)->lpVtbl->GetPixelSize(This)) + +#define ID2D1RenderTarget_GetMaximumBitmapSize(This) \ + ((This)->lpVtbl->GetMaximumBitmapSize(This)) + +#define ID2D1RenderTarget_IsSupported(This, renderTargetProperties) \ + ((This)->lpVtbl->IsSupported(This, renderTargetProperties)) + +typedef interface ID2D1BitmapRenderTarget ID2D1BitmapRenderTarget; + +typedef struct ID2D1BitmapRenderTargetVtbl +{ + + ID2D1RenderTargetVtbl Base; + + + STDMETHOD(GetBitmap)( + ID2D1BitmapRenderTarget *This, + __deref_out ID2D1Bitmap **bitmap + ) PURE; +} ID2D1BitmapRenderTargetVtbl; + +interface ID2D1BitmapRenderTarget +{ + CONST struct ID2D1BitmapRenderTargetVtbl *lpVtbl; +}; + + +#define ID2D1BitmapRenderTarget_QueryInterface(This, riid, ppv) \ + ((This)->lpVtbl->Base.Base.Base.QueryInterface((IUnknown *)This, riid, ppv)) + +#define ID2D1BitmapRenderTarget_AddRef(This) \ + ((This)->lpVtbl->Base.Base.Base.AddRef((IUnknown *)This)) + +#define ID2D1BitmapRenderTarget_Release(This) \ + ((This)->lpVtbl->Base.Base.Base.Release((IUnknown *)This)) + +#define ID2D1BitmapRenderTarget_GetFactory(This, factory) \ + ((This)->lpVtbl->Base.Base.GetFactory((ID2D1Resource *)This, factory)) + +#define ID2D1BitmapRenderTarget_CreateBitmap(This, size, srcData, pitch, bitmapProperties, bitmap) \ + ((This)->lpVtbl->Base.CreateBitmap((ID2D1RenderTarget *)This, size, srcData, pitch, bitmapProperties, bitmap)) + +#define ID2D1BitmapRenderTarget_CreateBitmapFromWicBitmap(This, wicBitmapSource, bitmapProperties, bitmap) \ + ((This)->lpVtbl->Base.CreateBitmapFromWicBitmap((ID2D1RenderTarget *)This, wicBitmapSource, bitmapProperties, bitmap)) + +#define ID2D1BitmapRenderTarget_CreateSharedBitmap(This, riid, data, bitmapProperties, bitmap) \ + ((This)->lpVtbl->Base.CreateSharedBitmap((ID2D1RenderTarget *)This, riid, data, bitmapProperties, bitmap)) + +#define ID2D1BitmapRenderTarget_CreateBitmapBrush(This, bitmap, bitmapBrushProperties, brushProperties, bitmapBrush) \ + ((This)->lpVtbl->Base.CreateBitmapBrush((ID2D1RenderTarget *)This, bitmap, bitmapBrushProperties, brushProperties, bitmapBrush)) + +#define ID2D1BitmapRenderTarget_CreateSolidColorBrush(This, color, brushProperties, solidColorBrush) \ + ((This)->lpVtbl->Base.CreateSolidColorBrush((ID2D1RenderTarget *)This, color, brushProperties, solidColorBrush)) + +#define ID2D1BitmapRenderTarget_CreateGradientStopCollection(This, gradientStops, gradientStopsCount, colorInterpolationGamma, extendMode, gradientStopCollection) \ + ((This)->lpVtbl->Base.CreateGradientStopCollection((ID2D1RenderTarget *)This, gradientStops, gradientStopsCount, colorInterpolationGamma, extendMode, gradientStopCollection)) + +#define ID2D1BitmapRenderTarget_CreateLinearGradientBrush(This, linearGradientBrushProperties, brushProperties, gradientStopCollection, linearGradientBrush) \ + ((This)->lpVtbl->Base.CreateLinearGradientBrush((ID2D1RenderTarget *)This, linearGradientBrushProperties, brushProperties, gradientStopCollection, linearGradientBrush)) + +#define ID2D1BitmapRenderTarget_CreateRadialGradientBrush(This, radialGradientBrushProperties, brushProperties, gradientStopCollection, radialGradientBrush) \ + ((This)->lpVtbl->Base.CreateRadialGradientBrush((ID2D1RenderTarget *)This, radialGradientBrushProperties, brushProperties, gradientStopCollection, radialGradientBrush)) + +#define ID2D1BitmapRenderTarget_CreateCompatibleRenderTarget(This, desiredSize, desiredPixelSize, desiredFormat, options, bitmapRenderTarget) \ + ((This)->lpVtbl->Base.CreateCompatibleRenderTarget((ID2D1RenderTarget *)This, desiredSize, desiredPixelSize, desiredFormat, options, bitmapRenderTarget)) + +#define ID2D1BitmapRenderTarget_CreateLayer(This, size, layer) \ + ((This)->lpVtbl->Base.CreateLayer((ID2D1RenderTarget *)This, size, layer)) + +#define ID2D1BitmapRenderTarget_CreateMesh(This, mesh) \ + ((This)->lpVtbl->Base.CreateMesh((ID2D1RenderTarget *)This, mesh)) + +#define ID2D1BitmapRenderTarget_DrawLine(This, point0, point1, brush, strokeWidth, strokeStyle) \ + ((This)->lpVtbl->Base.DrawLine((ID2D1RenderTarget *)This, point0, point1, brush, strokeWidth, strokeStyle)) + +#define ID2D1BitmapRenderTarget_DrawRectangle(This, rect, brush, strokeWidth, strokeStyle) \ + ((This)->lpVtbl->Base.DrawRectangle((ID2D1RenderTarget *)This, rect, brush, strokeWidth, strokeStyle)) + +#define ID2D1BitmapRenderTarget_FillRectangle(This, rect, brush) \ + ((This)->lpVtbl->Base.FillRectangle((ID2D1RenderTarget *)This, rect, brush)) + +#define ID2D1BitmapRenderTarget_DrawRoundedRectangle(This, roundedRect, brush, strokeWidth, strokeStyle) \ + ((This)->lpVtbl->Base.DrawRoundedRectangle((ID2D1RenderTarget *)This, roundedRect, brush, strokeWidth, strokeStyle)) + +#define ID2D1BitmapRenderTarget_FillRoundedRectangle(This, roundedRect, brush) \ + ((This)->lpVtbl->Base.FillRoundedRectangle((ID2D1RenderTarget *)This, roundedRect, brush)) + +#define ID2D1BitmapRenderTarget_DrawEllipse(This, ellipse, brush, strokeWidth, strokeStyle) \ + ((This)->lpVtbl->Base.DrawEllipse((ID2D1RenderTarget *)This, ellipse, brush, strokeWidth, strokeStyle)) + +#define ID2D1BitmapRenderTarget_FillEllipse(This, ellipse, brush) \ + ((This)->lpVtbl->Base.FillEllipse((ID2D1RenderTarget *)This, ellipse, brush)) + +#define ID2D1BitmapRenderTarget_DrawGeometry(This, geometry, brush, strokeWidth, strokeStyle) \ + ((This)->lpVtbl->Base.DrawGeometry((ID2D1RenderTarget *)This, geometry, brush, strokeWidth, strokeStyle)) + +#define ID2D1BitmapRenderTarget_FillGeometry(This, geometry, brush, opacityBrush) \ + ((This)->lpVtbl->Base.FillGeometry((ID2D1RenderTarget *)This, geometry, brush, opacityBrush)) + +#define ID2D1BitmapRenderTarget_FillMesh(This, mesh, brush) \ + ((This)->lpVtbl->Base.FillMesh((ID2D1RenderTarget *)This, mesh, brush)) + +#define ID2D1BitmapRenderTarget_FillOpacityMask(This, opacityMask, brush, content, destinationRectangle, sourceRectangle) \ + ((This)->lpVtbl->Base.FillOpacityMask((ID2D1RenderTarget *)This, opacityMask, brush, content, destinationRectangle, sourceRectangle)) + +#define ID2D1BitmapRenderTarget_DrawBitmap(This, bitmap, destinationRectangle, opacity, interpolationMode, sourceRectangle) \ + ((This)->lpVtbl->Base.DrawBitmap((ID2D1RenderTarget *)This, bitmap, destinationRectangle, opacity, interpolationMode, sourceRectangle)) + +#define ID2D1BitmapRenderTarget_DrawText(This, string, stringLength, textFormat, layoutRect, defaultForegroundBrush, options, measuringMode) \ + ((This)->lpVtbl->Base.DrawText((ID2D1RenderTarget *)This, string, stringLength, textFormat, layoutRect, defaultForegroundBrush, options, measuringMode)) + +#define ID2D1BitmapRenderTarget_DrawTextLayout(This, origin, textLayout, defaultForegroundBrush, options) \ + ((This)->lpVtbl->Base.DrawTextLayout((ID2D1RenderTarget *)This, origin, textLayout, defaultForegroundBrush, options)) + +#define ID2D1BitmapRenderTarget_DrawGlyphRun(This, baselineOrigin, glyphRun, foregroundBrush, measuringMode) \ + ((This)->lpVtbl->Base.DrawGlyphRun((ID2D1RenderTarget *)This, baselineOrigin, glyphRun, foregroundBrush, measuringMode)) + +#define ID2D1BitmapRenderTarget_SetTransform(This, transform) \ + ((This)->lpVtbl->Base.SetTransform((ID2D1RenderTarget *)This, transform)) + +#define ID2D1BitmapRenderTarget_GetTransform(This, transform) \ + ((This)->lpVtbl->Base.GetTransform((ID2D1RenderTarget *)This, transform)) + +#define ID2D1BitmapRenderTarget_SetAntialiasMode(This, antialiasMode) \ + ((This)->lpVtbl->Base.SetAntialiasMode((ID2D1RenderTarget *)This, antialiasMode)) + +#define ID2D1BitmapRenderTarget_GetAntialiasMode(This) \ + ((This)->lpVtbl->Base.GetAntialiasMode((ID2D1RenderTarget *)This)) + +#define ID2D1BitmapRenderTarget_SetTextAntialiasMode(This, textAntialiasMode) \ + ((This)->lpVtbl->Base.SetTextAntialiasMode((ID2D1RenderTarget *)This, textAntialiasMode)) + +#define ID2D1BitmapRenderTarget_GetTextAntialiasMode(This) \ + ((This)->lpVtbl->Base.GetTextAntialiasMode((ID2D1RenderTarget *)This)) + +#define ID2D1BitmapRenderTarget_SetTextRenderingParams(This, textRenderingParams) \ + ((This)->lpVtbl->Base.SetTextRenderingParams((ID2D1RenderTarget *)This, textRenderingParams)) + +#define ID2D1BitmapRenderTarget_GetTextRenderingParams(This, textRenderingParams) \ + ((This)->lpVtbl->Base.GetTextRenderingParams((ID2D1RenderTarget *)This, textRenderingParams)) + +#define ID2D1BitmapRenderTarget_SetTags(This, tag1, tag2) \ + ((This)->lpVtbl->Base.SetTags((ID2D1RenderTarget *)This, tag1, tag2)) + +#define ID2D1BitmapRenderTarget_GetTags(This, tag1, tag2) \ + ((This)->lpVtbl->Base.GetTags((ID2D1RenderTarget *)This, tag1, tag2)) + +#define ID2D1BitmapRenderTarget_PushLayer(This, layerParameters, layer) \ + ((This)->lpVtbl->Base.PushLayer((ID2D1RenderTarget *)This, layerParameters, layer)) + +#define ID2D1BitmapRenderTarget_PopLayer(This) \ + ((This)->lpVtbl->Base.PopLayer((ID2D1RenderTarget *)This)) + +#define ID2D1BitmapRenderTarget_Flush(This, tag1, tag2) \ + ((This)->lpVtbl->Base.Flush((ID2D1RenderTarget *)This, tag1, tag2)) + +#define ID2D1BitmapRenderTarget_SaveDrawingState(This, drawingStateBlock) \ + ((This)->lpVtbl->Base.SaveDrawingState((ID2D1RenderTarget *)This, drawingStateBlock)) + +#define ID2D1BitmapRenderTarget_RestoreDrawingState(This, drawingStateBlock) \ + ((This)->lpVtbl->Base.RestoreDrawingState((ID2D1RenderTarget *)This, drawingStateBlock)) + +#define ID2D1BitmapRenderTarget_PushAxisAlignedClip(This, clipRect, antialiasMode) \ + ((This)->lpVtbl->Base.PushAxisAlignedClip((ID2D1RenderTarget *)This, clipRect, antialiasMode)) + +#define ID2D1BitmapRenderTarget_PopAxisAlignedClip(This) \ + ((This)->lpVtbl->Base.PopAxisAlignedClip((ID2D1RenderTarget *)This)) + +#define ID2D1BitmapRenderTarget_Clear(This, clearColor) \ + ((This)->lpVtbl->Base.Clear((ID2D1RenderTarget *)This, clearColor)) + +#define ID2D1BitmapRenderTarget_BeginDraw(This) \ + ((This)->lpVtbl->Base.BeginDraw((ID2D1RenderTarget *)This)) + +#define ID2D1BitmapRenderTarget_EndDraw(This, tag1, tag2) \ + ((This)->lpVtbl->Base.EndDraw((ID2D1RenderTarget *)This, tag1, tag2)) + +#define ID2D1BitmapRenderTarget_GetPixelFormat(This) \ + ((This)->lpVtbl->Base.GetPixelFormat((ID2D1RenderTarget *)This)) + +#define ID2D1BitmapRenderTarget_SetDpi(This, dpiX, dpiY) \ + ((This)->lpVtbl->Base.SetDpi((ID2D1RenderTarget *)This, dpiX, dpiY)) + +#define ID2D1BitmapRenderTarget_GetDpi(This, dpiX, dpiY) \ + ((This)->lpVtbl->Base.GetDpi((ID2D1RenderTarget *)This, dpiX, dpiY)) + +#define ID2D1BitmapRenderTarget_GetSize(This) \ + ((This)->lpVtbl->Base.GetSize((ID2D1RenderTarget *)This)) + +#define ID2D1BitmapRenderTarget_GetPixelSize(This) \ + ((This)->lpVtbl->Base.GetPixelSize((ID2D1RenderTarget *)This)) + +#define ID2D1BitmapRenderTarget_GetMaximumBitmapSize(This) \ + ((This)->lpVtbl->Base.GetMaximumBitmapSize((ID2D1RenderTarget *)This)) + +#define ID2D1BitmapRenderTarget_IsSupported(This, renderTargetProperties) \ + ((This)->lpVtbl->Base.IsSupported((ID2D1RenderTarget *)This, renderTargetProperties)) + +#define ID2D1BitmapRenderTarget_GetBitmap(This, bitmap) \ + ((This)->lpVtbl->GetBitmap(This, bitmap)) + +typedef interface ID2D1HwndRenderTarget ID2D1HwndRenderTarget; + +typedef struct ID2D1HwndRenderTargetVtbl +{ + + ID2D1RenderTargetVtbl Base; + + + STDMETHOD_(D2D1_WINDOW_STATE, CheckWindowState)( + ID2D1HwndRenderTarget *This + ) PURE; + + STDMETHOD(Resize)( + ID2D1HwndRenderTarget *This, + __in CONST D2D1_SIZE_U *pixelSize + ) PURE; + + STDMETHOD_(HWND, GetHwnd)( + ID2D1HwndRenderTarget *This + ) PURE; +} ID2D1HwndRenderTargetVtbl; + +interface ID2D1HwndRenderTarget +{ + CONST struct ID2D1HwndRenderTargetVtbl *lpVtbl; +}; + + +#define ID2D1HwndRenderTarget_QueryInterface(This, riid, ppv) \ + ((This)->lpVtbl->Base.Base.Base.QueryInterface((IUnknown *)This, riid, ppv)) + +#define ID2D1HwndRenderTarget_AddRef(This) \ + ((This)->lpVtbl->Base.Base.Base.AddRef((IUnknown *)This)) + +#define ID2D1HwndRenderTarget_Release(This) \ + ((This)->lpVtbl->Base.Base.Base.Release((IUnknown *)This)) + +#define ID2D1HwndRenderTarget_GetFactory(This, factory) \ + ((This)->lpVtbl->Base.Base.GetFactory((ID2D1Resource *)This, factory)) + +#define ID2D1HwndRenderTarget_CreateBitmap(This, size, srcData, pitch, bitmapProperties, bitmap) \ + ((This)->lpVtbl->Base.CreateBitmap((ID2D1RenderTarget *)This, size, srcData, pitch, bitmapProperties, bitmap)) + +#define ID2D1HwndRenderTarget_CreateBitmapFromWicBitmap(This, wicBitmapSource, bitmapProperties, bitmap) \ + ((This)->lpVtbl->Base.CreateBitmapFromWicBitmap((ID2D1RenderTarget *)This, wicBitmapSource, bitmapProperties, bitmap)) + +#define ID2D1HwndRenderTarget_CreateSharedBitmap(This, riid, data, bitmapProperties, bitmap) \ + ((This)->lpVtbl->Base.CreateSharedBitmap((ID2D1RenderTarget *)This, riid, data, bitmapProperties, bitmap)) + +#define ID2D1HwndRenderTarget_CreateBitmapBrush(This, bitmap, bitmapBrushProperties, brushProperties, bitmapBrush) \ + ((This)->lpVtbl->Base.CreateBitmapBrush((ID2D1RenderTarget *)This, bitmap, bitmapBrushProperties, brushProperties, bitmapBrush)) + +#define ID2D1HwndRenderTarget_CreateSolidColorBrush(This, color, brushProperties, solidColorBrush) \ + ((This)->lpVtbl->Base.CreateSolidColorBrush((ID2D1RenderTarget *)This, color, brushProperties, solidColorBrush)) + +#define ID2D1HwndRenderTarget_CreateGradientStopCollection(This, gradientStops, gradientStopsCount, colorInterpolationGamma, extendMode, gradientStopCollection) \ + ((This)->lpVtbl->Base.CreateGradientStopCollection((ID2D1RenderTarget *)This, gradientStops, gradientStopsCount, colorInterpolationGamma, extendMode, gradientStopCollection)) + +#define ID2D1HwndRenderTarget_CreateLinearGradientBrush(This, linearGradientBrushProperties, brushProperties, gradientStopCollection, linearGradientBrush) \ + ((This)->lpVtbl->Base.CreateLinearGradientBrush((ID2D1RenderTarget *)This, linearGradientBrushProperties, brushProperties, gradientStopCollection, linearGradientBrush)) + +#define ID2D1HwndRenderTarget_CreateRadialGradientBrush(This, radialGradientBrushProperties, brushProperties, gradientStopCollection, radialGradientBrush) \ + ((This)->lpVtbl->Base.CreateRadialGradientBrush((ID2D1RenderTarget *)This, radialGradientBrushProperties, brushProperties, gradientStopCollection, radialGradientBrush)) + +#define ID2D1HwndRenderTarget_CreateCompatibleRenderTarget(This, desiredSize, desiredPixelSize, desiredFormat, options, bitmapRenderTarget) \ + ((This)->lpVtbl->Base.CreateCompatibleRenderTarget((ID2D1RenderTarget *)This, desiredSize, desiredPixelSize, desiredFormat, options, bitmapRenderTarget)) + +#define ID2D1HwndRenderTarget_CreateLayer(This, size, layer) \ + ((This)->lpVtbl->Base.CreateLayer((ID2D1RenderTarget *)This, size, layer)) + +#define ID2D1HwndRenderTarget_CreateMesh(This, mesh) \ + ((This)->lpVtbl->Base.CreateMesh((ID2D1RenderTarget *)This, mesh)) + +#define ID2D1HwndRenderTarget_DrawLine(This, point0, point1, brush, strokeWidth, strokeStyle) \ + ((This)->lpVtbl->Base.DrawLine((ID2D1RenderTarget *)This, point0, point1, brush, strokeWidth, strokeStyle)) + +#define ID2D1HwndRenderTarget_DrawRectangle(This, rect, brush, strokeWidth, strokeStyle) \ + ((This)->lpVtbl->Base.DrawRectangle((ID2D1RenderTarget *)This, rect, brush, strokeWidth, strokeStyle)) + +#define ID2D1HwndRenderTarget_FillRectangle(This, rect, brush) \ + ((This)->lpVtbl->Base.FillRectangle((ID2D1RenderTarget *)This, rect, brush)) + +#define ID2D1HwndRenderTarget_DrawRoundedRectangle(This, roundedRect, brush, strokeWidth, strokeStyle) \ + ((This)->lpVtbl->Base.DrawRoundedRectangle((ID2D1RenderTarget *)This, roundedRect, brush, strokeWidth, strokeStyle)) + +#define ID2D1HwndRenderTarget_FillRoundedRectangle(This, roundedRect, brush) \ + ((This)->lpVtbl->Base.FillRoundedRectangle((ID2D1RenderTarget *)This, roundedRect, brush)) + +#define ID2D1HwndRenderTarget_DrawEllipse(This, ellipse, brush, strokeWidth, strokeStyle) \ + ((This)->lpVtbl->Base.DrawEllipse((ID2D1RenderTarget *)This, ellipse, brush, strokeWidth, strokeStyle)) + +#define ID2D1HwndRenderTarget_FillEllipse(This, ellipse, brush) \ + ((This)->lpVtbl->Base.FillEllipse((ID2D1RenderTarget *)This, ellipse, brush)) + +#define ID2D1HwndRenderTarget_DrawGeometry(This, geometry, brush, strokeWidth, strokeStyle) \ + ((This)->lpVtbl->Base.DrawGeometry((ID2D1RenderTarget *)This, geometry, brush, strokeWidth, strokeStyle)) + +#define ID2D1HwndRenderTarget_FillGeometry(This, geometry, brush, opacityBrush) \ + ((This)->lpVtbl->Base.FillGeometry((ID2D1RenderTarget *)This, geometry, brush, opacityBrush)) + +#define ID2D1HwndRenderTarget_FillMesh(This, mesh, brush) \ + ((This)->lpVtbl->Base.FillMesh((ID2D1RenderTarget *)This, mesh, brush)) + +#define ID2D1HwndRenderTarget_FillOpacityMask(This, opacityMask, brush, content, destinationRectangle, sourceRectangle) \ + ((This)->lpVtbl->Base.FillOpacityMask((ID2D1RenderTarget *)This, opacityMask, brush, content, destinationRectangle, sourceRectangle)) + +#define ID2D1HwndRenderTarget_DrawBitmap(This, bitmap, destinationRectangle, opacity, interpolationMode, sourceRectangle) \ + ((This)->lpVtbl->Base.DrawBitmap((ID2D1RenderTarget *)This, bitmap, destinationRectangle, opacity, interpolationMode, sourceRectangle)) + +#define ID2D1HwndRenderTarget_DrawText(This, string, stringLength, textFormat, layoutRect, defaultForegroundBrush, options, measuringMode) \ + ((This)->lpVtbl->Base.DrawText((ID2D1RenderTarget *)This, string, stringLength, textFormat, layoutRect, defaultForegroundBrush, options, measuringMode)) + +#define ID2D1HwndRenderTarget_DrawTextLayout(This, origin, textLayout, defaultForegroundBrush, options) \ + ((This)->lpVtbl->Base.DrawTextLayout((ID2D1RenderTarget *)This, origin, textLayout, defaultForegroundBrush, options)) + +#define ID2D1HwndRenderTarget_DrawGlyphRun(This, baselineOrigin, glyphRun, foregroundBrush, measuringMode) \ + ((This)->lpVtbl->Base.DrawGlyphRun((ID2D1RenderTarget *)This, baselineOrigin, glyphRun, foregroundBrush, measuringMode)) + +#define ID2D1HwndRenderTarget_SetTransform(This, transform) \ + ((This)->lpVtbl->Base.SetTransform((ID2D1RenderTarget *)This, transform)) + +#define ID2D1HwndRenderTarget_GetTransform(This, transform) \ + ((This)->lpVtbl->Base.GetTransform((ID2D1RenderTarget *)This, transform)) + +#define ID2D1HwndRenderTarget_SetAntialiasMode(This, antialiasMode) \ + ((This)->lpVtbl->Base.SetAntialiasMode((ID2D1RenderTarget *)This, antialiasMode)) + +#define ID2D1HwndRenderTarget_GetAntialiasMode(This) \ + ((This)->lpVtbl->Base.GetAntialiasMode((ID2D1RenderTarget *)This)) + +#define ID2D1HwndRenderTarget_SetTextAntialiasMode(This, textAntialiasMode) \ + ((This)->lpVtbl->Base.SetTextAntialiasMode((ID2D1RenderTarget *)This, textAntialiasMode)) + +#define ID2D1HwndRenderTarget_GetTextAntialiasMode(This) \ + ((This)->lpVtbl->Base.GetTextAntialiasMode((ID2D1RenderTarget *)This)) + +#define ID2D1HwndRenderTarget_SetTextRenderingParams(This, textRenderingParams) \ + ((This)->lpVtbl->Base.SetTextRenderingParams((ID2D1RenderTarget *)This, textRenderingParams)) + +#define ID2D1HwndRenderTarget_GetTextRenderingParams(This, textRenderingParams) \ + ((This)->lpVtbl->Base.GetTextRenderingParams((ID2D1RenderTarget *)This, textRenderingParams)) + +#define ID2D1HwndRenderTarget_SetTags(This, tag1, tag2) \ + ((This)->lpVtbl->Base.SetTags((ID2D1RenderTarget *)This, tag1, tag2)) + +#define ID2D1HwndRenderTarget_GetTags(This, tag1, tag2) \ + ((This)->lpVtbl->Base.GetTags((ID2D1RenderTarget *)This, tag1, tag2)) + +#define ID2D1HwndRenderTarget_PushLayer(This, layerParameters, layer) \ + ((This)->lpVtbl->Base.PushLayer((ID2D1RenderTarget *)This, layerParameters, layer)) + +#define ID2D1HwndRenderTarget_PopLayer(This) \ + ((This)->lpVtbl->Base.PopLayer((ID2D1RenderTarget *)This)) + +#define ID2D1HwndRenderTarget_Flush(This, tag1, tag2) \ + ((This)->lpVtbl->Base.Flush((ID2D1RenderTarget *)This, tag1, tag2)) + +#define ID2D1HwndRenderTarget_SaveDrawingState(This, drawingStateBlock) \ + ((This)->lpVtbl->Base.SaveDrawingState((ID2D1RenderTarget *)This, drawingStateBlock)) + +#define ID2D1HwndRenderTarget_RestoreDrawingState(This, drawingStateBlock) \ + ((This)->lpVtbl->Base.RestoreDrawingState((ID2D1RenderTarget *)This, drawingStateBlock)) + +#define ID2D1HwndRenderTarget_PushAxisAlignedClip(This, clipRect, antialiasMode) \ + ((This)->lpVtbl->Base.PushAxisAlignedClip((ID2D1RenderTarget *)This, clipRect, antialiasMode)) + +#define ID2D1HwndRenderTarget_PopAxisAlignedClip(This) \ + ((This)->lpVtbl->Base.PopAxisAlignedClip((ID2D1RenderTarget *)This)) + +#define ID2D1HwndRenderTarget_Clear(This, clearColor) \ + ((This)->lpVtbl->Base.Clear((ID2D1RenderTarget *)This, clearColor)) + +#define ID2D1HwndRenderTarget_BeginDraw(This) \ + ((This)->lpVtbl->Base.BeginDraw((ID2D1RenderTarget *)This)) + +#define ID2D1HwndRenderTarget_EndDraw(This, tag1, tag2) \ + ((This)->lpVtbl->Base.EndDraw((ID2D1RenderTarget *)This, tag1, tag2)) + +#define ID2D1HwndRenderTarget_GetPixelFormat(This) \ + ((This)->lpVtbl->Base.GetPixelFormat((ID2D1RenderTarget *)This)) + +#define ID2D1HwndRenderTarget_SetDpi(This, dpiX, dpiY) \ + ((This)->lpVtbl->Base.SetDpi((ID2D1RenderTarget *)This, dpiX, dpiY)) + +#define ID2D1HwndRenderTarget_GetDpi(This, dpiX, dpiY) \ + ((This)->lpVtbl->Base.GetDpi((ID2D1RenderTarget *)This, dpiX, dpiY)) + +#define ID2D1HwndRenderTarget_GetSize(This) \ + ((This)->lpVtbl->Base.GetSize((ID2D1RenderTarget *)This)) + +#define ID2D1HwndRenderTarget_GetPixelSize(This) \ + ((This)->lpVtbl->Base.GetPixelSize((ID2D1RenderTarget *)This)) + +#define ID2D1HwndRenderTarget_GetMaximumBitmapSize(This) \ + ((This)->lpVtbl->Base.GetMaximumBitmapSize((ID2D1RenderTarget *)This)) + +#define ID2D1HwndRenderTarget_IsSupported(This, renderTargetProperties) \ + ((This)->lpVtbl->Base.IsSupported((ID2D1RenderTarget *)This, renderTargetProperties)) + +#define ID2D1HwndRenderTarget_CheckWindowState(This) \ + ((This)->lpVtbl->CheckWindowState(This)) + +#define ID2D1HwndRenderTarget_Resize(This, pixelSize) \ + ((This)->lpVtbl->Resize(This, pixelSize)) + +#define ID2D1HwndRenderTarget_GetHwnd(This) \ + ((This)->lpVtbl->GetHwnd(This)) + +typedef interface ID2D1GdiInteropRenderTarget ID2D1GdiInteropRenderTarget; + +typedef struct ID2D1GdiInteropRenderTargetVtbl +{ + + IUnknownVtbl Base; + + + STDMETHOD(GetDC)( + ID2D1GdiInteropRenderTarget *This, + D2D1_DC_INITIALIZE_MODE mode, + __out HDC *hdc + ) PURE; + + STDMETHOD(ReleaseDC)( + ID2D1GdiInteropRenderTarget *This, + __in_opt CONST RECT *update + ) PURE; +} ID2D1GdiInteropRenderTargetVtbl; + +interface ID2D1GdiInteropRenderTarget +{ + CONST struct ID2D1GdiInteropRenderTargetVtbl *lpVtbl; +}; + + +#define ID2D1GdiInteropRenderTarget_QueryInterface(This, riid, ppv) \ + ((This)->lpVtbl->Base.QueryInterface((IUnknown *)This, riid, ppv)) + +#define ID2D1GdiInteropRenderTarget_AddRef(This) \ + ((This)->lpVtbl->Base.AddRef((IUnknown *)This)) + +#define ID2D1GdiInteropRenderTarget_Release(This) \ + ((This)->lpVtbl->Base.Release((IUnknown *)This)) + +#define ID2D1GdiInteropRenderTarget_GetDC(This, mode, hdc) \ + ((This)->lpVtbl->GetDC(This, mode, hdc)) + +#define ID2D1GdiInteropRenderTarget_ReleaseDC(This, update) \ + ((This)->lpVtbl->ReleaseDC(This, update)) + +typedef interface ID2D1DCRenderTarget ID2D1DCRenderTarget; + +typedef struct ID2D1DCRenderTargetVtbl +{ + + ID2D1RenderTargetVtbl Base; + + + STDMETHOD(BindDC)( + ID2D1DCRenderTarget *This, + __in CONST HDC hDC, + __in CONST RECT *pSubRect + ) PURE; +} ID2D1DCRenderTargetVtbl; + +interface ID2D1DCRenderTarget +{ + CONST struct ID2D1DCRenderTargetVtbl *lpVtbl; +}; + + +#define ID2D1DCRenderTarget_QueryInterface(This, riid, ppv) \ + ((This)->lpVtbl->Base.Base.Base.QueryInterface((IUnknown *)This, riid, ppv)) + +#define ID2D1DCRenderTarget_AddRef(This) \ + ((This)->lpVtbl->Base.Base.Base.AddRef((IUnknown *)This)) + +#define ID2D1DCRenderTarget_Release(This) \ + ((This)->lpVtbl->Base.Base.Base.Release((IUnknown *)This)) + +#define ID2D1DCRenderTarget_GetFactory(This, factory) \ + ((This)->lpVtbl->Base.Base.GetFactory((ID2D1Resource *)This, factory)) + +#define ID2D1DCRenderTarget_CreateBitmap(This, size, srcData, pitch, bitmapProperties, bitmap) \ + ((This)->lpVtbl->Base.CreateBitmap((ID2D1RenderTarget *)This, size, srcData, pitch, bitmapProperties, bitmap)) + +#define ID2D1DCRenderTarget_CreateBitmapFromWicBitmap(This, wicBitmapSource, bitmapProperties, bitmap) \ + ((This)->lpVtbl->Base.CreateBitmapFromWicBitmap((ID2D1RenderTarget *)This, wicBitmapSource, bitmapProperties, bitmap)) + +#define ID2D1DCRenderTarget_CreateSharedBitmap(This, riid, data, bitmapProperties, bitmap) \ + ((This)->lpVtbl->Base.CreateSharedBitmap((ID2D1RenderTarget *)This, riid, data, bitmapProperties, bitmap)) + +#define ID2D1DCRenderTarget_CreateBitmapBrush(This, bitmap, bitmapBrushProperties, brushProperties, bitmapBrush) \ + ((This)->lpVtbl->Base.CreateBitmapBrush((ID2D1RenderTarget *)This, bitmap, bitmapBrushProperties, brushProperties, bitmapBrush)) + +#define ID2D1DCRenderTarget_CreateSolidColorBrush(This, color, brushProperties, solidColorBrush) \ + ((This)->lpVtbl->Base.CreateSolidColorBrush((ID2D1RenderTarget *)This, color, brushProperties, solidColorBrush)) + +#define ID2D1DCRenderTarget_CreateGradientStopCollection(This, gradientStops, gradientStopsCount, colorInterpolationGamma, extendMode, gradientStopCollection) \ + ((This)->lpVtbl->Base.CreateGradientStopCollection((ID2D1RenderTarget *)This, gradientStops, gradientStopsCount, colorInterpolationGamma, extendMode, gradientStopCollection)) + +#define ID2D1DCRenderTarget_CreateLinearGradientBrush(This, linearGradientBrushProperties, brushProperties, gradientStopCollection, linearGradientBrush) \ + ((This)->lpVtbl->Base.CreateLinearGradientBrush((ID2D1RenderTarget *)This, linearGradientBrushProperties, brushProperties, gradientStopCollection, linearGradientBrush)) + +#define ID2D1DCRenderTarget_CreateRadialGradientBrush(This, radialGradientBrushProperties, brushProperties, gradientStopCollection, radialGradientBrush) \ + ((This)->lpVtbl->Base.CreateRadialGradientBrush((ID2D1RenderTarget *)This, radialGradientBrushProperties, brushProperties, gradientStopCollection, radialGradientBrush)) + +#define ID2D1DCRenderTarget_CreateCompatibleRenderTarget(This, desiredSize, desiredPixelSize, desiredFormat, options, bitmapRenderTarget) \ + ((This)->lpVtbl->Base.CreateCompatibleRenderTarget((ID2D1RenderTarget *)This, desiredSize, desiredPixelSize, desiredFormat, options, bitmapRenderTarget)) + +#define ID2D1DCRenderTarget_CreateLayer(This, size, layer) \ + ((This)->lpVtbl->Base.CreateLayer((ID2D1RenderTarget *)This, size, layer)) + +#define ID2D1DCRenderTarget_CreateMesh(This, mesh) \ + ((This)->lpVtbl->Base.CreateMesh((ID2D1RenderTarget *)This, mesh)) + +#define ID2D1DCRenderTarget_DrawLine(This, point0, point1, brush, strokeWidth, strokeStyle) \ + ((This)->lpVtbl->Base.DrawLine((ID2D1RenderTarget *)This, point0, point1, brush, strokeWidth, strokeStyle)) + +#define ID2D1DCRenderTarget_DrawRectangle(This, rect, brush, strokeWidth, strokeStyle) \ + ((This)->lpVtbl->Base.DrawRectangle((ID2D1RenderTarget *)This, rect, brush, strokeWidth, strokeStyle)) + +#define ID2D1DCRenderTarget_FillRectangle(This, rect, brush) \ + ((This)->lpVtbl->Base.FillRectangle((ID2D1RenderTarget *)This, rect, brush)) + +#define ID2D1DCRenderTarget_DrawRoundedRectangle(This, roundedRect, brush, strokeWidth, strokeStyle) \ + ((This)->lpVtbl->Base.DrawRoundedRectangle((ID2D1RenderTarget *)This, roundedRect, brush, strokeWidth, strokeStyle)) + +#define ID2D1DCRenderTarget_FillRoundedRectangle(This, roundedRect, brush) \ + ((This)->lpVtbl->Base.FillRoundedRectangle((ID2D1RenderTarget *)This, roundedRect, brush)) + +#define ID2D1DCRenderTarget_DrawEllipse(This, ellipse, brush, strokeWidth, strokeStyle) \ + ((This)->lpVtbl->Base.DrawEllipse((ID2D1RenderTarget *)This, ellipse, brush, strokeWidth, strokeStyle)) + +#define ID2D1DCRenderTarget_FillEllipse(This, ellipse, brush) \ + ((This)->lpVtbl->Base.FillEllipse((ID2D1RenderTarget *)This, ellipse, brush)) + +#define ID2D1DCRenderTarget_DrawGeometry(This, geometry, brush, strokeWidth, strokeStyle) \ + ((This)->lpVtbl->Base.DrawGeometry((ID2D1RenderTarget *)This, geometry, brush, strokeWidth, strokeStyle)) + +#define ID2D1DCRenderTarget_FillGeometry(This, geometry, brush, opacityBrush) \ + ((This)->lpVtbl->Base.FillGeometry((ID2D1RenderTarget *)This, geometry, brush, opacityBrush)) + +#define ID2D1DCRenderTarget_FillMesh(This, mesh, brush) \ + ((This)->lpVtbl->Base.FillMesh((ID2D1RenderTarget *)This, mesh, brush)) + +#define ID2D1DCRenderTarget_FillOpacityMask(This, opacityMask, brush, content, destinationRectangle, sourceRectangle) \ + ((This)->lpVtbl->Base.FillOpacityMask((ID2D1RenderTarget *)This, opacityMask, brush, content, destinationRectangle, sourceRectangle)) + +#define ID2D1DCRenderTarget_DrawBitmap(This, bitmap, destinationRectangle, opacity, interpolationMode, sourceRectangle) \ + ((This)->lpVtbl->Base.DrawBitmap((ID2D1RenderTarget *)This, bitmap, destinationRectangle, opacity, interpolationMode, sourceRectangle)) + +#define ID2D1DCRenderTarget_DrawText(This, string, stringLength, textFormat, layoutRect, defaultForegroundBrush, options, measuringMode) \ + ((This)->lpVtbl->Base.DrawText((ID2D1RenderTarget *)This, string, stringLength, textFormat, layoutRect, defaultForegroundBrush, options, measuringMode)) + +#define ID2D1DCRenderTarget_DrawTextLayout(This, origin, textLayout, defaultForegroundBrush, options) \ + ((This)->lpVtbl->Base.DrawTextLayout((ID2D1RenderTarget *)This, origin, textLayout, defaultForegroundBrush, options)) + +#define ID2D1DCRenderTarget_DrawGlyphRun(This, baselineOrigin, glyphRun, foregroundBrush, measuringMode) \ + ((This)->lpVtbl->Base.DrawGlyphRun((ID2D1RenderTarget *)This, baselineOrigin, glyphRun, foregroundBrush, measuringMode)) + +#define ID2D1DCRenderTarget_SetTransform(This, transform) \ + ((This)->lpVtbl->Base.SetTransform((ID2D1RenderTarget *)This, transform)) + +#define ID2D1DCRenderTarget_GetTransform(This, transform) \ + ((This)->lpVtbl->Base.GetTransform((ID2D1RenderTarget *)This, transform)) + +#define ID2D1DCRenderTarget_SetAntialiasMode(This, antialiasMode) \ + ((This)->lpVtbl->Base.SetAntialiasMode((ID2D1RenderTarget *)This, antialiasMode)) + +#define ID2D1DCRenderTarget_GetAntialiasMode(This) \ + ((This)->lpVtbl->Base.GetAntialiasMode((ID2D1RenderTarget *)This)) + +#define ID2D1DCRenderTarget_SetTextAntialiasMode(This, textAntialiasMode) \ + ((This)->lpVtbl->Base.SetTextAntialiasMode((ID2D1RenderTarget *)This, textAntialiasMode)) + +#define ID2D1DCRenderTarget_GetTextAntialiasMode(This) \ + ((This)->lpVtbl->Base.GetTextAntialiasMode((ID2D1RenderTarget *)This)) + +#define ID2D1DCRenderTarget_SetTextRenderingParams(This, textRenderingParams) \ + ((This)->lpVtbl->Base.SetTextRenderingParams((ID2D1RenderTarget *)This, textRenderingParams)) + +#define ID2D1DCRenderTarget_GetTextRenderingParams(This, textRenderingParams) \ + ((This)->lpVtbl->Base.GetTextRenderingParams((ID2D1RenderTarget *)This, textRenderingParams)) + +#define ID2D1DCRenderTarget_SetTags(This, tag1, tag2) \ + ((This)->lpVtbl->Base.SetTags((ID2D1RenderTarget *)This, tag1, tag2)) + +#define ID2D1DCRenderTarget_GetTags(This, tag1, tag2) \ + ((This)->lpVtbl->Base.GetTags((ID2D1RenderTarget *)This, tag1, tag2)) + +#define ID2D1DCRenderTarget_PushLayer(This, layerParameters, layer) \ + ((This)->lpVtbl->Base.PushLayer((ID2D1RenderTarget *)This, layerParameters, layer)) + +#define ID2D1DCRenderTarget_PopLayer(This) \ + ((This)->lpVtbl->Base.PopLayer((ID2D1RenderTarget *)This)) + +#define ID2D1DCRenderTarget_Flush(This, tag1, tag2) \ + ((This)->lpVtbl->Base.Flush((ID2D1RenderTarget *)This, tag1, tag2)) + +#define ID2D1DCRenderTarget_SaveDrawingState(This, drawingStateBlock) \ + ((This)->lpVtbl->Base.SaveDrawingState((ID2D1RenderTarget *)This, drawingStateBlock)) + +#define ID2D1DCRenderTarget_RestoreDrawingState(This, drawingStateBlock) \ + ((This)->lpVtbl->Base.RestoreDrawingState((ID2D1RenderTarget *)This, drawingStateBlock)) + +#define ID2D1DCRenderTarget_PushAxisAlignedClip(This, clipRect, antialiasMode) \ + ((This)->lpVtbl->Base.PushAxisAlignedClip((ID2D1RenderTarget *)This, clipRect, antialiasMode)) + +#define ID2D1DCRenderTarget_PopAxisAlignedClip(This) \ + ((This)->lpVtbl->Base.PopAxisAlignedClip((ID2D1RenderTarget *)This)) + +#define ID2D1DCRenderTarget_Clear(This, clearColor) \ + ((This)->lpVtbl->Base.Clear((ID2D1RenderTarget *)This, clearColor)) + +#define ID2D1DCRenderTarget_BeginDraw(This) \ + ((This)->lpVtbl->Base.BeginDraw((ID2D1RenderTarget *)This)) + +#define ID2D1DCRenderTarget_EndDraw(This, tag1, tag2) \ + ((This)->lpVtbl->Base.EndDraw((ID2D1RenderTarget *)This, tag1, tag2)) + +#define ID2D1DCRenderTarget_GetPixelFormat(This) \ + ((This)->lpVtbl->Base.GetPixelFormat((ID2D1RenderTarget *)This)) + +#define ID2D1DCRenderTarget_SetDpi(This, dpiX, dpiY) \ + ((This)->lpVtbl->Base.SetDpi((ID2D1RenderTarget *)This, dpiX, dpiY)) + +#define ID2D1DCRenderTarget_GetDpi(This, dpiX, dpiY) \ + ((This)->lpVtbl->Base.GetDpi((ID2D1RenderTarget *)This, dpiX, dpiY)) + +#define ID2D1DCRenderTarget_GetSize(This) \ + ((This)->lpVtbl->Base.GetSize((ID2D1RenderTarget *)This)) + +#define ID2D1DCRenderTarget_GetPixelSize(This) \ + ((This)->lpVtbl->Base.GetPixelSize((ID2D1RenderTarget *)This)) + +#define ID2D1DCRenderTarget_GetMaximumBitmapSize(This) \ + ((This)->lpVtbl->Base.GetMaximumBitmapSize((ID2D1RenderTarget *)This)) + +#define ID2D1DCRenderTarget_IsSupported(This, renderTargetProperties) \ + ((This)->lpVtbl->Base.IsSupported((ID2D1RenderTarget *)This, renderTargetProperties)) + +#define ID2D1DCRenderTarget_BindDC(This, hDC, pSubRect) \ + ((This)->lpVtbl->BindDC(This, hDC, pSubRect)) + +typedef interface ID2D1Factory ID2D1Factory; + +typedef struct ID2D1FactoryVtbl +{ + + IUnknownVtbl Base; + + + STDMETHOD(ReloadSystemMetrics)( + ID2D1Factory *This + ) PURE; + + STDMETHOD_(void, GetDesktopDpi)( + ID2D1Factory *This, + __out FLOAT *dpiX, + __out FLOAT *dpiY + ) PURE; + + STDMETHOD(CreateRectangleGeometry)( + ID2D1Factory *This, + __in CONST D2D1_RECT_F *rectangle, + __deref_out ID2D1RectangleGeometry **rectangleGeometry + ) PURE; + + STDMETHOD(CreateRoundedRectangleGeometry)( + ID2D1Factory *This, + __in CONST D2D1_ROUNDED_RECT *roundedRectangle, + __deref_out ID2D1RoundedRectangleGeometry **roundedRectangleGeometry + ) PURE; + + STDMETHOD(CreateEllipseGeometry)( + ID2D1Factory *This, + __in CONST D2D1_ELLIPSE *ellipse, + __deref_out ID2D1EllipseGeometry **ellipseGeometry + ) PURE; + + STDMETHOD(CreateGeometryGroup)( + ID2D1Factory *This, + D2D1_FILL_MODE fillMode, + __in_ecount(geometriesCount) ID2D1Geometry **geometries, + UINT geometriesCount, + __deref_out ID2D1GeometryGroup **geometryGroup + ) PURE; + + STDMETHOD(CreateTransformedGeometry)( + ID2D1Factory *This, + __in ID2D1Geometry *sourceGeometry, + __in CONST D2D1_MATRIX_3X2_F *transform, + __deref_out ID2D1TransformedGeometry **transformedGeometry + ) PURE; + + STDMETHOD(CreatePathGeometry)( + ID2D1Factory *This, + __deref_out ID2D1PathGeometry **pathGeometry + ) PURE; + + STDMETHOD(CreateStrokeStyle)( + ID2D1Factory *This, + __in CONST D2D1_STROKE_STYLE_PROPERTIES *strokeStyleProperties, + __in_ecount_opt(dashesCount) CONST FLOAT *dashes, + UINT dashesCount, + __deref_out ID2D1StrokeStyle **strokeStyle + ) PURE; + + STDMETHOD(CreateDrawingStateBlock)( + ID2D1Factory *This, + __in_opt CONST D2D1_DRAWING_STATE_DESCRIPTION *drawingStateDescription, + __in_opt IDWriteRenderingParams *textRenderingParams, + __deref_out ID2D1DrawingStateBlock **drawingStateBlock + ) PURE; + + STDMETHOD(CreateWicBitmapRenderTarget)( + ID2D1Factory *This, + __in IWICBitmap *target, + __in CONST D2D1_RENDER_TARGET_PROPERTIES *renderTargetProperties, + __deref_out ID2D1RenderTarget **renderTarget + ) PURE; + + STDMETHOD(CreateHwndRenderTarget)( + ID2D1Factory *This, + __in CONST D2D1_RENDER_TARGET_PROPERTIES *renderTargetProperties, + __in CONST D2D1_HWND_RENDER_TARGET_PROPERTIES *hwndRenderTargetProperties, + __deref_out ID2D1HwndRenderTarget **hwndRenderTarget + ) PURE; + + STDMETHOD(CreateDxgiSurfaceRenderTarget)( + ID2D1Factory *This, + __in IDXGISurface *dxgiSurface, + __in CONST D2D1_RENDER_TARGET_PROPERTIES *renderTargetProperties, + __deref_out ID2D1RenderTarget **renderTarget + ) PURE; + + STDMETHOD(CreateDCRenderTarget)( + ID2D1Factory *This, + __in CONST D2D1_RENDER_TARGET_PROPERTIES *renderTargetProperties, + __deref_out ID2D1DCRenderTarget **dcRenderTarget + ) PURE; +} ID2D1FactoryVtbl; + +interface ID2D1Factory +{ + CONST struct ID2D1FactoryVtbl *lpVtbl; +}; + + +#define ID2D1Factory_QueryInterface(This, riid, ppv) \ + ((This)->lpVtbl->Base.QueryInterface((IUnknown *)This, riid, ppv)) + +#define ID2D1Factory_AddRef(This) \ + ((This)->lpVtbl->Base.AddRef((IUnknown *)This)) + +#define ID2D1Factory_Release(This) \ + ((This)->lpVtbl->Base.Release((IUnknown *)This)) + +#define ID2D1Factory_ReloadSystemMetrics(This) \ + ((This)->lpVtbl->ReloadSystemMetrics(This)) + +#define ID2D1Factory_GetDesktopDpi(This, dpiX, dpiY) \ + ((This)->lpVtbl->GetDesktopDpi(This, dpiX, dpiY)) + +#define ID2D1Factory_CreateRectangleGeometry(This, rectangle, rectangleGeometry) \ + ((This)->lpVtbl->CreateRectangleGeometry(This, rectangle, rectangleGeometry)) + +#define ID2D1Factory_CreateRoundedRectangleGeometry(This, roundedRectangle, roundedRectangleGeometry) \ + ((This)->lpVtbl->CreateRoundedRectangleGeometry(This, roundedRectangle, roundedRectangleGeometry)) + +#define ID2D1Factory_CreateEllipseGeometry(This, ellipse, ellipseGeometry) \ + ((This)->lpVtbl->CreateEllipseGeometry(This, ellipse, ellipseGeometry)) + +#define ID2D1Factory_CreateGeometryGroup(This, fillMode, geometries, geometriesCount, geometryGroup) \ + ((This)->lpVtbl->CreateGeometryGroup(This, fillMode, geometries, geometriesCount, geometryGroup)) + +#define ID2D1Factory_CreateTransformedGeometry(This, sourceGeometry, transform, transformedGeometry) \ + ((This)->lpVtbl->CreateTransformedGeometry(This, sourceGeometry, transform, transformedGeometry)) + +#define ID2D1Factory_CreatePathGeometry(This, pathGeometry) \ + ((This)->lpVtbl->CreatePathGeometry(This, pathGeometry)) + +#define ID2D1Factory_CreateStrokeStyle(This, strokeStyleProperties, dashes, dashesCount, strokeStyle) \ + ((This)->lpVtbl->CreateStrokeStyle(This, strokeStyleProperties, dashes, dashesCount, strokeStyle)) + +#define ID2D1Factory_CreateDrawingStateBlock(This, drawingStateDescription, textRenderingParams, drawingStateBlock) \ + ((This)->lpVtbl->CreateDrawingStateBlock(This, drawingStateDescription, textRenderingParams, drawingStateBlock)) + +#define ID2D1Factory_CreateWicBitmapRenderTarget(This, target, renderTargetProperties, renderTarget) \ + ((This)->lpVtbl->CreateWicBitmapRenderTarget(This, target, renderTargetProperties, renderTarget)) + +#define ID2D1Factory_CreateHwndRenderTarget(This, renderTargetProperties, hwndRenderTargetProperties, hwndRenderTarget) \ + ((This)->lpVtbl->CreateHwndRenderTarget(This, renderTargetProperties, hwndRenderTargetProperties, hwndRenderTarget)) + +#define ID2D1Factory_CreateDxgiSurfaceRenderTarget(This, dxgiSurface, renderTargetProperties, renderTarget) \ + ((This)->lpVtbl->CreateDxgiSurfaceRenderTarget(This, dxgiSurface, renderTargetProperties, renderTarget)) + +#define ID2D1Factory_CreateDCRenderTarget(This, renderTargetProperties, dcRenderTarget) \ + ((This)->lpVtbl->CreateDCRenderTarget(This, renderTargetProperties, dcRenderTarget)) + + +#endif + + +#ifdef __cplusplus +extern "C" +{ +#endif + + // + // This export cannot be in a namespace because compiler name mangling isn't consistent + // also, this must be 'C' callable. + // + HRESULT WINAPI + D2D1CreateFactory( + __in D2D1_FACTORY_TYPE factoryType, + __in REFIID riid, + __in_opt CONST D2D1_FACTORY_OPTIONS *pFactoryOptions, + __out void **ppIFactory + ); + + + void WINAPI + D2D1MakeRotateMatrix( + __in FLOAT angle, + __in D2D1_POINT_2F center, + __out D2D1_MATRIX_3X2_F *matrix + ); + + void WINAPI + D2D1MakeSkewMatrix( + __in FLOAT angleX, + __in FLOAT angleY, + __in D2D1_POINT_2F center, + __out D2D1_MATRIX_3X2_F *matrix + ); + + BOOL WINAPI + D2D1IsMatrixInvertible( + __in CONST D2D1_MATRIX_3X2_F *matrix + ); + + BOOL WINAPI + D2D1InvertMatrix( + __inout D2D1_MATRIX_3X2_F *matrix + ); + +#ifdef __cplusplus +} +#endif + +#ifndef D2D1FORCEINLINE +#define D2D1FORCEINLINE FORCEINLINE +#endif // #ifndef D2D1FORCEINLINE + + +#include + + +#ifndef D2D_USE_C_DEFINITIONS + +inline +HRESULT +D2D1CreateFactory( + __in D2D1_FACTORY_TYPE factoryType, + __in REFIID riid, + __out void **factory + ) +{ + return + D2D1CreateFactory( + factoryType, + riid, + NULL, + factory); +} + + +template +HRESULT +D2D1CreateFactory( + __in D2D1_FACTORY_TYPE factoryType, + __out Factory **factory + ) +{ + return + D2D1CreateFactory( + factoryType, + __uuidof(Factory), + reinterpret_cast(factory)); +} + +template +HRESULT +D2D1CreateFactory( + __in D2D1_FACTORY_TYPE factoryType, + __in CONST D2D1_FACTORY_OPTIONS &factoryOptions, + __out Factory **ppFactory + ) +{ + return + D2D1CreateFactory( + factoryType, + __uuidof(Factory), + &factoryOptions, + reinterpret_cast(ppFactory)); +} + +#endif // #ifndef D2D_USE_C_DEFINITIONS +#endif // #ifndef _D2D1_H_ diff --git a/MediaClient/MediaClient/directx/include/D2D1Helper.h b/MediaClient/MediaClient/directx/include/D2D1Helper.h new file mode 100644 index 0000000..2f54ea2 --- /dev/null +++ b/MediaClient/MediaClient/directx/include/D2D1Helper.h @@ -0,0 +1,948 @@ + +/*=========================================================================*\ + + Copyright (c) Microsoft Corporation. All rights reserved. + + File: D2D1helper.h + + Module Name: D2D + + Description: Helper files over the D2D interfaces and APIs. + +\*=========================================================================*/ +#pragma once + +#ifndef _D2D1_HELPER_H_ +#define _D2D1_HELPER_H_ + +#ifndef _D2D1_H_ +#include +#endif // #ifndef _D2D1_H_ + +#ifndef D2D_USE_C_DEFINITIONS + +namespace D2D1 +{ + // + // Forward declared IdentityMatrix function to allow matrix class to use + // these constructors. + // + D2D1FORCEINLINE + D2D1_MATRIX_3X2_F + IdentityMatrix(); + + // + // The default trait type for objects in D2D is float. + // + template + struct TypeTraits + { + typedef D2D1_POINT_2F Point; + typedef D2D1_SIZE_F Size; + typedef D2D1_RECT_F Rect; + }; + + template<> + struct TypeTraits + { + typedef D2D1_POINT_2U Point; + typedef D2D1_SIZE_U Size; + typedef D2D1_RECT_U Rect; + }; + + static inline + FLOAT FloatMax() + { + #ifdef FLT_MAX + return FLT_MAX; + #else + return 3.402823466e+38F; + #endif + } + + // + // Construction helpers + // + template + D2D1FORCEINLINE + typename TypeTraits::Point + Point2( + Type x, + Type y + ) + { + typename TypeTraits::Point point = { x, y }; + + return point; + } + + D2D1FORCEINLINE + D2D1_POINT_2F + Point2F( + FLOAT x = 0.f, + FLOAT y = 0.f + ) + { + return Point2(x, y); + } + + D2D1FORCEINLINE + D2D1_POINT_2U + Point2U( + UINT32 x = 0, + UINT32 y = 0 + ) + { + return Point2(x, y); + } + + template + D2D1FORCEINLINE + typename TypeTraits::Size + Size( + Type width, + Type height + ) + { + typename TypeTraits::Size size = { width, height }; + + return size; + } + + D2D1FORCEINLINE + D2D1_SIZE_F + SizeF( + FLOAT width = 0.f, + FLOAT height = 0.f + ) + { + return Size(width, height); + } + + D2D1FORCEINLINE + D2D1_SIZE_U + SizeU( + UINT32 width = 0, + UINT32 height = 0 + ) + { + return Size(width, height); + } + + template + D2D1FORCEINLINE + typename TypeTraits::Rect + Rect( + Type left, + Type top, + Type right, + Type bottom + ) + { + typename TypeTraits::Rect rect = { left, top, right, bottom }; + + return rect; + } + + D2D1FORCEINLINE + D2D1_RECT_F + RectF( + FLOAT left = 0.f, + FLOAT top = 0.f, + FLOAT right = 0.f, + FLOAT bottom = 0.f + ) + { + return Rect(left, top, right, bottom); + } + + D2D1FORCEINLINE + D2D1_RECT_U + RectU( + UINT32 left = 0, + UINT32 top = 0, + UINT32 right = 0, + UINT32 bottom = 0 + ) + { + return Rect(left, top, right, bottom); + } + + D2D1FORCEINLINE + D2D1_RECT_F + InfiniteRect() + { + D2D1_RECT_F rect = { -FloatMax(), -FloatMax(), FloatMax(), FloatMax() }; + + return rect; + } + + D2D1FORCEINLINE + D2D1_ARC_SEGMENT + ArcSegment( + __in CONST D2D1_POINT_2F &point, + __in CONST D2D1_SIZE_F &size, + __in FLOAT rotationAngle, + __in D2D1_SWEEP_DIRECTION sweepDirection, + __in D2D1_ARC_SIZE arcSize + ) + { + D2D1_ARC_SEGMENT arcSegment = { point, size, rotationAngle, sweepDirection, arcSize }; + + return arcSegment; + } + + D2D1FORCEINLINE + D2D1_BEZIER_SEGMENT + BezierSegment( + __in CONST D2D1_POINT_2F &point1, + __in CONST D2D1_POINT_2F &point2, + __in CONST D2D1_POINT_2F &point3 + ) + { + D2D1_BEZIER_SEGMENT bezierSegment = { point1, point2, point3 }; + + return bezierSegment; + } + + D2D1FORCEINLINE + D2D1_ELLIPSE + Ellipse( + __in CONST D2D1_POINT_2F ¢er, + FLOAT radiusX, + FLOAT radiusY + ) + { + D2D1_ELLIPSE ellipse; + + ellipse.point = center; + ellipse.radiusX = radiusX; + ellipse.radiusY = radiusY; + + return ellipse; + } + + D2D1FORCEINLINE + D2D1_ROUNDED_RECT + RoundedRect( + __in CONST D2D1_RECT_F &rect, + FLOAT radiusX, + FLOAT radiusY + ) + { + D2D1_ROUNDED_RECT roundedRect; + + roundedRect.rect = rect; + roundedRect.radiusX = radiusX; + roundedRect.radiusY = radiusY; + + return roundedRect; + } + + D2D1FORCEINLINE + D2D1_BRUSH_PROPERTIES + BrushProperties( + __in FLOAT opacity = 1.0, + __in CONST D2D1_MATRIX_3X2_F &transform = D2D1::IdentityMatrix() + ) + { + D2D1_BRUSH_PROPERTIES brushProperties; + + brushProperties.opacity = opacity; + brushProperties.transform = transform; + + return brushProperties; + } + + D2D1FORCEINLINE + D2D1_GRADIENT_STOP + GradientStop( + FLOAT position, + __in CONST D2D1_COLOR_F &color + ) + { + D2D1_GRADIENT_STOP gradientStop = { position, color }; + + return gradientStop; + } + + D2D1FORCEINLINE + D2D1_QUADRATIC_BEZIER_SEGMENT + QuadraticBezierSegment( + __in CONST D2D1_POINT_2F &point1, + __in CONST D2D1_POINT_2F &point2 + ) + { + D2D1_QUADRATIC_BEZIER_SEGMENT quadraticBezier = { point1, point2 }; + + return quadraticBezier; + } + + D2D1FORCEINLINE + D2D1_STROKE_STYLE_PROPERTIES + StrokeStyleProperties( + D2D1_CAP_STYLE startCap = D2D1_CAP_STYLE_FLAT, + D2D1_CAP_STYLE endCap = D2D1_CAP_STYLE_FLAT, + D2D1_CAP_STYLE dashCap = D2D1_CAP_STYLE_FLAT, + D2D1_LINE_JOIN lineJoin = D2D1_LINE_JOIN_MITER, + FLOAT miterLimit = 10.0f, + D2D1_DASH_STYLE dashStyle = D2D1_DASH_STYLE_SOLID, + FLOAT dashOffset = 0.0f + ) + { + D2D1_STROKE_STYLE_PROPERTIES strokeStyleProperties; + + strokeStyleProperties.startCap = startCap; + strokeStyleProperties.endCap = endCap; + strokeStyleProperties.dashCap = dashCap; + strokeStyleProperties.lineJoin = lineJoin; + strokeStyleProperties.miterLimit = miterLimit; + strokeStyleProperties.dashStyle = dashStyle; + strokeStyleProperties.dashOffset = dashOffset; + + return strokeStyleProperties; + } + + D2D1FORCEINLINE + D2D1_BITMAP_BRUSH_PROPERTIES + BitmapBrushProperties( + D2D1_EXTEND_MODE extendModeX = D2D1_EXTEND_MODE_CLAMP, + D2D1_EXTEND_MODE extendModeY = D2D1_EXTEND_MODE_CLAMP, + D2D1_BITMAP_INTERPOLATION_MODE interpolationMode = D2D1_BITMAP_INTERPOLATION_MODE_LINEAR + ) + { + D2D1_BITMAP_BRUSH_PROPERTIES bitmapBrushProperties; + + bitmapBrushProperties.extendModeX = extendModeX; + bitmapBrushProperties.extendModeY = extendModeY; + bitmapBrushProperties.interpolationMode = interpolationMode; + + return bitmapBrushProperties; + } + + D2D1FORCEINLINE + D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES + LinearGradientBrushProperties( + __in CONST D2D1_POINT_2F &startPoint, + __in CONST D2D1_POINT_2F &endPoint + ) + { + D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES linearGradientBrushProperties; + + linearGradientBrushProperties.startPoint = startPoint; + linearGradientBrushProperties.endPoint = endPoint; + + return linearGradientBrushProperties; + } + + D2D1FORCEINLINE + D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES + RadialGradientBrushProperties( + __in CONST D2D1_POINT_2F ¢er, + __in CONST D2D1_POINT_2F &gradientOriginOffset, + FLOAT radiusX, + FLOAT radiusY + ) + { + D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES radialGradientBrushProperties; + + radialGradientBrushProperties.center = center; + radialGradientBrushProperties.gradientOriginOffset = gradientOriginOffset; + radialGradientBrushProperties.radiusX = radiusX; + radialGradientBrushProperties.radiusY = radiusY; + + return radialGradientBrushProperties; + } + + // + // PixelFormat + // + D2D1FORCEINLINE + D2D1_PIXEL_FORMAT + PixelFormat( + __in DXGI_FORMAT dxgiFormat = DXGI_FORMAT_UNKNOWN, + __in D2D1_ALPHA_MODE alphaMode = D2D1_ALPHA_MODE_UNKNOWN + ) + { + D2D1_PIXEL_FORMAT pixelFormat; + + pixelFormat.format = dxgiFormat; + pixelFormat.alphaMode = alphaMode; + + return pixelFormat; + } + + // + // Bitmaps + // + D2D1FORCEINLINE + D2D1_BITMAP_PROPERTIES + BitmapProperties( + CONST D2D1_PIXEL_FORMAT &pixelFormat = D2D1::PixelFormat(), + FLOAT dpiX = 96.0f, + FLOAT dpiY = 96.0f + ) + { + D2D1_BITMAP_PROPERTIES bitmapProperties; + + bitmapProperties.pixelFormat = pixelFormat; + bitmapProperties.dpiX = dpiX; + bitmapProperties.dpiY = dpiY; + + return bitmapProperties; + } + + // + // Render Targets + // + D2D1FORCEINLINE + D2D1_RENDER_TARGET_PROPERTIES + RenderTargetProperties( + D2D1_RENDER_TARGET_TYPE type = D2D1_RENDER_TARGET_TYPE_DEFAULT, + __in CONST D2D1_PIXEL_FORMAT &pixelFormat = D2D1::PixelFormat(), + FLOAT dpiX = 0.0, + FLOAT dpiY = 0.0, + D2D1_RENDER_TARGET_USAGE usage = D2D1_RENDER_TARGET_USAGE_NONE, + D2D1_FEATURE_LEVEL minLevel = D2D1_FEATURE_LEVEL_DEFAULT + ) + { + D2D1_RENDER_TARGET_PROPERTIES renderTargetProperties; + + renderTargetProperties.type = type; + renderTargetProperties.pixelFormat = pixelFormat; + renderTargetProperties.dpiX = dpiX; + renderTargetProperties.dpiY = dpiY; + renderTargetProperties.usage = usage; + renderTargetProperties.minLevel = minLevel; + + return renderTargetProperties; + } + + D2D1FORCEINLINE + D2D1_HWND_RENDER_TARGET_PROPERTIES + HwndRenderTargetProperties( + __in HWND hwnd, + __in D2D1_SIZE_U pixelSize = D2D1::Size(static_cast(0), static_cast(0)), + __in D2D1_PRESENT_OPTIONS presentOptions = D2D1_PRESENT_OPTIONS_NONE + ) + { + D2D1_HWND_RENDER_TARGET_PROPERTIES hwndRenderTargetProperties; + + hwndRenderTargetProperties.hwnd = hwnd; + hwndRenderTargetProperties.pixelSize = pixelSize; + hwndRenderTargetProperties.presentOptions = presentOptions; + + return hwndRenderTargetProperties; + } + + D2D1FORCEINLINE + D2D1_LAYER_PARAMETERS + LayerParameters( + __in CONST D2D1_RECT_F &contentBounds = D2D1::InfiniteRect(), + __in_opt ID2D1Geometry *geometricMask = NULL, + D2D1_ANTIALIAS_MODE maskAntialiasMode = D2D1_ANTIALIAS_MODE_PER_PRIMITIVE, + D2D1_MATRIX_3X2_F maskTransform = D2D1::IdentityMatrix(), + FLOAT opacity = 1.0, + __in_opt ID2D1Brush *opacityBrush = NULL, + D2D1_LAYER_OPTIONS layerOptions = D2D1_LAYER_OPTIONS_NONE + ) + { + D2D1_LAYER_PARAMETERS layerParameters = { 0 }; + + layerParameters.contentBounds = contentBounds; + layerParameters.geometricMask = geometricMask; + layerParameters.maskAntialiasMode = maskAntialiasMode; + layerParameters.maskTransform = maskTransform; + layerParameters.opacity = opacity; + layerParameters.opacityBrush = opacityBrush; + layerParameters.layerOptions = layerOptions; + + return layerParameters; + } + + D2D1FORCEINLINE + D2D1_DRAWING_STATE_DESCRIPTION + DrawingStateDescription( + D2D1_ANTIALIAS_MODE antialiasMode = D2D1_ANTIALIAS_MODE_PER_PRIMITIVE, + D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode = D2D1_TEXT_ANTIALIAS_MODE_DEFAULT, + D2D1_TAG tag1 = 0, + D2D1_TAG tag2 = 0, + __in const D2D1_MATRIX_3X2_F &transform = D2D1::IdentityMatrix() + ) + { + D2D1_DRAWING_STATE_DESCRIPTION drawingStateDescription; + + drawingStateDescription.antialiasMode = antialiasMode; + drawingStateDescription.textAntialiasMode = textAntialiasMode; + drawingStateDescription.tag1 = tag1; + drawingStateDescription.tag2 = tag2; + drawingStateDescription.transform = transform; + + return drawingStateDescription; + } + + // + // Colors, this enum defines a set of predefined colors. + // + class ColorF : public D2D1_COLOR_F + { + public: + + enum Enum + { + AliceBlue = 0xF0F8FF, + AntiqueWhite = 0xFAEBD7, + Aqua = 0x00FFFF, + Aquamarine = 0x7FFFD4, + Azure = 0xF0FFFF, + Beige = 0xF5F5DC, + Bisque = 0xFFE4C4, + Black = 0x000000, + BlanchedAlmond = 0xFFEBCD, + Blue = 0x0000FF, + BlueViolet = 0x8A2BE2, + Brown = 0xA52A2A, + BurlyWood = 0xDEB887, + CadetBlue = 0x5F9EA0, + Chartreuse = 0x7FFF00, + Chocolate = 0xD2691E, + Coral = 0xFF7F50, + CornflowerBlue = 0x6495ED, + Cornsilk = 0xFFF8DC, + Crimson = 0xDC143C, + Cyan = 0x00FFFF, + DarkBlue = 0x00008B, + DarkCyan = 0x008B8B, + DarkGoldenrod = 0xB8860B, + DarkGray = 0xA9A9A9, + DarkGreen = 0x006400, + DarkKhaki = 0xBDB76B, + DarkMagenta = 0x8B008B, + DarkOliveGreen = 0x556B2F, + DarkOrange = 0xFF8C00, + DarkOrchid = 0x9932CC, + DarkRed = 0x8B0000, + DarkSalmon = 0xE9967A, + DarkSeaGreen = 0x8FBC8F, + DarkSlateBlue = 0x483D8B, + DarkSlateGray = 0x2F4F4F, + DarkTurquoise = 0x00CED1, + DarkViolet = 0x9400D3, + DeepPink = 0xFF1493, + DeepSkyBlue = 0x00BFFF, + DimGray = 0x696969, + DodgerBlue = 0x1E90FF, + Firebrick = 0xB22222, + FloralWhite = 0xFFFAF0, + ForestGreen = 0x228B22, + Fuchsia = 0xFF00FF, + Gainsboro = 0xDCDCDC, + GhostWhite = 0xF8F8FF, + Gold = 0xFFD700, + Goldenrod = 0xDAA520, + Gray = 0x808080, + Green = 0x008000, + GreenYellow = 0xADFF2F, + Honeydew = 0xF0FFF0, + HotPink = 0xFF69B4, + IndianRed = 0xCD5C5C, + Indigo = 0x4B0082, + Ivory = 0xFFFFF0, + Khaki = 0xF0E68C, + Lavender = 0xE6E6FA, + LavenderBlush = 0xFFF0F5, + LawnGreen = 0x7CFC00, + LemonChiffon = 0xFFFACD, + LightBlue = 0xADD8E6, + LightCoral = 0xF08080, + LightCyan = 0xE0FFFF, + LightGoldenrodYellow = 0xFAFAD2, + LightGreen = 0x90EE90, + LightGray = 0xD3D3D3, + LightPink = 0xFFB6C1, + LightSalmon = 0xFFA07A, + LightSeaGreen = 0x20B2AA, + LightSkyBlue = 0x87CEFA, + LightSlateGray = 0x778899, + LightSteelBlue = 0xB0C4DE, + LightYellow = 0xFFFFE0, + Lime = 0x00FF00, + LimeGreen = 0x32CD32, + Linen = 0xFAF0E6, + Magenta = 0xFF00FF, + Maroon = 0x800000, + MediumAquamarine = 0x66CDAA, + MediumBlue = 0x0000CD, + MediumOrchid = 0xBA55D3, + MediumPurple = 0x9370DB, + MediumSeaGreen = 0x3CB371, + MediumSlateBlue = 0x7B68EE, + MediumSpringGreen = 0x00FA9A, + MediumTurquoise = 0x48D1CC, + MediumVioletRed = 0xC71585, + MidnightBlue = 0x191970, + MintCream = 0xF5FFFA, + MistyRose = 0xFFE4E1, + Moccasin = 0xFFE4B5, + NavajoWhite = 0xFFDEAD, + Navy = 0x000080, + OldLace = 0xFDF5E6, + Olive = 0x808000, + OliveDrab = 0x6B8E23, + Orange = 0xFFA500, + OrangeRed = 0xFF4500, + Orchid = 0xDA70D6, + PaleGoldenrod = 0xEEE8AA, + PaleGreen = 0x98FB98, + PaleTurquoise = 0xAFEEEE, + PaleVioletRed = 0xDB7093, + PapayaWhip = 0xFFEFD5, + PeachPuff = 0xFFDAB9, + Peru = 0xCD853F, + Pink = 0xFFC0CB, + Plum = 0xDDA0DD, + PowderBlue = 0xB0E0E6, + Purple = 0x800080, + Red = 0xFF0000, + RosyBrown = 0xBC8F8F, + RoyalBlue = 0x4169E1, + SaddleBrown = 0x8B4513, + Salmon = 0xFA8072, + SandyBrown = 0xF4A460, + SeaGreen = 0x2E8B57, + SeaShell = 0xFFF5EE, + Sienna = 0xA0522D, + Silver = 0xC0C0C0, + SkyBlue = 0x87CEEB, + SlateBlue = 0x6A5ACD, + SlateGray = 0x708090, + Snow = 0xFFFAFA, + SpringGreen = 0x00FF7F, + SteelBlue = 0x4682B4, + Tan = 0xD2B48C, + Teal = 0x008080, + Thistle = 0xD8BFD8, + Tomato = 0xFF6347, + Turquoise = 0x40E0D0, + Violet = 0xEE82EE, + Wheat = 0xF5DEB3, + White = 0xFFFFFF, + WhiteSmoke = 0xF5F5F5, + Yellow = 0xFFFF00, + YellowGreen = 0x9ACD32, + }; + + // + // Construct a color, note that the alpha value from the "rgb" component + // is never used. + // + D2D1FORCEINLINE + ColorF( + UINT32 rgb, + FLOAT a = 1.0 + ) + { + Init(rgb, a); + } + + D2D1FORCEINLINE + ColorF( + Enum knownColor, + FLOAT a = 1.0 + ) + { + Init(knownColor, a); + } + + D2D1FORCEINLINE + ColorF( + FLOAT r, + FLOAT g, + FLOAT b, + FLOAT a = 1.0 + ) + { + this->r = r; + this->g = g; + this->b = b; + this->a = a; + } + + private: + + D2D1FORCEINLINE + void + Init( + UINT32 rgb, + FLOAT a + ) + { + this->r = static_cast((rgb & sc_redMask) >> sc_redShift) / 255.f; + this->g = static_cast((rgb & sc_greenMask) >> sc_greenShift) / 255.f; + this->b = static_cast((rgb & sc_blueMask) >> sc_blueShift) / 255.f; + this->a = a; + } + + static const UINT32 sc_redShift = 16; + static const UINT32 sc_greenShift = 8; + static const UINT32 sc_blueShift = 0; + + static const UINT32 sc_redMask = 0xff << sc_redShift; + static const UINT32 sc_greenMask = 0xff << sc_greenShift; + static const UINT32 sc_blueMask = 0xff << sc_blueShift; + }; + + class Matrix3x2F : public D2D1_MATRIX_3X2_F + { + public: + + D2D1FORCEINLINE + Matrix3x2F( + FLOAT _11, + FLOAT _12, + FLOAT _21, + FLOAT _22, + FLOAT _31, + FLOAT _32 + ) + { + this->_11 = _11; + this->_12 = _12; + this->_21 = _21; + this->_22 = _22; + this->_31 = _31; + this->_32 = _32; + } + + // + // Creates an identity matrix + // + D2D1FORCEINLINE + Matrix3x2F( + ) + { + } + + // + // Named quasi-constructors + // + static D2D1FORCEINLINE + Matrix3x2F + Identity() + { + Matrix3x2F identity; + + identity._11 = 1.f; + identity._12 = 0.f; + identity._21 = 0.f; + identity._22 = 1.f; + identity._31 = 0.f; + identity._32 = 0.f; + + return identity; + } + + static D2D1FORCEINLINE + Matrix3x2F + Translation( + D2D1_SIZE_F size + ) + { + Matrix3x2F translation; + + translation._11 = 1.0; translation._12 = 0.0; + translation._21 = 0.0; translation._22 = 1.0; + translation._31 = size.width; translation._32 = size.height; + + return translation; + } + + static D2D1FORCEINLINE + Matrix3x2F + Translation( + FLOAT x, + FLOAT y + ) + { + return Translation(SizeF(x, y)); + } + + + static D2D1FORCEINLINE + Matrix3x2F + Scale( + D2D1_SIZE_F size, + D2D1_POINT_2F center = D2D1::Point2F() + ) + { + Matrix3x2F scale; + + scale._11 = size.width; scale._12 = 0.0; + scale._21 = 0.0; scale._22 = size.height; + scale._31 = center.x - size.width * center.x; + scale._32 = center.y - size.height * center.y; + + return scale; + } + + static D2D1FORCEINLINE + Matrix3x2F + Scale( + FLOAT x, + FLOAT y, + D2D1_POINT_2F center = D2D1::Point2F() + ) + { + return Scale(SizeF(x, y), center); + } + + static D2D1FORCEINLINE + Matrix3x2F + Rotation( + FLOAT angle, + D2D1_POINT_2F center = D2D1::Point2F() + ) + { + Matrix3x2F rotation; + + D2D1MakeRotateMatrix(angle, center, &rotation); + + return rotation; + } + + static D2D1FORCEINLINE + Matrix3x2F + Skew( + FLOAT angleX, + FLOAT angleY, + D2D1_POINT_2F center = D2D1::Point2F() + ) + { + Matrix3x2F skew; + + D2D1MakeSkewMatrix(angleX, angleY, center, &skew); + + return skew; + } + + // + // Functions for convertion from the base D2D1_MATRIX_3X2_F to this type + // without making a copy + // + static inline const Matrix3x2F* ReinterpretBaseType(const D2D1_MATRIX_3X2_F *pMatrix) + { + return static_cast(pMatrix); + } + + static inline Matrix3x2F* ReinterpretBaseType(D2D1_MATRIX_3X2_F *pMatrix) + { + return static_cast(pMatrix); + } + + inline + FLOAT + Determinant() const + { + return (_11 * _22) - (_12 * _21); + } + + inline + bool + IsInvertible() const + { + return !!D2D1IsMatrixInvertible(this); + } + + inline + bool + Invert() + { + return !!D2D1InvertMatrix(this); + } + + inline + bool + IsIdentity() const + { + return _11 == 1.f && _12 == 0.f + && _21 == 0.f && _22 == 1.f + && _31 == 0.f && _32 == 0.f; + } + + inline + void SetProduct( + const Matrix3x2F &a, + const Matrix3x2F &b + ) + { + _11 = a._11 * b._11 + a._12 * b._21; + _12 = a._11 * b._12 + a._12 * b._22; + _21 = a._21 * b._11 + a._22 * b._21; + _22 = a._21 * b._12 + a._22 * b._22; + _31 = a._31 * b._11 + a._32 * b._21 + b._31; + _32 = a._31 * b._12 + a._32 * b._22 + b._32; + } + + D2D1FORCEINLINE + Matrix3x2F + operator*( + const Matrix3x2F &matrix + ) const + { + Matrix3x2F result; + + result.SetProduct(*this, matrix); + + return result; + } + + D2D1FORCEINLINE + D2D1_POINT_2F + TransformPoint( + D2D1_POINT_2F point + ) const + { + D2D1_POINT_2F result = + { + point.x * _11 + point.y * _21 + _31, + point.x * _12 + point.y * _22 + _32 + }; + + return result; + } + }; + + D2D1FORCEINLINE + D2D1_POINT_2F + operator*( + const D2D1_POINT_2F &point, + const D2D1_MATRIX_3X2_F &matrix + ) + { + return Matrix3x2F::ReinterpretBaseType(&matrix)->TransformPoint(point); + } + + D2D1_MATRIX_3X2_F + IdentityMatrix() + { + return Matrix3x2F::Identity(); + } + +} // namespace D2D1 + +D2D1FORCEINLINE +D2D1_MATRIX_3X2_F +operator*( + const D2D1_MATRIX_3X2_F &matrix1, + const D2D1_MATRIX_3X2_F &matrix2 + ) +{ + return + (*D2D1::Matrix3x2F::ReinterpretBaseType(&matrix1)) * + (*D2D1::Matrix3x2F::ReinterpretBaseType(&matrix2)); +} + +#endif // #ifndef D2D_USE_C_DEFINITIONS + +#endif // #ifndef _D2D1_HELPER_H_ + diff --git a/MediaClient/MediaClient/directx/include/D2DBaseTypes.h b/MediaClient/MediaClient/directx/include/D2DBaseTypes.h new file mode 100644 index 0000000..c2ff5bb --- /dev/null +++ b/MediaClient/MediaClient/directx/include/D2DBaseTypes.h @@ -0,0 +1,145 @@ +//--------------------------------------------------------------------------- +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// This file is automatically generated. Please do not edit it directly. +// +// File name: D2DBaseTypes.h +//--------------------------------------------------------------------------- +#pragma once + + +#ifndef _D2DBASETYPES_INCLUDED +#define _D2DBASETYPES_INCLUDED + +#ifndef COM_NO_WINDOWS_H +#include +#endif // #ifndef COM_NO_WINDOWS_H + +#ifndef D3DCOLORVALUE_DEFINED + +//+----------------------------------------------------------------------------- +// +// Struct: +// D3DCOLORVALUE +// +//------------------------------------------------------------------------------ +typedef struct D3DCOLORVALUE +{ + FLOAT r; + FLOAT g; + FLOAT b; + FLOAT a; + +} D3DCOLORVALUE; + +#define D3DCOLORVALUE_DEFINED +#endif + + +//+----------------------------------------------------------------------------- +// +// Struct: +// D2D_POINT_2U +// +//------------------------------------------------------------------------------ +typedef struct D2D_POINT_2U +{ + UINT32 x; + UINT32 y; + +} D2D_POINT_2U; + + +//+----------------------------------------------------------------------------- +// +// Struct: +// D2D_POINT_2F +// +//------------------------------------------------------------------------------ +typedef struct D2D_POINT_2F +{ + FLOAT x; + FLOAT y; + +} D2D_POINT_2F; + + +//+----------------------------------------------------------------------------- +// +// Struct: +// D2D_RECT_F +// +//------------------------------------------------------------------------------ +typedef struct D2D_RECT_F +{ + FLOAT left; + FLOAT top; + FLOAT right; + FLOAT bottom; + +} D2D_RECT_F; + + +//+----------------------------------------------------------------------------- +// +// Struct: +// D2D_RECT_U +// +//------------------------------------------------------------------------------ +typedef struct D2D_RECT_U +{ + UINT32 left; + UINT32 top; + UINT32 right; + UINT32 bottom; + +} D2D_RECT_U; + + +//+----------------------------------------------------------------------------- +// +// Struct: +// D2D_SIZE_F +// +//------------------------------------------------------------------------------ +typedef struct D2D_SIZE_F +{ + FLOAT width; + FLOAT height; + +} D2D_SIZE_F; + + +//+----------------------------------------------------------------------------- +// +// Struct: +// D2D_SIZE_U +// +//------------------------------------------------------------------------------ +typedef struct D2D_SIZE_U +{ + UINT32 width; + UINT32 height; + +} D2D_SIZE_U; + +typedef D3DCOLORVALUE D2D_COLOR_F; + +//+----------------------------------------------------------------------------- +// +// Struct: +// D2D_MATRIX_3X2_F +// +//------------------------------------------------------------------------------ +typedef struct D2D_MATRIX_3X2_F +{ + FLOAT _11; + FLOAT _12; + FLOAT _21; + FLOAT _22; + FLOAT _31; + FLOAT _32; + +} D2D_MATRIX_3X2_F; + +#endif // #ifndef _D2DBASETYPES_INCLUDED diff --git a/MediaClient/MediaClient/directx/include/D2Derr.h b/MediaClient/MediaClient/directx/include/D2Derr.h new file mode 100644 index 0000000..afbaa36 --- /dev/null +++ b/MediaClient/MediaClient/directx/include/D2Derr.h @@ -0,0 +1,206 @@ +/*=========================================================================*\ + + Copyright (c) Microsoft Corporation. All rights reserved. + +\*=========================================================================*/ + +#pragma once + +/*=========================================================================*\ + D2D Status Codes +\*=========================================================================*/ + +#define FACILITY_D2D 0x899 + +#define MAKE_D2DHR( sev, code )\ + MAKE_HRESULT( sev, FACILITY_D2D, (code) ) + +#define MAKE_D2DHR_ERR( code )\ + MAKE_D2DHR( 1, code ) + + +//+---------------------------------------------------------------------------- +// +// D2D error codes +// +//------------------------------------------------------------------------------ + +// +// Error codes shared with WINCODECS +// + +// +// The pixel format is not supported. +// +#define D2DERR_UNSUPPORTED_PIXEL_FORMAT WINCODEC_ERR_UNSUPPORTEDPIXELFORMAT + +// +// Error codes that were already returned in prior versions and were part of the +// MIL facility. + +// +// Error codes mapped from WIN32 where there isn't already another HRESULT based +// define +// + +// +// The supplied buffer was too small to accomodate the data. +// +#define D2DERR_INSUFFICIENT_BUFFER HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER) + + +// +// D2D specific codes +// + +// +// The object was not in the correct state to process the method. +// +#define D2DERR_WRONG_STATE MAKE_D2DHR_ERR(0x001) + +// +// The object has not yet been initialized. +// +#define D2DERR_NOT_INITIALIZED MAKE_D2DHR_ERR(0x002) + +// +// The requested opertion is not supported. +// +#define D2DERR_UNSUPPORTED_OPERATION MAKE_D2DHR_ERR(0x003) + +// +// The geomery scanner failed to process the data. +// +#define D2DERR_SCANNER_FAILED MAKE_D2DHR_ERR(0x004) + +// +// D2D could not access the screen. +// +#define D2DERR_SCREEN_ACCESS_DENIED MAKE_D2DHR_ERR(0x005) + +// +// A valid display state could not be determined. +// +#define D2DERR_DISPLAY_STATE_INVALID MAKE_D2DHR_ERR(0x006) + +// +// The supplied vector is vero. +// +#define D2DERR_ZERO_VECTOR MAKE_D2DHR_ERR(0x007) + +// +// An internal error (D2D bug) occurred. On checked builds, we would assert. +// +// The application should close this instance of D2D and should consider +// restarting its process. +// +#define D2DERR_INTERNAL_ERROR MAKE_D2DHR_ERR(0x008) + +// +// The display format we need to render is not supported by the +// hardware device. +// +#define D2DERR_DISPLAY_FORMAT_NOT_SUPPORTED MAKE_D2DHR_ERR(0x009) + +// +// A call to this method is invalid. +// +#define D2DERR_INVALID_CALL MAKE_D2DHR_ERR(0x00A) + +// +// No HW rendering device is available for this operation. +// +#define D2DERR_NO_HARDWARE_DEVICE MAKE_D2DHR_ERR(0x00B) + +// +// There has been a presentation error that may be recoverable. The caller +// needs to recreate, rerender the entire frame, and reattempt present. +// +#define D2DERR_RECREATE_TARGET MAKE_D2DHR_ERR(0x00C) + +// +// Shader construction failed because it was too complex. +// +#define D2DERR_TOO_MANY_SHADER_ELEMENTS MAKE_D2DHR_ERR(0x00D) + +// +// Shader compilation failed. +// +#define D2DERR_SHADER_COMPILE_FAILED MAKE_D2DHR_ERR(0x00E) + +// +// Requested DX surface size exceeded maximum texture size. +// +#define D2DERR_MAX_TEXTURE_SIZE_EXCEEDED MAKE_D2DHR_ERR(0x00F) + +// +// The requested D2D version is not supported. +// +#define D2DERR_UNSUPPORTED_VERSION MAKE_D2DHR_ERR(0x010) + +// +// Invalid number. +// +#define D2DERR_BAD_NUMBER MAKE_D2DHR_ERR(0x0011) + +// +// Objects used together must be created from the same factory instance. +// +#define D2DERR_WRONG_FACTORY MAKE_D2DHR_ERR(0x012) + +// +// A layer resource can only be in use once at any point in time. +// +#define D2DERR_LAYER_ALREADY_IN_USE MAKE_D2DHR_ERR(0x013) + +// +// The pop call did not match the corresponding push call +// +#define D2DERR_POP_CALL_DID_NOT_MATCH_PUSH MAKE_D2DHR_ERR(0x014) + +// +// The resource was realized on the wrong render target +// +#define D2DERR_WRONG_RESOURCE_DOMAIN MAKE_D2DHR_ERR(0x015) + +// +// The push and pop calls were unbalanced +// +#define D2DERR_PUSH_POP_UNBALANCED MAKE_D2DHR_ERR(0x016) + +// +// Attempt to copy from a render target while a layer or clip rect is applied +// +#define D2DERR_RENDER_TARGET_HAS_LAYER_OR_CLIPRECT MAKE_D2DHR_ERR(0x017) + +// +// The brush types are incompatible for the call. +// +#define D2DERR_INCOMPATIBLE_BRUSH_TYPES MAKE_D2DHR_ERR(0x018) + +// +// An unknown win32 failure occurred. +// +#define D2DERR_WIN32_ERROR MAKE_D2DHR_ERR(0x019) + +// +// The render target is not compatible with GDI +// +#define D2DERR_TARGET_NOT_GDI_COMPATIBLE MAKE_D2DHR_ERR(0x01A) + +// +// A text client drawing effect object is of the wrong type +// +#define D2DERR_TEXT_EFFECT_IS_WRONG_TYPE MAKE_D2DHR_ERR(0x01B) + +// +// The application is holding a reference to the IDWriteTextRenderer interface +// after the corresponding DrawText or DrawTextLayout call has returned. The +// IDWriteTextRenderer instance will be zombied. +// +#define D2DERR_TEXT_RENDERER_NOT_RELEASED MAKE_D2DHR_ERR(0x01C) + +// +// The requested size is larger than the guaranteed supported texture size. +// +#define D2DERR_EXCEEDS_MAX_BITMAP_SIZE MAKE_D2DHR_ERR(0x01D) diff --git a/MediaClient/MediaClient/directx/include/D3D10.h b/MediaClient/MediaClient/directx/include/D3D10.h new file mode 100644 index 0000000..248999f --- /dev/null +++ b/MediaClient/MediaClient/directx/include/D3D10.h @@ -0,0 +1,6723 @@ +/*------------------------------------------------------------------------------------- + * + * Copyright (c) Microsoft Corporation + * + *-------------------------------------------------------------------------------------*/ + + +/* this ALWAYS GENERATED file contains the definitions for the interfaces */ + + + /* File created by MIDL compiler version 7.00.0555 */ +/* @@MIDL_FILE_HEADING( ) */ + +#pragma warning( disable: 4049 ) /* more than 64k source lines */ + + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCNDR_H_VERSION__ +#define __REQUIRED_RPCNDR_H_VERSION__ 475 +#endif + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCSAL_H_VERSION__ +#define __REQUIRED_RPCSAL_H_VERSION__ 100 +#endif + +#include "rpc.h" +#include "rpcndr.h" + +#ifndef __RPCNDR_H_VERSION__ +#error this stub requires an updated version of +#endif // __RPCNDR_H_VERSION__ + +#ifndef COM_NO_WINDOWS_H +#include "windows.h" +#include "ole2.h" +#endif /*COM_NO_WINDOWS_H*/ + +#ifndef __d3d10_h__ +#define __d3d10_h__ + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +/* Forward Declarations */ + +#ifndef __ID3D10DeviceChild_FWD_DEFINED__ +#define __ID3D10DeviceChild_FWD_DEFINED__ +typedef interface ID3D10DeviceChild ID3D10DeviceChild; +#endif /* __ID3D10DeviceChild_FWD_DEFINED__ */ + + +#ifndef __ID3D10DepthStencilState_FWD_DEFINED__ +#define __ID3D10DepthStencilState_FWD_DEFINED__ +typedef interface ID3D10DepthStencilState ID3D10DepthStencilState; +#endif /* __ID3D10DepthStencilState_FWD_DEFINED__ */ + + +#ifndef __ID3D10BlendState_FWD_DEFINED__ +#define __ID3D10BlendState_FWD_DEFINED__ +typedef interface ID3D10BlendState ID3D10BlendState; +#endif /* __ID3D10BlendState_FWD_DEFINED__ */ + + +#ifndef __ID3D10RasterizerState_FWD_DEFINED__ +#define __ID3D10RasterizerState_FWD_DEFINED__ +typedef interface ID3D10RasterizerState ID3D10RasterizerState; +#endif /* __ID3D10RasterizerState_FWD_DEFINED__ */ + + +#ifndef __ID3D10Resource_FWD_DEFINED__ +#define __ID3D10Resource_FWD_DEFINED__ +typedef interface ID3D10Resource ID3D10Resource; +#endif /* __ID3D10Resource_FWD_DEFINED__ */ + + +#ifndef __ID3D10Buffer_FWD_DEFINED__ +#define __ID3D10Buffer_FWD_DEFINED__ +typedef interface ID3D10Buffer ID3D10Buffer; +#endif /* __ID3D10Buffer_FWD_DEFINED__ */ + + +#ifndef __ID3D10Texture1D_FWD_DEFINED__ +#define __ID3D10Texture1D_FWD_DEFINED__ +typedef interface ID3D10Texture1D ID3D10Texture1D; +#endif /* __ID3D10Texture1D_FWD_DEFINED__ */ + + +#ifndef __ID3D10Texture2D_FWD_DEFINED__ +#define __ID3D10Texture2D_FWD_DEFINED__ +typedef interface ID3D10Texture2D ID3D10Texture2D; +#endif /* __ID3D10Texture2D_FWD_DEFINED__ */ + + +#ifndef __ID3D10Texture3D_FWD_DEFINED__ +#define __ID3D10Texture3D_FWD_DEFINED__ +typedef interface ID3D10Texture3D ID3D10Texture3D; +#endif /* __ID3D10Texture3D_FWD_DEFINED__ */ + + +#ifndef __ID3D10View_FWD_DEFINED__ +#define __ID3D10View_FWD_DEFINED__ +typedef interface ID3D10View ID3D10View; +#endif /* __ID3D10View_FWD_DEFINED__ */ + + +#ifndef __ID3D10ShaderResourceView_FWD_DEFINED__ +#define __ID3D10ShaderResourceView_FWD_DEFINED__ +typedef interface ID3D10ShaderResourceView ID3D10ShaderResourceView; +#endif /* __ID3D10ShaderResourceView_FWD_DEFINED__ */ + + +#ifndef __ID3D10RenderTargetView_FWD_DEFINED__ +#define __ID3D10RenderTargetView_FWD_DEFINED__ +typedef interface ID3D10RenderTargetView ID3D10RenderTargetView; +#endif /* __ID3D10RenderTargetView_FWD_DEFINED__ */ + + +#ifndef __ID3D10DepthStencilView_FWD_DEFINED__ +#define __ID3D10DepthStencilView_FWD_DEFINED__ +typedef interface ID3D10DepthStencilView ID3D10DepthStencilView; +#endif /* __ID3D10DepthStencilView_FWD_DEFINED__ */ + + +#ifndef __ID3D10VertexShader_FWD_DEFINED__ +#define __ID3D10VertexShader_FWD_DEFINED__ +typedef interface ID3D10VertexShader ID3D10VertexShader; +#endif /* __ID3D10VertexShader_FWD_DEFINED__ */ + + +#ifndef __ID3D10GeometryShader_FWD_DEFINED__ +#define __ID3D10GeometryShader_FWD_DEFINED__ +typedef interface ID3D10GeometryShader ID3D10GeometryShader; +#endif /* __ID3D10GeometryShader_FWD_DEFINED__ */ + + +#ifndef __ID3D10PixelShader_FWD_DEFINED__ +#define __ID3D10PixelShader_FWD_DEFINED__ +typedef interface ID3D10PixelShader ID3D10PixelShader; +#endif /* __ID3D10PixelShader_FWD_DEFINED__ */ + + +#ifndef __ID3D10InputLayout_FWD_DEFINED__ +#define __ID3D10InputLayout_FWD_DEFINED__ +typedef interface ID3D10InputLayout ID3D10InputLayout; +#endif /* __ID3D10InputLayout_FWD_DEFINED__ */ + + +#ifndef __ID3D10SamplerState_FWD_DEFINED__ +#define __ID3D10SamplerState_FWD_DEFINED__ +typedef interface ID3D10SamplerState ID3D10SamplerState; +#endif /* __ID3D10SamplerState_FWD_DEFINED__ */ + + +#ifndef __ID3D10Asynchronous_FWD_DEFINED__ +#define __ID3D10Asynchronous_FWD_DEFINED__ +typedef interface ID3D10Asynchronous ID3D10Asynchronous; +#endif /* __ID3D10Asynchronous_FWD_DEFINED__ */ + + +#ifndef __ID3D10Query_FWD_DEFINED__ +#define __ID3D10Query_FWD_DEFINED__ +typedef interface ID3D10Query ID3D10Query; +#endif /* __ID3D10Query_FWD_DEFINED__ */ + + +#ifndef __ID3D10Predicate_FWD_DEFINED__ +#define __ID3D10Predicate_FWD_DEFINED__ +typedef interface ID3D10Predicate ID3D10Predicate; +#endif /* __ID3D10Predicate_FWD_DEFINED__ */ + + +#ifndef __ID3D10Counter_FWD_DEFINED__ +#define __ID3D10Counter_FWD_DEFINED__ +typedef interface ID3D10Counter ID3D10Counter; +#endif /* __ID3D10Counter_FWD_DEFINED__ */ + + +#ifndef __ID3D10Device_FWD_DEFINED__ +#define __ID3D10Device_FWD_DEFINED__ +typedef interface ID3D10Device ID3D10Device; +#endif /* __ID3D10Device_FWD_DEFINED__ */ + + +#ifndef __ID3D10Multithread_FWD_DEFINED__ +#define __ID3D10Multithread_FWD_DEFINED__ +typedef interface ID3D10Multithread ID3D10Multithread; +#endif /* __ID3D10Multithread_FWD_DEFINED__ */ + + +/* header files for imported files */ +#include "oaidl.h" +#include "ocidl.h" +#include "dxgi.h" +#include "d3dcommon.h" + +#ifdef __cplusplus +extern "C"{ +#endif + + +/* interface __MIDL_itf_d3d10_0000_0000 */ +/* [local] */ + +#ifndef _D3D10_CONSTANTS +#define _D3D10_CONSTANTS +#define D3D10_16BIT_INDEX_STRIP_CUT_VALUE ( 0xffff ) + +#define D3D10_32BIT_INDEX_STRIP_CUT_VALUE ( 0xffffffff ) + +#define D3D10_8BIT_INDEX_STRIP_CUT_VALUE ( 0xff ) + +#define D3D10_ARRAY_AXIS_ADDRESS_RANGE_BIT_COUNT ( 9 ) + +#define D3D10_CLIP_OR_CULL_DISTANCE_COUNT ( 8 ) + +#define D3D10_CLIP_OR_CULL_DISTANCE_ELEMENT_COUNT ( 2 ) + +#define D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT ( 14 ) + +#define D3D10_COMMONSHADER_CONSTANT_BUFFER_COMPONENTS ( 4 ) + +#define D3D10_COMMONSHADER_CONSTANT_BUFFER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D10_COMMONSHADER_CONSTANT_BUFFER_HW_SLOT_COUNT ( 15 ) + +#define D3D10_COMMONSHADER_CONSTANT_BUFFER_REGISTER_COMPONENTS ( 4 ) + +#define D3D10_COMMONSHADER_CONSTANT_BUFFER_REGISTER_COUNT ( 15 ) + +#define D3D10_COMMONSHADER_CONSTANT_BUFFER_REGISTER_READS_PER_INST ( 1 ) + +#define D3D10_COMMONSHADER_CONSTANT_BUFFER_REGISTER_READ_PORTS ( 1 ) + +#define D3D10_COMMONSHADER_FLOWCONTROL_NESTING_LIMIT ( 64 ) + +#define D3D10_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_COMPONENTS ( 4 ) + +#define D3D10_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_COUNT ( 1 ) + +#define D3D10_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_READS_PER_INST ( 1 ) + +#define D3D10_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_READ_PORTS ( 1 ) + +#define D3D10_COMMONSHADER_IMMEDIATE_VALUE_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D10_COMMONSHADER_INPUT_RESOURCE_REGISTER_COMPONENTS ( 1 ) + +#define D3D10_COMMONSHADER_INPUT_RESOURCE_REGISTER_COUNT ( 128 ) + +#define D3D10_COMMONSHADER_INPUT_RESOURCE_REGISTER_READS_PER_INST ( 1 ) + +#define D3D10_COMMONSHADER_INPUT_RESOURCE_REGISTER_READ_PORTS ( 1 ) + +#define D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT ( 128 ) + +#define D3D10_COMMONSHADER_SAMPLER_REGISTER_COMPONENTS ( 1 ) + +#define D3D10_COMMONSHADER_SAMPLER_REGISTER_COUNT ( 16 ) + +#define D3D10_COMMONSHADER_SAMPLER_REGISTER_READS_PER_INST ( 1 ) + +#define D3D10_COMMONSHADER_SAMPLER_REGISTER_READ_PORTS ( 1 ) + +#define D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT ( 16 ) + +#define D3D10_COMMONSHADER_SUBROUTINE_NESTING_LIMIT ( 32 ) + +#define D3D10_COMMONSHADER_TEMP_REGISTER_COMPONENTS ( 4 ) + +#define D3D10_COMMONSHADER_TEMP_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D10_COMMONSHADER_TEMP_REGISTER_COUNT ( 4096 ) + +#define D3D10_COMMONSHADER_TEMP_REGISTER_READS_PER_INST ( 3 ) + +#define D3D10_COMMONSHADER_TEMP_REGISTER_READ_PORTS ( 3 ) + +#define D3D10_COMMONSHADER_TEXCOORD_RANGE_REDUCTION_MAX ( 10 ) + +#define D3D10_COMMONSHADER_TEXCOORD_RANGE_REDUCTION_MIN ( -10 ) + +#define D3D10_COMMONSHADER_TEXEL_OFFSET_MAX_NEGATIVE ( -8 ) + +#define D3D10_COMMONSHADER_TEXEL_OFFSET_MAX_POSITIVE ( 7 ) + +#define D3D10_DEFAULT_BLEND_FACTOR_ALPHA ( 1.0f ) +#define D3D10_DEFAULT_BLEND_FACTOR_BLUE ( 1.0f ) +#define D3D10_DEFAULT_BLEND_FACTOR_GREEN ( 1.0f ) +#define D3D10_DEFAULT_BLEND_FACTOR_RED ( 1.0f ) +#define D3D10_DEFAULT_BORDER_COLOR_COMPONENT ( 0.0f ) +#define D3D10_DEFAULT_DEPTH_BIAS ( 0 ) + +#define D3D10_DEFAULT_DEPTH_BIAS_CLAMP ( 0.0f ) +#define D3D10_DEFAULT_MAX_ANISOTROPY ( 16.0f ) +#define D3D10_DEFAULT_MIP_LOD_BIAS ( 0.0f ) +#define D3D10_DEFAULT_RENDER_TARGET_ARRAY_INDEX ( 0 ) + +#define D3D10_DEFAULT_SAMPLE_MASK ( 0xffffffff ) + +#define D3D10_DEFAULT_SCISSOR_ENDX ( 0 ) + +#define D3D10_DEFAULT_SCISSOR_ENDY ( 0 ) + +#define D3D10_DEFAULT_SCISSOR_STARTX ( 0 ) + +#define D3D10_DEFAULT_SCISSOR_STARTY ( 0 ) + +#define D3D10_DEFAULT_SLOPE_SCALED_DEPTH_BIAS ( 0.0f ) +#define D3D10_DEFAULT_STENCIL_READ_MASK ( 0xff ) + +#define D3D10_DEFAULT_STENCIL_REFERENCE ( 0 ) + +#define D3D10_DEFAULT_STENCIL_WRITE_MASK ( 0xff ) + +#define D3D10_DEFAULT_VIEWPORT_AND_SCISSORRECT_INDEX ( 0 ) + +#define D3D10_DEFAULT_VIEWPORT_HEIGHT ( 0 ) + +#define D3D10_DEFAULT_VIEWPORT_MAX_DEPTH ( 0.0f ) +#define D3D10_DEFAULT_VIEWPORT_MIN_DEPTH ( 0.0f ) +#define D3D10_DEFAULT_VIEWPORT_TOPLEFTX ( 0 ) + +#define D3D10_DEFAULT_VIEWPORT_TOPLEFTY ( 0 ) + +#define D3D10_DEFAULT_VIEWPORT_WIDTH ( 0 ) + +#define D3D10_FLOAT16_FUSED_TOLERANCE_IN_ULP ( 0.6 ) +#define D3D10_FLOAT32_MAX ( 3.402823466e+38f ) +#define D3D10_FLOAT32_TO_INTEGER_TOLERANCE_IN_ULP ( 0.6f ) +#define D3D10_FLOAT_TO_SRGB_EXPONENT_DENOMINATOR ( 2.4f ) +#define D3D10_FLOAT_TO_SRGB_EXPONENT_NUMERATOR ( 1.0f ) +#define D3D10_FLOAT_TO_SRGB_OFFSET ( 0.055f ) +#define D3D10_FLOAT_TO_SRGB_SCALE_1 ( 12.92f ) +#define D3D10_FLOAT_TO_SRGB_SCALE_2 ( 1.055f ) +#define D3D10_FLOAT_TO_SRGB_THRESHOLD ( 0.0031308f ) +#define D3D10_FTOI_INSTRUCTION_MAX_INPUT ( 2147483647.999f ) +#define D3D10_FTOI_INSTRUCTION_MIN_INPUT ( -2147483648.999f ) +#define D3D10_FTOU_INSTRUCTION_MAX_INPUT ( 4294967295.999f ) +#define D3D10_FTOU_INSTRUCTION_MIN_INPUT ( 0.0f ) +#define D3D10_GS_INPUT_PRIM_CONST_REGISTER_COMPONENTS ( 1 ) + +#define D3D10_GS_INPUT_PRIM_CONST_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D10_GS_INPUT_PRIM_CONST_REGISTER_COUNT ( 1 ) + +#define D3D10_GS_INPUT_PRIM_CONST_REGISTER_READS_PER_INST ( 2 ) + +#define D3D10_GS_INPUT_PRIM_CONST_REGISTER_READ_PORTS ( 1 ) + +#define D3D10_GS_INPUT_REGISTER_COMPONENTS ( 4 ) + +#define D3D10_GS_INPUT_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D10_GS_INPUT_REGISTER_COUNT ( 16 ) + +#define D3D10_GS_INPUT_REGISTER_READS_PER_INST ( 2 ) + +#define D3D10_GS_INPUT_REGISTER_READ_PORTS ( 1 ) + +#define D3D10_GS_INPUT_REGISTER_VERTICES ( 6 ) + +#define D3D10_GS_OUTPUT_ELEMENTS ( 32 ) + +#define D3D10_GS_OUTPUT_REGISTER_COMPONENTS ( 4 ) + +#define D3D10_GS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D10_GS_OUTPUT_REGISTER_COUNT ( 32 ) + +#define D3D10_IA_DEFAULT_INDEX_BUFFER_OFFSET_IN_BYTES ( 0 ) + +#define D3D10_IA_DEFAULT_PRIMITIVE_TOPOLOGY ( 0 ) + +#define D3D10_IA_DEFAULT_VERTEX_BUFFER_OFFSET_IN_BYTES ( 0 ) + +#define D3D10_IA_INDEX_INPUT_RESOURCE_SLOT_COUNT ( 1 ) + +#define D3D10_IA_INSTANCE_ID_BIT_COUNT ( 32 ) + +#define D3D10_IA_INTEGER_ARITHMETIC_BIT_COUNT ( 32 ) + +#define D3D10_IA_PRIMITIVE_ID_BIT_COUNT ( 32 ) + +#define D3D10_IA_VERTEX_ID_BIT_COUNT ( 32 ) + +#define D3D10_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT ( 16 ) + +#define D3D10_IA_VERTEX_INPUT_STRUCTURE_ELEMENTS_COMPONENTS ( 64 ) + +#define D3D10_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT ( 16 ) + +#define D3D10_INTEGER_DIVIDE_BY_ZERO_QUOTIENT ( 0xffffffff ) + +#define D3D10_INTEGER_DIVIDE_BY_ZERO_REMAINDER ( 0xffffffff ) + +#define D3D10_LINEAR_GAMMA ( 1.0f ) +#define D3D10_MAX_BORDER_COLOR_COMPONENT ( 1.0f ) +#define D3D10_MAX_DEPTH ( 1.0f ) +#define D3D10_MAX_MAXANISOTROPY ( 16 ) + +#define D3D10_MAX_MULTISAMPLE_SAMPLE_COUNT ( 32 ) + +#define D3D10_MAX_POSITION_VALUE ( 3.402823466e+34f ) +#define D3D10_MAX_TEXTURE_DIMENSION_2_TO_EXP ( 17 ) + +#define D3D10_MIN_BORDER_COLOR_COMPONENT ( 0.0f ) +#define D3D10_MIN_DEPTH ( 0.0f ) +#define D3D10_MIN_MAXANISOTROPY ( 0 ) + +#define D3D10_MIP_LOD_BIAS_MAX ( 15.99f ) +#define D3D10_MIP_LOD_BIAS_MIN ( -16.0f ) +#define D3D10_MIP_LOD_FRACTIONAL_BIT_COUNT ( 6 ) + +#define D3D10_MIP_LOD_RANGE_BIT_COUNT ( 8 ) + +#define D3D10_MULTISAMPLE_ANTIALIAS_LINE_WIDTH ( 1.4f ) +#define D3D10_NONSAMPLE_FETCH_OUT_OF_RANGE_ACCESS_RESULT ( 0 ) + +#define D3D10_PIXEL_ADDRESS_RANGE_BIT_COUNT ( 13 ) + +#define D3D10_PRE_SCISSOR_PIXEL_ADDRESS_RANGE_BIT_COUNT ( 15 ) + +#define D3D10_PS_FRONTFACING_DEFAULT_VALUE ( 0xffffffff ) + +#define D3D10_PS_FRONTFACING_FALSE_VALUE ( 0 ) + +#define D3D10_PS_FRONTFACING_TRUE_VALUE ( 0xffffffff ) + +#define D3D10_PS_INPUT_REGISTER_COMPONENTS ( 4 ) + +#define D3D10_PS_INPUT_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D10_PS_INPUT_REGISTER_COUNT ( 32 ) + +#define D3D10_PS_INPUT_REGISTER_READS_PER_INST ( 2 ) + +#define D3D10_PS_INPUT_REGISTER_READ_PORTS ( 1 ) + +#define D3D10_PS_LEGACY_PIXEL_CENTER_FRACTIONAL_COMPONENT ( 0.0f ) +#define D3D10_PS_OUTPUT_DEPTH_REGISTER_COMPONENTS ( 1 ) + +#define D3D10_PS_OUTPUT_DEPTH_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D10_PS_OUTPUT_DEPTH_REGISTER_COUNT ( 1 ) + +#define D3D10_PS_OUTPUT_REGISTER_COMPONENTS ( 4 ) + +#define D3D10_PS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D10_PS_OUTPUT_REGISTER_COUNT ( 8 ) + +#define D3D10_PS_PIXEL_CENTER_FRACTIONAL_COMPONENT ( 0.5f ) +#define D3D10_REQ_BLEND_OBJECT_COUNT_PER_CONTEXT ( 4096 ) + +#define D3D10_REQ_BUFFER_RESOURCE_TEXEL_COUNT_2_TO_EXP ( 27 ) + +#define D3D10_REQ_CONSTANT_BUFFER_ELEMENT_COUNT ( 4096 ) + +#define D3D10_REQ_DEPTH_STENCIL_OBJECT_COUNT_PER_CONTEXT ( 4096 ) + +#define D3D10_REQ_DRAWINDEXED_INDEX_COUNT_2_TO_EXP ( 32 ) + +#define D3D10_REQ_DRAW_VERTEX_COUNT_2_TO_EXP ( 32 ) + +#define D3D10_REQ_FILTERING_HW_ADDRESSABLE_RESOURCE_DIMENSION ( 8192 ) + +#define D3D10_REQ_GS_INVOCATION_32BIT_OUTPUT_COMPONENT_LIMIT ( 1024 ) + +#define D3D10_REQ_IMMEDIATE_CONSTANT_BUFFER_ELEMENT_COUNT ( 4096 ) + +#define D3D10_REQ_MAXANISOTROPY ( 16 ) + +#define D3D10_REQ_MIP_LEVELS ( 14 ) + +#define D3D10_REQ_MULTI_ELEMENT_STRUCTURE_SIZE_IN_BYTES ( 2048 ) + +#define D3D10_REQ_RASTERIZER_OBJECT_COUNT_PER_CONTEXT ( 4096 ) + +#define D3D10_REQ_RENDER_TO_BUFFER_WINDOW_WIDTH ( 8192 ) + +#define D3D10_REQ_RESOURCE_SIZE_IN_MEGABYTES ( 128 ) + +#define D3D10_REQ_RESOURCE_VIEW_COUNT_PER_CONTEXT_2_TO_EXP ( 20 ) + +#define D3D10_REQ_SAMPLER_OBJECT_COUNT_PER_CONTEXT ( 4096 ) + +#define D3D10_REQ_TEXTURE1D_ARRAY_AXIS_DIMENSION ( 512 ) + +#define D3D10_REQ_TEXTURE1D_U_DIMENSION ( 8192 ) + +#define D3D10_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION ( 512 ) + +#define D3D10_REQ_TEXTURE2D_U_OR_V_DIMENSION ( 8192 ) + +#define D3D10_REQ_TEXTURE3D_U_V_OR_W_DIMENSION ( 2048 ) + +#define D3D10_REQ_TEXTURECUBE_DIMENSION ( 8192 ) + +#define D3D10_RESINFO_INSTRUCTION_MISSING_COMPONENT_RETVAL ( 0 ) + +#define D3D10_SHADER_MAJOR_VERSION ( 4 ) + +#define D3D10_SHADER_MINOR_VERSION ( 0 ) + +#define D3D10_SHIFT_INSTRUCTION_PAD_VALUE ( 0 ) + +#define D3D10_SHIFT_INSTRUCTION_SHIFT_VALUE_BIT_COUNT ( 5 ) + +#define D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT ( 8 ) + +#define D3D10_SO_BUFFER_MAX_STRIDE_IN_BYTES ( 2048 ) + +#define D3D10_SO_BUFFER_MAX_WRITE_WINDOW_IN_BYTES ( 256 ) + +#define D3D10_SO_BUFFER_SLOT_COUNT ( 4 ) + +#define D3D10_SO_DDI_REGISTER_INDEX_DENOTING_GAP ( 0xffffffff ) + +#define D3D10_SO_MULTIPLE_BUFFER_ELEMENTS_PER_BUFFER ( 1 ) + +#define D3D10_SO_SINGLE_BUFFER_COMPONENT_LIMIT ( 64 ) + +#define D3D10_SRGB_GAMMA ( 2.2f ) +#define D3D10_SRGB_TO_FLOAT_DENOMINATOR_1 ( 12.92f ) +#define D3D10_SRGB_TO_FLOAT_DENOMINATOR_2 ( 1.055f ) +#define D3D10_SRGB_TO_FLOAT_EXPONENT ( 2.4f ) +#define D3D10_SRGB_TO_FLOAT_OFFSET ( 0.055f ) +#define D3D10_SRGB_TO_FLOAT_THRESHOLD ( 0.04045f ) +#define D3D10_SRGB_TO_FLOAT_TOLERANCE_IN_ULP ( 0.5f ) +#define D3D10_STANDARD_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D10_STANDARD_COMPONENT_BIT_COUNT_DOUBLED ( 64 ) + +#define D3D10_STANDARD_MAXIMUM_ELEMENT_ALIGNMENT_BYTE_MULTIPLE ( 4 ) + +#define D3D10_STANDARD_PIXEL_COMPONENT_COUNT ( 128 ) + +#define D3D10_STANDARD_PIXEL_ELEMENT_COUNT ( 32 ) + +#define D3D10_STANDARD_VECTOR_SIZE ( 4 ) + +#define D3D10_STANDARD_VERTEX_ELEMENT_COUNT ( 16 ) + +#define D3D10_STANDARD_VERTEX_TOTAL_COMPONENT_COUNT ( 64 ) + +#define D3D10_SUBPIXEL_FRACTIONAL_BIT_COUNT ( 8 ) + +#define D3D10_SUBTEXEL_FRACTIONAL_BIT_COUNT ( 6 ) + +#define D3D10_TEXEL_ADDRESS_RANGE_BIT_COUNT ( 18 ) + +#define D3D10_UNBOUND_MEMORY_ACCESS_RESULT ( 0 ) + +#define D3D10_VIEWPORT_AND_SCISSORRECT_MAX_INDEX ( 15 ) + +#define D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE ( 16 ) + +#define D3D10_VIEWPORT_BOUNDS_MAX ( 16383 ) + +#define D3D10_VIEWPORT_BOUNDS_MIN ( -16384 ) + +#define D3D10_VS_INPUT_REGISTER_COMPONENTS ( 4 ) + +#define D3D10_VS_INPUT_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D10_VS_INPUT_REGISTER_COUNT ( 16 ) + +#define D3D10_VS_INPUT_REGISTER_READS_PER_INST ( 2 ) + +#define D3D10_VS_INPUT_REGISTER_READ_PORTS ( 1 ) + +#define D3D10_VS_OUTPUT_REGISTER_COMPONENTS ( 4 ) + +#define D3D10_VS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D10_VS_OUTPUT_REGISTER_COUNT ( 16 ) + +#define D3D10_WHQL_CONTEXT_COUNT_FOR_RESOURCE_LIMIT ( 10 ) + +#define D3D10_WHQL_DRAWINDEXED_INDEX_COUNT_2_TO_EXP ( 25 ) + +#define D3D10_WHQL_DRAW_VERTEX_COUNT_2_TO_EXP ( 25 ) + +#define D3D_MAJOR_VERSION ( 10 ) + +#define D3D_MINOR_VERSION ( 0 ) + +#define D3D_SPEC_DATE_DAY ( 8 ) + +#define D3D_SPEC_DATE_MONTH ( 8 ) + +#define D3D_SPEC_DATE_YEAR ( 2006 ) + +#define D3D_SPEC_VERSION ( 1.050005 ) +#endif +#if !defined( __d3d10_1_h__ ) && !(D3D10_HEADER_MINOR_VERSION >= 1) +#define D3D10_1_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT D3D10_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT +#define D3D10_1_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT D3D10_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT +#endif +#define _FACD3D10 ( 0x879 ) + +#define _FACD3D10DEBUG ( ( _FACD3D10 + 1 ) ) + +#define MAKE_D3D10_HRESULT( code ) MAKE_HRESULT( 1, _FACD3D10, code ) +#define MAKE_D3D10_STATUS( code ) MAKE_HRESULT( 0, _FACD3D10, code ) +#define D3D10_ERROR_TOO_MANY_UNIQUE_STATE_OBJECTS MAKE_D3D10_HRESULT(1) +#define D3D10_ERROR_FILE_NOT_FOUND MAKE_D3D10_HRESULT(2) +#if __SAL_H_FULL_VER < 140050727 +#undef __in_range +#undef __in_xcount_opt +#define __in_range(x, y) +#define __in_xcount_opt(x) +#endif +typedef +enum D3D10_INPUT_CLASSIFICATION + { D3D10_INPUT_PER_VERTEX_DATA = 0, + D3D10_INPUT_PER_INSTANCE_DATA = 1 + } D3D10_INPUT_CLASSIFICATION; + +#define D3D10_APPEND_ALIGNED_ELEMENT ( 0xffffffff ) + +typedef struct D3D10_INPUT_ELEMENT_DESC + { + LPCSTR SemanticName; + UINT SemanticIndex; + DXGI_FORMAT Format; + UINT InputSlot; + UINT AlignedByteOffset; + D3D10_INPUT_CLASSIFICATION InputSlotClass; + UINT InstanceDataStepRate; + } D3D10_INPUT_ELEMENT_DESC; + +typedef +enum D3D10_FILL_MODE + { D3D10_FILL_WIREFRAME = 2, + D3D10_FILL_SOLID = 3 + } D3D10_FILL_MODE; + +typedef D3D_PRIMITIVE_TOPOLOGY D3D10_PRIMITIVE_TOPOLOGY; + +typedef D3D_PRIMITIVE D3D10_PRIMITIVE; + +typedef +enum D3D10_CULL_MODE + { D3D10_CULL_NONE = 1, + D3D10_CULL_FRONT = 2, + D3D10_CULL_BACK = 3 + } D3D10_CULL_MODE; + +typedef struct D3D10_SO_DECLARATION_ENTRY + { + LPCSTR SemanticName; + UINT SemanticIndex; + BYTE StartComponent; + BYTE ComponentCount; + BYTE OutputSlot; + } D3D10_SO_DECLARATION_ENTRY; + +typedef struct D3D10_VIEWPORT + { + INT TopLeftX; + INT TopLeftY; + UINT Width; + UINT Height; + FLOAT MinDepth; + FLOAT MaxDepth; + } D3D10_VIEWPORT; + +typedef +enum D3D10_RESOURCE_DIMENSION + { D3D10_RESOURCE_DIMENSION_UNKNOWN = 0, + D3D10_RESOURCE_DIMENSION_BUFFER = 1, + D3D10_RESOURCE_DIMENSION_TEXTURE1D = 2, + D3D10_RESOURCE_DIMENSION_TEXTURE2D = 3, + D3D10_RESOURCE_DIMENSION_TEXTURE3D = 4 + } D3D10_RESOURCE_DIMENSION; + +typedef D3D_SRV_DIMENSION D3D10_SRV_DIMENSION; + +typedef +enum D3D10_DSV_DIMENSION + { D3D10_DSV_DIMENSION_UNKNOWN = 0, + D3D10_DSV_DIMENSION_TEXTURE1D = 1, + D3D10_DSV_DIMENSION_TEXTURE1DARRAY = 2, + D3D10_DSV_DIMENSION_TEXTURE2D = 3, + D3D10_DSV_DIMENSION_TEXTURE2DARRAY = 4, + D3D10_DSV_DIMENSION_TEXTURE2DMS = 5, + D3D10_DSV_DIMENSION_TEXTURE2DMSARRAY = 6 + } D3D10_DSV_DIMENSION; + +typedef +enum D3D10_RTV_DIMENSION + { D3D10_RTV_DIMENSION_UNKNOWN = 0, + D3D10_RTV_DIMENSION_BUFFER = 1, + D3D10_RTV_DIMENSION_TEXTURE1D = 2, + D3D10_RTV_DIMENSION_TEXTURE1DARRAY = 3, + D3D10_RTV_DIMENSION_TEXTURE2D = 4, + D3D10_RTV_DIMENSION_TEXTURE2DARRAY = 5, + D3D10_RTV_DIMENSION_TEXTURE2DMS = 6, + D3D10_RTV_DIMENSION_TEXTURE2DMSARRAY = 7, + D3D10_RTV_DIMENSION_TEXTURE3D = 8 + } D3D10_RTV_DIMENSION; + +typedef +enum D3D10_USAGE + { D3D10_USAGE_DEFAULT = 0, + D3D10_USAGE_IMMUTABLE = 1, + D3D10_USAGE_DYNAMIC = 2, + D3D10_USAGE_STAGING = 3 + } D3D10_USAGE; + +typedef +enum D3D10_BIND_FLAG + { D3D10_BIND_VERTEX_BUFFER = 0x1L, + D3D10_BIND_INDEX_BUFFER = 0x2L, + D3D10_BIND_CONSTANT_BUFFER = 0x4L, + D3D10_BIND_SHADER_RESOURCE = 0x8L, + D3D10_BIND_STREAM_OUTPUT = 0x10L, + D3D10_BIND_RENDER_TARGET = 0x20L, + D3D10_BIND_DEPTH_STENCIL = 0x40L + } D3D10_BIND_FLAG; + +typedef +enum D3D10_CPU_ACCESS_FLAG + { D3D10_CPU_ACCESS_WRITE = 0x10000L, + D3D10_CPU_ACCESS_READ = 0x20000L + } D3D10_CPU_ACCESS_FLAG; + +typedef +enum D3D10_RESOURCE_MISC_FLAG + { D3D10_RESOURCE_MISC_GENERATE_MIPS = 0x1L, + D3D10_RESOURCE_MISC_SHARED = 0x2L, + D3D10_RESOURCE_MISC_TEXTURECUBE = 0x4L, + D3D10_RESOURCE_MISC_SHARED_KEYEDMUTEX = 0x10L, + D3D10_RESOURCE_MISC_GDI_COMPATIBLE = 0x20L + } D3D10_RESOURCE_MISC_FLAG; + +typedef +enum D3D10_MAP + { D3D10_MAP_READ = 1, + D3D10_MAP_WRITE = 2, + D3D10_MAP_READ_WRITE = 3, + D3D10_MAP_WRITE_DISCARD = 4, + D3D10_MAP_WRITE_NO_OVERWRITE = 5 + } D3D10_MAP; + +typedef +enum D3D10_MAP_FLAG + { D3D10_MAP_FLAG_DO_NOT_WAIT = 0x100000L + } D3D10_MAP_FLAG; + +typedef +enum D3D10_RAISE_FLAG + { D3D10_RAISE_FLAG_DRIVER_INTERNAL_ERROR = 0x1L + } D3D10_RAISE_FLAG; + +typedef +enum D3D10_CLEAR_FLAG + { D3D10_CLEAR_DEPTH = 0x1L, + D3D10_CLEAR_STENCIL = 0x2L + } D3D10_CLEAR_FLAG; + +typedef RECT D3D10_RECT; + +typedef struct D3D10_BOX + { + UINT left; + UINT top; + UINT front; + UINT right; + UINT bottom; + UINT back; + } D3D10_BOX; + + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0000_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0000_v0_0_s_ifspec; + +#ifndef __ID3D10DeviceChild_INTERFACE_DEFINED__ +#define __ID3D10DeviceChild_INTERFACE_DEFINED__ + +/* interface ID3D10DeviceChild */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10DeviceChild; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9B7E4C00-342C-4106-A19F-4F2704F689F0") + ID3D10DeviceChild : public IUnknown + { + public: + virtual void STDMETHODCALLTYPE GetDevice( + /* [annotation] */ + __out ID3D10Device **ppDevice) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetPrivateData( + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt(*pDataSize) void *pData) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetPrivateData( + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt(DataSize) const void *pData) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface( + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D10DeviceChildVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10DeviceChild * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10DeviceChild * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10DeviceChild * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D10DeviceChild * This, + /* [annotation] */ + __out ID3D10Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D10DeviceChild * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D10DeviceChild * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D10DeviceChild * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData); + + END_INTERFACE + } ID3D10DeviceChildVtbl; + + interface ID3D10DeviceChild + { + CONST_VTBL struct ID3D10DeviceChildVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10DeviceChild_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10DeviceChild_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10DeviceChild_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10DeviceChild_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D10DeviceChild_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D10DeviceChild_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D10DeviceChild_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10DeviceChild_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d10_0000_0001 */ +/* [local] */ + +typedef +enum D3D10_COMPARISON_FUNC + { D3D10_COMPARISON_NEVER = 1, + D3D10_COMPARISON_LESS = 2, + D3D10_COMPARISON_EQUAL = 3, + D3D10_COMPARISON_LESS_EQUAL = 4, + D3D10_COMPARISON_GREATER = 5, + D3D10_COMPARISON_NOT_EQUAL = 6, + D3D10_COMPARISON_GREATER_EQUAL = 7, + D3D10_COMPARISON_ALWAYS = 8 + } D3D10_COMPARISON_FUNC; + +typedef +enum D3D10_DEPTH_WRITE_MASK + { D3D10_DEPTH_WRITE_MASK_ZERO = 0, + D3D10_DEPTH_WRITE_MASK_ALL = 1 + } D3D10_DEPTH_WRITE_MASK; + +typedef +enum D3D10_STENCIL_OP + { D3D10_STENCIL_OP_KEEP = 1, + D3D10_STENCIL_OP_ZERO = 2, + D3D10_STENCIL_OP_REPLACE = 3, + D3D10_STENCIL_OP_INCR_SAT = 4, + D3D10_STENCIL_OP_DECR_SAT = 5, + D3D10_STENCIL_OP_INVERT = 6, + D3D10_STENCIL_OP_INCR = 7, + D3D10_STENCIL_OP_DECR = 8 + } D3D10_STENCIL_OP; + +typedef struct D3D10_DEPTH_STENCILOP_DESC + { + D3D10_STENCIL_OP StencilFailOp; + D3D10_STENCIL_OP StencilDepthFailOp; + D3D10_STENCIL_OP StencilPassOp; + D3D10_COMPARISON_FUNC StencilFunc; + } D3D10_DEPTH_STENCILOP_DESC; + +typedef struct D3D10_DEPTH_STENCIL_DESC + { + BOOL DepthEnable; + D3D10_DEPTH_WRITE_MASK DepthWriteMask; + D3D10_COMPARISON_FUNC DepthFunc; + BOOL StencilEnable; + UINT8 StencilReadMask; + UINT8 StencilWriteMask; + D3D10_DEPTH_STENCILOP_DESC FrontFace; + D3D10_DEPTH_STENCILOP_DESC BackFace; + } D3D10_DEPTH_STENCIL_DESC; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0001_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0001_v0_0_s_ifspec; + +#ifndef __ID3D10DepthStencilState_INTERFACE_DEFINED__ +#define __ID3D10DepthStencilState_INTERFACE_DEFINED__ + +/* interface ID3D10DepthStencilState */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10DepthStencilState; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("2B4B1CC8-A4AD-41f8-8322-CA86FC3EC675") + ID3D10DepthStencilState : public ID3D10DeviceChild + { + public: + virtual void STDMETHODCALLTYPE GetDesc( + /* [annotation] */ + __out D3D10_DEPTH_STENCIL_DESC *pDesc) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D10DepthStencilStateVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10DepthStencilState * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10DepthStencilState * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10DepthStencilState * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D10DepthStencilState * This, + /* [annotation] */ + __out ID3D10Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D10DepthStencilState * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D10DepthStencilState * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D10DepthStencilState * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData); + + void ( STDMETHODCALLTYPE *GetDesc )( + ID3D10DepthStencilState * This, + /* [annotation] */ + __out D3D10_DEPTH_STENCIL_DESC *pDesc); + + END_INTERFACE + } ID3D10DepthStencilStateVtbl; + + interface ID3D10DepthStencilState + { + CONST_VTBL struct ID3D10DepthStencilStateVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10DepthStencilState_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10DepthStencilState_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10DepthStencilState_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10DepthStencilState_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D10DepthStencilState_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D10DepthStencilState_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D10DepthStencilState_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D10DepthStencilState_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10DepthStencilState_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d10_0000_0002 */ +/* [local] */ + +typedef +enum D3D10_BLEND + { D3D10_BLEND_ZERO = 1, + D3D10_BLEND_ONE = 2, + D3D10_BLEND_SRC_COLOR = 3, + D3D10_BLEND_INV_SRC_COLOR = 4, + D3D10_BLEND_SRC_ALPHA = 5, + D3D10_BLEND_INV_SRC_ALPHA = 6, + D3D10_BLEND_DEST_ALPHA = 7, + D3D10_BLEND_INV_DEST_ALPHA = 8, + D3D10_BLEND_DEST_COLOR = 9, + D3D10_BLEND_INV_DEST_COLOR = 10, + D3D10_BLEND_SRC_ALPHA_SAT = 11, + D3D10_BLEND_BLEND_FACTOR = 14, + D3D10_BLEND_INV_BLEND_FACTOR = 15, + D3D10_BLEND_SRC1_COLOR = 16, + D3D10_BLEND_INV_SRC1_COLOR = 17, + D3D10_BLEND_SRC1_ALPHA = 18, + D3D10_BLEND_INV_SRC1_ALPHA = 19 + } D3D10_BLEND; + +typedef +enum D3D10_BLEND_OP + { D3D10_BLEND_OP_ADD = 1, + D3D10_BLEND_OP_SUBTRACT = 2, + D3D10_BLEND_OP_REV_SUBTRACT = 3, + D3D10_BLEND_OP_MIN = 4, + D3D10_BLEND_OP_MAX = 5 + } D3D10_BLEND_OP; + +typedef +enum D3D10_COLOR_WRITE_ENABLE + { D3D10_COLOR_WRITE_ENABLE_RED = 1, + D3D10_COLOR_WRITE_ENABLE_GREEN = 2, + D3D10_COLOR_WRITE_ENABLE_BLUE = 4, + D3D10_COLOR_WRITE_ENABLE_ALPHA = 8, + D3D10_COLOR_WRITE_ENABLE_ALL = ( ( ( D3D10_COLOR_WRITE_ENABLE_RED | D3D10_COLOR_WRITE_ENABLE_GREEN ) | D3D10_COLOR_WRITE_ENABLE_BLUE ) | D3D10_COLOR_WRITE_ENABLE_ALPHA ) + } D3D10_COLOR_WRITE_ENABLE; + +typedef struct D3D10_BLEND_DESC + { + BOOL AlphaToCoverageEnable; + BOOL BlendEnable[ 8 ]; + D3D10_BLEND SrcBlend; + D3D10_BLEND DestBlend; + D3D10_BLEND_OP BlendOp; + D3D10_BLEND SrcBlendAlpha; + D3D10_BLEND DestBlendAlpha; + D3D10_BLEND_OP BlendOpAlpha; + UINT8 RenderTargetWriteMask[ 8 ]; + } D3D10_BLEND_DESC; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0002_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0002_v0_0_s_ifspec; + +#ifndef __ID3D10BlendState_INTERFACE_DEFINED__ +#define __ID3D10BlendState_INTERFACE_DEFINED__ + +/* interface ID3D10BlendState */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10BlendState; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("EDAD8D19-8A35-4d6d-8566-2EA276CDE161") + ID3D10BlendState : public ID3D10DeviceChild + { + public: + virtual void STDMETHODCALLTYPE GetDesc( + /* [annotation] */ + __out D3D10_BLEND_DESC *pDesc) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D10BlendStateVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10BlendState * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10BlendState * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10BlendState * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D10BlendState * This, + /* [annotation] */ + __out ID3D10Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D10BlendState * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D10BlendState * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D10BlendState * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData); + + void ( STDMETHODCALLTYPE *GetDesc )( + ID3D10BlendState * This, + /* [annotation] */ + __out D3D10_BLEND_DESC *pDesc); + + END_INTERFACE + } ID3D10BlendStateVtbl; + + interface ID3D10BlendState + { + CONST_VTBL struct ID3D10BlendStateVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10BlendState_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10BlendState_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10BlendState_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10BlendState_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D10BlendState_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D10BlendState_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D10BlendState_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D10BlendState_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10BlendState_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d10_0000_0003 */ +/* [local] */ + +typedef struct D3D10_RASTERIZER_DESC + { + D3D10_FILL_MODE FillMode; + D3D10_CULL_MODE CullMode; + BOOL FrontCounterClockwise; + INT DepthBias; + FLOAT DepthBiasClamp; + FLOAT SlopeScaledDepthBias; + BOOL DepthClipEnable; + BOOL ScissorEnable; + BOOL MultisampleEnable; + BOOL AntialiasedLineEnable; + } D3D10_RASTERIZER_DESC; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0003_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0003_v0_0_s_ifspec; + +#ifndef __ID3D10RasterizerState_INTERFACE_DEFINED__ +#define __ID3D10RasterizerState_INTERFACE_DEFINED__ + +/* interface ID3D10RasterizerState */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10RasterizerState; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("A2A07292-89AF-4345-BE2E-C53D9FBB6E9F") + ID3D10RasterizerState : public ID3D10DeviceChild + { + public: + virtual void STDMETHODCALLTYPE GetDesc( + /* [annotation] */ + __out D3D10_RASTERIZER_DESC *pDesc) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D10RasterizerStateVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10RasterizerState * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10RasterizerState * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10RasterizerState * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D10RasterizerState * This, + /* [annotation] */ + __out ID3D10Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D10RasterizerState * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D10RasterizerState * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D10RasterizerState * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData); + + void ( STDMETHODCALLTYPE *GetDesc )( + ID3D10RasterizerState * This, + /* [annotation] */ + __out D3D10_RASTERIZER_DESC *pDesc); + + END_INTERFACE + } ID3D10RasterizerStateVtbl; + + interface ID3D10RasterizerState + { + CONST_VTBL struct ID3D10RasterizerStateVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10RasterizerState_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10RasterizerState_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10RasterizerState_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10RasterizerState_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D10RasterizerState_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D10RasterizerState_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D10RasterizerState_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D10RasterizerState_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10RasterizerState_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d10_0000_0004 */ +/* [local] */ + +#if !defined( D3D10_NO_HELPERS ) && defined( __cplusplus ) +inline UINT D3D10CalcSubresource( UINT MipSlice, UINT ArraySlice, UINT MipLevels ) +{ return MipSlice + ArraySlice * MipLevels; } +#endif +typedef struct D3D10_SUBRESOURCE_DATA + { + const void *pSysMem; + UINT SysMemPitch; + UINT SysMemSlicePitch; + } D3D10_SUBRESOURCE_DATA; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0004_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0004_v0_0_s_ifspec; + +#ifndef __ID3D10Resource_INTERFACE_DEFINED__ +#define __ID3D10Resource_INTERFACE_DEFINED__ + +/* interface ID3D10Resource */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10Resource; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9B7E4C01-342C-4106-A19F-4F2704F689F0") + ID3D10Resource : public ID3D10DeviceChild + { + public: + virtual void STDMETHODCALLTYPE GetType( + /* [annotation] */ + __out D3D10_RESOURCE_DIMENSION *rType) = 0; + + virtual void STDMETHODCALLTYPE SetEvictionPriority( + /* [annotation] */ + __in UINT EvictionPriority) = 0; + + virtual UINT STDMETHODCALLTYPE GetEvictionPriority( void) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D10ResourceVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10Resource * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10Resource * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10Resource * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D10Resource * This, + /* [annotation] */ + __out ID3D10Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D10Resource * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D10Resource * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D10Resource * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData); + + void ( STDMETHODCALLTYPE *GetType )( + ID3D10Resource * This, + /* [annotation] */ + __out D3D10_RESOURCE_DIMENSION *rType); + + void ( STDMETHODCALLTYPE *SetEvictionPriority )( + ID3D10Resource * This, + /* [annotation] */ + __in UINT EvictionPriority); + + UINT ( STDMETHODCALLTYPE *GetEvictionPriority )( + ID3D10Resource * This); + + END_INTERFACE + } ID3D10ResourceVtbl; + + interface ID3D10Resource + { + CONST_VTBL struct ID3D10ResourceVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10Resource_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10Resource_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10Resource_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10Resource_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D10Resource_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D10Resource_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D10Resource_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D10Resource_GetType(This,rType) \ + ( (This)->lpVtbl -> GetType(This,rType) ) + +#define ID3D10Resource_SetEvictionPriority(This,EvictionPriority) \ + ( (This)->lpVtbl -> SetEvictionPriority(This,EvictionPriority) ) + +#define ID3D10Resource_GetEvictionPriority(This) \ + ( (This)->lpVtbl -> GetEvictionPriority(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10Resource_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d10_0000_0005 */ +/* [local] */ + +typedef struct D3D10_BUFFER_DESC + { + UINT ByteWidth; + D3D10_USAGE Usage; + UINT BindFlags; + UINT CPUAccessFlags; + UINT MiscFlags; + } D3D10_BUFFER_DESC; + +#if !defined( D3D10_NO_HELPERS ) && defined( __cplusplus ) +struct CD3D10_BUFFER_DESC : public D3D10_BUFFER_DESC +{ + CD3D10_BUFFER_DESC() + {} + explicit CD3D10_BUFFER_DESC( const D3D10_BUFFER_DESC& o ) : + D3D10_BUFFER_DESC( o ) + {} + explicit CD3D10_BUFFER_DESC( + UINT byteWidth, + UINT bindFlags, + D3D10_USAGE usage = D3D10_USAGE_DEFAULT, + UINT cpuaccessFlags = 0, + UINT miscFlags = 0 ) + { + ByteWidth = byteWidth; + Usage = usage; + BindFlags = bindFlags; + CPUAccessFlags = cpuaccessFlags ; + MiscFlags = miscFlags; + } + ~CD3D10_BUFFER_DESC() {} + operator const D3D10_BUFFER_DESC&() const { return *this; } +}; +#endif + + +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0005_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0005_v0_0_s_ifspec; + +#ifndef __ID3D10Buffer_INTERFACE_DEFINED__ +#define __ID3D10Buffer_INTERFACE_DEFINED__ + +/* interface ID3D10Buffer */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10Buffer; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9B7E4C02-342C-4106-A19F-4F2704F689F0") + ID3D10Buffer : public ID3D10Resource + { + public: + virtual HRESULT STDMETHODCALLTYPE Map( + /* [annotation] */ + __in D3D10_MAP MapType, + /* [annotation] */ + __in UINT MapFlags, + /* [annotation] */ + __out void **ppData) = 0; + + virtual void STDMETHODCALLTYPE Unmap( void) = 0; + + virtual void STDMETHODCALLTYPE GetDesc( + /* [annotation] */ + __out D3D10_BUFFER_DESC *pDesc) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D10BufferVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10Buffer * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10Buffer * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10Buffer * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D10Buffer * This, + /* [annotation] */ + __out ID3D10Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D10Buffer * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D10Buffer * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D10Buffer * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData); + + void ( STDMETHODCALLTYPE *GetType )( + ID3D10Buffer * This, + /* [annotation] */ + __out D3D10_RESOURCE_DIMENSION *rType); + + void ( STDMETHODCALLTYPE *SetEvictionPriority )( + ID3D10Buffer * This, + /* [annotation] */ + __in UINT EvictionPriority); + + UINT ( STDMETHODCALLTYPE *GetEvictionPriority )( + ID3D10Buffer * This); + + HRESULT ( STDMETHODCALLTYPE *Map )( + ID3D10Buffer * This, + /* [annotation] */ + __in D3D10_MAP MapType, + /* [annotation] */ + __in UINT MapFlags, + /* [annotation] */ + __out void **ppData); + + void ( STDMETHODCALLTYPE *Unmap )( + ID3D10Buffer * This); + + void ( STDMETHODCALLTYPE *GetDesc )( + ID3D10Buffer * This, + /* [annotation] */ + __out D3D10_BUFFER_DESC *pDesc); + + END_INTERFACE + } ID3D10BufferVtbl; + + interface ID3D10Buffer + { + CONST_VTBL struct ID3D10BufferVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10Buffer_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10Buffer_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10Buffer_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10Buffer_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D10Buffer_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D10Buffer_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D10Buffer_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D10Buffer_GetType(This,rType) \ + ( (This)->lpVtbl -> GetType(This,rType) ) + +#define ID3D10Buffer_SetEvictionPriority(This,EvictionPriority) \ + ( (This)->lpVtbl -> SetEvictionPriority(This,EvictionPriority) ) + +#define ID3D10Buffer_GetEvictionPriority(This) \ + ( (This)->lpVtbl -> GetEvictionPriority(This) ) + + +#define ID3D10Buffer_Map(This,MapType,MapFlags,ppData) \ + ( (This)->lpVtbl -> Map(This,MapType,MapFlags,ppData) ) + +#define ID3D10Buffer_Unmap(This) \ + ( (This)->lpVtbl -> Unmap(This) ) + +#define ID3D10Buffer_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10Buffer_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d10_0000_0006 */ +/* [local] */ + +typedef struct D3D10_TEXTURE1D_DESC + { + UINT Width; + UINT MipLevels; + UINT ArraySize; + DXGI_FORMAT Format; + D3D10_USAGE Usage; + UINT BindFlags; + UINT CPUAccessFlags; + UINT MiscFlags; + } D3D10_TEXTURE1D_DESC; + +#if !defined( D3D10_NO_HELPERS ) && defined( __cplusplus ) +struct CD3D10_TEXTURE1D_DESC : public D3D10_TEXTURE1D_DESC +{ + CD3D10_TEXTURE1D_DESC() + {} + explicit CD3D10_TEXTURE1D_DESC( const D3D10_TEXTURE1D_DESC& o ) : + D3D10_TEXTURE1D_DESC( o ) + {} + explicit CD3D10_TEXTURE1D_DESC( + DXGI_FORMAT format, + UINT width, + UINT arraySize = 1, + UINT mipLevels = 0, + UINT bindFlags = D3D10_BIND_SHADER_RESOURCE, + D3D10_USAGE usage = D3D10_USAGE_DEFAULT, + UINT cpuaccessFlags= 0, + UINT miscFlags = 0 ) + { + Width = width; + MipLevels = mipLevels; + ArraySize = arraySize; + Format = format; + Usage = usage; + BindFlags = bindFlags; + CPUAccessFlags = cpuaccessFlags; + MiscFlags = miscFlags; + } + ~CD3D10_TEXTURE1D_DESC() {} + operator const D3D10_TEXTURE1D_DESC&() const { return *this; } +}; +#endif + + +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0006_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0006_v0_0_s_ifspec; + +#ifndef __ID3D10Texture1D_INTERFACE_DEFINED__ +#define __ID3D10Texture1D_INTERFACE_DEFINED__ + +/* interface ID3D10Texture1D */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10Texture1D; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9B7E4C03-342C-4106-A19F-4F2704F689F0") + ID3D10Texture1D : public ID3D10Resource + { + public: + virtual HRESULT STDMETHODCALLTYPE Map( + /* [annotation] */ + __in UINT Subresource, + /* [annotation] */ + __in D3D10_MAP MapType, + /* [annotation] */ + __in UINT MapFlags, + /* [annotation] */ + __out void **ppData) = 0; + + virtual void STDMETHODCALLTYPE Unmap( + /* [annotation] */ + __in UINT Subresource) = 0; + + virtual void STDMETHODCALLTYPE GetDesc( + /* [annotation] */ + __out D3D10_TEXTURE1D_DESC *pDesc) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D10Texture1DVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10Texture1D * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10Texture1D * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10Texture1D * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D10Texture1D * This, + /* [annotation] */ + __out ID3D10Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D10Texture1D * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D10Texture1D * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D10Texture1D * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData); + + void ( STDMETHODCALLTYPE *GetType )( + ID3D10Texture1D * This, + /* [annotation] */ + __out D3D10_RESOURCE_DIMENSION *rType); + + void ( STDMETHODCALLTYPE *SetEvictionPriority )( + ID3D10Texture1D * This, + /* [annotation] */ + __in UINT EvictionPriority); + + UINT ( STDMETHODCALLTYPE *GetEvictionPriority )( + ID3D10Texture1D * This); + + HRESULT ( STDMETHODCALLTYPE *Map )( + ID3D10Texture1D * This, + /* [annotation] */ + __in UINT Subresource, + /* [annotation] */ + __in D3D10_MAP MapType, + /* [annotation] */ + __in UINT MapFlags, + /* [annotation] */ + __out void **ppData); + + void ( STDMETHODCALLTYPE *Unmap )( + ID3D10Texture1D * This, + /* [annotation] */ + __in UINT Subresource); + + void ( STDMETHODCALLTYPE *GetDesc )( + ID3D10Texture1D * This, + /* [annotation] */ + __out D3D10_TEXTURE1D_DESC *pDesc); + + END_INTERFACE + } ID3D10Texture1DVtbl; + + interface ID3D10Texture1D + { + CONST_VTBL struct ID3D10Texture1DVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10Texture1D_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10Texture1D_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10Texture1D_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10Texture1D_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D10Texture1D_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D10Texture1D_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D10Texture1D_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D10Texture1D_GetType(This,rType) \ + ( (This)->lpVtbl -> GetType(This,rType) ) + +#define ID3D10Texture1D_SetEvictionPriority(This,EvictionPriority) \ + ( (This)->lpVtbl -> SetEvictionPriority(This,EvictionPriority) ) + +#define ID3D10Texture1D_GetEvictionPriority(This) \ + ( (This)->lpVtbl -> GetEvictionPriority(This) ) + + +#define ID3D10Texture1D_Map(This,Subresource,MapType,MapFlags,ppData) \ + ( (This)->lpVtbl -> Map(This,Subresource,MapType,MapFlags,ppData) ) + +#define ID3D10Texture1D_Unmap(This,Subresource) \ + ( (This)->lpVtbl -> Unmap(This,Subresource) ) + +#define ID3D10Texture1D_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10Texture1D_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d10_0000_0007 */ +/* [local] */ + +typedef struct D3D10_TEXTURE2D_DESC + { + UINT Width; + UINT Height; + UINT MipLevels; + UINT ArraySize; + DXGI_FORMAT Format; + DXGI_SAMPLE_DESC SampleDesc; + D3D10_USAGE Usage; + UINT BindFlags; + UINT CPUAccessFlags; + UINT MiscFlags; + } D3D10_TEXTURE2D_DESC; + +#if !defined( D3D10_NO_HELPERS ) && defined( __cplusplus ) +struct CD3D10_TEXTURE2D_DESC : public D3D10_TEXTURE2D_DESC +{ + CD3D10_TEXTURE2D_DESC() + {} + explicit CD3D10_TEXTURE2D_DESC( const D3D10_TEXTURE2D_DESC& o ) : + D3D10_TEXTURE2D_DESC( o ) + {} + explicit CD3D10_TEXTURE2D_DESC( + DXGI_FORMAT format, + UINT width, + UINT height, + UINT arraySize = 1, + UINT mipLevels = 0, + UINT bindFlags = D3D10_BIND_SHADER_RESOURCE, + D3D10_USAGE usage = D3D10_USAGE_DEFAULT, + UINT cpuaccessFlags = 0, + UINT sampleCount = 1, + UINT sampleQuality = 0, + UINT miscFlags = 0 ) + { + Width = width; + Height = height; + MipLevels = mipLevels; + ArraySize = arraySize; + Format = format; + SampleDesc.Count = sampleCount; + SampleDesc.Quality = sampleQuality; + Usage = usage; + BindFlags = bindFlags; + CPUAccessFlags = cpuaccessFlags; + MiscFlags = miscFlags; + } + ~CD3D10_TEXTURE2D_DESC() {} + operator const D3D10_TEXTURE2D_DESC&() const { return *this; } +}; +#endif +typedef struct D3D10_MAPPED_TEXTURE2D + { + void *pData; + UINT RowPitch; + } D3D10_MAPPED_TEXTURE2D; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0007_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0007_v0_0_s_ifspec; + +#ifndef __ID3D10Texture2D_INTERFACE_DEFINED__ +#define __ID3D10Texture2D_INTERFACE_DEFINED__ + +/* interface ID3D10Texture2D */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10Texture2D; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9B7E4C04-342C-4106-A19F-4F2704F689F0") + ID3D10Texture2D : public ID3D10Resource + { + public: + virtual HRESULT STDMETHODCALLTYPE Map( + /* [annotation] */ + __in UINT Subresource, + /* [annotation] */ + __in D3D10_MAP MapType, + /* [annotation] */ + __in UINT MapFlags, + /* [annotation] */ + __out D3D10_MAPPED_TEXTURE2D *pMappedTex2D) = 0; + + virtual void STDMETHODCALLTYPE Unmap( + /* [annotation] */ + __in UINT Subresource) = 0; + + virtual void STDMETHODCALLTYPE GetDesc( + /* [annotation] */ + __out D3D10_TEXTURE2D_DESC *pDesc) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D10Texture2DVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10Texture2D * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10Texture2D * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10Texture2D * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D10Texture2D * This, + /* [annotation] */ + __out ID3D10Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D10Texture2D * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D10Texture2D * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D10Texture2D * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData); + + void ( STDMETHODCALLTYPE *GetType )( + ID3D10Texture2D * This, + /* [annotation] */ + __out D3D10_RESOURCE_DIMENSION *rType); + + void ( STDMETHODCALLTYPE *SetEvictionPriority )( + ID3D10Texture2D * This, + /* [annotation] */ + __in UINT EvictionPriority); + + UINT ( STDMETHODCALLTYPE *GetEvictionPriority )( + ID3D10Texture2D * This); + + HRESULT ( STDMETHODCALLTYPE *Map )( + ID3D10Texture2D * This, + /* [annotation] */ + __in UINT Subresource, + /* [annotation] */ + __in D3D10_MAP MapType, + /* [annotation] */ + __in UINT MapFlags, + /* [annotation] */ + __out D3D10_MAPPED_TEXTURE2D *pMappedTex2D); + + void ( STDMETHODCALLTYPE *Unmap )( + ID3D10Texture2D * This, + /* [annotation] */ + __in UINT Subresource); + + void ( STDMETHODCALLTYPE *GetDesc )( + ID3D10Texture2D * This, + /* [annotation] */ + __out D3D10_TEXTURE2D_DESC *pDesc); + + END_INTERFACE + } ID3D10Texture2DVtbl; + + interface ID3D10Texture2D + { + CONST_VTBL struct ID3D10Texture2DVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10Texture2D_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10Texture2D_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10Texture2D_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10Texture2D_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D10Texture2D_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D10Texture2D_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D10Texture2D_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D10Texture2D_GetType(This,rType) \ + ( (This)->lpVtbl -> GetType(This,rType) ) + +#define ID3D10Texture2D_SetEvictionPriority(This,EvictionPriority) \ + ( (This)->lpVtbl -> SetEvictionPriority(This,EvictionPriority) ) + +#define ID3D10Texture2D_GetEvictionPriority(This) \ + ( (This)->lpVtbl -> GetEvictionPriority(This) ) + + +#define ID3D10Texture2D_Map(This,Subresource,MapType,MapFlags,pMappedTex2D) \ + ( (This)->lpVtbl -> Map(This,Subresource,MapType,MapFlags,pMappedTex2D) ) + +#define ID3D10Texture2D_Unmap(This,Subresource) \ + ( (This)->lpVtbl -> Unmap(This,Subresource) ) + +#define ID3D10Texture2D_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10Texture2D_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d10_0000_0008 */ +/* [local] */ + +typedef struct D3D10_TEXTURE3D_DESC + { + UINT Width; + UINT Height; + UINT Depth; + UINT MipLevels; + DXGI_FORMAT Format; + D3D10_USAGE Usage; + UINT BindFlags; + UINT CPUAccessFlags; + UINT MiscFlags; + } D3D10_TEXTURE3D_DESC; + +#if !defined( D3D10_NO_HELPERS ) && defined( __cplusplus ) +struct CD3D10_TEXTURE3D_DESC : public D3D10_TEXTURE3D_DESC +{ + CD3D10_TEXTURE3D_DESC() + {} + explicit CD3D10_TEXTURE3D_DESC( const D3D10_TEXTURE3D_DESC& o ) : + D3D10_TEXTURE3D_DESC( o ) + {} + explicit CD3D10_TEXTURE3D_DESC( + DXGI_FORMAT format, + UINT width, + UINT height, + UINT depth, + UINT mipLevels = 0, + UINT bindFlags = D3D10_BIND_SHADER_RESOURCE, + D3D10_USAGE usage = D3D10_USAGE_DEFAULT, + UINT cpuaccessFlags = 0, + UINT miscFlags = 0 ) + { + Width = width; + Height = height; + Depth = depth; + MipLevels = mipLevels; + Format = format; + Usage = usage; + BindFlags = bindFlags; + CPUAccessFlags = cpuaccessFlags; + MiscFlags = miscFlags; + } + ~CD3D10_TEXTURE3D_DESC() {} + operator const D3D10_TEXTURE3D_DESC&() const { return *this; } +}; +#endif +typedef struct D3D10_MAPPED_TEXTURE3D + { + void *pData; + UINT RowPitch; + UINT DepthPitch; + } D3D10_MAPPED_TEXTURE3D; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0008_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0008_v0_0_s_ifspec; + +#ifndef __ID3D10Texture3D_INTERFACE_DEFINED__ +#define __ID3D10Texture3D_INTERFACE_DEFINED__ + +/* interface ID3D10Texture3D */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10Texture3D; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9B7E4C05-342C-4106-A19F-4F2704F689F0") + ID3D10Texture3D : public ID3D10Resource + { + public: + virtual HRESULT STDMETHODCALLTYPE Map( + /* [annotation] */ + __in UINT Subresource, + /* [annotation] */ + __in D3D10_MAP MapType, + /* [annotation] */ + __in UINT MapFlags, + /* [annotation] */ + __out D3D10_MAPPED_TEXTURE3D *pMappedTex3D) = 0; + + virtual void STDMETHODCALLTYPE Unmap( + /* [annotation] */ + __in UINT Subresource) = 0; + + virtual void STDMETHODCALLTYPE GetDesc( + /* [annotation] */ + __out D3D10_TEXTURE3D_DESC *pDesc) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D10Texture3DVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10Texture3D * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10Texture3D * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10Texture3D * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D10Texture3D * This, + /* [annotation] */ + __out ID3D10Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D10Texture3D * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D10Texture3D * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D10Texture3D * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData); + + void ( STDMETHODCALLTYPE *GetType )( + ID3D10Texture3D * This, + /* [annotation] */ + __out D3D10_RESOURCE_DIMENSION *rType); + + void ( STDMETHODCALLTYPE *SetEvictionPriority )( + ID3D10Texture3D * This, + /* [annotation] */ + __in UINT EvictionPriority); + + UINT ( STDMETHODCALLTYPE *GetEvictionPriority )( + ID3D10Texture3D * This); + + HRESULT ( STDMETHODCALLTYPE *Map )( + ID3D10Texture3D * This, + /* [annotation] */ + __in UINT Subresource, + /* [annotation] */ + __in D3D10_MAP MapType, + /* [annotation] */ + __in UINT MapFlags, + /* [annotation] */ + __out D3D10_MAPPED_TEXTURE3D *pMappedTex3D); + + void ( STDMETHODCALLTYPE *Unmap )( + ID3D10Texture3D * This, + /* [annotation] */ + __in UINT Subresource); + + void ( STDMETHODCALLTYPE *GetDesc )( + ID3D10Texture3D * This, + /* [annotation] */ + __out D3D10_TEXTURE3D_DESC *pDesc); + + END_INTERFACE + } ID3D10Texture3DVtbl; + + interface ID3D10Texture3D + { + CONST_VTBL struct ID3D10Texture3DVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10Texture3D_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10Texture3D_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10Texture3D_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10Texture3D_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D10Texture3D_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D10Texture3D_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D10Texture3D_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D10Texture3D_GetType(This,rType) \ + ( (This)->lpVtbl -> GetType(This,rType) ) + +#define ID3D10Texture3D_SetEvictionPriority(This,EvictionPriority) \ + ( (This)->lpVtbl -> SetEvictionPriority(This,EvictionPriority) ) + +#define ID3D10Texture3D_GetEvictionPriority(This) \ + ( (This)->lpVtbl -> GetEvictionPriority(This) ) + + +#define ID3D10Texture3D_Map(This,Subresource,MapType,MapFlags,pMappedTex3D) \ + ( (This)->lpVtbl -> Map(This,Subresource,MapType,MapFlags,pMappedTex3D) ) + +#define ID3D10Texture3D_Unmap(This,Subresource) \ + ( (This)->lpVtbl -> Unmap(This,Subresource) ) + +#define ID3D10Texture3D_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10Texture3D_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d10_0000_0009 */ +/* [local] */ + +typedef +enum D3D10_TEXTURECUBE_FACE + { D3D10_TEXTURECUBE_FACE_POSITIVE_X = 0, + D3D10_TEXTURECUBE_FACE_NEGATIVE_X = 1, + D3D10_TEXTURECUBE_FACE_POSITIVE_Y = 2, + D3D10_TEXTURECUBE_FACE_NEGATIVE_Y = 3, + D3D10_TEXTURECUBE_FACE_POSITIVE_Z = 4, + D3D10_TEXTURECUBE_FACE_NEGATIVE_Z = 5 + } D3D10_TEXTURECUBE_FACE; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0009_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0009_v0_0_s_ifspec; + +#ifndef __ID3D10View_INTERFACE_DEFINED__ +#define __ID3D10View_INTERFACE_DEFINED__ + +/* interface ID3D10View */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10View; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("C902B03F-60A7-49BA-9936-2A3AB37A7E33") + ID3D10View : public ID3D10DeviceChild + { + public: + virtual void STDMETHODCALLTYPE GetResource( + /* [annotation] */ + __out ID3D10Resource **ppResource) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D10ViewVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10View * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10View * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10View * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D10View * This, + /* [annotation] */ + __out ID3D10Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D10View * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D10View * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D10View * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData); + + void ( STDMETHODCALLTYPE *GetResource )( + ID3D10View * This, + /* [annotation] */ + __out ID3D10Resource **ppResource); + + END_INTERFACE + } ID3D10ViewVtbl; + + interface ID3D10View + { + CONST_VTBL struct ID3D10ViewVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10View_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10View_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10View_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10View_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D10View_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D10View_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D10View_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D10View_GetResource(This,ppResource) \ + ( (This)->lpVtbl -> GetResource(This,ppResource) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10View_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d10_0000_0010 */ +/* [local] */ + +typedef struct D3D10_BUFFER_SRV + { + union + { + UINT FirstElement; + UINT ElementOffset; + } ; + union + { + UINT NumElements; + UINT ElementWidth; + } ; + } D3D10_BUFFER_SRV; + +typedef struct D3D10_TEX1D_SRV + { + UINT MostDetailedMip; + UINT MipLevels; + } D3D10_TEX1D_SRV; + +typedef struct D3D10_TEX1D_ARRAY_SRV + { + UINT MostDetailedMip; + UINT MipLevels; + UINT FirstArraySlice; + UINT ArraySize; + } D3D10_TEX1D_ARRAY_SRV; + +typedef struct D3D10_TEX2D_SRV + { + UINT MostDetailedMip; + UINT MipLevels; + } D3D10_TEX2D_SRV; + +typedef struct D3D10_TEX2D_ARRAY_SRV + { + UINT MostDetailedMip; + UINT MipLevels; + UINT FirstArraySlice; + UINT ArraySize; + } D3D10_TEX2D_ARRAY_SRV; + +typedef struct D3D10_TEX3D_SRV + { + UINT MostDetailedMip; + UINT MipLevels; + } D3D10_TEX3D_SRV; + +typedef struct D3D10_TEXCUBE_SRV + { + UINT MostDetailedMip; + UINT MipLevels; + } D3D10_TEXCUBE_SRV; + +typedef struct D3D10_TEX2DMS_SRV + { + UINT UnusedField_NothingToDefine; + } D3D10_TEX2DMS_SRV; + +typedef struct D3D10_TEX2DMS_ARRAY_SRV + { + UINT FirstArraySlice; + UINT ArraySize; + } D3D10_TEX2DMS_ARRAY_SRV; + +typedef struct D3D10_SHADER_RESOURCE_VIEW_DESC + { + DXGI_FORMAT Format; + D3D10_SRV_DIMENSION ViewDimension; + union + { + D3D10_BUFFER_SRV Buffer; + D3D10_TEX1D_SRV Texture1D; + D3D10_TEX1D_ARRAY_SRV Texture1DArray; + D3D10_TEX2D_SRV Texture2D; + D3D10_TEX2D_ARRAY_SRV Texture2DArray; + D3D10_TEX2DMS_SRV Texture2DMS; + D3D10_TEX2DMS_ARRAY_SRV Texture2DMSArray; + D3D10_TEX3D_SRV Texture3D; + D3D10_TEXCUBE_SRV TextureCube; + } ; + } D3D10_SHADER_RESOURCE_VIEW_DESC; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0010_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0010_v0_0_s_ifspec; + +#ifndef __ID3D10ShaderResourceView_INTERFACE_DEFINED__ +#define __ID3D10ShaderResourceView_INTERFACE_DEFINED__ + +/* interface ID3D10ShaderResourceView */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10ShaderResourceView; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9B7E4C07-342C-4106-A19F-4F2704F689F0") + ID3D10ShaderResourceView : public ID3D10View + { + public: + virtual void STDMETHODCALLTYPE GetDesc( + /* [annotation] */ + __out D3D10_SHADER_RESOURCE_VIEW_DESC *pDesc) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D10ShaderResourceViewVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10ShaderResourceView * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10ShaderResourceView * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10ShaderResourceView * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D10ShaderResourceView * This, + /* [annotation] */ + __out ID3D10Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D10ShaderResourceView * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D10ShaderResourceView * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D10ShaderResourceView * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData); + + void ( STDMETHODCALLTYPE *GetResource )( + ID3D10ShaderResourceView * This, + /* [annotation] */ + __out ID3D10Resource **ppResource); + + void ( STDMETHODCALLTYPE *GetDesc )( + ID3D10ShaderResourceView * This, + /* [annotation] */ + __out D3D10_SHADER_RESOURCE_VIEW_DESC *pDesc); + + END_INTERFACE + } ID3D10ShaderResourceViewVtbl; + + interface ID3D10ShaderResourceView + { + CONST_VTBL struct ID3D10ShaderResourceViewVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10ShaderResourceView_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10ShaderResourceView_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10ShaderResourceView_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10ShaderResourceView_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D10ShaderResourceView_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D10ShaderResourceView_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D10ShaderResourceView_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D10ShaderResourceView_GetResource(This,ppResource) \ + ( (This)->lpVtbl -> GetResource(This,ppResource) ) + + +#define ID3D10ShaderResourceView_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10ShaderResourceView_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d10_0000_0011 */ +/* [local] */ + +typedef struct D3D10_BUFFER_RTV + { + union + { + UINT FirstElement; + UINT ElementOffset; + } ; + union + { + UINT NumElements; + UINT ElementWidth; + } ; + } D3D10_BUFFER_RTV; + +typedef struct D3D10_TEX1D_RTV + { + UINT MipSlice; + } D3D10_TEX1D_RTV; + +typedef struct D3D10_TEX1D_ARRAY_RTV + { + UINT MipSlice; + UINT FirstArraySlice; + UINT ArraySize; + } D3D10_TEX1D_ARRAY_RTV; + +typedef struct D3D10_TEX2D_RTV + { + UINT MipSlice; + } D3D10_TEX2D_RTV; + +typedef struct D3D10_TEX2DMS_RTV + { + UINT UnusedField_NothingToDefine; + } D3D10_TEX2DMS_RTV; + +typedef struct D3D10_TEX2D_ARRAY_RTV + { + UINT MipSlice; + UINT FirstArraySlice; + UINT ArraySize; + } D3D10_TEX2D_ARRAY_RTV; + +typedef struct D3D10_TEX2DMS_ARRAY_RTV + { + UINT FirstArraySlice; + UINT ArraySize; + } D3D10_TEX2DMS_ARRAY_RTV; + +typedef struct D3D10_TEX3D_RTV + { + UINT MipSlice; + UINT FirstWSlice; + UINT WSize; + } D3D10_TEX3D_RTV; + +typedef struct D3D10_RENDER_TARGET_VIEW_DESC + { + DXGI_FORMAT Format; + D3D10_RTV_DIMENSION ViewDimension; + union + { + D3D10_BUFFER_RTV Buffer; + D3D10_TEX1D_RTV Texture1D; + D3D10_TEX1D_ARRAY_RTV Texture1DArray; + D3D10_TEX2D_RTV Texture2D; + D3D10_TEX2D_ARRAY_RTV Texture2DArray; + D3D10_TEX2DMS_RTV Texture2DMS; + D3D10_TEX2DMS_ARRAY_RTV Texture2DMSArray; + D3D10_TEX3D_RTV Texture3D; + } ; + } D3D10_RENDER_TARGET_VIEW_DESC; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0011_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0011_v0_0_s_ifspec; + +#ifndef __ID3D10RenderTargetView_INTERFACE_DEFINED__ +#define __ID3D10RenderTargetView_INTERFACE_DEFINED__ + +/* interface ID3D10RenderTargetView */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10RenderTargetView; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9B7E4C08-342C-4106-A19F-4F2704F689F0") + ID3D10RenderTargetView : public ID3D10View + { + public: + virtual void STDMETHODCALLTYPE GetDesc( + /* [annotation] */ + __out D3D10_RENDER_TARGET_VIEW_DESC *pDesc) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D10RenderTargetViewVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10RenderTargetView * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10RenderTargetView * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10RenderTargetView * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D10RenderTargetView * This, + /* [annotation] */ + __out ID3D10Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D10RenderTargetView * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D10RenderTargetView * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D10RenderTargetView * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData); + + void ( STDMETHODCALLTYPE *GetResource )( + ID3D10RenderTargetView * This, + /* [annotation] */ + __out ID3D10Resource **ppResource); + + void ( STDMETHODCALLTYPE *GetDesc )( + ID3D10RenderTargetView * This, + /* [annotation] */ + __out D3D10_RENDER_TARGET_VIEW_DESC *pDesc); + + END_INTERFACE + } ID3D10RenderTargetViewVtbl; + + interface ID3D10RenderTargetView + { + CONST_VTBL struct ID3D10RenderTargetViewVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10RenderTargetView_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10RenderTargetView_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10RenderTargetView_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10RenderTargetView_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D10RenderTargetView_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D10RenderTargetView_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D10RenderTargetView_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D10RenderTargetView_GetResource(This,ppResource) \ + ( (This)->lpVtbl -> GetResource(This,ppResource) ) + + +#define ID3D10RenderTargetView_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10RenderTargetView_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d10_0000_0012 */ +/* [local] */ + +typedef struct D3D10_TEX1D_DSV + { + UINT MipSlice; + } D3D10_TEX1D_DSV; + +typedef struct D3D10_TEX1D_ARRAY_DSV + { + UINT MipSlice; + UINT FirstArraySlice; + UINT ArraySize; + } D3D10_TEX1D_ARRAY_DSV; + +typedef struct D3D10_TEX2D_DSV + { + UINT MipSlice; + } D3D10_TEX2D_DSV; + +typedef struct D3D10_TEX2D_ARRAY_DSV + { + UINT MipSlice; + UINT FirstArraySlice; + UINT ArraySize; + } D3D10_TEX2D_ARRAY_DSV; + +typedef struct D3D10_TEX2DMS_DSV + { + UINT UnusedField_NothingToDefine; + } D3D10_TEX2DMS_DSV; + +typedef struct D3D10_TEX2DMS_ARRAY_DSV + { + UINT FirstArraySlice; + UINT ArraySize; + } D3D10_TEX2DMS_ARRAY_DSV; + +typedef struct D3D10_DEPTH_STENCIL_VIEW_DESC + { + DXGI_FORMAT Format; + D3D10_DSV_DIMENSION ViewDimension; + union + { + D3D10_TEX1D_DSV Texture1D; + D3D10_TEX1D_ARRAY_DSV Texture1DArray; + D3D10_TEX2D_DSV Texture2D; + D3D10_TEX2D_ARRAY_DSV Texture2DArray; + D3D10_TEX2DMS_DSV Texture2DMS; + D3D10_TEX2DMS_ARRAY_DSV Texture2DMSArray; + } ; + } D3D10_DEPTH_STENCIL_VIEW_DESC; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0012_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0012_v0_0_s_ifspec; + +#ifndef __ID3D10DepthStencilView_INTERFACE_DEFINED__ +#define __ID3D10DepthStencilView_INTERFACE_DEFINED__ + +/* interface ID3D10DepthStencilView */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10DepthStencilView; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9B7E4C09-342C-4106-A19F-4F2704F689F0") + ID3D10DepthStencilView : public ID3D10View + { + public: + virtual void STDMETHODCALLTYPE GetDesc( + /* [annotation] */ + __out D3D10_DEPTH_STENCIL_VIEW_DESC *pDesc) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D10DepthStencilViewVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10DepthStencilView * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10DepthStencilView * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10DepthStencilView * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D10DepthStencilView * This, + /* [annotation] */ + __out ID3D10Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D10DepthStencilView * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D10DepthStencilView * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D10DepthStencilView * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData); + + void ( STDMETHODCALLTYPE *GetResource )( + ID3D10DepthStencilView * This, + /* [annotation] */ + __out ID3D10Resource **ppResource); + + void ( STDMETHODCALLTYPE *GetDesc )( + ID3D10DepthStencilView * This, + /* [annotation] */ + __out D3D10_DEPTH_STENCIL_VIEW_DESC *pDesc); + + END_INTERFACE + } ID3D10DepthStencilViewVtbl; + + interface ID3D10DepthStencilView + { + CONST_VTBL struct ID3D10DepthStencilViewVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10DepthStencilView_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10DepthStencilView_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10DepthStencilView_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10DepthStencilView_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D10DepthStencilView_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D10DepthStencilView_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D10DepthStencilView_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D10DepthStencilView_GetResource(This,ppResource) \ + ( (This)->lpVtbl -> GetResource(This,ppResource) ) + + +#define ID3D10DepthStencilView_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10DepthStencilView_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D10VertexShader_INTERFACE_DEFINED__ +#define __ID3D10VertexShader_INTERFACE_DEFINED__ + +/* interface ID3D10VertexShader */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10VertexShader; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9B7E4C0A-342C-4106-A19F-4F2704F689F0") + ID3D10VertexShader : public ID3D10DeviceChild + { + public: + }; + +#else /* C style interface */ + + typedef struct ID3D10VertexShaderVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10VertexShader * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10VertexShader * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10VertexShader * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D10VertexShader * This, + /* [annotation] */ + __out ID3D10Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D10VertexShader * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D10VertexShader * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D10VertexShader * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData); + + END_INTERFACE + } ID3D10VertexShaderVtbl; + + interface ID3D10VertexShader + { + CONST_VTBL struct ID3D10VertexShaderVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10VertexShader_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10VertexShader_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10VertexShader_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10VertexShader_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D10VertexShader_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D10VertexShader_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D10VertexShader_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10VertexShader_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D10GeometryShader_INTERFACE_DEFINED__ +#define __ID3D10GeometryShader_INTERFACE_DEFINED__ + +/* interface ID3D10GeometryShader */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10GeometryShader; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("6316BE88-54CD-4040-AB44-20461BC81F68") + ID3D10GeometryShader : public ID3D10DeviceChild + { + public: + }; + +#else /* C style interface */ + + typedef struct ID3D10GeometryShaderVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10GeometryShader * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10GeometryShader * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10GeometryShader * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D10GeometryShader * This, + /* [annotation] */ + __out ID3D10Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D10GeometryShader * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D10GeometryShader * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D10GeometryShader * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData); + + END_INTERFACE + } ID3D10GeometryShaderVtbl; + + interface ID3D10GeometryShader + { + CONST_VTBL struct ID3D10GeometryShaderVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10GeometryShader_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10GeometryShader_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10GeometryShader_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10GeometryShader_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D10GeometryShader_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D10GeometryShader_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D10GeometryShader_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10GeometryShader_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D10PixelShader_INTERFACE_DEFINED__ +#define __ID3D10PixelShader_INTERFACE_DEFINED__ + +/* interface ID3D10PixelShader */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10PixelShader; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("4968B601-9D00-4cde-8346-8E7F675819B6") + ID3D10PixelShader : public ID3D10DeviceChild + { + public: + }; + +#else /* C style interface */ + + typedef struct ID3D10PixelShaderVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10PixelShader * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10PixelShader * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10PixelShader * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D10PixelShader * This, + /* [annotation] */ + __out ID3D10Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D10PixelShader * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D10PixelShader * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D10PixelShader * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData); + + END_INTERFACE + } ID3D10PixelShaderVtbl; + + interface ID3D10PixelShader + { + CONST_VTBL struct ID3D10PixelShaderVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10PixelShader_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10PixelShader_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10PixelShader_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10PixelShader_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D10PixelShader_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D10PixelShader_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D10PixelShader_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10PixelShader_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D10InputLayout_INTERFACE_DEFINED__ +#define __ID3D10InputLayout_INTERFACE_DEFINED__ + +/* interface ID3D10InputLayout */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10InputLayout; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9B7E4C0B-342C-4106-A19F-4F2704F689F0") + ID3D10InputLayout : public ID3D10DeviceChild + { + public: + }; + +#else /* C style interface */ + + typedef struct ID3D10InputLayoutVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10InputLayout * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10InputLayout * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10InputLayout * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D10InputLayout * This, + /* [annotation] */ + __out ID3D10Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D10InputLayout * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D10InputLayout * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D10InputLayout * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData); + + END_INTERFACE + } ID3D10InputLayoutVtbl; + + interface ID3D10InputLayout + { + CONST_VTBL struct ID3D10InputLayoutVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10InputLayout_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10InputLayout_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10InputLayout_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10InputLayout_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D10InputLayout_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D10InputLayout_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D10InputLayout_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10InputLayout_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d10_0000_0017 */ +/* [local] */ + +typedef +enum D3D10_FILTER + { D3D10_FILTER_MIN_MAG_MIP_POINT = 0, + D3D10_FILTER_MIN_MAG_POINT_MIP_LINEAR = 0x1, + D3D10_FILTER_MIN_POINT_MAG_LINEAR_MIP_POINT = 0x4, + D3D10_FILTER_MIN_POINT_MAG_MIP_LINEAR = 0x5, + D3D10_FILTER_MIN_LINEAR_MAG_MIP_POINT = 0x10, + D3D10_FILTER_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 0x11, + D3D10_FILTER_MIN_MAG_LINEAR_MIP_POINT = 0x14, + D3D10_FILTER_MIN_MAG_MIP_LINEAR = 0x15, + D3D10_FILTER_ANISOTROPIC = 0x55, + D3D10_FILTER_COMPARISON_MIN_MAG_MIP_POINT = 0x80, + D3D10_FILTER_COMPARISON_MIN_MAG_POINT_MIP_LINEAR = 0x81, + D3D10_FILTER_COMPARISON_MIN_POINT_MAG_LINEAR_MIP_POINT = 0x84, + D3D10_FILTER_COMPARISON_MIN_POINT_MAG_MIP_LINEAR = 0x85, + D3D10_FILTER_COMPARISON_MIN_LINEAR_MAG_MIP_POINT = 0x90, + D3D10_FILTER_COMPARISON_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 0x91, + D3D10_FILTER_COMPARISON_MIN_MAG_LINEAR_MIP_POINT = 0x94, + D3D10_FILTER_COMPARISON_MIN_MAG_MIP_LINEAR = 0x95, + D3D10_FILTER_COMPARISON_ANISOTROPIC = 0xd5, + D3D10_FILTER_TEXT_1BIT = 0x80000000 + } D3D10_FILTER; + +typedef +enum D3D10_FILTER_TYPE + { D3D10_FILTER_TYPE_POINT = 0, + D3D10_FILTER_TYPE_LINEAR = 1 + } D3D10_FILTER_TYPE; + +#define D3D10_FILTER_TYPE_MASK ( 0x3 ) + +#define D3D10_MIN_FILTER_SHIFT ( 4 ) + +#define D3D10_MAG_FILTER_SHIFT ( 2 ) + +#define D3D10_MIP_FILTER_SHIFT ( 0 ) + +#define D3D10_COMPARISON_FILTERING_BIT ( 0x80 ) + +#define D3D10_ANISOTROPIC_FILTERING_BIT ( 0x40 ) + +#define D3D10_TEXT_1BIT_BIT ( 0x80000000 ) + +#define D3D10_ENCODE_BASIC_FILTER( min, mag, mip, bComparison ) \ + ( ( D3D10_FILTER ) ( \ + ( ( bComparison ) ? D3D10_COMPARISON_FILTERING_BIT : 0 ) | \ + ( ( ( min ) & D3D10_FILTER_TYPE_MASK ) << D3D10_MIN_FILTER_SHIFT ) | \ + ( ( ( mag ) & D3D10_FILTER_TYPE_MASK ) << D3D10_MAG_FILTER_SHIFT ) | \ + ( ( ( mip ) & D3D10_FILTER_TYPE_MASK ) << D3D10_MIP_FILTER_SHIFT ) ) ) +#define D3D10_ENCODE_ANISOTROPIC_FILTER( bComparison ) \ + ( ( D3D10_FILTER ) ( \ + D3D10_ANISOTROPIC_FILTERING_BIT | \ + D3D10_ENCODE_BASIC_FILTER( D3D10_FILTER_TYPE_LINEAR, \ + D3D10_FILTER_TYPE_LINEAR, \ + D3D10_FILTER_TYPE_LINEAR, \ + bComparison ) ) ) +#define D3D10_DECODE_MIN_FILTER( d3d10Filter ) \ + ( ( D3D10_FILTER_TYPE ) \ + ( ( ( d3d10Filter ) >> D3D10_MIN_FILTER_SHIFT ) & D3D10_FILTER_TYPE_MASK ) ) +#define D3D10_DECODE_MAG_FILTER( d3d10Filter ) \ + ( ( D3D10_FILTER_TYPE ) \ + ( ( ( d3d10Filter ) >> D3D10_MAG_FILTER_SHIFT ) & D3D10_FILTER_TYPE_MASK ) ) +#define D3D10_DECODE_MIP_FILTER( d3d10Filter ) \ + ( ( D3D10_FILTER_TYPE ) \ + ( ( ( d3d10Filter ) >> D3D10_MIP_FILTER_SHIFT ) & D3D10_FILTER_TYPE_MASK ) ) +#define D3D10_DECODE_IS_COMPARISON_FILTER( d3d10Filter ) \ + ( ( d3d10Filter ) & D3D10_COMPARISON_FILTERING_BIT ) +#define D3D10_DECODE_IS_ANISOTROPIC_FILTER( d3d10Filter ) \ + ( ( ( d3d10Filter ) & D3D10_ANISOTROPIC_FILTERING_BIT ) && \ + ( D3D10_FILTER_TYPE_LINEAR == D3D10_DECODE_MIN_FILTER( d3d10Filter ) ) && \ + ( D3D10_FILTER_TYPE_LINEAR == D3D10_DECODE_MAG_FILTER( d3d10Filter ) ) && \ + ( D3D10_FILTER_TYPE_LINEAR == D3D10_DECODE_MIP_FILTER( d3d10Filter ) ) ) +#define D3D10_DECODE_IS_TEXT_1BIT_FILTER( d3d10Filter ) \ + ( ( d3d10Filter ) == D3D10_TEXT_1BIT_BIT ) +typedef +enum D3D10_TEXTURE_ADDRESS_MODE + { D3D10_TEXTURE_ADDRESS_WRAP = 1, + D3D10_TEXTURE_ADDRESS_MIRROR = 2, + D3D10_TEXTURE_ADDRESS_CLAMP = 3, + D3D10_TEXTURE_ADDRESS_BORDER = 4, + D3D10_TEXTURE_ADDRESS_MIRROR_ONCE = 5 + } D3D10_TEXTURE_ADDRESS_MODE; + +typedef struct D3D10_SAMPLER_DESC + { + D3D10_FILTER Filter; + D3D10_TEXTURE_ADDRESS_MODE AddressU; + D3D10_TEXTURE_ADDRESS_MODE AddressV; + D3D10_TEXTURE_ADDRESS_MODE AddressW; + FLOAT MipLODBias; + UINT MaxAnisotropy; + D3D10_COMPARISON_FUNC ComparisonFunc; + FLOAT BorderColor[ 4 ]; + FLOAT MinLOD; + FLOAT MaxLOD; + } D3D10_SAMPLER_DESC; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0017_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0017_v0_0_s_ifspec; + +#ifndef __ID3D10SamplerState_INTERFACE_DEFINED__ +#define __ID3D10SamplerState_INTERFACE_DEFINED__ + +/* interface ID3D10SamplerState */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10SamplerState; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9B7E4C0C-342C-4106-A19F-4F2704F689F0") + ID3D10SamplerState : public ID3D10DeviceChild + { + public: + virtual void STDMETHODCALLTYPE GetDesc( + /* [annotation] */ + __out D3D10_SAMPLER_DESC *pDesc) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D10SamplerStateVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10SamplerState * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10SamplerState * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10SamplerState * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D10SamplerState * This, + /* [annotation] */ + __out ID3D10Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D10SamplerState * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D10SamplerState * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D10SamplerState * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData); + + void ( STDMETHODCALLTYPE *GetDesc )( + ID3D10SamplerState * This, + /* [annotation] */ + __out D3D10_SAMPLER_DESC *pDesc); + + END_INTERFACE + } ID3D10SamplerStateVtbl; + + interface ID3D10SamplerState + { + CONST_VTBL struct ID3D10SamplerStateVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10SamplerState_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10SamplerState_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10SamplerState_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10SamplerState_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D10SamplerState_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D10SamplerState_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D10SamplerState_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D10SamplerState_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10SamplerState_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d10_0000_0018 */ +/* [local] */ + +typedef +enum D3D10_FORMAT_SUPPORT + { D3D10_FORMAT_SUPPORT_BUFFER = 0x1, + D3D10_FORMAT_SUPPORT_IA_VERTEX_BUFFER = 0x2, + D3D10_FORMAT_SUPPORT_IA_INDEX_BUFFER = 0x4, + D3D10_FORMAT_SUPPORT_SO_BUFFER = 0x8, + D3D10_FORMAT_SUPPORT_TEXTURE1D = 0x10, + D3D10_FORMAT_SUPPORT_TEXTURE2D = 0x20, + D3D10_FORMAT_SUPPORT_TEXTURE3D = 0x40, + D3D10_FORMAT_SUPPORT_TEXTURECUBE = 0x80, + D3D10_FORMAT_SUPPORT_SHADER_LOAD = 0x100, + D3D10_FORMAT_SUPPORT_SHADER_SAMPLE = 0x200, + D3D10_FORMAT_SUPPORT_SHADER_SAMPLE_COMPARISON = 0x400, + D3D10_FORMAT_SUPPORT_SHADER_SAMPLE_MONO_TEXT = 0x800, + D3D10_FORMAT_SUPPORT_MIP = 0x1000, + D3D10_FORMAT_SUPPORT_MIP_AUTOGEN = 0x2000, + D3D10_FORMAT_SUPPORT_RENDER_TARGET = 0x4000, + D3D10_FORMAT_SUPPORT_BLENDABLE = 0x8000, + D3D10_FORMAT_SUPPORT_DEPTH_STENCIL = 0x10000, + D3D10_FORMAT_SUPPORT_CPU_LOCKABLE = 0x20000, + D3D10_FORMAT_SUPPORT_MULTISAMPLE_RESOLVE = 0x40000, + D3D10_FORMAT_SUPPORT_DISPLAY = 0x80000, + D3D10_FORMAT_SUPPORT_CAST_WITHIN_BIT_LAYOUT = 0x100000, + D3D10_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET = 0x200000, + D3D10_FORMAT_SUPPORT_MULTISAMPLE_LOAD = 0x400000, + D3D10_FORMAT_SUPPORT_SHADER_GATHER = 0x800000, + D3D10_FORMAT_SUPPORT_BACK_BUFFER_CAST = 0x1000000 + } D3D10_FORMAT_SUPPORT; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0018_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0018_v0_0_s_ifspec; + +#ifndef __ID3D10Asynchronous_INTERFACE_DEFINED__ +#define __ID3D10Asynchronous_INTERFACE_DEFINED__ + +/* interface ID3D10Asynchronous */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10Asynchronous; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9B7E4C0D-342C-4106-A19F-4F2704F689F0") + ID3D10Asynchronous : public ID3D10DeviceChild + { + public: + virtual void STDMETHODCALLTYPE Begin( void) = 0; + + virtual void STDMETHODCALLTYPE End( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetData( + /* [annotation] */ + __out_bcount_opt(DataSize) void *pData, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in UINT GetDataFlags) = 0; + + virtual UINT STDMETHODCALLTYPE GetDataSize( void) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D10AsynchronousVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10Asynchronous * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10Asynchronous * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10Asynchronous * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D10Asynchronous * This, + /* [annotation] */ + __out ID3D10Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D10Asynchronous * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D10Asynchronous * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D10Asynchronous * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData); + + void ( STDMETHODCALLTYPE *Begin )( + ID3D10Asynchronous * This); + + void ( STDMETHODCALLTYPE *End )( + ID3D10Asynchronous * This); + + HRESULT ( STDMETHODCALLTYPE *GetData )( + ID3D10Asynchronous * This, + /* [annotation] */ + __out_bcount_opt(DataSize) void *pData, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in UINT GetDataFlags); + + UINT ( STDMETHODCALLTYPE *GetDataSize )( + ID3D10Asynchronous * This); + + END_INTERFACE + } ID3D10AsynchronousVtbl; + + interface ID3D10Asynchronous + { + CONST_VTBL struct ID3D10AsynchronousVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10Asynchronous_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10Asynchronous_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10Asynchronous_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10Asynchronous_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D10Asynchronous_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D10Asynchronous_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D10Asynchronous_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D10Asynchronous_Begin(This) \ + ( (This)->lpVtbl -> Begin(This) ) + +#define ID3D10Asynchronous_End(This) \ + ( (This)->lpVtbl -> End(This) ) + +#define ID3D10Asynchronous_GetData(This,pData,DataSize,GetDataFlags) \ + ( (This)->lpVtbl -> GetData(This,pData,DataSize,GetDataFlags) ) + +#define ID3D10Asynchronous_GetDataSize(This) \ + ( (This)->lpVtbl -> GetDataSize(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10Asynchronous_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d10_0000_0019 */ +/* [local] */ + +typedef +enum D3D10_ASYNC_GETDATA_FLAG + { D3D10_ASYNC_GETDATA_DONOTFLUSH = 0x1 + } D3D10_ASYNC_GETDATA_FLAG; + +typedef +enum D3D10_QUERY + { D3D10_QUERY_EVENT = 0, + D3D10_QUERY_OCCLUSION = ( D3D10_QUERY_EVENT + 1 ) , + D3D10_QUERY_TIMESTAMP = ( D3D10_QUERY_OCCLUSION + 1 ) , + D3D10_QUERY_TIMESTAMP_DISJOINT = ( D3D10_QUERY_TIMESTAMP + 1 ) , + D3D10_QUERY_PIPELINE_STATISTICS = ( D3D10_QUERY_TIMESTAMP_DISJOINT + 1 ) , + D3D10_QUERY_OCCLUSION_PREDICATE = ( D3D10_QUERY_PIPELINE_STATISTICS + 1 ) , + D3D10_QUERY_SO_STATISTICS = ( D3D10_QUERY_OCCLUSION_PREDICATE + 1 ) , + D3D10_QUERY_SO_OVERFLOW_PREDICATE = ( D3D10_QUERY_SO_STATISTICS + 1 ) + } D3D10_QUERY; + +typedef +enum D3D10_QUERY_MISC_FLAG + { D3D10_QUERY_MISC_PREDICATEHINT = 0x1 + } D3D10_QUERY_MISC_FLAG; + +typedef struct D3D10_QUERY_DESC + { + D3D10_QUERY Query; + UINT MiscFlags; + } D3D10_QUERY_DESC; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0019_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0019_v0_0_s_ifspec; + +#ifndef __ID3D10Query_INTERFACE_DEFINED__ +#define __ID3D10Query_INTERFACE_DEFINED__ + +/* interface ID3D10Query */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10Query; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9B7E4C0E-342C-4106-A19F-4F2704F689F0") + ID3D10Query : public ID3D10Asynchronous + { + public: + virtual void STDMETHODCALLTYPE GetDesc( + /* [annotation] */ + __out D3D10_QUERY_DESC *pDesc) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D10QueryVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10Query * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10Query * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10Query * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D10Query * This, + /* [annotation] */ + __out ID3D10Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D10Query * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D10Query * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D10Query * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData); + + void ( STDMETHODCALLTYPE *Begin )( + ID3D10Query * This); + + void ( STDMETHODCALLTYPE *End )( + ID3D10Query * This); + + HRESULT ( STDMETHODCALLTYPE *GetData )( + ID3D10Query * This, + /* [annotation] */ + __out_bcount_opt(DataSize) void *pData, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in UINT GetDataFlags); + + UINT ( STDMETHODCALLTYPE *GetDataSize )( + ID3D10Query * This); + + void ( STDMETHODCALLTYPE *GetDesc )( + ID3D10Query * This, + /* [annotation] */ + __out D3D10_QUERY_DESC *pDesc); + + END_INTERFACE + } ID3D10QueryVtbl; + + interface ID3D10Query + { + CONST_VTBL struct ID3D10QueryVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10Query_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10Query_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10Query_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10Query_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D10Query_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D10Query_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D10Query_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D10Query_Begin(This) \ + ( (This)->lpVtbl -> Begin(This) ) + +#define ID3D10Query_End(This) \ + ( (This)->lpVtbl -> End(This) ) + +#define ID3D10Query_GetData(This,pData,DataSize,GetDataFlags) \ + ( (This)->lpVtbl -> GetData(This,pData,DataSize,GetDataFlags) ) + +#define ID3D10Query_GetDataSize(This) \ + ( (This)->lpVtbl -> GetDataSize(This) ) + + +#define ID3D10Query_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10Query_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D10Predicate_INTERFACE_DEFINED__ +#define __ID3D10Predicate_INTERFACE_DEFINED__ + +/* interface ID3D10Predicate */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10Predicate; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9B7E4C10-342C-4106-A19F-4F2704F689F0") + ID3D10Predicate : public ID3D10Query + { + public: + }; + +#else /* C style interface */ + + typedef struct ID3D10PredicateVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10Predicate * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10Predicate * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10Predicate * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D10Predicate * This, + /* [annotation] */ + __out ID3D10Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D10Predicate * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D10Predicate * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D10Predicate * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData); + + void ( STDMETHODCALLTYPE *Begin )( + ID3D10Predicate * This); + + void ( STDMETHODCALLTYPE *End )( + ID3D10Predicate * This); + + HRESULT ( STDMETHODCALLTYPE *GetData )( + ID3D10Predicate * This, + /* [annotation] */ + __out_bcount_opt(DataSize) void *pData, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in UINT GetDataFlags); + + UINT ( STDMETHODCALLTYPE *GetDataSize )( + ID3D10Predicate * This); + + void ( STDMETHODCALLTYPE *GetDesc )( + ID3D10Predicate * This, + /* [annotation] */ + __out D3D10_QUERY_DESC *pDesc); + + END_INTERFACE + } ID3D10PredicateVtbl; + + interface ID3D10Predicate + { + CONST_VTBL struct ID3D10PredicateVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10Predicate_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10Predicate_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10Predicate_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10Predicate_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D10Predicate_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D10Predicate_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D10Predicate_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D10Predicate_Begin(This) \ + ( (This)->lpVtbl -> Begin(This) ) + +#define ID3D10Predicate_End(This) \ + ( (This)->lpVtbl -> End(This) ) + +#define ID3D10Predicate_GetData(This,pData,DataSize,GetDataFlags) \ + ( (This)->lpVtbl -> GetData(This,pData,DataSize,GetDataFlags) ) + +#define ID3D10Predicate_GetDataSize(This) \ + ( (This)->lpVtbl -> GetDataSize(This) ) + + +#define ID3D10Predicate_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10Predicate_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d10_0000_0021 */ +/* [local] */ + +typedef struct D3D10_QUERY_DATA_TIMESTAMP_DISJOINT + { + UINT64 Frequency; + BOOL Disjoint; + } D3D10_QUERY_DATA_TIMESTAMP_DISJOINT; + +typedef struct D3D10_QUERY_DATA_PIPELINE_STATISTICS + { + UINT64 IAVertices; + UINT64 IAPrimitives; + UINT64 VSInvocations; + UINT64 GSInvocations; + UINT64 GSPrimitives; + UINT64 CInvocations; + UINT64 CPrimitives; + UINT64 PSInvocations; + } D3D10_QUERY_DATA_PIPELINE_STATISTICS; + +typedef struct D3D10_QUERY_DATA_SO_STATISTICS + { + UINT64 NumPrimitivesWritten; + UINT64 PrimitivesStorageNeeded; + } D3D10_QUERY_DATA_SO_STATISTICS; + +typedef +enum D3D10_COUNTER + { D3D10_COUNTER_GPU_IDLE = 0, + D3D10_COUNTER_VERTEX_PROCESSING = ( D3D10_COUNTER_GPU_IDLE + 1 ) , + D3D10_COUNTER_GEOMETRY_PROCESSING = ( D3D10_COUNTER_VERTEX_PROCESSING + 1 ) , + D3D10_COUNTER_PIXEL_PROCESSING = ( D3D10_COUNTER_GEOMETRY_PROCESSING + 1 ) , + D3D10_COUNTER_OTHER_GPU_PROCESSING = ( D3D10_COUNTER_PIXEL_PROCESSING + 1 ) , + D3D10_COUNTER_HOST_ADAPTER_BANDWIDTH_UTILIZATION = ( D3D10_COUNTER_OTHER_GPU_PROCESSING + 1 ) , + D3D10_COUNTER_LOCAL_VIDMEM_BANDWIDTH_UTILIZATION = ( D3D10_COUNTER_HOST_ADAPTER_BANDWIDTH_UTILIZATION + 1 ) , + D3D10_COUNTER_VERTEX_THROUGHPUT_UTILIZATION = ( D3D10_COUNTER_LOCAL_VIDMEM_BANDWIDTH_UTILIZATION + 1 ) , + D3D10_COUNTER_TRIANGLE_SETUP_THROUGHPUT_UTILIZATION = ( D3D10_COUNTER_VERTEX_THROUGHPUT_UTILIZATION + 1 ) , + D3D10_COUNTER_FILLRATE_THROUGHPUT_UTILIZATION = ( D3D10_COUNTER_TRIANGLE_SETUP_THROUGHPUT_UTILIZATION + 1 ) , + D3D10_COUNTER_VS_MEMORY_LIMITED = ( D3D10_COUNTER_FILLRATE_THROUGHPUT_UTILIZATION + 1 ) , + D3D10_COUNTER_VS_COMPUTATION_LIMITED = ( D3D10_COUNTER_VS_MEMORY_LIMITED + 1 ) , + D3D10_COUNTER_GS_MEMORY_LIMITED = ( D3D10_COUNTER_VS_COMPUTATION_LIMITED + 1 ) , + D3D10_COUNTER_GS_COMPUTATION_LIMITED = ( D3D10_COUNTER_GS_MEMORY_LIMITED + 1 ) , + D3D10_COUNTER_PS_MEMORY_LIMITED = ( D3D10_COUNTER_GS_COMPUTATION_LIMITED + 1 ) , + D3D10_COUNTER_PS_COMPUTATION_LIMITED = ( D3D10_COUNTER_PS_MEMORY_LIMITED + 1 ) , + D3D10_COUNTER_POST_TRANSFORM_CACHE_HIT_RATE = ( D3D10_COUNTER_PS_COMPUTATION_LIMITED + 1 ) , + D3D10_COUNTER_TEXTURE_CACHE_HIT_RATE = ( D3D10_COUNTER_POST_TRANSFORM_CACHE_HIT_RATE + 1 ) , + D3D10_COUNTER_DEVICE_DEPENDENT_0 = 0x40000000 + } D3D10_COUNTER; + +typedef +enum D3D10_COUNTER_TYPE + { D3D10_COUNTER_TYPE_FLOAT32 = 0, + D3D10_COUNTER_TYPE_UINT16 = ( D3D10_COUNTER_TYPE_FLOAT32 + 1 ) , + D3D10_COUNTER_TYPE_UINT32 = ( D3D10_COUNTER_TYPE_UINT16 + 1 ) , + D3D10_COUNTER_TYPE_UINT64 = ( D3D10_COUNTER_TYPE_UINT32 + 1 ) + } D3D10_COUNTER_TYPE; + +typedef struct D3D10_COUNTER_DESC + { + D3D10_COUNTER Counter; + UINT MiscFlags; + } D3D10_COUNTER_DESC; + +typedef struct D3D10_COUNTER_INFO + { + D3D10_COUNTER LastDeviceDependentCounter; + UINT NumSimultaneousCounters; + UINT8 NumDetectableParallelUnits; + } D3D10_COUNTER_INFO; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0021_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0021_v0_0_s_ifspec; + +#ifndef __ID3D10Counter_INTERFACE_DEFINED__ +#define __ID3D10Counter_INTERFACE_DEFINED__ + +/* interface ID3D10Counter */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10Counter; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9B7E4C11-342C-4106-A19F-4F2704F689F0") + ID3D10Counter : public ID3D10Asynchronous + { + public: + virtual void STDMETHODCALLTYPE GetDesc( + /* [annotation] */ + __out D3D10_COUNTER_DESC *pDesc) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D10CounterVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10Counter * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10Counter * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10Counter * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D10Counter * This, + /* [annotation] */ + __out ID3D10Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D10Counter * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D10Counter * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D10Counter * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData); + + void ( STDMETHODCALLTYPE *Begin )( + ID3D10Counter * This); + + void ( STDMETHODCALLTYPE *End )( + ID3D10Counter * This); + + HRESULT ( STDMETHODCALLTYPE *GetData )( + ID3D10Counter * This, + /* [annotation] */ + __out_bcount_opt(DataSize) void *pData, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in UINT GetDataFlags); + + UINT ( STDMETHODCALLTYPE *GetDataSize )( + ID3D10Counter * This); + + void ( STDMETHODCALLTYPE *GetDesc )( + ID3D10Counter * This, + /* [annotation] */ + __out D3D10_COUNTER_DESC *pDesc); + + END_INTERFACE + } ID3D10CounterVtbl; + + interface ID3D10Counter + { + CONST_VTBL struct ID3D10CounterVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10Counter_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10Counter_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10Counter_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10Counter_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D10Counter_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D10Counter_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D10Counter_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D10Counter_Begin(This) \ + ( (This)->lpVtbl -> Begin(This) ) + +#define ID3D10Counter_End(This) \ + ( (This)->lpVtbl -> End(This) ) + +#define ID3D10Counter_GetData(This,pData,DataSize,GetDataFlags) \ + ( (This)->lpVtbl -> GetData(This,pData,DataSize,GetDataFlags) ) + +#define ID3D10Counter_GetDataSize(This) \ + ( (This)->lpVtbl -> GetDataSize(This) ) + + +#define ID3D10Counter_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10Counter_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D10Device_INTERFACE_DEFINED__ +#define __ID3D10Device_INTERFACE_DEFINED__ + +/* interface ID3D10Device */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10Device; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9B7E4C0F-342C-4106-A19F-4F2704F689F0") + ID3D10Device : public IUnknown + { + public: + virtual void STDMETHODCALLTYPE VSSetConstantBuffers( + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + __in_ecount(NumBuffers) ID3D10Buffer *const *ppConstantBuffers) = 0; + + virtual void STDMETHODCALLTYPE PSSetShaderResources( + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* [annotation] */ + __in_ecount(NumViews) ID3D10ShaderResourceView *const *ppShaderResourceViews) = 0; + + virtual void STDMETHODCALLTYPE PSSetShader( + /* [annotation] */ + __in_opt ID3D10PixelShader *pPixelShader) = 0; + + virtual void STDMETHODCALLTYPE PSSetSamplers( + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* [annotation] */ + __in_ecount(NumSamplers) ID3D10SamplerState *const *ppSamplers) = 0; + + virtual void STDMETHODCALLTYPE VSSetShader( + /* [annotation] */ + __in_opt ID3D10VertexShader *pVertexShader) = 0; + + virtual void STDMETHODCALLTYPE DrawIndexed( + /* [annotation] */ + __in UINT IndexCount, + /* [annotation] */ + __in UINT StartIndexLocation, + /* [annotation] */ + __in INT BaseVertexLocation) = 0; + + virtual void STDMETHODCALLTYPE Draw( + /* [annotation] */ + __in UINT VertexCount, + /* [annotation] */ + __in UINT StartVertexLocation) = 0; + + virtual void STDMETHODCALLTYPE PSSetConstantBuffers( + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + __in_ecount(NumBuffers) ID3D10Buffer *const *ppConstantBuffers) = 0; + + virtual void STDMETHODCALLTYPE IASetInputLayout( + /* [annotation] */ + __in_opt ID3D10InputLayout *pInputLayout) = 0; + + virtual void STDMETHODCALLTYPE IASetVertexBuffers( + /* [annotation] */ + __in_range( 0, D3D10_1_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D10_1_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + __in_ecount(NumBuffers) ID3D10Buffer *const *ppVertexBuffers, + /* [annotation] */ + __in_ecount(NumBuffers) const UINT *pStrides, + /* [annotation] */ + __in_ecount(NumBuffers) const UINT *pOffsets) = 0; + + virtual void STDMETHODCALLTYPE IASetIndexBuffer( + /* [annotation] */ + __in_opt ID3D10Buffer *pIndexBuffer, + /* [annotation] */ + __in DXGI_FORMAT Format, + /* [annotation] */ + __in UINT Offset) = 0; + + virtual void STDMETHODCALLTYPE DrawIndexedInstanced( + /* [annotation] */ + __in UINT IndexCountPerInstance, + /* [annotation] */ + __in UINT InstanceCount, + /* [annotation] */ + __in UINT StartIndexLocation, + /* [annotation] */ + __in INT BaseVertexLocation, + /* [annotation] */ + __in UINT StartInstanceLocation) = 0; + + virtual void STDMETHODCALLTYPE DrawInstanced( + /* [annotation] */ + __in UINT VertexCountPerInstance, + /* [annotation] */ + __in UINT InstanceCount, + /* [annotation] */ + __in UINT StartVertexLocation, + /* [annotation] */ + __in UINT StartInstanceLocation) = 0; + + virtual void STDMETHODCALLTYPE GSSetConstantBuffers( + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + __in_ecount(NumBuffers) ID3D10Buffer *const *ppConstantBuffers) = 0; + + virtual void STDMETHODCALLTYPE GSSetShader( + /* [annotation] */ + __in_opt ID3D10GeometryShader *pShader) = 0; + + virtual void STDMETHODCALLTYPE IASetPrimitiveTopology( + /* [annotation] */ + __in D3D10_PRIMITIVE_TOPOLOGY Topology) = 0; + + virtual void STDMETHODCALLTYPE VSSetShaderResources( + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* [annotation] */ + __in_ecount(NumViews) ID3D10ShaderResourceView *const *ppShaderResourceViews) = 0; + + virtual void STDMETHODCALLTYPE VSSetSamplers( + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* [annotation] */ + __in_ecount(NumSamplers) ID3D10SamplerState *const *ppSamplers) = 0; + + virtual void STDMETHODCALLTYPE SetPredication( + /* [annotation] */ + __in_opt ID3D10Predicate *pPredicate, + /* [annotation] */ + __in BOOL PredicateValue) = 0; + + virtual void STDMETHODCALLTYPE GSSetShaderResources( + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* [annotation] */ + __in_ecount(NumViews) ID3D10ShaderResourceView *const *ppShaderResourceViews) = 0; + + virtual void STDMETHODCALLTYPE GSSetSamplers( + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* [annotation] */ + __in_ecount(NumSamplers) ID3D10SamplerState *const *ppSamplers) = 0; + + virtual void STDMETHODCALLTYPE OMSetRenderTargets( + /* [annotation] */ + __in_range( 0, D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT ) UINT NumViews, + /* [annotation] */ + __in_ecount_opt(NumViews) ID3D10RenderTargetView *const *ppRenderTargetViews, + /* [annotation] */ + __in_opt ID3D10DepthStencilView *pDepthStencilView) = 0; + + virtual void STDMETHODCALLTYPE OMSetBlendState( + /* [annotation] */ + __in_opt ID3D10BlendState *pBlendState, + /* [annotation] */ + __in const FLOAT BlendFactor[ 4 ], + /* [annotation] */ + __in UINT SampleMask) = 0; + + virtual void STDMETHODCALLTYPE OMSetDepthStencilState( + /* [annotation] */ + __in_opt ID3D10DepthStencilState *pDepthStencilState, + /* [annotation] */ + __in UINT StencilRef) = 0; + + virtual void STDMETHODCALLTYPE SOSetTargets( + /* [annotation] */ + __in_range( 0, D3D10_SO_BUFFER_SLOT_COUNT) UINT NumBuffers, + /* [annotation] */ + __in_ecount_opt(NumBuffers) ID3D10Buffer *const *ppSOTargets, + /* [annotation] */ + __in_ecount_opt(NumBuffers) const UINT *pOffsets) = 0; + + virtual void STDMETHODCALLTYPE DrawAuto( void) = 0; + + virtual void STDMETHODCALLTYPE RSSetState( + /* [annotation] */ + __in_opt ID3D10RasterizerState *pRasterizerState) = 0; + + virtual void STDMETHODCALLTYPE RSSetViewports( + /* [annotation] */ + __in_range(0, D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT NumViewports, + /* [annotation] */ + __in_ecount_opt(NumViewports) const D3D10_VIEWPORT *pViewports) = 0; + + virtual void STDMETHODCALLTYPE RSSetScissorRects( + /* [annotation] */ + __in_range(0, D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT NumRects, + /* [annotation] */ + __in_ecount_opt(NumRects) const D3D10_RECT *pRects) = 0; + + virtual void STDMETHODCALLTYPE CopySubresourceRegion( + /* [annotation] */ + __in ID3D10Resource *pDstResource, + /* [annotation] */ + __in UINT DstSubresource, + /* [annotation] */ + __in UINT DstX, + /* [annotation] */ + __in UINT DstY, + /* [annotation] */ + __in UINT DstZ, + /* [annotation] */ + __in ID3D10Resource *pSrcResource, + /* [annotation] */ + __in UINT SrcSubresource, + /* [annotation] */ + __in_opt const D3D10_BOX *pSrcBox) = 0; + + virtual void STDMETHODCALLTYPE CopyResource( + /* [annotation] */ + __in ID3D10Resource *pDstResource, + /* [annotation] */ + __in ID3D10Resource *pSrcResource) = 0; + + virtual void STDMETHODCALLTYPE UpdateSubresource( + /* [annotation] */ + __in ID3D10Resource *pDstResource, + /* [annotation] */ + __in UINT DstSubresource, + /* [annotation] */ + __in_opt const D3D10_BOX *pDstBox, + /* [annotation] */ + __in const void *pSrcData, + /* [annotation] */ + __in UINT SrcRowPitch, + /* [annotation] */ + __in UINT SrcDepthPitch) = 0; + + virtual void STDMETHODCALLTYPE ClearRenderTargetView( + /* [annotation] */ + __in ID3D10RenderTargetView *pRenderTargetView, + /* [annotation] */ + __in const FLOAT ColorRGBA[ 4 ]) = 0; + + virtual void STDMETHODCALLTYPE ClearDepthStencilView( + /* [annotation] */ + __in ID3D10DepthStencilView *pDepthStencilView, + /* [annotation] */ + __in UINT ClearFlags, + /* [annotation] */ + __in FLOAT Depth, + /* [annotation] */ + __in UINT8 Stencil) = 0; + + virtual void STDMETHODCALLTYPE GenerateMips( + /* [annotation] */ + __in ID3D10ShaderResourceView *pShaderResourceView) = 0; + + virtual void STDMETHODCALLTYPE ResolveSubresource( + /* [annotation] */ + __in ID3D10Resource *pDstResource, + /* [annotation] */ + __in UINT DstSubresource, + /* [annotation] */ + __in ID3D10Resource *pSrcResource, + /* [annotation] */ + __in UINT SrcSubresource, + /* [annotation] */ + __in DXGI_FORMAT Format) = 0; + + virtual void STDMETHODCALLTYPE VSGetConstantBuffers( + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + __out_ecount(NumBuffers) ID3D10Buffer **ppConstantBuffers) = 0; + + virtual void STDMETHODCALLTYPE PSGetShaderResources( + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* [annotation] */ + __out_ecount(NumViews) ID3D10ShaderResourceView **ppShaderResourceViews) = 0; + + virtual void STDMETHODCALLTYPE PSGetShader( + /* [annotation] */ + __out ID3D10PixelShader **ppPixelShader) = 0; + + virtual void STDMETHODCALLTYPE PSGetSamplers( + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* [annotation] */ + __out_ecount(NumSamplers) ID3D10SamplerState **ppSamplers) = 0; + + virtual void STDMETHODCALLTYPE VSGetShader( + /* [annotation] */ + __out ID3D10VertexShader **ppVertexShader) = 0; + + virtual void STDMETHODCALLTYPE PSGetConstantBuffers( + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + __out_ecount(NumBuffers) ID3D10Buffer **ppConstantBuffers) = 0; + + virtual void STDMETHODCALLTYPE IAGetInputLayout( + /* [annotation] */ + __out ID3D10InputLayout **ppInputLayout) = 0; + + virtual void STDMETHODCALLTYPE IAGetVertexBuffers( + /* [annotation] */ + __in_range( 0, D3D10_1_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D10_1_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + __out_ecount_opt(NumBuffers) ID3D10Buffer **ppVertexBuffers, + /* [annotation] */ + __out_ecount_opt(NumBuffers) UINT *pStrides, + /* [annotation] */ + __out_ecount_opt(NumBuffers) UINT *pOffsets) = 0; + + virtual void STDMETHODCALLTYPE IAGetIndexBuffer( + /* [annotation] */ + __out_opt ID3D10Buffer **pIndexBuffer, + /* [annotation] */ + __out_opt DXGI_FORMAT *Format, + /* [annotation] */ + __out_opt UINT *Offset) = 0; + + virtual void STDMETHODCALLTYPE GSGetConstantBuffers( + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + __out_ecount(NumBuffers) ID3D10Buffer **ppConstantBuffers) = 0; + + virtual void STDMETHODCALLTYPE GSGetShader( + /* [annotation] */ + __out ID3D10GeometryShader **ppGeometryShader) = 0; + + virtual void STDMETHODCALLTYPE IAGetPrimitiveTopology( + /* [annotation] */ + __out D3D10_PRIMITIVE_TOPOLOGY *pTopology) = 0; + + virtual void STDMETHODCALLTYPE VSGetShaderResources( + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* [annotation] */ + __out_ecount(NumViews) ID3D10ShaderResourceView **ppShaderResourceViews) = 0; + + virtual void STDMETHODCALLTYPE VSGetSamplers( + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* [annotation] */ + __out_ecount(NumSamplers) ID3D10SamplerState **ppSamplers) = 0; + + virtual void STDMETHODCALLTYPE GetPredication( + /* [annotation] */ + __out_opt ID3D10Predicate **ppPredicate, + /* [annotation] */ + __out_opt BOOL *pPredicateValue) = 0; + + virtual void STDMETHODCALLTYPE GSGetShaderResources( + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* [annotation] */ + __out_ecount(NumViews) ID3D10ShaderResourceView **ppShaderResourceViews) = 0; + + virtual void STDMETHODCALLTYPE GSGetSamplers( + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* [annotation] */ + __out_ecount(NumSamplers) ID3D10SamplerState **ppSamplers) = 0; + + virtual void STDMETHODCALLTYPE OMGetRenderTargets( + /* [annotation] */ + __in_range( 0, D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT ) UINT NumViews, + /* [annotation] */ + __out_ecount_opt(NumViews) ID3D10RenderTargetView **ppRenderTargetViews, + /* [annotation] */ + __out_opt ID3D10DepthStencilView **ppDepthStencilView) = 0; + + virtual void STDMETHODCALLTYPE OMGetBlendState( + /* [annotation] */ + __out_opt ID3D10BlendState **ppBlendState, + /* [annotation] */ + __out_opt FLOAT BlendFactor[ 4 ], + /* [annotation] */ + __out_opt UINT *pSampleMask) = 0; + + virtual void STDMETHODCALLTYPE OMGetDepthStencilState( + /* [annotation] */ + __out_opt ID3D10DepthStencilState **ppDepthStencilState, + /* [annotation] */ + __out_opt UINT *pStencilRef) = 0; + + virtual void STDMETHODCALLTYPE SOGetTargets( + /* [annotation] */ + __in_range( 0, D3D10_SO_BUFFER_SLOT_COUNT ) UINT NumBuffers, + /* [annotation] */ + __out_ecount_opt(NumBuffers) ID3D10Buffer **ppSOTargets, + /* [annotation] */ + __out_ecount_opt(NumBuffers) UINT *pOffsets) = 0; + + virtual void STDMETHODCALLTYPE RSGetState( + /* [annotation] */ + __out ID3D10RasterizerState **ppRasterizerState) = 0; + + virtual void STDMETHODCALLTYPE RSGetViewports( + /* [annotation] */ + __inout /*_range(0, D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE )*/ UINT *NumViewports, + /* [annotation] */ + __out_ecount_opt(*NumViewports) D3D10_VIEWPORT *pViewports) = 0; + + virtual void STDMETHODCALLTYPE RSGetScissorRects( + /* [annotation] */ + __inout /*_range(0, D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE )*/ UINT *NumRects, + /* [annotation] */ + __out_ecount_opt(*NumRects) D3D10_RECT *pRects) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetDeviceRemovedReason( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetExceptionMode( + UINT RaiseFlags) = 0; + + virtual UINT STDMETHODCALLTYPE GetExceptionMode( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetPrivateData( + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt(*pDataSize) void *pData) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetPrivateData( + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt(DataSize) const void *pData) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface( + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData) = 0; + + virtual void STDMETHODCALLTYPE ClearState( void) = 0; + + virtual void STDMETHODCALLTYPE Flush( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateBuffer( + /* [annotation] */ + __in const D3D10_BUFFER_DESC *pDesc, + /* [annotation] */ + __in_opt const D3D10_SUBRESOURCE_DATA *pInitialData, + /* [annotation] */ + __out_opt ID3D10Buffer **ppBuffer) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateTexture1D( + /* [annotation] */ + __in const D3D10_TEXTURE1D_DESC *pDesc, + /* [annotation] */ + __in_xcount_opt(pDesc->MipLevels * pDesc->ArraySize) const D3D10_SUBRESOURCE_DATA *pInitialData, + /* [annotation] */ + __out ID3D10Texture1D **ppTexture1D) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateTexture2D( + /* [annotation] */ + __in const D3D10_TEXTURE2D_DESC *pDesc, + /* [annotation] */ + __in_xcount_opt(pDesc->MipLevels * pDesc->ArraySize) const D3D10_SUBRESOURCE_DATA *pInitialData, + /* [annotation] */ + __out ID3D10Texture2D **ppTexture2D) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateTexture3D( + /* [annotation] */ + __in const D3D10_TEXTURE3D_DESC *pDesc, + /* [annotation] */ + __in_xcount_opt(pDesc->MipLevels) const D3D10_SUBRESOURCE_DATA *pInitialData, + /* [annotation] */ + __out ID3D10Texture3D **ppTexture3D) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateShaderResourceView( + /* [annotation] */ + __in ID3D10Resource *pResource, + /* [annotation] */ + __in_opt const D3D10_SHADER_RESOURCE_VIEW_DESC *pDesc, + /* [annotation] */ + __out_opt ID3D10ShaderResourceView **ppSRView) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateRenderTargetView( + /* [annotation] */ + __in ID3D10Resource *pResource, + /* [annotation] */ + __in_opt const D3D10_RENDER_TARGET_VIEW_DESC *pDesc, + /* [annotation] */ + __out_opt ID3D10RenderTargetView **ppRTView) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateDepthStencilView( + /* [annotation] */ + __in ID3D10Resource *pResource, + /* [annotation] */ + __in_opt const D3D10_DEPTH_STENCIL_VIEW_DESC *pDesc, + /* [annotation] */ + __out_opt ID3D10DepthStencilView **ppDepthStencilView) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateInputLayout( + /* [annotation] */ + __in_ecount(NumElements) const D3D10_INPUT_ELEMENT_DESC *pInputElementDescs, + /* [annotation] */ + __in_range( 0, D3D10_1_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT ) UINT NumElements, + /* [annotation] */ + __in const void *pShaderBytecodeWithInputSignature, + /* [annotation] */ + __in SIZE_T BytecodeLength, + /* [annotation] */ + __out_opt ID3D10InputLayout **ppInputLayout) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateVertexShader( + /* [annotation] */ + __in const void *pShaderBytecode, + /* [annotation] */ + __in SIZE_T BytecodeLength, + /* [annotation] */ + __out_opt ID3D10VertexShader **ppVertexShader) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateGeometryShader( + /* [annotation] */ + __in const void *pShaderBytecode, + /* [annotation] */ + __in SIZE_T BytecodeLength, + /* [annotation] */ + __out_opt ID3D10GeometryShader **ppGeometryShader) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateGeometryShaderWithStreamOutput( + /* [annotation] */ + __in const void *pShaderBytecode, + /* [annotation] */ + __in SIZE_T BytecodeLength, + /* [annotation] */ + __in_ecount_opt(NumEntries) const D3D10_SO_DECLARATION_ENTRY *pSODeclaration, + /* [annotation] */ + __in_range( 0, D3D10_SO_SINGLE_BUFFER_COMPONENT_LIMIT ) UINT NumEntries, + /* [annotation] */ + __in UINT OutputStreamStride, + /* [annotation] */ + __out_opt ID3D10GeometryShader **ppGeometryShader) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreatePixelShader( + /* [annotation] */ + __in const void *pShaderBytecode, + /* [annotation] */ + __in SIZE_T BytecodeLength, + /* [annotation] */ + __out_opt ID3D10PixelShader **ppPixelShader) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateBlendState( + /* [annotation] */ + __in const D3D10_BLEND_DESC *pBlendStateDesc, + /* [annotation] */ + __out_opt ID3D10BlendState **ppBlendState) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateDepthStencilState( + /* [annotation] */ + __in const D3D10_DEPTH_STENCIL_DESC *pDepthStencilDesc, + /* [annotation] */ + __out_opt ID3D10DepthStencilState **ppDepthStencilState) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateRasterizerState( + /* [annotation] */ + __in const D3D10_RASTERIZER_DESC *pRasterizerDesc, + /* [annotation] */ + __out_opt ID3D10RasterizerState **ppRasterizerState) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateSamplerState( + /* [annotation] */ + __in const D3D10_SAMPLER_DESC *pSamplerDesc, + /* [annotation] */ + __out_opt ID3D10SamplerState **ppSamplerState) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateQuery( + /* [annotation] */ + __in const D3D10_QUERY_DESC *pQueryDesc, + /* [annotation] */ + __out_opt ID3D10Query **ppQuery) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreatePredicate( + /* [annotation] */ + __in const D3D10_QUERY_DESC *pPredicateDesc, + /* [annotation] */ + __out_opt ID3D10Predicate **ppPredicate) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateCounter( + /* [annotation] */ + __in const D3D10_COUNTER_DESC *pCounterDesc, + /* [annotation] */ + __out_opt ID3D10Counter **ppCounter) = 0; + + virtual HRESULT STDMETHODCALLTYPE CheckFormatSupport( + /* [annotation] */ + __in DXGI_FORMAT Format, + /* [annotation] */ + __out UINT *pFormatSupport) = 0; + + virtual HRESULT STDMETHODCALLTYPE CheckMultisampleQualityLevels( + /* [annotation] */ + __in DXGI_FORMAT Format, + /* [annotation] */ + __in UINT SampleCount, + /* [annotation] */ + __out UINT *pNumQualityLevels) = 0; + + virtual void STDMETHODCALLTYPE CheckCounterInfo( + /* [annotation] */ + __out D3D10_COUNTER_INFO *pCounterInfo) = 0; + + virtual HRESULT STDMETHODCALLTYPE CheckCounter( + /* [annotation] */ + __in const D3D10_COUNTER_DESC *pDesc, + /* [annotation] */ + __out D3D10_COUNTER_TYPE *pType, + /* [annotation] */ + __out UINT *pActiveCounters, + /* [annotation] */ + __out_ecount_opt(*pNameLength) LPSTR szName, + /* [annotation] */ + __inout_opt UINT *pNameLength, + /* [annotation] */ + __out_ecount_opt(*pUnitsLength) LPSTR szUnits, + /* [annotation] */ + __inout_opt UINT *pUnitsLength, + /* [annotation] */ + __out_ecount_opt(*pDescriptionLength) LPSTR szDescription, + /* [annotation] */ + __inout_opt UINT *pDescriptionLength) = 0; + + virtual UINT STDMETHODCALLTYPE GetCreationFlags( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE OpenSharedResource( + /* [annotation] */ + __in HANDLE hResource, + /* [annotation] */ + __in REFIID ReturnedInterface, + /* [annotation] */ + __out_opt void **ppResource) = 0; + + virtual void STDMETHODCALLTYPE SetTextFilterSize( + /* [annotation] */ + __in UINT Width, + /* [annotation] */ + __in UINT Height) = 0; + + virtual void STDMETHODCALLTYPE GetTextFilterSize( + /* [annotation] */ + __out_opt UINT *pWidth, + /* [annotation] */ + __out_opt UINT *pHeight) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D10DeviceVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10Device * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10Device * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10Device * This); + + void ( STDMETHODCALLTYPE *VSSetConstantBuffers )( + ID3D10Device * This, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + __in_ecount(NumBuffers) ID3D10Buffer *const *ppConstantBuffers); + + void ( STDMETHODCALLTYPE *PSSetShaderResources )( + ID3D10Device * This, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* [annotation] */ + __in_ecount(NumViews) ID3D10ShaderResourceView *const *ppShaderResourceViews); + + void ( STDMETHODCALLTYPE *PSSetShader )( + ID3D10Device * This, + /* [annotation] */ + __in_opt ID3D10PixelShader *pPixelShader); + + void ( STDMETHODCALLTYPE *PSSetSamplers )( + ID3D10Device * This, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* [annotation] */ + __in_ecount(NumSamplers) ID3D10SamplerState *const *ppSamplers); + + void ( STDMETHODCALLTYPE *VSSetShader )( + ID3D10Device * This, + /* [annotation] */ + __in_opt ID3D10VertexShader *pVertexShader); + + void ( STDMETHODCALLTYPE *DrawIndexed )( + ID3D10Device * This, + /* [annotation] */ + __in UINT IndexCount, + /* [annotation] */ + __in UINT StartIndexLocation, + /* [annotation] */ + __in INT BaseVertexLocation); + + void ( STDMETHODCALLTYPE *Draw )( + ID3D10Device * This, + /* [annotation] */ + __in UINT VertexCount, + /* [annotation] */ + __in UINT StartVertexLocation); + + void ( STDMETHODCALLTYPE *PSSetConstantBuffers )( + ID3D10Device * This, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + __in_ecount(NumBuffers) ID3D10Buffer *const *ppConstantBuffers); + + void ( STDMETHODCALLTYPE *IASetInputLayout )( + ID3D10Device * This, + /* [annotation] */ + __in_opt ID3D10InputLayout *pInputLayout); + + void ( STDMETHODCALLTYPE *IASetVertexBuffers )( + ID3D10Device * This, + /* [annotation] */ + __in_range( 0, D3D10_1_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D10_1_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + __in_ecount(NumBuffers) ID3D10Buffer *const *ppVertexBuffers, + /* [annotation] */ + __in_ecount(NumBuffers) const UINT *pStrides, + /* [annotation] */ + __in_ecount(NumBuffers) const UINT *pOffsets); + + void ( STDMETHODCALLTYPE *IASetIndexBuffer )( + ID3D10Device * This, + /* [annotation] */ + __in_opt ID3D10Buffer *pIndexBuffer, + /* [annotation] */ + __in DXGI_FORMAT Format, + /* [annotation] */ + __in UINT Offset); + + void ( STDMETHODCALLTYPE *DrawIndexedInstanced )( + ID3D10Device * This, + /* [annotation] */ + __in UINT IndexCountPerInstance, + /* [annotation] */ + __in UINT InstanceCount, + /* [annotation] */ + __in UINT StartIndexLocation, + /* [annotation] */ + __in INT BaseVertexLocation, + /* [annotation] */ + __in UINT StartInstanceLocation); + + void ( STDMETHODCALLTYPE *DrawInstanced )( + ID3D10Device * This, + /* [annotation] */ + __in UINT VertexCountPerInstance, + /* [annotation] */ + __in UINT InstanceCount, + /* [annotation] */ + __in UINT StartVertexLocation, + /* [annotation] */ + __in UINT StartInstanceLocation); + + void ( STDMETHODCALLTYPE *GSSetConstantBuffers )( + ID3D10Device * This, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + __in_ecount(NumBuffers) ID3D10Buffer *const *ppConstantBuffers); + + void ( STDMETHODCALLTYPE *GSSetShader )( + ID3D10Device * This, + /* [annotation] */ + __in_opt ID3D10GeometryShader *pShader); + + void ( STDMETHODCALLTYPE *IASetPrimitiveTopology )( + ID3D10Device * This, + /* [annotation] */ + __in D3D10_PRIMITIVE_TOPOLOGY Topology); + + void ( STDMETHODCALLTYPE *VSSetShaderResources )( + ID3D10Device * This, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* [annotation] */ + __in_ecount(NumViews) ID3D10ShaderResourceView *const *ppShaderResourceViews); + + void ( STDMETHODCALLTYPE *VSSetSamplers )( + ID3D10Device * This, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* [annotation] */ + __in_ecount(NumSamplers) ID3D10SamplerState *const *ppSamplers); + + void ( STDMETHODCALLTYPE *SetPredication )( + ID3D10Device * This, + /* [annotation] */ + __in_opt ID3D10Predicate *pPredicate, + /* [annotation] */ + __in BOOL PredicateValue); + + void ( STDMETHODCALLTYPE *GSSetShaderResources )( + ID3D10Device * This, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* [annotation] */ + __in_ecount(NumViews) ID3D10ShaderResourceView *const *ppShaderResourceViews); + + void ( STDMETHODCALLTYPE *GSSetSamplers )( + ID3D10Device * This, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* [annotation] */ + __in_ecount(NumSamplers) ID3D10SamplerState *const *ppSamplers); + + void ( STDMETHODCALLTYPE *OMSetRenderTargets )( + ID3D10Device * This, + /* [annotation] */ + __in_range( 0, D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT ) UINT NumViews, + /* [annotation] */ + __in_ecount_opt(NumViews) ID3D10RenderTargetView *const *ppRenderTargetViews, + /* [annotation] */ + __in_opt ID3D10DepthStencilView *pDepthStencilView); + + void ( STDMETHODCALLTYPE *OMSetBlendState )( + ID3D10Device * This, + /* [annotation] */ + __in_opt ID3D10BlendState *pBlendState, + /* [annotation] */ + __in const FLOAT BlendFactor[ 4 ], + /* [annotation] */ + __in UINT SampleMask); + + void ( STDMETHODCALLTYPE *OMSetDepthStencilState )( + ID3D10Device * This, + /* [annotation] */ + __in_opt ID3D10DepthStencilState *pDepthStencilState, + /* [annotation] */ + __in UINT StencilRef); + + void ( STDMETHODCALLTYPE *SOSetTargets )( + ID3D10Device * This, + /* [annotation] */ + __in_range( 0, D3D10_SO_BUFFER_SLOT_COUNT) UINT NumBuffers, + /* [annotation] */ + __in_ecount_opt(NumBuffers) ID3D10Buffer *const *ppSOTargets, + /* [annotation] */ + __in_ecount_opt(NumBuffers) const UINT *pOffsets); + + void ( STDMETHODCALLTYPE *DrawAuto )( + ID3D10Device * This); + + void ( STDMETHODCALLTYPE *RSSetState )( + ID3D10Device * This, + /* [annotation] */ + __in_opt ID3D10RasterizerState *pRasterizerState); + + void ( STDMETHODCALLTYPE *RSSetViewports )( + ID3D10Device * This, + /* [annotation] */ + __in_range(0, D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT NumViewports, + /* [annotation] */ + __in_ecount_opt(NumViewports) const D3D10_VIEWPORT *pViewports); + + void ( STDMETHODCALLTYPE *RSSetScissorRects )( + ID3D10Device * This, + /* [annotation] */ + __in_range(0, D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT NumRects, + /* [annotation] */ + __in_ecount_opt(NumRects) const D3D10_RECT *pRects); + + void ( STDMETHODCALLTYPE *CopySubresourceRegion )( + ID3D10Device * This, + /* [annotation] */ + __in ID3D10Resource *pDstResource, + /* [annotation] */ + __in UINT DstSubresource, + /* [annotation] */ + __in UINT DstX, + /* [annotation] */ + __in UINT DstY, + /* [annotation] */ + __in UINT DstZ, + /* [annotation] */ + __in ID3D10Resource *pSrcResource, + /* [annotation] */ + __in UINT SrcSubresource, + /* [annotation] */ + __in_opt const D3D10_BOX *pSrcBox); + + void ( STDMETHODCALLTYPE *CopyResource )( + ID3D10Device * This, + /* [annotation] */ + __in ID3D10Resource *pDstResource, + /* [annotation] */ + __in ID3D10Resource *pSrcResource); + + void ( STDMETHODCALLTYPE *UpdateSubresource )( + ID3D10Device * This, + /* [annotation] */ + __in ID3D10Resource *pDstResource, + /* [annotation] */ + __in UINT DstSubresource, + /* [annotation] */ + __in_opt const D3D10_BOX *pDstBox, + /* [annotation] */ + __in const void *pSrcData, + /* [annotation] */ + __in UINT SrcRowPitch, + /* [annotation] */ + __in UINT SrcDepthPitch); + + void ( STDMETHODCALLTYPE *ClearRenderTargetView )( + ID3D10Device * This, + /* [annotation] */ + __in ID3D10RenderTargetView *pRenderTargetView, + /* [annotation] */ + __in const FLOAT ColorRGBA[ 4 ]); + + void ( STDMETHODCALLTYPE *ClearDepthStencilView )( + ID3D10Device * This, + /* [annotation] */ + __in ID3D10DepthStencilView *pDepthStencilView, + /* [annotation] */ + __in UINT ClearFlags, + /* [annotation] */ + __in FLOAT Depth, + /* [annotation] */ + __in UINT8 Stencil); + + void ( STDMETHODCALLTYPE *GenerateMips )( + ID3D10Device * This, + /* [annotation] */ + __in ID3D10ShaderResourceView *pShaderResourceView); + + void ( STDMETHODCALLTYPE *ResolveSubresource )( + ID3D10Device * This, + /* [annotation] */ + __in ID3D10Resource *pDstResource, + /* [annotation] */ + __in UINT DstSubresource, + /* [annotation] */ + __in ID3D10Resource *pSrcResource, + /* [annotation] */ + __in UINT SrcSubresource, + /* [annotation] */ + __in DXGI_FORMAT Format); + + void ( STDMETHODCALLTYPE *VSGetConstantBuffers )( + ID3D10Device * This, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + __out_ecount(NumBuffers) ID3D10Buffer **ppConstantBuffers); + + void ( STDMETHODCALLTYPE *PSGetShaderResources )( + ID3D10Device * This, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* [annotation] */ + __out_ecount(NumViews) ID3D10ShaderResourceView **ppShaderResourceViews); + + void ( STDMETHODCALLTYPE *PSGetShader )( + ID3D10Device * This, + /* [annotation] */ + __out ID3D10PixelShader **ppPixelShader); + + void ( STDMETHODCALLTYPE *PSGetSamplers )( + ID3D10Device * This, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* [annotation] */ + __out_ecount(NumSamplers) ID3D10SamplerState **ppSamplers); + + void ( STDMETHODCALLTYPE *VSGetShader )( + ID3D10Device * This, + /* [annotation] */ + __out ID3D10VertexShader **ppVertexShader); + + void ( STDMETHODCALLTYPE *PSGetConstantBuffers )( + ID3D10Device * This, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + __out_ecount(NumBuffers) ID3D10Buffer **ppConstantBuffers); + + void ( STDMETHODCALLTYPE *IAGetInputLayout )( + ID3D10Device * This, + /* [annotation] */ + __out ID3D10InputLayout **ppInputLayout); + + void ( STDMETHODCALLTYPE *IAGetVertexBuffers )( + ID3D10Device * This, + /* [annotation] */ + __in_range( 0, D3D10_1_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D10_1_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + __out_ecount_opt(NumBuffers) ID3D10Buffer **ppVertexBuffers, + /* [annotation] */ + __out_ecount_opt(NumBuffers) UINT *pStrides, + /* [annotation] */ + __out_ecount_opt(NumBuffers) UINT *pOffsets); + + void ( STDMETHODCALLTYPE *IAGetIndexBuffer )( + ID3D10Device * This, + /* [annotation] */ + __out_opt ID3D10Buffer **pIndexBuffer, + /* [annotation] */ + __out_opt DXGI_FORMAT *Format, + /* [annotation] */ + __out_opt UINT *Offset); + + void ( STDMETHODCALLTYPE *GSGetConstantBuffers )( + ID3D10Device * This, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + __out_ecount(NumBuffers) ID3D10Buffer **ppConstantBuffers); + + void ( STDMETHODCALLTYPE *GSGetShader )( + ID3D10Device * This, + /* [annotation] */ + __out ID3D10GeometryShader **ppGeometryShader); + + void ( STDMETHODCALLTYPE *IAGetPrimitiveTopology )( + ID3D10Device * This, + /* [annotation] */ + __out D3D10_PRIMITIVE_TOPOLOGY *pTopology); + + void ( STDMETHODCALLTYPE *VSGetShaderResources )( + ID3D10Device * This, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* [annotation] */ + __out_ecount(NumViews) ID3D10ShaderResourceView **ppShaderResourceViews); + + void ( STDMETHODCALLTYPE *VSGetSamplers )( + ID3D10Device * This, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* [annotation] */ + __out_ecount(NumSamplers) ID3D10SamplerState **ppSamplers); + + void ( STDMETHODCALLTYPE *GetPredication )( + ID3D10Device * This, + /* [annotation] */ + __out_opt ID3D10Predicate **ppPredicate, + /* [annotation] */ + __out_opt BOOL *pPredicateValue); + + void ( STDMETHODCALLTYPE *GSGetShaderResources )( + ID3D10Device * This, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* [annotation] */ + __out_ecount(NumViews) ID3D10ShaderResourceView **ppShaderResourceViews); + + void ( STDMETHODCALLTYPE *GSGetSamplers )( + ID3D10Device * This, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* [annotation] */ + __out_ecount(NumSamplers) ID3D10SamplerState **ppSamplers); + + void ( STDMETHODCALLTYPE *OMGetRenderTargets )( + ID3D10Device * This, + /* [annotation] */ + __in_range( 0, D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT ) UINT NumViews, + /* [annotation] */ + __out_ecount_opt(NumViews) ID3D10RenderTargetView **ppRenderTargetViews, + /* [annotation] */ + __out_opt ID3D10DepthStencilView **ppDepthStencilView); + + void ( STDMETHODCALLTYPE *OMGetBlendState )( + ID3D10Device * This, + /* [annotation] */ + __out_opt ID3D10BlendState **ppBlendState, + /* [annotation] */ + __out_opt FLOAT BlendFactor[ 4 ], + /* [annotation] */ + __out_opt UINT *pSampleMask); + + void ( STDMETHODCALLTYPE *OMGetDepthStencilState )( + ID3D10Device * This, + /* [annotation] */ + __out_opt ID3D10DepthStencilState **ppDepthStencilState, + /* [annotation] */ + __out_opt UINT *pStencilRef); + + void ( STDMETHODCALLTYPE *SOGetTargets )( + ID3D10Device * This, + /* [annotation] */ + __in_range( 0, D3D10_SO_BUFFER_SLOT_COUNT ) UINT NumBuffers, + /* [annotation] */ + __out_ecount_opt(NumBuffers) ID3D10Buffer **ppSOTargets, + /* [annotation] */ + __out_ecount_opt(NumBuffers) UINT *pOffsets); + + void ( STDMETHODCALLTYPE *RSGetState )( + ID3D10Device * This, + /* [annotation] */ + __out ID3D10RasterizerState **ppRasterizerState); + + void ( STDMETHODCALLTYPE *RSGetViewports )( + ID3D10Device * This, + /* [annotation] */ + __inout /*_range(0, D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE )*/ UINT *NumViewports, + /* [annotation] */ + __out_ecount_opt(*NumViewports) D3D10_VIEWPORT *pViewports); + + void ( STDMETHODCALLTYPE *RSGetScissorRects )( + ID3D10Device * This, + /* [annotation] */ + __inout /*_range(0, D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE )*/ UINT *NumRects, + /* [annotation] */ + __out_ecount_opt(*NumRects) D3D10_RECT *pRects); + + HRESULT ( STDMETHODCALLTYPE *GetDeviceRemovedReason )( + ID3D10Device * This); + + HRESULT ( STDMETHODCALLTYPE *SetExceptionMode )( + ID3D10Device * This, + UINT RaiseFlags); + + UINT ( STDMETHODCALLTYPE *GetExceptionMode )( + ID3D10Device * This); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D10Device * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D10Device * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D10Device * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData); + + void ( STDMETHODCALLTYPE *ClearState )( + ID3D10Device * This); + + void ( STDMETHODCALLTYPE *Flush )( + ID3D10Device * This); + + HRESULT ( STDMETHODCALLTYPE *CreateBuffer )( + ID3D10Device * This, + /* [annotation] */ + __in const D3D10_BUFFER_DESC *pDesc, + /* [annotation] */ + __in_opt const D3D10_SUBRESOURCE_DATA *pInitialData, + /* [annotation] */ + __out_opt ID3D10Buffer **ppBuffer); + + HRESULT ( STDMETHODCALLTYPE *CreateTexture1D )( + ID3D10Device * This, + /* [annotation] */ + __in const D3D10_TEXTURE1D_DESC *pDesc, + /* [annotation] */ + __in_xcount_opt(pDesc->MipLevels * pDesc->ArraySize) const D3D10_SUBRESOURCE_DATA *pInitialData, + /* [annotation] */ + __out ID3D10Texture1D **ppTexture1D); + + HRESULT ( STDMETHODCALLTYPE *CreateTexture2D )( + ID3D10Device * This, + /* [annotation] */ + __in const D3D10_TEXTURE2D_DESC *pDesc, + /* [annotation] */ + __in_xcount_opt(pDesc->MipLevels * pDesc->ArraySize) const D3D10_SUBRESOURCE_DATA *pInitialData, + /* [annotation] */ + __out ID3D10Texture2D **ppTexture2D); + + HRESULT ( STDMETHODCALLTYPE *CreateTexture3D )( + ID3D10Device * This, + /* [annotation] */ + __in const D3D10_TEXTURE3D_DESC *pDesc, + /* [annotation] */ + __in_xcount_opt(pDesc->MipLevels) const D3D10_SUBRESOURCE_DATA *pInitialData, + /* [annotation] */ + __out ID3D10Texture3D **ppTexture3D); + + HRESULT ( STDMETHODCALLTYPE *CreateShaderResourceView )( + ID3D10Device * This, + /* [annotation] */ + __in ID3D10Resource *pResource, + /* [annotation] */ + __in_opt const D3D10_SHADER_RESOURCE_VIEW_DESC *pDesc, + /* [annotation] */ + __out_opt ID3D10ShaderResourceView **ppSRView); + + HRESULT ( STDMETHODCALLTYPE *CreateRenderTargetView )( + ID3D10Device * This, + /* [annotation] */ + __in ID3D10Resource *pResource, + /* [annotation] */ + __in_opt const D3D10_RENDER_TARGET_VIEW_DESC *pDesc, + /* [annotation] */ + __out_opt ID3D10RenderTargetView **ppRTView); + + HRESULT ( STDMETHODCALLTYPE *CreateDepthStencilView )( + ID3D10Device * This, + /* [annotation] */ + __in ID3D10Resource *pResource, + /* [annotation] */ + __in_opt const D3D10_DEPTH_STENCIL_VIEW_DESC *pDesc, + /* [annotation] */ + __out_opt ID3D10DepthStencilView **ppDepthStencilView); + + HRESULT ( STDMETHODCALLTYPE *CreateInputLayout )( + ID3D10Device * This, + /* [annotation] */ + __in_ecount(NumElements) const D3D10_INPUT_ELEMENT_DESC *pInputElementDescs, + /* [annotation] */ + __in_range( 0, D3D10_1_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT ) UINT NumElements, + /* [annotation] */ + __in const void *pShaderBytecodeWithInputSignature, + /* [annotation] */ + __in SIZE_T BytecodeLength, + /* [annotation] */ + __out_opt ID3D10InputLayout **ppInputLayout); + + HRESULT ( STDMETHODCALLTYPE *CreateVertexShader )( + ID3D10Device * This, + /* [annotation] */ + __in const void *pShaderBytecode, + /* [annotation] */ + __in SIZE_T BytecodeLength, + /* [annotation] */ + __out_opt ID3D10VertexShader **ppVertexShader); + + HRESULT ( STDMETHODCALLTYPE *CreateGeometryShader )( + ID3D10Device * This, + /* [annotation] */ + __in const void *pShaderBytecode, + /* [annotation] */ + __in SIZE_T BytecodeLength, + /* [annotation] */ + __out_opt ID3D10GeometryShader **ppGeometryShader); + + HRESULT ( STDMETHODCALLTYPE *CreateGeometryShaderWithStreamOutput )( + ID3D10Device * This, + /* [annotation] */ + __in const void *pShaderBytecode, + /* [annotation] */ + __in SIZE_T BytecodeLength, + /* [annotation] */ + __in_ecount_opt(NumEntries) const D3D10_SO_DECLARATION_ENTRY *pSODeclaration, + /* [annotation] */ + __in_range( 0, D3D10_SO_SINGLE_BUFFER_COMPONENT_LIMIT ) UINT NumEntries, + /* [annotation] */ + __in UINT OutputStreamStride, + /* [annotation] */ + __out_opt ID3D10GeometryShader **ppGeometryShader); + + HRESULT ( STDMETHODCALLTYPE *CreatePixelShader )( + ID3D10Device * This, + /* [annotation] */ + __in const void *pShaderBytecode, + /* [annotation] */ + __in SIZE_T BytecodeLength, + /* [annotation] */ + __out_opt ID3D10PixelShader **ppPixelShader); + + HRESULT ( STDMETHODCALLTYPE *CreateBlendState )( + ID3D10Device * This, + /* [annotation] */ + __in const D3D10_BLEND_DESC *pBlendStateDesc, + /* [annotation] */ + __out_opt ID3D10BlendState **ppBlendState); + + HRESULT ( STDMETHODCALLTYPE *CreateDepthStencilState )( + ID3D10Device * This, + /* [annotation] */ + __in const D3D10_DEPTH_STENCIL_DESC *pDepthStencilDesc, + /* [annotation] */ + __out_opt ID3D10DepthStencilState **ppDepthStencilState); + + HRESULT ( STDMETHODCALLTYPE *CreateRasterizerState )( + ID3D10Device * This, + /* [annotation] */ + __in const D3D10_RASTERIZER_DESC *pRasterizerDesc, + /* [annotation] */ + __out_opt ID3D10RasterizerState **ppRasterizerState); + + HRESULT ( STDMETHODCALLTYPE *CreateSamplerState )( + ID3D10Device * This, + /* [annotation] */ + __in const D3D10_SAMPLER_DESC *pSamplerDesc, + /* [annotation] */ + __out_opt ID3D10SamplerState **ppSamplerState); + + HRESULT ( STDMETHODCALLTYPE *CreateQuery )( + ID3D10Device * This, + /* [annotation] */ + __in const D3D10_QUERY_DESC *pQueryDesc, + /* [annotation] */ + __out_opt ID3D10Query **ppQuery); + + HRESULT ( STDMETHODCALLTYPE *CreatePredicate )( + ID3D10Device * This, + /* [annotation] */ + __in const D3D10_QUERY_DESC *pPredicateDesc, + /* [annotation] */ + __out_opt ID3D10Predicate **ppPredicate); + + HRESULT ( STDMETHODCALLTYPE *CreateCounter )( + ID3D10Device * This, + /* [annotation] */ + __in const D3D10_COUNTER_DESC *pCounterDesc, + /* [annotation] */ + __out_opt ID3D10Counter **ppCounter); + + HRESULT ( STDMETHODCALLTYPE *CheckFormatSupport )( + ID3D10Device * This, + /* [annotation] */ + __in DXGI_FORMAT Format, + /* [annotation] */ + __out UINT *pFormatSupport); + + HRESULT ( STDMETHODCALLTYPE *CheckMultisampleQualityLevels )( + ID3D10Device * This, + /* [annotation] */ + __in DXGI_FORMAT Format, + /* [annotation] */ + __in UINT SampleCount, + /* [annotation] */ + __out UINT *pNumQualityLevels); + + void ( STDMETHODCALLTYPE *CheckCounterInfo )( + ID3D10Device * This, + /* [annotation] */ + __out D3D10_COUNTER_INFO *pCounterInfo); + + HRESULT ( STDMETHODCALLTYPE *CheckCounter )( + ID3D10Device * This, + /* [annotation] */ + __in const D3D10_COUNTER_DESC *pDesc, + /* [annotation] */ + __out D3D10_COUNTER_TYPE *pType, + /* [annotation] */ + __out UINT *pActiveCounters, + /* [annotation] */ + __out_ecount_opt(*pNameLength) LPSTR szName, + /* [annotation] */ + __inout_opt UINT *pNameLength, + /* [annotation] */ + __out_ecount_opt(*pUnitsLength) LPSTR szUnits, + /* [annotation] */ + __inout_opt UINT *pUnitsLength, + /* [annotation] */ + __out_ecount_opt(*pDescriptionLength) LPSTR szDescription, + /* [annotation] */ + __inout_opt UINT *pDescriptionLength); + + UINT ( STDMETHODCALLTYPE *GetCreationFlags )( + ID3D10Device * This); + + HRESULT ( STDMETHODCALLTYPE *OpenSharedResource )( + ID3D10Device * This, + /* [annotation] */ + __in HANDLE hResource, + /* [annotation] */ + __in REFIID ReturnedInterface, + /* [annotation] */ + __out_opt void **ppResource); + + void ( STDMETHODCALLTYPE *SetTextFilterSize )( + ID3D10Device * This, + /* [annotation] */ + __in UINT Width, + /* [annotation] */ + __in UINT Height); + + void ( STDMETHODCALLTYPE *GetTextFilterSize )( + ID3D10Device * This, + /* [annotation] */ + __out_opt UINT *pWidth, + /* [annotation] */ + __out_opt UINT *pHeight); + + END_INTERFACE + } ID3D10DeviceVtbl; + + interface ID3D10Device + { + CONST_VTBL struct ID3D10DeviceVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10Device_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10Device_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10Device_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10Device_VSSetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) \ + ( (This)->lpVtbl -> VSSetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) ) + +#define ID3D10Device_PSSetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) \ + ( (This)->lpVtbl -> PSSetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) ) + +#define ID3D10Device_PSSetShader(This,pPixelShader) \ + ( (This)->lpVtbl -> PSSetShader(This,pPixelShader) ) + +#define ID3D10Device_PSSetSamplers(This,StartSlot,NumSamplers,ppSamplers) \ + ( (This)->lpVtbl -> PSSetSamplers(This,StartSlot,NumSamplers,ppSamplers) ) + +#define ID3D10Device_VSSetShader(This,pVertexShader) \ + ( (This)->lpVtbl -> VSSetShader(This,pVertexShader) ) + +#define ID3D10Device_DrawIndexed(This,IndexCount,StartIndexLocation,BaseVertexLocation) \ + ( (This)->lpVtbl -> DrawIndexed(This,IndexCount,StartIndexLocation,BaseVertexLocation) ) + +#define ID3D10Device_Draw(This,VertexCount,StartVertexLocation) \ + ( (This)->lpVtbl -> Draw(This,VertexCount,StartVertexLocation) ) + +#define ID3D10Device_PSSetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) \ + ( (This)->lpVtbl -> PSSetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) ) + +#define ID3D10Device_IASetInputLayout(This,pInputLayout) \ + ( (This)->lpVtbl -> IASetInputLayout(This,pInputLayout) ) + +#define ID3D10Device_IASetVertexBuffers(This,StartSlot,NumBuffers,ppVertexBuffers,pStrides,pOffsets) \ + ( (This)->lpVtbl -> IASetVertexBuffers(This,StartSlot,NumBuffers,ppVertexBuffers,pStrides,pOffsets) ) + +#define ID3D10Device_IASetIndexBuffer(This,pIndexBuffer,Format,Offset) \ + ( (This)->lpVtbl -> IASetIndexBuffer(This,pIndexBuffer,Format,Offset) ) + +#define ID3D10Device_DrawIndexedInstanced(This,IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) \ + ( (This)->lpVtbl -> DrawIndexedInstanced(This,IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) ) + +#define ID3D10Device_DrawInstanced(This,VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) \ + ( (This)->lpVtbl -> DrawInstanced(This,VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) ) + +#define ID3D10Device_GSSetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) \ + ( (This)->lpVtbl -> GSSetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) ) + +#define ID3D10Device_GSSetShader(This,pShader) \ + ( (This)->lpVtbl -> GSSetShader(This,pShader) ) + +#define ID3D10Device_IASetPrimitiveTopology(This,Topology) \ + ( (This)->lpVtbl -> IASetPrimitiveTopology(This,Topology) ) + +#define ID3D10Device_VSSetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) \ + ( (This)->lpVtbl -> VSSetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) ) + +#define ID3D10Device_VSSetSamplers(This,StartSlot,NumSamplers,ppSamplers) \ + ( (This)->lpVtbl -> VSSetSamplers(This,StartSlot,NumSamplers,ppSamplers) ) + +#define ID3D10Device_SetPredication(This,pPredicate,PredicateValue) \ + ( (This)->lpVtbl -> SetPredication(This,pPredicate,PredicateValue) ) + +#define ID3D10Device_GSSetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) \ + ( (This)->lpVtbl -> GSSetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) ) + +#define ID3D10Device_GSSetSamplers(This,StartSlot,NumSamplers,ppSamplers) \ + ( (This)->lpVtbl -> GSSetSamplers(This,StartSlot,NumSamplers,ppSamplers) ) + +#define ID3D10Device_OMSetRenderTargets(This,NumViews,ppRenderTargetViews,pDepthStencilView) \ + ( (This)->lpVtbl -> OMSetRenderTargets(This,NumViews,ppRenderTargetViews,pDepthStencilView) ) + +#define ID3D10Device_OMSetBlendState(This,pBlendState,BlendFactor,SampleMask) \ + ( (This)->lpVtbl -> OMSetBlendState(This,pBlendState,BlendFactor,SampleMask) ) + +#define ID3D10Device_OMSetDepthStencilState(This,pDepthStencilState,StencilRef) \ + ( (This)->lpVtbl -> OMSetDepthStencilState(This,pDepthStencilState,StencilRef) ) + +#define ID3D10Device_SOSetTargets(This,NumBuffers,ppSOTargets,pOffsets) \ + ( (This)->lpVtbl -> SOSetTargets(This,NumBuffers,ppSOTargets,pOffsets) ) + +#define ID3D10Device_DrawAuto(This) \ + ( (This)->lpVtbl -> DrawAuto(This) ) + +#define ID3D10Device_RSSetState(This,pRasterizerState) \ + ( (This)->lpVtbl -> RSSetState(This,pRasterizerState) ) + +#define ID3D10Device_RSSetViewports(This,NumViewports,pViewports) \ + ( (This)->lpVtbl -> RSSetViewports(This,NumViewports,pViewports) ) + +#define ID3D10Device_RSSetScissorRects(This,NumRects,pRects) \ + ( (This)->lpVtbl -> RSSetScissorRects(This,NumRects,pRects) ) + +#define ID3D10Device_CopySubresourceRegion(This,pDstResource,DstSubresource,DstX,DstY,DstZ,pSrcResource,SrcSubresource,pSrcBox) \ + ( (This)->lpVtbl -> CopySubresourceRegion(This,pDstResource,DstSubresource,DstX,DstY,DstZ,pSrcResource,SrcSubresource,pSrcBox) ) + +#define ID3D10Device_CopyResource(This,pDstResource,pSrcResource) \ + ( (This)->lpVtbl -> CopyResource(This,pDstResource,pSrcResource) ) + +#define ID3D10Device_UpdateSubresource(This,pDstResource,DstSubresource,pDstBox,pSrcData,SrcRowPitch,SrcDepthPitch) \ + ( (This)->lpVtbl -> UpdateSubresource(This,pDstResource,DstSubresource,pDstBox,pSrcData,SrcRowPitch,SrcDepthPitch) ) + +#define ID3D10Device_ClearRenderTargetView(This,pRenderTargetView,ColorRGBA) \ + ( (This)->lpVtbl -> ClearRenderTargetView(This,pRenderTargetView,ColorRGBA) ) + +#define ID3D10Device_ClearDepthStencilView(This,pDepthStencilView,ClearFlags,Depth,Stencil) \ + ( (This)->lpVtbl -> ClearDepthStencilView(This,pDepthStencilView,ClearFlags,Depth,Stencil) ) + +#define ID3D10Device_GenerateMips(This,pShaderResourceView) \ + ( (This)->lpVtbl -> GenerateMips(This,pShaderResourceView) ) + +#define ID3D10Device_ResolveSubresource(This,pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) \ + ( (This)->lpVtbl -> ResolveSubresource(This,pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) ) + +#define ID3D10Device_VSGetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) \ + ( (This)->lpVtbl -> VSGetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) ) + +#define ID3D10Device_PSGetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) \ + ( (This)->lpVtbl -> PSGetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) ) + +#define ID3D10Device_PSGetShader(This,ppPixelShader) \ + ( (This)->lpVtbl -> PSGetShader(This,ppPixelShader) ) + +#define ID3D10Device_PSGetSamplers(This,StartSlot,NumSamplers,ppSamplers) \ + ( (This)->lpVtbl -> PSGetSamplers(This,StartSlot,NumSamplers,ppSamplers) ) + +#define ID3D10Device_VSGetShader(This,ppVertexShader) \ + ( (This)->lpVtbl -> VSGetShader(This,ppVertexShader) ) + +#define ID3D10Device_PSGetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) \ + ( (This)->lpVtbl -> PSGetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) ) + +#define ID3D10Device_IAGetInputLayout(This,ppInputLayout) \ + ( (This)->lpVtbl -> IAGetInputLayout(This,ppInputLayout) ) + +#define ID3D10Device_IAGetVertexBuffers(This,StartSlot,NumBuffers,ppVertexBuffers,pStrides,pOffsets) \ + ( (This)->lpVtbl -> IAGetVertexBuffers(This,StartSlot,NumBuffers,ppVertexBuffers,pStrides,pOffsets) ) + +#define ID3D10Device_IAGetIndexBuffer(This,pIndexBuffer,Format,Offset) \ + ( (This)->lpVtbl -> IAGetIndexBuffer(This,pIndexBuffer,Format,Offset) ) + +#define ID3D10Device_GSGetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) \ + ( (This)->lpVtbl -> GSGetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) ) + +#define ID3D10Device_GSGetShader(This,ppGeometryShader) \ + ( (This)->lpVtbl -> GSGetShader(This,ppGeometryShader) ) + +#define ID3D10Device_IAGetPrimitiveTopology(This,pTopology) \ + ( (This)->lpVtbl -> IAGetPrimitiveTopology(This,pTopology) ) + +#define ID3D10Device_VSGetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) \ + ( (This)->lpVtbl -> VSGetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) ) + +#define ID3D10Device_VSGetSamplers(This,StartSlot,NumSamplers,ppSamplers) \ + ( (This)->lpVtbl -> VSGetSamplers(This,StartSlot,NumSamplers,ppSamplers) ) + +#define ID3D10Device_GetPredication(This,ppPredicate,pPredicateValue) \ + ( (This)->lpVtbl -> GetPredication(This,ppPredicate,pPredicateValue) ) + +#define ID3D10Device_GSGetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) \ + ( (This)->lpVtbl -> GSGetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) ) + +#define ID3D10Device_GSGetSamplers(This,StartSlot,NumSamplers,ppSamplers) \ + ( (This)->lpVtbl -> GSGetSamplers(This,StartSlot,NumSamplers,ppSamplers) ) + +#define ID3D10Device_OMGetRenderTargets(This,NumViews,ppRenderTargetViews,ppDepthStencilView) \ + ( (This)->lpVtbl -> OMGetRenderTargets(This,NumViews,ppRenderTargetViews,ppDepthStencilView) ) + +#define ID3D10Device_OMGetBlendState(This,ppBlendState,BlendFactor,pSampleMask) \ + ( (This)->lpVtbl -> OMGetBlendState(This,ppBlendState,BlendFactor,pSampleMask) ) + +#define ID3D10Device_OMGetDepthStencilState(This,ppDepthStencilState,pStencilRef) \ + ( (This)->lpVtbl -> OMGetDepthStencilState(This,ppDepthStencilState,pStencilRef) ) + +#define ID3D10Device_SOGetTargets(This,NumBuffers,ppSOTargets,pOffsets) \ + ( (This)->lpVtbl -> SOGetTargets(This,NumBuffers,ppSOTargets,pOffsets) ) + +#define ID3D10Device_RSGetState(This,ppRasterizerState) \ + ( (This)->lpVtbl -> RSGetState(This,ppRasterizerState) ) + +#define ID3D10Device_RSGetViewports(This,NumViewports,pViewports) \ + ( (This)->lpVtbl -> RSGetViewports(This,NumViewports,pViewports) ) + +#define ID3D10Device_RSGetScissorRects(This,NumRects,pRects) \ + ( (This)->lpVtbl -> RSGetScissorRects(This,NumRects,pRects) ) + +#define ID3D10Device_GetDeviceRemovedReason(This) \ + ( (This)->lpVtbl -> GetDeviceRemovedReason(This) ) + +#define ID3D10Device_SetExceptionMode(This,RaiseFlags) \ + ( (This)->lpVtbl -> SetExceptionMode(This,RaiseFlags) ) + +#define ID3D10Device_GetExceptionMode(This) \ + ( (This)->lpVtbl -> GetExceptionMode(This) ) + +#define ID3D10Device_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D10Device_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D10Device_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D10Device_ClearState(This) \ + ( (This)->lpVtbl -> ClearState(This) ) + +#define ID3D10Device_Flush(This) \ + ( (This)->lpVtbl -> Flush(This) ) + +#define ID3D10Device_CreateBuffer(This,pDesc,pInitialData,ppBuffer) \ + ( (This)->lpVtbl -> CreateBuffer(This,pDesc,pInitialData,ppBuffer) ) + +#define ID3D10Device_CreateTexture1D(This,pDesc,pInitialData,ppTexture1D) \ + ( (This)->lpVtbl -> CreateTexture1D(This,pDesc,pInitialData,ppTexture1D) ) + +#define ID3D10Device_CreateTexture2D(This,pDesc,pInitialData,ppTexture2D) \ + ( (This)->lpVtbl -> CreateTexture2D(This,pDesc,pInitialData,ppTexture2D) ) + +#define ID3D10Device_CreateTexture3D(This,pDesc,pInitialData,ppTexture3D) \ + ( (This)->lpVtbl -> CreateTexture3D(This,pDesc,pInitialData,ppTexture3D) ) + +#define ID3D10Device_CreateShaderResourceView(This,pResource,pDesc,ppSRView) \ + ( (This)->lpVtbl -> CreateShaderResourceView(This,pResource,pDesc,ppSRView) ) + +#define ID3D10Device_CreateRenderTargetView(This,pResource,pDesc,ppRTView) \ + ( (This)->lpVtbl -> CreateRenderTargetView(This,pResource,pDesc,ppRTView) ) + +#define ID3D10Device_CreateDepthStencilView(This,pResource,pDesc,ppDepthStencilView) \ + ( (This)->lpVtbl -> CreateDepthStencilView(This,pResource,pDesc,ppDepthStencilView) ) + +#define ID3D10Device_CreateInputLayout(This,pInputElementDescs,NumElements,pShaderBytecodeWithInputSignature,BytecodeLength,ppInputLayout) \ + ( (This)->lpVtbl -> CreateInputLayout(This,pInputElementDescs,NumElements,pShaderBytecodeWithInputSignature,BytecodeLength,ppInputLayout) ) + +#define ID3D10Device_CreateVertexShader(This,pShaderBytecode,BytecodeLength,ppVertexShader) \ + ( (This)->lpVtbl -> CreateVertexShader(This,pShaderBytecode,BytecodeLength,ppVertexShader) ) + +#define ID3D10Device_CreateGeometryShader(This,pShaderBytecode,BytecodeLength,ppGeometryShader) \ + ( (This)->lpVtbl -> CreateGeometryShader(This,pShaderBytecode,BytecodeLength,ppGeometryShader) ) + +#define ID3D10Device_CreateGeometryShaderWithStreamOutput(This,pShaderBytecode,BytecodeLength,pSODeclaration,NumEntries,OutputStreamStride,ppGeometryShader) \ + ( (This)->lpVtbl -> CreateGeometryShaderWithStreamOutput(This,pShaderBytecode,BytecodeLength,pSODeclaration,NumEntries,OutputStreamStride,ppGeometryShader) ) + +#define ID3D10Device_CreatePixelShader(This,pShaderBytecode,BytecodeLength,ppPixelShader) \ + ( (This)->lpVtbl -> CreatePixelShader(This,pShaderBytecode,BytecodeLength,ppPixelShader) ) + +#define ID3D10Device_CreateBlendState(This,pBlendStateDesc,ppBlendState) \ + ( (This)->lpVtbl -> CreateBlendState(This,pBlendStateDesc,ppBlendState) ) + +#define ID3D10Device_CreateDepthStencilState(This,pDepthStencilDesc,ppDepthStencilState) \ + ( (This)->lpVtbl -> CreateDepthStencilState(This,pDepthStencilDesc,ppDepthStencilState) ) + +#define ID3D10Device_CreateRasterizerState(This,pRasterizerDesc,ppRasterizerState) \ + ( (This)->lpVtbl -> CreateRasterizerState(This,pRasterizerDesc,ppRasterizerState) ) + +#define ID3D10Device_CreateSamplerState(This,pSamplerDesc,ppSamplerState) \ + ( (This)->lpVtbl -> CreateSamplerState(This,pSamplerDesc,ppSamplerState) ) + +#define ID3D10Device_CreateQuery(This,pQueryDesc,ppQuery) \ + ( (This)->lpVtbl -> CreateQuery(This,pQueryDesc,ppQuery) ) + +#define ID3D10Device_CreatePredicate(This,pPredicateDesc,ppPredicate) \ + ( (This)->lpVtbl -> CreatePredicate(This,pPredicateDesc,ppPredicate) ) + +#define ID3D10Device_CreateCounter(This,pCounterDesc,ppCounter) \ + ( (This)->lpVtbl -> CreateCounter(This,pCounterDesc,ppCounter) ) + +#define ID3D10Device_CheckFormatSupport(This,Format,pFormatSupport) \ + ( (This)->lpVtbl -> CheckFormatSupport(This,Format,pFormatSupport) ) + +#define ID3D10Device_CheckMultisampleQualityLevels(This,Format,SampleCount,pNumQualityLevels) \ + ( (This)->lpVtbl -> CheckMultisampleQualityLevels(This,Format,SampleCount,pNumQualityLevels) ) + +#define ID3D10Device_CheckCounterInfo(This,pCounterInfo) \ + ( (This)->lpVtbl -> CheckCounterInfo(This,pCounterInfo) ) + +#define ID3D10Device_CheckCounter(This,pDesc,pType,pActiveCounters,szName,pNameLength,szUnits,pUnitsLength,szDescription,pDescriptionLength) \ + ( (This)->lpVtbl -> CheckCounter(This,pDesc,pType,pActiveCounters,szName,pNameLength,szUnits,pUnitsLength,szDescription,pDescriptionLength) ) + +#define ID3D10Device_GetCreationFlags(This) \ + ( (This)->lpVtbl -> GetCreationFlags(This) ) + +#define ID3D10Device_OpenSharedResource(This,hResource,ReturnedInterface,ppResource) \ + ( (This)->lpVtbl -> OpenSharedResource(This,hResource,ReturnedInterface,ppResource) ) + +#define ID3D10Device_SetTextFilterSize(This,Width,Height) \ + ( (This)->lpVtbl -> SetTextFilterSize(This,Width,Height) ) + +#define ID3D10Device_GetTextFilterSize(This,pWidth,pHeight) \ + ( (This)->lpVtbl -> GetTextFilterSize(This,pWidth,pHeight) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10Device_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D10Multithread_INTERFACE_DEFINED__ +#define __ID3D10Multithread_INTERFACE_DEFINED__ + +/* interface ID3D10Multithread */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10Multithread; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9B7E4E00-342C-4106-A19F-4F2704F689F0") + ID3D10Multithread : public IUnknown + { + public: + virtual void STDMETHODCALLTYPE Enter( void) = 0; + + virtual void STDMETHODCALLTYPE Leave( void) = 0; + + virtual BOOL STDMETHODCALLTYPE SetMultithreadProtected( + /* [annotation] */ + __in BOOL bMTProtect) = 0; + + virtual BOOL STDMETHODCALLTYPE GetMultithreadProtected( void) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D10MultithreadVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10Multithread * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10Multithread * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10Multithread * This); + + void ( STDMETHODCALLTYPE *Enter )( + ID3D10Multithread * This); + + void ( STDMETHODCALLTYPE *Leave )( + ID3D10Multithread * This); + + BOOL ( STDMETHODCALLTYPE *SetMultithreadProtected )( + ID3D10Multithread * This, + /* [annotation] */ + __in BOOL bMTProtect); + + BOOL ( STDMETHODCALLTYPE *GetMultithreadProtected )( + ID3D10Multithread * This); + + END_INTERFACE + } ID3D10MultithreadVtbl; + + interface ID3D10Multithread + { + CONST_VTBL struct ID3D10MultithreadVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10Multithread_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10Multithread_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10Multithread_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10Multithread_Enter(This) \ + ( (This)->lpVtbl -> Enter(This) ) + +#define ID3D10Multithread_Leave(This) \ + ( (This)->lpVtbl -> Leave(This) ) + +#define ID3D10Multithread_SetMultithreadProtected(This,bMTProtect) \ + ( (This)->lpVtbl -> SetMultithreadProtected(This,bMTProtect) ) + +#define ID3D10Multithread_GetMultithreadProtected(This) \ + ( (This)->lpVtbl -> GetMultithreadProtected(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10Multithread_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d10_0000_0024 */ +/* [local] */ + +typedef +enum D3D10_CREATE_DEVICE_FLAG + { D3D10_CREATE_DEVICE_SINGLETHREADED = 0x1, + D3D10_CREATE_DEVICE_DEBUG = 0x2, + D3D10_CREATE_DEVICE_SWITCH_TO_REF = 0x4, + D3D10_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS = 0x8, + D3D10_CREATE_DEVICE_ALLOW_NULL_FROM_MAP = 0x10, + D3D10_CREATE_DEVICE_BGRA_SUPPORT = 0x20, + D3D10_CREATE_DEVICE_STRICT_VALIDATION = 0x200 + } D3D10_CREATE_DEVICE_FLAG; + + +#define D3D10_SDK_VERSION ( 29 ) + +#if !defined( D3D10_IGNORE_SDK_LAYERS ) +#include "d3d10sdklayers.h" +#endif +#include "d3d10misc.h" +#include "d3d10shader.h" +#include "d3d10effect.h" +DEFINE_GUID(IID_ID3D10DeviceChild,0x9B7E4C00,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); +DEFINE_GUID(IID_ID3D10DepthStencilState,0x2B4B1CC8,0xA4AD,0x41f8,0x83,0x22,0xCA,0x86,0xFC,0x3E,0xC6,0x75); +DEFINE_GUID(IID_ID3D10BlendState,0xEDAD8D19,0x8A35,0x4d6d,0x85,0x66,0x2E,0xA2,0x76,0xCD,0xE1,0x61); +DEFINE_GUID(IID_ID3D10RasterizerState,0xA2A07292,0x89AF,0x4345,0xBE,0x2E,0xC5,0x3D,0x9F,0xBB,0x6E,0x9F); +DEFINE_GUID(IID_ID3D10Resource,0x9B7E4C01,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); +DEFINE_GUID(IID_ID3D10Buffer,0x9B7E4C02,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); +DEFINE_GUID(IID_ID3D10Texture1D,0x9B7E4C03,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); +DEFINE_GUID(IID_ID3D10Texture2D,0x9B7E4C04,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); +DEFINE_GUID(IID_ID3D10Texture3D,0x9B7E4C05,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); +DEFINE_GUID(IID_ID3D10View,0xC902B03F,0x60A7,0x49BA,0x99,0x36,0x2A,0x3A,0xB3,0x7A,0x7E,0x33); +DEFINE_GUID(IID_ID3D10ShaderResourceView,0x9B7E4C07,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); +DEFINE_GUID(IID_ID3D10RenderTargetView,0x9B7E4C08,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); +DEFINE_GUID(IID_ID3D10DepthStencilView,0x9B7E4C09,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); +DEFINE_GUID(IID_ID3D10VertexShader,0x9B7E4C0A,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); +DEFINE_GUID(IID_ID3D10GeometryShader,0x6316BE88,0x54CD,0x4040,0xAB,0x44,0x20,0x46,0x1B,0xC8,0x1F,0x68); +DEFINE_GUID(IID_ID3D10PixelShader,0x4968B601,0x9D00,0x4cde,0x83,0x46,0x8E,0x7F,0x67,0x58,0x19,0xB6); +DEFINE_GUID(IID_ID3D10InputLayout,0x9B7E4C0B,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); +DEFINE_GUID(IID_ID3D10SamplerState,0x9B7E4C0C,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); +DEFINE_GUID(IID_ID3D10Asynchronous,0x9B7E4C0D,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); +DEFINE_GUID(IID_ID3D10Query,0x9B7E4C0E,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); +DEFINE_GUID(IID_ID3D10Predicate,0x9B7E4C10,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); +DEFINE_GUID(IID_ID3D10Counter,0x9B7E4C11,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); +DEFINE_GUID(IID_ID3D10Device,0x9B7E4C0F,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); +DEFINE_GUID(IID_ID3D10Multithread,0x9B7E4E00,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); + + +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0024_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0024_v0_0_s_ifspec; + +/* Additional Prototypes for ALL interfaces */ + +/* end of Additional Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/MediaClient/MediaClient/directx/include/D3D10_1.h b/MediaClient/MediaClient/directx/include/D3D10_1.h new file mode 100644 index 0000000..17a8ec5 --- /dev/null +++ b/MediaClient/MediaClient/directx/include/D3D10_1.h @@ -0,0 +1,1775 @@ + + +/* this ALWAYS GENERATED file contains the definitions for the interfaces */ + + + /* File created by MIDL compiler version 7.00.0555 */ +/* @@MIDL_FILE_HEADING( ) */ + +#pragma warning( disable: 4049 ) /* more than 64k source lines */ + + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCNDR_H_VERSION__ +#define __REQUIRED_RPCNDR_H_VERSION__ 475 +#endif + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCSAL_H_VERSION__ +#define __REQUIRED_RPCSAL_H_VERSION__ 100 +#endif + +#include "rpc.h" +#include "rpcndr.h" + +#ifndef __RPCNDR_H_VERSION__ +#error this stub requires an updated version of +#endif // __RPCNDR_H_VERSION__ + +#ifndef COM_NO_WINDOWS_H +#include "windows.h" +#include "ole2.h" +#endif /*COM_NO_WINDOWS_H*/ + +#ifndef __d3d10_1_h__ +#define __d3d10_1_h__ + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +/* Forward Declarations */ + +#ifndef __ID3D10BlendState1_FWD_DEFINED__ +#define __ID3D10BlendState1_FWD_DEFINED__ +typedef interface ID3D10BlendState1 ID3D10BlendState1; +#endif /* __ID3D10BlendState1_FWD_DEFINED__ */ + + +#ifndef __ID3D10ShaderResourceView1_FWD_DEFINED__ +#define __ID3D10ShaderResourceView1_FWD_DEFINED__ +typedef interface ID3D10ShaderResourceView1 ID3D10ShaderResourceView1; +#endif /* __ID3D10ShaderResourceView1_FWD_DEFINED__ */ + + +#ifndef __ID3D10Device1_FWD_DEFINED__ +#define __ID3D10Device1_FWD_DEFINED__ +typedef interface ID3D10Device1 ID3D10Device1; +#endif /* __ID3D10Device1_FWD_DEFINED__ */ + + +/* header files for imported files */ +#include "oaidl.h" +#include "ocidl.h" + +#ifdef __cplusplus +extern "C"{ +#endif + + +/* interface __MIDL_itf_d3d10_1_0000_0000 */ +/* [local] */ + +#if defined( __d3d10_h__ ) && !defined( D3D10_ARBITRARY_HEADER_ORDERING ) +#error d3d10.h is included before d3d10_1.h, and it will confuse tools that honor SAL annotations. \ +If possibly targeting d3d10.1, include d3d10_1.h instead of d3d10.h, or ensure d3d10_1.h is included before d3d10.h +#endif +#ifndef _D3D10_1_CONSTANTS +#define _D3D10_1_CONSTANTS +#define D3D10_1_DEFAULT_SAMPLE_MASK ( 0xffffffff ) + +#define D3D10_1_FLOAT16_FUSED_TOLERANCE_IN_ULP ( 0.6 ) +#define D3D10_1_FLOAT32_TO_INTEGER_TOLERANCE_IN_ULP ( 0.6f ) +#define D3D10_1_GS_INPUT_REGISTER_COUNT ( 32 ) + +#define D3D10_1_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT ( 32 ) + +#define D3D10_1_IA_VERTEX_INPUT_STRUCTURE_ELEMENTS_COMPONENTS ( 128 ) + +#define D3D10_1_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT ( 32 ) + +#define D3D10_1_PS_OUTPUT_MASK_REGISTER_COMPONENTS ( 1 ) + +#define D3D10_1_PS_OUTPUT_MASK_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D10_1_PS_OUTPUT_MASK_REGISTER_COUNT ( 1 ) + +#define D3D10_1_SHADER_MAJOR_VERSION ( 4 ) + +#define D3D10_1_SHADER_MINOR_VERSION ( 1 ) + +#define D3D10_1_SO_BUFFER_MAX_STRIDE_IN_BYTES ( 2048 ) + +#define D3D10_1_SO_BUFFER_MAX_WRITE_WINDOW_IN_BYTES ( 256 ) + +#define D3D10_1_SO_BUFFER_SLOT_COUNT ( 4 ) + +#define D3D10_1_SO_MULTIPLE_BUFFER_ELEMENTS_PER_BUFFER ( 1 ) + +#define D3D10_1_SO_SINGLE_BUFFER_COMPONENT_LIMIT ( 64 ) + +#define D3D10_1_STANDARD_VERTEX_ELEMENT_COUNT ( 32 ) + +#define D3D10_1_SUBPIXEL_FRACTIONAL_BIT_COUNT ( 8 ) + +#define D3D10_1_VS_INPUT_REGISTER_COUNT ( 32 ) + +#define D3D10_1_VS_OUTPUT_REGISTER_COUNT ( 32 ) + +#endif +#include "d3d10.h" // + +typedef +enum D3D10_FEATURE_LEVEL1 + { D3D10_FEATURE_LEVEL_10_0 = 0xa000, + D3D10_FEATURE_LEVEL_10_1 = 0xa100, + D3D10_FEATURE_LEVEL_9_1 = 0x9100, + D3D10_FEATURE_LEVEL_9_2 = 0x9200, + D3D10_FEATURE_LEVEL_9_3 = 0x9300 + } D3D10_FEATURE_LEVEL1; + +typedef struct D3D10_RENDER_TARGET_BLEND_DESC1 + { + BOOL BlendEnable; + D3D10_BLEND SrcBlend; + D3D10_BLEND DestBlend; + D3D10_BLEND_OP BlendOp; + D3D10_BLEND SrcBlendAlpha; + D3D10_BLEND DestBlendAlpha; + D3D10_BLEND_OP BlendOpAlpha; + UINT8 RenderTargetWriteMask; + } D3D10_RENDER_TARGET_BLEND_DESC1; + +typedef struct D3D10_BLEND_DESC1 + { + BOOL AlphaToCoverageEnable; + BOOL IndependentBlendEnable; + D3D10_RENDER_TARGET_BLEND_DESC1 RenderTarget[ 8 ]; + } D3D10_BLEND_DESC1; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d10_1_0000_0000_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d10_1_0000_0000_v0_0_s_ifspec; + +#ifndef __ID3D10BlendState1_INTERFACE_DEFINED__ +#define __ID3D10BlendState1_INTERFACE_DEFINED__ + +/* interface ID3D10BlendState1 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10BlendState1; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("EDAD8D99-8A35-4d6d-8566-2EA276CDE161") + ID3D10BlendState1 : public ID3D10BlendState + { + public: + virtual void STDMETHODCALLTYPE GetDesc1( + /* [annotation] */ + __out D3D10_BLEND_DESC1 *pDesc) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D10BlendState1Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10BlendState1 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10BlendState1 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10BlendState1 * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D10BlendState1 * This, + /* [annotation] */ + __out ID3D10Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D10BlendState1 * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D10BlendState1 * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D10BlendState1 * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData); + + void ( STDMETHODCALLTYPE *GetDesc )( + ID3D10BlendState1 * This, + /* [annotation] */ + __out D3D10_BLEND_DESC *pDesc); + + void ( STDMETHODCALLTYPE *GetDesc1 )( + ID3D10BlendState1 * This, + /* [annotation] */ + __out D3D10_BLEND_DESC1 *pDesc); + + END_INTERFACE + } ID3D10BlendState1Vtbl; + + interface ID3D10BlendState1 + { + CONST_VTBL struct ID3D10BlendState1Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10BlendState1_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10BlendState1_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10BlendState1_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10BlendState1_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D10BlendState1_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D10BlendState1_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D10BlendState1_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D10BlendState1_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + + +#define ID3D10BlendState1_GetDesc1(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc1(This,pDesc) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10BlendState1_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d10_1_0000_0001 */ +/* [local] */ + +typedef struct D3D10_TEXCUBE_ARRAY_SRV1 + { + UINT MostDetailedMip; + UINT MipLevels; + UINT First2DArrayFace; + UINT NumCubes; + } D3D10_TEXCUBE_ARRAY_SRV1; + +typedef D3D_SRV_DIMENSION D3D10_SRV_DIMENSION1; + +typedef struct D3D10_SHADER_RESOURCE_VIEW_DESC1 + { + DXGI_FORMAT Format; + D3D10_SRV_DIMENSION1 ViewDimension; + union + { + D3D10_BUFFER_SRV Buffer; + D3D10_TEX1D_SRV Texture1D; + D3D10_TEX1D_ARRAY_SRV Texture1DArray; + D3D10_TEX2D_SRV Texture2D; + D3D10_TEX2D_ARRAY_SRV Texture2DArray; + D3D10_TEX2DMS_SRV Texture2DMS; + D3D10_TEX2DMS_ARRAY_SRV Texture2DMSArray; + D3D10_TEX3D_SRV Texture3D; + D3D10_TEXCUBE_SRV TextureCube; + D3D10_TEXCUBE_ARRAY_SRV1 TextureCubeArray; + } ; + } D3D10_SHADER_RESOURCE_VIEW_DESC1; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d10_1_0000_0001_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d10_1_0000_0001_v0_0_s_ifspec; + +#ifndef __ID3D10ShaderResourceView1_INTERFACE_DEFINED__ +#define __ID3D10ShaderResourceView1_INTERFACE_DEFINED__ + +/* interface ID3D10ShaderResourceView1 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10ShaderResourceView1; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9B7E4C87-342C-4106-A19F-4F2704F689F0") + ID3D10ShaderResourceView1 : public ID3D10ShaderResourceView + { + public: + virtual void STDMETHODCALLTYPE GetDesc1( + /* [annotation] */ + __out D3D10_SHADER_RESOURCE_VIEW_DESC1 *pDesc) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D10ShaderResourceView1Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10ShaderResourceView1 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10ShaderResourceView1 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10ShaderResourceView1 * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D10ShaderResourceView1 * This, + /* [annotation] */ + __out ID3D10Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D10ShaderResourceView1 * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D10ShaderResourceView1 * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D10ShaderResourceView1 * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData); + + void ( STDMETHODCALLTYPE *GetResource )( + ID3D10ShaderResourceView1 * This, + /* [annotation] */ + __out ID3D10Resource **ppResource); + + void ( STDMETHODCALLTYPE *GetDesc )( + ID3D10ShaderResourceView1 * This, + /* [annotation] */ + __out D3D10_SHADER_RESOURCE_VIEW_DESC *pDesc); + + void ( STDMETHODCALLTYPE *GetDesc1 )( + ID3D10ShaderResourceView1 * This, + /* [annotation] */ + __out D3D10_SHADER_RESOURCE_VIEW_DESC1 *pDesc); + + END_INTERFACE + } ID3D10ShaderResourceView1Vtbl; + + interface ID3D10ShaderResourceView1 + { + CONST_VTBL struct ID3D10ShaderResourceView1Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10ShaderResourceView1_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10ShaderResourceView1_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10ShaderResourceView1_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10ShaderResourceView1_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D10ShaderResourceView1_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D10ShaderResourceView1_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D10ShaderResourceView1_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D10ShaderResourceView1_GetResource(This,ppResource) \ + ( (This)->lpVtbl -> GetResource(This,ppResource) ) + + +#define ID3D10ShaderResourceView1_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + + +#define ID3D10ShaderResourceView1_GetDesc1(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc1(This,pDesc) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10ShaderResourceView1_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d10_1_0000_0002 */ +/* [local] */ + +typedef +enum D3D10_STANDARD_MULTISAMPLE_QUALITY_LEVELS + { D3D10_STANDARD_MULTISAMPLE_PATTERN = 0xffffffff, + D3D10_CENTER_MULTISAMPLE_PATTERN = 0xfffffffe + } D3D10_STANDARD_MULTISAMPLE_QUALITY_LEVELS; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d10_1_0000_0002_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d10_1_0000_0002_v0_0_s_ifspec; + +#ifndef __ID3D10Device1_INTERFACE_DEFINED__ +#define __ID3D10Device1_INTERFACE_DEFINED__ + +/* interface ID3D10Device1 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10Device1; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9B7E4C8F-342C-4106-A19F-4F2704F689F0") + ID3D10Device1 : public ID3D10Device + { + public: + virtual HRESULT STDMETHODCALLTYPE CreateShaderResourceView1( + /* [annotation] */ + __in ID3D10Resource *pResource, + /* [annotation] */ + __in_opt const D3D10_SHADER_RESOURCE_VIEW_DESC1 *pDesc, + /* [annotation] */ + __out_opt ID3D10ShaderResourceView1 **ppSRView) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateBlendState1( + /* [annotation] */ + __in const D3D10_BLEND_DESC1 *pBlendStateDesc, + /* [annotation] */ + __out_opt ID3D10BlendState1 **ppBlendState) = 0; + + virtual D3D10_FEATURE_LEVEL1 STDMETHODCALLTYPE GetFeatureLevel( void) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D10Device1Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10Device1 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10Device1 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10Device1 * This); + + void ( STDMETHODCALLTYPE *VSSetConstantBuffers )( + ID3D10Device1 * This, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + __in_ecount(NumBuffers) ID3D10Buffer *const *ppConstantBuffers); + + void ( STDMETHODCALLTYPE *PSSetShaderResources )( + ID3D10Device1 * This, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* [annotation] */ + __in_ecount(NumViews) ID3D10ShaderResourceView *const *ppShaderResourceViews); + + void ( STDMETHODCALLTYPE *PSSetShader )( + ID3D10Device1 * This, + /* [annotation] */ + __in_opt ID3D10PixelShader *pPixelShader); + + void ( STDMETHODCALLTYPE *PSSetSamplers )( + ID3D10Device1 * This, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* [annotation] */ + __in_ecount(NumSamplers) ID3D10SamplerState *const *ppSamplers); + + void ( STDMETHODCALLTYPE *VSSetShader )( + ID3D10Device1 * This, + /* [annotation] */ + __in_opt ID3D10VertexShader *pVertexShader); + + void ( STDMETHODCALLTYPE *DrawIndexed )( + ID3D10Device1 * This, + /* [annotation] */ + __in UINT IndexCount, + /* [annotation] */ + __in UINT StartIndexLocation, + /* [annotation] */ + __in INT BaseVertexLocation); + + void ( STDMETHODCALLTYPE *Draw )( + ID3D10Device1 * This, + /* [annotation] */ + __in UINT VertexCount, + /* [annotation] */ + __in UINT StartVertexLocation); + + void ( STDMETHODCALLTYPE *PSSetConstantBuffers )( + ID3D10Device1 * This, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + __in_ecount(NumBuffers) ID3D10Buffer *const *ppConstantBuffers); + + void ( STDMETHODCALLTYPE *IASetInputLayout )( + ID3D10Device1 * This, + /* [annotation] */ + __in_opt ID3D10InputLayout *pInputLayout); + + void ( STDMETHODCALLTYPE *IASetVertexBuffers )( + ID3D10Device1 * This, + /* [annotation] */ + __in_range( 0, D3D10_1_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D10_1_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + __in_ecount(NumBuffers) ID3D10Buffer *const *ppVertexBuffers, + /* [annotation] */ + __in_ecount(NumBuffers) const UINT *pStrides, + /* [annotation] */ + __in_ecount(NumBuffers) const UINT *pOffsets); + + void ( STDMETHODCALLTYPE *IASetIndexBuffer )( + ID3D10Device1 * This, + /* [annotation] */ + __in_opt ID3D10Buffer *pIndexBuffer, + /* [annotation] */ + __in DXGI_FORMAT Format, + /* [annotation] */ + __in UINT Offset); + + void ( STDMETHODCALLTYPE *DrawIndexedInstanced )( + ID3D10Device1 * This, + /* [annotation] */ + __in UINT IndexCountPerInstance, + /* [annotation] */ + __in UINT InstanceCount, + /* [annotation] */ + __in UINT StartIndexLocation, + /* [annotation] */ + __in INT BaseVertexLocation, + /* [annotation] */ + __in UINT StartInstanceLocation); + + void ( STDMETHODCALLTYPE *DrawInstanced )( + ID3D10Device1 * This, + /* [annotation] */ + __in UINT VertexCountPerInstance, + /* [annotation] */ + __in UINT InstanceCount, + /* [annotation] */ + __in UINT StartVertexLocation, + /* [annotation] */ + __in UINT StartInstanceLocation); + + void ( STDMETHODCALLTYPE *GSSetConstantBuffers )( + ID3D10Device1 * This, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + __in_ecount(NumBuffers) ID3D10Buffer *const *ppConstantBuffers); + + void ( STDMETHODCALLTYPE *GSSetShader )( + ID3D10Device1 * This, + /* [annotation] */ + __in_opt ID3D10GeometryShader *pShader); + + void ( STDMETHODCALLTYPE *IASetPrimitiveTopology )( + ID3D10Device1 * This, + /* [annotation] */ + __in D3D10_PRIMITIVE_TOPOLOGY Topology); + + void ( STDMETHODCALLTYPE *VSSetShaderResources )( + ID3D10Device1 * This, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* [annotation] */ + __in_ecount(NumViews) ID3D10ShaderResourceView *const *ppShaderResourceViews); + + void ( STDMETHODCALLTYPE *VSSetSamplers )( + ID3D10Device1 * This, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* [annotation] */ + __in_ecount(NumSamplers) ID3D10SamplerState *const *ppSamplers); + + void ( STDMETHODCALLTYPE *SetPredication )( + ID3D10Device1 * This, + /* [annotation] */ + __in_opt ID3D10Predicate *pPredicate, + /* [annotation] */ + __in BOOL PredicateValue); + + void ( STDMETHODCALLTYPE *GSSetShaderResources )( + ID3D10Device1 * This, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* [annotation] */ + __in_ecount(NumViews) ID3D10ShaderResourceView *const *ppShaderResourceViews); + + void ( STDMETHODCALLTYPE *GSSetSamplers )( + ID3D10Device1 * This, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* [annotation] */ + __in_ecount(NumSamplers) ID3D10SamplerState *const *ppSamplers); + + void ( STDMETHODCALLTYPE *OMSetRenderTargets )( + ID3D10Device1 * This, + /* [annotation] */ + __in_range( 0, D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT ) UINT NumViews, + /* [annotation] */ + __in_ecount_opt(NumViews) ID3D10RenderTargetView *const *ppRenderTargetViews, + /* [annotation] */ + __in_opt ID3D10DepthStencilView *pDepthStencilView); + + void ( STDMETHODCALLTYPE *OMSetBlendState )( + ID3D10Device1 * This, + /* [annotation] */ + __in_opt ID3D10BlendState *pBlendState, + /* [annotation] */ + __in const FLOAT BlendFactor[ 4 ], + /* [annotation] */ + __in UINT SampleMask); + + void ( STDMETHODCALLTYPE *OMSetDepthStencilState )( + ID3D10Device1 * This, + /* [annotation] */ + __in_opt ID3D10DepthStencilState *pDepthStencilState, + /* [annotation] */ + __in UINT StencilRef); + + void ( STDMETHODCALLTYPE *SOSetTargets )( + ID3D10Device1 * This, + /* [annotation] */ + __in_range( 0, D3D10_SO_BUFFER_SLOT_COUNT) UINT NumBuffers, + /* [annotation] */ + __in_ecount_opt(NumBuffers) ID3D10Buffer *const *ppSOTargets, + /* [annotation] */ + __in_ecount_opt(NumBuffers) const UINT *pOffsets); + + void ( STDMETHODCALLTYPE *DrawAuto )( + ID3D10Device1 * This); + + void ( STDMETHODCALLTYPE *RSSetState )( + ID3D10Device1 * This, + /* [annotation] */ + __in_opt ID3D10RasterizerState *pRasterizerState); + + void ( STDMETHODCALLTYPE *RSSetViewports )( + ID3D10Device1 * This, + /* [annotation] */ + __in_range(0, D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT NumViewports, + /* [annotation] */ + __in_ecount_opt(NumViewports) const D3D10_VIEWPORT *pViewports); + + void ( STDMETHODCALLTYPE *RSSetScissorRects )( + ID3D10Device1 * This, + /* [annotation] */ + __in_range(0, D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT NumRects, + /* [annotation] */ + __in_ecount_opt(NumRects) const D3D10_RECT *pRects); + + void ( STDMETHODCALLTYPE *CopySubresourceRegion )( + ID3D10Device1 * This, + /* [annotation] */ + __in ID3D10Resource *pDstResource, + /* [annotation] */ + __in UINT DstSubresource, + /* [annotation] */ + __in UINT DstX, + /* [annotation] */ + __in UINT DstY, + /* [annotation] */ + __in UINT DstZ, + /* [annotation] */ + __in ID3D10Resource *pSrcResource, + /* [annotation] */ + __in UINT SrcSubresource, + /* [annotation] */ + __in_opt const D3D10_BOX *pSrcBox); + + void ( STDMETHODCALLTYPE *CopyResource )( + ID3D10Device1 * This, + /* [annotation] */ + __in ID3D10Resource *pDstResource, + /* [annotation] */ + __in ID3D10Resource *pSrcResource); + + void ( STDMETHODCALLTYPE *UpdateSubresource )( + ID3D10Device1 * This, + /* [annotation] */ + __in ID3D10Resource *pDstResource, + /* [annotation] */ + __in UINT DstSubresource, + /* [annotation] */ + __in_opt const D3D10_BOX *pDstBox, + /* [annotation] */ + __in const void *pSrcData, + /* [annotation] */ + __in UINT SrcRowPitch, + /* [annotation] */ + __in UINT SrcDepthPitch); + + void ( STDMETHODCALLTYPE *ClearRenderTargetView )( + ID3D10Device1 * This, + /* [annotation] */ + __in ID3D10RenderTargetView *pRenderTargetView, + /* [annotation] */ + __in const FLOAT ColorRGBA[ 4 ]); + + void ( STDMETHODCALLTYPE *ClearDepthStencilView )( + ID3D10Device1 * This, + /* [annotation] */ + __in ID3D10DepthStencilView *pDepthStencilView, + /* [annotation] */ + __in UINT ClearFlags, + /* [annotation] */ + __in FLOAT Depth, + /* [annotation] */ + __in UINT8 Stencil); + + void ( STDMETHODCALLTYPE *GenerateMips )( + ID3D10Device1 * This, + /* [annotation] */ + __in ID3D10ShaderResourceView *pShaderResourceView); + + void ( STDMETHODCALLTYPE *ResolveSubresource )( + ID3D10Device1 * This, + /* [annotation] */ + __in ID3D10Resource *pDstResource, + /* [annotation] */ + __in UINT DstSubresource, + /* [annotation] */ + __in ID3D10Resource *pSrcResource, + /* [annotation] */ + __in UINT SrcSubresource, + /* [annotation] */ + __in DXGI_FORMAT Format); + + void ( STDMETHODCALLTYPE *VSGetConstantBuffers )( + ID3D10Device1 * This, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + __out_ecount(NumBuffers) ID3D10Buffer **ppConstantBuffers); + + void ( STDMETHODCALLTYPE *PSGetShaderResources )( + ID3D10Device1 * This, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* [annotation] */ + __out_ecount(NumViews) ID3D10ShaderResourceView **ppShaderResourceViews); + + void ( STDMETHODCALLTYPE *PSGetShader )( + ID3D10Device1 * This, + /* [annotation] */ + __out ID3D10PixelShader **ppPixelShader); + + void ( STDMETHODCALLTYPE *PSGetSamplers )( + ID3D10Device1 * This, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* [annotation] */ + __out_ecount(NumSamplers) ID3D10SamplerState **ppSamplers); + + void ( STDMETHODCALLTYPE *VSGetShader )( + ID3D10Device1 * This, + /* [annotation] */ + __out ID3D10VertexShader **ppVertexShader); + + void ( STDMETHODCALLTYPE *PSGetConstantBuffers )( + ID3D10Device1 * This, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + __out_ecount(NumBuffers) ID3D10Buffer **ppConstantBuffers); + + void ( STDMETHODCALLTYPE *IAGetInputLayout )( + ID3D10Device1 * This, + /* [annotation] */ + __out ID3D10InputLayout **ppInputLayout); + + void ( STDMETHODCALLTYPE *IAGetVertexBuffers )( + ID3D10Device1 * This, + /* [annotation] */ + __in_range( 0, D3D10_1_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D10_1_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + __out_ecount_opt(NumBuffers) ID3D10Buffer **ppVertexBuffers, + /* [annotation] */ + __out_ecount_opt(NumBuffers) UINT *pStrides, + /* [annotation] */ + __out_ecount_opt(NumBuffers) UINT *pOffsets); + + void ( STDMETHODCALLTYPE *IAGetIndexBuffer )( + ID3D10Device1 * This, + /* [annotation] */ + __out_opt ID3D10Buffer **pIndexBuffer, + /* [annotation] */ + __out_opt DXGI_FORMAT *Format, + /* [annotation] */ + __out_opt UINT *Offset); + + void ( STDMETHODCALLTYPE *GSGetConstantBuffers )( + ID3D10Device1 * This, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + __out_ecount(NumBuffers) ID3D10Buffer **ppConstantBuffers); + + void ( STDMETHODCALLTYPE *GSGetShader )( + ID3D10Device1 * This, + /* [annotation] */ + __out ID3D10GeometryShader **ppGeometryShader); + + void ( STDMETHODCALLTYPE *IAGetPrimitiveTopology )( + ID3D10Device1 * This, + /* [annotation] */ + __out D3D10_PRIMITIVE_TOPOLOGY *pTopology); + + void ( STDMETHODCALLTYPE *VSGetShaderResources )( + ID3D10Device1 * This, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* [annotation] */ + __out_ecount(NumViews) ID3D10ShaderResourceView **ppShaderResourceViews); + + void ( STDMETHODCALLTYPE *VSGetSamplers )( + ID3D10Device1 * This, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* [annotation] */ + __out_ecount(NumSamplers) ID3D10SamplerState **ppSamplers); + + void ( STDMETHODCALLTYPE *GetPredication )( + ID3D10Device1 * This, + /* [annotation] */ + __out_opt ID3D10Predicate **ppPredicate, + /* [annotation] */ + __out_opt BOOL *pPredicateValue); + + void ( STDMETHODCALLTYPE *GSGetShaderResources )( + ID3D10Device1 * This, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* [annotation] */ + __out_ecount(NumViews) ID3D10ShaderResourceView **ppShaderResourceViews); + + void ( STDMETHODCALLTYPE *GSGetSamplers )( + ID3D10Device1 * This, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* [annotation] */ + __out_ecount(NumSamplers) ID3D10SamplerState **ppSamplers); + + void ( STDMETHODCALLTYPE *OMGetRenderTargets )( + ID3D10Device1 * This, + /* [annotation] */ + __in_range( 0, D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT ) UINT NumViews, + /* [annotation] */ + __out_ecount_opt(NumViews) ID3D10RenderTargetView **ppRenderTargetViews, + /* [annotation] */ + __out_opt ID3D10DepthStencilView **ppDepthStencilView); + + void ( STDMETHODCALLTYPE *OMGetBlendState )( + ID3D10Device1 * This, + /* [annotation] */ + __out_opt ID3D10BlendState **ppBlendState, + /* [annotation] */ + __out_opt FLOAT BlendFactor[ 4 ], + /* [annotation] */ + __out_opt UINT *pSampleMask); + + void ( STDMETHODCALLTYPE *OMGetDepthStencilState )( + ID3D10Device1 * This, + /* [annotation] */ + __out_opt ID3D10DepthStencilState **ppDepthStencilState, + /* [annotation] */ + __out_opt UINT *pStencilRef); + + void ( STDMETHODCALLTYPE *SOGetTargets )( + ID3D10Device1 * This, + /* [annotation] */ + __in_range( 0, D3D10_SO_BUFFER_SLOT_COUNT ) UINT NumBuffers, + /* [annotation] */ + __out_ecount_opt(NumBuffers) ID3D10Buffer **ppSOTargets, + /* [annotation] */ + __out_ecount_opt(NumBuffers) UINT *pOffsets); + + void ( STDMETHODCALLTYPE *RSGetState )( + ID3D10Device1 * This, + /* [annotation] */ + __out ID3D10RasterizerState **ppRasterizerState); + + void ( STDMETHODCALLTYPE *RSGetViewports )( + ID3D10Device1 * This, + /* [annotation] */ + __inout /*_range(0, D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE )*/ UINT *NumViewports, + /* [annotation] */ + __out_ecount_opt(*NumViewports) D3D10_VIEWPORT *pViewports); + + void ( STDMETHODCALLTYPE *RSGetScissorRects )( + ID3D10Device1 * This, + /* [annotation] */ + __inout /*_range(0, D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE )*/ UINT *NumRects, + /* [annotation] */ + __out_ecount_opt(*NumRects) D3D10_RECT *pRects); + + HRESULT ( STDMETHODCALLTYPE *GetDeviceRemovedReason )( + ID3D10Device1 * This); + + HRESULT ( STDMETHODCALLTYPE *SetExceptionMode )( + ID3D10Device1 * This, + UINT RaiseFlags); + + UINT ( STDMETHODCALLTYPE *GetExceptionMode )( + ID3D10Device1 * This); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D10Device1 * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D10Device1 * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D10Device1 * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData); + + void ( STDMETHODCALLTYPE *ClearState )( + ID3D10Device1 * This); + + void ( STDMETHODCALLTYPE *Flush )( + ID3D10Device1 * This); + + HRESULT ( STDMETHODCALLTYPE *CreateBuffer )( + ID3D10Device1 * This, + /* [annotation] */ + __in const D3D10_BUFFER_DESC *pDesc, + /* [annotation] */ + __in_opt const D3D10_SUBRESOURCE_DATA *pInitialData, + /* [annotation] */ + __out_opt ID3D10Buffer **ppBuffer); + + HRESULT ( STDMETHODCALLTYPE *CreateTexture1D )( + ID3D10Device1 * This, + /* [annotation] */ + __in const D3D10_TEXTURE1D_DESC *pDesc, + /* [annotation] */ + __in_xcount_opt(pDesc->MipLevels * pDesc->ArraySize) const D3D10_SUBRESOURCE_DATA *pInitialData, + /* [annotation] */ + __out ID3D10Texture1D **ppTexture1D); + + HRESULT ( STDMETHODCALLTYPE *CreateTexture2D )( + ID3D10Device1 * This, + /* [annotation] */ + __in const D3D10_TEXTURE2D_DESC *pDesc, + /* [annotation] */ + __in_xcount_opt(pDesc->MipLevels * pDesc->ArraySize) const D3D10_SUBRESOURCE_DATA *pInitialData, + /* [annotation] */ + __out ID3D10Texture2D **ppTexture2D); + + HRESULT ( STDMETHODCALLTYPE *CreateTexture3D )( + ID3D10Device1 * This, + /* [annotation] */ + __in const D3D10_TEXTURE3D_DESC *pDesc, + /* [annotation] */ + __in_xcount_opt(pDesc->MipLevels) const D3D10_SUBRESOURCE_DATA *pInitialData, + /* [annotation] */ + __out ID3D10Texture3D **ppTexture3D); + + HRESULT ( STDMETHODCALLTYPE *CreateShaderResourceView )( + ID3D10Device1 * This, + /* [annotation] */ + __in ID3D10Resource *pResource, + /* [annotation] */ + __in_opt const D3D10_SHADER_RESOURCE_VIEW_DESC *pDesc, + /* [annotation] */ + __out_opt ID3D10ShaderResourceView **ppSRView); + + HRESULT ( STDMETHODCALLTYPE *CreateRenderTargetView )( + ID3D10Device1 * This, + /* [annotation] */ + __in ID3D10Resource *pResource, + /* [annotation] */ + __in_opt const D3D10_RENDER_TARGET_VIEW_DESC *pDesc, + /* [annotation] */ + __out_opt ID3D10RenderTargetView **ppRTView); + + HRESULT ( STDMETHODCALLTYPE *CreateDepthStencilView )( + ID3D10Device1 * This, + /* [annotation] */ + __in ID3D10Resource *pResource, + /* [annotation] */ + __in_opt const D3D10_DEPTH_STENCIL_VIEW_DESC *pDesc, + /* [annotation] */ + __out_opt ID3D10DepthStencilView **ppDepthStencilView); + + HRESULT ( STDMETHODCALLTYPE *CreateInputLayout )( + ID3D10Device1 * This, + /* [annotation] */ + __in_ecount(NumElements) const D3D10_INPUT_ELEMENT_DESC *pInputElementDescs, + /* [annotation] */ + __in_range( 0, D3D10_1_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT ) UINT NumElements, + /* [annotation] */ + __in const void *pShaderBytecodeWithInputSignature, + /* [annotation] */ + __in SIZE_T BytecodeLength, + /* [annotation] */ + __out_opt ID3D10InputLayout **ppInputLayout); + + HRESULT ( STDMETHODCALLTYPE *CreateVertexShader )( + ID3D10Device1 * This, + /* [annotation] */ + __in const void *pShaderBytecode, + /* [annotation] */ + __in SIZE_T BytecodeLength, + /* [annotation] */ + __out_opt ID3D10VertexShader **ppVertexShader); + + HRESULT ( STDMETHODCALLTYPE *CreateGeometryShader )( + ID3D10Device1 * This, + /* [annotation] */ + __in const void *pShaderBytecode, + /* [annotation] */ + __in SIZE_T BytecodeLength, + /* [annotation] */ + __out_opt ID3D10GeometryShader **ppGeometryShader); + + HRESULT ( STDMETHODCALLTYPE *CreateGeometryShaderWithStreamOutput )( + ID3D10Device1 * This, + /* [annotation] */ + __in const void *pShaderBytecode, + /* [annotation] */ + __in SIZE_T BytecodeLength, + /* [annotation] */ + __in_ecount_opt(NumEntries) const D3D10_SO_DECLARATION_ENTRY *pSODeclaration, + /* [annotation] */ + __in_range( 0, D3D10_SO_SINGLE_BUFFER_COMPONENT_LIMIT ) UINT NumEntries, + /* [annotation] */ + __in UINT OutputStreamStride, + /* [annotation] */ + __out_opt ID3D10GeometryShader **ppGeometryShader); + + HRESULT ( STDMETHODCALLTYPE *CreatePixelShader )( + ID3D10Device1 * This, + /* [annotation] */ + __in const void *pShaderBytecode, + /* [annotation] */ + __in SIZE_T BytecodeLength, + /* [annotation] */ + __out_opt ID3D10PixelShader **ppPixelShader); + + HRESULT ( STDMETHODCALLTYPE *CreateBlendState )( + ID3D10Device1 * This, + /* [annotation] */ + __in const D3D10_BLEND_DESC *pBlendStateDesc, + /* [annotation] */ + __out_opt ID3D10BlendState **ppBlendState); + + HRESULT ( STDMETHODCALLTYPE *CreateDepthStencilState )( + ID3D10Device1 * This, + /* [annotation] */ + __in const D3D10_DEPTH_STENCIL_DESC *pDepthStencilDesc, + /* [annotation] */ + __out_opt ID3D10DepthStencilState **ppDepthStencilState); + + HRESULT ( STDMETHODCALLTYPE *CreateRasterizerState )( + ID3D10Device1 * This, + /* [annotation] */ + __in const D3D10_RASTERIZER_DESC *pRasterizerDesc, + /* [annotation] */ + __out_opt ID3D10RasterizerState **ppRasterizerState); + + HRESULT ( STDMETHODCALLTYPE *CreateSamplerState )( + ID3D10Device1 * This, + /* [annotation] */ + __in const D3D10_SAMPLER_DESC *pSamplerDesc, + /* [annotation] */ + __out_opt ID3D10SamplerState **ppSamplerState); + + HRESULT ( STDMETHODCALLTYPE *CreateQuery )( + ID3D10Device1 * This, + /* [annotation] */ + __in const D3D10_QUERY_DESC *pQueryDesc, + /* [annotation] */ + __out_opt ID3D10Query **ppQuery); + + HRESULT ( STDMETHODCALLTYPE *CreatePredicate )( + ID3D10Device1 * This, + /* [annotation] */ + __in const D3D10_QUERY_DESC *pPredicateDesc, + /* [annotation] */ + __out_opt ID3D10Predicate **ppPredicate); + + HRESULT ( STDMETHODCALLTYPE *CreateCounter )( + ID3D10Device1 * This, + /* [annotation] */ + __in const D3D10_COUNTER_DESC *pCounterDesc, + /* [annotation] */ + __out_opt ID3D10Counter **ppCounter); + + HRESULT ( STDMETHODCALLTYPE *CheckFormatSupport )( + ID3D10Device1 * This, + /* [annotation] */ + __in DXGI_FORMAT Format, + /* [annotation] */ + __out UINT *pFormatSupport); + + HRESULT ( STDMETHODCALLTYPE *CheckMultisampleQualityLevels )( + ID3D10Device1 * This, + /* [annotation] */ + __in DXGI_FORMAT Format, + /* [annotation] */ + __in UINT SampleCount, + /* [annotation] */ + __out UINT *pNumQualityLevels); + + void ( STDMETHODCALLTYPE *CheckCounterInfo )( + ID3D10Device1 * This, + /* [annotation] */ + __out D3D10_COUNTER_INFO *pCounterInfo); + + HRESULT ( STDMETHODCALLTYPE *CheckCounter )( + ID3D10Device1 * This, + /* [annotation] */ + __in const D3D10_COUNTER_DESC *pDesc, + /* [annotation] */ + __out D3D10_COUNTER_TYPE *pType, + /* [annotation] */ + __out UINT *pActiveCounters, + /* [annotation] */ + __out_ecount_opt(*pNameLength) LPSTR szName, + /* [annotation] */ + __inout_opt UINT *pNameLength, + /* [annotation] */ + __out_ecount_opt(*pUnitsLength) LPSTR szUnits, + /* [annotation] */ + __inout_opt UINT *pUnitsLength, + /* [annotation] */ + __out_ecount_opt(*pDescriptionLength) LPSTR szDescription, + /* [annotation] */ + __inout_opt UINT *pDescriptionLength); + + UINT ( STDMETHODCALLTYPE *GetCreationFlags )( + ID3D10Device1 * This); + + HRESULT ( STDMETHODCALLTYPE *OpenSharedResource )( + ID3D10Device1 * This, + /* [annotation] */ + __in HANDLE hResource, + /* [annotation] */ + __in REFIID ReturnedInterface, + /* [annotation] */ + __out_opt void **ppResource); + + void ( STDMETHODCALLTYPE *SetTextFilterSize )( + ID3D10Device1 * This, + /* [annotation] */ + __in UINT Width, + /* [annotation] */ + __in UINT Height); + + void ( STDMETHODCALLTYPE *GetTextFilterSize )( + ID3D10Device1 * This, + /* [annotation] */ + __out_opt UINT *pWidth, + /* [annotation] */ + __out_opt UINT *pHeight); + + HRESULT ( STDMETHODCALLTYPE *CreateShaderResourceView1 )( + ID3D10Device1 * This, + /* [annotation] */ + __in ID3D10Resource *pResource, + /* [annotation] */ + __in_opt const D3D10_SHADER_RESOURCE_VIEW_DESC1 *pDesc, + /* [annotation] */ + __out_opt ID3D10ShaderResourceView1 **ppSRView); + + HRESULT ( STDMETHODCALLTYPE *CreateBlendState1 )( + ID3D10Device1 * This, + /* [annotation] */ + __in const D3D10_BLEND_DESC1 *pBlendStateDesc, + /* [annotation] */ + __out_opt ID3D10BlendState1 **ppBlendState); + + D3D10_FEATURE_LEVEL1 ( STDMETHODCALLTYPE *GetFeatureLevel )( + ID3D10Device1 * This); + + END_INTERFACE + } ID3D10Device1Vtbl; + + interface ID3D10Device1 + { + CONST_VTBL struct ID3D10Device1Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10Device1_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10Device1_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10Device1_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10Device1_VSSetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) \ + ( (This)->lpVtbl -> VSSetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) ) + +#define ID3D10Device1_PSSetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) \ + ( (This)->lpVtbl -> PSSetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) ) + +#define ID3D10Device1_PSSetShader(This,pPixelShader) \ + ( (This)->lpVtbl -> PSSetShader(This,pPixelShader) ) + +#define ID3D10Device1_PSSetSamplers(This,StartSlot,NumSamplers,ppSamplers) \ + ( (This)->lpVtbl -> PSSetSamplers(This,StartSlot,NumSamplers,ppSamplers) ) + +#define ID3D10Device1_VSSetShader(This,pVertexShader) \ + ( (This)->lpVtbl -> VSSetShader(This,pVertexShader) ) + +#define ID3D10Device1_DrawIndexed(This,IndexCount,StartIndexLocation,BaseVertexLocation) \ + ( (This)->lpVtbl -> DrawIndexed(This,IndexCount,StartIndexLocation,BaseVertexLocation) ) + +#define ID3D10Device1_Draw(This,VertexCount,StartVertexLocation) \ + ( (This)->lpVtbl -> Draw(This,VertexCount,StartVertexLocation) ) + +#define ID3D10Device1_PSSetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) \ + ( (This)->lpVtbl -> PSSetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) ) + +#define ID3D10Device1_IASetInputLayout(This,pInputLayout) \ + ( (This)->lpVtbl -> IASetInputLayout(This,pInputLayout) ) + +#define ID3D10Device1_IASetVertexBuffers(This,StartSlot,NumBuffers,ppVertexBuffers,pStrides,pOffsets) \ + ( (This)->lpVtbl -> IASetVertexBuffers(This,StartSlot,NumBuffers,ppVertexBuffers,pStrides,pOffsets) ) + +#define ID3D10Device1_IASetIndexBuffer(This,pIndexBuffer,Format,Offset) \ + ( (This)->lpVtbl -> IASetIndexBuffer(This,pIndexBuffer,Format,Offset) ) + +#define ID3D10Device1_DrawIndexedInstanced(This,IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) \ + ( (This)->lpVtbl -> DrawIndexedInstanced(This,IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) ) + +#define ID3D10Device1_DrawInstanced(This,VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) \ + ( (This)->lpVtbl -> DrawInstanced(This,VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) ) + +#define ID3D10Device1_GSSetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) \ + ( (This)->lpVtbl -> GSSetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) ) + +#define ID3D10Device1_GSSetShader(This,pShader) \ + ( (This)->lpVtbl -> GSSetShader(This,pShader) ) + +#define ID3D10Device1_IASetPrimitiveTopology(This,Topology) \ + ( (This)->lpVtbl -> IASetPrimitiveTopology(This,Topology) ) + +#define ID3D10Device1_VSSetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) \ + ( (This)->lpVtbl -> VSSetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) ) + +#define ID3D10Device1_VSSetSamplers(This,StartSlot,NumSamplers,ppSamplers) \ + ( (This)->lpVtbl -> VSSetSamplers(This,StartSlot,NumSamplers,ppSamplers) ) + +#define ID3D10Device1_SetPredication(This,pPredicate,PredicateValue) \ + ( (This)->lpVtbl -> SetPredication(This,pPredicate,PredicateValue) ) + +#define ID3D10Device1_GSSetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) \ + ( (This)->lpVtbl -> GSSetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) ) + +#define ID3D10Device1_GSSetSamplers(This,StartSlot,NumSamplers,ppSamplers) \ + ( (This)->lpVtbl -> GSSetSamplers(This,StartSlot,NumSamplers,ppSamplers) ) + +#define ID3D10Device1_OMSetRenderTargets(This,NumViews,ppRenderTargetViews,pDepthStencilView) \ + ( (This)->lpVtbl -> OMSetRenderTargets(This,NumViews,ppRenderTargetViews,pDepthStencilView) ) + +#define ID3D10Device1_OMSetBlendState(This,pBlendState,BlendFactor,SampleMask) \ + ( (This)->lpVtbl -> OMSetBlendState(This,pBlendState,BlendFactor,SampleMask) ) + +#define ID3D10Device1_OMSetDepthStencilState(This,pDepthStencilState,StencilRef) \ + ( (This)->lpVtbl -> OMSetDepthStencilState(This,pDepthStencilState,StencilRef) ) + +#define ID3D10Device1_SOSetTargets(This,NumBuffers,ppSOTargets,pOffsets) \ + ( (This)->lpVtbl -> SOSetTargets(This,NumBuffers,ppSOTargets,pOffsets) ) + +#define ID3D10Device1_DrawAuto(This) \ + ( (This)->lpVtbl -> DrawAuto(This) ) + +#define ID3D10Device1_RSSetState(This,pRasterizerState) \ + ( (This)->lpVtbl -> RSSetState(This,pRasterizerState) ) + +#define ID3D10Device1_RSSetViewports(This,NumViewports,pViewports) \ + ( (This)->lpVtbl -> RSSetViewports(This,NumViewports,pViewports) ) + +#define ID3D10Device1_RSSetScissorRects(This,NumRects,pRects) \ + ( (This)->lpVtbl -> RSSetScissorRects(This,NumRects,pRects) ) + +#define ID3D10Device1_CopySubresourceRegion(This,pDstResource,DstSubresource,DstX,DstY,DstZ,pSrcResource,SrcSubresource,pSrcBox) \ + ( (This)->lpVtbl -> CopySubresourceRegion(This,pDstResource,DstSubresource,DstX,DstY,DstZ,pSrcResource,SrcSubresource,pSrcBox) ) + +#define ID3D10Device1_CopyResource(This,pDstResource,pSrcResource) \ + ( (This)->lpVtbl -> CopyResource(This,pDstResource,pSrcResource) ) + +#define ID3D10Device1_UpdateSubresource(This,pDstResource,DstSubresource,pDstBox,pSrcData,SrcRowPitch,SrcDepthPitch) \ + ( (This)->lpVtbl -> UpdateSubresource(This,pDstResource,DstSubresource,pDstBox,pSrcData,SrcRowPitch,SrcDepthPitch) ) + +#define ID3D10Device1_ClearRenderTargetView(This,pRenderTargetView,ColorRGBA) \ + ( (This)->lpVtbl -> ClearRenderTargetView(This,pRenderTargetView,ColorRGBA) ) + +#define ID3D10Device1_ClearDepthStencilView(This,pDepthStencilView,ClearFlags,Depth,Stencil) \ + ( (This)->lpVtbl -> ClearDepthStencilView(This,pDepthStencilView,ClearFlags,Depth,Stencil) ) + +#define ID3D10Device1_GenerateMips(This,pShaderResourceView) \ + ( (This)->lpVtbl -> GenerateMips(This,pShaderResourceView) ) + +#define ID3D10Device1_ResolveSubresource(This,pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) \ + ( (This)->lpVtbl -> ResolveSubresource(This,pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) ) + +#define ID3D10Device1_VSGetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) \ + ( (This)->lpVtbl -> VSGetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) ) + +#define ID3D10Device1_PSGetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) \ + ( (This)->lpVtbl -> PSGetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) ) + +#define ID3D10Device1_PSGetShader(This,ppPixelShader) \ + ( (This)->lpVtbl -> PSGetShader(This,ppPixelShader) ) + +#define ID3D10Device1_PSGetSamplers(This,StartSlot,NumSamplers,ppSamplers) \ + ( (This)->lpVtbl -> PSGetSamplers(This,StartSlot,NumSamplers,ppSamplers) ) + +#define ID3D10Device1_VSGetShader(This,ppVertexShader) \ + ( (This)->lpVtbl -> VSGetShader(This,ppVertexShader) ) + +#define ID3D10Device1_PSGetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) \ + ( (This)->lpVtbl -> PSGetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) ) + +#define ID3D10Device1_IAGetInputLayout(This,ppInputLayout) \ + ( (This)->lpVtbl -> IAGetInputLayout(This,ppInputLayout) ) + +#define ID3D10Device1_IAGetVertexBuffers(This,StartSlot,NumBuffers,ppVertexBuffers,pStrides,pOffsets) \ + ( (This)->lpVtbl -> IAGetVertexBuffers(This,StartSlot,NumBuffers,ppVertexBuffers,pStrides,pOffsets) ) + +#define ID3D10Device1_IAGetIndexBuffer(This,pIndexBuffer,Format,Offset) \ + ( (This)->lpVtbl -> IAGetIndexBuffer(This,pIndexBuffer,Format,Offset) ) + +#define ID3D10Device1_GSGetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) \ + ( (This)->lpVtbl -> GSGetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) ) + +#define ID3D10Device1_GSGetShader(This,ppGeometryShader) \ + ( (This)->lpVtbl -> GSGetShader(This,ppGeometryShader) ) + +#define ID3D10Device1_IAGetPrimitiveTopology(This,pTopology) \ + ( (This)->lpVtbl -> IAGetPrimitiveTopology(This,pTopology) ) + +#define ID3D10Device1_VSGetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) \ + ( (This)->lpVtbl -> VSGetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) ) + +#define ID3D10Device1_VSGetSamplers(This,StartSlot,NumSamplers,ppSamplers) \ + ( (This)->lpVtbl -> VSGetSamplers(This,StartSlot,NumSamplers,ppSamplers) ) + +#define ID3D10Device1_GetPredication(This,ppPredicate,pPredicateValue) \ + ( (This)->lpVtbl -> GetPredication(This,ppPredicate,pPredicateValue) ) + +#define ID3D10Device1_GSGetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) \ + ( (This)->lpVtbl -> GSGetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) ) + +#define ID3D10Device1_GSGetSamplers(This,StartSlot,NumSamplers,ppSamplers) \ + ( (This)->lpVtbl -> GSGetSamplers(This,StartSlot,NumSamplers,ppSamplers) ) + +#define ID3D10Device1_OMGetRenderTargets(This,NumViews,ppRenderTargetViews,ppDepthStencilView) \ + ( (This)->lpVtbl -> OMGetRenderTargets(This,NumViews,ppRenderTargetViews,ppDepthStencilView) ) + +#define ID3D10Device1_OMGetBlendState(This,ppBlendState,BlendFactor,pSampleMask) \ + ( (This)->lpVtbl -> OMGetBlendState(This,ppBlendState,BlendFactor,pSampleMask) ) + +#define ID3D10Device1_OMGetDepthStencilState(This,ppDepthStencilState,pStencilRef) \ + ( (This)->lpVtbl -> OMGetDepthStencilState(This,ppDepthStencilState,pStencilRef) ) + +#define ID3D10Device1_SOGetTargets(This,NumBuffers,ppSOTargets,pOffsets) \ + ( (This)->lpVtbl -> SOGetTargets(This,NumBuffers,ppSOTargets,pOffsets) ) + +#define ID3D10Device1_RSGetState(This,ppRasterizerState) \ + ( (This)->lpVtbl -> RSGetState(This,ppRasterizerState) ) + +#define ID3D10Device1_RSGetViewports(This,NumViewports,pViewports) \ + ( (This)->lpVtbl -> RSGetViewports(This,NumViewports,pViewports) ) + +#define ID3D10Device1_RSGetScissorRects(This,NumRects,pRects) \ + ( (This)->lpVtbl -> RSGetScissorRects(This,NumRects,pRects) ) + +#define ID3D10Device1_GetDeviceRemovedReason(This) \ + ( (This)->lpVtbl -> GetDeviceRemovedReason(This) ) + +#define ID3D10Device1_SetExceptionMode(This,RaiseFlags) \ + ( (This)->lpVtbl -> SetExceptionMode(This,RaiseFlags) ) + +#define ID3D10Device1_GetExceptionMode(This) \ + ( (This)->lpVtbl -> GetExceptionMode(This) ) + +#define ID3D10Device1_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D10Device1_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D10Device1_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D10Device1_ClearState(This) \ + ( (This)->lpVtbl -> ClearState(This) ) + +#define ID3D10Device1_Flush(This) \ + ( (This)->lpVtbl -> Flush(This) ) + +#define ID3D10Device1_CreateBuffer(This,pDesc,pInitialData,ppBuffer) \ + ( (This)->lpVtbl -> CreateBuffer(This,pDesc,pInitialData,ppBuffer) ) + +#define ID3D10Device1_CreateTexture1D(This,pDesc,pInitialData,ppTexture1D) \ + ( (This)->lpVtbl -> CreateTexture1D(This,pDesc,pInitialData,ppTexture1D) ) + +#define ID3D10Device1_CreateTexture2D(This,pDesc,pInitialData,ppTexture2D) \ + ( (This)->lpVtbl -> CreateTexture2D(This,pDesc,pInitialData,ppTexture2D) ) + +#define ID3D10Device1_CreateTexture3D(This,pDesc,pInitialData,ppTexture3D) \ + ( (This)->lpVtbl -> CreateTexture3D(This,pDesc,pInitialData,ppTexture3D) ) + +#define ID3D10Device1_CreateShaderResourceView(This,pResource,pDesc,ppSRView) \ + ( (This)->lpVtbl -> CreateShaderResourceView(This,pResource,pDesc,ppSRView) ) + +#define ID3D10Device1_CreateRenderTargetView(This,pResource,pDesc,ppRTView) \ + ( (This)->lpVtbl -> CreateRenderTargetView(This,pResource,pDesc,ppRTView) ) + +#define ID3D10Device1_CreateDepthStencilView(This,pResource,pDesc,ppDepthStencilView) \ + ( (This)->lpVtbl -> CreateDepthStencilView(This,pResource,pDesc,ppDepthStencilView) ) + +#define ID3D10Device1_CreateInputLayout(This,pInputElementDescs,NumElements,pShaderBytecodeWithInputSignature,BytecodeLength,ppInputLayout) \ + ( (This)->lpVtbl -> CreateInputLayout(This,pInputElementDescs,NumElements,pShaderBytecodeWithInputSignature,BytecodeLength,ppInputLayout) ) + +#define ID3D10Device1_CreateVertexShader(This,pShaderBytecode,BytecodeLength,ppVertexShader) \ + ( (This)->lpVtbl -> CreateVertexShader(This,pShaderBytecode,BytecodeLength,ppVertexShader) ) + +#define ID3D10Device1_CreateGeometryShader(This,pShaderBytecode,BytecodeLength,ppGeometryShader) \ + ( (This)->lpVtbl -> CreateGeometryShader(This,pShaderBytecode,BytecodeLength,ppGeometryShader) ) + +#define ID3D10Device1_CreateGeometryShaderWithStreamOutput(This,pShaderBytecode,BytecodeLength,pSODeclaration,NumEntries,OutputStreamStride,ppGeometryShader) \ + ( (This)->lpVtbl -> CreateGeometryShaderWithStreamOutput(This,pShaderBytecode,BytecodeLength,pSODeclaration,NumEntries,OutputStreamStride,ppGeometryShader) ) + +#define ID3D10Device1_CreatePixelShader(This,pShaderBytecode,BytecodeLength,ppPixelShader) \ + ( (This)->lpVtbl -> CreatePixelShader(This,pShaderBytecode,BytecodeLength,ppPixelShader) ) + +#define ID3D10Device1_CreateBlendState(This,pBlendStateDesc,ppBlendState) \ + ( (This)->lpVtbl -> CreateBlendState(This,pBlendStateDesc,ppBlendState) ) + +#define ID3D10Device1_CreateDepthStencilState(This,pDepthStencilDesc,ppDepthStencilState) \ + ( (This)->lpVtbl -> CreateDepthStencilState(This,pDepthStencilDesc,ppDepthStencilState) ) + +#define ID3D10Device1_CreateRasterizerState(This,pRasterizerDesc,ppRasterizerState) \ + ( (This)->lpVtbl -> CreateRasterizerState(This,pRasterizerDesc,ppRasterizerState) ) + +#define ID3D10Device1_CreateSamplerState(This,pSamplerDesc,ppSamplerState) \ + ( (This)->lpVtbl -> CreateSamplerState(This,pSamplerDesc,ppSamplerState) ) + +#define ID3D10Device1_CreateQuery(This,pQueryDesc,ppQuery) \ + ( (This)->lpVtbl -> CreateQuery(This,pQueryDesc,ppQuery) ) + +#define ID3D10Device1_CreatePredicate(This,pPredicateDesc,ppPredicate) \ + ( (This)->lpVtbl -> CreatePredicate(This,pPredicateDesc,ppPredicate) ) + +#define ID3D10Device1_CreateCounter(This,pCounterDesc,ppCounter) \ + ( (This)->lpVtbl -> CreateCounter(This,pCounterDesc,ppCounter) ) + +#define ID3D10Device1_CheckFormatSupport(This,Format,pFormatSupport) \ + ( (This)->lpVtbl -> CheckFormatSupport(This,Format,pFormatSupport) ) + +#define ID3D10Device1_CheckMultisampleQualityLevels(This,Format,SampleCount,pNumQualityLevels) \ + ( (This)->lpVtbl -> CheckMultisampleQualityLevels(This,Format,SampleCount,pNumQualityLevels) ) + +#define ID3D10Device1_CheckCounterInfo(This,pCounterInfo) \ + ( (This)->lpVtbl -> CheckCounterInfo(This,pCounterInfo) ) + +#define ID3D10Device1_CheckCounter(This,pDesc,pType,pActiveCounters,szName,pNameLength,szUnits,pUnitsLength,szDescription,pDescriptionLength) \ + ( (This)->lpVtbl -> CheckCounter(This,pDesc,pType,pActiveCounters,szName,pNameLength,szUnits,pUnitsLength,szDescription,pDescriptionLength) ) + +#define ID3D10Device1_GetCreationFlags(This) \ + ( (This)->lpVtbl -> GetCreationFlags(This) ) + +#define ID3D10Device1_OpenSharedResource(This,hResource,ReturnedInterface,ppResource) \ + ( (This)->lpVtbl -> OpenSharedResource(This,hResource,ReturnedInterface,ppResource) ) + +#define ID3D10Device1_SetTextFilterSize(This,Width,Height) \ + ( (This)->lpVtbl -> SetTextFilterSize(This,Width,Height) ) + +#define ID3D10Device1_GetTextFilterSize(This,pWidth,pHeight) \ + ( (This)->lpVtbl -> GetTextFilterSize(This,pWidth,pHeight) ) + + +#define ID3D10Device1_CreateShaderResourceView1(This,pResource,pDesc,ppSRView) \ + ( (This)->lpVtbl -> CreateShaderResourceView1(This,pResource,pDesc,ppSRView) ) + +#define ID3D10Device1_CreateBlendState1(This,pBlendStateDesc,ppBlendState) \ + ( (This)->lpVtbl -> CreateBlendState1(This,pBlendStateDesc,ppBlendState) ) + +#define ID3D10Device1_GetFeatureLevel(This) \ + ( (This)->lpVtbl -> GetFeatureLevel(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10Device1_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d10_1_0000_0003 */ +/* [local] */ + +#define D3D10_1_SDK_VERSION ( ( 0 + 0x20 ) ) + +#include "d3d10_1shader.h" + +/////////////////////////////////////////////////////////////////////////// +// D3D10CreateDevice1 +// ------------------ +// +// pAdapter +// If NULL, D3D10CreateDevice1 will choose the primary adapter and +// create a new instance from a temporarily created IDXGIFactory. +// If non-NULL, D3D10CreateDevice1 will register the appropriate +// device, if necessary (via IDXGIAdapter::RegisterDrver), before +// creating the device. +// DriverType +// Specifies the driver type to be created: hardware, reference or +// null. +// Software +// HMODULE of a DLL implementing a software rasterizer. Must be NULL for +// non-Software driver types. +// Flags +// Any of those documented for D3D10CreateDeviceAndSwapChain1. +// HardwareLevel +// Any of those documented for D3D10CreateDeviceAndSwapChain1. +// SDKVersion +// SDK version. Use the D3D10_1_SDK_VERSION macro. +// ppDevice +// Pointer to returned interface. +// +// Return Values +// Any of those documented for +// CreateDXGIFactory +// IDXGIFactory::EnumAdapters +// IDXGIAdapter::RegisterDriver +// D3D10CreateDevice1 +// +/////////////////////////////////////////////////////////////////////////// +typedef HRESULT (WINAPI* PFN_D3D10_CREATE_DEVICE1)(IDXGIAdapter *, + D3D10_DRIVER_TYPE, HMODULE, UINT, D3D10_FEATURE_LEVEL1, UINT, ID3D10Device1**); + +HRESULT WINAPI D3D10CreateDevice1( + IDXGIAdapter *pAdapter, + D3D10_DRIVER_TYPE DriverType, + HMODULE Software, + UINT Flags, + D3D10_FEATURE_LEVEL1 HardwareLevel, + UINT SDKVersion, + ID3D10Device1 **ppDevice); + +/////////////////////////////////////////////////////////////////////////// +// D3D10CreateDeviceAndSwapChain1 +// ------------------------------ +// +// ppAdapter +// If NULL, D3D10CreateDevice1 will choose the primary adapter and +// create a new instance from a temporarily created IDXGIFactory. +// If non-NULL, D3D10CreateDevice1 will register the appropriate +// device, if necessary (via IDXGIAdapter::RegisterDrver), before +// creating the device. +// DriverType +// Specifies the driver type to be created: hardware, reference or +// null. +// Software +// HMODULE of a DLL implementing a software rasterizer. Must be NULL for +// non-Software driver types. +// Flags +// Any of those documented for D3D10CreateDevice1. +// HardwareLevel +// Any of: +// D3D10_CREATE_LEVEL_10_0 +// D3D10_CREATE_LEVEL_10_1 +// SDKVersion +// SDK version. Use the D3D10_1_SDK_VERSION macro. +// pSwapChainDesc +// Swap chain description, may be NULL. +// ppSwapChain +// Pointer to returned interface. May be NULL. +// ppDevice +// Pointer to returned interface. +// +// Return Values +// Any of those documented for +// CreateDXGIFactory +// IDXGIFactory::EnumAdapters +// IDXGIAdapter::RegisterDriver +// D3D10CreateDevice1 +// IDXGIFactory::CreateSwapChain +// +/////////////////////////////////////////////////////////////////////////// +typedef HRESULT (WINAPI* PFN_D3D10_CREATE_DEVICE_AND_SWAP_CHAIN1)(IDXGIAdapter *, + D3D10_DRIVER_TYPE, HMODULE, UINT, D3D10_FEATURE_LEVEL1, UINT, DXGI_SWAP_CHAIN_DESC *, IDXGISwapChain **, ID3D10Device1 **); + +HRESULT WINAPI D3D10CreateDeviceAndSwapChain1( + IDXGIAdapter *pAdapter, + D3D10_DRIVER_TYPE DriverType, + HMODULE Software, + UINT Flags, + D3D10_FEATURE_LEVEL1 HardwareLevel, + UINT SDKVersion, + DXGI_SWAP_CHAIN_DESC *pSwapChainDesc, + IDXGISwapChain **ppSwapChain, + ID3D10Device1 **ppDevice); +DEFINE_GUID(IID_ID3D10BlendState1,0xEDAD8D99,0x8A35,0x4d6d,0x85,0x66,0x2E,0xA2,0x76,0xCD,0xE1,0x61); +DEFINE_GUID(IID_ID3D10ShaderResourceView1,0x9B7E4C87,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); +DEFINE_GUID(IID_ID3D10Device1,0x9B7E4C8F,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); + + +extern RPC_IF_HANDLE __MIDL_itf_d3d10_1_0000_0003_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d10_1_0000_0003_v0_0_s_ifspec; + +/* Additional Prototypes for ALL interfaces */ + +/* end of Additional Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/MediaClient/MediaClient/directx/include/D3D10_1shader.h b/MediaClient/MediaClient/directx/include/D3D10_1shader.h new file mode 100644 index 0000000..2726f8f --- /dev/null +++ b/MediaClient/MediaClient/directx/include/D3D10_1shader.h @@ -0,0 +1,301 @@ +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// File: D3D10_1Shader.h +// Content: D3D10.1 Shader Types and APIs +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef __D3D10_1SHADER_H__ +#define __D3D10_1SHADER_H__ + +#include "d3d10shader.h" + +//---------------------------------------------------------------------------- +// Shader debugging structures +//---------------------------------------------------------------------------- + +typedef enum _D3D10_SHADER_DEBUG_REGTYPE +{ + D3D10_SHADER_DEBUG_REG_INPUT, + D3D10_SHADER_DEBUG_REG_OUTPUT, + D3D10_SHADER_DEBUG_REG_CBUFFER, + D3D10_SHADER_DEBUG_REG_TBUFFER, + D3D10_SHADER_DEBUG_REG_TEMP, + D3D10_SHADER_DEBUG_REG_TEMPARRAY, + D3D10_SHADER_DEBUG_REG_TEXTURE, + D3D10_SHADER_DEBUG_REG_SAMPLER, + D3D10_SHADER_DEBUG_REG_IMMEDIATECBUFFER, + D3D10_SHADER_DEBUG_REG_LITERAL, + D3D10_SHADER_DEBUG_REG_UNUSED, + D3D11_SHADER_DEBUG_REG_INTERFACE_POINTERS, + D3D11_SHADER_DEBUG_REG_UAV, + D3D10_SHADER_DEBUG_REG_FORCE_DWORD = 0x7fffffff, +} D3D10_SHADER_DEBUG_REGTYPE; + +typedef enum _D3D10_SHADER_DEBUG_SCOPETYPE +{ + D3D10_SHADER_DEBUG_SCOPE_GLOBAL, + D3D10_SHADER_DEBUG_SCOPE_BLOCK, + D3D10_SHADER_DEBUG_SCOPE_FORLOOP, + D3D10_SHADER_DEBUG_SCOPE_STRUCT, + D3D10_SHADER_DEBUG_SCOPE_FUNC_PARAMS, + D3D10_SHADER_DEBUG_SCOPE_STATEBLOCK, + D3D10_SHADER_DEBUG_SCOPE_NAMESPACE, + D3D10_SHADER_DEBUG_SCOPE_ANNOTATION, + D3D10_SHADER_DEBUG_SCOPE_FORCE_DWORD = 0x7fffffff, +} D3D10_SHADER_DEBUG_SCOPETYPE; + +typedef enum _D3D10_SHADER_DEBUG_VARTYPE +{ + D3D10_SHADER_DEBUG_VAR_VARIABLE, + D3D10_SHADER_DEBUG_VAR_FUNCTION, + D3D10_SHADER_DEBUG_VAR_FORCE_DWORD = 0x7fffffff, +} D3D10_SHADER_DEBUG_VARTYPE; + +///////////////////////////////////////////////////////////////////// +// These are the serialized structures that get written to the file +///////////////////////////////////////////////////////////////////// + +typedef struct _D3D10_SHADER_DEBUG_TOKEN_INFO +{ + UINT File; // offset into file list + UINT Line; // line # + UINT Column; // column # + + UINT TokenLength; + UINT TokenId; // offset to LPCSTR of length TokenLength in string datastore +} D3D10_SHADER_DEBUG_TOKEN_INFO; + +// Variable list +typedef struct _D3D10_SHADER_DEBUG_VAR_INFO +{ + // Index into token list for declaring identifier + UINT TokenId; + D3D10_SHADER_VARIABLE_TYPE Type; + // register and component for this variable, only valid/necessary for arrays + UINT Register; + UINT Component; + // gives the original variable that declared this variable + UINT ScopeVar; + // this variable's offset in its ScopeVar + UINT ScopeVarOffset; +} D3D10_SHADER_DEBUG_VAR_INFO; + +typedef struct _D3D10_SHADER_DEBUG_INPUT_INFO +{ + // index into array of variables of variable to initialize + UINT Var; + // input, cbuffer, tbuffer + D3D10_SHADER_DEBUG_REGTYPE InitialRegisterSet; + // set to cbuffer or tbuffer slot, geometry shader input primitive #, + // identifying register for indexable temp, or -1 + UINT InitialBank; + // -1 if temp, otherwise gives register in register set + UINT InitialRegister; + // -1 if temp, otherwise gives component + UINT InitialComponent; + // initial value if literal + UINT InitialValue; +} D3D10_SHADER_DEBUG_INPUT_INFO; + +typedef struct _D3D10_SHADER_DEBUG_SCOPEVAR_INFO +{ + // Index into variable token + UINT TokenId; + + D3D10_SHADER_DEBUG_VARTYPE VarType; // variable or function (different namespaces) + D3D10_SHADER_VARIABLE_CLASS Class; + UINT Rows; // number of rows (matrices) + UINT Columns; // number of columns (vectors and matrices) + + // In an array of structures, one struct member scope is provided, and + // you'll have to add the array stride times the index to the variable + // index you find, then find that variable in this structure's list of + // variables. + + // gives a scope to look up struct members. -1 if not a struct + UINT StructMemberScope; + + // number of array indices + UINT uArrayIndices; // a[3][2][1] has 3 indices + // maximum array index for each index + // offset to UINT[uArrayIndices] in UINT datastore + UINT ArrayElements; // a[3][2][1] has {3, 2, 1} + // how many variables each array index moves + // offset to UINT[uArrayIndices] in UINT datastore + UINT ArrayStrides; // a[3][2][1] has {2, 1, 1} + + UINT uVariables; + // index of the first variable, later variables are offsets from this one + UINT uFirstVariable; +} D3D10_SHADER_DEBUG_SCOPEVAR_INFO; + +// scope data, this maps variable names to debug variables (useful for the watch window) +typedef struct _D3D10_SHADER_DEBUG_SCOPE_INFO +{ + D3D10_SHADER_DEBUG_SCOPETYPE ScopeType; + UINT Name; // offset to name of scope in strings list + UINT uNameLen; // length of name string + UINT uVariables; + UINT VariableData; // Offset to UINT[uVariables] indexing the Scope Variable list +} D3D10_SHADER_DEBUG_SCOPE_INFO; + +// instruction outputs +typedef struct _D3D10_SHADER_DEBUG_OUTPUTVAR +{ + // index variable being written to, if -1 it's not going to a variable + UINT Var; + // range data that the compiler expects to be true + UINT uValueMin, uValueMax; + INT iValueMin, iValueMax; + FLOAT fValueMin, fValueMax; + + BOOL bNaNPossible, bInfPossible; +} D3D10_SHADER_DEBUG_OUTPUTVAR; + +typedef struct _D3D10_SHADER_DEBUG_OUTPUTREG_INFO +{ + // Only temp, indexable temp, and output are valid here + D3D10_SHADER_DEBUG_REGTYPE OutputRegisterSet; + // -1 means no output + UINT OutputReg; + // if a temp array, identifier for which one + UINT TempArrayReg; + // -1 means masked out + UINT OutputComponents[4]; + D3D10_SHADER_DEBUG_OUTPUTVAR OutputVars[4]; + // when indexing the output, get the value of this register, then add + // that to uOutputReg. If uIndexReg is -1, then there is no index. + // find the variable whose register is the sum (by looking in the ScopeVar) + // and component matches, then set it. This should only happen for indexable + // temps and outputs. + UINT IndexReg; + UINT IndexComp; +} D3D10_SHADER_DEBUG_OUTPUTREG_INFO; + +// per instruction data +typedef struct _D3D10_SHADER_DEBUG_INST_INFO +{ + UINT Id; // Which instruction this is in the bytecode + UINT Opcode; // instruction type + + // 0, 1, or 2 + UINT uOutputs; + + // up to two outputs per instruction + D3D10_SHADER_DEBUG_OUTPUTREG_INFO pOutputs[2]; + + // index into the list of tokens for this instruction's token + UINT TokenId; + + // how many function calls deep this instruction is + UINT NestingLevel; + + // list of scopes from outer-most to inner-most + // Number of scopes + UINT Scopes; + UINT ScopeInfo; // Offset to UINT[uScopes] specifying indices of the ScopeInfo Array + + // list of variables accessed by this instruction + // Number of variables + UINT AccessedVars; + UINT AccessedVarsInfo; // Offset to UINT[AccessedVars] specifying indices of the ScopeVariableInfo Array +} D3D10_SHADER_DEBUG_INST_INFO; + +typedef struct _D3D10_SHADER_DEBUG_FILE_INFO +{ + UINT FileName; // Offset to LPCSTR for file name + UINT FileNameLen; // Length of file name + UINT FileData; // Offset to LPCSTR of length FileLen + UINT FileLen; // Length of file +} D3D10_SHADER_DEBUG_FILE_INFO; + +typedef struct _D3D10_SHADER_DEBUG_INFO +{ + UINT Size; // sizeof(D3D10_SHADER_DEBUG_INFO) + UINT Creator; // Offset to LPCSTR for compiler version + UINT EntrypointName; // Offset to LPCSTR for Entry point name + UINT ShaderTarget; // Offset to LPCSTR for shader target + UINT CompileFlags; // flags used to compile + UINT Files; // number of included files + UINT FileInfo; // Offset to D3D10_SHADER_DEBUG_FILE_INFO[Files] + UINT Instructions; // number of instructions + UINT InstructionInfo; // Offset to D3D10_SHADER_DEBUG_INST_INFO[Instructions] + UINT Variables; // number of variables + UINT VariableInfo; // Offset to D3D10_SHADER_DEBUG_VAR_INFO[Variables] + UINT InputVariables; // number of variables to initialize before running + UINT InputVariableInfo; // Offset to D3D10_SHADER_DEBUG_INPUT_INFO[InputVariables] + UINT Tokens; // number of tokens to initialize + UINT TokenInfo; // Offset to D3D10_SHADER_DEBUG_TOKEN_INFO[Tokens] + UINT Scopes; // number of scopes + UINT ScopeInfo; // Offset to D3D10_SHADER_DEBUG_SCOPE_INFO[Scopes] + UINT ScopeVariables; // number of variables declared + UINT ScopeVariableInfo; // Offset to D3D10_SHADER_DEBUG_SCOPEVAR_INFO[Scopes] + UINT UintOffset; // Offset to the UINT datastore, all UINT offsets are from this offset + UINT StringOffset; // Offset to the string datastore, all string offsets are from this offset +} D3D10_SHADER_DEBUG_INFO; + +//---------------------------------------------------------------------------- +// ID3D10ShaderReflection1: +//---------------------------------------------------------------------------- + +// +// Interface definitions +// + +typedef interface ID3D10ShaderReflection1 ID3D10ShaderReflection1; +typedef interface ID3D10ShaderReflection1 *LPD3D10SHADERREFLECTION1; + +// {C3457783-A846-47CE-9520-CEA6F66E7447} +DEFINE_GUID(IID_ID3D10ShaderReflection1, +0xc3457783, 0xa846, 0x47ce, 0x95, 0x20, 0xce, 0xa6, 0xf6, 0x6e, 0x74, 0x47); + +#undef INTERFACE +#define INTERFACE ID3D10ShaderReflection1 + +DECLARE_INTERFACE_(ID3D10ShaderReflection1, IUnknown) +{ + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + STDMETHOD(GetDesc)(THIS_ D3D10_SHADER_DESC *pDesc) PURE; + + STDMETHOD_(ID3D10ShaderReflectionConstantBuffer*, GetConstantBufferByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10ShaderReflectionConstantBuffer*, GetConstantBufferByName)(THIS_ LPCSTR Name) PURE; + + STDMETHOD(GetResourceBindingDesc)(THIS_ UINT ResourceIndex, D3D10_SHADER_INPUT_BIND_DESC *pDesc) PURE; + + STDMETHOD(GetInputParameterDesc)(THIS_ UINT ParameterIndex, D3D10_SIGNATURE_PARAMETER_DESC *pDesc) PURE; + STDMETHOD(GetOutputParameterDesc)(THIS_ UINT ParameterIndex, D3D10_SIGNATURE_PARAMETER_DESC *pDesc) PURE; + + STDMETHOD_(ID3D10ShaderReflectionVariable*, GetVariableByName)(THIS_ LPCSTR Name) PURE; + + STDMETHOD(GetResourceBindingDescByName)(THIS_ LPCSTR Name, D3D10_SHADER_INPUT_BIND_DESC *pDesc) PURE; + + STDMETHOD(GetMovInstructionCount)(THIS_ UINT* pCount) PURE; + STDMETHOD(GetMovcInstructionCount)(THIS_ UINT* pCount) PURE; + STDMETHOD(GetConversionInstructionCount)(THIS_ UINT* pCount) PURE; + STDMETHOD(GetBitwiseInstructionCount)(THIS_ UINT* pCount) PURE; + + STDMETHOD(GetGSInputPrimitive)(THIS_ D3D10_PRIMITIVE* pPrim) PURE; + STDMETHOD(IsLevel9Shader)(THIS_ BOOL* pbLevel9Shader) PURE; + STDMETHOD(IsSampleFrequencyShader)(THIS_ BOOL* pbSampleFrequency) PURE; +}; + +////////////////////////////////////////////////////////////////////////////// +// APIs ////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif //__D3D10_1SHADER_H__ + diff --git a/MediaClient/MediaClient/directx/include/D3D10effect.h b/MediaClient/MediaClient/directx/include/D3D10effect.h new file mode 100644 index 0000000..7387854 --- /dev/null +++ b/MediaClient/MediaClient/directx/include/D3D10effect.h @@ -0,0 +1,1455 @@ + +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// File: D3D10Effect.h +// Content: D3D10 Stateblock/Effect Types & APIs +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef __D3D10EFFECT_H__ +#define __D3D10EFFECT_H__ + +#include "d3d10.h" + +////////////////////////////////////////////////////////////////////////////// +// File contents: +// +// 1) Stateblock enums, structs, interfaces, flat APIs +// 2) Effect enums, structs, interfaces, flat APIs +////////////////////////////////////////////////////////////////////////////// + +//---------------------------------------------------------------------------- +// D3D10_DEVICE_STATE_TYPES: +// +// Used in ID3D10StateBlockMask function calls +// +//---------------------------------------------------------------------------- + +typedef enum _D3D10_DEVICE_STATE_TYPES +{ + + D3D10_DST_SO_BUFFERS=1, // Single-value state (atomical gets/sets) + D3D10_DST_OM_RENDER_TARGETS, // Single-value state (atomical gets/sets) + D3D10_DST_OM_DEPTH_STENCIL_STATE, // Single-value state + D3D10_DST_OM_BLEND_STATE, // Single-value state + + D3D10_DST_VS, // Single-value state + D3D10_DST_VS_SAMPLERS, // Count: D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT + D3D10_DST_VS_SHADER_RESOURCES, // Count: D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT + D3D10_DST_VS_CONSTANT_BUFFERS, // Count: + + D3D10_DST_GS, // Single-value state + D3D10_DST_GS_SAMPLERS, // Count: D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT + D3D10_DST_GS_SHADER_RESOURCES, // Count: D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT + D3D10_DST_GS_CONSTANT_BUFFERS, // Count: D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT + + D3D10_DST_PS, // Single-value state + D3D10_DST_PS_SAMPLERS, // Count: D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT + D3D10_DST_PS_SHADER_RESOURCES, // Count: D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT + D3D10_DST_PS_CONSTANT_BUFFERS, // Count: D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT + + D3D10_DST_IA_VERTEX_BUFFERS, // Count: D3D10_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT + D3D10_DST_IA_INDEX_BUFFER, // Single-value state + D3D10_DST_IA_INPUT_LAYOUT, // Single-value state + D3D10_DST_IA_PRIMITIVE_TOPOLOGY, // Single-value state + + D3D10_DST_RS_VIEWPORTS, // Single-value state (atomical gets/sets) + D3D10_DST_RS_SCISSOR_RECTS, // Single-value state (atomical gets/sets) + D3D10_DST_RS_RASTERIZER_STATE, // Single-value state + + D3D10_DST_PREDICATION, // Single-value state +} D3D10_DEVICE_STATE_TYPES; + +//---------------------------------------------------------------------------- +// D3D10_DEVICE_STATE_TYPES: +// +// Used in ID3D10StateBlockMask function calls +// +//---------------------------------------------------------------------------- + +#ifndef D3D10_BYTES_FROM_BITS +#define D3D10_BYTES_FROM_BITS(x) (((x) + 7) / 8) +#endif // D3D10_BYTES_FROM_BITS + +typedef struct _D3D10_STATE_BLOCK_MASK +{ + BYTE VS; + BYTE VSSamplers[D3D10_BYTES_FROM_BITS(D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT)]; + BYTE VSShaderResources[D3D10_BYTES_FROM_BITS(D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT)]; + BYTE VSConstantBuffers[D3D10_BYTES_FROM_BITS(D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT)]; + + BYTE GS; + BYTE GSSamplers[D3D10_BYTES_FROM_BITS(D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT)]; + BYTE GSShaderResources[D3D10_BYTES_FROM_BITS(D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT)]; + BYTE GSConstantBuffers[D3D10_BYTES_FROM_BITS(D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT)]; + + BYTE PS; + BYTE PSSamplers[D3D10_BYTES_FROM_BITS(D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT)]; + BYTE PSShaderResources[D3D10_BYTES_FROM_BITS(D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT)]; + BYTE PSConstantBuffers[D3D10_BYTES_FROM_BITS(D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT)]; + + BYTE IAVertexBuffers[D3D10_BYTES_FROM_BITS(D3D10_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT)]; + BYTE IAIndexBuffer; + BYTE IAInputLayout; + BYTE IAPrimitiveTopology; + + BYTE OMRenderTargets; + BYTE OMDepthStencilState; + BYTE OMBlendState; + + BYTE RSViewports; + BYTE RSScissorRects; + BYTE RSRasterizerState; + + BYTE SOBuffers; + + BYTE Predication; +} D3D10_STATE_BLOCK_MASK; + +////////////////////////////////////////////////////////////////////////////// +// ID3D10StateBlock ////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +typedef interface ID3D10StateBlock ID3D10StateBlock; +typedef interface ID3D10StateBlock *LPD3D10STATEBLOCK; + +// {0803425A-57F5-4dd6-9465-A87570834A08} +DEFINE_GUID(IID_ID3D10StateBlock, +0x803425a, 0x57f5, 0x4dd6, 0x94, 0x65, 0xa8, 0x75, 0x70, 0x83, 0x4a, 0x8); + +#undef INTERFACE +#define INTERFACE ID3D10StateBlock + +DECLARE_INTERFACE_(ID3D10StateBlock, IUnknown) +{ + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + STDMETHOD(Capture)(THIS) PURE; + STDMETHOD(Apply)(THIS) PURE; + STDMETHOD(ReleaseAllDeviceObjects)(THIS) PURE; + STDMETHOD(GetDevice)(THIS_ ID3D10Device **ppDevice) PURE; +}; + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + +//---------------------------------------------------------------------------- +// D3D10_STATE_BLOCK_MASK and manipulation functions +// ------------------------------------------------- +// +// These functions exist to facilitate working with the D3D10_STATE_BLOCK_MASK +// structure. +// +// D3D10_STATE_BLOCK_MASK *pResult or *pMask +// The state block mask to operate on +// +// D3D10_STATE_BLOCK_MASK *pA, *pB +// The source state block masks for the binary union/intersect/difference +// operations. +// +// D3D10_DEVICE_STATE_TYPES StateType +// The specific state type to enable/disable/query +// +// UINT RangeStart, RangeLength, Entry +// The specific bit or range of bits for a given state type to operate on. +// Consult the comments for D3D10_DEVICE_STATE_TYPES and +// D3D10_STATE_BLOCK_MASK for information on the valid bit ranges for +// each state. +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI D3D10StateBlockMaskUnion(D3D10_STATE_BLOCK_MASK *pA, D3D10_STATE_BLOCK_MASK *pB, D3D10_STATE_BLOCK_MASK *pResult); +HRESULT WINAPI D3D10StateBlockMaskIntersect(D3D10_STATE_BLOCK_MASK *pA, D3D10_STATE_BLOCK_MASK *pB, D3D10_STATE_BLOCK_MASK *pResult); +HRESULT WINAPI D3D10StateBlockMaskDifference(D3D10_STATE_BLOCK_MASK *pA, D3D10_STATE_BLOCK_MASK *pB, D3D10_STATE_BLOCK_MASK *pResult); +HRESULT WINAPI D3D10StateBlockMaskEnableCapture(D3D10_STATE_BLOCK_MASK *pMask, D3D10_DEVICE_STATE_TYPES StateType, UINT RangeStart, UINT RangeLength); +HRESULT WINAPI D3D10StateBlockMaskDisableCapture(D3D10_STATE_BLOCK_MASK *pMask, D3D10_DEVICE_STATE_TYPES StateType, UINT RangeStart, UINT RangeLength); +HRESULT WINAPI D3D10StateBlockMaskEnableAll(D3D10_STATE_BLOCK_MASK *pMask); +HRESULT WINAPI D3D10StateBlockMaskDisableAll(D3D10_STATE_BLOCK_MASK *pMask); +BOOL WINAPI D3D10StateBlockMaskGetSetting(D3D10_STATE_BLOCK_MASK *pMask, D3D10_DEVICE_STATE_TYPES StateType, UINT Entry); + +//---------------------------------------------------------------------------- +// D3D10CreateStateBlock +// --------------------- +// +// Creates a state block object based on the mask settings specified +// in a D3D10_STATE_BLOCK_MASK structure. +// +// ID3D10Device *pDevice +// The device interface to associate with this state block +// +// D3D10_STATE_BLOCK_MASK *pStateBlockMask +// A bit mask whose settings are used to generate a state block +// object. +// +// ID3D10StateBlock **ppStateBlock +// The resulting state block object. This object will save/restore +// only those pieces of state that were set in the state block +// bit mask +//---------------------------------------------------------------------------- + +HRESULT WINAPI D3D10CreateStateBlock(ID3D10Device *pDevice, D3D10_STATE_BLOCK_MASK *pStateBlockMask, ID3D10StateBlock **ppStateBlock); + +#ifdef __cplusplus +} +#endif //__cplusplus + +//---------------------------------------------------------------------------- +// D3D10_COMPILE & D3D10_EFFECT flags: +// ------------------------------------- +// +// These flags are passed in when creating an effect, and affect +// either compilation behavior or runtime effect behavior +// +// D3D10_EFFECT_COMPILE_CHILD_EFFECT +// Compile this .fx file to a child effect. Child effects have no initializers +// for any shared values as these are initialied in the master effect (pool). +// +// D3D10_EFFECT_COMPILE_ALLOW_SLOW_OPS +// By default, performance mode is enabled. Performance mode disallows +// mutable state objects by preventing non-literal expressions from appearing in +// state object definitions. Specifying this flag will disable the mode and allow +// for mutable state objects. +// +// D3D10_EFFECT_SINGLE_THREADED +// Do not attempt to synchronize with other threads loading effects into the +// same pool. +// +//---------------------------------------------------------------------------- + +#define D3D10_EFFECT_COMPILE_CHILD_EFFECT (1 << 0) +#define D3D10_EFFECT_COMPILE_ALLOW_SLOW_OPS (1 << 1) +#define D3D10_EFFECT_SINGLE_THREADED (1 << 3) + + +//---------------------------------------------------------------------------- +// D3D10_EFFECT_VARIABLE flags: +// ---------------------------- +// +// These flags describe an effect variable (global or annotation), +// and are returned in D3D10_EFFECT_VARIABLE_DESC::Flags. +// +// D3D10_EFFECT_VARIABLE_POOLED +// Indicates that the this variable or constant buffer resides +// in an effect pool. If this flag is not set, then the variable resides +// in a standalone effect (if ID3D10Effect::GetPool returns NULL) +// or a child effect (if ID3D10Effect::GetPool returns non-NULL) +// +// D3D10_EFFECT_VARIABLE_ANNOTATION +// Indicates that this is an annotation on a technique, pass, or global +// variable. Otherwise, this is a global variable. Annotations cannot +// be shared. +// +// D3D10_EFFECT_VARIABLE_EXPLICIT_BIND_POINT +// Indicates that the variable has been explicitly bound using the +// register keyword. +//---------------------------------------------------------------------------- + +#define D3D10_EFFECT_VARIABLE_POOLED (1 << 0) +#define D3D10_EFFECT_VARIABLE_ANNOTATION (1 << 1) +#define D3D10_EFFECT_VARIABLE_EXPLICIT_BIND_POINT (1 << 2) + +////////////////////////////////////////////////////////////////////////////// +// ID3D10EffectType ////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +//---------------------------------------------------------------------------- +// D3D10_EFFECT_TYPE_DESC: +// +// Retrieved by ID3D10EffectType::GetDesc() +//---------------------------------------------------------------------------- + +typedef struct _D3D10_EFFECT_TYPE_DESC +{ + LPCSTR TypeName; // Name of the type + // (e.g. "float4" or "MyStruct") + + D3D10_SHADER_VARIABLE_CLASS Class; // (e.g. scalar, vector, object, etc.) + D3D10_SHADER_VARIABLE_TYPE Type; // (e.g. float, texture, vertexshader, etc.) + + UINT Elements; // Number of elements in this type + // (0 if not an array) + UINT Members; // Number of members + // (0 if not a structure) + UINT Rows; // Number of rows in this type + // (0 if not a numeric primitive) + UINT Columns; // Number of columns in this type + // (0 if not a numeric primitive) + + UINT PackedSize; // Number of bytes required to represent + // this data type, when tightly packed + UINT UnpackedSize; // Number of bytes occupied by this data + // type, when laid out in a constant buffer + UINT Stride; // Number of bytes to seek between elements, + // when laid out in a constant buffer +} D3D10_EFFECT_TYPE_DESC; + +typedef interface ID3D10EffectType ID3D10EffectType; +typedef interface ID3D10EffectType *LPD3D10EFFECTTYPE; + +// {4E9E1DDC-CD9D-4772-A837-00180B9B88FD} +DEFINE_GUID(IID_ID3D10EffectType, +0x4e9e1ddc, 0xcd9d, 0x4772, 0xa8, 0x37, 0x0, 0x18, 0xb, 0x9b, 0x88, 0xfd); + +#undef INTERFACE +#define INTERFACE ID3D10EffectType + +DECLARE_INTERFACE(ID3D10EffectType) +{ + STDMETHOD_(BOOL, IsValid)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3D10_EFFECT_TYPE_DESC *pDesc) PURE; + STDMETHOD_(ID3D10EffectType*, GetMemberTypeByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectType*, GetMemberTypeByName)(THIS_ LPCSTR Name) PURE; + STDMETHOD_(ID3D10EffectType*, GetMemberTypeBySemantic)(THIS_ LPCSTR Semantic) PURE; + STDMETHOD_(LPCSTR, GetMemberName)(THIS_ UINT Index) PURE; + STDMETHOD_(LPCSTR, GetMemberSemantic)(THIS_ UINT Index) PURE; +}; + +////////////////////////////////////////////////////////////////////////////// +// ID3D10EffectVariable ////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +//---------------------------------------------------------------------------- +// D3D10_EFFECT_VARIABLE_DESC: +// +// Retrieved by ID3D10EffectVariable::GetDesc() +//---------------------------------------------------------------------------- + +typedef struct _D3D10_EFFECT_VARIABLE_DESC +{ + LPCSTR Name; // Name of this variable, annotation, + // or structure member + LPCSTR Semantic; // Semantic string of this variable + // or structure member (NULL for + // annotations or if not present) + + UINT Flags; // D3D10_EFFECT_VARIABLE_* flags + UINT Annotations; // Number of annotations on this variable + // (always 0 for annotations) + + UINT BufferOffset; // Offset into containing cbuffer or tbuffer + // (always 0 for annotations or variables + // not in constant buffers) + + UINT ExplicitBindPoint; // Used if the variable has been explicitly bound + // using the register keyword. Check Flags for + // D3D10_EFFECT_VARIABLE_EXPLICIT_BIND_POINT; +} D3D10_EFFECT_VARIABLE_DESC; + +typedef interface ID3D10EffectVariable ID3D10EffectVariable; +typedef interface ID3D10EffectVariable *LPD3D10EFFECTVARIABLE; + +// {AE897105-00E6-45bf-BB8E-281DD6DB8E1B} +DEFINE_GUID(IID_ID3D10EffectVariable, +0xae897105, 0xe6, 0x45bf, 0xbb, 0x8e, 0x28, 0x1d, 0xd6, 0xdb, 0x8e, 0x1b); + +#undef INTERFACE +#define INTERFACE ID3D10EffectVariable + +// Forward defines +typedef interface ID3D10EffectScalarVariable ID3D10EffectScalarVariable; +typedef interface ID3D10EffectVectorVariable ID3D10EffectVectorVariable; +typedef interface ID3D10EffectMatrixVariable ID3D10EffectMatrixVariable; +typedef interface ID3D10EffectStringVariable ID3D10EffectStringVariable; +typedef interface ID3D10EffectShaderResourceVariable ID3D10EffectShaderResourceVariable; +typedef interface ID3D10EffectRenderTargetViewVariable ID3D10EffectRenderTargetViewVariable; +typedef interface ID3D10EffectDepthStencilViewVariable ID3D10EffectDepthStencilViewVariable; +typedef interface ID3D10EffectConstantBuffer ID3D10EffectConstantBuffer; +typedef interface ID3D10EffectShaderVariable ID3D10EffectShaderVariable; +typedef interface ID3D10EffectBlendVariable ID3D10EffectBlendVariable; +typedef interface ID3D10EffectDepthStencilVariable ID3D10EffectDepthStencilVariable; +typedef interface ID3D10EffectRasterizerVariable ID3D10EffectRasterizerVariable; +typedef interface ID3D10EffectSamplerVariable ID3D10EffectSamplerVariable; + +DECLARE_INTERFACE(ID3D10EffectVariable) +{ + STDMETHOD_(BOOL, IsValid)(THIS) PURE; + STDMETHOD_(ID3D10EffectType*, GetType)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3D10_EFFECT_VARIABLE_DESC *pDesc) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByName)(THIS_ LPCSTR Name) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetMemberByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetMemberByName)(THIS_ LPCSTR Name) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetMemberBySemantic)(THIS_ LPCSTR Semantic) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetElement)(THIS_ UINT Index) PURE; + + STDMETHOD_(ID3D10EffectConstantBuffer*, GetParentConstantBuffer)(THIS) PURE; + + STDMETHOD_(ID3D10EffectScalarVariable*, AsScalar)(THIS) PURE; + STDMETHOD_(ID3D10EffectVectorVariable*, AsVector)(THIS) PURE; + STDMETHOD_(ID3D10EffectMatrixVariable*, AsMatrix)(THIS) PURE; + STDMETHOD_(ID3D10EffectStringVariable*, AsString)(THIS) PURE; + STDMETHOD_(ID3D10EffectShaderResourceVariable*, AsShaderResource)(THIS) PURE; + STDMETHOD_(ID3D10EffectRenderTargetViewVariable*, AsRenderTargetView)(THIS) PURE; + STDMETHOD_(ID3D10EffectDepthStencilViewVariable*, AsDepthStencilView)(THIS) PURE; + STDMETHOD_(ID3D10EffectConstantBuffer*, AsConstantBuffer)(THIS) PURE; + STDMETHOD_(ID3D10EffectShaderVariable*, AsShader)(THIS) PURE; + STDMETHOD_(ID3D10EffectBlendVariable*, AsBlend)(THIS) PURE; + STDMETHOD_(ID3D10EffectDepthStencilVariable*, AsDepthStencil)(THIS) PURE; + STDMETHOD_(ID3D10EffectRasterizerVariable*, AsRasterizer)(THIS) PURE; + STDMETHOD_(ID3D10EffectSamplerVariable*, AsSampler)(THIS) PURE; + + STDMETHOD(SetRawValue)(THIS_ void *pData, UINT Offset, UINT Count) PURE; + STDMETHOD(GetRawValue)(THIS_ void *pData, UINT Offset, UINT Count) PURE; +}; + +////////////////////////////////////////////////////////////////////////////// +// ID3D10EffectScalarVariable //////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +typedef interface ID3D10EffectScalarVariable ID3D10EffectScalarVariable; +typedef interface ID3D10EffectScalarVariable *LPD3D10EFFECTSCALARVARIABLE; + +// {00E48F7B-D2C8-49e8-A86C-022DEE53431F} +DEFINE_GUID(IID_ID3D10EffectScalarVariable, +0xe48f7b, 0xd2c8, 0x49e8, 0xa8, 0x6c, 0x2, 0x2d, 0xee, 0x53, 0x43, 0x1f); + +#undef INTERFACE +#define INTERFACE ID3D10EffectScalarVariable + +DECLARE_INTERFACE_(ID3D10EffectScalarVariable, ID3D10EffectVariable) +{ + STDMETHOD_(BOOL, IsValid)(THIS) PURE; + STDMETHOD_(ID3D10EffectType*, GetType)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3D10_EFFECT_VARIABLE_DESC *pDesc) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByName)(THIS_ LPCSTR Name) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetMemberByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetMemberByName)(THIS_ LPCSTR Name) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetMemberBySemantic)(THIS_ LPCSTR Semantic) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetElement)(THIS_ UINT Index) PURE; + + STDMETHOD_(ID3D10EffectConstantBuffer*, GetParentConstantBuffer)(THIS) PURE; + + STDMETHOD_(ID3D10EffectScalarVariable*, AsScalar)(THIS) PURE; + STDMETHOD_(ID3D10EffectVectorVariable*, AsVector)(THIS) PURE; + STDMETHOD_(ID3D10EffectMatrixVariable*, AsMatrix)(THIS) PURE; + STDMETHOD_(ID3D10EffectStringVariable*, AsString)(THIS) PURE; + STDMETHOD_(ID3D10EffectShaderResourceVariable*, AsShaderResource)(THIS) PURE; + STDMETHOD_(ID3D10EffectRenderTargetViewVariable*, AsRenderTargetView)(THIS) PURE; + STDMETHOD_(ID3D10EffectDepthStencilViewVariable*, AsDepthStencilView)(THIS) PURE; + STDMETHOD_(ID3D10EffectConstantBuffer*, AsConstantBuffer)(THIS) PURE; + STDMETHOD_(ID3D10EffectShaderVariable*, AsShader)(THIS) PURE; + STDMETHOD_(ID3D10EffectBlendVariable*, AsBlend)(THIS) PURE; + STDMETHOD_(ID3D10EffectDepthStencilVariable*, AsDepthStencil)(THIS) PURE; + STDMETHOD_(ID3D10EffectRasterizerVariable*, AsRasterizer)(THIS) PURE; + STDMETHOD_(ID3D10EffectSamplerVariable*, AsSampler)(THIS) PURE; + + STDMETHOD(SetRawValue)(THIS_ void *pData, UINT ByteOffset, UINT ByteCount) PURE; + STDMETHOD(GetRawValue)(THIS_ void *pData, UINT ByteOffset, UINT ByteCount) PURE; + + STDMETHOD(SetFloat)(THIS_ float Value) PURE; + STDMETHOD(GetFloat)(THIS_ float *pValue) PURE; + + STDMETHOD(SetFloatArray)(THIS_ float *pData, UINT Offset, UINT Count) PURE; + STDMETHOD(GetFloatArray)(THIS_ float *pData, UINT Offset, UINT Count) PURE; + + STDMETHOD(SetInt)(THIS_ int Value) PURE; + STDMETHOD(GetInt)(THIS_ int *pValue) PURE; + + STDMETHOD(SetIntArray)(THIS_ int *pData, UINT Offset, UINT Count) PURE; + STDMETHOD(GetIntArray)(THIS_ int *pData, UINT Offset, UINT Count) PURE; + + STDMETHOD(SetBool)(THIS_ BOOL Value) PURE; + STDMETHOD(GetBool)(THIS_ BOOL *pValue) PURE; + + STDMETHOD(SetBoolArray)(THIS_ BOOL *pData, UINT Offset, UINT Count) PURE; + STDMETHOD(GetBoolArray)(THIS_ BOOL *pData, UINT Offset, UINT Count) PURE; +}; + +////////////////////////////////////////////////////////////////////////////// +// ID3D10EffectVectorVariable //////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +typedef interface ID3D10EffectVectorVariable ID3D10EffectVectorVariable; +typedef interface ID3D10EffectVectorVariable *LPD3D10EFFECTVECTORVARIABLE; + +// {62B98C44-1F82-4c67-BCD0-72CF8F217E81} +DEFINE_GUID(IID_ID3D10EffectVectorVariable, +0x62b98c44, 0x1f82, 0x4c67, 0xbc, 0xd0, 0x72, 0xcf, 0x8f, 0x21, 0x7e, 0x81); + +#undef INTERFACE +#define INTERFACE ID3D10EffectVectorVariable + +DECLARE_INTERFACE_(ID3D10EffectVectorVariable, ID3D10EffectVariable) +{ + STDMETHOD_(BOOL, IsValid)(THIS) PURE; + STDMETHOD_(ID3D10EffectType*, GetType)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3D10_EFFECT_VARIABLE_DESC *pDesc) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByName)(THIS_ LPCSTR Name) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetMemberByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetMemberByName)(THIS_ LPCSTR Name) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetMemberBySemantic)(THIS_ LPCSTR Semantic) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetElement)(THIS_ UINT Index) PURE; + + STDMETHOD_(ID3D10EffectConstantBuffer*, GetParentConstantBuffer)(THIS) PURE; + + STDMETHOD_(ID3D10EffectScalarVariable*, AsScalar)(THIS) PURE; + STDMETHOD_(ID3D10EffectVectorVariable*, AsVector)(THIS) PURE; + STDMETHOD_(ID3D10EffectMatrixVariable*, AsMatrix)(THIS) PURE; + STDMETHOD_(ID3D10EffectStringVariable*, AsString)(THIS) PURE; + STDMETHOD_(ID3D10EffectShaderResourceVariable*, AsShaderResource)(THIS) PURE; + STDMETHOD_(ID3D10EffectRenderTargetViewVariable*, AsRenderTargetView)(THIS) PURE; + STDMETHOD_(ID3D10EffectDepthStencilViewVariable*, AsDepthStencilView)(THIS) PURE; + STDMETHOD_(ID3D10EffectConstantBuffer*, AsConstantBuffer)(THIS) PURE; + STDMETHOD_(ID3D10EffectShaderVariable*, AsShader)(THIS) PURE; + STDMETHOD_(ID3D10EffectBlendVariable*, AsBlend)(THIS) PURE; + STDMETHOD_(ID3D10EffectDepthStencilVariable*, AsDepthStencil)(THIS) PURE; + STDMETHOD_(ID3D10EffectRasterizerVariable*, AsRasterizer)(THIS) PURE; + STDMETHOD_(ID3D10EffectSamplerVariable*, AsSampler)(THIS) PURE; + + STDMETHOD(SetRawValue)(THIS_ void *pData, UINT ByteOffset, UINT ByteCount) PURE; + STDMETHOD(GetRawValue)(THIS_ void *pData, UINT ByteOffset, UINT ByteCount) PURE; + + STDMETHOD(SetBoolVector) (THIS_ BOOL *pData) PURE; + STDMETHOD(SetIntVector) (THIS_ int *pData) PURE; + STDMETHOD(SetFloatVector)(THIS_ float *pData) PURE; + + STDMETHOD(GetBoolVector) (THIS_ BOOL *pData) PURE; + STDMETHOD(GetIntVector) (THIS_ int *pData) PURE; + STDMETHOD(GetFloatVector)(THIS_ float *pData) PURE; + + STDMETHOD(SetBoolVectorArray) (THIS_ BOOL *pData, UINT Offset, UINT Count) PURE; + STDMETHOD(SetIntVectorArray) (THIS_ int *pData, UINT Offset, UINT Count) PURE; + STDMETHOD(SetFloatVectorArray)(THIS_ float *pData, UINT Offset, UINT Count) PURE; + + STDMETHOD(GetBoolVectorArray) (THIS_ BOOL *pData, UINT Offset, UINT Count) PURE; + STDMETHOD(GetIntVectorArray) (THIS_ int *pData, UINT Offset, UINT Count) PURE; + STDMETHOD(GetFloatVectorArray)(THIS_ float *pData, UINT Offset, UINT Count) PURE; +}; + +////////////////////////////////////////////////////////////////////////////// +// ID3D10EffectMatrixVariable //////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +typedef interface ID3D10EffectMatrixVariable ID3D10EffectMatrixVariable; +typedef interface ID3D10EffectMatrixVariable *LPD3D10EFFECTMATRIXVARIABLE; + +// {50666C24-B82F-4eed-A172-5B6E7E8522E0} +DEFINE_GUID(IID_ID3D10EffectMatrixVariable, +0x50666c24, 0xb82f, 0x4eed, 0xa1, 0x72, 0x5b, 0x6e, 0x7e, 0x85, 0x22, 0xe0); + +#undef INTERFACE +#define INTERFACE ID3D10EffectMatrixVariable + +DECLARE_INTERFACE_(ID3D10EffectMatrixVariable, ID3D10EffectVariable) +{ + STDMETHOD_(BOOL, IsValid)(THIS) PURE; + STDMETHOD_(ID3D10EffectType*, GetType)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3D10_EFFECT_VARIABLE_DESC *pDesc) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByName)(THIS_ LPCSTR Name) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetMemberByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetMemberByName)(THIS_ LPCSTR Name) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetMemberBySemantic)(THIS_ LPCSTR Semantic) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetElement)(THIS_ UINT Index) PURE; + + STDMETHOD_(ID3D10EffectConstantBuffer*, GetParentConstantBuffer)(THIS) PURE; + + STDMETHOD_(ID3D10EffectScalarVariable*, AsScalar)(THIS) PURE; + STDMETHOD_(ID3D10EffectVectorVariable*, AsVector)(THIS) PURE; + STDMETHOD_(ID3D10EffectMatrixVariable*, AsMatrix)(THIS) PURE; + STDMETHOD_(ID3D10EffectStringVariable*, AsString)(THIS) PURE; + STDMETHOD_(ID3D10EffectShaderResourceVariable*, AsShaderResource)(THIS) PURE; + STDMETHOD_(ID3D10EffectRenderTargetViewVariable*, AsRenderTargetView)(THIS) PURE; + STDMETHOD_(ID3D10EffectDepthStencilViewVariable*, AsDepthStencilView)(THIS) PURE; + STDMETHOD_(ID3D10EffectConstantBuffer*, AsConstantBuffer)(THIS) PURE; + STDMETHOD_(ID3D10EffectShaderVariable*, AsShader)(THIS) PURE; + STDMETHOD_(ID3D10EffectBlendVariable*, AsBlend)(THIS) PURE; + STDMETHOD_(ID3D10EffectDepthStencilVariable*, AsDepthStencil)(THIS) PURE; + STDMETHOD_(ID3D10EffectRasterizerVariable*, AsRasterizer)(THIS) PURE; + STDMETHOD_(ID3D10EffectSamplerVariable*, AsSampler)(THIS) PURE; + + STDMETHOD(SetRawValue)(THIS_ void *pData, UINT ByteOffset, UINT ByteCount) PURE; + STDMETHOD(GetRawValue)(THIS_ void *pData, UINT ByteOffset, UINT ByteCount) PURE; + + STDMETHOD(SetMatrix)(THIS_ float *pData) PURE; + STDMETHOD(GetMatrix)(THIS_ float *pData) PURE; + + STDMETHOD(SetMatrixArray)(THIS_ float *pData, UINT Offset, UINT Count) PURE; + STDMETHOD(GetMatrixArray)(THIS_ float *pData, UINT Offset, UINT Count) PURE; + + STDMETHOD(SetMatrixTranspose)(THIS_ float *pData) PURE; + STDMETHOD(GetMatrixTranspose)(THIS_ float *pData) PURE; + + STDMETHOD(SetMatrixTransposeArray)(THIS_ float *pData, UINT Offset, UINT Count) PURE; + STDMETHOD(GetMatrixTransposeArray)(THIS_ float *pData, UINT Offset, UINT Count) PURE; +}; + +////////////////////////////////////////////////////////////////////////////// +// ID3D10EffectStringVariable //////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +typedef interface ID3D10EffectStringVariable ID3D10EffectStringVariable; +typedef interface ID3D10EffectStringVariable *LPD3D10EFFECTSTRINGVARIABLE; + +// {71417501-8DF9-4e0a-A78A-255F9756BAFF} +DEFINE_GUID(IID_ID3D10EffectStringVariable, +0x71417501, 0x8df9, 0x4e0a, 0xa7, 0x8a, 0x25, 0x5f, 0x97, 0x56, 0xba, 0xff); + +#undef INTERFACE +#define INTERFACE ID3D10EffectStringVariable + +DECLARE_INTERFACE_(ID3D10EffectStringVariable, ID3D10EffectVariable) +{ + STDMETHOD_(BOOL, IsValid)(THIS) PURE; + STDMETHOD_(ID3D10EffectType*, GetType)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3D10_EFFECT_VARIABLE_DESC *pDesc) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByName)(THIS_ LPCSTR Name) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetMemberByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetMemberByName)(THIS_ LPCSTR Name) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetMemberBySemantic)(THIS_ LPCSTR Semantic) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetElement)(THIS_ UINT Index) PURE; + + STDMETHOD_(ID3D10EffectConstantBuffer*, GetParentConstantBuffer)(THIS) PURE; + + STDMETHOD_(ID3D10EffectScalarVariable*, AsScalar)(THIS) PURE; + STDMETHOD_(ID3D10EffectVectorVariable*, AsVector)(THIS) PURE; + STDMETHOD_(ID3D10EffectMatrixVariable*, AsMatrix)(THIS) PURE; + STDMETHOD_(ID3D10EffectStringVariable*, AsString)(THIS) PURE; + STDMETHOD_(ID3D10EffectShaderResourceVariable*, AsShaderResource)(THIS) PURE; + STDMETHOD_(ID3D10EffectRenderTargetViewVariable*, AsRenderTargetView)(THIS) PURE; + STDMETHOD_(ID3D10EffectDepthStencilViewVariable*, AsDepthStencilView)(THIS) PURE; + STDMETHOD_(ID3D10EffectConstantBuffer*, AsConstantBuffer)(THIS) PURE; + STDMETHOD_(ID3D10EffectShaderVariable*, AsShader)(THIS) PURE; + STDMETHOD_(ID3D10EffectBlendVariable*, AsBlend)(THIS) PURE; + STDMETHOD_(ID3D10EffectDepthStencilVariable*, AsDepthStencil)(THIS) PURE; + STDMETHOD_(ID3D10EffectRasterizerVariable*, AsRasterizer)(THIS) PURE; + STDMETHOD_(ID3D10EffectSamplerVariable*, AsSampler)(THIS) PURE; + + STDMETHOD(SetRawValue)(THIS_ void *pData, UINT Offset, UINT Count) PURE; + STDMETHOD(GetRawValue)(THIS_ void *pData, UINT Offset, UINT Count) PURE; + + STDMETHOD(GetString)(THIS_ LPCSTR *ppString) PURE; + STDMETHOD(GetStringArray)(THIS_ LPCSTR *ppStrings, UINT Offset, UINT Count) PURE; +}; + +////////////////////////////////////////////////////////////////////////////// +// ID3D10EffectShaderResourceVariable //////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +typedef interface ID3D10EffectShaderResourceVariable ID3D10EffectShaderResourceVariable; +typedef interface ID3D10EffectShaderResourceVariable *LPD3D10EFFECTSHADERRESOURCEVARIABLE; + +// {C0A7157B-D872-4b1d-8073-EFC2ACD4B1FC} +DEFINE_GUID(IID_ID3D10EffectShaderResourceVariable, +0xc0a7157b, 0xd872, 0x4b1d, 0x80, 0x73, 0xef, 0xc2, 0xac, 0xd4, 0xb1, 0xfc); + + +#undef INTERFACE +#define INTERFACE ID3D10EffectShaderResourceVariable + +DECLARE_INTERFACE_(ID3D10EffectShaderResourceVariable, ID3D10EffectVariable) +{ + STDMETHOD_(BOOL, IsValid)(THIS) PURE; + STDMETHOD_(ID3D10EffectType*, GetType)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3D10_EFFECT_VARIABLE_DESC *pDesc) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByName)(THIS_ LPCSTR Name) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetMemberByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetMemberByName)(THIS_ LPCSTR Name) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetMemberBySemantic)(THIS_ LPCSTR Semantic) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetElement)(THIS_ UINT Index) PURE; + + STDMETHOD_(ID3D10EffectConstantBuffer*, GetParentConstantBuffer)(THIS) PURE; + + STDMETHOD_(ID3D10EffectScalarVariable*, AsScalar)(THIS) PURE; + STDMETHOD_(ID3D10EffectVectorVariable*, AsVector)(THIS) PURE; + STDMETHOD_(ID3D10EffectMatrixVariable*, AsMatrix)(THIS) PURE; + STDMETHOD_(ID3D10EffectStringVariable*, AsString)(THIS) PURE; + STDMETHOD_(ID3D10EffectShaderResourceVariable*, AsShaderResource)(THIS) PURE; + STDMETHOD_(ID3D10EffectRenderTargetViewVariable*, AsRenderTargetView)(THIS) PURE; + STDMETHOD_(ID3D10EffectDepthStencilViewVariable*, AsDepthStencilView)(THIS) PURE; + STDMETHOD_(ID3D10EffectConstantBuffer*, AsConstantBuffer)(THIS) PURE; + STDMETHOD_(ID3D10EffectShaderVariable*, AsShader)(THIS) PURE; + STDMETHOD_(ID3D10EffectBlendVariable*, AsBlend)(THIS) PURE; + STDMETHOD_(ID3D10EffectDepthStencilVariable*, AsDepthStencil)(THIS) PURE; + STDMETHOD_(ID3D10EffectRasterizerVariable*, AsRasterizer)(THIS) PURE; + STDMETHOD_(ID3D10EffectSamplerVariable*, AsSampler)(THIS) PURE; + + STDMETHOD(SetRawValue)(THIS_ void *pData, UINT Offset, UINT Count) PURE; + STDMETHOD(GetRawValue)(THIS_ void *pData, UINT Offset, UINT Count) PURE; + + STDMETHOD(SetResource)(THIS_ ID3D10ShaderResourceView *pResource) PURE; + STDMETHOD(GetResource)(THIS_ ID3D10ShaderResourceView **ppResource) PURE; + + STDMETHOD(SetResourceArray)(THIS_ ID3D10ShaderResourceView **ppResources, UINT Offset, UINT Count) PURE; + STDMETHOD(GetResourceArray)(THIS_ ID3D10ShaderResourceView **ppResources, UINT Offset, UINT Count) PURE; +}; + +////////////////////////////////////////////////////////////////////////////// +// ID3D10EffectRenderTargetViewVariable ////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +typedef interface ID3D10EffectRenderTargetViewVariable ID3D10EffectRenderTargetViewVariable; +typedef interface ID3D10EffectRenderTargetViewVariable *LPD3D10EFFECTRENDERTARGETVIEWVARIABLE; + +// {28CA0CC3-C2C9-40bb-B57F-67B737122B17} +DEFINE_GUID(IID_ID3D10EffectRenderTargetViewVariable, +0x28ca0cc3, 0xc2c9, 0x40bb, 0xb5, 0x7f, 0x67, 0xb7, 0x37, 0x12, 0x2b, 0x17); + +#undef INTERFACE +#define INTERFACE ID3D10EffectRenderTargetViewVariable + +DECLARE_INTERFACE_(ID3D10EffectRenderTargetViewVariable, ID3D10EffectVariable) +{ + STDMETHOD_(BOOL, IsValid)(THIS) PURE; + STDMETHOD_(ID3D10EffectType*, GetType)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3D10_EFFECT_VARIABLE_DESC *pDesc) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByName)(THIS_ LPCSTR Name) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetMemberByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetMemberByName)(THIS_ LPCSTR Name) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetMemberBySemantic)(THIS_ LPCSTR Semantic) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetElement)(THIS_ UINT Index) PURE; + + STDMETHOD_(ID3D10EffectConstantBuffer*, GetParentConstantBuffer)(THIS) PURE; + + STDMETHOD_(ID3D10EffectScalarVariable*, AsScalar)(THIS) PURE; + STDMETHOD_(ID3D10EffectVectorVariable*, AsVector)(THIS) PURE; + STDMETHOD_(ID3D10EffectMatrixVariable*, AsMatrix)(THIS) PURE; + STDMETHOD_(ID3D10EffectStringVariable*, AsString)(THIS) PURE; + STDMETHOD_(ID3D10EffectShaderResourceVariable*, AsShaderResource)(THIS) PURE; + STDMETHOD_(ID3D10EffectRenderTargetViewVariable*, AsRenderTargetView)(THIS) PURE; + STDMETHOD_(ID3D10EffectDepthStencilViewVariable*, AsDepthStencilView)(THIS) PURE; + STDMETHOD_(ID3D10EffectConstantBuffer*, AsConstantBuffer)(THIS) PURE; + STDMETHOD_(ID3D10EffectShaderVariable*, AsShader)(THIS) PURE; + STDMETHOD_(ID3D10EffectBlendVariable*, AsBlend)(THIS) PURE; + STDMETHOD_(ID3D10EffectDepthStencilVariable*, AsDepthStencil)(THIS) PURE; + STDMETHOD_(ID3D10EffectRasterizerVariable*, AsRasterizer)(THIS) PURE; + STDMETHOD_(ID3D10EffectSamplerVariable*, AsSampler)(THIS) PURE; + + STDMETHOD(SetRawValue)(THIS_ void *pData, UINT Offset, UINT Count) PURE; + STDMETHOD(GetRawValue)(THIS_ void *pData, UINT Offset, UINT Count) PURE; + + STDMETHOD(SetRenderTarget)(THIS_ ID3D10RenderTargetView *pResource) PURE; + STDMETHOD(GetRenderTarget)(THIS_ ID3D10RenderTargetView **ppResource) PURE; + + STDMETHOD(SetRenderTargetArray)(THIS_ ID3D10RenderTargetView **ppResources, UINT Offset, UINT Count) PURE; + STDMETHOD(GetRenderTargetArray)(THIS_ ID3D10RenderTargetView **ppResources, UINT Offset, UINT Count) PURE; +}; + +////////////////////////////////////////////////////////////////////////////// +// ID3D10EffectDepthStencilViewVariable ////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +typedef interface ID3D10EffectDepthStencilViewVariable ID3D10EffectDepthStencilViewVariable; +typedef interface ID3D10EffectDepthStencilViewVariable *LPD3D10EFFECTDEPTHSTENCILVIEWVARIABLE; + +// {3E02C918-CC79-4985-B622-2D92AD701623} +DEFINE_GUID(IID_ID3D10EffectDepthStencilViewVariable, +0x3e02c918, 0xcc79, 0x4985, 0xb6, 0x22, 0x2d, 0x92, 0xad, 0x70, 0x16, 0x23); + +#undef INTERFACE +#define INTERFACE ID3D10EffectDepthStencilViewVariable + +DECLARE_INTERFACE_(ID3D10EffectDepthStencilViewVariable, ID3D10EffectVariable) +{ + STDMETHOD_(BOOL, IsValid)(THIS) PURE; + STDMETHOD_(ID3D10EffectType*, GetType)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3D10_EFFECT_VARIABLE_DESC *pDesc) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByName)(THIS_ LPCSTR Name) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetMemberByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetMemberByName)(THIS_ LPCSTR Name) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetMemberBySemantic)(THIS_ LPCSTR Semantic) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetElement)(THIS_ UINT Index) PURE; + + STDMETHOD_(ID3D10EffectConstantBuffer*, GetParentConstantBuffer)(THIS) PURE; + + STDMETHOD_(ID3D10EffectScalarVariable*, AsScalar)(THIS) PURE; + STDMETHOD_(ID3D10EffectVectorVariable*, AsVector)(THIS) PURE; + STDMETHOD_(ID3D10EffectMatrixVariable*, AsMatrix)(THIS) PURE; + STDMETHOD_(ID3D10EffectStringVariable*, AsString)(THIS) PURE; + STDMETHOD_(ID3D10EffectShaderResourceVariable*, AsShaderResource)(THIS) PURE; + STDMETHOD_(ID3D10EffectRenderTargetViewVariable*, AsRenderTargetView)(THIS) PURE; + STDMETHOD_(ID3D10EffectDepthStencilViewVariable*, AsDepthStencilView)(THIS) PURE; + STDMETHOD_(ID3D10EffectConstantBuffer*, AsConstantBuffer)(THIS) PURE; + STDMETHOD_(ID3D10EffectShaderVariable*, AsShader)(THIS) PURE; + STDMETHOD_(ID3D10EffectBlendVariable*, AsBlend)(THIS) PURE; + STDMETHOD_(ID3D10EffectDepthStencilVariable*, AsDepthStencil)(THIS) PURE; + STDMETHOD_(ID3D10EffectRasterizerVariable*, AsRasterizer)(THIS) PURE; + STDMETHOD_(ID3D10EffectSamplerVariable*, AsSampler)(THIS) PURE; + + STDMETHOD(SetRawValue)(THIS_ void *pData, UINT Offset, UINT Count) PURE; + STDMETHOD(GetRawValue)(THIS_ void *pData, UINT Offset, UINT Count) PURE; + + STDMETHOD(SetDepthStencil)(THIS_ ID3D10DepthStencilView *pResource) PURE; + STDMETHOD(GetDepthStencil)(THIS_ ID3D10DepthStencilView **ppResource) PURE; + + STDMETHOD(SetDepthStencilArray)(THIS_ ID3D10DepthStencilView **ppResources, UINT Offset, UINT Count) PURE; + STDMETHOD(GetDepthStencilArray)(THIS_ ID3D10DepthStencilView **ppResources, UINT Offset, UINT Count) PURE; +}; + +////////////////////////////////////////////////////////////////////////////// +// ID3D10EffectConstantBuffer //////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +typedef interface ID3D10EffectConstantBuffer ID3D10EffectConstantBuffer; +typedef interface ID3D10EffectConstantBuffer *LPD3D10EFFECTCONSTANTBUFFER; + +// {56648F4D-CC8B-4444-A5AD-B5A3D76E91B3} +DEFINE_GUID(IID_ID3D10EffectConstantBuffer, +0x56648f4d, 0xcc8b, 0x4444, 0xa5, 0xad, 0xb5, 0xa3, 0xd7, 0x6e, 0x91, 0xb3); + +#undef INTERFACE +#define INTERFACE ID3D10EffectConstantBuffer + +DECLARE_INTERFACE_(ID3D10EffectConstantBuffer, ID3D10EffectVariable) +{ + STDMETHOD_(ID3D10EffectType*, GetType)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3D10_EFFECT_VARIABLE_DESC *pDesc) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByName)(THIS_ LPCSTR Name) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetMemberByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetMemberByName)(THIS_ LPCSTR Name) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetMemberBySemantic)(THIS_ LPCSTR Semantic) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetElement)(THIS_ UINT Index) PURE; + + STDMETHOD_(ID3D10EffectConstantBuffer*, GetParentConstantBuffer)(THIS) PURE; + + STDMETHOD_(ID3D10EffectScalarVariable*, AsScalar)(THIS) PURE; + STDMETHOD_(ID3D10EffectVectorVariable*, AsVector)(THIS) PURE; + STDMETHOD_(ID3D10EffectMatrixVariable*, AsMatrix)(THIS) PURE; + STDMETHOD_(ID3D10EffectStringVariable*, AsString)(THIS) PURE; + STDMETHOD_(ID3D10EffectShaderResourceVariable*, AsShaderResource)(THIS) PURE; + STDMETHOD_(ID3D10EffectRenderTargetViewVariable*, AsRenderTargetView)(THIS) PURE; + STDMETHOD_(ID3D10EffectDepthStencilViewVariable*, AsDepthStencilView)(THIS) PURE; + STDMETHOD_(ID3D10EffectConstantBuffer*, AsConstantBuffer)(THIS) PURE; + STDMETHOD_(ID3D10EffectShaderVariable*, AsShader)(THIS) PURE; + STDMETHOD_(ID3D10EffectBlendVariable*, AsBlend)(THIS) PURE; + STDMETHOD_(ID3D10EffectDepthStencilVariable*, AsDepthStencil)(THIS) PURE; + STDMETHOD_(ID3D10EffectRasterizerVariable*, AsRasterizer)(THIS) PURE; + STDMETHOD_(ID3D10EffectSamplerVariable*, AsSampler)(THIS) PURE; + + STDMETHOD(SetRawValue)(THIS_ void *pData, UINT Offset, UINT Count) PURE; + STDMETHOD(GetRawValue)(THIS_ void *pData, UINT Offset, UINT Count) PURE; + + STDMETHOD(SetConstantBuffer)(THIS_ ID3D10Buffer *pConstantBuffer) PURE; + STDMETHOD(GetConstantBuffer)(THIS_ ID3D10Buffer **ppConstantBuffer) PURE; + + STDMETHOD(SetTextureBuffer)(THIS_ ID3D10ShaderResourceView *pTextureBuffer) PURE; + STDMETHOD(GetTextureBuffer)(THIS_ ID3D10ShaderResourceView **ppTextureBuffer) PURE; +}; + +////////////////////////////////////////////////////////////////////////////// +// ID3D10EffectShaderVariable //////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +//---------------------------------------------------------------------------- +// D3D10_EFFECT_SHADER_DESC: +// +// Retrieved by ID3D10EffectShaderVariable::GetShaderDesc() +//---------------------------------------------------------------------------- + +typedef struct _D3D10_EFFECT_SHADER_DESC +{ + CONST BYTE *pInputSignature; // Passed into CreateInputLayout, + // valid on VS and GS only + + BOOL IsInline; // Is this an anonymous shader variable + // resulting from an inline shader assignment? + + + // -- The following fields are not valid after Optimize() -- + CONST BYTE *pBytecode; // Shader bytecode + UINT BytecodeLength; + + LPCSTR SODecl; // Stream out declaration string (for GS with SO) + + UINT NumInputSignatureEntries; // Number of entries in the input signature + UINT NumOutputSignatureEntries; // Number of entries in the output signature +} D3D10_EFFECT_SHADER_DESC; + + +typedef interface ID3D10EffectShaderVariable ID3D10EffectShaderVariable; +typedef interface ID3D10EffectShaderVariable *LPD3D10EFFECTSHADERVARIABLE; + +// {80849279-C799-4797-8C33-0407A07D9E06} +DEFINE_GUID(IID_ID3D10EffectShaderVariable, +0x80849279, 0xc799, 0x4797, 0x8c, 0x33, 0x4, 0x7, 0xa0, 0x7d, 0x9e, 0x6); + +#undef INTERFACE +#define INTERFACE ID3D10EffectShaderVariable + +DECLARE_INTERFACE_(ID3D10EffectShaderVariable, ID3D10EffectVariable) +{ + STDMETHOD_(ID3D10EffectType*, GetType)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3D10_EFFECT_VARIABLE_DESC *pDesc) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByName)(THIS_ LPCSTR Name) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetMemberByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetMemberByName)(THIS_ LPCSTR Name) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetMemberBySemantic)(THIS_ LPCSTR Semantic) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetElement)(THIS_ UINT Index) PURE; + + STDMETHOD_(ID3D10EffectConstantBuffer*, GetParentConstantBuffer)(THIS) PURE; + + STDMETHOD_(ID3D10EffectScalarVariable*, AsScalar)(THIS) PURE; + STDMETHOD_(ID3D10EffectVectorVariable*, AsVector)(THIS) PURE; + STDMETHOD_(ID3D10EffectMatrixVariable*, AsMatrix)(THIS) PURE; + STDMETHOD_(ID3D10EffectStringVariable*, AsString)(THIS) PURE; + STDMETHOD_(ID3D10EffectShaderResourceVariable*, AsShaderResource)(THIS) PURE; + STDMETHOD_(ID3D10EffectRenderTargetViewVariable*, AsRenderTargetView)(THIS) PURE; + STDMETHOD_(ID3D10EffectDepthStencilViewVariable*, AsDepthStencilView)(THIS) PURE; + STDMETHOD_(ID3D10EffectConstantBuffer*, AsConstantBuffer)(THIS) PURE; + STDMETHOD_(ID3D10EffectShaderVariable*, AsShader)(THIS) PURE; + STDMETHOD_(ID3D10EffectBlendVariable*, AsBlend)(THIS) PURE; + STDMETHOD_(ID3D10EffectDepthStencilVariable*, AsDepthStencil)(THIS) PURE; + STDMETHOD_(ID3D10EffectRasterizerVariable*, AsRasterizer)(THIS) PURE; + STDMETHOD_(ID3D10EffectSamplerVariable*, AsSampler)(THIS) PURE; + + STDMETHOD(SetRawValue)(THIS_ void *pData, UINT Offset, UINT Count) PURE; + STDMETHOD(GetRawValue)(THIS_ void *pData, UINT Offset, UINT Count) PURE; + + STDMETHOD(GetShaderDesc)(THIS_ UINT ShaderIndex, D3D10_EFFECT_SHADER_DESC *pDesc) PURE; + + STDMETHOD(GetVertexShader)(THIS_ UINT ShaderIndex, ID3D10VertexShader **ppVS) PURE; + STDMETHOD(GetGeometryShader)(THIS_ UINT ShaderIndex, ID3D10GeometryShader **ppGS) PURE; + STDMETHOD(GetPixelShader)(THIS_ UINT ShaderIndex, ID3D10PixelShader **ppPS) PURE; + + STDMETHOD(GetInputSignatureElementDesc)(THIS_ UINT ShaderIndex, UINT Element, D3D10_SIGNATURE_PARAMETER_DESC *pDesc) PURE; + STDMETHOD(GetOutputSignatureElementDesc)(THIS_ UINT ShaderIndex, UINT Element, D3D10_SIGNATURE_PARAMETER_DESC *pDesc) PURE; +}; + +////////////////////////////////////////////////////////////////////////////// +// ID3D10EffectBlendVariable ///////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +typedef interface ID3D10EffectBlendVariable ID3D10EffectBlendVariable; +typedef interface ID3D10EffectBlendVariable *LPD3D10EFFECTBLENDVARIABLE; + +// {1FCD2294-DF6D-4eae-86B3-0E9160CFB07B} +DEFINE_GUID(IID_ID3D10EffectBlendVariable, +0x1fcd2294, 0xdf6d, 0x4eae, 0x86, 0xb3, 0xe, 0x91, 0x60, 0xcf, 0xb0, 0x7b); + +#undef INTERFACE +#define INTERFACE ID3D10EffectBlendVariable + +DECLARE_INTERFACE_(ID3D10EffectBlendVariable, ID3D10EffectVariable) +{ + STDMETHOD_(ID3D10EffectType*, GetType)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3D10_EFFECT_VARIABLE_DESC *pDesc) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByName)(THIS_ LPCSTR Name) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetMemberByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetMemberByName)(THIS_ LPCSTR Name) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetMemberBySemantic)(THIS_ LPCSTR Semantic) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetElement)(THIS_ UINT Index) PURE; + + STDMETHOD_(ID3D10EffectConstantBuffer*, GetParentConstantBuffer)(THIS) PURE; + + STDMETHOD_(ID3D10EffectScalarVariable*, AsScalar)(THIS) PURE; + STDMETHOD_(ID3D10EffectVectorVariable*, AsVector)(THIS) PURE; + STDMETHOD_(ID3D10EffectMatrixVariable*, AsMatrix)(THIS) PURE; + STDMETHOD_(ID3D10EffectStringVariable*, AsString)(THIS) PURE; + STDMETHOD_(ID3D10EffectShaderResourceVariable*, AsShaderResource)(THIS) PURE; + STDMETHOD_(ID3D10EffectRenderTargetViewVariable*, AsRenderTargetView)(THIS) PURE; + STDMETHOD_(ID3D10EffectDepthStencilViewVariable*, AsDepthStencilView)(THIS) PURE; + STDMETHOD_(ID3D10EffectConstantBuffer*, AsConstantBuffer)(THIS) PURE; + STDMETHOD_(ID3D10EffectShaderVariable*, AsShader)(THIS) PURE; + STDMETHOD_(ID3D10EffectBlendVariable*, AsBlend)(THIS) PURE; + STDMETHOD_(ID3D10EffectDepthStencilVariable*, AsDepthStencil)(THIS) PURE; + STDMETHOD_(ID3D10EffectRasterizerVariable*, AsRasterizer)(THIS) PURE; + STDMETHOD_(ID3D10EffectSamplerVariable*, AsSampler)(THIS) PURE; + + STDMETHOD(SetRawValue)(THIS_ void *pData, UINT Offset, UINT Count) PURE; + STDMETHOD(GetRawValue)(THIS_ void *pData, UINT Offset, UINT Count) PURE; + + STDMETHOD(GetBlendState)(THIS_ UINT Index, ID3D10BlendState **ppBlendState) PURE; + STDMETHOD(GetBackingStore)(THIS_ UINT Index, D3D10_BLEND_DESC *pBlendDesc) PURE; +}; + +////////////////////////////////////////////////////////////////////////////// +// ID3D10EffectDepthStencilVariable ////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +typedef interface ID3D10EffectDepthStencilVariable ID3D10EffectDepthStencilVariable; +typedef interface ID3D10EffectDepthStencilVariable *LPD3D10EFFECTDEPTHSTENCILVARIABLE; + +// {AF482368-330A-46a5-9A5C-01C71AF24C8D} +DEFINE_GUID(IID_ID3D10EffectDepthStencilVariable, +0xaf482368, 0x330a, 0x46a5, 0x9a, 0x5c, 0x1, 0xc7, 0x1a, 0xf2, 0x4c, 0x8d); + +#undef INTERFACE +#define INTERFACE ID3D10EffectDepthStencilVariable + +DECLARE_INTERFACE_(ID3D10EffectDepthStencilVariable, ID3D10EffectVariable) +{ + STDMETHOD_(ID3D10EffectType*, GetType)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3D10_EFFECT_VARIABLE_DESC *pDesc) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByName)(THIS_ LPCSTR Name) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetMemberByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetMemberByName)(THIS_ LPCSTR Name) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetMemberBySemantic)(THIS_ LPCSTR Semantic) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetElement)(THIS_ UINT Index) PURE; + + STDMETHOD_(ID3D10EffectConstantBuffer*, GetParentConstantBuffer)(THIS) PURE; + + STDMETHOD_(ID3D10EffectScalarVariable*, AsScalar)(THIS) PURE; + STDMETHOD_(ID3D10EffectVectorVariable*, AsVector)(THIS) PURE; + STDMETHOD_(ID3D10EffectMatrixVariable*, AsMatrix)(THIS) PURE; + STDMETHOD_(ID3D10EffectStringVariable*, AsString)(THIS) PURE; + STDMETHOD_(ID3D10EffectShaderResourceVariable*, AsShaderResource)(THIS) PURE; + STDMETHOD_(ID3D10EffectRenderTargetViewVariable*, AsRenderTargetView)(THIS) PURE; + STDMETHOD_(ID3D10EffectDepthStencilViewVariable*, AsDepthStencilView)(THIS) PURE; + STDMETHOD_(ID3D10EffectConstantBuffer*, AsConstantBuffer)(THIS) PURE; + STDMETHOD_(ID3D10EffectShaderVariable*, AsShader)(THIS) PURE; + STDMETHOD_(ID3D10EffectBlendVariable*, AsBlend)(THIS) PURE; + STDMETHOD_(ID3D10EffectDepthStencilVariable*, AsDepthStencil)(THIS) PURE; + STDMETHOD_(ID3D10EffectRasterizerVariable*, AsRasterizer)(THIS) PURE; + STDMETHOD_(ID3D10EffectSamplerVariable*, AsSampler)(THIS) PURE; + + STDMETHOD(SetRawValue)(THIS_ void *pData, UINT Offset, UINT Count) PURE; + STDMETHOD(GetRawValue)(THIS_ void *pData, UINT Offset, UINT Count) PURE; + + STDMETHOD(GetDepthStencilState)(THIS_ UINT Index, ID3D10DepthStencilState **ppDepthStencilState) PURE; + STDMETHOD(GetBackingStore)(THIS_ UINT Index, D3D10_DEPTH_STENCIL_DESC *pDepthStencilDesc) PURE; +}; + +////////////////////////////////////////////////////////////////////////////// +// ID3D10EffectRasterizerVariable //////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +typedef interface ID3D10EffectRasterizerVariable ID3D10EffectRasterizerVariable; +typedef interface ID3D10EffectRasterizerVariable *LPD3D10EFFECTRASTERIZERVARIABLE; + +// {21AF9F0E-4D94-4ea9-9785-2CB76B8C0B34} +DEFINE_GUID(IID_ID3D10EffectRasterizerVariable, +0x21af9f0e, 0x4d94, 0x4ea9, 0x97, 0x85, 0x2c, 0xb7, 0x6b, 0x8c, 0xb, 0x34); + +#undef INTERFACE +#define INTERFACE ID3D10EffectRasterizerVariable + +DECLARE_INTERFACE_(ID3D10EffectRasterizerVariable, ID3D10EffectVariable) +{ + STDMETHOD_(ID3D10EffectType*, GetType)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3D10_EFFECT_VARIABLE_DESC *pDesc) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByName)(THIS_ LPCSTR Name) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetMemberByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetMemberByName)(THIS_ LPCSTR Name) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetMemberBySemantic)(THIS_ LPCSTR Semantic) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetElement)(THIS_ UINT Index) PURE; + + STDMETHOD_(ID3D10EffectConstantBuffer*, GetParentConstantBuffer)(THIS) PURE; + + STDMETHOD_(ID3D10EffectScalarVariable*, AsScalar)(THIS) PURE; + STDMETHOD_(ID3D10EffectVectorVariable*, AsVector)(THIS) PURE; + STDMETHOD_(ID3D10EffectMatrixVariable*, AsMatrix)(THIS) PURE; + STDMETHOD_(ID3D10EffectStringVariable*, AsString)(THIS) PURE; + STDMETHOD_(ID3D10EffectShaderResourceVariable*, AsShaderResource)(THIS) PURE; + STDMETHOD_(ID3D10EffectRenderTargetViewVariable*, AsRenderTargetView)(THIS) PURE; + STDMETHOD_(ID3D10EffectDepthStencilViewVariable*, AsDepthStencilView)(THIS) PURE; + STDMETHOD_(ID3D10EffectConstantBuffer*, AsConstantBuffer)(THIS) PURE; + STDMETHOD_(ID3D10EffectShaderVariable*, AsShader)(THIS) PURE; + STDMETHOD_(ID3D10EffectBlendVariable*, AsBlend)(THIS) PURE; + STDMETHOD_(ID3D10EffectDepthStencilVariable*, AsDepthStencil)(THIS) PURE; + STDMETHOD_(ID3D10EffectRasterizerVariable*, AsRasterizer)(THIS) PURE; + STDMETHOD_(ID3D10EffectSamplerVariable*, AsSampler)(THIS) PURE; + + STDMETHOD(SetRawValue)(THIS_ void *pData, UINT Offset, UINT Count) PURE; + STDMETHOD(GetRawValue)(THIS_ void *pData, UINT Offset, UINT Count) PURE; + + STDMETHOD(GetRasterizerState)(THIS_ UINT Index, ID3D10RasterizerState **ppRasterizerState) PURE; + STDMETHOD(GetBackingStore)(THIS_ UINT Index, D3D10_RASTERIZER_DESC *pRasterizerDesc) PURE; +}; + +////////////////////////////////////////////////////////////////////////////// +// ID3D10EffectSamplerVariable /////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +typedef interface ID3D10EffectSamplerVariable ID3D10EffectSamplerVariable; +typedef interface ID3D10EffectSamplerVariable *LPD3D10EFFECTSAMPLERVARIABLE; + +// {6530D5C7-07E9-4271-A418-E7CE4BD1E480} +DEFINE_GUID(IID_ID3D10EffectSamplerVariable, +0x6530d5c7, 0x7e9, 0x4271, 0xa4, 0x18, 0xe7, 0xce, 0x4b, 0xd1, 0xe4, 0x80); + +#undef INTERFACE +#define INTERFACE ID3D10EffectSamplerVariable + +DECLARE_INTERFACE_(ID3D10EffectSamplerVariable, ID3D10EffectVariable) +{ + STDMETHOD_(ID3D10EffectType*, GetType)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3D10_EFFECT_VARIABLE_DESC *pDesc) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByName)(THIS_ LPCSTR Name) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetMemberByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetMemberByName)(THIS_ LPCSTR Name) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetMemberBySemantic)(THIS_ LPCSTR Semantic) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetElement)(THIS_ UINT Index) PURE; + + STDMETHOD_(ID3D10EffectConstantBuffer*, GetParentConstantBuffer)(THIS) PURE; + + STDMETHOD_(ID3D10EffectScalarVariable*, AsScalar)(THIS) PURE; + STDMETHOD_(ID3D10EffectVectorVariable*, AsVector)(THIS) PURE; + STDMETHOD_(ID3D10EffectMatrixVariable*, AsMatrix)(THIS) PURE; + STDMETHOD_(ID3D10EffectStringVariable*, AsString)(THIS) PURE; + STDMETHOD_(ID3D10EffectShaderResourceVariable*, AsShaderResource)(THIS) PURE; + STDMETHOD_(ID3D10EffectRenderTargetViewVariable*, AsRenderTargetView)(THIS) PURE; + STDMETHOD_(ID3D10EffectDepthStencilViewVariable*, AsDepthStencilView)(THIS) PURE; + STDMETHOD_(ID3D10EffectConstantBuffer*, AsConstantBuffer)(THIS) PURE; + STDMETHOD_(ID3D10EffectShaderVariable*, AsShader)(THIS) PURE; + STDMETHOD_(ID3D10EffectBlendVariable*, AsBlend)(THIS) PURE; + STDMETHOD_(ID3D10EffectDepthStencilVariable*, AsDepthStencil)(THIS) PURE; + STDMETHOD_(ID3D10EffectRasterizerVariable*, AsRasterizer)(THIS) PURE; + STDMETHOD_(ID3D10EffectSamplerVariable*, AsSampler)(THIS) PURE; + + STDMETHOD(SetRawValue)(THIS_ void *pData, UINT Offset, UINT Count) PURE; + STDMETHOD(GetRawValue)(THIS_ void *pData, UINT Offset, UINT Count) PURE; + + STDMETHOD(GetSampler)(THIS_ UINT Index, ID3D10SamplerState **ppSampler) PURE; + STDMETHOD(GetBackingStore)(THIS_ UINT Index, D3D10_SAMPLER_DESC *pSamplerDesc) PURE; +}; + +////////////////////////////////////////////////////////////////////////////// +// ID3D10EffectPass ////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +//---------------------------------------------------------------------------- +// D3D10_PASS_DESC: +// +// Retrieved by ID3D10EffectPass::GetDesc() +//---------------------------------------------------------------------------- + +typedef struct _D3D10_PASS_DESC +{ + LPCSTR Name; // Name of this pass (NULL if not anonymous) + UINT Annotations; // Number of annotations on this pass + + BYTE *pIAInputSignature; // Signature from VS or GS (if there is no VS) + // or NULL if neither exists + SIZE_T IAInputSignatureSize; // Singature size in bytes + + UINT StencilRef; // Specified in SetDepthStencilState() + UINT SampleMask; // Specified in SetBlendState() + FLOAT BlendFactor[4]; // Specified in SetBlendState() +} D3D10_PASS_DESC; + +//---------------------------------------------------------------------------- +// D3D10_PASS_SHADER_DESC: +// +// Retrieved by ID3D10EffectPass::Get**ShaderDesc() +//---------------------------------------------------------------------------- + +typedef struct _D3D10_PASS_SHADER_DESC +{ + ID3D10EffectShaderVariable *pShaderVariable; // The variable that this shader came from. + // If this is an inline shader assignment, + // the returned interface will be an + // anonymous shader variable, which is + // not retrievable any other way. It's + // name in the variable description will + // be "$Anonymous". + // If there is no assignment of this type in + // the pass block, pShaderVariable != NULL, + // but pShaderVariable->IsValid() == FALSE. + + UINT ShaderIndex; // The element of pShaderVariable (if an array) + // or 0 if not applicable +} D3D10_PASS_SHADER_DESC; + +typedef interface ID3D10EffectPass ID3D10EffectPass; +typedef interface ID3D10EffectPass *LPD3D10EFFECTPASS; + +// {5CFBEB89-1A06-46e0-B282-E3F9BFA36A54} +DEFINE_GUID(IID_ID3D10EffectPass, +0x5cfbeb89, 0x1a06, 0x46e0, 0xb2, 0x82, 0xe3, 0xf9, 0xbf, 0xa3, 0x6a, 0x54); + +#undef INTERFACE +#define INTERFACE ID3D10EffectPass + +DECLARE_INTERFACE(ID3D10EffectPass) +{ + STDMETHOD_(BOOL, IsValid)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3D10_PASS_DESC *pDesc) PURE; + + STDMETHOD(GetVertexShaderDesc)(THIS_ D3D10_PASS_SHADER_DESC *pDesc) PURE; + STDMETHOD(GetGeometryShaderDesc)(THIS_ D3D10_PASS_SHADER_DESC *pDesc) PURE; + STDMETHOD(GetPixelShaderDesc)(THIS_ D3D10_PASS_SHADER_DESC *pDesc) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByName)(THIS_ LPCSTR Name) PURE; + + STDMETHOD(Apply)(THIS_ UINT Flags) PURE; + + STDMETHOD(ComputeStateBlockMask)(THIS_ D3D10_STATE_BLOCK_MASK *pStateBlockMask) PURE; +}; + +////////////////////////////////////////////////////////////////////////////// +// ID3D10EffectTechnique ///////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +//---------------------------------------------------------------------------- +// D3D10_TECHNIQUE_DESC: +// +// Retrieved by ID3D10EffectTechnique::GetDesc() +//---------------------------------------------------------------------------- + +typedef struct _D3D10_TECHNIQUE_DESC +{ + LPCSTR Name; // Name of this technique (NULL if not anonymous) + UINT Passes; // Number of passes contained within + UINT Annotations; // Number of annotations on this technique +} D3D10_TECHNIQUE_DESC; + +typedef interface ID3D10EffectTechnique ID3D10EffectTechnique; +typedef interface ID3D10EffectTechnique *LPD3D10EFFECTTECHNIQUE; + +// {DB122CE8-D1C9-4292-B237-24ED3DE8B175} +DEFINE_GUID(IID_ID3D10EffectTechnique, +0xdb122ce8, 0xd1c9, 0x4292, 0xb2, 0x37, 0x24, 0xed, 0x3d, 0xe8, 0xb1, 0x75); + +#undef INTERFACE +#define INTERFACE ID3D10EffectTechnique + +DECLARE_INTERFACE(ID3D10EffectTechnique) +{ + STDMETHOD_(BOOL, IsValid)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3D10_TECHNIQUE_DESC *pDesc) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByName)(THIS_ LPCSTR Name) PURE; + + STDMETHOD_(ID3D10EffectPass*, GetPassByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectPass*, GetPassByName)(THIS_ LPCSTR Name) PURE; + + STDMETHOD(ComputeStateBlockMask)(THIS_ D3D10_STATE_BLOCK_MASK *pStateBlockMask) PURE; +}; + +////////////////////////////////////////////////////////////////////////////// +// ID3D10Effect ////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +//---------------------------------------------------------------------------- +// D3D10_EFFECT_DESC: +// +// Retrieved by ID3D10Effect::GetDesc() +//---------------------------------------------------------------------------- + +typedef struct _D3D10_EFFECT_DESC +{ + + BOOL IsChildEffect; // TRUE if this is a child effect, + // FALSE if this is standalone or an effect pool. + + UINT ConstantBuffers; // Number of constant buffers in this effect, + // excluding the effect pool. + UINT SharedConstantBuffers; // Number of constant buffers shared in this + // effect's pool. + + UINT GlobalVariables; // Number of global variables in this effect, + // excluding the effect pool. + UINT SharedGlobalVariables; // Number of global variables shared in this + // effect's pool. + + UINT Techniques; // Number of techniques in this effect, + // excluding the effect pool. +} D3D10_EFFECT_DESC; + +typedef interface ID3D10Effect ID3D10Effect; +typedef interface ID3D10Effect *LPD3D10EFFECT; + +// {51B0CA8B-EC0B-4519-870D-8EE1CB5017C7} +DEFINE_GUID(IID_ID3D10Effect, +0x51b0ca8b, 0xec0b, 0x4519, 0x87, 0xd, 0x8e, 0xe1, 0xcb, 0x50, 0x17, 0xc7); + +#undef INTERFACE +#define INTERFACE ID3D10Effect + +DECLARE_INTERFACE_(ID3D10Effect, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + STDMETHOD_(BOOL, IsValid)(THIS) PURE; + STDMETHOD_(BOOL, IsPool)(THIS) PURE; + + // Managing D3D Device + STDMETHOD(GetDevice)(THIS_ ID3D10Device** ppDevice) PURE; + + // New Reflection APIs + STDMETHOD(GetDesc)(THIS_ D3D10_EFFECT_DESC *pDesc) PURE; + + STDMETHOD_(ID3D10EffectConstantBuffer*, GetConstantBufferByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectConstantBuffer*, GetConstantBufferByName)(THIS_ LPCSTR Name) PURE; + + STDMETHOD_(ID3D10EffectVariable*, GetVariableByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetVariableByName)(THIS_ LPCSTR Name) PURE; + STDMETHOD_(ID3D10EffectVariable*, GetVariableBySemantic)(THIS_ LPCSTR Semantic) PURE; + + STDMETHOD_(ID3D10EffectTechnique*, GetTechniqueByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10EffectTechnique*, GetTechniqueByName)(THIS_ LPCSTR Name) PURE; + + STDMETHOD(Optimize)(THIS) PURE; + STDMETHOD_(BOOL, IsOptimized)(THIS) PURE; + +}; + +////////////////////////////////////////////////////////////////////////////// +// ID3D10EffectPool ////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +typedef interface ID3D10EffectPool ID3D10EffectPool; +typedef interface ID3D10EffectPool *LPD3D10EFFECTPOOL; + +// {9537AB04-3250-412e-8213-FCD2F8677933} +DEFINE_GUID(IID_ID3D10EffectPool, +0x9537ab04, 0x3250, 0x412e, 0x82, 0x13, 0xfc, 0xd2, 0xf8, 0x67, 0x79, 0x33); + +#undef INTERFACE +#define INTERFACE ID3D10EffectPool + +DECLARE_INTERFACE_(ID3D10EffectPool, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + STDMETHOD_(ID3D10Effect*, AsEffect)(THIS) PURE; + + // No public methods +}; + +////////////////////////////////////////////////////////////////////////////// +// APIs ////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + +//---------------------------------------------------------------------------- +// D3D10CreateEffectFromXXXX: +// -------------------------- +// Creates an effect from a binary effect or file +// +// Parameters: +// +// [in] +// +// +// pData +// Blob of effect data, either ASCII (uncompiled, for D3D10CompileEffectFromMemory) or binary (compiled, for D3D10CreateEffect*) +// DataLength +// Length of the data blob +// +// pSrcFileName +// Name of the ASCII Effect file pData was obtained from +// +// pDefines +// Optional NULL-terminated array of preprocessor macro definitions. +// pInclude +// Optional interface pointer to use for handling #include directives. +// If this parameter is NULL, #includes will be honored when compiling +// from file, and will error when compiling from resource or memory. +// HLSLFlags +// Compilation flags pertaining to shaders and data types, honored by +// the HLSL compiler +// FXFlags +// Compilation flags pertaining to Effect compilation, honored +// by the Effect compiler +// pDevice +// Pointer to the D3D10 device on which to create Effect resources +// pEffectPool +// Pointer to an Effect pool to share variables with or NULL +// +// [out] +// +// ppEffect +// Address of the newly created Effect interface +// ppEffectPool +// Address of the newly created Effect pool interface +// ppErrors +// If non-NULL, address of a buffer with error messages that occurred +// during parsing or compilation +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI D3D10CompileEffectFromMemory(void *pData, SIZE_T DataLength, LPCSTR pSrcFileName, CONST D3D10_SHADER_MACRO *pDefines, + ID3D10Include *pInclude, UINT HLSLFlags, UINT FXFlags, + ID3D10Blob **ppCompiledEffect, ID3D10Blob **ppErrors); + +HRESULT WINAPI D3D10CreateEffectFromMemory(void *pData, SIZE_T DataLength, UINT FXFlags, ID3D10Device *pDevice, + ID3D10EffectPool *pEffectPool, ID3D10Effect **ppEffect); + +HRESULT WINAPI D3D10CreateEffectPoolFromMemory(void *pData, SIZE_T DataLength, UINT FXFlags, ID3D10Device *pDevice, + ID3D10EffectPool **ppEffectPool); + + +//---------------------------------------------------------------------------- +// D3D10DisassembleEffect: +// ----------------------- +// Takes an effect interface, and returns a buffer containing text assembly. +// +// Parameters: +// pEffect +// Pointer to the runtime effect interface. +// EnableColorCode +// Emit HTML tags for color coding the output? +// ppDisassembly +// Returns a buffer containing the disassembled effect. +//---------------------------------------------------------------------------- + +HRESULT WINAPI D3D10DisassembleEffect(ID3D10Effect *pEffect, BOOL EnableColorCode, ID3D10Blob **ppDisassembly); + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif //__D3D10EFFECT_H__ + + diff --git a/MediaClient/MediaClient/directx/include/D3D10shader.h b/MediaClient/MediaClient/directx/include/D3D10shader.h new file mode 100644 index 0000000..d5a8a7f --- /dev/null +++ b/MediaClient/MediaClient/directx/include/D3D10shader.h @@ -0,0 +1,534 @@ +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// File: D3D10Shader.h +// Content: D3D10 Shader Types and APIs +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef __D3D10SHADER_H__ +#define __D3D10SHADER_H__ + +#include "d3d10.h" + + +//--------------------------------------------------------------------------- +// D3D10_TX_VERSION: +// -------------- +// Version token used to create a procedural texture filler in effects +// Used by D3D10Fill[]TX functions +//--------------------------------------------------------------------------- +#define D3D10_TX_VERSION(_Major,_Minor) (('T' << 24) | ('X' << 16) | ((_Major) << 8) | (_Minor)) + + +//---------------------------------------------------------------------------- +// D3D10SHADER flags: +// ----------------- +// D3D10_SHADER_DEBUG +// Insert debug file/line/type/symbol information. +// +// D3D10_SHADER_SKIP_VALIDATION +// Do not validate the generated code against known capabilities and +// constraints. This option is only recommended when compiling shaders +// you KNOW will work. (ie. have compiled before without this option.) +// Shaders are always validated by D3D before they are set to the device. +// +// D3D10_SHADER_SKIP_OPTIMIZATION +// Instructs the compiler to skip optimization steps during code generation. +// Unless you are trying to isolate a problem in your code using this option +// is not recommended. +// +// D3D10_SHADER_PACK_MATRIX_ROW_MAJOR +// Unless explicitly specified, matrices will be packed in row-major order +// on input and output from the shader. +// +// D3D10_SHADER_PACK_MATRIX_COLUMN_MAJOR +// Unless explicitly specified, matrices will be packed in column-major +// order on input and output from the shader. This is generally more +// efficient, since it allows vector-matrix multiplication to be performed +// using a series of dot-products. +// +// D3D10_SHADER_PARTIAL_PRECISION +// Force all computations in resulting shader to occur at partial precision. +// This may result in faster evaluation of shaders on some hardware. +// +// D3D10_SHADER_FORCE_VS_SOFTWARE_NO_OPT +// Force compiler to compile against the next highest available software +// target for vertex shaders. This flag also turns optimizations off, +// and debugging on. +// +// D3D10_SHADER_FORCE_PS_SOFTWARE_NO_OPT +// Force compiler to compile against the next highest available software +// target for pixel shaders. This flag also turns optimizations off, +// and debugging on. +// +// D3D10_SHADER_NO_PRESHADER +// Disables Preshaders. Using this flag will cause the compiler to not +// pull out static expression for evaluation on the host cpu +// +// D3D10_SHADER_AVOID_FLOW_CONTROL +// Hint compiler to avoid flow-control constructs where possible. +// +// D3D10_SHADER_PREFER_FLOW_CONTROL +// Hint compiler to prefer flow-control constructs where possible. +// +// D3D10_SHADER_ENABLE_STRICTNESS +// By default, the HLSL/Effect compilers are not strict on deprecated syntax. +// Specifying this flag enables the strict mode. Deprecated syntax may be +// removed in a future release, and enabling syntax is a good way to make sure +// your shaders comply to the latest spec. +// +// D3D10_SHADER_ENABLE_BACKWARDS_COMPATIBILITY +// This enables older shaders to compile to 4_0 targets. +// +//---------------------------------------------------------------------------- + +#define D3D10_SHADER_DEBUG (1 << 0) +#define D3D10_SHADER_SKIP_VALIDATION (1 << 1) +#define D3D10_SHADER_SKIP_OPTIMIZATION (1 << 2) +#define D3D10_SHADER_PACK_MATRIX_ROW_MAJOR (1 << 3) +#define D3D10_SHADER_PACK_MATRIX_COLUMN_MAJOR (1 << 4) +#define D3D10_SHADER_PARTIAL_PRECISION (1 << 5) +#define D3D10_SHADER_FORCE_VS_SOFTWARE_NO_OPT (1 << 6) +#define D3D10_SHADER_FORCE_PS_SOFTWARE_NO_OPT (1 << 7) +#define D3D10_SHADER_NO_PRESHADER (1 << 8) +#define D3D10_SHADER_AVOID_FLOW_CONTROL (1 << 9) +#define D3D10_SHADER_PREFER_FLOW_CONTROL (1 << 10) +#define D3D10_SHADER_ENABLE_STRICTNESS (1 << 11) +#define D3D10_SHADER_ENABLE_BACKWARDS_COMPATIBILITY (1 << 12) +#define D3D10_SHADER_IEEE_STRICTNESS (1 << 13) +#define D3D10_SHADER_WARNINGS_ARE_ERRORS (1 << 18) + + +// optimization level flags +#define D3D10_SHADER_OPTIMIZATION_LEVEL0 (1 << 14) +#define D3D10_SHADER_OPTIMIZATION_LEVEL1 0 +#define D3D10_SHADER_OPTIMIZATION_LEVEL2 ((1 << 14) | (1 << 15)) +#define D3D10_SHADER_OPTIMIZATION_LEVEL3 (1 << 15) + + + + +typedef D3D_SHADER_MACRO D3D10_SHADER_MACRO; +typedef D3D10_SHADER_MACRO* LPD3D10_SHADER_MACRO; + + +typedef D3D_SHADER_VARIABLE_CLASS D3D10_SHADER_VARIABLE_CLASS; +typedef D3D10_SHADER_VARIABLE_CLASS* LPD3D10_SHADER_VARIABLE_CLASS; + +typedef D3D_SHADER_VARIABLE_FLAGS D3D10_SHADER_VARIABLE_FLAGS; +typedef D3D10_SHADER_VARIABLE_FLAGS* LPD3D10_SHADER_VARIABLE_FLAGS; + +typedef D3D_SHADER_VARIABLE_TYPE D3D10_SHADER_VARIABLE_TYPE; +typedef D3D10_SHADER_VARIABLE_TYPE* LPD3D10_SHADER_VARIABLE_TYPE; + +typedef D3D_SHADER_INPUT_FLAGS D3D10_SHADER_INPUT_FLAGS; +typedef D3D10_SHADER_INPUT_FLAGS* LPD3D10_SHADER_INPUT_FLAGS; + +typedef D3D_SHADER_INPUT_TYPE D3D10_SHADER_INPUT_TYPE; +typedef D3D10_SHADER_INPUT_TYPE* LPD3D10_SHADER_INPUT_TYPE; + +typedef D3D_SHADER_CBUFFER_FLAGS D3D10_SHADER_CBUFFER_FLAGS; +typedef D3D10_SHADER_CBUFFER_FLAGS* LPD3D10_SHADER_CBUFFER_FLAGS; + +typedef D3D_CBUFFER_TYPE D3D10_CBUFFER_TYPE; +typedef D3D10_CBUFFER_TYPE* LPD3D10_CBUFFER_TYPE; + +typedef D3D_NAME D3D10_NAME; + +typedef D3D_RESOURCE_RETURN_TYPE D3D10_RESOURCE_RETURN_TYPE; + +typedef D3D_REGISTER_COMPONENT_TYPE D3D10_REGISTER_COMPONENT_TYPE; + +typedef D3D_INCLUDE_TYPE D3D10_INCLUDE_TYPE; + +// ID3D10Include has been made version-neutral and moved to d3dcommon.h. +typedef interface ID3DInclude ID3D10Include; +typedef interface ID3DInclude* LPD3D10INCLUDE; +#define IID_ID3D10Include IID_ID3DInclude + + +//---------------------------------------------------------------------------- +// ID3D10ShaderReflection: +//---------------------------------------------------------------------------- + +// +// Structure definitions +// + +typedef struct _D3D10_SHADER_DESC +{ + UINT Version; // Shader version + LPCSTR Creator; // Creator string + UINT Flags; // Shader compilation/parse flags + + UINT ConstantBuffers; // Number of constant buffers + UINT BoundResources; // Number of bound resources + UINT InputParameters; // Number of parameters in the input signature + UINT OutputParameters; // Number of parameters in the output signature + + UINT InstructionCount; // Number of emitted instructions + UINT TempRegisterCount; // Number of temporary registers used + UINT TempArrayCount; // Number of temporary arrays used + UINT DefCount; // Number of constant defines + UINT DclCount; // Number of declarations (input + output) + UINT TextureNormalInstructions; // Number of non-categorized texture instructions + UINT TextureLoadInstructions; // Number of texture load instructions + UINT TextureCompInstructions; // Number of texture comparison instructions + UINT TextureBiasInstructions; // Number of texture bias instructions + UINT TextureGradientInstructions; // Number of texture gradient instructions + UINT FloatInstructionCount; // Number of floating point arithmetic instructions used + UINT IntInstructionCount; // Number of signed integer arithmetic instructions used + UINT UintInstructionCount; // Number of unsigned integer arithmetic instructions used + UINT StaticFlowControlCount; // Number of static flow control instructions used + UINT DynamicFlowControlCount; // Number of dynamic flow control instructions used + UINT MacroInstructionCount; // Number of macro instructions used + UINT ArrayInstructionCount; // Number of array instructions used + UINT CutInstructionCount; // Number of cut instructions used + UINT EmitInstructionCount; // Number of emit instructions used + D3D10_PRIMITIVE_TOPOLOGY GSOutputTopology; // Geometry shader output topology + UINT GSMaxOutputVertexCount; // Geometry shader maximum output vertex count +} D3D10_SHADER_DESC; + +typedef struct _D3D10_SHADER_BUFFER_DESC +{ + LPCSTR Name; // Name of the constant buffer + D3D10_CBUFFER_TYPE Type; // Indicates that this is a CBuffer or TBuffer + UINT Variables; // Number of member variables + UINT Size; // Size of CB (in bytes) + UINT uFlags; // Buffer description flags +} D3D10_SHADER_BUFFER_DESC; + +typedef struct _D3D10_SHADER_VARIABLE_DESC +{ + LPCSTR Name; // Name of the variable + UINT StartOffset; // Offset in constant buffer's backing store + UINT Size; // Size of variable (in bytes) + UINT uFlags; // Variable flags + LPVOID DefaultValue; // Raw pointer to default value +} D3D10_SHADER_VARIABLE_DESC; + +typedef struct _D3D10_SHADER_TYPE_DESC +{ + D3D10_SHADER_VARIABLE_CLASS Class; // Variable class (e.g. object, matrix, etc.) + D3D10_SHADER_VARIABLE_TYPE Type; // Variable type (e.g. float, sampler, etc.) + UINT Rows; // Number of rows (for matrices, 1 for other numeric, 0 if not applicable) + UINT Columns; // Number of columns (for vectors & matrices, 1 for other numeric, 0 if not applicable) + UINT Elements; // Number of elements (0 if not an array) + UINT Members; // Number of members (0 if not a structure) + UINT Offset; // Offset from the start of structure (0 if not a structure member) +} D3D10_SHADER_TYPE_DESC; + +typedef struct _D3D10_SHADER_INPUT_BIND_DESC +{ + LPCSTR Name; // Name of the resource + D3D10_SHADER_INPUT_TYPE Type; // Type of resource (e.g. texture, cbuffer, etc.) + UINT BindPoint; // Starting bind point + UINT BindCount; // Number of contiguous bind points (for arrays) + + UINT uFlags; // Input binding flags + D3D10_RESOURCE_RETURN_TYPE ReturnType; // Return type (if texture) + D3D10_SRV_DIMENSION Dimension; // Dimension (if texture) + UINT NumSamples; // Number of samples (0 if not MS texture) +} D3D10_SHADER_INPUT_BIND_DESC; + +typedef struct _D3D10_SIGNATURE_PARAMETER_DESC +{ + LPCSTR SemanticName; // Name of the semantic + UINT SemanticIndex; // Index of the semantic + UINT Register; // Number of member variables + D3D10_NAME SystemValueType;// A predefined system value, or D3D10_NAME_UNDEFINED if not applicable + D3D10_REGISTER_COMPONENT_TYPE ComponentType;// Scalar type (e.g. uint, float, etc.) + BYTE Mask; // Mask to indicate which components of the register + // are used (combination of D3D10_COMPONENT_MASK values) + BYTE ReadWriteMask; // Mask to indicate whether a given component is + // never written (if this is an output signature) or + // always read (if this is an input signature). + // (combination of D3D10_COMPONENT_MASK values) + +} D3D10_SIGNATURE_PARAMETER_DESC; + + +// +// Interface definitions +// + +typedef interface ID3D10ShaderReflectionType ID3D10ShaderReflectionType; +typedef interface ID3D10ShaderReflectionType *LPD3D10SHADERREFLECTIONTYPE; + +// {C530AD7D-9B16-4395-A979-BA2ECFF83ADD} +DEFINE_GUID(IID_ID3D10ShaderReflectionType, +0xc530ad7d, 0x9b16, 0x4395, 0xa9, 0x79, 0xba, 0x2e, 0xcf, 0xf8, 0x3a, 0xdd); + +#undef INTERFACE +#define INTERFACE ID3D10ShaderReflectionType + +DECLARE_INTERFACE(ID3D10ShaderReflectionType) +{ + STDMETHOD(GetDesc)(THIS_ D3D10_SHADER_TYPE_DESC *pDesc) PURE; + + STDMETHOD_(ID3D10ShaderReflectionType*, GetMemberTypeByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10ShaderReflectionType*, GetMemberTypeByName)(THIS_ LPCSTR Name) PURE; + STDMETHOD_(LPCSTR, GetMemberTypeName)(THIS_ UINT Index) PURE; +}; + +typedef interface ID3D10ShaderReflectionVariable ID3D10ShaderReflectionVariable; +typedef interface ID3D10ShaderReflectionVariable *LPD3D10SHADERREFLECTIONVARIABLE; + +// {1BF63C95-2650-405d-99C1-3636BD1DA0A1} +DEFINE_GUID(IID_ID3D10ShaderReflectionVariable, +0x1bf63c95, 0x2650, 0x405d, 0x99, 0xc1, 0x36, 0x36, 0xbd, 0x1d, 0xa0, 0xa1); + +#undef INTERFACE +#define INTERFACE ID3D10ShaderReflectionVariable + +DECLARE_INTERFACE(ID3D10ShaderReflectionVariable) +{ + STDMETHOD(GetDesc)(THIS_ D3D10_SHADER_VARIABLE_DESC *pDesc) PURE; + + STDMETHOD_(ID3D10ShaderReflectionType*, GetType)(THIS) PURE; +}; + +typedef interface ID3D10ShaderReflectionConstantBuffer ID3D10ShaderReflectionConstantBuffer; +typedef interface ID3D10ShaderReflectionConstantBuffer *LPD3D10SHADERREFLECTIONCONSTANTBUFFER; + +// {66C66A94-DDDD-4b62-A66A-F0DA33C2B4D0} +DEFINE_GUID(IID_ID3D10ShaderReflectionConstantBuffer, +0x66c66a94, 0xdddd, 0x4b62, 0xa6, 0x6a, 0xf0, 0xda, 0x33, 0xc2, 0xb4, 0xd0); + +#undef INTERFACE +#define INTERFACE ID3D10ShaderReflectionConstantBuffer + +DECLARE_INTERFACE(ID3D10ShaderReflectionConstantBuffer) +{ + STDMETHOD(GetDesc)(THIS_ D3D10_SHADER_BUFFER_DESC *pDesc) PURE; + + STDMETHOD_(ID3D10ShaderReflectionVariable*, GetVariableByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10ShaderReflectionVariable*, GetVariableByName)(THIS_ LPCSTR Name) PURE; +}; + +typedef interface ID3D10ShaderReflection ID3D10ShaderReflection; +typedef interface ID3D10ShaderReflection *LPD3D10SHADERREFLECTION; + +// {D40E20B6-F8F7-42ad-AB20-4BAF8F15DFAA} +DEFINE_GUID(IID_ID3D10ShaderReflection, +0xd40e20b6, 0xf8f7, 0x42ad, 0xab, 0x20, 0x4b, 0xaf, 0x8f, 0x15, 0xdf, 0xaa); + +#undef INTERFACE +#define INTERFACE ID3D10ShaderReflection + +DECLARE_INTERFACE_(ID3D10ShaderReflection, IUnknown) +{ + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + STDMETHOD(GetDesc)(THIS_ D3D10_SHADER_DESC *pDesc) PURE; + + STDMETHOD_(ID3D10ShaderReflectionConstantBuffer*, GetConstantBufferByIndex)(THIS_ UINT Index) PURE; + STDMETHOD_(ID3D10ShaderReflectionConstantBuffer*, GetConstantBufferByName)(THIS_ LPCSTR Name) PURE; + + STDMETHOD(GetResourceBindingDesc)(THIS_ UINT ResourceIndex, D3D10_SHADER_INPUT_BIND_DESC *pDesc) PURE; + + STDMETHOD(GetInputParameterDesc)(THIS_ UINT ParameterIndex, D3D10_SIGNATURE_PARAMETER_DESC *pDesc) PURE; + STDMETHOD(GetOutputParameterDesc)(THIS_ UINT ParameterIndex, D3D10_SIGNATURE_PARAMETER_DESC *pDesc) PURE; + +}; + +////////////////////////////////////////////////////////////////////////////// +// APIs ////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + + +//---------------------------------------------------------------------------- +// D3D10CompileShader: +// ------------------ +// Compiles a shader. +// +// Parameters: +// pSrcFile +// Source file name. +// hSrcModule +// Module handle. if NULL, current module will be used. +// pSrcResource +// Resource name in module. +// pSrcData +// Pointer to source code. +// SrcDataLen +// Size of source code, in bytes. +// pDefines +// Optional NULL-terminated array of preprocessor macro definitions. +// pInclude +// Optional interface pointer to use for handling #include directives. +// If this parameter is NULL, #includes will be honored when compiling +// from file, and will error when compiling from resource or memory. +// pFunctionName +// Name of the entrypoint function where execution should begin. +// pProfile +// Instruction set to be used when generating code. The D3D10 entry +// point currently supports only "vs_4_0", "ps_4_0", and "gs_4_0". +// Flags +// See D3D10_SHADER_xxx flags. +// ppShader +// Returns a buffer containing the created shader. This buffer contains +// the compiled shader code, as well as any embedded debug and symbol +// table info. (See D3D10GetShaderConstantTable) +// ppErrorMsgs +// Returns a buffer containing a listing of errors and warnings that were +// encountered during the compile. If you are running in a debugger, +// these are the same messages you will see in your debug output. +//---------------------------------------------------------------------------- + +HRESULT WINAPI D3D10CompileShader(LPCSTR pSrcData, SIZE_T SrcDataLen, LPCSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines, LPD3D10INCLUDE pInclude, + LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags, ID3D10Blob** ppShader, ID3D10Blob** ppErrorMsgs); + +//---------------------------------------------------------------------------- +// D3D10DisassembleShader: +// ---------------------- +// Takes a binary shader, and returns a buffer containing text assembly. +// +// Parameters: +// pShader +// Pointer to the shader byte code. +// BytecodeLength +// Size of the shader byte code in bytes. +// EnableColorCode +// Emit HTML tags for color coding the output? +// pComments +// Pointer to a comment string to include at the top of the shader. +// ppDisassembly +// Returns a buffer containing the disassembled shader. +//---------------------------------------------------------------------------- + +HRESULT WINAPI D3D10DisassembleShader(CONST void *pShader, SIZE_T BytecodeLength, BOOL EnableColorCode, LPCSTR pComments, ID3D10Blob** ppDisassembly); + + +//---------------------------------------------------------------------------- +// D3D10GetPixelShaderProfile/D3D10GetVertexShaderProfile/D3D10GetGeometryShaderProfile: +// ----------------------------------------------------- +// Returns the name of the HLSL profile best suited to a given device. +// +// Parameters: +// pDevice +// Pointer to the device in question +//---------------------------------------------------------------------------- + +LPCSTR WINAPI D3D10GetPixelShaderProfile(ID3D10Device *pDevice); + +LPCSTR WINAPI D3D10GetVertexShaderProfile(ID3D10Device *pDevice); + +LPCSTR WINAPI D3D10GetGeometryShaderProfile(ID3D10Device *pDevice); + +//---------------------------------------------------------------------------- +// D3D10ReflectShader: +// ------------------ +// Creates a shader reflection object that can be used to retrieve information +// about a compiled shader +// +// Parameters: +// pShaderBytecode +// Pointer to a compiled shader (same pointer that is passed into +// ID3D10Device::CreateShader) +// BytecodeLength +// Length of the shader bytecode buffer +// ppReflector +// [out] Returns a ID3D10ShaderReflection object that can be used to +// retrieve shader resource and constant buffer information +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI D3D10ReflectShader(CONST void *pShaderBytecode, SIZE_T BytecodeLength, ID3D10ShaderReflection **ppReflector); + +//---------------------------------------------------------------------------- +// D3D10PreprocessShader +// --------------------- +// Creates a shader reflection object that can be used to retrieve information +// about a compiled shader +// +// Parameters: +// pSrcData +// Pointer to source code +// SrcDataLen +// Size of source code, in bytes +// pFileName +// Source file name (used for error output) +// pDefines +// Optional NULL-terminated array of preprocessor macro definitions. +// pInclude +// Optional interface pointer to use for handling #include directives. +// If this parameter is NULL, #includes will be honored when assembling +// from file, and will error when assembling from resource or memory. +// ppShaderText +// Returns a buffer containing a single large string that represents +// the resulting formatted token stream +// ppErrorMsgs +// Returns a buffer containing a listing of errors and warnings that were +// encountered during assembly. If you are running in a debugger, +// these are the same messages you will see in your debug output. +//---------------------------------------------------------------------------- + +HRESULT WINAPI D3D10PreprocessShader(LPCSTR pSrcData, SIZE_T SrcDataSize, LPCSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines, + LPD3D10INCLUDE pInclude, ID3D10Blob** ppShaderText, ID3D10Blob** ppErrorMsgs); + +////////////////////////////////////////////////////////////////////////// +// +// Shader blob manipulation routines +// --------------------------------- +// +// void *pShaderBytecode - a buffer containing the result of an HLSL +// compilation. Typically this opaque buffer contains several +// discrete sections including the shader executable code, the input +// signature, and the output signature. This can typically be retrieved +// by calling ID3D10Blob::GetBufferPointer() on the returned blob +// from HLSL's compile APIs. +// +// UINT BytecodeLength - the length of pShaderBytecode. This can +// typically be retrieved by calling ID3D10Blob::GetBufferSize() +// on the returned blob from HLSL's compile APIs. +// +// ID3D10Blob **ppSignatureBlob(s) - a newly created buffer that +// contains only the signature portions of the original bytecode. +// This is a copy; the original bytecode is not modified. You may +// specify NULL for this parameter to have the bytecode validated +// for the presence of the corresponding signatures without actually +// copying them and creating a new blob. +// +// Returns E_INVALIDARG if any required parameters are NULL +// Returns E_FAIL is the bytecode is corrupt or missing signatures +// Returns S_OK on success +// +////////////////////////////////////////////////////////////////////////// + +HRESULT WINAPI D3D10GetInputSignatureBlob(CONST void *pShaderBytecode, SIZE_T BytecodeLength, ID3D10Blob **ppSignatureBlob); +HRESULT WINAPI D3D10GetOutputSignatureBlob(CONST void *pShaderBytecode, SIZE_T BytecodeLength, ID3D10Blob **ppSignatureBlob); +HRESULT WINAPI D3D10GetInputAndOutputSignatureBlob(CONST void *pShaderBytecode, SIZE_T BytecodeLength, ID3D10Blob **ppSignatureBlob); + +//---------------------------------------------------------------------------- +// D3D10GetShaderDebugInfo: +// ----------------------- +// Gets shader debug info. Debug info is generated by D3D10CompileShader and is +// embedded in the body of the shader. +// +// Parameters: +// pShaderBytecode +// Pointer to the function bytecode +// BytecodeLength +// Length of the shader bytecode buffer +// ppDebugInfo +// Buffer used to return debug info. For information about the layout +// of this buffer, see definition of D3D10_SHADER_DEBUG_INFO above. +//---------------------------------------------------------------------------- + +HRESULT WINAPI D3D10GetShaderDebugInfo(CONST void *pShaderBytecode, SIZE_T BytecodeLength, ID3D10Blob** ppDebugInfo); + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif //__D3D10SHADER_H__ + diff --git a/MediaClient/MediaClient/directx/include/D3D11.h b/MediaClient/MediaClient/directx/include/D3D11.h new file mode 100644 index 0000000..680cf80 --- /dev/null +++ b/MediaClient/MediaClient/directx/include/D3D11.h @@ -0,0 +1,10227 @@ +/*------------------------------------------------------------------------------------- + * + * Copyright (c) Microsoft Corporation + * + *-------------------------------------------------------------------------------------*/ + + +/* this ALWAYS GENERATED file contains the definitions for the interfaces */ + + + /* File created by MIDL compiler version 7.00.0555 */ +/* @@MIDL_FILE_HEADING( ) */ + +#pragma warning( disable: 4049 ) /* more than 64k source lines */ + + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCNDR_H_VERSION__ +#define __REQUIRED_RPCNDR_H_VERSION__ 475 +#endif + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCSAL_H_VERSION__ +#define __REQUIRED_RPCSAL_H_VERSION__ 100 +#endif + +#include "rpc.h" +#include "rpcndr.h" + +#ifndef __RPCNDR_H_VERSION__ +#error this stub requires an updated version of +#endif // __RPCNDR_H_VERSION__ + +#ifndef COM_NO_WINDOWS_H +#include "windows.h" +#include "ole2.h" +#endif /*COM_NO_WINDOWS_H*/ + +#ifndef __d3d11_h__ +#define __d3d11_h__ + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +/* Forward Declarations */ + +#ifndef __ID3D11DeviceChild_FWD_DEFINED__ +#define __ID3D11DeviceChild_FWD_DEFINED__ +typedef interface ID3D11DeviceChild ID3D11DeviceChild; +#endif /* __ID3D11DeviceChild_FWD_DEFINED__ */ + + +#ifndef __ID3D11DepthStencilState_FWD_DEFINED__ +#define __ID3D11DepthStencilState_FWD_DEFINED__ +typedef interface ID3D11DepthStencilState ID3D11DepthStencilState; +#endif /* __ID3D11DepthStencilState_FWD_DEFINED__ */ + + +#ifndef __ID3D11BlendState_FWD_DEFINED__ +#define __ID3D11BlendState_FWD_DEFINED__ +typedef interface ID3D11BlendState ID3D11BlendState; +#endif /* __ID3D11BlendState_FWD_DEFINED__ */ + + +#ifndef __ID3D11RasterizerState_FWD_DEFINED__ +#define __ID3D11RasterizerState_FWD_DEFINED__ +typedef interface ID3D11RasterizerState ID3D11RasterizerState; +#endif /* __ID3D11RasterizerState_FWD_DEFINED__ */ + + +#ifndef __ID3D11Resource_FWD_DEFINED__ +#define __ID3D11Resource_FWD_DEFINED__ +typedef interface ID3D11Resource ID3D11Resource; +#endif /* __ID3D11Resource_FWD_DEFINED__ */ + + +#ifndef __ID3D11Buffer_FWD_DEFINED__ +#define __ID3D11Buffer_FWD_DEFINED__ +typedef interface ID3D11Buffer ID3D11Buffer; +#endif /* __ID3D11Buffer_FWD_DEFINED__ */ + + +#ifndef __ID3D11Texture1D_FWD_DEFINED__ +#define __ID3D11Texture1D_FWD_DEFINED__ +typedef interface ID3D11Texture1D ID3D11Texture1D; +#endif /* __ID3D11Texture1D_FWD_DEFINED__ */ + + +#ifndef __ID3D11Texture2D_FWD_DEFINED__ +#define __ID3D11Texture2D_FWD_DEFINED__ +typedef interface ID3D11Texture2D ID3D11Texture2D; +#endif /* __ID3D11Texture2D_FWD_DEFINED__ */ + + +#ifndef __ID3D11Texture3D_FWD_DEFINED__ +#define __ID3D11Texture3D_FWD_DEFINED__ +typedef interface ID3D11Texture3D ID3D11Texture3D; +#endif /* __ID3D11Texture3D_FWD_DEFINED__ */ + + +#ifndef __ID3D11View_FWD_DEFINED__ +#define __ID3D11View_FWD_DEFINED__ +typedef interface ID3D11View ID3D11View; +#endif /* __ID3D11View_FWD_DEFINED__ */ + + +#ifndef __ID3D11ShaderResourceView_FWD_DEFINED__ +#define __ID3D11ShaderResourceView_FWD_DEFINED__ +typedef interface ID3D11ShaderResourceView ID3D11ShaderResourceView; +#endif /* __ID3D11ShaderResourceView_FWD_DEFINED__ */ + + +#ifndef __ID3D11RenderTargetView_FWD_DEFINED__ +#define __ID3D11RenderTargetView_FWD_DEFINED__ +typedef interface ID3D11RenderTargetView ID3D11RenderTargetView; +#endif /* __ID3D11RenderTargetView_FWD_DEFINED__ */ + + +#ifndef __ID3D11DepthStencilView_FWD_DEFINED__ +#define __ID3D11DepthStencilView_FWD_DEFINED__ +typedef interface ID3D11DepthStencilView ID3D11DepthStencilView; +#endif /* __ID3D11DepthStencilView_FWD_DEFINED__ */ + + +#ifndef __ID3D11UnorderedAccessView_FWD_DEFINED__ +#define __ID3D11UnorderedAccessView_FWD_DEFINED__ +typedef interface ID3D11UnorderedAccessView ID3D11UnorderedAccessView; +#endif /* __ID3D11UnorderedAccessView_FWD_DEFINED__ */ + + +#ifndef __ID3D11VertexShader_FWD_DEFINED__ +#define __ID3D11VertexShader_FWD_DEFINED__ +typedef interface ID3D11VertexShader ID3D11VertexShader; +#endif /* __ID3D11VertexShader_FWD_DEFINED__ */ + + +#ifndef __ID3D11HullShader_FWD_DEFINED__ +#define __ID3D11HullShader_FWD_DEFINED__ +typedef interface ID3D11HullShader ID3D11HullShader; +#endif /* __ID3D11HullShader_FWD_DEFINED__ */ + + +#ifndef __ID3D11DomainShader_FWD_DEFINED__ +#define __ID3D11DomainShader_FWD_DEFINED__ +typedef interface ID3D11DomainShader ID3D11DomainShader; +#endif /* __ID3D11DomainShader_FWD_DEFINED__ */ + + +#ifndef __ID3D11GeometryShader_FWD_DEFINED__ +#define __ID3D11GeometryShader_FWD_DEFINED__ +typedef interface ID3D11GeometryShader ID3D11GeometryShader; +#endif /* __ID3D11GeometryShader_FWD_DEFINED__ */ + + +#ifndef __ID3D11PixelShader_FWD_DEFINED__ +#define __ID3D11PixelShader_FWD_DEFINED__ +typedef interface ID3D11PixelShader ID3D11PixelShader; +#endif /* __ID3D11PixelShader_FWD_DEFINED__ */ + + +#ifndef __ID3D11ComputeShader_FWD_DEFINED__ +#define __ID3D11ComputeShader_FWD_DEFINED__ +typedef interface ID3D11ComputeShader ID3D11ComputeShader; +#endif /* __ID3D11ComputeShader_FWD_DEFINED__ */ + + +#ifndef __ID3D11InputLayout_FWD_DEFINED__ +#define __ID3D11InputLayout_FWD_DEFINED__ +typedef interface ID3D11InputLayout ID3D11InputLayout; +#endif /* __ID3D11InputLayout_FWD_DEFINED__ */ + + +#ifndef __ID3D11SamplerState_FWD_DEFINED__ +#define __ID3D11SamplerState_FWD_DEFINED__ +typedef interface ID3D11SamplerState ID3D11SamplerState; +#endif /* __ID3D11SamplerState_FWD_DEFINED__ */ + + +#ifndef __ID3D11Asynchronous_FWD_DEFINED__ +#define __ID3D11Asynchronous_FWD_DEFINED__ +typedef interface ID3D11Asynchronous ID3D11Asynchronous; +#endif /* __ID3D11Asynchronous_FWD_DEFINED__ */ + + +#ifndef __ID3D11Query_FWD_DEFINED__ +#define __ID3D11Query_FWD_DEFINED__ +typedef interface ID3D11Query ID3D11Query; +#endif /* __ID3D11Query_FWD_DEFINED__ */ + + +#ifndef __ID3D11Predicate_FWD_DEFINED__ +#define __ID3D11Predicate_FWD_DEFINED__ +typedef interface ID3D11Predicate ID3D11Predicate; +#endif /* __ID3D11Predicate_FWD_DEFINED__ */ + + +#ifndef __ID3D11Counter_FWD_DEFINED__ +#define __ID3D11Counter_FWD_DEFINED__ +typedef interface ID3D11Counter ID3D11Counter; +#endif /* __ID3D11Counter_FWD_DEFINED__ */ + + +#ifndef __ID3D11ClassInstance_FWD_DEFINED__ +#define __ID3D11ClassInstance_FWD_DEFINED__ +typedef interface ID3D11ClassInstance ID3D11ClassInstance; +#endif /* __ID3D11ClassInstance_FWD_DEFINED__ */ + + +#ifndef __ID3D11ClassLinkage_FWD_DEFINED__ +#define __ID3D11ClassLinkage_FWD_DEFINED__ +typedef interface ID3D11ClassLinkage ID3D11ClassLinkage; +#endif /* __ID3D11ClassLinkage_FWD_DEFINED__ */ + + +#ifndef __ID3D11CommandList_FWD_DEFINED__ +#define __ID3D11CommandList_FWD_DEFINED__ +typedef interface ID3D11CommandList ID3D11CommandList; +#endif /* __ID3D11CommandList_FWD_DEFINED__ */ + + +#ifndef __ID3D11DeviceContext_FWD_DEFINED__ +#define __ID3D11DeviceContext_FWD_DEFINED__ +typedef interface ID3D11DeviceContext ID3D11DeviceContext; +#endif /* __ID3D11DeviceContext_FWD_DEFINED__ */ + + +#ifndef __ID3D11Device_FWD_DEFINED__ +#define __ID3D11Device_FWD_DEFINED__ +typedef interface ID3D11Device ID3D11Device; +#endif /* __ID3D11Device_FWD_DEFINED__ */ + + +/* header files for imported files */ +#include "oaidl.h" +#include "ocidl.h" +#include "dxgi.h" +#include "d3dcommon.h" + +#ifdef __cplusplus +extern "C"{ +#endif + + +/* interface __MIDL_itf_d3d11_0000_0000 */ +/* [local] */ + +#ifndef _D3D11_CONSTANTS +#define _D3D11_CONSTANTS +#define D3D11_16BIT_INDEX_STRIP_CUT_VALUE ( 0xffff ) + +#define D3D11_32BIT_INDEX_STRIP_CUT_VALUE ( 0xffffffff ) + +#define D3D11_8BIT_INDEX_STRIP_CUT_VALUE ( 0xff ) + +#define D3D11_ARRAY_AXIS_ADDRESS_RANGE_BIT_COUNT ( 9 ) + +#define D3D11_CLIP_OR_CULL_DISTANCE_COUNT ( 8 ) + +#define D3D11_CLIP_OR_CULL_DISTANCE_ELEMENT_COUNT ( 2 ) + +#define D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT ( 14 ) + +#define D3D11_COMMONSHADER_CONSTANT_BUFFER_COMPONENTS ( 4 ) + +#define D3D11_COMMONSHADER_CONSTANT_BUFFER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D11_COMMONSHADER_CONSTANT_BUFFER_HW_SLOT_COUNT ( 15 ) + +#define D3D11_COMMONSHADER_CONSTANT_BUFFER_REGISTER_COMPONENTS ( 4 ) + +#define D3D11_COMMONSHADER_CONSTANT_BUFFER_REGISTER_COUNT ( 15 ) + +#define D3D11_COMMONSHADER_CONSTANT_BUFFER_REGISTER_READS_PER_INST ( 1 ) + +#define D3D11_COMMONSHADER_CONSTANT_BUFFER_REGISTER_READ_PORTS ( 1 ) + +#define D3D11_COMMONSHADER_FLOWCONTROL_NESTING_LIMIT ( 64 ) + +#define D3D11_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_COMPONENTS ( 4 ) + +#define D3D11_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_COUNT ( 1 ) + +#define D3D11_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_READS_PER_INST ( 1 ) + +#define D3D11_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_READ_PORTS ( 1 ) + +#define D3D11_COMMONSHADER_IMMEDIATE_VALUE_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D11_COMMONSHADER_INPUT_RESOURCE_REGISTER_COMPONENTS ( 1 ) + +#define D3D11_COMMONSHADER_INPUT_RESOURCE_REGISTER_COUNT ( 128 ) + +#define D3D11_COMMONSHADER_INPUT_RESOURCE_REGISTER_READS_PER_INST ( 1 ) + +#define D3D11_COMMONSHADER_INPUT_RESOURCE_REGISTER_READ_PORTS ( 1 ) + +#define D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT ( 128 ) + +#define D3D11_COMMONSHADER_SAMPLER_REGISTER_COMPONENTS ( 1 ) + +#define D3D11_COMMONSHADER_SAMPLER_REGISTER_COUNT ( 16 ) + +#define D3D11_COMMONSHADER_SAMPLER_REGISTER_READS_PER_INST ( 1 ) + +#define D3D11_COMMONSHADER_SAMPLER_REGISTER_READ_PORTS ( 1 ) + +#define D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT ( 16 ) + +#define D3D11_COMMONSHADER_SUBROUTINE_NESTING_LIMIT ( 32 ) + +#define D3D11_COMMONSHADER_TEMP_REGISTER_COMPONENTS ( 4 ) + +#define D3D11_COMMONSHADER_TEMP_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D11_COMMONSHADER_TEMP_REGISTER_COUNT ( 4096 ) + +#define D3D11_COMMONSHADER_TEMP_REGISTER_READS_PER_INST ( 3 ) + +#define D3D11_COMMONSHADER_TEMP_REGISTER_READ_PORTS ( 3 ) + +#define D3D11_COMMONSHADER_TEXCOORD_RANGE_REDUCTION_MAX ( 10 ) + +#define D3D11_COMMONSHADER_TEXCOORD_RANGE_REDUCTION_MIN ( -10 ) + +#define D3D11_COMMONSHADER_TEXEL_OFFSET_MAX_NEGATIVE ( -8 ) + +#define D3D11_COMMONSHADER_TEXEL_OFFSET_MAX_POSITIVE ( 7 ) + +#define D3D11_CS_4_X_BUCKET00_MAX_BYTES_TGSM_WRITABLE_PER_THREAD ( 256 ) + +#define D3D11_CS_4_X_BUCKET00_MAX_NUM_THREADS_PER_GROUP ( 64 ) + +#define D3D11_CS_4_X_BUCKET01_MAX_BYTES_TGSM_WRITABLE_PER_THREAD ( 240 ) + +#define D3D11_CS_4_X_BUCKET01_MAX_NUM_THREADS_PER_GROUP ( 68 ) + +#define D3D11_CS_4_X_BUCKET02_MAX_BYTES_TGSM_WRITABLE_PER_THREAD ( 224 ) + +#define D3D11_CS_4_X_BUCKET02_MAX_NUM_THREADS_PER_GROUP ( 72 ) + +#define D3D11_CS_4_X_BUCKET03_MAX_BYTES_TGSM_WRITABLE_PER_THREAD ( 208 ) + +#define D3D11_CS_4_X_BUCKET03_MAX_NUM_THREADS_PER_GROUP ( 76 ) + +#define D3D11_CS_4_X_BUCKET04_MAX_BYTES_TGSM_WRITABLE_PER_THREAD ( 192 ) + +#define D3D11_CS_4_X_BUCKET04_MAX_NUM_THREADS_PER_GROUP ( 84 ) + +#define D3D11_CS_4_X_BUCKET05_MAX_BYTES_TGSM_WRITABLE_PER_THREAD ( 176 ) + +#define D3D11_CS_4_X_BUCKET05_MAX_NUM_THREADS_PER_GROUP ( 92 ) + +#define D3D11_CS_4_X_BUCKET06_MAX_BYTES_TGSM_WRITABLE_PER_THREAD ( 160 ) + +#define D3D11_CS_4_X_BUCKET06_MAX_NUM_THREADS_PER_GROUP ( 100 ) + +#define D3D11_CS_4_X_BUCKET07_MAX_BYTES_TGSM_WRITABLE_PER_THREAD ( 144 ) + +#define D3D11_CS_4_X_BUCKET07_MAX_NUM_THREADS_PER_GROUP ( 112 ) + +#define D3D11_CS_4_X_BUCKET08_MAX_BYTES_TGSM_WRITABLE_PER_THREAD ( 128 ) + +#define D3D11_CS_4_X_BUCKET08_MAX_NUM_THREADS_PER_GROUP ( 128 ) + +#define D3D11_CS_4_X_BUCKET09_MAX_BYTES_TGSM_WRITABLE_PER_THREAD ( 112 ) + +#define D3D11_CS_4_X_BUCKET09_MAX_NUM_THREADS_PER_GROUP ( 144 ) + +#define D3D11_CS_4_X_BUCKET10_MAX_BYTES_TGSM_WRITABLE_PER_THREAD ( 96 ) + +#define D3D11_CS_4_X_BUCKET10_MAX_NUM_THREADS_PER_GROUP ( 168 ) + +#define D3D11_CS_4_X_BUCKET11_MAX_BYTES_TGSM_WRITABLE_PER_THREAD ( 80 ) + +#define D3D11_CS_4_X_BUCKET11_MAX_NUM_THREADS_PER_GROUP ( 204 ) + +#define D3D11_CS_4_X_BUCKET12_MAX_BYTES_TGSM_WRITABLE_PER_THREAD ( 64 ) + +#define D3D11_CS_4_X_BUCKET12_MAX_NUM_THREADS_PER_GROUP ( 256 ) + +#define D3D11_CS_4_X_BUCKET13_MAX_BYTES_TGSM_WRITABLE_PER_THREAD ( 48 ) + +#define D3D11_CS_4_X_BUCKET13_MAX_NUM_THREADS_PER_GROUP ( 340 ) + +#define D3D11_CS_4_X_BUCKET14_MAX_BYTES_TGSM_WRITABLE_PER_THREAD ( 32 ) + +#define D3D11_CS_4_X_BUCKET14_MAX_NUM_THREADS_PER_GROUP ( 512 ) + +#define D3D11_CS_4_X_BUCKET15_MAX_BYTES_TGSM_WRITABLE_PER_THREAD ( 16 ) + +#define D3D11_CS_4_X_BUCKET15_MAX_NUM_THREADS_PER_GROUP ( 768 ) + +#define D3D11_CS_4_X_DISPATCH_MAX_THREAD_GROUPS_IN_Z_DIMENSION ( 1 ) + +#define D3D11_CS_4_X_RAW_UAV_BYTE_ALIGNMENT ( 256 ) + +#define D3D11_CS_4_X_THREAD_GROUP_MAX_THREADS_PER_GROUP ( 768 ) + +#define D3D11_CS_4_X_THREAD_GROUP_MAX_X ( 768 ) + +#define D3D11_CS_4_X_THREAD_GROUP_MAX_Y ( 768 ) + +#define D3D11_CS_4_X_UAV_REGISTER_COUNT ( 1 ) + +#define D3D11_CS_DISPATCH_MAX_THREAD_GROUPS_PER_DIMENSION ( 65535 ) + +#define D3D11_CS_TGSM_REGISTER_COUNT ( 8192 ) + +#define D3D11_CS_TGSM_REGISTER_READS_PER_INST ( 1 ) + +#define D3D11_CS_TGSM_RESOURCE_REGISTER_COMPONENTS ( 1 ) + +#define D3D11_CS_TGSM_RESOURCE_REGISTER_READ_PORTS ( 1 ) + +#define D3D11_CS_THREAD_GROUP_MAX_THREADS_PER_GROUP ( 1024 ) + +#define D3D11_CS_THREAD_GROUP_MAX_X ( 1024 ) + +#define D3D11_CS_THREAD_GROUP_MAX_Y ( 1024 ) + +#define D3D11_CS_THREAD_GROUP_MAX_Z ( 64 ) + +#define D3D11_CS_THREAD_GROUP_MIN_X ( 1 ) + +#define D3D11_CS_THREAD_GROUP_MIN_Y ( 1 ) + +#define D3D11_CS_THREAD_GROUP_MIN_Z ( 1 ) + +#define D3D11_CS_THREAD_LOCAL_TEMP_REGISTER_POOL ( 16384 ) + +#define D3D11_DEFAULT_BLEND_FACTOR_ALPHA ( 1.0f ) +#define D3D11_DEFAULT_BLEND_FACTOR_BLUE ( 1.0f ) +#define D3D11_DEFAULT_BLEND_FACTOR_GREEN ( 1.0f ) +#define D3D11_DEFAULT_BLEND_FACTOR_RED ( 1.0f ) +#define D3D11_DEFAULT_BORDER_COLOR_COMPONENT ( 0.0f ) +#define D3D11_DEFAULT_DEPTH_BIAS ( 0 ) + +#define D3D11_DEFAULT_DEPTH_BIAS_CLAMP ( 0.0f ) +#define D3D11_DEFAULT_MAX_ANISOTROPY ( 16 ) +#define D3D11_DEFAULT_MIP_LOD_BIAS ( 0.0f ) +#define D3D11_DEFAULT_RENDER_TARGET_ARRAY_INDEX ( 0 ) + +#define D3D11_DEFAULT_SAMPLE_MASK ( 0xffffffff ) + +#define D3D11_DEFAULT_SCISSOR_ENDX ( 0 ) + +#define D3D11_DEFAULT_SCISSOR_ENDY ( 0 ) + +#define D3D11_DEFAULT_SCISSOR_STARTX ( 0 ) + +#define D3D11_DEFAULT_SCISSOR_STARTY ( 0 ) + +#define D3D11_DEFAULT_SLOPE_SCALED_DEPTH_BIAS ( 0.0f ) +#define D3D11_DEFAULT_STENCIL_READ_MASK ( 0xff ) + +#define D3D11_DEFAULT_STENCIL_REFERENCE ( 0 ) + +#define D3D11_DEFAULT_STENCIL_WRITE_MASK ( 0xff ) + +#define D3D11_DEFAULT_VIEWPORT_AND_SCISSORRECT_INDEX ( 0 ) + +#define D3D11_DEFAULT_VIEWPORT_HEIGHT ( 0 ) + +#define D3D11_DEFAULT_VIEWPORT_MAX_DEPTH ( 0.0f ) +#define D3D11_DEFAULT_VIEWPORT_MIN_DEPTH ( 0.0f ) +#define D3D11_DEFAULT_VIEWPORT_TOPLEFTX ( 0 ) + +#define D3D11_DEFAULT_VIEWPORT_TOPLEFTY ( 0 ) + +#define D3D11_DEFAULT_VIEWPORT_WIDTH ( 0 ) + +#define D3D11_DS_INPUT_CONTROL_POINTS_MAX_TOTAL_SCALARS ( 3968 ) + +#define D3D11_DS_INPUT_CONTROL_POINT_REGISTER_COMPONENTS ( 4 ) + +#define D3D11_DS_INPUT_CONTROL_POINT_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D11_DS_INPUT_CONTROL_POINT_REGISTER_COUNT ( 32 ) + +#define D3D11_DS_INPUT_CONTROL_POINT_REGISTER_READS_PER_INST ( 2 ) + +#define D3D11_DS_INPUT_CONTROL_POINT_REGISTER_READ_PORTS ( 1 ) + +#define D3D11_DS_INPUT_DOMAIN_POINT_REGISTER_COMPONENTS ( 3 ) + +#define D3D11_DS_INPUT_DOMAIN_POINT_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D11_DS_INPUT_DOMAIN_POINT_REGISTER_COUNT ( 1 ) + +#define D3D11_DS_INPUT_DOMAIN_POINT_REGISTER_READS_PER_INST ( 2 ) + +#define D3D11_DS_INPUT_DOMAIN_POINT_REGISTER_READ_PORTS ( 1 ) + +#define D3D11_DS_INPUT_PATCH_CONSTANT_REGISTER_COMPONENTS ( 4 ) + +#define D3D11_DS_INPUT_PATCH_CONSTANT_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D11_DS_INPUT_PATCH_CONSTANT_REGISTER_COUNT ( 32 ) + +#define D3D11_DS_INPUT_PATCH_CONSTANT_REGISTER_READS_PER_INST ( 2 ) + +#define D3D11_DS_INPUT_PATCH_CONSTANT_REGISTER_READ_PORTS ( 1 ) + +#define D3D11_DS_OUTPUT_REGISTER_COMPONENTS ( 4 ) + +#define D3D11_DS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D11_DS_OUTPUT_REGISTER_COUNT ( 32 ) + +#define D3D11_FLOAT16_FUSED_TOLERANCE_IN_ULP ( 0.6 ) +#define D3D11_FLOAT32_MAX ( 3.402823466e+38f ) +#define D3D11_FLOAT32_TO_INTEGER_TOLERANCE_IN_ULP ( 0.6f ) +#define D3D11_FLOAT_TO_SRGB_EXPONENT_DENOMINATOR ( 2.4f ) +#define D3D11_FLOAT_TO_SRGB_EXPONENT_NUMERATOR ( 1.0f ) +#define D3D11_FLOAT_TO_SRGB_OFFSET ( 0.055f ) +#define D3D11_FLOAT_TO_SRGB_SCALE_1 ( 12.92f ) +#define D3D11_FLOAT_TO_SRGB_SCALE_2 ( 1.055f ) +#define D3D11_FLOAT_TO_SRGB_THRESHOLD ( 0.0031308f ) +#define D3D11_FTOI_INSTRUCTION_MAX_INPUT ( 2147483647.999f ) +#define D3D11_FTOI_INSTRUCTION_MIN_INPUT ( -2147483648.999f ) +#define D3D11_FTOU_INSTRUCTION_MAX_INPUT ( 4294967295.999f ) +#define D3D11_FTOU_INSTRUCTION_MIN_INPUT ( 0.0f ) +#define D3D11_GS_INPUT_INSTANCE_ID_READS_PER_INST ( 2 ) + +#define D3D11_GS_INPUT_INSTANCE_ID_READ_PORTS ( 1 ) + +#define D3D11_GS_INPUT_INSTANCE_ID_REGISTER_COMPONENTS ( 1 ) + +#define D3D11_GS_INPUT_INSTANCE_ID_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D11_GS_INPUT_INSTANCE_ID_REGISTER_COUNT ( 1 ) + +#define D3D11_GS_INPUT_PRIM_CONST_REGISTER_COMPONENTS ( 1 ) + +#define D3D11_GS_INPUT_PRIM_CONST_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D11_GS_INPUT_PRIM_CONST_REGISTER_COUNT ( 1 ) + +#define D3D11_GS_INPUT_PRIM_CONST_REGISTER_READS_PER_INST ( 2 ) + +#define D3D11_GS_INPUT_PRIM_CONST_REGISTER_READ_PORTS ( 1 ) + +#define D3D11_GS_INPUT_REGISTER_COMPONENTS ( 4 ) + +#define D3D11_GS_INPUT_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D11_GS_INPUT_REGISTER_COUNT ( 32 ) + +#define D3D11_GS_INPUT_REGISTER_READS_PER_INST ( 2 ) + +#define D3D11_GS_INPUT_REGISTER_READ_PORTS ( 1 ) + +#define D3D11_GS_INPUT_REGISTER_VERTICES ( 32 ) + +#define D3D11_GS_MAX_INSTANCE_COUNT ( 32 ) + +#define D3D11_GS_MAX_OUTPUT_VERTEX_COUNT_ACROSS_INSTANCES ( 1024 ) + +#define D3D11_GS_OUTPUT_ELEMENTS ( 32 ) + +#define D3D11_GS_OUTPUT_REGISTER_COMPONENTS ( 4 ) + +#define D3D11_GS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D11_GS_OUTPUT_REGISTER_COUNT ( 32 ) + +#define D3D11_HS_CONTROL_POINT_PHASE_INPUT_REGISTER_COUNT ( 32 ) + +#define D3D11_HS_CONTROL_POINT_PHASE_OUTPUT_REGISTER_COUNT ( 32 ) + +#define D3D11_HS_CONTROL_POINT_REGISTER_COMPONENTS ( 4 ) + +#define D3D11_HS_CONTROL_POINT_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D11_HS_CONTROL_POINT_REGISTER_READS_PER_INST ( 2 ) + +#define D3D11_HS_CONTROL_POINT_REGISTER_READ_PORTS ( 1 ) + +#define D3D11_HS_FORK_PHASE_INSTANCE_COUNT_UPPER_BOUND ( 0xffffffff ) + +#define D3D11_HS_INPUT_FORK_INSTANCE_ID_REGISTER_COMPONENTS ( 1 ) + +#define D3D11_HS_INPUT_FORK_INSTANCE_ID_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D11_HS_INPUT_FORK_INSTANCE_ID_REGISTER_COUNT ( 1 ) + +#define D3D11_HS_INPUT_FORK_INSTANCE_ID_REGISTER_READS_PER_INST ( 2 ) + +#define D3D11_HS_INPUT_FORK_INSTANCE_ID_REGISTER_READ_PORTS ( 1 ) + +#define D3D11_HS_INPUT_JOIN_INSTANCE_ID_REGISTER_COMPONENTS ( 1 ) + +#define D3D11_HS_INPUT_JOIN_INSTANCE_ID_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D11_HS_INPUT_JOIN_INSTANCE_ID_REGISTER_COUNT ( 1 ) + +#define D3D11_HS_INPUT_JOIN_INSTANCE_ID_REGISTER_READS_PER_INST ( 2 ) + +#define D3D11_HS_INPUT_JOIN_INSTANCE_ID_REGISTER_READ_PORTS ( 1 ) + +#define D3D11_HS_INPUT_PRIMITIVE_ID_REGISTER_COMPONENTS ( 1 ) + +#define D3D11_HS_INPUT_PRIMITIVE_ID_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D11_HS_INPUT_PRIMITIVE_ID_REGISTER_COUNT ( 1 ) + +#define D3D11_HS_INPUT_PRIMITIVE_ID_REGISTER_READS_PER_INST ( 2 ) + +#define D3D11_HS_INPUT_PRIMITIVE_ID_REGISTER_READ_PORTS ( 1 ) + +#define D3D11_HS_JOIN_PHASE_INSTANCE_COUNT_UPPER_BOUND ( 0xffffffff ) + +#define D3D11_HS_MAXTESSFACTOR_LOWER_BOUND ( 1.0f ) +#define D3D11_HS_MAXTESSFACTOR_UPPER_BOUND ( 64.0f ) +#define D3D11_HS_OUTPUT_CONTROL_POINTS_MAX_TOTAL_SCALARS ( 3968 ) + +#define D3D11_HS_OUTPUT_CONTROL_POINT_ID_REGISTER_COMPONENTS ( 1 ) + +#define D3D11_HS_OUTPUT_CONTROL_POINT_ID_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D11_HS_OUTPUT_CONTROL_POINT_ID_REGISTER_COUNT ( 1 ) + +#define D3D11_HS_OUTPUT_CONTROL_POINT_ID_REGISTER_READS_PER_INST ( 2 ) + +#define D3D11_HS_OUTPUT_CONTROL_POINT_ID_REGISTER_READ_PORTS ( 1 ) + +#define D3D11_HS_OUTPUT_PATCH_CONSTANT_REGISTER_COMPONENTS ( 4 ) + +#define D3D11_HS_OUTPUT_PATCH_CONSTANT_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D11_HS_OUTPUT_PATCH_CONSTANT_REGISTER_COUNT ( 32 ) + +#define D3D11_HS_OUTPUT_PATCH_CONSTANT_REGISTER_READS_PER_INST ( 2 ) + +#define D3D11_HS_OUTPUT_PATCH_CONSTANT_REGISTER_READ_PORTS ( 1 ) + +#define D3D11_IA_DEFAULT_INDEX_BUFFER_OFFSET_IN_BYTES ( 0 ) + +#define D3D11_IA_DEFAULT_PRIMITIVE_TOPOLOGY ( 0 ) + +#define D3D11_IA_DEFAULT_VERTEX_BUFFER_OFFSET_IN_BYTES ( 0 ) + +#define D3D11_IA_INDEX_INPUT_RESOURCE_SLOT_COUNT ( 1 ) + +#define D3D11_IA_INSTANCE_ID_BIT_COUNT ( 32 ) + +#define D3D11_IA_INTEGER_ARITHMETIC_BIT_COUNT ( 32 ) + +#define D3D11_IA_PATCH_MAX_CONTROL_POINT_COUNT ( 32 ) + +#define D3D11_IA_PRIMITIVE_ID_BIT_COUNT ( 32 ) + +#define D3D11_IA_VERTEX_ID_BIT_COUNT ( 32 ) + +#define D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT ( 32 ) + +#define D3D11_IA_VERTEX_INPUT_STRUCTURE_ELEMENTS_COMPONENTS ( 128 ) + +#define D3D11_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT ( 32 ) + +#define D3D11_INTEGER_DIVIDE_BY_ZERO_QUOTIENT ( 0xffffffff ) + +#define D3D11_INTEGER_DIVIDE_BY_ZERO_REMAINDER ( 0xffffffff ) + +#define D3D11_KEEP_RENDER_TARGETS_AND_DEPTH_STENCIL ( 0xffffffff ) + +#define D3D11_KEEP_UNORDERED_ACCESS_VIEWS ( 0xffffffff ) + +#define D3D11_LINEAR_GAMMA ( 1.0f ) +#define D3D11_MAJOR_VERSION ( 11 ) + +#define D3D11_MAX_BORDER_COLOR_COMPONENT ( 1.0f ) +#define D3D11_MAX_DEPTH ( 1.0f ) +#define D3D11_MAX_MAXANISOTROPY ( 16 ) + +#define D3D11_MAX_MULTISAMPLE_SAMPLE_COUNT ( 32 ) + +#define D3D11_MAX_POSITION_VALUE ( 3.402823466e+34f ) +#define D3D11_MAX_TEXTURE_DIMENSION_2_TO_EXP ( 17 ) + +#define D3D11_MINOR_VERSION ( 0 ) + +#define D3D11_MIN_BORDER_COLOR_COMPONENT ( 0.0f ) +#define D3D11_MIN_DEPTH ( 0.0f ) +#define D3D11_MIN_MAXANISOTROPY ( 0 ) + +#define D3D11_MIP_LOD_BIAS_MAX ( 15.99f ) +#define D3D11_MIP_LOD_BIAS_MIN ( -16.0f ) +#define D3D11_MIP_LOD_FRACTIONAL_BIT_COUNT ( 8 ) + +#define D3D11_MIP_LOD_RANGE_BIT_COUNT ( 8 ) + +#define D3D11_MULTISAMPLE_ANTIALIAS_LINE_WIDTH ( 1.4f ) +#define D3D11_NONSAMPLE_FETCH_OUT_OF_RANGE_ACCESS_RESULT ( 0 ) + +#define D3D11_PIXEL_ADDRESS_RANGE_BIT_COUNT ( 15 ) + +#define D3D11_PRE_SCISSOR_PIXEL_ADDRESS_RANGE_BIT_COUNT ( 16 ) + +#define D3D11_PS_CS_UAV_REGISTER_COMPONENTS ( 1 ) + +#define D3D11_PS_CS_UAV_REGISTER_COUNT ( 8 ) + +#define D3D11_PS_CS_UAV_REGISTER_READS_PER_INST ( 1 ) + +#define D3D11_PS_CS_UAV_REGISTER_READ_PORTS ( 1 ) + +#define D3D11_PS_FRONTFACING_DEFAULT_VALUE ( 0xffffffff ) + +#define D3D11_PS_FRONTFACING_FALSE_VALUE ( 0 ) + +#define D3D11_PS_FRONTFACING_TRUE_VALUE ( 0xffffffff ) + +#define D3D11_PS_INPUT_REGISTER_COMPONENTS ( 4 ) + +#define D3D11_PS_INPUT_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D11_PS_INPUT_REGISTER_COUNT ( 32 ) + +#define D3D11_PS_INPUT_REGISTER_READS_PER_INST ( 2 ) + +#define D3D11_PS_INPUT_REGISTER_READ_PORTS ( 1 ) + +#define D3D11_PS_LEGACY_PIXEL_CENTER_FRACTIONAL_COMPONENT ( 0.0f ) +#define D3D11_PS_OUTPUT_DEPTH_REGISTER_COMPONENTS ( 1 ) + +#define D3D11_PS_OUTPUT_DEPTH_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D11_PS_OUTPUT_DEPTH_REGISTER_COUNT ( 1 ) + +#define D3D11_PS_OUTPUT_MASK_REGISTER_COMPONENTS ( 1 ) + +#define D3D11_PS_OUTPUT_MASK_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D11_PS_OUTPUT_MASK_REGISTER_COUNT ( 1 ) + +#define D3D11_PS_OUTPUT_REGISTER_COMPONENTS ( 4 ) + +#define D3D11_PS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D11_PS_OUTPUT_REGISTER_COUNT ( 8 ) + +#define D3D11_PS_PIXEL_CENTER_FRACTIONAL_COMPONENT ( 0.5f ) +#define D3D11_RAW_UAV_SRV_BYTE_ALIGNMENT ( 16 ) + +#define D3D11_REQ_BLEND_OBJECT_COUNT_PER_DEVICE ( 4096 ) + +#define D3D11_REQ_BUFFER_RESOURCE_TEXEL_COUNT_2_TO_EXP ( 27 ) + +#define D3D11_REQ_CONSTANT_BUFFER_ELEMENT_COUNT ( 4096 ) + +#define D3D11_REQ_DEPTH_STENCIL_OBJECT_COUNT_PER_DEVICE ( 4096 ) + +#define D3D11_REQ_DRAWINDEXED_INDEX_COUNT_2_TO_EXP ( 32 ) + +#define D3D11_REQ_DRAW_VERTEX_COUNT_2_TO_EXP ( 32 ) + +#define D3D11_REQ_FILTERING_HW_ADDRESSABLE_RESOURCE_DIMENSION ( 16384 ) + +#define D3D11_REQ_GS_INVOCATION_32BIT_OUTPUT_COMPONENT_LIMIT ( 1024 ) + +#define D3D11_REQ_IMMEDIATE_CONSTANT_BUFFER_ELEMENT_COUNT ( 4096 ) + +#define D3D11_REQ_MAXANISOTROPY ( 16 ) + +#define D3D11_REQ_MIP_LEVELS ( 15 ) + +#define D3D11_REQ_MULTI_ELEMENT_STRUCTURE_SIZE_IN_BYTES ( 2048 ) + +#define D3D11_REQ_RASTERIZER_OBJECT_COUNT_PER_DEVICE ( 4096 ) + +#define D3D11_REQ_RENDER_TO_BUFFER_WINDOW_WIDTH ( 16384 ) + +#define D3D11_REQ_RESOURCE_SIZE_IN_MEGABYTES_EXPRESSION_A_TERM ( 128 ) + +#define D3D11_REQ_RESOURCE_SIZE_IN_MEGABYTES_EXPRESSION_B_TERM ( 0.25f ) +#define D3D11_REQ_RESOURCE_VIEW_COUNT_PER_DEVICE_2_TO_EXP ( 20 ) + +#define D3D11_REQ_SAMPLER_OBJECT_COUNT_PER_DEVICE ( 4096 ) + +#define D3D11_REQ_TEXTURE1D_ARRAY_AXIS_DIMENSION ( 2048 ) + +#define D3D11_REQ_TEXTURE1D_U_DIMENSION ( 16384 ) + +#define D3D11_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION ( 2048 ) + +#define D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION ( 16384 ) + +#define D3D11_REQ_TEXTURE3D_U_V_OR_W_DIMENSION ( 2048 ) + +#define D3D11_REQ_TEXTURECUBE_DIMENSION ( 16384 ) + +#define D3D11_RESINFO_INSTRUCTION_MISSING_COMPONENT_RETVAL ( 0 ) + +#define D3D11_SHADER_MAJOR_VERSION ( 5 ) + +#define D3D11_SHADER_MAX_INSTANCES ( 65535 ) + +#define D3D11_SHADER_MAX_INTERFACES ( 253 ) + +#define D3D11_SHADER_MAX_INTERFACE_CALL_SITES ( 4096 ) + +#define D3D11_SHADER_MAX_TYPES ( 65535 ) + +#define D3D11_SHADER_MINOR_VERSION ( 0 ) + +#define D3D11_SHIFT_INSTRUCTION_PAD_VALUE ( 0 ) + +#define D3D11_SHIFT_INSTRUCTION_SHIFT_VALUE_BIT_COUNT ( 5 ) + +#define D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT ( 8 ) + +#define D3D11_SO_BUFFER_MAX_STRIDE_IN_BYTES ( 2048 ) + +#define D3D11_SO_BUFFER_MAX_WRITE_WINDOW_IN_BYTES ( 512 ) + +#define D3D11_SO_BUFFER_SLOT_COUNT ( 4 ) + +#define D3D11_SO_DDI_REGISTER_INDEX_DENOTING_GAP ( 0xffffffff ) + +#define D3D11_SO_NO_RASTERIZED_STREAM ( 0xffffffff ) + +#define D3D11_SO_OUTPUT_COMPONENT_COUNT ( 128 ) + +#define D3D11_SO_STREAM_COUNT ( 4 ) + +#define D3D11_SPEC_DATE_DAY ( 04 ) + +#define D3D11_SPEC_DATE_MONTH ( 06 ) + +#define D3D11_SPEC_DATE_YEAR ( 2009 ) + +#define D3D11_SPEC_VERSION ( 1.0 ) +#define D3D11_SRGB_GAMMA ( 2.2f ) +#define D3D11_SRGB_TO_FLOAT_DENOMINATOR_1 ( 12.92f ) +#define D3D11_SRGB_TO_FLOAT_DENOMINATOR_2 ( 1.055f ) +#define D3D11_SRGB_TO_FLOAT_EXPONENT ( 2.4f ) +#define D3D11_SRGB_TO_FLOAT_OFFSET ( 0.055f ) +#define D3D11_SRGB_TO_FLOAT_THRESHOLD ( 0.04045f ) +#define D3D11_SRGB_TO_FLOAT_TOLERANCE_IN_ULP ( 0.5f ) +#define D3D11_STANDARD_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D11_STANDARD_COMPONENT_BIT_COUNT_DOUBLED ( 64 ) + +#define D3D11_STANDARD_MAXIMUM_ELEMENT_ALIGNMENT_BYTE_MULTIPLE ( 4 ) + +#define D3D11_STANDARD_PIXEL_COMPONENT_COUNT ( 128 ) + +#define D3D11_STANDARD_PIXEL_ELEMENT_COUNT ( 32 ) + +#define D3D11_STANDARD_VECTOR_SIZE ( 4 ) + +#define D3D11_STANDARD_VERTEX_ELEMENT_COUNT ( 32 ) + +#define D3D11_STANDARD_VERTEX_TOTAL_COMPONENT_COUNT ( 64 ) + +#define D3D11_SUBPIXEL_FRACTIONAL_BIT_COUNT ( 8 ) + +#define D3D11_SUBTEXEL_FRACTIONAL_BIT_COUNT ( 8 ) + +#define D3D11_TESSELLATOR_MAX_EVEN_TESSELLATION_FACTOR ( 64 ) + +#define D3D11_TESSELLATOR_MAX_ISOLINE_DENSITY_TESSELLATION_FACTOR ( 64 ) + +#define D3D11_TESSELLATOR_MAX_ODD_TESSELLATION_FACTOR ( 63 ) + +#define D3D11_TESSELLATOR_MAX_TESSELLATION_FACTOR ( 64 ) + +#define D3D11_TESSELLATOR_MIN_EVEN_TESSELLATION_FACTOR ( 2 ) + +#define D3D11_TESSELLATOR_MIN_ISOLINE_DENSITY_TESSELLATION_FACTOR ( 1 ) + +#define D3D11_TESSELLATOR_MIN_ODD_TESSELLATION_FACTOR ( 1 ) + +#define D3D11_TEXEL_ADDRESS_RANGE_BIT_COUNT ( 16 ) + +#define D3D11_UNBOUND_MEMORY_ACCESS_RESULT ( 0 ) + +#define D3D11_VIEWPORT_AND_SCISSORRECT_MAX_INDEX ( 15 ) + +#define D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE ( 16 ) + +#define D3D11_VIEWPORT_BOUNDS_MAX ( 32767 ) + +#define D3D11_VIEWPORT_BOUNDS_MIN ( -32768 ) + +#define D3D11_VS_INPUT_REGISTER_COMPONENTS ( 4 ) + +#define D3D11_VS_INPUT_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D11_VS_INPUT_REGISTER_COUNT ( 32 ) + +#define D3D11_VS_INPUT_REGISTER_READS_PER_INST ( 2 ) + +#define D3D11_VS_INPUT_REGISTER_READ_PORTS ( 1 ) + +#define D3D11_VS_OUTPUT_REGISTER_COMPONENTS ( 4 ) + +#define D3D11_VS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT ( 32 ) + +#define D3D11_VS_OUTPUT_REGISTER_COUNT ( 32 ) + +#define D3D11_WHQL_CONTEXT_COUNT_FOR_RESOURCE_LIMIT ( 10 ) + +#define D3D11_WHQL_DRAWINDEXED_INDEX_COUNT_2_TO_EXP ( 25 ) + +#define D3D11_WHQL_DRAW_VERTEX_COUNT_2_TO_EXP ( 25 ) + +#endif +#define _FACD3D11 ( 0x87c ) + +#define _FACD3D11DEBUG ( ( _FACD3D11 + 1 ) ) + +#define MAKE_D3D11_HRESULT( code ) MAKE_HRESULT( 1, _FACD3D11, code ) +#define MAKE_D3D11_STATUS( code ) MAKE_HRESULT( 0, _FACD3D11, code ) +#define D3D11_ERROR_TOO_MANY_UNIQUE_STATE_OBJECTS MAKE_D3D11_HRESULT(1) +#define D3D11_ERROR_FILE_NOT_FOUND MAKE_D3D11_HRESULT(2) +#define D3D11_ERROR_TOO_MANY_UNIQUE_VIEW_OBJECTS MAKE_D3D11_HRESULT(3) +#define D3D11_ERROR_DEFERRED_CONTEXT_MAP_WITHOUT_INITIAL_DISCARD MAKE_D3D11_HRESULT(4) +#if __SAL_H_FULL_VER < 140050727 +#undef __in_range +#undef __in_xcount_opt +#define __in_range(x, y) +#define __in_xcount_opt(x) +#endif +#if !defined( D3D11_NO_HELPERS ) && defined( __cplusplus ) +} +struct CD3D11_DEFAULT {}; +extern const DECLSPEC_SELECTANY CD3D11_DEFAULT D3D11_DEFAULT; +extern "C"{ +#endif +typedef +enum D3D11_INPUT_CLASSIFICATION + { D3D11_INPUT_PER_VERTEX_DATA = 0, + D3D11_INPUT_PER_INSTANCE_DATA = 1 + } D3D11_INPUT_CLASSIFICATION; + +#define D3D11_APPEND_ALIGNED_ELEMENT ( 0xffffffff ) + +typedef struct D3D11_INPUT_ELEMENT_DESC + { + LPCSTR SemanticName; + UINT SemanticIndex; + DXGI_FORMAT Format; + UINT InputSlot; + UINT AlignedByteOffset; + D3D11_INPUT_CLASSIFICATION InputSlotClass; + UINT InstanceDataStepRate; + } D3D11_INPUT_ELEMENT_DESC; + +typedef +enum D3D11_FILL_MODE + { D3D11_FILL_WIREFRAME = 2, + D3D11_FILL_SOLID = 3 + } D3D11_FILL_MODE; + +typedef D3D_PRIMITIVE_TOPOLOGY D3D11_PRIMITIVE_TOPOLOGY; + +typedef D3D_PRIMITIVE D3D11_PRIMITIVE; + +typedef +enum D3D11_CULL_MODE + { D3D11_CULL_NONE = 1, + D3D11_CULL_FRONT = 2, + D3D11_CULL_BACK = 3 + } D3D11_CULL_MODE; + +typedef struct D3D11_SO_DECLARATION_ENTRY + { + UINT Stream; + LPCSTR SemanticName; + UINT SemanticIndex; + BYTE StartComponent; + BYTE ComponentCount; + BYTE OutputSlot; + } D3D11_SO_DECLARATION_ENTRY; + +typedef struct D3D11_VIEWPORT + { + FLOAT TopLeftX; + FLOAT TopLeftY; + FLOAT Width; + FLOAT Height; + FLOAT MinDepth; + FLOAT MaxDepth; + } D3D11_VIEWPORT; + +#if !defined( D3D11_NO_HELPERS ) && defined( __cplusplus ) +} +inline bool operator==( const D3D11_VIEWPORT& l, const D3D11_VIEWPORT& r ) +{ + return l.TopLeftX == r.TopLeftX && l.TopLeftY == r.TopLeftY && l.Width == r.Width && + l.Height == r.Height && l.MinDepth == r.MinDepth && l.MaxDepth == r.MaxDepth; +} +inline bool operator!=( const D3D11_VIEWPORT& l, const D3D11_VIEWPORT& r ) +{ return !( l == r ); } +extern "C"{ +#endif +typedef +enum D3D11_RESOURCE_DIMENSION + { D3D11_RESOURCE_DIMENSION_UNKNOWN = 0, + D3D11_RESOURCE_DIMENSION_BUFFER = 1, + D3D11_RESOURCE_DIMENSION_TEXTURE1D = 2, + D3D11_RESOURCE_DIMENSION_TEXTURE2D = 3, + D3D11_RESOURCE_DIMENSION_TEXTURE3D = 4 + } D3D11_RESOURCE_DIMENSION; + +typedef D3D_SRV_DIMENSION D3D11_SRV_DIMENSION; + +typedef +enum D3D11_DSV_DIMENSION + { D3D11_DSV_DIMENSION_UNKNOWN = 0, + D3D11_DSV_DIMENSION_TEXTURE1D = 1, + D3D11_DSV_DIMENSION_TEXTURE1DARRAY = 2, + D3D11_DSV_DIMENSION_TEXTURE2D = 3, + D3D11_DSV_DIMENSION_TEXTURE2DARRAY = 4, + D3D11_DSV_DIMENSION_TEXTURE2DMS = 5, + D3D11_DSV_DIMENSION_TEXTURE2DMSARRAY = 6 + } D3D11_DSV_DIMENSION; + +typedef +enum D3D11_RTV_DIMENSION + { D3D11_RTV_DIMENSION_UNKNOWN = 0, + D3D11_RTV_DIMENSION_BUFFER = 1, + D3D11_RTV_DIMENSION_TEXTURE1D = 2, + D3D11_RTV_DIMENSION_TEXTURE1DARRAY = 3, + D3D11_RTV_DIMENSION_TEXTURE2D = 4, + D3D11_RTV_DIMENSION_TEXTURE2DARRAY = 5, + D3D11_RTV_DIMENSION_TEXTURE2DMS = 6, + D3D11_RTV_DIMENSION_TEXTURE2DMSARRAY = 7, + D3D11_RTV_DIMENSION_TEXTURE3D = 8 + } D3D11_RTV_DIMENSION; + +typedef +enum D3D11_UAV_DIMENSION + { D3D11_UAV_DIMENSION_UNKNOWN = 0, + D3D11_UAV_DIMENSION_BUFFER = 1, + D3D11_UAV_DIMENSION_TEXTURE1D = 2, + D3D11_UAV_DIMENSION_TEXTURE1DARRAY = 3, + D3D11_UAV_DIMENSION_TEXTURE2D = 4, + D3D11_UAV_DIMENSION_TEXTURE2DARRAY = 5, + D3D11_UAV_DIMENSION_TEXTURE3D = 8 + } D3D11_UAV_DIMENSION; + +typedef +enum D3D11_USAGE + { D3D11_USAGE_DEFAULT = 0, + D3D11_USAGE_IMMUTABLE = 1, + D3D11_USAGE_DYNAMIC = 2, + D3D11_USAGE_STAGING = 3 + } D3D11_USAGE; + +typedef +enum D3D11_BIND_FLAG + { D3D11_BIND_VERTEX_BUFFER = 0x1L, + D3D11_BIND_INDEX_BUFFER = 0x2L, + D3D11_BIND_CONSTANT_BUFFER = 0x4L, + D3D11_BIND_SHADER_RESOURCE = 0x8L, + D3D11_BIND_STREAM_OUTPUT = 0x10L, + D3D11_BIND_RENDER_TARGET = 0x20L, + D3D11_BIND_DEPTH_STENCIL = 0x40L, + D3D11_BIND_UNORDERED_ACCESS = 0x80L + } D3D11_BIND_FLAG; + +typedef +enum D3D11_CPU_ACCESS_FLAG + { D3D11_CPU_ACCESS_WRITE = 0x10000L, + D3D11_CPU_ACCESS_READ = 0x20000L + } D3D11_CPU_ACCESS_FLAG; + +typedef +enum D3D11_RESOURCE_MISC_FLAG + { D3D11_RESOURCE_MISC_GENERATE_MIPS = 0x1L, + D3D11_RESOURCE_MISC_SHARED = 0x2L, + D3D11_RESOURCE_MISC_TEXTURECUBE = 0x4L, + D3D11_RESOURCE_MISC_DRAWINDIRECT_ARGS = 0x10L, + D3D11_RESOURCE_MISC_BUFFER_ALLOW_RAW_VIEWS = 0x20L, + D3D11_RESOURCE_MISC_BUFFER_STRUCTURED = 0x40L, + D3D11_RESOURCE_MISC_RESOURCE_CLAMP = 0x80L, + D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX = 0x100L, + D3D11_RESOURCE_MISC_GDI_COMPATIBLE = 0x200L + } D3D11_RESOURCE_MISC_FLAG; + +typedef +enum D3D11_MAP + { D3D11_MAP_READ = 1, + D3D11_MAP_WRITE = 2, + D3D11_MAP_READ_WRITE = 3, + D3D11_MAP_WRITE_DISCARD = 4, + D3D11_MAP_WRITE_NO_OVERWRITE = 5 + } D3D11_MAP; + +typedef +enum D3D11_MAP_FLAG + { D3D11_MAP_FLAG_DO_NOT_WAIT = 0x100000L + } D3D11_MAP_FLAG; + +typedef +enum D3D11_RAISE_FLAG + { D3D11_RAISE_FLAG_DRIVER_INTERNAL_ERROR = 0x1L + } D3D11_RAISE_FLAG; + +typedef +enum D3D11_CLEAR_FLAG + { D3D11_CLEAR_DEPTH = 0x1L, + D3D11_CLEAR_STENCIL = 0x2L + } D3D11_CLEAR_FLAG; + +typedef RECT D3D11_RECT; + +#if !defined( D3D11_NO_HELPERS ) && defined( __cplusplus ) +} +struct CD3D11_RECT : public D3D11_RECT +{ + CD3D11_RECT() + {} + explicit CD3D11_RECT( const D3D11_RECT& o ) : + D3D11_RECT( o ) + {} + explicit CD3D11_RECT( + LONG Left, + LONG Top, + LONG Right, + LONG Bottom ) + { + left = Left; + top = Top; + right = Right; + bottom = Bottom; + } + ~CD3D11_RECT() {} + operator const D3D11_RECT&() const { return *this; } +}; +inline bool operator==( const D3D11_RECT& l, const D3D11_RECT& r ) +{ + return l.left == r.left && l.top == r.top && + l.right == r.right && l.bottom == r.bottom; +} +inline bool operator!=( const D3D11_RECT& l, const D3D11_RECT& r ) +{ return !( l == r ); } +extern "C"{ +#endif +typedef struct D3D11_BOX + { + UINT left; + UINT top; + UINT front; + UINT right; + UINT bottom; + UINT back; + } D3D11_BOX; + +#if !defined( D3D11_NO_HELPERS ) && defined( __cplusplus ) +} +struct CD3D11_BOX : public D3D11_BOX +{ + CD3D11_BOX() + {} + explicit CD3D11_BOX( const D3D11_BOX& o ) : + D3D11_BOX( o ) + {} + explicit CD3D11_BOX( + LONG Left, + LONG Top, + LONG Front, + LONG Right, + LONG Bottom, + LONG Back ) + { + left = Left; + top = Top; + front = Front; + right = Right; + bottom = Bottom; + back = Back; + } + ~CD3D11_BOX() {} + operator const D3D11_BOX&() const { return *this; } +}; +inline bool operator==( const D3D11_BOX& l, const D3D11_BOX& r ) +{ + return l.left == r.left && l.top == r.top && l.front == r.front && + l.right == r.right && l.bottom == r.bottom && l.back == r.back; +} +inline bool operator!=( const D3D11_BOX& l, const D3D11_BOX& r ) +{ return !( l == r ); } +extern "C"{ +#endif + + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d11_0000_0000_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d11_0000_0000_v0_0_s_ifspec; + +#ifndef __ID3D11DeviceChild_INTERFACE_DEFINED__ +#define __ID3D11DeviceChild_INTERFACE_DEFINED__ + +/* interface ID3D11DeviceChild */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D11DeviceChild; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("1841e5c8-16b0-489b-bcc8-44cfb0d5deae") + ID3D11DeviceChild : public IUnknown + { + public: + virtual void STDMETHODCALLTYPE GetDevice( + /* [annotation] */ + __out ID3D11Device **ppDevice) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetPrivateData( + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt( *pDataSize ) void *pData) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetPrivateData( + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt( DataSize ) const void *pData) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface( + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D11DeviceChildVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D11DeviceChild * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D11DeviceChild * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D11DeviceChild * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D11DeviceChild * This, + /* [annotation] */ + __out ID3D11Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D11DeviceChild * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D11DeviceChild * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D11DeviceChild * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData); + + END_INTERFACE + } ID3D11DeviceChildVtbl; + + interface ID3D11DeviceChild + { + CONST_VTBL struct ID3D11DeviceChildVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D11DeviceChild_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D11DeviceChild_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D11DeviceChild_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D11DeviceChild_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D11DeviceChild_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D11DeviceChild_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D11DeviceChild_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D11DeviceChild_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d11_0000_0001 */ +/* [local] */ + +typedef +enum D3D11_COMPARISON_FUNC + { D3D11_COMPARISON_NEVER = 1, + D3D11_COMPARISON_LESS = 2, + D3D11_COMPARISON_EQUAL = 3, + D3D11_COMPARISON_LESS_EQUAL = 4, + D3D11_COMPARISON_GREATER = 5, + D3D11_COMPARISON_NOT_EQUAL = 6, + D3D11_COMPARISON_GREATER_EQUAL = 7, + D3D11_COMPARISON_ALWAYS = 8 + } D3D11_COMPARISON_FUNC; + +typedef +enum D3D11_DEPTH_WRITE_MASK + { D3D11_DEPTH_WRITE_MASK_ZERO = 0, + D3D11_DEPTH_WRITE_MASK_ALL = 1 + } D3D11_DEPTH_WRITE_MASK; + +typedef +enum D3D11_STENCIL_OP + { D3D11_STENCIL_OP_KEEP = 1, + D3D11_STENCIL_OP_ZERO = 2, + D3D11_STENCIL_OP_REPLACE = 3, + D3D11_STENCIL_OP_INCR_SAT = 4, + D3D11_STENCIL_OP_DECR_SAT = 5, + D3D11_STENCIL_OP_INVERT = 6, + D3D11_STENCIL_OP_INCR = 7, + D3D11_STENCIL_OP_DECR = 8 + } D3D11_STENCIL_OP; + +typedef struct D3D11_DEPTH_STENCILOP_DESC + { + D3D11_STENCIL_OP StencilFailOp; + D3D11_STENCIL_OP StencilDepthFailOp; + D3D11_STENCIL_OP StencilPassOp; + D3D11_COMPARISON_FUNC StencilFunc; + } D3D11_DEPTH_STENCILOP_DESC; + +typedef struct D3D11_DEPTH_STENCIL_DESC + { + BOOL DepthEnable; + D3D11_DEPTH_WRITE_MASK DepthWriteMask; + D3D11_COMPARISON_FUNC DepthFunc; + BOOL StencilEnable; + UINT8 StencilReadMask; + UINT8 StencilWriteMask; + D3D11_DEPTH_STENCILOP_DESC FrontFace; + D3D11_DEPTH_STENCILOP_DESC BackFace; + } D3D11_DEPTH_STENCIL_DESC; + +#if !defined( D3D11_NO_HELPERS ) && defined( __cplusplus ) +} +struct CD3D11_DEPTH_STENCIL_DESC : public D3D11_DEPTH_STENCIL_DESC +{ + CD3D11_DEPTH_STENCIL_DESC() + {} + explicit CD3D11_DEPTH_STENCIL_DESC( const D3D11_DEPTH_STENCIL_DESC& o ) : + D3D11_DEPTH_STENCIL_DESC( o ) + {} + explicit CD3D11_DEPTH_STENCIL_DESC( CD3D11_DEFAULT ) + { + DepthEnable = TRUE; + DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL; + DepthFunc = D3D11_COMPARISON_LESS; + StencilEnable = FALSE; + StencilReadMask = D3D11_DEFAULT_STENCIL_READ_MASK; + StencilWriteMask = D3D11_DEFAULT_STENCIL_WRITE_MASK; + const D3D11_DEPTH_STENCILOP_DESC defaultStencilOp = + { D3D11_STENCIL_OP_KEEP, D3D11_STENCIL_OP_KEEP, D3D11_STENCIL_OP_KEEP, D3D11_COMPARISON_ALWAYS }; + FrontFace = defaultStencilOp; + BackFace = defaultStencilOp; + } + explicit CD3D11_DEPTH_STENCIL_DESC( + BOOL depthEnable, + D3D11_DEPTH_WRITE_MASK depthWriteMask, + D3D11_COMPARISON_FUNC depthFunc, + BOOL stencilEnable, + UINT8 stencilReadMask, + UINT8 stencilWriteMask, + D3D11_STENCIL_OP frontStencilFailOp, + D3D11_STENCIL_OP frontStencilDepthFailOp, + D3D11_STENCIL_OP frontStencilPassOp, + D3D11_COMPARISON_FUNC frontStencilFunc, + D3D11_STENCIL_OP backStencilFailOp, + D3D11_STENCIL_OP backStencilDepthFailOp, + D3D11_STENCIL_OP backStencilPassOp, + D3D11_COMPARISON_FUNC backStencilFunc ) + { + DepthEnable = depthEnable; + DepthWriteMask = depthWriteMask; + DepthFunc = depthFunc; + StencilEnable = stencilEnable; + StencilReadMask = stencilReadMask; + StencilWriteMask = stencilWriteMask; + FrontFace.StencilFailOp = frontStencilFailOp; + FrontFace.StencilDepthFailOp = frontStencilDepthFailOp; + FrontFace.StencilPassOp = frontStencilPassOp; + FrontFace.StencilFunc = frontStencilFunc; + BackFace.StencilFailOp = backStencilFailOp; + BackFace.StencilDepthFailOp = backStencilDepthFailOp; + BackFace.StencilPassOp = backStencilPassOp; + BackFace.StencilFunc = backStencilFunc; + } + ~CD3D11_DEPTH_STENCIL_DESC() {} + operator const D3D11_DEPTH_STENCIL_DESC&() const { return *this; } +}; +extern "C"{ +#endif + + +extern RPC_IF_HANDLE __MIDL_itf_d3d11_0000_0001_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d11_0000_0001_v0_0_s_ifspec; + +#ifndef __ID3D11DepthStencilState_INTERFACE_DEFINED__ +#define __ID3D11DepthStencilState_INTERFACE_DEFINED__ + +/* interface ID3D11DepthStencilState */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D11DepthStencilState; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("03823efb-8d8f-4e1c-9aa2-f64bb2cbfdf1") + ID3D11DepthStencilState : public ID3D11DeviceChild + { + public: + virtual void STDMETHODCALLTYPE GetDesc( + /* [annotation] */ + __out D3D11_DEPTH_STENCIL_DESC *pDesc) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D11DepthStencilStateVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D11DepthStencilState * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D11DepthStencilState * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D11DepthStencilState * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D11DepthStencilState * This, + /* [annotation] */ + __out ID3D11Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D11DepthStencilState * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D11DepthStencilState * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D11DepthStencilState * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData); + + void ( STDMETHODCALLTYPE *GetDesc )( + ID3D11DepthStencilState * This, + /* [annotation] */ + __out D3D11_DEPTH_STENCIL_DESC *pDesc); + + END_INTERFACE + } ID3D11DepthStencilStateVtbl; + + interface ID3D11DepthStencilState + { + CONST_VTBL struct ID3D11DepthStencilStateVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D11DepthStencilState_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D11DepthStencilState_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D11DepthStencilState_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D11DepthStencilState_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D11DepthStencilState_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D11DepthStencilState_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D11DepthStencilState_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D11DepthStencilState_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D11DepthStencilState_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d11_0000_0002 */ +/* [local] */ + +typedef +enum D3D11_BLEND + { D3D11_BLEND_ZERO = 1, + D3D11_BLEND_ONE = 2, + D3D11_BLEND_SRC_COLOR = 3, + D3D11_BLEND_INV_SRC_COLOR = 4, + D3D11_BLEND_SRC_ALPHA = 5, + D3D11_BLEND_INV_SRC_ALPHA = 6, + D3D11_BLEND_DEST_ALPHA = 7, + D3D11_BLEND_INV_DEST_ALPHA = 8, + D3D11_BLEND_DEST_COLOR = 9, + D3D11_BLEND_INV_DEST_COLOR = 10, + D3D11_BLEND_SRC_ALPHA_SAT = 11, + D3D11_BLEND_BLEND_FACTOR = 14, + D3D11_BLEND_INV_BLEND_FACTOR = 15, + D3D11_BLEND_SRC1_COLOR = 16, + D3D11_BLEND_INV_SRC1_COLOR = 17, + D3D11_BLEND_SRC1_ALPHA = 18, + D3D11_BLEND_INV_SRC1_ALPHA = 19 + } D3D11_BLEND; + +typedef +enum D3D11_BLEND_OP + { D3D11_BLEND_OP_ADD = 1, + D3D11_BLEND_OP_SUBTRACT = 2, + D3D11_BLEND_OP_REV_SUBTRACT = 3, + D3D11_BLEND_OP_MIN = 4, + D3D11_BLEND_OP_MAX = 5 + } D3D11_BLEND_OP; + +typedef +enum D3D11_COLOR_WRITE_ENABLE + { D3D11_COLOR_WRITE_ENABLE_RED = 1, + D3D11_COLOR_WRITE_ENABLE_GREEN = 2, + D3D11_COLOR_WRITE_ENABLE_BLUE = 4, + D3D11_COLOR_WRITE_ENABLE_ALPHA = 8, + D3D11_COLOR_WRITE_ENABLE_ALL = ( ( ( D3D11_COLOR_WRITE_ENABLE_RED | D3D11_COLOR_WRITE_ENABLE_GREEN ) | D3D11_COLOR_WRITE_ENABLE_BLUE ) | D3D11_COLOR_WRITE_ENABLE_ALPHA ) + } D3D11_COLOR_WRITE_ENABLE; + +typedef struct D3D11_RENDER_TARGET_BLEND_DESC + { + BOOL BlendEnable; + D3D11_BLEND SrcBlend; + D3D11_BLEND DestBlend; + D3D11_BLEND_OP BlendOp; + D3D11_BLEND SrcBlendAlpha; + D3D11_BLEND DestBlendAlpha; + D3D11_BLEND_OP BlendOpAlpha; + UINT8 RenderTargetWriteMask; + } D3D11_RENDER_TARGET_BLEND_DESC; + +typedef struct D3D11_BLEND_DESC + { + BOOL AlphaToCoverageEnable; + BOOL IndependentBlendEnable; + D3D11_RENDER_TARGET_BLEND_DESC RenderTarget[ 8 ]; + } D3D11_BLEND_DESC; + +/* Note, the array size for RenderTarget[] above is D3D11_SIMULTANEOUS_RENDERTARGET_COUNT. + IDL processing/generation of this header replaces the define; this comment is merely explaining what happened. */ +#if !defined( D3D11_NO_HELPERS ) && defined( __cplusplus ) +} +struct CD3D11_BLEND_DESC : public D3D11_BLEND_DESC +{ + CD3D11_BLEND_DESC() + {} + explicit CD3D11_BLEND_DESC( const D3D11_BLEND_DESC& o ) : + D3D11_BLEND_DESC( o ) + {} + explicit CD3D11_BLEND_DESC( CD3D11_DEFAULT ) + { + AlphaToCoverageEnable = FALSE; + IndependentBlendEnable = FALSE; + const D3D11_RENDER_TARGET_BLEND_DESC defaultRenderTargetBlendDesc = + { + FALSE, + D3D11_BLEND_ONE, D3D11_BLEND_ZERO, D3D11_BLEND_OP_ADD, + D3D11_BLEND_ONE, D3D11_BLEND_ZERO, D3D11_BLEND_OP_ADD, + D3D11_COLOR_WRITE_ENABLE_ALL, + }; + for (UINT i = 0; i < D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT; ++i) + RenderTarget[ i ] = defaultRenderTargetBlendDesc; + } + ~CD3D11_BLEND_DESC() {} + operator const D3D11_BLEND_DESC&() const { return *this; } +}; +extern "C"{ +#endif + + +extern RPC_IF_HANDLE __MIDL_itf_d3d11_0000_0002_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d11_0000_0002_v0_0_s_ifspec; + +#ifndef __ID3D11BlendState_INTERFACE_DEFINED__ +#define __ID3D11BlendState_INTERFACE_DEFINED__ + +/* interface ID3D11BlendState */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D11BlendState; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("75b68faa-347d-4159-8f45-a0640f01cd9a") + ID3D11BlendState : public ID3D11DeviceChild + { + public: + virtual void STDMETHODCALLTYPE GetDesc( + /* [annotation] */ + __out D3D11_BLEND_DESC *pDesc) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D11BlendStateVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D11BlendState * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D11BlendState * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D11BlendState * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D11BlendState * This, + /* [annotation] */ + __out ID3D11Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D11BlendState * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D11BlendState * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D11BlendState * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData); + + void ( STDMETHODCALLTYPE *GetDesc )( + ID3D11BlendState * This, + /* [annotation] */ + __out D3D11_BLEND_DESC *pDesc); + + END_INTERFACE + } ID3D11BlendStateVtbl; + + interface ID3D11BlendState + { + CONST_VTBL struct ID3D11BlendStateVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D11BlendState_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D11BlendState_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D11BlendState_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D11BlendState_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D11BlendState_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D11BlendState_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D11BlendState_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D11BlendState_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D11BlendState_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d11_0000_0003 */ +/* [local] */ + +typedef struct D3D11_RASTERIZER_DESC + { + D3D11_FILL_MODE FillMode; + D3D11_CULL_MODE CullMode; + BOOL FrontCounterClockwise; + INT DepthBias; + FLOAT DepthBiasClamp; + FLOAT SlopeScaledDepthBias; + BOOL DepthClipEnable; + BOOL ScissorEnable; + BOOL MultisampleEnable; + BOOL AntialiasedLineEnable; + } D3D11_RASTERIZER_DESC; + +#if !defined( D3D11_NO_HELPERS ) && defined( __cplusplus ) +} +struct CD3D11_RASTERIZER_DESC : public D3D11_RASTERIZER_DESC +{ + CD3D11_RASTERIZER_DESC() + {} + explicit CD3D11_RASTERIZER_DESC( const D3D11_RASTERIZER_DESC& o ) : + D3D11_RASTERIZER_DESC( o ) + {} + explicit CD3D11_RASTERIZER_DESC( CD3D11_DEFAULT ) + { + FillMode = D3D11_FILL_SOLID; + CullMode = D3D11_CULL_BACK; + FrontCounterClockwise = FALSE; + DepthBias = D3D11_DEFAULT_DEPTH_BIAS; + DepthBiasClamp = D3D11_DEFAULT_DEPTH_BIAS_CLAMP; + SlopeScaledDepthBias = D3D11_DEFAULT_SLOPE_SCALED_DEPTH_BIAS; + DepthClipEnable = TRUE; + ScissorEnable = FALSE; + MultisampleEnable = FALSE; + AntialiasedLineEnable = FALSE; + } + explicit CD3D11_RASTERIZER_DESC( + D3D11_FILL_MODE fillMode, + D3D11_CULL_MODE cullMode, + BOOL frontCounterClockwise, + INT depthBias, + FLOAT depthBiasClamp, + FLOAT slopeScaledDepthBias, + BOOL depthClipEnable, + BOOL scissorEnable, + BOOL multisampleEnable, + BOOL antialiasedLineEnable ) + { + FillMode = fillMode; + CullMode = cullMode; + FrontCounterClockwise = frontCounterClockwise; + DepthBias = depthBias; + DepthBiasClamp = depthBiasClamp; + SlopeScaledDepthBias = slopeScaledDepthBias; + DepthClipEnable = depthClipEnable; + ScissorEnable = scissorEnable; + MultisampleEnable = multisampleEnable; + AntialiasedLineEnable = antialiasedLineEnable; + } + ~CD3D11_RASTERIZER_DESC() {} + operator const D3D11_RASTERIZER_DESC&() const { return *this; } +}; +extern "C"{ +#endif + + +extern RPC_IF_HANDLE __MIDL_itf_d3d11_0000_0003_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d11_0000_0003_v0_0_s_ifspec; + +#ifndef __ID3D11RasterizerState_INTERFACE_DEFINED__ +#define __ID3D11RasterizerState_INTERFACE_DEFINED__ + +/* interface ID3D11RasterizerState */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D11RasterizerState; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9bb4ab81-ab1a-4d8f-b506-fc04200b6ee7") + ID3D11RasterizerState : public ID3D11DeviceChild + { + public: + virtual void STDMETHODCALLTYPE GetDesc( + /* [annotation] */ + __out D3D11_RASTERIZER_DESC *pDesc) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D11RasterizerStateVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D11RasterizerState * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D11RasterizerState * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D11RasterizerState * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D11RasterizerState * This, + /* [annotation] */ + __out ID3D11Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D11RasterizerState * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D11RasterizerState * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D11RasterizerState * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData); + + void ( STDMETHODCALLTYPE *GetDesc )( + ID3D11RasterizerState * This, + /* [annotation] */ + __out D3D11_RASTERIZER_DESC *pDesc); + + END_INTERFACE + } ID3D11RasterizerStateVtbl; + + interface ID3D11RasterizerState + { + CONST_VTBL struct ID3D11RasterizerStateVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D11RasterizerState_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D11RasterizerState_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D11RasterizerState_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D11RasterizerState_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D11RasterizerState_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D11RasterizerState_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D11RasterizerState_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D11RasterizerState_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D11RasterizerState_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d11_0000_0004 */ +/* [local] */ + +#if !defined( D3D11_NO_HELPERS ) && defined( __cplusplus ) +} +inline UINT D3D11CalcSubresource( UINT MipSlice, UINT ArraySlice, UINT MipLevels ) +{ return MipSlice + ArraySlice * MipLevels; } +extern "C"{ +#endif +typedef struct D3D11_SUBRESOURCE_DATA + { + const void *pSysMem; + UINT SysMemPitch; + UINT SysMemSlicePitch; + } D3D11_SUBRESOURCE_DATA; + +typedef struct D3D11_MAPPED_SUBRESOURCE + { + void *pData; + UINT RowPitch; + UINT DepthPitch; + } D3D11_MAPPED_SUBRESOURCE; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d11_0000_0004_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d11_0000_0004_v0_0_s_ifspec; + +#ifndef __ID3D11Resource_INTERFACE_DEFINED__ +#define __ID3D11Resource_INTERFACE_DEFINED__ + +/* interface ID3D11Resource */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D11Resource; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("dc8e63f3-d12b-4952-b47b-5e45026a862d") + ID3D11Resource : public ID3D11DeviceChild + { + public: + virtual void STDMETHODCALLTYPE GetType( + /* [annotation] */ + __out D3D11_RESOURCE_DIMENSION *pResourceDimension) = 0; + + virtual void STDMETHODCALLTYPE SetEvictionPriority( + /* [annotation] */ + __in UINT EvictionPriority) = 0; + + virtual UINT STDMETHODCALLTYPE GetEvictionPriority( void) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D11ResourceVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D11Resource * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D11Resource * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D11Resource * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D11Resource * This, + /* [annotation] */ + __out ID3D11Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D11Resource * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D11Resource * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D11Resource * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData); + + void ( STDMETHODCALLTYPE *GetType )( + ID3D11Resource * This, + /* [annotation] */ + __out D3D11_RESOURCE_DIMENSION *pResourceDimension); + + void ( STDMETHODCALLTYPE *SetEvictionPriority )( + ID3D11Resource * This, + /* [annotation] */ + __in UINT EvictionPriority); + + UINT ( STDMETHODCALLTYPE *GetEvictionPriority )( + ID3D11Resource * This); + + END_INTERFACE + } ID3D11ResourceVtbl; + + interface ID3D11Resource + { + CONST_VTBL struct ID3D11ResourceVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D11Resource_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D11Resource_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D11Resource_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D11Resource_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D11Resource_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D11Resource_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D11Resource_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D11Resource_GetType(This,pResourceDimension) \ + ( (This)->lpVtbl -> GetType(This,pResourceDimension) ) + +#define ID3D11Resource_SetEvictionPriority(This,EvictionPriority) \ + ( (This)->lpVtbl -> SetEvictionPriority(This,EvictionPriority) ) + +#define ID3D11Resource_GetEvictionPriority(This) \ + ( (This)->lpVtbl -> GetEvictionPriority(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D11Resource_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d11_0000_0005 */ +/* [local] */ + +typedef struct D3D11_BUFFER_DESC + { + UINT ByteWidth; + D3D11_USAGE Usage; + UINT BindFlags; + UINT CPUAccessFlags; + UINT MiscFlags; + UINT StructureByteStride; + } D3D11_BUFFER_DESC; + +#if !defined( D3D11_NO_HELPERS ) && defined( __cplusplus ) +} +struct CD3D11_BUFFER_DESC : public D3D11_BUFFER_DESC +{ + CD3D11_BUFFER_DESC() + {} + explicit CD3D11_BUFFER_DESC( const D3D11_BUFFER_DESC& o ) : + D3D11_BUFFER_DESC( o ) + {} + explicit CD3D11_BUFFER_DESC( + UINT byteWidth, + UINT bindFlags, + D3D11_USAGE usage = D3D11_USAGE_DEFAULT, + UINT cpuaccessFlags = 0, + UINT miscFlags = 0, + UINT structureByteStride = 0 ) + { + ByteWidth = byteWidth; + Usage = usage; + BindFlags = bindFlags; + CPUAccessFlags = cpuaccessFlags ; + MiscFlags = miscFlags; + StructureByteStride = structureByteStride; + } + ~CD3D11_BUFFER_DESC() {} + operator const D3D11_BUFFER_DESC&() const { return *this; } +}; +extern "C"{ +#endif + + +extern RPC_IF_HANDLE __MIDL_itf_d3d11_0000_0005_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d11_0000_0005_v0_0_s_ifspec; + +#ifndef __ID3D11Buffer_INTERFACE_DEFINED__ +#define __ID3D11Buffer_INTERFACE_DEFINED__ + +/* interface ID3D11Buffer */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D11Buffer; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("48570b85-d1ee-4fcd-a250-eb350722b037") + ID3D11Buffer : public ID3D11Resource + { + public: + virtual void STDMETHODCALLTYPE GetDesc( + /* [annotation] */ + __out D3D11_BUFFER_DESC *pDesc) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D11BufferVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D11Buffer * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D11Buffer * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D11Buffer * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D11Buffer * This, + /* [annotation] */ + __out ID3D11Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D11Buffer * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D11Buffer * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D11Buffer * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData); + + void ( STDMETHODCALLTYPE *GetType )( + ID3D11Buffer * This, + /* [annotation] */ + __out D3D11_RESOURCE_DIMENSION *pResourceDimension); + + void ( STDMETHODCALLTYPE *SetEvictionPriority )( + ID3D11Buffer * This, + /* [annotation] */ + __in UINT EvictionPriority); + + UINT ( STDMETHODCALLTYPE *GetEvictionPriority )( + ID3D11Buffer * This); + + void ( STDMETHODCALLTYPE *GetDesc )( + ID3D11Buffer * This, + /* [annotation] */ + __out D3D11_BUFFER_DESC *pDesc); + + END_INTERFACE + } ID3D11BufferVtbl; + + interface ID3D11Buffer + { + CONST_VTBL struct ID3D11BufferVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D11Buffer_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D11Buffer_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D11Buffer_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D11Buffer_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D11Buffer_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D11Buffer_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D11Buffer_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D11Buffer_GetType(This,pResourceDimension) \ + ( (This)->lpVtbl -> GetType(This,pResourceDimension) ) + +#define ID3D11Buffer_SetEvictionPriority(This,EvictionPriority) \ + ( (This)->lpVtbl -> SetEvictionPriority(This,EvictionPriority) ) + +#define ID3D11Buffer_GetEvictionPriority(This) \ + ( (This)->lpVtbl -> GetEvictionPriority(This) ) + + +#define ID3D11Buffer_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D11Buffer_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d11_0000_0006 */ +/* [local] */ + +typedef struct D3D11_TEXTURE1D_DESC + { + UINT Width; + UINT MipLevels; + UINT ArraySize; + DXGI_FORMAT Format; + D3D11_USAGE Usage; + UINT BindFlags; + UINT CPUAccessFlags; + UINT MiscFlags; + } D3D11_TEXTURE1D_DESC; + +#if !defined( D3D11_NO_HELPERS ) && defined( __cplusplus ) +} +struct CD3D11_TEXTURE1D_DESC : public D3D11_TEXTURE1D_DESC +{ + CD3D11_TEXTURE1D_DESC() + {} + explicit CD3D11_TEXTURE1D_DESC( const D3D11_TEXTURE1D_DESC& o ) : + D3D11_TEXTURE1D_DESC( o ) + {} + explicit CD3D11_TEXTURE1D_DESC( + DXGI_FORMAT format, + UINT width, + UINT arraySize = 1, + UINT mipLevels = 0, + UINT bindFlags = D3D11_BIND_SHADER_RESOURCE, + D3D11_USAGE usage = D3D11_USAGE_DEFAULT, + UINT cpuaccessFlags= 0, + UINT miscFlags = 0 ) + { + Width = width; + MipLevels = mipLevels; + ArraySize = arraySize; + Format = format; + Usage = usage; + BindFlags = bindFlags; + CPUAccessFlags = cpuaccessFlags; + MiscFlags = miscFlags; + } + ~CD3D11_TEXTURE1D_DESC() {} + operator const D3D11_TEXTURE1D_DESC&() const { return *this; } +}; +extern "C"{ +#endif + + +extern RPC_IF_HANDLE __MIDL_itf_d3d11_0000_0006_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d11_0000_0006_v0_0_s_ifspec; + +#ifndef __ID3D11Texture1D_INTERFACE_DEFINED__ +#define __ID3D11Texture1D_INTERFACE_DEFINED__ + +/* interface ID3D11Texture1D */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D11Texture1D; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("f8fb5c27-c6b3-4f75-a4c8-439af2ef564c") + ID3D11Texture1D : public ID3D11Resource + { + public: + virtual void STDMETHODCALLTYPE GetDesc( + /* [annotation] */ + __out D3D11_TEXTURE1D_DESC *pDesc) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D11Texture1DVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D11Texture1D * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D11Texture1D * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D11Texture1D * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D11Texture1D * This, + /* [annotation] */ + __out ID3D11Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D11Texture1D * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D11Texture1D * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D11Texture1D * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData); + + void ( STDMETHODCALLTYPE *GetType )( + ID3D11Texture1D * This, + /* [annotation] */ + __out D3D11_RESOURCE_DIMENSION *pResourceDimension); + + void ( STDMETHODCALLTYPE *SetEvictionPriority )( + ID3D11Texture1D * This, + /* [annotation] */ + __in UINT EvictionPriority); + + UINT ( STDMETHODCALLTYPE *GetEvictionPriority )( + ID3D11Texture1D * This); + + void ( STDMETHODCALLTYPE *GetDesc )( + ID3D11Texture1D * This, + /* [annotation] */ + __out D3D11_TEXTURE1D_DESC *pDesc); + + END_INTERFACE + } ID3D11Texture1DVtbl; + + interface ID3D11Texture1D + { + CONST_VTBL struct ID3D11Texture1DVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D11Texture1D_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D11Texture1D_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D11Texture1D_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D11Texture1D_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D11Texture1D_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D11Texture1D_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D11Texture1D_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D11Texture1D_GetType(This,pResourceDimension) \ + ( (This)->lpVtbl -> GetType(This,pResourceDimension) ) + +#define ID3D11Texture1D_SetEvictionPriority(This,EvictionPriority) \ + ( (This)->lpVtbl -> SetEvictionPriority(This,EvictionPriority) ) + +#define ID3D11Texture1D_GetEvictionPriority(This) \ + ( (This)->lpVtbl -> GetEvictionPriority(This) ) + + +#define ID3D11Texture1D_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D11Texture1D_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d11_0000_0007 */ +/* [local] */ + +typedef struct D3D11_TEXTURE2D_DESC + { + UINT Width; + UINT Height; + UINT MipLevels; + UINT ArraySize; + DXGI_FORMAT Format; + DXGI_SAMPLE_DESC SampleDesc; + D3D11_USAGE Usage; + UINT BindFlags; + UINT CPUAccessFlags; + UINT MiscFlags; + } D3D11_TEXTURE2D_DESC; + +#if !defined( D3D11_NO_HELPERS ) && defined( __cplusplus ) +} +struct CD3D11_TEXTURE2D_DESC : public D3D11_TEXTURE2D_DESC +{ + CD3D11_TEXTURE2D_DESC() + {} + explicit CD3D11_TEXTURE2D_DESC( const D3D11_TEXTURE2D_DESC& o ) : + D3D11_TEXTURE2D_DESC( o ) + {} + explicit CD3D11_TEXTURE2D_DESC( + DXGI_FORMAT format, + UINT width, + UINT height, + UINT arraySize = 1, + UINT mipLevels = 0, + UINT bindFlags = D3D11_BIND_SHADER_RESOURCE, + D3D11_USAGE usage = D3D11_USAGE_DEFAULT, + UINT cpuaccessFlags = 0, + UINT sampleCount = 1, + UINT sampleQuality = 0, + UINT miscFlags = 0 ) + { + Width = width; + Height = height; + MipLevels = mipLevels; + ArraySize = arraySize; + Format = format; + SampleDesc.Count = sampleCount; + SampleDesc.Quality = sampleQuality; + Usage = usage; + BindFlags = bindFlags; + CPUAccessFlags = cpuaccessFlags; + MiscFlags = miscFlags; + } + ~CD3D11_TEXTURE2D_DESC() {} + operator const D3D11_TEXTURE2D_DESC&() const { return *this; } +}; +extern "C"{ +#endif + + +extern RPC_IF_HANDLE __MIDL_itf_d3d11_0000_0007_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d11_0000_0007_v0_0_s_ifspec; + +#ifndef __ID3D11Texture2D_INTERFACE_DEFINED__ +#define __ID3D11Texture2D_INTERFACE_DEFINED__ + +/* interface ID3D11Texture2D */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D11Texture2D; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("6f15aaf2-d208-4e89-9ab4-489535d34f9c") + ID3D11Texture2D : public ID3D11Resource + { + public: + virtual void STDMETHODCALLTYPE GetDesc( + /* [annotation] */ + __out D3D11_TEXTURE2D_DESC *pDesc) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D11Texture2DVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D11Texture2D * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D11Texture2D * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D11Texture2D * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D11Texture2D * This, + /* [annotation] */ + __out ID3D11Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D11Texture2D * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D11Texture2D * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D11Texture2D * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData); + + void ( STDMETHODCALLTYPE *GetType )( + ID3D11Texture2D * This, + /* [annotation] */ + __out D3D11_RESOURCE_DIMENSION *pResourceDimension); + + void ( STDMETHODCALLTYPE *SetEvictionPriority )( + ID3D11Texture2D * This, + /* [annotation] */ + __in UINT EvictionPriority); + + UINT ( STDMETHODCALLTYPE *GetEvictionPriority )( + ID3D11Texture2D * This); + + void ( STDMETHODCALLTYPE *GetDesc )( + ID3D11Texture2D * This, + /* [annotation] */ + __out D3D11_TEXTURE2D_DESC *pDesc); + + END_INTERFACE + } ID3D11Texture2DVtbl; + + interface ID3D11Texture2D + { + CONST_VTBL struct ID3D11Texture2DVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D11Texture2D_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D11Texture2D_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D11Texture2D_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D11Texture2D_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D11Texture2D_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D11Texture2D_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D11Texture2D_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D11Texture2D_GetType(This,pResourceDimension) \ + ( (This)->lpVtbl -> GetType(This,pResourceDimension) ) + +#define ID3D11Texture2D_SetEvictionPriority(This,EvictionPriority) \ + ( (This)->lpVtbl -> SetEvictionPriority(This,EvictionPriority) ) + +#define ID3D11Texture2D_GetEvictionPriority(This) \ + ( (This)->lpVtbl -> GetEvictionPriority(This) ) + + +#define ID3D11Texture2D_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D11Texture2D_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d11_0000_0008 */ +/* [local] */ + +typedef struct D3D11_TEXTURE3D_DESC + { + UINT Width; + UINT Height; + UINT Depth; + UINT MipLevels; + DXGI_FORMAT Format; + D3D11_USAGE Usage; + UINT BindFlags; + UINT CPUAccessFlags; + UINT MiscFlags; + } D3D11_TEXTURE3D_DESC; + +#if !defined( D3D11_NO_HELPERS ) && defined( __cplusplus ) +} +struct CD3D11_TEXTURE3D_DESC : public D3D11_TEXTURE3D_DESC +{ + CD3D11_TEXTURE3D_DESC() + {} + explicit CD3D11_TEXTURE3D_DESC( const D3D11_TEXTURE3D_DESC& o ) : + D3D11_TEXTURE3D_DESC( o ) + {} + explicit CD3D11_TEXTURE3D_DESC( + DXGI_FORMAT format, + UINT width, + UINT height, + UINT depth, + UINT mipLevels = 0, + UINT bindFlags = D3D11_BIND_SHADER_RESOURCE, + D3D11_USAGE usage = D3D11_USAGE_DEFAULT, + UINT cpuaccessFlags = 0, + UINT miscFlags = 0 ) + { + Width = width; + Height = height; + Depth = depth; + MipLevels = mipLevels; + Format = format; + Usage = usage; + BindFlags = bindFlags; + CPUAccessFlags = cpuaccessFlags; + MiscFlags = miscFlags; + } + ~CD3D11_TEXTURE3D_DESC() {} + operator const D3D11_TEXTURE3D_DESC&() const { return *this; } +}; +extern "C"{ +#endif + + +extern RPC_IF_HANDLE __MIDL_itf_d3d11_0000_0008_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d11_0000_0008_v0_0_s_ifspec; + +#ifndef __ID3D11Texture3D_INTERFACE_DEFINED__ +#define __ID3D11Texture3D_INTERFACE_DEFINED__ + +/* interface ID3D11Texture3D */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D11Texture3D; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("037e866e-f56d-4357-a8af-9dabbe6e250e") + ID3D11Texture3D : public ID3D11Resource + { + public: + virtual void STDMETHODCALLTYPE GetDesc( + /* [annotation] */ + __out D3D11_TEXTURE3D_DESC *pDesc) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D11Texture3DVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D11Texture3D * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D11Texture3D * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D11Texture3D * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D11Texture3D * This, + /* [annotation] */ + __out ID3D11Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D11Texture3D * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D11Texture3D * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D11Texture3D * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData); + + void ( STDMETHODCALLTYPE *GetType )( + ID3D11Texture3D * This, + /* [annotation] */ + __out D3D11_RESOURCE_DIMENSION *pResourceDimension); + + void ( STDMETHODCALLTYPE *SetEvictionPriority )( + ID3D11Texture3D * This, + /* [annotation] */ + __in UINT EvictionPriority); + + UINT ( STDMETHODCALLTYPE *GetEvictionPriority )( + ID3D11Texture3D * This); + + void ( STDMETHODCALLTYPE *GetDesc )( + ID3D11Texture3D * This, + /* [annotation] */ + __out D3D11_TEXTURE3D_DESC *pDesc); + + END_INTERFACE + } ID3D11Texture3DVtbl; + + interface ID3D11Texture3D + { + CONST_VTBL struct ID3D11Texture3DVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D11Texture3D_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D11Texture3D_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D11Texture3D_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D11Texture3D_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D11Texture3D_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D11Texture3D_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D11Texture3D_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D11Texture3D_GetType(This,pResourceDimension) \ + ( (This)->lpVtbl -> GetType(This,pResourceDimension) ) + +#define ID3D11Texture3D_SetEvictionPriority(This,EvictionPriority) \ + ( (This)->lpVtbl -> SetEvictionPriority(This,EvictionPriority) ) + +#define ID3D11Texture3D_GetEvictionPriority(This) \ + ( (This)->lpVtbl -> GetEvictionPriority(This) ) + + +#define ID3D11Texture3D_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D11Texture3D_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d11_0000_0009 */ +/* [local] */ + +typedef +enum D3D11_TEXTURECUBE_FACE + { D3D11_TEXTURECUBE_FACE_POSITIVE_X = 0, + D3D11_TEXTURECUBE_FACE_NEGATIVE_X = 1, + D3D11_TEXTURECUBE_FACE_POSITIVE_Y = 2, + D3D11_TEXTURECUBE_FACE_NEGATIVE_Y = 3, + D3D11_TEXTURECUBE_FACE_POSITIVE_Z = 4, + D3D11_TEXTURECUBE_FACE_NEGATIVE_Z = 5 + } D3D11_TEXTURECUBE_FACE; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d11_0000_0009_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d11_0000_0009_v0_0_s_ifspec; + +#ifndef __ID3D11View_INTERFACE_DEFINED__ +#define __ID3D11View_INTERFACE_DEFINED__ + +/* interface ID3D11View */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D11View; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("839d1216-bb2e-412b-b7f4-a9dbebe08ed1") + ID3D11View : public ID3D11DeviceChild + { + public: + virtual void STDMETHODCALLTYPE GetResource( + /* [annotation] */ + __out ID3D11Resource **ppResource) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D11ViewVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D11View * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D11View * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D11View * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D11View * This, + /* [annotation] */ + __out ID3D11Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D11View * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D11View * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D11View * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData); + + void ( STDMETHODCALLTYPE *GetResource )( + ID3D11View * This, + /* [annotation] */ + __out ID3D11Resource **ppResource); + + END_INTERFACE + } ID3D11ViewVtbl; + + interface ID3D11View + { + CONST_VTBL struct ID3D11ViewVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D11View_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D11View_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D11View_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D11View_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D11View_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D11View_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D11View_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D11View_GetResource(This,ppResource) \ + ( (This)->lpVtbl -> GetResource(This,ppResource) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D11View_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d11_0000_0010 */ +/* [local] */ + +typedef struct D3D11_BUFFER_SRV + { + union + { + UINT FirstElement; + UINT ElementOffset; + } ; + union + { + UINT NumElements; + UINT ElementWidth; + } ; + } D3D11_BUFFER_SRV; + +typedef +enum D3D11_BUFFEREX_SRV_FLAG + { D3D11_BUFFEREX_SRV_FLAG_RAW = 0x1 + } D3D11_BUFFEREX_SRV_FLAG; + +typedef struct D3D11_BUFFEREX_SRV + { + UINT FirstElement; + UINT NumElements; + UINT Flags; + } D3D11_BUFFEREX_SRV; + +typedef struct D3D11_TEX1D_SRV + { + UINT MostDetailedMip; + UINT MipLevels; + } D3D11_TEX1D_SRV; + +typedef struct D3D11_TEX1D_ARRAY_SRV + { + UINT MostDetailedMip; + UINT MipLevels; + UINT FirstArraySlice; + UINT ArraySize; + } D3D11_TEX1D_ARRAY_SRV; + +typedef struct D3D11_TEX2D_SRV + { + UINT MostDetailedMip; + UINT MipLevels; + } D3D11_TEX2D_SRV; + +typedef struct D3D11_TEX2D_ARRAY_SRV + { + UINT MostDetailedMip; + UINT MipLevels; + UINT FirstArraySlice; + UINT ArraySize; + } D3D11_TEX2D_ARRAY_SRV; + +typedef struct D3D11_TEX3D_SRV + { + UINT MostDetailedMip; + UINT MipLevels; + } D3D11_TEX3D_SRV; + +typedef struct D3D11_TEXCUBE_SRV + { + UINT MostDetailedMip; + UINT MipLevels; + } D3D11_TEXCUBE_SRV; + +typedef struct D3D11_TEXCUBE_ARRAY_SRV + { + UINT MostDetailedMip; + UINT MipLevels; + UINT First2DArrayFace; + UINT NumCubes; + } D3D11_TEXCUBE_ARRAY_SRV; + +typedef struct D3D11_TEX2DMS_SRV + { + UINT UnusedField_NothingToDefine; + } D3D11_TEX2DMS_SRV; + +typedef struct D3D11_TEX2DMS_ARRAY_SRV + { + UINT FirstArraySlice; + UINT ArraySize; + } D3D11_TEX2DMS_ARRAY_SRV; + +typedef struct D3D11_SHADER_RESOURCE_VIEW_DESC + { + DXGI_FORMAT Format; + D3D11_SRV_DIMENSION ViewDimension; + union + { + D3D11_BUFFER_SRV Buffer; + D3D11_TEX1D_SRV Texture1D; + D3D11_TEX1D_ARRAY_SRV Texture1DArray; + D3D11_TEX2D_SRV Texture2D; + D3D11_TEX2D_ARRAY_SRV Texture2DArray; + D3D11_TEX2DMS_SRV Texture2DMS; + D3D11_TEX2DMS_ARRAY_SRV Texture2DMSArray; + D3D11_TEX3D_SRV Texture3D; + D3D11_TEXCUBE_SRV TextureCube; + D3D11_TEXCUBE_ARRAY_SRV TextureCubeArray; + D3D11_BUFFEREX_SRV BufferEx; + } ; + } D3D11_SHADER_RESOURCE_VIEW_DESC; + +#if !defined( D3D11_NO_HELPERS ) && defined( __cplusplus ) +} +struct CD3D11_SHADER_RESOURCE_VIEW_DESC : public D3D11_SHADER_RESOURCE_VIEW_DESC +{ + CD3D11_SHADER_RESOURCE_VIEW_DESC() + {} + explicit CD3D11_SHADER_RESOURCE_VIEW_DESC( const D3D11_SHADER_RESOURCE_VIEW_DESC& o ) : + D3D11_SHADER_RESOURCE_VIEW_DESC( o ) + {} + explicit CD3D11_SHADER_RESOURCE_VIEW_DESC( + D3D11_SRV_DIMENSION viewDimension, + DXGI_FORMAT format = DXGI_FORMAT_UNKNOWN, + UINT mostDetailedMip = 0, // FirstElement for BUFFER + UINT mipLevels = -1, // NumElements for BUFFER + UINT firstArraySlice = 0, // First2DArrayFace for TEXTURECUBEARRAY + UINT arraySize = -1, // NumCubes for TEXTURECUBEARRAY + UINT flags = 0 ) // BUFFEREX only + { + Format = format; + ViewDimension = viewDimension; + switch (viewDimension) + { + case D3D11_SRV_DIMENSION_BUFFER: + Buffer.FirstElement = mostDetailedMip; + Buffer.NumElements = mipLevels; + break; + case D3D11_SRV_DIMENSION_TEXTURE1D: + Texture1D.MostDetailedMip = mostDetailedMip; + Texture1D.MipLevels = mipLevels; + break; + case D3D11_SRV_DIMENSION_TEXTURE1DARRAY: + Texture1DArray.MostDetailedMip = mostDetailedMip; + Texture1DArray.MipLevels = mipLevels; + Texture1DArray.FirstArraySlice = firstArraySlice; + Texture1DArray.ArraySize = arraySize; + break; + case D3D11_SRV_DIMENSION_TEXTURE2D: + Texture2D.MostDetailedMip = mostDetailedMip; + Texture2D.MipLevels = mipLevels; + break; + case D3D11_SRV_DIMENSION_TEXTURE2DARRAY: + Texture2DArray.MostDetailedMip = mostDetailedMip; + Texture2DArray.MipLevels = mipLevels; + Texture2DArray.FirstArraySlice = firstArraySlice; + Texture2DArray.ArraySize = arraySize; + break; + case D3D11_SRV_DIMENSION_TEXTURE2DMS: + break; + case D3D11_SRV_DIMENSION_TEXTURE2DMSARRAY: + Texture2DMSArray.FirstArraySlice = firstArraySlice; + Texture2DMSArray.ArraySize = arraySize; + break; + case D3D11_SRV_DIMENSION_TEXTURE3D: + Texture3D.MostDetailedMip = mostDetailedMip; + Texture3D.MipLevels = mipLevels; + break; + case D3D11_SRV_DIMENSION_TEXTURECUBE: + TextureCube.MostDetailedMip = mostDetailedMip; + TextureCube.MipLevels = mipLevels; + break; + case D3D11_SRV_DIMENSION_TEXTURECUBEARRAY: + TextureCubeArray.MostDetailedMip = mostDetailedMip; + TextureCubeArray.MipLevels = mipLevels; + TextureCubeArray.First2DArrayFace = firstArraySlice; + TextureCubeArray.NumCubes = arraySize; + break; + case D3D11_SRV_DIMENSION_BUFFEREX: + BufferEx.FirstElement = mostDetailedMip; + BufferEx.NumElements = mipLevels; + BufferEx.Flags = flags; + break; + default: break; + } + } + explicit CD3D11_SHADER_RESOURCE_VIEW_DESC( + __in ID3D11Buffer*, + DXGI_FORMAT format, + UINT firstElement, + UINT numElements, + UINT flags = 0 ) + { + Format = format; + ViewDimension = D3D11_SRV_DIMENSION_BUFFEREX; + BufferEx.FirstElement = firstElement; + BufferEx.NumElements = numElements; + BufferEx.Flags = flags; + } + explicit CD3D11_SHADER_RESOURCE_VIEW_DESC( + __in ID3D11Texture1D* pTex1D, + D3D11_SRV_DIMENSION viewDimension, + DXGI_FORMAT format = DXGI_FORMAT_UNKNOWN, + UINT mostDetailedMip = 0, + UINT mipLevels = -1, + UINT firstArraySlice = 0, + UINT arraySize = -1 ) + { + ViewDimension = viewDimension; + if (DXGI_FORMAT_UNKNOWN == format || -1 == mipLevels || + (-1 == arraySize && D3D11_SRV_DIMENSION_TEXTURE1DARRAY == viewDimension)) + { + D3D11_TEXTURE1D_DESC TexDesc; + pTex1D->GetDesc( &TexDesc ); + if (DXGI_FORMAT_UNKNOWN == format) format = TexDesc.Format; + if (-1 == mipLevels) mipLevels = TexDesc.MipLevels - mostDetailedMip; + if (-1 == arraySize) arraySize = TexDesc.ArraySize - firstArraySlice; + } + Format = format; + switch (viewDimension) + { + case D3D11_SRV_DIMENSION_TEXTURE1D: + Texture1D.MostDetailedMip = mostDetailedMip; + Texture1D.MipLevels = mipLevels; + break; + case D3D11_SRV_DIMENSION_TEXTURE1DARRAY: + Texture1DArray.MostDetailedMip = mostDetailedMip; + Texture1DArray.MipLevels = mipLevels; + Texture1DArray.FirstArraySlice = firstArraySlice; + Texture1DArray.ArraySize = arraySize; + break; + default: break; + } + } + explicit CD3D11_SHADER_RESOURCE_VIEW_DESC( + __in ID3D11Texture2D* pTex2D, + D3D11_SRV_DIMENSION viewDimension, + DXGI_FORMAT format = DXGI_FORMAT_UNKNOWN, + UINT mostDetailedMip = 0, + UINT mipLevels = -1, + UINT firstArraySlice = 0, // First2DArrayFace for TEXTURECUBEARRAY + UINT arraySize = -1 ) // NumCubes for TEXTURECUBEARRAY + { + ViewDimension = viewDimension; + if (DXGI_FORMAT_UNKNOWN == format || + (-1 == mipLevels && + D3D11_SRV_DIMENSION_TEXTURE2DMS != viewDimension && + D3D11_SRV_DIMENSION_TEXTURE2DMSARRAY != viewDimension) || + (-1 == arraySize && + (D3D11_SRV_DIMENSION_TEXTURE2DARRAY == viewDimension || + D3D11_SRV_DIMENSION_TEXTURE2DMSARRAY == viewDimension || + D3D11_SRV_DIMENSION_TEXTURECUBEARRAY == viewDimension))) + { + D3D11_TEXTURE2D_DESC TexDesc; + pTex2D->GetDesc( &TexDesc ); + if (DXGI_FORMAT_UNKNOWN == format) format = TexDesc.Format; + if (-1 == mipLevels) mipLevels = TexDesc.MipLevels - mostDetailedMip; + if (-1 == arraySize) + { + arraySize = TexDesc.ArraySize - firstArraySlice; + if (D3D11_SRV_DIMENSION_TEXTURECUBEARRAY == viewDimension) arraySize /= 6; + } + } + Format = format; + switch (viewDimension) + { + case D3D11_SRV_DIMENSION_TEXTURE2D: + Texture2D.MostDetailedMip = mostDetailedMip; + Texture2D.MipLevels = mipLevels; + break; + case D3D11_SRV_DIMENSION_TEXTURE2DARRAY: + Texture2DArray.MostDetailedMip = mostDetailedMip; + Texture2DArray.MipLevels = mipLevels; + Texture2DArray.FirstArraySlice = firstArraySlice; + Texture2DArray.ArraySize = arraySize; + break; + case D3D11_SRV_DIMENSION_TEXTURE2DMS: + break; + case D3D11_SRV_DIMENSION_TEXTURE2DMSARRAY: + Texture2DMSArray.FirstArraySlice = firstArraySlice; + Texture2DMSArray.ArraySize = arraySize; + break; + case D3D11_SRV_DIMENSION_TEXTURECUBE: + TextureCube.MostDetailedMip = mostDetailedMip; + TextureCube.MipLevels = mipLevels; + break; + case D3D11_SRV_DIMENSION_TEXTURECUBEARRAY: + TextureCubeArray.MostDetailedMip = mostDetailedMip; + TextureCubeArray.MipLevels = mipLevels; + TextureCubeArray.First2DArrayFace = firstArraySlice; + TextureCubeArray.NumCubes = arraySize; + break; + default: break; + } + } + explicit CD3D11_SHADER_RESOURCE_VIEW_DESC( + __in ID3D11Texture3D* pTex3D, + DXGI_FORMAT format = DXGI_FORMAT_UNKNOWN, + UINT mostDetailedMip = 0, + UINT mipLevels = -1 ) + { + ViewDimension = D3D11_SRV_DIMENSION_TEXTURE3D; + if (DXGI_FORMAT_UNKNOWN == format || -1 == mipLevels) + { + D3D11_TEXTURE3D_DESC TexDesc; + pTex3D->GetDesc( &TexDesc ); + if (DXGI_FORMAT_UNKNOWN == format) format = TexDesc.Format; + if (-1 == mipLevels) mipLevels = TexDesc.MipLevels - mostDetailedMip; + } + Format = format; + Texture3D.MostDetailedMip = mostDetailedMip; + Texture3D.MipLevels = mipLevels; + } + ~CD3D11_SHADER_RESOURCE_VIEW_DESC() {} + operator const D3D11_SHADER_RESOURCE_VIEW_DESC&() const { return *this; } +}; +extern "C"{ +#endif + + +extern RPC_IF_HANDLE __MIDL_itf_d3d11_0000_0010_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d11_0000_0010_v0_0_s_ifspec; + +#ifndef __ID3D11ShaderResourceView_INTERFACE_DEFINED__ +#define __ID3D11ShaderResourceView_INTERFACE_DEFINED__ + +/* interface ID3D11ShaderResourceView */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D11ShaderResourceView; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("b0e06fe0-8192-4e1a-b1ca-36d7414710b2") + ID3D11ShaderResourceView : public ID3D11View + { + public: + virtual void STDMETHODCALLTYPE GetDesc( + /* [annotation] */ + __out D3D11_SHADER_RESOURCE_VIEW_DESC *pDesc) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D11ShaderResourceViewVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D11ShaderResourceView * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D11ShaderResourceView * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D11ShaderResourceView * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D11ShaderResourceView * This, + /* [annotation] */ + __out ID3D11Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D11ShaderResourceView * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D11ShaderResourceView * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D11ShaderResourceView * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData); + + void ( STDMETHODCALLTYPE *GetResource )( + ID3D11ShaderResourceView * This, + /* [annotation] */ + __out ID3D11Resource **ppResource); + + void ( STDMETHODCALLTYPE *GetDesc )( + ID3D11ShaderResourceView * This, + /* [annotation] */ + __out D3D11_SHADER_RESOURCE_VIEW_DESC *pDesc); + + END_INTERFACE + } ID3D11ShaderResourceViewVtbl; + + interface ID3D11ShaderResourceView + { + CONST_VTBL struct ID3D11ShaderResourceViewVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D11ShaderResourceView_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D11ShaderResourceView_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D11ShaderResourceView_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D11ShaderResourceView_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D11ShaderResourceView_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D11ShaderResourceView_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D11ShaderResourceView_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D11ShaderResourceView_GetResource(This,ppResource) \ + ( (This)->lpVtbl -> GetResource(This,ppResource) ) + + +#define ID3D11ShaderResourceView_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D11ShaderResourceView_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d11_0000_0011 */ +/* [local] */ + +typedef struct D3D11_BUFFER_RTV + { + union + { + UINT FirstElement; + UINT ElementOffset; + } ; + union + { + UINT NumElements; + UINT ElementWidth; + } ; + } D3D11_BUFFER_RTV; + +typedef struct D3D11_TEX1D_RTV + { + UINT MipSlice; + } D3D11_TEX1D_RTV; + +typedef struct D3D11_TEX1D_ARRAY_RTV + { + UINT MipSlice; + UINT FirstArraySlice; + UINT ArraySize; + } D3D11_TEX1D_ARRAY_RTV; + +typedef struct D3D11_TEX2D_RTV + { + UINT MipSlice; + } D3D11_TEX2D_RTV; + +typedef struct D3D11_TEX2DMS_RTV + { + UINT UnusedField_NothingToDefine; + } D3D11_TEX2DMS_RTV; + +typedef struct D3D11_TEX2D_ARRAY_RTV + { + UINT MipSlice; + UINT FirstArraySlice; + UINT ArraySize; + } D3D11_TEX2D_ARRAY_RTV; + +typedef struct D3D11_TEX2DMS_ARRAY_RTV + { + UINT FirstArraySlice; + UINT ArraySize; + } D3D11_TEX2DMS_ARRAY_RTV; + +typedef struct D3D11_TEX3D_RTV + { + UINT MipSlice; + UINT FirstWSlice; + UINT WSize; + } D3D11_TEX3D_RTV; + +typedef struct D3D11_RENDER_TARGET_VIEW_DESC + { + DXGI_FORMAT Format; + D3D11_RTV_DIMENSION ViewDimension; + union + { + D3D11_BUFFER_RTV Buffer; + D3D11_TEX1D_RTV Texture1D; + D3D11_TEX1D_ARRAY_RTV Texture1DArray; + D3D11_TEX2D_RTV Texture2D; + D3D11_TEX2D_ARRAY_RTV Texture2DArray; + D3D11_TEX2DMS_RTV Texture2DMS; + D3D11_TEX2DMS_ARRAY_RTV Texture2DMSArray; + D3D11_TEX3D_RTV Texture3D; + } ; + } D3D11_RENDER_TARGET_VIEW_DESC; + +#if !defined( D3D11_NO_HELPERS ) && defined( __cplusplus ) +} +struct CD3D11_RENDER_TARGET_VIEW_DESC : public D3D11_RENDER_TARGET_VIEW_DESC +{ + CD3D11_RENDER_TARGET_VIEW_DESC() + {} + explicit CD3D11_RENDER_TARGET_VIEW_DESC( const D3D11_RENDER_TARGET_VIEW_DESC& o ) : + D3D11_RENDER_TARGET_VIEW_DESC( o ) + {} + explicit CD3D11_RENDER_TARGET_VIEW_DESC( + D3D11_RTV_DIMENSION viewDimension, + DXGI_FORMAT format = DXGI_FORMAT_UNKNOWN, + UINT mipSlice = 0, // FirstElement for BUFFER + UINT firstArraySlice = 0, // NumElements for BUFFER, FirstWSlice for TEXTURE3D + UINT arraySize = -1 ) // WSize for TEXTURE3D + { + Format = format; + ViewDimension = viewDimension; + switch (viewDimension) + { + case D3D11_RTV_DIMENSION_BUFFER: + Buffer.FirstElement = mipSlice; + Buffer.NumElements = firstArraySlice; + break; + case D3D11_RTV_DIMENSION_TEXTURE1D: + Texture1D.MipSlice = mipSlice; + break; + case D3D11_RTV_DIMENSION_TEXTURE1DARRAY: + Texture1DArray.MipSlice = mipSlice; + Texture1DArray.FirstArraySlice = firstArraySlice; + Texture1DArray.ArraySize = arraySize; + break; + case D3D11_RTV_DIMENSION_TEXTURE2D: + Texture2D.MipSlice = mipSlice; + break; + case D3D11_RTV_DIMENSION_TEXTURE2DARRAY: + Texture2DArray.MipSlice = mipSlice; + Texture2DArray.FirstArraySlice = firstArraySlice; + Texture2DArray.ArraySize = arraySize; + break; + case D3D11_RTV_DIMENSION_TEXTURE2DMS: + break; + case D3D11_RTV_DIMENSION_TEXTURE2DMSARRAY: + Texture2DMSArray.FirstArraySlice = firstArraySlice; + Texture2DMSArray.ArraySize = arraySize; + break; + case D3D11_RTV_DIMENSION_TEXTURE3D: + Texture3D.MipSlice = mipSlice; + Texture3D.FirstWSlice = firstArraySlice; + Texture3D.WSize = arraySize; + break; + default: break; + } + } + explicit CD3D11_RENDER_TARGET_VIEW_DESC( + __in ID3D11Buffer*, + DXGI_FORMAT format, + UINT firstElement, + UINT numElements ) + { + Format = format; + ViewDimension = D3D11_RTV_DIMENSION_BUFFER; + Buffer.FirstElement = firstElement; + Buffer.NumElements = numElements; + } + explicit CD3D11_RENDER_TARGET_VIEW_DESC( + __in ID3D11Texture1D* pTex1D, + D3D11_RTV_DIMENSION viewDimension, + DXGI_FORMAT format = DXGI_FORMAT_UNKNOWN, + UINT mipSlice = 0, + UINT firstArraySlice = 0, + UINT arraySize = -1 ) + { + ViewDimension = viewDimension; + if (DXGI_FORMAT_UNKNOWN == format || + (-1 == arraySize && D3D11_RTV_DIMENSION_TEXTURE1DARRAY == viewDimension)) + { + D3D11_TEXTURE1D_DESC TexDesc; + pTex1D->GetDesc( &TexDesc ); + if (DXGI_FORMAT_UNKNOWN == format) format = TexDesc.Format; + if (-1 == arraySize) arraySize = TexDesc.ArraySize - firstArraySlice; + } + Format = format; + switch (viewDimension) + { + case D3D11_RTV_DIMENSION_TEXTURE1D: + Texture1D.MipSlice = mipSlice; + break; + case D3D11_RTV_DIMENSION_TEXTURE1DARRAY: + Texture1DArray.MipSlice = mipSlice; + Texture1DArray.FirstArraySlice = firstArraySlice; + Texture1DArray.ArraySize = arraySize; + break; + default: break; + } + } + explicit CD3D11_RENDER_TARGET_VIEW_DESC( + __in ID3D11Texture2D* pTex2D, + D3D11_RTV_DIMENSION viewDimension, + DXGI_FORMAT format = DXGI_FORMAT_UNKNOWN, + UINT mipSlice = 0, + UINT firstArraySlice = 0, + UINT arraySize = -1 ) + { + ViewDimension = viewDimension; + if (DXGI_FORMAT_UNKNOWN == format || + (-1 == arraySize && + (D3D11_RTV_DIMENSION_TEXTURE2DARRAY == viewDimension || + D3D11_RTV_DIMENSION_TEXTURE2DMSARRAY == viewDimension))) + { + D3D11_TEXTURE2D_DESC TexDesc; + pTex2D->GetDesc( &TexDesc ); + if (DXGI_FORMAT_UNKNOWN == format) format = TexDesc.Format; + if (-1 == arraySize) arraySize = TexDesc.ArraySize - firstArraySlice; + } + Format = format; + switch (viewDimension) + { + case D3D11_RTV_DIMENSION_TEXTURE2D: + Texture2D.MipSlice = mipSlice; + break; + case D3D11_RTV_DIMENSION_TEXTURE2DARRAY: + Texture2DArray.MipSlice = mipSlice; + Texture2DArray.FirstArraySlice = firstArraySlice; + Texture2DArray.ArraySize = arraySize; + break; + case D3D11_RTV_DIMENSION_TEXTURE2DMS: + break; + case D3D11_RTV_DIMENSION_TEXTURE2DMSARRAY: + Texture2DMSArray.FirstArraySlice = firstArraySlice; + Texture2DMSArray.ArraySize = arraySize; + break; + default: break; + } + } + explicit CD3D11_RENDER_TARGET_VIEW_DESC( + __in ID3D11Texture3D* pTex3D, + DXGI_FORMAT format = DXGI_FORMAT_UNKNOWN, + UINT mipSlice = 0, + UINT firstWSlice = 0, + UINT wSize = -1 ) + { + ViewDimension = D3D11_RTV_DIMENSION_TEXTURE3D; + if (DXGI_FORMAT_UNKNOWN == format || -1 == wSize) + { + D3D11_TEXTURE3D_DESC TexDesc; + pTex3D->GetDesc( &TexDesc ); + if (DXGI_FORMAT_UNKNOWN == format) format = TexDesc.Format; + if (-1 == wSize) wSize = TexDesc.Depth - firstWSlice; + } + Format = format; + Texture3D.MipSlice = mipSlice; + Texture3D.FirstWSlice = firstWSlice; + Texture3D.WSize = wSize; + } + ~CD3D11_RENDER_TARGET_VIEW_DESC() {} + operator const D3D11_RENDER_TARGET_VIEW_DESC&() const { return *this; } +}; +extern "C"{ +#endif + + +extern RPC_IF_HANDLE __MIDL_itf_d3d11_0000_0011_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d11_0000_0011_v0_0_s_ifspec; + +#ifndef __ID3D11RenderTargetView_INTERFACE_DEFINED__ +#define __ID3D11RenderTargetView_INTERFACE_DEFINED__ + +/* interface ID3D11RenderTargetView */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D11RenderTargetView; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("dfdba067-0b8d-4865-875b-d7b4516cc164") + ID3D11RenderTargetView : public ID3D11View + { + public: + virtual void STDMETHODCALLTYPE GetDesc( + /* [annotation] */ + __out D3D11_RENDER_TARGET_VIEW_DESC *pDesc) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D11RenderTargetViewVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D11RenderTargetView * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D11RenderTargetView * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D11RenderTargetView * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D11RenderTargetView * This, + /* [annotation] */ + __out ID3D11Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D11RenderTargetView * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D11RenderTargetView * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D11RenderTargetView * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData); + + void ( STDMETHODCALLTYPE *GetResource )( + ID3D11RenderTargetView * This, + /* [annotation] */ + __out ID3D11Resource **ppResource); + + void ( STDMETHODCALLTYPE *GetDesc )( + ID3D11RenderTargetView * This, + /* [annotation] */ + __out D3D11_RENDER_TARGET_VIEW_DESC *pDesc); + + END_INTERFACE + } ID3D11RenderTargetViewVtbl; + + interface ID3D11RenderTargetView + { + CONST_VTBL struct ID3D11RenderTargetViewVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D11RenderTargetView_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D11RenderTargetView_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D11RenderTargetView_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D11RenderTargetView_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D11RenderTargetView_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D11RenderTargetView_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D11RenderTargetView_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D11RenderTargetView_GetResource(This,ppResource) \ + ( (This)->lpVtbl -> GetResource(This,ppResource) ) + + +#define ID3D11RenderTargetView_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D11RenderTargetView_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d11_0000_0012 */ +/* [local] */ + +#if !defined( D3D11_NO_HELPERS ) && defined( __cplusplus ) +} +struct CD3D11_VIEWPORT : public D3D11_VIEWPORT +{ + CD3D11_VIEWPORT() + {} + explicit CD3D11_VIEWPORT( const D3D11_VIEWPORT& o ) : + D3D11_VIEWPORT( o ) + {} + explicit CD3D11_VIEWPORT( + FLOAT topLeftX, + FLOAT topLeftY, + FLOAT width, + FLOAT height, + FLOAT minDepth = D3D11_MIN_DEPTH, + FLOAT maxDepth = D3D11_MAX_DEPTH ) + { + TopLeftX = topLeftX; + TopLeftY = topLeftY; + Width = width; + Height = height; + MinDepth = minDepth; + MaxDepth = maxDepth; + } + explicit CD3D11_VIEWPORT( + __in ID3D11Buffer*, + __in ID3D11RenderTargetView* pRTView, + FLOAT topLeftX = 0.0f, + FLOAT minDepth = D3D11_MIN_DEPTH, + FLOAT maxDepth = D3D11_MAX_DEPTH ) + { + D3D11_RENDER_TARGET_VIEW_DESC RTVDesc; + pRTView->GetDesc( &RTVDesc ); + UINT NumElements = 0; + switch (RTVDesc.ViewDimension) + { + case D3D11_RTV_DIMENSION_BUFFER: + NumElements = RTVDesc.Buffer.NumElements; + break; + default: break; + } + TopLeftX = topLeftX; + TopLeftY = 0.0f; + Width = NumElements - topLeftX; + Height = 1.0f; + MinDepth = minDepth; + MaxDepth = maxDepth; + } + explicit CD3D11_VIEWPORT( + __in ID3D11Texture1D* pTex1D, + __in ID3D11RenderTargetView* pRTView, + FLOAT topLeftX = 0.0f, + FLOAT minDepth = D3D11_MIN_DEPTH, + FLOAT maxDepth = D3D11_MAX_DEPTH ) + { + D3D11_TEXTURE1D_DESC TexDesc; + pTex1D->GetDesc( &TexDesc ); + D3D11_RENDER_TARGET_VIEW_DESC RTVDesc; + pRTView->GetDesc( &RTVDesc ); + UINT MipSlice = 0; + switch (RTVDesc.ViewDimension) + { + case D3D11_RTV_DIMENSION_TEXTURE1D: + MipSlice = RTVDesc.Texture1D.MipSlice; + break; + case D3D11_RTV_DIMENSION_TEXTURE1DARRAY: + MipSlice = RTVDesc.Texture1DArray.MipSlice; + break; + default: break; + } + const UINT SubResourceWidth = TexDesc.Width / (UINT( 1 ) << MipSlice); + TopLeftX = topLeftX; + TopLeftY = 0.0f; + Width = (SubResourceWidth ? SubResourceWidth : 1) - topLeftX; + Height = 1.0f; + MinDepth = minDepth; + MaxDepth = maxDepth; + } + explicit CD3D11_VIEWPORT( + __in ID3D11Texture2D* pTex2D, + __in ID3D11RenderTargetView* pRTView, + FLOAT topLeftX = 0.0f, + FLOAT topLeftY = 0.0f, + FLOAT minDepth = D3D11_MIN_DEPTH, + FLOAT maxDepth = D3D11_MAX_DEPTH ) + { + D3D11_TEXTURE2D_DESC TexDesc; + pTex2D->GetDesc( &TexDesc ); + D3D11_RENDER_TARGET_VIEW_DESC RTVDesc; + pRTView->GetDesc( &RTVDesc ); + UINT MipSlice = 0; + switch (RTVDesc.ViewDimension) + { + case D3D11_RTV_DIMENSION_TEXTURE2D: + MipSlice = RTVDesc.Texture2D.MipSlice; + break; + case D3D11_RTV_DIMENSION_TEXTURE2DARRAY: + MipSlice = RTVDesc.Texture2DArray.MipSlice; + break; + case D3D11_RTV_DIMENSION_TEXTURE2DMS: + case D3D11_RTV_DIMENSION_TEXTURE2DMSARRAY: + break; + default: break; + } + const UINT SubResourceWidth = TexDesc.Width / (UINT( 1 ) << MipSlice); + const UINT SubResourceHeight = TexDesc.Height / (UINT( 1 ) << MipSlice); + TopLeftX = topLeftX; + TopLeftY = topLeftY; + Width = (SubResourceWidth ? SubResourceWidth : 1) - topLeftX; + Height = (SubResourceHeight ? SubResourceHeight : 1) - topLeftY; + MinDepth = minDepth; + MaxDepth = maxDepth; + } + explicit CD3D11_VIEWPORT( + __in ID3D11Texture3D* pTex3D, + __in ID3D11RenderTargetView* pRTView, + FLOAT topLeftX = 0.0f, + FLOAT topLeftY = 0.0f, + FLOAT minDepth = D3D11_MIN_DEPTH, + FLOAT maxDepth = D3D11_MAX_DEPTH ) + { + D3D11_TEXTURE3D_DESC TexDesc; + pTex3D->GetDesc( &TexDesc ); + D3D11_RENDER_TARGET_VIEW_DESC RTVDesc; + pRTView->GetDesc( &RTVDesc ); + UINT MipSlice = 0; + switch (RTVDesc.ViewDimension) + { + case D3D11_RTV_DIMENSION_TEXTURE3D: + MipSlice = RTVDesc.Texture3D.MipSlice; + break; + default: break; + } + const UINT SubResourceWidth = TexDesc.Width / (UINT( 1 ) << MipSlice); + const UINT SubResourceHeight = TexDesc.Height / (UINT( 1 ) << MipSlice); + TopLeftX = topLeftX; + TopLeftY = topLeftY; + Width = (SubResourceWidth ? SubResourceWidth : 1) - topLeftX; + Height = (SubResourceHeight ? SubResourceHeight : 1) - topLeftY; + MinDepth = minDepth; + MaxDepth = maxDepth; + } + ~CD3D11_VIEWPORT() {} + operator const D3D11_VIEWPORT&() const { return *this; } +}; +extern "C"{ +#endif +typedef struct D3D11_TEX1D_DSV + { + UINT MipSlice; + } D3D11_TEX1D_DSV; + +typedef struct D3D11_TEX1D_ARRAY_DSV + { + UINT MipSlice; + UINT FirstArraySlice; + UINT ArraySize; + } D3D11_TEX1D_ARRAY_DSV; + +typedef struct D3D11_TEX2D_DSV + { + UINT MipSlice; + } D3D11_TEX2D_DSV; + +typedef struct D3D11_TEX2D_ARRAY_DSV + { + UINT MipSlice; + UINT FirstArraySlice; + UINT ArraySize; + } D3D11_TEX2D_ARRAY_DSV; + +typedef struct D3D11_TEX2DMS_DSV + { + UINT UnusedField_NothingToDefine; + } D3D11_TEX2DMS_DSV; + +typedef struct D3D11_TEX2DMS_ARRAY_DSV + { + UINT FirstArraySlice; + UINT ArraySize; + } D3D11_TEX2DMS_ARRAY_DSV; + +typedef +enum D3D11_DSV_FLAG + { D3D11_DSV_READ_ONLY_DEPTH = 0x1L, + D3D11_DSV_READ_ONLY_STENCIL = 0x2L + } D3D11_DSV_FLAG; + +typedef struct D3D11_DEPTH_STENCIL_VIEW_DESC + { + DXGI_FORMAT Format; + D3D11_DSV_DIMENSION ViewDimension; + UINT Flags; + union + { + D3D11_TEX1D_DSV Texture1D; + D3D11_TEX1D_ARRAY_DSV Texture1DArray; + D3D11_TEX2D_DSV Texture2D; + D3D11_TEX2D_ARRAY_DSV Texture2DArray; + D3D11_TEX2DMS_DSV Texture2DMS; + D3D11_TEX2DMS_ARRAY_DSV Texture2DMSArray; + } ; + } D3D11_DEPTH_STENCIL_VIEW_DESC; + +#if !defined( D3D11_NO_HELPERS ) && defined( __cplusplus ) +} +struct CD3D11_DEPTH_STENCIL_VIEW_DESC : public D3D11_DEPTH_STENCIL_VIEW_DESC +{ + CD3D11_DEPTH_STENCIL_VIEW_DESC() + {} + explicit CD3D11_DEPTH_STENCIL_VIEW_DESC( const D3D11_DEPTH_STENCIL_VIEW_DESC& o ) : + D3D11_DEPTH_STENCIL_VIEW_DESC( o ) + {} + explicit CD3D11_DEPTH_STENCIL_VIEW_DESC( + D3D11_DSV_DIMENSION viewDimension, + DXGI_FORMAT format = DXGI_FORMAT_UNKNOWN, + UINT mipSlice = 0, + UINT firstArraySlice = 0, + UINT arraySize = -1, + UINT flags = 0 ) + { + Format = format; + ViewDimension = viewDimension; + Flags = flags; + switch (viewDimension) + { + case D3D11_DSV_DIMENSION_TEXTURE1D: + Texture1D.MipSlice = mipSlice; + break; + case D3D11_DSV_DIMENSION_TEXTURE1DARRAY: + Texture1DArray.MipSlice = mipSlice; + Texture1DArray.FirstArraySlice = firstArraySlice; + Texture1DArray.ArraySize = arraySize; + break; + case D3D11_DSV_DIMENSION_TEXTURE2D: + Texture2D.MipSlice = mipSlice; + break; + case D3D11_DSV_DIMENSION_TEXTURE2DARRAY: + Texture2DArray.MipSlice = mipSlice; + Texture2DArray.FirstArraySlice = firstArraySlice; + Texture2DArray.ArraySize = arraySize; + break; + case D3D11_DSV_DIMENSION_TEXTURE2DMS: + break; + case D3D11_DSV_DIMENSION_TEXTURE2DMSARRAY: + Texture2DMSArray.FirstArraySlice = firstArraySlice; + Texture2DMSArray.ArraySize = arraySize; + break; + default: break; + } + } + explicit CD3D11_DEPTH_STENCIL_VIEW_DESC( + __in ID3D11Texture1D* pTex1D, + D3D11_DSV_DIMENSION viewDimension, + DXGI_FORMAT format = DXGI_FORMAT_UNKNOWN, + UINT mipSlice = 0, + UINT firstArraySlice = 0, + UINT arraySize = -1, + UINT flags = 0 ) + { + ViewDimension = viewDimension; + Flags = flags; + if (DXGI_FORMAT_UNKNOWN == format || + (-1 == arraySize && D3D11_DSV_DIMENSION_TEXTURE1DARRAY == viewDimension)) + { + D3D11_TEXTURE1D_DESC TexDesc; + pTex1D->GetDesc( &TexDesc ); + if (DXGI_FORMAT_UNKNOWN == format) format = TexDesc.Format; + if (-1 == arraySize) arraySize = TexDesc.ArraySize - firstArraySlice; + } + Format = format; + switch (viewDimension) + { + case D3D11_DSV_DIMENSION_TEXTURE1D: + Texture1D.MipSlice = mipSlice; + break; + case D3D11_DSV_DIMENSION_TEXTURE1DARRAY: + Texture1DArray.MipSlice = mipSlice; + Texture1DArray.FirstArraySlice = firstArraySlice; + Texture1DArray.ArraySize = arraySize; + break; + default: break; + } + } + explicit CD3D11_DEPTH_STENCIL_VIEW_DESC( + __in ID3D11Texture2D* pTex2D, + D3D11_DSV_DIMENSION viewDimension, + DXGI_FORMAT format = DXGI_FORMAT_UNKNOWN, + UINT mipSlice = 0, + UINT firstArraySlice = 0, + UINT arraySize = -1, + UINT flags = 0 ) + { + ViewDimension = viewDimension; + Flags = flags; + if (DXGI_FORMAT_UNKNOWN == format || + (-1 == arraySize && + (D3D11_DSV_DIMENSION_TEXTURE2DARRAY == viewDimension || + D3D11_DSV_DIMENSION_TEXTURE2DMSARRAY == viewDimension))) + { + D3D11_TEXTURE2D_DESC TexDesc; + pTex2D->GetDesc( &TexDesc ); + if (DXGI_FORMAT_UNKNOWN == format) format = TexDesc.Format; + if (-1 == arraySize) arraySize = TexDesc.ArraySize - firstArraySlice; + } + Format = format; + switch (viewDimension) + { + case D3D11_DSV_DIMENSION_TEXTURE2D: + Texture2D.MipSlice = mipSlice; + break; + case D3D11_DSV_DIMENSION_TEXTURE2DARRAY: + Texture2DArray.MipSlice = mipSlice; + Texture2DArray.FirstArraySlice = firstArraySlice; + Texture2DArray.ArraySize = arraySize; + break; + case D3D11_DSV_DIMENSION_TEXTURE2DMS: + break; + case D3D11_DSV_DIMENSION_TEXTURE2DMSARRAY: + Texture2DMSArray.FirstArraySlice = firstArraySlice; + Texture2DMSArray.ArraySize = arraySize; + break; + default: break; + } + } + ~CD3D11_DEPTH_STENCIL_VIEW_DESC() {} + operator const D3D11_DEPTH_STENCIL_VIEW_DESC&() const { return *this; } +}; +extern "C"{ +#endif + + +extern RPC_IF_HANDLE __MIDL_itf_d3d11_0000_0012_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d11_0000_0012_v0_0_s_ifspec; + +#ifndef __ID3D11DepthStencilView_INTERFACE_DEFINED__ +#define __ID3D11DepthStencilView_INTERFACE_DEFINED__ + +/* interface ID3D11DepthStencilView */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D11DepthStencilView; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9fdac92a-1876-48c3-afad-25b94f84a9b6") + ID3D11DepthStencilView : public ID3D11View + { + public: + virtual void STDMETHODCALLTYPE GetDesc( + /* [annotation] */ + __out D3D11_DEPTH_STENCIL_VIEW_DESC *pDesc) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D11DepthStencilViewVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D11DepthStencilView * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D11DepthStencilView * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D11DepthStencilView * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D11DepthStencilView * This, + /* [annotation] */ + __out ID3D11Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D11DepthStencilView * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D11DepthStencilView * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D11DepthStencilView * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData); + + void ( STDMETHODCALLTYPE *GetResource )( + ID3D11DepthStencilView * This, + /* [annotation] */ + __out ID3D11Resource **ppResource); + + void ( STDMETHODCALLTYPE *GetDesc )( + ID3D11DepthStencilView * This, + /* [annotation] */ + __out D3D11_DEPTH_STENCIL_VIEW_DESC *pDesc); + + END_INTERFACE + } ID3D11DepthStencilViewVtbl; + + interface ID3D11DepthStencilView + { + CONST_VTBL struct ID3D11DepthStencilViewVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D11DepthStencilView_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D11DepthStencilView_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D11DepthStencilView_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D11DepthStencilView_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D11DepthStencilView_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D11DepthStencilView_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D11DepthStencilView_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D11DepthStencilView_GetResource(This,ppResource) \ + ( (This)->lpVtbl -> GetResource(This,ppResource) ) + + +#define ID3D11DepthStencilView_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D11DepthStencilView_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d11_0000_0013 */ +/* [local] */ + +typedef +enum D3D11_BUFFER_UAV_FLAG + { D3D11_BUFFER_UAV_FLAG_RAW = 0x1, + D3D11_BUFFER_UAV_FLAG_APPEND = 0x2, + D3D11_BUFFER_UAV_FLAG_COUNTER = 0x4 + } D3D11_BUFFER_UAV_FLAG; + +typedef struct D3D11_BUFFER_UAV + { + UINT FirstElement; + UINT NumElements; + UINT Flags; + } D3D11_BUFFER_UAV; + +typedef struct D3D11_TEX1D_UAV + { + UINT MipSlice; + } D3D11_TEX1D_UAV; + +typedef struct D3D11_TEX1D_ARRAY_UAV + { + UINT MipSlice; + UINT FirstArraySlice; + UINT ArraySize; + } D3D11_TEX1D_ARRAY_UAV; + +typedef struct D3D11_TEX2D_UAV + { + UINT MipSlice; + } D3D11_TEX2D_UAV; + +typedef struct D3D11_TEX2D_ARRAY_UAV + { + UINT MipSlice; + UINT FirstArraySlice; + UINT ArraySize; + } D3D11_TEX2D_ARRAY_UAV; + +typedef struct D3D11_TEX3D_UAV + { + UINT MipSlice; + UINT FirstWSlice; + UINT WSize; + } D3D11_TEX3D_UAV; + +typedef struct D3D11_UNORDERED_ACCESS_VIEW_DESC + { + DXGI_FORMAT Format; + D3D11_UAV_DIMENSION ViewDimension; + union + { + D3D11_BUFFER_UAV Buffer; + D3D11_TEX1D_UAV Texture1D; + D3D11_TEX1D_ARRAY_UAV Texture1DArray; + D3D11_TEX2D_UAV Texture2D; + D3D11_TEX2D_ARRAY_UAV Texture2DArray; + D3D11_TEX3D_UAV Texture3D; + } ; + } D3D11_UNORDERED_ACCESS_VIEW_DESC; + +#if !defined( D3D11_NO_HELPERS ) && defined( __cplusplus ) +} +struct CD3D11_UNORDERED_ACCESS_VIEW_DESC : public D3D11_UNORDERED_ACCESS_VIEW_DESC +{ + CD3D11_UNORDERED_ACCESS_VIEW_DESC() + {} + explicit CD3D11_UNORDERED_ACCESS_VIEW_DESC( const D3D11_UNORDERED_ACCESS_VIEW_DESC& o ) : + D3D11_UNORDERED_ACCESS_VIEW_DESC( o ) + {} + explicit CD3D11_UNORDERED_ACCESS_VIEW_DESC( + D3D11_UAV_DIMENSION viewDimension, + DXGI_FORMAT format = DXGI_FORMAT_UNKNOWN, + UINT mipSlice = 0, // FirstElement for BUFFER + UINT firstArraySlice = 0, // NumElements for BUFFER, FirstWSlice for TEXTURE3D + UINT arraySize = -1, // WSize for TEXTURE3D + UINT flags = 0 ) // BUFFER only + { + Format = format; + ViewDimension = viewDimension; + switch (viewDimension) + { + case D3D11_UAV_DIMENSION_BUFFER: + Buffer.FirstElement = mipSlice; + Buffer.NumElements = firstArraySlice; + Buffer.Flags = flags; + break; + case D3D11_UAV_DIMENSION_TEXTURE1D: + Texture1D.MipSlice = mipSlice; + break; + case D3D11_UAV_DIMENSION_TEXTURE1DARRAY: + Texture1DArray.MipSlice = mipSlice; + Texture1DArray.FirstArraySlice = firstArraySlice; + Texture1DArray.ArraySize = arraySize; + break; + case D3D11_UAV_DIMENSION_TEXTURE2D: + Texture2D.MipSlice = mipSlice; + break; + case D3D11_UAV_DIMENSION_TEXTURE2DARRAY: + Texture2DArray.MipSlice = mipSlice; + Texture2DArray.FirstArraySlice = firstArraySlice; + Texture2DArray.ArraySize = arraySize; + break; + case D3D11_UAV_DIMENSION_TEXTURE3D: + Texture3D.MipSlice = mipSlice; + Texture3D.FirstWSlice = firstArraySlice; + Texture3D.WSize = arraySize; + break; + default: break; + } + } + explicit CD3D11_UNORDERED_ACCESS_VIEW_DESC( + __in ID3D11Buffer*, + DXGI_FORMAT format, + UINT firstElement, + UINT numElements, + UINT flags = 0 ) + { + Format = format; + ViewDimension = D3D11_UAV_DIMENSION_BUFFER; + Buffer.FirstElement = firstElement; + Buffer.NumElements = numElements; + Buffer.Flags = flags; + } + explicit CD3D11_UNORDERED_ACCESS_VIEW_DESC( + __in ID3D11Texture1D* pTex1D, + D3D11_UAV_DIMENSION viewDimension, + DXGI_FORMAT format = DXGI_FORMAT_UNKNOWN, + UINT mipSlice = 0, + UINT firstArraySlice = 0, + UINT arraySize = -1 ) + { + ViewDimension = viewDimension; + if (DXGI_FORMAT_UNKNOWN == format || + (-1 == arraySize && D3D11_UAV_DIMENSION_TEXTURE1DARRAY == viewDimension)) + { + D3D11_TEXTURE1D_DESC TexDesc; + pTex1D->GetDesc( &TexDesc ); + if (DXGI_FORMAT_UNKNOWN == format) format = TexDesc.Format; + if (-1 == arraySize) arraySize = TexDesc.ArraySize - firstArraySlice; + } + Format = format; + switch (viewDimension) + { + case D3D11_UAV_DIMENSION_TEXTURE1D: + Texture1D.MipSlice = mipSlice; + break; + case D3D11_UAV_DIMENSION_TEXTURE1DARRAY: + Texture1DArray.MipSlice = mipSlice; + Texture1DArray.FirstArraySlice = firstArraySlice; + Texture1DArray.ArraySize = arraySize; + break; + default: break; + } + } + explicit CD3D11_UNORDERED_ACCESS_VIEW_DESC( + __in ID3D11Texture2D* pTex2D, + D3D11_UAV_DIMENSION viewDimension, + DXGI_FORMAT format = DXGI_FORMAT_UNKNOWN, + UINT mipSlice = 0, + UINT firstArraySlice = 0, + UINT arraySize = -1 ) + { + ViewDimension = viewDimension; + if (DXGI_FORMAT_UNKNOWN == format || + (-1 == arraySize && D3D11_UAV_DIMENSION_TEXTURE2DARRAY == viewDimension)) + { + D3D11_TEXTURE2D_DESC TexDesc; + pTex2D->GetDesc( &TexDesc ); + if (DXGI_FORMAT_UNKNOWN == format) format = TexDesc.Format; + if (-1 == arraySize) arraySize = TexDesc.ArraySize - firstArraySlice; + } + Format = format; + switch (viewDimension) + { + case D3D11_UAV_DIMENSION_TEXTURE2D: + Texture2D.MipSlice = mipSlice; + break; + case D3D11_UAV_DIMENSION_TEXTURE2DARRAY: + Texture2DArray.MipSlice = mipSlice; + Texture2DArray.FirstArraySlice = firstArraySlice; + Texture2DArray.ArraySize = arraySize; + break; + default: break; + } + } + explicit CD3D11_UNORDERED_ACCESS_VIEW_DESC( + __in ID3D11Texture3D* pTex3D, + DXGI_FORMAT format = DXGI_FORMAT_UNKNOWN, + UINT mipSlice = 0, + UINT firstWSlice = 0, + UINT wSize = -1 ) + { + ViewDimension = D3D11_UAV_DIMENSION_TEXTURE3D; + if (DXGI_FORMAT_UNKNOWN == format || -1 == wSize) + { + D3D11_TEXTURE3D_DESC TexDesc; + pTex3D->GetDesc( &TexDesc ); + if (DXGI_FORMAT_UNKNOWN == format) format = TexDesc.Format; + if (-1 == wSize) wSize = TexDesc.Depth - firstWSlice; + } + Format = format; + Texture3D.MipSlice = mipSlice; + Texture3D.FirstWSlice = firstWSlice; + Texture3D.WSize = wSize; + } + ~CD3D11_UNORDERED_ACCESS_VIEW_DESC() {} + operator const D3D11_UNORDERED_ACCESS_VIEW_DESC&() const { return *this; } +}; +extern "C"{ +#endif + + +extern RPC_IF_HANDLE __MIDL_itf_d3d11_0000_0013_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d11_0000_0013_v0_0_s_ifspec; + +#ifndef __ID3D11UnorderedAccessView_INTERFACE_DEFINED__ +#define __ID3D11UnorderedAccessView_INTERFACE_DEFINED__ + +/* interface ID3D11UnorderedAccessView */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D11UnorderedAccessView; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("28acf509-7f5c-48f6-8611-f316010a6380") + ID3D11UnorderedAccessView : public ID3D11View + { + public: + virtual void STDMETHODCALLTYPE GetDesc( + /* [annotation] */ + __out D3D11_UNORDERED_ACCESS_VIEW_DESC *pDesc) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D11UnorderedAccessViewVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D11UnorderedAccessView * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D11UnorderedAccessView * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D11UnorderedAccessView * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D11UnorderedAccessView * This, + /* [annotation] */ + __out ID3D11Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D11UnorderedAccessView * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D11UnorderedAccessView * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D11UnorderedAccessView * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData); + + void ( STDMETHODCALLTYPE *GetResource )( + ID3D11UnorderedAccessView * This, + /* [annotation] */ + __out ID3D11Resource **ppResource); + + void ( STDMETHODCALLTYPE *GetDesc )( + ID3D11UnorderedAccessView * This, + /* [annotation] */ + __out D3D11_UNORDERED_ACCESS_VIEW_DESC *pDesc); + + END_INTERFACE + } ID3D11UnorderedAccessViewVtbl; + + interface ID3D11UnorderedAccessView + { + CONST_VTBL struct ID3D11UnorderedAccessViewVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D11UnorderedAccessView_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D11UnorderedAccessView_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D11UnorderedAccessView_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D11UnorderedAccessView_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D11UnorderedAccessView_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D11UnorderedAccessView_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D11UnorderedAccessView_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D11UnorderedAccessView_GetResource(This,ppResource) \ + ( (This)->lpVtbl -> GetResource(This,ppResource) ) + + +#define ID3D11UnorderedAccessView_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D11UnorderedAccessView_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D11VertexShader_INTERFACE_DEFINED__ +#define __ID3D11VertexShader_INTERFACE_DEFINED__ + +/* interface ID3D11VertexShader */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D11VertexShader; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("3b301d64-d678-4289-8897-22f8928b72f3") + ID3D11VertexShader : public ID3D11DeviceChild + { + public: + }; + +#else /* C style interface */ + + typedef struct ID3D11VertexShaderVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D11VertexShader * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D11VertexShader * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D11VertexShader * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D11VertexShader * This, + /* [annotation] */ + __out ID3D11Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D11VertexShader * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D11VertexShader * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D11VertexShader * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData); + + END_INTERFACE + } ID3D11VertexShaderVtbl; + + interface ID3D11VertexShader + { + CONST_VTBL struct ID3D11VertexShaderVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D11VertexShader_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D11VertexShader_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D11VertexShader_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D11VertexShader_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D11VertexShader_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D11VertexShader_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D11VertexShader_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D11VertexShader_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D11HullShader_INTERFACE_DEFINED__ +#define __ID3D11HullShader_INTERFACE_DEFINED__ + +/* interface ID3D11HullShader */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D11HullShader; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("8e5c6061-628a-4c8e-8264-bbe45cb3d5dd") + ID3D11HullShader : public ID3D11DeviceChild + { + public: + }; + +#else /* C style interface */ + + typedef struct ID3D11HullShaderVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D11HullShader * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D11HullShader * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D11HullShader * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D11HullShader * This, + /* [annotation] */ + __out ID3D11Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D11HullShader * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D11HullShader * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D11HullShader * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData); + + END_INTERFACE + } ID3D11HullShaderVtbl; + + interface ID3D11HullShader + { + CONST_VTBL struct ID3D11HullShaderVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D11HullShader_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D11HullShader_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D11HullShader_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D11HullShader_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D11HullShader_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D11HullShader_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D11HullShader_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D11HullShader_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D11DomainShader_INTERFACE_DEFINED__ +#define __ID3D11DomainShader_INTERFACE_DEFINED__ + +/* interface ID3D11DomainShader */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D11DomainShader; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("f582c508-0f36-490c-9977-31eece268cfa") + ID3D11DomainShader : public ID3D11DeviceChild + { + public: + }; + +#else /* C style interface */ + + typedef struct ID3D11DomainShaderVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D11DomainShader * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D11DomainShader * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D11DomainShader * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D11DomainShader * This, + /* [annotation] */ + __out ID3D11Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D11DomainShader * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D11DomainShader * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D11DomainShader * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData); + + END_INTERFACE + } ID3D11DomainShaderVtbl; + + interface ID3D11DomainShader + { + CONST_VTBL struct ID3D11DomainShaderVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D11DomainShader_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D11DomainShader_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D11DomainShader_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D11DomainShader_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D11DomainShader_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D11DomainShader_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D11DomainShader_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D11DomainShader_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D11GeometryShader_INTERFACE_DEFINED__ +#define __ID3D11GeometryShader_INTERFACE_DEFINED__ + +/* interface ID3D11GeometryShader */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D11GeometryShader; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("38325b96-effb-4022-ba02-2e795b70275c") + ID3D11GeometryShader : public ID3D11DeviceChild + { + public: + }; + +#else /* C style interface */ + + typedef struct ID3D11GeometryShaderVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D11GeometryShader * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D11GeometryShader * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D11GeometryShader * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D11GeometryShader * This, + /* [annotation] */ + __out ID3D11Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D11GeometryShader * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D11GeometryShader * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D11GeometryShader * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData); + + END_INTERFACE + } ID3D11GeometryShaderVtbl; + + interface ID3D11GeometryShader + { + CONST_VTBL struct ID3D11GeometryShaderVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D11GeometryShader_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D11GeometryShader_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D11GeometryShader_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D11GeometryShader_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D11GeometryShader_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D11GeometryShader_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D11GeometryShader_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D11GeometryShader_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D11PixelShader_INTERFACE_DEFINED__ +#define __ID3D11PixelShader_INTERFACE_DEFINED__ + +/* interface ID3D11PixelShader */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D11PixelShader; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("ea82e40d-51dc-4f33-93d4-db7c9125ae8c") + ID3D11PixelShader : public ID3D11DeviceChild + { + public: + }; + +#else /* C style interface */ + + typedef struct ID3D11PixelShaderVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D11PixelShader * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D11PixelShader * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D11PixelShader * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D11PixelShader * This, + /* [annotation] */ + __out ID3D11Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D11PixelShader * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D11PixelShader * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D11PixelShader * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData); + + END_INTERFACE + } ID3D11PixelShaderVtbl; + + interface ID3D11PixelShader + { + CONST_VTBL struct ID3D11PixelShaderVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D11PixelShader_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D11PixelShader_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D11PixelShader_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D11PixelShader_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D11PixelShader_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D11PixelShader_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D11PixelShader_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D11PixelShader_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D11ComputeShader_INTERFACE_DEFINED__ +#define __ID3D11ComputeShader_INTERFACE_DEFINED__ + +/* interface ID3D11ComputeShader */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D11ComputeShader; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("4f5b196e-c2bd-495e-bd01-1fded38e4969") + ID3D11ComputeShader : public ID3D11DeviceChild + { + public: + }; + +#else /* C style interface */ + + typedef struct ID3D11ComputeShaderVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D11ComputeShader * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D11ComputeShader * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D11ComputeShader * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D11ComputeShader * This, + /* [annotation] */ + __out ID3D11Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D11ComputeShader * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D11ComputeShader * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D11ComputeShader * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData); + + END_INTERFACE + } ID3D11ComputeShaderVtbl; + + interface ID3D11ComputeShader + { + CONST_VTBL struct ID3D11ComputeShaderVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D11ComputeShader_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D11ComputeShader_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D11ComputeShader_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D11ComputeShader_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D11ComputeShader_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D11ComputeShader_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D11ComputeShader_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D11ComputeShader_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D11InputLayout_INTERFACE_DEFINED__ +#define __ID3D11InputLayout_INTERFACE_DEFINED__ + +/* interface ID3D11InputLayout */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D11InputLayout; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("e4819ddc-4cf0-4025-bd26-5de82a3e07b7") + ID3D11InputLayout : public ID3D11DeviceChild + { + public: + }; + +#else /* C style interface */ + + typedef struct ID3D11InputLayoutVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D11InputLayout * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D11InputLayout * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D11InputLayout * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D11InputLayout * This, + /* [annotation] */ + __out ID3D11Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D11InputLayout * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D11InputLayout * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D11InputLayout * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData); + + END_INTERFACE + } ID3D11InputLayoutVtbl; + + interface ID3D11InputLayout + { + CONST_VTBL struct ID3D11InputLayoutVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D11InputLayout_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D11InputLayout_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D11InputLayout_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D11InputLayout_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D11InputLayout_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D11InputLayout_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D11InputLayout_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D11InputLayout_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d11_0000_0021 */ +/* [local] */ + +typedef +enum D3D11_FILTER + { D3D11_FILTER_MIN_MAG_MIP_POINT = 0, + D3D11_FILTER_MIN_MAG_POINT_MIP_LINEAR = 0x1, + D3D11_FILTER_MIN_POINT_MAG_LINEAR_MIP_POINT = 0x4, + D3D11_FILTER_MIN_POINT_MAG_MIP_LINEAR = 0x5, + D3D11_FILTER_MIN_LINEAR_MAG_MIP_POINT = 0x10, + D3D11_FILTER_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 0x11, + D3D11_FILTER_MIN_MAG_LINEAR_MIP_POINT = 0x14, + D3D11_FILTER_MIN_MAG_MIP_LINEAR = 0x15, + D3D11_FILTER_ANISOTROPIC = 0x55, + D3D11_FILTER_COMPARISON_MIN_MAG_MIP_POINT = 0x80, + D3D11_FILTER_COMPARISON_MIN_MAG_POINT_MIP_LINEAR = 0x81, + D3D11_FILTER_COMPARISON_MIN_POINT_MAG_LINEAR_MIP_POINT = 0x84, + D3D11_FILTER_COMPARISON_MIN_POINT_MAG_MIP_LINEAR = 0x85, + D3D11_FILTER_COMPARISON_MIN_LINEAR_MAG_MIP_POINT = 0x90, + D3D11_FILTER_COMPARISON_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 0x91, + D3D11_FILTER_COMPARISON_MIN_MAG_LINEAR_MIP_POINT = 0x94, + D3D11_FILTER_COMPARISON_MIN_MAG_MIP_LINEAR = 0x95, + D3D11_FILTER_COMPARISON_ANISOTROPIC = 0xd5 + } D3D11_FILTER; + +typedef +enum D3D11_FILTER_TYPE + { D3D11_FILTER_TYPE_POINT = 0, + D3D11_FILTER_TYPE_LINEAR = 1 + } D3D11_FILTER_TYPE; + +#define D3D11_FILTER_TYPE_MASK ( 0x3 ) + +#define D3D11_MIN_FILTER_SHIFT ( 4 ) + +#define D3D11_MAG_FILTER_SHIFT ( 2 ) + +#define D3D11_MIP_FILTER_SHIFT ( 0 ) + +#define D3D11_COMPARISON_FILTERING_BIT ( 0x80 ) + +#define D3D11_ANISOTROPIC_FILTERING_BIT ( 0x40 ) + +#define D3D11_ENCODE_BASIC_FILTER( min, mag, mip, bComparison ) \ + ( ( D3D11_FILTER ) ( \ + ( ( bComparison ) ? D3D11_COMPARISON_FILTERING_BIT : 0 ) | \ + ( ( ( min ) & D3D11_FILTER_TYPE_MASK ) << D3D11_MIN_FILTER_SHIFT ) | \ + ( ( ( mag ) & D3D11_FILTER_TYPE_MASK ) << D3D11_MAG_FILTER_SHIFT ) | \ + ( ( ( mip ) & D3D11_FILTER_TYPE_MASK ) << D3D11_MIP_FILTER_SHIFT ) ) ) +#define D3D11_ENCODE_ANISOTROPIC_FILTER( bComparison ) \ + ( ( D3D11_FILTER ) ( \ + D3D11_ANISOTROPIC_FILTERING_BIT | \ + D3D11_ENCODE_BASIC_FILTER( D3D11_FILTER_TYPE_LINEAR, \ + D3D11_FILTER_TYPE_LINEAR, \ + D3D11_FILTER_TYPE_LINEAR, \ + bComparison ) ) ) +#define D3D11_DECODE_MIN_FILTER( d3d11Filter ) \ + ( ( D3D11_FILTER_TYPE ) \ + ( ( ( d3d11Filter ) >> D3D11_MIN_FILTER_SHIFT ) & D3D11_FILTER_TYPE_MASK ) ) +#define D3D11_DECODE_MAG_FILTER( d3d11Filter ) \ + ( ( D3D11_FILTER_TYPE ) \ + ( ( ( d3d11Filter ) >> D3D11_MAG_FILTER_SHIFT ) & D3D11_FILTER_TYPE_MASK ) ) +#define D3D11_DECODE_MIP_FILTER( d3d11Filter ) \ + ( ( D3D11_FILTER_TYPE ) \ + ( ( ( d3d11Filter ) >> D3D11_MIP_FILTER_SHIFT ) & D3D11_FILTER_TYPE_MASK ) ) +#define D3D11_DECODE_IS_COMPARISON_FILTER( d3d11Filter ) \ + ( ( d3d11Filter ) & D3D11_COMPARISON_FILTERING_BIT ) +#define D3D11_DECODE_IS_ANISOTROPIC_FILTER( d3d11Filter ) \ + ( ( ( d3d11Filter ) & D3D11_ANISOTROPIC_FILTERING_BIT ) && \ + ( D3D11_FILTER_TYPE_LINEAR == D3D11_DECODE_MIN_FILTER( d3d11Filter ) ) && \ + ( D3D11_FILTER_TYPE_LINEAR == D3D11_DECODE_MAG_FILTER( d3d11Filter ) ) && \ + ( D3D11_FILTER_TYPE_LINEAR == D3D11_DECODE_MIP_FILTER( d3d11Filter ) ) ) +typedef +enum D3D11_TEXTURE_ADDRESS_MODE + { D3D11_TEXTURE_ADDRESS_WRAP = 1, + D3D11_TEXTURE_ADDRESS_MIRROR = 2, + D3D11_TEXTURE_ADDRESS_CLAMP = 3, + D3D11_TEXTURE_ADDRESS_BORDER = 4, + D3D11_TEXTURE_ADDRESS_MIRROR_ONCE = 5 + } D3D11_TEXTURE_ADDRESS_MODE; + +typedef struct D3D11_SAMPLER_DESC + { + D3D11_FILTER Filter; + D3D11_TEXTURE_ADDRESS_MODE AddressU; + D3D11_TEXTURE_ADDRESS_MODE AddressV; + D3D11_TEXTURE_ADDRESS_MODE AddressW; + FLOAT MipLODBias; + UINT MaxAnisotropy; + D3D11_COMPARISON_FUNC ComparisonFunc; + FLOAT BorderColor[ 4 ]; + FLOAT MinLOD; + FLOAT MaxLOD; + } D3D11_SAMPLER_DESC; + +#if !defined( D3D11_NO_HELPERS ) && defined( __cplusplus ) +} +struct CD3D11_SAMPLER_DESC : public D3D11_SAMPLER_DESC +{ + CD3D11_SAMPLER_DESC() + {} + explicit CD3D11_SAMPLER_DESC( const D3D11_SAMPLER_DESC& o ) : + D3D11_SAMPLER_DESC( o ) + {} + explicit CD3D11_SAMPLER_DESC( CD3D11_DEFAULT ) + { + Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR; + AddressU = D3D11_TEXTURE_ADDRESS_CLAMP; + AddressV = D3D11_TEXTURE_ADDRESS_CLAMP; + AddressW = D3D11_TEXTURE_ADDRESS_CLAMP; + MipLODBias = 0; + MaxAnisotropy = 1; + ComparisonFunc = D3D11_COMPARISON_NEVER; + BorderColor[ 0 ] = 1.0f; + BorderColor[ 1 ] = 1.0f; + BorderColor[ 2 ] = 1.0f; + BorderColor[ 3 ] = 1.0f; + MinLOD = -3.402823466e+38F; // -FLT_MAX + MaxLOD = 3.402823466e+38F; // FLT_MAX + } + explicit CD3D11_SAMPLER_DESC( + D3D11_FILTER filter, + D3D11_TEXTURE_ADDRESS_MODE addressU, + D3D11_TEXTURE_ADDRESS_MODE addressV, + D3D11_TEXTURE_ADDRESS_MODE addressW, + FLOAT mipLODBias, + UINT maxAnisotropy, + D3D11_COMPARISON_FUNC comparisonFunc, + __in_ecount_opt( 4 ) const FLOAT* borderColor, // RGBA + FLOAT minLOD, + FLOAT maxLOD ) + { + Filter = filter; + AddressU = addressU; + AddressV = addressV; + AddressW = addressW; + MipLODBias = mipLODBias; + MaxAnisotropy = maxAnisotropy; + ComparisonFunc = comparisonFunc; + const float defaultColor[ 4 ] = { 1.0f, 1.0f, 1.0f, 1.0f }; + if (!borderColor) borderColor = defaultColor; + BorderColor[ 0 ] = borderColor[ 0 ]; + BorderColor[ 1 ] = borderColor[ 1 ]; + BorderColor[ 2 ] = borderColor[ 2 ]; + BorderColor[ 3 ] = borderColor[ 3 ]; + MinLOD = minLOD; + MaxLOD = maxLOD; + } + ~CD3D11_SAMPLER_DESC() {} + operator const D3D11_SAMPLER_DESC&() const { return *this; } +}; +extern "C"{ +#endif + + +extern RPC_IF_HANDLE __MIDL_itf_d3d11_0000_0021_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d11_0000_0021_v0_0_s_ifspec; + +#ifndef __ID3D11SamplerState_INTERFACE_DEFINED__ +#define __ID3D11SamplerState_INTERFACE_DEFINED__ + +/* interface ID3D11SamplerState */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D11SamplerState; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("da6fea51-564c-4487-9810-f0d0f9b4e3a5") + ID3D11SamplerState : public ID3D11DeviceChild + { + public: + virtual void STDMETHODCALLTYPE GetDesc( + /* [annotation] */ + __out D3D11_SAMPLER_DESC *pDesc) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D11SamplerStateVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D11SamplerState * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D11SamplerState * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D11SamplerState * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D11SamplerState * This, + /* [annotation] */ + __out ID3D11Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D11SamplerState * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D11SamplerState * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D11SamplerState * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData); + + void ( STDMETHODCALLTYPE *GetDesc )( + ID3D11SamplerState * This, + /* [annotation] */ + __out D3D11_SAMPLER_DESC *pDesc); + + END_INTERFACE + } ID3D11SamplerStateVtbl; + + interface ID3D11SamplerState + { + CONST_VTBL struct ID3D11SamplerStateVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D11SamplerState_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D11SamplerState_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D11SamplerState_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D11SamplerState_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D11SamplerState_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D11SamplerState_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D11SamplerState_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D11SamplerState_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D11SamplerState_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d11_0000_0022 */ +/* [local] */ + +typedef +enum D3D11_FORMAT_SUPPORT + { D3D11_FORMAT_SUPPORT_BUFFER = 0x1, + D3D11_FORMAT_SUPPORT_IA_VERTEX_BUFFER = 0x2, + D3D11_FORMAT_SUPPORT_IA_INDEX_BUFFER = 0x4, + D3D11_FORMAT_SUPPORT_SO_BUFFER = 0x8, + D3D11_FORMAT_SUPPORT_TEXTURE1D = 0x10, + D3D11_FORMAT_SUPPORT_TEXTURE2D = 0x20, + D3D11_FORMAT_SUPPORT_TEXTURE3D = 0x40, + D3D11_FORMAT_SUPPORT_TEXTURECUBE = 0x80, + D3D11_FORMAT_SUPPORT_SHADER_LOAD = 0x100, + D3D11_FORMAT_SUPPORT_SHADER_SAMPLE = 0x200, + D3D11_FORMAT_SUPPORT_SHADER_SAMPLE_COMPARISON = 0x400, + D3D11_FORMAT_SUPPORT_SHADER_SAMPLE_MONO_TEXT = 0x800, + D3D11_FORMAT_SUPPORT_MIP = 0x1000, + D3D11_FORMAT_SUPPORT_MIP_AUTOGEN = 0x2000, + D3D11_FORMAT_SUPPORT_RENDER_TARGET = 0x4000, + D3D11_FORMAT_SUPPORT_BLENDABLE = 0x8000, + D3D11_FORMAT_SUPPORT_DEPTH_STENCIL = 0x10000, + D3D11_FORMAT_SUPPORT_CPU_LOCKABLE = 0x20000, + D3D11_FORMAT_SUPPORT_MULTISAMPLE_RESOLVE = 0x40000, + D3D11_FORMAT_SUPPORT_DISPLAY = 0x80000, + D3D11_FORMAT_SUPPORT_CAST_WITHIN_BIT_LAYOUT = 0x100000, + D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET = 0x200000, + D3D11_FORMAT_SUPPORT_MULTISAMPLE_LOAD = 0x400000, + D3D11_FORMAT_SUPPORT_SHADER_GATHER = 0x800000, + D3D11_FORMAT_SUPPORT_BACK_BUFFER_CAST = 0x1000000, + D3D11_FORMAT_SUPPORT_TYPED_UNORDERED_ACCESS_VIEW = 0x2000000, + D3D11_FORMAT_SUPPORT_SHADER_GATHER_COMPARISON = 0x4000000 + } D3D11_FORMAT_SUPPORT; + +typedef +enum D3D11_FORMAT_SUPPORT2 + { D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_ADD = 0x1, + D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_BITWISE_OPS = 0x2, + D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_COMPARE_STORE_OR_COMPARE_EXCHANGE = 0x4, + D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_EXCHANGE = 0x8, + D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_SIGNED_MIN_OR_MAX = 0x10, + D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_UNSIGNED_MIN_OR_MAX = 0x20, + D3D11_FORMAT_SUPPORT2_UAV_TYPED_LOAD = 0x40, + D3D11_FORMAT_SUPPORT2_UAV_TYPED_STORE = 0x80 + } D3D11_FORMAT_SUPPORT2; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d11_0000_0022_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d11_0000_0022_v0_0_s_ifspec; + +#ifndef __ID3D11Asynchronous_INTERFACE_DEFINED__ +#define __ID3D11Asynchronous_INTERFACE_DEFINED__ + +/* interface ID3D11Asynchronous */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D11Asynchronous; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("4b35d0cd-1e15-4258-9c98-1b1333f6dd3b") + ID3D11Asynchronous : public ID3D11DeviceChild + { + public: + virtual UINT STDMETHODCALLTYPE GetDataSize( void) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D11AsynchronousVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D11Asynchronous * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D11Asynchronous * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D11Asynchronous * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D11Asynchronous * This, + /* [annotation] */ + __out ID3D11Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D11Asynchronous * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D11Asynchronous * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D11Asynchronous * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData); + + UINT ( STDMETHODCALLTYPE *GetDataSize )( + ID3D11Asynchronous * This); + + END_INTERFACE + } ID3D11AsynchronousVtbl; + + interface ID3D11Asynchronous + { + CONST_VTBL struct ID3D11AsynchronousVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D11Asynchronous_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D11Asynchronous_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D11Asynchronous_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D11Asynchronous_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D11Asynchronous_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D11Asynchronous_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D11Asynchronous_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D11Asynchronous_GetDataSize(This) \ + ( (This)->lpVtbl -> GetDataSize(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D11Asynchronous_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d11_0000_0023 */ +/* [local] */ + +typedef +enum D3D11_ASYNC_GETDATA_FLAG + { D3D11_ASYNC_GETDATA_DONOTFLUSH = 0x1 + } D3D11_ASYNC_GETDATA_FLAG; + +typedef +enum D3D11_QUERY + { D3D11_QUERY_EVENT = 0, + D3D11_QUERY_OCCLUSION = ( D3D11_QUERY_EVENT + 1 ) , + D3D11_QUERY_TIMESTAMP = ( D3D11_QUERY_OCCLUSION + 1 ) , + D3D11_QUERY_TIMESTAMP_DISJOINT = ( D3D11_QUERY_TIMESTAMP + 1 ) , + D3D11_QUERY_PIPELINE_STATISTICS = ( D3D11_QUERY_TIMESTAMP_DISJOINT + 1 ) , + D3D11_QUERY_OCCLUSION_PREDICATE = ( D3D11_QUERY_PIPELINE_STATISTICS + 1 ) , + D3D11_QUERY_SO_STATISTICS = ( D3D11_QUERY_OCCLUSION_PREDICATE + 1 ) , + D3D11_QUERY_SO_OVERFLOW_PREDICATE = ( D3D11_QUERY_SO_STATISTICS + 1 ) , + D3D11_QUERY_SO_STATISTICS_STREAM0 = ( D3D11_QUERY_SO_OVERFLOW_PREDICATE + 1 ) , + D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM0 = ( D3D11_QUERY_SO_STATISTICS_STREAM0 + 1 ) , + D3D11_QUERY_SO_STATISTICS_STREAM1 = ( D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM0 + 1 ) , + D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM1 = ( D3D11_QUERY_SO_STATISTICS_STREAM1 + 1 ) , + D3D11_QUERY_SO_STATISTICS_STREAM2 = ( D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM1 + 1 ) , + D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM2 = ( D3D11_QUERY_SO_STATISTICS_STREAM2 + 1 ) , + D3D11_QUERY_SO_STATISTICS_STREAM3 = ( D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM2 + 1 ) , + D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM3 = ( D3D11_QUERY_SO_STATISTICS_STREAM3 + 1 ) + } D3D11_QUERY; + +typedef +enum D3D11_QUERY_MISC_FLAG + { D3D11_QUERY_MISC_PREDICATEHINT = 0x1 + } D3D11_QUERY_MISC_FLAG; + +typedef struct D3D11_QUERY_DESC + { + D3D11_QUERY Query; + UINT MiscFlags; + } D3D11_QUERY_DESC; + +#if !defined( D3D11_NO_HELPERS ) && defined( __cplusplus ) +} +struct CD3D11_QUERY_DESC : public D3D11_QUERY_DESC +{ + CD3D11_QUERY_DESC() + {} + explicit CD3D11_QUERY_DESC( const D3D11_QUERY_DESC& o ) : + D3D11_QUERY_DESC( o ) + {} + explicit CD3D11_QUERY_DESC( + D3D11_QUERY query, + UINT miscFlags = 0 ) + { + Query = query; + MiscFlags = miscFlags; + } + ~CD3D11_QUERY_DESC() {} + operator const D3D11_QUERY_DESC&() const { return *this; } +}; +extern "C"{ +#endif + + +extern RPC_IF_HANDLE __MIDL_itf_d3d11_0000_0023_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d11_0000_0023_v0_0_s_ifspec; + +#ifndef __ID3D11Query_INTERFACE_DEFINED__ +#define __ID3D11Query_INTERFACE_DEFINED__ + +/* interface ID3D11Query */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D11Query; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("d6c00747-87b7-425e-b84d-44d108560afd") + ID3D11Query : public ID3D11Asynchronous + { + public: + virtual void STDMETHODCALLTYPE GetDesc( + /* [annotation] */ + __out D3D11_QUERY_DESC *pDesc) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D11QueryVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D11Query * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D11Query * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D11Query * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D11Query * This, + /* [annotation] */ + __out ID3D11Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D11Query * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D11Query * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D11Query * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData); + + UINT ( STDMETHODCALLTYPE *GetDataSize )( + ID3D11Query * This); + + void ( STDMETHODCALLTYPE *GetDesc )( + ID3D11Query * This, + /* [annotation] */ + __out D3D11_QUERY_DESC *pDesc); + + END_INTERFACE + } ID3D11QueryVtbl; + + interface ID3D11Query + { + CONST_VTBL struct ID3D11QueryVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D11Query_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D11Query_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D11Query_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D11Query_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D11Query_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D11Query_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D11Query_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D11Query_GetDataSize(This) \ + ( (This)->lpVtbl -> GetDataSize(This) ) + + +#define ID3D11Query_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D11Query_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D11Predicate_INTERFACE_DEFINED__ +#define __ID3D11Predicate_INTERFACE_DEFINED__ + +/* interface ID3D11Predicate */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D11Predicate; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9eb576dd-9f77-4d86-81aa-8bab5fe490e2") + ID3D11Predicate : public ID3D11Query + { + public: + }; + +#else /* C style interface */ + + typedef struct ID3D11PredicateVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D11Predicate * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D11Predicate * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D11Predicate * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D11Predicate * This, + /* [annotation] */ + __out ID3D11Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D11Predicate * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D11Predicate * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D11Predicate * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData); + + UINT ( STDMETHODCALLTYPE *GetDataSize )( + ID3D11Predicate * This); + + void ( STDMETHODCALLTYPE *GetDesc )( + ID3D11Predicate * This, + /* [annotation] */ + __out D3D11_QUERY_DESC *pDesc); + + END_INTERFACE + } ID3D11PredicateVtbl; + + interface ID3D11Predicate + { + CONST_VTBL struct ID3D11PredicateVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D11Predicate_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D11Predicate_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D11Predicate_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D11Predicate_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D11Predicate_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D11Predicate_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D11Predicate_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D11Predicate_GetDataSize(This) \ + ( (This)->lpVtbl -> GetDataSize(This) ) + + +#define ID3D11Predicate_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D11Predicate_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d11_0000_0025 */ +/* [local] */ + +typedef struct D3D11_QUERY_DATA_TIMESTAMP_DISJOINT + { + UINT64 Frequency; + BOOL Disjoint; + } D3D11_QUERY_DATA_TIMESTAMP_DISJOINT; + +typedef struct D3D11_QUERY_DATA_PIPELINE_STATISTICS + { + UINT64 IAVertices; + UINT64 IAPrimitives; + UINT64 VSInvocations; + UINT64 GSInvocations; + UINT64 GSPrimitives; + UINT64 CInvocations; + UINT64 CPrimitives; + UINT64 PSInvocations; + UINT64 HSInvocations; + UINT64 DSInvocations; + UINT64 CSInvocations; + } D3D11_QUERY_DATA_PIPELINE_STATISTICS; + +typedef struct D3D11_QUERY_DATA_SO_STATISTICS + { + UINT64 NumPrimitivesWritten; + UINT64 PrimitivesStorageNeeded; + } D3D11_QUERY_DATA_SO_STATISTICS; + +typedef +enum D3D11_COUNTER + { D3D11_COUNTER_DEVICE_DEPENDENT_0 = 0x40000000 + } D3D11_COUNTER; + +typedef +enum D3D11_COUNTER_TYPE + { D3D11_COUNTER_TYPE_FLOAT32 = 0, + D3D11_COUNTER_TYPE_UINT16 = ( D3D11_COUNTER_TYPE_FLOAT32 + 1 ) , + D3D11_COUNTER_TYPE_UINT32 = ( D3D11_COUNTER_TYPE_UINT16 + 1 ) , + D3D11_COUNTER_TYPE_UINT64 = ( D3D11_COUNTER_TYPE_UINT32 + 1 ) + } D3D11_COUNTER_TYPE; + +typedef struct D3D11_COUNTER_DESC + { + D3D11_COUNTER Counter; + UINT MiscFlags; + } D3D11_COUNTER_DESC; + +#if !defined( D3D11_NO_HELPERS ) && defined( __cplusplus ) +} +struct CD3D11_COUNTER_DESC : public D3D11_COUNTER_DESC +{ + CD3D11_COUNTER_DESC() + {} + explicit CD3D11_COUNTER_DESC( const D3D11_COUNTER_DESC& o ) : + D3D11_COUNTER_DESC( o ) + {} + explicit CD3D11_COUNTER_DESC( + D3D11_COUNTER counter, + UINT miscFlags = 0 ) + { + Counter = counter; + MiscFlags = miscFlags; + } + ~CD3D11_COUNTER_DESC() {} + operator const D3D11_COUNTER_DESC&() const { return *this; } +}; +extern "C"{ +#endif +typedef struct D3D11_COUNTER_INFO + { + D3D11_COUNTER LastDeviceDependentCounter; + UINT NumSimultaneousCounters; + UINT8 NumDetectableParallelUnits; + } D3D11_COUNTER_INFO; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d11_0000_0025_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d11_0000_0025_v0_0_s_ifspec; + +#ifndef __ID3D11Counter_INTERFACE_DEFINED__ +#define __ID3D11Counter_INTERFACE_DEFINED__ + +/* interface ID3D11Counter */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D11Counter; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("6e8c49fb-a371-4770-b440-29086022b741") + ID3D11Counter : public ID3D11Asynchronous + { + public: + virtual void STDMETHODCALLTYPE GetDesc( + /* [annotation] */ + __out D3D11_COUNTER_DESC *pDesc) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D11CounterVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D11Counter * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D11Counter * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D11Counter * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D11Counter * This, + /* [annotation] */ + __out ID3D11Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D11Counter * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D11Counter * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D11Counter * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData); + + UINT ( STDMETHODCALLTYPE *GetDataSize )( + ID3D11Counter * This); + + void ( STDMETHODCALLTYPE *GetDesc )( + ID3D11Counter * This, + /* [annotation] */ + __out D3D11_COUNTER_DESC *pDesc); + + END_INTERFACE + } ID3D11CounterVtbl; + + interface ID3D11Counter + { + CONST_VTBL struct ID3D11CounterVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D11Counter_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D11Counter_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D11Counter_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D11Counter_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D11Counter_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D11Counter_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D11Counter_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D11Counter_GetDataSize(This) \ + ( (This)->lpVtbl -> GetDataSize(This) ) + + +#define ID3D11Counter_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D11Counter_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d11_0000_0026 */ +/* [local] */ + +typedef +enum D3D11_STANDARD_MULTISAMPLE_QUALITY_LEVELS + { D3D11_STANDARD_MULTISAMPLE_PATTERN = 0xffffffff, + D3D11_CENTER_MULTISAMPLE_PATTERN = 0xfffffffe + } D3D11_STANDARD_MULTISAMPLE_QUALITY_LEVELS; + +typedef +enum D3D11_DEVICE_CONTEXT_TYPE + { D3D11_DEVICE_CONTEXT_IMMEDIATE = 0, + D3D11_DEVICE_CONTEXT_DEFERRED = ( D3D11_DEVICE_CONTEXT_IMMEDIATE + 1 ) + } D3D11_DEVICE_CONTEXT_TYPE; + +typedef struct D3D11_CLASS_INSTANCE_DESC + { + UINT InstanceId; + UINT InstanceIndex; + UINT TypeId; + UINT ConstantBuffer; + UINT BaseConstantBufferOffset; + UINT BaseTexture; + UINT BaseSampler; + BOOL Created; + } D3D11_CLASS_INSTANCE_DESC; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d11_0000_0026_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d11_0000_0026_v0_0_s_ifspec; + +#ifndef __ID3D11ClassInstance_INTERFACE_DEFINED__ +#define __ID3D11ClassInstance_INTERFACE_DEFINED__ + +/* interface ID3D11ClassInstance */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D11ClassInstance; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("a6cd7faa-b0b7-4a2f-9436-8662a65797cb") + ID3D11ClassInstance : public ID3D11DeviceChild + { + public: + virtual void STDMETHODCALLTYPE GetClassLinkage( + /* [annotation] */ + __out ID3D11ClassLinkage **ppLinkage) = 0; + + virtual void STDMETHODCALLTYPE GetDesc( + /* [annotation] */ + __out D3D11_CLASS_INSTANCE_DESC *pDesc) = 0; + + virtual void STDMETHODCALLTYPE GetInstanceName( + /* [annotation] */ + __out_ecount_opt(*pBufferLength) LPSTR pInstanceName, + /* [annotation] */ + __inout SIZE_T *pBufferLength) = 0; + + virtual void STDMETHODCALLTYPE GetTypeName( + /* [annotation] */ + __out_ecount_opt(*pBufferLength) LPSTR pTypeName, + /* [annotation] */ + __inout SIZE_T *pBufferLength) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D11ClassInstanceVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D11ClassInstance * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D11ClassInstance * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D11ClassInstance * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D11ClassInstance * This, + /* [annotation] */ + __out ID3D11Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D11ClassInstance * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D11ClassInstance * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D11ClassInstance * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData); + + void ( STDMETHODCALLTYPE *GetClassLinkage )( + ID3D11ClassInstance * This, + /* [annotation] */ + __out ID3D11ClassLinkage **ppLinkage); + + void ( STDMETHODCALLTYPE *GetDesc )( + ID3D11ClassInstance * This, + /* [annotation] */ + __out D3D11_CLASS_INSTANCE_DESC *pDesc); + + void ( STDMETHODCALLTYPE *GetInstanceName )( + ID3D11ClassInstance * This, + /* [annotation] */ + __out_ecount_opt(*pBufferLength) LPSTR pInstanceName, + /* [annotation] */ + __inout SIZE_T *pBufferLength); + + void ( STDMETHODCALLTYPE *GetTypeName )( + ID3D11ClassInstance * This, + /* [annotation] */ + __out_ecount_opt(*pBufferLength) LPSTR pTypeName, + /* [annotation] */ + __inout SIZE_T *pBufferLength); + + END_INTERFACE + } ID3D11ClassInstanceVtbl; + + interface ID3D11ClassInstance + { + CONST_VTBL struct ID3D11ClassInstanceVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D11ClassInstance_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D11ClassInstance_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D11ClassInstance_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D11ClassInstance_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D11ClassInstance_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D11ClassInstance_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D11ClassInstance_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D11ClassInstance_GetClassLinkage(This,ppLinkage) \ + ( (This)->lpVtbl -> GetClassLinkage(This,ppLinkage) ) + +#define ID3D11ClassInstance_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + +#define ID3D11ClassInstance_GetInstanceName(This,pInstanceName,pBufferLength) \ + ( (This)->lpVtbl -> GetInstanceName(This,pInstanceName,pBufferLength) ) + +#define ID3D11ClassInstance_GetTypeName(This,pTypeName,pBufferLength) \ + ( (This)->lpVtbl -> GetTypeName(This,pTypeName,pBufferLength) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D11ClassInstance_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D11ClassLinkage_INTERFACE_DEFINED__ +#define __ID3D11ClassLinkage_INTERFACE_DEFINED__ + +/* interface ID3D11ClassLinkage */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D11ClassLinkage; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("ddf57cba-9543-46e4-a12b-f207a0fe7fed") + ID3D11ClassLinkage : public ID3D11DeviceChild + { + public: + virtual HRESULT STDMETHODCALLTYPE GetClassInstance( + /* [annotation] */ + __in LPCSTR pClassInstanceName, + /* [annotation] */ + __in UINT InstanceIndex, + /* [annotation] */ + __out ID3D11ClassInstance **ppInstance) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateClassInstance( + /* [annotation] */ + __in LPCSTR pClassTypeName, + /* [annotation] */ + __in UINT ConstantBufferOffset, + /* [annotation] */ + __in UINT ConstantVectorOffset, + /* [annotation] */ + __in UINT TextureOffset, + /* [annotation] */ + __in UINT SamplerOffset, + /* [annotation] */ + __out ID3D11ClassInstance **ppInstance) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D11ClassLinkageVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D11ClassLinkage * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D11ClassLinkage * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D11ClassLinkage * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D11ClassLinkage * This, + /* [annotation] */ + __out ID3D11Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D11ClassLinkage * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D11ClassLinkage * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D11ClassLinkage * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData); + + HRESULT ( STDMETHODCALLTYPE *GetClassInstance )( + ID3D11ClassLinkage * This, + /* [annotation] */ + __in LPCSTR pClassInstanceName, + /* [annotation] */ + __in UINT InstanceIndex, + /* [annotation] */ + __out ID3D11ClassInstance **ppInstance); + + HRESULT ( STDMETHODCALLTYPE *CreateClassInstance )( + ID3D11ClassLinkage * This, + /* [annotation] */ + __in LPCSTR pClassTypeName, + /* [annotation] */ + __in UINT ConstantBufferOffset, + /* [annotation] */ + __in UINT ConstantVectorOffset, + /* [annotation] */ + __in UINT TextureOffset, + /* [annotation] */ + __in UINT SamplerOffset, + /* [annotation] */ + __out ID3D11ClassInstance **ppInstance); + + END_INTERFACE + } ID3D11ClassLinkageVtbl; + + interface ID3D11ClassLinkage + { + CONST_VTBL struct ID3D11ClassLinkageVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D11ClassLinkage_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D11ClassLinkage_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D11ClassLinkage_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D11ClassLinkage_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D11ClassLinkage_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D11ClassLinkage_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D11ClassLinkage_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D11ClassLinkage_GetClassInstance(This,pClassInstanceName,InstanceIndex,ppInstance) \ + ( (This)->lpVtbl -> GetClassInstance(This,pClassInstanceName,InstanceIndex,ppInstance) ) + +#define ID3D11ClassLinkage_CreateClassInstance(This,pClassTypeName,ConstantBufferOffset,ConstantVectorOffset,TextureOffset,SamplerOffset,ppInstance) \ + ( (This)->lpVtbl -> CreateClassInstance(This,pClassTypeName,ConstantBufferOffset,ConstantVectorOffset,TextureOffset,SamplerOffset,ppInstance) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D11ClassLinkage_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D11CommandList_INTERFACE_DEFINED__ +#define __ID3D11CommandList_INTERFACE_DEFINED__ + +/* interface ID3D11CommandList */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D11CommandList; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("a24bc4d1-769e-43f7-8013-98ff566c18e2") + ID3D11CommandList : public ID3D11DeviceChild + { + public: + virtual UINT STDMETHODCALLTYPE GetContextFlags( void) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D11CommandListVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D11CommandList * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D11CommandList * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D11CommandList * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D11CommandList * This, + /* [annotation] */ + __out ID3D11Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D11CommandList * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D11CommandList * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D11CommandList * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData); + + UINT ( STDMETHODCALLTYPE *GetContextFlags )( + ID3D11CommandList * This); + + END_INTERFACE + } ID3D11CommandListVtbl; + + interface ID3D11CommandList + { + CONST_VTBL struct ID3D11CommandListVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D11CommandList_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D11CommandList_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D11CommandList_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D11CommandList_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D11CommandList_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D11CommandList_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D11CommandList_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D11CommandList_GetContextFlags(This) \ + ( (This)->lpVtbl -> GetContextFlags(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D11CommandList_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d11_0000_0029 */ +/* [local] */ + +typedef +enum D3D11_FEATURE + { D3D11_FEATURE_THREADING = 0, + D3D11_FEATURE_DOUBLES = ( D3D11_FEATURE_THREADING + 1 ) , + D3D11_FEATURE_FORMAT_SUPPORT = ( D3D11_FEATURE_DOUBLES + 1 ) , + D3D11_FEATURE_FORMAT_SUPPORT2 = ( D3D11_FEATURE_FORMAT_SUPPORT + 1 ) , + D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS = ( D3D11_FEATURE_FORMAT_SUPPORT2 + 1 ) + } D3D11_FEATURE; + +typedef struct D3D11_FEATURE_DATA_THREADING + { + BOOL DriverConcurrentCreates; + BOOL DriverCommandLists; + } D3D11_FEATURE_DATA_THREADING; + +typedef struct D3D11_FEATURE_DATA_DOUBLES + { + BOOL DoublePrecisionFloatShaderOps; + } D3D11_FEATURE_DATA_DOUBLES; + +typedef struct D3D11_FEATURE_DATA_FORMAT_SUPPORT + { + DXGI_FORMAT InFormat; + UINT OutFormatSupport; + } D3D11_FEATURE_DATA_FORMAT_SUPPORT; + +typedef struct D3D11_FEATURE_DATA_FORMAT_SUPPORT2 + { + DXGI_FORMAT InFormat; + UINT OutFormatSupport2; + } D3D11_FEATURE_DATA_FORMAT_SUPPORT2; + +typedef struct D3D11_FEATURE_DATA_D3D10_X_HARDWARE_OPTIONS + { + BOOL ComputeShaders_Plus_RawAndStructuredBuffers_Via_Shader_4_x; + } D3D11_FEATURE_DATA_D3D10_X_HARDWARE_OPTIONS; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d11_0000_0029_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d11_0000_0029_v0_0_s_ifspec; + +#ifndef __ID3D11DeviceContext_INTERFACE_DEFINED__ +#define __ID3D11DeviceContext_INTERFACE_DEFINED__ + +/* interface ID3D11DeviceContext */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D11DeviceContext; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("c0bfa96c-e089-44fb-8eaf-26f8796190da") + ID3D11DeviceContext : public ID3D11DeviceChild + { + public: + virtual void STDMETHODCALLTYPE VSSetConstantBuffers( + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + __in_ecount(NumBuffers) ID3D11Buffer *const *ppConstantBuffers) = 0; + + virtual void STDMETHODCALLTYPE PSSetShaderResources( + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* [annotation] */ + __in_ecount(NumViews) ID3D11ShaderResourceView *const *ppShaderResourceViews) = 0; + + virtual void STDMETHODCALLTYPE PSSetShader( + /* [annotation] */ + __in_opt ID3D11PixelShader *pPixelShader, + /* [annotation] */ + __in_ecount_opt(NumClassInstances) ID3D11ClassInstance *const *ppClassInstances, + UINT NumClassInstances) = 0; + + virtual void STDMETHODCALLTYPE PSSetSamplers( + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* [annotation] */ + __in_ecount(NumSamplers) ID3D11SamplerState *const *ppSamplers) = 0; + + virtual void STDMETHODCALLTYPE VSSetShader( + /* [annotation] */ + __in_opt ID3D11VertexShader *pVertexShader, + /* [annotation] */ + __in_ecount_opt(NumClassInstances) ID3D11ClassInstance *const *ppClassInstances, + UINT NumClassInstances) = 0; + + virtual void STDMETHODCALLTYPE DrawIndexed( + /* [annotation] */ + __in UINT IndexCount, + /* [annotation] */ + __in UINT StartIndexLocation, + /* [annotation] */ + __in INT BaseVertexLocation) = 0; + + virtual void STDMETHODCALLTYPE Draw( + /* [annotation] */ + __in UINT VertexCount, + /* [annotation] */ + __in UINT StartVertexLocation) = 0; + + virtual HRESULT STDMETHODCALLTYPE Map( + /* [annotation] */ + __in ID3D11Resource *pResource, + /* [annotation] */ + __in UINT Subresource, + /* [annotation] */ + __in D3D11_MAP MapType, + /* [annotation] */ + __in UINT MapFlags, + /* [annotation] */ + __out D3D11_MAPPED_SUBRESOURCE *pMappedResource) = 0; + + virtual void STDMETHODCALLTYPE Unmap( + /* [annotation] */ + __in ID3D11Resource *pResource, + /* [annotation] */ + __in UINT Subresource) = 0; + + virtual void STDMETHODCALLTYPE PSSetConstantBuffers( + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + __in_ecount(NumBuffers) ID3D11Buffer *const *ppConstantBuffers) = 0; + + virtual void STDMETHODCALLTYPE IASetInputLayout( + /* [annotation] */ + __in_opt ID3D11InputLayout *pInputLayout) = 0; + + virtual void STDMETHODCALLTYPE IASetVertexBuffers( + /* [annotation] */ + __in_range( 0, D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + __in_ecount(NumBuffers) ID3D11Buffer *const *ppVertexBuffers, + /* [annotation] */ + __in_ecount(NumBuffers) const UINT *pStrides, + /* [annotation] */ + __in_ecount(NumBuffers) const UINT *pOffsets) = 0; + + virtual void STDMETHODCALLTYPE IASetIndexBuffer( + /* [annotation] */ + __in_opt ID3D11Buffer *pIndexBuffer, + /* [annotation] */ + __in DXGI_FORMAT Format, + /* [annotation] */ + __in UINT Offset) = 0; + + virtual void STDMETHODCALLTYPE DrawIndexedInstanced( + /* [annotation] */ + __in UINT IndexCountPerInstance, + /* [annotation] */ + __in UINT InstanceCount, + /* [annotation] */ + __in UINT StartIndexLocation, + /* [annotation] */ + __in INT BaseVertexLocation, + /* [annotation] */ + __in UINT StartInstanceLocation) = 0; + + virtual void STDMETHODCALLTYPE DrawInstanced( + /* [annotation] */ + __in UINT VertexCountPerInstance, + /* [annotation] */ + __in UINT InstanceCount, + /* [annotation] */ + __in UINT StartVertexLocation, + /* [annotation] */ + __in UINT StartInstanceLocation) = 0; + + virtual void STDMETHODCALLTYPE GSSetConstantBuffers( + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + __in_ecount(NumBuffers) ID3D11Buffer *const *ppConstantBuffers) = 0; + + virtual void STDMETHODCALLTYPE GSSetShader( + /* [annotation] */ + __in_opt ID3D11GeometryShader *pShader, + /* [annotation] */ + __in_ecount_opt(NumClassInstances) ID3D11ClassInstance *const *ppClassInstances, + UINT NumClassInstances) = 0; + + virtual void STDMETHODCALLTYPE IASetPrimitiveTopology( + /* [annotation] */ + __in D3D11_PRIMITIVE_TOPOLOGY Topology) = 0; + + virtual void STDMETHODCALLTYPE VSSetShaderResources( + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* [annotation] */ + __in_ecount(NumViews) ID3D11ShaderResourceView *const *ppShaderResourceViews) = 0; + + virtual void STDMETHODCALLTYPE VSSetSamplers( + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* [annotation] */ + __in_ecount(NumSamplers) ID3D11SamplerState *const *ppSamplers) = 0; + + virtual void STDMETHODCALLTYPE Begin( + /* [annotation] */ + __in ID3D11Asynchronous *pAsync) = 0; + + virtual void STDMETHODCALLTYPE End( + /* [annotation] */ + __in ID3D11Asynchronous *pAsync) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetData( + /* [annotation] */ + __in ID3D11Asynchronous *pAsync, + /* [annotation] */ + __out_bcount_opt( DataSize ) void *pData, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in UINT GetDataFlags) = 0; + + virtual void STDMETHODCALLTYPE SetPredication( + /* [annotation] */ + __in_opt ID3D11Predicate *pPredicate, + /* [annotation] */ + __in BOOL PredicateValue) = 0; + + virtual void STDMETHODCALLTYPE GSSetShaderResources( + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* [annotation] */ + __in_ecount(NumViews) ID3D11ShaderResourceView *const *ppShaderResourceViews) = 0; + + virtual void STDMETHODCALLTYPE GSSetSamplers( + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* [annotation] */ + __in_ecount(NumSamplers) ID3D11SamplerState *const *ppSamplers) = 0; + + virtual void STDMETHODCALLTYPE OMSetRenderTargets( + /* [annotation] */ + __in_range( 0, D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT ) UINT NumViews, + /* [annotation] */ + __in_ecount_opt(NumViews) ID3D11RenderTargetView *const *ppRenderTargetViews, + /* [annotation] */ + __in_opt ID3D11DepthStencilView *pDepthStencilView) = 0; + + virtual void STDMETHODCALLTYPE OMSetRenderTargetsAndUnorderedAccessViews( + /* [annotation] */ + __in UINT NumRTVs, + /* [annotation] */ + __in_ecount_opt(NumRTVs) ID3D11RenderTargetView *const *ppRenderTargetViews, + /* [annotation] */ + __in_opt ID3D11DepthStencilView *pDepthStencilView, + /* [annotation] */ + __in_range( 0, D3D11_PS_CS_UAV_REGISTER_COUNT - 1 ) UINT UAVStartSlot, + /* [annotation] */ + __in UINT NumUAVs, + /* [annotation] */ + __in_ecount_opt(NumUAVs) ID3D11UnorderedAccessView *const *ppUnorderedAccessViews, + /* [annotation] */ + __in_ecount_opt(NumUAVs) const UINT *pUAVInitialCounts) = 0; + + virtual void STDMETHODCALLTYPE OMSetBlendState( + /* [annotation] */ + __in_opt ID3D11BlendState *pBlendState, + /* [annotation] */ + __in_opt const FLOAT BlendFactor[ 4 ], + /* [annotation] */ + __in UINT SampleMask) = 0; + + virtual void STDMETHODCALLTYPE OMSetDepthStencilState( + /* [annotation] */ + __in_opt ID3D11DepthStencilState *pDepthStencilState, + /* [annotation] */ + __in UINT StencilRef) = 0; + + virtual void STDMETHODCALLTYPE SOSetTargets( + /* [annotation] */ + __in_range( 0, D3D11_SO_BUFFER_SLOT_COUNT) UINT NumBuffers, + /* [annotation] */ + __in_ecount_opt(NumBuffers) ID3D11Buffer *const *ppSOTargets, + /* [annotation] */ + __in_ecount_opt(NumBuffers) const UINT *pOffsets) = 0; + + virtual void STDMETHODCALLTYPE DrawAuto( void) = 0; + + virtual void STDMETHODCALLTYPE DrawIndexedInstancedIndirect( + /* [annotation] */ + __in ID3D11Buffer *pBufferForArgs, + /* [annotation] */ + __in UINT AlignedByteOffsetForArgs) = 0; + + virtual void STDMETHODCALLTYPE DrawInstancedIndirect( + /* [annotation] */ + __in ID3D11Buffer *pBufferForArgs, + /* [annotation] */ + __in UINT AlignedByteOffsetForArgs) = 0; + + virtual void STDMETHODCALLTYPE Dispatch( + /* [annotation] */ + __in UINT ThreadGroupCountX, + /* [annotation] */ + __in UINT ThreadGroupCountY, + /* [annotation] */ + __in UINT ThreadGroupCountZ) = 0; + + virtual void STDMETHODCALLTYPE DispatchIndirect( + /* [annotation] */ + __in ID3D11Buffer *pBufferForArgs, + /* [annotation] */ + __in UINT AlignedByteOffsetForArgs) = 0; + + virtual void STDMETHODCALLTYPE RSSetState( + /* [annotation] */ + __in_opt ID3D11RasterizerState *pRasterizerState) = 0; + + virtual void STDMETHODCALLTYPE RSSetViewports( + /* [annotation] */ + __in_range(0, D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT NumViewports, + /* [annotation] */ + __in_ecount_opt(NumViewports) const D3D11_VIEWPORT *pViewports) = 0; + + virtual void STDMETHODCALLTYPE RSSetScissorRects( + /* [annotation] */ + __in_range(0, D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT NumRects, + /* [annotation] */ + __in_ecount_opt(NumRects) const D3D11_RECT *pRects) = 0; + + virtual void STDMETHODCALLTYPE CopySubresourceRegion( + /* [annotation] */ + __in ID3D11Resource *pDstResource, + /* [annotation] */ + __in UINT DstSubresource, + /* [annotation] */ + __in UINT DstX, + /* [annotation] */ + __in UINT DstY, + /* [annotation] */ + __in UINT DstZ, + /* [annotation] */ + __in ID3D11Resource *pSrcResource, + /* [annotation] */ + __in UINT SrcSubresource, + /* [annotation] */ + __in_opt const D3D11_BOX *pSrcBox) = 0; + + virtual void STDMETHODCALLTYPE CopyResource( + /* [annotation] */ + __in ID3D11Resource *pDstResource, + /* [annotation] */ + __in ID3D11Resource *pSrcResource) = 0; + + virtual void STDMETHODCALLTYPE UpdateSubresource( + /* [annotation] */ + __in ID3D11Resource *pDstResource, + /* [annotation] */ + __in UINT DstSubresource, + /* [annotation] */ + __in_opt const D3D11_BOX *pDstBox, + /* [annotation] */ + __in const void *pSrcData, + /* [annotation] */ + __in UINT SrcRowPitch, + /* [annotation] */ + __in UINT SrcDepthPitch) = 0; + + virtual void STDMETHODCALLTYPE CopyStructureCount( + /* [annotation] */ + __in ID3D11Buffer *pDstBuffer, + /* [annotation] */ + __in UINT DstAlignedByteOffset, + /* [annotation] */ + __in ID3D11UnorderedAccessView *pSrcView) = 0; + + virtual void STDMETHODCALLTYPE ClearRenderTargetView( + /* [annotation] */ + __in ID3D11RenderTargetView *pRenderTargetView, + /* [annotation] */ + __in const FLOAT ColorRGBA[ 4 ]) = 0; + + virtual void STDMETHODCALLTYPE ClearUnorderedAccessViewUint( + /* [annotation] */ + __in ID3D11UnorderedAccessView *pUnorderedAccessView, + /* [annotation] */ + __in const UINT Values[ 4 ]) = 0; + + virtual void STDMETHODCALLTYPE ClearUnorderedAccessViewFloat( + /* [annotation] */ + __in ID3D11UnorderedAccessView *pUnorderedAccessView, + /* [annotation] */ + __in const FLOAT Values[ 4 ]) = 0; + + virtual void STDMETHODCALLTYPE ClearDepthStencilView( + /* [annotation] */ + __in ID3D11DepthStencilView *pDepthStencilView, + /* [annotation] */ + __in UINT ClearFlags, + /* [annotation] */ + __in FLOAT Depth, + /* [annotation] */ + __in UINT8 Stencil) = 0; + + virtual void STDMETHODCALLTYPE GenerateMips( + /* [annotation] */ + __in ID3D11ShaderResourceView *pShaderResourceView) = 0; + + virtual void STDMETHODCALLTYPE SetResourceMinLOD( + /* [annotation] */ + __in ID3D11Resource *pResource, + FLOAT MinLOD) = 0; + + virtual FLOAT STDMETHODCALLTYPE GetResourceMinLOD( + /* [annotation] */ + __in ID3D11Resource *pResource) = 0; + + virtual void STDMETHODCALLTYPE ResolveSubresource( + /* [annotation] */ + __in ID3D11Resource *pDstResource, + /* [annotation] */ + __in UINT DstSubresource, + /* [annotation] */ + __in ID3D11Resource *pSrcResource, + /* [annotation] */ + __in UINT SrcSubresource, + /* [annotation] */ + __in DXGI_FORMAT Format) = 0; + + virtual void STDMETHODCALLTYPE ExecuteCommandList( + /* [annotation] */ + __in ID3D11CommandList *pCommandList, + BOOL RestoreContextState) = 0; + + virtual void STDMETHODCALLTYPE HSSetShaderResources( + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* [annotation] */ + __in_ecount(NumViews) ID3D11ShaderResourceView *const *ppShaderResourceViews) = 0; + + virtual void STDMETHODCALLTYPE HSSetShader( + /* [annotation] */ + __in_opt ID3D11HullShader *pHullShader, + /* [annotation] */ + __in_ecount_opt(NumClassInstances) ID3D11ClassInstance *const *ppClassInstances, + UINT NumClassInstances) = 0; + + virtual void STDMETHODCALLTYPE HSSetSamplers( + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* [annotation] */ + __in_ecount(NumSamplers) ID3D11SamplerState *const *ppSamplers) = 0; + + virtual void STDMETHODCALLTYPE HSSetConstantBuffers( + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + __in_ecount(NumBuffers) ID3D11Buffer *const *ppConstantBuffers) = 0; + + virtual void STDMETHODCALLTYPE DSSetShaderResources( + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* [annotation] */ + __in_ecount(NumViews) ID3D11ShaderResourceView *const *ppShaderResourceViews) = 0; + + virtual void STDMETHODCALLTYPE DSSetShader( + /* [annotation] */ + __in_opt ID3D11DomainShader *pDomainShader, + /* [annotation] */ + __in_ecount_opt(NumClassInstances) ID3D11ClassInstance *const *ppClassInstances, + UINT NumClassInstances) = 0; + + virtual void STDMETHODCALLTYPE DSSetSamplers( + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* [annotation] */ + __in_ecount(NumSamplers) ID3D11SamplerState *const *ppSamplers) = 0; + + virtual void STDMETHODCALLTYPE DSSetConstantBuffers( + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + __in_ecount(NumBuffers) ID3D11Buffer *const *ppConstantBuffers) = 0; + + virtual void STDMETHODCALLTYPE CSSetShaderResources( + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* [annotation] */ + __in_ecount(NumViews) ID3D11ShaderResourceView *const *ppShaderResourceViews) = 0; + + virtual void STDMETHODCALLTYPE CSSetUnorderedAccessViews( + /* [annotation] */ + __in_range( 0, D3D11_PS_CS_UAV_REGISTER_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_PS_CS_UAV_REGISTER_COUNT - StartSlot ) UINT NumUAVs, + /* [annotation] */ + __in_ecount(NumUAVs) ID3D11UnorderedAccessView *const *ppUnorderedAccessViews, + /* [annotation] */ + __in_ecount(NumUAVs) const UINT *pUAVInitialCounts) = 0; + + virtual void STDMETHODCALLTYPE CSSetShader( + /* [annotation] */ + __in_opt ID3D11ComputeShader *pComputeShader, + /* [annotation] */ + __in_ecount_opt(NumClassInstances) ID3D11ClassInstance *const *ppClassInstances, + UINT NumClassInstances) = 0; + + virtual void STDMETHODCALLTYPE CSSetSamplers( + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* [annotation] */ + __in_ecount(NumSamplers) ID3D11SamplerState *const *ppSamplers) = 0; + + virtual void STDMETHODCALLTYPE CSSetConstantBuffers( + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + __in_ecount(NumBuffers) ID3D11Buffer *const *ppConstantBuffers) = 0; + + virtual void STDMETHODCALLTYPE VSGetConstantBuffers( + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + __out_ecount(NumBuffers) ID3D11Buffer **ppConstantBuffers) = 0; + + virtual void STDMETHODCALLTYPE PSGetShaderResources( + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* [annotation] */ + __out_ecount(NumViews) ID3D11ShaderResourceView **ppShaderResourceViews) = 0; + + virtual void STDMETHODCALLTYPE PSGetShader( + /* [annotation] */ + __out ID3D11PixelShader **ppPixelShader, + /* [annotation] */ + __out_ecount_opt(*pNumClassInstances) ID3D11ClassInstance **ppClassInstances, + /* [annotation] */ + __inout_opt UINT *pNumClassInstances) = 0; + + virtual void STDMETHODCALLTYPE PSGetSamplers( + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* [annotation] */ + __out_ecount(NumSamplers) ID3D11SamplerState **ppSamplers) = 0; + + virtual void STDMETHODCALLTYPE VSGetShader( + /* [annotation] */ + __out ID3D11VertexShader **ppVertexShader, + /* [annotation] */ + __out_ecount_opt(*pNumClassInstances) ID3D11ClassInstance **ppClassInstances, + /* [annotation] */ + __inout_opt UINT *pNumClassInstances) = 0; + + virtual void STDMETHODCALLTYPE PSGetConstantBuffers( + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + __out_ecount(NumBuffers) ID3D11Buffer **ppConstantBuffers) = 0; + + virtual void STDMETHODCALLTYPE IAGetInputLayout( + /* [annotation] */ + __out ID3D11InputLayout **ppInputLayout) = 0; + + virtual void STDMETHODCALLTYPE IAGetVertexBuffers( + /* [annotation] */ + __in_range( 0, D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + __out_ecount_opt(NumBuffers) ID3D11Buffer **ppVertexBuffers, + /* [annotation] */ + __out_ecount_opt(NumBuffers) UINT *pStrides, + /* [annotation] */ + __out_ecount_opt(NumBuffers) UINT *pOffsets) = 0; + + virtual void STDMETHODCALLTYPE IAGetIndexBuffer( + /* [annotation] */ + __out_opt ID3D11Buffer **pIndexBuffer, + /* [annotation] */ + __out_opt DXGI_FORMAT *Format, + /* [annotation] */ + __out_opt UINT *Offset) = 0; + + virtual void STDMETHODCALLTYPE GSGetConstantBuffers( + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + __out_ecount(NumBuffers) ID3D11Buffer **ppConstantBuffers) = 0; + + virtual void STDMETHODCALLTYPE GSGetShader( + /* [annotation] */ + __out ID3D11GeometryShader **ppGeometryShader, + /* [annotation] */ + __out_ecount_opt(*pNumClassInstances) ID3D11ClassInstance **ppClassInstances, + /* [annotation] */ + __inout_opt UINT *pNumClassInstances) = 0; + + virtual void STDMETHODCALLTYPE IAGetPrimitiveTopology( + /* [annotation] */ + __out D3D11_PRIMITIVE_TOPOLOGY *pTopology) = 0; + + virtual void STDMETHODCALLTYPE VSGetShaderResources( + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* [annotation] */ + __out_ecount(NumViews) ID3D11ShaderResourceView **ppShaderResourceViews) = 0; + + virtual void STDMETHODCALLTYPE VSGetSamplers( + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* [annotation] */ + __out_ecount(NumSamplers) ID3D11SamplerState **ppSamplers) = 0; + + virtual void STDMETHODCALLTYPE GetPredication( + /* [annotation] */ + __out_opt ID3D11Predicate **ppPredicate, + /* [annotation] */ + __out_opt BOOL *pPredicateValue) = 0; + + virtual void STDMETHODCALLTYPE GSGetShaderResources( + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* [annotation] */ + __out_ecount(NumViews) ID3D11ShaderResourceView **ppShaderResourceViews) = 0; + + virtual void STDMETHODCALLTYPE GSGetSamplers( + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* [annotation] */ + __out_ecount(NumSamplers) ID3D11SamplerState **ppSamplers) = 0; + + virtual void STDMETHODCALLTYPE OMGetRenderTargets( + /* [annotation] */ + __in_range( 0, D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT ) UINT NumViews, + /* [annotation] */ + __out_ecount_opt(NumViews) ID3D11RenderTargetView **ppRenderTargetViews, + /* [annotation] */ + __out_opt ID3D11DepthStencilView **ppDepthStencilView) = 0; + + virtual void STDMETHODCALLTYPE OMGetRenderTargetsAndUnorderedAccessViews( + /* [annotation] */ + __in_range( 0, D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT ) UINT NumRTVs, + /* [annotation] */ + __out_ecount_opt(NumRTVs) ID3D11RenderTargetView **ppRenderTargetViews, + /* [annotation] */ + __out_opt ID3D11DepthStencilView **ppDepthStencilView, + /* [annotation] */ + __in_range( 0, D3D11_PS_CS_UAV_REGISTER_COUNT - 1 ) UINT UAVStartSlot, + /* [annotation] */ + __in_range( 0, D3D11_PS_CS_UAV_REGISTER_COUNT - UAVStartSlot ) UINT NumUAVs, + /* [annotation] */ + __out_ecount_opt(NumUAVs) ID3D11UnorderedAccessView **ppUnorderedAccessViews) = 0; + + virtual void STDMETHODCALLTYPE OMGetBlendState( + /* [annotation] */ + __out_opt ID3D11BlendState **ppBlendState, + /* [annotation] */ + __out_opt FLOAT BlendFactor[ 4 ], + /* [annotation] */ + __out_opt UINT *pSampleMask) = 0; + + virtual void STDMETHODCALLTYPE OMGetDepthStencilState( + /* [annotation] */ + __out_opt ID3D11DepthStencilState **ppDepthStencilState, + /* [annotation] */ + __out_opt UINT *pStencilRef) = 0; + + virtual void STDMETHODCALLTYPE SOGetTargets( + /* [annotation] */ + __in_range( 0, D3D11_SO_BUFFER_SLOT_COUNT ) UINT NumBuffers, + /* [annotation] */ + __out_ecount(NumBuffers) ID3D11Buffer **ppSOTargets) = 0; + + virtual void STDMETHODCALLTYPE RSGetState( + /* [annotation] */ + __out ID3D11RasterizerState **ppRasterizerState) = 0; + + virtual void STDMETHODCALLTYPE RSGetViewports( + /* [annotation] */ + __inout /*_range(0, D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE )*/ UINT *pNumViewports, + /* [annotation] */ + __out_ecount_opt(*pNumViewports) D3D11_VIEWPORT *pViewports) = 0; + + virtual void STDMETHODCALLTYPE RSGetScissorRects( + /* [annotation] */ + __inout /*_range(0, D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE )*/ UINT *pNumRects, + /* [annotation] */ + __out_ecount_opt(*pNumRects) D3D11_RECT *pRects) = 0; + + virtual void STDMETHODCALLTYPE HSGetShaderResources( + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* [annotation] */ + __out_ecount(NumViews) ID3D11ShaderResourceView **ppShaderResourceViews) = 0; + + virtual void STDMETHODCALLTYPE HSGetShader( + /* [annotation] */ + __out ID3D11HullShader **ppHullShader, + /* [annotation] */ + __out_ecount_opt(*pNumClassInstances) ID3D11ClassInstance **ppClassInstances, + /* [annotation] */ + __inout_opt UINT *pNumClassInstances) = 0; + + virtual void STDMETHODCALLTYPE HSGetSamplers( + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* [annotation] */ + __out_ecount(NumSamplers) ID3D11SamplerState **ppSamplers) = 0; + + virtual void STDMETHODCALLTYPE HSGetConstantBuffers( + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + __out_ecount(NumBuffers) ID3D11Buffer **ppConstantBuffers) = 0; + + virtual void STDMETHODCALLTYPE DSGetShaderResources( + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* [annotation] */ + __out_ecount(NumViews) ID3D11ShaderResourceView **ppShaderResourceViews) = 0; + + virtual void STDMETHODCALLTYPE DSGetShader( + /* [annotation] */ + __out ID3D11DomainShader **ppDomainShader, + /* [annotation] */ + __out_ecount_opt(*pNumClassInstances) ID3D11ClassInstance **ppClassInstances, + /* [annotation] */ + __inout_opt UINT *pNumClassInstances) = 0; + + virtual void STDMETHODCALLTYPE DSGetSamplers( + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* [annotation] */ + __out_ecount(NumSamplers) ID3D11SamplerState **ppSamplers) = 0; + + virtual void STDMETHODCALLTYPE DSGetConstantBuffers( + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + __out_ecount(NumBuffers) ID3D11Buffer **ppConstantBuffers) = 0; + + virtual void STDMETHODCALLTYPE CSGetShaderResources( + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* [annotation] */ + __out_ecount(NumViews) ID3D11ShaderResourceView **ppShaderResourceViews) = 0; + + virtual void STDMETHODCALLTYPE CSGetUnorderedAccessViews( + /* [annotation] */ + __in_range( 0, D3D11_PS_CS_UAV_REGISTER_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_PS_CS_UAV_REGISTER_COUNT - StartSlot ) UINT NumUAVs, + /* [annotation] */ + __out_ecount(NumUAVs) ID3D11UnorderedAccessView **ppUnorderedAccessViews) = 0; + + virtual void STDMETHODCALLTYPE CSGetShader( + /* [annotation] */ + __out ID3D11ComputeShader **ppComputeShader, + /* [annotation] */ + __out_ecount_opt(*pNumClassInstances) ID3D11ClassInstance **ppClassInstances, + /* [annotation] */ + __inout_opt UINT *pNumClassInstances) = 0; + + virtual void STDMETHODCALLTYPE CSGetSamplers( + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* [annotation] */ + __out_ecount(NumSamplers) ID3D11SamplerState **ppSamplers) = 0; + + virtual void STDMETHODCALLTYPE CSGetConstantBuffers( + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + __out_ecount(NumBuffers) ID3D11Buffer **ppConstantBuffers) = 0; + + virtual void STDMETHODCALLTYPE ClearState( void) = 0; + + virtual void STDMETHODCALLTYPE Flush( void) = 0; + + virtual D3D11_DEVICE_CONTEXT_TYPE STDMETHODCALLTYPE GetType( void) = 0; + + virtual UINT STDMETHODCALLTYPE GetContextFlags( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE FinishCommandList( + BOOL RestoreDeferredContextState, + /* [annotation] */ + __out_opt ID3D11CommandList **ppCommandList) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D11DeviceContextVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D11DeviceContext * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D11DeviceContext * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D11DeviceContext * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D11DeviceContext * This, + /* [annotation] */ + __out ID3D11Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData); + + void ( STDMETHODCALLTYPE *VSSetConstantBuffers )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + __in_ecount(NumBuffers) ID3D11Buffer *const *ppConstantBuffers); + + void ( STDMETHODCALLTYPE *PSSetShaderResources )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* [annotation] */ + __in_ecount(NumViews) ID3D11ShaderResourceView *const *ppShaderResourceViews); + + void ( STDMETHODCALLTYPE *PSSetShader )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in_opt ID3D11PixelShader *pPixelShader, + /* [annotation] */ + __in_ecount_opt(NumClassInstances) ID3D11ClassInstance *const *ppClassInstances, + UINT NumClassInstances); + + void ( STDMETHODCALLTYPE *PSSetSamplers )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* [annotation] */ + __in_ecount(NumSamplers) ID3D11SamplerState *const *ppSamplers); + + void ( STDMETHODCALLTYPE *VSSetShader )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in_opt ID3D11VertexShader *pVertexShader, + /* [annotation] */ + __in_ecount_opt(NumClassInstances) ID3D11ClassInstance *const *ppClassInstances, + UINT NumClassInstances); + + void ( STDMETHODCALLTYPE *DrawIndexed )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in UINT IndexCount, + /* [annotation] */ + __in UINT StartIndexLocation, + /* [annotation] */ + __in INT BaseVertexLocation); + + void ( STDMETHODCALLTYPE *Draw )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in UINT VertexCount, + /* [annotation] */ + __in UINT StartVertexLocation); + + HRESULT ( STDMETHODCALLTYPE *Map )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in ID3D11Resource *pResource, + /* [annotation] */ + __in UINT Subresource, + /* [annotation] */ + __in D3D11_MAP MapType, + /* [annotation] */ + __in UINT MapFlags, + /* [annotation] */ + __out D3D11_MAPPED_SUBRESOURCE *pMappedResource); + + void ( STDMETHODCALLTYPE *Unmap )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in ID3D11Resource *pResource, + /* [annotation] */ + __in UINT Subresource); + + void ( STDMETHODCALLTYPE *PSSetConstantBuffers )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + __in_ecount(NumBuffers) ID3D11Buffer *const *ppConstantBuffers); + + void ( STDMETHODCALLTYPE *IASetInputLayout )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in_opt ID3D11InputLayout *pInputLayout); + + void ( STDMETHODCALLTYPE *IASetVertexBuffers )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in_range( 0, D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + __in_ecount(NumBuffers) ID3D11Buffer *const *ppVertexBuffers, + /* [annotation] */ + __in_ecount(NumBuffers) const UINT *pStrides, + /* [annotation] */ + __in_ecount(NumBuffers) const UINT *pOffsets); + + void ( STDMETHODCALLTYPE *IASetIndexBuffer )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in_opt ID3D11Buffer *pIndexBuffer, + /* [annotation] */ + __in DXGI_FORMAT Format, + /* [annotation] */ + __in UINT Offset); + + void ( STDMETHODCALLTYPE *DrawIndexedInstanced )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in UINT IndexCountPerInstance, + /* [annotation] */ + __in UINT InstanceCount, + /* [annotation] */ + __in UINT StartIndexLocation, + /* [annotation] */ + __in INT BaseVertexLocation, + /* [annotation] */ + __in UINT StartInstanceLocation); + + void ( STDMETHODCALLTYPE *DrawInstanced )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in UINT VertexCountPerInstance, + /* [annotation] */ + __in UINT InstanceCount, + /* [annotation] */ + __in UINT StartVertexLocation, + /* [annotation] */ + __in UINT StartInstanceLocation); + + void ( STDMETHODCALLTYPE *GSSetConstantBuffers )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + __in_ecount(NumBuffers) ID3D11Buffer *const *ppConstantBuffers); + + void ( STDMETHODCALLTYPE *GSSetShader )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in_opt ID3D11GeometryShader *pShader, + /* [annotation] */ + __in_ecount_opt(NumClassInstances) ID3D11ClassInstance *const *ppClassInstances, + UINT NumClassInstances); + + void ( STDMETHODCALLTYPE *IASetPrimitiveTopology )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in D3D11_PRIMITIVE_TOPOLOGY Topology); + + void ( STDMETHODCALLTYPE *VSSetShaderResources )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* [annotation] */ + __in_ecount(NumViews) ID3D11ShaderResourceView *const *ppShaderResourceViews); + + void ( STDMETHODCALLTYPE *VSSetSamplers )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* [annotation] */ + __in_ecount(NumSamplers) ID3D11SamplerState *const *ppSamplers); + + void ( STDMETHODCALLTYPE *Begin )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in ID3D11Asynchronous *pAsync); + + void ( STDMETHODCALLTYPE *End )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in ID3D11Asynchronous *pAsync); + + HRESULT ( STDMETHODCALLTYPE *GetData )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in ID3D11Asynchronous *pAsync, + /* [annotation] */ + __out_bcount_opt( DataSize ) void *pData, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in UINT GetDataFlags); + + void ( STDMETHODCALLTYPE *SetPredication )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in_opt ID3D11Predicate *pPredicate, + /* [annotation] */ + __in BOOL PredicateValue); + + void ( STDMETHODCALLTYPE *GSSetShaderResources )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* [annotation] */ + __in_ecount(NumViews) ID3D11ShaderResourceView *const *ppShaderResourceViews); + + void ( STDMETHODCALLTYPE *GSSetSamplers )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* [annotation] */ + __in_ecount(NumSamplers) ID3D11SamplerState *const *ppSamplers); + + void ( STDMETHODCALLTYPE *OMSetRenderTargets )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in_range( 0, D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT ) UINT NumViews, + /* [annotation] */ + __in_ecount_opt(NumViews) ID3D11RenderTargetView *const *ppRenderTargetViews, + /* [annotation] */ + __in_opt ID3D11DepthStencilView *pDepthStencilView); + + void ( STDMETHODCALLTYPE *OMSetRenderTargetsAndUnorderedAccessViews )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in UINT NumRTVs, + /* [annotation] */ + __in_ecount_opt(NumRTVs) ID3D11RenderTargetView *const *ppRenderTargetViews, + /* [annotation] */ + __in_opt ID3D11DepthStencilView *pDepthStencilView, + /* [annotation] */ + __in_range( 0, D3D11_PS_CS_UAV_REGISTER_COUNT - 1 ) UINT UAVStartSlot, + /* [annotation] */ + __in UINT NumUAVs, + /* [annotation] */ + __in_ecount_opt(NumUAVs) ID3D11UnorderedAccessView *const *ppUnorderedAccessViews, + /* [annotation] */ + __in_ecount_opt(NumUAVs) const UINT *pUAVInitialCounts); + + void ( STDMETHODCALLTYPE *OMSetBlendState )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in_opt ID3D11BlendState *pBlendState, + /* [annotation] */ + __in_opt const FLOAT BlendFactor[ 4 ], + /* [annotation] */ + __in UINT SampleMask); + + void ( STDMETHODCALLTYPE *OMSetDepthStencilState )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in_opt ID3D11DepthStencilState *pDepthStencilState, + /* [annotation] */ + __in UINT StencilRef); + + void ( STDMETHODCALLTYPE *SOSetTargets )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in_range( 0, D3D11_SO_BUFFER_SLOT_COUNT) UINT NumBuffers, + /* [annotation] */ + __in_ecount_opt(NumBuffers) ID3D11Buffer *const *ppSOTargets, + /* [annotation] */ + __in_ecount_opt(NumBuffers) const UINT *pOffsets); + + void ( STDMETHODCALLTYPE *DrawAuto )( + ID3D11DeviceContext * This); + + void ( STDMETHODCALLTYPE *DrawIndexedInstancedIndirect )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in ID3D11Buffer *pBufferForArgs, + /* [annotation] */ + __in UINT AlignedByteOffsetForArgs); + + void ( STDMETHODCALLTYPE *DrawInstancedIndirect )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in ID3D11Buffer *pBufferForArgs, + /* [annotation] */ + __in UINT AlignedByteOffsetForArgs); + + void ( STDMETHODCALLTYPE *Dispatch )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in UINT ThreadGroupCountX, + /* [annotation] */ + __in UINT ThreadGroupCountY, + /* [annotation] */ + __in UINT ThreadGroupCountZ); + + void ( STDMETHODCALLTYPE *DispatchIndirect )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in ID3D11Buffer *pBufferForArgs, + /* [annotation] */ + __in UINT AlignedByteOffsetForArgs); + + void ( STDMETHODCALLTYPE *RSSetState )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in_opt ID3D11RasterizerState *pRasterizerState); + + void ( STDMETHODCALLTYPE *RSSetViewports )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in_range(0, D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT NumViewports, + /* [annotation] */ + __in_ecount_opt(NumViewports) const D3D11_VIEWPORT *pViewports); + + void ( STDMETHODCALLTYPE *RSSetScissorRects )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in_range(0, D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT NumRects, + /* [annotation] */ + __in_ecount_opt(NumRects) const D3D11_RECT *pRects); + + void ( STDMETHODCALLTYPE *CopySubresourceRegion )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in ID3D11Resource *pDstResource, + /* [annotation] */ + __in UINT DstSubresource, + /* [annotation] */ + __in UINT DstX, + /* [annotation] */ + __in UINT DstY, + /* [annotation] */ + __in UINT DstZ, + /* [annotation] */ + __in ID3D11Resource *pSrcResource, + /* [annotation] */ + __in UINT SrcSubresource, + /* [annotation] */ + __in_opt const D3D11_BOX *pSrcBox); + + void ( STDMETHODCALLTYPE *CopyResource )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in ID3D11Resource *pDstResource, + /* [annotation] */ + __in ID3D11Resource *pSrcResource); + + void ( STDMETHODCALLTYPE *UpdateSubresource )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in ID3D11Resource *pDstResource, + /* [annotation] */ + __in UINT DstSubresource, + /* [annotation] */ + __in_opt const D3D11_BOX *pDstBox, + /* [annotation] */ + __in const void *pSrcData, + /* [annotation] */ + __in UINT SrcRowPitch, + /* [annotation] */ + __in UINT SrcDepthPitch); + + void ( STDMETHODCALLTYPE *CopyStructureCount )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in ID3D11Buffer *pDstBuffer, + /* [annotation] */ + __in UINT DstAlignedByteOffset, + /* [annotation] */ + __in ID3D11UnorderedAccessView *pSrcView); + + void ( STDMETHODCALLTYPE *ClearRenderTargetView )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in ID3D11RenderTargetView *pRenderTargetView, + /* [annotation] */ + __in const FLOAT ColorRGBA[ 4 ]); + + void ( STDMETHODCALLTYPE *ClearUnorderedAccessViewUint )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in ID3D11UnorderedAccessView *pUnorderedAccessView, + /* [annotation] */ + __in const UINT Values[ 4 ]); + + void ( STDMETHODCALLTYPE *ClearUnorderedAccessViewFloat )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in ID3D11UnorderedAccessView *pUnorderedAccessView, + /* [annotation] */ + __in const FLOAT Values[ 4 ]); + + void ( STDMETHODCALLTYPE *ClearDepthStencilView )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in ID3D11DepthStencilView *pDepthStencilView, + /* [annotation] */ + __in UINT ClearFlags, + /* [annotation] */ + __in FLOAT Depth, + /* [annotation] */ + __in UINT8 Stencil); + + void ( STDMETHODCALLTYPE *GenerateMips )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in ID3D11ShaderResourceView *pShaderResourceView); + + void ( STDMETHODCALLTYPE *SetResourceMinLOD )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in ID3D11Resource *pResource, + FLOAT MinLOD); + + FLOAT ( STDMETHODCALLTYPE *GetResourceMinLOD )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in ID3D11Resource *pResource); + + void ( STDMETHODCALLTYPE *ResolveSubresource )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in ID3D11Resource *pDstResource, + /* [annotation] */ + __in UINT DstSubresource, + /* [annotation] */ + __in ID3D11Resource *pSrcResource, + /* [annotation] */ + __in UINT SrcSubresource, + /* [annotation] */ + __in DXGI_FORMAT Format); + + void ( STDMETHODCALLTYPE *ExecuteCommandList )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in ID3D11CommandList *pCommandList, + BOOL RestoreContextState); + + void ( STDMETHODCALLTYPE *HSSetShaderResources )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* [annotation] */ + __in_ecount(NumViews) ID3D11ShaderResourceView *const *ppShaderResourceViews); + + void ( STDMETHODCALLTYPE *HSSetShader )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in_opt ID3D11HullShader *pHullShader, + /* [annotation] */ + __in_ecount_opt(NumClassInstances) ID3D11ClassInstance *const *ppClassInstances, + UINT NumClassInstances); + + void ( STDMETHODCALLTYPE *HSSetSamplers )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* [annotation] */ + __in_ecount(NumSamplers) ID3D11SamplerState *const *ppSamplers); + + void ( STDMETHODCALLTYPE *HSSetConstantBuffers )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + __in_ecount(NumBuffers) ID3D11Buffer *const *ppConstantBuffers); + + void ( STDMETHODCALLTYPE *DSSetShaderResources )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* [annotation] */ + __in_ecount(NumViews) ID3D11ShaderResourceView *const *ppShaderResourceViews); + + void ( STDMETHODCALLTYPE *DSSetShader )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in_opt ID3D11DomainShader *pDomainShader, + /* [annotation] */ + __in_ecount_opt(NumClassInstances) ID3D11ClassInstance *const *ppClassInstances, + UINT NumClassInstances); + + void ( STDMETHODCALLTYPE *DSSetSamplers )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* [annotation] */ + __in_ecount(NumSamplers) ID3D11SamplerState *const *ppSamplers); + + void ( STDMETHODCALLTYPE *DSSetConstantBuffers )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + __in_ecount(NumBuffers) ID3D11Buffer *const *ppConstantBuffers); + + void ( STDMETHODCALLTYPE *CSSetShaderResources )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* [annotation] */ + __in_ecount(NumViews) ID3D11ShaderResourceView *const *ppShaderResourceViews); + + void ( STDMETHODCALLTYPE *CSSetUnorderedAccessViews )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in_range( 0, D3D11_PS_CS_UAV_REGISTER_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_PS_CS_UAV_REGISTER_COUNT - StartSlot ) UINT NumUAVs, + /* [annotation] */ + __in_ecount(NumUAVs) ID3D11UnorderedAccessView *const *ppUnorderedAccessViews, + /* [annotation] */ + __in_ecount(NumUAVs) const UINT *pUAVInitialCounts); + + void ( STDMETHODCALLTYPE *CSSetShader )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in_opt ID3D11ComputeShader *pComputeShader, + /* [annotation] */ + __in_ecount_opt(NumClassInstances) ID3D11ClassInstance *const *ppClassInstances, + UINT NumClassInstances); + + void ( STDMETHODCALLTYPE *CSSetSamplers )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* [annotation] */ + __in_ecount(NumSamplers) ID3D11SamplerState *const *ppSamplers); + + void ( STDMETHODCALLTYPE *CSSetConstantBuffers )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + __in_ecount(NumBuffers) ID3D11Buffer *const *ppConstantBuffers); + + void ( STDMETHODCALLTYPE *VSGetConstantBuffers )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + __out_ecount(NumBuffers) ID3D11Buffer **ppConstantBuffers); + + void ( STDMETHODCALLTYPE *PSGetShaderResources )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* [annotation] */ + __out_ecount(NumViews) ID3D11ShaderResourceView **ppShaderResourceViews); + + void ( STDMETHODCALLTYPE *PSGetShader )( + ID3D11DeviceContext * This, + /* [annotation] */ + __out ID3D11PixelShader **ppPixelShader, + /* [annotation] */ + __out_ecount_opt(*pNumClassInstances) ID3D11ClassInstance **ppClassInstances, + /* [annotation] */ + __inout_opt UINT *pNumClassInstances); + + void ( STDMETHODCALLTYPE *PSGetSamplers )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* [annotation] */ + __out_ecount(NumSamplers) ID3D11SamplerState **ppSamplers); + + void ( STDMETHODCALLTYPE *VSGetShader )( + ID3D11DeviceContext * This, + /* [annotation] */ + __out ID3D11VertexShader **ppVertexShader, + /* [annotation] */ + __out_ecount_opt(*pNumClassInstances) ID3D11ClassInstance **ppClassInstances, + /* [annotation] */ + __inout_opt UINT *pNumClassInstances); + + void ( STDMETHODCALLTYPE *PSGetConstantBuffers )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + __out_ecount(NumBuffers) ID3D11Buffer **ppConstantBuffers); + + void ( STDMETHODCALLTYPE *IAGetInputLayout )( + ID3D11DeviceContext * This, + /* [annotation] */ + __out ID3D11InputLayout **ppInputLayout); + + void ( STDMETHODCALLTYPE *IAGetVertexBuffers )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in_range( 0, D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + __out_ecount_opt(NumBuffers) ID3D11Buffer **ppVertexBuffers, + /* [annotation] */ + __out_ecount_opt(NumBuffers) UINT *pStrides, + /* [annotation] */ + __out_ecount_opt(NumBuffers) UINT *pOffsets); + + void ( STDMETHODCALLTYPE *IAGetIndexBuffer )( + ID3D11DeviceContext * This, + /* [annotation] */ + __out_opt ID3D11Buffer **pIndexBuffer, + /* [annotation] */ + __out_opt DXGI_FORMAT *Format, + /* [annotation] */ + __out_opt UINT *Offset); + + void ( STDMETHODCALLTYPE *GSGetConstantBuffers )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + __out_ecount(NumBuffers) ID3D11Buffer **ppConstantBuffers); + + void ( STDMETHODCALLTYPE *GSGetShader )( + ID3D11DeviceContext * This, + /* [annotation] */ + __out ID3D11GeometryShader **ppGeometryShader, + /* [annotation] */ + __out_ecount_opt(*pNumClassInstances) ID3D11ClassInstance **ppClassInstances, + /* [annotation] */ + __inout_opt UINT *pNumClassInstances); + + void ( STDMETHODCALLTYPE *IAGetPrimitiveTopology )( + ID3D11DeviceContext * This, + /* [annotation] */ + __out D3D11_PRIMITIVE_TOPOLOGY *pTopology); + + void ( STDMETHODCALLTYPE *VSGetShaderResources )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* [annotation] */ + __out_ecount(NumViews) ID3D11ShaderResourceView **ppShaderResourceViews); + + void ( STDMETHODCALLTYPE *VSGetSamplers )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* [annotation] */ + __out_ecount(NumSamplers) ID3D11SamplerState **ppSamplers); + + void ( STDMETHODCALLTYPE *GetPredication )( + ID3D11DeviceContext * This, + /* [annotation] */ + __out_opt ID3D11Predicate **ppPredicate, + /* [annotation] */ + __out_opt BOOL *pPredicateValue); + + void ( STDMETHODCALLTYPE *GSGetShaderResources )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* [annotation] */ + __out_ecount(NumViews) ID3D11ShaderResourceView **ppShaderResourceViews); + + void ( STDMETHODCALLTYPE *GSGetSamplers )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* [annotation] */ + __out_ecount(NumSamplers) ID3D11SamplerState **ppSamplers); + + void ( STDMETHODCALLTYPE *OMGetRenderTargets )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in_range( 0, D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT ) UINT NumViews, + /* [annotation] */ + __out_ecount_opt(NumViews) ID3D11RenderTargetView **ppRenderTargetViews, + /* [annotation] */ + __out_opt ID3D11DepthStencilView **ppDepthStencilView); + + void ( STDMETHODCALLTYPE *OMGetRenderTargetsAndUnorderedAccessViews )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in_range( 0, D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT ) UINT NumRTVs, + /* [annotation] */ + __out_ecount_opt(NumRTVs) ID3D11RenderTargetView **ppRenderTargetViews, + /* [annotation] */ + __out_opt ID3D11DepthStencilView **ppDepthStencilView, + /* [annotation] */ + __in_range( 0, D3D11_PS_CS_UAV_REGISTER_COUNT - 1 ) UINT UAVStartSlot, + /* [annotation] */ + __in_range( 0, D3D11_PS_CS_UAV_REGISTER_COUNT - UAVStartSlot ) UINT NumUAVs, + /* [annotation] */ + __out_ecount_opt(NumUAVs) ID3D11UnorderedAccessView **ppUnorderedAccessViews); + + void ( STDMETHODCALLTYPE *OMGetBlendState )( + ID3D11DeviceContext * This, + /* [annotation] */ + __out_opt ID3D11BlendState **ppBlendState, + /* [annotation] */ + __out_opt FLOAT BlendFactor[ 4 ], + /* [annotation] */ + __out_opt UINT *pSampleMask); + + void ( STDMETHODCALLTYPE *OMGetDepthStencilState )( + ID3D11DeviceContext * This, + /* [annotation] */ + __out_opt ID3D11DepthStencilState **ppDepthStencilState, + /* [annotation] */ + __out_opt UINT *pStencilRef); + + void ( STDMETHODCALLTYPE *SOGetTargets )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in_range( 0, D3D11_SO_BUFFER_SLOT_COUNT ) UINT NumBuffers, + /* [annotation] */ + __out_ecount(NumBuffers) ID3D11Buffer **ppSOTargets); + + void ( STDMETHODCALLTYPE *RSGetState )( + ID3D11DeviceContext * This, + /* [annotation] */ + __out ID3D11RasterizerState **ppRasterizerState); + + void ( STDMETHODCALLTYPE *RSGetViewports )( + ID3D11DeviceContext * This, + /* [annotation] */ + __inout /*_range(0, D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE )*/ UINT *pNumViewports, + /* [annotation] */ + __out_ecount_opt(*pNumViewports) D3D11_VIEWPORT *pViewports); + + void ( STDMETHODCALLTYPE *RSGetScissorRects )( + ID3D11DeviceContext * This, + /* [annotation] */ + __inout /*_range(0, D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE )*/ UINT *pNumRects, + /* [annotation] */ + __out_ecount_opt(*pNumRects) D3D11_RECT *pRects); + + void ( STDMETHODCALLTYPE *HSGetShaderResources )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* [annotation] */ + __out_ecount(NumViews) ID3D11ShaderResourceView **ppShaderResourceViews); + + void ( STDMETHODCALLTYPE *HSGetShader )( + ID3D11DeviceContext * This, + /* [annotation] */ + __out ID3D11HullShader **ppHullShader, + /* [annotation] */ + __out_ecount_opt(*pNumClassInstances) ID3D11ClassInstance **ppClassInstances, + /* [annotation] */ + __inout_opt UINT *pNumClassInstances); + + void ( STDMETHODCALLTYPE *HSGetSamplers )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* [annotation] */ + __out_ecount(NumSamplers) ID3D11SamplerState **ppSamplers); + + void ( STDMETHODCALLTYPE *HSGetConstantBuffers )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + __out_ecount(NumBuffers) ID3D11Buffer **ppConstantBuffers); + + void ( STDMETHODCALLTYPE *DSGetShaderResources )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* [annotation] */ + __out_ecount(NumViews) ID3D11ShaderResourceView **ppShaderResourceViews); + + void ( STDMETHODCALLTYPE *DSGetShader )( + ID3D11DeviceContext * This, + /* [annotation] */ + __out ID3D11DomainShader **ppDomainShader, + /* [annotation] */ + __out_ecount_opt(*pNumClassInstances) ID3D11ClassInstance **ppClassInstances, + /* [annotation] */ + __inout_opt UINT *pNumClassInstances); + + void ( STDMETHODCALLTYPE *DSGetSamplers )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* [annotation] */ + __out_ecount(NumSamplers) ID3D11SamplerState **ppSamplers); + + void ( STDMETHODCALLTYPE *DSGetConstantBuffers )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + __out_ecount(NumBuffers) ID3D11Buffer **ppConstantBuffers); + + void ( STDMETHODCALLTYPE *CSGetShaderResources )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* [annotation] */ + __out_ecount(NumViews) ID3D11ShaderResourceView **ppShaderResourceViews); + + void ( STDMETHODCALLTYPE *CSGetUnorderedAccessViews )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in_range( 0, D3D11_PS_CS_UAV_REGISTER_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_PS_CS_UAV_REGISTER_COUNT - StartSlot ) UINT NumUAVs, + /* [annotation] */ + __out_ecount(NumUAVs) ID3D11UnorderedAccessView **ppUnorderedAccessViews); + + void ( STDMETHODCALLTYPE *CSGetShader )( + ID3D11DeviceContext * This, + /* [annotation] */ + __out ID3D11ComputeShader **ppComputeShader, + /* [annotation] */ + __out_ecount_opt(*pNumClassInstances) ID3D11ClassInstance **ppClassInstances, + /* [annotation] */ + __inout_opt UINT *pNumClassInstances); + + void ( STDMETHODCALLTYPE *CSGetSamplers )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* [annotation] */ + __out_ecount(NumSamplers) ID3D11SamplerState **ppSamplers); + + void ( STDMETHODCALLTYPE *CSGetConstantBuffers )( + ID3D11DeviceContext * This, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + __in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + __out_ecount(NumBuffers) ID3D11Buffer **ppConstantBuffers); + + void ( STDMETHODCALLTYPE *ClearState )( + ID3D11DeviceContext * This); + + void ( STDMETHODCALLTYPE *Flush )( + ID3D11DeviceContext * This); + + D3D11_DEVICE_CONTEXT_TYPE ( STDMETHODCALLTYPE *GetType )( + ID3D11DeviceContext * This); + + UINT ( STDMETHODCALLTYPE *GetContextFlags )( + ID3D11DeviceContext * This); + + HRESULT ( STDMETHODCALLTYPE *FinishCommandList )( + ID3D11DeviceContext * This, + BOOL RestoreDeferredContextState, + /* [annotation] */ + __out_opt ID3D11CommandList **ppCommandList); + + END_INTERFACE + } ID3D11DeviceContextVtbl; + + interface ID3D11DeviceContext + { + CONST_VTBL struct ID3D11DeviceContextVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D11DeviceContext_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D11DeviceContext_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D11DeviceContext_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D11DeviceContext_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D11DeviceContext_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D11DeviceContext_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D11DeviceContext_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D11DeviceContext_VSSetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) \ + ( (This)->lpVtbl -> VSSetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) ) + +#define ID3D11DeviceContext_PSSetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) \ + ( (This)->lpVtbl -> PSSetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) ) + +#define ID3D11DeviceContext_PSSetShader(This,pPixelShader,ppClassInstances,NumClassInstances) \ + ( (This)->lpVtbl -> PSSetShader(This,pPixelShader,ppClassInstances,NumClassInstances) ) + +#define ID3D11DeviceContext_PSSetSamplers(This,StartSlot,NumSamplers,ppSamplers) \ + ( (This)->lpVtbl -> PSSetSamplers(This,StartSlot,NumSamplers,ppSamplers) ) + +#define ID3D11DeviceContext_VSSetShader(This,pVertexShader,ppClassInstances,NumClassInstances) \ + ( (This)->lpVtbl -> VSSetShader(This,pVertexShader,ppClassInstances,NumClassInstances) ) + +#define ID3D11DeviceContext_DrawIndexed(This,IndexCount,StartIndexLocation,BaseVertexLocation) \ + ( (This)->lpVtbl -> DrawIndexed(This,IndexCount,StartIndexLocation,BaseVertexLocation) ) + +#define ID3D11DeviceContext_Draw(This,VertexCount,StartVertexLocation) \ + ( (This)->lpVtbl -> Draw(This,VertexCount,StartVertexLocation) ) + +#define ID3D11DeviceContext_Map(This,pResource,Subresource,MapType,MapFlags,pMappedResource) \ + ( (This)->lpVtbl -> Map(This,pResource,Subresource,MapType,MapFlags,pMappedResource) ) + +#define ID3D11DeviceContext_Unmap(This,pResource,Subresource) \ + ( (This)->lpVtbl -> Unmap(This,pResource,Subresource) ) + +#define ID3D11DeviceContext_PSSetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) \ + ( (This)->lpVtbl -> PSSetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) ) + +#define ID3D11DeviceContext_IASetInputLayout(This,pInputLayout) \ + ( (This)->lpVtbl -> IASetInputLayout(This,pInputLayout) ) + +#define ID3D11DeviceContext_IASetVertexBuffers(This,StartSlot,NumBuffers,ppVertexBuffers,pStrides,pOffsets) \ + ( (This)->lpVtbl -> IASetVertexBuffers(This,StartSlot,NumBuffers,ppVertexBuffers,pStrides,pOffsets) ) + +#define ID3D11DeviceContext_IASetIndexBuffer(This,pIndexBuffer,Format,Offset) \ + ( (This)->lpVtbl -> IASetIndexBuffer(This,pIndexBuffer,Format,Offset) ) + +#define ID3D11DeviceContext_DrawIndexedInstanced(This,IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) \ + ( (This)->lpVtbl -> DrawIndexedInstanced(This,IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) ) + +#define ID3D11DeviceContext_DrawInstanced(This,VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) \ + ( (This)->lpVtbl -> DrawInstanced(This,VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) ) + +#define ID3D11DeviceContext_GSSetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) \ + ( (This)->lpVtbl -> GSSetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) ) + +#define ID3D11DeviceContext_GSSetShader(This,pShader,ppClassInstances,NumClassInstances) \ + ( (This)->lpVtbl -> GSSetShader(This,pShader,ppClassInstances,NumClassInstances) ) + +#define ID3D11DeviceContext_IASetPrimitiveTopology(This,Topology) \ + ( (This)->lpVtbl -> IASetPrimitiveTopology(This,Topology) ) + +#define ID3D11DeviceContext_VSSetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) \ + ( (This)->lpVtbl -> VSSetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) ) + +#define ID3D11DeviceContext_VSSetSamplers(This,StartSlot,NumSamplers,ppSamplers) \ + ( (This)->lpVtbl -> VSSetSamplers(This,StartSlot,NumSamplers,ppSamplers) ) + +#define ID3D11DeviceContext_Begin(This,pAsync) \ + ( (This)->lpVtbl -> Begin(This,pAsync) ) + +#define ID3D11DeviceContext_End(This,pAsync) \ + ( (This)->lpVtbl -> End(This,pAsync) ) + +#define ID3D11DeviceContext_GetData(This,pAsync,pData,DataSize,GetDataFlags) \ + ( (This)->lpVtbl -> GetData(This,pAsync,pData,DataSize,GetDataFlags) ) + +#define ID3D11DeviceContext_SetPredication(This,pPredicate,PredicateValue) \ + ( (This)->lpVtbl -> SetPredication(This,pPredicate,PredicateValue) ) + +#define ID3D11DeviceContext_GSSetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) \ + ( (This)->lpVtbl -> GSSetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) ) + +#define ID3D11DeviceContext_GSSetSamplers(This,StartSlot,NumSamplers,ppSamplers) \ + ( (This)->lpVtbl -> GSSetSamplers(This,StartSlot,NumSamplers,ppSamplers) ) + +#define ID3D11DeviceContext_OMSetRenderTargets(This,NumViews,ppRenderTargetViews,pDepthStencilView) \ + ( (This)->lpVtbl -> OMSetRenderTargets(This,NumViews,ppRenderTargetViews,pDepthStencilView) ) + +#define ID3D11DeviceContext_OMSetRenderTargetsAndUnorderedAccessViews(This,NumRTVs,ppRenderTargetViews,pDepthStencilView,UAVStartSlot,NumUAVs,ppUnorderedAccessViews,pUAVInitialCounts) \ + ( (This)->lpVtbl -> OMSetRenderTargetsAndUnorderedAccessViews(This,NumRTVs,ppRenderTargetViews,pDepthStencilView,UAVStartSlot,NumUAVs,ppUnorderedAccessViews,pUAVInitialCounts) ) + +#define ID3D11DeviceContext_OMSetBlendState(This,pBlendState,BlendFactor,SampleMask) \ + ( (This)->lpVtbl -> OMSetBlendState(This,pBlendState,BlendFactor,SampleMask) ) + +#define ID3D11DeviceContext_OMSetDepthStencilState(This,pDepthStencilState,StencilRef) \ + ( (This)->lpVtbl -> OMSetDepthStencilState(This,pDepthStencilState,StencilRef) ) + +#define ID3D11DeviceContext_SOSetTargets(This,NumBuffers,ppSOTargets,pOffsets) \ + ( (This)->lpVtbl -> SOSetTargets(This,NumBuffers,ppSOTargets,pOffsets) ) + +#define ID3D11DeviceContext_DrawAuto(This) \ + ( (This)->lpVtbl -> DrawAuto(This) ) + +#define ID3D11DeviceContext_DrawIndexedInstancedIndirect(This,pBufferForArgs,AlignedByteOffsetForArgs) \ + ( (This)->lpVtbl -> DrawIndexedInstancedIndirect(This,pBufferForArgs,AlignedByteOffsetForArgs) ) + +#define ID3D11DeviceContext_DrawInstancedIndirect(This,pBufferForArgs,AlignedByteOffsetForArgs) \ + ( (This)->lpVtbl -> DrawInstancedIndirect(This,pBufferForArgs,AlignedByteOffsetForArgs) ) + +#define ID3D11DeviceContext_Dispatch(This,ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) \ + ( (This)->lpVtbl -> Dispatch(This,ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) ) + +#define ID3D11DeviceContext_DispatchIndirect(This,pBufferForArgs,AlignedByteOffsetForArgs) \ + ( (This)->lpVtbl -> DispatchIndirect(This,pBufferForArgs,AlignedByteOffsetForArgs) ) + +#define ID3D11DeviceContext_RSSetState(This,pRasterizerState) \ + ( (This)->lpVtbl -> RSSetState(This,pRasterizerState) ) + +#define ID3D11DeviceContext_RSSetViewports(This,NumViewports,pViewports) \ + ( (This)->lpVtbl -> RSSetViewports(This,NumViewports,pViewports) ) + +#define ID3D11DeviceContext_RSSetScissorRects(This,NumRects,pRects) \ + ( (This)->lpVtbl -> RSSetScissorRects(This,NumRects,pRects) ) + +#define ID3D11DeviceContext_CopySubresourceRegion(This,pDstResource,DstSubresource,DstX,DstY,DstZ,pSrcResource,SrcSubresource,pSrcBox) \ + ( (This)->lpVtbl -> CopySubresourceRegion(This,pDstResource,DstSubresource,DstX,DstY,DstZ,pSrcResource,SrcSubresource,pSrcBox) ) + +#define ID3D11DeviceContext_CopyResource(This,pDstResource,pSrcResource) \ + ( (This)->lpVtbl -> CopyResource(This,pDstResource,pSrcResource) ) + +#define ID3D11DeviceContext_UpdateSubresource(This,pDstResource,DstSubresource,pDstBox,pSrcData,SrcRowPitch,SrcDepthPitch) \ + ( (This)->lpVtbl -> UpdateSubresource(This,pDstResource,DstSubresource,pDstBox,pSrcData,SrcRowPitch,SrcDepthPitch) ) + +#define ID3D11DeviceContext_CopyStructureCount(This,pDstBuffer,DstAlignedByteOffset,pSrcView) \ + ( (This)->lpVtbl -> CopyStructureCount(This,pDstBuffer,DstAlignedByteOffset,pSrcView) ) + +#define ID3D11DeviceContext_ClearRenderTargetView(This,pRenderTargetView,ColorRGBA) \ + ( (This)->lpVtbl -> ClearRenderTargetView(This,pRenderTargetView,ColorRGBA) ) + +#define ID3D11DeviceContext_ClearUnorderedAccessViewUint(This,pUnorderedAccessView,Values) \ + ( (This)->lpVtbl -> ClearUnorderedAccessViewUint(This,pUnorderedAccessView,Values) ) + +#define ID3D11DeviceContext_ClearUnorderedAccessViewFloat(This,pUnorderedAccessView,Values) \ + ( (This)->lpVtbl -> ClearUnorderedAccessViewFloat(This,pUnorderedAccessView,Values) ) + +#define ID3D11DeviceContext_ClearDepthStencilView(This,pDepthStencilView,ClearFlags,Depth,Stencil) \ + ( (This)->lpVtbl -> ClearDepthStencilView(This,pDepthStencilView,ClearFlags,Depth,Stencil) ) + +#define ID3D11DeviceContext_GenerateMips(This,pShaderResourceView) \ + ( (This)->lpVtbl -> GenerateMips(This,pShaderResourceView) ) + +#define ID3D11DeviceContext_SetResourceMinLOD(This,pResource,MinLOD) \ + ( (This)->lpVtbl -> SetResourceMinLOD(This,pResource,MinLOD) ) + +#define ID3D11DeviceContext_GetResourceMinLOD(This,pResource) \ + ( (This)->lpVtbl -> GetResourceMinLOD(This,pResource) ) + +#define ID3D11DeviceContext_ResolveSubresource(This,pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) \ + ( (This)->lpVtbl -> ResolveSubresource(This,pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) ) + +#define ID3D11DeviceContext_ExecuteCommandList(This,pCommandList,RestoreContextState) \ + ( (This)->lpVtbl -> ExecuteCommandList(This,pCommandList,RestoreContextState) ) + +#define ID3D11DeviceContext_HSSetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) \ + ( (This)->lpVtbl -> HSSetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) ) + +#define ID3D11DeviceContext_HSSetShader(This,pHullShader,ppClassInstances,NumClassInstances) \ + ( (This)->lpVtbl -> HSSetShader(This,pHullShader,ppClassInstances,NumClassInstances) ) + +#define ID3D11DeviceContext_HSSetSamplers(This,StartSlot,NumSamplers,ppSamplers) \ + ( (This)->lpVtbl -> HSSetSamplers(This,StartSlot,NumSamplers,ppSamplers) ) + +#define ID3D11DeviceContext_HSSetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) \ + ( (This)->lpVtbl -> HSSetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) ) + +#define ID3D11DeviceContext_DSSetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) \ + ( (This)->lpVtbl -> DSSetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) ) + +#define ID3D11DeviceContext_DSSetShader(This,pDomainShader,ppClassInstances,NumClassInstances) \ + ( (This)->lpVtbl -> DSSetShader(This,pDomainShader,ppClassInstances,NumClassInstances) ) + +#define ID3D11DeviceContext_DSSetSamplers(This,StartSlot,NumSamplers,ppSamplers) \ + ( (This)->lpVtbl -> DSSetSamplers(This,StartSlot,NumSamplers,ppSamplers) ) + +#define ID3D11DeviceContext_DSSetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) \ + ( (This)->lpVtbl -> DSSetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) ) + +#define ID3D11DeviceContext_CSSetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) \ + ( (This)->lpVtbl -> CSSetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) ) + +#define ID3D11DeviceContext_CSSetUnorderedAccessViews(This,StartSlot,NumUAVs,ppUnorderedAccessViews,pUAVInitialCounts) \ + ( (This)->lpVtbl -> CSSetUnorderedAccessViews(This,StartSlot,NumUAVs,ppUnorderedAccessViews,pUAVInitialCounts) ) + +#define ID3D11DeviceContext_CSSetShader(This,pComputeShader,ppClassInstances,NumClassInstances) \ + ( (This)->lpVtbl -> CSSetShader(This,pComputeShader,ppClassInstances,NumClassInstances) ) + +#define ID3D11DeviceContext_CSSetSamplers(This,StartSlot,NumSamplers,ppSamplers) \ + ( (This)->lpVtbl -> CSSetSamplers(This,StartSlot,NumSamplers,ppSamplers) ) + +#define ID3D11DeviceContext_CSSetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) \ + ( (This)->lpVtbl -> CSSetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) ) + +#define ID3D11DeviceContext_VSGetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) \ + ( (This)->lpVtbl -> VSGetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) ) + +#define ID3D11DeviceContext_PSGetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) \ + ( (This)->lpVtbl -> PSGetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) ) + +#define ID3D11DeviceContext_PSGetShader(This,ppPixelShader,ppClassInstances,pNumClassInstances) \ + ( (This)->lpVtbl -> PSGetShader(This,ppPixelShader,ppClassInstances,pNumClassInstances) ) + +#define ID3D11DeviceContext_PSGetSamplers(This,StartSlot,NumSamplers,ppSamplers) \ + ( (This)->lpVtbl -> PSGetSamplers(This,StartSlot,NumSamplers,ppSamplers) ) + +#define ID3D11DeviceContext_VSGetShader(This,ppVertexShader,ppClassInstances,pNumClassInstances) \ + ( (This)->lpVtbl -> VSGetShader(This,ppVertexShader,ppClassInstances,pNumClassInstances) ) + +#define ID3D11DeviceContext_PSGetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) \ + ( (This)->lpVtbl -> PSGetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) ) + +#define ID3D11DeviceContext_IAGetInputLayout(This,ppInputLayout) \ + ( (This)->lpVtbl -> IAGetInputLayout(This,ppInputLayout) ) + +#define ID3D11DeviceContext_IAGetVertexBuffers(This,StartSlot,NumBuffers,ppVertexBuffers,pStrides,pOffsets) \ + ( (This)->lpVtbl -> IAGetVertexBuffers(This,StartSlot,NumBuffers,ppVertexBuffers,pStrides,pOffsets) ) + +#define ID3D11DeviceContext_IAGetIndexBuffer(This,pIndexBuffer,Format,Offset) \ + ( (This)->lpVtbl -> IAGetIndexBuffer(This,pIndexBuffer,Format,Offset) ) + +#define ID3D11DeviceContext_GSGetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) \ + ( (This)->lpVtbl -> GSGetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) ) + +#define ID3D11DeviceContext_GSGetShader(This,ppGeometryShader,ppClassInstances,pNumClassInstances) \ + ( (This)->lpVtbl -> GSGetShader(This,ppGeometryShader,ppClassInstances,pNumClassInstances) ) + +#define ID3D11DeviceContext_IAGetPrimitiveTopology(This,pTopology) \ + ( (This)->lpVtbl -> IAGetPrimitiveTopology(This,pTopology) ) + +#define ID3D11DeviceContext_VSGetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) \ + ( (This)->lpVtbl -> VSGetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) ) + +#define ID3D11DeviceContext_VSGetSamplers(This,StartSlot,NumSamplers,ppSamplers) \ + ( (This)->lpVtbl -> VSGetSamplers(This,StartSlot,NumSamplers,ppSamplers) ) + +#define ID3D11DeviceContext_GetPredication(This,ppPredicate,pPredicateValue) \ + ( (This)->lpVtbl -> GetPredication(This,ppPredicate,pPredicateValue) ) + +#define ID3D11DeviceContext_GSGetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) \ + ( (This)->lpVtbl -> GSGetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) ) + +#define ID3D11DeviceContext_GSGetSamplers(This,StartSlot,NumSamplers,ppSamplers) \ + ( (This)->lpVtbl -> GSGetSamplers(This,StartSlot,NumSamplers,ppSamplers) ) + +#define ID3D11DeviceContext_OMGetRenderTargets(This,NumViews,ppRenderTargetViews,ppDepthStencilView) \ + ( (This)->lpVtbl -> OMGetRenderTargets(This,NumViews,ppRenderTargetViews,ppDepthStencilView) ) + +#define ID3D11DeviceContext_OMGetRenderTargetsAndUnorderedAccessViews(This,NumRTVs,ppRenderTargetViews,ppDepthStencilView,UAVStartSlot,NumUAVs,ppUnorderedAccessViews) \ + ( (This)->lpVtbl -> OMGetRenderTargetsAndUnorderedAccessViews(This,NumRTVs,ppRenderTargetViews,ppDepthStencilView,UAVStartSlot,NumUAVs,ppUnorderedAccessViews) ) + +#define ID3D11DeviceContext_OMGetBlendState(This,ppBlendState,BlendFactor,pSampleMask) \ + ( (This)->lpVtbl -> OMGetBlendState(This,ppBlendState,BlendFactor,pSampleMask) ) + +#define ID3D11DeviceContext_OMGetDepthStencilState(This,ppDepthStencilState,pStencilRef) \ + ( (This)->lpVtbl -> OMGetDepthStencilState(This,ppDepthStencilState,pStencilRef) ) + +#define ID3D11DeviceContext_SOGetTargets(This,NumBuffers,ppSOTargets) \ + ( (This)->lpVtbl -> SOGetTargets(This,NumBuffers,ppSOTargets) ) + +#define ID3D11DeviceContext_RSGetState(This,ppRasterizerState) \ + ( (This)->lpVtbl -> RSGetState(This,ppRasterizerState) ) + +#define ID3D11DeviceContext_RSGetViewports(This,pNumViewports,pViewports) \ + ( (This)->lpVtbl -> RSGetViewports(This,pNumViewports,pViewports) ) + +#define ID3D11DeviceContext_RSGetScissorRects(This,pNumRects,pRects) \ + ( (This)->lpVtbl -> RSGetScissorRects(This,pNumRects,pRects) ) + +#define ID3D11DeviceContext_HSGetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) \ + ( (This)->lpVtbl -> HSGetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) ) + +#define ID3D11DeviceContext_HSGetShader(This,ppHullShader,ppClassInstances,pNumClassInstances) \ + ( (This)->lpVtbl -> HSGetShader(This,ppHullShader,ppClassInstances,pNumClassInstances) ) + +#define ID3D11DeviceContext_HSGetSamplers(This,StartSlot,NumSamplers,ppSamplers) \ + ( (This)->lpVtbl -> HSGetSamplers(This,StartSlot,NumSamplers,ppSamplers) ) + +#define ID3D11DeviceContext_HSGetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) \ + ( (This)->lpVtbl -> HSGetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) ) + +#define ID3D11DeviceContext_DSGetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) \ + ( (This)->lpVtbl -> DSGetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) ) + +#define ID3D11DeviceContext_DSGetShader(This,ppDomainShader,ppClassInstances,pNumClassInstances) \ + ( (This)->lpVtbl -> DSGetShader(This,ppDomainShader,ppClassInstances,pNumClassInstances) ) + +#define ID3D11DeviceContext_DSGetSamplers(This,StartSlot,NumSamplers,ppSamplers) \ + ( (This)->lpVtbl -> DSGetSamplers(This,StartSlot,NumSamplers,ppSamplers) ) + +#define ID3D11DeviceContext_DSGetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) \ + ( (This)->lpVtbl -> DSGetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) ) + +#define ID3D11DeviceContext_CSGetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) \ + ( (This)->lpVtbl -> CSGetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) ) + +#define ID3D11DeviceContext_CSGetUnorderedAccessViews(This,StartSlot,NumUAVs,ppUnorderedAccessViews) \ + ( (This)->lpVtbl -> CSGetUnorderedAccessViews(This,StartSlot,NumUAVs,ppUnorderedAccessViews) ) + +#define ID3D11DeviceContext_CSGetShader(This,ppComputeShader,ppClassInstances,pNumClassInstances) \ + ( (This)->lpVtbl -> CSGetShader(This,ppComputeShader,ppClassInstances,pNumClassInstances) ) + +#define ID3D11DeviceContext_CSGetSamplers(This,StartSlot,NumSamplers,ppSamplers) \ + ( (This)->lpVtbl -> CSGetSamplers(This,StartSlot,NumSamplers,ppSamplers) ) + +#define ID3D11DeviceContext_CSGetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) \ + ( (This)->lpVtbl -> CSGetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) ) + +#define ID3D11DeviceContext_ClearState(This) \ + ( (This)->lpVtbl -> ClearState(This) ) + +#define ID3D11DeviceContext_Flush(This) \ + ( (This)->lpVtbl -> Flush(This) ) + +#define ID3D11DeviceContext_GetType(This) \ + ( (This)->lpVtbl -> GetType(This) ) + +#define ID3D11DeviceContext_GetContextFlags(This) \ + ( (This)->lpVtbl -> GetContextFlags(This) ) + +#define ID3D11DeviceContext_FinishCommandList(This,RestoreDeferredContextState,ppCommandList) \ + ( (This)->lpVtbl -> FinishCommandList(This,RestoreDeferredContextState,ppCommandList) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D11DeviceContext_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D11Device_INTERFACE_DEFINED__ +#define __ID3D11Device_INTERFACE_DEFINED__ + +/* interface ID3D11Device */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D11Device; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("db6f6ddb-ac77-4e88-8253-819df9bbf140") + ID3D11Device : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE CreateBuffer( + /* [annotation] */ + __in const D3D11_BUFFER_DESC *pDesc, + /* [annotation] */ + __in_opt const D3D11_SUBRESOURCE_DATA *pInitialData, + /* [annotation] */ + __out_opt ID3D11Buffer **ppBuffer) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateTexture1D( + /* [annotation] */ + __in const D3D11_TEXTURE1D_DESC *pDesc, + /* [annotation] */ + __in_xcount_opt(pDesc->MipLevels * pDesc->ArraySize) const D3D11_SUBRESOURCE_DATA *pInitialData, + /* [annotation] */ + __out_opt ID3D11Texture1D **ppTexture1D) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateTexture2D( + /* [annotation] */ + __in const D3D11_TEXTURE2D_DESC *pDesc, + /* [annotation] */ + __in_xcount_opt(pDesc->MipLevels * pDesc->ArraySize) const D3D11_SUBRESOURCE_DATA *pInitialData, + /* [annotation] */ + __out_opt ID3D11Texture2D **ppTexture2D) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateTexture3D( + /* [annotation] */ + __in const D3D11_TEXTURE3D_DESC *pDesc, + /* [annotation] */ + __in_xcount_opt(pDesc->MipLevels) const D3D11_SUBRESOURCE_DATA *pInitialData, + /* [annotation] */ + __out_opt ID3D11Texture3D **ppTexture3D) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateShaderResourceView( + /* [annotation] */ + __in ID3D11Resource *pResource, + /* [annotation] */ + __in_opt const D3D11_SHADER_RESOURCE_VIEW_DESC *pDesc, + /* [annotation] */ + __out_opt ID3D11ShaderResourceView **ppSRView) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateUnorderedAccessView( + /* [annotation] */ + __in ID3D11Resource *pResource, + /* [annotation] */ + __in_opt const D3D11_UNORDERED_ACCESS_VIEW_DESC *pDesc, + /* [annotation] */ + __out_opt ID3D11UnorderedAccessView **ppUAView) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateRenderTargetView( + /* [annotation] */ + __in ID3D11Resource *pResource, + /* [annotation] */ + __in_opt const D3D11_RENDER_TARGET_VIEW_DESC *pDesc, + /* [annotation] */ + __out_opt ID3D11RenderTargetView **ppRTView) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateDepthStencilView( + /* [annotation] */ + __in ID3D11Resource *pResource, + /* [annotation] */ + __in_opt const D3D11_DEPTH_STENCIL_VIEW_DESC *pDesc, + /* [annotation] */ + __out_opt ID3D11DepthStencilView **ppDepthStencilView) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateInputLayout( + /* [annotation] */ + __in_ecount(NumElements) const D3D11_INPUT_ELEMENT_DESC *pInputElementDescs, + /* [annotation] */ + __in_range( 0, D3D11_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT ) UINT NumElements, + /* [annotation] */ + __in const void *pShaderBytecodeWithInputSignature, + /* [annotation] */ + __in SIZE_T BytecodeLength, + /* [annotation] */ + __out_opt ID3D11InputLayout **ppInputLayout) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateVertexShader( + /* [annotation] */ + __in const void *pShaderBytecode, + /* [annotation] */ + __in SIZE_T BytecodeLength, + /* [annotation] */ + __in_opt ID3D11ClassLinkage *pClassLinkage, + /* [annotation] */ + __out_opt ID3D11VertexShader **ppVertexShader) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateGeometryShader( + /* [annotation] */ + __in const void *pShaderBytecode, + /* [annotation] */ + __in SIZE_T BytecodeLength, + /* [annotation] */ + __in_opt ID3D11ClassLinkage *pClassLinkage, + /* [annotation] */ + __out_opt ID3D11GeometryShader **ppGeometryShader) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateGeometryShaderWithStreamOutput( + /* [annotation] */ + __in const void *pShaderBytecode, + /* [annotation] */ + __in SIZE_T BytecodeLength, + /* [annotation] */ + __in_ecount_opt(NumEntries) const D3D11_SO_DECLARATION_ENTRY *pSODeclaration, + /* [annotation] */ + __in_range( 0, D3D11_SO_STREAM_COUNT * D3D11_SO_OUTPUT_COMPONENT_COUNT ) UINT NumEntries, + /* [annotation] */ + __in_ecount_opt(NumStrides) const UINT *pBufferStrides, + /* [annotation] */ + __in_range( 0, D3D11_SO_BUFFER_SLOT_COUNT ) UINT NumStrides, + /* [annotation] */ + __in UINT RasterizedStream, + /* [annotation] */ + __in_opt ID3D11ClassLinkage *pClassLinkage, + /* [annotation] */ + __out_opt ID3D11GeometryShader **ppGeometryShader) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreatePixelShader( + /* [annotation] */ + __in const void *pShaderBytecode, + /* [annotation] */ + __in SIZE_T BytecodeLength, + /* [annotation] */ + __in_opt ID3D11ClassLinkage *pClassLinkage, + /* [annotation] */ + __out_opt ID3D11PixelShader **ppPixelShader) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateHullShader( + /* [annotation] */ + __in const void *pShaderBytecode, + /* [annotation] */ + __in SIZE_T BytecodeLength, + /* [annotation] */ + __in_opt ID3D11ClassLinkage *pClassLinkage, + /* [annotation] */ + __out_opt ID3D11HullShader **ppHullShader) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateDomainShader( + /* [annotation] */ + __in const void *pShaderBytecode, + /* [annotation] */ + __in SIZE_T BytecodeLength, + /* [annotation] */ + __in_opt ID3D11ClassLinkage *pClassLinkage, + /* [annotation] */ + __out_opt ID3D11DomainShader **ppDomainShader) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateComputeShader( + /* [annotation] */ + __in const void *pShaderBytecode, + /* [annotation] */ + __in SIZE_T BytecodeLength, + /* [annotation] */ + __in_opt ID3D11ClassLinkage *pClassLinkage, + /* [annotation] */ + __out_opt ID3D11ComputeShader **ppComputeShader) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateClassLinkage( + /* [annotation] */ + __out ID3D11ClassLinkage **ppLinkage) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateBlendState( + /* [annotation] */ + __in const D3D11_BLEND_DESC *pBlendStateDesc, + /* [annotation] */ + __out_opt ID3D11BlendState **ppBlendState) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateDepthStencilState( + /* [annotation] */ + __in const D3D11_DEPTH_STENCIL_DESC *pDepthStencilDesc, + /* [annotation] */ + __out_opt ID3D11DepthStencilState **ppDepthStencilState) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateRasterizerState( + /* [annotation] */ + __in const D3D11_RASTERIZER_DESC *pRasterizerDesc, + /* [annotation] */ + __out_opt ID3D11RasterizerState **ppRasterizerState) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateSamplerState( + /* [annotation] */ + __in const D3D11_SAMPLER_DESC *pSamplerDesc, + /* [annotation] */ + __out_opt ID3D11SamplerState **ppSamplerState) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateQuery( + /* [annotation] */ + __in const D3D11_QUERY_DESC *pQueryDesc, + /* [annotation] */ + __out_opt ID3D11Query **ppQuery) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreatePredicate( + /* [annotation] */ + __in const D3D11_QUERY_DESC *pPredicateDesc, + /* [annotation] */ + __out_opt ID3D11Predicate **ppPredicate) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateCounter( + /* [annotation] */ + __in const D3D11_COUNTER_DESC *pCounterDesc, + /* [annotation] */ + __out_opt ID3D11Counter **ppCounter) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateDeferredContext( + UINT ContextFlags, + /* [annotation] */ + __out_opt ID3D11DeviceContext **ppDeferredContext) = 0; + + virtual HRESULT STDMETHODCALLTYPE OpenSharedResource( + /* [annotation] */ + __in HANDLE hResource, + /* [annotation] */ + __in REFIID ReturnedInterface, + /* [annotation] */ + __out_opt void **ppResource) = 0; + + virtual HRESULT STDMETHODCALLTYPE CheckFormatSupport( + /* [annotation] */ + __in DXGI_FORMAT Format, + /* [annotation] */ + __out UINT *pFormatSupport) = 0; + + virtual HRESULT STDMETHODCALLTYPE CheckMultisampleQualityLevels( + /* [annotation] */ + __in DXGI_FORMAT Format, + /* [annotation] */ + __in UINT SampleCount, + /* [annotation] */ + __out UINT *pNumQualityLevels) = 0; + + virtual void STDMETHODCALLTYPE CheckCounterInfo( + /* [annotation] */ + __out D3D11_COUNTER_INFO *pCounterInfo) = 0; + + virtual HRESULT STDMETHODCALLTYPE CheckCounter( + /* [annotation] */ + __in const D3D11_COUNTER_DESC *pDesc, + /* [annotation] */ + __out D3D11_COUNTER_TYPE *pType, + /* [annotation] */ + __out UINT *pActiveCounters, + /* [annotation] */ + __out_ecount_opt(*pNameLength) LPSTR szName, + /* [annotation] */ + __inout_opt UINT *pNameLength, + /* [annotation] */ + __out_ecount_opt(*pUnitsLength) LPSTR szUnits, + /* [annotation] */ + __inout_opt UINT *pUnitsLength, + /* [annotation] */ + __out_ecount_opt(*pDescriptionLength) LPSTR szDescription, + /* [annotation] */ + __inout_opt UINT *pDescriptionLength) = 0; + + virtual HRESULT STDMETHODCALLTYPE CheckFeatureSupport( + D3D11_FEATURE Feature, + /* [annotation] */ + __out_bcount(FeatureSupportDataSize) void *pFeatureSupportData, + UINT FeatureSupportDataSize) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetPrivateData( + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt(*pDataSize) void *pData) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetPrivateData( + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt(DataSize) const void *pData) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface( + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData) = 0; + + virtual D3D_FEATURE_LEVEL STDMETHODCALLTYPE GetFeatureLevel( void) = 0; + + virtual UINT STDMETHODCALLTYPE GetCreationFlags( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetDeviceRemovedReason( void) = 0; + + virtual void STDMETHODCALLTYPE GetImmediateContext( + /* [annotation] */ + __out ID3D11DeviceContext **ppImmediateContext) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetExceptionMode( + UINT RaiseFlags) = 0; + + virtual UINT STDMETHODCALLTYPE GetExceptionMode( void) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D11DeviceVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D11Device * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D11Device * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D11Device * This); + + HRESULT ( STDMETHODCALLTYPE *CreateBuffer )( + ID3D11Device * This, + /* [annotation] */ + __in const D3D11_BUFFER_DESC *pDesc, + /* [annotation] */ + __in_opt const D3D11_SUBRESOURCE_DATA *pInitialData, + /* [annotation] */ + __out_opt ID3D11Buffer **ppBuffer); + + HRESULT ( STDMETHODCALLTYPE *CreateTexture1D )( + ID3D11Device * This, + /* [annotation] */ + __in const D3D11_TEXTURE1D_DESC *pDesc, + /* [annotation] */ + __in_xcount_opt(pDesc->MipLevels * pDesc->ArraySize) const D3D11_SUBRESOURCE_DATA *pInitialData, + /* [annotation] */ + __out_opt ID3D11Texture1D **ppTexture1D); + + HRESULT ( STDMETHODCALLTYPE *CreateTexture2D )( + ID3D11Device * This, + /* [annotation] */ + __in const D3D11_TEXTURE2D_DESC *pDesc, + /* [annotation] */ + __in_xcount_opt(pDesc->MipLevels * pDesc->ArraySize) const D3D11_SUBRESOURCE_DATA *pInitialData, + /* [annotation] */ + __out_opt ID3D11Texture2D **ppTexture2D); + + HRESULT ( STDMETHODCALLTYPE *CreateTexture3D )( + ID3D11Device * This, + /* [annotation] */ + __in const D3D11_TEXTURE3D_DESC *pDesc, + /* [annotation] */ + __in_xcount_opt(pDesc->MipLevels) const D3D11_SUBRESOURCE_DATA *pInitialData, + /* [annotation] */ + __out_opt ID3D11Texture3D **ppTexture3D); + + HRESULT ( STDMETHODCALLTYPE *CreateShaderResourceView )( + ID3D11Device * This, + /* [annotation] */ + __in ID3D11Resource *pResource, + /* [annotation] */ + __in_opt const D3D11_SHADER_RESOURCE_VIEW_DESC *pDesc, + /* [annotation] */ + __out_opt ID3D11ShaderResourceView **ppSRView); + + HRESULT ( STDMETHODCALLTYPE *CreateUnorderedAccessView )( + ID3D11Device * This, + /* [annotation] */ + __in ID3D11Resource *pResource, + /* [annotation] */ + __in_opt const D3D11_UNORDERED_ACCESS_VIEW_DESC *pDesc, + /* [annotation] */ + __out_opt ID3D11UnorderedAccessView **ppUAView); + + HRESULT ( STDMETHODCALLTYPE *CreateRenderTargetView )( + ID3D11Device * This, + /* [annotation] */ + __in ID3D11Resource *pResource, + /* [annotation] */ + __in_opt const D3D11_RENDER_TARGET_VIEW_DESC *pDesc, + /* [annotation] */ + __out_opt ID3D11RenderTargetView **ppRTView); + + HRESULT ( STDMETHODCALLTYPE *CreateDepthStencilView )( + ID3D11Device * This, + /* [annotation] */ + __in ID3D11Resource *pResource, + /* [annotation] */ + __in_opt const D3D11_DEPTH_STENCIL_VIEW_DESC *pDesc, + /* [annotation] */ + __out_opt ID3D11DepthStencilView **ppDepthStencilView); + + HRESULT ( STDMETHODCALLTYPE *CreateInputLayout )( + ID3D11Device * This, + /* [annotation] */ + __in_ecount(NumElements) const D3D11_INPUT_ELEMENT_DESC *pInputElementDescs, + /* [annotation] */ + __in_range( 0, D3D11_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT ) UINT NumElements, + /* [annotation] */ + __in const void *pShaderBytecodeWithInputSignature, + /* [annotation] */ + __in SIZE_T BytecodeLength, + /* [annotation] */ + __out_opt ID3D11InputLayout **ppInputLayout); + + HRESULT ( STDMETHODCALLTYPE *CreateVertexShader )( + ID3D11Device * This, + /* [annotation] */ + __in const void *pShaderBytecode, + /* [annotation] */ + __in SIZE_T BytecodeLength, + /* [annotation] */ + __in_opt ID3D11ClassLinkage *pClassLinkage, + /* [annotation] */ + __out_opt ID3D11VertexShader **ppVertexShader); + + HRESULT ( STDMETHODCALLTYPE *CreateGeometryShader )( + ID3D11Device * This, + /* [annotation] */ + __in const void *pShaderBytecode, + /* [annotation] */ + __in SIZE_T BytecodeLength, + /* [annotation] */ + __in_opt ID3D11ClassLinkage *pClassLinkage, + /* [annotation] */ + __out_opt ID3D11GeometryShader **ppGeometryShader); + + HRESULT ( STDMETHODCALLTYPE *CreateGeometryShaderWithStreamOutput )( + ID3D11Device * This, + /* [annotation] */ + __in const void *pShaderBytecode, + /* [annotation] */ + __in SIZE_T BytecodeLength, + /* [annotation] */ + __in_ecount_opt(NumEntries) const D3D11_SO_DECLARATION_ENTRY *pSODeclaration, + /* [annotation] */ + __in_range( 0, D3D11_SO_STREAM_COUNT * D3D11_SO_OUTPUT_COMPONENT_COUNT ) UINT NumEntries, + /* [annotation] */ + __in_ecount_opt(NumStrides) const UINT *pBufferStrides, + /* [annotation] */ + __in_range( 0, D3D11_SO_BUFFER_SLOT_COUNT ) UINT NumStrides, + /* [annotation] */ + __in UINT RasterizedStream, + /* [annotation] */ + __in_opt ID3D11ClassLinkage *pClassLinkage, + /* [annotation] */ + __out_opt ID3D11GeometryShader **ppGeometryShader); + + HRESULT ( STDMETHODCALLTYPE *CreatePixelShader )( + ID3D11Device * This, + /* [annotation] */ + __in const void *pShaderBytecode, + /* [annotation] */ + __in SIZE_T BytecodeLength, + /* [annotation] */ + __in_opt ID3D11ClassLinkage *pClassLinkage, + /* [annotation] */ + __out_opt ID3D11PixelShader **ppPixelShader); + + HRESULT ( STDMETHODCALLTYPE *CreateHullShader )( + ID3D11Device * This, + /* [annotation] */ + __in const void *pShaderBytecode, + /* [annotation] */ + __in SIZE_T BytecodeLength, + /* [annotation] */ + __in_opt ID3D11ClassLinkage *pClassLinkage, + /* [annotation] */ + __out_opt ID3D11HullShader **ppHullShader); + + HRESULT ( STDMETHODCALLTYPE *CreateDomainShader )( + ID3D11Device * This, + /* [annotation] */ + __in const void *pShaderBytecode, + /* [annotation] */ + __in SIZE_T BytecodeLength, + /* [annotation] */ + __in_opt ID3D11ClassLinkage *pClassLinkage, + /* [annotation] */ + __out_opt ID3D11DomainShader **ppDomainShader); + + HRESULT ( STDMETHODCALLTYPE *CreateComputeShader )( + ID3D11Device * This, + /* [annotation] */ + __in const void *pShaderBytecode, + /* [annotation] */ + __in SIZE_T BytecodeLength, + /* [annotation] */ + __in_opt ID3D11ClassLinkage *pClassLinkage, + /* [annotation] */ + __out_opt ID3D11ComputeShader **ppComputeShader); + + HRESULT ( STDMETHODCALLTYPE *CreateClassLinkage )( + ID3D11Device * This, + /* [annotation] */ + __out ID3D11ClassLinkage **ppLinkage); + + HRESULT ( STDMETHODCALLTYPE *CreateBlendState )( + ID3D11Device * This, + /* [annotation] */ + __in const D3D11_BLEND_DESC *pBlendStateDesc, + /* [annotation] */ + __out_opt ID3D11BlendState **ppBlendState); + + HRESULT ( STDMETHODCALLTYPE *CreateDepthStencilState )( + ID3D11Device * This, + /* [annotation] */ + __in const D3D11_DEPTH_STENCIL_DESC *pDepthStencilDesc, + /* [annotation] */ + __out_opt ID3D11DepthStencilState **ppDepthStencilState); + + HRESULT ( STDMETHODCALLTYPE *CreateRasterizerState )( + ID3D11Device * This, + /* [annotation] */ + __in const D3D11_RASTERIZER_DESC *pRasterizerDesc, + /* [annotation] */ + __out_opt ID3D11RasterizerState **ppRasterizerState); + + HRESULT ( STDMETHODCALLTYPE *CreateSamplerState )( + ID3D11Device * This, + /* [annotation] */ + __in const D3D11_SAMPLER_DESC *pSamplerDesc, + /* [annotation] */ + __out_opt ID3D11SamplerState **ppSamplerState); + + HRESULT ( STDMETHODCALLTYPE *CreateQuery )( + ID3D11Device * This, + /* [annotation] */ + __in const D3D11_QUERY_DESC *pQueryDesc, + /* [annotation] */ + __out_opt ID3D11Query **ppQuery); + + HRESULT ( STDMETHODCALLTYPE *CreatePredicate )( + ID3D11Device * This, + /* [annotation] */ + __in const D3D11_QUERY_DESC *pPredicateDesc, + /* [annotation] */ + __out_opt ID3D11Predicate **ppPredicate); + + HRESULT ( STDMETHODCALLTYPE *CreateCounter )( + ID3D11Device * This, + /* [annotation] */ + __in const D3D11_COUNTER_DESC *pCounterDesc, + /* [annotation] */ + __out_opt ID3D11Counter **ppCounter); + + HRESULT ( STDMETHODCALLTYPE *CreateDeferredContext )( + ID3D11Device * This, + UINT ContextFlags, + /* [annotation] */ + __out_opt ID3D11DeviceContext **ppDeferredContext); + + HRESULT ( STDMETHODCALLTYPE *OpenSharedResource )( + ID3D11Device * This, + /* [annotation] */ + __in HANDLE hResource, + /* [annotation] */ + __in REFIID ReturnedInterface, + /* [annotation] */ + __out_opt void **ppResource); + + HRESULT ( STDMETHODCALLTYPE *CheckFormatSupport )( + ID3D11Device * This, + /* [annotation] */ + __in DXGI_FORMAT Format, + /* [annotation] */ + __out UINT *pFormatSupport); + + HRESULT ( STDMETHODCALLTYPE *CheckMultisampleQualityLevels )( + ID3D11Device * This, + /* [annotation] */ + __in DXGI_FORMAT Format, + /* [annotation] */ + __in UINT SampleCount, + /* [annotation] */ + __out UINT *pNumQualityLevels); + + void ( STDMETHODCALLTYPE *CheckCounterInfo )( + ID3D11Device * This, + /* [annotation] */ + __out D3D11_COUNTER_INFO *pCounterInfo); + + HRESULT ( STDMETHODCALLTYPE *CheckCounter )( + ID3D11Device * This, + /* [annotation] */ + __in const D3D11_COUNTER_DESC *pDesc, + /* [annotation] */ + __out D3D11_COUNTER_TYPE *pType, + /* [annotation] */ + __out UINT *pActiveCounters, + /* [annotation] */ + __out_ecount_opt(*pNameLength) LPSTR szName, + /* [annotation] */ + __inout_opt UINT *pNameLength, + /* [annotation] */ + __out_ecount_opt(*pUnitsLength) LPSTR szUnits, + /* [annotation] */ + __inout_opt UINT *pUnitsLength, + /* [annotation] */ + __out_ecount_opt(*pDescriptionLength) LPSTR szDescription, + /* [annotation] */ + __inout_opt UINT *pDescriptionLength); + + HRESULT ( STDMETHODCALLTYPE *CheckFeatureSupport )( + ID3D11Device * This, + D3D11_FEATURE Feature, + /* [annotation] */ + __out_bcount(FeatureSupportDataSize) void *pFeatureSupportData, + UINT FeatureSupportDataSize); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D11Device * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __inout UINT *pDataSize, + /* [annotation] */ + __out_bcount_opt(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D11Device * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in UINT DataSize, + /* [annotation] */ + __in_bcount_opt(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D11Device * This, + /* [annotation] */ + __in REFGUID guid, + /* [annotation] */ + __in_opt const IUnknown *pData); + + D3D_FEATURE_LEVEL ( STDMETHODCALLTYPE *GetFeatureLevel )( + ID3D11Device * This); + + UINT ( STDMETHODCALLTYPE *GetCreationFlags )( + ID3D11Device * This); + + HRESULT ( STDMETHODCALLTYPE *GetDeviceRemovedReason )( + ID3D11Device * This); + + void ( STDMETHODCALLTYPE *GetImmediateContext )( + ID3D11Device * This, + /* [annotation] */ + __out ID3D11DeviceContext **ppImmediateContext); + + HRESULT ( STDMETHODCALLTYPE *SetExceptionMode )( + ID3D11Device * This, + UINT RaiseFlags); + + UINT ( STDMETHODCALLTYPE *GetExceptionMode )( + ID3D11Device * This); + + END_INTERFACE + } ID3D11DeviceVtbl; + + interface ID3D11Device + { + CONST_VTBL struct ID3D11DeviceVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D11Device_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D11Device_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D11Device_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D11Device_CreateBuffer(This,pDesc,pInitialData,ppBuffer) \ + ( (This)->lpVtbl -> CreateBuffer(This,pDesc,pInitialData,ppBuffer) ) + +#define ID3D11Device_CreateTexture1D(This,pDesc,pInitialData,ppTexture1D) \ + ( (This)->lpVtbl -> CreateTexture1D(This,pDesc,pInitialData,ppTexture1D) ) + +#define ID3D11Device_CreateTexture2D(This,pDesc,pInitialData,ppTexture2D) \ + ( (This)->lpVtbl -> CreateTexture2D(This,pDesc,pInitialData,ppTexture2D) ) + +#define ID3D11Device_CreateTexture3D(This,pDesc,pInitialData,ppTexture3D) \ + ( (This)->lpVtbl -> CreateTexture3D(This,pDesc,pInitialData,ppTexture3D) ) + +#define ID3D11Device_CreateShaderResourceView(This,pResource,pDesc,ppSRView) \ + ( (This)->lpVtbl -> CreateShaderResourceView(This,pResource,pDesc,ppSRView) ) + +#define ID3D11Device_CreateUnorderedAccessView(This,pResource,pDesc,ppUAView) \ + ( (This)->lpVtbl -> CreateUnorderedAccessView(This,pResource,pDesc,ppUAView) ) + +#define ID3D11Device_CreateRenderTargetView(This,pResource,pDesc,ppRTView) \ + ( (This)->lpVtbl -> CreateRenderTargetView(This,pResource,pDesc,ppRTView) ) + +#define ID3D11Device_CreateDepthStencilView(This,pResource,pDesc,ppDepthStencilView) \ + ( (This)->lpVtbl -> CreateDepthStencilView(This,pResource,pDesc,ppDepthStencilView) ) + +#define ID3D11Device_CreateInputLayout(This,pInputElementDescs,NumElements,pShaderBytecodeWithInputSignature,BytecodeLength,ppInputLayout) \ + ( (This)->lpVtbl -> CreateInputLayout(This,pInputElementDescs,NumElements,pShaderBytecodeWithInputSignature,BytecodeLength,ppInputLayout) ) + +#define ID3D11Device_CreateVertexShader(This,pShaderBytecode,BytecodeLength,pClassLinkage,ppVertexShader) \ + ( (This)->lpVtbl -> CreateVertexShader(This,pShaderBytecode,BytecodeLength,pClassLinkage,ppVertexShader) ) + +#define ID3D11Device_CreateGeometryShader(This,pShaderBytecode,BytecodeLength,pClassLinkage,ppGeometryShader) \ + ( (This)->lpVtbl -> CreateGeometryShader(This,pShaderBytecode,BytecodeLength,pClassLinkage,ppGeometryShader) ) + +#define ID3D11Device_CreateGeometryShaderWithStreamOutput(This,pShaderBytecode,BytecodeLength,pSODeclaration,NumEntries,pBufferStrides,NumStrides,RasterizedStream,pClassLinkage,ppGeometryShader) \ + ( (This)->lpVtbl -> CreateGeometryShaderWithStreamOutput(This,pShaderBytecode,BytecodeLength,pSODeclaration,NumEntries,pBufferStrides,NumStrides,RasterizedStream,pClassLinkage,ppGeometryShader) ) + +#define ID3D11Device_CreatePixelShader(This,pShaderBytecode,BytecodeLength,pClassLinkage,ppPixelShader) \ + ( (This)->lpVtbl -> CreatePixelShader(This,pShaderBytecode,BytecodeLength,pClassLinkage,ppPixelShader) ) + +#define ID3D11Device_CreateHullShader(This,pShaderBytecode,BytecodeLength,pClassLinkage,ppHullShader) \ + ( (This)->lpVtbl -> CreateHullShader(This,pShaderBytecode,BytecodeLength,pClassLinkage,ppHullShader) ) + +#define ID3D11Device_CreateDomainShader(This,pShaderBytecode,BytecodeLength,pClassLinkage,ppDomainShader) \ + ( (This)->lpVtbl -> CreateDomainShader(This,pShaderBytecode,BytecodeLength,pClassLinkage,ppDomainShader) ) + +#define ID3D11Device_CreateComputeShader(This,pShaderBytecode,BytecodeLength,pClassLinkage,ppComputeShader) \ + ( (This)->lpVtbl -> CreateComputeShader(This,pShaderBytecode,BytecodeLength,pClassLinkage,ppComputeShader) ) + +#define ID3D11Device_CreateClassLinkage(This,ppLinkage) \ + ( (This)->lpVtbl -> CreateClassLinkage(This,ppLinkage) ) + +#define ID3D11Device_CreateBlendState(This,pBlendStateDesc,ppBlendState) \ + ( (This)->lpVtbl -> CreateBlendState(This,pBlendStateDesc,ppBlendState) ) + +#define ID3D11Device_CreateDepthStencilState(This,pDepthStencilDesc,ppDepthStencilState) \ + ( (This)->lpVtbl -> CreateDepthStencilState(This,pDepthStencilDesc,ppDepthStencilState) ) + +#define ID3D11Device_CreateRasterizerState(This,pRasterizerDesc,ppRasterizerState) \ + ( (This)->lpVtbl -> CreateRasterizerState(This,pRasterizerDesc,ppRasterizerState) ) + +#define ID3D11Device_CreateSamplerState(This,pSamplerDesc,ppSamplerState) \ + ( (This)->lpVtbl -> CreateSamplerState(This,pSamplerDesc,ppSamplerState) ) + +#define ID3D11Device_CreateQuery(This,pQueryDesc,ppQuery) \ + ( (This)->lpVtbl -> CreateQuery(This,pQueryDesc,ppQuery) ) + +#define ID3D11Device_CreatePredicate(This,pPredicateDesc,ppPredicate) \ + ( (This)->lpVtbl -> CreatePredicate(This,pPredicateDesc,ppPredicate) ) + +#define ID3D11Device_CreateCounter(This,pCounterDesc,ppCounter) \ + ( (This)->lpVtbl -> CreateCounter(This,pCounterDesc,ppCounter) ) + +#define ID3D11Device_CreateDeferredContext(This,ContextFlags,ppDeferredContext) \ + ( (This)->lpVtbl -> CreateDeferredContext(This,ContextFlags,ppDeferredContext) ) + +#define ID3D11Device_OpenSharedResource(This,hResource,ReturnedInterface,ppResource) \ + ( (This)->lpVtbl -> OpenSharedResource(This,hResource,ReturnedInterface,ppResource) ) + +#define ID3D11Device_CheckFormatSupport(This,Format,pFormatSupport) \ + ( (This)->lpVtbl -> CheckFormatSupport(This,Format,pFormatSupport) ) + +#define ID3D11Device_CheckMultisampleQualityLevels(This,Format,SampleCount,pNumQualityLevels) \ + ( (This)->lpVtbl -> CheckMultisampleQualityLevels(This,Format,SampleCount,pNumQualityLevels) ) + +#define ID3D11Device_CheckCounterInfo(This,pCounterInfo) \ + ( (This)->lpVtbl -> CheckCounterInfo(This,pCounterInfo) ) + +#define ID3D11Device_CheckCounter(This,pDesc,pType,pActiveCounters,szName,pNameLength,szUnits,pUnitsLength,szDescription,pDescriptionLength) \ + ( (This)->lpVtbl -> CheckCounter(This,pDesc,pType,pActiveCounters,szName,pNameLength,szUnits,pUnitsLength,szDescription,pDescriptionLength) ) + +#define ID3D11Device_CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) \ + ( (This)->lpVtbl -> CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) ) + +#define ID3D11Device_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D11Device_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D11Device_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D11Device_GetFeatureLevel(This) \ + ( (This)->lpVtbl -> GetFeatureLevel(This) ) + +#define ID3D11Device_GetCreationFlags(This) \ + ( (This)->lpVtbl -> GetCreationFlags(This) ) + +#define ID3D11Device_GetDeviceRemovedReason(This) \ + ( (This)->lpVtbl -> GetDeviceRemovedReason(This) ) + +#define ID3D11Device_GetImmediateContext(This,ppImmediateContext) \ + ( (This)->lpVtbl -> GetImmediateContext(This,ppImmediateContext) ) + +#define ID3D11Device_SetExceptionMode(This,RaiseFlags) \ + ( (This)->lpVtbl -> SetExceptionMode(This,RaiseFlags) ) + +#define ID3D11Device_GetExceptionMode(This) \ + ( (This)->lpVtbl -> GetExceptionMode(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D11Device_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d11_0000_0031 */ +/* [local] */ + +typedef +enum D3D11_CREATE_DEVICE_FLAG + { D3D11_CREATE_DEVICE_SINGLETHREADED = 0x1, + D3D11_CREATE_DEVICE_DEBUG = 0x2, + D3D11_CREATE_DEVICE_SWITCH_TO_REF = 0x4, + D3D11_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS = 0x8, + D3D11_CREATE_DEVICE_BGRA_SUPPORT = 0x20 + } D3D11_CREATE_DEVICE_FLAG; + +#define D3D11_SDK_VERSION ( 7 ) + +#include "d3d10_1.h" +#if !defined( D3D11_IGNORE_SDK_LAYERS ) +#include "d3d11sdklayers.h" +#endif +#include "d3d10misc.h" +#include "d3d10shader.h" +#include "d3d10effect.h" +#include "d3d10_1shader.h" + +/////////////////////////////////////////////////////////////////////////// +// D3D11CreateDevice +// ------------------ +// +// pAdapter +// If NULL, D3D11CreateDevice will choose the primary adapter and +// create a new instance from a temporarily created IDXGIFactory. +// If non-NULL, D3D11CreateDevice will register the appropriate +// device, if necessary (via IDXGIAdapter::RegisterDrver), before +// creating the device. +// DriverType +// Specifies the driver type to be created: hardware, reference or +// null. +// Software +// HMODULE of a DLL implementing a software rasterizer. Must be NULL for +// non-Software driver types. +// Flags +// Any of those documented for D3D11CreateDeviceAndSwapChain. +// pFeatureLevels +// Any of those documented for D3D11CreateDeviceAndSwapChain. +// FeatureLevels +// Size of feature levels array. +// SDKVersion +// SDK version. Use the D3D11_SDK_VERSION macro. +// ppDevice +// Pointer to returned interface. May be NULL. +// pFeatureLevel +// Pointer to returned feature level. May be NULL. +// ppImmediateContext +// Pointer to returned interface. May be NULL. +// +// Return Values +// Any of those documented for +// CreateDXGIFactory1 +// IDXGIFactory::EnumAdapters +// IDXGIAdapter::RegisterDriver +// D3D11CreateDevice +// +/////////////////////////////////////////////////////////////////////////// +typedef HRESULT (WINAPI* PFN_D3D11_CREATE_DEVICE)( __in_opt IDXGIAdapter*, + D3D_DRIVER_TYPE, HMODULE, UINT, + __in_ecount_opt( FeatureLevels ) CONST D3D_FEATURE_LEVEL*, + UINT FeatureLevels, UINT, __out_opt ID3D11Device**, + __out_opt D3D_FEATURE_LEVEL*, __out_opt ID3D11DeviceContext** ); + +HRESULT WINAPI D3D11CreateDevice( + __in_opt IDXGIAdapter* pAdapter, + D3D_DRIVER_TYPE DriverType, + HMODULE Software, + UINT Flags, + __in_ecount_opt( FeatureLevels ) CONST D3D_FEATURE_LEVEL* pFeatureLevels, + UINT FeatureLevels, + UINT SDKVersion, + __out_opt ID3D11Device** ppDevice, + __out_opt D3D_FEATURE_LEVEL* pFeatureLevel, + __out_opt ID3D11DeviceContext** ppImmediateContext ); + +/////////////////////////////////////////////////////////////////////////// +// D3D11CreateDeviceAndSwapChain +// ------------------------------ +// +// ppAdapter +// If NULL, D3D11CreateDevice will choose the primary adapter and +// create a new instance from a temporarily created IDXGIFactory. +// If non-NULL, D3D11CreateDevice will register the appropriate +// device, if necessary (via IDXGIAdapter::RegisterDrver), before +// creating the device. +// DriverType +// Specifies the driver type to be created: hardware, reference or +// null. +// Software +// HMODULE of a DLL implementing a software rasterizer. Must be NULL for +// non-Software driver types. +// Flags +// Any of those documented for D3D11CreateDevice. +// pFeatureLevels +// Array of any of the following: +// D3D_FEATURE_LEVEL_11_0 +// D3D_FEATURE_LEVEL_10_1 +// D3D_FEATURE_LEVEL_10_0 +// D3D_FEATURE_LEVEL_9_3 +// D3D_FEATURE_LEVEL_9_2 +// D3D_FEATURE_LEVEL_9_1 +// Order indicates sequence in which instantiation will be attempted. If +// NULL, then the implied order is the same as previously listed (i.e. +// prefer most features available). +// FeatureLevels +// Size of feature levels array. +// SDKVersion +// SDK version. Use the D3D11_SDK_VERSION macro. +// pSwapChainDesc +// Swap chain description, may be NULL. +// ppSwapChain +// Pointer to returned interface. May be NULL. +// ppDevice +// Pointer to returned interface. May be NULL. +// pFeatureLevel +// Pointer to returned feature level. May be NULL. +// ppImmediateContext +// Pointer to returned interface. May be NULL. +// +// Return Values +// Any of those documented for +// CreateDXGIFactory1 +// IDXGIFactory::EnumAdapters +// IDXGIAdapter::RegisterDriver +// D3D11CreateDevice +// IDXGIFactory::CreateSwapChain +// +/////////////////////////////////////////////////////////////////////////// +typedef HRESULT (WINAPI* PFN_D3D11_CREATE_DEVICE_AND_SWAP_CHAIN)( __in_opt IDXGIAdapter*, + D3D_DRIVER_TYPE, HMODULE, UINT, + __in_ecount_opt( FeatureLevels ) CONST D3D_FEATURE_LEVEL*, + UINT FeatureLevels, UINT, __in_opt CONST DXGI_SWAP_CHAIN_DESC*, + __out_opt IDXGISwapChain**, __out_opt ID3D11Device**, + __out_opt D3D_FEATURE_LEVEL*, __out_opt ID3D11DeviceContext** ); + +HRESULT WINAPI D3D11CreateDeviceAndSwapChain( + __in_opt IDXGIAdapter* pAdapter, + D3D_DRIVER_TYPE DriverType, + HMODULE Software, + UINT Flags, + __in_ecount_opt( FeatureLevels ) CONST D3D_FEATURE_LEVEL* pFeatureLevels, + UINT FeatureLevels, + UINT SDKVersion, + __in_opt CONST DXGI_SWAP_CHAIN_DESC* pSwapChainDesc, + __out_opt IDXGISwapChain** ppSwapChain, + __out_opt ID3D11Device** ppDevice, + __out_opt D3D_FEATURE_LEVEL* pFeatureLevel, + __out_opt ID3D11DeviceContext** ppImmediateContext ); + +DEFINE_GUID(IID_ID3D11DeviceChild,0x1841e5c8,0x16b0,0x489b,0xbc,0xc8,0x44,0xcf,0xb0,0xd5,0xde,0xae); +DEFINE_GUID(IID_ID3D11DepthStencilState,0x03823efb,0x8d8f,0x4e1c,0x9a,0xa2,0xf6,0x4b,0xb2,0xcb,0xfd,0xf1); +DEFINE_GUID(IID_ID3D11BlendState,0x75b68faa,0x347d,0x4159,0x8f,0x45,0xa0,0x64,0x0f,0x01,0xcd,0x9a); +DEFINE_GUID(IID_ID3D11RasterizerState,0x9bb4ab81,0xab1a,0x4d8f,0xb5,0x06,0xfc,0x04,0x20,0x0b,0x6e,0xe7); +DEFINE_GUID(IID_ID3D11Resource,0xdc8e63f3,0xd12b,0x4952,0xb4,0x7b,0x5e,0x45,0x02,0x6a,0x86,0x2d); +DEFINE_GUID(IID_ID3D11Buffer,0x48570b85,0xd1ee,0x4fcd,0xa2,0x50,0xeb,0x35,0x07,0x22,0xb0,0x37); +DEFINE_GUID(IID_ID3D11Texture1D,0xf8fb5c27,0xc6b3,0x4f75,0xa4,0xc8,0x43,0x9a,0xf2,0xef,0x56,0x4c); +DEFINE_GUID(IID_ID3D11Texture2D,0x6f15aaf2,0xd208,0x4e89,0x9a,0xb4,0x48,0x95,0x35,0xd3,0x4f,0x9c); +DEFINE_GUID(IID_ID3D11Texture3D,0x037e866e,0xf56d,0x4357,0xa8,0xaf,0x9d,0xab,0xbe,0x6e,0x25,0x0e); +DEFINE_GUID(IID_ID3D11View,0x839d1216,0xbb2e,0x412b,0xb7,0xf4,0xa9,0xdb,0xeb,0xe0,0x8e,0xd1); +DEFINE_GUID(IID_ID3D11ShaderResourceView,0xb0e06fe0,0x8192,0x4e1a,0xb1,0xca,0x36,0xd7,0x41,0x47,0x10,0xb2); +DEFINE_GUID(IID_ID3D11RenderTargetView,0xdfdba067,0x0b8d,0x4865,0x87,0x5b,0xd7,0xb4,0x51,0x6c,0xc1,0x64); +DEFINE_GUID(IID_ID3D11DepthStencilView,0x9fdac92a,0x1876,0x48c3,0xaf,0xad,0x25,0xb9,0x4f,0x84,0xa9,0xb6); +DEFINE_GUID(IID_ID3D11UnorderedAccessView,0x28acf509,0x7f5c,0x48f6,0x86,0x11,0xf3,0x16,0x01,0x0a,0x63,0x80); +DEFINE_GUID(IID_ID3D11VertexShader,0x3b301d64,0xd678,0x4289,0x88,0x97,0x22,0xf8,0x92,0x8b,0x72,0xf3); +DEFINE_GUID(IID_ID3D11HullShader,0x8e5c6061,0x628a,0x4c8e,0x82,0x64,0xbb,0xe4,0x5c,0xb3,0xd5,0xdd); +DEFINE_GUID(IID_ID3D11DomainShader,0xf582c508,0x0f36,0x490c,0x99,0x77,0x31,0xee,0xce,0x26,0x8c,0xfa); +DEFINE_GUID(IID_ID3D11GeometryShader,0x38325b96,0xeffb,0x4022,0xba,0x02,0x2e,0x79,0x5b,0x70,0x27,0x5c); +DEFINE_GUID(IID_ID3D11PixelShader,0xea82e40d,0x51dc,0x4f33,0x93,0xd4,0xdb,0x7c,0x91,0x25,0xae,0x8c); +DEFINE_GUID(IID_ID3D11ComputeShader,0x4f5b196e,0xc2bd,0x495e,0xbd,0x01,0x1f,0xde,0xd3,0x8e,0x49,0x69); +DEFINE_GUID(IID_ID3D11InputLayout,0xe4819ddc,0x4cf0,0x4025,0xbd,0x26,0x5d,0xe8,0x2a,0x3e,0x07,0xb7); +DEFINE_GUID(IID_ID3D11SamplerState,0xda6fea51,0x564c,0x4487,0x98,0x10,0xf0,0xd0,0xf9,0xb4,0xe3,0xa5); +DEFINE_GUID(IID_ID3D11Asynchronous,0x4b35d0cd,0x1e15,0x4258,0x9c,0x98,0x1b,0x13,0x33,0xf6,0xdd,0x3b); +DEFINE_GUID(IID_ID3D11Query,0xd6c00747,0x87b7,0x425e,0xb8,0x4d,0x44,0xd1,0x08,0x56,0x0a,0xfd); +DEFINE_GUID(IID_ID3D11Predicate,0x9eb576dd,0x9f77,0x4d86,0x81,0xaa,0x8b,0xab,0x5f,0xe4,0x90,0xe2); +DEFINE_GUID(IID_ID3D11Counter,0x6e8c49fb,0xa371,0x4770,0xb4,0x40,0x29,0x08,0x60,0x22,0xb7,0x41); +DEFINE_GUID(IID_ID3D11ClassInstance,0xa6cd7faa,0xb0b7,0x4a2f,0x94,0x36,0x86,0x62,0xa6,0x57,0x97,0xcb); +DEFINE_GUID(IID_ID3D11ClassLinkage,0xddf57cba,0x9543,0x46e4,0xa1,0x2b,0xf2,0x07,0xa0,0xfe,0x7f,0xed); +DEFINE_GUID(IID_ID3D11CommandList,0xa24bc4d1,0x769e,0x43f7,0x80,0x13,0x98,0xff,0x56,0x6c,0x18,0xe2); +DEFINE_GUID(IID_ID3D11DeviceContext,0xc0bfa96c,0xe089,0x44fb,0x8e,0xaf,0x26,0xf8,0x79,0x61,0x90,0xda); +DEFINE_GUID(IID_ID3D11Device,0xdb6f6ddb,0xac77,0x4e88,0x82,0x53,0x81,0x9d,0xf9,0xbb,0xf1,0x40); + + +extern RPC_IF_HANDLE __MIDL_itf_d3d11_0000_0031_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d11_0000_0031_v0_0_s_ifspec; + +/* Additional Prototypes for ALL interfaces */ + +/* end of Additional Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/MediaClient/MediaClient/directx/include/D3D11SDKLayers.h b/MediaClient/MediaClient/directx/include/D3D11SDKLayers.h new file mode 100644 index 0000000..5970f81 --- /dev/null +++ b/MediaClient/MediaClient/directx/include/D3D11SDKLayers.h @@ -0,0 +1,1669 @@ + + +/* this ALWAYS GENERATED file contains the definitions for the interfaces */ + + + /* File created by MIDL compiler version 7.00.0555 */ +/* Compiler settings for d3d11sdklayers.idl: + Oicf, W1, Zp8, env=Win64 (32b run), target_arch=AMD64 7.00.0555 + protocol : all , ms_ext, c_ext, robust + error checks: allocation ref bounds_check enum stub_data + VC __declspec() decoration level: + __declspec(uuid()), __declspec(selectany), __declspec(novtable) + DECLSPEC_UUID(), MIDL_INTERFACE() +*/ +/* @@MIDL_FILE_HEADING( ) */ + +#pragma warning( disable: 4049 ) /* more than 64k source lines */ + + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCNDR_H_VERSION__ +#define __REQUIRED_RPCNDR_H_VERSION__ 475 +#endif + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCSAL_H_VERSION__ +#define __REQUIRED_RPCSAL_H_VERSION__ 100 +#endif + +#include "rpc.h" +#include "rpcndr.h" + +#ifndef __RPCNDR_H_VERSION__ +#error this stub requires an updated version of +#endif // __RPCNDR_H_VERSION__ + +#ifndef COM_NO_WINDOWS_H +#include "windows.h" +#include "ole2.h" +#endif /*COM_NO_WINDOWS_H*/ + +#ifndef __d3d11sdklayers_h__ +#define __d3d11sdklayers_h__ + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +/* Forward Declarations */ + +#ifndef __ID3D11Debug_FWD_DEFINED__ +#define __ID3D11Debug_FWD_DEFINED__ +typedef interface ID3D11Debug ID3D11Debug; +#endif /* __ID3D11Debug_FWD_DEFINED__ */ + + +#ifndef __ID3D11SwitchToRef_FWD_DEFINED__ +#define __ID3D11SwitchToRef_FWD_DEFINED__ +typedef interface ID3D11SwitchToRef ID3D11SwitchToRef; +#endif /* __ID3D11SwitchToRef_FWD_DEFINED__ */ + + +#ifndef __ID3D11InfoQueue_FWD_DEFINED__ +#define __ID3D11InfoQueue_FWD_DEFINED__ +typedef interface ID3D11InfoQueue ID3D11InfoQueue; +#endif /* __ID3D11InfoQueue_FWD_DEFINED__ */ + + +/* header files for imported files */ +#include "oaidl.h" +#include "ocidl.h" +#include "d3d11.h" + +#ifdef __cplusplus +extern "C"{ +#endif + + +/* interface __MIDL_itf_d3d11sdklayers_0000_0000 */ +/* [local] */ + +#define D3D11_SDK_LAYERS_VERSION ( 1 ) + +#define D3D11_DEBUG_FEATURE_FLUSH_PER_RENDER_OP ( 0x1 ) + +#define D3D11_DEBUG_FEATURE_FINISH_PER_RENDER_OP ( 0x2 ) + +#define D3D11_DEBUG_FEATURE_PRESENT_PER_RENDER_OP ( 0x4 ) + +typedef +enum D3D11_RLDO_FLAGS + { D3D11_RLDO_SUMMARY = 0x1, + D3D11_RLDO_DETAIL = 0x2 + } D3D11_RLDO_FLAGS; + +#if !defined( D3D11_NO_HELPERS ) && defined( __cplusplus ) +} +inline D3D11_RLDO_FLAGS operator~( D3D11_RLDO_FLAGS a ) +{ return D3D11_RLDO_FLAGS( ~UINT( a ) ); } +inline D3D11_RLDO_FLAGS operator&( D3D11_RLDO_FLAGS a, D3D11_RLDO_FLAGS b ) +{ return D3D11_RLDO_FLAGS( UINT( a ) & UINT( b ) ); } +inline D3D11_RLDO_FLAGS operator|( D3D11_RLDO_FLAGS a, D3D11_RLDO_FLAGS b ) +{ return D3D11_RLDO_FLAGS( UINT( a ) | UINT( b ) ); } +inline D3D11_RLDO_FLAGS operator^( D3D11_RLDO_FLAGS a, D3D11_RLDO_FLAGS b ) +{ return D3D11_RLDO_FLAGS( UINT( a ) ^ UINT( b ) ); } +inline D3D11_RLDO_FLAGS& operator&=( D3D11_RLDO_FLAGS& a, D3D11_RLDO_FLAGS b ) +{ a = a & b; return a; } +inline D3D11_RLDO_FLAGS& operator|=( D3D11_RLDO_FLAGS& a, D3D11_RLDO_FLAGS b ) +{ a = a | b; return a; } +inline D3D11_RLDO_FLAGS& operator^=( D3D11_RLDO_FLAGS& a, D3D11_RLDO_FLAGS b ) +{ a = a ^ b; return a; } +extern "C"{ +#endif + + +extern RPC_IF_HANDLE __MIDL_itf_d3d11sdklayers_0000_0000_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d11sdklayers_0000_0000_v0_0_s_ifspec; + +#ifndef __ID3D11Debug_INTERFACE_DEFINED__ +#define __ID3D11Debug_INTERFACE_DEFINED__ + +/* interface ID3D11Debug */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D11Debug; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("79cf2233-7536-4948-9d36-1e4692dc5760") + ID3D11Debug : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SetFeatureMask( + UINT Mask) = 0; + + virtual UINT STDMETHODCALLTYPE GetFeatureMask( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetPresentPerRenderOpDelay( + UINT Milliseconds) = 0; + + virtual UINT STDMETHODCALLTYPE GetPresentPerRenderOpDelay( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetSwapChain( + /* [annotation] */ + __in_opt IDXGISwapChain *pSwapChain) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetSwapChain( + /* [annotation] */ + __out IDXGISwapChain **ppSwapChain) = 0; + + virtual HRESULT STDMETHODCALLTYPE ValidateContext( + /* [annotation] */ + __in ID3D11DeviceContext *pContext) = 0; + + virtual HRESULT STDMETHODCALLTYPE ReportLiveDeviceObjects( + D3D11_RLDO_FLAGS Flags) = 0; + + virtual HRESULT STDMETHODCALLTYPE ValidateContextForDispatch( + /* [annotation] */ + __in ID3D11DeviceContext *pContext) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D11DebugVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D11Debug * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D11Debug * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D11Debug * This); + + HRESULT ( STDMETHODCALLTYPE *SetFeatureMask )( + ID3D11Debug * This, + UINT Mask); + + UINT ( STDMETHODCALLTYPE *GetFeatureMask )( + ID3D11Debug * This); + + HRESULT ( STDMETHODCALLTYPE *SetPresentPerRenderOpDelay )( + ID3D11Debug * This, + UINT Milliseconds); + + UINT ( STDMETHODCALLTYPE *GetPresentPerRenderOpDelay )( + ID3D11Debug * This); + + HRESULT ( STDMETHODCALLTYPE *SetSwapChain )( + ID3D11Debug * This, + /* [annotation] */ + __in_opt IDXGISwapChain *pSwapChain); + + HRESULT ( STDMETHODCALLTYPE *GetSwapChain )( + ID3D11Debug * This, + /* [annotation] */ + __out IDXGISwapChain **ppSwapChain); + + HRESULT ( STDMETHODCALLTYPE *ValidateContext )( + ID3D11Debug * This, + /* [annotation] */ + __in ID3D11DeviceContext *pContext); + + HRESULT ( STDMETHODCALLTYPE *ReportLiveDeviceObjects )( + ID3D11Debug * This, + D3D11_RLDO_FLAGS Flags); + + HRESULT ( STDMETHODCALLTYPE *ValidateContextForDispatch )( + ID3D11Debug * This, + /* [annotation] */ + __in ID3D11DeviceContext *pContext); + + END_INTERFACE + } ID3D11DebugVtbl; + + interface ID3D11Debug + { + CONST_VTBL struct ID3D11DebugVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D11Debug_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D11Debug_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D11Debug_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D11Debug_SetFeatureMask(This,Mask) \ + ( (This)->lpVtbl -> SetFeatureMask(This,Mask) ) + +#define ID3D11Debug_GetFeatureMask(This) \ + ( (This)->lpVtbl -> GetFeatureMask(This) ) + +#define ID3D11Debug_SetPresentPerRenderOpDelay(This,Milliseconds) \ + ( (This)->lpVtbl -> SetPresentPerRenderOpDelay(This,Milliseconds) ) + +#define ID3D11Debug_GetPresentPerRenderOpDelay(This) \ + ( (This)->lpVtbl -> GetPresentPerRenderOpDelay(This) ) + +#define ID3D11Debug_SetSwapChain(This,pSwapChain) \ + ( (This)->lpVtbl -> SetSwapChain(This,pSwapChain) ) + +#define ID3D11Debug_GetSwapChain(This,ppSwapChain) \ + ( (This)->lpVtbl -> GetSwapChain(This,ppSwapChain) ) + +#define ID3D11Debug_ValidateContext(This,pContext) \ + ( (This)->lpVtbl -> ValidateContext(This,pContext) ) + +#define ID3D11Debug_ReportLiveDeviceObjects(This,Flags) \ + ( (This)->lpVtbl -> ReportLiveDeviceObjects(This,Flags) ) + +#define ID3D11Debug_ValidateContextForDispatch(This,pContext) \ + ( (This)->lpVtbl -> ValidateContextForDispatch(This,pContext) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D11Debug_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D11SwitchToRef_INTERFACE_DEFINED__ +#define __ID3D11SwitchToRef_INTERFACE_DEFINED__ + +/* interface ID3D11SwitchToRef */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D11SwitchToRef; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("1ef337e3-58e7-4f83-a692-db221f5ed47e") + ID3D11SwitchToRef : public IUnknown + { + public: + virtual BOOL STDMETHODCALLTYPE SetUseRef( + BOOL UseRef) = 0; + + virtual BOOL STDMETHODCALLTYPE GetUseRef( void) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D11SwitchToRefVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D11SwitchToRef * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D11SwitchToRef * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D11SwitchToRef * This); + + BOOL ( STDMETHODCALLTYPE *SetUseRef )( + ID3D11SwitchToRef * This, + BOOL UseRef); + + BOOL ( STDMETHODCALLTYPE *GetUseRef )( + ID3D11SwitchToRef * This); + + END_INTERFACE + } ID3D11SwitchToRefVtbl; + + interface ID3D11SwitchToRef + { + CONST_VTBL struct ID3D11SwitchToRefVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D11SwitchToRef_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D11SwitchToRef_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D11SwitchToRef_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D11SwitchToRef_SetUseRef(This,UseRef) \ + ( (This)->lpVtbl -> SetUseRef(This,UseRef) ) + +#define ID3D11SwitchToRef_GetUseRef(This) \ + ( (This)->lpVtbl -> GetUseRef(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D11SwitchToRef_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d11sdklayers_0000_0002 */ +/* [local] */ + +typedef +enum D3D11_MESSAGE_CATEGORY + { D3D11_MESSAGE_CATEGORY_APPLICATION_DEFINED = 0, + D3D11_MESSAGE_CATEGORY_MISCELLANEOUS = ( D3D11_MESSAGE_CATEGORY_APPLICATION_DEFINED + 1 ) , + D3D11_MESSAGE_CATEGORY_INITIALIZATION = ( D3D11_MESSAGE_CATEGORY_MISCELLANEOUS + 1 ) , + D3D11_MESSAGE_CATEGORY_CLEANUP = ( D3D11_MESSAGE_CATEGORY_INITIALIZATION + 1 ) , + D3D11_MESSAGE_CATEGORY_COMPILATION = ( D3D11_MESSAGE_CATEGORY_CLEANUP + 1 ) , + D3D11_MESSAGE_CATEGORY_STATE_CREATION = ( D3D11_MESSAGE_CATEGORY_COMPILATION + 1 ) , + D3D11_MESSAGE_CATEGORY_STATE_SETTING = ( D3D11_MESSAGE_CATEGORY_STATE_CREATION + 1 ) , + D3D11_MESSAGE_CATEGORY_STATE_GETTING = ( D3D11_MESSAGE_CATEGORY_STATE_SETTING + 1 ) , + D3D11_MESSAGE_CATEGORY_RESOURCE_MANIPULATION = ( D3D11_MESSAGE_CATEGORY_STATE_GETTING + 1 ) , + D3D11_MESSAGE_CATEGORY_EXECUTION = ( D3D11_MESSAGE_CATEGORY_RESOURCE_MANIPULATION + 1 ) + } D3D11_MESSAGE_CATEGORY; + +typedef +enum D3D11_MESSAGE_SEVERITY + { D3D11_MESSAGE_SEVERITY_CORRUPTION = 0, + D3D11_MESSAGE_SEVERITY_ERROR = ( D3D11_MESSAGE_SEVERITY_CORRUPTION + 1 ) , + D3D11_MESSAGE_SEVERITY_WARNING = ( D3D11_MESSAGE_SEVERITY_ERROR + 1 ) , + D3D11_MESSAGE_SEVERITY_INFO = ( D3D11_MESSAGE_SEVERITY_WARNING + 1 ) + } D3D11_MESSAGE_SEVERITY; + +typedef +enum D3D11_MESSAGE_ID + { D3D11_MESSAGE_ID_UNKNOWN = 0, + D3D11_MESSAGE_ID_DEVICE_IASETVERTEXBUFFERS_HAZARD = ( D3D11_MESSAGE_ID_UNKNOWN + 1 ) , + D3D11_MESSAGE_ID_DEVICE_IASETINDEXBUFFER_HAZARD = ( D3D11_MESSAGE_ID_DEVICE_IASETVERTEXBUFFERS_HAZARD + 1 ) , + D3D11_MESSAGE_ID_DEVICE_VSSETSHADERRESOURCES_HAZARD = ( D3D11_MESSAGE_ID_DEVICE_IASETINDEXBUFFER_HAZARD + 1 ) , + D3D11_MESSAGE_ID_DEVICE_VSSETCONSTANTBUFFERS_HAZARD = ( D3D11_MESSAGE_ID_DEVICE_VSSETSHADERRESOURCES_HAZARD + 1 ) , + D3D11_MESSAGE_ID_DEVICE_GSSETSHADERRESOURCES_HAZARD = ( D3D11_MESSAGE_ID_DEVICE_VSSETCONSTANTBUFFERS_HAZARD + 1 ) , + D3D11_MESSAGE_ID_DEVICE_GSSETCONSTANTBUFFERS_HAZARD = ( D3D11_MESSAGE_ID_DEVICE_GSSETSHADERRESOURCES_HAZARD + 1 ) , + D3D11_MESSAGE_ID_DEVICE_PSSETSHADERRESOURCES_HAZARD = ( D3D11_MESSAGE_ID_DEVICE_GSSETCONSTANTBUFFERS_HAZARD + 1 ) , + D3D11_MESSAGE_ID_DEVICE_PSSETCONSTANTBUFFERS_HAZARD = ( D3D11_MESSAGE_ID_DEVICE_PSSETSHADERRESOURCES_HAZARD + 1 ) , + D3D11_MESSAGE_ID_DEVICE_OMSETRENDERTARGETS_HAZARD = ( D3D11_MESSAGE_ID_DEVICE_PSSETCONSTANTBUFFERS_HAZARD + 1 ) , + D3D11_MESSAGE_ID_DEVICE_SOSETTARGETS_HAZARD = ( D3D11_MESSAGE_ID_DEVICE_OMSETRENDERTARGETS_HAZARD + 1 ) , + D3D11_MESSAGE_ID_STRING_FROM_APPLICATION = ( D3D11_MESSAGE_ID_DEVICE_SOSETTARGETS_HAZARD + 1 ) , + D3D11_MESSAGE_ID_CORRUPTED_THIS = ( D3D11_MESSAGE_ID_STRING_FROM_APPLICATION + 1 ) , + D3D11_MESSAGE_ID_CORRUPTED_PARAMETER1 = ( D3D11_MESSAGE_ID_CORRUPTED_THIS + 1 ) , + D3D11_MESSAGE_ID_CORRUPTED_PARAMETER2 = ( D3D11_MESSAGE_ID_CORRUPTED_PARAMETER1 + 1 ) , + D3D11_MESSAGE_ID_CORRUPTED_PARAMETER3 = ( D3D11_MESSAGE_ID_CORRUPTED_PARAMETER2 + 1 ) , + D3D11_MESSAGE_ID_CORRUPTED_PARAMETER4 = ( D3D11_MESSAGE_ID_CORRUPTED_PARAMETER3 + 1 ) , + D3D11_MESSAGE_ID_CORRUPTED_PARAMETER5 = ( D3D11_MESSAGE_ID_CORRUPTED_PARAMETER4 + 1 ) , + D3D11_MESSAGE_ID_CORRUPTED_PARAMETER6 = ( D3D11_MESSAGE_ID_CORRUPTED_PARAMETER5 + 1 ) , + D3D11_MESSAGE_ID_CORRUPTED_PARAMETER7 = ( D3D11_MESSAGE_ID_CORRUPTED_PARAMETER6 + 1 ) , + D3D11_MESSAGE_ID_CORRUPTED_PARAMETER8 = ( D3D11_MESSAGE_ID_CORRUPTED_PARAMETER7 + 1 ) , + D3D11_MESSAGE_ID_CORRUPTED_PARAMETER9 = ( D3D11_MESSAGE_ID_CORRUPTED_PARAMETER8 + 1 ) , + D3D11_MESSAGE_ID_CORRUPTED_PARAMETER10 = ( D3D11_MESSAGE_ID_CORRUPTED_PARAMETER9 + 1 ) , + D3D11_MESSAGE_ID_CORRUPTED_PARAMETER11 = ( D3D11_MESSAGE_ID_CORRUPTED_PARAMETER10 + 1 ) , + D3D11_MESSAGE_ID_CORRUPTED_PARAMETER12 = ( D3D11_MESSAGE_ID_CORRUPTED_PARAMETER11 + 1 ) , + D3D11_MESSAGE_ID_CORRUPTED_PARAMETER13 = ( D3D11_MESSAGE_ID_CORRUPTED_PARAMETER12 + 1 ) , + D3D11_MESSAGE_ID_CORRUPTED_PARAMETER14 = ( D3D11_MESSAGE_ID_CORRUPTED_PARAMETER13 + 1 ) , + D3D11_MESSAGE_ID_CORRUPTED_PARAMETER15 = ( D3D11_MESSAGE_ID_CORRUPTED_PARAMETER14 + 1 ) , + D3D11_MESSAGE_ID_CORRUPTED_MULTITHREADING = ( D3D11_MESSAGE_ID_CORRUPTED_PARAMETER15 + 1 ) , + D3D11_MESSAGE_ID_MESSAGE_REPORTING_OUTOFMEMORY = ( D3D11_MESSAGE_ID_CORRUPTED_MULTITHREADING + 1 ) , + D3D11_MESSAGE_ID_IASETINPUTLAYOUT_UNBINDDELETINGOBJECT = ( D3D11_MESSAGE_ID_MESSAGE_REPORTING_OUTOFMEMORY + 1 ) , + D3D11_MESSAGE_ID_IASETVERTEXBUFFERS_UNBINDDELETINGOBJECT = ( D3D11_MESSAGE_ID_IASETINPUTLAYOUT_UNBINDDELETINGOBJECT + 1 ) , + D3D11_MESSAGE_ID_IASETINDEXBUFFER_UNBINDDELETINGOBJECT = ( D3D11_MESSAGE_ID_IASETVERTEXBUFFERS_UNBINDDELETINGOBJECT + 1 ) , + D3D11_MESSAGE_ID_VSSETSHADER_UNBINDDELETINGOBJECT = ( D3D11_MESSAGE_ID_IASETINDEXBUFFER_UNBINDDELETINGOBJECT + 1 ) , + D3D11_MESSAGE_ID_VSSETSHADERRESOURCES_UNBINDDELETINGOBJECT = ( D3D11_MESSAGE_ID_VSSETSHADER_UNBINDDELETINGOBJECT + 1 ) , + D3D11_MESSAGE_ID_VSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT = ( D3D11_MESSAGE_ID_VSSETSHADERRESOURCES_UNBINDDELETINGOBJECT + 1 ) , + D3D11_MESSAGE_ID_VSSETSAMPLERS_UNBINDDELETINGOBJECT = ( D3D11_MESSAGE_ID_VSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT + 1 ) , + D3D11_MESSAGE_ID_GSSETSHADER_UNBINDDELETINGOBJECT = ( D3D11_MESSAGE_ID_VSSETSAMPLERS_UNBINDDELETINGOBJECT + 1 ) , + D3D11_MESSAGE_ID_GSSETSHADERRESOURCES_UNBINDDELETINGOBJECT = ( D3D11_MESSAGE_ID_GSSETSHADER_UNBINDDELETINGOBJECT + 1 ) , + D3D11_MESSAGE_ID_GSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT = ( D3D11_MESSAGE_ID_GSSETSHADERRESOURCES_UNBINDDELETINGOBJECT + 1 ) , + D3D11_MESSAGE_ID_GSSETSAMPLERS_UNBINDDELETINGOBJECT = ( D3D11_MESSAGE_ID_GSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT + 1 ) , + D3D11_MESSAGE_ID_SOSETTARGETS_UNBINDDELETINGOBJECT = ( D3D11_MESSAGE_ID_GSSETSAMPLERS_UNBINDDELETINGOBJECT + 1 ) , + D3D11_MESSAGE_ID_PSSETSHADER_UNBINDDELETINGOBJECT = ( D3D11_MESSAGE_ID_SOSETTARGETS_UNBINDDELETINGOBJECT + 1 ) , + D3D11_MESSAGE_ID_PSSETSHADERRESOURCES_UNBINDDELETINGOBJECT = ( D3D11_MESSAGE_ID_PSSETSHADER_UNBINDDELETINGOBJECT + 1 ) , + D3D11_MESSAGE_ID_PSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT = ( D3D11_MESSAGE_ID_PSSETSHADERRESOURCES_UNBINDDELETINGOBJECT + 1 ) , + D3D11_MESSAGE_ID_PSSETSAMPLERS_UNBINDDELETINGOBJECT = ( D3D11_MESSAGE_ID_PSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT + 1 ) , + D3D11_MESSAGE_ID_RSSETSTATE_UNBINDDELETINGOBJECT = ( D3D11_MESSAGE_ID_PSSETSAMPLERS_UNBINDDELETINGOBJECT + 1 ) , + D3D11_MESSAGE_ID_OMSETBLENDSTATE_UNBINDDELETINGOBJECT = ( D3D11_MESSAGE_ID_RSSETSTATE_UNBINDDELETINGOBJECT + 1 ) , + D3D11_MESSAGE_ID_OMSETDEPTHSTENCILSTATE_UNBINDDELETINGOBJECT = ( D3D11_MESSAGE_ID_OMSETBLENDSTATE_UNBINDDELETINGOBJECT + 1 ) , + D3D11_MESSAGE_ID_OMSETRENDERTARGETS_UNBINDDELETINGOBJECT = ( D3D11_MESSAGE_ID_OMSETDEPTHSTENCILSTATE_UNBINDDELETINGOBJECT + 1 ) , + D3D11_MESSAGE_ID_SETPREDICATION_UNBINDDELETINGOBJECT = ( D3D11_MESSAGE_ID_OMSETRENDERTARGETS_UNBINDDELETINGOBJECT + 1 ) , + D3D11_MESSAGE_ID_GETPRIVATEDATA_MOREDATA = ( D3D11_MESSAGE_ID_SETPREDICATION_UNBINDDELETINGOBJECT + 1 ) , + D3D11_MESSAGE_ID_SETPRIVATEDATA_INVALIDFREEDATA = ( D3D11_MESSAGE_ID_GETPRIVATEDATA_MOREDATA + 1 ) , + D3D11_MESSAGE_ID_SETPRIVATEDATA_INVALIDIUNKNOWN = ( D3D11_MESSAGE_ID_SETPRIVATEDATA_INVALIDFREEDATA + 1 ) , + D3D11_MESSAGE_ID_SETPRIVATEDATA_INVALIDFLAGS = ( D3D11_MESSAGE_ID_SETPRIVATEDATA_INVALIDIUNKNOWN + 1 ) , + D3D11_MESSAGE_ID_SETPRIVATEDATA_CHANGINGPARAMS = ( D3D11_MESSAGE_ID_SETPRIVATEDATA_INVALIDFLAGS + 1 ) , + D3D11_MESSAGE_ID_SETPRIVATEDATA_OUTOFMEMORY = ( D3D11_MESSAGE_ID_SETPRIVATEDATA_CHANGINGPARAMS + 1 ) , + D3D11_MESSAGE_ID_CREATEBUFFER_UNRECOGNIZEDFORMAT = ( D3D11_MESSAGE_ID_SETPRIVATEDATA_OUTOFMEMORY + 1 ) , + D3D11_MESSAGE_ID_CREATEBUFFER_INVALIDSAMPLES = ( D3D11_MESSAGE_ID_CREATEBUFFER_UNRECOGNIZEDFORMAT + 1 ) , + D3D11_MESSAGE_ID_CREATEBUFFER_UNRECOGNIZEDUSAGE = ( D3D11_MESSAGE_ID_CREATEBUFFER_INVALIDSAMPLES + 1 ) , + D3D11_MESSAGE_ID_CREATEBUFFER_UNRECOGNIZEDBINDFLAGS = ( D3D11_MESSAGE_ID_CREATEBUFFER_UNRECOGNIZEDUSAGE + 1 ) , + D3D11_MESSAGE_ID_CREATEBUFFER_UNRECOGNIZEDCPUACCESSFLAGS = ( D3D11_MESSAGE_ID_CREATEBUFFER_UNRECOGNIZEDBINDFLAGS + 1 ) , + D3D11_MESSAGE_ID_CREATEBUFFER_UNRECOGNIZEDMISCFLAGS = ( D3D11_MESSAGE_ID_CREATEBUFFER_UNRECOGNIZEDCPUACCESSFLAGS + 1 ) , + D3D11_MESSAGE_ID_CREATEBUFFER_INVALIDCPUACCESSFLAGS = ( D3D11_MESSAGE_ID_CREATEBUFFER_UNRECOGNIZEDMISCFLAGS + 1 ) , + D3D11_MESSAGE_ID_CREATEBUFFER_INVALIDBINDFLAGS = ( D3D11_MESSAGE_ID_CREATEBUFFER_INVALIDCPUACCESSFLAGS + 1 ) , + D3D11_MESSAGE_ID_CREATEBUFFER_INVALIDINITIALDATA = ( D3D11_MESSAGE_ID_CREATEBUFFER_INVALIDBINDFLAGS + 1 ) , + D3D11_MESSAGE_ID_CREATEBUFFER_INVALIDDIMENSIONS = ( D3D11_MESSAGE_ID_CREATEBUFFER_INVALIDINITIALDATA + 1 ) , + D3D11_MESSAGE_ID_CREATEBUFFER_INVALIDMIPLEVELS = ( D3D11_MESSAGE_ID_CREATEBUFFER_INVALIDDIMENSIONS + 1 ) , + D3D11_MESSAGE_ID_CREATEBUFFER_INVALIDMISCFLAGS = ( D3D11_MESSAGE_ID_CREATEBUFFER_INVALIDMIPLEVELS + 1 ) , + D3D11_MESSAGE_ID_CREATEBUFFER_INVALIDARG_RETURN = ( D3D11_MESSAGE_ID_CREATEBUFFER_INVALIDMISCFLAGS + 1 ) , + D3D11_MESSAGE_ID_CREATEBUFFER_OUTOFMEMORY_RETURN = ( D3D11_MESSAGE_ID_CREATEBUFFER_INVALIDARG_RETURN + 1 ) , + D3D11_MESSAGE_ID_CREATEBUFFER_NULLDESC = ( D3D11_MESSAGE_ID_CREATEBUFFER_OUTOFMEMORY_RETURN + 1 ) , + D3D11_MESSAGE_ID_CREATEBUFFER_INVALIDCONSTANTBUFFERBINDINGS = ( D3D11_MESSAGE_ID_CREATEBUFFER_NULLDESC + 1 ) , + D3D11_MESSAGE_ID_CREATEBUFFER_LARGEALLOCATION = ( D3D11_MESSAGE_ID_CREATEBUFFER_INVALIDCONSTANTBUFFERBINDINGS + 1 ) , + D3D11_MESSAGE_ID_CREATETEXTURE1D_UNRECOGNIZEDFORMAT = ( D3D11_MESSAGE_ID_CREATEBUFFER_LARGEALLOCATION + 1 ) , + D3D11_MESSAGE_ID_CREATETEXTURE1D_UNSUPPORTEDFORMAT = ( D3D11_MESSAGE_ID_CREATETEXTURE1D_UNRECOGNIZEDFORMAT + 1 ) , + D3D11_MESSAGE_ID_CREATETEXTURE1D_INVALIDSAMPLES = ( D3D11_MESSAGE_ID_CREATETEXTURE1D_UNSUPPORTEDFORMAT + 1 ) , + D3D11_MESSAGE_ID_CREATETEXTURE1D_UNRECOGNIZEDUSAGE = ( D3D11_MESSAGE_ID_CREATETEXTURE1D_INVALIDSAMPLES + 1 ) , + D3D11_MESSAGE_ID_CREATETEXTURE1D_UNRECOGNIZEDBINDFLAGS = ( D3D11_MESSAGE_ID_CREATETEXTURE1D_UNRECOGNIZEDUSAGE + 1 ) , + D3D11_MESSAGE_ID_CREATETEXTURE1D_UNRECOGNIZEDCPUACCESSFLAGS = ( D3D11_MESSAGE_ID_CREATETEXTURE1D_UNRECOGNIZEDBINDFLAGS + 1 ) , + D3D11_MESSAGE_ID_CREATETEXTURE1D_UNRECOGNIZEDMISCFLAGS = ( D3D11_MESSAGE_ID_CREATETEXTURE1D_UNRECOGNIZEDCPUACCESSFLAGS + 1 ) , + D3D11_MESSAGE_ID_CREATETEXTURE1D_INVALIDCPUACCESSFLAGS = ( D3D11_MESSAGE_ID_CREATETEXTURE1D_UNRECOGNIZEDMISCFLAGS + 1 ) , + D3D11_MESSAGE_ID_CREATETEXTURE1D_INVALIDBINDFLAGS = ( D3D11_MESSAGE_ID_CREATETEXTURE1D_INVALIDCPUACCESSFLAGS + 1 ) , + D3D11_MESSAGE_ID_CREATETEXTURE1D_INVALIDINITIALDATA = ( D3D11_MESSAGE_ID_CREATETEXTURE1D_INVALIDBINDFLAGS + 1 ) , + D3D11_MESSAGE_ID_CREATETEXTURE1D_INVALIDDIMENSIONS = ( D3D11_MESSAGE_ID_CREATETEXTURE1D_INVALIDINITIALDATA + 1 ) , + D3D11_MESSAGE_ID_CREATETEXTURE1D_INVALIDMIPLEVELS = ( D3D11_MESSAGE_ID_CREATETEXTURE1D_INVALIDDIMENSIONS + 1 ) , + D3D11_MESSAGE_ID_CREATETEXTURE1D_INVALIDMISCFLAGS = ( D3D11_MESSAGE_ID_CREATETEXTURE1D_INVALIDMIPLEVELS + 1 ) , + D3D11_MESSAGE_ID_CREATETEXTURE1D_INVALIDARG_RETURN = ( D3D11_MESSAGE_ID_CREATETEXTURE1D_INVALIDMISCFLAGS + 1 ) , + D3D11_MESSAGE_ID_CREATETEXTURE1D_OUTOFMEMORY_RETURN = ( D3D11_MESSAGE_ID_CREATETEXTURE1D_INVALIDARG_RETURN + 1 ) , + D3D11_MESSAGE_ID_CREATETEXTURE1D_NULLDESC = ( D3D11_MESSAGE_ID_CREATETEXTURE1D_OUTOFMEMORY_RETURN + 1 ) , + D3D11_MESSAGE_ID_CREATETEXTURE1D_LARGEALLOCATION = ( D3D11_MESSAGE_ID_CREATETEXTURE1D_NULLDESC + 1 ) , + D3D11_MESSAGE_ID_CREATETEXTURE2D_UNRECOGNIZEDFORMAT = ( D3D11_MESSAGE_ID_CREATETEXTURE1D_LARGEALLOCATION + 1 ) , + D3D11_MESSAGE_ID_CREATETEXTURE2D_UNSUPPORTEDFORMAT = ( D3D11_MESSAGE_ID_CREATETEXTURE2D_UNRECOGNIZEDFORMAT + 1 ) , + D3D11_MESSAGE_ID_CREATETEXTURE2D_INVALIDSAMPLES = ( D3D11_MESSAGE_ID_CREATETEXTURE2D_UNSUPPORTEDFORMAT + 1 ) , + D3D11_MESSAGE_ID_CREATETEXTURE2D_UNRECOGNIZEDUSAGE = ( D3D11_MESSAGE_ID_CREATETEXTURE2D_INVALIDSAMPLES + 1 ) , + D3D11_MESSAGE_ID_CREATETEXTURE2D_UNRECOGNIZEDBINDFLAGS = ( D3D11_MESSAGE_ID_CREATETEXTURE2D_UNRECOGNIZEDUSAGE + 1 ) , + D3D11_MESSAGE_ID_CREATETEXTURE2D_UNRECOGNIZEDCPUACCESSFLAGS = ( D3D11_MESSAGE_ID_CREATETEXTURE2D_UNRECOGNIZEDBINDFLAGS + 1 ) , + D3D11_MESSAGE_ID_CREATETEXTURE2D_UNRECOGNIZEDMISCFLAGS = ( D3D11_MESSAGE_ID_CREATETEXTURE2D_UNRECOGNIZEDCPUACCESSFLAGS + 1 ) , + D3D11_MESSAGE_ID_CREATETEXTURE2D_INVALIDCPUACCESSFLAGS = ( D3D11_MESSAGE_ID_CREATETEXTURE2D_UNRECOGNIZEDMISCFLAGS + 1 ) , + D3D11_MESSAGE_ID_CREATETEXTURE2D_INVALIDBINDFLAGS = ( D3D11_MESSAGE_ID_CREATETEXTURE2D_INVALIDCPUACCESSFLAGS + 1 ) , + D3D11_MESSAGE_ID_CREATETEXTURE2D_INVALIDINITIALDATA = ( D3D11_MESSAGE_ID_CREATETEXTURE2D_INVALIDBINDFLAGS + 1 ) , + D3D11_MESSAGE_ID_CREATETEXTURE2D_INVALIDDIMENSIONS = ( D3D11_MESSAGE_ID_CREATETEXTURE2D_INVALIDINITIALDATA + 1 ) , + D3D11_MESSAGE_ID_CREATETEXTURE2D_INVALIDMIPLEVELS = ( D3D11_MESSAGE_ID_CREATETEXTURE2D_INVALIDDIMENSIONS + 1 ) , + D3D11_MESSAGE_ID_CREATETEXTURE2D_INVALIDMISCFLAGS = ( D3D11_MESSAGE_ID_CREATETEXTURE2D_INVALIDMIPLEVELS + 1 ) , + D3D11_MESSAGE_ID_CREATETEXTURE2D_INVALIDARG_RETURN = ( D3D11_MESSAGE_ID_CREATETEXTURE2D_INVALIDMISCFLAGS + 1 ) , + D3D11_MESSAGE_ID_CREATETEXTURE2D_OUTOFMEMORY_RETURN = ( D3D11_MESSAGE_ID_CREATETEXTURE2D_INVALIDARG_RETURN + 1 ) , + D3D11_MESSAGE_ID_CREATETEXTURE2D_NULLDESC = ( D3D11_MESSAGE_ID_CREATETEXTURE2D_OUTOFMEMORY_RETURN + 1 ) , + D3D11_MESSAGE_ID_CREATETEXTURE2D_LARGEALLOCATION = ( D3D11_MESSAGE_ID_CREATETEXTURE2D_NULLDESC + 1 ) , + D3D11_MESSAGE_ID_CREATETEXTURE3D_UNRECOGNIZEDFORMAT = ( D3D11_MESSAGE_ID_CREATETEXTURE2D_LARGEALLOCATION + 1 ) , + D3D11_MESSAGE_ID_CREATETEXTURE3D_UNSUPPORTEDFORMAT = ( D3D11_MESSAGE_ID_CREATETEXTURE3D_UNRECOGNIZEDFORMAT + 1 ) , + D3D11_MESSAGE_ID_CREATETEXTURE3D_INVALIDSAMPLES = ( D3D11_MESSAGE_ID_CREATETEXTURE3D_UNSUPPORTEDFORMAT + 1 ) , + D3D11_MESSAGE_ID_CREATETEXTURE3D_UNRECOGNIZEDUSAGE = ( D3D11_MESSAGE_ID_CREATETEXTURE3D_INVALIDSAMPLES + 1 ) , + D3D11_MESSAGE_ID_CREATETEXTURE3D_UNRECOGNIZEDBINDFLAGS = ( D3D11_MESSAGE_ID_CREATETEXTURE3D_UNRECOGNIZEDUSAGE + 1 ) , + D3D11_MESSAGE_ID_CREATETEXTURE3D_UNRECOGNIZEDCPUACCESSFLAGS = ( D3D11_MESSAGE_ID_CREATETEXTURE3D_UNRECOGNIZEDBINDFLAGS + 1 ) , + D3D11_MESSAGE_ID_CREATETEXTURE3D_UNRECOGNIZEDMISCFLAGS = ( D3D11_MESSAGE_ID_CREATETEXTURE3D_UNRECOGNIZEDCPUACCESSFLAGS + 1 ) , + D3D11_MESSAGE_ID_CREATETEXTURE3D_INVALIDCPUACCESSFLAGS = ( D3D11_MESSAGE_ID_CREATETEXTURE3D_UNRECOGNIZEDMISCFLAGS + 1 ) , + D3D11_MESSAGE_ID_CREATETEXTURE3D_INVALIDBINDFLAGS = ( D3D11_MESSAGE_ID_CREATETEXTURE3D_INVALIDCPUACCESSFLAGS + 1 ) , + D3D11_MESSAGE_ID_CREATETEXTURE3D_INVALIDINITIALDATA = ( D3D11_MESSAGE_ID_CREATETEXTURE3D_INVALIDBINDFLAGS + 1 ) , + D3D11_MESSAGE_ID_CREATETEXTURE3D_INVALIDDIMENSIONS = ( D3D11_MESSAGE_ID_CREATETEXTURE3D_INVALIDINITIALDATA + 1 ) , + D3D11_MESSAGE_ID_CREATETEXTURE3D_INVALIDMIPLEVELS = ( D3D11_MESSAGE_ID_CREATETEXTURE3D_INVALIDDIMENSIONS + 1 ) , + D3D11_MESSAGE_ID_CREATETEXTURE3D_INVALIDMISCFLAGS = ( D3D11_MESSAGE_ID_CREATETEXTURE3D_INVALIDMIPLEVELS + 1 ) , + D3D11_MESSAGE_ID_CREATETEXTURE3D_INVALIDARG_RETURN = ( D3D11_MESSAGE_ID_CREATETEXTURE3D_INVALIDMISCFLAGS + 1 ) , + D3D11_MESSAGE_ID_CREATETEXTURE3D_OUTOFMEMORY_RETURN = ( D3D11_MESSAGE_ID_CREATETEXTURE3D_INVALIDARG_RETURN + 1 ) , + D3D11_MESSAGE_ID_CREATETEXTURE3D_NULLDESC = ( D3D11_MESSAGE_ID_CREATETEXTURE3D_OUTOFMEMORY_RETURN + 1 ) , + D3D11_MESSAGE_ID_CREATETEXTURE3D_LARGEALLOCATION = ( D3D11_MESSAGE_ID_CREATETEXTURE3D_NULLDESC + 1 ) , + D3D11_MESSAGE_ID_CREATESHADERRESOURCEVIEW_UNRECOGNIZEDFORMAT = ( D3D11_MESSAGE_ID_CREATETEXTURE3D_LARGEALLOCATION + 1 ) , + D3D11_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDDESC = ( D3D11_MESSAGE_ID_CREATESHADERRESOURCEVIEW_UNRECOGNIZEDFORMAT + 1 ) , + D3D11_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDFORMAT = ( D3D11_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDDESC + 1 ) , + D3D11_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDDIMENSIONS = ( D3D11_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDFORMAT + 1 ) , + D3D11_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDRESOURCE = ( D3D11_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDDIMENSIONS + 1 ) , + D3D11_MESSAGE_ID_CREATESHADERRESOURCEVIEW_TOOMANYOBJECTS = ( D3D11_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDRESOURCE + 1 ) , + D3D11_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDARG_RETURN = ( D3D11_MESSAGE_ID_CREATESHADERRESOURCEVIEW_TOOMANYOBJECTS + 1 ) , + D3D11_MESSAGE_ID_CREATESHADERRESOURCEVIEW_OUTOFMEMORY_RETURN = ( D3D11_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDARG_RETURN + 1 ) , + D3D11_MESSAGE_ID_CREATERENDERTARGETVIEW_UNRECOGNIZEDFORMAT = ( D3D11_MESSAGE_ID_CREATESHADERRESOURCEVIEW_OUTOFMEMORY_RETURN + 1 ) , + D3D11_MESSAGE_ID_CREATERENDERTARGETVIEW_UNSUPPORTEDFORMAT = ( D3D11_MESSAGE_ID_CREATERENDERTARGETVIEW_UNRECOGNIZEDFORMAT + 1 ) , + D3D11_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDDESC = ( D3D11_MESSAGE_ID_CREATERENDERTARGETVIEW_UNSUPPORTEDFORMAT + 1 ) , + D3D11_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDFORMAT = ( D3D11_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDDESC + 1 ) , + D3D11_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDDIMENSIONS = ( D3D11_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDFORMAT + 1 ) , + D3D11_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDRESOURCE = ( D3D11_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDDIMENSIONS + 1 ) , + D3D11_MESSAGE_ID_CREATERENDERTARGETVIEW_TOOMANYOBJECTS = ( D3D11_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDRESOURCE + 1 ) , + D3D11_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDARG_RETURN = ( D3D11_MESSAGE_ID_CREATERENDERTARGETVIEW_TOOMANYOBJECTS + 1 ) , + D3D11_MESSAGE_ID_CREATERENDERTARGETVIEW_OUTOFMEMORY_RETURN = ( D3D11_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDARG_RETURN + 1 ) , + D3D11_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_UNRECOGNIZEDFORMAT = ( D3D11_MESSAGE_ID_CREATERENDERTARGETVIEW_OUTOFMEMORY_RETURN + 1 ) , + D3D11_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDDESC = ( D3D11_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_UNRECOGNIZEDFORMAT + 1 ) , + D3D11_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDFORMAT = ( D3D11_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDDESC + 1 ) , + D3D11_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDDIMENSIONS = ( D3D11_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDFORMAT + 1 ) , + D3D11_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDRESOURCE = ( D3D11_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDDIMENSIONS + 1 ) , + D3D11_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_TOOMANYOBJECTS = ( D3D11_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDRESOURCE + 1 ) , + D3D11_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDARG_RETURN = ( D3D11_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_TOOMANYOBJECTS + 1 ) , + D3D11_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_OUTOFMEMORY_RETURN = ( D3D11_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDARG_RETURN + 1 ) , + D3D11_MESSAGE_ID_CREATEINPUTLAYOUT_OUTOFMEMORY = ( D3D11_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_OUTOFMEMORY_RETURN + 1 ) , + D3D11_MESSAGE_ID_CREATEINPUTLAYOUT_TOOMANYELEMENTS = ( D3D11_MESSAGE_ID_CREATEINPUTLAYOUT_OUTOFMEMORY + 1 ) , + D3D11_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDFORMAT = ( D3D11_MESSAGE_ID_CREATEINPUTLAYOUT_TOOMANYELEMENTS + 1 ) , + D3D11_MESSAGE_ID_CREATEINPUTLAYOUT_INCOMPATIBLEFORMAT = ( D3D11_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDFORMAT + 1 ) , + D3D11_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDSLOT = ( D3D11_MESSAGE_ID_CREATEINPUTLAYOUT_INCOMPATIBLEFORMAT + 1 ) , + D3D11_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDINPUTSLOTCLASS = ( D3D11_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDSLOT + 1 ) , + D3D11_MESSAGE_ID_CREATEINPUTLAYOUT_STEPRATESLOTCLASSMISMATCH = ( D3D11_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDINPUTSLOTCLASS + 1 ) , + D3D11_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDSLOTCLASSCHANGE = ( D3D11_MESSAGE_ID_CREATEINPUTLAYOUT_STEPRATESLOTCLASSMISMATCH + 1 ) , + D3D11_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDSTEPRATECHANGE = ( D3D11_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDSLOTCLASSCHANGE + 1 ) , + D3D11_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDALIGNMENT = ( D3D11_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDSTEPRATECHANGE + 1 ) , + D3D11_MESSAGE_ID_CREATEINPUTLAYOUT_DUPLICATESEMANTIC = ( D3D11_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDALIGNMENT + 1 ) , + D3D11_MESSAGE_ID_CREATEINPUTLAYOUT_UNPARSEABLEINPUTSIGNATURE = ( D3D11_MESSAGE_ID_CREATEINPUTLAYOUT_DUPLICATESEMANTIC + 1 ) , + D3D11_MESSAGE_ID_CREATEINPUTLAYOUT_NULLSEMANTIC = ( D3D11_MESSAGE_ID_CREATEINPUTLAYOUT_UNPARSEABLEINPUTSIGNATURE + 1 ) , + D3D11_MESSAGE_ID_CREATEINPUTLAYOUT_MISSINGELEMENT = ( D3D11_MESSAGE_ID_CREATEINPUTLAYOUT_NULLSEMANTIC + 1 ) , + D3D11_MESSAGE_ID_CREATEINPUTLAYOUT_NULLDESC = ( D3D11_MESSAGE_ID_CREATEINPUTLAYOUT_MISSINGELEMENT + 1 ) , + D3D11_MESSAGE_ID_CREATEVERTEXSHADER_OUTOFMEMORY = ( D3D11_MESSAGE_ID_CREATEINPUTLAYOUT_NULLDESC + 1 ) , + D3D11_MESSAGE_ID_CREATEVERTEXSHADER_INVALIDSHADERBYTECODE = ( D3D11_MESSAGE_ID_CREATEVERTEXSHADER_OUTOFMEMORY + 1 ) , + D3D11_MESSAGE_ID_CREATEVERTEXSHADER_INVALIDSHADERTYPE = ( D3D11_MESSAGE_ID_CREATEVERTEXSHADER_INVALIDSHADERBYTECODE + 1 ) , + D3D11_MESSAGE_ID_CREATEGEOMETRYSHADER_OUTOFMEMORY = ( D3D11_MESSAGE_ID_CREATEVERTEXSHADER_INVALIDSHADERTYPE + 1 ) , + D3D11_MESSAGE_ID_CREATEGEOMETRYSHADER_INVALIDSHADERBYTECODE = ( D3D11_MESSAGE_ID_CREATEGEOMETRYSHADER_OUTOFMEMORY + 1 ) , + D3D11_MESSAGE_ID_CREATEGEOMETRYSHADER_INVALIDSHADERTYPE = ( D3D11_MESSAGE_ID_CREATEGEOMETRYSHADER_INVALIDSHADERBYTECODE + 1 ) , + D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_OUTOFMEMORY = ( D3D11_MESSAGE_ID_CREATEGEOMETRYSHADER_INVALIDSHADERTYPE + 1 ) , + D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSHADERBYTECODE = ( D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_OUTOFMEMORY + 1 ) , + D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSHADERTYPE = ( D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSHADERBYTECODE + 1 ) , + D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDNUMENTRIES = ( D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSHADERTYPE + 1 ) , + D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_OUTPUTSTREAMSTRIDEUNUSED = ( D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDNUMENTRIES + 1 ) , + D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_UNEXPECTEDDECL = ( D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_OUTPUTSTREAMSTRIDEUNUSED + 1 ) , + D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_EXPECTEDDECL = ( D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_UNEXPECTEDDECL + 1 ) , + D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_OUTPUTSLOT0EXPECTED = ( D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_EXPECTEDDECL + 1 ) , + D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDOUTPUTSLOT = ( D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_OUTPUTSLOT0EXPECTED + 1 ) , + D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_ONLYONEELEMENTPERSLOT = ( D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDOUTPUTSLOT + 1 ) , + D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDCOMPONENTCOUNT = ( D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_ONLYONEELEMENTPERSLOT + 1 ) , + D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSTARTCOMPONENTANDCOMPONENTCOUNT = ( D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDCOMPONENTCOUNT + 1 ) , + D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDGAPDEFINITION = ( D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSTARTCOMPONENTANDCOMPONENTCOUNT + 1 ) , + D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_REPEATEDOUTPUT = ( D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDGAPDEFINITION + 1 ) , + D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDOUTPUTSTREAMSTRIDE = ( D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_REPEATEDOUTPUT + 1 ) , + D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_MISSINGSEMANTIC = ( D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDOUTPUTSTREAMSTRIDE + 1 ) , + D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_MASKMISMATCH = ( D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_MISSINGSEMANTIC + 1 ) , + D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_CANTHAVEONLYGAPS = ( D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_MASKMISMATCH + 1 ) , + D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_DECLTOOCOMPLEX = ( D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_CANTHAVEONLYGAPS + 1 ) , + D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_MISSINGOUTPUTSIGNATURE = ( D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_DECLTOOCOMPLEX + 1 ) , + D3D11_MESSAGE_ID_CREATEPIXELSHADER_OUTOFMEMORY = ( D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_MISSINGOUTPUTSIGNATURE + 1 ) , + D3D11_MESSAGE_ID_CREATEPIXELSHADER_INVALIDSHADERBYTECODE = ( D3D11_MESSAGE_ID_CREATEPIXELSHADER_OUTOFMEMORY + 1 ) , + D3D11_MESSAGE_ID_CREATEPIXELSHADER_INVALIDSHADERTYPE = ( D3D11_MESSAGE_ID_CREATEPIXELSHADER_INVALIDSHADERBYTECODE + 1 ) , + D3D11_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDFILLMODE = ( D3D11_MESSAGE_ID_CREATEPIXELSHADER_INVALIDSHADERTYPE + 1 ) , + D3D11_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDCULLMODE = ( D3D11_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDFILLMODE + 1 ) , + D3D11_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDDEPTHBIASCLAMP = ( D3D11_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDCULLMODE + 1 ) , + D3D11_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDSLOPESCALEDDEPTHBIAS = ( D3D11_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDDEPTHBIASCLAMP + 1 ) , + D3D11_MESSAGE_ID_CREATERASTERIZERSTATE_TOOMANYOBJECTS = ( D3D11_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDSLOPESCALEDDEPTHBIAS + 1 ) , + D3D11_MESSAGE_ID_CREATERASTERIZERSTATE_NULLDESC = ( D3D11_MESSAGE_ID_CREATERASTERIZERSTATE_TOOMANYOBJECTS + 1 ) , + D3D11_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDDEPTHWRITEMASK = ( D3D11_MESSAGE_ID_CREATERASTERIZERSTATE_NULLDESC + 1 ) , + D3D11_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDDEPTHFUNC = ( D3D11_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDDEPTHWRITEMASK + 1 ) , + D3D11_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILFAILOP = ( D3D11_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDDEPTHFUNC + 1 ) , + D3D11_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILZFAILOP = ( D3D11_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILFAILOP + 1 ) , + D3D11_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILPASSOP = ( D3D11_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILZFAILOP + 1 ) , + D3D11_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILFUNC = ( D3D11_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILPASSOP + 1 ) , + D3D11_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILFAILOP = ( D3D11_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILFUNC + 1 ) , + D3D11_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILZFAILOP = ( D3D11_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILFAILOP + 1 ) , + D3D11_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILPASSOP = ( D3D11_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILZFAILOP + 1 ) , + D3D11_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILFUNC = ( D3D11_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILPASSOP + 1 ) , + D3D11_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_TOOMANYOBJECTS = ( D3D11_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILFUNC + 1 ) , + D3D11_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_NULLDESC = ( D3D11_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_TOOMANYOBJECTS + 1 ) , + D3D11_MESSAGE_ID_CREATEBLENDSTATE_INVALIDSRCBLEND = ( D3D11_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_NULLDESC + 1 ) , + D3D11_MESSAGE_ID_CREATEBLENDSTATE_INVALIDDESTBLEND = ( D3D11_MESSAGE_ID_CREATEBLENDSTATE_INVALIDSRCBLEND + 1 ) , + D3D11_MESSAGE_ID_CREATEBLENDSTATE_INVALIDBLENDOP = ( D3D11_MESSAGE_ID_CREATEBLENDSTATE_INVALIDDESTBLEND + 1 ) , + D3D11_MESSAGE_ID_CREATEBLENDSTATE_INVALIDSRCBLENDALPHA = ( D3D11_MESSAGE_ID_CREATEBLENDSTATE_INVALIDBLENDOP + 1 ) , + D3D11_MESSAGE_ID_CREATEBLENDSTATE_INVALIDDESTBLENDALPHA = ( D3D11_MESSAGE_ID_CREATEBLENDSTATE_INVALIDSRCBLENDALPHA + 1 ) , + D3D11_MESSAGE_ID_CREATEBLENDSTATE_INVALIDBLENDOPALPHA = ( D3D11_MESSAGE_ID_CREATEBLENDSTATE_INVALIDDESTBLENDALPHA + 1 ) , + D3D11_MESSAGE_ID_CREATEBLENDSTATE_INVALIDRENDERTARGETWRITEMASK = ( D3D11_MESSAGE_ID_CREATEBLENDSTATE_INVALIDBLENDOPALPHA + 1 ) , + D3D11_MESSAGE_ID_CREATEBLENDSTATE_TOOMANYOBJECTS = ( D3D11_MESSAGE_ID_CREATEBLENDSTATE_INVALIDRENDERTARGETWRITEMASK + 1 ) , + D3D11_MESSAGE_ID_CREATEBLENDSTATE_NULLDESC = ( D3D11_MESSAGE_ID_CREATEBLENDSTATE_TOOMANYOBJECTS + 1 ) , + D3D11_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDFILTER = ( D3D11_MESSAGE_ID_CREATEBLENDSTATE_NULLDESC + 1 ) , + D3D11_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDADDRESSU = ( D3D11_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDFILTER + 1 ) , + D3D11_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDADDRESSV = ( D3D11_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDADDRESSU + 1 ) , + D3D11_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDADDRESSW = ( D3D11_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDADDRESSV + 1 ) , + D3D11_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDMIPLODBIAS = ( D3D11_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDADDRESSW + 1 ) , + D3D11_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDMAXANISOTROPY = ( D3D11_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDMIPLODBIAS + 1 ) , + D3D11_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDCOMPARISONFUNC = ( D3D11_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDMAXANISOTROPY + 1 ) , + D3D11_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDMINLOD = ( D3D11_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDCOMPARISONFUNC + 1 ) , + D3D11_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDMAXLOD = ( D3D11_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDMINLOD + 1 ) , + D3D11_MESSAGE_ID_CREATESAMPLERSTATE_TOOMANYOBJECTS = ( D3D11_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDMAXLOD + 1 ) , + D3D11_MESSAGE_ID_CREATESAMPLERSTATE_NULLDESC = ( D3D11_MESSAGE_ID_CREATESAMPLERSTATE_TOOMANYOBJECTS + 1 ) , + D3D11_MESSAGE_ID_CREATEQUERYORPREDICATE_INVALIDQUERY = ( D3D11_MESSAGE_ID_CREATESAMPLERSTATE_NULLDESC + 1 ) , + D3D11_MESSAGE_ID_CREATEQUERYORPREDICATE_INVALIDMISCFLAGS = ( D3D11_MESSAGE_ID_CREATEQUERYORPREDICATE_INVALIDQUERY + 1 ) , + D3D11_MESSAGE_ID_CREATEQUERYORPREDICATE_UNEXPECTEDMISCFLAG = ( D3D11_MESSAGE_ID_CREATEQUERYORPREDICATE_INVALIDMISCFLAGS + 1 ) , + D3D11_MESSAGE_ID_CREATEQUERYORPREDICATE_NULLDESC = ( D3D11_MESSAGE_ID_CREATEQUERYORPREDICATE_UNEXPECTEDMISCFLAG + 1 ) , + D3D11_MESSAGE_ID_DEVICE_IASETPRIMITIVETOPOLOGY_TOPOLOGY_UNRECOGNIZED = ( D3D11_MESSAGE_ID_CREATEQUERYORPREDICATE_NULLDESC + 1 ) , + D3D11_MESSAGE_ID_DEVICE_IASETPRIMITIVETOPOLOGY_TOPOLOGY_UNDEFINED = ( D3D11_MESSAGE_ID_DEVICE_IASETPRIMITIVETOPOLOGY_TOPOLOGY_UNRECOGNIZED + 1 ) , + D3D11_MESSAGE_ID_IASETVERTEXBUFFERS_INVALIDBUFFER = ( D3D11_MESSAGE_ID_DEVICE_IASETPRIMITIVETOPOLOGY_TOPOLOGY_UNDEFINED + 1 ) , + D3D11_MESSAGE_ID_DEVICE_IASETVERTEXBUFFERS_OFFSET_TOO_LARGE = ( D3D11_MESSAGE_ID_IASETVERTEXBUFFERS_INVALIDBUFFER + 1 ) , + D3D11_MESSAGE_ID_DEVICE_IASETVERTEXBUFFERS_BUFFERS_EMPTY = ( D3D11_MESSAGE_ID_DEVICE_IASETVERTEXBUFFERS_OFFSET_TOO_LARGE + 1 ) , + D3D11_MESSAGE_ID_IASETINDEXBUFFER_INVALIDBUFFER = ( D3D11_MESSAGE_ID_DEVICE_IASETVERTEXBUFFERS_BUFFERS_EMPTY + 1 ) , + D3D11_MESSAGE_ID_DEVICE_IASETINDEXBUFFER_FORMAT_INVALID = ( D3D11_MESSAGE_ID_IASETINDEXBUFFER_INVALIDBUFFER + 1 ) , + D3D11_MESSAGE_ID_DEVICE_IASETINDEXBUFFER_OFFSET_TOO_LARGE = ( D3D11_MESSAGE_ID_DEVICE_IASETINDEXBUFFER_FORMAT_INVALID + 1 ) , + D3D11_MESSAGE_ID_DEVICE_IASETINDEXBUFFER_OFFSET_UNALIGNED = ( D3D11_MESSAGE_ID_DEVICE_IASETINDEXBUFFER_OFFSET_TOO_LARGE + 1 ) , + D3D11_MESSAGE_ID_DEVICE_VSSETSHADERRESOURCES_VIEWS_EMPTY = ( D3D11_MESSAGE_ID_DEVICE_IASETINDEXBUFFER_OFFSET_UNALIGNED + 1 ) , + D3D11_MESSAGE_ID_VSSETCONSTANTBUFFERS_INVALIDBUFFER = ( D3D11_MESSAGE_ID_DEVICE_VSSETSHADERRESOURCES_VIEWS_EMPTY + 1 ) , + D3D11_MESSAGE_ID_DEVICE_VSSETCONSTANTBUFFERS_BUFFERS_EMPTY = ( D3D11_MESSAGE_ID_VSSETCONSTANTBUFFERS_INVALIDBUFFER + 1 ) , + D3D11_MESSAGE_ID_DEVICE_VSSETSAMPLERS_SAMPLERS_EMPTY = ( D3D11_MESSAGE_ID_DEVICE_VSSETCONSTANTBUFFERS_BUFFERS_EMPTY + 1 ) , + D3D11_MESSAGE_ID_DEVICE_GSSETSHADERRESOURCES_VIEWS_EMPTY = ( D3D11_MESSAGE_ID_DEVICE_VSSETSAMPLERS_SAMPLERS_EMPTY + 1 ) , + D3D11_MESSAGE_ID_GSSETCONSTANTBUFFERS_INVALIDBUFFER = ( D3D11_MESSAGE_ID_DEVICE_GSSETSHADERRESOURCES_VIEWS_EMPTY + 1 ) , + D3D11_MESSAGE_ID_DEVICE_GSSETCONSTANTBUFFERS_BUFFERS_EMPTY = ( D3D11_MESSAGE_ID_GSSETCONSTANTBUFFERS_INVALIDBUFFER + 1 ) , + D3D11_MESSAGE_ID_DEVICE_GSSETSAMPLERS_SAMPLERS_EMPTY = ( D3D11_MESSAGE_ID_DEVICE_GSSETCONSTANTBUFFERS_BUFFERS_EMPTY + 1 ) , + D3D11_MESSAGE_ID_SOSETTARGETS_INVALIDBUFFER = ( D3D11_MESSAGE_ID_DEVICE_GSSETSAMPLERS_SAMPLERS_EMPTY + 1 ) , + D3D11_MESSAGE_ID_DEVICE_SOSETTARGETS_OFFSET_UNALIGNED = ( D3D11_MESSAGE_ID_SOSETTARGETS_INVALIDBUFFER + 1 ) , + D3D11_MESSAGE_ID_DEVICE_PSSETSHADERRESOURCES_VIEWS_EMPTY = ( D3D11_MESSAGE_ID_DEVICE_SOSETTARGETS_OFFSET_UNALIGNED + 1 ) , + D3D11_MESSAGE_ID_PSSETCONSTANTBUFFERS_INVALIDBUFFER = ( D3D11_MESSAGE_ID_DEVICE_PSSETSHADERRESOURCES_VIEWS_EMPTY + 1 ) , + D3D11_MESSAGE_ID_DEVICE_PSSETCONSTANTBUFFERS_BUFFERS_EMPTY = ( D3D11_MESSAGE_ID_PSSETCONSTANTBUFFERS_INVALIDBUFFER + 1 ) , + D3D11_MESSAGE_ID_DEVICE_PSSETSAMPLERS_SAMPLERS_EMPTY = ( D3D11_MESSAGE_ID_DEVICE_PSSETCONSTANTBUFFERS_BUFFERS_EMPTY + 1 ) , + D3D11_MESSAGE_ID_DEVICE_RSSETVIEWPORTS_INVALIDVIEWPORT = ( D3D11_MESSAGE_ID_DEVICE_PSSETSAMPLERS_SAMPLERS_EMPTY + 1 ) , + D3D11_MESSAGE_ID_DEVICE_RSSETSCISSORRECTS_INVALIDSCISSOR = ( D3D11_MESSAGE_ID_DEVICE_RSSETVIEWPORTS_INVALIDVIEWPORT + 1 ) , + D3D11_MESSAGE_ID_CLEARRENDERTARGETVIEW_DENORMFLUSH = ( D3D11_MESSAGE_ID_DEVICE_RSSETSCISSORRECTS_INVALIDSCISSOR + 1 ) , + D3D11_MESSAGE_ID_CLEARDEPTHSTENCILVIEW_DENORMFLUSH = ( D3D11_MESSAGE_ID_CLEARRENDERTARGETVIEW_DENORMFLUSH + 1 ) , + D3D11_MESSAGE_ID_CLEARDEPTHSTENCILVIEW_INVALID = ( D3D11_MESSAGE_ID_CLEARDEPTHSTENCILVIEW_DENORMFLUSH + 1 ) , + D3D11_MESSAGE_ID_DEVICE_IAGETVERTEXBUFFERS_BUFFERS_EMPTY = ( D3D11_MESSAGE_ID_CLEARDEPTHSTENCILVIEW_INVALID + 1 ) , + D3D11_MESSAGE_ID_DEVICE_VSGETSHADERRESOURCES_VIEWS_EMPTY = ( D3D11_MESSAGE_ID_DEVICE_IAGETVERTEXBUFFERS_BUFFERS_EMPTY + 1 ) , + D3D11_MESSAGE_ID_DEVICE_VSGETCONSTANTBUFFERS_BUFFERS_EMPTY = ( D3D11_MESSAGE_ID_DEVICE_VSGETSHADERRESOURCES_VIEWS_EMPTY + 1 ) , + D3D11_MESSAGE_ID_DEVICE_VSGETSAMPLERS_SAMPLERS_EMPTY = ( D3D11_MESSAGE_ID_DEVICE_VSGETCONSTANTBUFFERS_BUFFERS_EMPTY + 1 ) , + D3D11_MESSAGE_ID_DEVICE_GSGETSHADERRESOURCES_VIEWS_EMPTY = ( D3D11_MESSAGE_ID_DEVICE_VSGETSAMPLERS_SAMPLERS_EMPTY + 1 ) , + D3D11_MESSAGE_ID_DEVICE_GSGETCONSTANTBUFFERS_BUFFERS_EMPTY = ( D3D11_MESSAGE_ID_DEVICE_GSGETSHADERRESOURCES_VIEWS_EMPTY + 1 ) , + D3D11_MESSAGE_ID_DEVICE_GSGETSAMPLERS_SAMPLERS_EMPTY = ( D3D11_MESSAGE_ID_DEVICE_GSGETCONSTANTBUFFERS_BUFFERS_EMPTY + 1 ) , + D3D11_MESSAGE_ID_DEVICE_SOGETTARGETS_BUFFERS_EMPTY = ( D3D11_MESSAGE_ID_DEVICE_GSGETSAMPLERS_SAMPLERS_EMPTY + 1 ) , + D3D11_MESSAGE_ID_DEVICE_PSGETSHADERRESOURCES_VIEWS_EMPTY = ( D3D11_MESSAGE_ID_DEVICE_SOGETTARGETS_BUFFERS_EMPTY + 1 ) , + D3D11_MESSAGE_ID_DEVICE_PSGETCONSTANTBUFFERS_BUFFERS_EMPTY = ( D3D11_MESSAGE_ID_DEVICE_PSGETSHADERRESOURCES_VIEWS_EMPTY + 1 ) , + D3D11_MESSAGE_ID_DEVICE_PSGETSAMPLERS_SAMPLERS_EMPTY = ( D3D11_MESSAGE_ID_DEVICE_PSGETCONSTANTBUFFERS_BUFFERS_EMPTY + 1 ) , + D3D11_MESSAGE_ID_DEVICE_RSGETVIEWPORTS_VIEWPORTS_EMPTY = ( D3D11_MESSAGE_ID_DEVICE_PSGETSAMPLERS_SAMPLERS_EMPTY + 1 ) , + D3D11_MESSAGE_ID_DEVICE_RSGETSCISSORRECTS_RECTS_EMPTY = ( D3D11_MESSAGE_ID_DEVICE_RSGETVIEWPORTS_VIEWPORTS_EMPTY + 1 ) , + D3D11_MESSAGE_ID_DEVICE_GENERATEMIPS_RESOURCE_INVALID = ( D3D11_MESSAGE_ID_DEVICE_RSGETSCISSORRECTS_RECTS_EMPTY + 1 ) , + D3D11_MESSAGE_ID_COPYSUBRESOURCEREGION_INVALIDDESTINATIONSUBRESOURCE = ( D3D11_MESSAGE_ID_DEVICE_GENERATEMIPS_RESOURCE_INVALID + 1 ) , + D3D11_MESSAGE_ID_COPYSUBRESOURCEREGION_INVALIDSOURCESUBRESOURCE = ( D3D11_MESSAGE_ID_COPYSUBRESOURCEREGION_INVALIDDESTINATIONSUBRESOURCE + 1 ) , + D3D11_MESSAGE_ID_COPYSUBRESOURCEREGION_INVALIDSOURCEBOX = ( D3D11_MESSAGE_ID_COPYSUBRESOURCEREGION_INVALIDSOURCESUBRESOURCE + 1 ) , + D3D11_MESSAGE_ID_COPYSUBRESOURCEREGION_INVALIDSOURCE = ( D3D11_MESSAGE_ID_COPYSUBRESOURCEREGION_INVALIDSOURCEBOX + 1 ) , + D3D11_MESSAGE_ID_COPYSUBRESOURCEREGION_INVALIDDESTINATIONSTATE = ( D3D11_MESSAGE_ID_COPYSUBRESOURCEREGION_INVALIDSOURCE + 1 ) , + D3D11_MESSAGE_ID_COPYSUBRESOURCEREGION_INVALIDSOURCESTATE = ( D3D11_MESSAGE_ID_COPYSUBRESOURCEREGION_INVALIDDESTINATIONSTATE + 1 ) , + D3D11_MESSAGE_ID_COPYRESOURCE_INVALIDSOURCE = ( D3D11_MESSAGE_ID_COPYSUBRESOURCEREGION_INVALIDSOURCESTATE + 1 ) , + D3D11_MESSAGE_ID_COPYRESOURCE_INVALIDDESTINATIONSTATE = ( D3D11_MESSAGE_ID_COPYRESOURCE_INVALIDSOURCE + 1 ) , + D3D11_MESSAGE_ID_COPYRESOURCE_INVALIDSOURCESTATE = ( D3D11_MESSAGE_ID_COPYRESOURCE_INVALIDDESTINATIONSTATE + 1 ) , + D3D11_MESSAGE_ID_UPDATESUBRESOURCE_INVALIDDESTINATIONSUBRESOURCE = ( D3D11_MESSAGE_ID_COPYRESOURCE_INVALIDSOURCESTATE + 1 ) , + D3D11_MESSAGE_ID_UPDATESUBRESOURCE_INVALIDDESTINATIONBOX = ( D3D11_MESSAGE_ID_UPDATESUBRESOURCE_INVALIDDESTINATIONSUBRESOURCE + 1 ) , + D3D11_MESSAGE_ID_UPDATESUBRESOURCE_INVALIDDESTINATIONSTATE = ( D3D11_MESSAGE_ID_UPDATESUBRESOURCE_INVALIDDESTINATIONBOX + 1 ) , + D3D11_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_DESTINATION_INVALID = ( D3D11_MESSAGE_ID_UPDATESUBRESOURCE_INVALIDDESTINATIONSTATE + 1 ) , + D3D11_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_DESTINATION_SUBRESOURCE_INVALID = ( D3D11_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_DESTINATION_INVALID + 1 ) , + D3D11_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_SOURCE_INVALID = ( D3D11_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_DESTINATION_SUBRESOURCE_INVALID + 1 ) , + D3D11_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_SOURCE_SUBRESOURCE_INVALID = ( D3D11_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_SOURCE_INVALID + 1 ) , + D3D11_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_FORMAT_INVALID = ( D3D11_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_SOURCE_SUBRESOURCE_INVALID + 1 ) , + D3D11_MESSAGE_ID_BUFFER_MAP_INVALIDMAPTYPE = ( D3D11_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_FORMAT_INVALID + 1 ) , + D3D11_MESSAGE_ID_BUFFER_MAP_INVALIDFLAGS = ( D3D11_MESSAGE_ID_BUFFER_MAP_INVALIDMAPTYPE + 1 ) , + D3D11_MESSAGE_ID_BUFFER_MAP_ALREADYMAPPED = ( D3D11_MESSAGE_ID_BUFFER_MAP_INVALIDFLAGS + 1 ) , + D3D11_MESSAGE_ID_BUFFER_MAP_DEVICEREMOVED_RETURN = ( D3D11_MESSAGE_ID_BUFFER_MAP_ALREADYMAPPED + 1 ) , + D3D11_MESSAGE_ID_BUFFER_UNMAP_NOTMAPPED = ( D3D11_MESSAGE_ID_BUFFER_MAP_DEVICEREMOVED_RETURN + 1 ) , + D3D11_MESSAGE_ID_TEXTURE1D_MAP_INVALIDMAPTYPE = ( D3D11_MESSAGE_ID_BUFFER_UNMAP_NOTMAPPED + 1 ) , + D3D11_MESSAGE_ID_TEXTURE1D_MAP_INVALIDSUBRESOURCE = ( D3D11_MESSAGE_ID_TEXTURE1D_MAP_INVALIDMAPTYPE + 1 ) , + D3D11_MESSAGE_ID_TEXTURE1D_MAP_INVALIDFLAGS = ( D3D11_MESSAGE_ID_TEXTURE1D_MAP_INVALIDSUBRESOURCE + 1 ) , + D3D11_MESSAGE_ID_TEXTURE1D_MAP_ALREADYMAPPED = ( D3D11_MESSAGE_ID_TEXTURE1D_MAP_INVALIDFLAGS + 1 ) , + D3D11_MESSAGE_ID_TEXTURE1D_MAP_DEVICEREMOVED_RETURN = ( D3D11_MESSAGE_ID_TEXTURE1D_MAP_ALREADYMAPPED + 1 ) , + D3D11_MESSAGE_ID_TEXTURE1D_UNMAP_INVALIDSUBRESOURCE = ( D3D11_MESSAGE_ID_TEXTURE1D_MAP_DEVICEREMOVED_RETURN + 1 ) , + D3D11_MESSAGE_ID_TEXTURE1D_UNMAP_NOTMAPPED = ( D3D11_MESSAGE_ID_TEXTURE1D_UNMAP_INVALIDSUBRESOURCE + 1 ) , + D3D11_MESSAGE_ID_TEXTURE2D_MAP_INVALIDMAPTYPE = ( D3D11_MESSAGE_ID_TEXTURE1D_UNMAP_NOTMAPPED + 1 ) , + D3D11_MESSAGE_ID_TEXTURE2D_MAP_INVALIDSUBRESOURCE = ( D3D11_MESSAGE_ID_TEXTURE2D_MAP_INVALIDMAPTYPE + 1 ) , + D3D11_MESSAGE_ID_TEXTURE2D_MAP_INVALIDFLAGS = ( D3D11_MESSAGE_ID_TEXTURE2D_MAP_INVALIDSUBRESOURCE + 1 ) , + D3D11_MESSAGE_ID_TEXTURE2D_MAP_ALREADYMAPPED = ( D3D11_MESSAGE_ID_TEXTURE2D_MAP_INVALIDFLAGS + 1 ) , + D3D11_MESSAGE_ID_TEXTURE2D_MAP_DEVICEREMOVED_RETURN = ( D3D11_MESSAGE_ID_TEXTURE2D_MAP_ALREADYMAPPED + 1 ) , + D3D11_MESSAGE_ID_TEXTURE2D_UNMAP_INVALIDSUBRESOURCE = ( D3D11_MESSAGE_ID_TEXTURE2D_MAP_DEVICEREMOVED_RETURN + 1 ) , + D3D11_MESSAGE_ID_TEXTURE2D_UNMAP_NOTMAPPED = ( D3D11_MESSAGE_ID_TEXTURE2D_UNMAP_INVALIDSUBRESOURCE + 1 ) , + D3D11_MESSAGE_ID_TEXTURE3D_MAP_INVALIDMAPTYPE = ( D3D11_MESSAGE_ID_TEXTURE2D_UNMAP_NOTMAPPED + 1 ) , + D3D11_MESSAGE_ID_TEXTURE3D_MAP_INVALIDSUBRESOURCE = ( D3D11_MESSAGE_ID_TEXTURE3D_MAP_INVALIDMAPTYPE + 1 ) , + D3D11_MESSAGE_ID_TEXTURE3D_MAP_INVALIDFLAGS = ( D3D11_MESSAGE_ID_TEXTURE3D_MAP_INVALIDSUBRESOURCE + 1 ) , + D3D11_MESSAGE_ID_TEXTURE3D_MAP_ALREADYMAPPED = ( D3D11_MESSAGE_ID_TEXTURE3D_MAP_INVALIDFLAGS + 1 ) , + D3D11_MESSAGE_ID_TEXTURE3D_MAP_DEVICEREMOVED_RETURN = ( D3D11_MESSAGE_ID_TEXTURE3D_MAP_ALREADYMAPPED + 1 ) , + D3D11_MESSAGE_ID_TEXTURE3D_UNMAP_INVALIDSUBRESOURCE = ( D3D11_MESSAGE_ID_TEXTURE3D_MAP_DEVICEREMOVED_RETURN + 1 ) , + D3D11_MESSAGE_ID_TEXTURE3D_UNMAP_NOTMAPPED = ( D3D11_MESSAGE_ID_TEXTURE3D_UNMAP_INVALIDSUBRESOURCE + 1 ) , + D3D11_MESSAGE_ID_CHECKFORMATSUPPORT_FORMAT_DEPRECATED = ( D3D11_MESSAGE_ID_TEXTURE3D_UNMAP_NOTMAPPED + 1 ) , + D3D11_MESSAGE_ID_CHECKMULTISAMPLEQUALITYLEVELS_FORMAT_DEPRECATED = ( D3D11_MESSAGE_ID_CHECKFORMATSUPPORT_FORMAT_DEPRECATED + 1 ) , + D3D11_MESSAGE_ID_SETEXCEPTIONMODE_UNRECOGNIZEDFLAGS = ( D3D11_MESSAGE_ID_CHECKMULTISAMPLEQUALITYLEVELS_FORMAT_DEPRECATED + 1 ) , + D3D11_MESSAGE_ID_SETEXCEPTIONMODE_INVALIDARG_RETURN = ( D3D11_MESSAGE_ID_SETEXCEPTIONMODE_UNRECOGNIZEDFLAGS + 1 ) , + D3D11_MESSAGE_ID_SETEXCEPTIONMODE_DEVICEREMOVED_RETURN = ( D3D11_MESSAGE_ID_SETEXCEPTIONMODE_INVALIDARG_RETURN + 1 ) , + D3D11_MESSAGE_ID_REF_SIMULATING_INFINITELY_FAST_HARDWARE = ( D3D11_MESSAGE_ID_SETEXCEPTIONMODE_DEVICEREMOVED_RETURN + 1 ) , + D3D11_MESSAGE_ID_REF_THREADING_MODE = ( D3D11_MESSAGE_ID_REF_SIMULATING_INFINITELY_FAST_HARDWARE + 1 ) , + D3D11_MESSAGE_ID_REF_UMDRIVER_EXCEPTION = ( D3D11_MESSAGE_ID_REF_THREADING_MODE + 1 ) , + D3D11_MESSAGE_ID_REF_KMDRIVER_EXCEPTION = ( D3D11_MESSAGE_ID_REF_UMDRIVER_EXCEPTION + 1 ) , + D3D11_MESSAGE_ID_REF_HARDWARE_EXCEPTION = ( D3D11_MESSAGE_ID_REF_KMDRIVER_EXCEPTION + 1 ) , + D3D11_MESSAGE_ID_REF_ACCESSING_INDEXABLE_TEMP_OUT_OF_RANGE = ( D3D11_MESSAGE_ID_REF_HARDWARE_EXCEPTION + 1 ) , + D3D11_MESSAGE_ID_REF_PROBLEM_PARSING_SHADER = ( D3D11_MESSAGE_ID_REF_ACCESSING_INDEXABLE_TEMP_OUT_OF_RANGE + 1 ) , + D3D11_MESSAGE_ID_REF_OUT_OF_MEMORY = ( D3D11_MESSAGE_ID_REF_PROBLEM_PARSING_SHADER + 1 ) , + D3D11_MESSAGE_ID_REF_INFO = ( D3D11_MESSAGE_ID_REF_OUT_OF_MEMORY + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DRAW_VERTEXPOS_OVERFLOW = ( D3D11_MESSAGE_ID_REF_INFO + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DRAWINDEXED_INDEXPOS_OVERFLOW = ( D3D11_MESSAGE_ID_DEVICE_DRAW_VERTEXPOS_OVERFLOW + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DRAWINSTANCED_VERTEXPOS_OVERFLOW = ( D3D11_MESSAGE_ID_DEVICE_DRAWINDEXED_INDEXPOS_OVERFLOW + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DRAWINSTANCED_INSTANCEPOS_OVERFLOW = ( D3D11_MESSAGE_ID_DEVICE_DRAWINSTANCED_VERTEXPOS_OVERFLOW + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DRAWINDEXEDINSTANCED_INSTANCEPOS_OVERFLOW = ( D3D11_MESSAGE_ID_DEVICE_DRAWINSTANCED_INSTANCEPOS_OVERFLOW + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DRAWINDEXEDINSTANCED_INDEXPOS_OVERFLOW = ( D3D11_MESSAGE_ID_DEVICE_DRAWINDEXEDINSTANCED_INSTANCEPOS_OVERFLOW + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DRAW_VERTEX_SHADER_NOT_SET = ( D3D11_MESSAGE_ID_DEVICE_DRAWINDEXEDINSTANCED_INDEXPOS_OVERFLOW + 1 ) , + D3D11_MESSAGE_ID_DEVICE_SHADER_LINKAGE_SEMANTICNAME_NOT_FOUND = ( D3D11_MESSAGE_ID_DEVICE_DRAW_VERTEX_SHADER_NOT_SET + 1 ) , + D3D11_MESSAGE_ID_DEVICE_SHADER_LINKAGE_REGISTERINDEX = ( D3D11_MESSAGE_ID_DEVICE_SHADER_LINKAGE_SEMANTICNAME_NOT_FOUND + 1 ) , + D3D11_MESSAGE_ID_DEVICE_SHADER_LINKAGE_COMPONENTTYPE = ( D3D11_MESSAGE_ID_DEVICE_SHADER_LINKAGE_REGISTERINDEX + 1 ) , + D3D11_MESSAGE_ID_DEVICE_SHADER_LINKAGE_REGISTERMASK = ( D3D11_MESSAGE_ID_DEVICE_SHADER_LINKAGE_COMPONENTTYPE + 1 ) , + D3D11_MESSAGE_ID_DEVICE_SHADER_LINKAGE_SYSTEMVALUE = ( D3D11_MESSAGE_ID_DEVICE_SHADER_LINKAGE_REGISTERMASK + 1 ) , + D3D11_MESSAGE_ID_DEVICE_SHADER_LINKAGE_NEVERWRITTEN_ALWAYSREADS = ( D3D11_MESSAGE_ID_DEVICE_SHADER_LINKAGE_SYSTEMVALUE + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DRAW_VERTEX_BUFFER_NOT_SET = ( D3D11_MESSAGE_ID_DEVICE_SHADER_LINKAGE_NEVERWRITTEN_ALWAYSREADS + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DRAW_INPUTLAYOUT_NOT_SET = ( D3D11_MESSAGE_ID_DEVICE_DRAW_VERTEX_BUFFER_NOT_SET + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DRAW_CONSTANT_BUFFER_NOT_SET = ( D3D11_MESSAGE_ID_DEVICE_DRAW_INPUTLAYOUT_NOT_SET + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DRAW_CONSTANT_BUFFER_TOO_SMALL = ( D3D11_MESSAGE_ID_DEVICE_DRAW_CONSTANT_BUFFER_NOT_SET + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DRAW_SAMPLER_NOT_SET = ( D3D11_MESSAGE_ID_DEVICE_DRAW_CONSTANT_BUFFER_TOO_SMALL + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DRAW_SHADERRESOURCEVIEW_NOT_SET = ( D3D11_MESSAGE_ID_DEVICE_DRAW_SAMPLER_NOT_SET + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DRAW_VIEW_DIMENSION_MISMATCH = ( D3D11_MESSAGE_ID_DEVICE_DRAW_SHADERRESOURCEVIEW_NOT_SET + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DRAW_VERTEX_BUFFER_STRIDE_TOO_SMALL = ( D3D11_MESSAGE_ID_DEVICE_DRAW_VIEW_DIMENSION_MISMATCH + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DRAW_VERTEX_BUFFER_TOO_SMALL = ( D3D11_MESSAGE_ID_DEVICE_DRAW_VERTEX_BUFFER_STRIDE_TOO_SMALL + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DRAW_INDEX_BUFFER_NOT_SET = ( D3D11_MESSAGE_ID_DEVICE_DRAW_VERTEX_BUFFER_TOO_SMALL + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DRAW_INDEX_BUFFER_FORMAT_INVALID = ( D3D11_MESSAGE_ID_DEVICE_DRAW_INDEX_BUFFER_NOT_SET + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DRAW_INDEX_BUFFER_TOO_SMALL = ( D3D11_MESSAGE_ID_DEVICE_DRAW_INDEX_BUFFER_FORMAT_INVALID + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DRAW_GS_INPUT_PRIMITIVE_MISMATCH = ( D3D11_MESSAGE_ID_DEVICE_DRAW_INDEX_BUFFER_TOO_SMALL + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DRAW_RESOURCE_RETURN_TYPE_MISMATCH = ( D3D11_MESSAGE_ID_DEVICE_DRAW_GS_INPUT_PRIMITIVE_MISMATCH + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DRAW_POSITION_NOT_PRESENT = ( D3D11_MESSAGE_ID_DEVICE_DRAW_RESOURCE_RETURN_TYPE_MISMATCH + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DRAW_OUTPUT_STREAM_NOT_SET = ( D3D11_MESSAGE_ID_DEVICE_DRAW_POSITION_NOT_PRESENT + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DRAW_BOUND_RESOURCE_MAPPED = ( D3D11_MESSAGE_ID_DEVICE_DRAW_OUTPUT_STREAM_NOT_SET + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DRAW_INVALID_PRIMITIVETOPOLOGY = ( D3D11_MESSAGE_ID_DEVICE_DRAW_BOUND_RESOURCE_MAPPED + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DRAW_VERTEX_OFFSET_UNALIGNED = ( D3D11_MESSAGE_ID_DEVICE_DRAW_INVALID_PRIMITIVETOPOLOGY + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DRAW_VERTEX_STRIDE_UNALIGNED = ( D3D11_MESSAGE_ID_DEVICE_DRAW_VERTEX_OFFSET_UNALIGNED + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DRAW_INDEX_OFFSET_UNALIGNED = ( D3D11_MESSAGE_ID_DEVICE_DRAW_VERTEX_STRIDE_UNALIGNED + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DRAW_OUTPUT_STREAM_OFFSET_UNALIGNED = ( D3D11_MESSAGE_ID_DEVICE_DRAW_INDEX_OFFSET_UNALIGNED + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DRAW_RESOURCE_FORMAT_LD_UNSUPPORTED = ( D3D11_MESSAGE_ID_DEVICE_DRAW_OUTPUT_STREAM_OFFSET_UNALIGNED + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DRAW_RESOURCE_FORMAT_SAMPLE_UNSUPPORTED = ( D3D11_MESSAGE_ID_DEVICE_DRAW_RESOURCE_FORMAT_LD_UNSUPPORTED + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DRAW_RESOURCE_FORMAT_SAMPLE_C_UNSUPPORTED = ( D3D11_MESSAGE_ID_DEVICE_DRAW_RESOURCE_FORMAT_SAMPLE_UNSUPPORTED + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DRAW_RESOURCE_MULTISAMPLE_UNSUPPORTED = ( D3D11_MESSAGE_ID_DEVICE_DRAW_RESOURCE_FORMAT_SAMPLE_C_UNSUPPORTED + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DRAW_SO_TARGETS_BOUND_WITHOUT_SOURCE = ( D3D11_MESSAGE_ID_DEVICE_DRAW_RESOURCE_MULTISAMPLE_UNSUPPORTED + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DRAW_SO_STRIDE_LARGER_THAN_BUFFER = ( D3D11_MESSAGE_ID_DEVICE_DRAW_SO_TARGETS_BOUND_WITHOUT_SOURCE + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DRAW_OM_RENDER_TARGET_DOES_NOT_SUPPORT_BLENDING = ( D3D11_MESSAGE_ID_DEVICE_DRAW_SO_STRIDE_LARGER_THAN_BUFFER + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DRAW_OM_DUAL_SOURCE_BLENDING_CAN_ONLY_HAVE_RENDER_TARGET_0 = ( D3D11_MESSAGE_ID_DEVICE_DRAW_OM_RENDER_TARGET_DOES_NOT_SUPPORT_BLENDING + 1 ) , + D3D11_MESSAGE_ID_DEVICE_REMOVAL_PROCESS_AT_FAULT = ( D3D11_MESSAGE_ID_DEVICE_DRAW_OM_DUAL_SOURCE_BLENDING_CAN_ONLY_HAVE_RENDER_TARGET_0 + 1 ) , + D3D11_MESSAGE_ID_DEVICE_REMOVAL_PROCESS_POSSIBLY_AT_FAULT = ( D3D11_MESSAGE_ID_DEVICE_REMOVAL_PROCESS_AT_FAULT + 1 ) , + D3D11_MESSAGE_ID_DEVICE_REMOVAL_PROCESS_NOT_AT_FAULT = ( D3D11_MESSAGE_ID_DEVICE_REMOVAL_PROCESS_POSSIBLY_AT_FAULT + 1 ) , + D3D11_MESSAGE_ID_DEVICE_OPEN_SHARED_RESOURCE_INVALIDARG_RETURN = ( D3D11_MESSAGE_ID_DEVICE_REMOVAL_PROCESS_NOT_AT_FAULT + 1 ) , + D3D11_MESSAGE_ID_DEVICE_OPEN_SHARED_RESOURCE_OUTOFMEMORY_RETURN = ( D3D11_MESSAGE_ID_DEVICE_OPEN_SHARED_RESOURCE_INVALIDARG_RETURN + 1 ) , + D3D11_MESSAGE_ID_DEVICE_OPEN_SHARED_RESOURCE_BADINTERFACE_RETURN = ( D3D11_MESSAGE_ID_DEVICE_OPEN_SHARED_RESOURCE_OUTOFMEMORY_RETURN + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DRAW_VIEWPORT_NOT_SET = ( D3D11_MESSAGE_ID_DEVICE_OPEN_SHARED_RESOURCE_BADINTERFACE_RETURN + 1 ) , + D3D11_MESSAGE_ID_CREATEINPUTLAYOUT_TRAILING_DIGIT_IN_SEMANTIC = ( D3D11_MESSAGE_ID_DEVICE_DRAW_VIEWPORT_NOT_SET + 1 ) , + D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_TRAILING_DIGIT_IN_SEMANTIC = ( D3D11_MESSAGE_ID_CREATEINPUTLAYOUT_TRAILING_DIGIT_IN_SEMANTIC + 1 ) , + D3D11_MESSAGE_ID_DEVICE_RSSETVIEWPORTS_DENORMFLUSH = ( D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_TRAILING_DIGIT_IN_SEMANTIC + 1 ) , + D3D11_MESSAGE_ID_OMSETRENDERTARGETS_INVALIDVIEW = ( D3D11_MESSAGE_ID_DEVICE_RSSETVIEWPORTS_DENORMFLUSH + 1 ) , + D3D11_MESSAGE_ID_DEVICE_SETTEXTFILTERSIZE_INVALIDDIMENSIONS = ( D3D11_MESSAGE_ID_OMSETRENDERTARGETS_INVALIDVIEW + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DRAW_SAMPLER_MISMATCH = ( D3D11_MESSAGE_ID_DEVICE_SETTEXTFILTERSIZE_INVALIDDIMENSIONS + 1 ) , + D3D11_MESSAGE_ID_CREATEINPUTLAYOUT_TYPE_MISMATCH = ( D3D11_MESSAGE_ID_DEVICE_DRAW_SAMPLER_MISMATCH + 1 ) , + D3D11_MESSAGE_ID_BLENDSTATE_GETDESC_LEGACY = ( D3D11_MESSAGE_ID_CREATEINPUTLAYOUT_TYPE_MISMATCH + 1 ) , + D3D11_MESSAGE_ID_SHADERRESOURCEVIEW_GETDESC_LEGACY = ( D3D11_MESSAGE_ID_BLENDSTATE_GETDESC_LEGACY + 1 ) , + D3D11_MESSAGE_ID_CREATEQUERY_OUTOFMEMORY_RETURN = ( D3D11_MESSAGE_ID_SHADERRESOURCEVIEW_GETDESC_LEGACY + 1 ) , + D3D11_MESSAGE_ID_CREATEPREDICATE_OUTOFMEMORY_RETURN = ( D3D11_MESSAGE_ID_CREATEQUERY_OUTOFMEMORY_RETURN + 1 ) , + D3D11_MESSAGE_ID_CREATECOUNTER_OUTOFRANGE_COUNTER = ( D3D11_MESSAGE_ID_CREATEPREDICATE_OUTOFMEMORY_RETURN + 1 ) , + D3D11_MESSAGE_ID_CREATECOUNTER_SIMULTANEOUS_ACTIVE_COUNTERS_EXHAUSTED = ( D3D11_MESSAGE_ID_CREATECOUNTER_OUTOFRANGE_COUNTER + 1 ) , + D3D11_MESSAGE_ID_CREATECOUNTER_UNSUPPORTED_WELLKNOWN_COUNTER = ( D3D11_MESSAGE_ID_CREATECOUNTER_SIMULTANEOUS_ACTIVE_COUNTERS_EXHAUSTED + 1 ) , + D3D11_MESSAGE_ID_CREATECOUNTER_OUTOFMEMORY_RETURN = ( D3D11_MESSAGE_ID_CREATECOUNTER_UNSUPPORTED_WELLKNOWN_COUNTER + 1 ) , + D3D11_MESSAGE_ID_CREATECOUNTER_NONEXCLUSIVE_RETURN = ( D3D11_MESSAGE_ID_CREATECOUNTER_OUTOFMEMORY_RETURN + 1 ) , + D3D11_MESSAGE_ID_CREATECOUNTER_NULLDESC = ( D3D11_MESSAGE_ID_CREATECOUNTER_NONEXCLUSIVE_RETURN + 1 ) , + D3D11_MESSAGE_ID_CHECKCOUNTER_OUTOFRANGE_COUNTER = ( D3D11_MESSAGE_ID_CREATECOUNTER_NULLDESC + 1 ) , + D3D11_MESSAGE_ID_CHECKCOUNTER_UNSUPPORTED_WELLKNOWN_COUNTER = ( D3D11_MESSAGE_ID_CHECKCOUNTER_OUTOFRANGE_COUNTER + 1 ) , + D3D11_MESSAGE_ID_SETPREDICATION_INVALID_PREDICATE_STATE = ( D3D11_MESSAGE_ID_CHECKCOUNTER_UNSUPPORTED_WELLKNOWN_COUNTER + 1 ) , + D3D11_MESSAGE_ID_QUERY_BEGIN_UNSUPPORTED = ( D3D11_MESSAGE_ID_SETPREDICATION_INVALID_PREDICATE_STATE + 1 ) , + D3D11_MESSAGE_ID_PREDICATE_BEGIN_DURING_PREDICATION = ( D3D11_MESSAGE_ID_QUERY_BEGIN_UNSUPPORTED + 1 ) , + D3D11_MESSAGE_ID_QUERY_BEGIN_DUPLICATE = ( D3D11_MESSAGE_ID_PREDICATE_BEGIN_DURING_PREDICATION + 1 ) , + D3D11_MESSAGE_ID_QUERY_BEGIN_ABANDONING_PREVIOUS_RESULTS = ( D3D11_MESSAGE_ID_QUERY_BEGIN_DUPLICATE + 1 ) , + D3D11_MESSAGE_ID_PREDICATE_END_DURING_PREDICATION = ( D3D11_MESSAGE_ID_QUERY_BEGIN_ABANDONING_PREVIOUS_RESULTS + 1 ) , + D3D11_MESSAGE_ID_QUERY_END_ABANDONING_PREVIOUS_RESULTS = ( D3D11_MESSAGE_ID_PREDICATE_END_DURING_PREDICATION + 1 ) , + D3D11_MESSAGE_ID_QUERY_END_WITHOUT_BEGIN = ( D3D11_MESSAGE_ID_QUERY_END_ABANDONING_PREVIOUS_RESULTS + 1 ) , + D3D11_MESSAGE_ID_QUERY_GETDATA_INVALID_DATASIZE = ( D3D11_MESSAGE_ID_QUERY_END_WITHOUT_BEGIN + 1 ) , + D3D11_MESSAGE_ID_QUERY_GETDATA_INVALID_FLAGS = ( D3D11_MESSAGE_ID_QUERY_GETDATA_INVALID_DATASIZE + 1 ) , + D3D11_MESSAGE_ID_QUERY_GETDATA_INVALID_CALL = ( D3D11_MESSAGE_ID_QUERY_GETDATA_INVALID_FLAGS + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DRAW_PS_OUTPUT_TYPE_MISMATCH = ( D3D11_MESSAGE_ID_QUERY_GETDATA_INVALID_CALL + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DRAW_RESOURCE_FORMAT_GATHER_UNSUPPORTED = ( D3D11_MESSAGE_ID_DEVICE_DRAW_PS_OUTPUT_TYPE_MISMATCH + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DRAW_INVALID_USE_OF_CENTER_MULTISAMPLE_PATTERN = ( D3D11_MESSAGE_ID_DEVICE_DRAW_RESOURCE_FORMAT_GATHER_UNSUPPORTED + 1 ) , + D3D11_MESSAGE_ID_DEVICE_IASETVERTEXBUFFERS_STRIDE_TOO_LARGE = ( D3D11_MESSAGE_ID_DEVICE_DRAW_INVALID_USE_OF_CENTER_MULTISAMPLE_PATTERN + 1 ) , + D3D11_MESSAGE_ID_DEVICE_IASETVERTEXBUFFERS_INVALIDRANGE = ( D3D11_MESSAGE_ID_DEVICE_IASETVERTEXBUFFERS_STRIDE_TOO_LARGE + 1 ) , + D3D11_MESSAGE_ID_CREATEINPUTLAYOUT_EMPTY_LAYOUT = ( D3D11_MESSAGE_ID_DEVICE_IASETVERTEXBUFFERS_INVALIDRANGE + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DRAW_RESOURCE_SAMPLE_COUNT_MISMATCH = ( D3D11_MESSAGE_ID_CREATEINPUTLAYOUT_EMPTY_LAYOUT + 1 ) , + D3D11_MESSAGE_ID_D3D10_MESSAGES_END = ( D3D11_MESSAGE_ID_DEVICE_DRAW_RESOURCE_SAMPLE_COUNT_MISMATCH + 1 ) , + D3D11_MESSAGE_ID_D3D10L9_MESSAGES_START = 0x100000, + D3D11_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_STENCIL_NO_TWO_SIDED = ( D3D11_MESSAGE_ID_D3D10L9_MESSAGES_START + 1 ) , + D3D11_MESSAGE_ID_CREATERASTERIZERSTATE_DepthBiasClamp_NOT_SUPPORTED = ( D3D11_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_STENCIL_NO_TWO_SIDED + 1 ) , + D3D11_MESSAGE_ID_CREATESAMPLERSTATE_NO_COMPARISON_SUPPORT = ( D3D11_MESSAGE_ID_CREATERASTERIZERSTATE_DepthBiasClamp_NOT_SUPPORTED + 1 ) , + D3D11_MESSAGE_ID_CREATESAMPLERSTATE_EXCESSIVE_ANISOTROPY = ( D3D11_MESSAGE_ID_CREATESAMPLERSTATE_NO_COMPARISON_SUPPORT + 1 ) , + D3D11_MESSAGE_ID_CREATESAMPLERSTATE_BORDER_OUT_OF_RANGE = ( D3D11_MESSAGE_ID_CREATESAMPLERSTATE_EXCESSIVE_ANISOTROPY + 1 ) , + D3D11_MESSAGE_ID_VSSETSAMPLERS_NOT_SUPPORTED = ( D3D11_MESSAGE_ID_CREATESAMPLERSTATE_BORDER_OUT_OF_RANGE + 1 ) , + D3D11_MESSAGE_ID_VSSETSAMPLERS_TOO_MANY_SAMPLERS = ( D3D11_MESSAGE_ID_VSSETSAMPLERS_NOT_SUPPORTED + 1 ) , + D3D11_MESSAGE_ID_PSSETSAMPLERS_TOO_MANY_SAMPLERS = ( D3D11_MESSAGE_ID_VSSETSAMPLERS_TOO_MANY_SAMPLERS + 1 ) , + D3D11_MESSAGE_ID_CREATERESOURCE_NO_ARRAYS = ( D3D11_MESSAGE_ID_PSSETSAMPLERS_TOO_MANY_SAMPLERS + 1 ) , + D3D11_MESSAGE_ID_CREATERESOURCE_NO_VB_AND_IB_BIND = ( D3D11_MESSAGE_ID_CREATERESOURCE_NO_ARRAYS + 1 ) , + D3D11_MESSAGE_ID_CREATERESOURCE_NO_TEXTURE_1D = ( D3D11_MESSAGE_ID_CREATERESOURCE_NO_VB_AND_IB_BIND + 1 ) , + D3D11_MESSAGE_ID_CREATERESOURCE_DIMENSION_OUT_OF_RANGE = ( D3D11_MESSAGE_ID_CREATERESOURCE_NO_TEXTURE_1D + 1 ) , + D3D11_MESSAGE_ID_CREATERESOURCE_NOT_BINDABLE_AS_SHADER_RESOURCE = ( D3D11_MESSAGE_ID_CREATERESOURCE_DIMENSION_OUT_OF_RANGE + 1 ) , + D3D11_MESSAGE_ID_OMSETRENDERTARGETS_TOO_MANY_RENDER_TARGETS = ( D3D11_MESSAGE_ID_CREATERESOURCE_NOT_BINDABLE_AS_SHADER_RESOURCE + 1 ) , + D3D11_MESSAGE_ID_OMSETRENDERTARGETS_NO_DIFFERING_BIT_DEPTHS = ( D3D11_MESSAGE_ID_OMSETRENDERTARGETS_TOO_MANY_RENDER_TARGETS + 1 ) , + D3D11_MESSAGE_ID_IASETVERTEXBUFFERS_BAD_BUFFER_INDEX = ( D3D11_MESSAGE_ID_OMSETRENDERTARGETS_NO_DIFFERING_BIT_DEPTHS + 1 ) , + D3D11_MESSAGE_ID_DEVICE_RSSETVIEWPORTS_TOO_MANY_VIEWPORTS = ( D3D11_MESSAGE_ID_IASETVERTEXBUFFERS_BAD_BUFFER_INDEX + 1 ) , + D3D11_MESSAGE_ID_DEVICE_IASETPRIMITIVETOPOLOGY_ADJACENCY_UNSUPPORTED = ( D3D11_MESSAGE_ID_DEVICE_RSSETVIEWPORTS_TOO_MANY_VIEWPORTS + 1 ) , + D3D11_MESSAGE_ID_DEVICE_RSSETSCISSORRECTS_TOO_MANY_SCISSORS = ( D3D11_MESSAGE_ID_DEVICE_IASETPRIMITIVETOPOLOGY_ADJACENCY_UNSUPPORTED + 1 ) , + D3D11_MESSAGE_ID_COPYRESOURCE_ONLY_TEXTURE_2D_WITHIN_GPU_MEMORY = ( D3D11_MESSAGE_ID_DEVICE_RSSETSCISSORRECTS_TOO_MANY_SCISSORS + 1 ) , + D3D11_MESSAGE_ID_COPYRESOURCE_NO_TEXTURE_3D_READBACK = ( D3D11_MESSAGE_ID_COPYRESOURCE_ONLY_TEXTURE_2D_WITHIN_GPU_MEMORY + 1 ) , + D3D11_MESSAGE_ID_COPYRESOURCE_NO_TEXTURE_ONLY_READBACK = ( D3D11_MESSAGE_ID_COPYRESOURCE_NO_TEXTURE_3D_READBACK + 1 ) , + D3D11_MESSAGE_ID_CREATEINPUTLAYOUT_UNSUPPORTED_FORMAT = ( D3D11_MESSAGE_ID_COPYRESOURCE_NO_TEXTURE_ONLY_READBACK + 1 ) , + D3D11_MESSAGE_ID_CREATEBLENDSTATE_NO_ALPHA_TO_COVERAGE = ( D3D11_MESSAGE_ID_CREATEINPUTLAYOUT_UNSUPPORTED_FORMAT + 1 ) , + D3D11_MESSAGE_ID_CREATERASTERIZERSTATE_DepthClipEnable_MUST_BE_TRUE = ( D3D11_MESSAGE_ID_CREATEBLENDSTATE_NO_ALPHA_TO_COVERAGE + 1 ) , + D3D11_MESSAGE_ID_DRAWINDEXED_STARTINDEXLOCATION_MUST_BE_POSITIVE = ( D3D11_MESSAGE_ID_CREATERASTERIZERSTATE_DepthClipEnable_MUST_BE_TRUE + 1 ) , + D3D11_MESSAGE_ID_CREATESHADERRESOURCEVIEW_MUST_USE_LOWEST_LOD = ( D3D11_MESSAGE_ID_DRAWINDEXED_STARTINDEXLOCATION_MUST_BE_POSITIVE + 1 ) , + D3D11_MESSAGE_ID_CREATESAMPLERSTATE_MINLOD_MUST_NOT_BE_FRACTIONAL = ( D3D11_MESSAGE_ID_CREATESHADERRESOURCEVIEW_MUST_USE_LOWEST_LOD + 1 ) , + D3D11_MESSAGE_ID_CREATESAMPLERSTATE_MAXLOD_MUST_BE_FLT_MAX = ( D3D11_MESSAGE_ID_CREATESAMPLERSTATE_MINLOD_MUST_NOT_BE_FRACTIONAL + 1 ) , + D3D11_MESSAGE_ID_CREATESHADERRESOURCEVIEW_FIRSTARRAYSLICE_MUST_BE_ZERO = ( D3D11_MESSAGE_ID_CREATESAMPLERSTATE_MAXLOD_MUST_BE_FLT_MAX + 1 ) , + D3D11_MESSAGE_ID_CREATESHADERRESOURCEVIEW_CUBES_MUST_HAVE_6_SIDES = ( D3D11_MESSAGE_ID_CREATESHADERRESOURCEVIEW_FIRSTARRAYSLICE_MUST_BE_ZERO + 1 ) , + D3D11_MESSAGE_ID_CREATERESOURCE_NOT_BINDABLE_AS_RENDER_TARGET = ( D3D11_MESSAGE_ID_CREATESHADERRESOURCEVIEW_CUBES_MUST_HAVE_6_SIDES + 1 ) , + D3D11_MESSAGE_ID_CREATERESOURCE_NO_DWORD_INDEX_BUFFER = ( D3D11_MESSAGE_ID_CREATERESOURCE_NOT_BINDABLE_AS_RENDER_TARGET + 1 ) , + D3D11_MESSAGE_ID_CREATERESOURCE_MSAA_PRECLUDES_SHADER_RESOURCE = ( D3D11_MESSAGE_ID_CREATERESOURCE_NO_DWORD_INDEX_BUFFER + 1 ) , + D3D11_MESSAGE_ID_CREATERESOURCE_PRESENTATION_PRECLUDES_SHADER_RESOURCE = ( D3D11_MESSAGE_ID_CREATERESOURCE_MSAA_PRECLUDES_SHADER_RESOURCE + 1 ) , + D3D11_MESSAGE_ID_CREATEBLENDSTATE_NO_INDEPENDENT_BLEND_ENABLE = ( D3D11_MESSAGE_ID_CREATERESOURCE_PRESENTATION_PRECLUDES_SHADER_RESOURCE + 1 ) , + D3D11_MESSAGE_ID_CREATEBLENDSTATE_NO_INDEPENDENT_WRITE_MASKS = ( D3D11_MESSAGE_ID_CREATEBLENDSTATE_NO_INDEPENDENT_BLEND_ENABLE + 1 ) , + D3D11_MESSAGE_ID_CREATERESOURCE_NO_STREAM_OUT = ( D3D11_MESSAGE_ID_CREATEBLENDSTATE_NO_INDEPENDENT_WRITE_MASKS + 1 ) , + D3D11_MESSAGE_ID_CREATERESOURCE_ONLY_VB_IB_FOR_BUFFERS = ( D3D11_MESSAGE_ID_CREATERESOURCE_NO_STREAM_OUT + 1 ) , + D3D11_MESSAGE_ID_CREATERESOURCE_NO_AUTOGEN_FOR_VOLUMES = ( D3D11_MESSAGE_ID_CREATERESOURCE_ONLY_VB_IB_FOR_BUFFERS + 1 ) , + D3D11_MESSAGE_ID_CREATERESOURCE_DXGI_FORMAT_R8G8B8A8_CANNOT_BE_SHARED = ( D3D11_MESSAGE_ID_CREATERESOURCE_NO_AUTOGEN_FOR_VOLUMES + 1 ) , + D3D11_MESSAGE_ID_VSSHADERRESOURCES_NOT_SUPPORTED = ( D3D11_MESSAGE_ID_CREATERESOURCE_DXGI_FORMAT_R8G8B8A8_CANNOT_BE_SHARED + 1 ) , + D3D11_MESSAGE_ID_GEOMETRY_SHADER_NOT_SUPPORTED = ( D3D11_MESSAGE_ID_VSSHADERRESOURCES_NOT_SUPPORTED + 1 ) , + D3D11_MESSAGE_ID_STREAM_OUT_NOT_SUPPORTED = ( D3D11_MESSAGE_ID_GEOMETRY_SHADER_NOT_SUPPORTED + 1 ) , + D3D11_MESSAGE_ID_TEXT_FILTER_NOT_SUPPORTED = ( D3D11_MESSAGE_ID_STREAM_OUT_NOT_SUPPORTED + 1 ) , + D3D11_MESSAGE_ID_CREATEBLENDSTATE_NO_SEPARATE_ALPHA_BLEND = ( D3D11_MESSAGE_ID_TEXT_FILTER_NOT_SUPPORTED + 1 ) , + D3D11_MESSAGE_ID_CREATEBLENDSTATE_NO_MRT_BLEND = ( D3D11_MESSAGE_ID_CREATEBLENDSTATE_NO_SEPARATE_ALPHA_BLEND + 1 ) , + D3D11_MESSAGE_ID_CREATEBLENDSTATE_OPERATION_NOT_SUPPORTED = ( D3D11_MESSAGE_ID_CREATEBLENDSTATE_NO_MRT_BLEND + 1 ) , + D3D11_MESSAGE_ID_CREATESAMPLERSTATE_NO_MIRRORONCE = ( D3D11_MESSAGE_ID_CREATEBLENDSTATE_OPERATION_NOT_SUPPORTED + 1 ) , + D3D11_MESSAGE_ID_DRAWINSTANCED_NOT_SUPPORTED = ( D3D11_MESSAGE_ID_CREATESAMPLERSTATE_NO_MIRRORONCE + 1 ) , + D3D11_MESSAGE_ID_DRAWINDEXEDINSTANCED_NOT_SUPPORTED_BELOW_9_3 = ( D3D11_MESSAGE_ID_DRAWINSTANCED_NOT_SUPPORTED + 1 ) , + D3D11_MESSAGE_ID_DRAWINDEXED_POINTLIST_UNSUPPORTED = ( D3D11_MESSAGE_ID_DRAWINDEXEDINSTANCED_NOT_SUPPORTED_BELOW_9_3 + 1 ) , + D3D11_MESSAGE_ID_SETBLENDSTATE_SAMPLE_MASK_CANNOT_BE_ZERO = ( D3D11_MESSAGE_ID_DRAWINDEXED_POINTLIST_UNSUPPORTED + 1 ) , + D3D11_MESSAGE_ID_CREATERESOURCE_DIMENSION_EXCEEDS_FEATURE_LEVEL_DEFINITION = ( D3D11_MESSAGE_ID_SETBLENDSTATE_SAMPLE_MASK_CANNOT_BE_ZERO + 1 ) , + D3D11_MESSAGE_ID_CREATERESOURCE_ONLY_SINGLE_MIP_LEVEL_DEPTH_STENCIL_SUPPORTED = ( D3D11_MESSAGE_ID_CREATERESOURCE_DIMENSION_EXCEEDS_FEATURE_LEVEL_DEFINITION + 1 ) , + D3D11_MESSAGE_ID_DEVICE_RSSETSCISSORRECTS_NEGATIVESCISSOR = ( D3D11_MESSAGE_ID_CREATERESOURCE_ONLY_SINGLE_MIP_LEVEL_DEPTH_STENCIL_SUPPORTED + 1 ) , + D3D11_MESSAGE_ID_SLOT_ZERO_MUST_BE_D3D10_INPUT_PER_VERTEX_DATA = ( D3D11_MESSAGE_ID_DEVICE_RSSETSCISSORRECTS_NEGATIVESCISSOR + 1 ) , + D3D11_MESSAGE_ID_CREATERESOURCE_NON_POW_2_MIPMAP = ( D3D11_MESSAGE_ID_SLOT_ZERO_MUST_BE_D3D10_INPUT_PER_VERTEX_DATA + 1 ) , + D3D11_MESSAGE_ID_CREATESAMPLERSTATE_BORDER_NOT_SUPPORTED = ( D3D11_MESSAGE_ID_CREATERESOURCE_NON_POW_2_MIPMAP + 1 ) , + D3D11_MESSAGE_ID_OMSETRENDERTARGETS_NO_SRGB_MRT = ( D3D11_MESSAGE_ID_CREATESAMPLERSTATE_BORDER_NOT_SUPPORTED + 1 ) , + D3D11_MESSAGE_ID_D3D10L9_MESSAGES_END = ( D3D11_MESSAGE_ID_OMSETRENDERTARGETS_NO_SRGB_MRT + 1 ) , + D3D11_MESSAGE_ID_D3D11_MESSAGES_START = 0x200000, + D3D11_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDFLAGS = ( D3D11_MESSAGE_ID_D3D11_MESSAGES_START + 1 ) , + D3D11_MESSAGE_ID_CREATEVERTEXSHADER_INVALIDCLASSLINKAGE = ( D3D11_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDFLAGS + 1 ) , + D3D11_MESSAGE_ID_CREATEGEOMETRYSHADER_INVALIDCLASSLINKAGE = ( D3D11_MESSAGE_ID_CREATEVERTEXSHADER_INVALIDCLASSLINKAGE + 1 ) , + D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDNUMSTREAMS = ( D3D11_MESSAGE_ID_CREATEGEOMETRYSHADER_INVALIDCLASSLINKAGE + 1 ) , + D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSTREAMTORASTERIZER = ( D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDNUMSTREAMS + 1 ) , + D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_UNEXPECTEDSTREAMS = ( D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSTREAMTORASTERIZER + 1 ) , + D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDCLASSLINKAGE = ( D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_UNEXPECTEDSTREAMS + 1 ) , + D3D11_MESSAGE_ID_CREATEPIXELSHADER_INVALIDCLASSLINKAGE = ( D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDCLASSLINKAGE + 1 ) , + D3D11_MESSAGE_ID_CREATEDEFERREDCONTEXT_INVALID_COMMANDLISTFLAGS = ( D3D11_MESSAGE_ID_CREATEPIXELSHADER_INVALIDCLASSLINKAGE + 1 ) , + D3D11_MESSAGE_ID_CREATEDEFERREDCONTEXT_SINGLETHREADED = ( D3D11_MESSAGE_ID_CREATEDEFERREDCONTEXT_INVALID_COMMANDLISTFLAGS + 1 ) , + D3D11_MESSAGE_ID_CREATEDEFERREDCONTEXT_INVALIDARG_RETURN = ( D3D11_MESSAGE_ID_CREATEDEFERREDCONTEXT_SINGLETHREADED + 1 ) , + D3D11_MESSAGE_ID_CREATEDEFERREDCONTEXT_INVALID_CALL_RETURN = ( D3D11_MESSAGE_ID_CREATEDEFERREDCONTEXT_INVALIDARG_RETURN + 1 ) , + D3D11_MESSAGE_ID_CREATEDEFERREDCONTEXT_OUTOFMEMORY_RETURN = ( D3D11_MESSAGE_ID_CREATEDEFERREDCONTEXT_INVALID_CALL_RETURN + 1 ) , + D3D11_MESSAGE_ID_FINISHDISPLAYLIST_ONIMMEDIATECONTEXT = ( D3D11_MESSAGE_ID_CREATEDEFERREDCONTEXT_OUTOFMEMORY_RETURN + 1 ) , + D3D11_MESSAGE_ID_FINISHDISPLAYLIST_OUTOFMEMORY_RETURN = ( D3D11_MESSAGE_ID_FINISHDISPLAYLIST_ONIMMEDIATECONTEXT + 1 ) , + D3D11_MESSAGE_ID_FINISHDISPLAYLIST_INVALID_CALL_RETURN = ( D3D11_MESSAGE_ID_FINISHDISPLAYLIST_OUTOFMEMORY_RETURN + 1 ) , + D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSTREAM = ( D3D11_MESSAGE_ID_FINISHDISPLAYLIST_INVALID_CALL_RETURN + 1 ) , + D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_UNEXPECTEDENTRIES = ( D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSTREAM + 1 ) , + D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_UNEXPECTEDSTRIDES = ( D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_UNEXPECTEDENTRIES + 1 ) , + D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDNUMSTRIDES = ( D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_UNEXPECTEDSTRIDES + 1 ) , + D3D11_MESSAGE_ID_DEVICE_HSSETSHADERRESOURCES_HAZARD = ( D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDNUMSTRIDES + 1 ) , + D3D11_MESSAGE_ID_DEVICE_HSSETCONSTANTBUFFERS_HAZARD = ( D3D11_MESSAGE_ID_DEVICE_HSSETSHADERRESOURCES_HAZARD + 1 ) , + D3D11_MESSAGE_ID_HSSETSHADERRESOURCES_UNBINDDELETINGOBJECT = ( D3D11_MESSAGE_ID_DEVICE_HSSETCONSTANTBUFFERS_HAZARD + 1 ) , + D3D11_MESSAGE_ID_HSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT = ( D3D11_MESSAGE_ID_HSSETSHADERRESOURCES_UNBINDDELETINGOBJECT + 1 ) , + D3D11_MESSAGE_ID_CREATEHULLSHADER_INVALIDCALL = ( D3D11_MESSAGE_ID_HSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT + 1 ) , + D3D11_MESSAGE_ID_CREATEHULLSHADER_OUTOFMEMORY = ( D3D11_MESSAGE_ID_CREATEHULLSHADER_INVALIDCALL + 1 ) , + D3D11_MESSAGE_ID_CREATEHULLSHADER_INVALIDSHADERBYTECODE = ( D3D11_MESSAGE_ID_CREATEHULLSHADER_OUTOFMEMORY + 1 ) , + D3D11_MESSAGE_ID_CREATEHULLSHADER_INVALIDSHADERTYPE = ( D3D11_MESSAGE_ID_CREATEHULLSHADER_INVALIDSHADERBYTECODE + 1 ) , + D3D11_MESSAGE_ID_CREATEHULLSHADER_INVALIDCLASSLINKAGE = ( D3D11_MESSAGE_ID_CREATEHULLSHADER_INVALIDSHADERTYPE + 1 ) , + D3D11_MESSAGE_ID_DEVICE_HSSETSHADERRESOURCES_VIEWS_EMPTY = ( D3D11_MESSAGE_ID_CREATEHULLSHADER_INVALIDCLASSLINKAGE + 1 ) , + D3D11_MESSAGE_ID_HSSETCONSTANTBUFFERS_INVALIDBUFFER = ( D3D11_MESSAGE_ID_DEVICE_HSSETSHADERRESOURCES_VIEWS_EMPTY + 1 ) , + D3D11_MESSAGE_ID_DEVICE_HSSETCONSTANTBUFFERS_BUFFERS_EMPTY = ( D3D11_MESSAGE_ID_HSSETCONSTANTBUFFERS_INVALIDBUFFER + 1 ) , + D3D11_MESSAGE_ID_DEVICE_HSSETSAMPLERS_SAMPLERS_EMPTY = ( D3D11_MESSAGE_ID_DEVICE_HSSETCONSTANTBUFFERS_BUFFERS_EMPTY + 1 ) , + D3D11_MESSAGE_ID_DEVICE_HSGETSHADERRESOURCES_VIEWS_EMPTY = ( D3D11_MESSAGE_ID_DEVICE_HSSETSAMPLERS_SAMPLERS_EMPTY + 1 ) , + D3D11_MESSAGE_ID_DEVICE_HSGETCONSTANTBUFFERS_BUFFERS_EMPTY = ( D3D11_MESSAGE_ID_DEVICE_HSGETSHADERRESOURCES_VIEWS_EMPTY + 1 ) , + D3D11_MESSAGE_ID_DEVICE_HSGETSAMPLERS_SAMPLERS_EMPTY = ( D3D11_MESSAGE_ID_DEVICE_HSGETCONSTANTBUFFERS_BUFFERS_EMPTY + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DSSETSHADERRESOURCES_HAZARD = ( D3D11_MESSAGE_ID_DEVICE_HSGETSAMPLERS_SAMPLERS_EMPTY + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DSSETCONSTANTBUFFERS_HAZARD = ( D3D11_MESSAGE_ID_DEVICE_DSSETSHADERRESOURCES_HAZARD + 1 ) , + D3D11_MESSAGE_ID_DSSETSHADERRESOURCES_UNBINDDELETINGOBJECT = ( D3D11_MESSAGE_ID_DEVICE_DSSETCONSTANTBUFFERS_HAZARD + 1 ) , + D3D11_MESSAGE_ID_DSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT = ( D3D11_MESSAGE_ID_DSSETSHADERRESOURCES_UNBINDDELETINGOBJECT + 1 ) , + D3D11_MESSAGE_ID_CREATEDOMAINSHADER_INVALIDCALL = ( D3D11_MESSAGE_ID_DSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT + 1 ) , + D3D11_MESSAGE_ID_CREATEDOMAINSHADER_OUTOFMEMORY = ( D3D11_MESSAGE_ID_CREATEDOMAINSHADER_INVALIDCALL + 1 ) , + D3D11_MESSAGE_ID_CREATEDOMAINSHADER_INVALIDSHADERBYTECODE = ( D3D11_MESSAGE_ID_CREATEDOMAINSHADER_OUTOFMEMORY + 1 ) , + D3D11_MESSAGE_ID_CREATEDOMAINSHADER_INVALIDSHADERTYPE = ( D3D11_MESSAGE_ID_CREATEDOMAINSHADER_INVALIDSHADERBYTECODE + 1 ) , + D3D11_MESSAGE_ID_CREATEDOMAINSHADER_INVALIDCLASSLINKAGE = ( D3D11_MESSAGE_ID_CREATEDOMAINSHADER_INVALIDSHADERTYPE + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DSSETSHADERRESOURCES_VIEWS_EMPTY = ( D3D11_MESSAGE_ID_CREATEDOMAINSHADER_INVALIDCLASSLINKAGE + 1 ) , + D3D11_MESSAGE_ID_DSSETCONSTANTBUFFERS_INVALIDBUFFER = ( D3D11_MESSAGE_ID_DEVICE_DSSETSHADERRESOURCES_VIEWS_EMPTY + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DSSETCONSTANTBUFFERS_BUFFERS_EMPTY = ( D3D11_MESSAGE_ID_DSSETCONSTANTBUFFERS_INVALIDBUFFER + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DSSETSAMPLERS_SAMPLERS_EMPTY = ( D3D11_MESSAGE_ID_DEVICE_DSSETCONSTANTBUFFERS_BUFFERS_EMPTY + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DSGETSHADERRESOURCES_VIEWS_EMPTY = ( D3D11_MESSAGE_ID_DEVICE_DSSETSAMPLERS_SAMPLERS_EMPTY + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DSGETCONSTANTBUFFERS_BUFFERS_EMPTY = ( D3D11_MESSAGE_ID_DEVICE_DSGETSHADERRESOURCES_VIEWS_EMPTY + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DSGETSAMPLERS_SAMPLERS_EMPTY = ( D3D11_MESSAGE_ID_DEVICE_DSGETCONSTANTBUFFERS_BUFFERS_EMPTY + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DRAW_HS_XOR_DS_MISMATCH = ( D3D11_MESSAGE_ID_DEVICE_DSGETSAMPLERS_SAMPLERS_EMPTY + 1 ) , + D3D11_MESSAGE_ID_DEFERRED_CONTEXT_REMOVAL_PROCESS_AT_FAULT = ( D3D11_MESSAGE_ID_DEVICE_DRAW_HS_XOR_DS_MISMATCH + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DRAWINDIRECT_INVALID_ARG_BUFFER = ( D3D11_MESSAGE_ID_DEFERRED_CONTEXT_REMOVAL_PROCESS_AT_FAULT + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DRAWINDIRECT_OFFSET_UNALIGNED = ( D3D11_MESSAGE_ID_DEVICE_DRAWINDIRECT_INVALID_ARG_BUFFER + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DRAWINDIRECT_OFFSET_OVERFLOW = ( D3D11_MESSAGE_ID_DEVICE_DRAWINDIRECT_OFFSET_UNALIGNED + 1 ) , + D3D11_MESSAGE_ID_RESOURCE_MAP_INVALIDMAPTYPE = ( D3D11_MESSAGE_ID_DEVICE_DRAWINDIRECT_OFFSET_OVERFLOW + 1 ) , + D3D11_MESSAGE_ID_RESOURCE_MAP_INVALIDSUBRESOURCE = ( D3D11_MESSAGE_ID_RESOURCE_MAP_INVALIDMAPTYPE + 1 ) , + D3D11_MESSAGE_ID_RESOURCE_MAP_INVALIDFLAGS = ( D3D11_MESSAGE_ID_RESOURCE_MAP_INVALIDSUBRESOURCE + 1 ) , + D3D11_MESSAGE_ID_RESOURCE_MAP_ALREADYMAPPED = ( D3D11_MESSAGE_ID_RESOURCE_MAP_INVALIDFLAGS + 1 ) , + D3D11_MESSAGE_ID_RESOURCE_MAP_DEVICEREMOVED_RETURN = ( D3D11_MESSAGE_ID_RESOURCE_MAP_ALREADYMAPPED + 1 ) , + D3D11_MESSAGE_ID_RESOURCE_MAP_OUTOFMEMORY_RETURN = ( D3D11_MESSAGE_ID_RESOURCE_MAP_DEVICEREMOVED_RETURN + 1 ) , + D3D11_MESSAGE_ID_RESOURCE_MAP_WITHOUT_INITIAL_DISCARD = ( D3D11_MESSAGE_ID_RESOURCE_MAP_OUTOFMEMORY_RETURN + 1 ) , + D3D11_MESSAGE_ID_RESOURCE_UNMAP_INVALIDSUBRESOURCE = ( D3D11_MESSAGE_ID_RESOURCE_MAP_WITHOUT_INITIAL_DISCARD + 1 ) , + D3D11_MESSAGE_ID_RESOURCE_UNMAP_NOTMAPPED = ( D3D11_MESSAGE_ID_RESOURCE_UNMAP_INVALIDSUBRESOURCE + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DRAW_RASTERIZING_CONTROL_POINTS = ( D3D11_MESSAGE_ID_RESOURCE_UNMAP_NOTMAPPED + 1 ) , + D3D11_MESSAGE_ID_DEVICE_IASETPRIMITIVETOPOLOGY_TOPOLOGY_UNSUPPORTED = ( D3D11_MESSAGE_ID_DEVICE_DRAW_RASTERIZING_CONTROL_POINTS + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DRAW_HS_DS_SIGNATURE_MISMATCH = ( D3D11_MESSAGE_ID_DEVICE_IASETPRIMITIVETOPOLOGY_TOPOLOGY_UNSUPPORTED + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DRAW_HULL_SHADER_INPUT_TOPOLOGY_MISMATCH = ( D3D11_MESSAGE_ID_DEVICE_DRAW_HS_DS_SIGNATURE_MISMATCH + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DRAW_HS_DS_CONTROL_POINT_COUNT_MISMATCH = ( D3D11_MESSAGE_ID_DEVICE_DRAW_HULL_SHADER_INPUT_TOPOLOGY_MISMATCH + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DRAW_HS_DS_TESSELLATOR_DOMAIN_MISMATCH = ( D3D11_MESSAGE_ID_DEVICE_DRAW_HS_DS_CONTROL_POINT_COUNT_MISMATCH + 1 ) , + D3D11_MESSAGE_ID_CREATE_CONTEXT = ( D3D11_MESSAGE_ID_DEVICE_DRAW_HS_DS_TESSELLATOR_DOMAIN_MISMATCH + 1 ) , + D3D11_MESSAGE_ID_LIVE_CONTEXT = ( D3D11_MESSAGE_ID_CREATE_CONTEXT + 1 ) , + D3D11_MESSAGE_ID_DESTROY_CONTEXT = ( D3D11_MESSAGE_ID_LIVE_CONTEXT + 1 ) , + D3D11_MESSAGE_ID_CREATE_BUFFER = ( D3D11_MESSAGE_ID_DESTROY_CONTEXT + 1 ) , + D3D11_MESSAGE_ID_LIVE_BUFFER = ( D3D11_MESSAGE_ID_CREATE_BUFFER + 1 ) , + D3D11_MESSAGE_ID_DESTROY_BUFFER = ( D3D11_MESSAGE_ID_LIVE_BUFFER + 1 ) , + D3D11_MESSAGE_ID_CREATE_TEXTURE1D = ( D3D11_MESSAGE_ID_DESTROY_BUFFER + 1 ) , + D3D11_MESSAGE_ID_LIVE_TEXTURE1D = ( D3D11_MESSAGE_ID_CREATE_TEXTURE1D + 1 ) , + D3D11_MESSAGE_ID_DESTROY_TEXTURE1D = ( D3D11_MESSAGE_ID_LIVE_TEXTURE1D + 1 ) , + D3D11_MESSAGE_ID_CREATE_TEXTURE2D = ( D3D11_MESSAGE_ID_DESTROY_TEXTURE1D + 1 ) , + D3D11_MESSAGE_ID_LIVE_TEXTURE2D = ( D3D11_MESSAGE_ID_CREATE_TEXTURE2D + 1 ) , + D3D11_MESSAGE_ID_DESTROY_TEXTURE2D = ( D3D11_MESSAGE_ID_LIVE_TEXTURE2D + 1 ) , + D3D11_MESSAGE_ID_CREATE_TEXTURE3D = ( D3D11_MESSAGE_ID_DESTROY_TEXTURE2D + 1 ) , + D3D11_MESSAGE_ID_LIVE_TEXTURE3D = ( D3D11_MESSAGE_ID_CREATE_TEXTURE3D + 1 ) , + D3D11_MESSAGE_ID_DESTROY_TEXTURE3D = ( D3D11_MESSAGE_ID_LIVE_TEXTURE3D + 1 ) , + D3D11_MESSAGE_ID_CREATE_SHADERRESOURCEVIEW = ( D3D11_MESSAGE_ID_DESTROY_TEXTURE3D + 1 ) , + D3D11_MESSAGE_ID_LIVE_SHADERRESOURCEVIEW = ( D3D11_MESSAGE_ID_CREATE_SHADERRESOURCEVIEW + 1 ) , + D3D11_MESSAGE_ID_DESTROY_SHADERRESOURCEVIEW = ( D3D11_MESSAGE_ID_LIVE_SHADERRESOURCEVIEW + 1 ) , + D3D11_MESSAGE_ID_CREATE_RENDERTARGETVIEW = ( D3D11_MESSAGE_ID_DESTROY_SHADERRESOURCEVIEW + 1 ) , + D3D11_MESSAGE_ID_LIVE_RENDERTARGETVIEW = ( D3D11_MESSAGE_ID_CREATE_RENDERTARGETVIEW + 1 ) , + D3D11_MESSAGE_ID_DESTROY_RENDERTARGETVIEW = ( D3D11_MESSAGE_ID_LIVE_RENDERTARGETVIEW + 1 ) , + D3D11_MESSAGE_ID_CREATE_DEPTHSTENCILVIEW = ( D3D11_MESSAGE_ID_DESTROY_RENDERTARGETVIEW + 1 ) , + D3D11_MESSAGE_ID_LIVE_DEPTHSTENCILVIEW = ( D3D11_MESSAGE_ID_CREATE_DEPTHSTENCILVIEW + 1 ) , + D3D11_MESSAGE_ID_DESTROY_DEPTHSTENCILVIEW = ( D3D11_MESSAGE_ID_LIVE_DEPTHSTENCILVIEW + 1 ) , + D3D11_MESSAGE_ID_CREATE_VERTEXSHADER = ( D3D11_MESSAGE_ID_DESTROY_DEPTHSTENCILVIEW + 1 ) , + D3D11_MESSAGE_ID_LIVE_VERTEXSHADER = ( D3D11_MESSAGE_ID_CREATE_VERTEXSHADER + 1 ) , + D3D11_MESSAGE_ID_DESTROY_VERTEXSHADER = ( D3D11_MESSAGE_ID_LIVE_VERTEXSHADER + 1 ) , + D3D11_MESSAGE_ID_CREATE_HULLSHADER = ( D3D11_MESSAGE_ID_DESTROY_VERTEXSHADER + 1 ) , + D3D11_MESSAGE_ID_LIVE_HULLSHADER = ( D3D11_MESSAGE_ID_CREATE_HULLSHADER + 1 ) , + D3D11_MESSAGE_ID_DESTROY_HULLSHADER = ( D3D11_MESSAGE_ID_LIVE_HULLSHADER + 1 ) , + D3D11_MESSAGE_ID_CREATE_DOMAINSHADER = ( D3D11_MESSAGE_ID_DESTROY_HULLSHADER + 1 ) , + D3D11_MESSAGE_ID_LIVE_DOMAINSHADER = ( D3D11_MESSAGE_ID_CREATE_DOMAINSHADER + 1 ) , + D3D11_MESSAGE_ID_DESTROY_DOMAINSHADER = ( D3D11_MESSAGE_ID_LIVE_DOMAINSHADER + 1 ) , + D3D11_MESSAGE_ID_CREATE_GEOMETRYSHADER = ( D3D11_MESSAGE_ID_DESTROY_DOMAINSHADER + 1 ) , + D3D11_MESSAGE_ID_LIVE_GEOMETRYSHADER = ( D3D11_MESSAGE_ID_CREATE_GEOMETRYSHADER + 1 ) , + D3D11_MESSAGE_ID_DESTROY_GEOMETRYSHADER = ( D3D11_MESSAGE_ID_LIVE_GEOMETRYSHADER + 1 ) , + D3D11_MESSAGE_ID_CREATE_PIXELSHADER = ( D3D11_MESSAGE_ID_DESTROY_GEOMETRYSHADER + 1 ) , + D3D11_MESSAGE_ID_LIVE_PIXELSHADER = ( D3D11_MESSAGE_ID_CREATE_PIXELSHADER + 1 ) , + D3D11_MESSAGE_ID_DESTROY_PIXELSHADER = ( D3D11_MESSAGE_ID_LIVE_PIXELSHADER + 1 ) , + D3D11_MESSAGE_ID_CREATE_INPUTLAYOUT = ( D3D11_MESSAGE_ID_DESTROY_PIXELSHADER + 1 ) , + D3D11_MESSAGE_ID_LIVE_INPUTLAYOUT = ( D3D11_MESSAGE_ID_CREATE_INPUTLAYOUT + 1 ) , + D3D11_MESSAGE_ID_DESTROY_INPUTLAYOUT = ( D3D11_MESSAGE_ID_LIVE_INPUTLAYOUT + 1 ) , + D3D11_MESSAGE_ID_CREATE_SAMPLER = ( D3D11_MESSAGE_ID_DESTROY_INPUTLAYOUT + 1 ) , + D3D11_MESSAGE_ID_LIVE_SAMPLER = ( D3D11_MESSAGE_ID_CREATE_SAMPLER + 1 ) , + D3D11_MESSAGE_ID_DESTROY_SAMPLER = ( D3D11_MESSAGE_ID_LIVE_SAMPLER + 1 ) , + D3D11_MESSAGE_ID_CREATE_BLENDSTATE = ( D3D11_MESSAGE_ID_DESTROY_SAMPLER + 1 ) , + D3D11_MESSAGE_ID_LIVE_BLENDSTATE = ( D3D11_MESSAGE_ID_CREATE_BLENDSTATE + 1 ) , + D3D11_MESSAGE_ID_DESTROY_BLENDSTATE = ( D3D11_MESSAGE_ID_LIVE_BLENDSTATE + 1 ) , + D3D11_MESSAGE_ID_CREATE_DEPTHSTENCILSTATE = ( D3D11_MESSAGE_ID_DESTROY_BLENDSTATE + 1 ) , + D3D11_MESSAGE_ID_LIVE_DEPTHSTENCILSTATE = ( D3D11_MESSAGE_ID_CREATE_DEPTHSTENCILSTATE + 1 ) , + D3D11_MESSAGE_ID_DESTROY_DEPTHSTENCILSTATE = ( D3D11_MESSAGE_ID_LIVE_DEPTHSTENCILSTATE + 1 ) , + D3D11_MESSAGE_ID_CREATE_RASTERIZERSTATE = ( D3D11_MESSAGE_ID_DESTROY_DEPTHSTENCILSTATE + 1 ) , + D3D11_MESSAGE_ID_LIVE_RASTERIZERSTATE = ( D3D11_MESSAGE_ID_CREATE_RASTERIZERSTATE + 1 ) , + D3D11_MESSAGE_ID_DESTROY_RASTERIZERSTATE = ( D3D11_MESSAGE_ID_LIVE_RASTERIZERSTATE + 1 ) , + D3D11_MESSAGE_ID_CREATE_QUERY = ( D3D11_MESSAGE_ID_DESTROY_RASTERIZERSTATE + 1 ) , + D3D11_MESSAGE_ID_LIVE_QUERY = ( D3D11_MESSAGE_ID_CREATE_QUERY + 1 ) , + D3D11_MESSAGE_ID_DESTROY_QUERY = ( D3D11_MESSAGE_ID_LIVE_QUERY + 1 ) , + D3D11_MESSAGE_ID_CREATE_PREDICATE = ( D3D11_MESSAGE_ID_DESTROY_QUERY + 1 ) , + D3D11_MESSAGE_ID_LIVE_PREDICATE = ( D3D11_MESSAGE_ID_CREATE_PREDICATE + 1 ) , + D3D11_MESSAGE_ID_DESTROY_PREDICATE = ( D3D11_MESSAGE_ID_LIVE_PREDICATE + 1 ) , + D3D11_MESSAGE_ID_CREATE_COUNTER = ( D3D11_MESSAGE_ID_DESTROY_PREDICATE + 1 ) , + D3D11_MESSAGE_ID_LIVE_COUNTER = ( D3D11_MESSAGE_ID_CREATE_COUNTER + 1 ) , + D3D11_MESSAGE_ID_DESTROY_COUNTER = ( D3D11_MESSAGE_ID_LIVE_COUNTER + 1 ) , + D3D11_MESSAGE_ID_CREATE_COMMANDLIST = ( D3D11_MESSAGE_ID_DESTROY_COUNTER + 1 ) , + D3D11_MESSAGE_ID_LIVE_COMMANDLIST = ( D3D11_MESSAGE_ID_CREATE_COMMANDLIST + 1 ) , + D3D11_MESSAGE_ID_DESTROY_COMMANDLIST = ( D3D11_MESSAGE_ID_LIVE_COMMANDLIST + 1 ) , + D3D11_MESSAGE_ID_CREATE_CLASSINSTANCE = ( D3D11_MESSAGE_ID_DESTROY_COMMANDLIST + 1 ) , + D3D11_MESSAGE_ID_LIVE_CLASSINSTANCE = ( D3D11_MESSAGE_ID_CREATE_CLASSINSTANCE + 1 ) , + D3D11_MESSAGE_ID_DESTROY_CLASSINSTANCE = ( D3D11_MESSAGE_ID_LIVE_CLASSINSTANCE + 1 ) , + D3D11_MESSAGE_ID_CREATE_CLASSLINKAGE = ( D3D11_MESSAGE_ID_DESTROY_CLASSINSTANCE + 1 ) , + D3D11_MESSAGE_ID_LIVE_CLASSLINKAGE = ( D3D11_MESSAGE_ID_CREATE_CLASSLINKAGE + 1 ) , + D3D11_MESSAGE_ID_DESTROY_CLASSLINKAGE = ( D3D11_MESSAGE_ID_LIVE_CLASSLINKAGE + 1 ) , + D3D11_MESSAGE_ID_LIVE_DEVICE = ( D3D11_MESSAGE_ID_DESTROY_CLASSLINKAGE + 1 ) , + D3D11_MESSAGE_ID_LIVE_OBJECT_SUMMARY = ( D3D11_MESSAGE_ID_LIVE_DEVICE + 1 ) , + D3D11_MESSAGE_ID_CREATE_COMPUTESHADER = ( D3D11_MESSAGE_ID_LIVE_OBJECT_SUMMARY + 1 ) , + D3D11_MESSAGE_ID_LIVE_COMPUTESHADER = ( D3D11_MESSAGE_ID_CREATE_COMPUTESHADER + 1 ) , + D3D11_MESSAGE_ID_DESTROY_COMPUTESHADER = ( D3D11_MESSAGE_ID_LIVE_COMPUTESHADER + 1 ) , + D3D11_MESSAGE_ID_CREATE_UNORDEREDACCESSVIEW = ( D3D11_MESSAGE_ID_DESTROY_COMPUTESHADER + 1 ) , + D3D11_MESSAGE_ID_LIVE_UNORDEREDACCESSVIEW = ( D3D11_MESSAGE_ID_CREATE_UNORDEREDACCESSVIEW + 1 ) , + D3D11_MESSAGE_ID_DESTROY_UNORDEREDACCESSVIEW = ( D3D11_MESSAGE_ID_LIVE_UNORDEREDACCESSVIEW + 1 ) , + D3D11_MESSAGE_ID_DEVICE_SETSHADER_INTERFACES_FEATURELEVEL = ( D3D11_MESSAGE_ID_DESTROY_UNORDEREDACCESSVIEW + 1 ) , + D3D11_MESSAGE_ID_DEVICE_SETSHADER_INTERFACE_COUNT_MISMATCH = ( D3D11_MESSAGE_ID_DEVICE_SETSHADER_INTERFACES_FEATURELEVEL + 1 ) , + D3D11_MESSAGE_ID_DEVICE_SETSHADER_INVALID_INSTANCE = ( D3D11_MESSAGE_ID_DEVICE_SETSHADER_INTERFACE_COUNT_MISMATCH + 1 ) , + D3D11_MESSAGE_ID_DEVICE_SETSHADER_INVALID_INSTANCE_INDEX = ( D3D11_MESSAGE_ID_DEVICE_SETSHADER_INVALID_INSTANCE + 1 ) , + D3D11_MESSAGE_ID_DEVICE_SETSHADER_INVALID_INSTANCE_TYPE = ( D3D11_MESSAGE_ID_DEVICE_SETSHADER_INVALID_INSTANCE_INDEX + 1 ) , + D3D11_MESSAGE_ID_DEVICE_SETSHADER_INVALID_INSTANCE_DATA = ( D3D11_MESSAGE_ID_DEVICE_SETSHADER_INVALID_INSTANCE_TYPE + 1 ) , + D3D11_MESSAGE_ID_DEVICE_SETSHADER_UNBOUND_INSTANCE_DATA = ( D3D11_MESSAGE_ID_DEVICE_SETSHADER_INVALID_INSTANCE_DATA + 1 ) , + D3D11_MESSAGE_ID_DEVICE_SETSHADER_INSTANCE_DATA_BINDINGS = ( D3D11_MESSAGE_ID_DEVICE_SETSHADER_UNBOUND_INSTANCE_DATA + 1 ) , + D3D11_MESSAGE_ID_DEVICE_CREATESHADER_CLASSLINKAGE_FULL = ( D3D11_MESSAGE_ID_DEVICE_SETSHADER_INSTANCE_DATA_BINDINGS + 1 ) , + D3D11_MESSAGE_ID_DEVICE_CHECKFEATURESUPPORT_UNRECOGNIZED_FEATURE = ( D3D11_MESSAGE_ID_DEVICE_CREATESHADER_CLASSLINKAGE_FULL + 1 ) , + D3D11_MESSAGE_ID_DEVICE_CHECKFEATURESUPPORT_MISMATCHED_DATA_SIZE = ( D3D11_MESSAGE_ID_DEVICE_CHECKFEATURESUPPORT_UNRECOGNIZED_FEATURE + 1 ) , + D3D11_MESSAGE_ID_DEVICE_CHECKFEATURESUPPORT_INVALIDARG_RETURN = ( D3D11_MESSAGE_ID_DEVICE_CHECKFEATURESUPPORT_MISMATCHED_DATA_SIZE + 1 ) , + D3D11_MESSAGE_ID_DEVICE_CSSETSHADERRESOURCES_HAZARD = ( D3D11_MESSAGE_ID_DEVICE_CHECKFEATURESUPPORT_INVALIDARG_RETURN + 1 ) , + D3D11_MESSAGE_ID_DEVICE_CSSETCONSTANTBUFFERS_HAZARD = ( D3D11_MESSAGE_ID_DEVICE_CSSETSHADERRESOURCES_HAZARD + 1 ) , + D3D11_MESSAGE_ID_CSSETSHADERRESOURCES_UNBINDDELETINGOBJECT = ( D3D11_MESSAGE_ID_DEVICE_CSSETCONSTANTBUFFERS_HAZARD + 1 ) , + D3D11_MESSAGE_ID_CSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT = ( D3D11_MESSAGE_ID_CSSETSHADERRESOURCES_UNBINDDELETINGOBJECT + 1 ) , + D3D11_MESSAGE_ID_CREATECOMPUTESHADER_INVALIDCALL = ( D3D11_MESSAGE_ID_CSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT + 1 ) , + D3D11_MESSAGE_ID_CREATECOMPUTESHADER_OUTOFMEMORY = ( D3D11_MESSAGE_ID_CREATECOMPUTESHADER_INVALIDCALL + 1 ) , + D3D11_MESSAGE_ID_CREATECOMPUTESHADER_INVALIDSHADERBYTECODE = ( D3D11_MESSAGE_ID_CREATECOMPUTESHADER_OUTOFMEMORY + 1 ) , + D3D11_MESSAGE_ID_CREATECOMPUTESHADER_INVALIDSHADERTYPE = ( D3D11_MESSAGE_ID_CREATECOMPUTESHADER_INVALIDSHADERBYTECODE + 1 ) , + D3D11_MESSAGE_ID_CREATECOMPUTESHADER_INVALIDCLASSLINKAGE = ( D3D11_MESSAGE_ID_CREATECOMPUTESHADER_INVALIDSHADERTYPE + 1 ) , + D3D11_MESSAGE_ID_DEVICE_CSSETSHADERRESOURCES_VIEWS_EMPTY = ( D3D11_MESSAGE_ID_CREATECOMPUTESHADER_INVALIDCLASSLINKAGE + 1 ) , + D3D11_MESSAGE_ID_CSSETCONSTANTBUFFERS_INVALIDBUFFER = ( D3D11_MESSAGE_ID_DEVICE_CSSETSHADERRESOURCES_VIEWS_EMPTY + 1 ) , + D3D11_MESSAGE_ID_DEVICE_CSSETCONSTANTBUFFERS_BUFFERS_EMPTY = ( D3D11_MESSAGE_ID_CSSETCONSTANTBUFFERS_INVALIDBUFFER + 1 ) , + D3D11_MESSAGE_ID_DEVICE_CSSETSAMPLERS_SAMPLERS_EMPTY = ( D3D11_MESSAGE_ID_DEVICE_CSSETCONSTANTBUFFERS_BUFFERS_EMPTY + 1 ) , + D3D11_MESSAGE_ID_DEVICE_CSGETSHADERRESOURCES_VIEWS_EMPTY = ( D3D11_MESSAGE_ID_DEVICE_CSSETSAMPLERS_SAMPLERS_EMPTY + 1 ) , + D3D11_MESSAGE_ID_DEVICE_CSGETCONSTANTBUFFERS_BUFFERS_EMPTY = ( D3D11_MESSAGE_ID_DEVICE_CSGETSHADERRESOURCES_VIEWS_EMPTY + 1 ) , + D3D11_MESSAGE_ID_DEVICE_CSGETSAMPLERS_SAMPLERS_EMPTY = ( D3D11_MESSAGE_ID_DEVICE_CSGETCONSTANTBUFFERS_BUFFERS_EMPTY + 1 ) , + D3D11_MESSAGE_ID_DEVICE_CREATEVERTEXSHADER_DOUBLEFLOATOPSNOTSUPPORTED = ( D3D11_MESSAGE_ID_DEVICE_CSGETSAMPLERS_SAMPLERS_EMPTY + 1 ) , + D3D11_MESSAGE_ID_DEVICE_CREATEHULLSHADER_DOUBLEFLOATOPSNOTSUPPORTED = ( D3D11_MESSAGE_ID_DEVICE_CREATEVERTEXSHADER_DOUBLEFLOATOPSNOTSUPPORTED + 1 ) , + D3D11_MESSAGE_ID_DEVICE_CREATEDOMAINSHADER_DOUBLEFLOATOPSNOTSUPPORTED = ( D3D11_MESSAGE_ID_DEVICE_CREATEHULLSHADER_DOUBLEFLOATOPSNOTSUPPORTED + 1 ) , + D3D11_MESSAGE_ID_DEVICE_CREATEGEOMETRYSHADER_DOUBLEFLOATOPSNOTSUPPORTED = ( D3D11_MESSAGE_ID_DEVICE_CREATEDOMAINSHADER_DOUBLEFLOATOPSNOTSUPPORTED + 1 ) , + D3D11_MESSAGE_ID_DEVICE_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_DOUBLEFLOATOPSNOTSUPPORTED = ( D3D11_MESSAGE_ID_DEVICE_CREATEGEOMETRYSHADER_DOUBLEFLOATOPSNOTSUPPORTED + 1 ) , + D3D11_MESSAGE_ID_DEVICE_CREATEPIXELSHADER_DOUBLEFLOATOPSNOTSUPPORTED = ( D3D11_MESSAGE_ID_DEVICE_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_DOUBLEFLOATOPSNOTSUPPORTED + 1 ) , + D3D11_MESSAGE_ID_DEVICE_CREATECOMPUTESHADER_DOUBLEFLOATOPSNOTSUPPORTED = ( D3D11_MESSAGE_ID_DEVICE_CREATEPIXELSHADER_DOUBLEFLOATOPSNOTSUPPORTED + 1 ) , + D3D11_MESSAGE_ID_CREATEBUFFER_INVALIDSTRUCTURESTRIDE = ( D3D11_MESSAGE_ID_DEVICE_CREATECOMPUTESHADER_DOUBLEFLOATOPSNOTSUPPORTED + 1 ) , + D3D11_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDFLAGS = ( D3D11_MESSAGE_ID_CREATEBUFFER_INVALIDSTRUCTURESTRIDE + 1 ) , + D3D11_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDRESOURCE = ( D3D11_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDFLAGS + 1 ) , + D3D11_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDDESC = ( D3D11_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDRESOURCE + 1 ) , + D3D11_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDFORMAT = ( D3D11_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDDESC + 1 ) , + D3D11_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDDIMENSIONS = ( D3D11_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDFORMAT + 1 ) , + D3D11_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_UNRECOGNIZEDFORMAT = ( D3D11_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDDIMENSIONS + 1 ) , + D3D11_MESSAGE_ID_DEVICE_OMSETRENDERTARGETSANDUNORDEREDACCESSVIEWS_HAZARD = ( D3D11_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_UNRECOGNIZEDFORMAT + 1 ) , + D3D11_MESSAGE_ID_DEVICE_OMSETRENDERTARGETSANDUNORDEREDACCESSVIEWS_OVERLAPPING_OLD_SLOTS = ( D3D11_MESSAGE_ID_DEVICE_OMSETRENDERTARGETSANDUNORDEREDACCESSVIEWS_HAZARD + 1 ) , + D3D11_MESSAGE_ID_DEVICE_OMSETRENDERTARGETSANDUNORDEREDACCESSVIEWS_NO_OP = ( D3D11_MESSAGE_ID_DEVICE_OMSETRENDERTARGETSANDUNORDEREDACCESSVIEWS_OVERLAPPING_OLD_SLOTS + 1 ) , + D3D11_MESSAGE_ID_CSSETUNORDEREDACCESSVIEWS_UNBINDDELETINGOBJECT = ( D3D11_MESSAGE_ID_DEVICE_OMSETRENDERTARGETSANDUNORDEREDACCESSVIEWS_NO_OP + 1 ) , + D3D11_MESSAGE_ID_PSSETUNORDEREDACCESSVIEWS_UNBINDDELETINGOBJECT = ( D3D11_MESSAGE_ID_CSSETUNORDEREDACCESSVIEWS_UNBINDDELETINGOBJECT + 1 ) , + D3D11_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDARG_RETURN = ( D3D11_MESSAGE_ID_PSSETUNORDEREDACCESSVIEWS_UNBINDDELETINGOBJECT + 1 ) , + D3D11_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_OUTOFMEMORY_RETURN = ( D3D11_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDARG_RETURN + 1 ) , + D3D11_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_TOOMANYOBJECTS = ( D3D11_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_OUTOFMEMORY_RETURN + 1 ) , + D3D11_MESSAGE_ID_DEVICE_CSSETUNORDEREDACCESSVIEWS_HAZARD = ( D3D11_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_TOOMANYOBJECTS + 1 ) , + D3D11_MESSAGE_ID_CLEARUNORDEREDACCESSVIEW_DENORMFLUSH = ( D3D11_MESSAGE_ID_DEVICE_CSSETUNORDEREDACCESSVIEWS_HAZARD + 1 ) , + D3D11_MESSAGE_ID_DEVICE_CSSETUNORDEREDACCESSS_VIEWS_EMPTY = ( D3D11_MESSAGE_ID_CLEARUNORDEREDACCESSVIEW_DENORMFLUSH + 1 ) , + D3D11_MESSAGE_ID_DEVICE_CSGETUNORDEREDACCESSS_VIEWS_EMPTY = ( D3D11_MESSAGE_ID_DEVICE_CSSETUNORDEREDACCESSS_VIEWS_EMPTY + 1 ) , + D3D11_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDFLAGS = ( D3D11_MESSAGE_ID_DEVICE_CSGETUNORDEREDACCESSS_VIEWS_EMPTY + 1 ) , + D3D11_MESSAGE_ID_CREATESHADERRESESOURCEVIEW_TOOMANYOBJECTS = ( D3D11_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDFLAGS + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DISPATCHINDIRECT_INVALID_ARG_BUFFER = ( D3D11_MESSAGE_ID_CREATESHADERRESESOURCEVIEW_TOOMANYOBJECTS + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DISPATCHINDIRECT_OFFSET_UNALIGNED = ( D3D11_MESSAGE_ID_DEVICE_DISPATCHINDIRECT_INVALID_ARG_BUFFER + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DISPATCHINDIRECT_OFFSET_OVERFLOW = ( D3D11_MESSAGE_ID_DEVICE_DISPATCHINDIRECT_OFFSET_UNALIGNED + 1 ) , + D3D11_MESSAGE_ID_DEVICE_SETRESOURCEMINLOD_INVALIDCONTEXT = ( D3D11_MESSAGE_ID_DEVICE_DISPATCHINDIRECT_OFFSET_OVERFLOW + 1 ) , + D3D11_MESSAGE_ID_DEVICE_SETRESOURCEMINLOD_INVALIDRESOURCE = ( D3D11_MESSAGE_ID_DEVICE_SETRESOURCEMINLOD_INVALIDCONTEXT + 1 ) , + D3D11_MESSAGE_ID_DEVICE_SETRESOURCEMINLOD_INVALIDMINLOD = ( D3D11_MESSAGE_ID_DEVICE_SETRESOURCEMINLOD_INVALIDRESOURCE + 1 ) , + D3D11_MESSAGE_ID_DEVICE_GETRESOURCEMINLOD_INVALIDCONTEXT = ( D3D11_MESSAGE_ID_DEVICE_SETRESOURCEMINLOD_INVALIDMINLOD + 1 ) , + D3D11_MESSAGE_ID_DEVICE_GETRESOURCEMINLOD_INVALIDRESOURCE = ( D3D11_MESSAGE_ID_DEVICE_GETRESOURCEMINLOD_INVALIDCONTEXT + 1 ) , + D3D11_MESSAGE_ID_OMSETDEPTHSTENCIL_UNBINDDELETINGOBJECT = ( D3D11_MESSAGE_ID_DEVICE_GETRESOURCEMINLOD_INVALIDRESOURCE + 1 ) , + D3D11_MESSAGE_ID_CLEARDEPTHSTENCILVIEW_DEPTH_READONLY = ( D3D11_MESSAGE_ID_OMSETDEPTHSTENCIL_UNBINDDELETINGOBJECT + 1 ) , + D3D11_MESSAGE_ID_CLEARDEPTHSTENCILVIEW_STENCIL_READONLY = ( D3D11_MESSAGE_ID_CLEARDEPTHSTENCILVIEW_DEPTH_READONLY + 1 ) , + D3D11_MESSAGE_ID_CHECKFEATURESUPPORT_FORMAT_DEPRECATED = ( D3D11_MESSAGE_ID_CLEARDEPTHSTENCILVIEW_STENCIL_READONLY + 1 ) , + D3D11_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_RETURN_TYPE_MISMATCH = ( D3D11_MESSAGE_ID_CHECKFEATURESUPPORT_FORMAT_DEPRECATED + 1 ) , + D3D11_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_NOT_SET = ( D3D11_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_RETURN_TYPE_MISMATCH + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DRAW_UNORDEREDACCESSVIEW_RENDERTARGETVIEW_OVERLAP = ( D3D11_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_NOT_SET + 1 ) , + D3D11_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_DIMENSION_MISMATCH = ( D3D11_MESSAGE_ID_DEVICE_DRAW_UNORDEREDACCESSVIEW_RENDERTARGETVIEW_OVERLAP + 1 ) , + D3D11_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_APPEND_UNSUPPORTED = ( D3D11_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_DIMENSION_MISMATCH + 1 ) , + D3D11_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_ATOMICS_UNSUPPORTED = ( D3D11_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_APPEND_UNSUPPORTED + 1 ) , + D3D11_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_STRUCTURE_STRIDE_MISMATCH = ( D3D11_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_ATOMICS_UNSUPPORTED + 1 ) , + D3D11_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_BUFFER_TYPE_MISMATCH = ( D3D11_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_STRUCTURE_STRIDE_MISMATCH + 1 ) , + D3D11_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_RAW_UNSUPPORTED = ( D3D11_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_BUFFER_TYPE_MISMATCH + 1 ) , + D3D11_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_FORMAT_LD_UNSUPPORTED = ( D3D11_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_RAW_UNSUPPORTED + 1 ) , + D3D11_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_FORMAT_STORE_UNSUPPORTED = ( D3D11_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_FORMAT_LD_UNSUPPORTED + 1 ) , + D3D11_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_ATOMIC_ADD_UNSUPPORTED = ( D3D11_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_FORMAT_STORE_UNSUPPORTED + 1 ) , + D3D11_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_ATOMIC_BITWISE_OPS_UNSUPPORTED = ( D3D11_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_ATOMIC_ADD_UNSUPPORTED + 1 ) , + D3D11_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_ATOMIC_CMPSTORE_CMPEXCHANGE_UNSUPPORTED = ( D3D11_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_ATOMIC_BITWISE_OPS_UNSUPPORTED + 1 ) , + D3D11_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_ATOMIC_EXCHANGE_UNSUPPORTED = ( D3D11_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_ATOMIC_CMPSTORE_CMPEXCHANGE_UNSUPPORTED + 1 ) , + D3D11_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_ATOMIC_SIGNED_MINMAX_UNSUPPORTED = ( D3D11_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_ATOMIC_EXCHANGE_UNSUPPORTED + 1 ) , + D3D11_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_ATOMIC_UNSIGNED_MINMAX_UNSUPPORTED = ( D3D11_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_ATOMIC_SIGNED_MINMAX_UNSUPPORTED + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DISPATCH_BOUND_RESOURCE_MAPPED = ( D3D11_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_ATOMIC_UNSIGNED_MINMAX_UNSUPPORTED + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DISPATCH_THREADGROUPCOUNT_OVERFLOW = ( D3D11_MESSAGE_ID_DEVICE_DISPATCH_BOUND_RESOURCE_MAPPED + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DISPATCH_THREADGROUPCOUNT_ZERO = ( D3D11_MESSAGE_ID_DEVICE_DISPATCH_THREADGROUPCOUNT_OVERFLOW + 1 ) , + D3D11_MESSAGE_ID_DEVICE_SHADERRESOURCEVIEW_STRUCTURE_STRIDE_MISMATCH = ( D3D11_MESSAGE_ID_DEVICE_DISPATCH_THREADGROUPCOUNT_ZERO + 1 ) , + D3D11_MESSAGE_ID_DEVICE_SHADERRESOURCEVIEW_BUFFER_TYPE_MISMATCH = ( D3D11_MESSAGE_ID_DEVICE_SHADERRESOURCEVIEW_STRUCTURE_STRIDE_MISMATCH + 1 ) , + D3D11_MESSAGE_ID_DEVICE_SHADERRESOURCEVIEW_RAW_UNSUPPORTED = ( D3D11_MESSAGE_ID_DEVICE_SHADERRESOURCEVIEW_BUFFER_TYPE_MISMATCH + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DISPATCH_UNSUPPORTED = ( D3D11_MESSAGE_ID_DEVICE_SHADERRESOURCEVIEW_RAW_UNSUPPORTED + 1 ) , + D3D11_MESSAGE_ID_DEVICE_DISPATCHINDIRECT_UNSUPPORTED = ( D3D11_MESSAGE_ID_DEVICE_DISPATCH_UNSUPPORTED + 1 ) , + D3D11_MESSAGE_ID_COPYSTRUCTURECOUNT_INVALIDOFFSET = ( D3D11_MESSAGE_ID_DEVICE_DISPATCHINDIRECT_UNSUPPORTED + 1 ) , + D3D11_MESSAGE_ID_COPYSTRUCTURECOUNT_LARGEOFFSET = ( D3D11_MESSAGE_ID_COPYSTRUCTURECOUNT_INVALIDOFFSET + 1 ) , + D3D11_MESSAGE_ID_COPYSTRUCTURECOUNT_INVALIDDESTINATIONSTATE = ( D3D11_MESSAGE_ID_COPYSTRUCTURECOUNT_LARGEOFFSET + 1 ) , + D3D11_MESSAGE_ID_COPYSTRUCTURECOUNT_INVALIDSOURCESTATE = ( D3D11_MESSAGE_ID_COPYSTRUCTURECOUNT_INVALIDDESTINATIONSTATE + 1 ) , + D3D11_MESSAGE_ID_CHECKFORMATSUPPORT_FORMAT_NOT_SUPPORTED = ( D3D11_MESSAGE_ID_COPYSTRUCTURECOUNT_INVALIDSOURCESTATE + 1 ) , + D3D11_MESSAGE_ID_DEVICE_CSSETUNORDEREDACCESSVIEWS_INVALIDVIEW = ( D3D11_MESSAGE_ID_CHECKFORMATSUPPORT_FORMAT_NOT_SUPPORTED + 1 ) , + D3D11_MESSAGE_ID_DEVICE_CSSETUNORDEREDACCESSVIEWS_INVALIDOFFSET = ( D3D11_MESSAGE_ID_DEVICE_CSSETUNORDEREDACCESSVIEWS_INVALIDVIEW + 1 ) , + D3D11_MESSAGE_ID_DEVICE_CSSETUNORDEREDACCESSVIEWS_TOOMANYVIEWS = ( D3D11_MESSAGE_ID_DEVICE_CSSETUNORDEREDACCESSVIEWS_INVALIDOFFSET + 1 ) , + D3D11_MESSAGE_ID_CLEARUNORDEREDACCESSVIEWFLOAT_INVALIDFORMAT = ( D3D11_MESSAGE_ID_DEVICE_CSSETUNORDEREDACCESSVIEWS_TOOMANYVIEWS + 1 ) , + D3D11_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_COUNTER_UNSUPPORTED = ( D3D11_MESSAGE_ID_CLEARUNORDEREDACCESSVIEWFLOAT_INVALIDFORMAT + 1 ) , + D3D11_MESSAGE_ID_REF_WARNING = ( D3D11_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_COUNTER_UNSUPPORTED + 1 ) , + D3D11_MESSAGE_ID_D3D11_MESSAGES_END = ( D3D11_MESSAGE_ID_REF_WARNING + 1 ) + } D3D11_MESSAGE_ID; + +typedef struct D3D11_MESSAGE + { + D3D11_MESSAGE_CATEGORY Category; + D3D11_MESSAGE_SEVERITY Severity; + D3D11_MESSAGE_ID ID; + const char *pDescription; + SIZE_T DescriptionByteLength; + } D3D11_MESSAGE; + +typedef struct D3D11_INFO_QUEUE_FILTER_DESC + { + UINT NumCategories; + D3D11_MESSAGE_CATEGORY *pCategoryList; + UINT NumSeverities; + D3D11_MESSAGE_SEVERITY *pSeverityList; + UINT NumIDs; + D3D11_MESSAGE_ID *pIDList; + } D3D11_INFO_QUEUE_FILTER_DESC; + +typedef struct D3D11_INFO_QUEUE_FILTER + { + D3D11_INFO_QUEUE_FILTER_DESC AllowList; + D3D11_INFO_QUEUE_FILTER_DESC DenyList; + } D3D11_INFO_QUEUE_FILTER; + +#define D3D11_INFO_QUEUE_DEFAULT_MESSAGE_COUNT_LIMIT 1024 + + +extern RPC_IF_HANDLE __MIDL_itf_d3d11sdklayers_0000_0002_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d11sdklayers_0000_0002_v0_0_s_ifspec; + +#ifndef __ID3D11InfoQueue_INTERFACE_DEFINED__ +#define __ID3D11InfoQueue_INTERFACE_DEFINED__ + +/* interface ID3D11InfoQueue */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D11InfoQueue; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("6543dbb6-1b48-42f5-ab82-e97ec74326f6") + ID3D11InfoQueue : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SetMessageCountLimit( + /* [annotation] */ + __in UINT64 MessageCountLimit) = 0; + + virtual void STDMETHODCALLTYPE ClearStoredMessages( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetMessage( + /* [annotation] */ + __in UINT64 MessageIndex, + /* [annotation] */ + __out_bcount_opt(*pMessageByteLength) D3D11_MESSAGE *pMessage, + /* [annotation] */ + __inout SIZE_T *pMessageByteLength) = 0; + + virtual UINT64 STDMETHODCALLTYPE GetNumMessagesAllowedByStorageFilter( void) = 0; + + virtual UINT64 STDMETHODCALLTYPE GetNumMessagesDeniedByStorageFilter( void) = 0; + + virtual UINT64 STDMETHODCALLTYPE GetNumStoredMessages( void) = 0; + + virtual UINT64 STDMETHODCALLTYPE GetNumStoredMessagesAllowedByRetrievalFilter( void) = 0; + + virtual UINT64 STDMETHODCALLTYPE GetNumMessagesDiscardedByMessageCountLimit( void) = 0; + + virtual UINT64 STDMETHODCALLTYPE GetMessageCountLimit( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE AddStorageFilterEntries( + /* [annotation] */ + __in D3D11_INFO_QUEUE_FILTER *pFilter) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetStorageFilter( + /* [annotation] */ + __out_bcount_opt(*pFilterByteLength) D3D11_INFO_QUEUE_FILTER *pFilter, + /* [annotation] */ + __inout SIZE_T *pFilterByteLength) = 0; + + virtual void STDMETHODCALLTYPE ClearStorageFilter( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE PushEmptyStorageFilter( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE PushCopyOfStorageFilter( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE PushStorageFilter( + /* [annotation] */ + __in D3D11_INFO_QUEUE_FILTER *pFilter) = 0; + + virtual void STDMETHODCALLTYPE PopStorageFilter( void) = 0; + + virtual UINT STDMETHODCALLTYPE GetStorageFilterStackSize( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE AddRetrievalFilterEntries( + /* [annotation] */ + __in D3D11_INFO_QUEUE_FILTER *pFilter) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetRetrievalFilter( + /* [annotation] */ + __out_bcount_opt(*pFilterByteLength) D3D11_INFO_QUEUE_FILTER *pFilter, + /* [annotation] */ + __inout SIZE_T *pFilterByteLength) = 0; + + virtual void STDMETHODCALLTYPE ClearRetrievalFilter( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE PushEmptyRetrievalFilter( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE PushCopyOfRetrievalFilter( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE PushRetrievalFilter( + /* [annotation] */ + __in D3D11_INFO_QUEUE_FILTER *pFilter) = 0; + + virtual void STDMETHODCALLTYPE PopRetrievalFilter( void) = 0; + + virtual UINT STDMETHODCALLTYPE GetRetrievalFilterStackSize( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE AddMessage( + /* [annotation] */ + __in D3D11_MESSAGE_CATEGORY Category, + /* [annotation] */ + __in D3D11_MESSAGE_SEVERITY Severity, + /* [annotation] */ + __in D3D11_MESSAGE_ID ID, + /* [annotation] */ + __in LPCSTR pDescription) = 0; + + virtual HRESULT STDMETHODCALLTYPE AddApplicationMessage( + /* [annotation] */ + __in D3D11_MESSAGE_SEVERITY Severity, + /* [annotation] */ + __in LPCSTR pDescription) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetBreakOnCategory( + /* [annotation] */ + __in D3D11_MESSAGE_CATEGORY Category, + /* [annotation] */ + __in BOOL bEnable) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetBreakOnSeverity( + /* [annotation] */ + __in D3D11_MESSAGE_SEVERITY Severity, + /* [annotation] */ + __in BOOL bEnable) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetBreakOnID( + /* [annotation] */ + __in D3D11_MESSAGE_ID ID, + /* [annotation] */ + __in BOOL bEnable) = 0; + + virtual BOOL STDMETHODCALLTYPE GetBreakOnCategory( + /* [annotation] */ + __in D3D11_MESSAGE_CATEGORY Category) = 0; + + virtual BOOL STDMETHODCALLTYPE GetBreakOnSeverity( + /* [annotation] */ + __in D3D11_MESSAGE_SEVERITY Severity) = 0; + + virtual BOOL STDMETHODCALLTYPE GetBreakOnID( + /* [annotation] */ + __in D3D11_MESSAGE_ID ID) = 0; + + virtual void STDMETHODCALLTYPE SetMuteDebugOutput( + /* [annotation] */ + __in BOOL bMute) = 0; + + virtual BOOL STDMETHODCALLTYPE GetMuteDebugOutput( void) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D11InfoQueueVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D11InfoQueue * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D11InfoQueue * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D11InfoQueue * This); + + HRESULT ( STDMETHODCALLTYPE *SetMessageCountLimit )( + ID3D11InfoQueue * This, + /* [annotation] */ + __in UINT64 MessageCountLimit); + + void ( STDMETHODCALLTYPE *ClearStoredMessages )( + ID3D11InfoQueue * This); + + HRESULT ( STDMETHODCALLTYPE *GetMessage )( + ID3D11InfoQueue * This, + /* [annotation] */ + __in UINT64 MessageIndex, + /* [annotation] */ + __out_bcount_opt(*pMessageByteLength) D3D11_MESSAGE *pMessage, + /* [annotation] */ + __inout SIZE_T *pMessageByteLength); + + UINT64 ( STDMETHODCALLTYPE *GetNumMessagesAllowedByStorageFilter )( + ID3D11InfoQueue * This); + + UINT64 ( STDMETHODCALLTYPE *GetNumMessagesDeniedByStorageFilter )( + ID3D11InfoQueue * This); + + UINT64 ( STDMETHODCALLTYPE *GetNumStoredMessages )( + ID3D11InfoQueue * This); + + UINT64 ( STDMETHODCALLTYPE *GetNumStoredMessagesAllowedByRetrievalFilter )( + ID3D11InfoQueue * This); + + UINT64 ( STDMETHODCALLTYPE *GetNumMessagesDiscardedByMessageCountLimit )( + ID3D11InfoQueue * This); + + UINT64 ( STDMETHODCALLTYPE *GetMessageCountLimit )( + ID3D11InfoQueue * This); + + HRESULT ( STDMETHODCALLTYPE *AddStorageFilterEntries )( + ID3D11InfoQueue * This, + /* [annotation] */ + __in D3D11_INFO_QUEUE_FILTER *pFilter); + + HRESULT ( STDMETHODCALLTYPE *GetStorageFilter )( + ID3D11InfoQueue * This, + /* [annotation] */ + __out_bcount_opt(*pFilterByteLength) D3D11_INFO_QUEUE_FILTER *pFilter, + /* [annotation] */ + __inout SIZE_T *pFilterByteLength); + + void ( STDMETHODCALLTYPE *ClearStorageFilter )( + ID3D11InfoQueue * This); + + HRESULT ( STDMETHODCALLTYPE *PushEmptyStorageFilter )( + ID3D11InfoQueue * This); + + HRESULT ( STDMETHODCALLTYPE *PushCopyOfStorageFilter )( + ID3D11InfoQueue * This); + + HRESULT ( STDMETHODCALLTYPE *PushStorageFilter )( + ID3D11InfoQueue * This, + /* [annotation] */ + __in D3D11_INFO_QUEUE_FILTER *pFilter); + + void ( STDMETHODCALLTYPE *PopStorageFilter )( + ID3D11InfoQueue * This); + + UINT ( STDMETHODCALLTYPE *GetStorageFilterStackSize )( + ID3D11InfoQueue * This); + + HRESULT ( STDMETHODCALLTYPE *AddRetrievalFilterEntries )( + ID3D11InfoQueue * This, + /* [annotation] */ + __in D3D11_INFO_QUEUE_FILTER *pFilter); + + HRESULT ( STDMETHODCALLTYPE *GetRetrievalFilter )( + ID3D11InfoQueue * This, + /* [annotation] */ + __out_bcount_opt(*pFilterByteLength) D3D11_INFO_QUEUE_FILTER *pFilter, + /* [annotation] */ + __inout SIZE_T *pFilterByteLength); + + void ( STDMETHODCALLTYPE *ClearRetrievalFilter )( + ID3D11InfoQueue * This); + + HRESULT ( STDMETHODCALLTYPE *PushEmptyRetrievalFilter )( + ID3D11InfoQueue * This); + + HRESULT ( STDMETHODCALLTYPE *PushCopyOfRetrievalFilter )( + ID3D11InfoQueue * This); + + HRESULT ( STDMETHODCALLTYPE *PushRetrievalFilter )( + ID3D11InfoQueue * This, + /* [annotation] */ + __in D3D11_INFO_QUEUE_FILTER *pFilter); + + void ( STDMETHODCALLTYPE *PopRetrievalFilter )( + ID3D11InfoQueue * This); + + UINT ( STDMETHODCALLTYPE *GetRetrievalFilterStackSize )( + ID3D11InfoQueue * This); + + HRESULT ( STDMETHODCALLTYPE *AddMessage )( + ID3D11InfoQueue * This, + /* [annotation] */ + __in D3D11_MESSAGE_CATEGORY Category, + /* [annotation] */ + __in D3D11_MESSAGE_SEVERITY Severity, + /* [annotation] */ + __in D3D11_MESSAGE_ID ID, + /* [annotation] */ + __in LPCSTR pDescription); + + HRESULT ( STDMETHODCALLTYPE *AddApplicationMessage )( + ID3D11InfoQueue * This, + /* [annotation] */ + __in D3D11_MESSAGE_SEVERITY Severity, + /* [annotation] */ + __in LPCSTR pDescription); + + HRESULT ( STDMETHODCALLTYPE *SetBreakOnCategory )( + ID3D11InfoQueue * This, + /* [annotation] */ + __in D3D11_MESSAGE_CATEGORY Category, + /* [annotation] */ + __in BOOL bEnable); + + HRESULT ( STDMETHODCALLTYPE *SetBreakOnSeverity )( + ID3D11InfoQueue * This, + /* [annotation] */ + __in D3D11_MESSAGE_SEVERITY Severity, + /* [annotation] */ + __in BOOL bEnable); + + HRESULT ( STDMETHODCALLTYPE *SetBreakOnID )( + ID3D11InfoQueue * This, + /* [annotation] */ + __in D3D11_MESSAGE_ID ID, + /* [annotation] */ + __in BOOL bEnable); + + BOOL ( STDMETHODCALLTYPE *GetBreakOnCategory )( + ID3D11InfoQueue * This, + /* [annotation] */ + __in D3D11_MESSAGE_CATEGORY Category); + + BOOL ( STDMETHODCALLTYPE *GetBreakOnSeverity )( + ID3D11InfoQueue * This, + /* [annotation] */ + __in D3D11_MESSAGE_SEVERITY Severity); + + BOOL ( STDMETHODCALLTYPE *GetBreakOnID )( + ID3D11InfoQueue * This, + /* [annotation] */ + __in D3D11_MESSAGE_ID ID); + + void ( STDMETHODCALLTYPE *SetMuteDebugOutput )( + ID3D11InfoQueue * This, + /* [annotation] */ + __in BOOL bMute); + + BOOL ( STDMETHODCALLTYPE *GetMuteDebugOutput )( + ID3D11InfoQueue * This); + + END_INTERFACE + } ID3D11InfoQueueVtbl; + + interface ID3D11InfoQueue + { + CONST_VTBL struct ID3D11InfoQueueVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D11InfoQueue_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D11InfoQueue_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D11InfoQueue_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D11InfoQueue_SetMessageCountLimit(This,MessageCountLimit) \ + ( (This)->lpVtbl -> SetMessageCountLimit(This,MessageCountLimit) ) + +#define ID3D11InfoQueue_ClearStoredMessages(This) \ + ( (This)->lpVtbl -> ClearStoredMessages(This) ) + +#define ID3D11InfoQueue_GetMessage(This,MessageIndex,pMessage,pMessageByteLength) \ + ( (This)->lpVtbl -> GetMessage(This,MessageIndex,pMessage,pMessageByteLength) ) + +#define ID3D11InfoQueue_GetNumMessagesAllowedByStorageFilter(This) \ + ( (This)->lpVtbl -> GetNumMessagesAllowedByStorageFilter(This) ) + +#define ID3D11InfoQueue_GetNumMessagesDeniedByStorageFilter(This) \ + ( (This)->lpVtbl -> GetNumMessagesDeniedByStorageFilter(This) ) + +#define ID3D11InfoQueue_GetNumStoredMessages(This) \ + ( (This)->lpVtbl -> GetNumStoredMessages(This) ) + +#define ID3D11InfoQueue_GetNumStoredMessagesAllowedByRetrievalFilter(This) \ + ( (This)->lpVtbl -> GetNumStoredMessagesAllowedByRetrievalFilter(This) ) + +#define ID3D11InfoQueue_GetNumMessagesDiscardedByMessageCountLimit(This) \ + ( (This)->lpVtbl -> GetNumMessagesDiscardedByMessageCountLimit(This) ) + +#define ID3D11InfoQueue_GetMessageCountLimit(This) \ + ( (This)->lpVtbl -> GetMessageCountLimit(This) ) + +#define ID3D11InfoQueue_AddStorageFilterEntries(This,pFilter) \ + ( (This)->lpVtbl -> AddStorageFilterEntries(This,pFilter) ) + +#define ID3D11InfoQueue_GetStorageFilter(This,pFilter,pFilterByteLength) \ + ( (This)->lpVtbl -> GetStorageFilter(This,pFilter,pFilterByteLength) ) + +#define ID3D11InfoQueue_ClearStorageFilter(This) \ + ( (This)->lpVtbl -> ClearStorageFilter(This) ) + +#define ID3D11InfoQueue_PushEmptyStorageFilter(This) \ + ( (This)->lpVtbl -> PushEmptyStorageFilter(This) ) + +#define ID3D11InfoQueue_PushCopyOfStorageFilter(This) \ + ( (This)->lpVtbl -> PushCopyOfStorageFilter(This) ) + +#define ID3D11InfoQueue_PushStorageFilter(This,pFilter) \ + ( (This)->lpVtbl -> PushStorageFilter(This,pFilter) ) + +#define ID3D11InfoQueue_PopStorageFilter(This) \ + ( (This)->lpVtbl -> PopStorageFilter(This) ) + +#define ID3D11InfoQueue_GetStorageFilterStackSize(This) \ + ( (This)->lpVtbl -> GetStorageFilterStackSize(This) ) + +#define ID3D11InfoQueue_AddRetrievalFilterEntries(This,pFilter) \ + ( (This)->lpVtbl -> AddRetrievalFilterEntries(This,pFilter) ) + +#define ID3D11InfoQueue_GetRetrievalFilter(This,pFilter,pFilterByteLength) \ + ( (This)->lpVtbl -> GetRetrievalFilter(This,pFilter,pFilterByteLength) ) + +#define ID3D11InfoQueue_ClearRetrievalFilter(This) \ + ( (This)->lpVtbl -> ClearRetrievalFilter(This) ) + +#define ID3D11InfoQueue_PushEmptyRetrievalFilter(This) \ + ( (This)->lpVtbl -> PushEmptyRetrievalFilter(This) ) + +#define ID3D11InfoQueue_PushCopyOfRetrievalFilter(This) \ + ( (This)->lpVtbl -> PushCopyOfRetrievalFilter(This) ) + +#define ID3D11InfoQueue_PushRetrievalFilter(This,pFilter) \ + ( (This)->lpVtbl -> PushRetrievalFilter(This,pFilter) ) + +#define ID3D11InfoQueue_PopRetrievalFilter(This) \ + ( (This)->lpVtbl -> PopRetrievalFilter(This) ) + +#define ID3D11InfoQueue_GetRetrievalFilterStackSize(This) \ + ( (This)->lpVtbl -> GetRetrievalFilterStackSize(This) ) + +#define ID3D11InfoQueue_AddMessage(This,Category,Severity,ID,pDescription) \ + ( (This)->lpVtbl -> AddMessage(This,Category,Severity,ID,pDescription) ) + +#define ID3D11InfoQueue_AddApplicationMessage(This,Severity,pDescription) \ + ( (This)->lpVtbl -> AddApplicationMessage(This,Severity,pDescription) ) + +#define ID3D11InfoQueue_SetBreakOnCategory(This,Category,bEnable) \ + ( (This)->lpVtbl -> SetBreakOnCategory(This,Category,bEnable) ) + +#define ID3D11InfoQueue_SetBreakOnSeverity(This,Severity,bEnable) \ + ( (This)->lpVtbl -> SetBreakOnSeverity(This,Severity,bEnable) ) + +#define ID3D11InfoQueue_SetBreakOnID(This,ID,bEnable) \ + ( (This)->lpVtbl -> SetBreakOnID(This,ID,bEnable) ) + +#define ID3D11InfoQueue_GetBreakOnCategory(This,Category) \ + ( (This)->lpVtbl -> GetBreakOnCategory(This,Category) ) + +#define ID3D11InfoQueue_GetBreakOnSeverity(This,Severity) \ + ( (This)->lpVtbl -> GetBreakOnSeverity(This,Severity) ) + +#define ID3D11InfoQueue_GetBreakOnID(This,ID) \ + ( (This)->lpVtbl -> GetBreakOnID(This,ID) ) + +#define ID3D11InfoQueue_SetMuteDebugOutput(This,bMute) \ + ( (This)->lpVtbl -> SetMuteDebugOutput(This,bMute) ) + +#define ID3D11InfoQueue_GetMuteDebugOutput(This) \ + ( (This)->lpVtbl -> GetMuteDebugOutput(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D11InfoQueue_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d11sdklayers_0000_0003 */ +/* [local] */ + +#define D3D11_REGKEY_PATH __TEXT("Software\\Microsoft\\Direct3D") +#define D3D11_MUTE_DEBUG_OUTPUT __TEXT("MuteDebugOutput") +#define D3D11_ENABLE_BREAK_ON_MESSAGE __TEXT("EnableBreakOnMessage") +#define D3D11_INFOQUEUE_STORAGE_FILTER_OVERRIDE __TEXT("InfoQueueStorageFilterOverride") +#define D3D11_MUTE_CATEGORY __TEXT("Mute_CATEGORY_%s") +#define D3D11_MUTE_SEVERITY __TEXT("Mute_SEVERITY_%s") +#define D3D11_MUTE_ID_STRING __TEXT("Mute_ID_%s") +#define D3D11_MUTE_ID_DECIMAL __TEXT("Mute_ID_%d") +#define D3D11_UNMUTE_SEVERITY_INFO __TEXT("Unmute_SEVERITY_INFO") +#define D3D11_BREAKON_CATEGORY __TEXT("BreakOn_CATEGORY_%s") +#define D3D11_BREAKON_SEVERITY __TEXT("BreakOn_SEVERITY_%s") +#define D3D11_BREAKON_ID_STRING __TEXT("BreakOn_ID_%s") +#define D3D11_BREAKON_ID_DECIMAL __TEXT("BreakOn_ID_%d") +#define D3D11_APPSIZE_STRING __TEXT("Size") +#define D3D11_APPNAME_STRING __TEXT("Name") +DEFINE_GUID(IID_ID3D11Debug,0x79cf2233,0x7536,0x4948,0x9d,0x36,0x1e,0x46,0x92,0xdc,0x57,0x60); +DEFINE_GUID(IID_ID3D11SwitchToRef,0x1ef337e3,0x58e7,0x4f83,0xa6,0x92,0xdb,0x22,0x1f,0x5e,0xd4,0x7e); +DEFINE_GUID(IID_ID3D11InfoQueue,0x6543dbb6,0x1b48,0x42f5,0xab,0x82,0xe9,0x7e,0xc7,0x43,0x26,0xf6); + + +extern RPC_IF_HANDLE __MIDL_itf_d3d11sdklayers_0000_0003_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d11sdklayers_0000_0003_v0_0_s_ifspec; + +/* Additional Prototypes for ALL interfaces */ + +/* end of Additional Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/MediaClient/MediaClient/directx/include/D3D11Shader.h b/MediaClient/MediaClient/directx/include/D3D11Shader.h new file mode 100644 index 0000000..f91897c --- /dev/null +++ b/MediaClient/MediaClient/directx/include/D3D11Shader.h @@ -0,0 +1,296 @@ +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// File: D3D11Shader.h +// Content: D3D11 Shader Types and APIs +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef __D3D11SHADER_H__ +#define __D3D11SHADER_H__ + +#include "d3dcommon.h" + + +typedef enum D3D11_SHADER_VERSION_TYPE +{ + D3D11_SHVER_PIXEL_SHADER = 0, + D3D11_SHVER_VERTEX_SHADER = 1, + D3D11_SHVER_GEOMETRY_SHADER = 2, + + // D3D11 Shaders + D3D11_SHVER_HULL_SHADER = 3, + D3D11_SHVER_DOMAIN_SHADER = 4, + D3D11_SHVER_COMPUTE_SHADER = 5, +} D3D11_SHADER_VERSION_TYPE; + +#define D3D11_SHVER_GET_TYPE(_Version) \ + (((_Version) >> 16) & 0xffff) +#define D3D11_SHVER_GET_MAJOR(_Version) \ + (((_Version) >> 4) & 0xf) +#define D3D11_SHVER_GET_MINOR(_Version) \ + (((_Version) >> 0) & 0xf) + +typedef D3D_RESOURCE_RETURN_TYPE D3D11_RESOURCE_RETURN_TYPE; + +typedef D3D_CBUFFER_TYPE D3D11_CBUFFER_TYPE; + + +typedef struct _D3D11_SIGNATURE_PARAMETER_DESC +{ + LPCSTR SemanticName; // Name of the semantic + UINT SemanticIndex; // Index of the semantic + UINT Register; // Number of member variables + D3D_NAME SystemValueType;// A predefined system value, or D3D_NAME_UNDEFINED if not applicable + D3D_REGISTER_COMPONENT_TYPE ComponentType;// Scalar type (e.g. uint, float, etc.) + BYTE Mask; // Mask to indicate which components of the register + // are used (combination of D3D10_COMPONENT_MASK values) + BYTE ReadWriteMask; // Mask to indicate whether a given component is + // never written (if this is an output signature) or + // always read (if this is an input signature). + // (combination of D3D10_COMPONENT_MASK values) + UINT Stream; // Stream index +} D3D11_SIGNATURE_PARAMETER_DESC; + +typedef struct _D3D11_SHADER_BUFFER_DESC +{ + LPCSTR Name; // Name of the constant buffer + D3D_CBUFFER_TYPE Type; // Indicates type of buffer content + UINT Variables; // Number of member variables + UINT Size; // Size of CB (in bytes) + UINT uFlags; // Buffer description flags +} D3D11_SHADER_BUFFER_DESC; + +typedef struct _D3D11_SHADER_VARIABLE_DESC +{ + LPCSTR Name; // Name of the variable + UINT StartOffset; // Offset in constant buffer's backing store + UINT Size; // Size of variable (in bytes) + UINT uFlags; // Variable flags + LPVOID DefaultValue; // Raw pointer to default value + UINT StartTexture; // First texture index (or -1 if no textures used) + UINT TextureSize; // Number of texture slots possibly used. + UINT StartSampler; // First sampler index (or -1 if no textures used) + UINT SamplerSize; // Number of sampler slots possibly used. +} D3D11_SHADER_VARIABLE_DESC; + +typedef struct _D3D11_SHADER_TYPE_DESC +{ + D3D_SHADER_VARIABLE_CLASS Class; // Variable class (e.g. object, matrix, etc.) + D3D_SHADER_VARIABLE_TYPE Type; // Variable type (e.g. float, sampler, etc.) + UINT Rows; // Number of rows (for matrices, 1 for other numeric, 0 if not applicable) + UINT Columns; // Number of columns (for vectors & matrices, 1 for other numeric, 0 if not applicable) + UINT Elements; // Number of elements (0 if not an array) + UINT Members; // Number of members (0 if not a structure) + UINT Offset; // Offset from the start of structure (0 if not a structure member) + LPCSTR Name; // Name of type, can be NULL +} D3D11_SHADER_TYPE_DESC; + +typedef D3D_TESSELLATOR_DOMAIN D3D11_TESSELLATOR_DOMAIN; + +typedef D3D_TESSELLATOR_PARTITIONING D3D11_TESSELLATOR_PARTITIONING; + +typedef D3D_TESSELLATOR_OUTPUT_PRIMITIVE D3D11_TESSELLATOR_OUTPUT_PRIMITIVE; + +typedef struct _D3D11_SHADER_DESC +{ + UINT Version; // Shader version + LPCSTR Creator; // Creator string + UINT Flags; // Shader compilation/parse flags + + UINT ConstantBuffers; // Number of constant buffers + UINT BoundResources; // Number of bound resources + UINT InputParameters; // Number of parameters in the input signature + UINT OutputParameters; // Number of parameters in the output signature + + UINT InstructionCount; // Number of emitted instructions + UINT TempRegisterCount; // Number of temporary registers used + UINT TempArrayCount; // Number of temporary arrays used + UINT DefCount; // Number of constant defines + UINT DclCount; // Number of declarations (input + output) + UINT TextureNormalInstructions; // Number of non-categorized texture instructions + UINT TextureLoadInstructions; // Number of texture load instructions + UINT TextureCompInstructions; // Number of texture comparison instructions + UINT TextureBiasInstructions; // Number of texture bias instructions + UINT TextureGradientInstructions; // Number of texture gradient instructions + UINT FloatInstructionCount; // Number of floating point arithmetic instructions used + UINT IntInstructionCount; // Number of signed integer arithmetic instructions used + UINT UintInstructionCount; // Number of unsigned integer arithmetic instructions used + UINT StaticFlowControlCount; // Number of static flow control instructions used + UINT DynamicFlowControlCount; // Number of dynamic flow control instructions used + UINT MacroInstructionCount; // Number of macro instructions used + UINT ArrayInstructionCount; // Number of array instructions used + UINT CutInstructionCount; // Number of cut instructions used + UINT EmitInstructionCount; // Number of emit instructions used + D3D_PRIMITIVE_TOPOLOGY GSOutputTopology; // Geometry shader output topology + UINT GSMaxOutputVertexCount; // Geometry shader maximum output vertex count + D3D_PRIMITIVE InputPrimitive; // GS/HS input primitive + UINT PatchConstantParameters; // Number of parameters in the patch constant signature + UINT cGSInstanceCount; // Number of Geometry shader instances + UINT cControlPoints; // Number of control points in the HS->DS stage + D3D_TESSELLATOR_OUTPUT_PRIMITIVE HSOutputPrimitive; // Primitive output by the tessellator + D3D_TESSELLATOR_PARTITIONING HSPartitioning; // Partitioning mode of the tessellator + D3D_TESSELLATOR_DOMAIN TessellatorDomain; // Domain of the tessellator (quad, tri, isoline) + // instruction counts + UINT cBarrierInstructions; // Number of barrier instructions in a compute shader + UINT cInterlockedInstructions; // Number of interlocked instructions + UINT cTextureStoreInstructions; // Number of texture writes +} D3D11_SHADER_DESC; + +typedef struct _D3D11_SHADER_INPUT_BIND_DESC +{ + LPCSTR Name; // Name of the resource + D3D_SHADER_INPUT_TYPE Type; // Type of resource (e.g. texture, cbuffer, etc.) + UINT BindPoint; // Starting bind point + UINT BindCount; // Number of contiguous bind points (for arrays) + + UINT uFlags; // Input binding flags + D3D_RESOURCE_RETURN_TYPE ReturnType; // Return type (if texture) + D3D_SRV_DIMENSION Dimension; // Dimension (if texture) + UINT NumSamples; // Number of samples (0 if not MS texture) +} D3D11_SHADER_INPUT_BIND_DESC; + + +////////////////////////////////////////////////////////////////////////////// +// Interfaces //////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +typedef interface ID3D11ShaderReflectionType ID3D11ShaderReflectionType; +typedef interface ID3D11ShaderReflectionType *LPD3D11SHADERREFLECTIONTYPE; + +typedef interface ID3D11ShaderReflectionVariable ID3D11ShaderReflectionVariable; +typedef interface ID3D11ShaderReflectionVariable *LPD3D11SHADERREFLECTIONVARIABLE; + +typedef interface ID3D11ShaderReflectionConstantBuffer ID3D11ShaderReflectionConstantBuffer; +typedef interface ID3D11ShaderReflectionConstantBuffer *LPD3D11SHADERREFLECTIONCONSTANTBUFFER; + +typedef interface ID3D11ShaderReflection ID3D11ShaderReflection; +typedef interface ID3D11ShaderReflection *LPD3D11SHADERREFLECTION; + +// {6E6FFA6A-9BAE-4613-A51E-91652D508C21} +DEFINE_GUID(IID_ID3D11ShaderReflectionType, +0x6e6ffa6a, 0x9bae, 0x4613, 0xa5, 0x1e, 0x91, 0x65, 0x2d, 0x50, 0x8c, 0x21); + +#undef INTERFACE +#define INTERFACE ID3D11ShaderReflectionType + +DECLARE_INTERFACE(ID3D11ShaderReflectionType) +{ + STDMETHOD(GetDesc)(THIS_ __out D3D11_SHADER_TYPE_DESC *pDesc) PURE; + + STDMETHOD_(ID3D11ShaderReflectionType*, GetMemberTypeByIndex)(THIS_ __in UINT Index) PURE; + STDMETHOD_(ID3D11ShaderReflectionType*, GetMemberTypeByName)(THIS_ __in LPCSTR Name) PURE; + STDMETHOD_(LPCSTR, GetMemberTypeName)(THIS_ __in UINT Index) PURE; + + STDMETHOD(IsEqual)(THIS_ __in ID3D11ShaderReflectionType* pType) PURE; + STDMETHOD_(ID3D11ShaderReflectionType*, GetSubType)(THIS) PURE; + STDMETHOD_(ID3D11ShaderReflectionType*, GetBaseClass)(THIS) PURE; + STDMETHOD_(UINT, GetNumInterfaces)(THIS) PURE; + STDMETHOD_(ID3D11ShaderReflectionType*, GetInterfaceByIndex)(THIS_ __in UINT uIndex) PURE; + STDMETHOD(IsOfType)(THIS_ __in ID3D11ShaderReflectionType* pType) PURE; + STDMETHOD(ImplementsInterface)(THIS_ __in ID3D11ShaderReflectionType* pBase) PURE; +}; + +// {51F23923-F3E5-4BD1-91CB-606177D8DB4C} +DEFINE_GUID(IID_ID3D11ShaderReflectionVariable, +0x51f23923, 0xf3e5, 0x4bd1, 0x91, 0xcb, 0x60, 0x61, 0x77, 0xd8, 0xdb, 0x4c); + +#undef INTERFACE +#define INTERFACE ID3D11ShaderReflectionVariable + +DECLARE_INTERFACE(ID3D11ShaderReflectionVariable) +{ + STDMETHOD(GetDesc)(THIS_ __out D3D11_SHADER_VARIABLE_DESC *pDesc) PURE; + + STDMETHOD_(ID3D11ShaderReflectionType*, GetType)(THIS) PURE; + STDMETHOD_(ID3D11ShaderReflectionConstantBuffer*, GetBuffer)(THIS) PURE; + + STDMETHOD_(UINT, GetInterfaceSlot)(THIS_ __in UINT uArrayIndex) PURE; +}; + +// {EB62D63D-93DD-4318-8AE8-C6F83AD371B8} +DEFINE_GUID(IID_ID3D11ShaderReflectionConstantBuffer, +0xeb62d63d, 0x93dd, 0x4318, 0x8a, 0xe8, 0xc6, 0xf8, 0x3a, 0xd3, 0x71, 0xb8); + +#undef INTERFACE +#define INTERFACE ID3D11ShaderReflectionConstantBuffer + +DECLARE_INTERFACE(ID3D11ShaderReflectionConstantBuffer) +{ + STDMETHOD(GetDesc)(THIS_ D3D11_SHADER_BUFFER_DESC *pDesc) PURE; + + STDMETHOD_(ID3D11ShaderReflectionVariable*, GetVariableByIndex)(THIS_ __in UINT Index) PURE; + STDMETHOD_(ID3D11ShaderReflectionVariable*, GetVariableByName)(THIS_ __in LPCSTR Name) PURE; +}; + +// The ID3D11ShaderReflection IID may change from SDK version to SDK version +// if the reflection API changes. This prevents new code with the new API +// from working with an old binary. Recompiling with the new header +// will pick up the new IID. + +// 0a233719-3960-4578-9d7c-203b8b1d9cc1 +DEFINE_GUID(IID_ID3D11ShaderReflection, +0x0a233719, 0x3960, 0x4578, 0x9d, 0x7c, 0x20, 0x3b, 0x8b, 0x1d, 0x9c, 0xc1); + +#undef INTERFACE +#define INTERFACE ID3D11ShaderReflection + +DECLARE_INTERFACE_(ID3D11ShaderReflection, IUnknown) +{ + STDMETHOD(QueryInterface)(THIS_ __in REFIID iid, + __out LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + STDMETHOD(GetDesc)(THIS_ __out D3D11_SHADER_DESC *pDesc) PURE; + + STDMETHOD_(ID3D11ShaderReflectionConstantBuffer*, GetConstantBufferByIndex)(THIS_ __in UINT Index) PURE; + STDMETHOD_(ID3D11ShaderReflectionConstantBuffer*, GetConstantBufferByName)(THIS_ __in LPCSTR Name) PURE; + + STDMETHOD(GetResourceBindingDesc)(THIS_ __in UINT ResourceIndex, + __out D3D11_SHADER_INPUT_BIND_DESC *pDesc) PURE; + + STDMETHOD(GetInputParameterDesc)(THIS_ __in UINT ParameterIndex, + __out D3D11_SIGNATURE_PARAMETER_DESC *pDesc) PURE; + STDMETHOD(GetOutputParameterDesc)(THIS_ __in UINT ParameterIndex, + __out D3D11_SIGNATURE_PARAMETER_DESC *pDesc) PURE; + STDMETHOD(GetPatchConstantParameterDesc)(THIS_ __in UINT ParameterIndex, + __out D3D11_SIGNATURE_PARAMETER_DESC *pDesc) PURE; + + STDMETHOD_(ID3D11ShaderReflectionVariable*, GetVariableByName)(THIS_ __in LPCSTR Name) PURE; + + STDMETHOD(GetResourceBindingDescByName)(THIS_ __in LPCSTR Name, + __out D3D11_SHADER_INPUT_BIND_DESC *pDesc) PURE; + + STDMETHOD_(UINT, GetMovInstructionCount)(THIS) PURE; + STDMETHOD_(UINT, GetMovcInstructionCount)(THIS) PURE; + STDMETHOD_(UINT, GetConversionInstructionCount)(THIS) PURE; + STDMETHOD_(UINT, GetBitwiseInstructionCount)(THIS) PURE; + + STDMETHOD_(D3D_PRIMITIVE, GetGSInputPrimitive)(THIS) PURE; + STDMETHOD_(BOOL, IsSampleFrequencyShader)(THIS) PURE; + + STDMETHOD_(UINT, GetNumInterfaceSlots)(THIS) PURE; + STDMETHOD(GetMinFeatureLevel)(THIS_ __out enum D3D_FEATURE_LEVEL* pLevel) PURE; + + STDMETHOD_(UINT, GetThreadGroupSize)(THIS_ + __out_opt UINT* pSizeX, + __out_opt UINT* pSizeY, + __out_opt UINT* pSizeZ) PURE; +}; + +////////////////////////////////////////////////////////////////////////////// +// APIs ////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif //__D3D11SHADER_H__ + diff --git a/MediaClient/MediaClient/directx/include/D3DCSX.h b/MediaClient/MediaClient/directx/include/D3DCSX.h new file mode 100644 index 0000000..240cdbb --- /dev/null +++ b/MediaClient/MediaClient/directx/include/D3DCSX.h @@ -0,0 +1,409 @@ + +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// File: D3DX11GPGPU.h +// Content: D3DX11 General Purpose GPU computing algorithms +// +////////////////////////////////////////////////////////////////////////////// + +#include "d3dx11.h" + +#ifndef __D3DX11GPGPU_H__ +#define __D3DX11GPGPU_H__ + +// Current name of the DLL shipped in the same SDK as this header. + + +#define D3DCSX_DLL_W L"d3dcsx_43.dll" +#define D3DCSX_DLL_A "d3dcsx_43.dll" + +#ifdef UNICODE + #define D3DCSX_DLL D3DCSX_DLL_W +#else + #define D3DCSX_DLL D3DCSX_DLL_A +#endif + + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + + + + + + +////////////////////////////////////////////////////////////////////////////// + +typedef enum D3DX11_SCAN_DATA_TYPE +{ + D3DX11_SCAN_DATA_TYPE_FLOAT = 1, + D3DX11_SCAN_DATA_TYPE_INT, + D3DX11_SCAN_DATA_TYPE_UINT, +} D3DX11_SCAN_DATA_TYPE; + +typedef enum D3DX11_SCAN_OPCODE +{ + D3DX11_SCAN_OPCODE_ADD = 1, + D3DX11_SCAN_OPCODE_MIN, + D3DX11_SCAN_OPCODE_MAX, + D3DX11_SCAN_OPCODE_MUL, + D3DX11_SCAN_OPCODE_AND, + D3DX11_SCAN_OPCODE_OR, + D3DX11_SCAN_OPCODE_XOR, +} D3DX11_SCAN_OPCODE; + +typedef enum D3DX11_SCAN_DIRECTION +{ + D3DX11_SCAN_DIRECTION_FORWARD = 1, + D3DX11_SCAN_DIRECTION_BACKWARD, +} D3DX11_SCAN_DIRECTION; + + +////////////////////////////////////////////////////////////////////////////// +// ID3DX11Scan: +////////////////////////////////////////////////////////////////////////////// + +// {5089b68f-e71d-4d38-be8e-f363b95a9405} +DEFINE_GUID(IID_ID3DX11Scan, 0x5089b68f, 0xe71d, 0x4d38, 0xbe, 0x8e, 0xf3, 0x63, 0xb9, 0x5a, 0x94, 0x05); + +#undef INTERFACE +#define INTERFACE ID3DX11Scan + +DECLARE_INTERFACE_(ID3DX11Scan, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DX11Scan + + STDMETHOD(SetScanDirection)(THIS_ D3DX11_SCAN_DIRECTION Direction) PURE; + + //============================================================================= + // Performs an unsegmented scan of a sequence in-place or out-of-place + // ElementType element type + // OpCode binary operation + // Direction scan direction + // ElementScanSize size of scan, in elements + // pSrc input sequence on the device. pSrc==pDst for in-place scans + // pDst output sequence on the device + //============================================================================= + STDMETHOD(Scan)( THIS_ + D3DX11_SCAN_DATA_TYPE ElementType, + D3DX11_SCAN_OPCODE OpCode, + UINT ElementScanSize, + __in ID3D11UnorderedAccessView* pSrc, + __in ID3D11UnorderedAccessView* pDst + ) PURE; + + //============================================================================= + // Performs a multiscan of a sequence in-place or out-of-place + // ElementType element type + // OpCode binary operation + // Direction scan direction + // ElementScanSize size of scan, in elements + // ElementScanPitch pitch of the next scan, in elements + // ScanCount number of scans in a multiscan + // pSrc input sequence on the device. pSrc==pDst for in-place scans + // pDst output sequence on the device + //============================================================================= + STDMETHOD(Multiscan)( THIS_ + D3DX11_SCAN_DATA_TYPE ElementType, + D3DX11_SCAN_OPCODE OpCode, + UINT ElementScanSize, + UINT ElementScanPitch, + UINT ScanCount, + __in ID3D11UnorderedAccessView* pSrc, + __in ID3D11UnorderedAccessView* pDst + ) PURE; +}; + + +//============================================================================= +// Creates a scan context +// pDevice the device context +// MaxElementScanSize maximum single scan size, in elements (FLOAT, UINT, or INT) +// MaxScanCount maximum number of scans in multiscan +// ppScanContext new scan context +//============================================================================= +HRESULT WINAPI D3DX11CreateScan( + __in ID3D11DeviceContext* pDeviceContext, + UINT MaxElementScanSize, + UINT MaxScanCount, + __out ID3DX11Scan** ppScan ); + + + +////////////////////////////////////////////////////////////////////////////// +// ID3DX11SegmentedScan: +////////////////////////////////////////////////////////////////////////////// + +// {a915128c-d954-4c79-bfe1-64db923194d6} +DEFINE_GUID(IID_ID3DX11SegmentedScan, 0xa915128c, 0xd954, 0x4c79, 0xbf, 0xe1, 0x64, 0xdb, 0x92, 0x31, 0x94, 0xd6); + +#undef INTERFACE +#define INTERFACE ID3DX11SegmentedScan + +DECLARE_INTERFACE_(ID3DX11SegmentedScan, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DX11SegmentedScan + + STDMETHOD(SetScanDirection)(THIS_ D3DX11_SCAN_DIRECTION Direction) PURE; + + //============================================================================= + // Performs a segscan of a sequence in-place or out-of-place + // ElementType element type + // OpCode binary operation + // Direction scan direction + // pSrcElementFlags compact array of bits, one per element of pSrc. A set value + // indicates the start of a new segment. + // ElementScanSize size of scan, in elements + // pSrc input sequence on the device. pSrc==pDst for in-place scans + // pDst output sequence on the device + //============================================================================= + STDMETHOD(SegScan)( THIS_ + D3DX11_SCAN_DATA_TYPE ElementType, + D3DX11_SCAN_OPCODE OpCode, + UINT ElementScanSize, + __in_opt ID3D11UnorderedAccessView* pSrc, + __in ID3D11UnorderedAccessView* pSrcElementFlags, + __in ID3D11UnorderedAccessView* pDst + ) PURE; +}; + + +//============================================================================= +// Creates a segmented scan context +// pDevice the device context +// MaxElementScanSize maximum single scan size, in elements (FLOAT, UINT, or INT) +// ppScanContext new scan context +//============================================================================= +HRESULT WINAPI D3DX11CreateSegmentedScan( + __in ID3D11DeviceContext* pDeviceContext, + UINT MaxElementScanSize, + __out ID3DX11SegmentedScan** ppScan ); + + + +////////////////////////////////////////////////////////////////////////////// + +#define D3DX11_FFT_MAX_PRECOMPUTE_BUFFERS 4 +#define D3DX11_FFT_MAX_TEMP_BUFFERS 4 +#define D3DX11_FFT_MAX_DIMENSIONS 32 + + + +////////////////////////////////////////////////////////////////////////////// +// ID3DX11FFT: +////////////////////////////////////////////////////////////////////////////// + +// {b3f7a938-4c93-4310-a675-b30d6de50553} +DEFINE_GUID(IID_ID3DX11FFT, 0xb3f7a938, 0x4c93, 0x4310, 0xa6, 0x75, 0xb3, 0x0d, 0x6d, 0xe5, 0x05, 0x53); + +#undef INTERFACE +#define INTERFACE ID3DX11FFT + +DECLARE_INTERFACE_(ID3DX11FFT, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DX11FFT + + // scale for forward transform (defaults to 1 if set to 0) + STDMETHOD(SetForwardScale)(THIS_ FLOAT ForwardScale) PURE; + STDMETHOD_(FLOAT, GetForwardScale)(THIS) PURE; + + // scale for inverse transform (defaults to 1/N if set to 0, where N is + // the product of the transformed dimension lengths + STDMETHOD(SetInverseScale)(THIS_ FLOAT InverseScale) PURE; + STDMETHOD_(FLOAT, GetInverseScale)(THIS) PURE; + + //------------------------------------------------------------------------------ + // Attaches buffers to the context and performs any required precomputation. + // The buffers must be no smaller than the corresponding buffer sizes returned + // by D3DX11CreateFFT*(). Temp buffers may beshared between multiple contexts, + // though care should be taken to concurrently execute multiple FFTs which share + // temp buffers. + // + // NumTempBuffers number of buffers in ppTempBuffers + // ppTempBuffers temp buffers to attach + // NumPrecomputeBuffers number of buffers in ppPrecomputeBufferSizes + // ppPrecomputeBufferSizes buffers to hold precomputed data + STDMETHOD(AttachBuffersAndPrecompute)( THIS_ + __in_range(0,D3DX11_FFT_MAX_TEMP_BUFFERS) UINT NumTempBuffers, + __in_ecount(NumTempBuffers) ID3D11UnorderedAccessView*const* ppTempBuffers, + __in_range(0,D3DX11_FFT_MAX_PRECOMPUTE_BUFFERS) UINT NumPrecomputeBuffers, + __in_ecount(NumPrecomputeBuffers) ID3D11UnorderedAccessView*const* ppPrecomputeBufferSizes ) PURE; + + //------------------------------------------------------------------------------ + // Call after buffers have been attached to the context, pInput and *ppOuput can + // be one of the temp buffers. If *ppOutput == NULL, then the computation will ping-pong + // between temp buffers and the last buffer written to is stored at *ppOutput. + // Otherwise, *ppOutput is used as the output buffer (which may incur an extra copy). + // + // The format of complex data is interleaved components, e.g. (Real0, Imag0), + // (Real1, Imag1) ... etc. Data is stored in row major order + // + // pInputBuffer view onto input buffer + // ppOutpuBuffert pointer to view of output buffer + STDMETHOD(ForwardTransform)( THIS_ + __in const ID3D11UnorderedAccessView* pInputBuffer, + __inout ID3D11UnorderedAccessView** ppOutputBuffer ) PURE; + + STDMETHOD(InverseTransform)( THIS_ + __in const ID3D11UnorderedAccessView* pInputBuffer, + __inout ID3D11UnorderedAccessView** ppOutputBuffer ) PURE; +}; + + +////////////////////////////////////////////////////////////////////////////// +// ID3DX11FFT Creation Routines +////////////////////////////////////////////////////////////////////////////// + +typedef enum D3DX11_FFT_DATA_TYPE +{ + D3DX11_FFT_DATA_TYPE_REAL, + D3DX11_FFT_DATA_TYPE_COMPLEX, +} D3DX11_FFT_DATA_TYPE; + +typedef enum D3DX11_FFT_DIM_MASK +{ + D3DX11_FFT_DIM_MASK_1D = 0x1, + D3DX11_FFT_DIM_MASK_2D = 0x3, + D3DX11_FFT_DIM_MASK_3D = 0x7, +} D3DX11_FFT_DIM_MASK; + +typedef struct D3DX11_FFT_DESC +{ + UINT NumDimensions; // number of dimensions + UINT ElementLengths[D3DX11_FFT_MAX_DIMENSIONS]; // length of each dimension + UINT DimensionMask; // a bit set for each dimensions to transform + // (see D3DX11_FFT_DIM_MASK for common masks) + D3DX11_FFT_DATA_TYPE Type; // type of the elements in spatial domain +} D3DX11_FFT_DESC; + + +//------------------------------------------------------------------------------ +// NumTempBufferSizes Number of temporary buffers needed +// pTempBufferSizes Minimum sizes (in FLOATs) of temporary buffers +// NumPrecomputeBufferSizes Number of precompute buffers needed +// pPrecomputeBufferSizes minimum sizes (in FLOATs) for precompute buffers +//------------------------------------------------------------------------------ + +typedef struct D3DX11_FFT_BUFFER_INFO +{ + __range(0,D3DX11_FFT_MAX_TEMP_BUFFERS) UINT NumTempBufferSizes; + UINT TempBufferFloatSizes[D3DX11_FFT_MAX_TEMP_BUFFERS]; + __range(0,D3DX11_FFT_MAX_PRECOMPUTE_BUFFERS) UINT NumPrecomputeBufferSizes; + UINT PrecomputeBufferFloatSizes[D3DX11_FFT_MAX_PRECOMPUTE_BUFFERS]; +} D3DX11_FFT_BUFFER_INFO; + + +typedef enum D3DX11_FFT_CREATE_FLAG +{ + D3DX11_FFT_CREATE_FLAG_NO_PRECOMPUTE_BUFFERS = 0x01L, // do not precompute values and store into buffers +} D3DX11_FFT_CREATE_FLAG; + + +//------------------------------------------------------------------------------ +// Creates an ID3DX11FFT COM interface object and returns a pointer to it at *ppFFT. +// The descriptor describes the shape of the data as well as the scaling factors +// that should be used for forward and inverse transforms. +// The FFT computation may require temporaries that act as ping-pong buffers +// and for other purposes. aTempSizes is a list of the sizes required for +// temporaries. Likewise, some data may need to be precomputed and the sizes +// of those sizes are returned in aPrecomputedBufferSizes. +// +// To perform a computation, follow these steps: +// 1) Create the FFT context object +// 2) Precompute (and Attach temp working buffers of at least the required size) +// 3) Call Compute() on some input data +// +// Compute() may be called repeatedly with different inputs and transform +// directions. When finished with the FFT work, release the FFT interface() +// +// Device Direct3DDeviceContext to use in +// pDesc Descriptor for FFT transform in +// Count the number of 1D FFTs to perform in +// Flags See D3DX11_FFT_CREATE_FLAG in +// pBufferInfo Pointer to BUFFER_INFO struct, filled by funciton out +// ppFFT Pointer to returned context pointer out +//------------------------------------------------------------------------------ + +HRESULT WINAPI D3DX11CreateFFT( + ID3D11DeviceContext* pDeviceContext, + __in const D3DX11_FFT_DESC* pDesc, + UINT Flags, + __out D3DX11_FFT_BUFFER_INFO* pBufferInfo, + __out ID3DX11FFT** ppFFT + ); + +HRESULT WINAPI D3DX11CreateFFT1DReal( + ID3D11DeviceContext* pDeviceContext, + UINT X, + UINT Flags, + __out D3DX11_FFT_BUFFER_INFO* pBufferInfo, + __out ID3DX11FFT** ppFFT + ); +HRESULT WINAPI D3DX11CreateFFT1DComplex( + ID3D11DeviceContext* pDeviceContext, + UINT X, + UINT Flags, + __out D3DX11_FFT_BUFFER_INFO* pBufferInfo, + __out ID3DX11FFT** ppFFT + ); +HRESULT WINAPI D3DX11CreateFFT2DReal( + ID3D11DeviceContext* pDeviceContext, + UINT X, + UINT Y, + UINT Flags, + __out D3DX11_FFT_BUFFER_INFO* pBufferInfo, + __out ID3DX11FFT** ppFFT + ); +HRESULT WINAPI D3DX11CreateFFT2DComplex( + ID3D11DeviceContext* pDeviceContext, + UINT X, + UINT Y, + UINT Flags, + __out D3DX11_FFT_BUFFER_INFO* pBufferInfo, + __out ID3DX11FFT** ppFFT + ); +HRESULT WINAPI D3DX11CreateFFT3DReal( + ID3D11DeviceContext* pDeviceContext, + UINT X, + UINT Y, + UINT Z, + UINT Flags, + __out D3DX11_FFT_BUFFER_INFO* pBufferInfo, + __out ID3DX11FFT** ppFFT + ); +HRESULT WINAPI D3DX11CreateFFT3DComplex( + ID3D11DeviceContext* pDeviceContext, + UINT X, + UINT Y, + UINT Z, + UINT Flags, + __out D3DX11_FFT_BUFFER_INFO* pBufferInfo, + __out ID3DX11FFT** ppFFT + ); + + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif //__D3DX11GPGPU_H__ + + diff --git a/MediaClient/MediaClient/directx/include/D3DX10.h b/MediaClient/MediaClient/directx/include/D3DX10.h new file mode 100644 index 0000000..5cdcd51 --- /dev/null +++ b/MediaClient/MediaClient/directx/include/D3DX10.h @@ -0,0 +1,72 @@ +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx10.h +// Content: D3DX10 utility library +// +////////////////////////////////////////////////////////////////////////////// + +#ifdef __D3DX10_INTERNAL__ +#error Incorrect D3DX10 header used +#endif + +#ifndef __D3DX10_H__ +#define __D3DX10_H__ + + +// Defines +#include +#include + +#define D3DX10_DEFAULT ((UINT) -1) +#define D3DX10_FROM_FILE ((UINT) -3) +#define DXGI_FORMAT_FROM_FILE ((DXGI_FORMAT) -3) + +#ifndef D3DX10INLINE +#ifdef _MSC_VER + #if (_MSC_VER >= 1200) + #define D3DX10INLINE __forceinline + #else + #define D3DX10INLINE __inline + #endif +#else + #ifdef __cplusplus + #define D3DX10INLINE inline + #else + #define D3DX10INLINE + #endif +#endif +#endif + + + +// Includes +#include "d3d10.h" +#include "d3dx10.h" +#include "d3dx10math.h" +#include "d3dx10core.h" +#include "d3dx10tex.h" +#include "d3dx10mesh.h" +#include "d3dx10async.h" + + +// Errors +#define _FACDD 0x876 +#define MAKE_DDHRESULT( code ) MAKE_HRESULT( 1, _FACDD, code ) + +enum _D3DX10_ERR { + D3DX10_ERR_CANNOT_MODIFY_INDEX_BUFFER = MAKE_DDHRESULT(2900), + D3DX10_ERR_INVALID_MESH = MAKE_DDHRESULT(2901), + D3DX10_ERR_CANNOT_ATTR_SORT = MAKE_DDHRESULT(2902), + D3DX10_ERR_SKINNING_NOT_SUPPORTED = MAKE_DDHRESULT(2903), + D3DX10_ERR_TOO_MANY_INFLUENCES = MAKE_DDHRESULT(2904), + D3DX10_ERR_INVALID_DATA = MAKE_DDHRESULT(2905), + D3DX10_ERR_LOADED_MESH_HAS_NO_DATA = MAKE_DDHRESULT(2906), + D3DX10_ERR_DUPLICATE_NAMED_FRAGMENT = MAKE_DDHRESULT(2907), + D3DX10_ERR_CANNOT_REMOVE_LAST_ITEM = MAKE_DDHRESULT(2908), +}; + + +#endif //__D3DX10_H__ + diff --git a/MediaClient/MediaClient/directx/include/D3DX10core.h b/MediaClient/MediaClient/directx/include/D3DX10core.h new file mode 100644 index 0000000..290a004 --- /dev/null +++ b/MediaClient/MediaClient/directx/include/D3DX10core.h @@ -0,0 +1,444 @@ +/////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx10core.h +// Content: D3DX10 core types and functions +// +/////////////////////////////////////////////////////////////////////////// + +#include "d3dx10.h" + +#ifndef __D3DX10CORE_H__ +#define __D3DX10CORE_H__ + +// Current name of the DLL shipped in the same SDK as this header. + + +#define D3DX10_DLL_W L"d3dx10_43.dll" +#define D3DX10_DLL_A "d3dx10_43.dll" + +#ifdef UNICODE + #define D3DX10_DLL D3DX10_DLL_W +#else + #define D3DX10_DLL D3DX10_DLL_A +#endif + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + +/////////////////////////////////////////////////////////////////////////// +// D3DX10_SDK_VERSION: +// ----------------- +// This identifier is passed to D3DX10CheckVersion in order to ensure that an +// application was built against the correct header files and lib files. +// This number is incremented whenever a header (or other) change would +// require applications to be rebuilt. If the version doesn't match, +// D3DX10CreateVersion will return FALSE. (The number itself has no meaning.) +/////////////////////////////////////////////////////////////////////////// + + +#define D3DX10_SDK_VERSION 43 + + +/////////////////////////////////////////////////////////////////////////// +// D3DX10CreateDevice +// D3DX10CreateDeviceAndSwapChain +// D3DX10GetFeatureLevel1 +/////////////////////////////////////////////////////////////////////////// +HRESULT WINAPI D3DX10CreateDevice(IDXGIAdapter *pAdapter, + D3D10_DRIVER_TYPE DriverType, + HMODULE Software, + UINT Flags, + ID3D10Device **ppDevice); + +HRESULT WINAPI D3DX10CreateDeviceAndSwapChain(IDXGIAdapter *pAdapter, + D3D10_DRIVER_TYPE DriverType, + HMODULE Software, + UINT Flags, + DXGI_SWAP_CHAIN_DESC *pSwapChainDesc, + IDXGISwapChain **ppSwapChain, + ID3D10Device **ppDevice); + +typedef interface ID3D10Device1 ID3D10Device1; +HRESULT WINAPI D3DX10GetFeatureLevel1(ID3D10Device *pDevice, ID3D10Device1 **ppDevice1); + + +#ifdef D3D_DIAG_DLL +BOOL WINAPI D3DX10DebugMute(BOOL Mute); +#endif +HRESULT WINAPI D3DX10CheckVersion(UINT D3DSdkVersion, UINT D3DX10SdkVersion); + +#ifdef __cplusplus +} +#endif //__cplusplus + + +////////////////////////////////////////////////////////////////////////////// +// D3DX10_SPRITE flags: +// ----------------- +// D3DX10_SPRITE_SAVE_STATE +// Specifies device state should be saved and restored in Begin/End. +// D3DX10SPRITE_SORT_TEXTURE +// Sprites are sorted by texture prior to drawing. This is recommended when +// drawing non-overlapping sprites of uniform depth. For example, drawing +// screen-aligned text with ID3DX10Font. +// D3DX10SPRITE_SORT_DEPTH_FRONT_TO_BACK +// Sprites are sorted by depth front-to-back prior to drawing. This is +// recommended when drawing opaque sprites of varying depths. +// D3DX10SPRITE_SORT_DEPTH_BACK_TO_FRONT +// Sprites are sorted by depth back-to-front prior to drawing. This is +// recommended when drawing transparent sprites of varying depths. +// D3DX10SPRITE_ADDREF_TEXTURES +// AddRef/Release all textures passed in to DrawSpritesBuffered +////////////////////////////////////////////////////////////////////////////// + +typedef enum _D3DX10_SPRITE_FLAG +{ + D3DX10_SPRITE_SORT_TEXTURE = 0x01, + D3DX10_SPRITE_SORT_DEPTH_BACK_TO_FRONT = 0x02, + D3DX10_SPRITE_SORT_DEPTH_FRONT_TO_BACK = 0x04, + D3DX10_SPRITE_SAVE_STATE = 0x08, + D3DX10_SPRITE_ADDREF_TEXTURES = 0x10, +} D3DX10_SPRITE_FLAG; + +typedef struct _D3DX10_SPRITE +{ + D3DXMATRIX matWorld; + + D3DXVECTOR2 TexCoord; + D3DXVECTOR2 TexSize; + + D3DXCOLOR ColorModulate; + + ID3D10ShaderResourceView *pTexture; + UINT TextureIndex; +} D3DX10_SPRITE; + + +////////////////////////////////////////////////////////////////////////////// +// ID3DX10Sprite: +// ------------ +// This object intends to provide an easy way to drawing sprites using D3D. +// +// Begin - +// Prepares device for drawing sprites. +// +// Draw - +// Draws a sprite +// +// Flush - +// Forces all batched sprites to submitted to the device. +// +// End - +// Restores device state to how it was when Begin was called. +// +////////////////////////////////////////////////////////////////////////////// + +typedef interface ID3DX10Sprite ID3DX10Sprite; +typedef interface ID3DX10Sprite *LPD3DX10SPRITE; + + +// {BA0B762D-8D28-43ec-B9DC-2F84443B0614} +DEFINE_GUID(IID_ID3DX10Sprite, +0xba0b762d, 0x8d28, 0x43ec, 0xb9, 0xdc, 0x2f, 0x84, 0x44, 0x3b, 0x6, 0x14); + + +#undef INTERFACE +#define INTERFACE ID3DX10Sprite + +DECLARE_INTERFACE_(ID3DX10Sprite, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DX10Sprite + STDMETHOD(Begin)(THIS_ UINT flags) PURE; + + STDMETHOD(DrawSpritesBuffered)(THIS_ D3DX10_SPRITE *pSprites, UINT cSprites) PURE; + STDMETHOD(Flush)(THIS) PURE; + + STDMETHOD(DrawSpritesImmediate)(THIS_ D3DX10_SPRITE *pSprites, UINT cSprites, UINT cbSprite, UINT flags) PURE; + STDMETHOD(End)(THIS) PURE; + + STDMETHOD(GetViewTransform)(THIS_ D3DXMATRIX *pViewTransform) PURE; + STDMETHOD(SetViewTransform)(THIS_ D3DXMATRIX *pViewTransform) PURE; + STDMETHOD(GetProjectionTransform)(THIS_ D3DXMATRIX *pProjectionTransform) PURE; + STDMETHOD(SetProjectionTransform)(THIS_ D3DXMATRIX *pProjectionTransform) PURE; + + STDMETHOD(GetDevice)(THIS_ ID3D10Device** ppDevice) PURE; +}; + + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + +HRESULT WINAPI + D3DX10CreateSprite( + ID3D10Device* pDevice, + UINT cDeviceBufferSize, + LPD3DX10SPRITE* ppSprite); + +#ifdef __cplusplus +} +#endif //__cplusplus + + +////////////////////////////////////////////////////////////////////////////// +// ID3DX10ThreadPump: +////////////////////////////////////////////////////////////////////////////// + +#undef INTERFACE +#define INTERFACE ID3DX10DataLoader + +DECLARE_INTERFACE(ID3DX10DataLoader) +{ + STDMETHOD(Load)(THIS) PURE; + STDMETHOD(Decompress)(THIS_ void **ppData, SIZE_T *pcBytes) PURE; + STDMETHOD(Destroy)(THIS) PURE; +}; + +#undef INTERFACE +#define INTERFACE ID3DX10DataProcessor + +DECLARE_INTERFACE(ID3DX10DataProcessor) +{ + STDMETHOD(Process)(THIS_ void *pData, SIZE_T cBytes) PURE; + STDMETHOD(CreateDeviceObject)(THIS_ void **ppDataObject) PURE; + STDMETHOD(Destroy)(THIS) PURE; +}; + +// {C93FECFA-6967-478a-ABBC-402D90621FCB} +DEFINE_GUID(IID_ID3DX10ThreadPump, +0xc93fecfa, 0x6967, 0x478a, 0xab, 0xbc, 0x40, 0x2d, 0x90, 0x62, 0x1f, 0xcb); + +#undef INTERFACE +#define INTERFACE ID3DX10ThreadPump + +DECLARE_INTERFACE_(ID3DX10ThreadPump, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DX10ThreadPump + STDMETHOD(AddWorkItem)(THIS_ ID3DX10DataLoader *pDataLoader, ID3DX10DataProcessor *pDataProcessor, HRESULT *pHResult, void **ppDeviceObject) PURE; + STDMETHOD_(UINT, GetWorkItemCount)(THIS) PURE; + + STDMETHOD(WaitForAllItems)(THIS) PURE; + STDMETHOD(ProcessDeviceWorkItems)(THIS_ UINT iWorkItemCount); + + STDMETHOD(PurgeAllItems)(THIS) PURE; + STDMETHOD(GetQueueStatus)(THIS_ UINT *pIoQueue, UINT *pProcessQueue, UINT *pDeviceQueue) PURE; + +}; + +HRESULT WINAPI D3DX10CreateThreadPump(UINT cIoThreads, UINT cProcThreads, ID3DX10ThreadPump **ppThreadPump); + + +////////////////////////////////////////////////////////////////////////////// +// ID3DX10Font: +// ---------- +// Font objects contain the textures and resources needed to render a specific +// font on a specific device. +// +// GetGlyphData - +// Returns glyph cache data, for a given glyph. +// +// PreloadCharacters/PreloadGlyphs/PreloadText - +// Preloads glyphs into the glyph cache textures. +// +// DrawText - +// Draws formatted text on a D3D device. Some parameters are +// surprisingly similar to those of GDI's DrawText function. See GDI +// documentation for a detailed description of these parameters. +// If pSprite is NULL, an internal sprite object will be used. +// +////////////////////////////////////////////////////////////////////////////// + +typedef struct _D3DX10_FONT_DESCA +{ + INT Height; + UINT Width; + UINT Weight; + UINT MipLevels; + BOOL Italic; + BYTE CharSet; + BYTE OutputPrecision; + BYTE Quality; + BYTE PitchAndFamily; + CHAR FaceName[LF_FACESIZE]; + +} D3DX10_FONT_DESCA, *LPD3DX10_FONT_DESCA; + +typedef struct _D3DX10_FONT_DESCW +{ + INT Height; + UINT Width; + UINT Weight; + UINT MipLevels; + BOOL Italic; + BYTE CharSet; + BYTE OutputPrecision; + BYTE Quality; + BYTE PitchAndFamily; + WCHAR FaceName[LF_FACESIZE]; + +} D3DX10_FONT_DESCW, *LPD3DX10_FONT_DESCW; + +#ifdef UNICODE +typedef D3DX10_FONT_DESCW D3DX10_FONT_DESC; +typedef LPD3DX10_FONT_DESCW LPD3DX10_FONT_DESC; +#else +typedef D3DX10_FONT_DESCA D3DX10_FONT_DESC; +typedef LPD3DX10_FONT_DESCA LPD3DX10_FONT_DESC; +#endif + + +typedef interface ID3DX10Font ID3DX10Font; +typedef interface ID3DX10Font *LPD3DX10FONT; + + +// {D79DBB70-5F21-4d36-BBC2-FF525C213CDC} +DEFINE_GUID(IID_ID3DX10Font, +0xd79dbb70, 0x5f21, 0x4d36, 0xbb, 0xc2, 0xff, 0x52, 0x5c, 0x21, 0x3c, 0xdc); + + +#undef INTERFACE +#define INTERFACE ID3DX10Font + +DECLARE_INTERFACE_(ID3DX10Font, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DX10Font + STDMETHOD(GetDevice)(THIS_ ID3D10Device** ppDevice) PURE; + STDMETHOD(GetDescA)(THIS_ D3DX10_FONT_DESCA *pDesc) PURE; + STDMETHOD(GetDescW)(THIS_ D3DX10_FONT_DESCW *pDesc) PURE; + STDMETHOD_(BOOL, GetTextMetricsA)(THIS_ TEXTMETRICA *pTextMetrics) PURE; + STDMETHOD_(BOOL, GetTextMetricsW)(THIS_ TEXTMETRICW *pTextMetrics) PURE; + + STDMETHOD_(HDC, GetDC)(THIS) PURE; + STDMETHOD(GetGlyphData)(THIS_ UINT Glyph, ID3D10ShaderResourceView** ppTexture, RECT *pBlackBox, POINT *pCellInc) PURE; + + STDMETHOD(PreloadCharacters)(THIS_ UINT First, UINT Last) PURE; + STDMETHOD(PreloadGlyphs)(THIS_ UINT First, UINT Last) PURE; + STDMETHOD(PreloadTextA)(THIS_ LPCSTR pString, INT Count) PURE; + STDMETHOD(PreloadTextW)(THIS_ LPCWSTR pString, INT Count) PURE; + + STDMETHOD_(INT, DrawTextA)(THIS_ LPD3DX10SPRITE pSprite, LPCSTR pString, INT Count, LPRECT pRect, UINT Format, D3DXCOLOR Color) PURE; + STDMETHOD_(INT, DrawTextW)(THIS_ LPD3DX10SPRITE pSprite, LPCWSTR pString, INT Count, LPRECT pRect, UINT Format, D3DXCOLOR Color) PURE; + +#ifdef __cplusplus +#ifdef UNICODE + HRESULT WINAPI_INLINE GetDesc(D3DX10_FONT_DESCW *pDesc) { return GetDescW(pDesc); } + HRESULT WINAPI_INLINE PreloadText(LPCWSTR pString, INT Count) { return PreloadTextW(pString, Count); } +#else + HRESULT WINAPI_INLINE GetDesc(D3DX10_FONT_DESCA *pDesc) { return GetDescA(pDesc); } + HRESULT WINAPI_INLINE PreloadText(LPCSTR pString, INT Count) { return PreloadTextA(pString, Count); } +#endif +#endif //__cplusplus +}; + +#ifndef GetTextMetrics +#ifdef UNICODE +#define GetTextMetrics GetTextMetricsW +#else +#define GetTextMetrics GetTextMetricsA +#endif +#endif + +#ifndef DrawText +#ifdef UNICODE +#define DrawText DrawTextW +#else +#define DrawText DrawTextA +#endif +#endif + + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + + +HRESULT WINAPI + D3DX10CreateFontA( + ID3D10Device* pDevice, + INT Height, + UINT Width, + UINT Weight, + UINT MipLevels, + BOOL Italic, + UINT CharSet, + UINT OutputPrecision, + UINT Quality, + UINT PitchAndFamily, + LPCSTR pFaceName, + LPD3DX10FONT* ppFont); + +HRESULT WINAPI + D3DX10CreateFontW( + ID3D10Device* pDevice, + INT Height, + UINT Width, + UINT Weight, + UINT MipLevels, + BOOL Italic, + UINT CharSet, + UINT OutputPrecision, + UINT Quality, + UINT PitchAndFamily, + LPCWSTR pFaceName, + LPD3DX10FONT* ppFont); + +#ifdef UNICODE +#define D3DX10CreateFont D3DX10CreateFontW +#else +#define D3DX10CreateFont D3DX10CreateFontA +#endif + + +HRESULT WINAPI + D3DX10CreateFontIndirectA( + ID3D10Device* pDevice, + CONST D3DX10_FONT_DESCA* pDesc, + LPD3DX10FONT* ppFont); + +HRESULT WINAPI + D3DX10CreateFontIndirectW( + ID3D10Device* pDevice, + CONST D3DX10_FONT_DESCW* pDesc, + LPD3DX10FONT* ppFont); + +#ifdef UNICODE +#define D3DX10CreateFontIndirect D3DX10CreateFontIndirectW +#else +#define D3DX10CreateFontIndirect D3DX10CreateFontIndirectA +#endif + +HRESULT WINAPI D3DX10UnsetAllDeviceObjects(ID3D10Device *pDevice); + +#ifdef __cplusplus +} +#endif //__cplusplus + +/////////////////////////////////////////////////////////////////////////// + +#define _FACD3D 0x876 +#define MAKE_D3DHRESULT( code ) MAKE_HRESULT( 1, _FACD3D, code ) +#define MAKE_D3DSTATUS( code ) MAKE_HRESULT( 0, _FACD3D, code ) + +#define D3DERR_INVALIDCALL MAKE_D3DHRESULT(2156) +#define D3DERR_WASSTILLDRAWING MAKE_D3DHRESULT(540) + +#endif //__D3DX10CORE_H__ + diff --git a/MediaClient/MediaClient/directx/include/D3DX10math.h b/MediaClient/MediaClient/directx/include/D3DX10math.h new file mode 100644 index 0000000..a4b8e2d --- /dev/null +++ b/MediaClient/MediaClient/directx/include/D3DX10math.h @@ -0,0 +1,1866 @@ +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: D3DX10math.h +// Content: D3DX10 math types and functions +// +////////////////////////////////////////////////////////////////////////////// + +#include "D3DX10.h" + +// D3DX10 and D3DX9 math look the same. You can include either one into your project. +// We are intentionally using the header define from D3DX9 math to prevent double-inclusion. +#ifndef __D3DX9MATH_H__ +#define __D3DX9MATH_H__ + +#include +#if _MSC_VER >= 1200 +#pragma warning(push) +#endif +#pragma warning(disable:4201) // anonymous unions warning + +//=========================================================================== +// +// Type definitions from D3D9 +// +//=========================================================================== + +#ifndef D3DVECTOR_DEFINED +typedef struct _D3DVECTOR { + float x; + float y; + float z; +} D3DVECTOR; +#define D3DVECTOR_DEFINED +#endif + +#ifndef D3DMATRIX_DEFINED +typedef struct _D3DMATRIX { + union { + struct { + float _11, _12, _13, _14; + float _21, _22, _23, _24; + float _31, _32, _33, _34; + float _41, _42, _43, _44; + + }; + float m[4][4]; + }; +} D3DMATRIX; +#define D3DMATRIX_DEFINED +#endif + +//=========================================================================== +// +// General purpose utilities +// +//=========================================================================== +#define D3DX_PI (3.14159265358979323846) +#define D3DX_1BYPI ( 1.0 / D3DX_PI ) + +#define D3DXToRadian( degree ) ((degree) * (D3DX_PI / 180.0)) +#define D3DXToDegree( radian ) ((radian) * (180.0 / D3DX_PI)) + + + +//=========================================================================== +// +// 16 bit floating point numbers +// +//=========================================================================== + +#define D3DX_16F_DIG 3 // # of decimal digits of precision +#define D3DX_16F_EPSILON 4.8875809e-4f // smallest such that 1.0 + epsilon != 1.0 +#define D3DX_16F_MANT_DIG 11 // # of bits in mantissa +#define D3DX_16F_MAX 6.550400e+004 // max value +#define D3DX_16F_MAX_10_EXP 4 // max decimal exponent +#define D3DX_16F_MAX_EXP 15 // max binary exponent +#define D3DX_16F_MIN 6.1035156e-5f // min positive value +#define D3DX_16F_MIN_10_EXP (-4) // min decimal exponent +#define D3DX_16F_MIN_EXP (-14) // min binary exponent +#define D3DX_16F_RADIX 2 // exponent radix +#define D3DX_16F_ROUNDS 1 // addition rounding: near +#define D3DX_16F_SIGN_MASK 0x8000 +#define D3DX_16F_EXP_MASK 0x7C00 +#define D3DX_16F_FRAC_MASK 0x03FF + +typedef struct D3DXFLOAT16 +{ +#ifdef __cplusplus +public: + D3DXFLOAT16() {}; + D3DXFLOAT16( FLOAT ); + D3DXFLOAT16( CONST D3DXFLOAT16& ); + + // casting + operator FLOAT (); + + // binary operators + BOOL operator == ( CONST D3DXFLOAT16& ) const; + BOOL operator != ( CONST D3DXFLOAT16& ) const; + +protected: +#endif //__cplusplus + WORD value; +} D3DXFLOAT16, *LPD3DXFLOAT16; + + + +//=========================================================================== +// +// Vectors +// +//=========================================================================== + + +//-------------------------- +// 2D Vector +//-------------------------- +typedef struct D3DXVECTOR2 +{ +#ifdef __cplusplus +public: + D3DXVECTOR2() {}; + D3DXVECTOR2( CONST FLOAT * ); + D3DXVECTOR2( CONST D3DXFLOAT16 * ); + D3DXVECTOR2( FLOAT x, FLOAT y ); + + // casting + operator FLOAT* (); + operator CONST FLOAT* () const; + + // assignment operators + D3DXVECTOR2& operator += ( CONST D3DXVECTOR2& ); + D3DXVECTOR2& operator -= ( CONST D3DXVECTOR2& ); + D3DXVECTOR2& operator *= ( FLOAT ); + D3DXVECTOR2& operator /= ( FLOAT ); + + // unary operators + D3DXVECTOR2 operator + () const; + D3DXVECTOR2 operator - () const; + + // binary operators + D3DXVECTOR2 operator + ( CONST D3DXVECTOR2& ) const; + D3DXVECTOR2 operator - ( CONST D3DXVECTOR2& ) const; + D3DXVECTOR2 operator * ( FLOAT ) const; + D3DXVECTOR2 operator / ( FLOAT ) const; + + friend D3DXVECTOR2 operator * ( FLOAT, CONST D3DXVECTOR2& ); + + BOOL operator == ( CONST D3DXVECTOR2& ) const; + BOOL operator != ( CONST D3DXVECTOR2& ) const; + + +public: +#endif //__cplusplus + FLOAT x, y; +} D3DXVECTOR2, *LPD3DXVECTOR2; + + + +//-------------------------- +// 2D Vector (16 bit) +//-------------------------- + +typedef struct D3DXVECTOR2_16F +{ +#ifdef __cplusplus +public: + D3DXVECTOR2_16F() {}; + D3DXVECTOR2_16F( CONST FLOAT * ); + D3DXVECTOR2_16F( CONST D3DXFLOAT16 * ); + D3DXVECTOR2_16F( CONST D3DXFLOAT16 &x, CONST D3DXFLOAT16 &y ); + + // casting + operator D3DXFLOAT16* (); + operator CONST D3DXFLOAT16* () const; + + // binary operators + BOOL operator == ( CONST D3DXVECTOR2_16F& ) const; + BOOL operator != ( CONST D3DXVECTOR2_16F& ) const; + +public: +#endif //__cplusplus + D3DXFLOAT16 x, y; + +} D3DXVECTOR2_16F, *LPD3DXVECTOR2_16F; + + + +//-------------------------- +// 3D Vector +//-------------------------- +#ifdef __cplusplus +typedef struct D3DXVECTOR3 : public D3DVECTOR +{ +public: + D3DXVECTOR3() {}; + D3DXVECTOR3( CONST FLOAT * ); + D3DXVECTOR3( CONST D3DVECTOR& ); + D3DXVECTOR3( CONST D3DXFLOAT16 * ); + D3DXVECTOR3( FLOAT x, FLOAT y, FLOAT z ); + + // casting + operator FLOAT* (); + operator CONST FLOAT* () const; + + // assignment operators + D3DXVECTOR3& operator += ( CONST D3DXVECTOR3& ); + D3DXVECTOR3& operator -= ( CONST D3DXVECTOR3& ); + D3DXVECTOR3& operator *= ( FLOAT ); + D3DXVECTOR3& operator /= ( FLOAT ); + + // unary operators + D3DXVECTOR3 operator + () const; + D3DXVECTOR3 operator - () const; + + // binary operators + D3DXVECTOR3 operator + ( CONST D3DXVECTOR3& ) const; + D3DXVECTOR3 operator - ( CONST D3DXVECTOR3& ) const; + D3DXVECTOR3 operator * ( FLOAT ) const; + D3DXVECTOR3 operator / ( FLOAT ) const; + + friend D3DXVECTOR3 operator * ( FLOAT, CONST struct D3DXVECTOR3& ); + + BOOL operator == ( CONST D3DXVECTOR3& ) const; + BOOL operator != ( CONST D3DXVECTOR3& ) const; + +} D3DXVECTOR3, *LPD3DXVECTOR3; + +#else //!__cplusplus +typedef struct _D3DVECTOR D3DXVECTOR3, *LPD3DXVECTOR3; +#endif //!__cplusplus + + + +//-------------------------- +// 3D Vector (16 bit) +//-------------------------- +typedef struct D3DXVECTOR3_16F +{ +#ifdef __cplusplus +public: + D3DXVECTOR3_16F() {}; + D3DXVECTOR3_16F( CONST FLOAT * ); + D3DXVECTOR3_16F( CONST D3DVECTOR& ); + D3DXVECTOR3_16F( CONST D3DXFLOAT16 * ); + D3DXVECTOR3_16F( CONST D3DXFLOAT16 &x, CONST D3DXFLOAT16 &y, CONST D3DXFLOAT16 &z ); + + // casting + operator D3DXFLOAT16* (); + operator CONST D3DXFLOAT16* () const; + + // binary operators + BOOL operator == ( CONST D3DXVECTOR3_16F& ) const; + BOOL operator != ( CONST D3DXVECTOR3_16F& ) const; + +public: +#endif //__cplusplus + D3DXFLOAT16 x, y, z; + +} D3DXVECTOR3_16F, *LPD3DXVECTOR3_16F; + + + +//-------------------------- +// 4D Vector +//-------------------------- +typedef struct D3DXVECTOR4 +{ +#ifdef __cplusplus +public: + D3DXVECTOR4() {}; + D3DXVECTOR4( CONST FLOAT* ); + D3DXVECTOR4( CONST D3DXFLOAT16* ); + D3DXVECTOR4( CONST D3DVECTOR& xyz, FLOAT w ); + D3DXVECTOR4( FLOAT x, FLOAT y, FLOAT z, FLOAT w ); + + // casting + operator FLOAT* (); + operator CONST FLOAT* () const; + + // assignment operators + D3DXVECTOR4& operator += ( CONST D3DXVECTOR4& ); + D3DXVECTOR4& operator -= ( CONST D3DXVECTOR4& ); + D3DXVECTOR4& operator *= ( FLOAT ); + D3DXVECTOR4& operator /= ( FLOAT ); + + // unary operators + D3DXVECTOR4 operator + () const; + D3DXVECTOR4 operator - () const; + + // binary operators + D3DXVECTOR4 operator + ( CONST D3DXVECTOR4& ) const; + D3DXVECTOR4 operator - ( CONST D3DXVECTOR4& ) const; + D3DXVECTOR4 operator * ( FLOAT ) const; + D3DXVECTOR4 operator / ( FLOAT ) const; + + friend D3DXVECTOR4 operator * ( FLOAT, CONST D3DXVECTOR4& ); + + BOOL operator == ( CONST D3DXVECTOR4& ) const; + BOOL operator != ( CONST D3DXVECTOR4& ) const; + +public: +#endif //__cplusplus + FLOAT x, y, z, w; +} D3DXVECTOR4, *LPD3DXVECTOR4; + + +//-------------------------- +// 4D Vector (16 bit) +//-------------------------- +typedef struct D3DXVECTOR4_16F +{ +#ifdef __cplusplus +public: + D3DXVECTOR4_16F() {}; + D3DXVECTOR4_16F( CONST FLOAT * ); + D3DXVECTOR4_16F( CONST D3DXFLOAT16* ); + D3DXVECTOR4_16F( CONST D3DXVECTOR3_16F& xyz, CONST D3DXFLOAT16& w ); + D3DXVECTOR4_16F( CONST D3DXFLOAT16& x, CONST D3DXFLOAT16& y, CONST D3DXFLOAT16& z, CONST D3DXFLOAT16& w ); + + // casting + operator D3DXFLOAT16* (); + operator CONST D3DXFLOAT16* () const; + + // binary operators + BOOL operator == ( CONST D3DXVECTOR4_16F& ) const; + BOOL operator != ( CONST D3DXVECTOR4_16F& ) const; + +public: +#endif //__cplusplus + D3DXFLOAT16 x, y, z, w; + +} D3DXVECTOR4_16F, *LPD3DXVECTOR4_16F; + + + +//=========================================================================== +// +// Matrices +// +//=========================================================================== +#ifdef __cplusplus +typedef struct D3DXMATRIX : public D3DMATRIX +{ +public: + D3DXMATRIX() {}; + D3DXMATRIX( CONST FLOAT * ); + D3DXMATRIX( CONST D3DMATRIX& ); + D3DXMATRIX( CONST D3DXFLOAT16 * ); + D3DXMATRIX( FLOAT _11, FLOAT _12, FLOAT _13, FLOAT _14, + FLOAT _21, FLOAT _22, FLOAT _23, FLOAT _24, + FLOAT _31, FLOAT _32, FLOAT _33, FLOAT _34, + FLOAT _41, FLOAT _42, FLOAT _43, FLOAT _44 ); + + + // access grants + FLOAT& operator () ( UINT Row, UINT Col ); + FLOAT operator () ( UINT Row, UINT Col ) const; + + // casting operators + operator FLOAT* (); + operator CONST FLOAT* () const; + + // assignment operators + D3DXMATRIX& operator *= ( CONST D3DXMATRIX& ); + D3DXMATRIX& operator += ( CONST D3DXMATRIX& ); + D3DXMATRIX& operator -= ( CONST D3DXMATRIX& ); + D3DXMATRIX& operator *= ( FLOAT ); + D3DXMATRIX& operator /= ( FLOAT ); + + // unary operators + D3DXMATRIX operator + () const; + D3DXMATRIX operator - () const; + + // binary operators + D3DXMATRIX operator * ( CONST D3DXMATRIX& ) const; + D3DXMATRIX operator + ( CONST D3DXMATRIX& ) const; + D3DXMATRIX operator - ( CONST D3DXMATRIX& ) const; + D3DXMATRIX operator * ( FLOAT ) const; + D3DXMATRIX operator / ( FLOAT ) const; + + friend D3DXMATRIX operator * ( FLOAT, CONST D3DXMATRIX& ); + + BOOL operator == ( CONST D3DXMATRIX& ) const; + BOOL operator != ( CONST D3DXMATRIX& ) const; + +} D3DXMATRIX, *LPD3DXMATRIX; + +#else //!__cplusplus +typedef struct _D3DMATRIX D3DXMATRIX, *LPD3DXMATRIX; +#endif //!__cplusplus + + +//--------------------------------------------------------------------------- +// Aligned Matrices +// +// This class helps keep matrices 16-byte aligned as preferred by P4 cpus. +// It aligns matrices on the stack and on the heap or in global scope. +// It does this using __declspec(align(16)) which works on VC7 and on VC 6 +// with the processor pack. Unfortunately there is no way to detect the +// latter so this is turned on only on VC7. On other compilers this is the +// the same as D3DXMATRIX. +// +// Using this class on a compiler that does not actually do the alignment +// can be dangerous since it will not expose bugs that ignore alignment. +// E.g if an object of this class in inside a struct or class, and some code +// memcopys data in it assuming tight packing. This could break on a compiler +// that eventually start aligning the matrix. +//--------------------------------------------------------------------------- +#ifdef __cplusplus +typedef struct _D3DXMATRIXA16 : public D3DXMATRIX +{ + _D3DXMATRIXA16() {}; + _D3DXMATRIXA16( CONST FLOAT * ); + _D3DXMATRIXA16( CONST D3DMATRIX& ); + _D3DXMATRIXA16( CONST D3DXFLOAT16 * ); + _D3DXMATRIXA16( FLOAT _11, FLOAT _12, FLOAT _13, FLOAT _14, + FLOAT _21, FLOAT _22, FLOAT _23, FLOAT _24, + FLOAT _31, FLOAT _32, FLOAT _33, FLOAT _34, + FLOAT _41, FLOAT _42, FLOAT _43, FLOAT _44 ); + + // new operators + void* operator new ( size_t ); + void* operator new[] ( size_t ); + + // delete operators + void operator delete ( void* ); // These are NOT virtual; Do not + void operator delete[] ( void* ); // cast to D3DXMATRIX and delete. + + // assignment operators + _D3DXMATRIXA16& operator = ( CONST D3DXMATRIX& ); + +} _D3DXMATRIXA16; + +#else //!__cplusplus +typedef D3DXMATRIX _D3DXMATRIXA16; +#endif //!__cplusplus + + + +#if _MSC_VER >= 1300 // VC7 +#define D3DX_ALIGN16 __declspec(align(16)) +#else +#define D3DX_ALIGN16 // Earlier compiler may not understand this, do nothing. +#endif + +typedef D3DX_ALIGN16 _D3DXMATRIXA16 D3DXMATRIXA16, *LPD3DXMATRIXA16; + + + +//=========================================================================== +// +// Quaternions +// +//=========================================================================== +typedef struct D3DXQUATERNION +{ +#ifdef __cplusplus +public: + D3DXQUATERNION() {}; + D3DXQUATERNION( CONST FLOAT * ); + D3DXQUATERNION( CONST D3DXFLOAT16 * ); + D3DXQUATERNION( FLOAT x, FLOAT y, FLOAT z, FLOAT w ); + + // casting + operator FLOAT* (); + operator CONST FLOAT* () const; + + // assignment operators + D3DXQUATERNION& operator += ( CONST D3DXQUATERNION& ); + D3DXQUATERNION& operator -= ( CONST D3DXQUATERNION& ); + D3DXQUATERNION& operator *= ( CONST D3DXQUATERNION& ); + D3DXQUATERNION& operator *= ( FLOAT ); + D3DXQUATERNION& operator /= ( FLOAT ); + + // unary operators + D3DXQUATERNION operator + () const; + D3DXQUATERNION operator - () const; + + // binary operators + D3DXQUATERNION operator + ( CONST D3DXQUATERNION& ) const; + D3DXQUATERNION operator - ( CONST D3DXQUATERNION& ) const; + D3DXQUATERNION operator * ( CONST D3DXQUATERNION& ) const; + D3DXQUATERNION operator * ( FLOAT ) const; + D3DXQUATERNION operator / ( FLOAT ) const; + + friend D3DXQUATERNION operator * (FLOAT, CONST D3DXQUATERNION& ); + + BOOL operator == ( CONST D3DXQUATERNION& ) const; + BOOL operator != ( CONST D3DXQUATERNION& ) const; + +#endif //__cplusplus + FLOAT x, y, z, w; +} D3DXQUATERNION, *LPD3DXQUATERNION; + + +//=========================================================================== +// +// Planes +// +//=========================================================================== +typedef struct D3DXPLANE +{ +#ifdef __cplusplus +public: + D3DXPLANE() {}; + D3DXPLANE( CONST FLOAT* ); + D3DXPLANE( CONST D3DXFLOAT16* ); + D3DXPLANE( FLOAT a, FLOAT b, FLOAT c, FLOAT d ); + + // casting + operator FLOAT* (); + operator CONST FLOAT* () const; + + // assignment operators + D3DXPLANE& operator *= ( FLOAT ); + D3DXPLANE& operator /= ( FLOAT ); + + // unary operators + D3DXPLANE operator + () const; + D3DXPLANE operator - () const; + + // binary operators + D3DXPLANE operator * ( FLOAT ) const; + D3DXPLANE operator / ( FLOAT ) const; + + friend D3DXPLANE operator * ( FLOAT, CONST D3DXPLANE& ); + + BOOL operator == ( CONST D3DXPLANE& ) const; + BOOL operator != ( CONST D3DXPLANE& ) const; + +#endif //__cplusplus + FLOAT a, b, c, d; +} D3DXPLANE, *LPD3DXPLANE; + + +//=========================================================================== +// +// Colors +// +//=========================================================================== + +typedef struct D3DXCOLOR +{ +#ifdef __cplusplus +public: + D3DXCOLOR() {}; + D3DXCOLOR( UINT argb ); + D3DXCOLOR( CONST FLOAT * ); + D3DXCOLOR( CONST D3DXFLOAT16 * ); + D3DXCOLOR( FLOAT r, FLOAT g, FLOAT b, FLOAT a ); + + // casting + operator UINT () const; + + operator FLOAT* (); + operator CONST FLOAT* () const; + + // assignment operators + D3DXCOLOR& operator += ( CONST D3DXCOLOR& ); + D3DXCOLOR& operator -= ( CONST D3DXCOLOR& ); + D3DXCOLOR& operator *= ( FLOAT ); + D3DXCOLOR& operator /= ( FLOAT ); + + // unary operators + D3DXCOLOR operator + () const; + D3DXCOLOR operator - () const; + + // binary operators + D3DXCOLOR operator + ( CONST D3DXCOLOR& ) const; + D3DXCOLOR operator - ( CONST D3DXCOLOR& ) const; + D3DXCOLOR operator * ( FLOAT ) const; + D3DXCOLOR operator / ( FLOAT ) const; + + friend D3DXCOLOR operator * ( FLOAT, CONST D3DXCOLOR& ); + + BOOL operator == ( CONST D3DXCOLOR& ) const; + BOOL operator != ( CONST D3DXCOLOR& ) const; + +#endif //__cplusplus + FLOAT r, g, b, a; +} D3DXCOLOR, *LPD3DXCOLOR; + + + +//=========================================================================== +// +// D3DX math functions: +// +// NOTE: +// * All these functions can take the same object as in and out parameters. +// +// * Out parameters are typically also returned as return values, so that +// the output of one function may be used as a parameter to another. +// +//=========================================================================== + +//-------------------------- +// Float16 +//-------------------------- + +// non-inline +#ifdef __cplusplus +extern "C" { +#endif + +// Converts an array 32-bit floats to 16-bit floats +D3DXFLOAT16* WINAPI D3DXFloat32To16Array + ( D3DXFLOAT16 *pOut, CONST FLOAT *pIn, UINT n ); + +// Converts an array 16-bit floats to 32-bit floats +FLOAT* WINAPI D3DXFloat16To32Array + ( __out_ecount(n) FLOAT *pOut, __in_ecount(n) CONST D3DXFLOAT16 *pIn, UINT n ); + +#ifdef __cplusplus +} +#endif + + +//-------------------------- +// 2D Vector +//-------------------------- + +// inline + +FLOAT D3DXVec2Length + ( CONST D3DXVECTOR2 *pV ); + +FLOAT D3DXVec2LengthSq + ( CONST D3DXVECTOR2 *pV ); + +FLOAT D3DXVec2Dot + ( CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ); + +// Z component of ((x1,y1,0) cross (x2,y2,0)) +FLOAT D3DXVec2CCW + ( CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ); + +D3DXVECTOR2* D3DXVec2Add + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ); + +D3DXVECTOR2* D3DXVec2Subtract + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ); + +// Minimize each component. x = min(x1, x2), y = min(y1, y2) +D3DXVECTOR2* D3DXVec2Minimize + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ); + +// Maximize each component. x = max(x1, x2), y = max(y1, y2) +D3DXVECTOR2* D3DXVec2Maximize + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ); + +D3DXVECTOR2* D3DXVec2Scale + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV, FLOAT s ); + +// Linear interpolation. V1 + s(V2-V1) +D3DXVECTOR2* D3DXVec2Lerp + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2, + FLOAT s ); + +// non-inline +#ifdef __cplusplus +extern "C" { +#endif + +D3DXVECTOR2* WINAPI D3DXVec2Normalize + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV ); + +// Hermite interpolation between position V1, tangent T1 (when s == 0) +// and position V2, tangent T2 (when s == 1). +D3DXVECTOR2* WINAPI D3DXVec2Hermite + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pT1, + CONST D3DXVECTOR2 *pV2, CONST D3DXVECTOR2 *pT2, FLOAT s ); + +// CatmullRom interpolation between V1 (when s == 0) and V2 (when s == 1) +D3DXVECTOR2* WINAPI D3DXVec2CatmullRom + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV0, CONST D3DXVECTOR2 *pV1, + CONST D3DXVECTOR2 *pV2, CONST D3DXVECTOR2 *pV3, FLOAT s ); + +// Barycentric coordinates. V1 + f(V2-V1) + g(V3-V1) +D3DXVECTOR2* WINAPI D3DXVec2BaryCentric + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2, + CONST D3DXVECTOR2 *pV3, FLOAT f, FLOAT g); + +// Transform (x, y, 0, 1) by matrix. +D3DXVECTOR4* WINAPI D3DXVec2Transform + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR2 *pV, CONST D3DXMATRIX *pM ); + +// Transform (x, y, 0, 1) by matrix, project result back into w=1. +D3DXVECTOR2* WINAPI D3DXVec2TransformCoord + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV, CONST D3DXMATRIX *pM ); + +// Transform (x, y, 0, 0) by matrix. +D3DXVECTOR2* WINAPI D3DXVec2TransformNormal + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV, CONST D3DXMATRIX *pM ); + +// Transform Array (x, y, 0, 1) by matrix. +D3DXVECTOR4* WINAPI D3DXVec2TransformArray + ( D3DXVECTOR4 *pOut, UINT OutStride, CONST D3DXVECTOR2 *pV, UINT VStride, CONST D3DXMATRIX *pM, UINT n); + +// Transform Array (x, y, 0, 1) by matrix, project result back into w=1. +D3DXVECTOR2* WINAPI D3DXVec2TransformCoordArray + ( D3DXVECTOR2 *pOut, UINT OutStride, CONST D3DXVECTOR2 *pV, UINT VStride, CONST D3DXMATRIX *pM, UINT n ); + +// Transform Array (x, y, 0, 0) by matrix. +D3DXVECTOR2* WINAPI D3DXVec2TransformNormalArray + ( D3DXVECTOR2 *pOut, UINT OutStride, CONST D3DXVECTOR2 *pV, UINT VStride, CONST D3DXMATRIX *pM, UINT n ); + + + +#ifdef __cplusplus +} +#endif + + +//-------------------------- +// 3D Vector +//-------------------------- + +// inline + +FLOAT D3DXVec3Length + ( CONST D3DXVECTOR3 *pV ); + +FLOAT D3DXVec3LengthSq + ( CONST D3DXVECTOR3 *pV ); + +FLOAT D3DXVec3Dot + ( CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ); + +D3DXVECTOR3* D3DXVec3Cross + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ); + +D3DXVECTOR3* D3DXVec3Add + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ); + +D3DXVECTOR3* D3DXVec3Subtract + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ); + +// Minimize each component. x = min(x1, x2), y = min(y1, y2), ... +D3DXVECTOR3* D3DXVec3Minimize + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ); + +// Maximize each component. x = max(x1, x2), y = max(y1, y2), ... +D3DXVECTOR3* D3DXVec3Maximize + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ); + +D3DXVECTOR3* D3DXVec3Scale + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV, FLOAT s); + +// Linear interpolation. V1 + s(V2-V1) +D3DXVECTOR3* D3DXVec3Lerp + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2, + FLOAT s ); + +// non-inline +#ifdef __cplusplus +extern "C" { +#endif + +D3DXVECTOR3* WINAPI D3DXVec3Normalize + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV ); + +// Hermite interpolation between position V1, tangent T1 (when s == 0) +// and position V2, tangent T2 (when s == 1). +D3DXVECTOR3* WINAPI D3DXVec3Hermite + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pT1, + CONST D3DXVECTOR3 *pV2, CONST D3DXVECTOR3 *pT2, FLOAT s ); + +// CatmullRom interpolation between V1 (when s == 0) and V2 (when s == 1) +D3DXVECTOR3* WINAPI D3DXVec3CatmullRom + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV0, CONST D3DXVECTOR3 *pV1, + CONST D3DXVECTOR3 *pV2, CONST D3DXVECTOR3 *pV3, FLOAT s ); + +// Barycentric coordinates. V1 + f(V2-V1) + g(V3-V1) +D3DXVECTOR3* WINAPI D3DXVec3BaryCentric + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2, + CONST D3DXVECTOR3 *pV3, FLOAT f, FLOAT g); + +// Transform (x, y, z, 1) by matrix. +D3DXVECTOR4* WINAPI D3DXVec3Transform + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR3 *pV, CONST D3DXMATRIX *pM ); + +// Transform (x, y, z, 1) by matrix, project result back into w=1. +D3DXVECTOR3* WINAPI D3DXVec3TransformCoord + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV, CONST D3DXMATRIX *pM ); + +// Transform (x, y, z, 0) by matrix. If you transforming a normal by a +// non-affine matrix, the matrix you pass to this function should be the +// transpose of the inverse of the matrix you would use to transform a coord. +D3DXVECTOR3* WINAPI D3DXVec3TransformNormal + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV, CONST D3DXMATRIX *pM ); + + +// Transform Array (x, y, z, 1) by matrix. +D3DXVECTOR4* WINAPI D3DXVec3TransformArray + ( D3DXVECTOR4 *pOut, UINT OutStride, CONST D3DXVECTOR3 *pV, UINT VStride, CONST D3DXMATRIX *pM, UINT n ); + +// Transform Array (x, y, z, 1) by matrix, project result back into w=1. +D3DXVECTOR3* WINAPI D3DXVec3TransformCoordArray + ( D3DXVECTOR3 *pOut, UINT OutStride, CONST D3DXVECTOR3 *pV, UINT VStride, CONST D3DXMATRIX *pM, UINT n ); + +// Transform (x, y, z, 0) by matrix. If you transforming a normal by a +// non-affine matrix, the matrix you pass to this function should be the +// transpose of the inverse of the matrix you would use to transform a coord. +D3DXVECTOR3* WINAPI D3DXVec3TransformNormalArray + ( D3DXVECTOR3 *pOut, UINT OutStride, CONST D3DXVECTOR3 *pV, UINT VStride, CONST D3DXMATRIX *pM, UINT n ); + +// Project vector from object space into screen space +D3DXVECTOR3* WINAPI D3DXVec3Project + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV, CONST D3D10_VIEWPORT *pViewport, + CONST D3DXMATRIX *pProjection, CONST D3DXMATRIX *pView, CONST D3DXMATRIX *pWorld); + +// Project vector from screen space into object space +D3DXVECTOR3* WINAPI D3DXVec3Unproject + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV, CONST D3D10_VIEWPORT *pViewport, + CONST D3DXMATRIX *pProjection, CONST D3DXMATRIX *pView, CONST D3DXMATRIX *pWorld); + +// Project vector Array from object space into screen space +D3DXVECTOR3* WINAPI D3DXVec3ProjectArray + ( D3DXVECTOR3 *pOut, UINT OutStride,CONST D3DXVECTOR3 *pV, UINT VStride,CONST D3D10_VIEWPORT *pViewport, + CONST D3DXMATRIX *pProjection, CONST D3DXMATRIX *pView, CONST D3DXMATRIX *pWorld, UINT n); + +// Project vector Array from screen space into object space +D3DXVECTOR3* WINAPI D3DXVec3UnprojectArray + ( D3DXVECTOR3 *pOut, UINT OutStride, CONST D3DXVECTOR3 *pV, UINT VStride, CONST D3D10_VIEWPORT *pViewport, + CONST D3DXMATRIX *pProjection, CONST D3DXMATRIX *pView, CONST D3DXMATRIX *pWorld, UINT n); + + +#ifdef __cplusplus +} +#endif + + + +//-------------------------- +// 4D Vector +//-------------------------- + +// inline + +FLOAT D3DXVec4Length + ( CONST D3DXVECTOR4 *pV ); + +FLOAT D3DXVec4LengthSq + ( CONST D3DXVECTOR4 *pV ); + +FLOAT D3DXVec4Dot + ( CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2 ); + +D3DXVECTOR4* D3DXVec4Add + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2); + +D3DXVECTOR4* D3DXVec4Subtract + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2); + +// Minimize each component. x = min(x1, x2), y = min(y1, y2), ... +D3DXVECTOR4* D3DXVec4Minimize + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2); + +// Maximize each component. x = max(x1, x2), y = max(y1, y2), ... +D3DXVECTOR4* D3DXVec4Maximize + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2); + +D3DXVECTOR4* D3DXVec4Scale + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV, FLOAT s); + +// Linear interpolation. V1 + s(V2-V1) +D3DXVECTOR4* D3DXVec4Lerp + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2, + FLOAT s ); + +// non-inline +#ifdef __cplusplus +extern "C" { +#endif + +// Cross-product in 4 dimensions. +D3DXVECTOR4* WINAPI D3DXVec4Cross + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2, + CONST D3DXVECTOR4 *pV3); + +D3DXVECTOR4* WINAPI D3DXVec4Normalize + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV ); + +// Hermite interpolation between position V1, tangent T1 (when s == 0) +// and position V2, tangent T2 (when s == 1). +D3DXVECTOR4* WINAPI D3DXVec4Hermite + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pT1, + CONST D3DXVECTOR4 *pV2, CONST D3DXVECTOR4 *pT2, FLOAT s ); + +// CatmullRom interpolation between V1 (when s == 0) and V2 (when s == 1) +D3DXVECTOR4* WINAPI D3DXVec4CatmullRom + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV0, CONST D3DXVECTOR4 *pV1, + CONST D3DXVECTOR4 *pV2, CONST D3DXVECTOR4 *pV3, FLOAT s ); + +// Barycentric coordinates. V1 + f(V2-V1) + g(V3-V1) +D3DXVECTOR4* WINAPI D3DXVec4BaryCentric + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2, + CONST D3DXVECTOR4 *pV3, FLOAT f, FLOAT g); + +// Transform vector by matrix. +D3DXVECTOR4* WINAPI D3DXVec4Transform + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV, CONST D3DXMATRIX *pM ); + +// Transform vector array by matrix. +D3DXVECTOR4* WINAPI D3DXVec4TransformArray + ( D3DXVECTOR4 *pOut, UINT OutStride, CONST D3DXVECTOR4 *pV, UINT VStride, CONST D3DXMATRIX *pM, UINT n ); + +#ifdef __cplusplus +} +#endif + + +//-------------------------- +// 4D Matrix +//-------------------------- + +// inline + +D3DXMATRIX* D3DXMatrixIdentity + ( D3DXMATRIX *pOut ); + +BOOL D3DXMatrixIsIdentity + ( CONST D3DXMATRIX *pM ); + + +// non-inline +#ifdef __cplusplus +extern "C" { +#endif + +FLOAT WINAPI D3DXMatrixDeterminant + ( CONST D3DXMATRIX *pM ); + +HRESULT WINAPI D3DXMatrixDecompose + ( D3DXVECTOR3 *pOutScale, D3DXQUATERNION *pOutRotation, + D3DXVECTOR3 *pOutTranslation, CONST D3DXMATRIX *pM ); + +D3DXMATRIX* WINAPI D3DXMatrixTranspose + ( D3DXMATRIX *pOut, CONST D3DXMATRIX *pM ); + +// Matrix multiplication. The result represents the transformation M2 +// followed by the transformation M1. (Out = M1 * M2) +D3DXMATRIX* WINAPI D3DXMatrixMultiply + ( D3DXMATRIX *pOut, CONST D3DXMATRIX *pM1, CONST D3DXMATRIX *pM2 ); + +// Matrix multiplication, followed by a transpose. (Out = T(M1 * M2)) +D3DXMATRIX* WINAPI D3DXMatrixMultiplyTranspose + ( D3DXMATRIX *pOut, CONST D3DXMATRIX *pM1, CONST D3DXMATRIX *pM2 ); + +// Calculate inverse of matrix. Inversion my fail, in which case NULL will +// be returned. The determinant of pM is also returned it pfDeterminant +// is non-NULL. +D3DXMATRIX* WINAPI D3DXMatrixInverse + ( D3DXMATRIX *pOut, FLOAT *pDeterminant, CONST D3DXMATRIX *pM ); + +// Build a matrix which scales by (sx, sy, sz) +D3DXMATRIX* WINAPI D3DXMatrixScaling + ( D3DXMATRIX *pOut, FLOAT sx, FLOAT sy, FLOAT sz ); + +// Build a matrix which translates by (x, y, z) +D3DXMATRIX* WINAPI D3DXMatrixTranslation + ( D3DXMATRIX *pOut, FLOAT x, FLOAT y, FLOAT z ); + +// Build a matrix which rotates around the X axis +D3DXMATRIX* WINAPI D3DXMatrixRotationX + ( D3DXMATRIX *pOut, FLOAT Angle ); + +// Build a matrix which rotates around the Y axis +D3DXMATRIX* WINAPI D3DXMatrixRotationY + ( D3DXMATRIX *pOut, FLOAT Angle ); + +// Build a matrix which rotates around the Z axis +D3DXMATRIX* WINAPI D3DXMatrixRotationZ + ( D3DXMATRIX *pOut, FLOAT Angle ); + +// Build a matrix which rotates around an arbitrary axis +D3DXMATRIX* WINAPI D3DXMatrixRotationAxis + ( D3DXMATRIX *pOut, CONST D3DXVECTOR3 *pV, FLOAT Angle ); + +// Build a matrix from a quaternion +D3DXMATRIX* WINAPI D3DXMatrixRotationQuaternion + ( D3DXMATRIX *pOut, CONST D3DXQUATERNION *pQ); + +// Yaw around the Y axis, a pitch around the X axis, +// and a roll around the Z axis. +D3DXMATRIX* WINAPI D3DXMatrixRotationYawPitchRoll + ( D3DXMATRIX *pOut, FLOAT Yaw, FLOAT Pitch, FLOAT Roll ); + +// Build transformation matrix. NULL arguments are treated as identity. +// Mout = Msc-1 * Msr-1 * Ms * Msr * Msc * Mrc-1 * Mr * Mrc * Mt +D3DXMATRIX* WINAPI D3DXMatrixTransformation + ( D3DXMATRIX *pOut, CONST D3DXVECTOR3 *pScalingCenter, + CONST D3DXQUATERNION *pScalingRotation, CONST D3DXVECTOR3 *pScaling, + CONST D3DXVECTOR3 *pRotationCenter, CONST D3DXQUATERNION *pRotation, + CONST D3DXVECTOR3 *pTranslation); + +// Build 2D transformation matrix in XY plane. NULL arguments are treated as identity. +// Mout = Msc-1 * Msr-1 * Ms * Msr * Msc * Mrc-1 * Mr * Mrc * Mt +D3DXMATRIX* WINAPI D3DXMatrixTransformation2D + ( D3DXMATRIX *pOut, CONST D3DXVECTOR2* pScalingCenter, + FLOAT ScalingRotation, CONST D3DXVECTOR2* pScaling, + CONST D3DXVECTOR2* pRotationCenter, FLOAT Rotation, + CONST D3DXVECTOR2* pTranslation); + +// Build affine transformation matrix. NULL arguments are treated as identity. +// Mout = Ms * Mrc-1 * Mr * Mrc * Mt +D3DXMATRIX* WINAPI D3DXMatrixAffineTransformation + ( D3DXMATRIX *pOut, FLOAT Scaling, CONST D3DXVECTOR3 *pRotationCenter, + CONST D3DXQUATERNION *pRotation, CONST D3DXVECTOR3 *pTranslation); + +// Build 2D affine transformation matrix in XY plane. NULL arguments are treated as identity. +// Mout = Ms * Mrc-1 * Mr * Mrc * Mt +D3DXMATRIX* WINAPI D3DXMatrixAffineTransformation2D + ( D3DXMATRIX *pOut, FLOAT Scaling, CONST D3DXVECTOR2* pRotationCenter, + FLOAT Rotation, CONST D3DXVECTOR2* pTranslation); + +// Build a lookat matrix. (right-handed) +D3DXMATRIX* WINAPI D3DXMatrixLookAtRH + ( D3DXMATRIX *pOut, CONST D3DXVECTOR3 *pEye, CONST D3DXVECTOR3 *pAt, + CONST D3DXVECTOR3 *pUp ); + +// Build a lookat matrix. (left-handed) +D3DXMATRIX* WINAPI D3DXMatrixLookAtLH + ( D3DXMATRIX *pOut, CONST D3DXVECTOR3 *pEye, CONST D3DXVECTOR3 *pAt, + CONST D3DXVECTOR3 *pUp ); + +// Build a perspective projection matrix. (right-handed) +D3DXMATRIX* WINAPI D3DXMatrixPerspectiveRH + ( D3DXMATRIX *pOut, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf ); + +// Build a perspective projection matrix. (left-handed) +D3DXMATRIX* WINAPI D3DXMatrixPerspectiveLH + ( D3DXMATRIX *pOut, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf ); + +// Build a perspective projection matrix. (right-handed) +D3DXMATRIX* WINAPI D3DXMatrixPerspectiveFovRH + ( D3DXMATRIX *pOut, FLOAT fovy, FLOAT Aspect, FLOAT zn, FLOAT zf ); + +// Build a perspective projection matrix. (left-handed) +D3DXMATRIX* WINAPI D3DXMatrixPerspectiveFovLH + ( D3DXMATRIX *pOut, FLOAT fovy, FLOAT Aspect, FLOAT zn, FLOAT zf ); + +// Build a perspective projection matrix. (right-handed) +D3DXMATRIX* WINAPI D3DXMatrixPerspectiveOffCenterRH + ( D3DXMATRIX *pOut, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, + FLOAT zf ); + +// Build a perspective projection matrix. (left-handed) +D3DXMATRIX* WINAPI D3DXMatrixPerspectiveOffCenterLH + ( D3DXMATRIX *pOut, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, + FLOAT zf ); + +// Build an ortho projection matrix. (right-handed) +D3DXMATRIX* WINAPI D3DXMatrixOrthoRH + ( D3DXMATRIX *pOut, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf ); + +// Build an ortho projection matrix. (left-handed) +D3DXMATRIX* WINAPI D3DXMatrixOrthoLH + ( D3DXMATRIX *pOut, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf ); + +// Build an ortho projection matrix. (right-handed) +D3DXMATRIX* WINAPI D3DXMatrixOrthoOffCenterRH + ( D3DXMATRIX *pOut, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, + FLOAT zf ); + +// Build an ortho projection matrix. (left-handed) +D3DXMATRIX* WINAPI D3DXMatrixOrthoOffCenterLH + ( D3DXMATRIX *pOut, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, + FLOAT zf ); + +// Build a matrix which flattens geometry into a plane, as if casting +// a shadow from a light. +D3DXMATRIX* WINAPI D3DXMatrixShadow + ( D3DXMATRIX *pOut, CONST D3DXVECTOR4 *pLight, + CONST D3DXPLANE *pPlane ); + +// Build a matrix which reflects the coordinate system about a plane +D3DXMATRIX* WINAPI D3DXMatrixReflect + ( D3DXMATRIX *pOut, CONST D3DXPLANE *pPlane ); + +#ifdef __cplusplus +} +#endif + + +//-------------------------- +// Quaternion +//-------------------------- + +// inline + +FLOAT D3DXQuaternionLength + ( CONST D3DXQUATERNION *pQ ); + +// Length squared, or "norm" +FLOAT D3DXQuaternionLengthSq + ( CONST D3DXQUATERNION *pQ ); + +FLOAT D3DXQuaternionDot + ( CONST D3DXQUATERNION *pQ1, CONST D3DXQUATERNION *pQ2 ); + +// (0, 0, 0, 1) +D3DXQUATERNION* D3DXQuaternionIdentity + ( D3DXQUATERNION *pOut ); + +BOOL D3DXQuaternionIsIdentity + ( CONST D3DXQUATERNION *pQ ); + +// (-x, -y, -z, w) +D3DXQUATERNION* D3DXQuaternionConjugate + ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ ); + + +// non-inline +#ifdef __cplusplus +extern "C" { +#endif + +// Compute a quaternin's axis and angle of rotation. Expects unit quaternions. +void WINAPI D3DXQuaternionToAxisAngle + ( CONST D3DXQUATERNION *pQ, D3DXVECTOR3 *pAxis, FLOAT *pAngle ); + +// Build a quaternion from a rotation matrix. +D3DXQUATERNION* WINAPI D3DXQuaternionRotationMatrix + ( D3DXQUATERNION *pOut, CONST D3DXMATRIX *pM); + +// Rotation about arbitrary axis. +D3DXQUATERNION* WINAPI D3DXQuaternionRotationAxis + ( D3DXQUATERNION *pOut, CONST D3DXVECTOR3 *pV, FLOAT Angle ); + +// Yaw around the Y axis, a pitch around the X axis, +// and a roll around the Z axis. +D3DXQUATERNION* WINAPI D3DXQuaternionRotationYawPitchRoll + ( D3DXQUATERNION *pOut, FLOAT Yaw, FLOAT Pitch, FLOAT Roll ); + +// Quaternion multiplication. The result represents the rotation Q2 +// followed by the rotation Q1. (Out = Q2 * Q1) +D3DXQUATERNION* WINAPI D3DXQuaternionMultiply + ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ1, + CONST D3DXQUATERNION *pQ2 ); + +D3DXQUATERNION* WINAPI D3DXQuaternionNormalize + ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ ); + +// Conjugate and re-norm +D3DXQUATERNION* WINAPI D3DXQuaternionInverse + ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ ); + +// Expects unit quaternions. +// if q = (cos(theta), sin(theta) * v); ln(q) = (0, theta * v) +D3DXQUATERNION* WINAPI D3DXQuaternionLn + ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ ); + +// Expects pure quaternions. (w == 0) w is ignored in calculation. +// if q = (0, theta * v); exp(q) = (cos(theta), sin(theta) * v) +D3DXQUATERNION* WINAPI D3DXQuaternionExp + ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ ); + +// Spherical linear interpolation between Q1 (t == 0) and Q2 (t == 1). +// Expects unit quaternions. +D3DXQUATERNION* WINAPI D3DXQuaternionSlerp + ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ1, + CONST D3DXQUATERNION *pQ2, FLOAT t ); + +// Spherical quadrangle interpolation. +// Slerp(Slerp(Q1, C, t), Slerp(A, B, t), 2t(1-t)) +D3DXQUATERNION* WINAPI D3DXQuaternionSquad + ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ1, + CONST D3DXQUATERNION *pA, CONST D3DXQUATERNION *pB, + CONST D3DXQUATERNION *pC, FLOAT t ); + +// Setup control points for spherical quadrangle interpolation +// from Q1 to Q2. The control points are chosen in such a way +// to ensure the continuity of tangents with adjacent segments. +void WINAPI D3DXQuaternionSquadSetup + ( D3DXQUATERNION *pAOut, D3DXQUATERNION *pBOut, D3DXQUATERNION *pCOut, + CONST D3DXQUATERNION *pQ0, CONST D3DXQUATERNION *pQ1, + CONST D3DXQUATERNION *pQ2, CONST D3DXQUATERNION *pQ3 ); + +// Barycentric interpolation. +// Slerp(Slerp(Q1, Q2, f+g), Slerp(Q1, Q3, f+g), g/(f+g)) +D3DXQUATERNION* WINAPI D3DXQuaternionBaryCentric + ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ1, + CONST D3DXQUATERNION *pQ2, CONST D3DXQUATERNION *pQ3, + FLOAT f, FLOAT g ); + +#ifdef __cplusplus +} +#endif + + +//-------------------------- +// Plane +//-------------------------- + +// inline + +// ax + by + cz + dw +FLOAT D3DXPlaneDot + ( CONST D3DXPLANE *pP, CONST D3DXVECTOR4 *pV); + +// ax + by + cz + d +FLOAT D3DXPlaneDotCoord + ( CONST D3DXPLANE *pP, CONST D3DXVECTOR3 *pV); + +// ax + by + cz +FLOAT D3DXPlaneDotNormal + ( CONST D3DXPLANE *pP, CONST D3DXVECTOR3 *pV); + +D3DXPLANE* D3DXPlaneScale + (D3DXPLANE *pOut, CONST D3DXPLANE *pP, FLOAT s); + +// non-inline +#ifdef __cplusplus +extern "C" { +#endif + +// Normalize plane (so that |a,b,c| == 1) +D3DXPLANE* WINAPI D3DXPlaneNormalize + ( D3DXPLANE *pOut, CONST D3DXPLANE *pP); + +// Find the intersection between a plane and a line. If the line is +// parallel to the plane, NULL is returned. +D3DXVECTOR3* WINAPI D3DXPlaneIntersectLine + ( D3DXVECTOR3 *pOut, CONST D3DXPLANE *pP, CONST D3DXVECTOR3 *pV1, + CONST D3DXVECTOR3 *pV2); + +// Construct a plane from a point and a normal +D3DXPLANE* WINAPI D3DXPlaneFromPointNormal + ( D3DXPLANE *pOut, CONST D3DXVECTOR3 *pPoint, CONST D3DXVECTOR3 *pNormal); + +// Construct a plane from 3 points +D3DXPLANE* WINAPI D3DXPlaneFromPoints + ( D3DXPLANE *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2, + CONST D3DXVECTOR3 *pV3); + +// Transform a plane by a matrix. The vector (a,b,c) must be normal. +// M should be the inverse transpose of the transformation desired. +D3DXPLANE* WINAPI D3DXPlaneTransform + ( D3DXPLANE *pOut, CONST D3DXPLANE *pP, CONST D3DXMATRIX *pM ); + +// Transform an array of planes by a matrix. The vectors (a,b,c) must be normal. +// M should be the inverse transpose of the transformation desired. +D3DXPLANE* WINAPI D3DXPlaneTransformArray + ( D3DXPLANE *pOut, UINT OutStride, CONST D3DXPLANE *pP, UINT PStride, CONST D3DXMATRIX *pM, UINT n ); + +#ifdef __cplusplus +} +#endif + + +//-------------------------- +// Color +//-------------------------- + +// inline + +// (1-r, 1-g, 1-b, a) +D3DXCOLOR* D3DXColorNegative + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC); + +D3DXCOLOR* D3DXColorAdd + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2); + +D3DXCOLOR* D3DXColorSubtract + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2); + +D3DXCOLOR* D3DXColorScale + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC, FLOAT s); + +// (r1*r2, g1*g2, b1*b2, a1*a2) +D3DXCOLOR* D3DXColorModulate + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2); + +// Linear interpolation of r,g,b, and a. C1 + s(C2-C1) +D3DXCOLOR* D3DXColorLerp + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2, FLOAT s); + +// non-inline +#ifdef __cplusplus +extern "C" { +#endif + +// Interpolate r,g,b between desaturated color and color. +// DesaturatedColor + s(Color - DesaturatedColor) +D3DXCOLOR* WINAPI D3DXColorAdjustSaturation + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC, FLOAT s); + +// Interpolate r,g,b between 50% grey and color. Grey + s(Color - Grey) +D3DXCOLOR* WINAPI D3DXColorAdjustContrast + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC, FLOAT c); + +#ifdef __cplusplus +} +#endif + + + + +//-------------------------- +// Misc +//-------------------------- + +#ifdef __cplusplus +extern "C" { +#endif + +// Calculate Fresnel term given the cosine of theta (likely obtained by +// taking the dot of two normals), and the refraction index of the material. +FLOAT WINAPI D3DXFresnelTerm + (FLOAT CosTheta, FLOAT RefractionIndex); + +#ifdef __cplusplus +} +#endif + + + +//=========================================================================== +// +// Matrix Stack +// +//=========================================================================== + +typedef interface ID3DXMatrixStack ID3DXMatrixStack; +typedef interface ID3DXMatrixStack *LPD3DXMATRIXSTACK; + +// {C7885BA7-F990-4fe7-922D-8515E477DD85} +DEFINE_GUID(IID_ID3DXMatrixStack, +0xc7885ba7, 0xf990, 0x4fe7, 0x92, 0x2d, 0x85, 0x15, 0xe4, 0x77, 0xdd, 0x85); + + +#undef INTERFACE +#define INTERFACE ID3DXMatrixStack + +DECLARE_INTERFACE_(ID3DXMatrixStack, IUnknown) +{ + // + // IUnknown methods + // + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + // + // ID3DXMatrixStack methods + // + + // Pops the top of the stack, returns the current top + // *after* popping the top. + STDMETHOD(Pop)(THIS) PURE; + + // Pushes the stack by one, duplicating the current matrix. + STDMETHOD(Push)(THIS) PURE; + + // Loads identity in the current matrix. + STDMETHOD(LoadIdentity)(THIS) PURE; + + // Loads the given matrix into the current matrix + STDMETHOD(LoadMatrix)(THIS_ CONST D3DXMATRIX* pM ) PURE; + + // Right-Multiplies the given matrix to the current matrix. + // (transformation is about the current world origin) + STDMETHOD(MultMatrix)(THIS_ CONST D3DXMATRIX* pM ) PURE; + + // Left-Multiplies the given matrix to the current matrix + // (transformation is about the local origin of the object) + STDMETHOD(MultMatrixLocal)(THIS_ CONST D3DXMATRIX* pM ) PURE; + + // Right multiply the current matrix with the computed rotation + // matrix, counterclockwise about the given axis with the given angle. + // (rotation is about the current world origin) + STDMETHOD(RotateAxis) + (THIS_ CONST D3DXVECTOR3* pV, FLOAT Angle) PURE; + + // Left multiply the current matrix with the computed rotation + // matrix, counterclockwise about the given axis with the given angle. + // (rotation is about the local origin of the object) + STDMETHOD(RotateAxisLocal) + (THIS_ CONST D3DXVECTOR3* pV, FLOAT Angle) PURE; + + // Right multiply the current matrix with the computed rotation + // matrix. All angles are counterclockwise. (rotation is about the + // current world origin) + + // The rotation is composed of a yaw around the Y axis, a pitch around + // the X axis, and a roll around the Z axis. + STDMETHOD(RotateYawPitchRoll) + (THIS_ FLOAT Yaw, FLOAT Pitch, FLOAT Roll) PURE; + + // Left multiply the current matrix with the computed rotation + // matrix. All angles are counterclockwise. (rotation is about the + // local origin of the object) + + // The rotation is composed of a yaw around the Y axis, a pitch around + // the X axis, and a roll around the Z axis. + STDMETHOD(RotateYawPitchRollLocal) + (THIS_ FLOAT Yaw, FLOAT Pitch, FLOAT Roll) PURE; + + // Right multiply the current matrix with the computed scale + // matrix. (transformation is about the current world origin) + STDMETHOD(Scale)(THIS_ FLOAT x, FLOAT y, FLOAT z) PURE; + + // Left multiply the current matrix with the computed scale + // matrix. (transformation is about the local origin of the object) + STDMETHOD(ScaleLocal)(THIS_ FLOAT x, FLOAT y, FLOAT z) PURE; + + // Right multiply the current matrix with the computed translation + // matrix. (transformation is about the current world origin) + STDMETHOD(Translate)(THIS_ FLOAT x, FLOAT y, FLOAT z ) PURE; + + // Left multiply the current matrix with the computed translation + // matrix. (transformation is about the local origin of the object) + STDMETHOD(TranslateLocal)(THIS_ FLOAT x, FLOAT y, FLOAT z) PURE; + + // Obtain the current matrix at the top of the stack + STDMETHOD_(D3DXMATRIX*, GetTop)(THIS) PURE; +}; + +#ifdef __cplusplus +extern "C" { +#endif + +HRESULT WINAPI + D3DXCreateMatrixStack( + UINT Flags, + LPD3DXMATRIXSTACK* ppStack); + +#ifdef __cplusplus +} +#endif + +// non-inline +#ifdef __cplusplus +extern "C" { +#endif + +//============================================================================ +// +// Basic Spherical Harmonic math routines +// +//============================================================================ + +#define D3DXSH_MINORDER 2 +#define D3DXSH_MAXORDER 6 + +//============================================================================ +// +// D3DXSHEvalDirection: +// -------------------- +// Evaluates the Spherical Harmonic basis functions +// +// Parameters: +// pOut +// Output SH coefficients - basis function Ylm is stored at l*l + m+l +// This is the pointer that is returned. +// Order +// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 +// pDir +// Direction to evaluate in - assumed to be normalized +// +//============================================================================ + +FLOAT* WINAPI D3DXSHEvalDirection + ( FLOAT *pOut, UINT Order, CONST D3DXVECTOR3 *pDir ); + +//============================================================================ +// +// D3DXSHRotate: +// -------------------- +// Rotates SH vector by a rotation matrix +// +// Parameters: +// pOut +// Output SH coefficients - basis function Ylm is stored at l*l + m+l +// This is the pointer that is returned (should not alias with pIn.) +// Order +// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 +// pMatrix +// Matrix used for rotation - rotation sub matrix should be orthogonal +// and have a unit determinant. +// pIn +// Input SH coeffs (rotated), incorect results if this is also output. +// +//============================================================================ + +FLOAT* WINAPI D3DXSHRotate + ( __out_ecount(Order*Order) FLOAT *pOut, UINT Order, CONST D3DXMATRIX *pMatrix, CONST FLOAT *pIn ); + +//============================================================================ +// +// D3DXSHRotateZ: +// -------------------- +// Rotates the SH vector in the Z axis by an angle +// +// Parameters: +// pOut +// Output SH coefficients - basis function Ylm is stored at l*l + m+l +// This is the pointer that is returned (should not alias with pIn.) +// Order +// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 +// Angle +// Angle in radians to rotate around the Z axis. +// pIn +// Input SH coeffs (rotated), incorect results if this is also output. +// +//============================================================================ + + +FLOAT* WINAPI D3DXSHRotateZ + ( FLOAT *pOut, UINT Order, FLOAT Angle, CONST FLOAT *pIn ); + +//============================================================================ +// +// D3DXSHAdd: +// -------------------- +// Adds two SH vectors, pOut[i] = pA[i] + pB[i]; +// +// Parameters: +// pOut +// Output SH coefficients - basis function Ylm is stored at l*l + m+l +// This is the pointer that is returned. +// Order +// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 +// pA +// Input SH coeffs. +// pB +// Input SH coeffs (second vector.) +// +//============================================================================ + +FLOAT* WINAPI D3DXSHAdd + ( __out_ecount(Order*Order) FLOAT *pOut, UINT Order, CONST FLOAT *pA, CONST FLOAT *pB ); + +//============================================================================ +// +// D3DXSHScale: +// -------------------- +// Adds two SH vectors, pOut[i] = pA[i]*Scale; +// +// Parameters: +// pOut +// Output SH coefficients - basis function Ylm is stored at l*l + m+l +// This is the pointer that is returned. +// Order +// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 +// pIn +// Input SH coeffs. +// Scale +// Scale factor. +// +//============================================================================ + +FLOAT* WINAPI D3DXSHScale + ( __out_ecount(Order*Order) FLOAT *pOut, UINT Order, CONST FLOAT *pIn, CONST FLOAT Scale ); + +//============================================================================ +// +// D3DXSHDot: +// -------------------- +// Computes the dot product of two SH vectors +// +// Parameters: +// Order +// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 +// pA +// Input SH coeffs. +// pB +// Second set of input SH coeffs. +// +//============================================================================ + +FLOAT WINAPI D3DXSHDot + ( UINT Order, CONST FLOAT *pA, CONST FLOAT *pB ); + +//============================================================================ +// +// D3DXSHMultiply[O]: +// -------------------- +// Computes the product of two functions represented using SH (f and g), where: +// pOut[i] = int(y_i(s) * f(s) * g(s)), where y_i(s) is the ith SH basis +// function, f(s) and g(s) are SH functions (sum_i(y_i(s)*c_i)). The order O +// determines the lengths of the arrays, where there should always be O^2 +// coefficients. In general the product of two SH functions of order O generates +// and SH function of order 2*O - 1, but we truncate the result. This means +// that the product commutes (f*g == g*f) but doesn't associate +// (f*(g*h) != (f*g)*h. +// +// Parameters: +// pOut +// Output SH coefficients - basis function Ylm is stored at l*l + m+l +// This is the pointer that is returned. +// pF +// Input SH coeffs for first function. +// pG +// Second set of input SH coeffs. +// +//============================================================================ + +__out_ecount(4) FLOAT* WINAPI D3DXSHMultiply2(__out_ecount(4) FLOAT *pOut,__in_ecount(4) CONST FLOAT *pF,__in_ecount(4) CONST FLOAT *pG); +__out_ecount(9) FLOAT* WINAPI D3DXSHMultiply3(__out_ecount(9) FLOAT *pOut,__in_ecount(9) CONST FLOAT *pF,__in_ecount(9) CONST FLOAT *pG); +__out_ecount(16) FLOAT* WINAPI D3DXSHMultiply4(__out_ecount(16) FLOAT *pOut,__in_ecount(16) CONST FLOAT *pF,__in_ecount(16) CONST FLOAT *pG); +__out_ecount(25) FLOAT* WINAPI D3DXSHMultiply5(__out_ecount(25) FLOAT *pOut,__in_ecount(25) CONST FLOAT *pF,__in_ecount(25) CONST FLOAT *pG); +__out_ecount(36) FLOAT* WINAPI D3DXSHMultiply6(__out_ecount(36) FLOAT *pOut,__in_ecount(36) CONST FLOAT *pF,__in_ecount(36) CONST FLOAT *pG); + + +//============================================================================ +// +// Basic Spherical Harmonic lighting routines +// +//============================================================================ + +//============================================================================ +// +// D3DXSHEvalDirectionalLight: +// -------------------- +// Evaluates a directional light and returns spectral SH data. The output +// vector is computed so that if the intensity of R/G/B is unit the resulting +// exit radiance of a point directly under the light on a diffuse object with +// an albedo of 1 would be 1.0. This will compute 3 spectral samples, pROut +// has to be specified, while pGout and pBout are optional. +// +// Parameters: +// Order +// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 +// pDir +// Direction light is coming from (assumed to be normalized.) +// RIntensity +// Red intensity of light. +// GIntensity +// Green intensity of light. +// BIntensity +// Blue intensity of light. +// pROut +// Output SH vector for Red. +// pGOut +// Output SH vector for Green (optional.) +// pBOut +// Output SH vector for Blue (optional.) +// +//============================================================================ + +HRESULT WINAPI D3DXSHEvalDirectionalLight + ( UINT Order, CONST D3DXVECTOR3 *pDir, + FLOAT RIntensity, FLOAT GIntensity, FLOAT BIntensity, + __out_ecount_opt(Order*Order) FLOAT *pROut, + __out_ecount_opt(Order*Order) FLOAT *pGOut, + __out_ecount_opt(Order*Order) FLOAT *pBOut ); + +//============================================================================ +// +// D3DXSHEvalSphericalLight: +// -------------------- +// Evaluates a spherical light and returns spectral SH data. There is no +// normalization of the intensity of the light like there is for directional +// lights, care has to be taken when specifiying the intensities. This will +// compute 3 spectral samples, pROut has to be specified, while pGout and +// pBout are optional. +// +// Parameters: +// Order +// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 +// pPos +// Position of light - reciever is assumed to be at the origin. +// Radius +// Radius of the spherical light source. +// RIntensity +// Red intensity of light. +// GIntensity +// Green intensity of light. +// BIntensity +// Blue intensity of light. +// pROut +// Output SH vector for Red. +// pGOut +// Output SH vector for Green (optional.) +// pBOut +// Output SH vector for Blue (optional.) +// +//============================================================================ + +HRESULT WINAPI D3DXSHEvalSphericalLight + ( UINT Order, CONST D3DXVECTOR3 *pPos, FLOAT Radius, + FLOAT RIntensity, FLOAT GIntensity, FLOAT BIntensity, + __out_ecount_opt(Order*Order) FLOAT *pROut, + __out_ecount_opt(Order*Order) FLOAT *pGOut, + __out_ecount_opt(Order*Order) FLOAT *pBOut ); + +//============================================================================ +// +// D3DXSHEvalConeLight: +// -------------------- +// Evaluates a light that is a cone of constant intensity and returns spectral +// SH data. The output vector is computed so that if the intensity of R/G/B is +// unit the resulting exit radiance of a point directly under the light oriented +// in the cone direction on a diffuse object with an albedo of 1 would be 1.0. +// This will compute 3 spectral samples, pROut has to be specified, while pGout +// and pBout are optional. +// +// Parameters: +// Order +// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 +// pDir +// Direction light is coming from (assumed to be normalized.) +// Radius +// Radius of cone in radians. +// RIntensity +// Red intensity of light. +// GIntensity +// Green intensity of light. +// BIntensity +// Blue intensity of light. +// pROut +// Output SH vector for Red. +// pGOut +// Output SH vector for Green (optional.) +// pBOut +// Output SH vector for Blue (optional.) +// +//============================================================================ + +HRESULT WINAPI D3DXSHEvalConeLight + ( UINT Order, CONST D3DXVECTOR3 *pDir, FLOAT Radius, + FLOAT RIntensity, FLOAT GIntensity, FLOAT BIntensity, + __out_ecount_opt(Order*Order) FLOAT *pROut, + __out_ecount_opt(Order*Order) FLOAT *pGOut, + __out_ecount_opt(Order*Order) FLOAT *pBOut ); + +//============================================================================ +// +// D3DXSHEvalHemisphereLight: +// -------------------- +// Evaluates a light that is a linear interpolant between two colors over the +// sphere. The interpolant is linear along the axis of the two points, not +// over the surface of the sphere (ie: if the axis was (0,0,1) it is linear in +// Z, not in the azimuthal angle.) The resulting spherical lighting function +// is normalized so that a point on a perfectly diffuse surface with no +// shadowing and a normal pointed in the direction pDir would result in exit +// radiance with a value of 1 if the top color was white and the bottom color +// was black. This is a very simple model where Top represents the intensity +// of the "sky" and Bottom represents the intensity of the "ground". +// +// Parameters: +// Order +// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 +// pDir +// Axis of the hemisphere. +// Top +// Color of the upper hemisphere. +// Bottom +// Color of the lower hemisphere. +// pROut +// Output SH vector for Red. +// pGOut +// Output SH vector for Green +// pBOut +// Output SH vector for Blue +// +//============================================================================ + +HRESULT WINAPI D3DXSHEvalHemisphereLight + ( UINT Order, CONST D3DXVECTOR3 *pDir, D3DXCOLOR Top, D3DXCOLOR Bottom, + __out_ecount_opt(Order*Order) FLOAT *pROut, + __out_ecount_opt(Order*Order) FLOAT *pGOut, + __out_ecount_opt(Order*Order) FLOAT *pBOut ); + +// Math intersection functions + +BOOL WINAPI D3DXIntersectTri +( + CONST D3DXVECTOR3 *p0, // Triangle vertex 0 position + CONST D3DXVECTOR3 *p1, // Triangle vertex 1 position + CONST D3DXVECTOR3 *p2, // Triangle vertex 2 position + CONST D3DXVECTOR3 *pRayPos, // Ray origin + CONST D3DXVECTOR3 *pRayDir, // Ray direction + FLOAT *pU, // Barycentric Hit Coordinates + FLOAT *pV, // Barycentric Hit Coordinates + FLOAT *pDist); // Ray-Intersection Parameter Distance + +BOOL WINAPI + D3DXSphereBoundProbe( + CONST D3DXVECTOR3 *pCenter, + FLOAT Radius, + CONST D3DXVECTOR3 *pRayPosition, + CONST D3DXVECTOR3 *pRayDirection); + +BOOL WINAPI + D3DXBoxBoundProbe( + CONST D3DXVECTOR3 *pMin, + CONST D3DXVECTOR3 *pMax, + CONST D3DXVECTOR3 *pRayPosition, + CONST D3DXVECTOR3 *pRayDirection); + +HRESULT WINAPI + D3DXComputeBoundingSphere( + CONST D3DXVECTOR3 *pFirstPosition, // pointer to first position + DWORD NumVertices, + DWORD dwStride, // count in bytes to subsequent position vectors + D3DXVECTOR3 *pCenter, + FLOAT *pRadius); + +HRESULT WINAPI + D3DXComputeBoundingBox( + CONST D3DXVECTOR3 *pFirstPosition, // pointer to first position + DWORD NumVertices, + DWORD dwStride, // count in bytes to subsequent position vectors + D3DXVECTOR3 *pMin, + D3DXVECTOR3 *pMax); + + +/////////////////////////////////////////////////////////////////////////// +// CPU Optimization: +/////////////////////////////////////////////////////////////////////////// + +//------------------------------------------------------------------------- +// D3DX_CPU_OPTIMIZATION flags: +// ---------------------------- +// D3DX_NOT_OPTIMIZED Use Intel Pentium optimizations +// D3DX_3DNOW_OPTIMIZED Use AMD 3DNow optimizations +// D3DX_SSE_OPTIMIZED Use Intel Pentium III SSE optimizations +// D3DX_SSE2_OPTIMIZED Use Intel Pentium IV SSE2 optimizations +//------------------------------------------------------------------------- + + +typedef enum _D3DX_CPU_OPTIMIZATION +{ + D3DX_NOT_OPTIMIZED = 0, + D3DX_3DNOW_OPTIMIZED, + D3DX_SSE2_OPTIMIZED, + D3DX_SSE_OPTIMIZED +} D3DX_CPU_OPTIMIZATION; + + +//------------------------------------------------------------------------- +// D3DXCpuOptimizations: +// --------------------- +// Enables or disables CPU optimizations. Returns the type of CPU, which +// was detected, and for which optimizations exist. +// +// Parameters: +// Enable +// TRUE to enable CPU optimizations. FALSE to disable. +//------------------------------------------------------------------------- + +D3DX_CPU_OPTIMIZATION WINAPI + D3DXCpuOptimizations(BOOL Enable); + +#ifdef __cplusplus +} +#endif + + +#include "D3DX10math.inl" + +#if _MSC_VER >= 1200 +#pragma warning(pop) +#else +#pragma warning(default:4201) +#endif + +#endif // __D3DX9MATH_H__ + diff --git a/MediaClient/MediaClient/directx/include/D3DX10math.inl b/MediaClient/MediaClient/directx/include/D3DX10math.inl new file mode 100644 index 0000000..56f1163 --- /dev/null +++ b/MediaClient/MediaClient/directx/include/D3DX10math.inl @@ -0,0 +1,2228 @@ +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx10math.inl +// Content: D3DX10 math inline functions +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef __D3DXMATH_INL__ +#define __D3DXMATH_INL__ + + +//=========================================================================== +// +// Inline Class Methods +// +//=========================================================================== + +#ifdef __cplusplus + +//-------------------------- +// Float16 +//-------------------------- + +D3DX10INLINE +D3DXFLOAT16::D3DXFLOAT16( FLOAT f ) +{ + D3DXFloat32To16Array(this, &f, 1); +} + +D3DX10INLINE +D3DXFLOAT16::D3DXFLOAT16( CONST D3DXFLOAT16& f ) +{ + value = f.value; +} + +// casting +D3DX10INLINE +D3DXFLOAT16::operator FLOAT () +{ + FLOAT f; + D3DXFloat16To32Array(&f, this, 1); + return f; +} + +// binary operators +D3DX10INLINE BOOL +D3DXFLOAT16::operator == ( CONST D3DXFLOAT16& f ) const +{ + // At least one is NaN + if(((value & D3DX_16F_EXP_MASK) == D3DX_16F_EXP_MASK && (value & D3DX_16F_FRAC_MASK)) + || ((f.value & D3DX_16F_EXP_MASK) == D3DX_16F_EXP_MASK && (f.value & D3DX_16F_FRAC_MASK))) + return false; + // +/- Zero + else if((value & ~D3DX_16F_SIGN_MASK) == 0 && (f.value & ~D3DX_16F_SIGN_MASK) == 0) + return true; + else + return value == f.value; +} + +D3DX10INLINE BOOL +D3DXFLOAT16::operator != ( CONST D3DXFLOAT16& f ) const +{ + // At least one is NaN + if(((value & D3DX_16F_EXP_MASK) == D3DX_16F_EXP_MASK && (value & D3DX_16F_FRAC_MASK)) + || ((f.value & D3DX_16F_EXP_MASK) == D3DX_16F_EXP_MASK && (f.value & D3DX_16F_FRAC_MASK))) + return true; + // +/- Zero + else if((value & ~D3DX_16F_SIGN_MASK) == 0 && (f.value & ~D3DX_16F_SIGN_MASK) == 0) + return false; + else + return value != f.value; +} + + +//-------------------------- +// 2D Vector +//-------------------------- + +D3DX10INLINE +D3DXVECTOR2::D3DXVECTOR2( CONST FLOAT *pf ) +{ +#ifdef D3DX10_DEBUG + if(!pf) + return; +#endif + + x = pf[0]; + y = pf[1]; +} + +D3DX10INLINE +D3DXVECTOR2::D3DXVECTOR2( CONST D3DXFLOAT16 *pf ) +{ +#ifdef D3DX10_DEBUG + if(!pf) + return; +#endif + + D3DXFloat16To32Array(&x, pf, 2); +} + +D3DX10INLINE +D3DXVECTOR2::D3DXVECTOR2( FLOAT fx, FLOAT fy ) +{ + x = fx; + y = fy; +} + + +// casting +D3DX10INLINE +D3DXVECTOR2::operator FLOAT* () +{ + return (FLOAT *) &x; +} + +D3DX10INLINE +D3DXVECTOR2::operator CONST FLOAT* () const +{ + return (CONST FLOAT *) &x; +} + + +// assignment operators +D3DX10INLINE D3DXVECTOR2& +D3DXVECTOR2::operator += ( CONST D3DXVECTOR2& v ) +{ + x += v.x; + y += v.y; + return *this; +} + +D3DX10INLINE D3DXVECTOR2& +D3DXVECTOR2::operator -= ( CONST D3DXVECTOR2& v ) +{ + x -= v.x; + y -= v.y; + return *this; +} + +D3DX10INLINE D3DXVECTOR2& +D3DXVECTOR2::operator *= ( FLOAT f ) +{ + x *= f; + y *= f; + return *this; +} + +D3DX10INLINE D3DXVECTOR2& +D3DXVECTOR2::operator /= ( FLOAT f ) +{ + FLOAT fInv = 1.0f / f; + x *= fInv; + y *= fInv; + return *this; +} + + +// unary operators +D3DX10INLINE D3DXVECTOR2 +D3DXVECTOR2::operator + () const +{ + return *this; +} + +D3DX10INLINE D3DXVECTOR2 +D3DXVECTOR2::operator - () const +{ + return D3DXVECTOR2(-x, -y); +} + + +// binary operators +D3DX10INLINE D3DXVECTOR2 +D3DXVECTOR2::operator + ( CONST D3DXVECTOR2& v ) const +{ + return D3DXVECTOR2(x + v.x, y + v.y); +} + +D3DX10INLINE D3DXVECTOR2 +D3DXVECTOR2::operator - ( CONST D3DXVECTOR2& v ) const +{ + return D3DXVECTOR2(x - v.x, y - v.y); +} + +D3DX10INLINE D3DXVECTOR2 +D3DXVECTOR2::operator * ( FLOAT f ) const +{ + return D3DXVECTOR2(x * f, y * f); +} + +D3DX10INLINE D3DXVECTOR2 +D3DXVECTOR2::operator / ( FLOAT f ) const +{ + FLOAT fInv = 1.0f / f; + return D3DXVECTOR2(x * fInv, y * fInv); +} + +D3DX10INLINE D3DXVECTOR2 +operator * ( FLOAT f, CONST D3DXVECTOR2& v ) +{ + return D3DXVECTOR2(f * v.x, f * v.y); +} + +D3DX10INLINE BOOL +D3DXVECTOR2::operator == ( CONST D3DXVECTOR2& v ) const +{ + return x == v.x && y == v.y; +} + +D3DX10INLINE BOOL +D3DXVECTOR2::operator != ( CONST D3DXVECTOR2& v ) const +{ + return x != v.x || y != v.y; +} + + + +//-------------------------- +// 2D Vector (16 bit) +//-------------------------- + +D3DX10INLINE +D3DXVECTOR2_16F::D3DXVECTOR2_16F( CONST FLOAT *pf ) +{ +#ifdef D3DX10_DEBUG + if(!pf) + return; +#endif + + D3DXFloat32To16Array(&x, pf, 2); +} + +D3DX10INLINE +D3DXVECTOR2_16F::D3DXVECTOR2_16F( CONST D3DXFLOAT16 *pf ) +{ +#ifdef D3DX10_DEBUG + if(!pf) + return; +#endif + + *((UINT *) &x) = *((UINT *) &pf[0]); +} + +D3DX10INLINE +D3DXVECTOR2_16F::D3DXVECTOR2_16F( CONST D3DXFLOAT16 &fx, CONST D3DXFLOAT16 &fy ) +{ + x = fx; + y = fy; +} + + +// casting +D3DX10INLINE +D3DXVECTOR2_16F::operator D3DXFLOAT16* () +{ + return (D3DXFLOAT16*) &x; +} + +D3DX10INLINE +D3DXVECTOR2_16F::operator CONST D3DXFLOAT16* () const +{ + return (CONST D3DXFLOAT16*) &x; +} + + +// binary operators +D3DX10INLINE BOOL +D3DXVECTOR2_16F::operator == ( CONST D3DXVECTOR2_16F &v ) const +{ + return x == v.x && y == v.y; +} + +D3DX10INLINE BOOL +D3DXVECTOR2_16F::operator != ( CONST D3DXVECTOR2_16F &v ) const +{ + return x != v.x || y != v.y; +} + + +//-------------------------- +// 3D Vector +//-------------------------- +D3DX10INLINE +D3DXVECTOR3::D3DXVECTOR3( CONST FLOAT *pf ) +{ +#ifdef D3DX10_DEBUG + if(!pf) + return; +#endif + + x = pf[0]; + y = pf[1]; + z = pf[2]; +} + +D3DX10INLINE +D3DXVECTOR3::D3DXVECTOR3( CONST D3DVECTOR& v ) +{ + x = v.x; + y = v.y; + z = v.z; +} + +D3DX10INLINE +D3DXVECTOR3::D3DXVECTOR3( CONST D3DXFLOAT16 *pf ) +{ +#ifdef D3DX10_DEBUG + if(!pf) + return; +#endif + + D3DXFloat16To32Array(&x, pf, 3); +} + +D3DX10INLINE +D3DXVECTOR3::D3DXVECTOR3( FLOAT fx, FLOAT fy, FLOAT fz ) +{ + x = fx; + y = fy; + z = fz; +} + + +// casting +D3DX10INLINE +D3DXVECTOR3::operator FLOAT* () +{ + return (FLOAT *) &x; +} + +D3DX10INLINE +D3DXVECTOR3::operator CONST FLOAT* () const +{ + return (CONST FLOAT *) &x; +} + + +// assignment operators +D3DX10INLINE D3DXVECTOR3& +D3DXVECTOR3::operator += ( CONST D3DXVECTOR3& v ) +{ + x += v.x; + y += v.y; + z += v.z; + return *this; +} + +D3DX10INLINE D3DXVECTOR3& +D3DXVECTOR3::operator -= ( CONST D3DXVECTOR3& v ) +{ + x -= v.x; + y -= v.y; + z -= v.z; + return *this; +} + +D3DX10INLINE D3DXVECTOR3& +D3DXVECTOR3::operator *= ( FLOAT f ) +{ + x *= f; + y *= f; + z *= f; + return *this; +} + +D3DX10INLINE D3DXVECTOR3& +D3DXVECTOR3::operator /= ( FLOAT f ) +{ + FLOAT fInv = 1.0f / f; + x *= fInv; + y *= fInv; + z *= fInv; + return *this; +} + + +// unary operators +D3DX10INLINE D3DXVECTOR3 +D3DXVECTOR3::operator + () const +{ + return *this; +} + +D3DX10INLINE D3DXVECTOR3 +D3DXVECTOR3::operator - () const +{ + return D3DXVECTOR3(-x, -y, -z); +} + + +// binary operators +D3DX10INLINE D3DXVECTOR3 +D3DXVECTOR3::operator + ( CONST D3DXVECTOR3& v ) const +{ + return D3DXVECTOR3(x + v.x, y + v.y, z + v.z); +} + +D3DX10INLINE D3DXVECTOR3 +D3DXVECTOR3::operator - ( CONST D3DXVECTOR3& v ) const +{ + return D3DXVECTOR3(x - v.x, y - v.y, z - v.z); +} + +D3DX10INLINE D3DXVECTOR3 +D3DXVECTOR3::operator * ( FLOAT f ) const +{ + return D3DXVECTOR3(x * f, y * f, z * f); +} + +D3DX10INLINE D3DXVECTOR3 +D3DXVECTOR3::operator / ( FLOAT f ) const +{ + FLOAT fInv = 1.0f / f; + return D3DXVECTOR3(x * fInv, y * fInv, z * fInv); +} + + +D3DX10INLINE D3DXVECTOR3 +operator * ( FLOAT f, CONST struct D3DXVECTOR3& v ) +{ + return D3DXVECTOR3(f * v.x, f * v.y, f * v.z); +} + + +D3DX10INLINE BOOL +D3DXVECTOR3::operator == ( CONST D3DXVECTOR3& v ) const +{ + return x == v.x && y == v.y && z == v.z; +} + +D3DX10INLINE BOOL +D3DXVECTOR3::operator != ( CONST D3DXVECTOR3& v ) const +{ + return x != v.x || y != v.y || z != v.z; +} + + + +//-------------------------- +// 3D Vector (16 bit) +//-------------------------- + +D3DX10INLINE +D3DXVECTOR3_16F::D3DXVECTOR3_16F( CONST FLOAT *pf ) +{ +#ifdef D3DX10_DEBUG + if(!pf) + return; +#endif + + D3DXFloat32To16Array(&x, pf, 3); +} + +D3DX10INLINE +D3DXVECTOR3_16F::D3DXVECTOR3_16F( CONST D3DVECTOR& v ) +{ + D3DXFloat32To16Array(&x, &v.x, 1); + D3DXFloat32To16Array(&y, &v.y, 1); + D3DXFloat32To16Array(&z, &v.z, 1); +} + +D3DX10INLINE +D3DXVECTOR3_16F::D3DXVECTOR3_16F( CONST D3DXFLOAT16 *pf ) +{ +#ifdef D3DX10_DEBUG + if(!pf) + return; +#endif + + *((UINT *) &x) = *((UINT *) &pf[0]); + *((WORD *) &z) = *((WORD *) &pf[2]); +} + +D3DX10INLINE +D3DXVECTOR3_16F::D3DXVECTOR3_16F( CONST D3DXFLOAT16 &fx, CONST D3DXFLOAT16 &fy, CONST D3DXFLOAT16 &fz ) +{ + x = fx; + y = fy; + z = fz; +} + + +// casting +D3DX10INLINE +D3DXVECTOR3_16F::operator D3DXFLOAT16* () +{ + return (D3DXFLOAT16*) &x; +} + +D3DX10INLINE +D3DXVECTOR3_16F::operator CONST D3DXFLOAT16* () const +{ + return (CONST D3DXFLOAT16*) &x; +} + + +// binary operators +D3DX10INLINE BOOL +D3DXVECTOR3_16F::operator == ( CONST D3DXVECTOR3_16F &v ) const +{ + return x == v.x && y == v.y && z == v.z; +} + +D3DX10INLINE BOOL +D3DXVECTOR3_16F::operator != ( CONST D3DXVECTOR3_16F &v ) const +{ + return x != v.x || y != v.y || z != v.z; +} + + +//-------------------------- +// 4D Vector +//-------------------------- +D3DX10INLINE +D3DXVECTOR4::D3DXVECTOR4( CONST FLOAT *pf ) +{ +#ifdef D3DX10_DEBUG + if(!pf) + return; +#endif + + x = pf[0]; + y = pf[1]; + z = pf[2]; + w = pf[3]; +} + +D3DX10INLINE +D3DXVECTOR4::D3DXVECTOR4( CONST D3DXFLOAT16 *pf ) +{ +#ifdef D3DX10_DEBUG + if(!pf) + return; +#endif + + D3DXFloat16To32Array(&x, pf, 4); +} + +D3DX10INLINE +D3DXVECTOR4::D3DXVECTOR4( CONST D3DVECTOR& v, FLOAT f ) +{ + x = v.x; + y = v.y; + z = v.z; + w = f; +} + +D3DX10INLINE +D3DXVECTOR4::D3DXVECTOR4( FLOAT fx, FLOAT fy, FLOAT fz, FLOAT fw ) +{ + x = fx; + y = fy; + z = fz; + w = fw; +} + + +// casting +D3DX10INLINE +D3DXVECTOR4::operator FLOAT* () +{ + return (FLOAT *) &x; +} + +D3DX10INLINE +D3DXVECTOR4::operator CONST FLOAT* () const +{ + return (CONST FLOAT *) &x; +} + + +// assignment operators +D3DX10INLINE D3DXVECTOR4& +D3DXVECTOR4::operator += ( CONST D3DXVECTOR4& v ) +{ + x += v.x; + y += v.y; + z += v.z; + w += v.w; + return *this; +} + +D3DX10INLINE D3DXVECTOR4& +D3DXVECTOR4::operator -= ( CONST D3DXVECTOR4& v ) +{ + x -= v.x; + y -= v.y; + z -= v.z; + w -= v.w; + return *this; +} + +D3DX10INLINE D3DXVECTOR4& +D3DXVECTOR4::operator *= ( FLOAT f ) +{ + x *= f; + y *= f; + z *= f; + w *= f; + return *this; +} + +D3DX10INLINE D3DXVECTOR4& +D3DXVECTOR4::operator /= ( FLOAT f ) +{ + FLOAT fInv = 1.0f / f; + x *= fInv; + y *= fInv; + z *= fInv; + w *= fInv; + return *this; +} + + +// unary operators +D3DX10INLINE D3DXVECTOR4 +D3DXVECTOR4::operator + () const +{ + return *this; +} + +D3DX10INLINE D3DXVECTOR4 +D3DXVECTOR4::operator - () const +{ + return D3DXVECTOR4(-x, -y, -z, -w); +} + + +// binary operators +D3DX10INLINE D3DXVECTOR4 +D3DXVECTOR4::operator + ( CONST D3DXVECTOR4& v ) const +{ + return D3DXVECTOR4(x + v.x, y + v.y, z + v.z, w + v.w); +} + +D3DX10INLINE D3DXVECTOR4 +D3DXVECTOR4::operator - ( CONST D3DXVECTOR4& v ) const +{ + return D3DXVECTOR4(x - v.x, y - v.y, z - v.z, w - v.w); +} + +D3DX10INLINE D3DXVECTOR4 +D3DXVECTOR4::operator * ( FLOAT f ) const +{ + return D3DXVECTOR4(x * f, y * f, z * f, w * f); +} + +D3DX10INLINE D3DXVECTOR4 +D3DXVECTOR4::operator / ( FLOAT f ) const +{ + FLOAT fInv = 1.0f / f; + return D3DXVECTOR4(x * fInv, y * fInv, z * fInv, w * fInv); +} + +D3DX10INLINE D3DXVECTOR4 +operator * ( FLOAT f, CONST D3DXVECTOR4& v ) +{ + return D3DXVECTOR4(f * v.x, f * v.y, f * v.z, f * v.w); +} + + +D3DX10INLINE BOOL +D3DXVECTOR4::operator == ( CONST D3DXVECTOR4& v ) const +{ + return x == v.x && y == v.y && z == v.z && w == v.w; +} + +D3DX10INLINE BOOL +D3DXVECTOR4::operator != ( CONST D3DXVECTOR4& v ) const +{ + return x != v.x || y != v.y || z != v.z || w != v.w; +} + + + +//-------------------------- +// 4D Vector (16 bit) +//-------------------------- + +D3DX10INLINE +D3DXVECTOR4_16F::D3DXVECTOR4_16F( CONST FLOAT *pf ) +{ +#ifdef D3DX10_DEBUG + if(!pf) + return; +#endif + + D3DXFloat32To16Array(&x, pf, 4); +} + +D3DX10INLINE +D3DXVECTOR4_16F::D3DXVECTOR4_16F( CONST D3DXFLOAT16 *pf ) +{ +#ifdef D3DX10_DEBUG + if(!pf) + return; +#endif + + *((UINT *) &x) = *((UINT *) &pf[0]); + *((UINT *) &z) = *((UINT *) &pf[2]); +} + +D3DX10INLINE +D3DXVECTOR4_16F::D3DXVECTOR4_16F( CONST D3DXVECTOR3_16F& v, CONST D3DXFLOAT16& f ) +{ + x = v.x; + y = v.y; + z = v.z; + w = f; +} + +D3DX10INLINE +D3DXVECTOR4_16F::D3DXVECTOR4_16F( CONST D3DXFLOAT16 &fx, CONST D3DXFLOAT16 &fy, CONST D3DXFLOAT16 &fz, CONST D3DXFLOAT16 &fw ) +{ + x = fx; + y = fy; + z = fz; + w = fw; +} + + +// casting +D3DX10INLINE +D3DXVECTOR4_16F::operator D3DXFLOAT16* () +{ + return (D3DXFLOAT16*) &x; +} + +D3DX10INLINE +D3DXVECTOR4_16F::operator CONST D3DXFLOAT16* () const +{ + return (CONST D3DXFLOAT16*) &x; +} + + +// binary operators +D3DX10INLINE BOOL +D3DXVECTOR4_16F::operator == ( CONST D3DXVECTOR4_16F &v ) const +{ + return x == v.x && y == v.y && z == v.z && w == v.w; +} + +D3DX10INLINE BOOL +D3DXVECTOR4_16F::operator != ( CONST D3DXVECTOR4_16F &v ) const +{ + return x != v.x || y != v.y || z != v.z || w != v.w; +} + + +//-------------------------- +// Matrix +//-------------------------- +D3DX10INLINE +D3DXMATRIX::D3DXMATRIX( CONST FLOAT* pf ) +{ +#ifdef D3DX10_DEBUG + if(!pf) + return; +#endif + + memcpy(&_11, pf, sizeof(D3DXMATRIX)); +} + +D3DX10INLINE +D3DXMATRIX::D3DXMATRIX( CONST D3DMATRIX& mat ) +{ + memcpy(&_11, &mat, sizeof(D3DXMATRIX)); +} + +D3DX10INLINE +D3DXMATRIX::D3DXMATRIX( CONST D3DXFLOAT16* pf ) +{ +#ifdef D3DX10_DEBUG + if(!pf) + return; +#endif + + D3DXFloat16To32Array(&_11, pf, 16); +} + +D3DX10INLINE +D3DXMATRIX::D3DXMATRIX( FLOAT f11, FLOAT f12, FLOAT f13, FLOAT f14, + FLOAT f21, FLOAT f22, FLOAT f23, FLOAT f24, + FLOAT f31, FLOAT f32, FLOAT f33, FLOAT f34, + FLOAT f41, FLOAT f42, FLOAT f43, FLOAT f44 ) +{ + _11 = f11; _12 = f12; _13 = f13; _14 = f14; + _21 = f21; _22 = f22; _23 = f23; _24 = f24; + _31 = f31; _32 = f32; _33 = f33; _34 = f34; + _41 = f41; _42 = f42; _43 = f43; _44 = f44; +} + + + +// access grants +D3DX10INLINE FLOAT& +D3DXMATRIX::operator () ( UINT iRow, UINT iCol ) +{ + return m[iRow][iCol]; +} + +D3DX10INLINE FLOAT +D3DXMATRIX::operator () ( UINT iRow, UINT iCol ) const +{ + return m[iRow][iCol]; +} + + +// casting operators +D3DX10INLINE +D3DXMATRIX::operator FLOAT* () +{ + return (FLOAT *) &_11; +} + +D3DX10INLINE +D3DXMATRIX::operator CONST FLOAT* () const +{ + return (CONST FLOAT *) &_11; +} + + +// assignment operators +D3DX10INLINE D3DXMATRIX& +D3DXMATRIX::operator *= ( CONST D3DXMATRIX& mat ) +{ + D3DXMatrixMultiply(this, this, &mat); + return *this; +} + +D3DX10INLINE D3DXMATRIX& +D3DXMATRIX::operator += ( CONST D3DXMATRIX& mat ) +{ + _11 += mat._11; _12 += mat._12; _13 += mat._13; _14 += mat._14; + _21 += mat._21; _22 += mat._22; _23 += mat._23; _24 += mat._24; + _31 += mat._31; _32 += mat._32; _33 += mat._33; _34 += mat._34; + _41 += mat._41; _42 += mat._42; _43 += mat._43; _44 += mat._44; + return *this; +} + +D3DX10INLINE D3DXMATRIX& +D3DXMATRIX::operator -= ( CONST D3DXMATRIX& mat ) +{ + _11 -= mat._11; _12 -= mat._12; _13 -= mat._13; _14 -= mat._14; + _21 -= mat._21; _22 -= mat._22; _23 -= mat._23; _24 -= mat._24; + _31 -= mat._31; _32 -= mat._32; _33 -= mat._33; _34 -= mat._34; + _41 -= mat._41; _42 -= mat._42; _43 -= mat._43; _44 -= mat._44; + return *this; +} + +D3DX10INLINE D3DXMATRIX& +D3DXMATRIX::operator *= ( FLOAT f ) +{ + _11 *= f; _12 *= f; _13 *= f; _14 *= f; + _21 *= f; _22 *= f; _23 *= f; _24 *= f; + _31 *= f; _32 *= f; _33 *= f; _34 *= f; + _41 *= f; _42 *= f; _43 *= f; _44 *= f; + return *this; +} + +D3DX10INLINE D3DXMATRIX& +D3DXMATRIX::operator /= ( FLOAT f ) +{ + FLOAT fInv = 1.0f / f; + _11 *= fInv; _12 *= fInv; _13 *= fInv; _14 *= fInv; + _21 *= fInv; _22 *= fInv; _23 *= fInv; _24 *= fInv; + _31 *= fInv; _32 *= fInv; _33 *= fInv; _34 *= fInv; + _41 *= fInv; _42 *= fInv; _43 *= fInv; _44 *= fInv; + return *this; +} + + +// unary operators +D3DX10INLINE D3DXMATRIX +D3DXMATRIX::operator + () const +{ + return *this; +} + +D3DX10INLINE D3DXMATRIX +D3DXMATRIX::operator - () const +{ + return D3DXMATRIX(-_11, -_12, -_13, -_14, + -_21, -_22, -_23, -_24, + -_31, -_32, -_33, -_34, + -_41, -_42, -_43, -_44); +} + + +// binary operators +D3DX10INLINE D3DXMATRIX +D3DXMATRIX::operator * ( CONST D3DXMATRIX& mat ) const +{ + D3DXMATRIX matT; + D3DXMatrixMultiply(&matT, this, &mat); + return matT; +} + +D3DX10INLINE D3DXMATRIX +D3DXMATRIX::operator + ( CONST D3DXMATRIX& mat ) const +{ + return D3DXMATRIX(_11 + mat._11, _12 + mat._12, _13 + mat._13, _14 + mat._14, + _21 + mat._21, _22 + mat._22, _23 + mat._23, _24 + mat._24, + _31 + mat._31, _32 + mat._32, _33 + mat._33, _34 + mat._34, + _41 + mat._41, _42 + mat._42, _43 + mat._43, _44 + mat._44); +} + +D3DX10INLINE D3DXMATRIX +D3DXMATRIX::operator - ( CONST D3DXMATRIX& mat ) const +{ + return D3DXMATRIX(_11 - mat._11, _12 - mat._12, _13 - mat._13, _14 - mat._14, + _21 - mat._21, _22 - mat._22, _23 - mat._23, _24 - mat._24, + _31 - mat._31, _32 - mat._32, _33 - mat._33, _34 - mat._34, + _41 - mat._41, _42 - mat._42, _43 - mat._43, _44 - mat._44); +} + +D3DX10INLINE D3DXMATRIX +D3DXMATRIX::operator * ( FLOAT f ) const +{ + return D3DXMATRIX(_11 * f, _12 * f, _13 * f, _14 * f, + _21 * f, _22 * f, _23 * f, _24 * f, + _31 * f, _32 * f, _33 * f, _34 * f, + _41 * f, _42 * f, _43 * f, _44 * f); +} + +D3DX10INLINE D3DXMATRIX +D3DXMATRIX::operator / ( FLOAT f ) const +{ + FLOAT fInv = 1.0f / f; + return D3DXMATRIX(_11 * fInv, _12 * fInv, _13 * fInv, _14 * fInv, + _21 * fInv, _22 * fInv, _23 * fInv, _24 * fInv, + _31 * fInv, _32 * fInv, _33 * fInv, _34 * fInv, + _41 * fInv, _42 * fInv, _43 * fInv, _44 * fInv); +} + + +D3DX10INLINE D3DXMATRIX +operator * ( FLOAT f, CONST D3DXMATRIX& mat ) +{ + return D3DXMATRIX(f * mat._11, f * mat._12, f * mat._13, f * mat._14, + f * mat._21, f * mat._22, f * mat._23, f * mat._24, + f * mat._31, f * mat._32, f * mat._33, f * mat._34, + f * mat._41, f * mat._42, f * mat._43, f * mat._44); +} + + +D3DX10INLINE BOOL +D3DXMATRIX::operator == ( CONST D3DXMATRIX& mat ) const +{ + return 0 == memcmp(this, &mat, sizeof(D3DXMATRIX)); +} + +D3DX10INLINE BOOL +D3DXMATRIX::operator != ( CONST D3DXMATRIX& mat ) const +{ + return 0 != memcmp(this, &mat, sizeof(D3DXMATRIX)); +} + + + +//-------------------------- +// Aligned Matrices +//-------------------------- + +D3DX10INLINE +_D3DXMATRIXA16::_D3DXMATRIXA16( CONST FLOAT* f ) : + D3DXMATRIX( f ) +{ +} + +D3DX10INLINE +_D3DXMATRIXA16::_D3DXMATRIXA16( CONST D3DMATRIX& m ) : + D3DXMATRIX( m ) +{ +} + +D3DX10INLINE +_D3DXMATRIXA16::_D3DXMATRIXA16( CONST D3DXFLOAT16* f ) : + D3DXMATRIX( f ) +{ +} + +D3DX10INLINE +_D3DXMATRIXA16::_D3DXMATRIXA16( FLOAT _11, FLOAT _12, FLOAT _13, FLOAT _14, + FLOAT _21, FLOAT _22, FLOAT _23, FLOAT _24, + FLOAT _31, FLOAT _32, FLOAT _33, FLOAT _34, + FLOAT _41, FLOAT _42, FLOAT _43, FLOAT _44 ) : + D3DXMATRIX(_11, _12, _13, _14, + _21, _22, _23, _24, + _31, _32, _33, _34, + _41, _42, _43, _44) +{ +} + +#ifndef SIZE_MAX +#define SIZE_MAX ((SIZE_T)-1) +#endif + +D3DX10INLINE void* +_D3DXMATRIXA16::operator new( size_t s ) +{ + if (s > (SIZE_MAX-16)) + return NULL; + LPBYTE p = ::new BYTE[s + 16]; + if (p) + { + BYTE offset = (BYTE)(16 - ((UINT_PTR)p & 15)); + p += offset; + p[-1] = offset; + } + return p; +} + +D3DX10INLINE void* +_D3DXMATRIXA16::operator new[]( size_t s ) +{ + if (s > (SIZE_MAX-16)) + return NULL; + LPBYTE p = ::new BYTE[s + 16]; + if (p) + { + BYTE offset = (BYTE)(16 - ((UINT_PTR)p & 15)); + p += offset; + p[-1] = offset; + } + return p; +} + +D3DX10INLINE void +_D3DXMATRIXA16::operator delete(void* p) +{ + if(p) + { + BYTE* pb = static_cast(p); + pb -= pb[-1]; + ::delete [] pb; + } +} + +D3DX10INLINE void +_D3DXMATRIXA16::operator delete[](void* p) +{ + if(p) + { + BYTE* pb = static_cast(p); + pb -= pb[-1]; + ::delete [] pb; + } +} + +D3DX10INLINE _D3DXMATRIXA16& +_D3DXMATRIXA16::operator=(CONST D3DXMATRIX& rhs) +{ + memcpy(&_11, &rhs, sizeof(D3DXMATRIX)); + return *this; +} + + +//-------------------------- +// Quaternion +//-------------------------- + +D3DX10INLINE +D3DXQUATERNION::D3DXQUATERNION( CONST FLOAT* pf ) +{ +#ifdef D3DX10_DEBUG + if(!pf) + return; +#endif + + x = pf[0]; + y = pf[1]; + z = pf[2]; + w = pf[3]; +} + +D3DX10INLINE +D3DXQUATERNION::D3DXQUATERNION( CONST D3DXFLOAT16* pf ) +{ +#ifdef D3DX10_DEBUG + if(!pf) + return; +#endif + + D3DXFloat16To32Array(&x, pf, 4); +} + +D3DX10INLINE +D3DXQUATERNION::D3DXQUATERNION( FLOAT fx, FLOAT fy, FLOAT fz, FLOAT fw ) +{ + x = fx; + y = fy; + z = fz; + w = fw; +} + + +// casting +D3DX10INLINE +D3DXQUATERNION::operator FLOAT* () +{ + return (FLOAT *) &x; +} + +D3DX10INLINE +D3DXQUATERNION::operator CONST FLOAT* () const +{ + return (CONST FLOAT *) &x; +} + + +// assignment operators +D3DX10INLINE D3DXQUATERNION& +D3DXQUATERNION::operator += ( CONST D3DXQUATERNION& q ) +{ + x += q.x; + y += q.y; + z += q.z; + w += q.w; + return *this; +} + +D3DX10INLINE D3DXQUATERNION& +D3DXQUATERNION::operator -= ( CONST D3DXQUATERNION& q ) +{ + x -= q.x; + y -= q.y; + z -= q.z; + w -= q.w; + return *this; +} + +D3DX10INLINE D3DXQUATERNION& +D3DXQUATERNION::operator *= ( CONST D3DXQUATERNION& q ) +{ + D3DXQuaternionMultiply(this, this, &q); + return *this; +} + +D3DX10INLINE D3DXQUATERNION& +D3DXQUATERNION::operator *= ( FLOAT f ) +{ + x *= f; + y *= f; + z *= f; + w *= f; + return *this; +} + +D3DX10INLINE D3DXQUATERNION& +D3DXQUATERNION::operator /= ( FLOAT f ) +{ + FLOAT fInv = 1.0f / f; + x *= fInv; + y *= fInv; + z *= fInv; + w *= fInv; + return *this; +} + + +// unary operators +D3DX10INLINE D3DXQUATERNION +D3DXQUATERNION::operator + () const +{ + return *this; +} + +D3DX10INLINE D3DXQUATERNION +D3DXQUATERNION::operator - () const +{ + return D3DXQUATERNION(-x, -y, -z, -w); +} + + +// binary operators +D3DX10INLINE D3DXQUATERNION +D3DXQUATERNION::operator + ( CONST D3DXQUATERNION& q ) const +{ + return D3DXQUATERNION(x + q.x, y + q.y, z + q.z, w + q.w); +} + +D3DX10INLINE D3DXQUATERNION +D3DXQUATERNION::operator - ( CONST D3DXQUATERNION& q ) const +{ + return D3DXQUATERNION(x - q.x, y - q.y, z - q.z, w - q.w); +} + +D3DX10INLINE D3DXQUATERNION +D3DXQUATERNION::operator * ( CONST D3DXQUATERNION& q ) const +{ + D3DXQUATERNION qT; + D3DXQuaternionMultiply(&qT, this, &q); + return qT; +} + +D3DX10INLINE D3DXQUATERNION +D3DXQUATERNION::operator * ( FLOAT f ) const +{ + return D3DXQUATERNION(x * f, y * f, z * f, w * f); +} + +D3DX10INLINE D3DXQUATERNION +D3DXQUATERNION::operator / ( FLOAT f ) const +{ + FLOAT fInv = 1.0f / f; + return D3DXQUATERNION(x * fInv, y * fInv, z * fInv, w * fInv); +} + + +D3DX10INLINE D3DXQUATERNION +operator * (FLOAT f, CONST D3DXQUATERNION& q ) +{ + return D3DXQUATERNION(f * q.x, f * q.y, f * q.z, f * q.w); +} + + +D3DX10INLINE BOOL +D3DXQUATERNION::operator == ( CONST D3DXQUATERNION& q ) const +{ + return x == q.x && y == q.y && z == q.z && w == q.w; +} + +D3DX10INLINE BOOL +D3DXQUATERNION::operator != ( CONST D3DXQUATERNION& q ) const +{ + return x != q.x || y != q.y || z != q.z || w != q.w; +} + + + +//-------------------------- +// Plane +//-------------------------- + +D3DX10INLINE +D3DXPLANE::D3DXPLANE( CONST FLOAT* pf ) +{ +#ifdef D3DX10_DEBUG + if(!pf) + return; +#endif + + a = pf[0]; + b = pf[1]; + c = pf[2]; + d = pf[3]; +} + +D3DX10INLINE +D3DXPLANE::D3DXPLANE( CONST D3DXFLOAT16* pf ) +{ +#ifdef D3DX10_DEBUG + if(!pf) + return; +#endif + + D3DXFloat16To32Array(&a, pf, 4); +} + +D3DX10INLINE +D3DXPLANE::D3DXPLANE( FLOAT fa, FLOAT fb, FLOAT fc, FLOAT fd ) +{ + a = fa; + b = fb; + c = fc; + d = fd; +} + + +// casting +D3DX10INLINE +D3DXPLANE::operator FLOAT* () +{ + return (FLOAT *) &a; +} + +D3DX10INLINE +D3DXPLANE::operator CONST FLOAT* () const +{ + return (CONST FLOAT *) &a; +} + + +// assignment operators +D3DX10INLINE D3DXPLANE& +D3DXPLANE::operator *= ( FLOAT f ) +{ + a *= f; + b *= f; + c *= f; + d *= f; + return *this; +} + +D3DX10INLINE D3DXPLANE& +D3DXPLANE::operator /= ( FLOAT f ) +{ + FLOAT fInv = 1.0f / f; + a *= fInv; + b *= fInv; + c *= fInv; + d *= fInv; + return *this; +} + + +// unary operators +D3DX10INLINE D3DXPLANE +D3DXPLANE::operator + () const +{ + return *this; +} + +D3DX10INLINE D3DXPLANE +D3DXPLANE::operator - () const +{ + return D3DXPLANE(-a, -b, -c, -d); +} + + +// binary operators +D3DX10INLINE D3DXPLANE +D3DXPLANE::operator * ( FLOAT f ) const +{ + return D3DXPLANE(a * f, b * f, c * f, d * f); +} + +D3DX10INLINE D3DXPLANE +D3DXPLANE::operator / ( FLOAT f ) const +{ + FLOAT fInv = 1.0f / f; + return D3DXPLANE(a * fInv, b * fInv, c * fInv, d * fInv); +} + +D3DX10INLINE D3DXPLANE +operator * (FLOAT f, CONST D3DXPLANE& p ) +{ + return D3DXPLANE(f * p.a, f * p.b, f * p.c, f * p.d); +} + +D3DX10INLINE BOOL +D3DXPLANE::operator == ( CONST D3DXPLANE& p ) const +{ + return a == p.a && b == p.b && c == p.c && d == p.d; +} + +D3DX10INLINE BOOL +D3DXPLANE::operator != ( CONST D3DXPLANE& p ) const +{ + return a != p.a || b != p.b || c != p.c || d != p.d; +} + + + + +//-------------------------- +// Color +//-------------------------- + +D3DX10INLINE +D3DXCOLOR::D3DXCOLOR( UINT dw ) +{ + CONST FLOAT f = 1.0f / 255.0f; + r = f * (FLOAT) (unsigned char) (dw >> 16); + g = f * (FLOAT) (unsigned char) (dw >> 8); + b = f * (FLOAT) (unsigned char) (dw >> 0); + a = f * (FLOAT) (unsigned char) (dw >> 24); +} + +D3DX10INLINE +D3DXCOLOR::D3DXCOLOR( CONST FLOAT* pf ) +{ +#ifdef D3DX10_DEBUG + if(!pf) + return; +#endif + + r = pf[0]; + g = pf[1]; + b = pf[2]; + a = pf[3]; +} + +D3DX10INLINE +D3DXCOLOR::D3DXCOLOR( CONST D3DXFLOAT16* pf ) +{ +#ifdef D3DX10_DEBUG + if(!pf) + return; +#endif + + D3DXFloat16To32Array(&r, pf, 4); +} + +D3DX10INLINE +D3DXCOLOR::D3DXCOLOR( FLOAT fr, FLOAT fg, FLOAT fb, FLOAT fa ) +{ + r = fr; + g = fg; + b = fb; + a = fa; +} + + +// casting +D3DX10INLINE +D3DXCOLOR::operator UINT () const +{ + UINT dwR = r >= 1.0f ? 0xff : r <= 0.0f ? 0x00 : (UINT) (r * 255.0f + 0.5f); + UINT dwG = g >= 1.0f ? 0xff : g <= 0.0f ? 0x00 : (UINT) (g * 255.0f + 0.5f); + UINT dwB = b >= 1.0f ? 0xff : b <= 0.0f ? 0x00 : (UINT) (b * 255.0f + 0.5f); + UINT dwA = a >= 1.0f ? 0xff : a <= 0.0f ? 0x00 : (UINT) (a * 255.0f + 0.5f); + + return (dwA << 24) | (dwR << 16) | (dwG << 8) | (dwB << 0); +} + + +D3DX10INLINE +D3DXCOLOR::operator FLOAT * () +{ + return (FLOAT *) &r; +} + +D3DX10INLINE +D3DXCOLOR::operator CONST FLOAT * () const +{ + return (CONST FLOAT *) &r; +} + +// assignment operators +D3DX10INLINE D3DXCOLOR& +D3DXCOLOR::operator += ( CONST D3DXCOLOR& c ) +{ + r += c.r; + g += c.g; + b += c.b; + a += c.a; + return *this; +} + +D3DX10INLINE D3DXCOLOR& +D3DXCOLOR::operator -= ( CONST D3DXCOLOR& c ) +{ + r -= c.r; + g -= c.g; + b -= c.b; + a -= c.a; + return *this; +} + +D3DX10INLINE D3DXCOLOR& +D3DXCOLOR::operator *= ( FLOAT f ) +{ + r *= f; + g *= f; + b *= f; + a *= f; + return *this; +} + +D3DX10INLINE D3DXCOLOR& +D3DXCOLOR::operator /= ( FLOAT f ) +{ + FLOAT fInv = 1.0f / f; + r *= fInv; + g *= fInv; + b *= fInv; + a *= fInv; + return *this; +} + + +// unary operators +D3DX10INLINE D3DXCOLOR +D3DXCOLOR::operator + () const +{ + return *this; +} + +D3DX10INLINE D3DXCOLOR +D3DXCOLOR::operator - () const +{ + return D3DXCOLOR(-r, -g, -b, -a); +} + + +// binary operators +D3DX10INLINE D3DXCOLOR +D3DXCOLOR::operator + ( CONST D3DXCOLOR& c ) const +{ + return D3DXCOLOR(r + c.r, g + c.g, b + c.b, a + c.a); +} + +D3DX10INLINE D3DXCOLOR +D3DXCOLOR::operator - ( CONST D3DXCOLOR& c ) const +{ + return D3DXCOLOR(r - c.r, g - c.g, b - c.b, a - c.a); +} + +D3DX10INLINE D3DXCOLOR +D3DXCOLOR::operator * ( FLOAT f ) const +{ + return D3DXCOLOR(r * f, g * f, b * f, a * f); +} + +D3DX10INLINE D3DXCOLOR +D3DXCOLOR::operator / ( FLOAT f ) const +{ + FLOAT fInv = 1.0f / f; + return D3DXCOLOR(r * fInv, g * fInv, b * fInv, a * fInv); +} + + +D3DX10INLINE D3DXCOLOR +operator * (FLOAT f, CONST D3DXCOLOR& c ) +{ + return D3DXCOLOR(f * c.r, f * c.g, f * c.b, f * c.a); +} + + +D3DX10INLINE BOOL +D3DXCOLOR::operator == ( CONST D3DXCOLOR& c ) const +{ + return r == c.r && g == c.g && b == c.b && a == c.a; +} + +D3DX10INLINE BOOL +D3DXCOLOR::operator != ( CONST D3DXCOLOR& c ) const +{ + return r != c.r || g != c.g || b != c.b || a != c.a; +} + + +#endif //__cplusplus + + + +//=========================================================================== +// +// Inline functions +// +//=========================================================================== + + +//-------------------------- +// 2D Vector +//-------------------------- + +D3DX10INLINE FLOAT D3DXVec2Length + ( CONST D3DXVECTOR2 *pV ) +{ +#ifdef D3DX10_DEBUG + if(!pV) + return 0.0f; +#endif + +#ifdef __cplusplus + return sqrtf(pV->x * pV->x + pV->y * pV->y); +#else + return (FLOAT) sqrt(pV->x * pV->x + pV->y * pV->y); +#endif +} + +D3DX10INLINE FLOAT D3DXVec2LengthSq + ( CONST D3DXVECTOR2 *pV ) +{ +#ifdef D3DX10_DEBUG + if(!pV) + return 0.0f; +#endif + + return pV->x * pV->x + pV->y * pV->y; +} + +D3DX10INLINE FLOAT D3DXVec2Dot + ( CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ) +{ +#ifdef D3DX10_DEBUG + if(!pV1 || !pV2) + return 0.0f; +#endif + + return pV1->x * pV2->x + pV1->y * pV2->y; +} + +D3DX10INLINE FLOAT D3DXVec2CCW + ( CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ) +{ +#ifdef D3DX10_DEBUG + if(!pV1 || !pV2) + return 0.0f; +#endif + + return pV1->x * pV2->y - pV1->y * pV2->x; +} + +D3DX10INLINE D3DXVECTOR2* D3DXVec2Add + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ) +{ +#ifdef D3DX10_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x + pV2->x; + pOut->y = pV1->y + pV2->y; + return pOut; +} + +D3DX10INLINE D3DXVECTOR2* D3DXVec2Subtract + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ) +{ +#ifdef D3DX10_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x - pV2->x; + pOut->y = pV1->y - pV2->y; + return pOut; +} + +D3DX10INLINE D3DXVECTOR2* D3DXVec2Minimize + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ) +{ +#ifdef D3DX10_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x < pV2->x ? pV1->x : pV2->x; + pOut->y = pV1->y < pV2->y ? pV1->y : pV2->y; + return pOut; +} + +D3DX10INLINE D3DXVECTOR2* D3DXVec2Maximize + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ) +{ +#ifdef D3DX10_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x > pV2->x ? pV1->x : pV2->x; + pOut->y = pV1->y > pV2->y ? pV1->y : pV2->y; + return pOut; +} + +D3DX10INLINE D3DXVECTOR2* D3DXVec2Scale + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV, FLOAT s ) +{ +#ifdef D3DX10_DEBUG + if(!pOut || !pV) + return NULL; +#endif + + pOut->x = pV->x * s; + pOut->y = pV->y * s; + return pOut; +} + +D3DX10INLINE D3DXVECTOR2* D3DXVec2Lerp + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2, + FLOAT s ) +{ +#ifdef D3DX10_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x + s * (pV2->x - pV1->x); + pOut->y = pV1->y + s * (pV2->y - pV1->y); + return pOut; +} + + +//-------------------------- +// 3D Vector +//-------------------------- + +D3DX10INLINE FLOAT D3DXVec3Length + ( CONST D3DXVECTOR3 *pV ) +{ +#ifdef D3DX10_DEBUG + if(!pV) + return 0.0f; +#endif + +#ifdef __cplusplus + return sqrtf(pV->x * pV->x + pV->y * pV->y + pV->z * pV->z); +#else + return (FLOAT) sqrt(pV->x * pV->x + pV->y * pV->y + pV->z * pV->z); +#endif +} + +D3DX10INLINE FLOAT D3DXVec3LengthSq + ( CONST D3DXVECTOR3 *pV ) +{ +#ifdef D3DX10_DEBUG + if(!pV) + return 0.0f; +#endif + + return pV->x * pV->x + pV->y * pV->y + pV->z * pV->z; +} + +D3DX10INLINE FLOAT D3DXVec3Dot + ( CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ) +{ +#ifdef D3DX10_DEBUG + if(!pV1 || !pV2) + return 0.0f; +#endif + + return pV1->x * pV2->x + pV1->y * pV2->y + pV1->z * pV2->z; +} + +D3DX10INLINE D3DXVECTOR3* D3DXVec3Cross + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ) +{ + D3DXVECTOR3 v; + +#ifdef D3DX10_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + v.x = pV1->y * pV2->z - pV1->z * pV2->y; + v.y = pV1->z * pV2->x - pV1->x * pV2->z; + v.z = pV1->x * pV2->y - pV1->y * pV2->x; + + *pOut = v; + return pOut; +} + +D3DX10INLINE D3DXVECTOR3* D3DXVec3Add + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ) +{ +#ifdef D3DX10_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x + pV2->x; + pOut->y = pV1->y + pV2->y; + pOut->z = pV1->z + pV2->z; + return pOut; +} + +D3DX10INLINE D3DXVECTOR3* D3DXVec3Subtract + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ) +{ +#ifdef D3DX10_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x - pV2->x; + pOut->y = pV1->y - pV2->y; + pOut->z = pV1->z - pV2->z; + return pOut; +} + +D3DX10INLINE D3DXVECTOR3* D3DXVec3Minimize + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ) +{ +#ifdef D3DX10_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x < pV2->x ? pV1->x : pV2->x; + pOut->y = pV1->y < pV2->y ? pV1->y : pV2->y; + pOut->z = pV1->z < pV2->z ? pV1->z : pV2->z; + return pOut; +} + +D3DX10INLINE D3DXVECTOR3* D3DXVec3Maximize + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ) +{ +#ifdef D3DX10_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x > pV2->x ? pV1->x : pV2->x; + pOut->y = pV1->y > pV2->y ? pV1->y : pV2->y; + pOut->z = pV1->z > pV2->z ? pV1->z : pV2->z; + return pOut; +} + +D3DX10INLINE D3DXVECTOR3* D3DXVec3Scale + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV, FLOAT s) +{ +#ifdef D3DX10_DEBUG + if(!pOut || !pV) + return NULL; +#endif + + pOut->x = pV->x * s; + pOut->y = pV->y * s; + pOut->z = pV->z * s; + return pOut; +} + +D3DX10INLINE D3DXVECTOR3* D3DXVec3Lerp + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2, + FLOAT s ) +{ +#ifdef D3DX10_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x + s * (pV2->x - pV1->x); + pOut->y = pV1->y + s * (pV2->y - pV1->y); + pOut->z = pV1->z + s * (pV2->z - pV1->z); + return pOut; +} + + +//-------------------------- +// 4D Vector +//-------------------------- + +D3DX10INLINE FLOAT D3DXVec4Length + ( CONST D3DXVECTOR4 *pV ) +{ +#ifdef D3DX10_DEBUG + if(!pV) + return 0.0f; +#endif + +#ifdef __cplusplus + return sqrtf(pV->x * pV->x + pV->y * pV->y + pV->z * pV->z + pV->w * pV->w); +#else + return (FLOAT) sqrt(pV->x * pV->x + pV->y * pV->y + pV->z * pV->z + pV->w * pV->w); +#endif +} + +D3DX10INLINE FLOAT D3DXVec4LengthSq + ( CONST D3DXVECTOR4 *pV ) +{ +#ifdef D3DX10_DEBUG + if(!pV) + return 0.0f; +#endif + + return pV->x * pV->x + pV->y * pV->y + pV->z * pV->z + pV->w * pV->w; +} + +D3DX10INLINE FLOAT D3DXVec4Dot + ( CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2 ) +{ +#ifdef D3DX10_DEBUG + if(!pV1 || !pV2) + return 0.0f; +#endif + + return pV1->x * pV2->x + pV1->y * pV2->y + pV1->z * pV2->z + pV1->w * pV2->w; +} + +D3DX10INLINE D3DXVECTOR4* D3DXVec4Add + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2) +{ +#ifdef D3DX10_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x + pV2->x; + pOut->y = pV1->y + pV2->y; + pOut->z = pV1->z + pV2->z; + pOut->w = pV1->w + pV2->w; + return pOut; +} + +D3DX10INLINE D3DXVECTOR4* D3DXVec4Subtract + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2) +{ +#ifdef D3DX10_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x - pV2->x; + pOut->y = pV1->y - pV2->y; + pOut->z = pV1->z - pV2->z; + pOut->w = pV1->w - pV2->w; + return pOut; +} + +D3DX10INLINE D3DXVECTOR4* D3DXVec4Minimize + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2) +{ +#ifdef D3DX10_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x < pV2->x ? pV1->x : pV2->x; + pOut->y = pV1->y < pV2->y ? pV1->y : pV2->y; + pOut->z = pV1->z < pV2->z ? pV1->z : pV2->z; + pOut->w = pV1->w < pV2->w ? pV1->w : pV2->w; + return pOut; +} + +D3DX10INLINE D3DXVECTOR4* D3DXVec4Maximize + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2) +{ +#ifdef D3DX10_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x > pV2->x ? pV1->x : pV2->x; + pOut->y = pV1->y > pV2->y ? pV1->y : pV2->y; + pOut->z = pV1->z > pV2->z ? pV1->z : pV2->z; + pOut->w = pV1->w > pV2->w ? pV1->w : pV2->w; + return pOut; +} + +D3DX10INLINE D3DXVECTOR4* D3DXVec4Scale + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV, FLOAT s) +{ +#ifdef D3DX10_DEBUG + if(!pOut || !pV) + return NULL; +#endif + + pOut->x = pV->x * s; + pOut->y = pV->y * s; + pOut->z = pV->z * s; + pOut->w = pV->w * s; + return pOut; +} + +D3DX10INLINE D3DXVECTOR4* D3DXVec4Lerp + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2, + FLOAT s ) +{ +#ifdef D3DX10_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x + s * (pV2->x - pV1->x); + pOut->y = pV1->y + s * (pV2->y - pV1->y); + pOut->z = pV1->z + s * (pV2->z - pV1->z); + pOut->w = pV1->w + s * (pV2->w - pV1->w); + return pOut; +} + + +//-------------------------- +// 4D Matrix +//-------------------------- + +D3DX10INLINE D3DXMATRIX* D3DXMatrixIdentity + ( D3DXMATRIX *pOut ) +{ +#ifdef D3DX10_DEBUG + if(!pOut) + return NULL; +#endif + + pOut->m[0][1] = pOut->m[0][2] = pOut->m[0][3] = + pOut->m[1][0] = pOut->m[1][2] = pOut->m[1][3] = + pOut->m[2][0] = pOut->m[2][1] = pOut->m[2][3] = + pOut->m[3][0] = pOut->m[3][1] = pOut->m[3][2] = 0.0f; + + pOut->m[0][0] = pOut->m[1][1] = pOut->m[2][2] = pOut->m[3][3] = 1.0f; + return pOut; +} + + +D3DX10INLINE BOOL D3DXMatrixIsIdentity + ( CONST D3DXMATRIX *pM ) +{ +#ifdef D3DX10_DEBUG + if(!pM) + return FALSE; +#endif + + return pM->m[0][0] == 1.0f && pM->m[0][1] == 0.0f && pM->m[0][2] == 0.0f && pM->m[0][3] == 0.0f && + pM->m[1][0] == 0.0f && pM->m[1][1] == 1.0f && pM->m[1][2] == 0.0f && pM->m[1][3] == 0.0f && + pM->m[2][0] == 0.0f && pM->m[2][1] == 0.0f && pM->m[2][2] == 1.0f && pM->m[2][3] == 0.0f && + pM->m[3][0] == 0.0f && pM->m[3][1] == 0.0f && pM->m[3][2] == 0.0f && pM->m[3][3] == 1.0f; +} + + +//-------------------------- +// Quaternion +//-------------------------- + +D3DX10INLINE FLOAT D3DXQuaternionLength + ( CONST D3DXQUATERNION *pQ ) +{ +#ifdef D3DX10_DEBUG + if(!pQ) + return 0.0f; +#endif + +#ifdef __cplusplus + return sqrtf(pQ->x * pQ->x + pQ->y * pQ->y + pQ->z * pQ->z + pQ->w * pQ->w); +#else + return (FLOAT) sqrt(pQ->x * pQ->x + pQ->y * pQ->y + pQ->z * pQ->z + pQ->w * pQ->w); +#endif +} + +D3DX10INLINE FLOAT D3DXQuaternionLengthSq + ( CONST D3DXQUATERNION *pQ ) +{ +#ifdef D3DX10_DEBUG + if(!pQ) + return 0.0f; +#endif + + return pQ->x * pQ->x + pQ->y * pQ->y + pQ->z * pQ->z + pQ->w * pQ->w; +} + +D3DX10INLINE FLOAT D3DXQuaternionDot + ( CONST D3DXQUATERNION *pQ1, CONST D3DXQUATERNION *pQ2 ) +{ +#ifdef D3DX10_DEBUG + if(!pQ1 || !pQ2) + return 0.0f; +#endif + + return pQ1->x * pQ2->x + pQ1->y * pQ2->y + pQ1->z * pQ2->z + pQ1->w * pQ2->w; +} + + +D3DX10INLINE D3DXQUATERNION* D3DXQuaternionIdentity + ( D3DXQUATERNION *pOut ) +{ +#ifdef D3DX10_DEBUG + if(!pOut) + return NULL; +#endif + + pOut->x = pOut->y = pOut->z = 0.0f; + pOut->w = 1.0f; + return pOut; +} + +D3DX10INLINE BOOL D3DXQuaternionIsIdentity + ( CONST D3DXQUATERNION *pQ ) +{ +#ifdef D3DX10_DEBUG + if(!pQ) + return FALSE; +#endif + + return pQ->x == 0.0f && pQ->y == 0.0f && pQ->z == 0.0f && pQ->w == 1.0f; +} + + +D3DX10INLINE D3DXQUATERNION* D3DXQuaternionConjugate + ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ ) +{ +#ifdef D3DX10_DEBUG + if(!pOut || !pQ) + return NULL; +#endif + + pOut->x = -pQ->x; + pOut->y = -pQ->y; + pOut->z = -pQ->z; + pOut->w = pQ->w; + return pOut; +} + + +//-------------------------- +// Plane +//-------------------------- + +D3DX10INLINE FLOAT D3DXPlaneDot + ( CONST D3DXPLANE *pP, CONST D3DXVECTOR4 *pV) +{ +#ifdef D3DX10_DEBUG + if(!pP || !pV) + return 0.0f; +#endif + + return pP->a * pV->x + pP->b * pV->y + pP->c * pV->z + pP->d * pV->w; +} + +D3DX10INLINE FLOAT D3DXPlaneDotCoord + ( CONST D3DXPLANE *pP, CONST D3DXVECTOR3 *pV) +{ +#ifdef D3DX10_DEBUG + if(!pP || !pV) + return 0.0f; +#endif + + return pP->a * pV->x + pP->b * pV->y + pP->c * pV->z + pP->d; +} + +D3DX10INLINE FLOAT D3DXPlaneDotNormal + ( CONST D3DXPLANE *pP, CONST D3DXVECTOR3 *pV) +{ +#ifdef D3DX10_DEBUG + if(!pP || !pV) + return 0.0f; +#endif + + return pP->a * pV->x + pP->b * pV->y + pP->c * pV->z; +} + +D3DX10INLINE D3DXPLANE* D3DXPlaneScale + (D3DXPLANE *pOut, CONST D3DXPLANE *pP, FLOAT s) +{ +#ifdef D3DX10_DEBUG + if(!pOut || !pP) + return NULL; +#endif + + pOut->a = pP->a * s; + pOut->b = pP->b * s; + pOut->c = pP->c * s; + pOut->d = pP->d * s; + return pOut; +} + + +//-------------------------- +// Color +//-------------------------- + +D3DX10INLINE D3DXCOLOR* D3DXColorNegative + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC) +{ +#ifdef D3DX10_DEBUG + if(!pOut || !pC) + return NULL; +#endif + + pOut->r = 1.0f - pC->r; + pOut->g = 1.0f - pC->g; + pOut->b = 1.0f - pC->b; + pOut->a = pC->a; + return pOut; +} + +D3DX10INLINE D3DXCOLOR* D3DXColorAdd + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2) +{ +#ifdef D3DX10_DEBUG + if(!pOut || !pC1 || !pC2) + return NULL; +#endif + + pOut->r = pC1->r + pC2->r; + pOut->g = pC1->g + pC2->g; + pOut->b = pC1->b + pC2->b; + pOut->a = pC1->a + pC2->a; + return pOut; +} + +D3DX10INLINE D3DXCOLOR* D3DXColorSubtract + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2) +{ +#ifdef D3DX10_DEBUG + if(!pOut || !pC1 || !pC2) + return NULL; +#endif + + pOut->r = pC1->r - pC2->r; + pOut->g = pC1->g - pC2->g; + pOut->b = pC1->b - pC2->b; + pOut->a = pC1->a - pC2->a; + return pOut; +} + +D3DX10INLINE D3DXCOLOR* D3DXColorScale + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC, FLOAT s) +{ +#ifdef D3DX10_DEBUG + if(!pOut || !pC) + return NULL; +#endif + + pOut->r = pC->r * s; + pOut->g = pC->g * s; + pOut->b = pC->b * s; + pOut->a = pC->a * s; + return pOut; +} + +D3DX10INLINE D3DXCOLOR* D3DXColorModulate + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2) +{ +#ifdef D3DX10_DEBUG + if(!pOut || !pC1 || !pC2) + return NULL; +#endif + + pOut->r = pC1->r * pC2->r; + pOut->g = pC1->g * pC2->g; + pOut->b = pC1->b * pC2->b; + pOut->a = pC1->a * pC2->a; + return pOut; +} + +D3DX10INLINE D3DXCOLOR* D3DXColorLerp + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2, FLOAT s) +{ +#ifdef D3DX10_DEBUG + if(!pOut || !pC1 || !pC2) + return NULL; +#endif + + pOut->r = pC1->r + s * (pC2->r - pC1->r); + pOut->g = pC1->g + s * (pC2->g - pC1->g); + pOut->b = pC1->b + s * (pC2->b - pC1->b); + pOut->a = pC1->a + s * (pC2->a - pC1->a); + return pOut; +} + + +#endif // __D3DXMATH_INL__ + diff --git a/MediaClient/MediaClient/directx/include/D3DX10mesh.h b/MediaClient/MediaClient/directx/include/D3DX10mesh.h new file mode 100644 index 0000000..e5fed8f --- /dev/null +++ b/MediaClient/MediaClient/directx/include/D3DX10mesh.h @@ -0,0 +1,286 @@ +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx10mesh.h +// Content: D3DX10 mesh types and functions +// +////////////////////////////////////////////////////////////////////////////// + +#include "d3dx10.h" + +#ifndef __D3DX10MESH_H__ +#define __D3DX10MESH_H__ + +// {7ED943DD-52E8-40b5-A8D8-76685C406330} +DEFINE_GUID(IID_ID3DX10BaseMesh, +0x7ed943dd, 0x52e8, 0x40b5, 0xa8, 0xd8, 0x76, 0x68, 0x5c, 0x40, 0x63, 0x30); + +// {04B0D117-1041-46b1-AA8A-3952848BA22E} +DEFINE_GUID(IID_ID3DX10MeshBuffer, +0x4b0d117, 0x1041, 0x46b1, 0xaa, 0x8a, 0x39, 0x52, 0x84, 0x8b, 0xa2, 0x2e); + +// {4020E5C2-1403-4929-883F-E2E849FAC195} +DEFINE_GUID(IID_ID3DX10Mesh, +0x4020e5c2, 0x1403, 0x4929, 0x88, 0x3f, 0xe2, 0xe8, 0x49, 0xfa, 0xc1, 0x95); + +// {8875769A-D579-4088-AAEB-534D1AD84E96} +DEFINE_GUID(IID_ID3DX10PMesh, +0x8875769a, 0xd579, 0x4088, 0xaa, 0xeb, 0x53, 0x4d, 0x1a, 0xd8, 0x4e, 0x96); + +// {667EA4C7-F1CD-4386-B523-7C0290B83CC5} +DEFINE_GUID(IID_ID3DX10SPMesh, +0x667ea4c7, 0xf1cd, 0x4386, 0xb5, 0x23, 0x7c, 0x2, 0x90, 0xb8, 0x3c, 0xc5); + +// {3CE6CC22-DBF2-44f4-894D-F9C34A337139} +DEFINE_GUID(IID_ID3DX10PatchMesh, +0x3ce6cc22, 0xdbf2, 0x44f4, 0x89, 0x4d, 0xf9, 0xc3, 0x4a, 0x33, 0x71, 0x39); + + +// Mesh options - lower 3 bytes only, upper byte used by _D3DX10MESHOPT option flags +enum _D3DX10_MESH { + D3DX10_MESH_32_BIT = 0x001, // If set, then use 32 bit indices, if not set use 16 bit indices. + D3DX10_MESH_GS_ADJACENCY = 0x004, // If set, mesh contains GS adjacency info. Not valid on input. + +}; + +typedef struct _D3DX10_ATTRIBUTE_RANGE +{ + UINT AttribId; + UINT FaceStart; + UINT FaceCount; + UINT VertexStart; + UINT VertexCount; +} D3DX10_ATTRIBUTE_RANGE; + +typedef D3DX10_ATTRIBUTE_RANGE* LPD3DX10_ATTRIBUTE_RANGE; + +typedef enum _D3DX10_MESH_DISCARD_FLAGS +{ + D3DX10_MESH_DISCARD_ATTRIBUTE_BUFFER = 0x01, + D3DX10_MESH_DISCARD_ATTRIBUTE_TABLE = 0x02, + D3DX10_MESH_DISCARD_POINTREPS = 0x04, + D3DX10_MESH_DISCARD_ADJACENCY = 0x08, + D3DX10_MESH_DISCARD_DEVICE_BUFFERS = 0x10, + +} D3DX10_MESH_DISCARD_FLAGS; + +typedef struct _D3DX10_WELD_EPSILONS +{ + FLOAT Position; // NOTE: This does NOT replace the epsilon in GenerateAdjacency + // in general, it should be the same value or greater than the one passed to GeneratedAdjacency + FLOAT BlendWeights; + FLOAT Normal; + FLOAT PSize; + FLOAT Specular; + FLOAT Diffuse; + FLOAT Texcoord[8]; + FLOAT Tangent; + FLOAT Binormal; + FLOAT TessFactor; +} D3DX10_WELD_EPSILONS; + +typedef D3DX10_WELD_EPSILONS* LPD3DX10_WELD_EPSILONS; + +typedef struct _D3DX10_INTERSECT_INFO +{ + UINT FaceIndex; // index of face intersected + FLOAT U; // Barycentric Hit Coordinates + FLOAT V; // Barycentric Hit Coordinates + FLOAT Dist; // Ray-Intersection Parameter Distance +} D3DX10_INTERSECT_INFO, *LPD3DX10_INTERSECT_INFO; + +// ID3DX10MeshBuffer is used by D3DX10Mesh vertex and index buffers +#undef INTERFACE +#define INTERFACE ID3DX10MeshBuffer + +DECLARE_INTERFACE_(ID3DX10MeshBuffer, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DX10MeshBuffer + STDMETHOD(Map)(THIS_ void **ppData, SIZE_T *pSize) PURE; + STDMETHOD(Unmap)(THIS) PURE; + STDMETHOD_(SIZE_T, GetSize)(THIS) PURE; +}; + +// D3DX10 Mesh interfaces +#undef INTERFACE +#define INTERFACE ID3DX10Mesh + +DECLARE_INTERFACE_(ID3DX10Mesh, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DX10Mesh + STDMETHOD_(UINT, GetFaceCount)(THIS) PURE; + STDMETHOD_(UINT, GetVertexCount)(THIS) PURE; + STDMETHOD_(UINT, GetVertexBufferCount)(THIS) PURE; + STDMETHOD_(UINT, GetFlags)(THIS) PURE; + STDMETHOD(GetVertexDescription)(THIS_ CONST D3D10_INPUT_ELEMENT_DESC **ppDesc, UINT *pDeclCount) PURE; + + STDMETHOD(SetVertexData)(THIS_ UINT iBuffer, CONST void *pData) PURE; + STDMETHOD(GetVertexBuffer)(THIS_ UINT iBuffer, ID3DX10MeshBuffer **ppVertexBuffer) PURE; + + STDMETHOD(SetIndexData)(THIS_ CONST void *pData, UINT cIndices) PURE; + STDMETHOD(GetIndexBuffer)(THIS_ ID3DX10MeshBuffer **ppIndexBuffer) PURE; + + STDMETHOD(SetAttributeData)(THIS_ CONST UINT *pData) PURE; + STDMETHOD(GetAttributeBuffer)(THIS_ ID3DX10MeshBuffer **ppAttributeBuffer) PURE; + + STDMETHOD(SetAttributeTable)(THIS_ CONST D3DX10_ATTRIBUTE_RANGE *pAttribTable, UINT cAttribTableSize) PURE; + STDMETHOD(GetAttributeTable)(THIS_ D3DX10_ATTRIBUTE_RANGE *pAttribTable, UINT *pAttribTableSize) PURE; + + STDMETHOD(GenerateAdjacencyAndPointReps)(THIS_ FLOAT Epsilon) PURE; + STDMETHOD(GenerateGSAdjacency)(THIS) PURE; + + STDMETHOD(SetAdjacencyData)(THIS_ CONST UINT *pAdjacency) PURE; + STDMETHOD(GetAdjacencyBuffer)(THIS_ ID3DX10MeshBuffer **ppAdjacency) PURE; + + STDMETHOD(SetPointRepData)(THIS_ CONST UINT *pPointReps) PURE; + STDMETHOD(GetPointRepBuffer)(THIS_ ID3DX10MeshBuffer **ppPointReps) PURE; + + STDMETHOD(Discard)(THIS_ D3DX10_MESH_DISCARD_FLAGS dwDiscard) PURE; + STDMETHOD(CloneMesh)(THIS_ UINT Flags, LPCSTR pPosSemantic, CONST D3D10_INPUT_ELEMENT_DESC *pDesc, UINT DeclCount, ID3DX10Mesh** ppCloneMesh) PURE; + + STDMETHOD(Optimize)(THIS_ UINT Flags, UINT * pFaceRemap, LPD3D10BLOB *ppVertexRemap) PURE; + STDMETHOD(GenerateAttributeBufferFromTable)(THIS) PURE; + + STDMETHOD(Intersect)(THIS_ D3DXVECTOR3 *pRayPos, D3DXVECTOR3 *pRayDir, + UINT *pHitCount, UINT *pFaceIndex, float *pU, float *pV, float *pDist, ID3D10Blob **ppAllHits); + STDMETHOD(IntersectSubset)(THIS_ UINT AttribId, D3DXVECTOR3 *pRayPos, D3DXVECTOR3 *pRayDir, + UINT *pHitCount, UINT *pFaceIndex, float *pU, float *pV, float *pDist, ID3D10Blob **ppAllHits); + + // ID3DX10Mesh - Device functions + STDMETHOD(CommitToDevice)(THIS) PURE; + STDMETHOD(DrawSubset)(THIS_ UINT AttribId) PURE; + STDMETHOD(DrawSubsetInstanced)(THIS_ UINT AttribId, UINT InstanceCount, UINT StartInstanceLocation) PURE; + + STDMETHOD(GetDeviceVertexBuffer)(THIS_ UINT iBuffer, ID3D10Buffer **ppVertexBuffer) PURE; + STDMETHOD(GetDeviceIndexBuffer)(THIS_ ID3D10Buffer **ppIndexBuffer) PURE; +}; + + +// Flat API +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + +HRESULT WINAPI + D3DX10CreateMesh( + ID3D10Device *pDevice, + CONST D3D10_INPUT_ELEMENT_DESC *pDeclaration, + UINT DeclCount, + LPCSTR pPositionSemantic, + UINT VertexCount, + UINT FaceCount, + UINT Options, + ID3DX10Mesh **ppMesh); + +#ifdef __cplusplus +} +#endif //__cplusplus + + +// ID3DX10Mesh::Optimize options - upper byte only, lower 3 bytes used from _D3DX10MESH option flags +enum _D3DX10_MESHOPT { + D3DX10_MESHOPT_COMPACT = 0x01000000, + D3DX10_MESHOPT_ATTR_SORT = 0x02000000, + D3DX10_MESHOPT_VERTEX_CACHE = 0x04000000, + D3DX10_MESHOPT_STRIP_REORDER = 0x08000000, + D3DX10_MESHOPT_IGNORE_VERTS = 0x10000000, // optimize faces only, don't touch vertices + D3DX10_MESHOPT_DO_NOT_SPLIT = 0x20000000, // do not split vertices shared between attribute groups when attribute sorting + D3DX10_MESHOPT_DEVICE_INDEPENDENT = 0x00400000, // Only affects VCache. uses a static known good cache size for all cards + + // D3DX10_MESHOPT_SHAREVB has been removed, please use D3DX10MESH_VB_SHARE instead + +}; + + +////////////////////////////////////////////////////////////////////////// +// ID3DXSkinInfo +////////////////////////////////////////////////////////////////////////// + +// {420BD604-1C76-4a34-A466-E45D0658A32C} +DEFINE_GUID(IID_ID3DX10SkinInfo, +0x420bd604, 0x1c76, 0x4a34, 0xa4, 0x66, 0xe4, 0x5d, 0x6, 0x58, 0xa3, 0x2c); + +// scaling modes for ID3DX10SkinInfo::Compact() & ID3DX10SkinInfo::UpdateMesh() +#define D3DX10_SKININFO_NO_SCALING 0 +#define D3DX10_SKININFO_SCALE_TO_1 1 +#define D3DX10_SKININFO_SCALE_TO_TOTAL 2 + +typedef struct _D3DX10_SKINNING_CHANNEL +{ + UINT SrcOffset; + UINT DestOffset; + BOOL IsNormal; +} D3DX10_SKINNING_CHANNEL; + +#undef INTERFACE +#define INTERFACE ID3DX10SkinInfo + +typedef struct ID3DX10SkinInfo *LPD3DX10SKININFO; + +DECLARE_INTERFACE_(ID3DX10SkinInfo, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + STDMETHOD_(UINT , GetNumVertices)(THIS) PURE; + STDMETHOD_(UINT , GetNumBones)(THIS) PURE; + STDMETHOD_(UINT , GetMaxBoneInfluences)(THIS) PURE; + + STDMETHOD(AddVertices)(THIS_ UINT Count) PURE; + STDMETHOD(RemapVertices)(THIS_ UINT NewVertexCount, UINT *pVertexRemap) PURE; + + STDMETHOD(AddBones)(THIS_ UINT Count) PURE; + STDMETHOD(RemoveBone)(THIS_ UINT Index) PURE; + STDMETHOD(RemapBones)(THIS_ UINT NewBoneCount, UINT *pBoneRemap) PURE; + + STDMETHOD(AddBoneInfluences)(THIS_ UINT BoneIndex, UINT InfluenceCount, UINT *pIndices, float *pWeights) PURE; + STDMETHOD(ClearBoneInfluences)(THIS_ UINT BoneIndex) PURE; + STDMETHOD_(UINT , GetBoneInfluenceCount)(THIS_ UINT BoneIndex) PURE; + STDMETHOD(GetBoneInfluences)(THIS_ UINT BoneIndex, UINT Offset, UINT Count, UINT *pDestIndices, float *pDestWeights) PURE; + STDMETHOD(FindBoneInfluenceIndex)(THIS_ UINT BoneIndex, UINT VertexIndex, UINT *pInfluenceIndex) PURE; + STDMETHOD(SetBoneInfluence)(THIS_ UINT BoneIndex, UINT InfluenceIndex, float Weight) PURE; + STDMETHOD(GetBoneInfluence)(THIS_ UINT BoneIndex, UINT InfluenceIndex, float *pWeight) PURE; + + STDMETHOD(Compact)(THIS_ UINT MaxPerVertexInfluences, UINT ScaleMode, float MinWeight) PURE; + STDMETHOD(DoSoftwareSkinning)(UINT StartVertex, UINT VertexCount, void *pSrcVertices, UINT SrcStride, void *pDestVertices, UINT DestStride, D3DXMATRIX *pBoneMatrices, D3DXMATRIX *pInverseTransposeBoneMatrices, D3DX10_SKINNING_CHANNEL *pChannelDescs, UINT NumChannels) PURE; +}; + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + +HRESULT WINAPI + D3DX10CreateSkinInfo(LPD3DX10SKININFO* ppSkinInfo); + +#ifdef __cplusplus +} +#endif //__cplusplus + +typedef struct _D3DX10_ATTRIBUTE_WEIGHTS +{ + FLOAT Position; + FLOAT Boundary; + FLOAT Normal; + FLOAT Diffuse; + FLOAT Specular; + FLOAT Texcoord[8]; + FLOAT Tangent; + FLOAT Binormal; +} D3DX10_ATTRIBUTE_WEIGHTS, *LPD3DX10_ATTRIBUTE_WEIGHTS; + +#endif //__D3DX10MESH_H__ + + diff --git a/MediaClient/MediaClient/directx/include/D3DX10tex.h b/MediaClient/MediaClient/directx/include/D3DX10tex.h new file mode 100644 index 0000000..a6d8bb9 --- /dev/null +++ b/MediaClient/MediaClient/directx/include/D3DX10tex.h @@ -0,0 +1,766 @@ +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx10tex.h +// Content: D3DX10 texturing APIs +// +////////////////////////////////////////////////////////////////////////////// + +#include "d3dx10.h" + +#ifndef __D3DX10TEX_H__ +#define __D3DX10TEX_H__ + + +//---------------------------------------------------------------------------- +// D3DX10_FILTER flags: +// ------------------ +// +// A valid filter must contain one of these values: +// +// D3DX10_FILTER_NONE +// No scaling or filtering will take place. Pixels outside the bounds +// of the source image are assumed to be transparent black. +// D3DX10_FILTER_POINT +// Each destination pixel is computed by sampling the nearest pixel +// from the source image. +// D3DX10_FILTER_LINEAR +// Each destination pixel is computed by linearly interpolating between +// the nearest pixels in the source image. This filter works best +// when the scale on each axis is less than 2. +// D3DX10_FILTER_TRIANGLE +// Every pixel in the source image contributes equally to the +// destination image. This is the slowest of all the filters. +// D3DX10_FILTER_BOX +// Each pixel is computed by averaging a 2x2(x2) box pixels from +// the source image. Only works when the dimensions of the +// destination are half those of the source. (as with mip maps) +// +// And can be OR'd with any of these optional flags: +// +// D3DX10_FILTER_MIRROR_U +// Indicates that pixels off the edge of the texture on the U-axis +// should be mirrored, not wraped. +// D3DX10_FILTER_MIRROR_V +// Indicates that pixels off the edge of the texture on the V-axis +// should be mirrored, not wraped. +// D3DX10_FILTER_MIRROR_W +// Indicates that pixels off the edge of the texture on the W-axis +// should be mirrored, not wraped. +// D3DX10_FILTER_MIRROR +// Same as specifying D3DX10_FILTER_MIRROR_U | D3DX10_FILTER_MIRROR_V | +// D3DX10_FILTER_MIRROR_V +// D3DX10_FILTER_DITHER +// Dithers the resulting image using a 4x4 order dither pattern. +// D3DX10_FILTER_SRGB_IN +// Denotes that the input data is in sRGB (gamma 2.2) colorspace. +// D3DX10_FILTER_SRGB_OUT +// Denotes that the output data is in sRGB (gamma 2.2) colorspace. +// D3DX10_FILTER_SRGB +// Same as specifying D3DX10_FILTER_SRGB_IN | D3DX10_FILTER_SRGB_OUT +// +//---------------------------------------------------------------------------- + +typedef enum D3DX10_FILTER_FLAG +{ + D3DX10_FILTER_NONE = (1 << 0), + D3DX10_FILTER_POINT = (2 << 0), + D3DX10_FILTER_LINEAR = (3 << 0), + D3DX10_FILTER_TRIANGLE = (4 << 0), + D3DX10_FILTER_BOX = (5 << 0), + + D3DX10_FILTER_MIRROR_U = (1 << 16), + D3DX10_FILTER_MIRROR_V = (2 << 16), + D3DX10_FILTER_MIRROR_W = (4 << 16), + D3DX10_FILTER_MIRROR = (7 << 16), + + D3DX10_FILTER_DITHER = (1 << 19), + D3DX10_FILTER_DITHER_DIFFUSION= (2 << 19), + + D3DX10_FILTER_SRGB_IN = (1 << 21), + D3DX10_FILTER_SRGB_OUT = (2 << 21), + D3DX10_FILTER_SRGB = (3 << 21), +} D3DX10_FILTER_FLAG; + +//---------------------------------------------------------------------------- +// D3DX10_NORMALMAP flags: +// --------------------- +// These flags are used to control how D3DX10ComputeNormalMap generates normal +// maps. Any number of these flags may be OR'd together in any combination. +// +// D3DX10_NORMALMAP_MIRROR_U +// Indicates that pixels off the edge of the texture on the U-axis +// should be mirrored, not wraped. +// D3DX10_NORMALMAP_MIRROR_V +// Indicates that pixels off the edge of the texture on the V-axis +// should be mirrored, not wraped. +// D3DX10_NORMALMAP_MIRROR +// Same as specifying D3DX10_NORMALMAP_MIRROR_U | D3DX10_NORMALMAP_MIRROR_V +// D3DX10_NORMALMAP_INVERTSIGN +// Inverts the direction of each normal +// D3DX10_NORMALMAP_COMPUTE_OCCLUSION +// Compute the per pixel Occlusion term and encodes it into the alpha. +// An Alpha of 1 means that the pixel is not obscured in anyway, and +// an alpha of 0 would mean that the pixel is completly obscured. +// +//---------------------------------------------------------------------------- + +typedef enum D3DX10_NORMALMAP_FLAG +{ + D3DX10_NORMALMAP_MIRROR_U = (1 << 16), + D3DX10_NORMALMAP_MIRROR_V = (2 << 16), + D3DX10_NORMALMAP_MIRROR = (3 << 16), + D3DX10_NORMALMAP_INVERTSIGN = (8 << 16), + D3DX10_NORMALMAP_COMPUTE_OCCLUSION = (16 << 16), +} D3DX10_NORMALMAP_FLAG; + +//---------------------------------------------------------------------------- +// D3DX10_CHANNEL flags: +// ------------------- +// These flags are used by functions which operate on or more channels +// in a texture. +// +// D3DX10_CHANNEL_RED +// Indicates the red channel should be used +// D3DX10_CHANNEL_BLUE +// Indicates the blue channel should be used +// D3DX10_CHANNEL_GREEN +// Indicates the green channel should be used +// D3DX10_CHANNEL_ALPHA +// Indicates the alpha channel should be used +// D3DX10_CHANNEL_LUMINANCE +// Indicates the luminaces of the red green and blue channels should be +// used. +// +//---------------------------------------------------------------------------- + +typedef enum D3DX10_CHANNEL_FLAG +{ + D3DX10_CHANNEL_RED = (1 << 0), + D3DX10_CHANNEL_BLUE = (1 << 1), + D3DX10_CHANNEL_GREEN = (1 << 2), + D3DX10_CHANNEL_ALPHA = (1 << 3), + D3DX10_CHANNEL_LUMINANCE = (1 << 4), +} D3DX10_CHANNEL_FLAG; + + + +//---------------------------------------------------------------------------- +// D3DX10_IMAGE_FILE_FORMAT: +// --------------------- +// This enum is used to describe supported image file formats. +// +//---------------------------------------------------------------------------- + +typedef enum D3DX10_IMAGE_FILE_FORMAT +{ + D3DX10_IFF_BMP = 0, + D3DX10_IFF_JPG = 1, + D3DX10_IFF_PNG = 3, + D3DX10_IFF_DDS = 4, + D3DX10_IFF_TIFF = 10, + D3DX10_IFF_GIF = 11, + D3DX10_IFF_WMP = 12, + D3DX10_IFF_FORCE_DWORD = 0x7fffffff + +} D3DX10_IMAGE_FILE_FORMAT; + + +//---------------------------------------------------------------------------- +// D3DX10_SAVE_TEXTURE_FLAG: +// --------------------- +// This enum is used to support texture saving options. +// +//---------------------------------------------------------------------------- + +typedef enum D3DX10_SAVE_TEXTURE_FLAG +{ + D3DX10_STF_USEINPUTBLOB = 0x0001, +} D3DX10_SAVE_TEXTURE_FLAG; + + + +//---------------------------------------------------------------------------- +// D3DX10_IMAGE_INFO: +// --------------- +// This structure is used to return a rough description of what the +// the original contents of an image file looked like. +// +// Width +// Width of original image in pixels +// Height +// Height of original image in pixels +// Depth +// Depth of original image in pixels +// ArraySize +// Array size in textures +// MipLevels +// Number of mip levels in original image +// MiscFlags +// Miscellaneous flags +// Format +// D3D format which most closely describes the data in original image +// ResourceDimension +// D3D10_RESOURCE_DIMENSION representing the dimension of texture stored in the file. +// D3D10_RESOURCE_DIMENSION_TEXTURE1D, 2D, 3D +// ImageFileFormat +// D3DX10_IMAGE_FILE_FORMAT representing the format of the image file. +//---------------------------------------------------------------------------- + +typedef struct D3DX10_IMAGE_INFO +{ + UINT Width; + UINT Height; + UINT Depth; + UINT ArraySize; + UINT MipLevels; + UINT MiscFlags; + DXGI_FORMAT Format; + D3D10_RESOURCE_DIMENSION ResourceDimension; + D3DX10_IMAGE_FILE_FORMAT ImageFileFormat; +} D3DX10_IMAGE_INFO; + + + + + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + + + +////////////////////////////////////////////////////////////////////////////// +// Image File APIs /////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +//---------------------------------------------------------------------------- +// D3DX10_IMAGE_LOAD_INFO: +// --------------- +// This structure can be optionally passed in to texture loader APIs to +// control how textures get loaded. Pass in D3DX10_DEFAULT for any of these +// to have D3DX automatically pick defaults based on the source file. +// +// Width +// Rescale texture to Width texels wide +// Height +// Rescale texture to Height texels high +// Depth +// Rescale texture to Depth texels deep +// FirstMipLevel +// First mip level to load +// MipLevels +// Number of mip levels to load after the first level +// Usage +// D3D10_USAGE flag for the new texture +// BindFlags +// D3D10 Bind flags for the new texture +// CpuAccessFlags +// D3D10 CPU Access flags for the new texture +// MiscFlags +// Reserved. Must be 0 +// Format +// Resample texture to the specified format +// Filter +// Filter the texture using the specified filter (only when resampling) +// MipFilter +// Filter the texture mip levels using the specified filter (only if +// generating mips) +// pSrcInfo +// (optional) pointer to a D3DX10_IMAGE_INFO structure that will get +// populated with source image information +//---------------------------------------------------------------------------- + + +typedef struct D3DX10_IMAGE_LOAD_INFO +{ + UINT Width; + UINT Height; + UINT Depth; + UINT FirstMipLevel; + UINT MipLevels; + D3D10_USAGE Usage; + UINT BindFlags; + UINT CpuAccessFlags; + UINT MiscFlags; + DXGI_FORMAT Format; + UINT Filter; + UINT MipFilter; + D3DX10_IMAGE_INFO* pSrcInfo; + +#ifdef __cplusplus + D3DX10_IMAGE_LOAD_INFO() + { + Width = D3DX10_DEFAULT; + Height = D3DX10_DEFAULT; + Depth = D3DX10_DEFAULT; + FirstMipLevel = D3DX10_DEFAULT; + MipLevels = D3DX10_DEFAULT; + Usage = (D3D10_USAGE) D3DX10_DEFAULT; + BindFlags = D3DX10_DEFAULT; + CpuAccessFlags = D3DX10_DEFAULT; + MiscFlags = D3DX10_DEFAULT; + Format = DXGI_FORMAT_FROM_FILE; + Filter = D3DX10_DEFAULT; + MipFilter = D3DX10_DEFAULT; + pSrcInfo = NULL; + } +#endif + +} D3DX10_IMAGE_LOAD_INFO; + +//------------------------------------------------------------------------------- +// GetImageInfoFromFile/Resource/Memory: +// ------------------------------ +// Fills in a D3DX10_IMAGE_INFO struct with information about an image file. +// +// Parameters: +// pSrcFile +// File name of the source image. +// pSrcModule +// Module where resource is located, or NULL for module associated +// with image the os used to create the current process. +// pSrcResource +// Resource name. +// pSrcData +// Pointer to file in memory. +// SrcDataSize +// Size in bytes of file in memory. +// pPump +// Optional pointer to a thread pump object to use. +// pSrcInfo +// Pointer to a D3DX10_IMAGE_INFO structure to be filled in with the +// description of the data in the source image file. +// pHResult +// Pointer to a memory location to receive the return value upon completion. +// Maybe NULL if not needed. +// If pPump != NULL, pHResult must be a valid memory location until the +// the asynchronous execution completes. +//------------------------------------------------------------------------------- + +HRESULT WINAPI + D3DX10GetImageInfoFromFileA( + LPCSTR pSrcFile, + ID3DX10ThreadPump* pPump, + D3DX10_IMAGE_INFO* pSrcInfo, + HRESULT* pHResult); + +HRESULT WINAPI + D3DX10GetImageInfoFromFileW( + LPCWSTR pSrcFile, + ID3DX10ThreadPump* pPump, + D3DX10_IMAGE_INFO* pSrcInfo, + HRESULT* pHResult); + +#ifdef UNICODE +#define D3DX10GetImageInfoFromFile D3DX10GetImageInfoFromFileW +#else +#define D3DX10GetImageInfoFromFile D3DX10GetImageInfoFromFileA +#endif + + +HRESULT WINAPI + D3DX10GetImageInfoFromResourceA( + HMODULE hSrcModule, + LPCSTR pSrcResource, + ID3DX10ThreadPump* pPump, + D3DX10_IMAGE_INFO* pSrcInfo, + HRESULT* pHResult); + +HRESULT WINAPI + D3DX10GetImageInfoFromResourceW( + HMODULE hSrcModule, + LPCWSTR pSrcResource, + ID3DX10ThreadPump* pPump, + D3DX10_IMAGE_INFO* pSrcInfo, + HRESULT* pHResult); + +#ifdef UNICODE +#define D3DX10GetImageInfoFromResource D3DX10GetImageInfoFromResourceW +#else +#define D3DX10GetImageInfoFromResource D3DX10GetImageInfoFromResourceA +#endif + + +HRESULT WINAPI + D3DX10GetImageInfoFromMemory( + LPCVOID pSrcData, + SIZE_T SrcDataSize, + ID3DX10ThreadPump* pPump, + D3DX10_IMAGE_INFO* pSrcInfo, + HRESULT* pHResult); + + +////////////////////////////////////////////////////////////////////////////// +// Create/Save Texture APIs ////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +//---------------------------------------------------------------------------- +// D3DX10CreateTextureFromFile/Resource/Memory: +// D3DX10CreateShaderResourceViewFromFile/Resource/Memory: +// ----------------------------------- +// Create a texture object from a file or resource. +// +// Parameters: +// +// pDevice +// The D3D device with which the texture is going to be used. +// pSrcFile +// File name. +// hSrcModule +// Module handle. if NULL, current module will be used. +// pSrcResource +// Resource name in module +// pvSrcData +// Pointer to file in memory. +// SrcDataSize +// Size in bytes of file in memory. +// pLoadInfo +// Optional pointer to a D3DX10_IMAGE_LOAD_INFO structure that +// contains additional loader parameters. +// pPump +// Optional pointer to a thread pump object to use. +// ppTexture +// [out] Created texture object. +// ppShaderResourceView +// [out] Shader resource view object created. +// pHResult +// Pointer to a memory location to receive the return value upon completion. +// Maybe NULL if not needed. +// If pPump != NULL, pHResult must be a valid memory location until the +// the asynchronous execution completes. +// +//---------------------------------------------------------------------------- + + +// FromFile + +HRESULT WINAPI + D3DX10CreateShaderResourceViewFromFileA( + ID3D10Device* pDevice, + LPCSTR pSrcFile, + D3DX10_IMAGE_LOAD_INFO *pLoadInfo, + ID3DX10ThreadPump* pPump, + ID3D10ShaderResourceView** ppShaderResourceView, + HRESULT* pHResult); + +HRESULT WINAPI + D3DX10CreateShaderResourceViewFromFileW( + ID3D10Device* pDevice, + LPCWSTR pSrcFile, + D3DX10_IMAGE_LOAD_INFO *pLoadInfo, + ID3DX10ThreadPump* pPump, + ID3D10ShaderResourceView** ppShaderResourceView, + HRESULT* pHResult); + +#ifdef UNICODE +#define D3DX10CreateShaderResourceViewFromFile D3DX10CreateShaderResourceViewFromFileW +#else +#define D3DX10CreateShaderResourceViewFromFile D3DX10CreateShaderResourceViewFromFileA +#endif + +HRESULT WINAPI + D3DX10CreateTextureFromFileA( + ID3D10Device* pDevice, + LPCSTR pSrcFile, + D3DX10_IMAGE_LOAD_INFO *pLoadInfo, + ID3DX10ThreadPump* pPump, + ID3D10Resource** ppTexture, + HRESULT* pHResult); + +HRESULT WINAPI + D3DX10CreateTextureFromFileW( + ID3D10Device* pDevice, + LPCWSTR pSrcFile, + D3DX10_IMAGE_LOAD_INFO *pLoadInfo, + ID3DX10ThreadPump* pPump, + ID3D10Resource** ppTexture, + HRESULT* pHResult); + +#ifdef UNICODE +#define D3DX10CreateTextureFromFile D3DX10CreateTextureFromFileW +#else +#define D3DX10CreateTextureFromFile D3DX10CreateTextureFromFileA +#endif + + +// FromResource (resources in dll/exes) + +HRESULT WINAPI + D3DX10CreateShaderResourceViewFromResourceA( + ID3D10Device* pDevice, + HMODULE hSrcModule, + LPCSTR pSrcResource, + D3DX10_IMAGE_LOAD_INFO* pLoadInfo, + ID3DX10ThreadPump* pPump, + ID3D10ShaderResourceView** ppShaderResourceView, + HRESULT* pHResult); + +HRESULT WINAPI + D3DX10CreateShaderResourceViewFromResourceW( + ID3D10Device* pDevice, + HMODULE hSrcModule, + LPCWSTR pSrcResource, + D3DX10_IMAGE_LOAD_INFO* pLoadInfo, + ID3DX10ThreadPump* pPump, + ID3D10ShaderResourceView** ppShaderResourceView, + HRESULT* pHResult); + +#ifdef UNICODE +#define D3DX10CreateShaderResourceViewFromResource D3DX10CreateShaderResourceViewFromResourceW +#else +#define D3DX10CreateShaderResourceViewFromResource D3DX10CreateShaderResourceViewFromResourceA +#endif + +HRESULT WINAPI + D3DX10CreateTextureFromResourceA( + ID3D10Device* pDevice, + HMODULE hSrcModule, + LPCSTR pSrcResource, + D3DX10_IMAGE_LOAD_INFO *pLoadInfo, + ID3DX10ThreadPump* pPump, + ID3D10Resource** ppTexture, + HRESULT* pHResult); + +HRESULT WINAPI + D3DX10CreateTextureFromResourceW( + ID3D10Device* pDevice, + HMODULE hSrcModule, + LPCWSTR pSrcResource, + D3DX10_IMAGE_LOAD_INFO* pLoadInfo, + ID3DX10ThreadPump* pPump, + ID3D10Resource** ppTexture, + HRESULT* pHResult); + +#ifdef UNICODE +#define D3DX10CreateTextureFromResource D3DX10CreateTextureFromResourceW +#else +#define D3DX10CreateTextureFromResource D3DX10CreateTextureFromResourceA +#endif + + +// FromFileInMemory + +HRESULT WINAPI + D3DX10CreateShaderResourceViewFromMemory( + ID3D10Device* pDevice, + LPCVOID pSrcData, + SIZE_T SrcDataSize, + D3DX10_IMAGE_LOAD_INFO* pLoadInfo, + ID3DX10ThreadPump* pPump, + ID3D10ShaderResourceView** ppShaderResourceView, + HRESULT* pHResult); + +HRESULT WINAPI + D3DX10CreateTextureFromMemory( + ID3D10Device* pDevice, + LPCVOID pSrcData, + SIZE_T SrcDataSize, + D3DX10_IMAGE_LOAD_INFO* pLoadInfo, + ID3DX10ThreadPump* pPump, + ID3D10Resource** ppTexture, + HRESULT* pHResult); + + +////////////////////////////////////////////////////////////////////////////// +// Misc Texture APIs ///////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +//---------------------------------------------------------------------------- +// D3DX10_TEXTURE_LOAD_INFO: +// ------------------------ +// +//---------------------------------------------------------------------------- + +typedef struct _D3DX10_TEXTURE_LOAD_INFO +{ + D3D10_BOX *pSrcBox; + D3D10_BOX *pDstBox; + UINT SrcFirstMip; + UINT DstFirstMip; + UINT NumMips; + UINT SrcFirstElement; + UINT DstFirstElement; + UINT NumElements; + UINT Filter; + UINT MipFilter; + +#ifdef __cplusplus + _D3DX10_TEXTURE_LOAD_INFO() + { + pSrcBox = NULL; + pDstBox = NULL; + SrcFirstMip = 0; + DstFirstMip = 0; + NumMips = D3DX10_DEFAULT; + SrcFirstElement = 0; + DstFirstElement = 0; + NumElements = D3DX10_DEFAULT; + Filter = D3DX10_DEFAULT; + MipFilter = D3DX10_DEFAULT; + } +#endif + +} D3DX10_TEXTURE_LOAD_INFO; + + +//---------------------------------------------------------------------------- +// D3DX10LoadTextureFromTexture: +// ---------------------------- +// Load a texture from a texture. +// +// Parameters: +// +//---------------------------------------------------------------------------- + + +HRESULT WINAPI + D3DX10LoadTextureFromTexture( + ID3D10Resource *pSrcTexture, + D3DX10_TEXTURE_LOAD_INFO *pLoadInfo, + ID3D10Resource *pDstTexture); + + +//---------------------------------------------------------------------------- +// D3DX10FilterTexture: +// ------------------ +// Filters mipmaps levels of a texture. +// +// Parameters: +// pBaseTexture +// The texture object to be filtered +// SrcLevel +// The level whose image is used to generate the subsequent levels. +// MipFilter +// D3DX10_FILTER flags controlling how each miplevel is filtered. +// Or D3DX10_DEFAULT for D3DX10_FILTER_BOX, +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DX10FilterTexture( + ID3D10Resource *pTexture, + UINT SrcLevel, + UINT MipFilter); + + +//---------------------------------------------------------------------------- +// D3DX10SaveTextureToFile: +// ---------------------- +// Save a texture to a file. +// +// Parameters: +// pDestFile +// File name of the destination file +// DestFormat +// D3DX10_IMAGE_FILE_FORMAT specifying file format to use when saving. +// pSrcTexture +// Source texture, containing the image to be saved +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DX10SaveTextureToFileA( + ID3D10Resource *pSrcTexture, + D3DX10_IMAGE_FILE_FORMAT DestFormat, + LPCSTR pDestFile); + +HRESULT WINAPI + D3DX10SaveTextureToFileW( + ID3D10Resource *pSrcTexture, + D3DX10_IMAGE_FILE_FORMAT DestFormat, + LPCWSTR pDestFile); + +#ifdef UNICODE +#define D3DX10SaveTextureToFile D3DX10SaveTextureToFileW +#else +#define D3DX10SaveTextureToFile D3DX10SaveTextureToFileA +#endif + + +//---------------------------------------------------------------------------- +// D3DX10SaveTextureToMemory: +// ---------------------- +// Save a texture to a blob. +// +// Parameters: +// pSrcTexture +// Source texture, containing the image to be saved +// DestFormat +// D3DX10_IMAGE_FILE_FORMAT specifying file format to use when saving. +// ppDestBuf +// address of a d3dxbuffer pointer to return the image data +// Flags +// optional flags +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DX10SaveTextureToMemory( + ID3D10Resource* pSrcTexture, + D3DX10_IMAGE_FILE_FORMAT DestFormat, + LPD3D10BLOB* ppDestBuf, + UINT Flags); + + +//---------------------------------------------------------------------------- +// D3DX10ComputeNormalMap: +// --------------------- +// Converts a height map into a normal map. The (x,y,z) components of each +// normal are mapped to the (r,g,b) channels of the output texture. +// +// Parameters +// pSrcTexture +// Pointer to the source heightmap texture +// Flags +// D3DX10_NORMALMAP flags +// Channel +// D3DX10_CHANNEL specifying source of height information +// Amplitude +// The constant value which the height information is multiplied by. +// pDestTexture +// Pointer to the destination texture +//--------------------------------------------------------------------------- + +HRESULT WINAPI + D3DX10ComputeNormalMap( + ID3D10Texture2D *pSrcTexture, + UINT Flags, + UINT Channel, + FLOAT Amplitude, + ID3D10Texture2D *pDestTexture); + + +//---------------------------------------------------------------------------- +// D3DX10SHProjectCubeMap: +// ---------------------- +// Projects a function represented in a cube map into spherical harmonics. +// +// Parameters: +// Order +// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 +// pCubeMap +// CubeMap that is going to be projected into spherical harmonics +// pROut +// Output SH vector for Red. +// pGOut +// Output SH vector for Green +// pBOut +// Output SH vector for Blue +// +//--------------------------------------------------------------------------- + +HRESULT WINAPI + D3DX10SHProjectCubeMap( + __in_range(2,6) UINT Order, + ID3D10Texture2D *pCubeMap, + __out_ecount(Order*Order) FLOAT *pROut, + __out_ecount_opt(Order*Order) FLOAT *pGOut, + __out_ecount_opt(Order*Order) FLOAT *pBOut); + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif //__D3DX10TEX_H__ + diff --git a/MediaClient/MediaClient/directx/include/D3DX11.h b/MediaClient/MediaClient/directx/include/D3DX11.h new file mode 100644 index 0000000..103c782 --- /dev/null +++ b/MediaClient/MediaClient/directx/include/D3DX11.h @@ -0,0 +1,74 @@ +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx11.h +// Content: D3DX11 utility library +// +////////////////////////////////////////////////////////////////////////////// + +#ifdef __D3DX11_INTERNAL__ +#error Incorrect D3DX11 header used +#endif + +#ifndef __D3DX11_H__ +#define __D3DX11_H__ + + +// Defines +#include +#include + +#ifdef ALLOW_THROWING_NEW +#include +#endif + +#define D3DX11_DEFAULT ((UINT) -1) +#define D3DX11_FROM_FILE ((UINT) -3) +#define DXGI_FORMAT_FROM_FILE ((DXGI_FORMAT) -3) + +#ifndef D3DX11INLINE +#ifdef _MSC_VER + #if (_MSC_VER >= 1200) + #define D3DX11INLINE __forceinline + #else + #define D3DX11INLINE __inline + #endif +#else + #ifdef __cplusplus + #define D3DX11INLINE inline + #else + #define D3DX11INLINE + #endif +#endif +#endif + + + +// Includes +#include "d3d11.h" +#include "d3dx11.h" +#include "d3dx11core.h" +#include "d3dx11tex.h" +#include "d3dx11async.h" + + +// Errors +#define _FACDD 0x876 +#define MAKE_DDHRESULT( code ) MAKE_HRESULT( 1, _FACDD, code ) + +enum _D3DX11_ERR { + D3DX11_ERR_CANNOT_MODIFY_INDEX_BUFFER = MAKE_DDHRESULT(2900), + D3DX11_ERR_INVALID_MESH = MAKE_DDHRESULT(2901), + D3DX11_ERR_CANNOT_ATTR_SORT = MAKE_DDHRESULT(2902), + D3DX11_ERR_SKINNING_NOT_SUPPORTED = MAKE_DDHRESULT(2903), + D3DX11_ERR_TOO_MANY_INFLUENCES = MAKE_DDHRESULT(2904), + D3DX11_ERR_INVALID_DATA = MAKE_DDHRESULT(2905), + D3DX11_ERR_LOADED_MESH_HAS_NO_DATA = MAKE_DDHRESULT(2906), + D3DX11_ERR_DUPLICATE_NAMED_FRAGMENT = MAKE_DDHRESULT(2907), + D3DX11_ERR_CANNOT_REMOVE_LAST_ITEM = MAKE_DDHRESULT(2908), +}; + + +#endif //__D3DX11_H__ + diff --git a/MediaClient/MediaClient/directx/include/D3DX11async.h b/MediaClient/MediaClient/directx/include/D3DX11async.h new file mode 100644 index 0000000..4586c55 --- /dev/null +++ b/MediaClient/MediaClient/directx/include/D3DX11async.h @@ -0,0 +1,164 @@ + +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// File: D3DX11Async.h +// Content: D3DX11 Asynchronous Shader loaders / compilers +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef __D3DX11ASYNC_H__ +#define __D3DX11ASYNC_H__ + +#include "d3dx11.h" + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + + +//---------------------------------------------------------------------------- +// D3DX11Compile: +// ------------------ +// Compiles an effect or shader. +// +// Parameters: +// pSrcFile +// Source file name. +// hSrcModule +// Module handle. if NULL, current module will be used. +// pSrcResource +// Resource name in module. +// pSrcData +// Pointer to source code. +// SrcDataLen +// Size of source code, in bytes. +// pDefines +// Optional NULL-terminated array of preprocessor macro definitions. +// pInclude +// Optional interface pointer to use for handling #include directives. +// If this parameter is NULL, #includes will be honored when compiling +// from file, and will error when compiling from resource or memory. +// pFunctionName +// Name of the entrypoint function where execution should begin. +// pProfile +// Instruction set to be used when generating code. Currently supported +// profiles are "vs_1_1", "vs_2_0", "vs_2_a", "vs_2_sw", "vs_3_0", +// "vs_3_sw", "vs_4_0", "vs_4_1", +// "ps_2_0", "ps_2_a", "ps_2_b", "ps_2_sw", "ps_3_0", +// "ps_3_sw", "ps_4_0", "ps_4_1", +// "gs_4_0", "gs_4_1", +// "tx_1_0", +// "fx_4_0", "fx_4_1" +// Note that this entrypoint does not compile fx_2_0 targets, for that +// you need to use the D3DX9 function. +// Flags1 +// See D3D10_SHADER_xxx flags. +// Flags2 +// See D3D10_EFFECT_xxx flags. +// ppShader +// Returns a buffer containing the created shader. This buffer contains +// the compiled shader code, as well as any embedded debug and symbol +// table info. (See D3D10GetShaderConstantTable) +// ppErrorMsgs +// Returns a buffer containing a listing of errors and warnings that were +// encountered during the compile. If you are running in a debugger, +// these are the same messages you will see in your debug output. +// pHResult +// Pointer to a memory location to receive the return value upon completion. +// Maybe NULL if not needed. +// If pPump != NULL, pHResult must be a valid memory location until the +// the asynchronous execution completes. +//---------------------------------------------------------------------------- + +HRESULT WINAPI D3DX11CompileFromFileA(LPCSTR pSrcFile,CONST D3D10_SHADER_MACRO* pDefines, LPD3D10INCLUDE pInclude, + LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, ID3DX11ThreadPump* pPump, ID3D10Blob** ppShader, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult); + +HRESULT WINAPI D3DX11CompileFromFileW(LPCWSTR pSrcFile, CONST D3D10_SHADER_MACRO* pDefines, LPD3D10INCLUDE pInclude, + LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, ID3DX11ThreadPump* pPump, ID3D10Blob** ppShader, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult); + +#ifdef UNICODE +#define D3DX11CompileFromFile D3DX11CompileFromFileW +#else +#define D3DX11CompileFromFile D3DX11CompileFromFileA +#endif + +HRESULT WINAPI D3DX11CompileFromResourceA(HMODULE hSrcModule, LPCSTR pSrcResource, LPCSTR pSrcFileName, CONST D3D10_SHADER_MACRO* pDefines, + LPD3D10INCLUDE pInclude, LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, ID3DX11ThreadPump* pPump, ID3D10Blob** ppShader, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult); + +HRESULT WINAPI D3DX11CompileFromResourceW(HMODULE hSrcModule, LPCWSTR pSrcResource, LPCWSTR pSrcFileName, CONST D3D10_SHADER_MACRO* pDefines, + LPD3D10INCLUDE pInclude, LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, ID3DX11ThreadPump* pPump, ID3D10Blob** ppShader, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult); + +#ifdef UNICODE +#define D3DX11CompileFromResource D3DX11CompileFromResourceW +#else +#define D3DX11CompileFromResource D3DX11CompileFromResourceA +#endif + +HRESULT WINAPI D3DX11CompileFromMemory(LPCSTR pSrcData, SIZE_T SrcDataLen, LPCSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines, LPD3D10INCLUDE pInclude, + LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, ID3DX11ThreadPump* pPump, ID3D10Blob** ppShader, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult); + +HRESULT WINAPI D3DX11PreprocessShaderFromFileA(LPCSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines, + LPD3D10INCLUDE pInclude, ID3DX11ThreadPump *pPump, ID3D10Blob** ppShaderText, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult); + +HRESULT WINAPI D3DX11PreprocessShaderFromFileW(LPCWSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines, + LPD3D10INCLUDE pInclude, ID3DX11ThreadPump *pPump, ID3D10Blob** ppShaderText, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult); + +HRESULT WINAPI D3DX11PreprocessShaderFromMemory(LPCSTR pSrcData, SIZE_T SrcDataSize, LPCSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines, + LPD3D10INCLUDE pInclude, ID3DX11ThreadPump *pPump, ID3D10Blob** ppShaderText, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult); + +HRESULT WINAPI D3DX11PreprocessShaderFromResourceA(HMODULE hModule, LPCSTR pResourceName, LPCSTR pSrcFileName, CONST D3D10_SHADER_MACRO* pDefines, + LPD3D10INCLUDE pInclude, ID3DX11ThreadPump *pPump, ID3D10Blob** ppShaderText, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult); + +HRESULT WINAPI D3DX11PreprocessShaderFromResourceW(HMODULE hModule, LPCWSTR pResourceName, LPCWSTR pSrcFileName, CONST D3D10_SHADER_MACRO* pDefines, + LPD3D10INCLUDE pInclude, ID3DX11ThreadPump *pPump, ID3D10Blob** ppShaderText, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult); + +#ifdef UNICODE +#define D3DX11PreprocessShaderFromFile D3DX11PreprocessShaderFromFileW +#define D3DX11PreprocessShaderFromResource D3DX11PreprocessShaderFromResourceW +#else +#define D3DX11PreprocessShaderFromFile D3DX11PreprocessShaderFromFileA +#define D3DX11PreprocessShaderFromResource D3DX11PreprocessShaderFromResourceA +#endif + +//---------------------------------------------------------------------------- +// Async processors +//---------------------------------------------------------------------------- + +HRESULT WINAPI D3DX11CreateAsyncCompilerProcessor(LPCSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines, LPD3D10INCLUDE pInclude, + LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, + ID3D10Blob **ppCompiledShader, ID3D10Blob **ppErrorBuffer, ID3DX11DataProcessor **ppProcessor); + +HRESULT WINAPI D3DX11CreateAsyncShaderPreprocessProcessor(LPCSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines, LPD3D10INCLUDE pInclude, + ID3D10Blob** ppShaderText, ID3D10Blob **ppErrorBuffer, ID3DX11DataProcessor **ppProcessor); + +//---------------------------------------------------------------------------- +// D3DX11 Asynchronous texture I/O (advanced mode) +//---------------------------------------------------------------------------- + +HRESULT WINAPI D3DX11CreateAsyncFileLoaderW(LPCWSTR pFileName, ID3DX11DataLoader **ppDataLoader); +HRESULT WINAPI D3DX11CreateAsyncFileLoaderA(LPCSTR pFileName, ID3DX11DataLoader **ppDataLoader); +HRESULT WINAPI D3DX11CreateAsyncMemoryLoader(LPCVOID pData, SIZE_T cbData, ID3DX11DataLoader **ppDataLoader); +HRESULT WINAPI D3DX11CreateAsyncResourceLoaderW(HMODULE hSrcModule, LPCWSTR pSrcResource, ID3DX11DataLoader **ppDataLoader); +HRESULT WINAPI D3DX11CreateAsyncResourceLoaderA(HMODULE hSrcModule, LPCSTR pSrcResource, ID3DX11DataLoader **ppDataLoader); + +#ifdef UNICODE +#define D3DX11CreateAsyncFileLoader D3DX11CreateAsyncFileLoaderW +#define D3DX11CreateAsyncResourceLoader D3DX11CreateAsyncResourceLoaderW +#else +#define D3DX11CreateAsyncFileLoader D3DX11CreateAsyncFileLoaderA +#define D3DX11CreateAsyncResourceLoader D3DX11CreateAsyncResourceLoaderA +#endif + +HRESULT WINAPI D3DX11CreateAsyncTextureProcessor(ID3D11Device *pDevice, D3DX11_IMAGE_LOAD_INFO *pLoadInfo, ID3DX11DataProcessor **ppDataProcessor); +HRESULT WINAPI D3DX11CreateAsyncTextureInfoProcessor(D3DX11_IMAGE_INFO *pImageInfo, ID3DX11DataProcessor **ppDataProcessor); +HRESULT WINAPI D3DX11CreateAsyncShaderResourceViewProcessor(ID3D11Device *pDevice, D3DX11_IMAGE_LOAD_INFO *pLoadInfo, ID3DX11DataProcessor **ppDataProcessor); + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif //__D3DX11ASYNC_H__ + + diff --git a/MediaClient/MediaClient/directx/include/D3DX11core.h b/MediaClient/MediaClient/directx/include/D3DX11core.h new file mode 100644 index 0000000..18e9935 --- /dev/null +++ b/MediaClient/MediaClient/directx/include/D3DX11core.h @@ -0,0 +1,128 @@ +/////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx11core.h +// Content: D3DX11 core types and functions +// +/////////////////////////////////////////////////////////////////////////// + +#include "d3dx11.h" + +#ifndef __D3DX11CORE_H__ +#define __D3DX11CORE_H__ + +// Current name of the DLL shipped in the same SDK as this header. + + +#define D3DX11_DLL_W L"d3dx11_43.dll" +#define D3DX11_DLL_A "d3dx11_43.dll" + +#ifdef UNICODE + #define D3DX11_DLL D3DX11_DLL_W +#else + #define D3DX11_DLL D3DX11_DLL_A +#endif + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + +/////////////////////////////////////////////////////////////////////////// +// D3DX11_SDK_VERSION: +// ----------------- +// This identifier is passed to D3DX11CheckVersion in order to ensure that an +// application was built against the correct header files and lib files. +// This number is incremented whenever a header (or other) change would +// require applications to be rebuilt. If the version doesn't match, +// D3DX11CreateVersion will return FALSE. (The number itself has no meaning.) +/////////////////////////////////////////////////////////////////////////// + + +#define D3DX11_SDK_VERSION 43 + + +#ifdef D3D_DIAG_DLL +BOOL WINAPI D3DX11DebugMute(BOOL Mute); +#endif +HRESULT WINAPI D3DX11CheckVersion(UINT D3DSdkVersion, UINT D3DX11SdkVersion); + +#ifdef __cplusplus +} +#endif //__cplusplus + + + +////////////////////////////////////////////////////////////////////////////// +// ID3DX11ThreadPump: +////////////////////////////////////////////////////////////////////////////// + +#undef INTERFACE +#define INTERFACE ID3DX11DataLoader + +DECLARE_INTERFACE(ID3DX11DataLoader) +{ + STDMETHOD(Load)(THIS) PURE; + STDMETHOD(Decompress)(THIS_ void **ppData, SIZE_T *pcBytes) PURE; + STDMETHOD(Destroy)(THIS) PURE; +}; + +#undef INTERFACE +#define INTERFACE ID3DX11DataProcessor + +DECLARE_INTERFACE(ID3DX11DataProcessor) +{ + STDMETHOD(Process)(THIS_ void *pData, SIZE_T cBytes) PURE; + STDMETHOD(CreateDeviceObject)(THIS_ void **ppDataObject) PURE; + STDMETHOD(Destroy)(THIS) PURE; +}; + +// {C93FECFA-6967-478a-ABBC-402D90621FCB} +DEFINE_GUID(IID_ID3DX11ThreadPump, +0xc93fecfa, 0x6967, 0x478a, 0xab, 0xbc, 0x40, 0x2d, 0x90, 0x62, 0x1f, 0xcb); + +#undef INTERFACE +#define INTERFACE ID3DX11ThreadPump + +DECLARE_INTERFACE_(ID3DX11ThreadPump, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DX11ThreadPump + STDMETHOD(AddWorkItem)(THIS_ ID3DX11DataLoader *pDataLoader, ID3DX11DataProcessor *pDataProcessor, HRESULT *pHResult, void **ppDeviceObject) PURE; + STDMETHOD_(UINT, GetWorkItemCount)(THIS) PURE; + + STDMETHOD(WaitForAllItems)(THIS) PURE; + STDMETHOD(ProcessDeviceWorkItems)(THIS_ UINT iWorkItemCount); + + STDMETHOD(PurgeAllItems)(THIS) PURE; + STDMETHOD(GetQueueStatus)(THIS_ UINT *pIoQueue, UINT *pProcessQueue, UINT *pDeviceQueue) PURE; + +}; + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + +HRESULT WINAPI D3DX11CreateThreadPump(UINT cIoThreads, UINT cProcThreads, ID3DX11ThreadPump **ppThreadPump); + +HRESULT WINAPI D3DX11UnsetAllDeviceObjects(ID3D11DeviceContext *pContext); + +#ifdef __cplusplus +} +#endif //__cplusplus + +/////////////////////////////////////////////////////////////////////////// + +#define _FACD3D 0x876 +#define MAKE_D3DHRESULT( code ) MAKE_HRESULT( 1, _FACD3D, code ) +#define MAKE_D3DSTATUS( code ) MAKE_HRESULT( 0, _FACD3D, code ) + +#define D3DERR_INVALIDCALL MAKE_D3DHRESULT(2156) +#define D3DERR_WASSTILLDRAWING MAKE_D3DHRESULT(540) + +#endif //__D3DX11CORE_H__ + diff --git a/MediaClient/MediaClient/directx/include/D3DX11tex.h b/MediaClient/MediaClient/directx/include/D3DX11tex.h new file mode 100644 index 0000000..16c0409 --- /dev/null +++ b/MediaClient/MediaClient/directx/include/D3DX11tex.h @@ -0,0 +1,772 @@ +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx11tex.h +// Content: D3DX11 texturing APIs +// +////////////////////////////////////////////////////////////////////////////// + +#include "d3dx11.h" + +#ifndef __D3DX11TEX_H__ +#define __D3DX11TEX_H__ + + +//---------------------------------------------------------------------------- +// D3DX11_FILTER flags: +// ------------------ +// +// A valid filter must contain one of these values: +// +// D3DX11_FILTER_NONE +// No scaling or filtering will take place. Pixels outside the bounds +// of the source image are assumed to be transparent black. +// D3DX11_FILTER_POINT +// Each destination pixel is computed by sampling the nearest pixel +// from the source image. +// D3DX11_FILTER_LINEAR +// Each destination pixel is computed by linearly interpolating between +// the nearest pixels in the source image. This filter works best +// when the scale on each axis is less than 2. +// D3DX11_FILTER_TRIANGLE +// Every pixel in the source image contributes equally to the +// destination image. This is the slowest of all the filters. +// D3DX11_FILTER_BOX +// Each pixel is computed by averaging a 2x2(x2) box pixels from +// the source image. Only works when the dimensions of the +// destination are half those of the source. (as with mip maps) +// +// And can be OR'd with any of these optional flags: +// +// D3DX11_FILTER_MIRROR_U +// Indicates that pixels off the edge of the texture on the U-axis +// should be mirrored, not wraped. +// D3DX11_FILTER_MIRROR_V +// Indicates that pixels off the edge of the texture on the V-axis +// should be mirrored, not wraped. +// D3DX11_FILTER_MIRROR_W +// Indicates that pixels off the edge of the texture on the W-axis +// should be mirrored, not wraped. +// D3DX11_FILTER_MIRROR +// Same as specifying D3DX11_FILTER_MIRROR_U | D3DX11_FILTER_MIRROR_V | +// D3DX11_FILTER_MIRROR_V +// D3DX11_FILTER_DITHER +// Dithers the resulting image using a 4x4 order dither pattern. +// D3DX11_FILTER_SRGB_IN +// Denotes that the input data is in sRGB (gamma 2.2) colorspace. +// D3DX11_FILTER_SRGB_OUT +// Denotes that the output data is in sRGB (gamma 2.2) colorspace. +// D3DX11_FILTER_SRGB +// Same as specifying D3DX11_FILTER_SRGB_IN | D3DX11_FILTER_SRGB_OUT +// +//---------------------------------------------------------------------------- + +typedef enum D3DX11_FILTER_FLAG +{ + D3DX11_FILTER_NONE = (1 << 0), + D3DX11_FILTER_POINT = (2 << 0), + D3DX11_FILTER_LINEAR = (3 << 0), + D3DX11_FILTER_TRIANGLE = (4 << 0), + D3DX11_FILTER_BOX = (5 << 0), + + D3DX11_FILTER_MIRROR_U = (1 << 16), + D3DX11_FILTER_MIRROR_V = (2 << 16), + D3DX11_FILTER_MIRROR_W = (4 << 16), + D3DX11_FILTER_MIRROR = (7 << 16), + + D3DX11_FILTER_DITHER = (1 << 19), + D3DX11_FILTER_DITHER_DIFFUSION= (2 << 19), + + D3DX11_FILTER_SRGB_IN = (1 << 21), + D3DX11_FILTER_SRGB_OUT = (2 << 21), + D3DX11_FILTER_SRGB = (3 << 21), +} D3DX11_FILTER_FLAG; + +//---------------------------------------------------------------------------- +// D3DX11_NORMALMAP flags: +// --------------------- +// These flags are used to control how D3DX11ComputeNormalMap generates normal +// maps. Any number of these flags may be OR'd together in any combination. +// +// D3DX11_NORMALMAP_MIRROR_U +// Indicates that pixels off the edge of the texture on the U-axis +// should be mirrored, not wraped. +// D3DX11_NORMALMAP_MIRROR_V +// Indicates that pixels off the edge of the texture on the V-axis +// should be mirrored, not wraped. +// D3DX11_NORMALMAP_MIRROR +// Same as specifying D3DX11_NORMALMAP_MIRROR_U | D3DX11_NORMALMAP_MIRROR_V +// D3DX11_NORMALMAP_INVERTSIGN +// Inverts the direction of each normal +// D3DX11_NORMALMAP_COMPUTE_OCCLUSION +// Compute the per pixel Occlusion term and encodes it into the alpha. +// An Alpha of 1 means that the pixel is not obscured in anyway, and +// an alpha of 0 would mean that the pixel is completly obscured. +// +//---------------------------------------------------------------------------- + +typedef enum D3DX11_NORMALMAP_FLAG +{ + D3DX11_NORMALMAP_MIRROR_U = (1 << 16), + D3DX11_NORMALMAP_MIRROR_V = (2 << 16), + D3DX11_NORMALMAP_MIRROR = (3 << 16), + D3DX11_NORMALMAP_INVERTSIGN = (8 << 16), + D3DX11_NORMALMAP_COMPUTE_OCCLUSION = (16 << 16), +} D3DX11_NORMALMAP_FLAG; + +//---------------------------------------------------------------------------- +// D3DX11_CHANNEL flags: +// ------------------- +// These flags are used by functions which operate on or more channels +// in a texture. +// +// D3DX11_CHANNEL_RED +// Indicates the red channel should be used +// D3DX11_CHANNEL_BLUE +// Indicates the blue channel should be used +// D3DX11_CHANNEL_GREEN +// Indicates the green channel should be used +// D3DX11_CHANNEL_ALPHA +// Indicates the alpha channel should be used +// D3DX11_CHANNEL_LUMINANCE +// Indicates the luminaces of the red green and blue channels should be +// used. +// +//---------------------------------------------------------------------------- + +typedef enum D3DX11_CHANNEL_FLAG +{ + D3DX11_CHANNEL_RED = (1 << 0), + D3DX11_CHANNEL_BLUE = (1 << 1), + D3DX11_CHANNEL_GREEN = (1 << 2), + D3DX11_CHANNEL_ALPHA = (1 << 3), + D3DX11_CHANNEL_LUMINANCE = (1 << 4), +} D3DX11_CHANNEL_FLAG; + + + +//---------------------------------------------------------------------------- +// D3DX11_IMAGE_FILE_FORMAT: +// --------------------- +// This enum is used to describe supported image file formats. +// +//---------------------------------------------------------------------------- + +typedef enum D3DX11_IMAGE_FILE_FORMAT +{ + D3DX11_IFF_BMP = 0, + D3DX11_IFF_JPG = 1, + D3DX11_IFF_PNG = 3, + D3DX11_IFF_DDS = 4, + D3DX11_IFF_TIFF = 10, + D3DX11_IFF_GIF = 11, + D3DX11_IFF_WMP = 12, + D3DX11_IFF_FORCE_DWORD = 0x7fffffff + +} D3DX11_IMAGE_FILE_FORMAT; + + +//---------------------------------------------------------------------------- +// D3DX11_SAVE_TEXTURE_FLAG: +// --------------------- +// This enum is used to support texture saving options. +// +//---------------------------------------------------------------------------- + +typedef enum D3DX11_SAVE_TEXTURE_FLAG +{ + D3DX11_STF_USEINPUTBLOB = 0x0001, +} D3DX11_SAVE_TEXTURE_FLAG; + + +//---------------------------------------------------------------------------- +// D3DX11_IMAGE_INFO: +// --------------- +// This structure is used to return a rough description of what the +// the original contents of an image file looked like. +// +// Width +// Width of original image in pixels +// Height +// Height of original image in pixels +// Depth +// Depth of original image in pixels +// ArraySize +// Array size in textures +// MipLevels +// Number of mip levels in original image +// MiscFlags +// Miscellaneous flags +// Format +// D3D format which most closely describes the data in original image +// ResourceDimension +// D3D11_RESOURCE_DIMENSION representing the dimension of texture stored in the file. +// D3D11_RESOURCE_DIMENSION_TEXTURE1D, 2D, 3D +// ImageFileFormat +// D3DX11_IMAGE_FILE_FORMAT representing the format of the image file. +//---------------------------------------------------------------------------- + +typedef struct D3DX11_IMAGE_INFO +{ + UINT Width; + UINT Height; + UINT Depth; + UINT ArraySize; + UINT MipLevels; + UINT MiscFlags; + DXGI_FORMAT Format; + D3D11_RESOURCE_DIMENSION ResourceDimension; + D3DX11_IMAGE_FILE_FORMAT ImageFileFormat; +} D3DX11_IMAGE_INFO; + + + + + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + + + +////////////////////////////////////////////////////////////////////////////// +// Image File APIs /////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +//---------------------------------------------------------------------------- +// D3DX11_IMAGE_LOAD_INFO: +// --------------- +// This structure can be optionally passed in to texture loader APIs to +// control how textures get loaded. Pass in D3DX11_DEFAULT for any of these +// to have D3DX automatically pick defaults based on the source file. +// +// Width +// Rescale texture to Width texels wide +// Height +// Rescale texture to Height texels high +// Depth +// Rescale texture to Depth texels deep +// FirstMipLevel +// First mip level to load +// MipLevels +// Number of mip levels to load after the first level +// Usage +// D3D11_USAGE flag for the new texture +// BindFlags +// D3D11 Bind flags for the new texture +// CpuAccessFlags +// D3D11 CPU Access flags for the new texture +// MiscFlags +// Reserved. Must be 0 +// Format +// Resample texture to the specified format +// Filter +// Filter the texture using the specified filter (only when resampling) +// MipFilter +// Filter the texture mip levels using the specified filter (only if +// generating mips) +// pSrcInfo +// (optional) pointer to a D3DX11_IMAGE_INFO structure that will get +// populated with source image information +//---------------------------------------------------------------------------- + + +typedef struct D3DX11_IMAGE_LOAD_INFO +{ + UINT Width; + UINT Height; + UINT Depth; + UINT FirstMipLevel; + UINT MipLevels; + D3D11_USAGE Usage; + UINT BindFlags; + UINT CpuAccessFlags; + UINT MiscFlags; + DXGI_FORMAT Format; + UINT Filter; + UINT MipFilter; + D3DX11_IMAGE_INFO* pSrcInfo; + +#ifdef __cplusplus + D3DX11_IMAGE_LOAD_INFO() + { + Width = D3DX11_DEFAULT; + Height = D3DX11_DEFAULT; + Depth = D3DX11_DEFAULT; + FirstMipLevel = D3DX11_DEFAULT; + MipLevels = D3DX11_DEFAULT; + Usage = (D3D11_USAGE) D3DX11_DEFAULT; + BindFlags = D3DX11_DEFAULT; + CpuAccessFlags = D3DX11_DEFAULT; + MiscFlags = D3DX11_DEFAULT; + Format = DXGI_FORMAT_FROM_FILE; + Filter = D3DX11_DEFAULT; + MipFilter = D3DX11_DEFAULT; + pSrcInfo = NULL; + } +#endif + +} D3DX11_IMAGE_LOAD_INFO; + +//------------------------------------------------------------------------------- +// GetImageInfoFromFile/Resource/Memory: +// ------------------------------ +// Fills in a D3DX11_IMAGE_INFO struct with information about an image file. +// +// Parameters: +// pSrcFile +// File name of the source image. +// pSrcModule +// Module where resource is located, or NULL for module associated +// with image the os used to create the current process. +// pSrcResource +// Resource name. +// pSrcData +// Pointer to file in memory. +// SrcDataSize +// Size in bytes of file in memory. +// pPump +// Optional pointer to a thread pump object to use. +// pSrcInfo +// Pointer to a D3DX11_IMAGE_INFO structure to be filled in with the +// description of the data in the source image file. +// pHResult +// Pointer to a memory location to receive the return value upon completion. +// Maybe NULL if not needed. +// If pPump != NULL, pHResult must be a valid memory location until the +// the asynchronous execution completes. +//------------------------------------------------------------------------------- + +HRESULT WINAPI + D3DX11GetImageInfoFromFileA( + LPCSTR pSrcFile, + ID3DX11ThreadPump* pPump, + D3DX11_IMAGE_INFO* pSrcInfo, + HRESULT* pHResult); + +HRESULT WINAPI + D3DX11GetImageInfoFromFileW( + LPCWSTR pSrcFile, + ID3DX11ThreadPump* pPump, + D3DX11_IMAGE_INFO* pSrcInfo, + HRESULT* pHResult); + +#ifdef UNICODE +#define D3DX11GetImageInfoFromFile D3DX11GetImageInfoFromFileW +#else +#define D3DX11GetImageInfoFromFile D3DX11GetImageInfoFromFileA +#endif + + +HRESULT WINAPI + D3DX11GetImageInfoFromResourceA( + HMODULE hSrcModule, + LPCSTR pSrcResource, + ID3DX11ThreadPump* pPump, + D3DX11_IMAGE_INFO* pSrcInfo, + HRESULT* pHResult); + +HRESULT WINAPI + D3DX11GetImageInfoFromResourceW( + HMODULE hSrcModule, + LPCWSTR pSrcResource, + ID3DX11ThreadPump* pPump, + D3DX11_IMAGE_INFO* pSrcInfo, + HRESULT* pHResult); + +#ifdef UNICODE +#define D3DX11GetImageInfoFromResource D3DX11GetImageInfoFromResourceW +#else +#define D3DX11GetImageInfoFromResource D3DX11GetImageInfoFromResourceA +#endif + + +HRESULT WINAPI + D3DX11GetImageInfoFromMemory( + LPCVOID pSrcData, + SIZE_T SrcDataSize, + ID3DX11ThreadPump* pPump, + D3DX11_IMAGE_INFO* pSrcInfo, + HRESULT* pHResult); + + +////////////////////////////////////////////////////////////////////////////// +// Create/Save Texture APIs ////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +//---------------------------------------------------------------------------- +// D3DX11CreateTextureFromFile/Resource/Memory: +// D3DX11CreateShaderResourceViewFromFile/Resource/Memory: +// ----------------------------------- +// Create a texture object from a file or resource. +// +// Parameters: +// +// pDevice +// The D3D device with which the texture is going to be used. +// pSrcFile +// File name. +// hSrcModule +// Module handle. if NULL, current module will be used. +// pSrcResource +// Resource name in module +// pvSrcData +// Pointer to file in memory. +// SrcDataSize +// Size in bytes of file in memory. +// pLoadInfo +// Optional pointer to a D3DX11_IMAGE_LOAD_INFO structure that +// contains additional loader parameters. +// pPump +// Optional pointer to a thread pump object to use. +// ppTexture +// [out] Created texture object. +// ppShaderResourceView +// [out] Shader resource view object created. +// pHResult +// Pointer to a memory location to receive the return value upon completion. +// Maybe NULL if not needed. +// If pPump != NULL, pHResult must be a valid memory location until the +// the asynchronous execution completes. +// +//---------------------------------------------------------------------------- + + +// FromFile + +HRESULT WINAPI + D3DX11CreateShaderResourceViewFromFileA( + ID3D11Device* pDevice, + LPCSTR pSrcFile, + D3DX11_IMAGE_LOAD_INFO *pLoadInfo, + ID3DX11ThreadPump* pPump, + ID3D11ShaderResourceView** ppShaderResourceView, + HRESULT* pHResult); + +HRESULT WINAPI + D3DX11CreateShaderResourceViewFromFileW( + ID3D11Device* pDevice, + LPCWSTR pSrcFile, + D3DX11_IMAGE_LOAD_INFO *pLoadInfo, + ID3DX11ThreadPump* pPump, + ID3D11ShaderResourceView** ppShaderResourceView, + HRESULT* pHResult); + +#ifdef UNICODE +#define D3DX11CreateShaderResourceViewFromFile D3DX11CreateShaderResourceViewFromFileW +#else +#define D3DX11CreateShaderResourceViewFromFile D3DX11CreateShaderResourceViewFromFileA +#endif + +HRESULT WINAPI + D3DX11CreateTextureFromFileA( + ID3D11Device* pDevice, + LPCSTR pSrcFile, + D3DX11_IMAGE_LOAD_INFO *pLoadInfo, + ID3DX11ThreadPump* pPump, + ID3D11Resource** ppTexture, + HRESULT* pHResult); + +HRESULT WINAPI + D3DX11CreateTextureFromFileW( + ID3D11Device* pDevice, + LPCWSTR pSrcFile, + D3DX11_IMAGE_LOAD_INFO *pLoadInfo, + ID3DX11ThreadPump* pPump, + ID3D11Resource** ppTexture, + HRESULT* pHResult); + +#ifdef UNICODE +#define D3DX11CreateTextureFromFile D3DX11CreateTextureFromFileW +#else +#define D3DX11CreateTextureFromFile D3DX11CreateTextureFromFileA +#endif + + +// FromResource (resources in dll/exes) + +HRESULT WINAPI + D3DX11CreateShaderResourceViewFromResourceA( + ID3D11Device* pDevice, + HMODULE hSrcModule, + LPCSTR pSrcResource, + D3DX11_IMAGE_LOAD_INFO* pLoadInfo, + ID3DX11ThreadPump* pPump, + ID3D11ShaderResourceView** ppShaderResourceView, + HRESULT* pHResult); + +HRESULT WINAPI + D3DX11CreateShaderResourceViewFromResourceW( + ID3D11Device* pDevice, + HMODULE hSrcModule, + LPCWSTR pSrcResource, + D3DX11_IMAGE_LOAD_INFO* pLoadInfo, + ID3DX11ThreadPump* pPump, + ID3D11ShaderResourceView** ppShaderResourceView, + HRESULT* pHResult); + +#ifdef UNICODE +#define D3DX11CreateShaderResourceViewFromResource D3DX11CreateShaderResourceViewFromResourceW +#else +#define D3DX11CreateShaderResourceViewFromResource D3DX11CreateShaderResourceViewFromResourceA +#endif + +HRESULT WINAPI + D3DX11CreateTextureFromResourceA( + ID3D11Device* pDevice, + HMODULE hSrcModule, + LPCSTR pSrcResource, + D3DX11_IMAGE_LOAD_INFO *pLoadInfo, + ID3DX11ThreadPump* pPump, + ID3D11Resource** ppTexture, + HRESULT* pHResult); + +HRESULT WINAPI + D3DX11CreateTextureFromResourceW( + ID3D11Device* pDevice, + HMODULE hSrcModule, + LPCWSTR pSrcResource, + D3DX11_IMAGE_LOAD_INFO* pLoadInfo, + ID3DX11ThreadPump* pPump, + ID3D11Resource** ppTexture, + HRESULT* pHResult); + +#ifdef UNICODE +#define D3DX11CreateTextureFromResource D3DX11CreateTextureFromResourceW +#else +#define D3DX11CreateTextureFromResource D3DX11CreateTextureFromResourceA +#endif + + +// FromFileInMemory + +HRESULT WINAPI + D3DX11CreateShaderResourceViewFromMemory( + ID3D11Device* pDevice, + LPCVOID pSrcData, + SIZE_T SrcDataSize, + D3DX11_IMAGE_LOAD_INFO* pLoadInfo, + ID3DX11ThreadPump* pPump, + ID3D11ShaderResourceView** ppShaderResourceView, + HRESULT* pHResult); + +HRESULT WINAPI + D3DX11CreateTextureFromMemory( + ID3D11Device* pDevice, + LPCVOID pSrcData, + SIZE_T SrcDataSize, + D3DX11_IMAGE_LOAD_INFO* pLoadInfo, + ID3DX11ThreadPump* pPump, + ID3D11Resource** ppTexture, + HRESULT* pHResult); + + +////////////////////////////////////////////////////////////////////////////// +// Misc Texture APIs ///////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +//---------------------------------------------------------------------------- +// D3DX11_TEXTURE_LOAD_INFO: +// ------------------------ +// +//---------------------------------------------------------------------------- + +typedef struct _D3DX11_TEXTURE_LOAD_INFO +{ + D3D11_BOX *pSrcBox; + D3D11_BOX *pDstBox; + UINT SrcFirstMip; + UINT DstFirstMip; + UINT NumMips; + UINT SrcFirstElement; + UINT DstFirstElement; + UINT NumElements; + UINT Filter; + UINT MipFilter; + +#ifdef __cplusplus + _D3DX11_TEXTURE_LOAD_INFO() + { + pSrcBox = NULL; + pDstBox = NULL; + SrcFirstMip = 0; + DstFirstMip = 0; + NumMips = D3DX11_DEFAULT; + SrcFirstElement = 0; + DstFirstElement = 0; + NumElements = D3DX11_DEFAULT; + Filter = D3DX11_DEFAULT; + MipFilter = D3DX11_DEFAULT; + } +#endif + +} D3DX11_TEXTURE_LOAD_INFO; + + +//---------------------------------------------------------------------------- +// D3DX11LoadTextureFromTexture: +// ---------------------------- +// Load a texture from a texture. +// +// Parameters: +// +//---------------------------------------------------------------------------- + + +HRESULT WINAPI + D3DX11LoadTextureFromTexture( + ID3D11DeviceContext *pContext, + ID3D11Resource *pSrcTexture, + D3DX11_TEXTURE_LOAD_INFO *pLoadInfo, + ID3D11Resource *pDstTexture); + + +//---------------------------------------------------------------------------- +// D3DX11FilterTexture: +// ------------------ +// Filters mipmaps levels of a texture. +// +// Parameters: +// pBaseTexture +// The texture object to be filtered +// SrcLevel +// The level whose image is used to generate the subsequent levels. +// MipFilter +// D3DX11_FILTER flags controlling how each miplevel is filtered. +// Or D3DX11_DEFAULT for D3DX11_FILTER_BOX, +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DX11FilterTexture( + ID3D11DeviceContext *pContext, + ID3D11Resource *pTexture, + UINT SrcLevel, + UINT MipFilter); + + +//---------------------------------------------------------------------------- +// D3DX11SaveTextureToFile: +// ---------------------- +// Save a texture to a file. +// +// Parameters: +// pDestFile +// File name of the destination file +// DestFormat +// D3DX11_IMAGE_FILE_FORMAT specifying file format to use when saving. +// pSrcTexture +// Source texture, containing the image to be saved +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DX11SaveTextureToFileA( + ID3D11DeviceContext *pContext, + ID3D11Resource *pSrcTexture, + D3DX11_IMAGE_FILE_FORMAT DestFormat, + LPCSTR pDestFile); + +HRESULT WINAPI + D3DX11SaveTextureToFileW( + ID3D11DeviceContext *pContext, + ID3D11Resource *pSrcTexture, + D3DX11_IMAGE_FILE_FORMAT DestFormat, + LPCWSTR pDestFile); + +#ifdef UNICODE +#define D3DX11SaveTextureToFile D3DX11SaveTextureToFileW +#else +#define D3DX11SaveTextureToFile D3DX11SaveTextureToFileA +#endif + + +//---------------------------------------------------------------------------- +// D3DX11SaveTextureToMemory: +// ---------------------- +// Save a texture to a blob. +// +// Parameters: +// pSrcTexture +// Source texture, containing the image to be saved +// DestFormat +// D3DX11_IMAGE_FILE_FORMAT specifying file format to use when saving. +// ppDestBuf +// address of a d3dxbuffer pointer to return the image data +// Flags +// optional flags +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DX11SaveTextureToMemory( + ID3D11DeviceContext *pContext, + ID3D11Resource* pSrcTexture, + D3DX11_IMAGE_FILE_FORMAT DestFormat, + ID3D10Blob** ppDestBuf, + UINT Flags); + + +//---------------------------------------------------------------------------- +// D3DX11ComputeNormalMap: +// --------------------- +// Converts a height map into a normal map. The (x,y,z) components of each +// normal are mapped to the (r,g,b) channels of the output texture. +// +// Parameters +// pSrcTexture +// Pointer to the source heightmap texture +// Flags +// D3DX11_NORMALMAP flags +// Channel +// D3DX11_CHANNEL specifying source of height information +// Amplitude +// The constant value which the height information is multiplied by. +// pDestTexture +// Pointer to the destination texture +//--------------------------------------------------------------------------- + +HRESULT WINAPI + D3DX11ComputeNormalMap( + ID3D11DeviceContext *pContext, + ID3D11Texture2D *pSrcTexture, + UINT Flags, + UINT Channel, + FLOAT Amplitude, + ID3D11Texture2D *pDestTexture); + + +//---------------------------------------------------------------------------- +// D3DX11SHProjectCubeMap: +// ---------------------- +// Projects a function represented in a cube map into spherical harmonics. +// +// Parameters: +// Order +// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 +// pCubeMap +// CubeMap that is going to be projected into spherical harmonics +// pROut +// Output SH vector for Red. +// pGOut +// Output SH vector for Green +// pBOut +// Output SH vector for Blue +// +//--------------------------------------------------------------------------- + +HRESULT WINAPI + D3DX11SHProjectCubeMap( + ID3D11DeviceContext *pContext, + __in_range(2,6) UINT Order, + ID3D11Texture2D *pCubeMap, + __out_ecount(Order*Order) FLOAT *pROut, + __out_ecount_opt(Order*Order) FLOAT *pGOut, + __out_ecount_opt(Order*Order) FLOAT *pBOut); + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif //__D3DX11TEX_H__ + diff --git a/MediaClient/MediaClient/directx/include/D3DX_DXGIFormatConvert.inl b/MediaClient/MediaClient/directx/include/D3DX_DXGIFormatConvert.inl new file mode 100644 index 0000000..1cfba72 --- /dev/null +++ b/MediaClient/MediaClient/directx/include/D3DX_DXGIFormatConvert.inl @@ -0,0 +1,800 @@ +//============================================================================= +// D3D11 HLSL Routines for Manual Pack/Unpack of 32-bit DXGI_FORMAT_* +//============================================================================= +// +// This file contains format conversion routines for use in the +// Compute Shader or Pixel Shader on D3D11 Hardware. +// +// Skip to the end of this comment to see a summary of the routines +// provided. The rest of the text below explains why they are needed +// and how to use them. +// +// The scenario where these can be useful is if your application +// needs to simultaneously both read and write texture - i.e. in-place +// image editing. +// +// D3D11's Unordered Access View (UAV) of a Texture1D/2D/3D resource +// allows random access reads and writes to memory from a Compute Shader +// or Pixel Shader. However, the only texture format that supports this +// is DXGI_FORMAT_R32_UINT. e.g. Other more interesting formats like +// DXGI_FORMAT_R8G8B8A8_UNORM do not support simultaneous read and +// write. You can use such formats for random access writing only +// using a UAV, or reading only using a Shader Resource View (SRV). +// But for simultaneous read+write, the format conversion hardware is +// not available. +// +// There is a workaround to this limitation, involving casting the texture +// to R32_UINT when creating a UAV, as long as the original format of the +// resource supports it (most 32 bit per element formats). This allows +// simultaneous read+write as long as the shader does manual format +// unpacking on read and packing on write. +// +// The benefit is that later on, other views such as RenderTarget Views +// or ShaderResource Views on the same texture can be used with the +// proper format (e.g. DXGI_FORMAT_R16G16_FLOAT) so the hardware can +// do the usual automatic format unpack/pack and do texture filtering etc. +// where there are no hardware limitations. +// +// The sequence of actions for an application is the following: +// +// Suppose you want to make a texture than you can use a Pixel Shader +// or Compute Shader to perform in-place editing, and that the format +// you want the data to be stored in happens to be a descendent +// of of one of these formats: +// +// DXGI_FORMAT_R10G10B10A2_TYPELESS +// DXGI_FORMAT_R8G8B8A8_TYPELESS +// DXGI_FORMAT_B8G8R8A8_TYPELESS +// DXGI_FORMAT_B8G8R8X8_TYPELESS +// DXGI_FORMAT_R16G16_TYPELESS +// +// e.g. DXGI_FORMAT_R10G10B10A2_UNORM is a descendent of +// DXGI_FORMAT_R10G10B10A2_TYPELESS, so it supports the +// usage pattern described here. +// +// (Formats descending from DXGI_FORMAT_R32_TYPELESS, such as +// DXGI_FORMAT_R32_FLOAT, are trivially supported without +// needing any of the format conversion help provided here.) +// +// Steps: +// +// (1) Create a texture with the appropriate _TYPELESS format above +// along with the needed bind flags, such as +// D3D11_BIND_UNORDERED_ACCESS | D3D11_BIND_SHADER_RESOURCE. +// +// (2) For in-place image editing, create a UAV with the format +// DXGI_FORMAT_R32_UINT. D3D normally doesn't allow casting +// between different format "families", but the API makes +// an exception here. +// +// (3) In the Compute Shader or Pixel Shader, use the appropriate +// format pack/unpack routines provided in this file. +// For example if the DXGI_FORMAT_R32_UINT UAV really holds +// DXGI_FORMAT_R10G10B10A2_UNORM data, then, after reading a +// uint from the UAV into the shader, unpack by calling: +// +// XMFLOAT4 D3DX_R10G10B10A2_UNORM_to_FLOAT4(UINT packedInput) +// +// Then to write to the UAV in the same shader, call the following +// to pack shader data into a uint that can be written out: +// +// UINT D3DX_FLOAT4_to_R10G10B10A2_UNORM(hlsl_precise XMFLOAT4 unpackedInput) +// +// (4) Other views, such as SRVs, can be created with the desired format; +// e.g. DXGI_FORMAT_R10G10B10A2_UNORM if the resource was created as +// DXGI_FORMAT_R10G10B10A2_TYPELESS. When that view is accessed by a +// shader, the hardware can do automatic type conversion as usual. +// +// Note, again, that if the shader only needs to write to a UAV, or read +// as an SRV, then none of this is needed - fully typed UAV or SRVs can +// be used. Only if simultaneous reading and writing to a UAV of a texture +// is needed are the format conversion routines provided here potentially +// useful. +// +// The following is the list of format conversion routines included in this +// file, categorized by the DXGI_FORMAT they unpack/pack. Each of the +// formats supported descends from one of the TYPELESS formats listed +// above, and supports casting to DXGI_FORMAT_R32_UINT as a UAV. +// +// DXGI_FORMAT_R10G10B10A2_UNORM: +// +// XMFLOAT4 D3DX_R10G10B10A2_UNORM_to_FLOAT4(UINT packedInput) +// UINT D3DX_FLOAT4_to_R10G10B10A2_UNORM(hlsl_precise XMFLOAT4 unpackedInput) +// +// DXGI_FORMAT_R10G10B10A2_UINT: +// +// XMUINT4 D3DX_R10G10B10A2_UINT_to_UINT4(UINT packedInput) +// UINT D3DX_UINT4_to_R10G10B10A2_UINT(XMUINT4 unpackedInput) +// +// DXGI_FORMAT_R8G8B8A8_UNORM: +// +// XMFLOAT4 D3DX_R8G8B8A8_UNORM_to_FLOAT4(UINT packedInput) +// UINT D3DX_FLOAT4_to_R8G8B8A8_UNORM(hlsl_precise XMFLOAT4 unpackedInput) +// +// DXGI_FORMAT_R8G8B8A8_UNORM_SRGB: +// +// XMFLOAT4 D3DX_R8G8B8A8_UNORM_SRGB_to_FLOAT4_inexact(UINT packedInput) * +// XMFLOAT4 D3DX_R8G8B8A8_UNORM_SRGB_to_FLOAT4(UINT packedInput) +// UINT D3DX_FLOAT4_to_R8G8B8A8_UNORM_SRGB(hlsl_precise XMFLOAT4 unpackedInput) +// +// * The "_inexact" function above uses shader instructions that don't +// have high enough precision to give the exact answer, albeit close. +// The alternative function uses a lookup table stored in the shader +// to give an exact SRGB->float conversion. +// +// DXGI_FORMAT_R8G8B8A8_UINT: +// +// XMUINT4 D3DX_R8G8B8A8_UINT_to_UINT4(UINT packedInput) +// XMUINT D3DX_UINT4_to_R8G8B8A8_UINT(XMUINT4 unpackedInput) +// +// DXGI_FORMAT_R8G8B8A8_SNORM: +// +// XMFLOAT4 D3DX_R8G8B8A8_SNORM_to_FLOAT4(UINT packedInput) +// UINT D3DX_FLOAT4_to_R8G8B8A8_SNORM(hlsl_precise XMFLOAT4 unpackedInput) +// +// DXGI_FORMAT_R8G8B8A8_SINT: +// +// XMINT4 D3DX_R8G8B8A8_SINT_to_INT4(UINT packedInput) +// UINT D3DX_INT4_to_R8G8B8A8_SINT(XMINT4 unpackedInput) +// +// DXGI_FORMAT_B8G8R8A8_UNORM: +// +// XMFLOAT4 D3DX_B8G8R8A8_UNORM_to_FLOAT4(UINT packedInput) +// UINT D3DX_FLOAT4_to_B8G8R8A8_UNORM(hlsl_precise XMFLOAT4 unpackedInput) +// +// DXGI_FORMAT_B8G8R8A8_UNORM_SRGB: +// +// XMFLOAT4 D3DX_B8G8R8A8_UNORM_SRGB_to_FLOAT4_inexact(UINT packedInput) * +// XMFLOAT4 D3DX_B8G8R8A8_UNORM_SRGB_to_FLOAT4(UINT packedInput) +// UINT D3DX_FLOAT4_to_R8G8B8A8_UNORM_SRGB(hlsl_precise XMFLOAT4 unpackedInput) +// +// * The "_inexact" function above uses shader instructions that don't +// have high enough precision to give the exact answer, albeit close. +// The alternative function uses a lookup table stored in the shader +// to give an exact SRGB->float conversion. +// +// DXGI_FORMAT_B8G8R8X8_UNORM: +// +// XMFLOAT3 D3DX_B8G8R8X8_UNORM_to_FLOAT3(UINT packedInput) +// UINT D3DX_FLOAT3_to_B8G8R8X8_UNORM(hlsl_precise XMFLOAT3 unpackedInput) +// +// DXGI_FORMAT_B8G8R8X8_UNORM_SRGB: +// +// XMFLOAT3 D3DX_B8G8R8X8_UNORM_SRGB_to_FLOAT3_inexact(UINT packedInput) * +// XMFLOAT3 D3DX_B8G8R8X8_UNORM_SRGB_to_FLOAT3(UINT packedInput) +// UINT D3DX_FLOAT3_to_B8G8R8X8_UNORM_SRGB(hlsl_precise XMFLOAT3 unpackedInput) +// +// * The "_inexact" function above uses shader instructions that don't +// have high enough precision to give the exact answer, albeit close. +// The alternative function uses a lookup table stored in the shader +// to give an exact SRGB->float conversion. +// +// DXGI_FORMAT_R16G16_FLOAT: +// +// XMFLOAT2 D3DX_R16G16_FLOAT_to_FLOAT2(UINT packedInput) +// UINT D3DX_FLOAT2_to_R16G16_FLOAT(hlsl_precise XMFLOAT2 unpackedInput) +// +// DXGI_FORMAT_R16G16_UNORM: +// +// XMFLOAT2 D3DX_R16G16_UNORM_to_FLOAT2(UINT packedInput) +// UINT D3DX_FLOAT2_to_R16G16_UNORM(hlsl_precise FLOAT2 unpackedInput) +// +// DXGI_FORMAT_R16G16_UINT: +// +// XMUINT2 D3DX_R16G16_UINT_to_UINT2(UINT packedInput) +// UINT D3DX_UINT2_to_R16G16_UINT(XMUINT2 unpackedInput) +// +// DXGI_FORMAT_R16G16_SNORM: +// +// XMFLOAT2 D3DX_R16G16_SNORM_to_FLOAT2(UINT packedInput) +// UINT D3DX_FLOAT2_to_R16G16_SNORM(hlsl_precise XMFLOAT2 unpackedInput) +// +// DXGI_FORMAT_R16G16_SINT: +// +// XMINT2 D3DX_R16G16_SINT_to_INT2(UINT packedInput) +// UINT D3DX_INT2_to_R16G16_SINT(XMINT2 unpackedInput) +// +//============================================================================= + +#ifndef __D3DX_DXGI_FORMAT_CONVERT_INL___ +#define __D3DX_DXGI_FORMAT_CONVERT_INL___ + +#if HLSL_VERSION > 0 + +#define D3DX11INLINE + +typedef int INT; +typedef uint UINT; + +typedef float2 XMFLOAT2; +typedef float3 XMFLOAT3; +typedef float4 XMFLOAT4; +typedef int2 XMINT2; +typedef int4 XMINT4; +typedef uint2 XMUINT2; +typedef uint4 XMUINT4; + +#define hlsl_precise precise + +#define D3DX_Saturate_FLOAT(_V) saturate(_V) +#define D3DX_IsNan(_V) isnan(_V) +#define D3DX_Truncate_FLOAT(_V) trunc(_V) + +#else // HLSL_VERSION > 0 + +#ifndef __cplusplus +#error C++ compilation required +#endif + +#include +#include + +#define hlsl_precise + +D3DX11INLINE FLOAT D3DX_Saturate_FLOAT(FLOAT _V) +{ + return min(max(_V, 0), 1); +} +D3DX11INLINE bool D3DX_IsNan(FLOAT _V) +{ + return _V != _V; +} +D3DX11INLINE FLOAT D3DX_Truncate_FLOAT(FLOAT _V) +{ + return _V >= 0 ? floor(_V) : ceil(_V); +} + +// 2D Vector; 32 bit signed integer components +typedef struct _XMINT2 +{ + INT x; + INT y; +} XMINT2; + +// 2D Vector; 32 bit unsigned integer components +typedef struct _XMUINT2 +{ + UINT x; + UINT y; +} XMUINT2; + +// 4D Vector; 32 bit signed integer components +typedef struct _XMINT4 +{ + INT x; + INT y; + INT z; + INT w; +} XMINT4; + +// 4D Vector; 32 bit unsigned integer components +typedef struct _XMUINT4 +{ + UINT x; + UINT y; + UINT z; + UINT w; +} XMUINT4; + +#endif // HLSL_VERSION > 0 + +//============================================================================= +// SRGB Helper Functions Called By Conversions Further Below. +//============================================================================= +// SRGB_to_FLOAT_inexact is imprecise due to precision of pow implementations. +// If exact SRGB->float conversion is needed, a table lookup is provided +// further below. +D3DX11INLINE FLOAT D3DX_SRGB_to_FLOAT_inexact(hlsl_precise FLOAT val) +{ + if( val < 0.04045f ) + val /= 12.92f; + else + val = pow((val + 0.055f)/1.055f,2.4f); + return val; +} + +static const UINT D3DX_SRGBTable[] = +{ + 0x00000000,0x399f22b4,0x3a1f22b4,0x3a6eb40e,0x3a9f22b4,0x3ac6eb61,0x3aeeb40e,0x3b0b3e5d, + 0x3b1f22b4,0x3b33070b,0x3b46eb61,0x3b5b518d,0x3b70f18d,0x3b83e1c6,0x3b8fe616,0x3b9c87fd, + 0x3ba9c9b7,0x3bb7ad6f,0x3bc63549,0x3bd56361,0x3be539c1,0x3bf5ba70,0x3c0373b5,0x3c0c6152, + 0x3c15a703,0x3c1f45be,0x3c293e6b,0x3c3391f7,0x3c3e4149,0x3c494d43,0x3c54b6c7,0x3c607eb1, + 0x3c6ca5df,0x3c792d22,0x3c830aa8,0x3c89af9f,0x3c9085db,0x3c978dc5,0x3c9ec7c2,0x3ca63433, + 0x3cadd37d,0x3cb5a601,0x3cbdac20,0x3cc5e639,0x3cce54ab,0x3cd6f7d5,0x3cdfd010,0x3ce8ddb9, + 0x3cf2212c,0x3cfb9ac1,0x3d02a569,0x3d0798dc,0x3d0ca7e6,0x3d11d2af,0x3d171963,0x3d1c7c2e, + 0x3d21fb3c,0x3d2796b2,0x3d2d4ebb,0x3d332380,0x3d39152b,0x3d3f23e3,0x3d454fd1,0x3d4b991c, + 0x3d51ffef,0x3d58846a,0x3d5f26b7,0x3d65e6fe,0x3d6cc564,0x3d73c20f,0x3d7add29,0x3d810b67, + 0x3d84b795,0x3d887330,0x3d8c3e4a,0x3d9018f6,0x3d940345,0x3d97fd4a,0x3d9c0716,0x3da020bb, + 0x3da44a4b,0x3da883d7,0x3daccd70,0x3db12728,0x3db59112,0x3dba0b3b,0x3dbe95b5,0x3dc33092, + 0x3dc7dbe2,0x3dcc97b6,0x3dd1641f,0x3dd6412c,0x3ddb2eef,0x3de02d77,0x3de53cd5,0x3dea5d19, + 0x3def8e52,0x3df4d091,0x3dfa23e8,0x3dff8861,0x3e027f07,0x3e054280,0x3e080ea3,0x3e0ae378, + 0x3e0dc105,0x3e10a754,0x3e13966b,0x3e168e52,0x3e198f10,0x3e1c98ad,0x3e1fab30,0x3e22c6a3, + 0x3e25eb09,0x3e29186c,0x3e2c4ed0,0x3e2f8e41,0x3e32d6c4,0x3e362861,0x3e39831e,0x3e3ce703, + 0x3e405416,0x3e43ca5f,0x3e4749e4,0x3e4ad2ae,0x3e4e64c2,0x3e520027,0x3e55a4e6,0x3e595303, + 0x3e5d0a8b,0x3e60cb7c,0x3e6495e0,0x3e6869bf,0x3e6c4720,0x3e702e0c,0x3e741e84,0x3e781890, + 0x3e7c1c38,0x3e8014c2,0x3e82203c,0x3e84308d,0x3e8645ba,0x3e885fc5,0x3e8a7eb2,0x3e8ca283, + 0x3e8ecb3d,0x3e90f8e1,0x3e932b74,0x3e9562f8,0x3e979f71,0x3e99e0e2,0x3e9c274e,0x3e9e72b7, + 0x3ea0c322,0x3ea31892,0x3ea57308,0x3ea7d289,0x3eaa3718,0x3eaca0b7,0x3eaf0f69,0x3eb18333, + 0x3eb3fc18,0x3eb67a18,0x3eb8fd37,0x3ebb8579,0x3ebe12e1,0x3ec0a571,0x3ec33d2d,0x3ec5da17, + 0x3ec87c33,0x3ecb2383,0x3ecdd00b,0x3ed081cd,0x3ed338cc,0x3ed5f50b,0x3ed8b68d,0x3edb7d54, + 0x3ede4965,0x3ee11ac1,0x3ee3f16b,0x3ee6cd67,0x3ee9aeb6,0x3eec955d,0x3eef815d,0x3ef272ba, + 0x3ef56976,0x3ef86594,0x3efb6717,0x3efe6e02,0x3f00bd2d,0x3f02460e,0x3f03d1a7,0x3f055ff9, + 0x3f06f106,0x3f0884cf,0x3f0a1b56,0x3f0bb49b,0x3f0d50a0,0x3f0eef67,0x3f1090f1,0x3f12353e, + 0x3f13dc51,0x3f15862b,0x3f1732cd,0x3f18e239,0x3f1a946f,0x3f1c4971,0x3f1e0141,0x3f1fbbdf, + 0x3f21794e,0x3f23398e,0x3f24fca0,0x3f26c286,0x3f288b41,0x3f2a56d3,0x3f2c253d,0x3f2df680, + 0x3f2fca9e,0x3f31a197,0x3f337b6c,0x3f355820,0x3f3737b3,0x3f391a26,0x3f3aff7c,0x3f3ce7b5, + 0x3f3ed2d2,0x3f40c0d4,0x3f42b1be,0x3f44a590,0x3f469c4b,0x3f4895f1,0x3f4a9282,0x3f4c9201, + 0x3f4e946e,0x3f5099cb,0x3f52a218,0x3f54ad57,0x3f56bb8a,0x3f58ccb0,0x3f5ae0cd,0x3f5cf7e0, + 0x3f5f11ec,0x3f612eee,0x3f634eef,0x3f6571e9,0x3f6797e3,0x3f69c0d6,0x3f6beccd,0x3f6e1bbf, + 0x3f704db8,0x3f7282af,0x3f74baae,0x3f76f5ae,0x3f7933b9,0x3f7b74c6,0x3f7db8e0,0x3f800000 +}; + +D3DX11INLINE FLOAT D3DX_SRGB_to_FLOAT(UINT val) +{ +#if HLSL_VERSION > 0 + return asfloat(D3DX_SRGBTable[val]); +#else + return *(FLOAT*)&D3DX_SRGBTable[val]; +#endif +} + +D3DX11INLINE FLOAT D3DX_FLOAT_to_SRGB(hlsl_precise FLOAT val) +{ + if( val < 0.0031308f ) + val *= 12.92f; + else + val = 1.055f * pow(val,1.0f/2.4f) - 0.055f; + return val; +} + +D3DX11INLINE FLOAT D3DX_SaturateSigned_FLOAT(FLOAT _V) +{ + if (D3DX_IsNan(_V)) + { + return 0; + } + + return min(max(_V, -1), 1); +} + +D3DX11INLINE UINT D3DX_FLOAT_to_UINT(FLOAT _V, + FLOAT _Scale) +{ + return (UINT)floor(_V * _Scale + 0.5f); +} + +D3DX11INLINE FLOAT D3DX_INT_to_FLOAT(INT _V, + FLOAT _Scale) +{ + FLOAT Scaled = (FLOAT)_V / _Scale; + // The integer is a two's-complement signed + // number so the negative range is slightly + // larger than the positive range, meaning + // the scaled value can be slight less than -1. + // Clamp to keep the float range [-1, 1]. + return max(Scaled, -1.0f); +} + +D3DX11INLINE INT D3DX_FLOAT_to_INT(FLOAT _V, + FLOAT _Scale) +{ + return (INT)D3DX_Truncate_FLOAT(_V * _Scale + (_V >= 0 ? 0.5f : -0.5f)); +} + +//============================================================================= +// Conversion routines +//============================================================================= +//----------------------------------------------------------------------------- +// R10B10G10A2_UNORM <-> FLOAT4 +//----------------------------------------------------------------------------- +D3DX11INLINE XMFLOAT4 D3DX_R10G10B10A2_UNORM_to_FLOAT4(UINT packedInput) +{ + hlsl_precise XMFLOAT4 unpackedOutput; + unpackedOutput.x = (FLOAT) (packedInput & 0x000003ff) / 1023; + unpackedOutput.y = (FLOAT)(((packedInput>>10) & 0x000003ff)) / 1023; + unpackedOutput.z = (FLOAT)(((packedInput>>20) & 0x000003ff)) / 1023; + unpackedOutput.w = (FLOAT)(((packedInput>>30) & 0x00000003)) / 3; + return unpackedOutput; +} + +D3DX11INLINE UINT D3DX_FLOAT4_to_R10G10B10A2_UNORM(hlsl_precise XMFLOAT4 unpackedInput) +{ + UINT packedOutput; + packedOutput = ( (D3DX_FLOAT_to_UINT(D3DX_Saturate_FLOAT(unpackedInput.x), 1023)) | + (D3DX_FLOAT_to_UINT(D3DX_Saturate_FLOAT(unpackedInput.y), 1023)<<10) | + (D3DX_FLOAT_to_UINT(D3DX_Saturate_FLOAT(unpackedInput.z), 1023)<<20) | + (D3DX_FLOAT_to_UINT(D3DX_Saturate_FLOAT(unpackedInput.w), 3)<<30) ); + return packedOutput; +} + +//----------------------------------------------------------------------------- +// R10B10G10A2_UINT <-> UINT4 +//----------------------------------------------------------------------------- +D3DX11INLINE XMUINT4 D3DX_R10G10B10A2_UINT_to_UINT4(UINT packedInput) +{ + XMUINT4 unpackedOutput; + unpackedOutput.x = packedInput & 0x000003ff; + unpackedOutput.y = (packedInput>>10) & 0x000003ff; + unpackedOutput.z = (packedInput>>20) & 0x000003ff; + unpackedOutput.w = (packedInput>>30) & 0x00000003; + return unpackedOutput; +} + +D3DX11INLINE UINT D3DX_UINT4_to_R10G10B10A2_UINT(XMUINT4 unpackedInput) +{ + UINT packedOutput; + unpackedInput.x = min(unpackedInput.x, 0x000003ff); + unpackedInput.y = min(unpackedInput.y, 0x000003ff); + unpackedInput.z = min(unpackedInput.z, 0x000003ff); + unpackedInput.w = min(unpackedInput.w, 0x00000003); + packedOutput = ( (unpackedInput.x) | + ((unpackedInput.y)<<10) | + ((unpackedInput.z)<<20) | + ((unpackedInput.w)<<30) ); + return packedOutput; +} + +//----------------------------------------------------------------------------- +// R8G8B8A8_UNORM <-> FLOAT4 +//----------------------------------------------------------------------------- +D3DX11INLINE XMFLOAT4 D3DX_R8G8B8A8_UNORM_to_FLOAT4(UINT packedInput) +{ + hlsl_precise XMFLOAT4 unpackedOutput; + unpackedOutput.x = (FLOAT) (packedInput & 0x000000ff) / 255; + unpackedOutput.y = (FLOAT)(((packedInput>> 8) & 0x000000ff)) / 255; + unpackedOutput.z = (FLOAT)(((packedInput>>16) & 0x000000ff)) / 255; + unpackedOutput.w = (FLOAT) (packedInput>>24) / 255; + return unpackedOutput; +} + +D3DX11INLINE UINT D3DX_FLOAT4_to_R8G8B8A8_UNORM(hlsl_precise XMFLOAT4 unpackedInput) +{ + UINT packedOutput; + packedOutput = ( (D3DX_FLOAT_to_UINT(D3DX_Saturate_FLOAT(unpackedInput.x), 255)) | + (D3DX_FLOAT_to_UINT(D3DX_Saturate_FLOAT(unpackedInput.y), 255)<< 8) | + (D3DX_FLOAT_to_UINT(D3DX_Saturate_FLOAT(unpackedInput.z), 255)<<16) | + (D3DX_FLOAT_to_UINT(D3DX_Saturate_FLOAT(unpackedInput.w), 255)<<24) ); + return packedOutput; +} + +//----------------------------------------------------------------------------- +// R8G8B8A8_UNORM_SRGB <-> FLOAT4 +//----------------------------------------------------------------------------- +D3DX11INLINE XMFLOAT4 D3DX_R8G8B8A8_UNORM_SRGB_to_FLOAT4_inexact(UINT packedInput) +{ + hlsl_precise XMFLOAT4 unpackedOutput; + unpackedOutput.x = D3DX_SRGB_to_FLOAT_inexact(((FLOAT) (packedInput & 0x000000ff) )/255); + unpackedOutput.y = D3DX_SRGB_to_FLOAT_inexact(((FLOAT)(((packedInput>> 8) & 0x000000ff)))/255); + unpackedOutput.z = D3DX_SRGB_to_FLOAT_inexact(((FLOAT)(((packedInput>>16) & 0x000000ff)))/255); + unpackedOutput.w = (FLOAT)(packedInput>>24) / 255; + return unpackedOutput; +} + +D3DX11INLINE XMFLOAT4 D3DX_R8G8B8A8_UNORM_SRGB_to_FLOAT4(UINT packedInput) +{ + hlsl_precise XMFLOAT4 unpackedOutput; + unpackedOutput.x = D3DX_SRGB_to_FLOAT( (packedInput & 0x000000ff) ); + unpackedOutput.y = D3DX_SRGB_to_FLOAT((((packedInput>> 8) & 0x000000ff))); + unpackedOutput.z = D3DX_SRGB_to_FLOAT((((packedInput>>16) & 0x000000ff))); + unpackedOutput.w = (FLOAT)(packedInput>>24) / 255; + return unpackedOutput; +} + +D3DX11INLINE UINT D3DX_FLOAT4_to_R8G8B8A8_UNORM_SRGB(hlsl_precise XMFLOAT4 unpackedInput) +{ + UINT packedOutput; + unpackedInput.x = D3DX_FLOAT_to_SRGB(D3DX_Saturate_FLOAT(unpackedInput.x)); + unpackedInput.y = D3DX_FLOAT_to_SRGB(D3DX_Saturate_FLOAT(unpackedInput.y)); + unpackedInput.z = D3DX_FLOAT_to_SRGB(D3DX_Saturate_FLOAT(unpackedInput.z)); + unpackedInput.w = D3DX_Saturate_FLOAT(unpackedInput.w); + packedOutput = ( (D3DX_FLOAT_to_UINT(unpackedInput.x, 255)) | + (D3DX_FLOAT_to_UINT(unpackedInput.y, 255)<< 8) | + (D3DX_FLOAT_to_UINT(unpackedInput.z, 255)<<16) | + (D3DX_FLOAT_to_UINT(unpackedInput.w, 255)<<24) ); + return packedOutput; +} + +//----------------------------------------------------------------------------- +// R8G8B8A8_UINT <-> UINT4 +//----------------------------------------------------------------------------- +D3DX11INLINE XMUINT4 D3DX_R8G8B8A8_UINT_to_UINT4(UINT packedInput) +{ + XMUINT4 unpackedOutput; + unpackedOutput.x = packedInput & 0x000000ff; + unpackedOutput.y = (packedInput>> 8) & 0x000000ff; + unpackedOutput.z = (packedInput>>16) & 0x000000ff; + unpackedOutput.w = packedInput>>24; + return unpackedOutput; +} + +D3DX11INLINE UINT D3DX_UINT4_to_R8G8B8A8_UINT(XMUINT4 unpackedInput) +{ + UINT packedOutput; + unpackedInput.x = min(unpackedInput.x, 0x000000ff); + unpackedInput.y = min(unpackedInput.y, 0x000000ff); + unpackedInput.z = min(unpackedInput.z, 0x000000ff); + unpackedInput.w = min(unpackedInput.w, 0x000000ff); + packedOutput = ( unpackedInput.x | + (unpackedInput.y<< 8) | + (unpackedInput.z<<16) | + (unpackedInput.w<<24) ); + return packedOutput; +} + +//----------------------------------------------------------------------------- +// R8G8B8A8_SNORM <-> FLOAT4 +//----------------------------------------------------------------------------- +D3DX11INLINE XMFLOAT4 D3DX_R8G8B8A8_SNORM_to_FLOAT4(UINT packedInput) +{ + hlsl_precise XMFLOAT4 unpackedOutput; + XMINT4 signExtendedBits; + signExtendedBits.x = (INT)(packedInput << 24) >> 24; + signExtendedBits.y = (INT)((packedInput << 16) & 0xff000000) >> 24; + signExtendedBits.z = (INT)((packedInput << 8) & 0xff000000) >> 24; + signExtendedBits.w = (INT)(packedInput & 0xff000000) >> 24; + unpackedOutput.x = D3DX_INT_to_FLOAT(signExtendedBits.x, 127); + unpackedOutput.y = D3DX_INT_to_FLOAT(signExtendedBits.y, 127); + unpackedOutput.z = D3DX_INT_to_FLOAT(signExtendedBits.z, 127); + unpackedOutput.w = D3DX_INT_to_FLOAT(signExtendedBits.w, 127); + return unpackedOutput; +} + +D3DX11INLINE UINT D3DX_FLOAT4_to_R8G8B8A8_SNORM(hlsl_precise XMFLOAT4 unpackedInput) +{ + UINT packedOutput; + packedOutput = ( (D3DX_FLOAT_to_INT(D3DX_SaturateSigned_FLOAT(unpackedInput.x), 127) & 0x000000ff) | + ((D3DX_FLOAT_to_INT(D3DX_SaturateSigned_FLOAT(unpackedInput.y), 127) & 0x000000ff)<< 8) | + ((D3DX_FLOAT_to_INT(D3DX_SaturateSigned_FLOAT(unpackedInput.z), 127) & 0x000000ff)<<16) | + ((D3DX_FLOAT_to_INT(D3DX_SaturateSigned_FLOAT(unpackedInput.w), 127)) <<24) ); + return packedOutput; +} + +//----------------------------------------------------------------------------- +// R8G8B8A8_SINT <-> INT4 +//----------------------------------------------------------------------------- +D3DX11INLINE XMINT4 D3DX_R8G8B8A8_SINT_to_INT4(UINT packedInput) +{ + XMINT4 unpackedOutput; + unpackedOutput.x = (INT)(packedInput << 24) >> 24; + unpackedOutput.y = (INT)((packedInput << 16) & 0xff000000) >> 24; + unpackedOutput.z = (INT)((packedInput << 8) & 0xff000000) >> 24; + unpackedOutput.w = (INT)(packedInput & 0xff000000) >> 24; + return unpackedOutput; +} + +D3DX11INLINE UINT D3DX_INT4_to_R8G8B8A8_SINT(XMINT4 unpackedInput) +{ + UINT packedOutput; + unpackedInput.x = max(min(unpackedInput.x,127),-128); + unpackedInput.y = max(min(unpackedInput.y,127),-128); + unpackedInput.z = max(min(unpackedInput.z,127),-128); + unpackedInput.w = max(min(unpackedInput.w,127),-128); + packedOutput = ( (unpackedInput.x & 0x000000ff) | + ((unpackedInput.y & 0x000000ff)<< 8) | + ((unpackedInput.z & 0x000000ff)<<16) | + (unpackedInput.w <<24) ); + return packedOutput; +} + +//----------------------------------------------------------------------------- +// B8G8R8A8_UNORM <-> FLOAT4 +//----------------------------------------------------------------------------- +D3DX11INLINE XMFLOAT4 D3DX_B8G8R8A8_UNORM_to_FLOAT4(UINT packedInput) +{ + hlsl_precise XMFLOAT4 unpackedOutput; + unpackedOutput.z = (FLOAT) (packedInput & 0x000000ff) / 255; + unpackedOutput.y = (FLOAT)(((packedInput>> 8) & 0x000000ff)) / 255; + unpackedOutput.x = (FLOAT)(((packedInput>>16) & 0x000000ff)) / 255; + unpackedOutput.w = (FLOAT) (packedInput>>24) / 255; + return unpackedOutput; +} + +D3DX11INLINE UINT D3DX_FLOAT4_to_B8G8R8A8_UNORM(hlsl_precise XMFLOAT4 unpackedInput) +{ + UINT packedOutput; + packedOutput = ( (D3DX_FLOAT_to_UINT(D3DX_Saturate_FLOAT(unpackedInput.z), 255)) | + (D3DX_FLOAT_to_UINT(D3DX_Saturate_FLOAT(unpackedInput.y), 255)<< 8) | + (D3DX_FLOAT_to_UINT(D3DX_Saturate_FLOAT(unpackedInput.x), 255)<<16) | + (D3DX_FLOAT_to_UINT(D3DX_Saturate_FLOAT(unpackedInput.w), 255)<<24) ); + return packedOutput; +} + +//----------------------------------------------------------------------------- +// B8G8R8A8_UNORM_SRGB <-> FLOAT4 +//----------------------------------------------------------------------------- +D3DX11INLINE XMFLOAT4 D3DX_B8G8R8A8_UNORM_SRGB_to_FLOAT4_inexact(UINT packedInput) +{ + hlsl_precise XMFLOAT4 unpackedOutput; + unpackedOutput.z = D3DX_SRGB_to_FLOAT_inexact(((FLOAT) (packedInput & 0x000000ff) )/255); + unpackedOutput.y = D3DX_SRGB_to_FLOAT_inexact(((FLOAT)(((packedInput>> 8) & 0x000000ff)))/255); + unpackedOutput.x = D3DX_SRGB_to_FLOAT_inexact(((FLOAT)(((packedInput>>16) & 0x000000ff)))/255); + unpackedOutput.w = (FLOAT)(packedInput>>24) / 255; + return unpackedOutput; +} + +D3DX11INLINE XMFLOAT4 D3DX_B8G8R8A8_UNORM_SRGB_to_FLOAT4(UINT packedInput) +{ + hlsl_precise XMFLOAT4 unpackedOutput; + unpackedOutput.z = D3DX_SRGB_to_FLOAT( (packedInput & 0x000000ff) ); + unpackedOutput.y = D3DX_SRGB_to_FLOAT((((packedInput>> 8) & 0x000000ff))); + unpackedOutput.x = D3DX_SRGB_to_FLOAT((((packedInput>>16) & 0x000000ff))); + unpackedOutput.w = (FLOAT)(packedInput>>24) / 255; + return unpackedOutput; +} + +D3DX11INLINE UINT D3DX_FLOAT4_to_B8G8R8A8_UNORM_SRGB(hlsl_precise XMFLOAT4 unpackedInput) +{ + UINT packedOutput; + unpackedInput.z = D3DX_FLOAT_to_SRGB(D3DX_Saturate_FLOAT(unpackedInput.z)); + unpackedInput.y = D3DX_FLOAT_to_SRGB(D3DX_Saturate_FLOAT(unpackedInput.y)); + unpackedInput.x = D3DX_FLOAT_to_SRGB(D3DX_Saturate_FLOAT(unpackedInput.x)); + unpackedInput.w = D3DX_Saturate_FLOAT(unpackedInput.w); + packedOutput = ( (D3DX_FLOAT_to_UINT(unpackedInput.z, 255)) | + (D3DX_FLOAT_to_UINT(unpackedInput.y, 255)<< 8) | + (D3DX_FLOAT_to_UINT(unpackedInput.x, 255)<<16) | + (D3DX_FLOAT_to_UINT(unpackedInput.w, 255)<<24) ); + return packedOutput; +} + +//----------------------------------------------------------------------------- +// B8G8R8X8_UNORM <-> FLOAT3 +//----------------------------------------------------------------------------- +D3DX11INLINE XMFLOAT3 D3DX_B8G8R8X8_UNORM_to_FLOAT3(UINT packedInput) +{ + hlsl_precise XMFLOAT3 unpackedOutput; + unpackedOutput.z = (FLOAT) (packedInput & 0x000000ff) / 255; + unpackedOutput.y = (FLOAT)(((packedInput>> 8) & 0x000000ff)) / 255; + unpackedOutput.x = (FLOAT)(((packedInput>>16) & 0x000000ff)) / 255; + return unpackedOutput; +} + +D3DX11INLINE UINT D3DX_FLOAT3_to_B8G8R8X8_UNORM(hlsl_precise XMFLOAT3 unpackedInput) +{ + UINT packedOutput; + packedOutput = ( (D3DX_FLOAT_to_UINT(D3DX_Saturate_FLOAT(unpackedInput.z), 255)) | + (D3DX_FLOAT_to_UINT(D3DX_Saturate_FLOAT(unpackedInput.y), 255)<< 8) | + (D3DX_FLOAT_to_UINT(D3DX_Saturate_FLOAT(unpackedInput.x), 255)<<16) ); + return packedOutput; +} + +//----------------------------------------------------------------------------- +// B8G8R8X8_UNORM_SRGB <-> FLOAT3 +//----------------------------------------------------------------------------- +D3DX11INLINE XMFLOAT3 D3DX_B8G8R8X8_UNORM_SRGB_to_FLOAT3_inexact(UINT packedInput) +{ + hlsl_precise XMFLOAT3 unpackedOutput; + unpackedOutput.z = D3DX_SRGB_to_FLOAT_inexact(((FLOAT) (packedInput & 0x000000ff) )/255); + unpackedOutput.y = D3DX_SRGB_to_FLOAT_inexact(((FLOAT)(((packedInput>> 8) & 0x000000ff)))/255); + unpackedOutput.x = D3DX_SRGB_to_FLOAT_inexact(((FLOAT)(((packedInput>>16) & 0x000000ff)))/255); + return unpackedOutput; +} + +D3DX11INLINE XMFLOAT3 D3DX_B8G8R8X8_UNORM_SRGB_to_FLOAT3(UINT packedInput) +{ + hlsl_precise XMFLOAT3 unpackedOutput; + unpackedOutput.z = D3DX_SRGB_to_FLOAT( (packedInput & 0x000000ff) ); + unpackedOutput.y = D3DX_SRGB_to_FLOAT((((packedInput>> 8) & 0x000000ff))); + unpackedOutput.x = D3DX_SRGB_to_FLOAT((((packedInput>>16) & 0x000000ff))); + return unpackedOutput; +} + +D3DX11INLINE UINT D3DX_FLOAT3_to_B8G8R8X8_UNORM_SRGB(hlsl_precise XMFLOAT3 unpackedInput) +{ + UINT packedOutput; + unpackedInput.z = D3DX_FLOAT_to_SRGB(D3DX_Saturate_FLOAT(unpackedInput.z)); + unpackedInput.y = D3DX_FLOAT_to_SRGB(D3DX_Saturate_FLOAT(unpackedInput.y)); + unpackedInput.x = D3DX_FLOAT_to_SRGB(D3DX_Saturate_FLOAT(unpackedInput.x)); + packedOutput = ( (D3DX_FLOAT_to_UINT(unpackedInput.z, 255)) | + (D3DX_FLOAT_to_UINT(unpackedInput.y, 255)<< 8) | + (D3DX_FLOAT_to_UINT(unpackedInput.x, 255)<<16) ); + return packedOutput; +} + +//----------------------------------------------------------------------------- +// R16G16_FLOAT <-> FLOAT2 +//----------------------------------------------------------------------------- + +#if HLSL_VERSION > 0 + +D3DX11INLINE XMFLOAT2 D3DX_R16G16_FLOAT_to_FLOAT2(UINT packedInput) +{ + hlsl_precise XMFLOAT2 unpackedOutput; + unpackedOutput.x = f16tof32(packedInput&0x0000ffff); + unpackedOutput.y = f16tof32(packedInput>>16); + return unpackedOutput; +} + +D3DX11INLINE UINT D3DX_FLOAT2_to_R16G16_FLOAT(hlsl_precise XMFLOAT2 unpackedInput) +{ + UINT packedOutput; + packedOutput = asuint(f32tof16(unpackedInput.x)) | + (asuint(f32tof16(unpackedInput.y)) << 16); + return packedOutput; +} + +#endif // HLSL_VERSION > 0 + +//----------------------------------------------------------------------------- +// R16G16_UNORM <-> FLOAT2 +//----------------------------------------------------------------------------- +D3DX11INLINE XMFLOAT2 D3DX_R16G16_UNORM_to_FLOAT2(UINT packedInput) +{ + hlsl_precise XMFLOAT2 unpackedOutput; + unpackedOutput.x = (FLOAT) (packedInput & 0x0000ffff) / 65535; + unpackedOutput.y = (FLOAT) (packedInput>>16) / 65535; + return unpackedOutput; +} + +D3DX11INLINE UINT D3DX_FLOAT2_to_R16G16_UNORM(hlsl_precise XMFLOAT2 unpackedInput) +{ + UINT packedOutput; + packedOutput = ( (D3DX_FLOAT_to_UINT(D3DX_Saturate_FLOAT(unpackedInput.x), 65535)) | + (D3DX_FLOAT_to_UINT(D3DX_Saturate_FLOAT(unpackedInput.y), 65535)<< 16) ); + return packedOutput; +} + +//----------------------------------------------------------------------------- +// R16G16_UINT <-> UINT2 +//----------------------------------------------------------------------------- +D3DX11INLINE XMUINT2 D3DX_R16G16_UINT_to_UINT2(UINT packedInput) +{ + XMUINT2 unpackedOutput; + unpackedOutput.x = packedInput & 0x0000ffff; + unpackedOutput.y = packedInput>>16; + return unpackedOutput; +} + +D3DX11INLINE UINT D3DX_UINT2_to_R16G16_UINT(XMUINT2 unpackedInput) +{ + UINT packedOutput; + unpackedInput.x = min(unpackedInput.x,0x0000ffff); + unpackedInput.y = min(unpackedInput.y,0x0000ffff); + packedOutput = ( unpackedInput.x | + (unpackedInput.y<<16) ); + return packedOutput; +} + +//----------------------------------------------------------------------------- +// R16G16_SNORM <-> FLOAT2 +//----------------------------------------------------------------------------- +D3DX11INLINE XMFLOAT2 D3DX_R16G16_SNORM_to_FLOAT2(UINT packedInput) +{ + hlsl_precise XMFLOAT2 unpackedOutput; + XMINT2 signExtendedBits; + signExtendedBits.x = (INT)(packedInput << 16) >> 16; + signExtendedBits.y = (INT)(packedInput & 0xffff0000) >> 16; + unpackedOutput.x = D3DX_INT_to_FLOAT(signExtendedBits.x, 32767); + unpackedOutput.y = D3DX_INT_to_FLOAT(signExtendedBits.y, 32767); + return unpackedOutput; +} + +D3DX11INLINE UINT D3DX_FLOAT2_to_R16G16_SNORM(hlsl_precise XMFLOAT2 unpackedInput) +{ + UINT packedOutput; + packedOutput = ( (D3DX_FLOAT_to_INT(D3DX_SaturateSigned_FLOAT(unpackedInput.x), 32767) & 0x0000ffff) | + (D3DX_FLOAT_to_INT(D3DX_SaturateSigned_FLOAT(unpackedInput.y), 32767) <<16) ); + return packedOutput; +} + +//----------------------------------------------------------------------------- +// R16G16_SINT <-> INT2 +//----------------------------------------------------------------------------- +D3DX11INLINE XMINT2 D3DX_R16G16_SINT_to_INT2(UINT packedInput) +{ + XMINT2 unpackedOutput; + unpackedOutput.x = (INT)(packedInput << 16) >> 16; + unpackedOutput.y = (INT)(packedInput & 0xffff0000) >> 16; + return unpackedOutput; +} + +D3DX11INLINE UINT D3DX_INT2_to_R16G16_SINT(XMINT2 unpackedInput) +{ + UINT packedOutput; + unpackedInput.x = max(min(unpackedInput.x,32767),-32768); + unpackedInput.y = max(min(unpackedInput.y,32767),-32768); + packedOutput = ( (unpackedInput.x & 0x0000ffff) | + (unpackedInput.y <<16) ); + return packedOutput; +} + +#endif // __D3DX_DXGI_FORMAT_CONVERT_INL___ diff --git a/MediaClient/MediaClient/directx/include/D3Dcommon.h b/MediaClient/MediaClient/directx/include/D3Dcommon.h new file mode 100644 index 0000000..032b8b5 --- /dev/null +++ b/MediaClient/MediaClient/directx/include/D3Dcommon.h @@ -0,0 +1,787 @@ + + +/* this ALWAYS GENERATED file contains the definitions for the interfaces */ + + + /* File created by MIDL compiler version 7.00.0555 */ +/* @@MIDL_FILE_HEADING( ) */ + +#pragma warning( disable: 4049 ) /* more than 64k source lines */ + + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCNDR_H_VERSION__ +#define __REQUIRED_RPCNDR_H_VERSION__ 475 +#endif + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCSAL_H_VERSION__ +#define __REQUIRED_RPCSAL_H_VERSION__ 100 +#endif + +#include "rpc.h" +#include "rpcndr.h" + +#ifndef __RPCNDR_H_VERSION__ +#error this stub requires an updated version of +#endif // __RPCNDR_H_VERSION__ + +#ifndef COM_NO_WINDOWS_H +#include "windows.h" +#include "ole2.h" +#endif /*COM_NO_WINDOWS_H*/ + +#ifndef __d3dcommon_h__ +#define __d3dcommon_h__ + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +/* Forward Declarations */ + +#ifndef __ID3D10Blob_FWD_DEFINED__ +#define __ID3D10Blob_FWD_DEFINED__ +typedef interface ID3D10Blob ID3D10Blob; +#endif /* __ID3D10Blob_FWD_DEFINED__ */ + + +/* header files for imported files */ +#include "oaidl.h" +#include "ocidl.h" + +#ifdef __cplusplus +extern "C"{ +#endif + + +/* interface __MIDL_itf_d3dcommon_0000_0000 */ +/* [local] */ + +typedef +enum D3D_DRIVER_TYPE + { D3D_DRIVER_TYPE_UNKNOWN = 0, + D3D_DRIVER_TYPE_HARDWARE = ( D3D_DRIVER_TYPE_UNKNOWN + 1 ) , + D3D_DRIVER_TYPE_REFERENCE = ( D3D_DRIVER_TYPE_HARDWARE + 1 ) , + D3D_DRIVER_TYPE_NULL = ( D3D_DRIVER_TYPE_REFERENCE + 1 ) , + D3D_DRIVER_TYPE_SOFTWARE = ( D3D_DRIVER_TYPE_NULL + 1 ) , + D3D_DRIVER_TYPE_WARP = ( D3D_DRIVER_TYPE_SOFTWARE + 1 ) + } D3D_DRIVER_TYPE; + +typedef +enum D3D_FEATURE_LEVEL + { D3D_FEATURE_LEVEL_9_1 = 0x9100, + D3D_FEATURE_LEVEL_9_2 = 0x9200, + D3D_FEATURE_LEVEL_9_3 = 0x9300, + D3D_FEATURE_LEVEL_10_0 = 0xa000, + D3D_FEATURE_LEVEL_10_1 = 0xa100, + D3D_FEATURE_LEVEL_11_0 = 0xb000 + } D3D_FEATURE_LEVEL; + +typedef +enum D3D_PRIMITIVE_TOPOLOGY + { D3D_PRIMITIVE_TOPOLOGY_UNDEFINED = 0, + D3D_PRIMITIVE_TOPOLOGY_POINTLIST = 1, + D3D_PRIMITIVE_TOPOLOGY_LINELIST = 2, + D3D_PRIMITIVE_TOPOLOGY_LINESTRIP = 3, + D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST = 4, + D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP = 5, + D3D_PRIMITIVE_TOPOLOGY_LINELIST_ADJ = 10, + D3D_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ = 11, + D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ = 12, + D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ = 13, + D3D_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST = 33, + D3D_PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST = 34, + D3D_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST = 35, + D3D_PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST = 36, + D3D_PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST = 37, + D3D_PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST = 38, + D3D_PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST = 39, + D3D_PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST = 40, + D3D_PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST = 41, + D3D_PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST = 42, + D3D_PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST = 43, + D3D_PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST = 44, + D3D_PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST = 45, + D3D_PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST = 46, + D3D_PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST = 47, + D3D_PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST = 48, + D3D_PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST = 49, + D3D_PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST = 50, + D3D_PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST = 51, + D3D_PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST = 52, + D3D_PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST = 53, + D3D_PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST = 54, + D3D_PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST = 55, + D3D_PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST = 56, + D3D_PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST = 57, + D3D_PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST = 58, + D3D_PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST = 59, + D3D_PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST = 60, + D3D_PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST = 61, + D3D_PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST = 62, + D3D_PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST = 63, + D3D_PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST = 64, + D3D10_PRIMITIVE_TOPOLOGY_UNDEFINED = D3D_PRIMITIVE_TOPOLOGY_UNDEFINED, + D3D10_PRIMITIVE_TOPOLOGY_POINTLIST = D3D_PRIMITIVE_TOPOLOGY_POINTLIST, + D3D10_PRIMITIVE_TOPOLOGY_LINELIST = D3D_PRIMITIVE_TOPOLOGY_LINELIST, + D3D10_PRIMITIVE_TOPOLOGY_LINESTRIP = D3D_PRIMITIVE_TOPOLOGY_LINESTRIP, + D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST, + D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP = D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP, + D3D10_PRIMITIVE_TOPOLOGY_LINELIST_ADJ = D3D_PRIMITIVE_TOPOLOGY_LINELIST_ADJ, + D3D10_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ = D3D_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ, + D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ, + D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ = D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ, + D3D11_PRIMITIVE_TOPOLOGY_UNDEFINED = D3D_PRIMITIVE_TOPOLOGY_UNDEFINED, + D3D11_PRIMITIVE_TOPOLOGY_POINTLIST = D3D_PRIMITIVE_TOPOLOGY_POINTLIST, + D3D11_PRIMITIVE_TOPOLOGY_LINELIST = D3D_PRIMITIVE_TOPOLOGY_LINELIST, + D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP = D3D_PRIMITIVE_TOPOLOGY_LINESTRIP, + D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST, + D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP = D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP, + D3D11_PRIMITIVE_TOPOLOGY_LINELIST_ADJ = D3D_PRIMITIVE_TOPOLOGY_LINELIST_ADJ, + D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ = D3D_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ, + D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ, + D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ = D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ, + D3D11_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST, + D3D11_PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST + } D3D_PRIMITIVE_TOPOLOGY; + +typedef +enum D3D_PRIMITIVE + { D3D_PRIMITIVE_UNDEFINED = 0, + D3D_PRIMITIVE_POINT = 1, + D3D_PRIMITIVE_LINE = 2, + D3D_PRIMITIVE_TRIANGLE = 3, + D3D_PRIMITIVE_LINE_ADJ = 6, + D3D_PRIMITIVE_TRIANGLE_ADJ = 7, + D3D_PRIMITIVE_1_CONTROL_POINT_PATCH = 8, + D3D_PRIMITIVE_2_CONTROL_POINT_PATCH = 9, + D3D_PRIMITIVE_3_CONTROL_POINT_PATCH = 10, + D3D_PRIMITIVE_4_CONTROL_POINT_PATCH = 11, + D3D_PRIMITIVE_5_CONTROL_POINT_PATCH = 12, + D3D_PRIMITIVE_6_CONTROL_POINT_PATCH = 13, + D3D_PRIMITIVE_7_CONTROL_POINT_PATCH = 14, + D3D_PRIMITIVE_8_CONTROL_POINT_PATCH = 15, + D3D_PRIMITIVE_9_CONTROL_POINT_PATCH = 16, + D3D_PRIMITIVE_10_CONTROL_POINT_PATCH = 17, + D3D_PRIMITIVE_11_CONTROL_POINT_PATCH = 18, + D3D_PRIMITIVE_12_CONTROL_POINT_PATCH = 19, + D3D_PRIMITIVE_13_CONTROL_POINT_PATCH = 20, + D3D_PRIMITIVE_14_CONTROL_POINT_PATCH = 21, + D3D_PRIMITIVE_15_CONTROL_POINT_PATCH = 22, + D3D_PRIMITIVE_16_CONTROL_POINT_PATCH = 23, + D3D_PRIMITIVE_17_CONTROL_POINT_PATCH = 24, + D3D_PRIMITIVE_18_CONTROL_POINT_PATCH = 25, + D3D_PRIMITIVE_19_CONTROL_POINT_PATCH = 26, + D3D_PRIMITIVE_20_CONTROL_POINT_PATCH = 28, + D3D_PRIMITIVE_21_CONTROL_POINT_PATCH = 29, + D3D_PRIMITIVE_22_CONTROL_POINT_PATCH = 30, + D3D_PRIMITIVE_23_CONTROL_POINT_PATCH = 31, + D3D_PRIMITIVE_24_CONTROL_POINT_PATCH = 32, + D3D_PRIMITIVE_25_CONTROL_POINT_PATCH = 33, + D3D_PRIMITIVE_26_CONTROL_POINT_PATCH = 34, + D3D_PRIMITIVE_27_CONTROL_POINT_PATCH = 35, + D3D_PRIMITIVE_28_CONTROL_POINT_PATCH = 36, + D3D_PRIMITIVE_29_CONTROL_POINT_PATCH = 37, + D3D_PRIMITIVE_30_CONTROL_POINT_PATCH = 38, + D3D_PRIMITIVE_31_CONTROL_POINT_PATCH = 39, + D3D_PRIMITIVE_32_CONTROL_POINT_PATCH = 40, + D3D10_PRIMITIVE_UNDEFINED = D3D_PRIMITIVE_UNDEFINED, + D3D10_PRIMITIVE_POINT = D3D_PRIMITIVE_POINT, + D3D10_PRIMITIVE_LINE = D3D_PRIMITIVE_LINE, + D3D10_PRIMITIVE_TRIANGLE = D3D_PRIMITIVE_TRIANGLE, + D3D10_PRIMITIVE_LINE_ADJ = D3D_PRIMITIVE_LINE_ADJ, + D3D10_PRIMITIVE_TRIANGLE_ADJ = D3D_PRIMITIVE_TRIANGLE_ADJ, + D3D11_PRIMITIVE_UNDEFINED = D3D_PRIMITIVE_UNDEFINED, + D3D11_PRIMITIVE_POINT = D3D_PRIMITIVE_POINT, + D3D11_PRIMITIVE_LINE = D3D_PRIMITIVE_LINE, + D3D11_PRIMITIVE_TRIANGLE = D3D_PRIMITIVE_TRIANGLE, + D3D11_PRIMITIVE_LINE_ADJ = D3D_PRIMITIVE_LINE_ADJ, + D3D11_PRIMITIVE_TRIANGLE_ADJ = D3D_PRIMITIVE_TRIANGLE_ADJ, + D3D11_PRIMITIVE_1_CONTROL_POINT_PATCH = D3D_PRIMITIVE_1_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_2_CONTROL_POINT_PATCH = D3D_PRIMITIVE_2_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_3_CONTROL_POINT_PATCH = D3D_PRIMITIVE_3_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_4_CONTROL_POINT_PATCH = D3D_PRIMITIVE_4_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_5_CONTROL_POINT_PATCH = D3D_PRIMITIVE_5_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_6_CONTROL_POINT_PATCH = D3D_PRIMITIVE_6_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_7_CONTROL_POINT_PATCH = D3D_PRIMITIVE_7_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_8_CONTROL_POINT_PATCH = D3D_PRIMITIVE_8_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_9_CONTROL_POINT_PATCH = D3D_PRIMITIVE_9_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_10_CONTROL_POINT_PATCH = D3D_PRIMITIVE_10_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_11_CONTROL_POINT_PATCH = D3D_PRIMITIVE_11_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_12_CONTROL_POINT_PATCH = D3D_PRIMITIVE_12_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_13_CONTROL_POINT_PATCH = D3D_PRIMITIVE_13_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_14_CONTROL_POINT_PATCH = D3D_PRIMITIVE_14_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_15_CONTROL_POINT_PATCH = D3D_PRIMITIVE_15_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_16_CONTROL_POINT_PATCH = D3D_PRIMITIVE_16_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_17_CONTROL_POINT_PATCH = D3D_PRIMITIVE_17_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_18_CONTROL_POINT_PATCH = D3D_PRIMITIVE_18_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_19_CONTROL_POINT_PATCH = D3D_PRIMITIVE_19_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_20_CONTROL_POINT_PATCH = D3D_PRIMITIVE_20_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_21_CONTROL_POINT_PATCH = D3D_PRIMITIVE_21_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_22_CONTROL_POINT_PATCH = D3D_PRIMITIVE_22_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_23_CONTROL_POINT_PATCH = D3D_PRIMITIVE_23_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_24_CONTROL_POINT_PATCH = D3D_PRIMITIVE_24_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_25_CONTROL_POINT_PATCH = D3D_PRIMITIVE_25_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_26_CONTROL_POINT_PATCH = D3D_PRIMITIVE_26_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_27_CONTROL_POINT_PATCH = D3D_PRIMITIVE_27_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_28_CONTROL_POINT_PATCH = D3D_PRIMITIVE_28_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_29_CONTROL_POINT_PATCH = D3D_PRIMITIVE_29_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_30_CONTROL_POINT_PATCH = D3D_PRIMITIVE_30_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_31_CONTROL_POINT_PATCH = D3D_PRIMITIVE_31_CONTROL_POINT_PATCH, + D3D11_PRIMITIVE_32_CONTROL_POINT_PATCH = D3D_PRIMITIVE_32_CONTROL_POINT_PATCH + } D3D_PRIMITIVE; + +typedef +enum D3D_SRV_DIMENSION + { D3D_SRV_DIMENSION_UNKNOWN = 0, + D3D_SRV_DIMENSION_BUFFER = 1, + D3D_SRV_DIMENSION_TEXTURE1D = 2, + D3D_SRV_DIMENSION_TEXTURE1DARRAY = 3, + D3D_SRV_DIMENSION_TEXTURE2D = 4, + D3D_SRV_DIMENSION_TEXTURE2DARRAY = 5, + D3D_SRV_DIMENSION_TEXTURE2DMS = 6, + D3D_SRV_DIMENSION_TEXTURE2DMSARRAY = 7, + D3D_SRV_DIMENSION_TEXTURE3D = 8, + D3D_SRV_DIMENSION_TEXTURECUBE = 9, + D3D_SRV_DIMENSION_TEXTURECUBEARRAY = 10, + D3D_SRV_DIMENSION_BUFFEREX = 11, + D3D10_SRV_DIMENSION_UNKNOWN = D3D_SRV_DIMENSION_UNKNOWN, + D3D10_SRV_DIMENSION_BUFFER = D3D_SRV_DIMENSION_BUFFER, + D3D10_SRV_DIMENSION_TEXTURE1D = D3D_SRV_DIMENSION_TEXTURE1D, + D3D10_SRV_DIMENSION_TEXTURE1DARRAY = D3D_SRV_DIMENSION_TEXTURE1DARRAY, + D3D10_SRV_DIMENSION_TEXTURE2D = D3D_SRV_DIMENSION_TEXTURE2D, + D3D10_SRV_DIMENSION_TEXTURE2DARRAY = D3D_SRV_DIMENSION_TEXTURE2DARRAY, + D3D10_SRV_DIMENSION_TEXTURE2DMS = D3D_SRV_DIMENSION_TEXTURE2DMS, + D3D10_SRV_DIMENSION_TEXTURE2DMSARRAY = D3D_SRV_DIMENSION_TEXTURE2DMSARRAY, + D3D10_SRV_DIMENSION_TEXTURE3D = D3D_SRV_DIMENSION_TEXTURE3D, + D3D10_SRV_DIMENSION_TEXTURECUBE = D3D_SRV_DIMENSION_TEXTURECUBE, + D3D10_1_SRV_DIMENSION_UNKNOWN = D3D_SRV_DIMENSION_UNKNOWN, + D3D10_1_SRV_DIMENSION_BUFFER = D3D_SRV_DIMENSION_BUFFER, + D3D10_1_SRV_DIMENSION_TEXTURE1D = D3D_SRV_DIMENSION_TEXTURE1D, + D3D10_1_SRV_DIMENSION_TEXTURE1DARRAY = D3D_SRV_DIMENSION_TEXTURE1DARRAY, + D3D10_1_SRV_DIMENSION_TEXTURE2D = D3D_SRV_DIMENSION_TEXTURE2D, + D3D10_1_SRV_DIMENSION_TEXTURE2DARRAY = D3D_SRV_DIMENSION_TEXTURE2DARRAY, + D3D10_1_SRV_DIMENSION_TEXTURE2DMS = D3D_SRV_DIMENSION_TEXTURE2DMS, + D3D10_1_SRV_DIMENSION_TEXTURE2DMSARRAY = D3D_SRV_DIMENSION_TEXTURE2DMSARRAY, + D3D10_1_SRV_DIMENSION_TEXTURE3D = D3D_SRV_DIMENSION_TEXTURE3D, + D3D10_1_SRV_DIMENSION_TEXTURECUBE = D3D_SRV_DIMENSION_TEXTURECUBE, + D3D10_1_SRV_DIMENSION_TEXTURECUBEARRAY = D3D_SRV_DIMENSION_TEXTURECUBEARRAY, + D3D11_SRV_DIMENSION_UNKNOWN = D3D_SRV_DIMENSION_UNKNOWN, + D3D11_SRV_DIMENSION_BUFFER = D3D_SRV_DIMENSION_BUFFER, + D3D11_SRV_DIMENSION_TEXTURE1D = D3D_SRV_DIMENSION_TEXTURE1D, + D3D11_SRV_DIMENSION_TEXTURE1DARRAY = D3D_SRV_DIMENSION_TEXTURE1DARRAY, + D3D11_SRV_DIMENSION_TEXTURE2D = D3D_SRV_DIMENSION_TEXTURE2D, + D3D11_SRV_DIMENSION_TEXTURE2DARRAY = D3D_SRV_DIMENSION_TEXTURE2DARRAY, + D3D11_SRV_DIMENSION_TEXTURE2DMS = D3D_SRV_DIMENSION_TEXTURE2DMS, + D3D11_SRV_DIMENSION_TEXTURE2DMSARRAY = D3D_SRV_DIMENSION_TEXTURE2DMSARRAY, + D3D11_SRV_DIMENSION_TEXTURE3D = D3D_SRV_DIMENSION_TEXTURE3D, + D3D11_SRV_DIMENSION_TEXTURECUBE = D3D_SRV_DIMENSION_TEXTURECUBE, + D3D11_SRV_DIMENSION_TEXTURECUBEARRAY = D3D_SRV_DIMENSION_TEXTURECUBEARRAY, + D3D11_SRV_DIMENSION_BUFFEREX = D3D_SRV_DIMENSION_BUFFEREX + } D3D_SRV_DIMENSION; + +typedef struct _D3D_SHADER_MACRO + { + LPCSTR Name; + LPCSTR Definition; + } D3D_SHADER_MACRO; + +typedef struct _D3D_SHADER_MACRO *LPD3D_SHADER_MACRO; + +DEFINE_GUID(IID_ID3D10Blob, 0x8ba5fb08, 0x5195, 0x40e2, 0xac, 0x58, 0xd, 0x98, 0x9c, 0x3a, 0x1, 0x2); + + +extern RPC_IF_HANDLE __MIDL_itf_d3dcommon_0000_0000_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3dcommon_0000_0000_v0_0_s_ifspec; + +#ifndef __ID3D10Blob_INTERFACE_DEFINED__ +#define __ID3D10Blob_INTERFACE_DEFINED__ + +/* interface ID3D10Blob */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10Blob; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("8BA5FB08-5195-40e2-AC58-0D989C3A0102") + ID3D10Blob : public IUnknown + { + public: + virtual LPVOID STDMETHODCALLTYPE GetBufferPointer( void) = 0; + + virtual SIZE_T STDMETHODCALLTYPE GetBufferSize( void) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D10BlobVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10Blob * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10Blob * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10Blob * This); + + LPVOID ( STDMETHODCALLTYPE *GetBufferPointer )( + ID3D10Blob * This); + + SIZE_T ( STDMETHODCALLTYPE *GetBufferSize )( + ID3D10Blob * This); + + END_INTERFACE + } ID3D10BlobVtbl; + + interface ID3D10Blob + { + CONST_VTBL struct ID3D10BlobVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10Blob_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10Blob_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10Blob_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10Blob_GetBufferPointer(This) \ + ( (This)->lpVtbl -> GetBufferPointer(This) ) + +#define ID3D10Blob_GetBufferSize(This) \ + ( (This)->lpVtbl -> GetBufferSize(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10Blob_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3dcommon_0000_0001 */ +/* [local] */ + +typedef interface ID3D10Blob* LPD3D10BLOB; +typedef ID3D10Blob ID3DBlob; +typedef ID3DBlob* LPD3DBLOB; +#define IID_ID3DBlob IID_ID3D10Blob +typedef +enum _D3D_INCLUDE_TYPE + { D3D_INCLUDE_LOCAL = 0, + D3D_INCLUDE_SYSTEM = ( D3D_INCLUDE_LOCAL + 1 ) , + D3D10_INCLUDE_LOCAL = D3D_INCLUDE_LOCAL, + D3D10_INCLUDE_SYSTEM = D3D_INCLUDE_SYSTEM, + D3D_INCLUDE_FORCE_DWORD = 0x7fffffff + } D3D_INCLUDE_TYPE; + +typedef interface ID3DInclude ID3DInclude; +#undef INTERFACE +#define INTERFACE ID3DInclude +DECLARE_INTERFACE(ID3DInclude) +{ + STDMETHOD(Open)(THIS_ D3D_INCLUDE_TYPE IncludeType, LPCSTR pFileName, LPCVOID pParentData, LPCVOID *ppData, UINT *pBytes) PURE; + STDMETHOD(Close)(THIS_ LPCVOID pData) PURE; +}; +typedef ID3DInclude* LPD3DINCLUDE; +typedef +enum _D3D_SHADER_VARIABLE_CLASS + { D3D_SVC_SCALAR = 0, + D3D_SVC_VECTOR = ( D3D_SVC_SCALAR + 1 ) , + D3D_SVC_MATRIX_ROWS = ( D3D_SVC_VECTOR + 1 ) , + D3D_SVC_MATRIX_COLUMNS = ( D3D_SVC_MATRIX_ROWS + 1 ) , + D3D_SVC_OBJECT = ( D3D_SVC_MATRIX_COLUMNS + 1 ) , + D3D_SVC_STRUCT = ( D3D_SVC_OBJECT + 1 ) , + D3D_SVC_INTERFACE_CLASS = ( D3D_SVC_STRUCT + 1 ) , + D3D_SVC_INTERFACE_POINTER = ( D3D_SVC_INTERFACE_CLASS + 1 ) , + D3D10_SVC_SCALAR = D3D_SVC_SCALAR, + D3D10_SVC_VECTOR = D3D_SVC_VECTOR, + D3D10_SVC_MATRIX_ROWS = D3D_SVC_MATRIX_ROWS, + D3D10_SVC_MATRIX_COLUMNS = D3D_SVC_MATRIX_COLUMNS, + D3D10_SVC_OBJECT = D3D_SVC_OBJECT, + D3D10_SVC_STRUCT = D3D_SVC_STRUCT, + D3D11_SVC_INTERFACE_CLASS = D3D_SVC_INTERFACE_CLASS, + D3D11_SVC_INTERFACE_POINTER = D3D_SVC_INTERFACE_POINTER, + D3D_SVC_FORCE_DWORD = 0x7fffffff + } D3D_SHADER_VARIABLE_CLASS; + +typedef +enum _D3D_SHADER_VARIABLE_FLAGS + { D3D_SVF_USERPACKED = 1, + D3D_SVF_USED = 2, + D3D_SVF_INTERFACE_POINTER = 4, + D3D_SVF_INTERFACE_PARAMETER = 8, + D3D10_SVF_USERPACKED = D3D_SVF_USERPACKED, + D3D10_SVF_USED = D3D_SVF_USED, + D3D11_SVF_INTERFACE_POINTER = D3D_SVF_INTERFACE_POINTER, + D3D11_SVF_INTERFACE_PARAMETER = D3D_SVF_INTERFACE_PARAMETER, + D3D_SVF_FORCE_DWORD = 0x7fffffff + } D3D_SHADER_VARIABLE_FLAGS; + +typedef +enum _D3D_SHADER_VARIABLE_TYPE + { D3D_SVT_VOID = 0, + D3D_SVT_BOOL = 1, + D3D_SVT_INT = 2, + D3D_SVT_FLOAT = 3, + D3D_SVT_STRING = 4, + D3D_SVT_TEXTURE = 5, + D3D_SVT_TEXTURE1D = 6, + D3D_SVT_TEXTURE2D = 7, + D3D_SVT_TEXTURE3D = 8, + D3D_SVT_TEXTURECUBE = 9, + D3D_SVT_SAMPLER = 10, + D3D_SVT_SAMPLER1D = 11, + D3D_SVT_SAMPLER2D = 12, + D3D_SVT_SAMPLER3D = 13, + D3D_SVT_SAMPLERCUBE = 14, + D3D_SVT_PIXELSHADER = 15, + D3D_SVT_VERTEXSHADER = 16, + D3D_SVT_PIXELFRAGMENT = 17, + D3D_SVT_VERTEXFRAGMENT = 18, + D3D_SVT_UINT = 19, + D3D_SVT_UINT8 = 20, + D3D_SVT_GEOMETRYSHADER = 21, + D3D_SVT_RASTERIZER = 22, + D3D_SVT_DEPTHSTENCIL = 23, + D3D_SVT_BLEND = 24, + D3D_SVT_BUFFER = 25, + D3D_SVT_CBUFFER = 26, + D3D_SVT_TBUFFER = 27, + D3D_SVT_TEXTURE1DARRAY = 28, + D3D_SVT_TEXTURE2DARRAY = 29, + D3D_SVT_RENDERTARGETVIEW = 30, + D3D_SVT_DEPTHSTENCILVIEW = 31, + D3D_SVT_TEXTURE2DMS = 32, + D3D_SVT_TEXTURE2DMSARRAY = 33, + D3D_SVT_TEXTURECUBEARRAY = 34, + D3D_SVT_HULLSHADER = 35, + D3D_SVT_DOMAINSHADER = 36, + D3D_SVT_INTERFACE_POINTER = 37, + D3D_SVT_COMPUTESHADER = 38, + D3D_SVT_DOUBLE = 39, + D3D_SVT_RWTEXTURE1D = 40, + D3D_SVT_RWTEXTURE1DARRAY = 41, + D3D_SVT_RWTEXTURE2D = 42, + D3D_SVT_RWTEXTURE2DARRAY = 43, + D3D_SVT_RWTEXTURE3D = 44, + D3D_SVT_RWBUFFER = 45, + D3D_SVT_BYTEADDRESS_BUFFER = 46, + D3D_SVT_RWBYTEADDRESS_BUFFER = 47, + D3D_SVT_STRUCTURED_BUFFER = 48, + D3D_SVT_RWSTRUCTURED_BUFFER = 49, + D3D_SVT_APPEND_STRUCTURED_BUFFER = 50, + D3D_SVT_CONSUME_STRUCTURED_BUFFER = 51, + D3D10_SVT_VOID = D3D_SVT_VOID, + D3D10_SVT_BOOL = D3D_SVT_BOOL, + D3D10_SVT_INT = D3D_SVT_INT, + D3D10_SVT_FLOAT = D3D_SVT_FLOAT, + D3D10_SVT_STRING = D3D_SVT_STRING, + D3D10_SVT_TEXTURE = D3D_SVT_TEXTURE, + D3D10_SVT_TEXTURE1D = D3D_SVT_TEXTURE1D, + D3D10_SVT_TEXTURE2D = D3D_SVT_TEXTURE2D, + D3D10_SVT_TEXTURE3D = D3D_SVT_TEXTURE3D, + D3D10_SVT_TEXTURECUBE = D3D_SVT_TEXTURECUBE, + D3D10_SVT_SAMPLER = D3D_SVT_SAMPLER, + D3D10_SVT_SAMPLER1D = D3D_SVT_SAMPLER1D, + D3D10_SVT_SAMPLER2D = D3D_SVT_SAMPLER2D, + D3D10_SVT_SAMPLER3D = D3D_SVT_SAMPLER3D, + D3D10_SVT_SAMPLERCUBE = D3D_SVT_SAMPLERCUBE, + D3D10_SVT_PIXELSHADER = D3D_SVT_PIXELSHADER, + D3D10_SVT_VERTEXSHADER = D3D_SVT_VERTEXSHADER, + D3D10_SVT_PIXELFRAGMENT = D3D_SVT_PIXELFRAGMENT, + D3D10_SVT_VERTEXFRAGMENT = D3D_SVT_VERTEXFRAGMENT, + D3D10_SVT_UINT = D3D_SVT_UINT, + D3D10_SVT_UINT8 = D3D_SVT_UINT8, + D3D10_SVT_GEOMETRYSHADER = D3D_SVT_GEOMETRYSHADER, + D3D10_SVT_RASTERIZER = D3D_SVT_RASTERIZER, + D3D10_SVT_DEPTHSTENCIL = D3D_SVT_DEPTHSTENCIL, + D3D10_SVT_BLEND = D3D_SVT_BLEND, + D3D10_SVT_BUFFER = D3D_SVT_BUFFER, + D3D10_SVT_CBUFFER = D3D_SVT_CBUFFER, + D3D10_SVT_TBUFFER = D3D_SVT_TBUFFER, + D3D10_SVT_TEXTURE1DARRAY = D3D_SVT_TEXTURE1DARRAY, + D3D10_SVT_TEXTURE2DARRAY = D3D_SVT_TEXTURE2DARRAY, + D3D10_SVT_RENDERTARGETVIEW = D3D_SVT_RENDERTARGETVIEW, + D3D10_SVT_DEPTHSTENCILVIEW = D3D_SVT_DEPTHSTENCILVIEW, + D3D10_SVT_TEXTURE2DMS = D3D_SVT_TEXTURE2DMS, + D3D10_SVT_TEXTURE2DMSARRAY = D3D_SVT_TEXTURE2DMSARRAY, + D3D10_SVT_TEXTURECUBEARRAY = D3D_SVT_TEXTURECUBEARRAY, + D3D11_SVT_HULLSHADER = D3D_SVT_HULLSHADER, + D3D11_SVT_DOMAINSHADER = D3D_SVT_DOMAINSHADER, + D3D11_SVT_INTERFACE_POINTER = D3D_SVT_INTERFACE_POINTER, + D3D11_SVT_COMPUTESHADER = D3D_SVT_COMPUTESHADER, + D3D11_SVT_DOUBLE = D3D_SVT_DOUBLE, + D3D11_SVT_RWTEXTURE1D = D3D_SVT_RWTEXTURE1D, + D3D11_SVT_RWTEXTURE1DARRAY = D3D_SVT_RWTEXTURE1DARRAY, + D3D11_SVT_RWTEXTURE2D = D3D_SVT_RWTEXTURE2D, + D3D11_SVT_RWTEXTURE2DARRAY = D3D_SVT_RWTEXTURE2DARRAY, + D3D11_SVT_RWTEXTURE3D = D3D_SVT_RWTEXTURE3D, + D3D11_SVT_RWBUFFER = D3D_SVT_RWBUFFER, + D3D11_SVT_BYTEADDRESS_BUFFER = D3D_SVT_BYTEADDRESS_BUFFER, + D3D11_SVT_RWBYTEADDRESS_BUFFER = D3D_SVT_RWBYTEADDRESS_BUFFER, + D3D11_SVT_STRUCTURED_BUFFER = D3D_SVT_STRUCTURED_BUFFER, + D3D11_SVT_RWSTRUCTURED_BUFFER = D3D_SVT_RWSTRUCTURED_BUFFER, + D3D11_SVT_APPEND_STRUCTURED_BUFFER = D3D_SVT_APPEND_STRUCTURED_BUFFER, + D3D11_SVT_CONSUME_STRUCTURED_BUFFER = D3D_SVT_CONSUME_STRUCTURED_BUFFER, + D3D_SVT_FORCE_DWORD = 0x7fffffff + } D3D_SHADER_VARIABLE_TYPE; + +typedef +enum _D3D_SHADER_INPUT_FLAGS + { D3D_SIF_USERPACKED = 1, + D3D_SIF_COMPARISON_SAMPLER = 2, + D3D_SIF_TEXTURE_COMPONENT_0 = 4, + D3D_SIF_TEXTURE_COMPONENT_1 = 8, + D3D_SIF_TEXTURE_COMPONENTS = 12, + D3D10_SIF_USERPACKED = D3D_SIF_USERPACKED, + D3D10_SIF_COMPARISON_SAMPLER = D3D_SIF_COMPARISON_SAMPLER, + D3D10_SIF_TEXTURE_COMPONENT_0 = D3D_SIF_TEXTURE_COMPONENT_0, + D3D10_SIF_TEXTURE_COMPONENT_1 = D3D_SIF_TEXTURE_COMPONENT_1, + D3D10_SIF_TEXTURE_COMPONENTS = D3D_SIF_TEXTURE_COMPONENTS, + D3D_SIF_FORCE_DWORD = 0x7fffffff + } D3D_SHADER_INPUT_FLAGS; + +typedef +enum _D3D_SHADER_INPUT_TYPE + { D3D_SIT_CBUFFER = 0, + D3D_SIT_TBUFFER = ( D3D_SIT_CBUFFER + 1 ) , + D3D_SIT_TEXTURE = ( D3D_SIT_TBUFFER + 1 ) , + D3D_SIT_SAMPLER = ( D3D_SIT_TEXTURE + 1 ) , + D3D_SIT_UAV_RWTYPED = ( D3D_SIT_SAMPLER + 1 ) , + D3D_SIT_STRUCTURED = ( D3D_SIT_UAV_RWTYPED + 1 ) , + D3D_SIT_UAV_RWSTRUCTURED = ( D3D_SIT_STRUCTURED + 1 ) , + D3D_SIT_BYTEADDRESS = ( D3D_SIT_UAV_RWSTRUCTURED + 1 ) , + D3D_SIT_UAV_RWBYTEADDRESS = ( D3D_SIT_BYTEADDRESS + 1 ) , + D3D_SIT_UAV_APPEND_STRUCTURED = ( D3D_SIT_UAV_RWBYTEADDRESS + 1 ) , + D3D_SIT_UAV_CONSUME_STRUCTURED = ( D3D_SIT_UAV_APPEND_STRUCTURED + 1 ) , + D3D_SIT_UAV_RWSTRUCTURED_WITH_COUNTER = ( D3D_SIT_UAV_CONSUME_STRUCTURED + 1 ) , + D3D10_SIT_CBUFFER = D3D_SIT_CBUFFER, + D3D10_SIT_TBUFFER = D3D_SIT_TBUFFER, + D3D10_SIT_TEXTURE = D3D_SIT_TEXTURE, + D3D10_SIT_SAMPLER = D3D_SIT_SAMPLER, + D3D11_SIT_UAV_RWTYPED = D3D_SIT_UAV_RWTYPED, + D3D11_SIT_STRUCTURED = D3D_SIT_STRUCTURED, + D3D11_SIT_UAV_RWSTRUCTURED = D3D_SIT_UAV_RWSTRUCTURED, + D3D11_SIT_BYTEADDRESS = D3D_SIT_BYTEADDRESS, + D3D11_SIT_UAV_RWBYTEADDRESS = D3D_SIT_UAV_RWBYTEADDRESS, + D3D11_SIT_UAV_APPEND_STRUCTURED = D3D_SIT_UAV_APPEND_STRUCTURED, + D3D11_SIT_UAV_CONSUME_STRUCTURED = D3D_SIT_UAV_CONSUME_STRUCTURED, + D3D11_SIT_UAV_RWSTRUCTURED_WITH_COUNTER = D3D_SIT_UAV_RWSTRUCTURED_WITH_COUNTER + } D3D_SHADER_INPUT_TYPE; + +typedef +enum _D3D_SHADER_CBUFFER_FLAGS + { D3D_CBF_USERPACKED = 1, + D3D10_CBF_USERPACKED = D3D_CBF_USERPACKED, + D3D_CBF_FORCE_DWORD = 0x7fffffff + } D3D_SHADER_CBUFFER_FLAGS; + +typedef +enum _D3D_CBUFFER_TYPE + { D3D_CT_CBUFFER = 0, + D3D_CT_TBUFFER = ( D3D_CT_CBUFFER + 1 ) , + D3D_CT_INTERFACE_POINTERS = ( D3D_CT_TBUFFER + 1 ) , + D3D_CT_RESOURCE_BIND_INFO = ( D3D_CT_INTERFACE_POINTERS + 1 ) , + D3D10_CT_CBUFFER = D3D_CT_CBUFFER, + D3D10_CT_TBUFFER = D3D_CT_TBUFFER, + D3D11_CT_CBUFFER = D3D_CT_CBUFFER, + D3D11_CT_TBUFFER = D3D_CT_TBUFFER, + D3D11_CT_INTERFACE_POINTERS = D3D_CT_INTERFACE_POINTERS, + D3D11_CT_RESOURCE_BIND_INFO = D3D_CT_RESOURCE_BIND_INFO + } D3D_CBUFFER_TYPE; + +typedef +enum D3D_NAME + { D3D_NAME_UNDEFINED = 0, + D3D_NAME_POSITION = 1, + D3D_NAME_CLIP_DISTANCE = 2, + D3D_NAME_CULL_DISTANCE = 3, + D3D_NAME_RENDER_TARGET_ARRAY_INDEX = 4, + D3D_NAME_VIEWPORT_ARRAY_INDEX = 5, + D3D_NAME_VERTEX_ID = 6, + D3D_NAME_PRIMITIVE_ID = 7, + D3D_NAME_INSTANCE_ID = 8, + D3D_NAME_IS_FRONT_FACE = 9, + D3D_NAME_SAMPLE_INDEX = 10, + D3D_NAME_FINAL_QUAD_EDGE_TESSFACTOR = 11, + D3D_NAME_FINAL_QUAD_INSIDE_TESSFACTOR = 12, + D3D_NAME_FINAL_TRI_EDGE_TESSFACTOR = 13, + D3D_NAME_FINAL_TRI_INSIDE_TESSFACTOR = 14, + D3D_NAME_FINAL_LINE_DETAIL_TESSFACTOR = 15, + D3D_NAME_FINAL_LINE_DENSITY_TESSFACTOR = 16, + D3D_NAME_TARGET = 64, + D3D_NAME_DEPTH = 65, + D3D_NAME_COVERAGE = 66, + D3D_NAME_DEPTH_GREATER_EQUAL = 67, + D3D_NAME_DEPTH_LESS_EQUAL = 68, + D3D10_NAME_UNDEFINED = D3D_NAME_UNDEFINED, + D3D10_NAME_POSITION = D3D_NAME_POSITION, + D3D10_NAME_CLIP_DISTANCE = D3D_NAME_CLIP_DISTANCE, + D3D10_NAME_CULL_DISTANCE = D3D_NAME_CULL_DISTANCE, + D3D10_NAME_RENDER_TARGET_ARRAY_INDEX = D3D_NAME_RENDER_TARGET_ARRAY_INDEX, + D3D10_NAME_VIEWPORT_ARRAY_INDEX = D3D_NAME_VIEWPORT_ARRAY_INDEX, + D3D10_NAME_VERTEX_ID = D3D_NAME_VERTEX_ID, + D3D10_NAME_PRIMITIVE_ID = D3D_NAME_PRIMITIVE_ID, + D3D10_NAME_INSTANCE_ID = D3D_NAME_INSTANCE_ID, + D3D10_NAME_IS_FRONT_FACE = D3D_NAME_IS_FRONT_FACE, + D3D10_NAME_SAMPLE_INDEX = D3D_NAME_SAMPLE_INDEX, + D3D10_NAME_TARGET = D3D_NAME_TARGET, + D3D10_NAME_DEPTH = D3D_NAME_DEPTH, + D3D10_NAME_COVERAGE = D3D_NAME_COVERAGE, + D3D11_NAME_FINAL_QUAD_EDGE_TESSFACTOR = D3D_NAME_FINAL_QUAD_EDGE_TESSFACTOR, + D3D11_NAME_FINAL_QUAD_INSIDE_TESSFACTOR = D3D_NAME_FINAL_QUAD_INSIDE_TESSFACTOR, + D3D11_NAME_FINAL_TRI_EDGE_TESSFACTOR = D3D_NAME_FINAL_TRI_EDGE_TESSFACTOR, + D3D11_NAME_FINAL_TRI_INSIDE_TESSFACTOR = D3D_NAME_FINAL_TRI_INSIDE_TESSFACTOR, + D3D11_NAME_FINAL_LINE_DETAIL_TESSFACTOR = D3D_NAME_FINAL_LINE_DETAIL_TESSFACTOR, + D3D11_NAME_FINAL_LINE_DENSITY_TESSFACTOR = D3D_NAME_FINAL_LINE_DENSITY_TESSFACTOR, + D3D11_NAME_DEPTH_GREATER_EQUAL = D3D_NAME_DEPTH_GREATER_EQUAL, + D3D11_NAME_DEPTH_LESS_EQUAL = D3D_NAME_DEPTH_LESS_EQUAL + } D3D_NAME; + +typedef +enum D3D_RESOURCE_RETURN_TYPE + { D3D_RETURN_TYPE_UNORM = 1, + D3D_RETURN_TYPE_SNORM = 2, + D3D_RETURN_TYPE_SINT = 3, + D3D_RETURN_TYPE_UINT = 4, + D3D_RETURN_TYPE_FLOAT = 5, + D3D_RETURN_TYPE_MIXED = 6, + D3D_RETURN_TYPE_DOUBLE = 7, + D3D_RETURN_TYPE_CONTINUED = 8, + D3D10_RETURN_TYPE_UNORM = D3D_RETURN_TYPE_UNORM, + D3D10_RETURN_TYPE_SNORM = D3D_RETURN_TYPE_SNORM, + D3D10_RETURN_TYPE_SINT = D3D_RETURN_TYPE_SINT, + D3D10_RETURN_TYPE_UINT = D3D_RETURN_TYPE_UINT, + D3D10_RETURN_TYPE_FLOAT = D3D_RETURN_TYPE_FLOAT, + D3D10_RETURN_TYPE_MIXED = D3D_RETURN_TYPE_MIXED, + D3D11_RETURN_TYPE_UNORM = D3D_RETURN_TYPE_UNORM, + D3D11_RETURN_TYPE_SNORM = D3D_RETURN_TYPE_SNORM, + D3D11_RETURN_TYPE_SINT = D3D_RETURN_TYPE_SINT, + D3D11_RETURN_TYPE_UINT = D3D_RETURN_TYPE_UINT, + D3D11_RETURN_TYPE_FLOAT = D3D_RETURN_TYPE_FLOAT, + D3D11_RETURN_TYPE_MIXED = D3D_RETURN_TYPE_MIXED, + D3D11_RETURN_TYPE_DOUBLE = D3D_RETURN_TYPE_DOUBLE, + D3D11_RETURN_TYPE_CONTINUED = D3D_RETURN_TYPE_CONTINUED + } D3D_RESOURCE_RETURN_TYPE; + +typedef +enum D3D_REGISTER_COMPONENT_TYPE + { D3D_REGISTER_COMPONENT_UNKNOWN = 0, + D3D_REGISTER_COMPONENT_UINT32 = 1, + D3D_REGISTER_COMPONENT_SINT32 = 2, + D3D_REGISTER_COMPONENT_FLOAT32 = 3, + D3D10_REGISTER_COMPONENT_UNKNOWN = D3D_REGISTER_COMPONENT_UNKNOWN, + D3D10_REGISTER_COMPONENT_UINT32 = D3D_REGISTER_COMPONENT_UINT32, + D3D10_REGISTER_COMPONENT_SINT32 = D3D_REGISTER_COMPONENT_SINT32, + D3D10_REGISTER_COMPONENT_FLOAT32 = D3D_REGISTER_COMPONENT_FLOAT32 + } D3D_REGISTER_COMPONENT_TYPE; + +typedef +enum D3D_TESSELLATOR_DOMAIN + { D3D_TESSELLATOR_DOMAIN_UNDEFINED = 0, + D3D_TESSELLATOR_DOMAIN_ISOLINE = 1, + D3D_TESSELLATOR_DOMAIN_TRI = 2, + D3D_TESSELLATOR_DOMAIN_QUAD = 3, + D3D11_TESSELLATOR_DOMAIN_UNDEFINED = D3D_TESSELLATOR_DOMAIN_UNDEFINED, + D3D11_TESSELLATOR_DOMAIN_ISOLINE = D3D_TESSELLATOR_DOMAIN_ISOLINE, + D3D11_TESSELLATOR_DOMAIN_TRI = D3D_TESSELLATOR_DOMAIN_TRI, + D3D11_TESSELLATOR_DOMAIN_QUAD = D3D_TESSELLATOR_DOMAIN_QUAD + } D3D_TESSELLATOR_DOMAIN; + +typedef +enum D3D_TESSELLATOR_PARTITIONING + { D3D_TESSELLATOR_PARTITIONING_UNDEFINED = 0, + D3D_TESSELLATOR_PARTITIONING_INTEGER = 1, + D3D_TESSELLATOR_PARTITIONING_POW2 = 2, + D3D_TESSELLATOR_PARTITIONING_FRACTIONAL_ODD = 3, + D3D_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN = 4, + D3D11_TESSELLATOR_PARTITIONING_UNDEFINED = D3D_TESSELLATOR_PARTITIONING_UNDEFINED, + D3D11_TESSELLATOR_PARTITIONING_INTEGER = D3D_TESSELLATOR_PARTITIONING_INTEGER, + D3D11_TESSELLATOR_PARTITIONING_POW2 = D3D_TESSELLATOR_PARTITIONING_POW2, + D3D11_TESSELLATOR_PARTITIONING_FRACTIONAL_ODD = D3D_TESSELLATOR_PARTITIONING_FRACTIONAL_ODD, + D3D11_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN = D3D_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN + } D3D_TESSELLATOR_PARTITIONING; + +typedef +enum D3D_TESSELLATOR_OUTPUT_PRIMITIVE + { D3D_TESSELLATOR_OUTPUT_UNDEFINED = 0, + D3D_TESSELLATOR_OUTPUT_POINT = 1, + D3D_TESSELLATOR_OUTPUT_LINE = 2, + D3D_TESSELLATOR_OUTPUT_TRIANGLE_CW = 3, + D3D_TESSELLATOR_OUTPUT_TRIANGLE_CCW = 4, + D3D11_TESSELLATOR_OUTPUT_UNDEFINED = D3D_TESSELLATOR_OUTPUT_UNDEFINED, + D3D11_TESSELLATOR_OUTPUT_POINT = D3D_TESSELLATOR_OUTPUT_POINT, + D3D11_TESSELLATOR_OUTPUT_LINE = D3D_TESSELLATOR_OUTPUT_LINE, + D3D11_TESSELLATOR_OUTPUT_TRIANGLE_CW = D3D_TESSELLATOR_OUTPUT_TRIANGLE_CW, + D3D11_TESSELLATOR_OUTPUT_TRIANGLE_CCW = D3D_TESSELLATOR_OUTPUT_TRIANGLE_CCW + } D3D_TESSELLATOR_OUTPUT_PRIMITIVE; + +DEFINE_GUID(WKPDID_D3DDebugObjectName,0x429b8c22,0x9188,0x4b0c,0x87,0x42,0xac,0xb0,0xbf,0x85,0xc2,0x00); + + +extern RPC_IF_HANDLE __MIDL_itf_d3dcommon_0000_0001_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3dcommon_0000_0001_v0_0_s_ifspec; + +/* Additional Prototypes for ALL interfaces */ + +/* end of Additional Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/MediaClient/MediaClient/directx/include/D3Dcompiler.h b/MediaClient/MediaClient/directx/include/D3Dcompiler.h new file mode 100644 index 0000000..fea519f --- /dev/null +++ b/MediaClient/MediaClient/directx/include/D3Dcompiler.h @@ -0,0 +1,397 @@ +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// File: D3DCompiler.h +// Content: D3D Compilation Types and APIs +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef __D3DCOMPILER_H__ +#define __D3DCOMPILER_H__ + +// Current name of the DLL shipped in the same SDK as this header. + + +#define D3DCOMPILER_DLL_W L"d3dcompiler_43.dll" +#define D3DCOMPILER_DLL_A "d3dcompiler_43.dll" + +#ifdef UNICODE + #define D3DCOMPILER_DLL D3DCOMPILER_DLL_W +#else + #define D3DCOMPILER_DLL D3DCOMPILER_DLL_A +#endif + +#include "d3d11shader.h" + +////////////////////////////////////////////////////////////////////////////// +// APIs ////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + +//---------------------------------------------------------------------------- +// D3DCOMPILE flags: +// ----------------- +// D3DCOMPILE_DEBUG +// Insert debug file/line/type/symbol information. +// +// D3DCOMPILE_SKIP_VALIDATION +// Do not validate the generated code against known capabilities and +// constraints. This option is only recommended when compiling shaders +// you KNOW will work. (ie. have compiled before without this option.) +// Shaders are always validated by D3D before they are set to the device. +// +// D3DCOMPILE_SKIP_OPTIMIZATION +// Instructs the compiler to skip optimization steps during code generation. +// Unless you are trying to isolate a problem in your code using this option +// is not recommended. +// +// D3DCOMPILE_PACK_MATRIX_ROW_MAJOR +// Unless explicitly specified, matrices will be packed in row-major order +// on input and output from the shader. +// +// D3DCOMPILE_PACK_MATRIX_COLUMN_MAJOR +// Unless explicitly specified, matrices will be packed in column-major +// order on input and output from the shader. This is generally more +// efficient, since it allows vector-matrix multiplication to be performed +// using a series of dot-products. +// +// D3DCOMPILE_PARTIAL_PRECISION +// Force all computations in resulting shader to occur at partial precision. +// This may result in faster evaluation of shaders on some hardware. +// +// D3DCOMPILE_FORCE_VS_SOFTWARE_NO_OPT +// Force compiler to compile against the next highest available software +// target for vertex shaders. This flag also turns optimizations off, +// and debugging on. +// +// D3DCOMPILE_FORCE_PS_SOFTWARE_NO_OPT +// Force compiler to compile against the next highest available software +// target for pixel shaders. This flag also turns optimizations off, +// and debugging on. +// +// D3DCOMPILE_NO_PRESHADER +// Disables Preshaders. Using this flag will cause the compiler to not +// pull out static expression for evaluation on the host cpu +// +// D3DCOMPILE_AVOID_FLOW_CONTROL +// Hint compiler to avoid flow-control constructs where possible. +// +// D3DCOMPILE_PREFER_FLOW_CONTROL +// Hint compiler to prefer flow-control constructs where possible. +// +// D3DCOMPILE_ENABLE_STRICTNESS +// By default, the HLSL/Effect compilers are not strict on deprecated syntax. +// Specifying this flag enables the strict mode. Deprecated syntax may be +// removed in a future release, and enabling syntax is a good way to make +// sure your shaders comply to the latest spec. +// +// D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY +// This enables older shaders to compile to 4_0 targets. +// +//---------------------------------------------------------------------------- + +#define D3DCOMPILE_DEBUG (1 << 0) +#define D3DCOMPILE_SKIP_VALIDATION (1 << 1) +#define D3DCOMPILE_SKIP_OPTIMIZATION (1 << 2) +#define D3DCOMPILE_PACK_MATRIX_ROW_MAJOR (1 << 3) +#define D3DCOMPILE_PACK_MATRIX_COLUMN_MAJOR (1 << 4) +#define D3DCOMPILE_PARTIAL_PRECISION (1 << 5) +#define D3DCOMPILE_FORCE_VS_SOFTWARE_NO_OPT (1 << 6) +#define D3DCOMPILE_FORCE_PS_SOFTWARE_NO_OPT (1 << 7) +#define D3DCOMPILE_NO_PRESHADER (1 << 8) +#define D3DCOMPILE_AVOID_FLOW_CONTROL (1 << 9) +#define D3DCOMPILE_PREFER_FLOW_CONTROL (1 << 10) +#define D3DCOMPILE_ENABLE_STRICTNESS (1 << 11) +#define D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY (1 << 12) +#define D3DCOMPILE_IEEE_STRICTNESS (1 << 13) +#define D3DCOMPILE_OPTIMIZATION_LEVEL0 (1 << 14) +#define D3DCOMPILE_OPTIMIZATION_LEVEL1 0 +#define D3DCOMPILE_OPTIMIZATION_LEVEL2 ((1 << 14) | (1 << 15)) +#define D3DCOMPILE_OPTIMIZATION_LEVEL3 (1 << 15) +#define D3DCOMPILE_RESERVED16 (1 << 16) +#define D3DCOMPILE_RESERVED17 (1 << 17) +#define D3DCOMPILE_WARNINGS_ARE_ERRORS (1 << 18) + +//---------------------------------------------------------------------------- +// D3DCOMPILE_EFFECT flags: +// ------------------------------------- +// These flags are passed in when creating an effect, and affect +// either compilation behavior or runtime effect behavior +// +// D3DCOMPILE_EFFECT_CHILD_EFFECT +// Compile this .fx file to a child effect. Child effects have no +// initializers for any shared values as these are initialied in the +// master effect (pool). +// +// D3DCOMPILE_EFFECT_ALLOW_SLOW_OPS +// By default, performance mode is enabled. Performance mode +// disallows mutable state objects by preventing non-literal +// expressions from appearing in state object definitions. +// Specifying this flag will disable the mode and allow for mutable +// state objects. +// +//---------------------------------------------------------------------------- + +#define D3DCOMPILE_EFFECT_CHILD_EFFECT (1 << 0) +#define D3DCOMPILE_EFFECT_ALLOW_SLOW_OPS (1 << 1) + +//---------------------------------------------------------------------------- +// D3DCompile: +// ---------- +// Compile source text into bytecode appropriate for the given target. +//---------------------------------------------------------------------------- + +HRESULT WINAPI +D3DCompile(__in_bcount(SrcDataSize) LPCVOID pSrcData, + __in SIZE_T SrcDataSize, + __in_opt LPCSTR pSourceName, + __in_xcount_opt(pDefines->Name != NULL) CONST D3D_SHADER_MACRO* pDefines, + __in_opt ID3DInclude* pInclude, + __in LPCSTR pEntrypoint, + __in LPCSTR pTarget, + __in UINT Flags1, + __in UINT Flags2, + __out ID3DBlob** ppCode, + __out_opt ID3DBlob** ppErrorMsgs); + +typedef HRESULT (WINAPI *pD3DCompile) + (LPCVOID pSrcData, + SIZE_T SrcDataSize, + LPCSTR pFileName, + CONST D3D_SHADER_MACRO* pDefines, + ID3DInclude* pInclude, + LPCSTR pEntrypoint, + LPCSTR pTarget, + UINT Flags1, + UINT Flags2, + ID3DBlob** ppCode, + ID3DBlob** ppErrorMsgs); + +//---------------------------------------------------------------------------- +// D3DPreprocess: +// ---------- +// Process source text with the compiler's preprocessor and return +// the resulting text. +//---------------------------------------------------------------------------- + +HRESULT WINAPI +D3DPreprocess(__in_bcount(SrcDataSize) LPCVOID pSrcData, + __in SIZE_T SrcDataSize, + __in_opt LPCSTR pSourceName, + __in_opt CONST D3D_SHADER_MACRO* pDefines, + __in_opt ID3DInclude* pInclude, + __out ID3DBlob** ppCodeText, + __out_opt ID3DBlob** ppErrorMsgs); + +typedef HRESULT (WINAPI *pD3DPreprocess) + (LPCVOID pSrcData, + SIZE_T SrcDataSize, + LPCSTR pFileName, + CONST D3D_SHADER_MACRO* pDefines, + ID3DInclude* pInclude, + ID3DBlob** ppCodeText, + ID3DBlob** ppErrorMsgs); + +//---------------------------------------------------------------------------- +// D3DGetDebugInfo: +// ----------------------- +// Gets shader debug info. Debug info is generated by D3DCompile and is +// embedded in the body of the shader. +//---------------------------------------------------------------------------- + +HRESULT WINAPI +D3DGetDebugInfo(__in_bcount(SrcDataSize) LPCVOID pSrcData, + __in SIZE_T SrcDataSize, + __out ID3DBlob** ppDebugInfo); + +//---------------------------------------------------------------------------- +// D3DReflect: +// ---------- +// Shader code contains metadata that can be inspected via the +// reflection APIs. +//---------------------------------------------------------------------------- + +HRESULT WINAPI +D3DReflect(__in_bcount(SrcDataSize) LPCVOID pSrcData, + __in SIZE_T SrcDataSize, + __in REFIID pInterface, + __out void** ppReflector); + +//---------------------------------------------------------------------------- +// D3DDisassemble: +// ---------------------- +// Takes a binary shader and returns a buffer containing text assembly. +//---------------------------------------------------------------------------- + +#define D3D_DISASM_ENABLE_COLOR_CODE 0x00000001 +#define D3D_DISASM_ENABLE_DEFAULT_VALUE_PRINTS 0x00000002 +#define D3D_DISASM_ENABLE_INSTRUCTION_NUMBERING 0x00000004 +#define D3D_DISASM_ENABLE_INSTRUCTION_CYCLE 0x00000008 +#define D3D_DISASM_DISABLE_DEBUG_INFO 0x00000010 + +HRESULT WINAPI +D3DDisassemble(__in_bcount(SrcDataSize) LPCVOID pSrcData, + __in SIZE_T SrcDataSize, + __in UINT Flags, + __in_opt LPCSTR szComments, + __out ID3DBlob** ppDisassembly); + +typedef HRESULT (WINAPI *pD3DDisassemble) + (__in_bcount(SrcDataSize) LPCVOID pSrcData, + __in SIZE_T SrcDataSize, + __in UINT Flags, + __in_opt LPCSTR szComments, + __out ID3DBlob** ppDisassembly); + +//---------------------------------------------------------------------------- +// D3DDisassemble10Effect: +// ----------------------- +// Takes a D3D10 effect interface and returns a +// buffer containing text assembly. +//---------------------------------------------------------------------------- + +HRESULT WINAPI +D3DDisassemble10Effect(__in interface ID3D10Effect *pEffect, + __in UINT Flags, + __out ID3DBlob** ppDisassembly); + +//---------------------------------------------------------------------------- +// D3DGetInputSignatureBlob: +// ----------------------- +// Retrieve the input signature from a compilation result. +//---------------------------------------------------------------------------- + +HRESULT WINAPI +D3DGetInputSignatureBlob(__in_bcount(SrcDataSize) LPCVOID pSrcData, + __in SIZE_T SrcDataSize, + __out ID3DBlob** ppSignatureBlob); + +//---------------------------------------------------------------------------- +// D3DGetOutputSignatureBlob: +// ----------------------- +// Retrieve the output signature from a compilation result. +//---------------------------------------------------------------------------- + +HRESULT WINAPI +D3DGetOutputSignatureBlob(__in_bcount(SrcDataSize) LPCVOID pSrcData, + __in SIZE_T SrcDataSize, + __out ID3DBlob** ppSignatureBlob); + +//---------------------------------------------------------------------------- +// D3DGetInputAndOutputSignatureBlob: +// ----------------------- +// Retrieve the input and output signatures from a compilation result. +//---------------------------------------------------------------------------- + +HRESULT WINAPI +D3DGetInputAndOutputSignatureBlob(__in_bcount(SrcDataSize) LPCVOID pSrcData, + __in SIZE_T SrcDataSize, + __out ID3DBlob** ppSignatureBlob); + +//---------------------------------------------------------------------------- +// D3DStripShader: +// ----------------------- +// Removes unwanted blobs from a compilation result +//---------------------------------------------------------------------------- + +typedef enum D3DCOMPILER_STRIP_FLAGS +{ + D3DCOMPILER_STRIP_REFLECTION_DATA = 1, + D3DCOMPILER_STRIP_DEBUG_INFO = 2, + D3DCOMPILER_STRIP_TEST_BLOBS = 4, + D3DCOMPILER_STRIP_FORCE_DWORD = 0x7fffffff, +} D3DCOMPILER_STRIP_FLAGS; + +HRESULT WINAPI +D3DStripShader(__in_bcount(BytecodeLength) LPCVOID pShaderBytecode, + __in SIZE_T BytecodeLength, + __in UINT uStripFlags, + __out ID3DBlob** ppStrippedBlob); + +//---------------------------------------------------------------------------- +// D3DGetBlobPart: +// ----------------------- +// Extracts information from a compilation result. +//---------------------------------------------------------------------------- + +typedef enum D3D_BLOB_PART +{ + D3D_BLOB_INPUT_SIGNATURE_BLOB, + D3D_BLOB_OUTPUT_SIGNATURE_BLOB, + D3D_BLOB_INPUT_AND_OUTPUT_SIGNATURE_BLOB, + D3D_BLOB_PATCH_CONSTANT_SIGNATURE_BLOB, + D3D_BLOB_ALL_SIGNATURE_BLOB, + D3D_BLOB_DEBUG_INFO, + D3D_BLOB_LEGACY_SHADER, + D3D_BLOB_XNA_PREPASS_SHADER, + D3D_BLOB_XNA_SHADER, + + // Test parts are only produced by special compiler versions and so + // are usually not present in shaders. + D3D_BLOB_TEST_ALTERNATE_SHADER = 0x8000, + D3D_BLOB_TEST_COMPILE_DETAILS, + D3D_BLOB_TEST_COMPILE_PERF, +} D3D_BLOB_PART; + +HRESULT WINAPI +D3DGetBlobPart(__in_bcount(SrcDataSize) LPCVOID pSrcData, + __in SIZE_T SrcDataSize, + __in D3D_BLOB_PART Part, + __in UINT Flags, + __out ID3DBlob** ppPart); + +//---------------------------------------------------------------------------- +// D3DCompressShaders: +// ----------------------- +// Compresses a set of shaders into a more compact form. +//---------------------------------------------------------------------------- + +typedef struct _D3D_SHADER_DATA +{ + LPCVOID pBytecode; + SIZE_T BytecodeLength; +} D3D_SHADER_DATA; + +#define D3D_COMPRESS_SHADER_KEEP_ALL_PARTS 0x00000001 + +HRESULT WINAPI +D3DCompressShaders(__in UINT uNumShaders, + __in_ecount(uNumShaders) D3D_SHADER_DATA* pShaderData, + __in UINT uFlags, + __out ID3DBlob** ppCompressedData); + +//---------------------------------------------------------------------------- +// D3DDecompressShaders: +// ----------------------- +// Decompresses one or more shaders from a compressed set. +//---------------------------------------------------------------------------- + +HRESULT WINAPI +D3DDecompressShaders(__in_bcount(SrcDataSize) LPCVOID pSrcData, + __in SIZE_T SrcDataSize, + __in UINT uNumShaders, + __in UINT uStartIndex, + __in_ecount_opt(uNumShaders) UINT* pIndices, + __in UINT uFlags, + __out_ecount(uNumShaders) ID3DBlob** ppShaders, + __out_opt UINT* pTotalShaders); + +//---------------------------------------------------------------------------- +// D3DCreateBlob: +// ----------------------- +// Create an ID3DBlob instance. +//---------------------------------------------------------------------------- + +HRESULT WINAPI +D3DCreateBlob(__in SIZE_T Size, + __out ID3DBlob** ppBlob); + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif // #ifndef __D3DCOMPILER_H__ diff --git a/MediaClient/MediaClient/directx/include/DWrite.h b/MediaClient/MediaClient/directx/include/DWrite.h new file mode 100644 index 0000000..fc3b637 --- /dev/null +++ b/MediaClient/MediaClient/directx/include/DWrite.h @@ -0,0 +1,4995 @@ +//+-------------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// Abstract: +// DirectX Typography Services public API definitions. +// +//---------------------------------------------------------------------------- + +#ifndef DWRITE_H_INCLUDED +#define DWRITE_H_INCLUDED + +#if _MSC_VER > 1000 +#pragma once +#endif + +#ifndef DWRITE_NO_WINDOWS_H + +#include +#include + +#endif // DWRITE_NO_WINDOWS_H + +#include + +#ifndef DWRITE_DECLARE_INTERFACE +#define DWRITE_DECLARE_INTERFACE(iid) DECLSPEC_UUID(iid) DECLSPEC_NOVTABLE +#endif + +#ifndef DWRITE_EXPORT +#define DWRITE_EXPORT __declspec(dllimport) WINAPI +#endif + +/// +/// The type of a font represented by a single font file. +/// Font formats that consist of multiple files, e.g. Type 1 .PFM and .PFB, have +/// separate enum values for each of the file type. +/// +enum DWRITE_FONT_FILE_TYPE +{ + /// + /// Font type is not recognized by the DirectWrite font system. + /// + DWRITE_FONT_FILE_TYPE_UNKNOWN, + + /// + /// OpenType font with CFF outlines. + /// + DWRITE_FONT_FILE_TYPE_CFF, + + /// + /// OpenType font with TrueType outlines. + /// + DWRITE_FONT_FILE_TYPE_TRUETYPE, + + /// + /// OpenType font that contains a TrueType collection. + /// + DWRITE_FONT_FILE_TYPE_TRUETYPE_COLLECTION, + + /// + /// Type 1 PFM font. + /// + DWRITE_FONT_FILE_TYPE_TYPE1_PFM, + + /// + /// Type 1 PFB font. + /// + DWRITE_FONT_FILE_TYPE_TYPE1_PFB, + + /// + /// Vector .FON font. + /// + DWRITE_FONT_FILE_TYPE_VECTOR, + + /// + /// Bitmap .FON font. + /// + DWRITE_FONT_FILE_TYPE_BITMAP +}; + +/// +/// The file format of a complete font face. +/// Font formats that consist of multiple files, e.g. Type 1 .PFM and .PFB, have +/// a single enum entry. +/// +enum DWRITE_FONT_FACE_TYPE +{ + /// + /// OpenType font face with CFF outlines. + /// + DWRITE_FONT_FACE_TYPE_CFF, + + /// + /// OpenType font face with TrueType outlines. + /// + DWRITE_FONT_FACE_TYPE_TRUETYPE, + + /// + /// OpenType font face that is a part of a TrueType collection. + /// + DWRITE_FONT_FACE_TYPE_TRUETYPE_COLLECTION, + + /// + /// A Type 1 font face. + /// + DWRITE_FONT_FACE_TYPE_TYPE1, + + /// + /// A vector .FON format font face. + /// + DWRITE_FONT_FACE_TYPE_VECTOR, + + /// + /// A bitmap .FON format font face. + /// + DWRITE_FONT_FACE_TYPE_BITMAP, + + /// + /// Font face type is not recognized by the DirectWrite font system. + /// + DWRITE_FONT_FACE_TYPE_UNKNOWN +}; + +/// +/// Specifies algorithmic style simulations to be applied to the font face. +/// Bold and oblique simulations can be combined via bitwise OR operation. +/// +enum DWRITE_FONT_SIMULATIONS +{ + /// + /// No simulations are performed. + /// + DWRITE_FONT_SIMULATIONS_NONE = 0x0000, + + /// + /// Algorithmic emboldening is performed. + /// + DWRITE_FONT_SIMULATIONS_BOLD = 0x0001, + + /// + /// Algorithmic italicization is performed. + /// + DWRITE_FONT_SIMULATIONS_OBLIQUE = 0x0002 +}; + +#ifdef DEFINE_ENUM_FLAG_OPERATORS +DEFINE_ENUM_FLAG_OPERATORS(DWRITE_FONT_SIMULATIONS); +#endif + +/// +/// The font weight enumeration describes common values for degree of blackness or thickness of strokes of characters in a font. +/// Font weight values less than 1 or greater than 999 are considered to be invalid, and they are rejected by font API functions. +/// +enum DWRITE_FONT_WEIGHT +{ + /// + /// Predefined font weight : Thin (100). + /// + DWRITE_FONT_WEIGHT_THIN = 100, + + /// + /// Predefined font weight : Extra-light (200). + /// + DWRITE_FONT_WEIGHT_EXTRA_LIGHT = 200, + + /// + /// Predefined font weight : Ultra-light (200). + /// + DWRITE_FONT_WEIGHT_ULTRA_LIGHT = 200, + + /// + /// Predefined font weight : Light (300). + /// + DWRITE_FONT_WEIGHT_LIGHT = 300, + + /// + /// Predefined font weight : Normal (400). + /// + DWRITE_FONT_WEIGHT_NORMAL = 400, + + /// + /// Predefined font weight : Regular (400). + /// + DWRITE_FONT_WEIGHT_REGULAR = 400, + + /// + /// Predefined font weight : Medium (500). + /// + DWRITE_FONT_WEIGHT_MEDIUM = 500, + + /// + /// Predefined font weight : Demi-bold (600). + /// + DWRITE_FONT_WEIGHT_DEMI_BOLD = 600, + + /// + /// Predefined font weight : Semi-bold (600). + /// + DWRITE_FONT_WEIGHT_SEMI_BOLD = 600, + + /// + /// Predefined font weight : Bold (700). + /// + DWRITE_FONT_WEIGHT_BOLD = 700, + + /// + /// Predefined font weight : Extra-bold (800). + /// + DWRITE_FONT_WEIGHT_EXTRA_BOLD = 800, + + /// + /// Predefined font weight : Ultra-bold (800). + /// + DWRITE_FONT_WEIGHT_ULTRA_BOLD = 800, + + /// + /// Predefined font weight : Black (900). + /// + DWRITE_FONT_WEIGHT_BLACK = 900, + + /// + /// Predefined font weight : Heavy (900). + /// + DWRITE_FONT_WEIGHT_HEAVY = 900, + + /// + /// Predefined font weight : Extra-black (950). + /// + DWRITE_FONT_WEIGHT_EXTRA_BLACK = 950, + + /// + /// Predefined font weight : Ultra-black (950). + /// + DWRITE_FONT_WEIGHT_ULTRA_BLACK = 950 +}; + +/// +/// The font stretch enumeration describes relative change from the normal aspect ratio +/// as specified by a font designer for the glyphs in a font. +/// Values less than 1 or greater than 9 are considered to be invalid, and they are rejected by font API functions. +/// +enum DWRITE_FONT_STRETCH +{ + /// + /// Predefined font stretch : Not known (0). + /// + DWRITE_FONT_STRETCH_UNDEFINED = 0, + + /// + /// Predefined font stretch : Ultra-condensed (1). + /// + DWRITE_FONT_STRETCH_ULTRA_CONDENSED = 1, + + /// + /// Predefined font stretch : Extra-condensed (2). + /// + DWRITE_FONT_STRETCH_EXTRA_CONDENSED = 2, + + /// + /// Predefined font stretch : Condensed (3). + /// + DWRITE_FONT_STRETCH_CONDENSED = 3, + + /// + /// Predefined font stretch : Semi-condensed (4). + /// + DWRITE_FONT_STRETCH_SEMI_CONDENSED = 4, + + /// + /// Predefined font stretch : Normal (5). + /// + DWRITE_FONT_STRETCH_NORMAL = 5, + + /// + /// Predefined font stretch : Medium (5). + /// + DWRITE_FONT_STRETCH_MEDIUM = 5, + + /// + /// Predefined font stretch : Semi-expanded (6). + /// + DWRITE_FONT_STRETCH_SEMI_EXPANDED = 6, + + /// + /// Predefined font stretch : Expanded (7). + /// + DWRITE_FONT_STRETCH_EXPANDED = 7, + + /// + /// Predefined font stretch : Extra-expanded (8). + /// + DWRITE_FONT_STRETCH_EXTRA_EXPANDED = 8, + + /// + /// Predefined font stretch : Ultra-expanded (9). + /// + DWRITE_FONT_STRETCH_ULTRA_EXPANDED = 9 +}; + +/// +/// The font style enumeration describes the slope style of a font face, such as Normal, Italic or Oblique. +/// Values other than the ones defined in the enumeration are considered to be invalid, and they are rejected by font API functions. +/// +enum DWRITE_FONT_STYLE +{ + /// + /// Font slope style : Normal. + /// + DWRITE_FONT_STYLE_NORMAL, + + /// + /// Font slope style : Oblique. + /// + DWRITE_FONT_STYLE_OBLIQUE, + + /// + /// Font slope style : Italic. + /// + DWRITE_FONT_STYLE_ITALIC + +}; + +/// +/// The informational string enumeration identifies a string in a font. +/// +enum DWRITE_INFORMATIONAL_STRING_ID +{ + /// + /// Unspecified name ID. + /// + DWRITE_INFORMATIONAL_STRING_NONE, + + /// + /// Copyright notice provided by the font. + /// + DWRITE_INFORMATIONAL_STRING_COPYRIGHT_NOTICE, + + /// + /// String containing a version number. + /// + DWRITE_INFORMATIONAL_STRING_VERSION_STRINGS, + + /// + /// Trademark information provided by the font. + /// + DWRITE_INFORMATIONAL_STRING_TRADEMARK, + + /// + /// Name of the font manufacturer. + /// + DWRITE_INFORMATIONAL_STRING_MANUFACTURER, + + /// + /// Name of the font designer. + /// + DWRITE_INFORMATIONAL_STRING_DESIGNER, + + /// + /// URL of font designer (with protocol, e.g., http://, ftp://). + /// + DWRITE_INFORMATIONAL_STRING_DESIGNER_URL, + + /// + /// Description of the font. Can contain revision information, usage recommendations, history, features, etc. + /// + DWRITE_INFORMATIONAL_STRING_DESCRIPTION, + + /// + /// URL of font vendor (with protocol, e.g., http://, ftp://). If a unique serial number is embedded in the URL, it can be used to register the font. + /// + DWRITE_INFORMATIONAL_STRING_FONT_VENDOR_URL, + + /// + /// Description of how the font may be legally used, or different example scenarios for licensed use. This field should be written in plain language, not legalese. + /// + DWRITE_INFORMATIONAL_STRING_LICENSE_DESCRIPTION, + + /// + /// URL where additional licensing information can be found. + /// + DWRITE_INFORMATIONAL_STRING_LICENSE_INFO_URL, + + /// + /// GDI-compatible family name. Because GDI allows a maximum of four fonts per family, fonts in the same family may have different GDI-compatible family names + /// (e.g., "Arial", "Arial Narrow", "Arial Black"). + /// + DWRITE_INFORMATIONAL_STRING_WIN32_FAMILY_NAMES, + + /// + /// GDI-compatible subfamily name. + /// + DWRITE_INFORMATIONAL_STRING_WIN32_SUBFAMILY_NAMES, + + /// + /// Family name preferred by the designer. This enables font designers to group more than four fonts in a single family without losing compatibility with + /// GDI. This name is typically only present if it differs from the GDI-compatible family name. + /// + DWRITE_INFORMATIONAL_STRING_PREFERRED_FAMILY_NAMES, + + /// + /// Subfamily name preferred by the designer. This name is typically only present if it differs from the GDI-compatible subfamily name. + /// + DWRITE_INFORMATIONAL_STRING_PREFERRED_SUBFAMILY_NAMES, + + /// + /// Sample text. This can be the font name or any other text that the designer thinks is the best example to display the font in. + /// + DWRITE_INFORMATIONAL_STRING_SAMPLE_TEXT +}; + + +/// +/// The DWRITE_FONT_METRICS structure specifies the metrics of a font face that +/// are applicable to all glyphs within the font face. +/// +struct DWRITE_FONT_METRICS +{ + /// + /// The number of font design units per em unit. + /// Font files use their own coordinate system of font design units. + /// A font design unit is the smallest measurable unit in the em square, + /// an imaginary square that is used to size and align glyphs. + /// The concept of em square is used as a reference scale factor when defining font size and device transformation semantics. + /// The size of one em square is also commonly used to compute the paragraph identation value. + /// + UINT16 designUnitsPerEm; + + /// + /// Ascent value of the font face in font design units. + /// Ascent is the distance from the top of font character alignment box to English baseline. + /// + UINT16 ascent; + + /// + /// Descent value of the font face in font design units. + /// Descent is the distance from the bottom of font character alignment box to English baseline. + /// + UINT16 descent; + + /// + /// Line gap in font design units. + /// Recommended additional white space to add between lines to improve legibility. The recommended line spacing + /// (baseline-to-baseline distance) is thus the sum of ascent, descent, and lineGap. The line gap is usually + /// positive or zero but can be negative, in which case the recommended line spacing is less than the height + /// of the character alignment box. + /// + INT16 lineGap; + + /// + /// Cap height value of the font face in font design units. + /// Cap height is the distance from English baseline to the top of a typical English capital. + /// Capital "H" is often used as a reference character for the purpose of calculating the cap height value. + /// + UINT16 capHeight; + + /// + /// x-height value of the font face in font design units. + /// x-height is the distance from English baseline to the top of lowercase letter "x", or a similar lowercase character. + /// + UINT16 xHeight; + + /// + /// The underline position value of the font face in font design units. + /// Underline position is the position of underline relative to the English baseline. + /// The value is usually made negative in order to place the underline below the baseline. + /// + INT16 underlinePosition; + + /// + /// The suggested underline thickness value of the font face in font design units. + /// + UINT16 underlineThickness; + + /// + /// The strikethrough position value of the font face in font design units. + /// Strikethrough position is the position of strikethrough relative to the English baseline. + /// The value is usually made positive in order to place the strikethrough above the baseline. + /// + INT16 strikethroughPosition; + + /// + /// The suggested strikethrough thickness value of the font face in font design units. + /// + UINT16 strikethroughThickness; +}; + +/// +/// The DWRITE_GLYPH_METRICS structure specifies the metrics of an individual glyph. +/// The units depend on how the metrics are obtained. +/// +struct DWRITE_GLYPH_METRICS +{ + /// + /// Specifies the X offset from the glyph origin to the left edge of the black box. + /// The glyph origin is the current horizontal writing position. + /// A negative value means the black box extends to the left of the origin (often true for lowercase italic 'f'). + /// + INT32 leftSideBearing; + + /// + /// Specifies the X offset from the origin of the current glyph to the origin of the next glyph when writing horizontally. + /// + UINT32 advanceWidth; + + /// + /// Specifies the X offset from the right edge of the black box to the origin of the next glyph when writing horizontally. + /// The value is negative when the right edge of the black box overhangs the layout box. + /// + INT32 rightSideBearing; + + /// + /// Specifies the vertical offset from the vertical origin to the top of the black box. + /// Thus, a positive value adds whitespace whereas a negative value means the glyph overhangs the top of the layout box. + /// + INT32 topSideBearing; + + /// + /// Specifies the Y offset from the vertical origin of the current glyph to the vertical origin of the next glyph when writing vertically. + /// (Note that the term "origin" by itself denotes the horizontal origin. The vertical origin is different. + /// Its Y coordinate is specified by verticalOriginY value, + /// and its X coordinate is half the advanceWidth to the right of the horizontal origin). + /// + UINT32 advanceHeight; + + /// + /// Specifies the vertical distance from the black box's bottom edge to the advance height. + /// Positive when the bottom edge of the black box is within the layout box. + /// Negative when the bottom edge of black box overhangs the layout box. + /// + INT32 bottomSideBearing; + + /// + /// Specifies the Y coordinate of a glyph's vertical origin, in the font's design coordinate system. + /// The y coordinate of a glyph's vertical origin is the sum of the glyph's top side bearing + /// and the top (i.e. yMax) of the glyph's bounding box. + /// + INT32 verticalOriginY; +}; + +/// +/// Optional adjustment to a glyph's position. An glyph offset changes the position of a glyph without affecting +/// the pen position. Offsets are in logical, pre-transform units. +/// +struct DWRITE_GLYPH_OFFSET +{ + /// + /// Offset in the advance direction of the run. A positive advance offset moves the glyph to the right + /// (in pre-transform coordinates) if the run is left-to-right or to the left if the run is right-to-left. + /// + FLOAT advanceOffset; + + /// + /// Offset in the ascent direction, i.e., the direction ascenders point. A positive ascender offset moves + /// the glyph up (in pre-transform coordinates). + /// + FLOAT ascenderOffset; +}; + +/// +/// Specifies the type of DirectWrite factory object. +/// DirectWrite factory contains internal state such as font loader registration and cached font data. +/// In most cases it is recommended to use the shared factory object, because it allows multiple components +/// that use DirectWrite to share internal DirectWrite state and reduce memory usage. +/// However, there are cases when it is desirable to reduce the impact of a component, +/// such as a plug-in from an untrusted source, on the rest of the process by sandboxing and isolating it +/// from the rest of the process components. In such cases, it is recommended to use an isolated factory for the sandboxed +/// component. +/// +enum DWRITE_FACTORY_TYPE +{ + /// + /// Shared factory allow for re-use of cached font data across multiple in process components. + /// Such factories also take advantage of cross process font caching components for better performance. + /// + DWRITE_FACTORY_TYPE_SHARED, + + /// + /// Objects created from the isolated factory do not interact with internal DirectWrite state from other components. + /// + DWRITE_FACTORY_TYPE_ISOLATED +}; + +// Creates an OpenType tag as a 32bit integer such that +// the first character in the tag is the lowest byte, +// (least significant on little endian architectures) +// which can be used to compare with tags in the font file. +// This macro is compatible with DWRITE_FONT_FEATURE_TAG. +// +// Example: DWRITE_MAKE_OPENTYPE_TAG('c','c','m','p') +// Dword: 0x706D6363 +// +#define DWRITE_MAKE_OPENTYPE_TAG(a,b,c,d) ( \ + (static_cast(static_cast(d)) << 24) | \ + (static_cast(static_cast(c)) << 16) | \ + (static_cast(static_cast(b)) << 8) | \ + static_cast(static_cast(a))) + +interface IDWriteFontFileStream; + +/// +/// Font file loader interface handles loading font file resources of a particular type from a key. +/// The font file loader interface is recommended to be implemented by a singleton object. +/// IMPORTANT: font file loader implementations must not register themselves with DirectWrite factory +/// inside their constructors and must not unregister themselves in their destructors, because +/// registration and unregistraton operations increment and decrement the object reference count respectively. +/// Instead, registration and unregistration of font file loaders with DirectWrite factory should be performed +/// outside of the font file loader implementation as a separate step. +/// +interface DWRITE_DECLARE_INTERFACE("727cad4e-d6af-4c9e-8a08-d695b11caa49") IDWriteFontFileLoader : public IUnknown +{ + /// + /// Creates a font file stream object that encapsulates an open file resource. + /// The resource is closed when the last reference to fontFileStream is released. + /// + /// Font file reference key that uniquely identifies the font file resource + /// within the scope of the font loader being used. + /// Size of font file reference key in bytes. + /// Pointer to the newly created font file stream. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(CreateStreamFromKey)( + __in_bcount(fontFileReferenceKeySize) void const* fontFileReferenceKey, + UINT32 fontFileReferenceKeySize, + __out IDWriteFontFileStream** fontFileStream + ) PURE; +}; + +/// +/// A built-in implementation of IDWriteFontFileLoader interface that operates on local font files +/// and exposes local font file information from the font file reference key. +/// Font file references created using CreateFontFileReference use this font file loader. +/// +interface DWRITE_DECLARE_INTERFACE("b2d9f3ec-c9fe-4a11-a2ec-d86208f7c0a2") IDWriteLocalFontFileLoader : public IDWriteFontFileLoader +{ + /// + /// Obtains the length of the absolute file path from the font file reference key. + /// + /// Font file reference key that uniquely identifies the local font file + /// within the scope of the font loader being used. + /// Size of font file reference key in bytes. + /// Length of the file path string not including the terminated NULL character. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetFilePathLengthFromKey)( + __in_bcount(fontFileReferenceKeySize) void const* fontFileReferenceKey, + UINT32 fontFileReferenceKeySize, + __out UINT32* filePathLength + ) PURE; + + /// + /// Obtains the absolute font file path from the font file reference key. + /// + /// Font file reference key that uniquely identifies the local font file + /// within the scope of the font loader being used. + /// Size of font file reference key in bytes. + /// Character array that receives the local file path. + /// Size of the filePath array in character count including the terminated NULL character. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetFilePathFromKey)( + __in_bcount(fontFileReferenceKeySize) void const* fontFileReferenceKey, + UINT32 fontFileReferenceKeySize, + __out_ecount_z(filePathSize) WCHAR* filePath, + UINT32 filePathSize + ) PURE; + + /// + /// Obtains the last write time of the file from the font file reference key. + /// + /// Font file reference key that uniquely identifies the local font file + /// within the scope of the font loader being used. + /// Size of font file reference key in bytes. + /// Last modified time of the font file. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetLastWriteTimeFromKey)( + __in_bcount(fontFileReferenceKeySize) void const* fontFileReferenceKey, + UINT32 fontFileReferenceKeySize, + __out FILETIME* lastWriteTime + ) PURE; +}; + +/// +/// The interface for loading font file data. +/// +interface DWRITE_DECLARE_INTERFACE("6d4865fe-0ab8-4d91-8f62-5dd6be34a3e0") IDWriteFontFileStream : public IUnknown +{ + /// + /// Reads a fragment from a file. + /// + /// Receives the pointer to the start of the font file fragment. + /// Offset of the fragment from the beginning of the font file. + /// Size of the fragment in bytes. + /// The client defined context to be passed to the ReleaseFileFragment. + /// + /// Standard HRESULT error code. + /// + /// + /// IMPORTANT: ReadFileFragment() implementations must check whether the requested file fragment + /// is within the file bounds. Otherwise, an error should be returned from ReadFileFragment. + /// + STDMETHOD(ReadFileFragment)( + __deref_out_bcount(fragmentSize) void const** fragmentStart, + UINT64 fileOffset, + UINT64 fragmentSize, + __out void** fragmentContext + ) PURE; + + /// + /// Releases a fragment from a file. + /// + /// The client defined context of a font fragment returned from ReadFileFragment. + STDMETHOD_(void, ReleaseFileFragment)( + void* fragmentContext + ) PURE; + + /// + /// Obtains the total size of a file. + /// + /// Receives the total size of the file. + /// + /// Standard HRESULT error code. + /// + /// + /// Implementing GetFileSize() for asynchronously loaded font files may require + /// downloading the complete file contents, therefore this method should only be used for operations that + /// either require complete font file to be loaded (e.g., copying a font file) or need to make + /// decisions based on the value of the file size (e.g., validation against a persisted file size). + /// + STDMETHOD(GetFileSize)( + __out UINT64* fileSize + ) PURE; + + /// + /// Obtains the last modified time of the file. The last modified time is used by DirectWrite font selection algorithms + /// to determine whether one font resource is more up to date than another one. + /// + /// Receives the last modifed time of the file in the format that represents + /// the number of 100-nanosecond intervals since January 1, 1601 (UTC). + /// + /// Standard HRESULT error code. For resources that don't have a concept of the last modified time, the implementation of + /// GetLastWriteTime should return E_NOTIMPL. + /// + STDMETHOD(GetLastWriteTime)( + __out UINT64* lastWriteTime + ) PURE; +}; + +/// +/// The interface that represents a reference to a font file. +/// +interface DWRITE_DECLARE_INTERFACE("739d886a-cef5-47dc-8769-1a8b41bebbb0") IDWriteFontFile : public IUnknown +{ + /// + /// This method obtains the pointer to the reference key of a font file. The pointer is only valid until the object that refers to it is released. + /// + /// Pointer to the font file reference key. + /// IMPORTANT: The pointer value is valid until the font file reference object it is obtained from is released. + /// Size of font file reference key in bytes. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetReferenceKey)( + __deref_out_bcount(*fontFileReferenceKeySize) void const** fontFileReferenceKey, + __out UINT32* fontFileReferenceKeySize + ) PURE; + + /// + /// Obtains the file loader associated with a font file object. + /// + /// The font file loader associated with the font file object. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetLoader)( + __out IDWriteFontFileLoader** fontFileLoader + ) PURE; + + /// + /// Analyzes a file and returns whether it represents a font, and whether the font type is supported by the font system. + /// + /// TRUE if the font type is supported by the font system, FALSE otherwise. + /// The type of the font file. Note that even if isSupportedFontType is FALSE, + /// the fontFileType value may be different from DWRITE_FONT_FILE_TYPE_UNKNOWN. + /// The type of the font face that can be constructed from the font file. + /// Note that even if isSupportedFontType is FALSE, the fontFaceType value may be different from + /// DWRITE_FONT_FACE_TYPE_UNKNOWN. + /// Number of font faces contained in the font file. + /// + /// Standard HRESULT error code if there was a processing error during analysis. + /// + /// + /// IMPORTANT: certain font file types are recognized, but not supported by the font system. + /// For example, the font system will recognize a file as a Type 1 font file, + /// but will not be able to construct a font face object from it. In such situations, Analyze will set + /// isSupportedFontType output parameter to FALSE. + /// + STDMETHOD(Analyze)( + __out BOOL* isSupportedFontType, + __out DWRITE_FONT_FILE_TYPE* fontFileType, + __out_opt DWRITE_FONT_FACE_TYPE* fontFaceType, + __out UINT32* numberOfFaces + ) PURE; +}; + +/// +/// Represents the internal structure of a device pixel (i.e., the physical arrangement of red, +/// green, and blue color components) that is assumed for purposes of rendering text. +/// +#ifndef DWRITE_PIXEL_GEOMETRY_DEFINED +enum DWRITE_PIXEL_GEOMETRY +{ + /// + /// The red, green, and blue color components of each pixel are assumed to occupy the same point. + /// + DWRITE_PIXEL_GEOMETRY_FLAT, + + /// + /// Each pixel comprises three vertical stripes, with red on the left, green in the center, and + /// blue on the right. This is the most common pixel geometry for LCD monitors. + /// + DWRITE_PIXEL_GEOMETRY_RGB, + + /// + /// Each pixel comprises three vertical stripes, with blue on the left, green in the center, and + /// red on the right. + /// + DWRITE_PIXEL_GEOMETRY_BGR +}; +#define DWRITE_PIXEL_GEOMETRY_DEFINED +#endif + +/// +/// Represents a method of rendering glyphs. +/// +enum DWRITE_RENDERING_MODE +{ + /// + /// Specifies that the rendering mode is determined automatically based on the font and size. + /// + DWRITE_RENDERING_MODE_DEFAULT, + + /// + /// Specifies that no anti-aliasing is performed. Each pixel is either set to the foreground + /// color of the text or retains the color of the background. + /// + DWRITE_RENDERING_MODE_ALIASED, + + /// + /// Specifies ClearType rendering with the same metrics as aliased text. Glyphs can only + /// be positioned on whole-pixel boundaries. + /// + DWRITE_RENDERING_MODE_CLEARTYPE_GDI_CLASSIC, + + /// + /// Specifies ClearType rendering with the same metrics as text rendering using GDI using a font + /// created with CLEARTYPE_NATURAL_QUALITY. Glyph metrics are closer to their ideal values than + /// with aliased text, but glyphs are still positioned on whole-pixel boundaries. + /// + DWRITE_RENDERING_MODE_CLEARTYPE_GDI_NATURAL, + + /// + /// Specifies ClearType rendering with anti-aliasing in the horizontal dimension only. This is + /// typically used with small to medium font sizes (up to 16 ppem). + /// + DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL, + + /// + /// Specifies ClearType rendering with anti-aliasing in both horizontal and vertical dimensions. + /// This is typically used at larger sizes to makes curves and diagonal lines look smoother, at + /// the expense of some softness. + /// + DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL_SYMMETRIC, + + /// + /// Specifies that rendering should bypass the rasterizer and use the outlines directly. This is + /// typically used at very large sizes. + /// + DWRITE_RENDERING_MODE_OUTLINE +}; + +/// +/// The DWRITE_MATRIX structure specifies the graphics transform to be applied +/// to rendered glyphs. +/// +struct DWRITE_MATRIX +{ + /// + /// Horizontal scaling / cosine of rotation + /// + FLOAT m11; + + /// + /// Vertical shear / sine of rotation + /// + FLOAT m12; + + /// + /// Horizontal shear / negative sine of rotation + /// + FLOAT m21; + + /// + /// Vertical scaling / cosine of rotation + /// + FLOAT m22; + + /// + /// Horizontal shift (always orthogonal regardless of rotation) + /// + FLOAT dx; + + /// + /// Vertical shift (always orthogonal regardless of rotation) + /// + FLOAT dy; +}; + +/// +/// The interface that represents text rendering settings for glyph rasterization and filtering. +/// +interface DWRITE_DECLARE_INTERFACE("2f0da53a-2add-47cd-82ee-d9ec34688e75") IDWriteRenderingParams : public IUnknown +{ + /// + /// Gets the gamma value used for gamma correction. Valid values must be + /// greater than zero and cannot exceed 256. + /// + STDMETHOD_(FLOAT, GetGamma)() PURE; + + /// + /// Gets the amount of contrast enhancement. Valid values are greater than + /// or equal to zero. + /// + STDMETHOD_(FLOAT, GetEnhancedContrast)() PURE; + + /// + /// Gets the ClearType level. Valid values range from 0.0f (no ClearType) + /// to 1.0f (full ClearType). + /// + STDMETHOD_(FLOAT, GetClearTypeLevel)() PURE; + + /// + /// Gets the pixel geometry. + /// + STDMETHOD_(DWRITE_PIXEL_GEOMETRY, GetPixelGeometry)() PURE; + + /// + /// Gets the rendering mode. + /// + STDMETHOD_(DWRITE_RENDERING_MODE, GetRenderingMode)() PURE; +}; + +// Forward declarations of D2D types +interface ID2D1SimplifiedGeometrySink; + +typedef ID2D1SimplifiedGeometrySink IDWriteGeometrySink; + +/// +/// The interface that represents an absolute reference to a font face. +/// It contains font face type, appropriate file references and face identification data. +/// Various font data such as metrics, names and glyph outlines is obtained from IDWriteFontFace. +/// +interface DWRITE_DECLARE_INTERFACE("5f49804d-7024-4d43-bfa9-d25984f53849") IDWriteFontFace : public IUnknown +{ + /// + /// Obtains the file format type of a font face. + /// + STDMETHOD_(DWRITE_FONT_FACE_TYPE, GetType)() PURE; + + /// + /// Obtains the font files representing a font face. + /// + /// The number of files representing the font face. + /// User provided array that stores pointers to font files representing the font face. + /// This parameter can be NULL if the user is only interested in the number of files representing the font face. + /// This API increments reference count of the font file pointers returned according to COM conventions, and the client + /// should release them when finished. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetFiles)( + __inout UINT32* numberOfFiles, + __out_ecount_opt(*numberOfFiles) IDWriteFontFile** fontFiles + ) PURE; + + /// + /// Obtains the zero-based index of the font face in its font file or files. If the font files contain a single face, + /// the return value is zero. + /// + STDMETHOD_(UINT32, GetIndex)() PURE; + + /// + /// Obtains the algorithmic style simulation flags of a font face. + /// + STDMETHOD_(DWRITE_FONT_SIMULATIONS, GetSimulations)() PURE; + + /// + /// Determines whether the font is a symbol font. + /// + STDMETHOD_(BOOL, IsSymbolFont)() PURE; + + /// + /// Obtains design units and common metrics for the font face. + /// These metrics are applicable to all the glyphs within a fontface and are used by applications for layout calculations. + /// + /// Points to a DWRITE_FONT_METRICS structure to fill in. + /// The metrics returned by this function are in font design units. + STDMETHOD_(void, GetMetrics)( + __out DWRITE_FONT_METRICS* fontFaceMetrics + ) PURE; + + /// + /// Obtains the number of glyphs in the font face. + /// + STDMETHOD_(UINT16, GetGlyphCount)() PURE; + + /// + /// Obtains ideal glyph metrics in font design units. Design glyphs metrics are used for glyph positioning. + /// + /// An array of glyph indices to compute the metrics for. + /// The number of elements in the glyphIndices array. + /// Array of DWRITE_GLYPH_METRICS structures filled by this function. + /// The metrics returned by this function are in font design units. + /// Indicates whether the font is being used in a sideways run. + /// This can affect the glyph metrics if the font has oblique simulation + /// because sideways oblique simulation differs from non-sideways oblique simulation. + /// + /// Standard HRESULT error code. If any of the input glyph indices are outside of the valid glyph index range + /// for the current font face, E_INVALIDARG will be returned. + /// + STDMETHOD(GetDesignGlyphMetrics)( + __in_ecount(glyphCount) UINT16 const* glyphIndices, + UINT32 glyphCount, + __out_ecount(glyphCount) DWRITE_GLYPH_METRICS* glyphMetrics, + BOOL isSideways = FALSE + ) PURE; + + /// + /// Returns the nominal mapping of UCS4 Unicode code points to glyph indices as defined by the font 'CMAP' table. + /// Note that this mapping is primarily provided for line layout engines built on top of the physical font API. + /// Because of OpenType glyph substitution and line layout character substitution, the nominal conversion does not always correspond + /// to how a Unicode string will map to glyph indices when rendering using a particular font face. + /// Also, note that Unicode Variant Selectors provide for alternate mappings for character to glyph. + /// This call will always return the default variant. + /// + /// An array of USC4 code points to obtain nominal glyph indices from. + /// The number of elements in the codePoints array. + /// Array of nominal glyph indices filled by this function. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetGlyphIndices)( + __in_ecount(codePointCount) UINT32 const* codePoints, + UINT32 codePointCount, + __out_ecount(codePointCount) UINT16* glyphIndices + ) PURE; + + /// + /// Finds the specified OpenType font table if it exists and returns a pointer to it. + /// The function accesses the underling font data via the IDWriteFontStream interface + /// implemented by the font file loader. + /// + /// Four character tag of table to find. + /// Use the DWRITE_MAKE_OPENTYPE_TAG() macro to create it. + /// Unlike GDI, it does not support the special TTCF and null tags to access the whole font. + /// + /// Pointer to base of table in memory. + /// The pointer is only valid so long as the FontFace used to get the font table still exists + /// (not any other FontFace, even if it actually refers to the same physical font). + /// + /// Byte size of table. + /// + /// Opaque context which must be freed by calling ReleaseFontTable. + /// The context actually comes from the lower level IDWriteFontFileStream, + /// which may be implemented by the application or DWrite itself. + /// It is possible for a NULL tableContext to be returned, especially if + /// the implementation directly memory maps the whole file. + /// Nevertheless, always release it later, and do not use it as a test for function success. + /// The same table can be queried multiple times, + /// but each returned context can be different, so release each separately. + /// + /// True if table exists. + /// + /// Standard HRESULT error code. + /// If a table can not be found, the function will not return an error, but the size will be 0, table NULL, and exists = FALSE. + /// The context does not need to be freed if the table was not found. + /// + /// + /// The context for the same tag may be different for each call, + /// so each one must be held and released separately. + /// + STDMETHOD(TryGetFontTable)( + __in UINT32 openTypeTableTag, + __deref_out_bcount(*tableSize) const void** tableData, + __out UINT32* tableSize, + __out void** tableContext, + __out BOOL* exists + ) PURE; + + /// + /// Releases the table obtained earlier from TryGetFontTable. + /// + /// Opaque context from TryGetFontTable. + /// + /// Standard HRESULT error code. + /// + STDMETHOD_(void, ReleaseFontTable)( + __in void* tableContext + ) PURE; + + /// + /// Computes the outline of a run of glyphs by calling back to the outline sink interface. + /// + /// Logical size of the font in DIP units. A DIP ("device-independent pixel") equals 1/96 inch. + /// Array of glyph indices. + /// Optional array of glyph advances in DIPs. + /// Optional array of glyph offsets. + /// Number of glyphs. + /// If true, specifies that glyphs are rotated 90 degrees to the left and vertical metrics are used. + /// A client can render a vertical run by specifying isSideways = true and rotating the resulting geometry 90 degrees to the + /// right using a transform. The isSideways and isRightToLeft parameters cannot both be true. + /// If true, specifies that the advance direction is right to left. By default, the advance direction + /// is left to right. + /// Interface the function calls back to draw each element of the geometry. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetGlyphRunOutline)( + FLOAT emSize, + __in_ecount(glyphCount) UINT16 const* glyphIndices, + __in_ecount_opt(glyphCount) FLOAT const* glyphAdvances, + __in_ecount_opt(glyphCount) DWRITE_GLYPH_OFFSET const* glyphOffsets, + UINT32 glyphCount, + BOOL isSideways, + BOOL isRightToLeft, + IDWriteGeometrySink* geometrySink + ) PURE; + + /// + /// Determines the recommended rendering mode for the font given the specified size and rendering parameters. + /// + /// Logical size of the font in DIP units. A DIP ("device-independent pixel") equals 1/96 inch. + /// Number of physical pixels per DIP. For example, if the DPI of the rendering surface is 96 this + /// value is 1.0f. If the DPI is 120, this value is 120.0f/96. + /// Specifies measuring method that will be used for glyphs in the font. + /// Renderer implementations may choose different rendering modes for given measuring methods, but + /// best results are seen when the corresponding modes match: + /// DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL for DWRITE_MEASURING_MODE_NATURAL + /// DWRITE_RENDERING_MODE_CLEARTYPE_GDI_CLASSIC for DWRITE_MEASURING_MODE_GDI_CLASSIC + /// DWRITE_RENDERING_MODE_CLEARTYPE_GDI_NATURAL for DWRITE_MEASURING_MODE_GDI_NATURAL + /// + /// Rendering parameters object. This parameter is necessary in case the rendering parameters + /// object overrides the rendering mode. + /// Receives the recommended rendering mode to use. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetRecommendedRenderingMode)( + FLOAT emSize, + FLOAT pixelsPerDip, + DWRITE_MEASURING_MODE measuringMode, + IDWriteRenderingParams* renderingParams, + __out DWRITE_RENDERING_MODE* renderingMode + ) PURE; + + /// + /// Obtains design units and common metrics for the font face. + /// These metrics are applicable to all the glyphs within a fontface and are used by applications for layout calculations. + /// + /// Logical size of the font in DIP units. A DIP ("device-independent pixel") equals 1/96 inch. + /// Number of physical pixels per DIP. For example, if the DPI of the rendering surface is 96 this + /// value is 1.0f. If the DPI is 120, this value is 120.0f/96. + /// Optional transform applied to the glyphs and their positions. This transform is applied after the + /// scaling specified by the font size and pixelsPerDip. + /// Points to a DWRITE_FONT_METRICS structure to fill in. + /// The metrics returned by this function are in font design units. + STDMETHOD(GetGdiCompatibleMetrics)( + FLOAT emSize, + FLOAT pixelsPerDip, + __in_opt DWRITE_MATRIX const* transform, + __out DWRITE_FONT_METRICS* fontFaceMetrics + ) PURE; + + + /// + /// Obtains glyph metrics in font design units with the return values compatible with what GDI would produce. + /// Glyphs metrics are used for positioning of individual glyphs. + /// + /// Logical size of the font in DIP units. A DIP ("device-independent pixel") equals 1/96 inch. + /// Number of physical pixels per DIP. For example, if the DPI of the rendering surface is 96 this + /// value is 1.0f. If the DPI is 120, this value is 120.0f/96. + /// Optional transform applied to the glyphs and their positions. This transform is applied after the + /// scaling specified by the font size and pixelsPerDip. + /// + /// When set to FALSE, the metrics are the same as the metrics of GDI aliased text. + /// When set to TRUE, the metrics are the same as the metrics of text measured by GDI using a font + /// created with CLEARTYPE_NATURAL_QUALITY. + /// + /// An array of glyph indices to compute the metrics for. + /// The number of elements in the glyphIndices array. + /// Array of DWRITE_GLYPH_METRICS structures filled by this function. + /// The metrics returned by this function are in font design units. + /// Indicates whether the font is being used in a sideways run. + /// This can affect the glyph metrics if the font has oblique simulation + /// because sideways oblique simulation differs from non-sideways oblique simulation. + /// + /// Standard HRESULT error code. If any of the input glyph indices are outside of the valid glyph index range + /// for the current font face, E_INVALIDARG will be returned. + /// + STDMETHOD(GetGdiCompatibleGlyphMetrics)( + FLOAT emSize, + FLOAT pixelsPerDip, + __in_opt DWRITE_MATRIX const* transform, + BOOL useGdiNatural, + __in_ecount(glyphCount) UINT16 const* glyphIndices, + UINT32 glyphCount, + __out_ecount(glyphCount) DWRITE_GLYPH_METRICS* glyphMetrics, + BOOL isSideways = FALSE + ) PURE; +}; + +interface IDWriteFactory; +interface IDWriteFontFileEnumerator; + +/// +/// The font collection loader interface is used to construct a collection of fonts given a particular type of key. +/// The font collection loader interface is recommended to be implemented by a singleton object. +/// IMPORTANT: font collection loader implementations must not register themselves with a DirectWrite factory +/// inside their constructors and must not unregister themselves in their destructors, because +/// registration and unregistraton operations increment and decrement the object reference count respectively. +/// Instead, registration and unregistration of font file loaders with DirectWrite factory should be performed +/// outside of the font file loader implementation as a separate step. +/// +interface DWRITE_DECLARE_INTERFACE("cca920e4-52f0-492b-bfa8-29c72ee0a468") IDWriteFontCollectionLoader : public IUnknown +{ + /// + /// Creates a font file enumerator object that encapsulates a collection of font files. + /// The font system calls back to this interface to create a font collection. + /// + /// Factory associated with the loader. + /// Font collection key that uniquely identifies the collection of font files within + /// the scope of the font collection loader being used. + /// Size of the font collection key in bytes. + /// Pointer to the newly created font file enumerator. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(CreateEnumeratorFromKey)( + IDWriteFactory* factory, + __in_bcount(collectionKeySize) void const* collectionKey, + UINT32 collectionKeySize, + __out IDWriteFontFileEnumerator** fontFileEnumerator + ) PURE; +}; + +/// +/// The font file enumerator interface encapsulates a collection of font files. The font system uses this interface +/// to enumerate font files when building a font collection. +/// +interface DWRITE_DECLARE_INTERFACE("72755049-5ff7-435d-8348-4be97cfa6c7c") IDWriteFontFileEnumerator : public IUnknown +{ + /// + /// Advances to the next font file in the collection. When it is first created, the enumerator is positioned + /// before the first element of the collection and the first call to MoveNext advances to the first file. + /// + /// Receives the value TRUE if the enumerator advances to a file, or FALSE if + /// the enumerator advanced past the last file in the collection. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(MoveNext)( + __out BOOL* hasCurrentFile + ) PURE; + + /// + /// Gets a reference to the current font file. + /// + /// Pointer to the newly created font file object. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetCurrentFontFile)( + __out IDWriteFontFile** fontFile + ) PURE; +}; + +/// +/// Represents a collection of strings indexed by locale name. +/// +interface DWRITE_DECLARE_INTERFACE("08256209-099a-4b34-b86d-c22b110e7771") IDWriteLocalizedStrings : public IUnknown +{ + /// + /// Gets the number of language/string pairs. + /// + STDMETHOD_(UINT32, GetCount)() PURE; + + /// + /// Gets the index of the item with the specified locale name. + /// + /// Locale name to look for. + /// Receives the zero-based index of the locale name/string pair. + /// Receives TRUE if the locale name exists or FALSE if not. + /// + /// Standard HRESULT error code. If the specified locale name does not exist, the return value is S_OK, + /// but *index is UINT_MAX and *exists is FALSE. + /// + STDMETHOD(FindLocaleName)( + __in_z WCHAR const* localeName, + __out UINT32* index, + __out BOOL* exists + ) PURE; + + /// + /// Gets the length in characters (not including the null terminator) of the locale name with the specified index. + /// + /// Zero-based index of the locale name. + /// Receives the length in characters, not including the null terminator. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetLocaleNameLength)( + UINT32 index, + __out UINT32* length + ) PURE; + + /// + /// Copies the locale name with the specified index to the specified array. + /// + /// Zero-based index of the locale name. + /// Character array that receives the locale name. + /// Size of the array in characters. The size must include space for the terminating + /// null character. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetLocaleName)( + UINT32 index, + __out_ecount_z(size) WCHAR* localeName, + UINT32 size + ) PURE; + + /// + /// Gets the length in characters (not including the null terminator) of the string with the specified index. + /// + /// Zero-based index of the string. + /// Receives the length in characters, not including the null terminator. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetStringLength)( + UINT32 index, + __out UINT32* length + ) PURE; + + /// + /// Copies the string with the specified index to the specified array. + /// + /// Zero-based index of the string. + /// Character array that receives the string. + /// Size of the array in characters. The size must include space for the terminating + /// null character. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetString)( + UINT32 index, + __out_ecount_z(size) WCHAR* stringBuffer, + UINT32 size + ) PURE; +}; + +interface IDWriteFontFamily; +interface IDWriteFont; + +/// +/// The IDWriteFontCollection encapsulates a collection of fonts. +/// +interface DWRITE_DECLARE_INTERFACE("a84cee02-3eea-4eee-a827-87c1a02a0fcc") IDWriteFontCollection : public IUnknown +{ + /// + /// Gets the number of font families in the collection. + /// + STDMETHOD_(UINT32, GetFontFamilyCount)() PURE; + + /// + /// Creates a font family object given a zero-based font family index. + /// + /// Zero-based index of the font family. + /// Receives a pointer the newly created font family object. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetFontFamily)( + UINT32 index, + __out IDWriteFontFamily** fontFamily + ) PURE; + + /// + /// Finds the font family with the specified family name. + /// + /// Name of the font family. The name is not case-sensitive but must otherwise exactly match a family name in the collection. + /// Receives the zero-based index of the matching font family if the family name was found or UINT_MAX otherwise. + /// Receives TRUE if the family name exists or FALSE otherwise. + /// + /// Standard HRESULT error code. If the specified family name does not exist, the return value is S_OK, but *index is UINT_MAX and *exists is FALSE. + /// + STDMETHOD(FindFamilyName)( + __in_z WCHAR const* familyName, + __out UINT32* index, + __out BOOL* exists + ) PURE; + + /// + /// Gets the font object that corresponds to the same physical font as the specified font face object. The specified physical font must belong + /// to the font collection. + /// + /// Font face object that specifies the physical font. + /// Receives a pointer to the newly created font object if successful or NULL otherwise. + /// + /// Standard HRESULT error code. If the specified physical font is not part of the font collection the return value is DWRITE_E_NOFONT. + /// + STDMETHOD(GetFontFromFontFace)( + IDWriteFontFace* fontFace, + __out IDWriteFont** font + ) PURE; +}; + +/// +/// The IDWriteFontList interface represents a list of fonts. +/// +interface DWRITE_DECLARE_INTERFACE("1a0d8438-1d97-4ec1-aef9-a2fb86ed6acb") IDWriteFontList : public IUnknown +{ + /// + /// Gets the font collection that contains the fonts. + /// + /// Receives a pointer to the font collection object. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetFontCollection)( + __out IDWriteFontCollection** fontCollection + ) PURE; + + /// + /// Gets the number of fonts in the font list. + /// + STDMETHOD_(UINT32, GetFontCount)() PURE; + + /// + /// Gets a font given its zero-based index. + /// + /// Zero-based index of the font in the font list. + /// Receives a pointer to the newly created font object. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetFont)( + UINT32 index, + __out IDWriteFont** font + ) PURE; +}; + +/// +/// The IDWriteFontFamily interface represents a set of fonts that share the same design but are differentiated +/// by weight, stretch, and style. +/// +interface DWRITE_DECLARE_INTERFACE("da20d8ef-812a-4c43-9802-62ec4abd7add") IDWriteFontFamily : public IDWriteFontList +{ + /// + /// Creates an localized strings object that contains the family names for the font family, indexed by locale name. + /// + /// Receives a pointer to the newly created localized strings object. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetFamilyNames)( + __out IDWriteLocalizedStrings** names + ) PURE; + + /// + /// Gets the font that best matches the specified properties. + /// + /// Requested font weight. + /// Requested font stretch. + /// Requested font style. + /// Receives a pointer to the newly created font object. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetFirstMatchingFont)( + DWRITE_FONT_WEIGHT weight, + DWRITE_FONT_STRETCH stretch, + DWRITE_FONT_STYLE style, + __out IDWriteFont** matchingFont + ) PURE; + + /// + /// Gets a list of fonts in the font family ranked in order of how well they match the specified properties. + /// + /// Requested font weight. + /// Requested font stretch. + /// Requested font style. + /// Receives a pointer to the newly created font list object. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetMatchingFonts)( + DWRITE_FONT_WEIGHT weight, + DWRITE_FONT_STRETCH stretch, + DWRITE_FONT_STYLE style, + __out IDWriteFontList** matchingFonts + ) PURE; +}; + +/// +/// The IDWriteFont interface represents a physical font in a font collection. +/// +interface DWRITE_DECLARE_INTERFACE("acd16696-8c14-4f5d-877e-fe3fc1d32737") IDWriteFont : public IUnknown +{ + /// + /// Gets the font family to which the specified font belongs. + /// + /// Receives a pointer to the font family object. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetFontFamily)( + __out IDWriteFontFamily** fontFamily + ) PURE; + + /// + /// Gets the weight of the specified font. + /// + STDMETHOD_(DWRITE_FONT_WEIGHT, GetWeight)() PURE; + + /// + /// Gets the stretch (aka. width) of the specified font. + /// + STDMETHOD_(DWRITE_FONT_STRETCH, GetStretch)() PURE; + + /// + /// Gets the style (aka. slope) of the specified font. + /// + STDMETHOD_(DWRITE_FONT_STYLE, GetStyle)() PURE; + + /// + /// Returns TRUE if the font is a symbol font or FALSE if not. + /// + STDMETHOD_(BOOL, IsSymbolFont)() PURE; + + /// + /// Gets a localized strings collection containing the face names for the font (e.g., Regular or Bold), indexed by locale name. + /// + /// Receives a pointer to the newly created localized strings object. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetFaceNames)( + __out IDWriteLocalizedStrings** names + ) PURE; + + /// + /// Gets a localized strings collection containing the specified informational strings, indexed by locale name. + /// + /// Identifies the string to get. + /// Receives a pointer to the newly created localized strings object. + /// Receives the value TRUE if the font contains the specified string ID or FALSE if not. + /// + /// Standard HRESULT error code. If the font does not contain the specified string, the return value is S_OK but + /// informationalStrings receives a NULL pointer and exists receives the value FALSE. + /// + STDMETHOD(GetInformationalStrings)( + DWRITE_INFORMATIONAL_STRING_ID informationalStringID, + __out IDWriteLocalizedStrings** informationalStrings, + __out BOOL* exists + ) PURE; + + /// + /// Gets a value that indicates what simulation are applied to the specified font. + /// + STDMETHOD_(DWRITE_FONT_SIMULATIONS, GetSimulations)() PURE; + + /// + /// Gets the metrics for the font. + /// + /// Receives the font metrics. + STDMETHOD_(void, GetMetrics)( + __out DWRITE_FONT_METRICS* fontMetrics + ) PURE; + + /// + /// Determines whether the font supports the specified character. + /// + /// Unicode (UCS-4) character value. + /// Receives the value TRUE if the font supports the specified character or FALSE if not. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(HasCharacter)( + UINT32 unicodeValue, + __out BOOL* exists + ) PURE; + + /// + /// Creates a font face object for the font. + /// + /// Receives a pointer to the newly created font face object. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(CreateFontFace)( + __out IDWriteFontFace** fontFace + ) PURE; +}; + +/// +/// Direction for how reading progresses. +/// +enum DWRITE_READING_DIRECTION +{ + /// + /// Reading progresses from left to right. + /// + DWRITE_READING_DIRECTION_LEFT_TO_RIGHT, + + /// + /// Reading progresses from right to left. + /// + DWRITE_READING_DIRECTION_RIGHT_TO_LEFT +}; + +/// +/// Direction for how lines of text are placed relative to one another. +/// +enum DWRITE_FLOW_DIRECTION +{ + /// + /// Text lines are placed from top to bottom. + /// + DWRITE_FLOW_DIRECTION_TOP_TO_BOTTOM +}; + +/// +/// Alignment of paragraph text along the reading direction axis relative to +/// the leading and trailing edge of the layout box. +/// +enum DWRITE_TEXT_ALIGNMENT +{ + /// + /// The leading edge of the paragraph text is aligned to the layout box's leading edge. + /// + DWRITE_TEXT_ALIGNMENT_LEADING, + + /// + /// The trailing edge of the paragraph text is aligned to the layout box's trailing edge. + /// + DWRITE_TEXT_ALIGNMENT_TRAILING, + + /// + /// The center of the paragraph text is aligned to the center of the layout box. + /// + DWRITE_TEXT_ALIGNMENT_CENTER +}; + +/// +/// Alignment of paragraph text along the flow direction axis relative to the +/// flow's beginning and ending edge of the layout box. +/// +enum DWRITE_PARAGRAPH_ALIGNMENT +{ + /// + /// The first line of paragraph is aligned to the flow's beginning edge of the layout box. + /// + DWRITE_PARAGRAPH_ALIGNMENT_NEAR, + + /// + /// The last line of paragraph is aligned to the flow's ending edge of the layout box. + /// + DWRITE_PARAGRAPH_ALIGNMENT_FAR, + + /// + /// The center of the paragraph is aligned to the center of the flow of the layout box. + /// + DWRITE_PARAGRAPH_ALIGNMENT_CENTER +}; + +/// +/// Word wrapping in multiline paragraph. +/// +enum DWRITE_WORD_WRAPPING +{ + /// + /// Words are broken across lines to avoid text overflowing the layout box. + /// + DWRITE_WORD_WRAPPING_WRAP, + + /// + /// Words are kept within the same line even when it overflows the layout box. + /// This option is often used with scrolling to reveal overflow text. + /// + DWRITE_WORD_WRAPPING_NO_WRAP +}; + +/// +/// The method used for line spacing in layout. +/// +enum DWRITE_LINE_SPACING_METHOD +{ + /// + /// Line spacing depends solely on the content, growing to accomodate the size of fonts and inline objects. + /// + DWRITE_LINE_SPACING_METHOD_DEFAULT, + + /// + /// Lines are explicitly set to uniform spacing, regardless of contained font sizes. + /// This can be useful to avoid the uneven appearance that can occur from font fallback. + /// + DWRITE_LINE_SPACING_METHOD_UNIFORM +}; + +/// +/// Text granularity used to trim text overflowing the layout box. +/// +enum DWRITE_TRIMMING_GRANULARITY +{ + /// + /// No trimming occurs. Text flows beyond the layout width. + /// + DWRITE_TRIMMING_GRANULARITY_NONE, + + /// + /// Trimming occurs at character cluster boundary. + /// + DWRITE_TRIMMING_GRANULARITY_CHARACTER, + + /// + /// Trimming occurs at word boundary. + /// + DWRITE_TRIMMING_GRANULARITY_WORD +}; + +/// +/// Typographic feature of text supplied by the font. +/// +enum DWRITE_FONT_FEATURE_TAG +{ + DWRITE_FONT_FEATURE_TAG_ALTERNATIVE_FRACTIONS = 0x63726661, // 'afrc' + DWRITE_FONT_FEATURE_TAG_PETITE_CAPITALS_FROM_CAPITALS = 0x63703263, // 'c2pc' + DWRITE_FONT_FEATURE_TAG_SMALL_CAPITALS_FROM_CAPITALS = 0x63733263, // 'c2sc' + DWRITE_FONT_FEATURE_TAG_CONTEXTUAL_ALTERNATES = 0x746c6163, // 'calt' + DWRITE_FONT_FEATURE_TAG_CASE_SENSITIVE_FORMS = 0x65736163, // 'case' + DWRITE_FONT_FEATURE_TAG_GLYPH_COMPOSITION_DECOMPOSITION = 0x706d6363, // 'ccmp' + DWRITE_FONT_FEATURE_TAG_CONTEXTUAL_LIGATURES = 0x67696c63, // 'clig' + DWRITE_FONT_FEATURE_TAG_CAPITAL_SPACING = 0x70737063, // 'cpsp' + DWRITE_FONT_FEATURE_TAG_CONTEXTUAL_SWASH = 0x68777363, // 'cswh' + DWRITE_FONT_FEATURE_TAG_CURSIVE_POSITIONING = 0x73727563, // 'curs' + DWRITE_FONT_FEATURE_TAG_DEFAULT = 0x746c6664, // 'dflt' + DWRITE_FONT_FEATURE_TAG_DISCRETIONARY_LIGATURES = 0x67696c64, // 'dlig' + DWRITE_FONT_FEATURE_TAG_EXPERT_FORMS = 0x74707865, // 'expt' + DWRITE_FONT_FEATURE_TAG_FRACTIONS = 0x63617266, // 'frac' + DWRITE_FONT_FEATURE_TAG_FULL_WIDTH = 0x64697766, // 'fwid' + DWRITE_FONT_FEATURE_TAG_HALF_FORMS = 0x666c6168, // 'half' + DWRITE_FONT_FEATURE_TAG_HALANT_FORMS = 0x6e6c6168, // 'haln' + DWRITE_FONT_FEATURE_TAG_ALTERNATE_HALF_WIDTH = 0x746c6168, // 'halt' + DWRITE_FONT_FEATURE_TAG_HISTORICAL_FORMS = 0x74736968, // 'hist' + DWRITE_FONT_FEATURE_TAG_HORIZONTAL_KANA_ALTERNATES = 0x616e6b68, // 'hkna' + DWRITE_FONT_FEATURE_TAG_HISTORICAL_LIGATURES = 0x67696c68, // 'hlig' + DWRITE_FONT_FEATURE_TAG_HALF_WIDTH = 0x64697768, // 'hwid' + DWRITE_FONT_FEATURE_TAG_HOJO_KANJI_FORMS = 0x6f6a6f68, // 'hojo' + DWRITE_FONT_FEATURE_TAG_JIS04_FORMS = 0x3430706a, // 'jp04' + DWRITE_FONT_FEATURE_TAG_JIS78_FORMS = 0x3837706a, // 'jp78' + DWRITE_FONT_FEATURE_TAG_JIS83_FORMS = 0x3338706a, // 'jp83' + DWRITE_FONT_FEATURE_TAG_JIS90_FORMS = 0x3039706a, // 'jp90' + DWRITE_FONT_FEATURE_TAG_KERNING = 0x6e72656b, // 'kern' + DWRITE_FONT_FEATURE_TAG_STANDARD_LIGATURES = 0x6167696c, // 'liga' + DWRITE_FONT_FEATURE_TAG_LINING_FIGURES = 0x6d756e6c, // 'lnum' + DWRITE_FONT_FEATURE_TAG_LOCALIZED_FORMS = 0x6c636f6c, // 'locl' + DWRITE_FONT_FEATURE_TAG_MARK_POSITIONING = 0x6b72616d, // 'mark' + DWRITE_FONT_FEATURE_TAG_MATHEMATICAL_GREEK = 0x6b72676d, // 'mgrk' + DWRITE_FONT_FEATURE_TAG_MARK_TO_MARK_POSITIONING = 0x6b6d6b6d, // 'mkmk' + DWRITE_FONT_FEATURE_TAG_ALTERNATE_ANNOTATION_FORMS = 0x746c616e, // 'nalt' + DWRITE_FONT_FEATURE_TAG_NLC_KANJI_FORMS = 0x6b636c6e, // 'nlck' + DWRITE_FONT_FEATURE_TAG_OLD_STYLE_FIGURES = 0x6d756e6f, // 'onum' + DWRITE_FONT_FEATURE_TAG_ORDINALS = 0x6e64726f, // 'ordn' + DWRITE_FONT_FEATURE_TAG_PROPORTIONAL_ALTERNATE_WIDTH = 0x746c6170, // 'palt' + DWRITE_FONT_FEATURE_TAG_PETITE_CAPITALS = 0x70616370, // 'pcap' + DWRITE_FONT_FEATURE_TAG_PROPORTIONAL_FIGURES = 0x6d756e70, // 'pnum' + DWRITE_FONT_FEATURE_TAG_PROPORTIONAL_WIDTHS = 0x64697770, // 'pwid' + DWRITE_FONT_FEATURE_TAG_QUARTER_WIDTHS = 0x64697771, // 'qwid' + DWRITE_FONT_FEATURE_TAG_REQUIRED_LIGATURES = 0x67696c72, // 'rlig' + DWRITE_FONT_FEATURE_TAG_RUBY_NOTATION_FORMS = 0x79627572, // 'ruby' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_ALTERNATES = 0x746c6173, // 'salt' + DWRITE_FONT_FEATURE_TAG_SCIENTIFIC_INFERIORS = 0x666e6973, // 'sinf' + DWRITE_FONT_FEATURE_TAG_SMALL_CAPITALS = 0x70636d73, // 'smcp' + DWRITE_FONT_FEATURE_TAG_SIMPLIFIED_FORMS = 0x6c706d73, // 'smpl' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_1 = 0x31307373, // 'ss01' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_2 = 0x32307373, // 'ss02' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_3 = 0x33307373, // 'ss03' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_4 = 0x34307373, // 'ss04' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_5 = 0x35307373, // 'ss05' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_6 = 0x36307373, // 'ss06' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_7 = 0x37307373, // 'ss07' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_8 = 0x38307373, // 'ss08' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_9 = 0x39307373, // 'ss09' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_10 = 0x30317373, // 'ss10' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_11 = 0x31317373, // 'ss11' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_12 = 0x32317373, // 'ss12' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_13 = 0x33317373, // 'ss13' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_14 = 0x34317373, // 'ss14' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_15 = 0x35317373, // 'ss15' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_16 = 0x36317373, // 'ss16' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_17 = 0x37317373, // 'ss17' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_18 = 0x38317373, // 'ss18' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_19 = 0x39317373, // 'ss19' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_20 = 0x30327373, // 'ss20' + DWRITE_FONT_FEATURE_TAG_SUBSCRIPT = 0x73627573, // 'subs' + DWRITE_FONT_FEATURE_TAG_SUPERSCRIPT = 0x73707573, // 'sups' + DWRITE_FONT_FEATURE_TAG_SWASH = 0x68737773, // 'swsh' + DWRITE_FONT_FEATURE_TAG_TITLING = 0x6c746974, // 'titl' + DWRITE_FONT_FEATURE_TAG_TRADITIONAL_NAME_FORMS = 0x6d616e74, // 'tnam' + DWRITE_FONT_FEATURE_TAG_TABULAR_FIGURES = 0x6d756e74, // 'tnum' + DWRITE_FONT_FEATURE_TAG_TRADITIONAL_FORMS = 0x64617274, // 'trad' + DWRITE_FONT_FEATURE_TAG_THIRD_WIDTHS = 0x64697774, // 'twid' + DWRITE_FONT_FEATURE_TAG_UNICASE = 0x63696e75, // 'unic' + DWRITE_FONT_FEATURE_TAG_SLASHED_ZERO = 0x6f72657a, // 'zero' +}; + +/// +/// The DWRITE_TEXT_RANGE structure specifies a range of text positions where format is applied. +/// +struct DWRITE_TEXT_RANGE +{ + /// + /// The start text position of the range. + /// + UINT32 startPosition; + + /// + /// The number of text positions in the range. + /// + UINT32 length; +}; + +/// +/// The DWRITE_FONT_FEATURE structure specifies properties used to identify and execute typographic feature in the font. +/// +struct DWRITE_FONT_FEATURE +{ + /// + /// The feature OpenType name identifier. + /// + DWRITE_FONT_FEATURE_TAG nameTag; + + /// + /// Execution parameter of the feature. + /// + /// + /// The parameter should be non-zero to enable the feature. Once enabled, a feature can't be disabled again within + /// the same range. Features requiring a selector use this value to indicate the selector index. + /// + UINT32 parameter; +}; + +/// +/// Defines a set of typographic features to be applied during shaping. +/// Notice the character range which this feature list spans is specified +/// as a separate parameter to GetGlyphs. +/// +struct DWRITE_TYPOGRAPHIC_FEATURES +{ + /// + /// Array of font features. + /// + __field_ecount(featureCount) DWRITE_FONT_FEATURE* features; + + /// + /// The number of features. + /// + UINT32 featureCount; +}; + +/// +/// The DWRITE_TRIMMING structure specifies the trimming option for text overflowing the layout box. +/// +struct DWRITE_TRIMMING +{ + /// + /// Text granularity of which trimming applies. + /// + DWRITE_TRIMMING_GRANULARITY granularity; + + /// + /// Character code used as the delimiter signaling the beginning of the portion of text to be preserved, + /// most useful for path ellipsis, where the delimeter would be a slash. + /// + UINT32 delimiter; + + /// + /// How many occurences of the delimiter to step back. + /// + UINT32 delimiterCount; +}; + + +interface IDWriteTypography; +interface IDWriteInlineObject; + +/// +/// The format of text used for text layout purpose. +/// +/// +/// This object may not be thread-safe and it may carry the state of text format change. +/// +interface DWRITE_DECLARE_INTERFACE("9c906818-31d7-4fd3-a151-7c5e225db55a") IDWriteTextFormat : public IUnknown +{ + /// + /// Set alignment option of text relative to layout box's leading and trailing edge. + /// + /// Text alignment option + /// + /// Standard HRESULT error code. + /// + STDMETHOD(SetTextAlignment)( + DWRITE_TEXT_ALIGNMENT textAlignment + ) PURE; + + /// + /// Set alignment option of paragraph relative to layout box's top and bottom edge. + /// + /// Paragraph alignment option + /// + /// Standard HRESULT error code. + /// + STDMETHOD(SetParagraphAlignment)( + DWRITE_PARAGRAPH_ALIGNMENT paragraphAlignment + ) PURE; + + /// + /// Set word wrapping option. + /// + /// Word wrapping option + /// + /// Standard HRESULT error code. + /// + STDMETHOD(SetWordWrapping)( + DWRITE_WORD_WRAPPING wordWrapping + ) PURE; + + /// + /// Set paragraph reading direction. + /// + /// Text reading direction + /// + /// Standard HRESULT error code. + /// + STDMETHOD(SetReadingDirection)( + DWRITE_READING_DIRECTION readingDirection + ) PURE; + + /// + /// Set paragraph flow direction. + /// + /// Paragraph flow direction + /// + /// Standard HRESULT error code. + /// + STDMETHOD(SetFlowDirection)( + DWRITE_FLOW_DIRECTION flowDirection + ) PURE; + + /// + /// Set incremental tab stop position. + /// + /// The incremental tab stop value + /// + /// Standard HRESULT error code. + /// + STDMETHOD(SetIncrementalTabStop)( + FLOAT incrementalTabStop + ) PURE; + + /// + /// Set trimming options for any trailing text exceeding the layout width + /// or for any far text exceeding the layout height. + /// + /// Text trimming options. + /// Application-defined omission sign. This parameter may be NULL if no trimming sign is desired. + /// + /// Any inline object can be used for the trimming sign, but CreateEllipsisTrimmingSign + /// provides a typical ellipsis symbol. Trimming is also useful vertically for hiding + /// partial lines. + /// + /// + /// Standard HRESULT error code. + /// + STDMETHOD(SetTrimming)( + __in DWRITE_TRIMMING const* trimmingOptions, + IDWriteInlineObject* trimmingSign + ) PURE; + + /// + /// Set line spacing. + /// + /// How to determine line height. + /// The line height, or rather distance between one baseline to another. + /// Distance from top of line to baseline. A reasonable ratio to lineSpacing is 80%. + /// + /// For the default method, spacing depends solely on the content. + /// For uniform spacing, the given line height will override the content. + /// + /// + /// Standard HRESULT error code. + /// + STDMETHOD(SetLineSpacing)( + DWRITE_LINE_SPACING_METHOD lineSpacingMethod, + FLOAT lineSpacing, + FLOAT baseline + ) PURE; + + /// + /// Get alignment option of text relative to layout box's leading and trailing edge. + /// + STDMETHOD_(DWRITE_TEXT_ALIGNMENT, GetTextAlignment)() PURE; + + /// + /// Get alignment option of paragraph relative to layout box's top and bottom edge. + /// + STDMETHOD_(DWRITE_PARAGRAPH_ALIGNMENT, GetParagraphAlignment)() PURE; + + /// + /// Get word wrapping option. + /// + STDMETHOD_(DWRITE_WORD_WRAPPING, GetWordWrapping)() PURE; + + /// + /// Get paragraph reading direction. + /// + STDMETHOD_(DWRITE_READING_DIRECTION, GetReadingDirection)() PURE; + + /// + /// Get paragraph flow direction. + /// + STDMETHOD_(DWRITE_FLOW_DIRECTION, GetFlowDirection)() PURE; + + /// + /// Get incremental tab stop position. + /// + STDMETHOD_(FLOAT, GetIncrementalTabStop)() PURE; + + /// + /// Get trimming options for text overflowing the layout width. + /// + /// Text trimming options. + /// Trimming omission sign. This parameter may be NULL. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetTrimming)( + __out DWRITE_TRIMMING* trimmingOptions, + __out IDWriteInlineObject** trimmingSign + ) PURE; + + /// + /// Get line spacing. + /// + /// How line height is determined. + /// The line height, or rather distance between one baseline to another. + /// Distance from top of line to baseline. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetLineSpacing)( + __out DWRITE_LINE_SPACING_METHOD* lineSpacingMethod, + __out FLOAT* lineSpacing, + __out FLOAT* baseline + ) PURE; + + /// + /// Get the font collection. + /// + /// The current font collection. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetFontCollection)( + __out IDWriteFontCollection** fontCollection + ) PURE; + + /// + /// Get the length of the font family name, in characters, not including the terminating NULL character. + /// + STDMETHOD_(UINT32, GetFontFamilyNameLength)() PURE; + + /// + /// Get a copy of the font family name. + /// + /// Character array that receives the current font family name + /// Size of the character array in character count including the terminated NULL character. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetFontFamilyName)( + __out_ecount_z(nameSize) WCHAR* fontFamilyName, + UINT32 nameSize + ) PURE; + + /// + /// Get the font weight. + /// + STDMETHOD_(DWRITE_FONT_WEIGHT, GetFontWeight)() PURE; + + /// + /// Get the font style. + /// + STDMETHOD_(DWRITE_FONT_STYLE, GetFontStyle)() PURE; + + /// + /// Get the font stretch. + /// + STDMETHOD_(DWRITE_FONT_STRETCH, GetFontStretch)() PURE; + + /// + /// Get the font em height. + /// + STDMETHOD_(FLOAT, GetFontSize)() PURE; + + /// + /// Get the length of the locale name, in characters, not including the terminating NULL character. + /// + STDMETHOD_(UINT32, GetLocaleNameLength)() PURE; + + /// + /// Get a copy of the locale name. + /// + /// Character array that receives the current locale name + /// Size of the character array in character count including the terminated NULL character. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetLocaleName)( + __out_ecount_z(nameSize) WCHAR* localeName, + UINT32 nameSize + ) PURE; +}; + + +/// +/// Font typography setting. +/// +interface DWRITE_DECLARE_INTERFACE("55f1112b-1dc2-4b3c-9541-f46894ed85b6") IDWriteTypography : public IUnknown +{ + /// + /// Add font feature. + /// + /// The font feature to add. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(AddFontFeature)( + DWRITE_FONT_FEATURE fontFeature + ) PURE; + + /// + /// Get the number of font features. + /// + STDMETHOD_(UINT32, GetFontFeatureCount)() PURE; + + /// + /// Get the font feature at the specified index. + /// + /// The zero-based index of the font feature to get. + /// The font feature. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetFontFeature)( + UINT32 fontFeatureIndex, + __out DWRITE_FONT_FEATURE* fontFeature + ) PURE; +}; + +enum DWRITE_SCRIPT_SHAPES +{ + /// + /// No additional shaping requirement. Text is shaped with the writing system default behavior. + /// + DWRITE_SCRIPT_SHAPES_DEFAULT = 0, + + /// + /// Text should leave no visual on display i.e. control or format control characters. + /// + DWRITE_SCRIPT_SHAPES_NO_VISUAL = 1 +}; + +#ifdef DEFINE_ENUM_FLAG_OPERATORS +DEFINE_ENUM_FLAG_OPERATORS(DWRITE_SCRIPT_SHAPES); +#endif + +/// +/// Association of text and its writing system script as well as some display attributes. +/// +struct DWRITE_SCRIPT_ANALYSIS +{ + /// + /// Zero-based index representation of writing system script. + /// + UINT16 script; + + /// + /// Additional shaping requirement of text. + /// + DWRITE_SCRIPT_SHAPES shapes; +}; + +/// +/// Condition at the edges of inline object or text used to determine +/// line-breaking behavior. +/// +enum DWRITE_BREAK_CONDITION +{ + /// + /// Whether a break is allowed is determined by the condition of the + /// neighboring text span or inline object. + /// + DWRITE_BREAK_CONDITION_NEUTRAL, + + /// + /// A break is allowed, unless overruled by the condition of the + /// neighboring text span or inline object, either prohibited by a + /// May Not or forced by a Must. + /// + DWRITE_BREAK_CONDITION_CAN_BREAK, + + /// + /// There should be no break, unless overruled by a Must condition from + /// the neighboring text span or inline object. + /// + DWRITE_BREAK_CONDITION_MAY_NOT_BREAK, + + /// + /// The break must happen, regardless of the condition of the adjacent + /// text span or inline object. + /// + DWRITE_BREAK_CONDITION_MUST_BREAK +}; + +/// +/// Line breakpoint characteristics of a character. +/// +struct DWRITE_LINE_BREAKPOINT +{ + /// + /// Breaking condition before the character. + /// + UINT8 breakConditionBefore : 2; + + /// + /// Breaking condition after the character. + /// + UINT8 breakConditionAfter : 2; + + /// + /// The character is some form of whitespace, which may be meaningful + /// for justification. + /// + UINT8 isWhitespace : 1; + + /// + /// The character is a soft hyphen, often used to indicate hyphenation + /// points inside words. + /// + UINT8 isSoftHyphen : 1; + + UINT8 padding : 2; +}; + +/// +/// How to apply number substitution on digits and related punctuation. +/// +enum DWRITE_NUMBER_SUBSTITUTION_METHOD +{ + /// + /// Specifies that the substitution method should be determined based + /// on LOCALE_IDIGITSUBSTITUTION value of the specified text culture. + /// + DWRITE_NUMBER_SUBSTITUTION_METHOD_FROM_CULTURE, + + /// + /// If the culture is Arabic or Farsi, specifies that the number shape + /// depend on the context. Either traditional or nominal number shape + /// are used depending on the nearest preceding strong character or (if + /// there is none) the reading direction of the paragraph. + /// + DWRITE_NUMBER_SUBSTITUTION_METHOD_CONTEXTUAL, + + /// + /// Specifies that code points 0x30-0x39 are always rendered as nominal numeral + /// shapes (ones of the European number), i.e., no substitution is performed. + /// + DWRITE_NUMBER_SUBSTITUTION_METHOD_NONE, + + /// + /// Specifies that number are rendered using the national number shape + /// as specified by the LOCALE_SNATIVEDIGITS value of the specified text culture. + /// + DWRITE_NUMBER_SUBSTITUTION_METHOD_NATIONAL, + + /// + /// Specifies that number are rendered using the traditional shape + /// for the specified culture. For most cultures, this is the same as + /// NativeNational. However, NativeNational results in Latin number + /// for some Arabic cultures, whereas this value results in Arabic + /// number for all Arabic cultures. + /// + DWRITE_NUMBER_SUBSTITUTION_METHOD_TRADITIONAL +}; + +/// +/// Holds the appropriate digits and numeric punctuation for a given locale. +/// +interface DECLSPEC_UUID("14885CC9-BAB0-4f90-B6ED-5C366A2CD03D") DECLSPEC_NOVTABLE IDWriteNumberSubstitution : public IUnknown +{ +}; + +/// +/// Shaping output properties per input character. +/// +struct DWRITE_SHAPING_TEXT_PROPERTIES +{ + /// + /// This character can be shaped independently from the others + /// (usually set for the space character). + /// + UINT16 isShapedAlone : 1; + + /// + /// Reserved for use by shaping engine. + /// + UINT16 reserved : 15; +}; + +/// +/// Shaping output properties per output glyph. +/// +struct DWRITE_SHAPING_GLYPH_PROPERTIES +{ + /// + /// Justification class, whether to use spacing, kashidas, or + /// another method. This exists for backwards compatibility + /// with Uniscribe's SCRIPT_JUSTIFY enum. + /// + UINT16 justification : 4; + + /// + /// Indicates glyph is the first of a cluster. + /// + UINT16 isClusterStart : 1; + + /// + /// Glyph is a diacritic. + /// + UINT16 isDiacritic : 1; + + /// + /// Glyph has no width, blank, ZWJ, ZWNJ etc. + /// + UINT16 isZeroWidthSpace : 1; + + /// + /// Reserved for use by shaping engine. + /// + UINT16 reserved : 9; +}; + +/// +/// The interface implemented by the text analyzer's client to provide text to +/// the analyzer. It allows the separation between the logical view of text as +/// a continuous stream of characters identifiable by unique text positions, +/// and the actual memory layout of potentially discrete blocks of text in the +/// client's backing store. +/// +/// If any of these callbacks returns an error, the analysis functions will +/// stop prematurely and return a callback error. Rather than return E_NOTIMPL, +/// an application should stub the method and return a constant/null and S_OK. +/// +interface DECLSPEC_UUID("688e1a58-5094-47c8-adc8-fbcea60ae92b") DECLSPEC_NOVTABLE IDWriteTextAnalysisSource : public IUnknown +{ + /// + /// Get a block of text starting at the specified text position. + /// Returning NULL indicates the end of text - the position is after + /// the last character. This function is called iteratively for + /// each consecutive block, tying together several fragmented blocks + /// in the backing store into a virtual contiguous string. + /// + /// First position of the piece to obtain. All + /// positions are in UTF16 code-units, not whole characters, which + /// matters when supplementary characters are used. + /// Address that receives a pointer to the text block + /// at the specified position. + /// Number of UTF16 units of the retrieved chunk. + /// The returned length is not the length of the block, but the length + /// remaining in the block, from the given position until its end. + /// So querying for a position that is 75 positions into a 100 + /// postition block would return 25. + /// Pointer to the first character at the given text position. + /// NULL indicates no chunk available at the specified position, either + /// because textPosition >= the entire text content length or because the + /// queried position is not mapped into the app's backing store. + /// + /// Although apps can implement sparse textual content that only maps part of + /// the backing store, the app must map any text that is in the range passed + /// to any analysis functions. + /// + STDMETHOD(GetTextAtPosition)( + UINT32 textPosition, + __out WCHAR const** textString, + __out UINT32* textLength + ) PURE; + + /// + /// Get a block of text immediately preceding the specified position. + /// + /// Position immediately after the last position of the chunk to obtain. + /// Address that receives a pointer to the text block + /// at the specified position. + /// Number of UTF16 units of the retrieved block. + /// The length returned is from the given position to the front of + /// the block. + /// Pointer to the first character at (textPosition - textLength). + /// NULL indicates no chunk available at the specified position, either + /// because textPosition == 0,the textPosition > the entire text content + /// length, or the queried position is not mapped into the app's backing + /// store. + /// + /// Although apps can implement sparse textual content that only maps part of + /// the backing store, the app must map any text that is in the range passed + /// to any analysis functions. + /// + STDMETHOD(GetTextBeforePosition)( + UINT32 textPosition, + __out WCHAR const** textString, + __out UINT32* textLength + ) PURE; + + /// + /// Get paragraph reading direction. + /// + STDMETHOD_(DWRITE_READING_DIRECTION, GetParagraphReadingDirection)() PURE; + + /// + /// Get locale name on the range affected by it. + /// + /// Position to get the locale name of. + /// Receives the length from the given position up to the + /// next differing locale. + /// Address that receives a pointer to the locale + /// at the specified position. + /// + /// The localeName pointer must remain valid until the next call or until + /// the analysis returns. + /// + STDMETHOD(GetLocaleName)( + UINT32 textPosition, + __out UINT32* textLength, + __out_z WCHAR const** localeName + ) PURE; + + /// + /// Get number substitution on the range affected by it. + /// + /// Position to get the number substitution of. + /// Receives the length from the given position up to the + /// next differing number substitution. + /// Address that receives a pointer to the number substitution + /// at the specified position. + /// + /// Any implementation should return the number substitution with an + /// incremented ref count, and the analysis will release when finished + /// with it (either before the next call or before it returns). However, + /// the sink callback may hold onto it after that. + /// + STDMETHOD(GetNumberSubstitution)( + UINT32 textPosition, + __out UINT32* textLength, + __out IDWriteNumberSubstitution** numberSubstitution + ) PURE; +}; + +/// +/// The interface implemented by the text analyzer's client to receive the +/// output of a given text analysis. The Text analyzer disregards any current +/// state of the analysis sink, therefore a Set method call on a range +/// overwrites the previously set analysis result of the same range. +/// +interface DECLSPEC_UUID("5810cd44-0ca0-4701-b3fa-bec5182ae4f6") DECLSPEC_NOVTABLE IDWriteTextAnalysisSink : public IUnknown +{ + /// + /// Report script analysis for the text range. + /// + /// Starting position to report from. + /// Number of UTF16 units of the reported range. + /// Script analysis of characters in range. + /// + /// A successful code or error code to abort analysis. + /// + STDMETHOD(SetScriptAnalysis)( + UINT32 textPosition, + UINT32 textLength, + __in DWRITE_SCRIPT_ANALYSIS const* scriptAnalysis + ) PURE; + + /// + /// Repport line-break opportunities for each character, starting from + /// the specified position. + /// + /// Starting position to report from. + /// Number of UTF16 units of the reported range. + /// Breaking conditions for each character. + /// + /// A successful code or error code to abort analysis. + /// + STDMETHOD(SetLineBreakpoints)( + UINT32 textPosition, + UINT32 textLength, + __in_ecount(textLength) DWRITE_LINE_BREAKPOINT const* lineBreakpoints + ) PURE; + + /// + /// Set bidirectional level on the range, called once per each + /// level run change (either explicit or resolved implicit). + /// + /// Starting position to report from. + /// Number of UTF16 units of the reported range. + /// Explicit level from embedded control codes + /// RLE/RLO/LRE/LRO/PDF, determined before any additional rules. + /// Final implicit level considering the + /// explicit level and characters' natural directionality, after all + /// Bidi rules have been applied. + /// + /// A successful code or error code to abort analysis. + /// + STDMETHOD(SetBidiLevel)( + UINT32 textPosition, + UINT32 textLength, + UINT8 explicitLevel, + UINT8 resolvedLevel + ) PURE; + + /// + /// Set number substitution on the range. + /// + /// Starting position to report from. + /// Number of UTF16 units of the reported range. + /// The number substitution applicable to + /// the returned range of text. The sink callback may hold onto it by + /// incrementing its ref count. + /// + /// A successful code or error code to abort analysis. + /// + /// + /// Unlike script and bidi analysis, where every character passed to the + /// analyzer has a result, this will only be called for those ranges where + /// substitution is applicable. For any other range, you will simply not + /// be called. + /// + STDMETHOD(SetNumberSubstitution)( + UINT32 textPosition, + UINT32 textLength, + __notnull IDWriteNumberSubstitution* numberSubstitution + ) PURE; +}; + +/// +/// Analyzes various text properties for complex script processing. +/// +interface DWRITE_DECLARE_INTERFACE("b7e6163e-7f46-43b4-84b3-e4e6249c365d") IDWriteTextAnalyzer : public IUnknown +{ + /// + /// Analyzes a text range for script boundaries, reading text attributes + /// from the source and reporting the Unicode script ID to the sink + /// callback SetScript. + /// + /// Source object to analyze. + /// Starting position within the source object. + /// Length to analyze. + /// Callback object. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(AnalyzeScript)( + IDWriteTextAnalysisSource* analysisSource, + UINT32 textPosition, + UINT32 textLength, + IDWriteTextAnalysisSink* analysisSink + ) PURE; + + /// + /// Analyzes a text range for script directionality, reading attributes + /// from the source and reporting levels to the sink callback SetBidiLevel. + /// + /// Source object to analyze. + /// Starting position within the source object. + /// Length to analyze. + /// Callback object. + /// + /// Standard HRESULT error code. + /// + /// + /// While the function can handle multiple paragraphs, the text range + /// should not arbitrarily split the middle of paragraphs. Otherwise the + /// returned levels may be wrong, since the Bidi algorithm is meant to + /// apply to the paragraph as a whole. + /// + /// + /// Embedded control codes (LRE/LRO/RLE/RLO/PDF) are taken into account. + /// + STDMETHOD(AnalyzeBidi)( + IDWriteTextAnalysisSource* analysisSource, + UINT32 textPosition, + UINT32 textLength, + IDWriteTextAnalysisSink* analysisSink + ) PURE; + + /// + /// Analyzes a text range for spans where number substitution is applicable, + /// reading attributes from the source and reporting substitutable ranges + /// to the sink callback SetNumberSubstitution. + /// + /// Source object to analyze. + /// Starting position within the source object. + /// Length to analyze. + /// Callback object. + /// + /// Standard HRESULT error code. + /// + /// + /// While the function can handle multiple ranges of differing number + /// substitutions, the text ranges should not arbitrarily split the + /// middle of numbers. Otherwise it will treat the numbers separately + /// and will not translate any intervening punctuation. + /// + /// + /// Embedded control codes (LRE/LRO/RLE/RLO/PDF) are taken into account. + /// + STDMETHOD(AnalyzeNumberSubstitution)( + IDWriteTextAnalysisSource* analysisSource, + UINT32 textPosition, + UINT32 textLength, + IDWriteTextAnalysisSink* analysisSink + ) PURE; + + /// + /// Analyzes a text range for potential breakpoint opportunities, reading + /// attributes from the source and reporting breakpoint opportunities to + /// the sink callback SetLineBreakpoints. + /// + /// Source object to analyze. + /// Starting position within the source object. + /// Length to analyze. + /// Callback object. + /// + /// Standard HRESULT error code. + /// + /// + /// While the function can handle multiple paragraphs, the text range + /// should not arbitrarily split the middle of paragraphs, unless the + /// given text span is considered a whole unit. Otherwise the + /// returned properties for the first and last characters will + /// inappropriately allow breaks. + /// + /// + /// Special cases include the first, last, and surrogate characters. Any + /// text span is treated as if adjacent to inline objects on either side. + /// So the rules with contingent-break opportunities are used, where the + /// edge between text and inline objects is always treated as a potential + /// break opportunity, dependent on any overriding rules of the adjacent + /// objects to prohibit or force the break (see Unicode TR #14). + /// Surrogate pairs never break between. + /// + STDMETHOD(AnalyzeLineBreakpoints)( + IDWriteTextAnalysisSource* analysisSource, + UINT32 textPosition, + UINT32 textLength, + IDWriteTextAnalysisSink* analysisSink + ) PURE; + + /// + /// Parses the input text string and maps it to the set of glyphs and associated glyph data + /// according to the font and the writing system's rendering rules. + /// + /// The string to convert to glyphs. + /// The length of textString. + /// The font face to get glyphs from. + /// Set to true if the text is intended to be + /// drawn vertically. + /// Set to TRUE for right-to-left text. + /// Script analysis result from AnalyzeScript. + /// The locale to use when selecting glyphs. + /// e.g. the same character may map to different glyphs for ja-jp vs zh-chs. + /// If this is NULL then the default mapping based on the script is used. + /// Optional number substitution which + /// selects the appropriate glyphs for digits and related numeric characters, + /// depending on the results obtained from AnalyzeNumberSubstitution. Passing + /// null indicates that no substitution is needed and that the digits should + /// receive nominal glyphs. + /// An array of pointers to the sets of typographic + /// features to use in each feature range. + /// The length of each feature range, in characters. + /// The sum of all lengths should be equal to textLength. + /// The number of feature ranges. + /// The maximum number of glyphs that can be + /// returned. + /// The mapping from character ranges to glyph + /// ranges. + /// Per-character output properties. + /// Output glyph indices. + /// Per-glyph output properties. + /// The actual number of glyphs returned if + /// the call succeeds. + /// + /// Standard HRESULT error code. + /// + /// + /// Note that the mapping from characters to glyphs is, in general, many- + /// to-many. The recommended estimate for the per-glyph output buffers is + /// (3 * textLength / 2 + 16). This is not guaranteed to be sufficient. + /// + /// The value of the actualGlyphCount parameter is only valid if the call + /// succeeds. In the event that maxGlyphCount is not big enough + /// E_NOT_SUFFICIENT_BUFFER, which is equivalent to HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), + /// will be returned. The application should allocate a larger buffer and try again. + /// + STDMETHOD(GetGlyphs)( + __in_ecount(textLength) WCHAR const* textString, + UINT32 textLength, + IDWriteFontFace* fontFace, + BOOL isSideways, + BOOL isRightToLeft, + __in DWRITE_SCRIPT_ANALYSIS const* scriptAnalysis, + __in_z_opt WCHAR const* localeName, + __maybenull IDWriteNumberSubstitution* numberSubstitution, + __in_ecount_opt(featureRanges) DWRITE_TYPOGRAPHIC_FEATURES const** features, + __in_ecount_opt(featureRanges) UINT32 const* featureRangeLengths, + UINT32 featureRanges, + UINT32 maxGlyphCount, + __out_ecount(textLength) UINT16* clusterMap, + __out_ecount(textLength) DWRITE_SHAPING_TEXT_PROPERTIES* textProps, + __out_ecount(maxGlyphCount) UINT16* glyphIndices, + __out_ecount(maxGlyphCount) DWRITE_SHAPING_GLYPH_PROPERTIES* glyphProps, + __out UINT32* actualGlyphCount + ) PURE; + + /// + /// Place glyphs output from the GetGlyphs method according to the font + /// and the writing system's rendering rules. + /// + /// The original string the glyphs came from. + /// The mapping from character ranges to glyph + /// ranges. Returned by GetGlyphs. + /// Per-character properties. Returned by + /// GetGlyphs. + /// The length of textString. + /// Glyph indices. See GetGlyphs + /// Per-glyph properties. See GetGlyphs + /// The number of glyphs. + /// The font face the glyphs came from. + /// Logical font size in DIP's. + /// Set to true if the text is intended to be + /// drawn vertically. + /// Set to TRUE for right-to-left text. + /// Script analysis result from AnalyzeScript. + /// The locale to use when selecting glyphs. + /// e.g. the same character may map to different glyphs for ja-jp vs zh-chs. + /// If this is NULL then the default mapping based on the script is used. + /// An array of pointers to the sets of typographic + /// features to use in each feature range. + /// The length of each feature range, in characters. + /// The sum of all lengths should be equal to textLength. + /// The number of feature ranges. + /// The advance width of each glyph. + /// The offset of the origin of each glyph. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetGlyphPlacements)( + __in_ecount(textLength) WCHAR const* textString, + __in_ecount(textLength) UINT16 const* clusterMap, + __in_ecount(textLength) DWRITE_SHAPING_TEXT_PROPERTIES* textProps, + UINT32 textLength, + __in_ecount(glyphCount) UINT16 const* glyphIndices, + __in_ecount(glyphCount) DWRITE_SHAPING_GLYPH_PROPERTIES const* glyphProps, + UINT32 glyphCount, + IDWriteFontFace * fontFace, + FLOAT fontEmSize, + BOOL isSideways, + BOOL isRightToLeft, + __in DWRITE_SCRIPT_ANALYSIS const* scriptAnalysis, + __in_z_opt WCHAR const* localeName, + __in_ecount_opt(featureRanges) DWRITE_TYPOGRAPHIC_FEATURES const** features, + __in_ecount_opt(featureRanges) UINT32 const* featureRangeLengths, + UINT32 featureRanges, + __out_ecount(glyphCount) FLOAT* glyphAdvances, + __out_ecount(glyphCount) DWRITE_GLYPH_OFFSET* glyphOffsets + ) PURE; + + /// + /// Place glyphs output from the GetGlyphs method according to the font + /// and the writing system's rendering rules. + /// + /// The original string the glyphs came from. + /// The mapping from character ranges to glyph + /// ranges. Returned by GetGlyphs. + /// Per-character properties. Returned by + /// GetGlyphs. + /// The length of textString. + /// Glyph indices. See GetGlyphs + /// Per-glyph properties. See GetGlyphs + /// The number of glyphs. + /// The font face the glyphs came from. + /// Logical font size in DIP's. + /// Number of physical pixels per DIP. For example, if the DPI of the rendering surface is 96 this + /// value is 1.0f. If the DPI is 120, this value is 120.0f/96. + /// Optional transform applied to the glyphs and their positions. This transform is applied after the + /// scaling specified by the font size and pixelsPerDip. + /// + /// When set to FALSE, the metrics are the same as the metrics of GDI aliased text. + /// When set to TRUE, the metrics are the same as the metrics of text measured by GDI using a font + /// created with CLEARTYPE_NATURAL_QUALITY. + /// + /// Set to true if the text is intended to be + /// drawn vertically. + /// Set to TRUE for right-to-left text. + /// Script analysis result from AnalyzeScript. + /// The locale to use when selecting glyphs. + /// e.g. the same character may map to different glyphs for ja-jp vs zh-chs. + /// If this is NULL then the default mapping based on the script is used. + /// An array of pointers to the sets of typographic + /// features to use in each feature range. + /// The length of each feature range, in characters. + /// The sum of all lengths should be equal to textLength. + /// The number of feature ranges. + /// The advance width of each glyph. + /// The offset of the origin of each glyph. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetGdiCompatibleGlyphPlacements)( + __in_ecount(textLength) WCHAR const* textString, + __in_ecount(textLength) UINT16 const* clusterMap, + __in_ecount(textLength) DWRITE_SHAPING_TEXT_PROPERTIES* textProps, + UINT32 textLength, + __in_ecount(glyphCount) UINT16 const* glyphIndices, + __in_ecount(glyphCount) DWRITE_SHAPING_GLYPH_PROPERTIES const* glyphProps, + UINT32 glyphCount, + IDWriteFontFace * fontFace, + FLOAT fontEmSize, + FLOAT pixelsPerDip, + __in_opt DWRITE_MATRIX const* transform, + BOOL useGdiNatural, + BOOL isSideways, + BOOL isRightToLeft, + __in DWRITE_SCRIPT_ANALYSIS const* scriptAnalysis, + __in_z_opt WCHAR const* localeName, + __in_ecount_opt(featureRanges) DWRITE_TYPOGRAPHIC_FEATURES const** features, + __in_ecount_opt(featureRanges) UINT32 const* featureRangeLengths, + UINT32 featureRanges, + __out_ecount(glyphCount) FLOAT* glyphAdvances, + __out_ecount(glyphCount) DWRITE_GLYPH_OFFSET* glyphOffsets + ) PURE; +}; + +/// +/// The DWRITE_GLYPH_RUN structure contains the information needed by renderers +/// to draw glyph runs. All coordinates are in device independent pixels (DIPs). +/// +struct DWRITE_GLYPH_RUN +{ + /// + /// The physical font face to draw with. + /// + __notnull IDWriteFontFace* fontFace; + + /// + /// Logical size of the font in DIPs, not points (equals 1/96 inch). + /// + FLOAT fontEmSize; + + /// + /// The number of glyphs. + /// + UINT32 glyphCount; + + /// + /// The indices to render. + /// + __field_ecount(glyphCount) UINT16 const* glyphIndices; + + /// + /// Glyph advance widths. + /// + __field_ecount_opt(glyphCount) FLOAT const* glyphAdvances; + + /// + /// Glyph offsets. + /// + __field_ecount_opt(glyphCount) DWRITE_GLYPH_OFFSET const* glyphOffsets; + + /// + /// If true, specifies that glyphs are rotated 90 degrees to the left and + /// vertical metrics are used. Vertical writing is achieved by specifying + /// isSideways = true and rotating the entire run 90 degrees to the right + /// via a rotate transform. + /// + BOOL isSideways; + + /// + /// The implicit resolved bidi level of the run. Odd levels indicate + /// right-to-left languages like Hebrew and Arabic, while even levels + /// indicate left-to-right languages like English and Japanese (when + /// written horizontally). For right-to-left languages, the text origin + /// is on the right, and text should be drawn to the left. + /// + UINT32 bidiLevel; +}; + +/// +/// The DWRITE_GLYPH_RUN_DESCRIPTION structure contains additional properties +/// related to those in DWRITE_GLYPH_RUN. +/// +struct DWRITE_GLYPH_RUN_DESCRIPTION +{ + /// + /// The locale name associated with this run. + /// + __nullterminated WCHAR const* localeName; + + /// + /// The text associated with the glyphs. + /// + __field_ecount(stringLength) WCHAR const* string; + + /// + /// The number of characters (UTF16 code-units). + /// Note that this may be different than the number of glyphs. + /// + UINT32 stringLength; + + /// + /// An array of indices to the glyph indices array, of the first glyphs of + /// all the glyph clusters of the glyphs to render. + /// + __field_ecount(stringLength) UINT16 const* clusterMap; + + /// + /// Corresponding text position in the original string + /// this glyph run came from. + /// + UINT32 textPosition; +}; + +/// +/// The DWRITE_UNDERLINE structure contains about the size and placement of +/// underlines. All coordinates are in device independent pixels (DIPs). +/// +struct DWRITE_UNDERLINE +{ + /// + /// Width of the underline, measured parallel to the baseline. + /// + FLOAT width; + + /// + /// Thickness of the underline, measured perpendicular to the + /// baseline. + /// + FLOAT thickness; + + /// + /// Offset of the underline from the baseline. + /// A positive offset represents a position below the baseline and + /// a negative offset is above. + /// + FLOAT offset; + + /// + /// Height of the tallest run where the underline applies. + /// + FLOAT runHeight; + + /// + /// Reading direction of the text associated with the underline. This + /// value is used to interpret whether the width value runs horizontally + /// or vertically. + /// + DWRITE_READING_DIRECTION readingDirection; + + /// + /// Flow direction of the text associated with the underline. This value + /// is used to interpret whether the thickness value advances top to + /// bottom, left to right, or right to left. + /// + DWRITE_FLOW_DIRECTION flowDirection; + + /// + /// Locale of the text the underline is being drawn under. Can be + /// pertinent where the locale affects how the underline is drawn. + /// For example, in vertical text, the underline belongs on the + /// left for Chinese but on the right for Japanese. + /// This choice is completely left up to higher levels. + /// + __nullterminated WCHAR const* localeName; + + /// + /// The measuring mode can be useful to the renderer to determine how + /// underlines are rendered, e.g. rounding the thickness to a whole pixel + /// in GDI-compatible modes. + /// + DWRITE_MEASURING_MODE measuringMode; +}; + +/// +/// The DWRITE_STRIKETHROUGH structure contains about the size and placement of +/// strickthroughs. All coordinates are in device independent pixels (DIPs). +/// +struct DWRITE_STRIKETHROUGH +{ + /// + /// Width of the strikethrough, measured parallel to the baseline. + /// + FLOAT width; + + /// + /// Thickness of the strikethrough, measured perpendicular to the + /// baseline. + /// + FLOAT thickness; + + /// + /// Offset of the stikethrough from the baseline. + /// A positive offset represents a position below the baseline and + /// a negative offset is above. + /// + FLOAT offset; + + /// + /// Reading direction of the text associated with the strikethrough. This + /// value is used to interpret whether the width value runs horizontally + /// or vertically. + /// + DWRITE_READING_DIRECTION readingDirection; + + /// + /// Flow direction of the text associated with the strikethrough. This + /// value is used to interpret whether the thickness value advances top to + /// bottom, left to right, or right to left. + /// + DWRITE_FLOW_DIRECTION flowDirection; + + /// + /// Locale of the range. Can be pertinent where the locale affects the style. + /// + __nullterminated WCHAR const* localeName; + + /// + /// The measuring mode can be useful to the renderer to determine how + /// underlines are rendered, e.g. rounding the thickness to a whole pixel + /// in GDI-compatible modes. + /// + DWRITE_MEASURING_MODE measuringMode; +}; + +/// +/// The DWRITE_LINE_METRICS structure contains information about a formatted +/// line of text. +/// +struct DWRITE_LINE_METRICS +{ + /// + /// The number of total text positions in the line. + /// This includes any trailing whitespace and newline characters. + /// + UINT32 length; + + /// + /// The number of whitespace positions at the end of the line. Newline + /// sequences are considered whitespace. + /// + UINT32 trailingWhitespaceLength; + + /// + /// The number of characters in the newline sequence at the end of the line. + /// If the count is zero, then the line was either wrapped or it is the + /// end of the text. + /// + UINT32 newlineLength; + + /// + /// Height of the line as measured from top to bottom. + /// + FLOAT height; + + /// + /// Distance from the top of the line to its baseline. + /// + FLOAT baseline; + + /// + /// The line is trimmed. + /// + BOOL isTrimmed; +}; + + +/// +/// The DWRITE_CLUSTER_METRICS structure contains information about a glyph cluster. +/// +struct DWRITE_CLUSTER_METRICS +{ + /// + /// The total advance width of all glyphs in the cluster. + /// + FLOAT width; + + /// + /// The number of text positions in the cluster. + /// + UINT16 length; + + /// + /// Indicate whether line can be broken right after the cluster. + /// + UINT16 canWrapLineAfter : 1; + + /// + /// Indicate whether the cluster corresponds to whitespace character. + /// + UINT16 isWhitespace : 1; + + /// + /// Indicate whether the cluster corresponds to a newline character. + /// + UINT16 isNewline : 1; + + /// + /// Indicate whether the cluster corresponds to soft hyphen character. + /// + UINT16 isSoftHyphen : 1; + + /// + /// Indicate whether the cluster is read from right to left. + /// + UINT16 isRightToLeft : 1; + + UINT16 padding : 11; +}; + + +/// +/// Overall metrics associated with text after layout. +/// All coordinates are in device independent pixels (DIPs). +/// +struct DWRITE_TEXT_METRICS +{ + /// + /// Left-most point of formatted text relative to layout box + /// (excluding any glyph overhang). + /// + FLOAT left; + + /// + /// Top-most point of formatted text relative to layout box + /// (excluding any glyph overhang). + /// + FLOAT top; + + /// + /// The width of the formatted text ignoring trailing whitespace + /// at the end of each line. + /// + FLOAT width; + + /// + /// The width of the formatted text taking into account the + /// trailing whitespace at the end of each line. + /// + FLOAT widthIncludingTrailingWhitespace; + + /// + /// The height of the formatted text. The height of an empty string + /// is determined by the size of the default font's line height. + /// + FLOAT height; + + /// + /// Initial width given to the layout. Depending on whether the text + /// was wrapped or not, it can be either larger or smaller than the + /// text content width. + /// + FLOAT layoutWidth; + + /// + /// Initial height given to the layout. Depending on the length of the + /// text, it may be larger or smaller than the text content height. + /// + FLOAT layoutHeight; + + /// + /// The maximum reordering count of any line of text, used + /// to calculate the most number of hit-testing boxes needed. + /// If the layout has no bidirectional text or no text at all, + /// the minimum level is 1. + /// + UINT32 maxBidiReorderingDepth; + + /// + /// Total number of lines. + /// + UINT32 lineCount; +}; + + +/// +/// Properties describing the geometric measurement of an +/// application-defined inline object. +/// +struct DWRITE_INLINE_OBJECT_METRICS +{ + /// + /// Width of the inline object. + /// + FLOAT width; + + /// + /// Height of the inline object as measured from top to bottom. + /// + FLOAT height; + + /// + /// Distance from the top of the object to the baseline where it is lined up with the adjacent text. + /// If the baseline is at the bottom, baseline simply equals height. + /// + FLOAT baseline; + + /// + /// Flag indicating whether the object is to be placed upright or alongside the text baseline + /// for vertical text. + /// + BOOL supportsSideways; +}; + + +/// +/// The DWRITE_OVERHANG_METRICS structure holds how much any visible pixels +/// (in DIPs) overshoot each side of the layout or inline objects. +/// +/// +/// Positive overhangs indicate that the visible area extends outside the layout +/// box or inline object, while negative values mean there is whitespace inside. +/// The returned values are unaffected by rendering transforms or pixel snapping. +/// Additionally, they may not exactly match final target's pixel bounds after +/// applying grid fitting and hinting. +/// +struct DWRITE_OVERHANG_METRICS +{ + /// + /// The distance from the left-most visible DIP to its left alignment edge. + /// + FLOAT left; + + /// + /// The distance from the top-most visible DIP to its top alignment edge. + /// + FLOAT top; + + /// + /// The distance from the right-most visible DIP to its right alignment edge. + /// + FLOAT right; + + /// + /// The distance from the bottom-most visible DIP to its bottom alignment edge. + /// + FLOAT bottom; +}; + + +/// +/// Geometry enclosing of text positions. +/// +struct DWRITE_HIT_TEST_METRICS +{ + /// + /// First text position within the geometry. + /// + UINT32 textPosition; + + /// + /// Number of text positions within the geometry. + /// + UINT32 length; + + /// + /// Left position of the top-left coordinate of the geometry. + /// + FLOAT left; + + /// + /// Top position of the top-left coordinate of the geometry. + /// + FLOAT top; + + /// + /// Geometry's width. + /// + FLOAT width; + + /// + /// Geometry's height. + /// + FLOAT height; + + /// + /// Bidi level of text positions enclosed within the geometry. + /// + UINT32 bidiLevel; + + /// + /// Geometry encloses text? + /// + BOOL isText; + + /// + /// Range is trimmed. + /// + BOOL isTrimmed; +}; + + +interface IDWriteTextRenderer; + + +/// +/// The IDWriteInlineObject interface wraps an application defined inline graphic, +/// allowing DWrite to query metrics as if it was a glyph inline with the text. +/// +interface DWRITE_DECLARE_INTERFACE("8339FDE3-106F-47ab-8373-1C6295EB10B3") IDWriteInlineObject : public IUnknown +{ + /// + /// The application implemented rendering callback (IDWriteTextRenderer::DrawInlineObject) + /// can use this to draw the inline object without needing to cast or query the object + /// type. The text layout does not call this method directly. + /// + /// The context passed to IDWriteTextLayout::Draw. + /// The renderer passed to IDWriteTextLayout::Draw as the object's containing parent. + /// X-coordinate at the top-left corner of the inline object. + /// Y-coordinate at the top-left corner of the inline object. + /// The object should be drawn on its side. + /// The object is in an right-to-left context and should be drawn flipped. + /// The drawing effect set in IDWriteTextLayout::SetDrawingEffect. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(Draw)( + __maybenull void* clientDrawingContext, + IDWriteTextRenderer* renderer, + FLOAT originX, + FLOAT originY, + BOOL isSideways, + BOOL isRightToLeft, + __maybenull IUnknown* clientDrawingEffect + ) PURE; + + /// + /// TextLayout calls this callback function to get the measurement of the inline object. + /// + /// Returned metrics + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetMetrics)( + __out DWRITE_INLINE_OBJECT_METRICS* metrics + ) PURE; + + /// + /// TextLayout calls this callback function to get the visible extents (in DIPs) of the inline object. + /// In the case of a simple bitmap, with no padding and no overhang, all the overhangs will + /// simply be zeroes. + /// + /// Overshoot of visible extents (in DIPs) outside the object. + /// + /// Standard HRESULT error code. + /// + /// + /// The overhangs should be returned relative to the reported size of the object + /// (DWRITE_INLINE_OBJECT_METRICS::width/height), and should not be baseline + /// adjusted. If you have an image that is actually 100x100 DIPs, but you want it + /// slightly inset (perhaps it has a glow) by 20 DIPs on each side, you would + /// return a width/height of 60x60 and four overhangs of 20 DIPs. + /// + STDMETHOD(GetOverhangMetrics)( + __out DWRITE_OVERHANG_METRICS* overhangs + ) PURE; + + /// + /// Layout uses this to determine the line breaking behavior of the inline object + /// amidst the text. + /// + /// Line-breaking condition between the object and the content immediately preceding it. + /// Line-breaking condition between the object and the content immediately following it. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetBreakConditions)( + __out DWRITE_BREAK_CONDITION* breakConditionBefore, + __out DWRITE_BREAK_CONDITION* breakConditionAfter + ) PURE; +}; + +/// +/// The IDWritePixelSnapping interface defines the pixel snapping properties of a text renderer. +/// +interface DWRITE_DECLARE_INTERFACE("eaf3a2da-ecf4-4d24-b644-b34f6842024b") IDWritePixelSnapping : public IUnknown +{ + /// + /// Determines whether pixel snapping is disabled. The recommended default is FALSE, + /// unless doing animation that requires subpixel vertical placement. + /// + /// The context passed to IDWriteTextLayout::Draw. + /// Receives TRUE if pixel snapping is disabled or FALSE if it not. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(IsPixelSnappingDisabled)( + __maybenull void* clientDrawingContext, + __out BOOL* isDisabled + ) PURE; + + /// + /// Gets the current transform that maps abstract coordinates to DIPs, + /// which may disable pixel snapping upon any rotation or shear. + /// + /// The context passed to IDWriteTextLayout::Draw. + /// Receives the transform. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetCurrentTransform)( + __maybenull void* clientDrawingContext, + __out DWRITE_MATRIX* transform + ) PURE; + + /// + /// Gets the number of physical pixels per DIP. A DIP (device-independent pixel) is 1/96 inch, + /// so the pixelsPerDip value is the number of logical pixels per inch divided by 96 (yielding + /// a value of 1 for 96 DPI and 1.25 for 120). + /// + /// The context passed to IDWriteTextLayout::Draw. + /// Receives the number of physical pixels per DIP. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetPixelsPerDip)( + __maybenull void* clientDrawingContext, + __out FLOAT* pixelsPerDip + ) PURE; +}; + +/// +/// The IDWriteTextLayout interface represents a set of application-defined +/// callbacks that perform rendering of text, inline objects, and decorations +/// such as underlines. +/// +interface DWRITE_DECLARE_INTERFACE("ef8a8135-5cc6-45fe-8825-c5a0724eb819") IDWriteTextRenderer : public IDWritePixelSnapping +{ + /// + /// IDWriteTextLayout::Draw calls this function to instruct the client to + /// render a run of glyphs. + /// + /// The context passed to + /// IDWriteTextLayout::Draw. + /// X-coordinate of the baseline. + /// Y-coordinate of the baseline. + /// Specifies measuring method for glyphs in the run. + /// Renderer implementations may choose different rendering modes for given measuring methods, + /// but best results are seen when the rendering mode matches the corresponding measuring mode: + /// DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL for DWRITE_MEASURING_MODE_NATURAL + /// DWRITE_RENDERING_MODE_CLEARTYPE_GDI_CLASSIC for DWRITE_MEASURING_MODE_GDI_CLASSIC + /// DWRITE_RENDERING_MODE_CLEARTYPE_GDI_NATURAL for DWRITE_MEASURING_MODE_GDI_NATURAL + /// + /// The glyph run to draw. + /// Properties of the characters + /// associated with this run. + /// The drawing effect set in + /// IDWriteTextLayout::SetDrawingEffect. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(DrawGlyphRun)( + __maybenull void* clientDrawingContext, + FLOAT baselineOriginX, + FLOAT baselineOriginY, + DWRITE_MEASURING_MODE measuringMode, + __in DWRITE_GLYPH_RUN const* glyphRun, + __in DWRITE_GLYPH_RUN_DESCRIPTION const* glyphRunDescription, + __maybenull IUnknown* clientDrawingEffect + ) PURE; + + /// + /// IDWriteTextLayout::Draw calls this function to instruct the client to draw + /// an underline. + /// + /// The context passed to + /// IDWriteTextLayout::Draw. + /// X-coordinate of the baseline. + /// Y-coordinate of the baseline. + /// Underline logical information. + /// The drawing effect set in + /// IDWriteTextLayout::SetDrawingEffect. + /// + /// Standard HRESULT error code. + /// + /// + /// A single underline can be broken into multiple calls, depending on + /// how the formatting changes attributes. If font sizes/styles change + /// within an underline, the thickness and offset will be averaged + /// weighted according to characters. + /// To get the correct top coordinate of the underline rect, add underline::offset + /// to the baseline's Y. Otherwise the underline will be immediately under the text. + /// The x coordinate will always be passed as the left side, regardless + /// of text directionality. This simplifies drawing and reduces the + /// problem of round-off that could potentially cause gaps or a double + /// stamped alpha blend. To avoid alpha overlap, round the end points + /// to the nearest device pixel. + /// + STDMETHOD(DrawUnderline)( + __maybenull void* clientDrawingContext, + FLOAT baselineOriginX, + FLOAT baselineOriginY, + __in DWRITE_UNDERLINE const* underline, + __maybenull IUnknown* clientDrawingEffect + ) PURE; + + /// + /// IDWriteTextLayout::Draw calls this function to instruct the client to draw + /// a strikethrough. + /// + /// The context passed to + /// IDWriteTextLayout::Draw. + /// X-coordinate of the baseline. + /// Y-coordinate of the baseline. + /// Strikethrough logical information. + /// The drawing effect set in + /// IDWriteTextLayout::SetDrawingEffect. + /// + /// Standard HRESULT error code. + /// + /// + /// A single strikethrough can be broken into multiple calls, depending on + /// how the formatting changes attributes. Strikethrough is not averaged + /// across font sizes/styles changes. + /// To get the correct top coordinate of the strikethrough rect, + /// add strikethrough::offset to the baseline's Y. + /// Like underlines, the x coordinate will always be passed as the left side, + /// regardless of text directionality. + /// + STDMETHOD(DrawStrikethrough)( + __maybenull void* clientDrawingContext, + FLOAT baselineOriginX, + FLOAT baselineOriginY, + __in DWRITE_STRIKETHROUGH const* strikethrough, + __maybenull IUnknown* clientDrawingEffect + ) PURE; + + /// + /// IDWriteTextLayout::Draw calls this application callback when it needs to + /// draw an inline object. + /// + /// The context passed to IDWriteTextLayout::Draw. + /// X-coordinate at the top-left corner of the inline object. + /// Y-coordinate at the top-left corner of the inline object. + /// The object set using IDWriteTextLayout::SetInlineObject. + /// The object should be drawn on its side. + /// The object is in an right-to-left context and should be drawn flipped. + /// The drawing effect set in + /// IDWriteTextLayout::SetDrawingEffect. + /// + /// Standard HRESULT error code. + /// + /// + /// The right-to-left flag is a hint for those cases where it would look + /// strange for the image to be shown normally (like an arrow pointing to + /// right to indicate a submenu). + /// + STDMETHOD(DrawInlineObject)( + __maybenull void* clientDrawingContext, + FLOAT originX, + FLOAT originY, + IDWriteInlineObject* inlineObject, + BOOL isSideways, + BOOL isRightToLeft, + __maybenull IUnknown* clientDrawingEffect + ) PURE; +}; + +/// +/// The IDWriteTextLayout interface represents a block of text after it has +/// been fully analyzed and formatted. +/// +/// All coordinates are in device independent pixels (DIPs). +/// +interface DWRITE_DECLARE_INTERFACE("53737037-6d14-410b-9bfe-0b182bb70961") IDWriteTextLayout : public IDWriteTextFormat +{ + /// + /// Set layout maximum width + /// + /// Layout maximum width + /// + /// Standard HRESULT error code. + /// + STDMETHOD(SetMaxWidth)( + FLOAT maxWidth + ) PURE; + + /// + /// Set layout maximum height + /// + /// Layout maximum height + /// + /// Standard HRESULT error code. + /// + STDMETHOD(SetMaxHeight)( + FLOAT maxHeight + ) PURE; + + /// + /// Set the font collection. + /// + /// The font collection to set + /// Text range to which this change applies. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(SetFontCollection)( + IDWriteFontCollection* fontCollection, + DWRITE_TEXT_RANGE textRange + ) PURE; + + /// + /// Set null-terminated font family name. + /// + /// Font family name + /// Text range to which this change applies. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(SetFontFamilyName)( + __in_z WCHAR const* fontFamilyName, + DWRITE_TEXT_RANGE textRange + ) PURE; + + /// + /// Set font weight. + /// + /// Font weight + /// Text range to which this change applies. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(SetFontWeight)( + DWRITE_FONT_WEIGHT fontWeight, + DWRITE_TEXT_RANGE textRange + ) PURE; + + /// + /// Set font style. + /// + /// Font style + /// Text range to which this change applies. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(SetFontStyle)( + DWRITE_FONT_STYLE fontStyle, + DWRITE_TEXT_RANGE textRange + ) PURE; + + /// + /// Set font stretch. + /// + /// font stretch + /// Text range to which this change applies. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(SetFontStretch)( + DWRITE_FONT_STRETCH fontStretch, + DWRITE_TEXT_RANGE textRange + ) PURE; + + /// + /// Set font em height. + /// + /// Font em height + /// Text range to which this change applies. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(SetFontSize)( + FLOAT fontSize, + DWRITE_TEXT_RANGE textRange + ) PURE; + + /// + /// Set underline. + /// + /// The Boolean flag indicates whether underline takes place + /// Text range to which this change applies. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(SetUnderline)( + BOOL hasUnderline, + DWRITE_TEXT_RANGE textRange + ) PURE; + + /// + /// Set strikethrough. + /// + /// The Boolean flag indicates whether strikethrough takes place + /// Text range to which this change applies. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(SetStrikethrough)( + BOOL hasStrikethrough, + DWRITE_TEXT_RANGE textRange + ) PURE; + + /// + /// Set application-defined drawing effect. + /// + /// Pointer to an application-defined drawing effect. + /// Text range to which this change applies. + /// + /// Standard HRESULT error code. + /// + /// + /// This drawing effect is associated with the specified range and will be passed back + /// to the application via the callback when the range is drawn at drawing time. + /// + STDMETHOD(SetDrawingEffect)( + IUnknown* drawingEffect, + DWRITE_TEXT_RANGE textRange + ) PURE; + + /// + /// Set inline object. + /// + /// Pointer to an application-implemented inline object. + /// Text range to which this change applies. + /// + /// Standard HRESULT error code. + /// + /// + /// This inline object applies to the specified range and will be passed back + /// to the application via the DrawInlineObject callback when the range is drawn. + /// Any text in that range will be suppressed. + /// + STDMETHOD(SetInlineObject)( + IDWriteInlineObject* inlineObject, + DWRITE_TEXT_RANGE textRange + ) PURE; + + /// + /// Set font typography features. + /// + /// Pointer to font typography setting. + /// Text range to which this change applies. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(SetTypography)( + IDWriteTypography* typography, + DWRITE_TEXT_RANGE textRange + ) PURE; + + /// + /// Set locale name. + /// + /// Locale name + /// Text range to which this change applies. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(SetLocaleName)( + __in_z WCHAR const* localeName, + DWRITE_TEXT_RANGE textRange + ) PURE; + + /// + /// Get layout maximum width + /// + STDMETHOD_(FLOAT, GetMaxWidth)() PURE; + + /// + /// Get layout maximum height + /// + STDMETHOD_(FLOAT, GetMaxHeight)() PURE; + + /// + /// Get the font collection where the current position is at. + /// + /// The current text position. + /// The current font collection + /// Text range to which this change applies. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetFontCollection)( + UINT32 currentPosition, + __out IDWriteFontCollection** fontCollection, + __out_opt DWRITE_TEXT_RANGE* textRange = NULL + ) PURE; + + /// + /// Get the length of the font family name where the current position is at. + /// + /// The current text position. + /// Size of the character array in character count not including the terminated NULL character. + /// The position range of the current format. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetFontFamilyNameLength)( + UINT32 currentPosition, + __out UINT32* nameLength, + __out_opt DWRITE_TEXT_RANGE* textRange = NULL + ) PURE; + + /// + /// Copy the font family name where the current position is at. + /// + /// The current text position. + /// Character array that receives the current font family name + /// Size of the character array in character count including the terminated NULL character. + /// The position range of the current format. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetFontFamilyName)( + UINT32 currentPosition, + __out_ecount_z(nameSize) WCHAR* fontFamilyName, + UINT32 nameSize, + __out_opt DWRITE_TEXT_RANGE* textRange = NULL + ) PURE; + + /// + /// Get the font weight where the current position is at. + /// + /// The current text position. + /// The current font weight + /// The position range of the current format. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetFontWeight)( + UINT32 currentPosition, + __out DWRITE_FONT_WEIGHT* fontWeight, + __out_opt DWRITE_TEXT_RANGE* textRange = NULL + ) PURE; + + /// + /// Get the font style where the current position is at. + /// + /// The current text position. + /// The current font style + /// The position range of the current format. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetFontStyle)( + UINT32 currentPosition, + __out DWRITE_FONT_STYLE* fontStyle, + __out_opt DWRITE_TEXT_RANGE* textRange = NULL + ) PURE; + + /// + /// Get the font stretch where the current position is at. + /// + /// The current text position. + /// The current font stretch + /// The position range of the current format. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetFontStretch)( + UINT32 currentPosition, + __out DWRITE_FONT_STRETCH* fontStretch, + __out_opt DWRITE_TEXT_RANGE* textRange = NULL + ) PURE; + + /// + /// Get the font em height where the current position is at. + /// + /// The current text position. + /// The current font em height + /// The position range of the current format. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetFontSize)( + UINT32 currentPosition, + __out FLOAT* fontSize, + __out_opt DWRITE_TEXT_RANGE* textRange = NULL + ) PURE; + + /// + /// Get the underline presence where the current position is at. + /// + /// The current text position. + /// The Boolean flag indicates whether text is underlined. + /// The position range of the current format. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetUnderline)( + UINT32 currentPosition, + __out BOOL* hasUnderline, + __out_opt DWRITE_TEXT_RANGE* textRange = NULL + ) PURE; + + /// + /// Get the strikethrough presence where the current position is at. + /// + /// The current text position. + /// The Boolean flag indicates whether text has strikethrough. + /// The position range of the current format. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetStrikethrough)( + UINT32 currentPosition, + __out BOOL* hasStrikethrough, + __out_opt DWRITE_TEXT_RANGE* textRange = NULL + ) PURE; + + /// + /// Get the application-defined drawing effect where the current position is at. + /// + /// The current text position. + /// The current application-defined drawing effect. + /// The position range of the current format. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetDrawingEffect)( + UINT32 currentPosition, + __out IUnknown** drawingEffect, + __out_opt DWRITE_TEXT_RANGE* textRange = NULL + ) PURE; + + /// + /// Get the inline object at the given position. + /// + /// The given text position. + /// The inline object. + /// The position range of the current format. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetInlineObject)( + UINT32 currentPosition, + __out IDWriteInlineObject** inlineObject, + __out_opt DWRITE_TEXT_RANGE* textRange = NULL + ) PURE; + + /// + /// Get the typography setting where the current position is at. + /// + /// The current text position. + /// The current typography setting. + /// The position range of the current format. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetTypography)( + UINT32 currentPosition, + __out IDWriteTypography** typography, + __out_opt DWRITE_TEXT_RANGE* textRange = NULL + ) PURE; + + /// + /// Get the length of the locale name where the current position is at. + /// + /// The current text position. + /// Size of the character array in character count not including the terminated NULL character. + /// The position range of the current format. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetLocaleNameLength)( + UINT32 currentPosition, + __out UINT32* nameLength, + __out_opt DWRITE_TEXT_RANGE* textRange = NULL + ) PURE; + + /// + /// Get the locale name where the current position is at. + /// + /// The current text position. + /// Character array that receives the current locale name + /// Size of the character array in character count including the terminated NULL character. + /// The position range of the current format. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetLocaleName)( + UINT32 currentPosition, + __out_ecount_z(nameSize) WCHAR* localeName, + UINT32 nameSize, + __out_opt DWRITE_TEXT_RANGE* textRange = NULL + ) PURE; + + /// + /// Initiate drawing of the text. + /// + /// An application defined value + /// included in rendering callbacks. + /// The set of application-defined callbacks that do + /// the actual rendering. + /// X-coordinate of the layout's left side. + /// Y-coordinate of the layout's top side. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(Draw)( + __maybenull void* clientDrawingContext, + IDWriteTextRenderer* renderer, + FLOAT originX, + FLOAT originY + ) PURE; + + /// + /// GetLineMetrics returns properties of each line. + /// + /// The array to fill with line information. + /// The maximum size of the lineMetrics array. + /// The actual size of the lineMetrics + /// array that is needed. + /// + /// Standard HRESULT error code. + /// + /// + /// If maxLineCount is not large enough E_NOT_SUFFICIENT_BUFFER, + /// which is equivalent to HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), + /// is returned and *actualLineCount is set to the number of lines + /// needed. + /// + STDMETHOD(GetLineMetrics)( + __out_ecount_opt(maxLineCount) DWRITE_LINE_METRICS* lineMetrics, + UINT32 maxLineCount, + __out UINT32* actualLineCount + ) PURE; + + /// + /// GetMetrics retrieves overall metrics for the formatted string. + /// + /// The returned metrics. + /// + /// Standard HRESULT error code. + /// + /// + /// Drawing effects like underline and strikethrough do not contribute + /// to the text size, which is essentially the sum of advance widths and + /// line heights. Additionally, visible swashes and other graphic + /// adornments may extend outside the returned width and height. + /// + STDMETHOD(GetMetrics)( + __out DWRITE_TEXT_METRICS* textMetrics + ) PURE; + + /// + /// GetOverhangMetrics returns the overhangs (in DIPs) of the layout and all + /// objects contained in it, including text glyphs and inline objects. + /// + /// Overshoots of visible extents (in DIPs) outside the layout. + /// + /// Standard HRESULT error code. + /// + /// + /// Any underline and strikethrough do not contribute to the black box + /// determination, since these are actually drawn by the renderer, which + /// is allowed to draw them in any variety of styles. + /// + STDMETHOD(GetOverhangMetrics)( + __out DWRITE_OVERHANG_METRICS* overhangs + ) PURE; + + /// + /// Retrieve logical properties and measurement of each cluster. + /// + /// The array to fill with cluster information. + /// The maximum size of the clusterMetrics array. + /// The actual size of the clusterMetrics array that is needed. + /// + /// Standard HRESULT error code. + /// + /// + /// If maxClusterCount is not large enough E_NOT_SUFFICIENT_BUFFER, + /// which is equivalent to HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), + /// is returned and *actualClusterCount is set to the number of clusters + /// needed. + /// + STDMETHOD(GetClusterMetrics)( + __out_ecount_opt(maxClusterCount) DWRITE_CLUSTER_METRICS* clusterMetrics, + UINT32 maxClusterCount, + __out UINT32* actualClusterCount + ) PURE; + + /// + /// Determines the minimum possible width the layout can be set to without + /// emergency breaking between the characters of whole words. + /// + /// Minimum width. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(DetermineMinWidth)( + __out FLOAT* minWidth + ) PURE; + + /// + /// Given a coordinate (in DIPs) relative to the top-left of the layout box, + /// this returns the corresponding hit-test metrics of the text string where + /// the hit-test has occurred. This is useful for mapping mouse clicks to caret + /// positions. When the given coordinate is outside the text string, the function + /// sets the output value *isInside to false but returns the nearest character + /// position. + /// + /// X coordinate to hit-test, relative to the top-left location of the layout box. + /// Y coordinate to hit-test, relative to the top-left location of the layout box. + /// Output flag indicating whether the hit-test location is at the leading or the trailing + /// side of the character. When the output *isInside value is set to false, this value is set according to the output + /// *position value to represent the edge closest to the hit-test location. + /// Output flag indicating whether the hit-test location is inside the text string. + /// When false, the position nearest the text's edge is returned. + /// Output geometry fully enclosing the hit-test location. When the output *isInside value + /// is set to false, this structure represents the geometry enclosing the edge closest to the hit-test location. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(HitTestPoint)( + FLOAT pointX, + FLOAT pointY, + __out BOOL* isTrailingHit, + __out BOOL* isInside, + __out DWRITE_HIT_TEST_METRICS* hitTestMetrics + ) PURE; + + /// + /// Given a text position and whether the caret is on the leading or trailing + /// edge of that position, this returns the corresponding coordinate (in DIPs) + /// relative to the top-left of the layout box. This is most useful for drawing + /// the caret's current position, but it could also be used to anchor an IME to the + /// typed text or attach a floating menu near the point of interest. It may also be + /// used to programmatically obtain the geometry of a particular text position + /// for UI automation. + /// + /// Text position to get the coordinate of. + /// Flag indicating whether the location is of the leading or the trailing side of the specified text position. + /// Output caret X, relative to the top-left of the layout box. + /// Output caret Y, relative to the top-left of the layout box. + /// Output geometry fully enclosing the specified text position. + /// + /// Standard HRESULT error code. + /// + /// + /// When drawing a caret at the returned X,Y, it should should be centered on X + /// and drawn from the Y coordinate down. The height will be the size of the + /// hit-tested text (which can vary in size within a line). + /// Reading direction also affects which side of the character the caret is drawn. + /// However, the returned X coordinate will be correct for either case. + /// You can get a text length back that is larger than a single character. + /// This happens for complex scripts when multiple characters form a single cluster, + /// when diacritics join their base character, or when you test a surrogate pair. + /// + STDMETHOD(HitTestTextPosition)( + UINT32 textPosition, + BOOL isTrailingHit, + __out FLOAT* pointX, + __out FLOAT* pointY, + __out DWRITE_HIT_TEST_METRICS* hitTestMetrics + ) PURE; + + /// + /// The application calls this function to get a set of hit-test metrics + /// corresponding to a range of text positions. The main usage for this + /// is to draw highlighted selection of the text string. + /// + /// The function returns E_NOT_SUFFICIENT_BUFFER, which is equivalent to + /// HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), when the buffer size of + /// hitTestMetrics is too small to hold all the regions calculated by the + /// function. In such situation, the function sets the output value + /// *actualHitTestMetricsCount to the number of geometries calculated. + /// The application is responsible to allocate a new buffer of greater + /// size and call the function again. + /// + /// A good value to use as an initial value for maxHitTestMetricsCount may + /// be calculated from the following equation: + /// maxHitTestMetricsCount = lineCount * maxBidiReorderingDepth + /// + /// where lineCount is obtained from the value of the output argument + /// *actualLineCount from the function IDWriteTextLayout::GetLineMetrics, + /// and the maxBidiReorderingDepth value from the DWRITE_TEXT_METRICS + /// structure of the output argument *textMetrics from the function + /// IDWriteFactory::CreateTextLayout. + /// + /// First text position of the specified range. + /// Number of positions of the specified range. + /// Offset of the X origin (left of the layout box) which is added to each of the hit-test metrics returned. + /// Offset of the Y origin (top of the layout box) which is added to each of the hit-test metrics returned. + /// Pointer to a buffer of the output geometry fully enclosing the specified position range. + /// Maximum number of distinct metrics it could hold in its buffer memory. + /// Actual number of metrics returned or needed. + /// + /// Standard HRESULT error code. + /// + /// + /// There are no gaps in the returned metrics. While there could be visual gaps, + /// depending on bidi ordering, each range is contiguous and reports all the text, + /// including any hidden characters and trimmed text. + /// The height of each returned range will be the same within each line, regardless + /// of how the font sizes vary. + /// + STDMETHOD(HitTestTextRange)( + UINT32 textPosition, + UINT32 textLength, + FLOAT originX, + FLOAT originY, + __out_ecount_opt(maxHitTestMetricsCount) DWRITE_HIT_TEST_METRICS* hitTestMetrics, + UINT32 maxHitTestMetricsCount, + __out UINT32* actualHitTestMetricsCount + ) PURE; +}; + +/// +/// Encapsulates a 32-bit device independent bitmap and device context, which can be used for rendering glyphs. +/// +interface DWRITE_DECLARE_INTERFACE("5e5a32a3-8dff-4773-9ff6-0696eab77267") IDWriteBitmapRenderTarget : public IUnknown +{ + /// + /// Draws a run of glyphs to the bitmap. + /// + /// Horizontal position of the baseline origin, in DIPs, relative to the upper-left corner of the DIB. + /// Vertical position of the baseline origin, in DIPs, relative to the upper-left corner of the DIB. + /// Specifies measuring method for glyphs in the run. + /// Renderer implementations may choose different rendering modes for different measuring methods, for example + /// DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL for DWRITE_MEASURING_MODE_NATURAL, + /// DWRITE_RENDERING_MODE_CLEARTYPE_GDI_CLASSIC for DWRITE_MEASURING_MODE_GDI_CLASSIC, and + /// DWRITE_RENDERING_MODE_CLEARTYPE_GDI_NATURAL for DWRITE_MEASURING_MODE_GDI_NATURAL. + /// + /// Structure containing the properties of the glyph run. + /// Object that controls rendering behavior. + /// Specifies the foreground color of the text. + /// Optional rectangle that receives the bounding box (in pixels not DIPs) of all the pixels affected by + /// drawing the glyph run. The black box rectangle may extend beyond the dimensions of the bitmap. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(DrawGlyphRun)( + FLOAT baselineOriginX, + FLOAT baselineOriginY, + DWRITE_MEASURING_MODE measuringMode, + __in DWRITE_GLYPH_RUN const* glyphRun, + IDWriteRenderingParams* renderingParams, + COLORREF textColor, + __out_opt RECT* blackBoxRect = NULL + ) PURE; + + /// + /// Gets a handle to the memory device context. + /// + /// + /// Returns the device context handle. + /// + /// + /// An application can use the device context to draw using GDI functions. An application can obtain the bitmap handle + /// (HBITMAP) by calling GetCurrentObject. An application that wants information about the underlying bitmap, including + /// a pointer to the pixel data, can call GetObject to fill in a DIBSECTION structure. The bitmap is always a 32-bit + /// top-down DIB. + /// + STDMETHOD_(HDC, GetMemoryDC)() PURE; + + /// + /// Gets the number of bitmap pixels per DIP. A DIP (device-independent pixel) is 1/96 inch so this value is the number + /// if pixels per inch divided by 96. + /// + /// + /// Returns the number of bitmap pixels per DIP. + /// + STDMETHOD_(FLOAT, GetPixelsPerDip)() PURE; + + /// + /// Sets the number of bitmap pixels per DIP. A DIP (device-independent pixel) is 1/96 inch so this value is the number + /// if pixels per inch divided by 96. + /// + /// Specifies the number of pixels per DIP. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(SetPixelsPerDip)( + FLOAT pixelsPerDip + ) PURE; + + /// + /// Gets the transform that maps abstract coordinate to DIPs. By default this is the identity + /// transform. Note that this is unrelated to the world transform of the underlying device + /// context. + /// + /// Receives the transform. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetCurrentTransform)( + __out DWRITE_MATRIX* transform + ) PURE; + + /// + /// Sets the transform that maps abstract coordinate to DIPs. This does not affect the world + /// transform of the underlying device context. + /// + /// Specifies the new transform. This parameter can be NULL, in which + /// case the identity transform is implied. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(SetCurrentTransform)( + __in_opt DWRITE_MATRIX const* transform + ) PURE; + + /// + /// Gets the dimensions of the bitmap. + /// + /// Receives the size of the bitmap in pixels. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetSize)( + __out SIZE* size + ) PURE; + + /// + /// Resizes the bitmap. + /// + /// New bitmap width, in pixels. + /// New bitmap height, in pixels. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(Resize)( + UINT32 width, + UINT32 height + ) PURE; +}; + +/// +/// The GDI interop interface provides interoperability with GDI. +/// +interface DWRITE_DECLARE_INTERFACE("1edd9491-9853-4299-898f-6432983b6f3a") IDWriteGdiInterop : public IUnknown +{ + /// + /// Creates a font object that matches the properties specified by the LOGFONT structure. + /// + /// Structure containing a GDI-compatible font description. + /// Receives a newly created font object if successful, or NULL in case of error. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(CreateFontFromLOGFONT)( + __in LOGFONTW const* logFont, + __out IDWriteFont** font + ) PURE; + + /// + /// Initializes a LOGFONT structure based on the GDI-compatible properties of the specified font. + /// + /// Specifies a font in the system font collection. + /// Structure that receives a GDI-compatible font description. + /// Contains TRUE if the specified font object is part of the system font collection + /// or FALSE otherwise. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(ConvertFontToLOGFONT)( + IDWriteFont* font, + __out LOGFONTW* logFont, + __out BOOL* isSystemFont + ) PURE; + + /// + /// Initializes a LOGFONT structure based on the GDI-compatible properties of the specified font. + /// + /// Specifies a font face. + /// Structure that receives a GDI-compatible font description. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(ConvertFontFaceToLOGFONT)( + IDWriteFontFace* font, + __out LOGFONTW* logFont + ) PURE; + + /// + /// Creates a font face object that corresponds to the currently selected HFONT. + /// + /// Handle to a device context into which a font has been selected. It is assumed that the client + /// has already performed font mapping and that the font selected into the DC is the actual font that would be used + /// for rendering glyphs. + /// Contains the newly created font face object, or NULL in case of failure. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(CreateFontFaceFromHdc)( + HDC hdc, + __out IDWriteFontFace** fontFace + ) PURE; + + /// + /// Creates an object that encapsulates a bitmap and memory DC which can be used for rendering glyphs. + /// + /// Optional device context used to create a compatible memory DC. + /// Width of the bitmap. + /// Height of the bitmap. + /// Receives a pointer to the newly created render target. + STDMETHOD(CreateBitmapRenderTarget)( + __in_opt HDC hdc, + UINT32 width, + UINT32 height, + __out IDWriteBitmapRenderTarget** renderTarget + ) PURE; +}; + +/// +/// The DWRITE_TEXTURE_TYPE enumeration identifies a type of alpha texture. An alpha texture is a bitmap of alpha values, each +/// representing the darkness (i.e., opacity) of a pixel or subpixel. +/// +enum DWRITE_TEXTURE_TYPE +{ + /// + /// Specifies an alpha texture for aliased text rendering (i.e., bi-level, where each pixel is either fully opaque or fully transparent), + /// with one byte per pixel. + /// + DWRITE_TEXTURE_ALIASED_1x1, + + /// + /// Specifies an alpha texture for ClearType text rendering, with three bytes per pixel in the horizontal dimension and + /// one byte per pixel in the vertical dimension. + /// + DWRITE_TEXTURE_CLEARTYPE_3x1 +}; + +/// +/// Maximum alpha value in a texture returned by IDWriteGlyphRunAnalysis::CreateAlphaTexture. +/// +#define DWRITE_ALPHA_MAX 255 + +/// +/// Interface that encapsulates information used to render a glyph run. +/// +interface DWRITE_DECLARE_INTERFACE("7d97dbf7-e085-42d4-81e3-6a883bded118") IDWriteGlyphRunAnalysis : public IUnknown +{ + /// + /// Gets the bounding rectangle of the physical pixels affected by the glyph run. + /// + /// Specifies the type of texture requested. If a bi-level texture is requested, the + /// bounding rectangle includes only bi-level glyphs. Otherwise, the bounding rectangle includes only anti-aliased + /// glyphs. + /// Receives the bounding rectangle, or an empty rectangle if there are no glyphs + /// if the specified type. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetAlphaTextureBounds)( + DWRITE_TEXTURE_TYPE textureType, + __out RECT* textureBounds + ) PURE; + + /// + /// Creates an alpha texture of the specified type. + /// + /// Specifies the type of texture requested. If a bi-level texture is requested, the + /// texture contains only bi-level glyphs. Otherwise, the texture contains only anti-aliased glyphs. + /// Specifies the bounding rectangle of the texture, which can be different than + /// the bounding rectangle returned by GetAlphaTextureBounds. + /// Receives the array of alpha values. + /// Size of the alphaValues array. The minimum size depends on the dimensions of the + /// rectangle and the type of texture requested. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(CreateAlphaTexture)( + DWRITE_TEXTURE_TYPE textureType, + __in RECT const* textureBounds, + __out_bcount(bufferSize) BYTE* alphaValues, + UINT32 bufferSize + ) PURE; + + /// + /// Gets properties required for ClearType blending. + /// + /// Rendering parameters object. In most cases, the values returned in the output + /// parameters are based on the properties of this object. The exception is if a GDI-compatible rendering mode + /// is specified. + /// Receives the gamma value to use for gamma correction. + /// Receives the enhanced contrast value. + /// Receives the ClearType level. + STDMETHOD(GetAlphaBlendParams)( + IDWriteRenderingParams* renderingParams, + __out FLOAT* blendGamma, + __out FLOAT* blendEnhancedContrast, + __out FLOAT* blendClearTypeLevel + ) PURE; +}; + +/// +/// The root factory interface for all DWrite objects. +/// +interface DWRITE_DECLARE_INTERFACE("b859ee5a-d838-4b5b-a2e8-1adc7d93db48") IDWriteFactory : public IUnknown +{ + /// + /// Gets a font collection representing the set of installed fonts. + /// + /// Receives a pointer to the system font collection object, or NULL in case of failure. + /// If this parameter is nonzero, the function performs an immediate check for changes to the set of + /// installed fonts. If this parameter is FALSE, the function will still detect changes if the font cache service is running, but + /// there may be some latency. For example, an application might specify TRUE if it has itself just installed a font and wants to + /// be sure the font collection contains that font. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetSystemFontCollection)( + __out IDWriteFontCollection** fontCollection, + BOOL checkForUpdates = FALSE + ) PURE; + + /// + /// Creates a font collection using a custom font collection loader. + /// + /// Application-defined font collection loader, which must have been previously + /// registered using RegisterFontCollectionLoader. + /// Key used by the loader to identify a collection of font files. + /// Size in bytes of the collection key. + /// Receives a pointer to the system font collection object, or NULL in case of failure. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(CreateCustomFontCollection)( + IDWriteFontCollectionLoader* collectionLoader, + __in_bcount(collectionKeySize) void const* collectionKey, + UINT32 collectionKeySize, + __out IDWriteFontCollection** fontCollection + ) PURE; + + /// + /// Registers a custom font collection loader with the factory object. + /// + /// Application-defined font collection loader. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(RegisterFontCollectionLoader)( + IDWriteFontCollectionLoader* fontCollectionLoader + ) PURE; + + /// + /// Unregisters a custom font collection loader that was previously registered using RegisterFontCollectionLoader. + /// + /// Application-defined font collection loader. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(UnregisterFontCollectionLoader)( + IDWriteFontCollectionLoader* fontCollectionLoader + ) PURE; + + /// + /// CreateFontFileReference creates a font file reference object from a local font file. + /// + /// Absolute file path. Subsequent operations on the constructed object may fail + /// if the user provided filePath doesn't correspond to a valid file on the disk. + /// Last modified time of the input file path. If the parameter is omitted, + /// the function will access the font file to obtain its last write time, so the clients are encouraged to specify this value + /// to avoid extra disk access. Subsequent operations on the constructed object may fail + /// if the user provided lastWriteTime doesn't match the file on the disk. + /// Contains newly created font file reference object, or NULL in case of failure. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(CreateFontFileReference)( + __in_z WCHAR const* filePath, + __in_opt FILETIME const* lastWriteTime, + __out IDWriteFontFile** fontFile + ) PURE; + + /// + /// CreateCustomFontFileReference creates a reference to an application specific font file resource. + /// This function enables an application or a document to use a font without having to install it on the system. + /// The fontFileReferenceKey has to be unique only in the scope of the fontFileLoader used in this call. + /// + /// Font file reference key that uniquely identifies the font file resource + /// during the lifetime of fontFileLoader. + /// Size of font file reference key in bytes. + /// Font file loader that will be used by the font system to load data from the file identified by + /// fontFileReferenceKey. + /// Contains the newly created font file object, or NULL in case of failure. + /// + /// Standard HRESULT error code. + /// + /// + /// This function is provided for cases when an application or a document needs to use a font + /// without having to install it on the system. fontFileReferenceKey has to be unique only in the scope + /// of the fontFileLoader used in this call. + /// + STDMETHOD(CreateCustomFontFileReference)( + __in_bcount(fontFileReferenceKeySize) void const* fontFileReferenceKey, + UINT32 fontFileReferenceKeySize, + IDWriteFontFileLoader* fontFileLoader, + __out IDWriteFontFile** fontFile + ) PURE; + + /// + /// Creates a font face object. + /// + /// The file format of the font face. + /// The number of font files require to represent the font face. + /// Font files representing the font face. Since IDWriteFontFace maintains its own references + /// to the input font file objects, it's OK to release them after this call. + /// The zero based index of a font face in cases when the font files contain a collection of font faces. + /// If the font files contain a single face, this value should be zero. + /// Font face simulation flags for algorithmic emboldening and italicization. + /// Contains the newly created font face object, or NULL in case of failure. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(CreateFontFace)( + DWRITE_FONT_FACE_TYPE fontFaceType, + UINT32 numberOfFiles, + __in_ecount(numberOfFiles) IDWriteFontFile* const* fontFiles, + UINT32 faceIndex, + DWRITE_FONT_SIMULATIONS fontFaceSimulationFlags, + __out IDWriteFontFace** fontFace + ) PURE; + + /// + /// Creates a rendering parameters object with default settings for the primary monitor. + /// + /// Holds the newly created rendering parameters object, or NULL in case of failure. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(CreateRenderingParams)( + __out IDWriteRenderingParams** renderingParams + ) PURE; + + /// + /// Creates a rendering parameters object with default settings for the specified monitor. + /// + /// The monitor to read the default values from. + /// Holds the newly created rendering parameters object, or NULL in case of failure. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(CreateMonitorRenderingParams)( + HMONITOR monitor, + __out IDWriteRenderingParams** renderingParams + ) PURE; + + /// + /// Creates a rendering parameters object with the specified properties. + /// + /// The gamma value used for gamma correction, which must be greater than zero and cannot exceed 256. + /// The amount of contrast enhancement, zero or greater. + /// The degree of ClearType level, from 0.0f (no ClearType) to 1.0f (full ClearType). + /// The geometry of a device pixel. + /// Method of rendering glyphs. In most cases, this should be DWRITE_RENDERING_MODE_DEFAULT to automatically use an appropriate mode. + /// Holds the newly created rendering parameters object, or NULL in case of failure. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(CreateCustomRenderingParams)( + FLOAT gamma, + FLOAT enhancedContrast, + FLOAT clearTypeLevel, + DWRITE_PIXEL_GEOMETRY pixelGeometry, + DWRITE_RENDERING_MODE renderingMode, + __out IDWriteRenderingParams** renderingParams + ) PURE; + + /// + /// Registers a font file loader with DirectWrite. + /// + /// Pointer to the implementation of the IDWriteFontFileLoader for a particular file resource type. + /// + /// Standard HRESULT error code. + /// + /// + /// This function registers a font file loader with DirectWrite. + /// Font file loader interface handles loading font file resources of a particular type from a key. + /// The font file loader interface is recommended to be implemented by a singleton object. + /// A given instance can only be registered once. + /// Succeeding attempts will return an error that it has already been registered. + /// IMPORTANT: font file loader implementations must not register themselves with DirectWrite + /// inside their constructors and must not unregister themselves in their destructors, because + /// registration and unregistraton operations increment and decrement the object reference count respectively. + /// Instead, registration and unregistration of font file loaders with DirectWrite should be performed + /// outside of the font file loader implementation as a separate step. + /// + STDMETHOD(RegisterFontFileLoader)( + IDWriteFontFileLoader* fontFileLoader + ) PURE; + + /// + /// Unregisters a font file loader that was previously registered with the DirectWrite font system using RegisterFontFileLoader. + /// + /// Pointer to the file loader that was previously registered with the DirectWrite font system using RegisterFontFileLoader. + /// + /// This function will succeed if the user loader is requested to be removed. + /// It will fail if the pointer to the file loader identifies a standard DirectWrite loader, + /// or a loader that is never registered or has already been unregistered. + /// + /// + /// This function unregisters font file loader callbacks with the DirectWrite font system. + /// The font file loader interface is recommended to be implemented by a singleton object. + /// IMPORTANT: font file loader implementations must not register themselves with DirectWrite + /// inside their constructors and must not unregister themselves in their destructors, because + /// registration and unregistraton operations increment and decrement the object reference count respectively. + /// Instead, registration and unregistration of font file loaders with DirectWrite should be performed + /// outside of the font file loader implementation as a separate step. + /// + STDMETHOD(UnregisterFontFileLoader)( + IDWriteFontFileLoader* fontFileLoader + ) PURE; + + /// + /// Create a text format object used for text layout. + /// + /// Name of the font family + /// Font collection. NULL indicates the system font collection. + /// Font weight + /// Font style + /// Font stretch + /// Logical size of the font in DIP units. A DIP ("device-independent pixel") equals 1/96 inch. + /// Locale name + /// Contains newly created text format object, or NULL in case of failure. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(CreateTextFormat)( + __in_z WCHAR const* fontFamilyName, + __maybenull IDWriteFontCollection* fontCollection, + DWRITE_FONT_WEIGHT fontWeight, + DWRITE_FONT_STYLE fontStyle, + DWRITE_FONT_STRETCH fontStretch, + FLOAT fontSize, + __in_z WCHAR const* localeName, + __out IDWriteTextFormat** textFormat + ) PURE; + + /// + /// Create a typography object used in conjunction with text format for text layout. + /// + /// Contains newly created typography object, or NULL in case of failure. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(CreateTypography)( + __out IDWriteTypography** typography + ) PURE; + + /// + /// Create an object used for interoperability with GDI. + /// + /// Receives the GDI interop object if successful, or NULL in case of failure. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetGdiInterop)( + __out IDWriteGdiInterop** gdiInterop + ) PURE; + + /// + /// CreateTextLayout takes a string, format, and associated constraints + /// and produces and object representing the fully analyzed + /// and formatted result. + /// + /// The string to layout. + /// The length of the string. + /// The format to apply to the string. + /// Width of the layout box. + /// Height of the layout box. + /// The resultant object. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(CreateTextLayout)( + __in_ecount(stringLength) WCHAR const* string, + UINT32 stringLength, + IDWriteTextFormat* textFormat, + FLOAT maxWidth, + FLOAT maxHeight, + __out IDWriteTextLayout** textLayout + ) PURE; + + /// + /// CreateGdiCompatibleTextLayout takes a string, format, and associated constraints + /// and produces and object representing the result formatted for a particular display resolution + /// and measuring method. The resulting text layout should only be used for the intended resolution, + /// and for cases where text scalability is desired, CreateTextLayout should be used instead. + /// + /// The string to layout. + /// The length of the string. + /// The format to apply to the string. + /// Width of the layout box. + /// Height of the layout box. + /// Number of physical pixels per DIP. For example, if rendering onto a 96 DPI device then pixelsPerDip + /// is 1. If rendering onto a 120 DPI device then pixelsPerDip is 120/96. + /// Optional transform applied to the glyphs and their positions. This transform is applied after the + /// scaling specified the font size and pixelsPerDip. + /// + /// When set to FALSE, instructs the text layout to use the same metrics as GDI aliased text. + /// When set to TRUE, instructs the text layout to use the same metrics as text measured by GDI using a font + /// created with CLEARTYPE_NATURAL_QUALITY. + /// + /// The resultant object. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(CreateGdiCompatibleTextLayout)( + __in_ecount(stringLength) WCHAR const* string, + UINT32 stringLength, + IDWriteTextFormat* textFormat, + FLOAT layoutWidth, + FLOAT layoutHeight, + FLOAT pixelsPerDip, + __in_opt DWRITE_MATRIX const* transform, + BOOL useGdiNatural, + __out IDWriteTextLayout** textLayout + ) PURE; + + /// + /// The application may call this function to create an inline object for trimming, using an ellipsis as the omission sign. + /// The ellipsis will be created using the current settings of the format, including base font, style, and any effects. + /// Alternate omission signs can be created by the application by implementing IDWriteInlineObject. + /// + /// Text format used as a template for the omission sign. + /// Created omission sign. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(CreateEllipsisTrimmingSign)( + IDWriteTextFormat* textFormat, + __out IDWriteInlineObject** trimmingSign + ) PURE; + + /// + /// Return an interface to perform text analysis with. + /// + /// The resultant object. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(CreateTextAnalyzer)( + __out IDWriteTextAnalyzer** textAnalyzer + ) PURE; + + /// + /// Creates a number substitution object using a locale name, + /// substitution method, and whether to ignore user overrides (uses NLS + /// defaults for the given culture instead). + /// + /// Method of number substitution to use. + /// Which locale to obtain the digits from. + /// Ignore the user's settings and use the locale defaults + /// Receives a pointer to the newly created object. + STDMETHOD(CreateNumberSubstitution)( + __in DWRITE_NUMBER_SUBSTITUTION_METHOD substitutionMethod, + __in_z WCHAR const* localeName, + __in BOOL ignoreUserOverride, + __out IDWriteNumberSubstitution** numberSubstitution + ) PURE; + + /// + /// Creates a glyph run analysis object, which encapsulates information + /// used to render a glyph run. + /// + /// Structure specifying the properties of the glyph run. + /// Number of physical pixels per DIP. For example, if rendering onto a 96 DPI bitmap then pixelsPerDip + /// is 1. If rendering onto a 120 DPI bitmap then pixelsPerDip is 120/96. + /// Optional transform applied to the glyphs and their positions. This transform is applied after the + /// scaling specified the emSize and pixelsPerDip. + /// Specifies the rendering mode, which must be one of the raster rendering modes (i.e., not default + /// and not outline). + /// Specifies the method to measure glyphs. + /// Horizontal position of the baseline origin, in DIPs. + /// Vertical position of the baseline origin, in DIPs. + /// Receives a pointer to the newly created object. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(CreateGlyphRunAnalysis)( + __in DWRITE_GLYPH_RUN const* glyphRun, + FLOAT pixelsPerDip, + __in_opt DWRITE_MATRIX const* transform, + DWRITE_RENDERING_MODE renderingMode, + DWRITE_MEASURING_MODE measuringMode, + FLOAT baselineOriginX, + FLOAT baselineOriginY, + __out IDWriteGlyphRunAnalysis** glyphRunAnalysis + ) PURE; + +}; // interface IDWriteFactory + +/// +/// Creates a DirectWrite factory object that is used for subsequent creation of individual DirectWrite objects. +/// +/// Identifies whether the factory object will be shared or isolated. +/// Identifies the DirectWrite factory interface, such as __uuidof(IDWriteFactory). +/// Receives the DirectWrite factory object. +/// +/// Standard HRESULT error code. +/// +/// +/// Obtains DirectWrite factory object that is used for subsequent creation of individual DirectWrite classes. +/// DirectWrite factory contains internal state such as font loader registration and cached font data. +/// In most cases it is recommended to use the shared factory object, because it allows multiple components +/// that use DirectWrite to share internal DirectWrite state and reduce memory usage. +/// However, there are cases when it is desirable to reduce the impact of a component, +/// such as a plug-in from an untrusted source, on the rest of the process by sandboxing and isolating it +/// from the rest of the process components. In such cases, it is recommended to use an isolated factory for the sandboxed +/// component. +/// +EXTERN_C HRESULT DWRITE_EXPORT DWriteCreateFactory( + __in DWRITE_FACTORY_TYPE factoryType, + __in REFIID iid, + __out IUnknown **factory + ); + +// Macros used to define DirectWrite error codes. +#define FACILITY_DWRITE 0x898 +#define DWRITE_ERR_BASE 0x5000 +#define MAKE_DWRITE_HR(severity, code) MAKE_HRESULT(severity, FACILITY_DWRITE, (DWRITE_ERR_BASE + code)) +#define MAKE_DWRITE_HR_ERR(code) MAKE_DWRITE_HR(SEVERITY_ERROR, code) + +/// +/// Indicates an error in an input file such as a font file. +/// +#define DWRITE_E_FILEFORMAT MAKE_DWRITE_HR_ERR(0x000) + +/// +/// Indicates an error originating in DirectWrite code, which is not expected to occur but is safe to recover from. +/// +#define DWRITE_E_UNEXPECTED MAKE_DWRITE_HR_ERR(0x001) + +/// +/// Indicates the specified font does not exist. +/// +#define DWRITE_E_NOFONT MAKE_DWRITE_HR_ERR(0x002) + +/// +/// A font file could not be opened because the file, directory, network location, drive, or other storage +/// location does not exist or is unavailable. +/// +#define DWRITE_E_FILENOTFOUND MAKE_DWRITE_HR_ERR(0x003) + +/// +/// A font file exists but could not be opened due to access denied, sharing violation, or similar error. +/// +#define DWRITE_E_FILEACCESS MAKE_DWRITE_HR_ERR(0x004) + +/// +/// A font collection is obsolete due to changes in the system. +/// +#define DWRITE_E_FONTCOLLECTIONOBSOLETE MAKE_DWRITE_HR_ERR(0x005) + +/// +/// The given interface is already registered. +/// +#define DWRITE_E_ALREADYREGISTERED MAKE_DWRITE_HR_ERR(0x006) + +#endif /* DWRITE_H_INCLUDED */ diff --git a/MediaClient/MediaClient/directx/include/DXGI.h b/MediaClient/MediaClient/directx/include/DXGI.h new file mode 100644 index 0000000..1bfb39e --- /dev/null +++ b/MediaClient/MediaClient/directx/include/DXGI.h @@ -0,0 +1,2901 @@ + + +/* this ALWAYS GENERATED file contains the definitions for the interfaces */ + + + /* File created by MIDL compiler version 7.00.0555 */ +/* @@MIDL_FILE_HEADING( ) */ + +#pragma warning( disable: 4049 ) /* more than 64k source lines */ + + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCNDR_H_VERSION__ +#define __REQUIRED_RPCNDR_H_VERSION__ 475 +#endif + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCSAL_H_VERSION__ +#define __REQUIRED_RPCSAL_H_VERSION__ 100 +#endif + +#include "rpc.h" +#include "rpcndr.h" + +#ifndef __RPCNDR_H_VERSION__ +#error this stub requires an updated version of +#endif // __RPCNDR_H_VERSION__ + +#ifndef COM_NO_WINDOWS_H +#include "windows.h" +#include "ole2.h" +#endif /*COM_NO_WINDOWS_H*/ + +#ifndef __dxgi_h__ +#define __dxgi_h__ + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +/* Forward Declarations */ + +#ifndef __IDXGIObject_FWD_DEFINED__ +#define __IDXGIObject_FWD_DEFINED__ +typedef interface IDXGIObject IDXGIObject; +#endif /* __IDXGIObject_FWD_DEFINED__ */ + + +#ifndef __IDXGIDeviceSubObject_FWD_DEFINED__ +#define __IDXGIDeviceSubObject_FWD_DEFINED__ +typedef interface IDXGIDeviceSubObject IDXGIDeviceSubObject; +#endif /* __IDXGIDeviceSubObject_FWD_DEFINED__ */ + + +#ifndef __IDXGIResource_FWD_DEFINED__ +#define __IDXGIResource_FWD_DEFINED__ +typedef interface IDXGIResource IDXGIResource; +#endif /* __IDXGIResource_FWD_DEFINED__ */ + + +#ifndef __IDXGIKeyedMutex_FWD_DEFINED__ +#define __IDXGIKeyedMutex_FWD_DEFINED__ +typedef interface IDXGIKeyedMutex IDXGIKeyedMutex; +#endif /* __IDXGIKeyedMutex_FWD_DEFINED__ */ + + +#ifndef __IDXGISurface_FWD_DEFINED__ +#define __IDXGISurface_FWD_DEFINED__ +typedef interface IDXGISurface IDXGISurface; +#endif /* __IDXGISurface_FWD_DEFINED__ */ + + +#ifndef __IDXGISurface1_FWD_DEFINED__ +#define __IDXGISurface1_FWD_DEFINED__ +typedef interface IDXGISurface1 IDXGISurface1; +#endif /* __IDXGISurface1_FWD_DEFINED__ */ + + +#ifndef __IDXGIAdapter_FWD_DEFINED__ +#define __IDXGIAdapter_FWD_DEFINED__ +typedef interface IDXGIAdapter IDXGIAdapter; +#endif /* __IDXGIAdapter_FWD_DEFINED__ */ + + +#ifndef __IDXGIOutput_FWD_DEFINED__ +#define __IDXGIOutput_FWD_DEFINED__ +typedef interface IDXGIOutput IDXGIOutput; +#endif /* __IDXGIOutput_FWD_DEFINED__ */ + + +#ifndef __IDXGISwapChain_FWD_DEFINED__ +#define __IDXGISwapChain_FWD_DEFINED__ +typedef interface IDXGISwapChain IDXGISwapChain; +#endif /* __IDXGISwapChain_FWD_DEFINED__ */ + + +#ifndef __IDXGIFactory_FWD_DEFINED__ +#define __IDXGIFactory_FWD_DEFINED__ +typedef interface IDXGIFactory IDXGIFactory; +#endif /* __IDXGIFactory_FWD_DEFINED__ */ + + +#ifndef __IDXGIDevice_FWD_DEFINED__ +#define __IDXGIDevice_FWD_DEFINED__ +typedef interface IDXGIDevice IDXGIDevice; +#endif /* __IDXGIDevice_FWD_DEFINED__ */ + + +#ifndef __IDXGIFactory1_FWD_DEFINED__ +#define __IDXGIFactory1_FWD_DEFINED__ +typedef interface IDXGIFactory1 IDXGIFactory1; +#endif /* __IDXGIFactory1_FWD_DEFINED__ */ + + +#ifndef __IDXGIAdapter1_FWD_DEFINED__ +#define __IDXGIAdapter1_FWD_DEFINED__ +typedef interface IDXGIAdapter1 IDXGIAdapter1; +#endif /* __IDXGIAdapter1_FWD_DEFINED__ */ + + +#ifndef __IDXGIDevice1_FWD_DEFINED__ +#define __IDXGIDevice1_FWD_DEFINED__ +typedef interface IDXGIDevice1 IDXGIDevice1; +#endif /* __IDXGIDevice1_FWD_DEFINED__ */ + + +/* header files for imported files */ +#include "oaidl.h" +#include "ocidl.h" +#include "dxgitype.h" + +#ifdef __cplusplus +extern "C"{ +#endif + + +/* interface __MIDL_itf_dxgi_0000_0000 */ +/* [local] */ + +#define DXGI_CPU_ACCESS_NONE ( 0 ) +#define DXGI_CPU_ACCESS_DYNAMIC ( 1 ) +#define DXGI_CPU_ACCESS_READ_WRITE ( 2 ) +#define DXGI_CPU_ACCESS_SCRATCH ( 3 ) +#define DXGI_CPU_ACCESS_FIELD 15 +#define DXGI_USAGE_SHADER_INPUT ( 1L << (0 + 4) ) +#define DXGI_USAGE_RENDER_TARGET_OUTPUT ( 1L << (1 + 4) ) +#define DXGI_USAGE_BACK_BUFFER ( 1L << (2 + 4) ) +#define DXGI_USAGE_SHARED ( 1L << (3 + 4) ) +#define DXGI_USAGE_READ_ONLY ( 1L << (4 + 4) ) +#define DXGI_USAGE_DISCARD_ON_PRESENT ( 1L << (5 + 4) ) +#define DXGI_USAGE_UNORDERED_ACCESS ( 1L << (6 + 4) ) +typedef UINT DXGI_USAGE; + +typedef struct DXGI_FRAME_STATISTICS + { + UINT PresentCount; + UINT PresentRefreshCount; + UINT SyncRefreshCount; + LARGE_INTEGER SyncQPCTime; + LARGE_INTEGER SyncGPUTime; + } DXGI_FRAME_STATISTICS; + +typedef struct DXGI_MAPPED_RECT + { + INT Pitch; + BYTE *pBits; + } DXGI_MAPPED_RECT; + +#ifdef __midl +typedef struct _LUID + { + DWORD LowPart; + LONG HighPart; + } LUID; + +typedef struct _LUID *PLUID; + +#endif +typedef struct DXGI_ADAPTER_DESC + { + WCHAR Description[ 128 ]; + UINT VendorId; + UINT DeviceId; + UINT SubSysId; + UINT Revision; + SIZE_T DedicatedVideoMemory; + SIZE_T DedicatedSystemMemory; + SIZE_T SharedSystemMemory; + LUID AdapterLuid; + } DXGI_ADAPTER_DESC; + +#if !defined(HMONITOR_DECLARED) && !defined(HMONITOR) && (WINVER < 0x0500) +#define HMONITOR_DECLARED +#if 0 +typedef HANDLE HMONITOR; + +#endif +DECLARE_HANDLE(HMONITOR); +#endif +typedef struct DXGI_OUTPUT_DESC + { + WCHAR DeviceName[ 32 ]; + RECT DesktopCoordinates; + BOOL AttachedToDesktop; + DXGI_MODE_ROTATION Rotation; + HMONITOR Monitor; + } DXGI_OUTPUT_DESC; + +typedef struct DXGI_SHARED_RESOURCE + { + HANDLE Handle; + } DXGI_SHARED_RESOURCE; + +#define DXGI_RESOURCE_PRIORITY_MINIMUM ( 0x28000000 ) + +#define DXGI_RESOURCE_PRIORITY_LOW ( 0x50000000 ) + +#define DXGI_RESOURCE_PRIORITY_NORMAL ( 0x78000000 ) + +#define DXGI_RESOURCE_PRIORITY_HIGH ( 0xa0000000 ) + +#define DXGI_RESOURCE_PRIORITY_MAXIMUM ( 0xc8000000 ) + +typedef +enum DXGI_RESIDENCY + { DXGI_RESIDENCY_FULLY_RESIDENT = 1, + DXGI_RESIDENCY_RESIDENT_IN_SHARED_MEMORY = 2, + DXGI_RESIDENCY_EVICTED_TO_DISK = 3 + } DXGI_RESIDENCY; + +typedef struct DXGI_SURFACE_DESC + { + UINT Width; + UINT Height; + DXGI_FORMAT Format; + DXGI_SAMPLE_DESC SampleDesc; + } DXGI_SURFACE_DESC; + +typedef +enum DXGI_SWAP_EFFECT + { DXGI_SWAP_EFFECT_DISCARD = 0, + DXGI_SWAP_EFFECT_SEQUENTIAL = 1 + } DXGI_SWAP_EFFECT; + +typedef +enum DXGI_SWAP_CHAIN_FLAG + { DXGI_SWAP_CHAIN_FLAG_NONPREROTATED = 1, + DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH = 2, + DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE = 4 + } DXGI_SWAP_CHAIN_FLAG; + +typedef struct DXGI_SWAP_CHAIN_DESC + { + DXGI_MODE_DESC BufferDesc; + DXGI_SAMPLE_DESC SampleDesc; + DXGI_USAGE BufferUsage; + UINT BufferCount; + HWND OutputWindow; + BOOL Windowed; + DXGI_SWAP_EFFECT SwapEffect; + UINT Flags; + } DXGI_SWAP_CHAIN_DESC; + + + +extern RPC_IF_HANDLE __MIDL_itf_dxgi_0000_0000_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_dxgi_0000_0000_v0_0_s_ifspec; + +#ifndef __IDXGIObject_INTERFACE_DEFINED__ +#define __IDXGIObject_INTERFACE_DEFINED__ + +/* interface IDXGIObject */ +/* [unique][local][uuid][object] */ + + +EXTERN_C const IID IID_IDXGIObject; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("aec22fb8-76f3-4639-9be0-28eb43a67a2e") + IDXGIObject : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SetPrivateData( + /* [annotation][in] */ + __in REFGUID Name, + /* [in] */ UINT DataSize, + /* [annotation][in] */ + __in_bcount(DataSize) const void *pData) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface( + /* [annotation][in] */ + __in REFGUID Name, + /* [annotation][in] */ + __in const IUnknown *pUnknown) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetPrivateData( + /* [annotation][in] */ + __in REFGUID Name, + /* [annotation][out][in] */ + __inout UINT *pDataSize, + /* [annotation][out] */ + __out_bcount(*pDataSize) void *pData) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetParent( + /* [annotation][in] */ + __in REFIID riid, + /* [annotation][retval][out] */ + __out void **ppParent) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXGIObjectVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXGIObject * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXGIObject * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXGIObject * This); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + IDXGIObject * This, + /* [annotation][in] */ + __in REFGUID Name, + /* [in] */ UINT DataSize, + /* [annotation][in] */ + __in_bcount(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + IDXGIObject * This, + /* [annotation][in] */ + __in REFGUID Name, + /* [annotation][in] */ + __in const IUnknown *pUnknown); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + IDXGIObject * This, + /* [annotation][in] */ + __in REFGUID Name, + /* [annotation][out][in] */ + __inout UINT *pDataSize, + /* [annotation][out] */ + __out_bcount(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *GetParent )( + IDXGIObject * This, + /* [annotation][in] */ + __in REFIID riid, + /* [annotation][retval][out] */ + __out void **ppParent); + + END_INTERFACE + } IDXGIObjectVtbl; + + interface IDXGIObject + { + CONST_VTBL struct IDXGIObjectVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXGIObject_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDXGIObject_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDXGIObject_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDXGIObject_SetPrivateData(This,Name,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,Name,DataSize,pData) ) + +#define IDXGIObject_SetPrivateDataInterface(This,Name,pUnknown) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,Name,pUnknown) ) + +#define IDXGIObject_GetPrivateData(This,Name,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,Name,pDataSize,pData) ) + +#define IDXGIObject_GetParent(This,riid,ppParent) \ + ( (This)->lpVtbl -> GetParent(This,riid,ppParent) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDXGIObject_INTERFACE_DEFINED__ */ + + +#ifndef __IDXGIDeviceSubObject_INTERFACE_DEFINED__ +#define __IDXGIDeviceSubObject_INTERFACE_DEFINED__ + +/* interface IDXGIDeviceSubObject */ +/* [unique][local][uuid][object] */ + + +EXTERN_C const IID IID_IDXGIDeviceSubObject; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("3d3e0379-f9de-4d58-bb6c-18d62992f1a6") + IDXGIDeviceSubObject : public IDXGIObject + { + public: + virtual HRESULT STDMETHODCALLTYPE GetDevice( + /* [annotation][in] */ + __in REFIID riid, + /* [annotation][retval][out] */ + __out void **ppDevice) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXGIDeviceSubObjectVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXGIDeviceSubObject * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXGIDeviceSubObject * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXGIDeviceSubObject * This); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + IDXGIDeviceSubObject * This, + /* [annotation][in] */ + __in REFGUID Name, + /* [in] */ UINT DataSize, + /* [annotation][in] */ + __in_bcount(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + IDXGIDeviceSubObject * This, + /* [annotation][in] */ + __in REFGUID Name, + /* [annotation][in] */ + __in const IUnknown *pUnknown); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + IDXGIDeviceSubObject * This, + /* [annotation][in] */ + __in REFGUID Name, + /* [annotation][out][in] */ + __inout UINT *pDataSize, + /* [annotation][out] */ + __out_bcount(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *GetParent )( + IDXGIDeviceSubObject * This, + /* [annotation][in] */ + __in REFIID riid, + /* [annotation][retval][out] */ + __out void **ppParent); + + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + IDXGIDeviceSubObject * This, + /* [annotation][in] */ + __in REFIID riid, + /* [annotation][retval][out] */ + __out void **ppDevice); + + END_INTERFACE + } IDXGIDeviceSubObjectVtbl; + + interface IDXGIDeviceSubObject + { + CONST_VTBL struct IDXGIDeviceSubObjectVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXGIDeviceSubObject_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDXGIDeviceSubObject_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDXGIDeviceSubObject_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDXGIDeviceSubObject_SetPrivateData(This,Name,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,Name,DataSize,pData) ) + +#define IDXGIDeviceSubObject_SetPrivateDataInterface(This,Name,pUnknown) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,Name,pUnknown) ) + +#define IDXGIDeviceSubObject_GetPrivateData(This,Name,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,Name,pDataSize,pData) ) + +#define IDXGIDeviceSubObject_GetParent(This,riid,ppParent) \ + ( (This)->lpVtbl -> GetParent(This,riid,ppParent) ) + + +#define IDXGIDeviceSubObject_GetDevice(This,riid,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppDevice) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDXGIDeviceSubObject_INTERFACE_DEFINED__ */ + + +#ifndef __IDXGIResource_INTERFACE_DEFINED__ +#define __IDXGIResource_INTERFACE_DEFINED__ + +/* interface IDXGIResource */ +/* [unique][local][uuid][object] */ + + +EXTERN_C const IID IID_IDXGIResource; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("035f3ab4-482e-4e50-b41f-8a7f8bd8960b") + IDXGIResource : public IDXGIDeviceSubObject + { + public: + virtual HRESULT STDMETHODCALLTYPE GetSharedHandle( + /* [annotation][out] */ + __out HANDLE *pSharedHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetUsage( + /* [annotation][out] */ + __out DXGI_USAGE *pUsage) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetEvictionPriority( + /* [in] */ UINT EvictionPriority) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetEvictionPriority( + /* [annotation][retval][out] */ + __out UINT *pEvictionPriority) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXGIResourceVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXGIResource * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXGIResource * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXGIResource * This); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + IDXGIResource * This, + /* [annotation][in] */ + __in REFGUID Name, + /* [in] */ UINT DataSize, + /* [annotation][in] */ + __in_bcount(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + IDXGIResource * This, + /* [annotation][in] */ + __in REFGUID Name, + /* [annotation][in] */ + __in const IUnknown *pUnknown); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + IDXGIResource * This, + /* [annotation][in] */ + __in REFGUID Name, + /* [annotation][out][in] */ + __inout UINT *pDataSize, + /* [annotation][out] */ + __out_bcount(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *GetParent )( + IDXGIResource * This, + /* [annotation][in] */ + __in REFIID riid, + /* [annotation][retval][out] */ + __out void **ppParent); + + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + IDXGIResource * This, + /* [annotation][in] */ + __in REFIID riid, + /* [annotation][retval][out] */ + __out void **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetSharedHandle )( + IDXGIResource * This, + /* [annotation][out] */ + __out HANDLE *pSharedHandle); + + HRESULT ( STDMETHODCALLTYPE *GetUsage )( + IDXGIResource * This, + /* [annotation][out] */ + __out DXGI_USAGE *pUsage); + + HRESULT ( STDMETHODCALLTYPE *SetEvictionPriority )( + IDXGIResource * This, + /* [in] */ UINT EvictionPriority); + + HRESULT ( STDMETHODCALLTYPE *GetEvictionPriority )( + IDXGIResource * This, + /* [annotation][retval][out] */ + __out UINT *pEvictionPriority); + + END_INTERFACE + } IDXGIResourceVtbl; + + interface IDXGIResource + { + CONST_VTBL struct IDXGIResourceVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXGIResource_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDXGIResource_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDXGIResource_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDXGIResource_SetPrivateData(This,Name,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,Name,DataSize,pData) ) + +#define IDXGIResource_SetPrivateDataInterface(This,Name,pUnknown) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,Name,pUnknown) ) + +#define IDXGIResource_GetPrivateData(This,Name,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,Name,pDataSize,pData) ) + +#define IDXGIResource_GetParent(This,riid,ppParent) \ + ( (This)->lpVtbl -> GetParent(This,riid,ppParent) ) + + +#define IDXGIResource_GetDevice(This,riid,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppDevice) ) + + +#define IDXGIResource_GetSharedHandle(This,pSharedHandle) \ + ( (This)->lpVtbl -> GetSharedHandle(This,pSharedHandle) ) + +#define IDXGIResource_GetUsage(This,pUsage) \ + ( (This)->lpVtbl -> GetUsage(This,pUsage) ) + +#define IDXGIResource_SetEvictionPriority(This,EvictionPriority) \ + ( (This)->lpVtbl -> SetEvictionPriority(This,EvictionPriority) ) + +#define IDXGIResource_GetEvictionPriority(This,pEvictionPriority) \ + ( (This)->lpVtbl -> GetEvictionPriority(This,pEvictionPriority) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDXGIResource_INTERFACE_DEFINED__ */ + + +#ifndef __IDXGIKeyedMutex_INTERFACE_DEFINED__ +#define __IDXGIKeyedMutex_INTERFACE_DEFINED__ + +/* interface IDXGIKeyedMutex */ +/* [unique][local][uuid][object] */ + + +EXTERN_C const IID IID_IDXGIKeyedMutex; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9d8e1289-d7b3-465f-8126-250e349af85d") + IDXGIKeyedMutex : public IDXGIDeviceSubObject + { + public: + virtual HRESULT STDMETHODCALLTYPE AcquireSync( + /* [in] */ UINT64 Key, + /* [in] */ DWORD dwMilliseconds) = 0; + + virtual HRESULT STDMETHODCALLTYPE ReleaseSync( + /* [in] */ UINT64 Key) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXGIKeyedMutexVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXGIKeyedMutex * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXGIKeyedMutex * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXGIKeyedMutex * This); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + IDXGIKeyedMutex * This, + /* [annotation][in] */ + __in REFGUID Name, + /* [in] */ UINT DataSize, + /* [annotation][in] */ + __in_bcount(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + IDXGIKeyedMutex * This, + /* [annotation][in] */ + __in REFGUID Name, + /* [annotation][in] */ + __in const IUnknown *pUnknown); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + IDXGIKeyedMutex * This, + /* [annotation][in] */ + __in REFGUID Name, + /* [annotation][out][in] */ + __inout UINT *pDataSize, + /* [annotation][out] */ + __out_bcount(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *GetParent )( + IDXGIKeyedMutex * This, + /* [annotation][in] */ + __in REFIID riid, + /* [annotation][retval][out] */ + __out void **ppParent); + + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + IDXGIKeyedMutex * This, + /* [annotation][in] */ + __in REFIID riid, + /* [annotation][retval][out] */ + __out void **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *AcquireSync )( + IDXGIKeyedMutex * This, + /* [in] */ UINT64 Key, + /* [in] */ DWORD dwMilliseconds); + + HRESULT ( STDMETHODCALLTYPE *ReleaseSync )( + IDXGIKeyedMutex * This, + /* [in] */ UINT64 Key); + + END_INTERFACE + } IDXGIKeyedMutexVtbl; + + interface IDXGIKeyedMutex + { + CONST_VTBL struct IDXGIKeyedMutexVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXGIKeyedMutex_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDXGIKeyedMutex_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDXGIKeyedMutex_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDXGIKeyedMutex_SetPrivateData(This,Name,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,Name,DataSize,pData) ) + +#define IDXGIKeyedMutex_SetPrivateDataInterface(This,Name,pUnknown) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,Name,pUnknown) ) + +#define IDXGIKeyedMutex_GetPrivateData(This,Name,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,Name,pDataSize,pData) ) + +#define IDXGIKeyedMutex_GetParent(This,riid,ppParent) \ + ( (This)->lpVtbl -> GetParent(This,riid,ppParent) ) + + +#define IDXGIKeyedMutex_GetDevice(This,riid,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppDevice) ) + + +#define IDXGIKeyedMutex_AcquireSync(This,Key,dwMilliseconds) \ + ( (This)->lpVtbl -> AcquireSync(This,Key,dwMilliseconds) ) + +#define IDXGIKeyedMutex_ReleaseSync(This,Key) \ + ( (This)->lpVtbl -> ReleaseSync(This,Key) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDXGIKeyedMutex_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_dxgi_0000_0004 */ +/* [local] */ + +#define DXGI_MAP_READ ( 1UL ) + +#define DXGI_MAP_WRITE ( 2UL ) + +#define DXGI_MAP_DISCARD ( 4UL ) + + + +extern RPC_IF_HANDLE __MIDL_itf_dxgi_0000_0004_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_dxgi_0000_0004_v0_0_s_ifspec; + +#ifndef __IDXGISurface_INTERFACE_DEFINED__ +#define __IDXGISurface_INTERFACE_DEFINED__ + +/* interface IDXGISurface */ +/* [unique][local][uuid][object] */ + + +EXTERN_C const IID IID_IDXGISurface; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("cafcb56c-6ac3-4889-bf47-9e23bbd260ec") + IDXGISurface : public IDXGIDeviceSubObject + { + public: + virtual HRESULT STDMETHODCALLTYPE GetDesc( + /* [annotation][out] */ + __out DXGI_SURFACE_DESC *pDesc) = 0; + + virtual HRESULT STDMETHODCALLTYPE Map( + /* [annotation][out] */ + __out DXGI_MAPPED_RECT *pLockedRect, + /* [in] */ UINT MapFlags) = 0; + + virtual HRESULT STDMETHODCALLTYPE Unmap( void) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXGISurfaceVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXGISurface * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXGISurface * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXGISurface * This); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + IDXGISurface * This, + /* [annotation][in] */ + __in REFGUID Name, + /* [in] */ UINT DataSize, + /* [annotation][in] */ + __in_bcount(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + IDXGISurface * This, + /* [annotation][in] */ + __in REFGUID Name, + /* [annotation][in] */ + __in const IUnknown *pUnknown); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + IDXGISurface * This, + /* [annotation][in] */ + __in REFGUID Name, + /* [annotation][out][in] */ + __inout UINT *pDataSize, + /* [annotation][out] */ + __out_bcount(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *GetParent )( + IDXGISurface * This, + /* [annotation][in] */ + __in REFIID riid, + /* [annotation][retval][out] */ + __out void **ppParent); + + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + IDXGISurface * This, + /* [annotation][in] */ + __in REFIID riid, + /* [annotation][retval][out] */ + __out void **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetDesc )( + IDXGISurface * This, + /* [annotation][out] */ + __out DXGI_SURFACE_DESC *pDesc); + + HRESULT ( STDMETHODCALLTYPE *Map )( + IDXGISurface * This, + /* [annotation][out] */ + __out DXGI_MAPPED_RECT *pLockedRect, + /* [in] */ UINT MapFlags); + + HRESULT ( STDMETHODCALLTYPE *Unmap )( + IDXGISurface * This); + + END_INTERFACE + } IDXGISurfaceVtbl; + + interface IDXGISurface + { + CONST_VTBL struct IDXGISurfaceVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXGISurface_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDXGISurface_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDXGISurface_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDXGISurface_SetPrivateData(This,Name,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,Name,DataSize,pData) ) + +#define IDXGISurface_SetPrivateDataInterface(This,Name,pUnknown) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,Name,pUnknown) ) + +#define IDXGISurface_GetPrivateData(This,Name,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,Name,pDataSize,pData) ) + +#define IDXGISurface_GetParent(This,riid,ppParent) \ + ( (This)->lpVtbl -> GetParent(This,riid,ppParent) ) + + +#define IDXGISurface_GetDevice(This,riid,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppDevice) ) + + +#define IDXGISurface_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + +#define IDXGISurface_Map(This,pLockedRect,MapFlags) \ + ( (This)->lpVtbl -> Map(This,pLockedRect,MapFlags) ) + +#define IDXGISurface_Unmap(This) \ + ( (This)->lpVtbl -> Unmap(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDXGISurface_INTERFACE_DEFINED__ */ + + +#ifndef __IDXGISurface1_INTERFACE_DEFINED__ +#define __IDXGISurface1_INTERFACE_DEFINED__ + +/* interface IDXGISurface1 */ +/* [unique][local][uuid][object] */ + + +EXTERN_C const IID IID_IDXGISurface1; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("4AE63092-6327-4c1b-80AE-BFE12EA32B86") + IDXGISurface1 : public IDXGISurface + { + public: + virtual HRESULT STDMETHODCALLTYPE GetDC( + /* [in] */ BOOL Discard, + /* [annotation][out] */ + __out HDC *phdc) = 0; + + virtual HRESULT STDMETHODCALLTYPE ReleaseDC( + /* [annotation][in] */ + __in_opt RECT *pDirtyRect) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXGISurface1Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXGISurface1 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXGISurface1 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXGISurface1 * This); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + IDXGISurface1 * This, + /* [annotation][in] */ + __in REFGUID Name, + /* [in] */ UINT DataSize, + /* [annotation][in] */ + __in_bcount(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + IDXGISurface1 * This, + /* [annotation][in] */ + __in REFGUID Name, + /* [annotation][in] */ + __in const IUnknown *pUnknown); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + IDXGISurface1 * This, + /* [annotation][in] */ + __in REFGUID Name, + /* [annotation][out][in] */ + __inout UINT *pDataSize, + /* [annotation][out] */ + __out_bcount(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *GetParent )( + IDXGISurface1 * This, + /* [annotation][in] */ + __in REFIID riid, + /* [annotation][retval][out] */ + __out void **ppParent); + + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + IDXGISurface1 * This, + /* [annotation][in] */ + __in REFIID riid, + /* [annotation][retval][out] */ + __out void **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetDesc )( + IDXGISurface1 * This, + /* [annotation][out] */ + __out DXGI_SURFACE_DESC *pDesc); + + HRESULT ( STDMETHODCALLTYPE *Map )( + IDXGISurface1 * This, + /* [annotation][out] */ + __out DXGI_MAPPED_RECT *pLockedRect, + /* [in] */ UINT MapFlags); + + HRESULT ( STDMETHODCALLTYPE *Unmap )( + IDXGISurface1 * This); + + HRESULT ( STDMETHODCALLTYPE *GetDC )( + IDXGISurface1 * This, + /* [in] */ BOOL Discard, + /* [annotation][out] */ + __out HDC *phdc); + + HRESULT ( STDMETHODCALLTYPE *ReleaseDC )( + IDXGISurface1 * This, + /* [annotation][in] */ + __in_opt RECT *pDirtyRect); + + END_INTERFACE + } IDXGISurface1Vtbl; + + interface IDXGISurface1 + { + CONST_VTBL struct IDXGISurface1Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXGISurface1_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDXGISurface1_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDXGISurface1_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDXGISurface1_SetPrivateData(This,Name,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,Name,DataSize,pData) ) + +#define IDXGISurface1_SetPrivateDataInterface(This,Name,pUnknown) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,Name,pUnknown) ) + +#define IDXGISurface1_GetPrivateData(This,Name,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,Name,pDataSize,pData) ) + +#define IDXGISurface1_GetParent(This,riid,ppParent) \ + ( (This)->lpVtbl -> GetParent(This,riid,ppParent) ) + + +#define IDXGISurface1_GetDevice(This,riid,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppDevice) ) + + +#define IDXGISurface1_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + +#define IDXGISurface1_Map(This,pLockedRect,MapFlags) \ + ( (This)->lpVtbl -> Map(This,pLockedRect,MapFlags) ) + +#define IDXGISurface1_Unmap(This) \ + ( (This)->lpVtbl -> Unmap(This) ) + + +#define IDXGISurface1_GetDC(This,Discard,phdc) \ + ( (This)->lpVtbl -> GetDC(This,Discard,phdc) ) + +#define IDXGISurface1_ReleaseDC(This,pDirtyRect) \ + ( (This)->lpVtbl -> ReleaseDC(This,pDirtyRect) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDXGISurface1_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_dxgi_0000_0006 */ +/* [local] */ + + + + +extern RPC_IF_HANDLE __MIDL_itf_dxgi_0000_0006_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_dxgi_0000_0006_v0_0_s_ifspec; + +#ifndef __IDXGIAdapter_INTERFACE_DEFINED__ +#define __IDXGIAdapter_INTERFACE_DEFINED__ + +/* interface IDXGIAdapter */ +/* [unique][local][uuid][object] */ + + +EXTERN_C const IID IID_IDXGIAdapter; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("2411e7e1-12ac-4ccf-bd14-9798e8534dc0") + IDXGIAdapter : public IDXGIObject + { + public: + virtual HRESULT STDMETHODCALLTYPE EnumOutputs( + /* [in] */ UINT Output, + /* [annotation][out][in] */ + __out IDXGIOutput **ppOutput) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetDesc( + /* [annotation][out] */ + __out DXGI_ADAPTER_DESC *pDesc) = 0; + + virtual HRESULT STDMETHODCALLTYPE CheckInterfaceSupport( + /* [annotation][in] */ + __in REFGUID InterfaceName, + /* [annotation][out] */ + __out LARGE_INTEGER *pUMDVersion) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXGIAdapterVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXGIAdapter * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXGIAdapter * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXGIAdapter * This); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + IDXGIAdapter * This, + /* [annotation][in] */ + __in REFGUID Name, + /* [in] */ UINT DataSize, + /* [annotation][in] */ + __in_bcount(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + IDXGIAdapter * This, + /* [annotation][in] */ + __in REFGUID Name, + /* [annotation][in] */ + __in const IUnknown *pUnknown); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + IDXGIAdapter * This, + /* [annotation][in] */ + __in REFGUID Name, + /* [annotation][out][in] */ + __inout UINT *pDataSize, + /* [annotation][out] */ + __out_bcount(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *GetParent )( + IDXGIAdapter * This, + /* [annotation][in] */ + __in REFIID riid, + /* [annotation][retval][out] */ + __out void **ppParent); + + HRESULT ( STDMETHODCALLTYPE *EnumOutputs )( + IDXGIAdapter * This, + /* [in] */ UINT Output, + /* [annotation][out][in] */ + __out IDXGIOutput **ppOutput); + + HRESULT ( STDMETHODCALLTYPE *GetDesc )( + IDXGIAdapter * This, + /* [annotation][out] */ + __out DXGI_ADAPTER_DESC *pDesc); + + HRESULT ( STDMETHODCALLTYPE *CheckInterfaceSupport )( + IDXGIAdapter * This, + /* [annotation][in] */ + __in REFGUID InterfaceName, + /* [annotation][out] */ + __out LARGE_INTEGER *pUMDVersion); + + END_INTERFACE + } IDXGIAdapterVtbl; + + interface IDXGIAdapter + { + CONST_VTBL struct IDXGIAdapterVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXGIAdapter_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDXGIAdapter_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDXGIAdapter_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDXGIAdapter_SetPrivateData(This,Name,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,Name,DataSize,pData) ) + +#define IDXGIAdapter_SetPrivateDataInterface(This,Name,pUnknown) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,Name,pUnknown) ) + +#define IDXGIAdapter_GetPrivateData(This,Name,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,Name,pDataSize,pData) ) + +#define IDXGIAdapter_GetParent(This,riid,ppParent) \ + ( (This)->lpVtbl -> GetParent(This,riid,ppParent) ) + + +#define IDXGIAdapter_EnumOutputs(This,Output,ppOutput) \ + ( (This)->lpVtbl -> EnumOutputs(This,Output,ppOutput) ) + +#define IDXGIAdapter_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + +#define IDXGIAdapter_CheckInterfaceSupport(This,InterfaceName,pUMDVersion) \ + ( (This)->lpVtbl -> CheckInterfaceSupport(This,InterfaceName,pUMDVersion) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDXGIAdapter_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_dxgi_0000_0007 */ +/* [local] */ + +#define DXGI_ENUM_MODES_INTERLACED ( 1UL ) + +#define DXGI_ENUM_MODES_SCALING ( 2UL ) + + + +extern RPC_IF_HANDLE __MIDL_itf_dxgi_0000_0007_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_dxgi_0000_0007_v0_0_s_ifspec; + +#ifndef __IDXGIOutput_INTERFACE_DEFINED__ +#define __IDXGIOutput_INTERFACE_DEFINED__ + +/* interface IDXGIOutput */ +/* [unique][local][uuid][object] */ + + +EXTERN_C const IID IID_IDXGIOutput; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("ae02eedb-c735-4690-8d52-5a8dc20213aa") + IDXGIOutput : public IDXGIObject + { + public: + virtual HRESULT STDMETHODCALLTYPE GetDesc( + /* [annotation][out] */ + __out DXGI_OUTPUT_DESC *pDesc) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetDisplayModeList( + /* [in] */ DXGI_FORMAT EnumFormat, + /* [in] */ UINT Flags, + /* [annotation][out][in] */ + __inout UINT *pNumModes, + /* [annotation][out] */ + __out_ecount_part_opt(*pNumModes,*pNumModes) DXGI_MODE_DESC *pDesc) = 0; + + virtual HRESULT STDMETHODCALLTYPE FindClosestMatchingMode( + /* [annotation][in] */ + __in const DXGI_MODE_DESC *pModeToMatch, + /* [annotation][out] */ + __out DXGI_MODE_DESC *pClosestMatch, + /* [annotation][in] */ + __in_opt IUnknown *pConcernedDevice) = 0; + + virtual HRESULT STDMETHODCALLTYPE WaitForVBlank( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE TakeOwnership( + /* [annotation][in] */ + __in IUnknown *pDevice, + BOOL Exclusive) = 0; + + virtual void STDMETHODCALLTYPE ReleaseOwnership( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetGammaControlCapabilities( + /* [annotation][out] */ + __out DXGI_GAMMA_CONTROL_CAPABILITIES *pGammaCaps) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetGammaControl( + /* [annotation][in] */ + __in const DXGI_GAMMA_CONTROL *pArray) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetGammaControl( + /* [annotation][out] */ + __out DXGI_GAMMA_CONTROL *pArray) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetDisplaySurface( + /* [annotation][in] */ + __in IDXGISurface *pScanoutSurface) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetDisplaySurfaceData( + /* [annotation][in] */ + __in IDXGISurface *pDestination) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetFrameStatistics( + /* [annotation][out] */ + __out DXGI_FRAME_STATISTICS *pStats) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXGIOutputVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXGIOutput * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXGIOutput * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXGIOutput * This); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + IDXGIOutput * This, + /* [annotation][in] */ + __in REFGUID Name, + /* [in] */ UINT DataSize, + /* [annotation][in] */ + __in_bcount(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + IDXGIOutput * This, + /* [annotation][in] */ + __in REFGUID Name, + /* [annotation][in] */ + __in const IUnknown *pUnknown); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + IDXGIOutput * This, + /* [annotation][in] */ + __in REFGUID Name, + /* [annotation][out][in] */ + __inout UINT *pDataSize, + /* [annotation][out] */ + __out_bcount(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *GetParent )( + IDXGIOutput * This, + /* [annotation][in] */ + __in REFIID riid, + /* [annotation][retval][out] */ + __out void **ppParent); + + HRESULT ( STDMETHODCALLTYPE *GetDesc )( + IDXGIOutput * This, + /* [annotation][out] */ + __out DXGI_OUTPUT_DESC *pDesc); + + HRESULT ( STDMETHODCALLTYPE *GetDisplayModeList )( + IDXGIOutput * This, + /* [in] */ DXGI_FORMAT EnumFormat, + /* [in] */ UINT Flags, + /* [annotation][out][in] */ + __inout UINT *pNumModes, + /* [annotation][out] */ + __out_ecount_part_opt(*pNumModes,*pNumModes) DXGI_MODE_DESC *pDesc); + + HRESULT ( STDMETHODCALLTYPE *FindClosestMatchingMode )( + IDXGIOutput * This, + /* [annotation][in] */ + __in const DXGI_MODE_DESC *pModeToMatch, + /* [annotation][out] */ + __out DXGI_MODE_DESC *pClosestMatch, + /* [annotation][in] */ + __in_opt IUnknown *pConcernedDevice); + + HRESULT ( STDMETHODCALLTYPE *WaitForVBlank )( + IDXGIOutput * This); + + HRESULT ( STDMETHODCALLTYPE *TakeOwnership )( + IDXGIOutput * This, + /* [annotation][in] */ + __in IUnknown *pDevice, + BOOL Exclusive); + + void ( STDMETHODCALLTYPE *ReleaseOwnership )( + IDXGIOutput * This); + + HRESULT ( STDMETHODCALLTYPE *GetGammaControlCapabilities )( + IDXGIOutput * This, + /* [annotation][out] */ + __out DXGI_GAMMA_CONTROL_CAPABILITIES *pGammaCaps); + + HRESULT ( STDMETHODCALLTYPE *SetGammaControl )( + IDXGIOutput * This, + /* [annotation][in] */ + __in const DXGI_GAMMA_CONTROL *pArray); + + HRESULT ( STDMETHODCALLTYPE *GetGammaControl )( + IDXGIOutput * This, + /* [annotation][out] */ + __out DXGI_GAMMA_CONTROL *pArray); + + HRESULT ( STDMETHODCALLTYPE *SetDisplaySurface )( + IDXGIOutput * This, + /* [annotation][in] */ + __in IDXGISurface *pScanoutSurface); + + HRESULT ( STDMETHODCALLTYPE *GetDisplaySurfaceData )( + IDXGIOutput * This, + /* [annotation][in] */ + __in IDXGISurface *pDestination); + + HRESULT ( STDMETHODCALLTYPE *GetFrameStatistics )( + IDXGIOutput * This, + /* [annotation][out] */ + __out DXGI_FRAME_STATISTICS *pStats); + + END_INTERFACE + } IDXGIOutputVtbl; + + interface IDXGIOutput + { + CONST_VTBL struct IDXGIOutputVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXGIOutput_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDXGIOutput_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDXGIOutput_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDXGIOutput_SetPrivateData(This,Name,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,Name,DataSize,pData) ) + +#define IDXGIOutput_SetPrivateDataInterface(This,Name,pUnknown) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,Name,pUnknown) ) + +#define IDXGIOutput_GetPrivateData(This,Name,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,Name,pDataSize,pData) ) + +#define IDXGIOutput_GetParent(This,riid,ppParent) \ + ( (This)->lpVtbl -> GetParent(This,riid,ppParent) ) + + +#define IDXGIOutput_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + +#define IDXGIOutput_GetDisplayModeList(This,EnumFormat,Flags,pNumModes,pDesc) \ + ( (This)->lpVtbl -> GetDisplayModeList(This,EnumFormat,Flags,pNumModes,pDesc) ) + +#define IDXGIOutput_FindClosestMatchingMode(This,pModeToMatch,pClosestMatch,pConcernedDevice) \ + ( (This)->lpVtbl -> FindClosestMatchingMode(This,pModeToMatch,pClosestMatch,pConcernedDevice) ) + +#define IDXGIOutput_WaitForVBlank(This) \ + ( (This)->lpVtbl -> WaitForVBlank(This) ) + +#define IDXGIOutput_TakeOwnership(This,pDevice,Exclusive) \ + ( (This)->lpVtbl -> TakeOwnership(This,pDevice,Exclusive) ) + +#define IDXGIOutput_ReleaseOwnership(This) \ + ( (This)->lpVtbl -> ReleaseOwnership(This) ) + +#define IDXGIOutput_GetGammaControlCapabilities(This,pGammaCaps) \ + ( (This)->lpVtbl -> GetGammaControlCapabilities(This,pGammaCaps) ) + +#define IDXGIOutput_SetGammaControl(This,pArray) \ + ( (This)->lpVtbl -> SetGammaControl(This,pArray) ) + +#define IDXGIOutput_GetGammaControl(This,pArray) \ + ( (This)->lpVtbl -> GetGammaControl(This,pArray) ) + +#define IDXGIOutput_SetDisplaySurface(This,pScanoutSurface) \ + ( (This)->lpVtbl -> SetDisplaySurface(This,pScanoutSurface) ) + +#define IDXGIOutput_GetDisplaySurfaceData(This,pDestination) \ + ( (This)->lpVtbl -> GetDisplaySurfaceData(This,pDestination) ) + +#define IDXGIOutput_GetFrameStatistics(This,pStats) \ + ( (This)->lpVtbl -> GetFrameStatistics(This,pStats) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDXGIOutput_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_dxgi_0000_0008 */ +/* [local] */ + +#define DXGI_MAX_SWAP_CHAIN_BUFFERS ( 16 ) +#define DXGI_PRESENT_TEST 0x00000001UL +#define DXGI_PRESENT_DO_NOT_SEQUENCE 0x00000002UL +#define DXGI_PRESENT_RESTART 0x00000004UL + + +extern RPC_IF_HANDLE __MIDL_itf_dxgi_0000_0008_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_dxgi_0000_0008_v0_0_s_ifspec; + +#ifndef __IDXGISwapChain_INTERFACE_DEFINED__ +#define __IDXGISwapChain_INTERFACE_DEFINED__ + +/* interface IDXGISwapChain */ +/* [unique][local][uuid][object] */ + + +EXTERN_C const IID IID_IDXGISwapChain; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("310d36a0-d2e7-4c0a-aa04-6a9d23b8886a") + IDXGISwapChain : public IDXGIDeviceSubObject + { + public: + virtual HRESULT STDMETHODCALLTYPE Present( + /* [in] */ UINT SyncInterval, + /* [in] */ UINT Flags) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetBuffer( + /* [in] */ UINT Buffer, + /* [annotation][in] */ + __in REFIID riid, + /* [annotation][out][in] */ + __out void **ppSurface) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetFullscreenState( + /* [in] */ BOOL Fullscreen, + /* [annotation][in] */ + __in_opt IDXGIOutput *pTarget) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetFullscreenState( + /* [annotation][out] */ + __out BOOL *pFullscreen, + /* [annotation][out] */ + __out IDXGIOutput **ppTarget) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetDesc( + /* [annotation][out] */ + __out DXGI_SWAP_CHAIN_DESC *pDesc) = 0; + + virtual HRESULT STDMETHODCALLTYPE ResizeBuffers( + /* [in] */ UINT BufferCount, + /* [in] */ UINT Width, + /* [in] */ UINT Height, + /* [in] */ DXGI_FORMAT NewFormat, + /* [in] */ UINT SwapChainFlags) = 0; + + virtual HRESULT STDMETHODCALLTYPE ResizeTarget( + /* [annotation][in] */ + __in const DXGI_MODE_DESC *pNewTargetParameters) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetContainingOutput( + /* [annotation][out] */ + __out IDXGIOutput **ppOutput) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetFrameStatistics( + /* [annotation][out] */ + __out DXGI_FRAME_STATISTICS *pStats) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetLastPresentCount( + /* [annotation][out] */ + __out UINT *pLastPresentCount) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXGISwapChainVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXGISwapChain * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXGISwapChain * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXGISwapChain * This); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + IDXGISwapChain * This, + /* [annotation][in] */ + __in REFGUID Name, + /* [in] */ UINT DataSize, + /* [annotation][in] */ + __in_bcount(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + IDXGISwapChain * This, + /* [annotation][in] */ + __in REFGUID Name, + /* [annotation][in] */ + __in const IUnknown *pUnknown); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + IDXGISwapChain * This, + /* [annotation][in] */ + __in REFGUID Name, + /* [annotation][out][in] */ + __inout UINT *pDataSize, + /* [annotation][out] */ + __out_bcount(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *GetParent )( + IDXGISwapChain * This, + /* [annotation][in] */ + __in REFIID riid, + /* [annotation][retval][out] */ + __out void **ppParent); + + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + IDXGISwapChain * This, + /* [annotation][in] */ + __in REFIID riid, + /* [annotation][retval][out] */ + __out void **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *Present )( + IDXGISwapChain * This, + /* [in] */ UINT SyncInterval, + /* [in] */ UINT Flags); + + HRESULT ( STDMETHODCALLTYPE *GetBuffer )( + IDXGISwapChain * This, + /* [in] */ UINT Buffer, + /* [annotation][in] */ + __in REFIID riid, + /* [annotation][out][in] */ + __out void **ppSurface); + + HRESULT ( STDMETHODCALLTYPE *SetFullscreenState )( + IDXGISwapChain * This, + /* [in] */ BOOL Fullscreen, + /* [annotation][in] */ + __in_opt IDXGIOutput *pTarget); + + HRESULT ( STDMETHODCALLTYPE *GetFullscreenState )( + IDXGISwapChain * This, + /* [annotation][out] */ + __out BOOL *pFullscreen, + /* [annotation][out] */ + __out IDXGIOutput **ppTarget); + + HRESULT ( STDMETHODCALLTYPE *GetDesc )( + IDXGISwapChain * This, + /* [annotation][out] */ + __out DXGI_SWAP_CHAIN_DESC *pDesc); + + HRESULT ( STDMETHODCALLTYPE *ResizeBuffers )( + IDXGISwapChain * This, + /* [in] */ UINT BufferCount, + /* [in] */ UINT Width, + /* [in] */ UINT Height, + /* [in] */ DXGI_FORMAT NewFormat, + /* [in] */ UINT SwapChainFlags); + + HRESULT ( STDMETHODCALLTYPE *ResizeTarget )( + IDXGISwapChain * This, + /* [annotation][in] */ + __in const DXGI_MODE_DESC *pNewTargetParameters); + + HRESULT ( STDMETHODCALLTYPE *GetContainingOutput )( + IDXGISwapChain * This, + /* [annotation][out] */ + __out IDXGIOutput **ppOutput); + + HRESULT ( STDMETHODCALLTYPE *GetFrameStatistics )( + IDXGISwapChain * This, + /* [annotation][out] */ + __out DXGI_FRAME_STATISTICS *pStats); + + HRESULT ( STDMETHODCALLTYPE *GetLastPresentCount )( + IDXGISwapChain * This, + /* [annotation][out] */ + __out UINT *pLastPresentCount); + + END_INTERFACE + } IDXGISwapChainVtbl; + + interface IDXGISwapChain + { + CONST_VTBL struct IDXGISwapChainVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXGISwapChain_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDXGISwapChain_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDXGISwapChain_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDXGISwapChain_SetPrivateData(This,Name,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,Name,DataSize,pData) ) + +#define IDXGISwapChain_SetPrivateDataInterface(This,Name,pUnknown) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,Name,pUnknown) ) + +#define IDXGISwapChain_GetPrivateData(This,Name,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,Name,pDataSize,pData) ) + +#define IDXGISwapChain_GetParent(This,riid,ppParent) \ + ( (This)->lpVtbl -> GetParent(This,riid,ppParent) ) + + +#define IDXGISwapChain_GetDevice(This,riid,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppDevice) ) + + +#define IDXGISwapChain_Present(This,SyncInterval,Flags) \ + ( (This)->lpVtbl -> Present(This,SyncInterval,Flags) ) + +#define IDXGISwapChain_GetBuffer(This,Buffer,riid,ppSurface) \ + ( (This)->lpVtbl -> GetBuffer(This,Buffer,riid,ppSurface) ) + +#define IDXGISwapChain_SetFullscreenState(This,Fullscreen,pTarget) \ + ( (This)->lpVtbl -> SetFullscreenState(This,Fullscreen,pTarget) ) + +#define IDXGISwapChain_GetFullscreenState(This,pFullscreen,ppTarget) \ + ( (This)->lpVtbl -> GetFullscreenState(This,pFullscreen,ppTarget) ) + +#define IDXGISwapChain_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + +#define IDXGISwapChain_ResizeBuffers(This,BufferCount,Width,Height,NewFormat,SwapChainFlags) \ + ( (This)->lpVtbl -> ResizeBuffers(This,BufferCount,Width,Height,NewFormat,SwapChainFlags) ) + +#define IDXGISwapChain_ResizeTarget(This,pNewTargetParameters) \ + ( (This)->lpVtbl -> ResizeTarget(This,pNewTargetParameters) ) + +#define IDXGISwapChain_GetContainingOutput(This,ppOutput) \ + ( (This)->lpVtbl -> GetContainingOutput(This,ppOutput) ) + +#define IDXGISwapChain_GetFrameStatistics(This,pStats) \ + ( (This)->lpVtbl -> GetFrameStatistics(This,pStats) ) + +#define IDXGISwapChain_GetLastPresentCount(This,pLastPresentCount) \ + ( (This)->lpVtbl -> GetLastPresentCount(This,pLastPresentCount) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDXGISwapChain_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_dxgi_0000_0009 */ +/* [local] */ + +#define DXGI_MWA_NO_WINDOW_CHANGES ( 1 << 0 ) +#define DXGI_MWA_NO_ALT_ENTER ( 1 << 1 ) +#define DXGI_MWA_NO_PRINT_SCREEN ( 1 << 2 ) +#define DXGI_MWA_VALID ( 0x7 ) + + +extern RPC_IF_HANDLE __MIDL_itf_dxgi_0000_0009_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_dxgi_0000_0009_v0_0_s_ifspec; + +#ifndef __IDXGIFactory_INTERFACE_DEFINED__ +#define __IDXGIFactory_INTERFACE_DEFINED__ + +/* interface IDXGIFactory */ +/* [unique][local][uuid][object] */ + + +EXTERN_C const IID IID_IDXGIFactory; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("7b7166ec-21c7-44ae-b21a-c9ae321ae369") + IDXGIFactory : public IDXGIObject + { + public: + virtual HRESULT STDMETHODCALLTYPE EnumAdapters( + /* [in] */ UINT Adapter, + /* [annotation][out] */ + __out IDXGIAdapter **ppAdapter) = 0; + + virtual HRESULT STDMETHODCALLTYPE MakeWindowAssociation( + HWND WindowHandle, + UINT Flags) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetWindowAssociation( + /* [annotation][out] */ + __out HWND *pWindowHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateSwapChain( + /* [annotation][in] */ + __in IUnknown *pDevice, + /* [annotation][in] */ + __in DXGI_SWAP_CHAIN_DESC *pDesc, + /* [annotation][out] */ + __out IDXGISwapChain **ppSwapChain) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateSoftwareAdapter( + /* [in] */ HMODULE Module, + /* [annotation][out] */ + __out IDXGIAdapter **ppAdapter) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXGIFactoryVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXGIFactory * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXGIFactory * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXGIFactory * This); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + IDXGIFactory * This, + /* [annotation][in] */ + __in REFGUID Name, + /* [in] */ UINT DataSize, + /* [annotation][in] */ + __in_bcount(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + IDXGIFactory * This, + /* [annotation][in] */ + __in REFGUID Name, + /* [annotation][in] */ + __in const IUnknown *pUnknown); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + IDXGIFactory * This, + /* [annotation][in] */ + __in REFGUID Name, + /* [annotation][out][in] */ + __inout UINT *pDataSize, + /* [annotation][out] */ + __out_bcount(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *GetParent )( + IDXGIFactory * This, + /* [annotation][in] */ + __in REFIID riid, + /* [annotation][retval][out] */ + __out void **ppParent); + + HRESULT ( STDMETHODCALLTYPE *EnumAdapters )( + IDXGIFactory * This, + /* [in] */ UINT Adapter, + /* [annotation][out] */ + __out IDXGIAdapter **ppAdapter); + + HRESULT ( STDMETHODCALLTYPE *MakeWindowAssociation )( + IDXGIFactory * This, + HWND WindowHandle, + UINT Flags); + + HRESULT ( STDMETHODCALLTYPE *GetWindowAssociation )( + IDXGIFactory * This, + /* [annotation][out] */ + __out HWND *pWindowHandle); + + HRESULT ( STDMETHODCALLTYPE *CreateSwapChain )( + IDXGIFactory * This, + /* [annotation][in] */ + __in IUnknown *pDevice, + /* [annotation][in] */ + __in DXGI_SWAP_CHAIN_DESC *pDesc, + /* [annotation][out] */ + __out IDXGISwapChain **ppSwapChain); + + HRESULT ( STDMETHODCALLTYPE *CreateSoftwareAdapter )( + IDXGIFactory * This, + /* [in] */ HMODULE Module, + /* [annotation][out] */ + __out IDXGIAdapter **ppAdapter); + + END_INTERFACE + } IDXGIFactoryVtbl; + + interface IDXGIFactory + { + CONST_VTBL struct IDXGIFactoryVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXGIFactory_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDXGIFactory_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDXGIFactory_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDXGIFactory_SetPrivateData(This,Name,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,Name,DataSize,pData) ) + +#define IDXGIFactory_SetPrivateDataInterface(This,Name,pUnknown) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,Name,pUnknown) ) + +#define IDXGIFactory_GetPrivateData(This,Name,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,Name,pDataSize,pData) ) + +#define IDXGIFactory_GetParent(This,riid,ppParent) \ + ( (This)->lpVtbl -> GetParent(This,riid,ppParent) ) + + +#define IDXGIFactory_EnumAdapters(This,Adapter,ppAdapter) \ + ( (This)->lpVtbl -> EnumAdapters(This,Adapter,ppAdapter) ) + +#define IDXGIFactory_MakeWindowAssociation(This,WindowHandle,Flags) \ + ( (This)->lpVtbl -> MakeWindowAssociation(This,WindowHandle,Flags) ) + +#define IDXGIFactory_GetWindowAssociation(This,pWindowHandle) \ + ( (This)->lpVtbl -> GetWindowAssociation(This,pWindowHandle) ) + +#define IDXGIFactory_CreateSwapChain(This,pDevice,pDesc,ppSwapChain) \ + ( (This)->lpVtbl -> CreateSwapChain(This,pDevice,pDesc,ppSwapChain) ) + +#define IDXGIFactory_CreateSoftwareAdapter(This,Module,ppAdapter) \ + ( (This)->lpVtbl -> CreateSoftwareAdapter(This,Module,ppAdapter) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDXGIFactory_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_dxgi_0000_0010 */ +/* [local] */ + +HRESULT WINAPI CreateDXGIFactory(REFIID riid, void **ppFactory); +HRESULT WINAPI CreateDXGIFactory1(REFIID riid, void **ppFactory); + + +extern RPC_IF_HANDLE __MIDL_itf_dxgi_0000_0010_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_dxgi_0000_0010_v0_0_s_ifspec; + +#ifndef __IDXGIDevice_INTERFACE_DEFINED__ +#define __IDXGIDevice_INTERFACE_DEFINED__ + +/* interface IDXGIDevice */ +/* [unique][local][uuid][object] */ + + +EXTERN_C const IID IID_IDXGIDevice; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("54ec77fa-1377-44e6-8c32-88fd5f44c84c") + IDXGIDevice : public IDXGIObject + { + public: + virtual HRESULT STDMETHODCALLTYPE GetAdapter( + /* [annotation][out] */ + __out IDXGIAdapter **pAdapter) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateSurface( + /* [annotation][in] */ + __in const DXGI_SURFACE_DESC *pDesc, + /* [in] */ UINT NumSurfaces, + /* [in] */ DXGI_USAGE Usage, + /* [annotation][in] */ + __in_opt const DXGI_SHARED_RESOURCE *pSharedResource, + /* [annotation][out] */ + __out IDXGISurface **ppSurface) = 0; + + virtual HRESULT STDMETHODCALLTYPE QueryResourceResidency( + /* [annotation][size_is][in] */ + __in_ecount(NumResources) IUnknown *const *ppResources, + /* [annotation][size_is][out] */ + __out_ecount(NumResources) DXGI_RESIDENCY *pResidencyStatus, + /* [in] */ UINT NumResources) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetGPUThreadPriority( + /* [in] */ INT Priority) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetGPUThreadPriority( + /* [annotation][retval][out] */ + __out INT *pPriority) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXGIDeviceVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXGIDevice * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXGIDevice * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXGIDevice * This); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + IDXGIDevice * This, + /* [annotation][in] */ + __in REFGUID Name, + /* [in] */ UINT DataSize, + /* [annotation][in] */ + __in_bcount(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + IDXGIDevice * This, + /* [annotation][in] */ + __in REFGUID Name, + /* [annotation][in] */ + __in const IUnknown *pUnknown); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + IDXGIDevice * This, + /* [annotation][in] */ + __in REFGUID Name, + /* [annotation][out][in] */ + __inout UINT *pDataSize, + /* [annotation][out] */ + __out_bcount(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *GetParent )( + IDXGIDevice * This, + /* [annotation][in] */ + __in REFIID riid, + /* [annotation][retval][out] */ + __out void **ppParent); + + HRESULT ( STDMETHODCALLTYPE *GetAdapter )( + IDXGIDevice * This, + /* [annotation][out] */ + __out IDXGIAdapter **pAdapter); + + HRESULT ( STDMETHODCALLTYPE *CreateSurface )( + IDXGIDevice * This, + /* [annotation][in] */ + __in const DXGI_SURFACE_DESC *pDesc, + /* [in] */ UINT NumSurfaces, + /* [in] */ DXGI_USAGE Usage, + /* [annotation][in] */ + __in_opt const DXGI_SHARED_RESOURCE *pSharedResource, + /* [annotation][out] */ + __out IDXGISurface **ppSurface); + + HRESULT ( STDMETHODCALLTYPE *QueryResourceResidency )( + IDXGIDevice * This, + /* [annotation][size_is][in] */ + __in_ecount(NumResources) IUnknown *const *ppResources, + /* [annotation][size_is][out] */ + __out_ecount(NumResources) DXGI_RESIDENCY *pResidencyStatus, + /* [in] */ UINT NumResources); + + HRESULT ( STDMETHODCALLTYPE *SetGPUThreadPriority )( + IDXGIDevice * This, + /* [in] */ INT Priority); + + HRESULT ( STDMETHODCALLTYPE *GetGPUThreadPriority )( + IDXGIDevice * This, + /* [annotation][retval][out] */ + __out INT *pPriority); + + END_INTERFACE + } IDXGIDeviceVtbl; + + interface IDXGIDevice + { + CONST_VTBL struct IDXGIDeviceVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXGIDevice_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDXGIDevice_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDXGIDevice_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDXGIDevice_SetPrivateData(This,Name,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,Name,DataSize,pData) ) + +#define IDXGIDevice_SetPrivateDataInterface(This,Name,pUnknown) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,Name,pUnknown) ) + +#define IDXGIDevice_GetPrivateData(This,Name,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,Name,pDataSize,pData) ) + +#define IDXGIDevice_GetParent(This,riid,ppParent) \ + ( (This)->lpVtbl -> GetParent(This,riid,ppParent) ) + + +#define IDXGIDevice_GetAdapter(This,pAdapter) \ + ( (This)->lpVtbl -> GetAdapter(This,pAdapter) ) + +#define IDXGIDevice_CreateSurface(This,pDesc,NumSurfaces,Usage,pSharedResource,ppSurface) \ + ( (This)->lpVtbl -> CreateSurface(This,pDesc,NumSurfaces,Usage,pSharedResource,ppSurface) ) + +#define IDXGIDevice_QueryResourceResidency(This,ppResources,pResidencyStatus,NumResources) \ + ( (This)->lpVtbl -> QueryResourceResidency(This,ppResources,pResidencyStatus,NumResources) ) + +#define IDXGIDevice_SetGPUThreadPriority(This,Priority) \ + ( (This)->lpVtbl -> SetGPUThreadPriority(This,Priority) ) + +#define IDXGIDevice_GetGPUThreadPriority(This,pPriority) \ + ( (This)->lpVtbl -> GetGPUThreadPriority(This,pPriority) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDXGIDevice_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_dxgi_0000_0011 */ +/* [local] */ + +typedef +enum DXGI_ADAPTER_FLAG + { DXGI_ADAPTER_FLAG_NONE = 0, + DXGI_ADAPTER_FLAG_REMOTE = 1, + DXGI_ADAPTER_FLAG_FORCE_DWORD = 0xffffffff + } DXGI_ADAPTER_FLAG; + +typedef struct DXGI_ADAPTER_DESC1 + { + WCHAR Description[ 128 ]; + UINT VendorId; + UINT DeviceId; + UINT SubSysId; + UINT Revision; + SIZE_T DedicatedVideoMemory; + SIZE_T DedicatedSystemMemory; + SIZE_T SharedSystemMemory; + LUID AdapterLuid; + UINT Flags; + } DXGI_ADAPTER_DESC1; + +typedef struct DXGI_DISPLAY_COLOR_SPACE + { + FLOAT PrimaryCoordinates[ 8 ][ 2 ]; + FLOAT WhitePoints[ 16 ][ 2 ]; + } DXGI_DISPLAY_COLOR_SPACE; + + + + +extern RPC_IF_HANDLE __MIDL_itf_dxgi_0000_0011_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_dxgi_0000_0011_v0_0_s_ifspec; + +#ifndef __IDXGIFactory1_INTERFACE_DEFINED__ +#define __IDXGIFactory1_INTERFACE_DEFINED__ + +/* interface IDXGIFactory1 */ +/* [unique][local][uuid][object] */ + + +EXTERN_C const IID IID_IDXGIFactory1; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("770aae78-f26f-4dba-a829-253c83d1b387") + IDXGIFactory1 : public IDXGIFactory + { + public: + virtual HRESULT STDMETHODCALLTYPE EnumAdapters1( + /* [in] */ UINT Adapter, + /* [annotation][out] */ + __out IDXGIAdapter1 **ppAdapter) = 0; + + virtual BOOL STDMETHODCALLTYPE IsCurrent( void) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXGIFactory1Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXGIFactory1 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXGIFactory1 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXGIFactory1 * This); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + IDXGIFactory1 * This, + /* [annotation][in] */ + __in REFGUID Name, + /* [in] */ UINT DataSize, + /* [annotation][in] */ + __in_bcount(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + IDXGIFactory1 * This, + /* [annotation][in] */ + __in REFGUID Name, + /* [annotation][in] */ + __in const IUnknown *pUnknown); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + IDXGIFactory1 * This, + /* [annotation][in] */ + __in REFGUID Name, + /* [annotation][out][in] */ + __inout UINT *pDataSize, + /* [annotation][out] */ + __out_bcount(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *GetParent )( + IDXGIFactory1 * This, + /* [annotation][in] */ + __in REFIID riid, + /* [annotation][retval][out] */ + __out void **ppParent); + + HRESULT ( STDMETHODCALLTYPE *EnumAdapters )( + IDXGIFactory1 * This, + /* [in] */ UINT Adapter, + /* [annotation][out] */ + __out IDXGIAdapter **ppAdapter); + + HRESULT ( STDMETHODCALLTYPE *MakeWindowAssociation )( + IDXGIFactory1 * This, + HWND WindowHandle, + UINT Flags); + + HRESULT ( STDMETHODCALLTYPE *GetWindowAssociation )( + IDXGIFactory1 * This, + /* [annotation][out] */ + __out HWND *pWindowHandle); + + HRESULT ( STDMETHODCALLTYPE *CreateSwapChain )( + IDXGIFactory1 * This, + /* [annotation][in] */ + __in IUnknown *pDevice, + /* [annotation][in] */ + __in DXGI_SWAP_CHAIN_DESC *pDesc, + /* [annotation][out] */ + __out IDXGISwapChain **ppSwapChain); + + HRESULT ( STDMETHODCALLTYPE *CreateSoftwareAdapter )( + IDXGIFactory1 * This, + /* [in] */ HMODULE Module, + /* [annotation][out] */ + __out IDXGIAdapter **ppAdapter); + + HRESULT ( STDMETHODCALLTYPE *EnumAdapters1 )( + IDXGIFactory1 * This, + /* [in] */ UINT Adapter, + /* [annotation][out] */ + __out IDXGIAdapter1 **ppAdapter); + + BOOL ( STDMETHODCALLTYPE *IsCurrent )( + IDXGIFactory1 * This); + + END_INTERFACE + } IDXGIFactory1Vtbl; + + interface IDXGIFactory1 + { + CONST_VTBL struct IDXGIFactory1Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXGIFactory1_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDXGIFactory1_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDXGIFactory1_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDXGIFactory1_SetPrivateData(This,Name,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,Name,DataSize,pData) ) + +#define IDXGIFactory1_SetPrivateDataInterface(This,Name,pUnknown) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,Name,pUnknown) ) + +#define IDXGIFactory1_GetPrivateData(This,Name,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,Name,pDataSize,pData) ) + +#define IDXGIFactory1_GetParent(This,riid,ppParent) \ + ( (This)->lpVtbl -> GetParent(This,riid,ppParent) ) + + +#define IDXGIFactory1_EnumAdapters(This,Adapter,ppAdapter) \ + ( (This)->lpVtbl -> EnumAdapters(This,Adapter,ppAdapter) ) + +#define IDXGIFactory1_MakeWindowAssociation(This,WindowHandle,Flags) \ + ( (This)->lpVtbl -> MakeWindowAssociation(This,WindowHandle,Flags) ) + +#define IDXGIFactory1_GetWindowAssociation(This,pWindowHandle) \ + ( (This)->lpVtbl -> GetWindowAssociation(This,pWindowHandle) ) + +#define IDXGIFactory1_CreateSwapChain(This,pDevice,pDesc,ppSwapChain) \ + ( (This)->lpVtbl -> CreateSwapChain(This,pDevice,pDesc,ppSwapChain) ) + +#define IDXGIFactory1_CreateSoftwareAdapter(This,Module,ppAdapter) \ + ( (This)->lpVtbl -> CreateSoftwareAdapter(This,Module,ppAdapter) ) + + +#define IDXGIFactory1_EnumAdapters1(This,Adapter,ppAdapter) \ + ( (This)->lpVtbl -> EnumAdapters1(This,Adapter,ppAdapter) ) + +#define IDXGIFactory1_IsCurrent(This) \ + ( (This)->lpVtbl -> IsCurrent(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDXGIFactory1_INTERFACE_DEFINED__ */ + + +#ifndef __IDXGIAdapter1_INTERFACE_DEFINED__ +#define __IDXGIAdapter1_INTERFACE_DEFINED__ + +/* interface IDXGIAdapter1 */ +/* [unique][local][uuid][object] */ + + +EXTERN_C const IID IID_IDXGIAdapter1; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("29038f61-3839-4626-91fd-086879011a05") + IDXGIAdapter1 : public IDXGIAdapter + { + public: + virtual HRESULT STDMETHODCALLTYPE GetDesc1( + /* [annotation][out] */ + __out DXGI_ADAPTER_DESC1 *pDesc) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXGIAdapter1Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXGIAdapter1 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXGIAdapter1 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXGIAdapter1 * This); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + IDXGIAdapter1 * This, + /* [annotation][in] */ + __in REFGUID Name, + /* [in] */ UINT DataSize, + /* [annotation][in] */ + __in_bcount(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + IDXGIAdapter1 * This, + /* [annotation][in] */ + __in REFGUID Name, + /* [annotation][in] */ + __in const IUnknown *pUnknown); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + IDXGIAdapter1 * This, + /* [annotation][in] */ + __in REFGUID Name, + /* [annotation][out][in] */ + __inout UINT *pDataSize, + /* [annotation][out] */ + __out_bcount(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *GetParent )( + IDXGIAdapter1 * This, + /* [annotation][in] */ + __in REFIID riid, + /* [annotation][retval][out] */ + __out void **ppParent); + + HRESULT ( STDMETHODCALLTYPE *EnumOutputs )( + IDXGIAdapter1 * This, + /* [in] */ UINT Output, + /* [annotation][out][in] */ + __out IDXGIOutput **ppOutput); + + HRESULT ( STDMETHODCALLTYPE *GetDesc )( + IDXGIAdapter1 * This, + /* [annotation][out] */ + __out DXGI_ADAPTER_DESC *pDesc); + + HRESULT ( STDMETHODCALLTYPE *CheckInterfaceSupport )( + IDXGIAdapter1 * This, + /* [annotation][in] */ + __in REFGUID InterfaceName, + /* [annotation][out] */ + __out LARGE_INTEGER *pUMDVersion); + + HRESULT ( STDMETHODCALLTYPE *GetDesc1 )( + IDXGIAdapter1 * This, + /* [annotation][out] */ + __out DXGI_ADAPTER_DESC1 *pDesc); + + END_INTERFACE + } IDXGIAdapter1Vtbl; + + interface IDXGIAdapter1 + { + CONST_VTBL struct IDXGIAdapter1Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXGIAdapter1_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDXGIAdapter1_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDXGIAdapter1_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDXGIAdapter1_SetPrivateData(This,Name,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,Name,DataSize,pData) ) + +#define IDXGIAdapter1_SetPrivateDataInterface(This,Name,pUnknown) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,Name,pUnknown) ) + +#define IDXGIAdapter1_GetPrivateData(This,Name,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,Name,pDataSize,pData) ) + +#define IDXGIAdapter1_GetParent(This,riid,ppParent) \ + ( (This)->lpVtbl -> GetParent(This,riid,ppParent) ) + + +#define IDXGIAdapter1_EnumOutputs(This,Output,ppOutput) \ + ( (This)->lpVtbl -> EnumOutputs(This,Output,ppOutput) ) + +#define IDXGIAdapter1_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + +#define IDXGIAdapter1_CheckInterfaceSupport(This,InterfaceName,pUMDVersion) \ + ( (This)->lpVtbl -> CheckInterfaceSupport(This,InterfaceName,pUMDVersion) ) + + +#define IDXGIAdapter1_GetDesc1(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc1(This,pDesc) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDXGIAdapter1_INTERFACE_DEFINED__ */ + + +#ifndef __IDXGIDevice1_INTERFACE_DEFINED__ +#define __IDXGIDevice1_INTERFACE_DEFINED__ + +/* interface IDXGIDevice1 */ +/* [unique][local][uuid][object] */ + + +EXTERN_C const IID IID_IDXGIDevice1; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("77db970f-6276-48ba-ba28-070143b4392c") + IDXGIDevice1 : public IDXGIDevice + { + public: + virtual HRESULT STDMETHODCALLTYPE SetMaximumFrameLatency( + /* [in] */ UINT MaxLatency) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetMaximumFrameLatency( + /* [annotation][out] */ + __out UINT *pMaxLatency) = 0; + + }; + +#else /* C style interface */ + + typedef struct IDXGIDevice1Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXGIDevice1 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXGIDevice1 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXGIDevice1 * This); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + IDXGIDevice1 * This, + /* [annotation][in] */ + __in REFGUID Name, + /* [in] */ UINT DataSize, + /* [annotation][in] */ + __in_bcount(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + IDXGIDevice1 * This, + /* [annotation][in] */ + __in REFGUID Name, + /* [annotation][in] */ + __in const IUnknown *pUnknown); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + IDXGIDevice1 * This, + /* [annotation][in] */ + __in REFGUID Name, + /* [annotation][out][in] */ + __inout UINT *pDataSize, + /* [annotation][out] */ + __out_bcount(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *GetParent )( + IDXGIDevice1 * This, + /* [annotation][in] */ + __in REFIID riid, + /* [annotation][retval][out] */ + __out void **ppParent); + + HRESULT ( STDMETHODCALLTYPE *GetAdapter )( + IDXGIDevice1 * This, + /* [annotation][out] */ + __out IDXGIAdapter **pAdapter); + + HRESULT ( STDMETHODCALLTYPE *CreateSurface )( + IDXGIDevice1 * This, + /* [annotation][in] */ + __in const DXGI_SURFACE_DESC *pDesc, + /* [in] */ UINT NumSurfaces, + /* [in] */ DXGI_USAGE Usage, + /* [annotation][in] */ + __in_opt const DXGI_SHARED_RESOURCE *pSharedResource, + /* [annotation][out] */ + __out IDXGISurface **ppSurface); + + HRESULT ( STDMETHODCALLTYPE *QueryResourceResidency )( + IDXGIDevice1 * This, + /* [annotation][size_is][in] */ + __in_ecount(NumResources) IUnknown *const *ppResources, + /* [annotation][size_is][out] */ + __out_ecount(NumResources) DXGI_RESIDENCY *pResidencyStatus, + /* [in] */ UINT NumResources); + + HRESULT ( STDMETHODCALLTYPE *SetGPUThreadPriority )( + IDXGIDevice1 * This, + /* [in] */ INT Priority); + + HRESULT ( STDMETHODCALLTYPE *GetGPUThreadPriority )( + IDXGIDevice1 * This, + /* [annotation][retval][out] */ + __out INT *pPriority); + + HRESULT ( STDMETHODCALLTYPE *SetMaximumFrameLatency )( + IDXGIDevice1 * This, + /* [in] */ UINT MaxLatency); + + HRESULT ( STDMETHODCALLTYPE *GetMaximumFrameLatency )( + IDXGIDevice1 * This, + /* [annotation][out] */ + __out UINT *pMaxLatency); + + END_INTERFACE + } IDXGIDevice1Vtbl; + + interface IDXGIDevice1 + { + CONST_VTBL struct IDXGIDevice1Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXGIDevice1_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDXGIDevice1_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDXGIDevice1_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDXGIDevice1_SetPrivateData(This,Name,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,Name,DataSize,pData) ) + +#define IDXGIDevice1_SetPrivateDataInterface(This,Name,pUnknown) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,Name,pUnknown) ) + +#define IDXGIDevice1_GetPrivateData(This,Name,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,Name,pDataSize,pData) ) + +#define IDXGIDevice1_GetParent(This,riid,ppParent) \ + ( (This)->lpVtbl -> GetParent(This,riid,ppParent) ) + + +#define IDXGIDevice1_GetAdapter(This,pAdapter) \ + ( (This)->lpVtbl -> GetAdapter(This,pAdapter) ) + +#define IDXGIDevice1_CreateSurface(This,pDesc,NumSurfaces,Usage,pSharedResource,ppSurface) \ + ( (This)->lpVtbl -> CreateSurface(This,pDesc,NumSurfaces,Usage,pSharedResource,ppSurface) ) + +#define IDXGIDevice1_QueryResourceResidency(This,ppResources,pResidencyStatus,NumResources) \ + ( (This)->lpVtbl -> QueryResourceResidency(This,ppResources,pResidencyStatus,NumResources) ) + +#define IDXGIDevice1_SetGPUThreadPriority(This,Priority) \ + ( (This)->lpVtbl -> SetGPUThreadPriority(This,Priority) ) + +#define IDXGIDevice1_GetGPUThreadPriority(This,pPriority) \ + ( (This)->lpVtbl -> GetGPUThreadPriority(This,pPriority) ) + + +#define IDXGIDevice1_SetMaximumFrameLatency(This,MaxLatency) \ + ( (This)->lpVtbl -> SetMaximumFrameLatency(This,MaxLatency) ) + +#define IDXGIDevice1_GetMaximumFrameLatency(This,pMaxLatency) \ + ( (This)->lpVtbl -> GetMaximumFrameLatency(This,pMaxLatency) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDXGIDevice1_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_dxgi_0000_0014 */ +/* [local] */ + +#ifdef __cplusplus +#endif /*__cplusplus*/ +DEFINE_GUID(IID_IDXGIObject,0xaec22fb8,0x76f3,0x4639,0x9b,0xe0,0x28,0xeb,0x43,0xa6,0x7a,0x2e); +DEFINE_GUID(IID_IDXGIDeviceSubObject,0x3d3e0379,0xf9de,0x4d58,0xbb,0x6c,0x18,0xd6,0x29,0x92,0xf1,0xa6); +DEFINE_GUID(IID_IDXGIResource,0x035f3ab4,0x482e,0x4e50,0xb4,0x1f,0x8a,0x7f,0x8b,0xd8,0x96,0x0b); +DEFINE_GUID(IID_IDXGIKeyedMutex,0x9d8e1289,0xd7b3,0x465f,0x81,0x26,0x25,0x0e,0x34,0x9a,0xf8,0x5d); +DEFINE_GUID(IID_IDXGISurface,0xcafcb56c,0x6ac3,0x4889,0xbf,0x47,0x9e,0x23,0xbb,0xd2,0x60,0xec); +DEFINE_GUID(IID_IDXGISurface1,0x4AE63092,0x6327,0x4c1b,0x80,0xAE,0xBF,0xE1,0x2E,0xA3,0x2B,0x86); +DEFINE_GUID(IID_IDXGIAdapter,0x2411e7e1,0x12ac,0x4ccf,0xbd,0x14,0x97,0x98,0xe8,0x53,0x4d,0xc0); +DEFINE_GUID(IID_IDXGIOutput,0xae02eedb,0xc735,0x4690,0x8d,0x52,0x5a,0x8d,0xc2,0x02,0x13,0xaa); +DEFINE_GUID(IID_IDXGISwapChain,0x310d36a0,0xd2e7,0x4c0a,0xaa,0x04,0x6a,0x9d,0x23,0xb8,0x88,0x6a); +DEFINE_GUID(IID_IDXGIFactory,0x7b7166ec,0x21c7,0x44ae,0xb2,0x1a,0xc9,0xae,0x32,0x1a,0xe3,0x69); +DEFINE_GUID(IID_IDXGIDevice,0x54ec77fa,0x1377,0x44e6,0x8c,0x32,0x88,0xfd,0x5f,0x44,0xc8,0x4c); +DEFINE_GUID(IID_IDXGIFactory1,0x770aae78,0xf26f,0x4dba,0xa8,0x29,0x25,0x3c,0x83,0xd1,0xb3,0x87); +DEFINE_GUID(IID_IDXGIAdapter1,0x29038f61,0x3839,0x4626,0x91,0xfd,0x08,0x68,0x79,0x01,0x1a,0x05); +DEFINE_GUID(IID_IDXGIDevice1,0x77db970f,0x6276,0x48ba,0xba,0x28,0x07,0x01,0x43,0xb4,0x39,0x2c); + + +extern RPC_IF_HANDLE __MIDL_itf_dxgi_0000_0014_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_dxgi_0000_0014_v0_0_s_ifspec; + +/* Additional Prototypes for ALL interfaces */ + +/* end of Additional Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/MediaClient/MediaClient/directx/include/DXGIFormat.h b/MediaClient/MediaClient/directx/include/DXGIFormat.h new file mode 100644 index 0000000..e84f7f5 --- /dev/null +++ b/MediaClient/MediaClient/directx/include/DXGIFormat.h @@ -0,0 +1,112 @@ + +#ifndef __dxgiformat_h__ +#define __dxgiformat_h__ + +#define DXGI_FORMAT_DEFINED 1 + +typedef enum DXGI_FORMAT +{ + DXGI_FORMAT_UNKNOWN = 0, + DXGI_FORMAT_R32G32B32A32_TYPELESS = 1, + DXGI_FORMAT_R32G32B32A32_FLOAT = 2, + DXGI_FORMAT_R32G32B32A32_UINT = 3, + DXGI_FORMAT_R32G32B32A32_SINT = 4, + DXGI_FORMAT_R32G32B32_TYPELESS = 5, + DXGI_FORMAT_R32G32B32_FLOAT = 6, + DXGI_FORMAT_R32G32B32_UINT = 7, + DXGI_FORMAT_R32G32B32_SINT = 8, + DXGI_FORMAT_R16G16B16A16_TYPELESS = 9, + DXGI_FORMAT_R16G16B16A16_FLOAT = 10, + DXGI_FORMAT_R16G16B16A16_UNORM = 11, + DXGI_FORMAT_R16G16B16A16_UINT = 12, + DXGI_FORMAT_R16G16B16A16_SNORM = 13, + DXGI_FORMAT_R16G16B16A16_SINT = 14, + DXGI_FORMAT_R32G32_TYPELESS = 15, + DXGI_FORMAT_R32G32_FLOAT = 16, + DXGI_FORMAT_R32G32_UINT = 17, + DXGI_FORMAT_R32G32_SINT = 18, + DXGI_FORMAT_R32G8X24_TYPELESS = 19, + DXGI_FORMAT_D32_FLOAT_S8X24_UINT = 20, + DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS = 21, + DXGI_FORMAT_X32_TYPELESS_G8X24_UINT = 22, + DXGI_FORMAT_R10G10B10A2_TYPELESS = 23, + DXGI_FORMAT_R10G10B10A2_UNORM = 24, + DXGI_FORMAT_R10G10B10A2_UINT = 25, + DXGI_FORMAT_R11G11B10_FLOAT = 26, + DXGI_FORMAT_R8G8B8A8_TYPELESS = 27, + DXGI_FORMAT_R8G8B8A8_UNORM = 28, + DXGI_FORMAT_R8G8B8A8_UNORM_SRGB = 29, + DXGI_FORMAT_R8G8B8A8_UINT = 30, + DXGI_FORMAT_R8G8B8A8_SNORM = 31, + DXGI_FORMAT_R8G8B8A8_SINT = 32, + DXGI_FORMAT_R16G16_TYPELESS = 33, + DXGI_FORMAT_R16G16_FLOAT = 34, + DXGI_FORMAT_R16G16_UNORM = 35, + DXGI_FORMAT_R16G16_UINT = 36, + DXGI_FORMAT_R16G16_SNORM = 37, + DXGI_FORMAT_R16G16_SINT = 38, + DXGI_FORMAT_R32_TYPELESS = 39, + DXGI_FORMAT_D32_FLOAT = 40, + DXGI_FORMAT_R32_FLOAT = 41, + DXGI_FORMAT_R32_UINT = 42, + DXGI_FORMAT_R32_SINT = 43, + DXGI_FORMAT_R24G8_TYPELESS = 44, + DXGI_FORMAT_D24_UNORM_S8_UINT = 45, + DXGI_FORMAT_R24_UNORM_X8_TYPELESS = 46, + DXGI_FORMAT_X24_TYPELESS_G8_UINT = 47, + DXGI_FORMAT_R8G8_TYPELESS = 48, + DXGI_FORMAT_R8G8_UNORM = 49, + DXGI_FORMAT_R8G8_UINT = 50, + DXGI_FORMAT_R8G8_SNORM = 51, + DXGI_FORMAT_R8G8_SINT = 52, + DXGI_FORMAT_R16_TYPELESS = 53, + DXGI_FORMAT_R16_FLOAT = 54, + DXGI_FORMAT_D16_UNORM = 55, + DXGI_FORMAT_R16_UNORM = 56, + DXGI_FORMAT_R16_UINT = 57, + DXGI_FORMAT_R16_SNORM = 58, + DXGI_FORMAT_R16_SINT = 59, + DXGI_FORMAT_R8_TYPELESS = 60, + DXGI_FORMAT_R8_UNORM = 61, + DXGI_FORMAT_R8_UINT = 62, + DXGI_FORMAT_R8_SNORM = 63, + DXGI_FORMAT_R8_SINT = 64, + DXGI_FORMAT_A8_UNORM = 65, + DXGI_FORMAT_R1_UNORM = 66, + DXGI_FORMAT_R9G9B9E5_SHAREDEXP = 67, + DXGI_FORMAT_R8G8_B8G8_UNORM = 68, + DXGI_FORMAT_G8R8_G8B8_UNORM = 69, + DXGI_FORMAT_BC1_TYPELESS = 70, + DXGI_FORMAT_BC1_UNORM = 71, + DXGI_FORMAT_BC1_UNORM_SRGB = 72, + DXGI_FORMAT_BC2_TYPELESS = 73, + DXGI_FORMAT_BC2_UNORM = 74, + DXGI_FORMAT_BC2_UNORM_SRGB = 75, + DXGI_FORMAT_BC3_TYPELESS = 76, + DXGI_FORMAT_BC3_UNORM = 77, + DXGI_FORMAT_BC3_UNORM_SRGB = 78, + DXGI_FORMAT_BC4_TYPELESS = 79, + DXGI_FORMAT_BC4_UNORM = 80, + DXGI_FORMAT_BC4_SNORM = 81, + DXGI_FORMAT_BC5_TYPELESS = 82, + DXGI_FORMAT_BC5_UNORM = 83, + DXGI_FORMAT_BC5_SNORM = 84, + DXGI_FORMAT_B5G6R5_UNORM = 85, + DXGI_FORMAT_B5G5R5A1_UNORM = 86, + DXGI_FORMAT_B8G8R8A8_UNORM = 87, + DXGI_FORMAT_B8G8R8X8_UNORM = 88, + DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM = 89, + DXGI_FORMAT_B8G8R8A8_TYPELESS = 90, + DXGI_FORMAT_B8G8R8A8_UNORM_SRGB = 91, + DXGI_FORMAT_B8G8R8X8_TYPELESS = 92, + DXGI_FORMAT_B8G8R8X8_UNORM_SRGB = 93, + DXGI_FORMAT_BC6H_TYPELESS = 94, + DXGI_FORMAT_BC6H_UF16 = 95, + DXGI_FORMAT_BC6H_SF16 = 96, + DXGI_FORMAT_BC7_TYPELESS = 97, + DXGI_FORMAT_BC7_UNORM = 98, + DXGI_FORMAT_BC7_UNORM_SRGB = 99, + DXGI_FORMAT_FORCE_UINT = 0xffffffff +} DXGI_FORMAT; + +#endif // __dxgiformat_h__ diff --git a/MediaClient/MediaClient/directx/include/DXGIType.h b/MediaClient/MediaClient/directx/include/DXGIType.h new file mode 100644 index 0000000..89dd86a --- /dev/null +++ b/MediaClient/MediaClient/directx/include/DXGIType.h @@ -0,0 +1,123 @@ + +#ifndef __dxgitype_h__ +#define __dxgitype_h__ + + +#include "dxgiformat.h" + +#define _FACDXGI 0x87a +#define MAKE_DXGI_HRESULT(code) MAKE_HRESULT(1, _FACDXGI, code) +#define MAKE_DXGI_STATUS(code) MAKE_HRESULT(0, _FACDXGI, code) + +#define DXGI_STATUS_OCCLUDED MAKE_DXGI_STATUS(1) +#define DXGI_STATUS_CLIPPED MAKE_DXGI_STATUS(2) +#define DXGI_STATUS_NO_REDIRECTION MAKE_DXGI_STATUS(4) +#define DXGI_STATUS_NO_DESKTOP_ACCESS MAKE_DXGI_STATUS(5) +#define DXGI_STATUS_GRAPHICS_VIDPN_SOURCE_IN_USE MAKE_DXGI_STATUS(6) +#define DXGI_STATUS_MODE_CHANGED MAKE_DXGI_STATUS(7) +#define DXGI_STATUS_MODE_CHANGE_IN_PROGRESS MAKE_DXGI_STATUS(8) + + +#define DXGI_ERROR_INVALID_CALL MAKE_DXGI_HRESULT(1) +#define DXGI_ERROR_NOT_FOUND MAKE_DXGI_HRESULT(2) +#define DXGI_ERROR_MORE_DATA MAKE_DXGI_HRESULT(3) +#define DXGI_ERROR_UNSUPPORTED MAKE_DXGI_HRESULT(4) +#define DXGI_ERROR_DEVICE_REMOVED MAKE_DXGI_HRESULT(5) +#define DXGI_ERROR_DEVICE_HUNG MAKE_DXGI_HRESULT(6) +#define DXGI_ERROR_DEVICE_RESET MAKE_DXGI_HRESULT(7) +#define DXGI_ERROR_WAS_STILL_DRAWING MAKE_DXGI_HRESULT(10) +#define DXGI_ERROR_FRAME_STATISTICS_DISJOINT MAKE_DXGI_HRESULT(11) +#define DXGI_ERROR_GRAPHICS_VIDPN_SOURCE_IN_USE MAKE_DXGI_HRESULT(12) +#define DXGI_ERROR_DRIVER_INTERNAL_ERROR MAKE_DXGI_HRESULT(32) +#define DXGI_ERROR_NONEXCLUSIVE MAKE_DXGI_HRESULT(33) +#define DXGI_ERROR_NOT_CURRENTLY_AVAILABLE MAKE_DXGI_HRESULT(34) +#define DXGI_ERROR_REMOTE_CLIENT_DISCONNECTED MAKE_DXGI_HRESULT(35) +#define DXGI_ERROR_REMOTE_OUTOFMEMORY MAKE_DXGI_HRESULT(36) + + + +#define DXGI_CPU_ACCESS_NONE ( 0 ) +#define DXGI_CPU_ACCESS_DYNAMIC ( 1 ) +#define DXGI_CPU_ACCESS_READ_WRITE ( 2 ) +#define DXGI_CPU_ACCESS_SCRATCH ( 3 ) +#define DXGI_CPU_ACCESS_FIELD 15 + +#define DXGI_USAGE_SHADER_INPUT ( 1L << (0 + 4) ) +#define DXGI_USAGE_RENDER_TARGET_OUTPUT ( 1L << (1 + 4) ) +#define DXGI_USAGE_BACK_BUFFER ( 1L << (2 + 4) ) +#define DXGI_USAGE_SHARED ( 1L << (3 + 4) ) +#define DXGI_USAGE_READ_ONLY ( 1L << (4 + 4) ) +#define DXGI_USAGE_DISCARD_ON_PRESENT ( 1L << (5 + 4) ) +#define DXGI_USAGE_UNORDERED_ACCESS ( 1L << (6 + 4) ) + +typedef struct DXGI_RGB +{ + float Red; + float Green; + float Blue; +} DXGI_RGB; + +typedef struct DXGI_GAMMA_CONTROL +{ + DXGI_RGB Scale; + DXGI_RGB Offset; + DXGI_RGB GammaCurve[ 1025 ]; +} DXGI_GAMMA_CONTROL; + +typedef struct DXGI_GAMMA_CONTROL_CAPABILITIES +{ + BOOL ScaleAndOffsetSupported; + float MaxConvertedValue; + float MinConvertedValue; + UINT NumGammaControlPoints; + float ControlPointPositions[1025]; +} DXGI_GAMMA_CONTROL_CAPABILITIES; + +typedef struct DXGI_RATIONAL +{ + UINT Numerator; + UINT Denominator; +} DXGI_RATIONAL; + +typedef enum DXGI_MODE_SCANLINE_ORDER +{ + DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED = 0, + DXGI_MODE_SCANLINE_ORDER_PROGRESSIVE = 1, + DXGI_MODE_SCANLINE_ORDER_UPPER_FIELD_FIRST = 2, + DXGI_MODE_SCANLINE_ORDER_LOWER_FIELD_FIRST = 3 +} DXGI_MODE_SCANLINE_ORDER; + +typedef enum DXGI_MODE_SCALING +{ + DXGI_MODE_SCALING_UNSPECIFIED = 0, + DXGI_MODE_SCALING_CENTERED = 1, + DXGI_MODE_SCALING_STRETCHED = 2 +} DXGI_MODE_SCALING; + +typedef enum DXGI_MODE_ROTATION +{ + DXGI_MODE_ROTATION_UNSPECIFIED = 0, + DXGI_MODE_ROTATION_IDENTITY = 1, + DXGI_MODE_ROTATION_ROTATE90 = 2, + DXGI_MODE_ROTATION_ROTATE180 = 3, + DXGI_MODE_ROTATION_ROTATE270 = 4 +} DXGI_MODE_ROTATION; + +typedef struct DXGI_MODE_DESC +{ + UINT Width; + UINT Height; + DXGI_RATIONAL RefreshRate; + DXGI_FORMAT Format; + DXGI_MODE_SCANLINE_ORDER ScanlineOrdering; + DXGI_MODE_SCALING Scaling; +} DXGI_MODE_DESC; + +typedef struct DXGI_SAMPLE_DESC +{ + UINT Count; + UINT Quality; +} DXGI_SAMPLE_DESC; + +#endif // __dxgitype_h__ + diff --git a/MediaClient/MediaClient/directx/include/Dcommon.h b/MediaClient/MediaClient/directx/include/Dcommon.h new file mode 100644 index 0000000..4ecc5c1 --- /dev/null +++ b/MediaClient/MediaClient/directx/include/Dcommon.h @@ -0,0 +1,65 @@ +//+-------------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// Abstract: +// Public API definitions for DWrite and D2D +// +//---------------------------------------------------------------------------- + +#ifndef DCOMMON_H_INCLUDED +#define DCOMMON_H_INCLUDED + +// +//These macros are defined in the Windows 7 SDK, however to enable development using the technical preview, +//they are included here temporarily. +// +#ifndef DEFINE_ENUM_FLAG_OPERATORS +#define DEFINE_ENUM_FLAG_OPERATORS(ENUMTYPE) \ +extern "C++" { \ +inline ENUMTYPE operator | (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((int)a) | ((int)b)); } \ +inline ENUMTYPE &operator |= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((int &)a) |= ((int)b)); } \ +inline ENUMTYPE operator & (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((int)a) & ((int)b)); } \ +inline ENUMTYPE &operator &= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((int &)a) &= ((int)b)); } \ +inline ENUMTYPE operator ~ (ENUMTYPE a) { return ENUMTYPE(~((int)a)); } \ +inline ENUMTYPE operator ^ (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((int)a) ^ ((int)b)); } \ +inline ENUMTYPE &operator ^= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((int &)a) ^= ((int)b)); } \ +} +#endif + +#ifndef __field_ecount_opt +#define __field_ecount_opt(x) +#endif + +#ifndef __range +#define __range(x,y) +#endif + +#ifndef __field_ecount +#define __field_ecount(x) +#endif + +/// +/// The measuring method used for text layout. +/// +typedef enum DWRITE_MEASURING_MODE +{ + /// + /// Text is measured using glyph ideal metrics whose values are independent to the current display resolution. + /// + DWRITE_MEASURING_MODE_NATURAL, + + /// + /// Text is measured using glyph display compatible metrics whose values tuned for the current display resolution. + /// + DWRITE_MEASURING_MODE_GDI_CLASSIC, + + /// + /// Text is measured using the same glyph display metrics as text measured by GDI using a font + /// created with CLEARTYPE_NATURAL_QUALITY. + /// + DWRITE_MEASURING_MODE_GDI_NATURAL + +} DWRITE_MEASURING_MODE; + +#endif /* DCOMMON_H_INCLUDED */ diff --git a/MediaClient/MediaClient/directx/include/DxErr.h b/MediaClient/MediaClient/directx/include/DxErr.h new file mode 100644 index 0000000..2bd7591 --- /dev/null +++ b/MediaClient/MediaClient/directx/include/DxErr.h @@ -0,0 +1,99 @@ +/*==========================================================================; + * + * + * File: dxerr.h + * Content: DirectX Error Library Include File + * + ****************************************************************************/ + +#ifndef _DXERR_H_ +#define _DXERR_H_ + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + +// +// DXGetErrorString +// +// Desc: Converts a DirectX HRESULT to a string +// +// Args: HRESULT hr Can be any error code from +// XACT XAUDIO2 XAPO XINPUT DXGI D3D10 D3DX10 D3D9 D3DX9 DDRAW DSOUND DINPUT DSHOW +// +// Return: Converted string +// +const char* WINAPI DXGetErrorStringA(__in HRESULT hr); +const WCHAR* WINAPI DXGetErrorStringW(__in HRESULT hr); + +#ifdef UNICODE +#define DXGetErrorString DXGetErrorStringW +#else +#define DXGetErrorString DXGetErrorStringA +#endif + + +// +// DXGetErrorDescription +// +// Desc: Returns a string description of a DirectX HRESULT +// +// Args: HRESULT hr Can be any error code from +// XACT XAUDIO2 XAPO XINPUT DXGI D3D10 D3DX10 D3D9 D3DX9 DDRAW DSOUND DINPUT DSHOW +// +// Return: String description +// +const char* WINAPI DXGetErrorDescriptionA(__in HRESULT hr); +const WCHAR* WINAPI DXGetErrorDescriptionW(__in HRESULT hr); + +#ifdef UNICODE + #define DXGetErrorDescription DXGetErrorDescriptionW +#else + #define DXGetErrorDescription DXGetErrorDescriptionA +#endif + + +// +// DXTrace +// +// Desc: Outputs a formatted error message to the debug stream +// +// Args: CHAR* strFile The current file, typically passed in using the +// __FILE__ macro. +// DWORD dwLine The current line number, typically passed in using the +// __LINE__ macro. +// HRESULT hr An HRESULT that will be traced to the debug stream. +// CHAR* strMsg A string that will be traced to the debug stream (may be NULL) +// BOOL bPopMsgBox If TRUE, then a message box will popup also containing the passed info. +// +// Return: The hr that was passed in. +// +HRESULT WINAPI DXTraceA( __in_z const char* strFile, __in DWORD dwLine, __in HRESULT hr, __in_z_opt const char* strMsg, __in BOOL bPopMsgBox ); +HRESULT WINAPI DXTraceW( __in_z const char* strFile, __in DWORD dwLine, __in HRESULT hr, __in_z_opt const WCHAR* strMsg, __in BOOL bPopMsgBox ); + +#ifdef UNICODE +#define DXTrace DXTraceW +#else +#define DXTrace DXTraceA +#endif + + +// +// Helper macros +// +#if defined(DEBUG) | defined(_DEBUG) +#define DXTRACE_MSG(str) DXTrace( __FILE__, (DWORD)__LINE__, 0, str, FALSE ) +#define DXTRACE_ERR(str,hr) DXTrace( __FILE__, (DWORD)__LINE__, hr, str, FALSE ) +#define DXTRACE_ERR_MSGBOX(str,hr) DXTrace( __FILE__, (DWORD)__LINE__, hr, str, TRUE ) +#else +#define DXTRACE_MSG(str) (0L) +#define DXTRACE_ERR(str,hr) (hr) +#define DXTRACE_ERR_MSGBOX(str,hr) (hr) +#endif + + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif // _DXERR_H_ diff --git a/MediaClient/MediaClient/directx/include/PIXPlugin.h b/MediaClient/MediaClient/directx/include/PIXPlugin.h new file mode 100644 index 0000000..9c249af --- /dev/null +++ b/MediaClient/MediaClient/directx/include/PIXPlugin.h @@ -0,0 +1,120 @@ +//================================================================================================== +// PIXPlugin.h +// +// Microsoft PIX Plugin Header +// +// Copyright (c) Microsoft Corporation, All rights reserved +//================================================================================================== + +#pragma once + +#ifdef __cplusplus +extern "C" +{ +#endif + + +//================================================================================================== +// PIX_PLUGIN_SYSTEM_VERSION - Indicates version of the plugin interface the plugin is built with. +//================================================================================================== +#define PIX_PLUGIN_SYSTEM_VERSION 0x101 + + +//================================================================================================== +// PIXCOUNTERID - A unique identifier for each PIX plugin counter. +//================================================================================================== +typedef int PIXCOUNTERID; + + +//================================================================================================== +// PIXCOUNTERDATATYPE - Indicates what type of data the counter produces. +//================================================================================================== +enum PIXCOUNTERDATATYPE +{ + PCDT_RESERVED, + PCDT_FLOAT, + PCDT_INT, + PCDT_INT64, + PCDT_STRING, +}; + + +//================================================================================================== +// PIXPLUGININFO - This structure is filled out by PIXGetPluginInfo and passed back to PIX. +//================================================================================================== +struct PIXPLUGININFO +{ + // Filled in by caller: + HINSTANCE hinst; + + // Filled in by PIXGetPluginInfo: + WCHAR* pstrPluginName; // Name of plugin + int iPluginVersion; // Version of this particular plugin + int iPluginSystemVersion; // Version of PIX's plugin system this plugin was designed for +}; + + +//================================================================================================== +// PIXCOUNTERINFO - This structure is filled out by PIXGetCounterInfo and passed back to PIX +// to allow PIX to determine information about the counters in the plugin. +//================================================================================================== +struct PIXCOUNTERINFO +{ + PIXCOUNTERID counterID; // Used to uniquely ID this counter + WCHAR* pstrName; // String name of the counter + PIXCOUNTERDATATYPE pcdtDataType; // Data type returned by this counter +}; + + +//================================================================================================== +// PIXGetPluginInfo - This returns basic information about this plugin to PIX. +//================================================================================================== +BOOL WINAPI PIXGetPluginInfo( PIXPLUGININFO* pPIXPluginInfo ); + + +//================================================================================================== +// PIXGetCounterInfo - This returns an array of PIXCOUNTERINFO structs to PIX. +// These PIXCOUNTERINFOs allow PIX to enumerate the counters contained +// in this plugin. +//================================================================================================== +BOOL WINAPI PIXGetCounterInfo( DWORD* pdwReturnCounters, PIXCOUNTERINFO** ppCounterInfoList ); + + +//================================================================================================== +// PIXGetCounterDesc - This is called by PIX to request a description of the indicated counter. +//================================================================================================== +BOOL WINAPI PIXGetCounterDesc( PIXCOUNTERID id, WCHAR** ppstrCounterDesc ); + + +//================================================================================================== +// PIXBeginExperiment - This called by PIX once per counter when instrumentation starts. +//================================================================================================== +BOOL WINAPI PIXBeginExperiment( PIXCOUNTERID id, const WCHAR* pstrApplication ); + + +//================================================================================================== +// PIXEndFrame - This is called by PIX once per counter at the end of each frame to gather the +// counter value for that frame. Note that the pointer to the return data must +// continue to point to valid counter data until the next call to PIXEndFrame (or +// PIXEndExperiment) for the same counter. So do not set *ppReturnData to the same +// pointer for multiple counters, or point to a local variable that will go out of +// scope. See the sample PIX plugin for an example of how to structure a plugin +// properly. +//================================================================================================== +BOOL WINAPI PIXEndFrame( PIXCOUNTERID id, UINT iFrame, DWORD* pdwReturnBytes, BYTE** ppReturnData ); + + +//================================================================================================== +// PIXEndExperiment - This is called by PIX once per counter when instrumentation ends. +//================================================================================================== +BOOL WINAPI PIXEndExperiment( PIXCOUNTERID id ); + + +#ifdef __cplusplus +}; +#endif + +//================================================================================================== +// eof: PIXPlugin.h +//================================================================================================== + diff --git a/MediaClient/MediaClient/directx/include/X3DAudio.h b/MediaClient/MediaClient/directx/include/X3DAudio.h new file mode 100644 index 0000000..c25d98f --- /dev/null +++ b/MediaClient/MediaClient/directx/include/X3DAudio.h @@ -0,0 +1,316 @@ +/*-========================================================================-_ + | - X3DAUDIO - | + | Copyright (c) Microsoft Corporation. All rights reserved. | + |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| + |PROJECT: X3DAudio MODEL: Unmanaged User-mode | + |VERSION: 1.7 EXCEPT: No Exceptions | + |CLASS: N / A MINREQ: WinXP, Xbox360 | + |BASE: N / A DIALECT: MSC++ 14.00 | + |>------------------------------------------------------------------------<| + | DUTY: Cross-platform stand-alone 3D audio math library | + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ + NOTES: + 1. USE THE DEBUG DLL TO ENABLE PARAMETER VALIDATION VIA ASSERTS! + Here's how: + Copy X3DAudioDX_X.dll to where your application exists. + The debug DLL can be found under %WINDIR%\system32. + Rename X3DAudioDX_X.dll to X3DAudioX_X.dll to use the debug version. + + Only parameters required by DSP settings being calculated as + stipulated by the calculation control flags are validated. + + 2. Definition of terms: + LFE: Low Frequency Effect -- always omnidirectional. + LPF: Low Pass Filter, divided into two classifications: + Direct -- Applied to the direct signal path, + used for obstruction/occlusion effects. + Reverb -- Applied to the reverb signal path, + used for occlusion effects only. + + 3. Volume level is expressed as a linear amplitude scaler: + 1.0f represents no attenuation applied to the original signal, + 0.5f denotes an attenuation of 6dB, and 0.0f results in silence. + Amplification (volume > 1.0f) is also allowed, and is not clamped. + + LPF values range from 1.0f representing all frequencies pass through, + to 0.0f which results in silence as all frequencies are filtered out. + + 4. X3DAudio uses a left-handed Cartesian coordinate system with values + on the x-axis increasing from left to right, on the y-axis from + bottom to top, and on the z-axis from near to far. + Azimuths are measured clockwise from a given reference direction. + + Distance measurement is with respect to user-defined world units. + Applications may provide coordinates using any system of measure + as all non-normalized calculations are scale invariant, with such + operations natively occurring in user-defined world unit space. + Metric constants are supplied only as a convenience. + Distance is calculated using the Euclidean norm formula. + + 5. Only real values are permissible with functions using 32-bit + float parameters -- NAN and infinite values are not accepted. + All computation occurs in 32-bit precision mode. */ + +#pragma once +//---------------------------------------------------// +#include // general windows types +#if defined(_XBOX) + #include +#endif +#include // for D3DVECTOR + +// speaker geometry configuration flags, specifies assignment of channels to speaker positions, defined as per WAVEFORMATEXTENSIBLE.dwChannelMask +#if !defined(_SPEAKER_POSITIONS_) + #define _SPEAKER_POSITIONS_ + #define SPEAKER_FRONT_LEFT 0x00000001 + #define SPEAKER_FRONT_RIGHT 0x00000002 + #define SPEAKER_FRONT_CENTER 0x00000004 + #define SPEAKER_LOW_FREQUENCY 0x00000008 + #define SPEAKER_BACK_LEFT 0x00000010 + #define SPEAKER_BACK_RIGHT 0x00000020 + #define SPEAKER_FRONT_LEFT_OF_CENTER 0x00000040 + #define SPEAKER_FRONT_RIGHT_OF_CENTER 0x00000080 + #define SPEAKER_BACK_CENTER 0x00000100 + #define SPEAKER_SIDE_LEFT 0x00000200 + #define SPEAKER_SIDE_RIGHT 0x00000400 + #define SPEAKER_TOP_CENTER 0x00000800 + #define SPEAKER_TOP_FRONT_LEFT 0x00001000 + #define SPEAKER_TOP_FRONT_CENTER 0x00002000 + #define SPEAKER_TOP_FRONT_RIGHT 0x00004000 + #define SPEAKER_TOP_BACK_LEFT 0x00008000 + #define SPEAKER_TOP_BACK_CENTER 0x00010000 + #define SPEAKER_TOP_BACK_RIGHT 0x00020000 + #define SPEAKER_RESERVED 0x7FFC0000 // bit mask locations reserved for future use + #define SPEAKER_ALL 0x80000000 // used to specify that any possible permutation of speaker configurations +#endif + +// standard speaker geometry configurations, used with X3DAudioInitialize +#if !defined(SPEAKER_MONO) + #define SPEAKER_MONO SPEAKER_FRONT_CENTER + #define SPEAKER_STEREO (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT) + #define SPEAKER_2POINT1 (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_LOW_FREQUENCY) + #define SPEAKER_SURROUND (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_BACK_CENTER) + #define SPEAKER_QUAD (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT) + #define SPEAKER_4POINT1 (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_LOW_FREQUENCY | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT) + #define SPEAKER_5POINT1 (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT) + #define SPEAKER_7POINT1 (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT | SPEAKER_FRONT_LEFT_OF_CENTER | SPEAKER_FRONT_RIGHT_OF_CENTER) + #define SPEAKER_5POINT1_SURROUND (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | SPEAKER_SIDE_LEFT | SPEAKER_SIDE_RIGHT) + #define SPEAKER_7POINT1_SURROUND (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT | SPEAKER_SIDE_LEFT | SPEAKER_SIDE_RIGHT) +#endif + +// Xbox360 speaker geometry configuration, used with X3DAudioInitialize +#if defined(_XBOX) + #define SPEAKER_XBOX SPEAKER_5POINT1 +#endif + + +// size of instance handle in bytes +#define X3DAUDIO_HANDLE_BYTESIZE 20 + +// float math constants +#define X3DAUDIO_PI 3.141592654f +#define X3DAUDIO_2PI 6.283185307f + +// speed of sound in meters per second for dry air at approximately 20C, used with X3DAudioInitialize +#define X3DAUDIO_SPEED_OF_SOUND 343.5f + +// calculation control flags, used with X3DAudioCalculate +#define X3DAUDIO_CALCULATE_MATRIX 0x00000001 // enable matrix coefficient table calculation +#define X3DAUDIO_CALCULATE_DELAY 0x00000002 // enable delay time array calculation (stereo final mix only) +#define X3DAUDIO_CALCULATE_LPF_DIRECT 0x00000004 // enable LPF direct-path coefficient calculation +#define X3DAUDIO_CALCULATE_LPF_REVERB 0x00000008 // enable LPF reverb-path coefficient calculation +#define X3DAUDIO_CALCULATE_REVERB 0x00000010 // enable reverb send level calculation +#define X3DAUDIO_CALCULATE_DOPPLER 0x00000020 // enable doppler shift factor calculation +#define X3DAUDIO_CALCULATE_EMITTER_ANGLE 0x00000040 // enable emitter-to-listener interior angle calculation + +#define X3DAUDIO_CALCULATE_ZEROCENTER 0x00010000 // do not position to front center speaker, signal positioned to remaining speakers instead, front center destination channel will be zero in returned matrix coefficient table, valid only for matrix calculations with final mix formats that have a front center channel +#define X3DAUDIO_CALCULATE_REDIRECT_TO_LFE 0x00020000 // apply equal mix of all source channels to LFE destination channel, valid only for matrix calculations with sources that have no LFE channel and final mix formats that have an LFE channel + + +//-----------------------------------------------------// +#pragma pack(push, 1) // set packing alignment to ensure consistency across arbitrary build environments + + +// primitive types +typedef float FLOAT32; // 32-bit IEEE float +typedef D3DVECTOR X3DAUDIO_VECTOR; // float 3D vector + +// instance handle of precalculated constants +typedef BYTE X3DAUDIO_HANDLE[X3DAUDIO_HANDLE_BYTESIZE]; + + +// Distance curve point: +// Defines a DSP setting at a given normalized distance. +typedef struct X3DAUDIO_DISTANCE_CURVE_POINT +{ + FLOAT32 Distance; // normalized distance, must be within [0.0f, 1.0f] + FLOAT32 DSPSetting; // DSP setting +} X3DAUDIO_DISTANCE_CURVE_POINT, *LPX3DAUDIO_DISTANCE_CURVE_POINT; + +// Distance curve: +// A piecewise curve made up of linear segments used to +// define DSP behaviour with respect to normalized distance. +// +// Note that curve point distances are normalized within [0.0f, 1.0f]. +// X3DAUDIO_EMITTER.CurveDistanceScaler must be used to scale the +// normalized distances to user-defined world units. +// For distances beyond CurveDistanceScaler * 1.0f, +// pPoints[PointCount-1].DSPSetting is used as the DSP setting. +// +// All distance curve spans must be such that: +// pPoints[k-1].DSPSetting + ((pPoints[k].DSPSetting-pPoints[k-1].DSPSetting) / (pPoints[k].Distance-pPoints[k-1].Distance)) * (pPoints[k].Distance-pPoints[k-1].Distance) != NAN or infinite values +// For all points in the distance curve where 1 <= k < PointCount. +typedef struct X3DAUDIO_DISTANCE_CURVE +{ + X3DAUDIO_DISTANCE_CURVE_POINT* pPoints; // distance curve point array, must have at least PointCount elements with no duplicates and be sorted in ascending order with respect to Distance + UINT32 PointCount; // number of distance curve points, must be >= 2 as all distance curves must have at least two endpoints, defining DSP settings at 0.0f and 1.0f normalized distance +} X3DAUDIO_DISTANCE_CURVE, *LPX3DAUDIO_DISTANCE_CURVE; +static const X3DAUDIO_DISTANCE_CURVE_POINT X3DAudioDefault_LinearCurvePoints[2] = { 0.0f, 1.0f, 1.0f, 0.0f }; +static const X3DAUDIO_DISTANCE_CURVE X3DAudioDefault_LinearCurve = { (X3DAUDIO_DISTANCE_CURVE_POINT*)&X3DAudioDefault_LinearCurvePoints[0], 2 }; + +// Cone: +// Specifies directionality for a listener or single-channel emitter by +// modifying DSP behaviour with respect to its front orientation. +// This is modeled using two sound cones: an inner cone and an outer cone. +// On/within the inner cone, DSP settings are scaled by the inner values. +// On/beyond the outer cone, DSP settings are scaled by the outer values. +// If on both the cones, DSP settings are scaled by the inner values only. +// Between the two cones, the scaler is linearly interpolated between the +// inner and outer values. Set both cone angles to 0 or X3DAUDIO_2PI for +// omnidirectionality using only the outer or inner values respectively. +typedef struct X3DAUDIO_CONE +{ + FLOAT32 InnerAngle; // inner cone angle in radians, must be within [0.0f, X3DAUDIO_2PI] + FLOAT32 OuterAngle; // outer cone angle in radians, must be within [InnerAngle, X3DAUDIO_2PI] + + FLOAT32 InnerVolume; // volume level scaler on/within inner cone, used only for matrix calculations, must be within [0.0f, 2.0f] when used + FLOAT32 OuterVolume; // volume level scaler on/beyond outer cone, used only for matrix calculations, must be within [0.0f, 2.0f] when used + FLOAT32 InnerLPF; // LPF (both direct and reverb paths) coefficient subtrahend on/within inner cone, used only for LPF (both direct and reverb paths) calculations, must be within [0.0f, 1.0f] when used + FLOAT32 OuterLPF; // LPF (both direct and reverb paths) coefficient subtrahend on/beyond outer cone, used only for LPF (both direct and reverb paths) calculations, must be within [0.0f, 1.0f] when used + FLOAT32 InnerReverb; // reverb send level scaler on/within inner cone, used only for reverb calculations, must be within [0.0f, 2.0f] when used + FLOAT32 OuterReverb; // reverb send level scaler on/beyond outer cone, used only for reverb calculations, must be within [0.0f, 2.0f] when used +} X3DAUDIO_CONE, *LPX3DAUDIO_CONE; +static const X3DAUDIO_CONE X3DAudioDefault_DirectionalCone = { X3DAUDIO_PI/2, X3DAUDIO_PI, 1.0f, 0.708f, 0.0f, 0.25f, 0.708f, 1.0f }; + + +// Listener: +// Defines a point of 3D audio reception. +// +// The cone is directed by the listener's front orientation. +typedef struct X3DAUDIO_LISTENER +{ + X3DAUDIO_VECTOR OrientFront; // orientation of front direction, used only for matrix and delay calculations or listeners with cones for matrix, LPF (both direct and reverb paths), and reverb calculations, must be normalized when used + X3DAUDIO_VECTOR OrientTop; // orientation of top direction, used only for matrix and delay calculations, must be orthonormal with OrientFront when used + + X3DAUDIO_VECTOR Position; // position in user-defined world units, does not affect Velocity + X3DAUDIO_VECTOR Velocity; // velocity vector in user-defined world units/second, used only for doppler calculations, does not affect Position + + X3DAUDIO_CONE* pCone; // sound cone, used only for matrix, LPF (both direct and reverb paths), and reverb calculations, NULL specifies omnidirectionality +} X3DAUDIO_LISTENER, *LPX3DAUDIO_LISTENER; + +// Emitter: +// Defines a 3D audio source, divided into two classifications: +// +// Single-point -- For use with single-channel sounds. +// Positioned at the emitter base, i.e. the channel radius +// and azimuth are ignored if the number of channels == 1. +// +// May be omnidirectional or directional using a cone. +// The cone originates from the emitter base position, +// and is directed by the emitter's front orientation. +// +// Multi-point -- For use with multi-channel sounds. +// Each non-LFE channel is positioned using an +// azimuth along the channel radius with respect to the +// front orientation vector in the plane orthogonal to the +// top orientation vector. An azimuth of X3DAUDIO_2PI +// specifies a channel is an LFE. Such channels are +// positioned at the emitter base and are calculated +// with respect to pLFECurve only, never pVolumeCurve. +// +// Multi-point emitters are always omnidirectional, +// i.e. the cone is ignored if the number of channels > 1. +// +// Note that many properties are shared among all channel points, +// locking certain behaviour with respect to the emitter base position. +// For example, doppler shift is always calculated with respect to the +// emitter base position and so is constant for all its channel points. +// Distance curve calculations are also with respect to the emitter base +// position, with the curves being calculated independently of each other. +// For instance, volume and LFE calculations do not affect one another. +typedef struct X3DAUDIO_EMITTER +{ + X3DAUDIO_CONE* pCone; // sound cone, used only with single-channel emitters for matrix, LPF (both direct and reverb paths), and reverb calculations, NULL specifies omnidirectionality + X3DAUDIO_VECTOR OrientFront; // orientation of front direction, used only for emitter angle calculations or with multi-channel emitters for matrix calculations or single-channel emitters with cones for matrix, LPF (both direct and reverb paths), and reverb calculations, must be normalized when used + X3DAUDIO_VECTOR OrientTop; // orientation of top direction, used only with multi-channel emitters for matrix calculations, must be orthonormal with OrientFront when used + + X3DAUDIO_VECTOR Position; // position in user-defined world units, does not affect Velocity + X3DAUDIO_VECTOR Velocity; // velocity vector in user-defined world units/second, used only for doppler calculations, does not affect Position + + FLOAT32 InnerRadius; // inner radius, must be within [0.0f, FLT_MAX] + FLOAT32 InnerRadiusAngle; // inner radius angle, must be within [0.0f, X3DAUDIO_PI/4.0) + + UINT32 ChannelCount; // number of sound channels, must be > 0 + FLOAT32 ChannelRadius; // channel radius, used only with multi-channel emitters for matrix calculations, must be >= 0.0f when used + FLOAT32* pChannelAzimuths; // channel azimuth array, used only with multi-channel emitters for matrix calculations, contains positions of each channel expressed in radians along the channel radius with respect to the front orientation vector in the plane orthogonal to the top orientation vector, or X3DAUDIO_2PI to specify an LFE channel, must have at least ChannelCount elements, all within [0.0f, X3DAUDIO_2PI] when used + + X3DAUDIO_DISTANCE_CURVE* pVolumeCurve; // volume level distance curve, used only for matrix calculations, NULL specifies a default curve that conforms to the inverse square law, calculated in user-defined world units with distances <= CurveDistanceScaler clamped to no attenuation + X3DAUDIO_DISTANCE_CURVE* pLFECurve; // LFE level distance curve, used only for matrix calculations, NULL specifies a default curve that conforms to the inverse square law, calculated in user-defined world units with distances <= CurveDistanceScaler clamped to no attenuation + X3DAUDIO_DISTANCE_CURVE* pLPFDirectCurve; // LPF direct-path coefficient distance curve, used only for LPF direct-path calculations, NULL specifies the default curve: [0.0f,1.0f], [1.0f,0.75f] + X3DAUDIO_DISTANCE_CURVE* pLPFReverbCurve; // LPF reverb-path coefficient distance curve, used only for LPF reverb-path calculations, NULL specifies the default curve: [0.0f,0.75f], [1.0f,0.75f] + X3DAUDIO_DISTANCE_CURVE* pReverbCurve; // reverb send level distance curve, used only for reverb calculations, NULL specifies the default curve: [0.0f,1.0f], [1.0f,0.0f] + + FLOAT32 CurveDistanceScaler; // curve distance scaler, used to scale normalized distance curves to user-defined world units and/or exaggerate their effect, used only for matrix, LPF (both direct and reverb paths), and reverb calculations, must be within [FLT_MIN, FLT_MAX] when used + FLOAT32 DopplerScaler; // doppler shift scaler, used to exaggerate doppler shift effect, used only for doppler calculations, must be within [0.0f, FLT_MAX] when used +} X3DAUDIO_EMITTER, *LPX3DAUDIO_EMITTER; + + +// DSP settings: +// Receives results from a call to X3DAudioCalculate to be sent +// to the low-level audio rendering API for 3D signal processing. +// +// The user is responsible for allocating the matrix coefficient table, +// delay time array, and initializing the channel counts when used. +typedef struct X3DAUDIO_DSP_SETTINGS +{ + FLOAT32* pMatrixCoefficients; // [inout] matrix coefficient table, receives an array representing the volume level used to send from source channel S to destination channel D, stored as pMatrixCoefficients[SrcChannelCount * D + S], must have at least SrcChannelCount*DstChannelCount elements + FLOAT32* pDelayTimes; // [inout] delay time array, receives delays for each destination channel in milliseconds, must have at least DstChannelCount elements (stereo final mix only) + UINT32 SrcChannelCount; // [in] number of source channels, must equal number of channels in respective emitter + UINT32 DstChannelCount; // [in] number of destination channels, must equal number of channels of the final mix + + FLOAT32 LPFDirectCoefficient; // [out] LPF direct-path coefficient + FLOAT32 LPFReverbCoefficient; // [out] LPF reverb-path coefficient + FLOAT32 ReverbLevel; // [out] reverb send level + FLOAT32 DopplerFactor; // [out] doppler shift factor, scales resampler ratio for doppler shift effect, where the effective frequency = DopplerFactor * original frequency + FLOAT32 EmitterToListenerAngle; // [out] emitter-to-listener interior angle, expressed in radians with respect to the emitter's front orientation + + FLOAT32 EmitterToListenerDistance; // [out] distance in user-defined world units from the emitter base to listener position, always calculated + FLOAT32 EmitterVelocityComponent; // [out] component of emitter velocity vector projected onto emitter->listener vector in user-defined world units/second, calculated only for doppler + FLOAT32 ListenerVelocityComponent; // [out] component of listener velocity vector projected onto emitter->listener vector in user-defined world units/second, calculated only for doppler +} X3DAUDIO_DSP_SETTINGS, *LPX3DAUDIO_DSP_SETTINGS; + + +//-------------------------------------------------------------// +// function storage-class attribute and calltype +#if defined(_XBOX) || defined(X3DAUDIOSTATIC) + #define X3DAUDIO_API_(type) EXTERN_C type STDAPIVCALLTYPE +#else + #if defined(X3DEXPORT) + #define X3DAUDIO_API_(type) EXTERN_C __declspec(dllexport) type STDAPIVCALLTYPE + #else + #define X3DAUDIO_API_(type) EXTERN_C __declspec(dllimport) type STDAPIVCALLTYPE + #endif +#endif +#define X3DAUDIO_IMP_(type) type STDMETHODVCALLTYPE + + +//-------------------------------------------------------// +// initializes instance handle +X3DAUDIO_API_(void) X3DAudioInitialize (UINT32 SpeakerChannelMask, FLOAT32 SpeedOfSound, __out X3DAUDIO_HANDLE Instance); + +// calculates DSP settings with respect to 3D parameters +X3DAUDIO_API_(void) X3DAudioCalculate (__in const X3DAUDIO_HANDLE Instance, __in const X3DAUDIO_LISTENER* pListener, __in const X3DAUDIO_EMITTER* pEmitter, UINT32 Flags, __inout X3DAUDIO_DSP_SETTINGS* pDSPSettings); + + +#pragma pack(pop) // revert packing alignment +//---------------------------------<-EOF->----------------------------------// diff --git a/MediaClient/MediaClient/directx/include/XAPO.h b/MediaClient/MediaClient/directx/include/XAPO.h new file mode 100644 index 0000000..17947d6 --- /dev/null +++ b/MediaClient/MediaClient/directx/include/XAPO.h @@ -0,0 +1,645 @@ +/*-========================================================================-_ + | - XAPO - | + | Copyright (c) Microsoft Corporation. All rights reserved. | + |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| + |PROJECT: XAPO MODEL: Unmanaged User-mode | + |VERSION: 1.0 EXCEPT: No Exceptions | + |CLASS: N / A MINREQ: WinXP, Xbox360 | + |BASE: N / A DIALECT: MSC++ 14.00 | + |>------------------------------------------------------------------------<| + | DUTY: Cross-platform Audio Processing Object interfaces | + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ + NOTES: + 1. Definition of terms: + DSP: Digital Signal Processing. + + CBR: Constant BitRate -- DSP that consumes a constant number of + input samples to produce an output sample. + For example, a 22kHz to 44kHz resampler is CBR DSP. + Even though the number of input to output samples differ, + the ratio between input to output rate remains constant. + All user-defined XAPOs are assumed to be CBR as + XAudio2 only allows CBR DSP to be added to an effect chain. + + XAPO: Cross-platform Audio Processing Object -- + a thin wrapper that manages DSP code, allowing it + to be easily plugged into an XAudio2 effect chain. + + Frame: A block of samples, one per channel, + to be played simultaneously. + + In-Place: Processing such that the input buffer equals the + output buffer (i.e. input data modified directly). + This form of processing is generally more efficient + than using separate memory for input and output. + However, an XAPO may not perform format conversion + when processing in-place. + + 2. XAPO member variables are divided into three classifications: + Immutable: Set once via IXAPO::Initialize and remain + constant during the lifespan of the XAPO. + + Locked: May change before the XAPO is locked via + IXAPO::LockForProcess but remain constant + until IXAPO::UnlockForProcess is called. + + Dynamic: May change from one processing pass to the next, + usually via IXAPOParameters::SetParameters. + XAPOs should assign reasonable defaults to their dynamic + variables during IXAPO::Initialize/LockForProcess so + that calling IXAPOParameters::SetParameters is not + required before processing begins. + + When implementing an XAPO, determine the type of each variable and + initialize them in the appropriate method. Immutable variables are + generally preferable over locked which are preferable over dynamic. + That is, one should strive to minimize XAPO state changes for + best performance, maintainability, and ease of use. + + 3. To minimize glitches, the realtime audio processing thread must + not block. XAPO methods called by the realtime thread are commented + as non-blocking and therefore should not use blocking synchronization, + allocate memory, access the disk, etc. The XAPO interfaces were + designed to allow an effect implementer to move such operations + into other methods called on an application controlled thread. + + 4. Extending functionality is accomplished through the addition of new + COM interfaces. For example, if a new member is added to a parameter + structure, a new interface using the new structure should be added, + leaving the original interface unchanged. + This ensures consistent communication between future versions of + XAudio2 and various versions of XAPOs that may exist in an application. + + 5. All audio data is interleaved in XAudio2. + The default audio format for an effect chain is WAVE_FORMAT_IEEE_FLOAT. + + 6. User-defined XAPOs should assume all input and output buffers are + 16-byte aligned. + + 7. See XAPOBase.h for an XAPO base class which provides a default + implementation for most of the interface methods defined below. */ + +#pragma once +//---------------------------------------------------// +#include "comdecl.h" // for DEFINE_IID + +// XAPO interface IDs +DEFINE_IID(IXAPO, A90BC001, E897, E897, 55, E4, 9E, 47, 00, 00, 00, 00); +DEFINE_IID(IXAPOParameters, A90BC001, E897, E897, 55, E4, 9E, 47, 00, 00, 00, 01); + + +#if !defined(GUID_DEFS_ONLY) // ignore rest if only GUID definitions requested + #if defined(_XBOX) // general windows and COM declarations + #include + #include + #else + #include + #include + #endif + #include "audiodefs.h" // for WAVEFORMATEX etc. + + // XAPO error codes + #define FACILITY_XAPO 0x897 + #define XAPO_E_FORMAT_UNSUPPORTED MAKE_HRESULT(SEVERITY_ERROR, FACILITY_XAPO, 0x01) // requested audio format unsupported + + // supported number of channels (samples per frame) range + #define XAPO_MIN_CHANNELS 1 + #define XAPO_MAX_CHANNELS 64 + + // supported framerate range + #define XAPO_MIN_FRAMERATE 1000 + #define XAPO_MAX_FRAMERATE 200000 + + // unicode string length, including terminator, used with XAPO_REGISTRATION_PROPERTIES + #define XAPO_REGISTRATION_STRING_LENGTH 256 + + + // XAPO property flags, used with XAPO_REGISTRATION_PROPERTIES.Flags: + // Number of channels of input and output buffers must match, + // applies to XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS.pFormat. + #define XAPO_FLAG_CHANNELS_MUST_MATCH 0x00000001 + + // Framerate of input and output buffers must match, + // applies to XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS.pFormat. + #define XAPO_FLAG_FRAMERATE_MUST_MATCH 0x00000002 + + // Bit depth of input and output buffers must match, + // applies to XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS.pFormat. + // Container size of input and output buffers must also match if + // XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS.pFormat is WAVEFORMATEXTENSIBLE. + #define XAPO_FLAG_BITSPERSAMPLE_MUST_MATCH 0x00000004 + + // Number of input and output buffers must match, + // applies to XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS. + // + // Also, XAPO_REGISTRATION_PROPERTIES.MinInputBufferCount must + // equal XAPO_REGISTRATION_PROPERTIES.MinOutputBufferCount and + // XAPO_REGISTRATION_PROPERTIES.MaxInputBufferCount must equal + // XAPO_REGISTRATION_PROPERTIES.MaxOutputBufferCount when used. + #define XAPO_FLAG_BUFFERCOUNT_MUST_MATCH 0x00000008 + + // XAPO must be run in-place. Use this flag only if your DSP + // implementation cannot process separate input and output buffers. + // If set, the following flags must also be set: + // XAPO_FLAG_CHANNELS_MUST_MATCH + // XAPO_FLAG_FRAMERATE_MUST_MATCH + // XAPO_FLAG_BITSPERSAMPLE_MUST_MATCH + // XAPO_FLAG_BUFFERCOUNT_MUST_MATCH + // XAPO_FLAG_INPLACE_SUPPORTED + // + // Multiple input and output buffers may be used with in-place XAPOs, + // though the input buffer count must equal the output buffer count. + // When multiple input/output buffers are used, the XAPO may assume + // input buffer [N] equals output buffer [N] for in-place processing. + #define XAPO_FLAG_INPLACE_REQUIRED 0x00000020 + + // XAPO may be run in-place. If the XAPO is used in a chain + // such that the requirements for XAPO_FLAG_INPLACE_REQUIRED are met, + // XAudio2 will ensure the XAPO is run in-place. If not met, XAudio2 + // will still run the XAPO albeit with separate input and output buffers. + // + // For example, consider an effect which may be ran in stereo->5.1 mode or + // mono->mono mode. When set to stereo->5.1, it will be run with separate + // input and output buffers as format conversion is not permitted in-place. + // However, if configured to run mono->mono, the same XAPO can be run + // in-place. Thus the same implementation may be conveniently reused + // for various input/output configurations, while taking advantage of + // in-place processing when possible. + #define XAPO_FLAG_INPLACE_SUPPORTED 0x00000010 + + +//-----------------------------------------------------// + #pragma pack(push, 1) // set packing alignment to ensure consistency across arbitrary build environments + + + // XAPO registration properties, describes general XAPO characteristics, used with IXAPO::GetRegistrationProperties + typedef struct XAPO_REGISTRATION_PROPERTIES { + CLSID clsid; // COM class ID, used with CoCreate + WCHAR FriendlyName[XAPO_REGISTRATION_STRING_LENGTH]; // friendly name unicode string + WCHAR CopyrightInfo[XAPO_REGISTRATION_STRING_LENGTH]; // copyright information unicode string + UINT32 MajorVersion; // major version + UINT32 MinorVersion; // minor version + UINT32 Flags; // XAPO property flags, describes supported input/output configuration + UINT32 MinInputBufferCount; // minimum number of input buffers required for processing, can be 0 + UINT32 MaxInputBufferCount; // maximum number of input buffers supported for processing, must be >= MinInputBufferCount + UINT32 MinOutputBufferCount; // minimum number of output buffers required for processing, can be 0, must match MinInputBufferCount when XAPO_FLAG_BUFFERCOUNT_MUST_MATCH used + UINT32 MaxOutputBufferCount; // maximum number of output buffers supported for processing, must be >= MinOutputBufferCount, must match MaxInputBufferCount when XAPO_FLAG_BUFFERCOUNT_MUST_MATCH used + } XAPO_REGISTRATION_PROPERTIES; + + + // LockForProcess buffer parameters: + // Defines buffer parameters that remain constant while an XAPO is locked. + // Used with IXAPO::LockForProcess. + // + // For CBR XAPOs, MaxFrameCount is the only number of frames + // IXAPO::Process would have to handle for the respective buffer. + typedef struct XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS { + const WAVEFORMATEX* pFormat; // buffer audio format + UINT32 MaxFrameCount; // maximum number of frames in respective buffer that IXAPO::Process would have to handle, irrespective of dynamic variable settings, can be 0 + } XAPO_LOCKFORPROCESS_PARAMETERS; + + // Buffer flags: + // Describes assumed content of the respective buffer. + // Used with XAPO_PROCESS_BUFFER_PARAMETERS.BufferFlags. + // + // This meta-data can be used by an XAPO to implement + // optimizations that require knowledge of a buffer's content. + // + // For example, XAPOs that always produce silent output from silent input + // can check the flag on the input buffer to determine if any signal + // processing is necessary. If silent, the XAPO may simply set the flag + // on the output buffer to silent and return, optimizing out the work of + // processing silent data: XAPOs that generate silence for any reason may + // set the buffer's flag accordingly rather than writing out silent + // frames to the buffer itself. + // + // The flags represent what should be assumed is in the respective buffer. + // The flags may not reflect what is actually stored in memory. + typedef enum XAPO_BUFFER_FLAGS { + XAPO_BUFFER_SILENT, // silent data should be assumed, respective memory may be uninitialized + XAPO_BUFFER_VALID, // arbitrary data should be assumed (may or may not be silent frames), respective memory initialized + } XAPO_BUFFER_FLAGS; + + // Process buffer parameters: + // Defines buffer parameters that may change from one + // processing pass to the next. Used with IXAPO::Process. + // + // Note the byte size of the respective buffer must be at least: + // XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS.MaxFrameCount * XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS.pFormat->nBlockAlign + // + // Although the audio format and maximum size of the respective + // buffer is locked (defined by XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS), + // the actual memory address of the buffer given is permitted to change + // from one processing pass to the next. + // + // For CBR XAPOs, ValidFrameCount is constant while locked and equals + // the respective XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS.MaxFrameCount. + typedef struct XAPO_PROCESS_BUFFER_PARAMETERS { + void* pBuffer; // audio data buffer, must be non-NULL + XAPO_BUFFER_FLAGS BufferFlags; // describes assumed content of pBuffer, does not affect ValidFrameCount + UINT32 ValidFrameCount; // number of frames of valid data, must be within respective [0, XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS.MaxFrameCount], always XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS.MaxFrameCount for CBR/user-defined XAPOs, does not affect BufferFlags + } XAPO_PROCESS_BUFFER_PARAMETERS; + + +//-------------------------------------------------------------// + // Memory allocation macros that allow one module to allocate memory and + // another to free it, by guaranteeing that the same heap manager is used + // regardless of differences between build environments of the two modules. + // + // Used by IXAPO methods that must allocate arbitrary sized structures + // such as WAVEFORMATEX that are subsequently returned to the application. + #if defined(_XBOX) + #define XAPO_ALLOC_ATTRIBUTES MAKE_XALLOC_ATTRIBUTES ( \ + 0, /* ObjectType */ \ + FALSE, /* HeapTracksAttributes */ \ + FALSE, /* MustSucceed */ \ + FALSE, /* FixedSize */ \ + eXALLOCAllocatorId_XAUDIO2, /* AllocatorId */ \ + XALLOC_ALIGNMENT_DEFAULT, /* Alignment */ \ + XALLOC_MEMPROTECT_READWRITE, /* MemoryProtect */ \ + FALSE, /* ZeroInitialize */ \ + XALLOC_MEMTYPE_HEAP /* MemoryType */ \ + ) + #define XAPOAlloc(size) XMemAlloc(size, XAPO_ALLOC_ATTRIBUTES) + #define XAPOFree(p) XMemFree(p, XAPO_ALLOC_ATTRIBUTES) + #else + #define XAPOAlloc(size) CoTaskMemAlloc(size) + #define XAPOFree(p) CoTaskMemFree(p) + #endif + + +//-----------------------------------------------------// + // IXAPO: + // The only mandatory XAPO COM interface -- a thin wrapper that manages + // DSP code, allowing it to be easily plugged into an XAudio2 effect chain. + #undef INTERFACE + #define INTERFACE IXAPO + DECLARE_INTERFACE_(IXAPO, IUnknown) { + //// + // DESCRIPTION: + // Allocates a copy of the registration properties of the XAPO. + // + // PARAMETERS: + // ppRegistrationProperties - [out] receives pointer to copy of registration properties, use XAPOFree to free structure, left untouched on failure + // + // RETURN VALUE: + // COM error code + //// + STDMETHOD(GetRegistrationProperties) (THIS_ __deref_out XAPO_REGISTRATION_PROPERTIES** ppRegistrationProperties) PURE; + + //// + // DESCRIPTION: + // Queries if an input/output configuration is supported. + // + // REMARKS: + // This method allows XAPOs to express dependency of input format + // with respect to output format. + // + // If the input/output format pair configuration is unsupported, + // this method also determines the nearest input format supported. + // Nearest meaning closest bit depth, framerate, and channel count, + // in that order of importance. + // + // The behaviour of this method should remain constant after the + // XAPO has been initialized. + // + // PARAMETERS: + // pOutputFormat - [in] output format known to be supported + // pRequestedInputFormat - [in] input format to examine + // ppSupportedInputFormat - [out] receives pointer to nearest input format supported if not NULL and input/output configuration unsupported, use XAPOFree to free structure, left untouched on any failure except XAPO_E_FORMAT_UNSUPPORTED + // + // RETURN VALUE: + // COM error code, including: + // S_OK - input/output configuration supported, ppSupportedInputFormat left untouched + // XAPO_E_FORMAT_UNSUPPORTED - input/output configuration unsupported, ppSupportedInputFormat receives pointer to nearest input format supported if not NULL + // E_INVALIDARG - either audio format invalid, ppSupportedInputFormat left untouched + //// + STDMETHOD(IsInputFormatSupported) (THIS_ const WAVEFORMATEX* pOutputFormat, const WAVEFORMATEX* pRequestedInputFormat, __deref_opt_out WAVEFORMATEX** ppSupportedInputFormat) PURE; + + //// + // DESCRIPTION: + // Queries if an input/output configuration is supported. + // + // REMARKS: + // This method allows XAPOs to express dependency of output format + // with respect to input format. + // + // If the input/output format pair configuration is unsupported, + // this method also determines the nearest output format supported. + // Nearest meaning closest bit depth, framerate, and channel count, + // in that order of importance. + // + // The behaviour of this method should remain constant after the + // XAPO has been initialized. + // + // PARAMETERS: + // pInputFormat - [in] input format known to be supported + // pRequestedOutputFormat - [in] output format to examine + // ppSupportedOutputFormat - [out] receives pointer to nearest output format supported if not NULL and input/output configuration unsupported, use XAPOFree to free structure, left untouched on any failure except XAPO_E_FORMAT_UNSUPPORTED + // + // RETURN VALUE: + // COM error code, including: + // S_OK - input/output configuration supported, ppSupportedOutputFormat left untouched + // XAPO_E_FORMAT_UNSUPPORTED - input/output configuration unsupported, ppSupportedOutputFormat receives pointer to nearest output format supported if not NULL + // E_INVALIDARG - either audio format invalid, ppSupportedOutputFormat left untouched + //// + STDMETHOD(IsOutputFormatSupported) (THIS_ const WAVEFORMATEX* pInputFormat, const WAVEFORMATEX* pRequestedOutputFormat, __deref_opt_out WAVEFORMATEX** ppSupportedOutputFormat) PURE; + + //// + // DESCRIPTION: + // Performs any effect-specific initialization if required. + // + // REMARKS: + // The contents of pData are defined by the XAPO. + // Immutable variables (constant during the lifespan of the XAPO) + // should be set once via this method. + // Once initialized, an XAPO cannot be initialized again. + // + // An XAPO should be initialized before passing it to XAudio2 + // as part of an effect chain. XAudio2 will not call this method; + // it exists for future content-driven initialization by XACT. + // + // PARAMETERS: + // pData - [in] effect-specific initialization parameters, may be NULL if DataByteSize == 0 + // DataByteSize - [in] size of pData in bytes, may be 0 if DataByteSize is NULL + // + // RETURN VALUE: + // COM error code + //// + STDMETHOD(Initialize) (THIS_ __in_bcount_opt(DataByteSize) const void* pData, UINT32 DataByteSize) PURE; + + //// + // DESCRIPTION: + // Resets variables dependent on frame history. + // + // REMARKS: + // All other variables remain unchanged, including variables set by + // IXAPOParameters::SetParameters. + // + // For example, an effect with delay should zero out its delay line + // during this method, but should not reallocate anything as the + // XAPO remains locked with a constant input/output configuration. + // + // XAudio2 calls this method only if the XAPO is locked. + // This method should not block as it is called from the + // realtime thread. + // + // PARAMETERS: + // void + // + // RETURN VALUE: + // void + //// + STDMETHOD_(void, Reset) (THIS) PURE; + + //// + // DESCRIPTION: + // Locks the XAPO to a specific input/output configuration, + // allowing it to do any final initialization before Process + // is called on the realtime thread. + // + // REMARKS: + // Once locked, the input/output configuration and any other locked + // variables remain constant until UnlockForProcess is called. + // + // XAPOs should assert the input/output configuration is supported + // and that any required effect-specific initialization is complete. + // IsInputFormatSupported, IsOutputFormatSupported, and Initialize + // should be called as necessary before this method is called. + // + // All internal memory buffers required for Process should be + // allocated by the time this method returns successfully + // as Process is non-blocking and should not allocate memory. + // + // Once locked, an XAPO cannot be locked again until + // UnLockForProcess is called. + // + // PARAMETERS: + // InputLockedParameterCount - [in] number of input buffers, must be within [XAPO_REGISTRATION_PROPERTIES.MinInputBufferCount, XAPO_REGISTRATION_PROPERTIES.MaxInputBufferCount] + // pInputLockedParameters - [in] array of input locked buffer parameter structures, may be NULL if InputLockedParameterCount == 0, otherwise must have InputLockedParameterCount elements + // OutputLockedParameterCount - [in] number of output buffers, must be within [XAPO_REGISTRATION_PROPERTIES.MinOutputBufferCount, XAPO_REGISTRATION_PROPERTIES.MaxOutputBufferCount], must match InputLockedParameterCount when XAPO_FLAG_BUFFERCOUNT_MUST_MATCH used + // pOutputLockedParameters - [in] array of output locked buffer parameter structures, may be NULL if OutputLockedParameterCount == 0, otherwise must have OutputLockedParameterCount elements + // + // RETURN VALUE: + // COM error code + //// + STDMETHOD(LockForProcess) (THIS_ UINT32 InputLockedParameterCount, __in_ecount_opt(InputLockedParameterCount) const XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS* pInputLockedParameters, UINT32 OutputLockedParameterCount, __in_ecount_opt(OutputLockedParameterCount) const XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS* pOutputLockedParameters) PURE; + + //// + // DESCRIPTION: + // Opposite of LockForProcess. Variables allocated during + // LockForProcess should be deallocated by this method. + // + // REMARKS: + // Unlocking an XAPO allows an XAPO instance to be reused with + // different input/output configurations. + // + // PARAMETERS: + // void + // + // RETURN VALUE: + // void + //// + STDMETHOD_(void, UnlockForProcess) (THIS) PURE; + + //// + // DESCRIPTION: + // Runs the XAPO's DSP code on the given input/output buffers. + // + // REMARKS: + // In addition to writing to the output buffers as appropriate, + // an XAPO must set the BufferFlags and ValidFrameCount members + // of all elements in pOutputProcessParameters accordingly. + // + // ppInputProcessParameters will not necessarily be the same as + // ppOutputProcessParameters for in-place processing, rather + // the pBuffer members of each will point to the same memory. + // + // Multiple input/output buffers may be used with in-place XAPOs, + // though the input buffer count must equal the output buffer count. + // When multiple input/output buffers are used with in-place XAPOs, + // the XAPO may assume input buffer [N] equals output buffer [N]. + // + // When IsEnabled is FALSE, the XAPO should process thru. + // Thru processing means an XAPO should not apply its normal + // processing to the given input/output buffers during Process. + // It should instead pass data from input to output with as little + // modification possible. Effects that perform format conversion + // should continue to do so. The effect must ensure transitions + // between normal and thru processing do not introduce + // discontinuities into the signal. + // + // XAudio2 calls this method only if the XAPO is locked. + // This method should not block as it is called from the + // realtime thread. + // + // PARAMETERS: + // InputProcessParameterCount - [in] number of input buffers, matches respective InputLockedParameterCount parameter given to LockForProcess + // pInputProcessParameters - [in] array of input process buffer parameter structures, may be NULL if InputProcessParameterCount == 0, otherwise must have InputProcessParameterCount elements + // OutputProcessParameterCount - [in] number of output buffers, matches respective OutputLockedParameterCount parameter given to LockForProcess + // pOutputProcessParameters - [in/out] array of output process buffer parameter structures, may be NULL if OutputProcessParameterCount == 0, otherwise must have OutputProcessParameterCount elements + // IsEnabled - [in] TRUE to process normally, FALSE to process thru + // + // RETURN VALUE: + // void + //// + STDMETHOD_(void, Process) (THIS_ UINT32 InputProcessParameterCount, __in_ecount_opt(InputProcessParameterCount) const XAPO_PROCESS_BUFFER_PARAMETERS* pInputProcessParameters, UINT32 OutputProcessParameterCount, __inout_ecount_opt(OutputProcessParameterCount) XAPO_PROCESS_BUFFER_PARAMETERS* pOutputProcessParameters, BOOL IsEnabled) PURE; + + //// + // DESCRIPTION: + // Returns the number of input frames required to generate the + // requested number of output frames. + // + // REMARKS: + // XAudio2 may call this method to determine how many input frames + // an XAPO requires. This is constant for locked CBR XAPOs; + // this method need only be called once while an XAPO is locked. + // + // XAudio2 calls this method only if the XAPO is locked. + // This method should not block as it is called from the + // realtime thread. + // + // PARAMETERS: + // OutputFrameCount - [in] requested number of output frames, must be within respective [0, XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS.MaxFrameCount], always XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS.MaxFrameCount for CBR/user-defined XAPOs + // + // RETURN VALUE: + // number of input frames required + //// + STDMETHOD_(UINT32, CalcInputFrames) (THIS_ UINT32 OutputFrameCount) PURE; + + //// + // DESCRIPTION: + // Returns the number of output frames generated for the + // requested number of input frames. + // + // REMARKS: + // XAudio2 may call this method to determine how many output frames + // an XAPO will generate. This is constant for locked CBR XAPOs; + // this method need only be called once while an XAPO is locked. + // + // XAudio2 calls this method only if the XAPO is locked. + // This method should not block as it is called from the + // realtime thread. + // + // PARAMETERS: + // InputFrameCount - [in] requested number of input frames, must be within respective [0, XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS.MaxFrameCount], always XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS.MaxFrameCount for CBR/user-defined XAPOs + // + // RETURN VALUE: + // number of output frames generated + //// + STDMETHOD_(UINT32, CalcOutputFrames) (THIS_ UINT32 InputFrameCount) PURE; + }; + + + + // IXAPOParameters: + // Optional XAPO COM interface that allows an XAPO to use + // effect-specific parameters. + #undef INTERFACE + #define INTERFACE IXAPOParameters + DECLARE_INTERFACE_(IXAPOParameters, IUnknown) { + //// + // DESCRIPTION: + // Sets effect-specific parameters. + // + // REMARKS: + // This method may only be called on the realtime thread; + // no synchronization between it and IXAPO::Process is necessary. + // + // This method should not block as it is called from the + // realtime thread. + // + // PARAMETERS: + // pParameters - [in] effect-specific parameter block, must be != NULL + // ParameterByteSize - [in] size of pParameters in bytes, must be > 0 + // + // RETURN VALUE: + // void + //// + STDMETHOD_(void, SetParameters) (THIS_ __in_bcount(ParameterByteSize) const void* pParameters, UINT32 ParameterByteSize) PURE; + + //// + // DESCRIPTION: + // Gets effect-specific parameters. + // + // REMARKS: + // Unlike SetParameters, XAudio2 does not call this method on the + // realtime thread. Thus, the XAPO must protect variables shared + // with SetParameters/Process using appropriate synchronization. + // + // PARAMETERS: + // pParameters - [out] receives effect-specific parameter block, must be != NULL + // ParameterByteSize - [in] size of pParameters in bytes, must be > 0 + // + // RETURN VALUE: + // void + //// + STDMETHOD_(void, GetParameters) (THIS_ __out_bcount(ParameterByteSize) void* pParameters, UINT32 ParameterByteSize) PURE; + }; + + +//-------------------------------------------------------------// + // macros to allow XAPO interfaces to be used in C code + #if !defined(__cplusplus) + // IXAPO + #define IXAPO_QueryInterface(This, riid, ppInterface) \ + ( (This)->lpVtbl->QueryInterface(This, riid, ppInterface) ) + + #define IXAPO_AddRef(This) \ + ( (This)->lpVtbl->AddRef(This) ) + + #define IXAPO_Release(This) \ + ( (This)->lpVtbl->Release(This) ) + + #define IXAPO_GetRegistrationProperties(This, ppRegistrationProperties) \ + ( (This)->lpVtbl->GetRegistrationProperties(This, ppRegistrationProperties) ) + + #define IXAPO_IsInputFormatSupported(This, pOutputFormat, pRequestedInputFormat, ppSupportedInputFormat) \ + ( (This)->lpVtbl->IsInputFormatSupported(This, pOutputFormat, pRequestedInputFormat, ppSupportedInputFormat) ) + + #define IXAPO_IsOutputFormatSupported(This, pInputFormat, pRequestedOutputFormat, ppSupportedOutputFormat) \ + ( (This)->lpVtbl->IsOutputFormatSupported(This, pInputFormat, pRequestedOutputFormat, ppSupportedOutputFormat) ) + + #define IXAPO_Initialize(This, pData, DataByteSize) \ + ( (This)->lpVtbl->Initialize(This, pData, DataByteSize) ) + + #define IXAPO_Reset(This) \ + ( (This)->lpVtbl->Reset(This) ) + + #define IXAPO_LockForProcess(This, InputLockedParameterCount, pInputLockedParameters, OutputLockedParameterCount, pOutputLockedParameters) \ + ( (This)->lpVtbl->LockForProcess(This, InputLockedParameterCount, pInputLockedParameters, OutputLockedParameterCount, pOutputLockedParameters) ) + + #define IXAPO_UnlockForProcess(This) \ + ( (This)->lpVtbl->UnlockForProcess(This) ) + + #define IXAPO_Process(This, InputProcessParameterCount, pInputProcessParameters, OutputProcessParameterCount, pOutputProcessParameters, IsEnabled) \ + ( (This)->lpVtbl->Process(This, InputProcessParameterCount, pInputProcessParameters, OutputProcessParameterCount, pOutputProcessParameters, IsEnabled) ) + + #define IXAPO_CalcInputFrames(This, OutputFrameCount) \ + ( (This)->lpVtbl->CalcInputFrames(This, OutputFrameCount) ) + + #define IXAPO_CalcOutputFrames(This, InputFrameCount) \ + ( (This)->lpVtbl->CalcOutputFrames(This, InputFrameCount) ) + + + // IXAPOParameters + #define IXAPOParameters_QueryInterface(This, riid, ppInterface) \ + ( (This)->lpVtbl->QueryInterface(This, riid, ppInterface) ) + + #define IXAPOParameters_AddRef(This) \ + ( (This)->lpVtbl->AddRef(This) ) + + #define IXAPOParameters_Release(This) \ + ( (This)->lpVtbl->Release(This) ) + + #define IXAPOParameters_SetParameters(This, pParameters, ParameterByteSize) \ + ( (This)->lpVtbl->SetParameters(This, pParameters, ParameterByteSize) ) + + #define IXAPOParameters_GetParameters(This, pParameters, ParameterByteSize) \ + ( (This)->lpVtbl->GetParameters(This, pParameters, ParameterByteSize) ) + #endif // !defined(__cplusplus) + + + #pragma pack(pop) // revert packing alignment +#endif // !defined(GUID_DEFS_ONLY) +//---------------------------------<-EOF->----------------------------------// diff --git a/MediaClient/MediaClient/directx/include/XAPOBase.h b/MediaClient/MediaClient/directx/include/XAPOBase.h new file mode 100644 index 0000000..24c5c6f --- /dev/null +++ b/MediaClient/MediaClient/directx/include/XAPOBase.h @@ -0,0 +1,337 @@ +/*-========================================================================-_ + | - XAPO - | + | Copyright (c) Microsoft Corporation. All rights reserved. | + |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| + |PROJECT: XAPO MODEL: Unmanaged User-mode | + |VERSION: 1.0 EXCEPT: No Exceptions | + |CLASS: N / A MINREQ: WinXP, Xbox360 | + |BASE: N / A DIALECT: MSC++ 14.00 | + |>------------------------------------------------------------------------<| + | DUTY: XAPO base classes | + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ + NOTES: + 1. See XAPO.h for the rules governing XAPO interface behaviour. */ + +#pragma once +//---------------------------------------------------// +#include "XAPO.h" + +// default audio format ranges supported, applies to XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS.pFormat +#define XAPOBASE_DEFAULT_FORMAT_TAG WAVE_FORMAT_IEEE_FLOAT // 32-bit float only, applies to WAVEFORMATEX.wFormatTag or WAVEFORMATEXTENSIBLE.SubFormat when used +#define XAPOBASE_DEFAULT_FORMAT_MIN_CHANNELS XAPO_MIN_CHANNELS // minimum channel count, applies to WAVEFORMATEX.nChannels +#define XAPOBASE_DEFAULT_FORMAT_MAX_CHANNELS XAPO_MAX_CHANNELS // maximum channel count, applies to WAVEFORMATEX.nChannels +#define XAPOBASE_DEFAULT_FORMAT_MIN_FRAMERATE XAPO_MIN_FRAMERATE // minimum framerate, applies to WAVEFORMATEX.nSamplesPerSec +#define XAPOBASE_DEFAULT_FORMAT_MAX_FRAMERATE XAPO_MAX_FRAMERATE // maximum framerate, applies to WAVEFORMATEX.nSamplesPerSec +#define XAPOBASE_DEFAULT_FORMAT_BITSPERSAMPLE 32 // 32-bit float only, applies to WAVEFORMATEX.wBitsPerSample and WAVEFORMATEXTENSIBLE.wValidBitsPerSample when used + +// default XAPO property flags supported, applies to XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS +#define XAPOBASE_DEFAULT_FLAG (XAPO_FLAG_CHANNELS_MUST_MATCH | XAPO_FLAG_FRAMERATE_MUST_MATCH | XAPO_FLAG_BITSPERSAMPLE_MUST_MATCH | XAPO_FLAG_BUFFERCOUNT_MUST_MATCH | XAPO_FLAG_INPLACE_SUPPORTED) + +// default number of input and output buffers supported, applies to XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS +#define XAPOBASE_DEFAULT_BUFFER_COUNT 1 + + +//-------------------------------------------------------------// +// assertion +#if !defined(XAPOASSERT) + #if XAPODEBUG + #define XAPOASSERT(exp) if (!(exp)) { OutputDebugStringA("XAPO ASSERT: " #exp ", {" __FUNCTION__ "}\n"); __debugbreak(); } + #else + #define XAPOASSERT(exp) __assume(exp) + #endif +#endif + + +//-----------------------------------------------------// +#pragma pack(push, 8) // set packing alignment to ensure consistency across arbitrary build environments, and ensure synchronization variables used by Interlocked functionality are correctly aligned + + +// primitive types +typedef float FLOAT32; // 32-bit IEEE float + + + //// + // DESCRIPTION: + // Default implementation of the IXAPO and IUnknown interfaces. + // Provides overridable implementations for all methods save IXAPO::Process. + //// +class __declspec(novtable) CXAPOBase: public IXAPO { +private: + const XAPO_REGISTRATION_PROPERTIES* m_pRegistrationProperties; // pointer to registration properties of the XAPO, set via constructor + + void* m_pfnMatrixMixFunction; // optimal matrix function pointer, used for thru processing + FLOAT32* m_pfl32MatrixCoefficients; // matrix coefficient table, used for thru processing + UINT32 m_nSrcFormatType; // input format type, used for thru processing + BOOL m_fIsScalarMatrix; // TRUE if m_pfl32MatrixCoefficients is diagonal matrix with all main diagonal entries equal, i.e. m_pfnMatrixMixFunction only used for type conversion (no channel conversion), used for thru processing + BOOL m_fIsLocked; // TRUE if XAPO locked via CXAPOBase.LockForProcess + + +protected: + LONG m_lReferenceCount; // COM reference count, must be aligned for atomic operations + + //// + // DESCRIPTION: + // Verifies an audio format falls within the default ranges supported. + // + // REMARKS: + // If pFormat is unsupported, and fOverwrite is TRUE, + // pFormat is overwritten with the nearest format supported. + // Nearest meaning closest bit depth, framerate, and channel count, + // in that order of importance. + // + // PARAMETERS: + // pFormat - [in/out] audio format to examine + // fOverwrite - [in] TRUE to overwrite pFormat if audio format unsupported + // + // RETURN VALUE: + // COM error code, including: + // S_OK - audio format supported, pFormat left untouched + // XAPO_E_FORMAT_UNSUPPORTED - audio format unsupported, pFormat overwritten with nearest audio format supported if fOverwrite TRUE + // E_INVALIDARG - audio format invalid, pFormat left untouched + //// + virtual HRESULT ValidateFormatDefault (__inout WAVEFORMATEX* pFormat, BOOL fOverwrite); + + //// + // DESCRIPTION: + // Verifies that an input/output format pair configuration is supported + // with respect to the XAPO property flags. + // + // REMARKS: + // If pRequestedFormat is unsupported, and fOverwrite is TRUE, + // pRequestedFormat is overwritten with the nearest format supported. + // Nearest meaning closest bit depth, framerate, and channel count, + // in that order of importance. + // + // PARAMETERS: + // pSupportedFormat - [in] audio format known to be supported + // pRequestedFormat - [in/out] audio format to examine, must be WAVEFORMATEXTENSIBLE if fOverwrite TRUE + // fOverwrite - [in] TRUE to overwrite pRequestedFormat if input/output configuration unsupported + // + // RETURN VALUE: + // COM error code, including: + // S_OK - input/output configuration supported, pRequestedFormat left untouched + // XAPO_E_FORMAT_UNSUPPORTED - input/output configuration unsupported, pRequestedFormat overwritten with nearest audio format supported if fOverwrite TRUE + // E_INVALIDARG - either audio format invalid, pRequestedFormat left untouched + //// + HRESULT ValidateFormatPair (const WAVEFORMATEX* pSupportedFormat, __inout WAVEFORMATEX* pRequestedFormat, BOOL fOverwrite); + + //// + // DESCRIPTION: + // This method may be called by an IXAPO::Process implementation + // for thru processing. It copies/mixes data from source to + // destination, making as few changes as possible to the audio data. + // + // REMARKS: + // However, this method is capable of channel upmix/downmix and uses + // the same matrix coefficient table used by windows Vista to do so. + // + // For in-place processing (input buffer == output buffer) + // this method does nothing. + // + // This method should be called only if the XAPO is locked and + // XAPO_FLAG_FRAMERATE_MUST_MATCH is used. + // + // PARAMETERS: + // pInputBuffer - [in] input buffer, format may be INT8, INT16, INT20 (contained in 24 or 32 bits), INT24 (contained in 24 or 32 bits), INT32, or FLOAT32 + // pOutputBuffer - [out] output buffer, format must be FLOAT32 + // FrameCount - [in] number of frames to process + // InputChannelCount - [in] number of input channels + // OutputChannelCount - [in] number of output channels + // MixWithOutput - [in] TRUE to mix with output, FALSE to overwrite output + // + // RETURN VALUE: + // void + //// + void ProcessThru (__in void* pInputBuffer, __inout FLOAT32* pOutputBuffer, UINT32 FrameCount, WORD InputChannelCount, WORD OutputChannelCount, BOOL MixWithOutput); + + // accessors + const XAPO_REGISTRATION_PROPERTIES* GetRegistrationPropertiesInternal () { return m_pRegistrationProperties; } + BOOL IsLocked () { return m_fIsLocked; } + + +public: + CXAPOBase (const XAPO_REGISTRATION_PROPERTIES* pRegistrationProperties); + virtual ~CXAPOBase (); + + // IUnknown methods: + // retrieves the requested interface pointer if supported + STDMETHOD(QueryInterface) (REFIID riid, __deref_out_opt void** ppInterface) + { + XAPOASSERT(ppInterface != NULL); + HRESULT hr = S_OK; + + if (riid == __uuidof(IXAPO)) { + *ppInterface = static_cast(this); + AddRef(); + } else if (riid == __uuidof(IUnknown)) { + *ppInterface = static_cast(this); + AddRef(); + } else { + *ppInterface = NULL; + hr = E_NOINTERFACE; + } + + return hr; + } + + // increments reference count + STDMETHOD_(ULONG, AddRef) () + { + return (ULONG)InterlockedIncrement(&m_lReferenceCount); + } + + // decrements reference count and deletes the object if the reference count falls to zero + STDMETHOD_(ULONG, Release) () + { + ULONG uTmpReferenceCount = (ULONG)InterlockedDecrement(&m_lReferenceCount); + if (uTmpReferenceCount == 0) { + delete this; + } + return uTmpReferenceCount; + } + + // IXAPO methods: + // Allocates a copy of the registration properties of the XAPO. + // This default implementation returns a copy of the registration + // properties given to the constructor, allocated via XAPOAlloc. + STDMETHOD(GetRegistrationProperties) (__deref_out XAPO_REGISTRATION_PROPERTIES** ppRegistrationProperties); + + // Queries if a specific input format is supported for a given output format. + // This default implementation assumes only the format described by the + // XAPOBASE_DEFAULT_FORMAT values are supported for both input and output. + STDMETHOD(IsInputFormatSupported) (const WAVEFORMATEX* pOutputFormat, const WAVEFORMATEX* pRequestedInputFormat, __deref_opt_out WAVEFORMATEX** ppSupportedInputFormat); + + // Queries if a specific output format is supported for a given input format. + // This default implementation assumes only the format described by the + // XAPOBASE_DEFAULT_FORMAT values are supported for both input and output. + STDMETHOD(IsOutputFormatSupported) (const WAVEFORMATEX* pInputFormat, const WAVEFORMATEX* pRequestedOutputFormat, __deref_opt_out WAVEFORMATEX** ppSupportedOutputFormat); + + // Performs any effect-specific initialization. + // This default implementation is a no-op and only returns S_OK. + STDMETHOD(Initialize) (__in_bcount_opt(DataByteSize) const void*, UINT32 DataByteSize) + { + UNREFERENCED_PARAMETER(DataByteSize); + return S_OK; + } + + // Resets variables dependent on frame history. + // This default implementation is a no-op: this base class contains no + // relevant state to reset. + STDMETHOD_(void, Reset) () { return; } + + // Notifies XAPO of buffer formats Process() will be given. + // This default implementation performs basic input/output format + // validation against the XAPO's registration properties. + // Derived XAPOs should call the base implementation first. + STDMETHOD(LockForProcess) (UINT32 InputLockedParameterCount, __in_ecount_opt(InputLockedParameterCount) const XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS* pInputLockedParameters, UINT32 OutputLockedParameterCount, __in_ecount_opt(OutputLockedParameterCount) const XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS* pOutputLockedParameters); + + // Opposite of LockForProcess. + // Derived XAPOs should call the base implementation first. + STDMETHOD_(void, UnlockForProcess) (); + + // Returns the number of input frames required to generate the requested number of output frames. + // By default, this method returns the same number of frames it was passed. + STDMETHOD_(UINT32, CalcInputFrames) (UINT32 OutputFrameCount) { return OutputFrameCount; } + + // Returns the number of output frames generated for the requested number of input frames. + // By default, this method returns the same number of frames it was passed. + STDMETHOD_(UINT32, CalcOutputFrames) (UINT32 InputFrameCount) { return InputFrameCount; } +}; + + + + + +//--------------------------------------------------------------------------// + //// + // DESCRIPTION: + // Extends CXAPOBase, providing a default implementation of the + // IXAPOParameters interface with appropriate synchronization to + // protect variables shared between IXAPOParameters::GetParameters + // and IXAPOParameters::SetParameters/IXAPO::Process. + // + // This class is for parameter blocks whose size is larger than 4 bytes. + // For smaller parameter blocks, use atomic operations directly + // on the parameters for synchronization. + //// +class __declspec(novtable) CXAPOParametersBase: public CXAPOBase, public IXAPOParameters { +private: + BYTE* m_pParameterBlocks; // three contiguous process parameter blocks used for synchronization, user responsible for initialization of parameter blocks before IXAPO::Process/SetParameters/GetParameters called + BYTE* m_pCurrentParameters; // pointer to current process parameters, must be aligned for atomic operations + BYTE* m_pCurrentParametersInternal; // pointer to current process parameters (temp pointer read by SetParameters/BeginProcess/EndProcess) + UINT32 m_uCurrentParametersIndex; // index of current process parameters + UINT32 m_uParameterBlockByteSize; // size of a single parameter block in bytes, must be > 0 + BOOL m_fNewerResultsReady; // TRUE if there exists new processing results not yet picked up by GetParameters(), must be aligned for atomic operations + BOOL m_fProducer; // IXAPO::Process produces data to be returned by GetParameters(); SetParameters() disallowed + + +public: + //// + // PARAMETERS: + // pRegistrationProperties - [in] registration properties of the XAPO + // pParameterBlocks - [in] three contiguous process parameter blocks used for synchronization + // uParameterBlockByteSize - [in] size of one of the parameter blocks, must be > 0 + // fProducer - [in] TRUE if IXAPO::Process produces data to be returned by GetParameters() (SetParameters() and ParametersChanged() disallowed) + //// + CXAPOParametersBase (const XAPO_REGISTRATION_PROPERTIES* pRegistrationProperties, BYTE* pParameterBlocks, UINT32 uParameterBlockByteSize, BOOL fProducer); + virtual ~CXAPOParametersBase (); + + // IUnknown methods: + // retrieves the requested interface pointer if supported + STDMETHOD(QueryInterface) (REFIID riid, __deref_out_opt void** ppInterface) + { + XAPOASSERT(ppInterface != NULL); + HRESULT hr = S_OK; + + if (riid == __uuidof(IXAPOParameters)) { + *ppInterface = static_cast(this); + CXAPOBase::AddRef(); + } else { + hr = CXAPOBase::QueryInterface(riid, ppInterface); + } + + return hr; + } + + // increments reference count + STDMETHOD_(ULONG, AddRef)() { return CXAPOBase::AddRef(); } + + // decrements reference count and deletes the object if the reference count falls to zero + STDMETHOD_(ULONG, Release)() { return CXAPOBase::Release(); } + + // IXAPOParameters methods: + // Sets effect-specific parameters. + // This method may only be called on the realtime audio processing thread. + STDMETHOD_(void, SetParameters) (__in_bcount(ParameterByteSize) const void* pParameters, UINT32 ParameterByteSize); + + // Gets effect-specific parameters. + // This method may block and should not be called from the realtime thread. + // Get the current parameters via BeginProcess. + STDMETHOD_(void, GetParameters) (__out_bcount(ParameterByteSize) void* pParameters, UINT32 ParameterByteSize); + + // Called by SetParameters() to allow for user-defined parameter validation. + // SetParameters validates that ParameterByteSize == m_uParameterBlockByteSize + // so the user may assume/assert ParameterByteSize == m_uParameterBlockByteSize. + // This method should not block as it is called from the realtime thread. + virtual void OnSetParameters (const void*, UINT32) { } + + // Returns TRUE if SetParameters() has been called since the last processing pass. + // May only be used within the XAPO's IXAPO::Process implementation, + // before BeginProcess is called. + BOOL ParametersChanged (); + + // Returns latest process parameters. + // XAPOs must call this method within their IXAPO::Process + // implementation to access latest process parameters in threadsafe manner. + BYTE* BeginProcess (); + + // Notifies CXAPOParametersBase that the XAPO has finished accessing + // the latest process parameters. + // XAPOs must call this method within their IXAPO::Process + // implementation to access latest process parameters in threadsafe manner. + void EndProcess (); +}; + + +#pragma pack(pop) // revert packing alignment +//---------------------------------<-EOF->----------------------------------// diff --git a/MediaClient/MediaClient/directx/include/XAPOFX.h b/MediaClient/MediaClient/directx/include/XAPOFX.h new file mode 100644 index 0000000..a5dbeef --- /dev/null +++ b/MediaClient/MediaClient/directx/include/XAPOFX.h @@ -0,0 +1,167 @@ +/*-========================================================================-_ + | - XAPOFX - | + | Copyright (c) Microsoft Corporation. All rights reserved. | + |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| + |PROJECT: XAPOFX MODEL: Unmanaged User-mode | + |VERSION: 1.3 EXCEPT: No Exceptions | + |CLASS: N / A MINREQ: WinXP, Xbox360 | + |BASE: N / A DIALECT: MSC++ 14.00 | + |>------------------------------------------------------------------------<| + | DUTY: Cross-platform Audio Processing Objects | + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ + NOTES: + 1. USE THE DEBUG DLL TO ENABLE PARAMETER VALIDATION VIA ASSERTS! + Here's how: + Copy XAPOFXDX_X.dll to where your application exists. + The debug DLL can be found under %WINDIR%\system32. + Rename XAPOFXDX_X.dll to XAPOFXX_X.dll to use the debug version. */ + +#pragma once +//---------------------------------------------------// +#include "comdecl.h" // for DEFINE_CLSID + +// FX class IDs +DEFINE_CLSID(FXEQ, A90BC001, E897, E897, 74, 39, 43, 55, 00, 00, 00, 00); +DEFINE_CLSID(FXMasteringLimiter, A90BC001, E897, E897, 74, 39, 43, 55, 00, 00, 00, 01); +DEFINE_CLSID(FXReverb, A90BC001, E897, E897, 74, 39, 43, 55, 00, 00, 00, 02); +DEFINE_CLSID(FXEcho, A90BC001, E897, E897, 74, 39, 43, 55, 00, 00, 00, 03); + + +#if !defined(GUID_DEFS_ONLY) // ignore rest if only GUID definitions requested + #if defined(_XBOX) // general windows and COM declarations + #include + #include + #else + #include + #include + #endif + #include // float bounds + + + // EQ parameter bounds (inclusive), used with XEQ: + #define FXEQ_MIN_FRAMERATE 22000 + #define FXEQ_MAX_FRAMERATE 48000 + + #define FXEQ_MIN_FREQUENCY_CENTER 20.0f + #define FXEQ_MAX_FREQUENCY_CENTER 20000.0f + #define FXEQ_DEFAULT_FREQUENCY_CENTER_0 100.0f // band 0 + #define FXEQ_DEFAULT_FREQUENCY_CENTER_1 800.0f // band 1 + #define FXEQ_DEFAULT_FREQUENCY_CENTER_2 2000.0f // band 2 + #define FXEQ_DEFAULT_FREQUENCY_CENTER_3 10000.0f // band 3 + + #define FXEQ_MIN_GAIN 0.126f // -18dB + #define FXEQ_MAX_GAIN 7.94f // +18dB + #define FXEQ_DEFAULT_GAIN 1.0f // 0dB change, all bands + + #define FXEQ_MIN_BANDWIDTH 0.1f + #define FXEQ_MAX_BANDWIDTH 2.0f + #define FXEQ_DEFAULT_BANDWIDTH 1.0f // all bands + + + // Mastering limiter parameter bounds (inclusive), used with XMasteringLimiter: + #define FXMASTERINGLIMITER_MIN_RELEASE 1 + #define FXMASTERINGLIMITER_MAX_RELEASE 20 + #define FXMASTERINGLIMITER_DEFAULT_RELEASE 6 + + #define FXMASTERINGLIMITER_MIN_LOUDNESS 1 + #define FXMASTERINGLIMITER_MAX_LOUDNESS 1800 + #define FXMASTERINGLIMITER_DEFAULT_LOUDNESS 1000 + + + // Reverb parameter bounds (inclusive), used with XReverb: + #define FXREVERB_MIN_DIFFUSION 0.0f + #define FXREVERB_MAX_DIFFUSION 1.0f + #define FXREVERB_DEFAULT_DIFFUSION 0.9f + + #define FXREVERB_MIN_ROOMSIZE 0.0001f + #define FXREVERB_MAX_ROOMSIZE 1.0f + #define FXREVERB_DEFAULT_ROOMSIZE 0.6f + + + // Echo parameter bounds (inclusive), used with XEcho: + #define FXECHO_MIN_WETDRYMIX 0.0f + #define FXECHO_MAX_WETDRYMIX 1.0f + #define FXECHO_DEFAULT_WETDRYMIX 0.5f + + #define FXECHO_MIN_FEEDBACK 0.0f + #define FXECHO_MAX_FEEDBACK 1.0f + #define FXECHO_DEFAULT_FEEDBACK 0.5f + + #define FXECHO_MIN_DELAY 1.0f + #define FXECHO_MAX_DELAY 2000.0f + #define FXECHO_DEFAULT_DELAY 500.0f + + +//-----------------------------------------------------// + #pragma pack(push, 1) // set packing alignment to ensure consistency across arbitrary build environments + + + // EQ parameters (4 bands), used with IXAPOParameters::SetParameters: + // The EQ supports only FLOAT32 audio foramts. + // The framerate must be within [22000, 48000] Hz. + typedef struct FXEQ_PARAMETERS { + float FrequencyCenter0; // center frequency in Hz, band 0 + float Gain0; // boost/cut + float Bandwidth0; // bandwidth, region of EQ is center frequency +/- bandwidth/2 + float FrequencyCenter1; // band 1 + float Gain1; + float Bandwidth1; + float FrequencyCenter2; // band 2 + float Gain2; + float Bandwidth2; + float FrequencyCenter3; // band 3 + float Gain3; + float Bandwidth3; + } FXEQ_PARAMETERS; + + + // Mastering limiter parameters, used with IXAPOParameters::SetParameters: + // The mastering limiter supports only FLOAT32 audio formats. + typedef struct FXMASTERINGLIMITER_PARAMETERS { + UINT32 Release; // release time (tuning factor with no specific units) + UINT32 Loudness; // loudness target (threshold) + } FXMASTERINGLIMITER_PARAMETERS; + + + // Reverb parameters, used with IXAPOParameters::SetParameters: + // The reverb supports only FLOAT32 audio formats with the following + // channel configurations: + // Input: Mono Output: Mono + // Input: Stereo Output: Stereo + typedef struct FXREVERB_PARAMETERS { + float Diffusion; // diffusion + float RoomSize; // room size + } FXREVERB_PARAMETERS; + + + // Echo parameters, used with IXAPOParameters::SetParameters: + // The echo supports only FLOAT32 audio formats. + typedef struct FXECHO_PARAMETERS { + float WetDryMix; // ratio of wet (processed) signal to dry (original) signal + float Feedback; // amount of output fed back into input + float Delay; // delay (all channels) in milliseconds + } FXECHO_PARAMETERS; + + +//-------------------------------------------------------------// + // function storage-class attribute and calltype + #if defined(_XBOX) || !defined(FXDLL) + #define FX_API_(type) EXTERN_C type STDAPIVCALLTYPE + #else + #if defined(FXEXPORT) + #define FX_API_(type) EXTERN_C __declspec(dllexport) type STDAPIVCALLTYPE + #else + #define FX_API_(type) EXTERN_C __declspec(dllimport) type STDAPIVCALLTYPE + #endif + #endif + #define FX_IMP_(type) type STDMETHODVCALLTYPE + + +//-------------------------------------------------------// + // creates instance of requested XAPO, use Release to free instance + FX_API_(HRESULT) CreateFX (REFCLSID clsid, __deref_out IUnknown** pEffect); + + + #pragma pack(pop) // revert packing alignment +#endif // !defined(GUID_DEFS_ONLY) +//---------------------------------<-EOF->----------------------------------// diff --git a/MediaClient/MediaClient/directx/include/XAudio2.h b/MediaClient/MediaClient/directx/include/XAudio2.h new file mode 100644 index 0000000..885b92f --- /dev/null +++ b/MediaClient/MediaClient/directx/include/XAudio2.h @@ -0,0 +1,1282 @@ +/************************************************************************** + * + * Copyright (c) Microsoft Corporation. All rights reserved. + * + * File: xaudio2.h + * Content: Declarations for the XAudio2 game audio API. + * + **************************************************************************/ + +#ifndef __XAUDIO2_INCLUDED__ +#define __XAUDIO2_INCLUDED__ + + +/************************************************************************** + * + * XAudio2 COM object class and interface IDs. + * + **************************************************************************/ + +#include // For DEFINE_CLSID and DEFINE_IID + +// XAudio 2.0 (March 2008 SDK) +//DEFINE_CLSID(XAudio2, fac23f48, 31f5, 45a8, b4, 9b, 52, 25, d6, 14, 01, aa); +//DEFINE_CLSID(XAudio2_Debug, fac23f48, 31f5, 45a8, b4, 9b, 52, 25, d6, 14, 01, db); + +// XAudio 2.1 (June 2008 SDK) +//DEFINE_CLSID(XAudio2, e21a7345, eb21, 468e, be, 50, 80, 4d, b9, 7c, f7, 08); +//DEFINE_CLSID(XAudio2_Debug, f7a76c21, 53d4, 46bb, ac, 53, 8b, 45, 9c, ae, 46, bd); + +// XAudio 2.2 (August 2008 SDK) +//DEFINE_CLSID(XAudio2, b802058a, 464a, 42db, bc, 10, b6, 50, d6, f2, 58, 6a); +//DEFINE_CLSID(XAudio2_Debug, 97dfb7e7, 5161, 4015, 87, a9, c7, 9e, 6a, 19, 52, cc); + +// XAudio 2.3 (November 2008 SDK) +//DEFINE_CLSID(XAudio2, 4c5e637a, 16c7, 4de3, 9c, 46, 5e, d2, 21, 81, 96, 2d); +//DEFINE_CLSID(XAudio2_Debug, ef0aa05d, 8075, 4e5d, be, ad, 45, be, 0c, 3c, cb, b3); + +// XAudio 2.4 (March 2009 SDK) +//DEFINE_CLSID(XAudio2, 03219e78, 5bc3, 44d1, b9, 2e, f6, 3d, 89, cc, 65, 26); +//DEFINE_CLSID(XAudio2_Debug, 4256535c, 1ea4, 4d4b, 8a, d5, f9, db, 76, 2e, ca, 9e); + +// XAudio 2.5 (August 2009 SDK) +//DEFINE_CLSID(XAudio2, 4c9b6dde, 6809, 46e6, a2, 78, 9b, 6a, 97, 58, 86, 70); +//DEFINE_CLSID(XAudio2_Debug, 715bdd1a, aa82, 436b, b0, fa, 6a, ce, a3, 9b, d0, a1); + +// XAudio 2.6 (February 2010 SDK) +//DEFINE_CLSID(XAudio2, 3eda9b49, 2085, 498b, 9b, b2, 39, a6, 77, 84, 93, de); +//DEFINE_CLSID(XAudio2_Debug, 47199894, 7cc2, 444d, 98, 73, ce, d2, 56, 2c, c6, 0e); + +// XAudio 2.7 (June 2010 SDK) +DEFINE_CLSID(XAudio2, 5a508685, a254, 4fba, 9b, 82, 9a, 24, b0, 03, 06, af); +DEFINE_CLSID(XAudio2_Debug, db05ea35, 0329, 4d4b, a5, 3a, 6d, ea, d0, 3d, 38, 52); +DEFINE_IID(IXAudio2, 8bcf1f58, 9fe7, 4583, 8a, c6, e2, ad, c4, 65, c8, bb); + + +// Ignore the rest of this header if only the GUID definitions were requested +#ifndef GUID_DEFS_ONLY + +#ifdef _XBOX + #include // Xbox COM declarations (IUnknown, etc) +#else + #include // Windows COM declarations +#endif + +#include // Markers for documenting API semantics +#include // Basic audio data types and constants +#include // Data types and constants for XMA2 audio + +// All structures defined in this file use tight field packing +#pragma pack(push, 1) + + +/************************************************************************** + * + * XAudio2 constants, flags and error codes. + * + **************************************************************************/ + +// Numeric boundary values +#define XAUDIO2_MAX_BUFFER_BYTES 0x80000000 // Maximum bytes allowed in a source buffer +#define XAUDIO2_MAX_QUEUED_BUFFERS 64 // Maximum buffers allowed in a voice queue +#define XAUDIO2_MAX_BUFFERS_SYSTEM 2 // Maximum buffers allowed for system threads (Xbox 360 only) +#define XAUDIO2_MAX_AUDIO_CHANNELS 64 // Maximum channels in an audio stream +#define XAUDIO2_MIN_SAMPLE_RATE 1000 // Minimum audio sample rate supported +#define XAUDIO2_MAX_SAMPLE_RATE 200000 // Maximum audio sample rate supported +#define XAUDIO2_MAX_VOLUME_LEVEL 16777216.0f // Maximum acceptable volume level (2^24) +#define XAUDIO2_MIN_FREQ_RATIO (1/1024.0f) // Minimum SetFrequencyRatio argument +#define XAUDIO2_MAX_FREQ_RATIO 1024.0f // Maximum MaxFrequencyRatio argument +#define XAUDIO2_DEFAULT_FREQ_RATIO 2.0f // Default MaxFrequencyRatio argument +#define XAUDIO2_MAX_FILTER_ONEOVERQ 1.5f // Maximum XAUDIO2_FILTER_PARAMETERS.OneOverQ +#define XAUDIO2_MAX_FILTER_FREQUENCY 1.0f // Maximum XAUDIO2_FILTER_PARAMETERS.Frequency +#define XAUDIO2_MAX_LOOP_COUNT 254 // Maximum non-infinite XAUDIO2_BUFFER.LoopCount +#define XAUDIO2_MAX_INSTANCES 8 // Maximum simultaneous XAudio2 objects on Xbox 360 + +// For XMA voices on Xbox 360 there is an additional restriction on the MaxFrequencyRatio +// argument and the voice's sample rate: the product of these numbers cannot exceed 600000 +// for one-channel voices or 300000 for voices with more than one channel. +#define XAUDIO2_MAX_RATIO_TIMES_RATE_XMA_MONO 600000 +#define XAUDIO2_MAX_RATIO_TIMES_RATE_XMA_MULTICHANNEL 300000 + +// Numeric values with special meanings +#define XAUDIO2_COMMIT_NOW 0 // Used as an OperationSet argument +#define XAUDIO2_COMMIT_ALL 0 // Used in IXAudio2::CommitChanges +#define XAUDIO2_INVALID_OPSET (UINT32)(-1) // Not allowed for OperationSet arguments +#define XAUDIO2_NO_LOOP_REGION 0 // Used in XAUDIO2_BUFFER.LoopCount +#define XAUDIO2_LOOP_INFINITE 255 // Used in XAUDIO2_BUFFER.LoopCount +#define XAUDIO2_DEFAULT_CHANNELS 0 // Used in CreateMasteringVoice +#define XAUDIO2_DEFAULT_SAMPLERATE 0 // Used in CreateMasteringVoice + +// Flags +#define XAUDIO2_DEBUG_ENGINE 0x0001 // Used in XAudio2Create on Windows only +#define XAUDIO2_VOICE_NOPITCH 0x0002 // Used in IXAudio2::CreateSourceVoice +#define XAUDIO2_VOICE_NOSRC 0x0004 // Used in IXAudio2::CreateSourceVoice +#define XAUDIO2_VOICE_USEFILTER 0x0008 // Used in IXAudio2::CreateSource/SubmixVoice +#define XAUDIO2_VOICE_MUSIC 0x0010 // Used in IXAudio2::CreateSourceVoice +#define XAUDIO2_PLAY_TAILS 0x0020 // Used in IXAudio2SourceVoice::Stop +#define XAUDIO2_END_OF_STREAM 0x0040 // Used in XAUDIO2_BUFFER.Flags +#define XAUDIO2_SEND_USEFILTER 0x0080 // Used in XAUDIO2_SEND_DESCRIPTOR.Flags + +// Default parameters for the built-in filter +#define XAUDIO2_DEFAULT_FILTER_TYPE LowPassFilter +#define XAUDIO2_DEFAULT_FILTER_FREQUENCY XAUDIO2_MAX_FILTER_FREQUENCY +#define XAUDIO2_DEFAULT_FILTER_ONEOVERQ 1.0f + +// Internal XAudio2 constants +#ifdef _XBOX + #define XAUDIO2_QUANTUM_NUMERATOR 2 // On Xbox 360, XAudio2 processes audio + #define XAUDIO2_QUANTUM_DENOMINATOR 375 // in 5.333ms chunks (= 2/375 seconds) +#else + #define XAUDIO2_QUANTUM_NUMERATOR 1 // On Windows, XAudio2 processes audio + #define XAUDIO2_QUANTUM_DENOMINATOR 100 // in 10ms chunks (= 1/100 seconds) +#endif +#define XAUDIO2_QUANTUM_MS (1000.0f * XAUDIO2_QUANTUM_NUMERATOR / XAUDIO2_QUANTUM_DENOMINATOR) + +// XAudio2 error codes +#define FACILITY_XAUDIO2 0x896 +#define XAUDIO2_E_INVALID_CALL 0x88960001 // An API call or one of its arguments was illegal +#define XAUDIO2_E_XMA_DECODER_ERROR 0x88960002 // The XMA hardware suffered an unrecoverable error +#define XAUDIO2_E_XAPO_CREATION_FAILED 0x88960003 // XAudio2 failed to initialize an XAPO effect +#define XAUDIO2_E_DEVICE_INVALIDATED 0x88960004 // An audio device became unusable (unplugged, etc) + + +/************************************************************************** + * + * Forward declarations for the XAudio2 interfaces. + * + **************************************************************************/ + +#ifdef __cplusplus + #define FWD_DECLARE(x) interface x +#else + #define FWD_DECLARE(x) typedef interface x x +#endif + +FWD_DECLARE(IXAudio2); +FWD_DECLARE(IXAudio2Voice); +FWD_DECLARE(IXAudio2SourceVoice); +FWD_DECLARE(IXAudio2SubmixVoice); +FWD_DECLARE(IXAudio2MasteringVoice); +FWD_DECLARE(IXAudio2EngineCallback); +FWD_DECLARE(IXAudio2VoiceCallback); + + +/************************************************************************** + * + * XAudio2 structures and enumerations. + * + **************************************************************************/ + +// Used in IXAudio2::Initialize +#ifdef _XBOX + typedef enum XAUDIO2_XBOX_HWTHREAD_SPECIFIER + { + XboxThread0 = 0x01, + XboxThread1 = 0x02, + XboxThread2 = 0x04, + XboxThread3 = 0x08, + XboxThread4 = 0x10, + XboxThread5 = 0x20, + XAUDIO2_ANY_PROCESSOR = XboxThread4, + XAUDIO2_DEFAULT_PROCESSOR = XAUDIO2_ANY_PROCESSOR + } XAUDIO2_XBOX_HWTHREAD_SPECIFIER, XAUDIO2_PROCESSOR; +#else + typedef enum XAUDIO2_WINDOWS_PROCESSOR_SPECIFIER + { + Processor1 = 0x00000001, + Processor2 = 0x00000002, + Processor3 = 0x00000004, + Processor4 = 0x00000008, + Processor5 = 0x00000010, + Processor6 = 0x00000020, + Processor7 = 0x00000040, + Processor8 = 0x00000080, + Processor9 = 0x00000100, + Processor10 = 0x00000200, + Processor11 = 0x00000400, + Processor12 = 0x00000800, + Processor13 = 0x00001000, + Processor14 = 0x00002000, + Processor15 = 0x00004000, + Processor16 = 0x00008000, + Processor17 = 0x00010000, + Processor18 = 0x00020000, + Processor19 = 0x00040000, + Processor20 = 0x00080000, + Processor21 = 0x00100000, + Processor22 = 0x00200000, + Processor23 = 0x00400000, + Processor24 = 0x00800000, + Processor25 = 0x01000000, + Processor26 = 0x02000000, + Processor27 = 0x04000000, + Processor28 = 0x08000000, + Processor29 = 0x10000000, + Processor30 = 0x20000000, + Processor31 = 0x40000000, + Processor32 = 0x80000000, + XAUDIO2_ANY_PROCESSOR = 0xffffffff, + XAUDIO2_DEFAULT_PROCESSOR = XAUDIO2_ANY_PROCESSOR + } XAUDIO2_WINDOWS_PROCESSOR_SPECIFIER, XAUDIO2_PROCESSOR; +#endif + +// Used in XAUDIO2_DEVICE_DETAILS below to describe the types of applications +// that the user has specified each device as a default for. 0 means that the +// device isn't the default for any role. +typedef enum XAUDIO2_DEVICE_ROLE +{ + NotDefaultDevice = 0x0, + DefaultConsoleDevice = 0x1, + DefaultMultimediaDevice = 0x2, + DefaultCommunicationsDevice = 0x4, + DefaultGameDevice = 0x8, + GlobalDefaultDevice = 0xf, + InvalidDeviceRole = ~GlobalDefaultDevice +} XAUDIO2_DEVICE_ROLE; + +// Returned by IXAudio2::GetDeviceDetails +typedef struct XAUDIO2_DEVICE_DETAILS +{ + WCHAR DeviceID[256]; // String identifier for the audio device. + WCHAR DisplayName[256]; // Friendly name suitable for display to a human. + XAUDIO2_DEVICE_ROLE Role; // Roles that the device should be used for. + WAVEFORMATEXTENSIBLE OutputFormat; // The device's native PCM audio output format. +} XAUDIO2_DEVICE_DETAILS; + +// Returned by IXAudio2Voice::GetVoiceDetails +typedef struct XAUDIO2_VOICE_DETAILS +{ + UINT32 CreationFlags; // Flags the voice was created with. + UINT32 InputChannels; // Channels in the voice's input audio. + UINT32 InputSampleRate; // Sample rate of the voice's input audio. +} XAUDIO2_VOICE_DETAILS; + +// Used in XAUDIO2_VOICE_SENDS below +typedef struct XAUDIO2_SEND_DESCRIPTOR +{ + UINT32 Flags; // Either 0 or XAUDIO2_SEND_USEFILTER. + IXAudio2Voice* pOutputVoice; // This send's destination voice. +} XAUDIO2_SEND_DESCRIPTOR; + +// Used in the voice creation functions and in IXAudio2Voice::SetOutputVoices +typedef struct XAUDIO2_VOICE_SENDS +{ + UINT32 SendCount; // Number of sends from this voice. + XAUDIO2_SEND_DESCRIPTOR* pSends; // Array of SendCount send descriptors. +} XAUDIO2_VOICE_SENDS; + +// Used in XAUDIO2_EFFECT_CHAIN below +typedef struct XAUDIO2_EFFECT_DESCRIPTOR +{ + IUnknown* pEffect; // Pointer to the effect object's IUnknown interface. + BOOL InitialState; // TRUE if the effect should begin in the enabled state. + UINT32 OutputChannels; // How many output channels the effect should produce. +} XAUDIO2_EFFECT_DESCRIPTOR; + +// Used in the voice creation functions and in IXAudio2Voice::SetEffectChain +typedef struct XAUDIO2_EFFECT_CHAIN +{ + UINT32 EffectCount; // Number of effects in this voice's effect chain. + XAUDIO2_EFFECT_DESCRIPTOR* pEffectDescriptors; // Array of effect descriptors. +} XAUDIO2_EFFECT_CHAIN; + +// Used in XAUDIO2_FILTER_PARAMETERS below +typedef enum XAUDIO2_FILTER_TYPE +{ + LowPassFilter, // Attenuates frequencies above the cutoff frequency. + BandPassFilter, // Attenuates frequencies outside a given range. + HighPassFilter, // Attenuates frequencies below the cutoff frequency. + NotchFilter // Attenuates frequencies inside a given range. +} XAUDIO2_FILTER_TYPE; + +// Used in IXAudio2Voice::Set/GetFilterParameters and Set/GetOutputFilterParameters +typedef struct XAUDIO2_FILTER_PARAMETERS +{ + XAUDIO2_FILTER_TYPE Type; // Low-pass, band-pass or high-pass. + float Frequency; // Radian frequency (2 * sin(pi*CutoffFrequency/SampleRate)); + // must be >= 0 and <= XAUDIO2_MAX_FILTER_FREQUENCY + // (giving a maximum CutoffFrequency of SampleRate/6). + float OneOverQ; // Reciprocal of the filter's quality factor Q; + // must be > 0 and <= XAUDIO2_MAX_FILTER_ONEOVERQ. +} XAUDIO2_FILTER_PARAMETERS; + +// Used in IXAudio2SourceVoice::SubmitSourceBuffer +typedef struct XAUDIO2_BUFFER +{ + UINT32 Flags; // Either 0 or XAUDIO2_END_OF_STREAM. + UINT32 AudioBytes; // Size of the audio data buffer in bytes. + const BYTE* pAudioData; // Pointer to the audio data buffer. + UINT32 PlayBegin; // First sample in this buffer to be played. + UINT32 PlayLength; // Length of the region to be played in samples, + // or 0 to play the whole buffer. + UINT32 LoopBegin; // First sample of the region to be looped. + UINT32 LoopLength; // Length of the desired loop region in samples, + // or 0 to loop the entire buffer. + UINT32 LoopCount; // Number of times to repeat the loop region, + // or XAUDIO2_LOOP_INFINITE to loop forever. + void* pContext; // Context value to be passed back in callbacks. +} XAUDIO2_BUFFER; + +// Used in IXAudio2SourceVoice::SubmitSourceBuffer when submitting XWMA data. +// NOTE: If an XWMA sound is submitted in more than one buffer, each buffer's +// pDecodedPacketCumulativeBytes[PacketCount-1] value must be subtracted from +// all the entries in the next buffer's pDecodedPacketCumulativeBytes array. +// And whether a sound is submitted in more than one buffer or not, the final +// buffer of the sound should use the XAUDIO2_END_OF_STREAM flag, or else the +// client must call IXAudio2SourceVoice::Discontinuity after submitting it. +typedef struct XAUDIO2_BUFFER_WMA +{ + const UINT32* pDecodedPacketCumulativeBytes; // Decoded packet's cumulative size array. + // Each element is the number of bytes accumulated + // when the corresponding XWMA packet is decoded in + // order. The array must have PacketCount elements. + UINT32 PacketCount; // Number of XWMA packets submitted. Must be >= 1 and + // divide evenly into XAUDIO2_BUFFER.AudioBytes. +} XAUDIO2_BUFFER_WMA; + +// Returned by IXAudio2SourceVoice::GetState +typedef struct XAUDIO2_VOICE_STATE +{ + void* pCurrentBufferContext; // The pContext value provided in the XAUDIO2_BUFFER + // that is currently being processed, or NULL if + // there are no buffers in the queue. + UINT32 BuffersQueued; // Number of buffers currently queued on the voice + // (including the one that is being processed). + UINT64 SamplesPlayed; // Total number of samples produced by the voice since + // it began processing the current audio stream. +} XAUDIO2_VOICE_STATE; + +// Returned by IXAudio2::GetPerformanceData +typedef struct XAUDIO2_PERFORMANCE_DATA +{ + // CPU usage information + UINT64 AudioCyclesSinceLastQuery; // CPU cycles spent on audio processing since the + // last call to StartEngine or GetPerformanceData. + UINT64 TotalCyclesSinceLastQuery; // Total CPU cycles elapsed since the last call + // (only counts the CPU XAudio2 is running on). + UINT32 MinimumCyclesPerQuantum; // Fewest CPU cycles spent processing any one + // audio quantum since the last call. + UINT32 MaximumCyclesPerQuantum; // Most CPU cycles spent processing any one + // audio quantum since the last call. + + // Memory usage information + UINT32 MemoryUsageInBytes; // Total heap space currently in use. + + // Audio latency and glitching information + UINT32 CurrentLatencyInSamples; // Minimum delay from when a sample is read from a + // source buffer to when it reaches the speakers. + UINT32 GlitchesSinceEngineStarted; // Audio dropouts since the engine was started. + + // Data about XAudio2's current workload + UINT32 ActiveSourceVoiceCount; // Source voices currently playing. + UINT32 TotalSourceVoiceCount; // Source voices currently existing. + UINT32 ActiveSubmixVoiceCount; // Submix voices currently playing/existing. + + UINT32 ActiveResamplerCount; // Resample xAPOs currently active. + UINT32 ActiveMatrixMixCount; // MatrixMix xAPOs currently active. + + // Usage of the hardware XMA decoder (Xbox 360 only) + UINT32 ActiveXmaSourceVoices; // Number of source voices decoding XMA data. + UINT32 ActiveXmaStreams; // A voice can use more than one XMA stream. +} XAUDIO2_PERFORMANCE_DATA; + +// Used in IXAudio2::SetDebugConfiguration +typedef struct XAUDIO2_DEBUG_CONFIGURATION +{ + UINT32 TraceMask; // Bitmap of enabled debug message types. + UINT32 BreakMask; // Message types that will break into the debugger. + BOOL LogThreadID; // Whether to log the thread ID with each message. + BOOL LogFileline; // Whether to log the source file and line number. + BOOL LogFunctionName; // Whether to log the function name. + BOOL LogTiming; // Whether to log message timestamps. +} XAUDIO2_DEBUG_CONFIGURATION; + +// Values for the TraceMask and BreakMask bitmaps. Only ERRORS and WARNINGS +// are valid in BreakMask. WARNINGS implies ERRORS, DETAIL implies INFO, and +// FUNC_CALLS implies API_CALLS. By default, TraceMask is ERRORS and WARNINGS +// and all the other settings are zero. +#define XAUDIO2_LOG_ERRORS 0x0001 // For handled errors with serious effects. +#define XAUDIO2_LOG_WARNINGS 0x0002 // For handled errors that may be recoverable. +#define XAUDIO2_LOG_INFO 0x0004 // Informational chit-chat (e.g. state changes). +#define XAUDIO2_LOG_DETAIL 0x0008 // More detailed chit-chat. +#define XAUDIO2_LOG_API_CALLS 0x0010 // Public API function entries and exits. +#define XAUDIO2_LOG_FUNC_CALLS 0x0020 // Internal function entries and exits. +#define XAUDIO2_LOG_TIMING 0x0040 // Delays detected and other timing data. +#define XAUDIO2_LOG_LOCKS 0x0080 // Usage of critical sections and mutexes. +#define XAUDIO2_LOG_MEMORY 0x0100 // Memory heap usage information. +#define XAUDIO2_LOG_STREAMING 0x1000 // Audio streaming information. + + +/************************************************************************** + * + * IXAudio2: Top-level XAudio2 COM interface. + * + **************************************************************************/ + +// Use default arguments if compiling as C++ +#ifdef __cplusplus + #define X2DEFAULT(x) =x +#else + #define X2DEFAULT(x) +#endif + +#undef INTERFACE +#define INTERFACE IXAudio2 +DECLARE_INTERFACE_(IXAudio2, IUnknown) +{ + // NAME: IXAudio2::QueryInterface + // DESCRIPTION: Queries for a given COM interface on the XAudio2 object. + // Only IID_IUnknown and IID_IXAudio2 are supported. + // + // ARGUMENTS: + // riid - IID of the interface to be obtained. + // ppvInterface - Returns a pointer to the requested interface. + // + STDMETHOD(QueryInterface) (THIS_ REFIID riid, __deref_out void** ppvInterface) PURE; + + // NAME: IXAudio2::AddRef + // DESCRIPTION: Adds a reference to the XAudio2 object. + // + STDMETHOD_(ULONG, AddRef) (THIS) PURE; + + // NAME: IXAudio2::Release + // DESCRIPTION: Releases a reference to the XAudio2 object. + // + STDMETHOD_(ULONG, Release) (THIS) PURE; + + // NAME: IXAudio2::GetDeviceCount + // DESCRIPTION: Returns the number of audio output devices available. + // + // ARGUMENTS: + // pCount - Returns the device count. + // + STDMETHOD(GetDeviceCount) (THIS_ __out UINT32* pCount) PURE; + + // NAME: IXAudio2::GetDeviceDetails + // DESCRIPTION: Returns information about the device with the given index. + // + // ARGUMENTS: + // Index - Index of the device to be queried. + // pDeviceDetails - Returns the device details. + // + STDMETHOD(GetDeviceDetails) (THIS_ UINT32 Index, __out XAUDIO2_DEVICE_DETAILS* pDeviceDetails) PURE; + + // NAME: IXAudio2::Initialize + // DESCRIPTION: Sets global XAudio2 parameters and prepares it for use. + // + // ARGUMENTS: + // Flags - Flags specifying the XAudio2 object's behavior. Currently unused. + // XAudio2Processor - An XAUDIO2_PROCESSOR enumeration value that specifies + // the hardware thread (Xbox) or processor (Windows) that XAudio2 will use. + // The enumeration values are platform-specific; platform-independent code + // can use XAUDIO2_DEFAULT_PROCESSOR to use the default on each platform. + // + STDMETHOD(Initialize) (THIS_ UINT32 Flags X2DEFAULT(0), + XAUDIO2_PROCESSOR XAudio2Processor X2DEFAULT(XAUDIO2_DEFAULT_PROCESSOR)) PURE; + + // NAME: IXAudio2::RegisterForCallbacks + // DESCRIPTION: Adds a new client to receive XAudio2's engine callbacks. + // + // ARGUMENTS: + // pCallback - Callback interface to be called during each processing pass. + // + STDMETHOD(RegisterForCallbacks) (__in IXAudio2EngineCallback* pCallback) PURE; + + // NAME: IXAudio2::UnregisterForCallbacks + // DESCRIPTION: Removes an existing receiver of XAudio2 engine callbacks. + // + // ARGUMENTS: + // pCallback - Previously registered callback interface to be removed. + // + STDMETHOD_(void, UnregisterForCallbacks) (__in IXAudio2EngineCallback* pCallback) PURE; + + // NAME: IXAudio2::CreateSourceVoice + // DESCRIPTION: Creates and configures a source voice. + // + // ARGUMENTS: + // ppSourceVoice - Returns the new object's IXAudio2SourceVoice interface. + // pSourceFormat - Format of the audio that will be fed to the voice. + // Flags - XAUDIO2_VOICE flags specifying the source voice's behavior. + // MaxFrequencyRatio - Maximum SetFrequencyRatio argument to be allowed. + // pCallback - Optional pointer to a client-provided callback interface. + // pSendList - Optional list of voices this voice should send audio to. + // pEffectChain - Optional list of effects to apply to the audio data. + // + STDMETHOD(CreateSourceVoice) (THIS_ __deref_out IXAudio2SourceVoice** ppSourceVoice, + __in const WAVEFORMATEX* pSourceFormat, + UINT32 Flags X2DEFAULT(0), + float MaxFrequencyRatio X2DEFAULT(XAUDIO2_DEFAULT_FREQ_RATIO), + __in_opt IXAudio2VoiceCallback* pCallback X2DEFAULT(NULL), + __in_opt const XAUDIO2_VOICE_SENDS* pSendList X2DEFAULT(NULL), + __in_opt const XAUDIO2_EFFECT_CHAIN* pEffectChain X2DEFAULT(NULL)) PURE; + + // NAME: IXAudio2::CreateSubmixVoice + // DESCRIPTION: Creates and configures a submix voice. + // + // ARGUMENTS: + // ppSubmixVoice - Returns the new object's IXAudio2SubmixVoice interface. + // InputChannels - Number of channels in this voice's input audio data. + // InputSampleRate - Sample rate of this voice's input audio data. + // Flags - XAUDIO2_VOICE flags specifying the submix voice's behavior. + // ProcessingStage - Arbitrary number that determines the processing order. + // pSendList - Optional list of voices this voice should send audio to. + // pEffectChain - Optional list of effects to apply to the audio data. + // + STDMETHOD(CreateSubmixVoice) (THIS_ __deref_out IXAudio2SubmixVoice** ppSubmixVoice, + UINT32 InputChannels, UINT32 InputSampleRate, + UINT32 Flags X2DEFAULT(0), UINT32 ProcessingStage X2DEFAULT(0), + __in_opt const XAUDIO2_VOICE_SENDS* pSendList X2DEFAULT(NULL), + __in_opt const XAUDIO2_EFFECT_CHAIN* pEffectChain X2DEFAULT(NULL)) PURE; + + + // NAME: IXAudio2::CreateMasteringVoice + // DESCRIPTION: Creates and configures a mastering voice. + // + // ARGUMENTS: + // ppMasteringVoice - Returns the new object's IXAudio2MasteringVoice interface. + // InputChannels - Number of channels in this voice's input audio data. + // InputSampleRate - Sample rate of this voice's input audio data. + // Flags - XAUDIO2_VOICE flags specifying the mastering voice's behavior. + // DeviceIndex - Identifier of the device to receive the output audio. + // pEffectChain - Optional list of effects to apply to the audio data. + // + STDMETHOD(CreateMasteringVoice) (THIS_ __deref_out IXAudio2MasteringVoice** ppMasteringVoice, + UINT32 InputChannels X2DEFAULT(XAUDIO2_DEFAULT_CHANNELS), + UINT32 InputSampleRate X2DEFAULT(XAUDIO2_DEFAULT_SAMPLERATE), + UINT32 Flags X2DEFAULT(0), UINT32 DeviceIndex X2DEFAULT(0), + __in_opt const XAUDIO2_EFFECT_CHAIN* pEffectChain X2DEFAULT(NULL)) PURE; + + // NAME: IXAudio2::StartEngine + // DESCRIPTION: Creates and starts the audio processing thread. + // + STDMETHOD(StartEngine) (THIS) PURE; + + // NAME: IXAudio2::StopEngine + // DESCRIPTION: Stops and destroys the audio processing thread. + // + STDMETHOD_(void, StopEngine) (THIS) PURE; + + // NAME: IXAudio2::CommitChanges + // DESCRIPTION: Atomically applies a set of operations previously tagged + // with a given identifier. + // + // ARGUMENTS: + // OperationSet - Identifier of the set of operations to be applied. + // + STDMETHOD(CommitChanges) (THIS_ UINT32 OperationSet) PURE; + + // NAME: IXAudio2::GetPerformanceData + // DESCRIPTION: Returns current resource usage details: memory, CPU, etc. + // + // ARGUMENTS: + // pPerfData - Returns the performance data structure. + // + STDMETHOD_(void, GetPerformanceData) (THIS_ __out XAUDIO2_PERFORMANCE_DATA* pPerfData) PURE; + + // NAME: IXAudio2::SetDebugConfiguration + // DESCRIPTION: Configures XAudio2's debug output (in debug builds only). + // + // ARGUMENTS: + // pDebugConfiguration - Structure describing the debug output behavior. + // pReserved - Optional parameter; must be NULL. + // + STDMETHOD_(void, SetDebugConfiguration) (THIS_ __in_opt const XAUDIO2_DEBUG_CONFIGURATION* pDebugConfiguration, + __in_opt __reserved void* pReserved X2DEFAULT(NULL)) PURE; +}; + + +/************************************************************************** + * + * IXAudio2Voice: Base voice management interface. + * + **************************************************************************/ + +#undef INTERFACE +#define INTERFACE IXAudio2Voice +DECLARE_INTERFACE(IXAudio2Voice) +{ + // These methods are declared in a macro so that the same declarations + // can be used in the derived voice types (IXAudio2SourceVoice, etc). + + #define Declare_IXAudio2Voice_Methods() \ + \ + /* NAME: IXAudio2Voice::GetVoiceDetails + // DESCRIPTION: Returns the basic characteristics of this voice. + // + // ARGUMENTS: + // pVoiceDetails - Returns the voice's details. + */\ + STDMETHOD_(void, GetVoiceDetails) (THIS_ __out XAUDIO2_VOICE_DETAILS* pVoiceDetails) PURE; \ + \ + /* NAME: IXAudio2Voice::SetOutputVoices + // DESCRIPTION: Replaces the set of submix/mastering voices that receive + // this voice's output. + // + // ARGUMENTS: + // pSendList - Optional list of voices this voice should send audio to. + */\ + STDMETHOD(SetOutputVoices) (THIS_ __in_opt const XAUDIO2_VOICE_SENDS* pSendList) PURE; \ + \ + /* NAME: IXAudio2Voice::SetEffectChain + // DESCRIPTION: Replaces this voice's current effect chain with a new one. + // + // ARGUMENTS: + // pEffectChain - Structure describing the new effect chain to be used. + */\ + STDMETHOD(SetEffectChain) (THIS_ __in_opt const XAUDIO2_EFFECT_CHAIN* pEffectChain) PURE; \ + \ + /* NAME: IXAudio2Voice::EnableEffect + // DESCRIPTION: Enables an effect in this voice's effect chain. + // + // ARGUMENTS: + // EffectIndex - Index of an effect within this voice's effect chain. + // OperationSet - Used to identify this call as part of a deferred batch. + */\ + STDMETHOD(EnableEffect) (THIS_ UINT32 EffectIndex, \ + UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; \ + \ + /* NAME: IXAudio2Voice::DisableEffect + // DESCRIPTION: Disables an effect in this voice's effect chain. + // + // ARGUMENTS: + // EffectIndex - Index of an effect within this voice's effect chain. + // OperationSet - Used to identify this call as part of a deferred batch. + */\ + STDMETHOD(DisableEffect) (THIS_ UINT32 EffectIndex, \ + UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; \ + \ + /* NAME: IXAudio2Voice::GetEffectState + // DESCRIPTION: Returns the running state of an effect. + // + // ARGUMENTS: + // EffectIndex - Index of an effect within this voice's effect chain. + // pEnabled - Returns the enabled/disabled state of the given effect. + */\ + STDMETHOD_(void, GetEffectState) (THIS_ UINT32 EffectIndex, __out BOOL* pEnabled) PURE; \ + \ + /* NAME: IXAudio2Voice::SetEffectParameters + // DESCRIPTION: Sets effect-specific parameters. + // + // REMARKS: Unlike IXAPOParameters::SetParameters, this method may + // be called from any thread. XAudio2 implements + // appropriate synchronization to copy the parameters to the + // realtime audio processing thread. + // + // ARGUMENTS: + // EffectIndex - Index of an effect within this voice's effect chain. + // pParameters - Pointer to an effect-specific parameters block. + // ParametersByteSize - Size of the pParameters array in bytes. + // OperationSet - Used to identify this call as part of a deferred batch. + */\ + STDMETHOD(SetEffectParameters) (THIS_ UINT32 EffectIndex, \ + __in_bcount(ParametersByteSize) const void* pParameters, \ + UINT32 ParametersByteSize, \ + UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; \ + \ + /* NAME: IXAudio2Voice::GetEffectParameters + // DESCRIPTION: Obtains the current effect-specific parameters. + // + // ARGUMENTS: + // EffectIndex - Index of an effect within this voice's effect chain. + // pParameters - Returns the current values of the effect-specific parameters. + // ParametersByteSize - Size of the pParameters array in bytes. + */\ + STDMETHOD(GetEffectParameters) (THIS_ UINT32 EffectIndex, \ + __out_bcount(ParametersByteSize) void* pParameters, \ + UINT32 ParametersByteSize) PURE; \ + \ + /* NAME: IXAudio2Voice::SetFilterParameters + // DESCRIPTION: Sets this voice's filter parameters. + // + // ARGUMENTS: + // pParameters - Pointer to the filter's parameter structure. + // OperationSet - Used to identify this call as part of a deferred batch. + */\ + STDMETHOD(SetFilterParameters) (THIS_ __in const XAUDIO2_FILTER_PARAMETERS* pParameters, \ + UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; \ + \ + /* NAME: IXAudio2Voice::GetFilterParameters + // DESCRIPTION: Returns this voice's current filter parameters. + // + // ARGUMENTS: + // pParameters - Returns the filter parameters. + */\ + STDMETHOD_(void, GetFilterParameters) (THIS_ __out XAUDIO2_FILTER_PARAMETERS* pParameters) PURE; \ + \ + /* NAME: IXAudio2Voice::SetOutputFilterParameters + // DESCRIPTION: Sets the filter parameters on one of this voice's sends. + // + // ARGUMENTS: + // pDestinationVoice - Destination voice of the send whose filter parameters will be set. + // pParameters - Pointer to the filter's parameter structure. + // OperationSet - Used to identify this call as part of a deferred batch. + */\ + STDMETHOD(SetOutputFilterParameters) (THIS_ __in_opt IXAudio2Voice* pDestinationVoice, \ + __in const XAUDIO2_FILTER_PARAMETERS* pParameters, \ + UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; \ + \ + /* NAME: IXAudio2Voice::GetOutputFilterParameters + // DESCRIPTION: Returns the filter parameters from one of this voice's sends. + // + // ARGUMENTS: + // pDestinationVoice - Destination voice of the send whose filter parameters will be read. + // pParameters - Returns the filter parameters. + */\ + STDMETHOD_(void, GetOutputFilterParameters) (THIS_ __in_opt IXAudio2Voice* pDestinationVoice, \ + __out XAUDIO2_FILTER_PARAMETERS* pParameters) PURE; \ + \ + /* NAME: IXAudio2Voice::SetVolume + // DESCRIPTION: Sets this voice's overall volume level. + // + // ARGUMENTS: + // Volume - New overall volume level to be used, as an amplitude factor. + // OperationSet - Used to identify this call as part of a deferred batch. + */\ + STDMETHOD(SetVolume) (THIS_ float Volume, \ + UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; \ + \ + /* NAME: IXAudio2Voice::GetVolume + // DESCRIPTION: Obtains this voice's current overall volume level. + // + // ARGUMENTS: + // pVolume: Returns the voice's current overall volume level. + */\ + STDMETHOD_(void, GetVolume) (THIS_ __out float* pVolume) PURE; \ + \ + /* NAME: IXAudio2Voice::SetChannelVolumes + // DESCRIPTION: Sets this voice's per-channel volume levels. + // + // ARGUMENTS: + // Channels - Used to confirm the voice's channel count. + // pVolumes - Array of per-channel volume levels to be used. + // OperationSet - Used to identify this call as part of a deferred batch. + */\ + STDMETHOD(SetChannelVolumes) (THIS_ UINT32 Channels, __in_ecount(Channels) const float* pVolumes, \ + UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; \ + \ + /* NAME: IXAudio2Voice::GetChannelVolumes + // DESCRIPTION: Returns this voice's current per-channel volume levels. + // + // ARGUMENTS: + // Channels - Used to confirm the voice's channel count. + // pVolumes - Returns an array of the current per-channel volume levels. + */\ + STDMETHOD_(void, GetChannelVolumes) (THIS_ UINT32 Channels, __out_ecount(Channels) float* pVolumes) PURE; \ + \ + /* NAME: IXAudio2Voice::SetOutputMatrix + // DESCRIPTION: Sets the volume levels used to mix from each channel of this + // voice's output audio to each channel of a given destination + // voice's input audio. + // + // ARGUMENTS: + // pDestinationVoice - The destination voice whose mix matrix to change. + // SourceChannels - Used to confirm this voice's output channel count + // (the number of channels produced by the last effect in the chain). + // DestinationChannels - Confirms the destination voice's input channels. + // pLevelMatrix - Array of [SourceChannels * DestinationChannels] send + // levels. The level used to send from source channel S to destination + // channel D should be in pLevelMatrix[S + SourceChannels * D]. + // OperationSet - Used to identify this call as part of a deferred batch. + */\ + STDMETHOD(SetOutputMatrix) (THIS_ __in_opt IXAudio2Voice* pDestinationVoice, \ + UINT32 SourceChannels, UINT32 DestinationChannels, \ + __in_ecount(SourceChannels * DestinationChannels) const float* pLevelMatrix, \ + UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; \ + \ + /* NAME: IXAudio2Voice::GetOutputMatrix + // DESCRIPTION: Obtains the volume levels used to send each channel of this + // voice's output audio to each channel of a given destination + // voice's input audio. + // + // ARGUMENTS: + // pDestinationVoice - The destination voice whose mix matrix to obtain. + // SourceChannels - Used to confirm this voice's output channel count + // (the number of channels produced by the last effect in the chain). + // DestinationChannels - Confirms the destination voice's input channels. + // pLevelMatrix - Array of send levels, as above. + */\ + STDMETHOD_(void, GetOutputMatrix) (THIS_ __in_opt IXAudio2Voice* pDestinationVoice, \ + UINT32 SourceChannels, UINT32 DestinationChannels, \ + __out_ecount(SourceChannels * DestinationChannels) float* pLevelMatrix) PURE; \ + \ + /* NAME: IXAudio2Voice::DestroyVoice + // DESCRIPTION: Destroys this voice, stopping it if necessary and removing + // it from the XAudio2 graph. + */\ + STDMETHOD_(void, DestroyVoice) (THIS) PURE + + Declare_IXAudio2Voice_Methods(); +}; + + +/************************************************************************** + * + * IXAudio2SourceVoice: Source voice management interface. + * + **************************************************************************/ + +#undef INTERFACE +#define INTERFACE IXAudio2SourceVoice +DECLARE_INTERFACE_(IXAudio2SourceVoice, IXAudio2Voice) +{ + // Methods from IXAudio2Voice base interface + Declare_IXAudio2Voice_Methods(); + + // NAME: IXAudio2SourceVoice::Start + // DESCRIPTION: Makes this voice start consuming and processing audio. + // + // ARGUMENTS: + // Flags - Flags controlling how the voice should be started. + // OperationSet - Used to identify this call as part of a deferred batch. + // + STDMETHOD(Start) (THIS_ UINT32 Flags X2DEFAULT(0), UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; + + // NAME: IXAudio2SourceVoice::Stop + // DESCRIPTION: Makes this voice stop consuming audio. + // + // ARGUMENTS: + // Flags - Flags controlling how the voice should be stopped. + // OperationSet - Used to identify this call as part of a deferred batch. + // + STDMETHOD(Stop) (THIS_ UINT32 Flags X2DEFAULT(0), UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; + + // NAME: IXAudio2SourceVoice::SubmitSourceBuffer + // DESCRIPTION: Adds a new audio buffer to this voice's input queue. + // + // ARGUMENTS: + // pBuffer - Pointer to the buffer structure to be queued. + // pBufferWMA - Additional structure used only when submitting XWMA data. + // + STDMETHOD(SubmitSourceBuffer) (THIS_ __in const XAUDIO2_BUFFER* pBuffer, __in_opt const XAUDIO2_BUFFER_WMA* pBufferWMA X2DEFAULT(NULL)) PURE; + + // NAME: IXAudio2SourceVoice::FlushSourceBuffers + // DESCRIPTION: Removes all pending audio buffers from this voice's queue. + // + STDMETHOD(FlushSourceBuffers) (THIS) PURE; + + // NAME: IXAudio2SourceVoice::Discontinuity + // DESCRIPTION: Notifies the voice of an intentional break in the stream of + // audio buffers (e.g. the end of a sound), to prevent XAudio2 + // from interpreting an empty buffer queue as a glitch. + // + STDMETHOD(Discontinuity) (THIS) PURE; + + // NAME: IXAudio2SourceVoice::ExitLoop + // DESCRIPTION: Breaks out of the current loop when its end is reached. + // + // ARGUMENTS: + // OperationSet - Used to identify this call as part of a deferred batch. + // + STDMETHOD(ExitLoop) (THIS_ UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; + + // NAME: IXAudio2SourceVoice::GetState + // DESCRIPTION: Returns the number of buffers currently queued on this voice, + // the pContext value associated with the currently processing + // buffer (if any), and other voice state information. + // + // ARGUMENTS: + // pVoiceState - Returns the state information. + // + STDMETHOD_(void, GetState) (THIS_ __out XAUDIO2_VOICE_STATE* pVoiceState) PURE; + + // NAME: IXAudio2SourceVoice::SetFrequencyRatio + // DESCRIPTION: Sets this voice's frequency adjustment, i.e. its pitch. + // + // ARGUMENTS: + // Ratio - Frequency change, expressed as source frequency / target frequency. + // OperationSet - Used to identify this call as part of a deferred batch. + // + STDMETHOD(SetFrequencyRatio) (THIS_ float Ratio, + UINT32 OperationSet X2DEFAULT(XAUDIO2_COMMIT_NOW)) PURE; + + // NAME: IXAudio2SourceVoice::GetFrequencyRatio + // DESCRIPTION: Returns this voice's current frequency adjustment ratio. + // + // ARGUMENTS: + // pRatio - Returns the frequency adjustment. + // + STDMETHOD_(void, GetFrequencyRatio) (THIS_ __out float* pRatio) PURE; + + // NAME: IXAudio2SourceVoice::SetSourceSampleRate + // DESCRIPTION: Reconfigures this voice to treat its source data as being + // at a different sample rate than the original one specified + // in CreateSourceVoice's pSourceFormat argument. + // + // ARGUMENTS: + // UINT32 - The intended sample rate of further submitted source data. + // + STDMETHOD(SetSourceSampleRate) (THIS_ UINT32 NewSourceSampleRate) PURE; +}; + + +/************************************************************************** + * + * IXAudio2SubmixVoice: Submixing voice management interface. + * + **************************************************************************/ + +#undef INTERFACE +#define INTERFACE IXAudio2SubmixVoice +DECLARE_INTERFACE_(IXAudio2SubmixVoice, IXAudio2Voice) +{ + // Methods from IXAudio2Voice base interface + Declare_IXAudio2Voice_Methods(); + + // There are currently no methods specific to submix voices. +}; + + +/************************************************************************** + * + * IXAudio2MasteringVoice: Mastering voice management interface. + * + **************************************************************************/ + +#undef INTERFACE +#define INTERFACE IXAudio2MasteringVoice +DECLARE_INTERFACE_(IXAudio2MasteringVoice, IXAudio2Voice) +{ + // Methods from IXAudio2Voice base interface + Declare_IXAudio2Voice_Methods(); + + // There are currently no methods specific to mastering voices. +}; + + +/************************************************************************** + * + * IXAudio2EngineCallback: Client notification interface for engine events. + * + * REMARKS: Contains methods to notify the client when certain events happen + * in the XAudio2 engine. This interface should be implemented by + * the client. XAudio2 will call these methods via the interface + * pointer provided by the client when it calls XAudio2Create or + * IXAudio2::Initialize. + * + **************************************************************************/ + +#undef INTERFACE +#define INTERFACE IXAudio2EngineCallback +DECLARE_INTERFACE(IXAudio2EngineCallback) +{ + // Called by XAudio2 just before an audio processing pass begins. + STDMETHOD_(void, OnProcessingPassStart) (THIS) PURE; + + // Called just after an audio processing pass ends. + STDMETHOD_(void, OnProcessingPassEnd) (THIS) PURE; + + // Called in the event of a critical system error which requires XAudio2 + // to be closed down and restarted. The error code is given in Error. + STDMETHOD_(void, OnCriticalError) (THIS_ HRESULT Error) PURE; +}; + + +/************************************************************************** + * + * IXAudio2VoiceCallback: Client notification interface for voice events. + * + * REMARKS: Contains methods to notify the client when certain events happen + * in an XAudio2 voice. This interface should be implemented by the + * client. XAudio2 will call these methods via an interface pointer + * provided by the client in the IXAudio2::CreateSourceVoice call. + * + **************************************************************************/ + +#undef INTERFACE +#define INTERFACE IXAudio2VoiceCallback +DECLARE_INTERFACE(IXAudio2VoiceCallback) +{ + // Called just before this voice's processing pass begins. + STDMETHOD_(void, OnVoiceProcessingPassStart) (THIS_ UINT32 BytesRequired) PURE; + + // Called just after this voice's processing pass ends. + STDMETHOD_(void, OnVoiceProcessingPassEnd) (THIS) PURE; + + // Called when this voice has just finished playing a buffer stream + // (as marked with the XAUDIO2_END_OF_STREAM flag on the last buffer). + STDMETHOD_(void, OnStreamEnd) (THIS) PURE; + + // Called when this voice is about to start processing a new buffer. + STDMETHOD_(void, OnBufferStart) (THIS_ void* pBufferContext) PURE; + + // Called when this voice has just finished processing a buffer. + // The buffer can now be reused or destroyed. + STDMETHOD_(void, OnBufferEnd) (THIS_ void* pBufferContext) PURE; + + // Called when this voice has just reached the end position of a loop. + STDMETHOD_(void, OnLoopEnd) (THIS_ void* pBufferContext) PURE; + + // Called in the event of a critical error during voice processing, + // such as a failing xAPO or an error from the hardware XMA decoder. + // The voice may have to be destroyed and re-created to recover from + // the error. The callback arguments report which buffer was being + // processed when the error occurred, and its HRESULT code. + STDMETHOD_(void, OnVoiceError) (THIS_ void* pBufferContext, HRESULT Error) PURE; +}; + + +/************************************************************************** + * + * Macros to make it easier to use the XAudio2 COM interfaces in C code. + * + **************************************************************************/ + +#ifndef __cplusplus + +// IXAudio2 +#define IXAudio2_QueryInterface(This,riid,ppvInterface) ((This)->lpVtbl->QueryInterface(This,riid,ppvInterface)) +#define IXAudio2_AddRef(This) ((This)->lpVtbl->AddRef(This)) +#define IXAudio2_Release(This) ((This)->lpVtbl->Release(This)) +#define IXAudio2_GetDeviceCount(This,puCount) ((This)->lpVtbl->GetDeviceCount(This,puCount)) +#define IXAudio2_GetDeviceDetails(This,Index,pDeviceDetails) ((This)->lpVtbl->GetDeviceDetails(This,Index,pDeviceDetails)) +#define IXAudio2_Initialize(This,Flags,XAudio2Processor) ((This)->lpVtbl->Initialize(This,Flags,XAudio2Processor)) +#define IXAudio2_CreateSourceVoice(This,ppSourceVoice,pSourceFormat,Flags,MaxFrequencyRatio,pCallback,pSendList,pEffectChain) ((This)->lpVtbl->CreateSourceVoice(This,ppSourceVoice,pSourceFormat,Flags,MaxFrequencyRatio,pCallback,pSendList,pEffectChain)) +#define IXAudio2_CreateSubmixVoice(This,ppSubmixVoice,InputChannels,InputSampleRate,Flags,ProcessingStage,pSendList,pEffectChain) ((This)->lpVtbl->CreateSubmixVoice(This,ppSubmixVoice,InputChannels,InputSampleRate,Flags,ProcessingStage,pSendList,pEffectChain)) +#define IXAudio2_CreateMasteringVoice(This,ppMasteringVoice,InputChannels,InputSampleRate,Flags,DeviceIndex,pEffectChain) ((This)->lpVtbl->CreateMasteringVoice(This,ppMasteringVoice,InputChannels,InputSampleRate,Flags,DeviceIndex,pEffectChain)) +#define IXAudio2_StartEngine(This) ((This)->lpVtbl->StartEngine(This)) +#define IXAudio2_StopEngine(This) ((This)->lpVtbl->StopEngine(This)) +#define IXAudio2_CommitChanges(This,OperationSet) ((This)->lpVtbl->CommitChanges(This,OperationSet)) +#define IXAudio2_GetPerformanceData(This,pPerfData) ((This)->lpVtbl->GetPerformanceData(This,pPerfData)) +#define IXAudio2_SetDebugConfiguration(This,pDebugConfiguration,pReserved) ((This)->lpVtbl->SetDebugConfiguration(This,pDebugConfiguration,pReserved)) + +// IXAudio2Voice +#define IXAudio2Voice_GetVoiceDetails(This,pVoiceDetails) ((This)->lpVtbl->GetVoiceDetails(This,pVoiceDetails)) +#define IXAudio2Voice_SetOutputVoices(This,pSendList) ((This)->lpVtbl->SetOutputVoices(This,pSendList)) +#define IXAudio2Voice_SetEffectChain(This,pEffectChain) ((This)->lpVtbl->SetEffectChain(This,pEffectChain)) +#define IXAudio2Voice_EnableEffect(This,EffectIndex,OperationSet) ((This)->lpVtbl->EnableEffect(This,EffectIndex,OperationSet)) +#define IXAudio2Voice_DisableEffect(This,EffectIndex,OperationSet) ((This)->lpVtbl->DisableEffect(This,EffectIndex,OperationSet)) +#define IXAudio2Voice_GetEffectState(This,EffectIndex,pEnabled) ((This)->lpVtbl->GetEffectState(This,EffectIndex,pEnabled)) +#define IXAudio2Voice_SetEffectParameters(This,EffectIndex,pParameters,ParametersByteSize, OperationSet) ((This)->lpVtbl->SetEffectParameters(This,EffectIndex,pParameters,ParametersByteSize,OperationSet)) +#define IXAudio2Voice_GetEffectParameters(This,EffectIndex,pParameters,ParametersByteSize) ((This)->lpVtbl->GetEffectParameters(This,EffectIndex,pParameters,ParametersByteSize)) +#define IXAudio2Voice_SetFilterParameters(This,pParameters,OperationSet) ((This)->lpVtbl->SetFilterParameters(This,pParameters,OperationSet)) +#define IXAudio2Voice_GetFilterParameters(This,pParameters) ((This)->lpVtbl->GetFilterParameters(This,pParameters)) +#define IXAudio2Voice_SetOutputFilterParameters(This,pDestinationVoice,pParameters,OperationSet) ((This)->lpVtbl->SetOutputFilterParameters(This,pDestinationVoice,pParameters,OperationSet)) +#define IXAudio2Voice_GetOutputFilterParameters(This,pDestinationVoice,pParameters) ((This)->lpVtbl->GetOutputFilterParameters(This,pDestinationVoice,pParameters)) +#define IXAudio2Voice_SetVolume(This,Volume,OperationSet) ((This)->lpVtbl->SetVolume(This,Volume,OperationSet)) +#define IXAudio2Voice_GetVolume(This,pVolume) ((This)->lpVtbl->GetVolume(This,pVolume)) +#define IXAudio2Voice_SetChannelVolumes(This,Channels,pVolumes,OperationSet) ((This)->lpVtbl->SetChannelVolumes(This,Channels,pVolumes,OperationSet)) +#define IXAudio2Voice_GetChannelVolumes(This,Channels,pVolumes) ((This)->lpVtbl->GetChannelVolumes(This,Channels,pVolumes)) +#define IXAudio2Voice_SetOutputMatrix(This,pDestinationVoice,SourceChannels,DestinationChannels,pLevelMatrix,OperationSet) ((This)->lpVtbl->SetOutputMatrix(This,pDestinationVoice,SourceChannels,DestinationChannels,pLevelMatrix,OperationSet)) +#define IXAudio2Voice_GetOutputMatrix(This,pDestinationVoice,SourceChannels,DestinationChannels,pLevelMatrix) ((This)->lpVtbl->GetOutputMatrix(This,pDestinationVoice,SourceChannels,DestinationChannels,pLevelMatrix)) +#define IXAudio2Voice_DestroyVoice(This) ((This)->lpVtbl->DestroyVoice(This)) + +// IXAudio2SourceVoice +#define IXAudio2SourceVoice_GetVoiceDetails IXAudio2Voice_GetVoiceDetails +#define IXAudio2SourceVoice_SetOutputVoices IXAudio2Voice_SetOutputVoices +#define IXAudio2SourceVoice_SetEffectChain IXAudio2Voice_SetEffectChain +#define IXAudio2SourceVoice_EnableEffect IXAudio2Voice_EnableEffect +#define IXAudio2SourceVoice_DisableEffect IXAudio2Voice_DisableEffect +#define IXAudio2SourceVoice_GetEffectState IXAudio2Voice_GetEffectState +#define IXAudio2SourceVoice_SetEffectParameters IXAudio2Voice_SetEffectParameters +#define IXAudio2SourceVoice_GetEffectParameters IXAudio2Voice_GetEffectParameters +#define IXAudio2SourceVoice_SetFilterParameters IXAudio2Voice_SetFilterParameters +#define IXAudio2SourceVoice_GetFilterParameters IXAudio2Voice_GetFilterParameters +#define IXAudio2SourceVoice_SetOutputFilterParameters IXAudio2Voice_SetOutputFilterParameters +#define IXAudio2SourceVoice_GetOutputFilterParameters IXAudio2Voice_GetOutputFilterParameters +#define IXAudio2SourceVoice_SetVolume IXAudio2Voice_SetVolume +#define IXAudio2SourceVoice_GetVolume IXAudio2Voice_GetVolume +#define IXAudio2SourceVoice_SetChannelVolumes IXAudio2Voice_SetChannelVolumes +#define IXAudio2SourceVoice_GetChannelVolumes IXAudio2Voice_GetChannelVolumes +#define IXAudio2SourceVoice_SetOutputMatrix IXAudio2Voice_SetOutputMatrix +#define IXAudio2SourceVoice_GetOutputMatrix IXAudio2Voice_GetOutputMatrix +#define IXAudio2SourceVoice_DestroyVoice IXAudio2Voice_DestroyVoice +#define IXAudio2SourceVoice_Start(This,Flags,OperationSet) ((This)->lpVtbl->Start(This,Flags,OperationSet)) +#define IXAudio2SourceVoice_Stop(This,Flags,OperationSet) ((This)->lpVtbl->Stop(This,Flags,OperationSet)) +#define IXAudio2SourceVoice_SubmitSourceBuffer(This,pBuffer,pBufferWMA) ((This)->lpVtbl->SubmitSourceBuffer(This,pBuffer,pBufferWMA)) +#define IXAudio2SourceVoice_FlushSourceBuffers(This) ((This)->lpVtbl->FlushSourceBuffers(This)) +#define IXAudio2SourceVoice_Discontinuity(This) ((This)->lpVtbl->Discontinuity(This)) +#define IXAudio2SourceVoice_ExitLoop(This,OperationSet) ((This)->lpVtbl->ExitLoop(This,OperationSet)) +#define IXAudio2SourceVoice_GetState(This,pVoiceState) ((This)->lpVtbl->GetState(This,pVoiceState)) +#define IXAudio2SourceVoice_SetFrequencyRatio(This,Ratio,OperationSet) ((This)->lpVtbl->SetFrequencyRatio(This,Ratio,OperationSet)) +#define IXAudio2SourceVoice_GetFrequencyRatio(This,pRatio) ((This)->lpVtbl->GetFrequencyRatio(This,pRatio)) +#define IXAudio2SourceVoice_SetSourceSampleRate(This,NewSourceSampleRate) ((This)->lpVtbl->SetSourceSampleRate(This,NewSourceSampleRate)) + +// IXAudio2SubmixVoice +#define IXAudio2SubmixVoice_GetVoiceDetails IXAudio2Voice_GetVoiceDetails +#define IXAudio2SubmixVoice_SetOutputVoices IXAudio2Voice_SetOutputVoices +#define IXAudio2SubmixVoice_SetEffectChain IXAudio2Voice_SetEffectChain +#define IXAudio2SubmixVoice_EnableEffect IXAudio2Voice_EnableEffect +#define IXAudio2SubmixVoice_DisableEffect IXAudio2Voice_DisableEffect +#define IXAudio2SubmixVoice_GetEffectState IXAudio2Voice_GetEffectState +#define IXAudio2SubmixVoice_SetEffectParameters IXAudio2Voice_SetEffectParameters +#define IXAudio2SubmixVoice_GetEffectParameters IXAudio2Voice_GetEffectParameters +#define IXAudio2SubmixVoice_SetFilterParameters IXAudio2Voice_SetFilterParameters +#define IXAudio2SubmixVoice_GetFilterParameters IXAudio2Voice_GetFilterParameters +#define IXAudio2SubmixVoice_SetOutputFilterParameters IXAudio2Voice_SetOutputFilterParameters +#define IXAudio2SubmixVoice_GetOutputFilterParameters IXAudio2Voice_GetOutputFilterParameters +#define IXAudio2SubmixVoice_SetVolume IXAudio2Voice_SetVolume +#define IXAudio2SubmixVoice_GetVolume IXAudio2Voice_GetVolume +#define IXAudio2SubmixVoice_SetChannelVolumes IXAudio2Voice_SetChannelVolumes +#define IXAudio2SubmixVoice_GetChannelVolumes IXAudio2Voice_GetChannelVolumes +#define IXAudio2SubmixVoice_SetOutputMatrix IXAudio2Voice_SetOutputMatrix +#define IXAudio2SubmixVoice_GetOutputMatrix IXAudio2Voice_GetOutputMatrix +#define IXAudio2SubmixVoice_DestroyVoice IXAudio2Voice_DestroyVoice + +// IXAudio2MasteringVoice +#define IXAudio2MasteringVoice_GetVoiceDetails IXAudio2Voice_GetVoiceDetails +#define IXAudio2MasteringVoice_SetOutputVoices IXAudio2Voice_SetOutputVoices +#define IXAudio2MasteringVoice_SetEffectChain IXAudio2Voice_SetEffectChain +#define IXAudio2MasteringVoice_EnableEffect IXAudio2Voice_EnableEffect +#define IXAudio2MasteringVoice_DisableEffect IXAudio2Voice_DisableEffect +#define IXAudio2MasteringVoice_GetEffectState IXAudio2Voice_GetEffectState +#define IXAudio2MasteringVoice_SetEffectParameters IXAudio2Voice_SetEffectParameters +#define IXAudio2MasteringVoice_GetEffectParameters IXAudio2Voice_GetEffectParameters +#define IXAudio2MasteringVoice_SetFilterParameters IXAudio2Voice_SetFilterParameters +#define IXAudio2MasteringVoice_GetFilterParameters IXAudio2Voice_GetFilterParameters +#define IXAudio2MasteringVoice_SetOutputFilterParameters IXAudio2Voice_SetOutputFilterParameters +#define IXAudio2MasteringVoice_GetOutputFilterParameters IXAudio2Voice_GetOutputFilterParameters +#define IXAudio2MasteringVoice_SetVolume IXAudio2Voice_SetVolume +#define IXAudio2MasteringVoice_GetVolume IXAudio2Voice_GetVolume +#define IXAudio2MasteringVoice_SetChannelVolumes IXAudio2Voice_SetChannelVolumes +#define IXAudio2MasteringVoice_GetChannelVolumes IXAudio2Voice_GetChannelVolumes +#define IXAudio2MasteringVoice_SetOutputMatrix IXAudio2Voice_SetOutputMatrix +#define IXAudio2MasteringVoice_GetOutputMatrix IXAudio2Voice_GetOutputMatrix +#define IXAudio2MasteringVoice_DestroyVoice IXAudio2Voice_DestroyVoice + +#endif // #ifndef __cplusplus + + +/************************************************************************** + * + * Utility functions used to convert from pitch in semitones and volume + * in decibels to the frequency and amplitude ratio units used by XAudio2. + * These are only defined if the client #defines XAUDIO2_HELPER_FUNCTIONS + * prior to #including xaudio2.h. + * + **************************************************************************/ + +#ifdef XAUDIO2_HELPER_FUNCTIONS + +#define _USE_MATH_DEFINES // Make math.h define M_PI +#include // For powf, log10f, sinf and asinf + +// Calculate the argument to SetVolume from a decibel value +__inline float XAudio2DecibelsToAmplitudeRatio(float Decibels) +{ + return powf(10.0f, Decibels / 20.0f); +} + +// Recover a volume in decibels from an amplitude factor +__inline float XAudio2AmplitudeRatioToDecibels(float Volume) +{ + if (Volume == 0) + { + return -3.402823466e+38f; // Smallest float value (-FLT_MAX) + } + return 20.0f * log10f(Volume); +} + +// Calculate the argument to SetFrequencyRatio from a semitone value +__inline float XAudio2SemitonesToFrequencyRatio(float Semitones) +{ + // FrequencyRatio = 2 ^ Octaves + // = 2 ^ (Semitones / 12) + return powf(2.0f, Semitones / 12.0f); +} + +// Recover a pitch in semitones from a frequency ratio +__inline float XAudio2FrequencyRatioToSemitones(float FrequencyRatio) +{ + // Semitones = 12 * log2(FrequencyRatio) + // = 12 * log2(10) * log10(FrequencyRatio) + return 39.86313713864835f * log10f(FrequencyRatio); +} + +// Convert from filter cutoff frequencies expressed in Hertz to the radian +// frequency values used in XAUDIO2_FILTER_PARAMETERS.Frequency. Note that +// the highest CutoffFrequency supported is SampleRate/6. Higher values of +// CutoffFrequency will return XAUDIO2_MAX_FILTER_FREQUENCY. +__inline float XAudio2CutoffFrequencyToRadians(float CutoffFrequency, UINT32 SampleRate) +{ + if ((UINT32)(CutoffFrequency * 6.0f) >= SampleRate) + { + return XAUDIO2_MAX_FILTER_FREQUENCY; + } + return 2.0f * sinf((float)M_PI * CutoffFrequency / SampleRate); +} + +// Convert from radian frequencies back to absolute frequencies in Hertz +__inline float XAudio2RadiansToCutoffFrequency(float Radians, float SampleRate) +{ + return SampleRate * asinf(Radians / 2.0f) / (float)M_PI; +} +#endif // #ifdef XAUDIO2_HELPER_FUNCTIONS + + +/************************************************************************** + * + * XAudio2Create: Top-level function that creates an XAudio2 instance. + * + * On Windows this is just an inline function that calls CoCreateInstance + * and Initialize. The arguments are described above, under Initialize, + * except that the XAUDIO2_DEBUG_ENGINE flag can be used here to select + * the debug version of XAudio2. + * + * On Xbox, this function is implemented in the XAudio2 library, and the + * XAUDIO2_DEBUG_ENGINE flag has no effect; the client must explicitly + * link with the debug version of the library to obtain debug behavior. + * + **************************************************************************/ + +#ifdef _XBOX + +STDAPI XAudio2Create(__deref_out IXAudio2** ppXAudio2, UINT32 Flags X2DEFAULT(0), + XAUDIO2_PROCESSOR XAudio2Processor X2DEFAULT(XAUDIO2_DEFAULT_PROCESSOR)); + +#else // Windows + +__inline HRESULT XAudio2Create(__deref_out IXAudio2** ppXAudio2, UINT32 Flags X2DEFAULT(0), + XAUDIO2_PROCESSOR XAudio2Processor X2DEFAULT(XAUDIO2_DEFAULT_PROCESSOR)) +{ + // Instantiate the appropriate XAudio2 engine + IXAudio2* pXAudio2; + + #ifdef __cplusplus + + HRESULT hr = CoCreateInstance((Flags & XAUDIO2_DEBUG_ENGINE) ? __uuidof(XAudio2_Debug) : __uuidof(XAudio2), + NULL, CLSCTX_INPROC_SERVER, __uuidof(IXAudio2), (void**)&pXAudio2); + if (SUCCEEDED(hr)) + { + hr = pXAudio2->Initialize(Flags, XAudio2Processor); + + if (SUCCEEDED(hr)) + { + *ppXAudio2 = pXAudio2; + } + else + { + pXAudio2->Release(); + } + } + + #else + + HRESULT hr = CoCreateInstance((Flags & XAUDIO2_DEBUG_ENGINE) ? &CLSID_XAudio2_Debug : &CLSID_XAudio2, + NULL, CLSCTX_INPROC_SERVER, &IID_IXAudio2, (void**)&pXAudio2); + if (SUCCEEDED(hr)) + { + hr = pXAudio2->lpVtbl->Initialize(pXAudio2, Flags, XAudio2Processor); + + if (SUCCEEDED(hr)) + { + *ppXAudio2 = pXAudio2; + } + else + { + pXAudio2->lpVtbl->Release(pXAudio2); + } + } + + #endif // #ifdef __cplusplus + + return hr; +} + +#endif // #ifdef _XBOX + + +// Undo the #pragma pack(push, 1) directive at the top of this file +#pragma pack(pop) + +#endif // #ifndef GUID_DEFS_ONLY +#endif // #ifndef __XAUDIO2_INCLUDED__ diff --git a/MediaClient/MediaClient/directx/include/XAudio2fx.h b/MediaClient/MediaClient/directx/include/XAudio2fx.h new file mode 100644 index 0000000..4284bd2 --- /dev/null +++ b/MediaClient/MediaClient/directx/include/XAudio2fx.h @@ -0,0 +1,431 @@ +/************************************************************************** + * + * Copyright (c) Microsoft Corporation. All rights reserved. + * + * File: xaudio2fx.h + * Content: Declarations for the audio effects included with XAudio2. + * + **************************************************************************/ + +#ifndef __XAUDIO2FX_INCLUDED__ +#define __XAUDIO2FX_INCLUDED__ + + +/************************************************************************** + * + * XAudio2 effect class IDs. + * + **************************************************************************/ + +#include "comdecl.h" // For DEFINE_CLSID and DEFINE_IID + +// XAudio 2.0 (March 2008 SDK) +//DEFINE_CLSID(AudioVolumeMeter, C0C56F46, 29B1, 44E9, 99, 39, A3, 2C, E8, 68, 67, E2); +//DEFINE_CLSID(AudioVolumeMeter_Debug, C0C56F46, 29B1, 44E9, 99, 39, A3, 2C, E8, 68, 67, DB); +//DEFINE_CLSID(AudioReverb, 6F6EA3A9, 2CF5, 41CF, 91, C1, 21, 70, B1, 54, 00, 63); +//DEFINE_CLSID(AudioReverb_Debug, 6F6EA3A9, 2CF5, 41CF, 91, C1, 21, 70, B1, 54, 00, DB); + +// XAudio 2.1 (June 2008 SDK) +//DEFINE_CLSID(AudioVolumeMeter, c1e3f122, a2ea, 442c, 85, 4f, 20, d9, 8f, 83, 57, a1); +//DEFINE_CLSID(AudioVolumeMeter_Debug, 6d97a461, b02d, 48ae, b5, 43, 82, bc, 35, fd, fa, e2); +//DEFINE_CLSID(AudioReverb, f4769300, b949, 4df9, b3, 33, 00, d3, 39, 32, e9, a6); +//DEFINE_CLSID(AudioReverb_Debug, aea2cabc, 8c7c, 46aa, ba, 44, 0e, 6d, 75, 88, a1, f2); + +// XAudio 2.2 (August 2008 SDK) +//DEFINE_CLSID(AudioVolumeMeter, f5ca7b34, 8055, 42c0, b8, 36, 21, 61, 29, eb, 7e, 30); +//DEFINE_CLSID(AudioVolumeMeter_Debug, f796f5f7, 6059, 4a9f, 98, 2d, 61, ee, c2, ed, 67, ca); +//DEFINE_CLSID(AudioReverb, 629cf0de, 3ecc, 41e7, 99, 26, f7, e4, 3e, eb, ec, 51); +//DEFINE_CLSID(AudioReverb_Debug, 4aae4299, 3260, 46d4, 97, cc, 6c, c7, 60, c8, 53, 29); + +// XAudio 2.3 (November 2008 SDK) +//DEFINE_CLSID(AudioVolumeMeter, e180344b, ac83, 4483, 95, 9e, 18, a5, c5, 6a, 5e, 19); +//DEFINE_CLSID(AudioVolumeMeter_Debug, 922a0a56, 7d13, 40ae, a4, 81, 3c, 6c, 60, f1, 14, 01); +//DEFINE_CLSID(AudioReverb, 9cab402c, 1d37, 44b4, 88, 6d, fa, 4f, 36, 17, 0a, 4c); +//DEFINE_CLSID(AudioReverb_Debug, eadda998, 3be6, 4505, 84, be, ea, 06, 36, 5d, b9, 6b); + +// XAudio 2.4 (March 2009 SDK) +//DEFINE_CLSID(AudioVolumeMeter, c7338b95, 52b8, 4542, aa, 79, 42, eb, 01, 6c, 8c, 1c); +//DEFINE_CLSID(AudioVolumeMeter_Debug, 524bd872, 5c0b, 4217, bd, b8, 0a, 86, 81, 83, 0b, a5); +//DEFINE_CLSID(AudioReverb, 8bb7778b, 645b, 4475, 9a, 73, 1d, e3, 17, 0b, d3, af); +//DEFINE_CLSID(AudioReverb_Debug, da7738a2, cd0c, 4367, 9a, ac, d7, ea, d7, c6, 4f, 98); + +// XAudio 2.5 (March 2009 SDK) +//DEFINE_CLSID(AudioVolumeMeter, 2139e6da, c341, 4774, 9a, c3, b4, e0, 26, 34, 7f, 64); +//DEFINE_CLSID(AudioVolumeMeter_Debug, a5cc4e13, ca00, 416b, a6, ee, 49, fe, e7, b5, 43, d0); +//DEFINE_CLSID(AudioReverb, d06df0d0, 8518, 441e, 82, 2f, 54, 51, d5, c5, 95, b8); +//DEFINE_CLSID(AudioReverb_Debug, 613604ec, 304c, 45ec, a4, ed, 7a, 1c, 61, 2e, 9e, 72); + +// XAudio 2.6 (February 2010 SDK) +//DEFINE_CLSID(AudioVolumeMeter, e48c5a3f, 93ef, 43bb, a0, 92, 2c, 7c, eb, 94, 6f, 27); +//DEFINE_CLSID(AudioVolumeMeter_Debug, 9a9eaef7, a9e0, 4088, 9b, 1b, 9c, a0, 3a, 1a, ec, d4); +//DEFINE_CLSID(AudioReverb, cecec95a, d894, 491a, be, e3, 5e, 10, 6f, b5, 9f, 2d); +//DEFINE_CLSID(AudioReverb_Debug, 99a1c72e, 364c, 4c1b, 96, 23, fd, 5c, 8a, bd, 90, c7); + +// XAudio 2.7 (June 2010 SDK) +DEFINE_CLSID(AudioVolumeMeter, cac1105f, 619b, 4d04, 83, 1a, 44, e1, cb, f1, 2d, 57); +DEFINE_CLSID(AudioVolumeMeter_Debug, 2d9a0f9c, e67b, 4b24, ab, 44, 92, b3, e7, 70, c0, 20); +DEFINE_CLSID(AudioReverb, 6a93130e, 1d53, 41d1, a9, cf, e7, 58, 80, 0b, b1, 79); +DEFINE_CLSID(AudioReverb_Debug, c4f82dd4, cb4e, 4ce1, 8b, db, ee, 32, d4, 19, 82, 69); + +// Ignore the rest of this header if only the GUID definitions were requested +#ifndef GUID_DEFS_ONLY + +#ifdef _XBOX + #include // Xbox COM declarations (IUnknown, etc) +#else + #include // Windows COM declarations +#endif +#include // For log10() + + +// All structures defined in this file should use tight packing +#pragma pack(push, 1) + + +/************************************************************************** + * + * Effect creation functions. On Windows, these are just inline functions + * that call CoCreateInstance and Initialize; the XAUDIO2FX_DEBUG flag can + * be used to select the debug version of the effects. On Xbox, these map + * to real functions included in xaudio2.lib, and the XAUDIO2FX_DEBUG flag + * is ignored; the application must link with the debug library to use the + * debug functionality. + * + **************************************************************************/ + +// Use default values for some parameters if building C++ code +#ifdef __cplusplus + #define DEFAULT(x) =x +#else + #define DEFAULT(x) +#endif + +#define XAUDIO2FX_DEBUG 1 // To select the debug version of an effect + +#ifdef _XBOX + + STDAPI CreateAudioVolumeMeter(__deref_out IUnknown** ppApo); + STDAPI CreateAudioReverb(__deref_out IUnknown** ppApo); + + __inline HRESULT XAudio2CreateVolumeMeter(__deref_out IUnknown** ppApo, UINT32 /*Flags*/ DEFAULT(0)) + { + return CreateAudioVolumeMeter(ppApo); + } + + __inline HRESULT XAudio2CreateReverb(__deref_out IUnknown** ppApo, UINT32 /*Flags*/ DEFAULT(0)) + { + return CreateAudioReverb(ppApo); + } + +#else // Windows + + __inline HRESULT XAudio2CreateVolumeMeter(__deref_out IUnknown** ppApo, UINT32 Flags DEFAULT(0)) + { + #ifdef __cplusplus + return CoCreateInstance((Flags & XAUDIO2FX_DEBUG) ? __uuidof(AudioVolumeMeter_Debug) + : __uuidof(AudioVolumeMeter), + NULL, CLSCTX_INPROC_SERVER, __uuidof(IUnknown), (void**)ppApo); + #else + return CoCreateInstance((Flags & XAUDIO2FX_DEBUG) ? &CLSID_AudioVolumeMeter_Debug + : &CLSID_AudioVolumeMeter, + NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void**)ppApo); + #endif + } + + __inline HRESULT XAudio2CreateReverb(__deref_out IUnknown** ppApo, UINT32 Flags DEFAULT(0)) + { + #ifdef __cplusplus + return CoCreateInstance((Flags & XAUDIO2FX_DEBUG) ? __uuidof(AudioReverb_Debug) + : __uuidof(AudioReverb), + NULL, CLSCTX_INPROC_SERVER, __uuidof(IUnknown), (void**)ppApo); + #else + return CoCreateInstance((Flags & XAUDIO2FX_DEBUG) ? &CLSID_AudioReverb_Debug + : &CLSID_AudioReverb, + NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void**)ppApo); + #endif + } + +#endif // #ifdef _XBOX + + + +/************************************************************************** + * + * Volume meter parameters. + * The volume meter supports FLOAT32 audio formats and must be used in-place. + * + **************************************************************************/ + +// XAUDIO2FX_VOLUMEMETER_LEVELS: Receives results from GetEffectParameters(). +// The user is responsible for allocating pPeakLevels, pRMSLevels, and +// initializing ChannelCount accordingly. +// The volume meter does not support SetEffectParameters(). +typedef struct XAUDIO2FX_VOLUMEMETER_LEVELS +{ + float* pPeakLevels; // Peak levels table: receives maximum absolute level for each channel + // over a processing pass; may be NULL if pRMSLevls != NULL, + // otherwise must have at least ChannelCount elements. + float* pRMSLevels; // Root mean square levels table: receives RMS level for each channel + // over a processing pass; may be NULL if pPeakLevels != NULL, + // otherwise must have at least ChannelCount elements. + UINT32 ChannelCount; // Number of channels being processed by the volume meter APO +} XAUDIO2FX_VOLUMEMETER_LEVELS; + + + +/************************************************************************** + * + * Reverb parameters. + * The reverb supports only FLOAT32 audio with the following channel + * configurations: + * Input: Mono Output: Mono + * Input: Mono Output: 5.1 + * Input: Stereo Output: Stereo + * Input: Stereo Output: 5.1 + * The framerate must be within [20000, 48000] Hz. + * + * When using mono input, delay filters associated with the right channel + * are not executed. In this case, parameters such as PositionRight and + * PositionMatrixRight have no effect. This also means the reverb uses + * less CPU when hosted in a mono submix. + * + **************************************************************************/ + +#define XAUDIO2FX_REVERB_MIN_FRAMERATE 20000 +#define XAUDIO2FX_REVERB_MAX_FRAMERATE 48000 + +// XAUDIO2FX_REVERB_PARAMETERS: Native parameter set for the reverb effect + +typedef struct XAUDIO2FX_REVERB_PARAMETERS +{ + // ratio of wet (processed) signal to dry (original) signal + float WetDryMix; // [0, 100] (percentage) + + // Delay times + UINT32 ReflectionsDelay; // [0, 300] in ms + BYTE ReverbDelay; // [0, 85] in ms + BYTE RearDelay; // [0, 5] in ms + + // Indexed parameters + BYTE PositionLeft; // [0, 30] no units + BYTE PositionRight; // [0, 30] no units, ignored when configured to mono + BYTE PositionMatrixLeft; // [0, 30] no units + BYTE PositionMatrixRight; // [0, 30] no units, ignored when configured to mono + BYTE EarlyDiffusion; // [0, 15] no units + BYTE LateDiffusion; // [0, 15] no units + BYTE LowEQGain; // [0, 12] no units + BYTE LowEQCutoff; // [0, 9] no units + BYTE HighEQGain; // [0, 8] no units + BYTE HighEQCutoff; // [0, 14] no units + + // Direct parameters + float RoomFilterFreq; // [20, 20000] in Hz + float RoomFilterMain; // [-100, 0] in dB + float RoomFilterHF; // [-100, 0] in dB + float ReflectionsGain; // [-100, 20] in dB + float ReverbGain; // [-100, 20] in dB + float DecayTime; // [0.1, inf] in seconds + float Density; // [0, 100] (percentage) + float RoomSize; // [1, 100] in feet +} XAUDIO2FX_REVERB_PARAMETERS; + + +// Maximum, minimum and default values for the parameters above +#define XAUDIO2FX_REVERB_MIN_WET_DRY_MIX 0.0f +#define XAUDIO2FX_REVERB_MIN_REFLECTIONS_DELAY 0 +#define XAUDIO2FX_REVERB_MIN_REVERB_DELAY 0 +#define XAUDIO2FX_REVERB_MIN_REAR_DELAY 0 +#define XAUDIO2FX_REVERB_MIN_POSITION 0 +#define XAUDIO2FX_REVERB_MIN_DIFFUSION 0 +#define XAUDIO2FX_REVERB_MIN_LOW_EQ_GAIN 0 +#define XAUDIO2FX_REVERB_MIN_LOW_EQ_CUTOFF 0 +#define XAUDIO2FX_REVERB_MIN_HIGH_EQ_GAIN 0 +#define XAUDIO2FX_REVERB_MIN_HIGH_EQ_CUTOFF 0 +#define XAUDIO2FX_REVERB_MIN_ROOM_FILTER_FREQ 20.0f +#define XAUDIO2FX_REVERB_MIN_ROOM_FILTER_MAIN -100.0f +#define XAUDIO2FX_REVERB_MIN_ROOM_FILTER_HF -100.0f +#define XAUDIO2FX_REVERB_MIN_REFLECTIONS_GAIN -100.0f +#define XAUDIO2FX_REVERB_MIN_REVERB_GAIN -100.0f +#define XAUDIO2FX_REVERB_MIN_DECAY_TIME 0.1f +#define XAUDIO2FX_REVERB_MIN_DENSITY 0.0f +#define XAUDIO2FX_REVERB_MIN_ROOM_SIZE 0.0f + +#define XAUDIO2FX_REVERB_MAX_WET_DRY_MIX 100.0f +#define XAUDIO2FX_REVERB_MAX_REFLECTIONS_DELAY 300 +#define XAUDIO2FX_REVERB_MAX_REVERB_DELAY 85 +#define XAUDIO2FX_REVERB_MAX_REAR_DELAY 5 +#define XAUDIO2FX_REVERB_MAX_POSITION 30 +#define XAUDIO2FX_REVERB_MAX_DIFFUSION 15 +#define XAUDIO2FX_REVERB_MAX_LOW_EQ_GAIN 12 +#define XAUDIO2FX_REVERB_MAX_LOW_EQ_CUTOFF 9 +#define XAUDIO2FX_REVERB_MAX_HIGH_EQ_GAIN 8 +#define XAUDIO2FX_REVERB_MAX_HIGH_EQ_CUTOFF 14 +#define XAUDIO2FX_REVERB_MAX_ROOM_FILTER_FREQ 20000.0f +#define XAUDIO2FX_REVERB_MAX_ROOM_FILTER_MAIN 0.0f +#define XAUDIO2FX_REVERB_MAX_ROOM_FILTER_HF 0.0f +#define XAUDIO2FX_REVERB_MAX_REFLECTIONS_GAIN 20.0f +#define XAUDIO2FX_REVERB_MAX_REVERB_GAIN 20.0f +#define XAUDIO2FX_REVERB_MAX_DENSITY 100.0f +#define XAUDIO2FX_REVERB_MAX_ROOM_SIZE 100.0f + +#define XAUDIO2FX_REVERB_DEFAULT_WET_DRY_MIX 100.0f +#define XAUDIO2FX_REVERB_DEFAULT_REFLECTIONS_DELAY 5 +#define XAUDIO2FX_REVERB_DEFAULT_REVERB_DELAY 5 +#define XAUDIO2FX_REVERB_DEFAULT_REAR_DELAY 5 +#define XAUDIO2FX_REVERB_DEFAULT_POSITION 6 +#define XAUDIO2FX_REVERB_DEFAULT_POSITION_MATRIX 27 +#define XAUDIO2FX_REVERB_DEFAULT_EARLY_DIFFUSION 8 +#define XAUDIO2FX_REVERB_DEFAULT_LATE_DIFFUSION 8 +#define XAUDIO2FX_REVERB_DEFAULT_LOW_EQ_GAIN 8 +#define XAUDIO2FX_REVERB_DEFAULT_LOW_EQ_CUTOFF 4 +#define XAUDIO2FX_REVERB_DEFAULT_HIGH_EQ_GAIN 8 +#define XAUDIO2FX_REVERB_DEFAULT_HIGH_EQ_CUTOFF 4 +#define XAUDIO2FX_REVERB_DEFAULT_ROOM_FILTER_FREQ 5000.0f +#define XAUDIO2FX_REVERB_DEFAULT_ROOM_FILTER_MAIN 0.0f +#define XAUDIO2FX_REVERB_DEFAULT_ROOM_FILTER_HF 0.0f +#define XAUDIO2FX_REVERB_DEFAULT_REFLECTIONS_GAIN 0.0f +#define XAUDIO2FX_REVERB_DEFAULT_REVERB_GAIN 0.0f +#define XAUDIO2FX_REVERB_DEFAULT_DECAY_TIME 1.0f +#define XAUDIO2FX_REVERB_DEFAULT_DENSITY 100.0f +#define XAUDIO2FX_REVERB_DEFAULT_ROOM_SIZE 100.0f + + +// XAUDIO2FX_REVERB_I3DL2_PARAMETERS: Parameter set compliant with the I3DL2 standard + +typedef struct XAUDIO2FX_REVERB_I3DL2_PARAMETERS +{ + // ratio of wet (processed) signal to dry (original) signal + float WetDryMix; // [0, 100] (percentage) + + // Standard I3DL2 parameters + INT32 Room; // [-10000, 0] in mB (hundredths of decibels) + INT32 RoomHF; // [-10000, 0] in mB (hundredths of decibels) + float RoomRolloffFactor; // [0.0, 10.0] + float DecayTime; // [0.1, 20.0] in seconds + float DecayHFRatio; // [0.1, 2.0] + INT32 Reflections; // [-10000, 1000] in mB (hundredths of decibels) + float ReflectionsDelay; // [0.0, 0.3] in seconds + INT32 Reverb; // [-10000, 2000] in mB (hundredths of decibels) + float ReverbDelay; // [0.0, 0.1] in seconds + float Diffusion; // [0.0, 100.0] (percentage) + float Density; // [0.0, 100.0] (percentage) + float HFReference; // [20.0, 20000.0] in Hz +} XAUDIO2FX_REVERB_I3DL2_PARAMETERS; + + +// ReverbConvertI3DL2ToNative: Utility function to map from I3DL2 to native parameters + +__inline void ReverbConvertI3DL2ToNative +( + __in const XAUDIO2FX_REVERB_I3DL2_PARAMETERS* pI3DL2, + __out XAUDIO2FX_REVERB_PARAMETERS* pNative +) +{ + float reflectionsDelay; + float reverbDelay; + + // RoomRolloffFactor is ignored + + // These parameters have no equivalent in I3DL2 + pNative->RearDelay = XAUDIO2FX_REVERB_DEFAULT_REAR_DELAY; // 5 + pNative->PositionLeft = XAUDIO2FX_REVERB_DEFAULT_POSITION; // 6 + pNative->PositionRight = XAUDIO2FX_REVERB_DEFAULT_POSITION; // 6 + pNative->PositionMatrixLeft = XAUDIO2FX_REVERB_DEFAULT_POSITION_MATRIX; // 27 + pNative->PositionMatrixRight = XAUDIO2FX_REVERB_DEFAULT_POSITION_MATRIX; // 27 + pNative->RoomSize = XAUDIO2FX_REVERB_DEFAULT_ROOM_SIZE; // 100 + pNative->LowEQCutoff = 4; + pNative->HighEQCutoff = 6; + + // The rest of the I3DL2 parameters map to the native property set + pNative->RoomFilterMain = (float)pI3DL2->Room / 100.0f; + pNative->RoomFilterHF = (float)pI3DL2->RoomHF / 100.0f; + + if (pI3DL2->DecayHFRatio >= 1.0f) + { + INT32 index = (INT32)(-4.0 * log10(pI3DL2->DecayHFRatio)); + if (index < -8) index = -8; + pNative->LowEQGain = (BYTE)((index < 0) ? index + 8 : 8); + pNative->HighEQGain = 8; + pNative->DecayTime = pI3DL2->DecayTime * pI3DL2->DecayHFRatio; + } + else + { + INT32 index = (INT32)(4.0 * log10(pI3DL2->DecayHFRatio)); + if (index < -8) index = -8; + pNative->LowEQGain = 8; + pNative->HighEQGain = (BYTE)((index < 0) ? index + 8 : 8); + pNative->DecayTime = pI3DL2->DecayTime; + } + + reflectionsDelay = pI3DL2->ReflectionsDelay * 1000.0f; + if (reflectionsDelay >= XAUDIO2FX_REVERB_MAX_REFLECTIONS_DELAY) // 300 + { + reflectionsDelay = (float)(XAUDIO2FX_REVERB_MAX_REFLECTIONS_DELAY - 1); + } + else if (reflectionsDelay <= 1) + { + reflectionsDelay = 1; + } + pNative->ReflectionsDelay = (UINT32)reflectionsDelay; + + reverbDelay = pI3DL2->ReverbDelay * 1000.0f; + if (reverbDelay >= XAUDIO2FX_REVERB_MAX_REVERB_DELAY) // 85 + { + reverbDelay = (float)(XAUDIO2FX_REVERB_MAX_REVERB_DELAY - 1); + } + pNative->ReverbDelay = (BYTE)reverbDelay; + + pNative->ReflectionsGain = pI3DL2->Reflections / 100.0f; + pNative->ReverbGain = pI3DL2->Reverb / 100.0f; + pNative->EarlyDiffusion = (BYTE)(15.0f * pI3DL2->Diffusion / 100.0f); + pNative->LateDiffusion = pNative->EarlyDiffusion; + pNative->Density = pI3DL2->Density; + pNative->RoomFilterFreq = pI3DL2->HFReference; + + pNative->WetDryMix = pI3DL2->WetDryMix; +} + + +/************************************************************************** + * + * Standard I3DL2 reverb presets (100% wet). + * + **************************************************************************/ + +#define XAUDIO2FX_I3DL2_PRESET_DEFAULT {100,-10000, 0,0.0f, 1.00f,0.50f,-10000,0.020f,-10000,0.040f,100.0f,100.0f,5000.0f} +#define XAUDIO2FX_I3DL2_PRESET_GENERIC {100, -1000, -100,0.0f, 1.49f,0.83f, -2602,0.007f, 200,0.011f,100.0f,100.0f,5000.0f} +#define XAUDIO2FX_I3DL2_PRESET_PADDEDCELL {100, -1000,-6000,0.0f, 0.17f,0.10f, -1204,0.001f, 207,0.002f,100.0f,100.0f,5000.0f} +#define XAUDIO2FX_I3DL2_PRESET_ROOM {100, -1000, -454,0.0f, 0.40f,0.83f, -1646,0.002f, 53,0.003f,100.0f,100.0f,5000.0f} +#define XAUDIO2FX_I3DL2_PRESET_BATHROOM {100, -1000,-1200,0.0f, 1.49f,0.54f, -370,0.007f, 1030,0.011f,100.0f, 60.0f,5000.0f} +#define XAUDIO2FX_I3DL2_PRESET_LIVINGROOM {100, -1000,-6000,0.0f, 0.50f,0.10f, -1376,0.003f, -1104,0.004f,100.0f,100.0f,5000.0f} +#define XAUDIO2FX_I3DL2_PRESET_STONEROOM {100, -1000, -300,0.0f, 2.31f,0.64f, -711,0.012f, 83,0.017f,100.0f,100.0f,5000.0f} +#define XAUDIO2FX_I3DL2_PRESET_AUDITORIUM {100, -1000, -476,0.0f, 4.32f,0.59f, -789,0.020f, -289,0.030f,100.0f,100.0f,5000.0f} +#define XAUDIO2FX_I3DL2_PRESET_CONCERTHALL {100, -1000, -500,0.0f, 3.92f,0.70f, -1230,0.020f, -2,0.029f,100.0f,100.0f,5000.0f} +#define XAUDIO2FX_I3DL2_PRESET_CAVE {100, -1000, 0,0.0f, 2.91f,1.30f, -602,0.015f, -302,0.022f,100.0f,100.0f,5000.0f} +#define XAUDIO2FX_I3DL2_PRESET_ARENA {100, -1000, -698,0.0f, 7.24f,0.33f, -1166,0.020f, 16,0.030f,100.0f,100.0f,5000.0f} +#define XAUDIO2FX_I3DL2_PRESET_HANGAR {100, -1000,-1000,0.0f,10.05f,0.23f, -602,0.020f, 198,0.030f,100.0f,100.0f,5000.0f} +#define XAUDIO2FX_I3DL2_PRESET_CARPETEDHALLWAY {100, -1000,-4000,0.0f, 0.30f,0.10f, -1831,0.002f, -1630,0.030f,100.0f,100.0f,5000.0f} +#define XAUDIO2FX_I3DL2_PRESET_HALLWAY {100, -1000, -300,0.0f, 1.49f,0.59f, -1219,0.007f, 441,0.011f,100.0f,100.0f,5000.0f} +#define XAUDIO2FX_I3DL2_PRESET_STONECORRIDOR {100, -1000, -237,0.0f, 2.70f,0.79f, -1214,0.013f, 395,0.020f,100.0f,100.0f,5000.0f} +#define XAUDIO2FX_I3DL2_PRESET_ALLEY {100, -1000, -270,0.0f, 1.49f,0.86f, -1204,0.007f, -4,0.011f,100.0f,100.0f,5000.0f} +#define XAUDIO2FX_I3DL2_PRESET_FOREST {100, -1000,-3300,0.0f, 1.49f,0.54f, -2560,0.162f, -613,0.088f, 79.0f,100.0f,5000.0f} +#define XAUDIO2FX_I3DL2_PRESET_CITY {100, -1000, -800,0.0f, 1.49f,0.67f, -2273,0.007f, -2217,0.011f, 50.0f,100.0f,5000.0f} +#define XAUDIO2FX_I3DL2_PRESET_MOUNTAINS {100, -1000,-2500,0.0f, 1.49f,0.21f, -2780,0.300f, -2014,0.100f, 27.0f,100.0f,5000.0f} +#define XAUDIO2FX_I3DL2_PRESET_QUARRY {100, -1000,-1000,0.0f, 1.49f,0.83f,-10000,0.061f, 500,0.025f,100.0f,100.0f,5000.0f} +#define XAUDIO2FX_I3DL2_PRESET_PLAIN {100, -1000,-2000,0.0f, 1.49f,0.50f, -2466,0.179f, -2514,0.100f, 21.0f,100.0f,5000.0f} +#define XAUDIO2FX_I3DL2_PRESET_PARKINGLOT {100, -1000, 0,0.0f, 1.65f,1.50f, -1363,0.008f, -1153,0.012f,100.0f,100.0f,5000.0f} +#define XAUDIO2FX_I3DL2_PRESET_SEWERPIPE {100, -1000,-1000,0.0f, 2.81f,0.14f, 429,0.014f, 648,0.021f, 80.0f, 60.0f,5000.0f} +#define XAUDIO2FX_I3DL2_PRESET_UNDERWATER {100, -1000,-4000,0.0f, 1.49f,0.10f, -449,0.007f, 1700,0.011f,100.0f,100.0f,5000.0f} +#define XAUDIO2FX_I3DL2_PRESET_SMALLROOM {100, -1000, -600,0.0f, 1.10f,0.83f, -400,0.005f, 500,0.010f,100.0f,100.0f,5000.0f} +#define XAUDIO2FX_I3DL2_PRESET_MEDIUMROOM {100, -1000, -600,0.0f, 1.30f,0.83f, -1000,0.010f, -200,0.020f,100.0f,100.0f,5000.0f} +#define XAUDIO2FX_I3DL2_PRESET_LARGEROOM {100, -1000, -600,0.0f, 1.50f,0.83f, -1600,0.020f, -1000,0.040f,100.0f,100.0f,5000.0f} +#define XAUDIO2FX_I3DL2_PRESET_MEDIUMHALL {100, -1000, -600,0.0f, 1.80f,0.70f, -1300,0.015f, -800,0.030f,100.0f,100.0f,5000.0f} +#define XAUDIO2FX_I3DL2_PRESET_LARGEHALL {100, -1000, -600,0.0f, 1.80f,0.70f, -2000,0.030f, -1400,0.060f,100.0f,100.0f,5000.0f} +#define XAUDIO2FX_I3DL2_PRESET_PLATE {100, -1000, -200,0.0f, 1.30f,0.90f, 0,0.002f, 0,0.010f,100.0f, 75.0f,5000.0f} + + +// Undo the #pragma pack(push, 1) at the top of this file +#pragma pack(pop) + +#endif // #ifndef GUID_DEFS_ONLY +#endif // #ifndef __XAUDIO2FX_INCLUDED__ diff --git a/MediaClient/MediaClient/directx/include/XDSP.h b/MediaClient/MediaClient/directx/include/XDSP.h new file mode 100644 index 0000000..6ed0dc5 --- /dev/null +++ b/MediaClient/MediaClient/directx/include/XDSP.h @@ -0,0 +1,754 @@ +/*-========================================================================-_ + | - XDSP - | + | Copyright (c) Microsoft Corporation. All rights reserved. | + |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| + |PROJECT: XDSP MODEL: Unmanaged User-mode | + |VERSION: 1.2 EXCEPT: No Exceptions | + |CLASS: N / A MINREQ: WinXP, Xbox360 | + |BASE: N / A DIALECT: MSC++ 14.00 | + |>------------------------------------------------------------------------<| + | DUTY: DSP functions with CPU extension specific optimizations | + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ + NOTES: + 1. Definition of terms: + DSP: Digital Signal Processing. + FFT: Fast Fourier Transform. + Frame: A block of samples, one per channel, + to be played simultaneously. + + 2. All buffer parameters must be 16-byte aligned. + + 3. All FFT functions support only FLOAT32 audio. */ + +#pragma once +//---------------------------------------------------// +#include // general windows types +#include // trigonometric functions +#if defined(_XBOX) // SIMD intrinsics + #include +#else + #include +#endif + + +//-------------------------------------------------------------// +// assertion +#if !defined(DSPASSERT) + #if DBG + #define DSPASSERT(exp) if (!(exp)) { OutputDebugStringA("XDSP ASSERT: " #exp ", {" __FUNCTION__ "}\n"); __debugbreak(); } + #else + #define DSPASSERT(exp) __assume(exp) + #endif +#endif + +// true if n is a power of 2 +#if !defined(ISPOWEROF2) + #define ISPOWEROF2(n) ( ((n)&((n)-1)) == 0 && (n) != 0 ) +#endif + + +//-----------------------------------------------------------// +namespace XDSP { +#pragma warning(push) +#pragma warning(disable: 4328 4640) // disable "indirection alignment of formal parameter", "construction of local static object is not thread-safe" compile warnings + + +// Helper functions, used by the FFT functions. +// The application need not call them directly. + + // primitive types + typedef __m128 XVECTOR; + typedef XVECTOR& XVECTORREF; + typedef const XVECTOR& XVECTORREFC; + + + // Parallel multiplication of four complex numbers, assuming + // real and imaginary values are stored in separate vectors. + __forceinline void vmulComplex (__out XVECTORREF rResult, __out XVECTORREF iResult, __in XVECTORREFC r1, __in XVECTORREFC i1, __in XVECTORREFC r2, __in XVECTORREFC i2) + { + // (r1, i1) * (r2, i2) = (r1r2 - i1i2, r1i2 + r2i1) + XVECTOR vi1i2 = _mm_mul_ps(i1, i2); + XVECTOR vr1r2 = _mm_mul_ps(r1, r2); + XVECTOR vr1i2 = _mm_mul_ps(r1, i2); + XVECTOR vr2i1 = _mm_mul_ps(r2, i1); + rResult = _mm_sub_ps(vr1r2, vi1i2); // real: (r1*r2 - i1*i2) + iResult = _mm_add_ps(vr1i2, vr2i1); // imaginary: (r1*i2 + r2*i1) + } + __forceinline void vmulComplex (__inout XVECTORREF r1, __inout XVECTORREF i1, __in XVECTORREFC r2, __in XVECTORREFC i2) + { + // (r1, i1) * (r2, i2) = (r1r2 - i1i2, r1i2 + r2i1) + XVECTOR vi1i2 = _mm_mul_ps(i1, i2); + XVECTOR vr1r2 = _mm_mul_ps(r1, r2); + XVECTOR vr1i2 = _mm_mul_ps(r1, i2); + XVECTOR vr2i1 = _mm_mul_ps(r2, i1); + r1 = _mm_sub_ps(vr1r2, vi1i2); // real: (r1*r2 - i1*i2) + i1 = _mm_add_ps(vr1i2, vr2i1); // imaginary: (r1*i2 + r2*i1) + } + + + // Radix-4 decimation-in-time FFT butterfly. + // This version assumes that all four elements of the butterfly are + // adjacent in a single vector. + // + // Compute the product of the complex input vector and the + // 4-element DFT matrix: + // | 1 1 1 1 | | (r1X,i1X) | + // | 1 -j -1 j | | (r1Y,i1Y) | + // | 1 -1 1 -1 | | (r1Z,i1Z) | + // | 1 j -1 -j | | (r1W,i1W) | + // + // This matrix can be decomposed into two simpler ones to reduce the + // number of additions needed. The decomposed matrices look like this: + // | 1 0 1 0 | | 1 0 1 0 | + // | 0 1 0 -j | | 1 0 -1 0 | + // | 1 0 -1 0 | | 0 1 0 1 | + // | 0 1 0 j | | 0 1 0 -1 | + // + // Combine as follows: + // | 1 0 1 0 | | (r1X,i1X) | | (r1X + r1Z, i1X + i1Z) | + // Temp = | 1 0 -1 0 | * | (r1Y,i1Y) | = | (r1X - r1Z, i1X - i1Z) | + // | 0 1 0 1 | | (r1Z,i1Z) | | (r1Y + r1W, i1Y + i1W) | + // | 0 1 0 -1 | | (r1W,i1W) | | (r1Y - r1W, i1Y - i1W) | + // + // | 1 0 1 0 | | (rTempX,iTempX) | | (rTempX + rTempZ, iTempX + iTempZ) | + // Result = | 0 1 0 -j | * | (rTempY,iTempY) | = | (rTempY + iTempW, iTempY - rTempW) | + // | 1 0 -1 0 | | (rTempZ,iTempZ) | | (rTempX - rTempZ, iTempX - iTempZ) | + // | 0 1 0 j | | (rTempW,iTempW) | | (rTempY - iTempW, iTempY + rTempW) | + __forceinline void ButterflyDIT4_1 (__inout XVECTORREF r1, __inout XVECTORREF i1) + { + // sign constants for radix-4 butterflies + const static XVECTOR vDFT4SignBits1 = { 0.0f, -0.0f, 0.0f, -0.0f }; + const static XVECTOR vDFT4SignBits2 = { 0.0f, 0.0f, -0.0f, -0.0f }; + const static XVECTOR vDFT4SignBits3 = { 0.0f, -0.0f, -0.0f, 0.0f }; + + + // calculating Temp + XVECTOR rTemp = _mm_add_ps( _mm_shuffle_ps(r1, r1, _MM_SHUFFLE(1, 1, 0, 0)), // [r1X| r1X|r1Y| r1Y] + + _mm_xor_ps(_mm_shuffle_ps(r1, r1, _MM_SHUFFLE(3, 3, 2, 2)), vDFT4SignBits1) ); // [r1Z|-r1Z|r1W|-r1W] + XVECTOR iTemp = _mm_add_ps( _mm_shuffle_ps(i1, i1, _MM_SHUFFLE(1, 1, 0, 0)), // [i1X| i1X|i1Y| i1Y] + + _mm_xor_ps(_mm_shuffle_ps(i1, i1, _MM_SHUFFLE(3, 3, 2, 2)), vDFT4SignBits1) ); // [i1Z|-i1Z|i1W|-i1W] + + // calculating Result + XVECTOR rZrWiZiW = _mm_shuffle_ps(rTemp, iTemp, _MM_SHUFFLE(3, 2, 3, 2)); // [rTempZ|rTempW|iTempZ|iTempW] + XVECTOR rZiWrZiW = _mm_shuffle_ps(rZrWiZiW, rZrWiZiW, _MM_SHUFFLE(3, 0, 3, 0)); // [rTempZ|iTempW|rTempZ|iTempW] + XVECTOR iZrWiZrW = _mm_shuffle_ps(rZrWiZiW, rZrWiZiW, _MM_SHUFFLE(1, 2, 1, 2)); // [rTempZ|iTempW|rTempZ|iTempW] + r1 = _mm_add_ps( _mm_shuffle_ps(rTemp, rTemp, _MM_SHUFFLE(1, 0, 1, 0)), // [rTempX| rTempY| rTempX| rTempY] + + _mm_xor_ps(rZiWrZiW, vDFT4SignBits2) ); // [rTempZ| iTempW|-rTempZ|-iTempW] + i1 = _mm_add_ps( _mm_shuffle_ps(iTemp, iTemp, _MM_SHUFFLE(1, 0, 1, 0)), // [iTempX| iTempY| iTempX| iTempY] + + _mm_xor_ps(iZrWiZrW, vDFT4SignBits3) ); // [iTempZ|-rTempW|-iTempZ| rTempW] + } + + // Radix-4 decimation-in-time FFT butterfly. + // This version assumes that elements of the butterfly are + // in different vectors, so that each vector in the input + // contains elements from four different butterflies. + // The four separate butterflies are processed in parallel. + // + // The calculations here are the same as the ones in the single-vector + // radix-4 DFT, but instead of being done on a single vector (X,Y,Z,W) + // they are done in parallel on sixteen independent complex values. + // There is no interdependence between the vector elements: + // | 1 0 1 0 | | (rIn0,iIn0) | | (rIn0 + rIn2, iIn0 + iIn2) | + // | 1 0 -1 0 | * | (rIn1,iIn1) | = Temp = | (rIn0 - rIn2, iIn0 - iIn2) | + // | 0 1 0 1 | | (rIn2,iIn2) | | (rIn1 + rIn3, iIn1 + iIn3) | + // | 0 1 0 -1 | | (rIn3,iIn3) | | (rIn1 - rIn3, iIn1 - iIn3) | + // + // | 1 0 1 0 | | (rTemp0,iTemp0) | | (rTemp0 + rTemp2, iTemp0 + iTemp2) | + // Result = | 0 1 0 -j | * | (rTemp1,iTemp1) | = | (rTemp1 + iTemp3, iTemp1 - rTemp3) | + // | 1 0 -1 0 | | (rTemp2,iTemp2) | | (rTemp0 - rTemp2, iTemp0 - iTemp2) | + // | 0 1 0 j | | (rTemp3,iTemp3) | | (rTemp1 - iTemp3, iTemp1 + rTemp3) | + __forceinline void ButterflyDIT4_4 (__inout XVECTORREF r0, + __inout XVECTORREF r1, + __inout XVECTORREF r2, + __inout XVECTORREF r3, + __inout XVECTORREF i0, + __inout XVECTORREF i1, + __inout XVECTORREF i2, + __inout XVECTORREF i3, + __in_ecount(uStride*4) const XVECTOR* __restrict pUnityTableReal, + __in_ecount(uStride*4) const XVECTOR* __restrict pUnityTableImaginary, + const UINT32 uStride, const BOOL fLast) + { + DSPASSERT(pUnityTableReal != NULL); + DSPASSERT(pUnityTableImaginary != NULL); + DSPASSERT((UINT_PTR)pUnityTableReal % 16 == 0); + DSPASSERT((UINT_PTR)pUnityTableImaginary % 16 == 0); + DSPASSERT(ISPOWEROF2(uStride)); + + XVECTOR rTemp0, rTemp1, rTemp2, rTemp3, rTemp4, rTemp5, rTemp6, rTemp7; + XVECTOR iTemp0, iTemp1, iTemp2, iTemp3, iTemp4, iTemp5, iTemp6, iTemp7; + + + // calculating Temp + rTemp0 = _mm_add_ps(r0, r2); iTemp0 = _mm_add_ps(i0, i2); + rTemp2 = _mm_add_ps(r1, r3); iTemp2 = _mm_add_ps(i1, i3); + rTemp1 = _mm_sub_ps(r0, r2); iTemp1 = _mm_sub_ps(i0, i2); + rTemp3 = _mm_sub_ps(r1, r3); iTemp3 = _mm_sub_ps(i1, i3); + rTemp4 = _mm_add_ps(rTemp0, rTemp2); iTemp4 = _mm_add_ps(iTemp0, iTemp2); + rTemp5 = _mm_add_ps(rTemp1, iTemp3); iTemp5 = _mm_sub_ps(iTemp1, rTemp3); + rTemp6 = _mm_sub_ps(rTemp0, rTemp2); iTemp6 = _mm_sub_ps(iTemp0, iTemp2); + rTemp7 = _mm_sub_ps(rTemp1, iTemp3); iTemp7 = _mm_add_ps(iTemp1, rTemp3); + + // calculating Result + // vmulComplex(rTemp0, iTemp0, rTemp0, iTemp0, pUnityTableReal[0], pUnityTableImaginary[0]); // first one is always trivial + vmulComplex(rTemp5, iTemp5, pUnityTableReal[uStride], pUnityTableImaginary[uStride]); + vmulComplex(rTemp6, iTemp6, pUnityTableReal[uStride*2], pUnityTableImaginary[uStride*2]); + vmulComplex(rTemp7, iTemp7, pUnityTableReal[uStride*3], pUnityTableImaginary[uStride*3]); + if (fLast) { + ButterflyDIT4_1(rTemp4, iTemp4); + ButterflyDIT4_1(rTemp5, iTemp5); + ButterflyDIT4_1(rTemp6, iTemp6); + ButterflyDIT4_1(rTemp7, iTemp7); + } + + + r0 = rTemp4; i0 = iTemp4; + r1 = rTemp5; i1 = iTemp5; + r2 = rTemp6; i2 = iTemp6; + r3 = rTemp7; i3 = iTemp7; + } + +//-------------------------------------------------------// + + //// + // DESCRIPTION: + // 4-sample FFT. + // + // PARAMETERS: + // pReal - [inout] real components, must have at least uCount elements + // pImaginary - [inout] imaginary components, must have at least uCount elements + // uCount - [in] number of FFT iterations + // + // RETURN VALUE: + // void + //// + __forceinline void FFT4 (__inout_ecount(uCount) XVECTOR* __restrict pReal, __inout_ecount(uCount) XVECTOR* __restrict pImaginary, const UINT32 uCount=1) + { + DSPASSERT(pReal != NULL); + DSPASSERT(pImaginary != NULL); + DSPASSERT((UINT_PTR)pReal % 16 == 0); + DSPASSERT((UINT_PTR)pImaginary % 16 == 0); + DSPASSERT(ISPOWEROF2(uCount)); + + for (UINT32 uIndex=0; uIndex 16 + // uCount - [in] number of FFT iterations + // + // RETURN VALUE: + // void + //// + inline void FFT (__inout_ecount((uLength*uCount)/4) XVECTOR* __restrict pReal, __inout_ecount((uLength*uCount)/4) XVECTOR* __restrict pImaginary, __in_ecount(uLength*uCount) const XVECTOR* __restrict pUnityTable, const UINT32 uLength, const UINT32 uCount=1) + { + DSPASSERT(pReal != NULL); + DSPASSERT(pImaginary != NULL); + DSPASSERT(pUnityTable != NULL); + DSPASSERT((UINT_PTR)pReal % 16 == 0); + DSPASSERT((UINT_PTR)pImaginary % 16 == 0); + DSPASSERT((UINT_PTR)pUnityTable % 16 == 0); + DSPASSERT(uLength > 16); + DSPASSERT(ISPOWEROF2(uLength)); + DSPASSERT(ISPOWEROF2(uCount)); + + const XVECTOR* __restrict pUnityTableReal = pUnityTable; + const XVECTOR* __restrict pUnityTableImaginary = pUnityTable + (uLength>>2); + const UINT32 uTotal = uCount * uLength; + const UINT32 uTotal_vectors = uTotal >> 2; + const UINT32 uStage_vectors = uLength >> 2; + const UINT32 uStage_vectors_mask = uStage_vectors - 1; + const UINT32 uStride = uLength >> 4; // stride between butterfly elements + const UINT32 uStrideMask = uStride - 1; + const UINT32 uStride2 = uStride * 2; + const UINT32 uStride3 = uStride * 3; + const UINT32 uStrideInvMask = ~uStrideMask; + + + for (UINT32 uIndex=0; uIndex<(uTotal_vectors>>2); ++uIndex) { + const UINT32 n = ((uIndex & uStrideInvMask) << 2) + (uIndex & uStrideMask); + ButterflyDIT4_4(pReal[n], + pReal[n + uStride], + pReal[n + uStride2], + pReal[n + uStride3], + pImaginary[n ], + pImaginary[n + uStride], + pImaginary[n + uStride2], + pImaginary[n + uStride3], + pUnityTableReal + (n & uStage_vectors_mask), + pUnityTableImaginary + (n & uStage_vectors_mask), + uStride, FALSE); + } + + + if (uLength > 16*4) { + FFT(pReal, pImaginary, pUnityTable+(uLength>>1), uLength>>2, uCount*4); + } else if (uLength == 16*4) { + FFT16(pReal, pImaginary, uCount*4); + } else if (uLength == 8*4) { + FFT8(pReal, pImaginary, uCount*4); + } else if (uLength == 4*4) { + FFT4(pReal, pImaginary, uCount*4); + } + } + +//--------------------------------------------------------------------------// + //// + // DESCRIPTION: + // Initializes unity roots lookup table used by FFT functions. + // Once initialized, the table need not be initialized again unless a + // different FFT length is desired. + // + // REMARKS: + // The unity tables of FFT length 16 and below are hard coded into the + // respective FFT functions and so need not be initialized. + // + // PARAMETERS: + // pUnityTable - [out] unity table, receives unity roots lookup table, must have at least uLength elements + // uLength - [in] FFT length in frames, must be a power of 2 > 16 + // + // RETURN VALUE: + // void + //// +inline void FFTInitializeUnityTable (__out_ecount(uLength) XVECTOR* __restrict pUnityTable, UINT32 uLength) +{ + DSPASSERT(pUnityTable != NULL); + DSPASSERT(uLength > 16); + DSPASSERT(ISPOWEROF2(uLength)); + + FLOAT32* __restrict pfUnityTable = (FLOAT32* __restrict)pUnityTable; + + + // initialize unity table for recursive FFT lengths: uLength, uLength/4, uLength/16... > 16 + do { + FLOAT32 flStep = 6.283185307f / uLength; // 2PI / FFT length + uLength >>= 2; + + // pUnityTable[0 to uLength*4-1] contains real components for current FFT length + // pUnityTable[uLength*4 to uLength*8-1] contains imaginary components for current FFT length + for (UINT32 i=0; i<4; ++i) { + for (UINT32 j=0; j 16); +} + + + //// + // DESCRIPTION: + // The FFT functions generate output in bit reversed order. + // Use this function to re-arrange them into order of increasing frequency. + // + // REMARKS: + // + // PARAMETERS: + // pOutput - [out] output buffer, receives samples in order of increasing frequency, cannot overlap pInput, must have at least (1<= 2 + // + // RETURN VALUE: + // void + //// +inline void FFTUnswizzle (__out_ecount((1<= 2); + + FLOAT32* __restrict pfOutput = (FLOAT32* __restrict)pOutput; + const FLOAT32* __restrict pfInput = (const FLOAT32* __restrict)pInput; + const UINT32 uLength = UINT32(1 << uLog2Length); + + + if ((uLog2Length & 0x1) == 0) { + // even powers of two + for (UINT32 uIndex=0; uIndex> 2 ) | ( (n & 0x33333333) << 2 ); + n = ( (n & 0xf0f0f0f0) >> 4 ) | ( (n & 0x0f0f0f0f) << 4 ); + n = ( (n & 0xff00ff00) >> 8 ) | ( (n & 0x00ff00ff) << 8 ); + n = ( (n & 0xffff0000) >> 16 ) | ( (n & 0x0000ffff) << 16 ); + n >>= (32 - uLog2Length); + pfOutput[n] = pfInput[uIndex]; + } + } else { + // odd powers of two + for (UINT32 uIndex=0; uIndex>3); + n = ( (n & 0xcccccccc) >> 2 ) | ( (n & 0x33333333) << 2 ); + n = ( (n & 0xf0f0f0f0) >> 4 ) | ( (n & 0x0f0f0f0f) << 4 ); + n = ( (n & 0xff00ff00) >> 8 ) | ( (n & 0x00ff00ff) << 8 ); + n = ( (n & 0xffff0000) >> 16 ) | ( (n & 0x0000ffff) << 16 ); + n >>= (32 - (uLog2Length-3)); + n |= ((uIndex & 0x7) << (uLog2Length - 3)); + pfOutput[n] = pfInput[uIndex]; + } + } +} + + + //// + // DESCRIPTION: + // Convert complex components to polar form. + // + // PARAMETERS: + // pOutput - [out] output buffer, receives samples in polar form, must have at least uLength/4 elements + // pInputReal - [in] input buffer (real components), must have at least uLength/4 elements + // pInputImaginary - [in] input buffer (imaginary components), must have at least uLength/4 elements + // uLength - [in] FFT length in samples, must be a power of 2 >= 4 + // + // RETURN VALUE: + // void + //// +inline void FFTPolar (__out_ecount(uLength/4) XVECTOR* __restrict pOutput, __in_ecount(uLength/4) const XVECTOR* __restrict pInputReal, __in_ecount(uLength/4) const XVECTOR* __restrict pInputImaginary, const UINT32 uLength) +{ + DSPASSERT(pOutput != NULL); + DSPASSERT(pInputReal != NULL); + DSPASSERT(pInputImaginary != NULL); + DSPASSERT(uLength >= 4); + DSPASSERT(ISPOWEROF2(uLength)); + + FLOAT32 flOneOverLength = 1.0f / uLength; + + + // result = sqrtf((real/uLength)^2 + (imaginary/uLength)^2) * 2 + XVECTOR vOneOverLength = _mm_set_ps1(flOneOverLength); + + for (UINT32 uIndex=0; uIndex<(uLength>>2); ++uIndex) { + XVECTOR vReal = _mm_mul_ps(pInputReal[uIndex], vOneOverLength); + XVECTOR vImaginary = _mm_mul_ps(pInputImaginary[uIndex], vOneOverLength); + XVECTOR vRR = _mm_mul_ps(vReal, vReal); + XVECTOR vII = _mm_mul_ps(vImaginary, vImaginary); + XVECTOR vRRplusII = _mm_add_ps(vRR, vII); + XVECTOR vTotal = _mm_sqrt_ps(vRRplusII); + pOutput[uIndex] = _mm_add_ps(vTotal, vTotal); + } +} + + + + + +//--------------------------------------------------------------------------// + //// + // DESCRIPTION: + // Deinterleaves audio samples such that all samples corresponding to + + // + // REMARKS: + // For example, audio of the form [LRLRLR] becomes [LLLRRR]. + // + // PARAMETERS: + // pOutput - [out] output buffer, receives samples in deinterleaved form, cannot overlap pInput, must have at least (uChannelCount*uFrameCount)/4 elements + // pInput - [in] input buffer, cannot overlap pOutput, must have at least (uChannelCount*uFrameCount)/4 elements + // uChannelCount - [in] number of channels, must be > 1 + // uFrameCount - [in] number of frames of valid data, must be > 0 + // + // RETURN VALUE: + // void + //// +inline void Deinterleave (__out_ecount((uChannelCount*uFrameCount)/4) XVECTOR* __restrict pOutput, __in_ecount((uChannelCount*uFrameCount)/4) const XVECTOR* __restrict pInput, const UINT32 uChannelCount, const UINT32 uFrameCount) +{ + DSPASSERT(pOutput != NULL); + DSPASSERT(pInput != NULL); + DSPASSERT(uChannelCount > 1); + DSPASSERT(uFrameCount > 0); + + FLOAT32* __restrict pfOutput = (FLOAT32* __restrict)pOutput; + const FLOAT32* __restrict pfInput = (const FLOAT32* __restrict)pInput; + + + for (UINT32 uChannel=0; uChannel 1 + // uFrameCount - [in] number of frames of valid data, must be > 0 + // + // RETURN VALUE: + // void + //// +inline void Interleave (__out_ecount((uChannelCount*uFrameCount)/4) XVECTOR* __restrict pOutput, __in_ecount((uChannelCount*uFrameCount)/4) const XVECTOR* __restrict pInput, const UINT32 uChannelCount, const UINT32 uFrameCount) +{ + DSPASSERT(pOutput != NULL); + DSPASSERT(pInput != NULL); + DSPASSERT(uChannelCount > 1); + DSPASSERT(uFrameCount > 0); + + FLOAT32* __restrict pfOutput = (FLOAT32* __restrict)pOutput; + const FLOAT32* __restrict pfInput = (const FLOAT32* __restrict)pInput; + + + for (UINT32 uChannel=0; uChannel 0 && uChannelCount <= 6); + DSPASSERT(uLog2Length >= 2 && uLog2Length <= 9); + + XVECTOR vRealTemp[768]; + XVECTOR vImaginaryTemp[768]; + const UINT32 uLength = UINT32(1 << uLog2Length); + + + if (uChannelCount > 1) { + Deinterleave(vRealTemp, pReal, uChannelCount, uLength); + } else { + CopyMemory(vRealTemp, pReal, (uLength>>2)*sizeof(XVECTOR)); + } + for (UINT32 u=0; u>2); u++) { + vImaginaryTemp[u] = _mm_setzero_ps(); + } + + if (uLength > 16) { + for (UINT32 uChannel=0; uChannel>2)], &vImaginaryTemp[uChannel*(uLength>>2)], pUnityTable, uLength); + } + } else if (uLength == 16) { + for (UINT32 uChannel=0; uChannel>2)], &vImaginaryTemp[uChannel*(uLength>>2)]); + } + } else if (uLength == 8) { + for (UINT32 uChannel=0; uChannel>2)], &vImaginaryTemp[uChannel*(uLength>>2)]); + } + } else if (uLength == 4) { + for (UINT32 uChannel=0; uChannel>2)], &vImaginaryTemp[uChannel*(uLength>>2)]); + } + } + + for (UINT32 uChannel=0; uChannel>2)], &vRealTemp[uChannel*(uLength>>2)], uLog2Length); + FFTUnswizzle(&pImaginary[uChannel*(uLength>>2)], &vImaginaryTemp[uChannel*(uLength>>2)], uLog2Length); + } +} + + + //// + // DESCRIPTION: + // This function applies a 2^N-sample inverse FFT. + // Audio is interleaved if multichannel. + // + // PARAMETERS: + // pReal - [inout] real components, must have at least (1< 0 + // uLog2Length - [in] LOG (base 2) of FFT length in frames, must within [2, 10] + // + // RETURN VALUE: + // void + //// +inline void IFFTDeinterleaved (__inout_ecount((1< 0 && uChannelCount <= 6); + DSPASSERT(uLog2Length >= 2 && uLog2Length <= 9); + + XVECTOR vRealTemp[768]; + XVECTOR vImaginaryTemp[768]; + const UINT32 uLength = UINT32(1 << uLog2Length); + + + const XVECTOR vRnp = _mm_set_ps1(1.0f/uLength); + const XVECTOR vRnm = _mm_set_ps1(-1.0f/uLength); + for (UINT32 u=0; u>2); u++) { + vRealTemp[u] = _mm_mul_ps(pReal[u], vRnp); + vImaginaryTemp[u] = _mm_mul_ps(pImaginary[u], vRnm); + } + + if (uLength > 16) { + for (UINT32 uChannel=0; uChannel>2)], &vImaginaryTemp[uChannel*(uLength>>2)], pUnityTable, uLength); + } + } else if (uLength == 16) { + for (UINT32 uChannel=0; uChannel>2)], &vImaginaryTemp[uChannel*(uLength>>2)]); + } + } else if (uLength == 8) { + for (UINT32 uChannel=0; uChannel>2)], &vImaginaryTemp[uChannel*(uLength>>2)]); + } + } else if (uLength == 4) { + for (UINT32 uChannel=0; uChannel>2)], &vImaginaryTemp[uChannel*(uLength>>2)]); + } + } + + for (UINT32 uChannel=0; uChannel>2)], &vRealTemp[uChannel*(uLength>>2)], uLog2Length); + } + if (uChannelCount > 1) { + Interleave(pReal, vImaginaryTemp, uChannelCount, uLength); + } else { + CopyMemory(pReal, vImaginaryTemp, (uLength>>2)*sizeof(XVECTOR)); + } +} + + +#pragma warning(pop) +}; // namespace XDSP +//---------------------------------<-EOF->----------------------------------// + diff --git a/MediaClient/MediaClient/directx/include/XInput.h b/MediaClient/MediaClient/directx/include/XInput.h new file mode 100644 index 0000000..c50a5cb --- /dev/null +++ b/MediaClient/MediaClient/directx/include/XInput.h @@ -0,0 +1,283 @@ +/*************************************************************************** +* * +* XInput.h -- This module defines XBOX controller APIs * +* and constansts for the Windows platform. * +* * +* Copyright (c) Microsoft Corp. All rights reserved. * +* * +***************************************************************************/ +#ifndef _XINPUT_H_ +#define _XINPUT_H_ + +#include + +// Current name of the DLL shipped in the same SDK as this header. +// The name reflects the current version +#ifndef XINPUT_USE_9_1_0 +#define XINPUT_DLL_A "xinput1_3.dll" +#define XINPUT_DLL_W L"xinput1_3.dll" +#else +#define XINPUT_DLL_A "xinput9_1_0.dll" +#define XINPUT_DLL_W L"xinput9_1_0.dll" +#endif +#ifdef UNICODE + #define XINPUT_DLL XINPUT_DLL_W +#else + #define XINPUT_DLL XINPUT_DLL_A +#endif + +// +// Device types available in XINPUT_CAPABILITIES +// +#define XINPUT_DEVTYPE_GAMEPAD 0x01 + +// +// Device subtypes available in XINPUT_CAPABILITIES +// +#define XINPUT_DEVSUBTYPE_GAMEPAD 0x01 + +#ifndef XINPUT_USE_9_1_0 + +#define XINPUT_DEVSUBTYPE_WHEEL 0x02 +#define XINPUT_DEVSUBTYPE_ARCADE_STICK 0x03 +#define XINPUT_DEVSUBTYPE_FLIGHT_SICK 0x04 +#define XINPUT_DEVSUBTYPE_DANCE_PAD 0x05 +#define XINPUT_DEVSUBTYPE_GUITAR 0x06 +#define XINPUT_DEVSUBTYPE_DRUM_KIT 0x08 + +#endif // !XINPUT_USE_9_1_0 + + + +// +// Flags for XINPUT_CAPABILITIES +// +#define XINPUT_CAPS_VOICE_SUPPORTED 0x0004 + +// +// Constants for gamepad buttons +// +#define XINPUT_GAMEPAD_DPAD_UP 0x0001 +#define XINPUT_GAMEPAD_DPAD_DOWN 0x0002 +#define XINPUT_GAMEPAD_DPAD_LEFT 0x0004 +#define XINPUT_GAMEPAD_DPAD_RIGHT 0x0008 +#define XINPUT_GAMEPAD_START 0x0010 +#define XINPUT_GAMEPAD_BACK 0x0020 +#define XINPUT_GAMEPAD_LEFT_THUMB 0x0040 +#define XINPUT_GAMEPAD_RIGHT_THUMB 0x0080 +#define XINPUT_GAMEPAD_LEFT_SHOULDER 0x0100 +#define XINPUT_GAMEPAD_RIGHT_SHOULDER 0x0200 +#define XINPUT_GAMEPAD_A 0x1000 +#define XINPUT_GAMEPAD_B 0x2000 +#define XINPUT_GAMEPAD_X 0x4000 +#define XINPUT_GAMEPAD_Y 0x8000 + + +// +// Gamepad thresholds +// +#define XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE 7849 +#define XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE 8689 +#define XINPUT_GAMEPAD_TRIGGER_THRESHOLD 30 + +// +// Flags to pass to XInputGetCapabilities +// +#define XINPUT_FLAG_GAMEPAD 0x00000001 + + +#ifndef XINPUT_USE_9_1_0 + +// +// Devices that support batteries +// +#define BATTERY_DEVTYPE_GAMEPAD 0x00 +#define BATTERY_DEVTYPE_HEADSET 0x01 + +// +// Flags for battery status level +// +#define BATTERY_TYPE_DISCONNECTED 0x00 // This device is not connected +#define BATTERY_TYPE_WIRED 0x01 // Wired device, no battery +#define BATTERY_TYPE_ALKALINE 0x02 // Alkaline battery source +#define BATTERY_TYPE_NIMH 0x03 // Nickel Metal Hydride battery source +#define BATTERY_TYPE_UNKNOWN 0xFF // Cannot determine the battery type + +// These are only valid for wireless, connected devices, with known battery types +// The amount of use time remaining depends on the type of device. +#define BATTERY_LEVEL_EMPTY 0x00 +#define BATTERY_LEVEL_LOW 0x01 +#define BATTERY_LEVEL_MEDIUM 0x02 +#define BATTERY_LEVEL_FULL 0x03 + +// User index definitions +#define XUSER_MAX_COUNT 4 + +#define XUSER_INDEX_ANY 0x000000FF + + +// +// Codes returned for the gamepad keystroke +// + +#define VK_PAD_A 0x5800 +#define VK_PAD_B 0x5801 +#define VK_PAD_X 0x5802 +#define VK_PAD_Y 0x5803 +#define VK_PAD_RSHOULDER 0x5804 +#define VK_PAD_LSHOULDER 0x5805 +#define VK_PAD_LTRIGGER 0x5806 +#define VK_PAD_RTRIGGER 0x5807 + +#define VK_PAD_DPAD_UP 0x5810 +#define VK_PAD_DPAD_DOWN 0x5811 +#define VK_PAD_DPAD_LEFT 0x5812 +#define VK_PAD_DPAD_RIGHT 0x5813 +#define VK_PAD_START 0x5814 +#define VK_PAD_BACK 0x5815 +#define VK_PAD_LTHUMB_PRESS 0x5816 +#define VK_PAD_RTHUMB_PRESS 0x5817 + +#define VK_PAD_LTHUMB_UP 0x5820 +#define VK_PAD_LTHUMB_DOWN 0x5821 +#define VK_PAD_LTHUMB_RIGHT 0x5822 +#define VK_PAD_LTHUMB_LEFT 0x5823 +#define VK_PAD_LTHUMB_UPLEFT 0x5824 +#define VK_PAD_LTHUMB_UPRIGHT 0x5825 +#define VK_PAD_LTHUMB_DOWNRIGHT 0x5826 +#define VK_PAD_LTHUMB_DOWNLEFT 0x5827 + +#define VK_PAD_RTHUMB_UP 0x5830 +#define VK_PAD_RTHUMB_DOWN 0x5831 +#define VK_PAD_RTHUMB_RIGHT 0x5832 +#define VK_PAD_RTHUMB_LEFT 0x5833 +#define VK_PAD_RTHUMB_UPLEFT 0x5834 +#define VK_PAD_RTHUMB_UPRIGHT 0x5835 +#define VK_PAD_RTHUMB_DOWNRIGHT 0x5836 +#define VK_PAD_RTHUMB_DOWNLEFT 0x5837 + +// +// Flags used in XINPUT_KEYSTROKE +// +#define XINPUT_KEYSTROKE_KEYDOWN 0x0001 +#define XINPUT_KEYSTROKE_KEYUP 0x0002 +#define XINPUT_KEYSTROKE_REPEAT 0x0004 + +#endif //!XINPUT_USE_9_1_0 + +// +// Structures used by XInput APIs +// +typedef struct _XINPUT_GAMEPAD +{ + WORD wButtons; + BYTE bLeftTrigger; + BYTE bRightTrigger; + SHORT sThumbLX; + SHORT sThumbLY; + SHORT sThumbRX; + SHORT sThumbRY; +} XINPUT_GAMEPAD, *PXINPUT_GAMEPAD; + +typedef struct _XINPUT_STATE +{ + DWORD dwPacketNumber; + XINPUT_GAMEPAD Gamepad; +} XINPUT_STATE, *PXINPUT_STATE; + +typedef struct _XINPUT_VIBRATION +{ + WORD wLeftMotorSpeed; + WORD wRightMotorSpeed; +} XINPUT_VIBRATION, *PXINPUT_VIBRATION; + +typedef struct _XINPUT_CAPABILITIES +{ + BYTE Type; + BYTE SubType; + WORD Flags; + XINPUT_GAMEPAD Gamepad; + XINPUT_VIBRATION Vibration; +} XINPUT_CAPABILITIES, *PXINPUT_CAPABILITIES; + +#ifndef XINPUT_USE_9_1_0 + +typedef struct _XINPUT_BATTERY_INFORMATION +{ + BYTE BatteryType; + BYTE BatteryLevel; +} XINPUT_BATTERY_INFORMATION, *PXINPUT_BATTERY_INFORMATION; + +typedef struct _XINPUT_KEYSTROKE +{ + WORD VirtualKey; + WCHAR Unicode; + WORD Flags; + BYTE UserIndex; + BYTE HidCode; +} XINPUT_KEYSTROKE, *PXINPUT_KEYSTROKE; + +#endif // !XINPUT_USE_9_1_0 + +// +// XInput APIs +// +#ifdef __cplusplus +extern "C" { +#endif + +DWORD WINAPI XInputGetState +( + __in DWORD dwUserIndex, // Index of the gamer associated with the device + __out XINPUT_STATE* pState // Receives the current state +); + +DWORD WINAPI XInputSetState +( + __in DWORD dwUserIndex, // Index of the gamer associated with the device + __in XINPUT_VIBRATION* pVibration // The vibration information to send to the controller +); + +DWORD WINAPI XInputGetCapabilities +( + __in DWORD dwUserIndex, // Index of the gamer associated with the device + __in DWORD dwFlags, // Input flags that identify the device type + __out XINPUT_CAPABILITIES* pCapabilities // Receives the capabilities +); + +void WINAPI XInputEnable +( + __in BOOL enable // [in] Indicates whether xinput is enabled or disabled. +); + +DWORD WINAPI XInputGetDSoundAudioDeviceGuids +( + __in DWORD dwUserIndex, // Index of the gamer associated with the device + __out GUID* pDSoundRenderGuid, // DSound device ID for render + __out GUID* pDSoundCaptureGuid // DSound device ID for capture +); + +#ifndef XINPUT_USE_9_1_0 + +DWORD WINAPI XInputGetBatteryInformation +( + __in DWORD dwUserIndex, // Index of the gamer associated with the device + __in BYTE devType, // Which device on this user index + __out XINPUT_BATTERY_INFORMATION* pBatteryInformation // Contains the level and types of batteries +); + +DWORD WINAPI XInputGetKeystroke +( + __in DWORD dwUserIndex, // Index of the gamer associated with the device + __reserved DWORD dwReserved, // Reserved for future use + __out PXINPUT_KEYSTROKE pKeystroke // Pointer to an XINPUT_KEYSTROKE structure that receives an input event. +); + +#endif //!XINPUT_USE_9_1_0 + +#ifdef __cplusplus +} +#endif + +#endif //_XINPUT_H_ + diff --git a/MediaClient/MediaClient/directx/include/audiodefs.h b/MediaClient/MediaClient/directx/include/audiodefs.h new file mode 100644 index 0000000..ff995ec --- /dev/null +++ b/MediaClient/MediaClient/directx/include/audiodefs.h @@ -0,0 +1,263 @@ +/*************************************************************************** + * + * Copyright (c) Microsoft Corporation. All rights reserved. + * + * File: audiodefs.h + * Content: Basic constants and data types for audio work. + * + * Remarks: This header file defines all of the audio format constants and + * structures required for XAudio2 and XACT work. Providing these + * in a single location avoids certain dependency problems in the + * legacy audio headers (mmreg.h, mmsystem.h, ksmedia.h). + * + * NOTE: Including the legacy headers after this one may cause a + * compilation error, because they define some of the same types + * defined here without preprocessor guards to avoid multiple + * definitions. If a source file needs one of the old headers, + * it must include it before including audiodefs.h. + * + ***************************************************************************/ + +#ifndef __AUDIODEFS_INCLUDED__ +#define __AUDIODEFS_INCLUDED__ + +#include // For WORD, DWORD, etc. + +#pragma pack(push, 1) // Pack structures to 1-byte boundaries + + +/************************************************************************** + * + * WAVEFORMATEX: Base structure for many audio formats. Format-specific + * extensions can be defined for particular formats by using a non-zero + * cbSize value and adding extra fields to the end of this structure. + * + ***************************************************************************/ + +#ifndef _WAVEFORMATEX_ + + #define _WAVEFORMATEX_ + typedef struct tWAVEFORMATEX + { + WORD wFormatTag; // Integer identifier of the format + WORD nChannels; // Number of audio channels + DWORD nSamplesPerSec; // Audio sample rate + DWORD nAvgBytesPerSec; // Bytes per second (possibly approximate) + WORD nBlockAlign; // Size in bytes of a sample block (all channels) + WORD wBitsPerSample; // Size in bits of a single per-channel sample + WORD cbSize; // Bytes of extra data appended to this struct + } WAVEFORMATEX; + +#endif + +// Defining pointer types outside of the #if block to make sure they are +// defined even if mmreg.h or mmsystem.h is #included before this file + +typedef WAVEFORMATEX *PWAVEFORMATEX, *NPWAVEFORMATEX, *LPWAVEFORMATEX; +typedef const WAVEFORMATEX *PCWAVEFORMATEX, *LPCWAVEFORMATEX; + + +/************************************************************************** + * + * WAVEFORMATEXTENSIBLE: Extended version of WAVEFORMATEX that should be + * used as a basis for all new audio formats. The format tag is replaced + * with a GUID, allowing new formats to be defined without registering a + * format tag with Microsoft. There are also new fields that can be used + * to specify the spatial positions for each channel and the bit packing + * used for wide samples (e.g. 24-bit PCM samples in 32-bit containers). + * + ***************************************************************************/ + +#ifndef _WAVEFORMATEXTENSIBLE_ + + #define _WAVEFORMATEXTENSIBLE_ + typedef struct + { + WAVEFORMATEX Format; // Base WAVEFORMATEX data + union + { + WORD wValidBitsPerSample; // Valid bits in each sample container + WORD wSamplesPerBlock; // Samples per block of audio data; valid + // if wBitsPerSample=0 (but rarely used). + WORD wReserved; // Zero if neither case above applies. + } Samples; + DWORD dwChannelMask; // Positions of the audio channels + GUID SubFormat; // Format identifier GUID + } WAVEFORMATEXTENSIBLE; + +#endif + +typedef WAVEFORMATEXTENSIBLE *PWAVEFORMATEXTENSIBLE, *LPWAVEFORMATEXTENSIBLE; +typedef const WAVEFORMATEXTENSIBLE *PCWAVEFORMATEXTENSIBLE, *LPCWAVEFORMATEXTENSIBLE; + + + +/************************************************************************** + * + * Define the most common wave format tags used in WAVEFORMATEX formats. + * + ***************************************************************************/ + +#ifndef WAVE_FORMAT_PCM // Pulse Code Modulation + + // If WAVE_FORMAT_PCM is not defined, we need to define some legacy types + // for compatibility with the Windows mmreg.h / mmsystem.h header files. + + // Old general format structure (information common to all formats) + typedef struct waveformat_tag + { + WORD wFormatTag; + WORD nChannels; + DWORD nSamplesPerSec; + DWORD nAvgBytesPerSec; + WORD nBlockAlign; + } WAVEFORMAT, *PWAVEFORMAT, NEAR *NPWAVEFORMAT, FAR *LPWAVEFORMAT; + + // Specific format structure for PCM data + typedef struct pcmwaveformat_tag + { + WAVEFORMAT wf; + WORD wBitsPerSample; + } PCMWAVEFORMAT, *PPCMWAVEFORMAT, NEAR *NPPCMWAVEFORMAT, FAR *LPPCMWAVEFORMAT; + + #define WAVE_FORMAT_PCM 0x0001 + +#endif + +#ifndef WAVE_FORMAT_ADPCM // Microsoft Adaptive Differental PCM + + // Replicate the Microsoft ADPCM type definitions from mmreg.h. + + typedef struct adpcmcoef_tag + { + short iCoef1; + short iCoef2; + } ADPCMCOEFSET; + + #pragma warning(push) + #pragma warning(disable:4200) // Disable zero-sized array warnings + + typedef struct adpcmwaveformat_tag { + WAVEFORMATEX wfx; + WORD wSamplesPerBlock; + WORD wNumCoef; + ADPCMCOEFSET aCoef[]; // Always 7 coefficient pairs for MS ADPCM + } ADPCMWAVEFORMAT; + + #pragma warning(pop) + + #define WAVE_FORMAT_ADPCM 0x0002 + +#endif + +// Other frequently used format tags + +#ifndef WAVE_FORMAT_UNKNOWN + #define WAVE_FORMAT_UNKNOWN 0x0000 // Unknown or invalid format tag +#endif + +#ifndef WAVE_FORMAT_IEEE_FLOAT + #define WAVE_FORMAT_IEEE_FLOAT 0x0003 // 32-bit floating-point +#endif + +#ifndef WAVE_FORMAT_MPEGLAYER3 + #define WAVE_FORMAT_MPEGLAYER3 0x0055 // ISO/MPEG Layer3 +#endif + +#ifndef WAVE_FORMAT_DOLBY_AC3_SPDIF + #define WAVE_FORMAT_DOLBY_AC3_SPDIF 0x0092 // Dolby Audio Codec 3 over S/PDIF +#endif + +#ifndef WAVE_FORMAT_WMAUDIO2 + #define WAVE_FORMAT_WMAUDIO2 0x0161 // Windows Media Audio +#endif + +#ifndef WAVE_FORMAT_WMAUDIO3 + #define WAVE_FORMAT_WMAUDIO3 0x0162 // Windows Media Audio Pro +#endif + +#ifndef WAVE_FORMAT_WMASPDIF + #define WAVE_FORMAT_WMASPDIF 0x0164 // Windows Media Audio over S/PDIF +#endif + +#ifndef WAVE_FORMAT_EXTENSIBLE + #define WAVE_FORMAT_EXTENSIBLE 0xFFFE // All WAVEFORMATEXTENSIBLE formats +#endif + + +/************************************************************************** + * + * Define the most common wave format GUIDs used in WAVEFORMATEXTENSIBLE + * formats. Note that including the Windows ksmedia.h header after this + * one will cause build problems; this cannot be avoided, since ksmedia.h + * defines these macros without preprocessor guards. + * + ***************************************************************************/ + +#ifdef __cplusplus // uuid() and __uuidof() are only available in C++ + + #ifndef KSDATAFORMAT_SUBTYPE_PCM + struct __declspec(uuid("00000001-0000-0010-8000-00aa00389b71")) KSDATAFORMAT_SUBTYPE_PCM_STRUCT; + #define KSDATAFORMAT_SUBTYPE_PCM __uuidof(KSDATAFORMAT_SUBTYPE_PCM_STRUCT) + #endif + + #ifndef KSDATAFORMAT_SUBTYPE_ADPCM + struct __declspec(uuid("00000002-0000-0010-8000-00aa00389b71")) KSDATAFORMAT_SUBTYPE_ADPCM_STRUCT; + #define KSDATAFORMAT_SUBTYPE_ADPCM __uuidof(KSDATAFORMAT_SUBTYPE_ADPCM_STRUCT) + #endif + + #ifndef KSDATAFORMAT_SUBTYPE_IEEE_FLOAT + struct __declspec(uuid("00000003-0000-0010-8000-00aa00389b71")) KSDATAFORMAT_SUBTYPE_IEEE_FLOAT_STRUCT; + #define KSDATAFORMAT_SUBTYPE_IEEE_FLOAT __uuidof(KSDATAFORMAT_SUBTYPE_IEEE_FLOAT_STRUCT) + #endif + +#endif + + +/************************************************************************** + * + * Speaker positions used in the WAVEFORMATEXTENSIBLE dwChannelMask field. + * + ***************************************************************************/ + +#ifndef SPEAKER_FRONT_LEFT + #define SPEAKER_FRONT_LEFT 0x00000001 + #define SPEAKER_FRONT_RIGHT 0x00000002 + #define SPEAKER_FRONT_CENTER 0x00000004 + #define SPEAKER_LOW_FREQUENCY 0x00000008 + #define SPEAKER_BACK_LEFT 0x00000010 + #define SPEAKER_BACK_RIGHT 0x00000020 + #define SPEAKER_FRONT_LEFT_OF_CENTER 0x00000040 + #define SPEAKER_FRONT_RIGHT_OF_CENTER 0x00000080 + #define SPEAKER_BACK_CENTER 0x00000100 + #define SPEAKER_SIDE_LEFT 0x00000200 + #define SPEAKER_SIDE_RIGHT 0x00000400 + #define SPEAKER_TOP_CENTER 0x00000800 + #define SPEAKER_TOP_FRONT_LEFT 0x00001000 + #define SPEAKER_TOP_FRONT_CENTER 0x00002000 + #define SPEAKER_TOP_FRONT_RIGHT 0x00004000 + #define SPEAKER_TOP_BACK_LEFT 0x00008000 + #define SPEAKER_TOP_BACK_CENTER 0x00010000 + #define SPEAKER_TOP_BACK_RIGHT 0x00020000 + #define SPEAKER_RESERVED 0x7FFC0000 + #define SPEAKER_ALL 0x80000000 + #define _SPEAKER_POSITIONS_ +#endif + +#ifndef SPEAKER_STEREO + #define SPEAKER_MONO (SPEAKER_FRONT_CENTER) + #define SPEAKER_STEREO (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT) + #define SPEAKER_2POINT1 (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_LOW_FREQUENCY) + #define SPEAKER_SURROUND (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_BACK_CENTER) + #define SPEAKER_QUAD (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT) + #define SPEAKER_4POINT1 (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_LOW_FREQUENCY | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT) + #define SPEAKER_5POINT1 (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT) + #define SPEAKER_7POINT1 (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT | SPEAKER_FRONT_LEFT_OF_CENTER | SPEAKER_FRONT_RIGHT_OF_CENTER) + #define SPEAKER_5POINT1_SURROUND (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | SPEAKER_SIDE_LEFT | SPEAKER_SIDE_RIGHT) + #define SPEAKER_7POINT1_SURROUND (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT | SPEAKER_SIDE_LEFT | SPEAKER_SIDE_RIGHT) +#endif + + +#pragma pack(pop) + +#endif // #ifndef __AUDIODEFS_INCLUDED__ diff --git a/MediaClient/MediaClient/directx/include/comdecl.h b/MediaClient/MediaClient/directx/include/comdecl.h new file mode 100644 index 0000000..2ae9a96 --- /dev/null +++ b/MediaClient/MediaClient/directx/include/comdecl.h @@ -0,0 +1,59 @@ +// comdecl.h: Macros to facilitate COM interface and GUID declarations. +// Copyright (c) Microsoft Corporation. All rights reserved. + +#ifndef _COMDECL_H_ +#define _COMDECL_H_ + +#ifndef _XBOX + #include // For standard COM interface macros +#else + #pragma warning(push) + #pragma warning(disable:4061) + #include // Required by xobjbase.h + #include // Special definitions for Xbox build + #pragma warning(pop) +#endif + +// The DEFINE_CLSID() and DEFINE_IID() macros defined below allow COM GUIDs to +// be declared and defined in such a way that clients can obtain the GUIDs using +// either the __uuidof() extension or the old-style CLSID_Foo / IID_IFoo names. +// If using the latter approach, the client can also choose whether to get the +// GUID definitions by defining the INITGUID preprocessor constant or by linking +// to a GUID library. This works in either C or C++. + +#ifdef __cplusplus + + #define DECLSPEC_UUID_WRAPPER(x) __declspec(uuid(#x)) + #ifdef INITGUID + + #define DEFINE_CLSID(className, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ + class DECLSPEC_UUID_WRAPPER(l##-##w1##-##w2##-##b1##b2##-##b3##b4##b5##b6##b7##b8) className; \ + EXTERN_C const GUID DECLSPEC_SELECTANY CLSID_##className = __uuidof(className) + + #define DEFINE_IID(interfaceName, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ + interface DECLSPEC_UUID_WRAPPER(l##-##w1##-##w2##-##b1##b2##-##b3##b4##b5##b6##b7##b8) interfaceName; \ + EXTERN_C const GUID DECLSPEC_SELECTANY IID_##interfaceName = __uuidof(interfaceName) + + #else // INITGUID + + #define DEFINE_CLSID(className, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ + class DECLSPEC_UUID_WRAPPER(l##-##w1##-##w2##-##b1##b2##-##b3##b4##b5##b6##b7##b8) className; \ + EXTERN_C const GUID CLSID_##className + + #define DEFINE_IID(interfaceName, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ + interface DECLSPEC_UUID_WRAPPER(l##-##w1##-##w2##-##b1##b2##-##b3##b4##b5##b6##b7##b8) interfaceName; \ + EXTERN_C const GUID IID_##interfaceName + + #endif // INITGUID + +#else // __cplusplus + + #define DEFINE_CLSID(className, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ + DEFINE_GUID(CLSID_##className, 0x##l, 0x##w1, 0x##w2, 0x##b1, 0x##b2, 0x##b3, 0x##b4, 0x##b5, 0x##b6, 0x##b7, 0x##b8) + + #define DEFINE_IID(interfaceName, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ + DEFINE_GUID(IID_##interfaceName, 0x##l, 0x##w1, 0x##w2, 0x##b1, 0x##b2, 0x##b3, 0x##b4, 0x##b5, 0x##b6, 0x##b7, 0x##b8) + +#endif // __cplusplus + +#endif // #ifndef _COMDECL_H_ diff --git a/MediaClient/MediaClient/directx/include/d3d10misc.h b/MediaClient/MediaClient/directx/include/d3d10misc.h new file mode 100644 index 0000000..a20644d --- /dev/null +++ b/MediaClient/MediaClient/directx/include/d3d10misc.h @@ -0,0 +1,143 @@ +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// File: D3D10Misc.h +// Content: D3D10 Device Creation APIs +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef __D3D10MISC_H__ +#define __D3D10MISC_H__ + +#include "d3d10.h" + +// ID3D10Blob has been made version-neutral and moved to d3dcommon.h. + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + +/////////////////////////////////////////////////////////////////////////// +// D3D10_DRIVER_TYPE +// ---------------- +// +// This identifier is used to determine the implementation of Direct3D10 +// to be used. +// +// Pass one of these values to D3D10CreateDevice +// +/////////////////////////////////////////////////////////////////////////// +typedef enum D3D10_DRIVER_TYPE +{ + D3D10_DRIVER_TYPE_HARDWARE = 0, + D3D10_DRIVER_TYPE_REFERENCE = 1, + D3D10_DRIVER_TYPE_NULL = 2, + D3D10_DRIVER_TYPE_SOFTWARE = 3, + D3D10_DRIVER_TYPE_WARP = 5, +} D3D10_DRIVER_TYPE; + +DEFINE_GUID(GUID_DeviceType, +0xd722fb4d, 0x7a68, 0x437a, 0xb2, 0x0c, 0x58, 0x04, 0xee, 0x24, 0x94, 0xa6); + +/////////////////////////////////////////////////////////////////////////// +// D3D10CreateDevice +// ------------------ +// +// pAdapter +// If NULL, D3D10CreateDevice will choose the primary adapter and +// create a new instance from a temporarily created IDXGIFactory. +// If non-NULL, D3D10CreateDevice will register the appropriate +// device, if necessary (via IDXGIAdapter::RegisterDrver), before +// creating the device. +// DriverType +// Specifies the driver type to be created: hardware, reference or +// null. +// Software +// HMODULE of a DLL implementing a software rasterizer. Must be NULL for +// non-Software driver types. +// Flags +// Any of those documented for D3D10CreateDevice. +// SDKVersion +// SDK version. Use the D3D10_SDK_VERSION macro. +// ppDevice +// Pointer to returned interface. +// +// Return Values +// Any of those documented for +// CreateDXGIFactory +// IDXGIFactory::EnumAdapters +// IDXGIAdapter::RegisterDriver +// D3D10CreateDevice +// +/////////////////////////////////////////////////////////////////////////// +HRESULT WINAPI D3D10CreateDevice( + IDXGIAdapter *pAdapter, + D3D10_DRIVER_TYPE DriverType, + HMODULE Software, + UINT Flags, + UINT SDKVersion, + ID3D10Device **ppDevice); + +/////////////////////////////////////////////////////////////////////////// +// D3D10CreateDeviceAndSwapChain +// ------------------------------ +// +// ppAdapter +// If NULL, D3D10CreateDevice will choose the primary adapter and +// create a new instance from a temporarily created IDXGIFactory. +// If non-NULL, D3D10CreateDevice will register the appropriate +// device, if necessary (via IDXGIAdapter::RegisterDrver), before +// creating the device. +// DriverType +// Specifies the driver type to be created: hardware, reference or +// null. +// Software +// HMODULE of a DLL implementing a software rasterizer. Must be NULL for +// non-Software driver types. +// Flags +// Any of those documented for D3D10CreateDevice. +// SDKVersion +// SDK version. Use the D3D10_SDK_VERSION macro. +// pSwapChainDesc +// Swap chain description, may be NULL. +// ppSwapChain +// Pointer to returned interface. May be NULL. +// ppDevice +// Pointer to returned interface. +// +// Return Values +// Any of those documented for +// CreateDXGIFactory +// IDXGIFactory::EnumAdapters +// IDXGIAdapter::RegisterDriver +// D3D10CreateDevice +// IDXGIFactory::CreateSwapChain +// +/////////////////////////////////////////////////////////////////////////// +HRESULT WINAPI D3D10CreateDeviceAndSwapChain( + IDXGIAdapter *pAdapter, + D3D10_DRIVER_TYPE DriverType, + HMODULE Software, + UINT Flags, + UINT SDKVersion, + DXGI_SWAP_CHAIN_DESC *pSwapChainDesc, + IDXGISwapChain **ppSwapChain, + ID3D10Device **ppDevice); + + +/////////////////////////////////////////////////////////////////////////// +// D3D10CreateBlob: +// ----------------- +// Creates a Buffer of n Bytes +////////////////////////////////////////////////////////////////////////// + +HRESULT WINAPI D3D10CreateBlob(SIZE_T NumBytes, LPD3D10BLOB *ppBuffer); + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif //__D3D10EFFECT_H__ + + diff --git a/MediaClient/MediaClient/directx/include/d3d10sdklayers.h b/MediaClient/MediaClient/directx/include/d3d10sdklayers.h new file mode 100644 index 0000000..ef432eb --- /dev/null +++ b/MediaClient/MediaClient/directx/include/d3d10sdklayers.h @@ -0,0 +1,1361 @@ + + +/* this ALWAYS GENERATED file contains the definitions for the interfaces */ + + + /* File created by MIDL compiler version 7.00.0555 */ +/* Compiler settings for d3d10sdklayers.idl: + Oicf, W1, Zp8, env=Win64 (32b run), target_arch=AMD64 7.00.0555 + protocol : all , ms_ext, c_ext, robust + error checks: allocation ref bounds_check enum stub_data + VC __declspec() decoration level: + __declspec(uuid()), __declspec(selectany), __declspec(novtable) + DECLSPEC_UUID(), MIDL_INTERFACE() +*/ +/* @@MIDL_FILE_HEADING( ) */ + +#pragma warning( disable: 4049 ) /* more than 64k source lines */ + + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCNDR_H_VERSION__ +#define __REQUIRED_RPCNDR_H_VERSION__ 475 +#endif + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCSAL_H_VERSION__ +#define __REQUIRED_RPCSAL_H_VERSION__ 100 +#endif + +#include "rpc.h" +#include "rpcndr.h" + +#ifndef __RPCNDR_H_VERSION__ +#error this stub requires an updated version of +#endif // __RPCNDR_H_VERSION__ + +#ifndef COM_NO_WINDOWS_H +#include "windows.h" +#include "ole2.h" +#endif /*COM_NO_WINDOWS_H*/ + +#ifndef __d3d10sdklayers_h__ +#define __d3d10sdklayers_h__ + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +/* Forward Declarations */ + +#ifndef __ID3D10Debug_FWD_DEFINED__ +#define __ID3D10Debug_FWD_DEFINED__ +typedef interface ID3D10Debug ID3D10Debug; +#endif /* __ID3D10Debug_FWD_DEFINED__ */ + + +#ifndef __ID3D10SwitchToRef_FWD_DEFINED__ +#define __ID3D10SwitchToRef_FWD_DEFINED__ +typedef interface ID3D10SwitchToRef ID3D10SwitchToRef; +#endif /* __ID3D10SwitchToRef_FWD_DEFINED__ */ + + +#ifndef __ID3D10InfoQueue_FWD_DEFINED__ +#define __ID3D10InfoQueue_FWD_DEFINED__ +typedef interface ID3D10InfoQueue ID3D10InfoQueue; +#endif /* __ID3D10InfoQueue_FWD_DEFINED__ */ + + +/* header files for imported files */ +#include "oaidl.h" +#include "ocidl.h" +#include "dxgi.h" + +#ifdef __cplusplus +extern "C"{ +#endif + + +/* interface __MIDL_itf_d3d10sdklayers_0000_0000 */ +/* [local] */ + +#define D3D10_SDK_LAYERS_VERSION ( 11 ) + +#define D3D10_DEBUG_FEATURE_FLUSH_PER_RENDER_OP ( 0x1 ) + +#define D3D10_DEBUG_FEATURE_FINISH_PER_RENDER_OP ( 0x2 ) + +#define D3D10_DEBUG_FEATURE_PRESENT_PER_RENDER_OP ( 0x4 ) + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d10sdklayers_0000_0000_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d10sdklayers_0000_0000_v0_0_s_ifspec; + +#ifndef __ID3D10Debug_INTERFACE_DEFINED__ +#define __ID3D10Debug_INTERFACE_DEFINED__ + +/* interface ID3D10Debug */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10Debug; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9B7E4E01-342C-4106-A19F-4F2704F689F0") + ID3D10Debug : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SetFeatureMask( + UINT Mask) = 0; + + virtual UINT STDMETHODCALLTYPE GetFeatureMask( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetPresentPerRenderOpDelay( + UINT Milliseconds) = 0; + + virtual UINT STDMETHODCALLTYPE GetPresentPerRenderOpDelay( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetSwapChain( + /* [annotation] */ + __in_opt IDXGISwapChain *pSwapChain) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetSwapChain( + /* [annotation] */ + __out IDXGISwapChain **ppSwapChain) = 0; + + virtual HRESULT STDMETHODCALLTYPE Validate( void) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D10DebugVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10Debug * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10Debug * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10Debug * This); + + HRESULT ( STDMETHODCALLTYPE *SetFeatureMask )( + ID3D10Debug * This, + UINT Mask); + + UINT ( STDMETHODCALLTYPE *GetFeatureMask )( + ID3D10Debug * This); + + HRESULT ( STDMETHODCALLTYPE *SetPresentPerRenderOpDelay )( + ID3D10Debug * This, + UINT Milliseconds); + + UINT ( STDMETHODCALLTYPE *GetPresentPerRenderOpDelay )( + ID3D10Debug * This); + + HRESULT ( STDMETHODCALLTYPE *SetSwapChain )( + ID3D10Debug * This, + /* [annotation] */ + __in_opt IDXGISwapChain *pSwapChain); + + HRESULT ( STDMETHODCALLTYPE *GetSwapChain )( + ID3D10Debug * This, + /* [annotation] */ + __out IDXGISwapChain **ppSwapChain); + + HRESULT ( STDMETHODCALLTYPE *Validate )( + ID3D10Debug * This); + + END_INTERFACE + } ID3D10DebugVtbl; + + interface ID3D10Debug + { + CONST_VTBL struct ID3D10DebugVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10Debug_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10Debug_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10Debug_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10Debug_SetFeatureMask(This,Mask) \ + ( (This)->lpVtbl -> SetFeatureMask(This,Mask) ) + +#define ID3D10Debug_GetFeatureMask(This) \ + ( (This)->lpVtbl -> GetFeatureMask(This) ) + +#define ID3D10Debug_SetPresentPerRenderOpDelay(This,Milliseconds) \ + ( (This)->lpVtbl -> SetPresentPerRenderOpDelay(This,Milliseconds) ) + +#define ID3D10Debug_GetPresentPerRenderOpDelay(This) \ + ( (This)->lpVtbl -> GetPresentPerRenderOpDelay(This) ) + +#define ID3D10Debug_SetSwapChain(This,pSwapChain) \ + ( (This)->lpVtbl -> SetSwapChain(This,pSwapChain) ) + +#define ID3D10Debug_GetSwapChain(This,ppSwapChain) \ + ( (This)->lpVtbl -> GetSwapChain(This,ppSwapChain) ) + +#define ID3D10Debug_Validate(This) \ + ( (This)->lpVtbl -> Validate(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10Debug_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D10SwitchToRef_INTERFACE_DEFINED__ +#define __ID3D10SwitchToRef_INTERFACE_DEFINED__ + +/* interface ID3D10SwitchToRef */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10SwitchToRef; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9B7E4E02-342C-4106-A19F-4F2704F689F0") + ID3D10SwitchToRef : public IUnknown + { + public: + virtual BOOL STDMETHODCALLTYPE SetUseRef( + BOOL UseRef) = 0; + + virtual BOOL STDMETHODCALLTYPE GetUseRef( void) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D10SwitchToRefVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10SwitchToRef * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10SwitchToRef * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10SwitchToRef * This); + + BOOL ( STDMETHODCALLTYPE *SetUseRef )( + ID3D10SwitchToRef * This, + BOOL UseRef); + + BOOL ( STDMETHODCALLTYPE *GetUseRef )( + ID3D10SwitchToRef * This); + + END_INTERFACE + } ID3D10SwitchToRefVtbl; + + interface ID3D10SwitchToRef + { + CONST_VTBL struct ID3D10SwitchToRefVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10SwitchToRef_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10SwitchToRef_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10SwitchToRef_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10SwitchToRef_SetUseRef(This,UseRef) \ + ( (This)->lpVtbl -> SetUseRef(This,UseRef) ) + +#define ID3D10SwitchToRef_GetUseRef(This) \ + ( (This)->lpVtbl -> GetUseRef(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10SwitchToRef_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d10sdklayers_0000_0002 */ +/* [local] */ + +typedef +enum D3D10_MESSAGE_CATEGORY + { D3D10_MESSAGE_CATEGORY_APPLICATION_DEFINED = 0, + D3D10_MESSAGE_CATEGORY_MISCELLANEOUS = ( D3D10_MESSAGE_CATEGORY_APPLICATION_DEFINED + 1 ) , + D3D10_MESSAGE_CATEGORY_INITIALIZATION = ( D3D10_MESSAGE_CATEGORY_MISCELLANEOUS + 1 ) , + D3D10_MESSAGE_CATEGORY_CLEANUP = ( D3D10_MESSAGE_CATEGORY_INITIALIZATION + 1 ) , + D3D10_MESSAGE_CATEGORY_COMPILATION = ( D3D10_MESSAGE_CATEGORY_CLEANUP + 1 ) , + D3D10_MESSAGE_CATEGORY_STATE_CREATION = ( D3D10_MESSAGE_CATEGORY_COMPILATION + 1 ) , + D3D10_MESSAGE_CATEGORY_STATE_SETTING = ( D3D10_MESSAGE_CATEGORY_STATE_CREATION + 1 ) , + D3D10_MESSAGE_CATEGORY_STATE_GETTING = ( D3D10_MESSAGE_CATEGORY_STATE_SETTING + 1 ) , + D3D10_MESSAGE_CATEGORY_RESOURCE_MANIPULATION = ( D3D10_MESSAGE_CATEGORY_STATE_GETTING + 1 ) , + D3D10_MESSAGE_CATEGORY_EXECUTION = ( D3D10_MESSAGE_CATEGORY_RESOURCE_MANIPULATION + 1 ) + } D3D10_MESSAGE_CATEGORY; + +typedef +enum D3D10_MESSAGE_SEVERITY + { D3D10_MESSAGE_SEVERITY_CORRUPTION = 0, + D3D10_MESSAGE_SEVERITY_ERROR = ( D3D10_MESSAGE_SEVERITY_CORRUPTION + 1 ) , + D3D10_MESSAGE_SEVERITY_WARNING = ( D3D10_MESSAGE_SEVERITY_ERROR + 1 ) , + D3D10_MESSAGE_SEVERITY_INFO = ( D3D10_MESSAGE_SEVERITY_WARNING + 1 ) + } D3D10_MESSAGE_SEVERITY; + +typedef +enum D3D10_MESSAGE_ID + { D3D10_MESSAGE_ID_UNKNOWN = 0, + D3D10_MESSAGE_ID_DEVICE_IASETVERTEXBUFFERS_HAZARD = ( D3D10_MESSAGE_ID_UNKNOWN + 1 ) , + D3D10_MESSAGE_ID_DEVICE_IASETINDEXBUFFER_HAZARD = ( D3D10_MESSAGE_ID_DEVICE_IASETVERTEXBUFFERS_HAZARD + 1 ) , + D3D10_MESSAGE_ID_DEVICE_VSSETSHADERRESOURCES_HAZARD = ( D3D10_MESSAGE_ID_DEVICE_IASETINDEXBUFFER_HAZARD + 1 ) , + D3D10_MESSAGE_ID_DEVICE_VSSETCONSTANTBUFFERS_HAZARD = ( D3D10_MESSAGE_ID_DEVICE_VSSETSHADERRESOURCES_HAZARD + 1 ) , + D3D10_MESSAGE_ID_DEVICE_GSSETSHADERRESOURCES_HAZARD = ( D3D10_MESSAGE_ID_DEVICE_VSSETCONSTANTBUFFERS_HAZARD + 1 ) , + D3D10_MESSAGE_ID_DEVICE_GSSETCONSTANTBUFFERS_HAZARD = ( D3D10_MESSAGE_ID_DEVICE_GSSETSHADERRESOURCES_HAZARD + 1 ) , + D3D10_MESSAGE_ID_DEVICE_PSSETSHADERRESOURCES_HAZARD = ( D3D10_MESSAGE_ID_DEVICE_GSSETCONSTANTBUFFERS_HAZARD + 1 ) , + D3D10_MESSAGE_ID_DEVICE_PSSETCONSTANTBUFFERS_HAZARD = ( D3D10_MESSAGE_ID_DEVICE_PSSETSHADERRESOURCES_HAZARD + 1 ) , + D3D10_MESSAGE_ID_DEVICE_OMSETRENDERTARGETS_HAZARD = ( D3D10_MESSAGE_ID_DEVICE_PSSETCONSTANTBUFFERS_HAZARD + 1 ) , + D3D10_MESSAGE_ID_DEVICE_SOSETTARGETS_HAZARD = ( D3D10_MESSAGE_ID_DEVICE_OMSETRENDERTARGETS_HAZARD + 1 ) , + D3D10_MESSAGE_ID_STRING_FROM_APPLICATION = ( D3D10_MESSAGE_ID_DEVICE_SOSETTARGETS_HAZARD + 1 ) , + D3D10_MESSAGE_ID_CORRUPTED_THIS = ( D3D10_MESSAGE_ID_STRING_FROM_APPLICATION + 1 ) , + D3D10_MESSAGE_ID_CORRUPTED_PARAMETER1 = ( D3D10_MESSAGE_ID_CORRUPTED_THIS + 1 ) , + D3D10_MESSAGE_ID_CORRUPTED_PARAMETER2 = ( D3D10_MESSAGE_ID_CORRUPTED_PARAMETER1 + 1 ) , + D3D10_MESSAGE_ID_CORRUPTED_PARAMETER3 = ( D3D10_MESSAGE_ID_CORRUPTED_PARAMETER2 + 1 ) , + D3D10_MESSAGE_ID_CORRUPTED_PARAMETER4 = ( D3D10_MESSAGE_ID_CORRUPTED_PARAMETER3 + 1 ) , + D3D10_MESSAGE_ID_CORRUPTED_PARAMETER5 = ( D3D10_MESSAGE_ID_CORRUPTED_PARAMETER4 + 1 ) , + D3D10_MESSAGE_ID_CORRUPTED_PARAMETER6 = ( D3D10_MESSAGE_ID_CORRUPTED_PARAMETER5 + 1 ) , + D3D10_MESSAGE_ID_CORRUPTED_PARAMETER7 = ( D3D10_MESSAGE_ID_CORRUPTED_PARAMETER6 + 1 ) , + D3D10_MESSAGE_ID_CORRUPTED_PARAMETER8 = ( D3D10_MESSAGE_ID_CORRUPTED_PARAMETER7 + 1 ) , + D3D10_MESSAGE_ID_CORRUPTED_PARAMETER9 = ( D3D10_MESSAGE_ID_CORRUPTED_PARAMETER8 + 1 ) , + D3D10_MESSAGE_ID_CORRUPTED_PARAMETER10 = ( D3D10_MESSAGE_ID_CORRUPTED_PARAMETER9 + 1 ) , + D3D10_MESSAGE_ID_CORRUPTED_PARAMETER11 = ( D3D10_MESSAGE_ID_CORRUPTED_PARAMETER10 + 1 ) , + D3D10_MESSAGE_ID_CORRUPTED_PARAMETER12 = ( D3D10_MESSAGE_ID_CORRUPTED_PARAMETER11 + 1 ) , + D3D10_MESSAGE_ID_CORRUPTED_PARAMETER13 = ( D3D10_MESSAGE_ID_CORRUPTED_PARAMETER12 + 1 ) , + D3D10_MESSAGE_ID_CORRUPTED_PARAMETER14 = ( D3D10_MESSAGE_ID_CORRUPTED_PARAMETER13 + 1 ) , + D3D10_MESSAGE_ID_CORRUPTED_PARAMETER15 = ( D3D10_MESSAGE_ID_CORRUPTED_PARAMETER14 + 1 ) , + D3D10_MESSAGE_ID_CORRUPTED_MULTITHREADING = ( D3D10_MESSAGE_ID_CORRUPTED_PARAMETER15 + 1 ) , + D3D10_MESSAGE_ID_MESSAGE_REPORTING_OUTOFMEMORY = ( D3D10_MESSAGE_ID_CORRUPTED_MULTITHREADING + 1 ) , + D3D10_MESSAGE_ID_IASETINPUTLAYOUT_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_MESSAGE_REPORTING_OUTOFMEMORY + 1 ) , + D3D10_MESSAGE_ID_IASETVERTEXBUFFERS_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_IASETINPUTLAYOUT_UNBINDDELETINGOBJECT + 1 ) , + D3D10_MESSAGE_ID_IASETINDEXBUFFER_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_IASETVERTEXBUFFERS_UNBINDDELETINGOBJECT + 1 ) , + D3D10_MESSAGE_ID_VSSETSHADER_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_IASETINDEXBUFFER_UNBINDDELETINGOBJECT + 1 ) , + D3D10_MESSAGE_ID_VSSETSHADERRESOURCES_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_VSSETSHADER_UNBINDDELETINGOBJECT + 1 ) , + D3D10_MESSAGE_ID_VSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_VSSETSHADERRESOURCES_UNBINDDELETINGOBJECT + 1 ) , + D3D10_MESSAGE_ID_VSSETSAMPLERS_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_VSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT + 1 ) , + D3D10_MESSAGE_ID_GSSETSHADER_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_VSSETSAMPLERS_UNBINDDELETINGOBJECT + 1 ) , + D3D10_MESSAGE_ID_GSSETSHADERRESOURCES_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_GSSETSHADER_UNBINDDELETINGOBJECT + 1 ) , + D3D10_MESSAGE_ID_GSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_GSSETSHADERRESOURCES_UNBINDDELETINGOBJECT + 1 ) , + D3D10_MESSAGE_ID_GSSETSAMPLERS_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_GSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT + 1 ) , + D3D10_MESSAGE_ID_SOSETTARGETS_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_GSSETSAMPLERS_UNBINDDELETINGOBJECT + 1 ) , + D3D10_MESSAGE_ID_PSSETSHADER_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_SOSETTARGETS_UNBINDDELETINGOBJECT + 1 ) , + D3D10_MESSAGE_ID_PSSETSHADERRESOURCES_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_PSSETSHADER_UNBINDDELETINGOBJECT + 1 ) , + D3D10_MESSAGE_ID_PSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_PSSETSHADERRESOURCES_UNBINDDELETINGOBJECT + 1 ) , + D3D10_MESSAGE_ID_PSSETSAMPLERS_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_PSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT + 1 ) , + D3D10_MESSAGE_ID_RSSETSTATE_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_PSSETSAMPLERS_UNBINDDELETINGOBJECT + 1 ) , + D3D10_MESSAGE_ID_OMSETBLENDSTATE_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_RSSETSTATE_UNBINDDELETINGOBJECT + 1 ) , + D3D10_MESSAGE_ID_OMSETDEPTHSTENCILSTATE_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_OMSETBLENDSTATE_UNBINDDELETINGOBJECT + 1 ) , + D3D10_MESSAGE_ID_OMSETRENDERTARGETS_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_OMSETDEPTHSTENCILSTATE_UNBINDDELETINGOBJECT + 1 ) , + D3D10_MESSAGE_ID_SETPREDICATION_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_OMSETRENDERTARGETS_UNBINDDELETINGOBJECT + 1 ) , + D3D10_MESSAGE_ID_GETPRIVATEDATA_MOREDATA = ( D3D10_MESSAGE_ID_SETPREDICATION_UNBINDDELETINGOBJECT + 1 ) , + D3D10_MESSAGE_ID_SETPRIVATEDATA_INVALIDFREEDATA = ( D3D10_MESSAGE_ID_GETPRIVATEDATA_MOREDATA + 1 ) , + D3D10_MESSAGE_ID_SETPRIVATEDATA_INVALIDIUNKNOWN = ( D3D10_MESSAGE_ID_SETPRIVATEDATA_INVALIDFREEDATA + 1 ) , + D3D10_MESSAGE_ID_SETPRIVATEDATA_INVALIDFLAGS = ( D3D10_MESSAGE_ID_SETPRIVATEDATA_INVALIDIUNKNOWN + 1 ) , + D3D10_MESSAGE_ID_SETPRIVATEDATA_CHANGINGPARAMS = ( D3D10_MESSAGE_ID_SETPRIVATEDATA_INVALIDFLAGS + 1 ) , + D3D10_MESSAGE_ID_SETPRIVATEDATA_OUTOFMEMORY = ( D3D10_MESSAGE_ID_SETPRIVATEDATA_CHANGINGPARAMS + 1 ) , + D3D10_MESSAGE_ID_CREATEBUFFER_UNRECOGNIZEDFORMAT = ( D3D10_MESSAGE_ID_SETPRIVATEDATA_OUTOFMEMORY + 1 ) , + D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDSAMPLES = ( D3D10_MESSAGE_ID_CREATEBUFFER_UNRECOGNIZEDFORMAT + 1 ) , + D3D10_MESSAGE_ID_CREATEBUFFER_UNRECOGNIZEDUSAGE = ( D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDSAMPLES + 1 ) , + D3D10_MESSAGE_ID_CREATEBUFFER_UNRECOGNIZEDBINDFLAGS = ( D3D10_MESSAGE_ID_CREATEBUFFER_UNRECOGNIZEDUSAGE + 1 ) , + D3D10_MESSAGE_ID_CREATEBUFFER_UNRECOGNIZEDCPUACCESSFLAGS = ( D3D10_MESSAGE_ID_CREATEBUFFER_UNRECOGNIZEDBINDFLAGS + 1 ) , + D3D10_MESSAGE_ID_CREATEBUFFER_UNRECOGNIZEDMISCFLAGS = ( D3D10_MESSAGE_ID_CREATEBUFFER_UNRECOGNIZEDCPUACCESSFLAGS + 1 ) , + D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDCPUACCESSFLAGS = ( D3D10_MESSAGE_ID_CREATEBUFFER_UNRECOGNIZEDMISCFLAGS + 1 ) , + D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDBINDFLAGS = ( D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDCPUACCESSFLAGS + 1 ) , + D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDINITIALDATA = ( D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDBINDFLAGS + 1 ) , + D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDDIMENSIONS = ( D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDINITIALDATA + 1 ) , + D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDMIPLEVELS = ( D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDDIMENSIONS + 1 ) , + D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDMISCFLAGS = ( D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDMIPLEVELS + 1 ) , + D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDARG_RETURN = ( D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDMISCFLAGS + 1 ) , + D3D10_MESSAGE_ID_CREATEBUFFER_OUTOFMEMORY_RETURN = ( D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDARG_RETURN + 1 ) , + D3D10_MESSAGE_ID_CREATEBUFFER_NULLDESC = ( D3D10_MESSAGE_ID_CREATEBUFFER_OUTOFMEMORY_RETURN + 1 ) , + D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDCONSTANTBUFFERBINDINGS = ( D3D10_MESSAGE_ID_CREATEBUFFER_NULLDESC + 1 ) , + D3D10_MESSAGE_ID_CREATEBUFFER_LARGEALLOCATION = ( D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDCONSTANTBUFFERBINDINGS + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE1D_UNRECOGNIZEDFORMAT = ( D3D10_MESSAGE_ID_CREATEBUFFER_LARGEALLOCATION + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE1D_UNSUPPORTEDFORMAT = ( D3D10_MESSAGE_ID_CREATETEXTURE1D_UNRECOGNIZEDFORMAT + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE1D_INVALIDSAMPLES = ( D3D10_MESSAGE_ID_CREATETEXTURE1D_UNSUPPORTEDFORMAT + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE1D_UNRECOGNIZEDUSAGE = ( D3D10_MESSAGE_ID_CREATETEXTURE1D_INVALIDSAMPLES + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE1D_UNRECOGNIZEDBINDFLAGS = ( D3D10_MESSAGE_ID_CREATETEXTURE1D_UNRECOGNIZEDUSAGE + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE1D_UNRECOGNIZEDCPUACCESSFLAGS = ( D3D10_MESSAGE_ID_CREATETEXTURE1D_UNRECOGNIZEDBINDFLAGS + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE1D_UNRECOGNIZEDMISCFLAGS = ( D3D10_MESSAGE_ID_CREATETEXTURE1D_UNRECOGNIZEDCPUACCESSFLAGS + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE1D_INVALIDCPUACCESSFLAGS = ( D3D10_MESSAGE_ID_CREATETEXTURE1D_UNRECOGNIZEDMISCFLAGS + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE1D_INVALIDBINDFLAGS = ( D3D10_MESSAGE_ID_CREATETEXTURE1D_INVALIDCPUACCESSFLAGS + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE1D_INVALIDINITIALDATA = ( D3D10_MESSAGE_ID_CREATETEXTURE1D_INVALIDBINDFLAGS + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE1D_INVALIDDIMENSIONS = ( D3D10_MESSAGE_ID_CREATETEXTURE1D_INVALIDINITIALDATA + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE1D_INVALIDMIPLEVELS = ( D3D10_MESSAGE_ID_CREATETEXTURE1D_INVALIDDIMENSIONS + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE1D_INVALIDMISCFLAGS = ( D3D10_MESSAGE_ID_CREATETEXTURE1D_INVALIDMIPLEVELS + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE1D_INVALIDARG_RETURN = ( D3D10_MESSAGE_ID_CREATETEXTURE1D_INVALIDMISCFLAGS + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE1D_OUTOFMEMORY_RETURN = ( D3D10_MESSAGE_ID_CREATETEXTURE1D_INVALIDARG_RETURN + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE1D_NULLDESC = ( D3D10_MESSAGE_ID_CREATETEXTURE1D_OUTOFMEMORY_RETURN + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE1D_LARGEALLOCATION = ( D3D10_MESSAGE_ID_CREATETEXTURE1D_NULLDESC + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE2D_UNRECOGNIZEDFORMAT = ( D3D10_MESSAGE_ID_CREATETEXTURE1D_LARGEALLOCATION + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE2D_UNSUPPORTEDFORMAT = ( D3D10_MESSAGE_ID_CREATETEXTURE2D_UNRECOGNIZEDFORMAT + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE2D_INVALIDSAMPLES = ( D3D10_MESSAGE_ID_CREATETEXTURE2D_UNSUPPORTEDFORMAT + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE2D_UNRECOGNIZEDUSAGE = ( D3D10_MESSAGE_ID_CREATETEXTURE2D_INVALIDSAMPLES + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE2D_UNRECOGNIZEDBINDFLAGS = ( D3D10_MESSAGE_ID_CREATETEXTURE2D_UNRECOGNIZEDUSAGE + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE2D_UNRECOGNIZEDCPUACCESSFLAGS = ( D3D10_MESSAGE_ID_CREATETEXTURE2D_UNRECOGNIZEDBINDFLAGS + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE2D_UNRECOGNIZEDMISCFLAGS = ( D3D10_MESSAGE_ID_CREATETEXTURE2D_UNRECOGNIZEDCPUACCESSFLAGS + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE2D_INVALIDCPUACCESSFLAGS = ( D3D10_MESSAGE_ID_CREATETEXTURE2D_UNRECOGNIZEDMISCFLAGS + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE2D_INVALIDBINDFLAGS = ( D3D10_MESSAGE_ID_CREATETEXTURE2D_INVALIDCPUACCESSFLAGS + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE2D_INVALIDINITIALDATA = ( D3D10_MESSAGE_ID_CREATETEXTURE2D_INVALIDBINDFLAGS + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE2D_INVALIDDIMENSIONS = ( D3D10_MESSAGE_ID_CREATETEXTURE2D_INVALIDINITIALDATA + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE2D_INVALIDMIPLEVELS = ( D3D10_MESSAGE_ID_CREATETEXTURE2D_INVALIDDIMENSIONS + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE2D_INVALIDMISCFLAGS = ( D3D10_MESSAGE_ID_CREATETEXTURE2D_INVALIDMIPLEVELS + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE2D_INVALIDARG_RETURN = ( D3D10_MESSAGE_ID_CREATETEXTURE2D_INVALIDMISCFLAGS + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE2D_OUTOFMEMORY_RETURN = ( D3D10_MESSAGE_ID_CREATETEXTURE2D_INVALIDARG_RETURN + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE2D_NULLDESC = ( D3D10_MESSAGE_ID_CREATETEXTURE2D_OUTOFMEMORY_RETURN + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE2D_LARGEALLOCATION = ( D3D10_MESSAGE_ID_CREATETEXTURE2D_NULLDESC + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE3D_UNRECOGNIZEDFORMAT = ( D3D10_MESSAGE_ID_CREATETEXTURE2D_LARGEALLOCATION + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE3D_UNSUPPORTEDFORMAT = ( D3D10_MESSAGE_ID_CREATETEXTURE3D_UNRECOGNIZEDFORMAT + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE3D_INVALIDSAMPLES = ( D3D10_MESSAGE_ID_CREATETEXTURE3D_UNSUPPORTEDFORMAT + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE3D_UNRECOGNIZEDUSAGE = ( D3D10_MESSAGE_ID_CREATETEXTURE3D_INVALIDSAMPLES + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE3D_UNRECOGNIZEDBINDFLAGS = ( D3D10_MESSAGE_ID_CREATETEXTURE3D_UNRECOGNIZEDUSAGE + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE3D_UNRECOGNIZEDCPUACCESSFLAGS = ( D3D10_MESSAGE_ID_CREATETEXTURE3D_UNRECOGNIZEDBINDFLAGS + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE3D_UNRECOGNIZEDMISCFLAGS = ( D3D10_MESSAGE_ID_CREATETEXTURE3D_UNRECOGNIZEDCPUACCESSFLAGS + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE3D_INVALIDCPUACCESSFLAGS = ( D3D10_MESSAGE_ID_CREATETEXTURE3D_UNRECOGNIZEDMISCFLAGS + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE3D_INVALIDBINDFLAGS = ( D3D10_MESSAGE_ID_CREATETEXTURE3D_INVALIDCPUACCESSFLAGS + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE3D_INVALIDINITIALDATA = ( D3D10_MESSAGE_ID_CREATETEXTURE3D_INVALIDBINDFLAGS + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE3D_INVALIDDIMENSIONS = ( D3D10_MESSAGE_ID_CREATETEXTURE3D_INVALIDINITIALDATA + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE3D_INVALIDMIPLEVELS = ( D3D10_MESSAGE_ID_CREATETEXTURE3D_INVALIDDIMENSIONS + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE3D_INVALIDMISCFLAGS = ( D3D10_MESSAGE_ID_CREATETEXTURE3D_INVALIDMIPLEVELS + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE3D_INVALIDARG_RETURN = ( D3D10_MESSAGE_ID_CREATETEXTURE3D_INVALIDMISCFLAGS + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE3D_OUTOFMEMORY_RETURN = ( D3D10_MESSAGE_ID_CREATETEXTURE3D_INVALIDARG_RETURN + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE3D_NULLDESC = ( D3D10_MESSAGE_ID_CREATETEXTURE3D_OUTOFMEMORY_RETURN + 1 ) , + D3D10_MESSAGE_ID_CREATETEXTURE3D_LARGEALLOCATION = ( D3D10_MESSAGE_ID_CREATETEXTURE3D_NULLDESC + 1 ) , + D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_UNRECOGNIZEDFORMAT = ( D3D10_MESSAGE_ID_CREATETEXTURE3D_LARGEALLOCATION + 1 ) , + D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDDESC = ( D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_UNRECOGNIZEDFORMAT + 1 ) , + D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDFORMAT = ( D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDDESC + 1 ) , + D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDDIMENSIONS = ( D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDFORMAT + 1 ) , + D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDRESOURCE = ( D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDDIMENSIONS + 1 ) , + D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_TOOMANYOBJECTS = ( D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDRESOURCE + 1 ) , + D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDARG_RETURN = ( D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_TOOMANYOBJECTS + 1 ) , + D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_OUTOFMEMORY_RETURN = ( D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDARG_RETURN + 1 ) , + D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_UNRECOGNIZEDFORMAT = ( D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_OUTOFMEMORY_RETURN + 1 ) , + D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_UNSUPPORTEDFORMAT = ( D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_UNRECOGNIZEDFORMAT + 1 ) , + D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDDESC = ( D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_UNSUPPORTEDFORMAT + 1 ) , + D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDFORMAT = ( D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDDESC + 1 ) , + D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDDIMENSIONS = ( D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDFORMAT + 1 ) , + D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDRESOURCE = ( D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDDIMENSIONS + 1 ) , + D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_TOOMANYOBJECTS = ( D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDRESOURCE + 1 ) , + D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDARG_RETURN = ( D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_TOOMANYOBJECTS + 1 ) , + D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_OUTOFMEMORY_RETURN = ( D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDARG_RETURN + 1 ) , + D3D10_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_UNRECOGNIZEDFORMAT = ( D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_OUTOFMEMORY_RETURN + 1 ) , + D3D10_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDDESC = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_UNRECOGNIZEDFORMAT + 1 ) , + D3D10_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDFORMAT = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDDESC + 1 ) , + D3D10_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDDIMENSIONS = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDFORMAT + 1 ) , + D3D10_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDRESOURCE = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDDIMENSIONS + 1 ) , + D3D10_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_TOOMANYOBJECTS = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDRESOURCE + 1 ) , + D3D10_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDARG_RETURN = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_TOOMANYOBJECTS + 1 ) , + D3D10_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_OUTOFMEMORY_RETURN = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDARG_RETURN + 1 ) , + D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_OUTOFMEMORY = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_OUTOFMEMORY_RETURN + 1 ) , + D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_TOOMANYELEMENTS = ( D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_OUTOFMEMORY + 1 ) , + D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDFORMAT = ( D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_TOOMANYELEMENTS + 1 ) , + D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_INCOMPATIBLEFORMAT = ( D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDFORMAT + 1 ) , + D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDSLOT = ( D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_INCOMPATIBLEFORMAT + 1 ) , + D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDINPUTSLOTCLASS = ( D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDSLOT + 1 ) , + D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_STEPRATESLOTCLASSMISMATCH = ( D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDINPUTSLOTCLASS + 1 ) , + D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDSLOTCLASSCHANGE = ( D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_STEPRATESLOTCLASSMISMATCH + 1 ) , + D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDSTEPRATECHANGE = ( D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDSLOTCLASSCHANGE + 1 ) , + D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDALIGNMENT = ( D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDSTEPRATECHANGE + 1 ) , + D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_DUPLICATESEMANTIC = ( D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDALIGNMENT + 1 ) , + D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_UNPARSEABLEINPUTSIGNATURE = ( D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_DUPLICATESEMANTIC + 1 ) , + D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_NULLSEMANTIC = ( D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_UNPARSEABLEINPUTSIGNATURE + 1 ) , + D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_MISSINGELEMENT = ( D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_NULLSEMANTIC + 1 ) , + D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_NULLDESC = ( D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_MISSINGELEMENT + 1 ) , + D3D10_MESSAGE_ID_CREATEVERTEXSHADER_OUTOFMEMORY = ( D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_NULLDESC + 1 ) , + D3D10_MESSAGE_ID_CREATEVERTEXSHADER_INVALIDSHADERBYTECODE = ( D3D10_MESSAGE_ID_CREATEVERTEXSHADER_OUTOFMEMORY + 1 ) , + D3D10_MESSAGE_ID_CREATEVERTEXSHADER_INVALIDSHADERTYPE = ( D3D10_MESSAGE_ID_CREATEVERTEXSHADER_INVALIDSHADERBYTECODE + 1 ) , + D3D10_MESSAGE_ID_CREATEGEOMETRYSHADER_OUTOFMEMORY = ( D3D10_MESSAGE_ID_CREATEVERTEXSHADER_INVALIDSHADERTYPE + 1 ) , + D3D10_MESSAGE_ID_CREATEGEOMETRYSHADER_INVALIDSHADERBYTECODE = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADER_OUTOFMEMORY + 1 ) , + D3D10_MESSAGE_ID_CREATEGEOMETRYSHADER_INVALIDSHADERTYPE = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADER_INVALIDSHADERBYTECODE + 1 ) , + D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_OUTOFMEMORY = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADER_INVALIDSHADERTYPE + 1 ) , + D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSHADERBYTECODE = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_OUTOFMEMORY + 1 ) , + D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSHADERTYPE = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSHADERBYTECODE + 1 ) , + D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDNUMENTRIES = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSHADERTYPE + 1 ) , + D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_OUTPUTSTREAMSTRIDEUNUSED = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDNUMENTRIES + 1 ) , + D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_UNEXPECTEDDECL = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_OUTPUTSTREAMSTRIDEUNUSED + 1 ) , + D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_EXPECTEDDECL = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_UNEXPECTEDDECL + 1 ) , + D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_OUTPUTSLOT0EXPECTED = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_EXPECTEDDECL + 1 ) , + D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDOUTPUTSLOT = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_OUTPUTSLOT0EXPECTED + 1 ) , + D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_ONLYONEELEMENTPERSLOT = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDOUTPUTSLOT + 1 ) , + D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDCOMPONENTCOUNT = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_ONLYONEELEMENTPERSLOT + 1 ) , + D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSTARTCOMPONENTANDCOMPONENTCOUNT = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDCOMPONENTCOUNT + 1 ) , + D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDGAPDEFINITION = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSTARTCOMPONENTANDCOMPONENTCOUNT + 1 ) , + D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_REPEATEDOUTPUT = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDGAPDEFINITION + 1 ) , + D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDOUTPUTSTREAMSTRIDE = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_REPEATEDOUTPUT + 1 ) , + D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_MISSINGSEMANTIC = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDOUTPUTSTREAMSTRIDE + 1 ) , + D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_MASKMISMATCH = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_MISSINGSEMANTIC + 1 ) , + D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_CANTHAVEONLYGAPS = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_MASKMISMATCH + 1 ) , + D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_DECLTOOCOMPLEX = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_CANTHAVEONLYGAPS + 1 ) , + D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_MISSINGOUTPUTSIGNATURE = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_DECLTOOCOMPLEX + 1 ) , + D3D10_MESSAGE_ID_CREATEPIXELSHADER_OUTOFMEMORY = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_MISSINGOUTPUTSIGNATURE + 1 ) , + D3D10_MESSAGE_ID_CREATEPIXELSHADER_INVALIDSHADERBYTECODE = ( D3D10_MESSAGE_ID_CREATEPIXELSHADER_OUTOFMEMORY + 1 ) , + D3D10_MESSAGE_ID_CREATEPIXELSHADER_INVALIDSHADERTYPE = ( D3D10_MESSAGE_ID_CREATEPIXELSHADER_INVALIDSHADERBYTECODE + 1 ) , + D3D10_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDFILLMODE = ( D3D10_MESSAGE_ID_CREATEPIXELSHADER_INVALIDSHADERTYPE + 1 ) , + D3D10_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDCULLMODE = ( D3D10_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDFILLMODE + 1 ) , + D3D10_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDDEPTHBIASCLAMP = ( D3D10_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDCULLMODE + 1 ) , + D3D10_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDSLOPESCALEDDEPTHBIAS = ( D3D10_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDDEPTHBIASCLAMP + 1 ) , + D3D10_MESSAGE_ID_CREATERASTERIZERSTATE_TOOMANYOBJECTS = ( D3D10_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDSLOPESCALEDDEPTHBIAS + 1 ) , + D3D10_MESSAGE_ID_CREATERASTERIZERSTATE_NULLDESC = ( D3D10_MESSAGE_ID_CREATERASTERIZERSTATE_TOOMANYOBJECTS + 1 ) , + D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDDEPTHWRITEMASK = ( D3D10_MESSAGE_ID_CREATERASTERIZERSTATE_NULLDESC + 1 ) , + D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDDEPTHFUNC = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDDEPTHWRITEMASK + 1 ) , + D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILFAILOP = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDDEPTHFUNC + 1 ) , + D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILZFAILOP = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILFAILOP + 1 ) , + D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILPASSOP = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILZFAILOP + 1 ) , + D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILFUNC = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILPASSOP + 1 ) , + D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILFAILOP = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILFUNC + 1 ) , + D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILZFAILOP = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILFAILOP + 1 ) , + D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILPASSOP = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILZFAILOP + 1 ) , + D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILFUNC = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILPASSOP + 1 ) , + D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_TOOMANYOBJECTS = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILFUNC + 1 ) , + D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_NULLDESC = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_TOOMANYOBJECTS + 1 ) , + D3D10_MESSAGE_ID_CREATEBLENDSTATE_INVALIDSRCBLEND = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_NULLDESC + 1 ) , + D3D10_MESSAGE_ID_CREATEBLENDSTATE_INVALIDDESTBLEND = ( D3D10_MESSAGE_ID_CREATEBLENDSTATE_INVALIDSRCBLEND + 1 ) , + D3D10_MESSAGE_ID_CREATEBLENDSTATE_INVALIDBLENDOP = ( D3D10_MESSAGE_ID_CREATEBLENDSTATE_INVALIDDESTBLEND + 1 ) , + D3D10_MESSAGE_ID_CREATEBLENDSTATE_INVALIDSRCBLENDALPHA = ( D3D10_MESSAGE_ID_CREATEBLENDSTATE_INVALIDBLENDOP + 1 ) , + D3D10_MESSAGE_ID_CREATEBLENDSTATE_INVALIDDESTBLENDALPHA = ( D3D10_MESSAGE_ID_CREATEBLENDSTATE_INVALIDSRCBLENDALPHA + 1 ) , + D3D10_MESSAGE_ID_CREATEBLENDSTATE_INVALIDBLENDOPALPHA = ( D3D10_MESSAGE_ID_CREATEBLENDSTATE_INVALIDDESTBLENDALPHA + 1 ) , + D3D10_MESSAGE_ID_CREATEBLENDSTATE_INVALIDRENDERTARGETWRITEMASK = ( D3D10_MESSAGE_ID_CREATEBLENDSTATE_INVALIDBLENDOPALPHA + 1 ) , + D3D10_MESSAGE_ID_CREATEBLENDSTATE_TOOMANYOBJECTS = ( D3D10_MESSAGE_ID_CREATEBLENDSTATE_INVALIDRENDERTARGETWRITEMASK + 1 ) , + D3D10_MESSAGE_ID_CREATEBLENDSTATE_NULLDESC = ( D3D10_MESSAGE_ID_CREATEBLENDSTATE_TOOMANYOBJECTS + 1 ) , + D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDFILTER = ( D3D10_MESSAGE_ID_CREATEBLENDSTATE_NULLDESC + 1 ) , + D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDADDRESSU = ( D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDFILTER + 1 ) , + D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDADDRESSV = ( D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDADDRESSU + 1 ) , + D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDADDRESSW = ( D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDADDRESSV + 1 ) , + D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDMIPLODBIAS = ( D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDADDRESSW + 1 ) , + D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDMAXANISOTROPY = ( D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDMIPLODBIAS + 1 ) , + D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDCOMPARISONFUNC = ( D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDMAXANISOTROPY + 1 ) , + D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDMINLOD = ( D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDCOMPARISONFUNC + 1 ) , + D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDMAXLOD = ( D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDMINLOD + 1 ) , + D3D10_MESSAGE_ID_CREATESAMPLERSTATE_TOOMANYOBJECTS = ( D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDMAXLOD + 1 ) , + D3D10_MESSAGE_ID_CREATESAMPLERSTATE_NULLDESC = ( D3D10_MESSAGE_ID_CREATESAMPLERSTATE_TOOMANYOBJECTS + 1 ) , + D3D10_MESSAGE_ID_CREATEQUERYORPREDICATE_INVALIDQUERY = ( D3D10_MESSAGE_ID_CREATESAMPLERSTATE_NULLDESC + 1 ) , + D3D10_MESSAGE_ID_CREATEQUERYORPREDICATE_INVALIDMISCFLAGS = ( D3D10_MESSAGE_ID_CREATEQUERYORPREDICATE_INVALIDQUERY + 1 ) , + D3D10_MESSAGE_ID_CREATEQUERYORPREDICATE_UNEXPECTEDMISCFLAG = ( D3D10_MESSAGE_ID_CREATEQUERYORPREDICATE_INVALIDMISCFLAGS + 1 ) , + D3D10_MESSAGE_ID_CREATEQUERYORPREDICATE_NULLDESC = ( D3D10_MESSAGE_ID_CREATEQUERYORPREDICATE_UNEXPECTEDMISCFLAG + 1 ) , + D3D10_MESSAGE_ID_DEVICE_IASETPRIMITIVETOPOLOGY_TOPOLOGY_UNRECOGNIZED = ( D3D10_MESSAGE_ID_CREATEQUERYORPREDICATE_NULLDESC + 1 ) , + D3D10_MESSAGE_ID_DEVICE_IASETPRIMITIVETOPOLOGY_TOPOLOGY_UNDEFINED = ( D3D10_MESSAGE_ID_DEVICE_IASETPRIMITIVETOPOLOGY_TOPOLOGY_UNRECOGNIZED + 1 ) , + D3D10_MESSAGE_ID_IASETVERTEXBUFFERS_INVALIDBUFFER = ( D3D10_MESSAGE_ID_DEVICE_IASETPRIMITIVETOPOLOGY_TOPOLOGY_UNDEFINED + 1 ) , + D3D10_MESSAGE_ID_DEVICE_IASETVERTEXBUFFERS_OFFSET_TOO_LARGE = ( D3D10_MESSAGE_ID_IASETVERTEXBUFFERS_INVALIDBUFFER + 1 ) , + D3D10_MESSAGE_ID_DEVICE_IASETVERTEXBUFFERS_BUFFERS_EMPTY = ( D3D10_MESSAGE_ID_DEVICE_IASETVERTEXBUFFERS_OFFSET_TOO_LARGE + 1 ) , + D3D10_MESSAGE_ID_IASETINDEXBUFFER_INVALIDBUFFER = ( D3D10_MESSAGE_ID_DEVICE_IASETVERTEXBUFFERS_BUFFERS_EMPTY + 1 ) , + D3D10_MESSAGE_ID_DEVICE_IASETINDEXBUFFER_FORMAT_INVALID = ( D3D10_MESSAGE_ID_IASETINDEXBUFFER_INVALIDBUFFER + 1 ) , + D3D10_MESSAGE_ID_DEVICE_IASETINDEXBUFFER_OFFSET_TOO_LARGE = ( D3D10_MESSAGE_ID_DEVICE_IASETINDEXBUFFER_FORMAT_INVALID + 1 ) , + D3D10_MESSAGE_ID_DEVICE_IASETINDEXBUFFER_OFFSET_UNALIGNED = ( D3D10_MESSAGE_ID_DEVICE_IASETINDEXBUFFER_OFFSET_TOO_LARGE + 1 ) , + D3D10_MESSAGE_ID_DEVICE_VSSETSHADERRESOURCES_VIEWS_EMPTY = ( D3D10_MESSAGE_ID_DEVICE_IASETINDEXBUFFER_OFFSET_UNALIGNED + 1 ) , + D3D10_MESSAGE_ID_VSSETCONSTANTBUFFERS_INVALIDBUFFER = ( D3D10_MESSAGE_ID_DEVICE_VSSETSHADERRESOURCES_VIEWS_EMPTY + 1 ) , + D3D10_MESSAGE_ID_DEVICE_VSSETCONSTANTBUFFERS_BUFFERS_EMPTY = ( D3D10_MESSAGE_ID_VSSETCONSTANTBUFFERS_INVALIDBUFFER + 1 ) , + D3D10_MESSAGE_ID_DEVICE_VSSETSAMPLERS_SAMPLERS_EMPTY = ( D3D10_MESSAGE_ID_DEVICE_VSSETCONSTANTBUFFERS_BUFFERS_EMPTY + 1 ) , + D3D10_MESSAGE_ID_DEVICE_GSSETSHADERRESOURCES_VIEWS_EMPTY = ( D3D10_MESSAGE_ID_DEVICE_VSSETSAMPLERS_SAMPLERS_EMPTY + 1 ) , + D3D10_MESSAGE_ID_GSSETCONSTANTBUFFERS_INVALIDBUFFER = ( D3D10_MESSAGE_ID_DEVICE_GSSETSHADERRESOURCES_VIEWS_EMPTY + 1 ) , + D3D10_MESSAGE_ID_DEVICE_GSSETCONSTANTBUFFERS_BUFFERS_EMPTY = ( D3D10_MESSAGE_ID_GSSETCONSTANTBUFFERS_INVALIDBUFFER + 1 ) , + D3D10_MESSAGE_ID_DEVICE_GSSETSAMPLERS_SAMPLERS_EMPTY = ( D3D10_MESSAGE_ID_DEVICE_GSSETCONSTANTBUFFERS_BUFFERS_EMPTY + 1 ) , + D3D10_MESSAGE_ID_SOSETTARGETS_INVALIDBUFFER = ( D3D10_MESSAGE_ID_DEVICE_GSSETSAMPLERS_SAMPLERS_EMPTY + 1 ) , + D3D10_MESSAGE_ID_DEVICE_SOSETTARGETS_OFFSET_UNALIGNED = ( D3D10_MESSAGE_ID_SOSETTARGETS_INVALIDBUFFER + 1 ) , + D3D10_MESSAGE_ID_DEVICE_PSSETSHADERRESOURCES_VIEWS_EMPTY = ( D3D10_MESSAGE_ID_DEVICE_SOSETTARGETS_OFFSET_UNALIGNED + 1 ) , + D3D10_MESSAGE_ID_PSSETCONSTANTBUFFERS_INVALIDBUFFER = ( D3D10_MESSAGE_ID_DEVICE_PSSETSHADERRESOURCES_VIEWS_EMPTY + 1 ) , + D3D10_MESSAGE_ID_DEVICE_PSSETCONSTANTBUFFERS_BUFFERS_EMPTY = ( D3D10_MESSAGE_ID_PSSETCONSTANTBUFFERS_INVALIDBUFFER + 1 ) , + D3D10_MESSAGE_ID_DEVICE_PSSETSAMPLERS_SAMPLERS_EMPTY = ( D3D10_MESSAGE_ID_DEVICE_PSSETCONSTANTBUFFERS_BUFFERS_EMPTY + 1 ) , + D3D10_MESSAGE_ID_DEVICE_RSSETVIEWPORTS_INVALIDVIEWPORT = ( D3D10_MESSAGE_ID_DEVICE_PSSETSAMPLERS_SAMPLERS_EMPTY + 1 ) , + D3D10_MESSAGE_ID_DEVICE_RSSETSCISSORRECTS_INVALIDSCISSOR = ( D3D10_MESSAGE_ID_DEVICE_RSSETVIEWPORTS_INVALIDVIEWPORT + 1 ) , + D3D10_MESSAGE_ID_CLEARRENDERTARGETVIEW_DENORMFLUSH = ( D3D10_MESSAGE_ID_DEVICE_RSSETSCISSORRECTS_INVALIDSCISSOR + 1 ) , + D3D10_MESSAGE_ID_CLEARDEPTHSTENCILVIEW_DENORMFLUSH = ( D3D10_MESSAGE_ID_CLEARRENDERTARGETVIEW_DENORMFLUSH + 1 ) , + D3D10_MESSAGE_ID_CLEARDEPTHSTENCILVIEW_INVALID = ( D3D10_MESSAGE_ID_CLEARDEPTHSTENCILVIEW_DENORMFLUSH + 1 ) , + D3D10_MESSAGE_ID_DEVICE_IAGETVERTEXBUFFERS_BUFFERS_EMPTY = ( D3D10_MESSAGE_ID_CLEARDEPTHSTENCILVIEW_INVALID + 1 ) , + D3D10_MESSAGE_ID_DEVICE_VSGETSHADERRESOURCES_VIEWS_EMPTY = ( D3D10_MESSAGE_ID_DEVICE_IAGETVERTEXBUFFERS_BUFFERS_EMPTY + 1 ) , + D3D10_MESSAGE_ID_DEVICE_VSGETCONSTANTBUFFERS_BUFFERS_EMPTY = ( D3D10_MESSAGE_ID_DEVICE_VSGETSHADERRESOURCES_VIEWS_EMPTY + 1 ) , + D3D10_MESSAGE_ID_DEVICE_VSGETSAMPLERS_SAMPLERS_EMPTY = ( D3D10_MESSAGE_ID_DEVICE_VSGETCONSTANTBUFFERS_BUFFERS_EMPTY + 1 ) , + D3D10_MESSAGE_ID_DEVICE_GSGETSHADERRESOURCES_VIEWS_EMPTY = ( D3D10_MESSAGE_ID_DEVICE_VSGETSAMPLERS_SAMPLERS_EMPTY + 1 ) , + D3D10_MESSAGE_ID_DEVICE_GSGETCONSTANTBUFFERS_BUFFERS_EMPTY = ( D3D10_MESSAGE_ID_DEVICE_GSGETSHADERRESOURCES_VIEWS_EMPTY + 1 ) , + D3D10_MESSAGE_ID_DEVICE_GSGETSAMPLERS_SAMPLERS_EMPTY = ( D3D10_MESSAGE_ID_DEVICE_GSGETCONSTANTBUFFERS_BUFFERS_EMPTY + 1 ) , + D3D10_MESSAGE_ID_DEVICE_SOGETTARGETS_BUFFERS_EMPTY = ( D3D10_MESSAGE_ID_DEVICE_GSGETSAMPLERS_SAMPLERS_EMPTY + 1 ) , + D3D10_MESSAGE_ID_DEVICE_PSGETSHADERRESOURCES_VIEWS_EMPTY = ( D3D10_MESSAGE_ID_DEVICE_SOGETTARGETS_BUFFERS_EMPTY + 1 ) , + D3D10_MESSAGE_ID_DEVICE_PSGETCONSTANTBUFFERS_BUFFERS_EMPTY = ( D3D10_MESSAGE_ID_DEVICE_PSGETSHADERRESOURCES_VIEWS_EMPTY + 1 ) , + D3D10_MESSAGE_ID_DEVICE_PSGETSAMPLERS_SAMPLERS_EMPTY = ( D3D10_MESSAGE_ID_DEVICE_PSGETCONSTANTBUFFERS_BUFFERS_EMPTY + 1 ) , + D3D10_MESSAGE_ID_DEVICE_RSGETVIEWPORTS_VIEWPORTS_EMPTY = ( D3D10_MESSAGE_ID_DEVICE_PSGETSAMPLERS_SAMPLERS_EMPTY + 1 ) , + D3D10_MESSAGE_ID_DEVICE_RSGETSCISSORRECTS_RECTS_EMPTY = ( D3D10_MESSAGE_ID_DEVICE_RSGETVIEWPORTS_VIEWPORTS_EMPTY + 1 ) , + D3D10_MESSAGE_ID_DEVICE_GENERATEMIPS_RESOURCE_INVALID = ( D3D10_MESSAGE_ID_DEVICE_RSGETSCISSORRECTS_RECTS_EMPTY + 1 ) , + D3D10_MESSAGE_ID_COPYSUBRESOURCEREGION_INVALIDDESTINATIONSUBRESOURCE = ( D3D10_MESSAGE_ID_DEVICE_GENERATEMIPS_RESOURCE_INVALID + 1 ) , + D3D10_MESSAGE_ID_COPYSUBRESOURCEREGION_INVALIDSOURCESUBRESOURCE = ( D3D10_MESSAGE_ID_COPYSUBRESOURCEREGION_INVALIDDESTINATIONSUBRESOURCE + 1 ) , + D3D10_MESSAGE_ID_COPYSUBRESOURCEREGION_INVALIDSOURCEBOX = ( D3D10_MESSAGE_ID_COPYSUBRESOURCEREGION_INVALIDSOURCESUBRESOURCE + 1 ) , + D3D10_MESSAGE_ID_COPYSUBRESOURCEREGION_INVALIDSOURCE = ( D3D10_MESSAGE_ID_COPYSUBRESOURCEREGION_INVALIDSOURCEBOX + 1 ) , + D3D10_MESSAGE_ID_COPYSUBRESOURCEREGION_INVALIDDESTINATIONSTATE = ( D3D10_MESSAGE_ID_COPYSUBRESOURCEREGION_INVALIDSOURCE + 1 ) , + D3D10_MESSAGE_ID_COPYSUBRESOURCEREGION_INVALIDSOURCESTATE = ( D3D10_MESSAGE_ID_COPYSUBRESOURCEREGION_INVALIDDESTINATIONSTATE + 1 ) , + D3D10_MESSAGE_ID_COPYRESOURCE_INVALIDSOURCE = ( D3D10_MESSAGE_ID_COPYSUBRESOURCEREGION_INVALIDSOURCESTATE + 1 ) , + D3D10_MESSAGE_ID_COPYRESOURCE_INVALIDDESTINATIONSTATE = ( D3D10_MESSAGE_ID_COPYRESOURCE_INVALIDSOURCE + 1 ) , + D3D10_MESSAGE_ID_COPYRESOURCE_INVALIDSOURCESTATE = ( D3D10_MESSAGE_ID_COPYRESOURCE_INVALIDDESTINATIONSTATE + 1 ) , + D3D10_MESSAGE_ID_UPDATESUBRESOURCE_INVALIDDESTINATIONSUBRESOURCE = ( D3D10_MESSAGE_ID_COPYRESOURCE_INVALIDSOURCESTATE + 1 ) , + D3D10_MESSAGE_ID_UPDATESUBRESOURCE_INVALIDDESTINATIONBOX = ( D3D10_MESSAGE_ID_UPDATESUBRESOURCE_INVALIDDESTINATIONSUBRESOURCE + 1 ) , + D3D10_MESSAGE_ID_UPDATESUBRESOURCE_INVALIDDESTINATIONSTATE = ( D3D10_MESSAGE_ID_UPDATESUBRESOURCE_INVALIDDESTINATIONBOX + 1 ) , + D3D10_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_DESTINATION_INVALID = ( D3D10_MESSAGE_ID_UPDATESUBRESOURCE_INVALIDDESTINATIONSTATE + 1 ) , + D3D10_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_DESTINATION_SUBRESOURCE_INVALID = ( D3D10_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_DESTINATION_INVALID + 1 ) , + D3D10_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_SOURCE_INVALID = ( D3D10_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_DESTINATION_SUBRESOURCE_INVALID + 1 ) , + D3D10_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_SOURCE_SUBRESOURCE_INVALID = ( D3D10_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_SOURCE_INVALID + 1 ) , + D3D10_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_FORMAT_INVALID = ( D3D10_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_SOURCE_SUBRESOURCE_INVALID + 1 ) , + D3D10_MESSAGE_ID_BUFFER_MAP_INVALIDMAPTYPE = ( D3D10_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_FORMAT_INVALID + 1 ) , + D3D10_MESSAGE_ID_BUFFER_MAP_INVALIDFLAGS = ( D3D10_MESSAGE_ID_BUFFER_MAP_INVALIDMAPTYPE + 1 ) , + D3D10_MESSAGE_ID_BUFFER_MAP_ALREADYMAPPED = ( D3D10_MESSAGE_ID_BUFFER_MAP_INVALIDFLAGS + 1 ) , + D3D10_MESSAGE_ID_BUFFER_MAP_DEVICEREMOVED_RETURN = ( D3D10_MESSAGE_ID_BUFFER_MAP_ALREADYMAPPED + 1 ) , + D3D10_MESSAGE_ID_BUFFER_UNMAP_NOTMAPPED = ( D3D10_MESSAGE_ID_BUFFER_MAP_DEVICEREMOVED_RETURN + 1 ) , + D3D10_MESSAGE_ID_TEXTURE1D_MAP_INVALIDMAPTYPE = ( D3D10_MESSAGE_ID_BUFFER_UNMAP_NOTMAPPED + 1 ) , + D3D10_MESSAGE_ID_TEXTURE1D_MAP_INVALIDSUBRESOURCE = ( D3D10_MESSAGE_ID_TEXTURE1D_MAP_INVALIDMAPTYPE + 1 ) , + D3D10_MESSAGE_ID_TEXTURE1D_MAP_INVALIDFLAGS = ( D3D10_MESSAGE_ID_TEXTURE1D_MAP_INVALIDSUBRESOURCE + 1 ) , + D3D10_MESSAGE_ID_TEXTURE1D_MAP_ALREADYMAPPED = ( D3D10_MESSAGE_ID_TEXTURE1D_MAP_INVALIDFLAGS + 1 ) , + D3D10_MESSAGE_ID_TEXTURE1D_MAP_DEVICEREMOVED_RETURN = ( D3D10_MESSAGE_ID_TEXTURE1D_MAP_ALREADYMAPPED + 1 ) , + D3D10_MESSAGE_ID_TEXTURE1D_UNMAP_INVALIDSUBRESOURCE = ( D3D10_MESSAGE_ID_TEXTURE1D_MAP_DEVICEREMOVED_RETURN + 1 ) , + D3D10_MESSAGE_ID_TEXTURE1D_UNMAP_NOTMAPPED = ( D3D10_MESSAGE_ID_TEXTURE1D_UNMAP_INVALIDSUBRESOURCE + 1 ) , + D3D10_MESSAGE_ID_TEXTURE2D_MAP_INVALIDMAPTYPE = ( D3D10_MESSAGE_ID_TEXTURE1D_UNMAP_NOTMAPPED + 1 ) , + D3D10_MESSAGE_ID_TEXTURE2D_MAP_INVALIDSUBRESOURCE = ( D3D10_MESSAGE_ID_TEXTURE2D_MAP_INVALIDMAPTYPE + 1 ) , + D3D10_MESSAGE_ID_TEXTURE2D_MAP_INVALIDFLAGS = ( D3D10_MESSAGE_ID_TEXTURE2D_MAP_INVALIDSUBRESOURCE + 1 ) , + D3D10_MESSAGE_ID_TEXTURE2D_MAP_ALREADYMAPPED = ( D3D10_MESSAGE_ID_TEXTURE2D_MAP_INVALIDFLAGS + 1 ) , + D3D10_MESSAGE_ID_TEXTURE2D_MAP_DEVICEREMOVED_RETURN = ( D3D10_MESSAGE_ID_TEXTURE2D_MAP_ALREADYMAPPED + 1 ) , + D3D10_MESSAGE_ID_TEXTURE2D_UNMAP_INVALIDSUBRESOURCE = ( D3D10_MESSAGE_ID_TEXTURE2D_MAP_DEVICEREMOVED_RETURN + 1 ) , + D3D10_MESSAGE_ID_TEXTURE2D_UNMAP_NOTMAPPED = ( D3D10_MESSAGE_ID_TEXTURE2D_UNMAP_INVALIDSUBRESOURCE + 1 ) , + D3D10_MESSAGE_ID_TEXTURE3D_MAP_INVALIDMAPTYPE = ( D3D10_MESSAGE_ID_TEXTURE2D_UNMAP_NOTMAPPED + 1 ) , + D3D10_MESSAGE_ID_TEXTURE3D_MAP_INVALIDSUBRESOURCE = ( D3D10_MESSAGE_ID_TEXTURE3D_MAP_INVALIDMAPTYPE + 1 ) , + D3D10_MESSAGE_ID_TEXTURE3D_MAP_INVALIDFLAGS = ( D3D10_MESSAGE_ID_TEXTURE3D_MAP_INVALIDSUBRESOURCE + 1 ) , + D3D10_MESSAGE_ID_TEXTURE3D_MAP_ALREADYMAPPED = ( D3D10_MESSAGE_ID_TEXTURE3D_MAP_INVALIDFLAGS + 1 ) , + D3D10_MESSAGE_ID_TEXTURE3D_MAP_DEVICEREMOVED_RETURN = ( D3D10_MESSAGE_ID_TEXTURE3D_MAP_ALREADYMAPPED + 1 ) , + D3D10_MESSAGE_ID_TEXTURE3D_UNMAP_INVALIDSUBRESOURCE = ( D3D10_MESSAGE_ID_TEXTURE3D_MAP_DEVICEREMOVED_RETURN + 1 ) , + D3D10_MESSAGE_ID_TEXTURE3D_UNMAP_NOTMAPPED = ( D3D10_MESSAGE_ID_TEXTURE3D_UNMAP_INVALIDSUBRESOURCE + 1 ) , + D3D10_MESSAGE_ID_CHECKFORMATSUPPORT_FORMAT_DEPRECATED = ( D3D10_MESSAGE_ID_TEXTURE3D_UNMAP_NOTMAPPED + 1 ) , + D3D10_MESSAGE_ID_CHECKMULTISAMPLEQUALITYLEVELS_FORMAT_DEPRECATED = ( D3D10_MESSAGE_ID_CHECKFORMATSUPPORT_FORMAT_DEPRECATED + 1 ) , + D3D10_MESSAGE_ID_SETEXCEPTIONMODE_UNRECOGNIZEDFLAGS = ( D3D10_MESSAGE_ID_CHECKMULTISAMPLEQUALITYLEVELS_FORMAT_DEPRECATED + 1 ) , + D3D10_MESSAGE_ID_SETEXCEPTIONMODE_INVALIDARG_RETURN = ( D3D10_MESSAGE_ID_SETEXCEPTIONMODE_UNRECOGNIZEDFLAGS + 1 ) , + D3D10_MESSAGE_ID_SETEXCEPTIONMODE_DEVICEREMOVED_RETURN = ( D3D10_MESSAGE_ID_SETEXCEPTIONMODE_INVALIDARG_RETURN + 1 ) , + D3D10_MESSAGE_ID_REF_SIMULATING_INFINITELY_FAST_HARDWARE = ( D3D10_MESSAGE_ID_SETEXCEPTIONMODE_DEVICEREMOVED_RETURN + 1 ) , + D3D10_MESSAGE_ID_REF_THREADING_MODE = ( D3D10_MESSAGE_ID_REF_SIMULATING_INFINITELY_FAST_HARDWARE + 1 ) , + D3D10_MESSAGE_ID_REF_UMDRIVER_EXCEPTION = ( D3D10_MESSAGE_ID_REF_THREADING_MODE + 1 ) , + D3D10_MESSAGE_ID_REF_KMDRIVER_EXCEPTION = ( D3D10_MESSAGE_ID_REF_UMDRIVER_EXCEPTION + 1 ) , + D3D10_MESSAGE_ID_REF_HARDWARE_EXCEPTION = ( D3D10_MESSAGE_ID_REF_KMDRIVER_EXCEPTION + 1 ) , + D3D10_MESSAGE_ID_REF_ACCESSING_INDEXABLE_TEMP_OUT_OF_RANGE = ( D3D10_MESSAGE_ID_REF_HARDWARE_EXCEPTION + 1 ) , + D3D10_MESSAGE_ID_REF_PROBLEM_PARSING_SHADER = ( D3D10_MESSAGE_ID_REF_ACCESSING_INDEXABLE_TEMP_OUT_OF_RANGE + 1 ) , + D3D10_MESSAGE_ID_REF_OUT_OF_MEMORY = ( D3D10_MESSAGE_ID_REF_PROBLEM_PARSING_SHADER + 1 ) , + D3D10_MESSAGE_ID_REF_INFO = ( D3D10_MESSAGE_ID_REF_OUT_OF_MEMORY + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_VERTEXPOS_OVERFLOW = ( D3D10_MESSAGE_ID_REF_INFO + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAWINDEXED_INDEXPOS_OVERFLOW = ( D3D10_MESSAGE_ID_DEVICE_DRAW_VERTEXPOS_OVERFLOW + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAWINSTANCED_VERTEXPOS_OVERFLOW = ( D3D10_MESSAGE_ID_DEVICE_DRAWINDEXED_INDEXPOS_OVERFLOW + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAWINSTANCED_INSTANCEPOS_OVERFLOW = ( D3D10_MESSAGE_ID_DEVICE_DRAWINSTANCED_VERTEXPOS_OVERFLOW + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAWINDEXEDINSTANCED_INSTANCEPOS_OVERFLOW = ( D3D10_MESSAGE_ID_DEVICE_DRAWINSTANCED_INSTANCEPOS_OVERFLOW + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAWINDEXEDINSTANCED_INDEXPOS_OVERFLOW = ( D3D10_MESSAGE_ID_DEVICE_DRAWINDEXEDINSTANCED_INSTANCEPOS_OVERFLOW + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_VERTEX_SHADER_NOT_SET = ( D3D10_MESSAGE_ID_DEVICE_DRAWINDEXEDINSTANCED_INDEXPOS_OVERFLOW + 1 ) , + D3D10_MESSAGE_ID_DEVICE_SHADER_LINKAGE_SEMANTICNAME_NOT_FOUND = ( D3D10_MESSAGE_ID_DEVICE_DRAW_VERTEX_SHADER_NOT_SET + 1 ) , + D3D10_MESSAGE_ID_DEVICE_SHADER_LINKAGE_REGISTERINDEX = ( D3D10_MESSAGE_ID_DEVICE_SHADER_LINKAGE_SEMANTICNAME_NOT_FOUND + 1 ) , + D3D10_MESSAGE_ID_DEVICE_SHADER_LINKAGE_COMPONENTTYPE = ( D3D10_MESSAGE_ID_DEVICE_SHADER_LINKAGE_REGISTERINDEX + 1 ) , + D3D10_MESSAGE_ID_DEVICE_SHADER_LINKAGE_REGISTERMASK = ( D3D10_MESSAGE_ID_DEVICE_SHADER_LINKAGE_COMPONENTTYPE + 1 ) , + D3D10_MESSAGE_ID_DEVICE_SHADER_LINKAGE_SYSTEMVALUE = ( D3D10_MESSAGE_ID_DEVICE_SHADER_LINKAGE_REGISTERMASK + 1 ) , + D3D10_MESSAGE_ID_DEVICE_SHADER_LINKAGE_NEVERWRITTEN_ALWAYSREADS = ( D3D10_MESSAGE_ID_DEVICE_SHADER_LINKAGE_SYSTEMVALUE + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_VERTEX_BUFFER_NOT_SET = ( D3D10_MESSAGE_ID_DEVICE_SHADER_LINKAGE_NEVERWRITTEN_ALWAYSREADS + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_INPUTLAYOUT_NOT_SET = ( D3D10_MESSAGE_ID_DEVICE_DRAW_VERTEX_BUFFER_NOT_SET + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_CONSTANT_BUFFER_NOT_SET = ( D3D10_MESSAGE_ID_DEVICE_DRAW_INPUTLAYOUT_NOT_SET + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_CONSTANT_BUFFER_TOO_SMALL = ( D3D10_MESSAGE_ID_DEVICE_DRAW_CONSTANT_BUFFER_NOT_SET + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_SAMPLER_NOT_SET = ( D3D10_MESSAGE_ID_DEVICE_DRAW_CONSTANT_BUFFER_TOO_SMALL + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_SHADERRESOURCEVIEW_NOT_SET = ( D3D10_MESSAGE_ID_DEVICE_DRAW_SAMPLER_NOT_SET + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_VIEW_DIMENSION_MISMATCH = ( D3D10_MESSAGE_ID_DEVICE_DRAW_SHADERRESOURCEVIEW_NOT_SET + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_VERTEX_BUFFER_STRIDE_TOO_SMALL = ( D3D10_MESSAGE_ID_DEVICE_DRAW_VIEW_DIMENSION_MISMATCH + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_VERTEX_BUFFER_TOO_SMALL = ( D3D10_MESSAGE_ID_DEVICE_DRAW_VERTEX_BUFFER_STRIDE_TOO_SMALL + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_INDEX_BUFFER_NOT_SET = ( D3D10_MESSAGE_ID_DEVICE_DRAW_VERTEX_BUFFER_TOO_SMALL + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_INDEX_BUFFER_FORMAT_INVALID = ( D3D10_MESSAGE_ID_DEVICE_DRAW_INDEX_BUFFER_NOT_SET + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_INDEX_BUFFER_TOO_SMALL = ( D3D10_MESSAGE_ID_DEVICE_DRAW_INDEX_BUFFER_FORMAT_INVALID + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_GS_INPUT_PRIMITIVE_MISMATCH = ( D3D10_MESSAGE_ID_DEVICE_DRAW_INDEX_BUFFER_TOO_SMALL + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_RESOURCE_RETURN_TYPE_MISMATCH = ( D3D10_MESSAGE_ID_DEVICE_DRAW_GS_INPUT_PRIMITIVE_MISMATCH + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_POSITION_NOT_PRESENT = ( D3D10_MESSAGE_ID_DEVICE_DRAW_RESOURCE_RETURN_TYPE_MISMATCH + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_OUTPUT_STREAM_NOT_SET = ( D3D10_MESSAGE_ID_DEVICE_DRAW_POSITION_NOT_PRESENT + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_BOUND_RESOURCE_MAPPED = ( D3D10_MESSAGE_ID_DEVICE_DRAW_OUTPUT_STREAM_NOT_SET + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_INVALID_PRIMITIVETOPOLOGY = ( D3D10_MESSAGE_ID_DEVICE_DRAW_BOUND_RESOURCE_MAPPED + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_VERTEX_OFFSET_UNALIGNED = ( D3D10_MESSAGE_ID_DEVICE_DRAW_INVALID_PRIMITIVETOPOLOGY + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_VERTEX_STRIDE_UNALIGNED = ( D3D10_MESSAGE_ID_DEVICE_DRAW_VERTEX_OFFSET_UNALIGNED + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_INDEX_OFFSET_UNALIGNED = ( D3D10_MESSAGE_ID_DEVICE_DRAW_VERTEX_STRIDE_UNALIGNED + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_OUTPUT_STREAM_OFFSET_UNALIGNED = ( D3D10_MESSAGE_ID_DEVICE_DRAW_INDEX_OFFSET_UNALIGNED + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_RESOURCE_FORMAT_LD_UNSUPPORTED = ( D3D10_MESSAGE_ID_DEVICE_DRAW_OUTPUT_STREAM_OFFSET_UNALIGNED + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_RESOURCE_FORMAT_SAMPLE_UNSUPPORTED = ( D3D10_MESSAGE_ID_DEVICE_DRAW_RESOURCE_FORMAT_LD_UNSUPPORTED + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_RESOURCE_FORMAT_SAMPLE_C_UNSUPPORTED = ( D3D10_MESSAGE_ID_DEVICE_DRAW_RESOURCE_FORMAT_SAMPLE_UNSUPPORTED + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_RESOURCE_MULTISAMPLE_UNSUPPORTED = ( D3D10_MESSAGE_ID_DEVICE_DRAW_RESOURCE_FORMAT_SAMPLE_C_UNSUPPORTED + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_SO_TARGETS_BOUND_WITHOUT_SOURCE = ( D3D10_MESSAGE_ID_DEVICE_DRAW_RESOURCE_MULTISAMPLE_UNSUPPORTED + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_SO_STRIDE_LARGER_THAN_BUFFER = ( D3D10_MESSAGE_ID_DEVICE_DRAW_SO_TARGETS_BOUND_WITHOUT_SOURCE + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_OM_RENDER_TARGET_DOES_NOT_SUPPORT_BLENDING = ( D3D10_MESSAGE_ID_DEVICE_DRAW_SO_STRIDE_LARGER_THAN_BUFFER + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_OM_DUAL_SOURCE_BLENDING_CAN_ONLY_HAVE_RENDER_TARGET_0 = ( D3D10_MESSAGE_ID_DEVICE_DRAW_OM_RENDER_TARGET_DOES_NOT_SUPPORT_BLENDING + 1 ) , + D3D10_MESSAGE_ID_DEVICE_REMOVAL_PROCESS_AT_FAULT = ( D3D10_MESSAGE_ID_DEVICE_DRAW_OM_DUAL_SOURCE_BLENDING_CAN_ONLY_HAVE_RENDER_TARGET_0 + 1 ) , + D3D10_MESSAGE_ID_DEVICE_REMOVAL_PROCESS_POSSIBLY_AT_FAULT = ( D3D10_MESSAGE_ID_DEVICE_REMOVAL_PROCESS_AT_FAULT + 1 ) , + D3D10_MESSAGE_ID_DEVICE_REMOVAL_PROCESS_NOT_AT_FAULT = ( D3D10_MESSAGE_ID_DEVICE_REMOVAL_PROCESS_POSSIBLY_AT_FAULT + 1 ) , + D3D10_MESSAGE_ID_DEVICE_OPEN_SHARED_RESOURCE_INVALIDARG_RETURN = ( D3D10_MESSAGE_ID_DEVICE_REMOVAL_PROCESS_NOT_AT_FAULT + 1 ) , + D3D10_MESSAGE_ID_DEVICE_OPEN_SHARED_RESOURCE_OUTOFMEMORY_RETURN = ( D3D10_MESSAGE_ID_DEVICE_OPEN_SHARED_RESOURCE_INVALIDARG_RETURN + 1 ) , + D3D10_MESSAGE_ID_DEVICE_OPEN_SHARED_RESOURCE_BADINTERFACE_RETURN = ( D3D10_MESSAGE_ID_DEVICE_OPEN_SHARED_RESOURCE_OUTOFMEMORY_RETURN + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_VIEWPORT_NOT_SET = ( D3D10_MESSAGE_ID_DEVICE_OPEN_SHARED_RESOURCE_BADINTERFACE_RETURN + 1 ) , + D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_TRAILING_DIGIT_IN_SEMANTIC = ( D3D10_MESSAGE_ID_DEVICE_DRAW_VIEWPORT_NOT_SET + 1 ) , + D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_TRAILING_DIGIT_IN_SEMANTIC = ( D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_TRAILING_DIGIT_IN_SEMANTIC + 1 ) , + D3D10_MESSAGE_ID_DEVICE_RSSETVIEWPORTS_DENORMFLUSH = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_TRAILING_DIGIT_IN_SEMANTIC + 1 ) , + D3D10_MESSAGE_ID_OMSETRENDERTARGETS_INVALIDVIEW = ( D3D10_MESSAGE_ID_DEVICE_RSSETVIEWPORTS_DENORMFLUSH + 1 ) , + D3D10_MESSAGE_ID_DEVICE_SETTEXTFILTERSIZE_INVALIDDIMENSIONS = ( D3D10_MESSAGE_ID_OMSETRENDERTARGETS_INVALIDVIEW + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_SAMPLER_MISMATCH = ( D3D10_MESSAGE_ID_DEVICE_SETTEXTFILTERSIZE_INVALIDDIMENSIONS + 1 ) , + D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_TYPE_MISMATCH = ( D3D10_MESSAGE_ID_DEVICE_DRAW_SAMPLER_MISMATCH + 1 ) , + D3D10_MESSAGE_ID_BLENDSTATE_GETDESC_LEGACY = ( D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_TYPE_MISMATCH + 1 ) , + D3D10_MESSAGE_ID_SHADERRESOURCEVIEW_GETDESC_LEGACY = ( D3D10_MESSAGE_ID_BLENDSTATE_GETDESC_LEGACY + 1 ) , + D3D10_MESSAGE_ID_CREATEQUERY_OUTOFMEMORY_RETURN = ( D3D10_MESSAGE_ID_SHADERRESOURCEVIEW_GETDESC_LEGACY + 1 ) , + D3D10_MESSAGE_ID_CREATEPREDICATE_OUTOFMEMORY_RETURN = ( D3D10_MESSAGE_ID_CREATEQUERY_OUTOFMEMORY_RETURN + 1 ) , + D3D10_MESSAGE_ID_CREATECOUNTER_OUTOFRANGE_COUNTER = ( D3D10_MESSAGE_ID_CREATEPREDICATE_OUTOFMEMORY_RETURN + 1 ) , + D3D10_MESSAGE_ID_CREATECOUNTER_SIMULTANEOUS_ACTIVE_COUNTERS_EXHAUSTED = ( D3D10_MESSAGE_ID_CREATECOUNTER_OUTOFRANGE_COUNTER + 1 ) , + D3D10_MESSAGE_ID_CREATECOUNTER_UNSUPPORTED_WELLKNOWN_COUNTER = ( D3D10_MESSAGE_ID_CREATECOUNTER_SIMULTANEOUS_ACTIVE_COUNTERS_EXHAUSTED + 1 ) , + D3D10_MESSAGE_ID_CREATECOUNTER_OUTOFMEMORY_RETURN = ( D3D10_MESSAGE_ID_CREATECOUNTER_UNSUPPORTED_WELLKNOWN_COUNTER + 1 ) , + D3D10_MESSAGE_ID_CREATECOUNTER_NONEXCLUSIVE_RETURN = ( D3D10_MESSAGE_ID_CREATECOUNTER_OUTOFMEMORY_RETURN + 1 ) , + D3D10_MESSAGE_ID_CREATECOUNTER_NULLDESC = ( D3D10_MESSAGE_ID_CREATECOUNTER_NONEXCLUSIVE_RETURN + 1 ) , + D3D10_MESSAGE_ID_CHECKCOUNTER_OUTOFRANGE_COUNTER = ( D3D10_MESSAGE_ID_CREATECOUNTER_NULLDESC + 1 ) , + D3D10_MESSAGE_ID_CHECKCOUNTER_UNSUPPORTED_WELLKNOWN_COUNTER = ( D3D10_MESSAGE_ID_CHECKCOUNTER_OUTOFRANGE_COUNTER + 1 ) , + D3D10_MESSAGE_ID_SETPREDICATION_INVALID_PREDICATE_STATE = ( D3D10_MESSAGE_ID_CHECKCOUNTER_UNSUPPORTED_WELLKNOWN_COUNTER + 1 ) , + D3D10_MESSAGE_ID_QUERY_BEGIN_UNSUPPORTED = ( D3D10_MESSAGE_ID_SETPREDICATION_INVALID_PREDICATE_STATE + 1 ) , + D3D10_MESSAGE_ID_PREDICATE_BEGIN_DURING_PREDICATION = ( D3D10_MESSAGE_ID_QUERY_BEGIN_UNSUPPORTED + 1 ) , + D3D10_MESSAGE_ID_QUERY_BEGIN_DUPLICATE = ( D3D10_MESSAGE_ID_PREDICATE_BEGIN_DURING_PREDICATION + 1 ) , + D3D10_MESSAGE_ID_QUERY_BEGIN_ABANDONING_PREVIOUS_RESULTS = ( D3D10_MESSAGE_ID_QUERY_BEGIN_DUPLICATE + 1 ) , + D3D10_MESSAGE_ID_PREDICATE_END_DURING_PREDICATION = ( D3D10_MESSAGE_ID_QUERY_BEGIN_ABANDONING_PREVIOUS_RESULTS + 1 ) , + D3D10_MESSAGE_ID_QUERY_END_ABANDONING_PREVIOUS_RESULTS = ( D3D10_MESSAGE_ID_PREDICATE_END_DURING_PREDICATION + 1 ) , + D3D10_MESSAGE_ID_QUERY_END_WITHOUT_BEGIN = ( D3D10_MESSAGE_ID_QUERY_END_ABANDONING_PREVIOUS_RESULTS + 1 ) , + D3D10_MESSAGE_ID_QUERY_GETDATA_INVALID_DATASIZE = ( D3D10_MESSAGE_ID_QUERY_END_WITHOUT_BEGIN + 1 ) , + D3D10_MESSAGE_ID_QUERY_GETDATA_INVALID_FLAGS = ( D3D10_MESSAGE_ID_QUERY_GETDATA_INVALID_DATASIZE + 1 ) , + D3D10_MESSAGE_ID_QUERY_GETDATA_INVALID_CALL = ( D3D10_MESSAGE_ID_QUERY_GETDATA_INVALID_FLAGS + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_PS_OUTPUT_TYPE_MISMATCH = ( D3D10_MESSAGE_ID_QUERY_GETDATA_INVALID_CALL + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_RESOURCE_FORMAT_GATHER_UNSUPPORTED = ( D3D10_MESSAGE_ID_DEVICE_DRAW_PS_OUTPUT_TYPE_MISMATCH + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_INVALID_USE_OF_CENTER_MULTISAMPLE_PATTERN = ( D3D10_MESSAGE_ID_DEVICE_DRAW_RESOURCE_FORMAT_GATHER_UNSUPPORTED + 1 ) , + D3D10_MESSAGE_ID_DEVICE_IASETVERTEXBUFFERS_STRIDE_TOO_LARGE = ( D3D10_MESSAGE_ID_DEVICE_DRAW_INVALID_USE_OF_CENTER_MULTISAMPLE_PATTERN + 1 ) , + D3D10_MESSAGE_ID_DEVICE_IASETVERTEXBUFFERS_INVALIDRANGE = ( D3D10_MESSAGE_ID_DEVICE_IASETVERTEXBUFFERS_STRIDE_TOO_LARGE + 1 ) , + D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_EMPTY_LAYOUT = ( D3D10_MESSAGE_ID_DEVICE_IASETVERTEXBUFFERS_INVALIDRANGE + 1 ) , + D3D10_MESSAGE_ID_DEVICE_DRAW_RESOURCE_SAMPLE_COUNT_MISMATCH = ( D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_EMPTY_LAYOUT + 1 ) , + D3D10_MESSAGE_ID_D3D10_MESSAGES_END = ( D3D10_MESSAGE_ID_DEVICE_DRAW_RESOURCE_SAMPLE_COUNT_MISMATCH + 1 ) , + D3D10_MESSAGE_ID_D3D10L9_MESSAGES_START = 0x100000, + D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_STENCIL_NO_TWO_SIDED = ( D3D10_MESSAGE_ID_D3D10L9_MESSAGES_START + 1 ) , + D3D10_MESSAGE_ID_CREATERASTERIZERSTATE_DepthBiasClamp_NOT_SUPPORTED = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_STENCIL_NO_TWO_SIDED + 1 ) , + D3D10_MESSAGE_ID_CREATESAMPLERSTATE_NO_COMPARISON_SUPPORT = ( D3D10_MESSAGE_ID_CREATERASTERIZERSTATE_DepthBiasClamp_NOT_SUPPORTED + 1 ) , + D3D10_MESSAGE_ID_CREATESAMPLERSTATE_EXCESSIVE_ANISOTROPY = ( D3D10_MESSAGE_ID_CREATESAMPLERSTATE_NO_COMPARISON_SUPPORT + 1 ) , + D3D10_MESSAGE_ID_CREATESAMPLERSTATE_BORDER_OUT_OF_RANGE = ( D3D10_MESSAGE_ID_CREATESAMPLERSTATE_EXCESSIVE_ANISOTROPY + 1 ) , + D3D10_MESSAGE_ID_VSSETSAMPLERS_NOT_SUPPORTED = ( D3D10_MESSAGE_ID_CREATESAMPLERSTATE_BORDER_OUT_OF_RANGE + 1 ) , + D3D10_MESSAGE_ID_VSSETSAMPLERS_TOO_MANY_SAMPLERS = ( D3D10_MESSAGE_ID_VSSETSAMPLERS_NOT_SUPPORTED + 1 ) , + D3D10_MESSAGE_ID_PSSETSAMPLERS_TOO_MANY_SAMPLERS = ( D3D10_MESSAGE_ID_VSSETSAMPLERS_TOO_MANY_SAMPLERS + 1 ) , + D3D10_MESSAGE_ID_CREATERESOURCE_NO_ARRAYS = ( D3D10_MESSAGE_ID_PSSETSAMPLERS_TOO_MANY_SAMPLERS + 1 ) , + D3D10_MESSAGE_ID_CREATERESOURCE_NO_VB_AND_IB_BIND = ( D3D10_MESSAGE_ID_CREATERESOURCE_NO_ARRAYS + 1 ) , + D3D10_MESSAGE_ID_CREATERESOURCE_NO_TEXTURE_1D = ( D3D10_MESSAGE_ID_CREATERESOURCE_NO_VB_AND_IB_BIND + 1 ) , + D3D10_MESSAGE_ID_CREATERESOURCE_DIMENSION_OUT_OF_RANGE = ( D3D10_MESSAGE_ID_CREATERESOURCE_NO_TEXTURE_1D + 1 ) , + D3D10_MESSAGE_ID_CREATERESOURCE_NOT_BINDABLE_AS_SHADER_RESOURCE = ( D3D10_MESSAGE_ID_CREATERESOURCE_DIMENSION_OUT_OF_RANGE + 1 ) , + D3D10_MESSAGE_ID_OMSETRENDERTARGETS_TOO_MANY_RENDER_TARGETS = ( D3D10_MESSAGE_ID_CREATERESOURCE_NOT_BINDABLE_AS_SHADER_RESOURCE + 1 ) , + D3D10_MESSAGE_ID_OMSETRENDERTARGETS_NO_DIFFERING_BIT_DEPTHS = ( D3D10_MESSAGE_ID_OMSETRENDERTARGETS_TOO_MANY_RENDER_TARGETS + 1 ) , + D3D10_MESSAGE_ID_IASETVERTEXBUFFERS_BAD_BUFFER_INDEX = ( D3D10_MESSAGE_ID_OMSETRENDERTARGETS_NO_DIFFERING_BIT_DEPTHS + 1 ) , + D3D10_MESSAGE_ID_DEVICE_RSSETVIEWPORTS_TOO_MANY_VIEWPORTS = ( D3D10_MESSAGE_ID_IASETVERTEXBUFFERS_BAD_BUFFER_INDEX + 1 ) , + D3D10_MESSAGE_ID_DEVICE_IASETPRIMITIVETOPOLOGY_ADJACENCY_UNSUPPORTED = ( D3D10_MESSAGE_ID_DEVICE_RSSETVIEWPORTS_TOO_MANY_VIEWPORTS + 1 ) , + D3D10_MESSAGE_ID_DEVICE_RSSETSCISSORRECTS_TOO_MANY_SCISSORS = ( D3D10_MESSAGE_ID_DEVICE_IASETPRIMITIVETOPOLOGY_ADJACENCY_UNSUPPORTED + 1 ) , + D3D10_MESSAGE_ID_COPYRESOURCE_ONLY_TEXTURE_2D_WITHIN_GPU_MEMORY = ( D3D10_MESSAGE_ID_DEVICE_RSSETSCISSORRECTS_TOO_MANY_SCISSORS + 1 ) , + D3D10_MESSAGE_ID_COPYRESOURCE_NO_TEXTURE_3D_READBACK = ( D3D10_MESSAGE_ID_COPYRESOURCE_ONLY_TEXTURE_2D_WITHIN_GPU_MEMORY + 1 ) , + D3D10_MESSAGE_ID_COPYRESOURCE_NO_TEXTURE_ONLY_READBACK = ( D3D10_MESSAGE_ID_COPYRESOURCE_NO_TEXTURE_3D_READBACK + 1 ) , + D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_UNSUPPORTED_FORMAT = ( D3D10_MESSAGE_ID_COPYRESOURCE_NO_TEXTURE_ONLY_READBACK + 1 ) , + D3D10_MESSAGE_ID_CREATEBLENDSTATE_NO_ALPHA_TO_COVERAGE = ( D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_UNSUPPORTED_FORMAT + 1 ) , + D3D10_MESSAGE_ID_CREATERASTERIZERSTATE_DepthClipEnable_MUST_BE_TRUE = ( D3D10_MESSAGE_ID_CREATEBLENDSTATE_NO_ALPHA_TO_COVERAGE + 1 ) , + D3D10_MESSAGE_ID_DRAWINDEXED_STARTINDEXLOCATION_MUST_BE_POSITIVE = ( D3D10_MESSAGE_ID_CREATERASTERIZERSTATE_DepthClipEnable_MUST_BE_TRUE + 1 ) , + D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_MUST_USE_LOWEST_LOD = ( D3D10_MESSAGE_ID_DRAWINDEXED_STARTINDEXLOCATION_MUST_BE_POSITIVE + 1 ) , + D3D10_MESSAGE_ID_CREATESAMPLERSTATE_MINLOD_MUST_NOT_BE_FRACTIONAL = ( D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_MUST_USE_LOWEST_LOD + 1 ) , + D3D10_MESSAGE_ID_CREATESAMPLERSTATE_MAXLOD_MUST_BE_FLT_MAX = ( D3D10_MESSAGE_ID_CREATESAMPLERSTATE_MINLOD_MUST_NOT_BE_FRACTIONAL + 1 ) , + D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_FIRSTARRAYSLICE_MUST_BE_ZERO = ( D3D10_MESSAGE_ID_CREATESAMPLERSTATE_MAXLOD_MUST_BE_FLT_MAX + 1 ) , + D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_CUBES_MUST_HAVE_6_SIDES = ( D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_FIRSTARRAYSLICE_MUST_BE_ZERO + 1 ) , + D3D10_MESSAGE_ID_CREATERESOURCE_NOT_BINDABLE_AS_RENDER_TARGET = ( D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_CUBES_MUST_HAVE_6_SIDES + 1 ) , + D3D10_MESSAGE_ID_CREATERESOURCE_NO_DWORD_INDEX_BUFFER = ( D3D10_MESSAGE_ID_CREATERESOURCE_NOT_BINDABLE_AS_RENDER_TARGET + 1 ) , + D3D10_MESSAGE_ID_CREATERESOURCE_MSAA_PRECLUDES_SHADER_RESOURCE = ( D3D10_MESSAGE_ID_CREATERESOURCE_NO_DWORD_INDEX_BUFFER + 1 ) , + D3D10_MESSAGE_ID_CREATERESOURCE_PRESENTATION_PRECLUDES_SHADER_RESOURCE = ( D3D10_MESSAGE_ID_CREATERESOURCE_MSAA_PRECLUDES_SHADER_RESOURCE + 1 ) , + D3D10_MESSAGE_ID_CREATEBLENDSTATE_NO_INDEPENDENT_BLEND_ENABLE = ( D3D10_MESSAGE_ID_CREATERESOURCE_PRESENTATION_PRECLUDES_SHADER_RESOURCE + 1 ) , + D3D10_MESSAGE_ID_CREATEBLENDSTATE_NO_INDEPENDENT_WRITE_MASKS = ( D3D10_MESSAGE_ID_CREATEBLENDSTATE_NO_INDEPENDENT_BLEND_ENABLE + 1 ) , + D3D10_MESSAGE_ID_CREATERESOURCE_NO_STREAM_OUT = ( D3D10_MESSAGE_ID_CREATEBLENDSTATE_NO_INDEPENDENT_WRITE_MASKS + 1 ) , + D3D10_MESSAGE_ID_CREATERESOURCE_ONLY_VB_IB_FOR_BUFFERS = ( D3D10_MESSAGE_ID_CREATERESOURCE_NO_STREAM_OUT + 1 ) , + D3D10_MESSAGE_ID_CREATERESOURCE_NO_AUTOGEN_FOR_VOLUMES = ( D3D10_MESSAGE_ID_CREATERESOURCE_ONLY_VB_IB_FOR_BUFFERS + 1 ) , + D3D10_MESSAGE_ID_CREATERESOURCE_DXGI_FORMAT_R8G8B8A8_CANNOT_BE_SHARED = ( D3D10_MESSAGE_ID_CREATERESOURCE_NO_AUTOGEN_FOR_VOLUMES + 1 ) , + D3D10_MESSAGE_ID_VSSHADERRESOURCES_NOT_SUPPORTED = ( D3D10_MESSAGE_ID_CREATERESOURCE_DXGI_FORMAT_R8G8B8A8_CANNOT_BE_SHARED + 1 ) , + D3D10_MESSAGE_ID_GEOMETRY_SHADER_NOT_SUPPORTED = ( D3D10_MESSAGE_ID_VSSHADERRESOURCES_NOT_SUPPORTED + 1 ) , + D3D10_MESSAGE_ID_STREAM_OUT_NOT_SUPPORTED = ( D3D10_MESSAGE_ID_GEOMETRY_SHADER_NOT_SUPPORTED + 1 ) , + D3D10_MESSAGE_ID_TEXT_FILTER_NOT_SUPPORTED = ( D3D10_MESSAGE_ID_STREAM_OUT_NOT_SUPPORTED + 1 ) , + D3D10_MESSAGE_ID_CREATEBLENDSTATE_NO_SEPARATE_ALPHA_BLEND = ( D3D10_MESSAGE_ID_TEXT_FILTER_NOT_SUPPORTED + 1 ) , + D3D10_MESSAGE_ID_CREATEBLENDSTATE_NO_MRT_BLEND = ( D3D10_MESSAGE_ID_CREATEBLENDSTATE_NO_SEPARATE_ALPHA_BLEND + 1 ) , + D3D10_MESSAGE_ID_CREATEBLENDSTATE_OPERATION_NOT_SUPPORTED = ( D3D10_MESSAGE_ID_CREATEBLENDSTATE_NO_MRT_BLEND + 1 ) , + D3D10_MESSAGE_ID_CREATESAMPLERSTATE_NO_MIRRORONCE = ( D3D10_MESSAGE_ID_CREATEBLENDSTATE_OPERATION_NOT_SUPPORTED + 1 ) , + D3D10_MESSAGE_ID_DRAWINSTANCED_NOT_SUPPORTED = ( D3D10_MESSAGE_ID_CREATESAMPLERSTATE_NO_MIRRORONCE + 1 ) , + D3D10_MESSAGE_ID_DRAWINDEXEDINSTANCED_NOT_SUPPORTED_BELOW_9_3 = ( D3D10_MESSAGE_ID_DRAWINSTANCED_NOT_SUPPORTED + 1 ) , + D3D10_MESSAGE_ID_DRAWINDEXED_POINTLIST_UNSUPPORTED = ( D3D10_MESSAGE_ID_DRAWINDEXEDINSTANCED_NOT_SUPPORTED_BELOW_9_3 + 1 ) , + D3D10_MESSAGE_ID_SETBLENDSTATE_SAMPLE_MASK_CANNOT_BE_ZERO = ( D3D10_MESSAGE_ID_DRAWINDEXED_POINTLIST_UNSUPPORTED + 1 ) , + D3D10_MESSAGE_ID_CREATERESOURCE_DIMENSION_EXCEEDS_FEATURE_LEVEL_DEFINITION = ( D3D10_MESSAGE_ID_SETBLENDSTATE_SAMPLE_MASK_CANNOT_BE_ZERO + 1 ) , + D3D10_MESSAGE_ID_CREATERESOURCE_ONLY_SINGLE_MIP_LEVEL_DEPTH_STENCIL_SUPPORTED = ( D3D10_MESSAGE_ID_CREATERESOURCE_DIMENSION_EXCEEDS_FEATURE_LEVEL_DEFINITION + 1 ) , + D3D10_MESSAGE_ID_DEVICE_RSSETSCISSORRECTS_NEGATIVESCISSOR = ( D3D10_MESSAGE_ID_CREATERESOURCE_ONLY_SINGLE_MIP_LEVEL_DEPTH_STENCIL_SUPPORTED + 1 ) , + D3D10_MESSAGE_ID_SLOT_ZERO_MUST_BE_D3D10_INPUT_PER_VERTEX_DATA = ( D3D10_MESSAGE_ID_DEVICE_RSSETSCISSORRECTS_NEGATIVESCISSOR + 1 ) , + D3D10_MESSAGE_ID_CREATERESOURCE_NON_POW_2_MIPMAP = ( D3D10_MESSAGE_ID_SLOT_ZERO_MUST_BE_D3D10_INPUT_PER_VERTEX_DATA + 1 ) , + D3D10_MESSAGE_ID_CREATESAMPLERSTATE_BORDER_NOT_SUPPORTED = ( D3D10_MESSAGE_ID_CREATERESOURCE_NON_POW_2_MIPMAP + 1 ) , + D3D10_MESSAGE_ID_OMSETRENDERTARGETS_NO_SRGB_MRT = ( D3D10_MESSAGE_ID_CREATESAMPLERSTATE_BORDER_NOT_SUPPORTED + 1 ) , + D3D10_MESSAGE_ID_D3D10L9_MESSAGES_END = ( D3D10_MESSAGE_ID_OMSETRENDERTARGETS_NO_SRGB_MRT + 1 ) + } D3D10_MESSAGE_ID; + +typedef struct D3D10_MESSAGE + { + D3D10_MESSAGE_CATEGORY Category; + D3D10_MESSAGE_SEVERITY Severity; + D3D10_MESSAGE_ID ID; + const char *pDescription; + SIZE_T DescriptionByteLength; + } D3D10_MESSAGE; + +typedef struct D3D10_INFO_QUEUE_FILTER_DESC + { + UINT NumCategories; + D3D10_MESSAGE_CATEGORY *pCategoryList; + UINT NumSeverities; + D3D10_MESSAGE_SEVERITY *pSeverityList; + UINT NumIDs; + D3D10_MESSAGE_ID *pIDList; + } D3D10_INFO_QUEUE_FILTER_DESC; + +typedef struct D3D10_INFO_QUEUE_FILTER + { + D3D10_INFO_QUEUE_FILTER_DESC AllowList; + D3D10_INFO_QUEUE_FILTER_DESC DenyList; + } D3D10_INFO_QUEUE_FILTER; + +#define D3D10_INFO_QUEUE_DEFAULT_MESSAGE_COUNT_LIMIT 1024 + + +extern RPC_IF_HANDLE __MIDL_itf_d3d10sdklayers_0000_0002_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d10sdklayers_0000_0002_v0_0_s_ifspec; + +#ifndef __ID3D10InfoQueue_INTERFACE_DEFINED__ +#define __ID3D10InfoQueue_INTERFACE_DEFINED__ + +/* interface ID3D10InfoQueue */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D10InfoQueue; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("1b940b17-2642-4d1f-ab1f-b99bad0c395f") + ID3D10InfoQueue : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SetMessageCountLimit( + /* [annotation] */ + __in UINT64 MessageCountLimit) = 0; + + virtual void STDMETHODCALLTYPE ClearStoredMessages( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetMessage( + /* [annotation] */ + __in UINT64 MessageIndex, + /* [annotation] */ + __out_bcount_opt(*pMessageByteLength) D3D10_MESSAGE *pMessage, + /* [annotation] */ + __inout SIZE_T *pMessageByteLength) = 0; + + virtual UINT64 STDMETHODCALLTYPE GetNumMessagesAllowedByStorageFilter( void) = 0; + + virtual UINT64 STDMETHODCALLTYPE GetNumMessagesDeniedByStorageFilter( void) = 0; + + virtual UINT64 STDMETHODCALLTYPE GetNumStoredMessages( void) = 0; + + virtual UINT64 STDMETHODCALLTYPE GetNumStoredMessagesAllowedByRetrievalFilter( void) = 0; + + virtual UINT64 STDMETHODCALLTYPE GetNumMessagesDiscardedByMessageCountLimit( void) = 0; + + virtual UINT64 STDMETHODCALLTYPE GetMessageCountLimit( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE AddStorageFilterEntries( + /* [annotation] */ + __in D3D10_INFO_QUEUE_FILTER *pFilter) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetStorageFilter( + /* [annotation] */ + __out_bcount_opt(*pFilterByteLength) D3D10_INFO_QUEUE_FILTER *pFilter, + /* [annotation] */ + __inout SIZE_T *pFilterByteLength) = 0; + + virtual void STDMETHODCALLTYPE ClearStorageFilter( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE PushEmptyStorageFilter( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE PushCopyOfStorageFilter( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE PushStorageFilter( + /* [annotation] */ + __in D3D10_INFO_QUEUE_FILTER *pFilter) = 0; + + virtual void STDMETHODCALLTYPE PopStorageFilter( void) = 0; + + virtual UINT STDMETHODCALLTYPE GetStorageFilterStackSize( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE AddRetrievalFilterEntries( + /* [annotation] */ + __in D3D10_INFO_QUEUE_FILTER *pFilter) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetRetrievalFilter( + /* [annotation] */ + __out_bcount_opt(*pFilterByteLength) D3D10_INFO_QUEUE_FILTER *pFilter, + /* [annotation] */ + __inout SIZE_T *pFilterByteLength) = 0; + + virtual void STDMETHODCALLTYPE ClearRetrievalFilter( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE PushEmptyRetrievalFilter( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE PushCopyOfRetrievalFilter( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE PushRetrievalFilter( + /* [annotation] */ + __in D3D10_INFO_QUEUE_FILTER *pFilter) = 0; + + virtual void STDMETHODCALLTYPE PopRetrievalFilter( void) = 0; + + virtual UINT STDMETHODCALLTYPE GetRetrievalFilterStackSize( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE AddMessage( + /* [annotation] */ + __in D3D10_MESSAGE_CATEGORY Category, + /* [annotation] */ + __in D3D10_MESSAGE_SEVERITY Severity, + /* [annotation] */ + __in D3D10_MESSAGE_ID ID, + /* [annotation] */ + __in LPCSTR pDescription) = 0; + + virtual HRESULT STDMETHODCALLTYPE AddApplicationMessage( + /* [annotation] */ + __in D3D10_MESSAGE_SEVERITY Severity, + /* [annotation] */ + __in LPCSTR pDescription) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetBreakOnCategory( + /* [annotation] */ + __in D3D10_MESSAGE_CATEGORY Category, + /* [annotation] */ + __in BOOL bEnable) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetBreakOnSeverity( + /* [annotation] */ + __in D3D10_MESSAGE_SEVERITY Severity, + /* [annotation] */ + __in BOOL bEnable) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetBreakOnID( + /* [annotation] */ + __in D3D10_MESSAGE_ID ID, + /* [annotation] */ + __in BOOL bEnable) = 0; + + virtual BOOL STDMETHODCALLTYPE GetBreakOnCategory( + /* [annotation] */ + __in D3D10_MESSAGE_CATEGORY Category) = 0; + + virtual BOOL STDMETHODCALLTYPE GetBreakOnSeverity( + /* [annotation] */ + __in D3D10_MESSAGE_SEVERITY Severity) = 0; + + virtual BOOL STDMETHODCALLTYPE GetBreakOnID( + /* [annotation] */ + __in D3D10_MESSAGE_ID ID) = 0; + + virtual void STDMETHODCALLTYPE SetMuteDebugOutput( + /* [annotation] */ + __in BOOL bMute) = 0; + + virtual BOOL STDMETHODCALLTYPE GetMuteDebugOutput( void) = 0; + + }; + +#else /* C style interface */ + + typedef struct ID3D10InfoQueueVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D10InfoQueue * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D10InfoQueue * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D10InfoQueue * This); + + HRESULT ( STDMETHODCALLTYPE *SetMessageCountLimit )( + ID3D10InfoQueue * This, + /* [annotation] */ + __in UINT64 MessageCountLimit); + + void ( STDMETHODCALLTYPE *ClearStoredMessages )( + ID3D10InfoQueue * This); + + HRESULT ( STDMETHODCALLTYPE *GetMessage )( + ID3D10InfoQueue * This, + /* [annotation] */ + __in UINT64 MessageIndex, + /* [annotation] */ + __out_bcount_opt(*pMessageByteLength) D3D10_MESSAGE *pMessage, + /* [annotation] */ + __inout SIZE_T *pMessageByteLength); + + UINT64 ( STDMETHODCALLTYPE *GetNumMessagesAllowedByStorageFilter )( + ID3D10InfoQueue * This); + + UINT64 ( STDMETHODCALLTYPE *GetNumMessagesDeniedByStorageFilter )( + ID3D10InfoQueue * This); + + UINT64 ( STDMETHODCALLTYPE *GetNumStoredMessages )( + ID3D10InfoQueue * This); + + UINT64 ( STDMETHODCALLTYPE *GetNumStoredMessagesAllowedByRetrievalFilter )( + ID3D10InfoQueue * This); + + UINT64 ( STDMETHODCALLTYPE *GetNumMessagesDiscardedByMessageCountLimit )( + ID3D10InfoQueue * This); + + UINT64 ( STDMETHODCALLTYPE *GetMessageCountLimit )( + ID3D10InfoQueue * This); + + HRESULT ( STDMETHODCALLTYPE *AddStorageFilterEntries )( + ID3D10InfoQueue * This, + /* [annotation] */ + __in D3D10_INFO_QUEUE_FILTER *pFilter); + + HRESULT ( STDMETHODCALLTYPE *GetStorageFilter )( + ID3D10InfoQueue * This, + /* [annotation] */ + __out_bcount_opt(*pFilterByteLength) D3D10_INFO_QUEUE_FILTER *pFilter, + /* [annotation] */ + __inout SIZE_T *pFilterByteLength); + + void ( STDMETHODCALLTYPE *ClearStorageFilter )( + ID3D10InfoQueue * This); + + HRESULT ( STDMETHODCALLTYPE *PushEmptyStorageFilter )( + ID3D10InfoQueue * This); + + HRESULT ( STDMETHODCALLTYPE *PushCopyOfStorageFilter )( + ID3D10InfoQueue * This); + + HRESULT ( STDMETHODCALLTYPE *PushStorageFilter )( + ID3D10InfoQueue * This, + /* [annotation] */ + __in D3D10_INFO_QUEUE_FILTER *pFilter); + + void ( STDMETHODCALLTYPE *PopStorageFilter )( + ID3D10InfoQueue * This); + + UINT ( STDMETHODCALLTYPE *GetStorageFilterStackSize )( + ID3D10InfoQueue * This); + + HRESULT ( STDMETHODCALLTYPE *AddRetrievalFilterEntries )( + ID3D10InfoQueue * This, + /* [annotation] */ + __in D3D10_INFO_QUEUE_FILTER *pFilter); + + HRESULT ( STDMETHODCALLTYPE *GetRetrievalFilter )( + ID3D10InfoQueue * This, + /* [annotation] */ + __out_bcount_opt(*pFilterByteLength) D3D10_INFO_QUEUE_FILTER *pFilter, + /* [annotation] */ + __inout SIZE_T *pFilterByteLength); + + void ( STDMETHODCALLTYPE *ClearRetrievalFilter )( + ID3D10InfoQueue * This); + + HRESULT ( STDMETHODCALLTYPE *PushEmptyRetrievalFilter )( + ID3D10InfoQueue * This); + + HRESULT ( STDMETHODCALLTYPE *PushCopyOfRetrievalFilter )( + ID3D10InfoQueue * This); + + HRESULT ( STDMETHODCALLTYPE *PushRetrievalFilter )( + ID3D10InfoQueue * This, + /* [annotation] */ + __in D3D10_INFO_QUEUE_FILTER *pFilter); + + void ( STDMETHODCALLTYPE *PopRetrievalFilter )( + ID3D10InfoQueue * This); + + UINT ( STDMETHODCALLTYPE *GetRetrievalFilterStackSize )( + ID3D10InfoQueue * This); + + HRESULT ( STDMETHODCALLTYPE *AddMessage )( + ID3D10InfoQueue * This, + /* [annotation] */ + __in D3D10_MESSAGE_CATEGORY Category, + /* [annotation] */ + __in D3D10_MESSAGE_SEVERITY Severity, + /* [annotation] */ + __in D3D10_MESSAGE_ID ID, + /* [annotation] */ + __in LPCSTR pDescription); + + HRESULT ( STDMETHODCALLTYPE *AddApplicationMessage )( + ID3D10InfoQueue * This, + /* [annotation] */ + __in D3D10_MESSAGE_SEVERITY Severity, + /* [annotation] */ + __in LPCSTR pDescription); + + HRESULT ( STDMETHODCALLTYPE *SetBreakOnCategory )( + ID3D10InfoQueue * This, + /* [annotation] */ + __in D3D10_MESSAGE_CATEGORY Category, + /* [annotation] */ + __in BOOL bEnable); + + HRESULT ( STDMETHODCALLTYPE *SetBreakOnSeverity )( + ID3D10InfoQueue * This, + /* [annotation] */ + __in D3D10_MESSAGE_SEVERITY Severity, + /* [annotation] */ + __in BOOL bEnable); + + HRESULT ( STDMETHODCALLTYPE *SetBreakOnID )( + ID3D10InfoQueue * This, + /* [annotation] */ + __in D3D10_MESSAGE_ID ID, + /* [annotation] */ + __in BOOL bEnable); + + BOOL ( STDMETHODCALLTYPE *GetBreakOnCategory )( + ID3D10InfoQueue * This, + /* [annotation] */ + __in D3D10_MESSAGE_CATEGORY Category); + + BOOL ( STDMETHODCALLTYPE *GetBreakOnSeverity )( + ID3D10InfoQueue * This, + /* [annotation] */ + __in D3D10_MESSAGE_SEVERITY Severity); + + BOOL ( STDMETHODCALLTYPE *GetBreakOnID )( + ID3D10InfoQueue * This, + /* [annotation] */ + __in D3D10_MESSAGE_ID ID); + + void ( STDMETHODCALLTYPE *SetMuteDebugOutput )( + ID3D10InfoQueue * This, + /* [annotation] */ + __in BOOL bMute); + + BOOL ( STDMETHODCALLTYPE *GetMuteDebugOutput )( + ID3D10InfoQueue * This); + + END_INTERFACE + } ID3D10InfoQueueVtbl; + + interface ID3D10InfoQueue + { + CONST_VTBL struct ID3D10InfoQueueVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D10InfoQueue_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D10InfoQueue_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D10InfoQueue_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D10InfoQueue_SetMessageCountLimit(This,MessageCountLimit) \ + ( (This)->lpVtbl -> SetMessageCountLimit(This,MessageCountLimit) ) + +#define ID3D10InfoQueue_ClearStoredMessages(This) \ + ( (This)->lpVtbl -> ClearStoredMessages(This) ) + +#define ID3D10InfoQueue_GetMessage(This,MessageIndex,pMessage,pMessageByteLength) \ + ( (This)->lpVtbl -> GetMessage(This,MessageIndex,pMessage,pMessageByteLength) ) + +#define ID3D10InfoQueue_GetNumMessagesAllowedByStorageFilter(This) \ + ( (This)->lpVtbl -> GetNumMessagesAllowedByStorageFilter(This) ) + +#define ID3D10InfoQueue_GetNumMessagesDeniedByStorageFilter(This) \ + ( (This)->lpVtbl -> GetNumMessagesDeniedByStorageFilter(This) ) + +#define ID3D10InfoQueue_GetNumStoredMessages(This) \ + ( (This)->lpVtbl -> GetNumStoredMessages(This) ) + +#define ID3D10InfoQueue_GetNumStoredMessagesAllowedByRetrievalFilter(This) \ + ( (This)->lpVtbl -> GetNumStoredMessagesAllowedByRetrievalFilter(This) ) + +#define ID3D10InfoQueue_GetNumMessagesDiscardedByMessageCountLimit(This) \ + ( (This)->lpVtbl -> GetNumMessagesDiscardedByMessageCountLimit(This) ) + +#define ID3D10InfoQueue_GetMessageCountLimit(This) \ + ( (This)->lpVtbl -> GetMessageCountLimit(This) ) + +#define ID3D10InfoQueue_AddStorageFilterEntries(This,pFilter) \ + ( (This)->lpVtbl -> AddStorageFilterEntries(This,pFilter) ) + +#define ID3D10InfoQueue_GetStorageFilter(This,pFilter,pFilterByteLength) \ + ( (This)->lpVtbl -> GetStorageFilter(This,pFilter,pFilterByteLength) ) + +#define ID3D10InfoQueue_ClearStorageFilter(This) \ + ( (This)->lpVtbl -> ClearStorageFilter(This) ) + +#define ID3D10InfoQueue_PushEmptyStorageFilter(This) \ + ( (This)->lpVtbl -> PushEmptyStorageFilter(This) ) + +#define ID3D10InfoQueue_PushCopyOfStorageFilter(This) \ + ( (This)->lpVtbl -> PushCopyOfStorageFilter(This) ) + +#define ID3D10InfoQueue_PushStorageFilter(This,pFilter) \ + ( (This)->lpVtbl -> PushStorageFilter(This,pFilter) ) + +#define ID3D10InfoQueue_PopStorageFilter(This) \ + ( (This)->lpVtbl -> PopStorageFilter(This) ) + +#define ID3D10InfoQueue_GetStorageFilterStackSize(This) \ + ( (This)->lpVtbl -> GetStorageFilterStackSize(This) ) + +#define ID3D10InfoQueue_AddRetrievalFilterEntries(This,pFilter) \ + ( (This)->lpVtbl -> AddRetrievalFilterEntries(This,pFilter) ) + +#define ID3D10InfoQueue_GetRetrievalFilter(This,pFilter,pFilterByteLength) \ + ( (This)->lpVtbl -> GetRetrievalFilter(This,pFilter,pFilterByteLength) ) + +#define ID3D10InfoQueue_ClearRetrievalFilter(This) \ + ( (This)->lpVtbl -> ClearRetrievalFilter(This) ) + +#define ID3D10InfoQueue_PushEmptyRetrievalFilter(This) \ + ( (This)->lpVtbl -> PushEmptyRetrievalFilter(This) ) + +#define ID3D10InfoQueue_PushCopyOfRetrievalFilter(This) \ + ( (This)->lpVtbl -> PushCopyOfRetrievalFilter(This) ) + +#define ID3D10InfoQueue_PushRetrievalFilter(This,pFilter) \ + ( (This)->lpVtbl -> PushRetrievalFilter(This,pFilter) ) + +#define ID3D10InfoQueue_PopRetrievalFilter(This) \ + ( (This)->lpVtbl -> PopRetrievalFilter(This) ) + +#define ID3D10InfoQueue_GetRetrievalFilterStackSize(This) \ + ( (This)->lpVtbl -> GetRetrievalFilterStackSize(This) ) + +#define ID3D10InfoQueue_AddMessage(This,Category,Severity,ID,pDescription) \ + ( (This)->lpVtbl -> AddMessage(This,Category,Severity,ID,pDescription) ) + +#define ID3D10InfoQueue_AddApplicationMessage(This,Severity,pDescription) \ + ( (This)->lpVtbl -> AddApplicationMessage(This,Severity,pDescription) ) + +#define ID3D10InfoQueue_SetBreakOnCategory(This,Category,bEnable) \ + ( (This)->lpVtbl -> SetBreakOnCategory(This,Category,bEnable) ) + +#define ID3D10InfoQueue_SetBreakOnSeverity(This,Severity,bEnable) \ + ( (This)->lpVtbl -> SetBreakOnSeverity(This,Severity,bEnable) ) + +#define ID3D10InfoQueue_SetBreakOnID(This,ID,bEnable) \ + ( (This)->lpVtbl -> SetBreakOnID(This,ID,bEnable) ) + +#define ID3D10InfoQueue_GetBreakOnCategory(This,Category) \ + ( (This)->lpVtbl -> GetBreakOnCategory(This,Category) ) + +#define ID3D10InfoQueue_GetBreakOnSeverity(This,Severity) \ + ( (This)->lpVtbl -> GetBreakOnSeverity(This,Severity) ) + +#define ID3D10InfoQueue_GetBreakOnID(This,ID) \ + ( (This)->lpVtbl -> GetBreakOnID(This,ID) ) + +#define ID3D10InfoQueue_SetMuteDebugOutput(This,bMute) \ + ( (This)->lpVtbl -> SetMuteDebugOutput(This,bMute) ) + +#define ID3D10InfoQueue_GetMuteDebugOutput(This) \ + ( (This)->lpVtbl -> GetMuteDebugOutput(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D10InfoQueue_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d10sdklayers_0000_0003 */ +/* [local] */ + +#define D3D10_REGKEY_PATH __TEXT("Software\\Microsoft\\Direct3D") +#define D3D10_MUTE_DEBUG_OUTPUT __TEXT("MuteDebugOutput") +#define D3D10_ENABLE_BREAK_ON_MESSAGE __TEXT("EnableBreakOnMessage") +#define D3D10_INFOQUEUE_STORAGE_FILTER_OVERRIDE __TEXT("InfoQueueStorageFilterOverride") +#define D3D10_MUTE_CATEGORY __TEXT("Mute_CATEGORY_%s") +#define D3D10_MUTE_SEVERITY __TEXT("Mute_SEVERITY_%s") +#define D3D10_MUTE_ID_STRING __TEXT("Mute_ID_%s") +#define D3D10_MUTE_ID_DECIMAL __TEXT("Mute_ID_%d") +#define D3D10_UNMUTE_SEVERITY_INFO __TEXT("Unmute_SEVERITY_INFO") +#define D3D10_BREAKON_CATEGORY __TEXT("BreakOn_CATEGORY_%s") +#define D3D10_BREAKON_SEVERITY __TEXT("BreakOn_SEVERITY_%s") +#define D3D10_BREAKON_ID_STRING __TEXT("BreakOn_ID_%s") +#define D3D10_BREAKON_ID_DECIMAL __TEXT("BreakOn_ID_%d") +#define D3D10_APPSIZE_STRING __TEXT("Size") +#define D3D10_APPNAME_STRING __TEXT("Name") +DEFINE_GUID(IID_ID3D10Debug,0x9B7E4E01,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); +DEFINE_GUID(IID_ID3D10SwitchToRef,0x9B7E4E02,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); +DEFINE_GUID(IID_ID3D10InfoQueue,0x1b940b17,0x2642,0x4d1f,0xab,0x1f,0xb9,0x9b,0xad,0x0c,0x39,0x5f); + + +extern RPC_IF_HANDLE __MIDL_itf_d3d10sdklayers_0000_0003_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d10sdklayers_0000_0003_v0_0_s_ifspec; + +/* Additional Prototypes for ALL interfaces */ + +/* end of Additional Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/MediaClient/MediaClient/directx/include/d3d9.h b/MediaClient/MediaClient/directx/include/d3d9.h new file mode 100644 index 0000000..e5c7847 --- /dev/null +++ b/MediaClient/MediaClient/directx/include/d3d9.h @@ -0,0 +1,2791 @@ +/*==========================================================================; + * + * Copyright (C) Microsoft Corporation. All Rights Reserved. + * + * File: d3d9.h + * Content: Direct3D include file + * + ****************************************************************************/ + +#ifndef _D3D9_H_ +#define _D3D9_H_ + +#ifndef DIRECT3D_VERSION +#define DIRECT3D_VERSION 0x0900 +#endif //DIRECT3D_VERSION + +// include this file content only if compiling for DX9 interfaces +#if(DIRECT3D_VERSION >= 0x0900) + + +/* This identifier is passed to Direct3DCreate9 in order to ensure that an + * application was built against the correct header files. This number is + * incremented whenever a header (or other) change would require applications + * to be rebuilt. If the version doesn't match, Direct3DCreate9 will fail. + * (The number itself has no meaning.)*/ + +#ifdef D3D_DEBUG_INFO +#define D3D_SDK_VERSION (32 | 0x80000000) +#define D3D9b_SDK_VERSION (31 | 0x80000000) + +#else +#define D3D_SDK_VERSION 32 +#define D3D9b_SDK_VERSION 31 +#endif + + +#include + +#define COM_NO_WINDOWS_H +#include + +#include + +#if !defined(HMONITOR_DECLARED) && (WINVER < 0x0500) + #define HMONITOR_DECLARED + DECLARE_HANDLE(HMONITOR); +#endif + +#define D3DAPI WINAPI + +/* + * Interface IID's + */ +#if defined( _WIN32 ) && !defined( _NO_COM) + +/* IID_IDirect3D9 */ +/* {81BDCBCA-64D4-426d-AE8D-AD0147F4275C} */ +DEFINE_GUID(IID_IDirect3D9, 0x81bdcbca, 0x64d4, 0x426d, 0xae, 0x8d, 0xad, 0x1, 0x47, 0xf4, 0x27, 0x5c); + +/* IID_IDirect3DDevice9 */ +// {D0223B96-BF7A-43fd-92BD-A43B0D82B9EB} */ +DEFINE_GUID(IID_IDirect3DDevice9, 0xd0223b96, 0xbf7a, 0x43fd, 0x92, 0xbd, 0xa4, 0x3b, 0xd, 0x82, 0xb9, 0xeb); + +/* IID_IDirect3DResource9 */ +// {05EEC05D-8F7D-4362-B999-D1BAF357C704} +DEFINE_GUID(IID_IDirect3DResource9, 0x5eec05d, 0x8f7d, 0x4362, 0xb9, 0x99, 0xd1, 0xba, 0xf3, 0x57, 0xc7, 0x4); + +/* IID_IDirect3DBaseTexture9 */ +/* {580CA87E-1D3C-4d54-991D-B7D3E3C298CE} */ +DEFINE_GUID(IID_IDirect3DBaseTexture9, 0x580ca87e, 0x1d3c, 0x4d54, 0x99, 0x1d, 0xb7, 0xd3, 0xe3, 0xc2, 0x98, 0xce); + +/* IID_IDirect3DTexture9 */ +/* {85C31227-3DE5-4f00-9B3A-F11AC38C18B5} */ +DEFINE_GUID(IID_IDirect3DTexture9, 0x85c31227, 0x3de5, 0x4f00, 0x9b, 0x3a, 0xf1, 0x1a, 0xc3, 0x8c, 0x18, 0xb5); + +/* IID_IDirect3DCubeTexture9 */ +/* {FFF32F81-D953-473a-9223-93D652ABA93F} */ +DEFINE_GUID(IID_IDirect3DCubeTexture9, 0xfff32f81, 0xd953, 0x473a, 0x92, 0x23, 0x93, 0xd6, 0x52, 0xab, 0xa9, 0x3f); + +/* IID_IDirect3DVolumeTexture9 */ +/* {2518526C-E789-4111-A7B9-47EF328D13E6} */ +DEFINE_GUID(IID_IDirect3DVolumeTexture9, 0x2518526c, 0xe789, 0x4111, 0xa7, 0xb9, 0x47, 0xef, 0x32, 0x8d, 0x13, 0xe6); + +/* IID_IDirect3DVertexBuffer9 */ +/* {B64BB1B5-FD70-4df6-BF91-19D0A12455E3} */ +DEFINE_GUID(IID_IDirect3DVertexBuffer9, 0xb64bb1b5, 0xfd70, 0x4df6, 0xbf, 0x91, 0x19, 0xd0, 0xa1, 0x24, 0x55, 0xe3); + +/* IID_IDirect3DIndexBuffer9 */ +/* {7C9DD65E-D3F7-4529-ACEE-785830ACDE35} */ +DEFINE_GUID(IID_IDirect3DIndexBuffer9, 0x7c9dd65e, 0xd3f7, 0x4529, 0xac, 0xee, 0x78, 0x58, 0x30, 0xac, 0xde, 0x35); + +/* IID_IDirect3DSurface9 */ +/* {0CFBAF3A-9FF6-429a-99B3-A2796AF8B89B} */ +DEFINE_GUID(IID_IDirect3DSurface9, 0xcfbaf3a, 0x9ff6, 0x429a, 0x99, 0xb3, 0xa2, 0x79, 0x6a, 0xf8, 0xb8, 0x9b); + +/* IID_IDirect3DVolume9 */ +/* {24F416E6-1F67-4aa7-B88E-D33F6F3128A1} */ +DEFINE_GUID(IID_IDirect3DVolume9, 0x24f416e6, 0x1f67, 0x4aa7, 0xb8, 0x8e, 0xd3, 0x3f, 0x6f, 0x31, 0x28, 0xa1); + +/* IID_IDirect3DSwapChain9 */ +/* {794950F2-ADFC-458a-905E-10A10B0B503B} */ +DEFINE_GUID(IID_IDirect3DSwapChain9, 0x794950f2, 0xadfc, 0x458a, 0x90, 0x5e, 0x10, 0xa1, 0xb, 0xb, 0x50, 0x3b); + +/* IID_IDirect3DVertexDeclaration9 */ +/* {DD13C59C-36FA-4098-A8FB-C7ED39DC8546} */ +DEFINE_GUID(IID_IDirect3DVertexDeclaration9, 0xdd13c59c, 0x36fa, 0x4098, 0xa8, 0xfb, 0xc7, 0xed, 0x39, 0xdc, 0x85, 0x46); + +/* IID_IDirect3DVertexShader9 */ +/* {EFC5557E-6265-4613-8A94-43857889EB36} */ +DEFINE_GUID(IID_IDirect3DVertexShader9, 0xefc5557e, 0x6265, 0x4613, 0x8a, 0x94, 0x43, 0x85, 0x78, 0x89, 0xeb, 0x36); + +/* IID_IDirect3DPixelShader9 */ +/* {6D3BDBDC-5B02-4415-B852-CE5E8BCCB289} */ +DEFINE_GUID(IID_IDirect3DPixelShader9, 0x6d3bdbdc, 0x5b02, 0x4415, 0xb8, 0x52, 0xce, 0x5e, 0x8b, 0xcc, 0xb2, 0x89); + +/* IID_IDirect3DStateBlock9 */ +/* {B07C4FE5-310D-4ba8-A23C-4F0F206F218B} */ +DEFINE_GUID(IID_IDirect3DStateBlock9, 0xb07c4fe5, 0x310d, 0x4ba8, 0xa2, 0x3c, 0x4f, 0xf, 0x20, 0x6f, 0x21, 0x8b); + +/* IID_IDirect3DQuery9 */ +/* {d9771460-a695-4f26-bbd3-27b840b541cc} */ +DEFINE_GUID(IID_IDirect3DQuery9, 0xd9771460, 0xa695, 0x4f26, 0xbb, 0xd3, 0x27, 0xb8, 0x40, 0xb5, 0x41, 0xcc); + + +/* IID_HelperName */ +/* {E4A36723-FDFE-4b22-B146-3C04C07F4CC8} */ +DEFINE_GUID(IID_HelperName, 0xe4a36723, 0xfdfe, 0x4b22, 0xb1, 0x46, 0x3c, 0x4, 0xc0, 0x7f, 0x4c, 0xc8); + +/* D3D9Ex only -- */ +#if !defined(D3D_DISABLE_9EX) + +/* IID_IDirect3D9Ex */ +/* {02177241-69FC-400C-8FF1-93A44DF6861D} */ +DEFINE_GUID(IID_IDirect3D9Ex, 0x02177241, 0x69FC, 0x400C, 0x8F, 0xF1, 0x93, 0xA4, 0x4D, 0xF6, 0x86, 0x1D); + +/* IID_IDirect3DDevice9Ex */ +// {B18B10CE-2649-405a-870F-95F777D4313A} +DEFINE_GUID(IID_IDirect3DDevice9Ex, 0xb18b10ce, 0x2649, 0x405a, 0x87, 0xf, 0x95, 0xf7, 0x77, 0xd4, 0x31, 0x3a); + +/* IID_IDirect3DSwapChain9Ex */ +/* {91886CAF-1C3D-4d2e-A0AB-3E4C7D8D3303} */ +DEFINE_GUID(IID_IDirect3DSwapChain9Ex, 0x91886caf, 0x1c3d, 0x4d2e, 0xa0, 0xab, 0x3e, 0x4c, 0x7d, 0x8d, 0x33, 0x3); + +/* IID_IDirect3D9ExOverlayExtension */ +/* {187aeb13-aaf5-4c59-876d-e059088c0df8} */ +DEFINE_GUID(IID_IDirect3D9ExOverlayExtension, 0x187aeb13, 0xaaf5, 0x4c59, 0x87, 0x6d, 0xe0, 0x59, 0x8, 0x8c, 0xd, 0xf8); + +/* IID_IDirect3DDevice9Video */ +// {26DC4561-A1EE-4ae7-96DA-118A36C0EC95} +DEFINE_GUID(IID_IDirect3DDevice9Video, 0x26dc4561, 0xa1ee, 0x4ae7, 0x96, 0xda, 0x11, 0x8a, 0x36, 0xc0, 0xec, 0x95); + +/* IID_IDirect3D9AuthenticatedChannel */ +// {FF24BEEE-DA21-4beb-98B5-D2F899F98AF9} +DEFINE_GUID(IID_IDirect3DAuthenticatedChannel9, 0xff24beee, 0xda21, 0x4beb, 0x98, 0xb5, 0xd2, 0xf8, 0x99, 0xf9, 0x8a, 0xf9); + +/* IID_IDirect3DCryptoSession9 */ +// {FA0AB799-7A9C-48ca-8C5B-237E71A54434} +DEFINE_GUID(IID_IDirect3DCryptoSession9, 0xfa0ab799, 0x7a9c, 0x48ca, 0x8c, 0x5b, 0x23, 0x7e, 0x71, 0xa5, 0x44, 0x34); + + +#endif // !D3D_DISABLE_9EX +/* -- D3D9Ex only */ + +#endif + +#ifdef __cplusplus + +#ifndef DECLSPEC_UUID +#if _MSC_VER >= 1100 +#define DECLSPEC_UUID(x) __declspec(uuid(x)) +#else +#define DECLSPEC_UUID(x) +#endif +#endif + +interface DECLSPEC_UUID("81BDCBCA-64D4-426d-AE8D-AD0147F4275C") IDirect3D9; +interface DECLSPEC_UUID("D0223B96-BF7A-43fd-92BD-A43B0D82B9EB") IDirect3DDevice9; + +interface DECLSPEC_UUID("B07C4FE5-310D-4ba8-A23C-4F0F206F218B") IDirect3DStateBlock9; +interface DECLSPEC_UUID("05EEC05D-8F7D-4362-B999-D1BAF357C704") IDirect3DResource9; +interface DECLSPEC_UUID("DD13C59C-36FA-4098-A8FB-C7ED39DC8546") IDirect3DVertexDeclaration9; +interface DECLSPEC_UUID("EFC5557E-6265-4613-8A94-43857889EB36") IDirect3DVertexShader9; +interface DECLSPEC_UUID("6D3BDBDC-5B02-4415-B852-CE5E8BCCB289") IDirect3DPixelShader9; +interface DECLSPEC_UUID("580CA87E-1D3C-4d54-991D-B7D3E3C298CE") IDirect3DBaseTexture9; +interface DECLSPEC_UUID("85C31227-3DE5-4f00-9B3A-F11AC38C18B5") IDirect3DTexture9; +interface DECLSPEC_UUID("2518526C-E789-4111-A7B9-47EF328D13E6") IDirect3DVolumeTexture9; +interface DECLSPEC_UUID("FFF32F81-D953-473a-9223-93D652ABA93F") IDirect3DCubeTexture9; + +interface DECLSPEC_UUID("B64BB1B5-FD70-4df6-BF91-19D0A12455E3") IDirect3DVertexBuffer9; +interface DECLSPEC_UUID("7C9DD65E-D3F7-4529-ACEE-785830ACDE35") IDirect3DIndexBuffer9; + +interface DECLSPEC_UUID("0CFBAF3A-9FF6-429a-99B3-A2796AF8B89B") IDirect3DSurface9; +interface DECLSPEC_UUID("24F416E6-1F67-4aa7-B88E-D33F6F3128A1") IDirect3DVolume9; + +interface DECLSPEC_UUID("794950F2-ADFC-458a-905E-10A10B0B503B") IDirect3DSwapChain9; +interface DECLSPEC_UUID("d9771460-a695-4f26-bbd3-27b840b541cc") IDirect3DQuery9; + + +/* D3D9Ex only -- */ +#if !defined(D3D_DISABLE_9EX) + +interface DECLSPEC_UUID("02177241-69FC-400C-8FF1-93A44DF6861D") IDirect3D9Ex; +interface DECLSPEC_UUID("B18B10CE-2649-405a-870F-95F777D4313A") IDirect3DDevice9Ex; +interface DECLSPEC_UUID("91886CAF-1C3D-4d2e-A0AB-3E4C7D8D3303") IDirect3DSwapChain9Ex; +interface DECLSPEC_UUID("187AEB13-AAF5-4C59-876D-E059088C0DF8") IDirect3D9ExOverlayExtension; +interface DECLSPEC_UUID("26DC4561-A1EE-4ae7-96DA-118A36C0EC95") IDirect3DDevice9Video; +interface DECLSPEC_UUID("FF24BEEE-DA21-4beb-98B5-D2F899F98AF9") IDirect3DAuthenticatedChannel9; +interface DECLSPEC_UUID("FA0AB799-7A9C-48CA-8C5B-237E71A54434") IDirect3DCryptoSession9; + +#endif // !D3D_DISABLE_9EX +/* -- D3D9Ex only */ + +#if defined(_COM_SMARTPTR_TYPEDEF) +_COM_SMARTPTR_TYPEDEF(IDirect3D9, __uuidof(IDirect3D9)); +_COM_SMARTPTR_TYPEDEF(IDirect3DDevice9, __uuidof(IDirect3DDevice9)); + +_COM_SMARTPTR_TYPEDEF(IDirect3DStateBlock9, __uuidof(IDirect3DStateBlock9)); +_COM_SMARTPTR_TYPEDEF(IDirect3DResource9, __uuidof(IDirect3DResource9)); +_COM_SMARTPTR_TYPEDEF(IDirect3DVertexDeclaration9, __uuidof(IDirect3DVertexDeclaration9)); +_COM_SMARTPTR_TYPEDEF(IDirect3DVertexShader9, __uuidof(IDirect3DVertexShader9)); +_COM_SMARTPTR_TYPEDEF(IDirect3DPixelShader9, __uuidof(IDirect3DPixelShader9)); +_COM_SMARTPTR_TYPEDEF(IDirect3DBaseTexture9, __uuidof(IDirect3DBaseTexture9)); +_COM_SMARTPTR_TYPEDEF(IDirect3DTexture9, __uuidof(IDirect3DTexture9)); +_COM_SMARTPTR_TYPEDEF(IDirect3DVolumeTexture9, __uuidof(IDirect3DVolumeTexture9)); +_COM_SMARTPTR_TYPEDEF(IDirect3DCubeTexture9, __uuidof(IDirect3DCubeTexture9)); + +_COM_SMARTPTR_TYPEDEF(IDirect3DVertexBuffer9, __uuidof(IDirect3DVertexBuffer9)); +_COM_SMARTPTR_TYPEDEF(IDirect3DIndexBuffer9, __uuidof(IDirect3DIndexBuffer9)); + +_COM_SMARTPTR_TYPEDEF(IDirect3DSurface9, __uuidof(IDirect3DSurface9)); +_COM_SMARTPTR_TYPEDEF(IDirect3DVolume9, __uuidof(IDirect3DVolume9)); + +_COM_SMARTPTR_TYPEDEF(IDirect3DSwapChain9, __uuidof(IDirect3DSwapChain9)); +_COM_SMARTPTR_TYPEDEF(IDirect3DQuery9, __uuidof(IDirect3DQuery9)); + + +/* D3D9Ex only -- */ +#if !defined(D3D_DISABLE_9EX) + +_COM_SMARTPTR_TYPEDEF(IDirect3D9Ex, __uuidof(IDirect3D9Ex)); +_COM_SMARTPTR_TYPEDEF(IDirect3DDevice9Ex, __uuidof(IDirect3DDevice9Ex)); +_COM_SMARTPTR_TYPEDEF(IDirect3DSwapChain9Ex, __uuidof(IDirect3DSwapChain9Ex)); +_COM_SMARTPTR_TYPEDEF(IDirect3D9ExOverlayExtension, __uuidof(IDirect3D9ExOverlayExtension)); +_COM_SMARTPTR_TYPEDEF(IDirect3DDevice9Video, __uuidof(IDirect3DDevice9Video)); +_COM_SMARTPTR_TYPEDEF(IDirect3DAuthenticatedChannel9, __uuidof(IDirect3DAuthenticatedChannel9)); +_COM_SMARTPTR_TYPEDEF(IDirect3DCryptoSession9, __uuidof(IDirect3DCryptoSession9)); + +#endif // !D3D_DISABLE_9EX +/* -- D3D9Ex only */ + +#endif + +#endif + + +typedef interface IDirect3D9 IDirect3D9; +typedef interface IDirect3DDevice9 IDirect3DDevice9; +typedef interface IDirect3DStateBlock9 IDirect3DStateBlock9; +typedef interface IDirect3DVertexDeclaration9 IDirect3DVertexDeclaration9; +typedef interface IDirect3DVertexShader9 IDirect3DVertexShader9; +typedef interface IDirect3DPixelShader9 IDirect3DPixelShader9; +typedef interface IDirect3DResource9 IDirect3DResource9; +typedef interface IDirect3DBaseTexture9 IDirect3DBaseTexture9; +typedef interface IDirect3DTexture9 IDirect3DTexture9; +typedef interface IDirect3DVolumeTexture9 IDirect3DVolumeTexture9; +typedef interface IDirect3DCubeTexture9 IDirect3DCubeTexture9; +typedef interface IDirect3DVertexBuffer9 IDirect3DVertexBuffer9; +typedef interface IDirect3DIndexBuffer9 IDirect3DIndexBuffer9; +typedef interface IDirect3DSurface9 IDirect3DSurface9; +typedef interface IDirect3DVolume9 IDirect3DVolume9; +typedef interface IDirect3DSwapChain9 IDirect3DSwapChain9; +typedef interface IDirect3DQuery9 IDirect3DQuery9; + + +/* D3D9Ex only -- */ +#if !defined(D3D_DISABLE_9EX) + + +typedef interface IDirect3D9Ex IDirect3D9Ex; +typedef interface IDirect3DDevice9Ex IDirect3DDevice9Ex; +typedef interface IDirect3DSwapChain9Ex IDirect3DSwapChain9Ex; +typedef interface IDirect3D9ExOverlayExtension IDirect3D9ExOverlayExtension; +typedef interface IDirect3DDevice9Video IDirect3DDevice9Video; +typedef interface IDirect3DAuthenticatedChannel9 IDirect3DAuthenticatedChannel9; +typedef interface IDirect3DCryptoSession9 IDirect3DCryptoSession9; + +#endif // !D3D_DISABLE_9EX +/* -- D3D9Ex only */ + +#include "d3d9types.h" +#include "d3d9caps.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * DLL Function for creating a Direct3D9 object. This object supports + * enumeration and allows the creation of Direct3DDevice9 objects. + * Pass the value of the constant D3D_SDK_VERSION to this function, so + * that the run-time can validate that your application was compiled + * against the right headers. + */ + +IDirect3D9 * WINAPI Direct3DCreate9(UINT SDKVersion); + +/* + * Stubs for graphics profiling. + */ + +int WINAPI D3DPERF_BeginEvent( D3DCOLOR col, LPCWSTR wszName ); +int WINAPI D3DPERF_EndEvent( void ); +void WINAPI D3DPERF_SetMarker( D3DCOLOR col, LPCWSTR wszName ); +void WINAPI D3DPERF_SetRegion( D3DCOLOR col, LPCWSTR wszName ); +BOOL WINAPI D3DPERF_QueryRepeatFrame( void ); + +void WINAPI D3DPERF_SetOptions( DWORD dwOptions ); +DWORD WINAPI D3DPERF_GetStatus( void ); + +/* + * Direct3D interfaces + */ + + + + + + +#undef INTERFACE +#define INTERFACE IDirect3D9 + +DECLARE_INTERFACE_(IDirect3D9, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3D9 methods ***/ + STDMETHOD(RegisterSoftwareDevice)(THIS_ void* pInitializeFunction) PURE; + STDMETHOD_(UINT, GetAdapterCount)(THIS) PURE; + STDMETHOD(GetAdapterIdentifier)(THIS_ UINT Adapter,DWORD Flags,D3DADAPTER_IDENTIFIER9* pIdentifier) PURE; + STDMETHOD_(UINT, GetAdapterModeCount)(THIS_ UINT Adapter,D3DFORMAT Format) PURE; + STDMETHOD(EnumAdapterModes)(THIS_ UINT Adapter,D3DFORMAT Format,UINT Mode,D3DDISPLAYMODE* pMode) PURE; + STDMETHOD(GetAdapterDisplayMode)(THIS_ UINT Adapter,D3DDISPLAYMODE* pMode) PURE; + STDMETHOD(CheckDeviceType)(THIS_ UINT Adapter,D3DDEVTYPE DevType,D3DFORMAT AdapterFormat,D3DFORMAT BackBufferFormat,BOOL bWindowed) PURE; + STDMETHOD(CheckDeviceFormat)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT AdapterFormat,DWORD Usage,D3DRESOURCETYPE RType,D3DFORMAT CheckFormat) PURE; + STDMETHOD(CheckDeviceMultiSampleType)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT SurfaceFormat,BOOL Windowed,D3DMULTISAMPLE_TYPE MultiSampleType,DWORD* pQualityLevels) PURE; + STDMETHOD(CheckDepthStencilMatch)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT AdapterFormat,D3DFORMAT RenderTargetFormat,D3DFORMAT DepthStencilFormat) PURE; + STDMETHOD(CheckDeviceFormatConversion)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT SourceFormat,D3DFORMAT TargetFormat) PURE; + STDMETHOD(GetDeviceCaps)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DCAPS9* pCaps) PURE; + STDMETHOD_(HMONITOR, GetAdapterMonitor)(THIS_ UINT Adapter) PURE; + STDMETHOD(CreateDevice)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,HWND hFocusWindow,DWORD BehaviorFlags,D3DPRESENT_PARAMETERS* pPresentationParameters,IDirect3DDevice9** ppReturnedDeviceInterface) PURE; + + #ifdef D3D_DEBUG_INFO + LPCWSTR Version; + #endif +}; + +typedef struct IDirect3D9 *LPDIRECT3D9, *PDIRECT3D9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3D9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3D9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3D9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3D9_RegisterSoftwareDevice(p,a) (p)->lpVtbl->RegisterSoftwareDevice(p,a) +#define IDirect3D9_GetAdapterCount(p) (p)->lpVtbl->GetAdapterCount(p) +#define IDirect3D9_GetAdapterIdentifier(p,a,b,c) (p)->lpVtbl->GetAdapterIdentifier(p,a,b,c) +#define IDirect3D9_GetAdapterModeCount(p,a,b) (p)->lpVtbl->GetAdapterModeCount(p,a,b) +#define IDirect3D9_EnumAdapterModes(p,a,b,c,d) (p)->lpVtbl->EnumAdapterModes(p,a,b,c,d) +#define IDirect3D9_GetAdapterDisplayMode(p,a,b) (p)->lpVtbl->GetAdapterDisplayMode(p,a,b) +#define IDirect3D9_CheckDeviceType(p,a,b,c,d,e) (p)->lpVtbl->CheckDeviceType(p,a,b,c,d,e) +#define IDirect3D9_CheckDeviceFormat(p,a,b,c,d,e,f) (p)->lpVtbl->CheckDeviceFormat(p,a,b,c,d,e,f) +#define IDirect3D9_CheckDeviceMultiSampleType(p,a,b,c,d,e,f) (p)->lpVtbl->CheckDeviceMultiSampleType(p,a,b,c,d,e,f) +#define IDirect3D9_CheckDepthStencilMatch(p,a,b,c,d,e) (p)->lpVtbl->CheckDepthStencilMatch(p,a,b,c,d,e) +#define IDirect3D9_CheckDeviceFormatConversion(p,a,b,c,d) (p)->lpVtbl->CheckDeviceFormatConversion(p,a,b,c,d) +#define IDirect3D9_GetDeviceCaps(p,a,b,c) (p)->lpVtbl->GetDeviceCaps(p,a,b,c) +#define IDirect3D9_GetAdapterMonitor(p,a) (p)->lpVtbl->GetAdapterMonitor(p,a) +#define IDirect3D9_CreateDevice(p,a,b,c,d,e,f) (p)->lpVtbl->CreateDevice(p,a,b,c,d,e,f) +#else +#define IDirect3D9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3D9_AddRef(p) (p)->AddRef() +#define IDirect3D9_Release(p) (p)->Release() +#define IDirect3D9_RegisterSoftwareDevice(p,a) (p)->RegisterSoftwareDevice(a) +#define IDirect3D9_GetAdapterCount(p) (p)->GetAdapterCount() +#define IDirect3D9_GetAdapterIdentifier(p,a,b,c) (p)->GetAdapterIdentifier(a,b,c) +#define IDirect3D9_GetAdapterModeCount(p,a,b) (p)->GetAdapterModeCount(a,b) +#define IDirect3D9_EnumAdapterModes(p,a,b,c,d) (p)->EnumAdapterModes(a,b,c,d) +#define IDirect3D9_GetAdapterDisplayMode(p,a,b) (p)->GetAdapterDisplayMode(a,b) +#define IDirect3D9_CheckDeviceType(p,a,b,c,d,e) (p)->CheckDeviceType(a,b,c,d,e) +#define IDirect3D9_CheckDeviceFormat(p,a,b,c,d,e,f) (p)->CheckDeviceFormat(a,b,c,d,e,f) +#define IDirect3D9_CheckDeviceMultiSampleType(p,a,b,c,d,e,f) (p)->CheckDeviceMultiSampleType(a,b,c,d,e,f) +#define IDirect3D9_CheckDepthStencilMatch(p,a,b,c,d,e) (p)->CheckDepthStencilMatch(a,b,c,d,e) +#define IDirect3D9_CheckDeviceFormatConversion(p,a,b,c,d) (p)->CheckDeviceFormatConversion(a,b,c,d) +#define IDirect3D9_GetDeviceCaps(p,a,b,c) (p)->GetDeviceCaps(a,b,c) +#define IDirect3D9_GetAdapterMonitor(p,a) (p)->GetAdapterMonitor(a) +#define IDirect3D9_CreateDevice(p,a,b,c,d,e,f) (p)->CreateDevice(a,b,c,d,e,f) +#endif + + + + + + + +/* SwapChain */ + + + + + + + + + + + + + + + +#undef INTERFACE +#define INTERFACE IDirect3DDevice9 + +DECLARE_INTERFACE_(IDirect3DDevice9, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DDevice9 methods ***/ + STDMETHOD(TestCooperativeLevel)(THIS) PURE; + STDMETHOD_(UINT, GetAvailableTextureMem)(THIS) PURE; + STDMETHOD(EvictManagedResources)(THIS) PURE; + STDMETHOD(GetDirect3D)(THIS_ IDirect3D9** ppD3D9) PURE; + STDMETHOD(GetDeviceCaps)(THIS_ D3DCAPS9* pCaps) PURE; + STDMETHOD(GetDisplayMode)(THIS_ UINT iSwapChain,D3DDISPLAYMODE* pMode) PURE; + STDMETHOD(GetCreationParameters)(THIS_ D3DDEVICE_CREATION_PARAMETERS *pParameters) PURE; + STDMETHOD(SetCursorProperties)(THIS_ UINT XHotSpot,UINT YHotSpot,IDirect3DSurface9* pCursorBitmap) PURE; + STDMETHOD_(void, SetCursorPosition)(THIS_ int X,int Y,DWORD Flags) PURE; + STDMETHOD_(BOOL, ShowCursor)(THIS_ BOOL bShow) PURE; + STDMETHOD(CreateAdditionalSwapChain)(THIS_ D3DPRESENT_PARAMETERS* pPresentationParameters,IDirect3DSwapChain9** pSwapChain) PURE; + STDMETHOD(GetSwapChain)(THIS_ UINT iSwapChain,IDirect3DSwapChain9** pSwapChain) PURE; + STDMETHOD_(UINT, GetNumberOfSwapChains)(THIS) PURE; + STDMETHOD(Reset)(THIS_ D3DPRESENT_PARAMETERS* pPresentationParameters) PURE; + STDMETHOD(Present)(THIS_ CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion) PURE; + STDMETHOD(GetBackBuffer)(THIS_ UINT iSwapChain,UINT iBackBuffer,D3DBACKBUFFER_TYPE Type,IDirect3DSurface9** ppBackBuffer) PURE; + STDMETHOD(GetRasterStatus)(THIS_ UINT iSwapChain,D3DRASTER_STATUS* pRasterStatus) PURE; + STDMETHOD(SetDialogBoxMode)(THIS_ BOOL bEnableDialogs) PURE; + STDMETHOD_(void, SetGammaRamp)(THIS_ UINT iSwapChain,DWORD Flags,CONST D3DGAMMARAMP* pRamp) PURE; + STDMETHOD_(void, GetGammaRamp)(THIS_ UINT iSwapChain,D3DGAMMARAMP* pRamp) PURE; + STDMETHOD(CreateTexture)(THIS_ UINT Width,UINT Height,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DTexture9** ppTexture,HANDLE* pSharedHandle) PURE; + STDMETHOD(CreateVolumeTexture)(THIS_ UINT Width,UINT Height,UINT Depth,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DVolumeTexture9** ppVolumeTexture,HANDLE* pSharedHandle) PURE; + STDMETHOD(CreateCubeTexture)(THIS_ UINT EdgeLength,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DCubeTexture9** ppCubeTexture,HANDLE* pSharedHandle) PURE; + STDMETHOD(CreateVertexBuffer)(THIS_ UINT Length,DWORD Usage,DWORD FVF,D3DPOOL Pool,IDirect3DVertexBuffer9** ppVertexBuffer,HANDLE* pSharedHandle) PURE; + STDMETHOD(CreateIndexBuffer)(THIS_ UINT Length,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DIndexBuffer9** ppIndexBuffer,HANDLE* pSharedHandle) PURE; + STDMETHOD(CreateRenderTarget)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,DWORD MultisampleQuality,BOOL Lockable,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle) PURE; + STDMETHOD(CreateDepthStencilSurface)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,DWORD MultisampleQuality,BOOL Discard,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle) PURE; + STDMETHOD(UpdateSurface)(THIS_ IDirect3DSurface9* pSourceSurface,CONST RECT* pSourceRect,IDirect3DSurface9* pDestinationSurface,CONST POINT* pDestPoint) PURE; + STDMETHOD(UpdateTexture)(THIS_ IDirect3DBaseTexture9* pSourceTexture,IDirect3DBaseTexture9* pDestinationTexture) PURE; + STDMETHOD(GetRenderTargetData)(THIS_ IDirect3DSurface9* pRenderTarget,IDirect3DSurface9* pDestSurface) PURE; + STDMETHOD(GetFrontBufferData)(THIS_ UINT iSwapChain,IDirect3DSurface9* pDestSurface) PURE; + STDMETHOD(StretchRect)(THIS_ IDirect3DSurface9* pSourceSurface,CONST RECT* pSourceRect,IDirect3DSurface9* pDestSurface,CONST RECT* pDestRect,D3DTEXTUREFILTERTYPE Filter) PURE; + STDMETHOD(ColorFill)(THIS_ IDirect3DSurface9* pSurface,CONST RECT* pRect,D3DCOLOR color) PURE; + STDMETHOD(CreateOffscreenPlainSurface)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DPOOL Pool,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle) PURE; + STDMETHOD(SetRenderTarget)(THIS_ DWORD RenderTargetIndex,IDirect3DSurface9* pRenderTarget) PURE; + STDMETHOD(GetRenderTarget)(THIS_ DWORD RenderTargetIndex,IDirect3DSurface9** ppRenderTarget) PURE; + STDMETHOD(SetDepthStencilSurface)(THIS_ IDirect3DSurface9* pNewZStencil) PURE; + STDMETHOD(GetDepthStencilSurface)(THIS_ IDirect3DSurface9** ppZStencilSurface) PURE; + STDMETHOD(BeginScene)(THIS) PURE; + STDMETHOD(EndScene)(THIS) PURE; + STDMETHOD(Clear)(THIS_ DWORD Count,CONST D3DRECT* pRects,DWORD Flags,D3DCOLOR Color,float Z,DWORD Stencil) PURE; + STDMETHOD(SetTransform)(THIS_ D3DTRANSFORMSTATETYPE State,CONST D3DMATRIX* pMatrix) PURE; + STDMETHOD(GetTransform)(THIS_ D3DTRANSFORMSTATETYPE State,D3DMATRIX* pMatrix) PURE; + STDMETHOD(MultiplyTransform)(THIS_ D3DTRANSFORMSTATETYPE,CONST D3DMATRIX*) PURE; + STDMETHOD(SetViewport)(THIS_ CONST D3DVIEWPORT9* pViewport) PURE; + STDMETHOD(GetViewport)(THIS_ D3DVIEWPORT9* pViewport) PURE; + STDMETHOD(SetMaterial)(THIS_ CONST D3DMATERIAL9* pMaterial) PURE; + STDMETHOD(GetMaterial)(THIS_ D3DMATERIAL9* pMaterial) PURE; + STDMETHOD(SetLight)(THIS_ DWORD Index,CONST D3DLIGHT9*) PURE; + STDMETHOD(GetLight)(THIS_ DWORD Index,D3DLIGHT9*) PURE; + STDMETHOD(LightEnable)(THIS_ DWORD Index,BOOL Enable) PURE; + STDMETHOD(GetLightEnable)(THIS_ DWORD Index,BOOL* pEnable) PURE; + STDMETHOD(SetClipPlane)(THIS_ DWORD Index,CONST float* pPlane) PURE; + STDMETHOD(GetClipPlane)(THIS_ DWORD Index,float* pPlane) PURE; + STDMETHOD(SetRenderState)(THIS_ D3DRENDERSTATETYPE State,DWORD Value) PURE; + STDMETHOD(GetRenderState)(THIS_ D3DRENDERSTATETYPE State,DWORD* pValue) PURE; + STDMETHOD(CreateStateBlock)(THIS_ D3DSTATEBLOCKTYPE Type,IDirect3DStateBlock9** ppSB) PURE; + STDMETHOD(BeginStateBlock)(THIS) PURE; + STDMETHOD(EndStateBlock)(THIS_ IDirect3DStateBlock9** ppSB) PURE; + STDMETHOD(SetClipStatus)(THIS_ CONST D3DCLIPSTATUS9* pClipStatus) PURE; + STDMETHOD(GetClipStatus)(THIS_ D3DCLIPSTATUS9* pClipStatus) PURE; + STDMETHOD(GetTexture)(THIS_ DWORD Stage,IDirect3DBaseTexture9** ppTexture) PURE; + STDMETHOD(SetTexture)(THIS_ DWORD Stage,IDirect3DBaseTexture9* pTexture) PURE; + STDMETHOD(GetTextureStageState)(THIS_ DWORD Stage,D3DTEXTURESTAGESTATETYPE Type,DWORD* pValue) PURE; + STDMETHOD(SetTextureStageState)(THIS_ DWORD Stage,D3DTEXTURESTAGESTATETYPE Type,DWORD Value) PURE; + STDMETHOD(GetSamplerState)(THIS_ DWORD Sampler,D3DSAMPLERSTATETYPE Type,DWORD* pValue) PURE; + STDMETHOD(SetSamplerState)(THIS_ DWORD Sampler,D3DSAMPLERSTATETYPE Type,DWORD Value) PURE; + STDMETHOD(ValidateDevice)(THIS_ DWORD* pNumPasses) PURE; + STDMETHOD(SetPaletteEntries)(THIS_ UINT PaletteNumber,CONST PALETTEENTRY* pEntries) PURE; + STDMETHOD(GetPaletteEntries)(THIS_ UINT PaletteNumber,PALETTEENTRY* pEntries) PURE; + STDMETHOD(SetCurrentTexturePalette)(THIS_ UINT PaletteNumber) PURE; + STDMETHOD(GetCurrentTexturePalette)(THIS_ UINT *PaletteNumber) PURE; + STDMETHOD(SetScissorRect)(THIS_ CONST RECT* pRect) PURE; + STDMETHOD(GetScissorRect)(THIS_ RECT* pRect) PURE; + STDMETHOD(SetSoftwareVertexProcessing)(THIS_ BOOL bSoftware) PURE; + STDMETHOD_(BOOL, GetSoftwareVertexProcessing)(THIS) PURE; + STDMETHOD(SetNPatchMode)(THIS_ float nSegments) PURE; + STDMETHOD_(float, GetNPatchMode)(THIS) PURE; + STDMETHOD(DrawPrimitive)(THIS_ D3DPRIMITIVETYPE PrimitiveType,UINT StartVertex,UINT PrimitiveCount) PURE; + STDMETHOD(DrawIndexedPrimitive)(THIS_ D3DPRIMITIVETYPE,INT BaseVertexIndex,UINT MinVertexIndex,UINT NumVertices,UINT startIndex,UINT primCount) PURE; + STDMETHOD(DrawPrimitiveUP)(THIS_ D3DPRIMITIVETYPE PrimitiveType,UINT PrimitiveCount,CONST void* pVertexStreamZeroData,UINT VertexStreamZeroStride) PURE; + STDMETHOD(DrawIndexedPrimitiveUP)(THIS_ D3DPRIMITIVETYPE PrimitiveType,UINT MinVertexIndex,UINT NumVertices,UINT PrimitiveCount,CONST void* pIndexData,D3DFORMAT IndexDataFormat,CONST void* pVertexStreamZeroData,UINT VertexStreamZeroStride) PURE; + STDMETHOD(ProcessVertices)(THIS_ UINT SrcStartIndex,UINT DestIndex,UINT VertexCount,IDirect3DVertexBuffer9* pDestBuffer,IDirect3DVertexDeclaration9* pVertexDecl,DWORD Flags) PURE; + STDMETHOD(CreateVertexDeclaration)(THIS_ CONST D3DVERTEXELEMENT9* pVertexElements,IDirect3DVertexDeclaration9** ppDecl) PURE; + STDMETHOD(SetVertexDeclaration)(THIS_ IDirect3DVertexDeclaration9* pDecl) PURE; + STDMETHOD(GetVertexDeclaration)(THIS_ IDirect3DVertexDeclaration9** ppDecl) PURE; + STDMETHOD(SetFVF)(THIS_ DWORD FVF) PURE; + STDMETHOD(GetFVF)(THIS_ DWORD* pFVF) PURE; + STDMETHOD(CreateVertexShader)(THIS_ CONST DWORD* pFunction,IDirect3DVertexShader9** ppShader) PURE; + STDMETHOD(SetVertexShader)(THIS_ IDirect3DVertexShader9* pShader) PURE; + STDMETHOD(GetVertexShader)(THIS_ IDirect3DVertexShader9** ppShader) PURE; + STDMETHOD(SetVertexShaderConstantF)(THIS_ UINT StartRegister,CONST float* pConstantData,UINT Vector4fCount) PURE; + STDMETHOD(GetVertexShaderConstantF)(THIS_ UINT StartRegister,float* pConstantData,UINT Vector4fCount) PURE; + STDMETHOD(SetVertexShaderConstantI)(THIS_ UINT StartRegister,CONST int* pConstantData,UINT Vector4iCount) PURE; + STDMETHOD(GetVertexShaderConstantI)(THIS_ UINT StartRegister,int* pConstantData,UINT Vector4iCount) PURE; + STDMETHOD(SetVertexShaderConstantB)(THIS_ UINT StartRegister,CONST BOOL* pConstantData,UINT BoolCount) PURE; + STDMETHOD(GetVertexShaderConstantB)(THIS_ UINT StartRegister,BOOL* pConstantData,UINT BoolCount) PURE; + STDMETHOD(SetStreamSource)(THIS_ UINT StreamNumber,IDirect3DVertexBuffer9* pStreamData,UINT OffsetInBytes,UINT Stride) PURE; + STDMETHOD(GetStreamSource)(THIS_ UINT StreamNumber,IDirect3DVertexBuffer9** ppStreamData,UINT* pOffsetInBytes,UINT* pStride) PURE; + STDMETHOD(SetStreamSourceFreq)(THIS_ UINT StreamNumber,UINT Setting) PURE; + STDMETHOD(GetStreamSourceFreq)(THIS_ UINT StreamNumber,UINT* pSetting) PURE; + STDMETHOD(SetIndices)(THIS_ IDirect3DIndexBuffer9* pIndexData) PURE; + STDMETHOD(GetIndices)(THIS_ IDirect3DIndexBuffer9** ppIndexData) PURE; + STDMETHOD(CreatePixelShader)(THIS_ CONST DWORD* pFunction,IDirect3DPixelShader9** ppShader) PURE; + STDMETHOD(SetPixelShader)(THIS_ IDirect3DPixelShader9* pShader) PURE; + STDMETHOD(GetPixelShader)(THIS_ IDirect3DPixelShader9** ppShader) PURE; + STDMETHOD(SetPixelShaderConstantF)(THIS_ UINT StartRegister,CONST float* pConstantData,UINT Vector4fCount) PURE; + STDMETHOD(GetPixelShaderConstantF)(THIS_ UINT StartRegister,float* pConstantData,UINT Vector4fCount) PURE; + STDMETHOD(SetPixelShaderConstantI)(THIS_ UINT StartRegister,CONST int* pConstantData,UINT Vector4iCount) PURE; + STDMETHOD(GetPixelShaderConstantI)(THIS_ UINT StartRegister,int* pConstantData,UINT Vector4iCount) PURE; + STDMETHOD(SetPixelShaderConstantB)(THIS_ UINT StartRegister,CONST BOOL* pConstantData,UINT BoolCount) PURE; + STDMETHOD(GetPixelShaderConstantB)(THIS_ UINT StartRegister,BOOL* pConstantData,UINT BoolCount) PURE; + STDMETHOD(DrawRectPatch)(THIS_ UINT Handle,CONST float* pNumSegs,CONST D3DRECTPATCH_INFO* pRectPatchInfo) PURE; + STDMETHOD(DrawTriPatch)(THIS_ UINT Handle,CONST float* pNumSegs,CONST D3DTRIPATCH_INFO* pTriPatchInfo) PURE; + STDMETHOD(DeletePatch)(THIS_ UINT Handle) PURE; + STDMETHOD(CreateQuery)(THIS_ D3DQUERYTYPE Type,IDirect3DQuery9** ppQuery) PURE; + + #ifdef D3D_DEBUG_INFO + D3DDEVICE_CREATION_PARAMETERS CreationParameters; + D3DPRESENT_PARAMETERS PresentParameters; + D3DDISPLAYMODE DisplayMode; + D3DCAPS9 Caps; + + UINT AvailableTextureMem; + UINT SwapChains; + UINT Textures; + UINT VertexBuffers; + UINT IndexBuffers; + UINT VertexShaders; + UINT PixelShaders; + + D3DVIEWPORT9 Viewport; + D3DMATRIX ProjectionMatrix; + D3DMATRIX ViewMatrix; + D3DMATRIX WorldMatrix; + D3DMATRIX TextureMatrices[8]; + + DWORD FVF; + UINT VertexSize; + DWORD VertexShaderVersion; + DWORD PixelShaderVersion; + BOOL SoftwareVertexProcessing; + + D3DMATERIAL9 Material; + D3DLIGHT9 Lights[16]; + BOOL LightsEnabled[16]; + + D3DGAMMARAMP GammaRamp; + RECT ScissorRect; + BOOL DialogBoxMode; + #endif +}; + +typedef struct IDirect3DDevice9 *LPDIRECT3DDEVICE9, *PDIRECT3DDEVICE9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DDevice9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DDevice9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DDevice9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DDevice9_TestCooperativeLevel(p) (p)->lpVtbl->TestCooperativeLevel(p) +#define IDirect3DDevice9_GetAvailableTextureMem(p) (p)->lpVtbl->GetAvailableTextureMem(p) +#define IDirect3DDevice9_EvictManagedResources(p) (p)->lpVtbl->EvictManagedResources(p) +#define IDirect3DDevice9_GetDirect3D(p,a) (p)->lpVtbl->GetDirect3D(p,a) +#define IDirect3DDevice9_GetDeviceCaps(p,a) (p)->lpVtbl->GetDeviceCaps(p,a) +#define IDirect3DDevice9_GetDisplayMode(p,a,b) (p)->lpVtbl->GetDisplayMode(p,a,b) +#define IDirect3DDevice9_GetCreationParameters(p,a) (p)->lpVtbl->GetCreationParameters(p,a) +#define IDirect3DDevice9_SetCursorProperties(p,a,b,c) (p)->lpVtbl->SetCursorProperties(p,a,b,c) +#define IDirect3DDevice9_SetCursorPosition(p,a,b,c) (p)->lpVtbl->SetCursorPosition(p,a,b,c) +#define IDirect3DDevice9_ShowCursor(p,a) (p)->lpVtbl->ShowCursor(p,a) +#define IDirect3DDevice9_CreateAdditionalSwapChain(p,a,b) (p)->lpVtbl->CreateAdditionalSwapChain(p,a,b) +#define IDirect3DDevice9_GetSwapChain(p,a,b) (p)->lpVtbl->GetSwapChain(p,a,b) +#define IDirect3DDevice9_GetNumberOfSwapChains(p) (p)->lpVtbl->GetNumberOfSwapChains(p) +#define IDirect3DDevice9_Reset(p,a) (p)->lpVtbl->Reset(p,a) +#define IDirect3DDevice9_Present(p,a,b,c,d) (p)->lpVtbl->Present(p,a,b,c,d) +#define IDirect3DDevice9_GetBackBuffer(p,a,b,c,d) (p)->lpVtbl->GetBackBuffer(p,a,b,c,d) +#define IDirect3DDevice9_GetRasterStatus(p,a,b) (p)->lpVtbl->GetRasterStatus(p,a,b) +#define IDirect3DDevice9_SetDialogBoxMode(p,a) (p)->lpVtbl->SetDialogBoxMode(p,a) +#define IDirect3DDevice9_SetGammaRamp(p,a,b,c) (p)->lpVtbl->SetGammaRamp(p,a,b,c) +#define IDirect3DDevice9_GetGammaRamp(p,a,b) (p)->lpVtbl->GetGammaRamp(p,a,b) +#define IDirect3DDevice9_CreateTexture(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->CreateTexture(p,a,b,c,d,e,f,g,h) +#define IDirect3DDevice9_CreateVolumeTexture(p,a,b,c,d,e,f,g,h,i) (p)->lpVtbl->CreateVolumeTexture(p,a,b,c,d,e,f,g,h,i) +#define IDirect3DDevice9_CreateCubeTexture(p,a,b,c,d,e,f,g) (p)->lpVtbl->CreateCubeTexture(p,a,b,c,d,e,f,g) +#define IDirect3DDevice9_CreateVertexBuffer(p,a,b,c,d,e,f) (p)->lpVtbl->CreateVertexBuffer(p,a,b,c,d,e,f) +#define IDirect3DDevice9_CreateIndexBuffer(p,a,b,c,d,e,f) (p)->lpVtbl->CreateIndexBuffer(p,a,b,c,d,e,f) +#define IDirect3DDevice9_CreateRenderTarget(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->CreateRenderTarget(p,a,b,c,d,e,f,g,h) +#define IDirect3DDevice9_CreateDepthStencilSurface(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->CreateDepthStencilSurface(p,a,b,c,d,e,f,g,h) +#define IDirect3DDevice9_UpdateSurface(p,a,b,c,d) (p)->lpVtbl->UpdateSurface(p,a,b,c,d) +#define IDirect3DDevice9_UpdateTexture(p,a,b) (p)->lpVtbl->UpdateTexture(p,a,b) +#define IDirect3DDevice9_GetRenderTargetData(p,a,b) (p)->lpVtbl->GetRenderTargetData(p,a,b) +#define IDirect3DDevice9_GetFrontBufferData(p,a,b) (p)->lpVtbl->GetFrontBufferData(p,a,b) +#define IDirect3DDevice9_StretchRect(p,a,b,c,d,e) (p)->lpVtbl->StretchRect(p,a,b,c,d,e) +#define IDirect3DDevice9_ColorFill(p,a,b,c) (p)->lpVtbl->ColorFill(p,a,b,c) +#define IDirect3DDevice9_CreateOffscreenPlainSurface(p,a,b,c,d,e,f) (p)->lpVtbl->CreateOffscreenPlainSurface(p,a,b,c,d,e,f) +#define IDirect3DDevice9_SetRenderTarget(p,a,b) (p)->lpVtbl->SetRenderTarget(p,a,b) +#define IDirect3DDevice9_GetRenderTarget(p,a,b) (p)->lpVtbl->GetRenderTarget(p,a,b) +#define IDirect3DDevice9_SetDepthStencilSurface(p,a) (p)->lpVtbl->SetDepthStencilSurface(p,a) +#define IDirect3DDevice9_GetDepthStencilSurface(p,a) (p)->lpVtbl->GetDepthStencilSurface(p,a) +#define IDirect3DDevice9_BeginScene(p) (p)->lpVtbl->BeginScene(p) +#define IDirect3DDevice9_EndScene(p) (p)->lpVtbl->EndScene(p) +#define IDirect3DDevice9_Clear(p,a,b,c,d,e,f) (p)->lpVtbl->Clear(p,a,b,c,d,e,f) +#define IDirect3DDevice9_SetTransform(p,a,b) (p)->lpVtbl->SetTransform(p,a,b) +#define IDirect3DDevice9_GetTransform(p,a,b) (p)->lpVtbl->GetTransform(p,a,b) +#define IDirect3DDevice9_MultiplyTransform(p,a,b) (p)->lpVtbl->MultiplyTransform(p,a,b) +#define IDirect3DDevice9_SetViewport(p,a) (p)->lpVtbl->SetViewport(p,a) +#define IDirect3DDevice9_GetViewport(p,a) (p)->lpVtbl->GetViewport(p,a) +#define IDirect3DDevice9_SetMaterial(p,a) (p)->lpVtbl->SetMaterial(p,a) +#define IDirect3DDevice9_GetMaterial(p,a) (p)->lpVtbl->GetMaterial(p,a) +#define IDirect3DDevice9_SetLight(p,a,b) (p)->lpVtbl->SetLight(p,a,b) +#define IDirect3DDevice9_GetLight(p,a,b) (p)->lpVtbl->GetLight(p,a,b) +#define IDirect3DDevice9_LightEnable(p,a,b) (p)->lpVtbl->LightEnable(p,a,b) +#define IDirect3DDevice9_GetLightEnable(p,a,b) (p)->lpVtbl->GetLightEnable(p,a,b) +#define IDirect3DDevice9_SetClipPlane(p,a,b) (p)->lpVtbl->SetClipPlane(p,a,b) +#define IDirect3DDevice9_GetClipPlane(p,a,b) (p)->lpVtbl->GetClipPlane(p,a,b) +#define IDirect3DDevice9_SetRenderState(p,a,b) (p)->lpVtbl->SetRenderState(p,a,b) +#define IDirect3DDevice9_GetRenderState(p,a,b) (p)->lpVtbl->GetRenderState(p,a,b) +#define IDirect3DDevice9_CreateStateBlock(p,a,b) (p)->lpVtbl->CreateStateBlock(p,a,b) +#define IDirect3DDevice9_BeginStateBlock(p) (p)->lpVtbl->BeginStateBlock(p) +#define IDirect3DDevice9_EndStateBlock(p,a) (p)->lpVtbl->EndStateBlock(p,a) +#define IDirect3DDevice9_SetClipStatus(p,a) (p)->lpVtbl->SetClipStatus(p,a) +#define IDirect3DDevice9_GetClipStatus(p,a) (p)->lpVtbl->GetClipStatus(p,a) +#define IDirect3DDevice9_GetTexture(p,a,b) (p)->lpVtbl->GetTexture(p,a,b) +#define IDirect3DDevice9_SetTexture(p,a,b) (p)->lpVtbl->SetTexture(p,a,b) +#define IDirect3DDevice9_GetTextureStageState(p,a,b,c) (p)->lpVtbl->GetTextureStageState(p,a,b,c) +#define IDirect3DDevice9_SetTextureStageState(p,a,b,c) (p)->lpVtbl->SetTextureStageState(p,a,b,c) +#define IDirect3DDevice9_GetSamplerState(p,a,b,c) (p)->lpVtbl->GetSamplerState(p,a,b,c) +#define IDirect3DDevice9_SetSamplerState(p,a,b,c) (p)->lpVtbl->SetSamplerState(p,a,b,c) +#define IDirect3DDevice9_ValidateDevice(p,a) (p)->lpVtbl->ValidateDevice(p,a) +#define IDirect3DDevice9_SetPaletteEntries(p,a,b) (p)->lpVtbl->SetPaletteEntries(p,a,b) +#define IDirect3DDevice9_GetPaletteEntries(p,a,b) (p)->lpVtbl->GetPaletteEntries(p,a,b) +#define IDirect3DDevice9_SetCurrentTexturePalette(p,a) (p)->lpVtbl->SetCurrentTexturePalette(p,a) +#define IDirect3DDevice9_GetCurrentTexturePalette(p,a) (p)->lpVtbl->GetCurrentTexturePalette(p,a) +#define IDirect3DDevice9_SetScissorRect(p,a) (p)->lpVtbl->SetScissorRect(p,a) +#define IDirect3DDevice9_GetScissorRect(p,a) (p)->lpVtbl->GetScissorRect(p,a) +#define IDirect3DDevice9_SetSoftwareVertexProcessing(p,a) (p)->lpVtbl->SetSoftwareVertexProcessing(p,a) +#define IDirect3DDevice9_GetSoftwareVertexProcessing(p) (p)->lpVtbl->GetSoftwareVertexProcessing(p) +#define IDirect3DDevice9_SetNPatchMode(p,a) (p)->lpVtbl->SetNPatchMode(p,a) +#define IDirect3DDevice9_GetNPatchMode(p) (p)->lpVtbl->GetNPatchMode(p) +#define IDirect3DDevice9_DrawPrimitive(p,a,b,c) (p)->lpVtbl->DrawPrimitive(p,a,b,c) +#define IDirect3DDevice9_DrawIndexedPrimitive(p,a,b,c,d,e,f) (p)->lpVtbl->DrawIndexedPrimitive(p,a,b,c,d,e,f) +#define IDirect3DDevice9_DrawPrimitiveUP(p,a,b,c,d) (p)->lpVtbl->DrawPrimitiveUP(p,a,b,c,d) +#define IDirect3DDevice9_DrawIndexedPrimitiveUP(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->DrawIndexedPrimitiveUP(p,a,b,c,d,e,f,g,h) +#define IDirect3DDevice9_ProcessVertices(p,a,b,c,d,e,f) (p)->lpVtbl->ProcessVertices(p,a,b,c,d,e,f) +#define IDirect3DDevice9_CreateVertexDeclaration(p,a,b) (p)->lpVtbl->CreateVertexDeclaration(p,a,b) +#define IDirect3DDevice9_SetVertexDeclaration(p,a) (p)->lpVtbl->SetVertexDeclaration(p,a) +#define IDirect3DDevice9_GetVertexDeclaration(p,a) (p)->lpVtbl->GetVertexDeclaration(p,a) +#define IDirect3DDevice9_SetFVF(p,a) (p)->lpVtbl->SetFVF(p,a) +#define IDirect3DDevice9_GetFVF(p,a) (p)->lpVtbl->GetFVF(p,a) +#define IDirect3DDevice9_CreateVertexShader(p,a,b) (p)->lpVtbl->CreateVertexShader(p,a,b) +#define IDirect3DDevice9_SetVertexShader(p,a) (p)->lpVtbl->SetVertexShader(p,a) +#define IDirect3DDevice9_GetVertexShader(p,a) (p)->lpVtbl->GetVertexShader(p,a) +#define IDirect3DDevice9_SetVertexShaderConstantF(p,a,b,c) (p)->lpVtbl->SetVertexShaderConstantF(p,a,b,c) +#define IDirect3DDevice9_GetVertexShaderConstantF(p,a,b,c) (p)->lpVtbl->GetVertexShaderConstantF(p,a,b,c) +#define IDirect3DDevice9_SetVertexShaderConstantI(p,a,b,c) (p)->lpVtbl->SetVertexShaderConstantI(p,a,b,c) +#define IDirect3DDevice9_GetVertexShaderConstantI(p,a,b,c) (p)->lpVtbl->GetVertexShaderConstantI(p,a,b,c) +#define IDirect3DDevice9_SetVertexShaderConstantB(p,a,b,c) (p)->lpVtbl->SetVertexShaderConstantB(p,a,b,c) +#define IDirect3DDevice9_GetVertexShaderConstantB(p,a,b,c) (p)->lpVtbl->GetVertexShaderConstantB(p,a,b,c) +#define IDirect3DDevice9_SetStreamSource(p,a,b,c,d) (p)->lpVtbl->SetStreamSource(p,a,b,c,d) +#define IDirect3DDevice9_GetStreamSource(p,a,b,c,d) (p)->lpVtbl->GetStreamSource(p,a,b,c,d) +#define IDirect3DDevice9_SetStreamSourceFreq(p,a,b) (p)->lpVtbl->SetStreamSourceFreq(p,a,b) +#define IDirect3DDevice9_GetStreamSourceFreq(p,a,b) (p)->lpVtbl->GetStreamSourceFreq(p,a,b) +#define IDirect3DDevice9_SetIndices(p,a) (p)->lpVtbl->SetIndices(p,a) +#define IDirect3DDevice9_GetIndices(p,a) (p)->lpVtbl->GetIndices(p,a) +#define IDirect3DDevice9_CreatePixelShader(p,a,b) (p)->lpVtbl->CreatePixelShader(p,a,b) +#define IDirect3DDevice9_SetPixelShader(p,a) (p)->lpVtbl->SetPixelShader(p,a) +#define IDirect3DDevice9_GetPixelShader(p,a) (p)->lpVtbl->GetPixelShader(p,a) +#define IDirect3DDevice9_SetPixelShaderConstantF(p,a,b,c) (p)->lpVtbl->SetPixelShaderConstantF(p,a,b,c) +#define IDirect3DDevice9_GetPixelShaderConstantF(p,a,b,c) (p)->lpVtbl->GetPixelShaderConstantF(p,a,b,c) +#define IDirect3DDevice9_SetPixelShaderConstantI(p,a,b,c) (p)->lpVtbl->SetPixelShaderConstantI(p,a,b,c) +#define IDirect3DDevice9_GetPixelShaderConstantI(p,a,b,c) (p)->lpVtbl->GetPixelShaderConstantI(p,a,b,c) +#define IDirect3DDevice9_SetPixelShaderConstantB(p,a,b,c) (p)->lpVtbl->SetPixelShaderConstantB(p,a,b,c) +#define IDirect3DDevice9_GetPixelShaderConstantB(p,a,b,c) (p)->lpVtbl->GetPixelShaderConstantB(p,a,b,c) +#define IDirect3DDevice9_DrawRectPatch(p,a,b,c) (p)->lpVtbl->DrawRectPatch(p,a,b,c) +#define IDirect3DDevice9_DrawTriPatch(p,a,b,c) (p)->lpVtbl->DrawTriPatch(p,a,b,c) +#define IDirect3DDevice9_DeletePatch(p,a) (p)->lpVtbl->DeletePatch(p,a) +#define IDirect3DDevice9_CreateQuery(p,a,b) (p)->lpVtbl->CreateQuery(p,a,b) +#else +#define IDirect3DDevice9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DDevice9_AddRef(p) (p)->AddRef() +#define IDirect3DDevice9_Release(p) (p)->Release() +#define IDirect3DDevice9_TestCooperativeLevel(p) (p)->TestCooperativeLevel() +#define IDirect3DDevice9_GetAvailableTextureMem(p) (p)->GetAvailableTextureMem() +#define IDirect3DDevice9_EvictManagedResources(p) (p)->EvictManagedResources() +#define IDirect3DDevice9_GetDirect3D(p,a) (p)->GetDirect3D(a) +#define IDirect3DDevice9_GetDeviceCaps(p,a) (p)->GetDeviceCaps(a) +#define IDirect3DDevice9_GetDisplayMode(p,a,b) (p)->GetDisplayMode(a,b) +#define IDirect3DDevice9_GetCreationParameters(p,a) (p)->GetCreationParameters(a) +#define IDirect3DDevice9_SetCursorProperties(p,a,b,c) (p)->SetCursorProperties(a,b,c) +#define IDirect3DDevice9_SetCursorPosition(p,a,b,c) (p)->SetCursorPosition(a,b,c) +#define IDirect3DDevice9_ShowCursor(p,a) (p)->ShowCursor(a) +#define IDirect3DDevice9_CreateAdditionalSwapChain(p,a,b) (p)->CreateAdditionalSwapChain(a,b) +#define IDirect3DDevice9_GetSwapChain(p,a,b) (p)->GetSwapChain(a,b) +#define IDirect3DDevice9_GetNumberOfSwapChains(p) (p)->GetNumberOfSwapChains() +#define IDirect3DDevice9_Reset(p,a) (p)->Reset(a) +#define IDirect3DDevice9_Present(p,a,b,c,d) (p)->Present(a,b,c,d) +#define IDirect3DDevice9_GetBackBuffer(p,a,b,c,d) (p)->GetBackBuffer(a,b,c,d) +#define IDirect3DDevice9_GetRasterStatus(p,a,b) (p)->GetRasterStatus(a,b) +#define IDirect3DDevice9_SetDialogBoxMode(p,a) (p)->SetDialogBoxMode(a) +#define IDirect3DDevice9_SetGammaRamp(p,a,b,c) (p)->SetGammaRamp(a,b,c) +#define IDirect3DDevice9_GetGammaRamp(p,a,b) (p)->GetGammaRamp(a,b) +#define IDirect3DDevice9_CreateTexture(p,a,b,c,d,e,f,g,h) (p)->CreateTexture(a,b,c,d,e,f,g,h) +#define IDirect3DDevice9_CreateVolumeTexture(p,a,b,c,d,e,f,g,h,i) (p)->CreateVolumeTexture(a,b,c,d,e,f,g,h,i) +#define IDirect3DDevice9_CreateCubeTexture(p,a,b,c,d,e,f,g) (p)->CreateCubeTexture(a,b,c,d,e,f,g) +#define IDirect3DDevice9_CreateVertexBuffer(p,a,b,c,d,e,f) (p)->CreateVertexBuffer(a,b,c,d,e,f) +#define IDirect3DDevice9_CreateIndexBuffer(p,a,b,c,d,e,f) (p)->CreateIndexBuffer(a,b,c,d,e,f) +#define IDirect3DDevice9_CreateRenderTarget(p,a,b,c,d,e,f,g,h) (p)->CreateRenderTarget(a,b,c,d,e,f,g,h) +#define IDirect3DDevice9_CreateDepthStencilSurface(p,a,b,c,d,e,f,g,h) (p)->CreateDepthStencilSurface(a,b,c,d,e,f,g,h) +#define IDirect3DDevice9_UpdateSurface(p,a,b,c,d) (p)->UpdateSurface(a,b,c,d) +#define IDirect3DDevice9_UpdateTexture(p,a,b) (p)->UpdateTexture(a,b) +#define IDirect3DDevice9_GetRenderTargetData(p,a,b) (p)->GetRenderTargetData(a,b) +#define IDirect3DDevice9_GetFrontBufferData(p,a,b) (p)->GetFrontBufferData(a,b) +#define IDirect3DDevice9_StretchRect(p,a,b,c,d,e) (p)->StretchRect(a,b,c,d,e) +#define IDirect3DDevice9_ColorFill(p,a,b,c) (p)->ColorFill(a,b,c) +#define IDirect3DDevice9_CreateOffscreenPlainSurface(p,a,b,c,d,e,f) (p)->CreateOffscreenPlainSurface(a,b,c,d,e,f) +#define IDirect3DDevice9_SetRenderTarget(p,a,b) (p)->SetRenderTarget(a,b) +#define IDirect3DDevice9_GetRenderTarget(p,a,b) (p)->GetRenderTarget(a,b) +#define IDirect3DDevice9_SetDepthStencilSurface(p,a) (p)->SetDepthStencilSurface(a) +#define IDirect3DDevice9_GetDepthStencilSurface(p,a) (p)->GetDepthStencilSurface(a) +#define IDirect3DDevice9_BeginScene(p) (p)->BeginScene() +#define IDirect3DDevice9_EndScene(p) (p)->EndScene() +#define IDirect3DDevice9_Clear(p,a,b,c,d,e,f) (p)->Clear(a,b,c,d,e,f) +#define IDirect3DDevice9_SetTransform(p,a,b) (p)->SetTransform(a,b) +#define IDirect3DDevice9_GetTransform(p,a,b) (p)->GetTransform(a,b) +#define IDirect3DDevice9_MultiplyTransform(p,a,b) (p)->MultiplyTransform(a,b) +#define IDirect3DDevice9_SetViewport(p,a) (p)->SetViewport(a) +#define IDirect3DDevice9_GetViewport(p,a) (p)->GetViewport(a) +#define IDirect3DDevice9_SetMaterial(p,a) (p)->SetMaterial(a) +#define IDirect3DDevice9_GetMaterial(p,a) (p)->GetMaterial(a) +#define IDirect3DDevice9_SetLight(p,a,b) (p)->SetLight(a,b) +#define IDirect3DDevice9_GetLight(p,a,b) (p)->GetLight(a,b) +#define IDirect3DDevice9_LightEnable(p,a,b) (p)->LightEnable(a,b) +#define IDirect3DDevice9_GetLightEnable(p,a,b) (p)->GetLightEnable(a,b) +#define IDirect3DDevice9_SetClipPlane(p,a,b) (p)->SetClipPlane(a,b) +#define IDirect3DDevice9_GetClipPlane(p,a,b) (p)->GetClipPlane(a,b) +#define IDirect3DDevice9_SetRenderState(p,a,b) (p)->SetRenderState(a,b) +#define IDirect3DDevice9_GetRenderState(p,a,b) (p)->GetRenderState(a,b) +#define IDirect3DDevice9_CreateStateBlock(p,a,b) (p)->CreateStateBlock(a,b) +#define IDirect3DDevice9_BeginStateBlock(p) (p)->BeginStateBlock() +#define IDirect3DDevice9_EndStateBlock(p,a) (p)->EndStateBlock(a) +#define IDirect3DDevice9_SetClipStatus(p,a) (p)->SetClipStatus(a) +#define IDirect3DDevice9_GetClipStatus(p,a) (p)->GetClipStatus(a) +#define IDirect3DDevice9_GetTexture(p,a,b) (p)->GetTexture(a,b) +#define IDirect3DDevice9_SetTexture(p,a,b) (p)->SetTexture(a,b) +#define IDirect3DDevice9_GetTextureStageState(p,a,b,c) (p)->GetTextureStageState(a,b,c) +#define IDirect3DDevice9_SetTextureStageState(p,a,b,c) (p)->SetTextureStageState(a,b,c) +#define IDirect3DDevice9_GetSamplerState(p,a,b,c) (p)->GetSamplerState(a,b,c) +#define IDirect3DDevice9_SetSamplerState(p,a,b,c) (p)->SetSamplerState(a,b,c) +#define IDirect3DDevice9_ValidateDevice(p,a) (p)->ValidateDevice(a) +#define IDirect3DDevice9_SetPaletteEntries(p,a,b) (p)->SetPaletteEntries(a,b) +#define IDirect3DDevice9_GetPaletteEntries(p,a,b) (p)->GetPaletteEntries(a,b) +#define IDirect3DDevice9_SetCurrentTexturePalette(p,a) (p)->SetCurrentTexturePalette(a) +#define IDirect3DDevice9_GetCurrentTexturePalette(p,a) (p)->GetCurrentTexturePalette(a) +#define IDirect3DDevice9_SetScissorRect(p,a) (p)->SetScissorRect(a) +#define IDirect3DDevice9_GetScissorRect(p,a) (p)->GetScissorRect(a) +#define IDirect3DDevice9_SetSoftwareVertexProcessing(p,a) (p)->SetSoftwareVertexProcessing(a) +#define IDirect3DDevice9_GetSoftwareVertexProcessing(p) (p)->GetSoftwareVertexProcessing() +#define IDirect3DDevice9_SetNPatchMode(p,a) (p)->SetNPatchMode(a) +#define IDirect3DDevice9_GetNPatchMode(p) (p)->GetNPatchMode() +#define IDirect3DDevice9_DrawPrimitive(p,a,b,c) (p)->DrawPrimitive(a,b,c) +#define IDirect3DDevice9_DrawIndexedPrimitive(p,a,b,c,d,e,f) (p)->DrawIndexedPrimitive(a,b,c,d,e,f) +#define IDirect3DDevice9_DrawPrimitiveUP(p,a,b,c,d) (p)->DrawPrimitiveUP(a,b,c,d) +#define IDirect3DDevice9_DrawIndexedPrimitiveUP(p,a,b,c,d,e,f,g,h) (p)->DrawIndexedPrimitiveUP(a,b,c,d,e,f,g,h) +#define IDirect3DDevice9_ProcessVertices(p,a,b,c,d,e,f) (p)->ProcessVertices(a,b,c,d,e,f) +#define IDirect3DDevice9_CreateVertexDeclaration(p,a,b) (p)->CreateVertexDeclaration(a,b) +#define IDirect3DDevice9_SetVertexDeclaration(p,a) (p)->SetVertexDeclaration(a) +#define IDirect3DDevice9_GetVertexDeclaration(p,a) (p)->GetVertexDeclaration(a) +#define IDirect3DDevice9_SetFVF(p,a) (p)->SetFVF(a) +#define IDirect3DDevice9_GetFVF(p,a) (p)->GetFVF(a) +#define IDirect3DDevice9_CreateVertexShader(p,a,b) (p)->CreateVertexShader(a,b) +#define IDirect3DDevice9_SetVertexShader(p,a) (p)->SetVertexShader(a) +#define IDirect3DDevice9_GetVertexShader(p,a) (p)->GetVertexShader(a) +#define IDirect3DDevice9_SetVertexShaderConstantF(p,a,b,c) (p)->SetVertexShaderConstantF(a,b,c) +#define IDirect3DDevice9_GetVertexShaderConstantF(p,a,b,c) (p)->GetVertexShaderConstantF(a,b,c) +#define IDirect3DDevice9_SetVertexShaderConstantI(p,a,b,c) (p)->SetVertexShaderConstantI(a,b,c) +#define IDirect3DDevice9_GetVertexShaderConstantI(p,a,b,c) (p)->GetVertexShaderConstantI(a,b,c) +#define IDirect3DDevice9_SetVertexShaderConstantB(p,a,b,c) (p)->SetVertexShaderConstantB(a,b,c) +#define IDirect3DDevice9_GetVertexShaderConstantB(p,a,b,c) (p)->GetVertexShaderConstantB(a,b,c) +#define IDirect3DDevice9_SetStreamSource(p,a,b,c,d) (p)->SetStreamSource(a,b,c,d) +#define IDirect3DDevice9_GetStreamSource(p,a,b,c,d) (p)->GetStreamSource(a,b,c,d) +#define IDirect3DDevice9_SetStreamSourceFreq(p,a,b) (p)->SetStreamSourceFreq(a,b) +#define IDirect3DDevice9_GetStreamSourceFreq(p,a,b) (p)->GetStreamSourceFreq(a,b) +#define IDirect3DDevice9_SetIndices(p,a) (p)->SetIndices(a) +#define IDirect3DDevice9_GetIndices(p,a) (p)->GetIndices(a) +#define IDirect3DDevice9_CreatePixelShader(p,a,b) (p)->CreatePixelShader(a,b) +#define IDirect3DDevice9_SetPixelShader(p,a) (p)->SetPixelShader(a) +#define IDirect3DDevice9_GetPixelShader(p,a) (p)->GetPixelShader(a) +#define IDirect3DDevice9_SetPixelShaderConstantF(p,a,b,c) (p)->SetPixelShaderConstantF(a,b,c) +#define IDirect3DDevice9_GetPixelShaderConstantF(p,a,b,c) (p)->GetPixelShaderConstantF(a,b,c) +#define IDirect3DDevice9_SetPixelShaderConstantI(p,a,b,c) (p)->SetPixelShaderConstantI(a,b,c) +#define IDirect3DDevice9_GetPixelShaderConstantI(p,a,b,c) (p)->GetPixelShaderConstantI(a,b,c) +#define IDirect3DDevice9_SetPixelShaderConstantB(p,a,b,c) (p)->SetPixelShaderConstantB(a,b,c) +#define IDirect3DDevice9_GetPixelShaderConstantB(p,a,b,c) (p)->GetPixelShaderConstantB(a,b,c) +#define IDirect3DDevice9_DrawRectPatch(p,a,b,c) (p)->DrawRectPatch(a,b,c) +#define IDirect3DDevice9_DrawTriPatch(p,a,b,c) (p)->DrawTriPatch(a,b,c) +#define IDirect3DDevice9_DeletePatch(p,a) (p)->DeletePatch(a) +#define IDirect3DDevice9_CreateQuery(p,a,b) (p)->CreateQuery(a,b) +#endif + + + + + +#undef INTERFACE +#define INTERFACE IDirect3DStateBlock9 + +DECLARE_INTERFACE_(IDirect3DStateBlock9, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DStateBlock9 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD(Capture)(THIS) PURE; + STDMETHOD(Apply)(THIS) PURE; + + #ifdef D3D_DEBUG_INFO + LPCWSTR CreationCallStack; + #endif +}; + +typedef struct IDirect3DStateBlock9 *LPDIRECT3DSTATEBLOCK9, *PDIRECT3DSTATEBLOCK9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DStateBlock9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DStateBlock9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DStateBlock9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DStateBlock9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DStateBlock9_Capture(p) (p)->lpVtbl->Capture(p) +#define IDirect3DStateBlock9_Apply(p) (p)->lpVtbl->Apply(p) +#else +#define IDirect3DStateBlock9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DStateBlock9_AddRef(p) (p)->AddRef() +#define IDirect3DStateBlock9_Release(p) (p)->Release() +#define IDirect3DStateBlock9_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DStateBlock9_Capture(p) (p)->Capture() +#define IDirect3DStateBlock9_Apply(p) (p)->Apply() +#endif + + + + +#undef INTERFACE +#define INTERFACE IDirect3DSwapChain9 + +DECLARE_INTERFACE_(IDirect3DSwapChain9, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DSwapChain9 methods ***/ + STDMETHOD(Present)(THIS_ CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion,DWORD dwFlags) PURE; + STDMETHOD(GetFrontBufferData)(THIS_ IDirect3DSurface9* pDestSurface) PURE; + STDMETHOD(GetBackBuffer)(THIS_ UINT iBackBuffer,D3DBACKBUFFER_TYPE Type,IDirect3DSurface9** ppBackBuffer) PURE; + STDMETHOD(GetRasterStatus)(THIS_ D3DRASTER_STATUS* pRasterStatus) PURE; + STDMETHOD(GetDisplayMode)(THIS_ D3DDISPLAYMODE* pMode) PURE; + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD(GetPresentParameters)(THIS_ D3DPRESENT_PARAMETERS* pPresentationParameters) PURE; + + #ifdef D3D_DEBUG_INFO + D3DPRESENT_PARAMETERS PresentParameters; + D3DDISPLAYMODE DisplayMode; + LPCWSTR CreationCallStack; + #endif +}; + +typedef struct IDirect3DSwapChain9 *LPDIRECT3DSWAPCHAIN9, *PDIRECT3DSWAPCHAIN9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DSwapChain9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DSwapChain9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DSwapChain9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DSwapChain9_Present(p,a,b,c,d,e) (p)->lpVtbl->Present(p,a,b,c,d,e) +#define IDirect3DSwapChain9_GetFrontBufferData(p,a) (p)->lpVtbl->GetFrontBufferData(p,a) +#define IDirect3DSwapChain9_GetBackBuffer(p,a,b,c) (p)->lpVtbl->GetBackBuffer(p,a,b,c) +#define IDirect3DSwapChain9_GetRasterStatus(p,a) (p)->lpVtbl->GetRasterStatus(p,a) +#define IDirect3DSwapChain9_GetDisplayMode(p,a) (p)->lpVtbl->GetDisplayMode(p,a) +#define IDirect3DSwapChain9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DSwapChain9_GetPresentParameters(p,a) (p)->lpVtbl->GetPresentParameters(p,a) +#else +#define IDirect3DSwapChain9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DSwapChain9_AddRef(p) (p)->AddRef() +#define IDirect3DSwapChain9_Release(p) (p)->Release() +#define IDirect3DSwapChain9_Present(p,a,b,c,d,e) (p)->Present(a,b,c,d,e) +#define IDirect3DSwapChain9_GetFrontBufferData(p,a) (p)->GetFrontBufferData(a) +#define IDirect3DSwapChain9_GetBackBuffer(p,a,b,c) (p)->GetBackBuffer(a,b,c) +#define IDirect3DSwapChain9_GetRasterStatus(p,a) (p)->GetRasterStatus(a) +#define IDirect3DSwapChain9_GetDisplayMode(p,a) (p)->GetDisplayMode(a) +#define IDirect3DSwapChain9_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DSwapChain9_GetPresentParameters(p,a) (p)->GetPresentParameters(a) +#endif + + + +#undef INTERFACE +#define INTERFACE IDirect3DResource9 + +DECLARE_INTERFACE_(IDirect3DResource9, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DResource9 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; + STDMETHOD_(DWORD, GetPriority)(THIS) PURE; + STDMETHOD_(void, PreLoad)(THIS) PURE; + STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; +}; + +typedef struct IDirect3DResource9 *LPDIRECT3DRESOURCE9, *PDIRECT3DRESOURCE9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DResource9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DResource9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DResource9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DResource9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DResource9_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DResource9_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DResource9_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DResource9_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DResource9_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DResource9_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DResource9_GetType(p) (p)->lpVtbl->GetType(p) +#else +#define IDirect3DResource9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DResource9_AddRef(p) (p)->AddRef() +#define IDirect3DResource9_Release(p) (p)->Release() +#define IDirect3DResource9_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DResource9_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DResource9_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DResource9_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DResource9_SetPriority(p,a) (p)->SetPriority(a) +#define IDirect3DResource9_GetPriority(p) (p)->GetPriority() +#define IDirect3DResource9_PreLoad(p) (p)->PreLoad() +#define IDirect3DResource9_GetType(p) (p)->GetType() +#endif + + + + +#undef INTERFACE +#define INTERFACE IDirect3DVertexDeclaration9 + +DECLARE_INTERFACE_(IDirect3DVertexDeclaration9, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DVertexDeclaration9 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD(GetDeclaration)(THIS_ D3DVERTEXELEMENT9* pElement,UINT* pNumElements) PURE; + + #ifdef D3D_DEBUG_INFO + LPCWSTR CreationCallStack; + #endif +}; + +typedef struct IDirect3DVertexDeclaration9 *LPDIRECT3DVERTEXDECLARATION9, *PDIRECT3DVERTEXDECLARATION9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DVertexDeclaration9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DVertexDeclaration9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DVertexDeclaration9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DVertexDeclaration9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DVertexDeclaration9_GetDeclaration(p,a,b) (p)->lpVtbl->GetDeclaration(p,a,b) +#else +#define IDirect3DVertexDeclaration9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DVertexDeclaration9_AddRef(p) (p)->AddRef() +#define IDirect3DVertexDeclaration9_Release(p) (p)->Release() +#define IDirect3DVertexDeclaration9_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DVertexDeclaration9_GetDeclaration(p,a,b) (p)->GetDeclaration(a,b) +#endif + + + + +#undef INTERFACE +#define INTERFACE IDirect3DVertexShader9 + +DECLARE_INTERFACE_(IDirect3DVertexShader9, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DVertexShader9 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD(GetFunction)(THIS_ void*,UINT* pSizeOfData) PURE; + + #ifdef D3D_DEBUG_INFO + DWORD Version; + LPCWSTR CreationCallStack; + #endif +}; + +typedef struct IDirect3DVertexShader9 *LPDIRECT3DVERTEXSHADER9, *PDIRECT3DVERTEXSHADER9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DVertexShader9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DVertexShader9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DVertexShader9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DVertexShader9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DVertexShader9_GetFunction(p,a,b) (p)->lpVtbl->GetFunction(p,a,b) +#else +#define IDirect3DVertexShader9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DVertexShader9_AddRef(p) (p)->AddRef() +#define IDirect3DVertexShader9_Release(p) (p)->Release() +#define IDirect3DVertexShader9_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DVertexShader9_GetFunction(p,a,b) (p)->GetFunction(a,b) +#endif + + + + +#undef INTERFACE +#define INTERFACE IDirect3DPixelShader9 + +DECLARE_INTERFACE_(IDirect3DPixelShader9, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DPixelShader9 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD(GetFunction)(THIS_ void*,UINT* pSizeOfData) PURE; + + #ifdef D3D_DEBUG_INFO + DWORD Version; + LPCWSTR CreationCallStack; + #endif +}; + +typedef struct IDirect3DPixelShader9 *LPDIRECT3DPIXELSHADER9, *PDIRECT3DPIXELSHADER9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DPixelShader9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DPixelShader9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DPixelShader9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DPixelShader9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DPixelShader9_GetFunction(p,a,b) (p)->lpVtbl->GetFunction(p,a,b) +#else +#define IDirect3DPixelShader9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DPixelShader9_AddRef(p) (p)->AddRef() +#define IDirect3DPixelShader9_Release(p) (p)->Release() +#define IDirect3DPixelShader9_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DPixelShader9_GetFunction(p,a,b) (p)->GetFunction(a,b) +#endif + + + + +#undef INTERFACE +#define INTERFACE IDirect3DBaseTexture9 + +DECLARE_INTERFACE_(IDirect3DBaseTexture9, IDirect3DResource9) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DResource9 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; + STDMETHOD_(DWORD, GetPriority)(THIS) PURE; + STDMETHOD_(void, PreLoad)(THIS) PURE; + STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; + STDMETHOD_(DWORD, SetLOD)(THIS_ DWORD LODNew) PURE; + STDMETHOD_(DWORD, GetLOD)(THIS) PURE; + STDMETHOD_(DWORD, GetLevelCount)(THIS) PURE; + STDMETHOD(SetAutoGenFilterType)(THIS_ D3DTEXTUREFILTERTYPE FilterType) PURE; + STDMETHOD_(D3DTEXTUREFILTERTYPE, GetAutoGenFilterType)(THIS) PURE; + STDMETHOD_(void, GenerateMipSubLevels)(THIS) PURE; +}; + +typedef struct IDirect3DBaseTexture9 *LPDIRECT3DBASETEXTURE9, *PDIRECT3DBASETEXTURE9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DBaseTexture9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DBaseTexture9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DBaseTexture9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DBaseTexture9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DBaseTexture9_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DBaseTexture9_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DBaseTexture9_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DBaseTexture9_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DBaseTexture9_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DBaseTexture9_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DBaseTexture9_GetType(p) (p)->lpVtbl->GetType(p) +#define IDirect3DBaseTexture9_SetLOD(p,a) (p)->lpVtbl->SetLOD(p,a) +#define IDirect3DBaseTexture9_GetLOD(p) (p)->lpVtbl->GetLOD(p) +#define IDirect3DBaseTexture9_GetLevelCount(p) (p)->lpVtbl->GetLevelCount(p) +#define IDirect3DBaseTexture9_SetAutoGenFilterType(p,a) (p)->lpVtbl->SetAutoGenFilterType(p,a) +#define IDirect3DBaseTexture9_GetAutoGenFilterType(p) (p)->lpVtbl->GetAutoGenFilterType(p) +#define IDirect3DBaseTexture9_GenerateMipSubLevels(p) (p)->lpVtbl->GenerateMipSubLevels(p) +#else +#define IDirect3DBaseTexture9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DBaseTexture9_AddRef(p) (p)->AddRef() +#define IDirect3DBaseTexture9_Release(p) (p)->Release() +#define IDirect3DBaseTexture9_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DBaseTexture9_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DBaseTexture9_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DBaseTexture9_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DBaseTexture9_SetPriority(p,a) (p)->SetPriority(a) +#define IDirect3DBaseTexture9_GetPriority(p) (p)->GetPriority() +#define IDirect3DBaseTexture9_PreLoad(p) (p)->PreLoad() +#define IDirect3DBaseTexture9_GetType(p) (p)->GetType() +#define IDirect3DBaseTexture9_SetLOD(p,a) (p)->SetLOD(a) +#define IDirect3DBaseTexture9_GetLOD(p) (p)->GetLOD() +#define IDirect3DBaseTexture9_GetLevelCount(p) (p)->GetLevelCount() +#define IDirect3DBaseTexture9_SetAutoGenFilterType(p,a) (p)->SetAutoGenFilterType(a) +#define IDirect3DBaseTexture9_GetAutoGenFilterType(p) (p)->GetAutoGenFilterType() +#define IDirect3DBaseTexture9_GenerateMipSubLevels(p) (p)->GenerateMipSubLevels() +#endif + + + + + +#undef INTERFACE +#define INTERFACE IDirect3DTexture9 + +DECLARE_INTERFACE_(IDirect3DTexture9, IDirect3DBaseTexture9) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DBaseTexture9 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; + STDMETHOD_(DWORD, GetPriority)(THIS) PURE; + STDMETHOD_(void, PreLoad)(THIS) PURE; + STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; + STDMETHOD_(DWORD, SetLOD)(THIS_ DWORD LODNew) PURE; + STDMETHOD_(DWORD, GetLOD)(THIS) PURE; + STDMETHOD_(DWORD, GetLevelCount)(THIS) PURE; + STDMETHOD(SetAutoGenFilterType)(THIS_ D3DTEXTUREFILTERTYPE FilterType) PURE; + STDMETHOD_(D3DTEXTUREFILTERTYPE, GetAutoGenFilterType)(THIS) PURE; + STDMETHOD_(void, GenerateMipSubLevels)(THIS) PURE; + STDMETHOD(GetLevelDesc)(THIS_ UINT Level,D3DSURFACE_DESC *pDesc) PURE; + STDMETHOD(GetSurfaceLevel)(THIS_ UINT Level,IDirect3DSurface9** ppSurfaceLevel) PURE; + STDMETHOD(LockRect)(THIS_ UINT Level,D3DLOCKED_RECT* pLockedRect,CONST RECT* pRect,DWORD Flags) PURE; + STDMETHOD(UnlockRect)(THIS_ UINT Level) PURE; + STDMETHOD(AddDirtyRect)(THIS_ CONST RECT* pDirtyRect) PURE; + + #ifdef D3D_DEBUG_INFO + LPCWSTR Name; + UINT Width; + UINT Height; + UINT Levels; + DWORD Usage; + D3DFORMAT Format; + D3DPOOL Pool; + DWORD Priority; + DWORD LOD; + D3DTEXTUREFILTERTYPE FilterType; + UINT LockCount; + LPCWSTR CreationCallStack; + #endif +}; + +typedef struct IDirect3DTexture9 *LPDIRECT3DTEXTURE9, *PDIRECT3DTEXTURE9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DTexture9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DTexture9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DTexture9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DTexture9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DTexture9_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DTexture9_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DTexture9_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DTexture9_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DTexture9_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DTexture9_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DTexture9_GetType(p) (p)->lpVtbl->GetType(p) +#define IDirect3DTexture9_SetLOD(p,a) (p)->lpVtbl->SetLOD(p,a) +#define IDirect3DTexture9_GetLOD(p) (p)->lpVtbl->GetLOD(p) +#define IDirect3DTexture9_GetLevelCount(p) (p)->lpVtbl->GetLevelCount(p) +#define IDirect3DTexture9_SetAutoGenFilterType(p,a) (p)->lpVtbl->SetAutoGenFilterType(p,a) +#define IDirect3DTexture9_GetAutoGenFilterType(p) (p)->lpVtbl->GetAutoGenFilterType(p) +#define IDirect3DTexture9_GenerateMipSubLevels(p) (p)->lpVtbl->GenerateMipSubLevels(p) +#define IDirect3DTexture9_GetLevelDesc(p,a,b) (p)->lpVtbl->GetLevelDesc(p,a,b) +#define IDirect3DTexture9_GetSurfaceLevel(p,a,b) (p)->lpVtbl->GetSurfaceLevel(p,a,b) +#define IDirect3DTexture9_LockRect(p,a,b,c,d) (p)->lpVtbl->LockRect(p,a,b,c,d) +#define IDirect3DTexture9_UnlockRect(p,a) (p)->lpVtbl->UnlockRect(p,a) +#define IDirect3DTexture9_AddDirtyRect(p,a) (p)->lpVtbl->AddDirtyRect(p,a) +#else +#define IDirect3DTexture9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DTexture9_AddRef(p) (p)->AddRef() +#define IDirect3DTexture9_Release(p) (p)->Release() +#define IDirect3DTexture9_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DTexture9_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DTexture9_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DTexture9_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DTexture9_SetPriority(p,a) (p)->SetPriority(a) +#define IDirect3DTexture9_GetPriority(p) (p)->GetPriority() +#define IDirect3DTexture9_PreLoad(p) (p)->PreLoad() +#define IDirect3DTexture9_GetType(p) (p)->GetType() +#define IDirect3DTexture9_SetLOD(p,a) (p)->SetLOD(a) +#define IDirect3DTexture9_GetLOD(p) (p)->GetLOD() +#define IDirect3DTexture9_GetLevelCount(p) (p)->GetLevelCount() +#define IDirect3DTexture9_SetAutoGenFilterType(p,a) (p)->SetAutoGenFilterType(a) +#define IDirect3DTexture9_GetAutoGenFilterType(p) (p)->GetAutoGenFilterType() +#define IDirect3DTexture9_GenerateMipSubLevels(p) (p)->GenerateMipSubLevels() +#define IDirect3DTexture9_GetLevelDesc(p,a,b) (p)->GetLevelDesc(a,b) +#define IDirect3DTexture9_GetSurfaceLevel(p,a,b) (p)->GetSurfaceLevel(a,b) +#define IDirect3DTexture9_LockRect(p,a,b,c,d) (p)->LockRect(a,b,c,d) +#define IDirect3DTexture9_UnlockRect(p,a) (p)->UnlockRect(a) +#define IDirect3DTexture9_AddDirtyRect(p,a) (p)->AddDirtyRect(a) +#endif + + + + + +#undef INTERFACE +#define INTERFACE IDirect3DVolumeTexture9 + +DECLARE_INTERFACE_(IDirect3DVolumeTexture9, IDirect3DBaseTexture9) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DBaseTexture9 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; + STDMETHOD_(DWORD, GetPriority)(THIS) PURE; + STDMETHOD_(void, PreLoad)(THIS) PURE; + STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; + STDMETHOD_(DWORD, SetLOD)(THIS_ DWORD LODNew) PURE; + STDMETHOD_(DWORD, GetLOD)(THIS) PURE; + STDMETHOD_(DWORD, GetLevelCount)(THIS) PURE; + STDMETHOD(SetAutoGenFilterType)(THIS_ D3DTEXTUREFILTERTYPE FilterType) PURE; + STDMETHOD_(D3DTEXTUREFILTERTYPE, GetAutoGenFilterType)(THIS) PURE; + STDMETHOD_(void, GenerateMipSubLevels)(THIS) PURE; + STDMETHOD(GetLevelDesc)(THIS_ UINT Level,D3DVOLUME_DESC *pDesc) PURE; + STDMETHOD(GetVolumeLevel)(THIS_ UINT Level,IDirect3DVolume9** ppVolumeLevel) PURE; + STDMETHOD(LockBox)(THIS_ UINT Level,D3DLOCKED_BOX* pLockedVolume,CONST D3DBOX* pBox,DWORD Flags) PURE; + STDMETHOD(UnlockBox)(THIS_ UINT Level) PURE; + STDMETHOD(AddDirtyBox)(THIS_ CONST D3DBOX* pDirtyBox) PURE; + + #ifdef D3D_DEBUG_INFO + LPCWSTR Name; + UINT Width; + UINT Height; + UINT Depth; + UINT Levels; + DWORD Usage; + D3DFORMAT Format; + D3DPOOL Pool; + DWORD Priority; + DWORD LOD; + D3DTEXTUREFILTERTYPE FilterType; + UINT LockCount; + LPCWSTR CreationCallStack; + #endif +}; + +typedef struct IDirect3DVolumeTexture9 *LPDIRECT3DVOLUMETEXTURE9, *PDIRECT3DVOLUMETEXTURE9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DVolumeTexture9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DVolumeTexture9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DVolumeTexture9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DVolumeTexture9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DVolumeTexture9_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DVolumeTexture9_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DVolumeTexture9_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DVolumeTexture9_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DVolumeTexture9_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DVolumeTexture9_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DVolumeTexture9_GetType(p) (p)->lpVtbl->GetType(p) +#define IDirect3DVolumeTexture9_SetLOD(p,a) (p)->lpVtbl->SetLOD(p,a) +#define IDirect3DVolumeTexture9_GetLOD(p) (p)->lpVtbl->GetLOD(p) +#define IDirect3DVolumeTexture9_GetLevelCount(p) (p)->lpVtbl->GetLevelCount(p) +#define IDirect3DVolumeTexture9_SetAutoGenFilterType(p,a) (p)->lpVtbl->SetAutoGenFilterType(p,a) +#define IDirect3DVolumeTexture9_GetAutoGenFilterType(p) (p)->lpVtbl->GetAutoGenFilterType(p) +#define IDirect3DVolumeTexture9_GenerateMipSubLevels(p) (p)->lpVtbl->GenerateMipSubLevels(p) +#define IDirect3DVolumeTexture9_GetLevelDesc(p,a,b) (p)->lpVtbl->GetLevelDesc(p,a,b) +#define IDirect3DVolumeTexture9_GetVolumeLevel(p,a,b) (p)->lpVtbl->GetVolumeLevel(p,a,b) +#define IDirect3DVolumeTexture9_LockBox(p,a,b,c,d) (p)->lpVtbl->LockBox(p,a,b,c,d) +#define IDirect3DVolumeTexture9_UnlockBox(p,a) (p)->lpVtbl->UnlockBox(p,a) +#define IDirect3DVolumeTexture9_AddDirtyBox(p,a) (p)->lpVtbl->AddDirtyBox(p,a) +#else +#define IDirect3DVolumeTexture9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DVolumeTexture9_AddRef(p) (p)->AddRef() +#define IDirect3DVolumeTexture9_Release(p) (p)->Release() +#define IDirect3DVolumeTexture9_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DVolumeTexture9_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DVolumeTexture9_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DVolumeTexture9_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DVolumeTexture9_SetPriority(p,a) (p)->SetPriority(a) +#define IDirect3DVolumeTexture9_GetPriority(p) (p)->GetPriority() +#define IDirect3DVolumeTexture9_PreLoad(p) (p)->PreLoad() +#define IDirect3DVolumeTexture9_GetType(p) (p)->GetType() +#define IDirect3DVolumeTexture9_SetLOD(p,a) (p)->SetLOD(a) +#define IDirect3DVolumeTexture9_GetLOD(p) (p)->GetLOD() +#define IDirect3DVolumeTexture9_GetLevelCount(p) (p)->GetLevelCount() +#define IDirect3DVolumeTexture9_SetAutoGenFilterType(p,a) (p)->SetAutoGenFilterType(a) +#define IDirect3DVolumeTexture9_GetAutoGenFilterType(p) (p)->GetAutoGenFilterType() +#define IDirect3DVolumeTexture9_GenerateMipSubLevels(p) (p)->GenerateMipSubLevels() +#define IDirect3DVolumeTexture9_GetLevelDesc(p,a,b) (p)->GetLevelDesc(a,b) +#define IDirect3DVolumeTexture9_GetVolumeLevel(p,a,b) (p)->GetVolumeLevel(a,b) +#define IDirect3DVolumeTexture9_LockBox(p,a,b,c,d) (p)->LockBox(a,b,c,d) +#define IDirect3DVolumeTexture9_UnlockBox(p,a) (p)->UnlockBox(a) +#define IDirect3DVolumeTexture9_AddDirtyBox(p,a) (p)->AddDirtyBox(a) +#endif + + + + + +#undef INTERFACE +#define INTERFACE IDirect3DCubeTexture9 + +DECLARE_INTERFACE_(IDirect3DCubeTexture9, IDirect3DBaseTexture9) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DBaseTexture9 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; + STDMETHOD_(DWORD, GetPriority)(THIS) PURE; + STDMETHOD_(void, PreLoad)(THIS) PURE; + STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; + STDMETHOD_(DWORD, SetLOD)(THIS_ DWORD LODNew) PURE; + STDMETHOD_(DWORD, GetLOD)(THIS) PURE; + STDMETHOD_(DWORD, GetLevelCount)(THIS) PURE; + STDMETHOD(SetAutoGenFilterType)(THIS_ D3DTEXTUREFILTERTYPE FilterType) PURE; + STDMETHOD_(D3DTEXTUREFILTERTYPE, GetAutoGenFilterType)(THIS) PURE; + STDMETHOD_(void, GenerateMipSubLevels)(THIS) PURE; + STDMETHOD(GetLevelDesc)(THIS_ UINT Level,D3DSURFACE_DESC *pDesc) PURE; + STDMETHOD(GetCubeMapSurface)(THIS_ D3DCUBEMAP_FACES FaceType,UINT Level,IDirect3DSurface9** ppCubeMapSurface) PURE; + STDMETHOD(LockRect)(THIS_ D3DCUBEMAP_FACES FaceType,UINT Level,D3DLOCKED_RECT* pLockedRect,CONST RECT* pRect,DWORD Flags) PURE; + STDMETHOD(UnlockRect)(THIS_ D3DCUBEMAP_FACES FaceType,UINT Level) PURE; + STDMETHOD(AddDirtyRect)(THIS_ D3DCUBEMAP_FACES FaceType,CONST RECT* pDirtyRect) PURE; + + #ifdef D3D_DEBUG_INFO + LPCWSTR Name; + UINT Width; + UINT Height; + UINT Levels; + DWORD Usage; + D3DFORMAT Format; + D3DPOOL Pool; + DWORD Priority; + DWORD LOD; + D3DTEXTUREFILTERTYPE FilterType; + UINT LockCount; + LPCWSTR CreationCallStack; + #endif +}; + +typedef struct IDirect3DCubeTexture9 *LPDIRECT3DCUBETEXTURE9, *PDIRECT3DCUBETEXTURE9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DCubeTexture9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DCubeTexture9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DCubeTexture9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DCubeTexture9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DCubeTexture9_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DCubeTexture9_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DCubeTexture9_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DCubeTexture9_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DCubeTexture9_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DCubeTexture9_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DCubeTexture9_GetType(p) (p)->lpVtbl->GetType(p) +#define IDirect3DCubeTexture9_SetLOD(p,a) (p)->lpVtbl->SetLOD(p,a) +#define IDirect3DCubeTexture9_GetLOD(p) (p)->lpVtbl->GetLOD(p) +#define IDirect3DCubeTexture9_GetLevelCount(p) (p)->lpVtbl->GetLevelCount(p) +#define IDirect3DCubeTexture9_SetAutoGenFilterType(p,a) (p)->lpVtbl->SetAutoGenFilterType(p,a) +#define IDirect3DCubeTexture9_GetAutoGenFilterType(p) (p)->lpVtbl->GetAutoGenFilterType(p) +#define IDirect3DCubeTexture9_GenerateMipSubLevels(p) (p)->lpVtbl->GenerateMipSubLevels(p) +#define IDirect3DCubeTexture9_GetLevelDesc(p,a,b) (p)->lpVtbl->GetLevelDesc(p,a,b) +#define IDirect3DCubeTexture9_GetCubeMapSurface(p,a,b,c) (p)->lpVtbl->GetCubeMapSurface(p,a,b,c) +#define IDirect3DCubeTexture9_LockRect(p,a,b,c,d,e) (p)->lpVtbl->LockRect(p,a,b,c,d,e) +#define IDirect3DCubeTexture9_UnlockRect(p,a,b) (p)->lpVtbl->UnlockRect(p,a,b) +#define IDirect3DCubeTexture9_AddDirtyRect(p,a,b) (p)->lpVtbl->AddDirtyRect(p,a,b) +#else +#define IDirect3DCubeTexture9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DCubeTexture9_AddRef(p) (p)->AddRef() +#define IDirect3DCubeTexture9_Release(p) (p)->Release() +#define IDirect3DCubeTexture9_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DCubeTexture9_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DCubeTexture9_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DCubeTexture9_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DCubeTexture9_SetPriority(p,a) (p)->SetPriority(a) +#define IDirect3DCubeTexture9_GetPriority(p) (p)->GetPriority() +#define IDirect3DCubeTexture9_PreLoad(p) (p)->PreLoad() +#define IDirect3DCubeTexture9_GetType(p) (p)->GetType() +#define IDirect3DCubeTexture9_SetLOD(p,a) (p)->SetLOD(a) +#define IDirect3DCubeTexture9_GetLOD(p) (p)->GetLOD() +#define IDirect3DCubeTexture9_GetLevelCount(p) (p)->GetLevelCount() +#define IDirect3DCubeTexture9_SetAutoGenFilterType(p,a) (p)->SetAutoGenFilterType(a) +#define IDirect3DCubeTexture9_GetAutoGenFilterType(p) (p)->GetAutoGenFilterType() +#define IDirect3DCubeTexture9_GenerateMipSubLevels(p) (p)->GenerateMipSubLevels() +#define IDirect3DCubeTexture9_GetLevelDesc(p,a,b) (p)->GetLevelDesc(a,b) +#define IDirect3DCubeTexture9_GetCubeMapSurface(p,a,b,c) (p)->GetCubeMapSurface(a,b,c) +#define IDirect3DCubeTexture9_LockRect(p,a,b,c,d,e) (p)->LockRect(a,b,c,d,e) +#define IDirect3DCubeTexture9_UnlockRect(p,a,b) (p)->UnlockRect(a,b) +#define IDirect3DCubeTexture9_AddDirtyRect(p,a,b) (p)->AddDirtyRect(a,b) +#endif + + + + +#undef INTERFACE +#define INTERFACE IDirect3DVertexBuffer9 + +DECLARE_INTERFACE_(IDirect3DVertexBuffer9, IDirect3DResource9) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DResource9 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; + STDMETHOD_(DWORD, GetPriority)(THIS) PURE; + STDMETHOD_(void, PreLoad)(THIS) PURE; + STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; + STDMETHOD(Lock)(THIS_ UINT OffsetToLock,UINT SizeToLock,void** ppbData,DWORD Flags) PURE; + STDMETHOD(Unlock)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3DVERTEXBUFFER_DESC *pDesc) PURE; + + #ifdef D3D_DEBUG_INFO + LPCWSTR Name; + UINT Length; + DWORD Usage; + DWORD FVF; + D3DPOOL Pool; + DWORD Priority; + UINT LockCount; + LPCWSTR CreationCallStack; + #endif +}; + +typedef struct IDirect3DVertexBuffer9 *LPDIRECT3DVERTEXBUFFER9, *PDIRECT3DVERTEXBUFFER9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DVertexBuffer9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DVertexBuffer9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DVertexBuffer9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DVertexBuffer9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DVertexBuffer9_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DVertexBuffer9_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DVertexBuffer9_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DVertexBuffer9_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DVertexBuffer9_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DVertexBuffer9_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DVertexBuffer9_GetType(p) (p)->lpVtbl->GetType(p) +#define IDirect3DVertexBuffer9_Lock(p,a,b,c,d) (p)->lpVtbl->Lock(p,a,b,c,d) +#define IDirect3DVertexBuffer9_Unlock(p) (p)->lpVtbl->Unlock(p) +#define IDirect3DVertexBuffer9_GetDesc(p,a) (p)->lpVtbl->GetDesc(p,a) +#else +#define IDirect3DVertexBuffer9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DVertexBuffer9_AddRef(p) (p)->AddRef() +#define IDirect3DVertexBuffer9_Release(p) (p)->Release() +#define IDirect3DVertexBuffer9_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DVertexBuffer9_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DVertexBuffer9_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DVertexBuffer9_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DVertexBuffer9_SetPriority(p,a) (p)->SetPriority(a) +#define IDirect3DVertexBuffer9_GetPriority(p) (p)->GetPriority() +#define IDirect3DVertexBuffer9_PreLoad(p) (p)->PreLoad() +#define IDirect3DVertexBuffer9_GetType(p) (p)->GetType() +#define IDirect3DVertexBuffer9_Lock(p,a,b,c,d) (p)->Lock(a,b,c,d) +#define IDirect3DVertexBuffer9_Unlock(p) (p)->Unlock() +#define IDirect3DVertexBuffer9_GetDesc(p,a) (p)->GetDesc(a) +#endif + + + + +#undef INTERFACE +#define INTERFACE IDirect3DIndexBuffer9 + +DECLARE_INTERFACE_(IDirect3DIndexBuffer9, IDirect3DResource9) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DResource9 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; + STDMETHOD_(DWORD, GetPriority)(THIS) PURE; + STDMETHOD_(void, PreLoad)(THIS) PURE; + STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; + STDMETHOD(Lock)(THIS_ UINT OffsetToLock,UINT SizeToLock,void** ppbData,DWORD Flags) PURE; + STDMETHOD(Unlock)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3DINDEXBUFFER_DESC *pDesc) PURE; + + #ifdef D3D_DEBUG_INFO + LPCWSTR Name; + UINT Length; + DWORD Usage; + D3DFORMAT Format; + D3DPOOL Pool; + DWORD Priority; + UINT LockCount; + LPCWSTR CreationCallStack; + #endif +}; + +typedef struct IDirect3DIndexBuffer9 *LPDIRECT3DINDEXBUFFER9, *PDIRECT3DINDEXBUFFER9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DIndexBuffer9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DIndexBuffer9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DIndexBuffer9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DIndexBuffer9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DIndexBuffer9_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DIndexBuffer9_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DIndexBuffer9_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DIndexBuffer9_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DIndexBuffer9_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DIndexBuffer9_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DIndexBuffer9_GetType(p) (p)->lpVtbl->GetType(p) +#define IDirect3DIndexBuffer9_Lock(p,a,b,c,d) (p)->lpVtbl->Lock(p,a,b,c,d) +#define IDirect3DIndexBuffer9_Unlock(p) (p)->lpVtbl->Unlock(p) +#define IDirect3DIndexBuffer9_GetDesc(p,a) (p)->lpVtbl->GetDesc(p,a) +#else +#define IDirect3DIndexBuffer9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DIndexBuffer9_AddRef(p) (p)->AddRef() +#define IDirect3DIndexBuffer9_Release(p) (p)->Release() +#define IDirect3DIndexBuffer9_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DIndexBuffer9_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DIndexBuffer9_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DIndexBuffer9_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DIndexBuffer9_SetPriority(p,a) (p)->SetPriority(a) +#define IDirect3DIndexBuffer9_GetPriority(p) (p)->GetPriority() +#define IDirect3DIndexBuffer9_PreLoad(p) (p)->PreLoad() +#define IDirect3DIndexBuffer9_GetType(p) (p)->GetType() +#define IDirect3DIndexBuffer9_Lock(p,a,b,c,d) (p)->Lock(a,b,c,d) +#define IDirect3DIndexBuffer9_Unlock(p) (p)->Unlock() +#define IDirect3DIndexBuffer9_GetDesc(p,a) (p)->GetDesc(a) +#endif + + + + +#undef INTERFACE +#define INTERFACE IDirect3DSurface9 + +DECLARE_INTERFACE_(IDirect3DSurface9, IDirect3DResource9) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DResource9 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; + STDMETHOD_(DWORD, GetPriority)(THIS) PURE; + STDMETHOD_(void, PreLoad)(THIS) PURE; + STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; + STDMETHOD(GetContainer)(THIS_ REFIID riid,void** ppContainer) PURE; + STDMETHOD(GetDesc)(THIS_ D3DSURFACE_DESC *pDesc) PURE; + STDMETHOD(LockRect)(THIS_ D3DLOCKED_RECT* pLockedRect,CONST RECT* pRect,DWORD Flags) PURE; + STDMETHOD(UnlockRect)(THIS) PURE; + STDMETHOD(GetDC)(THIS_ HDC *phdc) PURE; + STDMETHOD(ReleaseDC)(THIS_ HDC hdc) PURE; + + #ifdef D3D_DEBUG_INFO + LPCWSTR Name; + UINT Width; + UINT Height; + DWORD Usage; + D3DFORMAT Format; + D3DPOOL Pool; + D3DMULTISAMPLE_TYPE MultiSampleType; + DWORD MultiSampleQuality; + DWORD Priority; + UINT LockCount; + UINT DCCount; + LPCWSTR CreationCallStack; + #endif +}; + +typedef struct IDirect3DSurface9 *LPDIRECT3DSURFACE9, *PDIRECT3DSURFACE9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DSurface9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DSurface9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DSurface9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DSurface9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DSurface9_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DSurface9_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DSurface9_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DSurface9_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DSurface9_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DSurface9_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DSurface9_GetType(p) (p)->lpVtbl->GetType(p) +#define IDirect3DSurface9_GetContainer(p,a,b) (p)->lpVtbl->GetContainer(p,a,b) +#define IDirect3DSurface9_GetDesc(p,a) (p)->lpVtbl->GetDesc(p,a) +#define IDirect3DSurface9_LockRect(p,a,b,c) (p)->lpVtbl->LockRect(p,a,b,c) +#define IDirect3DSurface9_UnlockRect(p) (p)->lpVtbl->UnlockRect(p) +#define IDirect3DSurface9_GetDC(p,a) (p)->lpVtbl->GetDC(p,a) +#define IDirect3DSurface9_ReleaseDC(p,a) (p)->lpVtbl->ReleaseDC(p,a) +#else +#define IDirect3DSurface9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DSurface9_AddRef(p) (p)->AddRef() +#define IDirect3DSurface9_Release(p) (p)->Release() +#define IDirect3DSurface9_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DSurface9_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DSurface9_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DSurface9_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DSurface9_SetPriority(p,a) (p)->SetPriority(a) +#define IDirect3DSurface9_GetPriority(p) (p)->GetPriority() +#define IDirect3DSurface9_PreLoad(p) (p)->PreLoad() +#define IDirect3DSurface9_GetType(p) (p)->GetType() +#define IDirect3DSurface9_GetContainer(p,a,b) (p)->GetContainer(a,b) +#define IDirect3DSurface9_GetDesc(p,a) (p)->GetDesc(a) +#define IDirect3DSurface9_LockRect(p,a,b,c) (p)->LockRect(a,b,c) +#define IDirect3DSurface9_UnlockRect(p) (p)->UnlockRect() +#define IDirect3DSurface9_GetDC(p,a) (p)->GetDC(a) +#define IDirect3DSurface9_ReleaseDC(p,a) (p)->ReleaseDC(a) +#endif + + + + + +#undef INTERFACE +#define INTERFACE IDirect3DVolume9 + +DECLARE_INTERFACE_(IDirect3DVolume9, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DVolume9 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD(GetContainer)(THIS_ REFIID riid,void** ppContainer) PURE; + STDMETHOD(GetDesc)(THIS_ D3DVOLUME_DESC *pDesc) PURE; + STDMETHOD(LockBox)(THIS_ D3DLOCKED_BOX * pLockedVolume,CONST D3DBOX* pBox,DWORD Flags) PURE; + STDMETHOD(UnlockBox)(THIS) PURE; + + #ifdef D3D_DEBUG_INFO + LPCWSTR Name; + UINT Width; + UINT Height; + UINT Depth; + DWORD Usage; + D3DFORMAT Format; + D3DPOOL Pool; + UINT LockCount; + LPCWSTR CreationCallStack; + #endif +}; + +typedef struct IDirect3DVolume9 *LPDIRECT3DVOLUME9, *PDIRECT3DVOLUME9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DVolume9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DVolume9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DVolume9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DVolume9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DVolume9_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DVolume9_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DVolume9_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DVolume9_GetContainer(p,a,b) (p)->lpVtbl->GetContainer(p,a,b) +#define IDirect3DVolume9_GetDesc(p,a) (p)->lpVtbl->GetDesc(p,a) +#define IDirect3DVolume9_LockBox(p,a,b,c) (p)->lpVtbl->LockBox(p,a,b,c) +#define IDirect3DVolume9_UnlockBox(p) (p)->lpVtbl->UnlockBox(p) +#else +#define IDirect3DVolume9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DVolume9_AddRef(p) (p)->AddRef() +#define IDirect3DVolume9_Release(p) (p)->Release() +#define IDirect3DVolume9_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DVolume9_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DVolume9_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DVolume9_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DVolume9_GetContainer(p,a,b) (p)->GetContainer(a,b) +#define IDirect3DVolume9_GetDesc(p,a) (p)->GetDesc(a) +#define IDirect3DVolume9_LockBox(p,a,b,c) (p)->LockBox(a,b,c) +#define IDirect3DVolume9_UnlockBox(p) (p)->UnlockBox() +#endif + + + + +#undef INTERFACE +#define INTERFACE IDirect3DQuery9 + +DECLARE_INTERFACE_(IDirect3DQuery9, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DQuery9 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD_(D3DQUERYTYPE, GetType)(THIS) PURE; + STDMETHOD_(DWORD, GetDataSize)(THIS) PURE; + STDMETHOD(Issue)(THIS_ DWORD dwIssueFlags) PURE; + STDMETHOD(GetData)(THIS_ void* pData,DWORD dwSize,DWORD dwGetDataFlags) PURE; + + #ifdef D3D_DEBUG_INFO + D3DQUERYTYPE Type; + DWORD DataSize; + LPCWSTR CreationCallStack; + #endif +}; + +typedef struct IDirect3DQuery9 *LPDIRECT3DQUERY9, *PDIRECT3DQUERY9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DQuery9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DQuery9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DQuery9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DQuery9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DQuery9_GetType(p) (p)->lpVtbl->GetType(p) +#define IDirect3DQuery9_GetDataSize(p) (p)->lpVtbl->GetDataSize(p) +#define IDirect3DQuery9_Issue(p,a) (p)->lpVtbl->Issue(p,a) +#define IDirect3DQuery9_GetData(p,a,b,c) (p)->lpVtbl->GetData(p,a,b,c) +#else +#define IDirect3DQuery9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DQuery9_AddRef(p) (p)->AddRef() +#define IDirect3DQuery9_Release(p) (p)->Release() +#define IDirect3DQuery9_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DQuery9_GetType(p) (p)->GetType() +#define IDirect3DQuery9_GetDataSize(p) (p)->GetDataSize() +#define IDirect3DQuery9_Issue(p,a) (p)->Issue(a) +#define IDirect3DQuery9_GetData(p,a,b,c) (p)->GetData(a,b,c) +#endif + + +/**************************************************************************** + * Flags for SetPrivateData method on all D3D9 interfaces + * + * The passed pointer is an IUnknown ptr. The SizeOfData argument to SetPrivateData + * must be set to sizeof(IUnknown*). Direct3D will call AddRef through this + * pointer and Release when the private data is destroyed. The data will be + * destroyed when another SetPrivateData with the same GUID is set, when + * FreePrivateData is called, or when the D3D9 object is freed. + ****************************************************************************/ +#define D3DSPD_IUNKNOWN 0x00000001L + +/**************************************************************************** + * + * Flags for IDirect3D9::CreateDevice's BehaviorFlags + * + ****************************************************************************/ + +#define D3DCREATE_FPU_PRESERVE 0x00000002L +#define D3DCREATE_MULTITHREADED 0x00000004L + +#define D3DCREATE_PUREDEVICE 0x00000010L +#define D3DCREATE_SOFTWARE_VERTEXPROCESSING 0x00000020L +#define D3DCREATE_HARDWARE_VERTEXPROCESSING 0x00000040L +#define D3DCREATE_MIXED_VERTEXPROCESSING 0x00000080L + +#define D3DCREATE_DISABLE_DRIVER_MANAGEMENT 0x00000100L +#define D3DCREATE_ADAPTERGROUP_DEVICE 0x00000200L +#define D3DCREATE_DISABLE_DRIVER_MANAGEMENT_EX 0x00000400L + +// This flag causes the D3D runtime not to alter the focus +// window in any way. Use with caution- the burden of supporting +// focus management events (alt-tab, etc.) falls on the +// application, and appropriate responses (switching display +// mode, etc.) should be coded. +#define D3DCREATE_NOWINDOWCHANGES 0x00000800L + +/* D3D9Ex only -- */ +#if !defined(D3D_DISABLE_9EX) + +// Disable multithreading for software vertex processing +#define D3DCREATE_DISABLE_PSGP_THREADING 0x00002000L +// This flag enables present statistics on device. +#define D3DCREATE_ENABLE_PRESENTSTATS 0x00004000L +// This flag disables printscreen support in the runtime for this device +#define D3DCREATE_DISABLE_PRINTSCREEN 0x00008000L + +#define D3DCREATE_SCREENSAVER 0x10000000L + + +#endif // !D3D_DISABLE_9EX +/* -- D3D9Ex only */ + + + +/**************************************************************************** + * + * Parameter for IDirect3D9::CreateDevice's Adapter argument + * + ****************************************************************************/ + +#define D3DADAPTER_DEFAULT 0 + +/**************************************************************************** + * + * Flags for IDirect3D9::EnumAdapters + * + ****************************************************************************/ + +/* + * The D3DENUM_WHQL_LEVEL value has been retired for 9Ex and future versions, + * but it needs to be defined here for compatibility with DX9 and earlier versions. + * See the DirectX SDK for sample code on discovering driver signatures. + */ +#define D3DENUM_WHQL_LEVEL 0x00000002L + +/* D3D9Ex only -- */ +#if !defined(D3D_DISABLE_9EX) + +/* NO_DRIVERVERSION will not fill out the DriverVersion field, nor will the + DriverVersion be incorporated into the DeviceIdentifier GUID. WINNT only */ +#define D3DENUM_NO_DRIVERVERSION 0x00000004L + +#endif // !D3D_DISABLE_9EX +/* -- D3D9Ex only */ + + +/**************************************************************************** + * + * Maximum number of back-buffers supported in DX9 + * + ****************************************************************************/ + +#define D3DPRESENT_BACK_BUFFERS_MAX 3L + +/* D3D9Ex only -- */ +#if !defined(D3D_DISABLE_9EX) + +/**************************************************************************** + * + * Maximum number of back-buffers supported when apps use CreateDeviceEx + * + ****************************************************************************/ + +#define D3DPRESENT_BACK_BUFFERS_MAX_EX 30L + +#endif // !D3D_DISABLE_9EX +/* -- D3D9Ex only */ + +/**************************************************************************** + * + * Flags for IDirect3DDevice9::SetGammaRamp + * + ****************************************************************************/ + +#define D3DSGR_NO_CALIBRATION 0x00000000L +#define D3DSGR_CALIBRATE 0x00000001L + +/**************************************************************************** + * + * Flags for IDirect3DDevice9::SetCursorPosition + * + ****************************************************************************/ + +#define D3DCURSOR_IMMEDIATE_UPDATE 0x00000001L + +/**************************************************************************** + * + * Flags for IDirect3DSwapChain9::Present + * + ****************************************************************************/ + +#define D3DPRESENT_DONOTWAIT 0x00000001L +#define D3DPRESENT_LINEAR_CONTENT 0x00000002L + +/* D3D9Ex only -- */ +#if !defined(D3D_DISABLE_9EX) + +#define D3DPRESENT_DONOTFLIP 0x00000004L +#define D3DPRESENT_FLIPRESTART 0x00000008L +#define D3DPRESENT_VIDEO_RESTRICT_TO_MONITOR 0x00000010L +#define D3DPRESENT_UPDATEOVERLAYONLY 0x00000020L +#define D3DPRESENT_HIDEOVERLAY 0x00000040L +#define D3DPRESENT_UPDATECOLORKEY 0x00000080L +#define D3DPRESENT_FORCEIMMEDIATE 0x00000100L + +#endif // !D3D_DISABLE_9EX +/* -- D3D9Ex only */ + + +/**************************************************************************** + * + * Flags for DrawPrimitive/DrawIndexedPrimitive + * Also valid for Begin/BeginIndexed + * Also valid for VertexBuffer::CreateVertexBuffer + ****************************************************************************/ + + +/* + * DirectDraw error codes + */ +#define _FACD3D 0x876 +#define MAKE_D3DHRESULT( code ) MAKE_HRESULT( 1, _FACD3D, code ) +#define MAKE_D3DSTATUS( code ) MAKE_HRESULT( 0, _FACD3D, code ) + +/* + * Direct3D Errors + */ +#define D3D_OK S_OK + +#define D3DERR_WRONGTEXTUREFORMAT MAKE_D3DHRESULT(2072) +#define D3DERR_UNSUPPORTEDCOLOROPERATION MAKE_D3DHRESULT(2073) +#define D3DERR_UNSUPPORTEDCOLORARG MAKE_D3DHRESULT(2074) +#define D3DERR_UNSUPPORTEDALPHAOPERATION MAKE_D3DHRESULT(2075) +#define D3DERR_UNSUPPORTEDALPHAARG MAKE_D3DHRESULT(2076) +#define D3DERR_TOOMANYOPERATIONS MAKE_D3DHRESULT(2077) +#define D3DERR_CONFLICTINGTEXTUREFILTER MAKE_D3DHRESULT(2078) +#define D3DERR_UNSUPPORTEDFACTORVALUE MAKE_D3DHRESULT(2079) +#define D3DERR_CONFLICTINGRENDERSTATE MAKE_D3DHRESULT(2081) +#define D3DERR_UNSUPPORTEDTEXTUREFILTER MAKE_D3DHRESULT(2082) +#define D3DERR_CONFLICTINGTEXTUREPALETTE MAKE_D3DHRESULT(2086) +#define D3DERR_DRIVERINTERNALERROR MAKE_D3DHRESULT(2087) + +#define D3DERR_NOTFOUND MAKE_D3DHRESULT(2150) +#define D3DERR_MOREDATA MAKE_D3DHRESULT(2151) +#define D3DERR_DEVICELOST MAKE_D3DHRESULT(2152) +#define D3DERR_DEVICENOTRESET MAKE_D3DHRESULT(2153) +#define D3DERR_NOTAVAILABLE MAKE_D3DHRESULT(2154) +#define D3DERR_OUTOFVIDEOMEMORY MAKE_D3DHRESULT(380) +#define D3DERR_INVALIDDEVICE MAKE_D3DHRESULT(2155) +#define D3DERR_INVALIDCALL MAKE_D3DHRESULT(2156) +#define D3DERR_DRIVERINVALIDCALL MAKE_D3DHRESULT(2157) +#define D3DERR_WASSTILLDRAWING MAKE_D3DHRESULT(540) +#define D3DOK_NOAUTOGEN MAKE_D3DSTATUS(2159) + +/* D3D9Ex only -- */ +#if !defined(D3D_DISABLE_9EX) + + +#define D3DERR_DEVICEREMOVED MAKE_D3DHRESULT(2160) +#define S_NOT_RESIDENT MAKE_D3DSTATUS(2165) +#define S_RESIDENT_IN_SHARED_MEMORY MAKE_D3DSTATUS(2166) +#define S_PRESENT_MODE_CHANGED MAKE_D3DSTATUS(2167) +#define S_PRESENT_OCCLUDED MAKE_D3DSTATUS(2168) +#define D3DERR_DEVICEHUNG MAKE_D3DHRESULT(2164) +#define D3DERR_UNSUPPORTEDOVERLAY MAKE_D3DHRESULT(2171) +#define D3DERR_UNSUPPORTEDOVERLAYFORMAT MAKE_D3DHRESULT(2172) +#define D3DERR_CANNOTPROTECTCONTENT MAKE_D3DHRESULT(2173) +#define D3DERR_UNSUPPORTEDCRYPTO MAKE_D3DHRESULT(2174) +#define D3DERR_PRESENT_STATISTICS_DISJOINT MAKE_D3DHRESULT(2180) + + +/********************* +/* D3D9Ex interfaces +/*********************/ + +HRESULT WINAPI Direct3DCreate9Ex(UINT SDKVersion, IDirect3D9Ex**); + + + + +#undef INTERFACE +#define INTERFACE IDirect3D9Ex + +DECLARE_INTERFACE_(IDirect3D9Ex, IDirect3D9) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3D9 methods ***/ + STDMETHOD_(UINT, GetAdapterCount)(THIS) PURE; + STDMETHOD(GetAdapterIdentifier)(THIS_ UINT Adapter,DWORD Flags,D3DADAPTER_IDENTIFIER9* pIdentifier) PURE; + STDMETHOD_(UINT, GetAdapterModeCount)(THIS_ UINT Adapter,D3DFORMAT Format) PURE; + STDMETHOD(EnumAdapterModes)(THIS_ UINT Adapter,D3DFORMAT Format,UINT Mode,D3DDISPLAYMODE* pMode) PURE; + STDMETHOD(GetAdapterDisplayMode)(THIS_ UINT Adapter,D3DDISPLAYMODE* pMode) PURE; + STDMETHOD(CheckDeviceType)(THIS_ UINT Adapter,D3DDEVTYPE DevType,D3DFORMAT AdapterFormat,D3DFORMAT BackBufferFormat,BOOL bWindowed) PURE; + STDMETHOD(CheckDeviceFormat)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT AdapterFormat,DWORD Usage,D3DRESOURCETYPE RType,D3DFORMAT CheckFormat) PURE; + STDMETHOD(CheckDeviceMultiSampleType)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT SurfaceFormat,BOOL Windowed,D3DMULTISAMPLE_TYPE MultiSampleType,DWORD* pQualityLevels) PURE; + STDMETHOD(CheckDepthStencilMatch)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT AdapterFormat,D3DFORMAT RenderTargetFormat,D3DFORMAT DepthStencilFormat) PURE; + STDMETHOD(CheckDeviceFormatConversion)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT SourceFormat,D3DFORMAT TargetFormat) PURE; + STDMETHOD(GetDeviceCaps)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DCAPS9* pCaps) PURE; + STDMETHOD_(HMONITOR, GetAdapterMonitor)(THIS_ UINT Adapter) PURE; + STDMETHOD(CreateDevice)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,HWND hFocusWindow,DWORD BehaviorFlags,D3DPRESENT_PARAMETERS* pPresentationParameters,IDirect3DDevice9** ppReturnedDeviceInterface) PURE; + STDMETHOD_(UINT, GetAdapterModeCountEx)(THIS_ UINT Adapter,CONST D3DDISPLAYMODEFILTER* pFilter ) PURE; + STDMETHOD(EnumAdapterModesEx)(THIS_ UINT Adapter,CONST D3DDISPLAYMODEFILTER* pFilter,UINT Mode,D3DDISPLAYMODEEX* pMode) PURE; + STDMETHOD(GetAdapterDisplayModeEx)(THIS_ UINT Adapter,D3DDISPLAYMODEEX* pMode,D3DDISPLAYROTATION* pRotation) PURE; + STDMETHOD(CreateDeviceEx)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,HWND hFocusWindow,DWORD BehaviorFlags,D3DPRESENT_PARAMETERS* pPresentationParameters,D3DDISPLAYMODEEX* pFullscreenDisplayMode,IDirect3DDevice9Ex** ppReturnedDeviceInterface) PURE; + STDMETHOD(GetAdapterLUID)(THIS_ UINT Adapter,LUID * pLUID) PURE; +}; + +typedef struct IDirect3D9Ex *LPDIRECT3D9EX, *PDIRECT3D9EX; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3D9Ex_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3D9Ex_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3D9Ex_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3D9Ex_GetAdapterCount(p) (p)->lpVtbl->GetAdapterCount(p) +#define IDirect3D9Ex_GetAdapterIdentifier(p,a,b,c) (p)->lpVtbl->GetAdapterIdentifier(p,a,b,c) +#define IDirect3D9Ex_GetAdapterModeCount(p,a,b) (p)->lpVtbl->GetAdapterModeCount(p,a,b) +#define IDirect3D9Ex_EnumAdapterModes(p,a,b,c,d) (p)->lpVtbl->EnumAdapterModes(p,a,b,c,d) +#define IDirect3D9Ex_GetAdapterDisplayMode(p,a,b) (p)->lpVtbl->GetAdapterDisplayMode(p,a,b) +#define IDirect3D9Ex_CheckDeviceType(p,a,b,c,d,e) (p)->lpVtbl->CheckDeviceType(p,a,b,c,d,e) +#define IDirect3D9Ex_CheckDeviceFormat(p,a,b,c,d,e,f) (p)->lpVtbl->CheckDeviceFormat(p,a,b,c,d,e,f) +#define IDirect3D9Ex_CheckDeviceMultiSampleType(p,a,b,c,d,e,f) (p)->lpVtbl->CheckDeviceMultiSampleType(p,a,b,c,d,e,f) +#define IDirect3D9Ex_CheckDepthStencilMatch(p,a,b,c,d,e) (p)->lpVtbl->CheckDepthStencilMatch(p,a,b,c,d,e) +#define IDirect3D9Ex_CheckDeviceFormatConversion(p,a,b,c,d) (p)->lpVtbl->CheckDeviceFormatConversion(p,a,b,c,d) +#define IDirect3D9Ex_GetDeviceCaps(p,a,b,c) (p)->lpVtbl->GetDeviceCaps(p,a,b,c) +#define IDirect3D9Ex_GetAdapterMonitor(p,a) (p)->lpVtbl->GetAdapterMonitor(p,a) +#define IDirect3D9Ex_CreateDevice(p,a,b,c,d,e,f) (p)->lpVtbl->CreateDevice(p,a,b,c,d,e,f) +#define IDirect3D9Ex_GetAdapterModeCountEx(p,a,b) (p)->lpVtbl->GetAdapterModeCountEx(p,a,b) +#define IDirect3D9Ex_EnumAdapterModesEx(p,a,b,c,d) (p)->lpVtbl->EnumAdapterModesEx(p,a,b,c,d) +#define IDirect3D9Ex_GetAdapterDisplayModeEx(p,a,b,c) (p)->lpVtbl->GetAdapterDisplayModeEx(p,a,b,c) +#define IDirect3D9Ex_CreateDeviceEx(p,a,b,c,d,e,f,g) (p)->lpVtbl->CreateDeviceEx(p,a,b,c,d,e,f,g) +#define IDirect3D9Ex_GetAdapterLUID(p,a,b) (p)->lpVtbl->GetAdapterLUID(p,a,b) +#else +#define IDirect3D9Ex_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3D9Ex_AddRef(p) (p)->AddRef() +#define IDirect3D9Ex_Release(p) (p)->Release() +#define IDirect3D9Ex_GetAdapterCount(p) (p)->GetAdapterCount() +#define IDirect3D9Ex_GetAdapterIdentifier(p,a,b,c) (p)->GetAdapterIdentifier(a,b,c) +#define IDirect3D9Ex_GetAdapterModeCount(p,a,b) (p)->GetAdapterModeCount(a,b) +#define IDirect3D9Ex_EnumAdapterModes(p,a,b,c,d) (p)->EnumAdapterModes(a,b,c,d) +#define IDirect3D9Ex_GetAdapterDisplayMode(p,a,b) (p)->GetAdapterDisplayMode(a,b) +#define IDirect3D9Ex_CheckDeviceType(p,a,b,c,d,e) (p)->CheckDeviceType(a,b,c,d,e) +#define IDirect3D9Ex_CheckDeviceFormat(p,a,b,c,d,e,f) (p)->CheckDeviceFormat(a,b,c,d,e,f) +#define IDirect3D9Ex_CheckDeviceMultiSampleType(p,a,b,c,d,e,f) (p)->CheckDeviceMultiSampleType(a,b,c,d,e,f) +#define IDirect3D9Ex_CheckDepthStencilMatch(p,a,b,c,d,e) (p)->CheckDepthStencilMatch(a,b,c,d,e) +#define IDirect3D9Ex_CheckDeviceFormatConversion(p,a,b,c,d) (p)->CheckDeviceFormatConversion(a,b,c,d) +#define IDirect3D9Ex_GetDeviceCaps(p,a,b,c) (p)->GetDeviceCaps(a,b,c) +#define IDirect3D9Ex_GetAdapterMonitor(p,a) (p)->GetAdapterMonitor(a) +#define IDirect3D9Ex_CreateDevice(p,a,b,c,d,e,f) (p)->CreateDevice(a,b,c,d,e,f) +#define IDirect3D9Ex_GetAdapterModeCountEx(p,a,b) (p)->GetAdapterModeCountEx(a,b) +#define IDirect3D9Ex_EnumAdapterModesEx(p,a,b,c,d) (p)->EnumAdapterModesEx(a,b,c,d) +#define IDirect3D9Ex_GetAdapterDisplayModeEx(p,a,b,c) (p)->GetAdapterDisplayModeEx(a,b,c) +#define IDirect3D9Ex_CreateDeviceEx(p,a,b,c,d,e,f,g) (p)->CreateDeviceEx(a,b,c,d,e,f,g) +#define IDirect3D9Ex_GetAdapterLUID(p,a,b) (p)->GetAdapterLUID(a,b) +#endif + + + + + + + + + + + + + + + + + + + + + + + + +#undef INTERFACE +#define INTERFACE IDirect3DDevice9Ex + +DECLARE_INTERFACE_(IDirect3DDevice9Ex, IDirect3DDevice9) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DDevice9 methods ***/ + STDMETHOD(TestCooperativeLevel)(THIS) PURE; + STDMETHOD_(UINT, GetAvailableTextureMem)(THIS) PURE; + STDMETHOD(EvictManagedResources)(THIS) PURE; + STDMETHOD(GetDirect3D)(THIS_ IDirect3D9** ppD3D9) PURE; + STDMETHOD(GetDeviceCaps)(THIS_ D3DCAPS9* pCaps) PURE; + STDMETHOD(GetDisplayMode)(THIS_ UINT iSwapChain,D3DDISPLAYMODE* pMode) PURE; + STDMETHOD(GetCreationParameters)(THIS_ D3DDEVICE_CREATION_PARAMETERS *pParameters) PURE; + STDMETHOD(SetCursorProperties)(THIS_ UINT XHotSpot,UINT YHotSpot,IDirect3DSurface9* pCursorBitmap) PURE; + STDMETHOD_(void, SetCursorPosition)(THIS_ int X,int Y,DWORD Flags) PURE; + STDMETHOD_(BOOL, ShowCursor)(THIS_ BOOL bShow) PURE; + STDMETHOD(CreateAdditionalSwapChain)(THIS_ D3DPRESENT_PARAMETERS* pPresentationParameters,IDirect3DSwapChain9** pSwapChain) PURE; + STDMETHOD(GetSwapChain)(THIS_ UINT iSwapChain,IDirect3DSwapChain9** pSwapChain) PURE; + STDMETHOD_(UINT, GetNumberOfSwapChains)(THIS) PURE; + STDMETHOD(Reset)(THIS_ D3DPRESENT_PARAMETERS* pPresentationParameters) PURE; + STDMETHOD(Present)(THIS_ CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion) PURE; + STDMETHOD(GetBackBuffer)(THIS_ UINT iSwapChain,UINT iBackBuffer,D3DBACKBUFFER_TYPE Type,IDirect3DSurface9** ppBackBuffer) PURE; + STDMETHOD(GetRasterStatus)(THIS_ UINT iSwapChain,D3DRASTER_STATUS* pRasterStatus) PURE; + STDMETHOD(SetDialogBoxMode)(THIS_ BOOL bEnableDialogs) PURE; + STDMETHOD_(void, SetGammaRamp)(THIS_ UINT iSwapChain,DWORD Flags,CONST D3DGAMMARAMP* pRamp) PURE; + STDMETHOD_(void, GetGammaRamp)(THIS_ UINT iSwapChain,D3DGAMMARAMP* pRamp) PURE; + STDMETHOD(CreateTexture)(THIS_ UINT Width,UINT Height,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DTexture9** ppTexture,HANDLE* pSharedHandle) PURE; + STDMETHOD(CreateVolumeTexture)(THIS_ UINT Width,UINT Height,UINT Depth,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DVolumeTexture9** ppVolumeTexture,HANDLE* pSharedHandle) PURE; + STDMETHOD(CreateCubeTexture)(THIS_ UINT EdgeLength,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DCubeTexture9** ppCubeTexture,HANDLE* pSharedHandle) PURE; + STDMETHOD(CreateVertexBuffer)(THIS_ UINT Length,DWORD Usage,DWORD FVF,D3DPOOL Pool,IDirect3DVertexBuffer9** ppVertexBuffer,HANDLE* pSharedHandle) PURE; + STDMETHOD(CreateIndexBuffer)(THIS_ UINT Length,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DIndexBuffer9** ppIndexBuffer,HANDLE* pSharedHandle) PURE; + STDMETHOD(CreateRenderTarget)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,DWORD MultisampleQuality,BOOL Lockable,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle) PURE; + STDMETHOD(CreateDepthStencilSurface)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,DWORD MultisampleQuality,BOOL Discard,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle) PURE; + STDMETHOD(UpdateSurface)(THIS_ IDirect3DSurface9* pSourceSurface,CONST RECT* pSourceRect,IDirect3DSurface9* pDestinationSurface,CONST POINT* pDestPoint) PURE; + STDMETHOD(UpdateTexture)(THIS_ IDirect3DBaseTexture9* pSourceTexture,IDirect3DBaseTexture9* pDestinationTexture) PURE; + STDMETHOD(GetRenderTargetData)(THIS_ IDirect3DSurface9* pRenderTarget,IDirect3DSurface9* pDestSurface) PURE; + STDMETHOD(GetFrontBufferData)(THIS_ UINT iSwapChain,IDirect3DSurface9* pDestSurface) PURE; + STDMETHOD(StretchRect)(THIS_ IDirect3DSurface9* pSourceSurface,CONST RECT* pSourceRect,IDirect3DSurface9* pDestSurface,CONST RECT* pDestRect,D3DTEXTUREFILTERTYPE Filter) PURE; + STDMETHOD(ColorFill)(THIS_ IDirect3DSurface9* pSurface,CONST RECT* pRect,D3DCOLOR color) PURE; + STDMETHOD(CreateOffscreenPlainSurface)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DPOOL Pool,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle) PURE; + STDMETHOD(SetRenderTarget)(THIS_ DWORD RenderTargetIndex,IDirect3DSurface9* pRenderTarget) PURE; + STDMETHOD(GetRenderTarget)(THIS_ DWORD RenderTargetIndex,IDirect3DSurface9** ppRenderTarget) PURE; + STDMETHOD(SetDepthStencilSurface)(THIS_ IDirect3DSurface9* pNewZStencil) PURE; + STDMETHOD(GetDepthStencilSurface)(THIS_ IDirect3DSurface9** ppZStencilSurface) PURE; + STDMETHOD(BeginScene)(THIS) PURE; + STDMETHOD(EndScene)(THIS) PURE; + STDMETHOD(Clear)(THIS_ DWORD Count,CONST D3DRECT* pRects,DWORD Flags,D3DCOLOR Color,float Z,DWORD Stencil) PURE; + STDMETHOD(SetTransform)(THIS_ D3DTRANSFORMSTATETYPE State,CONST D3DMATRIX* pMatrix) PURE; + STDMETHOD(GetTransform)(THIS_ D3DTRANSFORMSTATETYPE State,D3DMATRIX* pMatrix) PURE; + STDMETHOD(MultiplyTransform)(THIS_ D3DTRANSFORMSTATETYPE,CONST D3DMATRIX*) PURE; + STDMETHOD(SetViewport)(THIS_ CONST D3DVIEWPORT9* pViewport) PURE; + STDMETHOD(GetViewport)(THIS_ D3DVIEWPORT9* pViewport) PURE; + STDMETHOD(SetMaterial)(THIS_ CONST D3DMATERIAL9* pMaterial) PURE; + STDMETHOD(GetMaterial)(THIS_ D3DMATERIAL9* pMaterial) PURE; + STDMETHOD(SetLight)(THIS_ DWORD Index,CONST D3DLIGHT9*) PURE; + STDMETHOD(GetLight)(THIS_ DWORD Index,D3DLIGHT9*) PURE; + STDMETHOD(LightEnable)(THIS_ DWORD Index,BOOL Enable) PURE; + STDMETHOD(GetLightEnable)(THIS_ DWORD Index,BOOL* pEnable) PURE; + STDMETHOD(SetClipPlane)(THIS_ DWORD Index,CONST float* pPlane) PURE; + STDMETHOD(GetClipPlane)(THIS_ DWORD Index,float* pPlane) PURE; + STDMETHOD(SetRenderState)(THIS_ D3DRENDERSTATETYPE State,DWORD Value) PURE; + STDMETHOD(GetRenderState)(THIS_ D3DRENDERSTATETYPE State,DWORD* pValue) PURE; + STDMETHOD(CreateStateBlock)(THIS_ D3DSTATEBLOCKTYPE Type,IDirect3DStateBlock9** ppSB) PURE; + STDMETHOD(BeginStateBlock)(THIS) PURE; + STDMETHOD(EndStateBlock)(THIS_ IDirect3DStateBlock9** ppSB) PURE; + STDMETHOD(SetClipStatus)(THIS_ CONST D3DCLIPSTATUS9* pClipStatus) PURE; + STDMETHOD(GetClipStatus)(THIS_ D3DCLIPSTATUS9* pClipStatus) PURE; + STDMETHOD(GetTexture)(THIS_ DWORD Stage,IDirect3DBaseTexture9** ppTexture) PURE; + STDMETHOD(SetTexture)(THIS_ DWORD Stage,IDirect3DBaseTexture9* pTexture) PURE; + STDMETHOD(GetTextureStageState)(THIS_ DWORD Stage,D3DTEXTURESTAGESTATETYPE Type,DWORD* pValue) PURE; + STDMETHOD(SetTextureStageState)(THIS_ DWORD Stage,D3DTEXTURESTAGESTATETYPE Type,DWORD Value) PURE; + STDMETHOD(GetSamplerState)(THIS_ DWORD Sampler,D3DSAMPLERSTATETYPE Type,DWORD* pValue) PURE; + STDMETHOD(SetSamplerState)(THIS_ DWORD Sampler,D3DSAMPLERSTATETYPE Type,DWORD Value) PURE; + STDMETHOD(ValidateDevice)(THIS_ DWORD* pNumPasses) PURE; + STDMETHOD(SetPaletteEntries)(THIS_ UINT PaletteNumber,CONST PALETTEENTRY* pEntries) PURE; + STDMETHOD(GetPaletteEntries)(THIS_ UINT PaletteNumber,PALETTEENTRY* pEntries) PURE; + STDMETHOD(SetCurrentTexturePalette)(THIS_ UINT PaletteNumber) PURE; + STDMETHOD(GetCurrentTexturePalette)(THIS_ UINT *PaletteNumber) PURE; + STDMETHOD(SetScissorRect)(THIS_ CONST RECT* pRect) PURE; + STDMETHOD(GetScissorRect)(THIS_ RECT* pRect) PURE; + STDMETHOD(SetSoftwareVertexProcessing)(THIS_ BOOL bSoftware) PURE; + STDMETHOD_(BOOL, GetSoftwareVertexProcessing)(THIS) PURE; + STDMETHOD(SetNPatchMode)(THIS_ float nSegments) PURE; + STDMETHOD_(float, GetNPatchMode)(THIS) PURE; + STDMETHOD(DrawPrimitive)(THIS_ D3DPRIMITIVETYPE PrimitiveType,UINT StartVertex,UINT PrimitiveCount) PURE; + STDMETHOD(DrawIndexedPrimitive)(THIS_ D3DPRIMITIVETYPE,INT BaseVertexIndex,UINT MinVertexIndex,UINT NumVertices,UINT startIndex,UINT primCount) PURE; + STDMETHOD(DrawPrimitiveUP)(THIS_ D3DPRIMITIVETYPE PrimitiveType,UINT PrimitiveCount,CONST void* pVertexStreamZeroData,UINT VertexStreamZeroStride) PURE; + STDMETHOD(DrawIndexedPrimitiveUP)(THIS_ D3DPRIMITIVETYPE PrimitiveType,UINT MinVertexIndex,UINT NumVertices,UINT PrimitiveCount,CONST void* pIndexData,D3DFORMAT IndexDataFormat,CONST void* pVertexStreamZeroData,UINT VertexStreamZeroStride) PURE; + STDMETHOD(ProcessVertices)(THIS_ UINT SrcStartIndex,UINT DestIndex,UINT VertexCount,IDirect3DVertexBuffer9* pDestBuffer,IDirect3DVertexDeclaration9* pVertexDecl,DWORD Flags) PURE; + STDMETHOD(CreateVertexDeclaration)(THIS_ CONST D3DVERTEXELEMENT9* pVertexElements,IDirect3DVertexDeclaration9** ppDecl) PURE; + STDMETHOD(SetVertexDeclaration)(THIS_ IDirect3DVertexDeclaration9* pDecl) PURE; + STDMETHOD(GetVertexDeclaration)(THIS_ IDirect3DVertexDeclaration9** ppDecl) PURE; + STDMETHOD(SetFVF)(THIS_ DWORD FVF) PURE; + STDMETHOD(GetFVF)(THIS_ DWORD* pFVF) PURE; + STDMETHOD(CreateVertexShader)(THIS_ CONST DWORD* pFunction,IDirect3DVertexShader9** ppShader) PURE; + STDMETHOD(SetVertexShader)(THIS_ IDirect3DVertexShader9* pShader) PURE; + STDMETHOD(GetVertexShader)(THIS_ IDirect3DVertexShader9** ppShader) PURE; + STDMETHOD(SetVertexShaderConstantF)(THIS_ UINT StartRegister,CONST float* pConstantData,UINT Vector4fCount) PURE; + STDMETHOD(GetVertexShaderConstantF)(THIS_ UINT StartRegister,float* pConstantData,UINT Vector4fCount) PURE; + STDMETHOD(SetVertexShaderConstantI)(THIS_ UINT StartRegister,CONST int* pConstantData,UINT Vector4iCount) PURE; + STDMETHOD(GetVertexShaderConstantI)(THIS_ UINT StartRegister,int* pConstantData,UINT Vector4iCount) PURE; + STDMETHOD(SetVertexShaderConstantB)(THIS_ UINT StartRegister,CONST BOOL* pConstantData,UINT BoolCount) PURE; + STDMETHOD(GetVertexShaderConstantB)(THIS_ UINT StartRegister,BOOL* pConstantData,UINT BoolCount) PURE; + STDMETHOD(SetStreamSource)(THIS_ UINT StreamNumber,IDirect3DVertexBuffer9* pStreamData,UINT OffsetInBytes,UINT Stride) PURE; + STDMETHOD(GetStreamSource)(THIS_ UINT StreamNumber,IDirect3DVertexBuffer9** ppStreamData,UINT* pOffsetInBytes,UINT* pStride) PURE; + STDMETHOD(SetStreamSourceFreq)(THIS_ UINT StreamNumber,UINT Setting) PURE; + STDMETHOD(GetStreamSourceFreq)(THIS_ UINT StreamNumber,UINT* pSetting) PURE; + STDMETHOD(SetIndices)(THIS_ IDirect3DIndexBuffer9* pIndexData) PURE; + STDMETHOD(GetIndices)(THIS_ IDirect3DIndexBuffer9** ppIndexData) PURE; + STDMETHOD(CreatePixelShader)(THIS_ CONST DWORD* pFunction,IDirect3DPixelShader9** ppShader) PURE; + STDMETHOD(SetPixelShader)(THIS_ IDirect3DPixelShader9* pShader) PURE; + STDMETHOD(GetPixelShader)(THIS_ IDirect3DPixelShader9** ppShader) PURE; + STDMETHOD(SetPixelShaderConstantF)(THIS_ UINT StartRegister,CONST float* pConstantData,UINT Vector4fCount) PURE; + STDMETHOD(GetPixelShaderConstantF)(THIS_ UINT StartRegister,float* pConstantData,UINT Vector4fCount) PURE; + STDMETHOD(SetPixelShaderConstantI)(THIS_ UINT StartRegister,CONST int* pConstantData,UINT Vector4iCount) PURE; + STDMETHOD(GetPixelShaderConstantI)(THIS_ UINT StartRegister,int* pConstantData,UINT Vector4iCount) PURE; + STDMETHOD(SetPixelShaderConstantB)(THIS_ UINT StartRegister,CONST BOOL* pConstantData,UINT BoolCount) PURE; + STDMETHOD(GetPixelShaderConstantB)(THIS_ UINT StartRegister,BOOL* pConstantData,UINT BoolCount) PURE; + STDMETHOD(DrawRectPatch)(THIS_ UINT Handle,CONST float* pNumSegs,CONST D3DRECTPATCH_INFO* pRectPatchInfo) PURE; + STDMETHOD(DrawTriPatch)(THIS_ UINT Handle,CONST float* pNumSegs,CONST D3DTRIPATCH_INFO* pTriPatchInfo) PURE; + STDMETHOD(DeletePatch)(THIS_ UINT Handle) PURE; + STDMETHOD(CreateQuery)(THIS_ D3DQUERYTYPE Type,IDirect3DQuery9** ppQuery) PURE; + STDMETHOD(SetConvolutionMonoKernel)(THIS_ UINT width,UINT height,float* rows,float* columns) PURE; + STDMETHOD(ComposeRects)(THIS_ IDirect3DSurface9* pSrc,IDirect3DSurface9* pDst,IDirect3DVertexBuffer9* pSrcRectDescs,UINT NumRects,IDirect3DVertexBuffer9* pDstRectDescs,D3DCOMPOSERECTSOP Operation,int Xoffset,int Yoffset) PURE; + STDMETHOD(PresentEx)(THIS_ CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion,DWORD dwFlags) PURE; + STDMETHOD(GetGPUThreadPriority)(THIS_ INT* pPriority) PURE; + STDMETHOD(SetGPUThreadPriority)(THIS_ INT Priority) PURE; + STDMETHOD(WaitForVBlank)(THIS_ UINT iSwapChain) PURE; + STDMETHOD(CheckResourceResidency)(THIS_ IDirect3DResource9** pResourceArray,UINT32 NumResources) PURE; + STDMETHOD(SetMaximumFrameLatency)(THIS_ UINT MaxLatency) PURE; + STDMETHOD(GetMaximumFrameLatency)(THIS_ UINT* pMaxLatency) PURE; + STDMETHOD(CheckDeviceState)(THIS_ HWND hDestinationWindow) PURE; + STDMETHOD(CreateRenderTargetEx)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,DWORD MultisampleQuality,BOOL Lockable,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle,DWORD Usage) PURE; + STDMETHOD(CreateOffscreenPlainSurfaceEx)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DPOOL Pool,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle,DWORD Usage) PURE; + STDMETHOD(CreateDepthStencilSurfaceEx)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,DWORD MultisampleQuality,BOOL Discard,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle,DWORD Usage) PURE; + STDMETHOD(ResetEx)(THIS_ D3DPRESENT_PARAMETERS* pPresentationParameters,D3DDISPLAYMODEEX *pFullscreenDisplayMode) PURE; + STDMETHOD(GetDisplayModeEx)(THIS_ UINT iSwapChain,D3DDISPLAYMODEEX* pMode,D3DDISPLAYROTATION* pRotation) PURE; +}; + +typedef struct IDirect3DDevice9Ex *LPDIRECT3DDEVICE9EX, *PDIRECT3DDEVICE9EX; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DDevice9Ex_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DDevice9Ex_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DDevice9Ex_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DDevice9Ex_TestCooperativeLevel(p) (p)->lpVtbl->TestCooperativeLevel(p) +#define IDirect3DDevice9Ex_GetAvailableTextureMem(p) (p)->lpVtbl->GetAvailableTextureMem(p) +#define IDirect3DDevice9Ex_EvictManagedResources(p) (p)->lpVtbl->EvictManagedResources(p) +#define IDirect3DDevice9Ex_GetDirect3D(p,a) (p)->lpVtbl->GetDirect3D(p,a) +#define IDirect3DDevice9Ex_GetDeviceCaps(p,a) (p)->lpVtbl->GetDeviceCaps(p,a) +#define IDirect3DDevice9Ex_GetDisplayMode(p,a,b) (p)->lpVtbl->GetDisplayMode(p,a,b) +#define IDirect3DDevice9Ex_GetCreationParameters(p,a) (p)->lpVtbl->GetCreationParameters(p,a) +#define IDirect3DDevice9Ex_SetCursorProperties(p,a,b,c) (p)->lpVtbl->SetCursorProperties(p,a,b,c) +#define IDirect3DDevice9Ex_SetCursorPosition(p,a,b,c) (p)->lpVtbl->SetCursorPosition(p,a,b,c) +#define IDirect3DDevice9Ex_ShowCursor(p,a) (p)->lpVtbl->ShowCursor(p,a) +#define IDirect3DDevice9Ex_CreateAdditionalSwapChain(p,a,b) (p)->lpVtbl->CreateAdditionalSwapChain(p,a,b) +#define IDirect3DDevice9Ex_GetSwapChain(p,a,b) (p)->lpVtbl->GetSwapChain(p,a,b) +#define IDirect3DDevice9Ex_GetNumberOfSwapChains(p) (p)->lpVtbl->GetNumberOfSwapChains(p) +#define IDirect3DDevice9Ex_Reset(p,a) (p)->lpVtbl->Reset(p,a) +#define IDirect3DDevice9Ex_Present(p,a,b,c,d) (p)->lpVtbl->Present(p,a,b,c,d) +#define IDirect3DDevice9Ex_GetBackBuffer(p,a,b,c,d) (p)->lpVtbl->GetBackBuffer(p,a,b,c,d) +#define IDirect3DDevice9Ex_GetRasterStatus(p,a,b) (p)->lpVtbl->GetRasterStatus(p,a,b) +#define IDirect3DDevice9Ex_SetDialogBoxMode(p,a) (p)->lpVtbl->SetDialogBoxMode(p,a) +#define IDirect3DDevice9Ex_SetGammaRamp(p,a,b,c) (p)->lpVtbl->SetGammaRamp(p,a,b,c) +#define IDirect3DDevice9Ex_GetGammaRamp(p,a,b) (p)->lpVtbl->GetGammaRamp(p,a,b) +#define IDirect3DDevice9Ex_CreateTexture(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->CreateTexture(p,a,b,c,d,e,f,g,h) +#define IDirect3DDevice9Ex_CreateVolumeTexture(p,a,b,c,d,e,f,g,h,i) (p)->lpVtbl->CreateVolumeTexture(p,a,b,c,d,e,f,g,h,i) +#define IDirect3DDevice9Ex_CreateCubeTexture(p,a,b,c,d,e,f,g) (p)->lpVtbl->CreateCubeTexture(p,a,b,c,d,e,f,g) +#define IDirect3DDevice9Ex_CreateVertexBuffer(p,a,b,c,d,e,f) (p)->lpVtbl->CreateVertexBuffer(p,a,b,c,d,e,f) +#define IDirect3DDevice9Ex_CreateIndexBuffer(p,a,b,c,d,e,f) (p)->lpVtbl->CreateIndexBuffer(p,a,b,c,d,e,f) +#define IDirect3DDevice9Ex_CreateRenderTarget(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->CreateRenderTarget(p,a,b,c,d,e,f,g,h) +#define IDirect3DDevice9Ex_CreateDepthStencilSurface(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->CreateDepthStencilSurface(p,a,b,c,d,e,f,g,h) +#define IDirect3DDevice9Ex_UpdateSurface(p,a,b,c,d) (p)->lpVtbl->UpdateSurface(p,a,b,c,d) +#define IDirect3DDevice9Ex_UpdateTexture(p,a,b) (p)->lpVtbl->UpdateTexture(p,a,b) +#define IDirect3DDevice9Ex_GetRenderTargetData(p,a,b) (p)->lpVtbl->GetRenderTargetData(p,a,b) +#define IDirect3DDevice9Ex_GetFrontBufferData(p,a,b) (p)->lpVtbl->GetFrontBufferData(p,a,b) +#define IDirect3DDevice9Ex_StretchRect(p,a,b,c,d,e) (p)->lpVtbl->StretchRect(p,a,b,c,d,e) +#define IDirect3DDevice9Ex_ColorFill(p,a,b,c) (p)->lpVtbl->ColorFill(p,a,b,c) +#define IDirect3DDevice9Ex_CreateOffscreenPlainSurface(p,a,b,c,d,e,f) (p)->lpVtbl->CreateOffscreenPlainSurface(p,a,b,c,d,e,f) +#define IDirect3DDevice9Ex_SetRenderTarget(p,a,b) (p)->lpVtbl->SetRenderTarget(p,a,b) +#define IDirect3DDevice9Ex_GetRenderTarget(p,a,b) (p)->lpVtbl->GetRenderTarget(p,a,b) +#define IDirect3DDevice9Ex_SetDepthStencilSurface(p,a) (p)->lpVtbl->SetDepthStencilSurface(p,a) +#define IDirect3DDevice9Ex_GetDepthStencilSurface(p,a) (p)->lpVtbl->GetDepthStencilSurface(p,a) +#define IDirect3DDevice9Ex_BeginScene(p) (p)->lpVtbl->BeginScene(p) +#define IDirect3DDevice9Ex_EndScene(p) (p)->lpVtbl->EndScene(p) +#define IDirect3DDevice9Ex_Clear(p,a,b,c,d,e,f) (p)->lpVtbl->Clear(p,a,b,c,d,e,f) +#define IDirect3DDevice9Ex_SetTransform(p,a,b) (p)->lpVtbl->SetTransform(p,a,b) +#define IDirect3DDevice9Ex_GetTransform(p,a,b) (p)->lpVtbl->GetTransform(p,a,b) +#define IDirect3DDevice9Ex_MultiplyTransform(p,a,b) (p)->lpVtbl->MultiplyTransform(p,a,b) +#define IDirect3DDevice9Ex_SetViewport(p,a) (p)->lpVtbl->SetViewport(p,a) +#define IDirect3DDevice9Ex_GetViewport(p,a) (p)->lpVtbl->GetViewport(p,a) +#define IDirect3DDevice9Ex_SetMaterial(p,a) (p)->lpVtbl->SetMaterial(p,a) +#define IDirect3DDevice9Ex_GetMaterial(p,a) (p)->lpVtbl->GetMaterial(p,a) +#define IDirect3DDevice9Ex_SetLight(p,a,b) (p)->lpVtbl->SetLight(p,a,b) +#define IDirect3DDevice9Ex_GetLight(p,a,b) (p)->lpVtbl->GetLight(p,a,b) +#define IDirect3DDevice9Ex_LightEnable(p,a,b) (p)->lpVtbl->LightEnable(p,a,b) +#define IDirect3DDevice9Ex_GetLightEnable(p,a,b) (p)->lpVtbl->GetLightEnable(p,a,b) +#define IDirect3DDevice9Ex_SetClipPlane(p,a,b) (p)->lpVtbl->SetClipPlane(p,a,b) +#define IDirect3DDevice9Ex_GetClipPlane(p,a,b) (p)->lpVtbl->GetClipPlane(p,a,b) +#define IDirect3DDevice9Ex_SetRenderState(p,a,b) (p)->lpVtbl->SetRenderState(p,a,b) +#define IDirect3DDevice9Ex_GetRenderState(p,a,b) (p)->lpVtbl->GetRenderState(p,a,b) +#define IDirect3DDevice9Ex_CreateStateBlock(p,a,b) (p)->lpVtbl->CreateStateBlock(p,a,b) +#define IDirect3DDevice9Ex_BeginStateBlock(p) (p)->lpVtbl->BeginStateBlock(p) +#define IDirect3DDevice9Ex_EndStateBlock(p,a) (p)->lpVtbl->EndStateBlock(p,a) +#define IDirect3DDevice9Ex_SetClipStatus(p,a) (p)->lpVtbl->SetClipStatus(p,a) +#define IDirect3DDevice9Ex_GetClipStatus(p,a) (p)->lpVtbl->GetClipStatus(p,a) +#define IDirect3DDevice9Ex_GetTexture(p,a,b) (p)->lpVtbl->GetTexture(p,a,b) +#define IDirect3DDevice9Ex_SetTexture(p,a,b) (p)->lpVtbl->SetTexture(p,a,b) +#define IDirect3DDevice9Ex_GetTextureStageState(p,a,b,c) (p)->lpVtbl->GetTextureStageState(p,a,b,c) +#define IDirect3DDevice9Ex_SetTextureStageState(p,a,b,c) (p)->lpVtbl->SetTextureStageState(p,a,b,c) +#define IDirect3DDevice9Ex_GetSamplerState(p,a,b,c) (p)->lpVtbl->GetSamplerState(p,a,b,c) +#define IDirect3DDevice9Ex_SetSamplerState(p,a,b,c) (p)->lpVtbl->SetSamplerState(p,a,b,c) +#define IDirect3DDevice9Ex_ValidateDevice(p,a) (p)->lpVtbl->ValidateDevice(p,a) +#define IDirect3DDevice9Ex_SetPaletteEntries(p,a,b) (p)->lpVtbl->SetPaletteEntries(p,a,b) +#define IDirect3DDevice9Ex_GetPaletteEntries(p,a,b) (p)->lpVtbl->GetPaletteEntries(p,a,b) +#define IDirect3DDevice9Ex_SetCurrentTexturePalette(p,a) (p)->lpVtbl->SetCurrentTexturePalette(p,a) +#define IDirect3DDevice9Ex_GetCurrentTexturePalette(p,a) (p)->lpVtbl->GetCurrentTexturePalette(p,a) +#define IDirect3DDevice9Ex_SetScissorRect(p,a) (p)->lpVtbl->SetScissorRect(p,a) +#define IDirect3DDevice9Ex_GetScissorRect(p,a) (p)->lpVtbl->GetScissorRect(p,a) +#define IDirect3DDevice9Ex_SetSoftwareVertexProcessing(p,a) (p)->lpVtbl->SetSoftwareVertexProcessing(p,a) +#define IDirect3DDevice9Ex_GetSoftwareVertexProcessing(p) (p)->lpVtbl->GetSoftwareVertexProcessing(p) +#define IDirect3DDevice9Ex_SetNPatchMode(p,a) (p)->lpVtbl->SetNPatchMode(p,a) +#define IDirect3DDevice9Ex_GetNPatchMode(p) (p)->lpVtbl->GetNPatchMode(p) +#define IDirect3DDevice9Ex_DrawPrimitive(p,a,b,c) (p)->lpVtbl->DrawPrimitive(p,a,b,c) +#define IDirect3DDevice9Ex_DrawIndexedPrimitive(p,a,b,c,d,e,f) (p)->lpVtbl->DrawIndexedPrimitive(p,a,b,c,d,e,f) +#define IDirect3DDevice9Ex_DrawPrimitiveUP(p,a,b,c,d) (p)->lpVtbl->DrawPrimitiveUP(p,a,b,c,d) +#define IDirect3DDevice9Ex_DrawIndexedPrimitiveUP(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->DrawIndexedPrimitiveUP(p,a,b,c,d,e,f,g,h) +#define IDirect3DDevice9Ex_ProcessVertices(p,a,b,c,d,e,f) (p)->lpVtbl->ProcessVertices(p,a,b,c,d,e,f) +#define IDirect3DDevice9Ex_CreateVertexDeclaration(p,a,b) (p)->lpVtbl->CreateVertexDeclaration(p,a,b) +#define IDirect3DDevice9Ex_SetVertexDeclaration(p,a) (p)->lpVtbl->SetVertexDeclaration(p,a) +#define IDirect3DDevice9Ex_GetVertexDeclaration(p,a) (p)->lpVtbl->GetVertexDeclaration(p,a) +#define IDirect3DDevice9Ex_SetFVF(p,a) (p)->lpVtbl->SetFVF(p,a) +#define IDirect3DDevice9Ex_GetFVF(p,a) (p)->lpVtbl->GetFVF(p,a) +#define IDirect3DDevice9Ex_CreateVertexShader(p,a,b) (p)->lpVtbl->CreateVertexShader(p,a,b) +#define IDirect3DDevice9Ex_SetVertexShader(p,a) (p)->lpVtbl->SetVertexShader(p,a) +#define IDirect3DDevice9Ex_GetVertexShader(p,a) (p)->lpVtbl->GetVertexShader(p,a) +#define IDirect3DDevice9Ex_SetVertexShaderConstantF(p,a,b,c) (p)->lpVtbl->SetVertexShaderConstantF(p,a,b,c) +#define IDirect3DDevice9Ex_GetVertexShaderConstantF(p,a,b,c) (p)->lpVtbl->GetVertexShaderConstantF(p,a,b,c) +#define IDirect3DDevice9Ex_SetVertexShaderConstantI(p,a,b,c) (p)->lpVtbl->SetVertexShaderConstantI(p,a,b,c) +#define IDirect3DDevice9Ex_GetVertexShaderConstantI(p,a,b,c) (p)->lpVtbl->GetVertexShaderConstantI(p,a,b,c) +#define IDirect3DDevice9Ex_SetVertexShaderConstantB(p,a,b,c) (p)->lpVtbl->SetVertexShaderConstantB(p,a,b,c) +#define IDirect3DDevice9Ex_GetVertexShaderConstantB(p,a,b,c) (p)->lpVtbl->GetVertexShaderConstantB(p,a,b,c) +#define IDirect3DDevice9Ex_SetStreamSource(p,a,b,c,d) (p)->lpVtbl->SetStreamSource(p,a,b,c,d) +#define IDirect3DDevice9Ex_GetStreamSource(p,a,b,c,d) (p)->lpVtbl->GetStreamSource(p,a,b,c,d) +#define IDirect3DDevice9Ex_SetStreamSourceFreq(p,a,b) (p)->lpVtbl->SetStreamSourceFreq(p,a,b) +#define IDirect3DDevice9Ex_GetStreamSourceFreq(p,a,b) (p)->lpVtbl->GetStreamSourceFreq(p,a,b) +#define IDirect3DDevice9Ex_SetIndices(p,a) (p)->lpVtbl->SetIndices(p,a) +#define IDirect3DDevice9Ex_GetIndices(p,a) (p)->lpVtbl->GetIndices(p,a) +#define IDirect3DDevice9Ex_CreatePixelShader(p,a,b) (p)->lpVtbl->CreatePixelShader(p,a,b) +#define IDirect3DDevice9Ex_SetPixelShader(p,a) (p)->lpVtbl->SetPixelShader(p,a) +#define IDirect3DDevice9Ex_GetPixelShader(p,a) (p)->lpVtbl->GetPixelShader(p,a) +#define IDirect3DDevice9Ex_SetPixelShaderConstantF(p,a,b,c) (p)->lpVtbl->SetPixelShaderConstantF(p,a,b,c) +#define IDirect3DDevice9Ex_GetPixelShaderConstantF(p,a,b,c) (p)->lpVtbl->GetPixelShaderConstantF(p,a,b,c) +#define IDirect3DDevice9Ex_SetPixelShaderConstantI(p,a,b,c) (p)->lpVtbl->SetPixelShaderConstantI(p,a,b,c) +#define IDirect3DDevice9Ex_GetPixelShaderConstantI(p,a,b,c) (p)->lpVtbl->GetPixelShaderConstantI(p,a,b,c) +#define IDirect3DDevice9Ex_SetPixelShaderConstantB(p,a,b,c) (p)->lpVtbl->SetPixelShaderConstantB(p,a,b,c) +#define IDirect3DDevice9Ex_GetPixelShaderConstantB(p,a,b,c) (p)->lpVtbl->GetPixelShaderConstantB(p,a,b,c) +#define IDirect3DDevice9Ex_DrawRectPatch(p,a,b,c) (p)->lpVtbl->DrawRectPatch(p,a,b,c) +#define IDirect3DDevice9Ex_DrawTriPatch(p,a,b,c) (p)->lpVtbl->DrawTriPatch(p,a,b,c) +#define IDirect3DDevice9Ex_DeletePatch(p,a) (p)->lpVtbl->DeletePatch(p,a) +#define IDirect3DDevice9Ex_CreateQuery(p,a,b) (p)->lpVtbl->CreateQuery(p,a,b) +#define IDirect3DDevice9Ex_SetConvolutionMonoKernel(p,a,b,c,d) (p)->lpVtbl->SetConvolutionMonoKernel(p,a,b,c,d) +#define IDirect3DDevice9Ex_ComposeRects(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->ComposeRects(p,a,b,c,d,e,f,g,h) +#define IDirect3DDevice9Ex_PresentEx(p,a,b,c,d,e) (p)->lpVtbl->PresentEx(p,a,b,c,d,e) +#define IDirect3DDevice9Ex_GetGPUThreadPriority(p,a) (p)->lpVtbl->GetGPUThreadPriority(p,a) +#define IDirect3DDevice9Ex_SetGPUThreadPriority(p,a) (p)->lpVtbl->SetGPUThreadPriority(p,a) +#define IDirect3DDevice9Ex_WaitForVBlank(p,a) (p)->lpVtbl->WaitForVBlank(p,a) +#define IDirect3DDevice9Ex_CheckResourceResidency(p,a,b) (p)->lpVtbl->CheckResourceResidency(p,a,b) +#define IDirect3DDevice9Ex_SetMaximumFrameLatency(p,a) (p)->lpVtbl->SetMaximumFrameLatency(p,a) +#define IDirect3DDevice9Ex_GetMaximumFrameLatency(p,a) (p)->lpVtbl->GetMaximumFrameLatency(p,a) +#define IDirect3DDevice9Ex_CheckDeviceState(p,a) (p)->lpVtbl->CheckDeviceState(p,a) +#define IDirect3DDevice9Ex_CreateRenderTargetEx(p,a,b,c,d,e,f,g,h,i) (p)->lpVtbl->CreateRenderTargetEx(p,a,b,c,d,e,f,g,h,i) +#define IDirect3DDevice9Ex_CreateOffscreenPlainSurfaceEx(p,a,b,c,d,e,f,g) (p)->lpVtbl->CreateOffscreenPlainSurfaceEx(p,a,b,c,d,e,f,g) +#define IDirect3DDevice9Ex_CreateDepthStencilSurfaceEx(p,a,b,c,d,e,f,g,h,i) (p)->lpVtbl->CreateDepthStencilSurfaceEx(p,a,b,c,d,e,f,g,h,i) +#define IDirect3DDevice9Ex_ResetEx(p,a,b) (p)->lpVtbl->ResetEx(p,a,b) +#define IDirect3DDevice9Ex_GetDisplayModeEx(p,a,b,c) (p)->lpVtbl->GetDisplayModeEx(p,a,b,c) +#else +#define IDirect3DDevice9Ex_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DDevice9Ex_AddRef(p) (p)->AddRef() +#define IDirect3DDevice9Ex_Release(p) (p)->Release() +#define IDirect3DDevice9Ex_TestCooperativeLevel(p) (p)->TestCooperativeLevel() +#define IDirect3DDevice9Ex_GetAvailableTextureMem(p) (p)->GetAvailableTextureMem() +#define IDirect3DDevice9Ex_EvictManagedResources(p) (p)->EvictManagedResources() +#define IDirect3DDevice9Ex_GetDirect3D(p,a) (p)->GetDirect3D(a) +#define IDirect3DDevice9Ex_GetDeviceCaps(p,a) (p)->GetDeviceCaps(a) +#define IDirect3DDevice9Ex_GetDisplayMode(p,a,b) (p)->GetDisplayMode(a,b) +#define IDirect3DDevice9Ex_GetCreationParameters(p,a) (p)->GetCreationParameters(a) +#define IDirect3DDevice9Ex_SetCursorProperties(p,a,b,c) (p)->SetCursorProperties(a,b,c) +#define IDirect3DDevice9Ex_SetCursorPosition(p,a,b,c) (p)->SetCursorPosition(a,b,c) +#define IDirect3DDevice9Ex_ShowCursor(p,a) (p)->ShowCursor(a) +#define IDirect3DDevice9Ex_CreateAdditionalSwapChain(p,a,b) (p)->CreateAdditionalSwapChain(a,b) +#define IDirect3DDevice9Ex_GetSwapChain(p,a,b) (p)->GetSwapChain(a,b) +#define IDirect3DDevice9Ex_GetNumberOfSwapChains(p) (p)->GetNumberOfSwapChains() +#define IDirect3DDevice9Ex_Reset(p,a) (p)->Reset(a) +#define IDirect3DDevice9Ex_Present(p,a,b,c,d) (p)->Present(a,b,c,d) +#define IDirect3DDevice9Ex_GetBackBuffer(p,a,b,c,d) (p)->GetBackBuffer(a,b,c,d) +#define IDirect3DDevice9Ex_GetRasterStatus(p,a,b) (p)->GetRasterStatus(a,b) +#define IDirect3DDevice9Ex_SetDialogBoxMode(p,a) (p)->SetDialogBoxMode(a) +#define IDirect3DDevice9Ex_SetGammaRamp(p,a,b,c) (p)->SetGammaRamp(a,b,c) +#define IDirect3DDevice9Ex_GetGammaRamp(p,a,b) (p)->GetGammaRamp(a,b) +#define IDirect3DDevice9Ex_CreateTexture(p,a,b,c,d,e,f,g,h) (p)->CreateTexture(a,b,c,d,e,f,g,h) +#define IDirect3DDevice9Ex_CreateVolumeTexture(p,a,b,c,d,e,f,g,h,i) (p)->CreateVolumeTexture(a,b,c,d,e,f,g,h,i) +#define IDirect3DDevice9Ex_CreateCubeTexture(p,a,b,c,d,e,f,g) (p)->CreateCubeTexture(a,b,c,d,e,f,g) +#define IDirect3DDevice9Ex_CreateVertexBuffer(p,a,b,c,d,e,f) (p)->CreateVertexBuffer(a,b,c,d,e,f) +#define IDirect3DDevice9Ex_CreateIndexBuffer(p,a,b,c,d,e,f) (p)->CreateIndexBuffer(a,b,c,d,e,f) +#define IDirect3DDevice9Ex_CreateRenderTarget(p,a,b,c,d,e,f,g,h) (p)->CreateRenderTarget(a,b,c,d,e,f,g,h) +#define IDirect3DDevice9Ex_CreateDepthStencilSurface(p,a,b,c,d,e,f,g,h) (p)->CreateDepthStencilSurface(a,b,c,d,e,f,g,h) +#define IDirect3DDevice9Ex_UpdateSurface(p,a,b,c,d) (p)->UpdateSurface(a,b,c,d) +#define IDirect3DDevice9Ex_UpdateTexture(p,a,b) (p)->UpdateTexture(a,b) +#define IDirect3DDevice9Ex_GetRenderTargetData(p,a,b) (p)->GetRenderTargetData(a,b) +#define IDirect3DDevice9Ex_GetFrontBufferData(p,a,b) (p)->GetFrontBufferData(a,b) +#define IDirect3DDevice9Ex_StretchRect(p,a,b,c,d,e) (p)->StretchRect(a,b,c,d,e) +#define IDirect3DDevice9Ex_ColorFill(p,a,b,c) (p)->ColorFill(a,b,c) +#define IDirect3DDevice9Ex_CreateOffscreenPlainSurface(p,a,b,c,d,e,f) (p)->CreateOffscreenPlainSurface(a,b,c,d,e,f) +#define IDirect3DDevice9Ex_SetRenderTarget(p,a,b) (p)->SetRenderTarget(a,b) +#define IDirect3DDevice9Ex_GetRenderTarget(p,a,b) (p)->GetRenderTarget(a,b) +#define IDirect3DDevice9Ex_SetDepthStencilSurface(p,a) (p)->SetDepthStencilSurface(a) +#define IDirect3DDevice9Ex_GetDepthStencilSurface(p,a) (p)->GetDepthStencilSurface(a) +#define IDirect3DDevice9Ex_BeginScene(p) (p)->BeginScene() +#define IDirect3DDevice9Ex_EndScene(p) (p)->EndScene() +#define IDirect3DDevice9Ex_Clear(p,a,b,c,d,e,f) (p)->Clear(a,b,c,d,e,f) +#define IDirect3DDevice9Ex_SetTransform(p,a,b) (p)->SetTransform(a,b) +#define IDirect3DDevice9Ex_GetTransform(p,a,b) (p)->GetTransform(a,b) +#define IDirect3DDevice9Ex_MultiplyTransform(p,a,b) (p)->MultiplyTransform(a,b) +#define IDirect3DDevice9Ex_SetViewport(p,a) (p)->SetViewport(a) +#define IDirect3DDevice9Ex_GetViewport(p,a) (p)->GetViewport(a) +#define IDirect3DDevice9Ex_SetMaterial(p,a) (p)->SetMaterial(a) +#define IDirect3DDevice9Ex_GetMaterial(p,a) (p)->GetMaterial(a) +#define IDirect3DDevice9Ex_SetLight(p,a,b) (p)->SetLight(a,b) +#define IDirect3DDevice9Ex_GetLight(p,a,b) (p)->GetLight(a,b) +#define IDirect3DDevice9Ex_LightEnable(p,a,b) (p)->LightEnable(a,b) +#define IDirect3DDevice9Ex_GetLightEnable(p,a,b) (p)->GetLightEnable(a,b) +#define IDirect3DDevice9Ex_SetClipPlane(p,a,b) (p)->SetClipPlane(a,b) +#define IDirect3DDevice9Ex_GetClipPlane(p,a,b) (p)->GetClipPlane(a,b) +#define IDirect3DDevice9Ex_SetRenderState(p,a,b) (p)->SetRenderState(a,b) +#define IDirect3DDevice9Ex_GetRenderState(p,a,b) (p)->GetRenderState(a,b) +#define IDirect3DDevice9Ex_CreateStateBlock(p,a,b) (p)->CreateStateBlock(a,b) +#define IDirect3DDevice9Ex_BeginStateBlock(p) (p)->BeginStateBlock() +#define IDirect3DDevice9Ex_EndStateBlock(p,a) (p)->EndStateBlock(a) +#define IDirect3DDevice9Ex_SetClipStatus(p,a) (p)->SetClipStatus(a) +#define IDirect3DDevice9Ex_GetClipStatus(p,a) (p)->GetClipStatus(a) +#define IDirect3DDevice9Ex_GetTexture(p,a,b) (p)->GetTexture(a,b) +#define IDirect3DDevice9Ex_SetTexture(p,a,b) (p)->SetTexture(a,b) +#define IDirect3DDevice9Ex_GetTextureStageState(p,a,b,c) (p)->GetTextureStageState(a,b,c) +#define IDirect3DDevice9Ex_SetTextureStageState(p,a,b,c) (p)->SetTextureStageState(a,b,c) +#define IDirect3DDevice9Ex_GetSamplerState(p,a,b,c) (p)->GetSamplerState(a,b,c) +#define IDirect3DDevice9Ex_SetSamplerState(p,a,b,c) (p)->SetSamplerState(a,b,c) +#define IDirect3DDevice9Ex_ValidateDevice(p,a) (p)->ValidateDevice(a) +#define IDirect3DDevice9Ex_SetPaletteEntries(p,a,b) (p)->SetPaletteEntries(a,b) +#define IDirect3DDevice9Ex_GetPaletteEntries(p,a,b) (p)->GetPaletteEntries(a,b) +#define IDirect3DDevice9Ex_SetCurrentTexturePalette(p,a) (p)->SetCurrentTexturePalette(a) +#define IDirect3DDevice9Ex_GetCurrentTexturePalette(p,a) (p)->GetCurrentTexturePalette(a) +#define IDirect3DDevice9Ex_SetScissorRect(p,a) (p)->SetScissorRect(a) +#define IDirect3DDevice9Ex_GetScissorRect(p,a) (p)->GetScissorRect(a) +#define IDirect3DDevice9Ex_SetSoftwareVertexProcessing(p,a) (p)->SetSoftwareVertexProcessing(a) +#define IDirect3DDevice9Ex_GetSoftwareVertexProcessing(p) (p)->GetSoftwareVertexProcessing() +#define IDirect3DDevice9Ex_SetNPatchMode(p,a) (p)->SetNPatchMode(a) +#define IDirect3DDevice9Ex_GetNPatchMode(p) (p)->GetNPatchMode() +#define IDirect3DDevice9Ex_DrawPrimitive(p,a,b,c) (p)->DrawPrimitive(a,b,c) +#define IDirect3DDevice9Ex_DrawIndexedPrimitive(p,a,b,c,d,e,f) (p)->DrawIndexedPrimitive(a,b,c,d,e,f) +#define IDirect3DDevice9Ex_DrawPrimitiveUP(p,a,b,c,d) (p)->DrawPrimitiveUP(a,b,c,d) +#define IDirect3DDevice9Ex_DrawIndexedPrimitiveUP(p,a,b,c,d,e,f,g,h) (p)->DrawIndexedPrimitiveUP(a,b,c,d,e,f,g,h) +#define IDirect3DDevice9Ex_ProcessVertices(p,a,b,c,d,e,f) (p)->ProcessVertices(a,b,c,d,e,f) +#define IDirect3DDevice9Ex_CreateVertexDeclaration(p,a,b) (p)->CreateVertexDeclaration(a,b) +#define IDirect3DDevice9Ex_SetVertexDeclaration(p,a) (p)->SetVertexDeclaration(a) +#define IDirect3DDevice9Ex_GetVertexDeclaration(p,a) (p)->GetVertexDeclaration(a) +#define IDirect3DDevice9Ex_SetFVF(p,a) (p)->SetFVF(a) +#define IDirect3DDevice9Ex_GetFVF(p,a) (p)->GetFVF(a) +#define IDirect3DDevice9Ex_CreateVertexShader(p,a,b) (p)->CreateVertexShader(a,b) +#define IDirect3DDevice9Ex_SetVertexShader(p,a) (p)->SetVertexShader(a) +#define IDirect3DDevice9Ex_GetVertexShader(p,a) (p)->GetVertexShader(a) +#define IDirect3DDevice9Ex_SetVertexShaderConstantF(p,a,b,c) (p)->SetVertexShaderConstantF(a,b,c) +#define IDirect3DDevice9Ex_GetVertexShaderConstantF(p,a,b,c) (p)->GetVertexShaderConstantF(a,b,c) +#define IDirect3DDevice9Ex_SetVertexShaderConstantI(p,a,b,c) (p)->SetVertexShaderConstantI(a,b,c) +#define IDirect3DDevice9Ex_GetVertexShaderConstantI(p,a,b,c) (p)->GetVertexShaderConstantI(a,b,c) +#define IDirect3DDevice9Ex_SetVertexShaderConstantB(p,a,b,c) (p)->SetVertexShaderConstantB(a,b,c) +#define IDirect3DDevice9Ex_GetVertexShaderConstantB(p,a,b,c) (p)->GetVertexShaderConstantB(a,b,c) +#define IDirect3DDevice9Ex_SetStreamSource(p,a,b,c,d) (p)->SetStreamSource(a,b,c,d) +#define IDirect3DDevice9Ex_GetStreamSource(p,a,b,c,d) (p)->GetStreamSource(a,b,c,d) +#define IDirect3DDevice9Ex_SetStreamSourceFreq(p,a,b) (p)->SetStreamSourceFreq(a,b) +#define IDirect3DDevice9Ex_GetStreamSourceFreq(p,a,b) (p)->GetStreamSourceFreq(a,b) +#define IDirect3DDevice9Ex_SetIndices(p,a) (p)->SetIndices(a) +#define IDirect3DDevice9Ex_GetIndices(p,a) (p)->GetIndices(a) +#define IDirect3DDevice9Ex_CreatePixelShader(p,a,b) (p)->CreatePixelShader(a,b) +#define IDirect3DDevice9Ex_SetPixelShader(p,a) (p)->SetPixelShader(a) +#define IDirect3DDevice9Ex_GetPixelShader(p,a) (p)->GetPixelShader(a) +#define IDirect3DDevice9Ex_SetPixelShaderConstantF(p,a,b,c) (p)->SetPixelShaderConstantF(a,b,c) +#define IDirect3DDevice9Ex_GetPixelShaderConstantF(p,a,b,c) (p)->GetPixelShaderConstantF(a,b,c) +#define IDirect3DDevice9Ex_SetPixelShaderConstantI(p,a,b,c) (p)->SetPixelShaderConstantI(a,b,c) +#define IDirect3DDevice9Ex_GetPixelShaderConstantI(p,a,b,c) (p)->GetPixelShaderConstantI(a,b,c) +#define IDirect3DDevice9Ex_SetPixelShaderConstantB(p,a,b,c) (p)->SetPixelShaderConstantB(a,b,c) +#define IDirect3DDevice9Ex_GetPixelShaderConstantB(p,a,b,c) (p)->GetPixelShaderConstantB(a,b,c) +#define IDirect3DDevice9Ex_DrawRectPatch(p,a,b,c) (p)->DrawRectPatch(a,b,c) +#define IDirect3DDevice9Ex_DrawTriPatch(p,a,b,c) (p)->DrawTriPatch(a,b,c) +#define IDirect3DDevice9Ex_DeletePatch(p,a) (p)->DeletePatch(a) +#define IDirect3DDevice9Ex_CreateQuery(p,a,b) (p)->CreateQuery(a,b) +#define IDirect3DDevice9Ex_SetConvolutionMonoKernel(p,a,b,c,d) (p)->SetConvolutionMonoKernel(a,b,c,d) +#define IDirect3DDevice9Ex_ComposeRects(p,a,b,c,d,e,f,g,h) (p)->ComposeRects(a,b,c,d,e,f,g,h) +#define IDirect3DDevice9Ex_PresentEx(p,a,b,c,d,e) (p)->PresentEx(a,b,c,d,e) +#define IDirect3DDevice9Ex_GetGPUThreadPriority(p,a) (p)->GetGPUThreadPriority(a) +#define IDirect3DDevice9Ex_SetGPUThreadPriority(p,a) (p)->SetGPUThreadPriority(a) +#define IDirect3DDevice9Ex_WaitForVBlank(p,a) (p)->WaitForVBlank(a) +#define IDirect3DDevice9Ex_CheckResourceResidency(p,a,b) (p)->CheckResourceResidency(a,b) +#define IDirect3DDevice9Ex_SetMaximumFrameLatency(p,a) (p)->SetMaximumFrameLatency(a) +#define IDirect3DDevice9Ex_GetMaximumFrameLatency(p,a) (p)->GetMaximumFrameLatency(a) +#define IDirect3DDevice9Ex_CheckDeviceState(p,a) (p)->CheckDeviceState(a) +#define IDirect3DDevice9Ex_CreateRenderTargetEx(p,a,b,c,d,e,f,g,h,i) (p)->CreateRenderTargetEx(a,b,c,d,e,f,g,h,i) +#define IDirect3DDevice9Ex_CreateOffscreenPlainSurfaceEx(p,a,b,c,d,e,f,g) (p)->CreateOffscreenPlainSurfaceEx(a,b,c,d,e,f,g) +#define IDirect3DDevice9Ex_CreateDepthStencilSurfaceEx(p,a,b,c,d,e,f,g,h,i) (p)->CreateDepthStencilSurfaceEx(a,b,c,d,e,f,g,h,i) +#define IDirect3DDevice9Ex_ResetEx(p,a,b) (p)->ResetEx(a,b) +#define IDirect3DDevice9Ex_GetDisplayModeEx(p,a,b,c) (p)->GetDisplayModeEx(a,b,c) +#endif + + + +#undef INTERFACE +#define INTERFACE IDirect3DSwapChain9Ex + +DECLARE_INTERFACE_(IDirect3DSwapChain9Ex, IDirect3DSwapChain9) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DSwapChain9 methods ***/ + STDMETHOD(Present)(THIS_ CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion,DWORD dwFlags) PURE; + STDMETHOD(GetFrontBufferData)(THIS_ IDirect3DSurface9* pDestSurface) PURE; + STDMETHOD(GetBackBuffer)(THIS_ UINT iBackBuffer,D3DBACKBUFFER_TYPE Type,IDirect3DSurface9** ppBackBuffer) PURE; + STDMETHOD(GetRasterStatus)(THIS_ D3DRASTER_STATUS* pRasterStatus) PURE; + STDMETHOD(GetDisplayMode)(THIS_ D3DDISPLAYMODE* pMode) PURE; + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD(GetPresentParameters)(THIS_ D3DPRESENT_PARAMETERS* pPresentationParameters) PURE; + STDMETHOD(GetLastPresentCount)(THIS_ UINT* pLastPresentCount) PURE; + STDMETHOD(GetPresentStats)(THIS_ D3DPRESENTSTATS* pPresentationStatistics) PURE; + STDMETHOD(GetDisplayModeEx)(THIS_ D3DDISPLAYMODEEX* pMode,D3DDISPLAYROTATION* pRotation) PURE; +}; + +typedef struct IDirect3DSwapChain9Ex *LPDIRECT3DSWAPCHAIN9EX, *PDIRECT3DSWAPCHAIN9EX; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DSwapChain9Ex_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DSwapChain9Ex_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DSwapChain9Ex_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DSwapChain9Ex_Present(p,a,b,c,d,e) (p)->lpVtbl->Present(p,a,b,c,d,e) +#define IDirect3DSwapChain9Ex_GetFrontBufferData(p,a) (p)->lpVtbl->GetFrontBufferData(p,a) +#define IDirect3DSwapChain9Ex_GetBackBuffer(p,a,b,c) (p)->lpVtbl->GetBackBuffer(p,a,b,c) +#define IDirect3DSwapChain9Ex_GetRasterStatus(p,a) (p)->lpVtbl->GetRasterStatus(p,a) +#define IDirect3DSwapChain9Ex_GetDisplayMode(p,a) (p)->lpVtbl->GetDisplayMode(p,a) +#define IDirect3DSwapChain9Ex_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DSwapChain9Ex_GetPresentParameters(p,a) (p)->lpVtbl->GetPresentParameters(p,a) +#define IDirect3DSwapChain9Ex_GetLastPresentCount(p,a) (p)->lpVtbl->GetLastPresentCount(p,a) +#define IDirect3DSwapChain9Ex_GetPresentStats(p,a) (p)->lpVtbl->GetPresentStats(p,a) +#define IDirect3DSwapChain9Ex_GetDisplayModeEx(p,a,b) (p)->lpVtbl->GetDisplayModeEx(p,a,b) +#else +#define IDirect3DSwapChain9Ex_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DSwapChain9Ex_AddRef(p) (p)->AddRef() +#define IDirect3DSwapChain9Ex_Release(p) (p)->Release() +#define IDirect3DSwapChain9Ex_Present(p,a,b,c,d,e) (p)->Present(a,b,c,d,e) +#define IDirect3DSwapChain9Ex_GetFrontBufferData(p,a) (p)->GetFrontBufferData(a) +#define IDirect3DSwapChain9Ex_GetBackBuffer(p,a,b,c) (p)->GetBackBuffer(a,b,c) +#define IDirect3DSwapChain9Ex_GetRasterStatus(p,a) (p)->GetRasterStatus(a) +#define IDirect3DSwapChain9Ex_GetDisplayMode(p,a) (p)->GetDisplayMode(a) +#define IDirect3DSwapChain9Ex_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DSwapChain9Ex_GetPresentParameters(p,a) (p)->GetPresentParameters(a) +#define IDirect3DSwapChain9Ex_GetLastPresentCount(p,a) (p)->GetLastPresentCount(a) +#define IDirect3DSwapChain9Ex_GetPresentStats(p,a) (p)->GetPresentStats(a) +#define IDirect3DSwapChain9Ex_GetDisplayModeEx(p,a,b) (p)->GetDisplayModeEx(a,b) +#endif + +#endif // !D3D_DISABLE_9EX +/* -- D3D9Ex only */ + + + +/* D3D9Ex only -- */ +#if !defined(D3D_DISABLE_9EX) + + + +#undef INTERFACE +#define INTERFACE IDirect3D9ExOverlayExtension + +DECLARE_INTERFACE_(IDirect3D9ExOverlayExtension, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3D9ExOverlayExtension methods ***/ + STDMETHOD(CheckDeviceOverlayType)(THIS_ UINT Adapter,D3DDEVTYPE DevType,UINT OverlayWidth,UINT OverlayHeight,D3DFORMAT OverlayFormat,D3DDISPLAYMODEEX* pDisplayMode,D3DDISPLAYROTATION DisplayRotation,D3DOVERLAYCAPS* pOverlayCaps) PURE; +}; + +typedef struct IDirect3D9ExOverlayExtension *LPDIRECT3D9EXOVERLAYEXTENSION, *PDIRECT3D9EXOVERLAYEXTENSION; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3D9ExOverlayExtension_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3D9ExOverlayExtension_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3D9ExOverlayExtension_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3D9ExOverlayExtension_CheckDeviceOverlayType(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->CheckDeviceOverlayType(p,a,b,c,d,e,f,g,h) +#else +#define IDirect3D9ExOverlayExtension_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3D9ExOverlayExtension_AddRef(p) (p)->AddRef() +#define IDirect3D9ExOverlayExtension_Release(p) (p)->Release() +#define IDirect3D9ExOverlayExtension_CheckDeviceOverlayType(p,a,b,c,d,e,f,g,h) (p)->CheckDeviceOverlayType(a,b,c,d,e,f,g,h) +#endif + + + +#undef INTERFACE +#define INTERFACE IDirect3DDevice9Video + +DECLARE_INTERFACE_(IDirect3DDevice9Video, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DDevice9Video methods ***/ + STDMETHOD(GetContentProtectionCaps)(THIS_ CONST GUID* pCryptoType,CONST GUID* pDecodeProfile,D3DCONTENTPROTECTIONCAPS* pCaps) PURE; + STDMETHOD(CreateAuthenticatedChannel)(THIS_ D3DAUTHENTICATEDCHANNELTYPE ChannelType,IDirect3DAuthenticatedChannel9** ppAuthenticatedChannel,HANDLE* pChannelHandle) PURE; + STDMETHOD(CreateCryptoSession)(THIS_ CONST GUID* pCryptoType,CONST GUID* pDecodeProfile,IDirect3DCryptoSession9** ppCryptoSession,HANDLE* pCryptoHandle) PURE; +}; + +typedef struct IDirect3DDevice9Video *LPDIRECT3DDEVICE9VIDEO, *PDIRECT3DDEVICE9VIDEO; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DDevice9Video_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DDevice9Video_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DDevice9Video_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DDevice9Video_GetContentProtectionCaps(p,a,b,c) (p)->lpVtbl->GetContentProtectionCaps(p,a,b,c) +#define IDirect3DDevice9Video_CreateAuthenticatedChannel(p,a,b,c) (p)->lpVtbl->CreateAuthenticatedChannel(p,a,b,c) +#define IDirect3DDevice9Video_CreateCryptoSession(p,a,b,c,d) (p)->lpVtbl->CreateCryptoSession(p,a,b,c,d) +#else +#define IDirect3DDevice9Video_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DDevice9Video_AddRef(p) (p)->AddRef() +#define IDirect3DDevice9Video_Release(p) (p)->Release() +#define IDirect3DDevice9Video_GetContentProtectionCaps(p,a,b,c) (p)->GetContentProtectionCaps(a,b,c) +#define IDirect3DDevice9Video_CreateAuthenticatedChannel(p,a,b,c) (p)->CreateAuthenticatedChannel(a,b,c) +#define IDirect3DDevice9Video_CreateCryptoSession(p,a,b,c,d) (p)->CreateCryptoSession(a,b,c,d) +#endif + + + + +#undef INTERFACE +#define INTERFACE IDirect3DAuthenticatedChannel9 + +DECLARE_INTERFACE_(IDirect3DAuthenticatedChannel9, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DAuthenticatedChannel9 methods ***/ + STDMETHOD(GetCertificateSize)(THIS_ UINT* pCertificateSize) PURE; + STDMETHOD(GetCertificate)(THIS_ UINT CertifacteSize,BYTE* ppCertificate) PURE; + STDMETHOD(NegotiateKeyExchange)(THIS_ UINT DataSize,VOID* pData) PURE; + STDMETHOD(Query)(THIS_ UINT InputSize,CONST VOID* pInput,UINT OutputSize,VOID* pOutput) PURE; + STDMETHOD(Configure)(THIS_ UINT InputSize,CONST VOID* pInput,D3DAUTHENTICATEDCHANNEL_CONFIGURE_OUTPUT* pOutput) PURE; +}; + +typedef struct IDirect3DAuthenticatedChannel9 *LPDIRECT3DAUTHENTICATEDCHANNEL9, *PDIRECT3DAUTHENTICATEDCHANNEL9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DAuthenticatedChannel9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DAuthenticatedChannel9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DAuthenticatedChannel9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DAuthenticatedChannel9_GetCertificateSize(p,a) (p)->lpVtbl->GetCertificateSize(p,a) +#define IDirect3DAuthenticatedChannel9_GetCertificate(p,a,b) (p)->lpVtbl->GetCertificate(p,a,b) +#define IDirect3DAuthenticatedChannel9_NegotiateKeyExchange(p,a,b) (p)->lpVtbl->NegotiateKeyExchange(p,a,b) +#define IDirect3DAuthenticatedChannel9_Query(p,a,b,c,d) (p)->lpVtbl->Query(p,a,b,c,d) +#define IDirect3DAuthenticatedChannel9_Configure(p,a,b,c) (p)->lpVtbl->Configure(p,a,b,c) +#else +#define IDirect3DAuthenticatedChannel9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DAuthenticatedChannel9_AddRef(p) (p)->AddRef() +#define IDirect3DAuthenticatedChannel9_Release(p) (p)->Release() +#define IDirect3DAuthenticatedChannel9_GetCertificateSize(p,a) (p)->GetCertificateSize(a) +#define IDirect3DAuthenticatedChannel9_GetCertificate(p,a,b) (p)->GetCertificate(a,b) +#define IDirect3DAuthenticatedChannel9_NegotiateKeyExchange(p,a,b) (p)->NegotiateKeyExchange(a,b) +#define IDirect3DAuthenticatedChannel9_Query(p,a,b,c,d) (p)->Query(a,b,c,d) +#define IDirect3DAuthenticatedChannel9_Configure(p,a,b,c) (p)->Configure(a,b,c) +#endif + + + +#undef INTERFACE +#define INTERFACE IDirect3DCryptoSession9 + +DECLARE_INTERFACE_(IDirect3DCryptoSession9, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DCryptoSession9 methods ***/ + STDMETHOD(GetCertificateSize)(THIS_ UINT* pCertificateSize) PURE; + STDMETHOD(GetCertificate)(THIS_ UINT CertifacteSize,BYTE* ppCertificate) PURE; + STDMETHOD(NegotiateKeyExchange)(THIS_ UINT DataSize,VOID* pData) PURE; + STDMETHOD(EncryptionBlt)(THIS_ IDirect3DSurface9* pSrcSurface,IDirect3DSurface9* pDstSurface,UINT DstSurfaceSize,VOID* pIV) PURE; + STDMETHOD(DecryptionBlt)(THIS_ IDirect3DSurface9* pSrcSurface,IDirect3DSurface9* pDstSurface,UINT SrcSurfaceSize,D3DENCRYPTED_BLOCK_INFO* pEncryptedBlockInfo,VOID* pContentKey,VOID* pIV) PURE; + STDMETHOD(GetSurfacePitch)(THIS_ IDirect3DSurface9* pSrcSurface,UINT* pSurfacePitch) PURE; + STDMETHOD(StartSessionKeyRefresh)(THIS_ VOID* pRandomNumber,UINT RandomNumberSize) PURE; + STDMETHOD(FinishSessionKeyRefresh)(THIS) PURE; + STDMETHOD(GetEncryptionBltKey)(THIS_ VOID* pReadbackKey,UINT KeySize) PURE; +}; + +typedef struct IDirect3DCryptoSession9 *LPDIRECT3DCRYPTOSESSION9, *PDIRECT3DCRYPTOSESSION9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DCryptoSession9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DCryptoSession9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DCryptoSession9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DCryptoSession9_GetCertificateSize(p,a) (p)->lpVtbl->GetCertificateSize(p,a) +#define IDirect3DCryptoSession9_GetCertificate(p,a,b) (p)->lpVtbl->GetCertificate(p,a,b) +#define IDirect3DCryptoSession9_NegotiateKeyExchange(p,a,b) (p)->lpVtbl->NegotiateKeyExchange(p,a,b) +#define IDirect3DCryptoSession9_EncryptionBlt(p,a,b,c,d) (p)->lpVtbl->EncryptionBlt(p,a,b,c,d) +#define IDirect3DCryptoSession9_DecryptionBlt(p,a,b,c,d,e,f) (p)->lpVtbl->DecryptionBlt(p,a,b,c,d,e,f) +#define IDirect3DCryptoSession9_GetSurfacePitch(p,a,b) (p)->lpVtbl->GetSurfacePitch(p,a,b) +#define IDirect3DCryptoSession9_StartSessionKeyRefresh(p,a,b) (p)->lpVtbl->StartSessionKeyRefresh(p,a,b) +#define IDirect3DCryptoSession9_FinishSessionKeyRefresh(p) (p)->lpVtbl->FinishSessionKeyRefresh(p) +#define IDirect3DCryptoSession9_GetEncryptionBltKey(p,a,b) (p)->lpVtbl->GetEncryptionBltKey(p,a,b) +#else +#define IDirect3DCryptoSession9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DCryptoSession9_AddRef(p) (p)->AddRef() +#define IDirect3DCryptoSession9_Release(p) (p)->Release() +#define IDirect3DCryptoSession9_GetCertificateSize(p,a) (p)->GetCertificateSize(a) +#define IDirect3DCryptoSession9_GetCertificate(p,a,b) (p)->GetCertificate(a,b) +#define IDirect3DCryptoSession9_NegotiateKeyExchange(p,a,b) (p)->NegotiateKeyExchange(a,b) +#define IDirect3DCryptoSession9_EncryptionBlt(p,a,b,c,d) (p)->EncryptionBlt(a,b,c,d) +#define IDirect3DCryptoSession9_DecryptionBlt(p,a,b,c,d,e,f) (p)->DecryptionBlt(a,b,c,d,e,f) +#define IDirect3DCryptoSession9_GetSurfacePitch(p,a,b) (p)->GetSurfacePitch(a,b) +#define IDirect3DCryptoSession9_StartSessionKeyRefresh(p,a,b) (p)->StartSessionKeyRefresh(a,b) +#define IDirect3DCryptoSession9_FinishSessionKeyRefresh(p) (p)->FinishSessionKeyRefresh() +#define IDirect3DCryptoSession9_GetEncryptionBltKey(p,a,b) (p)->GetEncryptionBltKey(a,b) +#endif + +/* -- D3D9Ex only */ +#endif // !D3D_DISABLE_9EX + + +#ifdef __cplusplus +}; +#endif + +#endif /* (DIRECT3D_VERSION >= 0x0900) */ +#endif /* _D3D_H_ */ + diff --git a/MediaClient/MediaClient/directx/include/d3d9caps.h b/MediaClient/MediaClient/directx/include/d3d9caps.h new file mode 100644 index 0000000..c10c4cd --- /dev/null +++ b/MediaClient/MediaClient/directx/include/d3d9caps.h @@ -0,0 +1,567 @@ +/*==========================================================================; + * + * Copyright (C) Microsoft Corporation. All Rights Reserved. + * + * File: d3d9caps.h + * Content: Direct3D capabilities include file + * + ***************************************************************************/ + +#ifndef _d3d9CAPS_H +#define _d3d9CAPS_H + +#ifndef DIRECT3D_VERSION +#define DIRECT3D_VERSION 0x0900 +#endif //DIRECT3D_VERSION + +// include this file content only if compiling for DX9 interfaces +#if(DIRECT3D_VERSION >= 0x0900) + +#if defined(_X86_) || defined(_IA64_) +#pragma pack(4) +#endif + +typedef struct _D3DVSHADERCAPS2_0 +{ + DWORD Caps; + INT DynamicFlowControlDepth; + INT NumTemps; + INT StaticFlowControlDepth; +} D3DVSHADERCAPS2_0; + +#define D3DVS20CAPS_PREDICATION (1<<0) + +#define D3DVS20_MAX_DYNAMICFLOWCONTROLDEPTH 24 +#define D3DVS20_MIN_DYNAMICFLOWCONTROLDEPTH 0 +#define D3DVS20_MAX_NUMTEMPS 32 +#define D3DVS20_MIN_NUMTEMPS 12 +#define D3DVS20_MAX_STATICFLOWCONTROLDEPTH 4 +#define D3DVS20_MIN_STATICFLOWCONTROLDEPTH 1 + +typedef struct _D3DPSHADERCAPS2_0 +{ + DWORD Caps; + INT DynamicFlowControlDepth; + INT NumTemps; + INT StaticFlowControlDepth; + INT NumInstructionSlots; +} D3DPSHADERCAPS2_0; + +#define D3DPS20CAPS_ARBITRARYSWIZZLE (1<<0) +#define D3DPS20CAPS_GRADIENTINSTRUCTIONS (1<<1) +#define D3DPS20CAPS_PREDICATION (1<<2) +#define D3DPS20CAPS_NODEPENDENTREADLIMIT (1<<3) +#define D3DPS20CAPS_NOTEXINSTRUCTIONLIMIT (1<<4) + +#define D3DPS20_MAX_DYNAMICFLOWCONTROLDEPTH 24 +#define D3DPS20_MIN_DYNAMICFLOWCONTROLDEPTH 0 +#define D3DPS20_MAX_NUMTEMPS 32 +#define D3DPS20_MIN_NUMTEMPS 12 +#define D3DPS20_MAX_STATICFLOWCONTROLDEPTH 4 +#define D3DPS20_MIN_STATICFLOWCONTROLDEPTH 0 +#define D3DPS20_MAX_NUMINSTRUCTIONSLOTS 512 +#define D3DPS20_MIN_NUMINSTRUCTIONSLOTS 96 + +#define D3DMIN30SHADERINSTRUCTIONS 512 +#define D3DMAX30SHADERINSTRUCTIONS 32768 + +/* D3D9Ex only -- */ +#if !defined(D3D_DISABLE_9EX) + +typedef struct _D3DOVERLAYCAPS +{ + UINT Caps; + UINT MaxOverlayDisplayWidth; + UINT MaxOverlayDisplayHeight; +} D3DOVERLAYCAPS; + +#define D3DOVERLAYCAPS_FULLRANGERGB 0x00000001 +#define D3DOVERLAYCAPS_LIMITEDRANGERGB 0x00000002 +#define D3DOVERLAYCAPS_YCbCr_BT601 0x00000004 +#define D3DOVERLAYCAPS_YCbCr_BT709 0x00000008 +#define D3DOVERLAYCAPS_YCbCr_BT601_xvYCC 0x00000010 +#define D3DOVERLAYCAPS_YCbCr_BT709_xvYCC 0x00000020 +#define D3DOVERLAYCAPS_STRETCHX 0x00000040 +#define D3DOVERLAYCAPS_STRETCHY 0x00000080 + + +typedef struct _D3DCONTENTPROTECTIONCAPS +{ + DWORD Caps; + GUID KeyExchangeType; + UINT BufferAlignmentStart; + UINT BlockAlignmentSize; + ULONGLONG ProtectedMemorySize; +} D3DCONTENTPROTECTIONCAPS; + +#define D3DCPCAPS_SOFTWARE 0x00000001 +#define D3DCPCAPS_HARDWARE 0x00000002 +#define D3DCPCAPS_PROTECTIONALWAYSON 0x00000004 +#define D3DCPCAPS_PARTIALDECRYPTION 0x00000008 +#define D3DCPCAPS_CONTENTKEY 0x00000010 +#define D3DCPCAPS_FRESHENSESSIONKEY 0x00000020 +#define D3DCPCAPS_ENCRYPTEDREADBACK 0x00000040 +#define D3DCPCAPS_ENCRYPTEDREADBACKKEY 0x00000080 +#define D3DCPCAPS_SEQUENTIAL_CTR_IV 0x00000100 +#define D3DCPCAPS_ENCRYPTSLICEDATAONLY 0x00000200 + +DEFINE_GUID(D3DCRYPTOTYPE_AES128_CTR, +0x9b6bd711, 0x4f74, 0x41c9, 0x9e, 0x7b, 0xb, 0xe2, 0xd7, 0xd9, 0x3b, 0x4f); +DEFINE_GUID(D3DCRYPTOTYPE_PROPRIETARY, +0xab4e9afd, 0x1d1c, 0x46e6, 0xa7, 0x2f, 0x8, 0x69, 0x91, 0x7b, 0xd, 0xe8); + +DEFINE_GUID(D3DKEYEXCHANGE_RSAES_OAEP, +0xc1949895, 0xd72a, 0x4a1d, 0x8e, 0x5d, 0xed, 0x85, 0x7d, 0x17, 0x15, 0x20); +DEFINE_GUID(D3DKEYEXCHANGE_DXVA, +0x43d3775c, 0x38e5, 0x4924, 0x8d, 0x86, 0xd3, 0xfc, 0xcf, 0x15, 0x3e, 0x9b); + +#endif // !D3D_DISABLE_9EX +/* -- D3D9Ex only */ + +typedef struct _D3DCAPS9 +{ + /* Device Info */ + D3DDEVTYPE DeviceType; + UINT AdapterOrdinal; + + /* Caps from DX7 Draw */ + DWORD Caps; + DWORD Caps2; + DWORD Caps3; + DWORD PresentationIntervals; + + /* Cursor Caps */ + DWORD CursorCaps; + + /* 3D Device Caps */ + DWORD DevCaps; + + DWORD PrimitiveMiscCaps; + DWORD RasterCaps; + DWORD ZCmpCaps; + DWORD SrcBlendCaps; + DWORD DestBlendCaps; + DWORD AlphaCmpCaps; + DWORD ShadeCaps; + DWORD TextureCaps; + DWORD TextureFilterCaps; // D3DPTFILTERCAPS for IDirect3DTexture9's + DWORD CubeTextureFilterCaps; // D3DPTFILTERCAPS for IDirect3DCubeTexture9's + DWORD VolumeTextureFilterCaps; // D3DPTFILTERCAPS for IDirect3DVolumeTexture9's + DWORD TextureAddressCaps; // D3DPTADDRESSCAPS for IDirect3DTexture9's + DWORD VolumeTextureAddressCaps; // D3DPTADDRESSCAPS for IDirect3DVolumeTexture9's + + DWORD LineCaps; // D3DLINECAPS + + DWORD MaxTextureWidth, MaxTextureHeight; + DWORD MaxVolumeExtent; + + DWORD MaxTextureRepeat; + DWORD MaxTextureAspectRatio; + DWORD MaxAnisotropy; + float MaxVertexW; + + float GuardBandLeft; + float GuardBandTop; + float GuardBandRight; + float GuardBandBottom; + + float ExtentsAdjust; + DWORD StencilCaps; + + DWORD FVFCaps; + DWORD TextureOpCaps; + DWORD MaxTextureBlendStages; + DWORD MaxSimultaneousTextures; + + DWORD VertexProcessingCaps; + DWORD MaxActiveLights; + DWORD MaxUserClipPlanes; + DWORD MaxVertexBlendMatrices; + DWORD MaxVertexBlendMatrixIndex; + + float MaxPointSize; + + DWORD MaxPrimitiveCount; // max number of primitives per DrawPrimitive call + DWORD MaxVertexIndex; + DWORD MaxStreams; + DWORD MaxStreamStride; // max stride for SetStreamSource + + DWORD VertexShaderVersion; + DWORD MaxVertexShaderConst; // number of vertex shader constant registers + + DWORD PixelShaderVersion; + float PixelShader1xMaxValue; // max value storable in registers of ps.1.x shaders + + // Here are the DX9 specific ones + DWORD DevCaps2; + + float MaxNpatchTessellationLevel; + DWORD Reserved5; + + UINT MasterAdapterOrdinal; // ordinal of master adaptor for adapter group + UINT AdapterOrdinalInGroup; // ordinal inside the adapter group + UINT NumberOfAdaptersInGroup; // number of adapters in this adapter group (only if master) + DWORD DeclTypes; // Data types, supported in vertex declarations + DWORD NumSimultaneousRTs; // Will be at least 1 + DWORD StretchRectFilterCaps; // Filter caps supported by StretchRect + D3DVSHADERCAPS2_0 VS20Caps; + D3DPSHADERCAPS2_0 PS20Caps; + DWORD VertexTextureFilterCaps; // D3DPTFILTERCAPS for IDirect3DTexture9's for texture, used in vertex shaders + DWORD MaxVShaderInstructionsExecuted; // maximum number of vertex shader instructions that can be executed + DWORD MaxPShaderInstructionsExecuted; // maximum number of pixel shader instructions that can be executed + DWORD MaxVertexShader30InstructionSlots; + DWORD MaxPixelShader30InstructionSlots; +} D3DCAPS9; + +// +// BIT DEFINES FOR D3DCAPS9 DWORD MEMBERS +// + +// +// Caps +// +#define D3DCAPS_OVERLAY 0x00000800L +#define D3DCAPS_READ_SCANLINE 0x00020000L + +// +// Caps2 +// +#define D3DCAPS2_FULLSCREENGAMMA 0x00020000L +#define D3DCAPS2_CANCALIBRATEGAMMA 0x00100000L +#define D3DCAPS2_RESERVED 0x02000000L +#define D3DCAPS2_CANMANAGERESOURCE 0x10000000L +#define D3DCAPS2_DYNAMICTEXTURES 0x20000000L +#define D3DCAPS2_CANAUTOGENMIPMAP 0x40000000L + +/* D3D9Ex only -- */ +#if !defined(D3D_DISABLE_9EX) + +#define D3DCAPS2_CANSHARERESOURCE 0x80000000L + +#endif // !D3D_DISABLE_9EX +/* -- D3D9Ex only */ + +// +// Caps3 +// +#define D3DCAPS3_RESERVED 0x8000001fL + +// Indicates that the device can respect the ALPHABLENDENABLE render state +// when fullscreen while using the FLIP or DISCARD swap effect. +// COPY and COPYVSYNC swap effects work whether or not this flag is set. +#define D3DCAPS3_ALPHA_FULLSCREEN_FLIP_OR_DISCARD 0x00000020L + +// Indicates that the device can perform a gamma correction from +// a windowed back buffer containing linear content to the sRGB desktop. +#define D3DCAPS3_LINEAR_TO_SRGB_PRESENTATION 0x00000080L + +#define D3DCAPS3_COPY_TO_VIDMEM 0x00000100L /* Device can acclerate copies from sysmem to local vidmem */ +#define D3DCAPS3_COPY_TO_SYSTEMMEM 0x00000200L /* Device can acclerate copies from local vidmem to sysmem */ +#define D3DCAPS3_DXVAHD 0x00000400L + + +// +// PresentationIntervals +// +#define D3DPRESENT_INTERVAL_DEFAULT 0x00000000L +#define D3DPRESENT_INTERVAL_ONE 0x00000001L +#define D3DPRESENT_INTERVAL_TWO 0x00000002L +#define D3DPRESENT_INTERVAL_THREE 0x00000004L +#define D3DPRESENT_INTERVAL_FOUR 0x00000008L +#define D3DPRESENT_INTERVAL_IMMEDIATE 0x80000000L + +// +// CursorCaps +// +// Driver supports HW color cursor in at least hi-res modes(height >=400) +#define D3DCURSORCAPS_COLOR 0x00000001L +// Driver supports HW cursor also in low-res modes(height < 400) +#define D3DCURSORCAPS_LOWRES 0x00000002L + +// +// DevCaps +// +#define D3DDEVCAPS_EXECUTESYSTEMMEMORY 0x00000010L /* Device can use execute buffers from system memory */ +#define D3DDEVCAPS_EXECUTEVIDEOMEMORY 0x00000020L /* Device can use execute buffers from video memory */ +#define D3DDEVCAPS_TLVERTEXSYSTEMMEMORY 0x00000040L /* Device can use TL buffers from system memory */ +#define D3DDEVCAPS_TLVERTEXVIDEOMEMORY 0x00000080L /* Device can use TL buffers from video memory */ +#define D3DDEVCAPS_TEXTURESYSTEMMEMORY 0x00000100L /* Device can texture from system memory */ +#define D3DDEVCAPS_TEXTUREVIDEOMEMORY 0x00000200L /* Device can texture from device memory */ +#define D3DDEVCAPS_DRAWPRIMTLVERTEX 0x00000400L /* Device can draw TLVERTEX primitives */ +#define D3DDEVCAPS_CANRENDERAFTERFLIP 0x00000800L /* Device can render without waiting for flip to complete */ +#define D3DDEVCAPS_TEXTURENONLOCALVIDMEM 0x00001000L /* Device can texture from nonlocal video memory */ +#define D3DDEVCAPS_DRAWPRIMITIVES2 0x00002000L /* Device can support DrawPrimitives2 */ +#define D3DDEVCAPS_SEPARATETEXTUREMEMORIES 0x00004000L /* Device is texturing from separate memory pools */ +#define D3DDEVCAPS_DRAWPRIMITIVES2EX 0x00008000L /* Device can support Extended DrawPrimitives2 i.e. DX7 compliant driver*/ +#define D3DDEVCAPS_HWTRANSFORMANDLIGHT 0x00010000L /* Device can support transformation and lighting in hardware and DRAWPRIMITIVES2EX must be also */ +#define D3DDEVCAPS_CANBLTSYSTONONLOCAL 0x00020000L /* Device supports a Tex Blt from system memory to non-local vidmem */ +#define D3DDEVCAPS_HWRASTERIZATION 0x00080000L /* Device has HW acceleration for rasterization */ +#define D3DDEVCAPS_PUREDEVICE 0x00100000L /* Device supports D3DCREATE_PUREDEVICE */ +#define D3DDEVCAPS_QUINTICRTPATCHES 0x00200000L /* Device supports quintic Beziers and BSplines */ +#define D3DDEVCAPS_RTPATCHES 0x00400000L /* Device supports Rect and Tri patches */ +#define D3DDEVCAPS_RTPATCHHANDLEZERO 0x00800000L /* Indicates that RT Patches may be drawn efficiently using handle 0 */ +#define D3DDEVCAPS_NPATCHES 0x01000000L /* Device supports N-Patches */ + +// +// PrimitiveMiscCaps +// +#define D3DPMISCCAPS_MASKZ 0x00000002L +#define D3DPMISCCAPS_CULLNONE 0x00000010L +#define D3DPMISCCAPS_CULLCW 0x00000020L +#define D3DPMISCCAPS_CULLCCW 0x00000040L +#define D3DPMISCCAPS_COLORWRITEENABLE 0x00000080L +#define D3DPMISCCAPS_CLIPPLANESCALEDPOINTS 0x00000100L /* Device correctly clips scaled points to clip planes */ +#define D3DPMISCCAPS_CLIPTLVERTS 0x00000200L /* device will clip post-transformed vertex primitives */ +#define D3DPMISCCAPS_TSSARGTEMP 0x00000400L /* device supports D3DTA_TEMP for temporary register */ +#define D3DPMISCCAPS_BLENDOP 0x00000800L /* device supports D3DRS_BLENDOP */ +#define D3DPMISCCAPS_NULLREFERENCE 0x00001000L /* Reference Device that doesnt render */ +#define D3DPMISCCAPS_INDEPENDENTWRITEMASKS 0x00004000L /* Device supports independent write masks for MET or MRT */ +#define D3DPMISCCAPS_PERSTAGECONSTANT 0x00008000L /* Device supports per-stage constants */ +#define D3DPMISCCAPS_FOGANDSPECULARALPHA 0x00010000L /* Device supports separate fog and specular alpha (many devices + use the specular alpha channel to store fog factor) */ +#define D3DPMISCCAPS_SEPARATEALPHABLEND 0x00020000L /* Device supports separate blend settings for the alpha channel */ +#define D3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS 0x00040000L /* Device supports different bit depths for MRT */ +#define D3DPMISCCAPS_MRTPOSTPIXELSHADERBLENDING 0x00080000L /* Device supports post-pixel shader operations for MRT */ +#define D3DPMISCCAPS_FOGVERTEXCLAMPED 0x00100000L /* Device clamps fog blend factor per vertex */ + +/* D3D9Ex only -- */ +#if !defined(D3D_DISABLE_9EX) + +#define D3DPMISCCAPS_POSTBLENDSRGBCONVERT 0x00200000L /* Indicates device can perform conversion to sRGB after blending. */ + +#endif // !D3D_DISABLE_9EX +/* -- D3D9Ex only */ + + +// +// LineCaps +// +#define D3DLINECAPS_TEXTURE 0x00000001L +#define D3DLINECAPS_ZTEST 0x00000002L +#define D3DLINECAPS_BLEND 0x00000004L +#define D3DLINECAPS_ALPHACMP 0x00000008L +#define D3DLINECAPS_FOG 0x00000010L +#define D3DLINECAPS_ANTIALIAS 0x00000020L + +// +// RasterCaps +// +#define D3DPRASTERCAPS_DITHER 0x00000001L +#define D3DPRASTERCAPS_ZTEST 0x00000010L +#define D3DPRASTERCAPS_FOGVERTEX 0x00000080L +#define D3DPRASTERCAPS_FOGTABLE 0x00000100L +#define D3DPRASTERCAPS_MIPMAPLODBIAS 0x00002000L +#define D3DPRASTERCAPS_ZBUFFERLESSHSR 0x00008000L +#define D3DPRASTERCAPS_FOGRANGE 0x00010000L +#define D3DPRASTERCAPS_ANISOTROPY 0x00020000L +#define D3DPRASTERCAPS_WBUFFER 0x00040000L +#define D3DPRASTERCAPS_WFOG 0x00100000L +#define D3DPRASTERCAPS_ZFOG 0x00200000L +#define D3DPRASTERCAPS_COLORPERSPECTIVE 0x00400000L /* Device iterates colors perspective correct */ +#define D3DPRASTERCAPS_SCISSORTEST 0x01000000L +#define D3DPRASTERCAPS_SLOPESCALEDEPTHBIAS 0x02000000L +#define D3DPRASTERCAPS_DEPTHBIAS 0x04000000L +#define D3DPRASTERCAPS_MULTISAMPLE_TOGGLE 0x08000000L + +// +// ZCmpCaps, AlphaCmpCaps +// +#define D3DPCMPCAPS_NEVER 0x00000001L +#define D3DPCMPCAPS_LESS 0x00000002L +#define D3DPCMPCAPS_EQUAL 0x00000004L +#define D3DPCMPCAPS_LESSEQUAL 0x00000008L +#define D3DPCMPCAPS_GREATER 0x00000010L +#define D3DPCMPCAPS_NOTEQUAL 0x00000020L +#define D3DPCMPCAPS_GREATEREQUAL 0x00000040L +#define D3DPCMPCAPS_ALWAYS 0x00000080L + +// +// SourceBlendCaps, DestBlendCaps +// +#define D3DPBLENDCAPS_ZERO 0x00000001L +#define D3DPBLENDCAPS_ONE 0x00000002L +#define D3DPBLENDCAPS_SRCCOLOR 0x00000004L +#define D3DPBLENDCAPS_INVSRCCOLOR 0x00000008L +#define D3DPBLENDCAPS_SRCALPHA 0x00000010L +#define D3DPBLENDCAPS_INVSRCALPHA 0x00000020L +#define D3DPBLENDCAPS_DESTALPHA 0x00000040L +#define D3DPBLENDCAPS_INVDESTALPHA 0x00000080L +#define D3DPBLENDCAPS_DESTCOLOR 0x00000100L +#define D3DPBLENDCAPS_INVDESTCOLOR 0x00000200L +#define D3DPBLENDCAPS_SRCALPHASAT 0x00000400L +#define D3DPBLENDCAPS_BOTHSRCALPHA 0x00000800L +#define D3DPBLENDCAPS_BOTHINVSRCALPHA 0x00001000L +#define D3DPBLENDCAPS_BLENDFACTOR 0x00002000L /* Supports both D3DBLEND_BLENDFACTOR and D3DBLEND_INVBLENDFACTOR */ + +/* D3D9Ex only -- */ +#if !defined(D3D_DISABLE_9EX) + +#define D3DPBLENDCAPS_SRCCOLOR2 0x00004000L +#define D3DPBLENDCAPS_INVSRCCOLOR2 0x00008000L + +#endif // !D3D_DISABLE_9EX +/* -- D3D9Ex only */ + + +// +// ShadeCaps +// +#define D3DPSHADECAPS_COLORGOURAUDRGB 0x00000008L +#define D3DPSHADECAPS_SPECULARGOURAUDRGB 0x00000200L +#define D3DPSHADECAPS_ALPHAGOURAUDBLEND 0x00004000L +#define D3DPSHADECAPS_FOGGOURAUD 0x00080000L + +// +// TextureCaps +// +#define D3DPTEXTURECAPS_PERSPECTIVE 0x00000001L /* Perspective-correct texturing is supported */ +#define D3DPTEXTURECAPS_POW2 0x00000002L /* Power-of-2 texture dimensions are required - applies to non-Cube/Volume textures only. */ +#define D3DPTEXTURECAPS_ALPHA 0x00000004L /* Alpha in texture pixels is supported */ +#define D3DPTEXTURECAPS_SQUAREONLY 0x00000020L /* Only square textures are supported */ +#define D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE 0x00000040L /* Texture indices are not scaled by the texture size prior to interpolation */ +#define D3DPTEXTURECAPS_ALPHAPALETTE 0x00000080L /* Device can draw alpha from texture palettes */ +// Device can use non-POW2 textures if: +// 1) D3DTEXTURE_ADDRESS is set to CLAMP for this texture's stage +// 2) D3DRS_WRAP(N) is zero for this texture's coordinates +// 3) mip mapping is not enabled (use magnification filter only) +#define D3DPTEXTURECAPS_NONPOW2CONDITIONAL 0x00000100L +#define D3DPTEXTURECAPS_PROJECTED 0x00000400L /* Device can do D3DTTFF_PROJECTED */ +#define D3DPTEXTURECAPS_CUBEMAP 0x00000800L /* Device can do cubemap textures */ +#define D3DPTEXTURECAPS_VOLUMEMAP 0x00002000L /* Device can do volume textures */ +#define D3DPTEXTURECAPS_MIPMAP 0x00004000L /* Device can do mipmapped textures */ +#define D3DPTEXTURECAPS_MIPVOLUMEMAP 0x00008000L /* Device can do mipmapped volume textures */ +#define D3DPTEXTURECAPS_MIPCUBEMAP 0x00010000L /* Device can do mipmapped cube maps */ +#define D3DPTEXTURECAPS_CUBEMAP_POW2 0x00020000L /* Device requires that cubemaps be power-of-2 dimension */ +#define D3DPTEXTURECAPS_VOLUMEMAP_POW2 0x00040000L /* Device requires that volume maps be power-of-2 dimension */ +#define D3DPTEXTURECAPS_NOPROJECTEDBUMPENV 0x00200000L /* Device does not support projected bump env lookup operation + in programmable and fixed function pixel shaders */ + +// +// TextureFilterCaps, StretchRectFilterCaps +// +#define D3DPTFILTERCAPS_MINFPOINT 0x00000100L /* Min Filter */ +#define D3DPTFILTERCAPS_MINFLINEAR 0x00000200L +#define D3DPTFILTERCAPS_MINFANISOTROPIC 0x00000400L +#define D3DPTFILTERCAPS_MINFPYRAMIDALQUAD 0x00000800L +#define D3DPTFILTERCAPS_MINFGAUSSIANQUAD 0x00001000L +#define D3DPTFILTERCAPS_MIPFPOINT 0x00010000L /* Mip Filter */ +#define D3DPTFILTERCAPS_MIPFLINEAR 0x00020000L + +/* D3D9Ex only -- */ +#if !defined(D3D_DISABLE_9EX) + +#define D3DPTFILTERCAPS_CONVOLUTIONMONO 0x00040000L /* Min and Mag for the convolution mono filter */ + +#endif // !D3D_DISABLE_9EX +/* -- D3D9Ex only */ + +#define D3DPTFILTERCAPS_MAGFPOINT 0x01000000L /* Mag Filter */ +#define D3DPTFILTERCAPS_MAGFLINEAR 0x02000000L +#define D3DPTFILTERCAPS_MAGFANISOTROPIC 0x04000000L +#define D3DPTFILTERCAPS_MAGFPYRAMIDALQUAD 0x08000000L +#define D3DPTFILTERCAPS_MAGFGAUSSIANQUAD 0x10000000L + +// +// TextureAddressCaps +// +#define D3DPTADDRESSCAPS_WRAP 0x00000001L +#define D3DPTADDRESSCAPS_MIRROR 0x00000002L +#define D3DPTADDRESSCAPS_CLAMP 0x00000004L +#define D3DPTADDRESSCAPS_BORDER 0x00000008L +#define D3DPTADDRESSCAPS_INDEPENDENTUV 0x00000010L +#define D3DPTADDRESSCAPS_MIRRORONCE 0x00000020L + +// +// StencilCaps +// +#define D3DSTENCILCAPS_KEEP 0x00000001L +#define D3DSTENCILCAPS_ZERO 0x00000002L +#define D3DSTENCILCAPS_REPLACE 0x00000004L +#define D3DSTENCILCAPS_INCRSAT 0x00000008L +#define D3DSTENCILCAPS_DECRSAT 0x00000010L +#define D3DSTENCILCAPS_INVERT 0x00000020L +#define D3DSTENCILCAPS_INCR 0x00000040L +#define D3DSTENCILCAPS_DECR 0x00000080L +#define D3DSTENCILCAPS_TWOSIDED 0x00000100L + +// +// TextureOpCaps +// +#define D3DTEXOPCAPS_DISABLE 0x00000001L +#define D3DTEXOPCAPS_SELECTARG1 0x00000002L +#define D3DTEXOPCAPS_SELECTARG2 0x00000004L +#define D3DTEXOPCAPS_MODULATE 0x00000008L +#define D3DTEXOPCAPS_MODULATE2X 0x00000010L +#define D3DTEXOPCAPS_MODULATE4X 0x00000020L +#define D3DTEXOPCAPS_ADD 0x00000040L +#define D3DTEXOPCAPS_ADDSIGNED 0x00000080L +#define D3DTEXOPCAPS_ADDSIGNED2X 0x00000100L +#define D3DTEXOPCAPS_SUBTRACT 0x00000200L +#define D3DTEXOPCAPS_ADDSMOOTH 0x00000400L +#define D3DTEXOPCAPS_BLENDDIFFUSEALPHA 0x00000800L +#define D3DTEXOPCAPS_BLENDTEXTUREALPHA 0x00001000L +#define D3DTEXOPCAPS_BLENDFACTORALPHA 0x00002000L +#define D3DTEXOPCAPS_BLENDTEXTUREALPHAPM 0x00004000L +#define D3DTEXOPCAPS_BLENDCURRENTALPHA 0x00008000L +#define D3DTEXOPCAPS_PREMODULATE 0x00010000L +#define D3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR 0x00020000L +#define D3DTEXOPCAPS_MODULATECOLOR_ADDALPHA 0x00040000L +#define D3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR 0x00080000L +#define D3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA 0x00100000L +#define D3DTEXOPCAPS_BUMPENVMAP 0x00200000L +#define D3DTEXOPCAPS_BUMPENVMAPLUMINANCE 0x00400000L +#define D3DTEXOPCAPS_DOTPRODUCT3 0x00800000L +#define D3DTEXOPCAPS_MULTIPLYADD 0x01000000L +#define D3DTEXOPCAPS_LERP 0x02000000L + +// +// FVFCaps +// +#define D3DFVFCAPS_TEXCOORDCOUNTMASK 0x0000ffffL /* mask for texture coordinate count field */ +#define D3DFVFCAPS_DONOTSTRIPELEMENTS 0x00080000L /* Device prefers that vertex elements not be stripped */ +#define D3DFVFCAPS_PSIZE 0x00100000L /* Device can receive point size */ + +// +// VertexProcessingCaps +// +#define D3DVTXPCAPS_TEXGEN 0x00000001L /* device can do texgen */ +#define D3DVTXPCAPS_MATERIALSOURCE7 0x00000002L /* device can do DX7-level colormaterialsource ops */ +#define D3DVTXPCAPS_DIRECTIONALLIGHTS 0x00000008L /* device can do directional lights */ +#define D3DVTXPCAPS_POSITIONALLIGHTS 0x00000010L /* device can do positional lights (includes point and spot) */ +#define D3DVTXPCAPS_LOCALVIEWER 0x00000020L /* device can do local viewer */ +#define D3DVTXPCAPS_TWEENING 0x00000040L /* device can do vertex tweening */ +#define D3DVTXPCAPS_TEXGEN_SPHEREMAP 0x00000100L /* device supports D3DTSS_TCI_SPHEREMAP */ +#define D3DVTXPCAPS_NO_TEXGEN_NONLOCALVIEWER 0x00000200L /* device does not support TexGen in non-local + viewer mode */ + +// +// DevCaps2 +// +#define D3DDEVCAPS2_STREAMOFFSET 0x00000001L /* Device supports offsets in streams. Must be set by DX9 drivers */ +#define D3DDEVCAPS2_DMAPNPATCH 0x00000002L /* Device supports displacement maps for N-Patches*/ +#define D3DDEVCAPS2_ADAPTIVETESSRTPATCH 0x00000004L /* Device supports adaptive tesselation of RT-patches*/ +#define D3DDEVCAPS2_ADAPTIVETESSNPATCH 0x00000008L /* Device supports adaptive tesselation of N-patches*/ +#define D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES 0x00000010L /* Device supports StretchRect calls with a texture as the source*/ +#define D3DDEVCAPS2_PRESAMPLEDDMAPNPATCH 0x00000020L /* Device supports presampled displacement maps for N-Patches */ +#define D3DDEVCAPS2_VERTEXELEMENTSCANSHARESTREAMOFFSET 0x00000040L /* Vertex elements in a vertex declaration can share the same stream offset */ + +// +// DeclTypes +// +#define D3DDTCAPS_UBYTE4 0x00000001L +#define D3DDTCAPS_UBYTE4N 0x00000002L +#define D3DDTCAPS_SHORT2N 0x00000004L +#define D3DDTCAPS_SHORT4N 0x00000008L +#define D3DDTCAPS_USHORT2N 0x00000010L +#define D3DDTCAPS_USHORT4N 0x00000020L +#define D3DDTCAPS_UDEC3 0x00000040L +#define D3DDTCAPS_DEC3N 0x00000080L +#define D3DDTCAPS_FLOAT16_2 0x00000100L +#define D3DDTCAPS_FLOAT16_4 0x00000200L + + +#pragma pack() + +#endif /* (DIRECT3D_VERSION >= 0x0900) */ +#endif /* _d3d9CAPS_H_ */ + diff --git a/MediaClient/MediaClient/directx/include/d3d9types.h b/MediaClient/MediaClient/directx/include/d3d9types.h new file mode 100644 index 0000000..4dd3cfa --- /dev/null +++ b/MediaClient/MediaClient/directx/include/d3d9types.h @@ -0,0 +1,2416 @@ +/*==========================================================================; + * + * Copyright (C) Microsoft Corporation. All Rights Reserved. + * + * File: d3d9types.h + * Content: Direct3D capabilities include file + * + ***************************************************************************/ + +#ifndef _d3d9TYPES_H_ +#define _d3d9TYPES_H_ + +#ifndef DIRECT3D_VERSION +#define DIRECT3D_VERSION 0x0900 +#endif //DIRECT3D_VERSION + +// include this file content only if compiling for DX9 interfaces +#if(DIRECT3D_VERSION >= 0x0900) + +#include + +#if _MSC_VER >= 1200 +#pragma warning(push) +#endif +#pragma warning(disable:4201) // anonymous unions warning +#if defined(_X86_) || defined(_IA64_) +#pragma pack(4) +#endif + +// D3DCOLOR is equivalent to D3DFMT_A8R8G8B8 +#ifndef D3DCOLOR_DEFINED +typedef DWORD D3DCOLOR; +#define D3DCOLOR_DEFINED +#endif + +// maps unsigned 8 bits/channel to D3DCOLOR +#define D3DCOLOR_ARGB(a,r,g,b) \ + ((D3DCOLOR)((((a)&0xff)<<24)|(((r)&0xff)<<16)|(((g)&0xff)<<8)|((b)&0xff))) +#define D3DCOLOR_RGBA(r,g,b,a) D3DCOLOR_ARGB(a,r,g,b) +#define D3DCOLOR_XRGB(r,g,b) D3DCOLOR_ARGB(0xff,r,g,b) + +#define D3DCOLOR_XYUV(y,u,v) D3DCOLOR_ARGB(0xff,y,u,v) +#define D3DCOLOR_AYUV(a,y,u,v) D3DCOLOR_ARGB(a,y,u,v) + +// maps floating point channels (0.f to 1.f range) to D3DCOLOR +#define D3DCOLOR_COLORVALUE(r,g,b,a) \ + D3DCOLOR_RGBA((DWORD)((r)*255.f),(DWORD)((g)*255.f),(DWORD)((b)*255.f),(DWORD)((a)*255.f)) + + +#ifndef D3DVECTOR_DEFINED +typedef struct _D3DVECTOR { + float x; + float y; + float z; +} D3DVECTOR; +#define D3DVECTOR_DEFINED +#endif + +#ifndef D3DCOLORVALUE_DEFINED +typedef struct _D3DCOLORVALUE { + float r; + float g; + float b; + float a; +} D3DCOLORVALUE; +#define D3DCOLORVALUE_DEFINED +#endif + +#ifndef D3DRECT_DEFINED +typedef struct _D3DRECT { + LONG x1; + LONG y1; + LONG x2; + LONG y2; +} D3DRECT; +#define D3DRECT_DEFINED +#endif + +#ifndef D3DMATRIX_DEFINED +typedef struct _D3DMATRIX { + union { + struct { + float _11, _12, _13, _14; + float _21, _22, _23, _24; + float _31, _32, _33, _34; + float _41, _42, _43, _44; + + }; + float m[4][4]; + }; +} D3DMATRIX; +#define D3DMATRIX_DEFINED +#endif + +typedef struct _D3DVIEWPORT9 { + DWORD X; + DWORD Y; /* Viewport Top left */ + DWORD Width; + DWORD Height; /* Viewport Dimensions */ + float MinZ; /* Min/max of clip Volume */ + float MaxZ; +} D3DVIEWPORT9; + +/* + * Values for clip fields. + */ + +// Max number of user clipping planes, supported in D3D. +#define D3DMAXUSERCLIPPLANES 32 + +// These bits could be ORed together to use with D3DRS_CLIPPLANEENABLE +// +#define D3DCLIPPLANE0 (1 << 0) +#define D3DCLIPPLANE1 (1 << 1) +#define D3DCLIPPLANE2 (1 << 2) +#define D3DCLIPPLANE3 (1 << 3) +#define D3DCLIPPLANE4 (1 << 4) +#define D3DCLIPPLANE5 (1 << 5) + +// The following bits are used in the ClipUnion and ClipIntersection +// members of the D3DCLIPSTATUS9 +// + +#define D3DCS_LEFT 0x00000001L +#define D3DCS_RIGHT 0x00000002L +#define D3DCS_TOP 0x00000004L +#define D3DCS_BOTTOM 0x00000008L +#define D3DCS_FRONT 0x00000010L +#define D3DCS_BACK 0x00000020L +#define D3DCS_PLANE0 0x00000040L +#define D3DCS_PLANE1 0x00000080L +#define D3DCS_PLANE2 0x00000100L +#define D3DCS_PLANE3 0x00000200L +#define D3DCS_PLANE4 0x00000400L +#define D3DCS_PLANE5 0x00000800L + +#define D3DCS_ALL (D3DCS_LEFT | \ + D3DCS_RIGHT | \ + D3DCS_TOP | \ + D3DCS_BOTTOM | \ + D3DCS_FRONT | \ + D3DCS_BACK | \ + D3DCS_PLANE0 | \ + D3DCS_PLANE1 | \ + D3DCS_PLANE2 | \ + D3DCS_PLANE3 | \ + D3DCS_PLANE4 | \ + D3DCS_PLANE5) + +typedef struct _D3DCLIPSTATUS9 { + DWORD ClipUnion; + DWORD ClipIntersection; +} D3DCLIPSTATUS9; + +typedef struct _D3DMATERIAL9 { + D3DCOLORVALUE Diffuse; /* Diffuse color RGBA */ + D3DCOLORVALUE Ambient; /* Ambient color RGB */ + D3DCOLORVALUE Specular; /* Specular 'shininess' */ + D3DCOLORVALUE Emissive; /* Emissive color RGB */ + float Power; /* Sharpness if specular highlight */ +} D3DMATERIAL9; + +typedef enum _D3DLIGHTTYPE { + D3DLIGHT_POINT = 1, + D3DLIGHT_SPOT = 2, + D3DLIGHT_DIRECTIONAL = 3, + D3DLIGHT_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DLIGHTTYPE; + +typedef struct _D3DLIGHT9 { + D3DLIGHTTYPE Type; /* Type of light source */ + D3DCOLORVALUE Diffuse; /* Diffuse color of light */ + D3DCOLORVALUE Specular; /* Specular color of light */ + D3DCOLORVALUE Ambient; /* Ambient color of light */ + D3DVECTOR Position; /* Position in world space */ + D3DVECTOR Direction; /* Direction in world space */ + float Range; /* Cutoff range */ + float Falloff; /* Falloff */ + float Attenuation0; /* Constant attenuation */ + float Attenuation1; /* Linear attenuation */ + float Attenuation2; /* Quadratic attenuation */ + float Theta; /* Inner angle of spotlight cone */ + float Phi; /* Outer angle of spotlight cone */ +} D3DLIGHT9; + +/* + * Options for clearing + */ +#define D3DCLEAR_TARGET 0x00000001l /* Clear target surface */ +#define D3DCLEAR_ZBUFFER 0x00000002l /* Clear target z buffer */ +#define D3DCLEAR_STENCIL 0x00000004l /* Clear stencil planes */ + +/* + * The following defines the rendering states + */ + +typedef enum _D3DSHADEMODE { + D3DSHADE_FLAT = 1, + D3DSHADE_GOURAUD = 2, + D3DSHADE_PHONG = 3, + D3DSHADE_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DSHADEMODE; + +typedef enum _D3DFILLMODE { + D3DFILL_POINT = 1, + D3DFILL_WIREFRAME = 2, + D3DFILL_SOLID = 3, + D3DFILL_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DFILLMODE; + +typedef enum _D3DBLEND { + D3DBLEND_ZERO = 1, + D3DBLEND_ONE = 2, + D3DBLEND_SRCCOLOR = 3, + D3DBLEND_INVSRCCOLOR = 4, + D3DBLEND_SRCALPHA = 5, + D3DBLEND_INVSRCALPHA = 6, + D3DBLEND_DESTALPHA = 7, + D3DBLEND_INVDESTALPHA = 8, + D3DBLEND_DESTCOLOR = 9, + D3DBLEND_INVDESTCOLOR = 10, + D3DBLEND_SRCALPHASAT = 11, + D3DBLEND_BOTHSRCALPHA = 12, + D3DBLEND_BOTHINVSRCALPHA = 13, + D3DBLEND_BLENDFACTOR = 14, /* Only supported if D3DPBLENDCAPS_BLENDFACTOR is on */ + D3DBLEND_INVBLENDFACTOR = 15, /* Only supported if D3DPBLENDCAPS_BLENDFACTOR is on */ +/* D3D9Ex only -- */ +#if !defined(D3D_DISABLE_9EX) + + D3DBLEND_SRCCOLOR2 = 16, + D3DBLEND_INVSRCCOLOR2 = 17, + +#endif // !D3D_DISABLE_9EX +/* -- D3D9Ex only */ + D3DBLEND_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DBLEND; + +typedef enum _D3DBLENDOP { + D3DBLENDOP_ADD = 1, + D3DBLENDOP_SUBTRACT = 2, + D3DBLENDOP_REVSUBTRACT = 3, + D3DBLENDOP_MIN = 4, + D3DBLENDOP_MAX = 5, + D3DBLENDOP_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DBLENDOP; + +typedef enum _D3DTEXTUREADDRESS { + D3DTADDRESS_WRAP = 1, + D3DTADDRESS_MIRROR = 2, + D3DTADDRESS_CLAMP = 3, + D3DTADDRESS_BORDER = 4, + D3DTADDRESS_MIRRORONCE = 5, + D3DTADDRESS_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DTEXTUREADDRESS; + +typedef enum _D3DCULL { + D3DCULL_NONE = 1, + D3DCULL_CW = 2, + D3DCULL_CCW = 3, + D3DCULL_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DCULL; + +typedef enum _D3DCMPFUNC { + D3DCMP_NEVER = 1, + D3DCMP_LESS = 2, + D3DCMP_EQUAL = 3, + D3DCMP_LESSEQUAL = 4, + D3DCMP_GREATER = 5, + D3DCMP_NOTEQUAL = 6, + D3DCMP_GREATEREQUAL = 7, + D3DCMP_ALWAYS = 8, + D3DCMP_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DCMPFUNC; + +typedef enum _D3DSTENCILOP { + D3DSTENCILOP_KEEP = 1, + D3DSTENCILOP_ZERO = 2, + D3DSTENCILOP_REPLACE = 3, + D3DSTENCILOP_INCRSAT = 4, + D3DSTENCILOP_DECRSAT = 5, + D3DSTENCILOP_INVERT = 6, + D3DSTENCILOP_INCR = 7, + D3DSTENCILOP_DECR = 8, + D3DSTENCILOP_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DSTENCILOP; + +typedef enum _D3DFOGMODE { + D3DFOG_NONE = 0, + D3DFOG_EXP = 1, + D3DFOG_EXP2 = 2, + D3DFOG_LINEAR = 3, + D3DFOG_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DFOGMODE; + +typedef enum _D3DZBUFFERTYPE { + D3DZB_FALSE = 0, + D3DZB_TRUE = 1, // Z buffering + D3DZB_USEW = 2, // W buffering + D3DZB_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DZBUFFERTYPE; + +// Primitives supported by draw-primitive API +typedef enum _D3DPRIMITIVETYPE { + D3DPT_POINTLIST = 1, + D3DPT_LINELIST = 2, + D3DPT_LINESTRIP = 3, + D3DPT_TRIANGLELIST = 4, + D3DPT_TRIANGLESTRIP = 5, + D3DPT_TRIANGLEFAN = 6, + D3DPT_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DPRIMITIVETYPE; + +typedef enum _D3DTRANSFORMSTATETYPE { + D3DTS_VIEW = 2, + D3DTS_PROJECTION = 3, + D3DTS_TEXTURE0 = 16, + D3DTS_TEXTURE1 = 17, + D3DTS_TEXTURE2 = 18, + D3DTS_TEXTURE3 = 19, + D3DTS_TEXTURE4 = 20, + D3DTS_TEXTURE5 = 21, + D3DTS_TEXTURE6 = 22, + D3DTS_TEXTURE7 = 23, + D3DTS_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DTRANSFORMSTATETYPE; + +#define D3DTS_WORLDMATRIX(index) (D3DTRANSFORMSTATETYPE)(index + 256) +#define D3DTS_WORLD D3DTS_WORLDMATRIX(0) +#define D3DTS_WORLD1 D3DTS_WORLDMATRIX(1) +#define D3DTS_WORLD2 D3DTS_WORLDMATRIX(2) +#define D3DTS_WORLD3 D3DTS_WORLDMATRIX(3) + +typedef enum _D3DRENDERSTATETYPE { + D3DRS_ZENABLE = 7, /* D3DZBUFFERTYPE (or TRUE/FALSE for legacy) */ + D3DRS_FILLMODE = 8, /* D3DFILLMODE */ + D3DRS_SHADEMODE = 9, /* D3DSHADEMODE */ + D3DRS_ZWRITEENABLE = 14, /* TRUE to enable z writes */ + D3DRS_ALPHATESTENABLE = 15, /* TRUE to enable alpha tests */ + D3DRS_LASTPIXEL = 16, /* TRUE for last-pixel on lines */ + D3DRS_SRCBLEND = 19, /* D3DBLEND */ + D3DRS_DESTBLEND = 20, /* D3DBLEND */ + D3DRS_CULLMODE = 22, /* D3DCULL */ + D3DRS_ZFUNC = 23, /* D3DCMPFUNC */ + D3DRS_ALPHAREF = 24, /* D3DFIXED */ + D3DRS_ALPHAFUNC = 25, /* D3DCMPFUNC */ + D3DRS_DITHERENABLE = 26, /* TRUE to enable dithering */ + D3DRS_ALPHABLENDENABLE = 27, /* TRUE to enable alpha blending */ + D3DRS_FOGENABLE = 28, /* TRUE to enable fog blending */ + D3DRS_SPECULARENABLE = 29, /* TRUE to enable specular */ + D3DRS_FOGCOLOR = 34, /* D3DCOLOR */ + D3DRS_FOGTABLEMODE = 35, /* D3DFOGMODE */ + D3DRS_FOGSTART = 36, /* Fog start (for both vertex and pixel fog) */ + D3DRS_FOGEND = 37, /* Fog end */ + D3DRS_FOGDENSITY = 38, /* Fog density */ + D3DRS_RANGEFOGENABLE = 48, /* Enables range-based fog */ + D3DRS_STENCILENABLE = 52, /* BOOL enable/disable stenciling */ + D3DRS_STENCILFAIL = 53, /* D3DSTENCILOP to do if stencil test fails */ + D3DRS_STENCILZFAIL = 54, /* D3DSTENCILOP to do if stencil test passes and Z test fails */ + D3DRS_STENCILPASS = 55, /* D3DSTENCILOP to do if both stencil and Z tests pass */ + D3DRS_STENCILFUNC = 56, /* D3DCMPFUNC fn. Stencil Test passes if ((ref & mask) stencilfn (stencil & mask)) is true */ + D3DRS_STENCILREF = 57, /* Reference value used in stencil test */ + D3DRS_STENCILMASK = 58, /* Mask value used in stencil test */ + D3DRS_STENCILWRITEMASK = 59, /* Write mask applied to values written to stencil buffer */ + D3DRS_TEXTUREFACTOR = 60, /* D3DCOLOR used for multi-texture blend */ + D3DRS_WRAP0 = 128, /* wrap for 1st texture coord. set */ + D3DRS_WRAP1 = 129, /* wrap for 2nd texture coord. set */ + D3DRS_WRAP2 = 130, /* wrap for 3rd texture coord. set */ + D3DRS_WRAP3 = 131, /* wrap for 4th texture coord. set */ + D3DRS_WRAP4 = 132, /* wrap for 5th texture coord. set */ + D3DRS_WRAP5 = 133, /* wrap for 6th texture coord. set */ + D3DRS_WRAP6 = 134, /* wrap for 7th texture coord. set */ + D3DRS_WRAP7 = 135, /* wrap for 8th texture coord. set */ + D3DRS_CLIPPING = 136, + D3DRS_LIGHTING = 137, + D3DRS_AMBIENT = 139, + D3DRS_FOGVERTEXMODE = 140, + D3DRS_COLORVERTEX = 141, + D3DRS_LOCALVIEWER = 142, + D3DRS_NORMALIZENORMALS = 143, + D3DRS_DIFFUSEMATERIALSOURCE = 145, + D3DRS_SPECULARMATERIALSOURCE = 146, + D3DRS_AMBIENTMATERIALSOURCE = 147, + D3DRS_EMISSIVEMATERIALSOURCE = 148, + D3DRS_VERTEXBLEND = 151, + D3DRS_CLIPPLANEENABLE = 152, + D3DRS_POINTSIZE = 154, /* float point size */ + D3DRS_POINTSIZE_MIN = 155, /* float point size min threshold */ + D3DRS_POINTSPRITEENABLE = 156, /* BOOL point texture coord control */ + D3DRS_POINTSCALEENABLE = 157, /* BOOL point size scale enable */ + D3DRS_POINTSCALE_A = 158, /* float point attenuation A value */ + D3DRS_POINTSCALE_B = 159, /* float point attenuation B value */ + D3DRS_POINTSCALE_C = 160, /* float point attenuation C value */ + D3DRS_MULTISAMPLEANTIALIAS = 161, // BOOL - set to do FSAA with multisample buffer + D3DRS_MULTISAMPLEMASK = 162, // DWORD - per-sample enable/disable + D3DRS_PATCHEDGESTYLE = 163, // Sets whether patch edges will use float style tessellation + D3DRS_DEBUGMONITORTOKEN = 165, // DEBUG ONLY - token to debug monitor + D3DRS_POINTSIZE_MAX = 166, /* float point size max threshold */ + D3DRS_INDEXEDVERTEXBLENDENABLE = 167, + D3DRS_COLORWRITEENABLE = 168, // per-channel write enable + D3DRS_TWEENFACTOR = 170, // float tween factor + D3DRS_BLENDOP = 171, // D3DBLENDOP setting + D3DRS_POSITIONDEGREE = 172, // NPatch position interpolation degree. D3DDEGREE_LINEAR or D3DDEGREE_CUBIC (default) + D3DRS_NORMALDEGREE = 173, // NPatch normal interpolation degree. D3DDEGREE_LINEAR (default) or D3DDEGREE_QUADRATIC + D3DRS_SCISSORTESTENABLE = 174, + D3DRS_SLOPESCALEDEPTHBIAS = 175, + D3DRS_ANTIALIASEDLINEENABLE = 176, + D3DRS_MINTESSELLATIONLEVEL = 178, + D3DRS_MAXTESSELLATIONLEVEL = 179, + D3DRS_ADAPTIVETESS_X = 180, + D3DRS_ADAPTIVETESS_Y = 181, + D3DRS_ADAPTIVETESS_Z = 182, + D3DRS_ADAPTIVETESS_W = 183, + D3DRS_ENABLEADAPTIVETESSELLATION = 184, + D3DRS_TWOSIDEDSTENCILMODE = 185, /* BOOL enable/disable 2 sided stenciling */ + D3DRS_CCW_STENCILFAIL = 186, /* D3DSTENCILOP to do if ccw stencil test fails */ + D3DRS_CCW_STENCILZFAIL = 187, /* D3DSTENCILOP to do if ccw stencil test passes and Z test fails */ + D3DRS_CCW_STENCILPASS = 188, /* D3DSTENCILOP to do if both ccw stencil and Z tests pass */ + D3DRS_CCW_STENCILFUNC = 189, /* D3DCMPFUNC fn. ccw Stencil Test passes if ((ref & mask) stencilfn (stencil & mask)) is true */ + D3DRS_COLORWRITEENABLE1 = 190, /* Additional ColorWriteEnables for the devices that support D3DPMISCCAPS_INDEPENDENTWRITEMASKS */ + D3DRS_COLORWRITEENABLE2 = 191, /* Additional ColorWriteEnables for the devices that support D3DPMISCCAPS_INDEPENDENTWRITEMASKS */ + D3DRS_COLORWRITEENABLE3 = 192, /* Additional ColorWriteEnables for the devices that support D3DPMISCCAPS_INDEPENDENTWRITEMASKS */ + D3DRS_BLENDFACTOR = 193, /* D3DCOLOR used for a constant blend factor during alpha blending for devices that support D3DPBLENDCAPS_BLENDFACTOR */ + D3DRS_SRGBWRITEENABLE = 194, /* Enable rendertarget writes to be DE-linearized to SRGB (for formats that expose D3DUSAGE_QUERY_SRGBWRITE) */ + D3DRS_DEPTHBIAS = 195, + D3DRS_WRAP8 = 198, /* Additional wrap states for vs_3_0+ attributes with D3DDECLUSAGE_TEXCOORD */ + D3DRS_WRAP9 = 199, + D3DRS_WRAP10 = 200, + D3DRS_WRAP11 = 201, + D3DRS_WRAP12 = 202, + D3DRS_WRAP13 = 203, + D3DRS_WRAP14 = 204, + D3DRS_WRAP15 = 205, + D3DRS_SEPARATEALPHABLENDENABLE = 206, /* TRUE to enable a separate blending function for the alpha channel */ + D3DRS_SRCBLENDALPHA = 207, /* SRC blend factor for the alpha channel when D3DRS_SEPARATEDESTALPHAENABLE is TRUE */ + D3DRS_DESTBLENDALPHA = 208, /* DST blend factor for the alpha channel when D3DRS_SEPARATEDESTALPHAENABLE is TRUE */ + D3DRS_BLENDOPALPHA = 209, /* Blending operation for the alpha channel when D3DRS_SEPARATEDESTALPHAENABLE is TRUE */ + + + D3DRS_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DRENDERSTATETYPE; + +// Maximum number of simultaneous render targets D3D supports +#define D3D_MAX_SIMULTANEOUS_RENDERTARGETS 4 + +// Values for material source +typedef enum _D3DMATERIALCOLORSOURCE +{ + D3DMCS_MATERIAL = 0, // Color from material is used + D3DMCS_COLOR1 = 1, // Diffuse vertex color is used + D3DMCS_COLOR2 = 2, // Specular vertex color is used + D3DMCS_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum +} D3DMATERIALCOLORSOURCE; + +// Bias to apply to the texture coordinate set to apply a wrap to. +#define D3DRENDERSTATE_WRAPBIAS 128UL + +/* Flags to construct the WRAP render states */ +#define D3DWRAP_U 0x00000001L +#define D3DWRAP_V 0x00000002L +#define D3DWRAP_W 0x00000004L + +/* Flags to construct the WRAP render states for 1D thru 4D texture coordinates */ +#define D3DWRAPCOORD_0 0x00000001L // same as D3DWRAP_U +#define D3DWRAPCOORD_1 0x00000002L // same as D3DWRAP_V +#define D3DWRAPCOORD_2 0x00000004L // same as D3DWRAP_W +#define D3DWRAPCOORD_3 0x00000008L + +/* Flags to construct D3DRS_COLORWRITEENABLE */ +#define D3DCOLORWRITEENABLE_RED (1L<<0) +#define D3DCOLORWRITEENABLE_GREEN (1L<<1) +#define D3DCOLORWRITEENABLE_BLUE (1L<<2) +#define D3DCOLORWRITEENABLE_ALPHA (1L<<3) + +/* + * State enumerants for per-stage processing of fixed function pixel processing + * Two of these affect fixed function vertex processing as well: TEXTURETRANSFORMFLAGS and TEXCOORDINDEX. + */ +typedef enum _D3DTEXTURESTAGESTATETYPE +{ + D3DTSS_COLOROP = 1, /* D3DTEXTUREOP - per-stage blending controls for color channels */ + D3DTSS_COLORARG1 = 2, /* D3DTA_* (texture arg) */ + D3DTSS_COLORARG2 = 3, /* D3DTA_* (texture arg) */ + D3DTSS_ALPHAOP = 4, /* D3DTEXTUREOP - per-stage blending controls for alpha channel */ + D3DTSS_ALPHAARG1 = 5, /* D3DTA_* (texture arg) */ + D3DTSS_ALPHAARG2 = 6, /* D3DTA_* (texture arg) */ + D3DTSS_BUMPENVMAT00 = 7, /* float (bump mapping matrix) */ + D3DTSS_BUMPENVMAT01 = 8, /* float (bump mapping matrix) */ + D3DTSS_BUMPENVMAT10 = 9, /* float (bump mapping matrix) */ + D3DTSS_BUMPENVMAT11 = 10, /* float (bump mapping matrix) */ + D3DTSS_TEXCOORDINDEX = 11, /* identifies which set of texture coordinates index this texture */ + D3DTSS_BUMPENVLSCALE = 22, /* float scale for bump map luminance */ + D3DTSS_BUMPENVLOFFSET = 23, /* float offset for bump map luminance */ + D3DTSS_TEXTURETRANSFORMFLAGS = 24, /* D3DTEXTURETRANSFORMFLAGS controls texture transform */ + D3DTSS_COLORARG0 = 26, /* D3DTA_* third arg for triadic ops */ + D3DTSS_ALPHAARG0 = 27, /* D3DTA_* third arg for triadic ops */ + D3DTSS_RESULTARG = 28, /* D3DTA_* arg for result (CURRENT or TEMP) */ + D3DTSS_CONSTANT = 32, /* Per-stage constant D3DTA_CONSTANT */ + + + D3DTSS_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DTEXTURESTAGESTATETYPE; + +/* + * State enumerants for per-sampler texture processing. + */ +typedef enum _D3DSAMPLERSTATETYPE +{ + D3DSAMP_ADDRESSU = 1, /* D3DTEXTUREADDRESS for U coordinate */ + D3DSAMP_ADDRESSV = 2, /* D3DTEXTUREADDRESS for V coordinate */ + D3DSAMP_ADDRESSW = 3, /* D3DTEXTUREADDRESS for W coordinate */ + D3DSAMP_BORDERCOLOR = 4, /* D3DCOLOR */ + D3DSAMP_MAGFILTER = 5, /* D3DTEXTUREFILTER filter to use for magnification */ + D3DSAMP_MINFILTER = 6, /* D3DTEXTUREFILTER filter to use for minification */ + D3DSAMP_MIPFILTER = 7, /* D3DTEXTUREFILTER filter to use between mipmaps during minification */ + D3DSAMP_MIPMAPLODBIAS = 8, /* float Mipmap LOD bias */ + D3DSAMP_MAXMIPLEVEL = 9, /* DWORD 0..(n-1) LOD index of largest map to use (0 == largest) */ + D3DSAMP_MAXANISOTROPY = 10, /* DWORD maximum anisotropy */ + D3DSAMP_SRGBTEXTURE = 11, /* Default = 0 (which means Gamma 1.0, + no correction required.) else correct for + Gamma = 2.2 */ + D3DSAMP_ELEMENTINDEX = 12, /* When multi-element texture is assigned to sampler, this + indicates which element index to use. Default = 0. */ + D3DSAMP_DMAPOFFSET = 13, /* Offset in vertices in the pre-sampled displacement map. + Only valid for D3DDMAPSAMPLER sampler */ + D3DSAMP_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DSAMPLERSTATETYPE; + +/* Special sampler which is used in the tesselator */ +#define D3DDMAPSAMPLER 256 + +// Samplers used in vertex shaders +#define D3DVERTEXTEXTURESAMPLER0 (D3DDMAPSAMPLER+1) +#define D3DVERTEXTEXTURESAMPLER1 (D3DDMAPSAMPLER+2) +#define D3DVERTEXTEXTURESAMPLER2 (D3DDMAPSAMPLER+3) +#define D3DVERTEXTEXTURESAMPLER3 (D3DDMAPSAMPLER+4) + +// Values, used with D3DTSS_TEXCOORDINDEX, to specify that the vertex data(position +// and normal in the camera space) should be taken as texture coordinates +// Low 16 bits are used to specify texture coordinate index, to take the WRAP mode from +// +#define D3DTSS_TCI_PASSTHRU 0x00000000 +#define D3DTSS_TCI_CAMERASPACENORMAL 0x00010000 +#define D3DTSS_TCI_CAMERASPACEPOSITION 0x00020000 +#define D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR 0x00030000 +#define D3DTSS_TCI_SPHEREMAP 0x00040000 + +/* + * Enumerations for COLOROP and ALPHAOP texture blending operations set in + * texture processing stage controls in D3DTSS. + */ +typedef enum _D3DTEXTUREOP +{ + // Control + D3DTOP_DISABLE = 1, // disables stage + D3DTOP_SELECTARG1 = 2, // the default + D3DTOP_SELECTARG2 = 3, + + // Modulate + D3DTOP_MODULATE = 4, // multiply args together + D3DTOP_MODULATE2X = 5, // multiply and 1 bit + D3DTOP_MODULATE4X = 6, // multiply and 2 bits + + // Add + D3DTOP_ADD = 7, // add arguments together + D3DTOP_ADDSIGNED = 8, // add with -0.5 bias + D3DTOP_ADDSIGNED2X = 9, // as above but left 1 bit + D3DTOP_SUBTRACT = 10, // Arg1 - Arg2, with no saturation + D3DTOP_ADDSMOOTH = 11, // add 2 args, subtract product + // Arg1 + Arg2 - Arg1*Arg2 + // = Arg1 + (1-Arg1)*Arg2 + + // Linear alpha blend: Arg1*(Alpha) + Arg2*(1-Alpha) + D3DTOP_BLENDDIFFUSEALPHA = 12, // iterated alpha + D3DTOP_BLENDTEXTUREALPHA = 13, // texture alpha + D3DTOP_BLENDFACTORALPHA = 14, // alpha from D3DRS_TEXTUREFACTOR + + // Linear alpha blend with pre-multiplied arg1 input: Arg1 + Arg2*(1-Alpha) + D3DTOP_BLENDTEXTUREALPHAPM = 15, // texture alpha + D3DTOP_BLENDCURRENTALPHA = 16, // by alpha of current color + + // Specular mapping + D3DTOP_PREMODULATE = 17, // modulate with next texture before use + D3DTOP_MODULATEALPHA_ADDCOLOR = 18, // Arg1.RGB + Arg1.A*Arg2.RGB + // COLOROP only + D3DTOP_MODULATECOLOR_ADDALPHA = 19, // Arg1.RGB*Arg2.RGB + Arg1.A + // COLOROP only + D3DTOP_MODULATEINVALPHA_ADDCOLOR = 20, // (1-Arg1.A)*Arg2.RGB + Arg1.RGB + // COLOROP only + D3DTOP_MODULATEINVCOLOR_ADDALPHA = 21, // (1-Arg1.RGB)*Arg2.RGB + Arg1.A + // COLOROP only + + // Bump mapping + D3DTOP_BUMPENVMAP = 22, // per pixel env map perturbation + D3DTOP_BUMPENVMAPLUMINANCE = 23, // with luminance channel + + // This can do either diffuse or specular bump mapping with correct input. + // Performs the function (Arg1.R*Arg2.R + Arg1.G*Arg2.G + Arg1.B*Arg2.B) + // where each component has been scaled and offset to make it signed. + // The result is replicated into all four (including alpha) channels. + // This is a valid COLOROP only. + D3DTOP_DOTPRODUCT3 = 24, + + // Triadic ops + D3DTOP_MULTIPLYADD = 25, // Arg0 + Arg1*Arg2 + D3DTOP_LERP = 26, // (Arg0)*Arg1 + (1-Arg0)*Arg2 + + D3DTOP_FORCE_DWORD = 0x7fffffff, +} D3DTEXTUREOP; + +/* + * Values for COLORARG0,1,2, ALPHAARG0,1,2, and RESULTARG texture blending + * operations set in texture processing stage controls in D3DRENDERSTATE. + */ +#define D3DTA_SELECTMASK 0x0000000f // mask for arg selector +#define D3DTA_DIFFUSE 0x00000000 // select diffuse color (read only) +#define D3DTA_CURRENT 0x00000001 // select stage destination register (read/write) +#define D3DTA_TEXTURE 0x00000002 // select texture color (read only) +#define D3DTA_TFACTOR 0x00000003 // select D3DRS_TEXTUREFACTOR (read only) +#define D3DTA_SPECULAR 0x00000004 // select specular color (read only) +#define D3DTA_TEMP 0x00000005 // select temporary register color (read/write) +#define D3DTA_CONSTANT 0x00000006 // select texture stage constant +#define D3DTA_COMPLEMENT 0x00000010 // take 1.0 - x (read modifier) +#define D3DTA_ALPHAREPLICATE 0x00000020 // replicate alpha to color components (read modifier) + +// +// Values for D3DSAMP_***FILTER texture stage states +// +typedef enum _D3DTEXTUREFILTERTYPE +{ + D3DTEXF_NONE = 0, // filtering disabled (valid for mip filter only) + D3DTEXF_POINT = 1, // nearest + D3DTEXF_LINEAR = 2, // linear interpolation + D3DTEXF_ANISOTROPIC = 3, // anisotropic + D3DTEXF_PYRAMIDALQUAD = 6, // 4-sample tent + D3DTEXF_GAUSSIANQUAD = 7, // 4-sample gaussian +/* D3D9Ex only -- */ +#if !defined(D3D_DISABLE_9EX) + + D3DTEXF_CONVOLUTIONMONO = 8, // Convolution filter for monochrome textures + +#endif // !D3D_DISABLE_9EX +/* -- D3D9Ex only */ + D3DTEXF_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum +} D3DTEXTUREFILTERTYPE; + +/* Bits for Flags in ProcessVertices call */ + +#define D3DPV_DONOTCOPYDATA (1 << 0) + +//------------------------------------------------------------------- + +// Flexible vertex format bits +// +#define D3DFVF_RESERVED0 0x001 +#define D3DFVF_POSITION_MASK 0x400E +#define D3DFVF_XYZ 0x002 +#define D3DFVF_XYZRHW 0x004 +#define D3DFVF_XYZB1 0x006 +#define D3DFVF_XYZB2 0x008 +#define D3DFVF_XYZB3 0x00a +#define D3DFVF_XYZB4 0x00c +#define D3DFVF_XYZB5 0x00e +#define D3DFVF_XYZW 0x4002 + +#define D3DFVF_NORMAL 0x010 +#define D3DFVF_PSIZE 0x020 +#define D3DFVF_DIFFUSE 0x040 +#define D3DFVF_SPECULAR 0x080 + +#define D3DFVF_TEXCOUNT_MASK 0xf00 +#define D3DFVF_TEXCOUNT_SHIFT 8 +#define D3DFVF_TEX0 0x000 +#define D3DFVF_TEX1 0x100 +#define D3DFVF_TEX2 0x200 +#define D3DFVF_TEX3 0x300 +#define D3DFVF_TEX4 0x400 +#define D3DFVF_TEX5 0x500 +#define D3DFVF_TEX6 0x600 +#define D3DFVF_TEX7 0x700 +#define D3DFVF_TEX8 0x800 + +#define D3DFVF_LASTBETA_UBYTE4 0x1000 +#define D3DFVF_LASTBETA_D3DCOLOR 0x8000 + +#define D3DFVF_RESERVED2 0x6000 // 2 reserved bits + +//--------------------------------------------------------------------- +// Vertex Shaders +// + +// Vertex shader declaration + +// Vertex element semantics +// +typedef enum _D3DDECLUSAGE +{ + D3DDECLUSAGE_POSITION = 0, + D3DDECLUSAGE_BLENDWEIGHT, // 1 + D3DDECLUSAGE_BLENDINDICES, // 2 + D3DDECLUSAGE_NORMAL, // 3 + D3DDECLUSAGE_PSIZE, // 4 + D3DDECLUSAGE_TEXCOORD, // 5 + D3DDECLUSAGE_TANGENT, // 6 + D3DDECLUSAGE_BINORMAL, // 7 + D3DDECLUSAGE_TESSFACTOR, // 8 + D3DDECLUSAGE_POSITIONT, // 9 + D3DDECLUSAGE_COLOR, // 10 + D3DDECLUSAGE_FOG, // 11 + D3DDECLUSAGE_DEPTH, // 12 + D3DDECLUSAGE_SAMPLE, // 13 +} D3DDECLUSAGE; + +#define MAXD3DDECLUSAGE D3DDECLUSAGE_SAMPLE +#define MAXD3DDECLUSAGEINDEX 15 +#define MAXD3DDECLLENGTH 64 // does not include "end" marker vertex element + +typedef enum _D3DDECLMETHOD +{ + D3DDECLMETHOD_DEFAULT = 0, + D3DDECLMETHOD_PARTIALU, + D3DDECLMETHOD_PARTIALV, + D3DDECLMETHOD_CROSSUV, // Normal + D3DDECLMETHOD_UV, + D3DDECLMETHOD_LOOKUP, // Lookup a displacement map + D3DDECLMETHOD_LOOKUPPRESAMPLED, // Lookup a pre-sampled displacement map +} D3DDECLMETHOD; + +#define MAXD3DDECLMETHOD D3DDECLMETHOD_LOOKUPPRESAMPLED + +// Declarations for _Type fields +// +typedef enum _D3DDECLTYPE +{ + D3DDECLTYPE_FLOAT1 = 0, // 1D float expanded to (value, 0., 0., 1.) + D3DDECLTYPE_FLOAT2 = 1, // 2D float expanded to (value, value, 0., 1.) + D3DDECLTYPE_FLOAT3 = 2, // 3D float expanded to (value, value, value, 1.) + D3DDECLTYPE_FLOAT4 = 3, // 4D float + D3DDECLTYPE_D3DCOLOR = 4, // 4D packed unsigned bytes mapped to 0. to 1. range + // Input is in D3DCOLOR format (ARGB) expanded to (R, G, B, A) + D3DDECLTYPE_UBYTE4 = 5, // 4D unsigned byte + D3DDECLTYPE_SHORT2 = 6, // 2D signed short expanded to (value, value, 0., 1.) + D3DDECLTYPE_SHORT4 = 7, // 4D signed short + +// The following types are valid only with vertex shaders >= 2.0 + + + D3DDECLTYPE_UBYTE4N = 8, // Each of 4 bytes is normalized by dividing to 255.0 + D3DDECLTYPE_SHORT2N = 9, // 2D signed short normalized (v[0]/32767.0,v[1]/32767.0,0,1) + D3DDECLTYPE_SHORT4N = 10, // 4D signed short normalized (v[0]/32767.0,v[1]/32767.0,v[2]/32767.0,v[3]/32767.0) + D3DDECLTYPE_USHORT2N = 11, // 2D unsigned short normalized (v[0]/65535.0,v[1]/65535.0,0,1) + D3DDECLTYPE_USHORT4N = 12, // 4D unsigned short normalized (v[0]/65535.0,v[1]/65535.0,v[2]/65535.0,v[3]/65535.0) + D3DDECLTYPE_UDEC3 = 13, // 3D unsigned 10 10 10 format expanded to (value, value, value, 1) + D3DDECLTYPE_DEC3N = 14, // 3D signed 10 10 10 format normalized and expanded to (v[0]/511.0, v[1]/511.0, v[2]/511.0, 1) + D3DDECLTYPE_FLOAT16_2 = 15, // Two 16-bit floating point values, expanded to (value, value, 0, 1) + D3DDECLTYPE_FLOAT16_4 = 16, // Four 16-bit floating point values + D3DDECLTYPE_UNUSED = 17, // When the type field in a decl is unused. +} D3DDECLTYPE; + +#define MAXD3DDECLTYPE D3DDECLTYPE_UNUSED + +typedef struct _D3DVERTEXELEMENT9 +{ + WORD Stream; // Stream index + WORD Offset; // Offset in the stream in bytes + BYTE Type; // Data type + BYTE Method; // Processing method + BYTE Usage; // Semantics + BYTE UsageIndex; // Semantic index +} D3DVERTEXELEMENT9, *LPD3DVERTEXELEMENT9; + +// This is used to initialize the last vertex element in a vertex declaration +// array +// +#define D3DDECL_END() {0xFF,0,D3DDECLTYPE_UNUSED,0,0,0} + +// Maximum supported number of texture coordinate sets +#define D3DDP_MAXTEXCOORD 8 + +//--------------------------------------------------------------------- +// Values for IDirect3DDevice9::SetStreamSourceFreq's Setting parameter +//--------------------------------------------------------------------- +#define D3DSTREAMSOURCE_INDEXEDDATA (1<<30) +#define D3DSTREAMSOURCE_INSTANCEDATA (2<<30) + + + +//--------------------------------------------------------------------- +// +// The internal format of Pixel Shader (PS) & Vertex Shader (VS) +// Instruction Tokens is defined in the Direct3D Device Driver Kit +// +//--------------------------------------------------------------------- + +// +// Instruction Token Bit Definitions +// +#define D3DSI_OPCODE_MASK 0x0000FFFF + +#define D3DSI_INSTLENGTH_MASK 0x0F000000 +#define D3DSI_INSTLENGTH_SHIFT 24 + +typedef enum _D3DSHADER_INSTRUCTION_OPCODE_TYPE +{ + D3DSIO_NOP = 0, + D3DSIO_MOV , + D3DSIO_ADD , + D3DSIO_SUB , + D3DSIO_MAD , + D3DSIO_MUL , + D3DSIO_RCP , + D3DSIO_RSQ , + D3DSIO_DP3 , + D3DSIO_DP4 , + D3DSIO_MIN , + D3DSIO_MAX , + D3DSIO_SLT , + D3DSIO_SGE , + D3DSIO_EXP , + D3DSIO_LOG , + D3DSIO_LIT , + D3DSIO_DST , + D3DSIO_LRP , + D3DSIO_FRC , + D3DSIO_M4x4 , + D3DSIO_M4x3 , + D3DSIO_M3x4 , + D3DSIO_M3x3 , + D3DSIO_M3x2 , + D3DSIO_CALL , + D3DSIO_CALLNZ , + D3DSIO_LOOP , + D3DSIO_RET , + D3DSIO_ENDLOOP , + D3DSIO_LABEL , + D3DSIO_DCL , + D3DSIO_POW , + D3DSIO_CRS , + D3DSIO_SGN , + D3DSIO_ABS , + D3DSIO_NRM , + D3DSIO_SINCOS , + D3DSIO_REP , + D3DSIO_ENDREP , + D3DSIO_IF , + D3DSIO_IFC , + D3DSIO_ELSE , + D3DSIO_ENDIF , + D3DSIO_BREAK , + D3DSIO_BREAKC , + D3DSIO_MOVA , + D3DSIO_DEFB , + D3DSIO_DEFI , + + D3DSIO_TEXCOORD = 64, + D3DSIO_TEXKILL , + D3DSIO_TEX , + D3DSIO_TEXBEM , + D3DSIO_TEXBEML , + D3DSIO_TEXREG2AR , + D3DSIO_TEXREG2GB , + D3DSIO_TEXM3x2PAD , + D3DSIO_TEXM3x2TEX , + D3DSIO_TEXM3x3PAD , + D3DSIO_TEXM3x3TEX , + D3DSIO_RESERVED0 , + D3DSIO_TEXM3x3SPEC , + D3DSIO_TEXM3x3VSPEC , + D3DSIO_EXPP , + D3DSIO_LOGP , + D3DSIO_CND , + D3DSIO_DEF , + D3DSIO_TEXREG2RGB , + D3DSIO_TEXDP3TEX , + D3DSIO_TEXM3x2DEPTH , + D3DSIO_TEXDP3 , + D3DSIO_TEXM3x3 , + D3DSIO_TEXDEPTH , + D3DSIO_CMP , + D3DSIO_BEM , + D3DSIO_DP2ADD , + D3DSIO_DSX , + D3DSIO_DSY , + D3DSIO_TEXLDD , + D3DSIO_SETP , + D3DSIO_TEXLDL , + D3DSIO_BREAKP , + + D3DSIO_PHASE = 0xFFFD, + D3DSIO_COMMENT = 0xFFFE, + D3DSIO_END = 0xFFFF, + + D3DSIO_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum +} D3DSHADER_INSTRUCTION_OPCODE_TYPE; + +//--------------------------------------------------------------------- +// Use these constants with D3DSIO_SINCOS macro as SRC2, SRC3 +// +#define D3DSINCOSCONST1 -1.5500992e-006f, -2.1701389e-005f, 0.0026041667f, 0.00026041668f +#define D3DSINCOSCONST2 -0.020833334f, -0.12500000f, 1.0f, 0.50000000f + +//--------------------------------------------------------------------- +// Co-Issue Instruction Modifier - if set then this instruction is to be +// issued in parallel with the previous instruction(s) for which this bit +// is not set. +// +#define D3DSI_COISSUE 0x40000000 + +//--------------------------------------------------------------------- +// Opcode specific controls + +#define D3DSP_OPCODESPECIFICCONTROL_MASK 0x00ff0000 +#define D3DSP_OPCODESPECIFICCONTROL_SHIFT 16 + +// ps_2_0 texld controls +#define D3DSI_TEXLD_PROJECT (0x01 << D3DSP_OPCODESPECIFICCONTROL_SHIFT) +#define D3DSI_TEXLD_BIAS (0x02 << D3DSP_OPCODESPECIFICCONTROL_SHIFT) + +// Comparison for dynamic conditional instruction opcodes (i.e. if, breakc) +typedef enum _D3DSHADER_COMPARISON +{ + // < = > + D3DSPC_RESERVED0= 0, // 0 0 0 + D3DSPC_GT = 1, // 0 0 1 + D3DSPC_EQ = 2, // 0 1 0 + D3DSPC_GE = 3, // 0 1 1 + D3DSPC_LT = 4, // 1 0 0 + D3DSPC_NE = 5, // 1 0 1 + D3DSPC_LE = 6, // 1 1 0 + D3DSPC_RESERVED1= 7 // 1 1 1 +} D3DSHADER_COMPARISON; + +// Comparison is part of instruction opcode token: +#define D3DSHADER_COMPARISON_SHIFT D3DSP_OPCODESPECIFICCONTROL_SHIFT +#define D3DSHADER_COMPARISON_MASK (0x7<>8)&0xFF) +#define D3DSHADER_VERSION_MINOR(_Version) (((_Version)>>0)&0xFF) + +// destination/source parameter register type +#define D3DSI_COMMENTSIZE_SHIFT 16 +#define D3DSI_COMMENTSIZE_MASK 0x7FFF0000 +#define D3DSHADER_COMMENT(_DWordSize) \ + ((((_DWordSize)<= 1200 +#pragma warning(pop) +#else +#pragma warning(default:4201) +#endif + +#endif /* (DIRECT3D_VERSION >= 0x0900) */ +#endif /* _d3d9TYPES(P)_H_ */ + diff --git a/MediaClient/MediaClient/directx/include/d3dx10async.h b/MediaClient/MediaClient/directx/include/d3dx10async.h new file mode 100644 index 0000000..d1b1fc5 --- /dev/null +++ b/MediaClient/MediaClient/directx/include/d3dx10async.h @@ -0,0 +1,290 @@ + +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// File: D3DX10Async.h +// Content: D3DX10 Asynchronous Effect / Shader loaders / compilers +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef __D3DX10ASYNC_H__ +#define __D3DX10ASYNC_H__ + +#include "d3dx10.h" + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + + +//---------------------------------------------------------------------------- +// D3DX10Compile: +// ------------------ +// Compiles an effect or shader. +// +// Parameters: +// pSrcFile +// Source file name. +// hSrcModule +// Module handle. if NULL, current module will be used. +// pSrcResource +// Resource name in module. +// pSrcData +// Pointer to source code. +// SrcDataLen +// Size of source code, in bytes. +// pDefines +// Optional NULL-terminated array of preprocessor macro definitions. +// pInclude +// Optional interface pointer to use for handling #include directives. +// If this parameter is NULL, #includes will be honored when compiling +// from file, and will error when compiling from resource or memory. +// pFunctionName +// Name of the entrypoint function where execution should begin. +// pProfile +// Instruction set to be used when generating code. Currently supported +// profiles are "vs_1_1", "vs_2_0", "vs_2_a", "vs_2_sw", "vs_3_0", +// "vs_3_sw", "vs_4_0", "vs_4_1", +// "ps_2_0", "ps_2_a", "ps_2_b", "ps_2_sw", "ps_3_0", +// "ps_3_sw", "ps_4_0", "ps_4_1", +// "gs_4_0", "gs_4_1", +// "tx_1_0", +// "fx_4_0", "fx_4_1" +// Note that this entrypoint does not compile fx_2_0 targets, for that +// you need to use the D3DX9 function. +// Flags1 +// See D3D10_SHADER_xxx flags. +// Flags2 +// See D3D10_EFFECT_xxx flags. +// ppShader +// Returns a buffer containing the created shader. This buffer contains +// the compiled shader code, as well as any embedded debug and symbol +// table info. (See D3D10GetShaderConstantTable) +// ppErrorMsgs +// Returns a buffer containing a listing of errors and warnings that were +// encountered during the compile. If you are running in a debugger, +// these are the same messages you will see in your debug output. +// pHResult +// Pointer to a memory location to receive the return value upon completion. +// Maybe NULL if not needed. +// If pPump != NULL, pHResult must be a valid memory location until the +// the asynchronous execution completes. +//---------------------------------------------------------------------------- + +HRESULT WINAPI D3DX10CompileFromFileA(LPCSTR pSrcFile,CONST D3D10_SHADER_MACRO* pDefines, LPD3D10INCLUDE pInclude, + LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, ID3DX10ThreadPump* pPump, ID3D10Blob** ppShader, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult); + +HRESULT WINAPI D3DX10CompileFromFileW(LPCWSTR pSrcFile, CONST D3D10_SHADER_MACRO* pDefines, LPD3D10INCLUDE pInclude, + LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, ID3DX10ThreadPump* pPump, ID3D10Blob** ppShader, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult); + +#ifdef UNICODE +#define D3DX10CompileFromFile D3DX10CompileFromFileW +#else +#define D3DX10CompileFromFile D3DX10CompileFromFileA +#endif + +HRESULT WINAPI D3DX10CompileFromResourceA(HMODULE hSrcModule, LPCSTR pSrcResource, LPCSTR pSrcFileName, CONST D3D10_SHADER_MACRO* pDefines, + LPD3D10INCLUDE pInclude, LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, ID3DX10ThreadPump* pPump, ID3D10Blob** ppShader, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult); + +HRESULT WINAPI D3DX10CompileFromResourceW(HMODULE hSrcModule, LPCWSTR pSrcResource, LPCWSTR pSrcFileName, CONST D3D10_SHADER_MACRO* pDefines, + LPD3D10INCLUDE pInclude, LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, ID3DX10ThreadPump* pPump, ID3D10Blob** ppShader, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult); + +#ifdef UNICODE +#define D3DX10CompileFromResource D3DX10CompileFromResourceW +#else +#define D3DX10CompileFromResource D3DX10CompileFromResourceA +#endif + +HRESULT WINAPI D3DX10CompileFromMemory(LPCSTR pSrcData, SIZE_T SrcDataLen, LPCSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines, LPD3D10INCLUDE pInclude, + LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, ID3DX10ThreadPump* pPump, ID3D10Blob** ppShader, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult); + +//---------------------------------------------------------------------------- +// D3DX10CreateEffectFromXXXX: +// -------------------------- +// Creates an effect from a binary effect or file +// +// Parameters: +// +// [in] +// +// +// pFileName +// Name of the ASCII (uncompiled) or binary (compiled) Effect file to load +// +// hModule +// Handle to the module containing the resource to compile from +// pResourceName +// Name of the resource within hModule to compile from +// +// pData +// Blob of effect data, either ASCII (uncompiled) or binary (compiled) +// DataLength +// Length of the data blob +// +// pDefines +// Optional NULL-terminated array of preprocessor macro definitions. +// pInclude +// Optional interface pointer to use for handling #include directives. +// If this parameter is NULL, #includes will be honored when compiling +// from file, and will error when compiling from resource or memory. +// pProfile +// Profile to use when compiling the effect. +// HLSLFlags +// Compilation flags pertaining to shaders and data types, honored by +// the HLSL compiler +// FXFlags +// Compilation flags pertaining to Effect compilation, honored +// by the Effect compiler +// pDevice +// Pointer to the D3D10 device on which to create Effect resources +// pEffectPool +// Pointer to an Effect pool to share variables with or NULL +// +// [out] +// +// ppEffect +// Address of the newly created Effect interface +// ppEffectPool +// Address of the newly created Effect pool interface +// ppErrors +// If non-NULL, address of a buffer with error messages that occurred +// during parsing or compilation +// pHResult +// Pointer to a memory location to receive the return value upon completion. +// Maybe NULL if not needed. +// If pPump != NULL, pHResult must be a valid memory location until the +// the asynchronous execution completes. +//---------------------------------------------------------------------------- + + +HRESULT WINAPI D3DX10CreateEffectFromFileA(LPCSTR pFileName, CONST D3D10_SHADER_MACRO *pDefines, + ID3D10Include *pInclude, LPCSTR pProfile, UINT HLSLFlags, UINT FXFlags, ID3D10Device *pDevice, + ID3D10EffectPool *pEffectPool, ID3DX10ThreadPump* pPump, ID3D10Effect **ppEffect, ID3D10Blob **ppErrors, HRESULT* pHResult); + +HRESULT WINAPI D3DX10CreateEffectFromFileW(LPCWSTR pFileName, CONST D3D10_SHADER_MACRO *pDefines, + ID3D10Include *pInclude, LPCSTR pProfile, UINT HLSLFlags, UINT FXFlags, ID3D10Device *pDevice, + ID3D10EffectPool *pEffectPool, ID3DX10ThreadPump* pPump, ID3D10Effect **ppEffect, ID3D10Blob **ppErrors, HRESULT* pHResult); + +HRESULT WINAPI D3DX10CreateEffectFromMemory(LPCVOID pData, SIZE_T DataLength, LPCSTR pSrcFileName, CONST D3D10_SHADER_MACRO *pDefines, + ID3D10Include *pInclude, LPCSTR pProfile, UINT HLSLFlags, UINT FXFlags, ID3D10Device *pDevice, + ID3D10EffectPool *pEffectPool, ID3DX10ThreadPump* pPump, ID3D10Effect **ppEffect, ID3D10Blob **ppErrors, HRESULT* pHResult); + +HRESULT WINAPI D3DX10CreateEffectFromResourceA(HMODULE hModule, LPCSTR pResourceName, LPCSTR pSrcFileName, CONST D3D10_SHADER_MACRO *pDefines, + ID3D10Include *pInclude, LPCSTR pProfile, UINT HLSLFlags, UINT FXFlags, ID3D10Device *pDevice, + ID3D10EffectPool *pEffectPool, ID3DX10ThreadPump* pPump, ID3D10Effect **ppEffect, ID3D10Blob **ppErrors, HRESULT* pHResult); + +HRESULT WINAPI D3DX10CreateEffectFromResourceW(HMODULE hModule, LPCWSTR pResourceName, LPCWSTR pSrcFileName, CONST D3D10_SHADER_MACRO *pDefines, + ID3D10Include *pInclude, LPCSTR pProfile, UINT HLSLFlags, UINT FXFlags, ID3D10Device *pDevice, + ID3D10EffectPool *pEffectPool, ID3DX10ThreadPump* pPump, ID3D10Effect **ppEffect, ID3D10Blob **ppErrors, HRESULT* pHResult); + + +#ifdef UNICODE +#define D3DX10CreateEffectFromFile D3DX10CreateEffectFromFileW +#define D3DX10CreateEffectFromResource D3DX10CreateEffectFromResourceW +#else +#define D3DX10CreateEffectFromFile D3DX10CreateEffectFromFileA +#define D3DX10CreateEffectFromResource D3DX10CreateEffectFromResourceA +#endif + +HRESULT WINAPI D3DX10CreateEffectPoolFromFileA(LPCSTR pFileName, CONST D3D10_SHADER_MACRO *pDefines, + ID3D10Include *pInclude, LPCSTR pProfile, UINT HLSLFlags, UINT FXFlags, ID3D10Device *pDevice, ID3DX10ThreadPump* pPump, + ID3D10EffectPool **ppEffectPool, ID3D10Blob **ppErrors, HRESULT* pHResult); + +HRESULT WINAPI D3DX10CreateEffectPoolFromFileW(LPCWSTR pFileName, CONST D3D10_SHADER_MACRO *pDefines, + ID3D10Include *pInclude, LPCSTR pProfile, UINT HLSLFlags, UINT FXFlags, ID3D10Device *pDevice, ID3DX10ThreadPump* pPump, + ID3D10EffectPool **ppEffectPool, ID3D10Blob **ppErrors, HRESULT* pHResult); + +HRESULT WINAPI D3DX10CreateEffectPoolFromMemory(LPCVOID pData, SIZE_T DataLength, LPCSTR pSrcFileName, CONST D3D10_SHADER_MACRO *pDefines, + ID3D10Include *pInclude, LPCSTR pProfile, UINT HLSLFlags, UINT FXFlags, ID3D10Device *pDevice, + ID3DX10ThreadPump* pPump, ID3D10EffectPool **ppEffectPool, ID3D10Blob **ppErrors, HRESULT* pHResult); + +HRESULT WINAPI D3DX10CreateEffectPoolFromResourceA(HMODULE hModule, LPCSTR pResourceName, LPCSTR pSrcFileName, CONST D3D10_SHADER_MACRO *pDefines, + ID3D10Include *pInclude, LPCSTR pProfile, UINT HLSLFlags, UINT FXFlags, ID3D10Device *pDevice, + ID3DX10ThreadPump* pPump, ID3D10EffectPool **ppEffectPool, ID3D10Blob **ppErrors, HRESULT* pHResult); + +HRESULT WINAPI D3DX10CreateEffectPoolFromResourceW(HMODULE hModule, LPCWSTR pResourceName, LPCWSTR pSrcFileName, CONST D3D10_SHADER_MACRO *pDefines, + ID3D10Include *pInclude, LPCSTR pProfile, UINT HLSLFlags, UINT FXFlags, ID3D10Device *pDevice, + ID3DX10ThreadPump* pPump, ID3D10EffectPool **ppEffectPool, ID3D10Blob **ppErrors, HRESULT* pHResult); + +#ifdef UNICODE +#define D3DX10CreateEffectPoolFromFile D3DX10CreateEffectPoolFromFileW +#define D3DX10CreateEffectPoolFromResource D3DX10CreateEffectPoolFromResourceW +#else +#define D3DX10CreateEffectPoolFromFile D3DX10CreateEffectPoolFromFileA +#define D3DX10CreateEffectPoolFromResource D3DX10CreateEffectPoolFromResourceA +#endif + +HRESULT WINAPI D3DX10PreprocessShaderFromFileA(LPCSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines, + LPD3D10INCLUDE pInclude, ID3DX10ThreadPump *pPump, ID3D10Blob** ppShaderText, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult); + +HRESULT WINAPI D3DX10PreprocessShaderFromFileW(LPCWSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines, + LPD3D10INCLUDE pInclude, ID3DX10ThreadPump *pPump, ID3D10Blob** ppShaderText, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult); + +HRESULT WINAPI D3DX10PreprocessShaderFromMemory(LPCSTR pSrcData, SIZE_T SrcDataSize, LPCSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines, + LPD3D10INCLUDE pInclude, ID3DX10ThreadPump *pPump, ID3D10Blob** ppShaderText, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult); + +HRESULT WINAPI D3DX10PreprocessShaderFromResourceA(HMODULE hModule, LPCSTR pResourceName, LPCSTR pSrcFileName, CONST D3D10_SHADER_MACRO* pDefines, + LPD3D10INCLUDE pInclude, ID3DX10ThreadPump *pPump, ID3D10Blob** ppShaderText, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult); + +HRESULT WINAPI D3DX10PreprocessShaderFromResourceW(HMODULE hModule, LPCWSTR pResourceName, LPCWSTR pSrcFileName, CONST D3D10_SHADER_MACRO* pDefines, + LPD3D10INCLUDE pInclude, ID3DX10ThreadPump *pPump, ID3D10Blob** ppShaderText, ID3D10Blob** ppErrorMsgs, HRESULT* pHResult); + +#ifdef UNICODE +#define D3DX10PreprocessShaderFromFile D3DX10PreprocessShaderFromFileW +#define D3DX10PreprocessShaderFromResource D3DX10PreprocessShaderFromResourceW +#else +#define D3DX10PreprocessShaderFromFile D3DX10PreprocessShaderFromFileA +#define D3DX10PreprocessShaderFromResource D3DX10PreprocessShaderFromResourceA +#endif + +//---------------------------------------------------------------------------- +// Async processors +//---------------------------------------------------------------------------- + +HRESULT WINAPI D3DX10CreateAsyncCompilerProcessor(LPCSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines, LPD3D10INCLUDE pInclude, + LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags1, UINT Flags2, + ID3D10Blob **ppCompiledShader, ID3D10Blob **ppErrorBuffer, ID3DX10DataProcessor **ppProcessor); + +HRESULT WINAPI D3DX10CreateAsyncEffectCreateProcessor(LPCSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines, LPD3D10INCLUDE pInclude, + LPCSTR pProfile, UINT Flags, UINT FXFlags, ID3D10Device *pDevice, + ID3D10EffectPool *pPool, ID3D10Blob **ppErrorBuffer, ID3DX10DataProcessor **ppProcessor); + +HRESULT WINAPI D3DX10CreateAsyncEffectPoolCreateProcessor(LPCSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines, LPD3D10INCLUDE pInclude, + LPCSTR pProfile, UINT Flags, UINT FXFlags, ID3D10Device *pDevice, + ID3D10Blob **ppErrorBuffer, ID3DX10DataProcessor **ppProcessor); + +HRESULT WINAPI D3DX10CreateAsyncShaderPreprocessProcessor(LPCSTR pFileName, CONST D3D10_SHADER_MACRO* pDefines, LPD3D10INCLUDE pInclude, + ID3D10Blob** ppShaderText, ID3D10Blob **ppErrorBuffer, ID3DX10DataProcessor **ppProcessor); + + + +//---------------------------------------------------------------------------- +// D3DX10 Asynchronous texture I/O (advanced mode) +//---------------------------------------------------------------------------- + +HRESULT WINAPI D3DX10CreateAsyncFileLoaderW(LPCWSTR pFileName, ID3DX10DataLoader **ppDataLoader); +HRESULT WINAPI D3DX10CreateAsyncFileLoaderA(LPCSTR pFileName, ID3DX10DataLoader **ppDataLoader); +HRESULT WINAPI D3DX10CreateAsyncMemoryLoader(LPCVOID pData, SIZE_T cbData, ID3DX10DataLoader **ppDataLoader); +HRESULT WINAPI D3DX10CreateAsyncResourceLoaderW(HMODULE hSrcModule, LPCWSTR pSrcResource, ID3DX10DataLoader **ppDataLoader); +HRESULT WINAPI D3DX10CreateAsyncResourceLoaderA(HMODULE hSrcModule, LPCSTR pSrcResource, ID3DX10DataLoader **ppDataLoader); + +#ifdef UNICODE +#define D3DX10CreateAsyncFileLoader D3DX10CreateAsyncFileLoaderW +#define D3DX10CreateAsyncResourceLoader D3DX10CreateAsyncResourceLoaderW +#else +#define D3DX10CreateAsyncFileLoader D3DX10CreateAsyncFileLoaderA +#define D3DX10CreateAsyncResourceLoader D3DX10CreateAsyncResourceLoaderA +#endif + +HRESULT WINAPI D3DX10CreateAsyncTextureProcessor(ID3D10Device *pDevice, D3DX10_IMAGE_LOAD_INFO *pLoadInfo, ID3DX10DataProcessor **ppDataProcessor); +HRESULT WINAPI D3DX10CreateAsyncTextureInfoProcessor(D3DX10_IMAGE_INFO *pImageInfo, ID3DX10DataProcessor **ppDataProcessor); +HRESULT WINAPI D3DX10CreateAsyncShaderResourceViewProcessor(ID3D10Device *pDevice, D3DX10_IMAGE_LOAD_INFO *pLoadInfo, ID3DX10DataProcessor **ppDataProcessor); + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif //__D3DX10ASYNC_H__ + + diff --git a/MediaClient/MediaClient/directx/include/d3dx9.h b/MediaClient/MediaClient/directx/include/d3dx9.h new file mode 100644 index 0000000..43f9e62 --- /dev/null +++ b/MediaClient/MediaClient/directx/include/d3dx9.h @@ -0,0 +1,78 @@ +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx9.h +// Content: D3DX utility library +// +////////////////////////////////////////////////////////////////////////////// + +#ifdef __D3DX_INTERNAL__ +#error Incorrect D3DX header used +#endif + +#ifndef __D3DX9_H__ +#define __D3DX9_H__ + + +// Defines +#include + +#define D3DX_DEFAULT ((UINT) -1) +#define D3DX_DEFAULT_NONPOW2 ((UINT) -2) +#define D3DX_DEFAULT_FLOAT FLT_MAX +#define D3DX_FROM_FILE ((UINT) -3) +#define D3DFMT_FROM_FILE ((D3DFORMAT) -3) + +#ifndef D3DXINLINE +#ifdef _MSC_VER + #if (_MSC_VER >= 1200) + #define D3DXINLINE __forceinline + #else + #define D3DXINLINE __inline + #endif +#else + #ifdef __cplusplus + #define D3DXINLINE inline + #else + #define D3DXINLINE + #endif +#endif +#endif + + + +// Includes +#include "d3d9.h" +#include "d3dx9math.h" +#include "d3dx9core.h" +#include "d3dx9xof.h" +#include "d3dx9mesh.h" +#include "d3dx9shader.h" +#include "d3dx9effect.h" + +#include "d3dx9tex.h" +#include "d3dx9shape.h" +#include "d3dx9anim.h" + + + +// Errors +#define _FACDD 0x876 +#define MAKE_DDHRESULT( code ) MAKE_HRESULT( 1, _FACDD, code ) + +enum _D3DXERR { + D3DXERR_CANNOTMODIFYINDEXBUFFER = MAKE_DDHRESULT(2900), + D3DXERR_INVALIDMESH = MAKE_DDHRESULT(2901), + D3DXERR_CANNOTATTRSORT = MAKE_DDHRESULT(2902), + D3DXERR_SKINNINGNOTSUPPORTED = MAKE_DDHRESULT(2903), + D3DXERR_TOOMANYINFLUENCES = MAKE_DDHRESULT(2904), + D3DXERR_INVALIDDATA = MAKE_DDHRESULT(2905), + D3DXERR_LOADEDMESHASNODATA = MAKE_DDHRESULT(2906), + D3DXERR_DUPLICATENAMEDFRAGMENT = MAKE_DDHRESULT(2907), + D3DXERR_CANNOTREMOVELASTITEM = MAKE_DDHRESULT(2908), +}; + + +#endif //__D3DX9_H__ + diff --git a/MediaClient/MediaClient/directx/include/d3dx9anim.h b/MediaClient/MediaClient/directx/include/d3dx9anim.h new file mode 100644 index 0000000..fedb1db --- /dev/null +++ b/MediaClient/MediaClient/directx/include/d3dx9anim.h @@ -0,0 +1,1114 @@ +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx9anim.h +// Content: D3DX mesh types and functions +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef __D3DX9ANIM_H__ +#define __D3DX9ANIM_H__ + +// {698CFB3F-9289-4d95-9A57-33A94B5A65F9} +DEFINE_GUID(IID_ID3DXAnimationSet, +0x698cfb3f, 0x9289, 0x4d95, 0x9a, 0x57, 0x33, 0xa9, 0x4b, 0x5a, 0x65, 0xf9); + +// {FA4E8E3A-9786-407d-8B4C-5995893764AF} +DEFINE_GUID(IID_ID3DXKeyframedAnimationSet, +0xfa4e8e3a, 0x9786, 0x407d, 0x8b, 0x4c, 0x59, 0x95, 0x89, 0x37, 0x64, 0xaf); + +// {6CC2480D-3808-4739-9F88-DE49FACD8D4C} +DEFINE_GUID(IID_ID3DXCompressedAnimationSet, +0x6cc2480d, 0x3808, 0x4739, 0x9f, 0x88, 0xde, 0x49, 0xfa, 0xcd, 0x8d, 0x4c); + +// {AC8948EC-F86D-43e2-96DE-31FC35F96D9E} +DEFINE_GUID(IID_ID3DXAnimationController, +0xac8948ec, 0xf86d, 0x43e2, 0x96, 0xde, 0x31, 0xfc, 0x35, 0xf9, 0x6d, 0x9e); + + +//---------------------------------------------------------------------------- +// D3DXMESHDATATYPE: +// ----------------- +// This enum defines the type of mesh data present in a MeshData structure. +//---------------------------------------------------------------------------- +typedef enum _D3DXMESHDATATYPE { + D3DXMESHTYPE_MESH = 0x001, // Normal ID3DXMesh data + D3DXMESHTYPE_PMESH = 0x002, // Progressive Mesh - ID3DXPMesh + D3DXMESHTYPE_PATCHMESH = 0x003, // Patch Mesh - ID3DXPatchMesh + + D3DXMESHTYPE_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DXMESHDATATYPE; + +//---------------------------------------------------------------------------- +// D3DXMESHDATA: +// ------------- +// This struct encapsulates a the mesh data that can be present in a mesh +// container. The supported mesh types are pMesh, pPMesh, pPatchMesh. +// The valid way to access this is determined by the Type enum. +//---------------------------------------------------------------------------- +typedef struct _D3DXMESHDATA +{ + D3DXMESHDATATYPE Type; + + // current mesh data interface + union + { + LPD3DXMESH pMesh; + LPD3DXPMESH pPMesh; + LPD3DXPATCHMESH pPatchMesh; + }; +} D3DXMESHDATA, *LPD3DXMESHDATA; + +//---------------------------------------------------------------------------- +// D3DXMESHCONTAINER: +// ------------------ +// This struct encapsulates a mesh object in a transformation frame +// hierarchy. The app can derive from this structure to add other app specific +// data to this. +//---------------------------------------------------------------------------- +typedef struct _D3DXMESHCONTAINER +{ + LPSTR Name; + + D3DXMESHDATA MeshData; + + LPD3DXMATERIAL pMaterials; + LPD3DXEFFECTINSTANCE pEffects; + DWORD NumMaterials; + DWORD *pAdjacency; + + LPD3DXSKININFO pSkinInfo; + + struct _D3DXMESHCONTAINER *pNextMeshContainer; +} D3DXMESHCONTAINER, *LPD3DXMESHCONTAINER; + +//---------------------------------------------------------------------------- +// D3DXFRAME: +// ---------- +// This struct is the encapsulates a transform frame in a transformation frame +// hierarchy. The app can derive from this structure to add other app specific +// data to this +//---------------------------------------------------------------------------- +typedef struct _D3DXFRAME +{ + LPSTR Name; + D3DXMATRIX TransformationMatrix; + + LPD3DXMESHCONTAINER pMeshContainer; + + struct _D3DXFRAME *pFrameSibling; + struct _D3DXFRAME *pFrameFirstChild; +} D3DXFRAME, *LPD3DXFRAME; + + +//---------------------------------------------------------------------------- +// ID3DXAllocateHierarchy: +// ----------------------- +// This interface is implemented by the application to allocate/free frame and +// mesh container objects. Methods on this are called during loading and +// destroying frame hierarchies +//---------------------------------------------------------------------------- +typedef interface ID3DXAllocateHierarchy ID3DXAllocateHierarchy; +typedef interface ID3DXAllocateHierarchy *LPD3DXALLOCATEHIERARCHY; + +#undef INTERFACE +#define INTERFACE ID3DXAllocateHierarchy + +DECLARE_INTERFACE(ID3DXAllocateHierarchy) +{ + // ID3DXAllocateHierarchy + + //------------------------------------------------------------------------ + // CreateFrame: + // ------------ + // Requests allocation of a frame object. + // + // Parameters: + // Name + // Name of the frame to be created + // ppNewFrame + // Returns the created frame object + // + //------------------------------------------------------------------------ + STDMETHOD(CreateFrame)(THIS_ LPCSTR Name, + LPD3DXFRAME *ppNewFrame) PURE; + + //------------------------------------------------------------------------ + // CreateMeshContainer: + // -------------------- + // Requests allocation of a mesh container object. + // + // Parameters: + // Name + // Name of the mesh + // pMesh + // Pointer to the mesh object if basic polygon data found + // pPMesh + // Pointer to the progressive mesh object if progressive mesh data found + // pPatchMesh + // Pointer to the patch mesh object if patch data found + // pMaterials + // Array of materials used in the mesh + // pEffectInstances + // Array of effect instances used in the mesh + // NumMaterials + // Num elements in the pMaterials array + // pAdjacency + // Adjacency array for the mesh + // pSkinInfo + // Pointer to the skininfo object if the mesh is skinned + // pBoneNames + // Array of names, one for each bone in the skinned mesh. + // The numberof bones can be found from the pSkinMesh object + // pBoneOffsetMatrices + // Array of matrices, one for each bone in the skinned mesh. + // + //------------------------------------------------------------------------ + STDMETHOD(CreateMeshContainer)(THIS_ + LPCSTR Name, + CONST D3DXMESHDATA *pMeshData, + CONST D3DXMATERIAL *pMaterials, + CONST D3DXEFFECTINSTANCE *pEffectInstances, + DWORD NumMaterials, + CONST DWORD *pAdjacency, + LPD3DXSKININFO pSkinInfo, + LPD3DXMESHCONTAINER *ppNewMeshContainer) PURE; + + //------------------------------------------------------------------------ + // DestroyFrame: + // ------------- + // Requests de-allocation of a frame object. + // + // Parameters: + // pFrameToFree + // Pointer to the frame to be de-allocated + // + //------------------------------------------------------------------------ + STDMETHOD(DestroyFrame)(THIS_ LPD3DXFRAME pFrameToFree) PURE; + + //------------------------------------------------------------------------ + // DestroyMeshContainer: + // --------------------- + // Requests de-allocation of a mesh container object. + // + // Parameters: + // pMeshContainerToFree + // Pointer to the mesh container object to be de-allocated + // + //------------------------------------------------------------------------ + STDMETHOD(DestroyMeshContainer)(THIS_ LPD3DXMESHCONTAINER pMeshContainerToFree) PURE; +}; + +//---------------------------------------------------------------------------- +// ID3DXLoadUserData: +// ------------------ +// This interface is implemented by the application to load user data in a .X file +// When user data is found, these callbacks will be used to allow the application +// to load the data. +//---------------------------------------------------------------------------- +typedef interface ID3DXLoadUserData ID3DXLoadUserData; +typedef interface ID3DXLoadUserData *LPD3DXLOADUSERDATA; + +#undef INTERFACE +#define INTERFACE ID3DXLoadUserData + +DECLARE_INTERFACE(ID3DXLoadUserData) +{ + STDMETHOD(LoadTopLevelData)(LPD3DXFILEDATA pXofChildData) PURE; + + STDMETHOD(LoadFrameChildData)(LPD3DXFRAME pFrame, + LPD3DXFILEDATA pXofChildData) PURE; + + STDMETHOD(LoadMeshChildData)(LPD3DXMESHCONTAINER pMeshContainer, + LPD3DXFILEDATA pXofChildData) PURE; +}; + +//---------------------------------------------------------------------------- +// ID3DXSaveUserData: +// ------------------ +// This interface is implemented by the application to save user data in a .X file +// The callbacks are called for all data saved. The user can then add any +// child data objects to the object provided to the callback. +//---------------------------------------------------------------------------- +typedef interface ID3DXSaveUserData ID3DXSaveUserData; +typedef interface ID3DXSaveUserData *LPD3DXSAVEUSERDATA; + +#undef INTERFACE +#define INTERFACE ID3DXSaveUserData + +DECLARE_INTERFACE(ID3DXSaveUserData) +{ + STDMETHOD(AddFrameChildData)(CONST D3DXFRAME *pFrame, + LPD3DXFILESAVEOBJECT pXofSave, + LPD3DXFILESAVEDATA pXofFrameData) PURE; + + STDMETHOD(AddMeshChildData)(CONST D3DXMESHCONTAINER *pMeshContainer, + LPD3DXFILESAVEOBJECT pXofSave, + LPD3DXFILESAVEDATA pXofMeshData) PURE; + + // NOTE: this is called once per Save. All top level objects should be added using the + // provided interface. One call adds objects before the frame hierarchy, the other after + STDMETHOD(AddTopLevelDataObjectsPre)(LPD3DXFILESAVEOBJECT pXofSave) PURE; + STDMETHOD(AddTopLevelDataObjectsPost)(LPD3DXFILESAVEOBJECT pXofSave) PURE; + + // callbacks for the user to register and then save templates to the XFile + STDMETHOD(RegisterTemplates)(LPD3DXFILE pXFileApi) PURE; + STDMETHOD(SaveTemplates)(LPD3DXFILESAVEOBJECT pXofSave) PURE; +}; + + +//---------------------------------------------------------------------------- +// D3DXCALLBACK_SEARCH_FLAGS: +// -------------------------- +// Flags that can be passed into ID3DXAnimationSet::GetCallback. +//---------------------------------------------------------------------------- +typedef enum _D3DXCALLBACK_SEARCH_FLAGS +{ + D3DXCALLBACK_SEARCH_EXCLUDING_INITIAL_POSITION = 0x01, // exclude callbacks at the initial position from the search + D3DXCALLBACK_SEARCH_BEHIND_INITIAL_POSITION = 0x02, // reverse the callback search direction + + D3DXCALLBACK_SEARCH_FORCE_DWORD = 0x7fffffff, +} D3DXCALLBACK_SEARCH_FLAGS; + +//---------------------------------------------------------------------------- +// ID3DXAnimationSet: +// ------------------ +// This interface implements an animation set. +//---------------------------------------------------------------------------- +typedef interface ID3DXAnimationSet ID3DXAnimationSet; +typedef interface ID3DXAnimationSet *LPD3DXANIMATIONSET; + +#undef INTERFACE +#define INTERFACE ID3DXAnimationSet + +DECLARE_INTERFACE_(ID3DXAnimationSet, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // Name + STDMETHOD_(LPCSTR, GetName)(THIS) PURE; + + // Period + STDMETHOD_(DOUBLE, GetPeriod)(THIS) PURE; + STDMETHOD_(DOUBLE, GetPeriodicPosition)(THIS_ DOUBLE Position) PURE; // Maps position into animation period + + // Animation names + STDMETHOD_(UINT, GetNumAnimations)(THIS) PURE; + STDMETHOD(GetAnimationNameByIndex)(THIS_ UINT Index, LPCSTR *ppName) PURE; + STDMETHOD(GetAnimationIndexByName)(THIS_ LPCSTR pName, UINT *pIndex) PURE; + + // SRT + STDMETHOD(GetSRT)(THIS_ + DOUBLE PeriodicPosition, // Position mapped to period (use GetPeriodicPosition) + UINT Animation, // Animation index + D3DXVECTOR3 *pScale, // Returns the scale + D3DXQUATERNION *pRotation, // Returns the rotation as a quaternion + D3DXVECTOR3 *pTranslation) PURE; // Returns the translation + + // Callbacks + STDMETHOD(GetCallback)(THIS_ + DOUBLE Position, // Position from which to find callbacks + DWORD Flags, // Callback search flags + DOUBLE *pCallbackPosition, // Returns the position of the callback + LPVOID *ppCallbackData) PURE; // Returns the callback data pointer +}; + + +//---------------------------------------------------------------------------- +// D3DXPLAYBACK_TYPE: +// ------------------ +// This enum defines the type of animation set loop modes. +//---------------------------------------------------------------------------- +typedef enum _D3DXPLAYBACK_TYPE +{ + D3DXPLAY_LOOP = 0, + D3DXPLAY_ONCE = 1, + D3DXPLAY_PINGPONG = 2, + + D3DXPLAY_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DXPLAYBACK_TYPE; + + +//---------------------------------------------------------------------------- +// D3DXKEY_VECTOR3: +// ---------------- +// This structure describes a vector key for use in keyframe animation. +// It specifies a vector Value at a given Time. This is used for scale and +// translation keys. +//---------------------------------------------------------------------------- +typedef struct _D3DXKEY_VECTOR3 +{ + FLOAT Time; + D3DXVECTOR3 Value; +} D3DXKEY_VECTOR3, *LPD3DXKEY_VECTOR3; + + +//---------------------------------------------------------------------------- +// D3DXKEY_QUATERNION: +// ------------------- +// This structure describes a quaternion key for use in keyframe animation. +// It specifies a quaternion Value at a given Time. This is used for rotation +// keys. +//---------------------------------------------------------------------------- +typedef struct _D3DXKEY_QUATERNION +{ + FLOAT Time; + D3DXQUATERNION Value; +} D3DXKEY_QUATERNION, *LPD3DXKEY_QUATERNION; + + +//---------------------------------------------------------------------------- +// D3DXKEY_CALLBACK: +// ----------------- +// This structure describes an callback key for use in keyframe animation. +// It specifies a pointer to user data at a given Time. +//---------------------------------------------------------------------------- +typedef struct _D3DXKEY_CALLBACK +{ + FLOAT Time; + LPVOID pCallbackData; +} D3DXKEY_CALLBACK, *LPD3DXKEY_CALLBACK; + + +//---------------------------------------------------------------------------- +// D3DXCOMPRESSION_FLAGS: +// ---------------------- +// Flags that can be passed into ID3DXKeyframedAnimationSet::Compress. +//---------------------------------------------------------------------------- +typedef enum _D3DXCOMPRESSION_FLAGS +{ + D3DXCOMPRESS_DEFAULT = 0x00, + + D3DXCOMPRESS_FORCE_DWORD = 0x7fffffff, +} D3DXCOMPRESSION_FLAGS; + + +//---------------------------------------------------------------------------- +// ID3DXKeyframedAnimationSet: +// --------------------------- +// This interface implements a compressable keyframed animation set. +//---------------------------------------------------------------------------- +typedef interface ID3DXKeyframedAnimationSet ID3DXKeyframedAnimationSet; +typedef interface ID3DXKeyframedAnimationSet *LPD3DXKEYFRAMEDANIMATIONSET; + +#undef INTERFACE +#define INTERFACE ID3DXKeyframedAnimationSet + +DECLARE_INTERFACE_(ID3DXKeyframedAnimationSet, ID3DXAnimationSet) +{ + // ID3DXAnimationSet + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // Name + STDMETHOD_(LPCSTR, GetName)(THIS) PURE; + + // Period + STDMETHOD_(DOUBLE, GetPeriod)(THIS) PURE; + STDMETHOD_(DOUBLE, GetPeriodicPosition)(THIS_ DOUBLE Position) PURE; // Maps position into animation period + + // Animation names + STDMETHOD_(UINT, GetNumAnimations)(THIS) PURE; + STDMETHOD(GetAnimationNameByIndex)(THIS_ UINT Index, LPCSTR *ppName) PURE; + STDMETHOD(GetAnimationIndexByName)(THIS_ LPCSTR pName, UINT *pIndex) PURE; + + // SRT + STDMETHOD(GetSRT)(THIS_ + DOUBLE PeriodicPosition, // Position mapped to period (use GetPeriodicPosition) + UINT Animation, // Animation index + D3DXVECTOR3 *pScale, // Returns the scale + D3DXQUATERNION *pRotation, // Returns the rotation as a quaternion + D3DXVECTOR3 *pTranslation) PURE; // Returns the translation + + // Callbacks + STDMETHOD(GetCallback)(THIS_ + DOUBLE Position, // Position from which to find callbacks + DWORD Flags, // Callback search flags + DOUBLE *pCallbackPosition, // Returns the position of the callback + LPVOID *ppCallbackData) PURE; // Returns the callback data pointer + + // Playback + STDMETHOD_(D3DXPLAYBACK_TYPE, GetPlaybackType)(THIS) PURE; + STDMETHOD_(DOUBLE, GetSourceTicksPerSecond)(THIS) PURE; + + // Scale keys + STDMETHOD_(UINT, GetNumScaleKeys)(THIS_ UINT Animation) PURE; + STDMETHOD(GetScaleKeys)(THIS_ UINT Animation, LPD3DXKEY_VECTOR3 pScaleKeys) PURE; + STDMETHOD(GetScaleKey)(THIS_ UINT Animation, UINT Key, LPD3DXKEY_VECTOR3 pScaleKey) PURE; + STDMETHOD(SetScaleKey)(THIS_ UINT Animation, UINT Key, LPD3DXKEY_VECTOR3 pScaleKey) PURE; + + // Rotation keys + STDMETHOD_(UINT, GetNumRotationKeys)(THIS_ UINT Animation) PURE; + STDMETHOD(GetRotationKeys)(THIS_ UINT Animation, LPD3DXKEY_QUATERNION pRotationKeys) PURE; + STDMETHOD(GetRotationKey)(THIS_ UINT Animation, UINT Key, LPD3DXKEY_QUATERNION pRotationKey) PURE; + STDMETHOD(SetRotationKey)(THIS_ UINT Animation, UINT Key, LPD3DXKEY_QUATERNION pRotationKey) PURE; + + // Translation keys + STDMETHOD_(UINT, GetNumTranslationKeys)(THIS_ UINT Animation) PURE; + STDMETHOD(GetTranslationKeys)(THIS_ UINT Animation, LPD3DXKEY_VECTOR3 pTranslationKeys) PURE; + STDMETHOD(GetTranslationKey)(THIS_ UINT Animation, UINT Key, LPD3DXKEY_VECTOR3 pTranslationKey) PURE; + STDMETHOD(SetTranslationKey)(THIS_ UINT Animation, UINT Key, LPD3DXKEY_VECTOR3 pTranslationKey) PURE; + + // Callback keys + STDMETHOD_(UINT, GetNumCallbackKeys)(THIS) PURE; + STDMETHOD(GetCallbackKeys)(THIS_ LPD3DXKEY_CALLBACK pCallbackKeys) PURE; + STDMETHOD(GetCallbackKey)(THIS_ UINT Key, LPD3DXKEY_CALLBACK pCallbackKey) PURE; + STDMETHOD(SetCallbackKey)(THIS_ UINT Key, LPD3DXKEY_CALLBACK pCallbackKey) PURE; + + // Key removal methods. These are slow, and should not be used once the animation starts playing + STDMETHOD(UnregisterScaleKey)(THIS_ UINT Animation, UINT Key) PURE; + STDMETHOD(UnregisterRotationKey)(THIS_ UINT Animation, UINT Key) PURE; + STDMETHOD(UnregisterTranslationKey)(THIS_ UINT Animation, UINT Key) PURE; + + // One-time animaton SRT keyframe registration + STDMETHOD(RegisterAnimationSRTKeys)(THIS_ + LPCSTR pName, // Animation name + UINT NumScaleKeys, // Number of scale keys + UINT NumRotationKeys, // Number of rotation keys + UINT NumTranslationKeys, // Number of translation keys + CONST D3DXKEY_VECTOR3 *pScaleKeys, // Array of scale keys + CONST D3DXKEY_QUATERNION *pRotationKeys, // Array of rotation keys + CONST D3DXKEY_VECTOR3 *pTranslationKeys, // Array of translation keys + DWORD *pAnimationIndex) PURE; // Returns the animation index + + // Compression + STDMETHOD(Compress)(THIS_ + DWORD Flags, // Compression flags (use D3DXCOMPRESS_STRONG for better results) + FLOAT Lossiness, // Compression loss ratio in the [0, 1] range + LPD3DXFRAME pHierarchy, // Frame hierarchy (optional) + LPD3DXBUFFER *ppCompressedData) PURE; // Returns the compressed animation set + + STDMETHOD(UnregisterAnimation)(THIS_ UINT Index) PURE; +}; + + +//---------------------------------------------------------------------------- +// ID3DXCompressedAnimationSet: +// ---------------------------- +// This interface implements a compressed keyframed animation set. +//---------------------------------------------------------------------------- +typedef interface ID3DXCompressedAnimationSet ID3DXCompressedAnimationSet; +typedef interface ID3DXCompressedAnimationSet *LPD3DXCOMPRESSEDANIMATIONSET; + +#undef INTERFACE +#define INTERFACE ID3DXCompressedAnimationSet + +DECLARE_INTERFACE_(ID3DXCompressedAnimationSet, ID3DXAnimationSet) +{ + // ID3DXAnimationSet + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // Name + STDMETHOD_(LPCSTR, GetName)(THIS) PURE; + + // Period + STDMETHOD_(DOUBLE, GetPeriod)(THIS) PURE; + STDMETHOD_(DOUBLE, GetPeriodicPosition)(THIS_ DOUBLE Position) PURE; // Maps position into animation period + + // Animation names + STDMETHOD_(UINT, GetNumAnimations)(THIS) PURE; + STDMETHOD(GetAnimationNameByIndex)(THIS_ UINT Index, LPCSTR *ppName) PURE; + STDMETHOD(GetAnimationIndexByName)(THIS_ LPCSTR pName, UINT *pIndex) PURE; + + // SRT + STDMETHOD(GetSRT)(THIS_ + DOUBLE PeriodicPosition, // Position mapped to period (use GetPeriodicPosition) + UINT Animation, // Animation index + D3DXVECTOR3 *pScale, // Returns the scale + D3DXQUATERNION *pRotation, // Returns the rotation as a quaternion + D3DXVECTOR3 *pTranslation) PURE; // Returns the translation + + // Callbacks + STDMETHOD(GetCallback)(THIS_ + DOUBLE Position, // Position from which to find callbacks + DWORD Flags, // Callback search flags + DOUBLE *pCallbackPosition, // Returns the position of the callback + LPVOID *ppCallbackData) PURE; // Returns the callback data pointer + + // Playback + STDMETHOD_(D3DXPLAYBACK_TYPE, GetPlaybackType)(THIS) PURE; + STDMETHOD_(DOUBLE, GetSourceTicksPerSecond)(THIS) PURE; + + // Scale keys + STDMETHOD(GetCompressedData)(THIS_ LPD3DXBUFFER *ppCompressedData) PURE; + + // Callback keys + STDMETHOD_(UINT, GetNumCallbackKeys)(THIS) PURE; + STDMETHOD(GetCallbackKeys)(THIS_ LPD3DXKEY_CALLBACK pCallbackKeys) PURE; +}; + + +//---------------------------------------------------------------------------- +// D3DXPRIORITY_TYPE: +// ------------------ +// This enum defines the type of priority group that a track can be assigned to. +//---------------------------------------------------------------------------- +typedef enum _D3DXPRIORITY_TYPE { + D3DXPRIORITY_LOW = 0, // This track should be blended with all low priority tracks before mixed with the high priority result + D3DXPRIORITY_HIGH = 1, // This track should be blended with all high priority tracks before mixed with the low priority result + + D3DXPRIORITY_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DXPRIORITY_TYPE; + +//---------------------------------------------------------------------------- +// D3DXTRACK_DESC: +// --------------- +// This structure describes the mixing information of an animation track. +// The mixing information consists of the current position, speed, and blending +// weight for the track. The Flags field also specifies whether the track is +// low or high priority. Tracks with the same priority are blended together +// and then the two resulting values are blended using the priority blend factor. +// A track also has an animation set (stored separately) associated with it. +//---------------------------------------------------------------------------- +typedef struct _D3DXTRACK_DESC +{ + D3DXPRIORITY_TYPE Priority; + FLOAT Weight; + FLOAT Speed; + DOUBLE Position; + BOOL Enable; +} D3DXTRACK_DESC, *LPD3DXTRACK_DESC; + +//---------------------------------------------------------------------------- +// D3DXEVENT_TYPE: +// --------------- +// This enum defines the type of events keyable via the animation controller. +//---------------------------------------------------------------------------- +typedef enum _D3DXEVENT_TYPE +{ + D3DXEVENT_TRACKSPEED = 0, + D3DXEVENT_TRACKWEIGHT = 1, + D3DXEVENT_TRACKPOSITION = 2, + D3DXEVENT_TRACKENABLE = 3, + D3DXEVENT_PRIORITYBLEND = 4, + + D3DXEVENT_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DXEVENT_TYPE; + +//---------------------------------------------------------------------------- +// D3DXTRANSITION_TYPE: +// -------------------- +// This enum defines the type of transtion performed on a event that +// transitions from one value to another. +//---------------------------------------------------------------------------- +typedef enum _D3DXTRANSITION_TYPE { + D3DXTRANSITION_LINEAR = 0x000, // Linear transition from one value to the next + D3DXTRANSITION_EASEINEASEOUT = 0x001, // Ease-In Ease-Out spline transtion from one value to the next + + D3DXTRANSITION_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DXTRANSITION_TYPE; + +//---------------------------------------------------------------------------- +// D3DXEVENT_DESC: +// --------------- +// This structure describes a animation controller event. +// It gives the event's type, track (if the event is a track event), global +// start time, duration, transition method, and target value. +//---------------------------------------------------------------------------- +typedef struct _D3DXEVENT_DESC +{ + D3DXEVENT_TYPE Type; + UINT Track; + DOUBLE StartTime; + DOUBLE Duration; + D3DXTRANSITION_TYPE Transition; + union + { + FLOAT Weight; + FLOAT Speed; + DOUBLE Position; + BOOL Enable; + }; +} D3DXEVENT_DESC, *LPD3DXEVENT_DESC; + +//---------------------------------------------------------------------------- +// D3DXEVENTHANDLE: +// ---------------- +// Handle values used to efficiently reference animation controller events. +//---------------------------------------------------------------------------- +typedef DWORD D3DXEVENTHANDLE; +typedef D3DXEVENTHANDLE *LPD3DXEVENTHANDLE; + + +//---------------------------------------------------------------------------- +// ID3DXAnimationCallbackHandler: +// ------------------------------ +// This interface is intended to be implemented by the application, and can +// be used to handle callbacks in animation sets generated when +// ID3DXAnimationController::AdvanceTime() is called. +//---------------------------------------------------------------------------- +typedef interface ID3DXAnimationCallbackHandler ID3DXAnimationCallbackHandler; +typedef interface ID3DXAnimationCallbackHandler *LPD3DXANIMATIONCALLBACKHANDLER; + +#undef INTERFACE +#define INTERFACE ID3DXAnimationCallbackHandler + +DECLARE_INTERFACE(ID3DXAnimationCallbackHandler) +{ + //---------------------------------------------------------------------------- + // ID3DXAnimationCallbackHandler::HandleCallback: + // ---------------------------------------------- + // This method gets called when a callback occurs for an animation set in one + // of the tracks during the ID3DXAnimationController::AdvanceTime() call. + // + // Parameters: + // Track + // Index of the track on which the callback occured. + // pCallbackData + // Pointer to user owned callback data. + // + //---------------------------------------------------------------------------- + STDMETHOD(HandleCallback)(THIS_ UINT Track, LPVOID pCallbackData) PURE; +}; + + +//---------------------------------------------------------------------------- +// ID3DXAnimationController: +// ------------------------- +// This interface implements the main animation functionality. It connects +// animation sets with the transform frames that are being animated. Allows +// mixing multiple animations for blended animations or for transistions +// It adds also has methods to modify blending parameters over time to +// enable smooth transistions and other effects. +//---------------------------------------------------------------------------- +typedef interface ID3DXAnimationController ID3DXAnimationController; +typedef interface ID3DXAnimationController *LPD3DXANIMATIONCONTROLLER; + +#undef INTERFACE +#define INTERFACE ID3DXAnimationController + +DECLARE_INTERFACE_(ID3DXAnimationController, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // Max sizes + STDMETHOD_(UINT, GetMaxNumAnimationOutputs)(THIS) PURE; + STDMETHOD_(UINT, GetMaxNumAnimationSets)(THIS) PURE; + STDMETHOD_(UINT, GetMaxNumTracks)(THIS) PURE; + STDMETHOD_(UINT, GetMaxNumEvents)(THIS) PURE; + + // Animation output registration + STDMETHOD(RegisterAnimationOutput)(THIS_ + LPCSTR pName, + D3DXMATRIX *pMatrix, + D3DXVECTOR3 *pScale, + D3DXQUATERNION *pRotation, + D3DXVECTOR3 *pTranslation) PURE; + + // Animation set registration + STDMETHOD(RegisterAnimationSet)(THIS_ LPD3DXANIMATIONSET pAnimSet) PURE; + STDMETHOD(UnregisterAnimationSet)(THIS_ LPD3DXANIMATIONSET pAnimSet) PURE; + + STDMETHOD_(UINT, GetNumAnimationSets)(THIS) PURE; + STDMETHOD(GetAnimationSet)(THIS_ UINT Index, LPD3DXANIMATIONSET *ppAnimationSet) PURE; + STDMETHOD(GetAnimationSetByName)(THIS_ LPCSTR szName, LPD3DXANIMATIONSET *ppAnimationSet) PURE; + + // Global time + STDMETHOD(AdvanceTime)(THIS_ DOUBLE TimeDelta, LPD3DXANIMATIONCALLBACKHANDLER pCallbackHandler) PURE; + STDMETHOD(ResetTime)(THIS) PURE; + STDMETHOD_(DOUBLE, GetTime)(THIS) PURE; + + // Tracks + STDMETHOD(SetTrackAnimationSet)(THIS_ UINT Track, LPD3DXANIMATIONSET pAnimSet) PURE; + STDMETHOD(GetTrackAnimationSet)(THIS_ UINT Track, LPD3DXANIMATIONSET *ppAnimSet) PURE; + + STDMETHOD(SetTrackPriority)(THIS_ UINT Track, D3DXPRIORITY_TYPE Priority) PURE; + + STDMETHOD(SetTrackSpeed)(THIS_ UINT Track, FLOAT Speed) PURE; + STDMETHOD(SetTrackWeight)(THIS_ UINT Track, FLOAT Weight) PURE; + STDMETHOD(SetTrackPosition)(THIS_ UINT Track, DOUBLE Position) PURE; + STDMETHOD(SetTrackEnable)(THIS_ UINT Track, BOOL Enable) PURE; + + STDMETHOD(SetTrackDesc)(THIS_ UINT Track, LPD3DXTRACK_DESC pDesc) PURE; + STDMETHOD(GetTrackDesc)(THIS_ UINT Track, LPD3DXTRACK_DESC pDesc) PURE; + + // Priority blending + STDMETHOD(SetPriorityBlend)(THIS_ FLOAT BlendWeight) PURE; + STDMETHOD_(FLOAT, GetPriorityBlend)(THIS) PURE; + + // Event keying + STDMETHOD_(D3DXEVENTHANDLE, KeyTrackSpeed)(THIS_ UINT Track, FLOAT NewSpeed, DOUBLE StartTime, DOUBLE Duration, D3DXTRANSITION_TYPE Transition) PURE; + STDMETHOD_(D3DXEVENTHANDLE, KeyTrackWeight)(THIS_ UINT Track, FLOAT NewWeight, DOUBLE StartTime, DOUBLE Duration, D3DXTRANSITION_TYPE Transition) PURE; + STDMETHOD_(D3DXEVENTHANDLE, KeyTrackPosition)(THIS_ UINT Track, DOUBLE NewPosition, DOUBLE StartTime) PURE; + STDMETHOD_(D3DXEVENTHANDLE, KeyTrackEnable)(THIS_ UINT Track, BOOL NewEnable, DOUBLE StartTime) PURE; + + STDMETHOD_(D3DXEVENTHANDLE, KeyPriorityBlend)(THIS_ FLOAT NewBlendWeight, DOUBLE StartTime, DOUBLE Duration, D3DXTRANSITION_TYPE Transition) PURE; + + // Event unkeying + STDMETHOD(UnkeyEvent)(THIS_ D3DXEVENTHANDLE hEvent) PURE; + + STDMETHOD(UnkeyAllTrackEvents)(THIS_ UINT Track) PURE; + STDMETHOD(UnkeyAllPriorityBlends)(THIS) PURE; + + // Event enumeration + STDMETHOD_(D3DXEVENTHANDLE, GetCurrentTrackEvent)(THIS_ UINT Track, D3DXEVENT_TYPE EventType) PURE; + STDMETHOD_(D3DXEVENTHANDLE, GetCurrentPriorityBlend)(THIS) PURE; + + STDMETHOD_(D3DXEVENTHANDLE, GetUpcomingTrackEvent)(THIS_ UINT Track, D3DXEVENTHANDLE hEvent) PURE; + STDMETHOD_(D3DXEVENTHANDLE, GetUpcomingPriorityBlend)(THIS_ D3DXEVENTHANDLE hEvent) PURE; + + STDMETHOD(ValidateEvent)(THIS_ D3DXEVENTHANDLE hEvent) PURE; + + STDMETHOD(GetEventDesc)(THIS_ D3DXEVENTHANDLE hEvent, LPD3DXEVENT_DESC pDesc) PURE; + + // Cloning + STDMETHOD(CloneAnimationController)(THIS_ + UINT MaxNumAnimationOutputs, + UINT MaxNumAnimationSets, + UINT MaxNumTracks, + UINT MaxNumEvents, + LPD3DXANIMATIONCONTROLLER *ppAnimController) PURE; +}; + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + + +//---------------------------------------------------------------------------- +// D3DXLoadMeshHierarchyFromX: +// --------------------------- +// Loads the first frame hierarchy in a .X file. +// +// Parameters: +// Filename +// Name of the .X file +// MeshOptions +// Mesh creation options for meshes in the file (see d3dx9mesh.h) +// pD3DDevice +// D3D9 device on which meshes in the file are created in +// pAlloc +// Allocation interface used to allocate nodes of the frame hierarchy +// pUserDataLoader +// Application provided interface to allow loading of user data +// ppFrameHierarchy +// Returns root node pointer of the loaded frame hierarchy +// ppAnimController +// Returns pointer to an animation controller corresponding to animation +// in the .X file. This is created with default max tracks and events +// +//---------------------------------------------------------------------------- +HRESULT WINAPI +D3DXLoadMeshHierarchyFromXA + ( + LPCSTR Filename, + DWORD MeshOptions, + LPDIRECT3DDEVICE9 pD3DDevice, + LPD3DXALLOCATEHIERARCHY pAlloc, + LPD3DXLOADUSERDATA pUserDataLoader, + LPD3DXFRAME *ppFrameHierarchy, + LPD3DXANIMATIONCONTROLLER *ppAnimController + ); + +HRESULT WINAPI +D3DXLoadMeshHierarchyFromXW + ( + LPCWSTR Filename, + DWORD MeshOptions, + LPDIRECT3DDEVICE9 pD3DDevice, + LPD3DXALLOCATEHIERARCHY pAlloc, + LPD3DXLOADUSERDATA pUserDataLoader, + LPD3DXFRAME *ppFrameHierarchy, + LPD3DXANIMATIONCONTROLLER *ppAnimController + ); + +#ifdef UNICODE +#define D3DXLoadMeshHierarchyFromX D3DXLoadMeshHierarchyFromXW +#else +#define D3DXLoadMeshHierarchyFromX D3DXLoadMeshHierarchyFromXA +#endif + +HRESULT WINAPI +D3DXLoadMeshHierarchyFromXInMemory + ( + LPCVOID Memory, + DWORD SizeOfMemory, + DWORD MeshOptions, + LPDIRECT3DDEVICE9 pD3DDevice, + LPD3DXALLOCATEHIERARCHY pAlloc, + LPD3DXLOADUSERDATA pUserDataLoader, + LPD3DXFRAME *ppFrameHierarchy, + LPD3DXANIMATIONCONTROLLER *ppAnimController + ); + +//---------------------------------------------------------------------------- +// D3DXSaveMeshHierarchyToFile: +// ---------------------------- +// Creates a .X file and saves the mesh hierarchy and corresponding animations +// in it +// +// Parameters: +// Filename +// Name of the .X file +// XFormat +// Format of the .X file (text or binary, compressed or not, etc) +// pFrameRoot +// Root node of the hierarchy to be saved +// pAnimController +// The animation controller whose animation sets are to be stored +// pUserDataSaver +// Application provided interface to allow adding of user data to +// data objects saved to .X file +// +//---------------------------------------------------------------------------- +HRESULT WINAPI +D3DXSaveMeshHierarchyToFileA + ( + LPCSTR Filename, + DWORD XFormat, + CONST D3DXFRAME *pFrameRoot, + LPD3DXANIMATIONCONTROLLER pAnimcontroller, + LPD3DXSAVEUSERDATA pUserDataSaver + ); + +HRESULT WINAPI +D3DXSaveMeshHierarchyToFileW + ( + LPCWSTR Filename, + DWORD XFormat, + CONST D3DXFRAME *pFrameRoot, + LPD3DXANIMATIONCONTROLLER pAnimController, + LPD3DXSAVEUSERDATA pUserDataSaver + ); + +#ifdef UNICODE +#define D3DXSaveMeshHierarchyToFile D3DXSaveMeshHierarchyToFileW +#else +#define D3DXSaveMeshHierarchyToFile D3DXSaveMeshHierarchyToFileA +#endif + +//---------------------------------------------------------------------------- +// D3DXFrameDestroy: +// ----------------- +// Destroys the subtree of frames under the root, including the root +// +// Parameters: +// pFrameRoot +// Pointer to the root node +// pAlloc +// Allocation interface used to de-allocate nodes of the frame hierarchy +// +//---------------------------------------------------------------------------- +HRESULT WINAPI +D3DXFrameDestroy + ( + LPD3DXFRAME pFrameRoot, + LPD3DXALLOCATEHIERARCHY pAlloc + ); + +//---------------------------------------------------------------------------- +// D3DXFrameAppendChild: +// --------------------- +// Add a child frame to a frame +// +// Parameters: +// pFrameParent +// Pointer to the parent node +// pFrameChild +// Pointer to the child node +// +//---------------------------------------------------------------------------- +HRESULT WINAPI +D3DXFrameAppendChild + ( + LPD3DXFRAME pFrameParent, + CONST D3DXFRAME *pFrameChild + ); + +//---------------------------------------------------------------------------- +// D3DXFrameFind: +// -------------- +// Finds a frame with the given name. Returns NULL if no frame found. +// +// Parameters: +// pFrameRoot +// Pointer to the root node +// Name +// Name of frame to find +// +//---------------------------------------------------------------------------- +LPD3DXFRAME WINAPI +D3DXFrameFind + ( + CONST D3DXFRAME *pFrameRoot, + LPCSTR Name + ); + +//---------------------------------------------------------------------------- +// D3DXFrameRegisterNamedMatrices: +// ------------------------------- +// Finds all frames that have non-null names and registers each of those frame +// matrices to the given animation controller +// +// Parameters: +// pFrameRoot +// Pointer to the root node +// pAnimController +// Pointer to the animation controller where the matrices are registered +// +//---------------------------------------------------------------------------- +HRESULT WINAPI +D3DXFrameRegisterNamedMatrices + ( + LPD3DXFRAME pFrameRoot, + LPD3DXANIMATIONCONTROLLER pAnimController + ); + +//---------------------------------------------------------------------------- +// D3DXFrameNumNamedMatrices: +// -------------------------- +// Counts number of frames in a subtree that have non-null names +// +// Parameters: +// pFrameRoot +// Pointer to the root node of the subtree +// Return Value: +// Count of frames +// +//---------------------------------------------------------------------------- +UINT WINAPI +D3DXFrameNumNamedMatrices + ( + CONST D3DXFRAME *pFrameRoot + ); + +//---------------------------------------------------------------------------- +// D3DXFrameCalculateBoundingSphere: +// --------------------------------- +// Computes the bounding sphere of all the meshes in the frame hierarchy. +// +// Parameters: +// pFrameRoot +// Pointer to the root node +// pObjectCenter +// Returns the center of the bounding sphere +// pObjectRadius +// Returns the radius of the bounding sphere +// +//---------------------------------------------------------------------------- +HRESULT WINAPI +D3DXFrameCalculateBoundingSphere + ( + CONST D3DXFRAME *pFrameRoot, + LPD3DXVECTOR3 pObjectCenter, + FLOAT *pObjectRadius + ); + + +//---------------------------------------------------------------------------- +// D3DXCreateKeyframedAnimationSet: +// -------------------------------- +// This function creates a compressable keyframed animations set interface. +// +// Parameters: +// pName +// Name of the animation set +// TicksPerSecond +// Number of keyframe ticks that elapse per second +// Playback +// Playback mode of keyframe looping +// NumAnimations +// Number of SRT animations +// NumCallbackKeys +// Number of callback keys +// pCallbackKeys +// Array of callback keys +// ppAnimationSet +// Returns the animation set interface +// +//----------------------------------------------------------------------------- +HRESULT WINAPI +D3DXCreateKeyframedAnimationSet + ( + LPCSTR pName, + DOUBLE TicksPerSecond, + D3DXPLAYBACK_TYPE Playback, + UINT NumAnimations, + UINT NumCallbackKeys, + CONST D3DXKEY_CALLBACK *pCallbackKeys, + LPD3DXKEYFRAMEDANIMATIONSET *ppAnimationSet + ); + + +//---------------------------------------------------------------------------- +// D3DXCreateCompressedAnimationSet: +// -------------------------------- +// This function creates a compressed animations set interface from +// compressed data. +// +// Parameters: +// pName +// Name of the animation set +// TicksPerSecond +// Number of keyframe ticks that elapse per second +// Playback +// Playback mode of keyframe looping +// pCompressedData +// Compressed animation SRT data +// NumCallbackKeys +// Number of callback keys +// pCallbackKeys +// Array of callback keys +// ppAnimationSet +// Returns the animation set interface +// +//----------------------------------------------------------------------------- +HRESULT WINAPI +D3DXCreateCompressedAnimationSet + ( + LPCSTR pName, + DOUBLE TicksPerSecond, + D3DXPLAYBACK_TYPE Playback, + LPD3DXBUFFER pCompressedData, + UINT NumCallbackKeys, + CONST D3DXKEY_CALLBACK *pCallbackKeys, + LPD3DXCOMPRESSEDANIMATIONSET *ppAnimationSet + ); + + +//---------------------------------------------------------------------------- +// D3DXCreateAnimationController: +// ------------------------------ +// This function creates an animation controller object. +// +// Parameters: +// MaxNumMatrices +// Maximum number of matrices that can be animated +// MaxNumAnimationSets +// Maximum number of animation sets that can be played +// MaxNumTracks +// Maximum number of animation sets that can be blended +// MaxNumEvents +// Maximum number of outstanding events that can be scheduled at any given time +// ppAnimController +// Returns the animation controller interface +// +//----------------------------------------------------------------------------- +HRESULT WINAPI +D3DXCreateAnimationController + ( + UINT MaxNumMatrices, + UINT MaxNumAnimationSets, + UINT MaxNumTracks, + UINT MaxNumEvents, + LPD3DXANIMATIONCONTROLLER *ppAnimController + ); + + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif //__D3DX9ANIM_H__ + + diff --git a/MediaClient/MediaClient/directx/include/d3dx9core.h b/MediaClient/MediaClient/directx/include/d3dx9core.h new file mode 100644 index 0000000..45243f4 --- /dev/null +++ b/MediaClient/MediaClient/directx/include/d3dx9core.h @@ -0,0 +1,753 @@ +/////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx9core.h +// Content: D3DX core types and functions +// +/////////////////////////////////////////////////////////////////////////// + +#include "d3dx9.h" + +#ifndef __D3DX9CORE_H__ +#define __D3DX9CORE_H__ + + +/////////////////////////////////////////////////////////////////////////// +// D3DX_SDK_VERSION: +// ----------------- +// This identifier is passed to D3DXCheckVersion in order to ensure that an +// application was built against the correct header files and lib files. +// This number is incremented whenever a header (or other) change would +// require applications to be rebuilt. If the version doesn't match, +// D3DXCheckVersion will return FALSE. (The number itself has no meaning.) +/////////////////////////////////////////////////////////////////////////// + +#define D3DX_VERSION 0x0902 + +#define D3DX_SDK_VERSION 43 + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + +BOOL WINAPI + D3DXCheckVersion(UINT D3DSdkVersion, UINT D3DXSdkVersion); + +#ifdef __cplusplus +} +#endif //__cplusplus + + + +/////////////////////////////////////////////////////////////////////////// +// D3DXDebugMute +// Mutes D3DX and D3D debug spew (TRUE - mute, FALSE - not mute) +// +// returns previous mute value +// +/////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + +BOOL WINAPI + D3DXDebugMute(BOOL Mute); + +#ifdef __cplusplus +} +#endif //__cplusplus + + +/////////////////////////////////////////////////////////////////////////// +// D3DXGetDriverLevel: +// Returns driver version information: +// +// 700 - DX7 level driver +// 800 - DX8 level driver +// 900 - DX9 level driver +/////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + +UINT WINAPI + D3DXGetDriverLevel(LPDIRECT3DDEVICE9 pDevice); + +#ifdef __cplusplus +} +#endif //__cplusplus + + +/////////////////////////////////////////////////////////////////////////// +// ID3DXBuffer: +// ------------ +// The buffer object is used by D3DX to return arbitrary size data. +// +// GetBufferPointer - +// Returns a pointer to the beginning of the buffer. +// +// GetBufferSize - +// Returns the size of the buffer, in bytes. +/////////////////////////////////////////////////////////////////////////// + +typedef interface ID3DXBuffer ID3DXBuffer; +typedef interface ID3DXBuffer *LPD3DXBUFFER; + +// {8BA5FB08-5195-40e2-AC58-0D989C3A0102} +DEFINE_GUID(IID_ID3DXBuffer, +0x8ba5fb08, 0x5195, 0x40e2, 0xac, 0x58, 0xd, 0x98, 0x9c, 0x3a, 0x1, 0x2); + +#undef INTERFACE +#define INTERFACE ID3DXBuffer + +DECLARE_INTERFACE_(ID3DXBuffer, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DXBuffer + STDMETHOD_(LPVOID, GetBufferPointer)(THIS) PURE; + STDMETHOD_(DWORD, GetBufferSize)(THIS) PURE; +}; + + + +////////////////////////////////////////////////////////////////////////////// +// D3DXSPRITE flags: +// ----------------- +// D3DXSPRITE_DONOTSAVESTATE +// Specifies device state is not to be saved and restored in Begin/End. +// D3DXSPRITE_DONOTMODIFY_RENDERSTATE +// Specifies device render state is not to be changed in Begin. The device +// is assumed to be in a valid state to draw vertices containing POSITION0, +// TEXCOORD0, and COLOR0 data. +// D3DXSPRITE_OBJECTSPACE +// The WORLD, VIEW, and PROJECTION transforms are NOT modified. The +// transforms currently set to the device are used to transform the sprites +// when the batch is drawn (at Flush or End). If this is not specified, +// WORLD, VIEW, and PROJECTION transforms are modified so that sprites are +// drawn in screenspace coordinates. +// D3DXSPRITE_BILLBOARD +// Rotates each sprite about its center so that it is facing the viewer. +// D3DXSPRITE_ALPHABLEND +// Enables ALPHABLEND(SRCALPHA, INVSRCALPHA) and ALPHATEST(alpha > 0). +// ID3DXFont expects this to be set when drawing text. +// D3DXSPRITE_SORT_TEXTURE +// Sprites are sorted by texture prior to drawing. This is recommended when +// drawing non-overlapping sprites of uniform depth. For example, drawing +// screen-aligned text with ID3DXFont. +// D3DXSPRITE_SORT_DEPTH_FRONTTOBACK +// Sprites are sorted by depth front-to-back prior to drawing. This is +// recommended when drawing opaque sprites of varying depths. +// D3DXSPRITE_SORT_DEPTH_BACKTOFRONT +// Sprites are sorted by depth back-to-front prior to drawing. This is +// recommended when drawing transparent sprites of varying depths. +// D3DXSPRITE_DO_NOT_ADDREF_TEXTURE +// Disables calling AddRef() on every draw, and Release() on Flush() for +// better performance. +////////////////////////////////////////////////////////////////////////////// + +#define D3DXSPRITE_DONOTSAVESTATE (1 << 0) +#define D3DXSPRITE_DONOTMODIFY_RENDERSTATE (1 << 1) +#define D3DXSPRITE_OBJECTSPACE (1 << 2) +#define D3DXSPRITE_BILLBOARD (1 << 3) +#define D3DXSPRITE_ALPHABLEND (1 << 4) +#define D3DXSPRITE_SORT_TEXTURE (1 << 5) +#define D3DXSPRITE_SORT_DEPTH_FRONTTOBACK (1 << 6) +#define D3DXSPRITE_SORT_DEPTH_BACKTOFRONT (1 << 7) +#define D3DXSPRITE_DO_NOT_ADDREF_TEXTURE (1 << 8) + + +////////////////////////////////////////////////////////////////////////////// +// ID3DXSprite: +// ------------ +// This object intends to provide an easy way to drawing sprites using D3D. +// +// Begin - +// Prepares device for drawing sprites. +// +// Draw - +// Draws a sprite. Before transformation, the sprite is the size of +// SrcRect, with its top-left corner specified by Position. The color +// and alpha channels are modulated by Color. +// +// Flush - +// Forces all batched sprites to submitted to the device. +// +// End - +// Restores device state to how it was when Begin was called. +// +// OnLostDevice, OnResetDevice - +// Call OnLostDevice() on this object before calling Reset() on the +// device, so that this object can release any stateblocks and video +// memory resources. After Reset(), the call OnResetDevice(). +////////////////////////////////////////////////////////////////////////////// + +typedef interface ID3DXSprite ID3DXSprite; +typedef interface ID3DXSprite *LPD3DXSPRITE; + + +// {BA0B762D-7D28-43ec-B9DC-2F84443B0614} +DEFINE_GUID(IID_ID3DXSprite, +0xba0b762d, 0x7d28, 0x43ec, 0xb9, 0xdc, 0x2f, 0x84, 0x44, 0x3b, 0x6, 0x14); + + +#undef INTERFACE +#define INTERFACE ID3DXSprite + +DECLARE_INTERFACE_(ID3DXSprite, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DXSprite + STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE; + + STDMETHOD(GetTransform)(THIS_ D3DXMATRIX *pTransform) PURE; + STDMETHOD(SetTransform)(THIS_ CONST D3DXMATRIX *pTransform) PURE; + + STDMETHOD(SetWorldViewRH)(THIS_ CONST D3DXMATRIX *pWorld, CONST D3DXMATRIX *pView) PURE; + STDMETHOD(SetWorldViewLH)(THIS_ CONST D3DXMATRIX *pWorld, CONST D3DXMATRIX *pView) PURE; + + STDMETHOD(Begin)(THIS_ DWORD Flags) PURE; + STDMETHOD(Draw)(THIS_ LPDIRECT3DTEXTURE9 pTexture, CONST RECT *pSrcRect, CONST D3DXVECTOR3 *pCenter, CONST D3DXVECTOR3 *pPosition, D3DCOLOR Color) PURE; + STDMETHOD(Flush)(THIS) PURE; + STDMETHOD(End)(THIS) PURE; + + STDMETHOD(OnLostDevice)(THIS) PURE; + STDMETHOD(OnResetDevice)(THIS) PURE; +}; + + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + +HRESULT WINAPI + D3DXCreateSprite( + LPDIRECT3DDEVICE9 pDevice, + LPD3DXSPRITE* ppSprite); + +#ifdef __cplusplus +} +#endif //__cplusplus + + + +////////////////////////////////////////////////////////////////////////////// +// ID3DXFont: +// ---------- +// Font objects contain the textures and resources needed to render a specific +// font on a specific device. +// +// GetGlyphData - +// Returns glyph cache data, for a given glyph. +// +// PreloadCharacters/PreloadGlyphs/PreloadText - +// Preloads glyphs into the glyph cache textures. +// +// DrawText - +// Draws formatted text on a D3D device. Some parameters are +// surprisingly similar to those of GDI's DrawText function. See GDI +// documentation for a detailed description of these parameters. +// If pSprite is NULL, an internal sprite object will be used. +// +// OnLostDevice, OnResetDevice - +// Call OnLostDevice() on this object before calling Reset() on the +// device, so that this object can release any stateblocks and video +// memory resources. After Reset(), the call OnResetDevice(). +////////////////////////////////////////////////////////////////////////////// + +typedef struct _D3DXFONT_DESCA +{ + INT Height; + UINT Width; + UINT Weight; + UINT MipLevels; + BOOL Italic; + BYTE CharSet; + BYTE OutputPrecision; + BYTE Quality; + BYTE PitchAndFamily; + CHAR FaceName[LF_FACESIZE]; + +} D3DXFONT_DESCA, *LPD3DXFONT_DESCA; + +typedef struct _D3DXFONT_DESCW +{ + INT Height; + UINT Width; + UINT Weight; + UINT MipLevels; + BOOL Italic; + BYTE CharSet; + BYTE OutputPrecision; + BYTE Quality; + BYTE PitchAndFamily; + WCHAR FaceName[LF_FACESIZE]; + +} D3DXFONT_DESCW, *LPD3DXFONT_DESCW; + +#ifdef UNICODE +typedef D3DXFONT_DESCW D3DXFONT_DESC; +typedef LPD3DXFONT_DESCW LPD3DXFONT_DESC; +#else +typedef D3DXFONT_DESCA D3DXFONT_DESC; +typedef LPD3DXFONT_DESCA LPD3DXFONT_DESC; +#endif + + +typedef interface ID3DXFont ID3DXFont; +typedef interface ID3DXFont *LPD3DXFONT; + + +// {D79DBB70-5F21-4d36-BBC2-FF525C213CDC} +DEFINE_GUID(IID_ID3DXFont, +0xd79dbb70, 0x5f21, 0x4d36, 0xbb, 0xc2, 0xff, 0x52, 0x5c, 0x21, 0x3c, 0xdc); + + +#undef INTERFACE +#define INTERFACE ID3DXFont + +DECLARE_INTERFACE_(ID3DXFont, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DXFont + STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9 *ppDevice) PURE; + STDMETHOD(GetDescA)(THIS_ D3DXFONT_DESCA *pDesc) PURE; + STDMETHOD(GetDescW)(THIS_ D3DXFONT_DESCW *pDesc) PURE; + STDMETHOD_(BOOL, GetTextMetricsA)(THIS_ TEXTMETRICA *pTextMetrics) PURE; + STDMETHOD_(BOOL, GetTextMetricsW)(THIS_ TEXTMETRICW *pTextMetrics) PURE; + + STDMETHOD_(HDC, GetDC)(THIS) PURE; + STDMETHOD(GetGlyphData)(THIS_ UINT Glyph, LPDIRECT3DTEXTURE9 *ppTexture, RECT *pBlackBox, POINT *pCellInc) PURE; + + STDMETHOD(PreloadCharacters)(THIS_ UINT First, UINT Last) PURE; + STDMETHOD(PreloadGlyphs)(THIS_ UINT First, UINT Last) PURE; + STDMETHOD(PreloadTextA)(THIS_ LPCSTR pString, INT Count) PURE; + STDMETHOD(PreloadTextW)(THIS_ LPCWSTR pString, INT Count) PURE; + + STDMETHOD_(INT, DrawTextA)(THIS_ LPD3DXSPRITE pSprite, LPCSTR pString, INT Count, LPRECT pRect, DWORD Format, D3DCOLOR Color) PURE; + STDMETHOD_(INT, DrawTextW)(THIS_ LPD3DXSPRITE pSprite, LPCWSTR pString, INT Count, LPRECT pRect, DWORD Format, D3DCOLOR Color) PURE; + + STDMETHOD(OnLostDevice)(THIS) PURE; + STDMETHOD(OnResetDevice)(THIS) PURE; + +#ifdef __cplusplus +#ifdef UNICODE + HRESULT GetDesc(D3DXFONT_DESCW *pDesc) { return GetDescW(pDesc); } + HRESULT PreloadText(LPCWSTR pString, INT Count) { return PreloadTextW(pString, Count); } +#else + HRESULT GetDesc(D3DXFONT_DESCA *pDesc) { return GetDescA(pDesc); } + HRESULT PreloadText(LPCSTR pString, INT Count) { return PreloadTextA(pString, Count); } +#endif +#endif //__cplusplus +}; + +#ifndef GetTextMetrics +#ifdef UNICODE +#define GetTextMetrics GetTextMetricsW +#else +#define GetTextMetrics GetTextMetricsA +#endif +#endif + +#ifndef DrawText +#ifdef UNICODE +#define DrawText DrawTextW +#else +#define DrawText DrawTextA +#endif +#endif + + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + + +HRESULT WINAPI + D3DXCreateFontA( + LPDIRECT3DDEVICE9 pDevice, + INT Height, + UINT Width, + UINT Weight, + UINT MipLevels, + BOOL Italic, + DWORD CharSet, + DWORD OutputPrecision, + DWORD Quality, + DWORD PitchAndFamily, + LPCSTR pFaceName, + LPD3DXFONT* ppFont); + +HRESULT WINAPI + D3DXCreateFontW( + LPDIRECT3DDEVICE9 pDevice, + INT Height, + UINT Width, + UINT Weight, + UINT MipLevels, + BOOL Italic, + DWORD CharSet, + DWORD OutputPrecision, + DWORD Quality, + DWORD PitchAndFamily, + LPCWSTR pFaceName, + LPD3DXFONT* ppFont); + +#ifdef UNICODE +#define D3DXCreateFont D3DXCreateFontW +#else +#define D3DXCreateFont D3DXCreateFontA +#endif + + +HRESULT WINAPI + D3DXCreateFontIndirectA( + LPDIRECT3DDEVICE9 pDevice, + CONST D3DXFONT_DESCA* pDesc, + LPD3DXFONT* ppFont); + +HRESULT WINAPI + D3DXCreateFontIndirectW( + LPDIRECT3DDEVICE9 pDevice, + CONST D3DXFONT_DESCW* pDesc, + LPD3DXFONT* ppFont); + +#ifdef UNICODE +#define D3DXCreateFontIndirect D3DXCreateFontIndirectW +#else +#define D3DXCreateFontIndirect D3DXCreateFontIndirectA +#endif + + +#ifdef __cplusplus +} +#endif //__cplusplus + + + +/////////////////////////////////////////////////////////////////////////// +// ID3DXRenderToSurface: +// --------------------- +// This object abstracts rendering to surfaces. These surfaces do not +// necessarily need to be render targets. If they are not, a compatible +// render target is used, and the result copied into surface at end scene. +// +// BeginScene, EndScene - +// Call BeginScene() and EndScene() at the beginning and ending of your +// scene. These calls will setup and restore render targets, viewports, +// etc.. +// +// OnLostDevice, OnResetDevice - +// Call OnLostDevice() on this object before calling Reset() on the +// device, so that this object can release any stateblocks and video +// memory resources. After Reset(), the call OnResetDevice(). +/////////////////////////////////////////////////////////////////////////// + +typedef struct _D3DXRTS_DESC +{ + UINT Width; + UINT Height; + D3DFORMAT Format; + BOOL DepthStencil; + D3DFORMAT DepthStencilFormat; + +} D3DXRTS_DESC, *LPD3DXRTS_DESC; + + +typedef interface ID3DXRenderToSurface ID3DXRenderToSurface; +typedef interface ID3DXRenderToSurface *LPD3DXRENDERTOSURFACE; + + +// {6985F346-2C3D-43b3-BE8B-DAAE8A03D894} +DEFINE_GUID(IID_ID3DXRenderToSurface, +0x6985f346, 0x2c3d, 0x43b3, 0xbe, 0x8b, 0xda, 0xae, 0x8a, 0x3, 0xd8, 0x94); + + +#undef INTERFACE +#define INTERFACE ID3DXRenderToSurface + +DECLARE_INTERFACE_(ID3DXRenderToSurface, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DXRenderToSurface + STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE; + STDMETHOD(GetDesc)(THIS_ D3DXRTS_DESC* pDesc) PURE; + + STDMETHOD(BeginScene)(THIS_ LPDIRECT3DSURFACE9 pSurface, CONST D3DVIEWPORT9* pViewport) PURE; + STDMETHOD(EndScene)(THIS_ DWORD MipFilter) PURE; + + STDMETHOD(OnLostDevice)(THIS) PURE; + STDMETHOD(OnResetDevice)(THIS) PURE; +}; + + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + +HRESULT WINAPI + D3DXCreateRenderToSurface( + LPDIRECT3DDEVICE9 pDevice, + UINT Width, + UINT Height, + D3DFORMAT Format, + BOOL DepthStencil, + D3DFORMAT DepthStencilFormat, + LPD3DXRENDERTOSURFACE* ppRenderToSurface); + +#ifdef __cplusplus +} +#endif //__cplusplus + + + +/////////////////////////////////////////////////////////////////////////// +// ID3DXRenderToEnvMap: +// -------------------- +// This object abstracts rendering to environment maps. These surfaces +// do not necessarily need to be render targets. If they are not, a +// compatible render target is used, and the result copied into the +// environment map at end scene. +// +// BeginCube, BeginSphere, BeginHemisphere, BeginParabolic - +// This function initiates the rendering of the environment map. As +// parameters, you pass the textures in which will get filled in with +// the resulting environment map. +// +// Face - +// Call this function to initiate the drawing of each face. For each +// environment map, you will call this six times.. once for each face +// in D3DCUBEMAP_FACES. +// +// End - +// This will restore all render targets, and if needed compose all the +// rendered faces into the environment map surfaces. +// +// OnLostDevice, OnResetDevice - +// Call OnLostDevice() on this object before calling Reset() on the +// device, so that this object can release any stateblocks and video +// memory resources. After Reset(), the call OnResetDevice(). +/////////////////////////////////////////////////////////////////////////// + +typedef struct _D3DXRTE_DESC +{ + UINT Size; + UINT MipLevels; + D3DFORMAT Format; + BOOL DepthStencil; + D3DFORMAT DepthStencilFormat; + +} D3DXRTE_DESC, *LPD3DXRTE_DESC; + + +typedef interface ID3DXRenderToEnvMap ID3DXRenderToEnvMap; +typedef interface ID3DXRenderToEnvMap *LPD3DXRenderToEnvMap; + + +// {313F1B4B-C7B0-4fa2-9D9D-8D380B64385E} +DEFINE_GUID(IID_ID3DXRenderToEnvMap, +0x313f1b4b, 0xc7b0, 0x4fa2, 0x9d, 0x9d, 0x8d, 0x38, 0xb, 0x64, 0x38, 0x5e); + + +#undef INTERFACE +#define INTERFACE ID3DXRenderToEnvMap + +DECLARE_INTERFACE_(ID3DXRenderToEnvMap, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DXRenderToEnvMap + STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE; + STDMETHOD(GetDesc)(THIS_ D3DXRTE_DESC* pDesc) PURE; + + STDMETHOD(BeginCube)(THIS_ + LPDIRECT3DCUBETEXTURE9 pCubeTex) PURE; + + STDMETHOD(BeginSphere)(THIS_ + LPDIRECT3DTEXTURE9 pTex) PURE; + + STDMETHOD(BeginHemisphere)(THIS_ + LPDIRECT3DTEXTURE9 pTexZPos, + LPDIRECT3DTEXTURE9 pTexZNeg) PURE; + + STDMETHOD(BeginParabolic)(THIS_ + LPDIRECT3DTEXTURE9 pTexZPos, + LPDIRECT3DTEXTURE9 pTexZNeg) PURE; + + STDMETHOD(Face)(THIS_ D3DCUBEMAP_FACES Face, DWORD MipFilter) PURE; + STDMETHOD(End)(THIS_ DWORD MipFilter) PURE; + + STDMETHOD(OnLostDevice)(THIS) PURE; + STDMETHOD(OnResetDevice)(THIS) PURE; +}; + + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + +HRESULT WINAPI + D3DXCreateRenderToEnvMap( + LPDIRECT3DDEVICE9 pDevice, + UINT Size, + UINT MipLevels, + D3DFORMAT Format, + BOOL DepthStencil, + D3DFORMAT DepthStencilFormat, + LPD3DXRenderToEnvMap* ppRenderToEnvMap); + +#ifdef __cplusplus +} +#endif //__cplusplus + + + +/////////////////////////////////////////////////////////////////////////// +// ID3DXLine: +// ------------ +// This object intends to provide an easy way to draw lines using D3D. +// +// Begin - +// Prepares device for drawing lines +// +// Draw - +// Draws a line strip in screen-space. +// Input is in the form of a array defining points on the line strip. of D3DXVECTOR2 +// +// DrawTransform - +// Draws a line in screen-space with a specified input transformation matrix. +// +// End - +// Restores device state to how it was when Begin was called. +// +// SetPattern - +// Applies a stipple pattern to the line. Input is one 32-bit +// DWORD which describes the stipple pattern. 1 is opaque, 0 is +// transparent. +// +// SetPatternScale - +// Stretches the stipple pattern in the u direction. Input is one +// floating-point value. 0.0f is no scaling, whereas 1.0f doubles +// the length of the stipple pattern. +// +// SetWidth - +// Specifies the thickness of the line in the v direction. Input is +// one floating-point value. +// +// SetAntialias - +// Toggles line antialiasing. Input is a BOOL. +// TRUE = Antialiasing on. +// FALSE = Antialiasing off. +// +// SetGLLines - +// Toggles non-antialiased OpenGL line emulation. Input is a BOOL. +// TRUE = OpenGL line emulation on. +// FALSE = OpenGL line emulation off. +// +// OpenGL line: Regular line: +// *\ *\ +// | \ / \ +// | \ *\ \ +// *\ \ \ \ +// \ \ \ \ +// \ * \ * +// \ | \ / +// \| * +// * +// +// OnLostDevice, OnResetDevice - +// Call OnLostDevice() on this object before calling Reset() on the +// device, so that this object can release any stateblocks and video +// memory resources. After Reset(), the call OnResetDevice(). +/////////////////////////////////////////////////////////////////////////// + + +typedef interface ID3DXLine ID3DXLine; +typedef interface ID3DXLine *LPD3DXLINE; + + +// {D379BA7F-9042-4ac4-9F5E-58192A4C6BD8} +DEFINE_GUID(IID_ID3DXLine, +0xd379ba7f, 0x9042, 0x4ac4, 0x9f, 0x5e, 0x58, 0x19, 0x2a, 0x4c, 0x6b, 0xd8); + +#undef INTERFACE +#define INTERFACE ID3DXLine + +DECLARE_INTERFACE_(ID3DXLine, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DXLine + STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE; + + STDMETHOD(Begin)(THIS) PURE; + + STDMETHOD(Draw)(THIS_ CONST D3DXVECTOR2 *pVertexList, + DWORD dwVertexListCount, D3DCOLOR Color) PURE; + + STDMETHOD(DrawTransform)(THIS_ CONST D3DXVECTOR3 *pVertexList, + DWORD dwVertexListCount, CONST D3DXMATRIX* pTransform, + D3DCOLOR Color) PURE; + + STDMETHOD(SetPattern)(THIS_ DWORD dwPattern) PURE; + STDMETHOD_(DWORD, GetPattern)(THIS) PURE; + + STDMETHOD(SetPatternScale)(THIS_ FLOAT fPatternScale) PURE; + STDMETHOD_(FLOAT, GetPatternScale)(THIS) PURE; + + STDMETHOD(SetWidth)(THIS_ FLOAT fWidth) PURE; + STDMETHOD_(FLOAT, GetWidth)(THIS) PURE; + + STDMETHOD(SetAntialias)(THIS_ BOOL bAntialias) PURE; + STDMETHOD_(BOOL, GetAntialias)(THIS) PURE; + + STDMETHOD(SetGLLines)(THIS_ BOOL bGLLines) PURE; + STDMETHOD_(BOOL, GetGLLines)(THIS) PURE; + + STDMETHOD(End)(THIS) PURE; + + STDMETHOD(OnLostDevice)(THIS) PURE; + STDMETHOD(OnResetDevice)(THIS) PURE; +}; + + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + + +HRESULT WINAPI + D3DXCreateLine( + LPDIRECT3DDEVICE9 pDevice, + LPD3DXLINE* ppLine); + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif //__D3DX9CORE_H__ + diff --git a/MediaClient/MediaClient/directx/include/d3dx9effect.h b/MediaClient/MediaClient/directx/include/d3dx9effect.h new file mode 100644 index 0000000..a3bcd30 --- /dev/null +++ b/MediaClient/MediaClient/directx/include/d3dx9effect.h @@ -0,0 +1,873 @@ + +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// File: d3dx9effect.h +// Content: D3DX effect types and Shaders +// +////////////////////////////////////////////////////////////////////////////// + +#include "d3dx9.h" + +#ifndef __D3DX9EFFECT_H__ +#define __D3DX9EFFECT_H__ + + +//---------------------------------------------------------------------------- +// D3DXFX_DONOTSAVESTATE +// This flag is used as a parameter to ID3DXEffect::Begin(). When this flag +// is specified, device state is not saved or restored in Begin/End. +// D3DXFX_DONOTSAVESHADERSTATE +// This flag is used as a parameter to ID3DXEffect::Begin(). When this flag +// is specified, shader device state is not saved or restored in Begin/End. +// This includes pixel/vertex shaders and shader constants +// D3DXFX_DONOTSAVESAMPLERSTATE +// This flag is used as a parameter to ID3DXEffect::Begin(). When this flag +// is specified, sampler device state is not saved or restored in Begin/End. +// D3DXFX_NOT_CLONEABLE +// This flag is used as a parameter to the D3DXCreateEffect family of APIs. +// When this flag is specified, the effect will be non-cloneable and will not +// contain any shader binary data. +// Furthermore, GetPassDesc will not return shader function pointers. +// Setting this flag reduces effect memory usage by about 50%. +//---------------------------------------------------------------------------- + +#define D3DXFX_DONOTSAVESTATE (1 << 0) +#define D3DXFX_DONOTSAVESHADERSTATE (1 << 1) +#define D3DXFX_DONOTSAVESAMPLERSTATE (1 << 2) + +#define D3DXFX_NOT_CLONEABLE (1 << 11) +#define D3DXFX_LARGEADDRESSAWARE (1 << 17) + +//---------------------------------------------------------------------------- +// D3DX_PARAMETER_SHARED +// Indicates that the value of a parameter will be shared with all effects +// which share the same namespace. Changing the value in one effect will +// change it in all. +// +// D3DX_PARAMETER_LITERAL +// Indicates that the value of this parameter can be treated as literal. +// Literal parameters can be marked when the effect is compiled, and their +// cannot be changed after the effect is compiled. Shared parameters cannot +// be literal. +//---------------------------------------------------------------------------- + +#define D3DX_PARAMETER_SHARED (1 << 0) +#define D3DX_PARAMETER_LITERAL (1 << 1) +#define D3DX_PARAMETER_ANNOTATION (1 << 2) + +//---------------------------------------------------------------------------- +// D3DXEFFECT_DESC: +//---------------------------------------------------------------------------- + +typedef struct _D3DXEFFECT_DESC +{ + LPCSTR Creator; // Creator string + UINT Parameters; // Number of parameters + UINT Techniques; // Number of techniques + UINT Functions; // Number of function entrypoints + +} D3DXEFFECT_DESC; + + +//---------------------------------------------------------------------------- +// D3DXPARAMETER_DESC: +//---------------------------------------------------------------------------- + +typedef struct _D3DXPARAMETER_DESC +{ + LPCSTR Name; // Parameter name + LPCSTR Semantic; // Parameter semantic + D3DXPARAMETER_CLASS Class; // Class + D3DXPARAMETER_TYPE Type; // Component type + UINT Rows; // Number of rows + UINT Columns; // Number of columns + UINT Elements; // Number of array elements + UINT Annotations; // Number of annotations + UINT StructMembers; // Number of structure member sub-parameters + DWORD Flags; // D3DX_PARAMETER_* flags + UINT Bytes; // Parameter size, in bytes + +} D3DXPARAMETER_DESC; + + +//---------------------------------------------------------------------------- +// D3DXTECHNIQUE_DESC: +//---------------------------------------------------------------------------- + +typedef struct _D3DXTECHNIQUE_DESC +{ + LPCSTR Name; // Technique name + UINT Passes; // Number of passes + UINT Annotations; // Number of annotations + +} D3DXTECHNIQUE_DESC; + + +//---------------------------------------------------------------------------- +// D3DXPASS_DESC: +//---------------------------------------------------------------------------- + +typedef struct _D3DXPASS_DESC +{ + LPCSTR Name; // Pass name + UINT Annotations; // Number of annotations + + CONST DWORD *pVertexShaderFunction; // Vertex shader function + CONST DWORD *pPixelShaderFunction; // Pixel shader function + +} D3DXPASS_DESC; + + +//---------------------------------------------------------------------------- +// D3DXFUNCTION_DESC: +//---------------------------------------------------------------------------- + +typedef struct _D3DXFUNCTION_DESC +{ + LPCSTR Name; // Function name + UINT Annotations; // Number of annotations + +} D3DXFUNCTION_DESC; + + + +////////////////////////////////////////////////////////////////////////////// +// ID3DXEffectPool /////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +typedef interface ID3DXEffectPool ID3DXEffectPool; +typedef interface ID3DXEffectPool *LPD3DXEFFECTPOOL; + +// {9537AB04-3250-412e-8213-FCD2F8677933} +DEFINE_GUID(IID_ID3DXEffectPool, +0x9537ab04, 0x3250, 0x412e, 0x82, 0x13, 0xfc, 0xd2, 0xf8, 0x67, 0x79, 0x33); + + +#undef INTERFACE +#define INTERFACE ID3DXEffectPool + +DECLARE_INTERFACE_(ID3DXEffectPool, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // No public methods +}; + + +////////////////////////////////////////////////////////////////////////////// +// ID3DXBaseEffect /////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +typedef interface ID3DXBaseEffect ID3DXBaseEffect; +typedef interface ID3DXBaseEffect *LPD3DXBASEEFFECT; + +// {017C18AC-103F-4417-8C51-6BF6EF1E56BE} +DEFINE_GUID(IID_ID3DXBaseEffect, +0x17c18ac, 0x103f, 0x4417, 0x8c, 0x51, 0x6b, 0xf6, 0xef, 0x1e, 0x56, 0xbe); + + +#undef INTERFACE +#define INTERFACE ID3DXBaseEffect + +DECLARE_INTERFACE_(ID3DXBaseEffect, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // Descs + STDMETHOD(GetDesc)(THIS_ D3DXEFFECT_DESC* pDesc) PURE; + STDMETHOD(GetParameterDesc)(THIS_ D3DXHANDLE hParameter, D3DXPARAMETER_DESC* pDesc) PURE; + STDMETHOD(GetTechniqueDesc)(THIS_ D3DXHANDLE hTechnique, D3DXTECHNIQUE_DESC* pDesc) PURE; + STDMETHOD(GetPassDesc)(THIS_ D3DXHANDLE hPass, D3DXPASS_DESC* pDesc) PURE; + STDMETHOD(GetFunctionDesc)(THIS_ D3DXHANDLE hShader, D3DXFUNCTION_DESC* pDesc) PURE; + + // Handle operations + STDMETHOD_(D3DXHANDLE, GetParameter)(THIS_ D3DXHANDLE hParameter, UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetParameterByName)(THIS_ D3DXHANDLE hParameter, LPCSTR pName) PURE; + STDMETHOD_(D3DXHANDLE, GetParameterBySemantic)(THIS_ D3DXHANDLE hParameter, LPCSTR pSemantic) PURE; + STDMETHOD_(D3DXHANDLE, GetParameterElement)(THIS_ D3DXHANDLE hParameter, UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetTechnique)(THIS_ UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetTechniqueByName)(THIS_ LPCSTR pName) PURE; + STDMETHOD_(D3DXHANDLE, GetPass)(THIS_ D3DXHANDLE hTechnique, UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetPassByName)(THIS_ D3DXHANDLE hTechnique, LPCSTR pName) PURE; + STDMETHOD_(D3DXHANDLE, GetFunction)(THIS_ UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetFunctionByName)(THIS_ LPCSTR pName) PURE; + STDMETHOD_(D3DXHANDLE, GetAnnotation)(THIS_ D3DXHANDLE hObject, UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetAnnotationByName)(THIS_ D3DXHANDLE hObject, LPCSTR pName) PURE; + + // Get/Set Parameters + STDMETHOD(SetValue)(THIS_ D3DXHANDLE hParameter, LPCVOID pData, UINT Bytes) PURE; + STDMETHOD(GetValue)(THIS_ D3DXHANDLE hParameter, LPVOID pData, UINT Bytes) PURE; + STDMETHOD(SetBool)(THIS_ D3DXHANDLE hParameter, BOOL b) PURE; + STDMETHOD(GetBool)(THIS_ D3DXHANDLE hParameter, BOOL* pb) PURE; + STDMETHOD(SetBoolArray)(THIS_ D3DXHANDLE hParameter, CONST BOOL* pb, UINT Count) PURE; + STDMETHOD(GetBoolArray)(THIS_ D3DXHANDLE hParameter, BOOL* pb, UINT Count) PURE; + STDMETHOD(SetInt)(THIS_ D3DXHANDLE hParameter, INT n) PURE; + STDMETHOD(GetInt)(THIS_ D3DXHANDLE hParameter, INT* pn) PURE; + STDMETHOD(SetIntArray)(THIS_ D3DXHANDLE hParameter, CONST INT* pn, UINT Count) PURE; + STDMETHOD(GetIntArray)(THIS_ D3DXHANDLE hParameter, INT* pn, UINT Count) PURE; + STDMETHOD(SetFloat)(THIS_ D3DXHANDLE hParameter, FLOAT f) PURE; + STDMETHOD(GetFloat)(THIS_ D3DXHANDLE hParameter, FLOAT* pf) PURE; + STDMETHOD(SetFloatArray)(THIS_ D3DXHANDLE hParameter, CONST FLOAT* pf, UINT Count) PURE; + STDMETHOD(GetFloatArray)(THIS_ D3DXHANDLE hParameter, FLOAT* pf, UINT Count) PURE; + STDMETHOD(SetVector)(THIS_ D3DXHANDLE hParameter, CONST D3DXVECTOR4* pVector) PURE; + STDMETHOD(GetVector)(THIS_ D3DXHANDLE hParameter, D3DXVECTOR4* pVector) PURE; + STDMETHOD(SetVectorArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXVECTOR4* pVector, UINT Count) PURE; + STDMETHOD(GetVectorArray)(THIS_ D3DXHANDLE hParameter, D3DXVECTOR4* pVector, UINT Count) PURE; + STDMETHOD(SetMatrix)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix) PURE; + STDMETHOD(GetMatrix)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix) PURE; + STDMETHOD(SetMatrixArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix, UINT Count) PURE; + STDMETHOD(GetMatrixArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix, UINT Count) PURE; + STDMETHOD(SetMatrixPointerArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX** ppMatrix, UINT Count) PURE; + STDMETHOD(GetMatrixPointerArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX** ppMatrix, UINT Count) PURE; + STDMETHOD(SetMatrixTranspose)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix) PURE; + STDMETHOD(GetMatrixTranspose)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix) PURE; + STDMETHOD(SetMatrixTransposeArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix, UINT Count) PURE; + STDMETHOD(GetMatrixTransposeArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix, UINT Count) PURE; + STDMETHOD(SetMatrixTransposePointerArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX** ppMatrix, UINT Count) PURE; + STDMETHOD(GetMatrixTransposePointerArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX** ppMatrix, UINT Count) PURE; + STDMETHOD(SetString)(THIS_ D3DXHANDLE hParameter, LPCSTR pString) PURE; + STDMETHOD(GetString)(THIS_ D3DXHANDLE hParameter, LPCSTR* ppString) PURE; + STDMETHOD(SetTexture)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DBASETEXTURE9 pTexture) PURE; + STDMETHOD(GetTexture)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DBASETEXTURE9 *ppTexture) PURE; + STDMETHOD(GetPixelShader)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DPIXELSHADER9 *ppPShader) PURE; + STDMETHOD(GetVertexShader)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DVERTEXSHADER9 *ppVShader) PURE; + + //Set Range of an Array to pass to device + //Useful for sending only a subrange of an array down to the device + STDMETHOD(SetArrayRange)(THIS_ D3DXHANDLE hParameter, UINT uStart, UINT uEnd) PURE; + +}; + + +//---------------------------------------------------------------------------- +// ID3DXEffectStateManager: +// ------------------------ +// This is a user implemented interface that can be used to manage device +// state changes made by an Effect. +//---------------------------------------------------------------------------- + +typedef interface ID3DXEffectStateManager ID3DXEffectStateManager; +typedef interface ID3DXEffectStateManager *LPD3DXEFFECTSTATEMANAGER; + +// {79AAB587-6DBC-4fa7-82DE-37FA1781C5CE} +DEFINE_GUID(IID_ID3DXEffectStateManager, +0x79aab587, 0x6dbc, 0x4fa7, 0x82, 0xde, 0x37, 0xfa, 0x17, 0x81, 0xc5, 0xce); + +#undef INTERFACE +#define INTERFACE ID3DXEffectStateManager + +DECLARE_INTERFACE_(ID3DXEffectStateManager, IUnknown) +{ + // The user must correctly implement QueryInterface, AddRef, and Release. + + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // The following methods are called by the Effect when it wants to make + // the corresponding device call. Note that: + // 1. Users manage the state and are therefore responsible for making the + // the corresponding device calls themselves inside their callbacks. + // 2. Effects pay attention to the return values of the callbacks, and so + // users must pay attention to what they return in their callbacks. + + STDMETHOD(SetTransform)(THIS_ D3DTRANSFORMSTATETYPE State, CONST D3DMATRIX *pMatrix) PURE; + STDMETHOD(SetMaterial)(THIS_ CONST D3DMATERIAL9 *pMaterial) PURE; + STDMETHOD(SetLight)(THIS_ DWORD Index, CONST D3DLIGHT9 *pLight) PURE; + STDMETHOD(LightEnable)(THIS_ DWORD Index, BOOL Enable) PURE; + STDMETHOD(SetRenderState)(THIS_ D3DRENDERSTATETYPE State, DWORD Value) PURE; + STDMETHOD(SetTexture)(THIS_ DWORD Stage, LPDIRECT3DBASETEXTURE9 pTexture) PURE; + STDMETHOD(SetTextureStageState)(THIS_ DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD Value) PURE; + STDMETHOD(SetSamplerState)(THIS_ DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD Value) PURE; + STDMETHOD(SetNPatchMode)(THIS_ FLOAT NumSegments) PURE; + STDMETHOD(SetFVF)(THIS_ DWORD FVF) PURE; + STDMETHOD(SetVertexShader)(THIS_ LPDIRECT3DVERTEXSHADER9 pShader) PURE; + STDMETHOD(SetVertexShaderConstantF)(THIS_ UINT RegisterIndex, CONST FLOAT *pConstantData, UINT RegisterCount) PURE; + STDMETHOD(SetVertexShaderConstantI)(THIS_ UINT RegisterIndex, CONST INT *pConstantData, UINT RegisterCount) PURE; + STDMETHOD(SetVertexShaderConstantB)(THIS_ UINT RegisterIndex, CONST BOOL *pConstantData, UINT RegisterCount) PURE; + STDMETHOD(SetPixelShader)(THIS_ LPDIRECT3DPIXELSHADER9 pShader) PURE; + STDMETHOD(SetPixelShaderConstantF)(THIS_ UINT RegisterIndex, CONST FLOAT *pConstantData, UINT RegisterCount) PURE; + STDMETHOD(SetPixelShaderConstantI)(THIS_ UINT RegisterIndex, CONST INT *pConstantData, UINT RegisterCount) PURE; + STDMETHOD(SetPixelShaderConstantB)(THIS_ UINT RegisterIndex, CONST BOOL *pConstantData, UINT RegisterCount) PURE; +}; + + +////////////////////////////////////////////////////////////////////////////// +// ID3DXEffect /////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +typedef interface ID3DXEffect ID3DXEffect; +typedef interface ID3DXEffect *LPD3DXEFFECT; + +// {F6CEB4B3-4E4C-40dd-B883-8D8DE5EA0CD5} +DEFINE_GUID(IID_ID3DXEffect, +0xf6ceb4b3, 0x4e4c, 0x40dd, 0xb8, 0x83, 0x8d, 0x8d, 0xe5, 0xea, 0xc, 0xd5); + +#undef INTERFACE +#define INTERFACE ID3DXEffect + +DECLARE_INTERFACE_(ID3DXEffect, ID3DXBaseEffect) +{ + // ID3DXBaseEffect + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // Descs + STDMETHOD(GetDesc)(THIS_ D3DXEFFECT_DESC* pDesc) PURE; + STDMETHOD(GetParameterDesc)(THIS_ D3DXHANDLE hParameter, D3DXPARAMETER_DESC* pDesc) PURE; + STDMETHOD(GetTechniqueDesc)(THIS_ D3DXHANDLE hTechnique, D3DXTECHNIQUE_DESC* pDesc) PURE; + STDMETHOD(GetPassDesc)(THIS_ D3DXHANDLE hPass, D3DXPASS_DESC* pDesc) PURE; + STDMETHOD(GetFunctionDesc)(THIS_ D3DXHANDLE hShader, D3DXFUNCTION_DESC* pDesc) PURE; + + // Handle operations + STDMETHOD_(D3DXHANDLE, GetParameter)(THIS_ D3DXHANDLE hParameter, UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetParameterByName)(THIS_ D3DXHANDLE hParameter, LPCSTR pName) PURE; + STDMETHOD_(D3DXHANDLE, GetParameterBySemantic)(THIS_ D3DXHANDLE hParameter, LPCSTR pSemantic) PURE; + STDMETHOD_(D3DXHANDLE, GetParameterElement)(THIS_ D3DXHANDLE hParameter, UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetTechnique)(THIS_ UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetTechniqueByName)(THIS_ LPCSTR pName) PURE; + STDMETHOD_(D3DXHANDLE, GetPass)(THIS_ D3DXHANDLE hTechnique, UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetPassByName)(THIS_ D3DXHANDLE hTechnique, LPCSTR pName) PURE; + STDMETHOD_(D3DXHANDLE, GetFunction)(THIS_ UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetFunctionByName)(THIS_ LPCSTR pName) PURE; + STDMETHOD_(D3DXHANDLE, GetAnnotation)(THIS_ D3DXHANDLE hObject, UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetAnnotationByName)(THIS_ D3DXHANDLE hObject, LPCSTR pName) PURE; + + // Get/Set Parameters + STDMETHOD(SetValue)(THIS_ D3DXHANDLE hParameter, LPCVOID pData, UINT Bytes) PURE; + STDMETHOD(GetValue)(THIS_ D3DXHANDLE hParameter, LPVOID pData, UINT Bytes) PURE; + STDMETHOD(SetBool)(THIS_ D3DXHANDLE hParameter, BOOL b) PURE; + STDMETHOD(GetBool)(THIS_ D3DXHANDLE hParameter, BOOL* pb) PURE; + STDMETHOD(SetBoolArray)(THIS_ D3DXHANDLE hParameter, CONST BOOL* pb, UINT Count) PURE; + STDMETHOD(GetBoolArray)(THIS_ D3DXHANDLE hParameter, BOOL* pb, UINT Count) PURE; + STDMETHOD(SetInt)(THIS_ D3DXHANDLE hParameter, INT n) PURE; + STDMETHOD(GetInt)(THIS_ D3DXHANDLE hParameter, INT* pn) PURE; + STDMETHOD(SetIntArray)(THIS_ D3DXHANDLE hParameter, CONST INT* pn, UINT Count) PURE; + STDMETHOD(GetIntArray)(THIS_ D3DXHANDLE hParameter, INT* pn, UINT Count) PURE; + STDMETHOD(SetFloat)(THIS_ D3DXHANDLE hParameter, FLOAT f) PURE; + STDMETHOD(GetFloat)(THIS_ D3DXHANDLE hParameter, FLOAT* pf) PURE; + STDMETHOD(SetFloatArray)(THIS_ D3DXHANDLE hParameter, CONST FLOAT* pf, UINT Count) PURE; + STDMETHOD(GetFloatArray)(THIS_ D3DXHANDLE hParameter, FLOAT* pf, UINT Count) PURE; + STDMETHOD(SetVector)(THIS_ D3DXHANDLE hParameter, CONST D3DXVECTOR4* pVector) PURE; + STDMETHOD(GetVector)(THIS_ D3DXHANDLE hParameter, D3DXVECTOR4* pVector) PURE; + STDMETHOD(SetVectorArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXVECTOR4* pVector, UINT Count) PURE; + STDMETHOD(GetVectorArray)(THIS_ D3DXHANDLE hParameter, D3DXVECTOR4* pVector, UINT Count) PURE; + STDMETHOD(SetMatrix)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix) PURE; + STDMETHOD(GetMatrix)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix) PURE; + STDMETHOD(SetMatrixArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix, UINT Count) PURE; + STDMETHOD(GetMatrixArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix, UINT Count) PURE; + STDMETHOD(SetMatrixPointerArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX** ppMatrix, UINT Count) PURE; + STDMETHOD(GetMatrixPointerArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX** ppMatrix, UINT Count) PURE; + STDMETHOD(SetMatrixTranspose)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix) PURE; + STDMETHOD(GetMatrixTranspose)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix) PURE; + STDMETHOD(SetMatrixTransposeArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix, UINT Count) PURE; + STDMETHOD(GetMatrixTransposeArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix, UINT Count) PURE; + STDMETHOD(SetMatrixTransposePointerArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX** ppMatrix, UINT Count) PURE; + STDMETHOD(GetMatrixTransposePointerArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX** ppMatrix, UINT Count) PURE; + STDMETHOD(SetString)(THIS_ D3DXHANDLE hParameter, LPCSTR pString) PURE; + STDMETHOD(GetString)(THIS_ D3DXHANDLE hParameter, LPCSTR* ppString) PURE; + STDMETHOD(SetTexture)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DBASETEXTURE9 pTexture) PURE; + STDMETHOD(GetTexture)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DBASETEXTURE9 *ppTexture) PURE; + STDMETHOD(GetPixelShader)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DPIXELSHADER9 *ppPShader) PURE; + STDMETHOD(GetVertexShader)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DVERTEXSHADER9 *ppVShader) PURE; + + //Set Range of an Array to pass to device + //Usefull for sending only a subrange of an array down to the device + STDMETHOD(SetArrayRange)(THIS_ D3DXHANDLE hParameter, UINT uStart, UINT uEnd) PURE; + // ID3DXBaseEffect + + + // Pool + STDMETHOD(GetPool)(THIS_ LPD3DXEFFECTPOOL* ppPool) PURE; + + // Selecting and setting a technique + STDMETHOD(SetTechnique)(THIS_ D3DXHANDLE hTechnique) PURE; + STDMETHOD_(D3DXHANDLE, GetCurrentTechnique)(THIS) PURE; + STDMETHOD(ValidateTechnique)(THIS_ D3DXHANDLE hTechnique) PURE; + STDMETHOD(FindNextValidTechnique)(THIS_ D3DXHANDLE hTechnique, D3DXHANDLE *pTechnique) PURE; + STDMETHOD_(BOOL, IsParameterUsed)(THIS_ D3DXHANDLE hParameter, D3DXHANDLE hTechnique) PURE; + + // Using current technique + // Begin starts active technique + // BeginPass begins a pass + // CommitChanges updates changes to any set calls in the pass. This should be called before + // any DrawPrimitive call to d3d + // EndPass ends a pass + // End ends active technique + STDMETHOD(Begin)(THIS_ UINT *pPasses, DWORD Flags) PURE; + STDMETHOD(BeginPass)(THIS_ UINT Pass) PURE; + STDMETHOD(CommitChanges)(THIS) PURE; + STDMETHOD(EndPass)(THIS) PURE; + STDMETHOD(End)(THIS) PURE; + + // Managing D3D Device + STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE; + STDMETHOD(OnLostDevice)(THIS) PURE; + STDMETHOD(OnResetDevice)(THIS) PURE; + + // Logging device calls + STDMETHOD(SetStateManager)(THIS_ LPD3DXEFFECTSTATEMANAGER pManager) PURE; + STDMETHOD(GetStateManager)(THIS_ LPD3DXEFFECTSTATEMANAGER *ppManager) PURE; + + // Parameter blocks + STDMETHOD(BeginParameterBlock)(THIS) PURE; + STDMETHOD_(D3DXHANDLE, EndParameterBlock)(THIS) PURE; + STDMETHOD(ApplyParameterBlock)(THIS_ D3DXHANDLE hParameterBlock) PURE; + STDMETHOD(DeleteParameterBlock)(THIS_ D3DXHANDLE hParameterBlock) PURE; + + // Cloning + STDMETHOD(CloneEffect)(THIS_ LPDIRECT3DDEVICE9 pDevice, LPD3DXEFFECT* ppEffect) PURE; + + // Fast path for setting variables directly in ID3DXEffect + STDMETHOD(SetRawValue)(THIS_ D3DXHANDLE hParameter, LPCVOID pData, UINT ByteOffset, UINT Bytes) PURE; +}; + + +////////////////////////////////////////////////////////////////////////////// +// ID3DXEffectCompiler /////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +typedef interface ID3DXEffectCompiler ID3DXEffectCompiler; +typedef interface ID3DXEffectCompiler *LPD3DXEFFECTCOMPILER; + +// {51B8A949-1A31-47e6-BEA0-4B30DB53F1E0} +DEFINE_GUID(IID_ID3DXEffectCompiler, +0x51b8a949, 0x1a31, 0x47e6, 0xbe, 0xa0, 0x4b, 0x30, 0xdb, 0x53, 0xf1, 0xe0); + + +#undef INTERFACE +#define INTERFACE ID3DXEffectCompiler + +DECLARE_INTERFACE_(ID3DXEffectCompiler, ID3DXBaseEffect) +{ + // ID3DXBaseEffect + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // Descs + STDMETHOD(GetDesc)(THIS_ D3DXEFFECT_DESC* pDesc) PURE; + STDMETHOD(GetParameterDesc)(THIS_ D3DXHANDLE hParameter, D3DXPARAMETER_DESC* pDesc) PURE; + STDMETHOD(GetTechniqueDesc)(THIS_ D3DXHANDLE hTechnique, D3DXTECHNIQUE_DESC* pDesc) PURE; + STDMETHOD(GetPassDesc)(THIS_ D3DXHANDLE hPass, D3DXPASS_DESC* pDesc) PURE; + STDMETHOD(GetFunctionDesc)(THIS_ D3DXHANDLE hShader, D3DXFUNCTION_DESC* pDesc) PURE; + + // Handle operations + STDMETHOD_(D3DXHANDLE, GetParameter)(THIS_ D3DXHANDLE hParameter, UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetParameterByName)(THIS_ D3DXHANDLE hParameter, LPCSTR pName) PURE; + STDMETHOD_(D3DXHANDLE, GetParameterBySemantic)(THIS_ D3DXHANDLE hParameter, LPCSTR pSemantic) PURE; + STDMETHOD_(D3DXHANDLE, GetParameterElement)(THIS_ D3DXHANDLE hParameter, UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetTechnique)(THIS_ UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetTechniqueByName)(THIS_ LPCSTR pName) PURE; + STDMETHOD_(D3DXHANDLE, GetPass)(THIS_ D3DXHANDLE hTechnique, UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetPassByName)(THIS_ D3DXHANDLE hTechnique, LPCSTR pName) PURE; + STDMETHOD_(D3DXHANDLE, GetFunction)(THIS_ UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetFunctionByName)(THIS_ LPCSTR pName) PURE; + STDMETHOD_(D3DXHANDLE, GetAnnotation)(THIS_ D3DXHANDLE hObject, UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetAnnotationByName)(THIS_ D3DXHANDLE hObject, LPCSTR pName) PURE; + + // Get/Set Parameters + STDMETHOD(SetValue)(THIS_ D3DXHANDLE hParameter, LPCVOID pData, UINT Bytes) PURE; + STDMETHOD(GetValue)(THIS_ D3DXHANDLE hParameter, LPVOID pData, UINT Bytes) PURE; + STDMETHOD(SetBool)(THIS_ D3DXHANDLE hParameter, BOOL b) PURE; + STDMETHOD(GetBool)(THIS_ D3DXHANDLE hParameter, BOOL* pb) PURE; + STDMETHOD(SetBoolArray)(THIS_ D3DXHANDLE hParameter, CONST BOOL* pb, UINT Count) PURE; + STDMETHOD(GetBoolArray)(THIS_ D3DXHANDLE hParameter, BOOL* pb, UINT Count) PURE; + STDMETHOD(SetInt)(THIS_ D3DXHANDLE hParameter, INT n) PURE; + STDMETHOD(GetInt)(THIS_ D3DXHANDLE hParameter, INT* pn) PURE; + STDMETHOD(SetIntArray)(THIS_ D3DXHANDLE hParameter, CONST INT* pn, UINT Count) PURE; + STDMETHOD(GetIntArray)(THIS_ D3DXHANDLE hParameter, INT* pn, UINT Count) PURE; + STDMETHOD(SetFloat)(THIS_ D3DXHANDLE hParameter, FLOAT f) PURE; + STDMETHOD(GetFloat)(THIS_ D3DXHANDLE hParameter, FLOAT* pf) PURE; + STDMETHOD(SetFloatArray)(THIS_ D3DXHANDLE hParameter, CONST FLOAT* pf, UINT Count) PURE; + STDMETHOD(GetFloatArray)(THIS_ D3DXHANDLE hParameter, FLOAT* pf, UINT Count) PURE; + STDMETHOD(SetVector)(THIS_ D3DXHANDLE hParameter, CONST D3DXVECTOR4* pVector) PURE; + STDMETHOD(GetVector)(THIS_ D3DXHANDLE hParameter, D3DXVECTOR4* pVector) PURE; + STDMETHOD(SetVectorArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXVECTOR4* pVector, UINT Count) PURE; + STDMETHOD(GetVectorArray)(THIS_ D3DXHANDLE hParameter, D3DXVECTOR4* pVector, UINT Count) PURE; + STDMETHOD(SetMatrix)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix) PURE; + STDMETHOD(GetMatrix)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix) PURE; + STDMETHOD(SetMatrixArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix, UINT Count) PURE; + STDMETHOD(GetMatrixArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix, UINT Count) PURE; + STDMETHOD(SetMatrixPointerArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX** ppMatrix, UINT Count) PURE; + STDMETHOD(GetMatrixPointerArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX** ppMatrix, UINT Count) PURE; + STDMETHOD(SetMatrixTranspose)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix) PURE; + STDMETHOD(GetMatrixTranspose)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix) PURE; + STDMETHOD(SetMatrixTransposeArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix, UINT Count) PURE; + STDMETHOD(GetMatrixTransposeArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix, UINT Count) PURE; + STDMETHOD(SetMatrixTransposePointerArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX** ppMatrix, UINT Count) PURE; + STDMETHOD(GetMatrixTransposePointerArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX** ppMatrix, UINT Count) PURE; + STDMETHOD(SetString)(THIS_ D3DXHANDLE hParameter, LPCSTR pString) PURE; + STDMETHOD(GetString)(THIS_ D3DXHANDLE hParameter, LPCSTR* ppString) PURE; + STDMETHOD(SetTexture)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DBASETEXTURE9 pTexture) PURE; + STDMETHOD(GetTexture)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DBASETEXTURE9 *ppTexture) PURE; + STDMETHOD(GetPixelShader)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DPIXELSHADER9 *ppPShader) PURE; + STDMETHOD(GetVertexShader)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DVERTEXSHADER9 *ppVShader) PURE; + + //Set Range of an Array to pass to device + //Usefull for sending only a subrange of an array down to the device + STDMETHOD(SetArrayRange)(THIS_ D3DXHANDLE hParameter, UINT uStart, UINT uEnd) PURE; + // ID3DXBaseEffect + + // Parameter sharing, specialization, and information + STDMETHOD(SetLiteral)(THIS_ D3DXHANDLE hParameter, BOOL Literal) PURE; + STDMETHOD(GetLiteral)(THIS_ D3DXHANDLE hParameter, BOOL *pLiteral) PURE; + + // Compilation + STDMETHOD(CompileEffect)(THIS_ DWORD Flags, + LPD3DXBUFFER* ppEffect, LPD3DXBUFFER* ppErrorMsgs) PURE; + + STDMETHOD(CompileShader)(THIS_ D3DXHANDLE hFunction, LPCSTR pTarget, DWORD Flags, + LPD3DXBUFFER* ppShader, LPD3DXBUFFER* ppErrorMsgs, LPD3DXCONSTANTTABLE* ppConstantTable) PURE; +}; + + +////////////////////////////////////////////////////////////////////////////// +// APIs ////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + +//---------------------------------------------------------------------------- +// D3DXCreateEffectPool: +// --------------------- +// Creates an effect pool. Pools are used for sharing parameters between +// multiple effects. For all effects within a pool, shared parameters of the +// same name all share the same value. +// +// Parameters: +// ppPool +// Returns the created pool. +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXCreateEffectPool( + LPD3DXEFFECTPOOL* ppPool); + + +//---------------------------------------------------------------------------- +// D3DXCreateEffect: +// ----------------- +// Creates an effect from an ascii or binary effect description. +// +// Parameters: +// pDevice +// Pointer of the device on which to create the effect +// pSrcFile +// Name of the file containing the effect description +// hSrcModule +// Module handle. if NULL, current module will be used. +// pSrcResource +// Resource name in module +// pSrcData +// Pointer to effect description +// SrcDataSize +// Size of the effect description in bytes +// pDefines +// Optional NULL-terminated array of preprocessor macro definitions. +// Flags +// See D3DXSHADER_xxx flags. +// pSkipConstants +// A list of semi-colon delimited variable names. The effect will +// not set these variables to the device when they are referenced +// by a shader. NOTE: the variables specified here must be +// register bound in the file and must not be used in expressions +// in passes or samplers or the file will not load. +// pInclude +// Optional interface pointer to use for handling #include directives. +// If this parameter is NULL, #includes will be honored when compiling +// from file, and will error when compiling from resource or memory. +// pPool +// Pointer to ID3DXEffectPool object to use for shared parameters. +// If NULL, no parameters will be shared. +// ppEffect +// Returns a buffer containing created effect. +// ppCompilationErrors +// Returns a buffer containing any error messages which occurred during +// compile. Or NULL if you do not care about the error messages. +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXCreateEffectFromFileA( + LPDIRECT3DDEVICE9 pDevice, + LPCSTR pSrcFile, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + DWORD Flags, + LPD3DXEFFECTPOOL pPool, + LPD3DXEFFECT* ppEffect, + LPD3DXBUFFER* ppCompilationErrors); + +HRESULT WINAPI + D3DXCreateEffectFromFileW( + LPDIRECT3DDEVICE9 pDevice, + LPCWSTR pSrcFile, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + DWORD Flags, + LPD3DXEFFECTPOOL pPool, + LPD3DXEFFECT* ppEffect, + LPD3DXBUFFER* ppCompilationErrors); + +#ifdef UNICODE +#define D3DXCreateEffectFromFile D3DXCreateEffectFromFileW +#else +#define D3DXCreateEffectFromFile D3DXCreateEffectFromFileA +#endif + + +HRESULT WINAPI + D3DXCreateEffectFromResourceA( + LPDIRECT3DDEVICE9 pDevice, + HMODULE hSrcModule, + LPCSTR pSrcResource, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + DWORD Flags, + LPD3DXEFFECTPOOL pPool, + LPD3DXEFFECT* ppEffect, + LPD3DXBUFFER* ppCompilationErrors); + +HRESULT WINAPI + D3DXCreateEffectFromResourceW( + LPDIRECT3DDEVICE9 pDevice, + HMODULE hSrcModule, + LPCWSTR pSrcResource, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + DWORD Flags, + LPD3DXEFFECTPOOL pPool, + LPD3DXEFFECT* ppEffect, + LPD3DXBUFFER* ppCompilationErrors); + +#ifdef UNICODE +#define D3DXCreateEffectFromResource D3DXCreateEffectFromResourceW +#else +#define D3DXCreateEffectFromResource D3DXCreateEffectFromResourceA +#endif + + +HRESULT WINAPI + D3DXCreateEffect( + LPDIRECT3DDEVICE9 pDevice, + LPCVOID pSrcData, + UINT SrcDataLen, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + DWORD Flags, + LPD3DXEFFECTPOOL pPool, + LPD3DXEFFECT* ppEffect, + LPD3DXBUFFER* ppCompilationErrors); + +// +// Ex functions that accept pSkipConstants in addition to other parameters +// + +HRESULT WINAPI + D3DXCreateEffectFromFileExA( + LPDIRECT3DDEVICE9 pDevice, + LPCSTR pSrcFile, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + LPCSTR pSkipConstants, + DWORD Flags, + LPD3DXEFFECTPOOL pPool, + LPD3DXEFFECT* ppEffect, + LPD3DXBUFFER* ppCompilationErrors); + +HRESULT WINAPI + D3DXCreateEffectFromFileExW( + LPDIRECT3DDEVICE9 pDevice, + LPCWSTR pSrcFile, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + LPCSTR pSkipConstants, + DWORD Flags, + LPD3DXEFFECTPOOL pPool, + LPD3DXEFFECT* ppEffect, + LPD3DXBUFFER* ppCompilationErrors); + +#ifdef UNICODE +#define D3DXCreateEffectFromFileEx D3DXCreateEffectFromFileExW +#else +#define D3DXCreateEffectFromFileEx D3DXCreateEffectFromFileExA +#endif + + +HRESULT WINAPI + D3DXCreateEffectFromResourceExA( + LPDIRECT3DDEVICE9 pDevice, + HMODULE hSrcModule, + LPCSTR pSrcResource, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + LPCSTR pSkipConstants, + DWORD Flags, + LPD3DXEFFECTPOOL pPool, + LPD3DXEFFECT* ppEffect, + LPD3DXBUFFER* ppCompilationErrors); + +HRESULT WINAPI + D3DXCreateEffectFromResourceExW( + LPDIRECT3DDEVICE9 pDevice, + HMODULE hSrcModule, + LPCWSTR pSrcResource, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + LPCSTR pSkipConstants, + DWORD Flags, + LPD3DXEFFECTPOOL pPool, + LPD3DXEFFECT* ppEffect, + LPD3DXBUFFER* ppCompilationErrors); + +#ifdef UNICODE +#define D3DXCreateEffectFromResourceEx D3DXCreateEffectFromResourceExW +#else +#define D3DXCreateEffectFromResourceEx D3DXCreateEffectFromResourceExA +#endif + + +HRESULT WINAPI + D3DXCreateEffectEx( + LPDIRECT3DDEVICE9 pDevice, + LPCVOID pSrcData, + UINT SrcDataLen, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + LPCSTR pSkipConstants, + DWORD Flags, + LPD3DXEFFECTPOOL pPool, + LPD3DXEFFECT* ppEffect, + LPD3DXBUFFER* ppCompilationErrors); + +//---------------------------------------------------------------------------- +// D3DXCreateEffectCompiler: +// ------------------------- +// Creates an effect from an ascii or binary effect description. +// +// Parameters: +// pSrcFile +// Name of the file containing the effect description +// hSrcModule +// Module handle. if NULL, current module will be used. +// pSrcResource +// Resource name in module +// pSrcData +// Pointer to effect description +// SrcDataSize +// Size of the effect description in bytes +// pDefines +// Optional NULL-terminated array of preprocessor macro definitions. +// pInclude +// Optional interface pointer to use for handling #include directives. +// If this parameter is NULL, #includes will be honored when compiling +// from file, and will error when compiling from resource or memory. +// pPool +// Pointer to ID3DXEffectPool object to use for shared parameters. +// If NULL, no parameters will be shared. +// ppCompiler +// Returns a buffer containing created effect compiler. +// ppParseErrors +// Returns a buffer containing any error messages which occurred during +// parse. Or NULL if you do not care about the error messages. +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXCreateEffectCompilerFromFileA( + LPCSTR pSrcFile, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + DWORD Flags, + LPD3DXEFFECTCOMPILER* ppCompiler, + LPD3DXBUFFER* ppParseErrors); + +HRESULT WINAPI + D3DXCreateEffectCompilerFromFileW( + LPCWSTR pSrcFile, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + DWORD Flags, + LPD3DXEFFECTCOMPILER* ppCompiler, + LPD3DXBUFFER* ppParseErrors); + +#ifdef UNICODE +#define D3DXCreateEffectCompilerFromFile D3DXCreateEffectCompilerFromFileW +#else +#define D3DXCreateEffectCompilerFromFile D3DXCreateEffectCompilerFromFileA +#endif + + +HRESULT WINAPI + D3DXCreateEffectCompilerFromResourceA( + HMODULE hSrcModule, + LPCSTR pSrcResource, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + DWORD Flags, + LPD3DXEFFECTCOMPILER* ppCompiler, + LPD3DXBUFFER* ppParseErrors); + +HRESULT WINAPI + D3DXCreateEffectCompilerFromResourceW( + HMODULE hSrcModule, + LPCWSTR pSrcResource, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + DWORD Flags, + LPD3DXEFFECTCOMPILER* ppCompiler, + LPD3DXBUFFER* ppParseErrors); + +#ifdef UNICODE +#define D3DXCreateEffectCompilerFromResource D3DXCreateEffectCompilerFromResourceW +#else +#define D3DXCreateEffectCompilerFromResource D3DXCreateEffectCompilerFromResourceA +#endif + + +HRESULT WINAPI + D3DXCreateEffectCompiler( + LPCSTR pSrcData, + UINT SrcDataLen, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + DWORD Flags, + LPD3DXEFFECTCOMPILER* ppCompiler, + LPD3DXBUFFER* ppParseErrors); + +//---------------------------------------------------------------------------- +// D3DXDisassembleEffect: +// ----------------------- +// +// Parameters: +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXDisassembleEffect( + LPD3DXEFFECT pEffect, + BOOL EnableColorCode, + LPD3DXBUFFER *ppDisassembly); + + + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif //__D3DX9EFFECT_H__ + + diff --git a/MediaClient/MediaClient/directx/include/d3dx9math.h b/MediaClient/MediaClient/directx/include/d3dx9math.h new file mode 100644 index 0000000..3fda053 --- /dev/null +++ b/MediaClient/MediaClient/directx/include/d3dx9math.h @@ -0,0 +1,1796 @@ +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx9math.h +// Content: D3DX math types and functions +// +////////////////////////////////////////////////////////////////////////////// + +#include "d3dx9.h" + +#ifndef __D3DX9MATH_H__ +#define __D3DX9MATH_H__ + +#include +#if _MSC_VER >= 1200 +#pragma warning(push) +#endif +#pragma warning(disable:4201) // anonymous unions warning + + + +//=========================================================================== +// +// General purpose utilities +// +//=========================================================================== +#define D3DX_PI ((FLOAT) 3.141592654f) +#define D3DX_1BYPI ((FLOAT) 0.318309886f) + +#define D3DXToRadian( degree ) ((degree) * (D3DX_PI / 180.0f)) +#define D3DXToDegree( radian ) ((radian) * (180.0f / D3DX_PI)) + + + +//=========================================================================== +// +// 16 bit floating point numbers +// +//=========================================================================== + +#define D3DX_16F_DIG 3 // # of decimal digits of precision +#define D3DX_16F_EPSILON 4.8875809e-4f // smallest such that 1.0 + epsilon != 1.0 +#define D3DX_16F_MANT_DIG 11 // # of bits in mantissa +#define D3DX_16F_MAX 6.550400e+004 // max value +#define D3DX_16F_MAX_10_EXP 4 // max decimal exponent +#define D3DX_16F_MAX_EXP 15 // max binary exponent +#define D3DX_16F_MIN 6.1035156e-5f // min positive value +#define D3DX_16F_MIN_10_EXP (-4) // min decimal exponent +#define D3DX_16F_MIN_EXP (-14) // min binary exponent +#define D3DX_16F_RADIX 2 // exponent radix +#define D3DX_16F_ROUNDS 1 // addition rounding: near + + +typedef struct D3DXFLOAT16 +{ +#ifdef __cplusplus +public: + D3DXFLOAT16() {}; + D3DXFLOAT16( FLOAT ); + D3DXFLOAT16( CONST D3DXFLOAT16& ); + + // casting + operator FLOAT (); + + // binary operators + BOOL operator == ( CONST D3DXFLOAT16& ) const; + BOOL operator != ( CONST D3DXFLOAT16& ) const; + +protected: +#endif //__cplusplus + WORD value; +} D3DXFLOAT16, *LPD3DXFLOAT16; + + + +//=========================================================================== +// +// Vectors +// +//=========================================================================== + + +//-------------------------- +// 2D Vector +//-------------------------- +typedef struct D3DXVECTOR2 +{ +#ifdef __cplusplus +public: + D3DXVECTOR2() {}; + D3DXVECTOR2( CONST FLOAT * ); + D3DXVECTOR2( CONST D3DXFLOAT16 * ); + D3DXVECTOR2( FLOAT x, FLOAT y ); + + // casting + operator FLOAT* (); + operator CONST FLOAT* () const; + + // assignment operators + D3DXVECTOR2& operator += ( CONST D3DXVECTOR2& ); + D3DXVECTOR2& operator -= ( CONST D3DXVECTOR2& ); + D3DXVECTOR2& operator *= ( FLOAT ); + D3DXVECTOR2& operator /= ( FLOAT ); + + // unary operators + D3DXVECTOR2 operator + () const; + D3DXVECTOR2 operator - () const; + + // binary operators + D3DXVECTOR2 operator + ( CONST D3DXVECTOR2& ) const; + D3DXVECTOR2 operator - ( CONST D3DXVECTOR2& ) const; + D3DXVECTOR2 operator * ( FLOAT ) const; + D3DXVECTOR2 operator / ( FLOAT ) const; + + friend D3DXVECTOR2 operator * ( FLOAT, CONST D3DXVECTOR2& ); + + BOOL operator == ( CONST D3DXVECTOR2& ) const; + BOOL operator != ( CONST D3DXVECTOR2& ) const; + + +public: +#endif //__cplusplus + FLOAT x, y; +} D3DXVECTOR2, *LPD3DXVECTOR2; + + + +//-------------------------- +// 2D Vector (16 bit) +//-------------------------- + +typedef struct D3DXVECTOR2_16F +{ +#ifdef __cplusplus +public: + D3DXVECTOR2_16F() {}; + D3DXVECTOR2_16F( CONST FLOAT * ); + D3DXVECTOR2_16F( CONST D3DXFLOAT16 * ); + D3DXVECTOR2_16F( CONST D3DXFLOAT16 &x, CONST D3DXFLOAT16 &y ); + + // casting + operator D3DXFLOAT16* (); + operator CONST D3DXFLOAT16* () const; + + // binary operators + BOOL operator == ( CONST D3DXVECTOR2_16F& ) const; + BOOL operator != ( CONST D3DXVECTOR2_16F& ) const; + +public: +#endif //__cplusplus + D3DXFLOAT16 x, y; + +} D3DXVECTOR2_16F, *LPD3DXVECTOR2_16F; + + + +//-------------------------- +// 3D Vector +//-------------------------- +#ifdef __cplusplus +typedef struct D3DXVECTOR3 : public D3DVECTOR +{ +public: + D3DXVECTOR3() {}; + D3DXVECTOR3( CONST FLOAT * ); + D3DXVECTOR3( CONST D3DVECTOR& ); + D3DXVECTOR3( CONST D3DXFLOAT16 * ); + D3DXVECTOR3( FLOAT x, FLOAT y, FLOAT z ); + + // casting + operator FLOAT* (); + operator CONST FLOAT* () const; + + // assignment operators + D3DXVECTOR3& operator += ( CONST D3DXVECTOR3& ); + D3DXVECTOR3& operator -= ( CONST D3DXVECTOR3& ); + D3DXVECTOR3& operator *= ( FLOAT ); + D3DXVECTOR3& operator /= ( FLOAT ); + + // unary operators + D3DXVECTOR3 operator + () const; + D3DXVECTOR3 operator - () const; + + // binary operators + D3DXVECTOR3 operator + ( CONST D3DXVECTOR3& ) const; + D3DXVECTOR3 operator - ( CONST D3DXVECTOR3& ) const; + D3DXVECTOR3 operator * ( FLOAT ) const; + D3DXVECTOR3 operator / ( FLOAT ) const; + + friend D3DXVECTOR3 operator * ( FLOAT, CONST struct D3DXVECTOR3& ); + + BOOL operator == ( CONST D3DXVECTOR3& ) const; + BOOL operator != ( CONST D3DXVECTOR3& ) const; + +} D3DXVECTOR3, *LPD3DXVECTOR3; + +#else //!__cplusplus +typedef struct _D3DVECTOR D3DXVECTOR3, *LPD3DXVECTOR3; +#endif //!__cplusplus + + + +//-------------------------- +// 3D Vector (16 bit) +//-------------------------- +typedef struct D3DXVECTOR3_16F +{ +#ifdef __cplusplus +public: + D3DXVECTOR3_16F() {}; + D3DXVECTOR3_16F( CONST FLOAT * ); + D3DXVECTOR3_16F( CONST D3DVECTOR& ); + D3DXVECTOR3_16F( CONST D3DXFLOAT16 * ); + D3DXVECTOR3_16F( CONST D3DXFLOAT16 &x, CONST D3DXFLOAT16 &y, CONST D3DXFLOAT16 &z ); + + // casting + operator D3DXFLOAT16* (); + operator CONST D3DXFLOAT16* () const; + + // binary operators + BOOL operator == ( CONST D3DXVECTOR3_16F& ) const; + BOOL operator != ( CONST D3DXVECTOR3_16F& ) const; + +public: +#endif //__cplusplus + D3DXFLOAT16 x, y, z; + +} D3DXVECTOR3_16F, *LPD3DXVECTOR3_16F; + + + +//-------------------------- +// 4D Vector +//-------------------------- +typedef struct D3DXVECTOR4 +{ +#ifdef __cplusplus +public: + D3DXVECTOR4() {}; + D3DXVECTOR4( CONST FLOAT* ); + D3DXVECTOR4( CONST D3DXFLOAT16* ); + D3DXVECTOR4( CONST D3DVECTOR& xyz, FLOAT w ); + D3DXVECTOR4( FLOAT x, FLOAT y, FLOAT z, FLOAT w ); + + // casting + operator FLOAT* (); + operator CONST FLOAT* () const; + + // assignment operators + D3DXVECTOR4& operator += ( CONST D3DXVECTOR4& ); + D3DXVECTOR4& operator -= ( CONST D3DXVECTOR4& ); + D3DXVECTOR4& operator *= ( FLOAT ); + D3DXVECTOR4& operator /= ( FLOAT ); + + // unary operators + D3DXVECTOR4 operator + () const; + D3DXVECTOR4 operator - () const; + + // binary operators + D3DXVECTOR4 operator + ( CONST D3DXVECTOR4& ) const; + D3DXVECTOR4 operator - ( CONST D3DXVECTOR4& ) const; + D3DXVECTOR4 operator * ( FLOAT ) const; + D3DXVECTOR4 operator / ( FLOAT ) const; + + friend D3DXVECTOR4 operator * ( FLOAT, CONST D3DXVECTOR4& ); + + BOOL operator == ( CONST D3DXVECTOR4& ) const; + BOOL operator != ( CONST D3DXVECTOR4& ) const; + +public: +#endif //__cplusplus + FLOAT x, y, z, w; +} D3DXVECTOR4, *LPD3DXVECTOR4; + + +//-------------------------- +// 4D Vector (16 bit) +//-------------------------- +typedef struct D3DXVECTOR4_16F +{ +#ifdef __cplusplus +public: + D3DXVECTOR4_16F() {}; + D3DXVECTOR4_16F( CONST FLOAT * ); + D3DXVECTOR4_16F( CONST D3DXFLOAT16* ); + D3DXVECTOR4_16F( CONST D3DXVECTOR3_16F& xyz, CONST D3DXFLOAT16& w ); + D3DXVECTOR4_16F( CONST D3DXFLOAT16& x, CONST D3DXFLOAT16& y, CONST D3DXFLOAT16& z, CONST D3DXFLOAT16& w ); + + // casting + operator D3DXFLOAT16* (); + operator CONST D3DXFLOAT16* () const; + + // binary operators + BOOL operator == ( CONST D3DXVECTOR4_16F& ) const; + BOOL operator != ( CONST D3DXVECTOR4_16F& ) const; + +public: +#endif //__cplusplus + D3DXFLOAT16 x, y, z, w; + +} D3DXVECTOR4_16F, *LPD3DXVECTOR4_16F; + + + +//=========================================================================== +// +// Matrices +// +//=========================================================================== +#ifdef __cplusplus +typedef struct D3DXMATRIX : public D3DMATRIX +{ +public: + D3DXMATRIX() {}; + D3DXMATRIX( CONST FLOAT * ); + D3DXMATRIX( CONST D3DMATRIX& ); + D3DXMATRIX( CONST D3DXFLOAT16 * ); + D3DXMATRIX( FLOAT _11, FLOAT _12, FLOAT _13, FLOAT _14, + FLOAT _21, FLOAT _22, FLOAT _23, FLOAT _24, + FLOAT _31, FLOAT _32, FLOAT _33, FLOAT _34, + FLOAT _41, FLOAT _42, FLOAT _43, FLOAT _44 ); + + + // access grants + FLOAT& operator () ( UINT Row, UINT Col ); + FLOAT operator () ( UINT Row, UINT Col ) const; + + // casting operators + operator FLOAT* (); + operator CONST FLOAT* () const; + + // assignment operators + D3DXMATRIX& operator *= ( CONST D3DXMATRIX& ); + D3DXMATRIX& operator += ( CONST D3DXMATRIX& ); + D3DXMATRIX& operator -= ( CONST D3DXMATRIX& ); + D3DXMATRIX& operator *= ( FLOAT ); + D3DXMATRIX& operator /= ( FLOAT ); + + // unary operators + D3DXMATRIX operator + () const; + D3DXMATRIX operator - () const; + + // binary operators + D3DXMATRIX operator * ( CONST D3DXMATRIX& ) const; + D3DXMATRIX operator + ( CONST D3DXMATRIX& ) const; + D3DXMATRIX operator - ( CONST D3DXMATRIX& ) const; + D3DXMATRIX operator * ( FLOAT ) const; + D3DXMATRIX operator / ( FLOAT ) const; + + friend D3DXMATRIX operator * ( FLOAT, CONST D3DXMATRIX& ); + + BOOL operator == ( CONST D3DXMATRIX& ) const; + BOOL operator != ( CONST D3DXMATRIX& ) const; + +} D3DXMATRIX, *LPD3DXMATRIX; + +#else //!__cplusplus +typedef struct _D3DMATRIX D3DXMATRIX, *LPD3DXMATRIX; +#endif //!__cplusplus + + +//--------------------------------------------------------------------------- +// Aligned Matrices +// +// This class helps keep matrices 16-byte aligned as preferred by P4 cpus. +// It aligns matrices on the stack and on the heap or in global scope. +// It does this using __declspec(align(16)) which works on VC7 and on VC 6 +// with the processor pack. Unfortunately there is no way to detect the +// latter so this is turned on only on VC7. On other compilers this is the +// the same as D3DXMATRIX. +// +// Using this class on a compiler that does not actually do the alignment +// can be dangerous since it will not expose bugs that ignore alignment. +// E.g if an object of this class in inside a struct or class, and some code +// memcopys data in it assuming tight packing. This could break on a compiler +// that eventually start aligning the matrix. +//--------------------------------------------------------------------------- +#ifdef __cplusplus +typedef struct _D3DXMATRIXA16 : public D3DXMATRIX +{ + _D3DXMATRIXA16() {} + _D3DXMATRIXA16( CONST FLOAT * ); + _D3DXMATRIXA16( CONST D3DMATRIX& ); + _D3DXMATRIXA16( CONST D3DXFLOAT16 * ); + _D3DXMATRIXA16( FLOAT _11, FLOAT _12, FLOAT _13, FLOAT _14, + FLOAT _21, FLOAT _22, FLOAT _23, FLOAT _24, + FLOAT _31, FLOAT _32, FLOAT _33, FLOAT _34, + FLOAT _41, FLOAT _42, FLOAT _43, FLOAT _44 ); + + // new operators + void* operator new ( size_t ); + void* operator new[] ( size_t ); + + // delete operators + void operator delete ( void* ); // These are NOT virtual; Do not + void operator delete[] ( void* ); // cast to D3DXMATRIX and delete. + + // assignment operators + _D3DXMATRIXA16& operator = ( CONST D3DXMATRIX& ); + +} _D3DXMATRIXA16; + +#else //!__cplusplus +typedef D3DXMATRIX _D3DXMATRIXA16; +#endif //!__cplusplus + + + +#if _MSC_VER >= 1300 // VC7 +#define D3DX_ALIGN16 __declspec(align(16)) +#else +#define D3DX_ALIGN16 // Earlier compiler may not understand this, do nothing. +#endif + +typedef D3DX_ALIGN16 _D3DXMATRIXA16 D3DXMATRIXA16, *LPD3DXMATRIXA16; + + + +//=========================================================================== +// +// Quaternions +// +//=========================================================================== +typedef struct D3DXQUATERNION +{ +#ifdef __cplusplus +public: + D3DXQUATERNION() {} + D3DXQUATERNION( CONST FLOAT * ); + D3DXQUATERNION( CONST D3DXFLOAT16 * ); + D3DXQUATERNION( FLOAT x, FLOAT y, FLOAT z, FLOAT w ); + + // casting + operator FLOAT* (); + operator CONST FLOAT* () const; + + // assignment operators + D3DXQUATERNION& operator += ( CONST D3DXQUATERNION& ); + D3DXQUATERNION& operator -= ( CONST D3DXQUATERNION& ); + D3DXQUATERNION& operator *= ( CONST D3DXQUATERNION& ); + D3DXQUATERNION& operator *= ( FLOAT ); + D3DXQUATERNION& operator /= ( FLOAT ); + + // unary operators + D3DXQUATERNION operator + () const; + D3DXQUATERNION operator - () const; + + // binary operators + D3DXQUATERNION operator + ( CONST D3DXQUATERNION& ) const; + D3DXQUATERNION operator - ( CONST D3DXQUATERNION& ) const; + D3DXQUATERNION operator * ( CONST D3DXQUATERNION& ) const; + D3DXQUATERNION operator * ( FLOAT ) const; + D3DXQUATERNION operator / ( FLOAT ) const; + + friend D3DXQUATERNION operator * (FLOAT, CONST D3DXQUATERNION& ); + + BOOL operator == ( CONST D3DXQUATERNION& ) const; + BOOL operator != ( CONST D3DXQUATERNION& ) const; + +#endif //__cplusplus + FLOAT x, y, z, w; +} D3DXQUATERNION, *LPD3DXQUATERNION; + + +//=========================================================================== +// +// Planes +// +//=========================================================================== +typedef struct D3DXPLANE +{ +#ifdef __cplusplus +public: + D3DXPLANE() {} + D3DXPLANE( CONST FLOAT* ); + D3DXPLANE( CONST D3DXFLOAT16* ); + D3DXPLANE( FLOAT a, FLOAT b, FLOAT c, FLOAT d ); + + // casting + operator FLOAT* (); + operator CONST FLOAT* () const; + + // assignment operators + D3DXPLANE& operator *= ( FLOAT ); + D3DXPLANE& operator /= ( FLOAT ); + + // unary operators + D3DXPLANE operator + () const; + D3DXPLANE operator - () const; + + // binary operators + D3DXPLANE operator * ( FLOAT ) const; + D3DXPLANE operator / ( FLOAT ) const; + + friend D3DXPLANE operator * ( FLOAT, CONST D3DXPLANE& ); + + BOOL operator == ( CONST D3DXPLANE& ) const; + BOOL operator != ( CONST D3DXPLANE& ) const; + +#endif //__cplusplus + FLOAT a, b, c, d; +} D3DXPLANE, *LPD3DXPLANE; + + +//=========================================================================== +// +// Colors +// +//=========================================================================== + +typedef struct D3DXCOLOR +{ +#ifdef __cplusplus +public: + D3DXCOLOR() {} + D3DXCOLOR( DWORD argb ); + D3DXCOLOR( CONST FLOAT * ); + D3DXCOLOR( CONST D3DXFLOAT16 * ); + D3DXCOLOR( CONST D3DCOLORVALUE& ); + D3DXCOLOR( FLOAT r, FLOAT g, FLOAT b, FLOAT a ); + + // casting + operator DWORD () const; + + operator FLOAT* (); + operator CONST FLOAT* () const; + + operator D3DCOLORVALUE* (); + operator CONST D3DCOLORVALUE* () const; + + operator D3DCOLORVALUE& (); + operator CONST D3DCOLORVALUE& () const; + + // assignment operators + D3DXCOLOR& operator += ( CONST D3DXCOLOR& ); + D3DXCOLOR& operator -= ( CONST D3DXCOLOR& ); + D3DXCOLOR& operator *= ( FLOAT ); + D3DXCOLOR& operator /= ( FLOAT ); + + // unary operators + D3DXCOLOR operator + () const; + D3DXCOLOR operator - () const; + + // binary operators + D3DXCOLOR operator + ( CONST D3DXCOLOR& ) const; + D3DXCOLOR operator - ( CONST D3DXCOLOR& ) const; + D3DXCOLOR operator * ( FLOAT ) const; + D3DXCOLOR operator / ( FLOAT ) const; + + friend D3DXCOLOR operator * ( FLOAT, CONST D3DXCOLOR& ); + + BOOL operator == ( CONST D3DXCOLOR& ) const; + BOOL operator != ( CONST D3DXCOLOR& ) const; + +#endif //__cplusplus + FLOAT r, g, b, a; +} D3DXCOLOR, *LPD3DXCOLOR; + + + +//=========================================================================== +// +// D3DX math functions: +// +// NOTE: +// * All these functions can take the same object as in and out parameters. +// +// * Out parameters are typically also returned as return values, so that +// the output of one function may be used as a parameter to another. +// +//=========================================================================== + +//-------------------------- +// Float16 +//-------------------------- + +// non-inline +#ifdef __cplusplus +extern "C" { +#endif + +// Converts an array 32-bit floats to 16-bit floats +D3DXFLOAT16* WINAPI D3DXFloat32To16Array + ( D3DXFLOAT16 *pOut, CONST FLOAT *pIn, UINT n ); + +// Converts an array 16-bit floats to 32-bit floats +FLOAT* WINAPI D3DXFloat16To32Array + ( FLOAT *pOut, CONST D3DXFLOAT16 *pIn, UINT n ); + +#ifdef __cplusplus +} +#endif + + +//-------------------------- +// 2D Vector +//-------------------------- + +// inline + +FLOAT D3DXVec2Length + ( CONST D3DXVECTOR2 *pV ); + +FLOAT D3DXVec2LengthSq + ( CONST D3DXVECTOR2 *pV ); + +FLOAT D3DXVec2Dot + ( CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ); + +// Z component of ((x1,y1,0) cross (x2,y2,0)) +FLOAT D3DXVec2CCW + ( CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ); + +D3DXVECTOR2* D3DXVec2Add + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ); + +D3DXVECTOR2* D3DXVec2Subtract + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ); + +// Minimize each component. x = min(x1, x2), y = min(y1, y2) +D3DXVECTOR2* D3DXVec2Minimize + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ); + +// Maximize each component. x = max(x1, x2), y = max(y1, y2) +D3DXVECTOR2* D3DXVec2Maximize + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ); + +D3DXVECTOR2* D3DXVec2Scale + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV, FLOAT s ); + +// Linear interpolation. V1 + s(V2-V1) +D3DXVECTOR2* D3DXVec2Lerp + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2, + FLOAT s ); + +// non-inline +#ifdef __cplusplus +extern "C" { +#endif + +D3DXVECTOR2* WINAPI D3DXVec2Normalize + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV ); + +// Hermite interpolation between position V1, tangent T1 (when s == 0) +// and position V2, tangent T2 (when s == 1). +D3DXVECTOR2* WINAPI D3DXVec2Hermite + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pT1, + CONST D3DXVECTOR2 *pV2, CONST D3DXVECTOR2 *pT2, FLOAT s ); + +// CatmullRom interpolation between V1 (when s == 0) and V2 (when s == 1) +D3DXVECTOR2* WINAPI D3DXVec2CatmullRom + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV0, CONST D3DXVECTOR2 *pV1, + CONST D3DXVECTOR2 *pV2, CONST D3DXVECTOR2 *pV3, FLOAT s ); + +// Barycentric coordinates. V1 + f(V2-V1) + g(V3-V1) +D3DXVECTOR2* WINAPI D3DXVec2BaryCentric + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2, + CONST D3DXVECTOR2 *pV3, FLOAT f, FLOAT g); + +// Transform (x, y, 0, 1) by matrix. +D3DXVECTOR4* WINAPI D3DXVec2Transform + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR2 *pV, CONST D3DXMATRIX *pM ); + +// Transform (x, y, 0, 1) by matrix, project result back into w=1. +D3DXVECTOR2* WINAPI D3DXVec2TransformCoord + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV, CONST D3DXMATRIX *pM ); + +// Transform (x, y, 0, 0) by matrix. +D3DXVECTOR2* WINAPI D3DXVec2TransformNormal + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV, CONST D3DXMATRIX *pM ); + +// Transform Array (x, y, 0, 1) by matrix. +D3DXVECTOR4* WINAPI D3DXVec2TransformArray + ( D3DXVECTOR4 *pOut, UINT OutStride, CONST D3DXVECTOR2 *pV, UINT VStride, CONST D3DXMATRIX *pM, UINT n); + +// Transform Array (x, y, 0, 1) by matrix, project result back into w=1. +D3DXVECTOR2* WINAPI D3DXVec2TransformCoordArray + ( D3DXVECTOR2 *pOut, UINT OutStride, CONST D3DXVECTOR2 *pV, UINT VStride, CONST D3DXMATRIX *pM, UINT n ); + +// Transform Array (x, y, 0, 0) by matrix. +D3DXVECTOR2* WINAPI D3DXVec2TransformNormalArray + ( D3DXVECTOR2 *pOut, UINT OutStride, CONST D3DXVECTOR2 *pV, UINT VStride, CONST D3DXMATRIX *pM, UINT n ); + + + +#ifdef __cplusplus +} +#endif + + +//-------------------------- +// 3D Vector +//-------------------------- + +// inline + +FLOAT D3DXVec3Length + ( CONST D3DXVECTOR3 *pV ); + +FLOAT D3DXVec3LengthSq + ( CONST D3DXVECTOR3 *pV ); + +FLOAT D3DXVec3Dot + ( CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ); + +D3DXVECTOR3* D3DXVec3Cross + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ); + +D3DXVECTOR3* D3DXVec3Add + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ); + +D3DXVECTOR3* D3DXVec3Subtract + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ); + +// Minimize each component. x = min(x1, x2), y = min(y1, y2), ... +D3DXVECTOR3* D3DXVec3Minimize + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ); + +// Maximize each component. x = max(x1, x2), y = max(y1, y2), ... +D3DXVECTOR3* D3DXVec3Maximize + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ); + +D3DXVECTOR3* D3DXVec3Scale + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV, FLOAT s); + +// Linear interpolation. V1 + s(V2-V1) +D3DXVECTOR3* D3DXVec3Lerp + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2, + FLOAT s ); + +// non-inline +#ifdef __cplusplus +extern "C" { +#endif + +D3DXVECTOR3* WINAPI D3DXVec3Normalize + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV ); + +// Hermite interpolation between position V1, tangent T1 (when s == 0) +// and position V2, tangent T2 (when s == 1). +D3DXVECTOR3* WINAPI D3DXVec3Hermite + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pT1, + CONST D3DXVECTOR3 *pV2, CONST D3DXVECTOR3 *pT2, FLOAT s ); + +// CatmullRom interpolation between V1 (when s == 0) and V2 (when s == 1) +D3DXVECTOR3* WINAPI D3DXVec3CatmullRom + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV0, CONST D3DXVECTOR3 *pV1, + CONST D3DXVECTOR3 *pV2, CONST D3DXVECTOR3 *pV3, FLOAT s ); + +// Barycentric coordinates. V1 + f(V2-V1) + g(V3-V1) +D3DXVECTOR3* WINAPI D3DXVec3BaryCentric + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2, + CONST D3DXVECTOR3 *pV3, FLOAT f, FLOAT g); + +// Transform (x, y, z, 1) by matrix. +D3DXVECTOR4* WINAPI D3DXVec3Transform + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR3 *pV, CONST D3DXMATRIX *pM ); + +// Transform (x, y, z, 1) by matrix, project result back into w=1. +D3DXVECTOR3* WINAPI D3DXVec3TransformCoord + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV, CONST D3DXMATRIX *pM ); + +// Transform (x, y, z, 0) by matrix. If you transforming a normal by a +// non-affine matrix, the matrix you pass to this function should be the +// transpose of the inverse of the matrix you would use to transform a coord. +D3DXVECTOR3* WINAPI D3DXVec3TransformNormal + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV, CONST D3DXMATRIX *pM ); + + +// Transform Array (x, y, z, 1) by matrix. +D3DXVECTOR4* WINAPI D3DXVec3TransformArray + ( D3DXVECTOR4 *pOut, UINT OutStride, CONST D3DXVECTOR3 *pV, UINT VStride, CONST D3DXMATRIX *pM, UINT n ); + +// Transform Array (x, y, z, 1) by matrix, project result back into w=1. +D3DXVECTOR3* WINAPI D3DXVec3TransformCoordArray + ( D3DXVECTOR3 *pOut, UINT OutStride, CONST D3DXVECTOR3 *pV, UINT VStride, CONST D3DXMATRIX *pM, UINT n ); + +// Transform (x, y, z, 0) by matrix. If you transforming a normal by a +// non-affine matrix, the matrix you pass to this function should be the +// transpose of the inverse of the matrix you would use to transform a coord. +D3DXVECTOR3* WINAPI D3DXVec3TransformNormalArray + ( D3DXVECTOR3 *pOut, UINT OutStride, CONST D3DXVECTOR3 *pV, UINT VStride, CONST D3DXMATRIX *pM, UINT n ); + +// Project vector from object space into screen space +D3DXVECTOR3* WINAPI D3DXVec3Project + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV, CONST D3DVIEWPORT9 *pViewport, + CONST D3DXMATRIX *pProjection, CONST D3DXMATRIX *pView, CONST D3DXMATRIX *pWorld); + +// Project vector from screen space into object space +D3DXVECTOR3* WINAPI D3DXVec3Unproject + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV, CONST D3DVIEWPORT9 *pViewport, + CONST D3DXMATRIX *pProjection, CONST D3DXMATRIX *pView, CONST D3DXMATRIX *pWorld); + +// Project vector Array from object space into screen space +D3DXVECTOR3* WINAPI D3DXVec3ProjectArray + ( D3DXVECTOR3 *pOut, UINT OutStride,CONST D3DXVECTOR3 *pV, UINT VStride,CONST D3DVIEWPORT9 *pViewport, + CONST D3DXMATRIX *pProjection, CONST D3DXMATRIX *pView, CONST D3DXMATRIX *pWorld, UINT n); + +// Project vector Array from screen space into object space +D3DXVECTOR3* WINAPI D3DXVec3UnprojectArray + ( D3DXVECTOR3 *pOut, UINT OutStride, CONST D3DXVECTOR3 *pV, UINT VStride, CONST D3DVIEWPORT9 *pViewport, + CONST D3DXMATRIX *pProjection, CONST D3DXMATRIX *pView, CONST D3DXMATRIX *pWorld, UINT n); + + +#ifdef __cplusplus +} +#endif + + + +//-------------------------- +// 4D Vector +//-------------------------- + +// inline + +FLOAT D3DXVec4Length + ( CONST D3DXVECTOR4 *pV ); + +FLOAT D3DXVec4LengthSq + ( CONST D3DXVECTOR4 *pV ); + +FLOAT D3DXVec4Dot + ( CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2 ); + +D3DXVECTOR4* D3DXVec4Add + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2); + +D3DXVECTOR4* D3DXVec4Subtract + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2); + +// Minimize each component. x = min(x1, x2), y = min(y1, y2), ... +D3DXVECTOR4* D3DXVec4Minimize + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2); + +// Maximize each component. x = max(x1, x2), y = max(y1, y2), ... +D3DXVECTOR4* D3DXVec4Maximize + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2); + +D3DXVECTOR4* D3DXVec4Scale + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV, FLOAT s); + +// Linear interpolation. V1 + s(V2-V1) +D3DXVECTOR4* D3DXVec4Lerp + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2, + FLOAT s ); + +// non-inline +#ifdef __cplusplus +extern "C" { +#endif + +// Cross-product in 4 dimensions. +D3DXVECTOR4* WINAPI D3DXVec4Cross + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2, + CONST D3DXVECTOR4 *pV3); + +D3DXVECTOR4* WINAPI D3DXVec4Normalize + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV ); + +// Hermite interpolation between position V1, tangent T1 (when s == 0) +// and position V2, tangent T2 (when s == 1). +D3DXVECTOR4* WINAPI D3DXVec4Hermite + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pT1, + CONST D3DXVECTOR4 *pV2, CONST D3DXVECTOR4 *pT2, FLOAT s ); + +// CatmullRom interpolation between V1 (when s == 0) and V2 (when s == 1) +D3DXVECTOR4* WINAPI D3DXVec4CatmullRom + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV0, CONST D3DXVECTOR4 *pV1, + CONST D3DXVECTOR4 *pV2, CONST D3DXVECTOR4 *pV3, FLOAT s ); + +// Barycentric coordinates. V1 + f(V2-V1) + g(V3-V1) +D3DXVECTOR4* WINAPI D3DXVec4BaryCentric + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2, + CONST D3DXVECTOR4 *pV3, FLOAT f, FLOAT g); + +// Transform vector by matrix. +D3DXVECTOR4* WINAPI D3DXVec4Transform + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV, CONST D3DXMATRIX *pM ); + +// Transform vector array by matrix. +D3DXVECTOR4* WINAPI D3DXVec4TransformArray + ( D3DXVECTOR4 *pOut, UINT OutStride, CONST D3DXVECTOR4 *pV, UINT VStride, CONST D3DXMATRIX *pM, UINT n ); + +#ifdef __cplusplus +} +#endif + + +//-------------------------- +// 4D Matrix +//-------------------------- + +// inline + +D3DXMATRIX* D3DXMatrixIdentity + ( D3DXMATRIX *pOut ); + +BOOL D3DXMatrixIsIdentity + ( CONST D3DXMATRIX *pM ); + + +// non-inline +#ifdef __cplusplus +extern "C" { +#endif + +FLOAT WINAPI D3DXMatrixDeterminant + ( CONST D3DXMATRIX *pM ); + +HRESULT WINAPI D3DXMatrixDecompose + ( D3DXVECTOR3 *pOutScale, D3DXQUATERNION *pOutRotation, + D3DXVECTOR3 *pOutTranslation, CONST D3DXMATRIX *pM ); + +D3DXMATRIX* WINAPI D3DXMatrixTranspose + ( D3DXMATRIX *pOut, CONST D3DXMATRIX *pM ); + +// Matrix multiplication. The result represents the transformation M2 +// followed by the transformation M1. (Out = M1 * M2) +D3DXMATRIX* WINAPI D3DXMatrixMultiply + ( D3DXMATRIX *pOut, CONST D3DXMATRIX *pM1, CONST D3DXMATRIX *pM2 ); + +// Matrix multiplication, followed by a transpose. (Out = T(M1 * M2)) +D3DXMATRIX* WINAPI D3DXMatrixMultiplyTranspose + ( D3DXMATRIX *pOut, CONST D3DXMATRIX *pM1, CONST D3DXMATRIX *pM2 ); + +// Calculate inverse of matrix. Inversion my fail, in which case NULL will +// be returned. The determinant of pM is also returned it pfDeterminant +// is non-NULL. +D3DXMATRIX* WINAPI D3DXMatrixInverse + ( D3DXMATRIX *pOut, FLOAT *pDeterminant, CONST D3DXMATRIX *pM ); + +// Build a matrix which scales by (sx, sy, sz) +D3DXMATRIX* WINAPI D3DXMatrixScaling + ( D3DXMATRIX *pOut, FLOAT sx, FLOAT sy, FLOAT sz ); + +// Build a matrix which translates by (x, y, z) +D3DXMATRIX* WINAPI D3DXMatrixTranslation + ( D3DXMATRIX *pOut, FLOAT x, FLOAT y, FLOAT z ); + +// Build a matrix which rotates around the X axis +D3DXMATRIX* WINAPI D3DXMatrixRotationX + ( D3DXMATRIX *pOut, FLOAT Angle ); + +// Build a matrix which rotates around the Y axis +D3DXMATRIX* WINAPI D3DXMatrixRotationY + ( D3DXMATRIX *pOut, FLOAT Angle ); + +// Build a matrix which rotates around the Z axis +D3DXMATRIX* WINAPI D3DXMatrixRotationZ + ( D3DXMATRIX *pOut, FLOAT Angle ); + +// Build a matrix which rotates around an arbitrary axis +D3DXMATRIX* WINAPI D3DXMatrixRotationAxis + ( D3DXMATRIX *pOut, CONST D3DXVECTOR3 *pV, FLOAT Angle ); + +// Build a matrix from a quaternion +D3DXMATRIX* WINAPI D3DXMatrixRotationQuaternion + ( D3DXMATRIX *pOut, CONST D3DXQUATERNION *pQ); + +// Yaw around the Y axis, a pitch around the X axis, +// and a roll around the Z axis. +D3DXMATRIX* WINAPI D3DXMatrixRotationYawPitchRoll + ( D3DXMATRIX *pOut, FLOAT Yaw, FLOAT Pitch, FLOAT Roll ); + +// Build transformation matrix. NULL arguments are treated as identity. +// Mout = Msc-1 * Msr-1 * Ms * Msr * Msc * Mrc-1 * Mr * Mrc * Mt +D3DXMATRIX* WINAPI D3DXMatrixTransformation + ( D3DXMATRIX *pOut, CONST D3DXVECTOR3 *pScalingCenter, + CONST D3DXQUATERNION *pScalingRotation, CONST D3DXVECTOR3 *pScaling, + CONST D3DXVECTOR3 *pRotationCenter, CONST D3DXQUATERNION *pRotation, + CONST D3DXVECTOR3 *pTranslation); + +// Build 2D transformation matrix in XY plane. NULL arguments are treated as identity. +// Mout = Msc-1 * Msr-1 * Ms * Msr * Msc * Mrc-1 * Mr * Mrc * Mt +D3DXMATRIX* WINAPI D3DXMatrixTransformation2D + ( D3DXMATRIX *pOut, CONST D3DXVECTOR2* pScalingCenter, + FLOAT ScalingRotation, CONST D3DXVECTOR2* pScaling, + CONST D3DXVECTOR2* pRotationCenter, FLOAT Rotation, + CONST D3DXVECTOR2* pTranslation); + +// Build affine transformation matrix. NULL arguments are treated as identity. +// Mout = Ms * Mrc-1 * Mr * Mrc * Mt +D3DXMATRIX* WINAPI D3DXMatrixAffineTransformation + ( D3DXMATRIX *pOut, FLOAT Scaling, CONST D3DXVECTOR3 *pRotationCenter, + CONST D3DXQUATERNION *pRotation, CONST D3DXVECTOR3 *pTranslation); + +// Build 2D affine transformation matrix in XY plane. NULL arguments are treated as identity. +// Mout = Ms * Mrc-1 * Mr * Mrc * Mt +D3DXMATRIX* WINAPI D3DXMatrixAffineTransformation2D + ( D3DXMATRIX *pOut, FLOAT Scaling, CONST D3DXVECTOR2* pRotationCenter, + FLOAT Rotation, CONST D3DXVECTOR2* pTranslation); + +// Build a lookat matrix. (right-handed) +D3DXMATRIX* WINAPI D3DXMatrixLookAtRH + ( D3DXMATRIX *pOut, CONST D3DXVECTOR3 *pEye, CONST D3DXVECTOR3 *pAt, + CONST D3DXVECTOR3 *pUp ); + +// Build a lookat matrix. (left-handed) +D3DXMATRIX* WINAPI D3DXMatrixLookAtLH + ( D3DXMATRIX *pOut, CONST D3DXVECTOR3 *pEye, CONST D3DXVECTOR3 *pAt, + CONST D3DXVECTOR3 *pUp ); + +// Build a perspective projection matrix. (right-handed) +D3DXMATRIX* WINAPI D3DXMatrixPerspectiveRH + ( D3DXMATRIX *pOut, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf ); + +// Build a perspective projection matrix. (left-handed) +D3DXMATRIX* WINAPI D3DXMatrixPerspectiveLH + ( D3DXMATRIX *pOut, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf ); + +// Build a perspective projection matrix. (right-handed) +D3DXMATRIX* WINAPI D3DXMatrixPerspectiveFovRH + ( D3DXMATRIX *pOut, FLOAT fovy, FLOAT Aspect, FLOAT zn, FLOAT zf ); + +// Build a perspective projection matrix. (left-handed) +D3DXMATRIX* WINAPI D3DXMatrixPerspectiveFovLH + ( D3DXMATRIX *pOut, FLOAT fovy, FLOAT Aspect, FLOAT zn, FLOAT zf ); + +// Build a perspective projection matrix. (right-handed) +D3DXMATRIX* WINAPI D3DXMatrixPerspectiveOffCenterRH + ( D3DXMATRIX *pOut, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, + FLOAT zf ); + +// Build a perspective projection matrix. (left-handed) +D3DXMATRIX* WINAPI D3DXMatrixPerspectiveOffCenterLH + ( D3DXMATRIX *pOut, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, + FLOAT zf ); + +// Build an ortho projection matrix. (right-handed) +D3DXMATRIX* WINAPI D3DXMatrixOrthoRH + ( D3DXMATRIX *pOut, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf ); + +// Build an ortho projection matrix. (left-handed) +D3DXMATRIX* WINAPI D3DXMatrixOrthoLH + ( D3DXMATRIX *pOut, FLOAT w, FLOAT h, FLOAT zn, FLOAT zf ); + +// Build an ortho projection matrix. (right-handed) +D3DXMATRIX* WINAPI D3DXMatrixOrthoOffCenterRH + ( D3DXMATRIX *pOut, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, + FLOAT zf ); + +// Build an ortho projection matrix. (left-handed) +D3DXMATRIX* WINAPI D3DXMatrixOrthoOffCenterLH + ( D3DXMATRIX *pOut, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, + FLOAT zf ); + +// Build a matrix which flattens geometry into a plane, as if casting +// a shadow from a light. +D3DXMATRIX* WINAPI D3DXMatrixShadow + ( D3DXMATRIX *pOut, CONST D3DXVECTOR4 *pLight, + CONST D3DXPLANE *pPlane ); + +// Build a matrix which reflects the coordinate system about a plane +D3DXMATRIX* WINAPI D3DXMatrixReflect + ( D3DXMATRIX *pOut, CONST D3DXPLANE *pPlane ); + +#ifdef __cplusplus +} +#endif + + +//-------------------------- +// Quaternion +//-------------------------- + +// inline + +FLOAT D3DXQuaternionLength + ( CONST D3DXQUATERNION *pQ ); + +// Length squared, or "norm" +FLOAT D3DXQuaternionLengthSq + ( CONST D3DXQUATERNION *pQ ); + +FLOAT D3DXQuaternionDot + ( CONST D3DXQUATERNION *pQ1, CONST D3DXQUATERNION *pQ2 ); + +// (0, 0, 0, 1) +D3DXQUATERNION* D3DXQuaternionIdentity + ( D3DXQUATERNION *pOut ); + +BOOL D3DXQuaternionIsIdentity + ( CONST D3DXQUATERNION *pQ ); + +// (-x, -y, -z, w) +D3DXQUATERNION* D3DXQuaternionConjugate + ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ ); + + +// non-inline +#ifdef __cplusplus +extern "C" { +#endif + +// Compute a quaternin's axis and angle of rotation. Expects unit quaternions. +void WINAPI D3DXQuaternionToAxisAngle + ( CONST D3DXQUATERNION *pQ, D3DXVECTOR3 *pAxis, FLOAT *pAngle ); + +// Build a quaternion from a rotation matrix. +D3DXQUATERNION* WINAPI D3DXQuaternionRotationMatrix + ( D3DXQUATERNION *pOut, CONST D3DXMATRIX *pM); + +// Rotation about arbitrary axis. +D3DXQUATERNION* WINAPI D3DXQuaternionRotationAxis + ( D3DXQUATERNION *pOut, CONST D3DXVECTOR3 *pV, FLOAT Angle ); + +// Yaw around the Y axis, a pitch around the X axis, +// and a roll around the Z axis. +D3DXQUATERNION* WINAPI D3DXQuaternionRotationYawPitchRoll + ( D3DXQUATERNION *pOut, FLOAT Yaw, FLOAT Pitch, FLOAT Roll ); + +// Quaternion multiplication. The result represents the rotation Q2 +// followed by the rotation Q1. (Out = Q2 * Q1) +D3DXQUATERNION* WINAPI D3DXQuaternionMultiply + ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ1, + CONST D3DXQUATERNION *pQ2 ); + +D3DXQUATERNION* WINAPI D3DXQuaternionNormalize + ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ ); + +// Conjugate and re-norm +D3DXQUATERNION* WINAPI D3DXQuaternionInverse + ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ ); + +// Expects unit quaternions. +// if q = (cos(theta), sin(theta) * v); ln(q) = (0, theta * v) +D3DXQUATERNION* WINAPI D3DXQuaternionLn + ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ ); + +// Expects pure quaternions. (w == 0) w is ignored in calculation. +// if q = (0, theta * v); exp(q) = (cos(theta), sin(theta) * v) +D3DXQUATERNION* WINAPI D3DXQuaternionExp + ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ ); + +// Spherical linear interpolation between Q1 (t == 0) and Q2 (t == 1). +// Expects unit quaternions. +D3DXQUATERNION* WINAPI D3DXQuaternionSlerp + ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ1, + CONST D3DXQUATERNION *pQ2, FLOAT t ); + +// Spherical quadrangle interpolation. +// Slerp(Slerp(Q1, C, t), Slerp(A, B, t), 2t(1-t)) +D3DXQUATERNION* WINAPI D3DXQuaternionSquad + ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ1, + CONST D3DXQUATERNION *pA, CONST D3DXQUATERNION *pB, + CONST D3DXQUATERNION *pC, FLOAT t ); + +// Setup control points for spherical quadrangle interpolation +// from Q1 to Q2. The control points are chosen in such a way +// to ensure the continuity of tangents with adjacent segments. +void WINAPI D3DXQuaternionSquadSetup + ( D3DXQUATERNION *pAOut, D3DXQUATERNION *pBOut, D3DXQUATERNION *pCOut, + CONST D3DXQUATERNION *pQ0, CONST D3DXQUATERNION *pQ1, + CONST D3DXQUATERNION *pQ2, CONST D3DXQUATERNION *pQ3 ); + +// Barycentric interpolation. +// Slerp(Slerp(Q1, Q2, f+g), Slerp(Q1, Q3, f+g), g/(f+g)) +D3DXQUATERNION* WINAPI D3DXQuaternionBaryCentric + ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ1, + CONST D3DXQUATERNION *pQ2, CONST D3DXQUATERNION *pQ3, + FLOAT f, FLOAT g ); + +#ifdef __cplusplus +} +#endif + + +//-------------------------- +// Plane +//-------------------------- + +// inline + +// ax + by + cz + dw +FLOAT D3DXPlaneDot + ( CONST D3DXPLANE *pP, CONST D3DXVECTOR4 *pV); + +// ax + by + cz + d +FLOAT D3DXPlaneDotCoord + ( CONST D3DXPLANE *pP, CONST D3DXVECTOR3 *pV); + +// ax + by + cz +FLOAT D3DXPlaneDotNormal + ( CONST D3DXPLANE *pP, CONST D3DXVECTOR3 *pV); + +D3DXPLANE* D3DXPlaneScale + (D3DXPLANE *pOut, CONST D3DXPLANE *pP, FLOAT s); + +// non-inline +#ifdef __cplusplus +extern "C" { +#endif + +// Normalize plane (so that |a,b,c| == 1) +D3DXPLANE* WINAPI D3DXPlaneNormalize + ( D3DXPLANE *pOut, CONST D3DXPLANE *pP); + +// Find the intersection between a plane and a line. If the line is +// parallel to the plane, NULL is returned. +D3DXVECTOR3* WINAPI D3DXPlaneIntersectLine + ( D3DXVECTOR3 *pOut, CONST D3DXPLANE *pP, CONST D3DXVECTOR3 *pV1, + CONST D3DXVECTOR3 *pV2); + +// Construct a plane from a point and a normal +D3DXPLANE* WINAPI D3DXPlaneFromPointNormal + ( D3DXPLANE *pOut, CONST D3DXVECTOR3 *pPoint, CONST D3DXVECTOR3 *pNormal); + +// Construct a plane from 3 points +D3DXPLANE* WINAPI D3DXPlaneFromPoints + ( D3DXPLANE *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2, + CONST D3DXVECTOR3 *pV3); + +// Transform a plane by a matrix. The vector (a,b,c) must be normal. +// M should be the inverse transpose of the transformation desired. +D3DXPLANE* WINAPI D3DXPlaneTransform + ( D3DXPLANE *pOut, CONST D3DXPLANE *pP, CONST D3DXMATRIX *pM ); + +// Transform an array of planes by a matrix. The vectors (a,b,c) must be normal. +// M should be the inverse transpose of the transformation desired. +D3DXPLANE* WINAPI D3DXPlaneTransformArray + ( D3DXPLANE *pOut, UINT OutStride, CONST D3DXPLANE *pP, UINT PStride, CONST D3DXMATRIX *pM, UINT n ); + +#ifdef __cplusplus +} +#endif + + +//-------------------------- +// Color +//-------------------------- + +// inline + +// (1-r, 1-g, 1-b, a) +D3DXCOLOR* D3DXColorNegative + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC); + +D3DXCOLOR* D3DXColorAdd + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2); + +D3DXCOLOR* D3DXColorSubtract + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2); + +D3DXCOLOR* D3DXColorScale + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC, FLOAT s); + +// (r1*r2, g1*g2, b1*b2, a1*a2) +D3DXCOLOR* D3DXColorModulate + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2); + +// Linear interpolation of r,g,b, and a. C1 + s(C2-C1) +D3DXCOLOR* D3DXColorLerp + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2, FLOAT s); + +// non-inline +#ifdef __cplusplus +extern "C" { +#endif + +// Interpolate r,g,b between desaturated color and color. +// DesaturatedColor + s(Color - DesaturatedColor) +D3DXCOLOR* WINAPI D3DXColorAdjustSaturation + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC, FLOAT s); + +// Interpolate r,g,b between 50% grey and color. Grey + s(Color - Grey) +D3DXCOLOR* WINAPI D3DXColorAdjustContrast + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC, FLOAT c); + +#ifdef __cplusplus +} +#endif + + + + +//-------------------------- +// Misc +//-------------------------- + +#ifdef __cplusplus +extern "C" { +#endif + +// Calculate Fresnel term given the cosine of theta (likely obtained by +// taking the dot of two normals), and the refraction index of the material. +FLOAT WINAPI D3DXFresnelTerm + (FLOAT CosTheta, FLOAT RefractionIndex); + +#ifdef __cplusplus +} +#endif + + + +//=========================================================================== +// +// Matrix Stack +// +//=========================================================================== + +typedef interface ID3DXMatrixStack ID3DXMatrixStack; +typedef interface ID3DXMatrixStack *LPD3DXMATRIXSTACK; + +// {C7885BA7-F990-4fe7-922D-8515E477DD85} +DEFINE_GUID(IID_ID3DXMatrixStack, +0xc7885ba7, 0xf990, 0x4fe7, 0x92, 0x2d, 0x85, 0x15, 0xe4, 0x77, 0xdd, 0x85); + + +#undef INTERFACE +#define INTERFACE ID3DXMatrixStack + +DECLARE_INTERFACE_(ID3DXMatrixStack, IUnknown) +{ + // + // IUnknown methods + // + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + // + // ID3DXMatrixStack methods + // + + // Pops the top of the stack, returns the current top + // *after* popping the top. + STDMETHOD(Pop)(THIS) PURE; + + // Pushes the stack by one, duplicating the current matrix. + STDMETHOD(Push)(THIS) PURE; + + // Loads identity in the current matrix. + STDMETHOD(LoadIdentity)(THIS) PURE; + + // Loads the given matrix into the current matrix + STDMETHOD(LoadMatrix)(THIS_ CONST D3DXMATRIX* pM ) PURE; + + // Right-Multiplies the given matrix to the current matrix. + // (transformation is about the current world origin) + STDMETHOD(MultMatrix)(THIS_ CONST D3DXMATRIX* pM ) PURE; + + // Left-Multiplies the given matrix to the current matrix + // (transformation is about the local origin of the object) + STDMETHOD(MultMatrixLocal)(THIS_ CONST D3DXMATRIX* pM ) PURE; + + // Right multiply the current matrix with the computed rotation + // matrix, counterclockwise about the given axis with the given angle. + // (rotation is about the current world origin) + STDMETHOD(RotateAxis) + (THIS_ CONST D3DXVECTOR3* pV, FLOAT Angle) PURE; + + // Left multiply the current matrix with the computed rotation + // matrix, counterclockwise about the given axis with the given angle. + // (rotation is about the local origin of the object) + STDMETHOD(RotateAxisLocal) + (THIS_ CONST D3DXVECTOR3* pV, FLOAT Angle) PURE; + + // Right multiply the current matrix with the computed rotation + // matrix. All angles are counterclockwise. (rotation is about the + // current world origin) + + // The rotation is composed of a yaw around the Y axis, a pitch around + // the X axis, and a roll around the Z axis. + STDMETHOD(RotateYawPitchRoll) + (THIS_ FLOAT Yaw, FLOAT Pitch, FLOAT Roll) PURE; + + // Left multiply the current matrix with the computed rotation + // matrix. All angles are counterclockwise. (rotation is about the + // local origin of the object) + + // The rotation is composed of a yaw around the Y axis, a pitch around + // the X axis, and a roll around the Z axis. + STDMETHOD(RotateYawPitchRollLocal) + (THIS_ FLOAT Yaw, FLOAT Pitch, FLOAT Roll) PURE; + + // Right multiply the current matrix with the computed scale + // matrix. (transformation is about the current world origin) + STDMETHOD(Scale)(THIS_ FLOAT x, FLOAT y, FLOAT z) PURE; + + // Left multiply the current matrix with the computed scale + // matrix. (transformation is about the local origin of the object) + STDMETHOD(ScaleLocal)(THIS_ FLOAT x, FLOAT y, FLOAT z) PURE; + + // Right multiply the current matrix with the computed translation + // matrix. (transformation is about the current world origin) + STDMETHOD(Translate)(THIS_ FLOAT x, FLOAT y, FLOAT z ) PURE; + + // Left multiply the current matrix with the computed translation + // matrix. (transformation is about the local origin of the object) + STDMETHOD(TranslateLocal)(THIS_ FLOAT x, FLOAT y, FLOAT z) PURE; + + // Obtain the current matrix at the top of the stack + STDMETHOD_(D3DXMATRIX*, GetTop)(THIS) PURE; +}; + +#ifdef __cplusplus +extern "C" { +#endif + +HRESULT WINAPI + D3DXCreateMatrixStack( + DWORD Flags, + LPD3DXMATRIXSTACK* ppStack); + +#ifdef __cplusplus +} +#endif + +//=========================================================================== +// +// Spherical Harmonic Runtime Routines +// +// NOTE: +// * Most of these functions can take the same object as in and out parameters. +// The exceptions are the rotation functions. +// +// * Out parameters are typically also returned as return values, so that +// the output of one function may be used as a parameter to another. +// +//============================================================================ + + +// non-inline +#ifdef __cplusplus +extern "C" { +#endif + +//============================================================================ +// +// Basic Spherical Harmonic math routines +// +//============================================================================ + +#define D3DXSH_MINORDER 2 +#define D3DXSH_MAXORDER 6 + +//============================================================================ +// +// D3DXSHEvalDirection: +// -------------------- +// Evaluates the Spherical Harmonic basis functions +// +// Parameters: +// pOut +// Output SH coefficients - basis function Ylm is stored at l*l + m+l +// This is the pointer that is returned. +// Order +// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 +// pDir +// Direction to evaluate in - assumed to be normalized +// +//============================================================================ + +FLOAT* WINAPI D3DXSHEvalDirection + ( FLOAT *pOut, UINT Order, CONST D3DXVECTOR3 *pDir ); + +//============================================================================ +// +// D3DXSHRotate: +// -------------------- +// Rotates SH vector by a rotation matrix +// +// Parameters: +// pOut +// Output SH coefficients - basis function Ylm is stored at l*l + m+l +// This is the pointer that is returned (should not alias with pIn.) +// Order +// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 +// pMatrix +// Matrix used for rotation - rotation sub matrix should be orthogonal +// and have a unit determinant. +// pIn +// Input SH coeffs (rotated), incorect results if this is also output. +// +//============================================================================ + +FLOAT* WINAPI D3DXSHRotate + ( FLOAT *pOut, UINT Order, CONST D3DXMATRIX *pMatrix, CONST FLOAT *pIn ); + +//============================================================================ +// +// D3DXSHRotateZ: +// -------------------- +// Rotates the SH vector in the Z axis by an angle +// +// Parameters: +// pOut +// Output SH coefficients - basis function Ylm is stored at l*l + m+l +// This is the pointer that is returned (should not alias with pIn.) +// Order +// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 +// Angle +// Angle in radians to rotate around the Z axis. +// pIn +// Input SH coeffs (rotated), incorect results if this is also output. +// +//============================================================================ + + +FLOAT* WINAPI D3DXSHRotateZ + ( FLOAT *pOut, UINT Order, FLOAT Angle, CONST FLOAT *pIn ); + +//============================================================================ +// +// D3DXSHAdd: +// -------------------- +// Adds two SH vectors, pOut[i] = pA[i] + pB[i]; +// +// Parameters: +// pOut +// Output SH coefficients - basis function Ylm is stored at l*l + m+l +// This is the pointer that is returned. +// Order +// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 +// pA +// Input SH coeffs. +// pB +// Input SH coeffs (second vector.) +// +//============================================================================ + +FLOAT* WINAPI D3DXSHAdd + ( FLOAT *pOut, UINT Order, CONST FLOAT *pA, CONST FLOAT *pB ); + +//============================================================================ +// +// D3DXSHScale: +// -------------------- +// Adds two SH vectors, pOut[i] = pA[i]*Scale; +// +// Parameters: +// pOut +// Output SH coefficients - basis function Ylm is stored at l*l + m+l +// This is the pointer that is returned. +// Order +// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 +// pIn +// Input SH coeffs. +// Scale +// Scale factor. +// +//============================================================================ + +FLOAT* WINAPI D3DXSHScale + ( FLOAT *pOut, UINT Order, CONST FLOAT *pIn, CONST FLOAT Scale ); + +//============================================================================ +// +// D3DXSHDot: +// -------------------- +// Computes the dot product of two SH vectors +// +// Parameters: +// Order +// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 +// pA +// Input SH coeffs. +// pB +// Second set of input SH coeffs. +// +//============================================================================ + +FLOAT WINAPI D3DXSHDot + ( UINT Order, CONST FLOAT *pA, CONST FLOAT *pB ); + +//============================================================================ +// +// D3DXSHMultiply[O]: +// -------------------- +// Computes the product of two functions represented using SH (f and g), where: +// pOut[i] = int(y_i(s) * f(s) * g(s)), where y_i(s) is the ith SH basis +// function, f(s) and g(s) are SH functions (sum_i(y_i(s)*c_i)). The order O +// determines the lengths of the arrays, where there should always be O^2 +// coefficients. In general the product of two SH functions of order O generates +// and SH function of order 2*O - 1, but we truncate the result. This means +// that the product commutes (f*g == g*f) but doesn't associate +// (f*(g*h) != (f*g)*h. +// +// Parameters: +// pOut +// Output SH coefficients - basis function Ylm is stored at l*l + m+l +// This is the pointer that is returned. +// pF +// Input SH coeffs for first function. +// pG +// Second set of input SH coeffs. +// +//============================================================================ + +FLOAT* WINAPI D3DXSHMultiply2( FLOAT *pOut, CONST FLOAT *pF, CONST FLOAT *pG); +FLOAT* WINAPI D3DXSHMultiply3( FLOAT *pOut, CONST FLOAT *pF, CONST FLOAT *pG); +FLOAT* WINAPI D3DXSHMultiply4( FLOAT *pOut, CONST FLOAT *pF, CONST FLOAT *pG); +FLOAT* WINAPI D3DXSHMultiply5( FLOAT *pOut, CONST FLOAT *pF, CONST FLOAT *pG); +FLOAT* WINAPI D3DXSHMultiply6( FLOAT *pOut, CONST FLOAT *pF, CONST FLOAT *pG); + + +//============================================================================ +// +// Basic Spherical Harmonic lighting routines +// +//============================================================================ + +//============================================================================ +// +// D3DXSHEvalDirectionalLight: +// -------------------- +// Evaluates a directional light and returns spectral SH data. The output +// vector is computed so that if the intensity of R/G/B is unit the resulting +// exit radiance of a point directly under the light on a diffuse object with +// an albedo of 1 would be 1.0. This will compute 3 spectral samples, pROut +// has to be specified, while pGout and pBout are optional. +// +// Parameters: +// Order +// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 +// pDir +// Direction light is coming from (assumed to be normalized.) +// RIntensity +// Red intensity of light. +// GIntensity +// Green intensity of light. +// BIntensity +// Blue intensity of light. +// pROut +// Output SH vector for Red. +// pGOut +// Output SH vector for Green (optional.) +// pBOut +// Output SH vector for Blue (optional.) +// +//============================================================================ + +HRESULT WINAPI D3DXSHEvalDirectionalLight + ( UINT Order, CONST D3DXVECTOR3 *pDir, + FLOAT RIntensity, FLOAT GIntensity, FLOAT BIntensity, + FLOAT *pROut, FLOAT *pGOut, FLOAT *pBOut ); + +//============================================================================ +// +// D3DXSHEvalSphericalLight: +// -------------------- +// Evaluates a spherical light and returns spectral SH data. There is no +// normalization of the intensity of the light like there is for directional +// lights, care has to be taken when specifiying the intensities. This will +// compute 3 spectral samples, pROut has to be specified, while pGout and +// pBout are optional. +// +// Parameters: +// Order +// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 +// pPos +// Position of light - reciever is assumed to be at the origin. +// Radius +// Radius of the spherical light source. +// RIntensity +// Red intensity of light. +// GIntensity +// Green intensity of light. +// BIntensity +// Blue intensity of light. +// pROut +// Output SH vector for Red. +// pGOut +// Output SH vector for Green (optional.) +// pBOut +// Output SH vector for Blue (optional.) +// +//============================================================================ + +HRESULT WINAPI D3DXSHEvalSphericalLight + ( UINT Order, CONST D3DXVECTOR3 *pPos, FLOAT Radius, + FLOAT RIntensity, FLOAT GIntensity, FLOAT BIntensity, + FLOAT *pROut, FLOAT *pGOut, FLOAT *pBOut ); + +//============================================================================ +// +// D3DXSHEvalConeLight: +// -------------------- +// Evaluates a light that is a cone of constant intensity and returns spectral +// SH data. The output vector is computed so that if the intensity of R/G/B is +// unit the resulting exit radiance of a point directly under the light oriented +// in the cone direction on a diffuse object with an albedo of 1 would be 1.0. +// This will compute 3 spectral samples, pROut has to be specified, while pGout +// and pBout are optional. +// +// Parameters: +// Order +// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 +// pDir +// Direction light is coming from (assumed to be normalized.) +// Radius +// Radius of cone in radians. +// RIntensity +// Red intensity of light. +// GIntensity +// Green intensity of light. +// BIntensity +// Blue intensity of light. +// pROut +// Output SH vector for Red. +// pGOut +// Output SH vector for Green (optional.) +// pBOut +// Output SH vector for Blue (optional.) +// +//============================================================================ + +HRESULT WINAPI D3DXSHEvalConeLight + ( UINT Order, CONST D3DXVECTOR3 *pDir, FLOAT Radius, + FLOAT RIntensity, FLOAT GIntensity, FLOAT BIntensity, + FLOAT *pROut, FLOAT *pGOut, FLOAT *pBOut ); + +//============================================================================ +// +// D3DXSHEvalHemisphereLight: +// -------------------- +// Evaluates a light that is a linear interpolant between two colors over the +// sphere. The interpolant is linear along the axis of the two points, not +// over the surface of the sphere (ie: if the axis was (0,0,1) it is linear in +// Z, not in the azimuthal angle.) The resulting spherical lighting function +// is normalized so that a point on a perfectly diffuse surface with no +// shadowing and a normal pointed in the direction pDir would result in exit +// radiance with a value of 1 if the top color was white and the bottom color +// was black. This is a very simple model where Top represents the intensity +// of the "sky" and Bottom represents the intensity of the "ground". +// +// Parameters: +// Order +// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 +// pDir +// Axis of the hemisphere. +// Top +// Color of the upper hemisphere. +// Bottom +// Color of the lower hemisphere. +// pROut +// Output SH vector for Red. +// pGOut +// Output SH vector for Green +// pBOut +// Output SH vector for Blue +// +//============================================================================ + +HRESULT WINAPI D3DXSHEvalHemisphereLight + ( UINT Order, CONST D3DXVECTOR3 *pDir, D3DXCOLOR Top, D3DXCOLOR Bottom, + FLOAT *pROut, FLOAT *pGOut, FLOAT *pBOut ); + +//============================================================================ +// +// Basic Spherical Harmonic projection routines +// +//============================================================================ + +//============================================================================ +// +// D3DXSHProjectCubeMap: +// -------------------- +// Projects a function represented on a cube map into spherical harmonics. +// +// Parameters: +// Order +// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1 +// pCubeMap +// CubeMap that is going to be projected into spherical harmonics +// pROut +// Output SH vector for Red. +// pGOut +// Output SH vector for Green +// pBOut +// Output SH vector for Blue +// +//============================================================================ + +HRESULT WINAPI D3DXSHProjectCubeMap + ( UINT uOrder, LPDIRECT3DCUBETEXTURE9 pCubeMap, + FLOAT *pROut, FLOAT *pGOut, FLOAT *pBOut ); + + +#ifdef __cplusplus +} +#endif + + +#include "d3dx9math.inl" + +#if _MSC_VER >= 1200 +#pragma warning(pop) +#else +#pragma warning(default:4201) +#endif + +#endif // __D3DX9MATH_H__ + diff --git a/MediaClient/MediaClient/directx/include/d3dx9math.inl b/MediaClient/MediaClient/directx/include/d3dx9math.inl new file mode 100644 index 0000000..a3652ed --- /dev/null +++ b/MediaClient/MediaClient/directx/include/d3dx9math.inl @@ -0,0 +1,2251 @@ +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx9math.inl +// Content: D3DX math inline functions +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef __D3DX9MATH_INL__ +#define __D3DX9MATH_INL__ + +//=========================================================================== +// +// Inline Class Methods +// +//=========================================================================== + +#ifdef __cplusplus + +//-------------------------- +// Float16 +//-------------------------- + +D3DXINLINE +D3DXFLOAT16::D3DXFLOAT16( FLOAT f ) +{ + D3DXFloat32To16Array(this, &f, 1); +} + +D3DXINLINE +D3DXFLOAT16::D3DXFLOAT16( CONST D3DXFLOAT16& f ) +{ + value = f.value; +} + +// casting +D3DXINLINE +D3DXFLOAT16::operator FLOAT () +{ + FLOAT f; + D3DXFloat16To32Array(&f, this, 1); + return f; +} + +// binary operators +D3DXINLINE BOOL +D3DXFLOAT16::operator == ( CONST D3DXFLOAT16& f ) const +{ + return value == f.value; +} + +D3DXINLINE BOOL +D3DXFLOAT16::operator != ( CONST D3DXFLOAT16& f ) const +{ + return value != f.value; +} + + +//-------------------------- +// 2D Vector +//-------------------------- + +D3DXINLINE +D3DXVECTOR2::D3DXVECTOR2( CONST FLOAT *pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + x = pf[0]; + y = pf[1]; +} + +D3DXINLINE +D3DXVECTOR2::D3DXVECTOR2( CONST D3DXFLOAT16 *pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + D3DXFloat16To32Array(&x, pf, 2); +} + +D3DXINLINE +D3DXVECTOR2::D3DXVECTOR2( FLOAT fx, FLOAT fy ) +{ + x = fx; + y = fy; +} + + +// casting +D3DXINLINE +D3DXVECTOR2::operator FLOAT* () +{ + return (FLOAT *) &x; +} + +D3DXINLINE +D3DXVECTOR2::operator CONST FLOAT* () const +{ + return (CONST FLOAT *) &x; +} + + +// assignment operators +D3DXINLINE D3DXVECTOR2& +D3DXVECTOR2::operator += ( CONST D3DXVECTOR2& v ) +{ + x += v.x; + y += v.y; + return *this; +} + +D3DXINLINE D3DXVECTOR2& +D3DXVECTOR2::operator -= ( CONST D3DXVECTOR2& v ) +{ + x -= v.x; + y -= v.y; + return *this; +} + +D3DXINLINE D3DXVECTOR2& +D3DXVECTOR2::operator *= ( FLOAT f ) +{ + x *= f; + y *= f; + return *this; +} + +D3DXINLINE D3DXVECTOR2& +D3DXVECTOR2::operator /= ( FLOAT f ) +{ + FLOAT fInv = 1.0f / f; + x *= fInv; + y *= fInv; + return *this; +} + + +// unary operators +D3DXINLINE D3DXVECTOR2 +D3DXVECTOR2::operator + () const +{ + return *this; +} + +D3DXINLINE D3DXVECTOR2 +D3DXVECTOR2::operator - () const +{ + return D3DXVECTOR2(-x, -y); +} + + +// binary operators +D3DXINLINE D3DXVECTOR2 +D3DXVECTOR2::operator + ( CONST D3DXVECTOR2& v ) const +{ + return D3DXVECTOR2(x + v.x, y + v.y); +} + +D3DXINLINE D3DXVECTOR2 +D3DXVECTOR2::operator - ( CONST D3DXVECTOR2& v ) const +{ + return D3DXVECTOR2(x - v.x, y - v.y); +} + +D3DXINLINE D3DXVECTOR2 +D3DXVECTOR2::operator * ( FLOAT f ) const +{ + return D3DXVECTOR2(x * f, y * f); +} + +D3DXINLINE D3DXVECTOR2 +D3DXVECTOR2::operator / ( FLOAT f ) const +{ + FLOAT fInv = 1.0f / f; + return D3DXVECTOR2(x * fInv, y * fInv); +} + +D3DXINLINE D3DXVECTOR2 +operator * ( FLOAT f, CONST D3DXVECTOR2& v ) +{ + return D3DXVECTOR2(f * v.x, f * v.y); +} + +D3DXINLINE BOOL +D3DXVECTOR2::operator == ( CONST D3DXVECTOR2& v ) const +{ + return x == v.x && y == v.y; +} + +D3DXINLINE BOOL +D3DXVECTOR2::operator != ( CONST D3DXVECTOR2& v ) const +{ + return x != v.x || y != v.y; +} + + + +//-------------------------- +// 2D Vector (16 bit) +//-------------------------- + +D3DXINLINE +D3DXVECTOR2_16F::D3DXVECTOR2_16F( CONST FLOAT *pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + D3DXFloat32To16Array(&x, pf, 2); +} + +D3DXINLINE +D3DXVECTOR2_16F::D3DXVECTOR2_16F( CONST D3DXFLOAT16 *pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + *((DWORD *) &x) = *((DWORD *) &pf[0]); +} + +D3DXINLINE +D3DXVECTOR2_16F::D3DXVECTOR2_16F( CONST D3DXFLOAT16 &fx, CONST D3DXFLOAT16 &fy ) +{ + x = fx; + y = fy; +} + + +// casting +D3DXINLINE +D3DXVECTOR2_16F::operator D3DXFLOAT16* () +{ + return (D3DXFLOAT16*) &x; +} + +D3DXINLINE +D3DXVECTOR2_16F::operator CONST D3DXFLOAT16* () const +{ + return (CONST D3DXFLOAT16*) &x; +} + + +// binary operators +D3DXINLINE BOOL +D3DXVECTOR2_16F::operator == ( CONST D3DXVECTOR2_16F &v ) const +{ + return *((DWORD *) &x) == *((DWORD *) &v.x); +} + +D3DXINLINE BOOL +D3DXVECTOR2_16F::operator != ( CONST D3DXVECTOR2_16F &v ) const +{ + return *((DWORD *) &x) != *((DWORD *) &v.x); +} + + +//-------------------------- +// 3D Vector +//-------------------------- +D3DXINLINE +D3DXVECTOR3::D3DXVECTOR3( CONST FLOAT *pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + x = pf[0]; + y = pf[1]; + z = pf[2]; +} + +D3DXINLINE +D3DXVECTOR3::D3DXVECTOR3( CONST D3DVECTOR& v ) +{ + x = v.x; + y = v.y; + z = v.z; +} + +D3DXINLINE +D3DXVECTOR3::D3DXVECTOR3( CONST D3DXFLOAT16 *pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + D3DXFloat16To32Array(&x, pf, 3); +} + +D3DXINLINE +D3DXVECTOR3::D3DXVECTOR3( FLOAT fx, FLOAT fy, FLOAT fz ) +{ + x = fx; + y = fy; + z = fz; +} + + +// casting +D3DXINLINE +D3DXVECTOR3::operator FLOAT* () +{ + return (FLOAT *) &x; +} + +D3DXINLINE +D3DXVECTOR3::operator CONST FLOAT* () const +{ + return (CONST FLOAT *) &x; +} + + +// assignment operators +D3DXINLINE D3DXVECTOR3& +D3DXVECTOR3::operator += ( CONST D3DXVECTOR3& v ) +{ + x += v.x; + y += v.y; + z += v.z; + return *this; +} + +D3DXINLINE D3DXVECTOR3& +D3DXVECTOR3::operator -= ( CONST D3DXVECTOR3& v ) +{ + x -= v.x; + y -= v.y; + z -= v.z; + return *this; +} + +D3DXINLINE D3DXVECTOR3& +D3DXVECTOR3::operator *= ( FLOAT f ) +{ + x *= f; + y *= f; + z *= f; + return *this; +} + +D3DXINLINE D3DXVECTOR3& +D3DXVECTOR3::operator /= ( FLOAT f ) +{ + FLOAT fInv = 1.0f / f; + x *= fInv; + y *= fInv; + z *= fInv; + return *this; +} + + +// unary operators +D3DXINLINE D3DXVECTOR3 +D3DXVECTOR3::operator + () const +{ + return *this; +} + +D3DXINLINE D3DXVECTOR3 +D3DXVECTOR3::operator - () const +{ + return D3DXVECTOR3(-x, -y, -z); +} + + +// binary operators +D3DXINLINE D3DXVECTOR3 +D3DXVECTOR3::operator + ( CONST D3DXVECTOR3& v ) const +{ + return D3DXVECTOR3(x + v.x, y + v.y, z + v.z); +} + +D3DXINLINE D3DXVECTOR3 +D3DXVECTOR3::operator - ( CONST D3DXVECTOR3& v ) const +{ + return D3DXVECTOR3(x - v.x, y - v.y, z - v.z); +} + +D3DXINLINE D3DXVECTOR3 +D3DXVECTOR3::operator * ( FLOAT f ) const +{ + return D3DXVECTOR3(x * f, y * f, z * f); +} + +D3DXINLINE D3DXVECTOR3 +D3DXVECTOR3::operator / ( FLOAT f ) const +{ + FLOAT fInv = 1.0f / f; + return D3DXVECTOR3(x * fInv, y * fInv, z * fInv); +} + + +D3DXINLINE D3DXVECTOR3 +operator * ( FLOAT f, CONST struct D3DXVECTOR3& v ) +{ + return D3DXVECTOR3(f * v.x, f * v.y, f * v.z); +} + + +D3DXINLINE BOOL +D3DXVECTOR3::operator == ( CONST D3DXVECTOR3& v ) const +{ + return x == v.x && y == v.y && z == v.z; +} + +D3DXINLINE BOOL +D3DXVECTOR3::operator != ( CONST D3DXVECTOR3& v ) const +{ + return x != v.x || y != v.y || z != v.z; +} + + + +//-------------------------- +// 3D Vector (16 bit) +//-------------------------- + +D3DXINLINE +D3DXVECTOR3_16F::D3DXVECTOR3_16F( CONST FLOAT *pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + D3DXFloat32To16Array(&x, pf, 3); +} + +D3DXINLINE +D3DXVECTOR3_16F::D3DXVECTOR3_16F( CONST D3DVECTOR& v ) +{ + D3DXFloat32To16Array(&x, &v.x, 1); + D3DXFloat32To16Array(&y, &v.y, 1); + D3DXFloat32To16Array(&z, &v.z, 1); +} + +D3DXINLINE +D3DXVECTOR3_16F::D3DXVECTOR3_16F( CONST D3DXFLOAT16 *pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + *((DWORD *) &x) = *((DWORD *) &pf[0]); + *((WORD *) &z) = *((WORD *) &pf[2]); +} + +D3DXINLINE +D3DXVECTOR3_16F::D3DXVECTOR3_16F( CONST D3DXFLOAT16 &fx, CONST D3DXFLOAT16 &fy, CONST D3DXFLOAT16 &fz ) +{ + x = fx; + y = fy; + z = fz; +} + + +// casting +D3DXINLINE +D3DXVECTOR3_16F::operator D3DXFLOAT16* () +{ + return (D3DXFLOAT16*) &x; +} + +D3DXINLINE +D3DXVECTOR3_16F::operator CONST D3DXFLOAT16* () const +{ + return (CONST D3DXFLOAT16*) &x; +} + + +// binary operators +D3DXINLINE BOOL +D3DXVECTOR3_16F::operator == ( CONST D3DXVECTOR3_16F &v ) const +{ + return *((DWORD *) &x) == *((DWORD *) &v.x) && + *((WORD *) &z) == *((WORD *) &v.z); +} + +D3DXINLINE BOOL +D3DXVECTOR3_16F::operator != ( CONST D3DXVECTOR3_16F &v ) const +{ + return *((DWORD *) &x) != *((DWORD *) &v.x) || + *((WORD *) &z) != *((WORD *) &v.z); +} + + +//-------------------------- +// 4D Vector +//-------------------------- +D3DXINLINE +D3DXVECTOR4::D3DXVECTOR4( CONST FLOAT *pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + x = pf[0]; + y = pf[1]; + z = pf[2]; + w = pf[3]; +} + +D3DXINLINE +D3DXVECTOR4::D3DXVECTOR4( CONST D3DXFLOAT16 *pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + D3DXFloat16To32Array(&x, pf, 4); +} + +D3DXINLINE +D3DXVECTOR4::D3DXVECTOR4( CONST D3DVECTOR& v, FLOAT f ) +{ + x = v.x; + y = v.y; + z = v.z; + w = f; +} + +D3DXINLINE +D3DXVECTOR4::D3DXVECTOR4( FLOAT fx, FLOAT fy, FLOAT fz, FLOAT fw ) +{ + x = fx; + y = fy; + z = fz; + w = fw; +} + + +// casting +D3DXINLINE +D3DXVECTOR4::operator FLOAT* () +{ + return (FLOAT *) &x; +} + +D3DXINLINE +D3DXVECTOR4::operator CONST FLOAT* () const +{ + return (CONST FLOAT *) &x; +} + + +// assignment operators +D3DXINLINE D3DXVECTOR4& +D3DXVECTOR4::operator += ( CONST D3DXVECTOR4& v ) +{ + x += v.x; + y += v.y; + z += v.z; + w += v.w; + return *this; +} + +D3DXINLINE D3DXVECTOR4& +D3DXVECTOR4::operator -= ( CONST D3DXVECTOR4& v ) +{ + x -= v.x; + y -= v.y; + z -= v.z; + w -= v.w; + return *this; +} + +D3DXINLINE D3DXVECTOR4& +D3DXVECTOR4::operator *= ( FLOAT f ) +{ + x *= f; + y *= f; + z *= f; + w *= f; + return *this; +} + +D3DXINLINE D3DXVECTOR4& +D3DXVECTOR4::operator /= ( FLOAT f ) +{ + FLOAT fInv = 1.0f / f; + x *= fInv; + y *= fInv; + z *= fInv; + w *= fInv; + return *this; +} + + +// unary operators +D3DXINLINE D3DXVECTOR4 +D3DXVECTOR4::operator + () const +{ + return *this; +} + +D3DXINLINE D3DXVECTOR4 +D3DXVECTOR4::operator - () const +{ + return D3DXVECTOR4(-x, -y, -z, -w); +} + + +// binary operators +D3DXINLINE D3DXVECTOR4 +D3DXVECTOR4::operator + ( CONST D3DXVECTOR4& v ) const +{ + return D3DXVECTOR4(x + v.x, y + v.y, z + v.z, w + v.w); +} + +D3DXINLINE D3DXVECTOR4 +D3DXVECTOR4::operator - ( CONST D3DXVECTOR4& v ) const +{ + return D3DXVECTOR4(x - v.x, y - v.y, z - v.z, w - v.w); +} + +D3DXINLINE D3DXVECTOR4 +D3DXVECTOR4::operator * ( FLOAT f ) const +{ + return D3DXVECTOR4(x * f, y * f, z * f, w * f); +} + +D3DXINLINE D3DXVECTOR4 +D3DXVECTOR4::operator / ( FLOAT f ) const +{ + FLOAT fInv = 1.0f / f; + return D3DXVECTOR4(x * fInv, y * fInv, z * fInv, w * fInv); +} + +D3DXINLINE D3DXVECTOR4 +operator * ( FLOAT f, CONST D3DXVECTOR4& v ) +{ + return D3DXVECTOR4(f * v.x, f * v.y, f * v.z, f * v.w); +} + + +D3DXINLINE BOOL +D3DXVECTOR4::operator == ( CONST D3DXVECTOR4& v ) const +{ + return x == v.x && y == v.y && z == v.z && w == v.w; +} + +D3DXINLINE BOOL +D3DXVECTOR4::operator != ( CONST D3DXVECTOR4& v ) const +{ + return x != v.x || y != v.y || z != v.z || w != v.w; +} + + + +//-------------------------- +// 4D Vector (16 bit) +//-------------------------- + +D3DXINLINE +D3DXVECTOR4_16F::D3DXVECTOR4_16F( CONST FLOAT *pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + D3DXFloat32To16Array(&x, pf, 4); +} + +D3DXINLINE +D3DXVECTOR4_16F::D3DXVECTOR4_16F( CONST D3DXFLOAT16 *pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + *((DWORD *) &x) = *((DWORD *) &pf[0]); + *((DWORD *) &z) = *((DWORD *) &pf[2]); +} + +D3DXINLINE +D3DXVECTOR4_16F::D3DXVECTOR4_16F( CONST D3DXVECTOR3_16F& v, CONST D3DXFLOAT16& f ) +{ + x = v.x; + y = v.y; + z = v.z; + w = f; +} + +D3DXINLINE +D3DXVECTOR4_16F::D3DXVECTOR4_16F( CONST D3DXFLOAT16 &fx, CONST D3DXFLOAT16 &fy, CONST D3DXFLOAT16 &fz, CONST D3DXFLOAT16 &fw ) +{ + x = fx; + y = fy; + z = fz; + w = fw; +} + + +// casting +D3DXINLINE +D3DXVECTOR4_16F::operator D3DXFLOAT16* () +{ + return (D3DXFLOAT16*) &x; +} + +D3DXINLINE +D3DXVECTOR4_16F::operator CONST D3DXFLOAT16* () const +{ + return (CONST D3DXFLOAT16*) &x; +} + + +// binary operators +D3DXINLINE BOOL +D3DXVECTOR4_16F::operator == ( CONST D3DXVECTOR4_16F &v ) const +{ + return *((DWORD *) &x) == *((DWORD *) &v.x) && + *((DWORD *) &z) == *((DWORD *) &v.z); +} + +D3DXINLINE BOOL +D3DXVECTOR4_16F::operator != ( CONST D3DXVECTOR4_16F &v ) const +{ + return *((DWORD *) &x) != *((DWORD *) &v.x) || + *((DWORD *) &z) != *((DWORD *) &v.z); +} + + +//-------------------------- +// Matrix +//-------------------------- +D3DXINLINE +D3DXMATRIX::D3DXMATRIX( CONST FLOAT* pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + memcpy(&_11, pf, sizeof(D3DXMATRIX)); +} + +D3DXINLINE +D3DXMATRIX::D3DXMATRIX( CONST D3DMATRIX& mat ) +{ + memcpy(&_11, &mat, sizeof(D3DXMATRIX)); +} + +D3DXINLINE +D3DXMATRIX::D3DXMATRIX( CONST D3DXFLOAT16* pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + D3DXFloat16To32Array(&_11, pf, 16); +} + +D3DXINLINE +D3DXMATRIX::D3DXMATRIX( FLOAT f11, FLOAT f12, FLOAT f13, FLOAT f14, + FLOAT f21, FLOAT f22, FLOAT f23, FLOAT f24, + FLOAT f31, FLOAT f32, FLOAT f33, FLOAT f34, + FLOAT f41, FLOAT f42, FLOAT f43, FLOAT f44 ) +{ + _11 = f11; _12 = f12; _13 = f13; _14 = f14; + _21 = f21; _22 = f22; _23 = f23; _24 = f24; + _31 = f31; _32 = f32; _33 = f33; _34 = f34; + _41 = f41; _42 = f42; _43 = f43; _44 = f44; +} + + + +// access grants +D3DXINLINE FLOAT& +D3DXMATRIX::operator () ( UINT iRow, UINT iCol ) +{ + return m[iRow][iCol]; +} + +D3DXINLINE FLOAT +D3DXMATRIX::operator () ( UINT iRow, UINT iCol ) const +{ + return m[iRow][iCol]; +} + + +// casting operators +D3DXINLINE +D3DXMATRIX::operator FLOAT* () +{ + return (FLOAT *) &_11; +} + +D3DXINLINE +D3DXMATRIX::operator CONST FLOAT* () const +{ + return (CONST FLOAT *) &_11; +} + + +// assignment operators +D3DXINLINE D3DXMATRIX& +D3DXMATRIX::operator *= ( CONST D3DXMATRIX& mat ) +{ + D3DXMatrixMultiply(this, this, &mat); + return *this; +} + +D3DXINLINE D3DXMATRIX& +D3DXMATRIX::operator += ( CONST D3DXMATRIX& mat ) +{ + _11 += mat._11; _12 += mat._12; _13 += mat._13; _14 += mat._14; + _21 += mat._21; _22 += mat._22; _23 += mat._23; _24 += mat._24; + _31 += mat._31; _32 += mat._32; _33 += mat._33; _34 += mat._34; + _41 += mat._41; _42 += mat._42; _43 += mat._43; _44 += mat._44; + return *this; +} + +D3DXINLINE D3DXMATRIX& +D3DXMATRIX::operator -= ( CONST D3DXMATRIX& mat ) +{ + _11 -= mat._11; _12 -= mat._12; _13 -= mat._13; _14 -= mat._14; + _21 -= mat._21; _22 -= mat._22; _23 -= mat._23; _24 -= mat._24; + _31 -= mat._31; _32 -= mat._32; _33 -= mat._33; _34 -= mat._34; + _41 -= mat._41; _42 -= mat._42; _43 -= mat._43; _44 -= mat._44; + return *this; +} + +D3DXINLINE D3DXMATRIX& +D3DXMATRIX::operator *= ( FLOAT f ) +{ + _11 *= f; _12 *= f; _13 *= f; _14 *= f; + _21 *= f; _22 *= f; _23 *= f; _24 *= f; + _31 *= f; _32 *= f; _33 *= f; _34 *= f; + _41 *= f; _42 *= f; _43 *= f; _44 *= f; + return *this; +} + +D3DXINLINE D3DXMATRIX& +D3DXMATRIX::operator /= ( FLOAT f ) +{ + FLOAT fInv = 1.0f / f; + _11 *= fInv; _12 *= fInv; _13 *= fInv; _14 *= fInv; + _21 *= fInv; _22 *= fInv; _23 *= fInv; _24 *= fInv; + _31 *= fInv; _32 *= fInv; _33 *= fInv; _34 *= fInv; + _41 *= fInv; _42 *= fInv; _43 *= fInv; _44 *= fInv; + return *this; +} + + +// unary operators +D3DXINLINE D3DXMATRIX +D3DXMATRIX::operator + () const +{ + return *this; +} + +D3DXINLINE D3DXMATRIX +D3DXMATRIX::operator - () const +{ + return D3DXMATRIX(-_11, -_12, -_13, -_14, + -_21, -_22, -_23, -_24, + -_31, -_32, -_33, -_34, + -_41, -_42, -_43, -_44); +} + + +// binary operators +D3DXINLINE D3DXMATRIX +D3DXMATRIX::operator * ( CONST D3DXMATRIX& mat ) const +{ + D3DXMATRIX matT; + D3DXMatrixMultiply(&matT, this, &mat); + return matT; +} + +D3DXINLINE D3DXMATRIX +D3DXMATRIX::operator + ( CONST D3DXMATRIX& mat ) const +{ + return D3DXMATRIX(_11 + mat._11, _12 + mat._12, _13 + mat._13, _14 + mat._14, + _21 + mat._21, _22 + mat._22, _23 + mat._23, _24 + mat._24, + _31 + mat._31, _32 + mat._32, _33 + mat._33, _34 + mat._34, + _41 + mat._41, _42 + mat._42, _43 + mat._43, _44 + mat._44); +} + +D3DXINLINE D3DXMATRIX +D3DXMATRIX::operator - ( CONST D3DXMATRIX& mat ) const +{ + return D3DXMATRIX(_11 - mat._11, _12 - mat._12, _13 - mat._13, _14 - mat._14, + _21 - mat._21, _22 - mat._22, _23 - mat._23, _24 - mat._24, + _31 - mat._31, _32 - mat._32, _33 - mat._33, _34 - mat._34, + _41 - mat._41, _42 - mat._42, _43 - mat._43, _44 - mat._44); +} + +D3DXINLINE D3DXMATRIX +D3DXMATRIX::operator * ( FLOAT f ) const +{ + return D3DXMATRIX(_11 * f, _12 * f, _13 * f, _14 * f, + _21 * f, _22 * f, _23 * f, _24 * f, + _31 * f, _32 * f, _33 * f, _34 * f, + _41 * f, _42 * f, _43 * f, _44 * f); +} + +D3DXINLINE D3DXMATRIX +D3DXMATRIX::operator / ( FLOAT f ) const +{ + FLOAT fInv = 1.0f / f; + return D3DXMATRIX(_11 * fInv, _12 * fInv, _13 * fInv, _14 * fInv, + _21 * fInv, _22 * fInv, _23 * fInv, _24 * fInv, + _31 * fInv, _32 * fInv, _33 * fInv, _34 * fInv, + _41 * fInv, _42 * fInv, _43 * fInv, _44 * fInv); +} + + +D3DXINLINE D3DXMATRIX +operator * ( FLOAT f, CONST D3DXMATRIX& mat ) +{ + return D3DXMATRIX(f * mat._11, f * mat._12, f * mat._13, f * mat._14, + f * mat._21, f * mat._22, f * mat._23, f * mat._24, + f * mat._31, f * mat._32, f * mat._33, f * mat._34, + f * mat._41, f * mat._42, f * mat._43, f * mat._44); +} + + +D3DXINLINE BOOL +D3DXMATRIX::operator == ( CONST D3DXMATRIX& mat ) const +{ + return 0 == memcmp(this, &mat, sizeof(D3DXMATRIX)); +} + +D3DXINLINE BOOL +D3DXMATRIX::operator != ( CONST D3DXMATRIX& mat ) const +{ + return 0 != memcmp(this, &mat, sizeof(D3DXMATRIX)); +} + + + +//-------------------------- +// Aligned Matrices +//-------------------------- + +D3DXINLINE +_D3DXMATRIXA16::_D3DXMATRIXA16( CONST FLOAT* f ) : + D3DXMATRIX( f ) +{ +} + +D3DXINLINE +_D3DXMATRIXA16::_D3DXMATRIXA16( CONST D3DMATRIX& m ) : + D3DXMATRIX( m ) +{ +} + +D3DXINLINE +_D3DXMATRIXA16::_D3DXMATRIXA16( CONST D3DXFLOAT16* f ) : + D3DXMATRIX( f ) +{ +} + +D3DXINLINE +_D3DXMATRIXA16::_D3DXMATRIXA16( FLOAT _11, FLOAT _12, FLOAT _13, FLOAT _14, + FLOAT _21, FLOAT _22, FLOAT _23, FLOAT _24, + FLOAT _31, FLOAT _32, FLOAT _33, FLOAT _34, + FLOAT _41, FLOAT _42, FLOAT _43, FLOAT _44 ) : + D3DXMATRIX(_11, _12, _13, _14, + _21, _22, _23, _24, + _31, _32, _33, _34, + _41, _42, _43, _44) +{ +} + +#ifndef SIZE_MAX +#define SIZE_MAX ((SIZE_T)-1) +#endif + +D3DXINLINE void* +_D3DXMATRIXA16::operator new( size_t s ) +{ + if (s > (SIZE_MAX-16)) + return NULL; + LPBYTE p = ::new BYTE[s + 16]; + if (p) + { + BYTE offset = (BYTE)(16 - ((UINT_PTR)p & 15)); + p += offset; + p[-1] = offset; + } + return p; +} + +D3DXINLINE void* +_D3DXMATRIXA16::operator new[]( size_t s ) +{ + if (s > (SIZE_MAX-16)) + return NULL; + LPBYTE p = ::new BYTE[s + 16]; + if (p) + { + BYTE offset = (BYTE)(16 - ((UINT_PTR)p & 15)); + p += offset; + p[-1] = offset; + } + return p; +} + +D3DXINLINE void +_D3DXMATRIXA16::operator delete(void* p) +{ + if(p) + { + BYTE* pb = static_cast(p); + pb -= pb[-1]; + ::delete [] pb; + } +} + +D3DXINLINE void +_D3DXMATRIXA16::operator delete[](void* p) +{ + if(p) + { + BYTE* pb = static_cast(p); + pb -= pb[-1]; + ::delete [] pb; + } +} + +D3DXINLINE _D3DXMATRIXA16& +_D3DXMATRIXA16::operator=(CONST D3DXMATRIX& rhs) +{ + memcpy(&_11, &rhs, sizeof(D3DXMATRIX)); + return *this; +} + + +//-------------------------- +// Quaternion +//-------------------------- + +D3DXINLINE +D3DXQUATERNION::D3DXQUATERNION( CONST FLOAT* pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + x = pf[0]; + y = pf[1]; + z = pf[2]; + w = pf[3]; +} + +D3DXINLINE +D3DXQUATERNION::D3DXQUATERNION( CONST D3DXFLOAT16* pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + D3DXFloat16To32Array(&x, pf, 4); +} + +D3DXINLINE +D3DXQUATERNION::D3DXQUATERNION( FLOAT fx, FLOAT fy, FLOAT fz, FLOAT fw ) +{ + x = fx; + y = fy; + z = fz; + w = fw; +} + + +// casting +D3DXINLINE +D3DXQUATERNION::operator FLOAT* () +{ + return (FLOAT *) &x; +} + +D3DXINLINE +D3DXQUATERNION::operator CONST FLOAT* () const +{ + return (CONST FLOAT *) &x; +} + + +// assignment operators +D3DXINLINE D3DXQUATERNION& +D3DXQUATERNION::operator += ( CONST D3DXQUATERNION& q ) +{ + x += q.x; + y += q.y; + z += q.z; + w += q.w; + return *this; +} + +D3DXINLINE D3DXQUATERNION& +D3DXQUATERNION::operator -= ( CONST D3DXQUATERNION& q ) +{ + x -= q.x; + y -= q.y; + z -= q.z; + w -= q.w; + return *this; +} + +D3DXINLINE D3DXQUATERNION& +D3DXQUATERNION::operator *= ( CONST D3DXQUATERNION& q ) +{ + D3DXQuaternionMultiply(this, this, &q); + return *this; +} + +D3DXINLINE D3DXQUATERNION& +D3DXQUATERNION::operator *= ( FLOAT f ) +{ + x *= f; + y *= f; + z *= f; + w *= f; + return *this; +} + +D3DXINLINE D3DXQUATERNION& +D3DXQUATERNION::operator /= ( FLOAT f ) +{ + FLOAT fInv = 1.0f / f; + x *= fInv; + y *= fInv; + z *= fInv; + w *= fInv; + return *this; +} + + +// unary operators +D3DXINLINE D3DXQUATERNION +D3DXQUATERNION::operator + () const +{ + return *this; +} + +D3DXINLINE D3DXQUATERNION +D3DXQUATERNION::operator - () const +{ + return D3DXQUATERNION(-x, -y, -z, -w); +} + + +// binary operators +D3DXINLINE D3DXQUATERNION +D3DXQUATERNION::operator + ( CONST D3DXQUATERNION& q ) const +{ + return D3DXQUATERNION(x + q.x, y + q.y, z + q.z, w + q.w); +} + +D3DXINLINE D3DXQUATERNION +D3DXQUATERNION::operator - ( CONST D3DXQUATERNION& q ) const +{ + return D3DXQUATERNION(x - q.x, y - q.y, z - q.z, w - q.w); +} + +D3DXINLINE D3DXQUATERNION +D3DXQUATERNION::operator * ( CONST D3DXQUATERNION& q ) const +{ + D3DXQUATERNION qT; + D3DXQuaternionMultiply(&qT, this, &q); + return qT; +} + +D3DXINLINE D3DXQUATERNION +D3DXQUATERNION::operator * ( FLOAT f ) const +{ + return D3DXQUATERNION(x * f, y * f, z * f, w * f); +} + +D3DXINLINE D3DXQUATERNION +D3DXQUATERNION::operator / ( FLOAT f ) const +{ + FLOAT fInv = 1.0f / f; + return D3DXQUATERNION(x * fInv, y * fInv, z * fInv, w * fInv); +} + + +D3DXINLINE D3DXQUATERNION +operator * (FLOAT f, CONST D3DXQUATERNION& q ) +{ + return D3DXQUATERNION(f * q.x, f * q.y, f * q.z, f * q.w); +} + + +D3DXINLINE BOOL +D3DXQUATERNION::operator == ( CONST D3DXQUATERNION& q ) const +{ + return x == q.x && y == q.y && z == q.z && w == q.w; +} + +D3DXINLINE BOOL +D3DXQUATERNION::operator != ( CONST D3DXQUATERNION& q ) const +{ + return x != q.x || y != q.y || z != q.z || w != q.w; +} + + + +//-------------------------- +// Plane +//-------------------------- + +D3DXINLINE +D3DXPLANE::D3DXPLANE( CONST FLOAT* pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + a = pf[0]; + b = pf[1]; + c = pf[2]; + d = pf[3]; +} + +D3DXINLINE +D3DXPLANE::D3DXPLANE( CONST D3DXFLOAT16* pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + D3DXFloat16To32Array(&a, pf, 4); +} + +D3DXINLINE +D3DXPLANE::D3DXPLANE( FLOAT fa, FLOAT fb, FLOAT fc, FLOAT fd ) +{ + a = fa; + b = fb; + c = fc; + d = fd; +} + + +// casting +D3DXINLINE +D3DXPLANE::operator FLOAT* () +{ + return (FLOAT *) &a; +} + +D3DXINLINE +D3DXPLANE::operator CONST FLOAT* () const +{ + return (CONST FLOAT *) &a; +} + + +// assignment operators +D3DXINLINE D3DXPLANE& +D3DXPLANE::operator *= ( FLOAT f ) +{ + a *= f; + b *= f; + c *= f; + d *= f; + return *this; +} + +D3DXINLINE D3DXPLANE& +D3DXPLANE::operator /= ( FLOAT f ) +{ + FLOAT fInv = 1.0f / f; + a *= fInv; + b *= fInv; + c *= fInv; + d *= fInv; + return *this; +} + + +// unary operators +D3DXINLINE D3DXPLANE +D3DXPLANE::operator + () const +{ + return *this; +} + +D3DXINLINE D3DXPLANE +D3DXPLANE::operator - () const +{ + return D3DXPLANE(-a, -b, -c, -d); +} + + +// binary operators +D3DXINLINE D3DXPLANE +D3DXPLANE::operator * ( FLOAT f ) const +{ + return D3DXPLANE(a * f, b * f, c * f, d * f); +} + +D3DXINLINE D3DXPLANE +D3DXPLANE::operator / ( FLOAT f ) const +{ + FLOAT fInv = 1.0f / f; + return D3DXPLANE(a * fInv, b * fInv, c * fInv, d * fInv); +} + +D3DXINLINE D3DXPLANE +operator * (FLOAT f, CONST D3DXPLANE& p ) +{ + return D3DXPLANE(f * p.a, f * p.b, f * p.c, f * p.d); +} + +D3DXINLINE BOOL +D3DXPLANE::operator == ( CONST D3DXPLANE& p ) const +{ + return a == p.a && b == p.b && c == p.c && d == p.d; +} + +D3DXINLINE BOOL +D3DXPLANE::operator != ( CONST D3DXPLANE& p ) const +{ + return a != p.a || b != p.b || c != p.c || d != p.d; +} + + + + +//-------------------------- +// Color +//-------------------------- + +D3DXINLINE +D3DXCOLOR::D3DXCOLOR( DWORD dw ) +{ + CONST FLOAT f = 1.0f / 255.0f; + r = f * (FLOAT) (unsigned char) (dw >> 16); + g = f * (FLOAT) (unsigned char) (dw >> 8); + b = f * (FLOAT) (unsigned char) (dw >> 0); + a = f * (FLOAT) (unsigned char) (dw >> 24); +} + +D3DXINLINE +D3DXCOLOR::D3DXCOLOR( CONST FLOAT* pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + r = pf[0]; + g = pf[1]; + b = pf[2]; + a = pf[3]; +} + +D3DXINLINE +D3DXCOLOR::D3DXCOLOR( CONST D3DXFLOAT16* pf ) +{ +#ifdef D3DX_DEBUG + if(!pf) + return; +#endif + + D3DXFloat16To32Array(&r, pf, 4); +} + +D3DXINLINE +D3DXCOLOR::D3DXCOLOR( CONST D3DCOLORVALUE& c ) +{ + r = c.r; + g = c.g; + b = c.b; + a = c.a; +} + +D3DXINLINE +D3DXCOLOR::D3DXCOLOR( FLOAT fr, FLOAT fg, FLOAT fb, FLOAT fa ) +{ + r = fr; + g = fg; + b = fb; + a = fa; +} + + +// casting +D3DXINLINE +D3DXCOLOR::operator DWORD () const +{ + DWORD dwR = r >= 1.0f ? 0xff : r <= 0.0f ? 0x00 : (DWORD) (r * 255.0f + 0.5f); + DWORD dwG = g >= 1.0f ? 0xff : g <= 0.0f ? 0x00 : (DWORD) (g * 255.0f + 0.5f); + DWORD dwB = b >= 1.0f ? 0xff : b <= 0.0f ? 0x00 : (DWORD) (b * 255.0f + 0.5f); + DWORD dwA = a >= 1.0f ? 0xff : a <= 0.0f ? 0x00 : (DWORD) (a * 255.0f + 0.5f); + + return (dwA << 24) | (dwR << 16) | (dwG << 8) | dwB; +} + + +D3DXINLINE +D3DXCOLOR::operator FLOAT * () +{ + return (FLOAT *) &r; +} + +D3DXINLINE +D3DXCOLOR::operator CONST FLOAT * () const +{ + return (CONST FLOAT *) &r; +} + + +D3DXINLINE +D3DXCOLOR::operator D3DCOLORVALUE * () +{ + return (D3DCOLORVALUE *) &r; +} + +D3DXINLINE +D3DXCOLOR::operator CONST D3DCOLORVALUE * () const +{ + return (CONST D3DCOLORVALUE *) &r; +} + + +D3DXINLINE +D3DXCOLOR::operator D3DCOLORVALUE& () +{ + return *((D3DCOLORVALUE *) &r); +} + +D3DXINLINE +D3DXCOLOR::operator CONST D3DCOLORVALUE& () const +{ + return *((CONST D3DCOLORVALUE *) &r); +} + + +// assignment operators +D3DXINLINE D3DXCOLOR& +D3DXCOLOR::operator += ( CONST D3DXCOLOR& c ) +{ + r += c.r; + g += c.g; + b += c.b; + a += c.a; + return *this; +} + +D3DXINLINE D3DXCOLOR& +D3DXCOLOR::operator -= ( CONST D3DXCOLOR& c ) +{ + r -= c.r; + g -= c.g; + b -= c.b; + a -= c.a; + return *this; +} + +D3DXINLINE D3DXCOLOR& +D3DXCOLOR::operator *= ( FLOAT f ) +{ + r *= f; + g *= f; + b *= f; + a *= f; + return *this; +} + +D3DXINLINE D3DXCOLOR& +D3DXCOLOR::operator /= ( FLOAT f ) +{ + FLOAT fInv = 1.0f / f; + r *= fInv; + g *= fInv; + b *= fInv; + a *= fInv; + return *this; +} + + +// unary operators +D3DXINLINE D3DXCOLOR +D3DXCOLOR::operator + () const +{ + return *this; +} + +D3DXINLINE D3DXCOLOR +D3DXCOLOR::operator - () const +{ + return D3DXCOLOR(-r, -g, -b, -a); +} + + +// binary operators +D3DXINLINE D3DXCOLOR +D3DXCOLOR::operator + ( CONST D3DXCOLOR& c ) const +{ + return D3DXCOLOR(r + c.r, g + c.g, b + c.b, a + c.a); +} + +D3DXINLINE D3DXCOLOR +D3DXCOLOR::operator - ( CONST D3DXCOLOR& c ) const +{ + return D3DXCOLOR(r - c.r, g - c.g, b - c.b, a - c.a); +} + +D3DXINLINE D3DXCOLOR +D3DXCOLOR::operator * ( FLOAT f ) const +{ + return D3DXCOLOR(r * f, g * f, b * f, a * f); +} + +D3DXINLINE D3DXCOLOR +D3DXCOLOR::operator / ( FLOAT f ) const +{ + FLOAT fInv = 1.0f / f; + return D3DXCOLOR(r * fInv, g * fInv, b * fInv, a * fInv); +} + + +D3DXINLINE D3DXCOLOR +operator * (FLOAT f, CONST D3DXCOLOR& c ) +{ + return D3DXCOLOR(f * c.r, f * c.g, f * c.b, f * c.a); +} + + +D3DXINLINE BOOL +D3DXCOLOR::operator == ( CONST D3DXCOLOR& c ) const +{ + return r == c.r && g == c.g && b == c.b && a == c.a; +} + +D3DXINLINE BOOL +D3DXCOLOR::operator != ( CONST D3DXCOLOR& c ) const +{ + return r != c.r || g != c.g || b != c.b || a != c.a; +} + + +#endif //__cplusplus + + + +//=========================================================================== +// +// Inline functions +// +//=========================================================================== + + +//-------------------------- +// 2D Vector +//-------------------------- + +D3DXINLINE FLOAT D3DXVec2Length + ( CONST D3DXVECTOR2 *pV ) +{ +#ifdef D3DX_DEBUG + if(!pV) + return 0.0f; +#endif + +#ifdef __cplusplus + return sqrtf(pV->x * pV->x + pV->y * pV->y); +#else + return (FLOAT) sqrt(pV->x * pV->x + pV->y * pV->y); +#endif +} + +D3DXINLINE FLOAT D3DXVec2LengthSq + ( CONST D3DXVECTOR2 *pV ) +{ +#ifdef D3DX_DEBUG + if(!pV) + return 0.0f; +#endif + + return pV->x * pV->x + pV->y * pV->y; +} + +D3DXINLINE FLOAT D3DXVec2Dot + ( CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ) +{ +#ifdef D3DX_DEBUG + if(!pV1 || !pV2) + return 0.0f; +#endif + + return pV1->x * pV2->x + pV1->y * pV2->y; +} + +D3DXINLINE FLOAT D3DXVec2CCW + ( CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ) +{ +#ifdef D3DX_DEBUG + if(!pV1 || !pV2) + return 0.0f; +#endif + + return pV1->x * pV2->y - pV1->y * pV2->x; +} + +D3DXINLINE D3DXVECTOR2* D3DXVec2Add + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x + pV2->x; + pOut->y = pV1->y + pV2->y; + return pOut; +} + +D3DXINLINE D3DXVECTOR2* D3DXVec2Subtract + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x - pV2->x; + pOut->y = pV1->y - pV2->y; + return pOut; +} + +D3DXINLINE D3DXVECTOR2* D3DXVec2Minimize + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x < pV2->x ? pV1->x : pV2->x; + pOut->y = pV1->y < pV2->y ? pV1->y : pV2->y; + return pOut; +} + +D3DXINLINE D3DXVECTOR2* D3DXVec2Maximize + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2 ) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x > pV2->x ? pV1->x : pV2->x; + pOut->y = pV1->y > pV2->y ? pV1->y : pV2->y; + return pOut; +} + +D3DXINLINE D3DXVECTOR2* D3DXVec2Scale + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV, FLOAT s ) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV) + return NULL; +#endif + + pOut->x = pV->x * s; + pOut->y = pV->y * s; + return pOut; +} + +D3DXINLINE D3DXVECTOR2* D3DXVec2Lerp + ( D3DXVECTOR2 *pOut, CONST D3DXVECTOR2 *pV1, CONST D3DXVECTOR2 *pV2, + FLOAT s ) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x + s * (pV2->x - pV1->x); + pOut->y = pV1->y + s * (pV2->y - pV1->y); + return pOut; +} + + +//-------------------------- +// 3D Vector +//-------------------------- + +D3DXINLINE FLOAT D3DXVec3Length + ( CONST D3DXVECTOR3 *pV ) +{ +#ifdef D3DX_DEBUG + if(!pV) + return 0.0f; +#endif + +#ifdef __cplusplus + return sqrtf(pV->x * pV->x + pV->y * pV->y + pV->z * pV->z); +#else + return (FLOAT) sqrt(pV->x * pV->x + pV->y * pV->y + pV->z * pV->z); +#endif +} + +D3DXINLINE FLOAT D3DXVec3LengthSq + ( CONST D3DXVECTOR3 *pV ) +{ +#ifdef D3DX_DEBUG + if(!pV) + return 0.0f; +#endif + + return pV->x * pV->x + pV->y * pV->y + pV->z * pV->z; +} + +D3DXINLINE FLOAT D3DXVec3Dot + ( CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ) +{ +#ifdef D3DX_DEBUG + if(!pV1 || !pV2) + return 0.0f; +#endif + + return pV1->x * pV2->x + pV1->y * pV2->y + pV1->z * pV2->z; +} + +D3DXINLINE D3DXVECTOR3* D3DXVec3Cross + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ) +{ + D3DXVECTOR3 v; + +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + v.x = pV1->y * pV2->z - pV1->z * pV2->y; + v.y = pV1->z * pV2->x - pV1->x * pV2->z; + v.z = pV1->x * pV2->y - pV1->y * pV2->x; + + *pOut = v; + return pOut; +} + +D3DXINLINE D3DXVECTOR3* D3DXVec3Add + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x + pV2->x; + pOut->y = pV1->y + pV2->y; + pOut->z = pV1->z + pV2->z; + return pOut; +} + +D3DXINLINE D3DXVECTOR3* D3DXVec3Subtract + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x - pV2->x; + pOut->y = pV1->y - pV2->y; + pOut->z = pV1->z - pV2->z; + return pOut; +} + +D3DXINLINE D3DXVECTOR3* D3DXVec3Minimize + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x < pV2->x ? pV1->x : pV2->x; + pOut->y = pV1->y < pV2->y ? pV1->y : pV2->y; + pOut->z = pV1->z < pV2->z ? pV1->z : pV2->z; + return pOut; +} + +D3DXINLINE D3DXVECTOR3* D3DXVec3Maximize + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2 ) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x > pV2->x ? pV1->x : pV2->x; + pOut->y = pV1->y > pV2->y ? pV1->y : pV2->y; + pOut->z = pV1->z > pV2->z ? pV1->z : pV2->z; + return pOut; +} + +D3DXINLINE D3DXVECTOR3* D3DXVec3Scale + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV, FLOAT s) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV) + return NULL; +#endif + + pOut->x = pV->x * s; + pOut->y = pV->y * s; + pOut->z = pV->z * s; + return pOut; +} + +D3DXINLINE D3DXVECTOR3* D3DXVec3Lerp + ( D3DXVECTOR3 *pOut, CONST D3DXVECTOR3 *pV1, CONST D3DXVECTOR3 *pV2, + FLOAT s ) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x + s * (pV2->x - pV1->x); + pOut->y = pV1->y + s * (pV2->y - pV1->y); + pOut->z = pV1->z + s * (pV2->z - pV1->z); + return pOut; +} + + +//-------------------------- +// 4D Vector +//-------------------------- + +D3DXINLINE FLOAT D3DXVec4Length + ( CONST D3DXVECTOR4 *pV ) +{ +#ifdef D3DX_DEBUG + if(!pV) + return 0.0f; +#endif + +#ifdef __cplusplus + return sqrtf(pV->x * pV->x + pV->y * pV->y + pV->z * pV->z + pV->w * pV->w); +#else + return (FLOAT) sqrt(pV->x * pV->x + pV->y * pV->y + pV->z * pV->z + pV->w * pV->w); +#endif +} + +D3DXINLINE FLOAT D3DXVec4LengthSq + ( CONST D3DXVECTOR4 *pV ) +{ +#ifdef D3DX_DEBUG + if(!pV) + return 0.0f; +#endif + + return pV->x * pV->x + pV->y * pV->y + pV->z * pV->z + pV->w * pV->w; +} + +D3DXINLINE FLOAT D3DXVec4Dot + ( CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2 ) +{ +#ifdef D3DX_DEBUG + if(!pV1 || !pV2) + return 0.0f; +#endif + + return pV1->x * pV2->x + pV1->y * pV2->y + pV1->z * pV2->z + pV1->w * pV2->w; +} + +D3DXINLINE D3DXVECTOR4* D3DXVec4Add + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x + pV2->x; + pOut->y = pV1->y + pV2->y; + pOut->z = pV1->z + pV2->z; + pOut->w = pV1->w + pV2->w; + return pOut; +} + +D3DXINLINE D3DXVECTOR4* D3DXVec4Subtract + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x - pV2->x; + pOut->y = pV1->y - pV2->y; + pOut->z = pV1->z - pV2->z; + pOut->w = pV1->w - pV2->w; + return pOut; +} + +D3DXINLINE D3DXVECTOR4* D3DXVec4Minimize + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x < pV2->x ? pV1->x : pV2->x; + pOut->y = pV1->y < pV2->y ? pV1->y : pV2->y; + pOut->z = pV1->z < pV2->z ? pV1->z : pV2->z; + pOut->w = pV1->w < pV2->w ? pV1->w : pV2->w; + return pOut; +} + +D3DXINLINE D3DXVECTOR4* D3DXVec4Maximize + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x > pV2->x ? pV1->x : pV2->x; + pOut->y = pV1->y > pV2->y ? pV1->y : pV2->y; + pOut->z = pV1->z > pV2->z ? pV1->z : pV2->z; + pOut->w = pV1->w > pV2->w ? pV1->w : pV2->w; + return pOut; +} + +D3DXINLINE D3DXVECTOR4* D3DXVec4Scale + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV, FLOAT s) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV) + return NULL; +#endif + + pOut->x = pV->x * s; + pOut->y = pV->y * s; + pOut->z = pV->z * s; + pOut->w = pV->w * s; + return pOut; +} + +D3DXINLINE D3DXVECTOR4* D3DXVec4Lerp + ( D3DXVECTOR4 *pOut, CONST D3DXVECTOR4 *pV1, CONST D3DXVECTOR4 *pV2, + FLOAT s ) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pV1 || !pV2) + return NULL; +#endif + + pOut->x = pV1->x + s * (pV2->x - pV1->x); + pOut->y = pV1->y + s * (pV2->y - pV1->y); + pOut->z = pV1->z + s * (pV2->z - pV1->z); + pOut->w = pV1->w + s * (pV2->w - pV1->w); + return pOut; +} + + +//-------------------------- +// 4D Matrix +//-------------------------- + +D3DXINLINE D3DXMATRIX* D3DXMatrixIdentity + ( D3DXMATRIX *pOut ) +{ +#ifdef D3DX_DEBUG + if(!pOut) + return NULL; +#endif + + pOut->m[0][1] = pOut->m[0][2] = pOut->m[0][3] = + pOut->m[1][0] = pOut->m[1][2] = pOut->m[1][3] = + pOut->m[2][0] = pOut->m[2][1] = pOut->m[2][3] = + pOut->m[3][0] = pOut->m[3][1] = pOut->m[3][2] = 0.0f; + + pOut->m[0][0] = pOut->m[1][1] = pOut->m[2][2] = pOut->m[3][3] = 1.0f; + return pOut; +} + + +D3DXINLINE BOOL D3DXMatrixIsIdentity + ( CONST D3DXMATRIX *pM ) +{ +#ifdef D3DX_DEBUG + if(!pM) + return FALSE; +#endif + + return pM->m[0][0] == 1.0f && pM->m[0][1] == 0.0f && pM->m[0][2] == 0.0f && pM->m[0][3] == 0.0f && + pM->m[1][0] == 0.0f && pM->m[1][1] == 1.0f && pM->m[1][2] == 0.0f && pM->m[1][3] == 0.0f && + pM->m[2][0] == 0.0f && pM->m[2][1] == 0.0f && pM->m[2][2] == 1.0f && pM->m[2][3] == 0.0f && + pM->m[3][0] == 0.0f && pM->m[3][1] == 0.0f && pM->m[3][2] == 0.0f && pM->m[3][3] == 1.0f; +} + + +//-------------------------- +// Quaternion +//-------------------------- + +D3DXINLINE FLOAT D3DXQuaternionLength + ( CONST D3DXQUATERNION *pQ ) +{ +#ifdef D3DX_DEBUG + if(!pQ) + return 0.0f; +#endif + +#ifdef __cplusplus + return sqrtf(pQ->x * pQ->x + pQ->y * pQ->y + pQ->z * pQ->z + pQ->w * pQ->w); +#else + return (FLOAT) sqrt(pQ->x * pQ->x + pQ->y * pQ->y + pQ->z * pQ->z + pQ->w * pQ->w); +#endif +} + +D3DXINLINE FLOAT D3DXQuaternionLengthSq + ( CONST D3DXQUATERNION *pQ ) +{ +#ifdef D3DX_DEBUG + if(!pQ) + return 0.0f; +#endif + + return pQ->x * pQ->x + pQ->y * pQ->y + pQ->z * pQ->z + pQ->w * pQ->w; +} + +D3DXINLINE FLOAT D3DXQuaternionDot + ( CONST D3DXQUATERNION *pQ1, CONST D3DXQUATERNION *pQ2 ) +{ +#ifdef D3DX_DEBUG + if(!pQ1 || !pQ2) + return 0.0f; +#endif + + return pQ1->x * pQ2->x + pQ1->y * pQ2->y + pQ1->z * pQ2->z + pQ1->w * pQ2->w; +} + + +D3DXINLINE D3DXQUATERNION* D3DXQuaternionIdentity + ( D3DXQUATERNION *pOut ) +{ +#ifdef D3DX_DEBUG + if(!pOut) + return NULL; +#endif + + pOut->x = pOut->y = pOut->z = 0.0f; + pOut->w = 1.0f; + return pOut; +} + +D3DXINLINE BOOL D3DXQuaternionIsIdentity + ( CONST D3DXQUATERNION *pQ ) +{ +#ifdef D3DX_DEBUG + if(!pQ) + return FALSE; +#endif + + return pQ->x == 0.0f && pQ->y == 0.0f && pQ->z == 0.0f && pQ->w == 1.0f; +} + + +D3DXINLINE D3DXQUATERNION* D3DXQuaternionConjugate + ( D3DXQUATERNION *pOut, CONST D3DXQUATERNION *pQ ) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pQ) + return NULL; +#endif + + pOut->x = -pQ->x; + pOut->y = -pQ->y; + pOut->z = -pQ->z; + pOut->w = pQ->w; + return pOut; +} + + +//-------------------------- +// Plane +//-------------------------- + +D3DXINLINE FLOAT D3DXPlaneDot + ( CONST D3DXPLANE *pP, CONST D3DXVECTOR4 *pV) +{ +#ifdef D3DX_DEBUG + if(!pP || !pV) + return 0.0f; +#endif + + return pP->a * pV->x + pP->b * pV->y + pP->c * pV->z + pP->d * pV->w; +} + +D3DXINLINE FLOAT D3DXPlaneDotCoord + ( CONST D3DXPLANE *pP, CONST D3DXVECTOR3 *pV) +{ +#ifdef D3DX_DEBUG + if(!pP || !pV) + return 0.0f; +#endif + + return pP->a * pV->x + pP->b * pV->y + pP->c * pV->z + pP->d; +} + +D3DXINLINE FLOAT D3DXPlaneDotNormal + ( CONST D3DXPLANE *pP, CONST D3DXVECTOR3 *pV) +{ +#ifdef D3DX_DEBUG + if(!pP || !pV) + return 0.0f; +#endif + + return pP->a * pV->x + pP->b * pV->y + pP->c * pV->z; +} + +D3DXINLINE D3DXPLANE* D3DXPlaneScale + (D3DXPLANE *pOut, CONST D3DXPLANE *pP, FLOAT s) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pP) + return NULL; +#endif + + pOut->a = pP->a * s; + pOut->b = pP->b * s; + pOut->c = pP->c * s; + pOut->d = pP->d * s; + return pOut; +} + + +//-------------------------- +// Color +//-------------------------- + +D3DXINLINE D3DXCOLOR* D3DXColorNegative + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pC) + return NULL; +#endif + + pOut->r = 1.0f - pC->r; + pOut->g = 1.0f - pC->g; + pOut->b = 1.0f - pC->b; + pOut->a = pC->a; + return pOut; +} + +D3DXINLINE D3DXCOLOR* D3DXColorAdd + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pC1 || !pC2) + return NULL; +#endif + + pOut->r = pC1->r + pC2->r; + pOut->g = pC1->g + pC2->g; + pOut->b = pC1->b + pC2->b; + pOut->a = pC1->a + pC2->a; + return pOut; +} + +D3DXINLINE D3DXCOLOR* D3DXColorSubtract + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pC1 || !pC2) + return NULL; +#endif + + pOut->r = pC1->r - pC2->r; + pOut->g = pC1->g - pC2->g; + pOut->b = pC1->b - pC2->b; + pOut->a = pC1->a - pC2->a; + return pOut; +} + +D3DXINLINE D3DXCOLOR* D3DXColorScale + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC, FLOAT s) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pC) + return NULL; +#endif + + pOut->r = pC->r * s; + pOut->g = pC->g * s; + pOut->b = pC->b * s; + pOut->a = pC->a * s; + return pOut; +} + +D3DXINLINE D3DXCOLOR* D3DXColorModulate + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pC1 || !pC2) + return NULL; +#endif + + pOut->r = pC1->r * pC2->r; + pOut->g = pC1->g * pC2->g; + pOut->b = pC1->b * pC2->b; + pOut->a = pC1->a * pC2->a; + return pOut; +} + +D3DXINLINE D3DXCOLOR* D3DXColorLerp + (D3DXCOLOR *pOut, CONST D3DXCOLOR *pC1, CONST D3DXCOLOR *pC2, FLOAT s) +{ +#ifdef D3DX_DEBUG + if(!pOut || !pC1 || !pC2) + return NULL; +#endif + + pOut->r = pC1->r + s * (pC2->r - pC1->r); + pOut->g = pC1->g + s * (pC2->g - pC1->g); + pOut->b = pC1->b + s * (pC2->b - pC1->b); + pOut->a = pC1->a + s * (pC2->a - pC1->a); + return pOut; +} + + +#endif // __D3DX9MATH_INL__ + diff --git a/MediaClient/MediaClient/directx/include/d3dx9mesh.h b/MediaClient/MediaClient/directx/include/d3dx9mesh.h new file mode 100644 index 0000000..a009d9a --- /dev/null +++ b/MediaClient/MediaClient/directx/include/d3dx9mesh.h @@ -0,0 +1,3007 @@ +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx9mesh.h +// Content: D3DX mesh types and functions +// +////////////////////////////////////////////////////////////////////////////// + +#include "d3dx9.h" + +#ifndef __D3DX9MESH_H__ +#define __D3DX9MESH_H__ + +// {7ED943DD-52E8-40b5-A8D8-76685C406330} +DEFINE_GUID(IID_ID3DXBaseMesh, +0x7ed943dd, 0x52e8, 0x40b5, 0xa8, 0xd8, 0x76, 0x68, 0x5c, 0x40, 0x63, 0x30); + +// {4020E5C2-1403-4929-883F-E2E849FAC195} +DEFINE_GUID(IID_ID3DXMesh, +0x4020e5c2, 0x1403, 0x4929, 0x88, 0x3f, 0xe2, 0xe8, 0x49, 0xfa, 0xc1, 0x95); + +// {8875769A-D579-4088-AAEB-534D1AD84E96} +DEFINE_GUID(IID_ID3DXPMesh, +0x8875769a, 0xd579, 0x4088, 0xaa, 0xeb, 0x53, 0x4d, 0x1a, 0xd8, 0x4e, 0x96); + +// {667EA4C7-F1CD-4386-B523-7C0290B83CC5} +DEFINE_GUID(IID_ID3DXSPMesh, +0x667ea4c7, 0xf1cd, 0x4386, 0xb5, 0x23, 0x7c, 0x2, 0x90, 0xb8, 0x3c, 0xc5); + +// {11EAA540-F9A6-4d49-AE6A-E19221F70CC4} +DEFINE_GUID(IID_ID3DXSkinInfo, +0x11eaa540, 0xf9a6, 0x4d49, 0xae, 0x6a, 0xe1, 0x92, 0x21, 0xf7, 0xc, 0xc4); + +// {3CE6CC22-DBF2-44f4-894D-F9C34A337139} +DEFINE_GUID(IID_ID3DXPatchMesh, +0x3ce6cc22, 0xdbf2, 0x44f4, 0x89, 0x4d, 0xf9, 0xc3, 0x4a, 0x33, 0x71, 0x39); + +//patch mesh can be quads or tris +typedef enum _D3DXPATCHMESHTYPE { + D3DXPATCHMESH_RECT = 0x001, + D3DXPATCHMESH_TRI = 0x002, + D3DXPATCHMESH_NPATCH = 0x003, + + D3DXPATCHMESH_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ +} D3DXPATCHMESHTYPE; + +// Mesh options - lower 3 bytes only, upper byte used by _D3DXMESHOPT option flags +enum _D3DXMESH { + D3DXMESH_32BIT = 0x001, // If set, then use 32 bit indices, if not set use 16 bit indices. + D3DXMESH_DONOTCLIP = 0x002, // Use D3DUSAGE_DONOTCLIP for VB & IB. + D3DXMESH_POINTS = 0x004, // Use D3DUSAGE_POINTS for VB & IB. + D3DXMESH_RTPATCHES = 0x008, // Use D3DUSAGE_RTPATCHES for VB & IB. + D3DXMESH_NPATCHES = 0x4000,// Use D3DUSAGE_NPATCHES for VB & IB. + D3DXMESH_VB_SYSTEMMEM = 0x010, // Use D3DPOOL_SYSTEMMEM for VB. Overrides D3DXMESH_MANAGEDVERTEXBUFFER + D3DXMESH_VB_MANAGED = 0x020, // Use D3DPOOL_MANAGED for VB. + D3DXMESH_VB_WRITEONLY = 0x040, // Use D3DUSAGE_WRITEONLY for VB. + D3DXMESH_VB_DYNAMIC = 0x080, // Use D3DUSAGE_DYNAMIC for VB. + D3DXMESH_VB_SOFTWAREPROCESSING = 0x8000, // Use D3DUSAGE_SOFTWAREPROCESSING for VB. + D3DXMESH_IB_SYSTEMMEM = 0x100, // Use D3DPOOL_SYSTEMMEM for IB. Overrides D3DXMESH_MANAGEDINDEXBUFFER + D3DXMESH_IB_MANAGED = 0x200, // Use D3DPOOL_MANAGED for IB. + D3DXMESH_IB_WRITEONLY = 0x400, // Use D3DUSAGE_WRITEONLY for IB. + D3DXMESH_IB_DYNAMIC = 0x800, // Use D3DUSAGE_DYNAMIC for IB. + D3DXMESH_IB_SOFTWAREPROCESSING= 0x10000, // Use D3DUSAGE_SOFTWAREPROCESSING for IB. + + D3DXMESH_VB_SHARE = 0x1000, // Valid for Clone* calls only, forces cloned mesh/pmesh to share vertex buffer + + D3DXMESH_USEHWONLY = 0x2000, // Valid for ID3DXSkinInfo::ConvertToBlendedMesh + + // Helper options + D3DXMESH_SYSTEMMEM = 0x110, // D3DXMESH_VB_SYSTEMMEM | D3DXMESH_IB_SYSTEMMEM + D3DXMESH_MANAGED = 0x220, // D3DXMESH_VB_MANAGED | D3DXMESH_IB_MANAGED + D3DXMESH_WRITEONLY = 0x440, // D3DXMESH_VB_WRITEONLY | D3DXMESH_IB_WRITEONLY + D3DXMESH_DYNAMIC = 0x880, // D3DXMESH_VB_DYNAMIC | D3DXMESH_IB_DYNAMIC + D3DXMESH_SOFTWAREPROCESSING = 0x18000, // D3DXMESH_VB_SOFTWAREPROCESSING | D3DXMESH_IB_SOFTWAREPROCESSING + +}; + +//patch mesh options +enum _D3DXPATCHMESH { + D3DXPATCHMESH_DEFAULT = 000, +}; +// option field values for specifying min value in D3DXGeneratePMesh and D3DXSimplifyMesh +enum _D3DXMESHSIMP +{ + D3DXMESHSIMP_VERTEX = 0x1, + D3DXMESHSIMP_FACE = 0x2, + +}; + +typedef enum _D3DXCLEANTYPE { + D3DXCLEAN_BACKFACING = 0x00000001, + D3DXCLEAN_BOWTIES = 0x00000002, + + // Helper options + D3DXCLEAN_SKINNING = D3DXCLEAN_BACKFACING, // Bowtie cleaning modifies geometry and breaks skinning + D3DXCLEAN_OPTIMIZATION = D3DXCLEAN_BACKFACING, + D3DXCLEAN_SIMPLIFICATION= D3DXCLEAN_BACKFACING | D3DXCLEAN_BOWTIES, +} D3DXCLEANTYPE; + +enum _MAX_FVF_DECL_SIZE +{ + MAX_FVF_DECL_SIZE = MAXD3DDECLLENGTH + 1 // +1 for END +}; + +typedef enum _D3DXTANGENT +{ + D3DXTANGENT_WRAP_U = 0x01, + D3DXTANGENT_WRAP_V = 0x02, + D3DXTANGENT_WRAP_UV = 0x03, + D3DXTANGENT_DONT_NORMALIZE_PARTIALS = 0x04, + D3DXTANGENT_DONT_ORTHOGONALIZE = 0x08, + D3DXTANGENT_ORTHOGONALIZE_FROM_V = 0x010, + D3DXTANGENT_ORTHOGONALIZE_FROM_U = 0x020, + D3DXTANGENT_WEIGHT_BY_AREA = 0x040, + D3DXTANGENT_WEIGHT_EQUAL = 0x080, + D3DXTANGENT_WIND_CW = 0x0100, + D3DXTANGENT_CALCULATE_NORMALS = 0x0200, + D3DXTANGENT_GENERATE_IN_PLACE = 0x0400, +} D3DXTANGENT; + +// D3DXIMT_WRAP_U means the texture wraps in the U direction +// D3DXIMT_WRAP_V means the texture wraps in the V direction +// D3DXIMT_WRAP_UV means the texture wraps in both directions +typedef enum _D3DXIMT +{ + D3DXIMT_WRAP_U = 0x01, + D3DXIMT_WRAP_V = 0x02, + D3DXIMT_WRAP_UV = 0x03, +} D3DXIMT; + +// These options are only valid for UVAtlasCreate and UVAtlasPartition, we may add more for UVAtlasPack if necessary +// D3DXUVATLAS_DEFAULT - Meshes with more than 25k faces go through fast, meshes with fewer than 25k faces go through quality +// D3DXUVATLAS_GEODESIC_FAST - Uses approximations to improve charting speed at the cost of added stretch or more charts. +// D3DXUVATLAS_GEODESIC_QUALITY - Provides better quality charts, but requires more time and memory than fast. +typedef enum _D3DXUVATLAS +{ + D3DXUVATLAS_DEFAULT = 0x00, + D3DXUVATLAS_GEODESIC_FAST = 0x01, + D3DXUVATLAS_GEODESIC_QUALITY = 0x02, +} D3DXUVATLAS; + +typedef struct ID3DXBaseMesh *LPD3DXBASEMESH; +typedef struct ID3DXMesh *LPD3DXMESH; +typedef struct ID3DXPMesh *LPD3DXPMESH; +typedef struct ID3DXSPMesh *LPD3DXSPMESH; +typedef struct ID3DXSkinInfo *LPD3DXSKININFO; +typedef struct ID3DXPatchMesh *LPD3DXPATCHMESH; +typedef interface ID3DXTextureGutterHelper *LPD3DXTEXTUREGUTTERHELPER; +typedef interface ID3DXPRTBuffer *LPD3DXPRTBUFFER; + + +typedef struct _D3DXATTRIBUTERANGE +{ + DWORD AttribId; + DWORD FaceStart; + DWORD FaceCount; + DWORD VertexStart; + DWORD VertexCount; +} D3DXATTRIBUTERANGE; + +typedef D3DXATTRIBUTERANGE* LPD3DXATTRIBUTERANGE; + +typedef struct _D3DXMATERIAL +{ + D3DMATERIAL9 MatD3D; + LPSTR pTextureFilename; +} D3DXMATERIAL; +typedef D3DXMATERIAL *LPD3DXMATERIAL; + +typedef enum _D3DXEFFECTDEFAULTTYPE +{ + D3DXEDT_STRING = 0x1, // pValue points to a null terminated ASCII string + D3DXEDT_FLOATS = 0x2, // pValue points to an array of floats - number of floats is NumBytes / sizeof(float) + D3DXEDT_DWORD = 0x3, // pValue points to a DWORD + + D3DXEDT_FORCEDWORD = 0x7fffffff +} D3DXEFFECTDEFAULTTYPE; + +typedef struct _D3DXEFFECTDEFAULT +{ + LPSTR pParamName; + D3DXEFFECTDEFAULTTYPE Type; // type of the data pointed to by pValue + DWORD NumBytes; // size in bytes of the data pointed to by pValue + LPVOID pValue; // data for the default of the effect +} D3DXEFFECTDEFAULT, *LPD3DXEFFECTDEFAULT; + +typedef struct _D3DXEFFECTINSTANCE +{ + LPSTR pEffectFilename; + DWORD NumDefaults; + LPD3DXEFFECTDEFAULT pDefaults; +} D3DXEFFECTINSTANCE, *LPD3DXEFFECTINSTANCE; + +typedef struct _D3DXATTRIBUTEWEIGHTS +{ + FLOAT Position; + FLOAT Boundary; + FLOAT Normal; + FLOAT Diffuse; + FLOAT Specular; + FLOAT Texcoord[8]; + FLOAT Tangent; + FLOAT Binormal; +} D3DXATTRIBUTEWEIGHTS, *LPD3DXATTRIBUTEWEIGHTS; + +enum _D3DXWELDEPSILONSFLAGS +{ + D3DXWELDEPSILONS_WELDALL = 0x1, // weld all vertices marked by adjacency as being overlapping + + D3DXWELDEPSILONS_WELDPARTIALMATCHES = 0x2, // if a given vertex component is within epsilon, modify partial matched + // vertices so that both components identical AND if all components "equal" + // remove one of the vertices + D3DXWELDEPSILONS_DONOTREMOVEVERTICES = 0x4, // instructs weld to only allow modifications to vertices and not removal + // ONLY valid if D3DXWELDEPSILONS_WELDPARTIALMATCHES is set + // useful to modify vertices to be equal, but not allow vertices to be removed + + D3DXWELDEPSILONS_DONOTSPLIT = 0x8, // instructs weld to specify the D3DXMESHOPT_DONOTSPLIT flag when doing an Optimize(ATTR_SORT) + // if this flag is not set, all vertices that are in separate attribute groups + // will remain split and not welded. Setting this flag can slow down software vertex processing + +}; + +typedef struct _D3DXWELDEPSILONS +{ + FLOAT Position; // NOTE: This does NOT replace the epsilon in GenerateAdjacency + // in general, it should be the same value or greater than the one passed to GeneratedAdjacency + FLOAT BlendWeights; + FLOAT Normal; + FLOAT PSize; + FLOAT Specular; + FLOAT Diffuse; + FLOAT Texcoord[8]; + FLOAT Tangent; + FLOAT Binormal; + FLOAT TessFactor; +} D3DXWELDEPSILONS; + +typedef D3DXWELDEPSILONS* LPD3DXWELDEPSILONS; + + +#undef INTERFACE +#define INTERFACE ID3DXBaseMesh + +DECLARE_INTERFACE_(ID3DXBaseMesh, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DXBaseMesh + STDMETHOD(DrawSubset)(THIS_ DWORD AttribId) PURE; + STDMETHOD_(DWORD, GetNumFaces)(THIS) PURE; + STDMETHOD_(DWORD, GetNumVertices)(THIS) PURE; + STDMETHOD_(DWORD, GetFVF)(THIS) PURE; + STDMETHOD(GetDeclaration)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE; + STDMETHOD_(DWORD, GetNumBytesPerVertex)(THIS) PURE; + STDMETHOD_(DWORD, GetOptions)(THIS) PURE; + STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE; + STDMETHOD(CloneMeshFVF)(THIS_ DWORD Options, + DWORD FVF, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXMESH* ppCloneMesh) PURE; + STDMETHOD(CloneMesh)(THIS_ DWORD Options, + CONST D3DVERTEXELEMENT9 *pDeclaration, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXMESH* ppCloneMesh) PURE; + STDMETHOD(GetVertexBuffer)(THIS_ LPDIRECT3DVERTEXBUFFER9* ppVB) PURE; + STDMETHOD(GetIndexBuffer)(THIS_ LPDIRECT3DINDEXBUFFER9* ppIB) PURE; + STDMETHOD(LockVertexBuffer)(THIS_ DWORD Flags, LPVOID *ppData) PURE; + STDMETHOD(UnlockVertexBuffer)(THIS) PURE; + STDMETHOD(LockIndexBuffer)(THIS_ DWORD Flags, LPVOID *ppData) PURE; + STDMETHOD(UnlockIndexBuffer)(THIS) PURE; + STDMETHOD(GetAttributeTable)( + THIS_ D3DXATTRIBUTERANGE *pAttribTable, DWORD* pAttribTableSize) PURE; + + STDMETHOD(ConvertPointRepsToAdjacency)(THIS_ CONST DWORD* pPRep, DWORD* pAdjacency) PURE; + STDMETHOD(ConvertAdjacencyToPointReps)(THIS_ CONST DWORD* pAdjacency, DWORD* pPRep) PURE; + STDMETHOD(GenerateAdjacency)(THIS_ FLOAT Epsilon, DWORD* pAdjacency) PURE; + + STDMETHOD(UpdateSemantics)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE; +}; + + +#undef INTERFACE +#define INTERFACE ID3DXMesh + +DECLARE_INTERFACE_(ID3DXMesh, ID3DXBaseMesh) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DXBaseMesh + STDMETHOD(DrawSubset)(THIS_ DWORD AttribId) PURE; + STDMETHOD_(DWORD, GetNumFaces)(THIS) PURE; + STDMETHOD_(DWORD, GetNumVertices)(THIS) PURE; + STDMETHOD_(DWORD, GetFVF)(THIS) PURE; + STDMETHOD(GetDeclaration)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE; + STDMETHOD_(DWORD, GetNumBytesPerVertex)(THIS) PURE; + STDMETHOD_(DWORD, GetOptions)(THIS) PURE; + STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE; + STDMETHOD(CloneMeshFVF)(THIS_ DWORD Options, + DWORD FVF, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXMESH* ppCloneMesh) PURE; + STDMETHOD(CloneMesh)(THIS_ DWORD Options, + CONST D3DVERTEXELEMENT9 *pDeclaration, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXMESH* ppCloneMesh) PURE; + STDMETHOD(GetVertexBuffer)(THIS_ LPDIRECT3DVERTEXBUFFER9* ppVB) PURE; + STDMETHOD(GetIndexBuffer)(THIS_ LPDIRECT3DINDEXBUFFER9* ppIB) PURE; + STDMETHOD(LockVertexBuffer)(THIS_ DWORD Flags, LPVOID *ppData) PURE; + STDMETHOD(UnlockVertexBuffer)(THIS) PURE; + STDMETHOD(LockIndexBuffer)(THIS_ DWORD Flags, LPVOID *ppData) PURE; + STDMETHOD(UnlockIndexBuffer)(THIS) PURE; + STDMETHOD(GetAttributeTable)( + THIS_ D3DXATTRIBUTERANGE *pAttribTable, DWORD* pAttribTableSize) PURE; + + STDMETHOD(ConvertPointRepsToAdjacency)(THIS_ CONST DWORD* pPRep, DWORD* pAdjacency) PURE; + STDMETHOD(ConvertAdjacencyToPointReps)(THIS_ CONST DWORD* pAdjacency, DWORD* pPRep) PURE; + STDMETHOD(GenerateAdjacency)(THIS_ FLOAT Epsilon, DWORD* pAdjacency) PURE; + + STDMETHOD(UpdateSemantics)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE; + + // ID3DXMesh + STDMETHOD(LockAttributeBuffer)(THIS_ DWORD Flags, DWORD** ppData) PURE; + STDMETHOD(UnlockAttributeBuffer)(THIS) PURE; + STDMETHOD(Optimize)(THIS_ DWORD Flags, CONST DWORD* pAdjacencyIn, DWORD* pAdjacencyOut, + DWORD* pFaceRemap, LPD3DXBUFFER *ppVertexRemap, + LPD3DXMESH* ppOptMesh) PURE; + STDMETHOD(OptimizeInplace)(THIS_ DWORD Flags, CONST DWORD* pAdjacencyIn, DWORD* pAdjacencyOut, + DWORD* pFaceRemap, LPD3DXBUFFER *ppVertexRemap) PURE; + STDMETHOD(SetAttributeTable)(THIS_ CONST D3DXATTRIBUTERANGE *pAttribTable, DWORD cAttribTableSize) PURE; +}; + + +#undef INTERFACE +#define INTERFACE ID3DXPMesh + +DECLARE_INTERFACE_(ID3DXPMesh, ID3DXBaseMesh) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DXBaseMesh + STDMETHOD(DrawSubset)(THIS_ DWORD AttribId) PURE; + STDMETHOD_(DWORD, GetNumFaces)(THIS) PURE; + STDMETHOD_(DWORD, GetNumVertices)(THIS) PURE; + STDMETHOD_(DWORD, GetFVF)(THIS) PURE; + STDMETHOD(GetDeclaration)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE; + STDMETHOD_(DWORD, GetNumBytesPerVertex)(THIS) PURE; + STDMETHOD_(DWORD, GetOptions)(THIS) PURE; + STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE; + STDMETHOD(CloneMeshFVF)(THIS_ DWORD Options, + DWORD FVF, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXMESH* ppCloneMesh) PURE; + STDMETHOD(CloneMesh)(THIS_ DWORD Options, + CONST D3DVERTEXELEMENT9 *pDeclaration, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXMESH* ppCloneMesh) PURE; + STDMETHOD(GetVertexBuffer)(THIS_ LPDIRECT3DVERTEXBUFFER9* ppVB) PURE; + STDMETHOD(GetIndexBuffer)(THIS_ LPDIRECT3DINDEXBUFFER9* ppIB) PURE; + STDMETHOD(LockVertexBuffer)(THIS_ DWORD Flags, LPVOID *ppData) PURE; + STDMETHOD(UnlockVertexBuffer)(THIS) PURE; + STDMETHOD(LockIndexBuffer)(THIS_ DWORD Flags, LPVOID *ppData) PURE; + STDMETHOD(UnlockIndexBuffer)(THIS) PURE; + STDMETHOD(GetAttributeTable)( + THIS_ D3DXATTRIBUTERANGE *pAttribTable, DWORD* pAttribTableSize) PURE; + + STDMETHOD(ConvertPointRepsToAdjacency)(THIS_ CONST DWORD* pPRep, DWORD* pAdjacency) PURE; + STDMETHOD(ConvertAdjacencyToPointReps)(THIS_ CONST DWORD* pAdjacency, DWORD* pPRep) PURE; + STDMETHOD(GenerateAdjacency)(THIS_ FLOAT Epsilon, DWORD* pAdjacency) PURE; + + STDMETHOD(UpdateSemantics)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE; + + // ID3DXPMesh + STDMETHOD(ClonePMeshFVF)(THIS_ DWORD Options, + DWORD FVF, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXPMESH* ppCloneMesh) PURE; + STDMETHOD(ClonePMesh)(THIS_ DWORD Options, + CONST D3DVERTEXELEMENT9 *pDeclaration, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXPMESH* ppCloneMesh) PURE; + STDMETHOD(SetNumFaces)(THIS_ DWORD Faces) PURE; + STDMETHOD(SetNumVertices)(THIS_ DWORD Vertices) PURE; + STDMETHOD_(DWORD, GetMaxFaces)(THIS) PURE; + STDMETHOD_(DWORD, GetMinFaces)(THIS) PURE; + STDMETHOD_(DWORD, GetMaxVertices)(THIS) PURE; + STDMETHOD_(DWORD, GetMinVertices)(THIS) PURE; + STDMETHOD(Save)(THIS_ IStream *pStream, CONST D3DXMATERIAL* pMaterials, CONST D3DXEFFECTINSTANCE* pEffectInstances, DWORD NumMaterials) PURE; + + STDMETHOD(Optimize)(THIS_ DWORD Flags, DWORD* pAdjacencyOut, + DWORD* pFaceRemap, LPD3DXBUFFER *ppVertexRemap, + LPD3DXMESH* ppOptMesh) PURE; + + STDMETHOD(OptimizeBaseLOD)(THIS_ DWORD Flags, DWORD* pFaceRemap) PURE; + STDMETHOD(TrimByFaces)(THIS_ DWORD NewFacesMin, DWORD NewFacesMax, DWORD *rgiFaceRemap, DWORD *rgiVertRemap) PURE; + STDMETHOD(TrimByVertices)(THIS_ DWORD NewVerticesMin, DWORD NewVerticesMax, DWORD *rgiFaceRemap, DWORD *rgiVertRemap) PURE; + + STDMETHOD(GetAdjacency)(THIS_ DWORD* pAdjacency) PURE; + + // Used to generate the immediate "ancestor" for each vertex when it is removed by a vsplit. Allows generation of geomorphs + // Vertex buffer must be equal to or greater than the maximum number of vertices in the pmesh + STDMETHOD(GenerateVertexHistory)(THIS_ DWORD* pVertexHistory) PURE; +}; + + +#undef INTERFACE +#define INTERFACE ID3DXSPMesh + +DECLARE_INTERFACE_(ID3DXSPMesh, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DXSPMesh + STDMETHOD_(DWORD, GetNumFaces)(THIS) PURE; + STDMETHOD_(DWORD, GetNumVertices)(THIS) PURE; + STDMETHOD_(DWORD, GetFVF)(THIS) PURE; + STDMETHOD(GetDeclaration)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE; + STDMETHOD_(DWORD, GetOptions)(THIS) PURE; + STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE; + STDMETHOD(CloneMeshFVF)(THIS_ DWORD Options, + DWORD FVF, LPDIRECT3DDEVICE9 pD3DDevice, DWORD *pAdjacencyOut, DWORD *pVertexRemapOut, LPD3DXMESH* ppCloneMesh) PURE; + STDMETHOD(CloneMesh)(THIS_ DWORD Options, + CONST D3DVERTEXELEMENT9 *pDeclaration, LPDIRECT3DDEVICE9 pD3DDevice, DWORD *pAdjacencyOut, DWORD *pVertexRemapOut, LPD3DXMESH* ppCloneMesh) PURE; + STDMETHOD(ClonePMeshFVF)(THIS_ DWORD Options, + DWORD FVF, LPDIRECT3DDEVICE9 pD3DDevice, DWORD *pVertexRemapOut, FLOAT *pErrorsByFace, LPD3DXPMESH* ppCloneMesh) PURE; + STDMETHOD(ClonePMesh)(THIS_ DWORD Options, + CONST D3DVERTEXELEMENT9 *pDeclaration, LPDIRECT3DDEVICE9 pD3DDevice, DWORD *pVertexRemapOut, FLOAT *pErrorsbyFace, LPD3DXPMESH* ppCloneMesh) PURE; + STDMETHOD(ReduceFaces)(THIS_ DWORD Faces) PURE; + STDMETHOD(ReduceVertices)(THIS_ DWORD Vertices) PURE; + STDMETHOD_(DWORD, GetMaxFaces)(THIS) PURE; + STDMETHOD_(DWORD, GetMaxVertices)(THIS) PURE; + STDMETHOD(GetVertexAttributeWeights)(THIS_ LPD3DXATTRIBUTEWEIGHTS pVertexAttributeWeights) PURE; + STDMETHOD(GetVertexWeights)(THIS_ FLOAT *pVertexWeights) PURE; +}; + +#define UNUSED16 (0xffff) +#define UNUSED32 (0xffffffff) + +// ID3DXMesh::Optimize options - upper byte only, lower 3 bytes used from _D3DXMESH option flags +enum _D3DXMESHOPT { + D3DXMESHOPT_COMPACT = 0x01000000, + D3DXMESHOPT_ATTRSORT = 0x02000000, + D3DXMESHOPT_VERTEXCACHE = 0x04000000, + D3DXMESHOPT_STRIPREORDER = 0x08000000, + D3DXMESHOPT_IGNOREVERTS = 0x10000000, // optimize faces only, don't touch vertices + D3DXMESHOPT_DONOTSPLIT = 0x20000000, // do not split vertices shared between attribute groups when attribute sorting + D3DXMESHOPT_DEVICEINDEPENDENT = 0x00400000, // Only affects VCache. uses a static known good cache size for all cards + + // D3DXMESHOPT_SHAREVB has been removed, please use D3DXMESH_VB_SHARE instead + +}; + +// Subset of the mesh that has the same attribute and bone combination. +// This subset can be rendered in a single draw call +typedef struct _D3DXBONECOMBINATION +{ + DWORD AttribId; + DWORD FaceStart; + DWORD FaceCount; + DWORD VertexStart; + DWORD VertexCount; + DWORD* BoneId; +} D3DXBONECOMBINATION, *LPD3DXBONECOMBINATION; + +// The following types of patch combinations are supported: +// Patch type Basis Degree +// Rect Bezier 2,3,5 +// Rect B-Spline 2,3,5 +// Rect Catmull-Rom 3 +// Tri Bezier 2,3,5 +// N-Patch N/A 3 + +typedef struct _D3DXPATCHINFO +{ + D3DXPATCHMESHTYPE PatchType; + D3DDEGREETYPE Degree; + D3DBASISTYPE Basis; +} D3DXPATCHINFO, *LPD3DXPATCHINFO; + +#undef INTERFACE +#define INTERFACE ID3DXPatchMesh + +DECLARE_INTERFACE_(ID3DXPatchMesh, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DXPatchMesh + + // Return creation parameters + STDMETHOD_(DWORD, GetNumPatches)(THIS) PURE; + STDMETHOD_(DWORD, GetNumVertices)(THIS) PURE; + STDMETHOD(GetDeclaration)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE; + STDMETHOD_(DWORD, GetControlVerticesPerPatch)(THIS) PURE; + STDMETHOD_(DWORD, GetOptions)(THIS) PURE; + STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9 *ppDevice) PURE; + STDMETHOD(GetPatchInfo)(THIS_ LPD3DXPATCHINFO PatchInfo) PURE; + + // Control mesh access + STDMETHOD(GetVertexBuffer)(THIS_ LPDIRECT3DVERTEXBUFFER9* ppVB) PURE; + STDMETHOD(GetIndexBuffer)(THIS_ LPDIRECT3DINDEXBUFFER9* ppIB) PURE; + STDMETHOD(LockVertexBuffer)(THIS_ DWORD flags, LPVOID *ppData) PURE; + STDMETHOD(UnlockVertexBuffer)(THIS) PURE; + STDMETHOD(LockIndexBuffer)(THIS_ DWORD flags, LPVOID *ppData) PURE; + STDMETHOD(UnlockIndexBuffer)(THIS) PURE; + STDMETHOD(LockAttributeBuffer)(THIS_ DWORD flags, DWORD** ppData) PURE; + STDMETHOD(UnlockAttributeBuffer)(THIS) PURE; + + // This function returns the size of the tessellated mesh given a tessellation level. + // This assumes uniform tessellation. For adaptive tessellation the Adaptive parameter must + // be set to TRUE and TessellationLevel should be the max tessellation. + // This will result in the max mesh size necessary for adaptive tessellation. + STDMETHOD(GetTessSize)(THIS_ FLOAT fTessLevel,DWORD Adaptive, DWORD *NumTriangles,DWORD *NumVertices) PURE; + + //GenerateAdjacency determines which patches are adjacent with provided tolerance + //this information is used internally to optimize tessellation + STDMETHOD(GenerateAdjacency)(THIS_ FLOAT Tolerance) PURE; + + //CloneMesh Creates a new patchmesh with the specified decl, and converts the vertex buffer + //to the new decl. Entries in the new decl which are new are set to 0. If the current mesh + //has adjacency, the new mesh will also have adjacency + STDMETHOD(CloneMesh)(THIS_ DWORD Options, CONST D3DVERTEXELEMENT9 *pDecl, LPD3DXPATCHMESH *pMesh) PURE; + + // Optimizes the patchmesh for efficient tessellation. This function is designed + // to perform one time optimization for patch meshes that need to be tessellated + // repeatedly by calling the Tessellate() method. The optimization performed is + // independent of the actual tessellation level used. + // Currently Flags is unused. + // If vertices are changed, Optimize must be called again + STDMETHOD(Optimize)(THIS_ DWORD flags) PURE; + + //gets and sets displacement parameters + //displacement maps can only be 2D textures MIP-MAPPING is ignored for non adapative tessellation + STDMETHOD(SetDisplaceParam)(THIS_ LPDIRECT3DBASETEXTURE9 Texture, + D3DTEXTUREFILTERTYPE MinFilter, + D3DTEXTUREFILTERTYPE MagFilter, + D3DTEXTUREFILTERTYPE MipFilter, + D3DTEXTUREADDRESS Wrap, + DWORD dwLODBias) PURE; + + STDMETHOD(GetDisplaceParam)(THIS_ LPDIRECT3DBASETEXTURE9 *Texture, + D3DTEXTUREFILTERTYPE *MinFilter, + D3DTEXTUREFILTERTYPE *MagFilter, + D3DTEXTUREFILTERTYPE *MipFilter, + D3DTEXTUREADDRESS *Wrap, + DWORD *dwLODBias) PURE; + + // Performs the uniform tessellation based on the tessellation level. + // This function will perform more efficiently if the patch mesh has been optimized using the Optimize() call. + STDMETHOD(Tessellate)(THIS_ FLOAT fTessLevel,LPD3DXMESH pMesh) PURE; + + // Performs adaptive tessellation based on the Z based adaptive tessellation criterion. + // pTrans specifies a 4D vector that is dotted with the vertices to get the per vertex + // adaptive tessellation amount. Each edge is tessellated to the average of the criterion + // at the 2 vertices it connects. + // MaxTessLevel specifies the upper limit for adaptive tesselation. + // This function will perform more efficiently if the patch mesh has been optimized using the Optimize() call. + STDMETHOD(TessellateAdaptive)(THIS_ + CONST D3DXVECTOR4 *pTrans, + DWORD dwMaxTessLevel, + DWORD dwMinTessLevel, + LPD3DXMESH pMesh) PURE; + +}; + +#undef INTERFACE +#define INTERFACE ID3DXSkinInfo + +DECLARE_INTERFACE_(ID3DXSkinInfo, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // Specify the which vertices do each bones influence and by how much + STDMETHOD(SetBoneInfluence)(THIS_ DWORD bone, DWORD numInfluences, CONST DWORD* vertices, CONST FLOAT* weights) PURE; + STDMETHOD(SetBoneVertexInfluence)(THIS_ DWORD boneNum, DWORD influenceNum, float weight) PURE; + STDMETHOD_(DWORD, GetNumBoneInfluences)(THIS_ DWORD bone) PURE; + STDMETHOD(GetBoneInfluence)(THIS_ DWORD bone, DWORD* vertices, FLOAT* weights) PURE; + STDMETHOD(GetBoneVertexInfluence)(THIS_ DWORD boneNum, DWORD influenceNum, float *pWeight, DWORD *pVertexNum) PURE; + STDMETHOD(GetMaxVertexInfluences)(THIS_ DWORD* maxVertexInfluences) PURE; + STDMETHOD_(DWORD, GetNumBones)(THIS) PURE; + STDMETHOD(FindBoneVertexInfluenceIndex)(THIS_ DWORD boneNum, DWORD vertexNum, DWORD *pInfluenceIndex) PURE; + + // This gets the max face influences based on a triangle mesh with the specified index buffer + STDMETHOD(GetMaxFaceInfluences)(THIS_ LPDIRECT3DINDEXBUFFER9 pIB, DWORD NumFaces, DWORD* maxFaceInfluences) PURE; + + // Set min bone influence. Bone influences that are smaller than this are ignored + STDMETHOD(SetMinBoneInfluence)(THIS_ FLOAT MinInfl) PURE; + // Get min bone influence. + STDMETHOD_(FLOAT, GetMinBoneInfluence)(THIS) PURE; + + // Bone names are returned by D3DXLoadSkinMeshFromXof. They are not used by any other method of this object + STDMETHOD(SetBoneName)(THIS_ DWORD Bone, LPCSTR pName) PURE; // pName is copied to an internal string buffer + STDMETHOD_(LPCSTR, GetBoneName)(THIS_ DWORD Bone) PURE; // A pointer to an internal string buffer is returned. Do not free this. + + // Bone offset matrices are returned by D3DXLoadSkinMeshFromXof. They are not used by any other method of this object + STDMETHOD(SetBoneOffsetMatrix)(THIS_ DWORD Bone, CONST D3DXMATRIX *pBoneTransform) PURE; // pBoneTransform is copied to an internal buffer + STDMETHOD_(LPD3DXMATRIX, GetBoneOffsetMatrix)(THIS_ DWORD Bone) PURE; // A pointer to an internal matrix is returned. Do not free this. + + // Clone a skin info object + STDMETHOD(Clone)(THIS_ LPD3DXSKININFO* ppSkinInfo) PURE; + + // Update bone influence information to match vertices after they are reordered. This should be called + // if the target vertex buffer has been reordered externally. + STDMETHOD(Remap)(THIS_ DWORD NumVertices, DWORD* pVertexRemap) PURE; + + // These methods enable the modification of the vertex layout of the vertices that will be skinned + STDMETHOD(SetFVF)(THIS_ DWORD FVF) PURE; + STDMETHOD(SetDeclaration)(THIS_ CONST D3DVERTEXELEMENT9 *pDeclaration) PURE; + STDMETHOD_(DWORD, GetFVF)(THIS) PURE; + STDMETHOD(GetDeclaration)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE; + + // Apply SW skinning based on current pose matrices to the target vertices. + STDMETHOD(UpdateSkinnedMesh)(THIS_ + CONST D3DXMATRIX* pBoneTransforms, + CONST D3DXMATRIX* pBoneInvTransposeTransforms, + LPCVOID pVerticesSrc, + PVOID pVerticesDst) PURE; + + // Takes a mesh and returns a new mesh with per vertex blend weights and a bone combination + // table that describes which bones affect which subsets of the mesh + STDMETHOD(ConvertToBlendedMesh)(THIS_ + LPD3DXMESH pMesh, + DWORD Options, + CONST DWORD *pAdjacencyIn, + LPDWORD pAdjacencyOut, + DWORD* pFaceRemap, + LPD3DXBUFFER *ppVertexRemap, + DWORD* pMaxFaceInfl, + DWORD* pNumBoneCombinations, + LPD3DXBUFFER* ppBoneCombinationTable, + LPD3DXMESH* ppMesh) PURE; + + // Takes a mesh and returns a new mesh with per vertex blend weights and indices + // and a bone combination table that describes which bones palettes affect which subsets of the mesh + STDMETHOD(ConvertToIndexedBlendedMesh)(THIS_ + LPD3DXMESH pMesh, + DWORD Options, + DWORD paletteSize, + CONST DWORD *pAdjacencyIn, + LPDWORD pAdjacencyOut, + DWORD* pFaceRemap, + LPD3DXBUFFER *ppVertexRemap, + DWORD* pMaxVertexInfl, + DWORD* pNumBoneCombinations, + LPD3DXBUFFER* ppBoneCombinationTable, + LPD3DXMESH* ppMesh) PURE; +}; + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + + +HRESULT WINAPI + D3DXCreateMesh( + DWORD NumFaces, + DWORD NumVertices, + DWORD Options, + CONST D3DVERTEXELEMENT9 *pDeclaration, + LPDIRECT3DDEVICE9 pD3DDevice, + LPD3DXMESH* ppMesh); + +HRESULT WINAPI + D3DXCreateMeshFVF( + DWORD NumFaces, + DWORD NumVertices, + DWORD Options, + DWORD FVF, + LPDIRECT3DDEVICE9 pD3DDevice, + LPD3DXMESH* ppMesh); + +HRESULT WINAPI + D3DXCreateSPMesh( + LPD3DXMESH pMesh, + CONST DWORD* pAdjacency, + CONST D3DXATTRIBUTEWEIGHTS *pVertexAttributeWeights, + CONST FLOAT *pVertexWeights, + LPD3DXSPMESH* ppSMesh); + +// clean a mesh up for simplification, try to make manifold +HRESULT WINAPI + D3DXCleanMesh( + D3DXCLEANTYPE CleanType, + LPD3DXMESH pMeshIn, + CONST DWORD* pAdjacencyIn, + LPD3DXMESH* ppMeshOut, + DWORD* pAdjacencyOut, + LPD3DXBUFFER* ppErrorsAndWarnings); + +HRESULT WINAPI + D3DXValidMesh( + LPD3DXMESH pMeshIn, + CONST DWORD* pAdjacency, + LPD3DXBUFFER* ppErrorsAndWarnings); + +HRESULT WINAPI + D3DXGeneratePMesh( + LPD3DXMESH pMesh, + CONST DWORD* pAdjacency, + CONST D3DXATTRIBUTEWEIGHTS *pVertexAttributeWeights, + CONST FLOAT *pVertexWeights, + DWORD MinValue, + DWORD Options, + LPD3DXPMESH* ppPMesh); + +HRESULT WINAPI + D3DXSimplifyMesh( + LPD3DXMESH pMesh, + CONST DWORD* pAdjacency, + CONST D3DXATTRIBUTEWEIGHTS *pVertexAttributeWeights, + CONST FLOAT *pVertexWeights, + DWORD MinValue, + DWORD Options, + LPD3DXMESH* ppMesh); + +HRESULT WINAPI + D3DXComputeBoundingSphere( + CONST D3DXVECTOR3 *pFirstPosition, // pointer to first position + DWORD NumVertices, + DWORD dwStride, // count in bytes to subsequent position vectors + D3DXVECTOR3 *pCenter, + FLOAT *pRadius); + +HRESULT WINAPI + D3DXComputeBoundingBox( + CONST D3DXVECTOR3 *pFirstPosition, // pointer to first position + DWORD NumVertices, + DWORD dwStride, // count in bytes to subsequent position vectors + D3DXVECTOR3 *pMin, + D3DXVECTOR3 *pMax); + +HRESULT WINAPI + D3DXComputeNormals( + LPD3DXBASEMESH pMesh, + CONST DWORD *pAdjacency); + +HRESULT WINAPI + D3DXCreateBuffer( + DWORD NumBytes, + LPD3DXBUFFER *ppBuffer); + + +HRESULT WINAPI + D3DXLoadMeshFromXA( + LPCSTR pFilename, + DWORD Options, + LPDIRECT3DDEVICE9 pD3DDevice, + LPD3DXBUFFER *ppAdjacency, + LPD3DXBUFFER *ppMaterials, + LPD3DXBUFFER *ppEffectInstances, + DWORD *pNumMaterials, + LPD3DXMESH *ppMesh); + +HRESULT WINAPI + D3DXLoadMeshFromXW( + LPCWSTR pFilename, + DWORD Options, + LPDIRECT3DDEVICE9 pD3DDevice, + LPD3DXBUFFER *ppAdjacency, + LPD3DXBUFFER *ppMaterials, + LPD3DXBUFFER *ppEffectInstances, + DWORD *pNumMaterials, + LPD3DXMESH *ppMesh); + +#ifdef UNICODE +#define D3DXLoadMeshFromX D3DXLoadMeshFromXW +#else +#define D3DXLoadMeshFromX D3DXLoadMeshFromXA +#endif + +HRESULT WINAPI + D3DXLoadMeshFromXInMemory( + LPCVOID Memory, + DWORD SizeOfMemory, + DWORD Options, + LPDIRECT3DDEVICE9 pD3DDevice, + LPD3DXBUFFER *ppAdjacency, + LPD3DXBUFFER *ppMaterials, + LPD3DXBUFFER *ppEffectInstances, + DWORD *pNumMaterials, + LPD3DXMESH *ppMesh); + +HRESULT WINAPI + D3DXLoadMeshFromXResource( + HMODULE Module, + LPCSTR Name, + LPCSTR Type, + DWORD Options, + LPDIRECT3DDEVICE9 pD3DDevice, + LPD3DXBUFFER *ppAdjacency, + LPD3DXBUFFER *ppMaterials, + LPD3DXBUFFER *ppEffectInstances, + DWORD *pNumMaterials, + LPD3DXMESH *ppMesh); + +HRESULT WINAPI + D3DXSaveMeshToXA( + LPCSTR pFilename, + LPD3DXMESH pMesh, + CONST DWORD* pAdjacency, + CONST D3DXMATERIAL* pMaterials, + CONST D3DXEFFECTINSTANCE* pEffectInstances, + DWORD NumMaterials, + DWORD Format + ); + +HRESULT WINAPI + D3DXSaveMeshToXW( + LPCWSTR pFilename, + LPD3DXMESH pMesh, + CONST DWORD* pAdjacency, + CONST D3DXMATERIAL* pMaterials, + CONST D3DXEFFECTINSTANCE* pEffectInstances, + DWORD NumMaterials, + DWORD Format + ); + +#ifdef UNICODE +#define D3DXSaveMeshToX D3DXSaveMeshToXW +#else +#define D3DXSaveMeshToX D3DXSaveMeshToXA +#endif + + +HRESULT WINAPI + D3DXCreatePMeshFromStream( + IStream *pStream, + DWORD Options, + LPDIRECT3DDEVICE9 pD3DDevice, + LPD3DXBUFFER *ppMaterials, + LPD3DXBUFFER *ppEffectInstances, + DWORD* pNumMaterials, + LPD3DXPMESH *ppPMesh); + +// Creates a skin info object based on the number of vertices, number of bones, and a declaration describing the vertex layout of the target vertices +// The bone names and initial bone transforms are not filled in the skin info object by this method. +HRESULT WINAPI + D3DXCreateSkinInfo( + DWORD NumVertices, + CONST D3DVERTEXELEMENT9 *pDeclaration, + DWORD NumBones, + LPD3DXSKININFO* ppSkinInfo); + +// Creates a skin info object based on the number of vertices, number of bones, and a FVF describing the vertex layout of the target vertices +// The bone names and initial bone transforms are not filled in the skin info object by this method. +HRESULT WINAPI + D3DXCreateSkinInfoFVF( + DWORD NumVertices, + DWORD FVF, + DWORD NumBones, + LPD3DXSKININFO* ppSkinInfo); + +#ifdef __cplusplus +} + +extern "C" { +#endif //__cplusplus + +HRESULT WINAPI + D3DXLoadMeshFromXof( + LPD3DXFILEDATA pxofMesh, + DWORD Options, + LPDIRECT3DDEVICE9 pD3DDevice, + LPD3DXBUFFER *ppAdjacency, + LPD3DXBUFFER *ppMaterials, + LPD3DXBUFFER *ppEffectInstances, + DWORD *pNumMaterials, + LPD3DXMESH *ppMesh); + +// This similar to D3DXLoadMeshFromXof, except also returns skinning info if present in the file +// If skinning info is not present, ppSkinInfo will be NULL +HRESULT WINAPI + D3DXLoadSkinMeshFromXof( + LPD3DXFILEDATA pxofMesh, + DWORD Options, + LPDIRECT3DDEVICE9 pD3DDevice, + LPD3DXBUFFER* ppAdjacency, + LPD3DXBUFFER* ppMaterials, + LPD3DXBUFFER *ppEffectInstances, + DWORD *pMatOut, + LPD3DXSKININFO* ppSkinInfo, + LPD3DXMESH* ppMesh); + + +// The inverse of D3DXConvertTo{Indexed}BlendedMesh() functions. It figures out the skinning info from +// the mesh and the bone combination table and populates a skin info object with that data. The bone +// names and initial bone transforms are not filled in the skin info object by this method. This works +// with either a non-indexed or indexed blended mesh. It examines the FVF or declarator of the mesh to +// determine what type it is. +HRESULT WINAPI + D3DXCreateSkinInfoFromBlendedMesh( + LPD3DXBASEMESH pMesh, + DWORD NumBones, + CONST D3DXBONECOMBINATION *pBoneCombinationTable, + LPD3DXSKININFO* ppSkinInfo); + +HRESULT WINAPI + D3DXTessellateNPatches( + LPD3DXMESH pMeshIn, + CONST DWORD* pAdjacencyIn, + FLOAT NumSegs, + BOOL QuadraticInterpNormals, // if false use linear intrep for normals, if true use quadratic + LPD3DXMESH *ppMeshOut, + LPD3DXBUFFER *ppAdjacencyOut); + + +//generates implied outputdecl from input decl +//the decl generated from this should be used to generate the output decl for +//the tessellator subroutines. + +HRESULT WINAPI + D3DXGenerateOutputDecl( + D3DVERTEXELEMENT9 *pOutput, + CONST D3DVERTEXELEMENT9 *pInput); + +//loads patches from an XFileData +//since an X file can have up to 6 different patch meshes in it, +//returns them in an array - pNumPatches will contain the number of +//meshes in the actual file. +HRESULT WINAPI + D3DXLoadPatchMeshFromXof( + LPD3DXFILEDATA pXofObjMesh, + DWORD Options, + LPDIRECT3DDEVICE9 pD3DDevice, + LPD3DXBUFFER *ppMaterials, + LPD3DXBUFFER *ppEffectInstances, + PDWORD pNumMaterials, + LPD3DXPATCHMESH *ppMesh); + +//computes the size a single rect patch. +HRESULT WINAPI + D3DXRectPatchSize( + CONST FLOAT *pfNumSegs, //segments for each edge (4) + DWORD *pdwTriangles, //output number of triangles + DWORD *pdwVertices); //output number of vertices + +//computes the size of a single triangle patch +HRESULT WINAPI + D3DXTriPatchSize( + CONST FLOAT *pfNumSegs, //segments for each edge (3) + DWORD *pdwTriangles, //output number of triangles + DWORD *pdwVertices); //output number of vertices + + +//tessellates a patch into a created mesh +//similar to D3D RT patch +HRESULT WINAPI + D3DXTessellateRectPatch( + LPDIRECT3DVERTEXBUFFER9 pVB, + CONST FLOAT *pNumSegs, + CONST D3DVERTEXELEMENT9 *pdwInDecl, + CONST D3DRECTPATCH_INFO *pRectPatchInfo, + LPD3DXMESH pMesh); + + +HRESULT WINAPI + D3DXTessellateTriPatch( + LPDIRECT3DVERTEXBUFFER9 pVB, + CONST FLOAT *pNumSegs, + CONST D3DVERTEXELEMENT9 *pInDecl, + CONST D3DTRIPATCH_INFO *pTriPatchInfo, + LPD3DXMESH pMesh); + + + +//creates an NPatch PatchMesh from a D3DXMESH +HRESULT WINAPI + D3DXCreateNPatchMesh( + LPD3DXMESH pMeshSysMem, + LPD3DXPATCHMESH *pPatchMesh); + + +//creates a patch mesh +HRESULT WINAPI + D3DXCreatePatchMesh( + CONST D3DXPATCHINFO *pInfo, //patch type + DWORD dwNumPatches, //number of patches + DWORD dwNumVertices, //number of control vertices + DWORD dwOptions, //options + CONST D3DVERTEXELEMENT9 *pDecl, //format of control vertices + LPDIRECT3DDEVICE9 pD3DDevice, + LPD3DXPATCHMESH *pPatchMesh); + + +//returns the number of degenerates in a patch mesh - +//text output put in string. +HRESULT WINAPI + D3DXValidPatchMesh(LPD3DXPATCHMESH pMesh, + DWORD *dwcDegenerateVertices, + DWORD *dwcDegeneratePatches, + LPD3DXBUFFER *ppErrorsAndWarnings); + +UINT WINAPI + D3DXGetFVFVertexSize(DWORD FVF); + +UINT WINAPI + D3DXGetDeclVertexSize(CONST D3DVERTEXELEMENT9 *pDecl,DWORD Stream); + +UINT WINAPI + D3DXGetDeclLength(CONST D3DVERTEXELEMENT9 *pDecl); + +HRESULT WINAPI + D3DXDeclaratorFromFVF( + DWORD FVF, + D3DVERTEXELEMENT9 pDeclarator[MAX_FVF_DECL_SIZE]); + +HRESULT WINAPI + D3DXFVFFromDeclarator( + CONST D3DVERTEXELEMENT9 *pDeclarator, + DWORD *pFVF); + +HRESULT WINAPI + D3DXWeldVertices( + LPD3DXMESH pMesh, + DWORD Flags, + CONST D3DXWELDEPSILONS *pEpsilons, + CONST DWORD *pAdjacencyIn, + DWORD *pAdjacencyOut, + DWORD *pFaceRemap, + LPD3DXBUFFER *ppVertexRemap); + +typedef struct _D3DXINTERSECTINFO +{ + DWORD FaceIndex; // index of face intersected + FLOAT U; // Barycentric Hit Coordinates + FLOAT V; // Barycentric Hit Coordinates + FLOAT Dist; // Ray-Intersection Parameter Distance +} D3DXINTERSECTINFO, *LPD3DXINTERSECTINFO; + + +HRESULT WINAPI + D3DXIntersect( + LPD3DXBASEMESH pMesh, + CONST D3DXVECTOR3 *pRayPos, + CONST D3DXVECTOR3 *pRayDir, + BOOL *pHit, // True if any faces were intersected + DWORD *pFaceIndex, // index of closest face intersected + FLOAT *pU, // Barycentric Hit Coordinates + FLOAT *pV, // Barycentric Hit Coordinates + FLOAT *pDist, // Ray-Intersection Parameter Distance + LPD3DXBUFFER *ppAllHits, // Array of D3DXINTERSECTINFOs for all hits (not just closest) + DWORD *pCountOfHits); // Number of entries in AllHits array + +HRESULT WINAPI + D3DXIntersectSubset( + LPD3DXBASEMESH pMesh, + DWORD AttribId, + CONST D3DXVECTOR3 *pRayPos, + CONST D3DXVECTOR3 *pRayDir, + BOOL *pHit, // True if any faces were intersected + DWORD *pFaceIndex, // index of closest face intersected + FLOAT *pU, // Barycentric Hit Coordinates + FLOAT *pV, // Barycentric Hit Coordinates + FLOAT *pDist, // Ray-Intersection Parameter Distance + LPD3DXBUFFER *ppAllHits, // Array of D3DXINTERSECTINFOs for all hits (not just closest) + DWORD *pCountOfHits); // Number of entries in AllHits array + + +HRESULT WINAPI D3DXSplitMesh + ( + LPD3DXMESH pMeshIn, + CONST DWORD *pAdjacencyIn, + CONST DWORD MaxSize, + CONST DWORD Options, + DWORD *pMeshesOut, + LPD3DXBUFFER *ppMeshArrayOut, + LPD3DXBUFFER *ppAdjacencyArrayOut, + LPD3DXBUFFER *ppFaceRemapArrayOut, + LPD3DXBUFFER *ppVertRemapArrayOut + ); + +BOOL WINAPI D3DXIntersectTri +( + CONST D3DXVECTOR3 *p0, // Triangle vertex 0 position + CONST D3DXVECTOR3 *p1, // Triangle vertex 1 position + CONST D3DXVECTOR3 *p2, // Triangle vertex 2 position + CONST D3DXVECTOR3 *pRayPos, // Ray origin + CONST D3DXVECTOR3 *pRayDir, // Ray direction + FLOAT *pU, // Barycentric Hit Coordinates + FLOAT *pV, // Barycentric Hit Coordinates + FLOAT *pDist); // Ray-Intersection Parameter Distance + +BOOL WINAPI + D3DXSphereBoundProbe( + CONST D3DXVECTOR3 *pCenter, + FLOAT Radius, + CONST D3DXVECTOR3 *pRayPosition, + CONST D3DXVECTOR3 *pRayDirection); + +BOOL WINAPI + D3DXBoxBoundProbe( + CONST D3DXVECTOR3 *pMin, + CONST D3DXVECTOR3 *pMax, + CONST D3DXVECTOR3 *pRayPosition, + CONST D3DXVECTOR3 *pRayDirection); + + +HRESULT WINAPI D3DXComputeTangentFrame(ID3DXMesh *pMesh, + DWORD dwOptions); + +HRESULT WINAPI D3DXComputeTangentFrameEx(ID3DXMesh *pMesh, + DWORD dwTextureInSemantic, + DWORD dwTextureInIndex, + DWORD dwUPartialOutSemantic, + DWORD dwUPartialOutIndex, + DWORD dwVPartialOutSemantic, + DWORD dwVPartialOutIndex, + DWORD dwNormalOutSemantic, + DWORD dwNormalOutIndex, + DWORD dwOptions, + CONST DWORD *pdwAdjacency, + FLOAT fPartialEdgeThreshold, + FLOAT fSingularPointThreshold, + FLOAT fNormalEdgeThreshold, + ID3DXMesh **ppMeshOut, + ID3DXBuffer **ppVertexMapping); + + +//D3DXComputeTangent +// +//Computes the Tangent vectors for the TexStage texture coordinates +//and places the results in the TANGENT[TangentIndex] specified in the meshes' DECL +//puts the binorm in BINORM[BinormIndex] also specified in the decl. +// +//If neither the binorm or the tangnet are in the meshes declaration, +//the function will fail. +// +//If a tangent or Binorm field is in the Decl, but the user does not +//wish D3DXComputeTangent to replace them, then D3DX_DEFAULT specified +//in the TangentIndex or BinormIndex will cause it to ignore the specified +//semantic. +// +//Wrap should be specified if the texture coordinates wrap. + +HRESULT WINAPI D3DXComputeTangent(LPD3DXMESH Mesh, + DWORD TexStage, + DWORD TangentIndex, + DWORD BinormIndex, + DWORD Wrap, + CONST DWORD *pAdjacency); + +//============================================================================ +// +// UVAtlas apis +// +//============================================================================ +typedef HRESULT (WINAPI *LPD3DXUVATLASCB)(FLOAT fPercentDone, LPVOID lpUserContext); + +// This function creates atlases for meshes. There are two modes of operation, +// either based on the number of charts, or the maximum allowed stretch. If the +// maximum allowed stretch is 0, then each triangle will likely be in its own +// chart. + +// +// The parameters are as follows: +// pMesh - Input mesh to calculate an atlas for. This must have a position +// channel and at least a 2-d texture channel. +// uMaxChartNumber - The maximum number of charts required for the atlas. +// If this is 0, it will be parameterized based solely on +// stretch. +// fMaxStretch - The maximum amount of stretch, if 0, no stretching is allowed, +// if 1, then any amount of stretching is allowed. +// uWidth - The width of the texture the atlas will be used on. +// uHeight - The height of the texture the atlas will be used on. +// fGutter - The minimum distance, in texels between two charts on the atlas. +// this gets scaled by the width, so if fGutter is 2.5, and it is +// used on a 512x512 texture, then the minimum distance will be +// 2.5 / 512 in u-v space. +// dwTextureIndex - Specifies which texture coordinate to write to in the +// output mesh (which is cloned from the input mesh). Useful +// if your vertex has multiple texture coordinates. +// pdwAdjacency - a pointer to an array with 3 DWORDs per face, indicating +// which triangles are adjacent to each other. +// pdwFalseEdgeAdjacency - a pointer to an array with 3 DWORDS per face, indicating +// at each face, whether an edge is a false edge or not (using +// the same ordering as the adjacency data structure). If this +// is NULL, then it is assumed that there are no false edges. If +// not NULL, then a non-false edge is indicated by -1 and a false +// edge is indicated by any other value (it is not required, but +// it may be useful for the caller to use the original adjacency +// value). This allows you to parameterize a mesh of quads, and +// the edges down the middle of each quad will not be cut when +// parameterizing the mesh. +// pfIMTArray - a pointer to an array with 3 FLOATs per face, describing the +// integrated metric tensor for that face. This lets you control +// the way this triangle may be stretched in the atlas. The IMT +// passed in will be 3 floats (a,b,c) and specify a symmetric +// matrix (a b) that, given a vector (s,t), specifies the +// (b c) +// distance between a vector v1 and a vector v2 = v1 + (s,t) as +// sqrt((s, t) * M * (s, t)^T). +// In other words, this lets one specify the magnitude of the +// stretch in an arbitrary direction in u-v space. For example +// if a = b = c = 1, then this scales the vector (1,1) by 2, and +// the vector (1,-1) by 0. Note that this is multiplying the edge +// length by the square of the matrix, so if you want the face to +// stretch to twice its +// size with no shearing, the IMT value should be (2, 0, 2), which +// is just the identity matrix times 2. +// Note that this assumes you have an orientation for the triangle +// in some 2-D space. For D3DXUVAtlas, this space is created by +// letting S be the direction from the first to the second +// vertex, and T be the cross product between the normal and S. +// +// pStatusCallback - Since the atlas creation process can be very CPU intensive, +// this allows the programmer to specify a function to be called +// periodically, similarly to how it is done in the PRT simulation +// engine. +// fCallbackFrequency - This lets you specify how often the callback will be +// called. A decent default should be 0.0001f. +// pUserContext - a void pointer to be passed back to the callback function +// dwOptions - A combination of flags in the D3DXUVATLAS enum +// ppMeshOut - A pointer to a location to store a pointer for the newly created +// mesh. +// ppFacePartitioning - A pointer to a location to store a pointer for an array, +// one DWORD per face, giving the final partitioning +// created by the atlasing algorithm. +// ppVertexRemapArray - A pointer to a location to store a pointer for an array, +// one DWORD per vertex, giving the vertex it was copied +// from, if any vertices needed to be split. +// pfMaxStretchOut - A location to store the maximum stretch resulting from the +// atlasing algorithm. +// puNumChartsOut - A location to store the number of charts created, or if the +// maximum number of charts was too low, this gives the minimum +// number of charts needed to create an atlas. + +HRESULT WINAPI D3DXUVAtlasCreate(LPD3DXMESH pMesh, + UINT uMaxChartNumber, + FLOAT fMaxStretch, + UINT uWidth, + UINT uHeight, + FLOAT fGutter, + DWORD dwTextureIndex, + CONST DWORD *pdwAdjacency, + CONST DWORD *pdwFalseEdgeAdjacency, + CONST FLOAT *pfIMTArray, + LPD3DXUVATLASCB pStatusCallback, + FLOAT fCallbackFrequency, + LPVOID pUserContext, + DWORD dwOptions, + LPD3DXMESH *ppMeshOut, + LPD3DXBUFFER *ppFacePartitioning, + LPD3DXBUFFER *ppVertexRemapArray, + FLOAT *pfMaxStretchOut, + UINT *puNumChartsOut); + +// This has the same exact arguments as Create, except that it does not perform the +// final packing step. This method allows one to get a partitioning out, and possibly +// modify it before sending it to be repacked. Note that if you change the +// partitioning, you'll also need to calculate new texture coordinates for any faces +// that have switched charts. +// +// The partition result adjacency output parameter is meant to be passed to the +// UVAtlasPack function, this adjacency cuts edges that are between adjacent +// charts, and also can include cuts inside of a chart in order to make it +// equivalent to a disc. For example: +// +// _______ +// | ___ | +// | |_| | +// |_____| +// +// In order to make this equivalent to a disc, we would need to add a cut, and it +// Would end up looking like: +// _______ +// | ___ | +// | |_|_| +// |_____| +// +// The resulting partition adjacency parameter cannot be NULL, because it is +// required for the packing step. + + + +HRESULT WINAPI D3DXUVAtlasPartition(LPD3DXMESH pMesh, + UINT uMaxChartNumber, + FLOAT fMaxStretch, + DWORD dwTextureIndex, + CONST DWORD *pdwAdjacency, + CONST DWORD *pdwFalseEdgeAdjacency, + CONST FLOAT *pfIMTArray, + LPD3DXUVATLASCB pStatusCallback, + FLOAT fCallbackFrequency, + LPVOID pUserContext, + DWORD dwOptions, + LPD3DXMESH *ppMeshOut, + LPD3DXBUFFER *ppFacePartitioning, + LPD3DXBUFFER *ppVertexRemapArray, + LPD3DXBUFFER *ppPartitionResultAdjacency, + FLOAT *pfMaxStretchOut, + UINT *puNumChartsOut); + +// This takes the face partitioning result from Partition and packs it into an +// atlas of the given size. pdwPartitionResultAdjacency should be derived from +// the adjacency returned from the partition step. This value cannot be NULL +// because Pack needs to know where charts were cut in the partition step in +// order to find the edges of each chart. +// The options parameter is currently reserved. +HRESULT WINAPI D3DXUVAtlasPack(ID3DXMesh *pMesh, + UINT uWidth, + UINT uHeight, + FLOAT fGutter, + DWORD dwTextureIndex, + CONST DWORD *pdwPartitionResultAdjacency, + LPD3DXUVATLASCB pStatusCallback, + FLOAT fCallbackFrequency, + LPVOID pUserContext, + DWORD dwOptions, + LPD3DXBUFFER pFacePartitioning); + + +//============================================================================ +// +// IMT Calculation apis +// +// These functions all compute the Integrated Metric Tensor for use in the +// UVAtlas API. They all calculate the IMT with respect to the canonical +// triangle, where the coordinate system is set up so that the u axis goes +// from vertex 0 to 1 and the v axis is N x u. So, for example, the second +// vertex's canonical uv coordinates are (d,0) where d is the distance between +// vertices 0 and 1. This way the IMT does not depend on the parameterization +// of the mesh, and if the signal over the surface doesn't change, then +// the IMT doesn't need to be recalculated. +//============================================================================ + +// This callback is used by D3DXComputeIMTFromSignal. +// +// uv - The texture coordinate for the vertex. +// uPrimitiveID - Face ID of the triangle on which to compute the signal. +// uSignalDimension - The number of floats to store in pfSignalOut. +// pUserData - The pUserData pointer passed in to ComputeIMTFromSignal. +// pfSignalOut - A pointer to where to store the signal data. +typedef HRESULT (WINAPI* LPD3DXIMTSIGNALCALLBACK) + (CONST D3DXVECTOR2 *uv, + UINT uPrimitiveID, + UINT uSignalDimension, + VOID *pUserData, + FLOAT *pfSignalOut); + +// This function is used to calculate the IMT from per vertex data. It sets +// up a linear system over the triangle, solves for the jacobian J, then +// constructs the IMT from that (J^TJ). +// This function allows you to calculate the IMT based off of any value in a +// mesh (color, normal, etc) by specifying the correct stride of the array. +// The IMT computed will cause areas of the mesh that have similar values to +// take up less space in the texture. +// +// pMesh - The mesh to calculate the IMT for. +// pVertexSignal - A float array of size uSignalStride * v, where v is the +// number of vertices in the mesh. +// uSignalDimension - How many floats per vertex to use in calculating the IMT. +// uSignalStride - The number of bytes per vertex in the array. This must be +// a multiple of sizeof(float) +// ppIMTData - Where to store the buffer holding the IMT data + +HRESULT WINAPI D3DXComputeIMTFromPerVertexSignal ( + LPD3DXMESH pMesh, + CONST FLOAT *pfVertexSignal, // uSignalDimension floats per vertex + UINT uSignalDimension, + UINT uSignalStride, // stride of signal in bytes + DWORD dwOptions, // reserved for future use + LPD3DXUVATLASCB pStatusCallback, + LPVOID pUserContext, + LPD3DXBUFFER *ppIMTData); + +// This function is used to calculate the IMT from data that varies over the +// surface of the mesh (generally at a higher frequency than vertex data). +// This function requires the mesh to already be parameterized (so it already +// has texture coordinates). It allows the user to define a signal arbitrarily +// over the surface of the mesh. +// +// pMesh - The mesh to calculate the IMT for. +// dwTextureIndex - This describes which set of texture coordinates in the +// mesh to use. +// uSignalDimension - How many components there are in the signal. +// fMaxUVDistance - The subdivision will continue until the distance between +// all vertices is at most fMaxUVDistance. +// dwOptions - reserved for future use +// pSignalCallback - The callback to use to get the signal. +// pUserData - A pointer that will be passed in to the callback. +// ppIMTData - Where to store the buffer holding the IMT data +HRESULT WINAPI D3DXComputeIMTFromSignal( + LPD3DXMESH pMesh, + DWORD dwTextureIndex, + UINT uSignalDimension, + FLOAT fMaxUVDistance, + DWORD dwOptions, // reserved for future use + LPD3DXIMTSIGNALCALLBACK pSignalCallback, + VOID *pUserData, + LPD3DXUVATLASCB pStatusCallback, + LPVOID pUserContext, + LPD3DXBUFFER *ppIMTData); + +// This function is used to calculate the IMT from texture data. Given a texture +// that maps over the surface of the mesh, the algorithm computes the IMT for +// each face. This will cause large areas that are very similar to take up less +// room when parameterized with UVAtlas. The texture is assumed to be +// interpolated over the mesh bilinearly. +// +// pMesh - The mesh to calculate the IMT for. +// pTexture - The texture to load data from. +// dwTextureIndex - This describes which set of texture coordinates in the +// mesh to use. +// dwOptions - Combination of one or more D3DXIMT flags. +// ppIMTData - Where to store the buffer holding the IMT data +HRESULT WINAPI D3DXComputeIMTFromTexture ( + LPD3DXMESH pMesh, + LPDIRECT3DTEXTURE9 pTexture, + DWORD dwTextureIndex, + DWORD dwOptions, + LPD3DXUVATLASCB pStatusCallback, + LPVOID pUserContext, + LPD3DXBUFFER *ppIMTData); + +// This function is very similar to ComputeIMTFromTexture, but it uses a +// float array to pass in the data, and it can calculate higher dimensional +// values than 4. +// +// pMesh - The mesh to calculate the IMT for. +// dwTextureIndex - This describes which set of texture coordinates in the +// mesh to use. +// pfFloatArray - a pointer to a float array of size +// uWidth*uHeight*uComponents +// uWidth - The width of the texture +// uHeight - The height of the texture +// uSignalDimension - The number of floats per texel in the signal +// uComponents - The number of floats in each texel +// dwOptions - Combination of one or more D3DXIMT flags +// ppIMTData - Where to store the buffer holding the IMT data +HRESULT WINAPI D3DXComputeIMTFromPerTexelSignal( + LPD3DXMESH pMesh, + DWORD dwTextureIndex, + FLOAT *pfTexelSignal, + UINT uWidth, + UINT uHeight, + UINT uSignalDimension, + UINT uComponents, + DWORD dwOptions, + LPD3DXUVATLASCB pStatusCallback, + LPVOID pUserContext, + LPD3DXBUFFER *ppIMTData); + +HRESULT WINAPI + D3DXConvertMeshSubsetToSingleStrip( + LPD3DXBASEMESH MeshIn, + DWORD AttribId, + DWORD IBOptions, + LPDIRECT3DINDEXBUFFER9 *ppIndexBuffer, + DWORD *pNumIndices); + +HRESULT WINAPI + D3DXConvertMeshSubsetToStrips( + LPD3DXBASEMESH MeshIn, + DWORD AttribId, + DWORD IBOptions, + LPDIRECT3DINDEXBUFFER9 *ppIndexBuffer, + DWORD *pNumIndices, + LPD3DXBUFFER *ppStripLengths, + DWORD *pNumStrips); + + +//============================================================================ +// +// D3DXOptimizeFaces: +// -------------------- +// Generate a face remapping for a triangle list that more effectively utilizes +// vertex caches. This optimization is identical to the one provided +// by ID3DXMesh::Optimize with the hardware independent option enabled. +// +// Parameters: +// pbIndices +// Triangle list indices to use for generating a vertex ordering +// NumFaces +// Number of faces in the triangle list +// NumVertices +// Number of vertices referenced by the triangle list +// b32BitIndices +// TRUE if indices are 32 bit, FALSE if indices are 16 bit +// pFaceRemap +// Destination buffer to store face ordering +// The number stored for a given element is where in the new ordering +// the face will have come from. See ID3DXMesh::Optimize for more info. +// +//============================================================================ +HRESULT WINAPI + D3DXOptimizeFaces( + LPCVOID pbIndices, + UINT cFaces, + UINT cVertices, + BOOL b32BitIndices, + DWORD* pFaceRemap); + +//============================================================================ +// +// D3DXOptimizeVertices: +// -------------------- +// Generate a vertex remapping to optimize for in order use of vertices for +// a given set of indices. This is commonly used after applying the face +// remap generated by D3DXOptimizeFaces +// +// Parameters: +// pbIndices +// Triangle list indices to use for generating a vertex ordering +// NumFaces +// Number of faces in the triangle list +// NumVertices +// Number of vertices referenced by the triangle list +// b32BitIndices +// TRUE if indices are 32 bit, FALSE if indices are 16 bit +// pVertexRemap +// Destination buffer to store vertex ordering +// The number stored for a given element is where in the new ordering +// the vertex will have come from. See ID3DXMesh::Optimize for more info. +// +//============================================================================ +HRESULT WINAPI + D3DXOptimizeVertices( + LPCVOID pbIndices, + UINT cFaces, + UINT cVertices, + BOOL b32BitIndices, + DWORD* pVertexRemap); + +#ifdef __cplusplus +} +#endif //__cplusplus + + +//=========================================================================== +// +// Data structures for Spherical Harmonic Precomputation +// +// +//============================================================================ + +typedef enum _D3DXSHCOMPRESSQUALITYTYPE { + D3DXSHCQUAL_FASTLOWQUALITY = 1, + D3DXSHCQUAL_SLOWHIGHQUALITY = 2, + D3DXSHCQUAL_FORCE_DWORD = 0x7fffffff +} D3DXSHCOMPRESSQUALITYTYPE; + +typedef enum _D3DXSHGPUSIMOPT { + D3DXSHGPUSIMOPT_SHADOWRES256 = 1, + D3DXSHGPUSIMOPT_SHADOWRES512 = 0, + D3DXSHGPUSIMOPT_SHADOWRES1024 = 2, + D3DXSHGPUSIMOPT_SHADOWRES2048 = 3, + + D3DXSHGPUSIMOPT_HIGHQUALITY = 4, + + D3DXSHGPUSIMOPT_FORCE_DWORD = 0x7fffffff +} D3DXSHGPUSIMOPT; + +// for all properties that are colors the luminance is computed +// if the simulator is run with a single channel using the following +// formula: R * 0.2125 + G * 0.7154 + B * 0.0721 + +typedef struct _D3DXSHMATERIAL { + D3DCOLORVALUE Diffuse; // Diffuse albedo of the surface. (Ignored if object is a Mirror) + BOOL bMirror; // Must be set to FALSE. bMirror == TRUE not currently supported + BOOL bSubSurf; // true if the object does subsurface scattering - can't do this and be a mirror + + // subsurface scattering parameters + FLOAT RelativeIndexOfRefraction; + D3DCOLORVALUE Absorption; + D3DCOLORVALUE ReducedScattering; + +} D3DXSHMATERIAL; + +// allocated in D3DXSHPRTCompSplitMeshSC +// vertices are duplicated into multiple super clusters but +// only have a valid status in one super cluster (fill in the rest) + +typedef struct _D3DXSHPRTSPLITMESHVERTDATA { + UINT uVertRemap; // vertex in original mesh this corresponds to + UINT uSubCluster; // cluster index relative to super cluster + UCHAR ucVertStatus; // 1 if vertex has valid data, 0 if it is "fill" +} D3DXSHPRTSPLITMESHVERTDATA; + +// used in D3DXSHPRTCompSplitMeshSC +// information for each super cluster that maps into face/vert arrays + +typedef struct _D3DXSHPRTSPLITMESHCLUSTERDATA { + UINT uVertStart; // initial index into remapped vertex array + UINT uVertLength; // number of vertices in this super cluster + + UINT uFaceStart; // initial index into face array + UINT uFaceLength; // number of faces in this super cluster + + UINT uClusterStart; // initial index into cluster array + UINT uClusterLength; // number of clusters in this super cluster +} D3DXSHPRTSPLITMESHCLUSTERDATA; + +// call back function for simulator +// return S_OK to keep running the simulator - anything else represents +// failure and the simulator will abort. + +typedef HRESULT (WINAPI *LPD3DXSHPRTSIMCB)(float fPercentDone, LPVOID lpUserContext); + +// interfaces for PRT buffers/simulator + +// GUIDs +// {F1827E47-00A8-49cd-908C-9D11955F8728} +DEFINE_GUID(IID_ID3DXPRTBuffer, +0xf1827e47, 0xa8, 0x49cd, 0x90, 0x8c, 0x9d, 0x11, 0x95, 0x5f, 0x87, 0x28); + +// {A758D465-FE8D-45ad-9CF0-D01E56266A07} +DEFINE_GUID(IID_ID3DXPRTCompBuffer, +0xa758d465, 0xfe8d, 0x45ad, 0x9c, 0xf0, 0xd0, 0x1e, 0x56, 0x26, 0x6a, 0x7); + +// {838F01EC-9729-4527-AADB-DF70ADE7FEA9} +DEFINE_GUID(IID_ID3DXTextureGutterHelper, +0x838f01ec, 0x9729, 0x4527, 0xaa, 0xdb, 0xdf, 0x70, 0xad, 0xe7, 0xfe, 0xa9); + +// {683A4278-CD5F-4d24-90AD-C4E1B6855D53} +DEFINE_GUID(IID_ID3DXPRTEngine, +0x683a4278, 0xcd5f, 0x4d24, 0x90, 0xad, 0xc4, 0xe1, 0xb6, 0x85, 0x5d, 0x53); + +// interface defenitions + +typedef interface ID3DXTextureGutterHelper ID3DXTextureGutterHelper; +typedef interface ID3DXPRTBuffer ID3DXPRTBuffer; + +#undef INTERFACE +#define INTERFACE ID3DXPRTBuffer + +// Buffer interface - contains "NumSamples" samples +// each sample in memory is stored as NumCoeffs scalars per channel (1 or 3) +// Same interface is used for both Vertex and Pixel PRT buffers + +DECLARE_INTERFACE_(ID3DXPRTBuffer, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DXPRTBuffer + STDMETHOD_(UINT, GetNumSamples)(THIS) PURE; + STDMETHOD_(UINT, GetNumCoeffs)(THIS) PURE; + STDMETHOD_(UINT, GetNumChannels)(THIS) PURE; + + STDMETHOD_(BOOL, IsTexture)(THIS) PURE; + STDMETHOD_(UINT, GetWidth)(THIS) PURE; + STDMETHOD_(UINT, GetHeight)(THIS) PURE; + + // changes the number of samples allocated in the buffer + STDMETHOD(Resize)(THIS_ UINT NewSize) PURE; + + // ppData will point to the memory location where sample Start begins + // pointer is valid for at least NumSamples samples + STDMETHOD(LockBuffer)(THIS_ UINT Start, UINT NumSamples, FLOAT **ppData) PURE; + STDMETHOD(UnlockBuffer)(THIS) PURE; + + // every scalar in buffer is multiplied by Scale + STDMETHOD(ScaleBuffer)(THIS_ FLOAT Scale) PURE; + + // every scalar contains the sum of this and pBuffers values + // pBuffer must have the same storage class/dimensions + STDMETHOD(AddBuffer)(THIS_ LPD3DXPRTBUFFER pBuffer) PURE; + + // GutterHelper (described below) will fill in the gutter + // regions of a texture by interpolating "internal" values + STDMETHOD(AttachGH)(THIS_ LPD3DXTEXTUREGUTTERHELPER) PURE; + STDMETHOD(ReleaseGH)(THIS) PURE; + + // Evaluates attached gutter helper on the contents of this buffer + STDMETHOD(EvalGH)(THIS) PURE; + + // extracts a given channel into texture pTexture + // NumCoefficients starting from StartCoefficient are copied + STDMETHOD(ExtractTexture)(THIS_ UINT Channel, UINT StartCoefficient, + UINT NumCoefficients, LPDIRECT3DTEXTURE9 pTexture) PURE; + + // extracts NumCoefficients coefficients into mesh - only applicable on single channel + // buffers, otherwise just lockbuffer and copy data. With SHPRT data NumCoefficients + // should be Order^2 + STDMETHOD(ExtractToMesh)(THIS_ UINT NumCoefficients, D3DDECLUSAGE Usage, UINT UsageIndexStart, + LPD3DXMESH pScene) PURE; + +}; + +typedef interface ID3DXPRTCompBuffer ID3DXPRTCompBuffer; +typedef interface ID3DXPRTCompBuffer *LPD3DXPRTCOMPBUFFER; + +#undef INTERFACE +#define INTERFACE ID3DXPRTCompBuffer + +// compressed buffers stored a compressed version of a PRTBuffer + +DECLARE_INTERFACE_(ID3DXPRTCompBuffer, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DPRTCompBuffer + + // NumCoeffs and NumChannels are properties of input buffer + STDMETHOD_(UINT, GetNumSamples)(THIS) PURE; + STDMETHOD_(UINT, GetNumCoeffs)(THIS) PURE; + STDMETHOD_(UINT, GetNumChannels)(THIS) PURE; + + STDMETHOD_(BOOL, IsTexture)(THIS) PURE; + STDMETHOD_(UINT, GetWidth)(THIS) PURE; + STDMETHOD_(UINT, GetHeight)(THIS) PURE; + + // number of clusters, and PCA vectors per-cluster + STDMETHOD_(UINT, GetNumClusters)(THIS) PURE; + STDMETHOD_(UINT, GetNumPCA)(THIS) PURE; + + // normalizes PCA weights so that they are between [-1,1] + // basis vectors are modified to reflect this + STDMETHOD(NormalizeData)(THIS) PURE; + + // copies basis vectors for cluster "Cluster" into pClusterBasis + // (NumPCA+1)*NumCoeffs*NumChannels floats + STDMETHOD(ExtractBasis)(THIS_ UINT Cluster, FLOAT *pClusterBasis) PURE; + + // UINT per sample - which cluster it belongs to + STDMETHOD(ExtractClusterIDs)(THIS_ UINT *pClusterIDs) PURE; + + // copies NumExtract PCA projection coefficients starting at StartPCA + // into pPCACoefficients - NumSamples*NumExtract floats copied + STDMETHOD(ExtractPCA)(THIS_ UINT StartPCA, UINT NumExtract, FLOAT *pPCACoefficients) PURE; + + // copies NumPCA projection coefficients starting at StartPCA + // into pTexture - should be able to cope with signed formats + STDMETHOD(ExtractTexture)(THIS_ UINT StartPCA, UINT NumpPCA, + LPDIRECT3DTEXTURE9 pTexture) PURE; + + // copies NumPCA projection coefficients into mesh pScene + // Usage is D3DDECLUSAGE where coefficients are to be stored + // UsageIndexStart is starting index + STDMETHOD(ExtractToMesh)(THIS_ UINT NumPCA, D3DDECLUSAGE Usage, UINT UsageIndexStart, + LPD3DXMESH pScene) PURE; +}; + + +#undef INTERFACE +#define INTERFACE ID3DXTextureGutterHelper + +// ID3DXTextureGutterHelper will build and manage +// "gutter" regions in a texture - this will allow for +// bi-linear interpolation to not have artifacts when rendering +// It generates a map (in texture space) where each texel +// is in one of 3 states: +// 0 Invalid - not used at all +// 1 Inside triangle +// 2 Gutter texel +// 4 represents a gutter texel that will be computed during PRT +// For each Inside/Gutter texel it stores the face it +// belongs to and barycentric coordinates for the 1st two +// vertices of that face. Gutter vertices are assigned to +// the closest edge in texture space. +// +// When used with PRT this requires a unique parameterization +// of the model - every texel must correspond to a single point +// on the surface of the model and vice versa + +DECLARE_INTERFACE_(ID3DXTextureGutterHelper, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DXTextureGutterHelper + + // dimensions of texture this is bound too + STDMETHOD_(UINT, GetWidth)(THIS) PURE; + STDMETHOD_(UINT, GetHeight)(THIS) PURE; + + + // Applying gutters recomputes all of the gutter texels of class "2" + // based on texels of class "1" or "4" + + // Applies gutters to a raw float buffer - each texel is NumCoeffs floats + // Width and Height must match GutterHelper + STDMETHOD(ApplyGuttersFloat)(THIS_ FLOAT *pDataIn, UINT NumCoeffs, UINT Width, UINT Height); + + // Applies gutters to pTexture + // Dimensions must match GutterHelper + STDMETHOD(ApplyGuttersTex)(THIS_ LPDIRECT3DTEXTURE9 pTexture); + + // Applies gutters to a D3DXPRTBuffer + // Dimensions must match GutterHelper + STDMETHOD(ApplyGuttersPRT)(THIS_ LPD3DXPRTBUFFER pBuffer); + + // Resamples a texture from a mesh onto this gutterhelpers + // parameterization. It is assumed that the UV coordinates + // for this gutter helper are in TEXTURE 0 (usage/usage index) + // and the texture coordinates should all be within [0,1] for + // both sets. + // + // pTextureIn - texture represented using parameterization in pMeshIn + // pMeshIn - Mesh with texture coordinates that represent pTextureIn + // pTextureOut texture coordinates are assumed to be in + // TEXTURE 0 + // Usage - field in DECL for pMeshIn that stores texture coordinates + // for pTextureIn + // UsageIndex - which index for Usage above for pTextureIn + // pTextureOut- Resampled texture + // + // Usage would generally be D3DDECLUSAGE_TEXCOORD and UsageIndex other than zero + STDMETHOD(ResampleTex)(THIS_ LPDIRECT3DTEXTURE9 pTextureIn, + LPD3DXMESH pMeshIn, + D3DDECLUSAGE Usage, UINT UsageIndex, + LPDIRECT3DTEXTURE9 pTextureOut); + + // the routines below provide access to the data structures + // used by the Apply functions + + // face map is a UINT per texel that represents the + // face of the mesh that texel belongs too - + // only valid if same texel is valid in pGutterData + // pFaceData must be allocated by the user + STDMETHOD(GetFaceMap)(THIS_ UINT *pFaceData) PURE; + + // BaryMap is a D3DXVECTOR2 per texel + // the 1st two barycentric coordinates for the corresponding + // face (3rd weight is always 1-sum of first two) + // only valid if same texel is valid in pGutterData + // pBaryData must be allocated by the user + STDMETHOD(GetBaryMap)(THIS_ D3DXVECTOR2 *pBaryData) PURE; + + // TexelMap is a D3DXVECTOR2 per texel that + // stores the location in pixel coordinates where the + // corresponding texel is mapped + // pTexelData must be allocated by the user + STDMETHOD(GetTexelMap)(THIS_ D3DXVECTOR2 *pTexelData) PURE; + + // GutterMap is a BYTE per texel + // 0/1/2 for Invalid/Internal/Gutter texels + // 4 represents a gutter texel that will be computed + // during PRT + // pGutterData must be allocated by the user + STDMETHOD(GetGutterMap)(THIS_ BYTE *pGutterData) PURE; + + // face map is a UINT per texel that represents the + // face of the mesh that texel belongs too - + // only valid if same texel is valid in pGutterData + STDMETHOD(SetFaceMap)(THIS_ UINT *pFaceData) PURE; + + // BaryMap is a D3DXVECTOR2 per texel + // the 1st two barycentric coordinates for the corresponding + // face (3rd weight is always 1-sum of first two) + // only valid if same texel is valid in pGutterData + STDMETHOD(SetBaryMap)(THIS_ D3DXVECTOR2 *pBaryData) PURE; + + // TexelMap is a D3DXVECTOR2 per texel that + // stores the location in pixel coordinates where the + // corresponding texel is mapped + STDMETHOD(SetTexelMap)(THIS_ D3DXVECTOR2 *pTexelData) PURE; + + // GutterMap is a BYTE per texel + // 0/1/2 for Invalid/Internal/Gutter texels + // 4 represents a gutter texel that will be computed + // during PRT + STDMETHOD(SetGutterMap)(THIS_ BYTE *pGutterData) PURE; +}; + + +typedef interface ID3DXPRTEngine ID3DXPRTEngine; +typedef interface ID3DXPRTEngine *LPD3DXPRTENGINE; + +#undef INTERFACE +#define INTERFACE ID3DXPRTEngine + +// ID3DXPRTEngine is used to compute a PRT simulation +// Use the following steps to compute PRT for SH +// (1) create an interface (which includes a scene) +// (2) call SetSamplingInfo +// (3) [optional] Set MeshMaterials/albedo's (required if doing bounces) +// (4) call ComputeDirectLightingSH +// (5) [optional] call ComputeBounce +// repeat step 5 for as many bounces as wanted. +// if you want to model subsurface scattering you +// need to call ComputeSS after direct lighting and +// each bounce. +// If you want to bake the albedo into the PRT signal, you +// must call MutliplyAlbedo, otherwise the user has to multiply +// the albedo themselves. Not multiplying the albedo allows you +// to model albedo variation at a finer scale then illumination, and +// can result in better compression results. +// Luminance values are computed from RGB values using the following +// formula: R * 0.2125 + G * 0.7154 + B * 0.0721 + +DECLARE_INTERFACE_(ID3DXPRTEngine, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // ID3DXPRTEngine + + // This sets a material per attribute in the scene mesh and it is + // the only way to specify subsurface scattering parameters. if + // bSetAlbedo is FALSE, NumChannels must match the current + // configuration of the PRTEngine. If you intend to change + // NumChannels (through some other SetAlbedo function) it must + // happen before SetMeshMaterials is called. + // + // NumChannels 1 implies "grayscale" materials, set this to 3 to enable + // color bleeding effects + // bSetAlbedo sets albedo from material if TRUE - which clobbers per texel/vertex + // albedo that might have been set before. FALSE won't clobber. + // fLengthScale is used for subsurface scattering - scene is mapped into a 1mm unit cube + // and scaled by this amount + STDMETHOD(SetMeshMaterials)(THIS_ CONST D3DXSHMATERIAL **ppMaterials, UINT NumMeshes, + UINT NumChannels, BOOL bSetAlbedo, FLOAT fLengthScale) PURE; + + // setting albedo per-vertex or per-texel over rides the albedos stored per mesh + // but it does not over ride any other settings + + // sets an albedo to be used per vertex - the albedo is represented as a float + // pDataIn input pointer (pointint to albedo of 1st sample) + // NumChannels 1 implies "grayscale" materials, set this to 3 to enable + // color bleeding effects + // Stride - stride in bytes to get to next samples albedo + STDMETHOD(SetPerVertexAlbedo)(THIS_ CONST VOID *pDataIn, UINT NumChannels, UINT Stride) PURE; + + // represents the albedo per-texel instead of per-vertex (even if per-vertex PRT is used) + // pAlbedoTexture - texture that stores the albedo (dimension arbitrary) + // NumChannels 1 implies "grayscale" materials, set this to 3 to enable + // color bleeding effects + // pGH - optional gutter helper, otherwise one is constructed in computation routines and + // destroyed (if not attached to buffers) + STDMETHOD(SetPerTexelAlbedo)(THIS_ LPDIRECT3DTEXTURE9 pAlbedoTexture, + UINT NumChannels, + LPD3DXTEXTUREGUTTERHELPER pGH) PURE; + + // gets the per-vertex albedo + STDMETHOD(GetVertexAlbedo)(THIS_ D3DXCOLOR *pVertColors, UINT NumVerts) PURE; + + // If pixel PRT is being computed normals default to ones that are interpolated + // from the vertex normals. This specifies a texture that stores an object + // space normal map instead (must use a texture format that can represent signed values) + // pNormalTexture - normal map, must be same dimensions as PRTBuffers, signed + STDMETHOD(SetPerTexelNormal)(THIS_ LPDIRECT3DTEXTURE9 pNormalTexture) PURE; + + // Copies per-vertex albedo from mesh + // pMesh - mesh that represents the scene. It must have the same + // properties as the mesh used to create the PRTEngine + // Usage - D3DDECLUSAGE to extract albedos from + // NumChannels 1 implies "grayscale" materials, set this to 3 to enable + // color bleeding effects + STDMETHOD(ExtractPerVertexAlbedo)(THIS_ LPD3DXMESH pMesh, + D3DDECLUSAGE Usage, + UINT NumChannels) PURE; + + // Resamples the input buffer into the output buffer + // can be used to move between per-vertex and per-texel buffers. This can also be used + // to convert single channel buffers to 3-channel buffers and vice-versa. + STDMETHOD(ResampleBuffer)(THIS_ LPD3DXPRTBUFFER pBufferIn, LPD3DXPRTBUFFER pBufferOut) PURE; + + // Returns the scene mesh - including modifications from adaptive spatial sampling + // The returned mesh only has positions, normals and texture coordinates (if defined) + // pD3DDevice - d3d device that will be used to allocate the mesh + // pFaceRemap - each face has a pointer back to the face on the original mesh that it comes from + // if the face hasn't been subdivided this will be an identity mapping + // pVertRemap - each vertex contains 3 vertices that this is a linear combination of + // pVertWeights - weights for each of above indices (sum to 1.0f) + // ppMesh - mesh that will be allocated and filled + STDMETHOD(GetAdaptedMesh)(THIS_ LPDIRECT3DDEVICE9 pD3DDevice,UINT *pFaceRemap, UINT *pVertRemap, FLOAT *pfVertWeights, LPD3DXMESH *ppMesh) PURE; + + // Number of vertices currently allocated (includes new vertices from adaptive sampling) + STDMETHOD_(UINT, GetNumVerts)(THIS) PURE; + // Number of faces currently allocated (includes new faces) + STDMETHOD_(UINT, GetNumFaces)(THIS) PURE; + + // Sets the Minimum/Maximum intersection distances, this can be used to control + // maximum distance that objects can shadow/reflect light, and help with "bad" + // art that might have near features that you don't want to shadow. This does not + // apply for GPU simulations. + // fMin - minimum intersection distance, must be positive and less than fMax + // fMax - maximum intersection distance, if 0.0f use the previous value, otherwise + // must be strictly greater than fMin + STDMETHOD(SetMinMaxIntersection)(THIS_ FLOAT fMin, FLOAT fMax) PURE; + + // This will subdivide faces on a mesh so that adaptively simulations can + // use a more conservative threshold (it won't miss features.) + // MinEdgeLength - minimum edge length that will be generated, if 0.0f a + // reasonable default will be used + // MaxSubdiv - maximum level of subdivision, if 0 is specified a default + // value will be used (5) + STDMETHOD(RobustMeshRefine)(THIS_ FLOAT MinEdgeLength, UINT MaxSubdiv) PURE; + + // This sets to sampling information used by the simulator. Adaptive sampling + // parameters are currently ignored. + // NumRays - number of rays to shoot per sample + // UseSphere - if TRUE uses spherical samples, otherwise samples over + // the hemisphere. Should only be used with GPU and Vol computations + // UseCosine - if TRUE uses a cosine weighting - not used for Vol computations + // or if only the visiblity function is desired + // Adaptive - if TRUE adaptive sampling (angular) is used + // AdaptiveThresh - threshold used to terminate adaptive angular sampling + // ignored if adaptive sampling is not set + STDMETHOD(SetSamplingInfo)(THIS_ UINT NumRays, + BOOL UseSphere, + BOOL UseCosine, + BOOL Adaptive, + FLOAT AdaptiveThresh) PURE; + + // Methods that compute the direct lighting contribution for objects + // always represente light using spherical harmonics (SH) + // the albedo is not multiplied by the signal - it just integrates + // incoming light. If NumChannels is not 1 the vector is replicated + // + // SHOrder - order of SH to use + // pDataOut - PRT buffer that is generated. Can be single channel + STDMETHOD(ComputeDirectLightingSH)(THIS_ UINT SHOrder, + LPD3DXPRTBUFFER pDataOut) PURE; + + // Adaptive variant of above function. This will refine the mesh + // generating new vertices/faces to approximate the PRT signal + // more faithfully. + // SHOrder - order of SH to use + // AdaptiveThresh - threshold for adaptive subdivision (in PRT vector error) + // if value is less then 1e-6f, 1e-6f is specified + // MinEdgeLength - minimum edge length that will be generated + // if value is too small a fairly conservative model dependent value + // is used + // MaxSubdiv - maximum subdivision level, if 0 is specified it + // will default to 4 + // pDataOut - PRT buffer that is generated. Can be single channel. + STDMETHOD(ComputeDirectLightingSHAdaptive)(THIS_ UINT SHOrder, + FLOAT AdaptiveThresh, + FLOAT MinEdgeLength, + UINT MaxSubdiv, + LPD3DXPRTBUFFER pDataOut) PURE; + + // Function that computes the direct lighting contribution for objects + // light is always represented using spherical harmonics (SH) + // This is done on the GPU and is much faster then using the CPU. + // The albedo is not multiplied by the signal - it just integrates + // incoming light. If NumChannels is not 1 the vector is replicated. + // ZBias/ZAngleBias are akin to parameters used with shadow zbuffers. + // A reasonable default for both values is 0.005, but the user should + // experiment (ZAngleBias can be zero, ZBias should not be.) + // Callbacks should not use the Direct3D9Device the simulator is using. + // SetSamplingInfo must be called with TRUE for UseSphere and + // FALSE for UseCosine before this method is called. + // + // pD3DDevice - device used to run GPU simulator - must support PS2.0 + // and FP render targets + // Flags - parameters for the GPU simulator, combination of one or more + // D3DXSHGPUSIMOPT flags. Only one SHADOWRES setting should be set and + // the defaults is 512 + // SHOrder - order of SH to use + // ZBias - bias in normal direction (for depth test) + // ZAngleBias - scaled by one minus cosine of angle with light (offset in depth) + // pDataOut - PRT buffer that is filled in. Can be single channel + STDMETHOD(ComputeDirectLightingSHGPU)(THIS_ LPDIRECT3DDEVICE9 pD3DDevice, + UINT Flags, + UINT SHOrder, + FLOAT ZBias, + FLOAT ZAngleBias, + LPD3DXPRTBUFFER pDataOut) PURE; + + + // Functions that computes subsurface scattering (using material properties) + // Albedo is not multiplied by result. This only works for per-vertex data + // use ResampleBuffer to move per-vertex data into a texture and back. + // + // pDataIn - input data (previous bounce) + // pDataOut - result of subsurface scattering simulation + // pDataTotal - [optional] results can be summed into this buffer + STDMETHOD(ComputeSS)(THIS_ LPD3DXPRTBUFFER pDataIn, + LPD3DXPRTBUFFER pDataOut, LPD3DXPRTBUFFER pDataTotal) PURE; + + // Adaptive version of ComputeSS. + // + // pDataIn - input data (previous bounce) + // AdaptiveThresh - threshold for adaptive subdivision (in PRT vector error) + // if value is less then 1e-6f, 1e-6f is specified + // MinEdgeLength - minimum edge length that will be generated + // if value is too small a fairly conservative model dependent value + // is used + // MaxSubdiv - maximum subdivision level, if 0 is specified it + // will default to 4 + // pDataOut - result of subsurface scattering simulation + // pDataTotal - [optional] results can be summed into this buffer + STDMETHOD(ComputeSSAdaptive)(THIS_ LPD3DXPRTBUFFER pDataIn, + FLOAT AdaptiveThresh, + FLOAT MinEdgeLength, + UINT MaxSubdiv, + LPD3DXPRTBUFFER pDataOut, LPD3DXPRTBUFFER pDataTotal) PURE; + + // computes a single bounce of inter-reflected light + // works for SH based PRT or generic lighting + // Albedo is not multiplied by result + // + // pDataIn - previous bounces data + // pDataOut - PRT buffer that is generated + // pDataTotal - [optional] can be used to keep a running sum + STDMETHOD(ComputeBounce)(THIS_ LPD3DXPRTBUFFER pDataIn, + LPD3DXPRTBUFFER pDataOut, + LPD3DXPRTBUFFER pDataTotal) PURE; + + // Adaptive version of above function. + // + // pDataIn - previous bounces data, can be single channel + // AdaptiveThresh - threshold for adaptive subdivision (in PRT vector error) + // if value is less then 1e-6f, 1e-6f is specified + // MinEdgeLength - minimum edge length that will be generated + // if value is too small a fairly conservative model dependent value + // is used + // MaxSubdiv - maximum subdivision level, if 0 is specified it + // will default to 4 + // pDataOut - PRT buffer that is generated + // pDataTotal - [optional] can be used to keep a running sum + STDMETHOD(ComputeBounceAdaptive)(THIS_ LPD3DXPRTBUFFER pDataIn, + FLOAT AdaptiveThresh, + FLOAT MinEdgeLength, + UINT MaxSubdiv, + LPD3DXPRTBUFFER pDataOut, + LPD3DXPRTBUFFER pDataTotal) PURE; + + // Computes projection of distant SH radiance into a local SH radiance + // function. This models how direct lighting is attenuated by the + // scene and is a form of "neighborhood transfer." The result is + // a linear operator (matrix) at every sample point, if you multiply + // this matrix by the distant SH lighting coefficients you get an + // approximation of the local incident radiance function from + // direct lighting. These resulting lighting coefficients can + // than be projected into another basis or used with any rendering + // technique that uses spherical harmonics as input. + // SetSamplingInfo must be called with TRUE for UseSphere and + // FALSE for UseCosine before this method is called. + // Generates SHOrderIn*SHOrderIn*SHOrderOut*SHOrderOut scalars + // per channel at each sample location. + // + // SHOrderIn - Order of the SH representation of distant lighting + // SHOrderOut - Order of the SH representation of local lighting + // NumVolSamples - Number of sample locations + // pSampleLocs - position of sample locations + // pDataOut - PRT Buffer that will store output results + STDMETHOD(ComputeVolumeSamplesDirectSH)(THIS_ UINT SHOrderIn, + UINT SHOrderOut, + UINT NumVolSamples, + CONST D3DXVECTOR3 *pSampleLocs, + LPD3DXPRTBUFFER pDataOut) PURE; + + // At each sample location computes a linear operator (matrix) that maps + // the representation of source radiance (NumCoeffs in pSurfDataIn) + // into a local incident radiance function approximated with spherical + // harmonics. For example if a light map data is specified in pSurfDataIn + // the result is an SH representation of the flow of light at each sample + // point. If PRT data for an outdoor scene is used, each sample point + // contains a matrix that models how distant lighting bounces of the objects + // in the scene and arrives at the given sample point. Combined with + // ComputeVolumeSamplesDirectSH this gives the complete representation for + // how light arrives at each sample point parameterized by distant lighting. + // SetSamplingInfo must be called with TRUE for UseSphere and + // FALSE for UseCosine before this method is called. + // Generates pSurfDataIn->NumCoeffs()*SHOrder*SHOrder scalars + // per channel at each sample location. + // + // pSurfDataIn - previous bounce data + // SHOrder - order of SH to generate projection with + // NumVolSamples - Number of sample locations + // pSampleLocs - position of sample locations + // pDataOut - PRT Buffer that will store output results + STDMETHOD(ComputeVolumeSamples)(THIS_ LPD3DXPRTBUFFER pSurfDataIn, + UINT SHOrder, + UINT NumVolSamples, + CONST D3DXVECTOR3 *pSampleLocs, + LPD3DXPRTBUFFER pDataOut) PURE; + + // Computes direct lighting (SH) for a point not on the mesh + // with a given normal - cannot use texture buffers. + // + // SHOrder - order of SH to use + // NumSamples - number of sample locations + // pSampleLocs - position for each sample + // pSampleNorms - normal for each sample + // pDataOut - PRT Buffer that will store output results + STDMETHOD(ComputeSurfSamplesDirectSH)(THIS_ UINT SHOrder, + UINT NumSamples, + CONST D3DXVECTOR3 *pSampleLocs, + CONST D3DXVECTOR3 *pSampleNorms, + LPD3DXPRTBUFFER pDataOut) PURE; + + + // given the solution for PRT or light maps, computes transfer vector at arbitrary + // position/normal pairs in space + // + // pSurfDataIn - input data + // NumSamples - number of sample locations + // pSampleLocs - position for each sample + // pSampleNorms - normal for each sample + // pDataOut - PRT Buffer that will store output results + // pDataTotal - optional buffer to sum results into - can be NULL + STDMETHOD(ComputeSurfSamplesBounce)(THIS_ LPD3DXPRTBUFFER pSurfDataIn, + UINT NumSamples, + CONST D3DXVECTOR3 *pSampleLocs, + CONST D3DXVECTOR3 *pSampleNorms, + LPD3DXPRTBUFFER pDataOut, + LPD3DXPRTBUFFER pDataTotal) PURE; + + // Frees temporary data structures that can be created for subsurface scattering + // this data is freed when the PRTComputeEngine is freed and is lazily created + STDMETHOD(FreeSSData)(THIS) PURE; + + // Frees temporary data structures that can be created for bounce simulations + // this data is freed when the PRTComputeEngine is freed and is lazily created + STDMETHOD(FreeBounceData)(THIS) PURE; + + // This computes the Local Deformable PRT (LDPRT) coefficients relative to the + // per sample normals that minimize error in a least squares sense with respect + // to the input PRT data set. These coefficients can be used with skinned/transformed + // normals to model global effects with dynamic objects. Shading normals can + // optionally be solved for - these normals (along with the LDPRT coefficients) can + // more accurately represent the PRT signal. The coefficients are for zonal + // harmonics oriented in the normal/shading normal direction. + // + // pDataIn - SH PRT dataset that is input + // SHOrder - Order of SH to compute conv coefficients for + // pNormOut - Optional array of vectors (passed in) that will be filled with + // "shading normals", LDPRT coefficients are optimized for + // these normals. This array must be the same size as the number of + // samples in pDataIn + // pDataOut - Output buffer (SHOrder zonal harmonic coefficients per channel per sample) + STDMETHOD(ComputeLDPRTCoeffs)(THIS_ LPD3DXPRTBUFFER pDataIn, + UINT SHOrder, + D3DXVECTOR3 *pNormOut, + LPD3DXPRTBUFFER pDataOut) PURE; + + // scales all the samples associated with a given sub mesh + // can be useful when using subsurface scattering + // fScale - value to scale each vector in submesh by + STDMETHOD(ScaleMeshChunk)(THIS_ UINT uMeshChunk, FLOAT fScale, LPD3DXPRTBUFFER pDataOut) PURE; + + // mutliplies each PRT vector by the albedo - can be used if you want to have the albedo + // burned into the dataset, often better not to do this. If this is not done the user + // must mutliply the albedo themselves when rendering - just multiply the albedo times + // the result of the PRT dot product. + // If pDataOut is a texture simulation result and there is an albedo texture it + // must be represented at the same resolution as the simulation buffer. You can use + // LoadSurfaceFromSurface and set a new albedo texture if this is an issue - but must + // be careful about how the gutters are handled. + // + // pDataOut - dataset that will get albedo pushed into it + STDMETHOD(MultiplyAlbedo)(THIS_ LPD3DXPRTBUFFER pDataOut) PURE; + + // Sets a pointer to an optional call back function that reports back to the + // user percentage done and gives them the option of quitting + // pCB - pointer to call back function, return S_OK for the simulation + // to continue + // Frequency - 1/Frequency is roughly the number of times the call back + // will be invoked + // lpUserContext - will be passed back to the users call back + STDMETHOD(SetCallBack)(THIS_ LPD3DXSHPRTSIMCB pCB, FLOAT Frequency, LPVOID lpUserContext) PURE; + + // Returns TRUE if the ray intersects the mesh, FALSE if it does not. This function + // takes into account settings from SetMinMaxIntersection. If the closest intersection + // is not needed this function is more efficient compared to the ClosestRayIntersection + // method. + // pRayPos - origin of ray + // pRayDir - normalized ray direction (normalization required for SetMinMax to be meaningful) + + STDMETHOD_(BOOL, ShadowRayIntersects)(THIS_ CONST D3DXVECTOR3 *pRayPos, CONST D3DXVECTOR3 *pRayDir) PURE; + + // Returns TRUE if the ray intersects the mesh, FALSE if it does not. If there is an + // intersection the closest face that was intersected and its first two barycentric coordinates + // are returned. This function takes into account settings from SetMinMaxIntersection. + // This is a slower function compared to ShadowRayIntersects and should only be used where + // needed. The third vertices barycentric coordinates will be 1 - pU - pV. + // pRayPos - origin of ray + // pRayDir - normalized ray direction (normalization required for SetMinMax to be meaningful) + // pFaceIndex - Closest face that intersects. This index is based on stacking the pBlockerMesh + // faces before the faces from pMesh + // pU - Barycentric coordinate for vertex 0 + // pV - Barycentric coordinate for vertex 1 + // pDist - Distance along ray where the intersection occured + + STDMETHOD_(BOOL, ClosestRayIntersects)(THIS_ CONST D3DXVECTOR3 *pRayPos, CONST D3DXVECTOR3 *pRayDir, + DWORD *pFaceIndex, FLOAT *pU, FLOAT *pV, FLOAT *pDist) PURE; +}; + + +// API functions for creating interfaces + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + +//============================================================================ +// +// D3DXCreatePRTBuffer: +// -------------------- +// Generates a PRT Buffer that can be compressed or filled by a simulator +// This function should be used to create per-vertex or volume buffers. +// When buffers are created all values are initialized to zero. +// +// Parameters: +// NumSamples +// Number of sample locations represented +// NumCoeffs +// Number of coefficients per sample location (order^2 for SH) +// NumChannels +// Number of color channels to represent (1 or 3) +// ppBuffer +// Buffer that will be allocated +// +//============================================================================ + +HRESULT WINAPI + D3DXCreatePRTBuffer( + UINT NumSamples, + UINT NumCoeffs, + UINT NumChannels, + LPD3DXPRTBUFFER* ppBuffer); + +//============================================================================ +// +// D3DXCreatePRTBufferTex: +// -------------------- +// Generates a PRT Buffer that can be compressed or filled by a simulator +// This function should be used to create per-pixel buffers. +// When buffers are created all values are initialized to zero. +// +// Parameters: +// Width +// Width of texture +// Height +// Height of texture +// NumCoeffs +// Number of coefficients per sample location (order^2 for SH) +// NumChannels +// Number of color channels to represent (1 or 3) +// ppBuffer +// Buffer that will be allocated +// +//============================================================================ + +HRESULT WINAPI + D3DXCreatePRTBufferTex( + UINT Width, + UINT Height, + UINT NumCoeffs, + UINT NumChannels, + LPD3DXPRTBUFFER* ppBuffer); + +//============================================================================ +// +// D3DXLoadPRTBufferFromFile: +// -------------------- +// Loads a PRT buffer that has been saved to disk. +// +// Parameters: +// pFilename +// Name of the file to load +// ppBuffer +// Buffer that will be allocated +// +//============================================================================ + +HRESULT WINAPI + D3DXLoadPRTBufferFromFileA( + LPCSTR pFilename, + LPD3DXPRTBUFFER* ppBuffer); + +HRESULT WINAPI + D3DXLoadPRTBufferFromFileW( + LPCWSTR pFilename, + LPD3DXPRTBUFFER* ppBuffer); + +#ifdef UNICODE +#define D3DXLoadPRTBufferFromFile D3DXLoadPRTBufferFromFileW +#else +#define D3DXLoadPRTBufferFromFile D3DXLoadPRTBufferFromFileA +#endif + + +//============================================================================ +// +// D3DXSavePRTBufferToFile: +// -------------------- +// Saves a PRTBuffer to disk. +// +// Parameters: +// pFilename +// Name of the file to save +// pBuffer +// Buffer that will be saved +// +//============================================================================ + +HRESULT WINAPI + D3DXSavePRTBufferToFileA( + LPCSTR pFileName, + LPD3DXPRTBUFFER pBuffer); + +HRESULT WINAPI + D3DXSavePRTBufferToFileW( + LPCWSTR pFileName, + LPD3DXPRTBUFFER pBuffer); + +#ifdef UNICODE +#define D3DXSavePRTBufferToFile D3DXSavePRTBufferToFileW +#else +#define D3DXSavePRTBufferToFile D3DXSavePRTBufferToFileA +#endif + + +//============================================================================ +// +// D3DXLoadPRTCompBufferFromFile: +// -------------------- +// Loads a PRTComp buffer that has been saved to disk. +// +// Parameters: +// pFilename +// Name of the file to load +// ppBuffer +// Buffer that will be allocated +// +//============================================================================ + +HRESULT WINAPI + D3DXLoadPRTCompBufferFromFileA( + LPCSTR pFilename, + LPD3DXPRTCOMPBUFFER* ppBuffer); + +HRESULT WINAPI + D3DXLoadPRTCompBufferFromFileW( + LPCWSTR pFilename, + LPD3DXPRTCOMPBUFFER* ppBuffer); + +#ifdef UNICODE +#define D3DXLoadPRTCompBufferFromFile D3DXLoadPRTCompBufferFromFileW +#else +#define D3DXLoadPRTCompBufferFromFile D3DXLoadPRTCompBufferFromFileA +#endif + +//============================================================================ +// +// D3DXSavePRTCompBufferToFile: +// -------------------- +// Saves a PRTCompBuffer to disk. +// +// Parameters: +// pFilename +// Name of the file to save +// pBuffer +// Buffer that will be saved +// +//============================================================================ + +HRESULT WINAPI + D3DXSavePRTCompBufferToFileA( + LPCSTR pFileName, + LPD3DXPRTCOMPBUFFER pBuffer); + +HRESULT WINAPI + D3DXSavePRTCompBufferToFileW( + LPCWSTR pFileName, + LPD3DXPRTCOMPBUFFER pBuffer); + +#ifdef UNICODE +#define D3DXSavePRTCompBufferToFile D3DXSavePRTCompBufferToFileW +#else +#define D3DXSavePRTCompBufferToFile D3DXSavePRTCompBufferToFileA +#endif + +//============================================================================ +// +// D3DXCreatePRTCompBuffer: +// -------------------- +// Compresses a PRT buffer (vertex or texel) +// +// Parameters: +// D3DXSHCOMPRESSQUALITYTYPE +// Quality of compression - low is faster (computes PCA per voronoi cluster) +// high is slower but better quality (clusters based on distance to affine subspace) +// NumClusters +// Number of clusters to compute +// NumPCA +// Number of basis vectors to compute +// pCB +// Optional Callback function +// lpUserContext +// Optional user context +// pBufferIn +// Buffer that will be compressed +// ppBufferOut +// Compressed buffer that will be created +// +//============================================================================ + + +HRESULT WINAPI + D3DXCreatePRTCompBuffer( + D3DXSHCOMPRESSQUALITYTYPE Quality, + UINT NumClusters, + UINT NumPCA, + LPD3DXSHPRTSIMCB pCB, + LPVOID lpUserContext, + LPD3DXPRTBUFFER pBufferIn, + LPD3DXPRTCOMPBUFFER *ppBufferOut + ); + +//============================================================================ +// +// D3DXCreateTextureGutterHelper: +// -------------------- +// Generates a "GutterHelper" for a given set of meshes and texture +// resolution +// +// Parameters: +// Width +// Width of texture +// Height +// Height of texture +// pMesh +// Mesh that represents the scene +// GutterSize +// Number of texels to over rasterize in texture space +// this should be at least 1.0 +// ppBuffer +// GutterHelper that will be created +// +//============================================================================ + + +HRESULT WINAPI + D3DXCreateTextureGutterHelper( + UINT Width, + UINT Height, + LPD3DXMESH pMesh, + FLOAT GutterSize, + LPD3DXTEXTUREGUTTERHELPER* ppBuffer); + + +//============================================================================ +// +// D3DXCreatePRTEngine: +// -------------------- +// Computes a PRTEngine which can efficiently generate PRT simulations +// of a scene +// +// Parameters: +// pMesh +// Mesh that represents the scene - must have an AttributeTable +// where vertices are in a unique attribute. +// pAdjacency +// Optional adjacency information +// ExtractUVs +// Set this to true if textures are going to be used for albedos +// or to store PRT vectors +// pBlockerMesh +// Optional mesh that just blocks the scene +// ppEngine +// PRTEngine that will be created +// +//============================================================================ + + +HRESULT WINAPI + D3DXCreatePRTEngine( + LPD3DXMESH pMesh, + DWORD *pAdjacency, + BOOL ExtractUVs, + LPD3DXMESH pBlockerMesh, + LPD3DXPRTENGINE* ppEngine); + +//============================================================================ +// +// D3DXConcatenateMeshes: +// -------------------- +// Concatenates a group of meshes into one common mesh. This can optionaly transform +// each sub mesh or its texture coordinates. If no DECL is given it will +// generate a union of all of the DECL's of the sub meshes, promoting channels +// and types if neccesary. It will create an AttributeTable if possible, one can +// call OptimizeMesh with attribute sort and compacting enabled to ensure this. +// +// Parameters: +// ppMeshes +// Array of pointers to meshes that can store PRT vectors +// NumMeshes +// Number of meshes +// Options +// Passed through to D3DXCreateMesh +// pGeomXForms +// [optional] Each sub mesh is transformed by the corresponding +// matrix if this array is supplied +// pTextureXForms +// [optional] UV coordinates for each sub mesh are transformed +// by corresponding matrix if supplied +// pDecl +// [optional] Only information in this DECL is used when merging +// data +// pD3DDevice +// D3D device that is used to create the new mesh +// ppMeshOut +// Mesh that will be created +// +//============================================================================ + + +HRESULT WINAPI + D3DXConcatenateMeshes( + LPD3DXMESH *ppMeshes, + UINT NumMeshes, + DWORD Options, + CONST D3DXMATRIX *pGeomXForms, + CONST D3DXMATRIX *pTextureXForms, + CONST D3DVERTEXELEMENT9 *pDecl, + LPDIRECT3DDEVICE9 pD3DDevice, + LPD3DXMESH *ppMeshOut); + +//============================================================================ +// +// D3DXSHPRTCompSuperCluster: +// -------------------------- +// Used with compressed results of D3DXSHPRTSimulation. +// Generates "super clusters" - groups of clusters that can be drawn in +// the same draw call. A greedy algorithm that minimizes overdraw is used +// to group the clusters. +// +// Parameters: +// pClusterIDs +// NumVerts cluster ID's (extracted from a compressed buffer) +// pScene +// Mesh that represents composite scene passed to the simulator +// MaxNumClusters +// Maximum number of clusters allocated per super cluster +// NumClusters +// Number of clusters computed in the simulator +// pSuperClusterIDs +// Array of length NumClusters, contains index of super cluster +// that corresponding cluster was assigned to +// pNumSuperClusters +// Returns the number of super clusters allocated +// +//============================================================================ + +HRESULT WINAPI + D3DXSHPRTCompSuperCluster( + UINT *pClusterIDs, + LPD3DXMESH pScene, + UINT MaxNumClusters, + UINT NumClusters, + UINT *pSuperClusterIDs, + UINT *pNumSuperClusters); + +//============================================================================ +// +// D3DXSHPRTCompSplitMeshSC: +// ------------------------- +// Used with compressed results of the vertex version of the PRT simulator. +// After D3DXSHRTCompSuperCluster has been called this function can be used +// to split the mesh into a group of faces/vertices per super cluster. +// Each super cluster contains all of the faces that contain any vertex +// classified in one of its clusters. All of the vertices connected to this +// set of faces are also included with the returned array ppVertStatus +// indicating whether or not the vertex belongs to the supercluster. +// +// Parameters: +// pClusterIDs +// NumVerts cluster ID's (extracted from a compressed buffer) +// NumVertices +// Number of vertices in original mesh +// NumClusters +// Number of clusters (input parameter to compression) +// pSuperClusterIDs +// Array of size NumClusters that will contain super cluster ID's (from +// D3DXSHCompSuerCluster) +// NumSuperClusters +// Number of superclusters allocated in D3DXSHCompSuerCluster +// pInputIB +// Raw index buffer for mesh - format depends on bInputIBIs32Bit +// InputIBIs32Bit +// Indicates whether the input index buffer is 32-bit (otherwise 16-bit +// is assumed) +// NumFaces +// Number of faces in the original mesh (pInputIB is 3 times this length) +// ppIBData +// LPD3DXBUFFER holds raw index buffer that will contain the resulting split faces. +// Format determined by bIBIs32Bit. Allocated by function +// pIBDataLength +// Length of ppIBData, assigned in function +// OutputIBIs32Bit +// Indicates whether the output index buffer is to be 32-bit (otherwise +// 16-bit is assumed) +// ppFaceRemap +// LPD3DXBUFFER mapping of each face in ppIBData to original faces. Length is +// *pIBDataLength/3. Optional paramter, allocated in function +// ppVertData +// LPD3DXBUFFER contains new vertex data structure. Size of pVertDataLength +// pVertDataLength +// Number of new vertices in split mesh. Assigned in function +// pSCClusterList +// Array of length NumClusters which pSCData indexes into (Cluster* fields) +// for each SC, contains clusters sorted by super cluster +// pSCData +// Structure per super cluster - contains indices into ppIBData, +// pSCClusterList and ppVertData +// +//============================================================================ + +HRESULT WINAPI + D3DXSHPRTCompSplitMeshSC( + UINT *pClusterIDs, + UINT NumVertices, + UINT NumClusters, + UINT *pSuperClusterIDs, + UINT NumSuperClusters, + LPVOID pInputIB, + BOOL InputIBIs32Bit, + UINT NumFaces, + LPD3DXBUFFER *ppIBData, + UINT *pIBDataLength, + BOOL OutputIBIs32Bit, + LPD3DXBUFFER *ppFaceRemap, + LPD3DXBUFFER *ppVertData, + UINT *pVertDataLength, + UINT *pSCClusterList, + D3DXSHPRTSPLITMESHCLUSTERDATA *pSCData); + + +#ifdef __cplusplus +} +#endif //__cplusplus + +////////////////////////////////////////////////////////////////////////////// +// +// Definitions of .X file templates used by mesh load/save functions +// that are not RM standard +// +////////////////////////////////////////////////////////////////////////////// + +// {3CF169CE-FF7C-44ab-93C0-F78F62D172E2} +DEFINE_GUID(DXFILEOBJ_XSkinMeshHeader, +0x3cf169ce, 0xff7c, 0x44ab, 0x93, 0xc0, 0xf7, 0x8f, 0x62, 0xd1, 0x72, 0xe2); + +// {B8D65549-D7C9-4995-89CF-53A9A8B031E3} +DEFINE_GUID(DXFILEOBJ_VertexDuplicationIndices, +0xb8d65549, 0xd7c9, 0x4995, 0x89, 0xcf, 0x53, 0xa9, 0xa8, 0xb0, 0x31, 0xe3); + +// {A64C844A-E282-4756-8B80-250CDE04398C} +DEFINE_GUID(DXFILEOBJ_FaceAdjacency, +0xa64c844a, 0xe282, 0x4756, 0x8b, 0x80, 0x25, 0xc, 0xde, 0x4, 0x39, 0x8c); + +// {6F0D123B-BAD2-4167-A0D0-80224F25FABB} +DEFINE_GUID(DXFILEOBJ_SkinWeights, +0x6f0d123b, 0xbad2, 0x4167, 0xa0, 0xd0, 0x80, 0x22, 0x4f, 0x25, 0xfa, 0xbb); + +// {A3EB5D44-FC22-429d-9AFB-3221CB9719A6} +DEFINE_GUID(DXFILEOBJ_Patch, +0xa3eb5d44, 0xfc22, 0x429d, 0x9a, 0xfb, 0x32, 0x21, 0xcb, 0x97, 0x19, 0xa6); + +// {D02C95CC-EDBA-4305-9B5D-1820D7704BBF} +DEFINE_GUID(DXFILEOBJ_PatchMesh, +0xd02c95cc, 0xedba, 0x4305, 0x9b, 0x5d, 0x18, 0x20, 0xd7, 0x70, 0x4b, 0xbf); + +// {B9EC94E1-B9A6-4251-BA18-94893F02C0EA} +DEFINE_GUID(DXFILEOBJ_PatchMesh9, +0xb9ec94e1, 0xb9a6, 0x4251, 0xba, 0x18, 0x94, 0x89, 0x3f, 0x2, 0xc0, 0xea); + +// {B6C3E656-EC8B-4b92-9B62-681659522947} +DEFINE_GUID(DXFILEOBJ_PMInfo, +0xb6c3e656, 0xec8b, 0x4b92, 0x9b, 0x62, 0x68, 0x16, 0x59, 0x52, 0x29, 0x47); + +// {917E0427-C61E-4a14-9C64-AFE65F9E9844} +DEFINE_GUID(DXFILEOBJ_PMAttributeRange, +0x917e0427, 0xc61e, 0x4a14, 0x9c, 0x64, 0xaf, 0xe6, 0x5f, 0x9e, 0x98, 0x44); + +// {574CCC14-F0B3-4333-822D-93E8A8A08E4C} +DEFINE_GUID(DXFILEOBJ_PMVSplitRecord, +0x574ccc14, 0xf0b3, 0x4333, 0x82, 0x2d, 0x93, 0xe8, 0xa8, 0xa0, 0x8e, 0x4c); + +// {B6E70A0E-8EF9-4e83-94AD-ECC8B0C04897} +DEFINE_GUID(DXFILEOBJ_FVFData, +0xb6e70a0e, 0x8ef9, 0x4e83, 0x94, 0xad, 0xec, 0xc8, 0xb0, 0xc0, 0x48, 0x97); + +// {F752461C-1E23-48f6-B9F8-8350850F336F} +DEFINE_GUID(DXFILEOBJ_VertexElement, +0xf752461c, 0x1e23, 0x48f6, 0xb9, 0xf8, 0x83, 0x50, 0x85, 0xf, 0x33, 0x6f); + +// {BF22E553-292C-4781-9FEA-62BD554BDD93} +DEFINE_GUID(DXFILEOBJ_DeclData, +0xbf22e553, 0x292c, 0x4781, 0x9f, 0xea, 0x62, 0xbd, 0x55, 0x4b, 0xdd, 0x93); + +// {F1CFE2B3-0DE3-4e28-AFA1-155A750A282D} +DEFINE_GUID(DXFILEOBJ_EffectFloats, +0xf1cfe2b3, 0xde3, 0x4e28, 0xaf, 0xa1, 0x15, 0x5a, 0x75, 0xa, 0x28, 0x2d); + +// {D55B097E-BDB6-4c52-B03D-6051C89D0E42} +DEFINE_GUID(DXFILEOBJ_EffectString, +0xd55b097e, 0xbdb6, 0x4c52, 0xb0, 0x3d, 0x60, 0x51, 0xc8, 0x9d, 0xe, 0x42); + +// {622C0ED0-956E-4da9-908A-2AF94F3CE716} +DEFINE_GUID(DXFILEOBJ_EffectDWord, +0x622c0ed0, 0x956e, 0x4da9, 0x90, 0x8a, 0x2a, 0xf9, 0x4f, 0x3c, 0xe7, 0x16); + +// {3014B9A0-62F5-478c-9B86-E4AC9F4E418B} +DEFINE_GUID(DXFILEOBJ_EffectParamFloats, +0x3014b9a0, 0x62f5, 0x478c, 0x9b, 0x86, 0xe4, 0xac, 0x9f, 0x4e, 0x41, 0x8b); + +// {1DBC4C88-94C1-46ee-9076-2C28818C9481} +DEFINE_GUID(DXFILEOBJ_EffectParamString, +0x1dbc4c88, 0x94c1, 0x46ee, 0x90, 0x76, 0x2c, 0x28, 0x81, 0x8c, 0x94, 0x81); + +// {E13963BC-AE51-4c5d-B00F-CFA3A9D97CE5} +DEFINE_GUID(DXFILEOBJ_EffectParamDWord, +0xe13963bc, 0xae51, 0x4c5d, 0xb0, 0xf, 0xcf, 0xa3, 0xa9, 0xd9, 0x7c, 0xe5); + +// {E331F7E4-0559-4cc2-8E99-1CEC1657928F} +DEFINE_GUID(DXFILEOBJ_EffectInstance, +0xe331f7e4, 0x559, 0x4cc2, 0x8e, 0x99, 0x1c, 0xec, 0x16, 0x57, 0x92, 0x8f); + +// {9E415A43-7BA6-4a73-8743-B73D47E88476} +DEFINE_GUID(DXFILEOBJ_AnimTicksPerSecond, +0x9e415a43, 0x7ba6, 0x4a73, 0x87, 0x43, 0xb7, 0x3d, 0x47, 0xe8, 0x84, 0x76); + +// {7F9B00B3-F125-4890-876E-1CFFBF697C4D} +DEFINE_GUID(DXFILEOBJ_CompressedAnimationSet, +0x7f9b00b3, 0xf125, 0x4890, 0x87, 0x6e, 0x1c, 0x42, 0xbf, 0x69, 0x7c, 0x4d); + +#pragma pack(push, 1) +typedef struct _XFILECOMPRESSEDANIMATIONSET +{ + DWORD CompressedBlockSize; + FLOAT TicksPerSec; + DWORD PlaybackType; + DWORD BufferLength; +} XFILECOMPRESSEDANIMATIONSET; +#pragma pack(pop) + +#define XSKINEXP_TEMPLATES \ + "xof 0303txt 0032\ + template XSkinMeshHeader \ + { \ + <3CF169CE-FF7C-44ab-93C0-F78F62D172E2> \ + WORD nMaxSkinWeightsPerVertex; \ + WORD nMaxSkinWeightsPerFace; \ + WORD nBones; \ + } \ + template VertexDuplicationIndices \ + { \ + \ + DWORD nIndices; \ + DWORD nOriginalVertices; \ + array DWORD indices[nIndices]; \ + } \ + template FaceAdjacency \ + { \ + \ + DWORD nIndices; \ + array DWORD indices[nIndices]; \ + } \ + template SkinWeights \ + { \ + <6F0D123B-BAD2-4167-A0D0-80224F25FABB> \ + STRING transformNodeName; \ + DWORD nWeights; \ + array DWORD vertexIndices[nWeights]; \ + array float weights[nWeights]; \ + Matrix4x4 matrixOffset; \ + } \ + template Patch \ + { \ + \ + DWORD nControlIndices; \ + array DWORD controlIndices[nControlIndices]; \ + } \ + template PatchMesh \ + { \ + \ + DWORD nVertices; \ + array Vector vertices[nVertices]; \ + DWORD nPatches; \ + array Patch patches[nPatches]; \ + [ ... ] \ + } \ + template PatchMesh9 \ + { \ + \ + DWORD Type; \ + DWORD Degree; \ + DWORD Basis; \ + DWORD nVertices; \ + array Vector vertices[nVertices]; \ + DWORD nPatches; \ + array Patch patches[nPatches]; \ + [ ... ] \ + } " \ + "template EffectFloats \ + { \ + \ + DWORD nFloats; \ + array float Floats[nFloats]; \ + } \ + template EffectString \ + { \ + \ + STRING Value; \ + } \ + template EffectDWord \ + { \ + <622C0ED0-956E-4da9-908A-2AF94F3CE716> \ + DWORD Value; \ + } " \ + "template EffectParamFloats \ + { \ + <3014B9A0-62F5-478c-9B86-E4AC9F4E418B> \ + STRING ParamName; \ + DWORD nFloats; \ + array float Floats[nFloats]; \ + } " \ + "template EffectParamString \ + { \ + <1DBC4C88-94C1-46ee-9076-2C28818C9481> \ + STRING ParamName; \ + STRING Value; \ + } \ + template EffectParamDWord \ + { \ + \ + STRING ParamName; \ + DWORD Value; \ + } \ + template EffectInstance \ + { \ + \ + STRING EffectFilename; \ + [ ... ] \ + } " \ + "template AnimTicksPerSecond \ + { \ + <9E415A43-7BA6-4a73-8743-B73D47E88476> \ + DWORD AnimTicksPerSecond; \ + } \ + template CompressedAnimationSet \ + { \ + <7F9B00B3-F125-4890-876E-1C42BF697C4D> \ + DWORD CompressedBlockSize; \ + FLOAT TicksPerSec; \ + DWORD PlaybackType; \ + DWORD BufferLength; \ + array DWORD CompressedData[BufferLength]; \ + } " + +#define XEXTENSIONS_TEMPLATES \ + "xof 0303txt 0032\ + template FVFData \ + { \ + \ + DWORD dwFVF; \ + DWORD nDWords; \ + array DWORD data[nDWords]; \ + } \ + template VertexElement \ + { \ + \ + DWORD Type; \ + DWORD Method; \ + DWORD Usage; \ + DWORD UsageIndex; \ + } \ + template DeclData \ + { \ + \ + DWORD nElements; \ + array VertexElement Elements[nElements]; \ + DWORD nDWords; \ + array DWORD data[nDWords]; \ + } \ + template PMAttributeRange \ + { \ + <917E0427-C61E-4a14-9C64-AFE65F9E9844> \ + DWORD iFaceOffset; \ + DWORD nFacesMin; \ + DWORD nFacesMax; \ + DWORD iVertexOffset; \ + DWORD nVerticesMin; \ + DWORD nVerticesMax; \ + } \ + template PMVSplitRecord \ + { \ + <574CCC14-F0B3-4333-822D-93E8A8A08E4C> \ + DWORD iFaceCLW; \ + DWORD iVlrOffset; \ + DWORD iCode; \ + } \ + template PMInfo \ + { \ + \ + DWORD nAttributes; \ + array PMAttributeRange attributeRanges[nAttributes]; \ + DWORD nMaxValence; \ + DWORD nMinLogicalVertices; \ + DWORD nMaxLogicalVertices; \ + DWORD nVSplits; \ + array PMVSplitRecord splitRecords[nVSplits]; \ + DWORD nAttributeMispredicts; \ + array DWORD attributeMispredicts[nAttributeMispredicts]; \ + } " + +#endif //__D3DX9MESH_H__ + + diff --git a/MediaClient/MediaClient/directx/include/d3dx9shader.h b/MediaClient/MediaClient/directx/include/d3dx9shader.h new file mode 100644 index 0000000..5ed3f01 --- /dev/null +++ b/MediaClient/MediaClient/directx/include/d3dx9shader.h @@ -0,0 +1,1010 @@ +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// File: d3dx9shader.h +// Content: D3DX Shader APIs +// +////////////////////////////////////////////////////////////////////////////// + +#include "d3dx9.h" + +#ifndef __D3DX9SHADER_H__ +#define __D3DX9SHADER_H__ + + +//--------------------------------------------------------------------------- +// D3DXTX_VERSION: +// -------------- +// Version token used to create a procedural texture filler in effects +// Used by D3DXFill[]TX functions +//--------------------------------------------------------------------------- +#define D3DXTX_VERSION(_Major,_Minor) (('T' << 24) | ('X' << 16) | ((_Major) << 8) | (_Minor)) + + + +//---------------------------------------------------------------------------- +// D3DXSHADER flags: +// ----------------- +// D3DXSHADER_DEBUG +// Insert debug file/line/type/symbol information. +// +// D3DXSHADER_SKIPVALIDATION +// Do not validate the generated code against known capabilities and +// constraints. This option is only recommended when compiling shaders +// you KNOW will work. (ie. have compiled before without this option.) +// Shaders are always validated by D3D before they are set to the device. +// +// D3DXSHADER_SKIPOPTIMIZATION +// Instructs the compiler to skip optimization steps during code generation. +// Unless you are trying to isolate a problem in your code using this option +// is not recommended. +// +// D3DXSHADER_PACKMATRIX_ROWMAJOR +// Unless explicitly specified, matrices will be packed in row-major order +// on input and output from the shader. +// +// D3DXSHADER_PACKMATRIX_COLUMNMAJOR +// Unless explicitly specified, matrices will be packed in column-major +// order on input and output from the shader. This is generally more +// efficient, since it allows vector-matrix multiplication to be performed +// using a series of dot-products. +// +// D3DXSHADER_PARTIALPRECISION +// Force all computations in resulting shader to occur at partial precision. +// This may result in faster evaluation of shaders on some hardware. +// +// D3DXSHADER_FORCE_VS_SOFTWARE_NOOPT +// Force compiler to compile against the next highest available software +// target for vertex shaders. This flag also turns optimizations off, +// and debugging on. +// +// D3DXSHADER_FORCE_PS_SOFTWARE_NOOPT +// Force compiler to compile against the next highest available software +// target for pixel shaders. This flag also turns optimizations off, +// and debugging on. +// +// D3DXSHADER_NO_PRESHADER +// Disables Preshaders. Using this flag will cause the compiler to not +// pull out static expression for evaluation on the host cpu +// +// D3DXSHADER_AVOID_FLOW_CONTROL +// Hint compiler to avoid flow-control constructs where possible. +// +// D3DXSHADER_PREFER_FLOW_CONTROL +// Hint compiler to prefer flow-control constructs where possible. +// +//---------------------------------------------------------------------------- + +#define D3DXSHADER_DEBUG (1 << 0) +#define D3DXSHADER_SKIPVALIDATION (1 << 1) +#define D3DXSHADER_SKIPOPTIMIZATION (1 << 2) +#define D3DXSHADER_PACKMATRIX_ROWMAJOR (1 << 3) +#define D3DXSHADER_PACKMATRIX_COLUMNMAJOR (1 << 4) +#define D3DXSHADER_PARTIALPRECISION (1 << 5) +#define D3DXSHADER_FORCE_VS_SOFTWARE_NOOPT (1 << 6) +#define D3DXSHADER_FORCE_PS_SOFTWARE_NOOPT (1 << 7) +#define D3DXSHADER_NO_PRESHADER (1 << 8) +#define D3DXSHADER_AVOID_FLOW_CONTROL (1 << 9) +#define D3DXSHADER_PREFER_FLOW_CONTROL (1 << 10) +#define D3DXSHADER_ENABLE_BACKWARDS_COMPATIBILITY (1 << 12) +#define D3DXSHADER_IEEE_STRICTNESS (1 << 13) +#define D3DXSHADER_USE_LEGACY_D3DX9_31_DLL (1 << 16) + + +// optimization level flags +#define D3DXSHADER_OPTIMIZATION_LEVEL0 (1 << 14) +#define D3DXSHADER_OPTIMIZATION_LEVEL1 0 +#define D3DXSHADER_OPTIMIZATION_LEVEL2 ((1 << 14) | (1 << 15)) +#define D3DXSHADER_OPTIMIZATION_LEVEL3 (1 << 15) + + + +//---------------------------------------------------------------------------- +// D3DXCONSTTABLE flags: +// ------------------- + +#define D3DXCONSTTABLE_LARGEADDRESSAWARE (1 << 17) + + + +//---------------------------------------------------------------------------- +// D3DXHANDLE: +// ----------- +// Handle values used to efficiently reference shader and effect parameters. +// Strings can be used as handles. However, handles are not always strings. +//---------------------------------------------------------------------------- + +#ifndef D3DXFX_LARGEADDRESS_HANDLE +typedef LPCSTR D3DXHANDLE; +#else +typedef UINT_PTR D3DXHANDLE; +#endif +typedef D3DXHANDLE *LPD3DXHANDLE; + + +//---------------------------------------------------------------------------- +// D3DXMACRO: +// ---------- +// Preprocessor macro definition. The application pass in a NULL-terminated +// array of this structure to various D3DX APIs. This enables the application +// to #define tokens at runtime, before the file is parsed. +//---------------------------------------------------------------------------- + +typedef struct _D3DXMACRO +{ + LPCSTR Name; + LPCSTR Definition; + +} D3DXMACRO, *LPD3DXMACRO; + + +//---------------------------------------------------------------------------- +// D3DXSEMANTIC: +//---------------------------------------------------------------------------- + +typedef struct _D3DXSEMANTIC +{ + UINT Usage; + UINT UsageIndex; + +} D3DXSEMANTIC, *LPD3DXSEMANTIC; + + + +//---------------------------------------------------------------------------- +// D3DXREGISTER_SET: +//---------------------------------------------------------------------------- + +typedef enum _D3DXREGISTER_SET +{ + D3DXRS_BOOL, + D3DXRS_INT4, + D3DXRS_FLOAT4, + D3DXRS_SAMPLER, + + // force 32-bit size enum + D3DXRS_FORCE_DWORD = 0x7fffffff + +} D3DXREGISTER_SET, *LPD3DXREGISTER_SET; + + +//---------------------------------------------------------------------------- +// D3DXPARAMETER_CLASS: +//---------------------------------------------------------------------------- + +typedef enum _D3DXPARAMETER_CLASS +{ + D3DXPC_SCALAR, + D3DXPC_VECTOR, + D3DXPC_MATRIX_ROWS, + D3DXPC_MATRIX_COLUMNS, + D3DXPC_OBJECT, + D3DXPC_STRUCT, + + // force 32-bit size enum + D3DXPC_FORCE_DWORD = 0x7fffffff + +} D3DXPARAMETER_CLASS, *LPD3DXPARAMETER_CLASS; + + +//---------------------------------------------------------------------------- +// D3DXPARAMETER_TYPE: +//---------------------------------------------------------------------------- + +typedef enum _D3DXPARAMETER_TYPE +{ + D3DXPT_VOID, + D3DXPT_BOOL, + D3DXPT_INT, + D3DXPT_FLOAT, + D3DXPT_STRING, + D3DXPT_TEXTURE, + D3DXPT_TEXTURE1D, + D3DXPT_TEXTURE2D, + D3DXPT_TEXTURE3D, + D3DXPT_TEXTURECUBE, + D3DXPT_SAMPLER, + D3DXPT_SAMPLER1D, + D3DXPT_SAMPLER2D, + D3DXPT_SAMPLER3D, + D3DXPT_SAMPLERCUBE, + D3DXPT_PIXELSHADER, + D3DXPT_VERTEXSHADER, + D3DXPT_PIXELFRAGMENT, + D3DXPT_VERTEXFRAGMENT, + D3DXPT_UNSUPPORTED, + + // force 32-bit size enum + D3DXPT_FORCE_DWORD = 0x7fffffff + +} D3DXPARAMETER_TYPE, *LPD3DXPARAMETER_TYPE; + + +//---------------------------------------------------------------------------- +// D3DXCONSTANTTABLE_DESC: +//---------------------------------------------------------------------------- + +typedef struct _D3DXCONSTANTTABLE_DESC +{ + LPCSTR Creator; // Creator string + DWORD Version; // Shader version + UINT Constants; // Number of constants + +} D3DXCONSTANTTABLE_DESC, *LPD3DXCONSTANTTABLE_DESC; + + +//---------------------------------------------------------------------------- +// D3DXCONSTANT_DESC: +//---------------------------------------------------------------------------- + +typedef struct _D3DXCONSTANT_DESC +{ + LPCSTR Name; // Constant name + + D3DXREGISTER_SET RegisterSet; // Register set + UINT RegisterIndex; // Register index + UINT RegisterCount; // Number of registers occupied + + D3DXPARAMETER_CLASS Class; // Class + D3DXPARAMETER_TYPE Type; // Component type + + UINT Rows; // Number of rows + UINT Columns; // Number of columns + UINT Elements; // Number of array elements + UINT StructMembers; // Number of structure member sub-parameters + + UINT Bytes; // Data size, in bytes + LPCVOID DefaultValue; // Pointer to default value + +} D3DXCONSTANT_DESC, *LPD3DXCONSTANT_DESC; + + + +//---------------------------------------------------------------------------- +// ID3DXConstantTable: +//---------------------------------------------------------------------------- + +typedef interface ID3DXConstantTable ID3DXConstantTable; +typedef interface ID3DXConstantTable *LPD3DXCONSTANTTABLE; + +// {AB3C758F-093E-4356-B762-4DB18F1B3A01} +DEFINE_GUID(IID_ID3DXConstantTable, +0xab3c758f, 0x93e, 0x4356, 0xb7, 0x62, 0x4d, 0xb1, 0x8f, 0x1b, 0x3a, 0x1); + + +#undef INTERFACE +#define INTERFACE ID3DXConstantTable + +DECLARE_INTERFACE_(ID3DXConstantTable, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // Buffer + STDMETHOD_(LPVOID, GetBufferPointer)(THIS) PURE; + STDMETHOD_(DWORD, GetBufferSize)(THIS) PURE; + + // Descs + STDMETHOD(GetDesc)(THIS_ D3DXCONSTANTTABLE_DESC *pDesc) PURE; + STDMETHOD(GetConstantDesc)(THIS_ D3DXHANDLE hConstant, D3DXCONSTANT_DESC *pConstantDesc, UINT *pCount) PURE; + STDMETHOD_(UINT, GetSamplerIndex)(THIS_ D3DXHANDLE hConstant) PURE; + + // Handle operations + STDMETHOD_(D3DXHANDLE, GetConstant)(THIS_ D3DXHANDLE hConstant, UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetConstantByName)(THIS_ D3DXHANDLE hConstant, LPCSTR pName) PURE; + STDMETHOD_(D3DXHANDLE, GetConstantElement)(THIS_ D3DXHANDLE hConstant, UINT Index) PURE; + + // Set Constants + STDMETHOD(SetDefaults)(THIS_ LPDIRECT3DDEVICE9 pDevice) PURE; + STDMETHOD(SetValue)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, LPCVOID pData, UINT Bytes) PURE; + STDMETHOD(SetBool)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, BOOL b) PURE; + STDMETHOD(SetBoolArray)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST BOOL* pb, UINT Count) PURE; + STDMETHOD(SetInt)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, INT n) PURE; + STDMETHOD(SetIntArray)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST INT* pn, UINT Count) PURE; + STDMETHOD(SetFloat)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, FLOAT f) PURE; + STDMETHOD(SetFloatArray)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST FLOAT* pf, UINT Count) PURE; + STDMETHOD(SetVector)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST D3DXVECTOR4* pVector) PURE; + STDMETHOD(SetVectorArray)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST D3DXVECTOR4* pVector, UINT Count) PURE; + STDMETHOD(SetMatrix)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST D3DXMATRIX* pMatrix) PURE; + STDMETHOD(SetMatrixArray)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST D3DXMATRIX* pMatrix, UINT Count) PURE; + STDMETHOD(SetMatrixPointerArray)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST D3DXMATRIX** ppMatrix, UINT Count) PURE; + STDMETHOD(SetMatrixTranspose)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST D3DXMATRIX* pMatrix) PURE; + STDMETHOD(SetMatrixTransposeArray)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST D3DXMATRIX* pMatrix, UINT Count) PURE; + STDMETHOD(SetMatrixTransposePointerArray)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST D3DXMATRIX** ppMatrix, UINT Count) PURE; +}; + + +//---------------------------------------------------------------------------- +// ID3DXTextureShader: +//---------------------------------------------------------------------------- + +typedef interface ID3DXTextureShader ID3DXTextureShader; +typedef interface ID3DXTextureShader *LPD3DXTEXTURESHADER; + +// {3E3D67F8-AA7A-405d-A857-BA01D4758426} +DEFINE_GUID(IID_ID3DXTextureShader, +0x3e3d67f8, 0xaa7a, 0x405d, 0xa8, 0x57, 0xba, 0x1, 0xd4, 0x75, 0x84, 0x26); + +#undef INTERFACE +#define INTERFACE ID3DXTextureShader + +DECLARE_INTERFACE_(ID3DXTextureShader, IUnknown) +{ + // IUnknown + STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + // Gets + STDMETHOD(GetFunction)(THIS_ LPD3DXBUFFER *ppFunction) PURE; + STDMETHOD(GetConstantBuffer)(THIS_ LPD3DXBUFFER *ppConstantBuffer) PURE; + + // Descs + STDMETHOD(GetDesc)(THIS_ D3DXCONSTANTTABLE_DESC *pDesc) PURE; + STDMETHOD(GetConstantDesc)(THIS_ D3DXHANDLE hConstant, D3DXCONSTANT_DESC *pConstantDesc, UINT *pCount) PURE; + + // Handle operations + STDMETHOD_(D3DXHANDLE, GetConstant)(THIS_ D3DXHANDLE hConstant, UINT Index) PURE; + STDMETHOD_(D3DXHANDLE, GetConstantByName)(THIS_ D3DXHANDLE hConstant, LPCSTR pName) PURE; + STDMETHOD_(D3DXHANDLE, GetConstantElement)(THIS_ D3DXHANDLE hConstant, UINT Index) PURE; + + // Set Constants + STDMETHOD(SetDefaults)(THIS) PURE; + STDMETHOD(SetValue)(THIS_ D3DXHANDLE hConstant, LPCVOID pData, UINT Bytes) PURE; + STDMETHOD(SetBool)(THIS_ D3DXHANDLE hConstant, BOOL b) PURE; + STDMETHOD(SetBoolArray)(THIS_ D3DXHANDLE hConstant, CONST BOOL* pb, UINT Count) PURE; + STDMETHOD(SetInt)(THIS_ D3DXHANDLE hConstant, INT n) PURE; + STDMETHOD(SetIntArray)(THIS_ D3DXHANDLE hConstant, CONST INT* pn, UINT Count) PURE; + STDMETHOD(SetFloat)(THIS_ D3DXHANDLE hConstant, FLOAT f) PURE; + STDMETHOD(SetFloatArray)(THIS_ D3DXHANDLE hConstant, CONST FLOAT* pf, UINT Count) PURE; + STDMETHOD(SetVector)(THIS_ D3DXHANDLE hConstant, CONST D3DXVECTOR4* pVector) PURE; + STDMETHOD(SetVectorArray)(THIS_ D3DXHANDLE hConstant, CONST D3DXVECTOR4* pVector, UINT Count) PURE; + STDMETHOD(SetMatrix)(THIS_ D3DXHANDLE hConstant, CONST D3DXMATRIX* pMatrix) PURE; + STDMETHOD(SetMatrixArray)(THIS_ D3DXHANDLE hConstant, CONST D3DXMATRIX* pMatrix, UINT Count) PURE; + STDMETHOD(SetMatrixPointerArray)(THIS_ D3DXHANDLE hConstant, CONST D3DXMATRIX** ppMatrix, UINT Count) PURE; + STDMETHOD(SetMatrixTranspose)(THIS_ D3DXHANDLE hConstant, CONST D3DXMATRIX* pMatrix) PURE; + STDMETHOD(SetMatrixTransposeArray)(THIS_ D3DXHANDLE hConstant, CONST D3DXMATRIX* pMatrix, UINT Count) PURE; + STDMETHOD(SetMatrixTransposePointerArray)(THIS_ D3DXHANDLE hConstant, CONST D3DXMATRIX** ppMatrix, UINT Count) PURE; +}; + + +//---------------------------------------------------------------------------- +// D3DXINCLUDE_TYPE: +//---------------------------------------------------------------------------- + +typedef enum _D3DXINCLUDE_TYPE +{ + D3DXINC_LOCAL, + D3DXINC_SYSTEM, + + // force 32-bit size enum + D3DXINC_FORCE_DWORD = 0x7fffffff + +} D3DXINCLUDE_TYPE, *LPD3DXINCLUDE_TYPE; + + +//---------------------------------------------------------------------------- +// ID3DXInclude: +// ------------- +// This interface is intended to be implemented by the application, and can +// be used by various D3DX APIs. This enables application-specific handling +// of #include directives in source files. +// +// Open() +// Opens an include file. If successful, it should fill in ppData and +// pBytes. The data pointer returned must remain valid until Close is +// subsequently called. The name of the file is encoded in UTF-8 format. +// Close() +// Closes an include file. If Open was successful, Close is guaranteed +// to be called before the API using this interface returns. +//---------------------------------------------------------------------------- + +typedef interface ID3DXInclude ID3DXInclude; +typedef interface ID3DXInclude *LPD3DXINCLUDE; + +#undef INTERFACE +#define INTERFACE ID3DXInclude + +DECLARE_INTERFACE(ID3DXInclude) +{ + STDMETHOD(Open)(THIS_ D3DXINCLUDE_TYPE IncludeType, LPCSTR pFileName, LPCVOID pParentData, LPCVOID *ppData, UINT *pBytes) PURE; + STDMETHOD(Close)(THIS_ LPCVOID pData) PURE; +}; + + +////////////////////////////////////////////////////////////////////////////// +// APIs ////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + + +//---------------------------------------------------------------------------- +// D3DXAssembleShader: +// ------------------- +// Assembles a shader. +// +// Parameters: +// pSrcFile +// Source file name +// hSrcModule +// Module handle. if NULL, current module will be used +// pSrcResource +// Resource name in module +// pSrcData +// Pointer to source code +// SrcDataLen +// Size of source code, in bytes +// pDefines +// Optional NULL-terminated array of preprocessor macro definitions. +// pInclude +// Optional interface pointer to use for handling #include directives. +// If this parameter is NULL, #includes will be honored when assembling +// from file, and will error when assembling from resource or memory. +// Flags +// See D3DXSHADER_xxx flags +// ppShader +// Returns a buffer containing the created shader. This buffer contains +// the assembled shader code, as well as any embedded debug info. +// ppErrorMsgs +// Returns a buffer containing a listing of errors and warnings that were +// encountered during assembly. If you are running in a debugger, +// these are the same messages you will see in your debug output. +//---------------------------------------------------------------------------- + + +HRESULT WINAPI + D3DXAssembleShaderFromFileA( + LPCSTR pSrcFile, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + DWORD Flags, + LPD3DXBUFFER* ppShader, + LPD3DXBUFFER* ppErrorMsgs); + +HRESULT WINAPI + D3DXAssembleShaderFromFileW( + LPCWSTR pSrcFile, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + DWORD Flags, + LPD3DXBUFFER* ppShader, + LPD3DXBUFFER* ppErrorMsgs); + +#ifdef UNICODE +#define D3DXAssembleShaderFromFile D3DXAssembleShaderFromFileW +#else +#define D3DXAssembleShaderFromFile D3DXAssembleShaderFromFileA +#endif + + +HRESULT WINAPI + D3DXAssembleShaderFromResourceA( + HMODULE hSrcModule, + LPCSTR pSrcResource, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + DWORD Flags, + LPD3DXBUFFER* ppShader, + LPD3DXBUFFER* ppErrorMsgs); + +HRESULT WINAPI + D3DXAssembleShaderFromResourceW( + HMODULE hSrcModule, + LPCWSTR pSrcResource, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + DWORD Flags, + LPD3DXBUFFER* ppShader, + LPD3DXBUFFER* ppErrorMsgs); + +#ifdef UNICODE +#define D3DXAssembleShaderFromResource D3DXAssembleShaderFromResourceW +#else +#define D3DXAssembleShaderFromResource D3DXAssembleShaderFromResourceA +#endif + + +HRESULT WINAPI + D3DXAssembleShader( + LPCSTR pSrcData, + UINT SrcDataLen, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + DWORD Flags, + LPD3DXBUFFER* ppShader, + LPD3DXBUFFER* ppErrorMsgs); + + + +//---------------------------------------------------------------------------- +// D3DXCompileShader: +// ------------------ +// Compiles a shader. +// +// Parameters: +// pSrcFile +// Source file name. +// hSrcModule +// Module handle. if NULL, current module will be used. +// pSrcResource +// Resource name in module. +// pSrcData +// Pointer to source code. +// SrcDataLen +// Size of source code, in bytes. +// pDefines +// Optional NULL-terminated array of preprocessor macro definitions. +// pInclude +// Optional interface pointer to use for handling #include directives. +// If this parameter is NULL, #includes will be honored when compiling +// from file, and will error when compiling from resource or memory. +// pFunctionName +// Name of the entrypoint function where execution should begin. +// pProfile +// Instruction set to be used when generating code. Currently supported +// profiles are "vs_1_1", "vs_2_0", "vs_2_a", "vs_2_sw", "ps_1_1", +// "ps_1_2", "ps_1_3", "ps_1_4", "ps_2_0", "ps_2_a", "ps_2_sw", "tx_1_0" +// Flags +// See D3DXSHADER_xxx flags. +// ppShader +// Returns a buffer containing the created shader. This buffer contains +// the compiled shader code, as well as any embedded debug and symbol +// table info. (See D3DXGetShaderConstantTable) +// ppErrorMsgs +// Returns a buffer containing a listing of errors and warnings that were +// encountered during the compile. If you are running in a debugger, +// these are the same messages you will see in your debug output. +// ppConstantTable +// Returns a ID3DXConstantTable object which can be used to set +// shader constants to the device. Alternatively, an application can +// parse the D3DXSHADER_CONSTANTTABLE block embedded as a comment within +// the shader. +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXCompileShaderFromFileA( + LPCSTR pSrcFile, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + LPCSTR pFunctionName, + LPCSTR pProfile, + DWORD Flags, + LPD3DXBUFFER* ppShader, + LPD3DXBUFFER* ppErrorMsgs, + LPD3DXCONSTANTTABLE* ppConstantTable); + +HRESULT WINAPI + D3DXCompileShaderFromFileW( + LPCWSTR pSrcFile, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + LPCSTR pFunctionName, + LPCSTR pProfile, + DWORD Flags, + LPD3DXBUFFER* ppShader, + LPD3DXBUFFER* ppErrorMsgs, + LPD3DXCONSTANTTABLE* ppConstantTable); + +#ifdef UNICODE +#define D3DXCompileShaderFromFile D3DXCompileShaderFromFileW +#else +#define D3DXCompileShaderFromFile D3DXCompileShaderFromFileA +#endif + + +HRESULT WINAPI + D3DXCompileShaderFromResourceA( + HMODULE hSrcModule, + LPCSTR pSrcResource, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + LPCSTR pFunctionName, + LPCSTR pProfile, + DWORD Flags, + LPD3DXBUFFER* ppShader, + LPD3DXBUFFER* ppErrorMsgs, + LPD3DXCONSTANTTABLE* ppConstantTable); + +HRESULT WINAPI + D3DXCompileShaderFromResourceW( + HMODULE hSrcModule, + LPCWSTR pSrcResource, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + LPCSTR pFunctionName, + LPCSTR pProfile, + DWORD Flags, + LPD3DXBUFFER* ppShader, + LPD3DXBUFFER* ppErrorMsgs, + LPD3DXCONSTANTTABLE* ppConstantTable); + +#ifdef UNICODE +#define D3DXCompileShaderFromResource D3DXCompileShaderFromResourceW +#else +#define D3DXCompileShaderFromResource D3DXCompileShaderFromResourceA +#endif + + +HRESULT WINAPI + D3DXCompileShader( + LPCSTR pSrcData, + UINT SrcDataLen, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + LPCSTR pFunctionName, + LPCSTR pProfile, + DWORD Flags, + LPD3DXBUFFER* ppShader, + LPD3DXBUFFER* ppErrorMsgs, + LPD3DXCONSTANTTABLE* ppConstantTable); + + +//---------------------------------------------------------------------------- +// D3DXDisassembleShader: +// ---------------------- +// Takes a binary shader, and returns a buffer containing text assembly. +// +// Parameters: +// pShader +// Pointer to the shader byte code. +// ShaderSizeInBytes +// Size of the shader byte code in bytes. +// EnableColorCode +// Emit HTML tags for color coding the output? +// pComments +// Pointer to a comment string to include at the top of the shader. +// ppDisassembly +// Returns a buffer containing the disassembled shader. +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXDisassembleShader( + CONST DWORD* pShader, + BOOL EnableColorCode, + LPCSTR pComments, + LPD3DXBUFFER* ppDisassembly); + + +//---------------------------------------------------------------------------- +// D3DXGetPixelShaderProfile/D3DXGetVertexShaderProfile: +// ----------------------------------------------------- +// Returns the name of the HLSL profile best suited to a given device. +// +// Parameters: +// pDevice +// Pointer to the device in question +//---------------------------------------------------------------------------- + +LPCSTR WINAPI + D3DXGetPixelShaderProfile( + LPDIRECT3DDEVICE9 pDevice); + +LPCSTR WINAPI + D3DXGetVertexShaderProfile( + LPDIRECT3DDEVICE9 pDevice); + + +//---------------------------------------------------------------------------- +// D3DXFindShaderComment: +// ---------------------- +// Searches through a shader for a particular comment, denoted by a FourCC in +// the first DWORD of the comment. If the comment is not found, and no other +// error has occurred, S_FALSE is returned. +// +// Parameters: +// pFunction +// Pointer to the function DWORD stream +// FourCC +// FourCC used to identify the desired comment block. +// ppData +// Returns a pointer to the comment data (not including comment token +// and FourCC). Can be NULL. +// pSizeInBytes +// Returns the size of the comment data in bytes. Can be NULL. +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXFindShaderComment( + CONST DWORD* pFunction, + DWORD FourCC, + LPCVOID* ppData, + UINT* pSizeInBytes); + + +//---------------------------------------------------------------------------- +// D3DXGetShaderSize: +// ------------------ +// Returns the size of the shader byte-code, in bytes. +// +// Parameters: +// pFunction +// Pointer to the function DWORD stream +//---------------------------------------------------------------------------- + +UINT WINAPI + D3DXGetShaderSize( + CONST DWORD* pFunction); + + +//---------------------------------------------------------------------------- +// D3DXGetShaderVersion: +// ----------------------- +// Returns the shader version of a given shader. Returns zero if the shader +// function is NULL. +// +// Parameters: +// pFunction +// Pointer to the function DWORD stream +//---------------------------------------------------------------------------- + +DWORD WINAPI + D3DXGetShaderVersion( + CONST DWORD* pFunction); + +//---------------------------------------------------------------------------- +// D3DXGetShaderSemantics: +// ----------------------- +// Gets semantics for all input elements referenced inside a given shader. +// +// Parameters: +// pFunction +// Pointer to the function DWORD stream +// pSemantics +// Pointer to an array of D3DXSEMANTIC structures. The function will +// fill this array with the semantics for each input element referenced +// inside the shader. This array is assumed to contain at least +// MAXD3DDECLLENGTH elements. +// pCount +// Returns the number of elements referenced by the shader +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXGetShaderInputSemantics( + CONST DWORD* pFunction, + D3DXSEMANTIC* pSemantics, + UINT* pCount); + +HRESULT WINAPI + D3DXGetShaderOutputSemantics( + CONST DWORD* pFunction, + D3DXSEMANTIC* pSemantics, + UINT* pCount); + + +//---------------------------------------------------------------------------- +// D3DXGetShaderSamplers: +// ---------------------- +// Gets semantics for all input elements referenced inside a given shader. +// +// pFunction +// Pointer to the function DWORD stream +// pSamplers +// Pointer to an array of LPCSTRs. The function will fill this array +// with pointers to the sampler names contained within pFunction, for +// each sampler referenced inside the shader. This array is assumed to +// contain at least 16 elements. +// pCount +// Returns the number of samplers referenced by the shader +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXGetShaderSamplers( + CONST DWORD* pFunction, + LPCSTR* pSamplers, + UINT* pCount); + + +//---------------------------------------------------------------------------- +// D3DXGetShaderConstantTable: +// --------------------------- +// Gets shader constant table embedded inside shader. A constant table is +// generated by D3DXAssembleShader and D3DXCompileShader, and is embedded in +// the body of the shader. +// +// Parameters: +// pFunction +// Pointer to the function DWORD stream +// Flags +// See D3DXCONSTTABLE_xxx +// ppConstantTable +// Returns a ID3DXConstantTable object which can be used to set +// shader constants to the device. Alternatively, an application can +// parse the D3DXSHADER_CONSTANTTABLE block embedded as a comment within +// the shader. +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXGetShaderConstantTable( + CONST DWORD* pFunction, + LPD3DXCONSTANTTABLE* ppConstantTable); + +HRESULT WINAPI + D3DXGetShaderConstantTableEx( + CONST DWORD* pFunction, + DWORD Flags, + LPD3DXCONSTANTTABLE* ppConstantTable); + + + +//---------------------------------------------------------------------------- +// D3DXCreateTextureShader: +// ------------------------ +// Creates a texture shader object, given the compiled shader. +// +// Parameters +// pFunction +// Pointer to the function DWORD stream +// ppTextureShader +// Returns a ID3DXTextureShader object which can be used to procedurally +// fill the contents of a texture using the D3DXFillTextureTX functions. +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXCreateTextureShader( + CONST DWORD* pFunction, + LPD3DXTEXTURESHADER* ppTextureShader); + + +//---------------------------------------------------------------------------- +// D3DXPreprocessShader: +// --------------------- +// Runs the preprocessor on the specified shader or effect, but does +// not actually compile it. This is useful for evaluating the #includes +// and #defines in a shader and then emitting a reformatted token stream +// for debugging purposes or for generating a self-contained shader. +// +// Parameters: +// pSrcFile +// Source file name +// hSrcModule +// Module handle. if NULL, current module will be used +// pSrcResource +// Resource name in module +// pSrcData +// Pointer to source code +// SrcDataLen +// Size of source code, in bytes +// pDefines +// Optional NULL-terminated array of preprocessor macro definitions. +// pInclude +// Optional interface pointer to use for handling #include directives. +// If this parameter is NULL, #includes will be honored when assembling +// from file, and will error when assembling from resource or memory. +// ppShaderText +// Returns a buffer containing a single large string that represents +// the resulting formatted token stream +// ppErrorMsgs +// Returns a buffer containing a listing of errors and warnings that were +// encountered during assembly. If you are running in a debugger, +// these are the same messages you will see in your debug output. +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXPreprocessShaderFromFileA( + LPCSTR pSrcFile, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + LPD3DXBUFFER* ppShaderText, + LPD3DXBUFFER* ppErrorMsgs); + +HRESULT WINAPI + D3DXPreprocessShaderFromFileW( + LPCWSTR pSrcFile, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + LPD3DXBUFFER* ppShaderText, + LPD3DXBUFFER* ppErrorMsgs); + +#ifdef UNICODE +#define D3DXPreprocessShaderFromFile D3DXPreprocessShaderFromFileW +#else +#define D3DXPreprocessShaderFromFile D3DXPreprocessShaderFromFileA +#endif + +HRESULT WINAPI + D3DXPreprocessShaderFromResourceA( + HMODULE hSrcModule, + LPCSTR pSrcResource, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + LPD3DXBUFFER* ppShaderText, + LPD3DXBUFFER* ppErrorMsgs); + +HRESULT WINAPI + D3DXPreprocessShaderFromResourceW( + HMODULE hSrcModule, + LPCWSTR pSrcResource, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + LPD3DXBUFFER* ppShaderText, + LPD3DXBUFFER* ppErrorMsgs); + +#ifdef UNICODE +#define D3DXPreprocessShaderFromResource D3DXPreprocessShaderFromResourceW +#else +#define D3DXPreprocessShaderFromResource D3DXPreprocessShaderFromResourceA +#endif + +HRESULT WINAPI + D3DXPreprocessShader( + LPCSTR pSrcData, + UINT SrcDataSize, + CONST D3DXMACRO* pDefines, + LPD3DXINCLUDE pInclude, + LPD3DXBUFFER* ppShaderText, + LPD3DXBUFFER* ppErrorMsgs); + + +#ifdef __cplusplus +} +#endif //__cplusplus + + +////////////////////////////////////////////////////////////////////////////// +// Shader comment block layouts ////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +//---------------------------------------------------------------------------- +// D3DXSHADER_CONSTANTTABLE: +// ------------------------- +// Shader constant information; included as an CTAB comment block inside +// shaders. All offsets are BYTE offsets from start of CONSTANTTABLE struct. +// Entries in the table are sorted by Name in ascending order. +//---------------------------------------------------------------------------- + +typedef struct _D3DXSHADER_CONSTANTTABLE +{ + DWORD Size; // sizeof(D3DXSHADER_CONSTANTTABLE) + DWORD Creator; // LPCSTR offset + DWORD Version; // shader version + DWORD Constants; // number of constants + DWORD ConstantInfo; // D3DXSHADER_CONSTANTINFO[Constants] offset + DWORD Flags; // flags shader was compiled with + DWORD Target; // LPCSTR offset + +} D3DXSHADER_CONSTANTTABLE, *LPD3DXSHADER_CONSTANTTABLE; + + +typedef struct _D3DXSHADER_CONSTANTINFO +{ + DWORD Name; // LPCSTR offset + WORD RegisterSet; // D3DXREGISTER_SET + WORD RegisterIndex; // register number + WORD RegisterCount; // number of registers + WORD Reserved; // reserved + DWORD TypeInfo; // D3DXSHADER_TYPEINFO offset + DWORD DefaultValue; // offset of default value + +} D3DXSHADER_CONSTANTINFO, *LPD3DXSHADER_CONSTANTINFO; + + +typedef struct _D3DXSHADER_TYPEINFO +{ + WORD Class; // D3DXPARAMETER_CLASS + WORD Type; // D3DXPARAMETER_TYPE + WORD Rows; // number of rows (matrices) + WORD Columns; // number of columns (vectors and matrices) + WORD Elements; // array dimension + WORD StructMembers; // number of struct members + DWORD StructMemberInfo; // D3DXSHADER_STRUCTMEMBERINFO[Members] offset + +} D3DXSHADER_TYPEINFO, *LPD3DXSHADER_TYPEINFO; + + +typedef struct _D3DXSHADER_STRUCTMEMBERINFO +{ + DWORD Name; // LPCSTR offset + DWORD TypeInfo; // D3DXSHADER_TYPEINFO offset + +} D3DXSHADER_STRUCTMEMBERINFO, *LPD3DXSHADER_STRUCTMEMBERINFO; + + + +#endif //__D3DX9SHADER_H__ + diff --git a/MediaClient/MediaClient/directx/include/d3dx9shape.h b/MediaClient/MediaClient/directx/include/d3dx9shape.h new file mode 100644 index 0000000..4c23091 --- /dev/null +++ b/MediaClient/MediaClient/directx/include/d3dx9shape.h @@ -0,0 +1,221 @@ +/////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx9shapes.h +// Content: D3DX simple shapes +// +/////////////////////////////////////////////////////////////////////////// + +#include "d3dx9.h" + +#ifndef __D3DX9SHAPES_H__ +#define __D3DX9SHAPES_H__ + +/////////////////////////////////////////////////////////////////////////// +// Functions: +/////////////////////////////////////////////////////////////////////////// + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + + +//------------------------------------------------------------------------- +// D3DXCreatePolygon: +// ------------------ +// Creates a mesh containing an n-sided polygon. The polygon is centered +// at the origin. +// +// Parameters: +// +// pDevice The D3D device with which the mesh is going to be used. +// Length Length of each side. +// Sides Number of sides the polygon has. (Must be >= 3) +// ppMesh The mesh object which will be created +// ppAdjacency Returns a buffer containing adjacency info. Can be NULL. +//------------------------------------------------------------------------- +HRESULT WINAPI + D3DXCreatePolygon( + LPDIRECT3DDEVICE9 pDevice, + FLOAT Length, + UINT Sides, + LPD3DXMESH* ppMesh, + LPD3DXBUFFER* ppAdjacency); + + +//------------------------------------------------------------------------- +// D3DXCreateBox: +// -------------- +// Creates a mesh containing an axis-aligned box. The box is centered at +// the origin. +// +// Parameters: +// +// pDevice The D3D device with which the mesh is going to be used. +// Width Width of box (along X-axis) +// Height Height of box (along Y-axis) +// Depth Depth of box (along Z-axis) +// ppMesh The mesh object which will be created +// ppAdjacency Returns a buffer containing adjacency info. Can be NULL. +//------------------------------------------------------------------------- +HRESULT WINAPI + D3DXCreateBox( + LPDIRECT3DDEVICE9 pDevice, + FLOAT Width, + FLOAT Height, + FLOAT Depth, + LPD3DXMESH* ppMesh, + LPD3DXBUFFER* ppAdjacency); + + +//------------------------------------------------------------------------- +// D3DXCreateCylinder: +// ------------------- +// Creates a mesh containing a cylinder. The generated cylinder is +// centered at the origin, and its axis is aligned with the Z-axis. +// +// Parameters: +// +// pDevice The D3D device with which the mesh is going to be used. +// Radius1 Radius at -Z end (should be >= 0.0f) +// Radius2 Radius at +Z end (should be >= 0.0f) +// Length Length of cylinder (along Z-axis) +// Slices Number of slices about the main axis +// Stacks Number of stacks along the main axis +// ppMesh The mesh object which will be created +// ppAdjacency Returns a buffer containing adjacency info. Can be NULL. +//------------------------------------------------------------------------- +HRESULT WINAPI + D3DXCreateCylinder( + LPDIRECT3DDEVICE9 pDevice, + FLOAT Radius1, + FLOAT Radius2, + FLOAT Length, + UINT Slices, + UINT Stacks, + LPD3DXMESH* ppMesh, + LPD3DXBUFFER* ppAdjacency); + + +//------------------------------------------------------------------------- +// D3DXCreateSphere: +// ----------------- +// Creates a mesh containing a sphere. The sphere is centered at the +// origin. +// +// Parameters: +// +// pDevice The D3D device with which the mesh is going to be used. +// Radius Radius of the sphere (should be >= 0.0f) +// Slices Number of slices about the main axis +// Stacks Number of stacks along the main axis +// ppMesh The mesh object which will be created +// ppAdjacency Returns a buffer containing adjacency info. Can be NULL. +//------------------------------------------------------------------------- +HRESULT WINAPI + D3DXCreateSphere( + LPDIRECT3DDEVICE9 pDevice, + FLOAT Radius, + UINT Slices, + UINT Stacks, + LPD3DXMESH* ppMesh, + LPD3DXBUFFER* ppAdjacency); + + +//------------------------------------------------------------------------- +// D3DXCreateTorus: +// ---------------- +// Creates a mesh containing a torus. The generated torus is centered at +// the origin, and its axis is aligned with the Z-axis. +// +// Parameters: +// +// pDevice The D3D device with which the mesh is going to be used. +// InnerRadius Inner radius of the torus (should be >= 0.0f) +// OuterRadius Outer radius of the torue (should be >= 0.0f) +// Sides Number of sides in a cross-section (must be >= 3) +// Rings Number of rings making up the torus (must be >= 3) +// ppMesh The mesh object which will be created +// ppAdjacency Returns a buffer containing adjacency info. Can be NULL. +//------------------------------------------------------------------------- +HRESULT WINAPI + D3DXCreateTorus( + LPDIRECT3DDEVICE9 pDevice, + FLOAT InnerRadius, + FLOAT OuterRadius, + UINT Sides, + UINT Rings, + LPD3DXMESH* ppMesh, + LPD3DXBUFFER* ppAdjacency); + + +//------------------------------------------------------------------------- +// D3DXCreateTeapot: +// ----------------- +// Creates a mesh containing a teapot. +// +// Parameters: +// +// pDevice The D3D device with which the mesh is going to be used. +// ppMesh The mesh object which will be created +// ppAdjacency Returns a buffer containing adjacency info. Can be NULL. +//------------------------------------------------------------------------- +HRESULT WINAPI + D3DXCreateTeapot( + LPDIRECT3DDEVICE9 pDevice, + LPD3DXMESH* ppMesh, + LPD3DXBUFFER* ppAdjacency); + + +//------------------------------------------------------------------------- +// D3DXCreateText: +// --------------- +// Creates a mesh containing the specified text using the font associated +// with the device context. +// +// Parameters: +// +// pDevice The D3D device with which the mesh is going to be used. +// hDC Device context, with desired font selected +// pText Text to generate +// Deviation Maximum chordal deviation from true font outlines +// Extrusion Amount to extrude text in -Z direction +// ppMesh The mesh object which will be created +// pGlyphMetrics Address of buffer to receive glyph metric data (or NULL) +//------------------------------------------------------------------------- +HRESULT WINAPI + D3DXCreateTextA( + LPDIRECT3DDEVICE9 pDevice, + HDC hDC, + LPCSTR pText, + FLOAT Deviation, + FLOAT Extrusion, + LPD3DXMESH* ppMesh, + LPD3DXBUFFER* ppAdjacency, + LPGLYPHMETRICSFLOAT pGlyphMetrics); + +HRESULT WINAPI + D3DXCreateTextW( + LPDIRECT3DDEVICE9 pDevice, + HDC hDC, + LPCWSTR pText, + FLOAT Deviation, + FLOAT Extrusion, + LPD3DXMESH* ppMesh, + LPD3DXBUFFER* ppAdjacency, + LPGLYPHMETRICSFLOAT pGlyphMetrics); + +#ifdef UNICODE +#define D3DXCreateText D3DXCreateTextW +#else +#define D3DXCreateText D3DXCreateTextA +#endif + + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif //__D3DX9SHAPES_H__ + diff --git a/MediaClient/MediaClient/directx/include/d3dx9tex.h b/MediaClient/MediaClient/directx/include/d3dx9tex.h new file mode 100644 index 0000000..c4b6510 --- /dev/null +++ b/MediaClient/MediaClient/directx/include/d3dx9tex.h @@ -0,0 +1,1735 @@ +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx9tex.h +// Content: D3DX texturing APIs +// +////////////////////////////////////////////////////////////////////////////// + +#include "d3dx9.h" + +#ifndef __D3DX9TEX_H__ +#define __D3DX9TEX_H__ + + +//---------------------------------------------------------------------------- +// D3DX_FILTER flags: +// ------------------ +// +// A valid filter must contain one of these values: +// +// D3DX_FILTER_NONE +// No scaling or filtering will take place. Pixels outside the bounds +// of the source image are assumed to be transparent black. +// D3DX_FILTER_POINT +// Each destination pixel is computed by sampling the nearest pixel +// from the source image. +// D3DX_FILTER_LINEAR +// Each destination pixel is computed by linearly interpolating between +// the nearest pixels in the source image. This filter works best +// when the scale on each axis is less than 2. +// D3DX_FILTER_TRIANGLE +// Every pixel in the source image contributes equally to the +// destination image. This is the slowest of all the filters. +// D3DX_FILTER_BOX +// Each pixel is computed by averaging a 2x2(x2) box pixels from +// the source image. Only works when the dimensions of the +// destination are half those of the source. (as with mip maps) +// +// And can be OR'd with any of these optional flags: +// +// D3DX_FILTER_MIRROR_U +// Indicates that pixels off the edge of the texture on the U-axis +// should be mirrored, not wraped. +// D3DX_FILTER_MIRROR_V +// Indicates that pixels off the edge of the texture on the V-axis +// should be mirrored, not wraped. +// D3DX_FILTER_MIRROR_W +// Indicates that pixels off the edge of the texture on the W-axis +// should be mirrored, not wraped. +// D3DX_FILTER_MIRROR +// Same as specifying D3DX_FILTER_MIRROR_U | D3DX_FILTER_MIRROR_V | +// D3DX_FILTER_MIRROR_V +// D3DX_FILTER_DITHER +// Dithers the resulting image using a 4x4 order dither pattern. +// D3DX_FILTER_SRGB_IN +// Denotes that the input data is in sRGB (gamma 2.2) colorspace. +// D3DX_FILTER_SRGB_OUT +// Denotes that the output data is in sRGB (gamma 2.2) colorspace. +// D3DX_FILTER_SRGB +// Same as specifying D3DX_FILTER_SRGB_IN | D3DX_FILTER_SRGB_OUT +// +//---------------------------------------------------------------------------- + +#define D3DX_FILTER_NONE (1 << 0) +#define D3DX_FILTER_POINT (2 << 0) +#define D3DX_FILTER_LINEAR (3 << 0) +#define D3DX_FILTER_TRIANGLE (4 << 0) +#define D3DX_FILTER_BOX (5 << 0) + +#define D3DX_FILTER_MIRROR_U (1 << 16) +#define D3DX_FILTER_MIRROR_V (2 << 16) +#define D3DX_FILTER_MIRROR_W (4 << 16) +#define D3DX_FILTER_MIRROR (7 << 16) + +#define D3DX_FILTER_DITHER (1 << 19) +#define D3DX_FILTER_DITHER_DIFFUSION (2 << 19) + +#define D3DX_FILTER_SRGB_IN (1 << 21) +#define D3DX_FILTER_SRGB_OUT (2 << 21) +#define D3DX_FILTER_SRGB (3 << 21) + + +//----------------------------------------------------------------------------- +// D3DX_SKIP_DDS_MIP_LEVELS is used to skip mip levels when loading a DDS file: +//----------------------------------------------------------------------------- + +#define D3DX_SKIP_DDS_MIP_LEVELS_MASK 0x1F +#define D3DX_SKIP_DDS_MIP_LEVELS_SHIFT 26 +#define D3DX_SKIP_DDS_MIP_LEVELS(levels, filter) ((((levels) & D3DX_SKIP_DDS_MIP_LEVELS_MASK) << D3DX_SKIP_DDS_MIP_LEVELS_SHIFT) | ((filter) == D3DX_DEFAULT ? D3DX_FILTER_BOX : (filter))) + + + + +//---------------------------------------------------------------------------- +// D3DX_NORMALMAP flags: +// --------------------- +// These flags are used to control how D3DXComputeNormalMap generates normal +// maps. Any number of these flags may be OR'd together in any combination. +// +// D3DX_NORMALMAP_MIRROR_U +// Indicates that pixels off the edge of the texture on the U-axis +// should be mirrored, not wraped. +// D3DX_NORMALMAP_MIRROR_V +// Indicates that pixels off the edge of the texture on the V-axis +// should be mirrored, not wraped. +// D3DX_NORMALMAP_MIRROR +// Same as specifying D3DX_NORMALMAP_MIRROR_U | D3DX_NORMALMAP_MIRROR_V +// D3DX_NORMALMAP_INVERTSIGN +// Inverts the direction of each normal +// D3DX_NORMALMAP_COMPUTE_OCCLUSION +// Compute the per pixel Occlusion term and encodes it into the alpha. +// An Alpha of 1 means that the pixel is not obscured in anyway, and +// an alpha of 0 would mean that the pixel is completly obscured. +// +//---------------------------------------------------------------------------- + +//---------------------------------------------------------------------------- + +#define D3DX_NORMALMAP_MIRROR_U (1 << 16) +#define D3DX_NORMALMAP_MIRROR_V (2 << 16) +#define D3DX_NORMALMAP_MIRROR (3 << 16) +#define D3DX_NORMALMAP_INVERTSIGN (8 << 16) +#define D3DX_NORMALMAP_COMPUTE_OCCLUSION (16 << 16) + + + + +//---------------------------------------------------------------------------- +// D3DX_CHANNEL flags: +// ------------------- +// These flags are used by functions which operate on or more channels +// in a texture. +// +// D3DX_CHANNEL_RED +// Indicates the red channel should be used +// D3DX_CHANNEL_BLUE +// Indicates the blue channel should be used +// D3DX_CHANNEL_GREEN +// Indicates the green channel should be used +// D3DX_CHANNEL_ALPHA +// Indicates the alpha channel should be used +// D3DX_CHANNEL_LUMINANCE +// Indicates the luminaces of the red green and blue channels should be +// used. +// +//---------------------------------------------------------------------------- + +#define D3DX_CHANNEL_RED (1 << 0) +#define D3DX_CHANNEL_BLUE (1 << 1) +#define D3DX_CHANNEL_GREEN (1 << 2) +#define D3DX_CHANNEL_ALPHA (1 << 3) +#define D3DX_CHANNEL_LUMINANCE (1 << 4) + + + + +//---------------------------------------------------------------------------- +// D3DXIMAGE_FILEFORMAT: +// --------------------- +// This enum is used to describe supported image file formats. +// +//---------------------------------------------------------------------------- + +typedef enum _D3DXIMAGE_FILEFORMAT +{ + D3DXIFF_BMP = 0, + D3DXIFF_JPG = 1, + D3DXIFF_TGA = 2, + D3DXIFF_PNG = 3, + D3DXIFF_DDS = 4, + D3DXIFF_PPM = 5, + D3DXIFF_DIB = 6, + D3DXIFF_HDR = 7, //high dynamic range formats + D3DXIFF_PFM = 8, // + D3DXIFF_FORCE_DWORD = 0x7fffffff + +} D3DXIMAGE_FILEFORMAT; + + +//---------------------------------------------------------------------------- +// LPD3DXFILL2D and LPD3DXFILL3D: +// ------------------------------ +// Function types used by the texture fill functions. +// +// Parameters: +// pOut +// Pointer to a vector which the function uses to return its result. +// X,Y,Z,W will be mapped to R,G,B,A respectivly. +// pTexCoord +// Pointer to a vector containing the coordinates of the texel currently +// being evaluated. Textures and VolumeTexture texcoord components +// range from 0 to 1. CubeTexture texcoord component range from -1 to 1. +// pTexelSize +// Pointer to a vector containing the dimensions of the current texel. +// pData +// Pointer to user data. +// +//---------------------------------------------------------------------------- + +typedef VOID (WINAPI *LPD3DXFILL2D)(D3DXVECTOR4 *pOut, + CONST D3DXVECTOR2 *pTexCoord, CONST D3DXVECTOR2 *pTexelSize, LPVOID pData); + +typedef VOID (WINAPI *LPD3DXFILL3D)(D3DXVECTOR4 *pOut, + CONST D3DXVECTOR3 *pTexCoord, CONST D3DXVECTOR3 *pTexelSize, LPVOID pData); + + + +//---------------------------------------------------------------------------- +// D3DXIMAGE_INFO: +// --------------- +// This structure is used to return a rough description of what the +// the original contents of an image file looked like. +// +// Width +// Width of original image in pixels +// Height +// Height of original image in pixels +// Depth +// Depth of original image in pixels +// MipLevels +// Number of mip levels in original image +// Format +// D3D format which most closely describes the data in original image +// ResourceType +// D3DRESOURCETYPE representing the type of texture stored in the file. +// D3DRTYPE_TEXTURE, D3DRTYPE_VOLUMETEXTURE, or D3DRTYPE_CUBETEXTURE. +// ImageFileFormat +// D3DXIMAGE_FILEFORMAT representing the format of the image file. +// +//---------------------------------------------------------------------------- + +typedef struct _D3DXIMAGE_INFO +{ + UINT Width; + UINT Height; + UINT Depth; + UINT MipLevels; + D3DFORMAT Format; + D3DRESOURCETYPE ResourceType; + D3DXIMAGE_FILEFORMAT ImageFileFormat; + +} D3DXIMAGE_INFO; + + + + + +#ifdef __cplusplus +extern "C" { +#endif //__cplusplus + + + +////////////////////////////////////////////////////////////////////////////// +// Image File APIs /////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// +; +//---------------------------------------------------------------------------- +// GetImageInfoFromFile/Resource: +// ------------------------------ +// Fills in a D3DXIMAGE_INFO struct with information about an image file. +// +// Parameters: +// pSrcFile +// File name of the source image. +// pSrcModule +// Module where resource is located, or NULL for module associated +// with image the os used to create the current process. +// pSrcResource +// Resource name +// pSrcData +// Pointer to file in memory. +// SrcDataSize +// Size in bytes of file in memory. +// pSrcInfo +// Pointer to a D3DXIMAGE_INFO structure to be filled in with the +// description of the data in the source image file. +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXGetImageInfoFromFileA( + LPCSTR pSrcFile, + D3DXIMAGE_INFO* pSrcInfo); + +HRESULT WINAPI + D3DXGetImageInfoFromFileW( + LPCWSTR pSrcFile, + D3DXIMAGE_INFO* pSrcInfo); + +#ifdef UNICODE +#define D3DXGetImageInfoFromFile D3DXGetImageInfoFromFileW +#else +#define D3DXGetImageInfoFromFile D3DXGetImageInfoFromFileA +#endif + + +HRESULT WINAPI + D3DXGetImageInfoFromResourceA( + HMODULE hSrcModule, + LPCSTR pSrcResource, + D3DXIMAGE_INFO* pSrcInfo); + +HRESULT WINAPI + D3DXGetImageInfoFromResourceW( + HMODULE hSrcModule, + LPCWSTR pSrcResource, + D3DXIMAGE_INFO* pSrcInfo); + +#ifdef UNICODE +#define D3DXGetImageInfoFromResource D3DXGetImageInfoFromResourceW +#else +#define D3DXGetImageInfoFromResource D3DXGetImageInfoFromResourceA +#endif + + +HRESULT WINAPI + D3DXGetImageInfoFromFileInMemory( + LPCVOID pSrcData, + UINT SrcDataSize, + D3DXIMAGE_INFO* pSrcInfo); + + + + +////////////////////////////////////////////////////////////////////////////// +// Load/Save Surface APIs //////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +//---------------------------------------------------------------------------- +// D3DXLoadSurfaceFromFile/Resource: +// --------------------------------- +// Load surface from a file or resource +// +// Parameters: +// pDestSurface +// Destination surface, which will receive the image. +// pDestPalette +// Destination palette of 256 colors, or NULL +// pDestRect +// Destination rectangle, or NULL for entire surface +// pSrcFile +// File name of the source image. +// pSrcModule +// Module where resource is located, or NULL for module associated +// with image the os used to create the current process. +// pSrcResource +// Resource name +// pSrcData +// Pointer to file in memory. +// SrcDataSize +// Size in bytes of file in memory. +// pSrcRect +// Source rectangle, or NULL for entire image +// Filter +// D3DX_FILTER flags controlling how the image is filtered. +// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. +// ColorKey +// Color to replace with transparent black, or 0 to disable colorkey. +// This is always a 32-bit ARGB color, independent of the source image +// format. Alpha is significant, and should usually be set to FF for +// opaque colorkeys. (ex. Opaque black == 0xff000000) +// pSrcInfo +// Pointer to a D3DXIMAGE_INFO structure to be filled in with the +// description of the data in the source image file, or NULL. +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXLoadSurfaceFromFileA( + LPDIRECT3DSURFACE9 pDestSurface, + CONST PALETTEENTRY* pDestPalette, + CONST RECT* pDestRect, + LPCSTR pSrcFile, + CONST RECT* pSrcRect, + DWORD Filter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo); + +HRESULT WINAPI + D3DXLoadSurfaceFromFileW( + LPDIRECT3DSURFACE9 pDestSurface, + CONST PALETTEENTRY* pDestPalette, + CONST RECT* pDestRect, + LPCWSTR pSrcFile, + CONST RECT* pSrcRect, + DWORD Filter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo); + +#ifdef UNICODE +#define D3DXLoadSurfaceFromFile D3DXLoadSurfaceFromFileW +#else +#define D3DXLoadSurfaceFromFile D3DXLoadSurfaceFromFileA +#endif + + + +HRESULT WINAPI + D3DXLoadSurfaceFromResourceA( + LPDIRECT3DSURFACE9 pDestSurface, + CONST PALETTEENTRY* pDestPalette, + CONST RECT* pDestRect, + HMODULE hSrcModule, + LPCSTR pSrcResource, + CONST RECT* pSrcRect, + DWORD Filter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo); + +HRESULT WINAPI + D3DXLoadSurfaceFromResourceW( + LPDIRECT3DSURFACE9 pDestSurface, + CONST PALETTEENTRY* pDestPalette, + CONST RECT* pDestRect, + HMODULE hSrcModule, + LPCWSTR pSrcResource, + CONST RECT* pSrcRect, + DWORD Filter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo); + + +#ifdef UNICODE +#define D3DXLoadSurfaceFromResource D3DXLoadSurfaceFromResourceW +#else +#define D3DXLoadSurfaceFromResource D3DXLoadSurfaceFromResourceA +#endif + + + +HRESULT WINAPI + D3DXLoadSurfaceFromFileInMemory( + LPDIRECT3DSURFACE9 pDestSurface, + CONST PALETTEENTRY* pDestPalette, + CONST RECT* pDestRect, + LPCVOID pSrcData, + UINT SrcDataSize, + CONST RECT* pSrcRect, + DWORD Filter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo); + + + +//---------------------------------------------------------------------------- +// D3DXLoadSurfaceFromSurface: +// --------------------------- +// Load surface from another surface (with color conversion) +// +// Parameters: +// pDestSurface +// Destination surface, which will receive the image. +// pDestPalette +// Destination palette of 256 colors, or NULL +// pDestRect +// Destination rectangle, or NULL for entire surface +// pSrcSurface +// Source surface +// pSrcPalette +// Source palette of 256 colors, or NULL +// pSrcRect +// Source rectangle, or NULL for entire surface +// Filter +// D3DX_FILTER flags controlling how the image is filtered. +// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. +// ColorKey +// Color to replace with transparent black, or 0 to disable colorkey. +// This is always a 32-bit ARGB color, independent of the source image +// format. Alpha is significant, and should usually be set to FF for +// opaque colorkeys. (ex. Opaque black == 0xff000000) +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXLoadSurfaceFromSurface( + LPDIRECT3DSURFACE9 pDestSurface, + CONST PALETTEENTRY* pDestPalette, + CONST RECT* pDestRect, + LPDIRECT3DSURFACE9 pSrcSurface, + CONST PALETTEENTRY* pSrcPalette, + CONST RECT* pSrcRect, + DWORD Filter, + D3DCOLOR ColorKey); + + +//---------------------------------------------------------------------------- +// D3DXLoadSurfaceFromMemory: +// -------------------------- +// Load surface from memory. +// +// Parameters: +// pDestSurface +// Destination surface, which will receive the image. +// pDestPalette +// Destination palette of 256 colors, or NULL +// pDestRect +// Destination rectangle, or NULL for entire surface +// pSrcMemory +// Pointer to the top-left corner of the source image in memory +// SrcFormat +// Pixel format of the source image. +// SrcPitch +// Pitch of source image, in bytes. For DXT formats, this number +// should represent the width of one row of cells, in bytes. +// pSrcPalette +// Source palette of 256 colors, or NULL +// pSrcRect +// Source rectangle. +// Filter +// D3DX_FILTER flags controlling how the image is filtered. +// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. +// ColorKey +// Color to replace with transparent black, or 0 to disable colorkey. +// This is always a 32-bit ARGB color, independent of the source image +// format. Alpha is significant, and should usually be set to FF for +// opaque colorkeys. (ex. Opaque black == 0xff000000) +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXLoadSurfaceFromMemory( + LPDIRECT3DSURFACE9 pDestSurface, + CONST PALETTEENTRY* pDestPalette, + CONST RECT* pDestRect, + LPCVOID pSrcMemory, + D3DFORMAT SrcFormat, + UINT SrcPitch, + CONST PALETTEENTRY* pSrcPalette, + CONST RECT* pSrcRect, + DWORD Filter, + D3DCOLOR ColorKey); + + +//---------------------------------------------------------------------------- +// D3DXSaveSurfaceToFile: +// ---------------------- +// Save a surface to a image file. +// +// Parameters: +// pDestFile +// File name of the destination file +// DestFormat +// D3DXIMAGE_FILEFORMAT specifying file format to use when saving. +// pSrcSurface +// Source surface, containing the image to be saved +// pSrcPalette +// Source palette of 256 colors, or NULL +// pSrcRect +// Source rectangle, or NULL for the entire image +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXSaveSurfaceToFileA( + LPCSTR pDestFile, + D3DXIMAGE_FILEFORMAT DestFormat, + LPDIRECT3DSURFACE9 pSrcSurface, + CONST PALETTEENTRY* pSrcPalette, + CONST RECT* pSrcRect); + +HRESULT WINAPI + D3DXSaveSurfaceToFileW( + LPCWSTR pDestFile, + D3DXIMAGE_FILEFORMAT DestFormat, + LPDIRECT3DSURFACE9 pSrcSurface, + CONST PALETTEENTRY* pSrcPalette, + CONST RECT* pSrcRect); + +#ifdef UNICODE +#define D3DXSaveSurfaceToFile D3DXSaveSurfaceToFileW +#else +#define D3DXSaveSurfaceToFile D3DXSaveSurfaceToFileA +#endif + +//---------------------------------------------------------------------------- +// D3DXSaveSurfaceToFileInMemory: +// ---------------------- +// Save a surface to a image file. +// +// Parameters: +// ppDestBuf +// address of pointer to d3dxbuffer for returning data bits +// DestFormat +// D3DXIMAGE_FILEFORMAT specifying file format to use when saving. +// pSrcSurface +// Source surface, containing the image to be saved +// pSrcPalette +// Source palette of 256 colors, or NULL +// pSrcRect +// Source rectangle, or NULL for the entire image +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXSaveSurfaceToFileInMemory( + LPD3DXBUFFER* ppDestBuf, + D3DXIMAGE_FILEFORMAT DestFormat, + LPDIRECT3DSURFACE9 pSrcSurface, + CONST PALETTEENTRY* pSrcPalette, + CONST RECT* pSrcRect); + + +////////////////////////////////////////////////////////////////////////////// +// Load/Save Volume APIs ///////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +//---------------------------------------------------------------------------- +// D3DXLoadVolumeFromFile/Resource: +// -------------------------------- +// Load volume from a file or resource +// +// Parameters: +// pDestVolume +// Destination volume, which will receive the image. +// pDestPalette +// Destination palette of 256 colors, or NULL +// pDestBox +// Destination box, or NULL for entire volume +// pSrcFile +// File name of the source image. +// pSrcModule +// Module where resource is located, or NULL for module associated +// with image the os used to create the current process. +// pSrcResource +// Resource name +// pSrcData +// Pointer to file in memory. +// SrcDataSize +// Size in bytes of file in memory. +// pSrcBox +// Source box, or NULL for entire image +// Filter +// D3DX_FILTER flags controlling how the image is filtered. +// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. +// ColorKey +// Color to replace with transparent black, or 0 to disable colorkey. +// This is always a 32-bit ARGB color, independent of the source image +// format. Alpha is significant, and should usually be set to FF for +// opaque colorkeys. (ex. Opaque black == 0xff000000) +// pSrcInfo +// Pointer to a D3DXIMAGE_INFO structure to be filled in with the +// description of the data in the source image file, or NULL. +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXLoadVolumeFromFileA( + LPDIRECT3DVOLUME9 pDestVolume, + CONST PALETTEENTRY* pDestPalette, + CONST D3DBOX* pDestBox, + LPCSTR pSrcFile, + CONST D3DBOX* pSrcBox, + DWORD Filter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo); + +HRESULT WINAPI + D3DXLoadVolumeFromFileW( + LPDIRECT3DVOLUME9 pDestVolume, + CONST PALETTEENTRY* pDestPalette, + CONST D3DBOX* pDestBox, + LPCWSTR pSrcFile, + CONST D3DBOX* pSrcBox, + DWORD Filter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo); + +#ifdef UNICODE +#define D3DXLoadVolumeFromFile D3DXLoadVolumeFromFileW +#else +#define D3DXLoadVolumeFromFile D3DXLoadVolumeFromFileA +#endif + + +HRESULT WINAPI + D3DXLoadVolumeFromResourceA( + LPDIRECT3DVOLUME9 pDestVolume, + CONST PALETTEENTRY* pDestPalette, + CONST D3DBOX* pDestBox, + HMODULE hSrcModule, + LPCSTR pSrcResource, + CONST D3DBOX* pSrcBox, + DWORD Filter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo); + +HRESULT WINAPI + D3DXLoadVolumeFromResourceW( + LPDIRECT3DVOLUME9 pDestVolume, + CONST PALETTEENTRY* pDestPalette, + CONST D3DBOX* pDestBox, + HMODULE hSrcModule, + LPCWSTR pSrcResource, + CONST D3DBOX* pSrcBox, + DWORD Filter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo); + +#ifdef UNICODE +#define D3DXLoadVolumeFromResource D3DXLoadVolumeFromResourceW +#else +#define D3DXLoadVolumeFromResource D3DXLoadVolumeFromResourceA +#endif + + + +HRESULT WINAPI + D3DXLoadVolumeFromFileInMemory( + LPDIRECT3DVOLUME9 pDestVolume, + CONST PALETTEENTRY* pDestPalette, + CONST D3DBOX* pDestBox, + LPCVOID pSrcData, + UINT SrcDataSize, + CONST D3DBOX* pSrcBox, + DWORD Filter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo); + + + +//---------------------------------------------------------------------------- +// D3DXLoadVolumeFromVolume: +// ------------------------- +// Load volume from another volume (with color conversion) +// +// Parameters: +// pDestVolume +// Destination volume, which will receive the image. +// pDestPalette +// Destination palette of 256 colors, or NULL +// pDestBox +// Destination box, or NULL for entire volume +// pSrcVolume +// Source volume +// pSrcPalette +// Source palette of 256 colors, or NULL +// pSrcBox +// Source box, or NULL for entire volume +// Filter +// D3DX_FILTER flags controlling how the image is filtered. +// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. +// ColorKey +// Color to replace with transparent black, or 0 to disable colorkey. +// This is always a 32-bit ARGB color, independent of the source image +// format. Alpha is significant, and should usually be set to FF for +// opaque colorkeys. (ex. Opaque black == 0xff000000) +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXLoadVolumeFromVolume( + LPDIRECT3DVOLUME9 pDestVolume, + CONST PALETTEENTRY* pDestPalette, + CONST D3DBOX* pDestBox, + LPDIRECT3DVOLUME9 pSrcVolume, + CONST PALETTEENTRY* pSrcPalette, + CONST D3DBOX* pSrcBox, + DWORD Filter, + D3DCOLOR ColorKey); + + + +//---------------------------------------------------------------------------- +// D3DXLoadVolumeFromMemory: +// ------------------------- +// Load volume from memory. +// +// Parameters: +// pDestVolume +// Destination volume, which will receive the image. +// pDestPalette +// Destination palette of 256 colors, or NULL +// pDestBox +// Destination box, or NULL for entire volume +// pSrcMemory +// Pointer to the top-left corner of the source volume in memory +// SrcFormat +// Pixel format of the source volume. +// SrcRowPitch +// Pitch of source image, in bytes. For DXT formats, this number +// should represent the size of one row of cells, in bytes. +// SrcSlicePitch +// Pitch of source image, in bytes. For DXT formats, this number +// should represent the size of one slice of cells, in bytes. +// pSrcPalette +// Source palette of 256 colors, or NULL +// pSrcBox +// Source box. +// Filter +// D3DX_FILTER flags controlling how the image is filtered. +// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. +// ColorKey +// Color to replace with transparent black, or 0 to disable colorkey. +// This is always a 32-bit ARGB color, independent of the source image +// format. Alpha is significant, and should usually be set to FF for +// opaque colorkeys. (ex. Opaque black == 0xff000000) +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXLoadVolumeFromMemory( + LPDIRECT3DVOLUME9 pDestVolume, + CONST PALETTEENTRY* pDestPalette, + CONST D3DBOX* pDestBox, + LPCVOID pSrcMemory, + D3DFORMAT SrcFormat, + UINT SrcRowPitch, + UINT SrcSlicePitch, + CONST PALETTEENTRY* pSrcPalette, + CONST D3DBOX* pSrcBox, + DWORD Filter, + D3DCOLOR ColorKey); + + + +//---------------------------------------------------------------------------- +// D3DXSaveVolumeToFile: +// --------------------- +// Save a volume to a image file. +// +// Parameters: +// pDestFile +// File name of the destination file +// DestFormat +// D3DXIMAGE_FILEFORMAT specifying file format to use when saving. +// pSrcVolume +// Source volume, containing the image to be saved +// pSrcPalette +// Source palette of 256 colors, or NULL +// pSrcBox +// Source box, or NULL for the entire volume +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXSaveVolumeToFileA( + LPCSTR pDestFile, + D3DXIMAGE_FILEFORMAT DestFormat, + LPDIRECT3DVOLUME9 pSrcVolume, + CONST PALETTEENTRY* pSrcPalette, + CONST D3DBOX* pSrcBox); + +HRESULT WINAPI + D3DXSaveVolumeToFileW( + LPCWSTR pDestFile, + D3DXIMAGE_FILEFORMAT DestFormat, + LPDIRECT3DVOLUME9 pSrcVolume, + CONST PALETTEENTRY* pSrcPalette, + CONST D3DBOX* pSrcBox); + +#ifdef UNICODE +#define D3DXSaveVolumeToFile D3DXSaveVolumeToFileW +#else +#define D3DXSaveVolumeToFile D3DXSaveVolumeToFileA +#endif + + +//---------------------------------------------------------------------------- +// D3DXSaveVolumeToFileInMemory: +// --------------------- +// Save a volume to a image file. +// +// Parameters: +// pDestFile +// File name of the destination file +// DestFormat +// D3DXIMAGE_FILEFORMAT specifying file format to use when saving. +// pSrcVolume +// Source volume, containing the image to be saved +// pSrcPalette +// Source palette of 256 colors, or NULL +// pSrcBox +// Source box, or NULL for the entire volume +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXSaveVolumeToFileInMemory( + LPD3DXBUFFER* ppDestBuf, + D3DXIMAGE_FILEFORMAT DestFormat, + LPDIRECT3DVOLUME9 pSrcVolume, + CONST PALETTEENTRY* pSrcPalette, + CONST D3DBOX* pSrcBox); + +////////////////////////////////////////////////////////////////////////////// +// Create/Save Texture APIs ////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +//---------------------------------------------------------------------------- +// D3DXCheckTextureRequirements: +// ----------------------------- +// Checks texture creation parameters. If parameters are invalid, this +// function returns corrected parameters. +// +// Parameters: +// +// pDevice +// The D3D device to be used +// pWidth, pHeight, pDepth, pSize +// Desired size in pixels, or NULL. Returns corrected size. +// pNumMipLevels +// Number of desired mipmap levels, or NULL. Returns corrected number. +// Usage +// Texture usage flags +// pFormat +// Desired pixel format, or NULL. Returns corrected format. +// Pool +// Memory pool to be used to create texture +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXCheckTextureRequirements( + LPDIRECT3DDEVICE9 pDevice, + UINT* pWidth, + UINT* pHeight, + UINT* pNumMipLevels, + DWORD Usage, + D3DFORMAT* pFormat, + D3DPOOL Pool); + +HRESULT WINAPI + D3DXCheckCubeTextureRequirements( + LPDIRECT3DDEVICE9 pDevice, + UINT* pSize, + UINT* pNumMipLevels, + DWORD Usage, + D3DFORMAT* pFormat, + D3DPOOL Pool); + +HRESULT WINAPI + D3DXCheckVolumeTextureRequirements( + LPDIRECT3DDEVICE9 pDevice, + UINT* pWidth, + UINT* pHeight, + UINT* pDepth, + UINT* pNumMipLevels, + DWORD Usage, + D3DFORMAT* pFormat, + D3DPOOL Pool); + + +//---------------------------------------------------------------------------- +// D3DXCreateTexture: +// ------------------ +// Create an empty texture +// +// Parameters: +// +// pDevice +// The D3D device with which the texture is going to be used. +// Width, Height, Depth, Size +// size in pixels. these must be non-zero +// MipLevels +// number of mip levels desired. if zero or D3DX_DEFAULT, a complete +// mipmap chain will be created. +// Usage +// Texture usage flags +// Format +// Pixel format. +// Pool +// Memory pool to be used to create texture +// ppTexture, ppCubeTexture, ppVolumeTexture +// The texture object that will be created +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXCreateTexture( + LPDIRECT3DDEVICE9 pDevice, + UINT Width, + UINT Height, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + LPDIRECT3DTEXTURE9* ppTexture); + +HRESULT WINAPI + D3DXCreateCubeTexture( + LPDIRECT3DDEVICE9 pDevice, + UINT Size, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + LPDIRECT3DCUBETEXTURE9* ppCubeTexture); + +HRESULT WINAPI + D3DXCreateVolumeTexture( + LPDIRECT3DDEVICE9 pDevice, + UINT Width, + UINT Height, + UINT Depth, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + LPDIRECT3DVOLUMETEXTURE9* ppVolumeTexture); + + + +//---------------------------------------------------------------------------- +// D3DXCreateTextureFromFile/Resource: +// ----------------------------------- +// Create a texture object from a file or resource. +// +// Parameters: +// +// pDevice +// The D3D device with which the texture is going to be used. +// pSrcFile +// File name. +// hSrcModule +// Module handle. if NULL, current module will be used. +// pSrcResource +// Resource name in module +// pvSrcData +// Pointer to file in memory. +// SrcDataSize +// Size in bytes of file in memory. +// Width, Height, Depth, Size +// Size in pixels. If zero or D3DX_DEFAULT, the size will be taken from +// the file and rounded up to a power of two. If D3DX_DEFAULT_NONPOW2, +// and the device supports NONPOW2 textures, the size will not be rounded. +// If D3DX_FROM_FILE, the size will be taken exactly as it is in the file, +// and the call will fail if this violates device capabilities. +// MipLevels +// Number of mip levels. If zero or D3DX_DEFAULT, a complete mipmap +// chain will be created. If D3DX_FROM_FILE, the size will be taken +// exactly as it is in the file, and the call will fail if this violates +// device capabilities. +// Usage +// Texture usage flags +// Format +// Desired pixel format. If D3DFMT_UNKNOWN, the format will be +// taken from the file. If D3DFMT_FROM_FILE, the format will be taken +// exactly as it is in the file, and the call will fail if the device does +// not support the given format. +// Pool +// Memory pool to be used to create texture +// Filter +// D3DX_FILTER flags controlling how the image is filtered. +// Or D3DX_DEFAULT for D3DX_FILTER_TRIANGLE. +// MipFilter +// D3DX_FILTER flags controlling how each miplevel is filtered. +// Or D3DX_DEFAULT for D3DX_FILTER_BOX. +// Use the D3DX_SKIP_DDS_MIP_LEVELS macro to specify both a filter and the +// number of mip levels to skip when loading DDS files. +// ColorKey +// Color to replace with transparent black, or 0 to disable colorkey. +// This is always a 32-bit ARGB color, independent of the source image +// format. Alpha is significant, and should usually be set to FF for +// opaque colorkeys. (ex. Opaque black == 0xff000000) +// pSrcInfo +// Pointer to a D3DXIMAGE_INFO structure to be filled in with the +// description of the data in the source image file, or NULL. +// pPalette +// 256 color palette to be filled in, or NULL +// ppTexture, ppCubeTexture, ppVolumeTexture +// The texture object that will be created +// +//---------------------------------------------------------------------------- + +// FromFile + +HRESULT WINAPI + D3DXCreateTextureFromFileA( + LPDIRECT3DDEVICE9 pDevice, + LPCSTR pSrcFile, + LPDIRECT3DTEXTURE9* ppTexture); + +HRESULT WINAPI + D3DXCreateTextureFromFileW( + LPDIRECT3DDEVICE9 pDevice, + LPCWSTR pSrcFile, + LPDIRECT3DTEXTURE9* ppTexture); + +#ifdef UNICODE +#define D3DXCreateTextureFromFile D3DXCreateTextureFromFileW +#else +#define D3DXCreateTextureFromFile D3DXCreateTextureFromFileA +#endif + + +HRESULT WINAPI + D3DXCreateCubeTextureFromFileA( + LPDIRECT3DDEVICE9 pDevice, + LPCSTR pSrcFile, + LPDIRECT3DCUBETEXTURE9* ppCubeTexture); + +HRESULT WINAPI + D3DXCreateCubeTextureFromFileW( + LPDIRECT3DDEVICE9 pDevice, + LPCWSTR pSrcFile, + LPDIRECT3DCUBETEXTURE9* ppCubeTexture); + +#ifdef UNICODE +#define D3DXCreateCubeTextureFromFile D3DXCreateCubeTextureFromFileW +#else +#define D3DXCreateCubeTextureFromFile D3DXCreateCubeTextureFromFileA +#endif + + +HRESULT WINAPI + D3DXCreateVolumeTextureFromFileA( + LPDIRECT3DDEVICE9 pDevice, + LPCSTR pSrcFile, + LPDIRECT3DVOLUMETEXTURE9* ppVolumeTexture); + +HRESULT WINAPI + D3DXCreateVolumeTextureFromFileW( + LPDIRECT3DDEVICE9 pDevice, + LPCWSTR pSrcFile, + LPDIRECT3DVOLUMETEXTURE9* ppVolumeTexture); + +#ifdef UNICODE +#define D3DXCreateVolumeTextureFromFile D3DXCreateVolumeTextureFromFileW +#else +#define D3DXCreateVolumeTextureFromFile D3DXCreateVolumeTextureFromFileA +#endif + + +// FromResource + +HRESULT WINAPI + D3DXCreateTextureFromResourceA( + LPDIRECT3DDEVICE9 pDevice, + HMODULE hSrcModule, + LPCSTR pSrcResource, + LPDIRECT3DTEXTURE9* ppTexture); + +HRESULT WINAPI + D3DXCreateTextureFromResourceW( + LPDIRECT3DDEVICE9 pDevice, + HMODULE hSrcModule, + LPCWSTR pSrcResource, + LPDIRECT3DTEXTURE9* ppTexture); + +#ifdef UNICODE +#define D3DXCreateTextureFromResource D3DXCreateTextureFromResourceW +#else +#define D3DXCreateTextureFromResource D3DXCreateTextureFromResourceA +#endif + + +HRESULT WINAPI + D3DXCreateCubeTextureFromResourceA( + LPDIRECT3DDEVICE9 pDevice, + HMODULE hSrcModule, + LPCSTR pSrcResource, + LPDIRECT3DCUBETEXTURE9* ppCubeTexture); + +HRESULT WINAPI + D3DXCreateCubeTextureFromResourceW( + LPDIRECT3DDEVICE9 pDevice, + HMODULE hSrcModule, + LPCWSTR pSrcResource, + LPDIRECT3DCUBETEXTURE9* ppCubeTexture); + +#ifdef UNICODE +#define D3DXCreateCubeTextureFromResource D3DXCreateCubeTextureFromResourceW +#else +#define D3DXCreateCubeTextureFromResource D3DXCreateCubeTextureFromResourceA +#endif + + +HRESULT WINAPI + D3DXCreateVolumeTextureFromResourceA( + LPDIRECT3DDEVICE9 pDevice, + HMODULE hSrcModule, + LPCSTR pSrcResource, + LPDIRECT3DVOLUMETEXTURE9* ppVolumeTexture); + +HRESULT WINAPI + D3DXCreateVolumeTextureFromResourceW( + LPDIRECT3DDEVICE9 pDevice, + HMODULE hSrcModule, + LPCWSTR pSrcResource, + LPDIRECT3DVOLUMETEXTURE9* ppVolumeTexture); + +#ifdef UNICODE +#define D3DXCreateVolumeTextureFromResource D3DXCreateVolumeTextureFromResourceW +#else +#define D3DXCreateVolumeTextureFromResource D3DXCreateVolumeTextureFromResourceA +#endif + + +// FromFileEx + +HRESULT WINAPI + D3DXCreateTextureFromFileExA( + LPDIRECT3DDEVICE9 pDevice, + LPCSTR pSrcFile, + UINT Width, + UINT Height, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Filter, + DWORD MipFilter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo, + PALETTEENTRY* pPalette, + LPDIRECT3DTEXTURE9* ppTexture); + +HRESULT WINAPI + D3DXCreateTextureFromFileExW( + LPDIRECT3DDEVICE9 pDevice, + LPCWSTR pSrcFile, + UINT Width, + UINT Height, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Filter, + DWORD MipFilter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo, + PALETTEENTRY* pPalette, + LPDIRECT3DTEXTURE9* ppTexture); + +#ifdef UNICODE +#define D3DXCreateTextureFromFileEx D3DXCreateTextureFromFileExW +#else +#define D3DXCreateTextureFromFileEx D3DXCreateTextureFromFileExA +#endif + + +HRESULT WINAPI + D3DXCreateCubeTextureFromFileExA( + LPDIRECT3DDEVICE9 pDevice, + LPCSTR pSrcFile, + UINT Size, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Filter, + DWORD MipFilter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo, + PALETTEENTRY* pPalette, + LPDIRECT3DCUBETEXTURE9* ppCubeTexture); + +HRESULT WINAPI + D3DXCreateCubeTextureFromFileExW( + LPDIRECT3DDEVICE9 pDevice, + LPCWSTR pSrcFile, + UINT Size, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Filter, + DWORD MipFilter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo, + PALETTEENTRY* pPalette, + LPDIRECT3DCUBETEXTURE9* ppCubeTexture); + +#ifdef UNICODE +#define D3DXCreateCubeTextureFromFileEx D3DXCreateCubeTextureFromFileExW +#else +#define D3DXCreateCubeTextureFromFileEx D3DXCreateCubeTextureFromFileExA +#endif + + +HRESULT WINAPI + D3DXCreateVolumeTextureFromFileExA( + LPDIRECT3DDEVICE9 pDevice, + LPCSTR pSrcFile, + UINT Width, + UINT Height, + UINT Depth, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Filter, + DWORD MipFilter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo, + PALETTEENTRY* pPalette, + LPDIRECT3DVOLUMETEXTURE9* ppVolumeTexture); + +HRESULT WINAPI + D3DXCreateVolumeTextureFromFileExW( + LPDIRECT3DDEVICE9 pDevice, + LPCWSTR pSrcFile, + UINT Width, + UINT Height, + UINT Depth, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Filter, + DWORD MipFilter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo, + PALETTEENTRY* pPalette, + LPDIRECT3DVOLUMETEXTURE9* ppVolumeTexture); + +#ifdef UNICODE +#define D3DXCreateVolumeTextureFromFileEx D3DXCreateVolumeTextureFromFileExW +#else +#define D3DXCreateVolumeTextureFromFileEx D3DXCreateVolumeTextureFromFileExA +#endif + + +// FromResourceEx + +HRESULT WINAPI + D3DXCreateTextureFromResourceExA( + LPDIRECT3DDEVICE9 pDevice, + HMODULE hSrcModule, + LPCSTR pSrcResource, + UINT Width, + UINT Height, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Filter, + DWORD MipFilter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo, + PALETTEENTRY* pPalette, + LPDIRECT3DTEXTURE9* ppTexture); + +HRESULT WINAPI + D3DXCreateTextureFromResourceExW( + LPDIRECT3DDEVICE9 pDevice, + HMODULE hSrcModule, + LPCWSTR pSrcResource, + UINT Width, + UINT Height, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Filter, + DWORD MipFilter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo, + PALETTEENTRY* pPalette, + LPDIRECT3DTEXTURE9* ppTexture); + +#ifdef UNICODE +#define D3DXCreateTextureFromResourceEx D3DXCreateTextureFromResourceExW +#else +#define D3DXCreateTextureFromResourceEx D3DXCreateTextureFromResourceExA +#endif + + +HRESULT WINAPI + D3DXCreateCubeTextureFromResourceExA( + LPDIRECT3DDEVICE9 pDevice, + HMODULE hSrcModule, + LPCSTR pSrcResource, + UINT Size, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Filter, + DWORD MipFilter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo, + PALETTEENTRY* pPalette, + LPDIRECT3DCUBETEXTURE9* ppCubeTexture); + +HRESULT WINAPI + D3DXCreateCubeTextureFromResourceExW( + LPDIRECT3DDEVICE9 pDevice, + HMODULE hSrcModule, + LPCWSTR pSrcResource, + UINT Size, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Filter, + DWORD MipFilter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo, + PALETTEENTRY* pPalette, + LPDIRECT3DCUBETEXTURE9* ppCubeTexture); + +#ifdef UNICODE +#define D3DXCreateCubeTextureFromResourceEx D3DXCreateCubeTextureFromResourceExW +#else +#define D3DXCreateCubeTextureFromResourceEx D3DXCreateCubeTextureFromResourceExA +#endif + + +HRESULT WINAPI + D3DXCreateVolumeTextureFromResourceExA( + LPDIRECT3DDEVICE9 pDevice, + HMODULE hSrcModule, + LPCSTR pSrcResource, + UINT Width, + UINT Height, + UINT Depth, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Filter, + DWORD MipFilter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo, + PALETTEENTRY* pPalette, + LPDIRECT3DVOLUMETEXTURE9* ppVolumeTexture); + +HRESULT WINAPI + D3DXCreateVolumeTextureFromResourceExW( + LPDIRECT3DDEVICE9 pDevice, + HMODULE hSrcModule, + LPCWSTR pSrcResource, + UINT Width, + UINT Height, + UINT Depth, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Filter, + DWORD MipFilter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo, + PALETTEENTRY* pPalette, + LPDIRECT3DVOLUMETEXTURE9* ppVolumeTexture); + +#ifdef UNICODE +#define D3DXCreateVolumeTextureFromResourceEx D3DXCreateVolumeTextureFromResourceExW +#else +#define D3DXCreateVolumeTextureFromResourceEx D3DXCreateVolumeTextureFromResourceExA +#endif + + +// FromFileInMemory + +HRESULT WINAPI + D3DXCreateTextureFromFileInMemory( + LPDIRECT3DDEVICE9 pDevice, + LPCVOID pSrcData, + UINT SrcDataSize, + LPDIRECT3DTEXTURE9* ppTexture); + +HRESULT WINAPI + D3DXCreateCubeTextureFromFileInMemory( + LPDIRECT3DDEVICE9 pDevice, + LPCVOID pSrcData, + UINT SrcDataSize, + LPDIRECT3DCUBETEXTURE9* ppCubeTexture); + +HRESULT WINAPI + D3DXCreateVolumeTextureFromFileInMemory( + LPDIRECT3DDEVICE9 pDevice, + LPCVOID pSrcData, + UINT SrcDataSize, + LPDIRECT3DVOLUMETEXTURE9* ppVolumeTexture); + + +// FromFileInMemoryEx + +HRESULT WINAPI + D3DXCreateTextureFromFileInMemoryEx( + LPDIRECT3DDEVICE9 pDevice, + LPCVOID pSrcData, + UINT SrcDataSize, + UINT Width, + UINT Height, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Filter, + DWORD MipFilter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo, + PALETTEENTRY* pPalette, + LPDIRECT3DTEXTURE9* ppTexture); + +HRESULT WINAPI + D3DXCreateCubeTextureFromFileInMemoryEx( + LPDIRECT3DDEVICE9 pDevice, + LPCVOID pSrcData, + UINT SrcDataSize, + UINT Size, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Filter, + DWORD MipFilter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo, + PALETTEENTRY* pPalette, + LPDIRECT3DCUBETEXTURE9* ppCubeTexture); + +HRESULT WINAPI + D3DXCreateVolumeTextureFromFileInMemoryEx( + LPDIRECT3DDEVICE9 pDevice, + LPCVOID pSrcData, + UINT SrcDataSize, + UINT Width, + UINT Height, + UINT Depth, + UINT MipLevels, + DWORD Usage, + D3DFORMAT Format, + D3DPOOL Pool, + DWORD Filter, + DWORD MipFilter, + D3DCOLOR ColorKey, + D3DXIMAGE_INFO* pSrcInfo, + PALETTEENTRY* pPalette, + LPDIRECT3DVOLUMETEXTURE9* ppVolumeTexture); + + + +//---------------------------------------------------------------------------- +// D3DXSaveTextureToFile: +// ---------------------- +// Save a texture to a file. +// +// Parameters: +// pDestFile +// File name of the destination file +// DestFormat +// D3DXIMAGE_FILEFORMAT specifying file format to use when saving. +// pSrcTexture +// Source texture, containing the image to be saved +// pSrcPalette +// Source palette of 256 colors, or NULL +// +//---------------------------------------------------------------------------- + + +HRESULT WINAPI + D3DXSaveTextureToFileA( + LPCSTR pDestFile, + D3DXIMAGE_FILEFORMAT DestFormat, + LPDIRECT3DBASETEXTURE9 pSrcTexture, + CONST PALETTEENTRY* pSrcPalette); + +HRESULT WINAPI + D3DXSaveTextureToFileW( + LPCWSTR pDestFile, + D3DXIMAGE_FILEFORMAT DestFormat, + LPDIRECT3DBASETEXTURE9 pSrcTexture, + CONST PALETTEENTRY* pSrcPalette); + +#ifdef UNICODE +#define D3DXSaveTextureToFile D3DXSaveTextureToFileW +#else +#define D3DXSaveTextureToFile D3DXSaveTextureToFileA +#endif + + +//---------------------------------------------------------------------------- +// D3DXSaveTextureToFileInMemory: +// ---------------------- +// Save a texture to a file. +// +// Parameters: +// ppDestBuf +// address of a d3dxbuffer pointer to return the image data +// DestFormat +// D3DXIMAGE_FILEFORMAT specifying file format to use when saving. +// pSrcTexture +// Source texture, containing the image to be saved +// pSrcPalette +// Source palette of 256 colors, or NULL +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXSaveTextureToFileInMemory( + LPD3DXBUFFER* ppDestBuf, + D3DXIMAGE_FILEFORMAT DestFormat, + LPDIRECT3DBASETEXTURE9 pSrcTexture, + CONST PALETTEENTRY* pSrcPalette); + + + + +////////////////////////////////////////////////////////////////////////////// +// Misc Texture APIs ///////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +//---------------------------------------------------------------------------- +// D3DXFilterTexture: +// ------------------ +// Filters mipmaps levels of a texture. +// +// Parameters: +// pBaseTexture +// The texture object to be filtered +// pPalette +// 256 color palette to be used, or NULL for non-palettized formats +// SrcLevel +// The level whose image is used to generate the subsequent levels. +// Filter +// D3DX_FILTER flags controlling how each miplevel is filtered. +// Or D3DX_DEFAULT for D3DX_FILTER_BOX, +// +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXFilterTexture( + LPDIRECT3DBASETEXTURE9 pBaseTexture, + CONST PALETTEENTRY* pPalette, + UINT SrcLevel, + DWORD Filter); + +#define D3DXFilterCubeTexture D3DXFilterTexture +#define D3DXFilterVolumeTexture D3DXFilterTexture + + + +//---------------------------------------------------------------------------- +// D3DXFillTexture: +// ---------------- +// Uses a user provided function to fill each texel of each mip level of a +// given texture. +// +// Paramters: +// pTexture, pCubeTexture, pVolumeTexture +// Pointer to the texture to be filled. +// pFunction +// Pointer to user provided evalutor function which will be used to +// compute the value of each texel. +// pData +// Pointer to an arbitrary block of user defined data. This pointer +// will be passed to the function provided in pFunction +//----------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXFillTexture( + LPDIRECT3DTEXTURE9 pTexture, + LPD3DXFILL2D pFunction, + LPVOID pData); + +HRESULT WINAPI + D3DXFillCubeTexture( + LPDIRECT3DCUBETEXTURE9 pCubeTexture, + LPD3DXFILL3D pFunction, + LPVOID pData); + +HRESULT WINAPI + D3DXFillVolumeTexture( + LPDIRECT3DVOLUMETEXTURE9 pVolumeTexture, + LPD3DXFILL3D pFunction, + LPVOID pData); + +//--------------------------------------------------------------------------- +// D3DXFillTextureTX: +// ------------------ +// Uses a TX Shader target to function to fill each texel of each mip level +// of a given texture. The TX Shader target should be a compiled function +// taking 2 paramters and returning a float4 color. +// +// Paramters: +// pTexture, pCubeTexture, pVolumeTexture +// Pointer to the texture to be filled. +// pTextureShader +// Pointer to the texture shader to be used to fill in the texture +//---------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXFillTextureTX( + LPDIRECT3DTEXTURE9 pTexture, + LPD3DXTEXTURESHADER pTextureShader); + + +HRESULT WINAPI + D3DXFillCubeTextureTX( + LPDIRECT3DCUBETEXTURE9 pCubeTexture, + LPD3DXTEXTURESHADER pTextureShader); + + +HRESULT WINAPI + D3DXFillVolumeTextureTX( + LPDIRECT3DVOLUMETEXTURE9 pVolumeTexture, + LPD3DXTEXTURESHADER pTextureShader); + + + +//---------------------------------------------------------------------------- +// D3DXComputeNormalMap: +// --------------------- +// Converts a height map into a normal map. The (x,y,z) components of each +// normal are mapped to the (r,g,b) channels of the output texture. +// +// Parameters +// pTexture +// Pointer to the destination texture +// pSrcTexture +// Pointer to the source heightmap texture +// pSrcPalette +// Source palette of 256 colors, or NULL +// Flags +// D3DX_NORMALMAP flags +// Channel +// D3DX_CHANNEL specifying source of height information +// Amplitude +// The constant value which the height information is multiplied by. +//--------------------------------------------------------------------------- + +HRESULT WINAPI + D3DXComputeNormalMap( + LPDIRECT3DTEXTURE9 pTexture, + LPDIRECT3DTEXTURE9 pSrcTexture, + CONST PALETTEENTRY* pSrcPalette, + DWORD Flags, + DWORD Channel, + FLOAT Amplitude); + + + + +#ifdef __cplusplus +} +#endif //__cplusplus + +#endif //__D3DX9TEX_H__ + diff --git a/MediaClient/MediaClient/directx/include/d3dx9xof.h b/MediaClient/MediaClient/directx/include/d3dx9xof.h new file mode 100644 index 0000000..c513f0f --- /dev/null +++ b/MediaClient/MediaClient/directx/include/d3dx9xof.h @@ -0,0 +1,299 @@ +/////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx9xof.h +// Content: D3DX .X File types and functions +// +/////////////////////////////////////////////////////////////////////////// + +#include "d3dx9.h" + +#if !defined( __D3DX9XOF_H__ ) +#define __D3DX9XOF_H__ + +#if defined( __cplusplus ) +extern "C" { +#endif // defined( __cplusplus ) + +//---------------------------------------------------------------------------- +// D3DXF_FILEFORMAT +// This flag is used to specify what file type to use when saving to disk. +// _BINARY, and _TEXT are mutually exclusive, while +// _COMPRESSED is an optional setting that works with all file types. +//---------------------------------------------------------------------------- +typedef DWORD D3DXF_FILEFORMAT; + +#define D3DXF_FILEFORMAT_BINARY 0 +#define D3DXF_FILEFORMAT_TEXT 1 +#define D3DXF_FILEFORMAT_COMPRESSED 2 + +//---------------------------------------------------------------------------- +// D3DXF_FILESAVEOPTIONS +// This flag is used to specify where to save the file to. Each flag is +// mutually exclusive, indicates the data location of the file, and also +// chooses which additional data will specify the location. +// _TOFILE is paired with a filename (LPCSTR) +// _TOWFILE is paired with a filename (LPWSTR) +//---------------------------------------------------------------------------- +typedef DWORD D3DXF_FILESAVEOPTIONS; + +#define D3DXF_FILESAVE_TOFILE 0x00L +#define D3DXF_FILESAVE_TOWFILE 0x01L + +//---------------------------------------------------------------------------- +// D3DXF_FILELOADOPTIONS +// This flag is used to specify where to load the file from. Each flag is +// mutually exclusive, indicates the data location of the file, and also +// chooses which additional data will specify the location. +// _FROMFILE is paired with a filename (LPCSTR) +// _FROMWFILE is paired with a filename (LPWSTR) +// _FROMRESOURCE is paired with a (D3DXF_FILELOADRESOUCE*) description. +// _FROMMEMORY is paired with a (D3DXF_FILELOADMEMORY*) description. +//---------------------------------------------------------------------------- +typedef DWORD D3DXF_FILELOADOPTIONS; + +#define D3DXF_FILELOAD_FROMFILE 0x00L +#define D3DXF_FILELOAD_FROMWFILE 0x01L +#define D3DXF_FILELOAD_FROMRESOURCE 0x02L +#define D3DXF_FILELOAD_FROMMEMORY 0x03L + +//---------------------------------------------------------------------------- +// D3DXF_FILELOADRESOURCE: +//---------------------------------------------------------------------------- + +typedef struct _D3DXF_FILELOADRESOURCE +{ + HMODULE hModule; // Desc + LPCSTR lpName; // Desc + LPCSTR lpType; // Desc +} D3DXF_FILELOADRESOURCE; + +//---------------------------------------------------------------------------- +// D3DXF_FILELOADMEMORY: +//---------------------------------------------------------------------------- + +typedef struct _D3DXF_FILELOADMEMORY +{ + LPCVOID lpMemory; // Desc + SIZE_T dSize; // Desc +} D3DXF_FILELOADMEMORY; + +#if defined( _WIN32 ) && !defined( _NO_COM ) + +// {cef08cf9-7b4f-4429-9624-2a690a933201} +DEFINE_GUID( IID_ID3DXFile, +0xcef08cf9, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01 ); + +// {cef08cfa-7b4f-4429-9624-2a690a933201} +DEFINE_GUID( IID_ID3DXFileSaveObject, +0xcef08cfa, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01 ); + +// {cef08cfb-7b4f-4429-9624-2a690a933201} +DEFINE_GUID( IID_ID3DXFileSaveData, +0xcef08cfb, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01 ); + +// {cef08cfc-7b4f-4429-9624-2a690a933201} +DEFINE_GUID( IID_ID3DXFileEnumObject, +0xcef08cfc, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01 ); + +// {cef08cfd-7b4f-4429-9624-2a690a933201} +DEFINE_GUID( IID_ID3DXFileData, +0xcef08cfd, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01 ); + +#endif // defined( _WIN32 ) && !defined( _NO_COM ) + +#if defined( __cplusplus ) +#if !defined( DECLSPEC_UUID ) +#if _MSC_VER >= 1100 +#define DECLSPEC_UUID( x ) __declspec( uuid( x ) ) +#else // !( _MSC_VER >= 1100 ) +#define DECLSPEC_UUID( x ) +#endif // !( _MSC_VER >= 1100 ) +#endif // !defined( DECLSPEC_UUID ) + +interface DECLSPEC_UUID( "cef08cf9-7b4f-4429-9624-2a690a933201" ) + ID3DXFile; +interface DECLSPEC_UUID( "cef08cfa-7b4f-4429-9624-2a690a933201" ) + ID3DXFileSaveObject; +interface DECLSPEC_UUID( "cef08cfb-7b4f-4429-9624-2a690a933201" ) + ID3DXFileSaveData; +interface DECLSPEC_UUID( "cef08cfc-7b4f-4429-9624-2a690a933201" ) + ID3DXFileEnumObject; +interface DECLSPEC_UUID( "cef08cfd-7b4f-4429-9624-2a690a933201" ) + ID3DXFileData; + +#if defined( _COM_SMARTPTR_TYPEDEF ) +_COM_SMARTPTR_TYPEDEF( ID3DXFile, + __uuidof( ID3DXFile ) ); +_COM_SMARTPTR_TYPEDEF( ID3DXFileSaveObject, + __uuidof( ID3DXFileSaveObject ) ); +_COM_SMARTPTR_TYPEDEF( ID3DXFileSaveData, + __uuidof( ID3DXFileSaveData ) ); +_COM_SMARTPTR_TYPEDEF( ID3DXFileEnumObject, + __uuidof( ID3DXFileEnumObject ) ); +_COM_SMARTPTR_TYPEDEF( ID3DXFileData, + __uuidof( ID3DXFileData ) ); +#endif // defined( _COM_SMARTPTR_TYPEDEF ) +#endif // defined( __cplusplus ) + +typedef interface ID3DXFile ID3DXFile; +typedef interface ID3DXFileSaveObject ID3DXFileSaveObject; +typedef interface ID3DXFileSaveData ID3DXFileSaveData; +typedef interface ID3DXFileEnumObject ID3DXFileEnumObject; +typedef interface ID3DXFileData ID3DXFileData; + +////////////////////////////////////////////////////////////////////////////// +// ID3DXFile ///////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +#undef INTERFACE +#define INTERFACE ID3DXFile + +DECLARE_INTERFACE_( ID3DXFile, IUnknown ) +{ + STDMETHOD( QueryInterface )( THIS_ REFIID, LPVOID* ) PURE; + STDMETHOD_( ULONG, AddRef )( THIS ) PURE; + STDMETHOD_( ULONG, Release )( THIS ) PURE; + + STDMETHOD( CreateEnumObject )( THIS_ LPCVOID, D3DXF_FILELOADOPTIONS, + ID3DXFileEnumObject** ) PURE; + STDMETHOD( CreateSaveObject )( THIS_ LPCVOID, D3DXF_FILESAVEOPTIONS, + D3DXF_FILEFORMAT, ID3DXFileSaveObject** ) PURE; + STDMETHOD( RegisterTemplates )( THIS_ LPCVOID, SIZE_T ) PURE; + STDMETHOD( RegisterEnumTemplates )( THIS_ ID3DXFileEnumObject* ) PURE; +}; + +////////////////////////////////////////////////////////////////////////////// +// ID3DXFileSaveObject /////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +#undef INTERFACE +#define INTERFACE ID3DXFileSaveObject + +DECLARE_INTERFACE_( ID3DXFileSaveObject, IUnknown ) +{ + STDMETHOD( QueryInterface )( THIS_ REFIID, LPVOID* ) PURE; + STDMETHOD_( ULONG, AddRef )( THIS ) PURE; + STDMETHOD_( ULONG, Release )( THIS ) PURE; + + STDMETHOD( GetFile )( THIS_ ID3DXFile** ) PURE; + STDMETHOD( AddDataObject )( THIS_ REFGUID, LPCSTR, CONST GUID*, + SIZE_T, LPCVOID, ID3DXFileSaveData** ) PURE; + STDMETHOD( Save )( THIS ) PURE; +}; + +////////////////////////////////////////////////////////////////////////////// +// ID3DXFileSaveData ///////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +#undef INTERFACE +#define INTERFACE ID3DXFileSaveData + +DECLARE_INTERFACE_( ID3DXFileSaveData, IUnknown ) +{ + STDMETHOD( QueryInterface )( THIS_ REFIID, LPVOID* ) PURE; + STDMETHOD_( ULONG, AddRef )( THIS ) PURE; + STDMETHOD_( ULONG, Release )( THIS ) PURE; + + STDMETHOD( GetSave )( THIS_ ID3DXFileSaveObject** ) PURE; + STDMETHOD( GetName )( THIS_ LPSTR, SIZE_T* ) PURE; + STDMETHOD( GetId )( THIS_ LPGUID ) PURE; + STDMETHOD( GetType )( THIS_ GUID* ) PURE; + STDMETHOD( AddDataObject )( THIS_ REFGUID, LPCSTR, CONST GUID*, + SIZE_T, LPCVOID, ID3DXFileSaveData** ) PURE; + STDMETHOD( AddDataReference )( THIS_ LPCSTR, CONST GUID* ) PURE; +}; + +////////////////////////////////////////////////////////////////////////////// +// ID3DXFileEnumObject /////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +#undef INTERFACE +#define INTERFACE ID3DXFileEnumObject + +DECLARE_INTERFACE_( ID3DXFileEnumObject, IUnknown ) +{ + STDMETHOD( QueryInterface )( THIS_ REFIID, LPVOID* ) PURE; + STDMETHOD_( ULONG, AddRef )( THIS ) PURE; + STDMETHOD_( ULONG, Release )( THIS ) PURE; + + STDMETHOD( GetFile )( THIS_ ID3DXFile** ) PURE; + STDMETHOD( GetChildren )( THIS_ SIZE_T* ) PURE; + STDMETHOD( GetChild )( THIS_ SIZE_T, ID3DXFileData** ) PURE; + STDMETHOD( GetDataObjectById )( THIS_ REFGUID, ID3DXFileData** ) PURE; + STDMETHOD( GetDataObjectByName )( THIS_ LPCSTR, ID3DXFileData** ) PURE; +}; + +////////////////////////////////////////////////////////////////////////////// +// ID3DXFileData ///////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +#undef INTERFACE +#define INTERFACE ID3DXFileData + +DECLARE_INTERFACE_( ID3DXFileData, IUnknown ) +{ + STDMETHOD( QueryInterface )( THIS_ REFIID, LPVOID* ) PURE; + STDMETHOD_( ULONG, AddRef )( THIS ) PURE; + STDMETHOD_( ULONG, Release )( THIS ) PURE; + + STDMETHOD( GetEnum )( THIS_ ID3DXFileEnumObject** ) PURE; + STDMETHOD( GetName )( THIS_ LPSTR, SIZE_T* ) PURE; + STDMETHOD( GetId )( THIS_ LPGUID ) PURE; + STDMETHOD( Lock )( THIS_ SIZE_T*, LPCVOID* ) PURE; + STDMETHOD( Unlock )( THIS ) PURE; + STDMETHOD( GetType )( THIS_ GUID* ) PURE; + STDMETHOD_( BOOL, IsReference )( THIS ) PURE; + STDMETHOD( GetChildren )( THIS_ SIZE_T* ) PURE; + STDMETHOD( GetChild )( THIS_ SIZE_T, ID3DXFileData** ) PURE; +}; + +STDAPI D3DXFileCreate( ID3DXFile** lplpDirectXFile ); + +/* + * DirectX File errors. + */ + +#define _FACD3DXF 0x876 + +#define D3DXFERR_BADOBJECT MAKE_HRESULT( 1, _FACD3DXF, 900 ) +#define D3DXFERR_BADVALUE MAKE_HRESULT( 1, _FACD3DXF, 901 ) +#define D3DXFERR_BADTYPE MAKE_HRESULT( 1, _FACD3DXF, 902 ) +#define D3DXFERR_NOTFOUND MAKE_HRESULT( 1, _FACD3DXF, 903 ) +#define D3DXFERR_NOTDONEYET MAKE_HRESULT( 1, _FACD3DXF, 904 ) +#define D3DXFERR_FILENOTFOUND MAKE_HRESULT( 1, _FACD3DXF, 905 ) +#define D3DXFERR_RESOURCENOTFOUND MAKE_HRESULT( 1, _FACD3DXF, 906 ) +#define D3DXFERR_BADRESOURCE MAKE_HRESULT( 1, _FACD3DXF, 907 ) +#define D3DXFERR_BADFILETYPE MAKE_HRESULT( 1, _FACD3DXF, 908 ) +#define D3DXFERR_BADFILEVERSION MAKE_HRESULT( 1, _FACD3DXF, 909 ) +#define D3DXFERR_BADFILEFLOATSIZE MAKE_HRESULT( 1, _FACD3DXF, 910 ) +#define D3DXFERR_BADFILE MAKE_HRESULT( 1, _FACD3DXF, 911 ) +#define D3DXFERR_PARSEERROR MAKE_HRESULT( 1, _FACD3DXF, 912 ) +#define D3DXFERR_BADARRAYSIZE MAKE_HRESULT( 1, _FACD3DXF, 913 ) +#define D3DXFERR_BADDATAREFERENCE MAKE_HRESULT( 1, _FACD3DXF, 914 ) +#define D3DXFERR_NOMOREOBJECTS MAKE_HRESULT( 1, _FACD3DXF, 915 ) +#define D3DXFERR_NOMOREDATA MAKE_HRESULT( 1, _FACD3DXF, 916 ) +#define D3DXFERR_BADCACHEFILE MAKE_HRESULT( 1, _FACD3DXF, 917 ) + +/* + * DirectX File object types. + */ + +#ifndef WIN_TYPES +#define WIN_TYPES(itype, ptype) typedef interface itype *LP##ptype, **LPLP##ptype +#endif + +WIN_TYPES(ID3DXFile, D3DXFILE); +WIN_TYPES(ID3DXFileEnumObject, D3DXFILEENUMOBJECT); +WIN_TYPES(ID3DXFileSaveObject, D3DXFILESAVEOBJECT); +WIN_TYPES(ID3DXFileData, D3DXFILEDATA); +WIN_TYPES(ID3DXFileSaveData, D3DXFILESAVEDATA); + +#if defined( __cplusplus ) +} // extern "C" +#endif // defined( __cplusplus ) + +#endif // !defined( __D3DX9XOF_H__ ) + + diff --git a/MediaClient/MediaClient/directx/include/dinput.h b/MediaClient/MediaClient/directx/include/dinput.h new file mode 100644 index 0000000..5aac256 --- /dev/null +++ b/MediaClient/MediaClient/directx/include/dinput.h @@ -0,0 +1,4417 @@ +/**************************************************************************** + * + * Copyright (C) 1996-2000 Microsoft Corporation. All Rights Reserved. + * + * File: dinput.h + * Content: DirectInput include file + * + ****************************************************************************/ + +#ifndef __DINPUT_INCLUDED__ +#define __DINPUT_INCLUDED__ + +#ifndef DIJ_RINGZERO + +#ifdef _WIN32 +#define COM_NO_WINDOWS_H +#include +#endif + +#endif /* DIJ_RINGZERO */ + +#ifdef __cplusplus +extern "C" { +#endif + + + + + +/* + * To build applications for older versions of DirectInput + * + * #define DIRECTINPUT_VERSION [ 0x0300 | 0x0500 | 0x0700 ] + * + * before #include . By default, #include + * will produce a DirectX 8-compatible header file. + * + */ + +#define DIRECTINPUT_HEADER_VERSION 0x0800 +#ifndef DIRECTINPUT_VERSION +#define DIRECTINPUT_VERSION DIRECTINPUT_HEADER_VERSION +#pragma message(__FILE__ ": DIRECTINPUT_VERSION undefined. Defaulting to version 0x0800") +#endif + +#ifndef DIJ_RINGZERO + +/**************************************************************************** + * + * Class IDs + * + ****************************************************************************/ + +DEFINE_GUID(CLSID_DirectInput, 0x25E609E0,0xB259,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(CLSID_DirectInputDevice, 0x25E609E1,0xB259,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); + +DEFINE_GUID(CLSID_DirectInput8, 0x25E609E4,0xB259,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(CLSID_DirectInputDevice8,0x25E609E5,0xB259,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); + +/**************************************************************************** + * + * Interfaces + * + ****************************************************************************/ + +DEFINE_GUID(IID_IDirectInputA, 0x89521360,0xAA8A,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInputW, 0x89521361,0xAA8A,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInput2A, 0x5944E662,0xAA8A,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInput2W, 0x5944E663,0xAA8A,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInput7A, 0x9A4CB684,0x236D,0x11D3,0x8E,0x9D,0x00,0xC0,0x4F,0x68,0x44,0xAE); +DEFINE_GUID(IID_IDirectInput7W, 0x9A4CB685,0x236D,0x11D3,0x8E,0x9D,0x00,0xC0,0x4F,0x68,0x44,0xAE); +DEFINE_GUID(IID_IDirectInput8A, 0xBF798030,0x483A,0x4DA2,0xAA,0x99,0x5D,0x64,0xED,0x36,0x97,0x00); +DEFINE_GUID(IID_IDirectInput8W, 0xBF798031,0x483A,0x4DA2,0xAA,0x99,0x5D,0x64,0xED,0x36,0x97,0x00); +DEFINE_GUID(IID_IDirectInputDeviceA, 0x5944E680,0xC92E,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInputDeviceW, 0x5944E681,0xC92E,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInputDevice2A,0x5944E682,0xC92E,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInputDevice2W,0x5944E683,0xC92E,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInputDevice7A,0x57D7C6BC,0x2356,0x11D3,0x8E,0x9D,0x00,0xC0,0x4F,0x68,0x44,0xAE); +DEFINE_GUID(IID_IDirectInputDevice7W,0x57D7C6BD,0x2356,0x11D3,0x8E,0x9D,0x00,0xC0,0x4F,0x68,0x44,0xAE); +DEFINE_GUID(IID_IDirectInputDevice8A,0x54D41080,0xDC15,0x4833,0xA4,0x1B,0x74,0x8F,0x73,0xA3,0x81,0x79); +DEFINE_GUID(IID_IDirectInputDevice8W,0x54D41081,0xDC15,0x4833,0xA4,0x1B,0x74,0x8F,0x73,0xA3,0x81,0x79); +DEFINE_GUID(IID_IDirectInputEffect, 0xE7E1F7C0,0x88D2,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); + +/**************************************************************************** + * + * Predefined object types + * + ****************************************************************************/ + +DEFINE_GUID(GUID_XAxis, 0xA36D02E0,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_YAxis, 0xA36D02E1,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_ZAxis, 0xA36D02E2,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_RxAxis, 0xA36D02F4,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_RyAxis, 0xA36D02F5,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_RzAxis, 0xA36D02E3,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_Slider, 0xA36D02E4,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); + +DEFINE_GUID(GUID_Button, 0xA36D02F0,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_Key, 0x55728220,0xD33C,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); + +DEFINE_GUID(GUID_POV, 0xA36D02F2,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); + +DEFINE_GUID(GUID_Unknown, 0xA36D02F3,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); + +/**************************************************************************** + * + * Predefined product GUIDs + * + ****************************************************************************/ + +DEFINE_GUID(GUID_SysMouse, 0x6F1D2B60,0xD5A0,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_SysKeyboard,0x6F1D2B61,0xD5A0,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_Joystick ,0x6F1D2B70,0xD5A0,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_SysMouseEm, 0x6F1D2B80,0xD5A0,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_SysMouseEm2,0x6F1D2B81,0xD5A0,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_SysKeyboardEm, 0x6F1D2B82,0xD5A0,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(GUID_SysKeyboardEm2,0x6F1D2B83,0xD5A0,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); + +/**************************************************************************** + * + * Predefined force feedback effects + * + ****************************************************************************/ + +DEFINE_GUID(GUID_ConstantForce, 0x13541C20,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); +DEFINE_GUID(GUID_RampForce, 0x13541C21,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); +DEFINE_GUID(GUID_Square, 0x13541C22,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); +DEFINE_GUID(GUID_Sine, 0x13541C23,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); +DEFINE_GUID(GUID_Triangle, 0x13541C24,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); +DEFINE_GUID(GUID_SawtoothUp, 0x13541C25,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); +DEFINE_GUID(GUID_SawtoothDown, 0x13541C26,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); +DEFINE_GUID(GUID_Spring, 0x13541C27,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); +DEFINE_GUID(GUID_Damper, 0x13541C28,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); +DEFINE_GUID(GUID_Inertia, 0x13541C29,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); +DEFINE_GUID(GUID_Friction, 0x13541C2A,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); +DEFINE_GUID(GUID_CustomForce, 0x13541C2B,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); + +#endif /* DIJ_RINGZERO */ + +/**************************************************************************** + * + * Interfaces and Structures... + * + ****************************************************************************/ + +#if(DIRECTINPUT_VERSION >= 0x0500) + +/**************************************************************************** + * + * IDirectInputEffect + * + ****************************************************************************/ + +#define DIEFT_ALL 0x00000000 + +#define DIEFT_CONSTANTFORCE 0x00000001 +#define DIEFT_RAMPFORCE 0x00000002 +#define DIEFT_PERIODIC 0x00000003 +#define DIEFT_CONDITION 0x00000004 +#define DIEFT_CUSTOMFORCE 0x00000005 +#define DIEFT_HARDWARE 0x000000FF +#define DIEFT_FFATTACK 0x00000200 +#define DIEFT_FFFADE 0x00000400 +#define DIEFT_SATURATION 0x00000800 +#define DIEFT_POSNEGCOEFFICIENTS 0x00001000 +#define DIEFT_POSNEGSATURATION 0x00002000 +#define DIEFT_DEADBAND 0x00004000 +#define DIEFT_STARTDELAY 0x00008000 +#define DIEFT_GETTYPE(n) LOBYTE(n) + +#define DI_DEGREES 100 +#define DI_FFNOMINALMAX 10000 +#define DI_SECONDS 1000000 + +typedef struct DICONSTANTFORCE { + LONG lMagnitude; +} DICONSTANTFORCE, *LPDICONSTANTFORCE; +typedef const DICONSTANTFORCE *LPCDICONSTANTFORCE; + +typedef struct DIRAMPFORCE { + LONG lStart; + LONG lEnd; +} DIRAMPFORCE, *LPDIRAMPFORCE; +typedef const DIRAMPFORCE *LPCDIRAMPFORCE; + +typedef struct DIPERIODIC { + DWORD dwMagnitude; + LONG lOffset; + DWORD dwPhase; + DWORD dwPeriod; +} DIPERIODIC, *LPDIPERIODIC; +typedef const DIPERIODIC *LPCDIPERIODIC; + +typedef struct DICONDITION { + LONG lOffset; + LONG lPositiveCoefficient; + LONG lNegativeCoefficient; + DWORD dwPositiveSaturation; + DWORD dwNegativeSaturation; + LONG lDeadBand; +} DICONDITION, *LPDICONDITION; +typedef const DICONDITION *LPCDICONDITION; + +typedef struct DICUSTOMFORCE { + DWORD cChannels; + DWORD dwSamplePeriod; + DWORD cSamples; + LPLONG rglForceData; +} DICUSTOMFORCE, *LPDICUSTOMFORCE; +typedef const DICUSTOMFORCE *LPCDICUSTOMFORCE; + + +typedef struct DIENVELOPE { + DWORD dwSize; /* sizeof(DIENVELOPE) */ + DWORD dwAttackLevel; + DWORD dwAttackTime; /* Microseconds */ + DWORD dwFadeLevel; + DWORD dwFadeTime; /* Microseconds */ +} DIENVELOPE, *LPDIENVELOPE; +typedef const DIENVELOPE *LPCDIENVELOPE; + + +/* This structure is defined for DirectX 5.0 compatibility */ +typedef struct DIEFFECT_DX5 { + DWORD dwSize; /* sizeof(DIEFFECT_DX5) */ + DWORD dwFlags; /* DIEFF_* */ + DWORD dwDuration; /* Microseconds */ + DWORD dwSamplePeriod; /* Microseconds */ + DWORD dwGain; + DWORD dwTriggerButton; /* or DIEB_NOTRIGGER */ + DWORD dwTriggerRepeatInterval; /* Microseconds */ + DWORD cAxes; /* Number of axes */ + LPDWORD rgdwAxes; /* Array of axes */ + LPLONG rglDirection; /* Array of directions */ + LPDIENVELOPE lpEnvelope; /* Optional */ + DWORD cbTypeSpecificParams; /* Size of params */ + LPVOID lpvTypeSpecificParams; /* Pointer to params */ +} DIEFFECT_DX5, *LPDIEFFECT_DX5; +typedef const DIEFFECT_DX5 *LPCDIEFFECT_DX5; + +typedef struct DIEFFECT { + DWORD dwSize; /* sizeof(DIEFFECT) */ + DWORD dwFlags; /* DIEFF_* */ + DWORD dwDuration; /* Microseconds */ + DWORD dwSamplePeriod; /* Microseconds */ + DWORD dwGain; + DWORD dwTriggerButton; /* or DIEB_NOTRIGGER */ + DWORD dwTriggerRepeatInterval; /* Microseconds */ + DWORD cAxes; /* Number of axes */ + LPDWORD rgdwAxes; /* Array of axes */ + LPLONG rglDirection; /* Array of directions */ + LPDIENVELOPE lpEnvelope; /* Optional */ + DWORD cbTypeSpecificParams; /* Size of params */ + LPVOID lpvTypeSpecificParams; /* Pointer to params */ +#if(DIRECTINPUT_VERSION >= 0x0600) + DWORD dwStartDelay; /* Microseconds */ +#endif /* DIRECTINPUT_VERSION >= 0x0600 */ +} DIEFFECT, *LPDIEFFECT; +typedef DIEFFECT DIEFFECT_DX6; +typedef LPDIEFFECT LPDIEFFECT_DX6; +typedef const DIEFFECT *LPCDIEFFECT; + + +#if(DIRECTINPUT_VERSION >= 0x0700) +#ifndef DIJ_RINGZERO +typedef struct DIFILEEFFECT{ + DWORD dwSize; + GUID GuidEffect; + LPCDIEFFECT lpDiEffect; + CHAR szFriendlyName[MAX_PATH]; +}DIFILEEFFECT, *LPDIFILEEFFECT; +typedef const DIFILEEFFECT *LPCDIFILEEFFECT; +typedef BOOL (FAR PASCAL * LPDIENUMEFFECTSINFILECALLBACK)(LPCDIFILEEFFECT , LPVOID); +#endif /* DIJ_RINGZERO */ +#endif /* DIRECTINPUT_VERSION >= 0x0700 */ + +#define DIEFF_OBJECTIDS 0x00000001 +#define DIEFF_OBJECTOFFSETS 0x00000002 +#define DIEFF_CARTESIAN 0x00000010 +#define DIEFF_POLAR 0x00000020 +#define DIEFF_SPHERICAL 0x00000040 + +#define DIEP_DURATION 0x00000001 +#define DIEP_SAMPLEPERIOD 0x00000002 +#define DIEP_GAIN 0x00000004 +#define DIEP_TRIGGERBUTTON 0x00000008 +#define DIEP_TRIGGERREPEATINTERVAL 0x00000010 +#define DIEP_AXES 0x00000020 +#define DIEP_DIRECTION 0x00000040 +#define DIEP_ENVELOPE 0x00000080 +#define DIEP_TYPESPECIFICPARAMS 0x00000100 +#if(DIRECTINPUT_VERSION >= 0x0600) +#define DIEP_STARTDELAY 0x00000200 +#define DIEP_ALLPARAMS_DX5 0x000001FF +#define DIEP_ALLPARAMS 0x000003FF +#else /* DIRECTINPUT_VERSION < 0x0600 */ +#define DIEP_ALLPARAMS 0x000001FF +#endif /* DIRECTINPUT_VERSION < 0x0600 */ +#define DIEP_START 0x20000000 +#define DIEP_NORESTART 0x40000000 +#define DIEP_NODOWNLOAD 0x80000000 +#define DIEB_NOTRIGGER 0xFFFFFFFF + +#define DIES_SOLO 0x00000001 +#define DIES_NODOWNLOAD 0x80000000 + +#define DIEGES_PLAYING 0x00000001 +#define DIEGES_EMULATED 0x00000002 + +typedef struct DIEFFESCAPE { + DWORD dwSize; + DWORD dwCommand; + LPVOID lpvInBuffer; + DWORD cbInBuffer; + LPVOID lpvOutBuffer; + DWORD cbOutBuffer; +} DIEFFESCAPE, *LPDIEFFESCAPE; + +#ifndef DIJ_RINGZERO + +#undef INTERFACE +#define INTERFACE IDirectInputEffect + +DECLARE_INTERFACE_(IDirectInputEffect, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputEffect methods ***/ + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD,REFGUID) PURE; + STDMETHOD(GetEffectGuid)(THIS_ LPGUID) PURE; + STDMETHOD(GetParameters)(THIS_ LPDIEFFECT,DWORD) PURE; + STDMETHOD(SetParameters)(THIS_ LPCDIEFFECT,DWORD) PURE; + STDMETHOD(Start)(THIS_ DWORD,DWORD) PURE; + STDMETHOD(Stop)(THIS) PURE; + STDMETHOD(GetEffectStatus)(THIS_ LPDWORD) PURE; + STDMETHOD(Download)(THIS) PURE; + STDMETHOD(Unload)(THIS) PURE; + STDMETHOD(Escape)(THIS_ LPDIEFFESCAPE) PURE; +}; + +typedef struct IDirectInputEffect *LPDIRECTINPUTEFFECT; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectInputEffect_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectInputEffect_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectInputEffect_Release(p) (p)->lpVtbl->Release(p) +#define IDirectInputEffect_Initialize(p,a,b,c) (p)->lpVtbl->Initialize(p,a,b,c) +#define IDirectInputEffect_GetEffectGuid(p,a) (p)->lpVtbl->GetEffectGuid(p,a) +#define IDirectInputEffect_GetParameters(p,a,b) (p)->lpVtbl->GetParameters(p,a,b) +#define IDirectInputEffect_SetParameters(p,a,b) (p)->lpVtbl->SetParameters(p,a,b) +#define IDirectInputEffect_Start(p,a,b) (p)->lpVtbl->Start(p,a,b) +#define IDirectInputEffect_Stop(p) (p)->lpVtbl->Stop(p) +#define IDirectInputEffect_GetEffectStatus(p,a) (p)->lpVtbl->GetEffectStatus(p,a) +#define IDirectInputEffect_Download(p) (p)->lpVtbl->Download(p) +#define IDirectInputEffect_Unload(p) (p)->lpVtbl->Unload(p) +#define IDirectInputEffect_Escape(p,a) (p)->lpVtbl->Escape(p,a) +#else +#define IDirectInputEffect_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectInputEffect_AddRef(p) (p)->AddRef() +#define IDirectInputEffect_Release(p) (p)->Release() +#define IDirectInputEffect_Initialize(p,a,b,c) (p)->Initialize(a,b,c) +#define IDirectInputEffect_GetEffectGuid(p,a) (p)->GetEffectGuid(a) +#define IDirectInputEffect_GetParameters(p,a,b) (p)->GetParameters(a,b) +#define IDirectInputEffect_SetParameters(p,a,b) (p)->SetParameters(a,b) +#define IDirectInputEffect_Start(p,a,b) (p)->Start(a,b) +#define IDirectInputEffect_Stop(p) (p)->Stop() +#define IDirectInputEffect_GetEffectStatus(p,a) (p)->GetEffectStatus(a) +#define IDirectInputEffect_Download(p) (p)->Download() +#define IDirectInputEffect_Unload(p) (p)->Unload() +#define IDirectInputEffect_Escape(p,a) (p)->Escape(a) +#endif + +#endif /* DIJ_RINGZERO */ + +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ + +/**************************************************************************** + * + * IDirectInputDevice + * + ****************************************************************************/ + +#if DIRECTINPUT_VERSION <= 0x700 +#define DIDEVTYPE_DEVICE 1 +#define DIDEVTYPE_MOUSE 2 +#define DIDEVTYPE_KEYBOARD 3 +#define DIDEVTYPE_JOYSTICK 4 + +#else +#define DI8DEVCLASS_ALL 0 +#define DI8DEVCLASS_DEVICE 1 +#define DI8DEVCLASS_POINTER 2 +#define DI8DEVCLASS_KEYBOARD 3 +#define DI8DEVCLASS_GAMECTRL 4 + +#define DI8DEVTYPE_DEVICE 0x11 +#define DI8DEVTYPE_MOUSE 0x12 +#define DI8DEVTYPE_KEYBOARD 0x13 +#define DI8DEVTYPE_JOYSTICK 0x14 +#define DI8DEVTYPE_GAMEPAD 0x15 +#define DI8DEVTYPE_DRIVING 0x16 +#define DI8DEVTYPE_FLIGHT 0x17 +#define DI8DEVTYPE_1STPERSON 0x18 +#define DI8DEVTYPE_DEVICECTRL 0x19 +#define DI8DEVTYPE_SCREENPOINTER 0x1A +#define DI8DEVTYPE_REMOTE 0x1B +#define DI8DEVTYPE_SUPPLEMENTAL 0x1C +#endif /* DIRECTINPUT_VERSION <= 0x700 */ + +#define DIDEVTYPE_HID 0x00010000 + +#if DIRECTINPUT_VERSION <= 0x700 +#define DIDEVTYPEMOUSE_UNKNOWN 1 +#define DIDEVTYPEMOUSE_TRADITIONAL 2 +#define DIDEVTYPEMOUSE_FINGERSTICK 3 +#define DIDEVTYPEMOUSE_TOUCHPAD 4 +#define DIDEVTYPEMOUSE_TRACKBALL 5 + +#define DIDEVTYPEKEYBOARD_UNKNOWN 0 +#define DIDEVTYPEKEYBOARD_PCXT 1 +#define DIDEVTYPEKEYBOARD_OLIVETTI 2 +#define DIDEVTYPEKEYBOARD_PCAT 3 +#define DIDEVTYPEKEYBOARD_PCENH 4 +#define DIDEVTYPEKEYBOARD_NOKIA1050 5 +#define DIDEVTYPEKEYBOARD_NOKIA9140 6 +#define DIDEVTYPEKEYBOARD_NEC98 7 +#define DIDEVTYPEKEYBOARD_NEC98LAPTOP 8 +#define DIDEVTYPEKEYBOARD_NEC98106 9 +#define DIDEVTYPEKEYBOARD_JAPAN106 10 +#define DIDEVTYPEKEYBOARD_JAPANAX 11 +#define DIDEVTYPEKEYBOARD_J3100 12 + +#define DIDEVTYPEJOYSTICK_UNKNOWN 1 +#define DIDEVTYPEJOYSTICK_TRADITIONAL 2 +#define DIDEVTYPEJOYSTICK_FLIGHTSTICK 3 +#define DIDEVTYPEJOYSTICK_GAMEPAD 4 +#define DIDEVTYPEJOYSTICK_RUDDER 5 +#define DIDEVTYPEJOYSTICK_WHEEL 6 +#define DIDEVTYPEJOYSTICK_HEADTRACKER 7 + +#else +#define DI8DEVTYPEMOUSE_UNKNOWN 1 +#define DI8DEVTYPEMOUSE_TRADITIONAL 2 +#define DI8DEVTYPEMOUSE_FINGERSTICK 3 +#define DI8DEVTYPEMOUSE_TOUCHPAD 4 +#define DI8DEVTYPEMOUSE_TRACKBALL 5 +#define DI8DEVTYPEMOUSE_ABSOLUTE 6 + +#define DI8DEVTYPEKEYBOARD_UNKNOWN 0 +#define DI8DEVTYPEKEYBOARD_PCXT 1 +#define DI8DEVTYPEKEYBOARD_OLIVETTI 2 +#define DI8DEVTYPEKEYBOARD_PCAT 3 +#define DI8DEVTYPEKEYBOARD_PCENH 4 +#define DI8DEVTYPEKEYBOARD_NOKIA1050 5 +#define DI8DEVTYPEKEYBOARD_NOKIA9140 6 +#define DI8DEVTYPEKEYBOARD_NEC98 7 +#define DI8DEVTYPEKEYBOARD_NEC98LAPTOP 8 +#define DI8DEVTYPEKEYBOARD_NEC98106 9 +#define DI8DEVTYPEKEYBOARD_JAPAN106 10 +#define DI8DEVTYPEKEYBOARD_JAPANAX 11 +#define DI8DEVTYPEKEYBOARD_J3100 12 + +#define DI8DEVTYPE_LIMITEDGAMESUBTYPE 1 + +#define DI8DEVTYPEJOYSTICK_LIMITED DI8DEVTYPE_LIMITEDGAMESUBTYPE +#define DI8DEVTYPEJOYSTICK_STANDARD 2 + +#define DI8DEVTYPEGAMEPAD_LIMITED DI8DEVTYPE_LIMITEDGAMESUBTYPE +#define DI8DEVTYPEGAMEPAD_STANDARD 2 +#define DI8DEVTYPEGAMEPAD_TILT 3 + +#define DI8DEVTYPEDRIVING_LIMITED DI8DEVTYPE_LIMITEDGAMESUBTYPE +#define DI8DEVTYPEDRIVING_COMBINEDPEDALS 2 +#define DI8DEVTYPEDRIVING_DUALPEDALS 3 +#define DI8DEVTYPEDRIVING_THREEPEDALS 4 +#define DI8DEVTYPEDRIVING_HANDHELD 5 + +#define DI8DEVTYPEFLIGHT_LIMITED DI8DEVTYPE_LIMITEDGAMESUBTYPE +#define DI8DEVTYPEFLIGHT_STICK 2 +#define DI8DEVTYPEFLIGHT_YOKE 3 +#define DI8DEVTYPEFLIGHT_RC 4 + +#define DI8DEVTYPE1STPERSON_LIMITED DI8DEVTYPE_LIMITEDGAMESUBTYPE +#define DI8DEVTYPE1STPERSON_UNKNOWN 2 +#define DI8DEVTYPE1STPERSON_SIXDOF 3 +#define DI8DEVTYPE1STPERSON_SHOOTER 4 + +#define DI8DEVTYPESCREENPTR_UNKNOWN 2 +#define DI8DEVTYPESCREENPTR_LIGHTGUN 3 +#define DI8DEVTYPESCREENPTR_LIGHTPEN 4 +#define DI8DEVTYPESCREENPTR_TOUCH 5 + +#define DI8DEVTYPEREMOTE_UNKNOWN 2 + +#define DI8DEVTYPEDEVICECTRL_UNKNOWN 2 +#define DI8DEVTYPEDEVICECTRL_COMMSSELECTION 3 +#define DI8DEVTYPEDEVICECTRL_COMMSSELECTION_HARDWIRED 4 + +#define DI8DEVTYPESUPPLEMENTAL_UNKNOWN 2 +#define DI8DEVTYPESUPPLEMENTAL_2NDHANDCONTROLLER 3 +#define DI8DEVTYPESUPPLEMENTAL_HEADTRACKER 4 +#define DI8DEVTYPESUPPLEMENTAL_HANDTRACKER 5 +#define DI8DEVTYPESUPPLEMENTAL_SHIFTSTICKGATE 6 +#define DI8DEVTYPESUPPLEMENTAL_SHIFTER 7 +#define DI8DEVTYPESUPPLEMENTAL_THROTTLE 8 +#define DI8DEVTYPESUPPLEMENTAL_SPLITTHROTTLE 9 +#define DI8DEVTYPESUPPLEMENTAL_COMBINEDPEDALS 10 +#define DI8DEVTYPESUPPLEMENTAL_DUALPEDALS 11 +#define DI8DEVTYPESUPPLEMENTAL_THREEPEDALS 12 +#define DI8DEVTYPESUPPLEMENTAL_RUDDERPEDALS 13 +#endif /* DIRECTINPUT_VERSION <= 0x700 */ + +#define GET_DIDEVICE_TYPE(dwDevType) LOBYTE(dwDevType) +#define GET_DIDEVICE_SUBTYPE(dwDevType) HIBYTE(dwDevType) + +#if(DIRECTINPUT_VERSION >= 0x0500) +/* This structure is defined for DirectX 3.0 compatibility */ +typedef struct DIDEVCAPS_DX3 { + DWORD dwSize; + DWORD dwFlags; + DWORD dwDevType; + DWORD dwAxes; + DWORD dwButtons; + DWORD dwPOVs; +} DIDEVCAPS_DX3, *LPDIDEVCAPS_DX3; +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ + +typedef struct DIDEVCAPS { + DWORD dwSize; + DWORD dwFlags; + DWORD dwDevType; + DWORD dwAxes; + DWORD dwButtons; + DWORD dwPOVs; +#if(DIRECTINPUT_VERSION >= 0x0500) + DWORD dwFFSamplePeriod; + DWORD dwFFMinTimeResolution; + DWORD dwFirmwareRevision; + DWORD dwHardwareRevision; + DWORD dwFFDriverVersion; +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ +} DIDEVCAPS, *LPDIDEVCAPS; + +#define DIDC_ATTACHED 0x00000001 +#define DIDC_POLLEDDEVICE 0x00000002 +#define DIDC_EMULATED 0x00000004 +#define DIDC_POLLEDDATAFORMAT 0x00000008 +#if(DIRECTINPUT_VERSION >= 0x0500) +#define DIDC_FORCEFEEDBACK 0x00000100 +#define DIDC_FFATTACK 0x00000200 +#define DIDC_FFFADE 0x00000400 +#define DIDC_SATURATION 0x00000800 +#define DIDC_POSNEGCOEFFICIENTS 0x00001000 +#define DIDC_POSNEGSATURATION 0x00002000 +#define DIDC_DEADBAND 0x00004000 +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ +#define DIDC_STARTDELAY 0x00008000 +#if(DIRECTINPUT_VERSION >= 0x050a) +#define DIDC_ALIAS 0x00010000 +#define DIDC_PHANTOM 0x00020000 +#endif /* DIRECTINPUT_VERSION >= 0x050a */ +#if(DIRECTINPUT_VERSION >= 0x0800) +#define DIDC_HIDDEN 0x00040000 +#endif /* DIRECTINPUT_VERSION >= 0x0800 */ + +#define DIDFT_ALL 0x00000000 + +#define DIDFT_RELAXIS 0x00000001 +#define DIDFT_ABSAXIS 0x00000002 +#define DIDFT_AXIS 0x00000003 + +#define DIDFT_PSHBUTTON 0x00000004 +#define DIDFT_TGLBUTTON 0x00000008 +#define DIDFT_BUTTON 0x0000000C + +#define DIDFT_POV 0x00000010 +#define DIDFT_COLLECTION 0x00000040 +#define DIDFT_NODATA 0x00000080 + +#define DIDFT_ANYINSTANCE 0x00FFFF00 +#define DIDFT_INSTANCEMASK DIDFT_ANYINSTANCE +#define DIDFT_MAKEINSTANCE(n) ((WORD)(n) << 8) +#define DIDFT_GETTYPE(n) LOBYTE(n) +#define DIDFT_GETINSTANCE(n) LOWORD((n) >> 8) +#define DIDFT_FFACTUATOR 0x01000000 +#define DIDFT_FFEFFECTTRIGGER 0x02000000 +#if(DIRECTINPUT_VERSION >= 0x050a) +#define DIDFT_OUTPUT 0x10000000 +#define DIDFT_VENDORDEFINED 0x04000000 +#define DIDFT_ALIAS 0x08000000 +#endif /* DIRECTINPUT_VERSION >= 0x050a */ +#ifndef DIDFT_OPTIONAL +#define DIDFT_OPTIONAL 0x80000000 +#endif + +#define DIDFT_ENUMCOLLECTION(n) ((WORD)(n) << 8) +#define DIDFT_NOCOLLECTION 0x00FFFF00 + +#ifndef DIJ_RINGZERO + +typedef struct _DIOBJECTDATAFORMAT { + const GUID *pguid; + DWORD dwOfs; + DWORD dwType; + DWORD dwFlags; +} DIOBJECTDATAFORMAT, *LPDIOBJECTDATAFORMAT; +typedef const DIOBJECTDATAFORMAT *LPCDIOBJECTDATAFORMAT; + +typedef struct _DIDATAFORMAT { + DWORD dwSize; + DWORD dwObjSize; + DWORD dwFlags; + DWORD dwDataSize; + DWORD dwNumObjs; + LPDIOBJECTDATAFORMAT rgodf; +} DIDATAFORMAT, *LPDIDATAFORMAT; +typedef const DIDATAFORMAT *LPCDIDATAFORMAT; + +#define DIDF_ABSAXIS 0x00000001 +#define DIDF_RELAXIS 0x00000002 + +#ifdef __cplusplus +extern "C" { +#endif +extern const DIDATAFORMAT c_dfDIMouse; + +#if(DIRECTINPUT_VERSION >= 0x0700) +extern const DIDATAFORMAT c_dfDIMouse2; +#endif /* DIRECTINPUT_VERSION >= 0x0700 */ + +extern const DIDATAFORMAT c_dfDIKeyboard; + +#if(DIRECTINPUT_VERSION >= 0x0500) +extern const DIDATAFORMAT c_dfDIJoystick; +extern const DIDATAFORMAT c_dfDIJoystick2; +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ + +#ifdef __cplusplus +}; +#endif + + +#if DIRECTINPUT_VERSION > 0x0700 + +typedef struct _DIACTIONA { + UINT_PTR uAppData; + DWORD dwSemantic; + OPTIONAL DWORD dwFlags; + OPTIONAL union { + LPCSTR lptszActionName; + UINT uResIdString; + }; + OPTIONAL GUID guidInstance; + OPTIONAL DWORD dwObjID; + OPTIONAL DWORD dwHow; +} DIACTIONA, *LPDIACTIONA ; +typedef struct _DIACTIONW { + UINT_PTR uAppData; + DWORD dwSemantic; + OPTIONAL DWORD dwFlags; + OPTIONAL union { + LPCWSTR lptszActionName; + UINT uResIdString; + }; + OPTIONAL GUID guidInstance; + OPTIONAL DWORD dwObjID; + OPTIONAL DWORD dwHow; +} DIACTIONW, *LPDIACTIONW ; +#ifdef UNICODE +typedef DIACTIONW DIACTION; +typedef LPDIACTIONW LPDIACTION; +#else +typedef DIACTIONA DIACTION; +typedef LPDIACTIONA LPDIACTION; +#endif // UNICODE + +typedef const DIACTIONA *LPCDIACTIONA; +typedef const DIACTIONW *LPCDIACTIONW; +#ifdef UNICODE +typedef DIACTIONW DIACTION; +typedef LPCDIACTIONW LPCDIACTION; +#else +typedef DIACTIONA DIACTION; +typedef LPCDIACTIONA LPCDIACTION; +#endif // UNICODE +typedef const DIACTION *LPCDIACTION; + + +#define DIA_FORCEFEEDBACK 0x00000001 +#define DIA_APPMAPPED 0x00000002 +#define DIA_APPNOMAP 0x00000004 +#define DIA_NORANGE 0x00000008 +#define DIA_APPFIXED 0x00000010 + +#define DIAH_UNMAPPED 0x00000000 +#define DIAH_USERCONFIG 0x00000001 +#define DIAH_APPREQUESTED 0x00000002 +#define DIAH_HWAPP 0x00000004 +#define DIAH_HWDEFAULT 0x00000008 +#define DIAH_DEFAULT 0x00000020 +#define DIAH_ERROR 0x80000000 + +typedef struct _DIACTIONFORMATA { + DWORD dwSize; + DWORD dwActionSize; + DWORD dwDataSize; + DWORD dwNumActions; + LPDIACTIONA rgoAction; + GUID guidActionMap; + DWORD dwGenre; + DWORD dwBufferSize; + OPTIONAL LONG lAxisMin; + OPTIONAL LONG lAxisMax; + OPTIONAL HINSTANCE hInstString; + FILETIME ftTimeStamp; + DWORD dwCRC; + CHAR tszActionMap[MAX_PATH]; +} DIACTIONFORMATA, *LPDIACTIONFORMATA; +typedef struct _DIACTIONFORMATW { + DWORD dwSize; + DWORD dwActionSize; + DWORD dwDataSize; + DWORD dwNumActions; + LPDIACTIONW rgoAction; + GUID guidActionMap; + DWORD dwGenre; + DWORD dwBufferSize; + OPTIONAL LONG lAxisMin; + OPTIONAL LONG lAxisMax; + OPTIONAL HINSTANCE hInstString; + FILETIME ftTimeStamp; + DWORD dwCRC; + WCHAR tszActionMap[MAX_PATH]; +} DIACTIONFORMATW, *LPDIACTIONFORMATW; +#ifdef UNICODE +typedef DIACTIONFORMATW DIACTIONFORMAT; +typedef LPDIACTIONFORMATW LPDIACTIONFORMAT; +#else +typedef DIACTIONFORMATA DIACTIONFORMAT; +typedef LPDIACTIONFORMATA LPDIACTIONFORMAT; +#endif // UNICODE +typedef const DIACTIONFORMATA *LPCDIACTIONFORMATA; +typedef const DIACTIONFORMATW *LPCDIACTIONFORMATW; +#ifdef UNICODE +typedef DIACTIONFORMATW DIACTIONFORMAT; +typedef LPCDIACTIONFORMATW LPCDIACTIONFORMAT; +#else +typedef DIACTIONFORMATA DIACTIONFORMAT; +typedef LPCDIACTIONFORMATA LPCDIACTIONFORMAT; +#endif // UNICODE +typedef const DIACTIONFORMAT *LPCDIACTIONFORMAT; + +#define DIAFTS_NEWDEVICELOW 0xFFFFFFFF +#define DIAFTS_NEWDEVICEHIGH 0xFFFFFFFF +#define DIAFTS_UNUSEDDEVICELOW 0x00000000 +#define DIAFTS_UNUSEDDEVICEHIGH 0x00000000 + +#define DIDBAM_DEFAULT 0x00000000 +#define DIDBAM_PRESERVE 0x00000001 +#define DIDBAM_INITIALIZE 0x00000002 +#define DIDBAM_HWDEFAULTS 0x00000004 + +#define DIDSAM_DEFAULT 0x00000000 +#define DIDSAM_NOUSER 0x00000001 +#define DIDSAM_FORCESAVE 0x00000002 + +#define DICD_DEFAULT 0x00000000 +#define DICD_EDIT 0x00000001 + +/* + * The following definition is normally defined in d3dtypes.h + */ +#ifndef D3DCOLOR_DEFINED +typedef DWORD D3DCOLOR; +#define D3DCOLOR_DEFINED +#endif + +typedef struct _DICOLORSET{ + DWORD dwSize; + D3DCOLOR cTextFore; + D3DCOLOR cTextHighlight; + D3DCOLOR cCalloutLine; + D3DCOLOR cCalloutHighlight; + D3DCOLOR cBorder; + D3DCOLOR cControlFill; + D3DCOLOR cHighlightFill; + D3DCOLOR cAreaFill; +} DICOLORSET, *LPDICOLORSET; +typedef const DICOLORSET *LPCDICOLORSET; + + +typedef struct _DICONFIGUREDEVICESPARAMSA{ + DWORD dwSize; + DWORD dwcUsers; + LPSTR lptszUserNames; + DWORD dwcFormats; + LPDIACTIONFORMATA lprgFormats; + HWND hwnd; + DICOLORSET dics; + IUnknown FAR * lpUnkDDSTarget; +} DICONFIGUREDEVICESPARAMSA, *LPDICONFIGUREDEVICESPARAMSA; +typedef struct _DICONFIGUREDEVICESPARAMSW{ + DWORD dwSize; + DWORD dwcUsers; + LPWSTR lptszUserNames; + DWORD dwcFormats; + LPDIACTIONFORMATW lprgFormats; + HWND hwnd; + DICOLORSET dics; + IUnknown FAR * lpUnkDDSTarget; +} DICONFIGUREDEVICESPARAMSW, *LPDICONFIGUREDEVICESPARAMSW; +#ifdef UNICODE +typedef DICONFIGUREDEVICESPARAMSW DICONFIGUREDEVICESPARAMS; +typedef LPDICONFIGUREDEVICESPARAMSW LPDICONFIGUREDEVICESPARAMS; +#else +typedef DICONFIGUREDEVICESPARAMSA DICONFIGUREDEVICESPARAMS; +typedef LPDICONFIGUREDEVICESPARAMSA LPDICONFIGUREDEVICESPARAMS; +#endif // UNICODE +typedef const DICONFIGUREDEVICESPARAMSA *LPCDICONFIGUREDEVICESPARAMSA; +typedef const DICONFIGUREDEVICESPARAMSW *LPCDICONFIGUREDEVICESPARAMSW; +#ifdef UNICODE +typedef DICONFIGUREDEVICESPARAMSW DICONFIGUREDEVICESPARAMS; +typedef LPCDICONFIGUREDEVICESPARAMSW LPCDICONFIGUREDEVICESPARAMS; +#else +typedef DICONFIGUREDEVICESPARAMSA DICONFIGUREDEVICESPARAMS; +typedef LPCDICONFIGUREDEVICESPARAMSA LPCDICONFIGUREDEVICESPARAMS; +#endif // UNICODE +typedef const DICONFIGUREDEVICESPARAMS *LPCDICONFIGUREDEVICESPARAMS; + + +#define DIDIFT_CONFIGURATION 0x00000001 +#define DIDIFT_OVERLAY 0x00000002 + +#define DIDAL_CENTERED 0x00000000 +#define DIDAL_LEFTALIGNED 0x00000001 +#define DIDAL_RIGHTALIGNED 0x00000002 +#define DIDAL_MIDDLE 0x00000000 +#define DIDAL_TOPALIGNED 0x00000004 +#define DIDAL_BOTTOMALIGNED 0x00000008 + +typedef struct _DIDEVICEIMAGEINFOA { + CHAR tszImagePath[MAX_PATH]; + DWORD dwFlags; + // These are valid if DIDIFT_OVERLAY is present in dwFlags. + DWORD dwViewID; + RECT rcOverlay; + DWORD dwObjID; + DWORD dwcValidPts; + POINT rgptCalloutLine[5]; + RECT rcCalloutRect; + DWORD dwTextAlign; +} DIDEVICEIMAGEINFOA, *LPDIDEVICEIMAGEINFOA; +typedef struct _DIDEVICEIMAGEINFOW { + WCHAR tszImagePath[MAX_PATH]; + DWORD dwFlags; + // These are valid if DIDIFT_OVERLAY is present in dwFlags. + DWORD dwViewID; + RECT rcOverlay; + DWORD dwObjID; + DWORD dwcValidPts; + POINT rgptCalloutLine[5]; + RECT rcCalloutRect; + DWORD dwTextAlign; +} DIDEVICEIMAGEINFOW, *LPDIDEVICEIMAGEINFOW; +#ifdef UNICODE +typedef DIDEVICEIMAGEINFOW DIDEVICEIMAGEINFO; +typedef LPDIDEVICEIMAGEINFOW LPDIDEVICEIMAGEINFO; +#else +typedef DIDEVICEIMAGEINFOA DIDEVICEIMAGEINFO; +typedef LPDIDEVICEIMAGEINFOA LPDIDEVICEIMAGEINFO; +#endif // UNICODE +typedef const DIDEVICEIMAGEINFOA *LPCDIDEVICEIMAGEINFOA; +typedef const DIDEVICEIMAGEINFOW *LPCDIDEVICEIMAGEINFOW; +#ifdef UNICODE +typedef DIDEVICEIMAGEINFOW DIDEVICEIMAGEINFO; +typedef LPCDIDEVICEIMAGEINFOW LPCDIDEVICEIMAGEINFO; +#else +typedef DIDEVICEIMAGEINFOA DIDEVICEIMAGEINFO; +typedef LPCDIDEVICEIMAGEINFOA LPCDIDEVICEIMAGEINFO; +#endif // UNICODE +typedef const DIDEVICEIMAGEINFO *LPCDIDEVICEIMAGEINFO; + +typedef struct _DIDEVICEIMAGEINFOHEADERA { + DWORD dwSize; + DWORD dwSizeImageInfo; + DWORD dwcViews; + DWORD dwcButtons; + DWORD dwcAxes; + DWORD dwcPOVs; + DWORD dwBufferSize; + DWORD dwBufferUsed; + LPDIDEVICEIMAGEINFOA lprgImageInfoArray; +} DIDEVICEIMAGEINFOHEADERA, *LPDIDEVICEIMAGEINFOHEADERA; +typedef struct _DIDEVICEIMAGEINFOHEADERW { + DWORD dwSize; + DWORD dwSizeImageInfo; + DWORD dwcViews; + DWORD dwcButtons; + DWORD dwcAxes; + DWORD dwcPOVs; + DWORD dwBufferSize; + DWORD dwBufferUsed; + LPDIDEVICEIMAGEINFOW lprgImageInfoArray; +} DIDEVICEIMAGEINFOHEADERW, *LPDIDEVICEIMAGEINFOHEADERW; +#ifdef UNICODE +typedef DIDEVICEIMAGEINFOHEADERW DIDEVICEIMAGEINFOHEADER; +typedef LPDIDEVICEIMAGEINFOHEADERW LPDIDEVICEIMAGEINFOHEADER; +#else +typedef DIDEVICEIMAGEINFOHEADERA DIDEVICEIMAGEINFOHEADER; +typedef LPDIDEVICEIMAGEINFOHEADERA LPDIDEVICEIMAGEINFOHEADER; +#endif // UNICODE +typedef const DIDEVICEIMAGEINFOHEADERA *LPCDIDEVICEIMAGEINFOHEADERA; +typedef const DIDEVICEIMAGEINFOHEADERW *LPCDIDEVICEIMAGEINFOHEADERW; +#ifdef UNICODE +typedef DIDEVICEIMAGEINFOHEADERW DIDEVICEIMAGEINFOHEADER; +typedef LPCDIDEVICEIMAGEINFOHEADERW LPCDIDEVICEIMAGEINFOHEADER; +#else +typedef DIDEVICEIMAGEINFOHEADERA DIDEVICEIMAGEINFOHEADER; +typedef LPCDIDEVICEIMAGEINFOHEADERA LPCDIDEVICEIMAGEINFOHEADER; +#endif // UNICODE +typedef const DIDEVICEIMAGEINFOHEADER *LPCDIDEVICEIMAGEINFOHEADER; + +#endif /* DIRECTINPUT_VERSION > 0x0700 */ + +#if(DIRECTINPUT_VERSION >= 0x0500) +/* These structures are defined for DirectX 3.0 compatibility */ + +typedef struct DIDEVICEOBJECTINSTANCE_DX3A { + DWORD dwSize; + GUID guidType; + DWORD dwOfs; + DWORD dwType; + DWORD dwFlags; + CHAR tszName[MAX_PATH]; +} DIDEVICEOBJECTINSTANCE_DX3A, *LPDIDEVICEOBJECTINSTANCE_DX3A; +typedef struct DIDEVICEOBJECTINSTANCE_DX3W { + DWORD dwSize; + GUID guidType; + DWORD dwOfs; + DWORD dwType; + DWORD dwFlags; + WCHAR tszName[MAX_PATH]; +} DIDEVICEOBJECTINSTANCE_DX3W, *LPDIDEVICEOBJECTINSTANCE_DX3W; +#ifdef UNICODE +typedef DIDEVICEOBJECTINSTANCE_DX3W DIDEVICEOBJECTINSTANCE_DX3; +typedef LPDIDEVICEOBJECTINSTANCE_DX3W LPDIDEVICEOBJECTINSTANCE_DX3; +#else +typedef DIDEVICEOBJECTINSTANCE_DX3A DIDEVICEOBJECTINSTANCE_DX3; +typedef LPDIDEVICEOBJECTINSTANCE_DX3A LPDIDEVICEOBJECTINSTANCE_DX3; +#endif // UNICODE +typedef const DIDEVICEOBJECTINSTANCE_DX3A *LPCDIDEVICEOBJECTINSTANCE_DX3A; +typedef const DIDEVICEOBJECTINSTANCE_DX3W *LPCDIDEVICEOBJECTINSTANCE_DX3W; +typedef const DIDEVICEOBJECTINSTANCE_DX3 *LPCDIDEVICEOBJECTINSTANCE_DX3; +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ + +typedef struct DIDEVICEOBJECTINSTANCEA { + DWORD dwSize; + GUID guidType; + DWORD dwOfs; + DWORD dwType; + DWORD dwFlags; + CHAR tszName[MAX_PATH]; +#if(DIRECTINPUT_VERSION >= 0x0500) + DWORD dwFFMaxForce; + DWORD dwFFForceResolution; + WORD wCollectionNumber; + WORD wDesignatorIndex; + WORD wUsagePage; + WORD wUsage; + DWORD dwDimension; + WORD wExponent; + WORD wReportId; +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ +} DIDEVICEOBJECTINSTANCEA, *LPDIDEVICEOBJECTINSTANCEA; +typedef struct DIDEVICEOBJECTINSTANCEW { + DWORD dwSize; + GUID guidType; + DWORD dwOfs; + DWORD dwType; + DWORD dwFlags; + WCHAR tszName[MAX_PATH]; +#if(DIRECTINPUT_VERSION >= 0x0500) + DWORD dwFFMaxForce; + DWORD dwFFForceResolution; + WORD wCollectionNumber; + WORD wDesignatorIndex; + WORD wUsagePage; + WORD wUsage; + DWORD dwDimension; + WORD wExponent; + WORD wReportId; +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ +} DIDEVICEOBJECTINSTANCEW, *LPDIDEVICEOBJECTINSTANCEW; +#ifdef UNICODE +typedef DIDEVICEOBJECTINSTANCEW DIDEVICEOBJECTINSTANCE; +typedef LPDIDEVICEOBJECTINSTANCEW LPDIDEVICEOBJECTINSTANCE; +#else +typedef DIDEVICEOBJECTINSTANCEA DIDEVICEOBJECTINSTANCE; +typedef LPDIDEVICEOBJECTINSTANCEA LPDIDEVICEOBJECTINSTANCE; +#endif // UNICODE +typedef const DIDEVICEOBJECTINSTANCEA *LPCDIDEVICEOBJECTINSTANCEA; +typedef const DIDEVICEOBJECTINSTANCEW *LPCDIDEVICEOBJECTINSTANCEW; +typedef const DIDEVICEOBJECTINSTANCE *LPCDIDEVICEOBJECTINSTANCE; + +typedef BOOL (FAR PASCAL * LPDIENUMDEVICEOBJECTSCALLBACKA)(LPCDIDEVICEOBJECTINSTANCEA, LPVOID); +typedef BOOL (FAR PASCAL * LPDIENUMDEVICEOBJECTSCALLBACKW)(LPCDIDEVICEOBJECTINSTANCEW, LPVOID); +#ifdef UNICODE +#define LPDIENUMDEVICEOBJECTSCALLBACK LPDIENUMDEVICEOBJECTSCALLBACKW +#else +#define LPDIENUMDEVICEOBJECTSCALLBACK LPDIENUMDEVICEOBJECTSCALLBACKA +#endif // !UNICODE + +#if(DIRECTINPUT_VERSION >= 0x0500) +#define DIDOI_FFACTUATOR 0x00000001 +#define DIDOI_FFEFFECTTRIGGER 0x00000002 +#define DIDOI_POLLED 0x00008000 +#define DIDOI_ASPECTPOSITION 0x00000100 +#define DIDOI_ASPECTVELOCITY 0x00000200 +#define DIDOI_ASPECTACCEL 0x00000300 +#define DIDOI_ASPECTFORCE 0x00000400 +#define DIDOI_ASPECTMASK 0x00000F00 +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ +#if(DIRECTINPUT_VERSION >= 0x050a) +#define DIDOI_GUIDISUSAGE 0x00010000 +#endif /* DIRECTINPUT_VERSION >= 0x050a */ + +typedef struct DIPROPHEADER { + DWORD dwSize; + DWORD dwHeaderSize; + DWORD dwObj; + DWORD dwHow; +} DIPROPHEADER, *LPDIPROPHEADER; +typedef const DIPROPHEADER *LPCDIPROPHEADER; + +#define DIPH_DEVICE 0 +#define DIPH_BYOFFSET 1 +#define DIPH_BYID 2 +#if(DIRECTINPUT_VERSION >= 0x050a) +#define DIPH_BYUSAGE 3 +#endif /* DIRECTINPUT_VERSION >= 0x050a */ + +#if(DIRECTINPUT_VERSION >= 0x050a) +#define DIMAKEUSAGEDWORD(UsagePage, Usage) \ + (DWORD)MAKELONG(Usage, UsagePage) +#endif /* DIRECTINPUT_VERSION >= 0x050a */ + +typedef struct DIPROPDWORD { + DIPROPHEADER diph; + DWORD dwData; +} DIPROPDWORD, *LPDIPROPDWORD; +typedef const DIPROPDWORD *LPCDIPROPDWORD; + +#if(DIRECTINPUT_VERSION >= 0x0800) +typedef struct DIPROPPOINTER { + DIPROPHEADER diph; + UINT_PTR uData; +} DIPROPPOINTER, *LPDIPROPPOINTER; +typedef const DIPROPPOINTER *LPCDIPROPPOINTER; +#endif /* DIRECTINPUT_VERSION >= 0x0800 */ + +typedef struct DIPROPRANGE { + DIPROPHEADER diph; + LONG lMin; + LONG lMax; +} DIPROPRANGE, *LPDIPROPRANGE; +typedef const DIPROPRANGE *LPCDIPROPRANGE; + +#define DIPROPRANGE_NOMIN ((LONG)0x80000000) +#define DIPROPRANGE_NOMAX ((LONG)0x7FFFFFFF) + +#if(DIRECTINPUT_VERSION >= 0x050a) +typedef struct DIPROPCAL { + DIPROPHEADER diph; + LONG lMin; + LONG lCenter; + LONG lMax; +} DIPROPCAL, *LPDIPROPCAL; +typedef const DIPROPCAL *LPCDIPROPCAL; + +typedef struct DIPROPCALPOV { + DIPROPHEADER diph; + LONG lMin[5]; + LONG lMax[5]; +} DIPROPCALPOV, *LPDIPROPCALPOV; +typedef const DIPROPCALPOV *LPCDIPROPCALPOV; + +typedef struct DIPROPGUIDANDPATH { + DIPROPHEADER diph; + GUID guidClass; + WCHAR wszPath[MAX_PATH]; +} DIPROPGUIDANDPATH, *LPDIPROPGUIDANDPATH; +typedef const DIPROPGUIDANDPATH *LPCDIPROPGUIDANDPATH; + +typedef struct DIPROPSTRING { + DIPROPHEADER diph; + WCHAR wsz[MAX_PATH]; +} DIPROPSTRING, *LPDIPROPSTRING; +typedef const DIPROPSTRING *LPCDIPROPSTRING; + +#endif /* DIRECTINPUT_VERSION >= 0x050a */ + +#if(DIRECTINPUT_VERSION >= 0x0800) +#define MAXCPOINTSNUM 8 + +typedef struct _CPOINT +{ + LONG lP; // raw value + DWORD dwLog; // logical_value / max_logical_value * 10000 +} CPOINT, *PCPOINT; + +typedef struct DIPROPCPOINTS { + DIPROPHEADER diph; + DWORD dwCPointsNum; + CPOINT cp[MAXCPOINTSNUM]; +} DIPROPCPOINTS, *LPDIPROPCPOINTS; +typedef const DIPROPCPOINTS *LPCDIPROPCPOINTS; +#endif /* DIRECTINPUT_VERSION >= 0x0800 */ + + +#ifdef __cplusplus +#define MAKEDIPROP(prop) (*(const GUID *)(prop)) +#else +#define MAKEDIPROP(prop) ((REFGUID)(prop)) +#endif + +#define DIPROP_BUFFERSIZE MAKEDIPROP(1) + +#define DIPROP_AXISMODE MAKEDIPROP(2) + +#define DIPROPAXISMODE_ABS 0 +#define DIPROPAXISMODE_REL 1 + +#define DIPROP_GRANULARITY MAKEDIPROP(3) + +#define DIPROP_RANGE MAKEDIPROP(4) + +#define DIPROP_DEADZONE MAKEDIPROP(5) + +#define DIPROP_SATURATION MAKEDIPROP(6) + +#define DIPROP_FFGAIN MAKEDIPROP(7) + +#define DIPROP_FFLOAD MAKEDIPROP(8) + +#define DIPROP_AUTOCENTER MAKEDIPROP(9) + +#define DIPROPAUTOCENTER_OFF 0 +#define DIPROPAUTOCENTER_ON 1 + +#define DIPROP_CALIBRATIONMODE MAKEDIPROP(10) + +#define DIPROPCALIBRATIONMODE_COOKED 0 +#define DIPROPCALIBRATIONMODE_RAW 1 + +#if(DIRECTINPUT_VERSION >= 0x050a) +#define DIPROP_CALIBRATION MAKEDIPROP(11) + +#define DIPROP_GUIDANDPATH MAKEDIPROP(12) + +#define DIPROP_INSTANCENAME MAKEDIPROP(13) + +#define DIPROP_PRODUCTNAME MAKEDIPROP(14) +#endif /* DIRECTINPUT_VERSION >= 0x050a */ + +#if(DIRECTINPUT_VERSION >= 0x05b2) +#define DIPROP_JOYSTICKID MAKEDIPROP(15) + +#define DIPROP_GETPORTDISPLAYNAME MAKEDIPROP(16) + +#endif /* DIRECTINPUT_VERSION >= 0x05b2 */ + +#if(DIRECTINPUT_VERSION >= 0x0700) +#define DIPROP_PHYSICALRANGE MAKEDIPROP(18) + +#define DIPROP_LOGICALRANGE MAKEDIPROP(19) +#endif /* DIRECTINPUT_VERSION >= 0x0700 */ + +#if(DIRECTINPUT_VERSION >= 0x0800) +#define DIPROP_KEYNAME MAKEDIPROP(20) + +#define DIPROP_CPOINTS MAKEDIPROP(21) + +#define DIPROP_APPDATA MAKEDIPROP(22) + +#define DIPROP_SCANCODE MAKEDIPROP(23) + +#define DIPROP_VIDPID MAKEDIPROP(24) + +#define DIPROP_USERNAME MAKEDIPROP(25) + +#define DIPROP_TYPENAME MAKEDIPROP(26) +#endif /* DIRECTINPUT_VERSION >= 0x0800 */ + + +typedef struct DIDEVICEOBJECTDATA_DX3 { + DWORD dwOfs; + DWORD dwData; + DWORD dwTimeStamp; + DWORD dwSequence; +} DIDEVICEOBJECTDATA_DX3, *LPDIDEVICEOBJECTDATA_DX3; +typedef const DIDEVICEOBJECTDATA_DX3 *LPCDIDEVICEOBJECTDATA_DX; + +typedef struct DIDEVICEOBJECTDATA { + DWORD dwOfs; + DWORD dwData; + DWORD dwTimeStamp; + DWORD dwSequence; +#if(DIRECTINPUT_VERSION >= 0x0800) + UINT_PTR uAppData; +#endif /* DIRECTINPUT_VERSION >= 0x0800 */ +} DIDEVICEOBJECTDATA, *LPDIDEVICEOBJECTDATA; +typedef const DIDEVICEOBJECTDATA *LPCDIDEVICEOBJECTDATA; + +#define DIGDD_PEEK 0x00000001 + +#define DISEQUENCE_COMPARE(dwSequence1, cmp, dwSequence2) \ + ((int)((dwSequence1) - (dwSequence2)) cmp 0) +#define DISCL_EXCLUSIVE 0x00000001 +#define DISCL_NONEXCLUSIVE 0x00000002 +#define DISCL_FOREGROUND 0x00000004 +#define DISCL_BACKGROUND 0x00000008 +#define DISCL_NOWINKEY 0x00000010 + +#if(DIRECTINPUT_VERSION >= 0x0500) +/* These structures are defined for DirectX 3.0 compatibility */ + +typedef struct DIDEVICEINSTANCE_DX3A { + DWORD dwSize; + GUID guidInstance; + GUID guidProduct; + DWORD dwDevType; + CHAR tszInstanceName[MAX_PATH]; + CHAR tszProductName[MAX_PATH]; +} DIDEVICEINSTANCE_DX3A, *LPDIDEVICEINSTANCE_DX3A; +typedef struct DIDEVICEINSTANCE_DX3W { + DWORD dwSize; + GUID guidInstance; + GUID guidProduct; + DWORD dwDevType; + WCHAR tszInstanceName[MAX_PATH]; + WCHAR tszProductName[MAX_PATH]; +} DIDEVICEINSTANCE_DX3W, *LPDIDEVICEINSTANCE_DX3W; +#ifdef UNICODE +typedef DIDEVICEINSTANCE_DX3W DIDEVICEINSTANCE_DX3; +typedef LPDIDEVICEINSTANCE_DX3W LPDIDEVICEINSTANCE_DX3; +#else +typedef DIDEVICEINSTANCE_DX3A DIDEVICEINSTANCE_DX3; +typedef LPDIDEVICEINSTANCE_DX3A LPDIDEVICEINSTANCE_DX3; +#endif // UNICODE +typedef const DIDEVICEINSTANCE_DX3A *LPCDIDEVICEINSTANCE_DX3A; +typedef const DIDEVICEINSTANCE_DX3W *LPCDIDEVICEINSTANCE_DX3W; +typedef const DIDEVICEINSTANCE_DX3 *LPCDIDEVICEINSTANCE_DX3; +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ + +typedef struct DIDEVICEINSTANCEA { + DWORD dwSize; + GUID guidInstance; + GUID guidProduct; + DWORD dwDevType; + CHAR tszInstanceName[MAX_PATH]; + CHAR tszProductName[MAX_PATH]; +#if(DIRECTINPUT_VERSION >= 0x0500) + GUID guidFFDriver; + WORD wUsagePage; + WORD wUsage; +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ +} DIDEVICEINSTANCEA, *LPDIDEVICEINSTANCEA; +typedef struct DIDEVICEINSTANCEW { + DWORD dwSize; + GUID guidInstance; + GUID guidProduct; + DWORD dwDevType; + WCHAR tszInstanceName[MAX_PATH]; + WCHAR tszProductName[MAX_PATH]; +#if(DIRECTINPUT_VERSION >= 0x0500) + GUID guidFFDriver; + WORD wUsagePage; + WORD wUsage; +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ +} DIDEVICEINSTANCEW, *LPDIDEVICEINSTANCEW; +#ifdef UNICODE +typedef DIDEVICEINSTANCEW DIDEVICEINSTANCE; +typedef LPDIDEVICEINSTANCEW LPDIDEVICEINSTANCE; +#else +typedef DIDEVICEINSTANCEA DIDEVICEINSTANCE; +typedef LPDIDEVICEINSTANCEA LPDIDEVICEINSTANCE; +#endif // UNICODE + +typedef const DIDEVICEINSTANCEA *LPCDIDEVICEINSTANCEA; +typedef const DIDEVICEINSTANCEW *LPCDIDEVICEINSTANCEW; +#ifdef UNICODE +typedef DIDEVICEINSTANCEW DIDEVICEINSTANCE; +typedef LPCDIDEVICEINSTANCEW LPCDIDEVICEINSTANCE; +#else +typedef DIDEVICEINSTANCEA DIDEVICEINSTANCE; +typedef LPCDIDEVICEINSTANCEA LPCDIDEVICEINSTANCE; +#endif // UNICODE +typedef const DIDEVICEINSTANCE *LPCDIDEVICEINSTANCE; + +#undef INTERFACE +#define INTERFACE IDirectInputDeviceW + +DECLARE_INTERFACE_(IDirectInputDeviceW, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputDeviceW methods ***/ + STDMETHOD(GetCapabilities)(THIS_ LPDIDEVCAPS) PURE; + STDMETHOD(EnumObjects)(THIS_ LPDIENUMDEVICEOBJECTSCALLBACKW,LPVOID,DWORD) PURE; + STDMETHOD(GetProperty)(THIS_ REFGUID,LPDIPROPHEADER) PURE; + STDMETHOD(SetProperty)(THIS_ REFGUID,LPCDIPROPHEADER) PURE; + STDMETHOD(Acquire)(THIS) PURE; + STDMETHOD(Unacquire)(THIS) PURE; + STDMETHOD(GetDeviceState)(THIS_ DWORD,LPVOID) PURE; + STDMETHOD(GetDeviceData)(THIS_ DWORD,LPDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; + STDMETHOD(SetDataFormat)(THIS_ LPCDIDATAFORMAT) PURE; + STDMETHOD(SetEventNotification)(THIS_ HANDLE) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(GetObjectInfo)(THIS_ LPDIDEVICEOBJECTINSTANCEW,DWORD,DWORD) PURE; + STDMETHOD(GetDeviceInfo)(THIS_ LPDIDEVICEINSTANCEW) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD,REFGUID) PURE; +}; + +typedef struct IDirectInputDeviceW *LPDIRECTINPUTDEVICEW; + +#undef INTERFACE +#define INTERFACE IDirectInputDeviceA + +DECLARE_INTERFACE_(IDirectInputDeviceA, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputDeviceA methods ***/ + STDMETHOD(GetCapabilities)(THIS_ LPDIDEVCAPS) PURE; + STDMETHOD(EnumObjects)(THIS_ LPDIENUMDEVICEOBJECTSCALLBACKA,LPVOID,DWORD) PURE; + STDMETHOD(GetProperty)(THIS_ REFGUID,LPDIPROPHEADER) PURE; + STDMETHOD(SetProperty)(THIS_ REFGUID,LPCDIPROPHEADER) PURE; + STDMETHOD(Acquire)(THIS) PURE; + STDMETHOD(Unacquire)(THIS) PURE; + STDMETHOD(GetDeviceState)(THIS_ DWORD,LPVOID) PURE; + STDMETHOD(GetDeviceData)(THIS_ DWORD,LPDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; + STDMETHOD(SetDataFormat)(THIS_ LPCDIDATAFORMAT) PURE; + STDMETHOD(SetEventNotification)(THIS_ HANDLE) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(GetObjectInfo)(THIS_ LPDIDEVICEOBJECTINSTANCEA,DWORD,DWORD) PURE; + STDMETHOD(GetDeviceInfo)(THIS_ LPDIDEVICEINSTANCEA) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD,REFGUID) PURE; +}; + +typedef struct IDirectInputDeviceA *LPDIRECTINPUTDEVICEA; + +#ifdef UNICODE +#define IID_IDirectInputDevice IID_IDirectInputDeviceW +#define IDirectInputDevice IDirectInputDeviceW +#define IDirectInputDeviceVtbl IDirectInputDeviceWVtbl +#else +#define IID_IDirectInputDevice IID_IDirectInputDeviceA +#define IDirectInputDevice IDirectInputDeviceA +#define IDirectInputDeviceVtbl IDirectInputDeviceAVtbl +#endif +typedef struct IDirectInputDevice *LPDIRECTINPUTDEVICE; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectInputDevice_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectInputDevice_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectInputDevice_Release(p) (p)->lpVtbl->Release(p) +#define IDirectInputDevice_GetCapabilities(p,a) (p)->lpVtbl->GetCapabilities(p,a) +#define IDirectInputDevice_EnumObjects(p,a,b,c) (p)->lpVtbl->EnumObjects(p,a,b,c) +#define IDirectInputDevice_GetProperty(p,a,b) (p)->lpVtbl->GetProperty(p,a,b) +#define IDirectInputDevice_SetProperty(p,a,b) (p)->lpVtbl->SetProperty(p,a,b) +#define IDirectInputDevice_Acquire(p) (p)->lpVtbl->Acquire(p) +#define IDirectInputDevice_Unacquire(p) (p)->lpVtbl->Unacquire(p) +#define IDirectInputDevice_GetDeviceState(p,a,b) (p)->lpVtbl->GetDeviceState(p,a,b) +#define IDirectInputDevice_GetDeviceData(p,a,b,c,d) (p)->lpVtbl->GetDeviceData(p,a,b,c,d) +#define IDirectInputDevice_SetDataFormat(p,a) (p)->lpVtbl->SetDataFormat(p,a) +#define IDirectInputDevice_SetEventNotification(p,a) (p)->lpVtbl->SetEventNotification(p,a) +#define IDirectInputDevice_SetCooperativeLevel(p,a,b) (p)->lpVtbl->SetCooperativeLevel(p,a,b) +#define IDirectInputDevice_GetObjectInfo(p,a,b,c) (p)->lpVtbl->GetObjectInfo(p,a,b,c) +#define IDirectInputDevice_GetDeviceInfo(p,a) (p)->lpVtbl->GetDeviceInfo(p,a) +#define IDirectInputDevice_RunControlPanel(p,a,b) (p)->lpVtbl->RunControlPanel(p,a,b) +#define IDirectInputDevice_Initialize(p,a,b,c) (p)->lpVtbl->Initialize(p,a,b,c) +#else +#define IDirectInputDevice_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectInputDevice_AddRef(p) (p)->AddRef() +#define IDirectInputDevice_Release(p) (p)->Release() +#define IDirectInputDevice_GetCapabilities(p,a) (p)->GetCapabilities(a) +#define IDirectInputDevice_EnumObjects(p,a,b,c) (p)->EnumObjects(a,b,c) +#define IDirectInputDevice_GetProperty(p,a,b) (p)->GetProperty(a,b) +#define IDirectInputDevice_SetProperty(p,a,b) (p)->SetProperty(a,b) +#define IDirectInputDevice_Acquire(p) (p)->Acquire() +#define IDirectInputDevice_Unacquire(p) (p)->Unacquire() +#define IDirectInputDevice_GetDeviceState(p,a,b) (p)->GetDeviceState(a,b) +#define IDirectInputDevice_GetDeviceData(p,a,b,c,d) (p)->GetDeviceData(a,b,c,d) +#define IDirectInputDevice_SetDataFormat(p,a) (p)->SetDataFormat(a) +#define IDirectInputDevice_SetEventNotification(p,a) (p)->SetEventNotification(a) +#define IDirectInputDevice_SetCooperativeLevel(p,a,b) (p)->SetCooperativeLevel(a,b) +#define IDirectInputDevice_GetObjectInfo(p,a,b,c) (p)->GetObjectInfo(a,b,c) +#define IDirectInputDevice_GetDeviceInfo(p,a) (p)->GetDeviceInfo(a) +#define IDirectInputDevice_RunControlPanel(p,a,b) (p)->RunControlPanel(a,b) +#define IDirectInputDevice_Initialize(p,a,b,c) (p)->Initialize(a,b,c) +#endif + +#endif /* DIJ_RINGZERO */ + + +#if(DIRECTINPUT_VERSION >= 0x0500) + +#define DISFFC_RESET 0x00000001 +#define DISFFC_STOPALL 0x00000002 +#define DISFFC_PAUSE 0x00000004 +#define DISFFC_CONTINUE 0x00000008 +#define DISFFC_SETACTUATORSON 0x00000010 +#define DISFFC_SETACTUATORSOFF 0x00000020 + +#define DIGFFS_EMPTY 0x00000001 +#define DIGFFS_STOPPED 0x00000002 +#define DIGFFS_PAUSED 0x00000004 +#define DIGFFS_ACTUATORSON 0x00000010 +#define DIGFFS_ACTUATORSOFF 0x00000020 +#define DIGFFS_POWERON 0x00000040 +#define DIGFFS_POWEROFF 0x00000080 +#define DIGFFS_SAFETYSWITCHON 0x00000100 +#define DIGFFS_SAFETYSWITCHOFF 0x00000200 +#define DIGFFS_USERFFSWITCHON 0x00000400 +#define DIGFFS_USERFFSWITCHOFF 0x00000800 +#define DIGFFS_DEVICELOST 0x80000000 + +#ifndef DIJ_RINGZERO + +typedef struct DIEFFECTINFOA { + DWORD dwSize; + GUID guid; + DWORD dwEffType; + DWORD dwStaticParams; + DWORD dwDynamicParams; + CHAR tszName[MAX_PATH]; +} DIEFFECTINFOA, *LPDIEFFECTINFOA; +typedef struct DIEFFECTINFOW { + DWORD dwSize; + GUID guid; + DWORD dwEffType; + DWORD dwStaticParams; + DWORD dwDynamicParams; + WCHAR tszName[MAX_PATH]; +} DIEFFECTINFOW, *LPDIEFFECTINFOW; +#ifdef UNICODE +typedef DIEFFECTINFOW DIEFFECTINFO; +typedef LPDIEFFECTINFOW LPDIEFFECTINFO; +#else +typedef DIEFFECTINFOA DIEFFECTINFO; +typedef LPDIEFFECTINFOA LPDIEFFECTINFO; +#endif // UNICODE +typedef const DIEFFECTINFOA *LPCDIEFFECTINFOA; +typedef const DIEFFECTINFOW *LPCDIEFFECTINFOW; +typedef const DIEFFECTINFO *LPCDIEFFECTINFO; + +#define DISDD_CONTINUE 0x00000001 + +typedef BOOL (FAR PASCAL * LPDIENUMEFFECTSCALLBACKA)(LPCDIEFFECTINFOA, LPVOID); +typedef BOOL (FAR PASCAL * LPDIENUMEFFECTSCALLBACKW)(LPCDIEFFECTINFOW, LPVOID); +#ifdef UNICODE +#define LPDIENUMEFFECTSCALLBACK LPDIENUMEFFECTSCALLBACKW +#else +#define LPDIENUMEFFECTSCALLBACK LPDIENUMEFFECTSCALLBACKA +#endif // !UNICODE +typedef BOOL (FAR PASCAL * LPDIENUMCREATEDEFFECTOBJECTSCALLBACK)(LPDIRECTINPUTEFFECT, LPVOID); + +#undef INTERFACE +#define INTERFACE IDirectInputDevice2W + +DECLARE_INTERFACE_(IDirectInputDevice2W, IDirectInputDeviceW) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputDeviceW methods ***/ + STDMETHOD(GetCapabilities)(THIS_ LPDIDEVCAPS) PURE; + STDMETHOD(EnumObjects)(THIS_ LPDIENUMDEVICEOBJECTSCALLBACKW,LPVOID,DWORD) PURE; + STDMETHOD(GetProperty)(THIS_ REFGUID,LPDIPROPHEADER) PURE; + STDMETHOD(SetProperty)(THIS_ REFGUID,LPCDIPROPHEADER) PURE; + STDMETHOD(Acquire)(THIS) PURE; + STDMETHOD(Unacquire)(THIS) PURE; + STDMETHOD(GetDeviceState)(THIS_ DWORD,LPVOID) PURE; + STDMETHOD(GetDeviceData)(THIS_ DWORD,LPDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; + STDMETHOD(SetDataFormat)(THIS_ LPCDIDATAFORMAT) PURE; + STDMETHOD(SetEventNotification)(THIS_ HANDLE) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(GetObjectInfo)(THIS_ LPDIDEVICEOBJECTINSTANCEW,DWORD,DWORD) PURE; + STDMETHOD(GetDeviceInfo)(THIS_ LPDIDEVICEINSTANCEW) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD,REFGUID) PURE; + + /*** IDirectInputDevice2W methods ***/ + STDMETHOD(CreateEffect)(THIS_ REFGUID,LPCDIEFFECT,LPDIRECTINPUTEFFECT *,LPUNKNOWN) PURE; + STDMETHOD(EnumEffects)(THIS_ LPDIENUMEFFECTSCALLBACKW,LPVOID,DWORD) PURE; + STDMETHOD(GetEffectInfo)(THIS_ LPDIEFFECTINFOW,REFGUID) PURE; + STDMETHOD(GetForceFeedbackState)(THIS_ LPDWORD) PURE; + STDMETHOD(SendForceFeedbackCommand)(THIS_ DWORD) PURE; + STDMETHOD(EnumCreatedEffectObjects)(THIS_ LPDIENUMCREATEDEFFECTOBJECTSCALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(Escape)(THIS_ LPDIEFFESCAPE) PURE; + STDMETHOD(Poll)(THIS) PURE; + STDMETHOD(SendDeviceData)(THIS_ DWORD,LPCDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; +}; + +typedef struct IDirectInputDevice2W *LPDIRECTINPUTDEVICE2W; + +#undef INTERFACE +#define INTERFACE IDirectInputDevice2A + +DECLARE_INTERFACE_(IDirectInputDevice2A, IDirectInputDeviceA) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputDeviceA methods ***/ + STDMETHOD(GetCapabilities)(THIS_ LPDIDEVCAPS) PURE; + STDMETHOD(EnumObjects)(THIS_ LPDIENUMDEVICEOBJECTSCALLBACKA,LPVOID,DWORD) PURE; + STDMETHOD(GetProperty)(THIS_ REFGUID,LPDIPROPHEADER) PURE; + STDMETHOD(SetProperty)(THIS_ REFGUID,LPCDIPROPHEADER) PURE; + STDMETHOD(Acquire)(THIS) PURE; + STDMETHOD(Unacquire)(THIS) PURE; + STDMETHOD(GetDeviceState)(THIS_ DWORD,LPVOID) PURE; + STDMETHOD(GetDeviceData)(THIS_ DWORD,LPDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; + STDMETHOD(SetDataFormat)(THIS_ LPCDIDATAFORMAT) PURE; + STDMETHOD(SetEventNotification)(THIS_ HANDLE) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(GetObjectInfo)(THIS_ LPDIDEVICEOBJECTINSTANCEA,DWORD,DWORD) PURE; + STDMETHOD(GetDeviceInfo)(THIS_ LPDIDEVICEINSTANCEA) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD,REFGUID) PURE; + + /*** IDirectInputDevice2A methods ***/ + STDMETHOD(CreateEffect)(THIS_ REFGUID,LPCDIEFFECT,LPDIRECTINPUTEFFECT *,LPUNKNOWN) PURE; + STDMETHOD(EnumEffects)(THIS_ LPDIENUMEFFECTSCALLBACKA,LPVOID,DWORD) PURE; + STDMETHOD(GetEffectInfo)(THIS_ LPDIEFFECTINFOA,REFGUID) PURE; + STDMETHOD(GetForceFeedbackState)(THIS_ LPDWORD) PURE; + STDMETHOD(SendForceFeedbackCommand)(THIS_ DWORD) PURE; + STDMETHOD(EnumCreatedEffectObjects)(THIS_ LPDIENUMCREATEDEFFECTOBJECTSCALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(Escape)(THIS_ LPDIEFFESCAPE) PURE; + STDMETHOD(Poll)(THIS) PURE; + STDMETHOD(SendDeviceData)(THIS_ DWORD,LPCDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; +}; + +typedef struct IDirectInputDevice2A *LPDIRECTINPUTDEVICE2A; + +#ifdef UNICODE +#define IID_IDirectInputDevice2 IID_IDirectInputDevice2W +#define IDirectInputDevice2 IDirectInputDevice2W +#define IDirectInputDevice2Vtbl IDirectInputDevice2WVtbl +#else +#define IID_IDirectInputDevice2 IID_IDirectInputDevice2A +#define IDirectInputDevice2 IDirectInputDevice2A +#define IDirectInputDevice2Vtbl IDirectInputDevice2AVtbl +#endif +typedef struct IDirectInputDevice2 *LPDIRECTINPUTDEVICE2; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectInputDevice2_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectInputDevice2_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectInputDevice2_Release(p) (p)->lpVtbl->Release(p) +#define IDirectInputDevice2_GetCapabilities(p,a) (p)->lpVtbl->GetCapabilities(p,a) +#define IDirectInputDevice2_EnumObjects(p,a,b,c) (p)->lpVtbl->EnumObjects(p,a,b,c) +#define IDirectInputDevice2_GetProperty(p,a,b) (p)->lpVtbl->GetProperty(p,a,b) +#define IDirectInputDevice2_SetProperty(p,a,b) (p)->lpVtbl->SetProperty(p,a,b) +#define IDirectInputDevice2_Acquire(p) (p)->lpVtbl->Acquire(p) +#define IDirectInputDevice2_Unacquire(p) (p)->lpVtbl->Unacquire(p) +#define IDirectInputDevice2_GetDeviceState(p,a,b) (p)->lpVtbl->GetDeviceState(p,a,b) +#define IDirectInputDevice2_GetDeviceData(p,a,b,c,d) (p)->lpVtbl->GetDeviceData(p,a,b,c,d) +#define IDirectInputDevice2_SetDataFormat(p,a) (p)->lpVtbl->SetDataFormat(p,a) +#define IDirectInputDevice2_SetEventNotification(p,a) (p)->lpVtbl->SetEventNotification(p,a) +#define IDirectInputDevice2_SetCooperativeLevel(p,a,b) (p)->lpVtbl->SetCooperativeLevel(p,a,b) +#define IDirectInputDevice2_GetObjectInfo(p,a,b,c) (p)->lpVtbl->GetObjectInfo(p,a,b,c) +#define IDirectInputDevice2_GetDeviceInfo(p,a) (p)->lpVtbl->GetDeviceInfo(p,a) +#define IDirectInputDevice2_RunControlPanel(p,a,b) (p)->lpVtbl->RunControlPanel(p,a,b) +#define IDirectInputDevice2_Initialize(p,a,b,c) (p)->lpVtbl->Initialize(p,a,b,c) +#define IDirectInputDevice2_CreateEffect(p,a,b,c,d) (p)->lpVtbl->CreateEffect(p,a,b,c,d) +#define IDirectInputDevice2_EnumEffects(p,a,b,c) (p)->lpVtbl->EnumEffects(p,a,b,c) +#define IDirectInputDevice2_GetEffectInfo(p,a,b) (p)->lpVtbl->GetEffectInfo(p,a,b) +#define IDirectInputDevice2_GetForceFeedbackState(p,a) (p)->lpVtbl->GetForceFeedbackState(p,a) +#define IDirectInputDevice2_SendForceFeedbackCommand(p,a) (p)->lpVtbl->SendForceFeedbackCommand(p,a) +#define IDirectInputDevice2_EnumCreatedEffectObjects(p,a,b,c) (p)->lpVtbl->EnumCreatedEffectObjects(p,a,b,c) +#define IDirectInputDevice2_Escape(p,a) (p)->lpVtbl->Escape(p,a) +#define IDirectInputDevice2_Poll(p) (p)->lpVtbl->Poll(p) +#define IDirectInputDevice2_SendDeviceData(p,a,b,c,d) (p)->lpVtbl->SendDeviceData(p,a,b,c,d) +#else +#define IDirectInputDevice2_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectInputDevice2_AddRef(p) (p)->AddRef() +#define IDirectInputDevice2_Release(p) (p)->Release() +#define IDirectInputDevice2_GetCapabilities(p,a) (p)->GetCapabilities(a) +#define IDirectInputDevice2_EnumObjects(p,a,b,c) (p)->EnumObjects(a,b,c) +#define IDirectInputDevice2_GetProperty(p,a,b) (p)->GetProperty(a,b) +#define IDirectInputDevice2_SetProperty(p,a,b) (p)->SetProperty(a,b) +#define IDirectInputDevice2_Acquire(p) (p)->Acquire() +#define IDirectInputDevice2_Unacquire(p) (p)->Unacquire() +#define IDirectInputDevice2_GetDeviceState(p,a,b) (p)->GetDeviceState(a,b) +#define IDirectInputDevice2_GetDeviceData(p,a,b,c,d) (p)->GetDeviceData(a,b,c,d) +#define IDirectInputDevice2_SetDataFormat(p,a) (p)->SetDataFormat(a) +#define IDirectInputDevice2_SetEventNotification(p,a) (p)->SetEventNotification(a) +#define IDirectInputDevice2_SetCooperativeLevel(p,a,b) (p)->SetCooperativeLevel(a,b) +#define IDirectInputDevice2_GetObjectInfo(p,a,b,c) (p)->GetObjectInfo(a,b,c) +#define IDirectInputDevice2_GetDeviceInfo(p,a) (p)->GetDeviceInfo(a) +#define IDirectInputDevice2_RunControlPanel(p,a,b) (p)->RunControlPanel(a,b) +#define IDirectInputDevice2_Initialize(p,a,b,c) (p)->Initialize(a,b,c) +#define IDirectInputDevice2_CreateEffect(p,a,b,c,d) (p)->CreateEffect(a,b,c,d) +#define IDirectInputDevice2_EnumEffects(p,a,b,c) (p)->EnumEffects(a,b,c) +#define IDirectInputDevice2_GetEffectInfo(p,a,b) (p)->GetEffectInfo(a,b) +#define IDirectInputDevice2_GetForceFeedbackState(p,a) (p)->GetForceFeedbackState(a) +#define IDirectInputDevice2_SendForceFeedbackCommand(p,a) (p)->SendForceFeedbackCommand(a) +#define IDirectInputDevice2_EnumCreatedEffectObjects(p,a,b,c) (p)->EnumCreatedEffectObjects(a,b,c) +#define IDirectInputDevice2_Escape(p,a) (p)->Escape(a) +#define IDirectInputDevice2_Poll(p) (p)->Poll() +#define IDirectInputDevice2_SendDeviceData(p,a,b,c,d) (p)->SendDeviceData(a,b,c,d) +#endif + +#endif /* DIJ_RINGZERO */ + +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ + +#if(DIRECTINPUT_VERSION >= 0x0700) +#define DIFEF_DEFAULT 0x00000000 +#define DIFEF_INCLUDENONSTANDARD 0x00000001 +#define DIFEF_MODIFYIFNEEDED 0x00000010 + +#ifndef DIJ_RINGZERO + +#undef INTERFACE +#define INTERFACE IDirectInputDevice7W + +DECLARE_INTERFACE_(IDirectInputDevice7W, IDirectInputDevice2W) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputDevice2W methods ***/ + STDMETHOD(GetCapabilities)(THIS_ LPDIDEVCAPS) PURE; + STDMETHOD(EnumObjects)(THIS_ LPDIENUMDEVICEOBJECTSCALLBACKW,LPVOID,DWORD) PURE; + STDMETHOD(GetProperty)(THIS_ REFGUID,LPDIPROPHEADER) PURE; + STDMETHOD(SetProperty)(THIS_ REFGUID,LPCDIPROPHEADER) PURE; + STDMETHOD(Acquire)(THIS) PURE; + STDMETHOD(Unacquire)(THIS) PURE; + STDMETHOD(GetDeviceState)(THIS_ DWORD,LPVOID) PURE; + STDMETHOD(GetDeviceData)(THIS_ DWORD,LPDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; + STDMETHOD(SetDataFormat)(THIS_ LPCDIDATAFORMAT) PURE; + STDMETHOD(SetEventNotification)(THIS_ HANDLE) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(GetObjectInfo)(THIS_ LPDIDEVICEOBJECTINSTANCEW,DWORD,DWORD) PURE; + STDMETHOD(GetDeviceInfo)(THIS_ LPDIDEVICEINSTANCEW) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD,REFGUID) PURE; + STDMETHOD(CreateEffect)(THIS_ REFGUID,LPCDIEFFECT,LPDIRECTINPUTEFFECT *,LPUNKNOWN) PURE; + STDMETHOD(EnumEffects)(THIS_ LPDIENUMEFFECTSCALLBACKW,LPVOID,DWORD) PURE; + STDMETHOD(GetEffectInfo)(THIS_ LPDIEFFECTINFOW,REFGUID) PURE; + STDMETHOD(GetForceFeedbackState)(THIS_ LPDWORD) PURE; + STDMETHOD(SendForceFeedbackCommand)(THIS_ DWORD) PURE; + STDMETHOD(EnumCreatedEffectObjects)(THIS_ LPDIENUMCREATEDEFFECTOBJECTSCALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(Escape)(THIS_ LPDIEFFESCAPE) PURE; + STDMETHOD(Poll)(THIS) PURE; + STDMETHOD(SendDeviceData)(THIS_ DWORD,LPCDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; + + /*** IDirectInputDevice7W methods ***/ + STDMETHOD(EnumEffectsInFile)(THIS_ LPCWSTR,LPDIENUMEFFECTSINFILECALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(WriteEffectToFile)(THIS_ LPCWSTR,DWORD,LPDIFILEEFFECT,DWORD) PURE; +}; + +typedef struct IDirectInputDevice7W *LPDIRECTINPUTDEVICE7W; + +#undef INTERFACE +#define INTERFACE IDirectInputDevice7A + +DECLARE_INTERFACE_(IDirectInputDevice7A, IDirectInputDevice2A) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputDevice2A methods ***/ + STDMETHOD(GetCapabilities)(THIS_ LPDIDEVCAPS) PURE; + STDMETHOD(EnumObjects)(THIS_ LPDIENUMDEVICEOBJECTSCALLBACKA,LPVOID,DWORD) PURE; + STDMETHOD(GetProperty)(THIS_ REFGUID,LPDIPROPHEADER) PURE; + STDMETHOD(SetProperty)(THIS_ REFGUID,LPCDIPROPHEADER) PURE; + STDMETHOD(Acquire)(THIS) PURE; + STDMETHOD(Unacquire)(THIS) PURE; + STDMETHOD(GetDeviceState)(THIS_ DWORD,LPVOID) PURE; + STDMETHOD(GetDeviceData)(THIS_ DWORD,LPDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; + STDMETHOD(SetDataFormat)(THIS_ LPCDIDATAFORMAT) PURE; + STDMETHOD(SetEventNotification)(THIS_ HANDLE) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(GetObjectInfo)(THIS_ LPDIDEVICEOBJECTINSTANCEA,DWORD,DWORD) PURE; + STDMETHOD(GetDeviceInfo)(THIS_ LPDIDEVICEINSTANCEA) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD,REFGUID) PURE; + STDMETHOD(CreateEffect)(THIS_ REFGUID,LPCDIEFFECT,LPDIRECTINPUTEFFECT *,LPUNKNOWN) PURE; + STDMETHOD(EnumEffects)(THIS_ LPDIENUMEFFECTSCALLBACKA,LPVOID,DWORD) PURE; + STDMETHOD(GetEffectInfo)(THIS_ LPDIEFFECTINFOA,REFGUID) PURE; + STDMETHOD(GetForceFeedbackState)(THIS_ LPDWORD) PURE; + STDMETHOD(SendForceFeedbackCommand)(THIS_ DWORD) PURE; + STDMETHOD(EnumCreatedEffectObjects)(THIS_ LPDIENUMCREATEDEFFECTOBJECTSCALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(Escape)(THIS_ LPDIEFFESCAPE) PURE; + STDMETHOD(Poll)(THIS) PURE; + STDMETHOD(SendDeviceData)(THIS_ DWORD,LPCDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; + + /*** IDirectInputDevice7A methods ***/ + STDMETHOD(EnumEffectsInFile)(THIS_ LPCSTR,LPDIENUMEFFECTSINFILECALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(WriteEffectToFile)(THIS_ LPCSTR,DWORD,LPDIFILEEFFECT,DWORD) PURE; +}; + +typedef struct IDirectInputDevice7A *LPDIRECTINPUTDEVICE7A; + +#ifdef UNICODE +#define IID_IDirectInputDevice7 IID_IDirectInputDevice7W +#define IDirectInputDevice7 IDirectInputDevice7W +#define IDirectInputDevice7Vtbl IDirectInputDevice7WVtbl +#else +#define IID_IDirectInputDevice7 IID_IDirectInputDevice7A +#define IDirectInputDevice7 IDirectInputDevice7A +#define IDirectInputDevice7Vtbl IDirectInputDevice7AVtbl +#endif +typedef struct IDirectInputDevice7 *LPDIRECTINPUTDEVICE7; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectInputDevice7_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectInputDevice7_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectInputDevice7_Release(p) (p)->lpVtbl->Release(p) +#define IDirectInputDevice7_GetCapabilities(p,a) (p)->lpVtbl->GetCapabilities(p,a) +#define IDirectInputDevice7_EnumObjects(p,a,b,c) (p)->lpVtbl->EnumObjects(p,a,b,c) +#define IDirectInputDevice7_GetProperty(p,a,b) (p)->lpVtbl->GetProperty(p,a,b) +#define IDirectInputDevice7_SetProperty(p,a,b) (p)->lpVtbl->SetProperty(p,a,b) +#define IDirectInputDevice7_Acquire(p) (p)->lpVtbl->Acquire(p) +#define IDirectInputDevice7_Unacquire(p) (p)->lpVtbl->Unacquire(p) +#define IDirectInputDevice7_GetDeviceState(p,a,b) (p)->lpVtbl->GetDeviceState(p,a,b) +#define IDirectInputDevice7_GetDeviceData(p,a,b,c,d) (p)->lpVtbl->GetDeviceData(p,a,b,c,d) +#define IDirectInputDevice7_SetDataFormat(p,a) (p)->lpVtbl->SetDataFormat(p,a) +#define IDirectInputDevice7_SetEventNotification(p,a) (p)->lpVtbl->SetEventNotification(p,a) +#define IDirectInputDevice7_SetCooperativeLevel(p,a,b) (p)->lpVtbl->SetCooperativeLevel(p,a,b) +#define IDirectInputDevice7_GetObjectInfo(p,a,b,c) (p)->lpVtbl->GetObjectInfo(p,a,b,c) +#define IDirectInputDevice7_GetDeviceInfo(p,a) (p)->lpVtbl->GetDeviceInfo(p,a) +#define IDirectInputDevice7_RunControlPanel(p,a,b) (p)->lpVtbl->RunControlPanel(p,a,b) +#define IDirectInputDevice7_Initialize(p,a,b,c) (p)->lpVtbl->Initialize(p,a,b,c) +#define IDirectInputDevice7_CreateEffect(p,a,b,c,d) (p)->lpVtbl->CreateEffect(p,a,b,c,d) +#define IDirectInputDevice7_EnumEffects(p,a,b,c) (p)->lpVtbl->EnumEffects(p,a,b,c) +#define IDirectInputDevice7_GetEffectInfo(p,a,b) (p)->lpVtbl->GetEffectInfo(p,a,b) +#define IDirectInputDevice7_GetForceFeedbackState(p,a) (p)->lpVtbl->GetForceFeedbackState(p,a) +#define IDirectInputDevice7_SendForceFeedbackCommand(p,a) (p)->lpVtbl->SendForceFeedbackCommand(p,a) +#define IDirectInputDevice7_EnumCreatedEffectObjects(p,a,b,c) (p)->lpVtbl->EnumCreatedEffectObjects(p,a,b,c) +#define IDirectInputDevice7_Escape(p,a) (p)->lpVtbl->Escape(p,a) +#define IDirectInputDevice7_Poll(p) (p)->lpVtbl->Poll(p) +#define IDirectInputDevice7_SendDeviceData(p,a,b,c,d) (p)->lpVtbl->SendDeviceData(p,a,b,c,d) +#define IDirectInputDevice7_EnumEffectsInFile(p,a,b,c,d) (p)->lpVtbl->EnumEffectsInFile(p,a,b,c,d) +#define IDirectInputDevice7_WriteEffectToFile(p,a,b,c,d) (p)->lpVtbl->WriteEffectToFile(p,a,b,c,d) +#else +#define IDirectInputDevice7_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectInputDevice7_AddRef(p) (p)->AddRef() +#define IDirectInputDevice7_Release(p) (p)->Release() +#define IDirectInputDevice7_GetCapabilities(p,a) (p)->GetCapabilities(a) +#define IDirectInputDevice7_EnumObjects(p,a,b,c) (p)->EnumObjects(a,b,c) +#define IDirectInputDevice7_GetProperty(p,a,b) (p)->GetProperty(a,b) +#define IDirectInputDevice7_SetProperty(p,a,b) (p)->SetProperty(a,b) +#define IDirectInputDevice7_Acquire(p) (p)->Acquire() +#define IDirectInputDevice7_Unacquire(p) (p)->Unacquire() +#define IDirectInputDevice7_GetDeviceState(p,a,b) (p)->GetDeviceState(a,b) +#define IDirectInputDevice7_GetDeviceData(p,a,b,c,d) (p)->GetDeviceData(a,b,c,d) +#define IDirectInputDevice7_SetDataFormat(p,a) (p)->SetDataFormat(a) +#define IDirectInputDevice7_SetEventNotification(p,a) (p)->SetEventNotification(a) +#define IDirectInputDevice7_SetCooperativeLevel(p,a,b) (p)->SetCooperativeLevel(a,b) +#define IDirectInputDevice7_GetObjectInfo(p,a,b,c) (p)->GetObjectInfo(a,b,c) +#define IDirectInputDevice7_GetDeviceInfo(p,a) (p)->GetDeviceInfo(a) +#define IDirectInputDevice7_RunControlPanel(p,a,b) (p)->RunControlPanel(a,b) +#define IDirectInputDevice7_Initialize(p,a,b,c) (p)->Initialize(a,b,c) +#define IDirectInputDevice7_CreateEffect(p,a,b,c,d) (p)->CreateEffect(a,b,c,d) +#define IDirectInputDevice7_EnumEffects(p,a,b,c) (p)->EnumEffects(a,b,c) +#define IDirectInputDevice7_GetEffectInfo(p,a,b) (p)->GetEffectInfo(a,b) +#define IDirectInputDevice7_GetForceFeedbackState(p,a) (p)->GetForceFeedbackState(a) +#define IDirectInputDevice7_SendForceFeedbackCommand(p,a) (p)->SendForceFeedbackCommand(a) +#define IDirectInputDevice7_EnumCreatedEffectObjects(p,a,b,c) (p)->EnumCreatedEffectObjects(a,b,c) +#define IDirectInputDevice7_Escape(p,a) (p)->Escape(a) +#define IDirectInputDevice7_Poll(p) (p)->Poll() +#define IDirectInputDevice7_SendDeviceData(p,a,b,c,d) (p)->SendDeviceData(a,b,c,d) +#define IDirectInputDevice7_EnumEffectsInFile(p,a,b,c,d) (p)->EnumEffectsInFile(a,b,c,d) +#define IDirectInputDevice7_WriteEffectToFile(p,a,b,c,d) (p)->WriteEffectToFile(a,b,c,d) +#endif + +#endif /* DIJ_RINGZERO */ + +#endif /* DIRECTINPUT_VERSION >= 0x0700 */ + +#if(DIRECTINPUT_VERSION >= 0x0800) + +#ifndef DIJ_RINGZERO + +#undef INTERFACE +#define INTERFACE IDirectInputDevice8W + +DECLARE_INTERFACE_(IDirectInputDevice8W, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputDevice8W methods ***/ + STDMETHOD(GetCapabilities)(THIS_ LPDIDEVCAPS) PURE; + STDMETHOD(EnumObjects)(THIS_ LPDIENUMDEVICEOBJECTSCALLBACKW,LPVOID,DWORD) PURE; + STDMETHOD(GetProperty)(THIS_ REFGUID,LPDIPROPHEADER) PURE; + STDMETHOD(SetProperty)(THIS_ REFGUID,LPCDIPROPHEADER) PURE; + STDMETHOD(Acquire)(THIS) PURE; + STDMETHOD(Unacquire)(THIS) PURE; + STDMETHOD(GetDeviceState)(THIS_ DWORD,LPVOID) PURE; + STDMETHOD(GetDeviceData)(THIS_ DWORD,LPDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; + STDMETHOD(SetDataFormat)(THIS_ LPCDIDATAFORMAT) PURE; + STDMETHOD(SetEventNotification)(THIS_ HANDLE) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(GetObjectInfo)(THIS_ LPDIDEVICEOBJECTINSTANCEW,DWORD,DWORD) PURE; + STDMETHOD(GetDeviceInfo)(THIS_ LPDIDEVICEINSTANCEW) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD,REFGUID) PURE; + STDMETHOD(CreateEffect)(THIS_ REFGUID,LPCDIEFFECT,LPDIRECTINPUTEFFECT *,LPUNKNOWN) PURE; + STDMETHOD(EnumEffects)(THIS_ LPDIENUMEFFECTSCALLBACKW,LPVOID,DWORD) PURE; + STDMETHOD(GetEffectInfo)(THIS_ LPDIEFFECTINFOW,REFGUID) PURE; + STDMETHOD(GetForceFeedbackState)(THIS_ LPDWORD) PURE; + STDMETHOD(SendForceFeedbackCommand)(THIS_ DWORD) PURE; + STDMETHOD(EnumCreatedEffectObjects)(THIS_ LPDIENUMCREATEDEFFECTOBJECTSCALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(Escape)(THIS_ LPDIEFFESCAPE) PURE; + STDMETHOD(Poll)(THIS) PURE; + STDMETHOD(SendDeviceData)(THIS_ DWORD,LPCDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; + STDMETHOD(EnumEffectsInFile)(THIS_ LPCWSTR,LPDIENUMEFFECTSINFILECALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(WriteEffectToFile)(THIS_ LPCWSTR,DWORD,LPDIFILEEFFECT,DWORD) PURE; + STDMETHOD(BuildActionMap)(THIS_ LPDIACTIONFORMATW,LPCWSTR,DWORD) PURE; + STDMETHOD(SetActionMap)(THIS_ LPDIACTIONFORMATW,LPCWSTR,DWORD) PURE; + STDMETHOD(GetImageInfo)(THIS_ LPDIDEVICEIMAGEINFOHEADERW) PURE; +}; + +typedef struct IDirectInputDevice8W *LPDIRECTINPUTDEVICE8W; + +#undef INTERFACE +#define INTERFACE IDirectInputDevice8A + +DECLARE_INTERFACE_(IDirectInputDevice8A, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputDevice8A methods ***/ + STDMETHOD(GetCapabilities)(THIS_ LPDIDEVCAPS) PURE; + STDMETHOD(EnumObjects)(THIS_ LPDIENUMDEVICEOBJECTSCALLBACKA,LPVOID,DWORD) PURE; + STDMETHOD(GetProperty)(THIS_ REFGUID,LPDIPROPHEADER) PURE; + STDMETHOD(SetProperty)(THIS_ REFGUID,LPCDIPROPHEADER) PURE; + STDMETHOD(Acquire)(THIS) PURE; + STDMETHOD(Unacquire)(THIS) PURE; + STDMETHOD(GetDeviceState)(THIS_ DWORD,LPVOID) PURE; + STDMETHOD(GetDeviceData)(THIS_ DWORD,LPDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; + STDMETHOD(SetDataFormat)(THIS_ LPCDIDATAFORMAT) PURE; + STDMETHOD(SetEventNotification)(THIS_ HANDLE) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(GetObjectInfo)(THIS_ LPDIDEVICEOBJECTINSTANCEA,DWORD,DWORD) PURE; + STDMETHOD(GetDeviceInfo)(THIS_ LPDIDEVICEINSTANCEA) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD,REFGUID) PURE; + STDMETHOD(CreateEffect)(THIS_ REFGUID,LPCDIEFFECT,LPDIRECTINPUTEFFECT *,LPUNKNOWN) PURE; + STDMETHOD(EnumEffects)(THIS_ LPDIENUMEFFECTSCALLBACKA,LPVOID,DWORD) PURE; + STDMETHOD(GetEffectInfo)(THIS_ LPDIEFFECTINFOA,REFGUID) PURE; + STDMETHOD(GetForceFeedbackState)(THIS_ LPDWORD) PURE; + STDMETHOD(SendForceFeedbackCommand)(THIS_ DWORD) PURE; + STDMETHOD(EnumCreatedEffectObjects)(THIS_ LPDIENUMCREATEDEFFECTOBJECTSCALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(Escape)(THIS_ LPDIEFFESCAPE) PURE; + STDMETHOD(Poll)(THIS) PURE; + STDMETHOD(SendDeviceData)(THIS_ DWORD,LPCDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; + STDMETHOD(EnumEffectsInFile)(THIS_ LPCSTR,LPDIENUMEFFECTSINFILECALLBACK,LPVOID,DWORD) PURE; + STDMETHOD(WriteEffectToFile)(THIS_ LPCSTR,DWORD,LPDIFILEEFFECT,DWORD) PURE; + STDMETHOD(BuildActionMap)(THIS_ LPDIACTIONFORMATA,LPCSTR,DWORD) PURE; + STDMETHOD(SetActionMap)(THIS_ LPDIACTIONFORMATA,LPCSTR,DWORD) PURE; + STDMETHOD(GetImageInfo)(THIS_ LPDIDEVICEIMAGEINFOHEADERA) PURE; +}; + +typedef struct IDirectInputDevice8A *LPDIRECTINPUTDEVICE8A; + +#ifdef UNICODE +#define IID_IDirectInputDevice8 IID_IDirectInputDevice8W +#define IDirectInputDevice8 IDirectInputDevice8W +#define IDirectInputDevice8Vtbl IDirectInputDevice8WVtbl +#else +#define IID_IDirectInputDevice8 IID_IDirectInputDevice8A +#define IDirectInputDevice8 IDirectInputDevice8A +#define IDirectInputDevice8Vtbl IDirectInputDevice8AVtbl +#endif +typedef struct IDirectInputDevice8 *LPDIRECTINPUTDEVICE8; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectInputDevice8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectInputDevice8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectInputDevice8_Release(p) (p)->lpVtbl->Release(p) +#define IDirectInputDevice8_GetCapabilities(p,a) (p)->lpVtbl->GetCapabilities(p,a) +#define IDirectInputDevice8_EnumObjects(p,a,b,c) (p)->lpVtbl->EnumObjects(p,a,b,c) +#define IDirectInputDevice8_GetProperty(p,a,b) (p)->lpVtbl->GetProperty(p,a,b) +#define IDirectInputDevice8_SetProperty(p,a,b) (p)->lpVtbl->SetProperty(p,a,b) +#define IDirectInputDevice8_Acquire(p) (p)->lpVtbl->Acquire(p) +#define IDirectInputDevice8_Unacquire(p) (p)->lpVtbl->Unacquire(p) +#define IDirectInputDevice8_GetDeviceState(p,a,b) (p)->lpVtbl->GetDeviceState(p,a,b) +#define IDirectInputDevice8_GetDeviceData(p,a,b,c,d) (p)->lpVtbl->GetDeviceData(p,a,b,c,d) +#define IDirectInputDevice8_SetDataFormat(p,a) (p)->lpVtbl->SetDataFormat(p,a) +#define IDirectInputDevice8_SetEventNotification(p,a) (p)->lpVtbl->SetEventNotification(p,a) +#define IDirectInputDevice8_SetCooperativeLevel(p,a,b) (p)->lpVtbl->SetCooperativeLevel(p,a,b) +#define IDirectInputDevice8_GetObjectInfo(p,a,b,c) (p)->lpVtbl->GetObjectInfo(p,a,b,c) +#define IDirectInputDevice8_GetDeviceInfo(p,a) (p)->lpVtbl->GetDeviceInfo(p,a) +#define IDirectInputDevice8_RunControlPanel(p,a,b) (p)->lpVtbl->RunControlPanel(p,a,b) +#define IDirectInputDevice8_Initialize(p,a,b,c) (p)->lpVtbl->Initialize(p,a,b,c) +#define IDirectInputDevice8_CreateEffect(p,a,b,c,d) (p)->lpVtbl->CreateEffect(p,a,b,c,d) +#define IDirectInputDevice8_EnumEffects(p,a,b,c) (p)->lpVtbl->EnumEffects(p,a,b,c) +#define IDirectInputDevice8_GetEffectInfo(p,a,b) (p)->lpVtbl->GetEffectInfo(p,a,b) +#define IDirectInputDevice8_GetForceFeedbackState(p,a) (p)->lpVtbl->GetForceFeedbackState(p,a) +#define IDirectInputDevice8_SendForceFeedbackCommand(p,a) (p)->lpVtbl->SendForceFeedbackCommand(p,a) +#define IDirectInputDevice8_EnumCreatedEffectObjects(p,a,b,c) (p)->lpVtbl->EnumCreatedEffectObjects(p,a,b,c) +#define IDirectInputDevice8_Escape(p,a) (p)->lpVtbl->Escape(p,a) +#define IDirectInputDevice8_Poll(p) (p)->lpVtbl->Poll(p) +#define IDirectInputDevice8_SendDeviceData(p,a,b,c,d) (p)->lpVtbl->SendDeviceData(p,a,b,c,d) +#define IDirectInputDevice8_EnumEffectsInFile(p,a,b,c,d) (p)->lpVtbl->EnumEffectsInFile(p,a,b,c,d) +#define IDirectInputDevice8_WriteEffectToFile(p,a,b,c,d) (p)->lpVtbl->WriteEffectToFile(p,a,b,c,d) +#define IDirectInputDevice8_BuildActionMap(p,a,b,c) (p)->lpVtbl->BuildActionMap(p,a,b,c) +#define IDirectInputDevice8_SetActionMap(p,a,b,c) (p)->lpVtbl->SetActionMap(p,a,b,c) +#define IDirectInputDevice8_GetImageInfo(p,a) (p)->lpVtbl->GetImageInfo(p,a) +#else +#define IDirectInputDevice8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectInputDevice8_AddRef(p) (p)->AddRef() +#define IDirectInputDevice8_Release(p) (p)->Release() +#define IDirectInputDevice8_GetCapabilities(p,a) (p)->GetCapabilities(a) +#define IDirectInputDevice8_EnumObjects(p,a,b,c) (p)->EnumObjects(a,b,c) +#define IDirectInputDevice8_GetProperty(p,a,b) (p)->GetProperty(a,b) +#define IDirectInputDevice8_SetProperty(p,a,b) (p)->SetProperty(a,b) +#define IDirectInputDevice8_Acquire(p) (p)->Acquire() +#define IDirectInputDevice8_Unacquire(p) (p)->Unacquire() +#define IDirectInputDevice8_GetDeviceState(p,a,b) (p)->GetDeviceState(a,b) +#define IDirectInputDevice8_GetDeviceData(p,a,b,c,d) (p)->GetDeviceData(a,b,c,d) +#define IDirectInputDevice8_SetDataFormat(p,a) (p)->SetDataFormat(a) +#define IDirectInputDevice8_SetEventNotification(p,a) (p)->SetEventNotification(a) +#define IDirectInputDevice8_SetCooperativeLevel(p,a,b) (p)->SetCooperativeLevel(a,b) +#define IDirectInputDevice8_GetObjectInfo(p,a,b,c) (p)->GetObjectInfo(a,b,c) +#define IDirectInputDevice8_GetDeviceInfo(p,a) (p)->GetDeviceInfo(a) +#define IDirectInputDevice8_RunControlPanel(p,a,b) (p)->RunControlPanel(a,b) +#define IDirectInputDevice8_Initialize(p,a,b,c) (p)->Initialize(a,b,c) +#define IDirectInputDevice8_CreateEffect(p,a,b,c,d) (p)->CreateEffect(a,b,c,d) +#define IDirectInputDevice8_EnumEffects(p,a,b,c) (p)->EnumEffects(a,b,c) +#define IDirectInputDevice8_GetEffectInfo(p,a,b) (p)->GetEffectInfo(a,b) +#define IDirectInputDevice8_GetForceFeedbackState(p,a) (p)->GetForceFeedbackState(a) +#define IDirectInputDevice8_SendForceFeedbackCommand(p,a) (p)->SendForceFeedbackCommand(a) +#define IDirectInputDevice8_EnumCreatedEffectObjects(p,a,b,c) (p)->EnumCreatedEffectObjects(a,b,c) +#define IDirectInputDevice8_Escape(p,a) (p)->Escape(a) +#define IDirectInputDevice8_Poll(p) (p)->Poll() +#define IDirectInputDevice8_SendDeviceData(p,a,b,c,d) (p)->SendDeviceData(a,b,c,d) +#define IDirectInputDevice8_EnumEffectsInFile(p,a,b,c,d) (p)->EnumEffectsInFile(a,b,c,d) +#define IDirectInputDevice8_WriteEffectToFile(p,a,b,c,d) (p)->WriteEffectToFile(a,b,c,d) +#define IDirectInputDevice8_BuildActionMap(p,a,b,c) (p)->BuildActionMap(a,b,c) +#define IDirectInputDevice8_SetActionMap(p,a,b,c) (p)->SetActionMap(a,b,c) +#define IDirectInputDevice8_GetImageInfo(p,a) (p)->GetImageInfo(a) +#endif + +#endif /* DIJ_RINGZERO */ + +#endif /* DIRECTINPUT_VERSION >= 0x0800 */ + +/**************************************************************************** + * + * Mouse + * + ****************************************************************************/ + +#ifndef DIJ_RINGZERO + +typedef struct _DIMOUSESTATE { + LONG lX; + LONG lY; + LONG lZ; + BYTE rgbButtons[4]; +} DIMOUSESTATE, *LPDIMOUSESTATE; + +#if DIRECTINPUT_VERSION >= 0x0700 +typedef struct _DIMOUSESTATE2 { + LONG lX; + LONG lY; + LONG lZ; + BYTE rgbButtons[8]; +} DIMOUSESTATE2, *LPDIMOUSESTATE2; +#endif + + +#define DIMOFS_X FIELD_OFFSET(DIMOUSESTATE, lX) +#define DIMOFS_Y FIELD_OFFSET(DIMOUSESTATE, lY) +#define DIMOFS_Z FIELD_OFFSET(DIMOUSESTATE, lZ) +#define DIMOFS_BUTTON0 (FIELD_OFFSET(DIMOUSESTATE, rgbButtons) + 0) +#define DIMOFS_BUTTON1 (FIELD_OFFSET(DIMOUSESTATE, rgbButtons) + 1) +#define DIMOFS_BUTTON2 (FIELD_OFFSET(DIMOUSESTATE, rgbButtons) + 2) +#define DIMOFS_BUTTON3 (FIELD_OFFSET(DIMOUSESTATE, rgbButtons) + 3) +#if (DIRECTINPUT_VERSION >= 0x0700) +#define DIMOFS_BUTTON4 (FIELD_OFFSET(DIMOUSESTATE2, rgbButtons) + 4) +#define DIMOFS_BUTTON5 (FIELD_OFFSET(DIMOUSESTATE2, rgbButtons) + 5) +#define DIMOFS_BUTTON6 (FIELD_OFFSET(DIMOUSESTATE2, rgbButtons) + 6) +#define DIMOFS_BUTTON7 (FIELD_OFFSET(DIMOUSESTATE2, rgbButtons) + 7) +#endif +#endif /* DIJ_RINGZERO */ + +/**************************************************************************** + * + * Keyboard + * + ****************************************************************************/ + +#ifndef DIJ_RINGZERO + +/**************************************************************************** + * + * DirectInput keyboard scan codes + * + ****************************************************************************/ +#define DIK_ESCAPE 0x01 +#define DIK_1 0x02 +#define DIK_2 0x03 +#define DIK_3 0x04 +#define DIK_4 0x05 +#define DIK_5 0x06 +#define DIK_6 0x07 +#define DIK_7 0x08 +#define DIK_8 0x09 +#define DIK_9 0x0A +#define DIK_0 0x0B +#define DIK_MINUS 0x0C /* - on main keyboard */ +#define DIK_EQUALS 0x0D +#define DIK_BACK 0x0E /* backspace */ +#define DIK_TAB 0x0F +#define DIK_Q 0x10 +#define DIK_W 0x11 +#define DIK_E 0x12 +#define DIK_R 0x13 +#define DIK_T 0x14 +#define DIK_Y 0x15 +#define DIK_U 0x16 +#define DIK_I 0x17 +#define DIK_O 0x18 +#define DIK_P 0x19 +#define DIK_LBRACKET 0x1A +#define DIK_RBRACKET 0x1B +#define DIK_RETURN 0x1C /* Enter on main keyboard */ +#define DIK_LCONTROL 0x1D +#define DIK_A 0x1E +#define DIK_S 0x1F +#define DIK_D 0x20 +#define DIK_F 0x21 +#define DIK_G 0x22 +#define DIK_H 0x23 +#define DIK_J 0x24 +#define DIK_K 0x25 +#define DIK_L 0x26 +#define DIK_SEMICOLON 0x27 +#define DIK_APOSTROPHE 0x28 +#define DIK_GRAVE 0x29 /* accent grave */ +#define DIK_LSHIFT 0x2A +#define DIK_BACKSLASH 0x2B +#define DIK_Z 0x2C +#define DIK_X 0x2D +#define DIK_C 0x2E +#define DIK_V 0x2F +#define DIK_B 0x30 +#define DIK_N 0x31 +#define DIK_M 0x32 +#define DIK_COMMA 0x33 +#define DIK_PERIOD 0x34 /* . on main keyboard */ +#define DIK_SLASH 0x35 /* / on main keyboard */ +#define DIK_RSHIFT 0x36 +#define DIK_MULTIPLY 0x37 /* * on numeric keypad */ +#define DIK_LMENU 0x38 /* left Alt */ +#define DIK_SPACE 0x39 +#define DIK_CAPITAL 0x3A +#define DIK_F1 0x3B +#define DIK_F2 0x3C +#define DIK_F3 0x3D +#define DIK_F4 0x3E +#define DIK_F5 0x3F +#define DIK_F6 0x40 +#define DIK_F7 0x41 +#define DIK_F8 0x42 +#define DIK_F9 0x43 +#define DIK_F10 0x44 +#define DIK_NUMLOCK 0x45 +#define DIK_SCROLL 0x46 /* Scroll Lock */ +#define DIK_NUMPAD7 0x47 +#define DIK_NUMPAD8 0x48 +#define DIK_NUMPAD9 0x49 +#define DIK_SUBTRACT 0x4A /* - on numeric keypad */ +#define DIK_NUMPAD4 0x4B +#define DIK_NUMPAD5 0x4C +#define DIK_NUMPAD6 0x4D +#define DIK_ADD 0x4E /* + on numeric keypad */ +#define DIK_NUMPAD1 0x4F +#define DIK_NUMPAD2 0x50 +#define DIK_NUMPAD3 0x51 +#define DIK_NUMPAD0 0x52 +#define DIK_DECIMAL 0x53 /* . on numeric keypad */ +#define DIK_OEM_102 0x56 /* <> or \| on RT 102-key keyboard (Non-U.S.) */ +#define DIK_F11 0x57 +#define DIK_F12 0x58 +#define DIK_F13 0x64 /* (NEC PC98) */ +#define DIK_F14 0x65 /* (NEC PC98) */ +#define DIK_F15 0x66 /* (NEC PC98) */ +#define DIK_KANA 0x70 /* (Japanese keyboard) */ +#define DIK_ABNT_C1 0x73 /* /? on Brazilian keyboard */ +#define DIK_CONVERT 0x79 /* (Japanese keyboard) */ +#define DIK_NOCONVERT 0x7B /* (Japanese keyboard) */ +#define DIK_YEN 0x7D /* (Japanese keyboard) */ +#define DIK_ABNT_C2 0x7E /* Numpad . on Brazilian keyboard */ +#define DIK_NUMPADEQUALS 0x8D /* = on numeric keypad (NEC PC98) */ +#define DIK_PREVTRACK 0x90 /* Previous Track (DIK_CIRCUMFLEX on Japanese keyboard) */ +#define DIK_AT 0x91 /* (NEC PC98) */ +#define DIK_COLON 0x92 /* (NEC PC98) */ +#define DIK_UNDERLINE 0x93 /* (NEC PC98) */ +#define DIK_KANJI 0x94 /* (Japanese keyboard) */ +#define DIK_STOP 0x95 /* (NEC PC98) */ +#define DIK_AX 0x96 /* (Japan AX) */ +#define DIK_UNLABELED 0x97 /* (J3100) */ +#define DIK_NEXTTRACK 0x99 /* Next Track */ +#define DIK_NUMPADENTER 0x9C /* Enter on numeric keypad */ +#define DIK_RCONTROL 0x9D +#define DIK_MUTE 0xA0 /* Mute */ +#define DIK_CALCULATOR 0xA1 /* Calculator */ +#define DIK_PLAYPAUSE 0xA2 /* Play / Pause */ +#define DIK_MEDIASTOP 0xA4 /* Media Stop */ +#define DIK_VOLUMEDOWN 0xAE /* Volume - */ +#define DIK_VOLUMEUP 0xB0 /* Volume + */ +#define DIK_WEBHOME 0xB2 /* Web home */ +#define DIK_NUMPADCOMMA 0xB3 /* , on numeric keypad (NEC PC98) */ +#define DIK_DIVIDE 0xB5 /* / on numeric keypad */ +#define DIK_SYSRQ 0xB7 +#define DIK_RMENU 0xB8 /* right Alt */ +#define DIK_PAUSE 0xC5 /* Pause */ +#define DIK_HOME 0xC7 /* Home on arrow keypad */ +#define DIK_UP 0xC8 /* UpArrow on arrow keypad */ +#define DIK_PRIOR 0xC9 /* PgUp on arrow keypad */ +#define DIK_LEFT 0xCB /* LeftArrow on arrow keypad */ +#define DIK_RIGHT 0xCD /* RightArrow on arrow keypad */ +#define DIK_END 0xCF /* End on arrow keypad */ +#define DIK_DOWN 0xD0 /* DownArrow on arrow keypad */ +#define DIK_NEXT 0xD1 /* PgDn on arrow keypad */ +#define DIK_INSERT 0xD2 /* Insert on arrow keypad */ +#define DIK_DELETE 0xD3 /* Delete on arrow keypad */ +#define DIK_LWIN 0xDB /* Left Windows key */ +#define DIK_RWIN 0xDC /* Right Windows key */ +#define DIK_APPS 0xDD /* AppMenu key */ +#define DIK_POWER 0xDE /* System Power */ +#define DIK_SLEEP 0xDF /* System Sleep */ +#define DIK_WAKE 0xE3 /* System Wake */ +#define DIK_WEBSEARCH 0xE5 /* Web Search */ +#define DIK_WEBFAVORITES 0xE6 /* Web Favorites */ +#define DIK_WEBREFRESH 0xE7 /* Web Refresh */ +#define DIK_WEBSTOP 0xE8 /* Web Stop */ +#define DIK_WEBFORWARD 0xE9 /* Web Forward */ +#define DIK_WEBBACK 0xEA /* Web Back */ +#define DIK_MYCOMPUTER 0xEB /* My Computer */ +#define DIK_MAIL 0xEC /* Mail */ +#define DIK_MEDIASELECT 0xED /* Media Select */ + +/* + * Alternate names for keys, to facilitate transition from DOS. + */ +#define DIK_BACKSPACE DIK_BACK /* backspace */ +#define DIK_NUMPADSTAR DIK_MULTIPLY /* * on numeric keypad */ +#define DIK_LALT DIK_LMENU /* left Alt */ +#define DIK_CAPSLOCK DIK_CAPITAL /* CapsLock */ +#define DIK_NUMPADMINUS DIK_SUBTRACT /* - on numeric keypad */ +#define DIK_NUMPADPLUS DIK_ADD /* + on numeric keypad */ +#define DIK_NUMPADPERIOD DIK_DECIMAL /* . on numeric keypad */ +#define DIK_NUMPADSLASH DIK_DIVIDE /* / on numeric keypad */ +#define DIK_RALT DIK_RMENU /* right Alt */ +#define DIK_UPARROW DIK_UP /* UpArrow on arrow keypad */ +#define DIK_PGUP DIK_PRIOR /* PgUp on arrow keypad */ +#define DIK_LEFTARROW DIK_LEFT /* LeftArrow on arrow keypad */ +#define DIK_RIGHTARROW DIK_RIGHT /* RightArrow on arrow keypad */ +#define DIK_DOWNARROW DIK_DOWN /* DownArrow on arrow keypad */ +#define DIK_PGDN DIK_NEXT /* PgDn on arrow keypad */ + +/* + * Alternate names for keys originally not used on US keyboards. + */ +#define DIK_CIRCUMFLEX DIK_PREVTRACK /* Japanese keyboard */ + +#endif /* DIJ_RINGZERO */ + +/**************************************************************************** + * + * Joystick + * + ****************************************************************************/ + +#ifndef DIJ_RINGZERO + +typedef struct DIJOYSTATE { + LONG lX; /* x-axis position */ + LONG lY; /* y-axis position */ + LONG lZ; /* z-axis position */ + LONG lRx; /* x-axis rotation */ + LONG lRy; /* y-axis rotation */ + LONG lRz; /* z-axis rotation */ + LONG rglSlider[2]; /* extra axes positions */ + DWORD rgdwPOV[4]; /* POV directions */ + BYTE rgbButtons[32]; /* 32 buttons */ +} DIJOYSTATE, *LPDIJOYSTATE; + +typedef struct DIJOYSTATE2 { + LONG lX; /* x-axis position */ + LONG lY; /* y-axis position */ + LONG lZ; /* z-axis position */ + LONG lRx; /* x-axis rotation */ + LONG lRy; /* y-axis rotation */ + LONG lRz; /* z-axis rotation */ + LONG rglSlider[2]; /* extra axes positions */ + DWORD rgdwPOV[4]; /* POV directions */ + BYTE rgbButtons[128]; /* 128 buttons */ + LONG lVX; /* x-axis velocity */ + LONG lVY; /* y-axis velocity */ + LONG lVZ; /* z-axis velocity */ + LONG lVRx; /* x-axis angular velocity */ + LONG lVRy; /* y-axis angular velocity */ + LONG lVRz; /* z-axis angular velocity */ + LONG rglVSlider[2]; /* extra axes velocities */ + LONG lAX; /* x-axis acceleration */ + LONG lAY; /* y-axis acceleration */ + LONG lAZ; /* z-axis acceleration */ + LONG lARx; /* x-axis angular acceleration */ + LONG lARy; /* y-axis angular acceleration */ + LONG lARz; /* z-axis angular acceleration */ + LONG rglASlider[2]; /* extra axes accelerations */ + LONG lFX; /* x-axis force */ + LONG lFY; /* y-axis force */ + LONG lFZ; /* z-axis force */ + LONG lFRx; /* x-axis torque */ + LONG lFRy; /* y-axis torque */ + LONG lFRz; /* z-axis torque */ + LONG rglFSlider[2]; /* extra axes forces */ +} DIJOYSTATE2, *LPDIJOYSTATE2; + +#define DIJOFS_X FIELD_OFFSET(DIJOYSTATE, lX) +#define DIJOFS_Y FIELD_OFFSET(DIJOYSTATE, lY) +#define DIJOFS_Z FIELD_OFFSET(DIJOYSTATE, lZ) +#define DIJOFS_RX FIELD_OFFSET(DIJOYSTATE, lRx) +#define DIJOFS_RY FIELD_OFFSET(DIJOYSTATE, lRy) +#define DIJOFS_RZ FIELD_OFFSET(DIJOYSTATE, lRz) +#define DIJOFS_SLIDER(n) (FIELD_OFFSET(DIJOYSTATE, rglSlider) + \ + (n) * sizeof(LONG)) +#define DIJOFS_POV(n) (FIELD_OFFSET(DIJOYSTATE, rgdwPOV) + \ + (n) * sizeof(DWORD)) +#define DIJOFS_BUTTON(n) (FIELD_OFFSET(DIJOYSTATE, rgbButtons) + (n)) +#define DIJOFS_BUTTON0 DIJOFS_BUTTON(0) +#define DIJOFS_BUTTON1 DIJOFS_BUTTON(1) +#define DIJOFS_BUTTON2 DIJOFS_BUTTON(2) +#define DIJOFS_BUTTON3 DIJOFS_BUTTON(3) +#define DIJOFS_BUTTON4 DIJOFS_BUTTON(4) +#define DIJOFS_BUTTON5 DIJOFS_BUTTON(5) +#define DIJOFS_BUTTON6 DIJOFS_BUTTON(6) +#define DIJOFS_BUTTON7 DIJOFS_BUTTON(7) +#define DIJOFS_BUTTON8 DIJOFS_BUTTON(8) +#define DIJOFS_BUTTON9 DIJOFS_BUTTON(9) +#define DIJOFS_BUTTON10 DIJOFS_BUTTON(10) +#define DIJOFS_BUTTON11 DIJOFS_BUTTON(11) +#define DIJOFS_BUTTON12 DIJOFS_BUTTON(12) +#define DIJOFS_BUTTON13 DIJOFS_BUTTON(13) +#define DIJOFS_BUTTON14 DIJOFS_BUTTON(14) +#define DIJOFS_BUTTON15 DIJOFS_BUTTON(15) +#define DIJOFS_BUTTON16 DIJOFS_BUTTON(16) +#define DIJOFS_BUTTON17 DIJOFS_BUTTON(17) +#define DIJOFS_BUTTON18 DIJOFS_BUTTON(18) +#define DIJOFS_BUTTON19 DIJOFS_BUTTON(19) +#define DIJOFS_BUTTON20 DIJOFS_BUTTON(20) +#define DIJOFS_BUTTON21 DIJOFS_BUTTON(21) +#define DIJOFS_BUTTON22 DIJOFS_BUTTON(22) +#define DIJOFS_BUTTON23 DIJOFS_BUTTON(23) +#define DIJOFS_BUTTON24 DIJOFS_BUTTON(24) +#define DIJOFS_BUTTON25 DIJOFS_BUTTON(25) +#define DIJOFS_BUTTON26 DIJOFS_BUTTON(26) +#define DIJOFS_BUTTON27 DIJOFS_BUTTON(27) +#define DIJOFS_BUTTON28 DIJOFS_BUTTON(28) +#define DIJOFS_BUTTON29 DIJOFS_BUTTON(29) +#define DIJOFS_BUTTON30 DIJOFS_BUTTON(30) +#define DIJOFS_BUTTON31 DIJOFS_BUTTON(31) + + +#endif /* DIJ_RINGZERO */ + +/**************************************************************************** + * + * IDirectInput + * + ****************************************************************************/ + +#ifndef DIJ_RINGZERO + +#define DIENUM_STOP 0 +#define DIENUM_CONTINUE 1 + +typedef BOOL (FAR PASCAL * LPDIENUMDEVICESCALLBACKA)(LPCDIDEVICEINSTANCEA, LPVOID); +typedef BOOL (FAR PASCAL * LPDIENUMDEVICESCALLBACKW)(LPCDIDEVICEINSTANCEW, LPVOID); +#ifdef UNICODE +#define LPDIENUMDEVICESCALLBACK LPDIENUMDEVICESCALLBACKW +#else +#define LPDIENUMDEVICESCALLBACK LPDIENUMDEVICESCALLBACKA +#endif // !UNICODE +typedef BOOL (FAR PASCAL * LPDICONFIGUREDEVICESCALLBACK)(IUnknown FAR *, LPVOID); + +#define DIEDFL_ALLDEVICES 0x00000000 +#define DIEDFL_ATTACHEDONLY 0x00000001 +#if(DIRECTINPUT_VERSION >= 0x0500) +#define DIEDFL_FORCEFEEDBACK 0x00000100 +#endif /* DIRECTINPUT_VERSION >= 0x0500 */ +#if(DIRECTINPUT_VERSION >= 0x050a) +#define DIEDFL_INCLUDEALIASES 0x00010000 +#define DIEDFL_INCLUDEPHANTOMS 0x00020000 +#endif /* DIRECTINPUT_VERSION >= 0x050a */ +#if(DIRECTINPUT_VERSION >= 0x0800) +#define DIEDFL_INCLUDEHIDDEN 0x00040000 +#endif /* DIRECTINPUT_VERSION >= 0x0800 */ + + +#if(DIRECTINPUT_VERSION >= 0x0800) +typedef BOOL (FAR PASCAL * LPDIENUMDEVICESBYSEMANTICSCBA)(LPCDIDEVICEINSTANCEA, LPDIRECTINPUTDEVICE8A, DWORD, DWORD, LPVOID); +typedef BOOL (FAR PASCAL * LPDIENUMDEVICESBYSEMANTICSCBW)(LPCDIDEVICEINSTANCEW, LPDIRECTINPUTDEVICE8W, DWORD, DWORD, LPVOID); +#ifdef UNICODE +#define LPDIENUMDEVICESBYSEMANTICSCB LPDIENUMDEVICESBYSEMANTICSCBW +#else +#define LPDIENUMDEVICESBYSEMANTICSCB LPDIENUMDEVICESBYSEMANTICSCBA +#endif // !UNICODE +#endif /* DIRECTINPUT_VERSION >= 0x0800 */ + +#if(DIRECTINPUT_VERSION >= 0x0800) +#define DIEDBS_MAPPEDPRI1 0x00000001 +#define DIEDBS_MAPPEDPRI2 0x00000002 +#define DIEDBS_RECENTDEVICE 0x00000010 +#define DIEDBS_NEWDEVICE 0x00000020 +#endif /* DIRECTINPUT_VERSION >= 0x0800 */ + +#if(DIRECTINPUT_VERSION >= 0x0800) +#define DIEDBSFL_ATTACHEDONLY 0x00000000 +#define DIEDBSFL_THISUSER 0x00000010 +#define DIEDBSFL_FORCEFEEDBACK DIEDFL_FORCEFEEDBACK +#define DIEDBSFL_AVAILABLEDEVICES 0x00001000 +#define DIEDBSFL_MULTIMICEKEYBOARDS 0x00002000 +#define DIEDBSFL_NONGAMINGDEVICES 0x00004000 +#define DIEDBSFL_VALID 0x00007110 +#endif /* DIRECTINPUT_VERSION >= 0x0800 */ + +#undef INTERFACE +#define INTERFACE IDirectInputW + +DECLARE_INTERFACE_(IDirectInputW, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputW methods ***/ + STDMETHOD(CreateDevice)(THIS_ REFGUID,LPDIRECTINPUTDEVICEW *,LPUNKNOWN) PURE; + STDMETHOD(EnumDevices)(THIS_ DWORD,LPDIENUMDEVICESCALLBACKW,LPVOID,DWORD) PURE; + STDMETHOD(GetDeviceStatus)(THIS_ REFGUID) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD) PURE; +}; + +typedef struct IDirectInputW *LPDIRECTINPUTW; + +#undef INTERFACE +#define INTERFACE IDirectInputA + +DECLARE_INTERFACE_(IDirectInputA, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputA methods ***/ + STDMETHOD(CreateDevice)(THIS_ REFGUID,LPDIRECTINPUTDEVICEA *,LPUNKNOWN) PURE; + STDMETHOD(EnumDevices)(THIS_ DWORD,LPDIENUMDEVICESCALLBACKA,LPVOID,DWORD) PURE; + STDMETHOD(GetDeviceStatus)(THIS_ REFGUID) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD) PURE; +}; + +typedef struct IDirectInputA *LPDIRECTINPUTA; + +#ifdef UNICODE +#define IID_IDirectInput IID_IDirectInputW +#define IDirectInput IDirectInputW +#define IDirectInputVtbl IDirectInputWVtbl +#else +#define IID_IDirectInput IID_IDirectInputA +#define IDirectInput IDirectInputA +#define IDirectInputVtbl IDirectInputAVtbl +#endif +typedef struct IDirectInput *LPDIRECTINPUT; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectInput_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectInput_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectInput_Release(p) (p)->lpVtbl->Release(p) +#define IDirectInput_CreateDevice(p,a,b,c) (p)->lpVtbl->CreateDevice(p,a,b,c) +#define IDirectInput_EnumDevices(p,a,b,c,d) (p)->lpVtbl->EnumDevices(p,a,b,c,d) +#define IDirectInput_GetDeviceStatus(p,a) (p)->lpVtbl->GetDeviceStatus(p,a) +#define IDirectInput_RunControlPanel(p,a,b) (p)->lpVtbl->RunControlPanel(p,a,b) +#define IDirectInput_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b) +#else +#define IDirectInput_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectInput_AddRef(p) (p)->AddRef() +#define IDirectInput_Release(p) (p)->Release() +#define IDirectInput_CreateDevice(p,a,b,c) (p)->CreateDevice(a,b,c) +#define IDirectInput_EnumDevices(p,a,b,c,d) (p)->EnumDevices(a,b,c,d) +#define IDirectInput_GetDeviceStatus(p,a) (p)->GetDeviceStatus(a) +#define IDirectInput_RunControlPanel(p,a,b) (p)->RunControlPanel(a,b) +#define IDirectInput_Initialize(p,a,b) (p)->Initialize(a,b) +#endif + +#undef INTERFACE +#define INTERFACE IDirectInput2W + +DECLARE_INTERFACE_(IDirectInput2W, IDirectInputW) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputW methods ***/ + STDMETHOD(CreateDevice)(THIS_ REFGUID,LPDIRECTINPUTDEVICEW *,LPUNKNOWN) PURE; + STDMETHOD(EnumDevices)(THIS_ DWORD,LPDIENUMDEVICESCALLBACKW,LPVOID,DWORD) PURE; + STDMETHOD(GetDeviceStatus)(THIS_ REFGUID) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD) PURE; + + /*** IDirectInput2W methods ***/ + STDMETHOD(FindDevice)(THIS_ REFGUID,LPCWSTR,LPGUID) PURE; +}; + +typedef struct IDirectInput2W *LPDIRECTINPUT2W; + +#undef INTERFACE +#define INTERFACE IDirectInput2A + +DECLARE_INTERFACE_(IDirectInput2A, IDirectInputA) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputA methods ***/ + STDMETHOD(CreateDevice)(THIS_ REFGUID,LPDIRECTINPUTDEVICEA *,LPUNKNOWN) PURE; + STDMETHOD(EnumDevices)(THIS_ DWORD,LPDIENUMDEVICESCALLBACKA,LPVOID,DWORD) PURE; + STDMETHOD(GetDeviceStatus)(THIS_ REFGUID) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD) PURE; + + /*** IDirectInput2A methods ***/ + STDMETHOD(FindDevice)(THIS_ REFGUID,LPCSTR,LPGUID) PURE; +}; + +typedef struct IDirectInput2A *LPDIRECTINPUT2A; + +#ifdef UNICODE +#define IID_IDirectInput2 IID_IDirectInput2W +#define IDirectInput2 IDirectInput2W +#define IDirectInput2Vtbl IDirectInput2WVtbl +#else +#define IID_IDirectInput2 IID_IDirectInput2A +#define IDirectInput2 IDirectInput2A +#define IDirectInput2Vtbl IDirectInput2AVtbl +#endif +typedef struct IDirectInput2 *LPDIRECTINPUT2; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectInput2_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectInput2_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectInput2_Release(p) (p)->lpVtbl->Release(p) +#define IDirectInput2_CreateDevice(p,a,b,c) (p)->lpVtbl->CreateDevice(p,a,b,c) +#define IDirectInput2_EnumDevices(p,a,b,c,d) (p)->lpVtbl->EnumDevices(p,a,b,c,d) +#define IDirectInput2_GetDeviceStatus(p,a) (p)->lpVtbl->GetDeviceStatus(p,a) +#define IDirectInput2_RunControlPanel(p,a,b) (p)->lpVtbl->RunControlPanel(p,a,b) +#define IDirectInput2_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b) +#define IDirectInput2_FindDevice(p,a,b,c) (p)->lpVtbl->FindDevice(p,a,b,c) +#else +#define IDirectInput2_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectInput2_AddRef(p) (p)->AddRef() +#define IDirectInput2_Release(p) (p)->Release() +#define IDirectInput2_CreateDevice(p,a,b,c) (p)->CreateDevice(a,b,c) +#define IDirectInput2_EnumDevices(p,a,b,c,d) (p)->EnumDevices(a,b,c,d) +#define IDirectInput2_GetDeviceStatus(p,a) (p)->GetDeviceStatus(a) +#define IDirectInput2_RunControlPanel(p,a,b) (p)->RunControlPanel(a,b) +#define IDirectInput2_Initialize(p,a,b) (p)->Initialize(a,b) +#define IDirectInput2_FindDevice(p,a,b,c) (p)->FindDevice(a,b,c) +#endif + + +#undef INTERFACE +#define INTERFACE IDirectInput7W + +DECLARE_INTERFACE_(IDirectInput7W, IDirectInput2W) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInput2W methods ***/ + STDMETHOD(CreateDevice)(THIS_ REFGUID,LPDIRECTINPUTDEVICEW *,LPUNKNOWN) PURE; + STDMETHOD(EnumDevices)(THIS_ DWORD,LPDIENUMDEVICESCALLBACKW,LPVOID,DWORD) PURE; + STDMETHOD(GetDeviceStatus)(THIS_ REFGUID) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD) PURE; + STDMETHOD(FindDevice)(THIS_ REFGUID,LPCWSTR,LPGUID) PURE; + + /*** IDirectInput7W methods ***/ + STDMETHOD(CreateDeviceEx)(THIS_ REFGUID,REFIID,LPVOID *,LPUNKNOWN) PURE; +}; + +typedef struct IDirectInput7W *LPDIRECTINPUT7W; + +#undef INTERFACE +#define INTERFACE IDirectInput7A + +DECLARE_INTERFACE_(IDirectInput7A, IDirectInput2A) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInput2A methods ***/ + STDMETHOD(CreateDevice)(THIS_ REFGUID,LPDIRECTINPUTDEVICEA *,LPUNKNOWN) PURE; + STDMETHOD(EnumDevices)(THIS_ DWORD,LPDIENUMDEVICESCALLBACKA,LPVOID,DWORD) PURE; + STDMETHOD(GetDeviceStatus)(THIS_ REFGUID) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD) PURE; + STDMETHOD(FindDevice)(THIS_ REFGUID,LPCSTR,LPGUID) PURE; + + /*** IDirectInput7A methods ***/ + STDMETHOD(CreateDeviceEx)(THIS_ REFGUID,REFIID,LPVOID *,LPUNKNOWN) PURE; +}; + +typedef struct IDirectInput7A *LPDIRECTINPUT7A; + +#ifdef UNICODE +#define IID_IDirectInput7 IID_IDirectInput7W +#define IDirectInput7 IDirectInput7W +#define IDirectInput7Vtbl IDirectInput7WVtbl +#else +#define IID_IDirectInput7 IID_IDirectInput7A +#define IDirectInput7 IDirectInput7A +#define IDirectInput7Vtbl IDirectInput7AVtbl +#endif +typedef struct IDirectInput7 *LPDIRECTINPUT7; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectInput7_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectInput7_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectInput7_Release(p) (p)->lpVtbl->Release(p) +#define IDirectInput7_CreateDevice(p,a,b,c) (p)->lpVtbl->CreateDevice(p,a,b,c) +#define IDirectInput7_EnumDevices(p,a,b,c,d) (p)->lpVtbl->EnumDevices(p,a,b,c,d) +#define IDirectInput7_GetDeviceStatus(p,a) (p)->lpVtbl->GetDeviceStatus(p,a) +#define IDirectInput7_RunControlPanel(p,a,b) (p)->lpVtbl->RunControlPanel(p,a,b) +#define IDirectInput7_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b) +#define IDirectInput7_FindDevice(p,a,b,c) (p)->lpVtbl->FindDevice(p,a,b,c) +#define IDirectInput7_CreateDeviceEx(p,a,b,c,d) (p)->lpVtbl->CreateDeviceEx(p,a,b,c,d) +#else +#define IDirectInput7_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectInput7_AddRef(p) (p)->AddRef() +#define IDirectInput7_Release(p) (p)->Release() +#define IDirectInput7_CreateDevice(p,a,b,c) (p)->CreateDevice(a,b,c) +#define IDirectInput7_EnumDevices(p,a,b,c,d) (p)->EnumDevices(a,b,c,d) +#define IDirectInput7_GetDeviceStatus(p,a) (p)->GetDeviceStatus(a) +#define IDirectInput7_RunControlPanel(p,a,b) (p)->RunControlPanel(a,b) +#define IDirectInput7_Initialize(p,a,b) (p)->Initialize(a,b) +#define IDirectInput7_FindDevice(p,a,b,c) (p)->FindDevice(a,b,c) +#define IDirectInput7_CreateDeviceEx(p,a,b,c,d) (p)->CreateDeviceEx(a,b,c,d) +#endif + +#if(DIRECTINPUT_VERSION >= 0x0800) +#undef INTERFACE +#define INTERFACE IDirectInput8W + +DECLARE_INTERFACE_(IDirectInput8W, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInput8W methods ***/ + STDMETHOD(CreateDevice)(THIS_ REFGUID,LPDIRECTINPUTDEVICE8W *,LPUNKNOWN) PURE; + STDMETHOD(EnumDevices)(THIS_ DWORD,LPDIENUMDEVICESCALLBACKW,LPVOID,DWORD) PURE; + STDMETHOD(GetDeviceStatus)(THIS_ REFGUID) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD) PURE; + STDMETHOD(FindDevice)(THIS_ REFGUID,LPCWSTR,LPGUID) PURE; + STDMETHOD(EnumDevicesBySemantics)(THIS_ LPCWSTR,LPDIACTIONFORMATW,LPDIENUMDEVICESBYSEMANTICSCBW,LPVOID,DWORD) PURE; + STDMETHOD(ConfigureDevices)(THIS_ LPDICONFIGUREDEVICESCALLBACK,LPDICONFIGUREDEVICESPARAMSW,DWORD,LPVOID) PURE; +}; + +typedef struct IDirectInput8W *LPDIRECTINPUT8W; + +#undef INTERFACE +#define INTERFACE IDirectInput8A + +DECLARE_INTERFACE_(IDirectInput8A, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInput8A methods ***/ + STDMETHOD(CreateDevice)(THIS_ REFGUID,LPDIRECTINPUTDEVICE8A *,LPUNKNOWN) PURE; + STDMETHOD(EnumDevices)(THIS_ DWORD,LPDIENUMDEVICESCALLBACKA,LPVOID,DWORD) PURE; + STDMETHOD(GetDeviceStatus)(THIS_ REFGUID) PURE; + STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD) PURE; + STDMETHOD(FindDevice)(THIS_ REFGUID,LPCSTR,LPGUID) PURE; + STDMETHOD(EnumDevicesBySemantics)(THIS_ LPCSTR,LPDIACTIONFORMATA,LPDIENUMDEVICESBYSEMANTICSCBA,LPVOID,DWORD) PURE; + STDMETHOD(ConfigureDevices)(THIS_ LPDICONFIGUREDEVICESCALLBACK,LPDICONFIGUREDEVICESPARAMSA,DWORD,LPVOID) PURE; +}; + +typedef struct IDirectInput8A *LPDIRECTINPUT8A; + +#ifdef UNICODE +#define IID_IDirectInput8 IID_IDirectInput8W +#define IDirectInput8 IDirectInput8W +#define IDirectInput8Vtbl IDirectInput8WVtbl +#else +#define IID_IDirectInput8 IID_IDirectInput8A +#define IDirectInput8 IDirectInput8A +#define IDirectInput8Vtbl IDirectInput8AVtbl +#endif +typedef struct IDirectInput8 *LPDIRECTINPUT8; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectInput8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectInput8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectInput8_Release(p) (p)->lpVtbl->Release(p) +#define IDirectInput8_CreateDevice(p,a,b,c) (p)->lpVtbl->CreateDevice(p,a,b,c) +#define IDirectInput8_EnumDevices(p,a,b,c,d) (p)->lpVtbl->EnumDevices(p,a,b,c,d) +#define IDirectInput8_GetDeviceStatus(p,a) (p)->lpVtbl->GetDeviceStatus(p,a) +#define IDirectInput8_RunControlPanel(p,a,b) (p)->lpVtbl->RunControlPanel(p,a,b) +#define IDirectInput8_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b) +#define IDirectInput8_FindDevice(p,a,b,c) (p)->lpVtbl->FindDevice(p,a,b,c) +#define IDirectInput8_EnumDevicesBySemantics(p,a,b,c,d,e) (p)->lpVtbl->EnumDevicesBySemantics(p,a,b,c,d,e) +#define IDirectInput8_ConfigureDevices(p,a,b,c,d) (p)->lpVtbl->ConfigureDevices(p,a,b,c,d) +#else +#define IDirectInput8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectInput8_AddRef(p) (p)->AddRef() +#define IDirectInput8_Release(p) (p)->Release() +#define IDirectInput8_CreateDevice(p,a,b,c) (p)->CreateDevice(a,b,c) +#define IDirectInput8_EnumDevices(p,a,b,c,d) (p)->EnumDevices(a,b,c,d) +#define IDirectInput8_GetDeviceStatus(p,a) (p)->GetDeviceStatus(a) +#define IDirectInput8_RunControlPanel(p,a,b) (p)->RunControlPanel(a,b) +#define IDirectInput8_Initialize(p,a,b) (p)->Initialize(a,b) +#define IDirectInput8_FindDevice(p,a,b,c) (p)->FindDevice(a,b,c) +#define IDirectInput8_EnumDevicesBySemantics(p,a,b,c,d,e) (p)->EnumDevicesBySemantics(a,b,c,d,e) +#define IDirectInput8_ConfigureDevices(p,a,b,c,d) (p)->ConfigureDevices(a,b,c,d) +#endif +#endif /* DIRECTINPUT_VERSION >= 0x0800 */ + +#if DIRECTINPUT_VERSION > 0x0700 + +extern HRESULT WINAPI DirectInput8Create(HINSTANCE hinst, DWORD dwVersion, REFIID riidltf, LPVOID *ppvOut, LPUNKNOWN punkOuter); + +#else +extern HRESULT WINAPI DirectInputCreateA(HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPUTA *ppDI, LPUNKNOWN punkOuter); +extern HRESULT WINAPI DirectInputCreateW(HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPUTW *ppDI, LPUNKNOWN punkOuter); +#ifdef UNICODE +#define DirectInputCreate DirectInputCreateW +#else +#define DirectInputCreate DirectInputCreateA +#endif // !UNICODE + +extern HRESULT WINAPI DirectInputCreateEx(HINSTANCE hinst, DWORD dwVersion, REFIID riidltf, LPVOID *ppvOut, LPUNKNOWN punkOuter); + +#endif /* DIRECTINPUT_VERSION > 0x700 */ + +#endif /* DIJ_RINGZERO */ + + +/**************************************************************************** + * + * Return Codes + * + ****************************************************************************/ + +/* + * The operation completed successfully. + */ +#define DI_OK S_OK + +/* + * The device exists but is not currently attached. + */ +#define DI_NOTATTACHED S_FALSE + +/* + * The device buffer overflowed. Some input was lost. + */ +#define DI_BUFFEROVERFLOW S_FALSE + +/* + * The change in device properties had no effect. + */ +#define DI_PROPNOEFFECT S_FALSE + +/* + * The operation had no effect. + */ +#define DI_NOEFFECT S_FALSE + +/* + * The device is a polled device. As a result, device buffering + * will not collect any data and event notifications will not be + * signalled until GetDeviceState is called. + */ +#define DI_POLLEDDEVICE ((HRESULT)0x00000002L) + +/* + * The parameters of the effect were successfully updated by + * IDirectInputEffect::SetParameters, but the effect was not + * downloaded because the device is not exclusively acquired + * or because the DIEP_NODOWNLOAD flag was passed. + */ +#define DI_DOWNLOADSKIPPED ((HRESULT)0x00000003L) + +/* + * The parameters of the effect were successfully updated by + * IDirectInputEffect::SetParameters, but in order to change + * the parameters, the effect needed to be restarted. + */ +#define DI_EFFECTRESTARTED ((HRESULT)0x00000004L) + +/* + * The parameters of the effect were successfully updated by + * IDirectInputEffect::SetParameters, but some of them were + * beyond the capabilities of the device and were truncated. + */ +#define DI_TRUNCATED ((HRESULT)0x00000008L) + +/* + * The settings have been successfully applied but could not be + * persisted. + */ +#define DI_SETTINGSNOTSAVED ((HRESULT)0x0000000BL) + +/* + * Equal to DI_EFFECTRESTARTED | DI_TRUNCATED. + */ +#define DI_TRUNCATEDANDRESTARTED ((HRESULT)0x0000000CL) + +/* + * A SUCCESS code indicating that settings cannot be modified. + */ +#define DI_WRITEPROTECT ((HRESULT)0x00000013L) + +/* + * The application requires a newer version of DirectInput. + */ +#define DIERR_OLDDIRECTINPUTVERSION \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_OLD_WIN_VERSION) + +/* + * The application was written for an unsupported prerelease version + * of DirectInput. + */ +#define DIERR_BETADIRECTINPUTVERSION \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_RMODE_APP) + +/* + * The object could not be created due to an incompatible driver version + * or mismatched or incomplete driver components. + */ +#define DIERR_BADDRIVERVER \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_BAD_DRIVER_LEVEL) + +/* + * The device or device instance or effect is not registered with DirectInput. + */ +#define DIERR_DEVICENOTREG REGDB_E_CLASSNOTREG + +/* + * The requested object does not exist. + */ +#define DIERR_NOTFOUND \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_FILE_NOT_FOUND) + +/* + * The requested object does not exist. + */ +#define DIERR_OBJECTNOTFOUND \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_FILE_NOT_FOUND) + +/* + * An invalid parameter was passed to the returning function, + * or the object was not in a state that admitted the function + * to be called. + */ +#define DIERR_INVALIDPARAM E_INVALIDARG + +/* + * The specified interface is not supported by the object + */ +#define DIERR_NOINTERFACE E_NOINTERFACE + +/* + * An undetermined error occured inside the DInput subsystem + */ +#define DIERR_GENERIC E_FAIL + +/* + * The DInput subsystem couldn't allocate sufficient memory to complete the + * caller's request. + */ +#define DIERR_OUTOFMEMORY E_OUTOFMEMORY + +/* + * The function called is not supported at this time + */ +#define DIERR_UNSUPPORTED E_NOTIMPL + +/* + * This object has not been initialized + */ +#define DIERR_NOTINITIALIZED \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_NOT_READY) + +/* + * This object is already initialized + */ +#define DIERR_ALREADYINITIALIZED \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_ALREADY_INITIALIZED) + +/* + * This object does not support aggregation + */ +#define DIERR_NOAGGREGATION CLASS_E_NOAGGREGATION + +/* + * Another app has a higher priority level, preventing this call from + * succeeding. + */ +#define DIERR_OTHERAPPHASPRIO E_ACCESSDENIED + +/* + * Access to the device has been lost. It must be re-acquired. + */ +#define DIERR_INPUTLOST \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_READ_FAULT) + +/* + * The operation cannot be performed while the device is acquired. + */ +#define DIERR_ACQUIRED \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_BUSY) + +/* + * The operation cannot be performed unless the device is acquired. + */ +#define DIERR_NOTACQUIRED \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_INVALID_ACCESS) + +/* + * The specified property cannot be changed. + */ +#define DIERR_READONLY E_ACCESSDENIED + +/* + * The device already has an event notification associated with it. + */ +#define DIERR_HANDLEEXISTS E_ACCESSDENIED + +/* + * Data is not yet available. + */ +#ifndef E_PENDING +#define E_PENDING 0x8000000AL +#endif + +/* + * Unable to IDirectInputJoyConfig_Acquire because the user + * does not have sufficient privileges to change the joystick + * configuration. + */ +#define DIERR_INSUFFICIENTPRIVS 0x80040200L + +/* + * The device is full. + */ +#define DIERR_DEVICEFULL 0x80040201L + +/* + * Not all the requested information fit into the buffer. + */ +#define DIERR_MOREDATA 0x80040202L + +/* + * The effect is not downloaded. + */ +#define DIERR_NOTDOWNLOADED 0x80040203L + +/* + * The device cannot be reinitialized because there are still effects + * attached to it. + */ +#define DIERR_HASEFFECTS 0x80040204L + +/* + * The operation cannot be performed unless the device is acquired + * in DISCL_EXCLUSIVE mode. + */ +#define DIERR_NOTEXCLUSIVEACQUIRED 0x80040205L + +/* + * The effect could not be downloaded because essential information + * is missing. For example, no axes have been associated with the + * effect, or no type-specific information has been created. + */ +#define DIERR_INCOMPLETEEFFECT 0x80040206L + +/* + * Attempted to read buffered device data from a device that is + * not buffered. + */ +#define DIERR_NOTBUFFERED 0x80040207L + +/* + * An attempt was made to modify parameters of an effect while it is + * playing. Not all hardware devices support altering the parameters + * of an effect while it is playing. + */ +#define DIERR_EFFECTPLAYING 0x80040208L + +/* + * The operation could not be completed because the device is not + * plugged in. + */ +#define DIERR_UNPLUGGED 0x80040209L + +/* + * SendDeviceData failed because more information was requested + * to be sent than can be sent to the device. Some devices have + * restrictions on how much data can be sent to them. (For example, + * there might be a limit on the number of buttons that can be + * pressed at once.) + */ +#define DIERR_REPORTFULL 0x8004020AL + + +/* + * A mapper file function failed because reading or writing the user or IHV + * settings file failed. + */ +#define DIERR_MAPFILEFAIL 0x8004020BL + + +/*--- DINPUT Mapper Definitions: New for Dx8 ---*/ + + +/*--- Keyboard + Physical Keyboard Device ---*/ + +#define DIKEYBOARD_ESCAPE 0x81000401 +#define DIKEYBOARD_1 0x81000402 +#define DIKEYBOARD_2 0x81000403 +#define DIKEYBOARD_3 0x81000404 +#define DIKEYBOARD_4 0x81000405 +#define DIKEYBOARD_5 0x81000406 +#define DIKEYBOARD_6 0x81000407 +#define DIKEYBOARD_7 0x81000408 +#define DIKEYBOARD_8 0x81000409 +#define DIKEYBOARD_9 0x8100040A +#define DIKEYBOARD_0 0x8100040B +#define DIKEYBOARD_MINUS 0x8100040C /* - on main keyboard */ +#define DIKEYBOARD_EQUALS 0x8100040D +#define DIKEYBOARD_BACK 0x8100040E /* backspace */ +#define DIKEYBOARD_TAB 0x8100040F +#define DIKEYBOARD_Q 0x81000410 +#define DIKEYBOARD_W 0x81000411 +#define DIKEYBOARD_E 0x81000412 +#define DIKEYBOARD_R 0x81000413 +#define DIKEYBOARD_T 0x81000414 +#define DIKEYBOARD_Y 0x81000415 +#define DIKEYBOARD_U 0x81000416 +#define DIKEYBOARD_I 0x81000417 +#define DIKEYBOARD_O 0x81000418 +#define DIKEYBOARD_P 0x81000419 +#define DIKEYBOARD_LBRACKET 0x8100041A +#define DIKEYBOARD_RBRACKET 0x8100041B +#define DIKEYBOARD_RETURN 0x8100041C /* Enter on main keyboard */ +#define DIKEYBOARD_LCONTROL 0x8100041D +#define DIKEYBOARD_A 0x8100041E +#define DIKEYBOARD_S 0x8100041F +#define DIKEYBOARD_D 0x81000420 +#define DIKEYBOARD_F 0x81000421 +#define DIKEYBOARD_G 0x81000422 +#define DIKEYBOARD_H 0x81000423 +#define DIKEYBOARD_J 0x81000424 +#define DIKEYBOARD_K 0x81000425 +#define DIKEYBOARD_L 0x81000426 +#define DIKEYBOARD_SEMICOLON 0x81000427 +#define DIKEYBOARD_APOSTROPHE 0x81000428 +#define DIKEYBOARD_GRAVE 0x81000429 /* accent grave */ +#define DIKEYBOARD_LSHIFT 0x8100042A +#define DIKEYBOARD_BACKSLASH 0x8100042B +#define DIKEYBOARD_Z 0x8100042C +#define DIKEYBOARD_X 0x8100042D +#define DIKEYBOARD_C 0x8100042E +#define DIKEYBOARD_V 0x8100042F +#define DIKEYBOARD_B 0x81000430 +#define DIKEYBOARD_N 0x81000431 +#define DIKEYBOARD_M 0x81000432 +#define DIKEYBOARD_COMMA 0x81000433 +#define DIKEYBOARD_PERIOD 0x81000434 /* . on main keyboard */ +#define DIKEYBOARD_SLASH 0x81000435 /* / on main keyboard */ +#define DIKEYBOARD_RSHIFT 0x81000436 +#define DIKEYBOARD_MULTIPLY 0x81000437 /* * on numeric keypad */ +#define DIKEYBOARD_LMENU 0x81000438 /* left Alt */ +#define DIKEYBOARD_SPACE 0x81000439 +#define DIKEYBOARD_CAPITAL 0x8100043A +#define DIKEYBOARD_F1 0x8100043B +#define DIKEYBOARD_F2 0x8100043C +#define DIKEYBOARD_F3 0x8100043D +#define DIKEYBOARD_F4 0x8100043E +#define DIKEYBOARD_F5 0x8100043F +#define DIKEYBOARD_F6 0x81000440 +#define DIKEYBOARD_F7 0x81000441 +#define DIKEYBOARD_F8 0x81000442 +#define DIKEYBOARD_F9 0x81000443 +#define DIKEYBOARD_F10 0x81000444 +#define DIKEYBOARD_NUMLOCK 0x81000445 +#define DIKEYBOARD_SCROLL 0x81000446 /* Scroll Lock */ +#define DIKEYBOARD_NUMPAD7 0x81000447 +#define DIKEYBOARD_NUMPAD8 0x81000448 +#define DIKEYBOARD_NUMPAD9 0x81000449 +#define DIKEYBOARD_SUBTRACT 0x8100044A /* - on numeric keypad */ +#define DIKEYBOARD_NUMPAD4 0x8100044B +#define DIKEYBOARD_NUMPAD5 0x8100044C +#define DIKEYBOARD_NUMPAD6 0x8100044D +#define DIKEYBOARD_ADD 0x8100044E /* + on numeric keypad */ +#define DIKEYBOARD_NUMPAD1 0x8100044F +#define DIKEYBOARD_NUMPAD2 0x81000450 +#define DIKEYBOARD_NUMPAD3 0x81000451 +#define DIKEYBOARD_NUMPAD0 0x81000452 +#define DIKEYBOARD_DECIMAL 0x81000453 /* . on numeric keypad */ +#define DIKEYBOARD_OEM_102 0x81000456 /* <> or \| on RT 102-key keyboard (Non-U.S.) */ +#define DIKEYBOARD_F11 0x81000457 +#define DIKEYBOARD_F12 0x81000458 +#define DIKEYBOARD_F13 0x81000464 /* (NEC PC98) */ +#define DIKEYBOARD_F14 0x81000465 /* (NEC PC98) */ +#define DIKEYBOARD_F15 0x81000466 /* (NEC PC98) */ +#define DIKEYBOARD_KANA 0x81000470 /* (Japanese keyboard) */ +#define DIKEYBOARD_ABNT_C1 0x81000473 /* /? on Brazilian keyboard */ +#define DIKEYBOARD_CONVERT 0x81000479 /* (Japanese keyboard) */ +#define DIKEYBOARD_NOCONVERT 0x8100047B /* (Japanese keyboard) */ +#define DIKEYBOARD_YEN 0x8100047D /* (Japanese keyboard) */ +#define DIKEYBOARD_ABNT_C2 0x8100047E /* Numpad . on Brazilian keyboard */ +#define DIKEYBOARD_NUMPADEQUALS 0x8100048D /* = on numeric keypad (NEC PC98) */ +#define DIKEYBOARD_PREVTRACK 0x81000490 /* Previous Track (DIK_CIRCUMFLEX on Japanese keyboard) */ +#define DIKEYBOARD_AT 0x81000491 /* (NEC PC98) */ +#define DIKEYBOARD_COLON 0x81000492 /* (NEC PC98) */ +#define DIKEYBOARD_UNDERLINE 0x81000493 /* (NEC PC98) */ +#define DIKEYBOARD_KANJI 0x81000494 /* (Japanese keyboard) */ +#define DIKEYBOARD_STOP 0x81000495 /* (NEC PC98) */ +#define DIKEYBOARD_AX 0x81000496 /* (Japan AX) */ +#define DIKEYBOARD_UNLABELED 0x81000497 /* (J3100) */ +#define DIKEYBOARD_NEXTTRACK 0x81000499 /* Next Track */ +#define DIKEYBOARD_NUMPADENTER 0x8100049C /* Enter on numeric keypad */ +#define DIKEYBOARD_RCONTROL 0x8100049D +#define DIKEYBOARD_MUTE 0x810004A0 /* Mute */ +#define DIKEYBOARD_CALCULATOR 0x810004A1 /* Calculator */ +#define DIKEYBOARD_PLAYPAUSE 0x810004A2 /* Play / Pause */ +#define DIKEYBOARD_MEDIASTOP 0x810004A4 /* Media Stop */ +#define DIKEYBOARD_VOLUMEDOWN 0x810004AE /* Volume - */ +#define DIKEYBOARD_VOLUMEUP 0x810004B0 /* Volume + */ +#define DIKEYBOARD_WEBHOME 0x810004B2 /* Web home */ +#define DIKEYBOARD_NUMPADCOMMA 0x810004B3 /* , on numeric keypad (NEC PC98) */ +#define DIKEYBOARD_DIVIDE 0x810004B5 /* / on numeric keypad */ +#define DIKEYBOARD_SYSRQ 0x810004B7 +#define DIKEYBOARD_RMENU 0x810004B8 /* right Alt */ +#define DIKEYBOARD_PAUSE 0x810004C5 /* Pause */ +#define DIKEYBOARD_HOME 0x810004C7 /* Home on arrow keypad */ +#define DIKEYBOARD_UP 0x810004C8 /* UpArrow on arrow keypad */ +#define DIKEYBOARD_PRIOR 0x810004C9 /* PgUp on arrow keypad */ +#define DIKEYBOARD_LEFT 0x810004CB /* LeftArrow on arrow keypad */ +#define DIKEYBOARD_RIGHT 0x810004CD /* RightArrow on arrow keypad */ +#define DIKEYBOARD_END 0x810004CF /* End on arrow keypad */ +#define DIKEYBOARD_DOWN 0x810004D0 /* DownArrow on arrow keypad */ +#define DIKEYBOARD_NEXT 0x810004D1 /* PgDn on arrow keypad */ +#define DIKEYBOARD_INSERT 0x810004D2 /* Insert on arrow keypad */ +#define DIKEYBOARD_DELETE 0x810004D3 /* Delete on arrow keypad */ +#define DIKEYBOARD_LWIN 0x810004DB /* Left Windows key */ +#define DIKEYBOARD_RWIN 0x810004DC /* Right Windows key */ +#define DIKEYBOARD_APPS 0x810004DD /* AppMenu key */ +#define DIKEYBOARD_POWER 0x810004DE /* System Power */ +#define DIKEYBOARD_SLEEP 0x810004DF /* System Sleep */ +#define DIKEYBOARD_WAKE 0x810004E3 /* System Wake */ +#define DIKEYBOARD_WEBSEARCH 0x810004E5 /* Web Search */ +#define DIKEYBOARD_WEBFAVORITES 0x810004E6 /* Web Favorites */ +#define DIKEYBOARD_WEBREFRESH 0x810004E7 /* Web Refresh */ +#define DIKEYBOARD_WEBSTOP 0x810004E8 /* Web Stop */ +#define DIKEYBOARD_WEBFORWARD 0x810004E9 /* Web Forward */ +#define DIKEYBOARD_WEBBACK 0x810004EA /* Web Back */ +#define DIKEYBOARD_MYCOMPUTER 0x810004EB /* My Computer */ +#define DIKEYBOARD_MAIL 0x810004EC /* Mail */ +#define DIKEYBOARD_MEDIASELECT 0x810004ED /* Media Select */ + + +/*--- MOUSE + Physical Mouse Device ---*/ + +#define DIMOUSE_XAXISAB (0x82000200 |DIMOFS_X ) /* X Axis-absolute: Some mice natively report absolute coordinates */ +#define DIMOUSE_YAXISAB (0x82000200 |DIMOFS_Y ) /* Y Axis-absolute: Some mice natively report absolute coordinates */ +#define DIMOUSE_XAXIS (0x82000300 |DIMOFS_X ) /* X Axis */ +#define DIMOUSE_YAXIS (0x82000300 |DIMOFS_Y ) /* Y Axis */ +#define DIMOUSE_WHEEL (0x82000300 |DIMOFS_Z ) /* Z Axis */ +#define DIMOUSE_BUTTON0 (0x82000400 |DIMOFS_BUTTON0) /* Button 0 */ +#define DIMOUSE_BUTTON1 (0x82000400 |DIMOFS_BUTTON1) /* Button 1 */ +#define DIMOUSE_BUTTON2 (0x82000400 |DIMOFS_BUTTON2) /* Button 2 */ +#define DIMOUSE_BUTTON3 (0x82000400 |DIMOFS_BUTTON3) /* Button 3 */ +#define DIMOUSE_BUTTON4 (0x82000400 |DIMOFS_BUTTON4) /* Button 4 */ +#define DIMOUSE_BUTTON5 (0x82000400 |DIMOFS_BUTTON5) /* Button 5 */ +#define DIMOUSE_BUTTON6 (0x82000400 |DIMOFS_BUTTON6) /* Button 6 */ +#define DIMOUSE_BUTTON7 (0x82000400 |DIMOFS_BUTTON7) /* Button 7 */ + + +/*--- VOICE + Physical Dplay Voice Device ---*/ + +#define DIVOICE_CHANNEL1 0x83000401 +#define DIVOICE_CHANNEL2 0x83000402 +#define DIVOICE_CHANNEL3 0x83000403 +#define DIVOICE_CHANNEL4 0x83000404 +#define DIVOICE_CHANNEL5 0x83000405 +#define DIVOICE_CHANNEL6 0x83000406 +#define DIVOICE_CHANNEL7 0x83000407 +#define DIVOICE_CHANNEL8 0x83000408 +#define DIVOICE_TEAM 0x83000409 +#define DIVOICE_ALL 0x8300040A +#define DIVOICE_RECORDMUTE 0x8300040B +#define DIVOICE_PLAYBACKMUTE 0x8300040C +#define DIVOICE_TRANSMIT 0x8300040D + +#define DIVOICE_VOICECOMMAND 0x83000410 + + +/*--- Driving Simulator - Racing + Vehicle control is primary objective ---*/ +#define DIVIRTUAL_DRIVING_RACE 0x01000000 +#define DIAXIS_DRIVINGR_STEER 0x01008A01 /* Steering */ +#define DIAXIS_DRIVINGR_ACCELERATE 0x01039202 /* Accelerate */ +#define DIAXIS_DRIVINGR_BRAKE 0x01041203 /* Brake-Axis */ +#define DIBUTTON_DRIVINGR_SHIFTUP 0x01000C01 /* Shift to next higher gear */ +#define DIBUTTON_DRIVINGR_SHIFTDOWN 0x01000C02 /* Shift to next lower gear */ +#define DIBUTTON_DRIVINGR_VIEW 0x01001C03 /* Cycle through view options */ +#define DIBUTTON_DRIVINGR_MENU 0x010004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIAXIS_DRIVINGR_ACCEL_AND_BRAKE 0x01014A04 /* Some devices combine accelerate and brake in a single axis */ +#define DIHATSWITCH_DRIVINGR_GLANCE 0x01004601 /* Look around */ +#define DIBUTTON_DRIVINGR_BRAKE 0x01004C04 /* Brake-button */ +#define DIBUTTON_DRIVINGR_DASHBOARD 0x01004405 /* Select next dashboard option */ +#define DIBUTTON_DRIVINGR_AIDS 0x01004406 /* Driver correction aids */ +#define DIBUTTON_DRIVINGR_MAP 0x01004407 /* Display Driving Map */ +#define DIBUTTON_DRIVINGR_BOOST 0x01004408 /* Turbo Boost */ +#define DIBUTTON_DRIVINGR_PIT 0x01004409 /* Pit stop notification */ +#define DIBUTTON_DRIVINGR_ACCELERATE_LINK 0x0103D4E0 /* Fallback Accelerate button */ +#define DIBUTTON_DRIVINGR_STEER_LEFT_LINK 0x0100CCE4 /* Fallback Steer Left button */ +#define DIBUTTON_DRIVINGR_STEER_RIGHT_LINK 0x0100CCEC /* Fallback Steer Right button */ +#define DIBUTTON_DRIVINGR_GLANCE_LEFT_LINK 0x0107C4E4 /* Fallback Glance Left button */ +#define DIBUTTON_DRIVINGR_GLANCE_RIGHT_LINK 0x0107C4EC /* Fallback Glance Right button */ +#define DIBUTTON_DRIVINGR_DEVICE 0x010044FE /* Show input device and controls */ +#define DIBUTTON_DRIVINGR_PAUSE 0x010044FC /* Start / Pause / Restart game */ + +/*--- Driving Simulator - Combat + Combat from within a vehicle is primary objective ---*/ +#define DIVIRTUAL_DRIVING_COMBAT 0x02000000 +#define DIAXIS_DRIVINGC_STEER 0x02008A01 /* Steering */ +#define DIAXIS_DRIVINGC_ACCELERATE 0x02039202 /* Accelerate */ +#define DIAXIS_DRIVINGC_BRAKE 0x02041203 /* Brake-axis */ +#define DIBUTTON_DRIVINGC_FIRE 0x02000C01 /* Fire */ +#define DIBUTTON_DRIVINGC_WEAPONS 0x02000C02 /* Select next weapon */ +#define DIBUTTON_DRIVINGC_TARGET 0x02000C03 /* Select next available target */ +#define DIBUTTON_DRIVINGC_MENU 0x020004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIAXIS_DRIVINGC_ACCEL_AND_BRAKE 0x02014A04 /* Some devices combine accelerate and brake in a single axis */ +#define DIHATSWITCH_DRIVINGC_GLANCE 0x02004601 /* Look around */ +#define DIBUTTON_DRIVINGC_SHIFTUP 0x02004C04 /* Shift to next higher gear */ +#define DIBUTTON_DRIVINGC_SHIFTDOWN 0x02004C05 /* Shift to next lower gear */ +#define DIBUTTON_DRIVINGC_DASHBOARD 0x02004406 /* Select next dashboard option */ +#define DIBUTTON_DRIVINGC_AIDS 0x02004407 /* Driver correction aids */ +#define DIBUTTON_DRIVINGC_BRAKE 0x02004C08 /* Brake-button */ +#define DIBUTTON_DRIVINGC_FIRESECONDARY 0x02004C09 /* Alternative fire button */ +#define DIBUTTON_DRIVINGC_ACCELERATE_LINK 0x0203D4E0 /* Fallback Accelerate button */ +#define DIBUTTON_DRIVINGC_STEER_LEFT_LINK 0x0200CCE4 /* Fallback Steer Left button */ +#define DIBUTTON_DRIVINGC_STEER_RIGHT_LINK 0x0200CCEC /* Fallback Steer Right button */ +#define DIBUTTON_DRIVINGC_GLANCE_LEFT_LINK 0x0207C4E4 /* Fallback Glance Left button */ +#define DIBUTTON_DRIVINGC_GLANCE_RIGHT_LINK 0x0207C4EC /* Fallback Glance Right button */ +#define DIBUTTON_DRIVINGC_DEVICE 0x020044FE /* Show input device and controls */ +#define DIBUTTON_DRIVINGC_PAUSE 0x020044FC /* Start / Pause / Restart game */ + +/*--- Driving Simulator - Tank + Combat from withing a tank is primary objective ---*/ +#define DIVIRTUAL_DRIVING_TANK 0x03000000 +#define DIAXIS_DRIVINGT_STEER 0x03008A01 /* Turn tank left / right */ +#define DIAXIS_DRIVINGT_BARREL 0x03010202 /* Raise / lower barrel */ +#define DIAXIS_DRIVINGT_ACCELERATE 0x03039203 /* Accelerate */ +#define DIAXIS_DRIVINGT_ROTATE 0x03020204 /* Turn barrel left / right */ +#define DIBUTTON_DRIVINGT_FIRE 0x03000C01 /* Fire */ +#define DIBUTTON_DRIVINGT_WEAPONS 0x03000C02 /* Select next weapon */ +#define DIBUTTON_DRIVINGT_TARGET 0x03000C03 /* Selects next available target */ +#define DIBUTTON_DRIVINGT_MENU 0x030004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_DRIVINGT_GLANCE 0x03004601 /* Look around */ +#define DIAXIS_DRIVINGT_BRAKE 0x03045205 /* Brake-axis */ +#define DIAXIS_DRIVINGT_ACCEL_AND_BRAKE 0x03014A06 /* Some devices combine accelerate and brake in a single axis */ +#define DIBUTTON_DRIVINGT_VIEW 0x03005C04 /* Cycle through view options */ +#define DIBUTTON_DRIVINGT_DASHBOARD 0x03005C05 /* Select next dashboard option */ +#define DIBUTTON_DRIVINGT_BRAKE 0x03004C06 /* Brake-button */ +#define DIBUTTON_DRIVINGT_FIRESECONDARY 0x03004C07 /* Alternative fire button */ +#define DIBUTTON_DRIVINGT_ACCELERATE_LINK 0x0303D4E0 /* Fallback Accelerate button */ +#define DIBUTTON_DRIVINGT_STEER_LEFT_LINK 0x0300CCE4 /* Fallback Steer Left button */ +#define DIBUTTON_DRIVINGT_STEER_RIGHT_LINK 0x0300CCEC /* Fallback Steer Right button */ +#define DIBUTTON_DRIVINGT_BARREL_UP_LINK 0x030144E0 /* Fallback Barrel up button */ +#define DIBUTTON_DRIVINGT_BARREL_DOWN_LINK 0x030144E8 /* Fallback Barrel down button */ +#define DIBUTTON_DRIVINGT_ROTATE_LEFT_LINK 0x030244E4 /* Fallback Rotate left button */ +#define DIBUTTON_DRIVINGT_ROTATE_RIGHT_LINK 0x030244EC /* Fallback Rotate right button */ +#define DIBUTTON_DRIVINGT_GLANCE_LEFT_LINK 0x0307C4E4 /* Fallback Glance Left button */ +#define DIBUTTON_DRIVINGT_GLANCE_RIGHT_LINK 0x0307C4EC /* Fallback Glance Right button */ +#define DIBUTTON_DRIVINGT_DEVICE 0x030044FE /* Show input device and controls */ +#define DIBUTTON_DRIVINGT_PAUSE 0x030044FC /* Start / Pause / Restart game */ + +/*--- Flight Simulator - Civilian + Plane control is the primary objective ---*/ +#define DIVIRTUAL_FLYING_CIVILIAN 0x04000000 +#define DIAXIS_FLYINGC_BANK 0x04008A01 /* Roll ship left / right */ +#define DIAXIS_FLYINGC_PITCH 0x04010A02 /* Nose up / down */ +#define DIAXIS_FLYINGC_THROTTLE 0x04039203 /* Throttle */ +#define DIBUTTON_FLYINGC_VIEW 0x04002401 /* Cycle through view options */ +#define DIBUTTON_FLYINGC_DISPLAY 0x04002402 /* Select next dashboard / heads up display option */ +#define DIBUTTON_FLYINGC_GEAR 0x04002C03 /* Gear up / down */ +#define DIBUTTON_FLYINGC_MENU 0x040004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_FLYINGC_GLANCE 0x04004601 /* Look around */ +#define DIAXIS_FLYINGC_BRAKE 0x04046A04 /* Apply Brake */ +#define DIAXIS_FLYINGC_RUDDER 0x04025205 /* Yaw ship left/right */ +#define DIAXIS_FLYINGC_FLAPS 0x04055A06 /* Flaps */ +#define DIBUTTON_FLYINGC_FLAPSUP 0x04006404 /* Increment stepping up until fully retracted */ +#define DIBUTTON_FLYINGC_FLAPSDOWN 0x04006405 /* Decrement stepping down until fully extended */ +#define DIBUTTON_FLYINGC_BRAKE_LINK 0x04046CE0 /* Fallback brake button */ +#define DIBUTTON_FLYINGC_FASTER_LINK 0x0403D4E0 /* Fallback throttle up button */ +#define DIBUTTON_FLYINGC_SLOWER_LINK 0x0403D4E8 /* Fallback throttle down button */ +#define DIBUTTON_FLYINGC_GLANCE_LEFT_LINK 0x0407C4E4 /* Fallback Glance Left button */ +#define DIBUTTON_FLYINGC_GLANCE_RIGHT_LINK 0x0407C4EC /* Fallback Glance Right button */ +#define DIBUTTON_FLYINGC_GLANCE_UP_LINK 0x0407C4E0 /* Fallback Glance Up button */ +#define DIBUTTON_FLYINGC_GLANCE_DOWN_LINK 0x0407C4E8 /* Fallback Glance Down button */ +#define DIBUTTON_FLYINGC_DEVICE 0x040044FE /* Show input device and controls */ +#define DIBUTTON_FLYINGC_PAUSE 0x040044FC /* Start / Pause / Restart game */ + +/*--- Flight Simulator - Military + Aerial combat is the primary objective ---*/ +#define DIVIRTUAL_FLYING_MILITARY 0x05000000 +#define DIAXIS_FLYINGM_BANK 0x05008A01 /* Bank - Roll ship left / right */ +#define DIAXIS_FLYINGM_PITCH 0x05010A02 /* Pitch - Nose up / down */ +#define DIAXIS_FLYINGM_THROTTLE 0x05039203 /* Throttle - faster / slower */ +#define DIBUTTON_FLYINGM_FIRE 0x05000C01 /* Fire */ +#define DIBUTTON_FLYINGM_WEAPONS 0x05000C02 /* Select next weapon */ +#define DIBUTTON_FLYINGM_TARGET 0x05000C03 /* Selects next available target */ +#define DIBUTTON_FLYINGM_MENU 0x050004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_FLYINGM_GLANCE 0x05004601 /* Look around */ +#define DIBUTTON_FLYINGM_COUNTER 0x05005C04 /* Activate counter measures */ +#define DIAXIS_FLYINGM_RUDDER 0x05024A04 /* Rudder - Yaw ship left/right */ +#define DIAXIS_FLYINGM_BRAKE 0x05046205 /* Brake-axis */ +#define DIBUTTON_FLYINGM_VIEW 0x05006405 /* Cycle through view options */ +#define DIBUTTON_FLYINGM_DISPLAY 0x05006406 /* Select next dashboard option */ +#define DIAXIS_FLYINGM_FLAPS 0x05055206 /* Flaps */ +#define DIBUTTON_FLYINGM_FLAPSUP 0x05005407 /* Increment stepping up until fully retracted */ +#define DIBUTTON_FLYINGM_FLAPSDOWN 0x05005408 /* Decrement stepping down until fully extended */ +#define DIBUTTON_FLYINGM_FIRESECONDARY 0x05004C09 /* Alternative fire button */ +#define DIBUTTON_FLYINGM_GEAR 0x0500640A /* Gear up / down */ +#define DIBUTTON_FLYINGM_BRAKE_LINK 0x050464E0 /* Fallback brake button */ +#define DIBUTTON_FLYINGM_FASTER_LINK 0x0503D4E0 /* Fallback throttle up button */ +#define DIBUTTON_FLYINGM_SLOWER_LINK 0x0503D4E8 /* Fallback throttle down button */ +#define DIBUTTON_FLYINGM_GLANCE_LEFT_LINK 0x0507C4E4 /* Fallback Glance Left button */ +#define DIBUTTON_FLYINGM_GLANCE_RIGHT_LINK 0x0507C4EC /* Fallback Glance Right button */ +#define DIBUTTON_FLYINGM_GLANCE_UP_LINK 0x0507C4E0 /* Fallback Glance Up button */ +#define DIBUTTON_FLYINGM_GLANCE_DOWN_LINK 0x0507C4E8 /* Fallback Glance Down button */ +#define DIBUTTON_FLYINGM_DEVICE 0x050044FE /* Show input device and controls */ +#define DIBUTTON_FLYINGM_PAUSE 0x050044FC /* Start / Pause / Restart game */ + +/*--- Flight Simulator - Combat Helicopter + Combat from helicopter is primary objective ---*/ +#define DIVIRTUAL_FLYING_HELICOPTER 0x06000000 +#define DIAXIS_FLYINGH_BANK 0x06008A01 /* Bank - Roll ship left / right */ +#define DIAXIS_FLYINGH_PITCH 0x06010A02 /* Pitch - Nose up / down */ +#define DIAXIS_FLYINGH_COLLECTIVE 0x06018A03 /* Collective - Blade pitch/power */ +#define DIBUTTON_FLYINGH_FIRE 0x06001401 /* Fire */ +#define DIBUTTON_FLYINGH_WEAPONS 0x06001402 /* Select next weapon */ +#define DIBUTTON_FLYINGH_TARGET 0x06001403 /* Selects next available target */ +#define DIBUTTON_FLYINGH_MENU 0x060004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_FLYINGH_GLANCE 0x06004601 /* Look around */ +#define DIAXIS_FLYINGH_TORQUE 0x06025A04 /* Torque - Rotate ship around left / right axis */ +#define DIAXIS_FLYINGH_THROTTLE 0x0603DA05 /* Throttle */ +#define DIBUTTON_FLYINGH_COUNTER 0x06005404 /* Activate counter measures */ +#define DIBUTTON_FLYINGH_VIEW 0x06006405 /* Cycle through view options */ +#define DIBUTTON_FLYINGH_GEAR 0x06006406 /* Gear up / down */ +#define DIBUTTON_FLYINGH_FIRESECONDARY 0x06004C07 /* Alternative fire button */ +#define DIBUTTON_FLYINGH_FASTER_LINK 0x0603DCE0 /* Fallback throttle up button */ +#define DIBUTTON_FLYINGH_SLOWER_LINK 0x0603DCE8 /* Fallback throttle down button */ +#define DIBUTTON_FLYINGH_GLANCE_LEFT_LINK 0x0607C4E4 /* Fallback Glance Left button */ +#define DIBUTTON_FLYINGH_GLANCE_RIGHT_LINK 0x0607C4EC /* Fallback Glance Right button */ +#define DIBUTTON_FLYINGH_GLANCE_UP_LINK 0x0607C4E0 /* Fallback Glance Up button */ +#define DIBUTTON_FLYINGH_GLANCE_DOWN_LINK 0x0607C4E8 /* Fallback Glance Down button */ +#define DIBUTTON_FLYINGH_DEVICE 0x060044FE /* Show input device and controls */ +#define DIBUTTON_FLYINGH_PAUSE 0x060044FC /* Start / Pause / Restart game */ + +/*--- Space Simulator - Combat + Space Simulator with weapons ---*/ +#define DIVIRTUAL_SPACESIM 0x07000000 +#define DIAXIS_SPACESIM_LATERAL 0x07008201 /* Move ship left / right */ +#define DIAXIS_SPACESIM_MOVE 0x07010202 /* Move ship forward/backward */ +#define DIAXIS_SPACESIM_THROTTLE 0x07038203 /* Throttle - Engine speed */ +#define DIBUTTON_SPACESIM_FIRE 0x07000401 /* Fire */ +#define DIBUTTON_SPACESIM_WEAPONS 0x07000402 /* Select next weapon */ +#define DIBUTTON_SPACESIM_TARGET 0x07000403 /* Selects next available target */ +#define DIBUTTON_SPACESIM_MENU 0x070004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_SPACESIM_GLANCE 0x07004601 /* Look around */ +#define DIAXIS_SPACESIM_CLIMB 0x0701C204 /* Climb - Pitch ship up/down */ +#define DIAXIS_SPACESIM_ROTATE 0x07024205 /* Rotate - Turn ship left/right */ +#define DIBUTTON_SPACESIM_VIEW 0x07004404 /* Cycle through view options */ +#define DIBUTTON_SPACESIM_DISPLAY 0x07004405 /* Select next dashboard / heads up display option */ +#define DIBUTTON_SPACESIM_RAISE 0x07004406 /* Raise ship while maintaining current pitch */ +#define DIBUTTON_SPACESIM_LOWER 0x07004407 /* Lower ship while maintaining current pitch */ +#define DIBUTTON_SPACESIM_GEAR 0x07004408 /* Gear up / down */ +#define DIBUTTON_SPACESIM_FIRESECONDARY 0x07004409 /* Alternative fire button */ +#define DIBUTTON_SPACESIM_LEFT_LINK 0x0700C4E4 /* Fallback move left button */ +#define DIBUTTON_SPACESIM_RIGHT_LINK 0x0700C4EC /* Fallback move right button */ +#define DIBUTTON_SPACESIM_FORWARD_LINK 0x070144E0 /* Fallback move forward button */ +#define DIBUTTON_SPACESIM_BACKWARD_LINK 0x070144E8 /* Fallback move backwards button */ +#define DIBUTTON_SPACESIM_FASTER_LINK 0x0703C4E0 /* Fallback throttle up button */ +#define DIBUTTON_SPACESIM_SLOWER_LINK 0x0703C4E8 /* Fallback throttle down button */ +#define DIBUTTON_SPACESIM_TURN_LEFT_LINK 0x070244E4 /* Fallback turn left button */ +#define DIBUTTON_SPACESIM_TURN_RIGHT_LINK 0x070244EC /* Fallback turn right button */ +#define DIBUTTON_SPACESIM_GLANCE_LEFT_LINK 0x0707C4E4 /* Fallback Glance Left button */ +#define DIBUTTON_SPACESIM_GLANCE_RIGHT_LINK 0x0707C4EC /* Fallback Glance Right button */ +#define DIBUTTON_SPACESIM_GLANCE_UP_LINK 0x0707C4E0 /* Fallback Glance Up button */ +#define DIBUTTON_SPACESIM_GLANCE_DOWN_LINK 0x0707C4E8 /* Fallback Glance Down button */ +#define DIBUTTON_SPACESIM_DEVICE 0x070044FE /* Show input device and controls */ +#define DIBUTTON_SPACESIM_PAUSE 0x070044FC /* Start / Pause / Restart game */ + +/*--- Fighting - First Person + Hand to Hand combat is primary objective ---*/ +#define DIVIRTUAL_FIGHTING_HAND2HAND 0x08000000 +#define DIAXIS_FIGHTINGH_LATERAL 0x08008201 /* Sidestep left/right */ +#define DIAXIS_FIGHTINGH_MOVE 0x08010202 /* Move forward/backward */ +#define DIBUTTON_FIGHTINGH_PUNCH 0x08000401 /* Punch */ +#define DIBUTTON_FIGHTINGH_KICK 0x08000402 /* Kick */ +#define DIBUTTON_FIGHTINGH_BLOCK 0x08000403 /* Block */ +#define DIBUTTON_FIGHTINGH_CROUCH 0x08000404 /* Crouch */ +#define DIBUTTON_FIGHTINGH_JUMP 0x08000405 /* Jump */ +#define DIBUTTON_FIGHTINGH_SPECIAL1 0x08000406 /* Apply first special move */ +#define DIBUTTON_FIGHTINGH_SPECIAL2 0x08000407 /* Apply second special move */ +#define DIBUTTON_FIGHTINGH_MENU 0x080004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIBUTTON_FIGHTINGH_SELECT 0x08004408 /* Select special move */ +#define DIHATSWITCH_FIGHTINGH_SLIDE 0x08004601 /* Look around */ +#define DIBUTTON_FIGHTINGH_DISPLAY 0x08004409 /* Shows next on-screen display option */ +#define DIAXIS_FIGHTINGH_ROTATE 0x08024203 /* Rotate - Turn body left/right */ +#define DIBUTTON_FIGHTINGH_DODGE 0x0800440A /* Dodge */ +#define DIBUTTON_FIGHTINGH_LEFT_LINK 0x0800C4E4 /* Fallback left sidestep button */ +#define DIBUTTON_FIGHTINGH_RIGHT_LINK 0x0800C4EC /* Fallback right sidestep button */ +#define DIBUTTON_FIGHTINGH_FORWARD_LINK 0x080144E0 /* Fallback forward button */ +#define DIBUTTON_FIGHTINGH_BACKWARD_LINK 0x080144E8 /* Fallback backward button */ +#define DIBUTTON_FIGHTINGH_DEVICE 0x080044FE /* Show input device and controls */ +#define DIBUTTON_FIGHTINGH_PAUSE 0x080044FC /* Start / Pause / Restart game */ + +/*--- Fighting - First Person Shooting + Navigation and combat are primary objectives ---*/ +#define DIVIRTUAL_FIGHTING_FPS 0x09000000 +#define DIAXIS_FPS_ROTATE 0x09008201 /* Rotate character left/right */ +#define DIAXIS_FPS_MOVE 0x09010202 /* Move forward/backward */ +#define DIBUTTON_FPS_FIRE 0x09000401 /* Fire */ +#define DIBUTTON_FPS_WEAPONS 0x09000402 /* Select next weapon */ +#define DIBUTTON_FPS_APPLY 0x09000403 /* Use item */ +#define DIBUTTON_FPS_SELECT 0x09000404 /* Select next inventory item */ +#define DIBUTTON_FPS_CROUCH 0x09000405 /* Crouch/ climb down/ swim down */ +#define DIBUTTON_FPS_JUMP 0x09000406 /* Jump/ climb up/ swim up */ +#define DIAXIS_FPS_LOOKUPDOWN 0x09018203 /* Look up / down */ +#define DIBUTTON_FPS_STRAFE 0x09000407 /* Enable strafing while active */ +#define DIBUTTON_FPS_MENU 0x090004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_FPS_GLANCE 0x09004601 /* Look around */ +#define DIBUTTON_FPS_DISPLAY 0x09004408 /* Shows next on-screen display option/ map */ +#define DIAXIS_FPS_SIDESTEP 0x09024204 /* Sidestep */ +#define DIBUTTON_FPS_DODGE 0x09004409 /* Dodge */ +#define DIBUTTON_FPS_GLANCEL 0x0900440A /* Glance Left */ +#define DIBUTTON_FPS_GLANCER 0x0900440B /* Glance Right */ +#define DIBUTTON_FPS_FIRESECONDARY 0x0900440C /* Alternative fire button */ +#define DIBUTTON_FPS_ROTATE_LEFT_LINK 0x0900C4E4 /* Fallback rotate left button */ +#define DIBUTTON_FPS_ROTATE_RIGHT_LINK 0x0900C4EC /* Fallback rotate right button */ +#define DIBUTTON_FPS_FORWARD_LINK 0x090144E0 /* Fallback forward button */ +#define DIBUTTON_FPS_BACKWARD_LINK 0x090144E8 /* Fallback backward button */ +#define DIBUTTON_FPS_GLANCE_UP_LINK 0x0901C4E0 /* Fallback look up button */ +#define DIBUTTON_FPS_GLANCE_DOWN_LINK 0x0901C4E8 /* Fallback look down button */ +#define DIBUTTON_FPS_STEP_LEFT_LINK 0x090244E4 /* Fallback step left button */ +#define DIBUTTON_FPS_STEP_RIGHT_LINK 0x090244EC /* Fallback step right button */ +#define DIBUTTON_FPS_DEVICE 0x090044FE /* Show input device and controls */ +#define DIBUTTON_FPS_PAUSE 0x090044FC /* Start / Pause / Restart game */ + +/*--- Fighting - Third Person action + Perspective of camera is behind the main character ---*/ +#define DIVIRTUAL_FIGHTING_THIRDPERSON 0x0A000000 +#define DIAXIS_TPS_TURN 0x0A020201 /* Turn left/right */ +#define DIAXIS_TPS_MOVE 0x0A010202 /* Move forward/backward */ +#define DIBUTTON_TPS_RUN 0x0A000401 /* Run or walk toggle switch */ +#define DIBUTTON_TPS_ACTION 0x0A000402 /* Action Button */ +#define DIBUTTON_TPS_SELECT 0x0A000403 /* Select next weapon */ +#define DIBUTTON_TPS_USE 0x0A000404 /* Use inventory item currently selected */ +#define DIBUTTON_TPS_JUMP 0x0A000405 /* Character Jumps */ +#define DIBUTTON_TPS_MENU 0x0A0004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_TPS_GLANCE 0x0A004601 /* Look around */ +#define DIBUTTON_TPS_VIEW 0x0A004406 /* Select camera view */ +#define DIBUTTON_TPS_STEPLEFT 0x0A004407 /* Character takes a left step */ +#define DIBUTTON_TPS_STEPRIGHT 0x0A004408 /* Character takes a right step */ +#define DIAXIS_TPS_STEP 0x0A00C203 /* Character steps left/right */ +#define DIBUTTON_TPS_DODGE 0x0A004409 /* Character dodges or ducks */ +#define DIBUTTON_TPS_INVENTORY 0x0A00440A /* Cycle through inventory */ +#define DIBUTTON_TPS_TURN_LEFT_LINK 0x0A0244E4 /* Fallback turn left button */ +#define DIBUTTON_TPS_TURN_RIGHT_LINK 0x0A0244EC /* Fallback turn right button */ +#define DIBUTTON_TPS_FORWARD_LINK 0x0A0144E0 /* Fallback forward button */ +#define DIBUTTON_TPS_BACKWARD_LINK 0x0A0144E8 /* Fallback backward button */ +#define DIBUTTON_TPS_GLANCE_UP_LINK 0x0A07C4E0 /* Fallback look up button */ +#define DIBUTTON_TPS_GLANCE_DOWN_LINK 0x0A07C4E8 /* Fallback look down button */ +#define DIBUTTON_TPS_GLANCE_LEFT_LINK 0x0A07C4E4 /* Fallback glance up button */ +#define DIBUTTON_TPS_GLANCE_RIGHT_LINK 0x0A07C4EC /* Fallback glance right button */ +#define DIBUTTON_TPS_DEVICE 0x0A0044FE /* Show input device and controls */ +#define DIBUTTON_TPS_PAUSE 0x0A0044FC /* Start / Pause / Restart game */ + +/*--- Strategy - Role Playing + Navigation and problem solving are primary actions ---*/ +#define DIVIRTUAL_STRATEGY_ROLEPLAYING 0x0B000000 +#define DIAXIS_STRATEGYR_LATERAL 0x0B008201 /* sidestep - left/right */ +#define DIAXIS_STRATEGYR_MOVE 0x0B010202 /* move forward/backward */ +#define DIBUTTON_STRATEGYR_GET 0x0B000401 /* Acquire item */ +#define DIBUTTON_STRATEGYR_APPLY 0x0B000402 /* Use selected item */ +#define DIBUTTON_STRATEGYR_SELECT 0x0B000403 /* Select nextitem */ +#define DIBUTTON_STRATEGYR_ATTACK 0x0B000404 /* Attack */ +#define DIBUTTON_STRATEGYR_CAST 0x0B000405 /* Cast Spell */ +#define DIBUTTON_STRATEGYR_CROUCH 0x0B000406 /* Crouch */ +#define DIBUTTON_STRATEGYR_JUMP 0x0B000407 /* Jump */ +#define DIBUTTON_STRATEGYR_MENU 0x0B0004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_STRATEGYR_GLANCE 0x0B004601 /* Look around */ +#define DIBUTTON_STRATEGYR_MAP 0x0B004408 /* Cycle through map options */ +#define DIBUTTON_STRATEGYR_DISPLAY 0x0B004409 /* Shows next on-screen display option */ +#define DIAXIS_STRATEGYR_ROTATE 0x0B024203 /* Turn body left/right */ +#define DIBUTTON_STRATEGYR_LEFT_LINK 0x0B00C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_STRATEGYR_RIGHT_LINK 0x0B00C4EC /* Fallback sidestep right button */ +#define DIBUTTON_STRATEGYR_FORWARD_LINK 0x0B0144E0 /* Fallback move forward button */ +#define DIBUTTON_STRATEGYR_BACK_LINK 0x0B0144E8 /* Fallback move backward button */ +#define DIBUTTON_STRATEGYR_ROTATE_LEFT_LINK 0x0B0244E4 /* Fallback turn body left button */ +#define DIBUTTON_STRATEGYR_ROTATE_RIGHT_LINK 0x0B0244EC /* Fallback turn body right button */ +#define DIBUTTON_STRATEGYR_DEVICE 0x0B0044FE /* Show input device and controls */ +#define DIBUTTON_STRATEGYR_PAUSE 0x0B0044FC /* Start / Pause / Restart game */ + +/*--- Strategy - Turn based + Navigation and problem solving are primary actions ---*/ +#define DIVIRTUAL_STRATEGY_TURN 0x0C000000 +#define DIAXIS_STRATEGYT_LATERAL 0x0C008201 /* Sidestep left/right */ +#define DIAXIS_STRATEGYT_MOVE 0x0C010202 /* Move forward/backwards */ +#define DIBUTTON_STRATEGYT_SELECT 0x0C000401 /* Select unit or object */ +#define DIBUTTON_STRATEGYT_INSTRUCT 0x0C000402 /* Cycle through instructions */ +#define DIBUTTON_STRATEGYT_APPLY 0x0C000403 /* Apply selected instruction */ +#define DIBUTTON_STRATEGYT_TEAM 0x0C000404 /* Select next team / cycle through all */ +#define DIBUTTON_STRATEGYT_TURN 0x0C000405 /* Indicate turn over */ +#define DIBUTTON_STRATEGYT_MENU 0x0C0004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIBUTTON_STRATEGYT_ZOOM 0x0C004406 /* Zoom - in / out */ +#define DIBUTTON_STRATEGYT_MAP 0x0C004407 /* cycle through map options */ +#define DIBUTTON_STRATEGYT_DISPLAY 0x0C004408 /* shows next on-screen display options */ +#define DIBUTTON_STRATEGYT_LEFT_LINK 0x0C00C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_STRATEGYT_RIGHT_LINK 0x0C00C4EC /* Fallback sidestep right button */ +#define DIBUTTON_STRATEGYT_FORWARD_LINK 0x0C0144E0 /* Fallback move forward button */ +#define DIBUTTON_STRATEGYT_BACK_LINK 0x0C0144E8 /* Fallback move back button */ +#define DIBUTTON_STRATEGYT_DEVICE 0x0C0044FE /* Show input device and controls */ +#define DIBUTTON_STRATEGYT_PAUSE 0x0C0044FC /* Start / Pause / Restart game */ + +/*--- Sports - Hunting + Hunting ---*/ +#define DIVIRTUAL_SPORTS_HUNTING 0x0D000000 +#define DIAXIS_HUNTING_LATERAL 0x0D008201 /* sidestep left/right */ +#define DIAXIS_HUNTING_MOVE 0x0D010202 /* move forward/backwards */ +#define DIBUTTON_HUNTING_FIRE 0x0D000401 /* Fire selected weapon */ +#define DIBUTTON_HUNTING_AIM 0x0D000402 /* Select aim/move */ +#define DIBUTTON_HUNTING_WEAPON 0x0D000403 /* Select next weapon */ +#define DIBUTTON_HUNTING_BINOCULAR 0x0D000404 /* Look through Binoculars */ +#define DIBUTTON_HUNTING_CALL 0x0D000405 /* Make animal call */ +#define DIBUTTON_HUNTING_MAP 0x0D000406 /* View Map */ +#define DIBUTTON_HUNTING_SPECIAL 0x0D000407 /* Special game operation */ +#define DIBUTTON_HUNTING_MENU 0x0D0004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_HUNTING_GLANCE 0x0D004601 /* Look around */ +#define DIBUTTON_HUNTING_DISPLAY 0x0D004408 /* show next on-screen display option */ +#define DIAXIS_HUNTING_ROTATE 0x0D024203 /* Turn body left/right */ +#define DIBUTTON_HUNTING_CROUCH 0x0D004409 /* Crouch/ Climb / Swim down */ +#define DIBUTTON_HUNTING_JUMP 0x0D00440A /* Jump/ Climb up / Swim up */ +#define DIBUTTON_HUNTING_FIRESECONDARY 0x0D00440B /* Alternative fire button */ +#define DIBUTTON_HUNTING_LEFT_LINK 0x0D00C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_HUNTING_RIGHT_LINK 0x0D00C4EC /* Fallback sidestep right button */ +#define DIBUTTON_HUNTING_FORWARD_LINK 0x0D0144E0 /* Fallback move forward button */ +#define DIBUTTON_HUNTING_BACK_LINK 0x0D0144E8 /* Fallback move back button */ +#define DIBUTTON_HUNTING_ROTATE_LEFT_LINK 0x0D0244E4 /* Fallback turn body left button */ +#define DIBUTTON_HUNTING_ROTATE_RIGHT_LINK 0x0D0244EC /* Fallback turn body right button */ +#define DIBUTTON_HUNTING_DEVICE 0x0D0044FE /* Show input device and controls */ +#define DIBUTTON_HUNTING_PAUSE 0x0D0044FC /* Start / Pause / Restart game */ + +/*--- Sports - Fishing + Catching Fish is primary objective ---*/ +#define DIVIRTUAL_SPORTS_FISHING 0x0E000000 +#define DIAXIS_FISHING_LATERAL 0x0E008201 /* sidestep left/right */ +#define DIAXIS_FISHING_MOVE 0x0E010202 /* move forward/backwards */ +#define DIBUTTON_FISHING_CAST 0x0E000401 /* Cast line */ +#define DIBUTTON_FISHING_TYPE 0x0E000402 /* Select cast type */ +#define DIBUTTON_FISHING_BINOCULAR 0x0E000403 /* Look through Binocular */ +#define DIBUTTON_FISHING_BAIT 0x0E000404 /* Select type of Bait */ +#define DIBUTTON_FISHING_MAP 0x0E000405 /* View Map */ +#define DIBUTTON_FISHING_MENU 0x0E0004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_FISHING_GLANCE 0x0E004601 /* Look around */ +#define DIBUTTON_FISHING_DISPLAY 0x0E004406 /* Show next on-screen display option */ +#define DIAXIS_FISHING_ROTATE 0x0E024203 /* Turn character left / right */ +#define DIBUTTON_FISHING_CROUCH 0x0E004407 /* Crouch/ Climb / Swim down */ +#define DIBUTTON_FISHING_JUMP 0x0E004408 /* Jump/ Climb up / Swim up */ +#define DIBUTTON_FISHING_LEFT_LINK 0x0E00C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_FISHING_RIGHT_LINK 0x0E00C4EC /* Fallback sidestep right button */ +#define DIBUTTON_FISHING_FORWARD_LINK 0x0E0144E0 /* Fallback move forward button */ +#define DIBUTTON_FISHING_BACK_LINK 0x0E0144E8 /* Fallback move back button */ +#define DIBUTTON_FISHING_ROTATE_LEFT_LINK 0x0E0244E4 /* Fallback turn body left button */ +#define DIBUTTON_FISHING_ROTATE_RIGHT_LINK 0x0E0244EC /* Fallback turn body right button */ +#define DIBUTTON_FISHING_DEVICE 0x0E0044FE /* Show input device and controls */ +#define DIBUTTON_FISHING_PAUSE 0x0E0044FC /* Start / Pause / Restart game */ + +/*--- Sports - Baseball - Batting + Batter control is primary objective ---*/ +#define DIVIRTUAL_SPORTS_BASEBALL_BAT 0x0F000000 +#define DIAXIS_BASEBALLB_LATERAL 0x0F008201 /* Aim left / right */ +#define DIAXIS_BASEBALLB_MOVE 0x0F010202 /* Aim up / down */ +#define DIBUTTON_BASEBALLB_SELECT 0x0F000401 /* cycle through swing options */ +#define DIBUTTON_BASEBALLB_NORMAL 0x0F000402 /* normal swing */ +#define DIBUTTON_BASEBALLB_POWER 0x0F000403 /* swing for the fence */ +#define DIBUTTON_BASEBALLB_BUNT 0x0F000404 /* bunt */ +#define DIBUTTON_BASEBALLB_STEAL 0x0F000405 /* Base runner attempts to steal a base */ +#define DIBUTTON_BASEBALLB_BURST 0x0F000406 /* Base runner invokes burst of speed */ +#define DIBUTTON_BASEBALLB_SLIDE 0x0F000407 /* Base runner slides into base */ +#define DIBUTTON_BASEBALLB_CONTACT 0x0F000408 /* Contact swing */ +#define DIBUTTON_BASEBALLB_MENU 0x0F0004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIBUTTON_BASEBALLB_NOSTEAL 0x0F004409 /* Base runner goes back to a base */ +#define DIBUTTON_BASEBALLB_BOX 0x0F00440A /* Enter or exit batting box */ +#define DIBUTTON_BASEBALLB_LEFT_LINK 0x0F00C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_BASEBALLB_RIGHT_LINK 0x0F00C4EC /* Fallback sidestep right button */ +#define DIBUTTON_BASEBALLB_FORWARD_LINK 0x0F0144E0 /* Fallback move forward button */ +#define DIBUTTON_BASEBALLB_BACK_LINK 0x0F0144E8 /* Fallback move back button */ +#define DIBUTTON_BASEBALLB_DEVICE 0x0F0044FE /* Show input device and controls */ +#define DIBUTTON_BASEBALLB_PAUSE 0x0F0044FC /* Start / Pause / Restart game */ + +/*--- Sports - Baseball - Pitching + Pitcher control is primary objective ---*/ +#define DIVIRTUAL_SPORTS_BASEBALL_PITCH 0x10000000 +#define DIAXIS_BASEBALLP_LATERAL 0x10008201 /* Aim left / right */ +#define DIAXIS_BASEBALLP_MOVE 0x10010202 /* Aim up / down */ +#define DIBUTTON_BASEBALLP_SELECT 0x10000401 /* cycle through pitch selections */ +#define DIBUTTON_BASEBALLP_PITCH 0x10000402 /* throw pitch */ +#define DIBUTTON_BASEBALLP_BASE 0x10000403 /* select base to throw to */ +#define DIBUTTON_BASEBALLP_THROW 0x10000404 /* throw to base */ +#define DIBUTTON_BASEBALLP_FAKE 0x10000405 /* Fake a throw to a base */ +#define DIBUTTON_BASEBALLP_MENU 0x100004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIBUTTON_BASEBALLP_WALK 0x10004406 /* Throw intentional walk / pitch out */ +#define DIBUTTON_BASEBALLP_LOOK 0x10004407 /* Look at runners on bases */ +#define DIBUTTON_BASEBALLP_LEFT_LINK 0x1000C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_BASEBALLP_RIGHT_LINK 0x1000C4EC /* Fallback sidestep right button */ +#define DIBUTTON_BASEBALLP_FORWARD_LINK 0x100144E0 /* Fallback move forward button */ +#define DIBUTTON_BASEBALLP_BACK_LINK 0x100144E8 /* Fallback move back button */ +#define DIBUTTON_BASEBALLP_DEVICE 0x100044FE /* Show input device and controls */ +#define DIBUTTON_BASEBALLP_PAUSE 0x100044FC /* Start / Pause / Restart game */ + +/*--- Sports - Baseball - Fielding + Fielder control is primary objective ---*/ +#define DIVIRTUAL_SPORTS_BASEBALL_FIELD 0x11000000 +#define DIAXIS_BASEBALLF_LATERAL 0x11008201 /* Aim left / right */ +#define DIAXIS_BASEBALLF_MOVE 0x11010202 /* Aim up / down */ +#define DIBUTTON_BASEBALLF_NEAREST 0x11000401 /* Switch to fielder nearest to the ball */ +#define DIBUTTON_BASEBALLF_THROW1 0x11000402 /* Make conservative throw */ +#define DIBUTTON_BASEBALLF_THROW2 0x11000403 /* Make aggressive throw */ +#define DIBUTTON_BASEBALLF_BURST 0x11000404 /* Invoke burst of speed */ +#define DIBUTTON_BASEBALLF_JUMP 0x11000405 /* Jump to catch ball */ +#define DIBUTTON_BASEBALLF_DIVE 0x11000406 /* Dive to catch ball */ +#define DIBUTTON_BASEBALLF_MENU 0x110004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIBUTTON_BASEBALLF_SHIFTIN 0x11004407 /* Shift the infield positioning */ +#define DIBUTTON_BASEBALLF_SHIFTOUT 0x11004408 /* Shift the outfield positioning */ +#define DIBUTTON_BASEBALLF_AIM_LEFT_LINK 0x1100C4E4 /* Fallback aim left button */ +#define DIBUTTON_BASEBALLF_AIM_RIGHT_LINK 0x1100C4EC /* Fallback aim right button */ +#define DIBUTTON_BASEBALLF_FORWARD_LINK 0x110144E0 /* Fallback move forward button */ +#define DIBUTTON_BASEBALLF_BACK_LINK 0x110144E8 /* Fallback move back button */ +#define DIBUTTON_BASEBALLF_DEVICE 0x110044FE /* Show input device and controls */ +#define DIBUTTON_BASEBALLF_PAUSE 0x110044FC /* Start / Pause / Restart game */ + +/*--- Sports - Basketball - Offense + Offense ---*/ +#define DIVIRTUAL_SPORTS_BASKETBALL_OFFENSE 0x12000000 +#define DIAXIS_BBALLO_LATERAL 0x12008201 /* left / right */ +#define DIAXIS_BBALLO_MOVE 0x12010202 /* up / down */ +#define DIBUTTON_BBALLO_SHOOT 0x12000401 /* shoot basket */ +#define DIBUTTON_BBALLO_DUNK 0x12000402 /* dunk basket */ +#define DIBUTTON_BBALLO_PASS 0x12000403 /* throw pass */ +#define DIBUTTON_BBALLO_FAKE 0x12000404 /* fake shot or pass */ +#define DIBUTTON_BBALLO_SPECIAL 0x12000405 /* apply special move */ +#define DIBUTTON_BBALLO_PLAYER 0x12000406 /* select next player */ +#define DIBUTTON_BBALLO_BURST 0x12000407 /* invoke burst */ +#define DIBUTTON_BBALLO_CALL 0x12000408 /* call for ball / pass to me */ +#define DIBUTTON_BBALLO_MENU 0x120004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_BBALLO_GLANCE 0x12004601 /* scroll view */ +#define DIBUTTON_BBALLO_SCREEN 0x12004409 /* Call for screen */ +#define DIBUTTON_BBALLO_PLAY 0x1200440A /* Call for specific offensive play */ +#define DIBUTTON_BBALLO_JAB 0x1200440B /* Initiate fake drive to basket */ +#define DIBUTTON_BBALLO_POST 0x1200440C /* Perform post move */ +#define DIBUTTON_BBALLO_TIMEOUT 0x1200440D /* Time Out */ +#define DIBUTTON_BBALLO_SUBSTITUTE 0x1200440E /* substitute one player for another */ +#define DIBUTTON_BBALLO_LEFT_LINK 0x1200C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_BBALLO_RIGHT_LINK 0x1200C4EC /* Fallback sidestep right button */ +#define DIBUTTON_BBALLO_FORWARD_LINK 0x120144E0 /* Fallback move forward button */ +#define DIBUTTON_BBALLO_BACK_LINK 0x120144E8 /* Fallback move back button */ +#define DIBUTTON_BBALLO_DEVICE 0x120044FE /* Show input device and controls */ +#define DIBUTTON_BBALLO_PAUSE 0x120044FC /* Start / Pause / Restart game */ + +/*--- Sports - Basketball - Defense + Defense ---*/ +#define DIVIRTUAL_SPORTS_BASKETBALL_DEFENSE 0x13000000 +#define DIAXIS_BBALLD_LATERAL 0x13008201 /* left / right */ +#define DIAXIS_BBALLD_MOVE 0x13010202 /* up / down */ +#define DIBUTTON_BBALLD_JUMP 0x13000401 /* jump to block shot */ +#define DIBUTTON_BBALLD_STEAL 0x13000402 /* attempt to steal ball */ +#define DIBUTTON_BBALLD_FAKE 0x13000403 /* fake block or steal */ +#define DIBUTTON_BBALLD_SPECIAL 0x13000404 /* apply special move */ +#define DIBUTTON_BBALLD_PLAYER 0x13000405 /* select next player */ +#define DIBUTTON_BBALLD_BURST 0x13000406 /* invoke burst */ +#define DIBUTTON_BBALLD_PLAY 0x13000407 /* call for specific defensive play */ +#define DIBUTTON_BBALLD_MENU 0x130004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_BBALLD_GLANCE 0x13004601 /* scroll view */ +#define DIBUTTON_BBALLD_TIMEOUT 0x13004408 /* Time Out */ +#define DIBUTTON_BBALLD_SUBSTITUTE 0x13004409 /* substitute one player for another */ +#define DIBUTTON_BBALLD_LEFT_LINK 0x1300C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_BBALLD_RIGHT_LINK 0x1300C4EC /* Fallback sidestep right button */ +#define DIBUTTON_BBALLD_FORWARD_LINK 0x130144E0 /* Fallback move forward button */ +#define DIBUTTON_BBALLD_BACK_LINK 0x130144E8 /* Fallback move back button */ +#define DIBUTTON_BBALLD_DEVICE 0x130044FE /* Show input device and controls */ +#define DIBUTTON_BBALLD_PAUSE 0x130044FC /* Start / Pause / Restart game */ + +/*--- Sports - Football - Play + Play selection ---*/ +#define DIVIRTUAL_SPORTS_FOOTBALL_FIELD 0x14000000 +#define DIBUTTON_FOOTBALLP_PLAY 0x14000401 /* cycle through available plays */ +#define DIBUTTON_FOOTBALLP_SELECT 0x14000402 /* select play */ +#define DIBUTTON_FOOTBALLP_HELP 0x14000403 /* Bring up pop-up help */ +#define DIBUTTON_FOOTBALLP_MENU 0x140004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIBUTTON_FOOTBALLP_DEVICE 0x140044FE /* Show input device and controls */ +#define DIBUTTON_FOOTBALLP_PAUSE 0x140044FC /* Start / Pause / Restart game */ + +/*--- Sports - Football - QB + Offense: Quarterback / Kicker ---*/ +#define DIVIRTUAL_SPORTS_FOOTBALL_QBCK 0x15000000 +#define DIAXIS_FOOTBALLQ_LATERAL 0x15008201 /* Move / Aim: left / right */ +#define DIAXIS_FOOTBALLQ_MOVE 0x15010202 /* Move / Aim: up / down */ +#define DIBUTTON_FOOTBALLQ_SELECT 0x15000401 /* Select */ +#define DIBUTTON_FOOTBALLQ_SNAP 0x15000402 /* snap ball - start play */ +#define DIBUTTON_FOOTBALLQ_JUMP 0x15000403 /* jump over defender */ +#define DIBUTTON_FOOTBALLQ_SLIDE 0x15000404 /* Dive/Slide */ +#define DIBUTTON_FOOTBALLQ_PASS 0x15000405 /* throws pass to receiver */ +#define DIBUTTON_FOOTBALLQ_FAKE 0x15000406 /* pump fake pass or fake kick */ +#define DIBUTTON_FOOTBALLQ_MENU 0x150004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIBUTTON_FOOTBALLQ_FAKESNAP 0x15004407 /* Fake snap */ +#define DIBUTTON_FOOTBALLQ_MOTION 0x15004408 /* Send receivers in motion */ +#define DIBUTTON_FOOTBALLQ_AUDIBLE 0x15004409 /* Change offensive play at line of scrimmage */ +#define DIBUTTON_FOOTBALLQ_LEFT_LINK 0x1500C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_FOOTBALLQ_RIGHT_LINK 0x1500C4EC /* Fallback sidestep right button */ +#define DIBUTTON_FOOTBALLQ_FORWARD_LINK 0x150144E0 /* Fallback move forward button */ +#define DIBUTTON_FOOTBALLQ_BACK_LINK 0x150144E8 /* Fallback move back button */ +#define DIBUTTON_FOOTBALLQ_DEVICE 0x150044FE /* Show input device and controls */ +#define DIBUTTON_FOOTBALLQ_PAUSE 0x150044FC /* Start / Pause / Restart game */ + +/*--- Sports - Football - Offense + Offense - Runner ---*/ +#define DIVIRTUAL_SPORTS_FOOTBALL_OFFENSE 0x16000000 +#define DIAXIS_FOOTBALLO_LATERAL 0x16008201 /* Move / Aim: left / right */ +#define DIAXIS_FOOTBALLO_MOVE 0x16010202 /* Move / Aim: up / down */ +#define DIBUTTON_FOOTBALLO_JUMP 0x16000401 /* jump or hurdle over defender */ +#define DIBUTTON_FOOTBALLO_LEFTARM 0x16000402 /* holds out left arm */ +#define DIBUTTON_FOOTBALLO_RIGHTARM 0x16000403 /* holds out right arm */ +#define DIBUTTON_FOOTBALLO_THROW 0x16000404 /* throw pass or lateral ball to another runner */ +#define DIBUTTON_FOOTBALLO_SPIN 0x16000405 /* Spin to avoid defenders */ +#define DIBUTTON_FOOTBALLO_MENU 0x160004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIBUTTON_FOOTBALLO_JUKE 0x16004406 /* Use special move to avoid defenders */ +#define DIBUTTON_FOOTBALLO_SHOULDER 0x16004407 /* Lower shoulder to run over defenders */ +#define DIBUTTON_FOOTBALLO_TURBO 0x16004408 /* Speed burst past defenders */ +#define DIBUTTON_FOOTBALLO_DIVE 0x16004409 /* Dive over defenders */ +#define DIBUTTON_FOOTBALLO_ZOOM 0x1600440A /* Zoom view in / out */ +#define DIBUTTON_FOOTBALLO_SUBSTITUTE 0x1600440B /* substitute one player for another */ +#define DIBUTTON_FOOTBALLO_LEFT_LINK 0x1600C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_FOOTBALLO_RIGHT_LINK 0x1600C4EC /* Fallback sidestep right button */ +#define DIBUTTON_FOOTBALLO_FORWARD_LINK 0x160144E0 /* Fallback move forward button */ +#define DIBUTTON_FOOTBALLO_BACK_LINK 0x160144E8 /* Fallback move back button */ +#define DIBUTTON_FOOTBALLO_DEVICE 0x160044FE /* Show input device and controls */ +#define DIBUTTON_FOOTBALLO_PAUSE 0x160044FC /* Start / Pause / Restart game */ + +/*--- Sports - Football - Defense + Defense ---*/ +#define DIVIRTUAL_SPORTS_FOOTBALL_DEFENSE 0x17000000 +#define DIAXIS_FOOTBALLD_LATERAL 0x17008201 /* Move / Aim: left / right */ +#define DIAXIS_FOOTBALLD_MOVE 0x17010202 /* Move / Aim: up / down */ +#define DIBUTTON_FOOTBALLD_PLAY 0x17000401 /* cycle through available plays */ +#define DIBUTTON_FOOTBALLD_SELECT 0x17000402 /* select player closest to the ball */ +#define DIBUTTON_FOOTBALLD_JUMP 0x17000403 /* jump to intercept or block */ +#define DIBUTTON_FOOTBALLD_TACKLE 0x17000404 /* tackler runner */ +#define DIBUTTON_FOOTBALLD_FAKE 0x17000405 /* hold down to fake tackle or intercept */ +#define DIBUTTON_FOOTBALLD_SUPERTACKLE 0x17000406 /* Initiate special tackle */ +#define DIBUTTON_FOOTBALLD_MENU 0x170004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIBUTTON_FOOTBALLD_SPIN 0x17004407 /* Spin to beat offensive line */ +#define DIBUTTON_FOOTBALLD_SWIM 0x17004408 /* Swim to beat the offensive line */ +#define DIBUTTON_FOOTBALLD_BULLRUSH 0x17004409 /* Bull rush the offensive line */ +#define DIBUTTON_FOOTBALLD_RIP 0x1700440A /* Rip the offensive line */ +#define DIBUTTON_FOOTBALLD_AUDIBLE 0x1700440B /* Change defensive play at the line of scrimmage */ +#define DIBUTTON_FOOTBALLD_ZOOM 0x1700440C /* Zoom view in / out */ +#define DIBUTTON_FOOTBALLD_SUBSTITUTE 0x1700440D /* substitute one player for another */ +#define DIBUTTON_FOOTBALLD_LEFT_LINK 0x1700C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_FOOTBALLD_RIGHT_LINK 0x1700C4EC /* Fallback sidestep right button */ +#define DIBUTTON_FOOTBALLD_FORWARD_LINK 0x170144E0 /* Fallback move forward button */ +#define DIBUTTON_FOOTBALLD_BACK_LINK 0x170144E8 /* Fallback move back button */ +#define DIBUTTON_FOOTBALLD_DEVICE 0x170044FE /* Show input device and controls */ +#define DIBUTTON_FOOTBALLD_PAUSE 0x170044FC /* Start / Pause / Restart game */ + +/*--- Sports - Golf + ---*/ +#define DIVIRTUAL_SPORTS_GOLF 0x18000000 +#define DIAXIS_GOLF_LATERAL 0x18008201 /* Move / Aim: left / right */ +#define DIAXIS_GOLF_MOVE 0x18010202 /* Move / Aim: up / down */ +#define DIBUTTON_GOLF_SWING 0x18000401 /* swing club */ +#define DIBUTTON_GOLF_SELECT 0x18000402 /* cycle between: club / swing strength / ball arc / ball spin */ +#define DIBUTTON_GOLF_UP 0x18000403 /* increase selection */ +#define DIBUTTON_GOLF_DOWN 0x18000404 /* decrease selection */ +#define DIBUTTON_GOLF_TERRAIN 0x18000405 /* shows terrain detail */ +#define DIBUTTON_GOLF_FLYBY 0x18000406 /* view the hole via a flyby */ +#define DIBUTTON_GOLF_MENU 0x180004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_GOLF_SCROLL 0x18004601 /* scroll view */ +#define DIBUTTON_GOLF_ZOOM 0x18004407 /* Zoom view in / out */ +#define DIBUTTON_GOLF_TIMEOUT 0x18004408 /* Call for time out */ +#define DIBUTTON_GOLF_SUBSTITUTE 0x18004409 /* substitute one player for another */ +#define DIBUTTON_GOLF_LEFT_LINK 0x1800C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_GOLF_RIGHT_LINK 0x1800C4EC /* Fallback sidestep right button */ +#define DIBUTTON_GOLF_FORWARD_LINK 0x180144E0 /* Fallback move forward button */ +#define DIBUTTON_GOLF_BACK_LINK 0x180144E8 /* Fallback move back button */ +#define DIBUTTON_GOLF_DEVICE 0x180044FE /* Show input device and controls */ +#define DIBUTTON_GOLF_PAUSE 0x180044FC /* Start / Pause / Restart game */ + +/*--- Sports - Hockey - Offense + Offense ---*/ +#define DIVIRTUAL_SPORTS_HOCKEY_OFFENSE 0x19000000 +#define DIAXIS_HOCKEYO_LATERAL 0x19008201 /* Move / Aim: left / right */ +#define DIAXIS_HOCKEYO_MOVE 0x19010202 /* Move / Aim: up / down */ +#define DIBUTTON_HOCKEYO_SHOOT 0x19000401 /* Shoot */ +#define DIBUTTON_HOCKEYO_PASS 0x19000402 /* pass the puck */ +#define DIBUTTON_HOCKEYO_BURST 0x19000403 /* invoke speed burst */ +#define DIBUTTON_HOCKEYO_SPECIAL 0x19000404 /* invoke special move */ +#define DIBUTTON_HOCKEYO_FAKE 0x19000405 /* hold down to fake pass or kick */ +#define DIBUTTON_HOCKEYO_MENU 0x190004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_HOCKEYO_SCROLL 0x19004601 /* scroll view */ +#define DIBUTTON_HOCKEYO_ZOOM 0x19004406 /* Zoom view in / out */ +#define DIBUTTON_HOCKEYO_STRATEGY 0x19004407 /* Invoke coaching menu for strategy help */ +#define DIBUTTON_HOCKEYO_TIMEOUT 0x19004408 /* Call for time out */ +#define DIBUTTON_HOCKEYO_SUBSTITUTE 0x19004409 /* substitute one player for another */ +#define DIBUTTON_HOCKEYO_LEFT_LINK 0x1900C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_HOCKEYO_RIGHT_LINK 0x1900C4EC /* Fallback sidestep right button */ +#define DIBUTTON_HOCKEYO_FORWARD_LINK 0x190144E0 /* Fallback move forward button */ +#define DIBUTTON_HOCKEYO_BACK_LINK 0x190144E8 /* Fallback move back button */ +#define DIBUTTON_HOCKEYO_DEVICE 0x190044FE /* Show input device and controls */ +#define DIBUTTON_HOCKEYO_PAUSE 0x190044FC /* Start / Pause / Restart game */ + +/*--- Sports - Hockey - Defense + Defense ---*/ +#define DIVIRTUAL_SPORTS_HOCKEY_DEFENSE 0x1A000000 +#define DIAXIS_HOCKEYD_LATERAL 0x1A008201 /* Move / Aim: left / right */ +#define DIAXIS_HOCKEYD_MOVE 0x1A010202 /* Move / Aim: up / down */ +#define DIBUTTON_HOCKEYD_PLAYER 0x1A000401 /* control player closest to the puck */ +#define DIBUTTON_HOCKEYD_STEAL 0x1A000402 /* attempt steal */ +#define DIBUTTON_HOCKEYD_BURST 0x1A000403 /* speed burst or body check */ +#define DIBUTTON_HOCKEYD_BLOCK 0x1A000404 /* block puck */ +#define DIBUTTON_HOCKEYD_FAKE 0x1A000405 /* hold down to fake tackle or intercept */ +#define DIBUTTON_HOCKEYD_MENU 0x1A0004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_HOCKEYD_SCROLL 0x1A004601 /* scroll view */ +#define DIBUTTON_HOCKEYD_ZOOM 0x1A004406 /* Zoom view in / out */ +#define DIBUTTON_HOCKEYD_STRATEGY 0x1A004407 /* Invoke coaching menu for strategy help */ +#define DIBUTTON_HOCKEYD_TIMEOUT 0x1A004408 /* Call for time out */ +#define DIBUTTON_HOCKEYD_SUBSTITUTE 0x1A004409 /* substitute one player for another */ +#define DIBUTTON_HOCKEYD_LEFT_LINK 0x1A00C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_HOCKEYD_RIGHT_LINK 0x1A00C4EC /* Fallback sidestep right button */ +#define DIBUTTON_HOCKEYD_FORWARD_LINK 0x1A0144E0 /* Fallback move forward button */ +#define DIBUTTON_HOCKEYD_BACK_LINK 0x1A0144E8 /* Fallback move back button */ +#define DIBUTTON_HOCKEYD_DEVICE 0x1A0044FE /* Show input device and controls */ +#define DIBUTTON_HOCKEYD_PAUSE 0x1A0044FC /* Start / Pause / Restart game */ + +/*--- Sports - Hockey - Goalie + Goal tending ---*/ +#define DIVIRTUAL_SPORTS_HOCKEY_GOALIE 0x1B000000 +#define DIAXIS_HOCKEYG_LATERAL 0x1B008201 /* Move / Aim: left / right */ +#define DIAXIS_HOCKEYG_MOVE 0x1B010202 /* Move / Aim: up / down */ +#define DIBUTTON_HOCKEYG_PASS 0x1B000401 /* pass puck */ +#define DIBUTTON_HOCKEYG_POKE 0x1B000402 /* poke / check / hack */ +#define DIBUTTON_HOCKEYG_STEAL 0x1B000403 /* attempt steal */ +#define DIBUTTON_HOCKEYG_BLOCK 0x1B000404 /* block puck */ +#define DIBUTTON_HOCKEYG_MENU 0x1B0004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_HOCKEYG_SCROLL 0x1B004601 /* scroll view */ +#define DIBUTTON_HOCKEYG_ZOOM 0x1B004405 /* Zoom view in / out */ +#define DIBUTTON_HOCKEYG_STRATEGY 0x1B004406 /* Invoke coaching menu for strategy help */ +#define DIBUTTON_HOCKEYG_TIMEOUT 0x1B004407 /* Call for time out */ +#define DIBUTTON_HOCKEYG_SUBSTITUTE 0x1B004408 /* substitute one player for another */ +#define DIBUTTON_HOCKEYG_LEFT_LINK 0x1B00C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_HOCKEYG_RIGHT_LINK 0x1B00C4EC /* Fallback sidestep right button */ +#define DIBUTTON_HOCKEYG_FORWARD_LINK 0x1B0144E0 /* Fallback move forward button */ +#define DIBUTTON_HOCKEYG_BACK_LINK 0x1B0144E8 /* Fallback move back button */ +#define DIBUTTON_HOCKEYG_DEVICE 0x1B0044FE /* Show input device and controls */ +#define DIBUTTON_HOCKEYG_PAUSE 0x1B0044FC /* Start / Pause / Restart game */ + +/*--- Sports - Mountain Biking + ---*/ +#define DIVIRTUAL_SPORTS_BIKING_MOUNTAIN 0x1C000000 +#define DIAXIS_BIKINGM_TURN 0x1C008201 /* left / right */ +#define DIAXIS_BIKINGM_PEDAL 0x1C010202 /* Pedal faster / slower / brake */ +#define DIBUTTON_BIKINGM_JUMP 0x1C000401 /* jump over obstacle */ +#define DIBUTTON_BIKINGM_CAMERA 0x1C000402 /* switch camera view */ +#define DIBUTTON_BIKINGM_SPECIAL1 0x1C000403 /* perform first special move */ +#define DIBUTTON_BIKINGM_SELECT 0x1C000404 /* Select */ +#define DIBUTTON_BIKINGM_SPECIAL2 0x1C000405 /* perform second special move */ +#define DIBUTTON_BIKINGM_MENU 0x1C0004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_BIKINGM_SCROLL 0x1C004601 /* scroll view */ +#define DIBUTTON_BIKINGM_ZOOM 0x1C004406 /* Zoom view in / out */ +#define DIAXIS_BIKINGM_BRAKE 0x1C044203 /* Brake axis */ +#define DIBUTTON_BIKINGM_LEFT_LINK 0x1C00C4E4 /* Fallback turn left button */ +#define DIBUTTON_BIKINGM_RIGHT_LINK 0x1C00C4EC /* Fallback turn right button */ +#define DIBUTTON_BIKINGM_FASTER_LINK 0x1C0144E0 /* Fallback pedal faster button */ +#define DIBUTTON_BIKINGM_SLOWER_LINK 0x1C0144E8 /* Fallback pedal slower button */ +#define DIBUTTON_BIKINGM_BRAKE_BUTTON_LINK 0x1C0444E8 /* Fallback brake button */ +#define DIBUTTON_BIKINGM_DEVICE 0x1C0044FE /* Show input device and controls */ +#define DIBUTTON_BIKINGM_PAUSE 0x1C0044FC /* Start / Pause / Restart game */ + +/*--- Sports: Skiing / Snowboarding / Skateboarding + ---*/ +#define DIVIRTUAL_SPORTS_SKIING 0x1D000000 +#define DIAXIS_SKIING_TURN 0x1D008201 /* left / right */ +#define DIAXIS_SKIING_SPEED 0x1D010202 /* faster / slower */ +#define DIBUTTON_SKIING_JUMP 0x1D000401 /* Jump */ +#define DIBUTTON_SKIING_CROUCH 0x1D000402 /* crouch down */ +#define DIBUTTON_SKIING_CAMERA 0x1D000403 /* switch camera view */ +#define DIBUTTON_SKIING_SPECIAL1 0x1D000404 /* perform first special move */ +#define DIBUTTON_SKIING_SELECT 0x1D000405 /* Select */ +#define DIBUTTON_SKIING_SPECIAL2 0x1D000406 /* perform second special move */ +#define DIBUTTON_SKIING_MENU 0x1D0004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_SKIING_GLANCE 0x1D004601 /* scroll view */ +#define DIBUTTON_SKIING_ZOOM 0x1D004407 /* Zoom view in / out */ +#define DIBUTTON_SKIING_LEFT_LINK 0x1D00C4E4 /* Fallback turn left button */ +#define DIBUTTON_SKIING_RIGHT_LINK 0x1D00C4EC /* Fallback turn right button */ +#define DIBUTTON_SKIING_FASTER_LINK 0x1D0144E0 /* Fallback increase speed button */ +#define DIBUTTON_SKIING_SLOWER_LINK 0x1D0144E8 /* Fallback decrease speed button */ +#define DIBUTTON_SKIING_DEVICE 0x1D0044FE /* Show input device and controls */ +#define DIBUTTON_SKIING_PAUSE 0x1D0044FC /* Start / Pause / Restart game */ + +/*--- Sports - Soccer - Offense + Offense ---*/ +#define DIVIRTUAL_SPORTS_SOCCER_OFFENSE 0x1E000000 +#define DIAXIS_SOCCERO_LATERAL 0x1E008201 /* Move / Aim: left / right */ +#define DIAXIS_SOCCERO_MOVE 0x1E010202 /* Move / Aim: up / down */ +#define DIAXIS_SOCCERO_BEND 0x1E018203 /* Bend to soccer shot/pass */ +#define DIBUTTON_SOCCERO_SHOOT 0x1E000401 /* Shoot the ball */ +#define DIBUTTON_SOCCERO_PASS 0x1E000402 /* Pass */ +#define DIBUTTON_SOCCERO_FAKE 0x1E000403 /* Fake */ +#define DIBUTTON_SOCCERO_PLAYER 0x1E000404 /* Select next player */ +#define DIBUTTON_SOCCERO_SPECIAL1 0x1E000405 /* Apply special move */ +#define DIBUTTON_SOCCERO_SELECT 0x1E000406 /* Select special move */ +#define DIBUTTON_SOCCERO_MENU 0x1E0004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_SOCCERO_GLANCE 0x1E004601 /* scroll view */ +#define DIBUTTON_SOCCERO_SUBSTITUTE 0x1E004407 /* Substitute one player for another */ +#define DIBUTTON_SOCCERO_SHOOTLOW 0x1E004408 /* Shoot the ball low */ +#define DIBUTTON_SOCCERO_SHOOTHIGH 0x1E004409 /* Shoot the ball high */ +#define DIBUTTON_SOCCERO_PASSTHRU 0x1E00440A /* Make a thru pass */ +#define DIBUTTON_SOCCERO_SPRINT 0x1E00440B /* Sprint / turbo boost */ +#define DIBUTTON_SOCCERO_CONTROL 0x1E00440C /* Obtain control of the ball */ +#define DIBUTTON_SOCCERO_HEAD 0x1E00440D /* Attempt to head the ball */ +#define DIBUTTON_SOCCERO_LEFT_LINK 0x1E00C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_SOCCERO_RIGHT_LINK 0x1E00C4EC /* Fallback sidestep right button */ +#define DIBUTTON_SOCCERO_FORWARD_LINK 0x1E0144E0 /* Fallback move forward button */ +#define DIBUTTON_SOCCERO_BACK_LINK 0x1E0144E8 /* Fallback move back button */ +#define DIBUTTON_SOCCERO_DEVICE 0x1E0044FE /* Show input device and controls */ +#define DIBUTTON_SOCCERO_PAUSE 0x1E0044FC /* Start / Pause / Restart game */ + +/*--- Sports - Soccer - Defense + Defense ---*/ +#define DIVIRTUAL_SPORTS_SOCCER_DEFENSE 0x1F000000 +#define DIAXIS_SOCCERD_LATERAL 0x1F008201 /* Move / Aim: left / right */ +#define DIAXIS_SOCCERD_MOVE 0x1F010202 /* Move / Aim: up / down */ +#define DIBUTTON_SOCCERD_BLOCK 0x1F000401 /* Attempt to block shot */ +#define DIBUTTON_SOCCERD_STEAL 0x1F000402 /* Attempt to steal ball */ +#define DIBUTTON_SOCCERD_FAKE 0x1F000403 /* Fake a block or a steal */ +#define DIBUTTON_SOCCERD_PLAYER 0x1F000404 /* Select next player */ +#define DIBUTTON_SOCCERD_SPECIAL 0x1F000405 /* Apply special move */ +#define DIBUTTON_SOCCERD_SELECT 0x1F000406 /* Select special move */ +#define DIBUTTON_SOCCERD_SLIDE 0x1F000407 /* Attempt a slide tackle */ +#define DIBUTTON_SOCCERD_MENU 0x1F0004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_SOCCERD_GLANCE 0x1F004601 /* scroll view */ +#define DIBUTTON_SOCCERD_FOUL 0x1F004408 /* Initiate a foul / hard-foul */ +#define DIBUTTON_SOCCERD_HEAD 0x1F004409 /* Attempt a Header */ +#define DIBUTTON_SOCCERD_CLEAR 0x1F00440A /* Attempt to clear the ball down the field */ +#define DIBUTTON_SOCCERD_GOALIECHARGE 0x1F00440B /* Make the goalie charge out of the box */ +#define DIBUTTON_SOCCERD_SUBSTITUTE 0x1F00440C /* Substitute one player for another */ +#define DIBUTTON_SOCCERD_LEFT_LINK 0x1F00C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_SOCCERD_RIGHT_LINK 0x1F00C4EC /* Fallback sidestep right button */ +#define DIBUTTON_SOCCERD_FORWARD_LINK 0x1F0144E0 /* Fallback move forward button */ +#define DIBUTTON_SOCCERD_BACK_LINK 0x1F0144E8 /* Fallback move back button */ +#define DIBUTTON_SOCCERD_DEVICE 0x1F0044FE /* Show input device and controls */ +#define DIBUTTON_SOCCERD_PAUSE 0x1F0044FC /* Start / Pause / Restart game */ + +/*--- Sports - Racquet + Tennis - Table-Tennis - Squash ---*/ +#define DIVIRTUAL_SPORTS_RACQUET 0x20000000 +#define DIAXIS_RACQUET_LATERAL 0x20008201 /* Move / Aim: left / right */ +#define DIAXIS_RACQUET_MOVE 0x20010202 /* Move / Aim: up / down */ +#define DIBUTTON_RACQUET_SWING 0x20000401 /* Swing racquet */ +#define DIBUTTON_RACQUET_BACKSWING 0x20000402 /* Swing backhand */ +#define DIBUTTON_RACQUET_SMASH 0x20000403 /* Smash shot */ +#define DIBUTTON_RACQUET_SPECIAL 0x20000404 /* Special shot */ +#define DIBUTTON_RACQUET_SELECT 0x20000405 /* Select special shot */ +#define DIBUTTON_RACQUET_MENU 0x200004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_RACQUET_GLANCE 0x20004601 /* scroll view */ +#define DIBUTTON_RACQUET_TIMEOUT 0x20004406 /* Call for time out */ +#define DIBUTTON_RACQUET_SUBSTITUTE 0x20004407 /* Substitute one player for another */ +#define DIBUTTON_RACQUET_LEFT_LINK 0x2000C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_RACQUET_RIGHT_LINK 0x2000C4EC /* Fallback sidestep right button */ +#define DIBUTTON_RACQUET_FORWARD_LINK 0x200144E0 /* Fallback move forward button */ +#define DIBUTTON_RACQUET_BACK_LINK 0x200144E8 /* Fallback move back button */ +#define DIBUTTON_RACQUET_DEVICE 0x200044FE /* Show input device and controls */ +#define DIBUTTON_RACQUET_PAUSE 0x200044FC /* Start / Pause / Restart game */ + +/*--- Arcade- 2D + Side to Side movement ---*/ +#define DIVIRTUAL_ARCADE_SIDE2SIDE 0x21000000 +#define DIAXIS_ARCADES_LATERAL 0x21008201 /* left / right */ +#define DIAXIS_ARCADES_MOVE 0x21010202 /* up / down */ +#define DIBUTTON_ARCADES_THROW 0x21000401 /* throw object */ +#define DIBUTTON_ARCADES_CARRY 0x21000402 /* carry object */ +#define DIBUTTON_ARCADES_ATTACK 0x21000403 /* attack */ +#define DIBUTTON_ARCADES_SPECIAL 0x21000404 /* apply special move */ +#define DIBUTTON_ARCADES_SELECT 0x21000405 /* select special move */ +#define DIBUTTON_ARCADES_MENU 0x210004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_ARCADES_VIEW 0x21004601 /* scroll view left / right / up / down */ +#define DIBUTTON_ARCADES_LEFT_LINK 0x2100C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_ARCADES_RIGHT_LINK 0x2100C4EC /* Fallback sidestep right button */ +#define DIBUTTON_ARCADES_FORWARD_LINK 0x210144E0 /* Fallback move forward button */ +#define DIBUTTON_ARCADES_BACK_LINK 0x210144E8 /* Fallback move back button */ +#define DIBUTTON_ARCADES_VIEW_UP_LINK 0x2107C4E0 /* Fallback scroll view up button */ +#define DIBUTTON_ARCADES_VIEW_DOWN_LINK 0x2107C4E8 /* Fallback scroll view down button */ +#define DIBUTTON_ARCADES_VIEW_LEFT_LINK 0x2107C4E4 /* Fallback scroll view left button */ +#define DIBUTTON_ARCADES_VIEW_RIGHT_LINK 0x2107C4EC /* Fallback scroll view right button */ +#define DIBUTTON_ARCADES_DEVICE 0x210044FE /* Show input device and controls */ +#define DIBUTTON_ARCADES_PAUSE 0x210044FC /* Start / Pause / Restart game */ + +/*--- Arcade - Platform Game + Character moves around on screen ---*/ +#define DIVIRTUAL_ARCADE_PLATFORM 0x22000000 +#define DIAXIS_ARCADEP_LATERAL 0x22008201 /* Left / right */ +#define DIAXIS_ARCADEP_MOVE 0x22010202 /* Up / down */ +#define DIBUTTON_ARCADEP_JUMP 0x22000401 /* Jump */ +#define DIBUTTON_ARCADEP_FIRE 0x22000402 /* Fire */ +#define DIBUTTON_ARCADEP_CROUCH 0x22000403 /* Crouch */ +#define DIBUTTON_ARCADEP_SPECIAL 0x22000404 /* Apply special move */ +#define DIBUTTON_ARCADEP_SELECT 0x22000405 /* Select special move */ +#define DIBUTTON_ARCADEP_MENU 0x220004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_ARCADEP_VIEW 0x22004601 /* Scroll view */ +#define DIBUTTON_ARCADEP_FIRESECONDARY 0x22004406 /* Alternative fire button */ +#define DIBUTTON_ARCADEP_LEFT_LINK 0x2200C4E4 /* Fallback sidestep left button */ +#define DIBUTTON_ARCADEP_RIGHT_LINK 0x2200C4EC /* Fallback sidestep right button */ +#define DIBUTTON_ARCADEP_FORWARD_LINK 0x220144E0 /* Fallback move forward button */ +#define DIBUTTON_ARCADEP_BACK_LINK 0x220144E8 /* Fallback move back button */ +#define DIBUTTON_ARCADEP_VIEW_UP_LINK 0x2207C4E0 /* Fallback scroll view up button */ +#define DIBUTTON_ARCADEP_VIEW_DOWN_LINK 0x2207C4E8 /* Fallback scroll view down button */ +#define DIBUTTON_ARCADEP_VIEW_LEFT_LINK 0x2207C4E4 /* Fallback scroll view left button */ +#define DIBUTTON_ARCADEP_VIEW_RIGHT_LINK 0x2207C4EC /* Fallback scroll view right button */ +#define DIBUTTON_ARCADEP_DEVICE 0x220044FE /* Show input device and controls */ +#define DIBUTTON_ARCADEP_PAUSE 0x220044FC /* Start / Pause / Restart game */ + +/*--- CAD - 2D Object Control + Controls to select and move objects in 2D ---*/ +#define DIVIRTUAL_CAD_2DCONTROL 0x23000000 +#define DIAXIS_2DCONTROL_LATERAL 0x23008201 /* Move view left / right */ +#define DIAXIS_2DCONTROL_MOVE 0x23010202 /* Move view up / down */ +#define DIAXIS_2DCONTROL_INOUT 0x23018203 /* Zoom - in / out */ +#define DIBUTTON_2DCONTROL_SELECT 0x23000401 /* Select Object */ +#define DIBUTTON_2DCONTROL_SPECIAL1 0x23000402 /* Do first special operation */ +#define DIBUTTON_2DCONTROL_SPECIAL 0x23000403 /* Select special operation */ +#define DIBUTTON_2DCONTROL_SPECIAL2 0x23000404 /* Do second special operation */ +#define DIBUTTON_2DCONTROL_MENU 0x230004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_2DCONTROL_HATSWITCH 0x23004601 /* Hat switch */ +#define DIAXIS_2DCONTROL_ROTATEZ 0x23024204 /* Rotate view clockwise / counterclockwise */ +#define DIBUTTON_2DCONTROL_DISPLAY 0x23004405 /* Shows next on-screen display options */ +#define DIBUTTON_2DCONTROL_DEVICE 0x230044FE /* Show input device and controls */ +#define DIBUTTON_2DCONTROL_PAUSE 0x230044FC /* Start / Pause / Restart game */ + +/*--- CAD - 3D object control + Controls to select and move objects within a 3D environment ---*/ +#define DIVIRTUAL_CAD_3DCONTROL 0x24000000 +#define DIAXIS_3DCONTROL_LATERAL 0x24008201 /* Move view left / right */ +#define DIAXIS_3DCONTROL_MOVE 0x24010202 /* Move view up / down */ +#define DIAXIS_3DCONTROL_INOUT 0x24018203 /* Zoom - in / out */ +#define DIBUTTON_3DCONTROL_SELECT 0x24000401 /* Select Object */ +#define DIBUTTON_3DCONTROL_SPECIAL1 0x24000402 /* Do first special operation */ +#define DIBUTTON_3DCONTROL_SPECIAL 0x24000403 /* Select special operation */ +#define DIBUTTON_3DCONTROL_SPECIAL2 0x24000404 /* Do second special operation */ +#define DIBUTTON_3DCONTROL_MENU 0x240004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_3DCONTROL_HATSWITCH 0x24004601 /* Hat switch */ +#define DIAXIS_3DCONTROL_ROTATEX 0x24034204 /* Rotate view forward or up / backward or down */ +#define DIAXIS_3DCONTROL_ROTATEY 0x2402C205 /* Rotate view clockwise / counterclockwise */ +#define DIAXIS_3DCONTROL_ROTATEZ 0x24024206 /* Rotate view left / right */ +#define DIBUTTON_3DCONTROL_DISPLAY 0x24004405 /* Show next on-screen display options */ +#define DIBUTTON_3DCONTROL_DEVICE 0x240044FE /* Show input device and controls */ +#define DIBUTTON_3DCONTROL_PAUSE 0x240044FC /* Start / Pause / Restart game */ + +/*--- CAD - 3D Navigation - Fly through + Controls for 3D modeling ---*/ +#define DIVIRTUAL_CAD_FLYBY 0x25000000 +#define DIAXIS_CADF_LATERAL 0x25008201 /* move view left / right */ +#define DIAXIS_CADF_MOVE 0x25010202 /* move view up / down */ +#define DIAXIS_CADF_INOUT 0x25018203 /* in / out */ +#define DIBUTTON_CADF_SELECT 0x25000401 /* Select Object */ +#define DIBUTTON_CADF_SPECIAL1 0x25000402 /* do first special operation */ +#define DIBUTTON_CADF_SPECIAL 0x25000403 /* Select special operation */ +#define DIBUTTON_CADF_SPECIAL2 0x25000404 /* do second special operation */ +#define DIBUTTON_CADF_MENU 0x250004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_CADF_HATSWITCH 0x25004601 /* Hat switch */ +#define DIAXIS_CADF_ROTATEX 0x25034204 /* Rotate view forward or up / backward or down */ +#define DIAXIS_CADF_ROTATEY 0x2502C205 /* Rotate view clockwise / counterclockwise */ +#define DIAXIS_CADF_ROTATEZ 0x25024206 /* Rotate view left / right */ +#define DIBUTTON_CADF_DISPLAY 0x25004405 /* shows next on-screen display options */ +#define DIBUTTON_CADF_DEVICE 0x250044FE /* Show input device and controls */ +#define DIBUTTON_CADF_PAUSE 0x250044FC /* Start / Pause / Restart game */ + +/*--- CAD - 3D Model Control + Controls for 3D modeling ---*/ +#define DIVIRTUAL_CAD_MODEL 0x26000000 +#define DIAXIS_CADM_LATERAL 0x26008201 /* move view left / right */ +#define DIAXIS_CADM_MOVE 0x26010202 /* move view up / down */ +#define DIAXIS_CADM_INOUT 0x26018203 /* in / out */ +#define DIBUTTON_CADM_SELECT 0x26000401 /* Select Object */ +#define DIBUTTON_CADM_SPECIAL1 0x26000402 /* do first special operation */ +#define DIBUTTON_CADM_SPECIAL 0x26000403 /* Select special operation */ +#define DIBUTTON_CADM_SPECIAL2 0x26000404 /* do second special operation */ +#define DIBUTTON_CADM_MENU 0x260004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIHATSWITCH_CADM_HATSWITCH 0x26004601 /* Hat switch */ +#define DIAXIS_CADM_ROTATEX 0x26034204 /* Rotate view forward or up / backward or down */ +#define DIAXIS_CADM_ROTATEY 0x2602C205 /* Rotate view clockwise / counterclockwise */ +#define DIAXIS_CADM_ROTATEZ 0x26024206 /* Rotate view left / right */ +#define DIBUTTON_CADM_DISPLAY 0x26004405 /* shows next on-screen display options */ +#define DIBUTTON_CADM_DEVICE 0x260044FE /* Show input device and controls */ +#define DIBUTTON_CADM_PAUSE 0x260044FC /* Start / Pause / Restart game */ + +/*--- Control - Media Equipment + Remote ---*/ +#define DIVIRTUAL_REMOTE_CONTROL 0x27000000 +#define DIAXIS_REMOTE_SLIDER 0x27050201 /* Slider for adjustment: volume / color / bass / etc */ +#define DIBUTTON_REMOTE_MUTE 0x27000401 /* Set volume on current device to zero */ +#define DIBUTTON_REMOTE_SELECT 0x27000402 /* Next/previous: channel/ track / chapter / picture / station */ +#define DIBUTTON_REMOTE_PLAY 0x27002403 /* Start or pause entertainment on current device */ +#define DIBUTTON_REMOTE_CUE 0x27002404 /* Move through current media */ +#define DIBUTTON_REMOTE_REVIEW 0x27002405 /* Move through current media */ +#define DIBUTTON_REMOTE_CHANGE 0x27002406 /* Select next device */ +#define DIBUTTON_REMOTE_RECORD 0x27002407 /* Start recording the current media */ +#define DIBUTTON_REMOTE_MENU 0x270004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIAXIS_REMOTE_SLIDER2 0x27054202 /* Slider for adjustment: volume */ +#define DIBUTTON_REMOTE_TV 0x27005C08 /* Select TV */ +#define DIBUTTON_REMOTE_CABLE 0x27005C09 /* Select cable box */ +#define DIBUTTON_REMOTE_CD 0x27005C0A /* Select CD player */ +#define DIBUTTON_REMOTE_VCR 0x27005C0B /* Select VCR */ +#define DIBUTTON_REMOTE_TUNER 0x27005C0C /* Select tuner */ +#define DIBUTTON_REMOTE_DVD 0x27005C0D /* Select DVD player */ +#define DIBUTTON_REMOTE_ADJUST 0x27005C0E /* Enter device adjustment menu */ +#define DIBUTTON_REMOTE_DIGIT0 0x2700540F /* Digit 0 */ +#define DIBUTTON_REMOTE_DIGIT1 0x27005410 /* Digit 1 */ +#define DIBUTTON_REMOTE_DIGIT2 0x27005411 /* Digit 2 */ +#define DIBUTTON_REMOTE_DIGIT3 0x27005412 /* Digit 3 */ +#define DIBUTTON_REMOTE_DIGIT4 0x27005413 /* Digit 4 */ +#define DIBUTTON_REMOTE_DIGIT5 0x27005414 /* Digit 5 */ +#define DIBUTTON_REMOTE_DIGIT6 0x27005415 /* Digit 6 */ +#define DIBUTTON_REMOTE_DIGIT7 0x27005416 /* Digit 7 */ +#define DIBUTTON_REMOTE_DIGIT8 0x27005417 /* Digit 8 */ +#define DIBUTTON_REMOTE_DIGIT9 0x27005418 /* Digit 9 */ +#define DIBUTTON_REMOTE_DEVICE 0x270044FE /* Show input device and controls */ +#define DIBUTTON_REMOTE_PAUSE 0x270044FC /* Start / Pause / Restart game */ + +/*--- Control- Web + Help or Browser ---*/ +#define DIVIRTUAL_BROWSER_CONTROL 0x28000000 +#define DIAXIS_BROWSER_LATERAL 0x28008201 /* Move on screen pointer */ +#define DIAXIS_BROWSER_MOVE 0x28010202 /* Move on screen pointer */ +#define DIBUTTON_BROWSER_SELECT 0x28000401 /* Select current item */ +#define DIAXIS_BROWSER_VIEW 0x28018203 /* Move view up/down */ +#define DIBUTTON_BROWSER_REFRESH 0x28000402 /* Refresh */ +#define DIBUTTON_BROWSER_MENU 0x280004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIBUTTON_BROWSER_SEARCH 0x28004403 /* Use search tool */ +#define DIBUTTON_BROWSER_STOP 0x28004404 /* Cease current update */ +#define DIBUTTON_BROWSER_HOME 0x28004405 /* Go directly to "home" location */ +#define DIBUTTON_BROWSER_FAVORITES 0x28004406 /* Mark current site as favorite */ +#define DIBUTTON_BROWSER_NEXT 0x28004407 /* Select Next page */ +#define DIBUTTON_BROWSER_PREVIOUS 0x28004408 /* Select Previous page */ +#define DIBUTTON_BROWSER_HISTORY 0x28004409 /* Show/Hide History */ +#define DIBUTTON_BROWSER_PRINT 0x2800440A /* Print current page */ +#define DIBUTTON_BROWSER_DEVICE 0x280044FE /* Show input device and controls */ +#define DIBUTTON_BROWSER_PAUSE 0x280044FC /* Start / Pause / Restart game */ + +/*--- Driving Simulator - Giant Walking Robot + Walking tank with weapons ---*/ +#define DIVIRTUAL_DRIVING_MECHA 0x29000000 +#define DIAXIS_MECHA_STEER 0x29008201 /* Turns mecha left/right */ +#define DIAXIS_MECHA_TORSO 0x29010202 /* Tilts torso forward/backward */ +#define DIAXIS_MECHA_ROTATE 0x29020203 /* Turns torso left/right */ +#define DIAXIS_MECHA_THROTTLE 0x29038204 /* Engine Speed */ +#define DIBUTTON_MECHA_FIRE 0x29000401 /* Fire */ +#define DIBUTTON_MECHA_WEAPONS 0x29000402 /* Select next weapon group */ +#define DIBUTTON_MECHA_TARGET 0x29000403 /* Select closest enemy available target */ +#define DIBUTTON_MECHA_REVERSE 0x29000404 /* Toggles throttle in/out of reverse */ +#define DIBUTTON_MECHA_ZOOM 0x29000405 /* Zoom in/out targeting reticule */ +#define DIBUTTON_MECHA_JUMP 0x29000406 /* Fires jump jets */ +#define DIBUTTON_MECHA_MENU 0x290004FD /* Show menu options */ +/*--- Priority 2 controls ---*/ + +#define DIBUTTON_MECHA_CENTER 0x29004407 /* Center torso to legs */ +#define DIHATSWITCH_MECHA_GLANCE 0x29004601 /* Look around */ +#define DIBUTTON_MECHA_VIEW 0x29004408 /* Cycle through view options */ +#define DIBUTTON_MECHA_FIRESECONDARY 0x29004409 /* Alternative fire button */ +#define DIBUTTON_MECHA_LEFT_LINK 0x2900C4E4 /* Fallback steer left button */ +#define DIBUTTON_MECHA_RIGHT_LINK 0x2900C4EC /* Fallback steer right button */ +#define DIBUTTON_MECHA_FORWARD_LINK 0x290144E0 /* Fallback tilt torso forward button */ +#define DIBUTTON_MECHA_BACK_LINK 0x290144E8 /* Fallback tilt toroso backward button */ +#define DIBUTTON_MECHA_ROTATE_LEFT_LINK 0x290244E4 /* Fallback rotate toroso right button */ +#define DIBUTTON_MECHA_ROTATE_RIGHT_LINK 0x290244EC /* Fallback rotate torso left button */ +#define DIBUTTON_MECHA_FASTER_LINK 0x2903C4E0 /* Fallback increase engine speed */ +#define DIBUTTON_MECHA_SLOWER_LINK 0x2903C4E8 /* Fallback decrease engine speed */ +#define DIBUTTON_MECHA_DEVICE 0x290044FE /* Show input device and controls */ +#define DIBUTTON_MECHA_PAUSE 0x290044FC /* Start / Pause / Restart game */ + +/* + * "ANY" semantics can be used as a last resort to get mappings for actions + * that match nothing in the chosen virtual genre. These semantics will be + * mapped at a lower priority that virtual genre semantics. Also, hardware + * vendors will not be able to provide sensible mappings for these unless + * they provide application specific mappings. + */ +#define DIAXIS_ANY_X_1 0xFF00C201 +#define DIAXIS_ANY_X_2 0xFF00C202 +#define DIAXIS_ANY_Y_1 0xFF014201 +#define DIAXIS_ANY_Y_2 0xFF014202 +#define DIAXIS_ANY_Z_1 0xFF01C201 +#define DIAXIS_ANY_Z_2 0xFF01C202 +#define DIAXIS_ANY_R_1 0xFF024201 +#define DIAXIS_ANY_R_2 0xFF024202 +#define DIAXIS_ANY_U_1 0xFF02C201 +#define DIAXIS_ANY_U_2 0xFF02C202 +#define DIAXIS_ANY_V_1 0xFF034201 +#define DIAXIS_ANY_V_2 0xFF034202 +#define DIAXIS_ANY_A_1 0xFF03C201 +#define DIAXIS_ANY_A_2 0xFF03C202 +#define DIAXIS_ANY_B_1 0xFF044201 +#define DIAXIS_ANY_B_2 0xFF044202 +#define DIAXIS_ANY_C_1 0xFF04C201 +#define DIAXIS_ANY_C_2 0xFF04C202 +#define DIAXIS_ANY_S_1 0xFF054201 +#define DIAXIS_ANY_S_2 0xFF054202 + +#define DIAXIS_ANY_1 0xFF004201 +#define DIAXIS_ANY_2 0xFF004202 +#define DIAXIS_ANY_3 0xFF004203 +#define DIAXIS_ANY_4 0xFF004204 + +#define DIPOV_ANY_1 0xFF004601 +#define DIPOV_ANY_2 0xFF004602 +#define DIPOV_ANY_3 0xFF004603 +#define DIPOV_ANY_4 0xFF004604 + +#define DIBUTTON_ANY(instance) ( 0xFF004400 | instance ) + + +#ifdef __cplusplus +}; +#endif + +#endif /* __DINPUT_INCLUDED__ */ + +/**************************************************************************** + * + * Definitions for non-IDirectInput (VJoyD) features defined more recently + * than the current sdk files + * + ****************************************************************************/ + +#ifdef _INC_MMSYSTEM +#ifndef MMNOJOY + +#ifndef __VJOYDX_INCLUDED__ +#define __VJOYDX_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Flag to indicate that the dwReserved2 field of the JOYINFOEX structure + * contains mini-driver specific data to be passed by VJoyD to the mini- + * driver instead of doing a poll. + */ +#define JOY_PASSDRIVERDATA 0x10000000l + +/* + * Informs the joystick driver that the configuration has been changed + * and should be reloaded from the registery. + * dwFlags is reserved and should be set to zero + */ +WINMMAPI MMRESULT WINAPI joyConfigChanged( DWORD dwFlags ); + +#ifndef DIJ_RINGZERO +/* + * Invoke the joystick control panel directly, using the passed window handle + * as the parent of the dialog. This API is only supported for compatibility + * purposes; new applications should use the RunControlPanel method of a + * device interface for a game controller. + * The API is called by using the function pointer returned by + * GetProcAddress( hCPL, TEXT("ShowJoyCPL") ) where hCPL is a HMODULE returned + * by LoadLibrary( TEXT("joy.cpl") ). The typedef is provided to allow + * declaration and casting of an appropriately typed variable. + */ +void WINAPI ShowJoyCPL( HWND hWnd ); +typedef void (WINAPI* LPFNSHOWJOYCPL)( HWND hWnd ); +#endif /* DIJ_RINGZERO */ + + +/* + * Hardware Setting indicating that the device is a headtracker + */ +#define JOY_HWS_ISHEADTRACKER 0x02000000l + +/* + * Hardware Setting indicating that the VxD is used to replace + * the standard analog polling + */ +#define JOY_HWS_ISGAMEPORTDRIVER 0x04000000l + +/* + * Hardware Setting indicating that the driver needs a standard + * gameport in order to communicate with the device. + */ +#define JOY_HWS_ISANALOGPORTDRIVER 0x08000000l + +/* + * Hardware Setting indicating that VJoyD should not load this + * driver, it will be loaded externally and will register with + * VJoyD of it's own accord. + */ +#define JOY_HWS_AUTOLOAD 0x10000000l + +/* + * Hardware Setting indicating that the driver acquires any + * resources needed without needing a devnode through VJoyD. + */ +#define JOY_HWS_NODEVNODE 0x20000000l + + +/* + * Hardware Setting indicating that the device is a gameport bus + */ +#define JOY_HWS_ISGAMEPORTBUS 0x80000000l +#define JOY_HWS_GAMEPORTBUSBUSY 0x00000001l + +/* + * Usage Setting indicating that the settings are volatile and + * should be removed if still present on a reboot. + */ +#define JOY_US_VOLATILE 0x00000008L + +#ifdef __cplusplus +}; +#endif + +#endif /* __VJOYDX_INCLUDED__ */ + +#endif /* not MMNOJOY */ +#endif /* _INC_MMSYSTEM */ + +/**************************************************************************** + * + * Definitions for non-IDirectInput (VJoyD) features defined more recently + * than the current ddk files + * + ****************************************************************************/ + +#ifndef DIJ_RINGZERO + +#ifdef _INC_MMDDK +#ifndef MMNOJOYDEV + +#ifndef __VJOYDXD_INCLUDED__ +#define __VJOYDXD_INCLUDED__ +/* + * Poll type in which the do_other field of the JOYOEMPOLLDATA + * structure contains mini-driver specific data passed from an app. + */ +#define JOY_OEMPOLL_PASSDRIVERDATA 7 + +#endif /* __VJOYDXD_INCLUDED__ */ + +#endif /* not MMNOJOYDEV */ +#endif /* _INC_MMDDK */ + +#endif /* DIJ_RINGZERO */ + diff --git a/MediaClient/MediaClient/directx/include/dinputd.h b/MediaClient/MediaClient/directx/include/dinputd.h new file mode 100644 index 0000000..f534353 --- /dev/null +++ b/MediaClient/MediaClient/directx/include/dinputd.h @@ -0,0 +1,755 @@ +/**************************************************************************** + * + * Copyright (C) 1995-2000 Microsoft Corporation. All Rights Reserved. + * + * File: dinputd.h + * Content: DirectInput include file for device driver implementors + * + ****************************************************************************/ +#ifndef __DINPUTD_INCLUDED__ +#define __DINPUTD_INCLUDED__ + +#ifndef DIRECTINPUT_VERSION +#define DIRECTINPUT_VERSION 0x0800 +#pragma message(__FILE__ ": DIRECTINPUT_VERSION undefined. Defaulting to version 0x0800") +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/**************************************************************************** + * + * Interfaces + * + ****************************************************************************/ + +#ifndef DIJ_RINGZERO + +DEFINE_GUID(IID_IDirectInputEffectDriver, 0x02538130,0x898F,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35); +DEFINE_GUID(IID_IDirectInputJoyConfig, 0x1DE12AB1,0xC9F5,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); +DEFINE_GUID(IID_IDirectInputPIDDriver, 0xEEC6993A,0xB3FD,0x11D2,0xA9,0x16,0x00,0xC0,0x4F,0xB9,0x86,0x38); + +DEFINE_GUID(IID_IDirectInputJoyConfig8, 0xeb0d7dfa,0x1990,0x4f27,0xb4,0xd6,0xed,0xf2,0xee,0xc4,0xa4,0x4c); + +#endif /* DIJ_RINGZERO */ + + +/**************************************************************************** + * + * IDirectInputEffectDriver + * + ****************************************************************************/ + +typedef struct DIOBJECTATTRIBUTES { + DWORD dwFlags; + WORD wUsagePage; + WORD wUsage; +} DIOBJECTATTRIBUTES, *LPDIOBJECTATTRIBUTES; +typedef const DIOBJECTATTRIBUTES *LPCDIOBJECTATTRIBUTES; + +typedef struct DIFFOBJECTATTRIBUTES { + DWORD dwFFMaxForce; + DWORD dwFFForceResolution; +} DIFFOBJECTATTRIBUTES, *LPDIFFOBJECTATTRIBUTES; +typedef const DIFFOBJECTATTRIBUTES *LPCDIFFOBJECTATTRIBUTES; + +typedef struct DIOBJECTCALIBRATION { + LONG lMin; + LONG lCenter; + LONG lMax; +} DIOBJECTCALIBRATION, *LPDIOBJECTCALIBRATION; +typedef const DIOBJECTCALIBRATION *LPCDIOBJECTCALIBRATION; + +typedef struct DIPOVCALIBRATION { + LONG lMin[5]; + LONG lMax[5]; +} DIPOVCALIBRATION, *LPDIPOVCALIBRATION; +typedef const DIPOVCALIBRATION *LPCDIPOVCALIBRATION; + +typedef struct DIEFFECTATTRIBUTES { + DWORD dwEffectId; + DWORD dwEffType; + DWORD dwStaticParams; + DWORD dwDynamicParams; + DWORD dwCoords; +} DIEFFECTATTRIBUTES, *LPDIEFFECTATTRIBUTES; +typedef const DIEFFECTATTRIBUTES *LPCDIEFFECTATTRIBUTES; + +typedef struct DIFFDEVICEATTRIBUTES { + DWORD dwFlags; + DWORD dwFFSamplePeriod; + DWORD dwFFMinTimeResolution; +} DIFFDEVICEATTRIBUTES, *LPDIFFDEVICEATTRIBUTES; +typedef const DIFFDEVICEATTRIBUTES *LPCDIFFDEVICEATTRIBUTES; + +typedef struct DIDRIVERVERSIONS { + DWORD dwSize; + DWORD dwFirmwareRevision; + DWORD dwHardwareRevision; + DWORD dwFFDriverVersion; +} DIDRIVERVERSIONS, *LPDIDRIVERVERSIONS; +typedef const DIDRIVERVERSIONS *LPCDIDRIVERVERSIONS; + +typedef struct DIDEVICESTATE { + DWORD dwSize; + DWORD dwState; + DWORD dwLoad; +} DIDEVICESTATE, *LPDIDEVICESTATE; + +#define DEV_STS_EFFECT_RUNNING DIEGES_PLAYING + +#ifndef DIJ_RINGZERO + +typedef struct DIHIDFFINITINFO { + DWORD dwSize; + LPWSTR pwszDeviceInterface; + GUID GuidInstance; +} DIHIDFFINITINFO, *LPDIHIDFFINITINFO; + +#undef INTERFACE +#define INTERFACE IDirectInputEffectDriver + +DECLARE_INTERFACE_(IDirectInputEffectDriver, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputEffectDriver methods ***/ + STDMETHOD(DeviceID)(THIS_ DWORD,DWORD,DWORD,DWORD,LPVOID) PURE; + STDMETHOD(GetVersions)(THIS_ LPDIDRIVERVERSIONS) PURE; + STDMETHOD(Escape)(THIS_ DWORD,DWORD,LPDIEFFESCAPE) PURE; + STDMETHOD(SetGain)(THIS_ DWORD,DWORD) PURE; + STDMETHOD(SendForceFeedbackCommand)(THIS_ DWORD,DWORD) PURE; + STDMETHOD(GetForceFeedbackState)(THIS_ DWORD,LPDIDEVICESTATE) PURE; + STDMETHOD(DownloadEffect)(THIS_ DWORD,DWORD,LPDWORD,LPCDIEFFECT,DWORD) PURE; + STDMETHOD(DestroyEffect)(THIS_ DWORD,DWORD) PURE; + STDMETHOD(StartEffect)(THIS_ DWORD,DWORD,DWORD,DWORD) PURE; + STDMETHOD(StopEffect)(THIS_ DWORD,DWORD) PURE; + STDMETHOD(GetEffectStatus)(THIS_ DWORD,DWORD,LPDWORD) PURE; +}; + +typedef struct IDirectInputEffectDriver *LPDIRECTINPUTEFFECTDRIVER; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectInputEffectDriver_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectInputEffectDriver_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectInputEffectDriver_Release(p) (p)->lpVtbl->Release(p) +#define IDirectInputEffectDriver_DeviceID(p,a,b,c,d,e) (p)->lpVtbl->DeviceID(p,a,b,c,d,e) +#define IDirectInputEffectDriver_GetVersions(p,a) (p)->lpVtbl->GetVersions(p,a) +#define IDirectInputEffectDriver_Escape(p,a,b,c) (p)->lpVtbl->Escape(p,a,b,c) +#define IDirectInputEffectDriver_SetGain(p,a,b) (p)->lpVtbl->SetGain(p,a,b) +#define IDirectInputEffectDriver_SendForceFeedbackCommand(p,a,b) (p)->lpVtbl->SendForceFeedbackCommand(p,a,b) +#define IDirectInputEffectDriver_GetForceFeedbackState(p,a,b) (p)->lpVtbl->GetForceFeedbackState(p,a,b) +#define IDirectInputEffectDriver_DownloadEffect(p,a,b,c,d,e) (p)->lpVtbl->DownloadEffect(p,a,b,c,d,e) +#define IDirectInputEffectDriver_DestroyEffect(p,a,b) (p)->lpVtbl->DestroyEffect(p,a,b) +#define IDirectInputEffectDriver_StartEffect(p,a,b,c,d) (p)->lpVtbl->StartEffect(p,a,b,c,d) +#define IDirectInputEffectDriver_StopEffect(p,a,b) (p)->lpVtbl->StopEffect(p,a,b) +#define IDirectInputEffectDriver_GetEffectStatus(p,a,b,c) (p)->lpVtbl->GetEffectStatus(p,a,b,c) +#else +#define IDirectInputEffectDriver_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectInputEffectDriver_AddRef(p) (p)->AddRef() +#define IDirectInputEffectDriver_Release(p) (p)->Release() +#define IDirectInputEffectDriver_DeviceID(p,a,b,c,d,e) (p)->DeviceID(a,b,c,d,e) +#define IDirectInputEffectDriver_GetVersions(p,a) (p)->GetVersions(a) +#define IDirectInputEffectDriver_Escape(p,a,b,c) (p)->Escape(a,b,c) +#define IDirectInputEffectDriver_SetGain(p,a,b) (p)->SetGain(a,b) +#define IDirectInputEffectDriver_SendForceFeedbackCommand(p,a,b) (p)->SendForceFeedbackCommand(a,b) +#define IDirectInputEffectDriver_GetForceFeedbackState(p,a,b) (p)->GetForceFeedbackState(a,b) +#define IDirectInputEffectDriver_DownloadEffect(p,a,b,c,d,e) (p)->DownloadEffect(a,b,c,d,e) +#define IDirectInputEffectDriver_DestroyEffect(p,a,b) (p)->DestroyEffect(a,b) +#define IDirectInputEffectDriver_StartEffect(p,a,b,c,d) (p)->StartEffect(a,b,c,d) +#define IDirectInputEffectDriver_StopEffect(p,a,b) (p)->StopEffect(a,b) +#define IDirectInputEffectDriver_GetEffectStatus(p,a,b,c) (p)->GetEffectStatus(a,b,c) +#endif + + +#endif /* DIJ_RINGZERO */ + + +/**************************************************************************** + * + * IDirectInputJoyConfig + * + ****************************************************************************/ + +/**************************************************************************** + * + * Definitions copied from the DDK + * + ****************************************************************************/ + +#ifndef JOY_HW_NONE + +/* pre-defined joystick types */ +#define JOY_HW_NONE 0 +#define JOY_HW_CUSTOM 1 +#define JOY_HW_2A_2B_GENERIC 2 +#define JOY_HW_2A_4B_GENERIC 3 +#define JOY_HW_2B_GAMEPAD 4 +#define JOY_HW_2B_FLIGHTYOKE 5 +#define JOY_HW_2B_FLIGHTYOKETHROTTLE 6 +#define JOY_HW_3A_2B_GENERIC 7 +#define JOY_HW_3A_4B_GENERIC 8 +#define JOY_HW_4B_GAMEPAD 9 +#define JOY_HW_4B_FLIGHTYOKE 10 +#define JOY_HW_4B_FLIGHTYOKETHROTTLE 11 +#define JOY_HW_TWO_2A_2B_WITH_Y 12 +#define JOY_HW_LASTENTRY 13 + + +/* calibration flags */ +#define JOY_ISCAL_XY 0x00000001l /* XY are calibrated */ +#define JOY_ISCAL_Z 0x00000002l /* Z is calibrated */ +#define JOY_ISCAL_R 0x00000004l /* R is calibrated */ +#define JOY_ISCAL_U 0x00000008l /* U is calibrated */ +#define JOY_ISCAL_V 0x00000010l /* V is calibrated */ +#define JOY_ISCAL_POV 0x00000020l /* POV is calibrated */ + +/* point of view constants */ +#define JOY_POV_NUMDIRS 4 +#define JOY_POVVAL_FORWARD 0 +#define JOY_POVVAL_BACKWARD 1 +#define JOY_POVVAL_LEFT 2 +#define JOY_POVVAL_RIGHT 3 + +/* Specific settings for joystick hardware */ +#define JOY_HWS_HASZ 0x00000001l /* has Z info? */ +#define JOY_HWS_HASPOV 0x00000002l /* point of view hat present */ +#define JOY_HWS_POVISBUTTONCOMBOS 0x00000004l /* pov done through combo of buttons */ +#define JOY_HWS_POVISPOLL 0x00000008l /* pov done through polling */ +#define JOY_HWS_ISYOKE 0x00000010l /* joystick is a flight yoke */ +#define JOY_HWS_ISGAMEPAD 0x00000020l /* joystick is a game pad */ +#define JOY_HWS_ISCARCTRL 0x00000040l /* joystick is a car controller */ +/* X defaults to J1 X axis */ +#define JOY_HWS_XISJ1Y 0x00000080l /* X is on J1 Y axis */ +#define JOY_HWS_XISJ2X 0x00000100l /* X is on J2 X axis */ +#define JOY_HWS_XISJ2Y 0x00000200l /* X is on J2 Y axis */ +/* Y defaults to J1 Y axis */ +#define JOY_HWS_YISJ1X 0x00000400l /* Y is on J1 X axis */ +#define JOY_HWS_YISJ2X 0x00000800l /* Y is on J2 X axis */ +#define JOY_HWS_YISJ2Y 0x00001000l /* Y is on J2 Y axis */ +/* Z defaults to J2 Y axis */ +#define JOY_HWS_ZISJ1X 0x00002000l /* Z is on J1 X axis */ +#define JOY_HWS_ZISJ1Y 0x00004000l /* Z is on J1 Y axis */ +#define JOY_HWS_ZISJ2X 0x00008000l /* Z is on J2 X axis */ +/* POV defaults to J2 Y axis, if it is not button based */ +#define JOY_HWS_POVISJ1X 0x00010000l /* pov done through J1 X axis */ +#define JOY_HWS_POVISJ1Y 0x00020000l /* pov done through J1 Y axis */ +#define JOY_HWS_POVISJ2X 0x00040000l /* pov done through J2 X axis */ +/* R defaults to J2 X axis */ +#define JOY_HWS_HASR 0x00080000l /* has R (4th axis) info */ +#define JOY_HWS_RISJ1X 0x00100000l /* R done through J1 X axis */ +#define JOY_HWS_RISJ1Y 0x00200000l /* R done through J1 Y axis */ +#define JOY_HWS_RISJ2Y 0x00400000l /* R done through J2 X axis */ +/* U & V for future hardware */ +#define JOY_HWS_HASU 0x00800000l /* has U (5th axis) info */ +#define JOY_HWS_HASV 0x01000000l /* has V (6th axis) info */ + +/* Usage settings */ +#define JOY_US_HASRUDDER 0x00000001l /* joystick configured with rudder */ +#define JOY_US_PRESENT 0x00000002l /* is joystick actually present? */ +#define JOY_US_ISOEM 0x00000004l /* joystick is an OEM defined type */ + +/* reserved for future use -> as link to next possible dword */ +#define JOY_US_RESERVED 0x80000000l /* reserved */ + + +/* Settings for TypeInfo Flags1 */ +#define JOYTYPE_ZEROGAMEENUMOEMDATA 0x00000001l /* Zero GameEnum's OEM data field */ +#define JOYTYPE_NOAUTODETECTGAMEPORT 0x00000002l /* Device does not support Autodetect gameport*/ +#define JOYTYPE_NOHIDDIRECT 0x00000004l /* Do not use HID directly for this device */ +#define JOYTYPE_ANALOGCOMPAT 0x00000008l /* Expose the analog compatible ID */ +#define JOYTYPE_DEFAULTPROPSHEET 0x80000000l /* CPL overrides custom property sheet */ + +/* Settings for TypeInfo Flags2 */ +#define JOYTYPE_DEVICEHIDE 0x00010000l /* Hide unclassified devices */ +#define JOYTYPE_MOUSEHIDE 0x00020000l /* Hide mice */ +#define JOYTYPE_KEYBHIDE 0x00040000l /* Hide keyboards */ +#define JOYTYPE_GAMEHIDE 0x00080000l /* Hide game controllers */ +#define JOYTYPE_HIDEACTIVE 0x00100000l /* Hide flags are active */ +#define JOYTYPE_INFOMASK 0x00E00000l /* Mask for type specific info */ +#define JOYTYPE_INFODEFAULT 0x00000000l /* Use default axis mappings */ +#define JOYTYPE_INFOYYPEDALS 0x00200000l /* Use Y as a combined pedals axis */ +#define JOYTYPE_INFOZYPEDALS 0x00400000l /* Use Z for accelerate, Y for brake */ +#define JOYTYPE_INFOYRPEDALS 0x00600000l /* Use Y for accelerate, R for brake */ +#define JOYTYPE_INFOZRPEDALS 0x00800000l /* Use Z for accelerate, R for brake */ +#define JOYTYPE_INFOZISSLIDER 0x00200000l /* Use Z as a slider */ +#define JOYTYPE_INFOZISZ 0x00400000l /* Use Z as Z axis */ +#define JOYTYPE_ENABLEINPUTREPORT 0x01000000l /* Enable initial input reports */ + +/* struct for storing x,y, z, and rudder values */ +typedef struct joypos_tag { + DWORD dwX; + DWORD dwY; + DWORD dwZ; + DWORD dwR; + DWORD dwU; + DWORD dwV; +} JOYPOS, FAR *LPJOYPOS; + +/* struct for storing ranges */ +typedef struct joyrange_tag { + JOYPOS jpMin; + JOYPOS jpMax; + JOYPOS jpCenter; +} JOYRANGE,FAR *LPJOYRANGE; + +/* + * dwTimeout - value at which to timeout joystick polling + * jrvRanges - range of values app wants returned for axes + * jpDeadZone - area around center to be considered + * as "dead". specified as a percentage + * (0-100). Only X & Y handled by system driver + */ +typedef struct joyreguservalues_tag { + DWORD dwTimeOut; + JOYRANGE jrvRanges; + JOYPOS jpDeadZone; +} JOYREGUSERVALUES, FAR *LPJOYREGUSERVALUES; + +typedef struct joyreghwsettings_tag { + DWORD dwFlags; + DWORD dwNumButtons; +} JOYREGHWSETTINGS, FAR *LPJOYHWSETTINGS; + +/* range of values returned by the hardware (filled in by calibration) */ +/* + * jrvHardware - values returned by hardware + * dwPOVValues - POV values returned by hardware + * dwCalFlags - what has been calibrated + */ +typedef struct joyreghwvalues_tag { + JOYRANGE jrvHardware; + DWORD dwPOVValues[JOY_POV_NUMDIRS]; + DWORD dwCalFlags; +} JOYREGHWVALUES, FAR *LPJOYREGHWVALUES; + +/* hardware configuration */ +/* + * hws - hardware settings + * dwUsageSettings - usage settings + * hwv - values returned by hardware + * dwType - type of joystick + * dwReserved - reserved for OEM drivers + */ +typedef struct joyreghwconfig_tag { + JOYREGHWSETTINGS hws; + DWORD dwUsageSettings; + JOYREGHWVALUES hwv; + DWORD dwType; + DWORD dwReserved; +} JOYREGHWCONFIG, FAR *LPJOYREGHWCONFIG; + +/* joystick calibration info structure */ +typedef struct joycalibrate_tag { + UINT wXbase; + UINT wXdelta; + UINT wYbase; + UINT wYdelta; + UINT wZbase; + UINT wZdelta; +} JOYCALIBRATE; +typedef JOYCALIBRATE FAR *LPJOYCALIBRATE; + +#endif + +#ifndef DIJ_RINGZERO + +#define MAX_JOYSTRING 256 +typedef BOOL (FAR PASCAL * LPDIJOYTYPECALLBACK)(LPCWSTR, LPVOID); + +#ifndef MAX_JOYSTICKOEMVXDNAME +#define MAX_JOYSTICKOEMVXDNAME 260 +#endif + +#define DITC_REGHWSETTINGS 0x00000001 +#define DITC_CLSIDCONFIG 0x00000002 +#define DITC_DISPLAYNAME 0x00000004 +#define DITC_CALLOUT 0x00000008 +#define DITC_HARDWAREID 0x00000010 +#define DITC_FLAGS1 0x00000020 +#define DITC_FLAGS2 0x00000040 +#define DITC_MAPFILE 0x00000080 + + + +/* This structure is defined for DirectX 5.0 compatibility */ + +typedef struct DIJOYTYPEINFO_DX5 { + DWORD dwSize; + JOYREGHWSETTINGS hws; + CLSID clsidConfig; + WCHAR wszDisplayName[MAX_JOYSTRING]; + WCHAR wszCallout[MAX_JOYSTICKOEMVXDNAME]; +} DIJOYTYPEINFO_DX5, *LPDIJOYTYPEINFO_DX5; +typedef const DIJOYTYPEINFO_DX5 *LPCDIJOYTYPEINFO_DX5; + +/* This structure is defined for DirectX 6.1 compatibility */ +typedef struct DIJOYTYPEINFO_DX6 { + DWORD dwSize; + JOYREGHWSETTINGS hws; + CLSID clsidConfig; + WCHAR wszDisplayName[MAX_JOYSTRING]; + WCHAR wszCallout[MAX_JOYSTICKOEMVXDNAME]; + WCHAR wszHardwareId[MAX_JOYSTRING]; + DWORD dwFlags1; +} DIJOYTYPEINFO_DX6, *LPDIJOYTYPEINFO_DX6; +typedef const DIJOYTYPEINFO_DX6 *LPCDIJOYTYPEINFO_DX6; + +typedef struct DIJOYTYPEINFO { + DWORD dwSize; + JOYREGHWSETTINGS hws; + CLSID clsidConfig; + WCHAR wszDisplayName[MAX_JOYSTRING]; + WCHAR wszCallout[MAX_JOYSTICKOEMVXDNAME]; +#if(DIRECTINPUT_VERSION >= 0x05b2) + WCHAR wszHardwareId[MAX_JOYSTRING]; + DWORD dwFlags1; +#if(DIRECTINPUT_VERSION >= 0x0800) + DWORD dwFlags2; + WCHAR wszMapFile[MAX_JOYSTRING]; +#endif /* DIRECTINPUT_VERSION >= 0x0800 */ +#endif /* DIRECTINPUT_VERSION >= 0x05b2 */ +} DIJOYTYPEINFO, *LPDIJOYTYPEINFO; +typedef const DIJOYTYPEINFO *LPCDIJOYTYPEINFO; +#define DIJC_GUIDINSTANCE 0x00000001 +#define DIJC_REGHWCONFIGTYPE 0x00000002 +#define DIJC_GAIN 0x00000004 +#define DIJC_CALLOUT 0x00000008 +#define DIJC_WDMGAMEPORT 0x00000010 + +/* This structure is defined for DirectX 5.0 compatibility */ + +typedef struct DIJOYCONFIG_DX5 { + DWORD dwSize; + GUID guidInstance; + JOYREGHWCONFIG hwc; + DWORD dwGain; + WCHAR wszType[MAX_JOYSTRING]; + WCHAR wszCallout[MAX_JOYSTRING]; +} DIJOYCONFIG_DX5, *LPDIJOYCONFIG_DX5; +typedef const DIJOYCONFIG_DX5 *LPCDIJOYCONFIG_DX5; + +typedef struct DIJOYCONFIG { + DWORD dwSize; + GUID guidInstance; + JOYREGHWCONFIG hwc; + DWORD dwGain; + WCHAR wszType[MAX_JOYSTRING]; + WCHAR wszCallout[MAX_JOYSTRING]; +#if(DIRECTINPUT_VERSION >= 0x05b2) + GUID guidGameport; +#endif /* DIRECTINPUT_VERSION >= 0x05b2 */ + } DIJOYCONFIG, *LPDIJOYCONFIG; +typedef const DIJOYCONFIG *LPCDIJOYCONFIG; + + +#define DIJU_USERVALUES 0x00000001 +#define DIJU_GLOBALDRIVER 0x00000002 +#define DIJU_GAMEPORTEMULATOR 0x00000004 + +typedef struct DIJOYUSERVALUES { + DWORD dwSize; + JOYREGUSERVALUES ruv; + WCHAR wszGlobalDriver[MAX_JOYSTRING]; + WCHAR wszGameportEmulator[MAX_JOYSTRING]; +} DIJOYUSERVALUES, *LPDIJOYUSERVALUES; +typedef const DIJOYUSERVALUES *LPCDIJOYUSERVALUES; + +DEFINE_GUID(GUID_KeyboardClass, 0x4D36E96B,0xE325,0x11CE,0xBF,0xC1,0x08,0x00,0x2B,0xE1,0x03,0x18); +DEFINE_GUID(GUID_MediaClass, 0x4D36E96C,0xE325,0x11CE,0xBF,0xC1,0x08,0x00,0x2B,0xE1,0x03,0x18); +DEFINE_GUID(GUID_MouseClass, 0x4D36E96F,0xE325,0x11CE,0xBF,0xC1,0x08,0x00,0x2B,0xE1,0x03,0x18); +DEFINE_GUID(GUID_HIDClass, 0x745A17A0,0x74D3,0x11D0,0xB6,0xFE,0x00,0xA0,0xC9,0x0F,0x57,0xDA); + +#undef INTERFACE +#define INTERFACE IDirectInputJoyConfig + +DECLARE_INTERFACE_(IDirectInputJoyConfig, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputJoyConfig methods ***/ + STDMETHOD(Acquire)(THIS) PURE; + STDMETHOD(Unacquire)(THIS) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(SendNotify)(THIS) PURE; + STDMETHOD(EnumTypes)(THIS_ LPDIJOYTYPECALLBACK,LPVOID) PURE; + STDMETHOD(GetTypeInfo)(THIS_ LPCWSTR,LPDIJOYTYPEINFO,DWORD) PURE; + STDMETHOD(SetTypeInfo)(THIS_ LPCWSTR,LPCDIJOYTYPEINFO,DWORD) PURE; + STDMETHOD(DeleteType)(THIS_ LPCWSTR) PURE; + STDMETHOD(GetConfig)(THIS_ UINT,LPDIJOYCONFIG,DWORD) PURE; + STDMETHOD(SetConfig)(THIS_ UINT,LPCDIJOYCONFIG,DWORD) PURE; + STDMETHOD(DeleteConfig)(THIS_ UINT) PURE; + STDMETHOD(GetUserValues)(THIS_ LPDIJOYUSERVALUES,DWORD) PURE; + STDMETHOD(SetUserValues)(THIS_ LPCDIJOYUSERVALUES,DWORD) PURE; + STDMETHOD(AddNewHardware)(THIS_ HWND,REFGUID) PURE; + STDMETHOD(OpenTypeKey)(THIS_ LPCWSTR,DWORD,PHKEY) PURE; + STDMETHOD(OpenConfigKey)(THIS_ UINT,DWORD,PHKEY) PURE; +}; + +typedef struct IDirectInputJoyConfig *LPDIRECTINPUTJOYCONFIG; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectInputJoyConfig_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectInputJoyConfig_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectInputJoyConfig_Release(p) (p)->lpVtbl->Release(p) +#define IDirectInputJoyConfig_Acquire(p) (p)->lpVtbl->Acquire(p) +#define IDirectInputJoyConfig_Unacquire(p) (p)->lpVtbl->Unacquire(p) +#define IDirectInputJoyConfig_SetCooperativeLevel(p,a,b) (p)->lpVtbl->SetCooperativeLevel(p,a,b) +#define IDirectInputJoyConfig_SendNotify(p) (p)->lpVtbl->SendNotify(p) +#define IDirectInputJoyConfig_EnumTypes(p,a,b) (p)->lpVtbl->EnumTypes(p,a,b) +#define IDirectInputJoyConfig_GetTypeInfo(p,a,b,c) (p)->lpVtbl->GetTypeInfo(p,a,b,c) +#define IDirectInputJoyConfig_SetTypeInfo(p,a,b,c) (p)->lpVtbl->SetTypeInfo(p,a,b,c) +#define IDirectInputJoyConfig_DeleteType(p,a) (p)->lpVtbl->DeleteType(p,a) +#define IDirectInputJoyConfig_GetConfig(p,a,b,c) (p)->lpVtbl->GetConfig(p,a,b,c) +#define IDirectInputJoyConfig_SetConfig(p,a,b,c) (p)->lpVtbl->SetConfig(p,a,b,c) +#define IDirectInputJoyConfig_DeleteConfig(p,a) (p)->lpVtbl->DeleteConfig(p,a) +#define IDirectInputJoyConfig_GetUserValues(p,a,b) (p)->lpVtbl->GetUserValues(p,a,b) +#define IDirectInputJoyConfig_SetUserValues(p,a,b) (p)->lpVtbl->SetUserValues(p,a,b) +#define IDirectInputJoyConfig_AddNewHardware(p,a,b) (p)->lpVtbl->AddNewHardware(p,a,b) +#define IDirectInputJoyConfig_OpenTypeKey(p,a,b,c) (p)->lpVtbl->OpenTypeKey(p,a,b,c) +#define IDirectInputJoyConfig_OpenConfigKey(p,a,b,c) (p)->lpVtbl->OpenConfigKey(p,a,b,c) +#else +#define IDirectInputJoyConfig_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectInputJoyConfig_AddRef(p) (p)->AddRef() +#define IDirectInputJoyConfig_Release(p) (p)->Release() +#define IDirectInputJoyConfig_Acquire(p) (p)->Acquire() +#define IDirectInputJoyConfig_Unacquire(p) (p)->Unacquire() +#define IDirectInputJoyConfig_SetCooperativeLevel(p,a,b) (p)->SetCooperativeLevel(a,b) +#define IDirectInputJoyConfig_SendNotify(p) (p)->SendNotify() +#define IDirectInputJoyConfig_EnumTypes(p,a,b) (p)->EnumTypes(a,b) +#define IDirectInputJoyConfig_GetTypeInfo(p,a,b,c) (p)->GetTypeInfo(a,b,c) +#define IDirectInputJoyConfig_SetTypeInfo(p,a,b,c) (p)->SetTypeInfo(a,b,c) +#define IDirectInputJoyConfig_DeleteType(p,a) (p)->DeleteType(a) +#define IDirectInputJoyConfig_GetConfig(p,a,b,c) (p)->GetConfig(a,b,c) +#define IDirectInputJoyConfig_SetConfig(p,a,b,c) (p)->SetConfig(a,b,c) +#define IDirectInputJoyConfig_DeleteConfig(p,a) (p)->DeleteConfig(a) +#define IDirectInputJoyConfig_GetUserValues(p,a,b) (p)->GetUserValues(a,b) +#define IDirectInputJoyConfig_SetUserValues(p,a,b) (p)->SetUserValues(a,b) +#define IDirectInputJoyConfig_AddNewHardware(p,a,b) (p)->AddNewHardware(a,b) +#define IDirectInputJoyConfig_OpenTypeKey(p,a,b,c) (p)->OpenTypeKey(a,b,c) +#define IDirectInputJoyConfig_OpenConfigKey(p,a,b,c) (p)->OpenConfigKey(a,b,c) +#endif + +#endif /* DIJ_RINGZERO */ + +#if(DIRECTINPUT_VERSION >= 0x0800) + +#ifndef DIJ_RINGZERO + +#undef INTERFACE +#define INTERFACE IDirectInputJoyConfig8 + +DECLARE_INTERFACE_(IDirectInputJoyConfig8, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirectInputJoyConfig8 methods ***/ + STDMETHOD(Acquire)(THIS) PURE; + STDMETHOD(Unacquire)(THIS) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND,DWORD) PURE; + STDMETHOD(SendNotify)(THIS) PURE; + STDMETHOD(EnumTypes)(THIS_ LPDIJOYTYPECALLBACK,LPVOID) PURE; + STDMETHOD(GetTypeInfo)(THIS_ LPCWSTR,LPDIJOYTYPEINFO,DWORD) PURE; + STDMETHOD(SetTypeInfo)(THIS_ LPCWSTR,LPCDIJOYTYPEINFO,DWORD,LPWSTR) PURE; + STDMETHOD(DeleteType)(THIS_ LPCWSTR) PURE; + STDMETHOD(GetConfig)(THIS_ UINT,LPDIJOYCONFIG,DWORD) PURE; + STDMETHOD(SetConfig)(THIS_ UINT,LPCDIJOYCONFIG,DWORD) PURE; + STDMETHOD(DeleteConfig)(THIS_ UINT) PURE; + STDMETHOD(GetUserValues)(THIS_ LPDIJOYUSERVALUES,DWORD) PURE; + STDMETHOD(SetUserValues)(THIS_ LPCDIJOYUSERVALUES,DWORD) PURE; + STDMETHOD(AddNewHardware)(THIS_ HWND,REFGUID) PURE; + STDMETHOD(OpenTypeKey)(THIS_ LPCWSTR,DWORD,PHKEY) PURE; + STDMETHOD(OpenAppStatusKey)(THIS_ PHKEY) PURE; +}; + +typedef struct IDirectInputJoyConfig8 *LPDIRECTINPUTJOYCONFIG8; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectInputJoyConfig8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirectInputJoyConfig8_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirectInputJoyConfig8_Release(p) (p)->lpVtbl->Release(p) +#define IDirectInputJoyConfig8_Acquire(p) (p)->lpVtbl->Acquire(p) +#define IDirectInputJoyConfig8_Unacquire(p) (p)->lpVtbl->Unacquire(p) +#define IDirectInputJoyConfig8_SetCooperativeLevel(p,a,b) (p)->lpVtbl->SetCooperativeLevel(p,a,b) +#define IDirectInputJoyConfig8_SendNotify(p) (p)->lpVtbl->SendNotify(p) +#define IDirectInputJoyConfig8_EnumTypes(p,a,b) (p)->lpVtbl->EnumTypes(p,a,b) +#define IDirectInputJoyConfig8_GetTypeInfo(p,a,b,c) (p)->lpVtbl->GetTypeInfo(p,a,b,c) +#define IDirectInputJoyConfig8_SetTypeInfo(p,a,b,c,d) (p)->lpVtbl->SetTypeInfo(p,a,b,c,d) +#define IDirectInputJoyConfig8_DeleteType(p,a) (p)->lpVtbl->DeleteType(p,a) +#define IDirectInputJoyConfig8_GetConfig(p,a,b,c) (p)->lpVtbl->GetConfig(p,a,b,c) +#define IDirectInputJoyConfig8_SetConfig(p,a,b,c) (p)->lpVtbl->SetConfig(p,a,b,c) +#define IDirectInputJoyConfig8_DeleteConfig(p,a) (p)->lpVtbl->DeleteConfig(p,a) +#define IDirectInputJoyConfig8_GetUserValues(p,a,b) (p)->lpVtbl->GetUserValues(p,a,b) +#define IDirectInputJoyConfig8_SetUserValues(p,a,b) (p)->lpVtbl->SetUserValues(p,a,b) +#define IDirectInputJoyConfig8_AddNewHardware(p,a,b) (p)->lpVtbl->AddNewHardware(p,a,b) +#define IDirectInputJoyConfig8_OpenTypeKey(p,a,b,c) (p)->lpVtbl->OpenTypeKey(p,a,b,c) +#define IDirectInputJoyConfig8_OpenAppStatusKey(p,a) (p)->lpVtbl->OpenAppStatusKey(p,a) +#else +#define IDirectInputJoyConfig8_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirectInputJoyConfig8_AddRef(p) (p)->AddRef() +#define IDirectInputJoyConfig8_Release(p) (p)->Release() +#define IDirectInputJoyConfig8_Acquire(p) (p)->Acquire() +#define IDirectInputJoyConfig8_Unacquire(p) (p)->Unacquire() +#define IDirectInputJoyConfig8_SetCooperativeLevel(p,a,b) (p)->SetCooperativeLevel(a,b) +#define IDirectInputJoyConfig8_SendNotify(p) (p)->SendNotify() +#define IDirectInputJoyConfig8_EnumTypes(p,a,b) (p)->EnumTypes(a,b) +#define IDirectInputJoyConfig8_GetTypeInfo(p,a,b,c) (p)->GetTypeInfo(a,b,c) +#define IDirectInputJoyConfig8_SetTypeInfo(p,a,b,c,d) (p)->SetTypeInfo(a,b,c,d) +#define IDirectInputJoyConfig8_DeleteType(p,a) (p)->DeleteType(a) +#define IDirectInputJoyConfig8_GetConfig(p,a,b,c) (p)->GetConfig(a,b,c) +#define IDirectInputJoyConfig8_SetConfig(p,a,b,c) (p)->SetConfig(a,b,c) +#define IDirectInputJoyConfig8_DeleteConfig(p,a) (p)->DeleteConfig(a) +#define IDirectInputJoyConfig8_GetUserValues(p,a,b) (p)->GetUserValues(a,b) +#define IDirectInputJoyConfig8_SetUserValues(p,a,b) (p)->SetUserValues(a,b) +#define IDirectInputJoyConfig8_AddNewHardware(p,a,b) (p)->AddNewHardware(a,b) +#define IDirectInputJoyConfig8_OpenTypeKey(p,a,b,c) (p)->OpenTypeKey(a,b,c) +#define IDirectInputJoyConfig8_OpenAppStatusKey(p,a) (p)->OpenAppStatusKey(a) +#endif + +#endif /* DIJ_RINGZERO */ + +/**************************************************************************** + * + * Notification Messages + * + ****************************************************************************/ + +/* RegisterWindowMessage with this to get DirectInput notification messages */ +#define DIRECTINPUT_NOTIFICATION_MSGSTRINGA "DIRECTINPUT_NOTIFICATION_MSGSTRING" +#define DIRECTINPUT_NOTIFICATION_MSGSTRINGW L"DIRECTINPUT_NOTIFICATION_MSGSTRING" + +#ifdef UNICODE +#define DIRECTINPUT_NOTIFICATION_MSGSTRING DIRECTINPUT_NOTIFICATION_MSGSTRINGW +#else +#define DIRECTINPUT_NOTIFICATION_MSGSTRING DIRECTINPUT_NOTIFICATION_MSGSTRINGA +#endif + +#define DIMSGWP_NEWAPPSTART 0x00000001 +#define DIMSGWP_DX8APPSTART 0x00000002 +#define DIMSGWP_DX8MAPPERAPPSTART 0x00000003 + +#endif /* DIRECTINPUT_VERSION >= 0x0800 */ + +#define DIAPPIDFLAG_NOTIME 0x00000001 +#define DIAPPIDFLAG_NOSIZE 0x00000002 + +#define DIRECTINPUT_REGSTR_VAL_APPIDFLAGA "AppIdFlag" +#define DIRECTINPUT_REGSTR_KEY_LASTAPPA "MostRecentApplication" +#define DIRECTINPUT_REGSTR_KEY_LASTMAPAPPA "MostRecentMapperApplication" +#define DIRECTINPUT_REGSTR_VAL_VERSIONA "Version" +#define DIRECTINPUT_REGSTR_VAL_NAMEA "Name" +#define DIRECTINPUT_REGSTR_VAL_IDA "Id" +#define DIRECTINPUT_REGSTR_VAL_MAPPERA "UsesMapper" +#define DIRECTINPUT_REGSTR_VAL_LASTSTARTA "MostRecentStart" + +#define DIRECTINPUT_REGSTR_VAL_APPIDFLAGW L"AppIdFlag" +#define DIRECTINPUT_REGSTR_KEY_LASTAPPW L"MostRecentApplication" +#define DIRECTINPUT_REGSTR_KEY_LASTMAPAPPW L"MostRecentMapperApplication" +#define DIRECTINPUT_REGSTR_VAL_VERSIONW L"Version" +#define DIRECTINPUT_REGSTR_VAL_NAMEW L"Name" +#define DIRECTINPUT_REGSTR_VAL_IDW L"Id" +#define DIRECTINPUT_REGSTR_VAL_MAPPERW L"UsesMapper" +#define DIRECTINPUT_REGSTR_VAL_LASTSTARTW L"MostRecentStart" + +#ifdef UNICODE +#define DIRECTINPUT_REGSTR_VAL_APPIDFLAG DIRECTINPUT_REGSTR_VAL_APPIDFLAGW +#define DIRECTINPUT_REGSTR_KEY_LASTAPP DIRECTINPUT_REGSTR_KEY_LASTAPPW +#define DIRECTINPUT_REGSTR_KEY_LASTMAPAPP DIRECTINPUT_REGSTR_KEY_LASTMAPAPPW +#define DIRECTINPUT_REGSTR_VAL_VERSION DIRECTINPUT_REGSTR_VAL_VERSIONW +#define DIRECTINPUT_REGSTR_VAL_NAME DIRECTINPUT_REGSTR_VAL_NAMEW +#define DIRECTINPUT_REGSTR_VAL_ID DIRECTINPUT_REGSTR_VAL_IDW +#define DIRECTINPUT_REGSTR_VAL_MAPPER DIRECTINPUT_REGSTR_VAL_MAPPERW +#define DIRECTINPUT_REGSTR_VAL_LASTSTART DIRECTINPUT_REGSTR_VAL_LASTSTARTW +#else +#define DIRECTINPUT_REGSTR_VAL_APPIDFLAG DIRECTINPUT_REGSTR_VAL_APPIDFLAGA +#define DIRECTINPUT_REGSTR_KEY_LASTAPP DIRECTINPUT_REGSTR_KEY_LASTAPPA +#define DIRECTINPUT_REGSTR_KEY_LASTMAPAPP DIRECTINPUT_REGSTR_KEY_LASTMAPAPPA +#define DIRECTINPUT_REGSTR_VAL_VERSION DIRECTINPUT_REGSTR_VAL_VERSIONA +#define DIRECTINPUT_REGSTR_VAL_NAME DIRECTINPUT_REGSTR_VAL_NAMEA +#define DIRECTINPUT_REGSTR_VAL_ID DIRECTINPUT_REGSTR_VAL_IDA +#define DIRECTINPUT_REGSTR_VAL_MAPPER DIRECTINPUT_REGSTR_VAL_MAPPERA +#define DIRECTINPUT_REGSTR_VAL_LASTSTART DIRECTINPUT_REGSTR_VAL_LASTSTARTA +#endif + + +/**************************************************************************** + * + * Return Codes + * + ****************************************************************************/ + +#define DIERR_NOMOREITEMS \ + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_NO_MORE_ITEMS) + +/* + * Device driver-specific codes. + */ + +#define DIERR_DRIVERFIRST 0x80040300L +#define DIERR_DRIVERLAST 0x800403FFL + +/* + * Unless the specific driver has been precisely identified, no meaning + * should be attributed to these values other than that the driver + * originated the error. However, to illustrate the types of error that + * may be causing the failure, the PID force feedback driver distributed + * with DirectX 7 could return the following errors: + * + * DIERR_DRIVERFIRST + 1 + * The requested usage was not found. + * DIERR_DRIVERFIRST + 2 + * The parameter block couldn't be downloaded to the device. + * DIERR_DRIVERFIRST + 3 + * PID initialization failed. + * DIERR_DRIVERFIRST + 4 + * The provided values couldn't be scaled. + */ + + +/* + * Device installer errors. + */ + +/* + * Registry entry or DLL for class installer invalid + * or class installer not found. + */ +#define DIERR_INVALIDCLASSINSTALLER 0x80040400L + +/* + * The user cancelled the install operation. + */ +#define DIERR_CANCELLED 0x80040401L + +/* + * The INF file for the selected device could not be + * found or is invalid or is damaged. + */ +#define DIERR_BADINF 0x80040402L + +/**************************************************************************** + * + * Map files + * + ****************************************************************************/ + +/* + * Delete particular data from default map file. + */ +#define DIDIFT_DELETE 0x01000000 + +#ifdef __cplusplus +}; +#endif + +#endif /* __DINPUTD_INCLUDED__ */ diff --git a/MediaClient/MediaClient/directx/include/dsconf.h b/MediaClient/MediaClient/directx/include/dsconf.h new file mode 100644 index 0000000..018f65a --- /dev/null +++ b/MediaClient/MediaClient/directx/include/dsconf.h @@ -0,0 +1,195 @@ +/*==========================================================================; + * + * Copyright (c) Microsoft Corporation. All rights reserved. + * + * File: dsconf.h + * Content: DirectSound configuration interface include file + * + **************************************************************************/ + +#ifndef __DSCONF_INCLUDED__ +#define __DSCONF_INCLUDED__ + +#ifndef __DSOUND_INCLUDED__ +#error dsound.h not included +#endif // __DSOUND_INCLUDED__ + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + + +// DirectSound Private Component GUID {11AB3EC0-25EC-11d1-A4D8-00C04FC28ACA} +DEFINE_GUID(CLSID_DirectSoundPrivate, 0x11ab3ec0, 0x25ec, 0x11d1, 0xa4, 0xd8, 0x0, 0xc0, 0x4f, 0xc2, 0x8a, 0xca); + + +// +// DirectSound Device Properties {84624F82-25EC-11d1-A4D8-00C04FC28ACA} +// + +DEFINE_GUID(DSPROPSETID_DirectSoundDevice, 0x84624f82, 0x25ec, 0x11d1, 0xa4, 0xd8, 0x0, 0xc0, 0x4f, 0xc2, 0x8a, 0xca); + +typedef enum +{ + DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A = 1, + DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1 = 2, + DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1 = 3, + DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W = 4, + DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A = 5, + DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W = 6, + DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A = 7, + DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W = 8, +} DSPROPERTY_DIRECTSOUNDDEVICE; + +#if DIRECTSOUND_VERSION >= 0x0700 +#ifdef UNICODE +#define DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W +#define DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W +#define DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W +#else // UNICODE +#define DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A +#define DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A +#define DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A +#endif // UNICODE +#else // DIRECTSOUND_VERSION >= 0x0700 +#define DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A +#define DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1 +#define DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1 +#endif // DIRECTSOUND_VERSION >= 0x0700 + +typedef enum +{ + DIRECTSOUNDDEVICE_TYPE_EMULATED, + DIRECTSOUNDDEVICE_TYPE_VXD, + DIRECTSOUNDDEVICE_TYPE_WDM +} DIRECTSOUNDDEVICE_TYPE; + +typedef enum +{ + DIRECTSOUNDDEVICE_DATAFLOW_RENDER, + DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE +} DIRECTSOUNDDEVICE_DATAFLOW; + + +typedef struct _DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A_DATA +{ + LPSTR DeviceName; // waveIn/waveOut device name + DIRECTSOUNDDEVICE_DATAFLOW DataFlow; // Data flow (i.e. waveIn or waveOut) + GUID DeviceId; // DirectSound device id +} DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A_DATA, *PDSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A_DATA; + +typedef struct _DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W_DATA +{ + LPWSTR DeviceName; // waveIn/waveOut device name + DIRECTSOUNDDEVICE_DATAFLOW DataFlow; // Data flow (i.e. waveIn or waveOut) + GUID DeviceId; // DirectSound device id +} DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W_DATA, *PDSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W_DATA; + +#ifdef UNICODE +#define DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_DATA DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W_DATA +#define PDSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_DATA PDSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W_DATA +#else // UNICODE +#define DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_DATA DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A_DATA +#define PDSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_DATA PDSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A_DATA +#endif // UNICODE + +typedef struct _DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1_DATA +{ + GUID DeviceId; // DirectSound device id + CHAR DescriptionA[0x100]; // Device description (ANSI) + WCHAR DescriptionW[0x100]; // Device description (Unicode) + CHAR ModuleA[MAX_PATH]; // Device driver module (ANSI) + WCHAR ModuleW[MAX_PATH]; // Device driver module (Unicode) + DIRECTSOUNDDEVICE_TYPE Type; // Device type + DIRECTSOUNDDEVICE_DATAFLOW DataFlow; // Device dataflow + ULONG WaveDeviceId; // Wave device id + ULONG Devnode; // Devnode (or DevInst) +} DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1_DATA, *PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1_DATA; + +typedef struct _DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A_DATA +{ + DIRECTSOUNDDEVICE_TYPE Type; // Device type + DIRECTSOUNDDEVICE_DATAFLOW DataFlow; // Device dataflow + GUID DeviceId; // DirectSound device id + LPSTR Description; // Device description + LPSTR Module; // Device driver module + LPSTR Interface; // Device interface + ULONG WaveDeviceId; // Wave device id +} DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A_DATA, *PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A_DATA; + +typedef struct _DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W_DATA +{ + DIRECTSOUNDDEVICE_TYPE Type; // Device type + DIRECTSOUNDDEVICE_DATAFLOW DataFlow; // Device dataflow + GUID DeviceId; // DirectSound device id + LPWSTR Description; // Device description + LPWSTR Module; // Device driver module + LPWSTR Interface; // Device interface + ULONG WaveDeviceId; // Wave device id +} DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W_DATA, *PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W_DATA; + +#if DIRECTSOUND_VERSION >= 0x0700 +#ifdef UNICODE +#define DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_DATA DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W_DATA +#define PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_DATA PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W_DATA +#else // UNICODE +#define DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_DATA DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A_DATA +#define PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_DATA PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A_DATA +#endif // UNICODE +#else // DIRECTSOUND_VERSION >= 0x0700 +#define DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_DATA DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1_DATA +#define PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_DATA PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1_DATA +#endif // DIRECTSOUND_VERSION >= 0x0700 + +typedef BOOL (CALLBACK *LPFNDIRECTSOUNDDEVICEENUMERATECALLBACK1)(PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1_DATA, LPVOID); +typedef BOOL (CALLBACK *LPFNDIRECTSOUNDDEVICEENUMERATECALLBACKA)(PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A_DATA, LPVOID); +typedef BOOL (CALLBACK *LPFNDIRECTSOUNDDEVICEENUMERATECALLBACKW)(PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W_DATA, LPVOID); + +#if DIRECTSOUND_VERSION >= 0x0700 +#ifdef UNICODE +#define LPFNDIRECTSOUNDDEVICEENUMERATECALLBACK LPFNDIRECTSOUNDDEVICEENUMERATECALLBACKW +#else // UNICODE +#define LPFNDIRECTSOUNDDEVICEENUMERATECALLBACK LPFNDIRECTSOUNDDEVICEENUMERATECALLBACKA +#endif // UNICODE +#else // DIRECTSOUND_VERSION >= 0x0700 +#define LPFNDIRECTSOUNDDEVICEENUMERATECALLBACK LPFNDIRECTSOUNDDEVICEENUMERATECALLBACK1 +#endif // DIRECTSOUND_VERSION >= 0x0700 + +typedef struct _DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1_DATA +{ + LPFNDIRECTSOUNDDEVICEENUMERATECALLBACK1 Callback; // Callback function pointer + LPVOID Context; // Callback function context argument +} DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1_DATA, *PDSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1_DATA; + +typedef struct _DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A_DATA +{ + LPFNDIRECTSOUNDDEVICEENUMERATECALLBACKA Callback; // Callback function pointer + LPVOID Context; // Callback function context argument +} DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A_DATA, *PDSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A_DATA; + +typedef struct _DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W_DATA +{ + LPFNDIRECTSOUNDDEVICEENUMERATECALLBACKW Callback; // Callback function pointer + LPVOID Context; // Callback function context argument +} DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W_DATA, *PDSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W_DATA; + +#if DIRECTSOUND_VERSION >= 0x0700 +#ifdef UNICODE +#define DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_DATA DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W_DATA +#define PDSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_DATA PDSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W_DATA +#else // UNICODE +#define DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_DATA DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A_DATA +#define PDSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_DATA PDSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A_DATA +#endif // UNICODE +#else // DIRECTSOUND_VERSION >= 0x0700 +#define DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_DATA DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1_DATA +#define PDSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_DATA PDSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1_DATA +#endif // DIRECTSOUND_VERSION >= 0x0700 + + +#ifdef __cplusplus +} +#endif // __cplusplus + +#endif // __DSCONF_INCLUDED__ + diff --git a/MediaClient/MediaClient/directx/include/dsetup.h b/MediaClient/MediaClient/directx/include/dsetup.h new file mode 100644 index 0000000..ebada13 --- /dev/null +++ b/MediaClient/MediaClient/directx/include/dsetup.h @@ -0,0 +1,283 @@ +/*========================================================================== + * + * Copyright (C) 1995-1997 Microsoft Corporation. All Rights Reserved. + * + * File: dsetup.h + * Content: DirectXSetup, error codes and flags + ***************************************************************************/ + +#ifndef __DSETUP_H__ +#define __DSETUP_H__ + +#include // windows stuff + +#ifdef __cplusplus +extern "C" { +#endif + +#define FOURCC_VERS mmioFOURCC('v','e','r','s') + +// DSETUP Error Codes, must remain compatible with previous setup. +#define DSETUPERR_SUCCESS_RESTART 1 +#define DSETUPERR_SUCCESS 0 +#define DSETUPERR_BADWINDOWSVERSION -1 +#define DSETUPERR_SOURCEFILENOTFOUND -2 +#define DSETUPERR_NOCOPY -5 +#define DSETUPERR_OUTOFDISKSPACE -6 +#define DSETUPERR_CANTFINDINF -7 +#define DSETUPERR_CANTFINDDIR -8 +#define DSETUPERR_INTERNAL -9 +#define DSETUPERR_UNKNOWNOS -11 +#define DSETUPERR_NEWERVERSION -14 +#define DSETUPERR_NOTADMIN -15 +#define DSETUPERR_UNSUPPORTEDPROCESSOR -16 +#define DSETUPERR_MISSINGCAB_MANAGEDDX -17 +#define DSETUPERR_NODOTNETFRAMEWORKINSTALLED -18 +#define DSETUPERR_CABDOWNLOADFAIL -19 +#define DSETUPERR_DXCOMPONENTFILEINUSE -20 +#define DSETUPERR_UNTRUSTEDCABINETFILE -21 + +// DSETUP flags. DirectX 5.0 apps should use these flags only. +#define DSETUP_DDRAWDRV 0x00000008 /* install DirectDraw Drivers */ +#define DSETUP_DSOUNDDRV 0x00000010 /* install DirectSound Drivers */ +#define DSETUP_DXCORE 0x00010000 /* install DirectX runtime */ +#define DSETUP_DIRECTX (DSETUP_DXCORE|DSETUP_DDRAWDRV|DSETUP_DSOUNDDRV) +#define DSETUP_MANAGEDDX 0x00004000 /* OBSOLETE. install managed DirectX */ +#define DSETUP_TESTINSTALL 0x00020000 /* just test install, don't do anything */ + +// These OBSOLETE flags are here for compatibility with pre-DX5 apps only. +// They are present to allow DX3 apps to be recompiled with DX5 and still work. +// DO NOT USE THEM for DX5. They will go away in future DX releases. +#define DSETUP_DDRAW 0x00000001 /* OBSOLETE. install DirectDraw */ +#define DSETUP_DSOUND 0x00000002 /* OBSOLETE. install DirectSound */ +#define DSETUP_DPLAY 0x00000004 /* OBSOLETE. install DirectPlay */ +#define DSETUP_DPLAYSP 0x00000020 /* OBSOLETE. install DirectPlay Providers */ +#define DSETUP_DVIDEO 0x00000040 /* OBSOLETE. install DirectVideo */ +#define DSETUP_D3D 0x00000200 /* OBSOLETE. install Direct3D */ +#define DSETUP_DINPUT 0x00000800 /* OBSOLETE. install DirectInput */ +#define DSETUP_DIRECTXSETUP 0x00001000 /* OBSOLETE. install DirectXSetup DLL's */ +#define DSETUP_NOUI 0x00002000 /* OBSOLETE. install DirectX with NO UI */ +#define DSETUP_PROMPTFORDRIVERS 0x10000000 /* OBSOLETE. prompt when replacing display/audio drivers */ +#define DSETUP_RESTOREDRIVERS 0x20000000 /* OBSOLETE. restore display/audio drivers */ + + + +//****************************************************************** +// DirectX Setup Callback mechanism +//****************************************************************** + +// DSETUP Message Info Codes, passed to callback as Reason parameter. +#define DSETUP_CB_MSG_NOMESSAGE 0 +#define DSETUP_CB_MSG_INTERNAL_ERROR 10 +#define DSETUP_CB_MSG_BEGIN_INSTALL 13 +#define DSETUP_CB_MSG_BEGIN_INSTALL_RUNTIME 14 +#define DSETUP_CB_MSG_PROGRESS 18 +#define DSETUP_CB_MSG_WARNING_DISABLED_COMPONENT 19 + + + + + + +typedef struct _DSETUP_CB_PROGRESS +{ + DWORD dwPhase; + DWORD dwInPhaseMaximum; + DWORD dwInPhaseProgress; + DWORD dwOverallMaximum; + DWORD dwOverallProgress; +} DSETUP_CB_PROGRESS; + + +enum _DSETUP_CB_PROGRESS_PHASE +{ + DSETUP_INITIALIZING, + DSETUP_EXTRACTING, + DSETUP_COPYING, + DSETUP_FINALIZING +}; + + +#ifdef _WIN32 +// +// Data Structures +// +#ifndef UNICODE_ONLY + +typedef struct _DIRECTXREGISTERAPPA { + DWORD dwSize; + DWORD dwFlags; + LPSTR lpszApplicationName; + LPGUID lpGUID; + LPSTR lpszFilename; + LPSTR lpszCommandLine; + LPSTR lpszPath; + LPSTR lpszCurrentDirectory; +} DIRECTXREGISTERAPPA, *PDIRECTXREGISTERAPPA, *LPDIRECTXREGISTERAPPA; + +typedef struct _DIRECTXREGISTERAPP2A { + DWORD dwSize; + DWORD dwFlags; + LPSTR lpszApplicationName; + LPGUID lpGUID; + LPSTR lpszFilename; + LPSTR lpszCommandLine; + LPSTR lpszPath; + LPSTR lpszCurrentDirectory; + LPSTR lpszLauncherName; +} DIRECTXREGISTERAPP2A, *PDIRECTXREGISTERAPP2A, *LPDIRECTXREGISTERAPP2A; + +#endif //!UNICODE_ONLY +#ifndef ANSI_ONLY + +typedef struct _DIRECTXREGISTERAPPW { + DWORD dwSize; + DWORD dwFlags; + LPWSTR lpszApplicationName; + LPGUID lpGUID; + LPWSTR lpszFilename; + LPWSTR lpszCommandLine; + LPWSTR lpszPath; + LPWSTR lpszCurrentDirectory; +} DIRECTXREGISTERAPPW, *PDIRECTXREGISTERAPPW, *LPDIRECTXREGISTERAPPW; + +typedef struct _DIRECTXREGISTERAPP2W { + DWORD dwSize; + DWORD dwFlags; + LPWSTR lpszApplicationName; + LPGUID lpGUID; + LPWSTR lpszFilename; + LPWSTR lpszCommandLine; + LPWSTR lpszPath; + LPWSTR lpszCurrentDirectory; + LPWSTR lpszLauncherName; +} DIRECTXREGISTERAPP2W, *PDIRECTXREGISTERAPP2W, *LPDIRECTXREGISTERAPP2W; +#endif //!ANSI_ONLY +#ifdef UNICODE +typedef DIRECTXREGISTERAPPW DIRECTXREGISTERAPP; +typedef PDIRECTXREGISTERAPPW PDIRECTXREGISTERAPP; +typedef LPDIRECTXREGISTERAPPW LPDIRECTXREGISTERAPP; +typedef DIRECTXREGISTERAPP2W DIRECTXREGISTERAPP2; +typedef PDIRECTXREGISTERAPP2W PDIRECTXREGISTERAPP2; +typedef LPDIRECTXREGISTERAPP2W LPDIRECTXREGISTERAPP2; +#else +typedef DIRECTXREGISTERAPPA DIRECTXREGISTERAPP; +typedef PDIRECTXREGISTERAPPA PDIRECTXREGISTERAPP; +typedef LPDIRECTXREGISTERAPPA LPDIRECTXREGISTERAPP; +typedef DIRECTXREGISTERAPP2A DIRECTXREGISTERAPP2; +typedef PDIRECTXREGISTERAPP2A PDIRECTXREGISTERAPP2; +typedef LPDIRECTXREGISTERAPP2A LPDIRECTXREGISTERAPP2; +#endif // UNICODE + + +// +// API +// + +#ifndef UNICODE_ONLY +INT +WINAPI +DirectXSetupA( + HWND hWnd, + __in_opt LPSTR lpszRootPath, + DWORD dwFlags + ); +#endif //!UNICODE_ONLY +#ifndef ANSI_ONLY +INT +WINAPI +DirectXSetupW( + HWND hWnd, + __in_opt LPWSTR lpszRootPath, + DWORD dwFlags + ); +#endif //!ANSI_ONLY +#ifdef UNICODE +#define DirectXSetup DirectXSetupW +#else +#define DirectXSetup DirectXSetupA +#endif // !UNICODE + +#ifndef UNICODE_ONLY +INT +WINAPI +DirectXRegisterApplicationA( + HWND hWnd, + LPVOID lpDXRegApp + ); +#endif //!UNICODE_ONLY +#ifndef ANSI_ONLY +INT +WINAPI +DirectXRegisterApplicationW( + HWND hWnd, + LPVOID lpDXRegApp + ); +#endif //!ANSI_ONLY +#ifdef UNICODE +#define DirectXRegisterApplication DirectXRegisterApplicationW +#else +#define DirectXRegisterApplication DirectXRegisterApplicationA +#endif // !UNICODE + +INT +WINAPI +DirectXUnRegisterApplication( + HWND hWnd, + LPGUID lpGUID + ); + +// +// Function Pointers +// +#ifdef UNICODE +typedef INT (WINAPI * LPDIRECTXSETUP)(HWND, LPWSTR, DWORD); +typedef INT (WINAPI * LPDIRECTXREGISTERAPPLICATION)(HWND, LPVOID); +#else +typedef INT (WINAPI * LPDIRECTXSETUP)(HWND, LPSTR, DWORD); +typedef INT (WINAPI * LPDIRECTXREGISTERAPPLICATION)(HWND, LPVOID); +#endif // UNICODE + +typedef DWORD (FAR PASCAL * DSETUP_CALLBACK)(DWORD Reason, + DWORD MsgType, /* Same as flags to MessageBox */ + LPSTR szMessage, + LPSTR szName, + void *pInfo); + +INT WINAPI DirectXSetupSetCallback(DSETUP_CALLBACK Callback); +INT WINAPI DirectXSetupGetVersion(DWORD *lpdwVersion, DWORD *lpdwMinorVersion); +INT WINAPI DirectXSetupShowEULA(HWND hWndParent); +#ifndef UNICODE_ONLY +UINT +WINAPI +DirectXSetupGetEULAA( + __out_ecount(cchEULA) LPSTR lpszEULA, + UINT cchEULA, + WORD LangID + ); +#endif //!UNICODE_ONLY +#ifndef ANSI_ONLY +UINT +WINAPI +DirectXSetupGetEULAW( + __out_ecount(cchEULA) LPWSTR lpszEULA, + UINT cchEULA, + WORD LangID + ); +#endif //!ANSI_ONLY +#ifdef UNICODE +#define DirectXSetupGetEULA DirectXSetupGetEULAW +typedef UINT (WINAPI * LPDIRECTXSETUPGETEULA)(LPWSTR, UINT, WORD); +#else +#define DirectXSetupGetEULA DirectXSetupGetEULAA +typedef UINT (WINAPI * LPDIRECTXSETUPGETEULA)(LPSTR, UINT, WORD); +#endif // !UNICODE + +#endif // WIN32 + + +#ifdef __cplusplus +}; +#endif + +#endif diff --git a/MediaClient/MediaClient/directx/include/dsound.h b/MediaClient/MediaClient/directx/include/dsound.h new file mode 100644 index 0000000..34e4c30 --- /dev/null +++ b/MediaClient/MediaClient/directx/include/dsound.h @@ -0,0 +1,2385 @@ +/*==========================================================================; + * + * Copyright (c) Microsoft Corporation. All rights reserved. + * + * File: dsound.h + * Content: DirectSound include file + * + **************************************************************************/ + +#define COM_NO_WINDOWS_H +#include +#include +#include + +#ifndef DIRECTSOUND_VERSION + +#if (NTDDI_VERSION < NTDDI_WINXP) /* Windows 2000 */ +#define DIRECTSOUND_VERSION 0x0700 /* Version 7.0 */ +#elif (NTDDI_VERSION < NTDDI_WINXPSP2 || NTDDI_VERSION == NTDDI_WS03) /* Windows XP and SP1, or Windows Server 2003 */ +#define DIRECTSOUND_VERSION 0x0800 /* Version 8.0 */ +#else /* Windows XP SP2 and higher, Windows Server 2003 SP1 and higher, Longhorn, or higher */ +#define DIRECTSOUND_VERSION 0x0900 /* Version 9.0 */ +#endif + +#endif // DIRECTSOUND_VERSION + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +#ifndef __DSOUND_INCLUDED__ +#define __DSOUND_INCLUDED__ + +/* Type definitions shared with Direct3D */ + +#ifndef DX_SHARED_DEFINES + +typedef float D3DVALUE, *LPD3DVALUE; + +#ifndef D3DCOLOR_DEFINED +typedef DWORD D3DCOLOR; +#define D3DCOLOR_DEFINED +#endif + +#ifndef LPD3DCOLOR_DEFINED +typedef DWORD *LPD3DCOLOR; +#define LPD3DCOLOR_DEFINED +#endif + +#ifndef D3DVECTOR_DEFINED +typedef struct _D3DVECTOR { + float x; + float y; + float z; +} D3DVECTOR; +#define D3DVECTOR_DEFINED +#endif + +#ifndef LPD3DVECTOR_DEFINED +typedef D3DVECTOR *LPD3DVECTOR; +#define LPD3DVECTOR_DEFINED +#endif + +#define DX_SHARED_DEFINES +#endif // DX_SHARED_DEFINES + +#define _FACDS 0x878 /* DirectSound's facility code */ +#define MAKE_DSHRESULT(code) MAKE_HRESULT(1, _FACDS, code) + +// DirectSound Component GUID {47D4D946-62E8-11CF-93BC-444553540000} +DEFINE_GUID(CLSID_DirectSound, 0x47d4d946, 0x62e8, 0x11cf, 0x93, 0xbc, 0x44, 0x45, 0x53, 0x54, 0x0, 0x0); + +// DirectSound 8.0 Component GUID {3901CC3F-84B5-4FA4-BA35-AA8172B8A09B} +DEFINE_GUID(CLSID_DirectSound8, 0x3901cc3f, 0x84b5, 0x4fa4, 0xba, 0x35, 0xaa, 0x81, 0x72, 0xb8, 0xa0, 0x9b); + +// DirectSound Capture Component GUID {B0210780-89CD-11D0-AF08-00A0C925CD16} +DEFINE_GUID(CLSID_DirectSoundCapture, 0xb0210780, 0x89cd, 0x11d0, 0xaf, 0x8, 0x0, 0xa0, 0xc9, 0x25, 0xcd, 0x16); + +// DirectSound 8.0 Capture Component GUID {E4BCAC13-7F99-4908-9A8E-74E3BF24B6E1} +DEFINE_GUID(CLSID_DirectSoundCapture8, 0xe4bcac13, 0x7f99, 0x4908, 0x9a, 0x8e, 0x74, 0xe3, 0xbf, 0x24, 0xb6, 0xe1); + +// DirectSound Full Duplex Component GUID {FEA4300C-7959-4147-B26A-2377B9E7A91D} +DEFINE_GUID(CLSID_DirectSoundFullDuplex, 0xfea4300c, 0x7959, 0x4147, 0xb2, 0x6a, 0x23, 0x77, 0xb9, 0xe7, 0xa9, 0x1d); + + +// DirectSound default playback device GUID {DEF00000-9C6D-47ED-AAF1-4DDA8F2B5C03} +DEFINE_GUID(DSDEVID_DefaultPlayback, 0xdef00000, 0x9c6d, 0x47ed, 0xaa, 0xf1, 0x4d, 0xda, 0x8f, 0x2b, 0x5c, 0x03); + +// DirectSound default capture device GUID {DEF00001-9C6D-47ED-AAF1-4DDA8F2B5C03} +DEFINE_GUID(DSDEVID_DefaultCapture, 0xdef00001, 0x9c6d, 0x47ed, 0xaa, 0xf1, 0x4d, 0xda, 0x8f, 0x2b, 0x5c, 0x03); + +// DirectSound default device for voice playback {DEF00002-9C6D-47ED-AAF1-4DDA8F2B5C03} +DEFINE_GUID(DSDEVID_DefaultVoicePlayback, 0xdef00002, 0x9c6d, 0x47ed, 0xaa, 0xf1, 0x4d, 0xda, 0x8f, 0x2b, 0x5c, 0x03); + +// DirectSound default device for voice capture {DEF00003-9C6D-47ED-AAF1-4DDA8F2B5C03} +DEFINE_GUID(DSDEVID_DefaultVoiceCapture, 0xdef00003, 0x9c6d, 0x47ed, 0xaa, 0xf1, 0x4d, 0xda, 0x8f, 0x2b, 0x5c, 0x03); + + +// +// Forward declarations for interfaces. +// 'struct' not 'class' per the way DECLARE_INTERFACE_ is defined +// + +#ifdef __cplusplus +struct IDirectSound; +struct IDirectSoundBuffer; +struct IDirectSound3DListener; +struct IDirectSound3DBuffer; +struct IDirectSoundCapture; +struct IDirectSoundCaptureBuffer; +struct IDirectSoundNotify; +#endif // __cplusplus + +// +// DirectSound 8.0 interfaces. +// + +#if DIRECTSOUND_VERSION >= 0x0800 + +#ifdef __cplusplus +struct IDirectSound8; +struct IDirectSoundBuffer8; +struct IDirectSoundCaptureBuffer8; +struct IDirectSoundFXGargle; +struct IDirectSoundFXChorus; +struct IDirectSoundFXFlanger; +struct IDirectSoundFXEcho; +struct IDirectSoundFXDistortion; +struct IDirectSoundFXCompressor; +struct IDirectSoundFXParamEq; +struct IDirectSoundFXWavesReverb; +struct IDirectSoundFXI3DL2Reverb; +struct IDirectSoundCaptureFXAec; +struct IDirectSoundCaptureFXNoiseSuppress; +struct IDirectSoundFullDuplex; +#endif // __cplusplus + +// IDirectSound8, IDirectSoundBuffer8 and IDirectSoundCaptureBuffer8 are the +// only DirectSound 7.0 interfaces with changed functionality in version 8.0. +// The other level 8 interfaces as equivalent to their level 7 counterparts: + +#define IDirectSoundCapture8 IDirectSoundCapture +#define IDirectSound3DListener8 IDirectSound3DListener +#define IDirectSound3DBuffer8 IDirectSound3DBuffer +#define IDirectSoundNotify8 IDirectSoundNotify +#define IDirectSoundFXGargle8 IDirectSoundFXGargle +#define IDirectSoundFXChorus8 IDirectSoundFXChorus +#define IDirectSoundFXFlanger8 IDirectSoundFXFlanger +#define IDirectSoundFXEcho8 IDirectSoundFXEcho +#define IDirectSoundFXDistortion8 IDirectSoundFXDistortion +#define IDirectSoundFXCompressor8 IDirectSoundFXCompressor +#define IDirectSoundFXParamEq8 IDirectSoundFXParamEq +#define IDirectSoundFXWavesReverb8 IDirectSoundFXWavesReverb +#define IDirectSoundFXI3DL2Reverb8 IDirectSoundFXI3DL2Reverb +#define IDirectSoundCaptureFXAec8 IDirectSoundCaptureFXAec +#define IDirectSoundCaptureFXNoiseSuppress8 IDirectSoundCaptureFXNoiseSuppress +#define IDirectSoundFullDuplex8 IDirectSoundFullDuplex + +#endif // DIRECTSOUND_VERSION >= 0x0800 + +typedef struct IDirectSound *LPDIRECTSOUND; +typedef struct IDirectSoundBuffer *LPDIRECTSOUNDBUFFER; +typedef struct IDirectSound3DListener *LPDIRECTSOUND3DLISTENER; +typedef struct IDirectSound3DBuffer *LPDIRECTSOUND3DBUFFER; +typedef struct IDirectSoundCapture *LPDIRECTSOUNDCAPTURE; +typedef struct IDirectSoundCaptureBuffer *LPDIRECTSOUNDCAPTUREBUFFER; +typedef struct IDirectSoundNotify *LPDIRECTSOUNDNOTIFY; + +#if DIRECTSOUND_VERSION >= 0x0800 + +typedef struct IDirectSoundFXGargle *LPDIRECTSOUNDFXGARGLE; +typedef struct IDirectSoundFXChorus *LPDIRECTSOUNDFXCHORUS; +typedef struct IDirectSoundFXFlanger *LPDIRECTSOUNDFXFLANGER; +typedef struct IDirectSoundFXEcho *LPDIRECTSOUNDFXECHO; +typedef struct IDirectSoundFXDistortion *LPDIRECTSOUNDFXDISTORTION; +typedef struct IDirectSoundFXCompressor *LPDIRECTSOUNDFXCOMPRESSOR; +typedef struct IDirectSoundFXParamEq *LPDIRECTSOUNDFXPARAMEQ; +typedef struct IDirectSoundFXWavesReverb *LPDIRECTSOUNDFXWAVESREVERB; +typedef struct IDirectSoundFXI3DL2Reverb *LPDIRECTSOUNDFXI3DL2REVERB; +typedef struct IDirectSoundCaptureFXAec *LPDIRECTSOUNDCAPTUREFXAEC; +typedef struct IDirectSoundCaptureFXNoiseSuppress *LPDIRECTSOUNDCAPTUREFXNOISESUPPRESS; +typedef struct IDirectSoundFullDuplex *LPDIRECTSOUNDFULLDUPLEX; + +typedef struct IDirectSound8 *LPDIRECTSOUND8; +typedef struct IDirectSoundBuffer8 *LPDIRECTSOUNDBUFFER8; +typedef struct IDirectSound3DListener8 *LPDIRECTSOUND3DLISTENER8; +typedef struct IDirectSound3DBuffer8 *LPDIRECTSOUND3DBUFFER8; +typedef struct IDirectSoundCapture8 *LPDIRECTSOUNDCAPTURE8; +typedef struct IDirectSoundCaptureBuffer8 *LPDIRECTSOUNDCAPTUREBUFFER8; +typedef struct IDirectSoundNotify8 *LPDIRECTSOUNDNOTIFY8; +typedef struct IDirectSoundFXGargle8 *LPDIRECTSOUNDFXGARGLE8; +typedef struct IDirectSoundFXChorus8 *LPDIRECTSOUNDFXCHORUS8; +typedef struct IDirectSoundFXFlanger8 *LPDIRECTSOUNDFXFLANGER8; +typedef struct IDirectSoundFXEcho8 *LPDIRECTSOUNDFXECHO8; +typedef struct IDirectSoundFXDistortion8 *LPDIRECTSOUNDFXDISTORTION8; +typedef struct IDirectSoundFXCompressor8 *LPDIRECTSOUNDFXCOMPRESSOR8; +typedef struct IDirectSoundFXParamEq8 *LPDIRECTSOUNDFXPARAMEQ8; +typedef struct IDirectSoundFXWavesReverb8 *LPDIRECTSOUNDFXWAVESREVERB8; +typedef struct IDirectSoundFXI3DL2Reverb8 *LPDIRECTSOUNDFXI3DL2REVERB8; +typedef struct IDirectSoundCaptureFXAec8 *LPDIRECTSOUNDCAPTUREFXAEC8; +typedef struct IDirectSoundCaptureFXNoiseSuppress8 *LPDIRECTSOUNDCAPTUREFXNOISESUPPRESS8; +typedef struct IDirectSoundFullDuplex8 *LPDIRECTSOUNDFULLDUPLEX8; + +#endif // DIRECTSOUND_VERSION >= 0x0800 + +// +// IID definitions for the unchanged DirectSound 8.0 interfaces +// + +#if DIRECTSOUND_VERSION >= 0x0800 + +#define IID_IDirectSoundCapture8 IID_IDirectSoundCapture +#define IID_IDirectSound3DListener8 IID_IDirectSound3DListener +#define IID_IDirectSound3DBuffer8 IID_IDirectSound3DBuffer +#define IID_IDirectSoundNotify8 IID_IDirectSoundNotify +#define IID_IDirectSoundFXGargle8 IID_IDirectSoundFXGargle +#define IID_IDirectSoundFXChorus8 IID_IDirectSoundFXChorus +#define IID_IDirectSoundFXFlanger8 IID_IDirectSoundFXFlanger +#define IID_IDirectSoundFXEcho8 IID_IDirectSoundFXEcho +#define IID_IDirectSoundFXDistortion8 IID_IDirectSoundFXDistortion +#define IID_IDirectSoundFXCompressor8 IID_IDirectSoundFXCompressor +#define IID_IDirectSoundFXParamEq8 IID_IDirectSoundFXParamEq +#define IID_IDirectSoundFXWavesReverb8 IID_IDirectSoundFXWavesReverb +#define IID_IDirectSoundFXI3DL2Reverb8 IID_IDirectSoundFXI3DL2Reverb +#define IID_IDirectSoundCaptureFXAec8 IID_IDirectSoundCaptureFXAec +#define IID_IDirectSoundCaptureFXNoiseSuppress8 IID_IDirectSoundCaptureFXNoiseSuppress +#define IID_IDirectSoundFullDuplex8 IID_IDirectSoundFullDuplex + +#endif // DIRECTSOUND_VERSION >= 0x0800 + +// +// Compatibility typedefs +// + +#ifndef _LPCWAVEFORMATEX_DEFINED +#define _LPCWAVEFORMATEX_DEFINED +typedef const WAVEFORMATEX *LPCWAVEFORMATEX; +#endif // _LPCWAVEFORMATEX_DEFINED + +#ifndef __LPCGUID_DEFINED__ +#define __LPCGUID_DEFINED__ +typedef const GUID *LPCGUID; +#endif // __LPCGUID_DEFINED__ + +typedef LPDIRECTSOUND *LPLPDIRECTSOUND; +typedef LPDIRECTSOUNDBUFFER *LPLPDIRECTSOUNDBUFFER; +typedef LPDIRECTSOUND3DLISTENER *LPLPDIRECTSOUND3DLISTENER; +typedef LPDIRECTSOUND3DBUFFER *LPLPDIRECTSOUND3DBUFFER; +typedef LPDIRECTSOUNDCAPTURE *LPLPDIRECTSOUNDCAPTURE; +typedef LPDIRECTSOUNDCAPTUREBUFFER *LPLPDIRECTSOUNDCAPTUREBUFFER; +typedef LPDIRECTSOUNDNOTIFY *LPLPDIRECTSOUNDNOTIFY; + +#if DIRECTSOUND_VERSION >= 0x0800 +typedef LPDIRECTSOUND8 *LPLPDIRECTSOUND8; +typedef LPDIRECTSOUNDBUFFER8 *LPLPDIRECTSOUNDBUFFER8; +typedef LPDIRECTSOUNDCAPTURE8 *LPLPDIRECTSOUNDCAPTURE8; +typedef LPDIRECTSOUNDCAPTUREBUFFER8 *LPLPDIRECTSOUNDCAPTUREBUFFER8; +#endif // DIRECTSOUND_VERSION >= 0x0800 + +// +// Structures +// + +typedef struct _DSCAPS +{ + DWORD dwSize; + DWORD dwFlags; + DWORD dwMinSecondarySampleRate; + DWORD dwMaxSecondarySampleRate; + DWORD dwPrimaryBuffers; + DWORD dwMaxHwMixingAllBuffers; + DWORD dwMaxHwMixingStaticBuffers; + DWORD dwMaxHwMixingStreamingBuffers; + DWORD dwFreeHwMixingAllBuffers; + DWORD dwFreeHwMixingStaticBuffers; + DWORD dwFreeHwMixingStreamingBuffers; + DWORD dwMaxHw3DAllBuffers; + DWORD dwMaxHw3DStaticBuffers; + DWORD dwMaxHw3DStreamingBuffers; + DWORD dwFreeHw3DAllBuffers; + DWORD dwFreeHw3DStaticBuffers; + DWORD dwFreeHw3DStreamingBuffers; + DWORD dwTotalHwMemBytes; + DWORD dwFreeHwMemBytes; + DWORD dwMaxContigFreeHwMemBytes; + DWORD dwUnlockTransferRateHwBuffers; + DWORD dwPlayCpuOverheadSwBuffers; + DWORD dwReserved1; + DWORD dwReserved2; +} DSCAPS, *LPDSCAPS; + +typedef const DSCAPS *LPCDSCAPS; + +typedef struct _DSBCAPS +{ + DWORD dwSize; + DWORD dwFlags; + DWORD dwBufferBytes; + DWORD dwUnlockTransferRate; + DWORD dwPlayCpuOverhead; +} DSBCAPS, *LPDSBCAPS; + +typedef const DSBCAPS *LPCDSBCAPS; + +#if DIRECTSOUND_VERSION >= 0x0800 + + typedef struct _DSEFFECTDESC + { + DWORD dwSize; + DWORD dwFlags; + GUID guidDSFXClass; + DWORD_PTR dwReserved1; + DWORD_PTR dwReserved2; + } DSEFFECTDESC, *LPDSEFFECTDESC; + typedef const DSEFFECTDESC *LPCDSEFFECTDESC; + + #define DSFX_LOCHARDWARE 0x00000001 + #define DSFX_LOCSOFTWARE 0x00000002 + + enum + { + DSFXR_PRESENT, // 0 + DSFXR_LOCHARDWARE, // 1 + DSFXR_LOCSOFTWARE, // 2 + DSFXR_UNALLOCATED, // 3 + DSFXR_FAILED, // 4 + DSFXR_UNKNOWN, // 5 + DSFXR_SENDLOOP // 6 + }; + + typedef struct _DSCEFFECTDESC + { + DWORD dwSize; + DWORD dwFlags; + GUID guidDSCFXClass; + GUID guidDSCFXInstance; + DWORD dwReserved1; + DWORD dwReserved2; + } DSCEFFECTDESC, *LPDSCEFFECTDESC; + typedef const DSCEFFECTDESC *LPCDSCEFFECTDESC; + + #define DSCFX_LOCHARDWARE 0x00000001 + #define DSCFX_LOCSOFTWARE 0x00000002 + + #define DSCFXR_LOCHARDWARE 0x00000010 + #define DSCFXR_LOCSOFTWARE 0x00000020 + +#endif // DIRECTSOUND_VERSION >= 0x0800 + +typedef struct _DSBUFFERDESC +{ + DWORD dwSize; + DWORD dwFlags; + DWORD dwBufferBytes; + DWORD dwReserved; + LPWAVEFORMATEX lpwfxFormat; +#if DIRECTSOUND_VERSION >= 0x0700 + GUID guid3DAlgorithm; +#endif +} DSBUFFERDESC, *LPDSBUFFERDESC; + +typedef const DSBUFFERDESC *LPCDSBUFFERDESC; + +// Older version of this structure: + +typedef struct _DSBUFFERDESC1 +{ + DWORD dwSize; + DWORD dwFlags; + DWORD dwBufferBytes; + DWORD dwReserved; + LPWAVEFORMATEX lpwfxFormat; +} DSBUFFERDESC1, *LPDSBUFFERDESC1; + +typedef const DSBUFFERDESC1 *LPCDSBUFFERDESC1; + +typedef struct _DS3DBUFFER +{ + DWORD dwSize; + D3DVECTOR vPosition; + D3DVECTOR vVelocity; + DWORD dwInsideConeAngle; + DWORD dwOutsideConeAngle; + D3DVECTOR vConeOrientation; + LONG lConeOutsideVolume; + D3DVALUE flMinDistance; + D3DVALUE flMaxDistance; + DWORD dwMode; +} DS3DBUFFER, *LPDS3DBUFFER; + +typedef const DS3DBUFFER *LPCDS3DBUFFER; + +typedef struct _DS3DLISTENER +{ + DWORD dwSize; + D3DVECTOR vPosition; + D3DVECTOR vVelocity; + D3DVECTOR vOrientFront; + D3DVECTOR vOrientTop; + D3DVALUE flDistanceFactor; + D3DVALUE flRolloffFactor; + D3DVALUE flDopplerFactor; +} DS3DLISTENER, *LPDS3DLISTENER; + +typedef const DS3DLISTENER *LPCDS3DLISTENER; + +typedef struct _DSCCAPS +{ + DWORD dwSize; + DWORD dwFlags; + DWORD dwFormats; + DWORD dwChannels; +} DSCCAPS, *LPDSCCAPS; + +typedef const DSCCAPS *LPCDSCCAPS; + +typedef struct _DSCBUFFERDESC1 +{ + DWORD dwSize; + DWORD dwFlags; + DWORD dwBufferBytes; + DWORD dwReserved; + LPWAVEFORMATEX lpwfxFormat; +} DSCBUFFERDESC1, *LPDSCBUFFERDESC1; + +typedef struct _DSCBUFFERDESC +{ + DWORD dwSize; + DWORD dwFlags; + DWORD dwBufferBytes; + DWORD dwReserved; + LPWAVEFORMATEX lpwfxFormat; +#if DIRECTSOUND_VERSION >= 0x0800 + DWORD dwFXCount; + LPDSCEFFECTDESC lpDSCFXDesc; +#endif +} DSCBUFFERDESC, *LPDSCBUFFERDESC; + +typedef const DSCBUFFERDESC *LPCDSCBUFFERDESC; + +typedef struct _DSCBCAPS +{ + DWORD dwSize; + DWORD dwFlags; + DWORD dwBufferBytes; + DWORD dwReserved; +} DSCBCAPS, *LPDSCBCAPS; + +typedef const DSCBCAPS *LPCDSCBCAPS; + +typedef struct _DSBPOSITIONNOTIFY +{ + DWORD dwOffset; + HANDLE hEventNotify; +} DSBPOSITIONNOTIFY, *LPDSBPOSITIONNOTIFY; + +typedef const DSBPOSITIONNOTIFY *LPCDSBPOSITIONNOTIFY; + +// +// DirectSound API +// + +typedef BOOL (CALLBACK *LPDSENUMCALLBACKA)(LPGUID, LPCSTR, LPCSTR, LPVOID); +typedef BOOL (CALLBACK *LPDSENUMCALLBACKW)(LPGUID, LPCWSTR, LPCWSTR, LPVOID); + +extern HRESULT WINAPI DirectSoundCreate(__in_opt LPCGUID pcGuidDevice, __deref_out LPDIRECTSOUND *ppDS, __null LPUNKNOWN pUnkOuter); +extern HRESULT WINAPI DirectSoundEnumerateA(__in LPDSENUMCALLBACKA pDSEnumCallback, __in_opt LPVOID pContext); +extern HRESULT WINAPI DirectSoundEnumerateW(__in LPDSENUMCALLBACKW pDSEnumCallback, __in_opt LPVOID pContext); + +extern HRESULT WINAPI DirectSoundCaptureCreate(__in_opt LPCGUID pcGuidDevice, __deref_out LPDIRECTSOUNDCAPTURE *ppDSC, __null LPUNKNOWN pUnkOuter); +extern HRESULT WINAPI DirectSoundCaptureEnumerateA(__in LPDSENUMCALLBACKA pDSEnumCallback, __in_opt LPVOID pContext); +extern HRESULT WINAPI DirectSoundCaptureEnumerateW(__in LPDSENUMCALLBACKW pDSEnumCallback, __in_opt LPVOID pContext); + +#if DIRECTSOUND_VERSION >= 0x0800 +extern HRESULT WINAPI DirectSoundCreate8(__in_opt LPCGUID pcGuidDevice, __deref_out LPDIRECTSOUND8 *ppDS8, __null LPUNKNOWN pUnkOuter); +extern HRESULT WINAPI DirectSoundCaptureCreate8(__in_opt LPCGUID pcGuidDevice, __deref_out LPDIRECTSOUNDCAPTURE8 *ppDSC8, __null LPUNKNOWN pUnkOuter); +extern HRESULT WINAPI DirectSoundFullDuplexCreate +( + __in_opt LPCGUID pcGuidCaptureDevice, + __in_opt LPCGUID pcGuidRenderDevice, + __in LPCDSCBUFFERDESC pcDSCBufferDesc, + __in LPCDSBUFFERDESC pcDSBufferDesc, + HWND hWnd, + DWORD dwLevel, + __deref_out LPDIRECTSOUNDFULLDUPLEX* ppDSFD, + __deref_out LPDIRECTSOUNDCAPTUREBUFFER8 *ppDSCBuffer8, + __deref_out LPDIRECTSOUNDBUFFER8 *ppDSBuffer8, + __null LPUNKNOWN pUnkOuter +); +#define DirectSoundFullDuplexCreate8 DirectSoundFullDuplexCreate + +extern HRESULT WINAPI GetDeviceID(__in_opt LPCGUID pGuidSrc, __out LPGUID pGuidDest); +#endif // DIRECTSOUND_VERSION >= 0x0800 + +#ifdef UNICODE +#define LPDSENUMCALLBACK LPDSENUMCALLBACKW +#define DirectSoundEnumerate DirectSoundEnumerateW +#define DirectSoundCaptureEnumerate DirectSoundCaptureEnumerateW +#else // UNICODE +#define LPDSENUMCALLBACK LPDSENUMCALLBACKA +#define DirectSoundEnumerate DirectSoundEnumerateA +#define DirectSoundCaptureEnumerate DirectSoundCaptureEnumerateA +#endif // UNICODE + +// +// IUnknown +// + +#if !defined(__cplusplus) || defined(CINTERFACE) +#ifndef IUnknown_QueryInterface +#define IUnknown_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#endif // IUnknown_QueryInterface +#ifndef IUnknown_AddRef +#define IUnknown_AddRef(p) (p)->lpVtbl->AddRef(p) +#endif // IUnknown_AddRef +#ifndef IUnknown_Release +#define IUnknown_Release(p) (p)->lpVtbl->Release(p) +#endif // IUnknown_Release +#else // !defined(__cplusplus) || defined(CINTERFACE) +#ifndef IUnknown_QueryInterface +#define IUnknown_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#endif // IUnknown_QueryInterface +#ifndef IUnknown_AddRef +#define IUnknown_AddRef(p) (p)->AddRef() +#endif // IUnknown_AddRef +#ifndef IUnknown_Release +#define IUnknown_Release(p) (p)->Release() +#endif // IUnknown_Release +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +#ifndef __IReferenceClock_INTERFACE_DEFINED__ +#define __IReferenceClock_INTERFACE_DEFINED__ + +typedef LONGLONG REFERENCE_TIME; +typedef REFERENCE_TIME *LPREFERENCE_TIME; + +DEFINE_GUID(IID_IReferenceClock, 0x56a86897, 0x0ad4, 0x11ce, 0xb0, 0x3a, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70); + +#undef INTERFACE +#define INTERFACE IReferenceClock + +DECLARE_INTERFACE_(IReferenceClock, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ __in REFIID, __deref_out LPVOID*) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IReferenceClock methods + STDMETHOD(GetTime) (THIS_ __out REFERENCE_TIME *pTime) PURE; + STDMETHOD(AdviseTime) (THIS_ REFERENCE_TIME rtBaseTime, REFERENCE_TIME rtStreamTime, + HANDLE hEvent, __out LPDWORD pdwAdviseCookie) PURE; + STDMETHOD(AdvisePeriodic) (THIS_ REFERENCE_TIME rtStartTime, REFERENCE_TIME rtPeriodTime, + HANDLE hSemaphore, __out LPDWORD pdwAdviseCookie) PURE; + STDMETHOD(Unadvise) (THIS_ DWORD dwAdviseCookie) PURE; +}; + +#endif // __IReferenceClock_INTERFACE_DEFINED__ + +#ifndef IReferenceClock_QueryInterface + +#define IReferenceClock_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IReferenceClock_AddRef(p) IUnknown_AddRef(p) +#define IReferenceClock_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IReferenceClock_GetTime(p,a) (p)->lpVtbl->GetTime(p,a) +#define IReferenceClock_AdviseTime(p,a,b,c,d) (p)->lpVtbl->AdviseTime(p,a,b,c,d) +#define IReferenceClock_AdvisePeriodic(p,a,b,c,d) (p)->lpVtbl->AdvisePeriodic(p,a,b,c,d) +#define IReferenceClock_Unadvise(p,a) (p)->lpVtbl->Unadvise(p,a) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IReferenceClock_GetTime(p,a) (p)->GetTime(a) +#define IReferenceClock_AdviseTime(p,a,b,c,d) (p)->AdviseTime(a,b,c,d) +#define IReferenceClock_AdvisePeriodic(p,a,b,c,d) (p)->AdvisePeriodic(a,b,c,d) +#define IReferenceClock_Unadvise(p,a) (p)->Unadvise(a) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +#endif // IReferenceClock_QueryInterface + +// +// IDirectSound +// + +DEFINE_GUID(IID_IDirectSound, 0x279AFA83, 0x4981, 0x11CE, 0xA5, 0x21, 0x00, 0x20, 0xAF, 0x0B, 0xE5, 0x60); + +#undef INTERFACE +#define INTERFACE IDirectSound + +DECLARE_INTERFACE_(IDirectSound, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ __in REFIID, __deref_out LPVOID*) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSound methods + STDMETHOD(CreateSoundBuffer) (THIS_ __in LPCDSBUFFERDESC pcDSBufferDesc, __deref_out LPDIRECTSOUNDBUFFER *ppDSBuffer, __null LPUNKNOWN pUnkOuter) PURE; + STDMETHOD(GetCaps) (THIS_ __out LPDSCAPS pDSCaps) PURE; + STDMETHOD(DuplicateSoundBuffer) (THIS_ __in LPDIRECTSOUNDBUFFER pDSBufferOriginal, __deref_out LPDIRECTSOUNDBUFFER *ppDSBufferDuplicate) PURE; + STDMETHOD(SetCooperativeLevel) (THIS_ HWND hwnd, DWORD dwLevel) PURE; + STDMETHOD(Compact) (THIS) PURE; + STDMETHOD(GetSpeakerConfig) (THIS_ __out LPDWORD pdwSpeakerConfig) PURE; + STDMETHOD(SetSpeakerConfig) (THIS_ DWORD dwSpeakerConfig) PURE; + STDMETHOD(Initialize) (THIS_ __in_opt LPCGUID pcGuidDevice) PURE; +}; + +#define IDirectSound_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSound_AddRef(p) IUnknown_AddRef(p) +#define IDirectSound_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSound_CreateSoundBuffer(p,a,b,c) (p)->lpVtbl->CreateSoundBuffer(p,a,b,c) +#define IDirectSound_GetCaps(p,a) (p)->lpVtbl->GetCaps(p,a) +#define IDirectSound_DuplicateSoundBuffer(p,a,b) (p)->lpVtbl->DuplicateSoundBuffer(p,a,b) +#define IDirectSound_SetCooperativeLevel(p,a,b) (p)->lpVtbl->SetCooperativeLevel(p,a,b) +#define IDirectSound_Compact(p) (p)->lpVtbl->Compact(p) +#define IDirectSound_GetSpeakerConfig(p,a) (p)->lpVtbl->GetSpeakerConfig(p,a) +#define IDirectSound_SetSpeakerConfig(p,b) (p)->lpVtbl->SetSpeakerConfig(p,b) +#define IDirectSound_Initialize(p,a) (p)->lpVtbl->Initialize(p,a) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSound_CreateSoundBuffer(p,a,b,c) (p)->CreateSoundBuffer(a,b,c) +#define IDirectSound_GetCaps(p,a) (p)->GetCaps(a) +#define IDirectSound_DuplicateSoundBuffer(p,a,b) (p)->DuplicateSoundBuffer(a,b) +#define IDirectSound_SetCooperativeLevel(p,a,b) (p)->SetCooperativeLevel(a,b) +#define IDirectSound_Compact(p) (p)->Compact() +#define IDirectSound_GetSpeakerConfig(p,a) (p)->GetSpeakerConfig(a) +#define IDirectSound_SetSpeakerConfig(p,b) (p)->SetSpeakerConfig(b) +#define IDirectSound_Initialize(p,a) (p)->Initialize(a) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +#if DIRECTSOUND_VERSION >= 0x0800 + +// +// IDirectSound8 +// + +DEFINE_GUID(IID_IDirectSound8, 0xC50A7E93, 0xF395, 0x4834, 0x9E, 0xF6, 0x7F, 0xA9, 0x9D, 0xE5, 0x09, 0x66); + +#undef INTERFACE +#define INTERFACE IDirectSound8 + +DECLARE_INTERFACE_(IDirectSound8, IDirectSound) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ __in REFIID, __deref_out LPVOID*) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSound methods + STDMETHOD(CreateSoundBuffer) (THIS_ __in LPCDSBUFFERDESC pcDSBufferDesc, __out LPDIRECTSOUNDBUFFER *ppDSBuffer, __null LPUNKNOWN pUnkOuter) PURE; + STDMETHOD(GetCaps) (THIS_ __out LPDSCAPS pDSCaps) PURE; + STDMETHOD(DuplicateSoundBuffer) (THIS_ __in LPDIRECTSOUNDBUFFER pDSBufferOriginal, __out LPDIRECTSOUNDBUFFER *ppDSBufferDuplicate) PURE; + STDMETHOD(SetCooperativeLevel) (THIS_ HWND hwnd, DWORD dwLevel) PURE; + STDMETHOD(Compact) (THIS) PURE; + STDMETHOD(GetSpeakerConfig) (THIS_ __out LPDWORD pdwSpeakerConfig) PURE; + STDMETHOD(SetSpeakerConfig) (THIS_ DWORD dwSpeakerConfig) PURE; + STDMETHOD(Initialize) (THIS_ __in_opt LPCGUID pcGuidDevice) PURE; + + // IDirectSound8 methods + STDMETHOD(VerifyCertification) (THIS_ __out LPDWORD pdwCertified) PURE; +}; + +#define IDirectSound8_QueryInterface(p,a,b) IDirectSound_QueryInterface(p,a,b) +#define IDirectSound8_AddRef(p) IDirectSound_AddRef(p) +#define IDirectSound8_Release(p) IDirectSound_Release(p) +#define IDirectSound8_CreateSoundBuffer(p,a,b,c) IDirectSound_CreateSoundBuffer(p,a,b,c) +#define IDirectSound8_GetCaps(p,a) IDirectSound_GetCaps(p,a) +#define IDirectSound8_DuplicateSoundBuffer(p,a,b) IDirectSound_DuplicateSoundBuffer(p,a,b) +#define IDirectSound8_SetCooperativeLevel(p,a,b) IDirectSound_SetCooperativeLevel(p,a,b) +#define IDirectSound8_Compact(p) IDirectSound_Compact(p) +#define IDirectSound8_GetSpeakerConfig(p,a) IDirectSound_GetSpeakerConfig(p,a) +#define IDirectSound8_SetSpeakerConfig(p,a) IDirectSound_SetSpeakerConfig(p,a) +#define IDirectSound8_Initialize(p,a) IDirectSound_Initialize(p,a) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSound8_VerifyCertification(p,a) (p)->lpVtbl->VerifyCertification(p,a) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSound8_VerifyCertification(p,a) (p)->VerifyCertification(a) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +#endif // DIRECTSOUND_VERSION >= 0x0800 + +// +// IDirectSoundBuffer +// + +DEFINE_GUID(IID_IDirectSoundBuffer, 0x279AFA85, 0x4981, 0x11CE, 0xA5, 0x21, 0x00, 0x20, 0xAF, 0x0B, 0xE5, 0x60); + +#undef INTERFACE +#define INTERFACE IDirectSoundBuffer + +DECLARE_INTERFACE_(IDirectSoundBuffer, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ __in REFIID, __deref_out LPVOID*) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSoundBuffer methods + STDMETHOD(GetCaps) (THIS_ __out LPDSBCAPS pDSBufferCaps) PURE; + STDMETHOD(GetCurrentPosition) (THIS_ __out_opt LPDWORD pdwCurrentPlayCursor, __out_opt LPDWORD pdwCurrentWriteCursor) PURE; + STDMETHOD(GetFormat) (THIS_ __out_bcount_opt(dwSizeAllocated) LPWAVEFORMATEX pwfxFormat, DWORD dwSizeAllocated, __out_opt LPDWORD pdwSizeWritten) PURE; + STDMETHOD(GetVolume) (THIS_ __out LPLONG plVolume) PURE; + STDMETHOD(GetPan) (THIS_ __out LPLONG plPan) PURE; + STDMETHOD(GetFrequency) (THIS_ __out LPDWORD pdwFrequency) PURE; + STDMETHOD(GetStatus) (THIS_ __out LPDWORD pdwStatus) PURE; + STDMETHOD(Initialize) (THIS_ __in LPDIRECTSOUND pDirectSound, __in LPCDSBUFFERDESC pcDSBufferDesc) PURE; + STDMETHOD(Lock) (THIS_ DWORD dwOffset, DWORD dwBytes, + __deref_out_bcount(*pdwAudioBytes1) LPVOID *ppvAudioPtr1, __out LPDWORD pdwAudioBytes1, + __deref_opt_out_bcount(*pdwAudioBytes2) LPVOID *ppvAudioPtr2, __out_opt LPDWORD pdwAudioBytes2, DWORD dwFlags) PURE; + STDMETHOD(Play) (THIS_ DWORD dwReserved1, DWORD dwPriority, DWORD dwFlags) PURE; + STDMETHOD(SetCurrentPosition) (THIS_ DWORD dwNewPosition) PURE; + STDMETHOD(SetFormat) (THIS_ __in LPCWAVEFORMATEX pcfxFormat) PURE; + STDMETHOD(SetVolume) (THIS_ LONG lVolume) PURE; + STDMETHOD(SetPan) (THIS_ LONG lPan) PURE; + STDMETHOD(SetFrequency) (THIS_ DWORD dwFrequency) PURE; + STDMETHOD(Stop) (THIS) PURE; + STDMETHOD(Unlock) (THIS_ __in_bcount(dwAudioBytes1) LPVOID pvAudioPtr1, DWORD dwAudioBytes1, + __in_bcount_opt(dwAudioBytes2) LPVOID pvAudioPtr2, DWORD dwAudioBytes2) PURE; + STDMETHOD(Restore) (THIS) PURE; +}; + +#define IDirectSoundBuffer_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSoundBuffer_AddRef(p) IUnknown_AddRef(p) +#define IDirectSoundBuffer_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundBuffer_GetCaps(p,a) (p)->lpVtbl->GetCaps(p,a) +#define IDirectSoundBuffer_GetCurrentPosition(p,a,b) (p)->lpVtbl->GetCurrentPosition(p,a,b) +#define IDirectSoundBuffer_GetFormat(p,a,b,c) (p)->lpVtbl->GetFormat(p,a,b,c) +#define IDirectSoundBuffer_GetVolume(p,a) (p)->lpVtbl->GetVolume(p,a) +#define IDirectSoundBuffer_GetPan(p,a) (p)->lpVtbl->GetPan(p,a) +#define IDirectSoundBuffer_GetFrequency(p,a) (p)->lpVtbl->GetFrequency(p,a) +#define IDirectSoundBuffer_GetStatus(p,a) (p)->lpVtbl->GetStatus(p,a) +#define IDirectSoundBuffer_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b) +#define IDirectSoundBuffer_Lock(p,a,b,c,d,e,f,g) (p)->lpVtbl->Lock(p,a,b,c,d,e,f,g) +#define IDirectSoundBuffer_Play(p,a,b,c) (p)->lpVtbl->Play(p,a,b,c) +#define IDirectSoundBuffer_SetCurrentPosition(p,a) (p)->lpVtbl->SetCurrentPosition(p,a) +#define IDirectSoundBuffer_SetFormat(p,a) (p)->lpVtbl->SetFormat(p,a) +#define IDirectSoundBuffer_SetVolume(p,a) (p)->lpVtbl->SetVolume(p,a) +#define IDirectSoundBuffer_SetPan(p,a) (p)->lpVtbl->SetPan(p,a) +#define IDirectSoundBuffer_SetFrequency(p,a) (p)->lpVtbl->SetFrequency(p,a) +#define IDirectSoundBuffer_Stop(p) (p)->lpVtbl->Stop(p) +#define IDirectSoundBuffer_Unlock(p,a,b,c,d) (p)->lpVtbl->Unlock(p,a,b,c,d) +#define IDirectSoundBuffer_Restore(p) (p)->lpVtbl->Restore(p) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundBuffer_GetCaps(p,a) (p)->GetCaps(a) +#define IDirectSoundBuffer_GetCurrentPosition(p,a,b) (p)->GetCurrentPosition(a,b) +#define IDirectSoundBuffer_GetFormat(p,a,b,c) (p)->GetFormat(a,b,c) +#define IDirectSoundBuffer_GetVolume(p,a) (p)->GetVolume(a) +#define IDirectSoundBuffer_GetPan(p,a) (p)->GetPan(a) +#define IDirectSoundBuffer_GetFrequency(p,a) (p)->GetFrequency(a) +#define IDirectSoundBuffer_GetStatus(p,a) (p)->GetStatus(a) +#define IDirectSoundBuffer_Initialize(p,a,b) (p)->Initialize(a,b) +#define IDirectSoundBuffer_Lock(p,a,b,c,d,e,f,g) (p)->Lock(a,b,c,d,e,f,g) +#define IDirectSoundBuffer_Play(p,a,b,c) (p)->Play(a,b,c) +#define IDirectSoundBuffer_SetCurrentPosition(p,a) (p)->SetCurrentPosition(a) +#define IDirectSoundBuffer_SetFormat(p,a) (p)->SetFormat(a) +#define IDirectSoundBuffer_SetVolume(p,a) (p)->SetVolume(a) +#define IDirectSoundBuffer_SetPan(p,a) (p)->SetPan(a) +#define IDirectSoundBuffer_SetFrequency(p,a) (p)->SetFrequency(a) +#define IDirectSoundBuffer_Stop(p) (p)->Stop() +#define IDirectSoundBuffer_Unlock(p,a,b,c,d) (p)->Unlock(a,b,c,d) +#define IDirectSoundBuffer_Restore(p) (p)->Restore() +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +#if DIRECTSOUND_VERSION >= 0x0800 + +// +// IDirectSoundBuffer8 +// + +DEFINE_GUID(IID_IDirectSoundBuffer8, 0x6825a449, 0x7524, 0x4d82, 0x92, 0x0f, 0x50, 0xe3, 0x6a, 0xb3, 0xab, 0x1e); + +#undef INTERFACE +#define INTERFACE IDirectSoundBuffer8 + +DECLARE_INTERFACE_(IDirectSoundBuffer8, IDirectSoundBuffer) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ __in REFIID, __deref_out LPVOID*) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSoundBuffer methods + STDMETHOD(GetCaps) (THIS_ __out LPDSBCAPS pDSBufferCaps) PURE; + STDMETHOD(GetCurrentPosition) (THIS_ __out_opt LPDWORD pdwCurrentPlayCursor, __out_opt LPDWORD pdwCurrentWriteCursor) PURE; + STDMETHOD(GetFormat) (THIS_ __out_bcount_opt(dwSizeAllocated) LPWAVEFORMATEX pwfxFormat, DWORD dwSizeAllocated, __out_opt LPDWORD pdwSizeWritten) PURE; + STDMETHOD(GetVolume) (THIS_ __out LPLONG plVolume) PURE; + STDMETHOD(GetPan) (THIS_ __out LPLONG plPan) PURE; + STDMETHOD(GetFrequency) (THIS_ __out LPDWORD pdwFrequency) PURE; + STDMETHOD(GetStatus) (THIS_ __out LPDWORD pdwStatus) PURE; + STDMETHOD(Initialize) (THIS_ __in LPDIRECTSOUND pDirectSound, __in LPCDSBUFFERDESC pcDSBufferDesc) PURE; + STDMETHOD(Lock) (THIS_ DWORD dwOffset, DWORD dwBytes, + __deref_out_bcount(*pdwAudioBytes1) LPVOID *ppvAudioPtr1, __out LPDWORD pdwAudioBytes1, + __deref_opt_out_bcount(*pdwAudioBytes2) LPVOID *ppvAudioPtr2, __out_opt LPDWORD pdwAudioBytes2, DWORD dwFlags) PURE; + STDMETHOD(Play) (THIS_ DWORD dwReserved1, DWORD dwPriority, DWORD dwFlags) PURE; + STDMETHOD(SetCurrentPosition) (THIS_ DWORD dwNewPosition) PURE; + STDMETHOD(SetFormat) (THIS_ __in LPCWAVEFORMATEX pcfxFormat) PURE; + STDMETHOD(SetVolume) (THIS_ LONG lVolume) PURE; + STDMETHOD(SetPan) (THIS_ LONG lPan) PURE; + STDMETHOD(SetFrequency) (THIS_ DWORD dwFrequency) PURE; + STDMETHOD(Stop) (THIS) PURE; + STDMETHOD(Unlock) (THIS_ __in_bcount(dwAudioBytes1) LPVOID pvAudioPtr1, DWORD dwAudioBytes1, + __in_bcount_opt(dwAudioBytes2) LPVOID pvAudioPtr2, DWORD dwAudioBytes2) PURE; + STDMETHOD(Restore) (THIS) PURE; + + // IDirectSoundBuffer8 methods + STDMETHOD(SetFX) (THIS_ DWORD dwEffectsCount, __in_ecount_opt(dwEffectsCount) LPDSEFFECTDESC pDSFXDesc, __out_ecount_opt(dwEffectsCount) LPDWORD pdwResultCodes) PURE; + STDMETHOD(AcquireResources) (THIS_ DWORD dwFlags, DWORD dwEffectsCount, __out_ecount(dwEffectsCount) LPDWORD pdwResultCodes) PURE; + STDMETHOD(GetObjectInPath) (THIS_ __in REFGUID rguidObject, DWORD dwIndex, __in REFGUID rguidInterface, __deref_out LPVOID *ppObject) PURE; +}; + +// Special GUID meaning "select all objects" for use in GetObjectInPath() +DEFINE_GUID(GUID_All_Objects, 0xaa114de5, 0xc262, 0x4169, 0xa1, 0xc8, 0x23, 0xd6, 0x98, 0xcc, 0x73, 0xb5); + +#define IDirectSoundBuffer8_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSoundBuffer8_AddRef(p) IUnknown_AddRef(p) +#define IDirectSoundBuffer8_Release(p) IUnknown_Release(p) + +#define IDirectSoundBuffer8_GetCaps(p,a) IDirectSoundBuffer_GetCaps(p,a) +#define IDirectSoundBuffer8_GetCurrentPosition(p,a,b) IDirectSoundBuffer_GetCurrentPosition(p,a,b) +#define IDirectSoundBuffer8_GetFormat(p,a,b,c) IDirectSoundBuffer_GetFormat(p,a,b,c) +#define IDirectSoundBuffer8_GetVolume(p,a) IDirectSoundBuffer_GetVolume(p,a) +#define IDirectSoundBuffer8_GetPan(p,a) IDirectSoundBuffer_GetPan(p,a) +#define IDirectSoundBuffer8_GetFrequency(p,a) IDirectSoundBuffer_GetFrequency(p,a) +#define IDirectSoundBuffer8_GetStatus(p,a) IDirectSoundBuffer_GetStatus(p,a) +#define IDirectSoundBuffer8_Initialize(p,a,b) IDirectSoundBuffer_Initialize(p,a,b) +#define IDirectSoundBuffer8_Lock(p,a,b,c,d,e,f,g) IDirectSoundBuffer_Lock(p,a,b,c,d,e,f,g) +#define IDirectSoundBuffer8_Play(p,a,b,c) IDirectSoundBuffer_Play(p,a,b,c) +#define IDirectSoundBuffer8_SetCurrentPosition(p,a) IDirectSoundBuffer_SetCurrentPosition(p,a) +#define IDirectSoundBuffer8_SetFormat(p,a) IDirectSoundBuffer_SetFormat(p,a) +#define IDirectSoundBuffer8_SetVolume(p,a) IDirectSoundBuffer_SetVolume(p,a) +#define IDirectSoundBuffer8_SetPan(p,a) IDirectSoundBuffer_SetPan(p,a) +#define IDirectSoundBuffer8_SetFrequency(p,a) IDirectSoundBuffer_SetFrequency(p,a) +#define IDirectSoundBuffer8_Stop(p) IDirectSoundBuffer_Stop(p) +#define IDirectSoundBuffer8_Unlock(p,a,b,c,d) IDirectSoundBuffer_Unlock(p,a,b,c,d) +#define IDirectSoundBuffer8_Restore(p) IDirectSoundBuffer_Restore(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundBuffer8_SetFX(p,a,b,c) (p)->lpVtbl->SetFX(p,a,b,c) +#define IDirectSoundBuffer8_AcquireResources(p,a,b,c) (p)->lpVtbl->AcquireResources(p,a,b,c) +#define IDirectSoundBuffer8_GetObjectInPath(p,a,b,c,d) (p)->lpVtbl->GetObjectInPath(p,a,b,c,d) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundBuffer8_SetFX(p,a,b,c) (p)->SetFX(a,b,c) +#define IDirectSoundBuffer8_AcquireResources(p,a,b,c) (p)->AcquireResources(a,b,c) +#define IDirectSoundBuffer8_GetObjectInPath(p,a,b,c,d) (p)->GetObjectInPath(a,b,c,d) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +#endif // DIRECTSOUND_VERSION >= 0x0800 + +// +// IDirectSound3DListener +// + +DEFINE_GUID(IID_IDirectSound3DListener, 0x279AFA84, 0x4981, 0x11CE, 0xA5, 0x21, 0x00, 0x20, 0xAF, 0x0B, 0xE5, 0x60); + +#undef INTERFACE +#define INTERFACE IDirectSound3DListener + +DECLARE_INTERFACE_(IDirectSound3DListener, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ __in REFIID, __deref_out LPVOID*) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSound3DListener methods + STDMETHOD(GetAllParameters) (THIS_ __out LPDS3DLISTENER pListener) PURE; + STDMETHOD(GetDistanceFactor) (THIS_ __out D3DVALUE* pflDistanceFactor) PURE; + STDMETHOD(GetDopplerFactor) (THIS_ __out D3DVALUE* pflDopplerFactor) PURE; + STDMETHOD(GetOrientation) (THIS_ __out D3DVECTOR* pvOrientFront, __out D3DVECTOR* pvOrientTop) PURE; + STDMETHOD(GetPosition) (THIS_ __out D3DVECTOR* pvPosition) PURE; + STDMETHOD(GetRolloffFactor) (THIS_ __out D3DVALUE* pflRolloffFactor) PURE; + STDMETHOD(GetVelocity) (THIS_ __out D3DVECTOR* pvVelocity) PURE; + STDMETHOD(SetAllParameters) (THIS_ __in LPCDS3DLISTENER pcListener, DWORD dwApply) PURE; + STDMETHOD(SetDistanceFactor) (THIS_ D3DVALUE flDistanceFactor, DWORD dwApply) PURE; + STDMETHOD(SetDopplerFactor) (THIS_ D3DVALUE flDopplerFactor, DWORD dwApply) PURE; + STDMETHOD(SetOrientation) (THIS_ D3DVALUE xFront, D3DVALUE yFront, D3DVALUE zFront, + D3DVALUE xTop, D3DVALUE yTop, D3DVALUE zTop, DWORD dwApply) PURE; + STDMETHOD(SetPosition) (THIS_ D3DVALUE x, D3DVALUE y, D3DVALUE z, DWORD dwApply) PURE; + STDMETHOD(SetRolloffFactor) (THIS_ D3DVALUE flRolloffFactor, DWORD dwApply) PURE; + STDMETHOD(SetVelocity) (THIS_ D3DVALUE x, D3DVALUE y, D3DVALUE z, DWORD dwApply) PURE; + STDMETHOD(CommitDeferredSettings) (THIS) PURE; +}; + +#define IDirectSound3DListener_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSound3DListener_AddRef(p) IUnknown_AddRef(p) +#define IDirectSound3DListener_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSound3DListener_GetAllParameters(p,a) (p)->lpVtbl->GetAllParameters(p,a) +#define IDirectSound3DListener_GetDistanceFactor(p,a) (p)->lpVtbl->GetDistanceFactor(p,a) +#define IDirectSound3DListener_GetDopplerFactor(p,a) (p)->lpVtbl->GetDopplerFactor(p,a) +#define IDirectSound3DListener_GetOrientation(p,a,b) (p)->lpVtbl->GetOrientation(p,a,b) +#define IDirectSound3DListener_GetPosition(p,a) (p)->lpVtbl->GetPosition(p,a) +#define IDirectSound3DListener_GetRolloffFactor(p,a) (p)->lpVtbl->GetRolloffFactor(p,a) +#define IDirectSound3DListener_GetVelocity(p,a) (p)->lpVtbl->GetVelocity(p,a) +#define IDirectSound3DListener_SetAllParameters(p,a,b) (p)->lpVtbl->SetAllParameters(p,a,b) +#define IDirectSound3DListener_SetDistanceFactor(p,a,b) (p)->lpVtbl->SetDistanceFactor(p,a,b) +#define IDirectSound3DListener_SetDopplerFactor(p,a,b) (p)->lpVtbl->SetDopplerFactor(p,a,b) +#define IDirectSound3DListener_SetOrientation(p,a,b,c,d,e,f,g) (p)->lpVtbl->SetOrientation(p,a,b,c,d,e,f,g) +#define IDirectSound3DListener_SetPosition(p,a,b,c,d) (p)->lpVtbl->SetPosition(p,a,b,c,d) +#define IDirectSound3DListener_SetRolloffFactor(p,a,b) (p)->lpVtbl->SetRolloffFactor(p,a,b) +#define IDirectSound3DListener_SetVelocity(p,a,b,c,d) (p)->lpVtbl->SetVelocity(p,a,b,c,d) +#define IDirectSound3DListener_CommitDeferredSettings(p) (p)->lpVtbl->CommitDeferredSettings(p) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSound3DListener_GetAllParameters(p,a) (p)->GetAllParameters(a) +#define IDirectSound3DListener_GetDistanceFactor(p,a) (p)->GetDistanceFactor(a) +#define IDirectSound3DListener_GetDopplerFactor(p,a) (p)->GetDopplerFactor(a) +#define IDirectSound3DListener_GetOrientation(p,a,b) (p)->GetOrientation(a,b) +#define IDirectSound3DListener_GetPosition(p,a) (p)->GetPosition(a) +#define IDirectSound3DListener_GetRolloffFactor(p,a) (p)->GetRolloffFactor(a) +#define IDirectSound3DListener_GetVelocity(p,a) (p)->GetVelocity(a) +#define IDirectSound3DListener_SetAllParameters(p,a,b) (p)->SetAllParameters(a,b) +#define IDirectSound3DListener_SetDistanceFactor(p,a,b) (p)->SetDistanceFactor(a,b) +#define IDirectSound3DListener_SetDopplerFactor(p,a,b) (p)->SetDopplerFactor(a,b) +#define IDirectSound3DListener_SetOrientation(p,a,b,c,d,e,f,g) (p)->SetOrientation(a,b,c,d,e,f,g) +#define IDirectSound3DListener_SetPosition(p,a,b,c,d) (p)->SetPosition(a,b,c,d) +#define IDirectSound3DListener_SetRolloffFactor(p,a,b) (p)->SetRolloffFactor(a,b) +#define IDirectSound3DListener_SetVelocity(p,a,b,c,d) (p)->SetVelocity(a,b,c,d) +#define IDirectSound3DListener_CommitDeferredSettings(p) (p)->CommitDeferredSettings() +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +// +// IDirectSound3DBuffer +// + +DEFINE_GUID(IID_IDirectSound3DBuffer, 0x279AFA86, 0x4981, 0x11CE, 0xA5, 0x21, 0x00, 0x20, 0xAF, 0x0B, 0xE5, 0x60); + +#undef INTERFACE +#define INTERFACE IDirectSound3DBuffer + +DECLARE_INTERFACE_(IDirectSound3DBuffer, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ __in REFIID, __deref_out LPVOID*) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSound3DBuffer methods + STDMETHOD(GetAllParameters) (THIS_ __out LPDS3DBUFFER pDs3dBuffer) PURE; + STDMETHOD(GetConeAngles) (THIS_ __out LPDWORD pdwInsideConeAngle, __out LPDWORD pdwOutsideConeAngle) PURE; + STDMETHOD(GetConeOrientation) (THIS_ __out D3DVECTOR* pvOrientation) PURE; + STDMETHOD(GetConeOutsideVolume) (THIS_ __out LPLONG plConeOutsideVolume) PURE; + STDMETHOD(GetMaxDistance) (THIS_ __out D3DVALUE* pflMaxDistance) PURE; + STDMETHOD(GetMinDistance) (THIS_ __out D3DVALUE* pflMinDistance) PURE; + STDMETHOD(GetMode) (THIS_ __out LPDWORD pdwMode) PURE; + STDMETHOD(GetPosition) (THIS_ __out D3DVECTOR* pvPosition) PURE; + STDMETHOD(GetVelocity) (THIS_ __out D3DVECTOR* pvVelocity) PURE; + STDMETHOD(SetAllParameters) (THIS_ __in LPCDS3DBUFFER pcDs3dBuffer, DWORD dwApply) PURE; + STDMETHOD(SetConeAngles) (THIS_ DWORD dwInsideConeAngle, DWORD dwOutsideConeAngle, DWORD dwApply) PURE; + STDMETHOD(SetConeOrientation) (THIS_ D3DVALUE x, D3DVALUE y, D3DVALUE z, DWORD dwApply) PURE; + STDMETHOD(SetConeOutsideVolume) (THIS_ LONG lConeOutsideVolume, DWORD dwApply) PURE; + STDMETHOD(SetMaxDistance) (THIS_ D3DVALUE flMaxDistance, DWORD dwApply) PURE; + STDMETHOD(SetMinDistance) (THIS_ D3DVALUE flMinDistance, DWORD dwApply) PURE; + STDMETHOD(SetMode) (THIS_ DWORD dwMode, DWORD dwApply) PURE; + STDMETHOD(SetPosition) (THIS_ D3DVALUE x, D3DVALUE y, D3DVALUE z, DWORD dwApply) PURE; + STDMETHOD(SetVelocity) (THIS_ D3DVALUE x, D3DVALUE y, D3DVALUE z, DWORD dwApply) PURE; +}; + +#define IDirectSound3DBuffer_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSound3DBuffer_AddRef(p) IUnknown_AddRef(p) +#define IDirectSound3DBuffer_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSound3DBuffer_GetAllParameters(p,a) (p)->lpVtbl->GetAllParameters(p,a) +#define IDirectSound3DBuffer_GetConeAngles(p,a,b) (p)->lpVtbl->GetConeAngles(p,a,b) +#define IDirectSound3DBuffer_GetConeOrientation(p,a) (p)->lpVtbl->GetConeOrientation(p,a) +#define IDirectSound3DBuffer_GetConeOutsideVolume(p,a) (p)->lpVtbl->GetConeOutsideVolume(p,a) +#define IDirectSound3DBuffer_GetPosition(p,a) (p)->lpVtbl->GetPosition(p,a) +#define IDirectSound3DBuffer_GetMinDistance(p,a) (p)->lpVtbl->GetMinDistance(p,a) +#define IDirectSound3DBuffer_GetMaxDistance(p,a) (p)->lpVtbl->GetMaxDistance(p,a) +#define IDirectSound3DBuffer_GetMode(p,a) (p)->lpVtbl->GetMode(p,a) +#define IDirectSound3DBuffer_GetVelocity(p,a) (p)->lpVtbl->GetVelocity(p,a) +#define IDirectSound3DBuffer_SetAllParameters(p,a,b) (p)->lpVtbl->SetAllParameters(p,a,b) +#define IDirectSound3DBuffer_SetConeAngles(p,a,b,c) (p)->lpVtbl->SetConeAngles(p,a,b,c) +#define IDirectSound3DBuffer_SetConeOrientation(p,a,b,c,d) (p)->lpVtbl->SetConeOrientation(p,a,b,c,d) +#define IDirectSound3DBuffer_SetConeOutsideVolume(p,a,b) (p)->lpVtbl->SetConeOutsideVolume(p,a,b) +#define IDirectSound3DBuffer_SetPosition(p,a,b,c,d) (p)->lpVtbl->SetPosition(p,a,b,c,d) +#define IDirectSound3DBuffer_SetMinDistance(p,a,b) (p)->lpVtbl->SetMinDistance(p,a,b) +#define IDirectSound3DBuffer_SetMaxDistance(p,a,b) (p)->lpVtbl->SetMaxDistance(p,a,b) +#define IDirectSound3DBuffer_SetMode(p,a,b) (p)->lpVtbl->SetMode(p,a,b) +#define IDirectSound3DBuffer_SetVelocity(p,a,b,c,d) (p)->lpVtbl->SetVelocity(p,a,b,c,d) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSound3DBuffer_GetAllParameters(p,a) (p)->GetAllParameters(a) +#define IDirectSound3DBuffer_GetConeAngles(p,a,b) (p)->GetConeAngles(a,b) +#define IDirectSound3DBuffer_GetConeOrientation(p,a) (p)->GetConeOrientation(a) +#define IDirectSound3DBuffer_GetConeOutsideVolume(p,a) (p)->GetConeOutsideVolume(a) +#define IDirectSound3DBuffer_GetPosition(p,a) (p)->GetPosition(a) +#define IDirectSound3DBuffer_GetMinDistance(p,a) (p)->GetMinDistance(a) +#define IDirectSound3DBuffer_GetMaxDistance(p,a) (p)->GetMaxDistance(a) +#define IDirectSound3DBuffer_GetMode(p,a) (p)->GetMode(a) +#define IDirectSound3DBuffer_GetVelocity(p,a) (p)->GetVelocity(a) +#define IDirectSound3DBuffer_SetAllParameters(p,a,b) (p)->SetAllParameters(a,b) +#define IDirectSound3DBuffer_SetConeAngles(p,a,b,c) (p)->SetConeAngles(a,b,c) +#define IDirectSound3DBuffer_SetConeOrientation(p,a,b,c,d) (p)->SetConeOrientation(a,b,c,d) +#define IDirectSound3DBuffer_SetConeOutsideVolume(p,a,b) (p)->SetConeOutsideVolume(a,b) +#define IDirectSound3DBuffer_SetPosition(p,a,b,c,d) (p)->SetPosition(a,b,c,d) +#define IDirectSound3DBuffer_SetMinDistance(p,a,b) (p)->SetMinDistance(a,b) +#define IDirectSound3DBuffer_SetMaxDistance(p,a,b) (p)->SetMaxDistance(a,b) +#define IDirectSound3DBuffer_SetMode(p,a,b) (p)->SetMode(a,b) +#define IDirectSound3DBuffer_SetVelocity(p,a,b,c,d) (p)->SetVelocity(a,b,c,d) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +// +// IDirectSoundCapture +// + +DEFINE_GUID(IID_IDirectSoundCapture, 0xb0210781, 0x89cd, 0x11d0, 0xaf, 0x8, 0x0, 0xa0, 0xc9, 0x25, 0xcd, 0x16); + +#undef INTERFACE +#define INTERFACE IDirectSoundCapture + +DECLARE_INTERFACE_(IDirectSoundCapture, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ __in REFIID, __deref_out LPVOID*) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSoundCapture methods + STDMETHOD(CreateCaptureBuffer) (THIS_ __in LPCDSCBUFFERDESC pcDSCBufferDesc, __deref_out LPDIRECTSOUNDCAPTUREBUFFER *ppDSCBuffer, __null LPUNKNOWN pUnkOuter) PURE; + STDMETHOD(GetCaps) (THIS_ __out LPDSCCAPS pDSCCaps) PURE; + STDMETHOD(Initialize) (THIS_ __in_opt LPCGUID pcGuidDevice) PURE; +}; + +#define IDirectSoundCapture_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSoundCapture_AddRef(p) IUnknown_AddRef(p) +#define IDirectSoundCapture_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundCapture_CreateCaptureBuffer(p,a,b,c) (p)->lpVtbl->CreateCaptureBuffer(p,a,b,c) +#define IDirectSoundCapture_GetCaps(p,a) (p)->lpVtbl->GetCaps(p,a) +#define IDirectSoundCapture_Initialize(p,a) (p)->lpVtbl->Initialize(p,a) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundCapture_CreateCaptureBuffer(p,a,b,c) (p)->CreateCaptureBuffer(a,b,c) +#define IDirectSoundCapture_GetCaps(p,a) (p)->GetCaps(a) +#define IDirectSoundCapture_Initialize(p,a) (p)->Initialize(a) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +// +// IDirectSoundCaptureBuffer +// + +DEFINE_GUID(IID_IDirectSoundCaptureBuffer, 0xb0210782, 0x89cd, 0x11d0, 0xaf, 0x8, 0x0, 0xa0, 0xc9, 0x25, 0xcd, 0x16); + +#undef INTERFACE +#define INTERFACE IDirectSoundCaptureBuffer + +DECLARE_INTERFACE_(IDirectSoundCaptureBuffer, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ __in REFIID, __deref_out LPVOID*) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSoundCaptureBuffer methods + STDMETHOD(GetCaps) (THIS_ __out LPDSCBCAPS pDSCBCaps) PURE; + STDMETHOD(GetCurrentPosition) (THIS_ __out_opt LPDWORD pdwCapturePosition, __out_opt LPDWORD pdwReadPosition) PURE; + STDMETHOD(GetFormat) (THIS_ __out_bcount_opt(dwSizeAllocated) LPWAVEFORMATEX pwfxFormat, DWORD dwSizeAllocated, __out_opt LPDWORD pdwSizeWritten) PURE; + STDMETHOD(GetStatus) (THIS_ __out LPDWORD pdwStatus) PURE; + STDMETHOD(Initialize) (THIS_ __in LPDIRECTSOUNDCAPTURE pDirectSoundCapture, __in LPCDSCBUFFERDESC pcDSCBufferDesc) PURE; + STDMETHOD(Lock) (THIS_ DWORD dwOffset, DWORD dwBytes, + __deref_out_bcount(*pdwAudioBytes1) LPVOID *ppvAudioPtr1, __out LPDWORD pdwAudioBytes1, + __deref_opt_out_bcount(*pdwAudioBytes2) LPVOID *ppvAudioPtr2, __out_opt LPDWORD pdwAudioBytes2, DWORD dwFlags) PURE; + STDMETHOD(Start) (THIS_ DWORD dwFlags) PURE; + STDMETHOD(Stop) (THIS) PURE; + STDMETHOD(Unlock) (THIS_ __in_bcount(dwAudioBytes1) LPVOID pvAudioPtr1, DWORD dwAudioBytes1, + __in_bcount_opt(dwAudioBytes2) LPVOID pvAudioPtr2, DWORD dwAudioBytes2) PURE; +}; + +#define IDirectSoundCaptureBuffer_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSoundCaptureBuffer_AddRef(p) IUnknown_AddRef(p) +#define IDirectSoundCaptureBuffer_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundCaptureBuffer_GetCaps(p,a) (p)->lpVtbl->GetCaps(p,a) +#define IDirectSoundCaptureBuffer_GetCurrentPosition(p,a,b) (p)->lpVtbl->GetCurrentPosition(p,a,b) +#define IDirectSoundCaptureBuffer_GetFormat(p,a,b,c) (p)->lpVtbl->GetFormat(p,a,b,c) +#define IDirectSoundCaptureBuffer_GetStatus(p,a) (p)->lpVtbl->GetStatus(p,a) +#define IDirectSoundCaptureBuffer_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b) +#define IDirectSoundCaptureBuffer_Lock(p,a,b,c,d,e,f,g) (p)->lpVtbl->Lock(p,a,b,c,d,e,f,g) +#define IDirectSoundCaptureBuffer_Start(p,a) (p)->lpVtbl->Start(p,a) +#define IDirectSoundCaptureBuffer_Stop(p) (p)->lpVtbl->Stop(p) +#define IDirectSoundCaptureBuffer_Unlock(p,a,b,c,d) (p)->lpVtbl->Unlock(p,a,b,c,d) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundCaptureBuffer_GetCaps(p,a) (p)->GetCaps(a) +#define IDirectSoundCaptureBuffer_GetCurrentPosition(p,a,b) (p)->GetCurrentPosition(a,b) +#define IDirectSoundCaptureBuffer_GetFormat(p,a,b,c) (p)->GetFormat(a,b,c) +#define IDirectSoundCaptureBuffer_GetStatus(p,a) (p)->GetStatus(a) +#define IDirectSoundCaptureBuffer_Initialize(p,a,b) (p)->Initialize(a,b) +#define IDirectSoundCaptureBuffer_Lock(p,a,b,c,d,e,f,g) (p)->Lock(a,b,c,d,e,f,g) +#define IDirectSoundCaptureBuffer_Start(p,a) (p)->Start(a) +#define IDirectSoundCaptureBuffer_Stop(p) (p)->Stop() +#define IDirectSoundCaptureBuffer_Unlock(p,a,b,c,d) (p)->Unlock(a,b,c,d) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +#if DIRECTSOUND_VERSION >= 0x0800 + +// +// IDirectSoundCaptureBuffer8 +// + +DEFINE_GUID(IID_IDirectSoundCaptureBuffer8, 0x990df4, 0xdbb, 0x4872, 0x83, 0x3e, 0x6d, 0x30, 0x3e, 0x80, 0xae, 0xb6); + +#undef INTERFACE +#define INTERFACE IDirectSoundCaptureBuffer8 + +DECLARE_INTERFACE_(IDirectSoundCaptureBuffer8, IDirectSoundCaptureBuffer) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ __in REFIID, __deref_out LPVOID*) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSoundCaptureBuffer methods + STDMETHOD(GetCaps) (THIS_ __out LPDSCBCAPS pDSCBCaps) PURE; + STDMETHOD(GetCurrentPosition) (THIS_ __out_opt LPDWORD pdwCapturePosition, __out_opt LPDWORD pdwReadPosition) PURE; + STDMETHOD(GetFormat) (THIS_ __out_bcount_opt(dwSizeAllocated) LPWAVEFORMATEX pwfxFormat, DWORD dwSizeAllocated, __out_opt LPDWORD pdwSizeWritten) PURE; + STDMETHOD(GetStatus) (THIS_ __out LPDWORD pdwStatus) PURE; + STDMETHOD(Initialize) (THIS_ __in LPDIRECTSOUNDCAPTURE pDirectSoundCapture, __in LPCDSCBUFFERDESC pcDSCBufferDesc) PURE; + STDMETHOD(Lock) (THIS_ DWORD dwOffset, DWORD dwBytes, + __deref_out_bcount(*pdwAudioBytes1) LPVOID *ppvAudioPtr1, __out LPDWORD pdwAudioBytes1, + __deref_opt_out_bcount(*pdwAudioBytes2) LPVOID *ppvAudioPtr2, __out_opt LPDWORD pdwAudioBytes2, DWORD dwFlags) PURE; + STDMETHOD(Start) (THIS_ DWORD dwFlags) PURE; + STDMETHOD(Stop) (THIS) PURE; + STDMETHOD(Unlock) (THIS_ __in_bcount(dwAudioBytes1) LPVOID pvAudioPtr1, DWORD dwAudioBytes1, + __in_bcount_opt(dwAudioBytes2) LPVOID pvAudioPtr2, DWORD dwAudioBytes2) PURE; + + // IDirectSoundCaptureBuffer8 methods + STDMETHOD(GetObjectInPath) (THIS_ __in REFGUID rguidObject, DWORD dwIndex, __in REFGUID rguidInterface, __deref_out LPVOID *ppObject) PURE; + STDMETHOD(GetFXStatus) (DWORD dwEffectsCount, __out_ecount(dwEffectsCount) LPDWORD pdwFXStatus) PURE; +}; + +#define IDirectSoundCaptureBuffer8_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSoundCaptureBuffer8_AddRef(p) IUnknown_AddRef(p) +#define IDirectSoundCaptureBuffer8_Release(p) IUnknown_Release(p) + +#define IDirectSoundCaptureBuffer8_GetCaps(p,a) IDirectSoundCaptureBuffer_GetCaps(p,a) +#define IDirectSoundCaptureBuffer8_GetCurrentPosition(p,a,b) IDirectSoundCaptureBuffer_GetCurrentPosition(p,a,b) +#define IDirectSoundCaptureBuffer8_GetFormat(p,a,b,c) IDirectSoundCaptureBuffer_GetFormat(p,a,b,c) +#define IDirectSoundCaptureBuffer8_GetStatus(p,a) IDirectSoundCaptureBuffer_GetStatus(p,a) +#define IDirectSoundCaptureBuffer8_Initialize(p,a,b) IDirectSoundCaptureBuffer_Initialize(p,a,b) +#define IDirectSoundCaptureBuffer8_Lock(p,a,b,c,d,e,f,g) IDirectSoundCaptureBuffer_Lock(p,a,b,c,d,e,f,g) +#define IDirectSoundCaptureBuffer8_Start(p,a) IDirectSoundCaptureBuffer_Start(p,a) +#define IDirectSoundCaptureBuffer8_Stop(p) IDirectSoundCaptureBuffer_Stop(p)) +#define IDirectSoundCaptureBuffer8_Unlock(p,a,b,c,d) IDirectSoundCaptureBuffer_Unlock(p,a,b,c,d) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundCaptureBuffer8_GetObjectInPath(p,a,b,c,d) (p)->lpVtbl->GetObjectInPath(p,a,b,c,d) +#define IDirectSoundCaptureBuffer8_GetFXStatus(p,a,b) (p)->lpVtbl->GetFXStatus(p,a,b) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundCaptureBuffer8_GetObjectInPath(p,a,b,c,d) (p)->GetObjectInPath(a,b,c,d) +#define IDirectSoundCaptureBuffer8_GetFXStatus(p,a,b) (p)->GetFXStatus(a,b) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +#endif // DIRECTSOUND_VERSION >= 0x0800 + +// +// IDirectSoundNotify +// + +DEFINE_GUID(IID_IDirectSoundNotify, 0xb0210783, 0x89cd, 0x11d0, 0xaf, 0x8, 0x0, 0xa0, 0xc9, 0x25, 0xcd, 0x16); + +#undef INTERFACE +#define INTERFACE IDirectSoundNotify + +DECLARE_INTERFACE_(IDirectSoundNotify, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ __in REFIID, __deref_out LPVOID*) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSoundNotify methods + STDMETHOD(SetNotificationPositions) (THIS_ DWORD dwPositionNotifies, __in_ecount(dwPositionNotifies) LPCDSBPOSITIONNOTIFY pcPositionNotifies) PURE; +}; + +#define IDirectSoundNotify_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSoundNotify_AddRef(p) IUnknown_AddRef(p) +#define IDirectSoundNotify_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundNotify_SetNotificationPositions(p,a,b) (p)->lpVtbl->SetNotificationPositions(p,a,b) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundNotify_SetNotificationPositions(p,a,b) (p)->SetNotificationPositions(a,b) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +// +// IKsPropertySet +// + +#ifndef _IKsPropertySet_ +#define _IKsPropertySet_ + +#ifdef __cplusplus +// 'struct' not 'class' per the way DECLARE_INTERFACE_ is defined +struct IKsPropertySet; +#endif // __cplusplus + +typedef struct IKsPropertySet *LPKSPROPERTYSET; + +#define KSPROPERTY_SUPPORT_GET 0x00000001 +#define KSPROPERTY_SUPPORT_SET 0x00000002 + +DEFINE_GUID(IID_IKsPropertySet, 0x31efac30, 0x515c, 0x11d0, 0xa9, 0xaa, 0x00, 0xaa, 0x00, 0x61, 0xbe, 0x93); + +#undef INTERFACE +#define INTERFACE IKsPropertySet + +DECLARE_INTERFACE_(IKsPropertySet, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ __in REFIID, __deref_out LPVOID*) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IKsPropertySet methods + STDMETHOD(Get) (THIS_ __in REFGUID rguidPropSet, ULONG ulId, __in_bcount(ulInstanceLength) LPVOID pInstanceData, ULONG ulInstanceLength, + __out_bcount(ulDataLength) LPVOID pPropertyData, ULONG ulDataLength, __out PULONG pulBytesReturned) PURE; + STDMETHOD(Set) (THIS_ __in REFGUID rguidPropSet, ULONG ulId, __in_bcount(ulInstanceLength) LPVOID pInstanceData, ULONG ulInstanceLength, + __in_bcount(ulDataLength) LPVOID pPropertyData, ULONG ulDataLength) PURE; + STDMETHOD(QuerySupport) (THIS_ __in REFGUID rguidPropSet, ULONG ulId, __out PULONG pulTypeSupport) PURE; +}; + +#define IKsPropertySet_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IKsPropertySet_AddRef(p) IUnknown_AddRef(p) +#define IKsPropertySet_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IKsPropertySet_Get(p,a,b,c,d,e,f,g) (p)->lpVtbl->Get(p,a,b,c,d,e,f,g) +#define IKsPropertySet_Set(p,a,b,c,d,e,f) (p)->lpVtbl->Set(p,a,b,c,d,e,f) +#define IKsPropertySet_QuerySupport(p,a,b,c) (p)->lpVtbl->QuerySupport(p,a,b,c) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IKsPropertySet_Get(p,a,b,c,d,e,f,g) (p)->Get(a,b,c,d,e,f,g) +#define IKsPropertySet_Set(p,a,b,c,d,e,f) (p)->Set(a,b,c,d,e,f) +#define IKsPropertySet_QuerySupport(p,a,b,c) (p)->QuerySupport(a,b,c) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +#endif // _IKsPropertySet_ + +#if DIRECTSOUND_VERSION >= 0x0800 + +// +// IDirectSoundFXGargle +// + +DEFINE_GUID(IID_IDirectSoundFXGargle, 0xd616f352, 0xd622, 0x11ce, 0xaa, 0xc5, 0x00, 0x20, 0xaf, 0x0b, 0x99, 0xa3); + +typedef struct _DSFXGargle +{ + DWORD dwRateHz; // Rate of modulation in hz + DWORD dwWaveShape; // DSFXGARGLE_WAVE_xxx +} DSFXGargle, *LPDSFXGargle; + +#define DSFXGARGLE_WAVE_TRIANGLE 0 +#define DSFXGARGLE_WAVE_SQUARE 1 + +typedef const DSFXGargle *LPCDSFXGargle; + +#define DSFXGARGLE_RATEHZ_MIN 1 +#define DSFXGARGLE_RATEHZ_MAX 1000 + +#undef INTERFACE +#define INTERFACE IDirectSoundFXGargle + +DECLARE_INTERFACE_(IDirectSoundFXGargle, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ __in REFIID, __deref_out LPVOID*) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSoundFXGargle methods + STDMETHOD(SetAllParameters) (THIS_ __in LPCDSFXGargle pcDsFxGargle) PURE; + STDMETHOD(GetAllParameters) (THIS_ __out LPDSFXGargle pDsFxGargle) PURE; +}; + +#define IDirectSoundFXGargle_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSoundFXGargle_AddRef(p) IUnknown_AddRef(p) +#define IDirectSoundFXGargle_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundFXGargle_SetAllParameters(p,a) (p)->lpVtbl->SetAllParameters(p,a) +#define IDirectSoundFXGargle_GetAllParameters(p,a) (p)->lpVtbl->GetAllParameters(p,a) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundFXGargle_SetAllParameters(p,a) (p)->SetAllParameters(a) +#define IDirectSoundFXGargle_GetAllParameters(p,a) (p)->GetAllParameters(a) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +// +// IDirectSoundFXChorus +// + +DEFINE_GUID(IID_IDirectSoundFXChorus, 0x880842e3, 0x145f, 0x43e6, 0xa9, 0x34, 0xa7, 0x18, 0x06, 0xe5, 0x05, 0x47); + +typedef struct _DSFXChorus +{ + FLOAT fWetDryMix; + FLOAT fDepth; + FLOAT fFeedback; + FLOAT fFrequency; + LONG lWaveform; // LFO shape; DSFXCHORUS_WAVE_xxx + FLOAT fDelay; + LONG lPhase; +} DSFXChorus, *LPDSFXChorus; + +typedef const DSFXChorus *LPCDSFXChorus; + +#define DSFXCHORUS_WAVE_TRIANGLE 0 +#define DSFXCHORUS_WAVE_SIN 1 + +#define DSFXCHORUS_WETDRYMIX_MIN 0.0f +#define DSFXCHORUS_WETDRYMIX_MAX 100.0f +#define DSFXCHORUS_DEPTH_MIN 0.0f +#define DSFXCHORUS_DEPTH_MAX 100.0f +#define DSFXCHORUS_FEEDBACK_MIN -99.0f +#define DSFXCHORUS_FEEDBACK_MAX 99.0f +#define DSFXCHORUS_FREQUENCY_MIN 0.0f +#define DSFXCHORUS_FREQUENCY_MAX 10.0f +#define DSFXCHORUS_DELAY_MIN 0.0f +#define DSFXCHORUS_DELAY_MAX 20.0f +#define DSFXCHORUS_PHASE_MIN 0 +#define DSFXCHORUS_PHASE_MAX 4 + +#define DSFXCHORUS_PHASE_NEG_180 0 +#define DSFXCHORUS_PHASE_NEG_90 1 +#define DSFXCHORUS_PHASE_ZERO 2 +#define DSFXCHORUS_PHASE_90 3 +#define DSFXCHORUS_PHASE_180 4 + +#undef INTERFACE +#define INTERFACE IDirectSoundFXChorus + +DECLARE_INTERFACE_(IDirectSoundFXChorus, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ __in REFIID, __deref_out LPVOID*) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSoundFXChorus methods + STDMETHOD(SetAllParameters) (THIS_ __in LPCDSFXChorus pcDsFxChorus) PURE; + STDMETHOD(GetAllParameters) (THIS_ __out LPDSFXChorus pDsFxChorus) PURE; +}; + +#define IDirectSoundFXChorus_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSoundFXChorus_AddRef(p) IUnknown_AddRef(p) +#define IDirectSoundFXChorus_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundFXChorus_SetAllParameters(p,a) (p)->lpVtbl->SetAllParameters(p,a) +#define IDirectSoundFXChorus_GetAllParameters(p,a) (p)->lpVtbl->GetAllParameters(p,a) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundFXChorus_SetAllParameters(p,a) (p)->SetAllParameters(a) +#define IDirectSoundFXChorus_GetAllParameters(p,a) (p)->GetAllParameters(a) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +// +// IDirectSoundFXFlanger +// + +DEFINE_GUID(IID_IDirectSoundFXFlanger, 0x903e9878, 0x2c92, 0x4072, 0x9b, 0x2c, 0xea, 0x68, 0xf5, 0x39, 0x67, 0x83); + +typedef struct _DSFXFlanger +{ + FLOAT fWetDryMix; + FLOAT fDepth; + FLOAT fFeedback; + FLOAT fFrequency; + LONG lWaveform; + FLOAT fDelay; + LONG lPhase; +} DSFXFlanger, *LPDSFXFlanger; + +typedef const DSFXFlanger *LPCDSFXFlanger; + +#define DSFXFLANGER_WAVE_TRIANGLE 0 +#define DSFXFLANGER_WAVE_SIN 1 + +#define DSFXFLANGER_WETDRYMIX_MIN 0.0f +#define DSFXFLANGER_WETDRYMIX_MAX 100.0f +#define DSFXFLANGER_FREQUENCY_MIN 0.0f +#define DSFXFLANGER_FREQUENCY_MAX 10.0f +#define DSFXFLANGER_DEPTH_MIN 0.0f +#define DSFXFLANGER_DEPTH_MAX 100.0f +#define DSFXFLANGER_PHASE_MIN 0 +#define DSFXFLANGER_PHASE_MAX 4 +#define DSFXFLANGER_FEEDBACK_MIN -99.0f +#define DSFXFLANGER_FEEDBACK_MAX 99.0f +#define DSFXFLANGER_DELAY_MIN 0.0f +#define DSFXFLANGER_DELAY_MAX 4.0f + +#define DSFXFLANGER_PHASE_NEG_180 0 +#define DSFXFLANGER_PHASE_NEG_90 1 +#define DSFXFLANGER_PHASE_ZERO 2 +#define DSFXFLANGER_PHASE_90 3 +#define DSFXFLANGER_PHASE_180 4 + +#undef INTERFACE +#define INTERFACE IDirectSoundFXFlanger + +DECLARE_INTERFACE_(IDirectSoundFXFlanger, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ __in REFIID, __deref_out LPVOID*) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSoundFXFlanger methods + STDMETHOD(SetAllParameters) (THIS_ __in LPCDSFXFlanger pcDsFxFlanger) PURE; + STDMETHOD(GetAllParameters) (THIS_ __out LPDSFXFlanger pDsFxFlanger) PURE; +}; + +#define IDirectSoundFXFlanger_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSoundFXFlanger_AddRef(p) IUnknown_AddRef(p) +#define IDirectSoundFXFlanger_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundFXFlanger_SetAllParameters(p,a) (p)->lpVtbl->SetAllParameters(p,a) +#define IDirectSoundFXFlanger_GetAllParameters(p,a) (p)->lpVtbl->GetAllParameters(p,a) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundFXFlanger_SetAllParameters(p,a) (p)->SetAllParameters(a) +#define IDirectSoundFXFlanger_GetAllParameters(p,a) (p)->GetAllParameters(a) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +// +// IDirectSoundFXEcho +// + +DEFINE_GUID(IID_IDirectSoundFXEcho, 0x8bd28edf, 0x50db, 0x4e92, 0xa2, 0xbd, 0x44, 0x54, 0x88, 0xd1, 0xed, 0x42); + +typedef struct _DSFXEcho +{ + FLOAT fWetDryMix; + FLOAT fFeedback; + FLOAT fLeftDelay; + FLOAT fRightDelay; + LONG lPanDelay; +} DSFXEcho, *LPDSFXEcho; + +typedef const DSFXEcho *LPCDSFXEcho; + +#define DSFXECHO_WETDRYMIX_MIN 0.0f +#define DSFXECHO_WETDRYMIX_MAX 100.0f +#define DSFXECHO_FEEDBACK_MIN 0.0f +#define DSFXECHO_FEEDBACK_MAX 100.0f +#define DSFXECHO_LEFTDELAY_MIN 1.0f +#define DSFXECHO_LEFTDELAY_MAX 2000.0f +#define DSFXECHO_RIGHTDELAY_MIN 1.0f +#define DSFXECHO_RIGHTDELAY_MAX 2000.0f +#define DSFXECHO_PANDELAY_MIN 0 +#define DSFXECHO_PANDELAY_MAX 1 + +#undef INTERFACE +#define INTERFACE IDirectSoundFXEcho + +DECLARE_INTERFACE_(IDirectSoundFXEcho, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ __in REFIID, __deref_out LPVOID*) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSoundFXEcho methods + STDMETHOD(SetAllParameters) (THIS_ __in LPCDSFXEcho pcDsFxEcho) PURE; + STDMETHOD(GetAllParameters) (THIS_ __out LPDSFXEcho pDsFxEcho) PURE; +}; + +#define IDirectSoundFXEcho_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSoundFXEcho_AddRef(p) IUnknown_AddRef(p) +#define IDirectSoundFXEcho_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundFXEcho_SetAllParameters(p,a) (p)->lpVtbl->SetAllParameters(p,a) +#define IDirectSoundFXEcho_GetAllParameters(p,a) (p)->lpVtbl->GetAllParameters(p,a) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundFXEcho_SetAllParameters(p,a) (p)->SetAllParameters(a) +#define IDirectSoundFXEcho_GetAllParameters(p,a) (p)->GetAllParameters(a) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +// +// IDirectSoundFXDistortion +// + +DEFINE_GUID(IID_IDirectSoundFXDistortion, 0x8ecf4326, 0x455f, 0x4d8b, 0xbd, 0xa9, 0x8d, 0x5d, 0x3e, 0x9e, 0x3e, 0x0b); + +typedef struct _DSFXDistortion +{ + FLOAT fGain; + FLOAT fEdge; + FLOAT fPostEQCenterFrequency; + FLOAT fPostEQBandwidth; + FLOAT fPreLowpassCutoff; +} DSFXDistortion, *LPDSFXDistortion; + +typedef const DSFXDistortion *LPCDSFXDistortion; + +#define DSFXDISTORTION_GAIN_MIN -60.0f +#define DSFXDISTORTION_GAIN_MAX 0.0f +#define DSFXDISTORTION_EDGE_MIN 0.0f +#define DSFXDISTORTION_EDGE_MAX 100.0f +#define DSFXDISTORTION_POSTEQCENTERFREQUENCY_MIN 100.0f +#define DSFXDISTORTION_POSTEQCENTERFREQUENCY_MAX 8000.0f +#define DSFXDISTORTION_POSTEQBANDWIDTH_MIN 100.0f +#define DSFXDISTORTION_POSTEQBANDWIDTH_MAX 8000.0f +#define DSFXDISTORTION_PRELOWPASSCUTOFF_MIN 100.0f +#define DSFXDISTORTION_PRELOWPASSCUTOFF_MAX 8000.0f + +#undef INTERFACE +#define INTERFACE IDirectSoundFXDistortion + +DECLARE_INTERFACE_(IDirectSoundFXDistortion, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ __in REFIID, __deref_out LPVOID*) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSoundFXDistortion methods + STDMETHOD(SetAllParameters) (THIS_ __in LPCDSFXDistortion pcDsFxDistortion) PURE; + STDMETHOD(GetAllParameters) (THIS_ __out LPDSFXDistortion pDsFxDistortion) PURE; +}; + +#define IDirectSoundFXDistortion_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSoundFXDistortion_AddRef(p) IUnknown_AddRef(p) +#define IDirectSoundFXDistortion_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundFXDistortion_SetAllParameters(p,a) (p)->lpVtbl->SetAllParameters(p,a) +#define IDirectSoundFXDistortion_GetAllParameters(p,a) (p)->lpVtbl->GetAllParameters(p,a) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundFXDistortion_SetAllParameters(p,a) (p)->SetAllParameters(a) +#define IDirectSoundFXDistortion_GetAllParameters(p,a) (p)->GetAllParameters(a) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +// +// IDirectSoundFXCompressor +// + +DEFINE_GUID(IID_IDirectSoundFXCompressor, 0x4bbd1154, 0x62f6, 0x4e2c, 0xa1, 0x5c, 0xd3, 0xb6, 0xc4, 0x17, 0xf7, 0xa0); + +typedef struct _DSFXCompressor +{ + FLOAT fGain; + FLOAT fAttack; + FLOAT fRelease; + FLOAT fThreshold; + FLOAT fRatio; + FLOAT fPredelay; +} DSFXCompressor, *LPDSFXCompressor; + +typedef const DSFXCompressor *LPCDSFXCompressor; + +#define DSFXCOMPRESSOR_GAIN_MIN -60.0f +#define DSFXCOMPRESSOR_GAIN_MAX 60.0f +#define DSFXCOMPRESSOR_ATTACK_MIN 0.01f +#define DSFXCOMPRESSOR_ATTACK_MAX 500.0f +#define DSFXCOMPRESSOR_RELEASE_MIN 50.0f +#define DSFXCOMPRESSOR_RELEASE_MAX 3000.0f +#define DSFXCOMPRESSOR_THRESHOLD_MIN -60.0f +#define DSFXCOMPRESSOR_THRESHOLD_MAX 0.0f +#define DSFXCOMPRESSOR_RATIO_MIN 1.0f +#define DSFXCOMPRESSOR_RATIO_MAX 100.0f +#define DSFXCOMPRESSOR_PREDELAY_MIN 0.0f +#define DSFXCOMPRESSOR_PREDELAY_MAX 4.0f + +#undef INTERFACE +#define INTERFACE IDirectSoundFXCompressor + +DECLARE_INTERFACE_(IDirectSoundFXCompressor, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ __in REFIID, __deref_out LPVOID*) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSoundFXCompressor methods + STDMETHOD(SetAllParameters) (THIS_ __in LPCDSFXCompressor pcDsFxCompressor) PURE; + STDMETHOD(GetAllParameters) (THIS_ __out LPDSFXCompressor pDsFxCompressor) PURE; +}; + +#define IDirectSoundFXCompressor_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSoundFXCompressor_AddRef(p) IUnknown_AddRef(p) +#define IDirectSoundFXCompressor_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundFXCompressor_SetAllParameters(p,a) (p)->lpVtbl->SetAllParameters(p,a) +#define IDirectSoundFXCompressor_GetAllParameters(p,a) (p)->lpVtbl->GetAllParameters(p,a) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundFXCompressor_SetAllParameters(p,a) (p)->SetAllParameters(a) +#define IDirectSoundFXCompressor_GetAllParameters(p,a) (p)->GetAllParameters(a) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +// +// IDirectSoundFXParamEq +// + +DEFINE_GUID(IID_IDirectSoundFXParamEq, 0xc03ca9fe, 0xfe90, 0x4204, 0x80, 0x78, 0x82, 0x33, 0x4c, 0xd1, 0x77, 0xda); + +typedef struct _DSFXParamEq +{ + FLOAT fCenter; + FLOAT fBandwidth; + FLOAT fGain; +} DSFXParamEq, *LPDSFXParamEq; + +typedef const DSFXParamEq *LPCDSFXParamEq; + +#define DSFXPARAMEQ_CENTER_MIN 80.0f +#define DSFXPARAMEQ_CENTER_MAX 16000.0f +#define DSFXPARAMEQ_BANDWIDTH_MIN 1.0f +#define DSFXPARAMEQ_BANDWIDTH_MAX 36.0f +#define DSFXPARAMEQ_GAIN_MIN -15.0f +#define DSFXPARAMEQ_GAIN_MAX 15.0f + +#undef INTERFACE +#define INTERFACE IDirectSoundFXParamEq + +DECLARE_INTERFACE_(IDirectSoundFXParamEq, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ __in REFIID, __deref_out LPVOID*) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSoundFXParamEq methods + STDMETHOD(SetAllParameters) (THIS_ __in LPCDSFXParamEq pcDsFxParamEq) PURE; + STDMETHOD(GetAllParameters) (THIS_ __out LPDSFXParamEq pDsFxParamEq) PURE; +}; + +#define IDirectSoundFXParamEq_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSoundFXParamEq_AddRef(p) IUnknown_AddRef(p) +#define IDirectSoundFXParamEq_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundFXParamEq_SetAllParameters(p,a) (p)->lpVtbl->SetAllParameters(p,a) +#define IDirectSoundFXParamEq_GetAllParameters(p,a) (p)->lpVtbl->GetAllParameters(p,a) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundFXParamEq_SetAllParameters(p,a) (p)->SetAllParameters(a) +#define IDirectSoundFXParamEq_GetAllParameters(p,a) (p)->GetAllParameters(a) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +// +// IDirectSoundFXI3DL2Reverb +// + +DEFINE_GUID(IID_IDirectSoundFXI3DL2Reverb, 0x4b166a6a, 0x0d66, 0x43f3, 0x80, 0xe3, 0xee, 0x62, 0x80, 0xde, 0xe1, 0xa4); + +typedef struct _DSFXI3DL2Reverb +{ + LONG lRoom; // [-10000, 0] default: -1000 mB + LONG lRoomHF; // [-10000, 0] default: 0 mB + FLOAT flRoomRolloffFactor; // [0.0, 10.0] default: 0.0 + FLOAT flDecayTime; // [0.1, 20.0] default: 1.49s + FLOAT flDecayHFRatio; // [0.1, 2.0] default: 0.83 + LONG lReflections; // [-10000, 1000] default: -2602 mB + FLOAT flReflectionsDelay; // [0.0, 0.3] default: 0.007 s + LONG lReverb; // [-10000, 2000] default: 200 mB + FLOAT flReverbDelay; // [0.0, 0.1] default: 0.011 s + FLOAT flDiffusion; // [0.0, 100.0] default: 100.0 % + FLOAT flDensity; // [0.0, 100.0] default: 100.0 % + FLOAT flHFReference; // [20.0, 20000.0] default: 5000.0 Hz +} DSFXI3DL2Reverb, *LPDSFXI3DL2Reverb; + +typedef const DSFXI3DL2Reverb *LPCDSFXI3DL2Reverb; + +#define DSFX_I3DL2REVERB_ROOM_MIN (-10000) +#define DSFX_I3DL2REVERB_ROOM_MAX 0 +#define DSFX_I3DL2REVERB_ROOM_DEFAULT (-1000) + +#define DSFX_I3DL2REVERB_ROOMHF_MIN (-10000) +#define DSFX_I3DL2REVERB_ROOMHF_MAX 0 +#define DSFX_I3DL2REVERB_ROOMHF_DEFAULT (-100) + +#define DSFX_I3DL2REVERB_ROOMROLLOFFFACTOR_MIN 0.0f +#define DSFX_I3DL2REVERB_ROOMROLLOFFFACTOR_MAX 10.0f +#define DSFX_I3DL2REVERB_ROOMROLLOFFFACTOR_DEFAULT 0.0f + +#define DSFX_I3DL2REVERB_DECAYTIME_MIN 0.1f +#define DSFX_I3DL2REVERB_DECAYTIME_MAX 20.0f +#define DSFX_I3DL2REVERB_DECAYTIME_DEFAULT 1.49f + +#define DSFX_I3DL2REVERB_DECAYHFRATIO_MIN 0.1f +#define DSFX_I3DL2REVERB_DECAYHFRATIO_MAX 2.0f +#define DSFX_I3DL2REVERB_DECAYHFRATIO_DEFAULT 0.83f + +#define DSFX_I3DL2REVERB_REFLECTIONS_MIN (-10000) +#define DSFX_I3DL2REVERB_REFLECTIONS_MAX 1000 +#define DSFX_I3DL2REVERB_REFLECTIONS_DEFAULT (-2602) + +#define DSFX_I3DL2REVERB_REFLECTIONSDELAY_MIN 0.0f +#define DSFX_I3DL2REVERB_REFLECTIONSDELAY_MAX 0.3f +#define DSFX_I3DL2REVERB_REFLECTIONSDELAY_DEFAULT 0.007f + +#define DSFX_I3DL2REVERB_REVERB_MIN (-10000) +#define DSFX_I3DL2REVERB_REVERB_MAX 2000 +#define DSFX_I3DL2REVERB_REVERB_DEFAULT (200) + +#define DSFX_I3DL2REVERB_REVERBDELAY_MIN 0.0f +#define DSFX_I3DL2REVERB_REVERBDELAY_MAX 0.1f +#define DSFX_I3DL2REVERB_REVERBDELAY_DEFAULT 0.011f + +#define DSFX_I3DL2REVERB_DIFFUSION_MIN 0.0f +#define DSFX_I3DL2REVERB_DIFFUSION_MAX 100.0f +#define DSFX_I3DL2REVERB_DIFFUSION_DEFAULT 100.0f + +#define DSFX_I3DL2REVERB_DENSITY_MIN 0.0f +#define DSFX_I3DL2REVERB_DENSITY_MAX 100.0f +#define DSFX_I3DL2REVERB_DENSITY_DEFAULT 100.0f + +#define DSFX_I3DL2REVERB_HFREFERENCE_MIN 20.0f +#define DSFX_I3DL2REVERB_HFREFERENCE_MAX 20000.0f +#define DSFX_I3DL2REVERB_HFREFERENCE_DEFAULT 5000.0f + +#define DSFX_I3DL2REVERB_QUALITY_MIN 0 +#define DSFX_I3DL2REVERB_QUALITY_MAX 3 +#define DSFX_I3DL2REVERB_QUALITY_DEFAULT 2 + +#undef INTERFACE +#define INTERFACE IDirectSoundFXI3DL2Reverb + +DECLARE_INTERFACE_(IDirectSoundFXI3DL2Reverb, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ __in REFIID, __deref_out LPVOID*) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSoundFXI3DL2Reverb methods + STDMETHOD(SetAllParameters) (THIS_ __in LPCDSFXI3DL2Reverb pcDsFxI3DL2Reverb) PURE; + STDMETHOD(GetAllParameters) (THIS_ __out LPDSFXI3DL2Reverb pDsFxI3DL2Reverb) PURE; + STDMETHOD(SetPreset) (THIS_ DWORD dwPreset) PURE; + STDMETHOD(GetPreset) (THIS_ __out LPDWORD pdwPreset) PURE; + STDMETHOD(SetQuality) (THIS_ LONG lQuality) PURE; + STDMETHOD(GetQuality) (THIS_ __out LONG *plQuality) PURE; +}; + +#define IDirectSoundFXI3DL2Reverb_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSoundFXI3DL2Reverb_AddRef(p) IUnknown_AddRef(p) +#define IDirectSoundFXI3DL2Reverb_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundFXI3DL2Reverb_SetAllParameters(p,a) (p)->lpVtbl->SetAllParameters(p,a) +#define IDirectSoundFXI3DL2Reverb_GetAllParameters(p,a) (p)->lpVtbl->GetAllParameters(p,a) +#define IDirectSoundFXI3DL2Reverb_SetPreset(p,a) (p)->lpVtbl->SetPreset(p,a) +#define IDirectSoundFXI3DL2Reverb_GetPreset(p,a) (p)->lpVtbl->GetPreset(p,a) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundFXI3DL2Reverb_SetAllParameters(p,a) (p)->SetAllParameters(a) +#define IDirectSoundFXI3DL2Reverb_GetAllParameters(p,a) (p)->GetAllParameters(a) +#define IDirectSoundFXI3DL2Reverb_SetPreset(p,a) (p)->SetPreset(a) +#define IDirectSoundFXI3DL2Reverb_GetPreset(p,a) (p)->GetPreset(a) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +// +// IDirectSoundFXWavesReverb +// + +DEFINE_GUID(IID_IDirectSoundFXWavesReverb,0x46858c3a,0x0dc6,0x45e3,0xb7,0x60,0xd4,0xee,0xf1,0x6c,0xb3,0x25); + +typedef struct _DSFXWavesReverb +{ + FLOAT fInGain; // [-96.0,0.0] default: 0.0 dB + FLOAT fReverbMix; // [-96.0,0.0] default: 0.0 db + FLOAT fReverbTime; // [0.001,3000.0] default: 1000.0 ms + FLOAT fHighFreqRTRatio; // [0.001,0.999] default: 0.001 +} DSFXWavesReverb, *LPDSFXWavesReverb; + +typedef const DSFXWavesReverb *LPCDSFXWavesReverb; + +#define DSFX_WAVESREVERB_INGAIN_MIN -96.0f +#define DSFX_WAVESREVERB_INGAIN_MAX 0.0f +#define DSFX_WAVESREVERB_INGAIN_DEFAULT 0.0f +#define DSFX_WAVESREVERB_REVERBMIX_MIN -96.0f +#define DSFX_WAVESREVERB_REVERBMIX_MAX 0.0f +#define DSFX_WAVESREVERB_REVERBMIX_DEFAULT 0.0f +#define DSFX_WAVESREVERB_REVERBTIME_MIN 0.001f +#define DSFX_WAVESREVERB_REVERBTIME_MAX 3000.0f +#define DSFX_WAVESREVERB_REVERBTIME_DEFAULT 1000.0f +#define DSFX_WAVESREVERB_HIGHFREQRTRATIO_MIN 0.001f +#define DSFX_WAVESREVERB_HIGHFREQRTRATIO_MAX 0.999f +#define DSFX_WAVESREVERB_HIGHFREQRTRATIO_DEFAULT 0.001f + +#undef INTERFACE +#define INTERFACE IDirectSoundFXWavesReverb + +DECLARE_INTERFACE_(IDirectSoundFXWavesReverb, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ __in REFIID, __deref_out LPVOID*) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSoundFXWavesReverb methods + STDMETHOD(SetAllParameters) (THIS_ __in LPCDSFXWavesReverb pcDsFxWavesReverb) PURE; + STDMETHOD(GetAllParameters) (THIS_ __out LPDSFXWavesReverb pDsFxWavesReverb) PURE; +}; + +#define IDirectSoundFXWavesReverb_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSoundFXWavesReverb_AddRef(p) IUnknown_AddRef(p) +#define IDirectSoundFXWavesReverb_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundFXWavesReverb_SetAllParameters(p,a) (p)->lpVtbl->SetAllParameters(p,a) +#define IDirectSoundFXWavesReverb_GetAllParameters(p,a) (p)->lpVtbl->GetAllParameters(p,a) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundFXWavesReverb_SetAllParameters(p,a) (p)->SetAllParameters(a) +#define IDirectSoundFXWavesReverb_GetAllParameters(p,a) (p)->GetAllParameters(a) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +// +// IDirectSoundCaptureFXAec +// + +DEFINE_GUID(IID_IDirectSoundCaptureFXAec, 0xad74143d, 0x903d, 0x4ab7, 0x80, 0x66, 0x28, 0xd3, 0x63, 0x03, 0x6d, 0x65); + +typedef struct _DSCFXAec +{ + BOOL fEnable; + BOOL fNoiseFill; + DWORD dwMode; +} DSCFXAec, *LPDSCFXAec; + +typedef const DSCFXAec *LPCDSCFXAec; + +// These match the AEC_MODE_* constants in the DDK's ksmedia.h file +#define DSCFX_AEC_MODE_PASS_THROUGH 0x0 +#define DSCFX_AEC_MODE_HALF_DUPLEX 0x1 +#define DSCFX_AEC_MODE_FULL_DUPLEX 0x2 + +// These match the AEC_STATUS_* constants in ksmedia.h +#define DSCFX_AEC_STATUS_HISTORY_UNINITIALIZED 0x0 +#define DSCFX_AEC_STATUS_HISTORY_CONTINUOUSLY_CONVERGED 0x1 +#define DSCFX_AEC_STATUS_HISTORY_PREVIOUSLY_DIVERGED 0x2 +#define DSCFX_AEC_STATUS_CURRENTLY_CONVERGED 0x8 + +#undef INTERFACE +#define INTERFACE IDirectSoundCaptureFXAec + +DECLARE_INTERFACE_(IDirectSoundCaptureFXAec, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ __in REFIID, __deref_out LPVOID*) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSoundCaptureFXAec methods + STDMETHOD(SetAllParameters) (THIS_ __in LPCDSCFXAec pDscFxAec) PURE; + STDMETHOD(GetAllParameters) (THIS_ __out LPDSCFXAec pDscFxAec) PURE; + STDMETHOD(GetStatus) (THIS_ __out LPDWORD pdwStatus) PURE; + STDMETHOD(Reset) (THIS) PURE; +}; + +#define IDirectSoundCaptureFXAec_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSoundCaptureFXAec_AddRef(p) IUnknown_AddRef(p) +#define IDirectSoundCaptureFXAec_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundCaptureFXAec_SetAllParameters(p,a) (p)->lpVtbl->SetAllParameters(p,a) +#define IDirectSoundCaptureFXAec_GetAllParameters(p,a) (p)->lpVtbl->GetAllParameters(p,a) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundCaptureFXAec_SetAllParameters(p,a) (p)->SetAllParameters(a) +#define IDirectSoundCaptureFXAec_GetAllParameters(p,a) (p)->GetAllParameters(a) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + + +// +// IDirectSoundCaptureFXNoiseSuppress +// + +DEFINE_GUID(IID_IDirectSoundCaptureFXNoiseSuppress, 0xed311e41, 0xfbae, 0x4175, 0x96, 0x25, 0xcd, 0x8, 0x54, 0xf6, 0x93, 0xca); + +typedef struct _DSCFXNoiseSuppress +{ + BOOL fEnable; +} DSCFXNoiseSuppress, *LPDSCFXNoiseSuppress; + +typedef const DSCFXNoiseSuppress *LPCDSCFXNoiseSuppress; + +#undef INTERFACE +#define INTERFACE IDirectSoundCaptureFXNoiseSuppress + +DECLARE_INTERFACE_(IDirectSoundCaptureFXNoiseSuppress, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ __in REFIID, __deref_out LPVOID*) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSoundCaptureFXNoiseSuppress methods + STDMETHOD(SetAllParameters) (THIS_ __in LPCDSCFXNoiseSuppress pcDscFxNoiseSuppress) PURE; + STDMETHOD(GetAllParameters) (THIS_ __out LPDSCFXNoiseSuppress pDscFxNoiseSuppress) PURE; + STDMETHOD(Reset) (THIS) PURE; +}; + +#define IDirectSoundCaptureFXNoiseSuppress_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSoundCaptureFXNoiseSuppress_AddRef(p) IUnknown_AddRef(p) +#define IDirectSoundCaptureFXNoiseSuppress_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundCaptureFXNoiseSuppress_SetAllParameters(p,a) (p)->lpVtbl->SetAllParameters(p,a) +#define IDirectSoundCaptureFXNoiseSuppress_GetAllParameters(p,a) (p)->lpVtbl->GetAllParameters(p,a) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundCaptureFXNoiseSuppress_SetAllParameters(p,a) (p)->SetAllParameters(a) +#define IDirectSoundCaptureFXNoiseSuppress_GetAllParameters(p,a) (p)->GetAllParameters(a) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + + +// +// IDirectSoundFullDuplex +// + +#ifndef _IDirectSoundFullDuplex_ +#define _IDirectSoundFullDuplex_ + +#ifdef __cplusplus +// 'struct' not 'class' per the way DECLARE_INTERFACE_ is defined +struct IDirectSoundFullDuplex; +#endif // __cplusplus + +typedef struct IDirectSoundFullDuplex *LPDIRECTSOUNDFULLDUPLEX; + +DEFINE_GUID(IID_IDirectSoundFullDuplex, 0xedcb4c7a, 0xdaab, 0x4216, 0xa4, 0x2e, 0x6c, 0x50, 0x59, 0x6d, 0xdc, 0x1d); + +#undef INTERFACE +#define INTERFACE IDirectSoundFullDuplex + +DECLARE_INTERFACE_(IDirectSoundFullDuplex, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ __in REFIID, __deref_out LPVOID*) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IDirectSoundFullDuplex methods + STDMETHOD(Initialize) (THIS_ __in LPCGUID pCaptureGuid, __in LPCGUID pRenderGuid, __in LPCDSCBUFFERDESC lpDscBufferDesc, __in LPCDSBUFFERDESC lpDsBufferDesc, HWND hWnd, DWORD dwLevel, + __deref_out LPLPDIRECTSOUNDCAPTUREBUFFER8 lplpDirectSoundCaptureBuffer8, __deref_out LPLPDIRECTSOUNDBUFFER8 lplpDirectSoundBuffer8) PURE; +}; + +#define IDirectSoundFullDuplex_QueryInterface(p,a,b) IUnknown_QueryInterface(p,a,b) +#define IDirectSoundFullDuplex_AddRef(p) IUnknown_AddRef(p) +#define IDirectSoundFullDuplex_Release(p) IUnknown_Release(p) + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundFullDuplex_Initialize(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->Initialize(p,a,b,c,d,e,f,g,h) +#else // !defined(__cplusplus) || defined(CINTERFACE) +#define IDirectSoundFullDuplex_Initialize(p,a,b,c,d,e,f,g,h) (p)->Initialize(a,b,c,d,e,f,g,h) +#endif // !defined(__cplusplus) || defined(CINTERFACE) + +#endif // _IDirectSoundFullDuplex_ + +#endif // DIRECTSOUND_VERSION >= 0x0800 + +// +// Return Codes +// + +// The function completed successfully +#define DS_OK S_OK + +// The call succeeded, but we had to substitute the 3D algorithm +#define DS_NO_VIRTUALIZATION MAKE_HRESULT(0, _FACDS, 10) + +// The call failed because resources (such as a priority level) +// were already being used by another caller +#define DSERR_ALLOCATED MAKE_DSHRESULT(10) + +// The control (vol, pan, etc.) requested by the caller is not available +#define DSERR_CONTROLUNAVAIL MAKE_DSHRESULT(30) + +// An invalid parameter was passed to the returning function +#define DSERR_INVALIDPARAM E_INVALIDARG + +// This call is not valid for the current state of this object +#define DSERR_INVALIDCALL MAKE_DSHRESULT(50) + +// An undetermined error occurred inside the DirectSound subsystem +#define DSERR_GENERIC E_FAIL + +// The caller does not have the priority level required for the function to +// succeed +#define DSERR_PRIOLEVELNEEDED MAKE_DSHRESULT(70) + +// Not enough free memory is available to complete the operation +#define DSERR_OUTOFMEMORY E_OUTOFMEMORY + +// The specified WAVE format is not supported +#define DSERR_BADFORMAT MAKE_DSHRESULT(100) + +// The function called is not supported at this time +#define DSERR_UNSUPPORTED E_NOTIMPL + +// No sound driver is available for use +#define DSERR_NODRIVER MAKE_DSHRESULT(120) + +// This object is already initialized +#define DSERR_ALREADYINITIALIZED MAKE_DSHRESULT(130) + +// This object does not support aggregation +#define DSERR_NOAGGREGATION CLASS_E_NOAGGREGATION + +// The buffer memory has been lost, and must be restored +#define DSERR_BUFFERLOST MAKE_DSHRESULT(150) + +// Another app has a higher priority level, preventing this call from +// succeeding +#define DSERR_OTHERAPPHASPRIO MAKE_DSHRESULT(160) + +// This object has not been initialized +#define DSERR_UNINITIALIZED MAKE_DSHRESULT(170) + +// The requested COM interface is not available +#define DSERR_NOINTERFACE E_NOINTERFACE + +// Access is denied +#define DSERR_ACCESSDENIED E_ACCESSDENIED + +// Tried to create a DSBCAPS_CTRLFX buffer shorter than DSBSIZE_FX_MIN milliseconds +#define DSERR_BUFFERTOOSMALL MAKE_DSHRESULT(180) + +// Attempt to use DirectSound 8 functionality on an older DirectSound object +#define DSERR_DS8_REQUIRED MAKE_DSHRESULT(190) + +// A circular loop of send effects was detected +#define DSERR_SENDLOOP MAKE_DSHRESULT(200) + +// The GUID specified in an audiopath file does not match a valid MIXIN buffer +#define DSERR_BADSENDBUFFERGUID MAKE_DSHRESULT(210) + +// The object requested was not found (numerically equal to DMUS_E_NOT_FOUND) +#define DSERR_OBJECTNOTFOUND MAKE_DSHRESULT(4449) + +// The effects requested could not be found on the system, or they were found +// but in the wrong order, or in the wrong hardware/software locations. +#define DSERR_FXUNAVAILABLE MAKE_DSHRESULT(220) + +// +// Flags +// + +#define DSCAPS_PRIMARYMONO 0x00000001 +#define DSCAPS_PRIMARYSTEREO 0x00000002 +#define DSCAPS_PRIMARY8BIT 0x00000004 +#define DSCAPS_PRIMARY16BIT 0x00000008 +#define DSCAPS_CONTINUOUSRATE 0x00000010 +#define DSCAPS_EMULDRIVER 0x00000020 +#define DSCAPS_CERTIFIED 0x00000040 +#define DSCAPS_SECONDARYMONO 0x00000100 +#define DSCAPS_SECONDARYSTEREO 0x00000200 +#define DSCAPS_SECONDARY8BIT 0x00000400 +#define DSCAPS_SECONDARY16BIT 0x00000800 + +#define DSSCL_NORMAL 0x00000001 +#define DSSCL_PRIORITY 0x00000002 +#define DSSCL_EXCLUSIVE 0x00000003 +#define DSSCL_WRITEPRIMARY 0x00000004 + +#define DSSPEAKER_DIRECTOUT 0x00000000 +#define DSSPEAKER_HEADPHONE 0x00000001 +#define DSSPEAKER_MONO 0x00000002 +#define DSSPEAKER_QUAD 0x00000003 +#define DSSPEAKER_STEREO 0x00000004 +#define DSSPEAKER_SURROUND 0x00000005 +#define DSSPEAKER_5POINT1 0x00000006 // obsolete 5.1 setting +#define DSSPEAKER_7POINT1 0x00000007 // obsolete 7.1 setting +#define DSSPEAKER_7POINT1_SURROUND 0x00000008 // correct 7.1 Home Theater setting +#define DSSPEAKER_5POINT1_SURROUND 0x00000009 // correct 5.1 setting +#define DSSPEAKER_7POINT1_WIDE DSSPEAKER_7POINT1 +#define DSSPEAKER_5POINT1_BACK DSSPEAKER_5POINT1 + +#define DSSPEAKER_GEOMETRY_MIN 0x00000005 // 5 degrees +#define DSSPEAKER_GEOMETRY_NARROW 0x0000000A // 10 degrees +#define DSSPEAKER_GEOMETRY_WIDE 0x00000014 // 20 degrees +#define DSSPEAKER_GEOMETRY_MAX 0x000000B4 // 180 degrees + +#define DSSPEAKER_COMBINED(c, g) ((DWORD)(((BYTE)(c)) | ((DWORD)((BYTE)(g))) << 16)) +#define DSSPEAKER_CONFIG(a) ((BYTE)(a)) +#define DSSPEAKER_GEOMETRY(a) ((BYTE)(((DWORD)(a) >> 16) & 0x00FF)) + +#define DSBCAPS_PRIMARYBUFFER 0x00000001 +#define DSBCAPS_STATIC 0x00000002 +#define DSBCAPS_LOCHARDWARE 0x00000004 +#define DSBCAPS_LOCSOFTWARE 0x00000008 +#define DSBCAPS_CTRL3D 0x00000010 +#define DSBCAPS_CTRLFREQUENCY 0x00000020 +#define DSBCAPS_CTRLPAN 0x00000040 +#define DSBCAPS_CTRLVOLUME 0x00000080 +#define DSBCAPS_CTRLPOSITIONNOTIFY 0x00000100 +#define DSBCAPS_CTRLFX 0x00000200 +#define DSBCAPS_STICKYFOCUS 0x00004000 +#define DSBCAPS_GLOBALFOCUS 0x00008000 +#define DSBCAPS_GETCURRENTPOSITION2 0x00010000 +#define DSBCAPS_MUTE3DATMAXDISTANCE 0x00020000 +#define DSBCAPS_LOCDEFER 0x00040000 +#define DSBCAPS_TRUEPLAYPOSITION 0x00080000 + +#define DSBPLAY_LOOPING 0x00000001 +#define DSBPLAY_LOCHARDWARE 0x00000002 +#define DSBPLAY_LOCSOFTWARE 0x00000004 +#define DSBPLAY_TERMINATEBY_TIME 0x00000008 +#define DSBPLAY_TERMINATEBY_DISTANCE 0x000000010 +#define DSBPLAY_TERMINATEBY_PRIORITY 0x000000020 + +#define DSBSTATUS_PLAYING 0x00000001 +#define DSBSTATUS_BUFFERLOST 0x00000002 +#define DSBSTATUS_LOOPING 0x00000004 +#define DSBSTATUS_LOCHARDWARE 0x00000008 +#define DSBSTATUS_LOCSOFTWARE 0x00000010 +#define DSBSTATUS_TERMINATED 0x00000020 + +#define DSBLOCK_FROMWRITECURSOR 0x00000001 +#define DSBLOCK_ENTIREBUFFER 0x00000002 + +#define DSBFREQUENCY_ORIGINAL 0 +#define DSBFREQUENCY_MIN 100 +#if DIRECTSOUND_VERSION >= 0x0900 +#define DSBFREQUENCY_MAX 200000 +#else +#define DSBFREQUENCY_MAX 100000 +#endif + +#define DSBPAN_LEFT -10000 +#define DSBPAN_CENTER 0 +#define DSBPAN_RIGHT 10000 + +#define DSBVOLUME_MIN -10000 +#define DSBVOLUME_MAX 0 + +#define DSBSIZE_MIN 4 +#define DSBSIZE_MAX 0x0FFFFFFF +#define DSBSIZE_FX_MIN 150 // NOTE: Milliseconds, not bytes + +#define DSBNOTIFICATIONS_MAX 100000UL + +#define DS3DMODE_NORMAL 0x00000000 +#define DS3DMODE_HEADRELATIVE 0x00000001 +#define DS3DMODE_DISABLE 0x00000002 + +#define DS3D_IMMEDIATE 0x00000000 +#define DS3D_DEFERRED 0x00000001 + +#define DS3D_MINDISTANCEFACTOR FLT_MIN +#define DS3D_MAXDISTANCEFACTOR FLT_MAX +#define DS3D_DEFAULTDISTANCEFACTOR 1.0f + +#define DS3D_MINROLLOFFFACTOR 0.0f +#define DS3D_MAXROLLOFFFACTOR 10.0f +#define DS3D_DEFAULTROLLOFFFACTOR 1.0f + +#define DS3D_MINDOPPLERFACTOR 0.0f +#define DS3D_MAXDOPPLERFACTOR 10.0f +#define DS3D_DEFAULTDOPPLERFACTOR 1.0f + +#define DS3D_DEFAULTMINDISTANCE 1.0f +#define DS3D_DEFAULTMAXDISTANCE 1000000000.0f + +#define DS3D_MINCONEANGLE 0 +#define DS3D_MAXCONEANGLE 360 +#define DS3D_DEFAULTCONEANGLE 360 + +#define DS3D_DEFAULTCONEOUTSIDEVOLUME DSBVOLUME_MAX + +// IDirectSoundCapture attributes + +#define DSCCAPS_EMULDRIVER DSCAPS_EMULDRIVER +#define DSCCAPS_CERTIFIED DSCAPS_CERTIFIED +#define DSCCAPS_MULTIPLECAPTURE 0x00000001 + +// IDirectSoundCaptureBuffer attributes + +#define DSCBCAPS_WAVEMAPPED 0x80000000 +#if DIRECTSOUND_VERSION >= 0x0800 +#define DSCBCAPS_CTRLFX 0x00000200 +#endif + +#define DSCBLOCK_ENTIREBUFFER 0x00000001 + +#define DSCBSTATUS_CAPTURING 0x00000001 +#define DSCBSTATUS_LOOPING 0x00000002 + +#define DSCBSTART_LOOPING 0x00000001 + +#define DSBPN_OFFSETSTOP 0xFFFFFFFF + +#define DS_CERTIFIED 0x00000000 +#define DS_UNCERTIFIED 0x00000001 + +// +// Flags for the I3DL2 effects +// + +// +// I3DL2 Material Presets +// + +enum +{ + DSFX_I3DL2_MATERIAL_PRESET_SINGLEWINDOW, + DSFX_I3DL2_MATERIAL_PRESET_DOUBLEWINDOW, + DSFX_I3DL2_MATERIAL_PRESET_THINDOOR, + DSFX_I3DL2_MATERIAL_PRESET_THICKDOOR, + DSFX_I3DL2_MATERIAL_PRESET_WOODWALL, + DSFX_I3DL2_MATERIAL_PRESET_BRICKWALL, + DSFX_I3DL2_MATERIAL_PRESET_STONEWALL, + DSFX_I3DL2_MATERIAL_PRESET_CURTAIN +}; + +#define I3DL2_MATERIAL_PRESET_SINGLEWINDOW -2800,0.71f +#define I3DL2_MATERIAL_PRESET_DOUBLEWINDOW -5000,0.40f +#define I3DL2_MATERIAL_PRESET_THINDOOR -1800,0.66f +#define I3DL2_MATERIAL_PRESET_THICKDOOR -4400,0.64f +#define I3DL2_MATERIAL_PRESET_WOODWALL -4000,0.50f +#define I3DL2_MATERIAL_PRESET_BRICKWALL -5000,0.60f +#define I3DL2_MATERIAL_PRESET_STONEWALL -6000,0.68f +#define I3DL2_MATERIAL_PRESET_CURTAIN -1200,0.15f + +enum +{ + DSFX_I3DL2_ENVIRONMENT_PRESET_DEFAULT, + DSFX_I3DL2_ENVIRONMENT_PRESET_GENERIC, + DSFX_I3DL2_ENVIRONMENT_PRESET_PADDEDCELL, + DSFX_I3DL2_ENVIRONMENT_PRESET_ROOM, + DSFX_I3DL2_ENVIRONMENT_PRESET_BATHROOM, + DSFX_I3DL2_ENVIRONMENT_PRESET_LIVINGROOM, + DSFX_I3DL2_ENVIRONMENT_PRESET_STONEROOM, + DSFX_I3DL2_ENVIRONMENT_PRESET_AUDITORIUM, + DSFX_I3DL2_ENVIRONMENT_PRESET_CONCERTHALL, + DSFX_I3DL2_ENVIRONMENT_PRESET_CAVE, + DSFX_I3DL2_ENVIRONMENT_PRESET_ARENA, + DSFX_I3DL2_ENVIRONMENT_PRESET_HANGAR, + DSFX_I3DL2_ENVIRONMENT_PRESET_CARPETEDHALLWAY, + DSFX_I3DL2_ENVIRONMENT_PRESET_HALLWAY, + DSFX_I3DL2_ENVIRONMENT_PRESET_STONECORRIDOR, + DSFX_I3DL2_ENVIRONMENT_PRESET_ALLEY, + DSFX_I3DL2_ENVIRONMENT_PRESET_FOREST, + DSFX_I3DL2_ENVIRONMENT_PRESET_CITY, + DSFX_I3DL2_ENVIRONMENT_PRESET_MOUNTAINS, + DSFX_I3DL2_ENVIRONMENT_PRESET_QUARRY, + DSFX_I3DL2_ENVIRONMENT_PRESET_PLAIN, + DSFX_I3DL2_ENVIRONMENT_PRESET_PARKINGLOT, + DSFX_I3DL2_ENVIRONMENT_PRESET_SEWERPIPE, + DSFX_I3DL2_ENVIRONMENT_PRESET_UNDERWATER, + DSFX_I3DL2_ENVIRONMENT_PRESET_SMALLROOM, + DSFX_I3DL2_ENVIRONMENT_PRESET_MEDIUMROOM, + DSFX_I3DL2_ENVIRONMENT_PRESET_LARGEROOM, + DSFX_I3DL2_ENVIRONMENT_PRESET_MEDIUMHALL, + DSFX_I3DL2_ENVIRONMENT_PRESET_LARGEHALL, + DSFX_I3DL2_ENVIRONMENT_PRESET_PLATE +}; + +// +// I3DL2 Reverberation Presets Values +// + +#define I3DL2_ENVIRONMENT_PRESET_DEFAULT -1000, -100, 0.0f, 1.49f, 0.83f, -2602, 0.007f, 200, 0.011f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_GENERIC -1000, -100, 0.0f, 1.49f, 0.83f, -2602, 0.007f, 200, 0.011f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_PADDEDCELL -1000,-6000, 0.0f, 0.17f, 0.10f, -1204, 0.001f, 207, 0.002f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_ROOM -1000, -454, 0.0f, 0.40f, 0.83f, -1646, 0.002f, 53, 0.003f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_BATHROOM -1000,-1200, 0.0f, 1.49f, 0.54f, -370, 0.007f, 1030, 0.011f, 100.0f, 60.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_LIVINGROOM -1000,-6000, 0.0f, 0.50f, 0.10f, -1376, 0.003f, -1104, 0.004f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_STONEROOM -1000, -300, 0.0f, 2.31f, 0.64f, -711, 0.012f, 83, 0.017f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_AUDITORIUM -1000, -476, 0.0f, 4.32f, 0.59f, -789, 0.020f, -289, 0.030f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_CONCERTHALL -1000, -500, 0.0f, 3.92f, 0.70f, -1230, 0.020f, -2, 0.029f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_CAVE -1000, 0, 0.0f, 2.91f, 1.30f, -602, 0.015f, -302, 0.022f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_ARENA -1000, -698, 0.0f, 7.24f, 0.33f, -1166, 0.020f, 16, 0.030f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_HANGAR -1000,-1000, 0.0f,10.05f, 0.23f, -602, 0.020f, 198, 0.030f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_CARPETEDHALLWAY -1000,-4000, 0.0f, 0.30f, 0.10f, -1831, 0.002f, -1630, 0.030f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_HALLWAY -1000, -300, 0.0f, 1.49f, 0.59f, -1219, 0.007f, 441, 0.011f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_STONECORRIDOR -1000, -237, 0.0f, 2.70f, 0.79f, -1214, 0.013f, 395, 0.020f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_ALLEY -1000, -270, 0.0f, 1.49f, 0.86f, -1204, 0.007f, -4, 0.011f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_FOREST -1000,-3300, 0.0f, 1.49f, 0.54f, -2560, 0.162f, -613, 0.088f, 79.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_CITY -1000, -800, 0.0f, 1.49f, 0.67f, -2273, 0.007f, -2217, 0.011f, 50.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_MOUNTAINS -1000,-2500, 0.0f, 1.49f, 0.21f, -2780, 0.300f, -2014, 0.100f, 27.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_QUARRY -1000,-1000, 0.0f, 1.49f, 0.83f,-10000, 0.061f, 500, 0.025f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_PLAIN -1000,-2000, 0.0f, 1.49f, 0.50f, -2466, 0.179f, -2514, 0.100f, 21.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_PARKINGLOT -1000, 0, 0.0f, 1.65f, 1.50f, -1363, 0.008f, -1153, 0.012f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_SEWERPIPE -1000,-1000, 0.0f, 2.81f, 0.14f, 429, 0.014f, 648, 0.021f, 80.0f, 60.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_UNDERWATER -1000,-4000, 0.0f, 1.49f, 0.10f, -449, 0.007f, 1700, 0.011f, 100.0f, 100.0f, 5000.0f + +// +// Examples simulating 'musical' reverb presets +// +// Name Decay time Description +// Small Room 1.1s A small size room with a length of 5m or so. +// Medium Room 1.3s A medium size room with a length of 10m or so. +// Large Room 1.5s A large size room suitable for live performances. +// Medium Hall 1.8s A medium size concert hall. +// Large Hall 1.8s A large size concert hall suitable for a full orchestra. +// Plate 1.3s A plate reverb simulation. +// + +#define I3DL2_ENVIRONMENT_PRESET_SMALLROOM -1000, -600, 0.0f, 1.10f, 0.83f, -400, 0.005f, 500, 0.010f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_MEDIUMROOM -1000, -600, 0.0f, 1.30f, 0.83f, -1000, 0.010f, -200, 0.020f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_LARGEROOM -1000, -600, 0.0f, 1.50f, 0.83f, -1600, 0.020f, -1000, 0.040f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_MEDIUMHALL -1000, -600, 0.0f, 1.80f, 0.70f, -1300, 0.015f, -800, 0.030f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_LARGEHALL -1000, -600, 0.0f, 1.80f, 0.70f, -2000, 0.030f, -1400, 0.060f, 100.0f, 100.0f, 5000.0f +#define I3DL2_ENVIRONMENT_PRESET_PLATE -1000, -200, 0.0f, 1.30f, 0.90f, 0, 0.002f, 0, 0.010f, 100.0f, 75.0f, 5000.0f + +// +// DirectSound3D Algorithms +// + +// Default DirectSound3D algorithm {00000000-0000-0000-0000-000000000000} +#define DS3DALG_DEFAULT GUID_NULL + +// No virtualization (Pan3D) {C241333F-1C1B-11d2-94F5-00C04FC28ACA} +DEFINE_GUID(DS3DALG_NO_VIRTUALIZATION, 0xc241333f, 0x1c1b, 0x11d2, 0x94, 0xf5, 0x0, 0xc0, 0x4f, 0xc2, 0x8a, 0xca); + +// High-quality HRTF algorithm {C2413340-1C1B-11d2-94F5-00C04FC28ACA} +DEFINE_GUID(DS3DALG_HRTF_FULL, 0xc2413340, 0x1c1b, 0x11d2, 0x94, 0xf5, 0x0, 0xc0, 0x4f, 0xc2, 0x8a, 0xca); + +// Lower-quality HRTF algorithm {C2413342-1C1B-11d2-94F5-00C04FC28ACA} +DEFINE_GUID(DS3DALG_HRTF_LIGHT, 0xc2413342, 0x1c1b, 0x11d2, 0x94, 0xf5, 0x0, 0xc0, 0x4f, 0xc2, 0x8a, 0xca); + + +#if DIRECTSOUND_VERSION >= 0x0800 + +// +// DirectSound Internal Effect Algorithms +// + + +// Gargle {DAFD8210-5711-4B91-9FE3-F75B7AE279BF} +DEFINE_GUID(GUID_DSFX_STANDARD_GARGLE, 0xdafd8210, 0x5711, 0x4b91, 0x9f, 0xe3, 0xf7, 0x5b, 0x7a, 0xe2, 0x79, 0xbf); + +// Chorus {EFE6629C-81F7-4281-BD91-C9D604A95AF6} +DEFINE_GUID(GUID_DSFX_STANDARD_CHORUS, 0xefe6629c, 0x81f7, 0x4281, 0xbd, 0x91, 0xc9, 0xd6, 0x04, 0xa9, 0x5a, 0xf6); + +// Flanger {EFCA3D92-DFD8-4672-A603-7420894BAD98} +DEFINE_GUID(GUID_DSFX_STANDARD_FLANGER, 0xefca3d92, 0xdfd8, 0x4672, 0xa6, 0x03, 0x74, 0x20, 0x89, 0x4b, 0xad, 0x98); + +// Echo/Delay {EF3E932C-D40B-4F51-8CCF-3F98F1B29D5D} +DEFINE_GUID(GUID_DSFX_STANDARD_ECHO, 0xef3e932c, 0xd40b, 0x4f51, 0x8c, 0xcf, 0x3f, 0x98, 0xf1, 0xb2, 0x9d, 0x5d); + +// Distortion {EF114C90-CD1D-484E-96E5-09CFAF912A21} +DEFINE_GUID(GUID_DSFX_STANDARD_DISTORTION, 0xef114c90, 0xcd1d, 0x484e, 0x96, 0xe5, 0x09, 0xcf, 0xaf, 0x91, 0x2a, 0x21); + +// Compressor/Limiter {EF011F79-4000-406D-87AF-BFFB3FC39D57} +DEFINE_GUID(GUID_DSFX_STANDARD_COMPRESSOR, 0xef011f79, 0x4000, 0x406d, 0x87, 0xaf, 0xbf, 0xfb, 0x3f, 0xc3, 0x9d, 0x57); + +// Parametric Equalization {120CED89-3BF4-4173-A132-3CB406CF3231} +DEFINE_GUID(GUID_DSFX_STANDARD_PARAMEQ, 0x120ced89, 0x3bf4, 0x4173, 0xa1, 0x32, 0x3c, 0xb4, 0x06, 0xcf, 0x32, 0x31); + +// I3DL2 Environmental Reverberation: Reverb (Listener) Effect {EF985E71-D5C7-42D4-BA4D-2D073E2E96F4} +DEFINE_GUID(GUID_DSFX_STANDARD_I3DL2REVERB, 0xef985e71, 0xd5c7, 0x42d4, 0xba, 0x4d, 0x2d, 0x07, 0x3e, 0x2e, 0x96, 0xf4); + +// Waves Reverberation {87FC0268-9A55-4360-95AA-004A1D9DE26C} +DEFINE_GUID(GUID_DSFX_WAVES_REVERB, 0x87fc0268, 0x9a55, 0x4360, 0x95, 0xaa, 0x00, 0x4a, 0x1d, 0x9d, 0xe2, 0x6c); + +// +// DirectSound Capture Effect Algorithms +// + + +// Acoustic Echo Canceller {BF963D80-C559-11D0-8A2B-00A0C9255AC1} +// Matches KSNODETYPE_ACOUSTIC_ECHO_CANCEL in ksmedia.h +DEFINE_GUID(GUID_DSCFX_CLASS_AEC, 0xBF963D80L, 0xC559, 0x11D0, 0x8A, 0x2B, 0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1); + +// Microsoft AEC {CDEBB919-379A-488a-8765-F53CFD36DE40} +DEFINE_GUID(GUID_DSCFX_MS_AEC, 0xcdebb919, 0x379a, 0x488a, 0x87, 0x65, 0xf5, 0x3c, 0xfd, 0x36, 0xde, 0x40); + +// System AEC {1C22C56D-9879-4f5b-A389-27996DDC2810} +DEFINE_GUID(GUID_DSCFX_SYSTEM_AEC, 0x1c22c56d, 0x9879, 0x4f5b, 0xa3, 0x89, 0x27, 0x99, 0x6d, 0xdc, 0x28, 0x10); + +// Noise Supression {E07F903F-62FD-4e60-8CDD-DEA7236665B5} +// Matches KSNODETYPE_NOISE_SUPPRESS in post Windows ME DDK's ksmedia.h +DEFINE_GUID(GUID_DSCFX_CLASS_NS, 0xe07f903f, 0x62fd, 0x4e60, 0x8c, 0xdd, 0xde, 0xa7, 0x23, 0x66, 0x65, 0xb5); + +// Microsoft Noise Suppresion {11C5C73B-66E9-4ba1-A0BA-E814C6EED92D} +DEFINE_GUID(GUID_DSCFX_MS_NS, 0x11c5c73b, 0x66e9, 0x4ba1, 0xa0, 0xba, 0xe8, 0x14, 0xc6, 0xee, 0xd9, 0x2d); + +// System Noise Suppresion {5AB0882E-7274-4516-877D-4EEE99BA4FD0} +DEFINE_GUID(GUID_DSCFX_SYSTEM_NS, 0x5ab0882e, 0x7274, 0x4516, 0x87, 0x7d, 0x4e, 0xee, 0x99, 0xba, 0x4f, 0xd0); + +#endif // DIRECTSOUND_VERSION >= 0x0800 + +#endif // __DSOUND_INCLUDED__ + + + +#ifdef __cplusplus +}; +#endif // __cplusplus + diff --git a/MediaClient/MediaClient/directx/include/dxdiag.h b/MediaClient/MediaClient/directx/include/dxdiag.h new file mode 100644 index 0000000..602c88f --- /dev/null +++ b/MediaClient/MediaClient/directx/include/dxdiag.h @@ -0,0 +1,187 @@ +/*==========================================================================; + * + * Copyright (C) Microsoft Corporation. All Rights Reserved. + * + * File: dxdiag.h + * Content: DirectX Diagnostic Tool include file + * + ****************************************************************************/ + +#ifndef _DXDIAG_H_ +#define _DXDIAG_H_ + +#include // for DECLARE_INTERFACE_ and HRESULT + +// This identifier is passed to IDxDiagProvider::Initialize in order to ensure that an +// application was built against the correct header files. This number is +// incremented whenever a header (or other) change would require applications +// to be rebuilt. If the version doesn't match, IDxDiagProvider::Initialize will fail. +// (The number itself has no meaning.) +#define DXDIAG_DX9_SDK_VERSION 111 + +#ifdef __cplusplus +extern "C" { +#endif + + +/**************************************************************************** + * + * DxDiag Errors + * + ****************************************************************************/ +#define DXDIAG_E_INSUFFICIENT_BUFFER ((HRESULT)0x8007007AL) // HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER) + + +/**************************************************************************** + * + * DxDiag CLSIDs + * + ****************************************************************************/ + +// {A65B8071-3BFE-4213-9A5B-491DA4461CA7} +DEFINE_GUID(CLSID_DxDiagProvider, +0xA65B8071, 0x3BFE, 0x4213, 0x9A, 0x5B, 0x49, 0x1D, 0xA4, 0x46, 0x1C, 0xA7); + + +/**************************************************************************** + * + * DxDiag Interface IIDs + * + ****************************************************************************/ + +// {9C6B4CB0-23F8-49CC-A3ED-45A55000A6D2} +DEFINE_GUID(IID_IDxDiagProvider, +0x9C6B4CB0, 0x23F8, 0x49CC, 0xA3, 0xED, 0x45, 0xA5, 0x50, 0x00, 0xA6, 0xD2); + +// {0x7D0F462F-0x4064-0x4862-BC7F-933E5058C10F} +DEFINE_GUID(IID_IDxDiagContainer, +0x7D0F462F, 0x4064, 0x4862, 0xBC, 0x7F, 0x93, 0x3E, 0x50, 0x58, 0xC1, 0x0F); + + +/**************************************************************************** + * + * DxDiag Interface Pointer definitions + * + ****************************************************************************/ + +typedef struct IDxDiagProvider *LPDXDIAGPROVIDER, *PDXDIAGPROVIDER; + +typedef struct IDxDiagContainer *LPDXDIAGCONTAINER, *PDXDIAGCONTAINER; + + +/**************************************************************************** + * + * DxDiag Structures + * + ****************************************************************************/ + +typedef struct _DXDIAG_INIT_PARAMS +{ + DWORD dwSize; // Size of this structure. + DWORD dwDxDiagHeaderVersion; // Pass in DXDIAG_DX9_SDK_VERSION. This verifies + // the header and dll are correctly matched. + BOOL bAllowWHQLChecks; // If true, allow dxdiag to check if drivers are + // digital signed as logo'd by WHQL which may + // connect via internet to update WHQL certificates. + VOID* pReserved; // Reserved. Must be NULL. +} DXDIAG_INIT_PARAMS; + + +/**************************************************************************** + * + * DxDiag Application Interfaces + * + ****************************************************************************/ + +// +// COM definition for IDxDiagProvider +// +#undef INTERFACE // External COM Implementation +#define INTERFACE IDxDiagProvider +DECLARE_INTERFACE_(IDxDiagProvider,IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID *ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /*** IDxDiagProvider methods ***/ + STDMETHOD(Initialize) (THIS_ DXDIAG_INIT_PARAMS* pParams) PURE; + STDMETHOD(GetRootContainer) (THIS_ IDxDiagContainer **ppInstance) PURE; +}; + + +// +// COM definition for IDxDiagContainer +// +#undef INTERFACE // External COM Implementation +#define INTERFACE IDxDiagContainer +DECLARE_INTERFACE_(IDxDiagContainer,IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID *ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /*** IDxDiagContainer methods ***/ + STDMETHOD(GetNumberOfChildContainers) (THIS_ DWORD *pdwCount) PURE; + STDMETHOD(EnumChildContainerNames) (THIS_ DWORD dwIndex, LPWSTR pwszContainer, DWORD cchContainer) PURE; + STDMETHOD(GetChildContainer) (THIS_ LPCWSTR pwszContainer, IDxDiagContainer **ppInstance) PURE; + STDMETHOD(GetNumberOfProps) (THIS_ DWORD *pdwCount) PURE; + STDMETHOD(EnumPropNames) (THIS_ DWORD dwIndex, LPWSTR pwszPropName, DWORD cchPropName) PURE; + STDMETHOD(GetProp) (THIS_ LPCWSTR pwszPropName, VARIANT *pvarProp) PURE; +}; + + +/**************************************************************************** + * + * DxDiag application interface macros + * + ****************************************************************************/ + +#if !defined(__cplusplus) || defined(CINTERFACE) + +#define IDxDiagProvider_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDxDiagProvider_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDxDiagProvider_Release(p) (p)->lpVtbl->Release(p) +#define IDxDiagProvider_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b) +#define IDxDiagProvider_GetRootContainer(p,a) (p)->lpVtbl->GetRootContainer(p,a) + +#define IDxDiagContainer_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDxDiagContainer_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDxDiagContainer_Release(p) (p)->lpVtbl->Release(p) +#define IDxDiagContainer_GetNumberOfChildContainers(p,a) (p)->lpVtbl->GetNumberOfChildContainers(p,a) +#define IDxDiagContainer_EnumChildContainerNames(p,a,b,c) (p)->lpVtbl->EnumChildContainerNames(p,a,b,c) +#define IDxDiagContainer_GetChildContainer(p,a,b) (p)->lpVtbl->GetChildContainer(p,a,b) +#define IDxDiagContainer_GetNumberOfProps(p,a) (p)->lpVtbl->GetNumberOfProps(p,a) +#define IDxDiagContainer_EnumProps(p,a,b) (p)->lpVtbl->EnumProps(p,a,b,c) +#define IDxDiagContainer_GetProp(p,a,b) (p)->lpVtbl->GetProp(p,a,b) + +#else /* C++ */ + +#define IDxDiagProvider_QueryInterface(p,a,b) (p)->QueryInterface(p,a,b) +#define IDxDiagProvider_AddRef(p) (p)->AddRef(p) +#define IDxDiagProvider_Release(p) (p)->Release(p) +#define IDxDiagProvider_Initialize(p,a,b) (p)->Initialize(p,a,b) +#define IDxDiagProvider_GetRootContainer(p,a) (p)->GetRootContainer(p,a) + +#define IDxDiagContainer_QueryInterface(p,a,b) (p)->QueryInterface(p,a,b) +#define IDxDiagContainer_AddRef(p) (p)->AddRef(p) +#define IDxDiagContainer_Release(p) (p)->Release(p) +#define IDxDiagContainer_GetNumberOfChildContainers(p,a) (p)->GetNumberOfChildContainers(p,a) +#define IDxDiagContainer_EnumChildContainerNames(p,a,b,c) (p)->EnumChildContainerNames(p,a,b,c) +#define IDxDiagContainer_GetChildContainer(p,a,b) (p)->GetChildContainer(p,a,b) +#define IDxDiagContainer_GetNumberOfProps(p,a) (p)->GetNumberOfProps(p,a) +#define IDxDiagContainer_EnumProps(p,a,b) (p)->EnumProps(p,a,b,c) +#define IDxDiagContainer_GetProp(p,a,b) (p)->GetProp(p,a,b) + +#endif + + +#ifdef __cplusplus +} +#endif + +#endif /* _DXDIAG_H_ */ + + diff --git a/MediaClient/MediaClient/directx/include/dxfile.h b/MediaClient/MediaClient/directx/include/dxfile.h new file mode 100644 index 0000000..74e80e5 --- /dev/null +++ b/MediaClient/MediaClient/directx/include/dxfile.h @@ -0,0 +1,239 @@ +/*************************************************************************** + * + * Copyright (C) 1998-1999 Microsoft Corporation. All Rights Reserved. + * + * File: dxfile.h + * + * Content: DirectX File public header file + * + ***************************************************************************/ + +#ifndef __DXFILE_H__ +#define __DXFILE_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef DWORD DXFILEFORMAT; + +#define DXFILEFORMAT_BINARY 0 +#define DXFILEFORMAT_TEXT 1 +#define DXFILEFORMAT_COMPRESSED 2 + +typedef DWORD DXFILELOADOPTIONS; + +#define DXFILELOAD_FROMFILE 0x00L +#define DXFILELOAD_FROMRESOURCE 0x01L +#define DXFILELOAD_FROMMEMORY 0x02L +#define DXFILELOAD_FROMSTREAM 0x04L +#define DXFILELOAD_FROMURL 0x08L + +typedef struct _DXFILELOADRESOURCE { + HMODULE hModule; + LPCTSTR lpName; + LPCTSTR lpType; +}DXFILELOADRESOURCE, *LPDXFILELOADRESOURCE; + +typedef struct _DXFILELOADMEMORY { + LPVOID lpMemory; + DWORD dSize; +}DXFILELOADMEMORY, *LPDXFILELOADMEMORY; + +/* + * DirectX File object types. + */ + +#ifndef WIN_TYPES +#define WIN_TYPES(itype, ptype) typedef interface itype *LP##ptype, **LPLP##ptype +#endif + +WIN_TYPES(IDirectXFile, DIRECTXFILE); +WIN_TYPES(IDirectXFileEnumObject, DIRECTXFILEENUMOBJECT); +WIN_TYPES(IDirectXFileSaveObject, DIRECTXFILESAVEOBJECT); +WIN_TYPES(IDirectXFileObject, DIRECTXFILEOBJECT); +WIN_TYPES(IDirectXFileData, DIRECTXFILEDATA); +WIN_TYPES(IDirectXFileDataReference, DIRECTXFILEDATAREFERENCE); +WIN_TYPES(IDirectXFileBinary, DIRECTXFILEBINARY); + +/* + * API for creating IDirectXFile interface. + */ + +STDAPI DirectXFileCreate(LPDIRECTXFILE *lplpDirectXFile); + +/* + * The methods for IUnknown + */ + +#define IUNKNOWN_METHODS(kind) \ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID *ppvObj) kind; \ + STDMETHOD_(ULONG, AddRef) (THIS) kind; \ + STDMETHOD_(ULONG, Release) (THIS) kind + +/* + * The methods for IDirectXFileObject + */ + +#define IDIRECTXFILEOBJECT_METHODS(kind) \ + STDMETHOD(GetName) (THIS_ LPSTR, LPDWORD) kind; \ + STDMETHOD(GetId) (THIS_ LPGUID) kind + +/* + * DirectX File interfaces. + */ + +#undef INTERFACE +#define INTERFACE IDirectXFile + +DECLARE_INTERFACE_(IDirectXFile, IUnknown) +{ + IUNKNOWN_METHODS(PURE); + STDMETHOD(CreateEnumObject) (THIS_ LPVOID, DXFILELOADOPTIONS, + LPDIRECTXFILEENUMOBJECT *) PURE; + STDMETHOD(CreateSaveObject) (THIS_ LPCSTR, DXFILEFORMAT, + LPDIRECTXFILESAVEOBJECT *) PURE; + STDMETHOD(RegisterTemplates) (THIS_ LPVOID, DWORD) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirectXFileEnumObject + +DECLARE_INTERFACE_(IDirectXFileEnumObject, IUnknown) +{ + IUNKNOWN_METHODS(PURE); + STDMETHOD(GetNextDataObject) (THIS_ LPDIRECTXFILEDATA *) PURE; + STDMETHOD(GetDataObjectById) (THIS_ REFGUID, LPDIRECTXFILEDATA *) PURE; + STDMETHOD(GetDataObjectByName) (THIS_ LPCSTR, LPDIRECTXFILEDATA *) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirectXFileSaveObject + +DECLARE_INTERFACE_(IDirectXFileSaveObject, IUnknown) +{ + IUNKNOWN_METHODS(PURE); + STDMETHOD(SaveTemplates) (THIS_ DWORD, const GUID **) PURE; + STDMETHOD(CreateDataObject) (THIS_ REFGUID, LPCSTR, const GUID *, + DWORD, LPVOID, LPDIRECTXFILEDATA *) PURE; + STDMETHOD(SaveData) (THIS_ LPDIRECTXFILEDATA) PURE; +}; + + +#undef INTERFACE +#define INTERFACE IDirectXFileObject + +DECLARE_INTERFACE_(IDirectXFileObject, IUnknown) +{ + IUNKNOWN_METHODS(PURE); + IDIRECTXFILEOBJECT_METHODS(PURE); +}; + +#undef INTERFACE +#define INTERFACE IDirectXFileData + +DECLARE_INTERFACE_(IDirectXFileData, IDirectXFileObject) +{ + IUNKNOWN_METHODS(PURE); + IDIRECTXFILEOBJECT_METHODS(PURE); + + STDMETHOD(GetData) (THIS_ LPCSTR, DWORD *, void **) PURE; + STDMETHOD(GetType) (THIS_ const GUID **) PURE; + STDMETHOD(GetNextObject) (THIS_ LPDIRECTXFILEOBJECT *) PURE; + STDMETHOD(AddDataObject) (THIS_ LPDIRECTXFILEDATA) PURE; + STDMETHOD(AddDataReference) (THIS_ LPCSTR, const GUID *) PURE; + STDMETHOD(AddBinaryObject) (THIS_ LPCSTR, const GUID *, LPCSTR, LPVOID, DWORD) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirectXFileDataReference + +DECLARE_INTERFACE_(IDirectXFileDataReference, IDirectXFileObject) +{ + IUNKNOWN_METHODS(PURE); + IDIRECTXFILEOBJECT_METHODS(PURE); + + STDMETHOD(Resolve) (THIS_ LPDIRECTXFILEDATA *) PURE; +}; + +#undef INTERFACE +#define INTERFACE IDirectXFileBinary + +DECLARE_INTERFACE_(IDirectXFileBinary, IDirectXFileObject) +{ + IUNKNOWN_METHODS(PURE); + IDIRECTXFILEOBJECT_METHODS(PURE); + + STDMETHOD(GetSize) (THIS_ DWORD *) PURE; + STDMETHOD(GetMimeType) (THIS_ LPCSTR *) PURE; + STDMETHOD(Read) (THIS_ LPVOID, DWORD, LPDWORD) PURE; +}; + +/* + * DirectXFile Object Class Id (for CoCreateInstance()) + */ + +DEFINE_GUID(CLSID_CDirectXFile, 0x4516ec43, 0x8f20, 0x11d0, 0x9b, 0x6d, 0x00, 0x00, 0xc0, 0x78, 0x1b, 0xc3); + +/* + * DirectX File Interface GUIDs. + */ + +DEFINE_GUID(IID_IDirectXFile, 0x3d82ab40, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); +DEFINE_GUID(IID_IDirectXFileEnumObject, 0x3d82ab41, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); +DEFINE_GUID(IID_IDirectXFileSaveObject, 0x3d82ab42, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); +DEFINE_GUID(IID_IDirectXFileObject, 0x3d82ab43, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); +DEFINE_GUID(IID_IDirectXFileData, 0x3d82ab44, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); +DEFINE_GUID(IID_IDirectXFileDataReference, 0x3d82ab45, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); +DEFINE_GUID(IID_IDirectXFileBinary, 0x3d82ab46, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); + +/* + * DirectX File Header template's GUID. + */ + +DEFINE_GUID(TID_DXFILEHeader, 0x3d82ab43, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); + + +/* + * DirectX File errors. + */ + +#define _FACDD 0x876 +#define MAKE_DDHRESULT( code ) MAKE_HRESULT( 1, _FACDD, code ) + +#define DXFILE_OK 0 + +#define DXFILEERR_BADOBJECT MAKE_DDHRESULT(850) +#define DXFILEERR_BADVALUE MAKE_DDHRESULT(851) +#define DXFILEERR_BADTYPE MAKE_DDHRESULT(852) +#define DXFILEERR_BADSTREAMHANDLE MAKE_DDHRESULT(853) +#define DXFILEERR_BADALLOC MAKE_DDHRESULT(854) +#define DXFILEERR_NOTFOUND MAKE_DDHRESULT(855) +#define DXFILEERR_NOTDONEYET MAKE_DDHRESULT(856) +#define DXFILEERR_FILENOTFOUND MAKE_DDHRESULT(857) +#define DXFILEERR_RESOURCENOTFOUND MAKE_DDHRESULT(858) +#define DXFILEERR_URLNOTFOUND MAKE_DDHRESULT(859) +#define DXFILEERR_BADRESOURCE MAKE_DDHRESULT(860) +#define DXFILEERR_BADFILETYPE MAKE_DDHRESULT(861) +#define DXFILEERR_BADFILEVERSION MAKE_DDHRESULT(862) +#define DXFILEERR_BADFILEFLOATSIZE MAKE_DDHRESULT(863) +#define DXFILEERR_BADFILECOMPRESSIONTYPE MAKE_DDHRESULT(864) +#define DXFILEERR_BADFILE MAKE_DDHRESULT(865) +#define DXFILEERR_PARSEERROR MAKE_DDHRESULT(866) +#define DXFILEERR_NOTEMPLATE MAKE_DDHRESULT(867) +#define DXFILEERR_BADARRAYSIZE MAKE_DDHRESULT(868) +#define DXFILEERR_BADDATAREFERENCE MAKE_DDHRESULT(869) +#define DXFILEERR_INTERNALERROR MAKE_DDHRESULT(870) +#define DXFILEERR_NOMOREOBJECTS MAKE_DDHRESULT(871) +#define DXFILEERR_BADINTRINSICS MAKE_DDHRESULT(872) +#define DXFILEERR_NOMORESTREAMHANDLES MAKE_DDHRESULT(873) +#define DXFILEERR_NOMOREDATA MAKE_DDHRESULT(874) +#define DXFILEERR_BADCACHEFILE MAKE_DDHRESULT(875) +#define DXFILEERR_NOINTERNET MAKE_DDHRESULT(876) + + +#ifdef __cplusplus +}; +#endif + +#endif /* _DXFILE_H_ */ diff --git a/MediaClient/MediaClient/directx/include/dxsdkver.h b/MediaClient/MediaClient/directx/include/dxsdkver.h new file mode 100644 index 0000000..7d88bbb --- /dev/null +++ b/MediaClient/MediaClient/directx/include/dxsdkver.h @@ -0,0 +1,18 @@ +/*==========================================================================; + * + * + * File: dxsdkver.h + * Content: DirectX SDK Version Include File + * + ****************************************************************************/ + +#ifndef _DXSDKVER_H_ +#define _DXSDKVER_H_ + +#define _DXSDK_PRODUCT_MAJOR 9 +#define _DXSDK_PRODUCT_MINOR 29 +#define _DXSDK_BUILD_MAJOR 1962 +#define _DXSDK_BUILD_MINOR 0 + +#endif // _DXSDKVER_H_ + diff --git a/MediaClient/MediaClient/directx/include/gameux.h b/MediaClient/MediaClient/directx/include/gameux.h new file mode 100644 index 0000000..19e2f95 --- /dev/null +++ b/MediaClient/MediaClient/directx/include/gameux.h @@ -0,0 +1,719 @@ + + +/* this ALWAYS GENERATED file contains the definitions for the interfaces */ + + + /* File created by MIDL compiler version 7.00.0550 */ +/* Compiler settings for gameux.idl: + Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 7.00.0550 + protocol : dce , ms_ext, c_ext, robust + error checks: allocation ref bounds_check enum stub_data + VC __declspec() decoration level: + __declspec(uuid()), __declspec(selectany), __declspec(novtable) + DECLSPEC_UUID(), MIDL_INTERFACE() +*/ +/* @@MIDL_FILE_HEADING( ) */ + +#pragma warning( disable: 4049 ) /* more than 64k source lines */ + + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCNDR_H_VERSION__ +#define __REQUIRED_RPCNDR_H_VERSION__ 475 +#endif + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCSAL_H_VERSION__ +#define __REQUIRED_RPCSAL_H_VERSION__ 100 +#endif + +#include "rpc.h" +#include "rpcndr.h" + +#ifndef __RPCNDR_H_VERSION__ +#error this stub requires an updated version of +#endif // __RPCNDR_H_VERSION__ + +#ifndef COM_NO_WINDOWS_H +#include "windows.h" +#include "ole2.h" +#endif /*COM_NO_WINDOWS_H*/ + +#ifndef __gameux_h__ +#define __gameux_h__ + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +/* Forward Declarations */ + +#ifndef __IGameExplorer_FWD_DEFINED__ +#define __IGameExplorer_FWD_DEFINED__ +typedef interface IGameExplorer IGameExplorer; +#endif /* __IGameExplorer_FWD_DEFINED__ */ + + +#ifndef __IGameStatistics_FWD_DEFINED__ +#define __IGameStatistics_FWD_DEFINED__ +typedef interface IGameStatistics IGameStatistics; +#endif /* __IGameStatistics_FWD_DEFINED__ */ + + +#ifndef __IGameStatisticsMgr_FWD_DEFINED__ +#define __IGameStatisticsMgr_FWD_DEFINED__ +typedef interface IGameStatisticsMgr IGameStatisticsMgr; +#endif /* __IGameStatisticsMgr_FWD_DEFINED__ */ + + +#ifndef __IGameExplorer2_FWD_DEFINED__ +#define __IGameExplorer2_FWD_DEFINED__ +typedef interface IGameExplorer2 IGameExplorer2; +#endif /* __IGameExplorer2_FWD_DEFINED__ */ + + +#ifndef __GameExplorer_FWD_DEFINED__ +#define __GameExplorer_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class GameExplorer GameExplorer; +#else +typedef struct GameExplorer GameExplorer; +#endif /* __cplusplus */ + +#endif /* __GameExplorer_FWD_DEFINED__ */ + + +#ifndef __GameStatistics_FWD_DEFINED__ +#define __GameStatistics_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class GameStatistics GameStatistics; +#else +typedef struct GameStatistics GameStatistics; +#endif /* __cplusplus */ + +#endif /* __GameStatistics_FWD_DEFINED__ */ + + +/* header files for imported files */ +#include "oaidl.h" +#include "ocidl.h" +#include "shobjidl.h" + +#ifdef __cplusplus +extern "C"{ +#endif + + +/* interface __MIDL_itf_gameux_0000_0000 */ +/* [local] */ + +#define ID_GDF_XML __GDF_XML +#define ID_GDF_THUMBNAIL __GDF_THUMBNAIL +#define ID_ICON_ICO __ICON_ICO +#define ID_GDF_XML_STR L"__GDF_XML" +#define ID_GDF_THUMBNAIL_STR L"__GDF_THUMBNAIL" +typedef /* [v1_enum] */ +enum GAME_INSTALL_SCOPE + { GIS_NOT_INSTALLED = 1, + GIS_CURRENT_USER = 2, + GIS_ALL_USERS = 3 + } GAME_INSTALL_SCOPE; + + + +extern RPC_IF_HANDLE __MIDL_itf_gameux_0000_0000_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_gameux_0000_0000_v0_0_s_ifspec; + +#ifndef __IGameExplorer_INTERFACE_DEFINED__ +#define __IGameExplorer_INTERFACE_DEFINED__ + +/* interface IGameExplorer */ +/* [unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IGameExplorer; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("E7B2FB72-D728-49B3-A5F2-18EBF5F1349E") + IGameExplorer : public IUnknown + { + public: + virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE AddGame( + /* [in] */ __RPC__in BSTR bstrGDFBinaryPath, + /* [in] */ __RPC__in BSTR bstrGameInstallDirectory, + /* [in] */ GAME_INSTALL_SCOPE installScope, + /* [out][in] */ __RPC__inout GUID *pguidInstanceID) = 0; + + virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE RemoveGame( + /* [in] */ GUID guidInstanceID) = 0; + + virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE UpdateGame( + /* [in] */ GUID guidInstanceID) = 0; + + virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE VerifyAccess( + /* [in] */ __RPC__in BSTR bstrGDFBinaryPath, + /* [out] */ __RPC__out BOOL *pfHasAccess) = 0; + + }; + +#else /* C style interface */ + + typedef struct IGameExplorerVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + __RPC__in IGameExplorer * This, + /* [in] */ __RPC__in REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + __RPC__in IGameExplorer * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + __RPC__in IGameExplorer * This); + + /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *AddGame )( + __RPC__in IGameExplorer * This, + /* [in] */ __RPC__in BSTR bstrGDFBinaryPath, + /* [in] */ __RPC__in BSTR bstrGameInstallDirectory, + /* [in] */ GAME_INSTALL_SCOPE installScope, + /* [out][in] */ __RPC__inout GUID *pguidInstanceID); + + /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *RemoveGame )( + __RPC__in IGameExplorer * This, + /* [in] */ GUID guidInstanceID); + + /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *UpdateGame )( + __RPC__in IGameExplorer * This, + /* [in] */ GUID guidInstanceID); + + /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *VerifyAccess )( + __RPC__in IGameExplorer * This, + /* [in] */ __RPC__in BSTR bstrGDFBinaryPath, + /* [out] */ __RPC__out BOOL *pfHasAccess); + + END_INTERFACE + } IGameExplorerVtbl; + + interface IGameExplorer + { + CONST_VTBL struct IGameExplorerVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IGameExplorer_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IGameExplorer_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IGameExplorer_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IGameExplorer_AddGame(This,bstrGDFBinaryPath,bstrGameInstallDirectory,installScope,pguidInstanceID) \ + ( (This)->lpVtbl -> AddGame(This,bstrGDFBinaryPath,bstrGameInstallDirectory,installScope,pguidInstanceID) ) + +#define IGameExplorer_RemoveGame(This,guidInstanceID) \ + ( (This)->lpVtbl -> RemoveGame(This,guidInstanceID) ) + +#define IGameExplorer_UpdateGame(This,guidInstanceID) \ + ( (This)->lpVtbl -> UpdateGame(This,guidInstanceID) ) + +#define IGameExplorer_VerifyAccess(This,bstrGDFBinaryPath,pfHasAccess) \ + ( (This)->lpVtbl -> VerifyAccess(This,bstrGDFBinaryPath,pfHasAccess) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IGameExplorer_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_gameux_0000_0001 */ +/* [local] */ + +typedef /* [v1_enum] */ +enum GAMESTATS_OPEN_TYPE + { GAMESTATS_OPEN_OPENORCREATE = 0, + GAMESTATS_OPEN_OPENONLY = 1 + } GAMESTATS_OPEN_TYPE; + +typedef /* [v1_enum] */ +enum GAMESTATS_OPEN_RESULT + { GAMESTATS_OPEN_CREATED = 0, + GAMESTATS_OPEN_OPENED = 1 + } GAMESTATS_OPEN_RESULT; + + + +extern RPC_IF_HANDLE __MIDL_itf_gameux_0000_0001_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_gameux_0000_0001_v0_0_s_ifspec; + +#ifndef __IGameStatistics_INTERFACE_DEFINED__ +#define __IGameStatistics_INTERFACE_DEFINED__ + +/* interface IGameStatistics */ +/* [unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IGameStatistics; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("3887C9CA-04A0-42ae-BC4C-5FA6C7721145") + IGameStatistics : public IUnknown + { + public: + virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetMaxCategoryLength( + /* [retval][out] */ __RPC__out UINT *cch) = 0; + + virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetMaxNameLength( + /* [retval][out] */ __RPC__out UINT *cch) = 0; + + virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetMaxValueLength( + /* [retval][out] */ __RPC__out UINT *cch) = 0; + + virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetMaxCategories( + /* [retval][out] */ __RPC__out WORD *pMax) = 0; + + virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetMaxStatsPerCategory( + /* [retval][out] */ __RPC__out WORD *pMax) = 0; + + virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetCategoryTitle( + /* [in] */ WORD categoryIndex, + /* [string][in] */ __RPC__in_string LPCWSTR title) = 0; + + virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetCategoryTitle( + /* [in] */ WORD categoryIndex, + /* [retval][string][out] */ __RPC__deref_out_opt_string LPWSTR *pTitle) = 0; + + virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetStatistic( + /* [in] */ WORD categoryIndex, + /* [in] */ WORD statIndex, + /* [string][unique][out][in] */ __RPC__deref_opt_inout_opt_string LPWSTR *pName, + /* [string][unique][out][in] */ __RPC__deref_opt_inout_opt_string LPWSTR *pValue) = 0; + + virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetStatistic( + /* [in] */ WORD categoryIndex, + /* [in] */ WORD statIndex, + /* [string][in] */ __RPC__in_string LPCWSTR name, + /* [string][in] */ __RPC__in_string LPCWSTR value) = 0; + + virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE Save( + /* [in] */ BOOL trackChanges) = 0; + + virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetLastPlayedCategory( + /* [in] */ UINT categoryIndex) = 0; + + virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetLastPlayedCategory( + /* [retval][out] */ __RPC__out UINT *pCategoryIndex) = 0; + + }; + +#else /* C style interface */ + + typedef struct IGameStatisticsVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + __RPC__in IGameStatistics * This, + /* [in] */ __RPC__in REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + __RPC__in IGameStatistics * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + __RPC__in IGameStatistics * This); + + /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetMaxCategoryLength )( + __RPC__in IGameStatistics * This, + /* [retval][out] */ __RPC__out UINT *cch); + + /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetMaxNameLength )( + __RPC__in IGameStatistics * This, + /* [retval][out] */ __RPC__out UINT *cch); + + /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetMaxValueLength )( + __RPC__in IGameStatistics * This, + /* [retval][out] */ __RPC__out UINT *cch); + + /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetMaxCategories )( + __RPC__in IGameStatistics * This, + /* [retval][out] */ __RPC__out WORD *pMax); + + /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetMaxStatsPerCategory )( + __RPC__in IGameStatistics * This, + /* [retval][out] */ __RPC__out WORD *pMax); + + /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetCategoryTitle )( + __RPC__in IGameStatistics * This, + /* [in] */ WORD categoryIndex, + /* [string][in] */ __RPC__in_string LPCWSTR title); + + /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetCategoryTitle )( + __RPC__in IGameStatistics * This, + /* [in] */ WORD categoryIndex, + /* [retval][string][out] */ __RPC__deref_out_opt_string LPWSTR *pTitle); + + /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetStatistic )( + __RPC__in IGameStatistics * This, + /* [in] */ WORD categoryIndex, + /* [in] */ WORD statIndex, + /* [string][unique][out][in] */ __RPC__deref_opt_inout_opt_string LPWSTR *pName, + /* [string][unique][out][in] */ __RPC__deref_opt_inout_opt_string LPWSTR *pValue); + + /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetStatistic )( + __RPC__in IGameStatistics * This, + /* [in] */ WORD categoryIndex, + /* [in] */ WORD statIndex, + /* [string][in] */ __RPC__in_string LPCWSTR name, + /* [string][in] */ __RPC__in_string LPCWSTR value); + + /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *Save )( + __RPC__in IGameStatistics * This, + /* [in] */ BOOL trackChanges); + + /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetLastPlayedCategory )( + __RPC__in IGameStatistics * This, + /* [in] */ UINT categoryIndex); + + /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetLastPlayedCategory )( + __RPC__in IGameStatistics * This, + /* [retval][out] */ __RPC__out UINT *pCategoryIndex); + + END_INTERFACE + } IGameStatisticsVtbl; + + interface IGameStatistics + { + CONST_VTBL struct IGameStatisticsVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IGameStatistics_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IGameStatistics_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IGameStatistics_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IGameStatistics_GetMaxCategoryLength(This,cch) \ + ( (This)->lpVtbl -> GetMaxCategoryLength(This,cch) ) + +#define IGameStatistics_GetMaxNameLength(This,cch) \ + ( (This)->lpVtbl -> GetMaxNameLength(This,cch) ) + +#define IGameStatistics_GetMaxValueLength(This,cch) \ + ( (This)->lpVtbl -> GetMaxValueLength(This,cch) ) + +#define IGameStatistics_GetMaxCategories(This,pMax) \ + ( (This)->lpVtbl -> GetMaxCategories(This,pMax) ) + +#define IGameStatistics_GetMaxStatsPerCategory(This,pMax) \ + ( (This)->lpVtbl -> GetMaxStatsPerCategory(This,pMax) ) + +#define IGameStatistics_SetCategoryTitle(This,categoryIndex,title) \ + ( (This)->lpVtbl -> SetCategoryTitle(This,categoryIndex,title) ) + +#define IGameStatistics_GetCategoryTitle(This,categoryIndex,pTitle) \ + ( (This)->lpVtbl -> GetCategoryTitle(This,categoryIndex,pTitle) ) + +#define IGameStatistics_GetStatistic(This,categoryIndex,statIndex,pName,pValue) \ + ( (This)->lpVtbl -> GetStatistic(This,categoryIndex,statIndex,pName,pValue) ) + +#define IGameStatistics_SetStatistic(This,categoryIndex,statIndex,name,value) \ + ( (This)->lpVtbl -> SetStatistic(This,categoryIndex,statIndex,name,value) ) + +#define IGameStatistics_Save(This,trackChanges) \ + ( (This)->lpVtbl -> Save(This,trackChanges) ) + +#define IGameStatistics_SetLastPlayedCategory(This,categoryIndex) \ + ( (This)->lpVtbl -> SetLastPlayedCategory(This,categoryIndex) ) + +#define IGameStatistics_GetLastPlayedCategory(This,pCategoryIndex) \ + ( (This)->lpVtbl -> GetLastPlayedCategory(This,pCategoryIndex) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IGameStatistics_INTERFACE_DEFINED__ */ + + +#ifndef __IGameStatisticsMgr_INTERFACE_DEFINED__ +#define __IGameStatisticsMgr_INTERFACE_DEFINED__ + +/* interface IGameStatisticsMgr */ +/* [unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IGameStatisticsMgr; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("AFF3EA11-E70E-407d-95DD-35E612C41CE2") + IGameStatisticsMgr : public IUnknown + { + public: + virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetGameStatistics( + /* [string][in] */ __RPC__in_string LPCWSTR GDFBinaryPath, + /* [in] */ GAMESTATS_OPEN_TYPE openType, + /* [out] */ __RPC__out GAMESTATS_OPEN_RESULT *pOpenResult, + /* [retval][out] */ __RPC__deref_out_opt IGameStatistics **ppiStats) = 0; + + virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE RemoveGameStatistics( + /* [string][in] */ __RPC__in_string LPCWSTR GDFBinaryPath) = 0; + + }; + +#else /* C style interface */ + + typedef struct IGameStatisticsMgrVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + __RPC__in IGameStatisticsMgr * This, + /* [in] */ __RPC__in REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + __RPC__in IGameStatisticsMgr * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + __RPC__in IGameStatisticsMgr * This); + + /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetGameStatistics )( + __RPC__in IGameStatisticsMgr * This, + /* [string][in] */ __RPC__in_string LPCWSTR GDFBinaryPath, + /* [in] */ GAMESTATS_OPEN_TYPE openType, + /* [out] */ __RPC__out GAMESTATS_OPEN_RESULT *pOpenResult, + /* [retval][out] */ __RPC__deref_out_opt IGameStatistics **ppiStats); + + /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *RemoveGameStatistics )( + __RPC__in IGameStatisticsMgr * This, + /* [string][in] */ __RPC__in_string LPCWSTR GDFBinaryPath); + + END_INTERFACE + } IGameStatisticsMgrVtbl; + + interface IGameStatisticsMgr + { + CONST_VTBL struct IGameStatisticsMgrVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IGameStatisticsMgr_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IGameStatisticsMgr_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IGameStatisticsMgr_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IGameStatisticsMgr_GetGameStatistics(This,GDFBinaryPath,openType,pOpenResult,ppiStats) \ + ( (This)->lpVtbl -> GetGameStatistics(This,GDFBinaryPath,openType,pOpenResult,ppiStats) ) + +#define IGameStatisticsMgr_RemoveGameStatistics(This,GDFBinaryPath) \ + ( (This)->lpVtbl -> RemoveGameStatistics(This,GDFBinaryPath) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IGameStatisticsMgr_INTERFACE_DEFINED__ */ + + +#ifndef __IGameExplorer2_INTERFACE_DEFINED__ +#define __IGameExplorer2_INTERFACE_DEFINED__ + +/* interface IGameExplorer2 */ +/* [unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IGameExplorer2; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("86874AA7-A1ED-450d-A7EB-B89E20B2FFF3") + IGameExplorer2 : public IUnknown + { + public: + virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE InstallGame( + /* [string][in] */ __RPC__in_string LPCWSTR binaryGDFPath, + /* [unique][in] */ __RPC__in_opt LPCWSTR installDirectory, + /* [in] */ GAME_INSTALL_SCOPE installScope) = 0; + + virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE UninstallGame( + /* [string][in] */ __RPC__in_string LPCWSTR binaryGDFPath) = 0; + + virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE CheckAccess( + /* [string][in] */ __RPC__in_string LPCWSTR binaryGDFPath, + /* [retval][out] */ __RPC__out BOOL *pHasAccess) = 0; + + }; + +#else /* C style interface */ + + typedef struct IGameExplorer2Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + __RPC__in IGameExplorer2 * This, + /* [in] */ __RPC__in REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + __RPC__in IGameExplorer2 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + __RPC__in IGameExplorer2 * This); + + /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *InstallGame )( + __RPC__in IGameExplorer2 * This, + /* [string][in] */ __RPC__in_string LPCWSTR binaryGDFPath, + /* [unique][in] */ __RPC__in_opt LPCWSTR installDirectory, + /* [in] */ GAME_INSTALL_SCOPE installScope); + + /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *UninstallGame )( + __RPC__in IGameExplorer2 * This, + /* [string][in] */ __RPC__in_string LPCWSTR binaryGDFPath); + + /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *CheckAccess )( + __RPC__in IGameExplorer2 * This, + /* [string][in] */ __RPC__in_string LPCWSTR binaryGDFPath, + /* [retval][out] */ __RPC__out BOOL *pHasAccess); + + END_INTERFACE + } IGameExplorer2Vtbl; + + interface IGameExplorer2 + { + CONST_VTBL struct IGameExplorer2Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IGameExplorer2_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IGameExplorer2_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IGameExplorer2_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IGameExplorer2_InstallGame(This,binaryGDFPath,installDirectory,installScope) \ + ( (This)->lpVtbl -> InstallGame(This,binaryGDFPath,installDirectory,installScope) ) + +#define IGameExplorer2_UninstallGame(This,binaryGDFPath) \ + ( (This)->lpVtbl -> UninstallGame(This,binaryGDFPath) ) + +#define IGameExplorer2_CheckAccess(This,binaryGDFPath,pHasAccess) \ + ( (This)->lpVtbl -> CheckAccess(This,binaryGDFPath,pHasAccess) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IGameExplorer2_INTERFACE_DEFINED__ */ + + + +#ifndef __gameuxLib_LIBRARY_DEFINED__ +#define __gameuxLib_LIBRARY_DEFINED__ + +/* library gameuxLib */ +/* [helpstring][version][uuid] */ + + +EXTERN_C const IID LIBID_gameuxLib; + +EXTERN_C const CLSID CLSID_GameExplorer; + +#ifdef __cplusplus + +class DECLSPEC_UUID("9A5EA990-3034-4D6F-9128-01F3C61022BC") +GameExplorer; +#endif + +EXTERN_C const CLSID CLSID_GameStatistics; + +#ifdef __cplusplus + +class DECLSPEC_UUID("DBC85A2C-C0DC-4961-B6E2-D28B62C11AD4") +GameStatistics; +#endif +#endif /* __gameuxLib_LIBRARY_DEFINED__ */ + +/* Additional Prototypes for ALL interfaces */ + +unsigned long __RPC_USER BSTR_UserSize( __RPC__in unsigned long *, unsigned long , __RPC__in BSTR * ); +unsigned char * __RPC_USER BSTR_UserMarshal( __RPC__in unsigned long *, __RPC__inout_xcount(0) unsigned char *, __RPC__in BSTR * ); +unsigned char * __RPC_USER BSTR_UserUnmarshal(__RPC__in unsigned long *, __RPC__in_xcount(0) unsigned char *, __RPC__out BSTR * ); +void __RPC_USER BSTR_UserFree( __RPC__in unsigned long *, __RPC__in BSTR * ); + +unsigned long __RPC_USER BSTR_UserSize64( __RPC__in unsigned long *, unsigned long , __RPC__in BSTR * ); +unsigned char * __RPC_USER BSTR_UserMarshal64( __RPC__in unsigned long *, __RPC__inout_xcount(0) unsigned char *, __RPC__in BSTR * ); +unsigned char * __RPC_USER BSTR_UserUnmarshal64(__RPC__in unsigned long *, __RPC__in_xcount(0) unsigned char *, __RPC__out BSTR * ); +void __RPC_USER BSTR_UserFree64( __RPC__in unsigned long *, __RPC__in BSTR * ); + +/* end of Additional Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif + + + diff --git a/MediaClient/MediaClient/directx/include/rmxfguid.h b/MediaClient/MediaClient/directx/include/rmxfguid.h new file mode 100644 index 0000000..d3326cc --- /dev/null +++ b/MediaClient/MediaClient/directx/include/rmxfguid.h @@ -0,0 +1,223 @@ +/*************************************************************************** + * + * Copyright (C) 1998-1999 Microsoft Corporation. All Rights Reserved. + * + * File: rmxfguid.h + * + * Content: Defines GUIDs of D3DRM's templates. + * + ***************************************************************************/ + +#ifndef __RMXFGUID_H_ +#define __RMXFGUID_H_ + +/* {2B957100-9E9A-11cf-AB39-0020AF71E433} */ +DEFINE_GUID(TID_D3DRMInfo, +0x2b957100, 0x9e9a, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); + +/* {3D82AB44-62DA-11cf-AB39-0020AF71E433} */ +DEFINE_GUID(TID_D3DRMMesh, +0x3d82ab44, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); + +/* {3D82AB5E-62DA-11cf-AB39-0020AF71E433} */ +DEFINE_GUID(TID_D3DRMVector, +0x3d82ab5e, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); + +/* {3D82AB5F-62DA-11cf-AB39-0020AF71E433} */ +DEFINE_GUID(TID_D3DRMMeshFace, +0x3d82ab5f, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); + +/* {3D82AB4D-62DA-11cf-AB39-0020AF71E433} */ +DEFINE_GUID(TID_D3DRMMaterial, +0x3d82ab4d, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); + +/* {35FF44E1-6C7C-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMMaterialArray, +0x35ff44e1, 0x6c7c, 0x11cf, 0x8F, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {3D82AB46-62DA-11cf-AB39-0020AF71E433} */ +DEFINE_GUID(TID_D3DRMFrame, +0x3d82ab46, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); + +/* {F6F23F41-7686-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMFrameTransformMatrix, +0xf6f23f41, 0x7686, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {F6F23F42-7686-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMMeshMaterialList, +0xf6f23f42, 0x7686, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {F6F23F40-7686-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMMeshTextureCoords, +0xf6f23f40, 0x7686, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {F6F23F43-7686-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMMeshNormals, +0xf6f23f43, 0x7686, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {F6F23F44-7686-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMCoords2d, +0xf6f23f44, 0x7686, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {F6F23F45-7686-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMMatrix4x4, +0xf6f23f45, 0x7686, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {3D82AB4F-62DA-11cf-AB39-0020AF71E433} */ +DEFINE_GUID(TID_D3DRMAnimation, +0x3d82ab4f, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); + +/* {3D82AB50-62DA-11cf-AB39-0020AF71E433} */ +DEFINE_GUID(TID_D3DRMAnimationSet, +0x3d82ab50, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); + +/* {10DD46A8-775B-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMAnimationKey, +0x10dd46a8, 0x775b, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xA3); + +/* {10DD46A9-775B-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMFloatKeys, +0x10dd46a9, 0x775b, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xA3); + +/* {01411840-7786-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMMaterialAmbientColor, +0x01411840, 0x7786, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xA3); + +/* {01411841-7786-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMMaterialDiffuseColor, +0x01411841, 0x7786, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xA3); + +/* {01411842-7786-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMMaterialSpecularColor, +0x01411842, 0x7786, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xA3); + +/* {D3E16E80-7835-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMMaterialEmissiveColor, +0xd3e16e80, 0x7835, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {01411843-7786-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMMaterialPower, +0x01411843, 0x7786, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xA3); + +/* {35FF44E0-6C7C-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMColorRGBA, +0x35ff44e0, 0x6c7c, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xA3); + +/* {D3E16E81-7835-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMColorRGB, +0xd3e16e81, 0x7835, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {A42790E0-7810-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMGuid, +0xa42790e0, 0x7810, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {A42790E1-7810-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMTextureFilename, +0xa42790e1, 0x7810, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {A42790E2-7810-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMTextureReference, +0xa42790e2, 0x7810, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {1630B820-7842-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMIndexedColor, +0x1630b820, 0x7842, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {1630B821-7842-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMMeshVertexColors, +0x1630b821, 0x7842, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {4885AE60-78E8-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMMaterialWrap, +0x4885ae60, 0x78e8, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {537DA6A0-CA37-11d0-941C-0080C80CFA7B} */ +DEFINE_GUID(TID_D3DRMBoolean, +0x537da6a0, 0xca37, 0x11d0, 0x94, 0x1c, 0x0, 0x80, 0xc8, 0xc, 0xfa, 0x7b); + +/* {ED1EC5C0-C0A8-11d0-941C-0080C80CFA7B} */ +DEFINE_GUID(TID_D3DRMMeshFaceWraps, +0xed1ec5c0, 0xc0a8, 0x11d0, 0x94, 0x1c, 0x0, 0x80, 0xc8, 0xc, 0xfa, 0x7b); + +/* {4885AE63-78E8-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMBoolean2d, +0x4885ae63, 0x78e8, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {F406B180-7B3B-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMTimedFloatKeys, +0xf406b180, 0x7b3b, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {E2BF56C0-840F-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMAnimationOptions, +0xe2bf56c0, 0x840f, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {E2BF56C1-840F-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMFramePosition, +0xe2bf56c1, 0x840f, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {E2BF56C2-840F-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMFrameVelocity, +0xe2bf56c2, 0x840f, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {E2BF56C3-840F-11cf-8F52-0040333594A3} */ +DEFINE_GUID(TID_D3DRMFrameRotation, +0xe2bf56c3, 0x840f, 0x11cf, 0x8f, 0x52, 0x0, 0x40, 0x33, 0x35, 0x94, 0xa3); + +/* {3D82AB4A-62DA-11cf-AB39-0020AF71E433} */ +DEFINE_GUID(TID_D3DRMLight, +0x3d82ab4a, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); + +/* {3D82AB51-62DA-11cf-AB39-0020AF71E433} */ +DEFINE_GUID(TID_D3DRMCamera, +0x3d82ab51, 0x62da, 0x11cf, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); + +/* {E5745280-B24F-11cf-9DD5-00AA00A71A2F} */ +DEFINE_GUID(TID_D3DRMAppData, +0xe5745280, 0xb24f, 0x11cf, 0x9d, 0xd5, 0x0, 0xaa, 0x0, 0xa7, 0x1a, 0x2f); + +/* {AED22740-B31F-11cf-9DD5-00AA00A71A2F} */ +DEFINE_GUID(TID_D3DRMLightUmbra, +0xaed22740, 0xb31f, 0x11cf, 0x9d, 0xd5, 0x0, 0xaa, 0x0, 0xa7, 0x1a, 0x2f); + +/* {AED22742-B31F-11cf-9DD5-00AA00A71A2F} */ +DEFINE_GUID(TID_D3DRMLightRange, +0xaed22742, 0xb31f, 0x11cf, 0x9d, 0xd5, 0x0, 0xaa, 0x0, 0xa7, 0x1a, 0x2f); + +/* {AED22741-B31F-11cf-9DD5-00AA00A71A2F} */ +DEFINE_GUID(TID_D3DRMLightPenumbra, +0xaed22741, 0xb31f, 0x11cf, 0x9d, 0xd5, 0x0, 0xaa, 0x0, 0xa7, 0x1a, 0x2f); + +/* {A8A98BA0-C5E5-11cf-B941-0080C80CFA7B} */ +DEFINE_GUID(TID_D3DRMLightAttenuation, +0xa8a98ba0, 0xc5e5, 0x11cf, 0xb9, 0x41, 0x0, 0x80, 0xc8, 0xc, 0xfa, 0x7b); + +/* {3A23EEA0-94B1-11d0-AB39-0020AF71E433} */ +DEFINE_GUID(TID_D3DRMInlineData, +0x3a23eea0, 0x94b1, 0x11d0, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); + +/* {3A23EEA1-94B1-11d0-AB39-0020AF71E433} */ +DEFINE_GUID(TID_D3DRMUrl, +0x3a23eea1, 0x94b1, 0x11d0, 0xab, 0x39, 0x0, 0x20, 0xaf, 0x71, 0xe4, 0x33); + +/* {8A63C360-997D-11d0-941C-0080C80CFA7B} */ +DEFINE_GUID(TID_D3DRMProgressiveMesh, +0x8A63C360, 0x997D, 0x11d0, 0x94, 0x1C, 0x0, 0x80, 0xC8, 0x0C, 0xFA, 0x7B); + +/* {98116AA0-BDBA-11d1-82C0-00A0C9697271} */ +DEFINE_GUID(TID_D3DRMExternalVisual, +0x98116AA0, 0xBDBA, 0x11d1, 0x82, 0xC0, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x71); + +/* {7F0F21E0-BFE1-11d1-82C0-00A0C9697271} */ +DEFINE_GUID(TID_D3DRMStringProperty, +0x7f0f21e0, 0xbfe1, 0x11d1, 0x82, 0xc0, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x71); + +/* {7F0F21E1-BFE1-11d1-82C0-00A0C9697271} */ +DEFINE_GUID(TID_D3DRMPropertyBag, +0x7f0f21e1, 0xbfe1, 0x11d1, 0x82, 0xc0, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x71); + +// {7F5D5EA0-D53A-11d1-82C0-00A0C9697271} +DEFINE_GUID(TID_D3DRMRightHanded, +0x7f5d5ea0, 0xd53a, 0x11d1, 0x82, 0xc0, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x71); + +#endif /* __RMXFGUID_H_ */ + diff --git a/MediaClient/MediaClient/directx/include/rmxftmpl.h b/MediaClient/MediaClient/directx/include/rmxftmpl.h new file mode 100644 index 0000000..e0018d0 --- /dev/null +++ b/MediaClient/MediaClient/directx/include/rmxftmpl.h @@ -0,0 +1,339 @@ +/* D3DRM XFile templates in binary form */ + +#ifndef _RMXFTMPL_H_ +#define _RMXFTMPL_H_ + +unsigned char D3DRM_XTEMPLATES[] = { + 0x78, 0x6f, 0x66, 0x20, 0x30, 0x33, 0x30, 0x32, 0x62, + 0x69, 0x6e, 0x20, 0x30, 0x30, 0x36, 0x34, 0x1f, 0, 0x1, + 0, 0x6, 0, 0, 0, 0x48, 0x65, 0x61, 0x64, 0x65, + 0x72, 0xa, 0, 0x5, 0, 0x43, 0xab, 0x82, 0x3d, 0xda, + 0x62, 0xcf, 0x11, 0xab, 0x39, 0, 0x20, 0xaf, 0x71, 0xe4, + 0x33, 0x28, 0, 0x1, 0, 0x5, 0, 0, 0, 0x6d, + 0x61, 0x6a, 0x6f, 0x72, 0x14, 0, 0x28, 0, 0x1, 0, + 0x5, 0, 0, 0, 0x6d, 0x69, 0x6e, 0x6f, 0x72, 0x14, + 0, 0x29, 0, 0x1, 0, 0x5, 0, 0, 0, 0x66, + 0x6c, 0x61, 0x67, 0x73, 0x14, 0, 0xb, 0, 0x1f, 0, + 0x1, 0, 0x6, 0, 0, 0, 0x56, 0x65, 0x63, 0x74, + 0x6f, 0x72, 0xa, 0, 0x5, 0, 0x5e, 0xab, 0x82, 0x3d, + 0xda, 0x62, 0xcf, 0x11, 0xab, 0x39, 0, 0x20, 0xaf, 0x71, + 0xe4, 0x33, 0x2a, 0, 0x1, 0, 0x1, 0, 0, 0, + 0x78, 0x14, 0, 0x2a, 0, 0x1, 0, 0x1, 0, 0, + 0, 0x79, 0x14, 0, 0x2a, 0, 0x1, 0, 0x1, 0, + 0, 0, 0x7a, 0x14, 0, 0xb, 0, 0x1f, 0, 0x1, + 0, 0x8, 0, 0, 0, 0x43, 0x6f, 0x6f, 0x72, 0x64, + 0x73, 0x32, 0x64, 0xa, 0, 0x5, 0, 0x44, 0x3f, 0xf2, + 0xf6, 0x86, 0x76, 0xcf, 0x11, 0x8f, 0x52, 0, 0x40, 0x33, + 0x35, 0x94, 0xa3, 0x2a, 0, 0x1, 0, 0x1, 0, 0, + 0, 0x75, 0x14, 0, 0x2a, 0, 0x1, 0, 0x1, 0, + 0, 0, 0x76, 0x14, 0, 0xb, 0, 0x1f, 0, 0x1, + 0, 0x9, 0, 0, 0, 0x4d, 0x61, 0x74, 0x72, 0x69, + 0x78, 0x34, 0x78, 0x34, 0xa, 0, 0x5, 0, 0x45, 0x3f, + 0xf2, 0xf6, 0x86, 0x76, 0xcf, 0x11, 0x8f, 0x52, 0, 0x40, + 0x33, 0x35, 0x94, 0xa3, 0x34, 0, 0x2a, 0, 0x1, 0, + 0x6, 0, 0, 0, 0x6d, 0x61, 0x74, 0x72, 0x69, 0x78, + 0xe, 0, 0x3, 0, 0x10, 0, 0, 0, 0xf, 0, + 0x14, 0, 0xb, 0, 0x1f, 0, 0x1, 0, 0x9, 0, + 0, 0, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x52, 0x47, 0x42, + 0x41, 0xa, 0, 0x5, 0, 0xe0, 0x44, 0xff, 0x35, 0x7c, + 0x6c, 0xcf, 0x11, 0x8f, 0x52, 0, 0x40, 0x33, 0x35, 0x94, + 0xa3, 0x2a, 0, 0x1, 0, 0x3, 0, 0, 0, 0x72, + 0x65, 0x64, 0x14, 0, 0x2a, 0, 0x1, 0, 0x5, 0, + 0, 0, 0x67, 0x72, 0x65, 0x65, 0x6e, 0x14, 0, 0x2a, + 0, 0x1, 0, 0x4, 0, 0, 0, 0x62, 0x6c, 0x75, + 0x65, 0x14, 0, 0x2a, 0, 0x1, 0, 0x5, 0, 0, + 0, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x14, 0, 0xb, 0, + 0x1f, 0, 0x1, 0, 0x8, 0, 0, 0, 0x43, 0x6f, + 0x6c, 0x6f, 0x72, 0x52, 0x47, 0x42, 0xa, 0, 0x5, 0, + 0x81, 0x6e, 0xe1, 0xd3, 0x35, 0x78, 0xcf, 0x11, 0x8f, 0x52, + 0, 0x40, 0x33, 0x35, 0x94, 0xa3, 0x2a, 0, 0x1, 0, + 0x3, 0, 0, 0, 0x72, 0x65, 0x64, 0x14, 0, 0x2a, + 0, 0x1, 0, 0x5, 0, 0, 0, 0x67, 0x72, 0x65, + 0x65, 0x6e, 0x14, 0, 0x2a, 0, 0x1, 0, 0x4, 0, + 0, 0, 0x62, 0x6c, 0x75, 0x65, 0x14, 0, 0xb, 0, + 0x1f, 0, 0x1, 0, 0xc, 0, 0, 0, 0x49, 0x6e, + 0x64, 0x65, 0x78, 0x65, 0x64, 0x43, 0x6f, 0x6c, 0x6f, 0x72, + 0xa, 0, 0x5, 0, 0x20, 0xb8, 0x30, 0x16, 0x42, 0x78, + 0xcf, 0x11, 0x8f, 0x52, 0, 0x40, 0x33, 0x35, 0x94, 0xa3, + 0x29, 0, 0x1, 0, 0x5, 0, 0, 0, 0x69, 0x6e, + 0x64, 0x65, 0x78, 0x14, 0, 0x1, 0, 0x9, 0, 0, + 0, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x52, 0x47, 0x42, 0x41, + 0x1, 0, 0xa, 0, 0, 0, 0x69, 0x6e, 0x64, 0x65, + 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x14, 0, 0xb, 0, + 0x1f, 0, 0x1, 0, 0x7, 0, 0, 0, 0x42, 0x6f, + 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0xa, 0, 0x5, 0, 0xa0, + 0xa6, 0x7d, 0x53, 0x37, 0xca, 0xd0, 0x11, 0x94, 0x1c, 0, + 0x80, 0xc8, 0xc, 0xfa, 0x7b, 0x29, 0, 0x1, 0, 0x9, + 0, 0, 0, 0x74, 0x72, 0x75, 0x65, 0x66, 0x61, 0x6c, + 0x73, 0x65, 0x14, 0, 0xb, 0, 0x1f, 0, 0x1, 0, + 0x9, 0, 0, 0, 0x42, 0x6f, 0x6f, 0x6c, 0x65, 0x61, + 0x6e, 0x32, 0x64, 0xa, 0, 0x5, 0, 0x63, 0xae, 0x85, + 0x48, 0xe8, 0x78, 0xcf, 0x11, 0x8f, 0x52, 0, 0x40, 0x33, + 0x35, 0x94, 0xa3, 0x1, 0, 0x7, 0, 0, 0, 0x42, + 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x1, 0, 0x1, 0, + 0, 0, 0x75, 0x14, 0, 0x1, 0, 0x7, 0, 0, + 0, 0x42, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x1, 0, + 0x1, 0, 0, 0, 0x76, 0x14, 0, 0xb, 0, 0x1f, + 0, 0x1, 0, 0xc, 0, 0, 0, 0x4d, 0x61, 0x74, + 0x65, 0x72, 0x69, 0x61, 0x6c, 0x57, 0x72, 0x61, 0x70, 0xa, + 0, 0x5, 0, 0x60, 0xae, 0x85, 0x48, 0xe8, 0x78, 0xcf, + 0x11, 0x8f, 0x52, 0, 0x40, 0x33, 0x35, 0x94, 0xa3, 0x1, + 0, 0x7, 0, 0, 0, 0x42, 0x6f, 0x6f, 0x6c, 0x65, + 0x61, 0x6e, 0x1, 0, 0x1, 0, 0, 0, 0x75, 0x14, + 0, 0x1, 0, 0x7, 0, 0, 0, 0x42, 0x6f, 0x6f, + 0x6c, 0x65, 0x61, 0x6e, 0x1, 0, 0x1, 0, 0, 0, + 0x76, 0x14, 0, 0xb, 0, 0x1f, 0, 0x1, 0, 0xf, + 0, 0, 0, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, + 0x46, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0xa, 0, + 0x5, 0, 0xe1, 0x90, 0x27, 0xa4, 0x10, 0x78, 0xcf, 0x11, + 0x8f, 0x52, 0, 0x40, 0x33, 0x35, 0x94, 0xa3, 0x31, 0, + 0x1, 0, 0x8, 0, 0, 0, 0x66, 0x69, 0x6c, 0x65, + 0x6e, 0x61, 0x6d, 0x65, 0x14, 0, 0xb, 0, 0x1f, 0, + 0x1, 0, 0x8, 0, 0, 0, 0x4d, 0x61, 0x74, 0x65, + 0x72, 0x69, 0x61, 0x6c, 0xa, 0, 0x5, 0, 0x4d, 0xab, + 0x82, 0x3d, 0xda, 0x62, 0xcf, 0x11, 0xab, 0x39, 0, 0x20, + 0xaf, 0x71, 0xe4, 0x33, 0x1, 0, 0x9, 0, 0, 0, + 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x52, 0x47, 0x42, 0x41, 0x1, + 0, 0x9, 0, 0, 0, 0x66, 0x61, 0x63, 0x65, 0x43, + 0x6f, 0x6c, 0x6f, 0x72, 0x14, 0, 0x2a, 0, 0x1, 0, + 0x5, 0, 0, 0, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x14, + 0, 0x1, 0, 0x8, 0, 0, 0, 0x43, 0x6f, 0x6c, + 0x6f, 0x72, 0x52, 0x47, 0x42, 0x1, 0, 0xd, 0, 0, + 0, 0x73, 0x70, 0x65, 0x63, 0x75, 0x6c, 0x61, 0x72, 0x43, + 0x6f, 0x6c, 0x6f, 0x72, 0x14, 0, 0x1, 0, 0x8, 0, + 0, 0, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x52, 0x47, 0x42, + 0x1, 0, 0xd, 0, 0, 0, 0x65, 0x6d, 0x69, 0x73, + 0x73, 0x69, 0x76, 0x65, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x14, + 0, 0xe, 0, 0x12, 0, 0x12, 0, 0x12, 0, 0xf, + 0, 0xb, 0, 0x1f, 0, 0x1, 0, 0x8, 0, 0, + 0, 0x4d, 0x65, 0x73, 0x68, 0x46, 0x61, 0x63, 0x65, 0xa, + 0, 0x5, 0, 0x5f, 0xab, 0x82, 0x3d, 0xda, 0x62, 0xcf, + 0x11, 0xab, 0x39, 0, 0x20, 0xaf, 0x71, 0xe4, 0x33, 0x29, + 0, 0x1, 0, 0x12, 0, 0, 0, 0x6e, 0x46, 0x61, + 0x63, 0x65, 0x56, 0x65, 0x72, 0x74, 0x65, 0x78, 0x49, 0x6e, + 0x64, 0x69, 0x63, 0x65, 0x73, 0x14, 0, 0x34, 0, 0x29, + 0, 0x1, 0, 0x11, 0, 0, 0, 0x66, 0x61, 0x63, + 0x65, 0x56, 0x65, 0x72, 0x74, 0x65, 0x78, 0x49, 0x6e, 0x64, + 0x69, 0x63, 0x65, 0x73, 0xe, 0, 0x1, 0, 0x12, 0, + 0, 0, 0x6e, 0x46, 0x61, 0x63, 0x65, 0x56, 0x65, 0x72, + 0x74, 0x65, 0x78, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, + 0xf, 0, 0x14, 0, 0xb, 0, 0x1f, 0, 0x1, 0, + 0xd, 0, 0, 0, 0x4d, 0x65, 0x73, 0x68, 0x46, 0x61, + 0x63, 0x65, 0x57, 0x72, 0x61, 0x70, 0x73, 0xa, 0, 0x5, + 0, 0xc0, 0xc5, 0x1e, 0xed, 0xa8, 0xc0, 0xd0, 0x11, 0x94, + 0x1c, 0, 0x80, 0xc8, 0xc, 0xfa, 0x7b, 0x29, 0, 0x1, + 0, 0xf, 0, 0, 0, 0x6e, 0x46, 0x61, 0x63, 0x65, + 0x57, 0x72, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, + 0x14, 0, 0x34, 0, 0x1, 0, 0x9, 0, 0, 0, + 0x42, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x32, 0x64, 0x1, + 0, 0xe, 0, 0, 0, 0x66, 0x61, 0x63, 0x65, 0x57, + 0x72, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0xe, + 0, 0x1, 0, 0xf, 0, 0, 0, 0x6e, 0x46, 0x61, + 0x63, 0x65, 0x57, 0x72, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, + 0x65, 0x73, 0xf, 0, 0x14, 0, 0xb, 0, 0x1f, 0, + 0x1, 0, 0x11, 0, 0, 0, 0x4d, 0x65, 0x73, 0x68, + 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x43, 0x6f, 0x6f, + 0x72, 0x64, 0x73, 0xa, 0, 0x5, 0, 0x40, 0x3f, 0xf2, + 0xf6, 0x86, 0x76, 0xcf, 0x11, 0x8f, 0x52, 0, 0x40, 0x33, + 0x35, 0x94, 0xa3, 0x29, 0, 0x1, 0, 0xe, 0, 0, + 0, 0x6e, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x43, + 0x6f, 0x6f, 0x72, 0x64, 0x73, 0x14, 0, 0x34, 0, 0x1, + 0, 0x8, 0, 0, 0, 0x43, 0x6f, 0x6f, 0x72, 0x64, + 0x73, 0x32, 0x64, 0x1, 0, 0xd, 0, 0, 0, 0x74, + 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x43, 0x6f, 0x6f, 0x72, + 0x64, 0x73, 0xe, 0, 0x1, 0, 0xe, 0, 0, 0, + 0x6e, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x43, 0x6f, + 0x6f, 0x72, 0x64, 0x73, 0xf, 0, 0x14, 0, 0xb, 0, + 0x1f, 0, 0x1, 0, 0x10, 0, 0, 0, 0x4d, 0x65, + 0x73, 0x68, 0x4d, 0x61, 0x74, 0x65, 0x72, 0x69, 0x61, 0x6c, + 0x4c, 0x69, 0x73, 0x74, 0xa, 0, 0x5, 0, 0x42, 0x3f, + 0xf2, 0xf6, 0x86, 0x76, 0xcf, 0x11, 0x8f, 0x52, 0, 0x40, + 0x33, 0x35, 0x94, 0xa3, 0x29, 0, 0x1, 0, 0xa, 0, + 0, 0, 0x6e, 0x4d, 0x61, 0x74, 0x65, 0x72, 0x69, 0x61, + 0x6c, 0x73, 0x14, 0, 0x29, 0, 0x1, 0, 0xc, 0, + 0, 0, 0x6e, 0x46, 0x61, 0x63, 0x65, 0x49, 0x6e, 0x64, + 0x65, 0x78, 0x65, 0x73, 0x14, 0, 0x34, 0, 0x29, 0, + 0x1, 0, 0xb, 0, 0, 0, 0x66, 0x61, 0x63, 0x65, + 0x49, 0x6e, 0x64, 0x65, 0x78, 0x65, 0x73, 0xe, 0, 0x1, + 0, 0xc, 0, 0, 0, 0x6e, 0x46, 0x61, 0x63, 0x65, + 0x49, 0x6e, 0x64, 0x65, 0x78, 0x65, 0x73, 0xf, 0, 0x14, + 0, 0xe, 0, 0x1, 0, 0x8, 0, 0, 0, 0x4d, + 0x61, 0x74, 0x65, 0x72, 0x69, 0x61, 0x6c, 0xf, 0, 0xb, + 0, 0x1f, 0, 0x1, 0, 0xb, 0, 0, 0, 0x4d, + 0x65, 0x73, 0x68, 0x4e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x73, + 0xa, 0, 0x5, 0, 0x43, 0x3f, 0xf2, 0xf6, 0x86, 0x76, + 0xcf, 0x11, 0x8f, 0x52, 0, 0x40, 0x33, 0x35, 0x94, 0xa3, + 0x29, 0, 0x1, 0, 0x8, 0, 0, 0, 0x6e, 0x4e, + 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x73, 0x14, 0, 0x34, 0, + 0x1, 0, 0x6, 0, 0, 0, 0x56, 0x65, 0x63, 0x74, + 0x6f, 0x72, 0x1, 0, 0x7, 0, 0, 0, 0x6e, 0x6f, + 0x72, 0x6d, 0x61, 0x6c, 0x73, 0xe, 0, 0x1, 0, 0x8, + 0, 0, 0, 0x6e, 0x4e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, + 0x73, 0xf, 0, 0x14, 0, 0x29, 0, 0x1, 0, 0xc, + 0, 0, 0, 0x6e, 0x46, 0x61, 0x63, 0x65, 0x4e, 0x6f, + 0x72, 0x6d, 0x61, 0x6c, 0x73, 0x14, 0, 0x34, 0, 0x1, + 0, 0x8, 0, 0, 0, 0x4d, 0x65, 0x73, 0x68, 0x46, + 0x61, 0x63, 0x65, 0x1, 0, 0xb, 0, 0, 0, 0x66, + 0x61, 0x63, 0x65, 0x4e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x73, + 0xe, 0, 0x1, 0, 0xc, 0, 0, 0, 0x6e, 0x46, + 0x61, 0x63, 0x65, 0x4e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x73, + 0xf, 0, 0x14, 0, 0xb, 0, 0x1f, 0, 0x1, 0, + 0x10, 0, 0, 0, 0x4d, 0x65, 0x73, 0x68, 0x56, 0x65, + 0x72, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x73, + 0xa, 0, 0x5, 0, 0x21, 0xb8, 0x30, 0x16, 0x42, 0x78, + 0xcf, 0x11, 0x8f, 0x52, 0, 0x40, 0x33, 0x35, 0x94, 0xa3, + 0x29, 0, 0x1, 0, 0xd, 0, 0, 0, 0x6e, 0x56, + 0x65, 0x72, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, + 0x73, 0x14, 0, 0x34, 0, 0x1, 0, 0xc, 0, 0, + 0, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x65, 0x64, 0x43, 0x6f, + 0x6c, 0x6f, 0x72, 0x1, 0, 0xc, 0, 0, 0, 0x76, + 0x65, 0x72, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, + 0x73, 0xe, 0, 0x1, 0, 0xd, 0, 0, 0, 0x6e, + 0x56, 0x65, 0x72, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, + 0x72, 0x73, 0xf, 0, 0x14, 0, 0xb, 0, 0x1f, 0, + 0x1, 0, 0x4, 0, 0, 0, 0x4d, 0x65, 0x73, 0x68, + 0xa, 0, 0x5, 0, 0x44, 0xab, 0x82, 0x3d, 0xda, 0x62, + 0xcf, 0x11, 0xab, 0x39, 0, 0x20, 0xaf, 0x71, 0xe4, 0x33, + 0x29, 0, 0x1, 0, 0x9, 0, 0, 0, 0x6e, 0x56, + 0x65, 0x72, 0x74, 0x69, 0x63, 0x65, 0x73, 0x14, 0, 0x34, + 0, 0x1, 0, 0x6, 0, 0, 0, 0x56, 0x65, 0x63, + 0x74, 0x6f, 0x72, 0x1, 0, 0x8, 0, 0, 0, 0x76, + 0x65, 0x72, 0x74, 0x69, 0x63, 0x65, 0x73, 0xe, 0, 0x1, + 0, 0x9, 0, 0, 0, 0x6e, 0x56, 0x65, 0x72, 0x74, + 0x69, 0x63, 0x65, 0x73, 0xf, 0, 0x14, 0, 0x29, 0, + 0x1, 0, 0x6, 0, 0, 0, 0x6e, 0x46, 0x61, 0x63, + 0x65, 0x73, 0x14, 0, 0x34, 0, 0x1, 0, 0x8, 0, + 0, 0, 0x4d, 0x65, 0x73, 0x68, 0x46, 0x61, 0x63, 0x65, + 0x1, 0, 0x5, 0, 0, 0, 0x66, 0x61, 0x63, 0x65, + 0x73, 0xe, 0, 0x1, 0, 0x6, 0, 0, 0, 0x6e, + 0x46, 0x61, 0x63, 0x65, 0x73, 0xf, 0, 0x14, 0, 0xe, + 0, 0x12, 0, 0x12, 0, 0x12, 0, 0xf, 0, 0xb, + 0, 0x1f, 0, 0x1, 0, 0x14, 0, 0, 0, 0x46, + 0x72, 0x61, 0x6d, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, + 0x6f, 0x72, 0x6d, 0x4d, 0x61, 0x74, 0x72, 0x69, 0x78, 0xa, + 0, 0x5, 0, 0x41, 0x3f, 0xf2, 0xf6, 0x86, 0x76, 0xcf, + 0x11, 0x8f, 0x52, 0, 0x40, 0x33, 0x35, 0x94, 0xa3, 0x1, + 0, 0x9, 0, 0, 0, 0x4d, 0x61, 0x74, 0x72, 0x69, + 0x78, 0x34, 0x78, 0x34, 0x1, 0, 0xb, 0, 0, 0, + 0x66, 0x72, 0x61, 0x6d, 0x65, 0x4d, 0x61, 0x74, 0x72, 0x69, + 0x78, 0x14, 0, 0xb, 0, 0x1f, 0, 0x1, 0, 0x5, + 0, 0, 0, 0x46, 0x72, 0x61, 0x6d, 0x65, 0xa, 0, + 0x5, 0, 0x46, 0xab, 0x82, 0x3d, 0xda, 0x62, 0xcf, 0x11, + 0xab, 0x39, 0, 0x20, 0xaf, 0x71, 0xe4, 0x33, 0xe, 0, + 0x12, 0, 0x12, 0, 0x12, 0, 0xf, 0, 0xb, 0, + 0x1f, 0, 0x1, 0, 0x9, 0, 0, 0, 0x46, 0x6c, + 0x6f, 0x61, 0x74, 0x4b, 0x65, 0x79, 0x73, 0xa, 0, 0x5, + 0, 0xa9, 0x46, 0xdd, 0x10, 0x5b, 0x77, 0xcf, 0x11, 0x8f, + 0x52, 0, 0x40, 0x33, 0x35, 0x94, 0xa3, 0x29, 0, 0x1, + 0, 0x7, 0, 0, 0, 0x6e, 0x56, 0x61, 0x6c, 0x75, + 0x65, 0x73, 0x14, 0, 0x34, 0, 0x2a, 0, 0x1, 0, + 0x6, 0, 0, 0, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, + 0xe, 0, 0x1, 0, 0x7, 0, 0, 0, 0x6e, 0x56, + 0x61, 0x6c, 0x75, 0x65, 0x73, 0xf, 0, 0x14, 0, 0xb, + 0, 0x1f, 0, 0x1, 0, 0xe, 0, 0, 0, 0x54, + 0x69, 0x6d, 0x65, 0x64, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x4b, + 0x65, 0x79, 0x73, 0xa, 0, 0x5, 0, 0x80, 0xb1, 0x6, + 0xf4, 0x3b, 0x7b, 0xcf, 0x11, 0x8f, 0x52, 0, 0x40, 0x33, + 0x35, 0x94, 0xa3, 0x29, 0, 0x1, 0, 0x4, 0, 0, + 0, 0x74, 0x69, 0x6d, 0x65, 0x14, 0, 0x1, 0, 0x9, + 0, 0, 0, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x4b, 0x65, + 0x79, 0x73, 0x1, 0, 0x6, 0, 0, 0, 0x74, 0x66, + 0x6b, 0x65, 0x79, 0x73, 0x14, 0, 0xb, 0, 0x1f, 0, + 0x1, 0, 0xc, 0, 0, 0, 0x41, 0x6e, 0x69, 0x6d, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0xa, 0, + 0x5, 0, 0xa8, 0x46, 0xdd, 0x10, 0x5b, 0x77, 0xcf, 0x11, + 0x8f, 0x52, 0, 0x40, 0x33, 0x35, 0x94, 0xa3, 0x29, 0, + 0x1, 0, 0x7, 0, 0, 0, 0x6b, 0x65, 0x79, 0x54, + 0x79, 0x70, 0x65, 0x14, 0, 0x29, 0, 0x1, 0, 0x5, + 0, 0, 0, 0x6e, 0x4b, 0x65, 0x79, 0x73, 0x14, 0, + 0x34, 0, 0x1, 0, 0xe, 0, 0, 0, 0x54, 0x69, + 0x6d, 0x65, 0x64, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x4b, 0x65, + 0x79, 0x73, 0x1, 0, 0x4, 0, 0, 0, 0x6b, 0x65, + 0x79, 0x73, 0xe, 0, 0x1, 0, 0x5, 0, 0, 0, + 0x6e, 0x4b, 0x65, 0x79, 0x73, 0xf, 0, 0x14, 0, 0xb, + 0, 0x1f, 0, 0x1, 0, 0x10, 0, 0, 0, 0x41, + 0x6e, 0x69, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0xa, 0, 0x5, 0, 0xc0, + 0x56, 0xbf, 0xe2, 0xf, 0x84, 0xcf, 0x11, 0x8f, 0x52, 0, + 0x40, 0x33, 0x35, 0x94, 0xa3, 0x29, 0, 0x1, 0, 0xa, + 0, 0, 0, 0x6f, 0x70, 0x65, 0x6e, 0x63, 0x6c, 0x6f, + 0x73, 0x65, 0x64, 0x14, 0, 0x29, 0, 0x1, 0, 0xf, + 0, 0, 0, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, + 0x6e, 0x71, 0x75, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x14, 0, + 0xb, 0, 0x1f, 0, 0x1, 0, 0x9, 0, 0, 0, + 0x41, 0x6e, 0x69, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xa, + 0, 0x5, 0, 0x4f, 0xab, 0x82, 0x3d, 0xda, 0x62, 0xcf, + 0x11, 0xab, 0x39, 0, 0x20, 0xaf, 0x71, 0xe4, 0x33, 0xe, + 0, 0x12, 0, 0x12, 0, 0x12, 0, 0xf, 0, 0xb, + 0, 0x1f, 0, 0x1, 0, 0xc, 0, 0, 0, 0x41, + 0x6e, 0x69, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, + 0x74, 0xa, 0, 0x5, 0, 0x50, 0xab, 0x82, 0x3d, 0xda, + 0x62, 0xcf, 0x11, 0xab, 0x39, 0, 0x20, 0xaf, 0x71, 0xe4, + 0x33, 0xe, 0, 0x1, 0, 0x9, 0, 0, 0, 0x41, + 0x6e, 0x69, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xf, 0, + 0xb, 0, 0x1f, 0, 0x1, 0, 0xa, 0, 0, 0, + 0x49, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x44, 0x61, 0x74, 0x61, + 0xa, 0, 0x5, 0, 0xa0, 0xee, 0x23, 0x3a, 0xb1, 0x94, + 0xd0, 0x11, 0xab, 0x39, 0, 0x20, 0xaf, 0x71, 0xe4, 0x33, + 0xe, 0, 0x1, 0, 0x6, 0, 0, 0, 0x42, 0x49, + 0x4e, 0x41, 0x52, 0x59, 0xf, 0, 0xb, 0, 0x1f, 0, + 0x1, 0, 0x3, 0, 0, 0, 0x55, 0x72, 0x6c, 0xa, + 0, 0x5, 0, 0xa1, 0xee, 0x23, 0x3a, 0xb1, 0x94, 0xd0, + 0x11, 0xab, 0x39, 0, 0x20, 0xaf, 0x71, 0xe4, 0x33, 0x29, + 0, 0x1, 0, 0x5, 0, 0, 0, 0x6e, 0x55, 0x72, + 0x6c, 0x73, 0x14, 0, 0x34, 0, 0x31, 0, 0x1, 0, + 0x4, 0, 0, 0, 0x75, 0x72, 0x6c, 0x73, 0xe, 0, + 0x1, 0, 0x5, 0, 0, 0, 0x6e, 0x55, 0x72, 0x6c, + 0x73, 0xf, 0, 0x14, 0, 0xb, 0, 0x1f, 0, 0x1, + 0, 0xf, 0, 0, 0, 0x50, 0x72, 0x6f, 0x67, 0x72, + 0x65, 0x73, 0x73, 0x69, 0x76, 0x65, 0x4d, 0x65, 0x73, 0x68, + 0xa, 0, 0x5, 0, 0x60, 0xc3, 0x63, 0x8a, 0x7d, 0x99, + 0xd0, 0x11, 0x94, 0x1c, 0, 0x80, 0xc8, 0xc, 0xfa, 0x7b, + 0xe, 0, 0x1, 0, 0x3, 0, 0, 0, 0x55, 0x72, + 0x6c, 0x13, 0, 0x1, 0, 0xa, 0, 0, 0, 0x49, + 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x44, 0x61, 0x74, 0x61, 0xf, + 0, 0xb, 0, 0x1f, 0, 0x1, 0, 0x4, 0, 0, + 0, 0x47, 0x75, 0x69, 0x64, 0xa, 0, 0x5, 0, 0xe0, + 0x90, 0x27, 0xa4, 0x10, 0x78, 0xcf, 0x11, 0x8f, 0x52, 0, + 0x40, 0x33, 0x35, 0x94, 0xa3, 0x29, 0, 0x1, 0, 0x5, + 0, 0, 0, 0x64, 0x61, 0x74, 0x61, 0x31, 0x14, 0, + 0x28, 0, 0x1, 0, 0x5, 0, 0, 0, 0x64, 0x61, + 0x74, 0x61, 0x32, 0x14, 0, 0x28, 0, 0x1, 0, 0x5, + 0, 0, 0, 0x64, 0x61, 0x74, 0x61, 0x33, 0x14, 0, + 0x34, 0, 0x2d, 0, 0x1, 0, 0x5, 0, 0, 0, + 0x64, 0x61, 0x74, 0x61, 0x34, 0xe, 0, 0x3, 0, 0x8, + 0, 0, 0, 0xf, 0, 0x14, 0, 0xb, 0, 0x1f, + 0, 0x1, 0, 0xe, 0, 0, 0, 0x53, 0x74, 0x72, + 0x69, 0x6e, 0x67, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, + 0x79, 0xa, 0, 0x5, 0, 0xe0, 0x21, 0xf, 0x7f, 0xe1, + 0xbf, 0xd1, 0x11, 0x82, 0xc0, 0, 0xa0, 0xc9, 0x69, 0x72, + 0x71, 0x31, 0, 0x1, 0, 0x3, 0, 0, 0, 0x6b, + 0x65, 0x79, 0x14, 0, 0x31, 0, 0x1, 0, 0x5, 0, + 0, 0, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x14, 0, 0xb, + 0, 0x1f, 0, 0x1, 0, 0xb, 0, 0, 0, 0x50, + 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x42, 0x61, 0x67, + 0xa, 0, 0x5, 0, 0xe1, 0x21, 0xf, 0x7f, 0xe1, 0xbf, + 0xd1, 0x11, 0x82, 0xc0, 0, 0xa0, 0xc9, 0x69, 0x72, 0x71, + 0xe, 0, 0x1, 0, 0xe, 0, 0, 0, 0x53, 0x74, + 0x72, 0x69, 0x6e, 0x67, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, + 0x74, 0x79, 0xf, 0, 0xb, 0, 0x1f, 0, 0x1, 0, + 0xe, 0, 0, 0, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, + 0x61, 0x6c, 0x56, 0x69, 0x73, 0x75, 0x61, 0x6c, 0xa, 0, + 0x5, 0, 0xa0, 0x6a, 0x11, 0x98, 0xba, 0xbd, 0xd1, 0x11, + 0x82, 0xc0, 0, 0xa0, 0xc9, 0x69, 0x72, 0x71, 0x1, 0, + 0x4, 0, 0, 0, 0x47, 0x75, 0x69, 0x64, 0x1, 0, + 0x12, 0, 0, 0, 0x67, 0x75, 0x69, 0x64, 0x45, 0x78, + 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x56, 0x69, 0x73, 0x75, + 0x61, 0x6c, 0x14, 0, 0xe, 0, 0x12, 0, 0x12, 0, + 0x12, 0, 0xf, 0, 0xb, 0, 0x1f, 0, 0x1, 0, + 0xb, 0, 0, 0, 0x52, 0x69, 0x67, 0x68, 0x74, 0x48, + 0x61, 0x6e, 0x64, 0x65, 0x64, 0xa, 0, 0x5, 0, 0xa0, + 0x5e, 0x5d, 0x7f, 0x3a, 0xd5, 0xd1, 0x11, 0x82, 0xc0, 0, + 0xa0, 0xc9, 0x69, 0x72, 0x71, 0x29, 0, 0x1, 0, 0xc, + 0, 0, 0, 0x62, 0x52, 0x69, 0x67, 0x68, 0x74, 0x48, + 0x61, 0x6e, 0x64, 0x65, 0x64, 0x14, 0, 0xb, 0 +}; + +#define D3DRM_XTEMPLATE_BYTES 3278 + +#endif /* _RMXFTMPL_H_ */ diff --git a/MediaClient/MediaClient/directx/include/rpcsal.h b/MediaClient/MediaClient/directx/include/rpcsal.h new file mode 100644 index 0000000..484ddc9 --- /dev/null +++ b/MediaClient/MediaClient/directx/include/rpcsal.h @@ -0,0 +1,499 @@ +/****************************************************************\ +* * +* rpcsal.h - markers for documenting the semantics of RPC APIs * +* * +* Version 1.0 * +* * +* Copyright (c) 2004 Microsoft Corporation. All rights reserved. * +* * +\****************************************************************/ + +// ------------------------------------------------------------------------------- +// Introduction +// +// rpcsal.h provides a set of annotations to describe how RPC functions use their +// parameters - the assumptions it makes about them, adn the guarantees it makes +// upon finishing. These annotations are similar to those found in specstrings.h, +// but are designed to be used by the MIDL compiler when it generates annotations +// enabled header files. +// +// IDL authors do not need to annotate their functions declarations. The MIDL compiler +// will interpret the IDL directives and use one of the annotations contained +// in this header. This documentation is intended to help those trying to understand +// the MIDL-generated header files or those who maintain their own copies of these files. +// +// ------------------------------------------------------------------------------- +// Differences between rpcsal.h and specstrings.h +// +// There are a few important differences between the annotations found in rpcsal.h and +// those in specstrings.h: +// +// 1. [in] parameters are not marked as read-only. They may be used for scratch space +// at the server and changes will not affect the client. +// 2. String versions of each macro alleviates the need for a special type definition +// +// ------------------------------------------------------------------------------- +// Interpreting RPC Annotations +// +// These annotations are interpreted precisely in the same way as those in specstrings.h. +// Please refer to that header for information related to general usage in annotations. +// +// To construct an RPC annotation, concatenate the appropriate value from each category +// along with a leading __RPC_. A typical annotation looks like "__RPC__in_string". +// +// |----------------------------------------------------------------------------------| +// | RPC Annotations | +// |------------|------------|---------|--------|----------|----------|---------------| +// | Level | Usage | Size | Output | Optional | String | Parameters | +// |------------|------------|---------|--------|----------|----------|---------------| +// | <> | <> | <> | <> | <> | <> | <> | +// | _deref | _in | _ecount | _full | _opt | _string | (size) | +// | _deref_opt | _out | _bcount | _part | | | (size,length) | +// | | _inout | | | | | | +// | | | | | | | | +// |------------|------------|---------|--------|----------|----------|---------------| +// +// Level: Describes the buffer pointer's level of indirection from the parameter or +// return value 'p'. +// +// <> : p is the buffer pointer. +// _deref : *p is the buffer pointer. p must not be NULL. +// _deref_opt : *p may be the buffer pointer. p may be NULL, in which case the rest of +// the annotation is ignored. +// +// Usage: Describes how the function uses the buffer. +// +// <> : The buffer is not accessed. If used on the return value or with _deref, the +// function will provide the buffer, and it will be uninitialized at exit. +// Otherwise, the caller must provide the buffer. This should only be used +// for alloc and free functions. +// _in : The function will only read from the buffer. The caller must provide the +// buffer and initialize it. Cannot be used with _deref. +// _out : The function will only write to the buffer. If used on the return value or +// with _deref, the function will provide the buffer and initialize it. +// Otherwise, the caller must provide the buffer, and the function will +// initialize it. +// _inout : The function may freely read from and write to the buffer. The caller must +// provide the buffer and initialize it. If used with _deref, the buffer may +// be reallocated by the function. +// +// Size: Describes the total size of the buffer. This may be less than the space actually +// allocated for the buffer, in which case it describes the accessible amount. +// +// <> : No buffer size is given. If the type specifies the buffer size (such as +// with LPSTR and LPWSTR), that amount is used. Otherwise, the buffer is one +// element long. Must be used with _in, _out, or _inout. +// _ecount : The buffer size is an explicit element count. +// _bcount : The buffer size is an explicit byte count. +// +// Output: Describes how much of the buffer will be initialized by the function. For +// _inout buffers, this also describes how much is initialized at entry. Omit this +// category for _in buffers; they must be fully initialized by the caller. +// +// <> : The type specifies how much is initialized. For instance, a function initializing +// an LPWSTR must NULL-terminate the string. +// _full : The function initializes the entire buffer. +// _part : The function initializes part of the buffer, and explicitly indicates how much. +// +// Optional: Describes if the buffer itself is optional. +// +// <> : The pointer to the buffer must not be NULL. +// _opt : The pointer to the buffer might be NULL. It will be checked before being dereferenced. +// +// String: Describes if the buffer is NULL terminated +// +// <> : The buffer is not assumed to be NULL terminated +// _string : The buffer is assumed to be NULL terminated once it has been initialized +// +// Parameters: Gives explicit counts for the size and length of the buffer. +// +// <> : There is no explicit count. Use when neither _ecount nor _bcount is used. +// (size) : Only the buffer's total size is given. Use with _ecount or _bcount but not _part. +// (size,length) : The buffer's total size and initialized length are given. Use with _ecount_part +// and _bcount_part. +// +// Notes: +// +// 1. Specifying two buffer annotations on a single parameter results in unspecified behavior +// (e.g. __RPC__in_bcount(5) __RPC__out_bcount(6) +// +// 2. The size of the buffer and the amount that has been initialized are separate concepts. +// Specify the size using _ecount or _bcount. Specify the amount that is initialized using +// _full, _part, or _string. As a special case, a single element buffer does not need +// _ecount, _bcount, _full, or _part +// +// 3. The count may be less than the total size of the buffer in which case it describes the +// accessible portion. +// +// 4. "__RPC__opt" and "__RPC_deref" are not valid annotations. +// +// 5. The placement of _opt when using _deref is important: +// __RPC__deref_opt_... : Input may be NULL +// __RPC__deref_..._opt : Output may be NULL +// __RPC__deref_opt_..._opt : Both input and output may be NULL +// + +#pragma once + +#include + +#ifndef __RPCSAL_H_VERSION__ +#define __RPCSAL_H_VERSION__ ( 100 ) +#endif // __RPCSAL_H_VERSION__ + +#ifdef __REQUIRED_RPCSAL_H_VERSION__ + #if ( __RPCSAL_H_VERSION__ < __REQUIRED_RPCSAL_H_VERSION__ ) + #error incorrect version. Use the header that matches with the MIDL compiler. + #endif +#endif + + +#ifdef __cplusplus +extern "C" { +#endif // #ifdef __cplusplus + +#if (_MSC_VER >= 1000) && !defined(__midl) && defined(_PREFAST_) + + +// [in] +#define __RPC__in __pre __valid +#define __RPC__in_string __RPC__in __pre __nullterminated +#define __RPC__in_ecount(size) __RPC__in __pre __elem_readableTo(size) +#define __RPC__in_ecount_full(size) __RPC__in_ecount(size) +#define __RPC__in_ecount_full_string(size) __RPC__in_ecount_full(size) __pre __nullterminated +#define __RPC__in_ecount_part(size, length) __RPC__in_ecount(length) __pre __elem_writableTo(size) +#define __RPC__in_ecount_full_opt(size) __RPC__in_ecount_full(size) __pre __exceptthat __maybenull +#define __RPC__in_ecount_full_opt_string(size) __RPC__in_ecount_full_opt(size) __pre __nullterminated +#define __RPC__in_ecount_part_opt(size, length) __RPC__in_ecount_part(size, length) __pre __exceptthat __maybenull +#define __RPC__in_xcount(size) __RPC__in __pre __elem_readableTo(size) +#define __RPC__in_xcount_full(size) __RPC__in_ecount(size) +#define __RPC__in_xcount_full_string(size) __RPC__in_ecount_full(size) __pre __nullterminated +#define __RPC__in_xcount_part(size, length) __RPC__in_ecount(length) __pre __elem_writableTo(size) +#define __RPC__in_xcount_full_opt(size) __RPC__in_ecount_full(size) __pre __exceptthat __maybenull +#define __RPC__in_xcount_full_opt_string(size) __RPC__in_ecount_full_opt(size) __pre __nullterminated +#define __RPC__in_xcount_part_opt(size, length) __RPC__in_ecount_part(size, length) __pre __exceptthat __maybenull + + +#define __RPC__deref_in __RPC__in __deref __notnull +#define __RPC__deref_in_string __RPC__in __pre __deref __nullterminated +#define __RPC__deref_in_opt __RPC__deref_in __deref __exceptthat __maybenull +#define __RPC__deref_in_opt_string __RPC__deref_in_opt __pre __deref __nullterminated +#define __RPC__deref_opt_in __RPC__in __exceptthat __maybenull +#define __RPC__deref_opt_in_string __RPC__deref_opt_in __pre __deref __nullterminated +#define __RPC__deref_opt_in_opt __RPC__deref_opt_in __pre __deref __exceptthat __maybenull +#define __RPC__deref_opt_in_opt_string __RPC__deref_opt_in_opt __pre __deref __nullterminated +#define __RPC__deref_in_ecount(size) __RPC__in __pre __deref __elem_readableTo(size) +#define __RPC__deref_in_ecount_part(size, length) __RPC__deref_in_ecount(size) __pre __deref __elem_readableTo(length) +#define __RPC__deref_in_ecount_full(size) __RPC__deref_in_ecount_part(size, size) +#define __RPC__deref_in_ecount_full_opt(size) __RPC__deref_in_ecount_full(size) __pre __deref __exceptthat __maybenull +#define __RPC__deref_in_ecount_full_opt_string(size) __RPC__deref_in_ecount_full_opt(size) __pre __deref __nullterminated +#define __RPC__deref_in_ecount_full_string(size) __RPC__deref_in_ecount_full(size) __pre __deref __nullterminated +#define __RPC__deref_in_ecount_opt(size) __RPC__deref_in_ecount(size) __pre __deref __exceptthat __maybenull +#define __RPC__deref_in_ecount_opt_string(size) __RPC__deref_in_ecount_opt(size) __pre __deref __nullterminated +#define __RPC__deref_in_ecount_part_opt(size, length) __RPC__deref_in_ecount_opt(size) __pre __deref __elem_readableTo(length) +#define __RPC__deref_in_xcount(size) __RPC__in __pre __deref __elem_readableTo(size) +#define __RPC__deref_in_xcount_part(size, length) __RPC__deref_in_ecount(size) __pre __deref __elem_readableTo(length) +#define __RPC__deref_in_xcount_full(size) __RPC__deref_in_ecount_part(size, size) +#define __RPC__deref_in_xcount_full_opt(size) __RPC__deref_in_ecount_full(size) __pre __deref __exceptthat __maybenull +#define __RPC__deref_in_xcount_full_opt_string(size) __RPC__deref_in_ecount_full_opt(size) __pre __deref __nullterminated +#define __RPC__deref_in_xcount_full_string(size) __RPC__deref_in_ecount_full(size) __pre __deref __nullterminated +#define __RPC__deref_in_xcount_opt(size) __RPC__deref_in_ecount(size) __pre __deref __exceptthat __maybenull +#define __RPC__deref_in_xcount_opt_string(size) __RPC__deref_in_ecount_opt(size) __pre __deref __nullterminated +#define __RPC__deref_in_xcount_part_opt(size, length) __RPC__deref_in_ecount_opt(size) __pre __deref __elem_readableTo(length) + +// [out] +#define __RPC__out __out +#define __RPC__out_ecount(size) __out_ecount(size) __post __elem_writableTo(size) +#define __RPC__out_ecount_string(size) __RPC__out_ecount(size) __post __nullterminated +#define __RPC__out_ecount_part(size, length) __RPC__out_ecount(size) __post __elem_readableTo(length) +#define __RPC__out_ecount_full(size) __RPC__out_ecount_part(size, size) +#define __RPC__out_ecount_full_string(size) __RPC__out_ecount_full(size) __post __nullterminated +#define __RPC__out_xcount(size) __out +#define __RPC__out_xcount_string(size) __RPC__out __post __nullterminated +#define __RPC__out_xcount_part(size, length) __RPC__out +#define __RPC__out_xcount_full(size) __RPC__out +#define __RPC__out_xcount_full_string(size) __RPC__out __post __nullterminated + +// [in,out] +#define __RPC__inout __inout +#define __RPC__inout_string __RPC__inout __pre __nullterminated __post __nullterminated +#define __RPC__inout_ecount(size) __inout_ecount(size) +#define __RPC__inout_ecount_part(size, length) __inout_ecount_part(size, length) +#define __RPC__inout_ecount_full(size) __RPC__inout_ecount_part(size, size) +#define __RPC__inout_ecount_full_string(size) __RPC__inout_ecount_full(size) __pre __nullterminated __post __nullterminated +#define __RPC__inout_xcount(size) __inout +#define __RPC__inout_xcount_part(size, length) __inout +#define __RPC__inout_xcount_full(size) __RPC__inout +#define __RPC__inout_xcount_full_string(size) __RPC__inout __pre __nullterminated __post __nullterminated + +// [in,unique] +#define __RPC__in_opt __RPC__in __pre __exceptthat __maybenull +#define __RPC__in_opt_string __RPC__in_opt __pre __nullterminated +#define __RPC__in_ecount_opt(size) __RPC__in_ecount(size) __pre __exceptthat __maybenull +#define __RPC__in_ecount_opt_string(size) __RPC__in_ecount_opt(size) __pre __nullterminated +#define __RPC__in_xcount_opt(size) __RPC__in_ecount(size) __pre __exceptthat __maybenull +#define __RPC__in_xcount_opt_string(size) __RPC__in_ecount_opt(size) __pre __nullterminated + +// [in,out,unique] +#define __RPC__inout_opt __inout_opt +#define __RPC__inout_opt_string __RPC__inout_opt __pre __nullterminated +#define __RPC__inout_ecount_opt(size) __inout_ecount_opt(size) +#define __RPC__inout_ecount_part_opt(size, length) __inout_ecount_part_opt(size, length) +#define __RPC__inout_ecount_full_opt(size) __RPC__inout_ecount_part_opt(size, size) +#define __RPC__inout_ecount_full_opt_string(size) __RPC__inout_ecount_full_opt(size) __pre __nullterminated __post __nullterminated +#define __RPC__inout_xcount_opt(size) __inout_opt +#define __RPC__inout_xcount_part_opt(size, length) __inout_opt +#define __RPC__inout_xcount_full_opt(size) __RPC__inout_opt +#define __RPC__inout_xcount_full_opt_string(size) __RPC__inout_opt __pre __nullterminated __post __nullterminated + +// [out] ** +#define __RPC__deref_out __deref_out +#define __RPC__deref_out_string __RPC__deref_out __post __deref __nullterminated +// Removed "__post __deref __exceptthat __maybenull" so return values from QueryInterface and the like can be trusted without an explicit NULL check. +// This is a temporary fix until midl.exe can be rev'd to produce more accurate annotations. +#define __RPC__deref_out_opt __RPC__deref_out +#define __RPC__deref_out_opt_string __RPC__deref_out_opt __post __deref __nullterminated __pre __deref __null +#define __RPC__deref_out_ecount(size) __deref_out_ecount(size) __post __deref __elem_writableTo(size) +#define __RPC__deref_out_ecount_part(size, length) __RPC__deref_out_ecount(size) __post __deref __elem_readableTo(length) +#define __RPC__deref_out_ecount_full(size) __RPC__deref_out_ecount_part(size,size) +#define __RPC__deref_out_ecount_full_string(size) __RPC__deref_out_ecount_full(size) __post __deref __nullterminated +#define __RPC__deref_out_xcount(size) __deref_out __post __deref +#define __RPC__deref_out_xcount_part(size, length) __RPC__deref_out __post __deref +#define __RPC__deref_out_xcount_full(size) __RPC__deref_out +#define __RPC__deref_out_xcount_full_string(size) __RPC__deref_out __post __deref __nullterminated + +// [in,out] **, second pointer decoration. +#define __RPC__deref_inout __deref_inout +#define __RPC__deref_inout_string __RPC__deref_inout __pre __deref __nullterminated __post __deref __nullterminated +#define __RPC__deref_inout_opt __deref_inout_opt +#define __RPC__deref_inout_opt_string __RPC__deref_inout_opt __deref __nullterminated +#define __RPC__deref_inout_ecount_opt(size) __deref_inout_ecount_opt(size) +#define __RPC__deref_inout_ecount_part_opt(size, length) __deref_inout_ecount_part_opt(size , length) +#define __RPC__deref_inout_ecount_full_opt(size) __RPC__deref_inout_ecount_part_opt(size, size) +#define __RPC__deref_inout_ecount_full(size) __deref_inout_ecount_full(size) +#define __RPC__deref_inout_ecount_full_string(size) __RPC__deref_inout_ecount_full(size) __post __deref __nullterminated +#define __RPC__deref_inout_ecount_full_opt_string(size) __RPC__deref_inout_ecount_full_opt(size) __pre __deref __nullterminated __post __deref __nullterminated +#define __RPC__deref_inout_xcount_opt(size) __deref_inout_opt +#define __RPC__deref_inout_xcount_part_opt(size, length) __deref_inout_opt +#define __RPC__deref_inout_xcount_full_opt(size) __RPC__deref_inout_opt +#define __RPC__deref_inout_xcount_full(size) __deref_inout +#define __RPC__deref_inout_xcount_full_string(size) __RPC__deref_inout __post __deref __nullterminated +#define __RPC__deref_inout_xcount_full_opt_string(size) __RPC__deref_inout_opt __pre __deref __nullterminated __post __deref __nullterminated + + +// #define __RPC_out_opt out_opt is not allowed in rpc + +// [in,out,unique] +#define __RPC__deref_opt_inout __deref_opt_inout +#define __RPC__deref_opt_inout_ecount(size) __deref_opt_inout_ecount(size) +#define __RPC__deref_opt_inout_string __RPC__deref_opt_inout __pre __deref __nullterminated __post __deref __nullterminated +#define __RPC__deref_opt_inout_ecount_part(size, length) __deref_opt_inout_ecount_part(size, length) +#define __RPC__deref_opt_inout_ecount_full(size) __deref_opt_inout_ecount_full(size) +#define __RPC__deref_opt_inout_ecount_full_string(size) __RPC__deref_opt_inout_ecount_full(size) __pre __deref __nullterminated __post __deref __nullterminated +#define __RPC__deref_opt_inout_xcount_part(size, length) __deref_opt_inout +#define __RPC__deref_opt_inout_xcount_full(size) __deref_opt_inout +#define __RPC__deref_opt_inout_xcount_full_string(size) __RPC__deref_opt_inout __pre __deref __nullterminated __post __deref __nullterminated + + +// We don't need to specify __pre __deref __exceptthat __maybenull : this is default behavior. While this might not hold in SAL 1.1 syntax, SAL team +// believes it's OK. We can revisit if SAL 1.1 can survive. +#define __RPC__deref_out_ecount_opt(size) __RPC__out_ecount(size) __post __deref __exceptthat __maybenull __pre __deref __null +#define __RPC__deref_out_ecount_part_opt(size, length) __RPC__deref_out_ecount_part(size, length) __post __deref __exceptthat __maybenull __pre __deref __null +#define __RPC__deref_out_ecount_full_opt(size) __RPC__deref_out_ecount_part_opt(size, size) __pre __deref __null +#define __RPC__deref_out_ecount_full_opt_string(size) __RPC__deref_out_ecount_part_opt(size, size) __post __deref __nullterminated __pre __deref __null +#define __RPC__deref_out_xcount_opt(size) __RPC__out __post __deref __exceptthat __maybenull __pre __deref __null +#define __RPC__deref_out_xcount_part_opt(size, length) __RPC__deref_out __post __deref __exceptthat __maybenull __pre __deref __null +#define __RPC__deref_out_xcount_full_opt(size) __RPC__deref_out_opt __pre __deref __null +#define __RPC__deref_out_xcount_full_opt_string(size) __RPC__deref_out_opt __post __deref __nullterminated __pre __deref __null + +#define __RPC__deref_opt_inout_opt __deref_opt_inout_opt +#define __RPC__deref_opt_inout_opt_string __RPC__deref_opt_inout_opt __pre __deref __nullterminated __post __deref __nullterminated +#define __RPC__deref_opt_inout_ecount_opt(size) __deref_opt_inout_ecount_opt(size) +#define __RPC__deref_opt_inout_ecount_part_opt(size, length) __deref_opt_inout_ecount_part_opt(size, length) +#define __RPC__deref_opt_inout_ecount_full_opt(size) __RPC__deref_opt_inout_ecount_part_opt(size, size) +#define __RPC__deref_opt_inout_ecount_full_opt_string(size) __RPC__deref_opt_inout_ecount_full_opt(size) __pre __deref __nullterminated __post __deref __nullterminated +#define __RPC__deref_opt_inout_xcount_opt(size) __deref_opt_inout_opt +#define __RPC__deref_opt_inout_xcount_part_opt(size, length) __deref_opt_inout_opt +#define __RPC__deref_opt_inout_xcount_full_opt(size) __RPC__deref_opt_inout_opt +#define __RPC__deref_opt_inout_xcount_full_opt_string(size) __RPC__deref_opt_inout_opt __pre __deref __nullterminated __post __deref __nullterminated + +#define __RPC_full_pointer __maybenull +#define __RPC_unique_pointer __maybenull +#define __RPC_ref_pointer __notnull +#define __RPC_string __nullterminated + +#define __RPC__range(min,max) __range(min,max) +#define __RPC__in_range(min,max) __in_range(min,max) + +#else // not prefast + +#define __RPC__range(min,max) +#define __RPC__in_range(min,max) + +#define __RPC__in +#define __RPC__in_string +#define __RPC__in_opt_string +#define __RPC__in_ecount(size) +#define __RPC__in_ecount_full(size) +#define __RPC__in_ecount_full_string(size) +#define __RPC__in_ecount_part(size, length) +#define __RPC__in_ecount_full_opt(size) +#define __RPC__in_ecount_full_opt_string(size) +#define __RPC__inout_ecount_full_opt_string(size) +#define __RPC__in_ecount_part_opt(size, length) +#define __RPC__in_xcount(size) +#define __RPC__in_xcount_full(size) +#define __RPC__in_xcount_full_string(size) +#define __RPC__in_xcount_part(size, length) +#define __RPC__in_xcount_full_opt(size) +#define __RPC__in_xcount_full_opt_string(size) +#define __RPC__inout_xcount_full_opt_string(size) +#define __RPC__in_xcount_part_opt(size, length) + +#define __RPC__deref_in +#define __RPC__deref_in_string +#define __RPC__deref_in_opt +#define __RPC__deref_in_opt_string +#define __RPC__deref_opt_in +#define __RPC__deref_opt_in_string +#define __RPC__deref_opt_in_opt +#define __RPC__deref_opt_in_opt_string +#define __RPC__deref_in_ecount(size) +#define __RPC__deref_in_ecount_part(size, length) +#define __RPC__deref_in_ecount_full(size) +#define __RPC__deref_in_ecount_full_opt(size) +#define __RPC__deref_in_ecount_full_string(size) +#define __RPC__deref_in_ecount_full_opt_string(size) +#define __RPC__deref_in_ecount_opt(size) +#define __RPC__deref_in_ecount_opt_string(size) +#define __RPC__deref_in_ecount_part_opt(size, length) +#define __RPC__deref_in_xcount(size) +#define __RPC__deref_in_xcount_part(size, length) +#define __RPC__deref_in_xcount_full(size) +#define __RPC__deref_in_xcount_full_opt(size) +#define __RPC__deref_in_xcount_full_string(size) +#define __RPC__deref_in_xcount_full_opt_string(size) +#define __RPC__deref_in_xcount_opt(size) +#define __RPC__deref_in_xcount_opt_string(size) +#define __RPC__deref_in_xcount_part_opt(size, length) + +// [out] +#define __RPC__out +#define __RPC__out_ecount(size) +#define __RPC__out_ecount_part(size, length) +#define __RPC__out_ecount_full(size) +#define __RPC__out_ecount_full_string(size) +#define __RPC__out_xcount(size) +#define __RPC__out_xcount_part(size, length) +#define __RPC__out_xcount_full(size) +#define __RPC__out_xcount_full_string(size) + +// [in,out] +#define __RPC__inout +#define __RPC__inout_string +#define __RPC__opt_inout +#define __RPC__inout_ecount(size) +#define __RPC__inout_ecount_part(size, length) +#define __RPC__inout_ecount_full(size) +#define __RPC__inout_ecount_full_string(size) +#define __RPC__inout_xcount(size) +#define __RPC__inout_xcount_part(size, length) +#define __RPC__inout_xcount_full(size) +#define __RPC__inout_xcount_full_string(size) + +// [in,unique] +#define __RPC__in_opt +#define __RPC__in_ecount_opt(size) +#define __RPC__in_xcount_opt(size) + + +// [in,out,unique] +#define __RPC__inout_opt +#define __RPC__inout_opt_string +#define __RPC__inout_ecount_opt(size) +#define __RPC__inout_ecount_part_opt(size, length) +#define __RPC__inout_ecount_full_opt(size) +#define __RPC__inout_ecount_full_string(size) +#define __RPC__inout_xcount_opt(size) +#define __RPC__inout_xcount_part_opt(size, length) +#define __RPC__inout_xcount_full_opt(size) +#define __RPC__inout_xcount_full_string(size) + +// [out] ** +#define __RPC__deref_out +#define __RPC__deref_out_string +#define __RPC__deref_out_opt +#define __RPC__deref_out_opt_string +#define __RPC__deref_out_ecount(size) +#define __RPC__deref_out_ecount_part(size, length) +#define __RPC__deref_out_ecount_full(size) +#define __RPC__deref_out_ecount_full_string(size) +#define __RPC__deref_out_xcount(size) +#define __RPC__deref_out_xcount_part(size, length) +#define __RPC__deref_out_xcount_full(size) +#define __RPC__deref_out_xcount_full_string(size) + + +// [in,out] **, second pointer decoration. +#define __RPC__deref_inout +#define __RPC__deref_inout_string +#define __RPC__deref_inout_opt +#define __RPC__deref_inout_opt_string +#define __RPC__deref_inout_ecount_full(size) +#define __RPC__deref_inout_ecount_full_string(size) +#define __RPC__deref_inout_ecount_opt(size) +#define __RPC__deref_inout_ecount_part_opt(size, length) +#define __RPC__deref_inout_ecount_full_opt(size) +#define __RPC__deref_inout_ecount_full_opt_string(size) +#define __RPC__deref_inout_xcount_full(size) +#define __RPC__deref_inout_xcount_full_string(size) +#define __RPC__deref_inout_xcount_opt(size) +#define __RPC__deref_inout_xcount_part_opt(size, length) +#define __RPC__deref_inout_xcount_full_opt(size) +#define __RPC__deref_inout_xcount_full_opt_string(size) + +// #define __RPC_out_opt out_opt is not allowed in rpc + +// [in,out,unique] +#define __RPC__deref_opt_inout +#define __RPC__deref_opt_inout_string +#define __RPC__deref_opt_inout_ecount(size) +#define __RPC__deref_opt_inout_ecount_part(size, length) +#define __RPC__deref_opt_inout_ecount_full(size) +#define __RPC__deref_opt_inout_ecount_full_string(size) +#define __RPC__deref_opt_inout_xcount(size) +#define __RPC__deref_opt_inout_xcount_part(size, length) +#define __RPC__deref_opt_inout_xcount_full(size) +#define __RPC__deref_opt_inout_xcount_full_string(size) + +#define __RPC__deref_out_ecount_opt(size) +#define __RPC__deref_out_ecount_part_opt(size, length) +#define __RPC__deref_out_ecount_full_opt(size) +#define __RPC__deref_out_ecount_full_opt_string(size) +#define __RPC__deref_out_xcount_opt(size) +#define __RPC__deref_out_xcount_part_opt(size, length) +#define __RPC__deref_out_xcount_full_opt(size) +#define __RPC__deref_out_xcount_full_opt_string(size) + +#define __RPC__deref_opt_inout_opt +#define __RPC__deref_opt_inout_opt_string +#define __RPC__deref_opt_inout_ecount_opt(size) +#define __RPC__deref_opt_inout_ecount_part_opt(size, length) +#define __RPC__deref_opt_inout_ecount_full_opt(size) +#define __RPC__deref_opt_inout_ecount_full_opt_string(size) +#define __RPC__deref_opt_inout_xcount_opt(size) +#define __RPC__deref_opt_inout_xcount_part_opt(size, length) +#define __RPC__deref_opt_inout_xcount_full_opt(size) +#define __RPC__deref_opt_inout_xcount_full_opt_string(size) + +#define __RPC_full_pointer +#define __RPC_unique_pointer +#define __RPC_ref_pointer +#define __RPC_string + + +#endif + +#ifdef __cplusplus +} +#endif diff --git a/MediaClient/MediaClient/directx/include/xact3.h b/MediaClient/MediaClient/directx/include/xact3.h new file mode 100644 index 0000000..c27d563 --- /dev/null +++ b/MediaClient/MediaClient/directx/include/xact3.h @@ -0,0 +1,1551 @@ +/************************************************************************** + * + * Copyright (c) Microsoft Corporation. All rights reserved. + * + * Module Name: + * + * xact3.h + * + * Abstract: + * + * XACT public interfaces, functions and data types + * + **************************************************************************/ + +#pragma once + +#ifndef _XACT3_H_ +#define _XACT3_H_ + +//------------------------------------------------------------------------------ +// XACT class and interface IDs (Version 3.7) +//------------------------------------------------------------------------------ +#ifndef _XBOX // XACT COM support only exists on Windows + #include // For DEFINE_CLSID, DEFINE_IID and DECLARE_INTERFACE + DEFINE_CLSID(XACTEngine, bcc782bc, 6492, 4c22, 8c, 35, f5, d7, 2f, e7, 3c, 6e); + DEFINE_CLSID(XACTAuditionEngine, 9ecdd80d, 0e81, 40d8, 89, 03, 2b, f7, b1, 31, ac, 43); + DEFINE_CLSID(XACTDebugEngine, 02860630, bf3b, 42a8, b1, 4e, 91, ed, a2, f5, 1e, a5); + DEFINE_IID(IXACT3Engine, b1ee676a, d9cd, 4d2a, 89, a8, fa, 53, eb, 9e, 48, 0b); +#endif + +// Ignore the rest of this header if only the GUID definitions were requested: +#ifndef GUID_DEFS_ONLY + +//------------------------------------------------------------------------------ +// Includes +//------------------------------------------------------------------------------ + +#ifndef _XBOX + #include + #include + #include +#endif +#include +#include +#include + +//------------------------------------------------------------------------------ +// Forward Declarations +//------------------------------------------------------------------------------ + +typedef struct IXACT3SoundBank IXACT3SoundBank; +typedef struct IXACT3WaveBank IXACT3WaveBank; +typedef struct IXACT3Cue IXACT3Cue; +typedef struct IXACT3Wave IXACT3Wave; +typedef struct IXACT3Engine IXACT3Engine; +typedef struct XACT_NOTIFICATION XACT_NOTIFICATION; + + +//------------------------------------------------------------------------------ +// Typedefs +//------------------------------------------------------------------------------ + +typedef WORD XACTINDEX; // All normal indices +typedef BYTE XACTNOTIFICATIONTYPE; // Notification type +typedef FLOAT XACTVARIABLEVALUE; // Variable value +typedef WORD XACTVARIABLEINDEX; // Variable index +typedef WORD XACTCATEGORY; // Sound category +typedef BYTE XACTCHANNEL; // Audio channel +typedef FLOAT XACTVOLUME; // Volume value +typedef LONG XACTTIME; // Time (in ms) +typedef SHORT XACTPITCH; // Pitch value +typedef BYTE XACTLOOPCOUNT; // For all loops / recurrences +typedef BYTE XACTVARIATIONWEIGHT; // Variation weight +typedef BYTE XACTPRIORITY; // Sound priority +typedef BYTE XACTINSTANCELIMIT; // Instance limitations + +//------------------------------------------------------------------------------ +// Standard win32 multimedia definitions +//------------------------------------------------------------------------------ +#ifndef WAVE_FORMAT_IEEE_FLOAT + #define WAVE_FORMAT_IEEE_FLOAT 0x0003 +#endif + +#ifndef WAVE_FORMAT_EXTENSIBLE + #define WAVE_FORMAT_EXTENSIBLE 0xFFFE +#endif + +#ifndef _WAVEFORMATEX_ +#define _WAVEFORMATEX_ + #pragma pack(push, 1) + typedef struct tWAVEFORMATEX + { + WORD wFormatTag; // format type + WORD nChannels; // number of channels (i.e. mono, stereo...) + DWORD nSamplesPerSec; // sample rate + DWORD nAvgBytesPerSec; // for buffer estimation + WORD nBlockAlign; // block size of data + WORD wBitsPerSample; // Number of bits per sample of mono data + WORD cbSize; // The count in bytes of the size of extra information (after cbSize) + + } WAVEFORMATEX, *PWAVEFORMATEX; + typedef WAVEFORMATEX NEAR *NPWAVEFORMATEX; + typedef WAVEFORMATEX FAR *LPWAVEFORMATEX; + #pragma pack(pop) +#endif + +#ifndef _WAVEFORMATEXTENSIBLE_ +#define _WAVEFORMATEXTENSIBLE_ + #pragma pack(push, 1) + typedef struct + { + WAVEFORMATEX Format; // WAVEFORMATEX data + + union + { + WORD wValidBitsPerSample; // Bits of precision + WORD wSamplesPerBlock; // Samples per block of audio data, valid if wBitsPerSample==0 + WORD wReserved; // Unused -- If neither applies, set to zero. + } Samples; + + DWORD dwChannelMask; // Speaker usage bitmask + GUID SubFormat; // Sub-format identifier + } WAVEFORMATEXTENSIBLE, *PWAVEFORMATEXTENSIBLE; + #pragma pack(pop) +#endif + +//------------------------------------------------------------------------------ +// Constants +//------------------------------------------------------------------------------ +static const XACTTIME XACTTIME_MIN = LONG_MIN; +static const XACTTIME XACTTIME_MAX = LONG_MAX; // 24 days 20:31:23.647 +static const XACTTIME XACTTIME_INFINITE = LONG_MAX; +static const XACTINSTANCELIMIT XACTINSTANCELIMIT_INFINITE = 0xff; +static const XACTINSTANCELIMIT XACTINSTANCELIMIT_MIN = 0x00; // == 1 instance total (0 additional instances) +static const XACTINSTANCELIMIT XACTINSTANCELIMIT_MAX = 0xfe; // == 255 instances total (254 additional instances) +static const XACTINDEX XACTINDEX_MIN = 0x0; +static const XACTINDEX XACTINDEX_MAX = 0xfffe; +static const XACTINDEX XACTINDEX_INVALID = 0xffff; +static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_MIN = 0x00; +static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_MAX = 0xff; +static const XACTVARIABLEVALUE XACTVARIABLEVALUE_MIN = -FLT_MAX; +static const XACTVARIABLEVALUE XACTVARIABLEVALUE_MAX = FLT_MAX; +static const XACTVARIABLEINDEX XACTVARIABLEINDEX_MIN = 0x0000; +static const XACTVARIABLEINDEX XACTVARIABLEINDEX_MAX = 0xfffe; +static const XACTVARIABLEINDEX XACTVARIABLEINDEX_INVALID = 0xffff; +static const XACTCATEGORY XACTCATEGORY_MIN = 0x0; +static const XACTCATEGORY XACTCATEGORY_MAX = 0xfffe; +static const XACTCATEGORY XACTCATEGORY_INVALID = 0xffff; +static const XACTCHANNEL XACTCHANNEL_MIN = 0; +static const XACTCHANNEL XACTCHANNEL_MAX = 0xFF; +static const XACTPITCH XACTPITCH_MIN = -1200; // pitch change allowable per individual content field +static const XACTPITCH XACTPITCH_MAX = 1200; +static const XACTPITCH XACTPITCH_MIN_TOTAL = -2400; // total allowable pitch change, use with IXACTWave.SetPitch() +static const XACTPITCH XACTPITCH_MAX_TOTAL = 2400; +static const XACTVOLUME XACTVOLUME_MIN = 0.0f; +static const XACTVOLUME XACTVOLUME_MAX = 16777216.0f; // Maximum acceptable volume level (2^24) - matches XAudio2 max volume +static const XACTVARIABLEVALUE XACTPARAMETERVALUE_MIN = -FLT_MAX; +static const XACTVARIABLEVALUE XACTPARAMETERVALUE_MAX = FLT_MAX; +static const XACTLOOPCOUNT XACTLOOPCOUNT_MIN = 0x0; +static const XACTLOOPCOUNT XACTLOOPCOUNT_MAX = 0xfe; +static const XACTLOOPCOUNT XACTLOOPCOUNT_INFINITE = 0xff; +static const DWORD XACTWAVEALIGNMENT_MIN = 2048; +#ifdef _XBOX +static const BYTE XACTMAXOUTPUTVOICECOUNT = 3; +#endif // _XBOX + + +// ----------------------------------------------------------------------------- +// Cue friendly name length +// ----------------------------------------------------------------------------- +#define XACT_CUE_NAME_LENGTH 0xFF + +// ----------------------------------------------------------------------------- +// Current Content Tool Version +// ----------------------------------------------------------------------------- +#define XACT_CONTENT_VERSION 46 + +// ----------------------------------------------------------------------------- +// XACT Stop Flags +// ----------------------------------------------------------------------------- +static const DWORD XACT_FLAG_STOP_RELEASE = 0x00000000; // Stop with release envelope (or as authored), for looping waves this acts as break loop. +static const DWORD XACT_FLAG_STOP_IMMEDIATE = 0x00000001; // Stop immediately + +// ----------------------------------------------------------------------------- +// XACT Manage Data Flag - XACT will manage the lifetime of this data +// ----------------------------------------------------------------------------- +static const DWORD XACT_FLAG_MANAGEDATA = 0x00000001; + +// ----------------------------------------------------------------------------- +// XACT Content Preparation Flags +// ----------------------------------------------------------------------------- +static const DWORD XACT_FLAG_BACKGROUND_MUSIC = 0x00000002; // Marks the waves as background music. +static const DWORD XACT_FLAG_UNITS_MS = 0x00000004; // Indicates that the units passed in are in milliseconds. +static const DWORD XACT_FLAG_UNITS_SAMPLES = 0x00000008; // Indicates that the units passed in are in samples. + +// ----------------------------------------------------------------------------- +// XACT State flags +// ----------------------------------------------------------------------------- +static const DWORD XACT_STATE_CREATED = 0x00000001; // Created, but nothing else +static const DWORD XACT_STATE_PREPARING = 0x00000002; // In the middle of preparing +static const DWORD XACT_STATE_PREPARED = 0x00000004; // Prepared, but not yet played +static const DWORD XACT_STATE_PLAYING = 0x00000008; // Playing (though could be paused) +static const DWORD XACT_STATE_STOPPING = 0x00000010; // Stopping +static const DWORD XACT_STATE_STOPPED = 0x00000020; // Stopped +static const DWORD XACT_STATE_PAUSED = 0x00000040; // Paused (Can be combined with some of the other state flags above) +static const DWORD XACT_STATE_INUSE = 0x00000080; // Object is in use (used by wavebanks and soundbanks). +static const DWORD XACT_STATE_PREPAREFAILED = 0x80000000; // Object preparation failed. + +//------------------------------------------------------------------------------ +// XACT Parameters +//------------------------------------------------------------------------------ + +#define XACT_FLAG_GLOBAL_SETTINGS_MANAGEDATA XACT_FLAG_MANAGEDATA + +// ----------------------------------------------------------------------------- +// File IO Callbacks +// ----------------------------------------------------------------------------- +typedef BOOL (__stdcall * XACT_READFILE_CALLBACK)(__in HANDLE hFile, __out_bcount(nNumberOfBytesToRead) LPVOID lpBuffer, DWORD nNumberOfBytesToRead, __out LPDWORD lpNumberOfBytesRead, __inout LPOVERLAPPED lpOverlapped); +typedef BOOL (__stdcall * XACT_GETOVERLAPPEDRESULT_CALLBACK)(__in HANDLE hFile, __inout LPOVERLAPPED lpOverlapped, __out LPDWORD lpNumberOfBytesTransferred, BOOL bWait); + +typedef struct XACT_FILEIO_CALLBACKS +{ + XACT_READFILE_CALLBACK readFileCallback; + XACT_GETOVERLAPPEDRESULT_CALLBACK getOverlappedResultCallback; + +} XACT_FILEIO_CALLBACKS, *PXACT_FILEIO_CALLBACKS; +typedef const XACT_FILEIO_CALLBACKS *PCXACT_FILEIO_CALLBACKS; + +// ----------------------------------------------------------------------------- +// Notification Callback +// ----------------------------------------------------------------------------- +typedef void (__stdcall * XACT_NOTIFICATION_CALLBACK)(__in const XACT_NOTIFICATION* pNotification); + +#define XACT_RENDERER_ID_LENGTH 0xff // Maximum number of characters allowed in the renderer ID +#define XACT_RENDERER_NAME_LENGTH 0xff // Maximum number of characters allowed in the renderer display name. + +// ----------------------------------------------------------------------------- +// Renderer Details +// ----------------------------------------------------------------------------- +typedef struct XACT_RENDERER_DETAILS +{ + WCHAR rendererID[XACT_RENDERER_ID_LENGTH]; // The string ID for the rendering device. + WCHAR displayName[XACT_RENDERER_NAME_LENGTH]; // A friendly name suitable for display to a human. + BOOL defaultDevice; // Set to TRUE if this device is the primary audio device on the system. + +} XACT_RENDERER_DETAILS, *LPXACT_RENDERER_DETAILS; + +// ----------------------------------------------------------------------------- +// Engine Look-Ahead Time +// ----------------------------------------------------------------------------- +#define XACT_ENGINE_LOOKAHEAD_DEFAULT 250 // Default look-ahead time of 250ms can be used during XACT engine initialization. + +// ----------------------------------------------------------------------------- +// Runtime (engine) parameters +// ----------------------------------------------------------------------------- +typedef struct XACT_RUNTIME_PARAMETERS +{ + DWORD lookAheadTime; // Time in ms + void* pGlobalSettingsBuffer; // Buffer containing the global settings file + DWORD globalSettingsBufferSize; // Size of global settings buffer + DWORD globalSettingsFlags; // Flags for global settings + DWORD globalSettingsAllocAttributes; // Global settings buffer allocation attributes (see XMemAlloc) + XACT_FILEIO_CALLBACKS fileIOCallbacks; // File I/O callbacks + XACT_NOTIFICATION_CALLBACK fnNotificationCallback; // Callback that receives notifications. + PWSTR pRendererID; // Ptr to the ID for the audio renderer the engine should connect to. + IXAudio2* pXAudio2; // XAudio2 object to be used by the engine (NULL if one needs to be created) + IXAudio2MasteringVoice* pMasteringVoice; // Mastering voice to be used by the engine, if pXAudio2 is not NULL. + +} XACT_RUNTIME_PARAMETERS, *LPXACT_RUNTIME_PARAMETERS; +typedef const XACT_RUNTIME_PARAMETERS *LPCXACT_RUNTIME_PARAMETERS; + +//------------------------------------------------------------------------------ +// Streaming Parameters +//------------------------------------------------------------------------------ + +typedef struct XACT_STREAMING_PARAMETERS +{ + HANDLE file; // File handle associated with wavebank data + DWORD offset; // Offset within file of wavebank header (must be sector aligned) + DWORD flags; // Flags (none currently) + WORD packetSize; // Stream packet size (in sectors) to use for each stream (min = 2) + // number of sectors (DVD = 2048 bytes: 2 = 4096, 3 = 6144, 4 = 8192 etc.) + // optimal DVD size is a multiple of 16 (DVD block = 16 DVD sectors) + +} XACT_WAVEBANK_STREAMING_PARAMETERS, *LPXACT_WAVEBANK_STREAMING_PARAMETERS, XACT_STREAMING_PARAMETERS, *LPXACT_STREAMING_PARAMETERS; +typedef const XACT_STREAMING_PARAMETERS *LPCXACT_STREAMING_PARAMETERS; +typedef const XACT_WAVEBANK_STREAMING_PARAMETERS *LPCXACT_WAVEBANK_STREAMING_PARAMETERS; + +// Structure used to report cue properties back to the client. +typedef struct XACT_CUE_PROPERTIES +{ + CHAR friendlyName[XACT_CUE_NAME_LENGTH]; // Empty if the soundbank doesn't contain any friendly names + BOOL interactive; // TRUE if an IA cue; FALSE otherwise + XACTINDEX iaVariableIndex; // Only valid for IA cues; XACTINDEX_INVALID otherwise + XACTINDEX numVariations; // Number of variations in the cue + XACTINSTANCELIMIT maxInstances; // Number of maximum instances for this cue + XACTINSTANCELIMIT currentInstances; // Current active instances of this cue + +} XACT_CUE_PROPERTIES, *LPXACT_CUE_PROPERTIES; + +// Strucutre used to return the track properties. +typedef struct XACT_TRACK_PROPERTIES +{ + XACTTIME duration; // Duration of the track in ms + XACTINDEX numVariations; // Number of wave variations in the track + XACTCHANNEL numChannels; // Number of channels for the active wave variation on this track + XACTINDEX waveVariation; // Index of the active wave variation + XACTLOOPCOUNT loopCount; // Current loop count on this track + +} XACT_TRACK_PROPERTIES, *LPXACT_TRACK_PROPERTIES; + +// Structure used to return the properties of a variation. +typedef struct XACT_VARIATION_PROPERTIES +{ + XACTINDEX index; // Index of the variation in the cue's variation list + XACTVARIATIONWEIGHT weight; // Weight for the active variation. Valid only for complex cues + XACTVARIABLEVALUE iaVariableMin; // Valid only for IA cues + XACTVARIABLEVALUE iaVariableMax; // Valid only for IA cues + BOOL linger; // Valid only for IA cues + +} XACT_VARIATION_PROPERTIES, *LPXACT_VARIATION_PROPERTIES; + +// Structure used to return the properties of the sound referenced by a variation. +typedef struct XACT_SOUND_PROPERTIES +{ + XACTCATEGORY category; // Category this sound belongs to + BYTE priority; // Priority of this variation + XACTPITCH pitch; // Current pitch set on the active variation + XACTVOLUME volume; // Current volume set on the active variation + XACTINDEX numTracks; // Number of tracks in the active variation + XACT_TRACK_PROPERTIES arrTrackProperties[1]; // Array of active track properties (has numTracks number of elements) + +} XACT_SOUND_PROPERTIES, *LPXACT_SOUND_PROPERTIES; + +// Structure used to return the properties of the active variation and the sound referenced. +typedef struct XACT_SOUND_VARIATION_PROPERTIES +{ + XACT_VARIATION_PROPERTIES variationProperties;// Properties for this variation + XACT_SOUND_PROPERTIES soundProperties; // Proeprties for the sound referenced by this variation + +} XACT_SOUND_VARIATION_PROPERTIES, *LPXACT_SOUND_VARIATION_PROPERTIES; + +// Structure used to return the properties of an active cue instance. +typedef struct XACT_CUE_INSTANCE_PROPERTIES +{ + DWORD allocAttributes; // Buffer allocation attributes (see XMemAlloc) + XACT_CUE_PROPERTIES cueProperties; // Properties of the cue that are shared by all instances. + XACT_SOUND_VARIATION_PROPERTIES activeVariationProperties; // Properties if the currently active variation. + +} XACT_CUE_INSTANCE_PROPERTIES, *LPXACT_CUE_INSTANCE_PROPERTIES; + +// Structure used to return the common wave properties. +typedef struct XACT_WAVE_PROPERTIES +{ + char friendlyName[WAVEBANK_ENTRYNAME_LENGTH]; // Friendly name for the wave; empty if the wavebank doesn't contain friendly names. + WAVEBANKMINIWAVEFORMAT format; // Format for the wave. + DWORD durationInSamples; // Duration of the wave in units of one sample + WAVEBANKSAMPLEREGION loopRegion; // Loop region defined in samples. + BOOL streaming; // Set to TRUE if the wave is streaming; FALSE otherwise. + +} XACT_WAVE_PROPERTIES, *LPXACT_WAVE_PROPERTIES; +typedef const XACT_WAVE_PROPERTIES* LPCXACT_WAVE_PROPERTIES; + +// Structure used to return the properties specific to a wave instance. +typedef struct XACT_WAVE_INSTANCE_PROPERTIES +{ + XACT_WAVE_PROPERTIES properties; // Static properties common to all the wave instances. + BOOL backgroundMusic; // Set to TRUE if the wave is tagged as background music; FALSE otherwise. + +} XACT_WAVE_INSTANCE_PROPERTIES, *LPXACT_WAVE_INSTANCE_PROPERTIES; +typedef const XACT_WAVE_INSTANCE_PROPERTIES* LPCXACT_WAVE_INSTANCE_PROPERTIES; + +//------------------------------------------------------------------------------ +// Channel Mapping / Speaker Panning +//------------------------------------------------------------------------------ + +typedef struct XACTCHANNELMAPENTRY +{ + XACTCHANNEL InputChannel; + XACTCHANNEL OutputChannel; + XACTVOLUME Volume; + +} XACTCHANNELMAPENTRY, *LPXACTCHANNELMAPENTRY; +typedef const XACTCHANNELMAPENTRY *LPCXACTCHANNELMAPENTRY; + +typedef struct XACTCHANNELMAP +{ + XACTCHANNEL EntryCount; + XACTCHANNELMAPENTRY* paEntries; + +} XACTCHANNELMAP, *LPXACTCHANNELMAP; +typedef const XACTCHANNELMAP *LPCXACTCHANNELMAP; + +typedef struct XACTCHANNELVOLUMEENTRY +{ + XACTCHANNEL EntryIndex; + XACTVOLUME Volume; + +} XACTCHANNELVOLUMEENTRY, *LPXACTCHANNELVOLUMEENTRY; +typedef const XACTCHANNELVOLUMEENTRY *LPCXACTCHANNELVOLUMEENTRY; + +typedef struct XACTCHANNELVOLUME +{ + XACTCHANNEL EntryCount; + XACTCHANNELVOLUMEENTRY* paEntries; + +} XACTCHANNELVOLUME, *LPXACTCHANNELVOLUME; +typedef const XACTCHANNELVOLUME *LPCXACTCHANNELVOLUME; + +//------------------------------------------------------------------------------ +// Notifications +//------------------------------------------------------------------------------ + +static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_CUEPREPARED = 1; // None, SoundBank, SoundBank & cue index, cue instance +static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_CUEPLAY = 2; // None, SoundBank, SoundBank & cue index, cue instance +static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_CUESTOP = 3; // None, SoundBank, SoundBank & cue index, cue instance +static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_CUEDESTROYED = 4; // None, SoundBank, SoundBank & cue index, cue instance +static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_MARKER = 5; // None, SoundBank, SoundBank & cue index, cue instance +static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_SOUNDBANKDESTROYED = 6; // None, SoundBank +static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_WAVEBANKDESTROYED = 7; // None, WaveBank +static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_LOCALVARIABLECHANGED = 8; // None, SoundBank, SoundBank & cue index, cue instance +static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_GLOBALVARIABLECHANGED = 9; // None +static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_GUICONNECTED = 10; // None +static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_GUIDISCONNECTED = 11; // None +static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_WAVEPREPARED = 12; // None, WaveBank & wave index, wave instance. +static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_WAVEPLAY = 13; // None, SoundBank, SoundBank & cue index, cue instance, WaveBank, wave instance +static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_WAVESTOP = 14; // None, SoundBank, SoundBank & cue index, cue instance, WaveBank, wave instance +static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_WAVELOOPED = 15; // None, SoundBank, SoundBank & cue index, cue instance, WaveBank, wave instance +static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_WAVEDESTROYED = 16; // None, WaveBank & wave index, wave instance. +static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_WAVEBANKPREPARED = 17; // None, WaveBank +static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_WAVEBANKSTREAMING_INVALIDCONTENT = 18; // None, WaveBank + +static const BYTE XACT_FLAG_NOTIFICATION_PERSIST = 0x01; + +// Pack the notification structures +#pragma pack(push, 1) + +// Notification description used for registering, un-registering and flushing notifications +typedef struct XACT_NOTIFICATION_DESCRIPTION +{ + XACTNOTIFICATIONTYPE type; // Notification type + BYTE flags; // Flags + IXACT3SoundBank* pSoundBank; // SoundBank instance + IXACT3WaveBank* pWaveBank; // WaveBank instance + IXACT3Cue* pCue; // Cue instance + IXACT3Wave* pWave; // Wave instance + XACTINDEX cueIndex; // Cue index + XACTINDEX waveIndex; // Wave index + PVOID pvContext; // User context (optional) + +} XACT_NOTIFICATION_DESCRIPTION, *LPXACT_NOTIFICATION_DESCRIPTION; +typedef const XACT_NOTIFICATION_DESCRIPTION *LPCXACT_NOTIFICATION_DESCRIPTION; + +// Notification structure for all XACTNOTIFICATIONTYPE_CUE* notifications +typedef struct XACT_NOTIFICATION_CUE +{ + XACTINDEX cueIndex; // Cue index + IXACT3SoundBank* pSoundBank; // SoundBank instance + IXACT3Cue* pCue; // Cue instance + +} XACT_NOTIFICATION_CUE, *LPXACT_NOTIFICATION_CUE; +typedef const XACT_NOTIFICATION_CUE *LPCXACT_NOTIFICATION_CUE; + +// Notification structure for all XACTNOTIFICATIONTYPE_MARKER* notifications +typedef struct XACT_NOTIFICATION_MARKER +{ + XACTINDEX cueIndex; // Cue index + IXACT3SoundBank* pSoundBank; // SoundBank instance + IXACT3Cue* pCue; // Cue instance + DWORD marker; // Marker value + +} XACT_NOTIFICATION_MARKER, *LPXACT_NOTIFICATION_MARKER; +typedef const XACT_NOTIFICATION_MARKER *LPCXACT_NOTIFICATION_MARKER; + +// Notification structure for all XACTNOTIFICATIONTYPE_SOUNDBANK* notifications +typedef struct XACT_NOTIFICATION_SOUNDBANK +{ + IXACT3SoundBank* pSoundBank; // SoundBank instance + +} XACT_NOTIFICATION_SOUNDBANK, *LPXACT_NOTIFICATION_SOUNDBANK; +typedef const XACT_NOTIFICATION_SOUNDBANK *LPCXACT_NOTIFICATION_SOUNDBANK; + +// Notification structure for all XACTNOTIFICATIONTYPE_WAVEBANK* notifications +typedef struct XACT_NOTIFICATION_WAVEBANK +{ + IXACT3WaveBank* pWaveBank; // WaveBank instance + +} XACT_NOTIFICATION_WAVEBANK, *LPXACT_NOTIFICATION_WAVEBANK; +typedef const XACT_NOTIFICATION_WAVEBANK *LPCXACT_NOTIFICATION_WAVEBANK; + +// Notification structure for all XACTNOTIFICATIONTYPE_*VARIABLE* notifications +typedef struct XACT_NOTIFICATION_VARIABLE +{ + XACTINDEX cueIndex; // Cue index + IXACT3SoundBank* pSoundBank; // SoundBank instance + IXACT3Cue* pCue; // Cue instance + XACTVARIABLEINDEX variableIndex; // Variable index + XACTVARIABLEVALUE variableValue; // Variable value + BOOL local; // TRUE if a local variable + +} XACT_NOTIFICATION_VARIABLE, *LPXACT_NOTIFICATION_VARIABLE; +typedef const XACT_NOTIFICATION_VARIABLE *LPCXACT_NOTIFICATION_VARIABLE; + +// Notification structure for all XACTNOTIFICATIONTYPE_GUI* notifications +typedef struct XACT_NOTIFICATION_GUI +{ + DWORD reserved; // Reserved +} XACT_NOTIFICATION_GUI, *LPXACT_NOTIFICATION_GUI; +typedef const XACT_NOTIFICATION_GUI *LPCXACT_NOTIFICATION_GUI; + +// Notification structure for all XACTNOTIFICATIONTYPE_WAVE* notifications +typedef struct XACT_NOTIFICATION_WAVE +{ + IXACT3WaveBank* pWaveBank; // WaveBank + XACTINDEX waveIndex; // Wave index + XACTINDEX cueIndex; // Cue index + IXACT3SoundBank* pSoundBank; // SoundBank instance + IXACT3Cue* pCue; // Cue instance + IXACT3Wave* pWave; // Wave instance + +} XACT_NOTIFICATION_WAVE, *LPXACT_NOTIFICATION_WAVE; +typedef const XACT_NOTIFICATION_WAVE *LPCXACT_NOTIFICATION_WAVE; + +// General notification structure +typedef struct XACT_NOTIFICATION +{ + XACTNOTIFICATIONTYPE type; // Notification type + LONG timeStamp; // Timestamp of notification (milliseconds) + PVOID pvContext; // User context (optional) + union + { + XACT_NOTIFICATION_CUE cue; // XACTNOTIFICATIONTYPE_CUE* + XACT_NOTIFICATION_MARKER marker; // XACTNOTIFICATIONTYPE_MARKER* + XACT_NOTIFICATION_SOUNDBANK soundBank; // XACTNOTIFICATIONTYPE_SOUNDBANK* + XACT_NOTIFICATION_WAVEBANK waveBank; // XACTNOTIFICATIONTYPE_WAVEBANK* + XACT_NOTIFICATION_VARIABLE variable; // XACTNOTIFICATIONTYPE_VARIABLE* + XACT_NOTIFICATION_GUI gui; // XACTNOTIFICATIONTYPE_GUI* + XACT_NOTIFICATION_WAVE wave; // XACTNOTIFICATIONTYPE_WAVE* + }; + +} XACT_NOTIFICATION, *LPXACT_NOTIFICATION; +typedef const XACT_NOTIFICATION *LPCXACT_NOTIFICATION; + +#pragma pack(pop) + +//------------------------------------------------------------------------------ +// IXACT3SoundBank +//------------------------------------------------------------------------------ + +#define XACT_FLAG_SOUNDBANK_STOP_IMMEDIATE XACT_FLAG_STOP_IMMEDIATE +#define XACT_SOUNDBANKSTATE_INUSE XACT_STATE_INUSE + +STDAPI_(XACTINDEX) IXACT3SoundBank_GetCueIndex(__in IXACT3SoundBank* pSoundBank, __in PCSTR szFriendlyName); +STDAPI IXACT3SoundBank_GetNumCues(__in IXACT3SoundBank* pSoundBank, __out XACTINDEX* pnNumCues); +STDAPI IXACT3SoundBank_GetCueProperties(__in IXACT3SoundBank* pSoundBank, XACTINDEX nCueIndex, __out LPXACT_CUE_PROPERTIES pProperties); +STDAPI IXACT3SoundBank_Prepare(__in IXACT3SoundBank* pSoundBank, XACTINDEX nCueIndex, DWORD dwFlags, XACTTIME timeOffset, __deref_out IXACT3Cue** ppCue); +STDAPI IXACT3SoundBank_Play(__in IXACT3SoundBank* pSoundBank, XACTINDEX nCueIndex, DWORD dwFlags, XACTTIME timeOffset, __deref_opt_out IXACT3Cue** ppCue); +STDAPI IXACT3SoundBank_Stop(__in IXACT3SoundBank* pSoundBank, XACTINDEX nCueIndex, DWORD dwFlags); +STDAPI IXACT3SoundBank_Destroy(__in IXACT3SoundBank* pSoundBank); +STDAPI IXACT3SoundBank_GetState(__in IXACT3SoundBank* pSoundBank, __out DWORD* pdwState); + +#undef INTERFACE +#define INTERFACE IXACT3SoundBank + +DECLARE_INTERFACE(IXACT3SoundBank) +{ + STDMETHOD_(XACTINDEX, GetCueIndex)(THIS_ __in PCSTR szFriendlyName) PURE; + STDMETHOD(GetNumCues)(THIS_ __out XACTINDEX* pnNumCues) PURE; + STDMETHOD(GetCueProperties)(THIS_ XACTINDEX nCueIndex, __out LPXACT_CUE_PROPERTIES pProperties) PURE; + STDMETHOD(Prepare)(THIS_ XACTINDEX nCueIndex, DWORD dwFlags, XACTTIME timeOffset, __deref_out IXACT3Cue** ppCue) PURE; + STDMETHOD(Play)(THIS_ XACTINDEX nCueIndex, DWORD dwFlags, XACTTIME timeOffset, __deref_opt_out IXACT3Cue** ppCue) PURE; + STDMETHOD(Stop)(THIS_ XACTINDEX nCueIndex, DWORD dwFlags) PURE; + STDMETHOD(Destroy)(THIS) PURE; + STDMETHOD(GetState)(THIS_ __out DWORD* pdwState) PURE; +}; + +#ifdef __cplusplus + +__inline HRESULT __stdcall IXACT3SoundBank_Destroy(__in IXACT3SoundBank* pSoundBank) +{ + return pSoundBank->Destroy(); +} + +__inline XACTINDEX __stdcall IXACT3SoundBank_GetCueIndex(__in IXACT3SoundBank* pSoundBank, __in PCSTR szFriendlyName) +{ + return pSoundBank->GetCueIndex(szFriendlyName); +} + +__inline HRESULT __stdcall IXACT3SoundBank_GetNumCues(__in IXACT3SoundBank* pSoundBank, __out XACTINDEX* pnNumCues) +{ + return pSoundBank->GetNumCues(pnNumCues); +} + +__inline HRESULT __stdcall IXACT3SoundBank_GetCueProperties(__in IXACT3SoundBank* pSoundBank, XACTINDEX nCueIndex, __out LPXACT_CUE_PROPERTIES pProperties) +{ + return pSoundBank->GetCueProperties(nCueIndex, pProperties); +} + +__inline HRESULT __stdcall IXACT3SoundBank_Prepare(__in IXACT3SoundBank* pSoundBank, XACTINDEX nCueIndex, DWORD dwFlags, XACTTIME timeOffset, __deref_out IXACT3Cue** ppCue) +{ + return pSoundBank->Prepare(nCueIndex, dwFlags, timeOffset, ppCue); +} + +__inline HRESULT __stdcall IXACT3SoundBank_Play(__in IXACT3SoundBank* pSoundBank, XACTINDEX nCueIndex, DWORD dwFlags, XACTTIME timeOffset, __deref_opt_out IXACT3Cue** ppCue) +{ + return pSoundBank->Play(nCueIndex, dwFlags, timeOffset, ppCue); +} + +__inline HRESULT __stdcall IXACT3SoundBank_Stop(__in IXACT3SoundBank* pSoundBank, XACTINDEX nCueIndex, DWORD dwFlags) +{ + return pSoundBank->Stop(nCueIndex, dwFlags); +} + +__inline HRESULT __stdcall IXACT3SoundBank_GetState(__in IXACT3SoundBank* pSoundBank, __out DWORD* pdwState) +{ + return pSoundBank->GetState(pdwState); +} + +#else // __cplusplus + +__inline HRESULT __stdcall IXACT3SoundBank_Destroy(__in IXACT3SoundBank* pSoundBank) +{ + return pSoundBank->lpVtbl->Destroy(pSoundBank); +} + +__inline XACTINDEX __stdcall IXACT3SoundBank_GetCueIndex(__in IXACT3SoundBank* pSoundBank, __in PCSTR szFriendlyName) +{ + return pSoundBank->lpVtbl->GetCueIndex(pSoundBank, szFriendlyName); +} + +__inline HRESULT __stdcall IXACT3SoundBank_GetNumCues(__in IXACT3SoundBank* pSoundBank, __out XACTINDEX* pnNumCues) +{ + return pSoundBank->lpVtbl->GetNumCues(pSoundBank, pnNumCues); +} + +__inline HRESULT __stdcall IXACT3SoundBank_GetCueProperties(__in IXACT3SoundBank* pSoundBank, XACTINDEX nCueIndex, __out LPXACT_CUE_PROPERTIES pProperties) +{ + return pSoundBank->lpVtbl->GetCueProperties(pSoundBank, nCueIndex, pProperties); +} + +__inline HRESULT __stdcall IXACT3SoundBank_Prepare(__in IXACT3SoundBank* pSoundBank, XACTINDEX nCueIndex, DWORD dwFlags, XACTTIME timeOffset, __deref_out IXACT3Cue** ppCue) +{ + return pSoundBank->lpVtbl->Prepare(pSoundBank, nCueIndex, dwFlags, timeOffset, ppCue); +} + +__inline HRESULT __stdcall IXACT3SoundBank_Play(__in IXACT3SoundBank* pSoundBank, XACTINDEX nCueIndex, DWORD dwFlags, XACTTIME timeOffset, __deref_opt_out IXACT3Cue** ppCue) +{ + return pSoundBank->lpVtbl->Play(pSoundBank, nCueIndex, dwFlags, timeOffset, ppCue); +} + +__inline HRESULT __stdcall IXACT3SoundBank_Stop(__in IXACT3SoundBank* pSoundBank, XACTINDEX nCueIndex, DWORD dwFlags) +{ + return pSoundBank->lpVtbl->Stop(pSoundBank, nCueIndex, dwFlags); +} + +__inline HRESULT __stdcall IXACT3SoundBank_GetState(__in IXACT3SoundBank* pSoundBank, __out DWORD* pdwState) +{ + return pSoundBank->lpVtbl->GetState(pSoundBank, pdwState); +} + +#endif // __cplusplus + +//------------------------------------------------------------------------------ +// IXACT3WaveBank +//------------------------------------------------------------------------------ +#define XACT_WAVEBANKSTATE_INUSE XACT_STATE_INUSE // Currently in-use +#define XACT_WAVEBANKSTATE_PREPARED XACT_STATE_PREPARED // Prepared +#define XACT_WAVEBANKSTATE_PREPAREFAILED XACT_STATE_PREPAREFAILED // Prepare failed. + + +STDAPI IXACT3WaveBank_Destroy(__in IXACT3WaveBank* pWaveBank); +STDAPI IXACT3WaveBank_GetState(__in IXACT3WaveBank* pWaveBank, __out DWORD* pdwState); +STDAPI IXACT3WaveBank_GetNumWaves(__in IXACT3WaveBank* pWaveBank, __out XACTINDEX* pnNumWaves); +STDAPI_(XACTINDEX) IXACT3WaveBank_GetWaveIndex(__in IXACT3WaveBank* pWaveBank, __in PCSTR szFriendlyName); +STDAPI IXACT3WaveBank_GetWaveProperties(__in IXACT3WaveBank* pWaveBank, XACTINDEX nWaveIndex, __out LPXACT_WAVE_PROPERTIES pWaveProperties); +STDAPI IXACT3WaveBank_Prepare(__in IXACT3WaveBank* pWaveBank, XACTINDEX nWaveIndex, DWORD dwFlags, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, __deref_out IXACT3Wave** ppWave); +STDAPI IXACT3WaveBank_Play(__in IXACT3WaveBank* pWaveBank, XACTINDEX nWaveIndex, DWORD dwFlags, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, __deref_out IXACT3Wave** ppWave); +STDAPI IXACT3WaveBank_Stop(__in IXACT3WaveBank* pWaveBank, XACTINDEX nWaveIndex, DWORD dwFlags); + +#undef INTERFACE +#define INTERFACE IXACT3WaveBank + +DECLARE_INTERFACE(IXACT3WaveBank) +{ + STDMETHOD(Destroy)(THIS) PURE; + STDMETHOD(GetNumWaves)(THIS_ __out XACTINDEX* pnNumWaves) PURE; + STDMETHOD_(XACTINDEX, GetWaveIndex)(THIS_ __in PCSTR szFriendlyName) PURE; + STDMETHOD(GetWaveProperties)(THIS_ XACTINDEX nWaveIndex, __out LPXACT_WAVE_PROPERTIES pWaveProperties) PURE; + STDMETHOD(Prepare)(THIS_ XACTINDEX nWaveIndex, DWORD dwFlags, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, __deref_out IXACT3Wave** ppWave) PURE; + STDMETHOD(Play)(THIS_ XACTINDEX nWaveIndex, DWORD dwFlags, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, __deref_out IXACT3Wave** ppWave) PURE; + STDMETHOD(Stop)(THIS_ XACTINDEX nWaveIndex, DWORD dwFlags) PURE; + STDMETHOD(GetState)(THIS_ __out DWORD* pdwState) PURE; +}; + +#ifdef __cplusplus + +__inline HRESULT __stdcall IXACT3WaveBank_Destroy(__in IXACT3WaveBank* pWaveBank) +{ + return pWaveBank->Destroy(); +} + +__inline HRESULT __stdcall IXACT3WaveBank_GetNumWaves(__in IXACT3WaveBank* pWaveBank, __out XACTINDEX* pnNumWaves) +{ + return pWaveBank->GetNumWaves(pnNumWaves); +} + +__inline XACTINDEX __stdcall IXACT3WaveBank_GetWaveIndex(__in IXACT3WaveBank* pWaveBank, __in PCSTR szFriendlyName) +{ + return pWaveBank->GetWaveIndex(szFriendlyName); +} + +__inline HRESULT __stdcall IXACT3WaveBank_GetWaveProperties(__in IXACT3WaveBank* pWaveBank, XACTINDEX nWaveIndex, __out LPXACT_WAVE_PROPERTIES pWaveProperties) +{ + return pWaveBank->GetWaveProperties(nWaveIndex, pWaveProperties); +} + +__inline HRESULT __stdcall IXACT3WaveBank_Prepare(__in IXACT3WaveBank* pWaveBank, XACTINDEX nWaveIndex, DWORD dwFlags, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, __deref_out IXACT3Wave** ppWave) +{ + return pWaveBank->Prepare(nWaveIndex, dwFlags, dwPlayOffset, nLoopCount, ppWave); +} + +__inline HRESULT __stdcall IXACT3WaveBank_Play(__in IXACT3WaveBank* pWaveBank, XACTINDEX nWaveIndex, DWORD dwFlags, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, __deref_out IXACT3Wave** ppWave) +{ + return pWaveBank->Play(nWaveIndex, dwFlags, dwPlayOffset, nLoopCount, ppWave); +} + +__inline HRESULT __stdcall IXACT3WaveBank_Stop(__in IXACT3WaveBank* pWaveBank, XACTINDEX nWaveIndex, DWORD dwFlags) +{ + return pWaveBank->Stop(nWaveIndex, dwFlags); +} + +__inline HRESULT __stdcall IXACT3WaveBank_GetState(__in IXACT3WaveBank* pWaveBank, __out DWORD* pdwState) +{ + return pWaveBank->GetState(pdwState); +} + +#else // __cplusplus + +__inline HRESULT __stdcall IXACT3WaveBank_Destroy(__in IXACT3WaveBank* pWaveBank) +{ + return pWaveBank->lpVtbl->Destroy(pWaveBank); +} + +__inline HRESULT __stdcall IXACT3WaveBank_GetNumWaves(__in IXACT3WaveBank* pWaveBank, __out XACTINDEX* pnNumWaves) +{ + return pWaveBank->lpVtbl->GetNumWaves(pWaveBank, pnNumWaves); +} + +__inline XACTINDEX __stdcall IXACT3WaveBank_GetWaveIndex(__in IXACT3WaveBank* pWaveBank, __in PCSTR szFriendlyName) +{ + return pWaveBank->lpVtbl->GetWaveIndex(pWaveBank, szFriendlyName); +} + +__inline HRESULT __stdcall IXACT3WaveBank_GetWaveProperties(__in IXACT3WaveBank* pWaveBank, XACTINDEX nWaveIndex, __out LPXACT_WAVE_PROPERTIES pWaveProperties) +{ + return pWaveBank->lpVtbl->GetWaveProperties(pWaveBank, nWaveIndex, pWaveProperties); +} + +__inline HRESULT __stdcall IXACT3WaveBank_Prepare(__in IXACT3WaveBank* pWaveBank, XACTINDEX nWaveIndex, DWORD dwFlags, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, __deref_out IXACT3Wave** ppWave) +{ + return pWaveBank->lpVtbl->Prepare(pWaveBank, nWaveIndex, dwFlags, dwPlayOffset, nLoopCount, ppWave); +} + +__inline HRESULT __stdcall IXACT3WaveBank_Play(__in IXACT3WaveBank* pWaveBank, XACTINDEX nWaveIndex, DWORD dwFlags, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, __deref_out IXACT3Wave** ppWave) +{ + return pWaveBank->lpVtbl->Play(pWaveBank, nWaveIndex, dwFlags, dwPlayOffset, nLoopCount, ppWave); +} + +__inline HRESULT __stdcall IXACT3WaveBank_Stop(__in IXACT3WaveBank* pWaveBank, XACTINDEX nWaveIndex, DWORD dwFlags) +{ + return pWaveBank->lpVtbl->Stop(pWaveBank, nWaveIndex, dwFlags); +} + +__inline HRESULT __stdcall IXACT3WaveBank_GetState(__in IXACT3WaveBank* pWaveBank, __out DWORD* pdwState) +{ + return pWaveBank->lpVtbl->GetState(pWaveBank, pdwState); +} +#endif // __cplusplus + + +//------------------------------------------------------------------------------ +// IXACT3Wave +//------------------------------------------------------------------------------ + +STDAPI IXACT3Wave_Destroy(__in IXACT3Wave* pWave); +STDAPI IXACT3Wave_Play(__in IXACT3Wave* pWave); +STDAPI IXACT3Wave_Stop(__in IXACT3Wave* pWave, DWORD dwFlags); +STDAPI IXACT3Wave_Pause(__in IXACT3Wave* pWave, BOOL fPause); +STDAPI IXACT3Wave_GetState(__in IXACT3Wave* pWave, __out DWORD* pdwState); +STDAPI IXACT3Wave_SetPitch(__in IXACT3Wave* pWave, XACTPITCH pitch); +STDAPI IXACT3Wave_SetVolume(__in IXACT3Wave* pWave, XACTVOLUME volume); +STDAPI IXACT3Wave_SetMatrixCoefficients(__in IXACT3Wave* pWave, UINT32 uSrcChannelCount, UINT32 uDstChannelCount, __in float* pMatrixCoefficients); +STDAPI IXACT3Wave_GetProperties(__in IXACT3Wave* pWave, __out LPXACT_WAVE_INSTANCE_PROPERTIES pProperties); + +#undef INTERFACE +#define INTERFACE IXACT3Wave + +DECLARE_INTERFACE(IXACT3Wave) +{ + STDMETHOD(Destroy)(THIS) PURE; + STDMETHOD(Play)(THIS) PURE; + STDMETHOD(Stop)(THIS_ DWORD dwFlags) PURE; + STDMETHOD(Pause)(THIS_ BOOL fPause) PURE; + STDMETHOD(GetState)(THIS_ __out DWORD* pdwState) PURE; + STDMETHOD(SetPitch)(THIS_ XACTPITCH pitch) PURE; + STDMETHOD(SetVolume)(THIS_ XACTVOLUME volume) PURE; + STDMETHOD(SetMatrixCoefficients)(THIS_ UINT32 uSrcChannelCount, UINT32 uDstChannelCount, __in float* pMatrixCoefficients) PURE; + STDMETHOD(GetProperties)(THIS_ __out LPXACT_WAVE_INSTANCE_PROPERTIES pProperties) PURE; +}; + +#ifdef __cplusplus + +__inline HRESULT __stdcall IXACT3Wave_Destroy(__in IXACT3Wave* pWave) +{ + return pWave->Destroy(); +} + +__inline HRESULT __stdcall IXACT3Wave_Play(__in IXACT3Wave* pWave) +{ + return pWave->Play(); +} + +__inline HRESULT __stdcall IXACT3Wave_Stop(__in IXACT3Wave* pWave, DWORD dwFlags) +{ + return pWave->Stop(dwFlags); +} + +__inline HRESULT __stdcall IXACT3Wave_Pause(__in IXACT3Wave* pWave, BOOL fPause) +{ + return pWave->Pause(fPause); +} + +__inline HRESULT __stdcall IXACT3Wave_GetState(__in IXACT3Wave* pWave, __out DWORD* pdwState) +{ + return pWave->GetState(pdwState); +} + +__inline HRESULT __stdcall IXACT3Wave_SetPitch(__in IXACT3Wave* pWave, XACTPITCH pitch) +{ + return pWave->SetPitch(pitch); +} + +__inline HRESULT __stdcall IXACT3Wave_SetVolume(__in IXACT3Wave* pWave, XACTVOLUME volume) +{ + return pWave->SetVolume(volume); +} + +__inline HRESULT __stdcall IXACT3Wave_SetMatrixCoefficients(__in IXACT3Wave* pWave, UINT32 uSrcChannelCount, UINT32 uDstChannelCount, __in float* pMatrixCoefficients) +{ + return pWave->SetMatrixCoefficients(uSrcChannelCount, uDstChannelCount, pMatrixCoefficients); +} + +__inline HRESULT __stdcall IXACT3Wave_GetProperties(__in IXACT3Wave* pWave, __out LPXACT_WAVE_INSTANCE_PROPERTIES pProperties) +{ + return pWave->GetProperties(pProperties); +} + +#else // __cplusplus + +__inline HRESULT __stdcall IXACT3Wave_Destroy(__in IXACT3Wave* pWave) +{ + return pWave->lpVtbl->Destroy(pWave); +} + +__inline HRESULT __stdcall IXACT3Wave_Play(__in IXACT3Wave* pWave) +{ + return pWave->lpVtbl->Play(pWave); +} + +__inline HRESULT __stdcall IXACT3Wave_Stop(__in IXACT3Wave* pWave, DWORD dwFlags) +{ + return pWave->lpVtbl->Stop(pWave, dwFlags); +} + +__inline HRESULT __stdcall IXACT3Wave_Pause(__in IXACT3Wave* pWave, BOOL fPause) +{ + return pWave->lpVtbl->Pause(pWave, fPause); +} + +__inline HRESULT __stdcall IXACT3Wave_GetState(__in IXACT3Wave* pWave, __out DWORD* pdwState) +{ + return pWave->lpVtbl->GetState(pWave, pdwState); +} + +__inline HRESULT __stdcall IXACT3Wave_SetPitch(__in IXACT3Wave* pWave, XACTPITCH pitch) +{ + return pWave->lpVtbl->SetPitch(pWave, pitch); +} + +__inline HRESULT __stdcall IXACT3Wave_SetVolume(__in IXACT3Wave* pWave, XACTVOLUME volume) +{ + return pWave->lpVtbl->SetVolume(pWave, volume); +} + +__inline HRESULT __stdcall IXACT3Wave_SetMatrixCoefficients(__in IXACT3Wave* pWave, UINT32 uSrcChannelCount, UINT32 uDstChannelCount, __in float* pMatrixCoefficients) +{ + return pWave->lpVtbl->SetMatrixCoefficients(pWave, uSrcChannelCount, uDstChannelCount, pMatrixCoefficients); +} + +__inline HRESULT __stdcall IXACT3Wave_GetProperties(__in IXACT3Wave* pWave, __out LPXACT_WAVE_INSTANCE_PROPERTIES pProperties) +{ + return pWave->lpVtbl->GetProperties(pWave, pProperties); +} +#endif // __cplusplus + +//------------------------------------------------------------------------------ +// IXACT3Cue +//------------------------------------------------------------------------------ + +// Cue Flags +#define XACT_FLAG_CUE_STOP_RELEASE XACT_FLAG_STOP_RELEASE +#define XACT_FLAG_CUE_STOP_IMMEDIATE XACT_FLAG_STOP_IMMEDIATE + +// Mutually exclusive states +#define XACT_CUESTATE_CREATED XACT_STATE_CREATED // Created, but nothing else +#define XACT_CUESTATE_PREPARING XACT_STATE_PREPARING // In the middle of preparing +#define XACT_CUESTATE_PREPARED XACT_STATE_PREPARED // Prepared, but not yet played +#define XACT_CUESTATE_PLAYING XACT_STATE_PLAYING // Playing (though could be paused) +#define XACT_CUESTATE_STOPPING XACT_STATE_STOPPING // Stopping +#define XACT_CUESTATE_STOPPED XACT_STATE_STOPPED // Stopped +#define XACT_CUESTATE_PAUSED XACT_STATE_PAUSED // Paused (can be combined with other states) + +STDAPI IXACT3Cue_Destroy(__in IXACT3Cue* pCue); +STDAPI IXACT3Cue_Play(__in IXACT3Cue* pCue); +STDAPI IXACT3Cue_Stop(__in IXACT3Cue* pCue, DWORD dwFlags); +STDAPI IXACT3Cue_GetState(__in IXACT3Cue* pCue, __out DWORD* pdwState); +STDAPI IXACT3Cue_SetMatrixCoefficients(__in IXACT3Cue*, UINT32 uSrcChannelCount, UINT32 uDstChannelCount, __in float* pMatrixCoefficients); +STDAPI_(XACTVARIABLEINDEX) IXACT3Cue_GetVariableIndex(__in IXACT3Cue* pCue, __in PCSTR szFriendlyName); +STDAPI IXACT3Cue_SetVariable(__in IXACT3Cue* pCue, XACTVARIABLEINDEX nIndex, XACTVARIABLEVALUE nValue); +STDAPI IXACT3Cue_GetVariable(__in IXACT3Cue* pCue, XACTVARIABLEINDEX nIndex, __out XACTVARIABLEVALUE* nValue); +STDAPI IXACT3Cue_Pause(__in IXACT3Cue* pCue, BOOL fPause); +STDAPI IXACT3Cue_GetProperties(__in IXACT3Cue* pCue, __out LPXACT_CUE_INSTANCE_PROPERTIES* ppProperties); +STDAPI IXACT3Cue_SetOutputVoices(__in IXACT3Cue* pCue, __in_opt const XAUDIO2_VOICE_SENDS* pSendList); +STDAPI IXACT3Cue_SetOutputVoiceMatrix(__in IXACT3Cue* pCue, __in_opt IXAudio2Voice* pDestinationVoice, UINT32 SourceChannels, UINT32 DestinationChannels, __in_ecount(SourceChannels * DestinationChannels) const float* pLevelMatrix); + +#undef INTERFACE +#define INTERFACE IXACT3Cue + +DECLARE_INTERFACE(IXACT3Cue) +{ + STDMETHOD(Play)(THIS) PURE; + STDMETHOD(Stop)(THIS_ DWORD dwFlags) PURE; + STDMETHOD(GetState)(THIS_ __out DWORD* pdwState) PURE; + STDMETHOD(Destroy)(THIS) PURE; + STDMETHOD(SetMatrixCoefficients)(THIS_ UINT32 uSrcChannelCount, UINT32 uDstChannelCount, __in float* pMatrixCoefficients) PURE; + STDMETHOD_(XACTVARIABLEINDEX, GetVariableIndex)(THIS_ __in PCSTR szFriendlyName) PURE; + STDMETHOD(SetVariable)(THIS_ XACTVARIABLEINDEX nIndex, XACTVARIABLEVALUE nValue) PURE; + STDMETHOD(GetVariable)(THIS_ XACTVARIABLEINDEX nIndex, __out XACTVARIABLEVALUE* nValue) PURE; + STDMETHOD(Pause)(THIS_ BOOL fPause) PURE; + STDMETHOD(GetProperties)(THIS_ __out LPXACT_CUE_INSTANCE_PROPERTIES* ppProperties) PURE; + STDMETHOD(SetOutputVoices)(THIS_ __in_opt const XAUDIO2_VOICE_SENDS* pSendList) PURE; + STDMETHOD(SetOutputVoiceMatrix)(THIS_ __in_opt IXAudio2Voice* pDestinationVoice, UINT32 SourceChannels, UINT32 DestinationChannels, __in_ecount(SourceChannels * DestinationChannels) const float* pLevelMatrix) PURE; +}; + +#ifdef __cplusplus + +__inline HRESULT __stdcall IXACT3Cue_Play(__in IXACT3Cue* pCue) +{ + return pCue->Play(); +} + +__inline HRESULT __stdcall IXACT3Cue_Stop(__in IXACT3Cue* pCue, DWORD dwFlags) +{ + return pCue->Stop(dwFlags); +} + +__inline HRESULT __stdcall IXACT3Cue_GetState(__in IXACT3Cue* pCue, __out DWORD* pdwState) +{ + return pCue->GetState(pdwState); +} + +__inline HRESULT __stdcall IXACT3Cue_Destroy(__in IXACT3Cue* pCue) +{ + return pCue->Destroy(); +} + +__inline HRESULT __stdcall IXACT3Cue_SetMatrixCoefficients(__in IXACT3Cue* pCue, UINT32 uSrcChannelCount, UINT32 uDstChannelCount, __in float* pMatrixCoefficients) +{ + return pCue->SetMatrixCoefficients(uSrcChannelCount, uDstChannelCount, pMatrixCoefficients); +} + +__inline XACTVARIABLEINDEX __stdcall IXACT3Cue_GetVariableIndex(__in IXACT3Cue* pCue, __in PCSTR szFriendlyName) +{ + return pCue->GetVariableIndex(szFriendlyName); +} + +__inline HRESULT __stdcall IXACT3Cue_SetVariable(__in IXACT3Cue* pCue, XACTVARIABLEINDEX nIndex, XACTVARIABLEVALUE nValue) +{ + return pCue->SetVariable(nIndex, nValue); +} + +__inline HRESULT __stdcall IXACT3Cue_GetVariable(__in IXACT3Cue* pCue, XACTVARIABLEINDEX nIndex, __out XACTVARIABLEVALUE* pnValue) +{ + return pCue->GetVariable(nIndex, pnValue); +} + +__inline HRESULT __stdcall IXACT3Cue_Pause(__in IXACT3Cue* pCue, BOOL fPause) +{ + return pCue->Pause(fPause); +} + +__inline HRESULT __stdcall IXACT3Cue_GetProperties(__in IXACT3Cue* pCue, __out LPXACT_CUE_INSTANCE_PROPERTIES* ppProperties) +{ + return pCue->GetProperties(ppProperties); +} + +__inline HRESULT __stdcall IXACT3Cue_SetOutputVoices(__in IXACT3Cue* pCue, __in_opt const XAUDIO2_VOICE_SENDS* pSendList) +{ + return pCue->SetOutputVoices(pSendList); +} + +__inline HRESULT __stdcall IXACT3Cue_SetOutputVoiceMatrix(__in IXACT3Cue* pCue, __in_opt IXAudio2Voice* pDestinationVoice, UINT32 SourceChannels, UINT32 DestinationChannels, __in_ecount(SourceChannels * DestinationChannels) const float* pLevelMatrix) +{ + return pCue->SetOutputVoiceMatrix(pDestinationVoice, SourceChannels, DestinationChannels, pLevelMatrix); +} + +#else // __cplusplus + +__inline HRESULT __stdcall IXACT3Cue_Play(__in IXACT3Cue* pCue) +{ + return pCue->lpVtbl->Play(pCue); +} + +__inline HRESULT __stdcall IXACT3Cue_Stop(__in IXACT3Cue* pCue, DWORD dwFlags) +{ + return pCue->lpVtbl->Stop(pCue, dwFlags); +} + +__inline HRESULT __stdcall IXACT3Cue_GetState(__in IXACT3Cue* pCue, __out DWORD* pdwState) +{ + return pCue->lpVtbl->GetState(pCue, pdwState); +} + +__inline HRESULT __stdcall IXACT3Cue_Destroy(__in IXACT3Cue* pCue) +{ + return pCue->lpVtbl->Destroy(pCue); +} + +__inline HRESULT __stdcall IXACT3Cue_SetMatrixCoefficients(__in IXACT3Cue* pCue, UINT32 uSrcChannelCount, UINT32 uDstChannelCount, __in float* pMatrixCoefficients) +{ + return pCue->lpVtbl->SetMatrixCoefficients(pCue, uSrcChannelCount, uDstChannelCount, pMatrixCoefficients); +} + +__inline XACTVARIABLEINDEX __stdcall IXACT3Cue_GetVariableIndex(__in IXACT3Cue* pCue, __in PCSTR szFriendlyName) +{ + return pCue->lpVtbl->GetVariableIndex(pCue, szFriendlyName); +} + +__inline HRESULT __stdcall IXACT3Cue_SetVariable(__in IXACT3Cue* pCue, XACTVARIABLEINDEX nIndex, XACTVARIABLEVALUE nValue) +{ + return pCue->lpVtbl->SetVariable(pCue, nIndex, nValue); +} + +__inline HRESULT __stdcall IXACT3Cue_GetVariable(__in IXACT3Cue* pCue, XACTVARIABLEINDEX nIndex, __out XACTVARIABLEVALUE* pnValue) +{ + return pCue->lpVtbl->GetVariable(pCue, nIndex, pnValue); +} + +__inline HRESULT __stdcall IXACT3Cue_Pause(__in IXACT3Cue* pCue, BOOL fPause) +{ + return pCue->lpVtbl->Pause(pCue, fPause); +} + +__inline HRESULT __stdcall IXACT3Cue_GetProperties(__in IXACT3Cue* pCue, __out LPXACT_CUE_INSTANCE_PROPERTIES* ppProperties) +{ + return pCue->lpVtbl->GetProperties(pCue, ppProperties); +} + +__inline HRESULT __stdcall IXACT3Cue_SetOutputVoices(__in IXACT3Cue* pCue, __in_opt const XAUDIO2_VOICE_SENDS* pSendList) +{ + return pCue->lpVtbl->SetOutputVoices(pSendList); +} + +__inline HRESULT __stdcall IXACT3Cue_SetOutputVoiceMatrix(__in IXACT3Cue* pCue, __in_opt IXAudio2Voice* pDestinationVoice, UINT32 SourceChannels, UINT32 DestinationChannels, __in_ecount(SourceChannels * DestinationChannels) const float* pLevelMatrix) +{ + return pCue->lpVtbl->SetOutputVoiceMatrix(pDestinationVoice, SourceChannels, DestinationChannels, pLevelMatrix); +} + +#endif // __cplusplus + +//------------------------------------------------------------------------------ +// IXACT3Engine +//------------------------------------------------------------------------------ + +// Engine flags +#define XACT_FLAG_ENGINE_CREATE_MANAGEDATA XACT_FLAG_MANAGEDATA +#define XACT_FLAG_ENGINE_STOP_IMMEDIATE XACT_FLAG_STOP_IMMEDIATE + +STDAPI_(ULONG) IXACT3Engine_AddRef(__in IXACT3Engine* pEngine); +STDAPI_(ULONG) IXACT3Engine_Release(__in IXACT3Engine* pEngine); +STDAPI IXACT3Engine_GetRendererCount(__in IXACT3Engine* pEngine, __out XACTINDEX* pnRendererCount); +STDAPI IXACT3Engine_GetRendererDetails(__in IXACT3Engine* pEngine, XACTINDEX nRendererIndex, __out LPXACT_RENDERER_DETAILS pRendererDetails); +STDAPI IXACT3Engine_GetFinalMixFormat(__in IXACT3Engine* pEngine, __out WAVEFORMATEXTENSIBLE* pFinalMixFormat); +STDAPI IXACT3Engine_Initialize(__in IXACT3Engine* pEngine, __in const XACT_RUNTIME_PARAMETERS* pParams); +STDAPI IXACT3Engine_ShutDown(__in IXACT3Engine* pEngine); +STDAPI IXACT3Engine_DoWork(__in IXACT3Engine* pEngine); +STDAPI IXACT3Engine_CreateSoundBank(__in IXACT3Engine* pEngine, __in const void* pvBuffer, DWORD dwSize, DWORD dwFlags, DWORD dwAllocAttributes, __deref_out IXACT3SoundBank** ppSoundBank); +STDAPI IXACT3Engine_CreateInMemoryWaveBank(__in IXACT3Engine* pEngine, __in const void* pvBuffer, DWORD dwSize, DWORD dwFlags, DWORD dwAllocAttributes, __deref_out IXACT3WaveBank** ppWaveBank); +STDAPI IXACT3Engine_CreateStreamingWaveBank(__in IXACT3Engine* pEngine, __in const XACT_WAVEBANK_STREAMING_PARAMETERS* pParms, __deref_out IXACT3WaveBank** ppWaveBank); +STDAPI IXACT3Engine_PrepareWave(__in IXACT3Engine* pEngine, DWORD dwFlags, __in PCSTR szWavePath, WORD wStreamingPacketSize, DWORD dwAlignment, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, __deref_out IXACT3Wave** ppWave); +STDAPI IXACT3Engine_PrepareInMemoryWave(__in IXACT3Engine* pEngine, DWORD dwFlags, WAVEBANKENTRY entry, __in_opt DWORD* pdwSeekTable, __in_opt BYTE* pbWaveData, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, __deref_out IXACT3Wave** ppWave); +STDAPI IXACT3Engine_PrepareStreamingWave(__in IXACT3Engine* pEngine, DWORD dwFlags, WAVEBANKENTRY entry, XACT_STREAMING_PARAMETERS streamingParams, DWORD dwAlignment, __in_opt DWORD* pdwSeekTable, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, __deref_out IXACT3Wave** ppWave); +STDAPI IXACT3Engine_RegisterNotification(__in IXACT3Engine* pEngine, __in const XACT_NOTIFICATION_DESCRIPTION* pNotificationDesc); +STDAPI IXACT3Engine_UnRegisterNotification(__in IXACT3Engine* pEngine, __in const XACT_NOTIFICATION_DESCRIPTION* pNotificationDesc); +STDAPI_(XACTCATEGORY) IXACT3Engine_GetCategory(__in IXACT3Engine* pEngine, __in PCSTR szFriendlyName); +STDAPI IXACT3Engine_Stop(__in IXACT3Engine* pEngine, XACTCATEGORY nCategory, DWORD dwFlags); +STDAPI IXACT3Engine_SetVolume(__in IXACT3Engine* pEngine, XACTCATEGORY nCategory, XACTVOLUME nVolume); +STDAPI IXACT3Engine_Pause(__in IXACT3Engine* pEngine, XACTCATEGORY nCategory, BOOL fPause); +STDAPI_(XACTVARIABLEINDEX) IXACT3Engine_GetGlobalVariableIndex(__in IXACT3Engine* pEngine, __in PCSTR szFriendlyName); +STDAPI IXACT3Engine_SetGlobalVariable(__in IXACT3Engine* pEngine, XACTVARIABLEINDEX nIndex, XACTVARIABLEVALUE nValue); +STDAPI IXACT3Engine_GetGlobalVariable(__in IXACT3Engine* pEngine, XACTVARIABLEINDEX nIndex, __out XACTVARIABLEVALUE* pnValue); + +#undef INTERFACE +#define INTERFACE IXACT3Engine + +#ifdef _XBOX +DECLARE_INTERFACE(IXACT3Engine) +{ +#else +DECLARE_INTERFACE_(IXACT3Engine, IUnknown) +{ + STDMETHOD(QueryInterface)(THIS_ __in REFIID riid, __deref_out void** ppvObj) PURE; +#endif + + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + STDMETHOD_(ULONG, Release)(THIS) PURE; + + STDMETHOD(GetRendererCount)(THIS_ __out XACTINDEX* pnRendererCount) PURE; + STDMETHOD(GetRendererDetails)(THIS_ XACTINDEX nRendererIndex, __out LPXACT_RENDERER_DETAILS pRendererDetails) PURE; + + STDMETHOD(GetFinalMixFormat)(THIS_ __out WAVEFORMATEXTENSIBLE* pFinalMixFormat) PURE; + STDMETHOD(Initialize)(THIS_ __in const XACT_RUNTIME_PARAMETERS* pParams) PURE; + STDMETHOD(ShutDown)(THIS) PURE; + + STDMETHOD(DoWork)(THIS) PURE; + + STDMETHOD(CreateSoundBank)(THIS_ __in const void* pvBuffer, DWORD dwSize, DWORD dwFlags, DWORD dwAllocAttributes, __deref_out IXACT3SoundBank** ppSoundBank) PURE; + STDMETHOD(CreateInMemoryWaveBank)(THIS_ __in const void* pvBuffer, DWORD dwSize, DWORD dwFlags, DWORD dwAllocAttributes, __deref_out IXACT3WaveBank** ppWaveBank) PURE; + STDMETHOD(CreateStreamingWaveBank)(THIS_ __in const XACT_WAVEBANK_STREAMING_PARAMETERS* pParms, __deref_out IXACT3WaveBank** ppWaveBank) PURE; + + STDMETHOD(PrepareWave)(THIS_ DWORD dwFlags, __in PCSTR szWavePath, WORD wStreamingPacketSize, DWORD dwAlignment, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, __deref_out IXACT3Wave** ppWave) PURE; + STDMETHOD(PrepareInMemoryWave)(THIS_ DWORD dwFlags, WAVEBANKENTRY entry, __in_opt DWORD* pdwSeekTable, __in_opt BYTE* pbWaveData, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, __deref_out IXACT3Wave** ppWave) PURE; + STDMETHOD(PrepareStreamingWave)(THIS_ DWORD dwFlags, WAVEBANKENTRY entry, XACT_STREAMING_PARAMETERS streamingParams, DWORD dwAlignment, __in_opt DWORD* pdwSeekTable, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, __deref_out IXACT3Wave** ppWave) PURE; + + STDMETHOD(RegisterNotification)(THIS_ __in const XACT_NOTIFICATION_DESCRIPTION* pNotificationDesc) PURE; + STDMETHOD(UnRegisterNotification)(THIS_ __in const XACT_NOTIFICATION_DESCRIPTION* pNotificationDesc) PURE; + + STDMETHOD_(XACTCATEGORY, GetCategory)(THIS_ __in PCSTR szFriendlyName) PURE; + STDMETHOD(Stop)(THIS_ XACTCATEGORY nCategory, DWORD dwFlags) PURE; + STDMETHOD(SetVolume)(THIS_ XACTCATEGORY nCategory, XACTVOLUME nVolume) PURE; + STDMETHOD(Pause)(THIS_ XACTCATEGORY nCategory, BOOL fPause) PURE; + + STDMETHOD_(XACTVARIABLEINDEX, GetGlobalVariableIndex)(THIS_ __in PCSTR szFriendlyName) PURE; + STDMETHOD(SetGlobalVariable)(THIS_ XACTVARIABLEINDEX nIndex, XACTVARIABLEVALUE nValue) PURE; + STDMETHOD(GetGlobalVariable)(THIS_ XACTVARIABLEINDEX nIndex, __out XACTVARIABLEVALUE* nValue) PURE; +}; + +#ifdef __cplusplus + +__inline ULONG __stdcall IXACT3Engine_AddRef(__in IXACT3Engine* pEngine) +{ + return pEngine->AddRef(); +} + +__inline ULONG __stdcall IXACT3Engine_Release(__in IXACT3Engine* pEngine) +{ + return pEngine->Release(); +} + +__inline HRESULT __stdcall IXACT3Engine_GetRendererCount(__in IXACT3Engine* pEngine, __out XACTINDEX* pnRendererCount) +{ + return pEngine->GetRendererCount(pnRendererCount); +} + +__inline HRESULT __stdcall IXACT3Engine_GetRendererDetails(__in IXACT3Engine* pEngine, XACTINDEX nRendererIndex, __out LPXACT_RENDERER_DETAILS pRendererDetails) +{ + return pEngine->GetRendererDetails(nRendererIndex, pRendererDetails); +} + +__inline HRESULT __stdcall IXACT3Engine_GetFinalMixFormat(__in IXACT3Engine* pEngine, __out WAVEFORMATEXTENSIBLE* pFinalMixFormat) +{ + return pEngine->GetFinalMixFormat(pFinalMixFormat); +} + +__inline HRESULT __stdcall IXACT3Engine_Initialize(__in IXACT3Engine* pEngine, __in const XACT_RUNTIME_PARAMETERS* pParams) +{ + return pEngine->Initialize(pParams); +} + +__inline HRESULT __stdcall IXACT3Engine_ShutDown(__in IXACT3Engine* pEngine) +{ + return pEngine->ShutDown(); +} + +__inline HRESULT __stdcall IXACT3Engine_DoWork(__in IXACT3Engine* pEngine) +{ + return pEngine->DoWork(); +} + +__inline HRESULT __stdcall IXACT3Engine_CreateSoundBank(__in IXACT3Engine* pEngine, __in const void* pvBuffer, DWORD dwSize, DWORD dwFlags, DWORD dwAllocAttributes, __deref_out IXACT3SoundBank** ppSoundBank) +{ + return pEngine->CreateSoundBank(pvBuffer, dwSize, dwFlags, dwAllocAttributes, ppSoundBank); +} + +__inline HRESULT __stdcall IXACT3Engine_CreateInMemoryWaveBank(__in IXACT3Engine* pEngine, __in const void* pvBuffer, DWORD dwSize, DWORD dwFlags, DWORD dwAllocAttributes, __deref_out IXACT3WaveBank** ppWaveBank) +{ + return pEngine->CreateInMemoryWaveBank(pvBuffer, dwSize, dwFlags, dwAllocAttributes, ppWaveBank); +} + +__inline HRESULT __stdcall IXACT3Engine_CreateStreamingWaveBank(__in IXACT3Engine* pEngine, __in const XACT_WAVEBANK_STREAMING_PARAMETERS* pParms, __deref_out IXACT3WaveBank** ppWaveBank) +{ + return pEngine->CreateStreamingWaveBank(pParms, ppWaveBank); +} + +__inline HRESULT __stdcall IXACT3Engine_PrepareWave(__in IXACT3Engine* pEngine, DWORD dwFlags, __in PCSTR szWavePath, WORD wStreamingPacketSize, DWORD dwAlignment, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, __deref_out IXACT3Wave** ppWave) +{ + return pEngine->PrepareWave(dwFlags, szWavePath, wStreamingPacketSize, dwAlignment, dwPlayOffset, nLoopCount, ppWave); +} + +__inline HRESULT __stdcall IXACT3Engine_PrepareInMemoryWave(__in IXACT3Engine* pEngine, DWORD dwFlags, WAVEBANKENTRY entry, __in_opt DWORD* pdwSeekTable, __in_opt BYTE* pbWaveData, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, __deref_out IXACT3Wave** ppWave) +{ + return pEngine->PrepareInMemoryWave(dwFlags, entry, pdwSeekTable, pbWaveData, dwPlayOffset, nLoopCount, ppWave); +} + +__inline HRESULT __stdcall IXACT3Engine_PrepareStreamingWave(__in IXACT3Engine* pEngine, DWORD dwFlags, WAVEBANKENTRY entry, XACT_STREAMING_PARAMETERS streamingParams, DWORD dwAlignment, __in_opt DWORD* pdwSeekTable, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, __deref_out IXACT3Wave** ppWave) +{ + return pEngine->PrepareStreamingWave(dwFlags, entry, streamingParams, dwAlignment, pdwSeekTable, dwPlayOffset, nLoopCount, ppWave); +} + +__inline HRESULT __stdcall IXACT3Engine_RegisterNotification(__in IXACT3Engine* pEngine, __in const XACT_NOTIFICATION_DESCRIPTION* pNotificationDesc) +{ + return pEngine->RegisterNotification(pNotificationDesc); +} + +__inline HRESULT __stdcall IXACT3Engine_UnRegisterNotification(__in IXACT3Engine* pEngine, __in const XACT_NOTIFICATION_DESCRIPTION* pNotificationDesc) +{ + return pEngine->UnRegisterNotification(pNotificationDesc); +} + +__inline XACTCATEGORY __stdcall IXACT3Engine_GetCategory(__in IXACT3Engine* pEngine, __in PCSTR szFriendlyName) +{ + return pEngine->GetCategory(szFriendlyName); +} + +__inline HRESULT __stdcall IXACT3Engine_Stop(__in IXACT3Engine* pEngine, XACTCATEGORY nCategory, DWORD dwFlags) +{ + return pEngine->Stop(nCategory, dwFlags); +} + +__inline HRESULT __stdcall IXACT3Engine_SetVolume(__in IXACT3Engine* pEngine, XACTCATEGORY nCategory, XACTVOLUME nVolume) +{ + return pEngine->SetVolume(nCategory, nVolume); +} + +__inline HRESULT __stdcall IXACT3Engine_Pause(__in IXACT3Engine* pEngine, XACTCATEGORY nCategory, BOOL fPause) +{ + return pEngine->Pause(nCategory, fPause); +} + +__inline XACTVARIABLEINDEX __stdcall IXACT3Engine_GetGlobalVariableIndex(__in IXACT3Engine* pEngine, __in PCSTR szFriendlyName) +{ + return pEngine->GetGlobalVariableIndex(szFriendlyName); +} + +__inline HRESULT __stdcall IXACT3Engine_SetGlobalVariable(__in IXACT3Engine* pEngine, XACTVARIABLEINDEX nIndex, XACTVARIABLEVALUE nValue) +{ + return pEngine->SetGlobalVariable(nIndex, nValue); +} + +__inline HRESULT __stdcall IXACT3Engine_GetGlobalVariable(__in IXACT3Engine* pEngine, XACTVARIABLEINDEX nIndex, __out XACTVARIABLEVALUE* nValue) +{ + return pEngine->GetGlobalVariable(nIndex, nValue); +} + +#else // __cplusplus + +__inline ULONG __stdcall IXACT3Engine_AddRef(__in IXACT3Engine* pEngine) +{ + return pEngine->lpVtbl->AddRef(pEngine); +} + +__inline ULONG __stdcall IXACT3Engine_Release(__in IXACT3Engine* pEngine) +{ + return pEngine->lpVtbl->Release(pEngine); +} + +__inline HRESULT __stdcall IXACT3Engine_GetRendererCount(__in IXACT3Engine* pEngine, __out XACTINDEX* pnRendererCount) +{ + return pEngine->lpVtbl->GetRendererCount(pEngine, pnRendererCount); +} + +__inline HRESULT __stdcall IXACT3Engine_GetRendererDetails(__in IXACT3Engine* pEngine, XACTINDEX nRendererIndex, __out LPXACT_RENDERER_DETAILS pRendererDetails) +{ + return pEngine->lpVtbl->GetRendererDetails(pEngine, nRendererIndex, pRendererDetails); +} + +__inline HRESULT __stdcall IXACT3Engine_GetFinalMixFormat(__in IXACT3Engine* pEngine, __out WAVEFORMATEXTENSIBLE* pFinalMixFormat) +{ + return pEngine->lpVtbl->GetFinalMixFormat(pEngine, pFinalMixFormat); +} + +__inline HRESULT __stdcall IXACT3Engine_Initialize(__in IXACT3Engine* pEngine, __in const XACT_RUNTIME_PARAMETERS* pParams) +{ + return pEngine->lpVtbl->Initialize(pEngine, pParams); +} + +__inline HRESULT __stdcall IXACT3Engine_ShutDown(__in IXACT3Engine* pEngine) +{ + return pEngine->lpVtbl->ShutDown(pEngine); +} + +__inline HRESULT __stdcall IXACT3Engine_DoWork(__in IXACT3Engine* pEngine) +{ + return pEngine->lpVtbl->DoWork(pEngine); +} + +__inline HRESULT __stdcall IXACT3Engine_CreateSoundBank(__in IXACT3Engine* pEngine, __in const void* pvBuffer, DWORD dwSize, DWORD dwFlags, DWORD dwAllocAttributes, __deref_out IXACT3SoundBank** ppSoundBank) +{ + return pEngine->lpVtbl->CreateSoundBank(pEngine, pvBuffer, dwSize, dwFlags, dwAllocAttributes, ppSoundBank); +} + +__inline HRESULT __stdcall IXACT3Engine_CreateInMemoryWaveBank(__in IXACT3Engine* pEngine, __in const void* pvBuffer, DWORD dwSize, DWORD dwFlags, DWORD dwAllocAttributes, __deref_out IXACT3WaveBank** ppWaveBank) +{ + return pEngine->lpVtbl->CreateInMemoryWaveBank(pEngine, pvBuffer, dwSize, dwFlags, dwAllocAttributes, ppWaveBank); +} + +__inline HRESULT __stdcall IXACT3Engine_CreateStreamingWaveBank(__in IXACT3Engine* pEngine, __in const XACT_WAVEBANK_STREAMING_PARAMETERS* pParms, __deref_out IXACT3WaveBank** ppWaveBank) +{ + return pEngine->lpVtbl->CreateStreamingWaveBank(pEngine, pParms, ppWaveBank); +} + +__inline HRESULT __stdcall IXACT3Engine_PrepareWave(__in IXACT3Engine* pEngine, DWORD dwFlags, __in PCSTR szWavePath, WORD wStreamingPacketSize, DWORD dwAlignment, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, __deref_out IXACT3Wave** ppWave) +{ + return pEngine->lpVtbl->PrepareWave(pEngine, dwFlags, szWavePath, wStreamingPacketSize, dwAlignment, dwPlayOffset, nLoopCount, ppWave); +} + +__inline HRESULT __stdcall IXACT3Engine_PrepareInMemoryWave(__in IXACT3Engine* pEngine, DWORD dwFlags, WAVEBANKENTRY entry, __in_opt DWORD* pdwSeekTable, __in_opt BYTE* pbWaveData, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, __deref_out IXACT3Wave** ppWave) +{ + return pEngine->lpVtbl->PrepareInMemoryWave(pEngine, dwFlags, entry, pdwSeekTable, pbWaveData, dwPlayOffset, nLoopCount, ppWave); +} + +__inline HRESULT __stdcall IXACT3Engine_PrepareStreamingWave(__in IXACT3Engine* pEngine, DWORD dwFlags, WAVEBANKENTRY entry, XACT_STREAMING_PARAMETERS streamingParams, DWORD dwAlignment, __in_opt DWORD* pdwSeekTable, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount, __deref_out IXACT3Wave** ppWave) +{ + return pEngine->lpVtbl->PrepareStreamingWave(pEngine, dwFlags, entry, streamingParams, dwAlignment, pdwSeekTable, dwPlayOffset, nLoopCount, ppWave); +} + + +__inline HRESULT __stdcall IXACT3Engine_RegisterNotification(__in IXACT3Engine* pEngine, __in const XACT_NOTIFICATION_DESCRIPTION* pNotificationDesc) +{ + return pEngine->lpVtbl->RegisterNotification(pEngine, pNotificationDesc); +} + +__inline HRESULT __stdcall IXACT3Engine_UnRegisterNotification(__in IXACT3Engine* pEngine, __in const XACT_NOTIFICATION_DESCRIPTION* pNotificationDesc) +{ + return pEngine->lpVtbl->UnRegisterNotification(pEngine, pNotificationDesc); +} + +__inline XACTCATEGORY __stdcall IXACT3Engine_GetCategory(__in IXACT3Engine* pEngine, __in PCSTR szFriendlyName) +{ + return pEngine->lpVtbl->GetCategory(pEngine, szFriendlyName); +} + +__inline HRESULT __stdcall IXACT3Engine_Stop(__in IXACT3Engine* pEngine, XACTCATEGORY nCategory, DWORD dwFlags) +{ + return pEngine->lpVtbl->Stop(pEngine, nCategory, dwFlags); +} + +__inline HRESULT __stdcall IXACT3Engine_SetVolume(__in IXACT3Engine* pEngine, XACTCATEGORY nCategory, XACTVOLUME nVolume) +{ + return pEngine->lpVtbl->SetVolume(pEngine, nCategory, nVolume); +} + +__inline HRESULT __stdcall IXACT3Engine_Pause(__in IXACT3Engine* pEngine, XACTCATEGORY nCategory, BOOL fPause) +{ + return pEngine->lpVtbl->Pause(pEngine, nCategory, fPause); +} + +__inline XACTVARIABLEINDEX __stdcall IXACT3Engine_GetGlobalVariableIndex(__in IXACT3Engine* pEngine, __in PCSTR szFriendlyName) +{ + return pEngine->lpVtbl->GetGlobalVariableIndex(pEngine, szFriendlyName); +} + +__inline HRESULT __stdcall IXACT3Engine_SetGlobalVariable(__in IXACT3Engine* pEngine, XACTVARIABLEINDEX nIndex, XACTVARIABLEVALUE nValue) +{ + return pEngine->lpVtbl->SetGlobalVariable(pEngine, nIndex, nValue); +} + +__inline HRESULT __stdcall IXACT3Engine_GetGlobalVariable(__in IXACT3Engine* pEngine, XACTVARIABLEINDEX nIndex, __out XACTVARIABLEVALUE* nValue) +{ + return pEngine->lpVtbl->GetGlobalVariable(pEngine, nIndex, nValue); +} + +#endif // __cplusplus + +//------------------------------------------------------------------------------ +// Create Engine +//------------------------------------------------------------------------------ + +// Flags used only in XACT3CreateEngine below. These flags are valid but ignored +// when building for Xbox 360; to enable auditioning on that platform you must +// link explicitly to an auditioning version of the XACT static library. +static const DWORD XACT_FLAG_API_AUDITION_MODE = 0x00000001; +static const DWORD XACT_FLAG_API_DEBUG_MODE = 0x00000002; + +#ifdef _XBOX + +STDAPI XACT3CreateEngine(DWORD dwCreationFlags, __deref_out IXACT3Engine** ppEngine); + +#else // #ifdef _XBOX + +#define XACT_DEBUGENGINE_REGISTRY_KEY TEXT("Software\\Microsoft\\XACT") +#define XACT_DEBUGENGINE_REGISTRY_VALUE TEXT("DebugEngine") + + +#ifdef __cplusplus + +__inline HRESULT __stdcall XACT3CreateEngine(DWORD dwCreationFlags, __deref_out IXACT3Engine** ppEngine) +{ + HRESULT hr; + HKEY key; + DWORD data; + DWORD type = REG_DWORD; + DWORD dataSize = sizeof(DWORD); + BOOL debug = (dwCreationFlags & XACT_FLAG_API_DEBUG_MODE) ? TRUE : FALSE; + BOOL audition = (dwCreationFlags & XACT_FLAG_API_AUDITION_MODE) ? TRUE : FALSE; + + // If neither the debug nor audition flags are set, see if the debug registry key is set + if(!debug && !audition && + (RegOpenKeyEx(HKEY_LOCAL_MACHINE, XACT_DEBUGENGINE_REGISTRY_KEY, 0, KEY_READ, &key) == ERROR_SUCCESS)) + { + if(RegQueryValueEx(key, XACT_DEBUGENGINE_REGISTRY_VALUE, NULL, &type, (LPBYTE)&data, &dataSize) == ERROR_SUCCESS) + { + if(data) + { + debug = TRUE; + } + } + RegCloseKey(key); + } + + // Priority order: Audition, Debug, Retail + hr = CoCreateInstance(audition ? __uuidof(XACTAuditionEngine) + : (debug ? __uuidof(XACTDebugEngine) : __uuidof(XACTEngine)), + NULL, CLSCTX_INPROC_SERVER, __uuidof(IXACT3Engine), (void**)ppEngine); + + // If debug engine does not exist fallback to retail version + if(FAILED(hr) && debug && !audition) + { + hr = CoCreateInstance(__uuidof(XACTEngine), NULL, CLSCTX_INPROC_SERVER, __uuidof(IXACT3Engine), (void**)ppEngine); + } + + return hr; +} + +#else // #ifdef __cplusplus + +__inline HRESULT __stdcall XACT3CreateEngine(DWORD dwCreationFlags, __deref_out IXACT3Engine** ppEngine) +{ + HRESULT hr; + HKEY key; + DWORD data; + DWORD type = REG_DWORD; + DWORD dataSize = sizeof(DWORD); + BOOL debug = (dwCreationFlags & XACT_FLAG_API_DEBUG_MODE) ? TRUE : FALSE; + BOOL audition = (dwCreationFlags & XACT_FLAG_API_AUDITION_MODE) ? TRUE : FALSE; + + // If neither the debug nor audition flags are set, see if the debug registry key is set + if(!debug && !audition && + (RegOpenKeyEx(HKEY_LOCAL_MACHINE, XACT_DEBUGENGINE_REGISTRY_KEY, 0, KEY_READ, &key) == ERROR_SUCCESS)) + { + if(RegQueryValueEx(key, XACT_DEBUGENGINE_REGISTRY_VALUE, NULL, &type, (LPBYTE)&data, &dataSize) == ERROR_SUCCESS) + { + if(data) + { + debug = TRUE; + } + } + RegCloseKey(key); + } + + // Priority order: Audition, Debug, Retail + hr = CoCreateInstance(audition ? &CLSID_XACTAuditionEngine + : (debug ? &CLSID_XACTDebugEngine : &CLSID_XACTEngine), + NULL, CLSCTX_INPROC_SERVER, &IID_IXACT3Engine, (void**)ppEngine); + + // If debug engine does not exist fallback to retail version + if(FAILED(hr) && debug && !audition) + { + hr = CoCreateInstance(&CLSID_XACTEngine, NULL, CLSCTX_INPROC_SERVER, &IID_IXACT3Engine, (void**)ppEngine); + } + + return hr; +} + +#endif // #ifdef __cplusplus + +#endif // #ifdef _XBOX + +//------------------------------------------------------------------------------ +// XACT specific error codes +//------------------------------------------------------------------------------ + +#define FACILITY_XACTENGINE 0xAC7 +#define XACTENGINEERROR(n) MAKE_HRESULT(SEVERITY_ERROR, FACILITY_XACTENGINE, n) + +#define XACTENGINE_E_OUTOFMEMORY E_OUTOFMEMORY // Out of memory +#define XACTENGINE_E_INVALIDARG E_INVALIDARG // Invalid arg +#define XACTENGINE_E_NOTIMPL E_NOTIMPL // Not implemented +#define XACTENGINE_E_FAIL E_FAIL // Unknown error + +#define XACTENGINE_E_ALREADYINITIALIZED XACTENGINEERROR(0x001) // The engine is already initialized +#define XACTENGINE_E_NOTINITIALIZED XACTENGINEERROR(0x002) // The engine has not been initialized +#define XACTENGINE_E_EXPIRED XACTENGINEERROR(0x003) // The engine has expired (demo or pre-release version) +#define XACTENGINE_E_NONOTIFICATIONCALLBACK XACTENGINEERROR(0x004) // No notification callback +#define XACTENGINE_E_NOTIFICATIONREGISTERED XACTENGINEERROR(0x005) // Notification already registered +#define XACTENGINE_E_INVALIDUSAGE XACTENGINEERROR(0x006) // Invalid usage +#define XACTENGINE_E_INVALIDDATA XACTENGINEERROR(0x007) // Invalid data +#define XACTENGINE_E_INSTANCELIMITFAILTOPLAY XACTENGINEERROR(0x008) // Fail to play due to instance limit +#define XACTENGINE_E_NOGLOBALSETTINGS XACTENGINEERROR(0x009) // Global Settings not loaded +#define XACTENGINE_E_INVALIDVARIABLEINDEX XACTENGINEERROR(0x00a) // Invalid variable index +#define XACTENGINE_E_INVALIDCATEGORY XACTENGINEERROR(0x00b) // Invalid category +#define XACTENGINE_E_INVALIDCUEINDEX XACTENGINEERROR(0x00c) // Invalid cue index +#define XACTENGINE_E_INVALIDWAVEINDEX XACTENGINEERROR(0x00d) // Invalid wave index +#define XACTENGINE_E_INVALIDTRACKINDEX XACTENGINEERROR(0x00e) // Invalid track index +#define XACTENGINE_E_INVALIDSOUNDOFFSETORINDEX XACTENGINEERROR(0x00f) // Invalid sound offset or index +#define XACTENGINE_E_READFILE XACTENGINEERROR(0x010) // Error reading a file +#define XACTENGINE_E_UNKNOWNEVENT XACTENGINEERROR(0x011) // Unknown event type +#define XACTENGINE_E_INCALLBACK XACTENGINEERROR(0x012) // Invalid call of method of function from callback +#define XACTENGINE_E_NOWAVEBANK XACTENGINEERROR(0x013) // No wavebank exists for desired operation +#define XACTENGINE_E_SELECTVARIATION XACTENGINEERROR(0x014) // Unable to select a variation +#define XACTENGINE_E_MULTIPLEAUDITIONENGINES XACTENGINEERROR(0x015) // There can be only one audition engine +#define XACTENGINE_E_WAVEBANKNOTPREPARED XACTENGINEERROR(0x016) // The wavebank is not prepared +#define XACTENGINE_E_NORENDERER XACTENGINEERROR(0x017) // No audio device found on. +#define XACTENGINE_E_INVALIDENTRYCOUNT XACTENGINEERROR(0x018) // Invalid entry count for channel maps +#define XACTENGINE_E_SEEKTIMEBEYONDCUEEND XACTENGINEERROR(0x019) // Time offset for seeking is beyond the cue end. +#define XACTENGINE_E_SEEKTIMEBEYONDWAVEEND XACTENGINEERROR(0x01a) // Time offset for seeking is beyond the wave end. +#define XACTENGINE_E_NOFRIENDLYNAMES XACTENGINEERROR(0x01b) // Friendly names are not included in the bank. + +#define XACTENGINE_E_AUDITION_WRITEFILE XACTENGINEERROR(0x101) // Error writing a file during auditioning +#define XACTENGINE_E_AUDITION_NOSOUNDBANK XACTENGINEERROR(0x102) // Missing a soundbank +#define XACTENGINE_E_AUDITION_INVALIDRPCINDEX XACTENGINEERROR(0x103) // Missing an RPC curve +#define XACTENGINE_E_AUDITION_MISSINGDATA XACTENGINEERROR(0x104) // Missing data for an audition command +#define XACTENGINE_E_AUDITION_UNKNOWNCOMMAND XACTENGINEERROR(0x105) // Unknown command +#define XACTENGINE_E_AUDITION_INVALIDDSPINDEX XACTENGINEERROR(0x106) // Missing a DSP parameter +#define XACTENGINE_E_AUDITION_MISSINGWAVE XACTENGINEERROR(0x107) // Wave does not exist in auditioned wavebank +#define XACTENGINE_E_AUDITION_CREATEDIRECTORYFAILED XACTENGINEERROR(0x108) // Failed to create a directory for streaming wavebank data +#define XACTENGINE_E_AUDITION_INVALIDSESSION XACTENGINEERROR(0x109) // Invalid audition session + +#endif // #ifndef GUID_DEFS_ONLY + +#endif // #ifndef _XACT3_H_ diff --git a/MediaClient/MediaClient/directx/include/xact3d3.h b/MediaClient/MediaClient/directx/include/xact3d3.h new file mode 100644 index 0000000..f17e1e5 --- /dev/null +++ b/MediaClient/MediaClient/directx/include/xact3d3.h @@ -0,0 +1,275 @@ +/*-========================================================================-_ + | - XACT3D3 - | + | Copyright (c) Microsoft Corporation. All rights reserved. | + |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| + |VERSION: 0.1 MODEL: Unmanaged User-mode | + |CONTRACT: N / A EXCEPT: No Exceptions | + |PARENT: N / A MINREQ: Win2000, Xbox360 | + |PROJECT: XACT3D DIALECT: MS Visual C++ 7.0 | + |>------------------------------------------------------------------------<| + | DUTY: XACT 3D support | + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ + NOTES: + 1. See X3DAudio.h for information regarding X3DAudio types. */ + + +#ifndef __XACT3D3_H__ +#define __XACT3D3_H__ + +//---------------------------------------------------// + #include + #include + + #pragma warning(push) + #pragma warning(disable: 4701) // disable "local variable may be used without having been initialized" compile warning + + // Supported speaker positions, represented as azimuth angles. + // + // Here's a picture of the azimuth angles for the 8 cardinal points, + // seen from above. The emitter's base position is at the origin 0. + // + // FRONT + // | 0 <-- azimuth + // | + // 7pi/4 \ | / pi/4 + // \ | / + // LEFT \|/ RIGHT + // 3pi/2-------0-------pi/2 + // /|\ + // / | \ + // 5pi/4 / | \ 3pi/4 + // | + // | pi + // BACK + // + #define LEFT_AZIMUTH (3*X3DAUDIO_PI/2) + #define RIGHT_AZIMUTH (X3DAUDIO_PI/2) + #define FRONT_LEFT_AZIMUTH (7*X3DAUDIO_PI/4) + #define FRONT_RIGHT_AZIMUTH (X3DAUDIO_PI/4) + #define FRONT_CENTER_AZIMUTH 0.0f + #define LOW_FREQUENCY_AZIMUTH X3DAUDIO_2PI + #define BACK_LEFT_AZIMUTH (5*X3DAUDIO_PI/4) + #define BACK_RIGHT_AZIMUTH (3*X3DAUDIO_PI/4) + #define BACK_CENTER_AZIMUTH X3DAUDIO_PI + #define FRONT_LEFT_OF_CENTER_AZIMUTH (15*X3DAUDIO_PI/8) + #define FRONT_RIGHT_OF_CENTER_AZIMUTH (X3DAUDIO_PI/8) + + +//-----------------------------------------------------// + // Supported emitter channel layouts: + static const float aStereoLayout[] = + { + LEFT_AZIMUTH, + RIGHT_AZIMUTH + }; + static const float a2Point1Layout[] = + { + LEFT_AZIMUTH, + RIGHT_AZIMUTH, + LOW_FREQUENCY_AZIMUTH + }; + static const float aQuadLayout[] = + { + FRONT_LEFT_AZIMUTH, + FRONT_RIGHT_AZIMUTH, + BACK_LEFT_AZIMUTH, + BACK_RIGHT_AZIMUTH + }; + static const float a4Point1Layout[] = + { + FRONT_LEFT_AZIMUTH, + FRONT_RIGHT_AZIMUTH, + LOW_FREQUENCY_AZIMUTH, + BACK_LEFT_AZIMUTH, + BACK_RIGHT_AZIMUTH + }; + static const float a5Point1Layout[] = + { + FRONT_LEFT_AZIMUTH, + FRONT_RIGHT_AZIMUTH, + FRONT_CENTER_AZIMUTH, + LOW_FREQUENCY_AZIMUTH, + BACK_LEFT_AZIMUTH, + BACK_RIGHT_AZIMUTH + }; + static const float a7Point1Layout[] = + { + FRONT_LEFT_AZIMUTH, + FRONT_RIGHT_AZIMUTH, + FRONT_CENTER_AZIMUTH, + LOW_FREQUENCY_AZIMUTH, + BACK_LEFT_AZIMUTH, + BACK_RIGHT_AZIMUTH, + LEFT_AZIMUTH, + RIGHT_AZIMUTH + }; + + +//-------------------------------------------------------// + //// + // DESCRIPTION: + // Initializes the 3D API's: + // + // REMARKS: + // This method only needs to be called once. + // X3DAudio will be initialized such that its speaker channel mask + // matches the format of the given XACT engine's final mix. + // + // PARAMETERS: + // pEngine - [in] XACT engine + // X3DInstance - [out] X3DAudio instance handle + // + // RETURN VALUE: + // HResult error code + //// + EXTERN_C HRESULT inline XACT3DInitialize (__in IXACT3Engine* pEngine, __in X3DAUDIO_HANDLE X3DInstance) + { + HRESULT hr = S_OK; + if (pEngine == NULL) { + hr = E_POINTER; + } + + XACTVARIABLEVALUE nSpeedOfSound; + if (SUCCEEDED(hr)) { + XACTVARIABLEINDEX xactSpeedOfSoundID = pEngine->GetGlobalVariableIndex("SpeedOfSound"); + hr = pEngine->GetGlobalVariable(xactSpeedOfSoundID, &nSpeedOfSound); + } + + if (SUCCEEDED(hr)) { + WAVEFORMATEXTENSIBLE wfxFinalMixFormat; + hr = pEngine->GetFinalMixFormat(&wfxFinalMixFormat); + if (SUCCEEDED(hr)) { + X3DAudioInitialize(wfxFinalMixFormat.dwChannelMask, nSpeedOfSound, X3DInstance); + } + } + return hr; + } + + + //// + // DESCRIPTION: + // Calculates DSP settings with respect to 3D parameters: + // + // REMARKS: + // Note the following flags are always specified for XACT3D calculation: + // X3DAUDIO_CALCULATE_MATRIX | X3DAUDIO_CALCULATE_DOPPLER | X3DAUDIO_CALCULATE_EMITTER_ANGLE + // + // This means the caller must set at least the following fields: + // X3DAUDIO_LISTENER.OrientFront + // X3DAUDIO_LISTENER.OrientTop + // X3DAUDIO_LISTENER.Position + // X3DAUDIO_LISTENER.Velocity + // + // X3DAUDIO_EMITTER.OrientFront + // X3DAUDIO_EMITTER.OrientTop, if emitter is multi-channel + // X3DAUDIO_EMITTER.Position + // X3DAUDIO_EMITTER.Velocity + // X3DAUDIO_EMITTER.InnerRadius + // X3DAUDIO_EMITTER.InnerRadiusAngle + // X3DAUDIO_EMITTER.ChannelCount + // X3DAUDIO_EMITTER.CurveDistanceScaler + // X3DAUDIO_EMITTER.DopplerScaler + // + // X3DAUDIO_DSP_SETTINGS.pMatrixCoefficients, the caller need only allocate space for SrcChannelCount*DstChannelCount elements + // X3DAUDIO_DSP_SETTINGS.SrcChannelCount + // X3DAUDIO_DSP_SETTINGS.DstChannelCount + // + // If X3DAUDIO_EMITTER.pChannelAzimuths is left NULL for multi-channel emitters, + // a default channel radius and channel azimuth array will be applied below. + // Distance curves such as X3DAUDIO_EMITTER.pVolumeCurve should be + // left NULL as XACT's native RPCs will be used to define DSP behaviour + // with respect to normalized distance. + // + // See X3DAudio.h for information regarding X3DAudio types. + // + // PARAMETERS: + // X3DInstance - [in] X3DAudio instance handle, returned from XACT3DInitialize() + // pListener - [in] point of 3D audio reception + // pEmitter - [in] 3D audio source + // pDSPSettings - [out] receives calculation results, applied to an XACT cue via XACT3DApply() + // + // RETURN VALUE: + // HResult error code + //// + EXTERN_C HRESULT inline XACT3DCalculate (__in X3DAUDIO_HANDLE X3DInstance, __in const X3DAUDIO_LISTENER* pListener, __inout X3DAUDIO_EMITTER* pEmitter, __inout X3DAUDIO_DSP_SETTINGS* pDSPSettings) + { + HRESULT hr = S_OK; + if (pListener == NULL || pEmitter == NULL || pDSPSettings == NULL) { + hr = E_POINTER; + } + + if (SUCCEEDED(hr)) { + if (pEmitter->ChannelCount > 1 && pEmitter->pChannelAzimuths == NULL) { + pEmitter->ChannelRadius = 1.0f; + + switch (pEmitter->ChannelCount) { + case 2: pEmitter->pChannelAzimuths = (float*)&aStereoLayout[0]; break; + case 3: pEmitter->pChannelAzimuths = (float*)&a2Point1Layout[0]; break; + case 4: pEmitter->pChannelAzimuths = (float*)&aQuadLayout[0]; break; + case 5: pEmitter->pChannelAzimuths = (float*)&a4Point1Layout[0]; break; + case 6: pEmitter->pChannelAzimuths = (float*)&a5Point1Layout[0]; break; + case 8: pEmitter->pChannelAzimuths = (float*)&a7Point1Layout[0]; break; + default: hr = E_FAIL; break; + } + } + } + + if (SUCCEEDED(hr)) { + static X3DAUDIO_DISTANCE_CURVE_POINT DefaultCurvePoints[2] = { 0.0f, 1.0f, 1.0f, 1.0f }; + static X3DAUDIO_DISTANCE_CURVE DefaultCurve = { (X3DAUDIO_DISTANCE_CURVE_POINT*)&DefaultCurvePoints[0], 2 }; + if (pEmitter->pVolumeCurve == NULL) { + pEmitter->pVolumeCurve = &DefaultCurve; + } + if (pEmitter->pLFECurve == NULL) { + pEmitter->pLFECurve = &DefaultCurve; + } + + X3DAudioCalculate(X3DInstance, pListener, pEmitter, (X3DAUDIO_CALCULATE_MATRIX | X3DAUDIO_CALCULATE_DOPPLER | X3DAUDIO_CALCULATE_EMITTER_ANGLE), pDSPSettings); + } + + return hr; + } + + + //// + // DESCRIPTION: + // Applies results from a call to XACT3DCalculate() to a cue. + // + // PARAMETERS: + // pDSPSettings - [in] calculation results generated by XACT3DCalculate() + // pCue - [in] cue to which to apply pDSPSettings + // + // RETURN VALUE: + // HResult error code + //// + EXTERN_C HRESULT inline XACT3DApply (__in const X3DAUDIO_DSP_SETTINGS* pDSPSettings, __in IXACT3Cue* pCue) + { + HRESULT hr = S_OK; + if (pDSPSettings == NULL || pCue == NULL) { + hr = E_POINTER; + } + + if (SUCCEEDED(hr)) { + hr = pCue->SetMatrixCoefficients(pDSPSettings->SrcChannelCount, pDSPSettings->DstChannelCount, pDSPSettings->pMatrixCoefficients); + } + if (SUCCEEDED(hr)) { + XACTVARIABLEINDEX xactDistanceID = pCue->GetVariableIndex("Distance"); + hr = pCue->SetVariable(xactDistanceID, pDSPSettings->EmitterToListenerDistance); + } + if (SUCCEEDED(hr)) { + XACTVARIABLEINDEX xactDopplerID = pCue->GetVariableIndex("DopplerPitchScalar"); + hr = pCue->SetVariable(xactDopplerID, pDSPSettings->DopplerFactor); + } + if (SUCCEEDED(hr)) { + XACTVARIABLEINDEX xactOrientationID = pCue->GetVariableIndex("OrientationAngle"); + hr = pCue->SetVariable(xactOrientationID, pDSPSettings->EmitterToListenerAngle * (180.0f / X3DAUDIO_PI)); + } + + return hr; + } + + + #pragma warning(pop) + +#endif // __XACT3D3_H__ +//---------------------------------<-EOF->----------------------------------// diff --git a/MediaClient/MediaClient/directx/include/xact3wb.h b/MediaClient/MediaClient/directx/include/xact3wb.h new file mode 100644 index 0000000..521667b --- /dev/null +++ b/MediaClient/MediaClient/directx/include/xact3wb.h @@ -0,0 +1,598 @@ +/*************************************************************************** + * + * Copyright (c) Microsoft Corporation. All rights reserved. + * + * File: xact3wb.h + * Content: XACT 3 wave bank definitions. + * + ****************************************************************************/ + +#ifndef __XACT3WB_H__ +#define __XACT3WB_H__ + +#ifdef _XBOX +# include +#else +# include +#endif + +#include +#include + +#pragma warning(push) +#pragma warning(disable:4201) +#pragma warning(disable:4214) // nonstandard extension used : bit field types other than int + +#pragma pack(push, 1) +#if !defined(_X86_) + #define XACTUNALIGNED __unaligned +#else + #define XACTUNALIGNED +#endif + +#ifdef _M_PPCBE +#pragma bitfield_order(push, lsb_to_msb) +#endif + +#define WAVEBANK_HEADER_SIGNATURE 'DNBW' // WaveBank RIFF chunk signature +#define WAVEBANK_HEADER_VERSION 44 // Current wavebank file version + +#define WAVEBANK_BANKNAME_LENGTH 64 // Wave bank friendly name length, in characters +#define WAVEBANK_ENTRYNAME_LENGTH 64 // Wave bank entry friendly name length, in characters + +#define WAVEBANK_MAX_DATA_SEGMENT_SIZE 0xFFFFFFFF // Maximum wave bank data segment size, in bytes +#define WAVEBANK_MAX_COMPACT_DATA_SEGMENT_SIZE 0x001FFFFF // Maximum compact wave bank data segment size, in bytes + +typedef DWORD WAVEBANKOFFSET; + +// +// Bank flags +// + +#define WAVEBANK_TYPE_BUFFER 0x00000000 // In-memory buffer +#define WAVEBANK_TYPE_STREAMING 0x00000001 // Streaming +#define WAVEBANK_TYPE_MASK 0x00000001 + +#define WAVEBANK_FLAGS_ENTRYNAMES 0x00010000 // Bank includes entry names +#define WAVEBANK_FLAGS_COMPACT 0x00020000 // Bank uses compact format +#define WAVEBANK_FLAGS_SYNC_DISABLED 0x00040000 // Bank is disabled for audition sync +#define WAVEBANK_FLAGS_SEEKTABLES 0x00080000 // Bank includes seek tables. +#define WAVEBANK_FLAGS_MASK 0x000F0000 + +// +// Entry flags +// + +#define WAVEBANKENTRY_FLAGS_READAHEAD 0x00000001 // Enable stream read-ahead +#define WAVEBANKENTRY_FLAGS_LOOPCACHE 0x00000002 // One or more looping sounds use this wave +#define WAVEBANKENTRY_FLAGS_REMOVELOOPTAIL 0x00000004 // Remove data after the end of the loop region +#define WAVEBANKENTRY_FLAGS_IGNORELOOP 0x00000008 // Used internally when the loop region can't be used +#define WAVEBANKENTRY_FLAGS_MASK 0x00000008 + +// +// Entry wave format identifiers +// + +#define WAVEBANKMINIFORMAT_TAG_PCM 0x0 // PCM data +#define WAVEBANKMINIFORMAT_TAG_XMA 0x1 // XMA data +#define WAVEBANKMINIFORMAT_TAG_ADPCM 0x2 // ADPCM data +#define WAVEBANKMINIFORMAT_TAG_WMA 0x3 // WMA data + +#define WAVEBANKMINIFORMAT_BITDEPTH_8 0x0 // 8-bit data (PCM only) +#define WAVEBANKMINIFORMAT_BITDEPTH_16 0x1 // 16-bit data (PCM only) + +// +// Arbitrary fixed sizes +// +#define WAVEBANKENTRY_XMASTREAMS_MAX 3 // enough for 5.1 channel audio +#define WAVEBANKENTRY_XMACHANNELS_MAX 6 // enough for 5.1 channel audio (cf. XAUDIOCHANNEL_SOURCEMAX) + +// +// DVD data sizes +// + +#define WAVEBANK_DVD_SECTOR_SIZE 2048 +#define WAVEBANK_DVD_BLOCK_SIZE (WAVEBANK_DVD_SECTOR_SIZE * 16) + +// +// Bank alignment presets +// + +#define WAVEBANK_ALIGNMENT_MIN 4 // Minimum alignment +#define WAVEBANK_ALIGNMENT_DVD WAVEBANK_DVD_SECTOR_SIZE // DVD-optimized alignment + +// +// Wave bank segment identifiers +// + +typedef enum WAVEBANKSEGIDX +{ + WAVEBANK_SEGIDX_BANKDATA = 0, // Bank data + WAVEBANK_SEGIDX_ENTRYMETADATA, // Entry meta-data + WAVEBANK_SEGIDX_SEEKTABLES, // Storage for seek tables for the encoded waves. + WAVEBANK_SEGIDX_ENTRYNAMES, // Entry friendly names + WAVEBANK_SEGIDX_ENTRYWAVEDATA, // Entry wave data + WAVEBANK_SEGIDX_COUNT +} WAVEBANKSEGIDX, *LPWAVEBANKSEGIDX; + +typedef const WAVEBANKSEGIDX *LPCWAVEBANKSEGIDX; + +// +// Endianness +// + +#ifdef __cplusplus + +namespace XACTWaveBank +{ + __inline void SwapBytes(XACTUNALIGNED DWORD &dw) + { + +#ifdef _X86_ + + __asm + { + mov edi, dw + mov eax, [edi] + bswap eax + mov [edi], eax + } + +#else // _X86_ + + dw = _byteswap_ulong(dw); + +#endif // _X86_ + + } + + __inline void SwapBytes(XACTUNALIGNED WORD &w) + { + +#ifdef _X86_ + + __asm + { + mov edi, w + mov ax, [edi] + xchg ah, al + mov [edi], ax + } + +#else // _X86_ + + w = _byteswap_ushort(w); + +#endif // _X86_ + + } + +} + +#endif // __cplusplus + +// +// Wave bank region in bytes. +// + +typedef struct WAVEBANKREGION +{ + DWORD dwOffset; // Region offset, in bytes. + DWORD dwLength; // Region length, in bytes. + +#ifdef __cplusplus + + void SwapBytes(void) + { + XACTWaveBank::SwapBytes(dwOffset); + XACTWaveBank::SwapBytes(dwLength); + } + +#endif // __cplusplus + +} WAVEBANKREGION, *LPWAVEBANKREGION; + +typedef const WAVEBANKREGION *LPCWAVEBANKREGION; + + +// +// Wave bank region in samples. +// + +typedef struct WAVEBANKSAMPLEREGION +{ + DWORD dwStartSample; // Start sample for the region. + DWORD dwTotalSamples; // Region length in samples. + +#ifdef __cplusplus + + void SwapBytes(void) + { + XACTWaveBank::SwapBytes(dwStartSample); + XACTWaveBank::SwapBytes(dwTotalSamples); + } + +#endif // __cplusplus + +} WAVEBANKSAMPLEREGION, *LPWAVEBANKSAMPLEREGION; + +typedef const WAVEBANKSAMPLEREGION *LPCWAVEBANKSAMPLEREGION; + + +// +// Wave bank file header +// + +typedef struct WAVEBANKHEADER +{ + DWORD dwSignature; // File signature + DWORD dwVersion; // Version of the tool that created the file + DWORD dwHeaderVersion; // Version of the file format + WAVEBANKREGION Segments[WAVEBANK_SEGIDX_COUNT]; // Segment lookup table + +#ifdef __cplusplus + + void SwapBytes(void) + { + XACTWaveBank::SwapBytes(dwSignature); + XACTWaveBank::SwapBytes(dwVersion); + XACTWaveBank::SwapBytes(dwHeaderVersion); + + for(int i = 0; i < WAVEBANK_SEGIDX_COUNT; i++) + { + Segments[i].SwapBytes(); + } + } + +#endif // __cplusplus + +} WAVEBANKHEADER, *LPWAVEBANKHEADER; + +typedef const WAVEBANKHEADER *LPCWAVEBANKHEADER; + +// +// Table for converting WMA Average Bytes per Second values to the WAVEBANKMINIWAVEFORMAT wBlockAlign field +// NOTE: There can be a max of 8 values in the table. +// + +#define MAX_WMA_AVG_BYTES_PER_SEC_ENTRIES 7 + +static const DWORD aWMAAvgBytesPerSec[] = +{ + 12000, + 24000, + 4000, + 6000, + 8000, + 20000, + 2500 +}; +// bitrate = entry * 8 + +// +// Table for converting WMA Block Align values to the WAVEBANKMINIWAVEFORMAT wBlockAlign field +// NOTE: There can be a max of 32 values in the table. +// + +#define MAX_WMA_BLOCK_ALIGN_ENTRIES 17 + +static const DWORD aWMABlockAlign[] = +{ + 929, + 1487, + 1280, + 2230, + 8917, + 8192, + 4459, + 5945, + 2304, + 1536, + 1485, + 1008, + 2731, + 4096, + 6827, + 5462, + 1280 +}; + +struct WAVEBANKENTRY; + +// +// Entry compressed data format +// + +typedef union WAVEBANKMINIWAVEFORMAT +{ + struct + { + DWORD wFormatTag : 2; // Format tag + DWORD nChannels : 3; // Channel count (1 - 6) + DWORD nSamplesPerSec : 18; // Sampling rate + DWORD wBlockAlign : 8; // Block alignment. For WMA, lower 6 bits block alignment index, upper 2 bits bytes-per-second index. + DWORD wBitsPerSample : 1; // Bits per sample (8 vs. 16, PCM only); WMAudio2/WMAudio3 (for WMA) + }; + + DWORD dwValue; + +#ifdef __cplusplus + + void SwapBytes(void) + { + XACTWaveBank::SwapBytes(dwValue); + } + + WORD BitsPerSample() const + { + if (wFormatTag == WAVEBANKMINIFORMAT_TAG_XMA) + return XMA_OUTPUT_SAMPLE_BITS; // First, because most common on Xbox 360 + if (wFormatTag == WAVEBANKMINIFORMAT_TAG_WMA) + return 16; + if (wFormatTag == WAVEBANKMINIFORMAT_TAG_ADPCM) + return 4; // MSADPCM_BITS_PER_SAMPLE == 4 + + // wFormatTag must be WAVEBANKMINIFORMAT_TAG_PCM (2 bits can only represent 4 different values) + return (wBitsPerSample == WAVEBANKMINIFORMAT_BITDEPTH_16) ? 16 : 8; + } + + #define ADPCM_MINIWAVEFORMAT_BLOCKALIGN_CONVERSION_OFFSET 22 + DWORD BlockAlign() const + { + DWORD dwReturn = 0; + + switch (wFormatTag) + { + case WAVEBANKMINIFORMAT_TAG_PCM: + dwReturn = wBlockAlign; + break; + + case WAVEBANKMINIFORMAT_TAG_XMA: + dwReturn = nChannels * XMA_OUTPUT_SAMPLE_BITS / 8; + break; + + case WAVEBANKMINIFORMAT_TAG_ADPCM: + dwReturn = (wBlockAlign + ADPCM_MINIWAVEFORMAT_BLOCKALIGN_CONVERSION_OFFSET) * nChannels; + break; + + case WAVEBANKMINIFORMAT_TAG_WMA: + { + DWORD dwBlockAlignIndex = wBlockAlign & 0x1F; + if (dwBlockAlignIndex < MAX_WMA_BLOCK_ALIGN_ENTRIES) + dwReturn = aWMABlockAlign[dwBlockAlignIndex]; + } + break; + } + + return dwReturn; + } + + DWORD AvgBytesPerSec() const + { + DWORD dwReturn = 0; + + switch (wFormatTag) + { + case WAVEBANKMINIFORMAT_TAG_PCM: + case WAVEBANKMINIFORMAT_TAG_XMA: + dwReturn = nSamplesPerSec * wBlockAlign; + break; + + case WAVEBANKMINIFORMAT_TAG_ADPCM: + { + DWORD blockAlign = BlockAlign(); + DWORD samplesPerAdpcmBlock = AdpcmSamplesPerBlock(); + dwReturn = blockAlign * nSamplesPerSec / samplesPerAdpcmBlock; + } + break; + + case WAVEBANKMINIFORMAT_TAG_WMA: + { + DWORD dwBytesPerSecIndex = wBlockAlign >> 5; + if (dwBytesPerSecIndex < MAX_WMA_AVG_BYTES_PER_SEC_ENTRIES) + dwReturn = aWMAAvgBytesPerSec[dwBytesPerSecIndex]; + } + break; + } + + return dwReturn; + } + + DWORD EncodeWMABlockAlign(DWORD dwBlockAlign, DWORD dwAvgBytesPerSec) const + { + DWORD dwReturn = 0; + DWORD dwBlockAlignIndex = 0; + DWORD dwBytesPerSecIndex = 0; + + for (; dwBlockAlignIndex < MAX_WMA_BLOCK_ALIGN_ENTRIES && dwBlockAlign != aWMABlockAlign[dwBlockAlignIndex]; dwBlockAlignIndex++); + + if (dwBlockAlignIndex < MAX_WMA_BLOCK_ALIGN_ENTRIES) + { + for (; dwBytesPerSecIndex < MAX_WMA_AVG_BYTES_PER_SEC_ENTRIES && dwAvgBytesPerSec != aWMAAvgBytesPerSec[dwBytesPerSecIndex]; dwBytesPerSecIndex++); + + if (dwBytesPerSecIndex < MAX_WMA_AVG_BYTES_PER_SEC_ENTRIES) + { + dwReturn = dwBlockAlignIndex | (dwBytesPerSecIndex << 5); + } + } + + return dwReturn; + } + + + void XMA2FillFormatEx(XMA2WAVEFORMATEX *fmt, WORD blockCount, const struct WAVEBANKENTRY* entry) const; + + DWORD AdpcmSamplesPerBlock() const + { + DWORD nBlockAlign = (wBlockAlign + ADPCM_MINIWAVEFORMAT_BLOCKALIGN_CONVERSION_OFFSET) * nChannels; + return nBlockAlign * 2 / (DWORD)nChannels - 12; + } + + void AdpcmFillCoefficientTable(ADPCMWAVEFORMAT *fmt) const + { + // These are fixed since we are always using MS ADPCM + fmt->wNumCoef = 7; /* MSADPCM_NUM_COEFFICIENTS */ + + static ADPCMCOEFSET aCoef[7] = { { 256, 0}, {512, -256}, {0,0}, {192,64}, {240,0}, {460, -208}, {392,-232} }; + memcpy( &fmt->aCoef, aCoef, sizeof(aCoef) ); + } + +#endif // __cplusplus + +} WAVEBANKMINIWAVEFORMAT, *LPWAVEBANKMINIWAVEFORMAT; + +typedef const WAVEBANKMINIWAVEFORMAT *LPCWAVEBANKMINIWAVEFORMAT; + +// +// Entry meta-data +// + +typedef struct WAVEBANKENTRY +{ + union + { + struct + { + // Entry flags + DWORD dwFlags : 4; + + // Duration of the wave, in units of one sample. + // For instance, a ten second long wave sampled + // at 48KHz would have a duration of 480,000. + // This value is not affected by the number of + // channels, the number of bits per sample, or the + // compression format of the wave. + DWORD Duration : 28; + }; + DWORD dwFlagsAndDuration; + }; + + WAVEBANKMINIWAVEFORMAT Format; // Entry format. + WAVEBANKREGION PlayRegion; // Region within the wave data segment that contains this entry. + WAVEBANKSAMPLEREGION LoopRegion; // Region within the wave data (in samples) that should loop. + +#ifdef __cplusplus + + void SwapBytes(void) + { + XACTWaveBank::SwapBytes(dwFlagsAndDuration); + Format.SwapBytes(); + PlayRegion.SwapBytes(); + LoopRegion.SwapBytes(); + } + +#endif // __cplusplus + +} WAVEBANKENTRY, *LPWAVEBANKENTRY; + +typedef const WAVEBANKENTRY *LPCWAVEBANKENTRY; + +// +// Compact entry meta-data +// + +typedef struct WAVEBANKENTRYCOMPACT +{ + DWORD dwOffset : 21; // Data offset, in sectors + DWORD dwLengthDeviation : 11; // Data length deviation, in bytes + +#ifdef __cplusplus + + void SwapBytes(void) + { + XACTWaveBank::SwapBytes(*(LPDWORD)this); + } + +#endif // __cplusplus + +} WAVEBANKENTRYCOMPACT, *LPWAVEBANKENTRYCOMPACT; + +typedef const WAVEBANKENTRYCOMPACT *LPCWAVEBANKENTRYCOMPACT; + +// +// Bank data segment +// + +typedef struct WAVEBANKDATA +{ + DWORD dwFlags; // Bank flags + DWORD dwEntryCount; // Number of entries in the bank + CHAR szBankName[WAVEBANK_BANKNAME_LENGTH]; // Bank friendly name + DWORD dwEntryMetaDataElementSize; // Size of each entry meta-data element, in bytes + DWORD dwEntryNameElementSize; // Size of each entry name element, in bytes + DWORD dwAlignment; // Entry alignment, in bytes + WAVEBANKMINIWAVEFORMAT CompactFormat; // Format data for compact bank + FILETIME BuildTime; // Build timestamp + +#ifdef __cplusplus + + void SwapBytes(void) + { + XACTWaveBank::SwapBytes(dwFlags); + XACTWaveBank::SwapBytes(dwEntryCount); + XACTWaveBank::SwapBytes(dwEntryMetaDataElementSize); + XACTWaveBank::SwapBytes(dwEntryNameElementSize); + XACTWaveBank::SwapBytes(dwAlignment); + CompactFormat.SwapBytes(); + XACTWaveBank::SwapBytes(BuildTime.dwLowDateTime); + XACTWaveBank::SwapBytes(BuildTime.dwHighDateTime); + } + +#endif // __cplusplus + +} WAVEBANKDATA, *LPWAVEBANKDATA; + +typedef const WAVEBANKDATA *LPCWAVEBANKDATA; + +inline void WAVEBANKMINIWAVEFORMAT::XMA2FillFormatEx(XMA2WAVEFORMATEX *fmt, WORD blockCount, const WAVEBANKENTRY* entry) const +{ + // Note caller is responsbile for filling out fmt->wfx with other helper functions. + + fmt->NumStreams = (WORD)( (nChannels + 1) / 2 ); + + switch (nChannels) + { + case 1: fmt->ChannelMask = SPEAKER_MONO; break; + case 2: fmt->ChannelMask = SPEAKER_STEREO; break; + case 3: fmt->ChannelMask = SPEAKER_2POINT1; break; + case 4: fmt->ChannelMask = SPEAKER_QUAD; break; + case 5: fmt->ChannelMask = SPEAKER_4POINT1; break; + case 6: fmt->ChannelMask = SPEAKER_5POINT1; break; + case 7: fmt->ChannelMask = SPEAKER_5POINT1 | SPEAKER_BACK_CENTER; break; + case 8: fmt->ChannelMask = SPEAKER_7POINT1; break; + default: fmt->ChannelMask = 0; break; + } + + fmt->SamplesEncoded = entry->Duration; + fmt->BytesPerBlock = 65536; /* XACT_FIXED_XMA_BLOCK_SIZE */ + + fmt->PlayBegin = entry->PlayRegion.dwOffset; + fmt->PlayLength = entry->PlayRegion.dwLength; + + if (entry->LoopRegion.dwTotalSamples > 0) + { + fmt->LoopBegin = entry->LoopRegion.dwStartSample; + fmt->LoopLength = entry->LoopRegion.dwTotalSamples; + fmt->LoopCount = 0xff; /* XACTLOOPCOUNT_INFINITE */ + } + else + { + fmt->LoopBegin = 0; + fmt->LoopLength = 0; + fmt->LoopCount = 0; + } + + fmt->EncoderVersion = 4; // XMAENCODER_VERSION_XMA2 + + fmt->BlockCount = blockCount; +} + +#ifdef _M_PPCBE +#pragma bitfield_order(pop) +#endif + +#pragma warning(pop) +#pragma pack(pop) + +#endif // __XACTWB_H__ + diff --git a/MediaClient/MediaClient/directx/include/xma2defs.h b/MediaClient/MediaClient/directx/include/xma2defs.h new file mode 100644 index 0000000..13a4306 --- /dev/null +++ b/MediaClient/MediaClient/directx/include/xma2defs.h @@ -0,0 +1,718 @@ +/*************************************************************************** + * + * Copyright (c) Microsoft Corporation. All rights reserved. + * + * File: xma2defs.h + * Content: Constants, data types and functions for XMA2 compressed audio. + * + ***************************************************************************/ + +#ifndef __XMA2DEFS_INCLUDED__ +#define __XMA2DEFS_INCLUDED__ + +#include // Markers for documenting API semantics +#include // For S_OK, E_FAIL +#include // Basic data types and constants for audio work + + +/*************************************************************************** + * Overview + ***************************************************************************/ + +// A typical XMA2 file contains these RIFF chunks: +// +// 'fmt' or 'XMA2' chunk (or both): A description of the XMA data's structure +// and characteristics (length, channels, sample rate, loops, block size, etc). +// +// 'seek' chunk: A seek table to help navigate the XMA data. +// +// 'data' chunk: The encoded XMA2 data. +// +// The encoded XMA2 data is structured as a set of BLOCKS, which contain PACKETS, +// which contain FRAMES, which contain SUBFRAMES (roughly speaking). The frames +// in a file may also be divided into several subsets, called STREAMS. +// +// FRAME: A variable-sized segment of XMA data that decodes to exactly 512 mono +// or stereo PCM samples. This is the smallest unit of XMA data that can +// be decoded in isolation. Frames are an arbitrary number of bits in +// length, and need not be byte-aligned. See "XMA frame structure" below. +// +// SUBFRAME: A region of bits in an XMA frame that decodes to 128 mono or stereo +// samples. The XMA decoder cannot decode a subframe in isolation; it needs +// a whole frame to work with. However, it can begin emitting the frame's +// decoded samples at any one of the four subframe boundaries. Subframes +// can be addressed for seeking and looping purposes. +// +// PACKET: A 2Kb region containing a 32-bit header and some XMA frames. Frames +// can (and usually do) span packets. A packet's header includes the offset +// in bits of the first frame that begins within that packet. All of the +// frames that begin in a given packet belong to the same "stream" (see the +// Multichannel Audio section below). +// +// STREAM: A set of packets within an XMA file that all contain data for the +// same mono or stereo component of a PCM file with more than two channels. +// The packets comprising a given stream may be interleaved with each other +// more or less arbitrarily; see Multichannel Audio. +// +// BLOCK: An array of XMA packets; or, to break it down differently, a series of +// consecutive XMA frames, padded at the end with reserved data. A block +// must contain at least one 2Kb packet per stream, and it can hold up to +// 4095 packets (8190Kb), but its size is typically in the 32Kb-128Kb range. +// (The size chosen involves a trade-off between memory use and efficiency +// of reading from permanent storage.) +// +// XMA frames do not span blocks, so a block is guaranteed to begin with a +// set of complete frames, one per stream. Also, a block in a multi-stream +// XMA2 file always contains the same number of samples for each stream; +// see Multichannel Audio. +// +// The 'data' chunk in an XMA2 file is an array of XMA2WAVEFORMAT.BlockCount XMA +// blocks, all the same size (as specified in XMA2WAVEFORMAT.BlockSizeInBytes) +// except for the last one, which may be shorter. + + +// MULTICHANNEL AUDIO: the XMA decoder can only decode raw XMA data into either +// mono or stereo PCM data. In order to encode a 6-channel file (say), the file +// must be deinterleaved into 3 stereo streams that are encoded independently, +// producing 3 encoded XMA data streams. Then the packets in these 3 streams +// are interleaved to produce a single XMA2 file, and some information is added +// to the file so that the original 6-channel audio can be reconstructed at +// decode time. This works using the concept of an XMA stream (see above). +// +// The frames for all the streams in an XMA file are interleaved in an arbitrary +// order. To locate a frame that belongs to a given stream in a given XMA block, +// you must examine the first few packets in the block. Here (and only here) the +// packets are guaranteed to be presented in stream order, so that all frames +// beginning in packet 0 belong to stream 0 (the first stereo pair), etc. +// +// (This means that when decoding multi-stream XMA files, only entire XMA blocks +// should be submitted to the decoder; otherwise it cannot know which frames +// belong to which stream.) +// +// Once you have one frame that belongs to a given stream, you can find the next +// one by looking at the frame's 'NextFrameOffsetBits' value (which is stored in +// its first 15 bits; see XMAFRAME below). The GetXmaFrameBitPosition function +// uses this technique. + + +// SEEKING IN XMA2 FILES: Here is some pseudocode to find the byte position and +// subframe in an XMA2 file which will contain sample S when decoded. +// +// 1. Traverse the seek table to find the XMA2 block containing sample S. The +// seek table is an array of big-endian DWORDs, one per block in the file. +// The Nth DWORD is the total number of PCM samples that would be obtained +// by decoding the entire XMA file up to the end of block N. Hence, the +// block we want is the first one whose seek table entry is greater than S. +// (See the GetXmaBlockContainingSample helper function.) +// +// 2. Calculate which frame F within the block found above contains sample S. +// Since each frame decodes to 512 samples, this is straightforward. The +// first frame in the block produces samples X to X + 512, where X is the +// seek table entry for the prior block. So F is (S - X) / 512. +// +// 3. Find the bit offset within the block where frame F starts. Since frames +// are variable-sized, this can only be done by traversing all the frames in +// the block until we reach frame F. (See GetXmaFrameBitPosition.) +// +// 4. Frame F has four 128-sample subframes. To find the subframe containing S, +// we can use the formula (S % 512) / 128. +// +// In the case of multi-stream XMA files, sample S is a multichannel sample with +// parts coming from several frames, one per stream. To find all these frames, +// steps 2-4 need to be repeated for each stream N, using the knowledge that the +// first packets in a block are presented in stream order. The frame traversal +// in step 3 must be started at the first frame in the Nth packet of the block, +// which will be the first frame for stream N. (And the packet header will tell +// you the first frame's start position within the packet.) +// +// Step 1 can be performed using the GetXmaBlockContainingSample function below, +// and steps 2-4 by calling GetXmaDecodePositionForSample once for each stream. + + + +/*************************************************************************** + * XMA constants + ***************************************************************************/ + +// Size of the PCM samples produced by the XMA decoder +#define XMA_OUTPUT_SAMPLE_BYTES 2u +#define XMA_OUTPUT_SAMPLE_BITS (XMA_OUTPUT_SAMPLE_BYTES * 8u) + +// Size of an XMA packet +#define XMA_BYTES_PER_PACKET 2048u +#define XMA_BITS_PER_PACKET (XMA_BYTES_PER_PACKET * 8u) + +// Size of an XMA packet header +#define XMA_PACKET_HEADER_BYTES 4u +#define XMA_PACKET_HEADER_BITS (XMA_PACKET_HEADER_BYTES * 8u) + +// Sample blocks in a decoded XMA frame +#define XMA_SAMPLES_PER_FRAME 512u + +// Sample blocks in a decoded XMA subframe +#define XMA_SAMPLES_PER_SUBFRAME 128u + +// Maximum encoded data that can be submitted to the XMA decoder at a time +#define XMA_READBUFFER_MAX_PACKETS 4095u +#define XMA_READBUFFER_MAX_BYTES (XMA_READBUFFER_MAX_PACKETS * XMA_BYTES_PER_PACKET) + +// Maximum size allowed for the XMA decoder's output buffers +#define XMA_WRITEBUFFER_MAX_BYTES (31u * 256u) + +// Required byte alignment of the XMA decoder's output buffers +#define XMA_WRITEBUFFER_BYTE_ALIGNMENT 256u + +// Decode chunk sizes for the XMA_PLAYBACK_INIT.subframesToDecode field +#define XMA_MIN_SUBFRAMES_TO_DECODE 1u +#define XMA_MAX_SUBFRAMES_TO_DECODE 8u +#define XMA_OPTIMAL_SUBFRAMES_TO_DECODE 4u + +// LoopCount<255 means finite repetitions; LoopCount=255 means infinite looping +#define XMA_MAX_LOOPCOUNT 254u +#define XMA_INFINITE_LOOP 255u + + + +/*************************************************************************** + * XMA format structures + ***************************************************************************/ + +// The currently recommended way to express format information for XMA2 files +// is the XMA2WAVEFORMATEX structure. This structure is fully compliant with +// the WAVEFORMATEX standard and contains all the information needed to parse +// and manage XMA2 files in a compact way. + +#define WAVE_FORMAT_XMA2 0x166 + +typedef struct XMA2WAVEFORMATEX +{ + WAVEFORMATEX wfx; + // Meaning of the WAVEFORMATEX fields here: + // wFormatTag; // Audio format type; always WAVE_FORMAT_XMA2 + // nChannels; // Channel count of the decoded audio + // nSamplesPerSec; // Sample rate of the decoded audio + // nAvgBytesPerSec; // Used internally by the XMA encoder + // nBlockAlign; // Decoded sample size; channels * wBitsPerSample / 8 + // wBitsPerSample; // Bits per decoded mono sample; always 16 for XMA + // cbSize; // Size in bytes of the rest of this structure (34) + + WORD NumStreams; // Number of audio streams (1 or 2 channels each) + DWORD ChannelMask; // Spatial positions of the channels in this file, + // stored as SPEAKER_xxx values (see audiodefs.h) + DWORD SamplesEncoded; // Total number of PCM samples the file decodes to + DWORD BytesPerBlock; // XMA block size (but the last one may be shorter) + DWORD PlayBegin; // First valid sample in the decoded audio + DWORD PlayLength; // Length of the valid part of the decoded audio + DWORD LoopBegin; // Beginning of the loop region in decoded sample terms + DWORD LoopLength; // Length of the loop region in decoded sample terms + BYTE LoopCount; // Number of loop repetitions; 255 = infinite + BYTE EncoderVersion; // Version of XMA encoder that generated the file + WORD BlockCount; // XMA blocks in file (and entries in its seek table) +} XMA2WAVEFORMATEX, *PXMA2WAVEFORMATEX; + + +// The legacy XMA format structures are described here for reference, but they +// should not be used in new content. XMAWAVEFORMAT was the structure used in +// XMA version 1 files. XMA2WAVEFORMAT was used in early XMA2 files; it is not +// placed in the usual 'fmt' RIFF chunk but in its own 'XMA2' chunk. + +#ifndef WAVE_FORMAT_XMA +#define WAVE_FORMAT_XMA 0x0165 + +// Values used in the ChannelMask fields below. Similar to the SPEAKER_xxx +// values defined in audiodefs.h, but modified to fit in a single byte. +#ifndef XMA_SPEAKER_LEFT + #define XMA_SPEAKER_LEFT 0x01 + #define XMA_SPEAKER_RIGHT 0x02 + #define XMA_SPEAKER_CENTER 0x04 + #define XMA_SPEAKER_LFE 0x08 + #define XMA_SPEAKER_LEFT_SURROUND 0x10 + #define XMA_SPEAKER_RIGHT_SURROUND 0x20 + #define XMA_SPEAKER_LEFT_BACK 0x40 + #define XMA_SPEAKER_RIGHT_BACK 0x80 +#endif + + +// Used in XMAWAVEFORMAT for per-stream data +typedef struct XMASTREAMFORMAT +{ + DWORD PsuedoBytesPerSec; // Used by the XMA encoder (typo preserved for legacy reasons) + DWORD SampleRate; // The stream's decoded sample rate (in XMA2 files, + // this is the same for all streams in the file). + DWORD LoopStart; // Bit offset of the frame containing the loop start + // point, relative to the beginning of the stream. + DWORD LoopEnd; // Bit offset of the frame containing the loop end. + BYTE SubframeData; // Two 4-bit numbers specifying the exact location of + // the loop points within the frames that contain them. + // SubframeEnd: Subframe of the loop end frame where + // the loop ends. Ranges from 0 to 3. + // SubframeSkip: Subframes to skip in the start frame to + // reach the loop. Ranges from 0 to 4. + BYTE Channels; // Number of channels in the stream (1 or 2) + WORD ChannelMask; // Spatial positions of the channels in the stream +} XMASTREAMFORMAT; + +// Legacy XMA1 format structure +typedef struct XMAWAVEFORMAT +{ + WORD FormatTag; // Audio format type (always WAVE_FORMAT_XMA) + WORD BitsPerSample; // Bit depth (currently required to be 16) + WORD EncodeOptions; // Options for XMA encoder/decoder + WORD LargestSkip; // Largest skip used in interleaving streams + WORD NumStreams; // Number of interleaved audio streams + BYTE LoopCount; // Number of loop repetitions; 255 = infinite + BYTE Version; // XMA encoder version that generated the file. + // Always 3 or higher for XMA2 files. + XMASTREAMFORMAT XmaStreams[1]; // Per-stream format information; the actual + // array length is in the NumStreams field. +} XMAWAVEFORMAT; + + +// Used in XMA2WAVEFORMAT for per-stream data +typedef struct XMA2STREAMFORMAT +{ + BYTE Channels; // Number of channels in the stream (1 or 2) + BYTE RESERVED; // Reserved for future use + WORD ChannelMask; // Spatial positions of the channels in the stream +} XMA2STREAMFORMAT; + +// Legacy XMA2 format structure (big-endian byte ordering) +typedef struct XMA2WAVEFORMAT +{ + BYTE Version; // XMA encoder version that generated the file. + // Always 3 or higher for XMA2 files. + BYTE NumStreams; // Number of interleaved audio streams + BYTE RESERVED; // Reserved for future use + BYTE LoopCount; // Number of loop repetitions; 255 = infinite + DWORD LoopBegin; // Loop begin point, in samples + DWORD LoopEnd; // Loop end point, in samples + DWORD SampleRate; // The file's decoded sample rate + DWORD EncodeOptions; // Options for the XMA encoder/decoder + DWORD PsuedoBytesPerSec; // Used internally by the XMA encoder + DWORD BlockSizeInBytes; // Size in bytes of this file's XMA blocks (except + // possibly the last one). Always a multiple of + // 2Kb, since XMA blocks are arrays of 2Kb packets. + DWORD SamplesEncoded; // Total number of PCM samples encoded in this file + DWORD SamplesInSource; // Actual number of PCM samples in the source + // material used to generate this file + DWORD BlockCount; // Number of XMA blocks in this file (and hence + // also the number of entries in its seek table) + XMA2STREAMFORMAT Streams[1]; // Per-stream format information; the actual + // array length is in the NumStreams field. +} XMA2WAVEFORMAT; + +#endif // #ifndef WAVE_FORMAT_XMA + + + +/*************************************************************************** + * XMA packet structure (in big-endian form) + ***************************************************************************/ + +typedef struct XMA2PACKET +{ + int FrameCount : 6; // Number of XMA frames that begin in this packet + int FrameOffsetInBits : 15; // Bit of XmaData where the first complete frame begins + int PacketMetaData : 3; // Metadata stored in the packet (always 1 for XMA2) + int PacketSkipCount : 8; // How many packets belonging to other streams must be + // skipped to find the next packet belonging to this one + BYTE XmaData[XMA_BYTES_PER_PACKET - sizeof(DWORD)]; // XMA encoded data +} XMA2PACKET; + +// E.g. if the first DWORD of a packet is 0x30107902: +// +// 001100 000001000001111 001 00000010 +// | | | |____ Skip 2 packets to find the next one for this stream +// | | |___________ XMA2 signature (always 001) +// | |_____________________ First frame starts 527 bits into packet +// |________________________________ Packet contains 12 frames + + +// Helper functions to extract the fields above from an XMA packet. (Note that +// the bitfields cannot be read directly on little-endian architectures such as +// the Intel x86, as they are laid out in big-endian form.) + +__inline DWORD GetXmaPacketFrameCount(__in_bcount(1) const BYTE* pPacket) +{ + return (DWORD)(pPacket[0] >> 2); +} + +__inline DWORD GetXmaPacketFirstFrameOffsetInBits(__in_bcount(3) const BYTE* pPacket) +{ + return ((DWORD)(pPacket[0] & 0x3) << 13) | + ((DWORD)(pPacket[1]) << 5) | + ((DWORD)(pPacket[2]) >> 3); +} + +__inline DWORD GetXmaPacketMetadata(__in_bcount(3) const BYTE* pPacket) +{ + return (DWORD)(pPacket[2] & 0x7); +} + +__inline DWORD GetXmaPacketSkipCount(__in_bcount(4) const BYTE* pPacket) +{ + return (DWORD)(pPacket[3]); +} + + + +/*************************************************************************** + * XMA frame structure + ***************************************************************************/ + +// There is no way to represent the XMA frame as a C struct, since it is a +// variable-sized string of bits that need not be stored at a byte-aligned +// position in memory. This is the layout: +// +// XMAFRAME +// { +// LengthInBits: A 15-bit number representing the length of this frame. +// XmaData: Encoded XMA data; its size in bits is (LengthInBits - 15). +// } + +// Size in bits of the frame's initial LengthInBits field +#define XMA_BITS_IN_FRAME_LENGTH_FIELD 15 + +// Special LengthInBits value that marks an invalid final frame +#define XMA_FINAL_FRAME_MARKER 0x7FFF + + + +/*************************************************************************** + * XMA helper functions + ***************************************************************************/ + +// We define a local ASSERT macro to equal the global one if it exists. +// You can define XMA2DEFS_ASSERT in advance to override this default. +#ifndef XMA2DEFS_ASSERT + #ifdef ASSERT + #define XMA2DEFS_ASSERT ASSERT + #else + #define XMA2DEFS_ASSERT(a) /* No-op by default */ + #endif +#endif + + +// GetXmaBlockContainingSample: Use a given seek table to find the XMA block +// containing a given decoded sample. Note that the seek table entries in an +// XMA file are stored in big-endian form and may need to be converted prior +// to calling this function. + +__inline HRESULT GetXmaBlockContainingSample +( + DWORD nBlockCount, // Blocks in the file (= seek table entries) + __in_ecount(nBlockCount) const DWORD* pSeekTable, // Pointer to the seek table data + DWORD nDesiredSample, // Decoded sample to locate + __out DWORD* pnBlockContainingSample, // Index of the block containing the sample + __out DWORD* pnSampleOffsetWithinBlock // Position of the sample in this block +) +{ + DWORD nPreviousTotalSamples = 0; + DWORD nBlock; + DWORD nTotalSamplesSoFar; + + XMA2DEFS_ASSERT(pSeekTable); + XMA2DEFS_ASSERT(pnBlockContainingSample); + XMA2DEFS_ASSERT(pnSampleOffsetWithinBlock); + + for (nBlock = 0; nBlock < nBlockCount; ++nBlock) + { + nTotalSamplesSoFar = pSeekTable[nBlock]; + if (nTotalSamplesSoFar > nDesiredSample) + { + *pnBlockContainingSample = nBlock; + *pnSampleOffsetWithinBlock = nDesiredSample - nPreviousTotalSamples; + return S_OK; + } + nPreviousTotalSamples = nTotalSamplesSoFar; + } + + return E_FAIL; +} + + +// GetXmaFrameLengthInBits: Reads a given frame's LengthInBits field. + +__inline DWORD GetXmaFrameLengthInBits +( + __in_bcount(nBitPosition / 8 + 3) + __in const BYTE* pPacket, // Pointer to XMA packet[s] containing the frame + DWORD nBitPosition // Bit offset of the frame within this packet +) +{ + DWORD nRegion; + DWORD nBytePosition = nBitPosition / 8; + DWORD nBitOffset = nBitPosition % 8; + + if (nBitOffset < 2) // Only need to read 2 bytes (and might not be safe to read more) + { + nRegion = (DWORD)(pPacket[nBytePosition+0]) << 8 | + (DWORD)(pPacket[nBytePosition+1]); + return (nRegion >> (1 - nBitOffset)) & 0x7FFF; // Last 15 bits + } + else // Need to read 3 bytes + { + nRegion = (DWORD)(pPacket[nBytePosition+0]) << 16 | + (DWORD)(pPacket[nBytePosition+1]) << 8 | + (DWORD)(pPacket[nBytePosition+2]); + return (nRegion >> (9 - nBitOffset)) & 0x7FFF; // Last 15 bits + } +} + + +// GetXmaFrameBitPosition: Calculates the bit offset of a given frame within +// an XMA block or set of blocks. Returns 0 on failure. + +__inline DWORD GetXmaFrameBitPosition +( + __in_bcount(nXmaDataBytes) const BYTE* pXmaData, // Pointer to XMA block[s] + DWORD nXmaDataBytes, // Size of pXmaData in bytes + DWORD nStreamIndex, // Stream within which to seek + DWORD nDesiredFrame // Frame sought +) +{ + const BYTE* pCurrentPacket; + DWORD nPacketsExamined = 0; + DWORD nFrameCountSoFar = 0; + DWORD nFramesToSkip; + DWORD nFrameBitOffset; + + XMA2DEFS_ASSERT(pXmaData); + XMA2DEFS_ASSERT(nXmaDataBytes % XMA_BYTES_PER_PACKET == 0); + + // Get the first XMA packet belonging to the desired stream, relying on the + // fact that the first packets for each stream are in consecutive order at + // the beginning of an XMA block. + + pCurrentPacket = pXmaData + nStreamIndex * XMA_BYTES_PER_PACKET; + for (;;) + { + // If we have exceeded the size of the XMA data, return failure + if (pCurrentPacket + XMA_BYTES_PER_PACKET > pXmaData + nXmaDataBytes) + { + return 0; + } + + // If the current packet contains the frame we are looking for... + if (nFrameCountSoFar + GetXmaPacketFrameCount(pCurrentPacket) > nDesiredFrame) + { + // See how many frames in this packet we need to skip to get to it + XMA2DEFS_ASSERT(nDesiredFrame >= nFrameCountSoFar); + nFramesToSkip = nDesiredFrame - nFrameCountSoFar; + + // Get the bit offset of the first frame in this packet + nFrameBitOffset = XMA_PACKET_HEADER_BITS + GetXmaPacketFirstFrameOffsetInBits(pCurrentPacket); + + // Advance nFrameBitOffset to the frame of interest + while (nFramesToSkip--) + { + nFrameBitOffset += GetXmaFrameLengthInBits(pCurrentPacket, nFrameBitOffset); + } + + // The bit offset to return is the number of bits from pXmaData to + // pCurrentPacket plus the bit offset of the frame of interest + return (DWORD)(pCurrentPacket - pXmaData) * 8 + nFrameBitOffset; + } + + // If we haven't found the right packet yet, advance our counters + ++nPacketsExamined; + nFrameCountSoFar += GetXmaPacketFrameCount(pCurrentPacket); + + // And skip to the next packet belonging to the same stream + pCurrentPacket += XMA_BYTES_PER_PACKET * (GetXmaPacketSkipCount(pCurrentPacket) + 1); + } +} + + +// GetLastXmaFrameBitPosition: Calculates the bit offset of the last complete +// frame in an XMA block or set of blocks. + +__inline DWORD GetLastXmaFrameBitPosition +( + __in_bcount(nXmaDataBytes) const BYTE* pXmaData, // Pointer to XMA block[s] + DWORD nXmaDataBytes, // Size of pXmaData in bytes + DWORD nStreamIndex // Stream within which to seek +) +{ + const BYTE* pLastPacket; + DWORD nBytesToNextPacket; + DWORD nFrameBitOffset; + DWORD nFramesInLastPacket; + + XMA2DEFS_ASSERT(pXmaData); + XMA2DEFS_ASSERT(nXmaDataBytes % XMA_BYTES_PER_PACKET == 0); + XMA2DEFS_ASSERT(nXmaDataBytes >= XMA_BYTES_PER_PACKET * (nStreamIndex + 1)); + + // Get the first XMA packet belonging to the desired stream, relying on the + // fact that the first packets for each stream are in consecutive order at + // the beginning of an XMA block. + pLastPacket = pXmaData + nStreamIndex * XMA_BYTES_PER_PACKET; + + // Search for the last packet belonging to the desired stream + for (;;) + { + nBytesToNextPacket = XMA_BYTES_PER_PACKET * (GetXmaPacketSkipCount(pLastPacket) + 1); + XMA2DEFS_ASSERT(nBytesToNextPacket); + if (pLastPacket + nBytesToNextPacket + XMA_BYTES_PER_PACKET > pXmaData + nXmaDataBytes) + { + break; // The next packet would extend beyond the end of pXmaData + } + pLastPacket += nBytesToNextPacket; + } + + // The last packet can sometimes have no seekable frames, in which case we + // have to use the previous one + if (GetXmaPacketFrameCount(pLastPacket) == 0) + { + pLastPacket -= nBytesToNextPacket; + } + + // Found the last packet. Get the bit offset of its first frame. + nFrameBitOffset = XMA_PACKET_HEADER_BITS + GetXmaPacketFirstFrameOffsetInBits(pLastPacket); + + // Traverse frames until we reach the last one + nFramesInLastPacket = GetXmaPacketFrameCount(pLastPacket); + while (--nFramesInLastPacket) + { + nFrameBitOffset += GetXmaFrameLengthInBits(pLastPacket, nFrameBitOffset); + } + + // The bit offset to return is the number of bits from pXmaData to + // pLastPacket plus the offset of the last frame in this packet. + return (DWORD)(pLastPacket - pXmaData) * 8 + nFrameBitOffset; +} + + +// GetXmaDecodePositionForSample: Obtains the information needed to make the +// decoder generate audio starting at a given sample position relative to the +// beginning of the given XMA block: the bit offset of the appropriate frame, +// and the right subframe within that frame. This data can be passed directly +// to the XMAPlaybackSetDecodePosition function. + +__inline HRESULT GetXmaDecodePositionForSample +( + __in_bcount(nXmaDataBytes) const BYTE* pXmaData, // Pointer to XMA block[s] + DWORD nXmaDataBytes, // Size of pXmaData in bytes + DWORD nStreamIndex, // Stream within which to seek + DWORD nDesiredSample, // Sample sought + __out DWORD* pnBitOffset, // Returns the bit offset within pXmaData of + // the frame containing the sample sought + __out DWORD* pnSubFrame // Returns the subframe containing the sample +) +{ + DWORD nDesiredFrame = nDesiredSample / XMA_SAMPLES_PER_FRAME; + DWORD nSubFrame = (nDesiredSample % XMA_SAMPLES_PER_FRAME) / XMA_SAMPLES_PER_SUBFRAME; + DWORD nBitOffset = GetXmaFrameBitPosition(pXmaData, nXmaDataBytes, nStreamIndex, nDesiredFrame); + + XMA2DEFS_ASSERT(pnBitOffset); + XMA2DEFS_ASSERT(pnSubFrame); + + if (nBitOffset) + { + *pnBitOffset = nBitOffset; + *pnSubFrame = nSubFrame; + return S_OK; + } + else + { + return E_FAIL; + } +} + + +// GetXmaSampleRate: Obtains the legal XMA sample rate (24, 32, 44.1 or 48Khz) +// corresponding to a generic sample rate. + +__inline DWORD GetXmaSampleRate(DWORD dwGeneralRate) +{ + DWORD dwXmaRate = 48000; // Default XMA rate for all rates above 44100Hz + + if (dwGeneralRate <= 24000) dwXmaRate = 24000; + else if (dwGeneralRate <= 32000) dwXmaRate = 32000; + else if (dwGeneralRate <= 44100) dwXmaRate = 44100; + + return dwXmaRate; +} + + +// Functions to convert between WAVEFORMATEXTENSIBLE channel masks (combinations +// of the SPEAKER_xxx flags defined in audiodefs.h) and XMA channel masks (which +// are limited to eight possible speaker positions: left, right, center, low +// frequency, side left, side right, back left and back right). + +__inline DWORD GetStandardChannelMaskFromXmaMask(BYTE bXmaMask) +{ + DWORD dwStandardMask = 0; + + if (bXmaMask & XMA_SPEAKER_LEFT) dwStandardMask |= SPEAKER_FRONT_LEFT; + if (bXmaMask & XMA_SPEAKER_RIGHT) dwStandardMask |= SPEAKER_FRONT_RIGHT; + if (bXmaMask & XMA_SPEAKER_CENTER) dwStandardMask |= SPEAKER_FRONT_CENTER; + if (bXmaMask & XMA_SPEAKER_LFE) dwStandardMask |= SPEAKER_LOW_FREQUENCY; + if (bXmaMask & XMA_SPEAKER_LEFT_SURROUND) dwStandardMask |= SPEAKER_SIDE_LEFT; + if (bXmaMask & XMA_SPEAKER_RIGHT_SURROUND) dwStandardMask |= SPEAKER_SIDE_RIGHT; + if (bXmaMask & XMA_SPEAKER_LEFT_BACK) dwStandardMask |= SPEAKER_BACK_LEFT; + if (bXmaMask & XMA_SPEAKER_RIGHT_BACK) dwStandardMask |= SPEAKER_BACK_RIGHT; + + return dwStandardMask; +} + +__inline BYTE GetXmaChannelMaskFromStandardMask(DWORD dwStandardMask) +{ + BYTE bXmaMask = 0; + + if (dwStandardMask & SPEAKER_FRONT_LEFT) bXmaMask |= XMA_SPEAKER_LEFT; + if (dwStandardMask & SPEAKER_FRONT_RIGHT) bXmaMask |= XMA_SPEAKER_RIGHT; + if (dwStandardMask & SPEAKER_FRONT_CENTER) bXmaMask |= XMA_SPEAKER_CENTER; + if (dwStandardMask & SPEAKER_LOW_FREQUENCY) bXmaMask |= XMA_SPEAKER_LFE; + if (dwStandardMask & SPEAKER_SIDE_LEFT) bXmaMask |= XMA_SPEAKER_LEFT_SURROUND; + if (dwStandardMask & SPEAKER_SIDE_RIGHT) bXmaMask |= XMA_SPEAKER_RIGHT_SURROUND; + if (dwStandardMask & SPEAKER_BACK_LEFT) bXmaMask |= XMA_SPEAKER_LEFT_BACK; + if (dwStandardMask & SPEAKER_BACK_RIGHT) bXmaMask |= XMA_SPEAKER_RIGHT_BACK; + + return bXmaMask; +} + + +// LocalizeXma2Format: Modifies a XMA2WAVEFORMATEX structure in place to comply +// with the current platform's byte-ordering rules (little- or big-endian). + +__inline HRESULT LocalizeXma2Format(__inout XMA2WAVEFORMATEX* pXma2Format) +{ + #define XMASWAP2BYTES(n) ((WORD)(((n) >> 8) | (((n) & 0xff) << 8))) + #define XMASWAP4BYTES(n) ((DWORD)((n) >> 24 | (n) << 24 | ((n) & 0xff00) << 8 | ((n) & 0xff0000) >> 8)) + + if (pXma2Format->wfx.wFormatTag == WAVE_FORMAT_XMA2) + { + return S_OK; + } + else if (XMASWAP2BYTES(pXma2Format->wfx.wFormatTag) == WAVE_FORMAT_XMA2) + { + pXma2Format->wfx.wFormatTag = XMASWAP2BYTES(pXma2Format->wfx.wFormatTag); + pXma2Format->wfx.nChannels = XMASWAP2BYTES(pXma2Format->wfx.nChannels); + pXma2Format->wfx.nSamplesPerSec = XMASWAP4BYTES(pXma2Format->wfx.nSamplesPerSec); + pXma2Format->wfx.nAvgBytesPerSec = XMASWAP4BYTES(pXma2Format->wfx.nAvgBytesPerSec); + pXma2Format->wfx.nBlockAlign = XMASWAP2BYTES(pXma2Format->wfx.nBlockAlign); + pXma2Format->wfx.wBitsPerSample = XMASWAP2BYTES(pXma2Format->wfx.wBitsPerSample); + pXma2Format->wfx.cbSize = XMASWAP2BYTES(pXma2Format->wfx.cbSize); + pXma2Format->NumStreams = XMASWAP2BYTES(pXma2Format->NumStreams); + pXma2Format->ChannelMask = XMASWAP4BYTES(pXma2Format->ChannelMask); + pXma2Format->SamplesEncoded = XMASWAP4BYTES(pXma2Format->SamplesEncoded); + pXma2Format->BytesPerBlock = XMASWAP4BYTES(pXma2Format->BytesPerBlock); + pXma2Format->PlayBegin = XMASWAP4BYTES(pXma2Format->PlayBegin); + pXma2Format->PlayLength = XMASWAP4BYTES(pXma2Format->PlayLength); + pXma2Format->LoopBegin = XMASWAP4BYTES(pXma2Format->LoopBegin); + pXma2Format->LoopLength = XMASWAP4BYTES(pXma2Format->LoopLength); + pXma2Format->BlockCount = XMASWAP2BYTES(pXma2Format->BlockCount); + return S_OK; + } + else + { + return E_FAIL; // Not a recognizable XMA2 format + } + + #undef XMASWAP2BYTES + #undef XMASWAP4BYTES +} + + +#endif // #ifndef __XMA2DEFS_INCLUDED__ diff --git a/MediaClient/MediaClient/directx/include/xnamath.h b/MediaClient/MediaClient/directx/include/xnamath.h new file mode 100644 index 0000000..daaba0b --- /dev/null +++ b/MediaClient/MediaClient/directx/include/xnamath.h @@ -0,0 +1,2938 @@ +/*++ + +Copyright (c) Microsoft Corporation. All rights reserved. + +Module Name: + + xnamath.h + +Abstract: + + XNA math library for Windows and Xbox 360 +--*/ + +#if defined(_MSC_VER) && (_MSC_VER > 1000) +#pragma once +#endif + +#ifndef __XNAMATH_H__ +#define __XNAMATH_H__ + +#ifdef __XBOXMATH_H__ +#error XNAMATH and XBOXMATH are incompatible in the same compilation module. Use one or the other. +#endif + +#define XNAMATH_VERSION 203 + +#if !defined(_XM_X64_) && !defined(_XM_X86_) +#if defined(_M_AMD64) || defined(_AMD64_) +#define _XM_X64_ +#elif defined(_M_IX86) || defined(_X86_) +#define _XM_X86_ +#endif +#endif + +#if !defined(_XM_BIGENDIAN_) && !defined(_XM_LITTLEENDIAN_) +#if defined(_XM_X64_) || defined(_XM_X86_) +#define _XM_LITTLEENDIAN_ +#elif defined(_XBOX_VER) +#define _XM_BIGENDIAN_ +#else +#error xnamath.h only supports x86, x64, or XBox 360 targets +#endif +#endif + +#if defined(_XM_X86_) || defined(_XM_X64_) +#define _XM_SSE_INTRINSICS_ +#if !defined(__cplusplus) && !defined(_XM_NO_INTRINSICS_) +#error xnamath.h only supports C compliation for Xbox 360 targets and no intrinsics cases for x86/x64 +#endif +#elif defined(_XBOX_VER) +#if !defined(__VMX128_SUPPORTED) && !defined(_XM_NO_INTRINSICS_) +#error xnamath.h requires VMX128 compiler support for XBOX 360 +#endif // !__VMX128_SUPPORTED && !_XM_NO_INTRINSICS_ +#define _XM_VMX128_INTRINSICS_ +#else +#error xnamath.h only supports x86, x64, or XBox 360 targets +#endif + + +#if defined(_XM_SSE_INTRINSICS_) +#ifndef _XM_NO_INTRINSICS_ +#include +#include +#endif +#elif defined(_XM_VMX128_INTRINSICS_) +#error This version of xnamath.h is for Windows use only +#endif + +#if defined(_XM_SSE_INTRINSICS_) +#pragma warning(push) +#pragma warning(disable:4985) +#endif +#include +#if defined(_XM_SSE_INTRINSICS_) +#pragma warning(pop) +#endif + +#include + +#if !defined(XMINLINE) +#if !defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#define XMINLINE __inline +#else +#define XMINLINE __forceinline +#endif +#endif + +#if !defined(XMFINLINE) +#define XMFINLINE __forceinline +#endif + +#if !defined(XMDEBUG) +#if defined(_DEBUG) +#define XMDEBUG +#endif +#endif // !XMDEBUG + +#if !defined(XMASSERT) +#if defined(_PREFAST_) +#define XMASSERT(Expression) __analysis_assume((Expression)) +#elif defined(XMDEBUG) // !_PREFAST_ +#define XMASSERT(Expression) ((VOID)((Expression) || (XMAssert(#Expression, __FILE__, __LINE__), 0))) +#else // !XMDEBUG +#define XMASSERT(Expression) ((VOID)0) +#endif // !XMDEBUG +#endif // !XMASSERT + +#if !defined(XM_NO_ALIGNMENT) +#define _DECLSPEC_ALIGN_16_ __declspec(align(16)) +#else +#define _DECLSPEC_ALIGN_16_ +#endif + + +#if defined(_MSC_VER) && (_MSC_VER<1500) && (_MSC_VER>=1400) +#define _XM_ISVS2005_ +#endif + +/**************************************************************************** + * + * Constant definitions + * + ****************************************************************************/ + +#define XM_PI 3.141592654f +#define XM_2PI 6.283185307f +#define XM_1DIVPI 0.318309886f +#define XM_1DIV2PI 0.159154943f +#define XM_PIDIV2 1.570796327f +#define XM_PIDIV4 0.785398163f + +#define XM_SELECT_0 0x00000000 +#define XM_SELECT_1 0xFFFFFFFF + +#define XM_PERMUTE_0X 0x00010203 +#define XM_PERMUTE_0Y 0x04050607 +#define XM_PERMUTE_0Z 0x08090A0B +#define XM_PERMUTE_0W 0x0C0D0E0F +#define XM_PERMUTE_1X 0x10111213 +#define XM_PERMUTE_1Y 0x14151617 +#define XM_PERMUTE_1Z 0x18191A1B +#define XM_PERMUTE_1W 0x1C1D1E1F + +#define XM_CRMASK_CR6 0x000000F0 +#define XM_CRMASK_CR6TRUE 0x00000080 +#define XM_CRMASK_CR6FALSE 0x00000020 +#define XM_CRMASK_CR6BOUNDS XM_CRMASK_CR6FALSE + +#define XM_CACHE_LINE_SIZE 64 + +/**************************************************************************** + * + * Macros + * + ****************************************************************************/ + +// Unit conversion + +XMFINLINE FLOAT XMConvertToRadians(FLOAT fDegrees) { return fDegrees * (XM_PI / 180.0f); } +XMFINLINE FLOAT XMConvertToDegrees(FLOAT fRadians) { return fRadians * (180.0f / XM_PI); } + +// Condition register evaluation proceeding a recording (Rc) comparison + +#define XMComparisonAllTrue(CR) (((CR) & XM_CRMASK_CR6TRUE) == XM_CRMASK_CR6TRUE) +#define XMComparisonAnyTrue(CR) (((CR) & XM_CRMASK_CR6FALSE) != XM_CRMASK_CR6FALSE) +#define XMComparisonAllFalse(CR) (((CR) & XM_CRMASK_CR6FALSE) == XM_CRMASK_CR6FALSE) +#define XMComparisonAnyFalse(CR) (((CR) & XM_CRMASK_CR6TRUE) != XM_CRMASK_CR6TRUE) +#define XMComparisonMixed(CR) (((CR) & XM_CRMASK_CR6) == 0) +#define XMComparisonAllInBounds(CR) (((CR) & XM_CRMASK_CR6BOUNDS) == XM_CRMASK_CR6BOUNDS) +#define XMComparisonAnyOutOfBounds(CR) (((CR) & XM_CRMASK_CR6BOUNDS) != XM_CRMASK_CR6BOUNDS) + + +#define XMMin(a, b) (((a) < (b)) ? (a) : (b)) +#define XMMax(a, b) (((a) > (b)) ? (a) : (b)) + +/**************************************************************************** + * + * Data types + * + ****************************************************************************/ + +#pragma warning(push) +#pragma warning(disable:4201 4365 4324) + +#if !defined (_XM_X86_) && !defined(_XM_X64_) +#pragma bitfield_order(push) +#pragma bitfield_order(lsb_to_msb) +#endif // !_XM_X86_ && !_XM_X64_ + +#if defined(_XM_NO_INTRINSICS_) && !defined(_XBOX_VER) +// The __vector4 structure is an intrinsic on Xbox but must be separately defined +// for x86/x64 +typedef struct __vector4 +{ + union + { + float vector4_f32[4]; + unsigned int vector4_u32[4]; +#ifndef XM_STRICT_VECTOR4 + struct + { + FLOAT x; + FLOAT y; + FLOAT z; + FLOAT w; + }; + FLOAT v[4]; + UINT u[4]; +#endif // !XM_STRICT_VECTOR4 + }; +} __vector4; +#endif // _XM_NO_INTRINSICS_ + +#if (defined (_XM_X86_) || defined(_XM_X64_)) && defined(_XM_NO_INTRINSICS_) +typedef UINT __vector4i[4]; +#else +typedef __declspec(align(16)) UINT __vector4i[4]; +#endif + +// Vector intrinsic: Four 32 bit floating point components aligned on a 16 byte +// boundary and mapped to hardware vector registers +#if defined(_XM_SSE_INTRINSICS_) && !defined(_XM_NO_INTRINSICS_) +typedef __m128 XMVECTOR; +#else +typedef __vector4 XMVECTOR; +#endif + +// Conversion types for constants +typedef _DECLSPEC_ALIGN_16_ struct XMVECTORF32 { + union { + float f[4]; + XMVECTOR v; + }; + +#if defined(__cplusplus) + inline operator XMVECTOR() const { return v; } +#if !defined(_XM_NO_INTRINSICS_) && defined(_XM_SSE_INTRINSICS_) + inline operator __m128i() const { return reinterpret_cast(&v)[0]; } + inline operator __m128d() const { return reinterpret_cast(&v)[0]; } +#endif +#endif // __cplusplus +} XMVECTORF32; + +typedef _DECLSPEC_ALIGN_16_ struct XMVECTORI32 { + union { + INT i[4]; + XMVECTOR v; + }; +#if defined(__cplusplus) + inline operator XMVECTOR() const { return v; } +#if !defined(_XM_NO_INTRINSICS_) && defined(_XM_SSE_INTRINSICS_) + inline operator __m128i() const { return reinterpret_cast(&v)[0]; } + inline operator __m128d() const { return reinterpret_cast(&v)[0]; } +#endif +#endif // __cplusplus +} XMVECTORI32; + +typedef _DECLSPEC_ALIGN_16_ struct XMVECTORU8 { + union { + BYTE u[16]; + XMVECTOR v; + }; +#if defined(__cplusplus) + inline operator XMVECTOR() const { return v; } +#if !defined(_XM_NO_INTRINSICS_) && defined(_XM_SSE_INTRINSICS_) + inline operator __m128i() const { return reinterpret_cast(&v)[0]; } + inline operator __m128d() const { return reinterpret_cast(&v)[0]; } +#endif +#endif // __cplusplus +} XMVECTORU8; + +typedef _DECLSPEC_ALIGN_16_ struct XMVECTORU32 { + union { + UINT u[4]; + XMVECTOR v; + }; +#if defined(__cplusplus) + inline operator XMVECTOR() const { return v; } +#if !defined(_XM_NO_INTRINSICS_) && defined(_XM_SSE_INTRINSICS_) + inline operator __m128i() const { return reinterpret_cast(&v)[0]; } + inline operator __m128d() const { return reinterpret_cast(&v)[0]; } +#endif +#endif // __cplusplus +} XMVECTORU32; + +// Fix-up for (1st-3rd) XMVECTOR parameters that are pass-in-register for x86 and Xbox 360, but not for other targets +#if defined(_XM_VMX128_INTRINSICS_) && !defined(_XM_NO_INTRINSICS_) +typedef const XMVECTOR FXMVECTOR; +#elif defined(_XM_X86_) && !defined(_XM_NO_INTRINSICS_) +typedef const XMVECTOR FXMVECTOR; +#elif defined(__cplusplus) +typedef const XMVECTOR& FXMVECTOR; +#else +typedef const XMVECTOR FXMVECTOR; +#endif + +// Fix-up for (4th+) XMVECTOR parameters to pass in-register for Xbox 360 and by reference otherwise +#if defined(_XM_VMX128_INTRINSICS_) && !defined(_XM_NO_INTRINSICS_) +typedef const XMVECTOR CXMVECTOR; +#elif defined(__cplusplus) +typedef const XMVECTOR& CXMVECTOR; +#else +typedef const XMVECTOR CXMVECTOR; +#endif + +// Vector operators +#if defined(__cplusplus) && !defined(XM_NO_OPERATOR_OVERLOADS) + +XMVECTOR operator+ (FXMVECTOR V); +XMVECTOR operator- (FXMVECTOR V); + +XMVECTOR& operator+= (XMVECTOR& V1, FXMVECTOR V2); +XMVECTOR& operator-= (XMVECTOR& V1, FXMVECTOR V2); +XMVECTOR& operator*= (XMVECTOR& V1, FXMVECTOR V2); +XMVECTOR& operator/= (XMVECTOR& V1, FXMVECTOR V2); +XMVECTOR& operator*= (XMVECTOR& V, FLOAT S); +XMVECTOR& operator/= (XMVECTOR& V, FLOAT S); + +XMVECTOR operator+ (FXMVECTOR V1, FXMVECTOR V2); +XMVECTOR operator- (FXMVECTOR V1, FXMVECTOR V2); +XMVECTOR operator* (FXMVECTOR V1, FXMVECTOR V2); +XMVECTOR operator/ (FXMVECTOR V1, FXMVECTOR V2); +XMVECTOR operator* (FXMVECTOR V, FLOAT S); +XMVECTOR operator* (FLOAT S, FXMVECTOR V); +XMVECTOR operator/ (FXMVECTOR V, FLOAT S); + +#endif // __cplusplus && !XM_NO_OPERATOR_OVERLOADS + +// Matrix type: Sixteen 32 bit floating point components aligned on a +// 16 byte boundary and mapped to four hardware vector registers +#if (defined(_XM_X86_) || defined(_XM_X64_)) && defined(_XM_NO_INTRINSICS_) +typedef struct _XMMATRIX +#else +typedef _DECLSPEC_ALIGN_16_ struct _XMMATRIX +#endif +{ + union + { + XMVECTOR r[4]; + struct + { + FLOAT _11, _12, _13, _14; + FLOAT _21, _22, _23, _24; + FLOAT _31, _32, _33, _34; + FLOAT _41, _42, _43, _44; + }; + FLOAT m[4][4]; + }; + +#ifdef __cplusplus + + _XMMATRIX() {}; + _XMMATRIX(FXMVECTOR R0, FXMVECTOR R1, FXMVECTOR R2, CXMVECTOR R3); + _XMMATRIX(FLOAT m00, FLOAT m01, FLOAT m02, FLOAT m03, + FLOAT m10, FLOAT m11, FLOAT m12, FLOAT m13, + FLOAT m20, FLOAT m21, FLOAT m22, FLOAT m23, + FLOAT m30, FLOAT m31, FLOAT m32, FLOAT m33); + _XMMATRIX(CONST FLOAT *pArray); + + FLOAT operator() (UINT Row, UINT Column) CONST { return m[Row][Column]; } + FLOAT& operator() (UINT Row, UINT Column) { return m[Row][Column]; } + + _XMMATRIX& operator= (CONST _XMMATRIX& M); + +#ifndef XM_NO_OPERATOR_OVERLOADS + _XMMATRIX& operator*= (CONST _XMMATRIX& M); + _XMMATRIX operator* (CONST _XMMATRIX& M) CONST; +#endif // !XM_NO_OPERATOR_OVERLOADS + +#endif // __cplusplus + +} XMMATRIX; + +// Fix-up for XMMATRIX parameters to pass in-register on Xbox 360, by reference otherwise +#if defined(_XM_VMX128_INTRINSICS_) +typedef const XMMATRIX CXMMATRIX; +#elif defined(__cplusplus) +typedef const XMMATRIX& CXMMATRIX; +#else +typedef const XMMATRIX CXMMATRIX; +#endif + +// 16 bit floating point number consisting of a sign bit, a 5 bit biased +// exponent, and a 10 bit mantissa +//typedef WORD HALF; +typedef USHORT HALF; + +// 2D Vector; 32 bit floating point components +typedef struct _XMFLOAT2 +{ + FLOAT x; + FLOAT y; + +#ifdef __cplusplus + + _XMFLOAT2() {}; + _XMFLOAT2(FLOAT _x, FLOAT _y) : x(_x), y(_y) {}; + _XMFLOAT2(CONST FLOAT *pArray); + + _XMFLOAT2& operator= (CONST _XMFLOAT2& Float2); + +#endif // __cplusplus + +} XMFLOAT2; + +// 2D Vector; 32 bit floating point components aligned on a 16 byte boundary +#ifdef __cplusplus +__declspec(align(16)) struct XMFLOAT2A : public XMFLOAT2 +{ + XMFLOAT2A() : XMFLOAT2() {}; + XMFLOAT2A(FLOAT _x, FLOAT _y) : XMFLOAT2(_x, _y) {}; + XMFLOAT2A(CONST FLOAT *pArray) : XMFLOAT2(pArray) {}; + + XMFLOAT2A& operator= (CONST XMFLOAT2A& Float2); +}; +#else +typedef __declspec(align(16)) XMFLOAT2 XMFLOAT2A; +#endif // __cplusplus + +// 2D Vector; 16 bit floating point components +typedef struct _XMHALF2 +{ + HALF x; + HALF y; + +#ifdef __cplusplus + + _XMHALF2() {}; + _XMHALF2(HALF _x, HALF _y) : x(_x), y(_y) {}; + _XMHALF2(CONST HALF *pArray); + _XMHALF2(FLOAT _x, FLOAT _y); + _XMHALF2(CONST FLOAT *pArray); + + _XMHALF2& operator= (CONST _XMHALF2& Half2); + +#endif // __cplusplus + +} XMHALF2; + +// 2D Vector; 16 bit signed normalized integer components +typedef struct _XMSHORTN2 +{ + SHORT x; + SHORT y; + +#ifdef __cplusplus + + _XMSHORTN2() {}; + _XMSHORTN2(SHORT _x, SHORT _y) : x(_x), y(_y) {}; + _XMSHORTN2(CONST SHORT *pArray); + _XMSHORTN2(FLOAT _x, FLOAT _y); + _XMSHORTN2(CONST FLOAT *pArray); + + _XMSHORTN2& operator= (CONST _XMSHORTN2& ShortN2); + +#endif // __cplusplus + +} XMSHORTN2; + +// 2D Vector; 16 bit signed integer components +typedef struct _XMSHORT2 +{ + SHORT x; + SHORT y; + +#ifdef __cplusplus + + _XMSHORT2() {}; + _XMSHORT2(SHORT _x, SHORT _y) : x(_x), y(_y) {}; + _XMSHORT2(CONST SHORT *pArray); + _XMSHORT2(FLOAT _x, FLOAT _y); + _XMSHORT2(CONST FLOAT *pArray); + + _XMSHORT2& operator= (CONST _XMSHORT2& Short2); + +#endif // __cplusplus + +} XMSHORT2; + +// 2D Vector; 16 bit unsigned normalized integer components +typedef struct _XMUSHORTN2 +{ + USHORT x; + USHORT y; + +#ifdef __cplusplus + + _XMUSHORTN2() {}; + _XMUSHORTN2(USHORT _x, USHORT _y) : x(_x), y(_y) {}; + _XMUSHORTN2(CONST USHORT *pArray); + _XMUSHORTN2(FLOAT _x, FLOAT _y); + _XMUSHORTN2(CONST FLOAT *pArray); + + _XMUSHORTN2& operator= (CONST _XMUSHORTN2& UShortN2); + +#endif // __cplusplus + +} XMUSHORTN2; + +// 2D Vector; 16 bit unsigned integer components +typedef struct _XMUSHORT2 +{ + USHORT x; + USHORT y; + +#ifdef __cplusplus + + _XMUSHORT2() {}; + _XMUSHORT2(USHORT _x, USHORT _y) : x(_x), y(_y) {}; + _XMUSHORT2(CONST USHORT *pArray); + _XMUSHORT2(FLOAT _x, FLOAT _y); + _XMUSHORT2(CONST FLOAT *pArray); + + _XMUSHORT2& operator= (CONST _XMUSHORT2& UShort2); + +#endif // __cplusplus + +} XMUSHORT2; + +// 3D Vector; 32 bit floating point components +typedef struct _XMFLOAT3 +{ + FLOAT x; + FLOAT y; + FLOAT z; + +#ifdef __cplusplus + + _XMFLOAT3() {}; + _XMFLOAT3(FLOAT _x, FLOAT _y, FLOAT _z) : x(_x), y(_y), z(_z) {}; + _XMFLOAT3(CONST FLOAT *pArray); + + _XMFLOAT3& operator= (CONST _XMFLOAT3& Float3); + +#endif // __cplusplus + +} XMFLOAT3; + +// 3D Vector; 32 bit floating point components aligned on a 16 byte boundary +#ifdef __cplusplus +__declspec(align(16)) struct XMFLOAT3A : public XMFLOAT3 +{ + XMFLOAT3A() : XMFLOAT3() {}; + XMFLOAT3A(FLOAT _x, FLOAT _y, FLOAT _z) : XMFLOAT3(_x, _y, _z) {}; + XMFLOAT3A(CONST FLOAT *pArray) : XMFLOAT3(pArray) {}; + + XMFLOAT3A& operator= (CONST XMFLOAT3A& Float3); +}; +#else +typedef __declspec(align(16)) XMFLOAT3 XMFLOAT3A; +#endif // __cplusplus + +// 3D Vector; 11-11-10 bit normalized components packed into a 32 bit integer +// The normalized 3D Vector is packed into 32 bits as follows: a 10 bit signed, +// normalized integer for the z component and 11 bit signed, normalized +// integers for the x and y components. The z component is stored in the +// most significant bits and the x component in the least significant bits +// (Z10Y11X11): [32] zzzzzzzz zzyyyyyy yyyyyxxx xxxxxxxx [0] +typedef struct _XMHENDN3 +{ + union + { + struct + { + INT x : 11; // -1023/1023 to 1023/1023 + INT y : 11; // -1023/1023 to 1023/1023 + INT z : 10; // -511/511 to 511/511 + }; + UINT v; + }; + +#ifdef __cplusplus + + _XMHENDN3() {}; + _XMHENDN3(UINT Packed) : v(Packed) {}; + _XMHENDN3(FLOAT _x, FLOAT _y, FLOAT _z); + _XMHENDN3(CONST FLOAT *pArray); + + operator UINT () { return v; } + + _XMHENDN3& operator= (CONST _XMHENDN3& HenDN3); + _XMHENDN3& operator= (CONST UINT Packed); + +#endif // __cplusplus + +} XMHENDN3; + +// 3D Vector; 11-11-10 bit components packed into a 32 bit integer +// The 3D Vector is packed into 32 bits as follows: a 10 bit signed, +// integer for the z component and 11 bit signed integers for the +// x and y components. The z component is stored in the +// most significant bits and the x component in the least significant bits +// (Z10Y11X11): [32] zzzzzzzz zzyyyyyy yyyyyxxx xxxxxxxx [0] +typedef struct _XMHEND3 +{ + union + { + struct + { + INT x : 11; // -1023 to 1023 + INT y : 11; // -1023 to 1023 + INT z : 10; // -511 to 511 + }; + UINT v; + }; + +#ifdef __cplusplus + + _XMHEND3() {}; + _XMHEND3(UINT Packed) : v(Packed) {}; + _XMHEND3(FLOAT _x, FLOAT _y, FLOAT _z); + _XMHEND3(CONST FLOAT *pArray); + + operator UINT () { return v; } + + _XMHEND3& operator= (CONST _XMHEND3& HenD3); + _XMHEND3& operator= (CONST UINT Packed); + +#endif // __cplusplus + +} XMHEND3; + +// 3D Vector; 11-11-10 bit normalized components packed into a 32 bit integer +// The normalized 3D Vector is packed into 32 bits as follows: a 10 bit unsigned, +// normalized integer for the z component and 11 bit unsigned, normalized +// integers for the x and y components. The z component is stored in the +// most significant bits and the x component in the least significant bits +// (Z10Y11X11): [32] zzzzzzzz zzyyyyyy yyyyyxxx xxxxxxxx [0] +typedef struct _XMUHENDN3 +{ + union + { + struct + { + UINT x : 11; // 0/2047 to 2047/2047 + UINT y : 11; // 0/2047 to 2047/2047 + UINT z : 10; // 0/1023 to 1023/1023 + }; + UINT v; + }; + +#ifdef __cplusplus + + _XMUHENDN3() {}; + _XMUHENDN3(UINT Packed) : v(Packed) {}; + _XMUHENDN3(FLOAT _x, FLOAT _y, FLOAT _z); + _XMUHENDN3(CONST FLOAT *pArray); + + operator UINT () { return v; } + + _XMUHENDN3& operator= (CONST _XMUHENDN3& UHenDN3); + _XMUHENDN3& operator= (CONST UINT Packed); + +#endif // __cplusplus + +} XMUHENDN3; + +// 3D Vector; 11-11-10 bit components packed into a 32 bit integer +// The 3D Vector is packed into 32 bits as follows: a 10 bit unsigned +// integer for the z component and 11 bit unsigned integers +// for the x and y components. The z component is stored in the +// most significant bits and the x component in the least significant bits +// (Z10Y11X11): [32] zzzzzzzz zzyyyyyy yyyyyxxx xxxxxxxx [0] +typedef struct _XMUHEND3 +{ + union + { + struct + { + UINT x : 11; // 0 to 2047 + UINT y : 11; // 0 to 2047 + UINT z : 10; // 0 to 1023 + }; + UINT v; + }; + +#ifdef __cplusplus + + _XMUHEND3() {}; + _XMUHEND3(UINT Packed) : v(Packed) {}; + _XMUHEND3(FLOAT _x, FLOAT _y, FLOAT _z); + _XMUHEND3(CONST FLOAT *pArray); + + operator UINT () { return v; } + + _XMUHEND3& operator= (CONST _XMUHEND3& UHenD3); + _XMUHEND3& operator= (CONST UINT Packed); + +#endif // __cplusplus + +} XMUHEND3; + +// 3D Vector; 10-11-11 bit normalized components packed into a 32 bit integer +// The normalized 3D Vector is packed into 32 bits as follows: a 10 bit signed, +// normalized integer for the x component and 11 bit signed, normalized +// integers for the y and z components. The z component is stored in the +// most significant bits and the x component in the least significant bits +// (Z11Y11X10): [32] zzzzzzzz zzzyyyyy yyyyyyxx xxxxxxxx [0] +typedef struct _XMDHENN3 +{ + union + { + struct + { + INT x : 10; // -511/511 to 511/511 + INT y : 11; // -1023/1023 to 1023/1023 + INT z : 11; // -1023/1023 to 1023/1023 + }; + UINT v; + }; + +#ifdef __cplusplus + + _XMDHENN3() {}; + _XMDHENN3(UINT Packed) : v(Packed) {}; + _XMDHENN3(FLOAT _x, FLOAT _y, FLOAT _z); + _XMDHENN3(CONST FLOAT *pArray); + + operator UINT () { return v; } + + _XMDHENN3& operator= (CONST _XMDHENN3& DHenN3); + _XMDHENN3& operator= (CONST UINT Packed); + +#endif // __cplusplus + +} XMDHENN3; + +// 3D Vector; 10-11-11 bit components packed into a 32 bit integer +// The 3D Vector is packed into 32 bits as follows: a 10 bit signed, +// integer for the x component and 11 bit signed integers for the +// y and z components. The w component is stored in the +// most significant bits and the x component in the least significant bits +// (Z11Y11X10): [32] zzzzzzzz zzzyyyyy yyyyyyxx xxxxxxxx [0] +typedef struct _XMDHEN3 +{ + union + { + struct + { + INT x : 10; // -511 to 511 + INT y : 11; // -1023 to 1023 + INT z : 11; // -1023 to 1023 + }; + UINT v; + }; + +#ifdef __cplusplus + + _XMDHEN3() {}; + _XMDHEN3(UINT Packed) : v(Packed) {}; + _XMDHEN3(FLOAT _x, FLOAT _y, FLOAT _z); + _XMDHEN3(CONST FLOAT *pArray); + + operator UINT () { return v; } + + _XMDHEN3& operator= (CONST _XMDHEN3& DHen3); + _XMDHEN3& operator= (CONST UINT Packed); + +#endif // __cplusplus + +} XMDHEN3; + +// 3D Vector; 10-11-11 bit normalized components packed into a 32 bit integer +// The normalized 3D Vector is packed into 32 bits as follows: a 10 bit unsigned, +// normalized integer for the x component and 11 bit unsigned, normalized +// integers for the y and z components. The w component is stored in the +// most significant bits and the x component in the least significant bits +// (Z11Y11X10): [32] zzzzzzzz zzzyyyyy yyyyyyxx xxxxxxxx [0] +typedef struct _XMUDHENN3 +{ + union + { + struct + { + UINT x : 10; // 0/1023 to 1023/1023 + UINT y : 11; // 0/2047 to 2047/2047 + UINT z : 11; // 0/2047 to 2047/2047 + }; + UINT v; + }; + +#ifdef __cplusplus + + _XMUDHENN3() {}; + _XMUDHENN3(UINT Packed) : v(Packed) {}; + _XMUDHENN3(FLOAT _x, FLOAT _y, FLOAT _z); + _XMUDHENN3(CONST FLOAT *pArray); + + operator UINT () { return v; } + + _XMUDHENN3& operator= (CONST _XMUDHENN3& UDHenN3); + _XMUDHENN3& operator= (CONST UINT Packed); + +#endif // __cplusplus + +} XMUDHENN3; + +// 3D Vector; 10-11-11 bit components packed into a 32 bit integer +// The 3D Vector is packed into 32 bits as follows: a 10 bit unsigned, +// integer for the x component and 11 bit unsigned integers +// for the y and z components. The w component is stored in the +// most significant bits and the x component in the least significant bits +// (Z11Y11X10): [32] zzzzzzzz zzzyyyyy yyyyyyxx xxxxxxxx [0] +typedef struct _XMUDHEN3 +{ + union + { + struct + { + UINT x : 10; // 0 to 1023 + UINT y : 11; // 0 to 2047 + UINT z : 11; // 0 to 2047 + }; + UINT v; + }; + +#ifdef __cplusplus + + _XMUDHEN3() {}; + _XMUDHEN3(UINT Packed) : v(Packed) {}; + _XMUDHEN3(FLOAT _x, FLOAT _y, FLOAT _z); + _XMUDHEN3(CONST FLOAT *pArray); + + operator UINT () { return v; } + + _XMUDHEN3& operator= (CONST _XMUDHEN3& UDHen3); + _XMUDHEN3& operator= (CONST UINT Packed); + +#endif // __cplusplus + +} XMUDHEN3; + +// 3D vector: 5/6/5 unsigned integer components +typedef struct _XMU565 +{ + union + { + struct + { + USHORT x : 5; + USHORT y : 6; + USHORT z : 5; + }; + USHORT v; + }; + +#ifdef __cplusplus + + _XMU565() {}; + _XMU565(USHORT Packed) : v(Packed) {}; + _XMU565(CHAR _x, CHAR _y, CHAR _z) : x(_x), y(_y), z(_z) {}; + _XMU565(CONST CHAR *pArray); + _XMU565(FLOAT _x, FLOAT _y, FLOAT _z); + _XMU565(CONST FLOAT *pArray); + + operator USHORT () { return v; } + + _XMU565& operator= (CONST _XMU565& U565); + _XMU565& operator= (CONST USHORT Packed); + +#endif // __cplusplus + +} XMU565; + +// 3D vector: 11/11/10 floating-point components +// The 3D vector is packed into 32 bits as follows: a 5-bit biased exponent +// and 6-bit mantissa for x component, a 5-bit biased exponent and +// 6-bit mantissa for y component, a 5-bit biased exponent and a 5-bit +// mantissa for z. The z component is stored in the most significant bits +// and the x component in the least significant bits. No sign bits so +// all partial-precision numbers are positive. +// (Z10Y11X11): [32] ZZZZZzzz zzzYYYYY yyyyyyXX XXXxxxxx [0] +typedef struct _XMFLOAT3PK +{ + union + { + struct + { + UINT xm : 6; + UINT xe : 5; + UINT ym : 6; + UINT ye : 5; + UINT zm : 5; + UINT ze : 5; + }; + UINT v; + }; + +#ifdef __cplusplus + + _XMFLOAT3PK() {}; + _XMFLOAT3PK(UINT Packed) : v(Packed) {}; + _XMFLOAT3PK(FLOAT _x, FLOAT _y, FLOAT _z); + _XMFLOAT3PK(CONST FLOAT *pArray); + + operator UINT () { return v; } + + _XMFLOAT3PK& operator= (CONST _XMFLOAT3PK& float3pk); + _XMFLOAT3PK& operator= (CONST UINT Packed); + +#endif // __cplusplus + +} XMFLOAT3PK; + +// 3D vector: 9/9/9 floating-point components with shared 5-bit exponent +// The 3D vector is packed into 32 bits as follows: a 5-bit biased exponent +// with 9-bit mantissa for the x, y, and z component. The shared exponent +// is stored in the most significant bits and the x component mantissa is in +// the least significant bits. No sign bits so all partial-precision numbers +// are positive. +// (E5Z9Y9X9): [32] EEEEEzzz zzzzzzyy yyyyyyyx xxxxxxxx [0] +typedef struct _XMFLOAT3SE +{ + union + { + struct + { + UINT xm : 9; + UINT ym : 9; + UINT zm : 9; + UINT e : 5; + }; + UINT v; + }; + +#ifdef __cplusplus + + _XMFLOAT3SE() {}; + _XMFLOAT3SE(UINT Packed) : v(Packed) {}; + _XMFLOAT3SE(FLOAT _x, FLOAT _y, FLOAT _z); + _XMFLOAT3SE(CONST FLOAT *pArray); + + operator UINT () { return v; } + + _XMFLOAT3SE& operator= (CONST _XMFLOAT3SE& float3se); + _XMFLOAT3SE& operator= (CONST UINT Packed); + +#endif // __cplusplus + +} XMFLOAT3SE; + +// 4D Vector; 32 bit floating point components +typedef struct _XMFLOAT4 +{ + FLOAT x; + FLOAT y; + FLOAT z; + FLOAT w; + +#ifdef __cplusplus + + _XMFLOAT4() {}; + _XMFLOAT4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w) : x(_x), y(_y), z(_z), w(_w) {}; + _XMFLOAT4(CONST FLOAT *pArray); + + _XMFLOAT4& operator= (CONST _XMFLOAT4& Float4); + +#endif // __cplusplus + +} XMFLOAT4; + +// 4D Vector; 32 bit floating point components aligned on a 16 byte boundary +#ifdef __cplusplus +__declspec(align(16)) struct XMFLOAT4A : public XMFLOAT4 +{ + XMFLOAT4A() : XMFLOAT4() {}; + XMFLOAT4A(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w) : XMFLOAT4(_x, _y, _z, _w) {}; + XMFLOAT4A(CONST FLOAT *pArray) : XMFLOAT4(pArray) {}; + + XMFLOAT4A& operator= (CONST XMFLOAT4A& Float4); +}; +#else +typedef __declspec(align(16)) XMFLOAT4 XMFLOAT4A; +#endif // __cplusplus + +// 4D Vector; 16 bit floating point components +typedef struct _XMHALF4 +{ + HALF x; + HALF y; + HALF z; + HALF w; + +#ifdef __cplusplus + + _XMHALF4() {}; + _XMHALF4(HALF _x, HALF _y, HALF _z, HALF _w) : x(_x), y(_y), z(_z), w(_w) {}; + _XMHALF4(CONST HALF *pArray); + _XMHALF4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w); + _XMHALF4(CONST FLOAT *pArray); + + _XMHALF4& operator= (CONST _XMHALF4& Half4); + +#endif // __cplusplus + +} XMHALF4; + +// 4D Vector; 16 bit signed normalized integer components +typedef struct _XMSHORTN4 +{ + SHORT x; + SHORT y; + SHORT z; + SHORT w; + +#ifdef __cplusplus + + _XMSHORTN4() {}; + _XMSHORTN4(SHORT _x, SHORT _y, SHORT _z, SHORT _w) : x(_x), y(_y), z(_z), w(_w) {}; + _XMSHORTN4(CONST SHORT *pArray); + _XMSHORTN4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w); + _XMSHORTN4(CONST FLOAT *pArray); + + _XMSHORTN4& operator= (CONST _XMSHORTN4& ShortN4); + +#endif // __cplusplus + +} XMSHORTN4; + +// 4D Vector; 16 bit signed integer components +typedef struct _XMSHORT4 +{ + SHORT x; + SHORT y; + SHORT z; + SHORT w; + +#ifdef __cplusplus + + _XMSHORT4() {}; + _XMSHORT4(SHORT _x, SHORT _y, SHORT _z, SHORT _w) : x(_x), y(_y), z(_z), w(_w) {}; + _XMSHORT4(CONST SHORT *pArray); + _XMSHORT4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w); + _XMSHORT4(CONST FLOAT *pArray); + + _XMSHORT4& operator= (CONST _XMSHORT4& Short4); + +#endif // __cplusplus + +} XMSHORT4; + +// 4D Vector; 16 bit unsigned normalized integer components +typedef struct _XMUSHORTN4 +{ + USHORT x; + USHORT y; + USHORT z; + USHORT w; + +#ifdef __cplusplus + + _XMUSHORTN4() {}; + _XMUSHORTN4(USHORT _x, USHORT _y, USHORT _z, USHORT _w) : x(_x), y(_y), z(_z), w(_w) {}; + _XMUSHORTN4(CONST USHORT *pArray); + _XMUSHORTN4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w); + _XMUSHORTN4(CONST FLOAT *pArray); + + _XMUSHORTN4& operator= (CONST _XMUSHORTN4& UShortN4); + +#endif // __cplusplus + +} XMUSHORTN4; + +// 4D Vector; 16 bit unsigned integer components +typedef struct _XMUSHORT4 +{ + USHORT x; + USHORT y; + USHORT z; + USHORT w; + +#ifdef __cplusplus + + _XMUSHORT4() {}; + _XMUSHORT4(USHORT _x, USHORT _y, USHORT _z, USHORT _w) : x(_x), y(_y), z(_z), w(_w) {}; + _XMUSHORT4(CONST USHORT *pArray); + _XMUSHORT4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w); + _XMUSHORT4(CONST FLOAT *pArray); + + _XMUSHORT4& operator= (CONST _XMUSHORT4& UShort4); + +#endif // __cplusplus + +} XMUSHORT4; + +// 4D Vector; 10-10-10-2 bit normalized components packed into a 32 bit integer +// The normalized 4D Vector is packed into 32 bits as follows: a 2 bit unsigned, +// normalized integer for the w component and 10 bit signed, normalized +// integers for the z, y, and x components. The w component is stored in the +// most significant bits and the x component in the least significant bits +// (W2Z10Y10X10): [32] wwzzzzzz zzzzyyyy yyyyyyxx xxxxxxxx [0] +typedef struct _XMXDECN4 +{ + union + { + struct + { + INT x : 10; // -511/511 to 511/511 + INT y : 10; // -511/511 to 511/511 + INT z : 10; // -511/511 to 511/511 + UINT w : 2; // 0/3 to 3/3 + }; + UINT v; + }; + +#ifdef __cplusplus + + _XMXDECN4() {}; + _XMXDECN4(UINT Packed) : v(Packed) {}; + _XMXDECN4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w); + _XMXDECN4(CONST FLOAT *pArray); + + operator UINT () { return v; } + + _XMXDECN4& operator= (CONST _XMXDECN4& XDecN4); + _XMXDECN4& operator= (CONST UINT Packed); + +#endif // __cplusplus + +} XMXDECN4; + +// 4D Vector; 10-10-10-2 bit components packed into a 32 bit integer +// The normalized 4D Vector is packed into 32 bits as follows: a 2 bit unsigned +// integer for the w component and 10 bit signed integers for the +// z, y, and x components. The w component is stored in the +// most significant bits and the x component in the least significant bits +// (W2Z10Y10X10): [32] wwzzzzzz zzzzyyyy yyyyyyxx xxxxxxxx [0] +typedef struct _XMXDEC4 +{ + union + { + struct + { + INT x : 10; // -511 to 511 + INT y : 10; // -511 to 511 + INT z : 10; // -511 to 511 + UINT w : 2; // 0 to 3 + }; + UINT v; + }; + +#ifdef __cplusplus + + _XMXDEC4() {}; + _XMXDEC4(UINT Packed) : v(Packed) {}; + _XMXDEC4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w); + _XMXDEC4(CONST FLOAT *pArray); + + operator UINT () { return v; } + + _XMXDEC4& operator= (CONST _XMXDEC4& XDec4); + _XMXDEC4& operator= (CONST UINT Packed); + +#endif // __cplusplus + +} XMXDEC4; + +// 4D Vector; 10-10-10-2 bit normalized components packed into a 32 bit integer +// The normalized 4D Vector is packed into 32 bits as follows: a 2 bit signed, +// normalized integer for the w component and 10 bit signed, normalized +// integers for the z, y, and x components. The w component is stored in the +// most significant bits and the x component in the least significant bits +// (W2Z10Y10X10): [32] wwzzzzzz zzzzyyyy yyyyyyxx xxxxxxxx [0] +typedef struct _XMDECN4 +{ + union + { + struct + { + INT x : 10; // -511/511 to 511/511 + INT y : 10; // -511/511 to 511/511 + INT z : 10; // -511/511 to 511/511 + INT w : 2; // -1/1 to 1/1 + }; + UINT v; + }; + +#ifdef __cplusplus + + _XMDECN4() {}; + _XMDECN4(UINT Packed) : v(Packed) {}; + _XMDECN4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w); + _XMDECN4(CONST FLOAT *pArray); + + operator UINT () { return v; } + + _XMDECN4& operator= (CONST _XMDECN4& DecN4); + _XMDECN4& operator= (CONST UINT Packed); + +#endif // __cplusplus + +} XMDECN4; + +// 4D Vector; 10-10-10-2 bit components packed into a 32 bit integer +// The 4D Vector is packed into 32 bits as follows: a 2 bit signed, +// integer for the w component and 10 bit signed integers for the +// z, y, and x components. The w component is stored in the +// most significant bits and the x component in the least significant bits +// (W2Z10Y10X10): [32] wwzzzzzz zzzzyyyy yyyyyyxx xxxxxxxx [0] +typedef struct _XMDEC4 +{ + union + { + struct + { + INT x : 10; // -511 to 511 + INT y : 10; // -511 to 511 + INT z : 10; // -511 to 511 + INT w : 2; // -1 to 1 + }; + UINT v; + }; + +#ifdef __cplusplus + + _XMDEC4() {}; + _XMDEC4(UINT Packed) : v(Packed) {}; + _XMDEC4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w); + _XMDEC4(CONST FLOAT *pArray); + + operator UINT () { return v; } + + _XMDEC4& operator= (CONST _XMDEC4& Dec4); + _XMDEC4& operator= (CONST UINT Packed); + +#endif // __cplusplus + +} XMDEC4; + +// 4D Vector; 10-10-10-2 bit normalized components packed into a 32 bit integer +// The normalized 4D Vector is packed into 32 bits as follows: a 2 bit unsigned, +// normalized integer for the w component and 10 bit unsigned, normalized +// integers for the z, y, and x components. The w component is stored in the +// most significant bits and the x component in the least significant bits +// (W2Z10Y10X10): [32] wwzzzzzz zzzzyyyy yyyyyyxx xxxxxxxx [0] +typedef struct _XMUDECN4 +{ + union + { + struct + { + UINT x : 10; // 0/1023 to 1023/1023 + UINT y : 10; // 0/1023 to 1023/1023 + UINT z : 10; // 0/1023 to 1023/1023 + UINT w : 2; // 0/3 to 3/3 + }; + UINT v; + }; + +#ifdef __cplusplus + + _XMUDECN4() {}; + _XMUDECN4(UINT Packed) : v(Packed) {}; + _XMUDECN4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w); + _XMUDECN4(CONST FLOAT *pArray); + + operator UINT () { return v; } + + _XMUDECN4& operator= (CONST _XMUDECN4& UDecN4); + _XMUDECN4& operator= (CONST UINT Packed); + +#endif // __cplusplus + +} XMUDECN4; + +// 4D Vector; 10-10-10-2 bit components packed into a 32 bit integer +// The 4D Vector is packed into 32 bits as follows: a 2 bit unsigned, +// integer for the w component and 10 bit unsigned integers +// for the z, y, and x components. The w component is stored in the +// most significant bits and the x component in the least significant bits +// (W2Z10Y10X10): [32] wwzzzzzz zzzzyyyy yyyyyyxx xxxxxxxx [0] +typedef struct _XMUDEC4 +{ + union + { + struct + { + UINT x : 10; // 0 to 1023 + UINT y : 10; // 0 to 1023 + UINT z : 10; // 0 to 1023 + UINT w : 2; // 0 to 3 + }; + UINT v; + }; + +#ifdef __cplusplus + + _XMUDEC4() {}; + _XMUDEC4(UINT Packed) : v(Packed) {}; + _XMUDEC4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w); + _XMUDEC4(CONST FLOAT *pArray); + + operator UINT () { return v; } + + _XMUDEC4& operator= (CONST _XMUDEC4& UDec4); + _XMUDEC4& operator= (CONST UINT Packed); + +#endif // __cplusplus + +} XMUDEC4; + +// 4D Vector; 20-20-20-4 bit normalized components packed into a 64 bit integer +// The normalized 4D Vector is packed into 64 bits as follows: a 4 bit unsigned, +// normalized integer for the w component and 20 bit signed, normalized +// integers for the z, y, and x components. The w component is stored in the +// most significant bits and the x component in the least significant bits +// (W4Z20Y20X20): [64] wwwwzzzz zzzzzzzz zzzzzzzz yyyyyyyy yyyyyyyy yyyyxxxx xxxxxxxx xxxxxxxx [0] +typedef struct _XMXICON4 +{ + union + { + struct + { + INT64 x : 20; // -524287/524287 to 524287/524287 + INT64 y : 20; // -524287/524287 to 524287/524287 + INT64 z : 20; // -524287/524287 to 524287/524287 + UINT64 w : 4; // 0/15 to 15/15 + }; + UINT64 v; + }; + +#ifdef __cplusplus + + _XMXICON4() {}; + _XMXICON4(UINT64 Packed) : v(Packed) {}; + _XMXICON4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w); + _XMXICON4(CONST FLOAT *pArray); + + operator UINT64 () { return v; } + + _XMXICON4& operator= (CONST _XMXICON4& XIcoN4); + _XMXICON4& operator= (CONST UINT64 Packed); + +#endif // __cplusplus + +} XMXICON4; + +// 4D Vector; 20-20-20-4 bit components packed into a 64 bit integer +// The 4D Vector is packed into 64 bits as follows: a 4 bit unsigned +// integer for the w component and 20 bit signed integers for the +// z, y, and x components. The w component is stored in the +// most significant bits and the x component in the least significant bits +// (W4Z20Y20X20): [64] wwwwzzzz zzzzzzzz zzzzzzzz yyyyyyyy yyyyyyyy yyyyxxxx xxxxxxxx xxxxxxxx [0] +typedef struct _XMXICO4 +{ + union + { + struct + { + INT64 x : 20; // -524287 to 524287 + INT64 y : 20; // -524287 to 524287 + INT64 z : 20; // -524287 to 524287 + UINT64 w : 4; // 0 to 15 + }; + UINT64 v; + }; + +#ifdef __cplusplus + + _XMXICO4() {}; + _XMXICO4(UINT64 Packed) : v(Packed) {}; + _XMXICO4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w); + _XMXICO4(CONST FLOAT *pArray); + + operator UINT64 () { return v; } + + _XMXICO4& operator= (CONST _XMXICO4& XIco4); + _XMXICO4& operator= (CONST UINT64 Packed); + +#endif // __cplusplus + +} XMXICO4; + +// 4D Vector; 20-20-20-4 bit normalized components packed into a 64 bit integer +// The normalized 4D Vector is packed into 64 bits as follows: a 4 bit signed, +// normalized integer for the w component and 20 bit signed, normalized +// integers for the z, y, and x components. The w component is stored in the +// most significant bits and the x component in the least significant bits +// (W4Z20Y20X20): [64] wwwwzzzz zzzzzzzz zzzzzzzz yyyyyyyy yyyyyyyy yyyyxxxx xxxxxxxx xxxxxxxx [0] +typedef struct _XMICON4 +{ + union + { + struct + { + INT64 x : 20; // -524287/524287 to 524287/524287 + INT64 y : 20; // -524287/524287 to 524287/524287 + INT64 z : 20; // -524287/524287 to 524287/524287 + INT64 w : 4; // -7/7 to 7/7 + }; + UINT64 v; + }; + +#ifdef __cplusplus + + _XMICON4() {}; + _XMICON4(UINT64 Packed) : v(Packed) {}; + _XMICON4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w); + _XMICON4(CONST FLOAT *pArray); + + operator UINT64 () { return v; } + + _XMICON4& operator= (CONST _XMICON4& IcoN4); + _XMICON4& operator= (CONST UINT64 Packed); + +#endif // __cplusplus + +} XMICON4; + +// 4D Vector; 20-20-20-4 bit components packed into a 64 bit integer +// The 4D Vector is packed into 64 bits as follows: a 4 bit signed, +// integer for the w component and 20 bit signed integers for the +// z, y, and x components. The w component is stored in the +// most significant bits and the x component in the least significant bits +// (W4Z20Y20X20): [64] wwwwzzzz zzzzzzzz zzzzzzzz yyyyyyyy yyyyyyyy yyyyxxxx xxxxxxxx xxxxxxxx [0] +typedef struct _XMICO4 +{ + union + { + struct + { + INT64 x : 20; // -524287 to 524287 + INT64 y : 20; // -524287 to 524287 + INT64 z : 20; // -524287 to 524287 + INT64 w : 4; // -7 to 7 + }; + UINT64 v; + }; + +#ifdef __cplusplus + + _XMICO4() {}; + _XMICO4(UINT64 Packed) : v(Packed) {}; + _XMICO4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w); + _XMICO4(CONST FLOAT *pArray); + + operator UINT64 () { return v; } + + _XMICO4& operator= (CONST _XMICO4& Ico4); + _XMICO4& operator= (CONST UINT64 Packed); + +#endif // __cplusplus + +} XMICO4; + +// 4D Vector; 20-20-20-4 bit normalized components packed into a 64 bit integer +// The normalized 4D Vector is packed into 64 bits as follows: a 4 bit unsigned, +// normalized integer for the w component and 20 bit unsigned, normalized +// integers for the z, y, and x components. The w component is stored in the +// most significant bits and the x component in the least significant bits +// (W4Z20Y20X20): [64] wwwwzzzz zzzzzzzz zzzzzzzz yyyyyyyy yyyyyyyy yyyyxxxx xxxxxxxx xxxxxxxx [0] +typedef struct _XMUICON4 +{ + union + { + struct + { + UINT64 x : 20; // 0/1048575 to 1048575/1048575 + UINT64 y : 20; // 0/1048575 to 1048575/1048575 + UINT64 z : 20; // 0/1048575 to 1048575/1048575 + UINT64 w : 4; // 0/15 to 15/15 + }; + UINT64 v; + }; + +#ifdef __cplusplus + + _XMUICON4() {}; + _XMUICON4(UINT64 Packed) : v(Packed) {}; + _XMUICON4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w); + _XMUICON4(CONST FLOAT *pArray); + + operator UINT64 () { return v; } + + _XMUICON4& operator= (CONST _XMUICON4& UIcoN4); + _XMUICON4& operator= (CONST UINT64 Packed); + +#endif // __cplusplus + +} XMUICON4; + +// 4D Vector; 20-20-20-4 bit components packed into a 64 bit integer +// The 4D Vector is packed into 64 bits as follows: a 4 bit unsigned +// integer for the w component and 20 bit unsigned integers for the +// z, y, and x components. The w component is stored in the +// most significant bits and the x component in the least significant bits +// (W4Z20Y20X20): [64] wwwwzzzz zzzzzzzz zzzzzzzz yyyyyyyy yyyyyyyy yyyyxxxx xxxxxxxx xxxxxxxx [0] +typedef struct _XMUICO4 +{ + union + { + struct + { + UINT64 x : 20; // 0 to 1048575 + UINT64 y : 20; // 0 to 1048575 + UINT64 z : 20; // 0 to 1048575 + UINT64 w : 4; // 0 to 15 + }; + UINT64 v; + }; + +#ifdef __cplusplus + + _XMUICO4() {}; + _XMUICO4(UINT64 Packed) : v(Packed) {}; + _XMUICO4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w); + _XMUICO4(CONST FLOAT *pArray); + + operator UINT64 () { return v; } + + _XMUICO4& operator= (CONST _XMUICO4& UIco4); + _XMUICO4& operator= (CONST UINT64 Packed); + +#endif // __cplusplus + +} XMUICO4; + +// ARGB Color; 8-8-8-8 bit unsigned normalized integer components packed into +// a 32 bit integer. The normalized color is packed into 32 bits using 8 bit +// unsigned, normalized integers for the alpha, red, green, and blue components. +// The alpha component is stored in the most significant bits and the blue +// component in the least significant bits (A8R8G8B8): +// [32] aaaaaaaa rrrrrrrr gggggggg bbbbbbbb [0] +typedef struct _XMCOLOR +{ + union + { + struct + { + UINT b : 8; // Blue: 0/255 to 255/255 + UINT g : 8; // Green: 0/255 to 255/255 + UINT r : 8; // Red: 0/255 to 255/255 + UINT a : 8; // Alpha: 0/255 to 255/255 + }; + UINT c; + }; + +#ifdef __cplusplus + + _XMCOLOR() {}; + _XMCOLOR(UINT Color) : c(Color) {}; + _XMCOLOR(FLOAT _r, FLOAT _g, FLOAT _b, FLOAT _a); + _XMCOLOR(CONST FLOAT *pArray); + + operator UINT () { return c; } + + _XMCOLOR& operator= (CONST _XMCOLOR& Color); + _XMCOLOR& operator= (CONST UINT Color); + +#endif // __cplusplus + +} XMCOLOR; + +// 4D Vector; 8 bit signed normalized integer components +typedef struct _XMBYTEN4 +{ + union + { + struct + { + CHAR x; + CHAR y; + CHAR z; + CHAR w; + }; + UINT v; + }; + +#ifdef __cplusplus + + _XMBYTEN4() {}; + _XMBYTEN4(CHAR _x, CHAR _y, CHAR _z, CHAR _w) : x(_x), y(_y), z(_z), w(_w) {}; + _XMBYTEN4(UINT Packed) : v(Packed) {}; + _XMBYTEN4(CONST CHAR *pArray); + _XMBYTEN4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w); + _XMBYTEN4(CONST FLOAT *pArray); + + _XMBYTEN4& operator= (CONST _XMBYTEN4& ByteN4); + +#endif // __cplusplus + +} XMBYTEN4; + +// 4D Vector; 8 bit signed integer components +typedef struct _XMBYTE4 +{ + union + { + struct + { + CHAR x; + CHAR y; + CHAR z; + CHAR w; + }; + UINT v; + }; + +#ifdef __cplusplus + + _XMBYTE4() {}; + _XMBYTE4(CHAR _x, CHAR _y, CHAR _z, CHAR _w) : x(_x), y(_y), z(_z), w(_w) {}; + _XMBYTE4(UINT Packed) : v(Packed) {}; + _XMBYTE4(CONST CHAR *pArray); + _XMBYTE4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w); + _XMBYTE4(CONST FLOAT *pArray); + + _XMBYTE4& operator= (CONST _XMBYTE4& Byte4); + +#endif // __cplusplus + +} XMBYTE4; + +// 4D Vector; 8 bit unsigned normalized integer components +typedef struct _XMUBYTEN4 +{ + union + { + struct + { + BYTE x; + BYTE y; + BYTE z; + BYTE w; + }; + UINT v; + }; + +#ifdef __cplusplus + + _XMUBYTEN4() {}; + _XMUBYTEN4(BYTE _x, BYTE _y, BYTE _z, BYTE _w) : x(_x), y(_y), z(_z), w(_w) {}; + _XMUBYTEN4(UINT Packed) : v(Packed) {}; + _XMUBYTEN4(CONST BYTE *pArray); + _XMUBYTEN4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w); + _XMUBYTEN4(CONST FLOAT *pArray); + + _XMUBYTEN4& operator= (CONST _XMUBYTEN4& UByteN4); + +#endif // __cplusplus + +} XMUBYTEN4; + +// 4D Vector; 8 bit unsigned integer components +typedef struct _XMUBYTE4 +{ + union + { + struct + { + BYTE x; + BYTE y; + BYTE z; + BYTE w; + }; + UINT v; + }; + +#ifdef __cplusplus + + _XMUBYTE4() {}; + _XMUBYTE4(BYTE _x, BYTE _y, BYTE _z, BYTE _w) : x(_x), y(_y), z(_z), w(_w) {}; + _XMUBYTE4(UINT Packed) : v(Packed) {}; + _XMUBYTE4(CONST BYTE *pArray); + _XMUBYTE4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w); + _XMUBYTE4(CONST FLOAT *pArray); + + _XMUBYTE4& operator= (CONST _XMUBYTE4& UByte4); + +#endif // __cplusplus + +} XMUBYTE4; + +// 4D vector; 4 bit unsigned integer components +typedef struct _XMUNIBBLE4 +{ + union + { + struct + { + USHORT x : 4; + USHORT y : 4; + USHORT z : 4; + USHORT w : 4; + }; + USHORT v; + }; + +#ifdef __cplusplus + + _XMUNIBBLE4() {}; + _XMUNIBBLE4(USHORT Packed) : v(Packed) {}; + _XMUNIBBLE4(CHAR _x, CHAR _y, CHAR _z, CHAR _w) : x(_x), y(_y), z(_z), w(_w) {}; + _XMUNIBBLE4(CONST CHAR *pArray); + _XMUNIBBLE4(FLOAT _x, FLOAT _y, FLOAT _z, FLOAT _w); + _XMUNIBBLE4(CONST FLOAT *pArray); + + operator USHORT () { return v; } + + _XMUNIBBLE4& operator= (CONST _XMUNIBBLE4& UNibble4); + _XMUNIBBLE4& operator= (CONST USHORT Packed); + +#endif // __cplusplus + +} XMUNIBBLE4; + +// 4D vector: 5/5/5/1 unsigned integer components +typedef struct _XMU555 +{ + union + { + struct + { + USHORT x : 5; + USHORT y : 5; + USHORT z : 5; + USHORT w : 1; + }; + USHORT v; + }; + +#ifdef __cplusplus + + _XMU555() {}; + _XMU555(USHORT Packed) : v(Packed) {}; + _XMU555(CHAR _x, CHAR _y, CHAR _z, BOOL _w) : x(_x), y(_y), z(_z), w(_w ? 0x1 : 0) {}; + _XMU555(CONST CHAR *pArray, BOOL _w); + _XMU555(FLOAT _x, FLOAT _y, FLOAT _z, BOOL _w); + _XMU555(CONST FLOAT *pArray, BOOL _w); + + operator USHORT () { return v; } + + _XMU555& operator= (CONST _XMU555& U555); + _XMU555& operator= (CONST USHORT Packed); + +#endif // __cplusplus + +} XMU555; + +// 3x3 Matrix: 32 bit floating point components +typedef struct _XMFLOAT3X3 +{ + union + { + struct + { + FLOAT _11, _12, _13; + FLOAT _21, _22, _23; + FLOAT _31, _32, _33; + }; + FLOAT m[3][3]; + }; + +#ifdef __cplusplus + + _XMFLOAT3X3() {}; + _XMFLOAT3X3(FLOAT m00, FLOAT m01, FLOAT m02, + FLOAT m10, FLOAT m11, FLOAT m12, + FLOAT m20, FLOAT m21, FLOAT m22); + _XMFLOAT3X3(CONST FLOAT *pArray); + + FLOAT operator() (UINT Row, UINT Column) CONST { return m[Row][Column]; } + FLOAT& operator() (UINT Row, UINT Column) { return m[Row][Column]; } + + _XMFLOAT3X3& operator= (CONST _XMFLOAT3X3& Float3x3); + +#endif // __cplusplus + +} XMFLOAT3X3; + +// 4x3 Matrix: 32 bit floating point components +typedef struct _XMFLOAT4X3 +{ + union + { + struct + { + FLOAT _11, _12, _13; + FLOAT _21, _22, _23; + FLOAT _31, _32, _33; + FLOAT _41, _42, _43; + }; + FLOAT m[4][3]; + }; + +#ifdef __cplusplus + + _XMFLOAT4X3() {}; + _XMFLOAT4X3(FLOAT m00, FLOAT m01, FLOAT m02, + FLOAT m10, FLOAT m11, FLOAT m12, + FLOAT m20, FLOAT m21, FLOAT m22, + FLOAT m30, FLOAT m31, FLOAT m32); + _XMFLOAT4X3(CONST FLOAT *pArray); + + FLOAT operator() (UINT Row, UINT Column) CONST { return m[Row][Column]; } + FLOAT& operator() (UINT Row, UINT Column) { return m[Row][Column]; } + + _XMFLOAT4X3& operator= (CONST _XMFLOAT4X3& Float4x3); + +#endif // __cplusplus + +} XMFLOAT4X3; + +// 4x3 Matrix: 32 bit floating point components aligned on a 16 byte boundary +#ifdef __cplusplus +__declspec(align(16)) struct XMFLOAT4X3A : public XMFLOAT4X3 +{ + XMFLOAT4X3A() : XMFLOAT4X3() {}; + XMFLOAT4X3A(FLOAT m00, FLOAT m01, FLOAT m02, + FLOAT m10, FLOAT m11, FLOAT m12, + FLOAT m20, FLOAT m21, FLOAT m22, + FLOAT m30, FLOAT m31, FLOAT m32) : + XMFLOAT4X3(m00,m01,m02,m10,m11,m12,m20,m21,m22,m30,m31,m32) {}; + XMFLOAT4X3A(CONST FLOAT *pArray) : XMFLOAT4X3(pArray) {} + + FLOAT operator() (UINT Row, UINT Column) CONST { return m[Row][Column]; } + FLOAT& operator() (UINT Row, UINT Column) { return m[Row][Column]; } + + XMFLOAT4X3A& operator= (CONST XMFLOAT4X3A& Float4x3); +}; +#else +typedef __declspec(align(16)) XMFLOAT4X3 XMFLOAT4X3A; +#endif // __cplusplus + +// 4x4 Matrix: 32 bit floating point components +typedef struct _XMFLOAT4X4 +{ + union + { + struct + { + FLOAT _11, _12, _13, _14; + FLOAT _21, _22, _23, _24; + FLOAT _31, _32, _33, _34; + FLOAT _41, _42, _43, _44; + }; + FLOAT m[4][4]; + }; + +#ifdef __cplusplus + + _XMFLOAT4X4() {}; + _XMFLOAT4X4(FLOAT m00, FLOAT m01, FLOAT m02, FLOAT m03, + FLOAT m10, FLOAT m11, FLOAT m12, FLOAT m13, + FLOAT m20, FLOAT m21, FLOAT m22, FLOAT m23, + FLOAT m30, FLOAT m31, FLOAT m32, FLOAT m33); + _XMFLOAT4X4(CONST FLOAT *pArray); + + FLOAT operator() (UINT Row, UINT Column) CONST { return m[Row][Column]; } + FLOAT& operator() (UINT Row, UINT Column) { return m[Row][Column]; } + + _XMFLOAT4X4& operator= (CONST _XMFLOAT4X4& Float4x4); + +#endif // __cplusplus + +} XMFLOAT4X4; + +// 4x4 Matrix: 32 bit floating point components aligned on a 16 byte boundary +#ifdef __cplusplus +__declspec(align(16)) struct XMFLOAT4X4A : public XMFLOAT4X4 +{ + XMFLOAT4X4A() : XMFLOAT4X4() {}; + XMFLOAT4X4A(FLOAT m00, FLOAT m01, FLOAT m02, FLOAT m03, + FLOAT m10, FLOAT m11, FLOAT m12, FLOAT m13, + FLOAT m20, FLOAT m21, FLOAT m22, FLOAT m23, + FLOAT m30, FLOAT m31, FLOAT m32, FLOAT m33) + : XMFLOAT4X4(m00,m01,m02,m03,m10,m11,m12,m13,m20,m21,m22,m23,m30,m31,m32,m33) {}; + XMFLOAT4X4A(CONST FLOAT *pArray) : XMFLOAT4X4(pArray) {} + + FLOAT operator() (UINT Row, UINT Column) CONST { return m[Row][Column]; } + FLOAT& operator() (UINT Row, UINT Column) { return m[Row][Column]; } + + XMFLOAT4X4A& operator= (CONST XMFLOAT4X4A& Float4x4); +}; +#else +typedef __declspec(align(16)) XMFLOAT4X4 XMFLOAT4X4A; +#endif // __cplusplus + +#if !defined(_XM_X86_) && !defined(_XM_X64_) +#pragma bitfield_order(pop) +#endif // !_XM_X86_ && !_XM_X64_ + +#pragma warning(pop) + + +/**************************************************************************** + * + * Data conversion operations + * + ****************************************************************************/ + +#if !defined(_XM_NO_INTRINSICS_) && defined(_XM_VMX128_INTRINSICS_) +#else +XMVECTOR XMConvertVectorIntToFloat(FXMVECTOR VInt, UINT DivExponent); +XMVECTOR XMConvertVectorFloatToInt(FXMVECTOR VFloat, UINT MulExponent); +XMVECTOR XMConvertVectorUIntToFloat(FXMVECTOR VUInt, UINT DivExponent); +XMVECTOR XMConvertVectorFloatToUInt(FXMVECTOR VFloat, UINT MulExponent); +#endif + +FLOAT XMConvertHalfToFloat(HALF Value); +FLOAT* XMConvertHalfToFloatStream(_Out_bytecap_x_(sizeof(FLOAT)+OutputStride*(HalfCount-1)) FLOAT* pOutputStream, + _In_ UINT OutputStride, + _In_bytecount_x_(sizeof(HALF)+InputStride*(HalfCount-1)) CONST HALF* pInputStream, + _In_ UINT InputStride, _In_ UINT HalfCount); +HALF XMConvertFloatToHalf(FLOAT Value); +HALF* XMConvertFloatToHalfStream(_Out_bytecap_x_(sizeof(HALF)+OutputStride*(FloatCount-1)) HALF* pOutputStream, + _In_ UINT OutputStride, + _In_bytecount_x_(sizeof(FLOAT)+InputStride*(FloatCount-1)) CONST FLOAT* pInputStream, + _In_ UINT InputStride, _In_ UINT FloatCount); + +#if !defined(_XM_NO_INTRINSICS_) && defined(_XM_VMX128_INTRINSICS_) +#else +XMVECTOR XMVectorSetBinaryConstant(UINT C0, UINT C1, UINT C2, UINT C3); +XMVECTOR XMVectorSplatConstant(INT IntConstant, UINT DivExponent); +XMVECTOR XMVectorSplatConstantInt(INT IntConstant); +#endif + +/**************************************************************************** + * + * Load operations + * + ****************************************************************************/ + +XMVECTOR XMLoadInt(_In_ CONST UINT* pSource); +XMVECTOR XMLoadFloat(_In_ CONST FLOAT* pSource); + +XMVECTOR XMLoadInt2(_In_count_c_(2) CONST UINT* pSource); +XMVECTOR XMLoadInt2A(_In_count_c_(2) CONST UINT* PSource); +XMVECTOR XMLoadFloat2(_In_ CONST XMFLOAT2* pSource); +XMVECTOR XMLoadFloat2A(_In_ CONST XMFLOAT2A* pSource); +XMVECTOR XMLoadHalf2(_In_ CONST XMHALF2* pSource); +XMVECTOR XMLoadShortN2(_In_ CONST XMSHORTN2* pSource); +XMVECTOR XMLoadShort2(_In_ CONST XMSHORT2* pSource); +XMVECTOR XMLoadUShortN2(_In_ CONST XMUSHORTN2* pSource); +XMVECTOR XMLoadUShort2(_In_ CONST XMUSHORT2* pSource); + +XMVECTOR XMLoadInt3(_In_count_c_(3) CONST UINT* pSource); +XMVECTOR XMLoadInt3A(_In_count_c_(3) CONST UINT* pSource); +XMVECTOR XMLoadFloat3(_In_ CONST XMFLOAT3* pSource); +XMVECTOR XMLoadFloat3A(_In_ CONST XMFLOAT3A* pSource); +XMVECTOR XMLoadHenDN3(_In_ CONST XMHENDN3* pSource); +XMVECTOR XMLoadHenD3(_In_ CONST XMHEND3* pSource); +XMVECTOR XMLoadUHenDN3(_In_ CONST XMUHENDN3* pSource); +XMVECTOR XMLoadUHenD3(_In_ CONST XMUHEND3* pSource); +XMVECTOR XMLoadDHenN3(_In_ CONST XMDHENN3* pSource); +XMVECTOR XMLoadDHen3(_In_ CONST XMDHEN3* pSource); +XMVECTOR XMLoadUDHenN3(_In_ CONST XMUDHENN3* pSource); +XMVECTOR XMLoadUDHen3(_In_ CONST XMUDHEN3* pSource); +XMVECTOR XMLoadU565(_In_ CONST XMU565* pSource); +XMVECTOR XMLoadFloat3PK(_In_ CONST XMFLOAT3PK* pSource); +XMVECTOR XMLoadFloat3SE(_In_ CONST XMFLOAT3SE* pSource); + +XMVECTOR XMLoadInt4(_In_count_c_(4) CONST UINT* pSource); +XMVECTOR XMLoadInt4A(_In_count_c_(4) CONST UINT* pSource); +XMVECTOR XMLoadFloat4(_In_ CONST XMFLOAT4* pSource); +XMVECTOR XMLoadFloat4A(_In_ CONST XMFLOAT4A* pSource); +XMVECTOR XMLoadHalf4(_In_ CONST XMHALF4* pSource); +XMVECTOR XMLoadShortN4(_In_ CONST XMSHORTN4* pSource); +XMVECTOR XMLoadShort4(_In_ CONST XMSHORT4* pSource); +XMVECTOR XMLoadUShortN4(_In_ CONST XMUSHORTN4* pSource); +XMVECTOR XMLoadUShort4(_In_ CONST XMUSHORT4* pSource); +XMVECTOR XMLoadXIcoN4(_In_ CONST XMXICON4* pSource); +XMVECTOR XMLoadXIco4(_In_ CONST XMXICO4* pSource); +XMVECTOR XMLoadIcoN4(_In_ CONST XMICON4* pSource); +XMVECTOR XMLoadIco4(_In_ CONST XMICO4* pSource); +XMVECTOR XMLoadUIcoN4(_In_ CONST XMUICON4* pSource); +XMVECTOR XMLoadUIco4(_In_ CONST XMUICO4* pSource); +XMVECTOR XMLoadXDecN4(_In_ CONST XMXDECN4* pSource); +XMVECTOR XMLoadXDec4(_In_ CONST XMXDEC4* pSource); +XMVECTOR XMLoadDecN4(_In_ CONST XMDECN4* pSource); +XMVECTOR XMLoadDec4(_In_ CONST XMDEC4* pSource); +XMVECTOR XMLoadUDecN4(_In_ CONST XMUDECN4* pSource); +XMVECTOR XMLoadUDec4(_In_ CONST XMUDEC4* pSource); +XMVECTOR XMLoadByteN4(_In_ CONST XMBYTEN4* pSource); +XMVECTOR XMLoadByte4(_In_ CONST XMBYTE4* pSource); +XMVECTOR XMLoadUByteN4(_In_ CONST XMUBYTEN4* pSource); +XMVECTOR XMLoadUByte4(_In_ CONST XMUBYTE4* pSource); +XMVECTOR XMLoadUNibble4(_In_ CONST XMUNIBBLE4* pSource); +XMVECTOR XMLoadU555(_In_ CONST XMU555* pSource); +XMVECTOR XMLoadColor(_In_ CONST XMCOLOR* pSource); + +XMMATRIX XMLoadFloat3x3(_In_ CONST XMFLOAT3X3* pSource); +XMMATRIX XMLoadFloat4x3(_In_ CONST XMFLOAT4X3* pSource); +XMMATRIX XMLoadFloat4x3A(_In_ CONST XMFLOAT4X3A* pSource); +XMMATRIX XMLoadFloat4x4(_In_ CONST XMFLOAT4X4* pSource); +XMMATRIX XMLoadFloat4x4A(_In_ CONST XMFLOAT4X4A* pSource); + +/**************************************************************************** + * + * Store operations + * + ****************************************************************************/ + +VOID XMStoreInt(_Out_ UINT* pDestination, FXMVECTOR V); +VOID XMStoreFloat(_Out_ FLOAT* pDestination, FXMVECTOR V); + +VOID XMStoreInt2(_Out_cap_c_(2) UINT* pDestination, FXMVECTOR V); +VOID XMStoreInt2A(_Out_cap_c_(2) UINT* pDestination, FXMVECTOR V); +VOID XMStoreFloat2(_Out_ XMFLOAT2* pDestination, FXMVECTOR V); +VOID XMStoreFloat2A(_Out_ XMFLOAT2A* pDestination, FXMVECTOR V); +VOID XMStoreHalf2(_Out_ XMHALF2* pDestination, FXMVECTOR V); +VOID XMStoreShortN2(_Out_ XMSHORTN2* pDestination, FXMVECTOR V); +VOID XMStoreShort2(_Out_ XMSHORT2* pDestination, FXMVECTOR V); +VOID XMStoreUShortN2(_Out_ XMUSHORTN2* pDestination, FXMVECTOR V); +VOID XMStoreUShort2(_Out_ XMUSHORT2* pDestination, FXMVECTOR V); + +VOID XMStoreInt3(_Out_cap_c_(3) UINT* pDestination, FXMVECTOR V); +VOID XMStoreInt3A(_Out_cap_c_(3) UINT* pDestination, FXMVECTOR V); +VOID XMStoreFloat3(_Out_ XMFLOAT3* pDestination, FXMVECTOR V); +VOID XMStoreFloat3A(_Out_ XMFLOAT3A* pDestination, FXMVECTOR V); +VOID XMStoreHenDN3(_Out_ XMHENDN3* pDestination, FXMVECTOR V); +VOID XMStoreHenD3(_Out_ XMHEND3* pDestination, FXMVECTOR V); +VOID XMStoreUHenDN3(_Out_ XMUHENDN3* pDestination, FXMVECTOR V); +VOID XMStoreUHenD3(_Out_ XMUHEND3* pDestination, FXMVECTOR V); +VOID XMStoreDHenN3(_Out_ XMDHENN3* pDestination, FXMVECTOR V); +VOID XMStoreDHen3(_Out_ XMDHEN3* pDestination, FXMVECTOR V); +VOID XMStoreUDHenN3(_Out_ XMUDHENN3* pDestination, FXMVECTOR V); +VOID XMStoreUDHen3(_Out_ XMUDHEN3* pDestination, FXMVECTOR V); +VOID XMStoreU565(_Out_ XMU565* pDestination, FXMVECTOR V); +VOID XMStoreFloat3PK(_Out_ XMFLOAT3PK* pDestination, FXMVECTOR V); +VOID XMStoreFloat3SE(_Out_ XMFLOAT3SE* pDestination, FXMVECTOR V); + +VOID XMStoreInt4(_Out_cap_c_(4) UINT* pDestination, FXMVECTOR V); +VOID XMStoreInt4A(_Out_cap_c_(4) UINT* pDestination, FXMVECTOR V); +VOID XMStoreInt4NC(_Out_ UINT* pDestination, FXMVECTOR V); +VOID XMStoreFloat4(_Out_ XMFLOAT4* pDestination, FXMVECTOR V); +VOID XMStoreFloat4A(_Out_ XMFLOAT4A* pDestination, FXMVECTOR V); +VOID XMStoreFloat4NC(_Out_ XMFLOAT4* pDestination, FXMVECTOR V); +VOID XMStoreHalf4(_Out_ XMHALF4* pDestination, FXMVECTOR V); +VOID XMStoreShortN4(_Out_ XMSHORTN4* pDestination, FXMVECTOR V); +VOID XMStoreShort4(_Out_ XMSHORT4* pDestination, FXMVECTOR V); +VOID XMStoreUShortN4(_Out_ XMUSHORTN4* pDestination, FXMVECTOR V); +VOID XMStoreUShort4(_Out_ XMUSHORT4* pDestination, FXMVECTOR V); +VOID XMStoreXIcoN4(_Out_ XMXICON4* pDestination, FXMVECTOR V); +VOID XMStoreXIco4(_Out_ XMXICO4* pDestination, FXMVECTOR V); +VOID XMStoreIcoN4(_Out_ XMICON4* pDestination, FXMVECTOR V); +VOID XMStoreIco4(_Out_ XMICO4* pDestination, FXMVECTOR V); +VOID XMStoreUIcoN4(_Out_ XMUICON4* pDestination, FXMVECTOR V); +VOID XMStoreUIco4(_Out_ XMUICO4* pDestination, FXMVECTOR V); +VOID XMStoreXDecN4(_Out_ XMXDECN4* pDestination, FXMVECTOR V); +VOID XMStoreXDec4(_Out_ XMXDEC4* pDestination, FXMVECTOR V); +VOID XMStoreDecN4(_Out_ XMDECN4* pDestination, FXMVECTOR V); +VOID XMStoreDec4(_Out_ XMDEC4* pDestination, FXMVECTOR V); +VOID XMStoreUDecN4(_Out_ XMUDECN4* pDestination, FXMVECTOR V); +VOID XMStoreUDec4(_Out_ XMUDEC4* pDestination, FXMVECTOR V); +VOID XMStoreByteN4(_Out_ XMBYTEN4* pDestination, FXMVECTOR V); +VOID XMStoreByte4(_Out_ XMBYTE4* pDestination, FXMVECTOR V); +VOID XMStoreUByteN4(_Out_ XMUBYTEN4* pDestination, FXMVECTOR V); +VOID XMStoreUByte4(_Out_ XMUBYTE4* pDestination, FXMVECTOR V); +VOID XMStoreUNibble4(_Out_ XMUNIBBLE4* pDestination, FXMVECTOR V); +VOID XMStoreU555(_Out_ XMU555* pDestination, FXMVECTOR V); +VOID XMStoreColor(_Out_ XMCOLOR* pDestination, FXMVECTOR V); + +VOID XMStoreFloat3x3(_Out_ XMFLOAT3X3* pDestination, CXMMATRIX M); +VOID XMStoreFloat3x3NC(_Out_ XMFLOAT3X3* pDestination, CXMMATRIX M); +VOID XMStoreFloat4x3(_Out_ XMFLOAT4X3* pDestination, CXMMATRIX M); +VOID XMStoreFloat4x3A(_Out_ XMFLOAT4X3A* pDestination, CXMMATRIX M); +VOID XMStoreFloat4x3NC(_Out_ XMFLOAT4X3* pDestination, CXMMATRIX M); +VOID XMStoreFloat4x4(_Out_ XMFLOAT4X4* pDestination, CXMMATRIX M); +VOID XMStoreFloat4x4A(_Out_ XMFLOAT4X4A* pDestination, CXMMATRIX M); +VOID XMStoreFloat4x4NC(_Out_ XMFLOAT4X4* pDestination, CXMMATRIX M); + +/**************************************************************************** + * + * General vector operations + * + ****************************************************************************/ + +XMVECTOR XMVectorZero(); +XMVECTOR XMVectorSet(FLOAT x, FLOAT y, FLOAT z, FLOAT w); +XMVECTOR XMVectorSetInt(UINT x, UINT y, UINT z, UINT w); +XMVECTOR XMVectorReplicate(FLOAT Value); +XMVECTOR XMVectorReplicatePtr(_In_ CONST FLOAT *pValue); +XMVECTOR XMVectorReplicateInt(UINT Value); +XMVECTOR XMVectorReplicateIntPtr(_In_ CONST UINT *pValue); +XMVECTOR XMVectorTrueInt(); +XMVECTOR XMVectorFalseInt(); +XMVECTOR XMVectorSplatX(FXMVECTOR V); +XMVECTOR XMVectorSplatY(FXMVECTOR V); +XMVECTOR XMVectorSplatZ(FXMVECTOR V); +XMVECTOR XMVectorSplatW(FXMVECTOR V); +XMVECTOR XMVectorSplatOne(); +XMVECTOR XMVectorSplatInfinity(); +XMVECTOR XMVectorSplatQNaN(); +XMVECTOR XMVectorSplatEpsilon(); +XMVECTOR XMVectorSplatSignMask(); + +FLOAT XMVectorGetByIndex(FXMVECTOR V,UINT i); +FLOAT XMVectorGetX(FXMVECTOR V); +FLOAT XMVectorGetY(FXMVECTOR V); +FLOAT XMVectorGetZ(FXMVECTOR V); +FLOAT XMVectorGetW(FXMVECTOR V); + +VOID XMVectorGetByIndexPtr(_Out_ FLOAT *f, FXMVECTOR V, UINT i); +VOID XMVectorGetXPtr(_Out_ FLOAT *x, FXMVECTOR V); +VOID XMVectorGetYPtr(_Out_ FLOAT *y, FXMVECTOR V); +VOID XMVectorGetZPtr(_Out_ FLOAT *z, FXMVECTOR V); +VOID XMVectorGetWPtr(_Out_ FLOAT *w, FXMVECTOR V); + +UINT XMVectorGetIntByIndex(FXMVECTOR V,UINT i); +UINT XMVectorGetIntX(FXMVECTOR V); +UINT XMVectorGetIntY(FXMVECTOR V); +UINT XMVectorGetIntZ(FXMVECTOR V); +UINT XMVectorGetIntW(FXMVECTOR V); + +VOID XMVectorGetIntByIndexPtr(_Out_ UINT *x,FXMVECTOR V, UINT i); +VOID XMVectorGetIntXPtr(_Out_ UINT *x, FXMVECTOR V); +VOID XMVectorGetIntYPtr(_Out_ UINT *y, FXMVECTOR V); +VOID XMVectorGetIntZPtr(_Out_ UINT *z, FXMVECTOR V); +VOID XMVectorGetIntWPtr(_Out_ UINT *w, FXMVECTOR V); + +XMVECTOR XMVectorSetByIndex(FXMVECTOR V,FLOAT f,UINT i); +XMVECTOR XMVectorSetX(FXMVECTOR V, FLOAT x); +XMVECTOR XMVectorSetY(FXMVECTOR V, FLOAT y); +XMVECTOR XMVectorSetZ(FXMVECTOR V, FLOAT z); +XMVECTOR XMVectorSetW(FXMVECTOR V, FLOAT w); + +XMVECTOR XMVectorSetByIndexPtr(FXMVECTOR V, _In_ CONST FLOAT *f, UINT i); +XMVECTOR XMVectorSetXPtr(FXMVECTOR V, _In_ CONST FLOAT *x); +XMVECTOR XMVectorSetYPtr(FXMVECTOR V, _In_ CONST FLOAT *y); +XMVECTOR XMVectorSetZPtr(FXMVECTOR V, _In_ CONST FLOAT *z); +XMVECTOR XMVectorSetWPtr(FXMVECTOR V, _In_ CONST FLOAT *w); + +XMVECTOR XMVectorSetIntByIndex(FXMVECTOR V, UINT x,UINT i); +XMVECTOR XMVectorSetIntX(FXMVECTOR V, UINT x); +XMVECTOR XMVectorSetIntY(FXMVECTOR V, UINT y); +XMVECTOR XMVectorSetIntZ(FXMVECTOR V, UINT z); +XMVECTOR XMVectorSetIntW(FXMVECTOR V, UINT w); + +XMVECTOR XMVectorSetIntByIndexPtr(FXMVECTOR V, _In_ CONST UINT *x, UINT i); +XMVECTOR XMVectorSetIntXPtr(FXMVECTOR V, _In_ CONST UINT *x); +XMVECTOR XMVectorSetIntYPtr(FXMVECTOR V, _In_ CONST UINT *y); +XMVECTOR XMVectorSetIntZPtr(FXMVECTOR V, _In_ CONST UINT *z); +XMVECTOR XMVectorSetIntWPtr(FXMVECTOR V, _In_ CONST UINT *w); + +XMVECTOR XMVectorPermuteControl(UINT ElementIndex0, UINT ElementIndex1, UINT ElementIndex2, UINT ElementIndex3); +XMVECTOR XMVectorPermute(FXMVECTOR V1, FXMVECTOR V2, FXMVECTOR Control); +XMVECTOR XMVectorSelectControl(UINT VectorIndex0, UINT VectorIndex1, UINT VectorIndex2, UINT VectorIndex3); +XMVECTOR XMVectorSelect(FXMVECTOR V1, FXMVECTOR V2, FXMVECTOR Control); +XMVECTOR XMVectorMergeXY(FXMVECTOR V1, FXMVECTOR V2); +XMVECTOR XMVectorMergeZW(FXMVECTOR V1, FXMVECTOR V2); + +#if !defined(_XM_NO_INTRINSICS_) && defined(_XM_VMX128_INTRINSICS_) +#else +XMVECTOR XMVectorShiftLeft(FXMVECTOR V1, FXMVECTOR V2, UINT Elements); +XMVECTOR XMVectorRotateLeft(FXMVECTOR V, UINT Elements); +XMVECTOR XMVectorRotateRight(FXMVECTOR V, UINT Elements); +XMVECTOR XMVectorSwizzle(FXMVECTOR V, UINT E0, UINT E1, UINT E2, UINT E3); +XMVECTOR XMVectorInsert(FXMVECTOR VD, FXMVECTOR VS, UINT VSLeftRotateElements, + UINT Select0, UINT Select1, UINT Select2, UINT Select3); +#endif + +XMVECTOR XMVectorEqual(FXMVECTOR V1, FXMVECTOR V2); +XMVECTOR XMVectorEqualR(_Out_ UINT* pCR, FXMVECTOR V1, FXMVECTOR V2); +XMVECTOR XMVectorEqualInt(FXMVECTOR V1, FXMVECTOR V2); +XMVECTOR XMVectorEqualIntR(_Out_ UINT* pCR, FXMVECTOR V, FXMVECTOR V2); +XMVECTOR XMVectorNearEqual(FXMVECTOR V1, FXMVECTOR V2, FXMVECTOR Epsilon); +XMVECTOR XMVectorNotEqual(FXMVECTOR V1, FXMVECTOR V2); +XMVECTOR XMVectorNotEqualInt(FXMVECTOR V1, FXMVECTOR V2); +XMVECTOR XMVectorGreater(FXMVECTOR V1, FXMVECTOR V2); +XMVECTOR XMVectorGreaterR(_Out_ UINT* pCR, FXMVECTOR V1, FXMVECTOR V2); +XMVECTOR XMVectorGreaterOrEqual(FXMVECTOR V1, FXMVECTOR V2); +XMVECTOR XMVectorGreaterOrEqualR(_Out_ UINT* pCR, FXMVECTOR V1, FXMVECTOR V2); +XMVECTOR XMVectorLess(FXMVECTOR V1, FXMVECTOR V2); +XMVECTOR XMVectorLessOrEqual(FXMVECTOR V1, FXMVECTOR V2); +XMVECTOR XMVectorInBounds(FXMVECTOR V, FXMVECTOR Bounds); +XMVECTOR XMVectorInBoundsR(_Out_ UINT* pCR, FXMVECTOR V, FXMVECTOR Bounds); + +XMVECTOR XMVectorIsNaN(FXMVECTOR V); +XMVECTOR XMVectorIsInfinite(FXMVECTOR V); + +XMVECTOR XMVectorMin(FXMVECTOR V1,FXMVECTOR V2); +XMVECTOR XMVectorMax(FXMVECTOR V1, FXMVECTOR V2); +XMVECTOR XMVectorRound(FXMVECTOR V); +XMVECTOR XMVectorTruncate(FXMVECTOR V); +XMVECTOR XMVectorFloor(FXMVECTOR V); +XMVECTOR XMVectorCeiling(FXMVECTOR V); +XMVECTOR XMVectorClamp(FXMVECTOR V, FXMVECTOR Min, FXMVECTOR Max); +XMVECTOR XMVectorSaturate(FXMVECTOR V); + +XMVECTOR XMVectorAndInt(FXMVECTOR V1, FXMVECTOR V2); +XMVECTOR XMVectorAndCInt(FXMVECTOR V1, FXMVECTOR V2); +XMVECTOR XMVectorOrInt(FXMVECTOR V1, FXMVECTOR V2); +XMVECTOR XMVectorNorInt(FXMVECTOR V1, FXMVECTOR V2); +XMVECTOR XMVectorXorInt(FXMVECTOR V1, FXMVECTOR V2); + +XMVECTOR XMVectorNegate(FXMVECTOR V); +XMVECTOR XMVectorAdd(FXMVECTOR V1, FXMVECTOR V2); +XMVECTOR XMVectorAddAngles(FXMVECTOR V1, FXMVECTOR V2); +XMVECTOR XMVectorSubtract(FXMVECTOR V1, FXMVECTOR V2); +XMVECTOR XMVectorSubtractAngles(FXMVECTOR V1, FXMVECTOR V2); +XMVECTOR XMVectorMultiply(FXMVECTOR V1, FXMVECTOR V2); +XMVECTOR XMVectorMultiplyAdd(FXMVECTOR V1, FXMVECTOR V2, FXMVECTOR V3); +XMVECTOR XMVectorDivide(FXMVECTOR V1, FXMVECTOR V2); +XMVECTOR XMVectorNegativeMultiplySubtract(FXMVECTOR V1, FXMVECTOR V2, FXMVECTOR V3); +XMVECTOR XMVectorScale(FXMVECTOR V, FLOAT ScaleFactor); +XMVECTOR XMVectorReciprocalEst(FXMVECTOR V); +XMVECTOR XMVectorReciprocal(FXMVECTOR V); +XMVECTOR XMVectorSqrtEst(FXMVECTOR V); +XMVECTOR XMVectorSqrt(FXMVECTOR V); +XMVECTOR XMVectorReciprocalSqrtEst(FXMVECTOR V); +XMVECTOR XMVectorReciprocalSqrt(FXMVECTOR V); +XMVECTOR XMVectorExpEst(FXMVECTOR V); +XMVECTOR XMVectorExp(FXMVECTOR V); +XMVECTOR XMVectorLogEst(FXMVECTOR V); +XMVECTOR XMVectorLog(FXMVECTOR V); +XMVECTOR XMVectorPowEst(FXMVECTOR V1, FXMVECTOR V2); +XMVECTOR XMVectorPow(FXMVECTOR V1, FXMVECTOR V2); +XMVECTOR XMVectorAbs(FXMVECTOR V); +XMVECTOR XMVectorMod(FXMVECTOR V1, FXMVECTOR V2); +XMVECTOR XMVectorModAngles(FXMVECTOR Angles); +XMVECTOR XMVectorSin(FXMVECTOR V); +XMVECTOR XMVectorSinEst(FXMVECTOR V); +XMVECTOR XMVectorCos(FXMVECTOR V); +XMVECTOR XMVectorCosEst(FXMVECTOR V); +VOID XMVectorSinCos(_Out_ XMVECTOR* pSin, _Out_ XMVECTOR* pCos, FXMVECTOR V); +VOID XMVectorSinCosEst(_Out_ XMVECTOR* pSin, _Out_ XMVECTOR* pCos, FXMVECTOR V); +XMVECTOR XMVectorTan(FXMVECTOR V); +XMVECTOR XMVectorTanEst(FXMVECTOR V); +XMVECTOR XMVectorSinH(FXMVECTOR V); +XMVECTOR XMVectorSinHEst(FXMVECTOR V); +XMVECTOR XMVectorCosH(FXMVECTOR V); +XMVECTOR XMVectorCosHEst(FXMVECTOR V); +XMVECTOR XMVectorTanH(FXMVECTOR V); +XMVECTOR XMVectorTanHEst(FXMVECTOR V); +XMVECTOR XMVectorASin(FXMVECTOR V); +XMVECTOR XMVectorASinEst(FXMVECTOR V); +XMVECTOR XMVectorACos(FXMVECTOR V); +XMVECTOR XMVectorACosEst(FXMVECTOR V); +XMVECTOR XMVectorATan(FXMVECTOR V); +XMVECTOR XMVectorATanEst(FXMVECTOR V); +XMVECTOR XMVectorATan2(FXMVECTOR Y, FXMVECTOR X); +XMVECTOR XMVectorATan2Est(FXMVECTOR Y, FXMVECTOR X); +XMVECTOR XMVectorLerp(FXMVECTOR V0, FXMVECTOR V1, FLOAT t); +XMVECTOR XMVectorLerpV(FXMVECTOR V0, FXMVECTOR V1, FXMVECTOR T); +XMVECTOR XMVectorHermite(FXMVECTOR Position0, FXMVECTOR Tangent0, FXMVECTOR Position1, CXMVECTOR Tangent1, FLOAT t); +XMVECTOR XMVectorHermiteV(FXMVECTOR Position0, FXMVECTOR Tangent0, FXMVECTOR Position1, CXMVECTOR Tangent1, CXMVECTOR T); +XMVECTOR XMVectorCatmullRom(FXMVECTOR Position0, FXMVECTOR Position1, FXMVECTOR Position2, CXMVECTOR Position3, FLOAT t); +XMVECTOR XMVectorCatmullRomV(FXMVECTOR Position0, FXMVECTOR Position1, FXMVECTOR Position2, CXMVECTOR Position3, CXMVECTOR T); +XMVECTOR XMVectorBaryCentric(FXMVECTOR Position0, FXMVECTOR Position1, FXMVECTOR Position2, FLOAT f, FLOAT g); +XMVECTOR XMVectorBaryCentricV(FXMVECTOR Position0, FXMVECTOR Position1, FXMVECTOR Position2, CXMVECTOR F, CXMVECTOR G); + +/**************************************************************************** + * + * 2D vector operations + * + ****************************************************************************/ + + +BOOL XMVector2Equal(FXMVECTOR V1, FXMVECTOR V2); +UINT XMVector2EqualR(FXMVECTOR V1, FXMVECTOR V2); +BOOL XMVector2EqualInt(FXMVECTOR V1, FXMVECTOR V2); +UINT XMVector2EqualIntR(FXMVECTOR V1, FXMVECTOR V2); +BOOL XMVector2NearEqual(FXMVECTOR V1, FXMVECTOR V2, FXMVECTOR Epsilon); +BOOL XMVector2NotEqual(FXMVECTOR V1, FXMVECTOR V2); +BOOL XMVector2NotEqualInt(FXMVECTOR V1, FXMVECTOR V2); +BOOL XMVector2Greater(FXMVECTOR V1, FXMVECTOR V2); +UINT XMVector2GreaterR(FXMVECTOR V1, FXMVECTOR V2); +BOOL XMVector2GreaterOrEqual(FXMVECTOR V1, FXMVECTOR V2); +UINT XMVector2GreaterOrEqualR(FXMVECTOR V1, FXMVECTOR V2); +BOOL XMVector2Less(FXMVECTOR V1, FXMVECTOR V2); +BOOL XMVector2LessOrEqual(FXMVECTOR V1, FXMVECTOR V2); +BOOL XMVector2InBounds(FXMVECTOR V, FXMVECTOR Bounds); +UINT XMVector2InBoundsR(FXMVECTOR V, FXMVECTOR Bounds); + +BOOL XMVector2IsNaN(FXMVECTOR V); +BOOL XMVector2IsInfinite(FXMVECTOR V); + +XMVECTOR XMVector2Dot(FXMVECTOR V1, FXMVECTOR V2); +XMVECTOR XMVector2Cross(FXMVECTOR V1, FXMVECTOR V2); +XMVECTOR XMVector2LengthSq(FXMVECTOR V); +XMVECTOR XMVector2ReciprocalLengthEst(FXMVECTOR V); +XMVECTOR XMVector2ReciprocalLength(FXMVECTOR V); +XMVECTOR XMVector2LengthEst(FXMVECTOR V); +XMVECTOR XMVector2Length(FXMVECTOR V); +XMVECTOR XMVector2NormalizeEst(FXMVECTOR V); +XMVECTOR XMVector2Normalize(FXMVECTOR V); +XMVECTOR XMVector2ClampLength(FXMVECTOR V, FLOAT LengthMin, FLOAT LengthMax); +XMVECTOR XMVector2ClampLengthV(FXMVECTOR V, FXMVECTOR LengthMin, FXMVECTOR LengthMax); +XMVECTOR XMVector2Reflect(FXMVECTOR Incident, FXMVECTOR Normal); +XMVECTOR XMVector2Refract(FXMVECTOR Incident, FXMVECTOR Normal, FLOAT RefractionIndex); +XMVECTOR XMVector2RefractV(FXMVECTOR Incident, FXMVECTOR Normal, FXMVECTOR RefractionIndex); +XMVECTOR XMVector2Orthogonal(FXMVECTOR V); +XMVECTOR XMVector2AngleBetweenNormalsEst(FXMVECTOR N1, FXMVECTOR N2); +XMVECTOR XMVector2AngleBetweenNormals(FXMVECTOR N1, FXMVECTOR N2); +XMVECTOR XMVector2AngleBetweenVectors(FXMVECTOR V1, FXMVECTOR V2); +XMVECTOR XMVector2LinePointDistance(FXMVECTOR LinePoint1, FXMVECTOR LinePoint2, FXMVECTOR Point); +XMVECTOR XMVector2IntersectLine(FXMVECTOR Line1Point1, FXMVECTOR Line1Point2, FXMVECTOR Line2Point1, CXMVECTOR Line2Point2); +XMVECTOR XMVector2Transform(FXMVECTOR V, CXMMATRIX M); +XMFLOAT4* XMVector2TransformStream(_Out_bytecap_x_(sizeof(XMFLOAT4)+OutputStride*(VectorCount-1)) XMFLOAT4* pOutputStream, + _In_ UINT OutputStride, + _In_bytecount_x_(sizeof(XMFLOAT2)+InputStride*(VectorCount-1)) CONST XMFLOAT2* pInputStream, + _In_ UINT InputStride, _In_ UINT VectorCount, CXMMATRIX M); +XMFLOAT4* XMVector2TransformStreamNC(_Out_bytecap_x_(sizeof(XMFLOAT4)+OutputStride*(VectorCount-1)) XMFLOAT4* pOutputStream, + _In_ UINT OutputStride, + _In_bytecount_x_(sizeof(XMFLOAT2)+InputStride*(VectorCount-1)) CONST XMFLOAT2* pInputStream, + _In_ UINT InputStride, _In_ UINT VectorCount, CXMMATRIX M); +XMVECTOR XMVector2TransformCoord(FXMVECTOR V, CXMMATRIX M); +XMFLOAT2* XMVector2TransformCoordStream(_Out_bytecap_x_(sizeof(XMFLOAT2)+OutputStride*(VectorCount-1)) XMFLOAT2* pOutputStream, + _In_ UINT OutputStride, + _In_bytecount_x_(sizeof(XMFLOAT2)+InputStride*(VectorCount-1)) CONST XMFLOAT2* pInputStream, + _In_ UINT InputStride, _In_ UINT VectorCount, CXMMATRIX M); +XMVECTOR XMVector2TransformNormal(FXMVECTOR V, CXMMATRIX M); +XMFLOAT2* XMVector2TransformNormalStream(_Out_bytecap_x_(sizeof(XMFLOAT2)+OutputStride*(VectorCount-1)) XMFLOAT2* pOutputStream, + _In_ UINT OutputStride, + _In_bytecount_x_(sizeof(XMFLOAT2)+InputStride*(VectorCount-1)) CONST XMFLOAT2* pInputStream, + _In_ UINT InputStride, _In_ UINT VectorCount, CXMMATRIX M); + +/**************************************************************************** + * + * 3D vector operations + * + ****************************************************************************/ + + +BOOL XMVector3Equal(FXMVECTOR V1, FXMVECTOR V2); +UINT XMVector3EqualR(FXMVECTOR V1, FXMVECTOR V2); +BOOL XMVector3EqualInt(FXMVECTOR V1, FXMVECTOR V2); +UINT XMVector3EqualIntR(FXMVECTOR V1, FXMVECTOR V2); +BOOL XMVector3NearEqual(FXMVECTOR V1, FXMVECTOR V2, FXMVECTOR Epsilon); +BOOL XMVector3NotEqual(FXMVECTOR V1, FXMVECTOR V2); +BOOL XMVector3NotEqualInt(FXMVECTOR V1, FXMVECTOR V2); +BOOL XMVector3Greater(FXMVECTOR V1, FXMVECTOR V2); +UINT XMVector3GreaterR(FXMVECTOR V1, FXMVECTOR V2); +BOOL XMVector3GreaterOrEqual(FXMVECTOR V1, FXMVECTOR V2); +UINT XMVector3GreaterOrEqualR(FXMVECTOR V1, FXMVECTOR V2); +BOOL XMVector3Less(FXMVECTOR V1, FXMVECTOR V2); +BOOL XMVector3LessOrEqual(FXMVECTOR V1, FXMVECTOR V2); +BOOL XMVector3InBounds(FXMVECTOR V, FXMVECTOR Bounds); +UINT XMVector3InBoundsR(FXMVECTOR V, FXMVECTOR Bounds); + +BOOL XMVector3IsNaN(FXMVECTOR V); +BOOL XMVector3IsInfinite(FXMVECTOR V); + +XMVECTOR XMVector3Dot(FXMVECTOR V1, FXMVECTOR V2); +XMVECTOR XMVector3Cross(FXMVECTOR V1, FXMVECTOR V2); +XMVECTOR XMVector3LengthSq(FXMVECTOR V); +XMVECTOR XMVector3ReciprocalLengthEst(FXMVECTOR V); +XMVECTOR XMVector3ReciprocalLength(FXMVECTOR V); +XMVECTOR XMVector3LengthEst(FXMVECTOR V); +XMVECTOR XMVector3Length(FXMVECTOR V); +XMVECTOR XMVector3NormalizeEst(FXMVECTOR V); +XMVECTOR XMVector3Normalize(FXMVECTOR V); +XMVECTOR XMVector3ClampLength(FXMVECTOR V, FLOAT LengthMin, FLOAT LengthMax); +XMVECTOR XMVector3ClampLengthV(FXMVECTOR V, FXMVECTOR LengthMin, FXMVECTOR LengthMax); +XMVECTOR XMVector3Reflect(FXMVECTOR Incident, FXMVECTOR Normal); +XMVECTOR XMVector3Refract(FXMVECTOR Incident, FXMVECTOR Normal, FLOAT RefractionIndex); +XMVECTOR XMVector3RefractV(FXMVECTOR Incident, FXMVECTOR Normal, FXMVECTOR RefractionIndex); +XMVECTOR XMVector3Orthogonal(FXMVECTOR V); +XMVECTOR XMVector3AngleBetweenNormalsEst(FXMVECTOR N1, FXMVECTOR N2); +XMVECTOR XMVector3AngleBetweenNormals(FXMVECTOR N1, FXMVECTOR N2); +XMVECTOR XMVector3AngleBetweenVectors(FXMVECTOR V1, FXMVECTOR V2); +XMVECTOR XMVector3LinePointDistance(FXMVECTOR LinePoint1, FXMVECTOR LinePoint2, FXMVECTOR Point); +VOID XMVector3ComponentsFromNormal(_Out_ XMVECTOR* pParallel, _Out_ XMVECTOR* pPerpendicular, FXMVECTOR V, FXMVECTOR Normal); +XMVECTOR XMVector3Rotate(FXMVECTOR V, FXMVECTOR RotationQuaternion); +XMVECTOR XMVector3InverseRotate(FXMVECTOR V, FXMVECTOR RotationQuaternion); +XMVECTOR XMVector3Transform(FXMVECTOR V, CXMMATRIX M); +XMFLOAT4* XMVector3TransformStream(_Out_bytecap_x_(sizeof(XMFLOAT4)+OutputStride*(VectorCount-1)) XMFLOAT4* pOutputStream, + _In_ UINT OutputStride, + _In_bytecount_x_(sizeof(XMFLOAT3)+InputStride*(VectorCount-1)) CONST XMFLOAT3* pInputStream, + _In_ UINT InputStride, _In_ UINT VectorCount, CXMMATRIX M); +XMFLOAT4* XMVector3TransformStreamNC(_Out_bytecap_x_(sizeof(XMFLOAT4)+OutputStride*(VectorCount-1)) XMFLOAT4* pOutputStream, + _In_ UINT OutputStride, + _In_bytecount_x_(sizeof(XMFLOAT3)+InputStride*(VectorCount-1)) CONST XMFLOAT3* pInputStream, + _In_ UINT InputStride, _In_ UINT VectorCount, CXMMATRIX M); +XMVECTOR XMVector3TransformCoord(FXMVECTOR V, CXMMATRIX M); +XMFLOAT3* XMVector3TransformCoordStream(_Out_bytecap_x_(sizeof(XMFLOAT3)+OutputStride*(VectorCount-1)) XMFLOAT3* pOutputStream, + _In_ UINT OutputStride, + _In_bytecount_x_(sizeof(XMFLOAT3)+InputStride*(VectorCount-1)) CONST XMFLOAT3* pInputStream, + _In_ UINT InputStride, _In_ UINT VectorCount, CXMMATRIX M); +XMVECTOR XMVector3TransformNormal(FXMVECTOR V, CXMMATRIX M); +XMFLOAT3* XMVector3TransformNormalStream(_Out_bytecap_x_(sizeof(XMFLOAT3)+OutputStride*(VectorCount-1)) XMFLOAT3* pOutputStream, + _In_ UINT OutputStride, + _In_bytecount_x_(sizeof(XMFLOAT3)+InputStride*(VectorCount-1)) CONST XMFLOAT3* pInputStream, + _In_ UINT InputStride, _In_ UINT VectorCount, CXMMATRIX M); +XMVECTOR XMVector3Project(FXMVECTOR V, FLOAT ViewportX, FLOAT ViewportY, FLOAT ViewportWidth, FLOAT ViewportHeight, FLOAT ViewportMinZ, FLOAT ViewportMaxZ, + CXMMATRIX Projection, CXMMATRIX View, CXMMATRIX World); +XMFLOAT3* XMVector3ProjectStream(_Out_bytecap_x_(sizeof(XMFLOAT3)+OutputStride*(VectorCount-1)) XMFLOAT3* pOutputStream, + _In_ UINT OutputStride, + _In_bytecount_x_(sizeof(XMFLOAT3)+InputStride*(VectorCount-1)) CONST XMFLOAT3* pInputStream, + _In_ UINT InputStride, _In_ UINT VectorCount, + FLOAT ViewportX, FLOAT ViewportY, FLOAT ViewportWidth, FLOAT ViewportHeight, FLOAT ViewportMinZ, FLOAT ViewportMaxZ, + CXMMATRIX Projection, CXMMATRIX View, CXMMATRIX World); +XMVECTOR XMVector3Unproject(FXMVECTOR V, FLOAT ViewportX, FLOAT ViewportY, FLOAT ViewportWidth, FLOAT ViewportHeight, FLOAT ViewportMinZ, FLOAT ViewportMaxZ, + CXMMATRIX Projection, CXMMATRIX View, CXMMATRIX World); +XMFLOAT3* XMVector3UnprojectStream(_Out_bytecap_x_(sizeof(XMFLOAT3)+OutputStride*(VectorCount-1)) XMFLOAT3* pOutputStream, + _In_ UINT OutputStride, + _In_bytecount_x_(sizeof(XMFLOAT3)+InputStride*(VectorCount-1)) CONST XMFLOAT3* pInputStream, + _In_ UINT InputStride, _In_ UINT VectorCount, + FLOAT ViewportX, FLOAT ViewportY, FLOAT ViewportWidth, FLOAT ViewportHeight, FLOAT ViewportMinZ, FLOAT ViewportMaxZ, + CXMMATRIX Projection, CXMMATRIX View, CXMMATRIX World); + +/**************************************************************************** + * + * 4D vector operations + * + ****************************************************************************/ + +BOOL XMVector4Equal(FXMVECTOR V1, FXMVECTOR V2); +UINT XMVector4EqualR(FXMVECTOR V1, FXMVECTOR V2); +BOOL XMVector4EqualInt(FXMVECTOR V1, FXMVECTOR V2); +UINT XMVector4EqualIntR(FXMVECTOR V1, FXMVECTOR V2); +BOOL XMVector4NearEqual(FXMVECTOR V1, FXMVECTOR V2, FXMVECTOR Epsilon); +BOOL XMVector4NotEqual(FXMVECTOR V1, FXMVECTOR V2); +BOOL XMVector4NotEqualInt(FXMVECTOR V1, FXMVECTOR V2); +BOOL XMVector4Greater(FXMVECTOR V1, FXMVECTOR V2); +UINT XMVector4GreaterR(FXMVECTOR V1, FXMVECTOR V2); +BOOL XMVector4GreaterOrEqual(FXMVECTOR V1, FXMVECTOR V2); +UINT XMVector4GreaterOrEqualR(FXMVECTOR V1, FXMVECTOR V2); +BOOL XMVector4Less(FXMVECTOR V1, FXMVECTOR V2); +BOOL XMVector4LessOrEqual(FXMVECTOR V1, FXMVECTOR V2); +BOOL XMVector4InBounds(FXMVECTOR V, FXMVECTOR Bounds); +UINT XMVector4InBoundsR(FXMVECTOR V, FXMVECTOR Bounds); + +BOOL XMVector4IsNaN(FXMVECTOR V); +BOOL XMVector4IsInfinite(FXMVECTOR V); + +XMVECTOR XMVector4Dot(FXMVECTOR V1, FXMVECTOR V2); +XMVECTOR XMVector4Cross(FXMVECTOR V1, FXMVECTOR V2, FXMVECTOR V3); +XMVECTOR XMVector4LengthSq(FXMVECTOR V); +XMVECTOR XMVector4ReciprocalLengthEst(FXMVECTOR V); +XMVECTOR XMVector4ReciprocalLength(FXMVECTOR V); +XMVECTOR XMVector4LengthEst(FXMVECTOR V); +XMVECTOR XMVector4Length(FXMVECTOR V); +XMVECTOR XMVector4NormalizeEst(FXMVECTOR V); +XMVECTOR XMVector4Normalize(FXMVECTOR V); +XMVECTOR XMVector4ClampLength(FXMVECTOR V, FLOAT LengthMin, FLOAT LengthMax); +XMVECTOR XMVector4ClampLengthV(FXMVECTOR V, FXMVECTOR LengthMin, FXMVECTOR LengthMax); +XMVECTOR XMVector4Reflect(FXMVECTOR Incident, FXMVECTOR Normal); +XMVECTOR XMVector4Refract(FXMVECTOR Incident, FXMVECTOR Normal, FLOAT RefractionIndex); +XMVECTOR XMVector4RefractV(FXMVECTOR Incident, FXMVECTOR Normal, FXMVECTOR RefractionIndex); +XMVECTOR XMVector4Orthogonal(FXMVECTOR V); +XMVECTOR XMVector4AngleBetweenNormalsEst(FXMVECTOR N1, FXMVECTOR N2); +XMVECTOR XMVector4AngleBetweenNormals(FXMVECTOR N1, FXMVECTOR N2); +XMVECTOR XMVector4AngleBetweenVectors(FXMVECTOR V1, FXMVECTOR V2); +XMVECTOR XMVector4Transform(FXMVECTOR V, CXMMATRIX M); +XMFLOAT4* XMVector4TransformStream(_Out_bytecap_x_(sizeof(XMFLOAT4)+OutputStride*(VectorCount-1)) XMFLOAT4* pOutputStream, + _In_ UINT OutputStride, + _In_bytecount_x_(sizeof(XMFLOAT4)+InputStride*(VectorCount-1)) CONST XMFLOAT4* pInputStream, + _In_ UINT InputStride, _In_ UINT VectorCount, CXMMATRIX M); + +/**************************************************************************** + * + * Matrix operations + * + ****************************************************************************/ + +BOOL XMMatrixIsNaN(CXMMATRIX M); +BOOL XMMatrixIsInfinite(CXMMATRIX M); +BOOL XMMatrixIsIdentity(CXMMATRIX M); + +XMMATRIX XMMatrixMultiply(CXMMATRIX M1, CXMMATRIX M2); +XMMATRIX XMMatrixMultiplyTranspose(CXMMATRIX M1, CXMMATRIX M2); +XMMATRIX XMMatrixTranspose(CXMMATRIX M); +XMMATRIX XMMatrixInverse(_Out_ XMVECTOR* pDeterminant, CXMMATRIX M); +XMVECTOR XMMatrixDeterminant(CXMMATRIX M); +BOOL XMMatrixDecompose(_Out_ XMVECTOR *outScale, _Out_ XMVECTOR *outRotQuat, _Out_ XMVECTOR *outTrans, CXMMATRIX M); + +XMMATRIX XMMatrixIdentity(); +XMMATRIX XMMatrixSet(FLOAT m00, FLOAT m01, FLOAT m02, FLOAT m03, + FLOAT m10, FLOAT m11, FLOAT m12, FLOAT m13, + FLOAT m20, FLOAT m21, FLOAT m22, FLOAT m23, + FLOAT m30, FLOAT m31, FLOAT m32, FLOAT m33); +XMMATRIX XMMatrixTranslation(FLOAT OffsetX, FLOAT OffsetY, FLOAT OffsetZ); +XMMATRIX XMMatrixTranslationFromVector(FXMVECTOR Offset); +XMMATRIX XMMatrixScaling(FLOAT ScaleX, FLOAT ScaleY, FLOAT ScaleZ); +XMMATRIX XMMatrixScalingFromVector(FXMVECTOR Scale); +XMMATRIX XMMatrixRotationX(FLOAT Angle); +XMMATRIX XMMatrixRotationY(FLOAT Angle); +XMMATRIX XMMatrixRotationZ(FLOAT Angle); +XMMATRIX XMMatrixRotationRollPitchYaw(FLOAT Pitch, FLOAT Yaw, FLOAT Roll); +XMMATRIX XMMatrixRotationRollPitchYawFromVector(FXMVECTOR Angles); +XMMATRIX XMMatrixRotationNormal(FXMVECTOR NormalAxis, FLOAT Angle); +XMMATRIX XMMatrixRotationAxis(FXMVECTOR Axis, FLOAT Angle); +XMMATRIX XMMatrixRotationQuaternion(FXMVECTOR Quaternion); +XMMATRIX XMMatrixTransformation2D(FXMVECTOR ScalingOrigin, FLOAT ScalingOrientation, FXMVECTOR Scaling, + FXMVECTOR RotationOrigin, FLOAT Rotation, CXMVECTOR Translation); +XMMATRIX XMMatrixTransformation(FXMVECTOR ScalingOrigin, FXMVECTOR ScalingOrientationQuaternion, FXMVECTOR Scaling, + CXMVECTOR RotationOrigin, CXMVECTOR RotationQuaternion, CXMVECTOR Translation); +XMMATRIX XMMatrixAffineTransformation2D(FXMVECTOR Scaling, FXMVECTOR RotationOrigin, FLOAT Rotation, FXMVECTOR Translation); +XMMATRIX XMMatrixAffineTransformation(FXMVECTOR Scaling, FXMVECTOR RotationOrigin, FXMVECTOR RotationQuaternion, CXMVECTOR Translation); +XMMATRIX XMMatrixReflect(FXMVECTOR ReflectionPlane); +XMMATRIX XMMatrixShadow(FXMVECTOR ShadowPlane, FXMVECTOR LightPosition); + +XMMATRIX XMMatrixLookAtLH(FXMVECTOR EyePosition, FXMVECTOR FocusPosition, FXMVECTOR UpDirection); +XMMATRIX XMMatrixLookAtRH(FXMVECTOR EyePosition, FXMVECTOR FocusPosition, FXMVECTOR UpDirection); +XMMATRIX XMMatrixLookToLH(FXMVECTOR EyePosition, FXMVECTOR EyeDirection, FXMVECTOR UpDirection); +XMMATRIX XMMatrixLookToRH(FXMVECTOR EyePosition, FXMVECTOR EyeDirection, FXMVECTOR UpDirection); +XMMATRIX XMMatrixPerspectiveLH(FLOAT ViewWidth, FLOAT ViewHeight, FLOAT NearZ, FLOAT FarZ); +XMMATRIX XMMatrixPerspectiveRH(FLOAT ViewWidth, FLOAT ViewHeight, FLOAT NearZ, FLOAT FarZ); +XMMATRIX XMMatrixPerspectiveFovLH(FLOAT FovAngleY, FLOAT AspectHByW, FLOAT NearZ, FLOAT FarZ); +XMMATRIX XMMatrixPerspectiveFovRH(FLOAT FovAngleY, FLOAT AspectHByW, FLOAT NearZ, FLOAT FarZ); +XMMATRIX XMMatrixPerspectiveOffCenterLH(FLOAT ViewLeft, FLOAT ViewRight, FLOAT ViewBottom, FLOAT ViewTop, FLOAT NearZ, FLOAT FarZ); +XMMATRIX XMMatrixPerspectiveOffCenterRH(FLOAT ViewLeft, FLOAT ViewRight, FLOAT ViewBottom, FLOAT ViewTop, FLOAT NearZ, FLOAT FarZ); +XMMATRIX XMMatrixOrthographicLH(FLOAT ViewWidth, FLOAT ViewHeight, FLOAT NearZ, FLOAT FarZ); +XMMATRIX XMMatrixOrthographicRH(FLOAT ViewWidth, FLOAT ViewHeight, FLOAT NearZ, FLOAT FarZ); +XMMATRIX XMMatrixOrthographicOffCenterLH(FLOAT ViewLeft, FLOAT ViewRight, FLOAT ViewBottom, FLOAT ViewTop, FLOAT NearZ, FLOAT FarZ); +XMMATRIX XMMatrixOrthographicOffCenterRH(FLOAT ViewLeft, FLOAT ViewRight, FLOAT ViewBottom, FLOAT ViewTop, FLOAT NearZ, FLOAT FarZ); + +/**************************************************************************** + * + * Quaternion operations + * + ****************************************************************************/ + +BOOL XMQuaternionEqual(FXMVECTOR Q1, FXMVECTOR Q2); +BOOL XMQuaternionNotEqual(FXMVECTOR Q1, FXMVECTOR Q2); + +BOOL XMQuaternionIsNaN(FXMVECTOR Q); +BOOL XMQuaternionIsInfinite(FXMVECTOR Q); +BOOL XMQuaternionIsIdentity(FXMVECTOR Q); + +XMVECTOR XMQuaternionDot(FXMVECTOR Q1, FXMVECTOR Q2); +XMVECTOR XMQuaternionMultiply(FXMVECTOR Q1, FXMVECTOR Q2); +XMVECTOR XMQuaternionLengthSq(FXMVECTOR Q); +XMVECTOR XMQuaternionReciprocalLength(FXMVECTOR Q); +XMVECTOR XMQuaternionLength(FXMVECTOR Q); +XMVECTOR XMQuaternionNormalizeEst(FXMVECTOR Q); +XMVECTOR XMQuaternionNormalize(FXMVECTOR Q); +XMVECTOR XMQuaternionConjugate(FXMVECTOR Q); +XMVECTOR XMQuaternionInverse(FXMVECTOR Q); +XMVECTOR XMQuaternionLn(FXMVECTOR Q); +XMVECTOR XMQuaternionExp(FXMVECTOR Q); +XMVECTOR XMQuaternionSlerp(FXMVECTOR Q0, FXMVECTOR Q1, FLOAT t); +XMVECTOR XMQuaternionSlerpV(FXMVECTOR Q0, FXMVECTOR Q1, FXMVECTOR T); +XMVECTOR XMQuaternionSquad(FXMVECTOR Q0, FXMVECTOR Q1, FXMVECTOR Q2, CXMVECTOR Q3, FLOAT t); +XMVECTOR XMQuaternionSquadV(FXMVECTOR Q0, FXMVECTOR Q1, FXMVECTOR Q2, CXMVECTOR Q3, CXMVECTOR T); +VOID XMQuaternionSquadSetup(_Out_ XMVECTOR* pA, _Out_ XMVECTOR* pB, _Out_ XMVECTOR* pC, FXMVECTOR Q0, FXMVECTOR Q1, FXMVECTOR Q2, CXMVECTOR Q3); +XMVECTOR XMQuaternionBaryCentric(FXMVECTOR Q0, FXMVECTOR Q1, FXMVECTOR Q2, FLOAT f, FLOAT g); +XMVECTOR XMQuaternionBaryCentricV(FXMVECTOR Q0, FXMVECTOR Q1, FXMVECTOR Q2, CXMVECTOR F, CXMVECTOR G); + +XMVECTOR XMQuaternionIdentity(); +XMVECTOR XMQuaternionRotationRollPitchYaw(FLOAT Pitch, FLOAT Yaw, FLOAT Roll); +XMVECTOR XMQuaternionRotationRollPitchYawFromVector(FXMVECTOR Angles); +XMVECTOR XMQuaternionRotationNormal(FXMVECTOR NormalAxis, FLOAT Angle); +XMVECTOR XMQuaternionRotationAxis(FXMVECTOR Axis, FLOAT Angle); +XMVECTOR XMQuaternionRotationMatrix(CXMMATRIX M); + +VOID XMQuaternionToAxisAngle(_Out_ XMVECTOR* pAxis, _Out_ FLOAT* pAngle, FXMVECTOR Q); + +/**************************************************************************** + * + * Plane operations + * + ****************************************************************************/ + +BOOL XMPlaneEqual(FXMVECTOR P1, FXMVECTOR P2); +BOOL XMPlaneNearEqual(FXMVECTOR P1, FXMVECTOR P2, FXMVECTOR Epsilon); +BOOL XMPlaneNotEqual(FXMVECTOR P1, FXMVECTOR P2); + +BOOL XMPlaneIsNaN(FXMVECTOR P); +BOOL XMPlaneIsInfinite(FXMVECTOR P); + +XMVECTOR XMPlaneDot(FXMVECTOR P, FXMVECTOR V); +XMVECTOR XMPlaneDotCoord(FXMVECTOR P, FXMVECTOR V); +XMVECTOR XMPlaneDotNormal(FXMVECTOR P, FXMVECTOR V); +XMVECTOR XMPlaneNormalizeEst(FXMVECTOR P); +XMVECTOR XMPlaneNormalize(FXMVECTOR P); +XMVECTOR XMPlaneIntersectLine(FXMVECTOR P, FXMVECTOR LinePoint1, FXMVECTOR LinePoint2); +VOID XMPlaneIntersectPlane(_Out_ XMVECTOR* pLinePoint1, _Out_ XMVECTOR* pLinePoint2, FXMVECTOR P1, FXMVECTOR P2); +XMVECTOR XMPlaneTransform(FXMVECTOR P, CXMMATRIX M); +XMFLOAT4* XMPlaneTransformStream(_Out_bytecap_x_(sizeof(XMFLOAT4)+OutputStride*(PlaneCount-1)) XMFLOAT4* pOutputStream, + _In_ UINT OutputStride, + _In_bytecount_x_(sizeof(XMFLOAT4)+InputStride*(PlaneCount-1)) CONST XMFLOAT4* pInputStream, + _In_ UINT InputStride, _In_ UINT PlaneCount, CXMMATRIX M); + +XMVECTOR XMPlaneFromPointNormal(FXMVECTOR Point, FXMVECTOR Normal); +XMVECTOR XMPlaneFromPoints(FXMVECTOR Point1, FXMVECTOR Point2, FXMVECTOR Point3); + +/**************************************************************************** + * + * Color operations + * + ****************************************************************************/ + +BOOL XMColorEqual(FXMVECTOR C1, FXMVECTOR C2); +BOOL XMColorNotEqual(FXMVECTOR C1, FXMVECTOR C2); +BOOL XMColorGreater(FXMVECTOR C1, FXMVECTOR C2); +BOOL XMColorGreaterOrEqual(FXMVECTOR C1, FXMVECTOR C2); +BOOL XMColorLess(FXMVECTOR C1, FXMVECTOR C2); +BOOL XMColorLessOrEqual(FXMVECTOR C1, FXMVECTOR C2); + +BOOL XMColorIsNaN(FXMVECTOR C); +BOOL XMColorIsInfinite(FXMVECTOR C); + +XMVECTOR XMColorNegative(FXMVECTOR C); +XMVECTOR XMColorModulate(FXMVECTOR C1, FXMVECTOR C2); +XMVECTOR XMColorAdjustSaturation(FXMVECTOR C, FLOAT Saturation); +XMVECTOR XMColorAdjustContrast(FXMVECTOR C, FLOAT Contrast); + +/**************************************************************************** + * + * Miscellaneous operations + * + ****************************************************************************/ + +BOOL XMVerifyCPUSupport(); + +VOID XMAssert(_In_z_ CONST CHAR* pExpression, _In_z_ CONST CHAR* pFileName, UINT LineNumber); + +XMVECTOR XMFresnelTerm(FXMVECTOR CosIncidentAngle, FXMVECTOR RefractionIndex); + +BOOL XMScalarNearEqual(FLOAT S1, FLOAT S2, FLOAT Epsilon); +FLOAT XMScalarModAngle(FLOAT Value); +FLOAT XMScalarSin(FLOAT Value); +FLOAT XMScalarCos(FLOAT Value); +VOID XMScalarSinCos(_Out_ FLOAT* pSin, _Out_ FLOAT* pCos, FLOAT Value); +FLOAT XMScalarASin(FLOAT Value); +FLOAT XMScalarACos(FLOAT Value); +FLOAT XMScalarSinEst(FLOAT Value); +FLOAT XMScalarCosEst(FLOAT Value); +VOID XMScalarSinCosEst(_Out_ FLOAT* pSin, _Out_ FLOAT* pCos, FLOAT Value); +FLOAT XMScalarASinEst(FLOAT Value); +FLOAT XMScalarACosEst(FLOAT Value); + +/**************************************************************************** + * + * Globals + * + ****************************************************************************/ + +// The purpose of the following global constants is to prevent redundant +// reloading of the constants when they are referenced by more than one +// separate inline math routine called within the same function. Declaring +// a constant locally within a routine is sufficient to prevent redundant +// reloads of that constant when that single routine is called multiple +// times in a function, but if the constant is used (and declared) in a +// separate math routine it would be reloaded. + +#define XMGLOBALCONST extern CONST __declspec(selectany) + +XMGLOBALCONST XMVECTORF32 g_XMSinCoefficients0 = {1.0f, -0.166666667f, 8.333333333e-3f, -1.984126984e-4f}; +XMGLOBALCONST XMVECTORF32 g_XMSinCoefficients1 = {2.755731922e-6f, -2.505210839e-8f, 1.605904384e-10f, -7.647163732e-13f}; +XMGLOBALCONST XMVECTORF32 g_XMSinCoefficients2 = {2.811457254e-15f, -8.220635247e-18f, 1.957294106e-20f, -3.868170171e-23f}; +XMGLOBALCONST XMVECTORF32 g_XMCosCoefficients0 = {1.0f, -0.5f, 4.166666667e-2f, -1.388888889e-3f}; +XMGLOBALCONST XMVECTORF32 g_XMCosCoefficients1 = {2.480158730e-5f, -2.755731922e-7f, 2.087675699e-9f, -1.147074560e-11f}; +XMGLOBALCONST XMVECTORF32 g_XMCosCoefficients2 = {4.779477332e-14f, -1.561920697e-16f, 4.110317623e-19f, -8.896791392e-22f}; +XMGLOBALCONST XMVECTORF32 g_XMTanCoefficients0 = {1.0f, 0.333333333f, 0.133333333f, 5.396825397e-2f}; +XMGLOBALCONST XMVECTORF32 g_XMTanCoefficients1 = {2.186948854e-2f, 8.863235530e-3f, 3.592128167e-3f, 1.455834485e-3f}; +XMGLOBALCONST XMVECTORF32 g_XMTanCoefficients2 = {5.900274264e-4f, 2.391290764e-4f, 9.691537707e-5f, 3.927832950e-5f}; +XMGLOBALCONST XMVECTORF32 g_XMASinCoefficients0 = {-0.05806367563904f, -0.41861972469416f, 0.22480114791621f, 2.17337241360606f}; +XMGLOBALCONST XMVECTORF32 g_XMASinCoefficients1 = {0.61657275907170f, 4.29696498283455f, -1.18942822255452f, -6.53784832094831f}; +XMGLOBALCONST XMVECTORF32 g_XMASinCoefficients2 = {-1.36926553863413f, -4.48179294237210f, 1.41810672941833f, 5.48179257935713f}; +XMGLOBALCONST XMVECTORF32 g_XMATanCoefficients0 = {1.0f, 0.333333334f, 0.2f, 0.142857143f}; +XMGLOBALCONST XMVECTORF32 g_XMATanCoefficients1 = {1.111111111e-1f, 9.090909091e-2f, 7.692307692e-2f, 6.666666667e-2f}; +XMGLOBALCONST XMVECTORF32 g_XMATanCoefficients2 = {5.882352941e-2f, 5.263157895e-2f, 4.761904762e-2f, 4.347826087e-2f}; +XMGLOBALCONST XMVECTORF32 g_XMSinEstCoefficients = {1.0f, -1.66521856991541e-1f, 8.199913018755e-3f, -1.61475937228e-4f}; +XMGLOBALCONST XMVECTORF32 g_XMCosEstCoefficients = {1.0f, -4.95348008918096e-1f, 3.878259962881e-2f, -9.24587976263e-4f}; +XMGLOBALCONST XMVECTORF32 g_XMTanEstCoefficients = {2.484f, -1.954923183e-1f, 2.467401101f, XM_1DIVPI}; +XMGLOBALCONST XMVECTORF32 g_XMATanEstCoefficients = {7.689891418951e-1f, 1.104742493348f, 8.661844266006e-1f, XM_PIDIV2}; +XMGLOBALCONST XMVECTORF32 g_XMASinEstCoefficients = {-1.36178272886711f, 2.37949493464538f, -8.08228565650486e-1f, 2.78440142746736e-1f}; +XMGLOBALCONST XMVECTORF32 g_XMASinEstConstants = {1.00000011921f, XM_PIDIV2, 0.0f, 0.0f}; +XMGLOBALCONST XMVECTORF32 g_XMPiConstants0 = {XM_PI, XM_2PI, XM_1DIVPI, XM_1DIV2PI}; +XMGLOBALCONST XMVECTORF32 g_XMIdentityR0 = {1.0f, 0.0f, 0.0f, 0.0f}; +XMGLOBALCONST XMVECTORF32 g_XMIdentityR1 = {0.0f, 1.0f, 0.0f, 0.0f}; +XMGLOBALCONST XMVECTORF32 g_XMIdentityR2 = {0.0f, 0.0f, 1.0f, 0.0f}; +XMGLOBALCONST XMVECTORF32 g_XMIdentityR3 = {0.0f, 0.0f, 0.0f, 1.0f}; +XMGLOBALCONST XMVECTORF32 g_XMNegIdentityR0 = {-1.0f,0.0f, 0.0f, 0.0f}; +XMGLOBALCONST XMVECTORF32 g_XMNegIdentityR1 = {0.0f,-1.0f, 0.0f, 0.0f}; +XMGLOBALCONST XMVECTORF32 g_XMNegIdentityR2 = {0.0f, 0.0f,-1.0f, 0.0f}; +XMGLOBALCONST XMVECTORF32 g_XMNegIdentityR3 = {0.0f, 0.0f, 0.0f,-1.0f}; +XMGLOBALCONST XMVECTORI32 g_XMNegativeZero = {0x80000000, 0x80000000, 0x80000000, 0x80000000}; +XMGLOBALCONST XMVECTORI32 g_XMNegate3 = {0x80000000, 0x80000000, 0x80000000, 0x00000000}; +XMGLOBALCONST XMVECTORI32 g_XMMask3 = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000}; +XMGLOBALCONST XMVECTORI32 g_XMMaskX = {0xFFFFFFFF, 0x00000000, 0x00000000, 0x00000000}; +XMGLOBALCONST XMVECTORI32 g_XMMaskY = {0x00000000, 0xFFFFFFFF, 0x00000000, 0x00000000}; +XMGLOBALCONST XMVECTORI32 g_XMMaskZ = {0x00000000, 0x00000000, 0xFFFFFFFF, 0x00000000}; +XMGLOBALCONST XMVECTORI32 g_XMMaskW = {0x00000000, 0x00000000, 0x00000000, 0xFFFFFFFF}; +XMGLOBALCONST XMVECTORF32 g_XMOne = { 1.0f, 1.0f, 1.0f, 1.0f}; +XMGLOBALCONST XMVECTORF32 g_XMOne3 = { 1.0f, 1.0f, 1.0f, 0.0f}; +XMGLOBALCONST XMVECTORF32 g_XMZero = { 0.0f, 0.0f, 0.0f, 0.0f}; +XMGLOBALCONST XMVECTORF32 g_XMNegativeOne = {-1.0f,-1.0f,-1.0f,-1.0f}; +XMGLOBALCONST XMVECTORF32 g_XMOneHalf = { 0.5f, 0.5f, 0.5f, 0.5f}; +XMGLOBALCONST XMVECTORF32 g_XMNegativeOneHalf = {-0.5f,-0.5f,-0.5f,-0.5f}; +XMGLOBALCONST XMVECTORF32 g_XMNegativeTwoPi = {-XM_2PI, -XM_2PI, -XM_2PI, -XM_2PI}; +XMGLOBALCONST XMVECTORF32 g_XMNegativePi = {-XM_PI, -XM_PI, -XM_PI, -XM_PI}; +XMGLOBALCONST XMVECTORF32 g_XMHalfPi = {XM_PIDIV2, XM_PIDIV2, XM_PIDIV2, XM_PIDIV2}; +XMGLOBALCONST XMVECTORF32 g_XMPi = {XM_PI, XM_PI, XM_PI, XM_PI}; +XMGLOBALCONST XMVECTORF32 g_XMReciprocalPi = {XM_1DIVPI, XM_1DIVPI, XM_1DIVPI, XM_1DIVPI}; +XMGLOBALCONST XMVECTORF32 g_XMTwoPi = {XM_2PI, XM_2PI, XM_2PI, XM_2PI}; +XMGLOBALCONST XMVECTORF32 g_XMReciprocalTwoPi = {XM_1DIV2PI, XM_1DIV2PI, XM_1DIV2PI, XM_1DIV2PI}; +XMGLOBALCONST XMVECTORF32 g_XMEpsilon = {1.192092896e-7f, 1.192092896e-7f, 1.192092896e-7f, 1.192092896e-7f}; +XMGLOBALCONST XMVECTORI32 g_XMInfinity = {0x7F800000, 0x7F800000, 0x7F800000, 0x7F800000}; +XMGLOBALCONST XMVECTORI32 g_XMQNaN = {0x7FC00000, 0x7FC00000, 0x7FC00000, 0x7FC00000}; +XMGLOBALCONST XMVECTORI32 g_XMQNaNTest = {0x007FFFFF, 0x007FFFFF, 0x007FFFFF, 0x007FFFFF}; +XMGLOBALCONST XMVECTORI32 g_XMAbsMask = {0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF}; +XMGLOBALCONST XMVECTORI32 g_XMFltMin = {0x00800000, 0x00800000, 0x00800000, 0x00800000}; +XMGLOBALCONST XMVECTORI32 g_XMFltMax = {0x7F7FFFFF, 0x7F7FFFFF, 0x7F7FFFFF, 0x7F7FFFFF}; +XMGLOBALCONST XMVECTORI32 g_XMNegOneMask = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF}; +XMGLOBALCONST XMVECTORI32 g_XMMaskA8R8G8B8 = {0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000}; +XMGLOBALCONST XMVECTORI32 g_XMFlipA8R8G8B8 = {0x00000000, 0x00000000, 0x00000000, 0x80000000}; +XMGLOBALCONST XMVECTORF32 g_XMFixAA8R8G8B8 = {0.0f,0.0f,0.0f,(float)(0x80000000U)}; +XMGLOBALCONST XMVECTORF32 g_XMNormalizeA8R8G8B8 = {1.0f/(255.0f*(float)(0x10000)),1.0f/(255.0f*(float)(0x100)),1.0f/255.0f,1.0f/(255.0f*(float)(0x1000000))}; +XMGLOBALCONST XMVECTORI32 g_XMMaskA2B10G10R10 = {0x000003FF, 0x000FFC00, 0x3FF00000, 0xC0000000}; +XMGLOBALCONST XMVECTORI32 g_XMFlipA2B10G10R10 = {0x00000200, 0x00080000, 0x20000000, 0x80000000}; +XMGLOBALCONST XMVECTORF32 g_XMFixAA2B10G10R10 = {-512.0f,-512.0f*(float)(0x400),-512.0f*(float)(0x100000),(float)(0x80000000U)}; +XMGLOBALCONST XMVECTORF32 g_XMNormalizeA2B10G10R10 = {1.0f/511.0f,1.0f/(511.0f*(float)(0x400)),1.0f/(511.0f*(float)(0x100000)),1.0f/(3.0f*(float)(0x40000000))}; +XMGLOBALCONST XMVECTORI32 g_XMMaskX16Y16 = {0x0000FFFF, 0xFFFF0000, 0x00000000, 0x00000000}; +XMGLOBALCONST XMVECTORI32 g_XMFlipX16Y16 = {0x00008000, 0x00000000, 0x00000000, 0x00000000}; +XMGLOBALCONST XMVECTORF32 g_XMFixX16Y16 = {-32768.0f,0.0f,0.0f,0.0f}; +XMGLOBALCONST XMVECTORF32 g_XMNormalizeX16Y16 = {1.0f/32767.0f,1.0f/(32767.0f*65536.0f),0.0f,0.0f}; +XMGLOBALCONST XMVECTORI32 g_XMMaskX16Y16Z16W16 = {0x0000FFFF, 0x0000FFFF, 0xFFFF0000, 0xFFFF0000}; +XMGLOBALCONST XMVECTORI32 g_XMFlipX16Y16Z16W16 = {0x00008000, 0x00008000, 0x00000000, 0x00000000}; +XMGLOBALCONST XMVECTORF32 g_XMFixX16Y16Z16W16 = {-32768.0f,-32768.0f,0.0f,0.0f}; +XMGLOBALCONST XMVECTORF32 g_XMNormalizeX16Y16Z16W16 = {1.0f/32767.0f,1.0f/32767.0f,1.0f/(32767.0f*65536.0f),1.0f/(32767.0f*65536.0f)}; +XMGLOBALCONST XMVECTORF32 g_XMNoFraction = {8388608.0f,8388608.0f,8388608.0f,8388608.0f}; +XMGLOBALCONST XMVECTORI32 g_XMMaskByte = {0x000000FF, 0x000000FF, 0x000000FF, 0x000000FF}; +XMGLOBALCONST XMVECTORF32 g_XMNegateX = {-1.0f, 1.0f, 1.0f, 1.0f}; +XMGLOBALCONST XMVECTORF32 g_XMNegateY = { 1.0f,-1.0f, 1.0f, 1.0f}; +XMGLOBALCONST XMVECTORF32 g_XMNegateZ = { 1.0f, 1.0f,-1.0f, 1.0f}; +XMGLOBALCONST XMVECTORF32 g_XMNegateW = { 1.0f, 1.0f, 1.0f,-1.0f}; +XMGLOBALCONST XMVECTORI32 g_XMSelect0101 = {XM_SELECT_0, XM_SELECT_1, XM_SELECT_0, XM_SELECT_1}; +XMGLOBALCONST XMVECTORI32 g_XMSelect1010 = {XM_SELECT_1, XM_SELECT_0, XM_SELECT_1, XM_SELECT_0}; +XMGLOBALCONST XMVECTORI32 g_XMOneHalfMinusEpsilon = { 0x3EFFFFFD, 0x3EFFFFFD, 0x3EFFFFFD, 0x3EFFFFFD}; +XMGLOBALCONST XMVECTORI32 g_XMSelect1000 = {XM_SELECT_1, XM_SELECT_0, XM_SELECT_0, XM_SELECT_0}; +XMGLOBALCONST XMVECTORI32 g_XMSelect1100 = {XM_SELECT_1, XM_SELECT_1, XM_SELECT_0, XM_SELECT_0}; +XMGLOBALCONST XMVECTORI32 g_XMSelect1110 = {XM_SELECT_1, XM_SELECT_1, XM_SELECT_1, XM_SELECT_0}; +XMGLOBALCONST XMVECTORI32 g_XMSwizzleXYXY = {XM_PERMUTE_0X, XM_PERMUTE_0Y, XM_PERMUTE_0X, XM_PERMUTE_0Y}; +XMGLOBALCONST XMVECTORI32 g_XMSwizzleXYZX = {XM_PERMUTE_0X, XM_PERMUTE_0Y, XM_PERMUTE_0Z, XM_PERMUTE_0X}; +XMGLOBALCONST XMVECTORI32 g_XMSwizzleYXZW = {XM_PERMUTE_0Y, XM_PERMUTE_0X, XM_PERMUTE_0Z, XM_PERMUTE_0W}; +XMGLOBALCONST XMVECTORI32 g_XMSwizzleYZXW = {XM_PERMUTE_0Y, XM_PERMUTE_0Z, XM_PERMUTE_0X, XM_PERMUTE_0W}; +XMGLOBALCONST XMVECTORI32 g_XMSwizzleZXYW = {XM_PERMUTE_0Z, XM_PERMUTE_0X, XM_PERMUTE_0Y, XM_PERMUTE_0W}; +XMGLOBALCONST XMVECTORI32 g_XMPermute0X0Y1X1Y = {XM_PERMUTE_0X, XM_PERMUTE_0Y, XM_PERMUTE_1X, XM_PERMUTE_1Y}; +XMGLOBALCONST XMVECTORI32 g_XMPermute0Z0W1Z1W = {XM_PERMUTE_0Z, XM_PERMUTE_0W, XM_PERMUTE_1Z, XM_PERMUTE_1W}; +XMGLOBALCONST XMVECTORF32 g_XMFixupY16 = {1.0f,1.0f/65536.0f,0.0f,0.0f}; +XMGLOBALCONST XMVECTORF32 g_XMFixupY16W16 = {1.0f,1.0f,1.0f/65536.0f,1.0f/65536.0f}; +XMGLOBALCONST XMVECTORI32 g_XMFlipY = {0,0x80000000,0,0}; +XMGLOBALCONST XMVECTORI32 g_XMFlipZ = {0,0,0x80000000,0}; +XMGLOBALCONST XMVECTORI32 g_XMFlipW = {0,0,0,0x80000000}; +XMGLOBALCONST XMVECTORI32 g_XMFlipYZ = {0,0x80000000,0x80000000,0}; +XMGLOBALCONST XMVECTORI32 g_XMFlipZW = {0,0,0x80000000,0x80000000}; +XMGLOBALCONST XMVECTORI32 g_XMFlipYW = {0,0x80000000,0,0x80000000}; +XMGLOBALCONST XMVECTORI32 g_XMMaskHenD3 = {0x7FF,0x7ff<<11,0x3FF<<22,0}; +XMGLOBALCONST XMVECTORI32 g_XMMaskDHen3 = {0x3FF,0x7ff<<10,0x7FF<<21,0}; +XMGLOBALCONST XMVECTORF32 g_XMAddUHenD3 = {0,0,32768.0f*65536.0f,0}; +XMGLOBALCONST XMVECTORF32 g_XMAddHenD3 = {-1024.0f,-1024.0f*2048.0f,0,0}; +XMGLOBALCONST XMVECTORF32 g_XMAddDHen3 = {-512.0f,-1024.0f*1024.0f,0,0}; +XMGLOBALCONST XMVECTORF32 g_XMMulHenD3 = {1.0f,1.0f/2048.0f,1.0f/(2048.0f*2048.0f),0}; +XMGLOBALCONST XMVECTORF32 g_XMMulDHen3 = {1.0f,1.0f/1024.0f,1.0f/(1024.0f*2048.0f),0}; +XMGLOBALCONST XMVECTORI32 g_XMXorHenD3 = {0x400,0x400<<11,0,0}; +XMGLOBALCONST XMVECTORI32 g_XMXorDHen3 = {0x200,0x400<<10,0,0}; +XMGLOBALCONST XMVECTORI32 g_XMMaskIco4 = {0xFFFFF,0xFFFFF000,0xFFFFF,0xF0000000}; +XMGLOBALCONST XMVECTORI32 g_XMXorXIco4 = {0x80000,0,0x80000,0x80000000}; +XMGLOBALCONST XMVECTORI32 g_XMXorIco4 = {0x80000,0,0x80000,0}; +XMGLOBALCONST XMVECTORF32 g_XMAddXIco4 = {-8.0f*65536.0f,0,-8.0f*65536.0f,32768.0f*65536.0f}; +XMGLOBALCONST XMVECTORF32 g_XMAddUIco4 = {0,32768.0f*65536.0f,0,32768.0f*65536.0f}; +XMGLOBALCONST XMVECTORF32 g_XMAddIco4 = {-8.0f*65536.0f,0,-8.0f*65536.0f,0}; +XMGLOBALCONST XMVECTORF32 g_XMMulIco4 = {1.0f,1.0f/4096.0f,1.0f,1.0f/(4096.0f*65536.0f)}; +XMGLOBALCONST XMVECTORI32 g_XMMaskDec4 = {0x3FF,0x3FF<<10,0x3FF<<20,0x3<<30}; +XMGLOBALCONST XMVECTORI32 g_XMXorDec4 = {0x200,0x200<<10,0x200<<20,0}; +XMGLOBALCONST XMVECTORF32 g_XMAddUDec4 = {0,0,0,32768.0f*65536.0f}; +XMGLOBALCONST XMVECTORF32 g_XMAddDec4 = {-512.0f,-512.0f*1024.0f,-512.0f*1024.0f*1024.0f,0}; +XMGLOBALCONST XMVECTORF32 g_XMMulDec4 = {1.0f,1.0f/1024.0f,1.0f/(1024.0f*1024.0f),1.0f/(1024.0f*1024.0f*1024.0f)}; +XMGLOBALCONST XMVECTORI32 g_XMMaskByte4 = {0xFF,0xFF00,0xFF0000,0xFF000000}; +XMGLOBALCONST XMVECTORI32 g_XMXorByte4 = {0x80,0x8000,0x800000,0x00000000}; +XMGLOBALCONST XMVECTORF32 g_XMAddByte4 = {-128.0f,-128.0f*256.0f,-128.0f*65536.0f,0}; + +/**************************************************************************** + * + * Implementation + * + ****************************************************************************/ + +#pragma warning(push) +#pragma warning(disable:4214 4204 4365 4616 6001) + +#if !defined(__cplusplus) && !defined(_XBOX) && defined(_XM_ISVS2005_) + +/* Work around VC 2005 bug where math.h defines logf with a semicolon at the end. + * Note this is fixed as of Visual Studio 2005 Service Pack 1 + */ + +#undef logf +#define logf(x) ((float)log((double)(x))) + +#endif // !defined(__cplusplus) && !defined(_XBOX) && defined(_XM_ISVS2005_) + +//------------------------------------------------------------------------------ + +#if defined(_XM_NO_INTRINSICS_) || defined(_XM_SSE_INTRINSICS_) + +XMFINLINE XMVECTOR XMVectorSetBinaryConstant(UINT C0, UINT C1, UINT C2, UINT C3) +{ +#if defined(_XM_NO_INTRINSICS_) + XMVECTORU32 vResult; + vResult.u[0] = (0-(C0&1)) & 0x3F800000; + vResult.u[1] = (0-(C1&1)) & 0x3F800000; + vResult.u[2] = (0-(C2&1)) & 0x3F800000; + vResult.u[3] = (0-(C3&1)) & 0x3F800000; + return vResult.v; +#else // XM_SSE_INTRINSICS_ + static const XMVECTORU32 g_vMask1 = {1,1,1,1}; + // Move the parms to a vector + __m128i vTemp = _mm_set_epi32(C3,C2,C1,C0); + // Mask off the low bits + vTemp = _mm_and_si128(vTemp,g_vMask1); + // 0xFFFFFFFF on true bits + vTemp = _mm_cmpeq_epi32(vTemp,g_vMask1); + // 0xFFFFFFFF -> 1.0f, 0x00000000 -> 0.0f + vTemp = _mm_and_si128(vTemp,g_XMOne); + return reinterpret_cast(&vTemp)[0]; +#endif +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorSplatConstant(INT IntConstant, UINT DivExponent) +{ +#if defined(_XM_NO_INTRINSICS_) + XMASSERT( IntConstant >= -16 && IntConstant <= 15 ); + XMASSERT(DivExponent<32); + { + XMVECTORI32 V = { IntConstant, IntConstant, IntConstant, IntConstant }; + return XMConvertVectorIntToFloat( V.v, DivExponent); + } +#else // XM_SSE_INTRINSICS_ + XMASSERT( IntConstant >= -16 && IntConstant <= 15 ); + XMASSERT(DivExponent<32); + // Splat the int + __m128i vScale = _mm_set1_epi32(IntConstant); + // Convert to a float + XMVECTOR vResult = _mm_cvtepi32_ps(vScale); + // Convert DivExponent into 1.0f/(1<(&vScale)[0]); + return vResult; +#endif +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorSplatConstantInt(INT IntConstant) +{ +#if defined(_XM_NO_INTRINSICS_) + XMASSERT( IntConstant >= -16 && IntConstant <= 15 ); + { + XMVECTORI32 V = { IntConstant, IntConstant, IntConstant, IntConstant }; + return V.v; + } +#else // XM_SSE_INTRINSICS_ + XMASSERT( IntConstant >= -16 && IntConstant <= 15 ); + __m128i V = _mm_set1_epi32( IntConstant ); + return reinterpret_cast<__m128 *>(&V)[0]; +#endif +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorShiftLeft(FXMVECTOR V1, FXMVECTOR V2, UINT Elements) +{ + return XMVectorPermute(V1, V2, XMVectorPermuteControl((Elements), ((Elements) + 1), ((Elements) + 2), ((Elements) + 3))); +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorRotateLeft(FXMVECTOR V, UINT Elements) +{ +#if defined(_XM_NO_INTRINSICS_) + XMASSERT( Elements < 4 ); + { + XMVECTORF32 vResult = { V.vector4_f32[Elements & 3], V.vector4_f32[(Elements + 1) & 3], + V.vector4_f32[(Elements + 2) & 3], V.vector4_f32[(Elements + 3) & 3] }; + return vResult.v; + } +#else // XM_SSE_INTRINSICS_ + FLOAT fx = XMVectorGetByIndex(V,(Elements) & 3); + FLOAT fy = XMVectorGetByIndex(V,((Elements) + 1) & 3); + FLOAT fz = XMVectorGetByIndex(V,((Elements) + 2) & 3); + FLOAT fw = XMVectorGetByIndex(V,((Elements) + 3) & 3); + return _mm_set_ps( fw, fz, fy, fx ); +#endif +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorRotateRight(FXMVECTOR V, UINT Elements) +{ +#if defined(_XM_NO_INTRINSICS_) + XMASSERT( Elements < 4 ); + { + XMVECTORF32 vResult = { V.vector4_f32[(4 - (Elements)) & 3], V.vector4_f32[(5 - (Elements)) & 3], + V.vector4_f32[(6 - (Elements)) & 3], V.vector4_f32[(7 - (Elements)) & 3] }; + return vResult.v; + } +#else // XM_SSE_INTRINSICS_ + FLOAT fx = XMVectorGetByIndex(V,(4 - (Elements)) & 3); + FLOAT fy = XMVectorGetByIndex(V,(5 - (Elements)) & 3); + FLOAT fz = XMVectorGetByIndex(V,(6 - (Elements)) & 3); + FLOAT fw = XMVectorGetByIndex(V,(7 - (Elements)) & 3); + return _mm_set_ps( fw, fz, fy, fx ); +#endif +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorSwizzle(FXMVECTOR V, UINT E0, UINT E1, UINT E2, UINT E3) +{ +#if defined(_XM_NO_INTRINSICS_) + XMASSERT( (E0 < 4) && (E1 < 4) && (E2 < 4) && (E3 < 4) ); + { + XMVECTORF32 vResult = { V.vector4_f32[E0], V.vector4_f32[E1], V.vector4_f32[E2], V.vector4_f32[E3] }; + return vResult.v; + } +#else // XM_SSE_INTRINSICS_ + FLOAT fx = XMVectorGetByIndex(V,E0); + FLOAT fy = XMVectorGetByIndex(V,E1); + FLOAT fz = XMVectorGetByIndex(V,E2); + FLOAT fw = XMVectorGetByIndex(V,E3); + return _mm_set_ps( fw, fz, fy, fx ); +#endif +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorInsert(FXMVECTOR VD, FXMVECTOR VS, UINT VSLeftRotateElements, + UINT Select0, UINT Select1, UINT Select2, UINT Select3) +{ + XMVECTOR Control = XMVectorSelectControl(Select0&1, Select1&1, Select2&1, Select3&1); + return XMVectorSelect( VD, XMVectorRotateLeft(VS, VSLeftRotateElements), Control ); +} + +// Implemented for VMX128 intrinsics as #defines aboves +#endif _XM_NO_INTRINSICS_ || _XM_SSE_INTRINSICS_ + +//------------------------------------------------------------------------------ + +#include "xnamathconvert.inl" +#include "xnamathvector.inl" +#include "xnamathmatrix.inl" +#include "xnamathmisc.inl" + +#pragma warning(pop) + +#endif // __XNAMATH_H__ + diff --git a/MediaClient/MediaClient/directx/include/xnamathconvert.inl b/MediaClient/MediaClient/directx/include/xnamathconvert.inl new file mode 100644 index 0000000..370d27d --- /dev/null +++ b/MediaClient/MediaClient/directx/include/xnamathconvert.inl @@ -0,0 +1,5785 @@ +/*++ + +Copyright (c) Microsoft Corporation. All rights reserved. + +Module Name: + + xnamathconvert.inl + +Abstract: + + XNA math library for Windows and Xbox 360: Conversion, loading, and storing functions. +--*/ + +#if defined(_MSC_VER) && (_MSC_VER > 1000) +#pragma once +#endif + +#ifndef __XNAMATHCONVERT_INL__ +#define __XNAMATHCONVERT_INL__ + +#define XM_PACK_FACTOR (FLOAT)(1 << 22) +#define XM_UNPACK_FACTOR_UNSIGNED (FLOAT)(1 << 23) +#define XM_UNPACK_FACTOR_SIGNED XM_PACK_FACTOR + +#define XM_UNPACK_UNSIGNEDN_OFFSET(BitsX, BitsY, BitsZ, BitsW) \ + {-XM_UNPACK_FACTOR_UNSIGNED / (FLOAT)((1 << (BitsX)) - 1), \ + -XM_UNPACK_FACTOR_UNSIGNED / (FLOAT)((1 << (BitsY)) - 1), \ + -XM_UNPACK_FACTOR_UNSIGNED / (FLOAT)((1 << (BitsZ)) - 1), \ + -XM_UNPACK_FACTOR_UNSIGNED / (FLOAT)((1 << (BitsW)) - 1)} + +#define XM_UNPACK_UNSIGNEDN_SCALE(BitsX, BitsY, BitsZ, BitsW) \ + {XM_UNPACK_FACTOR_UNSIGNED / (FLOAT)((1 << (BitsX)) - 1), \ + XM_UNPACK_FACTOR_UNSIGNED / (FLOAT)((1 << (BitsY)) - 1), \ + XM_UNPACK_FACTOR_UNSIGNED / (FLOAT)((1 << (BitsZ)) - 1), \ + XM_UNPACK_FACTOR_UNSIGNED / (FLOAT)((1 << (BitsW)) - 1)} + +#define XM_UNPACK_SIGNEDN_SCALE(BitsX, BitsY, BitsZ, BitsW) \ + {-XM_UNPACK_FACTOR_SIGNED / (FLOAT)((1 << ((BitsX) - 1)) - 1), \ + -XM_UNPACK_FACTOR_SIGNED / (FLOAT)((1 << ((BitsY) - 1)) - 1), \ + -XM_UNPACK_FACTOR_SIGNED / (FLOAT)((1 << ((BitsZ) - 1)) - 1), \ + -XM_UNPACK_FACTOR_SIGNED / (FLOAT)((1 << ((BitsW) - 1)) - 1)} + +//#define XM_UNPACK_SIGNEDN_OFFSET(BitsX, BitsY, BitsZ, BitsW) \ +// {-XM_UNPACK_FACTOR_SIGNED / (FLOAT)((1 << ((BitsX) - 1)) - 1) * 3.0f, \ +// -XM_UNPACK_FACTOR_SIGNED / (FLOAT)((1 << ((BitsY) - 1)) - 1) * 3.0f, \ +// -XM_UNPACK_FACTOR_SIGNED / (FLOAT)((1 << ((BitsZ) - 1)) - 1) * 3.0f, \ +// -XM_UNPACK_FACTOR_SIGNED / (FLOAT)((1 << ((BitsW) - 1)) - 1) * 3.0f} + +#define XM_PACK_UNSIGNEDN_SCALE(BitsX, BitsY, BitsZ, BitsW) \ + {-(FLOAT)((1 << (BitsX)) - 1) / XM_PACK_FACTOR, \ + -(FLOAT)((1 << (BitsY)) - 1) / XM_PACK_FACTOR, \ + -(FLOAT)((1 << (BitsZ)) - 1) / XM_PACK_FACTOR, \ + -(FLOAT)((1 << (BitsW)) - 1) / XM_PACK_FACTOR} + +#define XM_PACK_SIGNEDN_SCALE(BitsX, BitsY, BitsZ, BitsW) \ + {-(FLOAT)((1 << ((BitsX) - 1)) - 1) / XM_PACK_FACTOR, \ + -(FLOAT)((1 << ((BitsY) - 1)) - 1) / XM_PACK_FACTOR, \ + -(FLOAT)((1 << ((BitsZ) - 1)) - 1) / XM_PACK_FACTOR, \ + -(FLOAT)((1 << ((BitsW) - 1)) - 1) / XM_PACK_FACTOR} + +#define XM_PACK_OFFSET XMVectorSplatConstant(3, 0) +//#define XM_UNPACK_OFFSET XM_PACK_OFFSET + +/**************************************************************************** + * + * Data conversion + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ + +XMFINLINE FLOAT XMConvertHalfToFloat +( + HALF Value +) +{ +#if defined(_XM_NO_INTRINSICS_) || defined(_XM_SSE_INTRINSICS_) + + UINT Mantissa; + UINT Exponent; + UINT Result; + + Mantissa = (UINT)(Value & 0x03FF); + + if ((Value & 0x7C00) != 0) // The value is normalized + { + Exponent = (UINT)((Value >> 10) & 0x1F); + } + else if (Mantissa != 0) // The value is denormalized + { + // Normalize the value in the resulting float + Exponent = 1; + + do + { + Exponent--; + Mantissa <<= 1; + } while ((Mantissa & 0x0400) == 0); + + Mantissa &= 0x03FF; + } + else // The value is zero + { + Exponent = (UINT)-112; + } + + Result = ((Value & 0x8000) << 16) | // Sign + ((Exponent + 112) << 23) | // Exponent + (Mantissa << 13); // Mantissa + + return *(FLOAT*)&Result; + +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif +} + +//------------------------------------------------------------------------------ + +XMINLINE FLOAT* XMConvertHalfToFloatStream +( + FLOAT* pOutputStream, + UINT OutputStride, + CONST HALF* pInputStream, + UINT InputStride, + UINT HalfCount +) +{ +#if defined(_XM_NO_INTRINSICS_) || defined(_XM_SSE_INTRINSICS_) + + UINT i; + BYTE* pHalf = (BYTE*)pInputStream; + BYTE* pFloat = (BYTE*)pOutputStream; + + XMASSERT(pOutputStream); + XMASSERT(pInputStream); + + for (i = 0; i < HalfCount; i++) + { + *(FLOAT*)pFloat = XMConvertHalfToFloat(*(HALF*)pHalf); + pHalf += InputStride; + pFloat += OutputStride; + } + + return pOutputStream; + +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE HALF XMConvertFloatToHalf +( + FLOAT Value +) +{ +#if defined(_XM_NO_INTRINSICS_) || defined(_XM_SSE_INTRINSICS_) + UINT Result; + + UINT IValue = ((UINT *)(&Value))[0]; + UINT Sign = (IValue & 0x80000000U) >> 16U; + IValue = IValue & 0x7FFFFFFFU; // Hack off the sign + + if (IValue > 0x47FFEFFFU) + { + // The number is too large to be represented as a half. Saturate to infinity. + Result = 0x7FFFU; + } + else + { + if (IValue < 0x38800000U) + { + // The number is too small to be represented as a normalized half. + // Convert it to a denormalized value. + UINT Shift = 113U - (IValue >> 23U); + IValue = (0x800000U | (IValue & 0x7FFFFFU)) >> Shift; + } + else + { + // Rebias the exponent to represent the value as a normalized half. + IValue += 0xC8000000U; + } + + Result = ((IValue + 0x0FFFU + ((IValue >> 13U) & 1U)) >> 13U)&0x7FFFU; + } + return (HALF)(Result|Sign); + +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif +} + +//------------------------------------------------------------------------------ + +XMINLINE HALF* XMConvertFloatToHalfStream +( + HALF* pOutputStream, + UINT OutputStride, + CONST FLOAT* pInputStream, + UINT InputStride, + UINT FloatCount +) +{ +#if defined(_XM_NO_INTRINSICS_) || defined(_XM_SSE_INTRINSICS_) + + UINT i; + BYTE* pFloat = (BYTE*)pInputStream; + BYTE* pHalf = (BYTE*)pOutputStream; + + XMASSERT(pOutputStream); + XMASSERT(pInputStream); + + for (i = 0; i < FloatCount; i++) + { + *(HALF*)pHalf = XMConvertFloatToHalf(*(FLOAT*)pFloat); + pFloat += InputStride; + pHalf += OutputStride; + } + return pOutputStream; +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +#if defined(_XM_NO_INTRINSICS_) || defined(_XM_SSE_INTRINSICS_) +// For VMX128, these routines are all defines in the main header + +#pragma warning(push) +#pragma warning(disable:4701) // Prevent warnings about 'Result' potentially being used without having been initialized + +XMINLINE XMVECTOR XMConvertVectorIntToFloat +( + FXMVECTOR VInt, + UINT DivExponent +) +{ +#if defined(_XM_NO_INTRINSICS_) + UINT ElementIndex; + FLOAT fScale; + XMVECTOR Result; + XMASSERT(DivExponent<32); + fScale = 1.0f / (FLOAT)(1U << DivExponent); + ElementIndex = 0; + do { + INT iTemp = (INT)VInt.vector4_u32[ElementIndex]; + Result.vector4_f32[ElementIndex] = ((FLOAT)iTemp) * fScale; + } while (++ElementIndex<4); + return Result; +#else // _XM_SSE_INTRINSICS_ + XMASSERT(DivExponent<32); + // Convert to floats + XMVECTOR vResult = _mm_cvtepi32_ps(reinterpret_cast(&VInt)[0]); + // Convert DivExponent into 1.0f/(1<(&vScale)[0]); + return vResult; +#endif +} + +//------------------------------------------------------------------------------ + +XMINLINE XMVECTOR XMConvertVectorFloatToInt +( + FXMVECTOR VFloat, + UINT MulExponent +) +{ +#if defined(_XM_NO_INTRINSICS_) + UINT ElementIndex; + XMVECTOR Result; + FLOAT fScale; + XMASSERT(MulExponent<32); + // Get the scalar factor. + fScale = (FLOAT)(1U << MulExponent); + ElementIndex = 0; + do { + INT iResult; + FLOAT fTemp = VFloat.vector4_f32[ElementIndex]*fScale; + if (fTemp <= -(65536.0f*32768.0f)) { + iResult = (-0x7FFFFFFF)-1; + } else if (fTemp > (65536.0f*32768.0f)-128.0f) { + iResult = 0x7FFFFFFF; + } else { + iResult = (INT)fTemp; + } + Result.vector4_u32[ElementIndex] = (UINT)iResult; + } while (++ElementIndex<4); + return Result; +#else // _XM_SSE_INTRINSICS_ + XMASSERT(MulExponent<32); + static const XMVECTORF32 MaxInt = {65536.0f*32768.0f-128.0f,65536.0f*32768.0f-128.0f,65536.0f*32768.0f-128.0f,65536.0f*32768.0f-128.0f}; + XMVECTOR vResult = _mm_set_ps1((FLOAT)(1U << MulExponent)); + vResult = _mm_mul_ps(vResult,VFloat); + // In case of positive overflow, detect it + XMVECTOR vOverflow = _mm_cmpgt_ps(vResult,MaxInt); + // Float to int conversion + __m128i vResulti = _mm_cvttps_epi32(vResult); + // If there was positive overflow, set to 0x7FFFFFFF + vResult = _mm_and_ps(vOverflow,g_XMAbsMask); + vOverflow = _mm_andnot_ps(vOverflow,reinterpret_cast(&vResulti)[0]); + vOverflow = _mm_or_ps(vOverflow,vResult); + return vOverflow; +#endif +} + +//------------------------------------------------------------------------------ + +XMINLINE XMVECTOR XMConvertVectorUIntToFloat +( + FXMVECTOR VUInt, + UINT DivExponent +) +{ +#if defined(_XM_NO_INTRINSICS_) + UINT ElementIndex; + FLOAT fScale; + XMVECTOR Result; + XMASSERT(DivExponent<32); + fScale = 1.0f / (FLOAT)(1U << DivExponent); + ElementIndex = 0; + do { + Result.vector4_f32[ElementIndex] = (FLOAT)VUInt.vector4_u32[ElementIndex] * fScale; + } while (++ElementIndex<4); + return Result; +#else // _XM_SSE_INTRINSICS_ + XMASSERT(DivExponent<32); + static const XMVECTORF32 FixUnsigned = {32768.0f*65536.0f,32768.0f*65536.0f,32768.0f*65536.0f,32768.0f*65536.0f}; + // For the values that are higher than 0x7FFFFFFF, a fixup is needed + // Determine which ones need the fix. + XMVECTOR vMask = _mm_and_ps(VUInt,g_XMNegativeZero); + // Force all values positive + XMVECTOR vResult = _mm_xor_ps(VUInt,vMask); + // Convert to floats + vResult = _mm_cvtepi32_ps(reinterpret_cast(&vResult)[0]); + // Convert 0x80000000 -> 0xFFFFFFFF + __m128i iMask = _mm_srai_epi32(reinterpret_cast(&vMask)[0],31); + // For only the ones that are too big, add the fixup + vMask = _mm_and_ps(reinterpret_cast(&iMask)[0],FixUnsigned); + vResult = _mm_add_ps(vResult,vMask); + // Convert DivExponent into 1.0f/(1<(&iMask)[0]); + return vResult; +#endif +} + +//------------------------------------------------------------------------------ + +XMINLINE XMVECTOR XMConvertVectorFloatToUInt +( + FXMVECTOR VFloat, + UINT MulExponent +) +{ +#if defined(_XM_NO_INTRINSICS_) + UINT ElementIndex; + XMVECTOR Result; + FLOAT fScale; + XMASSERT(MulExponent<32); + // Get the scalar factor. + fScale = (FLOAT)(1U << MulExponent); + ElementIndex = 0; + do { + UINT uResult; + FLOAT fTemp = VFloat.vector4_f32[ElementIndex]*fScale; + if (fTemp <= 0.0f) { + uResult = 0; + } else if (fTemp >= (65536.0f*65536.0f)) { + uResult = 0xFFFFFFFFU; + } else { + uResult = (UINT)fTemp; + } + Result.vector4_u32[ElementIndex] = uResult; + } while (++ElementIndex<4); + return Result; +#else // _XM_SSE_INTRINSICS_ + XMASSERT(MulExponent<32); + static const XMVECTORF32 MaxUInt = {65536.0f*65536.0f-256.0f,65536.0f*65536.0f-256.0f,65536.0f*65536.0f-256.0f,65536.0f*65536.0f-256.0f}; + static const XMVECTORF32 UnsignedFix = {32768.0f*65536.0f,32768.0f*65536.0f,32768.0f*65536.0f,32768.0f*65536.0f}; + XMVECTOR vResult = _mm_set_ps1(static_cast(1U << MulExponent)); + vResult = _mm_mul_ps(vResult,VFloat); + // Clamp to >=0 + vResult = _mm_max_ps(vResult,g_XMZero); + // Any numbers that are too big, set to 0xFFFFFFFFU + XMVECTOR vOverflow = _mm_cmpgt_ps(vResult,MaxUInt); + XMVECTOR vValue = UnsignedFix; + // Too large for a signed integer? + XMVECTOR vMask = _mm_cmpge_ps(vResult,vValue); + // Zero for number's lower than 0x80000000, 32768.0f*65536.0f otherwise + vValue = _mm_and_ps(vValue,vMask); + // Perform fixup only on numbers too large (Keeps low bit precision) + vResult = _mm_sub_ps(vResult,vValue); + __m128i vResulti = _mm_cvttps_epi32(vResult); + // Convert from signed to unsigned pnly if greater than 0x80000000 + vMask = _mm_and_ps(vMask,g_XMNegativeZero); + vResult = _mm_xor_ps(reinterpret_cast(&vResulti)[0],vMask); + // On those that are too large, set to 0xFFFFFFFF + vResult = _mm_or_ps(vResult,vOverflow); + return vResult; +#endif +} + +#pragma warning(pop) + +#endif // _XM_NO_INTRINSICS_ || _XM_SSE_INTRINSICS_ + +/**************************************************************************** + * + * Vector and matrix load operations + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMLoadInt(CONST UINT* pSource) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V; + XMASSERT(pSource); + XMASSERT(((UINT_PTR)pSource & 3) == 0); + + V.vector4_u32[0] = *pSource; + + return V; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pSource); + XMASSERT(((UINT_PTR)pSource & 3) == 0); + + return _mm_load_ss( (const float*)pSource ); +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMLoadFloat(CONST FLOAT* pSource) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V; + XMASSERT(pSource); + XMASSERT(((UINT_PTR)pSource & 3) == 0); + + V.vector4_f32[0] = *pSource; + + return V; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pSource); + XMASSERT(((UINT_PTR)pSource & 3) == 0); + + return _mm_load_ss( pSource ); +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMLoadInt2 +( + CONST UINT* pSource +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V; + + XMASSERT(pSource); + + V.vector4_u32[0] = pSource[0]; + V.vector4_u32[1] = pSource[1]; + + return V; +#elif defined(_XM_SSE_INTRINSICS_) + + XMASSERT(pSource); + + __m128 x = _mm_load_ss( (const float*)pSource ); + __m128 y = _mm_load_ss( (const float*)(pSource+1) ); + return _mm_unpacklo_ps( x, y ); +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMLoadInt2A +( + CONST UINT* pSource +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V; + + XMASSERT(pSource); + XMASSERT(((UINT_PTR)pSource & 0xF) == 0); + + V.vector4_u32[0] = pSource[0]; + V.vector4_u32[1] = pSource[1]; + + return V; + +#elif defined(_XM_SSE_INTRINSICS_) + + XMASSERT(pSource); + XMASSERT(((UINT_PTR)pSource & 0xF) == 0); + + __m128i V = _mm_loadl_epi64( (const __m128i*)pSource ); + return reinterpret_cast<__m128 *>(&V)[0]; + +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMLoadFloat2 +( + CONST XMFLOAT2* pSource +) +{ +#if defined(_XM_NO_INTRINSICS_) + XMVECTOR V; + XMASSERT(pSource); + + ((UINT *)(&V.vector4_f32[0]))[0] = ((const UINT *)(&pSource->x))[0]; + ((UINT *)(&V.vector4_f32[1]))[0] = ((const UINT *)(&pSource->y))[0]; + return V; +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pSource); + + __m128 x = _mm_load_ss( &pSource->x ); + __m128 y = _mm_load_ss( &pSource->y ); + return _mm_unpacklo_ps( x, y ); +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMLoadFloat2A +( + CONST XMFLOAT2A* pSource +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V; + + XMASSERT(pSource); + XMASSERT(((UINT_PTR)pSource & 0xF) == 0); + + V.vector4_f32[0] = pSource->x; + V.vector4_f32[1] = pSource->y; + + return V; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pSource); + XMASSERT(((UINT_PTR)pSource & 0xF) == 0); + + __m128i V = _mm_loadl_epi64( (const __m128i*)pSource ); + return reinterpret_cast<__m128 *>(&V)[0]; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMLoadHalf2 +( + CONST XMHALF2* pSource +) +{ +#if defined(_XM_NO_INTRINSICS_) + XMASSERT(pSource); + { + XMVECTOR vResult = { + XMConvertHalfToFloat(pSource->x), + XMConvertHalfToFloat(pSource->y), + 0.0f, + 0.0f + }; + return vResult; + } +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pSource); + XMVECTOR vResult = { + XMConvertHalfToFloat(pSource->x), + XMConvertHalfToFloat(pSource->y), + 0.0f, + 0.0f + }; + return vResult; + +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMLoadShortN2 +( + CONST XMSHORTN2* pSource +) +{ +#if defined(_XM_NO_INTRINSICS_) + XMASSERT(pSource); + XMASSERT(pSource->x != -32768); + XMASSERT(pSource->y != -32768); + { + XMVECTOR vResult = { + (FLOAT)pSource->x * (1.0f/32767.0f), + (FLOAT)pSource->y * (1.0f/32767.0f), + 0.0f, + 0.0f + }; + return vResult; + } + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pSource); + XMASSERT(pSource->x != -32768); + XMASSERT(pSource->y != -32768); + // Splat the two shorts in all four entries (WORD alignment okay, + // DWORD alignment preferred) + __m128 vTemp = _mm_load_ps1(reinterpret_cast(&pSource->x)); + // Mask x&0xFFFF, y&0xFFFF0000,z&0,w&0 + vTemp = _mm_and_ps(vTemp,g_XMMaskX16Y16); + // x needs to be sign extended + vTemp = _mm_xor_ps(vTemp,g_XMFlipX16Y16); + // Convert to floating point numbers + vTemp = _mm_cvtepi32_ps(reinterpret_cast(&vTemp)[0]); + // x - 0x8000 to undo the signed order. + vTemp = _mm_add_ps(vTemp,g_XMFixX16Y16); + // Convert 0-32767 to 0.0f-1.0f + return _mm_mul_ps(vTemp,g_XMNormalizeX16Y16); +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMLoadShort2 +( + CONST XMSHORT2* pSource +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V; + + XMASSERT(pSource); + XMASSERT(pSource->x != -32768); + XMASSERT(pSource->y != -32768); + + V.vector4_f32[0] = (FLOAT)pSource->x; + V.vector4_f32[1] = (FLOAT)pSource->y; + + return V; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pSource); + XMASSERT(pSource->x != -32768); + XMASSERT(pSource->y != -32768); + // Splat the two shorts in all four entries (WORD alignment okay, + // DWORD alignment preferred) + __m128 vTemp = _mm_load_ps1(reinterpret_cast(&pSource->x)); + // Mask x&0xFFFF, y&0xFFFF0000,z&0,w&0 + vTemp = _mm_and_ps(vTemp,g_XMMaskX16Y16); + // x needs to be sign extended + vTemp = _mm_xor_ps(vTemp,g_XMFlipX16Y16); + // Convert to floating point numbers + vTemp = _mm_cvtepi32_ps(reinterpret_cast(&vTemp)[0]); + // x - 0x8000 to undo the signed order. + vTemp = _mm_add_ps(vTemp,g_XMFixX16Y16); + // Y is 65536 too large + return _mm_mul_ps(vTemp,g_XMFixupY16); +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMLoadUShortN2 +( + CONST XMUSHORTN2* pSource +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V; + + XMASSERT(pSource); + + V.vector4_f32[0] = (FLOAT)pSource->x / 65535.0f; + V.vector4_f32[1] = (FLOAT)pSource->y / 65535.0f; + + return V; + +#elif defined(_XM_SSE_INTRINSICS_) + static const XMVECTORF32 FixupY16 = {1.0f/65535.0f,1.0f/(65535.0f*65536.0f),0.0f,0.0f}; + static const XMVECTORF32 FixaddY16 = {0,32768.0f*65536.0f,0,0}; + XMASSERT(pSource); + // Splat the two shorts in all four entries (WORD alignment okay, + // DWORD alignment preferred) + __m128 vTemp = _mm_load_ps1(reinterpret_cast(&pSource->x)); + // Mask x&0xFFFF, y&0xFFFF0000,z&0,w&0 + vTemp = _mm_and_ps(vTemp,g_XMMaskX16Y16); + // y needs to be sign flipped + vTemp = _mm_xor_ps(vTemp,g_XMFlipY); + // Convert to floating point numbers + vTemp = _mm_cvtepi32_ps(reinterpret_cast(&vTemp)[0]); + // y + 0x8000 to undo the signed order. + vTemp = _mm_add_ps(vTemp,FixaddY16); + // Y is 65536 times too large + vTemp = _mm_mul_ps(vTemp,FixupY16); + return vTemp; +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMLoadUShort2 +( + CONST XMUSHORT2* pSource +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V; + + XMASSERT(pSource); + + V.vector4_f32[0] = (FLOAT)pSource->x; + V.vector4_f32[1] = (FLOAT)pSource->y; + + return V; + +#elif defined(_XM_SSE_INTRINSICS_) + static const XMVECTORF32 FixaddY16 = {0,32768.0f,0,0}; + XMASSERT(pSource); + // Splat the two shorts in all four entries (WORD alignment okay, + // DWORD alignment preferred) + __m128 vTemp = _mm_load_ps1(reinterpret_cast(&pSource->x)); + // Mask x&0xFFFF, y&0xFFFF0000,z&0,w&0 + vTemp = _mm_and_ps(vTemp,g_XMMaskX16Y16); + // y needs to be sign flipped + vTemp = _mm_xor_ps(vTemp,g_XMFlipY); + // Convert to floating point numbers + vTemp = _mm_cvtepi32_ps(reinterpret_cast(&vTemp)[0]); + // Y is 65536 times too large + vTemp = _mm_mul_ps(vTemp,g_XMFixupY16); + // y + 0x8000 to undo the signed order. + vTemp = _mm_add_ps(vTemp,FixaddY16); + return vTemp; +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMLoadInt3 +( + CONST UINT* pSource +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V; + + XMASSERT(pSource); + + V.vector4_u32[0] = pSource[0]; + V.vector4_u32[1] = pSource[1]; + V.vector4_u32[2] = pSource[2]; + + return V; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pSource); + +#ifdef _XM_ISVS2005_ + __m128i V = _mm_set_epi32( 0, *(pSource+2), *(pSource+1), *pSource ); + return reinterpret_cast<__m128 *>(&V)[0]; +#else + __m128 x = _mm_load_ss( (const float*)pSource ); + __m128 y = _mm_load_ss( (const float*)(pSource+1) ); + __m128 z = _mm_load_ss( (const float*)(pSource+2) ); + __m128 xy = _mm_unpacklo_ps( x, y ); + return _mm_movelh_ps( xy, z ); +#endif // !_XM_ISVS2005_ +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMLoadInt3A +( + CONST UINT* pSource +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V; + + XMASSERT(pSource); + XMASSERT(((UINT_PTR)pSource & 0xF) == 0); + + V.vector4_u32[0] = pSource[0]; + V.vector4_u32[1] = pSource[1]; + V.vector4_u32[2] = pSource[2]; + + return V; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pSource); + + // Reads an extra integer that is 'undefined' + + __m128i V = _mm_load_si128( (const __m128i*)pSource ); + return reinterpret_cast<__m128 *>(&V)[0]; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMLoadFloat3 +( + CONST XMFLOAT3* pSource +) +{ +#if defined(_XM_NO_INTRINSICS_) + XMVECTOR V; + XMASSERT(pSource); + + ((UINT *)(&V.vector4_f32[0]))[0] = ((const UINT *)(&pSource->x))[0]; + ((UINT *)(&V.vector4_f32[1]))[0] = ((const UINT *)(&pSource->y))[0]; + ((UINT *)(&V.vector4_f32[2]))[0] = ((const UINT *)(&pSource->z))[0]; + return V; +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pSource); + +#ifdef _XM_ISVS2005_ + // This reads 1 floats past the memory that should be ignored. + // Need to continue to do this for VS 2005 due to compiler issue but prefer new method + // to avoid triggering issues with memory debug tools (like AV) + return _mm_loadu_ps( &pSource->x ); +#else + __m128 x = _mm_load_ss( &pSource->x ); + __m128 y = _mm_load_ss( &pSource->y ); + __m128 z = _mm_load_ss( &pSource->z ); + __m128 xy = _mm_unpacklo_ps( x, y ); + return _mm_movelh_ps( xy, z ); +#endif // !_XM_ISVS2005_ +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMLoadFloat3A +( + CONST XMFLOAT3A* pSource +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V; + + XMASSERT(pSource); + XMASSERT(((UINT_PTR)pSource & 0xF) == 0); + + V.vector4_f32[0] = pSource->x; + V.vector4_f32[1] = pSource->y; + V.vector4_f32[2] = pSource->z; + + return V; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pSource); + XMASSERT(((UINT_PTR)pSource & 0xF) == 0); + + // This reads 1 floats past the memory that should be ignored. + return _mm_load_ps( &pSource->x ); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMLoadUHenDN3 +( + CONST XMUHENDN3* pSource +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V; + UINT Element; + + XMASSERT(pSource); + + Element = pSource->v & 0x7FF; + V.vector4_f32[0] = (FLOAT)Element / 2047.0f; + Element = (pSource->v >> 11) & 0x7FF; + V.vector4_f32[1] = (FLOAT)Element / 2047.0f; + Element = (pSource->v >> 22) & 0x3FF; + V.vector4_f32[2] = (FLOAT)Element / 1023.0f; + + return V; + +#elif defined(_XM_SSE_INTRINSICS_) + static const XMVECTORF32 UHenDN3Mul = {1.0f/2047.0f,1.0f/(2047.0f*2048.0f),1.0f/(1023.0f*2048.0f*2048.0f),0}; + XMASSERT(pSource); + // Get the 32 bit value and splat it + XMVECTOR vResult = _mm_load_ps1(reinterpret_cast(&pSource->v)); + // Mask off x, y and z + vResult = _mm_and_ps(vResult,g_XMMaskHenD3); + // Convert x and y to unsigned + vResult = _mm_xor_ps(vResult,g_XMFlipZ); + // Convert to float + vResult = _mm_cvtepi32_ps(reinterpret_cast(&vResult)[0]); + // Convert x and y back to signed + vResult = _mm_add_ps(vResult,g_XMAddUHenD3); + // Normalize x,y and z to -1.0f-1.0f + vResult = _mm_mul_ps(vResult,UHenDN3Mul); + return vResult; +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMLoadUHenD3 +( + CONST XMUHEND3* pSource +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V; + UINT Element; + + XMASSERT(pSource); + + Element = pSource->v & 0x7FF; + V.vector4_f32[0] = (FLOAT)Element; + Element = (pSource->v >> 11) & 0x7FF; + V.vector4_f32[1] = (FLOAT)Element; + Element = (pSource->v >> 22) & 0x3FF; + V.vector4_f32[2] = (FLOAT)Element; + + return V; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pSource); + // Get the 32 bit value and splat it + XMVECTOR vResult = _mm_load_ps1(reinterpret_cast(&pSource->v)); + // Mask off x, y and z + vResult = _mm_and_ps(vResult,g_XMMaskHenD3); + // Convert x and y to unsigned + vResult = _mm_xor_ps(vResult,g_XMFlipZ); + // Convert to float + vResult = _mm_cvtepi32_ps(reinterpret_cast(&vResult)[0]); + // Convert x and y back to signed + vResult = _mm_add_ps(vResult,g_XMAddUHenD3); + // Normalize x and y to -1024-1023.0f and z to -512-511.0f + vResult = _mm_mul_ps(vResult,g_XMMulHenD3); + return vResult; +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMLoadHenDN3 +( + CONST XMHENDN3* pSource +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V; + UINT Element; + static CONST UINT SignExtendXY[] = {0x00000000, 0xFFFFF800}; + static CONST UINT SignExtendZ[] = {0x00000000, 0xFFFFFC00}; + + XMASSERT(pSource); + XMASSERT((pSource->v & 0x7FF) != 0x400); + XMASSERT(((pSource->v >> 11) & 0x7FF) != 0x400); + XMASSERT(((pSource->v >> 22) & 0x3FF) != 0x200); + + Element = pSource->v & 0x7FF; + V.vector4_f32[0] = (FLOAT)(SHORT)(Element | SignExtendXY[Element >> 10]) / 1023.0f; + Element = (pSource->v >> 11) & 0x7FF; + V.vector4_f32[1] = (FLOAT)(SHORT)(Element | SignExtendXY[Element >> 10]) / 1023.0f; + Element = (pSource->v >> 22) & 0x3FF; + V.vector4_f32[2] = (FLOAT)(SHORT)(Element | SignExtendZ[Element >> 9]) / 511.0f; + + return V; + +#elif defined(_XM_SSE_INTRINSICS_) + static const XMVECTORF32 HenDN3Mul = {1.0f/1023.0f,1.0f/(1023.0f*2048.0f),1.0f/(511.0f*2048.0f*2048.0f),0}; + XMASSERT(pSource); + XMASSERT((pSource->v & 0x7FF) != 0x400); + XMASSERT(((pSource->v >> 11) & 0x7FF) != 0x400); + XMASSERT(((pSource->v >> 22) & 0x3FF) != 0x200); + // Get the 32 bit value and splat it + XMVECTOR vResult = _mm_load_ps1(reinterpret_cast(&pSource->v)); + // Mask off x, y and z + vResult = _mm_and_ps(vResult,g_XMMaskHenD3); + // Convert x and y to unsigned + vResult = _mm_xor_ps(vResult,g_XMXorHenD3); + // Convert to float + vResult = _mm_cvtepi32_ps(reinterpret_cast(&vResult)[0]); + // Convert x and y back to signed + vResult = _mm_add_ps(vResult,g_XMAddHenD3); + // Normalize x,y and z to -1.0f-1.0f + vResult = _mm_mul_ps(vResult,HenDN3Mul); + return vResult; +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMLoadHenD3 +( + CONST XMHEND3* pSource +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V; + UINT Element; + static CONST UINT SignExtendXY[] = {0x00000000, 0xFFFFF800}; + static CONST UINT SignExtendZ[] = {0x00000000, 0xFFFFFC00}; + + XMASSERT(pSource); + XMASSERT((pSource->v & 0x7FF) != 0x400); + XMASSERT(((pSource->v >> 11) & 0x7FF) != 0x400); + XMASSERT(((pSource->v >> 22) & 0x3FF) != 0x200); + + Element = pSource->v & 0x7FF; + V.vector4_f32[0] = (FLOAT)(SHORT)(Element | SignExtendXY[Element >> 10]); + Element = (pSource->v >> 11) & 0x7FF; + V.vector4_f32[1] = (FLOAT)(SHORT)(Element | SignExtendXY[Element >> 10]); + Element = (pSource->v >> 22) & 0x3FF; + V.vector4_f32[2] = (FLOAT)(SHORT)(Element | SignExtendZ[Element >> 9]); + + return V; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pSource); + XMASSERT((pSource->v & 0x7FF) != 0x400); + XMASSERT(((pSource->v >> 11) & 0x7FF) != 0x400); + XMASSERT(((pSource->v >> 22) & 0x3FF) != 0x200); + // Get the 32 bit value and splat it + XMVECTOR vResult = _mm_load_ps1(reinterpret_cast(&pSource->v)); + // Mask off x, y and z + vResult = _mm_and_ps(vResult,g_XMMaskHenD3); + // Convert x and y to unsigned + vResult = _mm_xor_ps(vResult,g_XMXorHenD3); + // Convert to float + vResult = _mm_cvtepi32_ps(reinterpret_cast(&vResult)[0]); + // Convert x and y back to signed + vResult = _mm_add_ps(vResult,g_XMAddHenD3); + // Normalize x and y to -1024-1023.0f and z to -512-511.0f + vResult = _mm_mul_ps(vResult,g_XMMulHenD3); + return vResult; +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMLoadUDHenN3 +( + CONST XMUDHENN3* pSource +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V; + UINT Element; + + XMASSERT(pSource); + + Element = pSource->v & 0x3FF; + V.vector4_f32[0] = (FLOAT)Element / 1023.0f; + Element = (pSource->v >> 10) & 0x7FF; + V.vector4_f32[1] = (FLOAT)Element / 2047.0f; + Element = (pSource->v >> 21) & 0x7FF; + V.vector4_f32[2] = (FLOAT)Element / 2047.0f; + + return V; + +#elif defined(_XM_SSE_INTRINSICS_) + static const XMVECTORF32 UDHenN3Mul = {1.0f/1023.0f,1.0f/(2047.0f*1024.0f),1.0f/(2047.0f*1024.0f*2048.0f),0}; + XMASSERT(pSource); + // Get the 32 bit value and splat it + XMVECTOR vResult = _mm_load_ps1(reinterpret_cast(&pSource->v)); + // Mask off x, y and z + vResult = _mm_and_ps(vResult,g_XMMaskDHen3); + // Convert x and y to unsigned + vResult = _mm_xor_ps(vResult,g_XMFlipZ); + // Convert to float + vResult = _mm_cvtepi32_ps(reinterpret_cast(&vResult)[0]); + // Convert x and y back to signed + vResult = _mm_add_ps(vResult,g_XMAddUHenD3); + // Normalize x,y and z to -1.0f-1.0f + vResult = _mm_mul_ps(vResult,UDHenN3Mul); + return vResult; +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMLoadUDHen3 +( + CONST XMUDHEN3* pSource +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V; + UINT Element; + + XMASSERT(pSource); + + Element = pSource->v & 0x3FF; + V.vector4_f32[0] = (FLOAT)Element; + Element = (pSource->v >> 10) & 0x7FF; + V.vector4_f32[1] = (FLOAT)Element; + Element = (pSource->v >> 21) & 0x7FF; + V.vector4_f32[2] = (FLOAT)Element; + + return V; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pSource); + // Get the 32 bit value and splat it + XMVECTOR vResult = _mm_load_ps1(reinterpret_cast(&pSource->v)); + // Mask off x, y and z + vResult = _mm_and_ps(vResult,g_XMMaskDHen3); + // Convert x and y to unsigned + vResult = _mm_xor_ps(vResult,g_XMFlipZ); + // Convert to float + vResult = _mm_cvtepi32_ps(reinterpret_cast(&vResult)[0]); + // Convert x and y back to signed + vResult = _mm_add_ps(vResult,g_XMAddUHenD3); + // Normalize x to 0-1023.0f and y and z to 0-2047.0f + vResult = _mm_mul_ps(vResult,g_XMMulDHen3); + return vResult; +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMLoadDHenN3 +( + CONST XMDHENN3* pSource +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V; + UINT Element; + static CONST UINT SignExtendX[] = {0x00000000, 0xFFFFFC00}; + static CONST UINT SignExtendYZ[] = {0x00000000, 0xFFFFF800}; + + XMASSERT(pSource); + XMASSERT((pSource->v & 0x3FF) != 0x200); + XMASSERT(((pSource->v >> 10) & 0x7FF) != 0x400); + XMASSERT(((pSource->v >> 21) & 0x7FF) != 0x400); + + Element = pSource->v & 0x3FF; + V.vector4_f32[0] = (FLOAT)(SHORT)(Element | SignExtendX[Element >> 9]) / 511.0f; + Element = (pSource->v >> 10) & 0x7FF; + V.vector4_f32[1] = (FLOAT)(SHORT)(Element | SignExtendYZ[Element >> 10]) / 1023.0f; + Element = (pSource->v >> 21) & 0x7FF; + V.vector4_f32[2] = (FLOAT)(SHORT)(Element | SignExtendYZ[Element >> 10]) / 1023.0f; + + return V; + +#elif defined(_XM_SSE_INTRINSICS_) + static const XMVECTORF32 DHenN3Mul = {1.0f/511.0f,1.0f/(1023.0f*1024.0f),1.0f/(1023.0f*1024.0f*2048.0f),0}; + XMASSERT(pSource); + XMASSERT((pSource->v & 0x3FF) != 0x200); + XMASSERT(((pSource->v >> 10) & 0x7FF) != 0x400); + XMASSERT(((pSource->v >> 21) & 0x7FF) != 0x400); + // Get the 32 bit value and splat it + XMVECTOR vResult = _mm_load_ps1(reinterpret_cast(&pSource->v)); + // Mask off x, y and z + vResult = _mm_and_ps(vResult,g_XMMaskDHen3); + // Convert x and y to unsigned + vResult = _mm_xor_ps(vResult,g_XMXorDHen3); + // Convert to float + vResult = _mm_cvtepi32_ps(reinterpret_cast(&vResult)[0]); + // Convert x and y back to signed + vResult = _mm_add_ps(vResult,g_XMAddDHen3); + // Normalize x,y and z to -1.0f-1.0f + vResult = _mm_mul_ps(vResult,DHenN3Mul); + return vResult; +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMLoadDHen3 +( + CONST XMDHEN3* pSource +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V; + UINT Element; + static CONST UINT SignExtendX[] = {0x00000000, 0xFFFFFC00}; + static CONST UINT SignExtendYZ[] = {0x00000000, 0xFFFFF800}; + + XMASSERT(pSource); + XMASSERT((pSource->v & 0x3FF) != 0x200); + XMASSERT(((pSource->v >> 10) & 0x7FF) != 0x400); + XMASSERT(((pSource->v >> 21) & 0x7FF) != 0x400); + + Element = pSource->v & 0x3FF; + V.vector4_f32[0] = (FLOAT)(SHORT)(Element | SignExtendX[Element >> 9]); + Element = (pSource->v >> 10) & 0x7FF; + V.vector4_f32[1] = (FLOAT)(SHORT)(Element | SignExtendYZ[Element >> 10]); + Element = (pSource->v >> 21) & 0x7FF; + V.vector4_f32[2] = (FLOAT)(SHORT)(Element | SignExtendYZ[Element >> 10]); + + return V; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pSource); + XMASSERT((pSource->v & 0x3FF) != 0x200); + XMASSERT(((pSource->v >> 10) & 0x7FF) != 0x400); + XMASSERT(((pSource->v >> 21) & 0x7FF) != 0x400); + // Get the 32 bit value and splat it + XMVECTOR vResult = _mm_load_ps1(reinterpret_cast(&pSource->v)); + // Mask off x, y and z + vResult = _mm_and_ps(vResult,g_XMMaskDHen3); + // Convert x and y to unsigned + vResult = _mm_xor_ps(vResult,g_XMXorDHen3); + // Convert to float + vResult = _mm_cvtepi32_ps(reinterpret_cast(&vResult)[0]); + // Convert x and y back to signed + vResult = _mm_add_ps(vResult,g_XMAddDHen3); + // Normalize x to -210-511.0f and y and z to -1024-1023.0f + vResult = _mm_mul_ps(vResult,g_XMMulDHen3); + return vResult; +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMLoadU565 +( + CONST XMU565* pSource +) +{ +#if defined(_XM_SSE_INTRINSICS_) && !defined(_XM_NO_INTRINSICS_) + static const XMVECTORI32 U565And = {0x1F,0x3F<<5,0x1F<<11,0}; + static const XMVECTORF32 U565Mul = {1.0f,1.0f/32.0f,1.0f/2048.f,0}; + XMASSERT(pSource); + // Get the 32 bit value and splat it + XMVECTOR vResult = _mm_load_ps1(reinterpret_cast(&pSource->v)); + // Mask off x, y and z + vResult = _mm_and_ps(vResult,U565And); + // Convert to float + vResult = _mm_cvtepi32_ps(reinterpret_cast(&vResult)[0]); + // Normalize x, y, and z + vResult = _mm_mul_ps(vResult,U565Mul); + return vResult; +#else + XMVECTOR V; + UINT Element; + + XMASSERT(pSource); + + Element = pSource->v & 0x1F; + V.vector4_f32[0] = (FLOAT)Element; + Element = (pSource->v >> 5) & 0x3F; + V.vector4_f32[1] = (FLOAT)Element; + Element = (pSource->v >> 11) & 0x1F; + V.vector4_f32[2] = (FLOAT)Element; + + return V; +#endif // !_XM_SSE_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMLoadFloat3PK +( + CONST XMFLOAT3PK* pSource +) +{ + _DECLSPEC_ALIGN_16_ UINT Result[4]; + UINT Mantissa; + UINT Exponent; + + XMASSERT(pSource); + + // X Channel (6-bit mantissa) + Mantissa = pSource->xm; + + if ( pSource->xe == 0x1f ) // INF or NAN + { + Result[0] = 0x7f800000 | (pSource->xm << 17); + } + else + { + if ( pSource->xe != 0 ) // The value is normalized + { + Exponent = pSource->xe; + } + else if (Mantissa != 0) // The value is denormalized + { + // Normalize the value in the resulting float + Exponent = 1; + + do + { + Exponent--; + Mantissa <<= 1; + } while ((Mantissa & 0x40) == 0); + + Mantissa &= 0x3F; + } + else // The value is zero + { + Exponent = (UINT)-112; + } + + Result[0] = ((Exponent + 112) << 23) | (Mantissa << 17); + } + + // Y Channel (6-bit mantissa) + Mantissa = pSource->ym; + + if ( pSource->ye == 0x1f ) // INF or NAN + { + Result[1] = 0x7f800000 | (pSource->ym << 17); + } + else + { + if ( pSource->ye != 0 ) // The value is normalized + { + Exponent = pSource->ye; + } + else if (Mantissa != 0) // The value is denormalized + { + // Normalize the value in the resulting float + Exponent = 1; + + do + { + Exponent--; + Mantissa <<= 1; + } while ((Mantissa & 0x40) == 0); + + Mantissa &= 0x3F; + } + else // The value is zero + { + Exponent = (UINT)-112; + } + + Result[1] = ((Exponent + 112) << 23) | (Mantissa << 17); + } + + // Z Channel (5-bit mantissa) + Mantissa = pSource->zm; + + if ( pSource->ze == 0x1f ) // INF or NAN + { + Result[2] = 0x7f800000 | (pSource->zm << 17); + } + else + { + if ( pSource->ze != 0 ) // The value is normalized + { + Exponent = pSource->ze; + } + else if (Mantissa != 0) // The value is denormalized + { + // Normalize the value in the resulting float + Exponent = 1; + + do + { + Exponent--; + Mantissa <<= 1; + } while ((Mantissa & 0x20) == 0); + + Mantissa &= 0x1F; + } + else // The value is zero + { + Exponent = (UINT)-112; + } + + Result[2] = ((Exponent + 112) << 23) | (Mantissa << 18); + } + + return XMLoadFloat3A( (XMFLOAT3A*)&Result ); +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMLoadFloat3SE +( + CONST XMFLOAT3SE* pSource +) +{ + _DECLSPEC_ALIGN_16_ UINT Result[4]; + UINT Mantissa; + UINT Exponent, ExpBits; + + XMASSERT(pSource); + + if ( pSource->e == 0x1f ) // INF or NAN + { + Result[0] = 0x7f800000 | (pSource->xm << 14); + Result[1] = 0x7f800000 | (pSource->ym << 14); + Result[2] = 0x7f800000 | (pSource->zm << 14); + } + else if ( pSource->e != 0 ) // The values are all normalized + { + Exponent = pSource->e; + + ExpBits = (Exponent + 112) << 23; + + Mantissa = pSource->xm; + Result[0] = ExpBits | (Mantissa << 14); + + Mantissa = pSource->ym; + Result[1] = ExpBits | (Mantissa << 14); + + Mantissa = pSource->zm; + Result[2] = ExpBits | (Mantissa << 14); + } + else + { + // X Channel + Mantissa = pSource->xm; + + if (Mantissa != 0) // The value is denormalized + { + // Normalize the value in the resulting float + Exponent = 1; + + do + { + Exponent--; + Mantissa <<= 1; + } while ((Mantissa & 0x200) == 0); + + Mantissa &= 0x1FF; + } + else // The value is zero + { + Exponent = (UINT)-112; + } + + Result[0] = ((Exponent + 112) << 23) | (Mantissa << 14); + + // Y Channel + Mantissa = pSource->ym; + + if (Mantissa != 0) // The value is denormalized + { + // Normalize the value in the resulting float + Exponent = 1; + + do + { + Exponent--; + Mantissa <<= 1; + } while ((Mantissa & 0x200) == 0); + + Mantissa &= 0x1FF; + } + else // The value is zero + { + Exponent = (UINT)-112; + } + + Result[1] = ((Exponent + 112) << 23) | (Mantissa << 14); + + // Z Channel + Mantissa = pSource->zm; + + if (Mantissa != 0) // The value is denormalized + { + // Normalize the value in the resulting float + Exponent = 1; + + do + { + Exponent--; + Mantissa <<= 1; + } while ((Mantissa & 0x200) == 0); + + Mantissa &= 0x1FF; + } + else // The value is zero + { + Exponent = (UINT)-112; + } + + Result[2] = ((Exponent + 112) << 23) | (Mantissa << 14); + } + + return XMLoadFloat3A( (XMFLOAT3A*)&Result ); +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMLoadInt4 +( + CONST UINT* pSource +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V; + + XMASSERT(pSource); + + V.vector4_u32[0] = pSource[0]; + V.vector4_u32[1] = pSource[1]; + V.vector4_u32[2] = pSource[2]; + V.vector4_u32[3] = pSource[3]; + + return V; + +#elif defined(_XM_SSE_INTRINSICS_) + + XMASSERT(pSource); + + __m128i V = _mm_loadu_si128( (const __m128i*)pSource ); + return reinterpret_cast<__m128 *>(&V)[0]; + +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMLoadInt4A +( + CONST UINT* pSource +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V; + + XMASSERT(pSource); + XMASSERT(((UINT_PTR)pSource & 0xF) == 0); + + V.vector4_u32[0] = pSource[0]; + V.vector4_u32[1] = pSource[1]; + V.vector4_u32[2] = pSource[2]; + V.vector4_u32[3] = pSource[3]; + + return V; + +#elif defined(_XM_SSE_INTRINSICS_) + + XMASSERT(pSource); + XMASSERT(((UINT_PTR)pSource & 0xF) == 0); + + __m128i V = _mm_load_si128( (const __m128i*)pSource ); + return reinterpret_cast<__m128 *>(&V)[0]; + +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMLoadFloat4 +( + CONST XMFLOAT4* pSource +) +{ +#if defined(_XM_NO_INTRINSICS_) + XMVECTOR V; + XMASSERT(pSource); + + ((UINT *)(&V.vector4_f32[0]))[0] = ((const UINT *)(&pSource->x))[0]; + ((UINT *)(&V.vector4_f32[1]))[0] = ((const UINT *)(&pSource->y))[0]; + ((UINT *)(&V.vector4_f32[2]))[0] = ((const UINT *)(&pSource->z))[0]; + ((UINT *)(&V.vector4_f32[3]))[0] = ((const UINT *)(&pSource->w))[0]; + return V; +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pSource); + + return _mm_loadu_ps( &pSource->x ); +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMLoadFloat4A +( + CONST XMFLOAT4A* pSource +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V; + + XMASSERT(pSource); + XMASSERT(((UINT_PTR)pSource & 0xF) == 0); + + V.vector4_f32[0] = pSource->x; + V.vector4_f32[1] = pSource->y; + V.vector4_f32[2] = pSource->z; + V.vector4_f32[3] = pSource->w; + + return V; + +#elif defined(_XM_SSE_INTRINSICS_) + + XMASSERT(pSource); + XMASSERT(((UINT_PTR)pSource & 0xF) == 0); + + return _mm_load_ps( &pSource->x ); + +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMLoadHalf4 +( + CONST XMHALF4* pSource +) +{ +#if defined(_XM_NO_INTRINSICS_) + XMASSERT(pSource); + { + XMVECTOR vResult = { + XMConvertHalfToFloat(pSource->x), + XMConvertHalfToFloat(pSource->y), + XMConvertHalfToFloat(pSource->z), + XMConvertHalfToFloat(pSource->w) + }; + return vResult; + } +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pSource); + XMVECTOR vResult = { + XMConvertHalfToFloat(pSource->x), + XMConvertHalfToFloat(pSource->y), + XMConvertHalfToFloat(pSource->z), + XMConvertHalfToFloat(pSource->w) + }; + return vResult; +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMLoadShortN4 +( + CONST XMSHORTN4* pSource +) +{ +#if defined(_XM_NO_INTRINSICS_) + XMASSERT(pSource); + XMASSERT(pSource->x != -32768); + XMASSERT(pSource->y != -32768); + XMASSERT(pSource->z != -32768); + XMASSERT(pSource->w != -32768); + { + XMVECTOR vResult = { + (FLOAT)pSource->x * (1.0f/32767.0f), + (FLOAT)pSource->y * (1.0f/32767.0f), + (FLOAT)pSource->z * (1.0f/32767.0f), + (FLOAT)pSource->w * (1.0f/32767.0f) + }; + return vResult; + } +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pSource); + XMASSERT(pSource->x != -32768); + XMASSERT(pSource->y != -32768); + XMASSERT(pSource->z != -32768); + XMASSERT(pSource->w != -32768); + // Splat the color in all four entries (x,z,y,w) + __m128d vIntd = _mm_load1_pd(reinterpret_cast(&pSource->x)); + // Shift x&0ffff,z&0xffff,y&0xffff0000,w&0xffff0000 + __m128 vTemp = _mm_and_ps(reinterpret_cast(&vIntd)[0],g_XMMaskX16Y16Z16W16); + // x and z are unsigned! Flip the bits to convert the order to signed + vTemp = _mm_xor_ps(vTemp,g_XMFlipX16Y16Z16W16); + // Convert to floating point numbers + vTemp = _mm_cvtepi32_ps(reinterpret_cast(&vTemp)[0]); + // x and z - 0x8000 to complete the conversion + vTemp = _mm_add_ps(vTemp,g_XMFixX16Y16Z16W16); + // Convert -32767-32767 to -1.0f-1.0f + vTemp = _mm_mul_ps(vTemp,g_XMNormalizeX16Y16Z16W16); + // Very important! The entries are x,z,y,w, flip it to x,y,z,w + vTemp = _mm_shuffle_ps(vTemp,vTemp,_MM_SHUFFLE(3,1,2,0)); + return vTemp; +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMLoadShort4 +( + CONST XMSHORT4* pSource +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V; + + XMASSERT(pSource); + XMASSERT(pSource->x != -32768); + XMASSERT(pSource->y != -32768); + XMASSERT(pSource->z != -32768); + XMASSERT(pSource->w != -32768); + + V.vector4_f32[0] = (FLOAT)pSource->x; + V.vector4_f32[1] = (FLOAT)pSource->y; + V.vector4_f32[2] = (FLOAT)pSource->z; + V.vector4_f32[3] = (FLOAT)pSource->w; + + return V; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pSource); + XMASSERT(pSource->x != -32768); + XMASSERT(pSource->y != -32768); + XMASSERT(pSource->z != -32768); + XMASSERT(pSource->w != -32768); + // Splat the color in all four entries (x,z,y,w) + __m128d vIntd = _mm_load1_pd(reinterpret_cast(&pSource->x)); + // Shift x&0ffff,z&0xffff,y&0xffff0000,w&0xffff0000 + __m128 vTemp = _mm_and_ps(reinterpret_cast(&vIntd)[0],g_XMMaskX16Y16Z16W16); + // x and z are unsigned! Flip the bits to convert the order to signed + vTemp = _mm_xor_ps(vTemp,g_XMFlipX16Y16Z16W16); + // Convert to floating point numbers + vTemp = _mm_cvtepi32_ps(reinterpret_cast(&vTemp)[0]); + // x and z - 0x8000 to complete the conversion + vTemp = _mm_add_ps(vTemp,g_XMFixX16Y16Z16W16); + // Fix y and w because they are 65536 too large + vTemp = _mm_mul_ps(vTemp,g_XMFixupY16W16); + // Very important! The entries are x,z,y,w, flip it to x,y,z,w + return _mm_shuffle_ps(vTemp,vTemp,_MM_SHUFFLE(3,1,2,0)); +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMLoadUShortN4 +( + CONST XMUSHORTN4* pSource +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V; + + XMASSERT(pSource); + + V.vector4_f32[0] = (FLOAT)pSource->x / 65535.0f; + V.vector4_f32[1] = (FLOAT)pSource->y / 65535.0f; + V.vector4_f32[2] = (FLOAT)pSource->z / 65535.0f; + V.vector4_f32[3] = (FLOAT)pSource->w / 65535.0f; + + return V; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pSource); + static const XMVECTORF32 FixupY16W16 = {1.0f/65535.0f,1.0f/65535.0f,1.0f/(65535.0f*65536.0f),1.0f/(65535.0f*65536.0f)}; + static const XMVECTORF32 FixaddY16W16 = {0,0,32768.0f*65536.0f,32768.0f*65536.0f}; + XMASSERT(pSource); + // Splat the color in all four entries (x,z,y,w) + __m128d vIntd = _mm_load1_pd(reinterpret_cast(&pSource->x)); + // Shift x&0ffff,z&0xffff,y&0xffff0000,w&0xffff0000 + __m128 vTemp = _mm_and_ps(reinterpret_cast(&vIntd)[0],g_XMMaskX16Y16Z16W16); + // y and w are signed! Flip the bits to convert the order to unsigned + vTemp = _mm_xor_ps(vTemp,g_XMFlipZW); + // Convert to floating point numbers + vTemp = _mm_cvtepi32_ps(reinterpret_cast(&vTemp)[0]); + // y and w + 0x8000 to complete the conversion + vTemp = _mm_add_ps(vTemp,FixaddY16W16); + // Fix y and w because they are 65536 too large + vTemp = _mm_mul_ps(vTemp,FixupY16W16); + // Very important! The entries are x,z,y,w, flip it to x,y,z,w + return _mm_shuffle_ps(vTemp,vTemp,_MM_SHUFFLE(3,1,2,0)); +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMLoadUShort4 +( + CONST XMUSHORT4* pSource +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V; + + XMASSERT(pSource); + + V.vector4_f32[0] = (FLOAT)pSource->x; + V.vector4_f32[1] = (FLOAT)pSource->y; + V.vector4_f32[2] = (FLOAT)pSource->z; + V.vector4_f32[3] = (FLOAT)pSource->w; + + return V; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pSource); + static const XMVECTORF32 FixaddY16W16 = {0,0,32768.0f,32768.0f}; + XMASSERT(pSource); + // Splat the color in all four entries (x,z,y,w) + __m128d vIntd = _mm_load1_pd(reinterpret_cast(&pSource->x)); + // Shift x&0ffff,z&0xffff,y&0xffff0000,w&0xffff0000 + __m128 vTemp = _mm_and_ps(reinterpret_cast(&vIntd)[0],g_XMMaskX16Y16Z16W16); + // y and w are signed! Flip the bits to convert the order to unsigned + vTemp = _mm_xor_ps(vTemp,g_XMFlipZW); + // Convert to floating point numbers + vTemp = _mm_cvtepi32_ps(reinterpret_cast(&vTemp)[0]); + // Fix y and w because they are 65536 too large + vTemp = _mm_mul_ps(vTemp,g_XMFixupY16W16); + // y and w + 0x8000 to complete the conversion + vTemp = _mm_add_ps(vTemp,FixaddY16W16); + // Very important! The entries are x,z,y,w, flip it to x,y,z,w + return _mm_shuffle_ps(vTemp,vTemp,_MM_SHUFFLE(3,1,2,0)); +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMLoadXIcoN4 +( + CONST XMXICON4* pSource +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V; + UINT Element; + static CONST UINT SignExtend[] = {0x00000000, 0xFFF00000}; + + XMASSERT(pSource); + XMASSERT((pSource->v & 0xFFFFFull) != 0x80000ull); + XMASSERT(((pSource->v >> 20) & 0xFFFFFull) != 0x80000ull); + XMASSERT(((pSource->v >> 40) & 0xFFFFFull) != 0x80000ull); + + Element = (UINT)(pSource->v & 0xFFFFF); + V.vector4_f32[0] = (FLOAT)(INT)(Element | SignExtend[Element >> 19]) / 524287.0f; + Element = (UINT)((pSource->v >> 20) & 0xFFFFF); + V.vector4_f32[1] = (FLOAT)(INT)(Element | SignExtend[Element >> 19]) / 524287.0f; + Element = (UINT)((pSource->v >> 40) & 0xFFFFF); + V.vector4_f32[2] = (FLOAT)(INT)(Element | SignExtend[Element >> 19]) / 524287.0f; + V.vector4_f32[3] = (FLOAT)(pSource->v >> 60) / 15.0f; + + return V; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT((pSource->v & 0xFFFFFull) != 0x80000ull); + XMASSERT(((pSource->v >> 20) & 0xFFFFFull) != 0x80000ull); + XMASSERT(((pSource->v >> 40) & 0xFFFFFull) != 0x80000ull); + static const XMVECTORF32 LoadXIcoN4Mul = {1.0f/524287.0f,1.0f/(524287.0f*4096.0f),1.0f/524287.0f,1.0f/(15.0f*4096.0f*65536.0f)}; + XMASSERT(pSource); + // Grab the 64 bit structure + __m128d vResultd = _mm_load_sd(reinterpret_cast(&pSource->v)); + // By shifting down 8 bits, y and z are in seperate 32 bit elements + __m128i vResulti = _mm_srli_si128(reinterpret_cast(&vResultd)[0],8/8); + // vResultd has x and w, vResulti has y and z, merge into one as x,w,y,z + XMVECTOR vTemp = _mm_shuffle_ps(reinterpret_cast(&vResultd)[0],reinterpret_cast(&vResulti)[0],_MM_SHUFFLE(1,0,1,0)); + // Fix the entries to x,y,z,w + vTemp = _mm_shuffle_ps(vTemp,vTemp,_MM_SHUFFLE(1,3,2,0)); + // Mask x,y,z and w + vTemp = _mm_and_ps(vTemp,g_XMMaskIco4); + // x and z are unsigned! Flip the bits to convert the order to signed + vTemp = _mm_xor_ps(vTemp,g_XMXorXIco4); + // Convert to floating point numbers + vTemp = _mm_cvtepi32_ps(reinterpret_cast(&vTemp)[0]); + // x and z - 0x80 to complete the conversion + vTemp = _mm_add_ps(vTemp,g_XMAddXIco4); + // Fix y and w because they are too large + vTemp = _mm_mul_ps(vTemp,LoadXIcoN4Mul); + return vTemp; +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMLoadXIco4 +( + CONST XMXICO4* pSource +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V; + UINT Element; + static CONST UINT SignExtend[] = {0x00000000, 0xFFF00000}; + + XMASSERT(pSource); + XMASSERT((pSource->v & 0xFFFFFull) != 0x80000ull); + XMASSERT(((pSource->v >> 20) & 0xFFFFFull) != 0x80000ull); + XMASSERT(((pSource->v >> 40) & 0xFFFFFull) != 0x80000ull); + + Element = (UINT)(pSource->v & 0xFFFFF); + V.vector4_f32[0] = (FLOAT)(INT)(Element | SignExtend[Element >> 19]); + Element = (UINT)((pSource->v >> 20) & 0xFFFFF); + V.vector4_f32[1] = (FLOAT)(INT)(Element | SignExtend[Element >> 19]); + Element = (UINT)((pSource->v >> 40) & 0xFFFFF); + V.vector4_f32[2] = (FLOAT)(INT)(Element | SignExtend[Element >> 19]); + V.vector4_f32[3] = (FLOAT)(pSource->v >> 60); + + return V; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT((pSource->v & 0xFFFFFull) != 0x80000ull); + XMASSERT(((pSource->v >> 20) & 0xFFFFFull) != 0x80000ull); + XMASSERT(((pSource->v >> 40) & 0xFFFFFull) != 0x80000ull); + XMASSERT(pSource); + // Grab the 64 bit structure + __m128d vResultd = _mm_load_sd(reinterpret_cast(&pSource->v)); + // By shifting down 8 bits, y and z are in seperate 32 bit elements + __m128i vResulti = _mm_srli_si128(reinterpret_cast(&vResultd)[0],8/8); + // vResultd has x and w, vResulti has y and z, merge into one as x,w,y,z + XMVECTOR vTemp = _mm_shuffle_ps(reinterpret_cast(&vResultd)[0],reinterpret_cast(&vResulti)[0],_MM_SHUFFLE(1,0,1,0)); + // Fix the entries to x,y,z,w + vTemp = _mm_shuffle_ps(vTemp,vTemp,_MM_SHUFFLE(1,3,2,0)); + // Mask x,y,z and w + vTemp = _mm_and_ps(vTemp,g_XMMaskIco4); + // x and z are unsigned! Flip the bits to convert the order to signed + vTemp = _mm_xor_ps(vTemp,g_XMXorXIco4); + // Convert to floating point numbers + vTemp = _mm_cvtepi32_ps(reinterpret_cast(&vTemp)[0]); + // x and z - 0x80 to complete the conversion + vTemp = _mm_add_ps(vTemp,g_XMAddXIco4); + // Fix y and w because they are too large + vTemp = _mm_mul_ps(vTemp,g_XMMulIco4); + return vTemp; +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMLoadUIcoN4 +( + CONST XMUICON4* pSource +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V; + + XMASSERT(pSource); + + V.vector4_f32[0] = (FLOAT)(pSource->v & 0xFFFFF) / 1048575.0f; + V.vector4_f32[1] = (FLOAT)((pSource->v >> 20) & 0xFFFFF) / 1048575.0f; + V.vector4_f32[2] = (FLOAT)((pSource->v >> 40) & 0xFFFFF) / 1048575.0f; + V.vector4_f32[3] = (FLOAT)(pSource->v >> 60) / 15.0f; + + return V; + +#elif defined(_XM_SSE_INTRINSICS_) + static const XMVECTORF32 LoadUIcoN4Mul = {1.0f/1048575.0f,1.0f/(1048575.0f*4096.0f),1.0f/1048575.0f,1.0f/(15.0f*4096.0f*65536.0f)}; + XMASSERT(pSource); + // Grab the 64 bit structure + __m128d vResultd = _mm_load_sd(reinterpret_cast(&pSource->v)); + // By shifting down 8 bits, y and z are in seperate 32 bit elements + __m128i vResulti = _mm_srli_si128(reinterpret_cast(&vResultd)[0],8/8); + // vResultd has x and w, vResulti has y and z, merge into one as x,w,y,z + XMVECTOR vTemp = _mm_shuffle_ps(reinterpret_cast(&vResultd)[0],reinterpret_cast(&vResulti)[0],_MM_SHUFFLE(1,0,1,0)); + // Fix the entries to x,y,z,w + vTemp = _mm_shuffle_ps(vTemp,vTemp,_MM_SHUFFLE(1,3,2,0)); + // Mask x,y,z and w + vTemp = _mm_and_ps(vTemp,g_XMMaskIco4); + // x and z are unsigned! Flip the bits to convert the order to signed + vTemp = _mm_xor_ps(vTemp,g_XMFlipYW); + // Convert to floating point numbers + vTemp = _mm_cvtepi32_ps(reinterpret_cast(&vTemp)[0]); + // x and z - 0x80 to complete the conversion + vTemp = _mm_add_ps(vTemp,g_XMAddUIco4); + // Fix y and w because they are too large + vTemp = _mm_mul_ps(vTemp,LoadUIcoN4Mul); + return vTemp; +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMLoadUIco4 +( + CONST XMUICO4* pSource +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V; + + XMASSERT(pSource); + + V.vector4_f32[0] = (FLOAT)(pSource->v & 0xFFFFF); + V.vector4_f32[1] = (FLOAT)((pSource->v >> 20) & 0xFFFFF); + V.vector4_f32[2] = (FLOAT)((pSource->v >> 40) & 0xFFFFF); + V.vector4_f32[3] = (FLOAT)(pSource->v >> 60); + + return V; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pSource); + // Grab the 64 bit structure + __m128d vResultd = _mm_load_sd(reinterpret_cast(&pSource->v)); + // By shifting down 8 bits, y and z are in seperate 32 bit elements + __m128i vResulti = _mm_srli_si128(reinterpret_cast(&vResultd)[0],8/8); + // vResultd has x and w, vResulti has y and z, merge into one as x,w,y,z + XMVECTOR vTemp = _mm_shuffle_ps(reinterpret_cast(&vResultd)[0],reinterpret_cast(&vResulti)[0],_MM_SHUFFLE(1,0,1,0)); + // Fix the entries to x,y,z,w + vTemp = _mm_shuffle_ps(vTemp,vTemp,_MM_SHUFFLE(1,3,2,0)); + // Mask x,y,z and w + vTemp = _mm_and_ps(vTemp,g_XMMaskIco4); + // x and z are unsigned! Flip the bits to convert the order to signed + vTemp = _mm_xor_ps(vTemp,g_XMFlipYW); + // Convert to floating point numbers + vTemp = _mm_cvtepi32_ps(reinterpret_cast(&vTemp)[0]); + // x and z - 0x80 to complete the conversion + vTemp = _mm_add_ps(vTemp,g_XMAddUIco4); + // Fix y and w because they are too large + vTemp = _mm_mul_ps(vTemp,g_XMMulIco4); + return vTemp; +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMLoadIcoN4 +( + CONST XMICON4* pSource +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V; + UINT Element; + static CONST UINT SignExtend[] = {0x00000000, 0xFFF00000}; + static CONST UINT SignExtendW[] = {0x00000000, 0xFFFFFFF0}; + + XMASSERT(pSource); + + Element = (UINT)(pSource->v & 0xFFFFF); + V.vector4_f32[0] = (FLOAT)(INT)(Element | SignExtend[Element >> 19]) / 524287.0f; + Element = (UINT)((pSource->v >> 20) & 0xFFFFF); + V.vector4_f32[1] = (FLOAT)(INT)(Element | SignExtend[Element >> 19]) / 524287.0f; + Element = (UINT)((pSource->v >> 40) & 0xFFFFF); + V.vector4_f32[2] = (FLOAT)(INT)(Element | SignExtend[Element >> 19]) / 524287.0f; + Element = (UINT)(pSource->v >> 60); + V.vector4_f32[3] = (FLOAT)(INT)(Element | SignExtendW[Element >> 3]) / 7.0f; + + return V; + +#elif defined(_XM_SSE_INTRINSICS_) + static const XMVECTORF32 LoadIcoN4Mul = {1.0f/524287.0f,1.0f/(524287.0f*4096.0f),1.0f/524287.0f,1.0f/(7.0f*4096.0f*65536.0f)}; + XMASSERT(pSource); + // Grab the 64 bit structure + __m128d vResultd = _mm_load_sd(reinterpret_cast(&pSource->v)); + // By shifting down 8 bits, y and z are in seperate 32 bit elements + __m128i vResulti = _mm_srli_si128(reinterpret_cast(&vResultd)[0],8/8); + // vResultd has x and w, vResulti has y and z, merge into one as x,w,y,z + XMVECTOR vTemp = _mm_shuffle_ps(reinterpret_cast(&vResultd)[0],reinterpret_cast(&vResulti)[0],_MM_SHUFFLE(1,0,1,0)); + // Fix the entries to x,y,z,w + vTemp = _mm_shuffle_ps(vTemp,vTemp,_MM_SHUFFLE(1,3,2,0)); + // Mask x,y,z and w + vTemp = _mm_and_ps(vTemp,g_XMMaskIco4); + // x and z are unsigned! Flip the bits to convert the order to signed + vTemp = _mm_xor_ps(vTemp,g_XMXorIco4); + // Convert to floating point numbers + vTemp = _mm_cvtepi32_ps(reinterpret_cast(&vTemp)[0]); + // x and z - 0x80 to complete the conversion + vTemp = _mm_add_ps(vTemp,g_XMAddIco4); + // Fix y and w because they are too large + vTemp = _mm_mul_ps(vTemp,LoadIcoN4Mul); + return vTemp; +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMLoadIco4 +( + CONST XMICO4* pSource +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V; + UINT Element; + static CONST UINT SignExtend[] = {0x00000000, 0xFFF00000}; + static CONST UINT SignExtendW[] = {0x00000000, 0xFFFFFFF0}; + + XMASSERT(pSource); + + Element = (UINT)(pSource->v & 0xFFFFF); + V.vector4_f32[0] = (FLOAT)(INT)(Element | SignExtend[Element >> 19]); + Element = (UINT)((pSource->v >> 20) & 0xFFFFF); + V.vector4_f32[1] = (FLOAT)(INT)(Element | SignExtend[Element >> 19]); + Element = (UINT)((pSource->v >> 40) & 0xFFFFF); + V.vector4_f32[2] = (FLOAT)(INT)(Element | SignExtend[Element >> 19]); + Element = (UINT)(pSource->v >> 60); + V.vector4_f32[3] = (FLOAT)(INT)(Element | SignExtendW[Element >> 3]); + + return V; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pSource); + // Grab the 64 bit structure + __m128d vResultd = _mm_load_sd(reinterpret_cast(&pSource->v)); + // By shifting down 8 bits, y and z are in seperate 32 bit elements + __m128i vResulti = _mm_srli_si128(reinterpret_cast(&vResultd)[0],8/8); + // vResultd has x and w, vResulti has y and z, merge into one as x,w,y,z + XMVECTOR vTemp = _mm_shuffle_ps(reinterpret_cast(&vResultd)[0],reinterpret_cast(&vResulti)[0],_MM_SHUFFLE(1,0,1,0)); + // Fix the entries to x,y,z,w + vTemp = _mm_shuffle_ps(vTemp,vTemp,_MM_SHUFFLE(1,3,2,0)); + // Mask x,y,z and w + vTemp = _mm_and_ps(vTemp,g_XMMaskIco4); + // x and z are unsigned! Flip the bits to convert the order to signed + vTemp = _mm_xor_ps(vTemp,g_XMXorIco4); + // Convert to floating point numbers + vTemp = _mm_cvtepi32_ps(reinterpret_cast(&vTemp)[0]); + // x and z - 0x80 to complete the conversion + vTemp = _mm_add_ps(vTemp,g_XMAddIco4); + // Fix y and w because they are too large + vTemp = _mm_mul_ps(vTemp,g_XMMulIco4); + return vTemp; +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMLoadXDecN4 +( + CONST XMXDECN4* pSource +) +{ +#if defined(_XM_NO_INTRINSICS_) + XMVECTOR V; + UINT Element; + static CONST UINT SignExtend[] = {0x00000000, 0xFFFFFC00}; + + XMASSERT(pSource); + XMASSERT((pSource->v & 0x3FF) != 0x200); + XMASSERT(((pSource->v >> 10) & 0x3FF) != 0x200); + XMASSERT(((pSource->v >> 20) & 0x3FF) != 0x200); + + Element = pSource->v & 0x3FF; + V.vector4_f32[0] = (FLOAT)(SHORT)(Element | SignExtend[Element >> 9]) / 511.0f; + Element = (pSource->v >> 10) & 0x3FF; + V.vector4_f32[1] = (FLOAT)(SHORT)(Element | SignExtend[Element >> 9]) / 511.0f; + Element = (pSource->v >> 20) & 0x3FF; + V.vector4_f32[2] = (FLOAT)(SHORT)(Element | SignExtend[Element >> 9]) / 511.0f; + V.vector4_f32[3] = (FLOAT)(pSource->v >> 30) / 3.0f; + + return V; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pSource); + // Splat the color in all four entries + __m128 vTemp = _mm_load_ps1(reinterpret_cast(&pSource->v)); + // Shift R&0xFF0000, G&0xFF00, B&0xFF, A&0xFF000000 + vTemp = _mm_and_ps(vTemp,g_XMMaskA2B10G10R10); + // a is unsigned! Flip the bit to convert the order to signed + vTemp = _mm_xor_ps(vTemp,g_XMFlipA2B10G10R10); + // Convert to floating point numbers + vTemp = _mm_cvtepi32_ps(reinterpret_cast(&vTemp)[0]); + // RGB + 0, A + 0x80000000.f to undo the signed order. + vTemp = _mm_add_ps(vTemp,g_XMFixAA2B10G10R10); + // Convert 0-255 to 0.0f-1.0f + return _mm_mul_ps(vTemp,g_XMNormalizeA2B10G10R10); +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMLoadXDec4 +( + CONST XMXDEC4* pSource +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V; + UINT Element; + static CONST UINT SignExtend[] = {0x00000000, 0xFFFFFC00}; + + XMASSERT(pSource); + XMASSERT((pSource->v & 0x3FF) != 0x200); + XMASSERT(((pSource->v >> 10) & 0x3FF) != 0x200); + XMASSERT(((pSource->v >> 20) & 0x3FF) != 0x200); + + Element = pSource->v & 0x3FF; + V.vector4_f32[0] = (FLOAT)(SHORT)(Element | SignExtend[Element >> 9]); + Element = (pSource->v >> 10) & 0x3FF; + V.vector4_f32[1] = (FLOAT)(SHORT)(Element | SignExtend[Element >> 9]); + Element = (pSource->v >> 20) & 0x3FF; + V.vector4_f32[2] = (FLOAT)(SHORT)(Element | SignExtend[Element >> 9]); + V.vector4_f32[3] = (FLOAT)(pSource->v >> 30); + + return V; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT((pSource->v & 0x3FF) != 0x200); + XMASSERT(((pSource->v >> 10) & 0x3FF) != 0x200); + XMASSERT(((pSource->v >> 20) & 0x3FF) != 0x200); + static const XMVECTORI32 XDec4Xor = {0x200, 0x200<<10, 0x200<<20, 0x80000000}; + static const XMVECTORF32 XDec4Add = {-512.0f,-512.0f*1024.0f,-512.0f*1024.0f*1024.0f,32768*65536.0f}; + XMASSERT(pSource); + // Splat the color in all four entries + XMVECTOR vTemp = _mm_load_ps1(reinterpret_cast(&pSource->v)); + // Shift R&0xFF0000, G&0xFF00, B&0xFF, A&0xFF000000 + vTemp = _mm_and_ps(vTemp,g_XMMaskDec4); + // a is unsigned! Flip the bit to convert the order to signed + vTemp = _mm_xor_ps(vTemp,XDec4Xor); + // Convert to floating point numbers + vTemp = _mm_cvtepi32_ps(reinterpret_cast(&vTemp)[0]); + // RGB + 0, A + 0x80000000.f to undo the signed order. + vTemp = _mm_add_ps(vTemp,XDec4Add); + // Convert 0-255 to 0.0f-1.0f + vTemp = _mm_mul_ps(vTemp,g_XMMulDec4); + return vTemp; +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMLoadUDecN4 +( + CONST XMUDECN4* pSource +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V; + UINT Element; + + XMASSERT(pSource); + + Element = pSource->v & 0x3FF; + V.vector4_f32[0] = (FLOAT)Element / 1023.0f; + Element = (pSource->v >> 10) & 0x3FF; + V.vector4_f32[1] = (FLOAT)Element / 1023.0f; + Element = (pSource->v >> 20) & 0x3FF; + V.vector4_f32[2] = (FLOAT)Element / 1023.0f; + V.vector4_f32[3] = (FLOAT)(pSource->v >> 30) / 3.0f; + + return V; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pSource); + static const XMVECTORF32 UDecN4Mul = {1.0f/1023.0f,1.0f/(1023.0f*1024.0f),1.0f/(1023.0f*1024.0f*1024.0f),1.0f/(3.0f*1024.0f*1024.0f*1024.0f)}; + // Splat the color in all four entries + XMVECTOR vTemp = _mm_load_ps1(reinterpret_cast(&pSource->v)); + // Shift R&0xFF0000, G&0xFF00, B&0xFF, A&0xFF000000 + vTemp = _mm_and_ps(vTemp,g_XMMaskDec4); + // a is unsigned! Flip the bit to convert the order to signed + vTemp = _mm_xor_ps(vTemp,g_XMFlipW); + // Convert to floating point numbers + vTemp = _mm_cvtepi32_ps(reinterpret_cast(&vTemp)[0]); + // RGB + 0, A + 0x80000000.f to undo the signed order. + vTemp = _mm_add_ps(vTemp,g_XMAddUDec4); + // Convert 0-255 to 0.0f-1.0f + vTemp = _mm_mul_ps(vTemp,UDecN4Mul); + return vTemp; +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMLoadUDec4 +( + CONST XMUDEC4* pSource +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V; + UINT Element; + + XMASSERT(pSource); + + Element = pSource->v & 0x3FF; + V.vector4_f32[0] = (FLOAT)Element; + Element = (pSource->v >> 10) & 0x3FF; + V.vector4_f32[1] = (FLOAT)Element; + Element = (pSource->v >> 20) & 0x3FF; + V.vector4_f32[2] = (FLOAT)Element; + V.vector4_f32[3] = (FLOAT)(pSource->v >> 30); + + return V; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pSource); + // Splat the color in all four entries + XMVECTOR vTemp = _mm_load_ps1(reinterpret_cast(&pSource->v)); + // Shift R&0xFF0000, G&0xFF00, B&0xFF, A&0xFF000000 + vTemp = _mm_and_ps(vTemp,g_XMMaskDec4); + // a is unsigned! Flip the bit to convert the order to signed + vTemp = _mm_xor_ps(vTemp,g_XMFlipW); + // Convert to floating point numbers + vTemp = _mm_cvtepi32_ps(reinterpret_cast(&vTemp)[0]); + // RGB + 0, A + 0x80000000.f to undo the signed order. + vTemp = _mm_add_ps(vTemp,g_XMAddUDec4); + // Convert 0-255 to 0.0f-1.0f + vTemp = _mm_mul_ps(vTemp,g_XMMulDec4); + return vTemp; +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMLoadDecN4 +( + CONST XMDECN4* pSource +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V; + UINT Element; + static CONST UINT SignExtend[] = {0x00000000, 0xFFFFFC00}; + static CONST UINT SignExtendW[] = {0x00000000, 0xFFFFFFFC}; + + XMASSERT(pSource); + XMASSERT((pSource->v & 0x3FF) != 0x200); + XMASSERT(((pSource->v >> 10) & 0x3FF) != 0x200); + XMASSERT(((pSource->v >> 20) & 0x3FF) != 0x200); + XMASSERT(((pSource->v >> 30) & 0x3) != 0x2); + + Element = pSource->v & 0x3FF; + V.vector4_f32[0] = (FLOAT)(SHORT)(Element | SignExtend[Element >> 9]) / 511.0f; + Element = (pSource->v >> 10) & 0x3FF; + V.vector4_f32[1] = (FLOAT)(SHORT)(Element | SignExtend[Element >> 9]) / 511.0f; + Element = (pSource->v >> 20) & 0x3FF; + V.vector4_f32[2] = (FLOAT)(SHORT)(Element | SignExtend[Element >> 9]) / 511.0f; + Element = pSource->v >> 30; + V.vector4_f32[3] = (FLOAT)(SHORT)(Element | SignExtendW[Element >> 1]); + + return V; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pSource); + XMASSERT((pSource->v & 0x3FF) != 0x200); + XMASSERT(((pSource->v >> 10) & 0x3FF) != 0x200); + XMASSERT(((pSource->v >> 20) & 0x3FF) != 0x200); + XMASSERT(((pSource->v >> 30) & 0x3) != 0x2); + static const XMVECTORF32 DecN4Mul = {1.0f/511.0f,1.0f/(511.0f*1024.0f),1.0f/(511.0f*1024.0f*1024.0f),1.0f/(1024.0f*1024.0f*1024.0f)}; + // Splat the color in all four entries + XMVECTOR vTemp = _mm_load_ps1(reinterpret_cast(&pSource->v)); + // Shift R&0xFF0000, G&0xFF00, B&0xFF, A&0xFF000000 + vTemp = _mm_and_ps(vTemp,g_XMMaskDec4); + // a is unsigned! Flip the bit to convert the order to signed + vTemp = _mm_xor_ps(vTemp,g_XMXorDec4); + // Convert to floating point numbers + vTemp = _mm_cvtepi32_ps(reinterpret_cast(&vTemp)[0]); + // RGB + 0, A + 0x80000000.f to undo the signed order. + vTemp = _mm_add_ps(vTemp,g_XMAddDec4); + // Convert 0-255 to 0.0f-1.0f + vTemp = _mm_mul_ps(vTemp,DecN4Mul); + return vTemp; +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMLoadDec4 +( + CONST XMDEC4* pSource +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V; + UINT Element; + static CONST UINT SignExtend[] = {0x00000000, 0xFFFFFC00}; + static CONST UINT SignExtendW[] = {0x00000000, 0xFFFFFFFC}; + + XMASSERT(pSource); + XMASSERT((pSource->v & 0x3FF) != 0x200); + XMASSERT(((pSource->v >> 10) & 0x3FF) != 0x200); + XMASSERT(((pSource->v >> 20) & 0x3FF) != 0x200); + XMASSERT(((pSource->v >> 30) & 0x3) != 0x2); + + Element = pSource->v & 0x3FF; + V.vector4_f32[0] = (FLOAT)(SHORT)(Element | SignExtend[Element >> 9]); + Element = (pSource->v >> 10) & 0x3FF; + V.vector4_f32[1] = (FLOAT)(SHORT)(Element | SignExtend[Element >> 9]); + Element = (pSource->v >> 20) & 0x3FF; + V.vector4_f32[2] = (FLOAT)(SHORT)(Element | SignExtend[Element >> 9]); + Element = pSource->v >> 30; + V.vector4_f32[3] = (FLOAT)(SHORT)(Element | SignExtendW[Element >> 1]); + + return V; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT((pSource->v & 0x3FF) != 0x200); + XMASSERT(((pSource->v >> 10) & 0x3FF) != 0x200); + XMASSERT(((pSource->v >> 20) & 0x3FF) != 0x200); + XMASSERT(((pSource->v >> 30) & 0x3) != 0x2); + XMASSERT(pSource); + // Splat the color in all four entries + XMVECTOR vTemp = _mm_load_ps1(reinterpret_cast(&pSource->v)); + // Shift R&0xFF0000, G&0xFF00, B&0xFF, A&0xFF000000 + vTemp = _mm_and_ps(vTemp,g_XMMaskDec4); + // a is unsigned! Flip the bit to convert the order to signed + vTemp = _mm_xor_ps(vTemp,g_XMXorDec4); + // Convert to floating point numbers + vTemp = _mm_cvtepi32_ps(reinterpret_cast(&vTemp)[0]); + // RGB + 0, A + 0x80000000.f to undo the signed order. + vTemp = _mm_add_ps(vTemp,g_XMAddDec4); + // Convert 0-255 to 0.0f-1.0f + vTemp = _mm_mul_ps(vTemp,g_XMMulDec4); + return vTemp; +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMLoadUByteN4 +( + CONST XMUBYTEN4* pSource +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V; + + XMASSERT(pSource); + + V.vector4_f32[0] = (FLOAT)pSource->x / 255.0f; + V.vector4_f32[1] = (FLOAT)pSource->y / 255.0f; + V.vector4_f32[2] = (FLOAT)pSource->z / 255.0f; + V.vector4_f32[3] = (FLOAT)pSource->w / 255.0f; + + return V; + +#elif defined(_XM_SSE_INTRINSICS_) + static const XMVECTORF32 LoadUByteN4Mul = {1.0f/255.0f,1.0f/(255.0f*256.0f),1.0f/(255.0f*65536.0f),1.0f/(255.0f*65536.0f*256.0f)}; + XMASSERT(pSource); + // Splat the color in all four entries (x,z,y,w) + XMVECTOR vTemp = _mm_load1_ps(reinterpret_cast(&pSource->x)); + // Mask x&0ff,y&0xff00,z&0xff0000,w&0xff000000 + vTemp = _mm_and_ps(vTemp,g_XMMaskByte4); + // w is signed! Flip the bits to convert the order to unsigned + vTemp = _mm_xor_ps(vTemp,g_XMFlipW); + // Convert to floating point numbers + vTemp = _mm_cvtepi32_ps(reinterpret_cast(&vTemp)[0]); + // w + 0x80 to complete the conversion + vTemp = _mm_add_ps(vTemp,g_XMAddUDec4); + // Fix y, z and w because they are too large + vTemp = _mm_mul_ps(vTemp,LoadUByteN4Mul); + return vTemp; +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMLoadUByte4 +( + CONST XMUBYTE4* pSource +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V; + + XMASSERT(pSource); + + V.vector4_f32[0] = (FLOAT)pSource->x; + V.vector4_f32[1] = (FLOAT)pSource->y; + V.vector4_f32[2] = (FLOAT)pSource->z; + V.vector4_f32[3] = (FLOAT)pSource->w; + + return V; + +#elif defined(_XM_SSE_INTRINSICS_) + static const XMVECTORF32 LoadUByte4Mul = {1.0f,1.0f/256.0f,1.0f/65536.0f,1.0f/(65536.0f*256.0f)}; + XMASSERT(pSource); + // Splat the color in all four entries (x,z,y,w) + XMVECTOR vTemp = _mm_load1_ps(reinterpret_cast(&pSource->x)); + // Mask x&0ff,y&0xff00,z&0xff0000,w&0xff000000 + vTemp = _mm_and_ps(vTemp,g_XMMaskByte4); + // w is signed! Flip the bits to convert the order to unsigned + vTemp = _mm_xor_ps(vTemp,g_XMFlipW); + // Convert to floating point numbers + vTemp = _mm_cvtepi32_ps(reinterpret_cast(&vTemp)[0]); + // w + 0x80 to complete the conversion + vTemp = _mm_add_ps(vTemp,g_XMAddUDec4); + // Fix y, z and w because they are too large + vTemp = _mm_mul_ps(vTemp,LoadUByte4Mul); + return vTemp; +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMLoadByteN4 +( + CONST XMBYTEN4* pSource +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V; + + XMASSERT(pSource); + XMASSERT(pSource->x != -128); + XMASSERT(pSource->y != -128); + XMASSERT(pSource->z != -128); + XMASSERT(pSource->w != -128); + + V.vector4_f32[0] = (FLOAT)pSource->x / 127.0f; + V.vector4_f32[1] = (FLOAT)pSource->y / 127.0f; + V.vector4_f32[2] = (FLOAT)pSource->z / 127.0f; + V.vector4_f32[3] = (FLOAT)pSource->w / 127.0f; + + return V; + +#elif defined(_XM_SSE_INTRINSICS_) + static const XMVECTORF32 LoadByteN4Mul = {1.0f/127.0f,1.0f/(127.0f*256.0f),1.0f/(127.0f*65536.0f),1.0f/(127.0f*65536.0f*256.0f)}; + XMASSERT(pSource); + XMASSERT(pSource->x != -128); + XMASSERT(pSource->y != -128); + XMASSERT(pSource->z != -128); + XMASSERT(pSource->w != -128); + // Splat the color in all four entries (x,z,y,w) + XMVECTOR vTemp = _mm_load1_ps(reinterpret_cast(&pSource->x)); + // Mask x&0ff,y&0xff00,z&0xff0000,w&0xff000000 + vTemp = _mm_and_ps(vTemp,g_XMMaskByte4); + // x,y and z are unsigned! Flip the bits to convert the order to signed + vTemp = _mm_xor_ps(vTemp,g_XMXorByte4); + // Convert to floating point numbers + vTemp = _mm_cvtepi32_ps(reinterpret_cast(&vTemp)[0]); + // x, y and z - 0x80 to complete the conversion + vTemp = _mm_add_ps(vTemp,g_XMAddByte4); + // Fix y, z and w because they are too large + vTemp = _mm_mul_ps(vTemp,LoadByteN4Mul); + return vTemp; +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMLoadByte4 +( + CONST XMBYTE4* pSource +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V; + + XMASSERT(pSource); + XMASSERT(pSource->x != -128); + XMASSERT(pSource->y != -128); + XMASSERT(pSource->z != -128); + XMASSERT(pSource->w != -128); + + V.vector4_f32[0] = (FLOAT)pSource->x; + V.vector4_f32[1] = (FLOAT)pSource->y; + V.vector4_f32[2] = (FLOAT)pSource->z; + V.vector4_f32[3] = (FLOAT)pSource->w; + + return V; + +#elif defined(_XM_SSE_INTRINSICS_) + static const XMVECTORF32 LoadByte4Mul = {1.0f,1.0f/256.0f,1.0f/65536.0f,1.0f/(65536.0f*256.0f)}; + XMASSERT(pSource); + XMASSERT(pSource->x != -128); + XMASSERT(pSource->y != -128); + XMASSERT(pSource->z != -128); + XMASSERT(pSource->w != -128); + // Splat the color in all four entries (x,z,y,w) + XMVECTOR vTemp = _mm_load1_ps(reinterpret_cast(&pSource->x)); + // Mask x&0ff,y&0xff00,z&0xff0000,w&0xff000000 + vTemp = _mm_and_ps(vTemp,g_XMMaskByte4); + // x,y and z are unsigned! Flip the bits to convert the order to signed + vTemp = _mm_xor_ps(vTemp,g_XMXorByte4); + // Convert to floating point numbers + vTemp = _mm_cvtepi32_ps(reinterpret_cast(&vTemp)[0]); + // x, y and z - 0x80 to complete the conversion + vTemp = _mm_add_ps(vTemp,g_XMAddByte4); + // Fix y, z and w because they are too large + vTemp = _mm_mul_ps(vTemp,LoadByte4Mul); + return vTemp; +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMLoadUNibble4 +( + CONST XMUNIBBLE4* pSource +) +{ +#if defined(_XM_SSE_INTRINSICS_) && !defined(_XM_NO_INTRINSICS_) + static const XMVECTORI32 UNibble4And = {0xF,0xF0,0xF00,0xF000}; + static const XMVECTORF32 UNibble4Mul = {1.0f,1.0f/16.f,1.0f/256.f,1.0f/4096.f}; + XMASSERT(pSource); + // Get the 32 bit value and splat it + XMVECTOR vResult = _mm_load_ps1(reinterpret_cast(&pSource->v)); + // Mask off x, y and z + vResult = _mm_and_ps(vResult,UNibble4And); + // Convert to float + vResult = _mm_cvtepi32_ps(reinterpret_cast(&vResult)[0]); + // Normalize x, y, and z + vResult = _mm_mul_ps(vResult,UNibble4Mul); + return vResult; +#else + XMVECTOR V; + UINT Element; + + XMASSERT(pSource); + + Element = pSource->v & 0xF; + V.vector4_f32[0] = (FLOAT)Element; + Element = (pSource->v >> 4) & 0xF; + V.vector4_f32[1] = (FLOAT)Element; + Element = (pSource->v >> 8) & 0xF; + V.vector4_f32[2] = (FLOAT)Element; + Element = (pSource->v >> 12) & 0xF; + V.vector4_f32[3] = (FLOAT)Element; + + return V; +#endif // !_XM_SSE_INTRISICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMLoadU555 +( + CONST XMU555* pSource +) +{ +#if defined(_XM_SSE_INTRINSICS_) && !defined(_XM_NO_INTRINSICS_) + static const XMVECTORI32 U555And = {0x1F,0x1F<<5,0x1F<<10,0x8000}; + static const XMVECTORF32 U555Mul = {1.0f,1.0f/32.f,1.0f/1024.f,1.0f/32768.f}; + XMASSERT(pSource); + // Get the 32 bit value and splat it + XMVECTOR vResult = _mm_load_ps1(reinterpret_cast(&pSource->v)); + // Mask off x, y and z + vResult = _mm_and_ps(vResult,U555And); + // Convert to float + vResult = _mm_cvtepi32_ps(reinterpret_cast(&vResult)[0]); + // Normalize x, y, and z + vResult = _mm_mul_ps(vResult,U555Mul); + return vResult; +#else + XMVECTOR V; + UINT Element; + + XMASSERT(pSource); + + Element = pSource->v & 0x1F; + V.vector4_f32[0] = (FLOAT)Element; + Element = (pSource->v >> 5) & 0x1F; + V.vector4_f32[1] = (FLOAT)Element; + Element = (pSource->v >> 10) & 0x1F; + V.vector4_f32[2] = (FLOAT)Element; + Element = (pSource->v >> 15) & 0x1; + V.vector4_f32[3] = (FLOAT)Element; + + return V; +#endif // !_XM_SSE_INTRISICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMLoadColor +( + CONST XMCOLOR* pSource +) +{ +#if defined(_XM_NO_INTRINSICS_) + XMASSERT(pSource); + { + // INT -> Float conversions are done in one instruction. + // UINT -> Float calls a runtime function. Keep in INT + INT iColor = (INT)(pSource->c); + XMVECTOR vColor = { + (FLOAT)((iColor >> 16) & 0xFF) * (1.0f/255.0f), + (FLOAT)((iColor >> 8) & 0xFF) * (1.0f/255.0f), + (FLOAT)(iColor & 0xFF) * (1.0f/255.0f), + (FLOAT)((iColor >> 24) & 0xFF) * (1.0f/255.0f) + }; + return vColor; + } +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pSource); + // Splat the color in all four entries + __m128i vInt = _mm_set1_epi32(pSource->c); + // Shift R&0xFF0000, G&0xFF00, B&0xFF, A&0xFF000000 + vInt = _mm_and_si128(vInt,g_XMMaskA8R8G8B8); + // a is unsigned! Flip the bit to convert the order to signed + vInt = _mm_xor_si128(vInt,g_XMFlipA8R8G8B8); + // Convert to floating point numbers + XMVECTOR vTemp = _mm_cvtepi32_ps(vInt); + // RGB + 0, A + 0x80000000.f to undo the signed order. + vTemp = _mm_add_ps(vTemp,g_XMFixAA8R8G8B8); + // Convert 0-255 to 0.0f-1.0f + return _mm_mul_ps(vTemp,g_XMNormalizeA8R8G8B8); +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMMATRIX XMLoadFloat3x3 +( + CONST XMFLOAT3X3* pSource +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMMATRIX M; + + XMASSERT(pSource); + + M.r[0].vector4_f32[0] = pSource->m[0][0]; + M.r[0].vector4_f32[1] = pSource->m[0][1]; + M.r[0].vector4_f32[2] = pSource->m[0][2]; + M.r[0].vector4_f32[3] = 0.0f; + + M.r[1].vector4_f32[0] = pSource->m[1][0]; + M.r[1].vector4_f32[1] = pSource->m[1][1]; + M.r[1].vector4_f32[2] = pSource->m[1][2]; + M.r[1].vector4_f32[3] = 0.0f; + + M.r[2].vector4_f32[0] = pSource->m[2][0]; + M.r[2].vector4_f32[1] = pSource->m[2][1]; + M.r[2].vector4_f32[2] = pSource->m[2][2]; + M.r[2].vector4_f32[3] = 0.0f; + + M.r[3].vector4_f32[0] = 0.0f; + M.r[3].vector4_f32[1] = 0.0f; + M.r[3].vector4_f32[2] = 0.0f; + M.r[3].vector4_f32[3] = 1.0f; + + return M; + +#elif defined(_XM_SSE_INTRINSICS_) + XMMATRIX M; + XMVECTOR V1, V2, V3, Z, T1, T2, T3, T4, T5; + + Z = _mm_setzero_ps(); + + XMASSERT(pSource); + + V1 = _mm_loadu_ps( &pSource->m[0][0] ); + V2 = _mm_loadu_ps( &pSource->m[1][1] ); + V3 = _mm_load_ss( &pSource->m[2][2] ); + + T1 = _mm_unpackhi_ps( V1, Z ); + T2 = _mm_unpacklo_ps( V2, Z ); + T3 = _mm_shuffle_ps( V3, T2, _MM_SHUFFLE( 0, 1, 0, 0 ) ); + T4 = _mm_movehl_ps( T2, T3 ); + T5 = _mm_movehl_ps( Z, T1 ); + + M.r[0] = _mm_movelh_ps( V1, T1 ); + M.r[1] = _mm_add_ps( T4, T5 ); + M.r[2] = _mm_shuffle_ps( V2, V3, _MM_SHUFFLE(1, 0, 3, 2) ); + M.r[3] = g_XMIdentityR3; + + return M; +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMMATRIX XMLoadFloat4x3 +( + CONST XMFLOAT4X3* pSource +) +{ +#if defined(_XM_NO_INTRINSICS_) + XMMATRIX M; + XMASSERT(pSource); + + ((UINT *)(&M.r[0].vector4_f32[0]))[0] = ((const UINT *)(&pSource->m[0][0]))[0]; + ((UINT *)(&M.r[0].vector4_f32[1]))[0] = ((const UINT *)(&pSource->m[0][1]))[0]; + ((UINT *)(&M.r[0].vector4_f32[2]))[0] = ((const UINT *)(&pSource->m[0][2]))[0]; + M.r[0].vector4_f32[3] = 0.0f; + + ((UINT *)(&M.r[1].vector4_f32[0]))[0] = ((const UINT *)(&pSource->m[1][0]))[0]; + ((UINT *)(&M.r[1].vector4_f32[1]))[0] = ((const UINT *)(&pSource->m[1][1]))[0]; + ((UINT *)(&M.r[1].vector4_f32[2]))[0] = ((const UINT *)(&pSource->m[1][2]))[0]; + M.r[1].vector4_f32[3] = 0.0f; + + ((UINT *)(&M.r[2].vector4_f32[0]))[0] = ((const UINT *)(&pSource->m[2][0]))[0]; + ((UINT *)(&M.r[2].vector4_f32[1]))[0] = ((const UINT *)(&pSource->m[2][1]))[0]; + ((UINT *)(&M.r[2].vector4_f32[2]))[0] = ((const UINT *)(&pSource->m[2][2]))[0]; + M.r[2].vector4_f32[3] = 0.0f; + + ((UINT *)(&M.r[3].vector4_f32[0]))[0] = ((const UINT *)(&pSource->m[3][0]))[0]; + ((UINT *)(&M.r[3].vector4_f32[1]))[0] = ((const UINT *)(&pSource->m[3][1]))[0]; + ((UINT *)(&M.r[3].vector4_f32[2]))[0] = ((const UINT *)(&pSource->m[3][2]))[0]; + M.r[3].vector4_f32[3] = 1.0f; + + return M; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pSource); + // Use unaligned load instructions to + // load the 12 floats + // vTemp1 = x1,y1,z1,x2 + XMVECTOR vTemp1 = _mm_loadu_ps(&pSource->m[0][0]); + // vTemp2 = y2,z2,x3,y3 + XMVECTOR vTemp2 = _mm_loadu_ps(&pSource->m[1][1]); + // vTemp4 = z3,x4,y4,z4 + XMVECTOR vTemp4 = _mm_loadu_ps(&pSource->m[2][2]); + // vTemp3 = x3,y3,z3,z3 + XMVECTOR vTemp3 = _mm_shuffle_ps(vTemp2,vTemp4,_MM_SHUFFLE(0,0,3,2)); + // vTemp2 = y2,z2,x2,x2 + vTemp2 = _mm_shuffle_ps(vTemp2,vTemp1,_MM_SHUFFLE(3,3,1,0)); + // vTemp2 = x2,y2,z2,z2 + vTemp2 = _mm_shuffle_ps(vTemp2,vTemp2,_MM_SHUFFLE(1,1,0,2)); + // vTemp1 = x1,y1,z1,0 + vTemp1 = _mm_and_ps(vTemp1,g_XMMask3); + // vTemp2 = x2,y2,z2,0 + vTemp2 = _mm_and_ps(vTemp2,g_XMMask3); + // vTemp3 = x3,y3,z3,0 + vTemp3 = _mm_and_ps(vTemp3,g_XMMask3); + // vTemp4i = x4,y4,z4,0 + __m128i vTemp4i = _mm_srli_si128(reinterpret_cast(&vTemp4)[0],32/8); + // vTemp4i = x4,y4,z4,1.0f + vTemp4i = _mm_or_si128(vTemp4i,g_XMIdentityR3); + XMMATRIX M(vTemp1, + vTemp2, + vTemp3, + reinterpret_cast(&vTemp4i)[0]); + return M; +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMMATRIX XMLoadFloat4x3A +( + CONST XMFLOAT4X3A* pSource +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMMATRIX M; + + XMASSERT(pSource); + XMASSERT(((UINT_PTR)pSource & 0xF) == 0); + + M.r[0].vector4_f32[0] = pSource->m[0][0]; + M.r[0].vector4_f32[1] = pSource->m[0][1]; + M.r[0].vector4_f32[2] = pSource->m[0][2]; + M.r[0].vector4_f32[3] = 0.0f; + + M.r[1].vector4_f32[0] = pSource->m[1][0]; + M.r[1].vector4_f32[1] = pSource->m[1][1]; + M.r[1].vector4_f32[2] = pSource->m[1][2]; + M.r[1].vector4_f32[3] = 0.0f; + + M.r[2].vector4_f32[0] = pSource->m[2][0]; + M.r[2].vector4_f32[1] = pSource->m[2][1]; + M.r[2].vector4_f32[2] = pSource->m[2][2]; + M.r[2].vector4_f32[3] = 0.0f; + + M.r[3].vector4_f32[0] = pSource->m[3][0]; + M.r[3].vector4_f32[1] = pSource->m[3][1]; + M.r[3].vector4_f32[2] = pSource->m[3][2]; + M.r[3].vector4_f32[3] = 1.0f; + + return M; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pSource); + // Use aligned load instructions to + // load the 12 floats + // vTemp1 = x1,y1,z1,x2 + XMVECTOR vTemp1 = _mm_load_ps(&pSource->m[0][0]); + // vTemp2 = y2,z2,x3,y3 + XMVECTOR vTemp2 = _mm_load_ps(&pSource->m[1][1]); + // vTemp4 = z3,x4,y4,z4 + XMVECTOR vTemp4 = _mm_load_ps(&pSource->m[2][2]); + // vTemp3 = x3,y3,z3,z3 + XMVECTOR vTemp3 = _mm_shuffle_ps(vTemp2,vTemp4,_MM_SHUFFLE(0,0,3,2)); + // vTemp2 = y2,z2,x2,x2 + vTemp2 = _mm_shuffle_ps(vTemp2,vTemp1,_MM_SHUFFLE(3,3,1,0)); + // vTemp2 = x2,y2,z2,z2 + vTemp2 = _mm_shuffle_ps(vTemp2,vTemp2,_MM_SHUFFLE(1,1,0,2)); + // vTemp1 = x1,y1,z1,0 + vTemp1 = _mm_and_ps(vTemp1,g_XMMask3); + // vTemp2 = x2,y2,z2,0 + vTemp2 = _mm_and_ps(vTemp2,g_XMMask3); + // vTemp3 = x3,y3,z3,0 + vTemp3 = _mm_and_ps(vTemp3,g_XMMask3); + // vTemp4i = x4,y4,z4,0 + __m128i vTemp4i = _mm_srli_si128(reinterpret_cast(&vTemp4)[0],32/8); + // vTemp4i = x4,y4,z4,1.0f + vTemp4i = _mm_or_si128(vTemp4i,g_XMIdentityR3); + XMMATRIX M(vTemp1, + vTemp2, + vTemp3, + reinterpret_cast(&vTemp4i)[0]); + return M; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMMATRIX XMLoadFloat4x4 +( + CONST XMFLOAT4X4* pSource +) +{ +#if defined(_XM_NO_INTRINSICS_) + XMMATRIX M; + XMASSERT(pSource); + + ((UINT *)(&M.r[0].vector4_f32[0]))[0] = ((const UINT *)(&pSource->m[0][0]))[0]; + ((UINT *)(&M.r[0].vector4_f32[1]))[0] = ((const UINT *)(&pSource->m[0][1]))[0]; + ((UINT *)(&M.r[0].vector4_f32[2]))[0] = ((const UINT *)(&pSource->m[0][2]))[0]; + ((UINT *)(&M.r[0].vector4_f32[3]))[0] = ((const UINT *)(&pSource->m[0][3]))[0]; + + ((UINT *)(&M.r[1].vector4_f32[0]))[0] = ((const UINT *)(&pSource->m[1][0]))[0]; + ((UINT *)(&M.r[1].vector4_f32[1]))[0] = ((const UINT *)(&pSource->m[1][1]))[0]; + ((UINT *)(&M.r[1].vector4_f32[2]))[0] = ((const UINT *)(&pSource->m[1][2]))[0]; + ((UINT *)(&M.r[1].vector4_f32[3]))[0] = ((const UINT *)(&pSource->m[1][3]))[0]; + + ((UINT *)(&M.r[2].vector4_f32[0]))[0] = ((const UINT *)(&pSource->m[2][0]))[0]; + ((UINT *)(&M.r[2].vector4_f32[1]))[0] = ((const UINT *)(&pSource->m[2][1]))[0]; + ((UINT *)(&M.r[2].vector4_f32[2]))[0] = ((const UINT *)(&pSource->m[2][2]))[0]; + ((UINT *)(&M.r[2].vector4_f32[3]))[0] = ((const UINT *)(&pSource->m[2][3]))[0]; + + ((UINT *)(&M.r[3].vector4_f32[0]))[0] = ((const UINT *)(&pSource->m[3][0]))[0]; + ((UINT *)(&M.r[3].vector4_f32[1]))[0] = ((const UINT *)(&pSource->m[3][1]))[0]; + ((UINT *)(&M.r[3].vector4_f32[2]))[0] = ((const UINT *)(&pSource->m[3][2]))[0]; + ((UINT *)(&M.r[3].vector4_f32[3]))[0] = ((const UINT *)(&pSource->m[3][3]))[0]; + + return M; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pSource); + XMMATRIX M; + + M.r[0] = _mm_loadu_ps( &pSource->_11 ); + M.r[1] = _mm_loadu_ps( &pSource->_21 ); + M.r[2] = _mm_loadu_ps( &pSource->_31 ); + M.r[3] = _mm_loadu_ps( &pSource->_41 ); + + return M; +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMMATRIX XMLoadFloat4x4A +( + CONST XMFLOAT4X4A* pSource +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMMATRIX M; + + XMASSERT(pSource); + XMASSERT(((UINT_PTR)pSource & 0xF) == 0); + + M.r[0].vector4_f32[0] = pSource->m[0][0]; + M.r[0].vector4_f32[1] = pSource->m[0][1]; + M.r[0].vector4_f32[2] = pSource->m[0][2]; + M.r[0].vector4_f32[3] = pSource->m[0][3]; + + M.r[1].vector4_f32[0] = pSource->m[1][0]; + M.r[1].vector4_f32[1] = pSource->m[1][1]; + M.r[1].vector4_f32[2] = pSource->m[1][2]; + M.r[1].vector4_f32[3] = pSource->m[1][3]; + + M.r[2].vector4_f32[0] = pSource->m[2][0]; + M.r[2].vector4_f32[1] = pSource->m[2][1]; + M.r[2].vector4_f32[2] = pSource->m[2][2]; + M.r[2].vector4_f32[3] = pSource->m[2][3]; + + M.r[3].vector4_f32[0] = pSource->m[3][0]; + M.r[3].vector4_f32[1] = pSource->m[3][1]; + M.r[3].vector4_f32[2] = pSource->m[3][2]; + M.r[3].vector4_f32[3] = pSource->m[3][3]; + + return M; + +#elif defined(_XM_SSE_INTRINSICS_) + XMMATRIX M; + + XMASSERT(pSource); + + M.r[0] = _mm_load_ps( &pSource->_11 ); + M.r[1] = _mm_load_ps( &pSource->_21 ); + M.r[2] = _mm_load_ps( &pSource->_31 ); + M.r[3] = _mm_load_ps( &pSource->_41 ); + + return M; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +/**************************************************************************** + * + * Vector and matrix store operations + * + ****************************************************************************/ + +XMFINLINE VOID XMStoreInt +( + UINT* pDestination, + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMASSERT(pDestination); + XMASSERT(((UINT_PTR)pDestination & 3) == 0); + + *pDestination = XMVectorGetIntX( V ); + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pDestination); + XMASSERT(((UINT_PTR)pDestination & 3) == 0); + + _mm_store_ss( (float*)pDestination, V ); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreFloat +( + FLOAT* pDestination, + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMASSERT(pDestination); + XMASSERT(((UINT_PTR)pDestination & 3) == 0); + + *pDestination = XMVectorGetX( V ); + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pDestination); + XMASSERT(((UINT_PTR)pDestination & 3) == 0); + + _mm_store_ss( pDestination, V ); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreInt2 +( + UINT* pDestination, + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMASSERT(pDestination); + XMASSERT(((UINT_PTR)pDestination & 3) == 0); + + pDestination[0] = V.vector4_u32[0]; + pDestination[1] = V.vector4_u32[1]; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pDestination); + XMASSERT(((UINT_PTR)pDestination & 3) == 0); + + XMVECTOR T = _mm_shuffle_ps( V, V, _MM_SHUFFLE( 1, 1, 1, 1 ) ); + _mm_store_ss( (float*)&pDestination[0], V ); + _mm_store_ss( (float*)&pDestination[1], T ); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreInt2A +( + UINT* pDestination, + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMASSERT(pDestination); + XMASSERT(((UINT_PTR)pDestination & 0xF) == 0); + + pDestination[0] = V.vector4_u32[0]; + pDestination[1] = V.vector4_u32[1]; + +#elif defined(_XM_SSE_INTRINSICS_) + + XMASSERT(pDestination); + XMASSERT(((UINT_PTR)pDestination & 0xF) == 0); + + _mm_storel_epi64( (__m128i*)pDestination, reinterpret_cast(&V)[0] ); + +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreFloat2 +( + XMFLOAT2* pDestination, + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMASSERT(pDestination); + XMASSERT(((UINT_PTR)pDestination & 3) == 0); + + pDestination->x = V.vector4_f32[0]; + pDestination->y = V.vector4_f32[1]; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pDestination); + XMASSERT(((UINT_PTR)pDestination & 3) == 0); + + XMVECTOR T = _mm_shuffle_ps( V, V, _MM_SHUFFLE( 1, 1, 1, 1 ) ); + _mm_store_ss( &pDestination->x, V ); + _mm_store_ss( &pDestination->y, T ); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreFloat2A +( + XMFLOAT2A* pDestination, + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMASSERT(pDestination); + XMASSERT(((UINT_PTR)pDestination & 0xF) == 0); + + pDestination->x = V.vector4_f32[0]; + pDestination->y = V.vector4_f32[1]; + +#elif defined(_XM_SSE_INTRINSICS_) + + XMASSERT(pDestination); + XMASSERT(((UINT_PTR)pDestination & 0xF) == 0); + + _mm_storel_epi64( (__m128i*)pDestination, reinterpret_cast(&V)[0] ); + +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreHalf2 +( + XMHALF2* pDestination, + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMASSERT(pDestination); + + pDestination->x = XMConvertFloatToHalf(V.vector4_f32[0]); + pDestination->y = XMConvertFloatToHalf(V.vector4_f32[1]); + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pDestination); + pDestination->x = XMConvertFloatToHalf(XMVectorGetX(V)); + pDestination->y = XMConvertFloatToHalf(XMVectorGetY(V)); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreShortN2 +( + XMSHORTN2* pDestination, + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR N; + static CONST XMVECTORF32 Scale = {32767.0f, 32767.0f, 32767.0f, 32767.0f}; + + XMASSERT(pDestination); + + N = XMVectorClamp(V, g_XMNegativeOne.v, g_XMOne.v); + N = XMVectorMultiply(N, Scale.v); + N = XMVectorRound(N); + + pDestination->x = (SHORT)N.vector4_f32[0]; + pDestination->y = (SHORT)N.vector4_f32[1]; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pDestination); + static CONST XMVECTORF32 Scale = {32767.0f, 32767.0f, 32767.0f, 32767.0f}; + + XMVECTOR vResult = _mm_max_ps(V,g_XMNegativeOne); + vResult = _mm_min_ps(vResult,g_XMOne); + vResult = _mm_mul_ps(vResult,Scale); + __m128i vResulti = _mm_cvtps_epi32(vResult); + vResulti = _mm_packs_epi32(vResulti,vResulti); + _mm_store_ss(reinterpret_cast(&pDestination->x),reinterpret_cast(&vResulti)[0]); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreShort2 +( + XMSHORT2* pDestination, + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR N; + static CONST XMVECTOR Min = {-32767.0f, -32767.0f, -32767.0f, -32767.0f}; + static CONST XMVECTOR Max = {32767.0f, 32767.0f, 32767.0f, 32767.0f}; + + XMASSERT(pDestination); + + N = XMVectorClamp(V, Min, Max); + N = XMVectorRound(N); + + pDestination->x = (SHORT)N.vector4_f32[0]; + pDestination->y = (SHORT)N.vector4_f32[1]; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pDestination); + static CONST XMVECTORF32 Min = {-32767.0f, -32767.0f, -32767.0f, -32767.0f}; + static CONST XMVECTORF32 Max = {32767.0f, 32767.0f, 32767.0f, 32767.0f}; + // Bounds check + XMVECTOR vResult = _mm_max_ps(V,Min); + vResult = _mm_min_ps(vResult,Max); + // Convert to int with rounding + __m128i vInt = _mm_cvtps_epi32(vResult); + // Pack the ints into shorts + vInt = _mm_packs_epi32(vInt,vInt); + _mm_store_ss(reinterpret_cast(&pDestination->x),reinterpret_cast(&vInt)[0]); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreUShortN2 +( + XMUSHORTN2* pDestination, + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR N; + static CONST XMVECTORF32 Scale = {65535.0f, 65535.0f, 65535.0f, 65535.0f}; + + XMASSERT(pDestination); + + N = XMVectorClamp(V, XMVectorZero(), g_XMOne.v); + N = XMVectorMultiplyAdd(N, Scale.v, g_XMOneHalf.v); + N = XMVectorTruncate(N); + + pDestination->x = (SHORT)N.vector4_f32[0]; + pDestination->y = (SHORT)N.vector4_f32[1]; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pDestination); + static CONST XMVECTORF32 Scale = {65535.0f, 65535.0f, 65535.0f, 65535.0f}; + // Bounds check + XMVECTOR vResult = _mm_max_ps(V,g_XMZero); + vResult = _mm_min_ps(vResult,g_XMOne); + vResult = _mm_mul_ps(vResult,Scale); + // Convert to int with rounding + __m128i vInt = _mm_cvtps_epi32(vResult); + // Since the SSE pack instruction clamps using signed rules, + // manually extract the values to store them to memory + pDestination->x = static_cast(_mm_extract_epi16(vInt,0)); + pDestination->y = static_cast(_mm_extract_epi16(vInt,2)); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreUShort2 +( + XMUSHORT2* pDestination, + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR N; + static CONST XMVECTOR Max = {65535.0f, 65535.0f, 65535.0f, 65535.0f}; + + XMASSERT(pDestination); + + N = XMVectorClamp(V, XMVectorZero(), Max); + N = XMVectorRound(N); + + pDestination->x = (SHORT)N.vector4_f32[0]; + pDestination->y = (SHORT)N.vector4_f32[1]; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pDestination); + static CONST XMVECTORF32 Max = {65535.0f, 65535.0f, 65535.0f, 65535.0f}; + // Bounds check + XMVECTOR vResult = _mm_max_ps(V,g_XMZero); + vResult = _mm_min_ps(vResult,Max); + // Convert to int with rounding + __m128i vInt = _mm_cvtps_epi32(vResult); + // Since the SSE pack instruction clamps using signed rules, + // manually extract the values to store them to memory + pDestination->x = static_cast(_mm_extract_epi16(vInt,0)); + pDestination->y = static_cast(_mm_extract_epi16(vInt,2)); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreInt3 +( + UINT* pDestination, + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMASSERT(pDestination); + XMASSERT(((UINT_PTR)pDestination & 3) == 0); + + pDestination[0] = V.vector4_u32[0]; + pDestination[1] = V.vector4_u32[1]; + pDestination[2] = V.vector4_u32[2]; + +#elif defined(_XM_SSE_INTRINSICS_) + + XMASSERT(pDestination); + XMASSERT(((UINT_PTR)pDestination & 3) == 0); + + XMVECTOR T1 = _mm_shuffle_ps(V,V,_MM_SHUFFLE(1,1,1,1)); + XMVECTOR T2 = _mm_shuffle_ps(V,V,_MM_SHUFFLE(2,2,2,2)); + _mm_store_ss( (float*)pDestination, V ); + _mm_store_ss( (float*)&pDestination[1], T1 ); + _mm_store_ss( (float*)&pDestination[2], T2 ); + +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreInt3A +( + UINT* pDestination, + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMASSERT(pDestination); + XMASSERT(((UINT_PTR)pDestination & 0xF) == 0); + + pDestination[0] = V.vector4_u32[0]; + pDestination[1] = V.vector4_u32[1]; + pDestination[2] = V.vector4_u32[2]; + +#elif defined(_XM_SSE_INTRINSICS_) + + XMASSERT(pDestination); + XMASSERT(((UINT_PTR)pDestination & 0xF) == 0); + + XMVECTOR T = _mm_shuffle_ps(V,V,_MM_SHUFFLE(2,2,2,2)); + _mm_storel_epi64( (__m128i*)pDestination, reinterpret_cast(&V)[0] ); + _mm_store_ss( (float*)&pDestination[2], T ); + +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreFloat3 +( + XMFLOAT3* pDestination, + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMASSERT(pDestination); + XMASSERT(((UINT_PTR)pDestination & 3) == 0); + + pDestination->x = V.vector4_f32[0]; + pDestination->y = V.vector4_f32[1]; + pDestination->z = V.vector4_f32[2]; + +#elif defined(_XM_SSE_INTRINSICS_) + + XMASSERT(pDestination); + XMASSERT(((UINT_PTR)pDestination & 3) == 0); + + XMVECTOR T1 = _mm_shuffle_ps(V,V,_MM_SHUFFLE(1,1,1,1)); + XMVECTOR T2 = _mm_shuffle_ps(V,V,_MM_SHUFFLE(2,2,2,2)); + _mm_store_ss( &pDestination->x, V ); + _mm_store_ss( &pDestination->y, T1 ); + _mm_store_ss( &pDestination->z, T2 ); + +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreFloat3A +( + XMFLOAT3A* pDestination, + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMASSERT(pDestination); + XMASSERT(((UINT_PTR)pDestination & 0xF) == 0); + + pDestination->x = V.vector4_f32[0]; + pDestination->y = V.vector4_f32[1]; + pDestination->z = V.vector4_f32[2]; + +#elif defined(_XM_SSE_INTRINSICS_) + + XMASSERT(pDestination); + XMASSERT(((UINT_PTR)pDestination & 0xF) == 0); + + XMVECTOR T = _mm_shuffle_ps(V,V,_MM_SHUFFLE(2,2,2,2)); + _mm_storel_epi64( (__m128i*)pDestination, reinterpret_cast(&V)[0] ); + _mm_store_ss( &pDestination->z, T ); + +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreUHenDN3 +( + XMUHENDN3* pDestination, + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR N; + static CONST XMVECTORF32 Scale = {2047.0f, 2047.0f, 1023.0f, 0.0f}; + + XMASSERT(pDestination); + + N = XMVectorClamp(V, XMVectorZero(), g_XMOne.v); + N = XMVectorMultiply(N, Scale.v); + + pDestination->v = (((UINT)N.vector4_f32[2] & 0x3FF) << 22) | + (((UINT)N.vector4_f32[1] & 0x7FF) << 11) | + (((UINT)N.vector4_f32[0] & 0x7FF)); + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pDestination); + static const XMVECTORF32 ScaleUHenDN3 = {2047.0f, 2047.0f*2048.0f,1023.0f*(2048.0f*2048.0f)/2.0f,1.0f}; + static const XMVECTORI32 MaskUHenDN3 = {0x7FF,0x7FF<<11,0x3FF<<(22-1),0}; + // Clamp to bounds + XMVECTOR vResult = _mm_max_ps(V,g_XMZero); + vResult = _mm_min_ps(vResult,g_XMOne); + // Scale by multiplication + vResult = _mm_mul_ps(vResult,ScaleUHenDN3); + // Convert to int + __m128i vResulti = _mm_cvttps_epi32(vResult); + // Mask off any fraction + vResulti = _mm_and_si128(vResulti,MaskUHenDN3); + // Do a horizontal or of 3 entries + __m128i vResulti2 = _mm_shuffle_epi32(vResulti,_MM_SHUFFLE(0,3,2,1)); + // i = x|y + vResulti = _mm_or_si128(vResulti,vResulti2); + // Move Z to the x position + vResulti2 = _mm_shuffle_epi32(vResulti2,_MM_SHUFFLE(0,3,2,1)); + // Add Z to itself to perform a single bit left shift + vResulti2 = _mm_add_epi32(vResulti2,vResulti2); + // i = x|y|z + vResulti = _mm_or_si128(vResulti,vResulti2); + _mm_store_ss(reinterpret_cast(&pDestination->v),reinterpret_cast(&vResulti)[0]); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreUHenD3 +( + XMUHEND3* pDestination, + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR N; + static CONST XMVECTOR Max = {2047.0f, 2047.0f, 1023.0f, 0.0f}; + + XMASSERT(pDestination); + + N = XMVectorClamp(V, XMVectorZero(), Max); + + pDestination->v = (((UINT)N.vector4_f32[2] & 0x3FF) << 22) | + (((UINT)N.vector4_f32[1] & 0x7FF) << 11) | + (((UINT)N.vector4_f32[0] & 0x7FF)); + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pDestination); + static const XMVECTORF32 MaxUHenD3 = { 2047.0f, 2047.0f, 1023.0f, 1.0f}; + static const XMVECTORF32 ScaleUHenD3 = {1.0f, 2048.0f,(2048.0f*2048.0f)/2.0f,1.0f}; + static const XMVECTORI32 MaskUHenD3 = {0x7FF,0x7FF<<11,0x3FF<<(22-1),0}; + // Clamp to bounds + XMVECTOR vResult = _mm_max_ps(V,g_XMZero); + vResult = _mm_min_ps(vResult,MaxUHenD3); + // Scale by multiplication + vResult = _mm_mul_ps(vResult,ScaleUHenD3); + // Convert to int + __m128i vResulti = _mm_cvttps_epi32(vResult); + // Mask off any fraction + vResulti = _mm_and_si128(vResulti,MaskUHenD3); + // Do a horizontal or of 3 entries + __m128i vResulti2 = _mm_shuffle_epi32(vResulti,_MM_SHUFFLE(0,3,2,1)); + // i = x|y + vResulti = _mm_or_si128(vResulti,vResulti2); + // Move Z to the x position + vResulti2 = _mm_shuffle_epi32(vResulti2,_MM_SHUFFLE(0,3,2,1)); + // Add Z to itself to perform a single bit left shift + vResulti2 = _mm_add_epi32(vResulti2,vResulti2); + // i = x|y|z + vResulti = _mm_or_si128(vResulti,vResulti2); + _mm_store_ss(reinterpret_cast(&pDestination->v),reinterpret_cast(&vResulti)[0]); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreHenDN3 +( + XMHENDN3* pDestination, + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR N; + static CONST XMVECTORF32 Scale = {1023.0f, 1023.0f, 511.0f, 1.0f}; + + XMASSERT(pDestination); + + N = XMVectorClamp(V, g_XMNegativeOne.v, g_XMOne.v); + N = XMVectorMultiply(N, Scale.v); + + pDestination->v = (((INT)N.vector4_f32[2] & 0x3FF) << 22) | + (((INT)N.vector4_f32[1] & 0x7FF) << 11) | + (((INT)N.vector4_f32[0] & 0x7FF)); + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pDestination); + static const XMVECTORF32 ScaleHenDN3 = {1023.0f, 1023.0f*2048.0f,511.0f*(2048.0f*2048.0f),1.0f}; + // Clamp to bounds + XMVECTOR vResult = _mm_max_ps(V,g_XMNegativeOne); + vResult = _mm_min_ps(vResult,g_XMOne); + // Scale by multiplication + vResult = _mm_mul_ps(vResult,ScaleHenDN3); + // Convert to int + __m128i vResulti = _mm_cvttps_epi32(vResult); + // Mask off any fraction + vResulti = _mm_and_si128(vResulti,g_XMMaskHenD3); + // Do a horizontal or of all 4 entries + vResult = _mm_shuffle_ps(reinterpret_cast(&vResulti)[0],reinterpret_cast(&vResulti)[0],_MM_SHUFFLE(0,3,2,1)); + vResulti = _mm_or_si128(vResulti,reinterpret_cast(&vResult)[0]); + vResult = _mm_shuffle_ps(vResult,vResult,_MM_SHUFFLE(0,3,2,1)); + vResulti = _mm_or_si128(vResulti,reinterpret_cast(&vResult)[0]); + _mm_store_ss(reinterpret_cast(&pDestination->v),reinterpret_cast(&vResulti)[0]); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreHenD3 +( + XMHEND3* pDestination, + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR N; + static CONST XMVECTOR Min = {-1023.0f, -1023.0f, -511.0f, -1.0f}; + static CONST XMVECTOR Max = {1023.0f, 1023.0f, 511.0f, 1.0f}; + + XMASSERT(pDestination); + + N = XMVectorClamp(V, Min, Max); + + pDestination->v = (((INT)N.vector4_f32[2] & 0x3FF) << 22) | + (((INT)N.vector4_f32[1] & 0x7FF) << 11) | + (((INT)N.vector4_f32[0] & 0x7FF)); + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pDestination); + static const XMVECTORF32 MinHenD3 = {-1023.0f,-1023.0f,-511.0f,-1.0f}; + static const XMVECTORF32 MaxHenD3 = { 1023.0f, 1023.0f, 511.0f, 1.0f}; + static const XMVECTORF32 ScaleHenD3 = {1.0f, 2048.0f,(2048.0f*2048.0f),1.0f}; + // Clamp to bounds + XMVECTOR vResult = _mm_max_ps(V,MinHenD3); + vResult = _mm_min_ps(vResult,MaxHenD3); + // Scale by multiplication + vResult = _mm_mul_ps(vResult,ScaleHenD3); + // Convert to int + __m128i vResulti = _mm_cvttps_epi32(vResult); + // Mask off any fraction + vResulti = _mm_and_si128(vResulti,g_XMMaskHenD3); + // Do a horizontal or of all 4 entries + vResult = _mm_shuffle_ps(reinterpret_cast(&vResulti)[0],reinterpret_cast(&vResulti)[0],_MM_SHUFFLE(0,3,2,1)); + vResulti = _mm_or_si128(vResulti,reinterpret_cast(&vResult)[0]); + vResult = _mm_shuffle_ps(vResult,vResult,_MM_SHUFFLE(0,3,2,1)); + vResulti = _mm_or_si128(vResulti,reinterpret_cast(&vResult)[0]); + _mm_store_ss(reinterpret_cast(&pDestination->v),reinterpret_cast(&vResulti)[0]); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreUDHenN3 +( + XMUDHENN3* pDestination, + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR N; + static CONST XMVECTORF32 Scale = {1023.0f, 2047.0f, 2047.0f, 0.0f}; + + XMASSERT(pDestination); + + N = XMVectorClamp(V, XMVectorZero(), g_XMOne.v); + N = XMVectorMultiply(N, Scale.v); + + pDestination->v = (((UINT)N.vector4_f32[2] & 0x7FF) << 21) | + (((UINT)N.vector4_f32[1] & 0x7FF) << 10) | + (((UINT)N.vector4_f32[0] & 0x3FF)); + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pDestination); + static const XMVECTORF32 ScaleUDHenN3 = {1023.0f,2047.0f*1024.0f,2047.0f*(1024.0f*2048.0f)/2.0f,1.0f}; + static const XMVECTORI32 MaskUDHenN3 = {0x3FF,0x7FF<<10,0x7FF<<(21-1),0}; + // Clamp to bounds + XMVECTOR vResult = _mm_max_ps(V,g_XMZero); + vResult = _mm_min_ps(vResult,g_XMOne); + // Scale by multiplication + vResult = _mm_mul_ps(vResult,ScaleUDHenN3); + // Convert to int + __m128i vResulti = _mm_cvttps_epi32(vResult); + // Mask off any fraction + vResulti = _mm_and_si128(vResulti,MaskUDHenN3); + // Do a horizontal or of 3 entries + __m128i vResulti2 = _mm_shuffle_epi32(vResulti,_MM_SHUFFLE(0,3,2,1)); + // i = x|y + vResulti = _mm_or_si128(vResulti,vResulti2); + // Move Z to the x position + vResulti2 = _mm_shuffle_epi32(vResulti2,_MM_SHUFFLE(0,3,2,1)); + // Add Z to itself to perform a single bit left shift + vResulti2 = _mm_add_epi32(vResulti2,vResulti2); + // i = x|y|z + vResulti = _mm_or_si128(vResulti,vResulti2); + _mm_store_ss(reinterpret_cast(&pDestination->v),reinterpret_cast(&vResulti)[0]); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreUDHen3 +( + XMUDHEN3* pDestination, + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR N; + static CONST XMVECTOR Max = {1023.0f, 2047.0f, 2047.0f, 0.0f}; + + XMASSERT(pDestination); + + N = XMVectorClamp(V, XMVectorZero(), Max); + + pDestination->v = (((UINT)N.vector4_f32[2] & 0x7FF) << 21) | + (((UINT)N.vector4_f32[1] & 0x7FF) << 10) | + (((UINT)N.vector4_f32[0] & 0x3FF)); + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pDestination); + static const XMVECTORF32 MaxUDHen3 = { 1023.0f, 2047.0f, 2047.0f, 1.0f}; + static const XMVECTORF32 ScaleUDHen3 = {1.0f, 1024.0f,(1024.0f*2048.0f)/2.0f,1.0f}; + static const XMVECTORI32 MaskUDHen3 = {0x3FF,0x7FF<<10,0x7FF<<(21-1),0}; + // Clamp to bounds + XMVECTOR vResult = _mm_max_ps(V,g_XMZero); + vResult = _mm_min_ps(vResult,MaxUDHen3); + // Scale by multiplication + vResult = _mm_mul_ps(vResult,ScaleUDHen3); + // Convert to int + __m128i vResulti = _mm_cvttps_epi32(vResult); + // Mask off any fraction + vResulti = _mm_and_si128(vResulti,MaskUDHen3); + // Do a horizontal or of 3 entries + __m128i vResulti2 = _mm_shuffle_epi32(vResulti,_MM_SHUFFLE(0,3,2,1)); + // i = x|y + vResulti = _mm_or_si128(vResulti,vResulti2); + // Move Z to the x position + vResulti2 = _mm_shuffle_epi32(vResulti2,_MM_SHUFFLE(0,3,2,1)); + // Add Z to itself to perform a single bit left shift + vResulti2 = _mm_add_epi32(vResulti2,vResulti2); + // i = x|y|z + vResulti = _mm_or_si128(vResulti,vResulti2); + _mm_store_ss(reinterpret_cast(&pDestination->v),reinterpret_cast(&vResulti)[0]); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreDHenN3 +( + XMDHENN3* pDestination, + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR N; + static CONST XMVECTORF32 Scale = {511.0f, 1023.0f, 1023.0f, 1.0f}; + + XMASSERT(pDestination); + + N = XMVectorClamp(V, g_XMNegativeOne.v, g_XMOne.v); + N = XMVectorMultiply(N, Scale.v); + + pDestination->v = (((INT)N.vector4_f32[2] & 0x7FF) << 21) | + (((INT)N.vector4_f32[1] & 0x7FF) << 10) | + (((INT)N.vector4_f32[0] & 0x3FF)); + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pDestination); + static const XMVECTORF32 ScaleDHenN3 = {511.0f, 1023.0f*1024.0f,1023.0f*(1024.0f*2048.0f),1.0f}; + // Clamp to bounds + XMVECTOR vResult = _mm_max_ps(V,g_XMNegativeOne); + vResult = _mm_min_ps(vResult,g_XMOne); + // Scale by multiplication + vResult = _mm_mul_ps(vResult,ScaleDHenN3); + // Convert to int + __m128i vResulti = _mm_cvttps_epi32(vResult); + // Mask off any fraction + vResulti = _mm_and_si128(vResulti,g_XMMaskDHen3); + // Do a horizontal or of all 4 entries + vResult = _mm_shuffle_ps(reinterpret_cast(&vResulti)[0],reinterpret_cast(&vResulti)[0],_MM_SHUFFLE(0,3,2,1)); + vResulti = _mm_or_si128(vResulti,reinterpret_cast(&vResult)[0]); + vResult = _mm_shuffle_ps(vResult,vResult,_MM_SHUFFLE(0,3,2,1)); + vResulti = _mm_or_si128(vResulti,reinterpret_cast(&vResult)[0]); + _mm_store_ss(reinterpret_cast(&pDestination->v),reinterpret_cast(&vResulti)[0]); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreDHen3 +( + XMDHEN3* pDestination, + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR N; + static CONST XMVECTOR Min = {-511.0f, -1023.0f, -1023.0f, -1.0f}; + static CONST XMVECTOR Max = {511.0f, 1023.0f, 1023.0f, 1.0f}; + + XMASSERT(pDestination); + + N = XMVectorClamp(V, Min, Max); + + pDestination->v = (((INT)N.vector4_f32[2] & 0x7FF) << 21) | + (((INT)N.vector4_f32[1] & 0x7FF) << 10) | + (((INT)N.vector4_f32[0] & 0x3FF)); + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pDestination); + static const XMVECTORF32 MinDHen3 = {-511.0f,-1023.0f,-1023.0f,-1.0f}; + static const XMVECTORF32 MaxDHen3 = { 511.0f, 1023.0f, 1023.0f, 1.0f}; + static const XMVECTORF32 ScaleDHen3 = {1.0f, 1024.0f,(1024.0f*2048.0f),1.0f}; + // Clamp to bounds + XMVECTOR vResult = _mm_max_ps(V,MinDHen3); + vResult = _mm_min_ps(vResult,MaxDHen3); + // Scale by multiplication + vResult = _mm_mul_ps(vResult,ScaleDHen3); + // Convert to int + __m128i vResulti = _mm_cvttps_epi32(vResult); + // Mask off any fraction + vResulti = _mm_and_si128(vResulti,g_XMMaskDHen3); + // Do a horizontal or of all 4 entries + vResult = _mm_shuffle_ps(reinterpret_cast(&vResulti)[0],reinterpret_cast(&vResulti)[0],_MM_SHUFFLE(0,3,2,1)); + vResulti = _mm_or_si128(vResulti,reinterpret_cast(&vResult)[0]); + vResult = _mm_shuffle_ps(vResult,vResult,_MM_SHUFFLE(0,3,2,1)); + vResulti = _mm_or_si128(vResulti,reinterpret_cast(&vResult)[0]); + _mm_store_ss(reinterpret_cast(&pDestination->v),reinterpret_cast(&vResulti)[0]); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreU565 +( + XMU565* pDestination, + FXMVECTOR V +) +{ +#if defined(_XM_SSE_INTRINSICS_) && !defined(_XM_NO_INTRINSICS_) + XMASSERT(pDestination); + static CONST XMVECTORF32 Max = {31.0f, 63.0f, 31.0f, 0.0f}; + // Bounds check + XMVECTOR vResult = _mm_max_ps(V,g_XMZero); + vResult = _mm_min_ps(vResult,Max); + // Convert to int with rounding + __m128i vInt = _mm_cvtps_epi32(vResult); + // No SSE operations will write to 16-bit values, so we have to extract them manually + USHORT x = static_cast(_mm_extract_epi16(vInt,0)); + USHORT y = static_cast(_mm_extract_epi16(vInt,2)); + USHORT z = static_cast(_mm_extract_epi16(vInt,4)); + pDestination->v = ((z & 0x1F) << 11) | + ((y & 0x3F) << 5) | + ((x & 0x1F)); +#else + XMVECTOR N; + static CONST XMVECTORF32 Max = {31.0f, 63.0f, 31.0f, 0.0f}; + + XMASSERT(pDestination); + + N = XMVectorClamp(V, XMVectorZero(), Max.v); + N = XMVectorRound(N); + + pDestination->v = (((USHORT)N.vector4_f32[2] & 0x1F) << 11) | + (((USHORT)N.vector4_f32[1] & 0x3F) << 5) | + (((USHORT)N.vector4_f32[0] & 0x1F)); +#endif !_XM_SSE_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreFloat3PK +( + XMFLOAT3PK* pDestination, + FXMVECTOR V +) +{ + _DECLSPEC_ALIGN_16_ UINT IValue[4]; + UINT I, Sign, j; + UINT Result[3]; + + XMASSERT(pDestination); + + XMStoreFloat3A( (XMFLOAT3A*)&IValue, V ); + + // X & Y Channels (5-bit exponent, 6-bit mantissa) + for(j=0; j < 2; ++j) + { + Sign = IValue[j] & 0x80000000; + I = IValue[j] & 0x7FFFFFFF; + + if ((I & 0x7F800000) == 0x7F800000) + { + // INF or NAN + Result[j] = 0x7c0; + if (( I & 0x7FFFFF ) != 0) + { + Result[j] = 0x7c0 | (((I>>17)|(I>11)|(I>>6)|(I))&0x3f); + } + else if ( Sign ) + { + // -INF is clamped to 0 since 3PK is positive only + Result[j] = 0; + } + } + else if ( Sign ) + { + // 3PK is positive only, so clamp to zero + Result[j] = 0; + } + else if (I > 0x477E0000U) + { + // The number is too large to be represented as a float11, set to max + Result[j] = 0x7BF; + } + else + { + if (I < 0x38800000U) + { + // The number is too small to be represented as a normalized float11 + // Convert it to a denormalized value. + UINT Shift = 113U - (I >> 23U); + I = (0x800000U | (I & 0x7FFFFFU)) >> Shift; + } + else + { + // Rebias the exponent to represent the value as a normalized float11 + I += 0xC8000000U; + } + + Result[j] = ((I + 0xFFFFU + ((I >> 17U) & 1U)) >> 17U)&0x7ffU; + } + } + + // Z Channel (5-bit exponent, 5-bit mantissa) + Sign = IValue[2] & 0x80000000; + I = IValue[2] & 0x7FFFFFFF; + + if ((I & 0x7F800000) == 0x7F800000) + { + // INF or NAN + Result[2] = 0x3e0; + if ( I & 0x7FFFFF ) + { + Result[2] = 0x3e0 | (((I>>18)|(I>13)|(I>>3)|(I))&0x1f); + } + else if ( Sign ) + { + // -INF is clamped to 0 since 3PK is positive only + Result[2] = 0; + } + } + else if ( Sign ) + { + // 3PK is positive only, so clamp to zero + Result[2] = 0; + } + else if (I > 0x477C0000U) + { + // The number is too large to be represented as a float10, set to max + Result[2] = 0x3df; + } + else + { + if (I < 0x38800000U) + { + // The number is too small to be represented as a normalized float10 + // Convert it to a denormalized value. + UINT Shift = 113U - (I >> 23U); + I = (0x800000U | (I & 0x7FFFFFU)) >> Shift; + } + else + { + // Rebias the exponent to represent the value as a normalized float10 + I += 0xC8000000U; + } + + Result[2] = ((I + 0x1FFFFU + ((I >> 18U) & 1U)) >> 18U)&0x3ffU; + } + + // Pack Result into memory + pDestination->v = (Result[0] & 0x7ff) + | ( (Result[1] & 0x7ff) << 11 ) + | ( (Result[2] & 0x3ff) << 22 ); +} + + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreFloat3SE +( + XMFLOAT3SE* pDestination, + FXMVECTOR V +) +{ + _DECLSPEC_ALIGN_16_ UINT IValue[4]; + UINT I, Sign, j, T; + UINT Frac[3]; + UINT Exp[3]; + + + XMASSERT(pDestination); + + XMStoreFloat3A( (XMFLOAT3A*)&IValue, V ); + + // X, Y, Z Channels (5-bit exponent, 9-bit mantissa) + for(j=0; j < 3; ++j) + { + Sign = IValue[j] & 0x80000000; + I = IValue[j] & 0x7FFFFFFF; + + if ((I & 0x7F800000) == 0x7F800000) + { + // INF or NAN + Exp[j] = 0x1f; + if (( I & 0x7FFFFF ) != 0) + { + Frac[j] = ((I>>14)|(I>5)|(I))&0x1ff; + } + else if ( Sign ) + { + // -INF is clamped to 0 since 3SE is positive only + Exp[j] = Frac[j] = 0; + } + } + else if ( Sign ) + { + // 3SE is positive only, so clamp to zero + Exp[j] = Frac[j] = 0; + } + else if (I > 0x477FC000U) + { + // The number is too large, set to max + Exp[j] = 0x1e; + Frac[j] = 0x1ff; + } + else + { + if (I < 0x38800000U) + { + // The number is too small to be represented as a normalized float11 + // Convert it to a denormalized value. + UINT Shift = 113U - (I >> 23U); + I = (0x800000U | (I & 0x7FFFFFU)) >> Shift; + } + else + { + // Rebias the exponent to represent the value as a normalized float11 + I += 0xC8000000U; + } + + T = ((I + 0x1FFFU + ((I >> 14U) & 1U)) >> 14U)&0x3fffU; + + Exp[j] = (T & 0x3E00) >> 9; + Frac[j] = T & 0x1ff; + } + } + + // Adjust to a shared exponent + T = XMMax( Exp[0], XMMax( Exp[1], Exp[2] ) ); + + Frac[0] = Frac[0] >> (T - Exp[0]); + Frac[1] = Frac[1] >> (T - Exp[1]); + Frac[2] = Frac[2] >> (T - Exp[2]); + + // Store packed into memory + pDestination->xm = Frac[0]; + pDestination->ym = Frac[1]; + pDestination->zm = Frac[2]; + pDestination->e = T; +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreInt4 +( + UINT* pDestination, + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMASSERT(pDestination); + + pDestination[0] = V.vector4_u32[0]; + pDestination[1] = V.vector4_u32[1]; + pDestination[2] = V.vector4_u32[2]; + pDestination[3] = V.vector4_u32[3]; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pDestination); + + _mm_storeu_si128( (__m128i*)pDestination, reinterpret_cast(&V)[0] ); + +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreInt4A +( + UINT* pDestination, + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMASSERT(pDestination); + XMASSERT(((UINT_PTR)pDestination & 0xF) == 0); + + pDestination[0] = V.vector4_u32[0]; + pDestination[1] = V.vector4_u32[1]; + pDestination[2] = V.vector4_u32[2]; + pDestination[3] = V.vector4_u32[3]; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pDestination); + XMASSERT(((UINT_PTR)pDestination & 0xF) == 0); + + _mm_store_si128( (__m128i*)pDestination, reinterpret_cast(&V)[0] ); + +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreInt4NC +( + UINT* pDestination, + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMASSERT(pDestination); + XMASSERT(((UINT_PTR)pDestination & 3) == 0); + + pDestination[0] = V.vector4_u32[0]; + pDestination[1] = V.vector4_u32[1]; + pDestination[2] = V.vector4_u32[2]; + pDestination[3] = V.vector4_u32[3]; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pDestination); + XMASSERT(((UINT_PTR)pDestination & 3) == 0); + + _mm_storeu_si128( (__m128i*)pDestination, reinterpret_cast(&V)[0] ); + +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreFloat4 +( + XMFLOAT4* pDestination, + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMASSERT(pDestination); + + pDestination->x = V.vector4_f32[0]; + pDestination->y = V.vector4_f32[1]; + pDestination->z = V.vector4_f32[2]; + pDestination->w = V.vector4_f32[3]; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pDestination); + + _mm_storeu_ps( &pDestination->x, V ); + +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreFloat4A +( + XMFLOAT4A* pDestination, + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMASSERT(pDestination); + XMASSERT(((UINT_PTR)pDestination & 0xF) == 0); + + pDestination->x = V.vector4_f32[0]; + pDestination->y = V.vector4_f32[1]; + pDestination->z = V.vector4_f32[2]; + pDestination->w = V.vector4_f32[3]; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pDestination); + XMASSERT(((UINT_PTR)pDestination & 0xF) == 0); + + _mm_store_ps( &pDestination->x, V ); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreFloat4NC +( + XMFLOAT4* pDestination, + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMASSERT(pDestination); + XMASSERT(((UINT_PTR)pDestination & 3) == 0); + + pDestination->x = V.vector4_f32[0]; + pDestination->y = V.vector4_f32[1]; + pDestination->z = V.vector4_f32[2]; + pDestination->w = V.vector4_f32[3]; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pDestination); + XMASSERT(((UINT_PTR)pDestination & 3) == 0); + + _mm_storeu_ps( &pDestination->x, V ); + +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreHalf4 +( + XMHALF4* pDestination, + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMASSERT(pDestination); + + pDestination->x = XMConvertFloatToHalf(V.vector4_f32[0]); + pDestination->y = XMConvertFloatToHalf(V.vector4_f32[1]); + pDestination->z = XMConvertFloatToHalf(V.vector4_f32[2]); + pDestination->w = XMConvertFloatToHalf(V.vector4_f32[3]); + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pDestination); + pDestination->x = XMConvertFloatToHalf(XMVectorGetX(V)); + pDestination->y = XMConvertFloatToHalf(XMVectorGetY(V)); + pDestination->z = XMConvertFloatToHalf(XMVectorGetZ(V)); + pDestination->w = XMConvertFloatToHalf(XMVectorGetW(V)); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreShortN4 +( + XMSHORTN4* pDestination, + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR N; + static CONST XMVECTORF32 Scale = {32767.0f, 32767.0f, 32767.0f, 32767.0f}; + + XMASSERT(pDestination); + + N = XMVectorClamp(V, g_XMNegativeOne.v, g_XMOne.v); + N = XMVectorMultiply(N, Scale.v); + N = XMVectorRound(N); + + pDestination->x = (SHORT)N.vector4_f32[0]; + pDestination->y = (SHORT)N.vector4_f32[1]; + pDestination->z = (SHORT)N.vector4_f32[2]; + pDestination->w = (SHORT)N.vector4_f32[3]; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pDestination); + static CONST XMVECTORF32 Scale = {32767.0f, 32767.0f, 32767.0f, 32767.0f}; + + XMVECTOR vResult = _mm_max_ps(V,g_XMNegativeOne); + vResult = _mm_min_ps(vResult,g_XMOne); + vResult = _mm_mul_ps(vResult,Scale); + __m128i vResulti = _mm_cvtps_epi32(vResult); + vResulti = _mm_packs_epi32(vResulti,vResulti); + _mm_store_sd(reinterpret_cast(&pDestination->x),reinterpret_cast(&vResulti)[0]); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreShort4 +( + XMSHORT4* pDestination, + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR N; + static CONST XMVECTOR Min = {-32767.0f, -32767.0f, -32767.0f, -32767.0f}; + static CONST XMVECTOR Max = {32767.0f, 32767.0f, 32767.0f, 32767.0f}; + + XMASSERT(pDestination); + + N = XMVectorClamp(V, Min, Max); + N = XMVectorRound(N); + + pDestination->x = (SHORT)N.vector4_f32[0]; + pDestination->y = (SHORT)N.vector4_f32[1]; + pDestination->z = (SHORT)N.vector4_f32[2]; + pDestination->w = (SHORT)N.vector4_f32[3]; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pDestination); + static CONST XMVECTORF32 Min = {-32767.0f, -32767.0f, -32767.0f, -32767.0f}; + static CONST XMVECTORF32 Max = {32767.0f, 32767.0f, 32767.0f, 32767.0f}; + // Bounds check + XMVECTOR vResult = _mm_max_ps(V,Min); + vResult = _mm_min_ps(vResult,Max); + // Convert to int with rounding + __m128i vInt = _mm_cvtps_epi32(vResult); + // Pack the ints into shorts + vInt = _mm_packs_epi32(vInt,vInt); + _mm_store_sd(reinterpret_cast(&pDestination->x),reinterpret_cast(&vInt)[0]); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreUShortN4 +( + XMUSHORTN4* pDestination, + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR N; + static CONST XMVECTORF32 Scale = {65535.0f, 65535.0f, 65535.0f, 65535.0f}; + + XMASSERT(pDestination); + + N = XMVectorClamp(V, XMVectorZero(), g_XMOne.v); + N = XMVectorMultiplyAdd(N, Scale.v, g_XMOneHalf.v); + N = XMVectorTruncate(N); + + pDestination->x = (SHORT)N.vector4_f32[0]; + pDestination->y = (SHORT)N.vector4_f32[1]; + pDestination->z = (SHORT)N.vector4_f32[2]; + pDestination->w = (SHORT)N.vector4_f32[3]; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pDestination); + static CONST XMVECTORF32 Scale = {65535.0f, 65535.0f, 65535.0f, 65535.0f}; + // Bounds check + XMVECTOR vResult = _mm_max_ps(V,g_XMZero); + vResult = _mm_min_ps(vResult,g_XMOne); + vResult = _mm_mul_ps(vResult,Scale); + // Convert to int with rounding + __m128i vInt = _mm_cvtps_epi32(vResult); + // Since the SSE pack instruction clamps using signed rules, + // manually extract the values to store them to memory + pDestination->x = static_cast(_mm_extract_epi16(vInt,0)); + pDestination->y = static_cast(_mm_extract_epi16(vInt,2)); + pDestination->z = static_cast(_mm_extract_epi16(vInt,4)); + pDestination->w = static_cast(_mm_extract_epi16(vInt,6)); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreUShort4 +( + XMUSHORT4* pDestination, + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR N; + static CONST XMVECTOR Max = {65535.0f, 65535.0f, 65535.0f, 65535.0f}; + + XMASSERT(pDestination); + + N = XMVectorClamp(V, XMVectorZero(), Max); + N = XMVectorRound(N); + + pDestination->x = (SHORT)N.vector4_f32[0]; + pDestination->y = (SHORT)N.vector4_f32[1]; + pDestination->z = (SHORT)N.vector4_f32[2]; + pDestination->w = (SHORT)N.vector4_f32[3]; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pDestination); + static CONST XMVECTORF32 Max = {65535.0f, 65535.0f, 65535.0f, 65535.0f}; + // Bounds check + XMVECTOR vResult = _mm_max_ps(V,g_XMZero); + vResult = _mm_min_ps(vResult,Max); + // Convert to int with rounding + __m128i vInt = _mm_cvtps_epi32(vResult); + // Since the SSE pack instruction clamps using signed rules, + // manually extract the values to store them to memory + pDestination->x = static_cast(_mm_extract_epi16(vInt,0)); + pDestination->y = static_cast(_mm_extract_epi16(vInt,2)); + pDestination->z = static_cast(_mm_extract_epi16(vInt,4)); + pDestination->w = static_cast(_mm_extract_epi16(vInt,6)); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreXIcoN4 +( + XMXICON4* pDestination, + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR N; + static CONST XMVECTORF32 Min = {-1.0f, -1.0f, -1.0f, 0.0f}; + static CONST XMVECTORF32 Scale = {524287.0f, 524287.0f, 524287.0f, 15.0f}; + + XMASSERT(pDestination); + + N = XMVectorClamp(V, Min.v, g_XMOne.v); + N = XMVectorMultiply(N, Scale.v); + N = XMVectorRound(N); + + pDestination->v = ((UINT64)N.vector4_f32[3] << 60) | + (((INT64)N.vector4_f32[2] & 0xFFFFF) << 40) | + (((INT64)N.vector4_f32[1] & 0xFFFFF) << 20) | + (((INT64)N.vector4_f32[0] & 0xFFFFF)); + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pDestination); + // Note: Masks are x,w,y and z + static const XMVECTORF32 MinXIcoN4 = {-1.0f, 0.0f,-1.0f,-1.0f}; + static const XMVECTORF32 ScaleXIcoN4 = {524287.0f,15.0f*4096.0f*65536.0f*0.5f,524287.0f*4096.0f,524287.0f}; + static const XMVECTORI32 MaskXIcoN4 = {0xFFFFF,0xF<<((60-32)-1),0xFFFFF000,0xFFFFF}; + + // Clamp to bounds + XMVECTOR vResult = _mm_shuffle_ps(V,V,_MM_SHUFFLE(2,1,3,0)); + vResult = _mm_max_ps(vResult,MinXIcoN4); + vResult = _mm_min_ps(vResult,g_XMOne); + // Scale by multiplication + vResult = _mm_mul_ps(vResult,ScaleXIcoN4); + // Convert to integer (w is unsigned) + __m128i vResulti = _mm_cvttps_epi32(vResult); + // Mask off unused bits + vResulti = _mm_and_si128(vResulti,MaskXIcoN4); + // Isolate Y + __m128i vResulti2 = _mm_and_si128(vResulti,g_XMMaskY); + // Double Y (Really W) to fixup for unsigned conversion + vResulti = _mm_add_epi32(vResulti,vResulti2); + // Shift y and z to straddle the 32-bit boundary + vResulti2 = _mm_srli_si128(vResulti,(64+12)/8); + // Shift it into place + vResulti2 = _mm_slli_si128(vResulti2,20/8); + // i = x|y<<20|z<<40|w<<60 + vResulti = _mm_or_si128(vResulti,vResulti2); + _mm_store_sd(reinterpret_cast(&pDestination->v),reinterpret_cast(&vResulti)[0]); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreXIco4 +( + XMXICO4* pDestination, + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR N; + static CONST XMVECTORF32 Min = {-524287.0f, -524287.0f, -524287.0f, 0.0f}; + static CONST XMVECTORF32 Max = {524287.0f, 524287.0f, 524287.0f, 15.0f}; + + XMASSERT(pDestination); + N = XMVectorClamp(V, Min.v, Max.v); + pDestination->v = ((UINT64)N.vector4_f32[3] << 60) | + (((INT64)N.vector4_f32[2] & 0xFFFFF) << 40) | + (((INT64)N.vector4_f32[1] & 0xFFFFF) << 20) | + (((INT64)N.vector4_f32[0] & 0xFFFFF)); + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pDestination); + // Note: Masks are x,w,y and z + static const XMVECTORF32 MinXIco4 = {-524287.0f, 0.0f,-524287.0f,-524287.0f}; + static const XMVECTORF32 MaxXIco4 = { 524287.0f,15.0f, 524287.0f, 524287.0f}; + static const XMVECTORF32 ScaleXIco4 = {1.0f,4096.0f*65536.0f*0.5f,4096.0f,1.0f}; + static const XMVECTORI32 MaskXIco4 = {0xFFFFF,0xF<<((60-1)-32),0xFFFFF000,0xFFFFF}; + // Clamp to bounds + XMVECTOR vResult = _mm_shuffle_ps(V,V,_MM_SHUFFLE(2,1,3,0)); + vResult = _mm_max_ps(vResult,MinXIco4); + vResult = _mm_min_ps(vResult,MaxXIco4); + // Scale by multiplication + vResult = _mm_mul_ps(vResult,ScaleXIco4); + // Convert to int + __m128i vResulti = _mm_cvttps_epi32(vResult); + // Mask off any fraction + vResulti = _mm_and_si128(vResulti,MaskXIco4); + // Isolate Y + __m128i vResulti2 = _mm_and_si128(vResulti,g_XMMaskY); + // Double Y (Really W) to fixup for unsigned conversion + vResulti = _mm_add_epi32(vResulti,vResulti2); + // Shift y and z to straddle the 32-bit boundary + vResulti2 = _mm_srli_si128(vResulti,(64+12)/8); + // Shift it into place + vResulti2 = _mm_slli_si128(vResulti2,20/8); + // i = x|y<<20|z<<40|w<<60 + vResulti = _mm_or_si128(vResulti,vResulti2); + _mm_store_sd(reinterpret_cast(&pDestination->v),reinterpret_cast(&vResulti)[0]); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreUIcoN4 +( + XMUICON4* pDestination, + FXMVECTOR V +) +{ + #define XM_URange ((FLOAT)(1 << 20)) + #define XM_URangeDiv2 ((FLOAT)(1 << 19)) + #define XM_UMaxXYZ ((FLOAT)((1 << 20) - 1)) + #define XM_UMaxW ((FLOAT)((1 << 4) - 1)) + #define XM_ScaleXYZ (-(FLOAT)((1 << 20) - 1) / XM_PACK_FACTOR) + #define XM_ScaleW (-(FLOAT)((1 << 4) - 1) / XM_PACK_FACTOR) + #define XM_Scale (-1.0f / XM_PACK_FACTOR) + #define XM_Offset (3.0f) + +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR N; + static CONST XMVECTORF32 Scale = {1048575.0f, 1048575.0f, 1048575.0f, 15.0f}; + + XMASSERT(pDestination); + + N = XMVectorClamp(V, XMVectorZero(), g_XMOne.v); + N = XMVectorMultiplyAdd(N, Scale.v, g_XMOneHalf.v); + + pDestination->v = ((UINT64)N.vector4_f32[3] << 60) | + (((UINT64)N.vector4_f32[2] & 0xFFFFF) << 40) | + (((UINT64)N.vector4_f32[1] & 0xFFFFF) << 20) | + (((UINT64)N.vector4_f32[0] & 0xFFFFF)); + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pDestination); + // Note: Masks are x,w,y and z + static const XMVECTORF32 ScaleUIcoN4 = {1048575.0f,15.0f*4096.0f*65536.0f,1048575.0f*4096.0f,1048575.0f}; + static const XMVECTORI32 MaskUIcoN4 = {0xFFFFF,0xF<<(60-32),0xFFFFF000,0xFFFFF}; + static const XMVECTORF32 AddUIcoN4 = {0.0f,-32768.0f*65536.0f,-32768.0f*65536.0f,0.0f}; + // Clamp to bounds + XMVECTOR vResult = _mm_shuffle_ps(V,V,_MM_SHUFFLE(2,1,3,0)); + vResult = _mm_max_ps(vResult,g_XMZero); + vResult = _mm_min_ps(vResult,g_XMOne); + // Scale by multiplication + vResult = _mm_mul_ps(vResult,ScaleUIcoN4); + // Adjust for unsigned entries + vResult = _mm_add_ps(vResult,AddUIcoN4); + // Convert to int + __m128i vResulti = _mm_cvttps_epi32(vResult); + // Fix the signs on the unsigned entries + vResulti = _mm_xor_si128(vResulti,g_XMFlipYZ); + // Mask off any fraction + vResulti = _mm_and_si128(vResulti,MaskUIcoN4); + // Shift y and z to straddle the 32-bit boundary + __m128i vResulti2 = _mm_srli_si128(vResulti,(64+12)/8); + // Shift it into place + vResulti2 = _mm_slli_si128(vResulti2,20/8); + // i = x|y<<20|z<<40|w<<60 + vResulti = _mm_or_si128(vResulti,vResulti2); + _mm_store_sd(reinterpret_cast(&pDestination->v),reinterpret_cast(&vResulti)[0]); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ + + #undef XM_URange + #undef XM_URangeDiv2 + #undef XM_UMaxXYZ + #undef XM_UMaxW + #undef XM_ScaleXYZ + #undef XM_ScaleW + #undef XM_Scale + #undef XM_Offset +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreUIco4 +( + XMUICO4* pDestination, + FXMVECTOR V +) +{ + #define XM_Scale (-1.0f / XM_PACK_FACTOR) + #define XM_URange ((FLOAT)(1 << 20)) + #define XM_URangeDiv2 ((FLOAT)(1 << 19)) + +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR N; + static CONST XMVECTOR Max = {1048575.0f, 1048575.0f, 1048575.0f, 15.0f}; + + XMASSERT(pDestination); + + N = XMVectorClamp(V, XMVectorZero(), Max); + N = XMVectorRound(N); + + pDestination->v = ((UINT64)N.vector4_f32[3] << 60) | + (((UINT64)N.vector4_f32[2] & 0xFFFFF) << 40) | + (((UINT64)N.vector4_f32[1] & 0xFFFFF) << 20) | + (((UINT64)N.vector4_f32[0] & 0xFFFFF)); + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pDestination); + // Note: Masks are x,w,y and z + static const XMVECTORF32 MaxUIco4 = { 1048575.0f, 15.0f, 1048575.0f, 1048575.0f}; + static const XMVECTORF32 ScaleUIco4 = {1.0f,4096.0f*65536.0f,4096.0f,1.0f}; + static const XMVECTORI32 MaskUIco4 = {0xFFFFF,0xF<<(60-32),0xFFFFF000,0xFFFFF}; + static const XMVECTORF32 AddUIco4 = {0.0f,-32768.0f*65536.0f,-32768.0f*65536.0f,0.0f}; + // Clamp to bounds + XMVECTOR vResult = _mm_shuffle_ps(V,V,_MM_SHUFFLE(2,1,3,0)); + vResult = _mm_max_ps(vResult,g_XMZero); + vResult = _mm_min_ps(vResult,MaxUIco4); + // Scale by multiplication + vResult = _mm_mul_ps(vResult,ScaleUIco4); + vResult = _mm_add_ps(vResult,AddUIco4); + // Convert to int + __m128i vResulti = _mm_cvttps_epi32(vResult); + vResulti = _mm_xor_si128(vResulti,g_XMFlipYZ); + // Mask off any fraction + vResulti = _mm_and_si128(vResulti,MaskUIco4); + // Shift y and z to straddle the 32-bit boundary + __m128i vResulti2 = _mm_srli_si128(vResulti,(64+12)/8); + // Shift it into place + vResulti2 = _mm_slli_si128(vResulti2,20/8); + // i = x|y<<20|z<<40|w<<60 + vResulti = _mm_or_si128(vResulti,vResulti2); + _mm_store_sd(reinterpret_cast(&pDestination->v),reinterpret_cast(&vResulti)[0]); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ + + #undef XM_Scale + #undef XM_URange + #undef XM_URangeDiv2 +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreIcoN4 +( + XMICON4* pDestination, + FXMVECTOR V +) +{ + #define XM_Scale (-1.0f / XM_PACK_FACTOR) + #define XM_URange ((FLOAT)(1 << 4)) + #define XM_Offset (3.0f) + #define XM_UMaxXYZ ((FLOAT)((1 << (20 - 1)) - 1)) + #define XM_UMaxW ((FLOAT)((1 << (4 - 1)) - 1)) + +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR N; + static CONST XMVECTORF32 Scale = {524287.0f, 524287.0f, 524287.0f, 7.0f}; + + XMASSERT(pDestination); + + N = XMVectorClamp(V, g_XMNegativeOne.v, g_XMOne.v); + N = XMVectorMultiplyAdd(N, Scale.v, g_XMNegativeZero.v); + N = XMVectorRound(N); + + pDestination->v = ((UINT64)N.vector4_f32[3] << 60) | + (((UINT64)N.vector4_f32[2] & 0xFFFFF) << 40) | + (((UINT64)N.vector4_f32[1] & 0xFFFFF) << 20) | + (((UINT64)N.vector4_f32[0] & 0xFFFFF)); + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pDestination); + // Note: Masks are x,w,y and z + static const XMVECTORF32 ScaleIcoN4 = {524287.0f,7.0f*4096.0f*65536.0f,524287.0f*4096.0f,524287.0f}; + static const XMVECTORI32 MaskIcoN4 = {0xFFFFF,0xF<<(60-32),0xFFFFF000,0xFFFFF}; + // Clamp to bounds + XMVECTOR vResult = _mm_shuffle_ps(V,V,_MM_SHUFFLE(2,1,3,0)); + vResult = _mm_max_ps(vResult,g_XMNegativeOne); + vResult = _mm_min_ps(vResult,g_XMOne); + // Scale by multiplication + vResult = _mm_mul_ps(vResult,ScaleIcoN4); + // Convert to int + __m128i vResulti = _mm_cvttps_epi32(vResult); + // Mask off any fraction + vResulti = _mm_and_si128(vResulti,MaskIcoN4); + // Shift y and z to straddle the 32-bit boundary + __m128i vResulti2 = _mm_srli_si128(vResulti,(64+12)/8); + // Shift it into place + vResulti2 = _mm_slli_si128(vResulti2,20/8); + // i = x|y<<20|z<<40|w<<60 + vResulti = _mm_or_si128(vResulti,vResulti2); + _mm_store_sd(reinterpret_cast(&pDestination->v),reinterpret_cast(&vResulti)[0]); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ + + #undef XM_Scale + #undef XM_URange + #undef XM_Offset + #undef XM_UMaxXYZ + #undef XM_UMaxW +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreIco4 +( + XMICO4* pDestination, + FXMVECTOR V +) +{ + #define XM_Scale (-1.0f / XM_PACK_FACTOR) + #define XM_URange ((FLOAT)(1 << 4)) + #define XM_Offset (3.0f) + +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR N; + static CONST XMVECTOR Min = {-524287.0f, -524287.0f, -524287.0f, -7.0f}; + static CONST XMVECTOR Max = {524287.0f, 524287.0f, 524287.0f, 7.0f}; + + XMASSERT(pDestination); + + N = XMVectorClamp(V, Min, Max); + N = XMVectorRound(N); + + pDestination->v = ((INT64)N.vector4_f32[3] << 60) | + (((INT64)N.vector4_f32[2] & 0xFFFFF) << 40) | + (((INT64)N.vector4_f32[1] & 0xFFFFF) << 20) | + (((INT64)N.vector4_f32[0] & 0xFFFFF)); + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pDestination); + // Note: Masks are x,w,y and z + static const XMVECTORF32 MinIco4 = {-524287.0f,-7.0f,-524287.0f,-524287.0f}; + static const XMVECTORF32 MaxIco4 = { 524287.0f, 7.0f, 524287.0f, 524287.0f}; + static const XMVECTORF32 ScaleIco4 = {1.0f,4096.0f*65536.0f,4096.0f,1.0f}; + static const XMVECTORI32 MaskIco4 = {0xFFFFF,0xF<<(60-32),0xFFFFF000,0xFFFFF}; + // Clamp to bounds + XMVECTOR vResult = _mm_shuffle_ps(V,V,_MM_SHUFFLE(2,1,3,0)); + vResult = _mm_max_ps(vResult,MinIco4); + vResult = _mm_min_ps(vResult,MaxIco4); + // Scale by multiplication + vResult = _mm_mul_ps(vResult,ScaleIco4); + // Convert to int + __m128i vResulti = _mm_cvttps_epi32(vResult); + // Mask off any fraction + vResulti = _mm_and_si128(vResulti,MaskIco4); + // Shift y and z to straddle the 32-bit boundary + __m128i vResulti2 = _mm_srli_si128(vResulti,(64+12)/8); + // Shift it into place + vResulti2 = _mm_slli_si128(vResulti2,20/8); + // i = x|y<<20|z<<40|w<<60 + vResulti = _mm_or_si128(vResulti,vResulti2); + _mm_store_sd(reinterpret_cast(&pDestination->v),reinterpret_cast(&vResulti)[0]); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ + + #undef XM_Scale + #undef XM_URange + #undef XM_Offset +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreXDecN4 +( + XMXDECN4* pDestination, + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR N; + static CONST XMVECTORF32 Min = {-1.0f, -1.0f, -1.0f, 0.0f}; + static CONST XMVECTORF32 Scale = {511.0f, 511.0f, 511.0f, 3.0f}; + + XMASSERT(pDestination); + + N = XMVectorClamp(V, Min.v, g_XMOne.v); + N = XMVectorMultiply(N, Scale.v); + N = XMVectorRound(N); + + pDestination->v = ((UINT)N.vector4_f32[3] << 30) | + (((INT)N.vector4_f32[2] & 0x3FF) << 20) | + (((INT)N.vector4_f32[1] & 0x3FF) << 10) | + (((INT)N.vector4_f32[0] & 0x3FF)); + +#elif defined(_XM_SSE_INTRINSICS_) + static const XMVECTORF32 Min = {-1.0f, -1.0f, -1.0f, 0.0f}; + static const XMVECTORF32 Scale = {511.0f, 511.0f*1024.0f, 511.0f*1048576.0f,3.0f*536870912.0f}; + static const XMVECTORI32 ScaleMask = {0x3FF,0x3FF<<10,0x3FF<<20,0x3<<29}; + XMASSERT(pDestination); + XMVECTOR vResult = _mm_max_ps(V,Min); + vResult = _mm_min_ps(vResult,g_XMOne); + // Scale by multiplication + vResult = _mm_mul_ps(vResult,Scale); + // Convert to int (W is unsigned) + __m128i vResulti = _mm_cvtps_epi32(vResult); + // Mask off any fraction + vResulti = _mm_and_si128(vResulti,ScaleMask); + // To fix W, add itself to shift it up to <<30 instead of <<29 + __m128i vResultw = _mm_and_si128(vResulti,g_XMMaskW); + vResulti = _mm_add_epi32(vResulti,vResultw); + // Do a horizontal or of all 4 entries + vResult = _mm_shuffle_ps(reinterpret_cast(&vResulti)[0],reinterpret_cast(&vResulti)[0],_MM_SHUFFLE(0,3,2,1)); + vResulti = _mm_or_si128(vResulti,reinterpret_cast(&vResult)[0]); + vResult = _mm_shuffle_ps(vResult,vResult,_MM_SHUFFLE(0,3,2,1)); + vResulti = _mm_or_si128(vResulti,reinterpret_cast(&vResult)[0]); + vResult = _mm_shuffle_ps(vResult,vResult,_MM_SHUFFLE(0,3,2,1)); + vResulti = _mm_or_si128(vResulti,reinterpret_cast(&vResult)[0]); + _mm_store_ss(reinterpret_cast(&pDestination->v),reinterpret_cast(&vResulti)[0]); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreXDec4 +( + XMXDEC4* pDestination, + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR N; + static CONST XMVECTOR Min = {-511.0f, -511.0f, -511.0f, 0.0f}; + static CONST XMVECTOR Max = {511.0f, 511.0f, 511.0f, 3.0f}; + + XMASSERT(pDestination); + + N = XMVectorClamp(V, Min, Max); + + pDestination->v = ((UINT)N.vector4_f32[3] << 30) | + (((INT)N.vector4_f32[2] & 0x3FF) << 20) | + (((INT)N.vector4_f32[1] & 0x3FF) << 10) | + (((INT)N.vector4_f32[0] & 0x3FF)); + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pDestination); + static const XMVECTORF32 MinXDec4 = {-511.0f,-511.0f,-511.0f, 0.0f}; + static const XMVECTORF32 MaxXDec4 = { 511.0f, 511.0f, 511.0f, 3.0f}; + static const XMVECTORF32 ScaleXDec4 = {1.0f,1024.0f/2.0f,1024.0f*1024.0f,1024.0f*1024.0f*1024.0f/2.0f}; + static const XMVECTORI32 MaskXDec4= {0x3FF,0x3FF<<(10-1),0x3FF<<20,0x3<<(30-1)}; + // Clamp to bounds + XMVECTOR vResult = _mm_max_ps(V,MinXDec4); + vResult = _mm_min_ps(vResult,MaxXDec4); + // Scale by multiplication + vResult = _mm_mul_ps(vResult,ScaleXDec4); + // Convert to int + __m128i vResulti = _mm_cvttps_epi32(vResult); + // Mask off any fraction + vResulti = _mm_and_si128(vResulti,MaskXDec4); + // Do a horizontal or of 4 entries + __m128i vResulti2 = _mm_shuffle_epi32(vResulti,_MM_SHUFFLE(3,2,3,2)); + // x = x|z, y = y|w + vResulti = _mm_or_si128(vResulti,vResulti2); + // Move Z to the x position + vResulti2 = _mm_shuffle_epi32(vResulti,_MM_SHUFFLE(1,1,1,1)); + // Perform a single bit left shift on y|w + vResulti2 = _mm_add_epi32(vResulti2,vResulti2); + // i = x|y|z|w + vResulti = _mm_or_si128(vResulti,vResulti2); + _mm_store_ss(reinterpret_cast(&pDestination->v),reinterpret_cast(&vResulti)[0]); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreUDecN4 +( + XMUDECN4* pDestination, + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR N; + static CONST XMVECTORF32 Scale = {1023.0f, 1023.0f, 1023.0f, 3.0f}; + + XMASSERT(pDestination); + + N = XMVectorClamp(V, XMVectorZero(), g_XMOne.v); + N = XMVectorMultiply(N, Scale.v); + + pDestination->v = ((UINT)N.vector4_f32[3] << 30) | + (((UINT)N.vector4_f32[2] & 0x3FF) << 20) | + (((UINT)N.vector4_f32[1] & 0x3FF) << 10) | + (((UINT)N.vector4_f32[0] & 0x3FF)); + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pDestination); + static const XMVECTORF32 ScaleUDecN4 = {1023.0f,1023.0f*1024.0f*0.5f,1023.0f*1024.0f*1024.0f,3.0f*1024.0f*1024.0f*1024.0f*0.5f}; + static const XMVECTORI32 MaskUDecN4= {0x3FF,0x3FF<<(10-1),0x3FF<<20,0x3<<(30-1)}; + // Clamp to bounds + XMVECTOR vResult = _mm_max_ps(V,g_XMZero); + vResult = _mm_min_ps(vResult,g_XMOne); + // Scale by multiplication + vResult = _mm_mul_ps(vResult,ScaleUDecN4); + // Convert to int + __m128i vResulti = _mm_cvttps_epi32(vResult); + // Mask off any fraction + vResulti = _mm_and_si128(vResulti,MaskUDecN4); + // Do a horizontal or of 4 entries + __m128i vResulti2 = _mm_shuffle_epi32(vResulti,_MM_SHUFFLE(3,2,3,2)); + // x = x|z, y = y|w + vResulti = _mm_or_si128(vResulti,vResulti2); + // Move Z to the x position + vResulti2 = _mm_shuffle_epi32(vResulti,_MM_SHUFFLE(1,1,1,1)); + // Perform a left shift by one bit on y|w + vResulti2 = _mm_add_epi32(vResulti2,vResulti2); + // i = x|y|z|w + vResulti = _mm_or_si128(vResulti,vResulti2); + _mm_store_ss(reinterpret_cast(&pDestination->v),reinterpret_cast(&vResulti)[0]); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreUDec4 +( + XMUDEC4* pDestination, + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR N; + static CONST XMVECTOR Max = {1023.0f, 1023.0f, 1023.0f, 3.0f}; + + XMASSERT(pDestination); + + N = XMVectorClamp(V, XMVectorZero(), Max); + + pDestination->v = ((UINT)N.vector4_f32[3] << 30) | + (((UINT)N.vector4_f32[2] & 0x3FF) << 20) | + (((UINT)N.vector4_f32[1] & 0x3FF) << 10) | + (((UINT)N.vector4_f32[0] & 0x3FF)); + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pDestination); + static const XMVECTORF32 MaxUDec4 = { 1023.0f, 1023.0f, 1023.0f, 3.0f}; + static const XMVECTORF32 ScaleUDec4 = {1.0f,1024.0f/2.0f,1024.0f*1024.0f,1024.0f*1024.0f*1024.0f/2.0f}; + static const XMVECTORI32 MaskUDec4= {0x3FF,0x3FF<<(10-1),0x3FF<<20,0x3<<(30-1)}; + // Clamp to bounds + XMVECTOR vResult = _mm_max_ps(V,g_XMZero); + vResult = _mm_min_ps(vResult,MaxUDec4); + // Scale by multiplication + vResult = _mm_mul_ps(vResult,ScaleUDec4); + // Convert to int + __m128i vResulti = _mm_cvttps_epi32(vResult); + // Mask off any fraction + vResulti = _mm_and_si128(vResulti,MaskUDec4); + // Do a horizontal or of 4 entries + __m128i vResulti2 = _mm_shuffle_epi32(vResulti,_MM_SHUFFLE(3,2,3,2)); + // x = x|z, y = y|w + vResulti = _mm_or_si128(vResulti,vResulti2); + // Move Z to the x position + vResulti2 = _mm_shuffle_epi32(vResulti,_MM_SHUFFLE(1,1,1,1)); + // Perform a left shift by one bit on y|w + vResulti2 = _mm_add_epi32(vResulti2,vResulti2); + // i = x|y|z|w + vResulti = _mm_or_si128(vResulti,vResulti2); + _mm_store_ss(reinterpret_cast(&pDestination->v),reinterpret_cast(&vResulti)[0]); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreDecN4 +( + XMDECN4* pDestination, + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR N; + static CONST XMVECTORF32 Scale = {511.0f, 511.0f, 511.0f, 1.0f}; + + XMASSERT(pDestination); + + N = XMVectorClamp(V, g_XMNegativeOne.v, g_XMOne.v); + N = XMVectorMultiply(N, Scale.v); + + pDestination->v = ((INT)N.vector4_f32[3] << 30) | + (((INT)N.vector4_f32[2] & 0x3FF) << 20) | + (((INT)N.vector4_f32[1] & 0x3FF) << 10) | + (((INT)N.vector4_f32[0] & 0x3FF)); + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pDestination); + static const XMVECTORF32 ScaleDecN4 = {511.0f,511.0f*1024.0f,511.0f*1024.0f*1024.0f,1.0f*1024.0f*1024.0f*1024.0f}; + static const XMVECTORI32 MaskDecN4= {0x3FF,0x3FF<<10,0x3FF<<20,0x3<<30}; + // Clamp to bounds + XMVECTOR vResult = _mm_max_ps(V,g_XMNegativeOne); + vResult = _mm_min_ps(vResult,g_XMOne); + // Scale by multiplication + vResult = _mm_mul_ps(vResult,ScaleDecN4); + // Convert to int + __m128i vResulti = _mm_cvttps_epi32(vResult); + // Mask off any fraction + vResulti = _mm_and_si128(vResulti,MaskDecN4); + // Do a horizontal or of 4 entries + __m128i vResulti2 = _mm_shuffle_epi32(vResulti,_MM_SHUFFLE(3,2,3,2)); + // x = x|z, y = y|w + vResulti = _mm_or_si128(vResulti,vResulti2); + // Move Z to the x position + vResulti2 = _mm_shuffle_epi32(vResulti,_MM_SHUFFLE(1,1,1,1)); + // i = x|y|z|w + vResulti = _mm_or_si128(vResulti,vResulti2); + _mm_store_ss(reinterpret_cast(&pDestination->v),reinterpret_cast(&vResulti)[0]); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreDec4 +( + XMDEC4* pDestination, + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR N; + static CONST XMVECTOR Min = {-511.0f, -511.0f, -511.0f, -1.0f}; + static CONST XMVECTOR Max = {511.0f, 511.0f, 511.0f, 1.0f}; + + XMASSERT(pDestination); + + N = XMVectorClamp(V, Min, Max); + + pDestination->v = ((INT)N.vector4_f32[3] << 30) | + (((INT)N.vector4_f32[2] & 0x3FF) << 20) | + (((INT)N.vector4_f32[1] & 0x3FF) << 10) | + (((INT)N.vector4_f32[0] & 0x3FF)); + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pDestination); + static const XMVECTORF32 MinDec4 = {-511.0f,-511.0f,-511.0f,-1.0f}; + static const XMVECTORF32 MaxDec4 = { 511.0f, 511.0f, 511.0f, 1.0f}; + static const XMVECTORF32 ScaleDec4 = {1.0f,1024.0f,1024.0f*1024.0f,1024.0f*1024.0f*1024.0f}; + static const XMVECTORI32 MaskDec4= {0x3FF,0x3FF<<10,0x3FF<<20,0x3<<30}; + // Clamp to bounds + XMVECTOR vResult = _mm_max_ps(V,MinDec4); + vResult = _mm_min_ps(vResult,MaxDec4); + // Scale by multiplication + vResult = _mm_mul_ps(vResult,ScaleDec4); + // Convert to int + __m128i vResulti = _mm_cvttps_epi32(vResult); + // Mask off any fraction + vResulti = _mm_and_si128(vResulti,MaskDec4); + // Do a horizontal or of 4 entries + __m128i vResulti2 = _mm_shuffle_epi32(vResulti,_MM_SHUFFLE(3,2,3,2)); + // x = x|z, y = y|w + vResulti = _mm_or_si128(vResulti,vResulti2); + // Move Z to the x position + vResulti2 = _mm_shuffle_epi32(vResulti,_MM_SHUFFLE(1,1,1,1)); + // i = x|y|z|w + vResulti = _mm_or_si128(vResulti,vResulti2); + _mm_store_ss(reinterpret_cast(&pDestination->v),reinterpret_cast(&vResulti)[0]); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreUByteN4 +( + XMUBYTEN4* pDestination, + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR N; + static CONST XMVECTORF32 Scale = {255.0f, 255.0f, 255.0f, 255.0f}; + + XMASSERT(pDestination); + + N = XMVectorSaturate(V); + N = XMVectorMultiply(N, Scale.v); + N = XMVectorRound(N); + + pDestination->x = (BYTE)N.vector4_f32[0]; + pDestination->y = (BYTE)N.vector4_f32[1]; + pDestination->z = (BYTE)N.vector4_f32[2]; + pDestination->w = (BYTE)N.vector4_f32[3]; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pDestination); + static const XMVECTORF32 ScaleUByteN4 = {255.0f,255.0f*256.0f*0.5f,255.0f*256.0f*256.0f,255.0f*256.0f*256.0f*256.0f*0.5f}; + static const XMVECTORI32 MaskUByteN4 = {0xFF,0xFF<<(8-1),0xFF<<16,0xFF<<(24-1)}; + // Clamp to bounds + XMVECTOR vResult = _mm_max_ps(V,g_XMZero); + vResult = _mm_min_ps(vResult,g_XMOne); + // Scale by multiplication + vResult = _mm_mul_ps(vResult,ScaleUByteN4); + // Convert to int + __m128i vResulti = _mm_cvttps_epi32(vResult); + // Mask off any fraction + vResulti = _mm_and_si128(vResulti,MaskUByteN4); + // Do a horizontal or of 4 entries + __m128i vResulti2 = _mm_shuffle_epi32(vResulti,_MM_SHUFFLE(3,2,3,2)); + // x = x|z, y = y|w + vResulti = _mm_or_si128(vResulti,vResulti2); + // Move Z to the x position + vResulti2 = _mm_shuffle_epi32(vResulti,_MM_SHUFFLE(1,1,1,1)); + // Perform a single bit left shift to fix y|w + vResulti2 = _mm_add_epi32(vResulti2,vResulti2); + // i = x|y|z|w + vResulti = _mm_or_si128(vResulti,vResulti2); + _mm_store_ss(reinterpret_cast(&pDestination->v),reinterpret_cast(&vResulti)[0]); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreUByte4 +( + XMUBYTE4* pDestination, + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR N; + static CONST XMVECTOR Max = {255.0f, 255.0f, 255.0f, 255.0f}; + + XMASSERT(pDestination); + + N = XMVectorClamp(V, XMVectorZero(), Max); + N = XMVectorRound(N); + + pDestination->x = (BYTE)N.vector4_f32[0]; + pDestination->y = (BYTE)N.vector4_f32[1]; + pDestination->z = (BYTE)N.vector4_f32[2]; + pDestination->w = (BYTE)N.vector4_f32[3]; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pDestination); + static const XMVECTORF32 MaxUByte4 = { 255.0f, 255.0f, 255.0f, 255.0f}; + static const XMVECTORF32 ScaleUByte4 = {1.0f,256.0f*0.5f,256.0f*256.0f,256.0f*256.0f*256.0f*0.5f}; + static const XMVECTORI32 MaskUByte4 = {0xFF,0xFF<<(8-1),0xFF<<16,0xFF<<(24-1)}; + // Clamp to bounds + XMVECTOR vResult = _mm_max_ps(V,g_XMZero); + vResult = _mm_min_ps(vResult,MaxUByte4); + // Scale by multiplication + vResult = _mm_mul_ps(vResult,ScaleUByte4); + // Convert to int + __m128i vResulti = _mm_cvttps_epi32(vResult); + // Mask off any fraction + vResulti = _mm_and_si128(vResulti,MaskUByte4); + // Do a horizontal or of 4 entries + __m128i vResulti2 = _mm_shuffle_epi32(vResulti,_MM_SHUFFLE(3,2,3,2)); + // x = x|z, y = y|w + vResulti = _mm_or_si128(vResulti,vResulti2); + // Move Z to the x position + vResulti2 = _mm_shuffle_epi32(vResulti,_MM_SHUFFLE(1,1,1,1)); + // Perform a single bit left shift to fix y|w + vResulti2 = _mm_add_epi32(vResulti2,vResulti2); + // i = x|y|z|w + vResulti = _mm_or_si128(vResulti,vResulti2); + _mm_store_ss(reinterpret_cast(&pDestination->v),reinterpret_cast(&vResulti)[0]); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreByteN4 +( + XMBYTEN4* pDestination, + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR N; + static CONST XMVECTORF32 Scale = {127.0f, 127.0f, 127.0f, 127.0f}; + + XMASSERT(pDestination); + + N = XMVectorMultiply(V, Scale.v); + N = XMVectorRound(N); + + pDestination->x = (CHAR)N.vector4_f32[0]; + pDestination->y = (CHAR)N.vector4_f32[1]; + pDestination->z = (CHAR)N.vector4_f32[2]; + pDestination->w = (CHAR)N.vector4_f32[3]; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pDestination); + static const XMVECTORF32 ScaleByteN4 = {127.0f,127.0f*256.0f,127.0f*256.0f*256.0f,127.0f*256.0f*256.0f*256.0f}; + static const XMVECTORI32 MaskByteN4 = {0xFF,0xFF<<8,0xFF<<16,0xFF<<24}; + // Clamp to bounds + XMVECTOR vResult = _mm_max_ps(V,g_XMNegativeOne); + vResult = _mm_min_ps(vResult,g_XMOne); + // Scale by multiplication + vResult = _mm_mul_ps(vResult,ScaleByteN4); + // Convert to int + __m128i vResulti = _mm_cvttps_epi32(vResult); + // Mask off any fraction + vResulti = _mm_and_si128(vResulti,MaskByteN4); + // Do a horizontal or of 4 entries + __m128i vResulti2 = _mm_shuffle_epi32(vResulti,_MM_SHUFFLE(3,2,3,2)); + // x = x|z, y = y|w + vResulti = _mm_or_si128(vResulti,vResulti2); + // Move Z to the x position + vResulti2 = _mm_shuffle_epi32(vResulti,_MM_SHUFFLE(1,1,1,1)); + // i = x|y|z|w + vResulti = _mm_or_si128(vResulti,vResulti2); + _mm_store_ss(reinterpret_cast(&pDestination->v),reinterpret_cast(&vResulti)[0]); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreByte4 +( + XMBYTE4* pDestination, + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR N; + static CONST XMVECTOR Min = {-127.0f, -127.0f, -127.0f, -127.0f}; + static CONST XMVECTOR Max = {127.0f, 127.0f, 127.0f, 127.0f}; + + XMASSERT(pDestination); + + N = XMVectorClamp(V, Min, Max); + N = XMVectorRound(N); + + pDestination->x = (CHAR)N.vector4_f32[0]; + pDestination->y = (CHAR)N.vector4_f32[1]; + pDestination->z = (CHAR)N.vector4_f32[2]; + pDestination->w = (CHAR)N.vector4_f32[3]; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pDestination); + static const XMVECTORF32 MinByte4 = {-127.0f,-127.0f,-127.0f,-127.0f}; + static const XMVECTORF32 MaxByte4 = { 127.0f, 127.0f, 127.0f, 127.0f}; + static const XMVECTORF32 ScaleByte4 = {1.0f,256.0f,256.0f*256.0f,256.0f*256.0f*256.0f}; + static const XMVECTORI32 MaskByte4 = {0xFF,0xFF<<8,0xFF<<16,0xFF<<24}; + // Clamp to bounds + XMVECTOR vResult = _mm_max_ps(V,MinByte4); + vResult = _mm_min_ps(vResult,MaxByte4); + // Scale by multiplication + vResult = _mm_mul_ps(vResult,ScaleByte4); + // Convert to int + __m128i vResulti = _mm_cvttps_epi32(vResult); + // Mask off any fraction + vResulti = _mm_and_si128(vResulti,MaskByte4); + // Do a horizontal or of 4 entries + __m128i vResulti2 = _mm_shuffle_epi32(vResulti,_MM_SHUFFLE(3,2,3,2)); + // x = x|z, y = y|w + vResulti = _mm_or_si128(vResulti,vResulti2); + // Move Z to the x position + vResulti2 = _mm_shuffle_epi32(vResulti,_MM_SHUFFLE(1,1,1,1)); + // i = x|y|z|w + vResulti = _mm_or_si128(vResulti,vResulti2); + _mm_store_ss(reinterpret_cast(&pDestination->v),reinterpret_cast(&vResulti)[0]); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreUNibble4 +( + XMUNIBBLE4* pDestination, + FXMVECTOR V +) +{ +#if defined(_XM_SSE_INTRINSICS_) && !defined(_XM_NO_INTRINSICS_) + XMASSERT(pDestination); + static CONST XMVECTORF32 Max = {15.0f,15.0f,15.0f,15.0f}; + // Bounds check + XMVECTOR vResult = _mm_max_ps(V,g_XMZero); + vResult = _mm_min_ps(vResult,Max); + // Convert to int with rounding + __m128i vInt = _mm_cvtps_epi32(vResult); + // No SSE operations will write to 16-bit values, so we have to extract them manually + USHORT x = static_cast(_mm_extract_epi16(vInt,0)); + USHORT y = static_cast(_mm_extract_epi16(vInt,2)); + USHORT z = static_cast(_mm_extract_epi16(vInt,4)); + USHORT w = static_cast(_mm_extract_epi16(vInt,6)); + pDestination->v = ((w & 0xF) << 12) | + ((z & 0xF) << 8) | + ((y & 0xF) << 4) | + ((x & 0xF)); +#else + XMVECTOR N; + static CONST XMVECTORF32 Max = {15.0f,15.0f,15.0f,15.0f}; + + XMASSERT(pDestination); + + N = XMVectorClamp(V, XMVectorZero(), Max.v); + N = XMVectorRound(N); + + pDestination->v = (((USHORT)N.vector4_f32[3] & 0xF) << 12) | + (((USHORT)N.vector4_f32[2] & 0xF) << 8) | + (((USHORT)N.vector4_f32[1] & 0xF) << 4) | + (((USHORT)N.vector4_f32[0] & 0xF)); +#endif !_XM_SSE_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreU555( + XMU555* pDestination, + FXMVECTOR V +) +{ +#if defined(_XM_SSE_INTRINSICS_) && !defined(_XM_NO_INTRINSICS_) + XMASSERT(pDestination); + static CONST XMVECTORF32 Max = {31.0f, 31.0f, 31.0f, 1.0f}; + // Bounds check + XMVECTOR vResult = _mm_max_ps(V,g_XMZero); + vResult = _mm_min_ps(vResult,Max); + // Convert to int with rounding + __m128i vInt = _mm_cvtps_epi32(vResult); + // No SSE operations will write to 16-bit values, so we have to extract them manually + USHORT x = static_cast(_mm_extract_epi16(vInt,0)); + USHORT y = static_cast(_mm_extract_epi16(vInt,2)); + USHORT z = static_cast(_mm_extract_epi16(vInt,4)); + USHORT w = static_cast(_mm_extract_epi16(vInt,6)); + pDestination->v = ((w) ? 0x8000 : 0) | + ((z & 0x1F) << 10) | + ((y & 0x1F) << 5) | + ((x & 0x1F)); +#else + XMVECTOR N; + static CONST XMVECTORF32 Max = {31.0f, 31.0f, 31.0f, 1.0f}; + + XMASSERT(pDestination); + + N = XMVectorClamp(V, XMVectorZero(), Max.v); + N = XMVectorRound(N); + + pDestination->v = ((N.vector4_f32[3] > 0.f) ? 0x8000 : 0) | + (((USHORT)N.vector4_f32[2] & 0x1F) << 10) | + (((USHORT)N.vector4_f32[1] & 0x1F) << 5) | + (((USHORT)N.vector4_f32[0] & 0x1F)); +#endif !_XM_SSE_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreColor +( + XMCOLOR* pDestination, + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR N; + static CONST XMVECTORF32 Scale = {255.0f, 255.0f, 255.0f, 255.0f}; + + XMASSERT(pDestination); + + N = XMVectorSaturate(V); + N = XMVectorMultiply(N, Scale.v); + N = XMVectorRound(N); + + pDestination->c = ((UINT)N.vector4_f32[3] << 24) | + ((UINT)N.vector4_f32[0] << 16) | + ((UINT)N.vector4_f32[1] << 8) | + ((UINT)N.vector4_f32[2]); + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pDestination); + static CONST XMVECTORF32 Scale = {255.0f,255.0f,255.0f,255.0f}; + // Set <0 to 0 + XMVECTOR vResult = _mm_max_ps(V,g_XMZero); + // Set>1 to 1 + vResult = _mm_min_ps(vResult,g_XMOne); + // Convert to 0-255 + vResult = _mm_mul_ps(vResult,Scale); + // Shuffle RGBA to ARGB + vResult = _mm_shuffle_ps(vResult,vResult,_MM_SHUFFLE(3,0,1,2)); + // Convert to int + __m128i vInt = _mm_cvtps_epi32(vResult); + // Mash to shorts + vInt = _mm_packs_epi32(vInt,vInt); + // Mash to bytes + vInt = _mm_packus_epi16(vInt,vInt); + // Store the color + _mm_store_ss(reinterpret_cast(&pDestination->c),reinterpret_cast<__m128 *>(&vInt)[0]); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreFloat3x3 +( + XMFLOAT3X3* pDestination, + CXMMATRIX M +) +{ +#if defined(_XM_NO_INTRINSICS_) || defined(XM_NO_MISALIGNED_VECTOR_ACCESS) || defined(_XM_SSE_INTRINSICS_) + + XMStoreFloat3x3NC(pDestination, M); + +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreFloat3x3NC +( + XMFLOAT3X3* pDestination, + CXMMATRIX M +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMASSERT(pDestination); + + pDestination->m[0][0] = M.r[0].vector4_f32[0]; + pDestination->m[0][1] = M.r[0].vector4_f32[1]; + pDestination->m[0][2] = M.r[0].vector4_f32[2]; + + pDestination->m[1][0] = M.r[1].vector4_f32[0]; + pDestination->m[1][1] = M.r[1].vector4_f32[1]; + pDestination->m[1][2] = M.r[1].vector4_f32[2]; + + pDestination->m[2][0] = M.r[2].vector4_f32[0]; + pDestination->m[2][1] = M.r[2].vector4_f32[1]; + pDestination->m[2][2] = M.r[2].vector4_f32[2]; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pDestination); + XMVECTOR vTemp1 = M.r[0]; + XMVECTOR vTemp2 = M.r[1]; + XMVECTOR vTemp3 = M.r[2]; + XMVECTOR vWork = _mm_shuffle_ps(vTemp1,vTemp2,_MM_SHUFFLE(0,0,2,2)); + vTemp1 = _mm_shuffle_ps(vTemp1,vWork,_MM_SHUFFLE(2,0,1,0)); + _mm_storeu_ps(&pDestination->m[0][0],vTemp1); + vTemp2 = _mm_shuffle_ps(vTemp2,vTemp3,_MM_SHUFFLE(1,0,2,1)); + _mm_storeu_ps(&pDestination->m[1][1],vTemp2); + vTemp3 = _mm_shuffle_ps(vTemp3,vTemp3,_MM_SHUFFLE(2,2,2,2)); + _mm_store_ss(&pDestination->m[2][2],vTemp3); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreFloat4x3 +( + XMFLOAT4X3* pDestination, + CXMMATRIX M +) +{ +#if defined(_XM_NO_INTRINSICS_) || defined(XM_NO_MISALIGNED_VECTOR_ACCESS) || defined(_XM_SSE_INTRINSICS_) + + XMStoreFloat4x3NC(pDestination, M); + +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreFloat4x3A +( + XMFLOAT4X3A* pDestination, + CXMMATRIX M +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMASSERT(pDestination); + XMASSERT(((UINT_PTR)pDestination & 0xF) == 0); + + pDestination->m[0][0] = M.r[0].vector4_f32[0]; + pDestination->m[0][1] = M.r[0].vector4_f32[1]; + pDestination->m[0][2] = M.r[0].vector4_f32[2]; + + pDestination->m[1][0] = M.r[1].vector4_f32[0]; + pDestination->m[1][1] = M.r[1].vector4_f32[1]; + pDestination->m[1][2] = M.r[1].vector4_f32[2]; + + pDestination->m[2][0] = M.r[2].vector4_f32[0]; + pDestination->m[2][1] = M.r[2].vector4_f32[1]; + pDestination->m[2][2] = M.r[2].vector4_f32[2]; + + pDestination->m[3][0] = M.r[3].vector4_f32[0]; + pDestination->m[3][1] = M.r[3].vector4_f32[1]; + pDestination->m[3][2] = M.r[3].vector4_f32[2]; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pDestination); + XMASSERT(((UINT_PTR)pDestination & 0xF) == 0); + // x1,y1,z1,w1 + XMVECTOR vTemp1 = M.r[0]; + // x2,y2,z2,w2 + XMVECTOR vTemp2 = M.r[1]; + // x3,y3,z3,w3 + XMVECTOR vTemp3 = M.r[2]; + // x4,y4,z4,w4 + XMVECTOR vTemp4 = M.r[3]; + // z1,z1,x2,y2 + XMVECTOR vTemp = _mm_shuffle_ps(vTemp1,vTemp2,_MM_SHUFFLE(1,0,2,2)); + // y2,z2,x3,y3 (Final) + vTemp2 = _mm_shuffle_ps(vTemp2,vTemp3,_MM_SHUFFLE(1,0,2,1)); + // x1,y1,z1,x2 (Final) + vTemp1 = _mm_shuffle_ps(vTemp1,vTemp,_MM_SHUFFLE(2,0,1,0)); + // z3,z3,x4,x4 + vTemp3 = _mm_shuffle_ps(vTemp3,vTemp4,_MM_SHUFFLE(0,0,2,2)); + // z3,x4,y4,z4 (Final) + vTemp3 = _mm_shuffle_ps(vTemp3,vTemp4,_MM_SHUFFLE(2,1,2,0)); + // Store in 3 operations + _mm_store_ps(&pDestination->m[0][0],vTemp1); + _mm_store_ps(&pDestination->m[1][1],vTemp2); + _mm_store_ps(&pDestination->m[2][2],vTemp3); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreFloat4x3NC +( + XMFLOAT4X3* pDestination, + CXMMATRIX M +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMASSERT(pDestination); + + pDestination->m[0][0] = M.r[0].vector4_f32[0]; + pDestination->m[0][1] = M.r[0].vector4_f32[1]; + pDestination->m[0][2] = M.r[0].vector4_f32[2]; + + pDestination->m[1][0] = M.r[1].vector4_f32[0]; + pDestination->m[1][1] = M.r[1].vector4_f32[1]; + pDestination->m[1][2] = M.r[1].vector4_f32[2]; + + pDestination->m[2][0] = M.r[2].vector4_f32[0]; + pDestination->m[2][1] = M.r[2].vector4_f32[1]; + pDestination->m[2][2] = M.r[2].vector4_f32[2]; + + pDestination->m[3][0] = M.r[3].vector4_f32[0]; + pDestination->m[3][1] = M.r[3].vector4_f32[1]; + pDestination->m[3][2] = M.r[3].vector4_f32[2]; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pDestination); + XMVECTOR vTemp1 = M.r[0]; + XMVECTOR vTemp2 = M.r[1]; + XMVECTOR vTemp3 = M.r[2]; + XMVECTOR vTemp4 = M.r[3]; + XMVECTOR vTemp2x = _mm_shuffle_ps(vTemp2,vTemp3,_MM_SHUFFLE(1,0,2,1)); + vTemp2 = _mm_shuffle_ps(vTemp2,vTemp1,_MM_SHUFFLE(2,2,0,0)); + vTemp1 = _mm_shuffle_ps(vTemp1,vTemp2,_MM_SHUFFLE(0,2,1,0)); + vTemp3 = _mm_shuffle_ps(vTemp3,vTemp4,_MM_SHUFFLE(0,0,2,2)); + vTemp3 = _mm_shuffle_ps(vTemp3,vTemp4,_MM_SHUFFLE(2,1,2,0)); + _mm_storeu_ps(&pDestination->m[0][0],vTemp1); + _mm_storeu_ps(&pDestination->m[1][1],vTemp2x); + _mm_storeu_ps(&pDestination->m[2][2],vTemp3); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreFloat4x4 +( + XMFLOAT4X4* pDestination, + CXMMATRIX M +) +{ +#if defined(_XM_NO_INTRINSICS_) || defined(XM_NO_MISALIGNED_VECTOR_ACCESS) + + XMStoreFloat4x4NC(pDestination, M); + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pDestination); + + _mm_storeu_ps( &pDestination->_11, M.r[0] ); + _mm_storeu_ps( &pDestination->_21, M.r[1] ); + _mm_storeu_ps( &pDestination->_31, M.r[2] ); + _mm_storeu_ps( &pDestination->_41, M.r[3] ); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreFloat4x4A +( + XMFLOAT4X4A* pDestination, + CXMMATRIX M +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMASSERT(pDestination); + XMASSERT(((UINT_PTR)pDestination & 0xF) == 0); + + pDestination->m[0][0] = M.r[0].vector4_f32[0]; + pDestination->m[0][1] = M.r[0].vector4_f32[1]; + pDestination->m[0][2] = M.r[0].vector4_f32[2]; + pDestination->m[0][3] = M.r[0].vector4_f32[3]; + + pDestination->m[1][0] = M.r[1].vector4_f32[0]; + pDestination->m[1][1] = M.r[1].vector4_f32[1]; + pDestination->m[1][2] = M.r[1].vector4_f32[2]; + pDestination->m[1][3] = M.r[1].vector4_f32[3]; + + pDestination->m[2][0] = M.r[2].vector4_f32[0]; + pDestination->m[2][1] = M.r[2].vector4_f32[1]; + pDestination->m[2][2] = M.r[2].vector4_f32[2]; + pDestination->m[2][3] = M.r[2].vector4_f32[3]; + + pDestination->m[3][0] = M.r[3].vector4_f32[0]; + pDestination->m[3][1] = M.r[3].vector4_f32[1]; + pDestination->m[3][2] = M.r[3].vector4_f32[2]; + pDestination->m[3][3] = M.r[3].vector4_f32[3]; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pDestination); + + _mm_store_ps( &pDestination->_11, M.r[0] ); + _mm_store_ps( &pDestination->_21, M.r[1] ); + _mm_store_ps( &pDestination->_31, M.r[2] ); + _mm_store_ps( &pDestination->_41, M.r[3] ); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMStoreFloat4x4NC +( + XMFLOAT4X4* pDestination, + CXMMATRIX M +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMASSERT(pDestination); + + pDestination->m[0][0] = M.r[0].vector4_f32[0]; + pDestination->m[0][1] = M.r[0].vector4_f32[1]; + pDestination->m[0][2] = M.r[0].vector4_f32[2]; + pDestination->m[0][3] = M.r[0].vector4_f32[3]; + + pDestination->m[1][0] = M.r[1].vector4_f32[0]; + pDestination->m[1][1] = M.r[1].vector4_f32[1]; + pDestination->m[1][2] = M.r[1].vector4_f32[2]; + pDestination->m[1][3] = M.r[1].vector4_f32[3]; + + pDestination->m[2][0] = M.r[2].vector4_f32[0]; + pDestination->m[2][1] = M.r[2].vector4_f32[1]; + pDestination->m[2][2] = M.r[2].vector4_f32[2]; + pDestination->m[2][3] = M.r[2].vector4_f32[3]; + + pDestination->m[3][0] = M.r[3].vector4_f32[0]; + pDestination->m[3][1] = M.r[3].vector4_f32[1]; + pDestination->m[3][2] = M.r[3].vector4_f32[2]; + pDestination->m[3][3] = M.r[3].vector4_f32[3]; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pDestination); + _mm_storeu_ps(&pDestination->m[0][0],M.r[0]); + _mm_storeu_ps(&pDestination->m[1][0],M.r[1]); + _mm_storeu_ps(&pDestination->m[2][0],M.r[2]); + _mm_storeu_ps(&pDestination->m[3][0],M.r[3]); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +#endif // __XNAMATHCONVERT_INL__ + diff --git a/MediaClient/MediaClient/directx/include/xnamathmatrix.inl b/MediaClient/MediaClient/directx/include/xnamathmatrix.inl new file mode 100644 index 0000000..7ce4c1f --- /dev/null +++ b/MediaClient/MediaClient/directx/include/xnamathmatrix.inl @@ -0,0 +1,3254 @@ +/*++ + +Copyright (c) Microsoft Corporation. All rights reserved. + +Module Name: + + xnamathmatrix.inl + +Abstract: + + XNA math library for Windows and Xbox 360: Matrix functions +--*/ + +#if defined(_MSC_VER) && (_MSC_VER > 1000) +#pragma once +#endif + +#ifndef __XNAMATHMATRIX_INL__ +#define __XNAMATHMATRIX_INL__ + +/**************************************************************************** + * + * Matrix + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ +// Comparison operations +//------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------ + +// Return TRUE if any entry in the matrix is NaN +XMFINLINE BOOL XMMatrixIsNaN +( + CXMMATRIX M +) +{ +#if defined(_XM_NO_INTRINSICS_) + UINT i, uTest; + const UINT *pWork; + + i = 16; + pWork = (const UINT *)(&M.m[0][0]); + do { + // Fetch value into integer unit + uTest = pWork[0]; + // Remove sign + uTest &= 0x7FFFFFFFU; + // NaN is 0x7F800001 through 0x7FFFFFFF inclusive + uTest -= 0x7F800001U; + if (uTest<0x007FFFFFU) { + break; // NaN found + } + ++pWork; // Next entry + } while (--i); + return (i!=0); // i == 0 if nothing matched +#elif defined(_XM_SSE_INTRINSICS_) + // Load in registers + XMVECTOR vX = M.r[0]; + XMVECTOR vY = M.r[1]; + XMVECTOR vZ = M.r[2]; + XMVECTOR vW = M.r[3]; + // Test themselves to check for NaN + vX = _mm_cmpneq_ps(vX,vX); + vY = _mm_cmpneq_ps(vY,vY); + vZ = _mm_cmpneq_ps(vZ,vZ); + vW = _mm_cmpneq_ps(vW,vW); + // Or all the results + vX = _mm_or_ps(vX,vZ); + vY = _mm_or_ps(vY,vW); + vX = _mm_or_ps(vX,vY); + // If any tested true, return true + return (_mm_movemask_ps(vX)!=0); +#else +#endif +} + +//------------------------------------------------------------------------------ + +// Return TRUE if any entry in the matrix is +/-INF +XMFINLINE BOOL XMMatrixIsInfinite +( + CXMMATRIX M +) +{ +#if defined(_XM_NO_INTRINSICS_) + UINT i, uTest; + const UINT *pWork; + + i = 16; + pWork = (const UINT *)(&M.m[0][0]); + do { + // Fetch value into integer unit + uTest = pWork[0]; + // Remove sign + uTest &= 0x7FFFFFFFU; + // INF is 0x7F800000 + if (uTest==0x7F800000U) { + break; // INF found + } + ++pWork; // Next entry + } while (--i); + return (i!=0); // i == 0 if nothing matched +#elif defined(_XM_SSE_INTRINSICS_) + // Mask off the sign bits + XMVECTOR vTemp1 = _mm_and_ps(M.r[0],g_XMAbsMask); + XMVECTOR vTemp2 = _mm_and_ps(M.r[1],g_XMAbsMask); + XMVECTOR vTemp3 = _mm_and_ps(M.r[2],g_XMAbsMask); + XMVECTOR vTemp4 = _mm_and_ps(M.r[3],g_XMAbsMask); + // Compare to infinity + vTemp1 = _mm_cmpeq_ps(vTemp1,g_XMInfinity); + vTemp2 = _mm_cmpeq_ps(vTemp2,g_XMInfinity); + vTemp3 = _mm_cmpeq_ps(vTemp3,g_XMInfinity); + vTemp4 = _mm_cmpeq_ps(vTemp4,g_XMInfinity); + // Or the answers together + vTemp1 = _mm_or_ps(vTemp1,vTemp2); + vTemp3 = _mm_or_ps(vTemp3,vTemp4); + vTemp1 = _mm_or_ps(vTemp1,vTemp3); + // If any are infinity, the signs are true. + return (_mm_movemask_ps(vTemp1)!=0); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +// Return TRUE if the XMMatrix is equal to identity +XMFINLINE BOOL XMMatrixIsIdentity +( + CXMMATRIX M +) +{ +#if defined(_XM_NO_INTRINSICS_) + unsigned int uOne, uZero; + const unsigned int *pWork; + + // Use the integer pipeline to reduce branching to a minimum + pWork = (const unsigned int*)(&M.m[0][0]); + // Convert 1.0f to zero and or them together + uOne = pWork[0]^0x3F800000U; + // Or all the 0.0f entries together + uZero = pWork[1]; + uZero |= pWork[2]; + uZero |= pWork[3]; + // 2nd row + uZero |= pWork[4]; + uOne |= pWork[5]^0x3F800000U; + uZero |= pWork[6]; + uZero |= pWork[7]; + // 3rd row + uZero |= pWork[8]; + uZero |= pWork[9]; + uOne |= pWork[10]^0x3F800000U; + uZero |= pWork[11]; + // 4th row + uZero |= pWork[12]; + uZero |= pWork[13]; + uZero |= pWork[14]; + uOne |= pWork[15]^0x3F800000U; + // If all zero entries are zero, the uZero==0 + uZero &= 0x7FFFFFFF; // Allow -0.0f + // If all 1.0f entries are 1.0f, then uOne==0 + uOne |= uZero; + return (uOne==0); +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vTemp1 = _mm_cmpeq_ps(M.r[0],g_XMIdentityR0); + XMVECTOR vTemp2 = _mm_cmpeq_ps(M.r[1],g_XMIdentityR1); + XMVECTOR vTemp3 = _mm_cmpeq_ps(M.r[2],g_XMIdentityR2); + XMVECTOR vTemp4 = _mm_cmpeq_ps(M.r[3],g_XMIdentityR3); + vTemp1 = _mm_and_ps(vTemp1,vTemp2); + vTemp3 = _mm_and_ps(vTemp3,vTemp4); + vTemp1 = _mm_and_ps(vTemp1,vTemp3); + return (_mm_movemask_ps(vTemp1)==0x0f); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ +// Computation operations +//------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------ +// Perform a 4x4 matrix multiply by a 4x4 matrix +XMFINLINE XMMATRIX XMMatrixMultiply +( + CXMMATRIX M1, + CXMMATRIX M2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + XMMATRIX mResult; + // Cache the invariants in registers + float x = M1.m[0][0]; + float y = M1.m[0][1]; + float z = M1.m[0][2]; + float w = M1.m[0][3]; + // Perform the operation on the first row + mResult.m[0][0] = (M2.m[0][0]*x)+(M2.m[1][0]*y)+(M2.m[2][0]*z)+(M2.m[3][0]*w); + mResult.m[0][1] = (M2.m[0][1]*x)+(M2.m[1][1]*y)+(M2.m[2][1]*z)+(M2.m[3][1]*w); + mResult.m[0][2] = (M2.m[0][2]*x)+(M2.m[1][2]*y)+(M2.m[2][2]*z)+(M2.m[3][2]*w); + mResult.m[0][3] = (M2.m[0][3]*x)+(M2.m[1][3]*y)+(M2.m[2][3]*z)+(M2.m[3][3]*w); + // Repeat for all the other rows + x = M1.m[1][0]; + y = M1.m[1][1]; + z = M1.m[1][2]; + w = M1.m[1][3]; + mResult.m[1][0] = (M2.m[0][0]*x)+(M2.m[1][0]*y)+(M2.m[2][0]*z)+(M2.m[3][0]*w); + mResult.m[1][1] = (M2.m[0][1]*x)+(M2.m[1][1]*y)+(M2.m[2][1]*z)+(M2.m[3][1]*w); + mResult.m[1][2] = (M2.m[0][2]*x)+(M2.m[1][2]*y)+(M2.m[2][2]*z)+(M2.m[3][2]*w); + mResult.m[1][3] = (M2.m[0][3]*x)+(M2.m[1][3]*y)+(M2.m[2][3]*z)+(M2.m[3][3]*w); + x = M1.m[2][0]; + y = M1.m[2][1]; + z = M1.m[2][2]; + w = M1.m[2][3]; + mResult.m[2][0] = (M2.m[0][0]*x)+(M2.m[1][0]*y)+(M2.m[2][0]*z)+(M2.m[3][0]*w); + mResult.m[2][1] = (M2.m[0][1]*x)+(M2.m[1][1]*y)+(M2.m[2][1]*z)+(M2.m[3][1]*w); + mResult.m[2][2] = (M2.m[0][2]*x)+(M2.m[1][2]*y)+(M2.m[2][2]*z)+(M2.m[3][2]*w); + mResult.m[2][3] = (M2.m[0][3]*x)+(M2.m[1][3]*y)+(M2.m[2][3]*z)+(M2.m[3][3]*w); + x = M1.m[3][0]; + y = M1.m[3][1]; + z = M1.m[3][2]; + w = M1.m[3][3]; + mResult.m[3][0] = (M2.m[0][0]*x)+(M2.m[1][0]*y)+(M2.m[2][0]*z)+(M2.m[3][0]*w); + mResult.m[3][1] = (M2.m[0][1]*x)+(M2.m[1][1]*y)+(M2.m[2][1]*z)+(M2.m[3][1]*w); + mResult.m[3][2] = (M2.m[0][2]*x)+(M2.m[1][2]*y)+(M2.m[2][2]*z)+(M2.m[3][2]*w); + mResult.m[3][3] = (M2.m[0][3]*x)+(M2.m[1][3]*y)+(M2.m[2][3]*z)+(M2.m[3][3]*w); + return mResult; +#elif defined(_XM_SSE_INTRINSICS_) + XMMATRIX mResult; + // Use vW to hold the original row + XMVECTOR vW = M1.r[0]; + // Splat the component X,Y,Z then W + XMVECTOR vX = _mm_shuffle_ps(vW,vW,_MM_SHUFFLE(0,0,0,0)); + XMVECTOR vY = _mm_shuffle_ps(vW,vW,_MM_SHUFFLE(1,1,1,1)); + XMVECTOR vZ = _mm_shuffle_ps(vW,vW,_MM_SHUFFLE(2,2,2,2)); + vW = _mm_shuffle_ps(vW,vW,_MM_SHUFFLE(3,3,3,3)); + // Perform the opertion on the first row + vX = _mm_mul_ps(vX,M2.r[0]); + vY = _mm_mul_ps(vY,M2.r[1]); + vZ = _mm_mul_ps(vZ,M2.r[2]); + vW = _mm_mul_ps(vW,M2.r[3]); + // Perform a binary add to reduce cumulative errors + vX = _mm_add_ps(vX,vZ); + vY = _mm_add_ps(vY,vW); + vX = _mm_add_ps(vX,vY); + mResult.r[0] = vX; + // Repeat for the other 3 rows + vW = M1.r[1]; + vX = _mm_shuffle_ps(vW,vW,_MM_SHUFFLE(0,0,0,0)); + vY = _mm_shuffle_ps(vW,vW,_MM_SHUFFLE(1,1,1,1)); + vZ = _mm_shuffle_ps(vW,vW,_MM_SHUFFLE(2,2,2,2)); + vW = _mm_shuffle_ps(vW,vW,_MM_SHUFFLE(3,3,3,3)); + vX = _mm_mul_ps(vX,M2.r[0]); + vY = _mm_mul_ps(vY,M2.r[1]); + vZ = _mm_mul_ps(vZ,M2.r[2]); + vW = _mm_mul_ps(vW,M2.r[3]); + vX = _mm_add_ps(vX,vZ); + vY = _mm_add_ps(vY,vW); + vX = _mm_add_ps(vX,vY); + mResult.r[1] = vX; + vW = M1.r[2]; + vX = _mm_shuffle_ps(vW,vW,_MM_SHUFFLE(0,0,0,0)); + vY = _mm_shuffle_ps(vW,vW,_MM_SHUFFLE(1,1,1,1)); + vZ = _mm_shuffle_ps(vW,vW,_MM_SHUFFLE(2,2,2,2)); + vW = _mm_shuffle_ps(vW,vW,_MM_SHUFFLE(3,3,3,3)); + vX = _mm_mul_ps(vX,M2.r[0]); + vY = _mm_mul_ps(vY,M2.r[1]); + vZ = _mm_mul_ps(vZ,M2.r[2]); + vW = _mm_mul_ps(vW,M2.r[3]); + vX = _mm_add_ps(vX,vZ); + vY = _mm_add_ps(vY,vW); + vX = _mm_add_ps(vX,vY); + mResult.r[2] = vX; + vW = M1.r[3]; + vX = _mm_shuffle_ps(vW,vW,_MM_SHUFFLE(0,0,0,0)); + vY = _mm_shuffle_ps(vW,vW,_MM_SHUFFLE(1,1,1,1)); + vZ = _mm_shuffle_ps(vW,vW,_MM_SHUFFLE(2,2,2,2)); + vW = _mm_shuffle_ps(vW,vW,_MM_SHUFFLE(3,3,3,3)); + vX = _mm_mul_ps(vX,M2.r[0]); + vY = _mm_mul_ps(vY,M2.r[1]); + vZ = _mm_mul_ps(vZ,M2.r[2]); + vW = _mm_mul_ps(vW,M2.r[3]); + vX = _mm_add_ps(vX,vZ); + vY = _mm_add_ps(vY,vW); + vX = _mm_add_ps(vX,vY); + mResult.r[3] = vX; + return mResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMMATRIX XMMatrixMultiplyTranspose +( + CXMMATRIX M1, + CXMMATRIX M2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + XMMATRIX mResult; + // Cache the invariants in registers + float x = M2.m[0][0]; + float y = M2.m[1][0]; + float z = M2.m[2][0]; + float w = M2.m[3][0]; + // Perform the operation on the first row + mResult.m[0][0] = (M1.m[0][0]*x)+(M1.m[0][1]*y)+(M1.m[0][2]*z)+(M1.m[0][3]*w); + mResult.m[0][1] = (M1.m[1][0]*x)+(M1.m[1][1]*y)+(M1.m[1][2]*z)+(M1.m[1][3]*w); + mResult.m[0][2] = (M1.m[2][0]*x)+(M1.m[2][1]*y)+(M1.m[2][2]*z)+(M1.m[2][3]*w); + mResult.m[0][3] = (M1.m[3][0]*x)+(M1.m[3][1]*y)+(M1.m[3][2]*z)+(M1.m[3][3]*w); + // Repeat for all the other rows + x = M2.m[0][1]; + y = M2.m[1][1]; + z = M2.m[2][1]; + w = M2.m[3][1]; + mResult.m[1][0] = (M1.m[0][0]*x)+(M1.m[0][1]*y)+(M1.m[0][2]*z)+(M1.m[0][3]*w); + mResult.m[1][1] = (M1.m[1][0]*x)+(M1.m[1][1]*y)+(M1.m[1][2]*z)+(M1.m[1][3]*w); + mResult.m[1][2] = (M1.m[2][0]*x)+(M1.m[2][1]*y)+(M1.m[2][2]*z)+(M1.m[2][3]*w); + mResult.m[1][3] = (M1.m[3][0]*x)+(M1.m[3][1]*y)+(M1.m[3][2]*z)+(M1.m[3][3]*w); + x = M2.m[0][2]; + y = M2.m[1][2]; + z = M2.m[2][2]; + w = M2.m[3][2]; + mResult.m[2][0] = (M1.m[0][0]*x)+(M1.m[0][1]*y)+(M1.m[0][2]*z)+(M1.m[0][3]*w); + mResult.m[2][1] = (M1.m[1][0]*x)+(M1.m[1][1]*y)+(M1.m[1][2]*z)+(M1.m[1][3]*w); + mResult.m[2][2] = (M1.m[2][0]*x)+(M1.m[2][1]*y)+(M1.m[2][2]*z)+(M1.m[2][3]*w); + mResult.m[2][3] = (M1.m[3][0]*x)+(M1.m[3][1]*y)+(M1.m[3][2]*z)+(M1.m[3][3]*w); + x = M2.m[0][3]; + y = M2.m[1][3]; + z = M2.m[2][3]; + w = M2.m[3][3]; + mResult.m[3][0] = (M1.m[0][0]*x)+(M1.m[0][1]*y)+(M1.m[0][2]*z)+(M1.m[0][3]*w); + mResult.m[3][1] = (M1.m[1][0]*x)+(M1.m[1][1]*y)+(M1.m[1][2]*z)+(M1.m[1][3]*w); + mResult.m[3][2] = (M1.m[2][0]*x)+(M1.m[2][1]*y)+(M1.m[2][2]*z)+(M1.m[2][3]*w); + mResult.m[3][3] = (M1.m[3][0]*x)+(M1.m[3][1]*y)+(M1.m[3][2]*z)+(M1.m[3][3]*w); + return mResult; +#elif defined(_XM_SSE_INTRINSICS_) + XMMATRIX Product; + XMMATRIX Result; + Product = XMMatrixMultiply(M1, M2); + Result = XMMatrixTranspose(Product); + return Result; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMMATRIX XMMatrixTranspose +( + CXMMATRIX M +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMMATRIX P; + XMMATRIX MT; + + // Original matrix: + // + // m00m01m02m03 + // m10m11m12m13 + // m20m21m22m23 + // m30m31m32m33 + + P.r[0] = XMVectorMergeXY(M.r[0], M.r[2]); // m00m20m01m21 + P.r[1] = XMVectorMergeXY(M.r[1], M.r[3]); // m10m30m11m31 + P.r[2] = XMVectorMergeZW(M.r[0], M.r[2]); // m02m22m03m23 + P.r[3] = XMVectorMergeZW(M.r[1], M.r[3]); // m12m32m13m33 + + MT.r[0] = XMVectorMergeXY(P.r[0], P.r[1]); // m00m10m20m30 + MT.r[1] = XMVectorMergeZW(P.r[0], P.r[1]); // m01m11m21m31 + MT.r[2] = XMVectorMergeXY(P.r[2], P.r[3]); // m02m12m22m32 + MT.r[3] = XMVectorMergeZW(P.r[2], P.r[3]); // m03m13m23m33 + + return MT; + +#elif defined(_XM_SSE_INTRINSICS_) + // x.x,x.y,y.x,y.y + XMVECTOR vTemp1 = _mm_shuffle_ps(M.r[0],M.r[1],_MM_SHUFFLE(1,0,1,0)); + // x.z,x.w,y.z,y.w + XMVECTOR vTemp3 = _mm_shuffle_ps(M.r[0],M.r[1],_MM_SHUFFLE(3,2,3,2)); + // z.x,z.y,w.x,w.y + XMVECTOR vTemp2 = _mm_shuffle_ps(M.r[2],M.r[3],_MM_SHUFFLE(1,0,1,0)); + // z.z,z.w,w.z,w.w + XMVECTOR vTemp4 = _mm_shuffle_ps(M.r[2],M.r[3],_MM_SHUFFLE(3,2,3,2)); + XMMATRIX mResult; + + // x.x,y.x,z.x,w.x + mResult.r[0] = _mm_shuffle_ps(vTemp1, vTemp2,_MM_SHUFFLE(2,0,2,0)); + // x.y,y.y,z.y,w.y + mResult.r[1] = _mm_shuffle_ps(vTemp1, vTemp2,_MM_SHUFFLE(3,1,3,1)); + // x.z,y.z,z.z,w.z + mResult.r[2] = _mm_shuffle_ps(vTemp3, vTemp4,_MM_SHUFFLE(2,0,2,0)); + // x.w,y.w,z.w,w.w + mResult.r[3] = _mm_shuffle_ps(vTemp3, vTemp4,_MM_SHUFFLE(3,1,3,1)); + return mResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ +// Return the inverse and the determinant of a 4x4 matrix +XMINLINE XMMATRIX XMMatrixInverse +( + XMVECTOR* pDeterminant, + CXMMATRIX M +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMMATRIX R; + XMMATRIX MT; + XMVECTOR D0, D1, D2; + XMVECTOR C0, C1, C2, C3, C4, C5, C6, C7; + XMVECTOR V0[4], V1[4]; + XMVECTOR Determinant; + XMVECTOR Reciprocal; + XMMATRIX Result; + static CONST XMVECTORU32 SwizzleXXYY = {XM_PERMUTE_0X, XM_PERMUTE_0X, XM_PERMUTE_0Y, XM_PERMUTE_0Y}; + static CONST XMVECTORU32 SwizzleZWZW = {XM_PERMUTE_0Z, XM_PERMUTE_0W, XM_PERMUTE_0Z, XM_PERMUTE_0W}; + static CONST XMVECTORU32 SwizzleYZXY = {XM_PERMUTE_0Y, XM_PERMUTE_0Z, XM_PERMUTE_0X, XM_PERMUTE_0Y}; + static CONST XMVECTORU32 SwizzleZWYZ = {XM_PERMUTE_0Z, XM_PERMUTE_0W, XM_PERMUTE_0Y, XM_PERMUTE_0Z}; + static CONST XMVECTORU32 SwizzleWXWX = {XM_PERMUTE_0W, XM_PERMUTE_0X, XM_PERMUTE_0W, XM_PERMUTE_0X}; + static CONST XMVECTORU32 SwizzleZXYX = {XM_PERMUTE_0Z, XM_PERMUTE_0X, XM_PERMUTE_0Y, XM_PERMUTE_0X}; + static CONST XMVECTORU32 SwizzleYWXZ = {XM_PERMUTE_0Y, XM_PERMUTE_0W, XM_PERMUTE_0X, XM_PERMUTE_0Z}; + static CONST XMVECTORU32 SwizzleWZWY = {XM_PERMUTE_0W, XM_PERMUTE_0Z, XM_PERMUTE_0W, XM_PERMUTE_0Y}; + static CONST XMVECTORU32 Permute0X0Z1X1Z = {XM_PERMUTE_0X, XM_PERMUTE_0Z, XM_PERMUTE_1X, XM_PERMUTE_1Z}; + static CONST XMVECTORU32 Permute0Y0W1Y1W = {XM_PERMUTE_0Y, XM_PERMUTE_0W, XM_PERMUTE_1Y, XM_PERMUTE_1W}; + static CONST XMVECTORU32 Permute1Y0Y0W0X = {XM_PERMUTE_1Y, XM_PERMUTE_0Y, XM_PERMUTE_0W, XM_PERMUTE_0X}; + static CONST XMVECTORU32 Permute0W0X0Y1X = {XM_PERMUTE_0W, XM_PERMUTE_0X, XM_PERMUTE_0Y, XM_PERMUTE_1X}; + static CONST XMVECTORU32 Permute0Z1Y1X0Z = {XM_PERMUTE_0Z, XM_PERMUTE_1Y, XM_PERMUTE_1X, XM_PERMUTE_0Z}; + static CONST XMVECTORU32 Permute0W1Y0Y0Z = {XM_PERMUTE_0W, XM_PERMUTE_1Y, XM_PERMUTE_0Y, XM_PERMUTE_0Z}; + static CONST XMVECTORU32 Permute0Z0Y1X0X = {XM_PERMUTE_0Z, XM_PERMUTE_0Y, XM_PERMUTE_1X, XM_PERMUTE_0X}; + static CONST XMVECTORU32 Permute1Y0X0W1X = {XM_PERMUTE_1Y, XM_PERMUTE_0X, XM_PERMUTE_0W, XM_PERMUTE_1X}; + static CONST XMVECTORU32 Permute1W0Y0W0X = {XM_PERMUTE_1W, XM_PERMUTE_0Y, XM_PERMUTE_0W, XM_PERMUTE_0X}; + static CONST XMVECTORU32 Permute0W0X0Y1Z = {XM_PERMUTE_0W, XM_PERMUTE_0X, XM_PERMUTE_0Y, XM_PERMUTE_1Z}; + static CONST XMVECTORU32 Permute0Z1W1Z0Z = {XM_PERMUTE_0Z, XM_PERMUTE_1W, XM_PERMUTE_1Z, XM_PERMUTE_0Z}; + static CONST XMVECTORU32 Permute0W1W0Y0Z = {XM_PERMUTE_0W, XM_PERMUTE_1W, XM_PERMUTE_0Y, XM_PERMUTE_0Z}; + static CONST XMVECTORU32 Permute0Z0Y1Z0X = {XM_PERMUTE_0Z, XM_PERMUTE_0Y, XM_PERMUTE_1Z, XM_PERMUTE_0X}; + static CONST XMVECTORU32 Permute1W0X0W1Z = {XM_PERMUTE_1W, XM_PERMUTE_0X, XM_PERMUTE_0W, XM_PERMUTE_1Z}; + + XMASSERT(pDeterminant); + + MT = XMMatrixTranspose(M); + + V0[0] = XMVectorPermute(MT.r[2], MT.r[2], SwizzleXXYY.v); + V1[0] = XMVectorPermute(MT.r[3], MT.r[3], SwizzleZWZW.v); + V0[1] = XMVectorPermute(MT.r[0], MT.r[0], SwizzleXXYY.v); + V1[1] = XMVectorPermute(MT.r[1], MT.r[1], SwizzleZWZW.v); + V0[2] = XMVectorPermute(MT.r[2], MT.r[0], Permute0X0Z1X1Z.v); + V1[2] = XMVectorPermute(MT.r[3], MT.r[1], Permute0Y0W1Y1W.v); + + D0 = XMVectorMultiply(V0[0], V1[0]); + D1 = XMVectorMultiply(V0[1], V1[1]); + D2 = XMVectorMultiply(V0[2], V1[2]); + + V0[0] = XMVectorPermute(MT.r[2], MT.r[2], SwizzleZWZW.v); + V1[0] = XMVectorPermute(MT.r[3], MT.r[3], SwizzleXXYY.v); + V0[1] = XMVectorPermute(MT.r[0], MT.r[0], SwizzleZWZW.v); + V1[1] = XMVectorPermute(MT.r[1], MT.r[1], SwizzleXXYY.v); + V0[2] = XMVectorPermute(MT.r[2], MT.r[0], Permute0Y0W1Y1W.v); + V1[2] = XMVectorPermute(MT.r[3], MT.r[1], Permute0X0Z1X1Z.v); + + D0 = XMVectorNegativeMultiplySubtract(V0[0], V1[0], D0); + D1 = XMVectorNegativeMultiplySubtract(V0[1], V1[1], D1); + D2 = XMVectorNegativeMultiplySubtract(V0[2], V1[2], D2); + + V0[0] = XMVectorPermute(MT.r[1], MT.r[1], SwizzleYZXY.v); + V1[0] = XMVectorPermute(D0, D2, Permute1Y0Y0W0X.v); + V0[1] = XMVectorPermute(MT.r[0], MT.r[0], SwizzleZXYX.v); + V1[1] = XMVectorPermute(D0, D2, Permute0W1Y0Y0Z.v); + V0[2] = XMVectorPermute(MT.r[3], MT.r[3], SwizzleYZXY.v); + V1[2] = XMVectorPermute(D1, D2, Permute1W0Y0W0X.v); + V0[3] = XMVectorPermute(MT.r[2], MT.r[2], SwizzleZXYX.v); + V1[3] = XMVectorPermute(D1, D2, Permute0W1W0Y0Z.v); + + C0 = XMVectorMultiply(V0[0], V1[0]); + C2 = XMVectorMultiply(V0[1], V1[1]); + C4 = XMVectorMultiply(V0[2], V1[2]); + C6 = XMVectorMultiply(V0[3], V1[3]); + + V0[0] = XMVectorPermute(MT.r[1], MT.r[1], SwizzleZWYZ.v); + V1[0] = XMVectorPermute(D0, D2, Permute0W0X0Y1X.v); + V0[1] = XMVectorPermute(MT.r[0], MT.r[0], SwizzleWZWY.v); + V1[1] = XMVectorPermute(D0, D2, Permute0Z0Y1X0X.v); + V0[2] = XMVectorPermute(MT.r[3], MT.r[3], SwizzleZWYZ.v); + V1[2] = XMVectorPermute(D1, D2, Permute0W0X0Y1Z.v); + V0[3] = XMVectorPermute(MT.r[2], MT.r[2], SwizzleWZWY.v); + V1[3] = XMVectorPermute(D1, D2, Permute0Z0Y1Z0X.v); + + C0 = XMVectorNegativeMultiplySubtract(V0[0], V1[0], C0); + C2 = XMVectorNegativeMultiplySubtract(V0[1], V1[1], C2); + C4 = XMVectorNegativeMultiplySubtract(V0[2], V1[2], C4); + C6 = XMVectorNegativeMultiplySubtract(V0[3], V1[3], C6); + + V0[0] = XMVectorPermute(MT.r[1], MT.r[1], SwizzleWXWX.v); + V1[0] = XMVectorPermute(D0, D2, Permute0Z1Y1X0Z.v); + V0[1] = XMVectorPermute(MT.r[0], MT.r[0], SwizzleYWXZ.v); + V1[1] = XMVectorPermute(D0, D2, Permute1Y0X0W1X.v); + V0[2] = XMVectorPermute(MT.r[3], MT.r[3], SwizzleWXWX.v); + V1[2] = XMVectorPermute(D1, D2, Permute0Z1W1Z0Z.v); + V0[3] = XMVectorPermute(MT.r[2], MT.r[2], SwizzleYWXZ.v); + V1[3] = XMVectorPermute(D1, D2, Permute1W0X0W1Z.v); + + C1 = XMVectorNegativeMultiplySubtract(V0[0], V1[0], C0); + C0 = XMVectorMultiplyAdd(V0[0], V1[0], C0); + C3 = XMVectorMultiplyAdd(V0[1], V1[1], C2); + C2 = XMVectorNegativeMultiplySubtract(V0[1], V1[1], C2); + C5 = XMVectorNegativeMultiplySubtract(V0[2], V1[2], C4); + C4 = XMVectorMultiplyAdd(V0[2], V1[2], C4); + C7 = XMVectorMultiplyAdd(V0[3], V1[3], C6); + C6 = XMVectorNegativeMultiplySubtract(V0[3], V1[3], C6); + + R.r[0] = XMVectorSelect(C0, C1, g_XMSelect0101.v); + R.r[1] = XMVectorSelect(C2, C3, g_XMSelect0101.v); + R.r[2] = XMVectorSelect(C4, C5, g_XMSelect0101.v); + R.r[3] = XMVectorSelect(C6, C7, g_XMSelect0101.v); + + Determinant = XMVector4Dot(R.r[0], MT.r[0]); + + *pDeterminant = Determinant; + + Reciprocal = XMVectorReciprocal(Determinant); + + Result.r[0] = XMVectorMultiply(R.r[0], Reciprocal); + Result.r[1] = XMVectorMultiply(R.r[1], Reciprocal); + Result.r[2] = XMVectorMultiply(R.r[2], Reciprocal); + Result.r[3] = XMVectorMultiply(R.r[3], Reciprocal); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pDeterminant); + XMMATRIX MT = XMMatrixTranspose(M); + XMVECTOR V00 = _mm_shuffle_ps(MT.r[2], MT.r[2],_MM_SHUFFLE(1,1,0,0)); + XMVECTOR V10 = _mm_shuffle_ps(MT.r[3], MT.r[3],_MM_SHUFFLE(3,2,3,2)); + XMVECTOR V01 = _mm_shuffle_ps(MT.r[0], MT.r[0],_MM_SHUFFLE(1,1,0,0)); + XMVECTOR V11 = _mm_shuffle_ps(MT.r[1], MT.r[1],_MM_SHUFFLE(3,2,3,2)); + XMVECTOR V02 = _mm_shuffle_ps(MT.r[2], MT.r[0],_MM_SHUFFLE(2,0,2,0)); + XMVECTOR V12 = _mm_shuffle_ps(MT.r[3], MT.r[1],_MM_SHUFFLE(3,1,3,1)); + + XMVECTOR D0 = _mm_mul_ps(V00,V10); + XMVECTOR D1 = _mm_mul_ps(V01,V11); + XMVECTOR D2 = _mm_mul_ps(V02,V12); + + V00 = _mm_shuffle_ps(MT.r[2],MT.r[2],_MM_SHUFFLE(3,2,3,2)); + V10 = _mm_shuffle_ps(MT.r[3],MT.r[3],_MM_SHUFFLE(1,1,0,0)); + V01 = _mm_shuffle_ps(MT.r[0],MT.r[0],_MM_SHUFFLE(3,2,3,2)); + V11 = _mm_shuffle_ps(MT.r[1],MT.r[1],_MM_SHUFFLE(1,1,0,0)); + V02 = _mm_shuffle_ps(MT.r[2],MT.r[0],_MM_SHUFFLE(3,1,3,1)); + V12 = _mm_shuffle_ps(MT.r[3],MT.r[1],_MM_SHUFFLE(2,0,2,0)); + + V00 = _mm_mul_ps(V00,V10); + V01 = _mm_mul_ps(V01,V11); + V02 = _mm_mul_ps(V02,V12); + D0 = _mm_sub_ps(D0,V00); + D1 = _mm_sub_ps(D1,V01); + D2 = _mm_sub_ps(D2,V02); + // V11 = D0Y,D0W,D2Y,D2Y + V11 = _mm_shuffle_ps(D0,D2,_MM_SHUFFLE(1,1,3,1)); + V00 = _mm_shuffle_ps(MT.r[1], MT.r[1],_MM_SHUFFLE(1,0,2,1)); + V10 = _mm_shuffle_ps(V11,D0,_MM_SHUFFLE(0,3,0,2)); + V01 = _mm_shuffle_ps(MT.r[0], MT.r[0],_MM_SHUFFLE(0,1,0,2)); + V11 = _mm_shuffle_ps(V11,D0,_MM_SHUFFLE(2,1,2,1)); + // V13 = D1Y,D1W,D2W,D2W + XMVECTOR V13 = _mm_shuffle_ps(D1,D2,_MM_SHUFFLE(3,3,3,1)); + V02 = _mm_shuffle_ps(MT.r[3], MT.r[3],_MM_SHUFFLE(1,0,2,1)); + V12 = _mm_shuffle_ps(V13,D1,_MM_SHUFFLE(0,3,0,2)); + XMVECTOR V03 = _mm_shuffle_ps(MT.r[2], MT.r[2],_MM_SHUFFLE(0,1,0,2)); + V13 = _mm_shuffle_ps(V13,D1,_MM_SHUFFLE(2,1,2,1)); + + XMVECTOR C0 = _mm_mul_ps(V00,V10); + XMVECTOR C2 = _mm_mul_ps(V01,V11); + XMVECTOR C4 = _mm_mul_ps(V02,V12); + XMVECTOR C6 = _mm_mul_ps(V03,V13); + + // V11 = D0X,D0Y,D2X,D2X + V11 = _mm_shuffle_ps(D0,D2,_MM_SHUFFLE(0,0,1,0)); + V00 = _mm_shuffle_ps(MT.r[1], MT.r[1],_MM_SHUFFLE(2,1,3,2)); + V10 = _mm_shuffle_ps(D0,V11,_MM_SHUFFLE(2,1,0,3)); + V01 = _mm_shuffle_ps(MT.r[0], MT.r[0],_MM_SHUFFLE(1,3,2,3)); + V11 = _mm_shuffle_ps(D0,V11,_MM_SHUFFLE(0,2,1,2)); + // V13 = D1X,D1Y,D2Z,D2Z + V13 = _mm_shuffle_ps(D1,D2,_MM_SHUFFLE(2,2,1,0)); + V02 = _mm_shuffle_ps(MT.r[3], MT.r[3],_MM_SHUFFLE(2,1,3,2)); + V12 = _mm_shuffle_ps(D1,V13,_MM_SHUFFLE(2,1,0,3)); + V03 = _mm_shuffle_ps(MT.r[2], MT.r[2],_MM_SHUFFLE(1,3,2,3)); + V13 = _mm_shuffle_ps(D1,V13,_MM_SHUFFLE(0,2,1,2)); + + V00 = _mm_mul_ps(V00,V10); + V01 = _mm_mul_ps(V01,V11); + V02 = _mm_mul_ps(V02,V12); + V03 = _mm_mul_ps(V03,V13); + C0 = _mm_sub_ps(C0,V00); + C2 = _mm_sub_ps(C2,V01); + C4 = _mm_sub_ps(C4,V02); + C6 = _mm_sub_ps(C6,V03); + + V00 = _mm_shuffle_ps(MT.r[1],MT.r[1],_MM_SHUFFLE(0,3,0,3)); + // V10 = D0Z,D0Z,D2X,D2Y + V10 = _mm_shuffle_ps(D0,D2,_MM_SHUFFLE(1,0,2,2)); + V10 = _mm_shuffle_ps(V10,V10,_MM_SHUFFLE(0,2,3,0)); + V01 = _mm_shuffle_ps(MT.r[0],MT.r[0],_MM_SHUFFLE(2,0,3,1)); + // V11 = D0X,D0W,D2X,D2Y + V11 = _mm_shuffle_ps(D0,D2,_MM_SHUFFLE(1,0,3,0)); + V11 = _mm_shuffle_ps(V11,V11,_MM_SHUFFLE(2,1,0,3)); + V02 = _mm_shuffle_ps(MT.r[3],MT.r[3],_MM_SHUFFLE(0,3,0,3)); + // V12 = D1Z,D1Z,D2Z,D2W + V12 = _mm_shuffle_ps(D1,D2,_MM_SHUFFLE(3,2,2,2)); + V12 = _mm_shuffle_ps(V12,V12,_MM_SHUFFLE(0,2,3,0)); + V03 = _mm_shuffle_ps(MT.r[2],MT.r[2],_MM_SHUFFLE(2,0,3,1)); + // V13 = D1X,D1W,D2Z,D2W + V13 = _mm_shuffle_ps(D1,D2,_MM_SHUFFLE(3,2,3,0)); + V13 = _mm_shuffle_ps(V13,V13,_MM_SHUFFLE(2,1,0,3)); + + V00 = _mm_mul_ps(V00,V10); + V01 = _mm_mul_ps(V01,V11); + V02 = _mm_mul_ps(V02,V12); + V03 = _mm_mul_ps(V03,V13); + XMVECTOR C1 = _mm_sub_ps(C0,V00); + C0 = _mm_add_ps(C0,V00); + XMVECTOR C3 = _mm_add_ps(C2,V01); + C2 = _mm_sub_ps(C2,V01); + XMVECTOR C5 = _mm_sub_ps(C4,V02); + C4 = _mm_add_ps(C4,V02); + XMVECTOR C7 = _mm_add_ps(C6,V03); + C6 = _mm_sub_ps(C6,V03); + + C0 = _mm_shuffle_ps(C0,C1,_MM_SHUFFLE(3,1,2,0)); + C2 = _mm_shuffle_ps(C2,C3,_MM_SHUFFLE(3,1,2,0)); + C4 = _mm_shuffle_ps(C4,C5,_MM_SHUFFLE(3,1,2,0)); + C6 = _mm_shuffle_ps(C6,C7,_MM_SHUFFLE(3,1,2,0)); + C0 = _mm_shuffle_ps(C0,C0,_MM_SHUFFLE(3,1,2,0)); + C2 = _mm_shuffle_ps(C2,C2,_MM_SHUFFLE(3,1,2,0)); + C4 = _mm_shuffle_ps(C4,C4,_MM_SHUFFLE(3,1,2,0)); + C6 = _mm_shuffle_ps(C6,C6,_MM_SHUFFLE(3,1,2,0)); + // Get the determinate + XMVECTOR vTemp = XMVector4Dot(C0,MT.r[0]); + *pDeterminant = vTemp; + vTemp = _mm_div_ps(g_XMOne,vTemp); + XMMATRIX mResult; + mResult.r[0] = _mm_mul_ps(C0,vTemp); + mResult.r[1] = _mm_mul_ps(C2,vTemp); + mResult.r[2] = _mm_mul_ps(C4,vTemp); + mResult.r[3] = _mm_mul_ps(C6,vTemp); + return mResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMINLINE XMVECTOR XMMatrixDeterminant +( + CXMMATRIX M +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V0, V1, V2, V3, V4, V5; + XMVECTOR P0, P1, P2, R, S; + XMVECTOR Result; + static CONST XMVECTORU32 SwizzleYXXX = {XM_PERMUTE_0Y, XM_PERMUTE_0X, XM_PERMUTE_0X, XM_PERMUTE_0X}; + static CONST XMVECTORU32 SwizzleZZYY = {XM_PERMUTE_0Z, XM_PERMUTE_0Z, XM_PERMUTE_0Y, XM_PERMUTE_0Y}; + static CONST XMVECTORU32 SwizzleWWWZ = {XM_PERMUTE_0W, XM_PERMUTE_0W, XM_PERMUTE_0W, XM_PERMUTE_0Z}; + static CONST XMVECTOR Sign = {1.0f, -1.0f, 1.0f, -1.0f}; + + V0 = XMVectorPermute(M.r[2], M.r[2], SwizzleYXXX.v); + V1 = XMVectorPermute(M.r[3], M.r[3], SwizzleZZYY.v); + V2 = XMVectorPermute(M.r[2], M.r[2], SwizzleYXXX.v); + V3 = XMVectorPermute(M.r[3], M.r[3], SwizzleWWWZ.v); + V4 = XMVectorPermute(M.r[2], M.r[2], SwizzleZZYY.v); + V5 = XMVectorPermute(M.r[3], M.r[3], SwizzleWWWZ.v); + + P0 = XMVectorMultiply(V0, V1); + P1 = XMVectorMultiply(V2, V3); + P2 = XMVectorMultiply(V4, V5); + + V0 = XMVectorPermute(M.r[2], M.r[2], SwizzleZZYY.v); + V1 = XMVectorPermute(M.r[3], M.r[3], SwizzleYXXX.v); + V2 = XMVectorPermute(M.r[2], M.r[2], SwizzleWWWZ.v); + V3 = XMVectorPermute(M.r[3], M.r[3], SwizzleYXXX.v); + V4 = XMVectorPermute(M.r[2], M.r[2], SwizzleWWWZ.v); + V5 = XMVectorPermute(M.r[3], M.r[3], SwizzleZZYY.v); + + P0 = XMVectorNegativeMultiplySubtract(V0, V1, P0); + P1 = XMVectorNegativeMultiplySubtract(V2, V3, P1); + P2 = XMVectorNegativeMultiplySubtract(V4, V5, P2); + + V0 = XMVectorPermute(M.r[1], M.r[1], SwizzleWWWZ.v); + V1 = XMVectorPermute(M.r[1], M.r[1], SwizzleZZYY.v); + V2 = XMVectorPermute(M.r[1], M.r[1], SwizzleYXXX.v); + + S = XMVectorMultiply(M.r[0], Sign); + R = XMVectorMultiply(V0, P0); + R = XMVectorNegativeMultiplySubtract(V1, P1, R); + R = XMVectorMultiplyAdd(V2, P2, R); + + Result = XMVector4Dot(S, R); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR V0, V1, V2, V3, V4, V5; + XMVECTOR P0, P1, P2, R, S; + XMVECTOR Result; + static CONST XMVECTORU32 SwizzleYXXX = {XM_PERMUTE_0Y, XM_PERMUTE_0X, XM_PERMUTE_0X, XM_PERMUTE_0X}; + static CONST XMVECTORU32 SwizzleZZYY = {XM_PERMUTE_0Z, XM_PERMUTE_0Z, XM_PERMUTE_0Y, XM_PERMUTE_0Y}; + static CONST XMVECTORU32 SwizzleWWWZ = {XM_PERMUTE_0W, XM_PERMUTE_0W, XM_PERMUTE_0W, XM_PERMUTE_0Z}; + static CONST XMVECTORF32 Sign = {1.0f, -1.0f, 1.0f, -1.0f}; + + V0 = XMVectorPermute(M.r[2], M.r[2], SwizzleYXXX); + V1 = XMVectorPermute(M.r[3], M.r[3], SwizzleZZYY); + V2 = XMVectorPermute(M.r[2], M.r[2], SwizzleYXXX); + V3 = XMVectorPermute(M.r[3], M.r[3], SwizzleWWWZ); + V4 = XMVectorPermute(M.r[2], M.r[2], SwizzleZZYY); + V5 = XMVectorPermute(M.r[3], M.r[3], SwizzleWWWZ); + + P0 = _mm_mul_ps(V0, V1); + P1 = _mm_mul_ps(V2, V3); + P2 = _mm_mul_ps(V4, V5); + + V0 = XMVectorPermute(M.r[2], M.r[2], SwizzleZZYY); + V1 = XMVectorPermute(M.r[3], M.r[3], SwizzleYXXX); + V2 = XMVectorPermute(M.r[2], M.r[2], SwizzleWWWZ); + V3 = XMVectorPermute(M.r[3], M.r[3], SwizzleYXXX); + V4 = XMVectorPermute(M.r[2], M.r[2], SwizzleWWWZ); + V5 = XMVectorPermute(M.r[3], M.r[3], SwizzleZZYY); + + P0 = XMVectorNegativeMultiplySubtract(V0, V1, P0); + P1 = XMVectorNegativeMultiplySubtract(V2, V3, P1); + P2 = XMVectorNegativeMultiplySubtract(V4, V5, P2); + + V0 = XMVectorPermute(M.r[1], M.r[1], SwizzleWWWZ); + V1 = XMVectorPermute(M.r[1], M.r[1], SwizzleZZYY); + V2 = XMVectorPermute(M.r[1], M.r[1], SwizzleYXXX); + + S = _mm_mul_ps(M.r[0], Sign); + R = _mm_mul_ps(V0, P0); + R = XMVectorNegativeMultiplySubtract(V1, P1, R); + R = XMVectorMultiplyAdd(V2, P2, R); + + Result = XMVector4Dot(S, R); + + return Result; + +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +#define XMRANKDECOMPOSE(a, b, c, x, y, z) \ + if((x) < (y)) \ + { \ + if((y) < (z)) \ + { \ + (a) = 2; \ + (b) = 1; \ + (c) = 0; \ + } \ + else \ + { \ + (a) = 1; \ + \ + if((x) < (z)) \ + { \ + (b) = 2; \ + (c) = 0; \ + } \ + else \ + { \ + (b) = 0; \ + (c) = 2; \ + } \ + } \ + } \ + else \ + { \ + if((x) < (z)) \ + { \ + (a) = 2; \ + (b) = 0; \ + (c) = 1; \ + } \ + else \ + { \ + (a) = 0; \ + \ + if((y) < (z)) \ + { \ + (b) = 2; \ + (c) = 1; \ + } \ + else \ + { \ + (b) = 1; \ + (c) = 2; \ + } \ + } \ + } + +#define XM_DECOMP_EPSILON 0.0001f + +XMINLINE BOOL XMMatrixDecompose( XMVECTOR *outScale, XMVECTOR *outRotQuat, XMVECTOR *outTrans, CXMMATRIX M ) +{ + FLOAT fDet; + FLOAT *pfScales; + XMVECTOR *ppvBasis[3]; + XMMATRIX matTemp; + UINT a, b, c; + static const XMVECTOR *pvCanonicalBasis[3] = { + &g_XMIdentityR0.v, + &g_XMIdentityR1.v, + &g_XMIdentityR2.v + }; + + // Get the translation + outTrans[0] = M.r[3]; + + ppvBasis[0] = &matTemp.r[0]; + ppvBasis[1] = &matTemp.r[1]; + ppvBasis[2] = &matTemp.r[2]; + + matTemp.r[0] = M.r[0]; + matTemp.r[1] = M.r[1]; + matTemp.r[2] = M.r[2]; + matTemp.r[3] = g_XMIdentityR3.v; + + pfScales = (FLOAT *)outScale; + + XMVectorGetXPtr(&pfScales[0],XMVector3Length(ppvBasis[0][0])); + XMVectorGetXPtr(&pfScales[1],XMVector3Length(ppvBasis[1][0])); + XMVectorGetXPtr(&pfScales[2],XMVector3Length(ppvBasis[2][0])); + + XMRANKDECOMPOSE(a, b, c, pfScales[0], pfScales[1], pfScales[2]) + + if(pfScales[a] < XM_DECOMP_EPSILON) + { + ppvBasis[a][0] = pvCanonicalBasis[a][0]; + } + ppvBasis[a][0] = XMVector3Normalize(ppvBasis[a][0]); + + if(pfScales[b] < XM_DECOMP_EPSILON) + { + UINT aa, bb, cc; + FLOAT fAbsX, fAbsY, fAbsZ; + + fAbsX = fabsf(XMVectorGetX(ppvBasis[a][0])); + fAbsY = fabsf(XMVectorGetY(ppvBasis[a][0])); + fAbsZ = fabsf(XMVectorGetZ(ppvBasis[a][0])); + + XMRANKDECOMPOSE(aa, bb, cc, fAbsX, fAbsY, fAbsZ) + + ppvBasis[b][0] = XMVector3Cross(ppvBasis[a][0],pvCanonicalBasis[cc][0]); + } + + ppvBasis[b][0] = XMVector3Normalize(ppvBasis[b][0]); + + if(pfScales[c] < XM_DECOMP_EPSILON) + { + ppvBasis[c][0] = XMVector3Cross(ppvBasis[a][0],ppvBasis[b][0]); + } + + ppvBasis[c][0] = XMVector3Normalize(ppvBasis[c][0]); + + fDet = XMVectorGetX(XMMatrixDeterminant(matTemp)); + + // use Kramer's rule to check for handedness of coordinate system + if(fDet < 0.0f) + { + // switch coordinate system by negating the scale and inverting the basis vector on the x-axis + pfScales[a] = -pfScales[a]; + ppvBasis[a][0] = XMVectorNegate(ppvBasis[a][0]); + + fDet = -fDet; + } + + fDet -= 1.0f; + fDet *= fDet; + + if(XM_DECOMP_EPSILON < fDet) + { +// Non-SRT matrix encountered + return FALSE; + } + + // generate the quaternion from the matrix + outRotQuat[0] = XMQuaternionRotationMatrix(matTemp); + return TRUE; +} + +//------------------------------------------------------------------------------ +// Transformation operations +//------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------ + +XMFINLINE XMMATRIX XMMatrixIdentity() +{ +#if defined(_XM_NO_INTRINSICS_) + + XMMATRIX M; + M.r[0] = g_XMIdentityR0.v; + M.r[1] = g_XMIdentityR1.v; + M.r[2] = g_XMIdentityR2.v; + M.r[3] = g_XMIdentityR3.v; + return M; + +#elif defined(_XM_SSE_INTRINSICS_) + XMMATRIX M; + M.r[0] = g_XMIdentityR0; + M.r[1] = g_XMIdentityR1; + M.r[2] = g_XMIdentityR2; + M.r[3] = g_XMIdentityR3; + return M; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMMATRIX XMMatrixSet +( + FLOAT m00, FLOAT m01, FLOAT m02, FLOAT m03, + FLOAT m10, FLOAT m11, FLOAT m12, FLOAT m13, + FLOAT m20, FLOAT m21, FLOAT m22, FLOAT m23, + FLOAT m30, FLOAT m31, FLOAT m32, FLOAT m33 +) +{ + XMMATRIX M; + + M.r[0] = XMVectorSet(m00, m01, m02, m03); + M.r[1] = XMVectorSet(m10, m11, m12, m13); + M.r[2] = XMVectorSet(m20, m21, m22, m23); + M.r[3] = XMVectorSet(m30, m31, m32, m33); + + return M; +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMMATRIX XMMatrixTranslation +( + FLOAT OffsetX, + FLOAT OffsetY, + FLOAT OffsetZ +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMMATRIX M; + + M.m[0][0] = 1.0f; + M.m[0][1] = 0.0f; + M.m[0][2] = 0.0f; + M.m[0][3] = 0.0f; + + M.m[1][0] = 0.0f; + M.m[1][1] = 1.0f; + M.m[1][2] = 0.0f; + M.m[1][3] = 0.0f; + + M.m[2][0] = 0.0f; + M.m[2][1] = 0.0f; + M.m[2][2] = 1.0f; + M.m[2][3] = 0.0f; + + M.m[3][0] = OffsetX; + M.m[3][1] = OffsetY; + M.m[3][2] = OffsetZ; + M.m[3][3] = 1.0f; + return M; + +#elif defined(_XM_SSE_INTRINSICS_) + XMMATRIX M; + M.r[0] = g_XMIdentityR0; + M.r[1] = g_XMIdentityR1; + M.r[2] = g_XMIdentityR2; + M.r[3] = _mm_set_ps(1.0f,OffsetZ,OffsetY,OffsetX); + return M; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + + +//------------------------------------------------------------------------------ + +XMFINLINE XMMATRIX XMMatrixTranslationFromVector +( + FXMVECTOR Offset +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMMATRIX M; + M.m[0][0] = 1.0f; + M.m[0][1] = 0.0f; + M.m[0][2] = 0.0f; + M.m[0][3] = 0.0f; + + M.m[1][0] = 0.0f; + M.m[1][1] = 1.0f; + M.m[1][2] = 0.0f; + M.m[1][3] = 0.0f; + + M.m[2][0] = 0.0f; + M.m[2][1] = 0.0f; + M.m[2][2] = 1.0f; + M.m[2][3] = 0.0f; + + M.m[3][0] = Offset.vector4_f32[0]; + M.m[3][1] = Offset.vector4_f32[1]; + M.m[3][2] = Offset.vector4_f32[2]; + M.m[3][3] = 1.0f; + return M; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vTemp = _mm_and_ps(Offset,g_XMMask3); + vTemp = _mm_or_ps(vTemp,g_XMIdentityR3); + XMMATRIX M; + M.r[0] = g_XMIdentityR0; + M.r[1] = g_XMIdentityR1; + M.r[2] = g_XMIdentityR2; + M.r[3] = vTemp; + return M; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMMATRIX XMMatrixScaling +( + FLOAT ScaleX, + FLOAT ScaleY, + FLOAT ScaleZ +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMMATRIX M; + + M.r[0] = XMVectorSet(ScaleX, 0.0f, 0.0f, 0.0f); + M.r[1] = XMVectorSet(0.0f, ScaleY, 0.0f, 0.0f); + M.r[2] = XMVectorSet(0.0f, 0.0f, ScaleZ, 0.0f); + + M.r[3] = g_XMIdentityR3.v; + + return M; + +#elif defined(_XM_SSE_INTRINSICS_) + XMMATRIX M; + M.r[0] = _mm_set_ps( 0, 0, 0, ScaleX ); + M.r[1] = _mm_set_ps( 0, 0, ScaleY, 0 ); + M.r[2] = _mm_set_ps( 0, ScaleZ, 0, 0 ); + M.r[3] = g_XMIdentityR3; + return M; +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMMATRIX XMMatrixScalingFromVector +( + FXMVECTOR Scale +) +{ +#if defined(_XM_NO_INTRINSICS_) + XMMATRIX M; + M.m[0][0] = Scale.vector4_f32[0]; + M.m[0][1] = 0.0f; + M.m[0][2] = 0.0f; + M.m[0][3] = 0.0f; + + M.m[1][0] = 0.0f; + M.m[1][1] = Scale.vector4_f32[1]; + M.m[1][2] = 0.0f; + M.m[1][3] = 0.0f; + + M.m[2][0] = 0.0f; + M.m[2][1] = 0.0f; + M.m[2][2] = Scale.vector4_f32[2]; + M.m[2][3] = 0.0f; + + M.m[3][0] = 0.0f; + M.m[3][1] = 0.0f; + M.m[3][2] = 0.0f; + M.m[3][3] = 1.0f; + return M; + +#elif defined(_XM_SSE_INTRINSICS_) + XMMATRIX M; + M.r[0] = _mm_and_ps(Scale,g_XMMaskX); + M.r[1] = _mm_and_ps(Scale,g_XMMaskY); + M.r[2] = _mm_and_ps(Scale,g_XMMaskZ); + M.r[3] = g_XMIdentityR3; + return M; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMINLINE XMMATRIX XMMatrixRotationX +( + FLOAT Angle +) +{ +#if defined(_XM_NO_INTRINSICS_) + XMMATRIX M; + + FLOAT fSinAngle = sinf(Angle); + FLOAT fCosAngle = cosf(Angle); + + M.m[0][0] = 1.0f; + M.m[0][1] = 0.0f; + M.m[0][2] = 0.0f; + M.m[0][3] = 0.0f; + + M.m[1][0] = 0.0f; + M.m[1][1] = fCosAngle; + M.m[1][2] = fSinAngle; + M.m[1][3] = 0.0f; + + M.m[2][0] = 0.0f; + M.m[2][1] = -fSinAngle; + M.m[2][2] = fCosAngle; + M.m[2][3] = 0.0f; + + M.m[3][0] = 0.0f; + M.m[3][1] = 0.0f; + M.m[3][2] = 0.0f; + M.m[3][3] = 1.0f; + return M; + +#elif defined(_XM_SSE_INTRINSICS_) + FLOAT SinAngle = sinf(Angle); + FLOAT CosAngle = cosf(Angle); + + XMVECTOR vSin = _mm_set_ss(SinAngle); + XMVECTOR vCos = _mm_set_ss(CosAngle); + // x = 0,y = cos,z = sin, w = 0 + vCos = _mm_shuffle_ps(vCos,vSin,_MM_SHUFFLE(3,0,0,3)); + XMMATRIX M; + M.r[0] = g_XMIdentityR0; + M.r[1] = vCos; + // x = 0,y = sin,z = cos, w = 0 + vCos = _mm_shuffle_ps(vCos,vCos,_MM_SHUFFLE(3,1,2,0)); + // x = 0,y = -sin,z = cos, w = 0 + vCos = _mm_mul_ps(vCos,g_XMNegateY); + M.r[2] = vCos; + M.r[3] = g_XMIdentityR3; + return M; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMINLINE XMMATRIX XMMatrixRotationY +( + FLOAT Angle +) +{ +#if defined(_XM_NO_INTRINSICS_) + XMMATRIX M; + + FLOAT fSinAngle = sinf(Angle); + FLOAT fCosAngle = cosf(Angle); + + M.m[0][0] = fCosAngle; + M.m[0][1] = 0.0f; + M.m[0][2] = -fSinAngle; + M.m[0][3] = 0.0f; + + M.m[1][0] = 0.0f; + M.m[1][1] = 1.0f; + M.m[1][2] = 0.0f; + M.m[1][3] = 0.0f; + + M.m[2][0] = fSinAngle; + M.m[2][1] = 0.0f; + M.m[2][2] = fCosAngle; + M.m[2][3] = 0.0f; + + M.m[3][0] = 0.0f; + M.m[3][1] = 0.0f; + M.m[3][2] = 0.0f; + M.m[3][3] = 1.0f; + return M; +#elif defined(_XM_SSE_INTRINSICS_) + FLOAT SinAngle = sinf(Angle); + FLOAT CosAngle = cosf(Angle); + + XMVECTOR vSin = _mm_set_ss(SinAngle); + XMVECTOR vCos = _mm_set_ss(CosAngle); + // x = sin,y = 0,z = cos, w = 0 + vSin = _mm_shuffle_ps(vSin,vCos,_MM_SHUFFLE(3,0,3,0)); + XMMATRIX M; + M.r[2] = vSin; + M.r[1] = g_XMIdentityR1; + // x = cos,y = 0,z = sin, w = 0 + vSin = _mm_shuffle_ps(vSin,vSin,_MM_SHUFFLE(3,0,1,2)); + // x = cos,y = 0,z = -sin, w = 0 + vSin = _mm_mul_ps(vSin,g_XMNegateZ); + M.r[0] = vSin; + M.r[3] = g_XMIdentityR3; + return M; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMINLINE XMMATRIX XMMatrixRotationZ +( + FLOAT Angle +) +{ +#if defined(_XM_NO_INTRINSICS_) + XMMATRIX M; + + FLOAT fSinAngle = sinf(Angle); + FLOAT fCosAngle = cosf(Angle); + + M.m[0][0] = fCosAngle; + M.m[0][1] = fSinAngle; + M.m[0][2] = 0.0f; + M.m[0][3] = 0.0f; + + M.m[1][0] = -fSinAngle; + M.m[1][1] = fCosAngle; + M.m[1][2] = 0.0f; + M.m[1][3] = 0.0f; + + M.m[2][0] = 0.0f; + M.m[2][1] = 0.0f; + M.m[2][2] = 1.0f; + M.m[2][3] = 0.0f; + + M.m[3][0] = 0.0f; + M.m[3][1] = 0.0f; + M.m[3][2] = 0.0f; + M.m[3][3] = 1.0f; + return M; + +#elif defined(_XM_SSE_INTRINSICS_) + FLOAT SinAngle = sinf(Angle); + FLOAT CosAngle = cosf(Angle); + + XMVECTOR vSin = _mm_set_ss(SinAngle); + XMVECTOR vCos = _mm_set_ss(CosAngle); + // x = cos,y = sin,z = 0, w = 0 + vCos = _mm_unpacklo_ps(vCos,vSin); + XMMATRIX M; + M.r[0] = vCos; + // x = sin,y = cos,z = 0, w = 0 + vCos = _mm_shuffle_ps(vCos,vCos,_MM_SHUFFLE(3,2,0,1)); + // x = cos,y = -sin,z = 0, w = 0 + vCos = _mm_mul_ps(vCos,g_XMNegateX); + M.r[1] = vCos; + M.r[2] = g_XMIdentityR2; + M.r[3] = g_XMIdentityR3; + return M; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMINLINE XMMATRIX XMMatrixRotationRollPitchYaw +( + FLOAT Pitch, + FLOAT Yaw, + FLOAT Roll +) +{ + XMVECTOR Angles; + XMMATRIX M; + + Angles = XMVectorSet(Pitch, Yaw, Roll, 0.0f); + M = XMMatrixRotationRollPitchYawFromVector(Angles); + + return M; +} + +//------------------------------------------------------------------------------ + +XMINLINE XMMATRIX XMMatrixRotationRollPitchYawFromVector +( + FXMVECTOR Angles // +) +{ + XMVECTOR Q; + XMMATRIX M; + + Q = XMQuaternionRotationRollPitchYawFromVector(Angles); + M = XMMatrixRotationQuaternion(Q); + + return M; +} + +//------------------------------------------------------------------------------ + +XMINLINE XMMATRIX XMMatrixRotationNormal +( + FXMVECTOR NormalAxis, + FLOAT Angle +) +{ +#if defined(_XM_NO_INTRINSICS_) + XMVECTOR A; + XMVECTOR N0, N1; + XMVECTOR V0, V1, V2; + XMVECTOR R0, R1, R2; + XMVECTOR C0, C1, C2; + XMMATRIX M; + static CONST XMVECTORU32 SwizzleYZXW = {XM_PERMUTE_0Y, XM_PERMUTE_0Z, XM_PERMUTE_0X, XM_PERMUTE_0W}; + static CONST XMVECTORU32 SwizzleZXYW = {XM_PERMUTE_0Z, XM_PERMUTE_0X, XM_PERMUTE_0Y, XM_PERMUTE_0W}; + static CONST XMVECTORU32 Permute0Z1Y1Z0X = {XM_PERMUTE_0Z, XM_PERMUTE_1Y, XM_PERMUTE_1Z, XM_PERMUTE_0X}; + static CONST XMVECTORU32 Permute0Y1X0Y1X = {XM_PERMUTE_0Y, XM_PERMUTE_1X, XM_PERMUTE_0Y, XM_PERMUTE_1X}; + static CONST XMVECTORU32 Permute0X1X1Y0W = {XM_PERMUTE_0X, XM_PERMUTE_1X, XM_PERMUTE_1Y, XM_PERMUTE_0W}; + static CONST XMVECTORU32 Permute1Z0Y1W0W = {XM_PERMUTE_1Z, XM_PERMUTE_0Y, XM_PERMUTE_1W, XM_PERMUTE_0W}; + static CONST XMVECTORU32 Permute1X1Y0Z0W = {XM_PERMUTE_1X, XM_PERMUTE_1Y, XM_PERMUTE_0Z, XM_PERMUTE_0W}; + + FLOAT fSinAngle = sinf(Angle); + FLOAT fCosAngle = cosf(Angle); + + A = XMVectorSet(fSinAngle, fCosAngle, 1.0f - fCosAngle, 0.0f); + + C2 = XMVectorSplatZ(A); + C1 = XMVectorSplatY(A); + C0 = XMVectorSplatX(A); + + N0 = XMVectorPermute(NormalAxis, NormalAxis, SwizzleYZXW.v); + N1 = XMVectorPermute(NormalAxis, NormalAxis, SwizzleZXYW.v); + + V0 = XMVectorMultiply(C2, N0); + V0 = XMVectorMultiply(V0, N1); + + R0 = XMVectorMultiply(C2, NormalAxis); + R0 = XMVectorMultiplyAdd(R0, NormalAxis, C1); + + R1 = XMVectorMultiplyAdd(C0, NormalAxis, V0); + R2 = XMVectorNegativeMultiplySubtract(C0, NormalAxis, V0); + + V0 = XMVectorSelect(A, R0, g_XMSelect1110.v); + V1 = XMVectorPermute(R1, R2, Permute0Z1Y1Z0X.v); + V2 = XMVectorPermute(R1, R2, Permute0Y1X0Y1X.v); + + M.r[0] = XMVectorPermute(V0, V1, Permute0X1X1Y0W.v); + M.r[1] = XMVectorPermute(V0, V1, Permute1Z0Y1W0W.v); + M.r[2] = XMVectorPermute(V0, V2, Permute1X1Y0Z0W.v); + M.r[3] = g_XMIdentityR3.v; + + return M; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR N0, N1; + XMVECTOR V0, V1, V2; + XMVECTOR R0, R1, R2; + XMVECTOR C0, C1, C2; + XMMATRIX M; + + FLOAT fSinAngle = sinf(Angle); + FLOAT fCosAngle = cosf(Angle); + + C2 = _mm_set_ps1(1.0f - fCosAngle); + C1 = _mm_set_ps1(fCosAngle); + C0 = _mm_set_ps1(fSinAngle); + + N0 = _mm_shuffle_ps(NormalAxis,NormalAxis,_MM_SHUFFLE(3,0,2,1)); +// N0 = XMVectorPermute(NormalAxis, NormalAxis, SwizzleYZXW); + N1 = _mm_shuffle_ps(NormalAxis,NormalAxis,_MM_SHUFFLE(3,1,0,2)); +// N1 = XMVectorPermute(NormalAxis, NormalAxis, SwizzleZXYW); + + V0 = _mm_mul_ps(C2, N0); + V0 = _mm_mul_ps(V0, N1); + + R0 = _mm_mul_ps(C2, NormalAxis); + R0 = _mm_mul_ps(R0, NormalAxis); + R0 = _mm_add_ps(R0, C1); + + R1 = _mm_mul_ps(C0, NormalAxis); + R1 = _mm_add_ps(R1, V0); + R2 = _mm_mul_ps(C0, NormalAxis); + R2 = _mm_sub_ps(V0,R2); + + V0 = _mm_and_ps(R0,g_XMMask3); +// V0 = XMVectorSelect(A, R0, g_XMSelect1110); + V1 = _mm_shuffle_ps(R1,R2,_MM_SHUFFLE(2,1,2,0)); + V1 = _mm_shuffle_ps(V1,V1,_MM_SHUFFLE(0,3,2,1)); +// V1 = XMVectorPermute(R1, R2, Permute0Z1Y1Z0X); + V2 = _mm_shuffle_ps(R1,R2,_MM_SHUFFLE(0,0,1,1)); + V2 = _mm_shuffle_ps(V2,V2,_MM_SHUFFLE(2,0,2,0)); +// V2 = XMVectorPermute(R1, R2, Permute0Y1X0Y1X); + + R2 = _mm_shuffle_ps(V0,V1,_MM_SHUFFLE(1,0,3,0)); + R2 = _mm_shuffle_ps(R2,R2,_MM_SHUFFLE(1,3,2,0)); + M.r[0] = R2; +// M.r[0] = XMVectorPermute(V0, V1, Permute0X1X1Y0W); + R2 = _mm_shuffle_ps(V0,V1,_MM_SHUFFLE(3,2,3,1)); + R2 = _mm_shuffle_ps(R2,R2,_MM_SHUFFLE(1,3,0,2)); + M.r[1] = R2; +// M.r[1] = XMVectorPermute(V0, V1, Permute1Z0Y1W0W); + V2 = _mm_shuffle_ps(V2,V0,_MM_SHUFFLE(3,2,1,0)); +// R2 = _mm_shuffle_ps(R2,R2,_MM_SHUFFLE(3,2,1,0)); + M.r[2] = V2; +// M.r[2] = XMVectorPermute(V0, V2, Permute1X1Y0Z0W); + M.r[3] = g_XMIdentityR3; + return M; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMINLINE XMMATRIX XMMatrixRotationAxis +( + FXMVECTOR Axis, + FLOAT Angle +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Normal; + XMMATRIX M; + + XMASSERT(!XMVector3Equal(Axis, XMVectorZero())); + XMASSERT(!XMVector3IsInfinite(Axis)); + + Normal = XMVector3Normalize(Axis); + M = XMMatrixRotationNormal(Normal, Angle); + + return M; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(!XMVector3Equal(Axis, XMVectorZero())); + XMASSERT(!XMVector3IsInfinite(Axis)); + XMVECTOR Normal = XMVector3Normalize(Axis); + XMMATRIX M = XMMatrixRotationNormal(Normal, Angle); + return M; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMMATRIX XMMatrixRotationQuaternion +( + FXMVECTOR Quaternion +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMMATRIX M; + XMVECTOR Q0, Q1; + XMVECTOR V0, V1, V2; + XMVECTOR R0, R1, R2; + static CONST XMVECTOR Constant1110 = {1.0f, 1.0f, 1.0f, 0.0f}; + static CONST XMVECTORU32 SwizzleXXYW = {XM_PERMUTE_0X, XM_PERMUTE_0X, XM_PERMUTE_0Y, XM_PERMUTE_0W}; + static CONST XMVECTORU32 SwizzleZYZW = {XM_PERMUTE_0Z, XM_PERMUTE_0Y, XM_PERMUTE_0Z, XM_PERMUTE_0W}; + static CONST XMVECTORU32 SwizzleYZXW = {XM_PERMUTE_0Y, XM_PERMUTE_0Z, XM_PERMUTE_0X, XM_PERMUTE_0W}; + static CONST XMVECTORU32 Permute0Y0X0X1W = {XM_PERMUTE_0Y, XM_PERMUTE_0X, XM_PERMUTE_0X, XM_PERMUTE_1W}; + static CONST XMVECTORU32 Permute0Z0Z0Y1W = {XM_PERMUTE_0Z, XM_PERMUTE_0Z, XM_PERMUTE_0Y, XM_PERMUTE_1W}; + static CONST XMVECTORU32 Permute0Y1X1Y0Z = {XM_PERMUTE_0Y, XM_PERMUTE_1X, XM_PERMUTE_1Y, XM_PERMUTE_0Z}; + static CONST XMVECTORU32 Permute0X1Z0X1Z = {XM_PERMUTE_0X, XM_PERMUTE_1Z, XM_PERMUTE_0X, XM_PERMUTE_1Z}; + static CONST XMVECTORU32 Permute0X1X1Y0W = {XM_PERMUTE_0X, XM_PERMUTE_1X, XM_PERMUTE_1Y, XM_PERMUTE_0W}; + static CONST XMVECTORU32 Permute1Z0Y1W0W = {XM_PERMUTE_1Z, XM_PERMUTE_0Y, XM_PERMUTE_1W, XM_PERMUTE_0W}; + static CONST XMVECTORU32 Permute1X1Y0Z0W = {XM_PERMUTE_1X, XM_PERMUTE_1Y, XM_PERMUTE_0Z, XM_PERMUTE_0W}; + + Q0 = XMVectorAdd(Quaternion, Quaternion); + Q1 = XMVectorMultiply(Quaternion, Q0); + + V0 = XMVectorPermute(Q1, Constant1110, Permute0Y0X0X1W.v); + V1 = XMVectorPermute(Q1, Constant1110, Permute0Z0Z0Y1W.v); + R0 = XMVectorSubtract(Constant1110, V0); + R0 = XMVectorSubtract(R0, V1); + + V0 = XMVectorPermute(Quaternion, Quaternion, SwizzleXXYW.v); + V1 = XMVectorPermute(Q0, Q0, SwizzleZYZW.v); + V0 = XMVectorMultiply(V0, V1); + + V1 = XMVectorSplatW(Quaternion); + V2 = XMVectorPermute(Q0, Q0, SwizzleYZXW.v); + V1 = XMVectorMultiply(V1, V2); + + R1 = XMVectorAdd(V0, V1); + R2 = XMVectorSubtract(V0, V1); + + V0 = XMVectorPermute(R1, R2, Permute0Y1X1Y0Z.v); + V1 = XMVectorPermute(R1, R2, Permute0X1Z0X1Z.v); + + M.r[0] = XMVectorPermute(R0, V0, Permute0X1X1Y0W.v); + M.r[1] = XMVectorPermute(R0, V0, Permute1Z0Y1W0W.v); + M.r[2] = XMVectorPermute(R0, V1, Permute1X1Y0Z0W.v); + M.r[3] = g_XMIdentityR3.v; + + return M; + +#elif defined(_XM_SSE_INTRINSICS_) + XMMATRIX M; + XMVECTOR Q0, Q1; + XMVECTOR V0, V1, V2; + XMVECTOR R0, R1, R2; + static CONST XMVECTORF32 Constant1110 = {1.0f, 1.0f, 1.0f, 0.0f}; + + Q0 = _mm_add_ps(Quaternion,Quaternion); + Q1 = _mm_mul_ps(Quaternion,Q0); + + V0 = _mm_shuffle_ps(Q1,Q1,_MM_SHUFFLE(3,0,0,1)); + V0 = _mm_and_ps(V0,g_XMMask3); +// V0 = XMVectorPermute(Q1, Constant1110,Permute0Y0X0X1W); + V1 = _mm_shuffle_ps(Q1,Q1,_MM_SHUFFLE(3,1,2,2)); + V1 = _mm_and_ps(V1,g_XMMask3); +// V1 = XMVectorPermute(Q1, Constant1110,Permute0Z0Z0Y1W); + R0 = _mm_sub_ps(Constant1110,V0); + R0 = _mm_sub_ps(R0, V1); + + V0 = _mm_shuffle_ps(Quaternion,Quaternion,_MM_SHUFFLE(3,1,0,0)); +// V0 = XMVectorPermute(Quaternion, Quaternion,SwizzleXXYW); + V1 = _mm_shuffle_ps(Q0,Q0,_MM_SHUFFLE(3,2,1,2)); +// V1 = XMVectorPermute(Q0, Q0,SwizzleZYZW); + V0 = _mm_mul_ps(V0, V1); + + V1 = _mm_shuffle_ps(Quaternion,Quaternion,_MM_SHUFFLE(3,3,3,3)); +// V1 = XMVectorSplatW(Quaternion); + V2 = _mm_shuffle_ps(Q0,Q0,_MM_SHUFFLE(3,0,2,1)); +// V2 = XMVectorPermute(Q0, Q0,SwizzleYZXW); + V1 = _mm_mul_ps(V1, V2); + + R1 = _mm_add_ps(V0, V1); + R2 = _mm_sub_ps(V0, V1); + + V0 = _mm_shuffle_ps(R1,R2,_MM_SHUFFLE(1,0,2,1)); + V0 = _mm_shuffle_ps(V0,V0,_MM_SHUFFLE(1,3,2,0)); +// V0 = XMVectorPermute(R1, R2,Permute0Y1X1Y0Z); + V1 = _mm_shuffle_ps(R1,R2,_MM_SHUFFLE(2,2,0,0)); + V1 = _mm_shuffle_ps(V1,V1,_MM_SHUFFLE(2,0,2,0)); +// V1 = XMVectorPermute(R1, R2,Permute0X1Z0X1Z); + + Q1 = _mm_shuffle_ps(R0,V0,_MM_SHUFFLE(1,0,3,0)); + Q1 = _mm_shuffle_ps(Q1,Q1,_MM_SHUFFLE(1,3,2,0)); + M.r[0] = Q1; +// M.r[0] = XMVectorPermute(R0, V0,Permute0X1X1Y0W); + Q1 = _mm_shuffle_ps(R0,V0,_MM_SHUFFLE(3,2,3,1)); + Q1 = _mm_shuffle_ps(Q1,Q1,_MM_SHUFFLE(1,3,0,2)); + M.r[1] = Q1; +// M.r[1] = XMVectorPermute(R0, V0,Permute1Z0Y1W0W); + Q1 = _mm_shuffle_ps(V1,R0,_MM_SHUFFLE(3,2,1,0)); + M.r[2] = Q1; +// M.r[2] = XMVectorPermute(R0, V1,Permute1X1Y0Z0W); + M.r[3] = g_XMIdentityR3; + return M; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMINLINE XMMATRIX XMMatrixTransformation2D +( + FXMVECTOR ScalingOrigin, + FLOAT ScalingOrientation, + FXMVECTOR Scaling, + FXMVECTOR RotationOrigin, + FLOAT Rotation, + CXMVECTOR Translation +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMMATRIX M; + XMVECTOR VScaling; + XMVECTOR NegScalingOrigin; + XMVECTOR VScalingOrigin; + XMMATRIX MScalingOriginI; + XMMATRIX MScalingOrientation; + XMMATRIX MScalingOrientationT; + XMMATRIX MScaling; + XMVECTOR VRotationOrigin; + XMMATRIX MRotation; + XMVECTOR VTranslation; + + // M = Inverse(MScalingOrigin) * Transpose(MScalingOrientation) * MScaling * MScalingOrientation * + // MScalingOrigin * Inverse(MRotationOrigin) * MRotation * MRotationOrigin * MTranslation; + + VScalingOrigin = XMVectorSelect(g_XMSelect1100.v, ScalingOrigin, g_XMSelect1100.v); + NegScalingOrigin = XMVectorNegate(VScalingOrigin); + + MScalingOriginI = XMMatrixTranslationFromVector(NegScalingOrigin); + MScalingOrientation = XMMatrixRotationZ(ScalingOrientation); + MScalingOrientationT = XMMatrixTranspose(MScalingOrientation); + VScaling = XMVectorSelect(g_XMOne.v, Scaling, g_XMSelect1100.v); + MScaling = XMMatrixScalingFromVector(VScaling); + VRotationOrigin = XMVectorSelect(g_XMSelect1100.v, RotationOrigin, g_XMSelect1100.v); + MRotation = XMMatrixRotationZ(Rotation); + VTranslation = XMVectorSelect(g_XMSelect1100.v, Translation,g_XMSelect1100.v); + + M = XMMatrixMultiply(MScalingOriginI, MScalingOrientationT); + M = XMMatrixMultiply(M, MScaling); + M = XMMatrixMultiply(M, MScalingOrientation); + M.r[3] = XMVectorAdd(M.r[3], VScalingOrigin); + M.r[3] = XMVectorSubtract(M.r[3], VRotationOrigin); + M = XMMatrixMultiply(M, MRotation); + M.r[3] = XMVectorAdd(M.r[3], VRotationOrigin); + M.r[3] = XMVectorAdd(M.r[3], VTranslation); + + return M; + +#elif defined(_XM_SSE_INTRINSICS_) + XMMATRIX M; + XMVECTOR VScaling; + XMVECTOR NegScalingOrigin; + XMVECTOR VScalingOrigin; + XMMATRIX MScalingOriginI; + XMMATRIX MScalingOrientation; + XMMATRIX MScalingOrientationT; + XMMATRIX MScaling; + XMVECTOR VRotationOrigin; + XMMATRIX MRotation; + XMVECTOR VTranslation; + + // M = Inverse(MScalingOrigin) * Transpose(MScalingOrientation) * MScaling * MScalingOrientation * + // MScalingOrigin * Inverse(MRotationOrigin) * MRotation * MRotationOrigin * MTranslation; + static const XMVECTORU32 Mask2 = {0xFFFFFFFF,0xFFFFFFFF,0,0}; + static const XMVECTORF32 ZWOne = {0,0,1.0f,1.0f}; + + VScalingOrigin = _mm_and_ps(ScalingOrigin, Mask2); + NegScalingOrigin = XMVectorNegate(VScalingOrigin); + + MScalingOriginI = XMMatrixTranslationFromVector(NegScalingOrigin); + MScalingOrientation = XMMatrixRotationZ(ScalingOrientation); + MScalingOrientationT = XMMatrixTranspose(MScalingOrientation); + VScaling = _mm_and_ps(Scaling, Mask2); + VScaling = _mm_or_ps(VScaling,ZWOne); + MScaling = XMMatrixScalingFromVector(VScaling); + VRotationOrigin = _mm_and_ps(RotationOrigin, Mask2); + MRotation = XMMatrixRotationZ(Rotation); + VTranslation = _mm_and_ps(Translation, Mask2); + + M = XMMatrixMultiply(MScalingOriginI, MScalingOrientationT); + M = XMMatrixMultiply(M, MScaling); + M = XMMatrixMultiply(M, MScalingOrientation); + M.r[3] = XMVectorAdd(M.r[3], VScalingOrigin); + M.r[3] = XMVectorSubtract(M.r[3], VRotationOrigin); + M = XMMatrixMultiply(M, MRotation); + M.r[3] = XMVectorAdd(M.r[3], VRotationOrigin); + M.r[3] = XMVectorAdd(M.r[3], VTranslation); + + return M; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMINLINE XMMATRIX XMMatrixTransformation +( + FXMVECTOR ScalingOrigin, + FXMVECTOR ScalingOrientationQuaternion, + FXMVECTOR Scaling, + CXMVECTOR RotationOrigin, + CXMVECTOR RotationQuaternion, + CXMVECTOR Translation +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMMATRIX M; + XMVECTOR NegScalingOrigin; + XMVECTOR VScalingOrigin; + XMMATRIX MScalingOriginI; + XMMATRIX MScalingOrientation; + XMMATRIX MScalingOrientationT; + XMMATRIX MScaling; + XMVECTOR VRotationOrigin; + XMMATRIX MRotation; + XMVECTOR VTranslation; + + // M = Inverse(MScalingOrigin) * Transpose(MScalingOrientation) * MScaling * MScalingOrientation * + // MScalingOrigin * Inverse(MRotationOrigin) * MRotation * MRotationOrigin * MTranslation; + + VScalingOrigin = XMVectorSelect(g_XMSelect1110.v, ScalingOrigin, g_XMSelect1110.v); + NegScalingOrigin = XMVectorNegate(ScalingOrigin); + + MScalingOriginI = XMMatrixTranslationFromVector(NegScalingOrigin); + MScalingOrientation = XMMatrixRotationQuaternion(ScalingOrientationQuaternion); + MScalingOrientationT = XMMatrixTranspose(MScalingOrientation); + MScaling = XMMatrixScalingFromVector(Scaling); + VRotationOrigin = XMVectorSelect(g_XMSelect1110.v, RotationOrigin, g_XMSelect1110.v); + MRotation = XMMatrixRotationQuaternion(RotationQuaternion); + VTranslation = XMVectorSelect(g_XMSelect1110.v, Translation, g_XMSelect1110.v); + + M = XMMatrixMultiply(MScalingOriginI, MScalingOrientationT); + M = XMMatrixMultiply(M, MScaling); + M = XMMatrixMultiply(M, MScalingOrientation); + M.r[3] = XMVectorAdd(M.r[3], VScalingOrigin); + M.r[3] = XMVectorSubtract(M.r[3], VRotationOrigin); + M = XMMatrixMultiply(M, MRotation); + M.r[3] = XMVectorAdd(M.r[3], VRotationOrigin); + M.r[3] = XMVectorAdd(M.r[3], VTranslation); + + return M; + +#elif defined(_XM_SSE_INTRINSICS_) + XMMATRIX M; + XMVECTOR NegScalingOrigin; + XMVECTOR VScalingOrigin; + XMMATRIX MScalingOriginI; + XMMATRIX MScalingOrientation; + XMMATRIX MScalingOrientationT; + XMMATRIX MScaling; + XMVECTOR VRotationOrigin; + XMMATRIX MRotation; + XMVECTOR VTranslation; + + // M = Inverse(MScalingOrigin) * Transpose(MScalingOrientation) * MScaling * MScalingOrientation * + // MScalingOrigin * Inverse(MRotationOrigin) * MRotation * MRotationOrigin * MTranslation; + + VScalingOrigin = _mm_and_ps(ScalingOrigin,g_XMMask3); + NegScalingOrigin = XMVectorNegate(ScalingOrigin); + + MScalingOriginI = XMMatrixTranslationFromVector(NegScalingOrigin); + MScalingOrientation = XMMatrixRotationQuaternion(ScalingOrientationQuaternion); + MScalingOrientationT = XMMatrixTranspose(MScalingOrientation); + MScaling = XMMatrixScalingFromVector(Scaling); + VRotationOrigin = _mm_and_ps(RotationOrigin,g_XMMask3); + MRotation = XMMatrixRotationQuaternion(RotationQuaternion); + VTranslation = _mm_and_ps(Translation,g_XMMask3); + + M = XMMatrixMultiply(MScalingOriginI, MScalingOrientationT); + M = XMMatrixMultiply(M, MScaling); + M = XMMatrixMultiply(M, MScalingOrientation); + M.r[3] = XMVectorAdd(M.r[3], VScalingOrigin); + M.r[3] = XMVectorSubtract(M.r[3], VRotationOrigin); + M = XMMatrixMultiply(M, MRotation); + M.r[3] = XMVectorAdd(M.r[3], VRotationOrigin); + M.r[3] = XMVectorAdd(M.r[3], VTranslation); + + return M; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMINLINE XMMATRIX XMMatrixAffineTransformation2D +( + FXMVECTOR Scaling, + FXMVECTOR RotationOrigin, + FLOAT Rotation, + FXMVECTOR Translation +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMMATRIX M; + XMVECTOR VScaling; + XMMATRIX MScaling; + XMVECTOR VRotationOrigin; + XMMATRIX MRotation; + XMVECTOR VTranslation; + + // M = MScaling * Inverse(MRotationOrigin) * MRotation * MRotationOrigin * MTranslation; + + VScaling = XMVectorSelect(g_XMOne.v, Scaling, g_XMSelect1100.v); + MScaling = XMMatrixScalingFromVector(VScaling); + VRotationOrigin = XMVectorSelect(g_XMSelect1100.v, RotationOrigin, g_XMSelect1100.v); + MRotation = XMMatrixRotationZ(Rotation); + VTranslation = XMVectorSelect(g_XMSelect1100.v, Translation,g_XMSelect1100.v); + + M = MScaling; + M.r[3] = XMVectorSubtract(M.r[3], VRotationOrigin); + M = XMMatrixMultiply(M, MRotation); + M.r[3] = XMVectorAdd(M.r[3], VRotationOrigin); + M.r[3] = XMVectorAdd(M.r[3], VTranslation); + + return M; + +#elif defined(_XM_SSE_INTRINSICS_) + XMMATRIX M; + XMVECTOR VScaling; + XMMATRIX MScaling; + XMVECTOR VRotationOrigin; + XMMATRIX MRotation; + XMVECTOR VTranslation; + static const XMVECTORU32 Mask2 = {0xFFFFFFFFU,0xFFFFFFFFU,0,0}; + static const XMVECTORF32 ZW1 = {0,0,1.0f,1.0f}; + + // M = MScaling * Inverse(MRotationOrigin) * MRotation * MRotationOrigin * MTranslation; + + VScaling = _mm_and_ps(Scaling, Mask2); + VScaling = _mm_or_ps(VScaling, ZW1); + MScaling = XMMatrixScalingFromVector(VScaling); + VRotationOrigin = _mm_and_ps(RotationOrigin, Mask2); + MRotation = XMMatrixRotationZ(Rotation); + VTranslation = _mm_and_ps(Translation, Mask2); + + M = MScaling; + M.r[3] = _mm_sub_ps(M.r[3], VRotationOrigin); + M = XMMatrixMultiply(M, MRotation); + M.r[3] = _mm_add_ps(M.r[3], VRotationOrigin); + M.r[3] = _mm_add_ps(M.r[3], VTranslation); + return M; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMINLINE XMMATRIX XMMatrixAffineTransformation +( + FXMVECTOR Scaling, + FXMVECTOR RotationOrigin, + FXMVECTOR RotationQuaternion, + CXMVECTOR Translation +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMMATRIX M; + XMMATRIX MScaling; + XMVECTOR VRotationOrigin; + XMMATRIX MRotation; + XMVECTOR VTranslation; + + // M = MScaling * Inverse(MRotationOrigin) * MRotation * MRotationOrigin * MTranslation; + + MScaling = XMMatrixScalingFromVector(Scaling); + VRotationOrigin = XMVectorSelect(g_XMSelect1110.v, RotationOrigin,g_XMSelect1110.v); + MRotation = XMMatrixRotationQuaternion(RotationQuaternion); + VTranslation = XMVectorSelect(g_XMSelect1110.v, Translation,g_XMSelect1110.v); + + M = MScaling; + M.r[3] = XMVectorSubtract(M.r[3], VRotationOrigin); + M = XMMatrixMultiply(M, MRotation); + M.r[3] = XMVectorAdd(M.r[3], VRotationOrigin); + M.r[3] = XMVectorAdd(M.r[3], VTranslation); + + return M; + +#elif defined(_XM_SSE_INTRINSICS_) + XMMATRIX M; + XMMATRIX MScaling; + XMVECTOR VRotationOrigin; + XMMATRIX MRotation; + XMVECTOR VTranslation; + + // M = MScaling * Inverse(MRotationOrigin) * MRotation * MRotationOrigin * MTranslation; + + MScaling = XMMatrixScalingFromVector(Scaling); + VRotationOrigin = _mm_and_ps(RotationOrigin,g_XMMask3); + MRotation = XMMatrixRotationQuaternion(RotationQuaternion); + VTranslation = _mm_and_ps(Translation,g_XMMask3); + + M = MScaling; + M.r[3] = _mm_sub_ps(M.r[3], VRotationOrigin); + M = XMMatrixMultiply(M, MRotation); + M.r[3] = _mm_add_ps(M.r[3], VRotationOrigin); + M.r[3] = _mm_add_ps(M.r[3], VTranslation); + + return M; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMMATRIX XMMatrixReflect +( + FXMVECTOR ReflectionPlane +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR P; + XMVECTOR S; + XMVECTOR A, B, C, D; + XMMATRIX M; + static CONST XMVECTOR NegativeTwo = {-2.0f, -2.0f, -2.0f, 0.0f}; + + XMASSERT(!XMVector3Equal(ReflectionPlane, XMVectorZero())); + XMASSERT(!XMPlaneIsInfinite(ReflectionPlane)); + + P = XMPlaneNormalize(ReflectionPlane); + S = XMVectorMultiply(P, NegativeTwo); + + A = XMVectorSplatX(P); + B = XMVectorSplatY(P); + C = XMVectorSplatZ(P); + D = XMVectorSplatW(P); + + M.r[0] = XMVectorMultiplyAdd(A, S, g_XMIdentityR0.v); + M.r[1] = XMVectorMultiplyAdd(B, S, g_XMIdentityR1.v); + M.r[2] = XMVectorMultiplyAdd(C, S, g_XMIdentityR2.v); + M.r[3] = XMVectorMultiplyAdd(D, S, g_XMIdentityR3.v); + + return M; + +#elif defined(_XM_SSE_INTRINSICS_) + XMMATRIX M; + static CONST XMVECTORF32 NegativeTwo = {-2.0f, -2.0f, -2.0f, 0.0f}; + + XMASSERT(!XMVector3Equal(ReflectionPlane, XMVectorZero())); + XMASSERT(!XMPlaneIsInfinite(ReflectionPlane)); + + XMVECTOR P = XMPlaneNormalize(ReflectionPlane); + XMVECTOR S = _mm_mul_ps(P,NegativeTwo); + XMVECTOR X = _mm_shuffle_ps(P,P,_MM_SHUFFLE(0,0,0,0)); + XMVECTOR Y = _mm_shuffle_ps(P,P,_MM_SHUFFLE(1,1,1,1)); + XMVECTOR Z = _mm_shuffle_ps(P,P,_MM_SHUFFLE(2,2,2,2)); + P = _mm_shuffle_ps(P,P,_MM_SHUFFLE(3,3,3,3)); + X = _mm_mul_ps(X,S); + Y = _mm_mul_ps(Y,S); + Z = _mm_mul_ps(Z,S); + P = _mm_mul_ps(P,S); + X = _mm_add_ps(X,g_XMIdentityR0); + Y = _mm_add_ps(Y,g_XMIdentityR1); + Z = _mm_add_ps(Z,g_XMIdentityR2); + P = _mm_add_ps(P,g_XMIdentityR3); + M.r[0] = X; + M.r[1] = Y; + M.r[2] = Z; + M.r[3] = P; + return M; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMMATRIX XMMatrixShadow +( + FXMVECTOR ShadowPlane, + FXMVECTOR LightPosition +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR P; + XMVECTOR Dot; + XMVECTOR A, B, C, D; + XMMATRIX M; + static CONST XMVECTORU32 Select0001 = {XM_SELECT_0, XM_SELECT_0, XM_SELECT_0, XM_SELECT_1}; + + XMASSERT(!XMVector3Equal(ShadowPlane, XMVectorZero())); + XMASSERT(!XMPlaneIsInfinite(ShadowPlane)); + + P = XMPlaneNormalize(ShadowPlane); + Dot = XMPlaneDot(P, LightPosition); + P = XMVectorNegate(P); + D = XMVectorSplatW(P); + C = XMVectorSplatZ(P); + B = XMVectorSplatY(P); + A = XMVectorSplatX(P); + Dot = XMVectorSelect(Select0001.v, Dot, Select0001.v); + M.r[3] = XMVectorMultiplyAdd(D, LightPosition, Dot); + Dot = XMVectorRotateLeft(Dot, 1); + M.r[2] = XMVectorMultiplyAdd(C, LightPosition, Dot); + Dot = XMVectorRotateLeft(Dot, 1); + M.r[1] = XMVectorMultiplyAdd(B, LightPosition, Dot); + Dot = XMVectorRotateLeft(Dot, 1); + M.r[0] = XMVectorMultiplyAdd(A, LightPosition, Dot); + return M; + +#elif defined(_XM_SSE_INTRINSICS_) + XMMATRIX M; + XMASSERT(!XMVector3Equal(ShadowPlane, XMVectorZero())); + XMASSERT(!XMPlaneIsInfinite(ShadowPlane)); + XMVECTOR P = XMPlaneNormalize(ShadowPlane); + XMVECTOR Dot = XMPlaneDot(P,LightPosition); + // Negate + P = _mm_mul_ps(P,g_XMNegativeOne); + XMVECTOR X = _mm_shuffle_ps(P,P,_MM_SHUFFLE(0,0,0,0)); + XMVECTOR Y = _mm_shuffle_ps(P,P,_MM_SHUFFLE(1,1,1,1)); + XMVECTOR Z = _mm_shuffle_ps(P,P,_MM_SHUFFLE(2,2,2,2)); + P = _mm_shuffle_ps(P,P,_MM_SHUFFLE(3,3,3,3)); + Dot = _mm_and_ps(Dot,g_XMMaskW); + X = _mm_mul_ps(X,LightPosition); + Y = _mm_mul_ps(Y,LightPosition); + Z = _mm_mul_ps(Z,LightPosition); + P = _mm_mul_ps(P,LightPosition); + P = _mm_add_ps(P,Dot); + Dot = _mm_shuffle_ps(Dot,Dot,_MM_SHUFFLE(0,3,2,1)); + Z = _mm_add_ps(Z,Dot); + Dot = _mm_shuffle_ps(Dot,Dot,_MM_SHUFFLE(0,3,2,1)); + Y = _mm_add_ps(Y,Dot); + Dot = _mm_shuffle_ps(Dot,Dot,_MM_SHUFFLE(0,3,2,1)); + X = _mm_add_ps(X,Dot); + // Store the resulting matrix + M.r[0] = X; + M.r[1] = Y; + M.r[2] = Z; + M.r[3] = P; + return M; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ +// View and projection initialization operations +//------------------------------------------------------------------------------ + + +//------------------------------------------------------------------------------ + +XMFINLINE XMMATRIX XMMatrixLookAtLH +( + FXMVECTOR EyePosition, + FXMVECTOR FocusPosition, + FXMVECTOR UpDirection +) +{ + XMVECTOR EyeDirection; + XMMATRIX M; + + EyeDirection = XMVectorSubtract(FocusPosition, EyePosition); + M = XMMatrixLookToLH(EyePosition, EyeDirection, UpDirection); + + return M; +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMMATRIX XMMatrixLookAtRH +( + FXMVECTOR EyePosition, + FXMVECTOR FocusPosition, + FXMVECTOR UpDirection +) +{ + XMVECTOR NegEyeDirection; + XMMATRIX M; + + NegEyeDirection = XMVectorSubtract(EyePosition, FocusPosition); + M = XMMatrixLookToLH(EyePosition, NegEyeDirection, UpDirection); + + return M; +} + +//------------------------------------------------------------------------------ + +XMINLINE XMMATRIX XMMatrixLookToLH +( + FXMVECTOR EyePosition, + FXMVECTOR EyeDirection, + FXMVECTOR UpDirection +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR NegEyePosition; + XMVECTOR D0, D1, D2; + XMVECTOR R0, R1, R2; + XMMATRIX M; + + XMASSERT(!XMVector3Equal(EyeDirection, XMVectorZero())); + XMASSERT(!XMVector3IsInfinite(EyeDirection)); + XMASSERT(!XMVector3Equal(UpDirection, XMVectorZero())); + XMASSERT(!XMVector3IsInfinite(UpDirection)); + + R2 = XMVector3Normalize(EyeDirection); + + R0 = XMVector3Cross(UpDirection, R2); + R0 = XMVector3Normalize(R0); + + R1 = XMVector3Cross(R2, R0); + + NegEyePosition = XMVectorNegate(EyePosition); + + D0 = XMVector3Dot(R0, NegEyePosition); + D1 = XMVector3Dot(R1, NegEyePosition); + D2 = XMVector3Dot(R2, NegEyePosition); + + M.r[0] = XMVectorSelect(D0, R0, g_XMSelect1110.v); + M.r[1] = XMVectorSelect(D1, R1, g_XMSelect1110.v); + M.r[2] = XMVectorSelect(D2, R2, g_XMSelect1110.v); + M.r[3] = g_XMIdentityR3.v; + + M = XMMatrixTranspose(M); + + return M; + +#elif defined(_XM_SSE_INTRINSICS_) + XMMATRIX M; + + XMASSERT(!XMVector3Equal(EyeDirection, XMVectorZero())); + XMASSERT(!XMVector3IsInfinite(EyeDirection)); + XMASSERT(!XMVector3Equal(UpDirection, XMVectorZero())); + XMASSERT(!XMVector3IsInfinite(UpDirection)); + + XMVECTOR R2 = XMVector3Normalize(EyeDirection); + XMVECTOR R0 = XMVector3Cross(UpDirection, R2); + R0 = XMVector3Normalize(R0); + XMVECTOR R1 = XMVector3Cross(R2,R0); + XMVECTOR NegEyePosition = _mm_mul_ps(EyePosition,g_XMNegativeOne); + XMVECTOR D0 = XMVector3Dot(R0,NegEyePosition); + XMVECTOR D1 = XMVector3Dot(R1,NegEyePosition); + XMVECTOR D2 = XMVector3Dot(R2,NegEyePosition); + R0 = _mm_and_ps(R0,g_XMMask3); + R1 = _mm_and_ps(R1,g_XMMask3); + R2 = _mm_and_ps(R2,g_XMMask3); + D0 = _mm_and_ps(D0,g_XMMaskW); + D1 = _mm_and_ps(D1,g_XMMaskW); + D2 = _mm_and_ps(D2,g_XMMaskW); + D0 = _mm_or_ps(D0,R0); + D1 = _mm_or_ps(D1,R1); + D2 = _mm_or_ps(D2,R2); + M.r[0] = D0; + M.r[1] = D1; + M.r[2] = D2; + M.r[3] = g_XMIdentityR3; + M = XMMatrixTranspose(M); + return M; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMMATRIX XMMatrixLookToRH +( + FXMVECTOR EyePosition, + FXMVECTOR EyeDirection, + FXMVECTOR UpDirection +) +{ + XMVECTOR NegEyeDirection; + XMMATRIX M; + + NegEyeDirection = XMVectorNegate(EyeDirection); + M = XMMatrixLookToLH(EyePosition, NegEyeDirection, UpDirection); + + return M; +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMMATRIX XMMatrixPerspectiveLH +( + FLOAT ViewWidth, + FLOAT ViewHeight, + FLOAT NearZ, + FLOAT FarZ +) +{ +#if defined(_XM_NO_INTRINSICS_) + + FLOAT TwoNearZ, fRange; + XMMATRIX M; + + XMASSERT(!XMScalarNearEqual(ViewWidth, 0.0f, 0.00001f)); + XMASSERT(!XMScalarNearEqual(ViewHeight, 0.0f, 0.00001f)); + XMASSERT(!XMScalarNearEqual(FarZ, NearZ, 0.00001f)); + + TwoNearZ = NearZ + NearZ; + fRange = FarZ / (FarZ - NearZ); + M.m[0][0] = TwoNearZ / ViewWidth; + M.m[0][1] = 0.0f; + M.m[0][2] = 0.0f; + M.m[0][3] = 0.0f; + + M.m[1][0] = 0.0f; + M.m[1][1] = TwoNearZ / ViewHeight; + M.m[1][2] = 0.0f; + M.m[1][3] = 0.0f; + + M.m[2][0] = 0.0f; + M.m[2][1] = 0.0f; + M.m[2][2] = fRange; + M.m[2][3] = 1.0f; + + M.m[3][0] = 0.0f; + M.m[3][1] = 0.0f; + M.m[3][2] = -fRange * NearZ; + M.m[3][3] = 0.0f; + + return M; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(!XMScalarNearEqual(ViewWidth, 0.0f, 0.00001f)); + XMASSERT(!XMScalarNearEqual(ViewHeight, 0.0f, 0.00001f)); + XMASSERT(!XMScalarNearEqual(FarZ, NearZ, 0.00001f)); + + XMMATRIX M; + FLOAT TwoNearZ = NearZ + NearZ; + FLOAT fRange = FarZ / (FarZ - NearZ); + // Note: This is recorded on the stack + XMVECTOR rMem = { + TwoNearZ / ViewWidth, + TwoNearZ / ViewHeight, + fRange, + -fRange * NearZ + }; + // Copy from memory to SSE register + XMVECTOR vValues = rMem; + XMVECTOR vTemp = _mm_setzero_ps(); + // Copy x only + vTemp = _mm_move_ss(vTemp,vValues); + // TwoNearZ / ViewWidth,0,0,0 + M.r[0] = vTemp; + // 0,TwoNearZ / ViewHeight,0,0 + vTemp = vValues; + vTemp = _mm_and_ps(vTemp,g_XMMaskY); + M.r[1] = vTemp; + // x=fRange,y=-fRange * NearZ,0,1.0f + vValues = _mm_shuffle_ps(vValues,g_XMIdentityR3,_MM_SHUFFLE(3,2,3,2)); + // 0,0,fRange,1.0f + vTemp = _mm_setzero_ps(); + vTemp = _mm_shuffle_ps(vTemp,vValues,_MM_SHUFFLE(3,0,0,0)); + M.r[2] = vTemp; + // 0,0,-fRange * NearZ,0 + vTemp = _mm_shuffle_ps(vTemp,vValues,_MM_SHUFFLE(2,1,0,0)); + M.r[3] = vTemp; + + return M; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMMATRIX XMMatrixPerspectiveRH +( + FLOAT ViewWidth, + FLOAT ViewHeight, + FLOAT NearZ, + FLOAT FarZ +) +{ +#if defined(_XM_NO_INTRINSICS_) + + FLOAT TwoNearZ, fRange; + XMMATRIX M; + + XMASSERT(!XMScalarNearEqual(ViewWidth, 0.0f, 0.00001f)); + XMASSERT(!XMScalarNearEqual(ViewHeight, 0.0f, 0.00001f)); + XMASSERT(!XMScalarNearEqual(FarZ, NearZ, 0.00001f)); + + TwoNearZ = NearZ + NearZ; + fRange = FarZ / (NearZ - FarZ); + M.m[0][0] = TwoNearZ / ViewWidth; + M.m[0][1] = 0.0f; + M.m[0][2] = 0.0f; + M.m[0][3] = 0.0f; + + M.m[1][0] = 0.0f; + M.m[1][1] = TwoNearZ / ViewHeight; + M.m[1][2] = 0.0f; + M.m[1][3] = 0.0f; + + M.m[2][0] = 0.0f; + M.m[2][1] = 0.0f; + M.m[2][2] = fRange; + M.m[2][3] = -1.0f; + + M.m[3][0] = 0.0f; + M.m[3][1] = 0.0f; + M.m[3][2] = fRange * NearZ; + M.m[3][3] = 0.0f; + + return M; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(!XMScalarNearEqual(ViewWidth, 0.0f, 0.00001f)); + XMASSERT(!XMScalarNearEqual(ViewHeight, 0.0f, 0.00001f)); + XMASSERT(!XMScalarNearEqual(FarZ, NearZ, 0.00001f)); + + XMMATRIX M; + FLOAT TwoNearZ = NearZ + NearZ; + FLOAT fRange = FarZ / (NearZ-FarZ); + // Note: This is recorded on the stack + XMVECTOR rMem = { + TwoNearZ / ViewWidth, + TwoNearZ / ViewHeight, + fRange, + fRange * NearZ + }; + // Copy from memory to SSE register + XMVECTOR vValues = rMem; + XMVECTOR vTemp = _mm_setzero_ps(); + // Copy x only + vTemp = _mm_move_ss(vTemp,vValues); + // TwoNearZ / ViewWidth,0,0,0 + M.r[0] = vTemp; + // 0,TwoNearZ / ViewHeight,0,0 + vTemp = vValues; + vTemp = _mm_and_ps(vTemp,g_XMMaskY); + M.r[1] = vTemp; + // x=fRange,y=-fRange * NearZ,0,-1.0f + vValues = _mm_shuffle_ps(vValues,g_XMNegIdentityR3,_MM_SHUFFLE(3,2,3,2)); + // 0,0,fRange,-1.0f + vTemp = _mm_setzero_ps(); + vTemp = _mm_shuffle_ps(vTemp,vValues,_MM_SHUFFLE(3,0,0,0)); + M.r[2] = vTemp; + // 0,0,-fRange * NearZ,0 + vTemp = _mm_shuffle_ps(vTemp,vValues,_MM_SHUFFLE(2,1,0,0)); + M.r[3] = vTemp; + return M; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMMATRIX XMMatrixPerspectiveFovLH +( + FLOAT FovAngleY, + FLOAT AspectRatio, + FLOAT NearZ, + FLOAT FarZ +) +{ +#if defined(_XM_NO_INTRINSICS_) + + FLOAT SinFov; + FLOAT CosFov; + FLOAT Height; + FLOAT Width; + XMMATRIX M; + + XMASSERT(!XMScalarNearEqual(FovAngleY, 0.0f, 0.00001f * 2.0f)); + XMASSERT(!XMScalarNearEqual(AspectRatio, 0.0f, 0.00001f)); + XMASSERT(!XMScalarNearEqual(FarZ, NearZ, 0.00001f)); + + XMScalarSinCos(&SinFov, &CosFov, 0.5f * FovAngleY); + + Height = CosFov / SinFov; + Width = Height / AspectRatio; + + M.r[0] = XMVectorSet(Width, 0.0f, 0.0f, 0.0f); + M.r[1] = XMVectorSet(0.0f, Height, 0.0f, 0.0f); + M.r[2] = XMVectorSet(0.0f, 0.0f, FarZ / (FarZ - NearZ), 1.0f); + M.r[3] = XMVectorSet(0.0f, 0.0f, -M.r[2].vector4_f32[2] * NearZ, 0.0f); + + return M; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(!XMScalarNearEqual(FovAngleY, 0.0f, 0.00001f * 2.0f)); + XMASSERT(!XMScalarNearEqual(AspectRatio, 0.0f, 0.00001f)); + XMASSERT(!XMScalarNearEqual(FarZ, NearZ, 0.00001f)); + XMMATRIX M; + FLOAT SinFov; + FLOAT CosFov; + XMScalarSinCos(&SinFov, &CosFov, 0.5f * FovAngleY); + FLOAT fRange = FarZ / (FarZ-NearZ); + // Note: This is recorded on the stack + FLOAT Height = CosFov / SinFov; + XMVECTOR rMem = { + Height / AspectRatio, + Height, + fRange, + -fRange * NearZ + }; + // Copy from memory to SSE register + XMVECTOR vValues = rMem; + XMVECTOR vTemp = _mm_setzero_ps(); + // Copy x only + vTemp = _mm_move_ss(vTemp,vValues); + // CosFov / SinFov,0,0,0 + M.r[0] = vTemp; + // 0,Height / AspectRatio,0,0 + vTemp = vValues; + vTemp = _mm_and_ps(vTemp,g_XMMaskY); + M.r[1] = vTemp; + // x=fRange,y=-fRange * NearZ,0,1.0f + vTemp = _mm_setzero_ps(); + vValues = _mm_shuffle_ps(vValues,g_XMIdentityR3,_MM_SHUFFLE(3,2,3,2)); + // 0,0,fRange,1.0f + vTemp = _mm_shuffle_ps(vTemp,vValues,_MM_SHUFFLE(3,0,0,0)); + M.r[2] = vTemp; + // 0,0,-fRange * NearZ,0.0f + vTemp = _mm_shuffle_ps(vTemp,vValues,_MM_SHUFFLE(2,1,0,0)); + M.r[3] = vTemp; + return M; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMMATRIX XMMatrixPerspectiveFovRH +( + FLOAT FovAngleY, + FLOAT AspectRatio, + FLOAT NearZ, + FLOAT FarZ +) +{ +#if defined(_XM_NO_INTRINSICS_) + + FLOAT SinFov; + FLOAT CosFov; + FLOAT Height; + FLOAT Width; + XMMATRIX M; + + XMASSERT(!XMScalarNearEqual(FovAngleY, 0.0f, 0.00001f * 2.0f)); + XMASSERT(!XMScalarNearEqual(AspectRatio, 0.0f, 0.00001f)); + XMASSERT(!XMScalarNearEqual(FarZ, NearZ, 0.00001f)); + + XMScalarSinCos(&SinFov, &CosFov, 0.5f * FovAngleY); + + Height = CosFov / SinFov; + Width = Height / AspectRatio; + + M.r[0] = XMVectorSet(Width, 0.0f, 0.0f, 0.0f); + M.r[1] = XMVectorSet(0.0f, Height, 0.0f, 0.0f); + M.r[2] = XMVectorSet(0.0f, 0.0f, FarZ / (NearZ - FarZ), -1.0f); + M.r[3] = XMVectorSet(0.0f, 0.0f, M.r[2].vector4_f32[2] * NearZ, 0.0f); + + return M; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(!XMScalarNearEqual(FovAngleY, 0.0f, 0.00001f * 2.0f)); + XMASSERT(!XMScalarNearEqual(AspectRatio, 0.0f, 0.00001f)); + XMASSERT(!XMScalarNearEqual(FarZ, NearZ, 0.00001f)); + XMMATRIX M; + FLOAT SinFov; + FLOAT CosFov; + XMScalarSinCos(&SinFov, &CosFov, 0.5f * FovAngleY); + FLOAT fRange = FarZ / (NearZ-FarZ); + // Note: This is recorded on the stack + FLOAT Height = CosFov / SinFov; + XMVECTOR rMem = { + Height / AspectRatio, + Height, + fRange, + fRange * NearZ + }; + // Copy from memory to SSE register + XMVECTOR vValues = rMem; + XMVECTOR vTemp = _mm_setzero_ps(); + // Copy x only + vTemp = _mm_move_ss(vTemp,vValues); + // CosFov / SinFov,0,0,0 + M.r[0] = vTemp; + // 0,Height / AspectRatio,0,0 + vTemp = vValues; + vTemp = _mm_and_ps(vTemp,g_XMMaskY); + M.r[1] = vTemp; + // x=fRange,y=-fRange * NearZ,0,-1.0f + vTemp = _mm_setzero_ps(); + vValues = _mm_shuffle_ps(vValues,g_XMNegIdentityR3,_MM_SHUFFLE(3,2,3,2)); + // 0,0,fRange,-1.0f + vTemp = _mm_shuffle_ps(vTemp,vValues,_MM_SHUFFLE(3,0,0,0)); + M.r[2] = vTemp; + // 0,0,fRange * NearZ,0.0f + vTemp = _mm_shuffle_ps(vTemp,vValues,_MM_SHUFFLE(2,1,0,0)); + M.r[3] = vTemp; + return M; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMMATRIX XMMatrixPerspectiveOffCenterLH +( + FLOAT ViewLeft, + FLOAT ViewRight, + FLOAT ViewBottom, + FLOAT ViewTop, + FLOAT NearZ, + FLOAT FarZ +) +{ +#if defined(_XM_NO_INTRINSICS_) + + FLOAT TwoNearZ; + FLOAT ReciprocalWidth; + FLOAT ReciprocalHeight; + XMMATRIX M; + + XMASSERT(!XMScalarNearEqual(ViewRight, ViewLeft, 0.00001f)); + XMASSERT(!XMScalarNearEqual(ViewTop, ViewBottom, 0.00001f)); + XMASSERT(!XMScalarNearEqual(FarZ, NearZ, 0.00001f)); + + TwoNearZ = NearZ + NearZ; + ReciprocalWidth = 1.0f / (ViewRight - ViewLeft); + ReciprocalHeight = 1.0f / (ViewTop - ViewBottom); + + M.r[0] = XMVectorSet(TwoNearZ * ReciprocalWidth, 0.0f, 0.0f, 0.0f); + M.r[1] = XMVectorSet(0.0f, TwoNearZ * ReciprocalHeight, 0.0f, 0.0f); + M.r[2] = XMVectorSet(-(ViewLeft + ViewRight) * ReciprocalWidth, + -(ViewTop + ViewBottom) * ReciprocalHeight, + FarZ / (FarZ - NearZ), + 1.0f); + M.r[3] = XMVectorSet(0.0f, 0.0f, -M.r[2].vector4_f32[2] * NearZ, 0.0f); + + return M; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(!XMScalarNearEqual(ViewRight, ViewLeft, 0.00001f)); + XMASSERT(!XMScalarNearEqual(ViewTop, ViewBottom, 0.00001f)); + XMASSERT(!XMScalarNearEqual(FarZ, NearZ, 0.00001f)); + XMMATRIX M; + FLOAT TwoNearZ = NearZ+NearZ; + FLOAT ReciprocalWidth = 1.0f / (ViewRight - ViewLeft); + FLOAT ReciprocalHeight = 1.0f / (ViewTop - ViewBottom); + FLOAT fRange = FarZ / (FarZ-NearZ); + // Note: This is recorded on the stack + XMVECTOR rMem = { + TwoNearZ*ReciprocalWidth, + TwoNearZ*ReciprocalHeight, + -fRange * NearZ, + 0 + }; + // Copy from memory to SSE register + XMVECTOR vValues = rMem; + XMVECTOR vTemp = _mm_setzero_ps(); + // Copy x only + vTemp = _mm_move_ss(vTemp,vValues); + // TwoNearZ*ReciprocalWidth,0,0,0 + M.r[0] = vTemp; + // 0,TwoNearZ*ReciprocalHeight,0,0 + vTemp = vValues; + vTemp = _mm_and_ps(vTemp,g_XMMaskY); + M.r[1] = vTemp; + // 0,0,fRange,1.0f + M.m[2][0] = -(ViewLeft + ViewRight) * ReciprocalWidth; + M.m[2][1] = -(ViewTop + ViewBottom) * ReciprocalHeight; + M.m[2][2] = fRange; + M.m[2][3] = 1.0f; + // 0,0,-fRange * NearZ,0.0f + vValues = _mm_and_ps(vValues,g_XMMaskZ); + M.r[3] = vValues; + return M; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMMATRIX XMMatrixPerspectiveOffCenterRH +( + FLOAT ViewLeft, + FLOAT ViewRight, + FLOAT ViewBottom, + FLOAT ViewTop, + FLOAT NearZ, + FLOAT FarZ +) +{ +#if defined(_XM_NO_INTRINSICS_) + + FLOAT TwoNearZ; + FLOAT ReciprocalWidth; + FLOAT ReciprocalHeight; + XMMATRIX M; + + XMASSERT(!XMScalarNearEqual(ViewRight, ViewLeft, 0.00001f)); + XMASSERT(!XMScalarNearEqual(ViewTop, ViewBottom, 0.00001f)); + XMASSERT(!XMScalarNearEqual(FarZ, NearZ, 0.00001f)); + + TwoNearZ = NearZ + NearZ; + ReciprocalWidth = 1.0f / (ViewRight - ViewLeft); + ReciprocalHeight = 1.0f / (ViewTop - ViewBottom); + + M.r[0] = XMVectorSet(TwoNearZ * ReciprocalWidth, 0.0f, 0.0f, 0.0f); + M.r[1] = XMVectorSet(0.0f, TwoNearZ * ReciprocalHeight, 0.0f, 0.0f); + M.r[2] = XMVectorSet((ViewLeft + ViewRight) * ReciprocalWidth, + (ViewTop + ViewBottom) * ReciprocalHeight, + FarZ / (NearZ - FarZ), + -1.0f); + M.r[3] = XMVectorSet(0.0f, 0.0f, M.r[2].vector4_f32[2] * NearZ, 0.0f); + + return M; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(!XMScalarNearEqual(ViewRight, ViewLeft, 0.00001f)); + XMASSERT(!XMScalarNearEqual(ViewTop, ViewBottom, 0.00001f)); + XMASSERT(!XMScalarNearEqual(FarZ, NearZ, 0.00001f)); + + XMMATRIX M; + FLOAT TwoNearZ = NearZ+NearZ; + FLOAT ReciprocalWidth = 1.0f / (ViewRight - ViewLeft); + FLOAT ReciprocalHeight = 1.0f / (ViewTop - ViewBottom); + FLOAT fRange = FarZ / (NearZ-FarZ); + // Note: This is recorded on the stack + XMVECTOR rMem = { + TwoNearZ*ReciprocalWidth, + TwoNearZ*ReciprocalHeight, + fRange * NearZ, + 0 + }; + // Copy from memory to SSE register + XMVECTOR vValues = rMem; + XMVECTOR vTemp = _mm_setzero_ps(); + // Copy x only + vTemp = _mm_move_ss(vTemp,vValues); + // TwoNearZ*ReciprocalWidth,0,0,0 + M.r[0] = vTemp; + // 0,TwoNearZ*ReciprocalHeight,0,0 + vTemp = vValues; + vTemp = _mm_and_ps(vTemp,g_XMMaskY); + M.r[1] = vTemp; + // 0,0,fRange,1.0f + M.m[2][0] = (ViewLeft + ViewRight) * ReciprocalWidth; + M.m[2][1] = (ViewTop + ViewBottom) * ReciprocalHeight; + M.m[2][2] = fRange; + M.m[2][3] = -1.0f; + // 0,0,-fRange * NearZ,0.0f + vValues = _mm_and_ps(vValues,g_XMMaskZ); + M.r[3] = vValues; + return M; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMMATRIX XMMatrixOrthographicLH +( + FLOAT ViewWidth, + FLOAT ViewHeight, + FLOAT NearZ, + FLOAT FarZ +) +{ +#if defined(_XM_NO_INTRINSICS_) + + FLOAT fRange; + XMMATRIX M; + + XMASSERT(!XMScalarNearEqual(ViewWidth, 0.0f, 0.00001f)); + XMASSERT(!XMScalarNearEqual(ViewHeight, 0.0f, 0.00001f)); + XMASSERT(!XMScalarNearEqual(FarZ, NearZ, 0.00001f)); + + fRange = 1.0f / (FarZ-NearZ); + M.r[0] = XMVectorSet(2.0f / ViewWidth, 0.0f, 0.0f, 0.0f); + M.r[1] = XMVectorSet(0.0f, 2.0f / ViewHeight, 0.0f, 0.0f); + M.r[2] = XMVectorSet(0.0f, 0.0f, fRange, 0.0f); + M.r[3] = XMVectorSet(0.0f, 0.0f, -fRange * NearZ, 1.0f); + + return M; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(!XMScalarNearEqual(ViewWidth, 0.0f, 0.00001f)); + XMASSERT(!XMScalarNearEqual(ViewHeight, 0.0f, 0.00001f)); + XMASSERT(!XMScalarNearEqual(FarZ, NearZ, 0.00001f)); + XMMATRIX M; + FLOAT fRange = 1.0f / (FarZ-NearZ); + // Note: This is recorded on the stack + XMVECTOR rMem = { + 2.0f / ViewWidth, + 2.0f / ViewHeight, + fRange, + -fRange * NearZ + }; + // Copy from memory to SSE register + XMVECTOR vValues = rMem; + XMVECTOR vTemp = _mm_setzero_ps(); + // Copy x only + vTemp = _mm_move_ss(vTemp,vValues); + // 2.0f / ViewWidth,0,0,0 + M.r[0] = vTemp; + // 0,2.0f / ViewHeight,0,0 + vTemp = vValues; + vTemp = _mm_and_ps(vTemp,g_XMMaskY); + M.r[1] = vTemp; + // x=fRange,y=-fRange * NearZ,0,1.0f + vTemp = _mm_setzero_ps(); + vValues = _mm_shuffle_ps(vValues,g_XMIdentityR3,_MM_SHUFFLE(3,2,3,2)); + // 0,0,fRange,0.0f + vTemp = _mm_shuffle_ps(vTemp,vValues,_MM_SHUFFLE(2,0,0,0)); + M.r[2] = vTemp; + // 0,0,-fRange * NearZ,1.0f + vTemp = _mm_shuffle_ps(vTemp,vValues,_MM_SHUFFLE(3,1,0,0)); + M.r[3] = vTemp; + return M; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMMATRIX XMMatrixOrthographicRH +( + FLOAT ViewWidth, + FLOAT ViewHeight, + FLOAT NearZ, + FLOAT FarZ +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMMATRIX M; + + XMASSERT(!XMScalarNearEqual(ViewWidth, 0.0f, 0.00001f)); + XMASSERT(!XMScalarNearEqual(ViewHeight, 0.0f, 0.00001f)); + XMASSERT(!XMScalarNearEqual(FarZ, NearZ, 0.00001f)); + + M.r[0] = XMVectorSet(2.0f / ViewWidth, 0.0f, 0.0f, 0.0f); + M.r[1] = XMVectorSet(0.0f, 2.0f / ViewHeight, 0.0f, 0.0f); + M.r[2] = XMVectorSet(0.0f, 0.0f, 1.0f / (NearZ - FarZ), 0.0f); + M.r[3] = XMVectorSet(0.0f, 0.0f, M.r[2].vector4_f32[2] * NearZ, 1.0f); + + return M; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(!XMScalarNearEqual(ViewWidth, 0.0f, 0.00001f)); + XMASSERT(!XMScalarNearEqual(ViewHeight, 0.0f, 0.00001f)); + XMASSERT(!XMScalarNearEqual(FarZ, NearZ, 0.00001f)); + XMMATRIX M; + FLOAT fRange = 1.0f / (NearZ-FarZ); + // Note: This is recorded on the stack + XMVECTOR rMem = { + 2.0f / ViewWidth, + 2.0f / ViewHeight, + fRange, + fRange * NearZ + }; + // Copy from memory to SSE register + XMVECTOR vValues = rMem; + XMVECTOR vTemp = _mm_setzero_ps(); + // Copy x only + vTemp = _mm_move_ss(vTemp,vValues); + // 2.0f / ViewWidth,0,0,0 + M.r[0] = vTemp; + // 0,2.0f / ViewHeight,0,0 + vTemp = vValues; + vTemp = _mm_and_ps(vTemp,g_XMMaskY); + M.r[1] = vTemp; + // x=fRange,y=fRange * NearZ,0,1.0f + vTemp = _mm_setzero_ps(); + vValues = _mm_shuffle_ps(vValues,g_XMIdentityR3,_MM_SHUFFLE(3,2,3,2)); + // 0,0,fRange,0.0f + vTemp = _mm_shuffle_ps(vTemp,vValues,_MM_SHUFFLE(2,0,0,0)); + M.r[2] = vTemp; + // 0,0,fRange * NearZ,1.0f + vTemp = _mm_shuffle_ps(vTemp,vValues,_MM_SHUFFLE(3,1,0,0)); + M.r[3] = vTemp; + return M; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMMATRIX XMMatrixOrthographicOffCenterLH +( + FLOAT ViewLeft, + FLOAT ViewRight, + FLOAT ViewBottom, + FLOAT ViewTop, + FLOAT NearZ, + FLOAT FarZ +) +{ +#if defined(_XM_NO_INTRINSICS_) + + FLOAT ReciprocalWidth; + FLOAT ReciprocalHeight; + XMMATRIX M; + + XMASSERT(!XMScalarNearEqual(ViewRight, ViewLeft, 0.00001f)); + XMASSERT(!XMScalarNearEqual(ViewTop, ViewBottom, 0.00001f)); + XMASSERT(!XMScalarNearEqual(FarZ, NearZ, 0.00001f)); + + ReciprocalWidth = 1.0f / (ViewRight - ViewLeft); + ReciprocalHeight = 1.0f / (ViewTop - ViewBottom); + + M.r[0] = XMVectorSet(ReciprocalWidth + ReciprocalWidth, 0.0f, 0.0f, 0.0f); + M.r[1] = XMVectorSet(0.0f, ReciprocalHeight + ReciprocalHeight, 0.0f, 0.0f); + M.r[2] = XMVectorSet(0.0f, 0.0f, 1.0f / (FarZ - NearZ), 0.0f); + M.r[3] = XMVectorSet(-(ViewLeft + ViewRight) * ReciprocalWidth, + -(ViewTop + ViewBottom) * ReciprocalHeight, + -M.r[2].vector4_f32[2] * NearZ, + 1.0f); + + return M; + +#elif defined(_XM_SSE_INTRINSICS_) + XMMATRIX M; + FLOAT fReciprocalWidth = 1.0f / (ViewRight - ViewLeft); + FLOAT fReciprocalHeight = 1.0f / (ViewTop - ViewBottom); + FLOAT fRange = 1.0f / (FarZ-NearZ); + // Note: This is recorded on the stack + XMVECTOR rMem = { + fReciprocalWidth, + fReciprocalHeight, + fRange, + 1.0f + }; + XMVECTOR rMem2 = { + -(ViewLeft + ViewRight), + -(ViewTop + ViewBottom), + -NearZ, + 1.0f + }; + // Copy from memory to SSE register + XMVECTOR vValues = rMem; + XMVECTOR vTemp = _mm_setzero_ps(); + // Copy x only + vTemp = _mm_move_ss(vTemp,vValues); + // fReciprocalWidth*2,0,0,0 + vTemp = _mm_add_ss(vTemp,vTemp); + M.r[0] = vTemp; + // 0,fReciprocalHeight*2,0,0 + vTemp = vValues; + vTemp = _mm_and_ps(vTemp,g_XMMaskY); + vTemp = _mm_add_ps(vTemp,vTemp); + M.r[1] = vTemp; + // 0,0,fRange,0.0f + vTemp = vValues; + vTemp = _mm_and_ps(vTemp,g_XMMaskZ); + M.r[2] = vTemp; + // -(ViewLeft + ViewRight)*fReciprocalWidth,-(ViewTop + ViewBottom)*fReciprocalHeight,fRange*-NearZ,1.0f + vValues = _mm_mul_ps(vValues,rMem2); + M.r[3] = vValues; + return M; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMMATRIX XMMatrixOrthographicOffCenterRH +( + FLOAT ViewLeft, + FLOAT ViewRight, + FLOAT ViewBottom, + FLOAT ViewTop, + FLOAT NearZ, + FLOAT FarZ +) +{ +#if defined(_XM_NO_INTRINSICS_) + + FLOAT ReciprocalWidth; + FLOAT ReciprocalHeight; + XMMATRIX M; + + XMASSERT(!XMScalarNearEqual(ViewRight, ViewLeft, 0.00001f)); + XMASSERT(!XMScalarNearEqual(ViewTop, ViewBottom, 0.00001f)); + XMASSERT(!XMScalarNearEqual(FarZ, NearZ, 0.00001f)); + + ReciprocalWidth = 1.0f / (ViewRight - ViewLeft); + ReciprocalHeight = 1.0f / (ViewTop - ViewBottom); + + M.r[0] = XMVectorSet(ReciprocalWidth + ReciprocalWidth, 0.0f, 0.0f, 0.0f); + M.r[1] = XMVectorSet(0.0f, ReciprocalHeight + ReciprocalHeight, 0.0f, 0.0f); + M.r[2] = XMVectorSet(0.0f, 0.0f, 1.0f / (NearZ - FarZ), 0.0f); + M.r[3] = XMVectorSet(-(ViewLeft + ViewRight) * ReciprocalWidth, + -(ViewTop + ViewBottom) * ReciprocalHeight, + M.r[2].vector4_f32[2] * NearZ, + 1.0f); + + return M; + +#elif defined(_XM_SSE_INTRINSICS_) + XMMATRIX M; + FLOAT fReciprocalWidth = 1.0f / (ViewRight - ViewLeft); + FLOAT fReciprocalHeight = 1.0f / (ViewTop - ViewBottom); + FLOAT fRange = 1.0f / (NearZ-FarZ); + // Note: This is recorded on the stack + XMVECTOR rMem = { + fReciprocalWidth, + fReciprocalHeight, + fRange, + 1.0f + }; + XMVECTOR rMem2 = { + -(ViewLeft + ViewRight), + -(ViewTop + ViewBottom), + NearZ, + 1.0f + }; + // Copy from memory to SSE register + XMVECTOR vValues = rMem; + XMVECTOR vTemp = _mm_setzero_ps(); + // Copy x only + vTemp = _mm_move_ss(vTemp,vValues); + // fReciprocalWidth*2,0,0,0 + vTemp = _mm_add_ss(vTemp,vTemp); + M.r[0] = vTemp; + // 0,fReciprocalHeight*2,0,0 + vTemp = vValues; + vTemp = _mm_and_ps(vTemp,g_XMMaskY); + vTemp = _mm_add_ps(vTemp,vTemp); + M.r[1] = vTemp; + // 0,0,fRange,0.0f + vTemp = vValues; + vTemp = _mm_and_ps(vTemp,g_XMMaskZ); + M.r[2] = vTemp; + // -(ViewLeft + ViewRight)*fReciprocalWidth,-(ViewTop + ViewBottom)*fReciprocalHeight,fRange*-NearZ,1.0f + vValues = _mm_mul_ps(vValues,rMem2); + M.r[3] = vValues; + return M; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +#ifdef __cplusplus + +/**************************************************************************** + * + * XMMATRIX operators and methods + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ + +XMFINLINE _XMMATRIX::_XMMATRIX +( + FXMVECTOR R0, + FXMVECTOR R1, + FXMVECTOR R2, + CXMVECTOR R3 +) +{ + r[0] = R0; + r[1] = R1; + r[2] = R2; + r[3] = R3; +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMMATRIX::_XMMATRIX +( + FLOAT m00, FLOAT m01, FLOAT m02, FLOAT m03, + FLOAT m10, FLOAT m11, FLOAT m12, FLOAT m13, + FLOAT m20, FLOAT m21, FLOAT m22, FLOAT m23, + FLOAT m30, FLOAT m31, FLOAT m32, FLOAT m33 +) +{ + r[0] = XMVectorSet(m00, m01, m02, m03); + r[1] = XMVectorSet(m10, m11, m12, m13); + r[2] = XMVectorSet(m20, m21, m22, m23); + r[3] = XMVectorSet(m30, m31, m32, m33); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMMATRIX::_XMMATRIX +( + CONST FLOAT* pArray +) +{ + r[0] = XMLoadFloat4((XMFLOAT4*)pArray); + r[1] = XMLoadFloat4((XMFLOAT4*)(pArray + 4)); + r[2] = XMLoadFloat4((XMFLOAT4*)(pArray + 8)); + r[3] = XMLoadFloat4((XMFLOAT4*)(pArray + 12)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMMATRIX& _XMMATRIX::operator= +( + CONST _XMMATRIX& M +) +{ + r[0] = M.r[0]; + r[1] = M.r[1]; + r[2] = M.r[2]; + r[3] = M.r[3]; + return *this; +} + +//------------------------------------------------------------------------------ + +#ifndef XM_NO_OPERATOR_OVERLOADS + +#if !defined(_XBOX_VER) && defined(_XM_ISVS2005_) && defined(_XM_X64_) +#pragma warning(push) +#pragma warning(disable : 4328) +#endif + +XMFINLINE _XMMATRIX& _XMMATRIX::operator*= +( + CONST _XMMATRIX& M +) +{ + *this = XMMatrixMultiply(*this, M); + return *this; +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMMATRIX _XMMATRIX::operator* +( + CONST _XMMATRIX& M +) CONST +{ + return XMMatrixMultiply(*this, M); +} + +#if !defined(_XBOX_VER) && defined(_XM_ISVS2005_) && defined(_XM_X64_) +#pragma warning(pop) +#endif + +#endif // !XM_NO_OPERATOR_OVERLOADS + +/**************************************************************************** + * + * XMFLOAT3X3 operators + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ + +XMFINLINE _XMFLOAT3X3::_XMFLOAT3X3 +( + FLOAT m00, FLOAT m01, FLOAT m02, + FLOAT m10, FLOAT m11, FLOAT m12, + FLOAT m20, FLOAT m21, FLOAT m22 +) +{ + m[0][0] = m00; + m[0][1] = m01; + m[0][2] = m02; + + m[1][0] = m10; + m[1][1] = m11; + m[1][2] = m12; + + m[2][0] = m20; + m[2][1] = m21; + m[2][2] = m22; +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMFLOAT3X3::_XMFLOAT3X3 +( + CONST FLOAT* pArray +) +{ + UINT Row; + UINT Column; + + for (Row = 0; Row < 3; Row++) + { + for (Column = 0; Column < 3; Column++) + { + m[Row][Column] = pArray[Row * 3 + Column]; + } + } +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMFLOAT3X3& _XMFLOAT3X3::operator= +( + CONST _XMFLOAT3X3& Float3x3 +) +{ + _11 = Float3x3._11; + _12 = Float3x3._12; + _13 = Float3x3._13; + _21 = Float3x3._21; + _22 = Float3x3._22; + _23 = Float3x3._23; + _31 = Float3x3._31; + _32 = Float3x3._32; + _33 = Float3x3._33; + + return *this; +} + +/**************************************************************************** + * + * XMFLOAT4X3 operators + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ + +XMFINLINE _XMFLOAT4X3::_XMFLOAT4X3 +( + FLOAT m00, FLOAT m01, FLOAT m02, + FLOAT m10, FLOAT m11, FLOAT m12, + FLOAT m20, FLOAT m21, FLOAT m22, + FLOAT m30, FLOAT m31, FLOAT m32 +) +{ + m[0][0] = m00; + m[0][1] = m01; + m[0][2] = m02; + + m[1][0] = m10; + m[1][1] = m11; + m[1][2] = m12; + + m[2][0] = m20; + m[2][1] = m21; + m[2][2] = m22; + + m[3][0] = m30; + m[3][1] = m31; + m[3][2] = m32; +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMFLOAT4X3::_XMFLOAT4X3 +( + CONST FLOAT* pArray +) +{ + UINT Row; + UINT Column; + + for (Row = 0; Row < 4; Row++) + { + for (Column = 0; Column < 3; Column++) + { + m[Row][Column] = pArray[Row * 3 + Column]; + } + } +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMFLOAT4X3& _XMFLOAT4X3::operator= +( + CONST _XMFLOAT4X3& Float4x3 +) +{ + XMVECTOR V1 = XMLoadFloat4((XMFLOAT4*)&Float4x3._11); + XMVECTOR V2 = XMLoadFloat4((XMFLOAT4*)&Float4x3._22); + XMVECTOR V3 = XMLoadFloat4((XMFLOAT4*)&Float4x3._33); + + XMStoreFloat4((XMFLOAT4*)&_11, V1); + XMStoreFloat4((XMFLOAT4*)&_22, V2); + XMStoreFloat4((XMFLOAT4*)&_33, V3); + + return *this; +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMFLOAT4X3A& XMFLOAT4X3A::operator= +( + CONST XMFLOAT4X3A& Float4x3 +) +{ + XMVECTOR V1 = XMLoadFloat4A((XMFLOAT4A*)&Float4x3._11); + XMVECTOR V2 = XMLoadFloat4A((XMFLOAT4A*)&Float4x3._22); + XMVECTOR V3 = XMLoadFloat4A((XMFLOAT4A*)&Float4x3._33); + + XMStoreFloat4A((XMFLOAT4A*)&_11, V1); + XMStoreFloat4A((XMFLOAT4A*)&_22, V2); + XMStoreFloat4A((XMFLOAT4A*)&_33, V3); + + return *this; +} + +/**************************************************************************** + * + * XMFLOAT4X4 operators + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ + +XMFINLINE _XMFLOAT4X4::_XMFLOAT4X4 +( + FLOAT m00, FLOAT m01, FLOAT m02, FLOAT m03, + FLOAT m10, FLOAT m11, FLOAT m12, FLOAT m13, + FLOAT m20, FLOAT m21, FLOAT m22, FLOAT m23, + FLOAT m30, FLOAT m31, FLOAT m32, FLOAT m33 +) +{ + m[0][0] = m00; + m[0][1] = m01; + m[0][2] = m02; + m[0][3] = m03; + + m[1][0] = m10; + m[1][1] = m11; + m[1][2] = m12; + m[1][3] = m13; + + m[2][0] = m20; + m[2][1] = m21; + m[2][2] = m22; + m[2][3] = m23; + + m[3][0] = m30; + m[3][1] = m31; + m[3][2] = m32; + m[3][3] = m33; +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMFLOAT4X4::_XMFLOAT4X4 +( + CONST FLOAT* pArray +) +{ + UINT Row; + UINT Column; + + for (Row = 0; Row < 4; Row++) + { + for (Column = 0; Column < 4; Column++) + { + m[Row][Column] = pArray[Row * 4 + Column]; + } + } +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMFLOAT4X4& _XMFLOAT4X4::operator= +( + CONST _XMFLOAT4X4& Float4x4 +) +{ + XMVECTOR V1 = XMLoadFloat4((XMFLOAT4*)&Float4x4._11); + XMVECTOR V2 = XMLoadFloat4((XMFLOAT4*)&Float4x4._21); + XMVECTOR V3 = XMLoadFloat4((XMFLOAT4*)&Float4x4._31); + XMVECTOR V4 = XMLoadFloat4((XMFLOAT4*)&Float4x4._41); + + XMStoreFloat4((XMFLOAT4*)&_11, V1); + XMStoreFloat4((XMFLOAT4*)&_21, V2); + XMStoreFloat4((XMFLOAT4*)&_31, V3); + XMStoreFloat4((XMFLOAT4*)&_41, V4); + + return *this; +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMFLOAT4X4A& XMFLOAT4X4A::operator= +( + CONST XMFLOAT4X4A& Float4x4 +) +{ + XMVECTOR V1 = XMLoadFloat4A((XMFLOAT4A*)&Float4x4._11); + XMVECTOR V2 = XMLoadFloat4A((XMFLOAT4A*)&Float4x4._21); + XMVECTOR V3 = XMLoadFloat4A((XMFLOAT4A*)&Float4x4._31); + XMVECTOR V4 = XMLoadFloat4A((XMFLOAT4A*)&Float4x4._41); + + XMStoreFloat4A((XMFLOAT4A*)&_11, V1); + XMStoreFloat4A((XMFLOAT4A*)&_21, V2); + XMStoreFloat4A((XMFLOAT4A*)&_31, V3); + XMStoreFloat4A((XMFLOAT4A*)&_41, V4); + + return *this; +} + +#endif // __cplusplus + +#endif // __XNAMATHMATRIX_INL__ + diff --git a/MediaClient/MediaClient/directx/include/xnamathmisc.inl b/MediaClient/MediaClient/directx/include/xnamathmisc.inl new file mode 100644 index 0000000..c937ee1 --- /dev/null +++ b/MediaClient/MediaClient/directx/include/xnamathmisc.inl @@ -0,0 +1,2464 @@ +/*++ + +Copyright (c) Microsoft Corporation. All rights reserved. + +Module Name: + + xnamathmisc.inl + +Abstract: + + XNA math library for Windows and Xbox 360: Quaternion, plane, and color functions. +--*/ + +#if defined(_MSC_VER) && (_MSC_VER > 1000) +#pragma once +#endif + +#ifndef __XNAMATHMISC_INL__ +#define __XNAMATHMISC_INL__ + +/**************************************************************************** + * + * Quaternion + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ +// Comparison operations +//------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------ + +XMFINLINE BOOL XMQuaternionEqual +( + FXMVECTOR Q1, + FXMVECTOR Q2 +) +{ + return XMVector4Equal(Q1, Q2); +} + +//------------------------------------------------------------------------------ + +XMFINLINE BOOL XMQuaternionNotEqual +( + FXMVECTOR Q1, + FXMVECTOR Q2 +) +{ + return XMVector4NotEqual(Q1, Q2); +} + +//------------------------------------------------------------------------------ + +XMFINLINE BOOL XMQuaternionIsNaN +( + FXMVECTOR Q +) +{ + return XMVector4IsNaN(Q); +} + +//------------------------------------------------------------------------------ + +XMFINLINE BOOL XMQuaternionIsInfinite +( + FXMVECTOR Q +) +{ + return XMVector4IsInfinite(Q); +} + +//------------------------------------------------------------------------------ + +XMFINLINE BOOL XMQuaternionIsIdentity +( + FXMVECTOR Q +) +{ +#if defined(_XM_NO_INTRINSICS_) + + return XMVector4Equal(Q, g_XMIdentityR3.v); + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vTemp = _mm_cmpeq_ps(Q,g_XMIdentityR3); + return (_mm_movemask_ps(vTemp)==0x0f) ? true : false; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ +// Computation operations +//------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMQuaternionDot +( + FXMVECTOR Q1, + FXMVECTOR Q2 +) +{ + return XMVector4Dot(Q1, Q2); +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMQuaternionMultiply +( + FXMVECTOR Q1, + FXMVECTOR Q2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR NegativeQ1; + XMVECTOR Q2X; + XMVECTOR Q2Y; + XMVECTOR Q2Z; + XMVECTOR Q2W; + XMVECTOR Q1WZYX; + XMVECTOR Q1ZWXY; + XMVECTOR Q1YXWZ; + XMVECTOR Result; + CONST XMVECTORU32 ControlWZYX = {XM_PERMUTE_0W, XM_PERMUTE_1Z, XM_PERMUTE_0Y, XM_PERMUTE_1X}; + CONST XMVECTORU32 ControlZWXY = {XM_PERMUTE_0Z, XM_PERMUTE_0W, XM_PERMUTE_1X, XM_PERMUTE_1Y}; + CONST XMVECTORU32 ControlYXWZ = {XM_PERMUTE_1Y, XM_PERMUTE_0X, XM_PERMUTE_0W, XM_PERMUTE_1Z}; + + NegativeQ1 = XMVectorNegate(Q1); + + Q2W = XMVectorSplatW(Q2); + Q2X = XMVectorSplatX(Q2); + Q2Y = XMVectorSplatY(Q2); + Q2Z = XMVectorSplatZ(Q2); + + Q1WZYX = XMVectorPermute(Q1, NegativeQ1, ControlWZYX.v); + Q1ZWXY = XMVectorPermute(Q1, NegativeQ1, ControlZWXY.v); + Q1YXWZ = XMVectorPermute(Q1, NegativeQ1, ControlYXWZ.v); + + Result = XMVectorMultiply(Q1, Q2W); + Result = XMVectorMultiplyAdd(Q1WZYX, Q2X, Result); + Result = XMVectorMultiplyAdd(Q1ZWXY, Q2Y, Result); + Result = XMVectorMultiplyAdd(Q1YXWZ, Q2Z, Result); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + static CONST XMVECTORF32 ControlWZYX = { 1.0f,-1.0f, 1.0f,-1.0f}; + static CONST XMVECTORF32 ControlZWXY = { 1.0f, 1.0f,-1.0f,-1.0f}; + static CONST XMVECTORF32 ControlYXWZ = {-1.0f, 1.0f, 1.0f,-1.0f}; + // Copy to SSE registers and use as few as possible for x86 + XMVECTOR Q2X = Q2; + XMVECTOR Q2Y = Q2; + XMVECTOR Q2Z = Q2; + XMVECTOR vResult = Q2; + // Splat with one instruction + vResult = _mm_shuffle_ps(vResult,vResult,_MM_SHUFFLE(3,3,3,3)); + Q2X = _mm_shuffle_ps(Q2X,Q2X,_MM_SHUFFLE(0,0,0,0)); + Q2Y = _mm_shuffle_ps(Q2Y,Q2Y,_MM_SHUFFLE(1,1,1,1)); + Q2Z = _mm_shuffle_ps(Q2Z,Q2Z,_MM_SHUFFLE(2,2,2,2)); + // Retire Q1 and perform Q1*Q2W + vResult = _mm_mul_ps(vResult,Q1); + XMVECTOR Q1Shuffle = Q1; + // Shuffle the copies of Q1 + Q1Shuffle = _mm_shuffle_ps(Q1Shuffle,Q1Shuffle,_MM_SHUFFLE(0,1,2,3)); + // Mul by Q1WZYX + Q2X = _mm_mul_ps(Q2X,Q1Shuffle); + Q1Shuffle = _mm_shuffle_ps(Q1Shuffle,Q1Shuffle,_MM_SHUFFLE(2,3,0,1)); + // Flip the signs on y and z + Q2X = _mm_mul_ps(Q2X,ControlWZYX); + // Mul by Q1ZWXY + Q2Y = _mm_mul_ps(Q2Y,Q1Shuffle); + Q1Shuffle = _mm_shuffle_ps(Q1Shuffle,Q1Shuffle,_MM_SHUFFLE(0,1,2,3)); + // Flip the signs on z and w + Q2Y = _mm_mul_ps(Q2Y,ControlZWXY); + // Mul by Q1YXWZ + Q2Z = _mm_mul_ps(Q2Z,Q1Shuffle); + vResult = _mm_add_ps(vResult,Q2X); + // Flip the signs on x and w + Q2Z = _mm_mul_ps(Q2Z,ControlYXWZ); + Q2Y = _mm_add_ps(Q2Y,Q2Z); + vResult = _mm_add_ps(vResult,Q2Y); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMQuaternionLengthSq +( + FXMVECTOR Q +) +{ + return XMVector4LengthSq(Q); +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMQuaternionReciprocalLength +( + FXMVECTOR Q +) +{ + return XMVector4ReciprocalLength(Q); +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMQuaternionLength +( + FXMVECTOR Q +) +{ + return XMVector4Length(Q); +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMQuaternionNormalizeEst +( + FXMVECTOR Q +) +{ + return XMVector4NormalizeEst(Q); +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMQuaternionNormalize +( + FXMVECTOR Q +) +{ + return XMVector4Normalize(Q); +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMQuaternionConjugate +( + FXMVECTOR Q +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Result = { + -Q.vector4_f32[0], + -Q.vector4_f32[1], + -Q.vector4_f32[2], + Q.vector4_f32[3] + }; + return Result; +#elif defined(_XM_SSE_INTRINSICS_) + static const XMVECTORF32 NegativeOne3 = {-1.0f,-1.0f,-1.0f,1.0f}; + XMVECTOR Result = _mm_mul_ps(Q,NegativeOne3); + return Result; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMQuaternionInverse +( + FXMVECTOR Q +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Conjugate; + XMVECTOR L; + XMVECTOR Control; + XMVECTOR Result; + CONST XMVECTOR Zero = XMVectorZero(); + + L = XMVector4LengthSq(Q); + Conjugate = XMQuaternionConjugate(Q); + + Control = XMVectorLessOrEqual(L, g_XMEpsilon.v); + + L = XMVectorReciprocal(L); + Result = XMVectorMultiply(Conjugate, L); + + Result = XMVectorSelect(Result, Zero, Control); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR Conjugate; + XMVECTOR L; + XMVECTOR Control; + XMVECTOR Result; + XMVECTOR Zero = XMVectorZero(); + + L = XMVector4LengthSq(Q); + Conjugate = XMQuaternionConjugate(Q); + Control = XMVectorLessOrEqual(L, g_XMEpsilon); + Result = _mm_div_ps(Conjugate,L); + Result = XMVectorSelect(Result, Zero, Control); + return Result; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMQuaternionLn +( + FXMVECTOR Q +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Q0; + XMVECTOR QW; + XMVECTOR Theta; + XMVECTOR SinTheta; + XMVECTOR S; + XMVECTOR ControlW; + XMVECTOR Result; + static CONST XMVECTOR OneMinusEpsilon = {1.0f - 0.00001f, 1.0f - 0.00001f, 1.0f - 0.00001f, 1.0f - 0.00001f}; + + QW = XMVectorSplatW(Q); + Q0 = XMVectorSelect(g_XMSelect1110.v, Q, g_XMSelect1110.v); + + ControlW = XMVectorInBounds(QW, OneMinusEpsilon); + + Theta = XMVectorACos(QW); + SinTheta = XMVectorSin(Theta); + + S = XMVectorReciprocal(SinTheta); + S = XMVectorMultiply(Theta, S); + + Result = XMVectorMultiply(Q0, S); + + Result = XMVectorSelect(Q0, Result, ControlW); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + static CONST XMVECTORF32 OneMinusEpsilon = {1.0f - 0.00001f, 1.0f - 0.00001f, 1.0f - 0.00001f, 1.0f - 0.00001f}; + static CONST XMVECTORF32 NegOneMinusEpsilon = {-(1.0f - 0.00001f), -(1.0f - 0.00001f),-(1.0f - 0.00001f),-(1.0f - 0.00001f)}; + // Get W only + XMVECTOR QW = _mm_shuffle_ps(Q,Q,_MM_SHUFFLE(3,3,3,3)); + // W = 0 + XMVECTOR Q0 = _mm_and_ps(Q,g_XMMask3); + // Use W if within bounds + XMVECTOR ControlW = _mm_cmple_ps(QW,OneMinusEpsilon); + XMVECTOR vTemp2 = _mm_cmpge_ps(QW,NegOneMinusEpsilon); + ControlW = _mm_and_ps(ControlW,vTemp2); + // Get theta + XMVECTOR vTheta = XMVectorACos(QW); + // Get Sine of theta + vTemp2 = XMVectorSin(vTheta); + // theta/sine of theta + vTheta = _mm_div_ps(vTheta,vTemp2); + // Here's the answer + vTheta = _mm_mul_ps(vTheta,Q0); + // Was W in bounds? If not, return input as is + vTheta = XMVectorSelect(Q0,vTheta,ControlW); + return vTheta; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMQuaternionExp +( + FXMVECTOR Q +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Theta; + XMVECTOR SinTheta; + XMVECTOR CosTheta; + XMVECTOR S; + XMVECTOR Control; + XMVECTOR Zero; + XMVECTOR Result; + + Theta = XMVector3Length(Q); + XMVectorSinCos(&SinTheta, &CosTheta, Theta); + + S = XMVectorReciprocal(Theta); + S = XMVectorMultiply(SinTheta, S); + + Result = XMVectorMultiply(Q, S); + + Zero = XMVectorZero(); + Control = XMVectorNearEqual(Theta, Zero, g_XMEpsilon.v); + Result = XMVectorSelect(Result, Q, Control); + + Result = XMVectorSelect(CosTheta, Result, g_XMSelect1110.v); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR Theta; + XMVECTOR SinTheta; + XMVECTOR CosTheta; + XMVECTOR S; + XMVECTOR Control; + XMVECTOR Zero; + XMVECTOR Result; + Theta = XMVector3Length(Q); + XMVectorSinCos(&SinTheta, &CosTheta, Theta); + S = _mm_div_ps(SinTheta,Theta); + Result = _mm_mul_ps(Q, S); + Zero = XMVectorZero(); + Control = XMVectorNearEqual(Theta, Zero, g_XMEpsilon); + Result = XMVectorSelect(Result,Q,Control); + Result = _mm_and_ps(Result,g_XMMask3); + CosTheta = _mm_and_ps(CosTheta,g_XMMaskW); + Result = _mm_or_ps(Result,CosTheta); + return Result; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMINLINE XMVECTOR XMQuaternionSlerp +( + FXMVECTOR Q0, + FXMVECTOR Q1, + FLOAT t +) +{ + XMVECTOR T = XMVectorReplicate(t); + return XMQuaternionSlerpV(Q0, Q1, T); +} + +//------------------------------------------------------------------------------ + +XMINLINE XMVECTOR XMQuaternionSlerpV +( + FXMVECTOR Q0, + FXMVECTOR Q1, + FXMVECTOR T +) +{ +#if defined(_XM_NO_INTRINSICS_) + + // Result = Q0 * sin((1.0 - t) * Omega) / sin(Omega) + Q1 * sin(t * Omega) / sin(Omega) + XMVECTOR Omega; + XMVECTOR CosOmega; + XMVECTOR SinOmega; + XMVECTOR InvSinOmega; + XMVECTOR V01; + XMVECTOR C1000; + XMVECTOR SignMask; + XMVECTOR S0; + XMVECTOR S1; + XMVECTOR Sign; + XMVECTOR Control; + XMVECTOR Result; + XMVECTOR Zero; + CONST XMVECTOR OneMinusEpsilon = {1.0f - 0.00001f, 1.0f - 0.00001f, 1.0f - 0.00001f, 1.0f - 0.00001f}; + + XMASSERT((T.vector4_f32[1] == T.vector4_f32[0]) && (T.vector4_f32[2] == T.vector4_f32[0]) && (T.vector4_f32[3] == T.vector4_f32[0])); + + CosOmega = XMQuaternionDot(Q0, Q1); + + Zero = XMVectorZero(); + Control = XMVectorLess(CosOmega, Zero); + Sign = XMVectorSelect(g_XMOne.v, g_XMNegativeOne.v, Control); + + CosOmega = XMVectorMultiply(CosOmega, Sign); + + Control = XMVectorLess(CosOmega, OneMinusEpsilon); + + SinOmega = XMVectorNegativeMultiplySubtract(CosOmega, CosOmega, g_XMOne.v); + SinOmega = XMVectorSqrt(SinOmega); + + Omega = XMVectorATan2(SinOmega, CosOmega); + + SignMask = XMVectorSplatSignMask(); + C1000 = XMVectorSetBinaryConstant(1, 0, 0, 0); + V01 = XMVectorShiftLeft(T, Zero, 2); + SignMask = XMVectorShiftLeft(SignMask, Zero, 3); + V01 = XMVectorXorInt(V01, SignMask); + V01 = XMVectorAdd(C1000, V01); + + InvSinOmega = XMVectorReciprocal(SinOmega); + + S0 = XMVectorMultiply(V01, Omega); + S0 = XMVectorSin(S0); + S0 = XMVectorMultiply(S0, InvSinOmega); + + S0 = XMVectorSelect(V01, S0, Control); + + S1 = XMVectorSplatY(S0); + S0 = XMVectorSplatX(S0); + + S1 = XMVectorMultiply(S1, Sign); + + Result = XMVectorMultiply(Q0, S0); + Result = XMVectorMultiplyAdd(Q1, S1, Result); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + // Result = Q0 * sin((1.0 - t) * Omega) / sin(Omega) + Q1 * sin(t * Omega) / sin(Omega) + XMVECTOR Omega; + XMVECTOR CosOmega; + XMVECTOR SinOmega; + XMVECTOR V01; + XMVECTOR S0; + XMVECTOR S1; + XMVECTOR Sign; + XMVECTOR Control; + XMVECTOR Result; + XMVECTOR Zero; + static const XMVECTORF32 OneMinusEpsilon = {1.0f - 0.00001f, 1.0f - 0.00001f, 1.0f - 0.00001f, 1.0f - 0.00001f}; + static const XMVECTORI32 SignMask2 = {0x80000000,0x00000000,0x00000000,0x00000000}; + static const XMVECTORI32 MaskXY = {0xFFFFFFFF,0xFFFFFFFF,0x00000000,0x00000000}; + + XMASSERT((XMVectorGetY(T) == XMVectorGetX(T)) && (XMVectorGetZ(T) == XMVectorGetX(T)) && (XMVectorGetW(T) == XMVectorGetX(T))); + + CosOmega = XMQuaternionDot(Q0, Q1); + + Zero = XMVectorZero(); + Control = XMVectorLess(CosOmega, Zero); + Sign = XMVectorSelect(g_XMOne, g_XMNegativeOne, Control); + + CosOmega = _mm_mul_ps(CosOmega, Sign); + + Control = XMVectorLess(CosOmega, OneMinusEpsilon); + + SinOmega = _mm_mul_ps(CosOmega,CosOmega); + SinOmega = _mm_sub_ps(g_XMOne,SinOmega); + SinOmega = _mm_sqrt_ps(SinOmega); + + Omega = XMVectorATan2(SinOmega, CosOmega); + + V01 = _mm_shuffle_ps(T,T,_MM_SHUFFLE(2,3,0,1)); + V01 = _mm_and_ps(V01,MaskXY); + V01 = _mm_xor_ps(V01,SignMask2); + V01 = _mm_add_ps(g_XMIdentityR0, V01); + + S0 = _mm_mul_ps(V01, Omega); + S0 = XMVectorSin(S0); + S0 = _mm_div_ps(S0, SinOmega); + + S0 = XMVectorSelect(V01, S0, Control); + + S1 = XMVectorSplatY(S0); + S0 = XMVectorSplatX(S0); + + S1 = _mm_mul_ps(S1, Sign); + Result = _mm_mul_ps(Q0, S0); + S1 = _mm_mul_ps(S1, Q1); + Result = _mm_add_ps(Result,S1); + return Result; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMQuaternionSquad +( + FXMVECTOR Q0, + FXMVECTOR Q1, + FXMVECTOR Q2, + CXMVECTOR Q3, + FLOAT t +) +{ + XMVECTOR T = XMVectorReplicate(t); + return XMQuaternionSquadV(Q0, Q1, Q2, Q3, T); +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMQuaternionSquadV +( + FXMVECTOR Q0, + FXMVECTOR Q1, + FXMVECTOR Q2, + CXMVECTOR Q3, + CXMVECTOR T +) +{ + XMVECTOR Q03; + XMVECTOR Q12; + XMVECTOR TP; + XMVECTOR Two; + XMVECTOR Result; + + XMASSERT( (XMVectorGetY(T) == XMVectorGetX(T)) && (XMVectorGetZ(T) == XMVectorGetX(T)) && (XMVectorGetW(T) == XMVectorGetX(T)) ); + + TP = T; + Two = XMVectorSplatConstant(2, 0); + + Q03 = XMQuaternionSlerpV(Q0, Q3, T); + Q12 = XMQuaternionSlerpV(Q1, Q2, T); + + TP = XMVectorNegativeMultiplySubtract(TP, TP, TP); + TP = XMVectorMultiply(TP, Two); + + Result = XMQuaternionSlerpV(Q03, Q12, TP); + + return Result; + +} + +//------------------------------------------------------------------------------ + +XMINLINE VOID XMQuaternionSquadSetup +( + XMVECTOR* pA, + XMVECTOR* pB, + XMVECTOR* pC, + FXMVECTOR Q0, + FXMVECTOR Q1, + FXMVECTOR Q2, + CXMVECTOR Q3 +) +{ + XMVECTOR SQ0, SQ2, SQ3; + XMVECTOR InvQ1, InvQ2; + XMVECTOR LnQ0, LnQ1, LnQ2, LnQ3; + XMVECTOR ExpQ02, ExpQ13; + XMVECTOR LS01, LS12, LS23; + XMVECTOR LD01, LD12, LD23; + XMVECTOR Control0, Control1, Control2; + XMVECTOR NegativeOneQuarter; + + XMASSERT(pA); + XMASSERT(pB); + XMASSERT(pC); + + LS12 = XMQuaternionLengthSq(XMVectorAdd(Q1, Q2)); + LD12 = XMQuaternionLengthSq(XMVectorSubtract(Q1, Q2)); + SQ2 = XMVectorNegate(Q2); + + Control1 = XMVectorLess(LS12, LD12); + SQ2 = XMVectorSelect(Q2, SQ2, Control1); + + LS01 = XMQuaternionLengthSq(XMVectorAdd(Q0, Q1)); + LD01 = XMQuaternionLengthSq(XMVectorSubtract(Q0, Q1)); + SQ0 = XMVectorNegate(Q0); + + LS23 = XMQuaternionLengthSq(XMVectorAdd(SQ2, Q3)); + LD23 = XMQuaternionLengthSq(XMVectorSubtract(SQ2, Q3)); + SQ3 = XMVectorNegate(Q3); + + Control0 = XMVectorLess(LS01, LD01); + Control2 = XMVectorLess(LS23, LD23); + + SQ0 = XMVectorSelect(Q0, SQ0, Control0); + SQ3 = XMVectorSelect(Q3, SQ3, Control2); + + InvQ1 = XMQuaternionInverse(Q1); + InvQ2 = XMQuaternionInverse(SQ2); + + LnQ0 = XMQuaternionLn(XMQuaternionMultiply(InvQ1, SQ0)); + LnQ2 = XMQuaternionLn(XMQuaternionMultiply(InvQ1, SQ2)); + LnQ1 = XMQuaternionLn(XMQuaternionMultiply(InvQ2, Q1)); + LnQ3 = XMQuaternionLn(XMQuaternionMultiply(InvQ2, SQ3)); + + NegativeOneQuarter = XMVectorSplatConstant(-1, 2); + + ExpQ02 = XMVectorMultiply(XMVectorAdd(LnQ0, LnQ2), NegativeOneQuarter); + ExpQ13 = XMVectorMultiply(XMVectorAdd(LnQ1, LnQ3), NegativeOneQuarter); + ExpQ02 = XMQuaternionExp(ExpQ02); + ExpQ13 = XMQuaternionExp(ExpQ13); + + *pA = XMQuaternionMultiply(Q1, ExpQ02); + *pB = XMQuaternionMultiply(SQ2, ExpQ13); + *pC = SQ2; +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMQuaternionBaryCentric +( + FXMVECTOR Q0, + FXMVECTOR Q1, + FXMVECTOR Q2, + FLOAT f, + FLOAT g +) +{ + XMVECTOR Q01; + XMVECTOR Q02; + FLOAT s; + XMVECTOR Result; + + s = f + g; + + if ((s < 0.00001f) && (s > -0.00001f)) + { + Result = Q0; + } + else + { + Q01 = XMQuaternionSlerp(Q0, Q1, s); + Q02 = XMQuaternionSlerp(Q0, Q2, s); + + Result = XMQuaternionSlerp(Q01, Q02, g / s); + } + + return Result; +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMQuaternionBaryCentricV +( + FXMVECTOR Q0, + FXMVECTOR Q1, + FXMVECTOR Q2, + CXMVECTOR F, + CXMVECTOR G +) +{ + XMVECTOR Q01; + XMVECTOR Q02; + XMVECTOR S, GS; + XMVECTOR Epsilon; + XMVECTOR Result; + + XMASSERT( (XMVectorGetY(F) == XMVectorGetX(F)) && (XMVectorGetZ(F) == XMVectorGetX(F)) && (XMVectorGetW(F) == XMVectorGetX(F)) ); + XMASSERT( (XMVectorGetY(G) == XMVectorGetX(G)) && (XMVectorGetZ(G) == XMVectorGetX(G)) && (XMVectorGetW(G) == XMVectorGetX(G)) ); + + Epsilon = XMVectorSplatConstant(1, 16); + + S = XMVectorAdd(F, G); + + if (XMVector4InBounds(S, Epsilon)) + { + Result = Q0; + } + else + { + Q01 = XMQuaternionSlerpV(Q0, Q1, S); + Q02 = XMQuaternionSlerpV(Q0, Q2, S); + GS = XMVectorReciprocal(S); + GS = XMVectorMultiply(G, GS); + + Result = XMQuaternionSlerpV(Q01, Q02, GS); + } + + return Result; +} + +//------------------------------------------------------------------------------ +// Transformation operations +//------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMQuaternionIdentity() +{ +#if defined(_XM_NO_INTRINSICS_) + return g_XMIdentityR3.v; +#elif defined(_XM_SSE_INTRINSICS_) + return g_XMIdentityR3; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMQuaternionRotationRollPitchYaw +( + FLOAT Pitch, + FLOAT Yaw, + FLOAT Roll +) +{ + XMVECTOR Angles; + XMVECTOR Q; + + Angles = XMVectorSet(Pitch, Yaw, Roll, 0.0f); + Q = XMQuaternionRotationRollPitchYawFromVector(Angles); + + return Q; +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMQuaternionRotationRollPitchYawFromVector +( + FXMVECTOR Angles // +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Q, Q0, Q1; + XMVECTOR P0, P1, Y0, Y1, R0, R1; + XMVECTOR HalfAngles; + XMVECTOR SinAngles, CosAngles; + static CONST XMVECTORU32 ControlPitch = {XM_PERMUTE_0X, XM_PERMUTE_1X, XM_PERMUTE_1X, XM_PERMUTE_1X}; + static CONST XMVECTORU32 ControlYaw = {XM_PERMUTE_1Y, XM_PERMUTE_0Y, XM_PERMUTE_1Y, XM_PERMUTE_1Y}; + static CONST XMVECTORU32 ControlRoll = {XM_PERMUTE_1Z, XM_PERMUTE_1Z, XM_PERMUTE_0Z, XM_PERMUTE_1Z}; + static CONST XMVECTOR Sign = {1.0f, -1.0f, -1.0f, 1.0f}; + + HalfAngles = XMVectorMultiply(Angles, g_XMOneHalf.v); + XMVectorSinCos(&SinAngles, &CosAngles, HalfAngles); + + P0 = XMVectorPermute(SinAngles, CosAngles, ControlPitch.v); + Y0 = XMVectorPermute(SinAngles, CosAngles, ControlYaw.v); + R0 = XMVectorPermute(SinAngles, CosAngles, ControlRoll.v); + P1 = XMVectorPermute(CosAngles, SinAngles, ControlPitch.v); + Y1 = XMVectorPermute(CosAngles, SinAngles, ControlYaw.v); + R1 = XMVectorPermute(CosAngles, SinAngles, ControlRoll.v); + + Q1 = XMVectorMultiply(P1, Sign); + Q0 = XMVectorMultiply(P0, Y0); + Q1 = XMVectorMultiply(Q1, Y1); + Q0 = XMVectorMultiply(Q0, R0); + Q = XMVectorMultiplyAdd(Q1, R1, Q0); + + return Q; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR Q, Q0, Q1; + XMVECTOR P0, P1, Y0, Y1, R0, R1; + XMVECTOR HalfAngles; + XMVECTOR SinAngles, CosAngles; + static CONST XMVECTORI32 ControlPitch = {XM_PERMUTE_0X, XM_PERMUTE_1X, XM_PERMUTE_1X, XM_PERMUTE_1X}; + static CONST XMVECTORI32 ControlYaw = {XM_PERMUTE_1Y, XM_PERMUTE_0Y, XM_PERMUTE_1Y, XM_PERMUTE_1Y}; + static CONST XMVECTORI32 ControlRoll = {XM_PERMUTE_1Z, XM_PERMUTE_1Z, XM_PERMUTE_0Z, XM_PERMUTE_1Z}; + static CONST XMVECTORF32 Sign = {1.0f, -1.0f, -1.0f, 1.0f}; + + HalfAngles = _mm_mul_ps(Angles, g_XMOneHalf); + XMVectorSinCos(&SinAngles, &CosAngles, HalfAngles); + + P0 = XMVectorPermute(SinAngles, CosAngles, ControlPitch); + Y0 = XMVectorPermute(SinAngles, CosAngles, ControlYaw); + R0 = XMVectorPermute(SinAngles, CosAngles, ControlRoll); + P1 = XMVectorPermute(CosAngles, SinAngles, ControlPitch); + Y1 = XMVectorPermute(CosAngles, SinAngles, ControlYaw); + R1 = XMVectorPermute(CosAngles, SinAngles, ControlRoll); + + Q1 = _mm_mul_ps(P1, Sign); + Q0 = _mm_mul_ps(P0, Y0); + Q1 = _mm_mul_ps(Q1, Y1); + Q0 = _mm_mul_ps(Q0, R0); + Q = _mm_mul_ps(Q1, R1); + Q = _mm_add_ps(Q,Q0); + return Q; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMQuaternionRotationNormal +( + FXMVECTOR NormalAxis, + FLOAT Angle +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Q; + XMVECTOR N; + XMVECTOR Scale; + + N = XMVectorSelect(g_XMOne.v, NormalAxis, g_XMSelect1110.v); + + XMScalarSinCos(&Scale.vector4_f32[2], &Scale.vector4_f32[3], 0.5f * Angle); + + Scale.vector4_f32[0] = Scale.vector4_f32[1] = Scale.vector4_f32[2]; + + Q = XMVectorMultiply(N, Scale); + + return Q; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR N = _mm_and_ps(NormalAxis,g_XMMask3); + N = _mm_or_ps(N,g_XMIdentityR3); + XMVECTOR Scale = _mm_set_ps1(0.5f * Angle); + XMVECTOR vSine; + XMVECTOR vCosine; + XMVectorSinCos(&vSine,&vCosine,Scale); + Scale = _mm_and_ps(vSine,g_XMMask3); + vCosine = _mm_and_ps(vCosine,g_XMMaskW); + Scale = _mm_or_ps(Scale,vCosine); + N = _mm_mul_ps(N,Scale); + return N; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMQuaternionRotationAxis +( + FXMVECTOR Axis, + FLOAT Angle +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Normal; + XMVECTOR Q; + + XMASSERT(!XMVector3Equal(Axis, XMVectorZero())); + XMASSERT(!XMVector3IsInfinite(Axis)); + + Normal = XMVector3Normalize(Axis); + Q = XMQuaternionRotationNormal(Normal, Angle); + + return Q; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR Normal; + XMVECTOR Q; + + XMASSERT(!XMVector3Equal(Axis, XMVectorZero())); + XMASSERT(!XMVector3IsInfinite(Axis)); + + Normal = XMVector3Normalize(Axis); + Q = XMQuaternionRotationNormal(Normal, Angle); + return Q; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMINLINE XMVECTOR XMQuaternionRotationMatrix +( + CXMMATRIX M +) +{ +#if defined(_XM_NO_INTRINSICS_) || defined(_XM_SSE_INTRINSICS_) + + XMVECTOR Q0, Q1, Q2; + XMVECTOR M00, M11, M22; + XMVECTOR CQ0, CQ1, C; + XMVECTOR CX, CY, CZ, CW; + XMVECTOR SQ1, Scale; + XMVECTOR Rsq, Sqrt, VEqualsNaN; + XMVECTOR A, B, P; + XMVECTOR PermuteSplat, PermuteSplatT; + XMVECTOR SignB, SignBT; + XMVECTOR PermuteControl, PermuteControlT; + XMVECTOR Result; + static CONST XMVECTORF32 OneQuarter = {0.25f, 0.25f, 0.25f, 0.25f}; + static CONST XMVECTORF32 SignPNNP = {1.0f, -1.0f, -1.0f, 1.0f}; + static CONST XMVECTORF32 SignNPNP = {-1.0f, 1.0f, -1.0f, 1.0f}; + static CONST XMVECTORF32 SignNNPP = {-1.0f, -1.0f, 1.0f, 1.0f}; + static CONST XMVECTORF32 SignPNPP = {1.0f, -1.0f, 1.0f, 1.0f}; + static CONST XMVECTORF32 SignPPNP = {1.0f, 1.0f, -1.0f, 1.0f}; + static CONST XMVECTORF32 SignNPPP = {-1.0f, 1.0f, 1.0f, 1.0f}; + static CONST XMVECTORU32 Permute0X0X0Y0W = {XM_PERMUTE_0X, XM_PERMUTE_0X, XM_PERMUTE_0Y, XM_PERMUTE_0W}; + static CONST XMVECTORU32 Permute0Y0Z0Z1W = {XM_PERMUTE_0Y, XM_PERMUTE_0Z, XM_PERMUTE_0Z, XM_PERMUTE_1W}; + static CONST XMVECTORU32 SplatX = {XM_PERMUTE_0X, XM_PERMUTE_0X, XM_PERMUTE_0X, XM_PERMUTE_0X}; + static CONST XMVECTORU32 SplatY = {XM_PERMUTE_0Y, XM_PERMUTE_0Y, XM_PERMUTE_0Y, XM_PERMUTE_0Y}; + static CONST XMVECTORU32 SplatZ = {XM_PERMUTE_0Z, XM_PERMUTE_0Z, XM_PERMUTE_0Z, XM_PERMUTE_0Z}; + static CONST XMVECTORU32 SplatW = {XM_PERMUTE_0W, XM_PERMUTE_0W, XM_PERMUTE_0W, XM_PERMUTE_0W}; + static CONST XMVECTORU32 PermuteC = {XM_PERMUTE_0X, XM_PERMUTE_0Z, XM_PERMUTE_1X, XM_PERMUTE_1Y}; + static CONST XMVECTORU32 PermuteA = {XM_PERMUTE_0Y, XM_PERMUTE_1Y, XM_PERMUTE_1Z, XM_PERMUTE_0W}; + static CONST XMVECTORU32 PermuteB = {XM_PERMUTE_1X, XM_PERMUTE_1W, XM_PERMUTE_0Z, XM_PERMUTE_0W}; + static CONST XMVECTORU32 Permute0 = {XM_PERMUTE_0X, XM_PERMUTE_1X, XM_PERMUTE_1Z, XM_PERMUTE_1Y}; + static CONST XMVECTORU32 Permute1 = {XM_PERMUTE_1X, XM_PERMUTE_0Y, XM_PERMUTE_1Y, XM_PERMUTE_1Z}; + static CONST XMVECTORU32 Permute2 = {XM_PERMUTE_1Z, XM_PERMUTE_1Y, XM_PERMUTE_0Z, XM_PERMUTE_1X}; + static CONST XMVECTORU32 Permute3 = {XM_PERMUTE_1Y, XM_PERMUTE_1Z, XM_PERMUTE_1X, XM_PERMUTE_0W}; + + M00 = XMVectorSplatX(M.r[0]); + M11 = XMVectorSplatY(M.r[1]); + M22 = XMVectorSplatZ(M.r[2]); + + Q0 = XMVectorMultiply(SignPNNP.v, M00); + Q0 = XMVectorMultiplyAdd(SignNPNP.v, M11, Q0); + Q0 = XMVectorMultiplyAdd(SignNNPP.v, M22, Q0); + + Q1 = XMVectorAdd(Q0, g_XMOne.v); + + Rsq = XMVectorReciprocalSqrt(Q1); + VEqualsNaN = XMVectorIsNaN(Rsq); + Sqrt = XMVectorMultiply(Q1, Rsq); + Q1 = XMVectorSelect(Sqrt, Q1, VEqualsNaN); + + Q1 = XMVectorMultiply(Q1, g_XMOneHalf.v); + + SQ1 = XMVectorMultiply(Rsq, g_XMOneHalf.v); + + CQ0 = XMVectorPermute(Q0, Q0, Permute0X0X0Y0W.v); + CQ1 = XMVectorPermute(Q0, g_XMEpsilon.v, Permute0Y0Z0Z1W.v); + C = XMVectorGreaterOrEqual(CQ0, CQ1); + + CX = XMVectorSplatX(C); + CY = XMVectorSplatY(C); + CZ = XMVectorSplatZ(C); + CW = XMVectorSplatW(C); + + PermuteSplat = XMVectorSelect(SplatZ.v, SplatY.v, CZ); + SignB = XMVectorSelect(SignNPPP.v, SignPPNP.v, CZ); + PermuteControl = XMVectorSelect(Permute2.v, Permute1.v, CZ); + + PermuteSplat = XMVectorSelect(PermuteSplat, SplatZ.v, CX); + SignB = XMVectorSelect(SignB, SignNPPP.v, CX); + PermuteControl = XMVectorSelect(PermuteControl, Permute2.v, CX); + + PermuteSplatT = XMVectorSelect(PermuteSplat,SplatX.v, CY); + SignBT = XMVectorSelect(SignB, SignPNPP.v, CY); + PermuteControlT = XMVectorSelect(PermuteControl,Permute0.v, CY); + + PermuteSplat = XMVectorSelect(PermuteSplat, PermuteSplatT, CX); + SignB = XMVectorSelect(SignB, SignBT, CX); + PermuteControl = XMVectorSelect(PermuteControl, PermuteControlT, CX); + + PermuteSplat = XMVectorSelect(PermuteSplat,SplatW.v, CW); + SignB = XMVectorSelect(SignB, g_XMNegativeOne.v, CW); + PermuteControl = XMVectorSelect(PermuteControl,Permute3.v, CW); + + Scale = XMVectorPermute(SQ1, SQ1, PermuteSplat); + + P = XMVectorPermute(M.r[1], M.r[2],PermuteC.v); // {M10, M12, M20, M21} + A = XMVectorPermute(M.r[0], P, PermuteA.v); // {M01, M12, M20, M03} + B = XMVectorPermute(M.r[0], P, PermuteB.v); // {M10, M21, M02, M03} + + Q2 = XMVectorMultiplyAdd(SignB, B, A); + Q2 = XMVectorMultiply(Q2, Scale); + + Result = XMVectorPermute(Q1, Q2, PermuteControl); + + return Result; + +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ +// Conversion operations +//------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMQuaternionToAxisAngle +( + XMVECTOR* pAxis, + FLOAT* pAngle, + FXMVECTOR Q +) +{ + XMASSERT(pAxis); + XMASSERT(pAngle); + + *pAxis = Q; + +#if defined(_XM_SSE_INTRINSICS_) && !defined(_XM_NO_INTRINSICS_) + *pAngle = 2.0f * acosf(XMVectorGetW(Q)); +#else + *pAngle = 2.0f * XMScalarACos(XMVectorGetW(Q)); +#endif +} + +/**************************************************************************** + * + * Plane + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ +// Comparison operations +//------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------ + +XMFINLINE BOOL XMPlaneEqual +( + FXMVECTOR P1, + FXMVECTOR P2 +) +{ + return XMVector4Equal(P1, P2); +} + +//------------------------------------------------------------------------------ + +XMFINLINE BOOL XMPlaneNearEqual +( + FXMVECTOR P1, + FXMVECTOR P2, + FXMVECTOR Epsilon +) +{ + XMVECTOR NP1 = XMPlaneNormalize(P1); + XMVECTOR NP2 = XMPlaneNormalize(P2); + return XMVector4NearEqual(NP1, NP2, Epsilon); +} + +//------------------------------------------------------------------------------ + +XMFINLINE BOOL XMPlaneNotEqual +( + FXMVECTOR P1, + FXMVECTOR P2 +) +{ + return XMVector4NotEqual(P1, P2); +} + +//------------------------------------------------------------------------------ + +XMFINLINE BOOL XMPlaneIsNaN +( + FXMVECTOR P +) +{ + return XMVector4IsNaN(P); +} + +//------------------------------------------------------------------------------ + +XMFINLINE BOOL XMPlaneIsInfinite +( + FXMVECTOR P +) +{ + return XMVector4IsInfinite(P); +} + +//------------------------------------------------------------------------------ +// Computation operations +//------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMPlaneDot +( + FXMVECTOR P, + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + return XMVector4Dot(P, V); + +#elif defined(_XM_SSE_INTRINSICS_) + __m128 vTemp2 = V; + __m128 vTemp = _mm_mul_ps(P,vTemp2); + vTemp2 = _mm_shuffle_ps(vTemp2,vTemp,_MM_SHUFFLE(1,0,0,0)); // Copy X to the Z position and Y to the W position + vTemp2 = _mm_add_ps(vTemp2,vTemp); // Add Z = X+Z; W = Y+W; + vTemp = _mm_shuffle_ps(vTemp,vTemp2,_MM_SHUFFLE(0,3,0,0)); // Copy W to the Z position + vTemp = _mm_add_ps(vTemp,vTemp2); // Add Z and W together + return _mm_shuffle_ps(vTemp,vTemp,_MM_SHUFFLE(2,2,2,2)); // Splat Z and return +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMPlaneDotCoord +( + FXMVECTOR P, + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V3; + XMVECTOR Result; + + // Result = P[0] * V[0] + P[1] * V[1] + P[2] * V[2] + P[3] + V3 = XMVectorSelect(g_XMOne.v, V, g_XMSelect1110.v); + Result = XMVector4Dot(P, V3); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vTemp2 = _mm_and_ps(V,g_XMMask3); + vTemp2 = _mm_or_ps(vTemp2,g_XMIdentityR3); + XMVECTOR vTemp = _mm_mul_ps(P,vTemp2); + vTemp2 = _mm_shuffle_ps(vTemp2,vTemp,_MM_SHUFFLE(1,0,0,0)); // Copy X to the Z position and Y to the W position + vTemp2 = _mm_add_ps(vTemp2,vTemp); // Add Z = X+Z; W = Y+W; + vTemp = _mm_shuffle_ps(vTemp,vTemp2,_MM_SHUFFLE(0,3,0,0)); // Copy W to the Z position + vTemp = _mm_add_ps(vTemp,vTemp2); // Add Z and W together + return _mm_shuffle_ps(vTemp,vTemp,_MM_SHUFFLE(2,2,2,2)); // Splat Z and return +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMPlaneDotNormal +( + FXMVECTOR P, + FXMVECTOR V +) +{ + return XMVector3Dot(P, V); +} + +//------------------------------------------------------------------------------ +// XMPlaneNormalizeEst uses a reciprocal estimate and +// returns QNaN on zero and infinite vectors. + +XMFINLINE XMVECTOR XMPlaneNormalizeEst +( + FXMVECTOR P +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Result; + Result = XMVector3ReciprocalLength(P); + Result = XMVectorMultiply(P, Result); + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + // Perform the dot product + XMVECTOR vDot = _mm_mul_ps(P,P); + // x=Dot.y, y=Dot.z + XMVECTOR vTemp = _mm_shuffle_ps(vDot,vDot,_MM_SHUFFLE(2,1,2,1)); + // Result.x = x+y + vDot = _mm_add_ss(vDot,vTemp); + // x=Dot.z + vTemp = _mm_shuffle_ps(vTemp,vTemp,_MM_SHUFFLE(1,1,1,1)); + // Result.x = (x+y)+z + vDot = _mm_add_ss(vDot,vTemp); + // Splat x + vDot = _mm_shuffle_ps(vDot,vDot,_MM_SHUFFLE(0,0,0,0)); + // Get the reciprocal + vDot = _mm_rsqrt_ps(vDot); + // Get the reciprocal + vDot = _mm_mul_ps(vDot,P); + return vDot; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMPlaneNormalize +( + FXMVECTOR P +) +{ +#if defined(_XM_NO_INTRINSICS_) + FLOAT fLengthSq = sqrtf((P.vector4_f32[0]*P.vector4_f32[0])+(P.vector4_f32[1]*P.vector4_f32[1])+(P.vector4_f32[2]*P.vector4_f32[2])); + // Prevent divide by zero + if (fLengthSq) { + fLengthSq = 1.0f/fLengthSq; + } + { + XMVECTOR vResult = { + P.vector4_f32[0]*fLengthSq, + P.vector4_f32[1]*fLengthSq, + P.vector4_f32[2]*fLengthSq, + P.vector4_f32[3]*fLengthSq + }; + return vResult; + } +#elif defined(_XM_SSE_INTRINSICS_) + // Perform the dot product on x,y and z only + XMVECTOR vLengthSq = _mm_mul_ps(P,P); + XMVECTOR vTemp = _mm_shuffle_ps(vLengthSq,vLengthSq,_MM_SHUFFLE(2,1,2,1)); + vLengthSq = _mm_add_ss(vLengthSq,vTemp); + vTemp = _mm_shuffle_ps(vTemp,vTemp,_MM_SHUFFLE(1,1,1,1)); + vLengthSq = _mm_add_ss(vLengthSq,vTemp); + vLengthSq = _mm_shuffle_ps(vLengthSq,vLengthSq,_MM_SHUFFLE(0,0,0,0)); + // Prepare for the division + XMVECTOR vResult = _mm_sqrt_ps(vLengthSq); + // Failsafe on zero (Or epsilon) length planes + // If the length is infinity, set the elements to zero + vLengthSq = _mm_cmpneq_ps(vLengthSq,g_XMInfinity); + // Reciprocal mul to perform the normalization + vResult = _mm_div_ps(P,vResult); + // Any that are infinity, set to zero + vResult = _mm_and_ps(vResult,vLengthSq); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMPlaneIntersectLine +( + FXMVECTOR P, + FXMVECTOR LinePoint1, + FXMVECTOR LinePoint2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V1; + XMVECTOR V2; + XMVECTOR D; + XMVECTOR ReciprocalD; + XMVECTOR VT; + XMVECTOR Point; + XMVECTOR Zero; + XMVECTOR Control; + XMVECTOR Result; + + V1 = XMVector3Dot(P, LinePoint1); + V2 = XMVector3Dot(P, LinePoint2); + D = XMVectorSubtract(V1, V2); + + ReciprocalD = XMVectorReciprocal(D); + VT = XMPlaneDotCoord(P, LinePoint1); + VT = XMVectorMultiply(VT, ReciprocalD); + + Point = XMVectorSubtract(LinePoint2, LinePoint1); + Point = XMVectorMultiplyAdd(Point, VT, LinePoint1); + + Zero = XMVectorZero(); + Control = XMVectorNearEqual(D, Zero, g_XMEpsilon.v); + + Result = XMVectorSelect(Point, g_XMQNaN.v, Control); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR V1; + XMVECTOR V2; + XMVECTOR D; + XMVECTOR VT; + XMVECTOR Point; + XMVECTOR Zero; + XMVECTOR Control; + XMVECTOR Result; + + V1 = XMVector3Dot(P, LinePoint1); + V2 = XMVector3Dot(P, LinePoint2); + D = _mm_sub_ps(V1, V2); + + VT = XMPlaneDotCoord(P, LinePoint1); + VT = _mm_div_ps(VT, D); + + Point = _mm_sub_ps(LinePoint2, LinePoint1); + Point = _mm_mul_ps(Point,VT); + Point = _mm_add_ps(Point,LinePoint1); + Zero = XMVectorZero(); + Control = XMVectorNearEqual(D, Zero, g_XMEpsilon); + Result = XMVectorSelect(Point, g_XMQNaN, Control); + return Result; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMINLINE VOID XMPlaneIntersectPlane +( + XMVECTOR* pLinePoint1, + XMVECTOR* pLinePoint2, + FXMVECTOR P1, + FXMVECTOR P2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V1; + XMVECTOR V2; + XMVECTOR V3; + XMVECTOR LengthSq; + XMVECTOR RcpLengthSq; + XMVECTOR Point; + XMVECTOR P1W; + XMVECTOR P2W; + XMVECTOR Control; + XMVECTOR LinePoint1; + XMVECTOR LinePoint2; + + XMASSERT(pLinePoint1); + XMASSERT(pLinePoint2); + + V1 = XMVector3Cross(P2, P1); + + LengthSq = XMVector3LengthSq(V1); + + V2 = XMVector3Cross(P2, V1); + + P1W = XMVectorSplatW(P1); + Point = XMVectorMultiply(V2, P1W); + + V3 = XMVector3Cross(V1, P1); + + P2W = XMVectorSplatW(P2); + Point = XMVectorMultiplyAdd(V3, P2W, Point); + + RcpLengthSq = XMVectorReciprocal(LengthSq); + LinePoint1 = XMVectorMultiply(Point, RcpLengthSq); + + LinePoint2 = XMVectorAdd(LinePoint1, V1); + + Control = XMVectorLessOrEqual(LengthSq, g_XMEpsilon.v); + *pLinePoint1 = XMVectorSelect(LinePoint1,g_XMQNaN.v, Control); + *pLinePoint2 = XMVectorSelect(LinePoint2,g_XMQNaN.v, Control); + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pLinePoint1); + XMASSERT(pLinePoint2); + XMVECTOR V1; + XMVECTOR V2; + XMVECTOR V3; + XMVECTOR LengthSq; + XMVECTOR Point; + XMVECTOR P1W; + XMVECTOR P2W; + XMVECTOR Control; + XMVECTOR LinePoint1; + XMVECTOR LinePoint2; + + V1 = XMVector3Cross(P2, P1); + + LengthSq = XMVector3LengthSq(V1); + + V2 = XMVector3Cross(P2, V1); + + P1W = _mm_shuffle_ps(P1,P1,_MM_SHUFFLE(3,3,3,3)); + Point = _mm_mul_ps(V2, P1W); + + V3 = XMVector3Cross(V1, P1); + + P2W = _mm_shuffle_ps(P2,P2,_MM_SHUFFLE(3,3,3,3)); + V3 = _mm_mul_ps(V3,P2W); + Point = _mm_add_ps(Point,V3); + LinePoint1 = _mm_div_ps(Point,LengthSq); + + LinePoint2 = _mm_add_ps(LinePoint1, V1); + + Control = XMVectorLessOrEqual(LengthSq, g_XMEpsilon); + *pLinePoint1 = XMVectorSelect(LinePoint1,g_XMQNaN, Control); + *pLinePoint2 = XMVectorSelect(LinePoint2,g_XMQNaN, Control); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMPlaneTransform +( + FXMVECTOR P, + CXMMATRIX M +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR X; + XMVECTOR Y; + XMVECTOR Z; + XMVECTOR W; + XMVECTOR Result; + + W = XMVectorSplatW(P); + Z = XMVectorSplatZ(P); + Y = XMVectorSplatY(P); + X = XMVectorSplatX(P); + + Result = XMVectorMultiply(W, M.r[3]); + Result = XMVectorMultiplyAdd(Z, M.r[2], Result); + Result = XMVectorMultiplyAdd(Y, M.r[1], Result); + Result = XMVectorMultiplyAdd(X, M.r[0], Result); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR X = _mm_shuffle_ps(P,P,_MM_SHUFFLE(0,0,0,0)); + XMVECTOR Y = _mm_shuffle_ps(P,P,_MM_SHUFFLE(1,1,1,1)); + XMVECTOR Z = _mm_shuffle_ps(P,P,_MM_SHUFFLE(2,2,2,2)); + XMVECTOR W = _mm_shuffle_ps(P,P,_MM_SHUFFLE(3,3,3,3)); + X = _mm_mul_ps(X, M.r[0]); + Y = _mm_mul_ps(Y, M.r[1]); + Z = _mm_mul_ps(Z, M.r[2]); + W = _mm_mul_ps(W, M.r[3]); + X = _mm_add_ps(X,Z); + Y = _mm_add_ps(Y,W); + X = _mm_add_ps(X,Y); + return X; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMFLOAT4* XMPlaneTransformStream +( + XMFLOAT4* pOutputStream, + UINT OutputStride, + CONST XMFLOAT4* pInputStream, + UINT InputStride, + UINT PlaneCount, + CXMMATRIX M +) +{ + return XMVector4TransformStream(pOutputStream, + OutputStride, + pInputStream, + InputStride, + PlaneCount, + M); +} + +//------------------------------------------------------------------------------ +// Conversion operations +//------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMPlaneFromPointNormal +( + FXMVECTOR Point, + FXMVECTOR Normal +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR W; + XMVECTOR Result; + + W = XMVector3Dot(Point, Normal); + W = XMVectorNegate(W); + Result = XMVectorSelect(W, Normal, g_XMSelect1110.v); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR W; + XMVECTOR Result; + W = XMVector3Dot(Point,Normal); + W = _mm_mul_ps(W,g_XMNegativeOne); + Result = _mm_and_ps(Normal,g_XMMask3); + W = _mm_and_ps(W,g_XMMaskW); + Result = _mm_or_ps(Result,W); + return Result; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMPlaneFromPoints +( + FXMVECTOR Point1, + FXMVECTOR Point2, + FXMVECTOR Point3 +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR N; + XMVECTOR D; + XMVECTOR V21; + XMVECTOR V31; + XMVECTOR Result; + + V21 = XMVectorSubtract(Point1, Point2); + V31 = XMVectorSubtract(Point1, Point3); + + N = XMVector3Cross(V21, V31); + N = XMVector3Normalize(N); + + D = XMPlaneDotNormal(N, Point1); + D = XMVectorNegate(D); + + Result = XMVectorSelect(D, N, g_XMSelect1110.v); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR N; + XMVECTOR D; + XMVECTOR V21; + XMVECTOR V31; + XMVECTOR Result; + + V21 = _mm_sub_ps(Point1, Point2); + V31 = _mm_sub_ps(Point1, Point3); + + N = XMVector3Cross(V21, V31); + N = XMVector3Normalize(N); + + D = XMPlaneDotNormal(N, Point1); + D = _mm_mul_ps(D,g_XMNegativeOne); + N = _mm_and_ps(N,g_XMMask3); + D = _mm_and_ps(D,g_XMMaskW); + Result = _mm_or_ps(D,N); + return Result; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +/**************************************************************************** + * + * Color + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ +// Comparison operations +//------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------ + +XMFINLINE BOOL XMColorEqual +( + FXMVECTOR C1, + FXMVECTOR C2 +) +{ + return XMVector4Equal(C1, C2); +} + +//------------------------------------------------------------------------------ + +XMFINLINE BOOL XMColorNotEqual +( + FXMVECTOR C1, + FXMVECTOR C2 +) +{ + return XMVector4NotEqual(C1, C2); +} + +//------------------------------------------------------------------------------ + +XMFINLINE BOOL XMColorGreater +( + FXMVECTOR C1, + FXMVECTOR C2 +) +{ + return XMVector4Greater(C1, C2); +} + +//------------------------------------------------------------------------------ + +XMFINLINE BOOL XMColorGreaterOrEqual +( + FXMVECTOR C1, + FXMVECTOR C2 +) +{ + return XMVector4GreaterOrEqual(C1, C2); +} + +//------------------------------------------------------------------------------ + +XMFINLINE BOOL XMColorLess +( + FXMVECTOR C1, + FXMVECTOR C2 +) +{ + return XMVector4Less(C1, C2); +} + +//------------------------------------------------------------------------------ + +XMFINLINE BOOL XMColorLessOrEqual +( + FXMVECTOR C1, + FXMVECTOR C2 +) +{ + return XMVector4LessOrEqual(C1, C2); +} + +//------------------------------------------------------------------------------ + +XMFINLINE BOOL XMColorIsNaN +( + FXMVECTOR C +) +{ + return XMVector4IsNaN(C); +} + +//------------------------------------------------------------------------------ + +XMFINLINE BOOL XMColorIsInfinite +( + FXMVECTOR C +) +{ + return XMVector4IsInfinite(C); +} + +//------------------------------------------------------------------------------ +// Computation operations +//------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMColorNegative +( + FXMVECTOR vColor +) +{ +#if defined(_XM_NO_INTRINSICS_) +// XMASSERT(XMVector4GreaterOrEqual(C, XMVectorReplicate(0.0f))); +// XMASSERT(XMVector4LessOrEqual(C, XMVectorReplicate(1.0f))); + XMVECTOR vResult = { + 1.0f - vColor.vector4_f32[0], + 1.0f - vColor.vector4_f32[1], + 1.0f - vColor.vector4_f32[2], + vColor.vector4_f32[3] + }; + return vResult; + +#elif defined(_XM_SSE_INTRINSICS_) + // Negate only x,y and z. + XMVECTOR vTemp = _mm_xor_ps(vColor,g_XMNegate3); + // Add 1,1,1,0 to -x,-y,-z,w + return _mm_add_ps(vTemp,g_XMOne3); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMColorModulate +( + FXMVECTOR C1, + FXMVECTOR C2 +) +{ + return XMVectorMultiply(C1, C2); +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMColorAdjustSaturation +( + FXMVECTOR vColor, + FLOAT fSaturation +) +{ +#if defined(_XM_NO_INTRINSICS_) + CONST XMVECTOR gvLuminance = {0.2125f, 0.7154f, 0.0721f, 0.0f}; + + // Luminance = 0.2125f * C[0] + 0.7154f * C[1] + 0.0721f * C[2]; + // Result = (C - Luminance) * Saturation + Luminance; + + FLOAT fLuminance = (vColor.vector4_f32[0]*gvLuminance.vector4_f32[0])+(vColor.vector4_f32[1]*gvLuminance.vector4_f32[1])+(vColor.vector4_f32[2]*gvLuminance.vector4_f32[2]); + XMVECTOR vResult = { + ((vColor.vector4_f32[0] - fLuminance)*fSaturation)+fLuminance, + ((vColor.vector4_f32[1] - fLuminance)*fSaturation)+fLuminance, + ((vColor.vector4_f32[2] - fLuminance)*fSaturation)+fLuminance, + vColor.vector4_f32[3]}; + return vResult; + +#elif defined(_XM_SSE_INTRINSICS_) + static const XMVECTORF32 gvLuminance = {0.2125f, 0.7154f, 0.0721f, 0.0f}; +// Mul RGB by intensity constants + XMVECTOR vLuminance = _mm_mul_ps(vColor,gvLuminance); +// vResult.x = vLuminance.y, vResult.y = vLuminance.y, +// vResult.z = vLuminance.z, vResult.w = vLuminance.z + XMVECTOR vResult = vLuminance; + vResult = _mm_shuffle_ps(vResult,vResult,_MM_SHUFFLE(2,2,1,1)); +// vLuminance.x += vLuminance.y + vLuminance = _mm_add_ss(vLuminance,vResult); +// Splat vLuminance.z + vResult = _mm_shuffle_ps(vResult,vResult,_MM_SHUFFLE(2,2,2,2)); +// vLuminance.x += vLuminance.z (Dot product) + vLuminance = _mm_add_ss(vLuminance,vResult); +// Splat vLuminance + vLuminance = _mm_shuffle_ps(vLuminance,vLuminance,_MM_SHUFFLE(0,0,0,0)); +// Splat fSaturation + XMVECTOR vSaturation = _mm_set_ps1(fSaturation); +// vResult = ((vColor-vLuminance)*vSaturation)+vLuminance; + vResult = _mm_sub_ps(vColor,vLuminance); + vResult = _mm_mul_ps(vResult,vSaturation); + vResult = _mm_add_ps(vResult,vLuminance); +// Retain w from the source color + vLuminance = _mm_shuffle_ps(vResult,vColor,_MM_SHUFFLE(3,2,2,2)); // x = vResult.z,y = vResult.z,z = vColor.z,w=vColor.w + vResult = _mm_shuffle_ps(vResult,vLuminance,_MM_SHUFFLE(3,0,1,0)); // x = vResult.x,y = vResult.y,z = vResult.z,w=vColor.w + return vResult; +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMColorAdjustContrast +( + FXMVECTOR vColor, + FLOAT fContrast +) +{ +#if defined(_XM_NO_INTRINSICS_) + // Result = (vColor - 0.5f) * fContrast + 0.5f; + XMVECTOR vResult = { + ((vColor.vector4_f32[0]-0.5f) * fContrast) + 0.5f, + ((vColor.vector4_f32[1]-0.5f) * fContrast) + 0.5f, + ((vColor.vector4_f32[2]-0.5f) * fContrast) + 0.5f, + vColor.vector4_f32[3] // Leave W untouched + }; + return vResult; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vScale = _mm_set_ps1(fContrast); // Splat the scale + XMVECTOR vResult = _mm_sub_ps(vColor,g_XMOneHalf); // Subtract 0.5f from the source (Saving source) + vResult = _mm_mul_ps(vResult,vScale); // Mul by scale + vResult = _mm_add_ps(vResult,g_XMOneHalf); // Add 0.5f +// Retain w from the source color + vScale = _mm_shuffle_ps(vResult,vColor,_MM_SHUFFLE(3,2,2,2)); // x = vResult.z,y = vResult.z,z = vColor.z,w=vColor.w + vResult = _mm_shuffle_ps(vResult,vScale,_MM_SHUFFLE(3,0,1,0)); // x = vResult.x,y = vResult.y,z = vResult.z,w=vColor.w + return vResult; +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +/**************************************************************************** + * + * Miscellaneous + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ + +XMINLINE BOOL XMVerifyCPUSupport() +{ +#if defined(_XM_NO_INTRINSICS_) || !defined(_XM_SSE_INTRINSICS_) + return TRUE; +#else // _XM_SSE_INTRINSICS_ + // Note that on Windows 2000 or older, SSE2 detection is not supported so this will always fail + // Detecting SSE2 on older versions of Windows would require using cpuid directly + return ( IsProcessorFeaturePresent( PF_XMMI_INSTRUCTIONS_AVAILABLE ) && IsProcessorFeaturePresent( PF_XMMI64_INSTRUCTIONS_AVAILABLE ) ); +#endif +} + + +//------------------------------------------------------------------------------ + +#define XMASSERT_LINE_STRING_SIZE 16 + +XMINLINE VOID XMAssert +( + CONST CHAR* pExpression, + CONST CHAR* pFileName, + UINT LineNumber +) +{ + CHAR aLineString[XMASSERT_LINE_STRING_SIZE]; + CHAR* pLineString; + UINT Line; + + aLineString[XMASSERT_LINE_STRING_SIZE - 2] = '0'; + aLineString[XMASSERT_LINE_STRING_SIZE - 1] = '\0'; + for (Line = LineNumber, pLineString = aLineString + XMASSERT_LINE_STRING_SIZE - 2; + Line != 0 && pLineString >= aLineString; + Line /= 10, pLineString--) + { + *pLineString = (CHAR)('0' + (Line % 10)); + } + +#ifndef NO_OUTPUT_DEBUG_STRING + OutputDebugStringA("Assertion failed: "); + OutputDebugStringA(pExpression); + OutputDebugStringA(", file "); + OutputDebugStringA(pFileName); + OutputDebugStringA(", line "); + OutputDebugStringA(pLineString + 1); + OutputDebugStringA("\r\n"); +#else + DbgPrint("Assertion failed: %s, file %s, line %d\r\n", pExpression, pFileName, LineNumber); +#endif + + __debugbreak(); +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMFresnelTerm +( + FXMVECTOR CosIncidentAngle, + FXMVECTOR RefractionIndex +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR G; + XMVECTOR D, S; + XMVECTOR V0, V1, V2, V3; + XMVECTOR Result; + + // Result = 0.5f * (g - c)^2 / (g + c)^2 * ((c * (g + c) - 1)^2 / (c * (g - c) + 1)^2 + 1) where + // c = CosIncidentAngle + // g = sqrt(c^2 + RefractionIndex^2 - 1) + + XMASSERT(!XMVector4IsInfinite(CosIncidentAngle)); + + G = XMVectorMultiplyAdd(RefractionIndex, RefractionIndex, g_XMNegativeOne.v); + G = XMVectorMultiplyAdd(CosIncidentAngle, CosIncidentAngle, G); + G = XMVectorAbs(G); + G = XMVectorSqrt(G); + + S = XMVectorAdd(G, CosIncidentAngle); + D = XMVectorSubtract(G, CosIncidentAngle); + + V0 = XMVectorMultiply(D, D); + V1 = XMVectorMultiply(S, S); + V1 = XMVectorReciprocal(V1); + V0 = XMVectorMultiply(g_XMOneHalf.v, V0); + V0 = XMVectorMultiply(V0, V1); + + V2 = XMVectorMultiplyAdd(CosIncidentAngle, S, g_XMNegativeOne.v); + V3 = XMVectorMultiplyAdd(CosIncidentAngle, D, g_XMOne.v); + V2 = XMVectorMultiply(V2, V2); + V3 = XMVectorMultiply(V3, V3); + V3 = XMVectorReciprocal(V3); + V2 = XMVectorMultiplyAdd(V2, V3, g_XMOne.v); + + Result = XMVectorMultiply(V0, V2); + + Result = XMVectorSaturate(Result); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + // Result = 0.5f * (g - c)^2 / (g + c)^2 * ((c * (g + c) - 1)^2 / (c * (g - c) + 1)^2 + 1) where + // c = CosIncidentAngle + // g = sqrt(c^2 + RefractionIndex^2 - 1) + + XMASSERT(!XMVector4IsInfinite(CosIncidentAngle)); + + // G = sqrt(abs((RefractionIndex^2-1) + CosIncidentAngle^2)) + XMVECTOR G = _mm_mul_ps(RefractionIndex,RefractionIndex); + XMVECTOR vTemp = _mm_mul_ps(CosIncidentAngle,CosIncidentAngle); + G = _mm_sub_ps(G,g_XMOne); + vTemp = _mm_add_ps(vTemp,G); + // max((0-vTemp),vTemp) == abs(vTemp) + // The abs is needed to deal with refraction and cosine being zero + G = _mm_setzero_ps(); + G = _mm_sub_ps(G,vTemp); + G = _mm_max_ps(G,vTemp); + // Last operation, the sqrt() + G = _mm_sqrt_ps(G); + + // Calc G-C and G+C + XMVECTOR GAddC = _mm_add_ps(G,CosIncidentAngle); + XMVECTOR GSubC = _mm_sub_ps(G,CosIncidentAngle); + // Perform the term (0.5f *(g - c)^2) / (g + c)^2 + XMVECTOR vResult = _mm_mul_ps(GSubC,GSubC); + vTemp = _mm_mul_ps(GAddC,GAddC); + vResult = _mm_mul_ps(vResult,g_XMOneHalf); + vResult = _mm_div_ps(vResult,vTemp); + // Perform the term ((c * (g + c) - 1)^2 / (c * (g - c) + 1)^2 + 1) + GAddC = _mm_mul_ps(GAddC,CosIncidentAngle); + GSubC = _mm_mul_ps(GSubC,CosIncidentAngle); + GAddC = _mm_sub_ps(GAddC,g_XMOne); + GSubC = _mm_add_ps(GSubC,g_XMOne); + GAddC = _mm_mul_ps(GAddC,GAddC); + GSubC = _mm_mul_ps(GSubC,GSubC); + GAddC = _mm_div_ps(GAddC,GSubC); + GAddC = _mm_add_ps(GAddC,g_XMOne); + // Multiply the two term parts + vResult = _mm_mul_ps(vResult,GAddC); + // Clamp to 0.0 - 1.0f + vResult = _mm_max_ps(vResult,g_XMZero); + vResult = _mm_min_ps(vResult,g_XMOne); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE BOOL XMScalarNearEqual +( + FLOAT S1, + FLOAT S2, + FLOAT Epsilon +) +{ + FLOAT Delta = S1 - S2; +#if defined(_XM_NO_INTRINSICS_) + UINT AbsDelta = *(UINT*)&Delta & 0x7FFFFFFF; + return (*(FLOAT*)&AbsDelta <= Epsilon); +#elif defined(_XM_SSE_INTRINSICS_) + return (fabsf(Delta) <= Epsilon); +#else + return (__fabs(Delta) <= Epsilon); +#endif +} + +//------------------------------------------------------------------------------ +// Modulo the range of the given angle such that -XM_PI <= Angle < XM_PI +XMFINLINE FLOAT XMScalarModAngle +( + FLOAT Angle +) +{ + // Note: The modulo is performed with unsigned math only to work + // around a precision error on numbers that are close to PI + float fTemp; +#if defined(_XM_NO_INTRINSICS_) || !defined(_XM_VMX128_INTRINSICS_) + // Normalize the range from 0.0f to XM_2PI + Angle = Angle + XM_PI; + // Perform the modulo, unsigned + fTemp = fabsf(Angle); + fTemp = fTemp - (XM_2PI * (FLOAT)((INT)(fTemp/XM_2PI))); + // Restore the number to the range of -XM_PI to XM_PI-epsilon + fTemp = fTemp - XM_PI; + // If the modulo'd value was negative, restore negation + if (Angle<0.0f) { + fTemp = -fTemp; + } + return fTemp; +#else +#endif +} + +//------------------------------------------------------------------------------ + +XMINLINE FLOAT XMScalarSin +( + FLOAT Value +) +{ +#if defined(_XM_NO_INTRINSICS_) + + FLOAT ValueMod; + FLOAT ValueSq; + XMVECTOR V0123, V0246, V1357, V9111315, V17192123; + XMVECTOR V1, V7, V8; + XMVECTOR R0, R1, R2; + + ValueMod = XMScalarModAngle(Value); + + // sin(V) ~= V - V^3 / 3! + V^5 / 5! - V^7 / 7! + V^9 / 9! - V^11 / 11! + V^13 / 13! - V^15 / 15! + + // V^17 / 17! - V^19 / 19! + V^21 / 21! - V^23 / 23! (for -PI <= V < PI) + + ValueSq = ValueMod * ValueMod; + + V0123 = XMVectorSet(1.0f, ValueMod, ValueSq, ValueSq * ValueMod); + V1 = XMVectorSplatY(V0123); + V0246 = XMVectorMultiply(V0123, V0123); + V1357 = XMVectorMultiply(V0246, V1); + V7 = XMVectorSplatW(V1357); + V8 = XMVectorMultiply(V7, V1); + V9111315 = XMVectorMultiply(V1357, V8); + V17192123 = XMVectorMultiply(V9111315, V8); + + R0 = XMVector4Dot(V1357, g_XMSinCoefficients0.v); + R1 = XMVector4Dot(V9111315, g_XMSinCoefficients1.v); + R2 = XMVector4Dot(V17192123, g_XMSinCoefficients2.v); + + return R0.vector4_f32[0] + R1.vector4_f32[0] + R2.vector4_f32[0]; + +#elif defined(_XM_SSE_INTRINSICS_) + return sinf( Value ); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMINLINE FLOAT XMScalarCos +( + FLOAT Value +) +{ +#if defined(_XM_NO_INTRINSICS_) + + FLOAT ValueMod; + FLOAT ValueSq; + XMVECTOR V0123, V0246, V8101214, V16182022; + XMVECTOR V2, V6, V8; + XMVECTOR R0, R1, R2; + + ValueMod = XMScalarModAngle(Value); + + // cos(V) ~= 1 - V^2 / 2! + V^4 / 4! - V^6 / 6! + V^8 / 8! - V^10 / 10! + + // V^12 / 12! - V^14 / 14! + V^16 / 16! - V^18 / 18! + V^20 / 20! - V^22 / 22! (for -PI <= V < PI) + + ValueSq = ValueMod * ValueMod; + + V0123 = XMVectorSet(1.0f, ValueMod, ValueSq, ValueSq * ValueMod); + V0246 = XMVectorMultiply(V0123, V0123); + + V2 = XMVectorSplatZ(V0123); + V6 = XMVectorSplatW(V0246); + V8 = XMVectorMultiply(V6, V2); + + V8101214 = XMVectorMultiply(V0246, V8); + V16182022 = XMVectorMultiply(V8101214, V8); + + R0 = XMVector4Dot(V0246, g_XMCosCoefficients0.v); + R1 = XMVector4Dot(V8101214, g_XMCosCoefficients1.v); + R2 = XMVector4Dot(V16182022, g_XMCosCoefficients2.v); + + return R0.vector4_f32[0] + R1.vector4_f32[0] + R2.vector4_f32[0]; + +#elif defined(_XM_SSE_INTRINSICS_) + return cosf(Value); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMINLINE VOID XMScalarSinCos +( + FLOAT* pSin, + FLOAT* pCos, + FLOAT Value +) +{ +#if defined(_XM_NO_INTRINSICS_) + + FLOAT ValueMod; + FLOAT ValueSq; + XMVECTOR V0123, V0246, V1357, V8101214, V9111315, V16182022, V17192123; + XMVECTOR V1, V2, V6, V8; + XMVECTOR S0, S1, S2, C0, C1, C2; + + XMASSERT(pSin); + XMASSERT(pCos); + + ValueMod = XMScalarModAngle(Value); + + // sin(V) ~= V - V^3 / 3! + V^5 / 5! - V^7 / 7! + V^9 / 9! - V^11 / 11! + V^13 / 13! - V^15 / 15! + + // V^17 / 17! - V^19 / 19! + V^21 / 21! - V^23 / 23! (for -PI <= V < PI) + // cos(V) ~= 1 - V^2 / 2! + V^4 / 4! - V^6 / 6! + V^8 / 8! - V^10 / 10! + + // V^12 / 12! - V^14 / 14! + V^16 / 16! - V^18 / 18! + V^20 / 20! - V^22 / 22! (for -PI <= V < PI) + + ValueSq = ValueMod * ValueMod; + + V0123 = XMVectorSet(1.0f, ValueMod, ValueSq, ValueSq * ValueMod); + + V1 = XMVectorSplatY(V0123); + V2 = XMVectorSplatZ(V0123); + + V0246 = XMVectorMultiply(V0123, V0123); + V1357 = XMVectorMultiply(V0246, V1); + + V6 = XMVectorSplatW(V0246); + V8 = XMVectorMultiply(V6, V2); + + V8101214 = XMVectorMultiply(V0246, V8); + V9111315 = XMVectorMultiply(V1357, V8); + V16182022 = XMVectorMultiply(V8101214, V8); + V17192123 = XMVectorMultiply(V9111315, V8); + + C0 = XMVector4Dot(V0246, g_XMCosCoefficients0.v); + S0 = XMVector4Dot(V1357, g_XMSinCoefficients0.v); + C1 = XMVector4Dot(V8101214, g_XMCosCoefficients1.v); + S1 = XMVector4Dot(V9111315, g_XMSinCoefficients1.v); + C2 = XMVector4Dot(V16182022, g_XMCosCoefficients2.v); + S2 = XMVector4Dot(V17192123, g_XMSinCoefficients2.v); + + *pCos = C0.vector4_f32[0] + C1.vector4_f32[0] + C2.vector4_f32[0]; + *pSin = S0.vector4_f32[0] + S1.vector4_f32[0] + S2.vector4_f32[0]; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pSin); + XMASSERT(pCos); + + *pSin = sinf(Value); + *pCos = cosf(Value); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMINLINE FLOAT XMScalarASin +( + FLOAT Value +) +{ +#if defined(_XM_NO_INTRINSICS_) + + FLOAT AbsValue, Value2, Value3, D; + XMVECTOR AbsV, R0, R1, Result; + XMVECTOR V3; + + *(UINT*)&AbsValue = *(UINT*)&Value & 0x7FFFFFFF; + + Value2 = Value * AbsValue; + Value3 = Value * Value2; + D = (Value - Value2) / sqrtf(1.00000011921f - AbsValue); + + AbsV = XMVectorReplicate(AbsValue); + + V3.vector4_f32[0] = Value3; + V3.vector4_f32[1] = 1.0f; + V3.vector4_f32[2] = Value3; + V3.vector4_f32[3] = 1.0f; + + R1 = XMVectorSet(D, D, Value, Value); + R1 = XMVectorMultiply(R1, V3); + + R0 = XMVectorMultiplyAdd(AbsV, g_XMASinCoefficients0.v, g_XMASinCoefficients1.v); + R0 = XMVectorMultiplyAdd(AbsV, R0, g_XMASinCoefficients2.v); + + Result = XMVector4Dot(R0, R1); + + return Result.vector4_f32[0]; + +#elif defined(_XM_SSE_INTRINSICS_) + return asinf(Value); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMINLINE FLOAT XMScalarACos +( + FLOAT Value +) +{ +#if defined(_XM_NO_INTRINSICS_) + + return XM_PIDIV2 - XMScalarASin(Value); + +#elif defined(_XM_SSE_INTRINSICS_) + return acosf(Value); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE FLOAT XMScalarSinEst +( + FLOAT Value +) +{ +#if defined(_XM_NO_INTRINSICS_) + + FLOAT ValueSq; + XMVECTOR V; + XMVECTOR Y; + XMVECTOR Result; + + XMASSERT(Value >= -XM_PI); + XMASSERT(Value < XM_PI); + + // sin(V) ~= V - V^3 / 3! + V^5 / 5! - V^7 / 7! (for -PI <= V < PI) + + ValueSq = Value * Value; + + V = XMVectorSet(1.0f, Value, ValueSq, ValueSq * Value); + Y = XMVectorSplatY(V); + V = XMVectorMultiply(V, V); + V = XMVectorMultiply(V, Y); + + Result = XMVector4Dot(V, g_XMSinEstCoefficients.v); + + return Result.vector4_f32[0]; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(Value >= -XM_PI); + XMASSERT(Value < XM_PI); + float ValueSq = Value*Value; + XMVECTOR vValue = _mm_set_ps1(Value); + XMVECTOR vTemp = _mm_set_ps(ValueSq * Value,ValueSq,Value,1.0f); + vTemp = _mm_mul_ps(vTemp,vTemp); + vTemp = _mm_mul_ps(vTemp,vValue); + // vTemp = Value,Value^3,Value^5,Value^7 + vTemp = _mm_mul_ps(vTemp,g_XMSinEstCoefficients); + vValue = _mm_shuffle_ps(vValue,vTemp,_MM_SHUFFLE(1,0,0,0)); // Copy X to the Z position and Y to the W position + vValue = _mm_add_ps(vValue,vTemp); // Add Z = X+Z; W = Y+W; + vTemp = _mm_shuffle_ps(vTemp,vValue,_MM_SHUFFLE(0,3,0,0)); // Copy W to the Z position + vTemp = _mm_add_ps(vTemp,vValue); // Add Z and W together + vTemp = _mm_shuffle_ps(vTemp,vTemp,_MM_SHUFFLE(2,2,2,2)); // Splat Z and return +#if defined(_MSC_VER) && (_MSC_VER>=1500) + return _mm_cvtss_f32(vTemp); +#else + return vTemp.m128_f32[0]; +#endif +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE FLOAT XMScalarCosEst +( + FLOAT Value +) +{ +#if defined(_XM_NO_INTRINSICS_) + FLOAT ValueSq; + XMVECTOR V; + XMVECTOR Result; + XMASSERT(Value >= -XM_PI); + XMASSERT(Value < XM_PI); + // cos(V) ~= 1 - V^2 / 2! + V^4 / 4! - V^6 / 6! (for -PI <= V < PI) + ValueSq = Value * Value; + V = XMVectorSet(1.0f, Value, ValueSq, ValueSq * Value); + V = XMVectorMultiply(V, V); + Result = XMVector4Dot(V, g_XMCosEstCoefficients.v); + return Result.vector4_f32[0]; +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(Value >= -XM_PI); + XMASSERT(Value < XM_PI); + float ValueSq = Value*Value; + XMVECTOR vValue = _mm_setzero_ps(); + XMVECTOR vTemp = _mm_set_ps(ValueSq * Value,ValueSq,Value,1.0f); + vTemp = _mm_mul_ps(vTemp,vTemp); + // vTemp = 1.0f,Value^2,Value^4,Value^6 + vTemp = _mm_mul_ps(vTemp,g_XMCosEstCoefficients); + vValue = _mm_shuffle_ps(vValue,vTemp,_MM_SHUFFLE(1,0,0,0)); // Copy X to the Z position and Y to the W position + vValue = _mm_add_ps(vValue,vTemp); // Add Z = X+Z; W = Y+W; + vTemp = _mm_shuffle_ps(vTemp,vValue,_MM_SHUFFLE(0,3,0,0)); // Copy W to the Z position + vTemp = _mm_add_ps(vTemp,vValue); // Add Z and W together + vTemp = _mm_shuffle_ps(vTemp,vTemp,_MM_SHUFFLE(2,2,2,2)); // Splat Z and return +#if defined(_MSC_VER) && (_MSC_VER>=1500) + return _mm_cvtss_f32(vTemp); +#else + return vTemp.m128_f32[0]; +#endif +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMScalarSinCosEst +( + FLOAT* pSin, + FLOAT* pCos, + FLOAT Value +) +{ +#if defined(_XM_NO_INTRINSICS_) + + FLOAT ValueSq; + XMVECTOR V, Sin, Cos; + XMVECTOR Y; + + XMASSERT(pSin); + XMASSERT(pCos); + XMASSERT(Value >= -XM_PI); + XMASSERT(Value < XM_PI); + + // sin(V) ~= V - V^3 / 3! + V^5 / 5! - V^7 / 7! (for -PI <= V < PI) + // cos(V) ~= 1 - V^2 / 2! + V^4 / 4! - V^6 / 6! (for -PI <= V < PI) + + ValueSq = Value * Value; + V = XMVectorSet(1.0f, Value, ValueSq, Value * ValueSq); + Y = XMVectorSplatY(V); + Cos = XMVectorMultiply(V, V); + Sin = XMVectorMultiply(Cos, Y); + + Cos = XMVector4Dot(Cos, g_XMCosEstCoefficients.v); + Sin = XMVector4Dot(Sin, g_XMSinEstCoefficients.v); + + *pCos = Cos.vector4_f32[0]; + *pSin = Sin.vector4_f32[0]; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pSin); + XMASSERT(pCos); + XMASSERT(Value >= -XM_PI); + XMASSERT(Value < XM_PI); + float ValueSq = Value * Value; + XMVECTOR Cos = _mm_set_ps(Value * ValueSq,ValueSq,Value,1.0f); + XMVECTOR Sin = _mm_set_ps1(Value); + Cos = _mm_mul_ps(Cos,Cos); + Sin = _mm_mul_ps(Sin,Cos); + // Cos = 1.0f,Value^2,Value^4,Value^6 + Cos = XMVector4Dot(Cos,g_XMCosEstCoefficients); + _mm_store_ss(pCos,Cos); + // Sin = Value,Value^3,Value^5,Value^7 + Sin = XMVector4Dot(Sin, g_XMSinEstCoefficients); + _mm_store_ss(pSin,Sin); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE FLOAT XMScalarASinEst +( + FLOAT Value +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR VR, CR, CS; + XMVECTOR Result; + FLOAT AbsV, V2, D; + CONST FLOAT OnePlusEps = 1.00000011921f; + + *(UINT*)&AbsV = *(UINT*)&Value & 0x7FFFFFFF; + V2 = Value * AbsV; + D = OnePlusEps - AbsV; + + CS = XMVectorSet(Value, 1.0f, 1.0f, V2); + VR = XMVectorSet(sqrtf(D), Value, V2, D * AbsV); + CR = XMVectorMultiply(CS, g_XMASinEstCoefficients.v); + + Result = XMVector4Dot(VR, CR); + + return Result.vector4_f32[0]; + +#elif defined(_XM_SSE_INTRINSICS_) + CONST FLOAT OnePlusEps = 1.00000011921f; + FLOAT AbsV = fabsf(Value); + FLOAT V2 = Value * AbsV; // Square with sign retained + FLOAT D = OnePlusEps - AbsV; + + XMVECTOR Result = _mm_set_ps(V2,1.0f,1.0f,Value); + XMVECTOR VR = _mm_set_ps(D * AbsV,V2,Value,sqrtf(D)); + Result = _mm_mul_ps(Result, g_XMASinEstCoefficients); + Result = XMVector4Dot(VR,Result); +#if defined(_MSC_VER) && (_MSC_VER>=1500) + return _mm_cvtss_f32(Result); +#else + return Result.m128_f32[0]; +#endif +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE FLOAT XMScalarACosEst +( + FLOAT Value +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR VR, CR, CS; + XMVECTOR Result; + FLOAT AbsV, V2, D; + CONST FLOAT OnePlusEps = 1.00000011921f; + + // return XM_PIDIV2 - XMScalarASin(Value); + + *(UINT*)&AbsV = *(UINT*)&Value & 0x7FFFFFFF; + V2 = Value * AbsV; + D = OnePlusEps - AbsV; + + CS = XMVectorSet(Value, 1.0f, 1.0f, V2); + VR = XMVectorSet(sqrtf(D), Value, V2, D * AbsV); + CR = XMVectorMultiply(CS, g_XMASinEstCoefficients.v); + + Result = XMVector4Dot(VR, CR); + + return XM_PIDIV2 - Result.vector4_f32[0]; + +#elif defined(_XM_SSE_INTRINSICS_) + CONST FLOAT OnePlusEps = 1.00000011921f; + FLOAT AbsV = fabsf(Value); + FLOAT V2 = Value * AbsV; // Value^2 retaining sign + FLOAT D = OnePlusEps - AbsV; + XMVECTOR Result = _mm_set_ps(V2,1.0f,1.0f,Value); + XMVECTOR VR = _mm_set_ps(D * AbsV,V2,Value,sqrtf(D)); + Result = _mm_mul_ps(Result,g_XMASinEstCoefficients); + Result = XMVector4Dot(VR,Result); +#if defined(_MSC_VER) && (_MSC_VER>=1500) + return XM_PIDIV2 - _mm_cvtss_f32(Result); +#else + return XM_PIDIV2 - Result.m128_f32[0]; +#endif +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +#endif // __XNAMATHMISC_INL__ + diff --git a/MediaClient/MediaClient/directx/include/xnamathvector.inl b/MediaClient/MediaClient/directx/include/xnamathvector.inl new file mode 100644 index 0000000..bfea1d0 --- /dev/null +++ b/MediaClient/MediaClient/directx/include/xnamathvector.inl @@ -0,0 +1,13279 @@ +/*++ + +Copyright (c) Microsoft Corporation. All rights reserved. + +Module Name: + + xnamathvector.inl + +Abstract: + + XNA math library for Windows and Xbox 360: Vector functions +--*/ + +#if defined(_MSC_VER) && (_MSC_VER > 1000) +#pragma once +#endif + +#ifndef __XNAMATHVECTOR_INL__ +#define __XNAMATHVECTOR_INL__ + +#if defined(_XM_NO_INTRINSICS_) +#define XMISNAN(x) ((*(UINT*)&(x) & 0x7F800000) == 0x7F800000 && (*(UINT*)&(x) & 0x7FFFFF) != 0) +#define XMISINF(x) ((*(UINT*)&(x) & 0x7FFFFFFF) == 0x7F800000) +#endif + +/**************************************************************************** + * + * General Vector + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ +// Assignment operations +//------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------ +// Return a vector with all elements equaling zero +XMFINLINE XMVECTOR XMVectorZero() +{ +#if defined(_XM_NO_INTRINSICS_) + XMVECTOR vResult = {0.0f,0.0f,0.0f,0.0f}; + return vResult; +#elif defined(_XM_SSE_INTRINSICS_) + return _mm_setzero_ps(); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ +// Initialize a vector with four floating point values +XMFINLINE XMVECTOR XMVectorSet +( + FLOAT x, + FLOAT y, + FLOAT z, + FLOAT w +) +{ +#if defined(_XM_NO_INTRINSICS_) + XMVECTORF32 vResult = {x,y,z,w}; + return vResult.v; +#elif defined(_XM_SSE_INTRINSICS_) + return _mm_set_ps( w, z, y, x ); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ +// Initialize a vector with four integer values +XMFINLINE XMVECTOR XMVectorSetInt +( + UINT x, + UINT y, + UINT z, + UINT w +) +{ +#if defined(_XM_NO_INTRINSICS_) + XMVECTORU32 vResult = {x,y,z,w}; + return vResult.v; +#elif defined(_XM_SSE_INTRINSICS_) + __m128i V = _mm_set_epi32( w, z, y, x ); + return reinterpret_cast<__m128 *>(&V)[0]; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ +// Initialize a vector with a replicated floating point value +XMFINLINE XMVECTOR XMVectorReplicate +( + FLOAT Value +) +{ +#if defined(_XM_NO_INTRINSICS_) || defined(XM_NO_MISALIGNED_VECTOR_ACCESS) + XMVECTORF32 vResult = {Value,Value,Value,Value}; + return vResult.v; +#elif defined(_XM_SSE_INTRINSICS_) + return _mm_set_ps1( Value ); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ +// Initialize a vector with a replicated floating point value passed by pointer +XMFINLINE XMVECTOR XMVectorReplicatePtr +( + CONST FLOAT *pValue +) +{ +#if defined(_XM_NO_INTRINSICS_) || defined(XM_NO_MISALIGNED_VECTOR_ACCESS) + FLOAT Value = pValue[0]; + XMVECTORF32 vResult = {Value,Value,Value,Value}; + return vResult.v; +#elif defined(_XM_SSE_INTRINSICS_) + return _mm_load_ps1( pValue ); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ +// Initialize a vector with a replicated integer value +XMFINLINE XMVECTOR XMVectorReplicateInt +( + UINT Value +) +{ +#if defined(_XM_NO_INTRINSICS_) || defined(XM_NO_MISALIGNED_VECTOR_ACCESS) + XMVECTORU32 vResult = {Value,Value,Value,Value}; + return vResult.v; +#elif defined(_XM_SSE_INTRINSICS_) + __m128i vTemp = _mm_set1_epi32( Value ); + return reinterpret_cast(&vTemp)[0]; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ +// Initialize a vector with a replicated integer value passed by pointer +XMFINLINE XMVECTOR XMVectorReplicateIntPtr +( + CONST UINT *pValue +) +{ +#if defined(_XM_NO_INTRINSICS_) || defined(XM_NO_MISALIGNED_VECTOR_ACCESS) + UINT Value = pValue[0]; + XMVECTORU32 vResult = {Value,Value,Value,Value}; + return vResult.v; +#elif defined(_XM_SSE_INTRINSICS_) + return _mm_load_ps1(reinterpret_cast(pValue)); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ +// Initialize a vector with all bits set (true mask) +XMFINLINE XMVECTOR XMVectorTrueInt() +{ +#if defined(_XM_NO_INTRINSICS_) + XMVECTORU32 vResult = {0xFFFFFFFFU,0xFFFFFFFFU,0xFFFFFFFFU,0xFFFFFFFFU}; + return vResult.v; +#elif defined(_XM_SSE_INTRINSICS_) + __m128i V = _mm_set1_epi32(-1); + return reinterpret_cast<__m128 *>(&V)[0]; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ +// Initialize a vector with all bits clear (false mask) +XMFINLINE XMVECTOR XMVectorFalseInt() +{ +#if defined(_XM_NO_INTRINSICS_) + XMVECTOR vResult = {0.0f,0.0f,0.0f,0.0f}; + return vResult; +#elif defined(_XM_SSE_INTRINSICS_) + return _mm_setzero_ps(); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ +// Replicate the x component of the vector +XMFINLINE XMVECTOR XMVectorSplatX +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + XMVECTOR vResult; + vResult.vector4_f32[0] = + vResult.vector4_f32[1] = + vResult.vector4_f32[2] = + vResult.vector4_f32[3] = V.vector4_f32[0]; + return vResult; +#elif defined(_XM_SSE_INTRINSICS_) + return _mm_shuffle_ps( V, V, _MM_SHUFFLE(0, 0, 0, 0) ); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ +// Replicate the y component of the vector +XMFINLINE XMVECTOR XMVectorSplatY +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + XMVECTOR vResult; + vResult.vector4_f32[0] = + vResult.vector4_f32[1] = + vResult.vector4_f32[2] = + vResult.vector4_f32[3] = V.vector4_f32[1]; + return vResult; +#elif defined(_XM_SSE_INTRINSICS_) + return _mm_shuffle_ps( V, V, _MM_SHUFFLE(1, 1, 1, 1) ); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ +// Replicate the z component of the vector +XMFINLINE XMVECTOR XMVectorSplatZ +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + XMVECTOR vResult; + vResult.vector4_f32[0] = + vResult.vector4_f32[1] = + vResult.vector4_f32[2] = + vResult.vector4_f32[3] = V.vector4_f32[2]; + return vResult; +#elif defined(_XM_SSE_INTRINSICS_) + return _mm_shuffle_ps( V, V, _MM_SHUFFLE(2, 2, 2, 2) ); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ +// Replicate the w component of the vector +XMFINLINE XMVECTOR XMVectorSplatW +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + XMVECTOR vResult; + vResult.vector4_f32[0] = + vResult.vector4_f32[1] = + vResult.vector4_f32[2] = + vResult.vector4_f32[3] = V.vector4_f32[3]; + return vResult; +#elif defined(_XM_SSE_INTRINSICS_) + return _mm_shuffle_ps( V, V, _MM_SHUFFLE(3, 3, 3, 3) ); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ +// Return a vector of 1.0f,1.0f,1.0f,1.0f +XMFINLINE XMVECTOR XMVectorSplatOne() +{ +#if defined(_XM_NO_INTRINSICS_) + XMVECTOR vResult; + vResult.vector4_f32[0] = + vResult.vector4_f32[1] = + vResult.vector4_f32[2] = + vResult.vector4_f32[3] = 1.0f; + return vResult; +#elif defined(_XM_SSE_INTRINSICS_) + return g_XMOne; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ +// Return a vector of INF,INF,INF,INF +XMFINLINE XMVECTOR XMVectorSplatInfinity() +{ +#if defined(_XM_NO_INTRINSICS_) + XMVECTOR vResult; + vResult.vector4_u32[0] = + vResult.vector4_u32[1] = + vResult.vector4_u32[2] = + vResult.vector4_u32[3] = 0x7F800000; + return vResult; +#elif defined(_XM_SSE_INTRINSICS_) + return g_XMInfinity; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ +// Return a vector of Q_NAN,Q_NAN,Q_NAN,Q_NAN +XMFINLINE XMVECTOR XMVectorSplatQNaN() +{ +#if defined(_XM_NO_INTRINSICS_) + XMVECTOR vResult; + vResult.vector4_u32[0] = + vResult.vector4_u32[1] = + vResult.vector4_u32[2] = + vResult.vector4_u32[3] = 0x7FC00000; + return vResult; +#elif defined(_XM_SSE_INTRINSICS_) + return g_XMQNaN; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ +// Return a vector of 1.192092896e-7f,1.192092896e-7f,1.192092896e-7f,1.192092896e-7f +XMFINLINE XMVECTOR XMVectorSplatEpsilon() +{ +#if defined(_XM_NO_INTRINSICS_) + XMVECTOR vResult; + vResult.vector4_u32[0] = + vResult.vector4_u32[1] = + vResult.vector4_u32[2] = + vResult.vector4_u32[3] = 0x34000000; + return vResult; +#elif defined(_XM_SSE_INTRINSICS_) + return g_XMEpsilon; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ +// Return a vector of -0.0f (0x80000000),-0.0f,-0.0f,-0.0f +XMFINLINE XMVECTOR XMVectorSplatSignMask() +{ +#if defined(_XM_NO_INTRINSICS_) + XMVECTOR vResult; + vResult.vector4_u32[0] = + vResult.vector4_u32[1] = + vResult.vector4_u32[2] = + vResult.vector4_u32[3] = 0x80000000U; + return vResult; +#elif defined(_XM_SSE_INTRINSICS_) + __m128i V = _mm_set1_epi32( 0x80000000 ); + return reinterpret_cast<__m128*>(&V)[0]; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ +// Return a floating point value via an index. This is not a recommended +// function to use due to performance loss. +XMFINLINE FLOAT XMVectorGetByIndex(FXMVECTOR V,UINT i) +{ + XMASSERT( i <= 3 ); +#if defined(_XM_NO_INTRINSICS_) + return V.vector4_f32[i]; +#elif defined(_XM_SSE_INTRINSICS_) + return V.m128_f32[i]; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ +// Return the X component in an FPU register. +// This causes Load/Hit/Store on VMX targets +XMFINLINE FLOAT XMVectorGetX(FXMVECTOR V) +{ +#if defined(_XM_NO_INTRINSICS_) + return V.vector4_f32[0]; +#elif defined(_XM_SSE_INTRINSICS_) +#if defined(_MSC_VER) && (_MSC_VER>=1500) + return _mm_cvtss_f32(V); +#else + return V.m128_f32[0]; +#endif +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +// Return the Y component in an FPU register. +// This causes Load/Hit/Store on VMX targets +XMFINLINE FLOAT XMVectorGetY(FXMVECTOR V) +{ +#if defined(_XM_NO_INTRINSICS_) + return V.vector4_f32[1]; +#elif defined(_XM_SSE_INTRINSICS_) +#if defined(_MSC_VER) && (_MSC_VER>=1500) + XMVECTOR vTemp = _mm_shuffle_ps(V,V,_MM_SHUFFLE(1,1,1,1)); + return _mm_cvtss_f32(vTemp); +#else + return V.m128_f32[1]; +#endif +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +// Return the Z component in an FPU register. +// This causes Load/Hit/Store on VMX targets +XMFINLINE FLOAT XMVectorGetZ(FXMVECTOR V) +{ +#if defined(_XM_NO_INTRINSICS_) + return V.vector4_f32[2]; +#elif defined(_XM_SSE_INTRINSICS_) +#if defined(_MSC_VER) && (_MSC_VER>=1500) + XMVECTOR vTemp = _mm_shuffle_ps(V,V,_MM_SHUFFLE(2,2,2,2)); + return _mm_cvtss_f32(vTemp); +#else + return V.m128_f32[2]; +#endif +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +// Return the W component in an FPU register. +// This causes Load/Hit/Store on VMX targets +XMFINLINE FLOAT XMVectorGetW(FXMVECTOR V) +{ +#if defined(_XM_NO_INTRINSICS_) + return V.vector4_f32[3]; +#elif defined(_XM_SSE_INTRINSICS_) +#if defined(_MSC_VER) && (_MSC_VER>=1500) + XMVECTOR vTemp = _mm_shuffle_ps(V,V,_MM_SHUFFLE(3,3,3,3)); + return _mm_cvtss_f32(vTemp); +#else + return V.m128_f32[3]; +#endif +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +// Store a component indexed by i into a 32 bit float location in memory. +// This causes Load/Hit/Store on VMX targets +XMFINLINE VOID XMVectorGetByIndexPtr(FLOAT *f,FXMVECTOR V,UINT i) +{ + XMASSERT( f != 0 ); + XMASSERT( i < 4 ); +#if defined(_XM_NO_INTRINSICS_) + *f = V.vector4_f32[i]; +#elif defined(_XM_SSE_INTRINSICS_) + *f = V.m128_f32[i]; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +// Store the X component into a 32 bit float location in memory. +XMFINLINE VOID XMVectorGetXPtr(FLOAT *x,FXMVECTOR V) +{ + XMASSERT( x != 0 ); +#if defined(_XM_NO_INTRINSICS_) + *x = V.vector4_f32[0]; +#elif defined(_XM_SSE_INTRINSICS_) + _mm_store_ss(x,V); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +// Store the Y component into a 32 bit float location in memory. +XMFINLINE VOID XMVectorGetYPtr(FLOAT *y,FXMVECTOR V) +{ + XMASSERT( y != 0 ); +#if defined(_XM_NO_INTRINSICS_) + *y = V.vector4_f32[1]; +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vResult = _mm_shuffle_ps(V,V,_MM_SHUFFLE(1,1,1,1)); + _mm_store_ss(y,vResult); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +// Store the Z component into a 32 bit float location in memory. +XMFINLINE VOID XMVectorGetZPtr(FLOAT *z,FXMVECTOR V) +{ + XMASSERT( z != 0 ); +#if defined(_XM_NO_INTRINSICS_) + *z = V.vector4_f32[2]; +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vResult = _mm_shuffle_ps(V,V,_MM_SHUFFLE(2,2,2,2)); + _mm_store_ss(z,vResult); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +// Store the W component into a 32 bit float location in memory. +XMFINLINE VOID XMVectorGetWPtr(FLOAT *w,FXMVECTOR V) +{ + XMASSERT( w != 0 ); +#if defined(_XM_NO_INTRINSICS_) + *w = V.vector4_f32[3]; +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vResult = _mm_shuffle_ps(V,V,_MM_SHUFFLE(3,3,3,3)); + _mm_store_ss(w,vResult); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +// Return an integer value via an index. This is not a recommended +// function to use due to performance loss. +XMFINLINE UINT XMVectorGetIntByIndex(FXMVECTOR V, UINT i) +{ + XMASSERT( i < 4 ); +#if defined(_XM_NO_INTRINSICS_) + return V.vector4_u32[i]; +#elif defined(_XM_SSE_INTRINSICS_) +#if defined(_MSC_VER) && (_MSC_VER<1400) + XMVECTORU32 tmp; + tmp.v = V; + return tmp.u[i]; +#else + return V.m128_u32[i]; +#endif +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +// Return the X component in an integer register. +// This causes Load/Hit/Store on VMX targets +XMFINLINE UINT XMVectorGetIntX(FXMVECTOR V) +{ +#if defined(_XM_NO_INTRINSICS_) + return V.vector4_u32[0]; +#elif defined(_XM_SSE_INTRINSICS_) + return static_cast(_mm_cvtsi128_si32(reinterpret_cast(&V)[0])); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +// Return the Y component in an integer register. +// This causes Load/Hit/Store on VMX targets +XMFINLINE UINT XMVectorGetIntY(FXMVECTOR V) +{ +#if defined(_XM_NO_INTRINSICS_) + return V.vector4_u32[1]; +#elif defined(_XM_SSE_INTRINSICS_) + __m128i vResulti = _mm_shuffle_epi32(reinterpret_cast(&V)[0],_MM_SHUFFLE(1,1,1,1)); + return static_cast(_mm_cvtsi128_si32(vResulti)); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +// Return the Z component in an integer register. +// This causes Load/Hit/Store on VMX targets +XMFINLINE UINT XMVectorGetIntZ(FXMVECTOR V) +{ +#if defined(_XM_NO_INTRINSICS_) + return V.vector4_u32[2]; +#elif defined(_XM_SSE_INTRINSICS_) + __m128i vResulti = _mm_shuffle_epi32(reinterpret_cast(&V)[0],_MM_SHUFFLE(2,2,2,2)); + return static_cast(_mm_cvtsi128_si32(vResulti)); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +// Return the W component in an integer register. +// This causes Load/Hit/Store on VMX targets +XMFINLINE UINT XMVectorGetIntW(FXMVECTOR V) +{ +#if defined(_XM_NO_INTRINSICS_) + return V.vector4_u32[3]; +#elif defined(_XM_SSE_INTRINSICS_) + __m128i vResulti = _mm_shuffle_epi32(reinterpret_cast(&V)[0],_MM_SHUFFLE(3,3,3,3)); + return static_cast(_mm_cvtsi128_si32(vResulti)); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +// Store a component indexed by i into a 32 bit integer location in memory. +// This causes Load/Hit/Store on VMX targets +XMFINLINE VOID XMVectorGetIntByIndexPtr(UINT *x,FXMVECTOR V,UINT i) +{ + XMASSERT( x != 0 ); + XMASSERT( i < 4 ); +#if defined(_XM_NO_INTRINSICS_) + *x = V.vector4_u32[i]; +#elif defined(_XM_SSE_INTRINSICS_) +#if defined(_MSC_VER) && (_MSC_VER<1400) + XMVECTORU32 tmp; + tmp.v = V; + *x = tmp.u[i]; +#else + *x = V.m128_u32[i]; +#endif +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +// Store the X component into a 32 bit integer location in memory. +XMFINLINE VOID XMVectorGetIntXPtr(UINT *x,FXMVECTOR V) +{ + XMASSERT( x != 0 ); +#if defined(_XM_NO_INTRINSICS_) + *x = V.vector4_u32[0]; +#elif defined(_XM_SSE_INTRINSICS_) + _mm_store_ss(reinterpret_cast(x),V); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +// Store the Y component into a 32 bit integer location in memory. +XMFINLINE VOID XMVectorGetIntYPtr(UINT *y,FXMVECTOR V) +{ + XMASSERT( y != 0 ); +#if defined(_XM_NO_INTRINSICS_) + *y = V.vector4_u32[1]; +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vResult = _mm_shuffle_ps(V,V,_MM_SHUFFLE(1,1,1,1)); + _mm_store_ss(reinterpret_cast(y),vResult); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +// Store the Z component into a 32 bit integer locaCantion in memory. +XMFINLINE VOID XMVectorGetIntZPtr(UINT *z,FXMVECTOR V) +{ + XMASSERT( z != 0 ); +#if defined(_XM_NO_INTRINSICS_) + *z = V.vector4_u32[2]; +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vResult = _mm_shuffle_ps(V,V,_MM_SHUFFLE(2,2,2,2)); + _mm_store_ss(reinterpret_cast(z),vResult); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +// Store the W component into a 32 bit integer location in memory. +XMFINLINE VOID XMVectorGetIntWPtr(UINT *w,FXMVECTOR V) +{ + XMASSERT( w != 0 ); +#if defined(_XM_NO_INTRINSICS_) + *w = V.vector4_u32[3]; +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vResult = _mm_shuffle_ps(V,V,_MM_SHUFFLE(3,3,3,3)); + _mm_store_ss(reinterpret_cast(w),vResult); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +// Set a single indexed floating point component +// This causes Load/Hit/Store on VMX targets +XMFINLINE XMVECTOR XMVectorSetByIndex(FXMVECTOR V, FLOAT f,UINT i) +{ +#if defined(_XM_NO_INTRINSICS_) + XMVECTOR U; + XMASSERT( i <= 3 ); + U = V; + U.vector4_f32[i] = f; + return U; +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT( i <= 3 ); + XMVECTOR U = V; + U.m128_f32[i] = f; + return U; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +// Sets the X component of a vector to a passed floating point value +// This causes Load/Hit/Store on VMX targets +XMFINLINE XMVECTOR XMVectorSetX(FXMVECTOR V, FLOAT x) +{ +#if defined(_XM_NO_INTRINSICS_) + XMVECTOR U; + U.vector4_f32[0] = x; + U.vector4_f32[1] = V.vector4_f32[1]; + U.vector4_f32[2] = V.vector4_f32[2]; + U.vector4_f32[3] = V.vector4_f32[3]; + return U; +#elif defined(_XM_SSE_INTRINSICS_) +#if defined(_XM_ISVS2005_) + XMVECTOR vResult = V; + vResult.m128_f32[0] = x; + return vResult; +#else + XMVECTOR vResult = _mm_set_ss(x); + vResult = _mm_move_ss(V,vResult); + return vResult; +#endif // _XM_ISVS2005_ +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +// Sets the Y component of a vector to a passed floating point value +// This causes Load/Hit/Store on VMX targets +XMFINLINE XMVECTOR XMVectorSetY(FXMVECTOR V, FLOAT y) +{ +#if defined(_XM_NO_INTRINSICS_) + XMVECTOR U; + U.vector4_f32[0] = V.vector4_f32[0]; + U.vector4_f32[1] = y; + U.vector4_f32[2] = V.vector4_f32[2]; + U.vector4_f32[3] = V.vector4_f32[3]; + return U; +#elif defined(_XM_SSE_INTRINSICS_) +#if defined(_XM_ISVS2005_) + XMVECTOR vResult = V; + vResult.m128_f32[1] = y; + return vResult; +#else + // Swap y and x + XMVECTOR vResult = _mm_shuffle_ps(V,V,_MM_SHUFFLE(3,2,0,1)); + // Convert input to vector + XMVECTOR vTemp = _mm_set_ss(y); + // Replace the x component + vResult = _mm_move_ss(vResult,vTemp); + // Swap y and x again + vResult = _mm_shuffle_ps(vResult,vResult,_MM_SHUFFLE(3,2,0,1)); + return vResult; +#endif // _XM_ISVS2005_ +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} +// Sets the Z component of a vector to a passed floating point value +// This causes Load/Hit/Store on VMX targets +XMFINLINE XMVECTOR XMVectorSetZ(FXMVECTOR V, FLOAT z) +{ +#if defined(_XM_NO_INTRINSICS_) + XMVECTOR U; + U.vector4_f32[0] = V.vector4_f32[0]; + U.vector4_f32[1] = V.vector4_f32[1]; + U.vector4_f32[2] = z; + U.vector4_f32[3] = V.vector4_f32[3]; + return U; +#elif defined(_XM_SSE_INTRINSICS_) +#if defined(_XM_ISVS2005_) + XMVECTOR vResult = V; + vResult.m128_f32[2] = z; + return vResult; +#else + // Swap z and x + XMVECTOR vResult = _mm_shuffle_ps(V,V,_MM_SHUFFLE(3,0,1,2)); + // Convert input to vector + XMVECTOR vTemp = _mm_set_ss(z); + // Replace the x component + vResult = _mm_move_ss(vResult,vTemp); + // Swap z and x again + vResult = _mm_shuffle_ps(vResult,vResult,_MM_SHUFFLE(3,0,1,2)); + return vResult; +#endif // _XM_ISVS2005_ +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +// Sets the W component of a vector to a passed floating point value +// This causes Load/Hit/Store on VMX targets +XMFINLINE XMVECTOR XMVectorSetW(FXMVECTOR V, FLOAT w) +{ +#if defined(_XM_NO_INTRINSICS_) + XMVECTOR U; + U.vector4_f32[0] = V.vector4_f32[0]; + U.vector4_f32[1] = V.vector4_f32[1]; + U.vector4_f32[2] = V.vector4_f32[2]; + U.vector4_f32[3] = w; + return U; +#elif defined(_XM_SSE_INTRINSICS_) +#if defined(_XM_ISVS2005_) + XMVECTOR vResult = V; + vResult.m128_f32[3] = w; + return vResult; +#else + // Swap w and x + XMVECTOR vResult = _mm_shuffle_ps(V,V,_MM_SHUFFLE(0,2,1,3)); + // Convert input to vector + XMVECTOR vTemp = _mm_set_ss(w); + // Replace the x component + vResult = _mm_move_ss(vResult,vTemp); + // Swap w and x again + vResult = _mm_shuffle_ps(vResult,vResult,_MM_SHUFFLE(0,2,1,3)); + return vResult; +#endif // _XM_ISVS2005_ +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +// Sets a component of a vector to a floating point value passed by pointer +// This causes Load/Hit/Store on VMX targets +XMFINLINE XMVECTOR XMVectorSetByIndexPtr(FXMVECTOR V,CONST FLOAT *f,UINT i) +{ +#if defined(_XM_NO_INTRINSICS_) + XMVECTOR U; + XMASSERT( f != 0 ); + XMASSERT( i <= 3 ); + U = V; + U.vector4_f32[i] = *f; + return U; +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT( f != 0 ); + XMASSERT( i <= 3 ); + XMVECTOR U = V; + U.m128_f32[i] = *f; + return U; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +// Sets the X component of a vector to a floating point value passed by pointer +XMFINLINE XMVECTOR XMVectorSetXPtr(FXMVECTOR V,CONST FLOAT *x) +{ +#if defined(_XM_NO_INTRINSICS_) + XMVECTOR U; + XMASSERT( x != 0 ); + U.vector4_f32[0] = *x; + U.vector4_f32[1] = V.vector4_f32[1]; + U.vector4_f32[2] = V.vector4_f32[2]; + U.vector4_f32[3] = V.vector4_f32[3]; + return U; +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT( x != 0 ); + XMVECTOR vResult = _mm_load_ss(x); + vResult = _mm_move_ss(V,vResult); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +// Sets the Y component of a vector to a floating point value passed by pointer +XMFINLINE XMVECTOR XMVectorSetYPtr(FXMVECTOR V,CONST FLOAT *y) +{ +#if defined(_XM_NO_INTRINSICS_) + XMVECTOR U; + XMASSERT( y != 0 ); + U.vector4_f32[0] = V.vector4_f32[0]; + U.vector4_f32[1] = *y; + U.vector4_f32[2] = V.vector4_f32[2]; + U.vector4_f32[3] = V.vector4_f32[3]; + return U; +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT( y != 0 ); + // Swap y and x + XMVECTOR vResult = _mm_shuffle_ps(V,V,_MM_SHUFFLE(3,2,0,1)); + // Convert input to vector + XMVECTOR vTemp = _mm_load_ss(y); + // Replace the x component + vResult = _mm_move_ss(vResult,vTemp); + // Swap y and x again + vResult = _mm_shuffle_ps(vResult,vResult,_MM_SHUFFLE(3,2,0,1)); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +// Sets the Z component of a vector to a floating point value passed by pointer +XMFINLINE XMVECTOR XMVectorSetZPtr(FXMVECTOR V,CONST FLOAT *z) +{ +#if defined(_XM_NO_INTRINSICS_) + XMVECTOR U; + XMASSERT( z != 0 ); + U.vector4_f32[0] = V.vector4_f32[0]; + U.vector4_f32[1] = V.vector4_f32[1]; + U.vector4_f32[2] = *z; + U.vector4_f32[3] = V.vector4_f32[3]; + return U; +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT( z != 0 ); + // Swap z and x + XMVECTOR vResult = _mm_shuffle_ps(V,V,_MM_SHUFFLE(3,0,1,2)); + // Convert input to vector + XMVECTOR vTemp = _mm_load_ss(z); + // Replace the x component + vResult = _mm_move_ss(vResult,vTemp); + // Swap z and x again + vResult = _mm_shuffle_ps(vResult,vResult,_MM_SHUFFLE(3,0,1,2)); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +// Sets the W component of a vector to a floating point value passed by pointer +XMFINLINE XMVECTOR XMVectorSetWPtr(FXMVECTOR V,CONST FLOAT *w) +{ +#if defined(_XM_NO_INTRINSICS_) + XMVECTOR U; + XMASSERT( w != 0 ); + U.vector4_f32[0] = V.vector4_f32[0]; + U.vector4_f32[1] = V.vector4_f32[1]; + U.vector4_f32[2] = V.vector4_f32[2]; + U.vector4_f32[3] = *w; + return U; +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT( w != 0 ); + // Swap w and x + XMVECTOR vResult = _mm_shuffle_ps(V,V,_MM_SHUFFLE(0,2,1,3)); + // Convert input to vector + XMVECTOR vTemp = _mm_load_ss(w); + // Replace the x component + vResult = _mm_move_ss(vResult,vTemp); + // Swap w and x again + vResult = _mm_shuffle_ps(vResult,vResult,_MM_SHUFFLE(0,2,1,3)); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +// Sets a component of a vector to an integer passed by value +// This causes Load/Hit/Store on VMX targets +XMFINLINE XMVECTOR XMVectorSetIntByIndex(FXMVECTOR V, UINT x, UINT i) +{ +#if defined(_XM_NO_INTRINSICS_) + XMVECTOR U; + XMASSERT( i <= 3 ); + U = V; + U.vector4_u32[i] = x; + return U; +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT( i <= 3 ); + XMVECTORU32 tmp; + tmp.v = V; + tmp.u[i] = x; + return tmp; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +// Sets the X component of a vector to an integer passed by value +// This causes Load/Hit/Store on VMX targets +XMFINLINE XMVECTOR XMVectorSetIntX(FXMVECTOR V, UINT x) +{ +#if defined(_XM_NO_INTRINSICS_) + XMVECTOR U; + U.vector4_u32[0] = x; + U.vector4_u32[1] = V.vector4_u32[1]; + U.vector4_u32[2] = V.vector4_u32[2]; + U.vector4_u32[3] = V.vector4_u32[3]; + return U; +#elif defined(_XM_SSE_INTRINSICS_) +#if defined(_XM_ISVS2005_) + XMVECTOR vResult = V; + vResult.m128_i32[0] = x; + return vResult; +#else + __m128i vTemp = _mm_cvtsi32_si128(x); + XMVECTOR vResult = _mm_move_ss(V,reinterpret_cast(&vTemp)[0]); + return vResult; +#endif // _XM_ISVS2005_ +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +// Sets the Y component of a vector to an integer passed by value +// This causes Load/Hit/Store on VMX targets +XMFINLINE XMVECTOR XMVectorSetIntY(FXMVECTOR V, UINT y) +{ +#if defined(_XM_NO_INTRINSICS_) + XMVECTOR U; + U.vector4_u32[0] = V.vector4_u32[0]; + U.vector4_u32[1] = y; + U.vector4_u32[2] = V.vector4_u32[2]; + U.vector4_u32[3] = V.vector4_u32[3]; + return U; +#elif defined(_XM_SSE_INTRINSICS_) +#if defined(_XM_ISVS2005_) + XMVECTOR vResult = V; + vResult.m128_i32[1] = y; + return vResult; +#else // Swap y and x + XMVECTOR vResult = _mm_shuffle_ps(V,V,_MM_SHUFFLE(3,2,0,1)); + // Convert input to vector + __m128i vTemp = _mm_cvtsi32_si128(y); + // Replace the x component + vResult = _mm_move_ss(vResult,reinterpret_cast(&vTemp)[0]); + // Swap y and x again + vResult = _mm_shuffle_ps(vResult,vResult,_MM_SHUFFLE(3,2,0,1)); + return vResult; +#endif // _XM_ISVS2005_ +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +// Sets the Z component of a vector to an integer passed by value +// This causes Load/Hit/Store on VMX targets +XMFINLINE XMVECTOR XMVectorSetIntZ(FXMVECTOR V, UINT z) +{ +#if defined(_XM_NO_INTRINSICS_) + XMVECTOR U; + U.vector4_u32[0] = V.vector4_u32[0]; + U.vector4_u32[1] = V.vector4_u32[1]; + U.vector4_u32[2] = z; + U.vector4_u32[3] = V.vector4_u32[3]; + return U; +#elif defined(_XM_SSE_INTRINSICS_) +#if defined(_XM_ISVS2005_) + XMVECTOR vResult = V; + vResult.m128_i32[2] = z; + return vResult; +#else + // Swap z and x + XMVECTOR vResult = _mm_shuffle_ps(V,V,_MM_SHUFFLE(3,0,1,2)); + // Convert input to vector + __m128i vTemp = _mm_cvtsi32_si128(z); + // Replace the x component + vResult = _mm_move_ss(vResult,reinterpret_cast(&vTemp)[0]); + // Swap z and x again + vResult = _mm_shuffle_ps(vResult,vResult,_MM_SHUFFLE(3,0,1,2)); + return vResult; +#endif // _XM_ISVS2005_ +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +// Sets the W component of a vector to an integer passed by value +// This causes Load/Hit/Store on VMX targets +XMFINLINE XMVECTOR XMVectorSetIntW(FXMVECTOR V, UINT w) +{ +#if defined(_XM_NO_INTRINSICS_) + XMVECTOR U; + U.vector4_u32[0] = V.vector4_u32[0]; + U.vector4_u32[1] = V.vector4_u32[1]; + U.vector4_u32[2] = V.vector4_u32[2]; + U.vector4_u32[3] = w; + return U; +#elif defined(_XM_SSE_INTRINSICS_) +#if defined(_XM_ISVS2005_) + XMVECTOR vResult = V; + vResult.m128_i32[3] = w; + return vResult; +#else + // Swap w and x + XMVECTOR vResult = _mm_shuffle_ps(V,V,_MM_SHUFFLE(0,2,1,3)); + // Convert input to vector + __m128i vTemp = _mm_cvtsi32_si128(w); + // Replace the x component + vResult = _mm_move_ss(vResult,reinterpret_cast(&vTemp)[0]); + // Swap w and x again + vResult = _mm_shuffle_ps(vResult,vResult,_MM_SHUFFLE(0,2,1,3)); + return vResult; +#endif // _XM_ISVS2005_ +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +// Sets a component of a vector to an integer value passed by pointer +// This causes Load/Hit/Store on VMX targets +XMFINLINE XMVECTOR XMVectorSetIntByIndexPtr(FXMVECTOR V, CONST UINT *x,UINT i) +{ +#if defined(_XM_NO_INTRINSICS_) + XMVECTOR U; + XMASSERT( x != 0 ); + XMASSERT( i <= 3 ); + U = V; + U.vector4_u32[i] = *x; + return U; +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT( x != 0 ); + XMASSERT( i <= 3 ); + XMVECTORU32 tmp; + tmp.v = V; + tmp.u[i] = *x; + return tmp; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +// Sets the X component of a vector to an integer value passed by pointer +XMFINLINE XMVECTOR XMVectorSetIntXPtr(FXMVECTOR V,CONST UINT *x) +{ +#if defined(_XM_NO_INTRINSICS_) + XMVECTOR U; + XMASSERT( x != 0 ); + U.vector4_u32[0] = *x; + U.vector4_u32[1] = V.vector4_u32[1]; + U.vector4_u32[2] = V.vector4_u32[2]; + U.vector4_u32[3] = V.vector4_u32[3]; + return U; +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT( x != 0 ); + XMVECTOR vTemp = _mm_load_ss(reinterpret_cast(x)); + XMVECTOR vResult = _mm_move_ss(V,vTemp); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +// Sets the Y component of a vector to an integer value passed by pointer +XMFINLINE XMVECTOR XMVectorSetIntYPtr(FXMVECTOR V,CONST UINT *y) +{ +#if defined(_XM_NO_INTRINSICS_) + XMVECTOR U; + XMASSERT( y != 0 ); + U.vector4_u32[0] = V.vector4_u32[0]; + U.vector4_u32[1] = *y; + U.vector4_u32[2] = V.vector4_u32[2]; + U.vector4_u32[3] = V.vector4_u32[3]; + return U; +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT( y != 0 ); + // Swap y and x + XMVECTOR vResult = _mm_shuffle_ps(V,V,_MM_SHUFFLE(3,2,0,1)); + // Convert input to vector + XMVECTOR vTemp = _mm_load_ss(reinterpret_cast(y)); + // Replace the x component + vResult = _mm_move_ss(vResult,vTemp); + // Swap y and x again + vResult = _mm_shuffle_ps(vResult,vResult,_MM_SHUFFLE(3,2,0,1)); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +// Sets the Z component of a vector to an integer value passed by pointer +XMFINLINE XMVECTOR XMVectorSetIntZPtr(FXMVECTOR V,CONST UINT *z) +{ +#if defined(_XM_NO_INTRINSICS_) + XMVECTOR U; + XMASSERT( z != 0 ); + U.vector4_u32[0] = V.vector4_u32[0]; + U.vector4_u32[1] = V.vector4_u32[1]; + U.vector4_u32[2] = *z; + U.vector4_u32[3] = V.vector4_u32[3]; + return U; +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT( z != 0 ); + // Swap z and x + XMVECTOR vResult = _mm_shuffle_ps(V,V,_MM_SHUFFLE(3,0,1,2)); + // Convert input to vector + XMVECTOR vTemp = _mm_load_ss(reinterpret_cast(z)); + // Replace the x component + vResult = _mm_move_ss(vResult,vTemp); + // Swap z and x again + vResult = _mm_shuffle_ps(vResult,vResult,_MM_SHUFFLE(3,0,1,2)); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +// Sets the W component of a vector to an integer value passed by pointer +XMFINLINE XMVECTOR XMVectorSetIntWPtr(FXMVECTOR V,CONST UINT *w) +{ +#if defined(_XM_NO_INTRINSICS_) + XMVECTOR U; + XMASSERT( w != 0 ); + U.vector4_u32[0] = V.vector4_u32[0]; + U.vector4_u32[1] = V.vector4_u32[1]; + U.vector4_u32[2] = V.vector4_u32[2]; + U.vector4_u32[3] = *w; + return U; +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT( w != 0 ); + // Swap w and x + XMVECTOR vResult = _mm_shuffle_ps(V,V,_MM_SHUFFLE(0,2,1,3)); + // Convert input to vector + XMVECTOR vTemp = _mm_load_ss(reinterpret_cast(w)); + // Replace the x component + vResult = _mm_move_ss(vResult,vTemp); + // Swap w and x again + vResult = _mm_shuffle_ps(vResult,vResult,_MM_SHUFFLE(0,2,1,3)); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ +// Define a control vector to be used in XMVectorPermute +// operations. Visualize the two vectors V1 and V2 given +// in a permute as arranged back to back in a linear fashion, +// such that they form an array of 8 floating point values. +// The four integers specified in XMVectorPermuteControl +// will serve as indices into the array to select components +// from the two vectors. ElementIndex0 is used to select +// an element from the vectors to be placed in the first +// component of the resulting vector, ElementIndex1 is used +// to select an element for the second component, etc. + +XMFINLINE XMVECTOR XMVectorPermuteControl +( + UINT ElementIndex0, + UINT ElementIndex1, + UINT ElementIndex2, + UINT ElementIndex3 +) +{ +#if defined(_XM_SSE_INTRINSICS_) || defined(_XM_NO_INTRINSICS_) + XMVECTORU32 vControl; + static CONST UINT ControlElement[] = { + XM_PERMUTE_0X, + XM_PERMUTE_0Y, + XM_PERMUTE_0Z, + XM_PERMUTE_0W, + XM_PERMUTE_1X, + XM_PERMUTE_1Y, + XM_PERMUTE_1Z, + XM_PERMUTE_1W + }; + XMASSERT(ElementIndex0 < 8); + XMASSERT(ElementIndex1 < 8); + XMASSERT(ElementIndex2 < 8); + XMASSERT(ElementIndex3 < 8); + + vControl.u[0] = ControlElement[ElementIndex0]; + vControl.u[1] = ControlElement[ElementIndex1]; + vControl.u[2] = ControlElement[ElementIndex2]; + vControl.u[3] = ControlElement[ElementIndex3]; + return vControl.v; +#else +#endif +} + +//------------------------------------------------------------------------------ + +// Using a control vector made up of 16 bytes from 0-31, remap V1 and V2's byte +// entries into a single 16 byte vector and return it. Index 0-15 = V1, +// 16-31 = V2 +XMFINLINE XMVECTOR XMVectorPermute +( + FXMVECTOR V1, + FXMVECTOR V2, + FXMVECTOR Control +) +{ +#if defined(_XM_NO_INTRINSICS_) + const BYTE *aByte[2]; + XMVECTOR Result; + UINT i, uIndex, VectorIndex; + const BYTE *pControl; + BYTE *pWork; + + // Indices must be in range from 0 to 31 + XMASSERT((Control.vector4_u32[0] & 0xE0E0E0E0) == 0); + XMASSERT((Control.vector4_u32[1] & 0xE0E0E0E0) == 0); + XMASSERT((Control.vector4_u32[2] & 0xE0E0E0E0) == 0); + XMASSERT((Control.vector4_u32[3] & 0xE0E0E0E0) == 0); + + // 0-15 = V1, 16-31 = V2 + aByte[0] = (const BYTE*)(&V1); + aByte[1] = (const BYTE*)(&V2); + i = 16; + pControl = (const BYTE *)(&Control); + pWork = (BYTE *)(&Result); + do { + // Get the byte to map from + uIndex = pControl[0]; + ++pControl; + VectorIndex = (uIndex>>4)&1; + uIndex &= 0x0F; +#if defined(_XM_LITTLEENDIAN_) + uIndex ^= 3; // Swap byte ordering on little endian machines +#endif + pWork[0] = aByte[VectorIndex][uIndex]; + ++pWork; + } while (--i); + return Result; +#elif defined(_XM_SSE_INTRINSICS_) +#if defined(_PREFAST_) || defined(XMDEBUG) + // Indices must be in range from 0 to 31 + static const XMVECTORI32 PremuteTest = {0xE0E0E0E0,0xE0E0E0E0,0xE0E0E0E0,0xE0E0E0E0}; + XMVECTOR vAssert = _mm_and_ps(Control,PremuteTest); + __m128i vAsserti = _mm_cmpeq_epi32(reinterpret_cast(&vAssert)[0],g_XMZero); + XMASSERT(_mm_movemask_ps(*reinterpret_cast(&vAsserti)) == 0xf); +#endif + // Store the vectors onto local memory on the stack + XMVECTOR Array[2]; + Array[0] = V1; + Array[1] = V2; + // Output vector, on the stack + XMVECTORU8 vResult; + // Get pointer to the two vectors on the stack + const BYTE *pInput = reinterpret_cast(Array); + // Store the Control vector on the stack to access the bytes + // don't use Control, it can cause a register variable to spill on the stack. + XMVECTORU8 vControl; + vControl.v = Control; // Write to memory + UINT i = 0; + do { + UINT ComponentIndex = vControl.u[i] & 0x1FU; + ComponentIndex ^= 3; // Swap byte ordering + vResult.u[i] = pInput[ComponentIndex]; + } while (++i<16); + return vResult; +#else // _XM_SSE_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ +// Define a control vector to be used in XMVectorSelect +// operations. The four integers specified in XMVectorSelectControl +// serve as indices to select between components in two vectors. +// The first index controls selection for the first component of +// the vectors involved in a select operation, the second index +// controls selection for the second component etc. A value of +// zero for an index causes the corresponding component from the first +// vector to be selected whereas a one causes the component from the +// second vector to be selected instead. + +XMFINLINE XMVECTOR XMVectorSelectControl +( + UINT VectorIndex0, + UINT VectorIndex1, + UINT VectorIndex2, + UINT VectorIndex3 +) +{ +#if defined(_XM_SSE_INTRINSICS_) && !defined(_XM_NO_INTRINSICS_) + // x=Index0,y=Index1,z=Index2,w=Index3 + __m128i vTemp = _mm_set_epi32(VectorIndex3,VectorIndex2,VectorIndex1,VectorIndex0); + // Any non-zero entries become 0xFFFFFFFF else 0 + vTemp = _mm_cmpgt_epi32(vTemp,g_XMZero); + return reinterpret_cast<__m128 *>(&vTemp)[0]; +#else + XMVECTOR ControlVector; + CONST UINT ControlElement[] = + { + XM_SELECT_0, + XM_SELECT_1 + }; + + XMASSERT(VectorIndex0 < 2); + XMASSERT(VectorIndex1 < 2); + XMASSERT(VectorIndex2 < 2); + XMASSERT(VectorIndex3 < 2); + + ControlVector.vector4_u32[0] = ControlElement[VectorIndex0]; + ControlVector.vector4_u32[1] = ControlElement[VectorIndex1]; + ControlVector.vector4_u32[2] = ControlElement[VectorIndex2]; + ControlVector.vector4_u32[3] = ControlElement[VectorIndex3]; + + return ControlVector; + +#endif +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorSelect +( + FXMVECTOR V1, + FXMVECTOR V2, + FXMVECTOR Control +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Result; + + Result.vector4_u32[0] = (V1.vector4_u32[0] & ~Control.vector4_u32[0]) | (V2.vector4_u32[0] & Control.vector4_u32[0]); + Result.vector4_u32[1] = (V1.vector4_u32[1] & ~Control.vector4_u32[1]) | (V2.vector4_u32[1] & Control.vector4_u32[1]); + Result.vector4_u32[2] = (V1.vector4_u32[2] & ~Control.vector4_u32[2]) | (V2.vector4_u32[2] & Control.vector4_u32[2]); + Result.vector4_u32[3] = (V1.vector4_u32[3] & ~Control.vector4_u32[3]) | (V2.vector4_u32[3] & Control.vector4_u32[3]); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vTemp1 = _mm_andnot_ps(Control,V1); + XMVECTOR vTemp2 = _mm_and_ps(V2,Control); + return _mm_or_ps(vTemp1,vTemp2); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorMergeXY +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Result; + + Result.vector4_u32[0] = V1.vector4_u32[0]; + Result.vector4_u32[1] = V2.vector4_u32[0]; + Result.vector4_u32[2] = V1.vector4_u32[1]; + Result.vector4_u32[3] = V2.vector4_u32[1]; + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + return _mm_unpacklo_ps( V1, V2 ); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorMergeZW +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Result; + + Result.vector4_u32[0] = V1.vector4_u32[2]; + Result.vector4_u32[1] = V2.vector4_u32[2]; + Result.vector4_u32[2] = V1.vector4_u32[3]; + Result.vector4_u32[3] = V2.vector4_u32[3]; + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + return _mm_unpackhi_ps( V1, V2 ); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ +// Comparison operations +//------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorEqual +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Control; + + Control.vector4_u32[0] = (V1.vector4_f32[0] == V2.vector4_f32[0]) ? 0xFFFFFFFF : 0; + Control.vector4_u32[1] = (V1.vector4_f32[1] == V2.vector4_f32[1]) ? 0xFFFFFFFF : 0; + Control.vector4_u32[2] = (V1.vector4_f32[2] == V2.vector4_f32[2]) ? 0xFFFFFFFF : 0; + Control.vector4_u32[3] = (V1.vector4_f32[3] == V2.vector4_f32[3]) ? 0xFFFFFFFF : 0; + + return Control; + +#elif defined(_XM_SSE_INTRINSICS_) + return _mm_cmpeq_ps( V1, V2 ); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorEqualR +( + UINT* pCR, + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + UINT ux, uy, uz, uw, CR; + XMVECTOR Control; + + XMASSERT( pCR ); + + ux = (V1.vector4_f32[0] == V2.vector4_f32[0]) ? 0xFFFFFFFFU : 0; + uy = (V1.vector4_f32[1] == V2.vector4_f32[1]) ? 0xFFFFFFFFU : 0; + uz = (V1.vector4_f32[2] == V2.vector4_f32[2]) ? 0xFFFFFFFFU : 0; + uw = (V1.vector4_f32[3] == V2.vector4_f32[3]) ? 0xFFFFFFFFU : 0; + CR = 0; + if (ux&uy&uz&uw) + { + // All elements are greater + CR = XM_CRMASK_CR6TRUE; + } + else if (!(ux|uy|uz|uw)) + { + // All elements are not greater + CR = XM_CRMASK_CR6FALSE; + } + *pCR = CR; + Control.vector4_u32[0] = ux; + Control.vector4_u32[1] = uy; + Control.vector4_u32[2] = uz; + Control.vector4_u32[3] = uw; + return Control; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT( pCR ); + XMVECTOR vTemp = _mm_cmpeq_ps(V1,V2); + UINT CR = 0; + int iTest = _mm_movemask_ps(vTemp); + if (iTest==0xf) + { + CR = XM_CRMASK_CR6TRUE; + } + else if (!iTest) + { + // All elements are not greater + CR = XM_CRMASK_CR6FALSE; + } + *pCR = CR; + return vTemp; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ +// Treat the components of the vectors as unsigned integers and +// compare individual bits between the two. This is useful for +// comparing control vectors and result vectors returned from +// other comparison operations. + +XMFINLINE XMVECTOR XMVectorEqualInt +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Control; + + Control.vector4_u32[0] = (V1.vector4_u32[0] == V2.vector4_u32[0]) ? 0xFFFFFFFF : 0; + Control.vector4_u32[1] = (V1.vector4_u32[1] == V2.vector4_u32[1]) ? 0xFFFFFFFF : 0; + Control.vector4_u32[2] = (V1.vector4_u32[2] == V2.vector4_u32[2]) ? 0xFFFFFFFF : 0; + Control.vector4_u32[3] = (V1.vector4_u32[3] == V2.vector4_u32[3]) ? 0xFFFFFFFF : 0; + + return Control; + +#elif defined(_XM_SSE_INTRINSICS_) + __m128i V = _mm_cmpeq_epi32( reinterpret_cast(&V1)[0],reinterpret_cast(&V2)[0] ); + return reinterpret_cast<__m128 *>(&V)[0]; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorEqualIntR +( + UINT* pCR, + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Control; + + XMASSERT(pCR); + + Control = XMVectorEqualInt(V1, V2); + + *pCR = 0; + + if (XMVector4EqualInt(Control, XMVectorTrueInt())) + { + // All elements are equal + *pCR |= XM_CRMASK_CR6TRUE; + } + else if (XMVector4EqualInt(Control, XMVectorFalseInt())) + { + // All elements are not equal + *pCR |= XM_CRMASK_CR6FALSE; + } + + return Control; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pCR); + __m128i V = _mm_cmpeq_epi32( reinterpret_cast(&V1)[0],reinterpret_cast(&V2)[0] ); + int iTemp = _mm_movemask_ps(reinterpret_cast(&V)[0]); + UINT CR = 0; + if (iTemp==0x0F) + { + CR = XM_CRMASK_CR6TRUE; + } + else if (!iTemp) + { + CR = XM_CRMASK_CR6FALSE; + } + *pCR = CR; + return reinterpret_cast<__m128 *>(&V)[0]; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorNearEqual +( + FXMVECTOR V1, + FXMVECTOR V2, + FXMVECTOR Epsilon +) +{ +#if defined(_XM_NO_INTRINSICS_) + + FLOAT fDeltax, fDeltay, fDeltaz, fDeltaw; + XMVECTOR Control; + + fDeltax = V1.vector4_f32[0]-V2.vector4_f32[0]; + fDeltay = V1.vector4_f32[1]-V2.vector4_f32[1]; + fDeltaz = V1.vector4_f32[2]-V2.vector4_f32[2]; + fDeltaw = V1.vector4_f32[3]-V2.vector4_f32[3]; + + fDeltax = fabsf(fDeltax); + fDeltay = fabsf(fDeltay); + fDeltaz = fabsf(fDeltaz); + fDeltaw = fabsf(fDeltaw); + + Control.vector4_u32[0] = (fDeltax <= Epsilon.vector4_f32[0]) ? 0xFFFFFFFFU : 0; + Control.vector4_u32[1] = (fDeltay <= Epsilon.vector4_f32[1]) ? 0xFFFFFFFFU : 0; + Control.vector4_u32[2] = (fDeltaz <= Epsilon.vector4_f32[2]) ? 0xFFFFFFFFU : 0; + Control.vector4_u32[3] = (fDeltaw <= Epsilon.vector4_f32[3]) ? 0xFFFFFFFFU : 0; + + return Control; + +#elif defined(_XM_SSE_INTRINSICS_) + // Get the difference + XMVECTOR vDelta = _mm_sub_ps(V1,V2); + // Get the absolute value of the difference + XMVECTOR vTemp = _mm_setzero_ps(); + vTemp = _mm_sub_ps(vTemp,vDelta); + vTemp = _mm_max_ps(vTemp,vDelta); + vTemp = _mm_cmple_ps(vTemp,Epsilon); + return vTemp; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorNotEqual +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Control; + Control.vector4_u32[0] = (V1.vector4_f32[0] != V2.vector4_f32[0]) ? 0xFFFFFFFF : 0; + Control.vector4_u32[1] = (V1.vector4_f32[1] != V2.vector4_f32[1]) ? 0xFFFFFFFF : 0; + Control.vector4_u32[2] = (V1.vector4_f32[2] != V2.vector4_f32[2]) ? 0xFFFFFFFF : 0; + Control.vector4_u32[3] = (V1.vector4_f32[3] != V2.vector4_f32[3]) ? 0xFFFFFFFF : 0; + return Control; + +#elif defined(_XM_SSE_INTRINSICS_) + return _mm_cmpneq_ps( V1, V2 ); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorNotEqualInt +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Control; + Control.vector4_u32[0] = (V1.vector4_u32[0] != V2.vector4_u32[0]) ? 0xFFFFFFFFU : 0; + Control.vector4_u32[1] = (V1.vector4_u32[1] != V2.vector4_u32[1]) ? 0xFFFFFFFFU : 0; + Control.vector4_u32[2] = (V1.vector4_u32[2] != V2.vector4_u32[2]) ? 0xFFFFFFFFU : 0; + Control.vector4_u32[3] = (V1.vector4_u32[3] != V2.vector4_u32[3]) ? 0xFFFFFFFFU : 0; + return Control; + +#elif defined(_XM_SSE_INTRINSICS_) + __m128i V = _mm_cmpeq_epi32( reinterpret_cast(&V1)[0],reinterpret_cast(&V2)[0] ); + return _mm_xor_ps(reinterpret_cast<__m128 *>(&V)[0],g_XMNegOneMask); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorGreater +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Control; + Control.vector4_u32[0] = (V1.vector4_f32[0] > V2.vector4_f32[0]) ? 0xFFFFFFFF : 0; + Control.vector4_u32[1] = (V1.vector4_f32[1] > V2.vector4_f32[1]) ? 0xFFFFFFFF : 0; + Control.vector4_u32[2] = (V1.vector4_f32[2] > V2.vector4_f32[2]) ? 0xFFFFFFFF : 0; + Control.vector4_u32[3] = (V1.vector4_f32[3] > V2.vector4_f32[3]) ? 0xFFFFFFFF : 0; + return Control; + +#elif defined(_XM_SSE_INTRINSICS_) + return _mm_cmpgt_ps( V1, V2 ); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorGreaterR +( + UINT* pCR, + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + UINT ux, uy, uz, uw, CR; + XMVECTOR Control; + + XMASSERT( pCR ); + + ux = (V1.vector4_f32[0] > V2.vector4_f32[0]) ? 0xFFFFFFFFU : 0; + uy = (V1.vector4_f32[1] > V2.vector4_f32[1]) ? 0xFFFFFFFFU : 0; + uz = (V1.vector4_f32[2] > V2.vector4_f32[2]) ? 0xFFFFFFFFU : 0; + uw = (V1.vector4_f32[3] > V2.vector4_f32[3]) ? 0xFFFFFFFFU : 0; + CR = 0; + if (ux&uy&uz&uw) + { + // All elements are greater + CR = XM_CRMASK_CR6TRUE; + } + else if (!(ux|uy|uz|uw)) + { + // All elements are not greater + CR = XM_CRMASK_CR6FALSE; + } + *pCR = CR; + Control.vector4_u32[0] = ux; + Control.vector4_u32[1] = uy; + Control.vector4_u32[2] = uz; + Control.vector4_u32[3] = uw; + return Control; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT( pCR ); + XMVECTOR vTemp = _mm_cmpgt_ps(V1,V2); + UINT CR = 0; + int iTest = _mm_movemask_ps(vTemp); + if (iTest==0xf) + { + CR = XM_CRMASK_CR6TRUE; + } + else if (!iTest) + { + // All elements are not greater + CR = XM_CRMASK_CR6FALSE; + } + *pCR = CR; + return vTemp; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorGreaterOrEqual +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Control; + Control.vector4_u32[0] = (V1.vector4_f32[0] >= V2.vector4_f32[0]) ? 0xFFFFFFFF : 0; + Control.vector4_u32[1] = (V1.vector4_f32[1] >= V2.vector4_f32[1]) ? 0xFFFFFFFF : 0; + Control.vector4_u32[2] = (V1.vector4_f32[2] >= V2.vector4_f32[2]) ? 0xFFFFFFFF : 0; + Control.vector4_u32[3] = (V1.vector4_f32[3] >= V2.vector4_f32[3]) ? 0xFFFFFFFF : 0; + return Control; + +#elif defined(_XM_SSE_INTRINSICS_) + return _mm_cmpge_ps( V1, V2 ); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorGreaterOrEqualR +( + UINT* pCR, + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + UINT ux, uy, uz, uw, CR; + XMVECTOR Control; + + XMASSERT( pCR ); + + ux = (V1.vector4_f32[0] >= V2.vector4_f32[0]) ? 0xFFFFFFFFU : 0; + uy = (V1.vector4_f32[1] >= V2.vector4_f32[1]) ? 0xFFFFFFFFU : 0; + uz = (V1.vector4_f32[2] >= V2.vector4_f32[2]) ? 0xFFFFFFFFU : 0; + uw = (V1.vector4_f32[3] >= V2.vector4_f32[3]) ? 0xFFFFFFFFU : 0; + CR = 0; + if (ux&uy&uz&uw) + { + // All elements are greater + CR = XM_CRMASK_CR6TRUE; + } + else if (!(ux|uy|uz|uw)) + { + // All elements are not greater + CR = XM_CRMASK_CR6FALSE; + } + *pCR = CR; + Control.vector4_u32[0] = ux; + Control.vector4_u32[1] = uy; + Control.vector4_u32[2] = uz; + Control.vector4_u32[3] = uw; + return Control; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT( pCR ); + XMVECTOR vTemp = _mm_cmpge_ps(V1,V2); + UINT CR = 0; + int iTest = _mm_movemask_ps(vTemp); + if (iTest==0xf) + { + CR = XM_CRMASK_CR6TRUE; + } + else if (!iTest) + { + // All elements are not greater + CR = XM_CRMASK_CR6FALSE; + } + *pCR = CR; + return vTemp; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorLess +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Control; + Control.vector4_u32[0] = (V1.vector4_f32[0] < V2.vector4_f32[0]) ? 0xFFFFFFFF : 0; + Control.vector4_u32[1] = (V1.vector4_f32[1] < V2.vector4_f32[1]) ? 0xFFFFFFFF : 0; + Control.vector4_u32[2] = (V1.vector4_f32[2] < V2.vector4_f32[2]) ? 0xFFFFFFFF : 0; + Control.vector4_u32[3] = (V1.vector4_f32[3] < V2.vector4_f32[3]) ? 0xFFFFFFFF : 0; + return Control; + +#elif defined(_XM_SSE_INTRINSICS_) + return _mm_cmplt_ps( V1, V2 ); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorLessOrEqual +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Control; + Control.vector4_u32[0] = (V1.vector4_f32[0] <= V2.vector4_f32[0]) ? 0xFFFFFFFF : 0; + Control.vector4_u32[1] = (V1.vector4_f32[1] <= V2.vector4_f32[1]) ? 0xFFFFFFFF : 0; + Control.vector4_u32[2] = (V1.vector4_f32[2] <= V2.vector4_f32[2]) ? 0xFFFFFFFF : 0; + Control.vector4_u32[3] = (V1.vector4_f32[3] <= V2.vector4_f32[3]) ? 0xFFFFFFFF : 0; + return Control; + +#elif defined(_XM_SSE_INTRINSICS_) + return _mm_cmple_ps( V1, V2 ); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorInBounds +( + FXMVECTOR V, + FXMVECTOR Bounds +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Control; + Control.vector4_u32[0] = (V.vector4_f32[0] <= Bounds.vector4_f32[0] && V.vector4_f32[0] >= -Bounds.vector4_f32[0]) ? 0xFFFFFFFF : 0; + Control.vector4_u32[1] = (V.vector4_f32[1] <= Bounds.vector4_f32[1] && V.vector4_f32[1] >= -Bounds.vector4_f32[1]) ? 0xFFFFFFFF : 0; + Control.vector4_u32[2] = (V.vector4_f32[2] <= Bounds.vector4_f32[2] && V.vector4_f32[2] >= -Bounds.vector4_f32[2]) ? 0xFFFFFFFF : 0; + Control.vector4_u32[3] = (V.vector4_f32[3] <= Bounds.vector4_f32[3] && V.vector4_f32[3] >= -Bounds.vector4_f32[3]) ? 0xFFFFFFFF : 0; + return Control; + +#elif defined(_XM_SSE_INTRINSICS_) + // Test if less than or equal + XMVECTOR vTemp1 = _mm_cmple_ps(V,Bounds); + // Negate the bounds + XMVECTOR vTemp2 = _mm_mul_ps(Bounds,g_XMNegativeOne); + // Test if greater or equal (Reversed) + vTemp2 = _mm_cmple_ps(vTemp2,V); + // Blend answers + vTemp1 = _mm_and_ps(vTemp1,vTemp2); + return vTemp1; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorInBoundsR +( + UINT* pCR, + FXMVECTOR V, + FXMVECTOR Bounds +) +{ +#if defined(_XM_NO_INTRINSICS_) + UINT ux, uy, uz, uw, CR; + XMVECTOR Control; + + XMASSERT( pCR != 0 ); + + ux = (V.vector4_f32[0] <= Bounds.vector4_f32[0] && V.vector4_f32[0] >= -Bounds.vector4_f32[0]) ? 0xFFFFFFFFU : 0; + uy = (V.vector4_f32[1] <= Bounds.vector4_f32[1] && V.vector4_f32[1] >= -Bounds.vector4_f32[1]) ? 0xFFFFFFFFU : 0; + uz = (V.vector4_f32[2] <= Bounds.vector4_f32[2] && V.vector4_f32[2] >= -Bounds.vector4_f32[2]) ? 0xFFFFFFFFU : 0; + uw = (V.vector4_f32[3] <= Bounds.vector4_f32[3] && V.vector4_f32[3] >= -Bounds.vector4_f32[3]) ? 0xFFFFFFFFU : 0; + + CR = 0; + + if (ux&uy&uz&uw) + { + // All elements are in bounds + CR = XM_CRMASK_CR6BOUNDS; + } + *pCR = CR; + Control.vector4_u32[0] = ux; + Control.vector4_u32[1] = uy; + Control.vector4_u32[2] = uz; + Control.vector4_u32[3] = uw; + return Control; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT( pCR != 0 ); + // Test if less than or equal + XMVECTOR vTemp1 = _mm_cmple_ps(V,Bounds); + // Negate the bounds + XMVECTOR vTemp2 = _mm_mul_ps(Bounds,g_XMNegativeOne); + // Test if greater or equal (Reversed) + vTemp2 = _mm_cmple_ps(vTemp2,V); + // Blend answers + vTemp1 = _mm_and_ps(vTemp1,vTemp2); + + UINT CR = 0; + if (_mm_movemask_ps(vTemp1)==0xf) { + // All elements are in bounds + CR = XM_CRMASK_CR6BOUNDS; + } + *pCR = CR; + return vTemp1; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorIsNaN +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Control; + Control.vector4_u32[0] = XMISNAN(V.vector4_f32[0]) ? 0xFFFFFFFFU : 0; + Control.vector4_u32[1] = XMISNAN(V.vector4_f32[1]) ? 0xFFFFFFFFU : 0; + Control.vector4_u32[2] = XMISNAN(V.vector4_f32[2]) ? 0xFFFFFFFFU : 0; + Control.vector4_u32[3] = XMISNAN(V.vector4_f32[3]) ? 0xFFFFFFFFU : 0; + return Control; + +#elif defined(_XM_SSE_INTRINSICS_) + // Mask off the exponent + __m128i vTempInf = _mm_and_si128(reinterpret_cast(&V)[0],g_XMInfinity); + // Mask off the mantissa + __m128i vTempNan = _mm_and_si128(reinterpret_cast(&V)[0],g_XMQNaNTest); + // Are any of the exponents == 0x7F800000? + vTempInf = _mm_cmpeq_epi32(vTempInf,g_XMInfinity); + // Are any of the mantissa's zero? (SSE2 doesn't have a neq test) + vTempNan = _mm_cmpeq_epi32(vTempNan,g_XMZero); + // Perform a not on the NaN test to be true on NON-zero mantissas + vTempNan = _mm_andnot_si128(vTempNan,vTempInf); + // If any are NaN, the signs are true after the merge above + return reinterpret_cast(&vTempNan)[0]; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorIsInfinite +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Control; + Control.vector4_u32[0] = XMISINF(V.vector4_f32[0]) ? 0xFFFFFFFFU : 0; + Control.vector4_u32[1] = XMISINF(V.vector4_f32[1]) ? 0xFFFFFFFFU : 0; + Control.vector4_u32[2] = XMISINF(V.vector4_f32[2]) ? 0xFFFFFFFFU : 0; + Control.vector4_u32[3] = XMISINF(V.vector4_f32[3]) ? 0xFFFFFFFFU : 0; + return Control; + +#elif defined(_XM_SSE_INTRINSICS_) + // Mask off the sign bit + __m128 vTemp = _mm_and_ps(V,g_XMAbsMask); + // Compare to infinity + vTemp = _mm_cmpeq_ps(vTemp,g_XMInfinity); + // If any are infinity, the signs are true. + return vTemp; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ +// Rounding and clamping operations +//------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorMin +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Result; + Result.vector4_f32[0] = (V1.vector4_f32[0] < V2.vector4_f32[0]) ? V1.vector4_f32[0] : V2.vector4_f32[0]; + Result.vector4_f32[1] = (V1.vector4_f32[1] < V2.vector4_f32[1]) ? V1.vector4_f32[1] : V2.vector4_f32[1]; + Result.vector4_f32[2] = (V1.vector4_f32[2] < V2.vector4_f32[2]) ? V1.vector4_f32[2] : V2.vector4_f32[2]; + Result.vector4_f32[3] = (V1.vector4_f32[3] < V2.vector4_f32[3]) ? V1.vector4_f32[3] : V2.vector4_f32[3]; + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + return _mm_min_ps( V1, V2 ); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorMax +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Result; + Result.vector4_f32[0] = (V1.vector4_f32[0] > V2.vector4_f32[0]) ? V1.vector4_f32[0] : V2.vector4_f32[0]; + Result.vector4_f32[1] = (V1.vector4_f32[1] > V2.vector4_f32[1]) ? V1.vector4_f32[1] : V2.vector4_f32[1]; + Result.vector4_f32[2] = (V1.vector4_f32[2] > V2.vector4_f32[2]) ? V1.vector4_f32[2] : V2.vector4_f32[2]; + Result.vector4_f32[3] = (V1.vector4_f32[3] > V2.vector4_f32[3]) ? V1.vector4_f32[3] : V2.vector4_f32[3]; + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + return _mm_max_ps( V1, V2 ); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorRound +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Result; + XMVECTOR Bias; + CONST XMVECTOR Zero = XMVectorZero(); + CONST XMVECTOR BiasPos = XMVectorReplicate(0.5f); + CONST XMVECTOR BiasNeg = XMVectorReplicate(-0.5f); + + Bias = XMVectorLess(V, Zero); + Bias = XMVectorSelect(BiasPos, BiasNeg, Bias); + Result = XMVectorAdd(V, Bias); + Result = XMVectorTruncate(Result); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + // To handle NAN, INF and numbers greater than 8388608, use masking + // Get the abs value + __m128i vTest = _mm_and_si128(reinterpret_cast(&V)[0],g_XMAbsMask); + // Test for greater than 8388608 (All floats with NO fractionals, NAN and INF + vTest = _mm_cmplt_epi32(vTest,g_XMNoFraction); + // Convert to int and back to float for rounding + __m128i vInt = _mm_cvtps_epi32(V); + // Convert back to floats + XMVECTOR vResult = _mm_cvtepi32_ps(vInt); + // All numbers less than 8388608 will use the round to int + vResult = _mm_and_ps(vResult,reinterpret_cast(&vTest)[0]); + // All others, use the ORIGINAL value + vTest = _mm_andnot_si128(vTest,reinterpret_cast(&V)[0]); + vResult = _mm_or_ps(vResult,reinterpret_cast(&vTest)[0]); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorTruncate +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + XMVECTOR Result; + UINT i; + + // Avoid C4701 + Result.vector4_f32[0] = 0.0f; + + for (i = 0; i < 4; i++) + { + if (XMISNAN(V.vector4_f32[i])) + { + Result.vector4_u32[i] = 0x7FC00000; + } + else if (fabsf(V.vector4_f32[i]) < 8388608.0f) + { + Result.vector4_f32[i] = (FLOAT)((INT)V.vector4_f32[i]); + } + else + { + Result.vector4_f32[i] = V.vector4_f32[i]; + } + } + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + // To handle NAN, INF and numbers greater than 8388608, use masking + // Get the abs value + __m128i vTest = _mm_and_si128(reinterpret_cast(&V)[0],g_XMAbsMask); + // Test for greater than 8388608 (All floats with NO fractionals, NAN and INF + vTest = _mm_cmplt_epi32(vTest,g_XMNoFraction); + // Convert to int and back to float for rounding with truncation + __m128i vInt = _mm_cvttps_epi32(V); + // Convert back to floats + XMVECTOR vResult = _mm_cvtepi32_ps(vInt); + // All numbers less than 8388608 will use the round to int + vResult = _mm_and_ps(vResult,reinterpret_cast(&vTest)[0]); + // All others, use the ORIGINAL value + vTest = _mm_andnot_si128(vTest,reinterpret_cast(&V)[0]); + vResult = _mm_or_ps(vResult,reinterpret_cast(&vTest)[0]); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorFloor +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR vResult = { + floorf(V.vector4_f32[0]), + floorf(V.vector4_f32[1]), + floorf(V.vector4_f32[2]), + floorf(V.vector4_f32[3]) + }; + return vResult; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vResult = _mm_sub_ps(V,g_XMOneHalfMinusEpsilon); + __m128i vInt = _mm_cvtps_epi32(vResult); + vResult = _mm_cvtepi32_ps(vInt); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorCeiling +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + XMVECTOR vResult = { + ceilf(V.vector4_f32[0]), + ceilf(V.vector4_f32[1]), + ceilf(V.vector4_f32[2]), + ceilf(V.vector4_f32[3]) + }; + return vResult; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vResult = _mm_add_ps(V,g_XMOneHalfMinusEpsilon); + __m128i vInt = _mm_cvtps_epi32(vResult); + vResult = _mm_cvtepi32_ps(vInt); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorClamp +( + FXMVECTOR V, + FXMVECTOR Min, + FXMVECTOR Max +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Result; + + XMASSERT(XMVector4LessOrEqual(Min, Max)); + + Result = XMVectorMax(Min, V); + Result = XMVectorMin(Max, Result); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vResult; + XMASSERT(XMVector4LessOrEqual(Min, Max)); + vResult = _mm_max_ps(Min,V); + vResult = _mm_min_ps(vResult,Max); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorSaturate +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + CONST XMVECTOR Zero = XMVectorZero(); + + return XMVectorClamp(V, Zero, g_XMOne.v); + +#elif defined(_XM_SSE_INTRINSICS_) + // Set <0 to 0 + XMVECTOR vResult = _mm_max_ps(V,g_XMZero); + // Set>1 to 1 + return _mm_min_ps(vResult,g_XMOne); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ +// Bitwise logical operations +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorAndInt +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Result; + + Result.vector4_u32[0] = V1.vector4_u32[0] & V2.vector4_u32[0]; + Result.vector4_u32[1] = V1.vector4_u32[1] & V2.vector4_u32[1]; + Result.vector4_u32[2] = V1.vector4_u32[2] & V2.vector4_u32[2]; + Result.vector4_u32[3] = V1.vector4_u32[3] & V2.vector4_u32[3]; + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + return _mm_and_ps(V1,V2); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorAndCInt +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Result; + + Result.vector4_u32[0] = V1.vector4_u32[0] & ~V2.vector4_u32[0]; + Result.vector4_u32[1] = V1.vector4_u32[1] & ~V2.vector4_u32[1]; + Result.vector4_u32[2] = V1.vector4_u32[2] & ~V2.vector4_u32[2]; + Result.vector4_u32[3] = V1.vector4_u32[3] & ~V2.vector4_u32[3]; + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + __m128i V = _mm_andnot_si128( reinterpret_cast(&V2)[0], reinterpret_cast(&V1)[0] ); + return reinterpret_cast<__m128 *>(&V)[0]; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorOrInt +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Result; + + Result.vector4_u32[0] = V1.vector4_u32[0] | V2.vector4_u32[0]; + Result.vector4_u32[1] = V1.vector4_u32[1] | V2.vector4_u32[1]; + Result.vector4_u32[2] = V1.vector4_u32[2] | V2.vector4_u32[2]; + Result.vector4_u32[3] = V1.vector4_u32[3] | V2.vector4_u32[3]; + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + __m128i V = _mm_or_si128( reinterpret_cast(&V1)[0], reinterpret_cast(&V2)[0] ); + return reinterpret_cast<__m128 *>(&V)[0]; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorNorInt +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Result; + + Result.vector4_u32[0] = ~(V1.vector4_u32[0] | V2.vector4_u32[0]); + Result.vector4_u32[1] = ~(V1.vector4_u32[1] | V2.vector4_u32[1]); + Result.vector4_u32[2] = ~(V1.vector4_u32[2] | V2.vector4_u32[2]); + Result.vector4_u32[3] = ~(V1.vector4_u32[3] | V2.vector4_u32[3]); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + __m128i Result; + Result = _mm_or_si128( reinterpret_cast(&V1)[0], reinterpret_cast(&V2)[0] ); + Result = _mm_andnot_si128( Result,g_XMNegOneMask); + return reinterpret_cast<__m128 *>(&Result)[0]; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorXorInt +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Result; + + Result.vector4_u32[0] = V1.vector4_u32[0] ^ V2.vector4_u32[0]; + Result.vector4_u32[1] = V1.vector4_u32[1] ^ V2.vector4_u32[1]; + Result.vector4_u32[2] = V1.vector4_u32[2] ^ V2.vector4_u32[2]; + Result.vector4_u32[3] = V1.vector4_u32[3] ^ V2.vector4_u32[3]; + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + __m128i V = _mm_xor_si128( reinterpret_cast(&V1)[0], reinterpret_cast(&V2)[0] ); + return reinterpret_cast<__m128 *>(&V)[0]; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ +// Computation operations +//------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorNegate +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Result; + + Result.vector4_f32[0] = -V.vector4_f32[0]; + Result.vector4_f32[1] = -V.vector4_f32[1]; + Result.vector4_f32[2] = -V.vector4_f32[2]; + Result.vector4_f32[3] = -V.vector4_f32[3]; + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR Z; + + Z = _mm_setzero_ps(); + + return _mm_sub_ps( Z, V ); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorAdd +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Result; + + Result.vector4_f32[0] = V1.vector4_f32[0] + V2.vector4_f32[0]; + Result.vector4_f32[1] = V1.vector4_f32[1] + V2.vector4_f32[1]; + Result.vector4_f32[2] = V1.vector4_f32[2] + V2.vector4_f32[2]; + Result.vector4_f32[3] = V1.vector4_f32[3] + V2.vector4_f32[3]; + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + return _mm_add_ps( V1, V2 ); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorAddAngles +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Mask; + XMVECTOR Offset; + XMVECTOR Result; + CONST XMVECTOR Zero = XMVectorZero(); + + // Add the given angles together. If the range of V1 is such + // that -Pi <= V1 < Pi and the range of V2 is such that + // -2Pi <= V2 <= 2Pi, then the range of the resulting angle + // will be -Pi <= Result < Pi. + Result = XMVectorAdd(V1, V2); + + Mask = XMVectorLess(Result, g_XMNegativePi.v); + Offset = XMVectorSelect(Zero, g_XMTwoPi.v, Mask); + + Mask = XMVectorGreaterOrEqual(Result, g_XMPi.v); + Offset = XMVectorSelect(Offset, g_XMNegativeTwoPi.v, Mask); + + Result = XMVectorAdd(Result, Offset); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + // Adjust the angles + XMVECTOR vResult = _mm_add_ps(V1,V2); + // Less than Pi? + XMVECTOR vOffset = _mm_cmplt_ps(vResult,g_XMNegativePi); + vOffset = _mm_and_ps(vOffset,g_XMTwoPi); + // Add 2Pi to all entries less than -Pi + vResult = _mm_add_ps(vResult,vOffset); + // Greater than or equal to Pi? + vOffset = _mm_cmpge_ps(vResult,g_XMPi); + vOffset = _mm_and_ps(vOffset,g_XMTwoPi); + // Sub 2Pi to all entries greater than Pi + vResult = _mm_sub_ps(vResult,vOffset); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorSubtract +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Result; + + Result.vector4_f32[0] = V1.vector4_f32[0] - V2.vector4_f32[0]; + Result.vector4_f32[1] = V1.vector4_f32[1] - V2.vector4_f32[1]; + Result.vector4_f32[2] = V1.vector4_f32[2] - V2.vector4_f32[2]; + Result.vector4_f32[3] = V1.vector4_f32[3] - V2.vector4_f32[3]; + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + return _mm_sub_ps( V1, V2 ); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorSubtractAngles +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Mask; + XMVECTOR Offset; + XMVECTOR Result; + CONST XMVECTOR Zero = XMVectorZero(); + + // Subtract the given angles. If the range of V1 is such + // that -Pi <= V1 < Pi and the range of V2 is such that + // -2Pi <= V2 <= 2Pi, then the range of the resulting angle + // will be -Pi <= Result < Pi. + Result = XMVectorSubtract(V1, V2); + + Mask = XMVectorLess(Result, g_XMNegativePi.v); + Offset = XMVectorSelect(Zero, g_XMTwoPi.v, Mask); + + Mask = XMVectorGreaterOrEqual(Result, g_XMPi.v); + Offset = XMVectorSelect(Offset, g_XMNegativeTwoPi.v, Mask); + + Result = XMVectorAdd(Result, Offset); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + // Adjust the angles + XMVECTOR vResult = _mm_sub_ps(V1,V2); + // Less than Pi? + XMVECTOR vOffset = _mm_cmplt_ps(vResult,g_XMNegativePi); + vOffset = _mm_and_ps(vOffset,g_XMTwoPi); + // Add 2Pi to all entries less than -Pi + vResult = _mm_add_ps(vResult,vOffset); + // Greater than or equal to Pi? + vOffset = _mm_cmpge_ps(vResult,g_XMPi); + vOffset = _mm_and_ps(vOffset,g_XMTwoPi); + // Sub 2Pi to all entries greater than Pi + vResult = _mm_sub_ps(vResult,vOffset); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorMultiply +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + XMVECTOR Result = { + V1.vector4_f32[0] * V2.vector4_f32[0], + V1.vector4_f32[1] * V2.vector4_f32[1], + V1.vector4_f32[2] * V2.vector4_f32[2], + V1.vector4_f32[3] * V2.vector4_f32[3] + }; + return Result; +#elif defined(_XM_SSE_INTRINSICS_) + return _mm_mul_ps( V1, V2 ); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorMultiplyAdd +( + FXMVECTOR V1, + FXMVECTOR V2, + FXMVECTOR V3 +) +{ +#if defined(_XM_NO_INTRINSICS_) + XMVECTOR vResult = { + (V1.vector4_f32[0] * V2.vector4_f32[0]) + V3.vector4_f32[0], + (V1.vector4_f32[1] * V2.vector4_f32[1]) + V3.vector4_f32[1], + (V1.vector4_f32[2] * V2.vector4_f32[2]) + V3.vector4_f32[2], + (V1.vector4_f32[3] * V2.vector4_f32[3]) + V3.vector4_f32[3] + }; + return vResult; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vResult = _mm_mul_ps( V1, V2 ); + return _mm_add_ps(vResult, V3 ); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorDivide +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + XMVECTOR Result; + Result.vector4_f32[0] = V1.vector4_f32[0] / V2.vector4_f32[0]; + Result.vector4_f32[1] = V1.vector4_f32[1] / V2.vector4_f32[1]; + Result.vector4_f32[2] = V1.vector4_f32[2] / V2.vector4_f32[2]; + Result.vector4_f32[3] = V1.vector4_f32[3] / V2.vector4_f32[3]; + return Result; +#elif defined(_XM_SSE_INTRINSICS_) + return _mm_div_ps( V1, V2 ); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorNegativeMultiplySubtract +( + FXMVECTOR V1, + FXMVECTOR V2, + FXMVECTOR V3 +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR vResult = { + V3.vector4_f32[0] - (V1.vector4_f32[0] * V2.vector4_f32[0]), + V3.vector4_f32[1] - (V1.vector4_f32[1] * V2.vector4_f32[1]), + V3.vector4_f32[2] - (V1.vector4_f32[2] * V2.vector4_f32[2]), + V3.vector4_f32[3] - (V1.vector4_f32[3] * V2.vector4_f32[3]) + }; + return vResult; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR R = _mm_mul_ps( V1, V2 ); + return _mm_sub_ps( V3, R ); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorScale +( + FXMVECTOR V, + FLOAT ScaleFactor +) +{ +#if defined(_XM_NO_INTRINSICS_) + XMVECTOR vResult = { + V.vector4_f32[0] * ScaleFactor, + V.vector4_f32[1] * ScaleFactor, + V.vector4_f32[2] * ScaleFactor, + V.vector4_f32[3] * ScaleFactor + }; + return vResult; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vResult = _mm_set_ps1(ScaleFactor); + return _mm_mul_ps(vResult,V); +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorReciprocalEst +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + XMVECTOR Result; + UINT i; + + // Avoid C4701 + Result.vector4_f32[0] = 0.0f; + + for (i = 0; i < 4; i++) + { + if (XMISNAN(V.vector4_f32[i])) + { + Result.vector4_u32[i] = 0x7FC00000; + } + else if (V.vector4_f32[i] == 0.0f || V.vector4_f32[i] == -0.0f) + { + Result.vector4_u32[i] = 0x7F800000 | (V.vector4_u32[i] & 0x80000000); + } + else + { + Result.vector4_f32[i] = 1.f / V.vector4_f32[i]; + } + } + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + return _mm_rcp_ps(V); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorReciprocal +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + return XMVectorReciprocalEst(V); + +#elif defined(_XM_SSE_INTRINSICS_) + return _mm_div_ps(g_XMOne,V); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ +// Return an estimated square root +XMFINLINE XMVECTOR XMVectorSqrtEst +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + XMVECTOR Select; + + // if (x == +Infinity) sqrt(x) = +Infinity + // if (x == +0.0f) sqrt(x) = +0.0f + // if (x == -0.0f) sqrt(x) = -0.0f + // if (x < 0.0f) sqrt(x) = QNaN + + XMVECTOR Result = XMVectorReciprocalSqrtEst(V); + XMVECTOR Zero = XMVectorZero(); + XMVECTOR VEqualsInfinity = XMVectorEqualInt(V, g_XMInfinity.v); + XMVECTOR VEqualsZero = XMVectorEqual(V, Zero); + Result = XMVectorMultiply(V, Result); + Select = XMVectorEqualInt(VEqualsInfinity, VEqualsZero); + Result = XMVectorSelect(V, Result, Select); + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + return _mm_sqrt_ps(V); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorSqrt +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Zero; + XMVECTOR VEqualsInfinity, VEqualsZero; + XMVECTOR Select; + XMVECTOR Result; + + // if (x == +Infinity) sqrt(x) = +Infinity + // if (x == +0.0f) sqrt(x) = +0.0f + // if (x == -0.0f) sqrt(x) = -0.0f + // if (x < 0.0f) sqrt(x) = QNaN + + Result = XMVectorReciprocalSqrt(V); + Zero = XMVectorZero(); + VEqualsInfinity = XMVectorEqualInt(V, g_XMInfinity.v); + VEqualsZero = XMVectorEqual(V, Zero); + Result = XMVectorMultiply(V, Result); + Select = XMVectorEqualInt(VEqualsInfinity, VEqualsZero); + Result = XMVectorSelect(V, Result, Select); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + return _mm_sqrt_ps(V); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorReciprocalSqrtEst +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + // if (x == +Infinity) rsqrt(x) = 0 + // if (x == +0.0f) rsqrt(x) = +Infinity + // if (x == -0.0f) rsqrt(x) = -Infinity + // if (x < 0.0f) rsqrt(x) = QNaN + + XMVECTOR Result; + UINT i; + + // Avoid C4701 + Result.vector4_f32[0] = 0.0f; + + for (i = 0; i < 4; i++) + { + if (XMISNAN(V.vector4_f32[i])) + { + Result.vector4_u32[i] = 0x7FC00000; + } + else if (V.vector4_f32[i] == 0.0f || V.vector4_f32[i] == -0.0f) + { + Result.vector4_u32[i] = 0x7F800000 | (V.vector4_u32[i] & 0x80000000); + } + else if (V.vector4_f32[i] < 0.0f) + { + Result.vector4_u32[i] = 0x7FFFFFFF; + } + else if (XMISINF(V.vector4_f32[i])) + { + Result.vector4_f32[i] = 0.0f; + } + else + { + Result.vector4_f32[i] = 1.0f / sqrtf(V.vector4_f32[i]); + } + } + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + return _mm_rsqrt_ps(V); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorReciprocalSqrt +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + return XMVectorReciprocalSqrtEst(V); + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vResult = _mm_sqrt_ps(V); + vResult = _mm_div_ps(g_XMOne,vResult); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorExpEst +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Result; + Result.vector4_f32[0] = powf(2.0f, V.vector4_f32[0]); + Result.vector4_f32[1] = powf(2.0f, V.vector4_f32[1]); + Result.vector4_f32[2] = powf(2.0f, V.vector4_f32[2]); + Result.vector4_f32[3] = powf(2.0f, V.vector4_f32[3]); + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vResult = _mm_setr_ps( + powf(2.0f,XMVectorGetX(V)), + powf(2.0f,XMVectorGetY(V)), + powf(2.0f,XMVectorGetZ(V)), + powf(2.0f,XMVectorGetW(V))); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMINLINE XMVECTOR XMVectorExp +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR E, S; + XMVECTOR R, R2, R3, R4; + XMVECTOR V0, V1; + XMVECTOR C0X, C0Y, C0Z, C0W; + XMVECTOR C1X, C1Y, C1Z, C1W; + XMVECTOR Result; + static CONST XMVECTOR C0 = {1.0f, -6.93147182e-1f, 2.40226462e-1f, -5.55036440e-2f}; + static CONST XMVECTOR C1 = {9.61597636e-3f, -1.32823968e-3f, 1.47491097e-4f, -1.08635004e-5f}; + + R = XMVectorFloor(V); + E = XMVectorExpEst(R); + R = XMVectorSubtract(V, R); + R2 = XMVectorMultiply(R, R); + R3 = XMVectorMultiply(R, R2); + R4 = XMVectorMultiply(R2, R2); + + C0X = XMVectorSplatX(C0); + C0Y = XMVectorSplatY(C0); + C0Z = XMVectorSplatZ(C0); + C0W = XMVectorSplatW(C0); + + C1X = XMVectorSplatX(C1); + C1Y = XMVectorSplatY(C1); + C1Z = XMVectorSplatZ(C1); + C1W = XMVectorSplatW(C1); + + V0 = XMVectorMultiplyAdd(R, C0Y, C0X); + V0 = XMVectorMultiplyAdd(R2, C0Z, V0); + V0 = XMVectorMultiplyAdd(R3, C0W, V0); + + V1 = XMVectorMultiplyAdd(R, C1Y, C1X); + V1 = XMVectorMultiplyAdd(R2, C1Z, V1); + V1 = XMVectorMultiplyAdd(R3, C1W, V1); + + S = XMVectorMultiplyAdd(R4, V1, V0); + + S = XMVectorReciprocal(S); + Result = XMVectorMultiply(E, S); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + static CONST XMVECTORF32 C0 = {1.0f, -6.93147182e-1f, 2.40226462e-1f, -5.55036440e-2f}; + static CONST XMVECTORF32 C1 = {9.61597636e-3f, -1.32823968e-3f, 1.47491097e-4f, -1.08635004e-5f}; + + // Get the integer of the input + XMVECTOR R = XMVectorFloor(V); + // Get the exponent estimate + XMVECTOR E = XMVectorExpEst(R); + // Get the fractional only + R = _mm_sub_ps(V,R); + // Get R^2 + XMVECTOR R2 = _mm_mul_ps(R,R); + // And R^3 + XMVECTOR R3 = _mm_mul_ps(R,R2); + + XMVECTOR V0 = _mm_load_ps1(&C0.f[1]); + V0 = _mm_mul_ps(V0,R); + XMVECTOR vConstants = _mm_load_ps1(&C0.f[0]); + V0 = _mm_add_ps(V0,vConstants); + vConstants = _mm_load_ps1(&C0.f[2]); + vConstants = _mm_mul_ps(vConstants,R2); + V0 = _mm_add_ps(V0,vConstants); + vConstants = _mm_load_ps1(&C0.f[3]); + vConstants = _mm_mul_ps(vConstants,R3); + V0 = _mm_add_ps(V0,vConstants); + + XMVECTOR V1 = _mm_load_ps1(&C1.f[1]); + V1 = _mm_mul_ps(V1,R); + vConstants = _mm_load_ps1(&C1.f[0]); + V1 = _mm_add_ps(V1,vConstants); + vConstants = _mm_load_ps1(&C1.f[2]); + vConstants = _mm_mul_ps(vConstants,R2); + V1 = _mm_add_ps(V1,vConstants); + vConstants = _mm_load_ps1(&C1.f[3]); + vConstants = _mm_mul_ps(vConstants,R3); + V1 = _mm_add_ps(V1,vConstants); + // R2 = R^4 + R2 = _mm_mul_ps(R2,R2); + R2 = _mm_mul_ps(R2,V1); + R2 = _mm_add_ps(R2,V0); + E = _mm_div_ps(E,R2); + return E; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorLogEst +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + FLOAT fScale = (1.0f / logf(2.0f)); + XMVECTOR Result; + + Result.vector4_f32[0] = logf(V.vector4_f32[0])*fScale; + Result.vector4_f32[1] = logf(V.vector4_f32[1])*fScale; + Result.vector4_f32[2] = logf(V.vector4_f32[2])*fScale; + Result.vector4_f32[3] = logf(V.vector4_f32[3])*fScale; + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vScale = _mm_set_ps1(1.0f / logf(2.0f)); + XMVECTOR vResult = _mm_setr_ps( + logf(XMVectorGetX(V)), + logf(XMVectorGetY(V)), + logf(XMVectorGetZ(V)), + logf(XMVectorGetW(V))); + vResult = _mm_mul_ps(vResult,vScale); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMINLINE XMVECTOR XMVectorLog +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + FLOAT fScale = (1.0f / logf(2.0f)); + XMVECTOR Result; + + Result.vector4_f32[0] = logf(V.vector4_f32[0])*fScale; + Result.vector4_f32[1] = logf(V.vector4_f32[1])*fScale; + Result.vector4_f32[2] = logf(V.vector4_f32[2])*fScale; + Result.vector4_f32[3] = logf(V.vector4_f32[3])*fScale; + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vScale = _mm_set_ps1(1.0f / logf(2.0f)); + XMVECTOR vResult = _mm_setr_ps( + logf(XMVectorGetX(V)), + logf(XMVectorGetY(V)), + logf(XMVectorGetZ(V)), + logf(XMVectorGetW(V))); + vResult = _mm_mul_ps(vResult,vScale); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorPowEst +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Result; + + Result.vector4_f32[0] = powf(V1.vector4_f32[0], V2.vector4_f32[0]); + Result.vector4_f32[1] = powf(V1.vector4_f32[1], V2.vector4_f32[1]); + Result.vector4_f32[2] = powf(V1.vector4_f32[2], V2.vector4_f32[2]); + Result.vector4_f32[3] = powf(V1.vector4_f32[3], V2.vector4_f32[3]); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vResult = _mm_setr_ps( + powf(XMVectorGetX(V1),XMVectorGetX(V2)), + powf(XMVectorGetY(V1),XMVectorGetY(V2)), + powf(XMVectorGetZ(V1),XMVectorGetZ(V2)), + powf(XMVectorGetW(V1),XMVectorGetW(V2))); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorPow +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) || defined(_XM_SSE_INTRINSICS_) + + return XMVectorPowEst(V1, V2); + +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorAbs +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + XMVECTOR vResult = { + fabsf(V.vector4_f32[0]), + fabsf(V.vector4_f32[1]), + fabsf(V.vector4_f32[2]), + fabsf(V.vector4_f32[3]) + }; + return vResult; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vResult = _mm_setzero_ps(); + vResult = _mm_sub_ps(vResult,V); + vResult = _mm_max_ps(vResult,V); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorMod +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Reciprocal; + XMVECTOR Quotient; + XMVECTOR Result; + + // V1 % V2 = V1 - V2 * truncate(V1 / V2) + Reciprocal = XMVectorReciprocal(V2); + Quotient = XMVectorMultiply(V1, Reciprocal); + Quotient = XMVectorTruncate(Quotient); + Result = XMVectorNegativeMultiplySubtract(V2, Quotient, V1); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vResult = _mm_div_ps(V1, V2); + vResult = XMVectorTruncate(vResult); + vResult = _mm_mul_ps(vResult,V2); + vResult = _mm_sub_ps(V1,vResult); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorModAngles +( + FXMVECTOR Angles +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V; + XMVECTOR Result; + + // Modulo the range of the given angles such that -XM_PI <= Angles < XM_PI + V = XMVectorMultiply(Angles, g_XMReciprocalTwoPi.v); + V = XMVectorRound(V); + Result = XMVectorNegativeMultiplySubtract(g_XMTwoPi.v, V, Angles); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + // Modulo the range of the given angles such that -XM_PI <= Angles < XM_PI + XMVECTOR vResult = _mm_mul_ps(Angles,g_XMReciprocalTwoPi); + // Use the inline function due to complexity for rounding + vResult = XMVectorRound(vResult); + vResult = _mm_mul_ps(vResult,g_XMTwoPi); + vResult = _mm_sub_ps(Angles,vResult); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMINLINE XMVECTOR XMVectorSin +( + FXMVECTOR V +) +{ + +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V1, V2, V3, V5, V7, V9, V11, V13, V15, V17, V19, V21, V23; + XMVECTOR S1, S2, S3, S4, S5, S6, S7, S8, S9, S10, S11; + XMVECTOR Result; + + V1 = XMVectorModAngles(V); + + // sin(V) ~= V - V^3 / 3! + V^5 / 5! - V^7 / 7! + V^9 / 9! - V^11 / 11! + V^13 / 13! - + // V^15 / 15! + V^17 / 17! - V^19 / 19! + V^21 / 21! - V^23 / 23! (for -PI <= V < PI) + V2 = XMVectorMultiply(V1, V1); + V3 = XMVectorMultiply(V2, V1); + V5 = XMVectorMultiply(V3, V2); + V7 = XMVectorMultiply(V5, V2); + V9 = XMVectorMultiply(V7, V2); + V11 = XMVectorMultiply(V9, V2); + V13 = XMVectorMultiply(V11, V2); + V15 = XMVectorMultiply(V13, V2); + V17 = XMVectorMultiply(V15, V2); + V19 = XMVectorMultiply(V17, V2); + V21 = XMVectorMultiply(V19, V2); + V23 = XMVectorMultiply(V21, V2); + + S1 = XMVectorSplatY(g_XMSinCoefficients0.v); + S2 = XMVectorSplatZ(g_XMSinCoefficients0.v); + S3 = XMVectorSplatW(g_XMSinCoefficients0.v); + S4 = XMVectorSplatX(g_XMSinCoefficients1.v); + S5 = XMVectorSplatY(g_XMSinCoefficients1.v); + S6 = XMVectorSplatZ(g_XMSinCoefficients1.v); + S7 = XMVectorSplatW(g_XMSinCoefficients1.v); + S8 = XMVectorSplatX(g_XMSinCoefficients2.v); + S9 = XMVectorSplatY(g_XMSinCoefficients2.v); + S10 = XMVectorSplatZ(g_XMSinCoefficients2.v); + S11 = XMVectorSplatW(g_XMSinCoefficients2.v); + + Result = XMVectorMultiplyAdd(S1, V3, V1); + Result = XMVectorMultiplyAdd(S2, V5, Result); + Result = XMVectorMultiplyAdd(S3, V7, Result); + Result = XMVectorMultiplyAdd(S4, V9, Result); + Result = XMVectorMultiplyAdd(S5, V11, Result); + Result = XMVectorMultiplyAdd(S6, V13, Result); + Result = XMVectorMultiplyAdd(S7, V15, Result); + Result = XMVectorMultiplyAdd(S8, V17, Result); + Result = XMVectorMultiplyAdd(S9, V19, Result); + Result = XMVectorMultiplyAdd(S10, V21, Result); + Result = XMVectorMultiplyAdd(S11, V23, Result); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + // Force the value within the bounds of pi + XMVECTOR vResult = XMVectorModAngles(V); + // Each on is V to the "num" power + // V2 = V1^2 + XMVECTOR V2 = _mm_mul_ps(vResult,vResult); + // V1^3 + XMVECTOR vPower = _mm_mul_ps(vResult,V2); + XMVECTOR vConstants = _mm_load_ps1(&g_XMSinCoefficients0.f[1]); + vConstants = _mm_mul_ps(vConstants,vPower); + vResult = _mm_add_ps(vResult,vConstants); + + // V^5 + vPower = _mm_mul_ps(vPower,V2); + vConstants = _mm_load_ps1(&g_XMSinCoefficients0.f[2]); + vConstants = _mm_mul_ps(vConstants,vPower); + vResult = _mm_add_ps(vResult,vConstants); + + // V^7 + vPower = _mm_mul_ps(vPower,V2); + vConstants = _mm_load_ps1(&g_XMSinCoefficients0.f[3]); + vConstants = _mm_mul_ps(vConstants,vPower); + vResult = _mm_add_ps(vResult,vConstants); + + // V^9 + vPower = _mm_mul_ps(vPower,V2); + vConstants = _mm_load_ps1(&g_XMSinCoefficients1.f[0]); + vConstants = _mm_mul_ps(vConstants,vPower); + vResult = _mm_add_ps(vResult,vConstants); + + // V^11 + vPower = _mm_mul_ps(vPower,V2); + vConstants = _mm_load_ps1(&g_XMSinCoefficients1.f[1]); + vConstants = _mm_mul_ps(vConstants,vPower); + vResult = _mm_add_ps(vResult,vConstants); + + // V^13 + vPower = _mm_mul_ps(vPower,V2); + vConstants = _mm_load_ps1(&g_XMSinCoefficients1.f[2]); + vConstants = _mm_mul_ps(vConstants,vPower); + vResult = _mm_add_ps(vResult,vConstants); + + // V^15 + vPower = _mm_mul_ps(vPower,V2); + vConstants = _mm_load_ps1(&g_XMSinCoefficients1.f[3]); + vConstants = _mm_mul_ps(vConstants,vPower); + vResult = _mm_add_ps(vResult,vConstants); + + // V^17 + vPower = _mm_mul_ps(vPower,V2); + vConstants = _mm_load_ps1(&g_XMSinCoefficients2.f[0]); + vConstants = _mm_mul_ps(vConstants,vPower); + vResult = _mm_add_ps(vResult,vConstants); + + // V^19 + vPower = _mm_mul_ps(vPower,V2); + vConstants = _mm_load_ps1(&g_XMSinCoefficients2.f[1]); + vConstants = _mm_mul_ps(vConstants,vPower); + vResult = _mm_add_ps(vResult,vConstants); + + // V^21 + vPower = _mm_mul_ps(vPower,V2); + vConstants = _mm_load_ps1(&g_XMSinCoefficients2.f[2]); + vConstants = _mm_mul_ps(vConstants,vPower); + vResult = _mm_add_ps(vResult,vConstants); + + // V^23 + vPower = _mm_mul_ps(vPower,V2); + vConstants = _mm_load_ps1(&g_XMSinCoefficients2.f[3]); + vConstants = _mm_mul_ps(vConstants,vPower); + vResult = _mm_add_ps(vResult,vConstants); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMINLINE XMVECTOR XMVectorCos +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V1, V2, V4, V6, V8, V10, V12, V14, V16, V18, V20, V22; + XMVECTOR C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11; + XMVECTOR Result; + + V1 = XMVectorModAngles(V); + + // cos(V) ~= 1 - V^2 / 2! + V^4 / 4! - V^6 / 6! + V^8 / 8! - V^10 / 10! + V^12 / 12! - + // V^14 / 14! + V^16 / 16! - V^18 / 18! + V^20 / 20! - V^22 / 22! (for -PI <= V < PI) + V2 = XMVectorMultiply(V1, V1); + V4 = XMVectorMultiply(V2, V2); + V6 = XMVectorMultiply(V4, V2); + V8 = XMVectorMultiply(V4, V4); + V10 = XMVectorMultiply(V6, V4); + V12 = XMVectorMultiply(V6, V6); + V14 = XMVectorMultiply(V8, V6); + V16 = XMVectorMultiply(V8, V8); + V18 = XMVectorMultiply(V10, V8); + V20 = XMVectorMultiply(V10, V10); + V22 = XMVectorMultiply(V12, V10); + + C1 = XMVectorSplatY(g_XMCosCoefficients0.v); + C2 = XMVectorSplatZ(g_XMCosCoefficients0.v); + C3 = XMVectorSplatW(g_XMCosCoefficients0.v); + C4 = XMVectorSplatX(g_XMCosCoefficients1.v); + C5 = XMVectorSplatY(g_XMCosCoefficients1.v); + C6 = XMVectorSplatZ(g_XMCosCoefficients1.v); + C7 = XMVectorSplatW(g_XMCosCoefficients1.v); + C8 = XMVectorSplatX(g_XMCosCoefficients2.v); + C9 = XMVectorSplatY(g_XMCosCoefficients2.v); + C10 = XMVectorSplatZ(g_XMCosCoefficients2.v); + C11 = XMVectorSplatW(g_XMCosCoefficients2.v); + + Result = XMVectorMultiplyAdd(C1, V2, g_XMOne.v); + Result = XMVectorMultiplyAdd(C2, V4, Result); + Result = XMVectorMultiplyAdd(C3, V6, Result); + Result = XMVectorMultiplyAdd(C4, V8, Result); + Result = XMVectorMultiplyAdd(C5, V10, Result); + Result = XMVectorMultiplyAdd(C6, V12, Result); + Result = XMVectorMultiplyAdd(C7, V14, Result); + Result = XMVectorMultiplyAdd(C8, V16, Result); + Result = XMVectorMultiplyAdd(C9, V18, Result); + Result = XMVectorMultiplyAdd(C10, V20, Result); + Result = XMVectorMultiplyAdd(C11, V22, Result); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + // Force the value within the bounds of pi + XMVECTOR V2 = XMVectorModAngles(V); + // Each on is V to the "num" power + // V2 = V1^2 + V2 = _mm_mul_ps(V2,V2); + // V^2 + XMVECTOR vConstants = _mm_load_ps1(&g_XMCosCoefficients0.f[1]); + vConstants = _mm_mul_ps(vConstants,V2); + XMVECTOR vResult = _mm_add_ps(vConstants,g_XMOne); + + // V^4 + XMVECTOR vPower = _mm_mul_ps(V2,V2); + vConstants = _mm_load_ps1(&g_XMCosCoefficients0.f[2]); + vConstants = _mm_mul_ps(vConstants,vPower); + vResult = _mm_add_ps(vResult,vConstants); + + // V^6 + vPower = _mm_mul_ps(vPower,V2); + vConstants = _mm_load_ps1(&g_XMCosCoefficients0.f[3]); + vConstants = _mm_mul_ps(vConstants,vPower); + vResult = _mm_add_ps(vResult,vConstants); + + // V^8 + vPower = _mm_mul_ps(vPower,V2); + vConstants = _mm_load_ps1(&g_XMCosCoefficients1.f[0]); + vConstants = _mm_mul_ps(vConstants,vPower); + vResult = _mm_add_ps(vResult,vConstants); + + // V^10 + vPower = _mm_mul_ps(vPower,V2); + vConstants = _mm_load_ps1(&g_XMCosCoefficients1.f[1]); + vConstants = _mm_mul_ps(vConstants,vPower); + vResult = _mm_add_ps(vResult,vConstants); + + // V^12 + vPower = _mm_mul_ps(vPower,V2); + vConstants = _mm_load_ps1(&g_XMCosCoefficients1.f[2]); + vConstants = _mm_mul_ps(vConstants,vPower); + vResult = _mm_add_ps(vResult,vConstants); + + // V^14 + vPower = _mm_mul_ps(vPower,V2); + vConstants = _mm_load_ps1(&g_XMCosCoefficients1.f[3]); + vConstants = _mm_mul_ps(vConstants,vPower); + vResult = _mm_add_ps(vResult,vConstants); + + // V^16 + vPower = _mm_mul_ps(vPower,V2); + vConstants = _mm_load_ps1(&g_XMCosCoefficients2.f[0]); + vConstants = _mm_mul_ps(vConstants,vPower); + vResult = _mm_add_ps(vResult,vConstants); + + // V^18 + vPower = _mm_mul_ps(vPower,V2); + vConstants = _mm_load_ps1(&g_XMCosCoefficients2.f[1]); + vConstants = _mm_mul_ps(vConstants,vPower); + vResult = _mm_add_ps(vResult,vConstants); + + // V^20 + vPower = _mm_mul_ps(vPower,V2); + vConstants = _mm_load_ps1(&g_XMCosCoefficients2.f[2]); + vConstants = _mm_mul_ps(vConstants,vPower); + vResult = _mm_add_ps(vResult,vConstants); + + // V^22 + vPower = _mm_mul_ps(vPower,V2); + vConstants = _mm_load_ps1(&g_XMCosCoefficients2.f[3]); + vConstants = _mm_mul_ps(vConstants,vPower); + vResult = _mm_add_ps(vResult,vConstants); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMINLINE VOID XMVectorSinCos +( + XMVECTOR* pSin, + XMVECTOR* pCos, + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V1, V2, V3, V4, V5, V6, V7, V8, V9, V10, V11, V12, V13; + XMVECTOR V14, V15, V16, V17, V18, V19, V20, V21, V22, V23; + XMVECTOR S1, S2, S3, S4, S5, S6, S7, S8, S9, S10, S11; + XMVECTOR C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11; + XMVECTOR Sin, Cos; + + XMASSERT(pSin); + XMASSERT(pCos); + + V1 = XMVectorModAngles(V); + + // sin(V) ~= V - V^3 / 3! + V^5 / 5! - V^7 / 7! + V^9 / 9! - V^11 / 11! + V^13 / 13! - + // V^15 / 15! + V^17 / 17! - V^19 / 19! + V^21 / 21! - V^23 / 23! (for -PI <= V < PI) + // cos(V) ~= 1 - V^2 / 2! + V^4 / 4! - V^6 / 6! + V^8 / 8! - V^10 / 10! + V^12 / 12! - + // V^14 / 14! + V^16 / 16! - V^18 / 18! + V^20 / 20! - V^22 / 22! (for -PI <= V < PI) + + V2 = XMVectorMultiply(V1, V1); + V3 = XMVectorMultiply(V2, V1); + V4 = XMVectorMultiply(V2, V2); + V5 = XMVectorMultiply(V3, V2); + V6 = XMVectorMultiply(V3, V3); + V7 = XMVectorMultiply(V4, V3); + V8 = XMVectorMultiply(V4, V4); + V9 = XMVectorMultiply(V5, V4); + V10 = XMVectorMultiply(V5, V5); + V11 = XMVectorMultiply(V6, V5); + V12 = XMVectorMultiply(V6, V6); + V13 = XMVectorMultiply(V7, V6); + V14 = XMVectorMultiply(V7, V7); + V15 = XMVectorMultiply(V8, V7); + V16 = XMVectorMultiply(V8, V8); + V17 = XMVectorMultiply(V9, V8); + V18 = XMVectorMultiply(V9, V9); + V19 = XMVectorMultiply(V10, V9); + V20 = XMVectorMultiply(V10, V10); + V21 = XMVectorMultiply(V11, V10); + V22 = XMVectorMultiply(V11, V11); + V23 = XMVectorMultiply(V12, V11); + + S1 = XMVectorSplatY(g_XMSinCoefficients0.v); + S2 = XMVectorSplatZ(g_XMSinCoefficients0.v); + S3 = XMVectorSplatW(g_XMSinCoefficients0.v); + S4 = XMVectorSplatX(g_XMSinCoefficients1.v); + S5 = XMVectorSplatY(g_XMSinCoefficients1.v); + S6 = XMVectorSplatZ(g_XMSinCoefficients1.v); + S7 = XMVectorSplatW(g_XMSinCoefficients1.v); + S8 = XMVectorSplatX(g_XMSinCoefficients2.v); + S9 = XMVectorSplatY(g_XMSinCoefficients2.v); + S10 = XMVectorSplatZ(g_XMSinCoefficients2.v); + S11 = XMVectorSplatW(g_XMSinCoefficients2.v); + + C1 = XMVectorSplatY(g_XMCosCoefficients0.v); + C2 = XMVectorSplatZ(g_XMCosCoefficients0.v); + C3 = XMVectorSplatW(g_XMCosCoefficients0.v); + C4 = XMVectorSplatX(g_XMCosCoefficients1.v); + C5 = XMVectorSplatY(g_XMCosCoefficients1.v); + C6 = XMVectorSplatZ(g_XMCosCoefficients1.v); + C7 = XMVectorSplatW(g_XMCosCoefficients1.v); + C8 = XMVectorSplatX(g_XMCosCoefficients2.v); + C9 = XMVectorSplatY(g_XMCosCoefficients2.v); + C10 = XMVectorSplatZ(g_XMCosCoefficients2.v); + C11 = XMVectorSplatW(g_XMCosCoefficients2.v); + + Sin = XMVectorMultiplyAdd(S1, V3, V1); + Sin = XMVectorMultiplyAdd(S2, V5, Sin); + Sin = XMVectorMultiplyAdd(S3, V7, Sin); + Sin = XMVectorMultiplyAdd(S4, V9, Sin); + Sin = XMVectorMultiplyAdd(S5, V11, Sin); + Sin = XMVectorMultiplyAdd(S6, V13, Sin); + Sin = XMVectorMultiplyAdd(S7, V15, Sin); + Sin = XMVectorMultiplyAdd(S8, V17, Sin); + Sin = XMVectorMultiplyAdd(S9, V19, Sin); + Sin = XMVectorMultiplyAdd(S10, V21, Sin); + Sin = XMVectorMultiplyAdd(S11, V23, Sin); + + Cos = XMVectorMultiplyAdd(C1, V2, g_XMOne.v); + Cos = XMVectorMultiplyAdd(C2, V4, Cos); + Cos = XMVectorMultiplyAdd(C3, V6, Cos); + Cos = XMVectorMultiplyAdd(C4, V8, Cos); + Cos = XMVectorMultiplyAdd(C5, V10, Cos); + Cos = XMVectorMultiplyAdd(C6, V12, Cos); + Cos = XMVectorMultiplyAdd(C7, V14, Cos); + Cos = XMVectorMultiplyAdd(C8, V16, Cos); + Cos = XMVectorMultiplyAdd(C9, V18, Cos); + Cos = XMVectorMultiplyAdd(C10, V20, Cos); + Cos = XMVectorMultiplyAdd(C11, V22, Cos); + + *pSin = Sin; + *pCos = Cos; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pSin); + XMASSERT(pCos); + XMVECTOR V1, V2, V3, V4, V5, V6, V7, V8, V9, V10, V11, V12, V13; + XMVECTOR V14, V15, V16, V17, V18, V19, V20, V21, V22, V23; + XMVECTOR S1, S2, S3, S4, S5, S6, S7, S8, S9, S10, S11; + XMVECTOR C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11; + XMVECTOR Sin, Cos; + + V1 = XMVectorModAngles(V); + + // sin(V) ~= V - V^3 / 3! + V^5 / 5! - V^7 / 7! + V^9 / 9! - V^11 / 11! + V^13 / 13! - + // V^15 / 15! + V^17 / 17! - V^19 / 19! + V^21 / 21! - V^23 / 23! (for -PI <= V < PI) + // cos(V) ~= 1 - V^2 / 2! + V^4 / 4! - V^6 / 6! + V^8 / 8! - V^10 / 10! + V^12 / 12! - + // V^14 / 14! + V^16 / 16! - V^18 / 18! + V^20 / 20! - V^22 / 22! (for -PI <= V < PI) + + V2 = XMVectorMultiply(V1, V1); + V3 = XMVectorMultiply(V2, V1); + V4 = XMVectorMultiply(V2, V2); + V5 = XMVectorMultiply(V3, V2); + V6 = XMVectorMultiply(V3, V3); + V7 = XMVectorMultiply(V4, V3); + V8 = XMVectorMultiply(V4, V4); + V9 = XMVectorMultiply(V5, V4); + V10 = XMVectorMultiply(V5, V5); + V11 = XMVectorMultiply(V6, V5); + V12 = XMVectorMultiply(V6, V6); + V13 = XMVectorMultiply(V7, V6); + V14 = XMVectorMultiply(V7, V7); + V15 = XMVectorMultiply(V8, V7); + V16 = XMVectorMultiply(V8, V8); + V17 = XMVectorMultiply(V9, V8); + V18 = XMVectorMultiply(V9, V9); + V19 = XMVectorMultiply(V10, V9); + V20 = XMVectorMultiply(V10, V10); + V21 = XMVectorMultiply(V11, V10); + V22 = XMVectorMultiply(V11, V11); + V23 = XMVectorMultiply(V12, V11); + + S1 = _mm_load_ps1(&g_XMSinCoefficients0.f[1]); + S2 = _mm_load_ps1(&g_XMSinCoefficients0.f[2]); + S3 = _mm_load_ps1(&g_XMSinCoefficients0.f[3]); + S4 = _mm_load_ps1(&g_XMSinCoefficients1.f[0]); + S5 = _mm_load_ps1(&g_XMSinCoefficients1.f[1]); + S6 = _mm_load_ps1(&g_XMSinCoefficients1.f[2]); + S7 = _mm_load_ps1(&g_XMSinCoefficients1.f[3]); + S8 = _mm_load_ps1(&g_XMSinCoefficients2.f[0]); + S9 = _mm_load_ps1(&g_XMSinCoefficients2.f[1]); + S10 = _mm_load_ps1(&g_XMSinCoefficients2.f[2]); + S11 = _mm_load_ps1(&g_XMSinCoefficients2.f[3]); + + C1 = _mm_load_ps1(&g_XMCosCoefficients0.f[1]); + C2 = _mm_load_ps1(&g_XMCosCoefficients0.f[2]); + C3 = _mm_load_ps1(&g_XMCosCoefficients0.f[3]); + C4 = _mm_load_ps1(&g_XMCosCoefficients1.f[0]); + C5 = _mm_load_ps1(&g_XMCosCoefficients1.f[1]); + C6 = _mm_load_ps1(&g_XMCosCoefficients1.f[2]); + C7 = _mm_load_ps1(&g_XMCosCoefficients1.f[3]); + C8 = _mm_load_ps1(&g_XMCosCoefficients2.f[0]); + C9 = _mm_load_ps1(&g_XMCosCoefficients2.f[1]); + C10 = _mm_load_ps1(&g_XMCosCoefficients2.f[2]); + C11 = _mm_load_ps1(&g_XMCosCoefficients2.f[3]); + + S1 = _mm_mul_ps(S1,V3); + Sin = _mm_add_ps(S1,V1); + Sin = XMVectorMultiplyAdd(S2, V5, Sin); + Sin = XMVectorMultiplyAdd(S3, V7, Sin); + Sin = XMVectorMultiplyAdd(S4, V9, Sin); + Sin = XMVectorMultiplyAdd(S5, V11, Sin); + Sin = XMVectorMultiplyAdd(S6, V13, Sin); + Sin = XMVectorMultiplyAdd(S7, V15, Sin); + Sin = XMVectorMultiplyAdd(S8, V17, Sin); + Sin = XMVectorMultiplyAdd(S9, V19, Sin); + Sin = XMVectorMultiplyAdd(S10, V21, Sin); + Sin = XMVectorMultiplyAdd(S11, V23, Sin); + + Cos = _mm_mul_ps(C1,V2); + Cos = _mm_add_ps(Cos,g_XMOne); + Cos = XMVectorMultiplyAdd(C2, V4, Cos); + Cos = XMVectorMultiplyAdd(C3, V6, Cos); + Cos = XMVectorMultiplyAdd(C4, V8, Cos); + Cos = XMVectorMultiplyAdd(C5, V10, Cos); + Cos = XMVectorMultiplyAdd(C6, V12, Cos); + Cos = XMVectorMultiplyAdd(C7, V14, Cos); + Cos = XMVectorMultiplyAdd(C8, V16, Cos); + Cos = XMVectorMultiplyAdd(C9, V18, Cos); + Cos = XMVectorMultiplyAdd(C10, V20, Cos); + Cos = XMVectorMultiplyAdd(C11, V22, Cos); + + *pSin = Sin; + *pCos = Cos; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMINLINE XMVECTOR XMVectorTan +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + // Cody and Waite algorithm to compute tangent. + + XMVECTOR VA, VB, VC, VC2; + XMVECTOR T0, T1, T2, T3, T4, T5, T6, T7; + XMVECTOR C0, C1, TwoDivPi, Epsilon; + XMVECTOR N, D; + XMVECTOR R0, R1; + XMVECTOR VIsZero, VCNearZero, VBIsEven; + XMVECTOR Zero; + XMVECTOR Result; + UINT i; + static CONST XMVECTOR TanCoefficients0 = {1.0f, -4.667168334e-1f, 2.566383229e-2f, -3.118153191e-4f}; + static CONST XMVECTOR TanCoefficients1 = {4.981943399e-7f, -1.333835001e-1f, 3.424887824e-3f, -1.786170734e-5f}; + static CONST XMVECTOR TanConstants = {1.570796371f, 6.077100628e-11f, 0.000244140625f, 2.0f / XM_PI}; + static CONST XMVECTORU32 Mask = {0x1, 0x1, 0x1, 0x1}; + + TwoDivPi = XMVectorSplatW(TanConstants); + + Zero = XMVectorZero(); + + C0 = XMVectorSplatX(TanConstants); + C1 = XMVectorSplatY(TanConstants); + Epsilon = XMVectorSplatZ(TanConstants); + + VA = XMVectorMultiply(V, TwoDivPi); + + VA = XMVectorRound(VA); + + VC = XMVectorNegativeMultiplySubtract(VA, C0, V); + + VB = XMVectorAbs(VA); + + VC = XMVectorNegativeMultiplySubtract(VA, C1, VC); + + for (i = 0; i < 4; i++) + { + VB.vector4_u32[i] = (UINT)VB.vector4_f32[i]; + } + + VC2 = XMVectorMultiply(VC, VC); + + T7 = XMVectorSplatW(TanCoefficients1); + T6 = XMVectorSplatZ(TanCoefficients1); + T4 = XMVectorSplatX(TanCoefficients1); + T3 = XMVectorSplatW(TanCoefficients0); + T5 = XMVectorSplatY(TanCoefficients1); + T2 = XMVectorSplatZ(TanCoefficients0); + T1 = XMVectorSplatY(TanCoefficients0); + T0 = XMVectorSplatX(TanCoefficients0); + + VBIsEven = XMVectorAndInt(VB, Mask.v); + VBIsEven = XMVectorEqualInt(VBIsEven, Zero); + + N = XMVectorMultiplyAdd(VC2, T7, T6); + D = XMVectorMultiplyAdd(VC2, T4, T3); + N = XMVectorMultiplyAdd(VC2, N, T5); + D = XMVectorMultiplyAdd(VC2, D, T2); + N = XMVectorMultiply(VC2, N); + D = XMVectorMultiplyAdd(VC2, D, T1); + N = XMVectorMultiplyAdd(VC, N, VC); + VCNearZero = XMVectorInBounds(VC, Epsilon); + D = XMVectorMultiplyAdd(VC2, D, T0); + + N = XMVectorSelect(N, VC, VCNearZero); + D = XMVectorSelect(D, g_XMOne.v, VCNearZero); + + R0 = XMVectorNegate(N); + R1 = XMVectorReciprocal(D); + R0 = XMVectorReciprocal(R0); + R1 = XMVectorMultiply(N, R1); + R0 = XMVectorMultiply(D, R0); + + VIsZero = XMVectorEqual(V, Zero); + + Result = XMVectorSelect(R0, R1, VBIsEven); + + Result = XMVectorSelect(Result, Zero, VIsZero); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + // Cody and Waite algorithm to compute tangent. + + XMVECTOR VA, VB, VC, VC2; + XMVECTOR T0, T1, T2, T3, T4, T5, T6, T7; + XMVECTOR C0, C1, TwoDivPi, Epsilon; + XMVECTOR N, D; + XMVECTOR R0, R1; + XMVECTOR VIsZero, VCNearZero, VBIsEven; + XMVECTOR Zero; + XMVECTOR Result; + static CONST XMVECTORF32 TanCoefficients0 = {1.0f, -4.667168334e-1f, 2.566383229e-2f, -3.118153191e-4f}; + static CONST XMVECTORF32 TanCoefficients1 = {4.981943399e-7f, -1.333835001e-1f, 3.424887824e-3f, -1.786170734e-5f}; + static CONST XMVECTORF32 TanConstants = {1.570796371f, 6.077100628e-11f, 0.000244140625f, 2.0f / XM_PI}; + static CONST XMVECTORI32 Mask = {0x1, 0x1, 0x1, 0x1}; + + TwoDivPi = XMVectorSplatW(TanConstants); + + Zero = XMVectorZero(); + + C0 = XMVectorSplatX(TanConstants); + C1 = XMVectorSplatY(TanConstants); + Epsilon = XMVectorSplatZ(TanConstants); + + VA = XMVectorMultiply(V, TwoDivPi); + + VA = XMVectorRound(VA); + + VC = XMVectorNegativeMultiplySubtract(VA, C0, V); + + VB = XMVectorAbs(VA); + + VC = XMVectorNegativeMultiplySubtract(VA, C1, VC); + + reinterpret_cast<__m128i *>(&VB)[0] = _mm_cvttps_epi32(VB); + + VC2 = XMVectorMultiply(VC, VC); + + T7 = XMVectorSplatW(TanCoefficients1); + T6 = XMVectorSplatZ(TanCoefficients1); + T4 = XMVectorSplatX(TanCoefficients1); + T3 = XMVectorSplatW(TanCoefficients0); + T5 = XMVectorSplatY(TanCoefficients1); + T2 = XMVectorSplatZ(TanCoefficients0); + T1 = XMVectorSplatY(TanCoefficients0); + T0 = XMVectorSplatX(TanCoefficients0); + + VBIsEven = XMVectorAndInt(VB,Mask); + VBIsEven = XMVectorEqualInt(VBIsEven, Zero); + + N = XMVectorMultiplyAdd(VC2, T7, T6); + D = XMVectorMultiplyAdd(VC2, T4, T3); + N = XMVectorMultiplyAdd(VC2, N, T5); + D = XMVectorMultiplyAdd(VC2, D, T2); + N = XMVectorMultiply(VC2, N); + D = XMVectorMultiplyAdd(VC2, D, T1); + N = XMVectorMultiplyAdd(VC, N, VC); + VCNearZero = XMVectorInBounds(VC, Epsilon); + D = XMVectorMultiplyAdd(VC2, D, T0); + + N = XMVectorSelect(N, VC, VCNearZero); + D = XMVectorSelect(D, g_XMOne, VCNearZero); + R0 = XMVectorNegate(N); + R1 = _mm_div_ps(N,D); + R0 = _mm_div_ps(D,R0); + VIsZero = XMVectorEqual(V, Zero); + Result = XMVectorSelect(R0, R1, VBIsEven); + Result = XMVectorSelect(Result, Zero, VIsZero); + + return Result; + +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMINLINE XMVECTOR XMVectorSinH +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V1, V2; + XMVECTOR E1, E2; + XMVECTOR Result; + static CONST XMVECTORF32 Scale = {1.442695040888963f, 1.442695040888963f, 1.442695040888963f, 1.442695040888963f}; // 1.0f / ln(2.0f) + + V1 = XMVectorMultiplyAdd(V, Scale.v, g_XMNegativeOne.v); + V2 = XMVectorNegativeMultiplySubtract(V, Scale.v, g_XMNegativeOne.v); + + E1 = XMVectorExp(V1); + E2 = XMVectorExp(V2); + + Result = XMVectorSubtract(E1, E2); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR V1, V2; + XMVECTOR E1, E2; + XMVECTOR Result; + static CONST XMVECTORF32 Scale = {1.442695040888963f, 1.442695040888963f, 1.442695040888963f, 1.442695040888963f}; // 1.0f / ln(2.0f) + + V1 = _mm_mul_ps(V, Scale); + V1 = _mm_add_ps(V1,g_XMNegativeOne); + V2 = _mm_mul_ps(V, Scale); + V2 = _mm_sub_ps(g_XMNegativeOne,V2); + E1 = XMVectorExp(V1); + E2 = XMVectorExp(V2); + + Result = _mm_sub_ps(E1, E2); + + return Result; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMINLINE XMVECTOR XMVectorCosH +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V1, V2; + XMVECTOR E1, E2; + XMVECTOR Result; + static CONST XMVECTOR Scale = {1.442695040888963f, 1.442695040888963f, 1.442695040888963f, 1.442695040888963f}; // 1.0f / ln(2.0f) + + V1 = XMVectorMultiplyAdd(V, Scale, g_XMNegativeOne.v); + V2 = XMVectorNegativeMultiplySubtract(V, Scale, g_XMNegativeOne.v); + + E1 = XMVectorExp(V1); + E2 = XMVectorExp(V2); + + Result = XMVectorAdd(E1, E2); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR V1, V2; + XMVECTOR E1, E2; + XMVECTOR Result; + static CONST XMVECTORF32 Scale = {1.442695040888963f, 1.442695040888963f, 1.442695040888963f, 1.442695040888963f}; // 1.0f / ln(2.0f) + + V1 = _mm_mul_ps(V,Scale); + V1 = _mm_add_ps(V1,g_XMNegativeOne); + V2 = _mm_mul_ps(V, Scale); + V2 = _mm_sub_ps(g_XMNegativeOne,V2); + E1 = XMVectorExp(V1); + E2 = XMVectorExp(V2); + Result = _mm_add_ps(E1, E2); + return Result; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMINLINE XMVECTOR XMVectorTanH +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR E; + XMVECTOR Result; + static CONST XMVECTORF32 Scale = {2.8853900817779268f, 2.8853900817779268f, 2.8853900817779268f, 2.8853900817779268f}; // 2.0f / ln(2.0f) + + E = XMVectorMultiply(V, Scale.v); + E = XMVectorExp(E); + E = XMVectorMultiplyAdd(E, g_XMOneHalf.v, g_XMOneHalf.v); + E = XMVectorReciprocal(E); + + Result = XMVectorSubtract(g_XMOne.v, E); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + static CONST XMVECTORF32 Scale = {2.8853900817779268f, 2.8853900817779268f, 2.8853900817779268f, 2.8853900817779268f}; // 2.0f / ln(2.0f) + + XMVECTOR E = _mm_mul_ps(V, Scale); + E = XMVectorExp(E); + E = _mm_mul_ps(E,g_XMOneHalf); + E = _mm_add_ps(E,g_XMOneHalf); + E = XMVectorReciprocal(E); + E = _mm_sub_ps(g_XMOne, E); + return E; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMINLINE XMVECTOR XMVectorASin +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V2, V3, AbsV; + XMVECTOR C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11; + XMVECTOR R0, R1, R2, R3, R4; + XMVECTOR OneMinusAbsV; + XMVECTOR Rsq; + XMVECTOR Result; + static CONST XMVECTOR OnePlusEpsilon = {1.00000011921f, 1.00000011921f, 1.00000011921f, 1.00000011921f}; + + // asin(V) = V * (C0 + C1 * V + C2 * V^2 + C3 * V^3 + C4 * V^4 + C5 * V^5) + (1 - V) * rsq(1 - V) * + // V * (C6 + C7 * V + C8 * V^2 + C9 * V^3 + C10 * V^4 + C11 * V^5) + + AbsV = XMVectorAbs(V); + + V2 = XMVectorMultiply(V, V); + V3 = XMVectorMultiply(V2, AbsV); + + R4 = XMVectorNegativeMultiplySubtract(AbsV, V, V); + + OneMinusAbsV = XMVectorSubtract(OnePlusEpsilon, AbsV); + Rsq = XMVectorReciprocalSqrt(OneMinusAbsV); + + C0 = XMVectorSplatX(g_XMASinCoefficients0.v); + C1 = XMVectorSplatY(g_XMASinCoefficients0.v); + C2 = XMVectorSplatZ(g_XMASinCoefficients0.v); + C3 = XMVectorSplatW(g_XMASinCoefficients0.v); + + C4 = XMVectorSplatX(g_XMASinCoefficients1.v); + C5 = XMVectorSplatY(g_XMASinCoefficients1.v); + C6 = XMVectorSplatZ(g_XMASinCoefficients1.v); + C7 = XMVectorSplatW(g_XMASinCoefficients1.v); + + C8 = XMVectorSplatX(g_XMASinCoefficients2.v); + C9 = XMVectorSplatY(g_XMASinCoefficients2.v); + C10 = XMVectorSplatZ(g_XMASinCoefficients2.v); + C11 = XMVectorSplatW(g_XMASinCoefficients2.v); + + R0 = XMVectorMultiplyAdd(C3, AbsV, C7); + R1 = XMVectorMultiplyAdd(C1, AbsV, C5); + R2 = XMVectorMultiplyAdd(C2, AbsV, C6); + R3 = XMVectorMultiplyAdd(C0, AbsV, C4); + + R0 = XMVectorMultiplyAdd(R0, AbsV, C11); + R1 = XMVectorMultiplyAdd(R1, AbsV, C9); + R2 = XMVectorMultiplyAdd(R2, AbsV, C10); + R3 = XMVectorMultiplyAdd(R3, AbsV, C8); + + R0 = XMVectorMultiplyAdd(R2, V3, R0); + R1 = XMVectorMultiplyAdd(R3, V3, R1); + + R0 = XMVectorMultiply(V, R0); + R1 = XMVectorMultiply(R4, R1); + + Result = XMVectorMultiplyAdd(R1, Rsq, R0); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + static CONST XMVECTORF32 OnePlusEpsilon = {1.00000011921f, 1.00000011921f, 1.00000011921f, 1.00000011921f}; + + // asin(V) = V * (C0 + C1 * V + C2 * V^2 + C3 * V^3 + C4 * V^4 + C5 * V^5) + (1 - V) * rsq(1 - V) * + // V * (C6 + C7 * V + C8 * V^2 + C9 * V^3 + C10 * V^4 + C11 * V^5) + // Get abs(V) + XMVECTOR vAbsV = _mm_setzero_ps(); + vAbsV = _mm_sub_ps(vAbsV,V); + vAbsV = _mm_max_ps(vAbsV,V); + + XMVECTOR R0 = vAbsV; + XMVECTOR vConstants = _mm_load_ps1(&g_XMASinCoefficients0.f[3]); + R0 = _mm_mul_ps(R0,vConstants); + vConstants = _mm_load_ps1(&g_XMASinCoefficients1.f[3]); + R0 = _mm_add_ps(R0,vConstants); + + XMVECTOR R1 = vAbsV; + vConstants = _mm_load_ps1(&g_XMASinCoefficients0.f[1]); + R1 = _mm_mul_ps(R1,vConstants); + vConstants = _mm_load_ps1(&g_XMASinCoefficients1.f[1]); + R1 = _mm_add_ps(R1, vConstants); + + XMVECTOR R2 = vAbsV; + vConstants = _mm_load_ps1(&g_XMASinCoefficients0.f[2]); + R2 = _mm_mul_ps(R2,vConstants); + vConstants = _mm_load_ps1(&g_XMASinCoefficients1.f[2]); + R2 = _mm_add_ps(R2, vConstants); + + XMVECTOR R3 = vAbsV; + vConstants = _mm_load_ps1(&g_XMASinCoefficients0.f[0]); + R3 = _mm_mul_ps(R3,vConstants); + vConstants = _mm_load_ps1(&g_XMASinCoefficients1.f[0]); + R3 = _mm_add_ps(R3, vConstants); + + vConstants = _mm_load_ps1(&g_XMASinCoefficients2.f[3]); + R0 = _mm_mul_ps(R0,vAbsV); + R0 = _mm_add_ps(R0,vConstants); + + vConstants = _mm_load_ps1(&g_XMASinCoefficients2.f[1]); + R1 = _mm_mul_ps(R1,vAbsV); + R1 = _mm_add_ps(R1,vConstants); + + vConstants = _mm_load_ps1(&g_XMASinCoefficients2.f[2]); + R2 = _mm_mul_ps(R2,vAbsV); + R2 = _mm_add_ps(R2,vConstants); + + vConstants = _mm_load_ps1(&g_XMASinCoefficients2.f[0]); + R3 = _mm_mul_ps(R3,vAbsV); + R3 = _mm_add_ps(R3,vConstants); + + // V3 = V^3 + vConstants = _mm_mul_ps(V,V); + vConstants = _mm_mul_ps(vConstants, vAbsV); + // Mul by V^3 + R2 = _mm_mul_ps(R2,vConstants); + R3 = _mm_mul_ps(R3,vConstants); + // Merge the results + R0 = _mm_add_ps(R0,R2); + R1 = _mm_add_ps(R1,R3); + + R0 = _mm_mul_ps(R0,V); + // vConstants = V-(V^2 retaining sign) + vConstants = _mm_mul_ps(vAbsV, V); + vConstants = _mm_sub_ps(V,vConstants); + R1 = _mm_mul_ps(R1,vConstants); + vConstants = _mm_sub_ps(OnePlusEpsilon,vAbsV); + // Do NOT use rsqrt/mul. This needs the precision + vConstants = _mm_sqrt_ps(vConstants); + R1 = _mm_div_ps(R1,vConstants); + R0 = _mm_add_ps(R0,R1); + return R0; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMINLINE XMVECTOR XMVectorACos +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V2, V3, AbsV; + XMVECTOR C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11; + XMVECTOR R0, R1, R2, R3, R4; + XMVECTOR OneMinusAbsV; + XMVECTOR Rsq; + XMVECTOR Result; + static CONST XMVECTOR OnePlusEpsilon = {1.00000011921f, 1.00000011921f, 1.00000011921f, 1.00000011921f}; + + // acos(V) = PI / 2 - asin(V) + + AbsV = XMVectorAbs(V); + + V2 = XMVectorMultiply(V, V); + V3 = XMVectorMultiply(V2, AbsV); + + R4 = XMVectorNegativeMultiplySubtract(AbsV, V, V); + + OneMinusAbsV = XMVectorSubtract(OnePlusEpsilon, AbsV); + Rsq = XMVectorReciprocalSqrt(OneMinusAbsV); + + C0 = XMVectorSplatX(g_XMASinCoefficients0.v); + C1 = XMVectorSplatY(g_XMASinCoefficients0.v); + C2 = XMVectorSplatZ(g_XMASinCoefficients0.v); + C3 = XMVectorSplatW(g_XMASinCoefficients0.v); + + C4 = XMVectorSplatX(g_XMASinCoefficients1.v); + C5 = XMVectorSplatY(g_XMASinCoefficients1.v); + C6 = XMVectorSplatZ(g_XMASinCoefficients1.v); + C7 = XMVectorSplatW(g_XMASinCoefficients1.v); + + C8 = XMVectorSplatX(g_XMASinCoefficients2.v); + C9 = XMVectorSplatY(g_XMASinCoefficients2.v); + C10 = XMVectorSplatZ(g_XMASinCoefficients2.v); + C11 = XMVectorSplatW(g_XMASinCoefficients2.v); + + R0 = XMVectorMultiplyAdd(C3, AbsV, C7); + R1 = XMVectorMultiplyAdd(C1, AbsV, C5); + R2 = XMVectorMultiplyAdd(C2, AbsV, C6); + R3 = XMVectorMultiplyAdd(C0, AbsV, C4); + + R0 = XMVectorMultiplyAdd(R0, AbsV, C11); + R1 = XMVectorMultiplyAdd(R1, AbsV, C9); + R2 = XMVectorMultiplyAdd(R2, AbsV, C10); + R3 = XMVectorMultiplyAdd(R3, AbsV, C8); + + R0 = XMVectorMultiplyAdd(R2, V3, R0); + R1 = XMVectorMultiplyAdd(R3, V3, R1); + + R0 = XMVectorMultiply(V, R0); + R1 = XMVectorMultiply(R4, R1); + + Result = XMVectorMultiplyAdd(R1, Rsq, R0); + + Result = XMVectorSubtract(g_XMHalfPi.v, Result); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + static CONST XMVECTORF32 OnePlusEpsilon = {1.00000011921f, 1.00000011921f, 1.00000011921f, 1.00000011921f}; + // Uses only 6 registers for good code on x86 targets + // acos(V) = PI / 2 - asin(V) + // Get abs(V) + XMVECTOR vAbsV = _mm_setzero_ps(); + vAbsV = _mm_sub_ps(vAbsV,V); + vAbsV = _mm_max_ps(vAbsV,V); + // Perform the series in precision groups to + // retain precision across 20 bits. (3 bits of imprecision due to operations) + XMVECTOR R0 = vAbsV; + XMVECTOR vConstants = _mm_load_ps1(&g_XMASinCoefficients0.f[3]); + R0 = _mm_mul_ps(R0,vConstants); + vConstants = _mm_load_ps1(&g_XMASinCoefficients1.f[3]); + R0 = _mm_add_ps(R0,vConstants); + R0 = _mm_mul_ps(R0,vAbsV); + vConstants = _mm_load_ps1(&g_XMASinCoefficients2.f[3]); + R0 = _mm_add_ps(R0,vConstants); + + XMVECTOR R1 = vAbsV; + vConstants = _mm_load_ps1(&g_XMASinCoefficients0.f[1]); + R1 = _mm_mul_ps(R1,vConstants); + vConstants = _mm_load_ps1(&g_XMASinCoefficients1.f[1]); + R1 = _mm_add_ps(R1,vConstants); + R1 = _mm_mul_ps(R1, vAbsV); + vConstants = _mm_load_ps1(&g_XMASinCoefficients2.f[1]); + R1 = _mm_add_ps(R1,vConstants); + + XMVECTOR R2 = vAbsV; + vConstants = _mm_load_ps1(&g_XMASinCoefficients0.f[2]); + R2 = _mm_mul_ps(R2,vConstants); + vConstants = _mm_load_ps1(&g_XMASinCoefficients1.f[2]); + R2 = _mm_add_ps(R2,vConstants); + R2 = _mm_mul_ps(R2, vAbsV); + vConstants = _mm_load_ps1(&g_XMASinCoefficients2.f[2]); + R2 = _mm_add_ps(R2,vConstants); + + XMVECTOR R3 = vAbsV; + vConstants = _mm_load_ps1(&g_XMASinCoefficients0.f[0]); + R3 = _mm_mul_ps(R3,vConstants); + vConstants = _mm_load_ps1(&g_XMASinCoefficients1.f[0]); + R3 = _mm_add_ps(R3,vConstants); + R3 = _mm_mul_ps(R3, vAbsV); + vConstants = _mm_load_ps1(&g_XMASinCoefficients2.f[0]); + R3 = _mm_add_ps(R3,vConstants); + + // vConstants = V^3 + vConstants = _mm_mul_ps(V,V); + vConstants = _mm_mul_ps(vConstants,vAbsV); + R2 = _mm_mul_ps(R2,vConstants); + R3 = _mm_mul_ps(R3,vConstants); + // Add the pair of values together here to retain + // as much precision as possible + R0 = _mm_add_ps(R0,R2); + R1 = _mm_add_ps(R1,R3); + + R0 = _mm_mul_ps(R0,V); + // vConstants = V-(V*abs(V)) + vConstants = _mm_mul_ps(V,vAbsV); + vConstants = _mm_sub_ps(V,vConstants); + R1 = _mm_mul_ps(R1,vConstants); + // Episilon exists to allow 1.0 as an answer + vConstants = _mm_sub_ps(OnePlusEpsilon, vAbsV); + // Use sqrt instead of rsqrt for precision + vConstants = _mm_sqrt_ps(vConstants); + R1 = _mm_div_ps(R1,vConstants); + R1 = _mm_add_ps(R1,R0); + vConstants = _mm_sub_ps(g_XMHalfPi,R1); + return vConstants; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMINLINE XMVECTOR XMVectorATan +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + // Cody and Waite algorithm to compute inverse tangent. + + XMVECTOR N, D; + XMVECTOR VF, G, ReciprocalF, AbsF, FA, FB; + XMVECTOR Sqrt3, Sqrt3MinusOne, TwoMinusSqrt3; + XMVECTOR HalfPi, OneThirdPi, OneSixthPi, Epsilon, MinV, MaxV; + XMVECTOR Zero; + XMVECTOR NegativeHalfPi; + XMVECTOR Angle1, Angle2; + XMVECTOR F_GT_One, F_GT_TwoMinusSqrt3, AbsF_LT_Epsilon, V_LT_Zero, V_GT_MaxV, V_LT_MinV; + XMVECTOR NegativeResult, Result; + XMVECTOR P0, P1, P2, P3, Q0, Q1, Q2, Q3; + static CONST XMVECTOR ATanConstants0 = {-1.3688768894e+1f, -2.0505855195e+1f, -8.4946240351f, -8.3758299368e-1f}; + static CONST XMVECTOR ATanConstants1 = {4.1066306682e+1f, 8.6157349597e+1f, 5.9578436142e+1f, 1.5024001160e+1f}; + static CONST XMVECTOR ATanConstants2 = {1.732050808f, 7.320508076e-1f, 2.679491924e-1f, 0.000244140625f}; // + static CONST XMVECTOR ATanConstants3 = {XM_PIDIV2, XM_PI / 3.0f, XM_PI / 6.0f, 8.507059173e+37f}; // + + Zero = XMVectorZero(); + + P0 = XMVectorSplatX(ATanConstants0); + P1 = XMVectorSplatY(ATanConstants0); + P2 = XMVectorSplatZ(ATanConstants0); + P3 = XMVectorSplatW(ATanConstants0); + + Q0 = XMVectorSplatX(ATanConstants1); + Q1 = XMVectorSplatY(ATanConstants1); + Q2 = XMVectorSplatZ(ATanConstants1); + Q3 = XMVectorSplatW(ATanConstants1); + + Sqrt3 = XMVectorSplatX(ATanConstants2); + Sqrt3MinusOne = XMVectorSplatY(ATanConstants2); + TwoMinusSqrt3 = XMVectorSplatZ(ATanConstants2); + Epsilon = XMVectorSplatW(ATanConstants2); + + HalfPi = XMVectorSplatX(ATanConstants3); + OneThirdPi = XMVectorSplatY(ATanConstants3); + OneSixthPi = XMVectorSplatZ(ATanConstants3); + MaxV = XMVectorSplatW(ATanConstants3); + + VF = XMVectorAbs(V); + ReciprocalF = XMVectorReciprocal(VF); + + F_GT_One = XMVectorGreater(VF, g_XMOne.v); + + VF = XMVectorSelect(VF, ReciprocalF, F_GT_One); + Angle1 = XMVectorSelect(Zero, HalfPi, F_GT_One); + Angle2 = XMVectorSelect(OneSixthPi, OneThirdPi, F_GT_One); + + F_GT_TwoMinusSqrt3 = XMVectorGreater(VF, TwoMinusSqrt3); + + FA = XMVectorMultiplyAdd(Sqrt3MinusOne, VF, VF); + FA = XMVectorAdd(FA, g_XMNegativeOne.v); + FB = XMVectorAdd(VF, Sqrt3); + FB = XMVectorReciprocal(FB); + FA = XMVectorMultiply(FA, FB); + + VF = XMVectorSelect(VF, FA, F_GT_TwoMinusSqrt3); + Angle1 = XMVectorSelect(Angle1, Angle2, F_GT_TwoMinusSqrt3); + + AbsF = XMVectorAbs(VF); + AbsF_LT_Epsilon = XMVectorLess(AbsF, Epsilon); + + G = XMVectorMultiply(VF, VF); + + D = XMVectorAdd(G, Q3); + D = XMVectorMultiplyAdd(D, G, Q2); + D = XMVectorMultiplyAdd(D, G, Q1); + D = XMVectorMultiplyAdd(D, G, Q0); + D = XMVectorReciprocal(D); + + N = XMVectorMultiplyAdd(P3, G, P2); + N = XMVectorMultiplyAdd(N, G, P1); + N = XMVectorMultiplyAdd(N, G, P0); + N = XMVectorMultiply(N, G); + Result = XMVectorMultiply(N, D); + + Result = XMVectorMultiplyAdd(Result, VF, VF); + + Result = XMVectorSelect(Result, VF, AbsF_LT_Epsilon); + + NegativeResult = XMVectorNegate(Result); + Result = XMVectorSelect(Result, NegativeResult, F_GT_One); + + Result = XMVectorAdd(Result, Angle1); + + V_LT_Zero = XMVectorLess(V, Zero); + NegativeResult = XMVectorNegate(Result); + Result = XMVectorSelect(Result, NegativeResult, V_LT_Zero); + + MinV = XMVectorNegate(MaxV); + NegativeHalfPi = XMVectorNegate(HalfPi); + V_GT_MaxV = XMVectorGreater(V, MaxV); + V_LT_MinV = XMVectorLess(V, MinV); + Result = XMVectorSelect(Result, g_XMHalfPi.v, V_GT_MaxV); + Result = XMVectorSelect(Result, NegativeHalfPi, V_LT_MinV); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + static CONST XMVECTORF32 ATanConstants0 = {-1.3688768894e+1f, -2.0505855195e+1f, -8.4946240351f, -8.3758299368e-1f}; + static CONST XMVECTORF32 ATanConstants1 = {4.1066306682e+1f, 8.6157349597e+1f, 5.9578436142e+1f, 1.5024001160e+1f}; + static CONST XMVECTORF32 ATanConstants2 = {1.732050808f, 7.320508076e-1f, 2.679491924e-1f, 0.000244140625f}; // + static CONST XMVECTORF32 ATanConstants3 = {XM_PIDIV2, XM_PI / 3.0f, XM_PI / 6.0f, 8.507059173e+37f}; // + + XMVECTOR VF = XMVectorAbs(V); + XMVECTOR F_GT_One = _mm_cmpgt_ps(VF,g_XMOne); + XMVECTOR ReciprocalF = XMVectorReciprocal(VF); + VF = XMVectorSelect(VF, ReciprocalF, F_GT_One); + XMVECTOR Zero = XMVectorZero(); + XMVECTOR HalfPi = _mm_load_ps1(&ATanConstants3.f[0]); + XMVECTOR Angle1 = XMVectorSelect(Zero, HalfPi, F_GT_One); + // Pi/3 + XMVECTOR vConstants = _mm_load_ps1(&ATanConstants3.f[1]); + // Pi/6 + XMVECTOR Angle2 = _mm_load_ps1(&ATanConstants3.f[2]); + Angle2 = XMVectorSelect(Angle2, vConstants, F_GT_One); + + // 1-sqrt(3) + XMVECTOR FA = _mm_load_ps1(&ATanConstants2.f[1]); + FA = _mm_mul_ps(FA,VF); + FA = _mm_add_ps(FA,VF); + FA = _mm_add_ps(FA,g_XMNegativeOne); + // sqrt(3) + vConstants = _mm_load_ps1(&ATanConstants2.f[0]); + vConstants = _mm_add_ps(vConstants,VF); + FA = _mm_div_ps(FA,vConstants); + + // 2-sqrt(3) + vConstants = _mm_load_ps1(&ATanConstants2.f[2]); + // >2-sqrt(3)? + vConstants = _mm_cmpgt_ps(VF,vConstants); + VF = XMVectorSelect(VF, FA, vConstants); + Angle1 = XMVectorSelect(Angle1, Angle2, vConstants); + + XMVECTOR AbsF = XMVectorAbs(VF); + + XMVECTOR G = _mm_mul_ps(VF,VF); + XMVECTOR D = _mm_load_ps1(&ATanConstants1.f[3]); + D = _mm_add_ps(D,G); + D = _mm_mul_ps(D,G); + vConstants = _mm_load_ps1(&ATanConstants1.f[2]); + D = _mm_add_ps(D,vConstants); + D = _mm_mul_ps(D,G); + vConstants = _mm_load_ps1(&ATanConstants1.f[1]); + D = _mm_add_ps(D,vConstants); + D = _mm_mul_ps(D,G); + vConstants = _mm_load_ps1(&ATanConstants1.f[0]); + D = _mm_add_ps(D,vConstants); + + XMVECTOR N = _mm_load_ps1(&ATanConstants0.f[3]); + N = _mm_mul_ps(N,G); + vConstants = _mm_load_ps1(&ATanConstants0.f[2]); + N = _mm_add_ps(N,vConstants); + N = _mm_mul_ps(N,G); + vConstants = _mm_load_ps1(&ATanConstants0.f[1]); + N = _mm_add_ps(N,vConstants); + N = _mm_mul_ps(N,G); + vConstants = _mm_load_ps1(&ATanConstants0.f[0]); + N = _mm_add_ps(N,vConstants); + N = _mm_mul_ps(N,G); + XMVECTOR Result = _mm_div_ps(N,D); + + Result = _mm_mul_ps(Result,VF); + Result = _mm_add_ps(Result,VF); + // Epsilon + vConstants = _mm_load_ps1(&ATanConstants2.f[3]); + vConstants = _mm_cmpge_ps(vConstants,AbsF); + Result = XMVectorSelect(Result,VF,vConstants); + + XMVECTOR NegativeResult = _mm_mul_ps(Result,g_XMNegativeOne); + Result = XMVectorSelect(Result,NegativeResult,F_GT_One); + Result = _mm_add_ps(Result,Angle1); + + Zero = _mm_cmpge_ps(Zero,V); + NegativeResult = _mm_mul_ps(Result,g_XMNegativeOne); + Result = XMVectorSelect(Result,NegativeResult,Zero); + + XMVECTOR MaxV = _mm_load_ps1(&ATanConstants3.f[3]); + XMVECTOR MinV = _mm_mul_ps(MaxV,g_XMNegativeOne); + // Negate HalfPi + HalfPi = _mm_mul_ps(HalfPi,g_XMNegativeOne); + MaxV = _mm_cmple_ps(MaxV,V); + MinV = _mm_cmpge_ps(MinV,V); + Result = XMVectorSelect(Result,g_XMHalfPi,MaxV); + // HalfPi = -HalfPi + Result = XMVectorSelect(Result,HalfPi,MinV); + return Result; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMINLINE XMVECTOR XMVectorATan2 +( + FXMVECTOR Y, + FXMVECTOR X +) +{ +#if defined(_XM_NO_INTRINSICS_) + + // Return the inverse tangent of Y / X in the range of -Pi to Pi with the following exceptions: + + // Y == 0 and X is Negative -> Pi with the sign of Y + // y == 0 and x is positive -> 0 with the sign of y + // Y != 0 and X == 0 -> Pi / 2 with the sign of Y + // Y != 0 and X is Negative -> atan(y/x) + (PI with the sign of Y) + // X == -Infinity and Finite Y -> Pi with the sign of Y + // X == +Infinity and Finite Y -> 0 with the sign of Y + // Y == Infinity and X is Finite -> Pi / 2 with the sign of Y + // Y == Infinity and X == -Infinity -> 3Pi / 4 with the sign of Y + // Y == Infinity and X == +Infinity -> Pi / 4 with the sign of Y + + XMVECTOR Reciprocal; + XMVECTOR V; + XMVECTOR YSign; + XMVECTOR Pi, PiOverTwo, PiOverFour, ThreePiOverFour; + XMVECTOR YEqualsZero, XEqualsZero, XIsPositive, YEqualsInfinity, XEqualsInfinity; + XMVECTOR ATanResultValid; + XMVECTOR R0, R1, R2, R3, R4, R5; + XMVECTOR Zero; + XMVECTOR Result; + static CONST XMVECTOR ATan2Constants = {XM_PI, XM_PIDIV2, XM_PIDIV4, XM_PI * 3.0f / 4.0f}; + + Zero = XMVectorZero(); + ATanResultValid = XMVectorTrueInt(); + + Pi = XMVectorSplatX(ATan2Constants); + PiOverTwo = XMVectorSplatY(ATan2Constants); + PiOverFour = XMVectorSplatZ(ATan2Constants); + ThreePiOverFour = XMVectorSplatW(ATan2Constants); + + YEqualsZero = XMVectorEqual(Y, Zero); + XEqualsZero = XMVectorEqual(X, Zero); + XIsPositive = XMVectorAndInt(X, g_XMNegativeZero.v); + XIsPositive = XMVectorEqualInt(XIsPositive, Zero); + YEqualsInfinity = XMVectorIsInfinite(Y); + XEqualsInfinity = XMVectorIsInfinite(X); + + YSign = XMVectorAndInt(Y, g_XMNegativeZero.v); + Pi = XMVectorOrInt(Pi, YSign); + PiOverTwo = XMVectorOrInt(PiOverTwo, YSign); + PiOverFour = XMVectorOrInt(PiOverFour, YSign); + ThreePiOverFour = XMVectorOrInt(ThreePiOverFour, YSign); + + R1 = XMVectorSelect(Pi, YSign, XIsPositive); + R2 = XMVectorSelect(ATanResultValid, PiOverTwo, XEqualsZero); + R3 = XMVectorSelect(R2, R1, YEqualsZero); + R4 = XMVectorSelect(ThreePiOverFour, PiOverFour, XIsPositive); + R5 = XMVectorSelect(PiOverTwo, R4, XEqualsInfinity); + Result = XMVectorSelect(R3, R5, YEqualsInfinity); + ATanResultValid = XMVectorEqualInt(Result, ATanResultValid); + + Reciprocal = XMVectorReciprocal(X); + V = XMVectorMultiply(Y, Reciprocal); + R0 = XMVectorATan(V); + + R1 = XMVectorSelect( Pi, Zero, XIsPositive ); + R2 = XMVectorAdd(R0, R1); + + Result = XMVectorSelect(Result, R2, ATanResultValid); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + static CONST XMVECTORF32 ATan2Constants = {XM_PI, XM_PIDIV2, XM_PIDIV4, XM_PI * 3.0f / 4.0f}; + + // Mask if Y>0 && Y!=INF + XMVECTOR YEqualsInfinity = XMVectorIsInfinite(Y); + // Get the sign of (Y&0x80000000) + XMVECTOR YSign = _mm_and_ps(Y, g_XMNegativeZero); + // Get the sign bits of X + XMVECTOR XIsPositive = _mm_and_ps(X,g_XMNegativeZero); + // Change them to masks + XIsPositive = XMVectorEqualInt(XIsPositive,g_XMZero); + // Get Pi + XMVECTOR Pi = _mm_load_ps1(&ATan2Constants.f[0]); + // Copy the sign of Y + Pi = _mm_or_ps(Pi,YSign); + XMVECTOR R1 = XMVectorSelect(Pi,YSign,XIsPositive); + // Mask for X==0 + XMVECTOR vConstants = _mm_cmpeq_ps(X,g_XMZero); + // Get Pi/2 with with sign of Y + XMVECTOR PiOverTwo = _mm_load_ps1(&ATan2Constants.f[1]); + PiOverTwo = _mm_or_ps(PiOverTwo,YSign); + XMVECTOR R2 = XMVectorSelect(g_XMNegOneMask,PiOverTwo,vConstants); + // Mask for Y==0 + vConstants = _mm_cmpeq_ps(Y,g_XMZero); + R2 = XMVectorSelect(R2,R1,vConstants); + // Get Pi/4 with sign of Y + XMVECTOR PiOverFour = _mm_load_ps1(&ATan2Constants.f[2]); + PiOverFour = _mm_or_ps(PiOverFour,YSign); + // Get (Pi*3)/4 with sign of Y + XMVECTOR ThreePiOverFour = _mm_load_ps1(&ATan2Constants.f[3]); + ThreePiOverFour = _mm_or_ps(ThreePiOverFour,YSign); + vConstants = XMVectorSelect(ThreePiOverFour, PiOverFour, XIsPositive); + XMVECTOR XEqualsInfinity = XMVectorIsInfinite(X); + vConstants = XMVectorSelect(PiOverTwo,vConstants,XEqualsInfinity); + + XMVECTOR vResult = XMVectorSelect(R2,vConstants,YEqualsInfinity); + vConstants = XMVectorSelect(R1,vResult,YEqualsInfinity); + // At this point, any entry that's zero will get the result + // from XMVectorATan(), otherwise, return the failsafe value + vResult = XMVectorSelect(vResult,vConstants,XEqualsInfinity); + // Any entries not 0xFFFFFFFF, are considered precalculated + XMVECTOR ATanResultValid = XMVectorEqualInt(vResult,g_XMNegOneMask); + // Let's do the ATan2 function + vConstants = _mm_div_ps(Y,X); + vConstants = XMVectorATan(vConstants); + // Discard entries that have been declared void + + XMVECTOR R3 = XMVectorSelect( Pi, g_XMZero, XIsPositive ); + vConstants = _mm_add_ps( vConstants, R3 ); + + vResult = XMVectorSelect(vResult,vConstants,ATanResultValid); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorSinEst +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V2, V3, V5, V7; + XMVECTOR S1, S2, S3; + XMVECTOR Result; + + // sin(V) ~= V - V^3 / 3! + V^5 / 5! - V^7 / 7! (for -PI <= V < PI) + V2 = XMVectorMultiply(V, V); + V3 = XMVectorMultiply(V2, V); + V5 = XMVectorMultiply(V3, V2); + V7 = XMVectorMultiply(V5, V2); + + S1 = XMVectorSplatY(g_XMSinEstCoefficients.v); + S2 = XMVectorSplatZ(g_XMSinEstCoefficients.v); + S3 = XMVectorSplatW(g_XMSinEstCoefficients.v); + + Result = XMVectorMultiplyAdd(S1, V3, V); + Result = XMVectorMultiplyAdd(S2, V5, Result); + Result = XMVectorMultiplyAdd(S3, V7, Result); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + // sin(V) ~= V - V^3 / 3! + V^5 / 5! - V^7 / 7! (for -PI <= V < PI) + XMVECTOR V2 = _mm_mul_ps(V,V); + XMVECTOR V3 = _mm_mul_ps(V2,V); + XMVECTOR vResult = _mm_load_ps1(&g_XMSinEstCoefficients.f[1]); + vResult = _mm_mul_ps(vResult,V3); + vResult = _mm_add_ps(vResult,V); + XMVECTOR vConstants = _mm_load_ps1(&g_XMSinEstCoefficients.f[2]); + // V^5 + V3 = _mm_mul_ps(V3,V2); + vConstants = _mm_mul_ps(vConstants,V3); + vResult = _mm_add_ps(vResult,vConstants); + vConstants = _mm_load_ps1(&g_XMSinEstCoefficients.f[3]); + // V^7 + V3 = _mm_mul_ps(V3,V2); + vConstants = _mm_mul_ps(vConstants,V3); + vResult = _mm_add_ps(vResult,vConstants); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorCosEst +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V2, V4, V6; + XMVECTOR C0, C1, C2, C3; + XMVECTOR Result; + + V2 = XMVectorMultiply(V, V); + V4 = XMVectorMultiply(V2, V2); + V6 = XMVectorMultiply(V4, V2); + + C0 = XMVectorSplatX(g_XMCosEstCoefficients.v); + C1 = XMVectorSplatY(g_XMCosEstCoefficients.v); + C2 = XMVectorSplatZ(g_XMCosEstCoefficients.v); + C3 = XMVectorSplatW(g_XMCosEstCoefficients.v); + + Result = XMVectorMultiplyAdd(C1, V2, C0); + Result = XMVectorMultiplyAdd(C2, V4, Result); + Result = XMVectorMultiplyAdd(C3, V6, Result); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + // Get V^2 + XMVECTOR V2 = _mm_mul_ps(V,V); + XMVECTOR vResult = _mm_load_ps1(&g_XMCosEstCoefficients.f[1]); + vResult = _mm_mul_ps(vResult,V2); + XMVECTOR vConstants = _mm_load_ps1(&g_XMCosEstCoefficients.f[0]); + vResult = _mm_add_ps(vResult,vConstants); + vConstants = _mm_load_ps1(&g_XMCosEstCoefficients.f[2]); + // Get V^4 + XMVECTOR V4 = _mm_mul_ps(V2, V2); + vConstants = _mm_mul_ps(vConstants,V4); + vResult = _mm_add_ps(vResult,vConstants); + vConstants = _mm_load_ps1(&g_XMCosEstCoefficients.f[3]); + // It's really V^6 + V4 = _mm_mul_ps(V4,V2); + vConstants = _mm_mul_ps(vConstants,V4); + vResult = _mm_add_ps(vResult,vConstants); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMVectorSinCosEst +( + XMVECTOR* pSin, + XMVECTOR* pCos, + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V2, V3, V4, V5, V6, V7; + XMVECTOR S1, S2, S3; + XMVECTOR C0, C1, C2, C3; + XMVECTOR Sin, Cos; + + XMASSERT(pSin); + XMASSERT(pCos); + + // sin(V) ~= V - V^3 / 3! + V^5 / 5! - V^7 / 7! (for -PI <= V < PI) + // cos(V) ~= 1 - V^2 / 2! + V^4 / 4! - V^6 / 6! (for -PI <= V < PI) + V2 = XMVectorMultiply(V, V); + V3 = XMVectorMultiply(V2, V); + V4 = XMVectorMultiply(V2, V2); + V5 = XMVectorMultiply(V3, V2); + V6 = XMVectorMultiply(V3, V3); + V7 = XMVectorMultiply(V4, V3); + + S1 = XMVectorSplatY(g_XMSinEstCoefficients.v); + S2 = XMVectorSplatZ(g_XMSinEstCoefficients.v); + S3 = XMVectorSplatW(g_XMSinEstCoefficients.v); + + C0 = XMVectorSplatX(g_XMCosEstCoefficients.v); + C1 = XMVectorSplatY(g_XMCosEstCoefficients.v); + C2 = XMVectorSplatZ(g_XMCosEstCoefficients.v); + C3 = XMVectorSplatW(g_XMCosEstCoefficients.v); + + Sin = XMVectorMultiplyAdd(S1, V3, V); + Sin = XMVectorMultiplyAdd(S2, V5, Sin); + Sin = XMVectorMultiplyAdd(S3, V7, Sin); + + Cos = XMVectorMultiplyAdd(C1, V2, C0); + Cos = XMVectorMultiplyAdd(C2, V4, Cos); + Cos = XMVectorMultiplyAdd(C3, V6, Cos); + + *pSin = Sin; + *pCos = Cos; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pSin); + XMASSERT(pCos); + XMVECTOR V2, V3, V4, V5, V6, V7; + XMVECTOR S1, S2, S3; + XMVECTOR C0, C1, C2, C3; + XMVECTOR Sin, Cos; + + // sin(V) ~= V - V^3 / 3! + V^5 / 5! - V^7 / 7! (for -PI <= V < PI) + // cos(V) ~= 1 - V^2 / 2! + V^4 / 4! - V^6 / 6! (for -PI <= V < PI) + V2 = XMVectorMultiply(V, V); + V3 = XMVectorMultiply(V2, V); + V4 = XMVectorMultiply(V2, V2); + V5 = XMVectorMultiply(V3, V2); + V6 = XMVectorMultiply(V3, V3); + V7 = XMVectorMultiply(V4, V3); + + S1 = _mm_load_ps1(&g_XMSinEstCoefficients.f[1]); + S2 = _mm_load_ps1(&g_XMSinEstCoefficients.f[2]); + S3 = _mm_load_ps1(&g_XMSinEstCoefficients.f[3]); + + C0 = _mm_load_ps1(&g_XMCosEstCoefficients.f[0]); + C1 = _mm_load_ps1(&g_XMCosEstCoefficients.f[1]); + C2 = _mm_load_ps1(&g_XMCosEstCoefficients.f[2]); + C3 = _mm_load_ps1(&g_XMCosEstCoefficients.f[3]); + + Sin = XMVectorMultiplyAdd(S1, V3, V); + Sin = XMVectorMultiplyAdd(S2, V5, Sin); + Sin = XMVectorMultiplyAdd(S3, V7, Sin); + + Cos = XMVectorMultiplyAdd(C1, V2, C0); + Cos = XMVectorMultiplyAdd(C2, V4, Cos); + Cos = XMVectorMultiplyAdd(C3, V6, Cos); + + *pSin = Sin; + *pCos = Cos; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorTanEst +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V1, V2, V1T0, V1T1, V2T2; + XMVECTOR T0, T1, T2; + XMVECTOR N, D; + XMVECTOR OneOverPi; + XMVECTOR Result; + + OneOverPi = XMVectorSplatW(g_XMTanEstCoefficients.v); + + V1 = XMVectorMultiply(V, OneOverPi); + V1 = XMVectorRound(V1); + + V1 = XMVectorNegativeMultiplySubtract(g_XMPi.v, V1, V); + + T0 = XMVectorSplatX(g_XMTanEstCoefficients.v); + T1 = XMVectorSplatY(g_XMTanEstCoefficients.v); + T2 = XMVectorSplatZ(g_XMTanEstCoefficients.v); + + V2T2 = XMVectorNegativeMultiplySubtract(V1, V1, T2); + V2 = XMVectorMultiply(V1, V1); + V1T0 = XMVectorMultiply(V1, T0); + V1T1 = XMVectorMultiply(V1, T1); + + D = XMVectorReciprocalEst(V2T2); + N = XMVectorMultiplyAdd(V2, V1T1, V1T0); + + Result = XMVectorMultiply(N, D); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR V1, V2, V1T0, V1T1, V2T2; + XMVECTOR T0, T1, T2; + XMVECTOR N, D; + XMVECTOR OneOverPi; + XMVECTOR Result; + + OneOverPi = XMVectorSplatW(g_XMTanEstCoefficients); + + V1 = XMVectorMultiply(V, OneOverPi); + V1 = XMVectorRound(V1); + + V1 = XMVectorNegativeMultiplySubtract(g_XMPi, V1, V); + + T0 = XMVectorSplatX(g_XMTanEstCoefficients); + T1 = XMVectorSplatY(g_XMTanEstCoefficients); + T2 = XMVectorSplatZ(g_XMTanEstCoefficients); + + V2T2 = XMVectorNegativeMultiplySubtract(V1, V1, T2); + V2 = XMVectorMultiply(V1, V1); + V1T0 = XMVectorMultiply(V1, T0); + V1T1 = XMVectorMultiply(V1, T1); + + D = XMVectorReciprocalEst(V2T2); + N = XMVectorMultiplyAdd(V2, V1T1, V1T0); + + Result = XMVectorMultiply(N, D); + + return Result; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorSinHEst +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V1, V2; + XMVECTOR E1, E2; + XMVECTOR Result; + static CONST XMVECTORF32 Scale = {1.442695040888963f, 1.442695040888963f, 1.442695040888963f, 1.442695040888963f}; // 1.0f / ln(2.0f) + + V1 = XMVectorMultiplyAdd(V, Scale.v, g_XMNegativeOne.v); + V2 = XMVectorNegativeMultiplySubtract(V, Scale.v, g_XMNegativeOne.v); + + E1 = XMVectorExpEst(V1); + E2 = XMVectorExpEst(V2); + + Result = XMVectorSubtract(E1, E2); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR V1, V2; + XMVECTOR E1, E2; + XMVECTOR Result; + static CONST XMVECTORF32 Scale = {1.442695040888963f, 1.442695040888963f, 1.442695040888963f, 1.442695040888963f}; // 1.0f / ln(2.0f) + + V1 = _mm_mul_ps(V,Scale); + V1 = _mm_add_ps(V1,g_XMNegativeOne); + V2 = _mm_mul_ps(V,Scale); + V2 = _mm_sub_ps(g_XMNegativeOne,V2); + E1 = XMVectorExpEst(V1); + E2 = XMVectorExpEst(V2); + Result = _mm_sub_ps(E1, E2); + return Result; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorCosHEst +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V1, V2; + XMVECTOR E1, E2; + XMVECTOR Result; + static CONST XMVECTOR Scale = {1.442695040888963f, 1.442695040888963f, 1.442695040888963f, 1.442695040888963f}; // 1.0f / ln(2.0f) + + V1 = XMVectorMultiplyAdd(V, Scale, g_XMNegativeOne.v); + V2 = XMVectorNegativeMultiplySubtract(V, Scale, g_XMNegativeOne.v); + + E1 = XMVectorExpEst(V1); + E2 = XMVectorExpEst(V2); + + Result = XMVectorAdd(E1, E2); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR V1, V2; + XMVECTOR E1, E2; + XMVECTOR Result; + static CONST XMVECTORF32 Scale = {1.442695040888963f, 1.442695040888963f, 1.442695040888963f, 1.442695040888963f}; // 1.0f / ln(2.0f) + + V1 = _mm_mul_ps(V,Scale); + V1 = _mm_add_ps(V1,g_XMNegativeOne); + V2 = _mm_mul_ps(V, Scale); + V2 = _mm_sub_ps(g_XMNegativeOne,V2); + E1 = XMVectorExpEst(V1); + E2 = XMVectorExpEst(V2); + Result = _mm_add_ps(E1, E2); + return Result; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorTanHEst +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR E; + XMVECTOR Result; + static CONST XMVECTOR Scale = {2.8853900817779268f, 2.8853900817779268f, 2.8853900817779268f, 2.8853900817779268f}; // 2.0f / ln(2.0f) + + E = XMVectorMultiply(V, Scale); + E = XMVectorExpEst(E); + E = XMVectorMultiplyAdd(E, g_XMOneHalf.v, g_XMOneHalf.v); + E = XMVectorReciprocalEst(E); + + Result = XMVectorSubtract(g_XMOne.v, E); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + static CONST XMVECTORF32 Scale = {2.8853900817779268f, 2.8853900817779268f, 2.8853900817779268f, 2.8853900817779268f}; // 2.0f / ln(2.0f) + + XMVECTOR E = _mm_mul_ps(V, Scale); + E = XMVectorExpEst(E); + E = _mm_mul_ps(E,g_XMOneHalf); + E = _mm_add_ps(E,g_XMOneHalf); + E = XMVectorReciprocalEst(E); + E = _mm_sub_ps(g_XMOne, E); + return E; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorASinEst +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR AbsV, V2, VD, VC0, V2C3; + XMVECTOR C0, C1, C2, C3; + XMVECTOR D, Rsq, SqrtD; + XMVECTOR OnePlusEps; + XMVECTOR Result; + + AbsV = XMVectorAbs(V); + + OnePlusEps = XMVectorSplatX(g_XMASinEstConstants.v); + + C0 = XMVectorSplatX(g_XMASinEstCoefficients.v); + C1 = XMVectorSplatY(g_XMASinEstCoefficients.v); + C2 = XMVectorSplatZ(g_XMASinEstCoefficients.v); + C3 = XMVectorSplatW(g_XMASinEstCoefficients.v); + + D = XMVectorSubtract(OnePlusEps, AbsV); + + Rsq = XMVectorReciprocalSqrtEst(D); + SqrtD = XMVectorMultiply(D, Rsq); + + V2 = XMVectorMultiply(V, AbsV); + V2C3 = XMVectorMultiply(V2, C3); + VD = XMVectorMultiply(D, AbsV); + VC0 = XMVectorMultiply(V, C0); + + Result = XMVectorMultiply(V, C1); + Result = XMVectorMultiplyAdd(V2, C2, Result); + Result = XMVectorMultiplyAdd(V2C3, VD, Result); + Result = XMVectorMultiplyAdd(VC0, SqrtD, Result); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + // Get abs(V) + XMVECTOR vAbsV = _mm_setzero_ps(); + vAbsV = _mm_sub_ps(vAbsV,V); + vAbsV = _mm_max_ps(vAbsV,V); + + XMVECTOR D = _mm_load_ps1(&g_XMASinEstConstants.f[0]); + D = _mm_sub_ps(D,vAbsV); + // Since this is an estimate, rqsrt is okay + XMVECTOR vConstants = _mm_rsqrt_ps(D); + XMVECTOR SqrtD = _mm_mul_ps(D,vConstants); + // V2 = V^2 retaining sign + XMVECTOR V2 = _mm_mul_ps(V,vAbsV); + D = _mm_mul_ps(D,vAbsV); + + XMVECTOR vResult = _mm_load_ps1(&g_XMASinEstCoefficients.f[1]); + vResult = _mm_mul_ps(vResult,V); + vConstants = _mm_load_ps1(&g_XMASinEstCoefficients.f[2]); + vConstants = _mm_mul_ps(vConstants,V2); + vResult = _mm_add_ps(vResult,vConstants); + + vConstants = _mm_load_ps1(&g_XMASinEstCoefficients.f[3]); + vConstants = _mm_mul_ps(vConstants,V2); + vConstants = _mm_mul_ps(vConstants,D); + vResult = _mm_add_ps(vResult,vConstants); + + vConstants = _mm_load_ps1(&g_XMASinEstCoefficients.f[0]); + vConstants = _mm_mul_ps(vConstants,V); + vConstants = _mm_mul_ps(vConstants,SqrtD); + vResult = _mm_add_ps(vResult,vConstants); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorACosEst +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR AbsV, V2, VD, VC0, V2C3; + XMVECTOR C0, C1, C2, C3; + XMVECTOR D, Rsq, SqrtD; + XMVECTOR OnePlusEps, HalfPi; + XMVECTOR Result; + + // acos(V) = PI / 2 - asin(V) + + AbsV = XMVectorAbs(V); + + OnePlusEps = XMVectorSplatX(g_XMASinEstConstants.v); + HalfPi = XMVectorSplatY(g_XMASinEstConstants.v); + + C0 = XMVectorSplatX(g_XMASinEstCoefficients.v); + C1 = XMVectorSplatY(g_XMASinEstCoefficients.v); + C2 = XMVectorSplatZ(g_XMASinEstCoefficients.v); + C3 = XMVectorSplatW(g_XMASinEstCoefficients.v); + + D = XMVectorSubtract(OnePlusEps, AbsV); + + Rsq = XMVectorReciprocalSqrtEst(D); + SqrtD = XMVectorMultiply(D, Rsq); + + V2 = XMVectorMultiply(V, AbsV); + V2C3 = XMVectorMultiply(V2, C3); + VD = XMVectorMultiply(D, AbsV); + VC0 = XMVectorMultiply(V, C0); + + Result = XMVectorMultiply(V, C1); + Result = XMVectorMultiplyAdd(V2, C2, Result); + Result = XMVectorMultiplyAdd(V2C3, VD, Result); + Result = XMVectorMultiplyAdd(VC0, SqrtD, Result); + Result = XMVectorSubtract(HalfPi, Result); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + // acos(V) = PI / 2 - asin(V) + // Get abs(V) + XMVECTOR vAbsV = _mm_setzero_ps(); + vAbsV = _mm_sub_ps(vAbsV,V); + vAbsV = _mm_max_ps(vAbsV,V); + // Calc D + XMVECTOR D = _mm_load_ps1(&g_XMASinEstConstants.f[0]); + D = _mm_sub_ps(D,vAbsV); + // SqrtD = sqrt(D-abs(V)) estimated + XMVECTOR vConstants = _mm_rsqrt_ps(D); + XMVECTOR SqrtD = _mm_mul_ps(D,vConstants); + // V2 = V^2 while retaining sign + XMVECTOR V2 = _mm_mul_ps(V, vAbsV); + // Drop vAbsV here. D = (Const-abs(V))*abs(V) + D = _mm_mul_ps(D, vAbsV); + + XMVECTOR vResult = _mm_load_ps1(&g_XMASinEstCoefficients.f[1]); + vResult = _mm_mul_ps(vResult,V); + vConstants = _mm_load_ps1(&g_XMASinEstCoefficients.f[2]); + vConstants = _mm_mul_ps(vConstants,V2); + vResult = _mm_add_ps(vResult,vConstants); + + vConstants = _mm_load_ps1(&g_XMASinEstCoefficients.f[3]); + vConstants = _mm_mul_ps(vConstants,V2); + vConstants = _mm_mul_ps(vConstants,D); + vResult = _mm_add_ps(vResult,vConstants); + + vConstants = _mm_load_ps1(&g_XMASinEstCoefficients.f[0]); + vConstants = _mm_mul_ps(vConstants,V); + vConstants = _mm_mul_ps(vConstants,SqrtD); + vResult = _mm_add_ps(vResult,vConstants); + + vConstants = _mm_load_ps1(&g_XMASinEstConstants.f[1]); + vResult = _mm_sub_ps(vConstants,vResult); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorATanEst +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR AbsV, V2S2, N, D; + XMVECTOR S0, S1, S2; + XMVECTOR HalfPi; + XMVECTOR Result; + + S0 = XMVectorSplatX(g_XMATanEstCoefficients.v); + S1 = XMVectorSplatY(g_XMATanEstCoefficients.v); + S2 = XMVectorSplatZ(g_XMATanEstCoefficients.v); + HalfPi = XMVectorSplatW(g_XMATanEstCoefficients.v); + + AbsV = XMVectorAbs(V); + + V2S2 = XMVectorMultiplyAdd(V, V, S2); + N = XMVectorMultiplyAdd(AbsV, HalfPi, S0); + D = XMVectorMultiplyAdd(AbsV, S1, V2S2); + N = XMVectorMultiply(N, V); + D = XMVectorReciprocalEst(D); + + Result = XMVectorMultiply(N, D); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + // Get abs(V) + XMVECTOR vAbsV = _mm_setzero_ps(); + vAbsV = _mm_sub_ps(vAbsV,V); + vAbsV = _mm_max_ps(vAbsV,V); + + XMVECTOR vResult = _mm_load_ps1(&g_XMATanEstCoefficients.f[3]); + vResult = _mm_mul_ps(vResult,vAbsV); + XMVECTOR vConstants = _mm_load_ps1(&g_XMATanEstCoefficients.f[0]); + vResult = _mm_add_ps(vResult,vConstants); + vResult = _mm_mul_ps(vResult,V); + + XMVECTOR D = _mm_mul_ps(V,V); + vConstants = _mm_load_ps1(&g_XMATanEstCoefficients.f[2]); + D = _mm_add_ps(D,vConstants); + vConstants = _mm_load_ps1(&g_XMATanEstCoefficients.f[1]); + vConstants = _mm_mul_ps(vConstants,vAbsV); + D = _mm_add_ps(D,vConstants); + vResult = _mm_div_ps(vResult,D); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorATan2Est +( + FXMVECTOR Y, + FXMVECTOR X +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Reciprocal; + XMVECTOR V; + XMVECTOR YSign; + XMVECTOR Pi, PiOverTwo, PiOverFour, ThreePiOverFour; + XMVECTOR YEqualsZero, XEqualsZero, XIsPositive, YEqualsInfinity, XEqualsInfinity; + XMVECTOR ATanResultValid; + XMVECTOR R0, R1, R2, R3, R4, R5; + XMVECTOR Zero; + XMVECTOR Result; + static CONST XMVECTOR ATan2Constants = {XM_PI, XM_PIDIV2, XM_PIDIV4, XM_PI * 3.0f / 4.0f}; + + Zero = XMVectorZero(); + ATanResultValid = XMVectorTrueInt(); + + Pi = XMVectorSplatX(ATan2Constants); + PiOverTwo = XMVectorSplatY(ATan2Constants); + PiOverFour = XMVectorSplatZ(ATan2Constants); + ThreePiOverFour = XMVectorSplatW(ATan2Constants); + + YEqualsZero = XMVectorEqual(Y, Zero); + XEqualsZero = XMVectorEqual(X, Zero); + XIsPositive = XMVectorAndInt(X, g_XMNegativeZero.v); + XIsPositive = XMVectorEqualInt(XIsPositive, Zero); + YEqualsInfinity = XMVectorIsInfinite(Y); + XEqualsInfinity = XMVectorIsInfinite(X); + + YSign = XMVectorAndInt(Y, g_XMNegativeZero.v); + Pi = XMVectorOrInt(Pi, YSign); + PiOverTwo = XMVectorOrInt(PiOverTwo, YSign); + PiOverFour = XMVectorOrInt(PiOverFour, YSign); + ThreePiOverFour = XMVectorOrInt(ThreePiOverFour, YSign); + + R1 = XMVectorSelect(Pi, YSign, XIsPositive); + R2 = XMVectorSelect(ATanResultValid, PiOverTwo, XEqualsZero); + R3 = XMVectorSelect(R2, R1, YEqualsZero); + R4 = XMVectorSelect(ThreePiOverFour, PiOverFour, XIsPositive); + R5 = XMVectorSelect(PiOverTwo, R4, XEqualsInfinity); + Result = XMVectorSelect(R3, R5, YEqualsInfinity); + ATanResultValid = XMVectorEqualInt(Result, ATanResultValid); + + Reciprocal = XMVectorReciprocalEst(X); + V = XMVectorMultiply(Y, Reciprocal); + R0 = XMVectorATanEst(V); + + R1 = XMVectorSelect( Pi, Zero, XIsPositive ); + R2 = XMVectorAdd(R0, R1); + + Result = XMVectorSelect(Result, R2, ATanResultValid); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + static CONST XMVECTORF32 ATan2Constants = {XM_PI, XM_PIDIV2, XM_PIDIV4, XM_PI * 3.0f / 4.0f}; + + // Mask if Y>0 && Y!=INF + XMVECTOR YEqualsInfinity = XMVectorIsInfinite(Y); + // Get the sign of (Y&0x80000000) + XMVECTOR YSign = _mm_and_ps(Y, g_XMNegativeZero); + // Get the sign bits of X + XMVECTOR XIsPositive = _mm_and_ps(X,g_XMNegativeZero); + // Change them to masks + XIsPositive = XMVectorEqualInt(XIsPositive,g_XMZero); + // Get Pi + XMVECTOR Pi = _mm_load_ps1(&ATan2Constants.f[0]); + // Copy the sign of Y + Pi = _mm_or_ps(Pi,YSign); + XMVECTOR R1 = XMVectorSelect(Pi,YSign,XIsPositive); + // Mask for X==0 + XMVECTOR vConstants = _mm_cmpeq_ps(X,g_XMZero); + // Get Pi/2 with with sign of Y + XMVECTOR PiOverTwo = _mm_load_ps1(&ATan2Constants.f[1]); + PiOverTwo = _mm_or_ps(PiOverTwo,YSign); + XMVECTOR R2 = XMVectorSelect(g_XMNegOneMask,PiOverTwo,vConstants); + // Mask for Y==0 + vConstants = _mm_cmpeq_ps(Y,g_XMZero); + R2 = XMVectorSelect(R2,R1,vConstants); + // Get Pi/4 with sign of Y + XMVECTOR PiOverFour = _mm_load_ps1(&ATan2Constants.f[2]); + PiOverFour = _mm_or_ps(PiOverFour,YSign); + // Get (Pi*3)/4 with sign of Y + XMVECTOR ThreePiOverFour = _mm_load_ps1(&ATan2Constants.f[3]); + ThreePiOverFour = _mm_or_ps(ThreePiOverFour,YSign); + vConstants = XMVectorSelect(ThreePiOverFour, PiOverFour, XIsPositive); + XMVECTOR XEqualsInfinity = XMVectorIsInfinite(X); + vConstants = XMVectorSelect(PiOverTwo,vConstants,XEqualsInfinity); + + XMVECTOR vResult = XMVectorSelect(R2,vConstants,YEqualsInfinity); + vConstants = XMVectorSelect(R1,vResult,YEqualsInfinity); + // At this point, any entry that's zero will get the result + // from XMVectorATan(), otherwise, return the failsafe value + vResult = XMVectorSelect(vResult,vConstants,XEqualsInfinity); + // Any entries not 0xFFFFFFFF, are considered precalculated + XMVECTOR ATanResultValid = XMVectorEqualInt(vResult,g_XMNegOneMask); + // Let's do the ATan2 function + XMVECTOR Reciprocal = _mm_rcp_ps(X); + vConstants = _mm_mul_ps(Y, Reciprocal); + vConstants = XMVectorATanEst(vConstants); + // Discard entries that have been declared void + + XMVECTOR R3 = XMVectorSelect( Pi, g_XMZero, XIsPositive ); + vConstants = _mm_add_ps( vConstants, R3 ); + + vResult = XMVectorSelect(vResult,vConstants,ATanResultValid); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorLerp +( + FXMVECTOR V0, + FXMVECTOR V1, + FLOAT t +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Scale; + XMVECTOR Length; + XMVECTOR Result; + + // V0 + t * (V1 - V0) + Scale = XMVectorReplicate(t); + Length = XMVectorSubtract(V1, V0); + Result = XMVectorMultiplyAdd(Length, Scale, V0); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR L, S; + XMVECTOR Result; + + L = _mm_sub_ps( V1, V0 ); + + S = _mm_set_ps1( t ); + + Result = _mm_mul_ps( L, S ); + + return _mm_add_ps( Result, V0 ); +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorLerpV +( + FXMVECTOR V0, + FXMVECTOR V1, + FXMVECTOR T +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Length; + XMVECTOR Result; + + // V0 + T * (V1 - V0) + Length = XMVectorSubtract(V1, V0); + Result = XMVectorMultiplyAdd(Length, T, V0); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR Length; + XMVECTOR Result; + + Length = _mm_sub_ps( V1, V0 ); + + Result = _mm_mul_ps( Length, T ); + + return _mm_add_ps( Result, V0 ); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorHermite +( + FXMVECTOR Position0, + FXMVECTOR Tangent0, + FXMVECTOR Position1, + CXMVECTOR Tangent1, + FLOAT t +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR P0; + XMVECTOR T0; + XMVECTOR P1; + XMVECTOR T1; + XMVECTOR Result; + FLOAT t2; + FLOAT t3; + + // Result = (2 * t^3 - 3 * t^2 + 1) * Position0 + + // (t^3 - 2 * t^2 + t) * Tangent0 + + // (-2 * t^3 + 3 * t^2) * Position1 + + // (t^3 - t^2) * Tangent1 + t2 = t * t; + t3 = t * t2; + + P0 = XMVectorReplicate(2.0f * t3 - 3.0f * t2 + 1.0f); + T0 = XMVectorReplicate(t3 - 2.0f * t2 + t); + P1 = XMVectorReplicate(-2.0f * t3 + 3.0f * t2); + T1 = XMVectorReplicate(t3 - t2); + + Result = XMVectorMultiply(P0, Position0); + Result = XMVectorMultiplyAdd(T0, Tangent0, Result); + Result = XMVectorMultiplyAdd(P1, Position1, Result); + Result = XMVectorMultiplyAdd(T1, Tangent1, Result); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + FLOAT t2 = t * t; + FLOAT t3 = t * t2; + + XMVECTOR P0 = _mm_set_ps1(2.0f * t3 - 3.0f * t2 + 1.0f); + XMVECTOR T0 = _mm_set_ps1(t3 - 2.0f * t2 + t); + XMVECTOR P1 = _mm_set_ps1(-2.0f * t3 + 3.0f * t2); + XMVECTOR T1 = _mm_set_ps1(t3 - t2); + + XMVECTOR vResult = _mm_mul_ps(P0, Position0); + XMVECTOR vTemp = _mm_mul_ps(T0, Tangent0); + vResult = _mm_add_ps(vResult,vTemp); + vTemp = _mm_mul_ps(P1, Position1); + vResult = _mm_add_ps(vResult,vTemp); + vTemp = _mm_mul_ps(T1, Tangent1); + vResult = _mm_add_ps(vResult,vTemp); + return vResult; +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorHermiteV +( + FXMVECTOR Position0, + FXMVECTOR Tangent0, + FXMVECTOR Position1, + CXMVECTOR Tangent1, + CXMVECTOR T +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR P0; + XMVECTOR T0; + XMVECTOR P1; + XMVECTOR T1; + XMVECTOR Result; + XMVECTOR T2; + XMVECTOR T3; + + // Result = (2 * t^3 - 3 * t^2 + 1) * Position0 + + // (t^3 - 2 * t^2 + t) * Tangent0 + + // (-2 * t^3 + 3 * t^2) * Position1 + + // (t^3 - t^2) * Tangent1 + T2 = XMVectorMultiply(T, T); + T3 = XMVectorMultiply(T , T2); + + P0 = XMVectorReplicate(2.0f * T3.vector4_f32[0] - 3.0f * T2.vector4_f32[0] + 1.0f); + T0 = XMVectorReplicate(T3.vector4_f32[1] - 2.0f * T2.vector4_f32[1] + T.vector4_f32[1]); + P1 = XMVectorReplicate(-2.0f * T3.vector4_f32[2] + 3.0f * T2.vector4_f32[2]); + T1 = XMVectorReplicate(T3.vector4_f32[3] - T2.vector4_f32[3]); + + Result = XMVectorMultiply(P0, Position0); + Result = XMVectorMultiplyAdd(T0, Tangent0, Result); + Result = XMVectorMultiplyAdd(P1, Position1, Result); + Result = XMVectorMultiplyAdd(T1, Tangent1, Result); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + static const XMVECTORF32 CatMulT2 = {-3.0f,-2.0f,3.0f,-1.0f}; + static const XMVECTORF32 CatMulT3 = {2.0f,1.0f,-2.0f,1.0f}; + + // Result = (2 * t^3 - 3 * t^2 + 1) * Position0 + + // (t^3 - 2 * t^2 + t) * Tangent0 + + // (-2 * t^3 + 3 * t^2) * Position1 + + // (t^3 - t^2) * Tangent1 + XMVECTOR T2 = _mm_mul_ps(T,T); + XMVECTOR T3 = _mm_mul_ps(T,T2); + // Mul by the constants against t^2 + T2 = _mm_mul_ps(T2,CatMulT2); + // Mul by the constants against t^3 + T3 = _mm_mul_ps(T3,CatMulT3); + // T3 now has the pre-result. + T3 = _mm_add_ps(T3,T2); + // I need to add t.y only + T2 = _mm_and_ps(T,g_XMMaskY); + T3 = _mm_add_ps(T3,T2); + // Add 1.0f to x + T3 = _mm_add_ps(T3,g_XMIdentityR0); + // Now, I have the constants created + // Mul the x constant to Position0 + XMVECTOR vResult = _mm_shuffle_ps(T3,T3,_MM_SHUFFLE(0,0,0,0)); + vResult = _mm_mul_ps(vResult,Position0); + // Mul the y constant to Tangent0 + T2 = _mm_shuffle_ps(T3,T3,_MM_SHUFFLE(1,1,1,1)); + T2 = _mm_mul_ps(T2,Tangent0); + vResult = _mm_add_ps(vResult,T2); + // Mul the z constant to Position1 + T2 = _mm_shuffle_ps(T3,T3,_MM_SHUFFLE(2,2,2,2)); + T2 = _mm_mul_ps(T2,Position1); + vResult = _mm_add_ps(vResult,T2); + // Mul the w constant to Tangent1 + T3 = _mm_shuffle_ps(T3,T3,_MM_SHUFFLE(3,3,3,3)); + T3 = _mm_mul_ps(T3,Tangent1); + vResult = _mm_add_ps(vResult,T3); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorCatmullRom +( + FXMVECTOR Position0, + FXMVECTOR Position1, + FXMVECTOR Position2, + CXMVECTOR Position3, + FLOAT t +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR P0; + XMVECTOR P1; + XMVECTOR P2; + XMVECTOR P3; + XMVECTOR Result; + FLOAT t2; + FLOAT t3; + + // Result = ((-t^3 + 2 * t^2 - t) * Position0 + + // (3 * t^3 - 5 * t^2 + 2) * Position1 + + // (-3 * t^3 + 4 * t^2 + t) * Position2 + + // (t^3 - t^2) * Position3) * 0.5 + t2 = t * t; + t3 = t * t2; + + P0 = XMVectorReplicate((-t3 + 2.0f * t2 - t) * 0.5f); + P1 = XMVectorReplicate((3.0f * t3 - 5.0f * t2 + 2.0f) * 0.5f); + P2 = XMVectorReplicate((-3.0f * t3 + 4.0f * t2 + t) * 0.5f); + P3 = XMVectorReplicate((t3 - t2) * 0.5f); + + Result = XMVectorMultiply(P0, Position0); + Result = XMVectorMultiplyAdd(P1, Position1, Result); + Result = XMVectorMultiplyAdd(P2, Position2, Result); + Result = XMVectorMultiplyAdd(P3, Position3, Result); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + FLOAT t2 = t * t; + FLOAT t3 = t * t2; + + XMVECTOR P0 = _mm_set_ps1((-t3 + 2.0f * t2 - t) * 0.5f); + XMVECTOR P1 = _mm_set_ps1((3.0f * t3 - 5.0f * t2 + 2.0f) * 0.5f); + XMVECTOR P2 = _mm_set_ps1((-3.0f * t3 + 4.0f * t2 + t) * 0.5f); + XMVECTOR P3 = _mm_set_ps1((t3 - t2) * 0.5f); + + P0 = _mm_mul_ps(P0, Position0); + P1 = _mm_mul_ps(P1, Position1); + P2 = _mm_mul_ps(P2, Position2); + P3 = _mm_mul_ps(P3, Position3); + P0 = _mm_add_ps(P0,P1); + P2 = _mm_add_ps(P2,P3); + P0 = _mm_add_ps(P0,P2); + return P0; +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorCatmullRomV +( + FXMVECTOR Position0, + FXMVECTOR Position1, + FXMVECTOR Position2, + CXMVECTOR Position3, + CXMVECTOR T +) +{ +#if defined(_XM_NO_INTRINSICS_) + float fx = T.vector4_f32[0]; + float fy = T.vector4_f32[1]; + float fz = T.vector4_f32[2]; + float fw = T.vector4_f32[3]; + XMVECTOR vResult = { + 0.5f*((-fx*fx*fx+2*fx*fx-fx)*Position0.vector4_f32[0]+ + (3*fx*fx*fx-5*fx*fx+2)*Position1.vector4_f32[0]+ + (-3*fx*fx*fx+4*fx*fx+fx)*Position2.vector4_f32[0]+ + (fx*fx*fx-fx*fx)*Position3.vector4_f32[0]), + 0.5f*((-fy*fy*fy+2*fy*fy-fy)*Position0.vector4_f32[1]+ + (3*fy*fy*fy-5*fy*fy+2)*Position1.vector4_f32[1]+ + (-3*fy*fy*fy+4*fy*fy+fy)*Position2.vector4_f32[1]+ + (fy*fy*fy-fy*fy)*Position3.vector4_f32[1]), + 0.5f*((-fz*fz*fz+2*fz*fz-fz)*Position0.vector4_f32[2]+ + (3*fz*fz*fz-5*fz*fz+2)*Position1.vector4_f32[2]+ + (-3*fz*fz*fz+4*fz*fz+fz)*Position2.vector4_f32[2]+ + (fz*fz*fz-fz*fz)*Position3.vector4_f32[2]), + 0.5f*((-fw*fw*fw+2*fw*fw-fw)*Position0.vector4_f32[3]+ + (3*fw*fw*fw-5*fw*fw+2)*Position1.vector4_f32[3]+ + (-3*fw*fw*fw+4*fw*fw+fw)*Position2.vector4_f32[3]+ + (fw*fw*fw-fw*fw)*Position3.vector4_f32[3]) + }; + return vResult; +#elif defined(_XM_SSE_INTRINSICS_) + static const XMVECTORF32 Catmul2 = {2.0f,2.0f,2.0f,2.0f}; + static const XMVECTORF32 Catmul3 = {3.0f,3.0f,3.0f,3.0f}; + static const XMVECTORF32 Catmul4 = {4.0f,4.0f,4.0f,4.0f}; + static const XMVECTORF32 Catmul5 = {5.0f,5.0f,5.0f,5.0f}; + // Cache T^2 and T^3 + XMVECTOR T2 = _mm_mul_ps(T,T); + XMVECTOR T3 = _mm_mul_ps(T,T2); + // Perform the Position0 term + XMVECTOR vResult = _mm_add_ps(T2,T2); + vResult = _mm_sub_ps(vResult,T); + vResult = _mm_sub_ps(vResult,T3); + vResult = _mm_mul_ps(vResult,Position0); + // Perform the Position1 term and add + XMVECTOR vTemp = _mm_mul_ps(T3,Catmul3); + XMVECTOR vTemp2 = _mm_mul_ps(T2,Catmul5); + vTemp = _mm_sub_ps(vTemp,vTemp2); + vTemp = _mm_add_ps(vTemp,Catmul2); + vTemp = _mm_mul_ps(vTemp,Position1); + vResult = _mm_add_ps(vResult,vTemp); + // Perform the Position2 term and add + vTemp = _mm_mul_ps(T2,Catmul4); + vTemp2 = _mm_mul_ps(T3,Catmul3); + vTemp = _mm_sub_ps(vTemp,vTemp2); + vTemp = _mm_add_ps(vTemp,T); + vTemp = _mm_mul_ps(vTemp,Position2); + vResult = _mm_add_ps(vResult,vTemp); + // Position3 is the last term + T3 = _mm_sub_ps(T3,T2); + T3 = _mm_mul_ps(T3,Position3); + vResult = _mm_add_ps(vResult,T3); + // Multiply by 0.5f and exit + vResult = _mm_mul_ps(vResult,g_XMOneHalf); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorBaryCentric +( + FXMVECTOR Position0, + FXMVECTOR Position1, + FXMVECTOR Position2, + FLOAT f, + FLOAT g +) +{ +#if defined(_XM_NO_INTRINSICS_) + + // Result = Position0 + f * (Position1 - Position0) + g * (Position2 - Position0) + XMVECTOR P10; + XMVECTOR P20; + XMVECTOR ScaleF; + XMVECTOR ScaleG; + XMVECTOR Result; + + P10 = XMVectorSubtract(Position1, Position0); + ScaleF = XMVectorReplicate(f); + + P20 = XMVectorSubtract(Position2, Position0); + ScaleG = XMVectorReplicate(g); + + Result = XMVectorMultiplyAdd(P10, ScaleF, Position0); + Result = XMVectorMultiplyAdd(P20, ScaleG, Result); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR R1 = _mm_sub_ps(Position1,Position0); + XMVECTOR SF = _mm_set_ps1(f); + XMVECTOR R2 = _mm_sub_ps(Position2,Position0); + XMVECTOR SG = _mm_set_ps1(g); + R1 = _mm_mul_ps(R1,SF); + R2 = _mm_mul_ps(R2,SG); + R1 = _mm_add_ps(R1,Position0); + R1 = _mm_add_ps(R1,R2); + return R1; +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVectorBaryCentricV +( + FXMVECTOR Position0, + FXMVECTOR Position1, + FXMVECTOR Position2, + CXMVECTOR F, + CXMVECTOR G +) +{ +#if defined(_XM_NO_INTRINSICS_) + + // Result = Position0 + f * (Position1 - Position0) + g * (Position2 - Position0) + XMVECTOR P10; + XMVECTOR P20; + XMVECTOR Result; + + P10 = XMVectorSubtract(Position1, Position0); + P20 = XMVectorSubtract(Position2, Position0); + + Result = XMVectorMultiplyAdd(P10, F, Position0); + Result = XMVectorMultiplyAdd(P20, G, Result); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR R1 = _mm_sub_ps(Position1,Position0); + XMVECTOR R2 = _mm_sub_ps(Position2,Position0); + R1 = _mm_mul_ps(R1,F); + R2 = _mm_mul_ps(R2,G); + R1 = _mm_add_ps(R1,Position0); + R1 = _mm_add_ps(R1,R2); + return R1; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +/**************************************************************************** + * + * 2D Vector + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ +// Comparison operations +//------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------ + +XMFINLINE BOOL XMVector2Equal +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + return (((V1.vector4_f32[0] == V2.vector4_f32[0]) && (V1.vector4_f32[1] == V2.vector4_f32[1])) != 0); +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vTemp = _mm_cmpeq_ps(V1,V2); +// z and w are don't care + return (((_mm_movemask_ps(vTemp)&3)==3) != 0); +#else // _XM_VMX128_INTRINSICS_ + return XMComparisonAllTrue(XMVector2EqualR(V1, V2)); +#endif +} + + +//------------------------------------------------------------------------------ + +XMFINLINE UINT XMVector2EqualR +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + + UINT CR = 0; + + if ((V1.vector4_f32[0] == V2.vector4_f32[0]) && + (V1.vector4_f32[1] == V2.vector4_f32[1])) + { + CR = XM_CRMASK_CR6TRUE; + } + else if ((V1.vector4_f32[0] != V2.vector4_f32[0]) && + (V1.vector4_f32[1] != V2.vector4_f32[1])) + { + CR = XM_CRMASK_CR6FALSE; + } + return CR; +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vTemp = _mm_cmpeq_ps(V1,V2); +// z and w are don't care + int iTest = _mm_movemask_ps(vTemp)&3; + UINT CR = 0; + if (iTest==3) + { + CR = XM_CRMASK_CR6TRUE; + } + else if (!iTest) + { + CR = XM_CRMASK_CR6FALSE; + } + return CR; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE BOOL XMVector2EqualInt +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + return (((V1.vector4_u32[0] == V2.vector4_u32[0]) && (V1.vector4_u32[1] == V2.vector4_u32[1])) != 0); +#elif defined(_XM_SSE_INTRINSICS_) + __m128i vTemp = _mm_cmpeq_epi32(reinterpret_cast(&V1)[0],reinterpret_cast(&V2)[0]); + return (((_mm_movemask_ps(reinterpret_cast(&vTemp)[0])&3)==3) != 0); +#else // _XM_VMX128_INTRINSICS_ + return XMComparisonAllTrue(XMVector2EqualIntR(V1, V2)); +#endif +} + +//------------------------------------------------------------------------------ + +XMFINLINE UINT XMVector2EqualIntR +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + + UINT CR = 0; + if ((V1.vector4_u32[0] == V2.vector4_u32[0]) && + (V1.vector4_u32[1] == V2.vector4_u32[1])) + { + CR = XM_CRMASK_CR6TRUE; + } + else if ((V1.vector4_u32[0] != V2.vector4_u32[0]) && + (V1.vector4_u32[1] != V2.vector4_u32[1])) + { + CR = XM_CRMASK_CR6FALSE; + } + return CR; + +#elif defined(_XM_SSE_INTRINSICS_) + __m128i vTemp = _mm_cmpeq_epi32(reinterpret_cast(&V1)[0],reinterpret_cast(&V2)[0]); + int iTest = _mm_movemask_ps(reinterpret_cast(&vTemp)[0])&3; + UINT CR = 0; + if (iTest==3) + { + CR = XM_CRMASK_CR6TRUE; + } + else if (!iTest) + { + CR = XM_CRMASK_CR6FALSE; + } + return CR; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE BOOL XMVector2NearEqual +( + FXMVECTOR V1, + FXMVECTOR V2, + FXMVECTOR Epsilon +) +{ +#if defined(_XM_NO_INTRINSICS_) + FLOAT dx, dy; + dx = fabsf(V1.vector4_f32[0]-V2.vector4_f32[0]); + dy = fabsf(V1.vector4_f32[1]-V2.vector4_f32[1]); + return ((dx <= Epsilon.vector4_f32[0]) && + (dy <= Epsilon.vector4_f32[1])); +#elif defined(_XM_SSE_INTRINSICS_) + // Get the difference + XMVECTOR vDelta = _mm_sub_ps(V1,V2); + // Get the absolute value of the difference + XMVECTOR vTemp = _mm_setzero_ps(); + vTemp = _mm_sub_ps(vTemp,vDelta); + vTemp = _mm_max_ps(vTemp,vDelta); + vTemp = _mm_cmple_ps(vTemp,Epsilon); + // z and w are don't care + return (((_mm_movemask_ps(vTemp)&3)==0x3) != 0); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE BOOL XMVector2NotEqual +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + return (((V1.vector4_f32[0] != V2.vector4_f32[0]) || (V1.vector4_f32[1] != V2.vector4_f32[1])) != 0); +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vTemp = _mm_cmpeq_ps(V1,V2); +// z and w are don't care + return (((_mm_movemask_ps(vTemp)&3)!=3) != 0); +#else // _XM_VMX128_INTRINSICS_ + return XMComparisonAnyFalse(XMVector2EqualR(V1, V2)); +#endif +} + +//------------------------------------------------------------------------------ + +XMFINLINE BOOL XMVector2NotEqualInt +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + return (((V1.vector4_u32[0] != V2.vector4_u32[0]) || (V1.vector4_u32[1] != V2.vector4_u32[1])) != 0); +#elif defined(_XM_SSE_INTRINSICS_) + __m128i vTemp = _mm_cmpeq_epi32(reinterpret_cast(&V1)[0],reinterpret_cast(&V2)[0]); + return (((_mm_movemask_ps(reinterpret_cast(&vTemp)[0])&3)!=3) != 0); +#else // _XM_VMX128_INTRINSICS_ + return XMComparisonAnyFalse(XMVector2EqualIntR(V1, V2)); +#endif +} + +//------------------------------------------------------------------------------ + +XMFINLINE BOOL XMVector2Greater +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + return (((V1.vector4_f32[0] > V2.vector4_f32[0]) && (V1.vector4_f32[1] > V2.vector4_f32[1])) != 0); + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vTemp = _mm_cmpgt_ps(V1,V2); +// z and w are don't care + return (((_mm_movemask_ps(vTemp)&3)==3) != 0); +#else // _XM_VMX128_INTRINSICS_ + return XMComparisonAllTrue(XMVector2GreaterR(V1, V2)); +#endif +} + +//------------------------------------------------------------------------------ + +XMFINLINE UINT XMVector2GreaterR +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + + UINT CR = 0; + if ((V1.vector4_f32[0] > V2.vector4_f32[0]) && + (V1.vector4_f32[1] > V2.vector4_f32[1])) + { + CR = XM_CRMASK_CR6TRUE; + } + else if ((V1.vector4_f32[0] <= V2.vector4_f32[0]) && + (V1.vector4_f32[1] <= V2.vector4_f32[1])) + { + CR = XM_CRMASK_CR6FALSE; + } + return CR; +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vTemp = _mm_cmpgt_ps(V1,V2); + int iTest = _mm_movemask_ps(vTemp)&3; + UINT CR = 0; + if (iTest==3) + { + CR = XM_CRMASK_CR6TRUE; + } + else if (!iTest) + { + CR = XM_CRMASK_CR6FALSE; + } + return CR; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE BOOL XMVector2GreaterOrEqual +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + return (((V1.vector4_f32[0] >= V2.vector4_f32[0]) && (V1.vector4_f32[1] >= V2.vector4_f32[1])) != 0); +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vTemp = _mm_cmpge_ps(V1,V2); + return (((_mm_movemask_ps(vTemp)&3)==3) != 0); +#else // _XM_VMX128_INTRINSICS_ + return XMComparisonAllTrue(XMVector2GreaterOrEqualR(V1, V2)); +#endif +} + +//------------------------------------------------------------------------------ + +XMFINLINE UINT XMVector2GreaterOrEqualR +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + UINT CR = 0; + if ((V1.vector4_f32[0] >= V2.vector4_f32[0]) && + (V1.vector4_f32[1] >= V2.vector4_f32[1])) + { + CR = XM_CRMASK_CR6TRUE; + } + else if ((V1.vector4_f32[0] < V2.vector4_f32[0]) && + (V1.vector4_f32[1] < V2.vector4_f32[1])) + { + CR = XM_CRMASK_CR6FALSE; + } + return CR; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vTemp = _mm_cmpge_ps(V1,V2); + int iTest = _mm_movemask_ps(vTemp)&3; + UINT CR = 0; + if (iTest == 3) + { + CR = XM_CRMASK_CR6TRUE; + } + else if (!iTest) + { + CR = XM_CRMASK_CR6FALSE; + } + return CR; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE BOOL XMVector2Less +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + return (((V1.vector4_f32[0] < V2.vector4_f32[0]) && (V1.vector4_f32[1] < V2.vector4_f32[1])) != 0); +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vTemp = _mm_cmplt_ps(V1,V2); + return (((_mm_movemask_ps(vTemp)&3)==3) != 0); +#else // _XM_VMX128_INTRINSICS_ + return XMComparisonAllTrue(XMVector2GreaterR(V2, V1)); +#endif +} + +//------------------------------------------------------------------------------ + +XMFINLINE BOOL XMVector2LessOrEqual +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + return (((V1.vector4_f32[0] <= V2.vector4_f32[0]) && (V1.vector4_f32[1] <= V2.vector4_f32[1])) != 0); +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vTemp = _mm_cmple_ps(V1,V2); + return (((_mm_movemask_ps(vTemp)&3)==3) != 0); +#else // _XM_VMX128_INTRINSICS_ + return XMComparisonAllTrue(XMVector2GreaterOrEqualR(V2, V1)); +#endif +} + +//------------------------------------------------------------------------------ + +XMFINLINE BOOL XMVector2InBounds +( + FXMVECTOR V, + FXMVECTOR Bounds +) +{ + #if defined(_XM_NO_INTRINSICS_) + return (((V.vector4_f32[0] <= Bounds.vector4_f32[0] && V.vector4_f32[0] >= -Bounds.vector4_f32[0]) && + (V.vector4_f32[1] <= Bounds.vector4_f32[1] && V.vector4_f32[1] >= -Bounds.vector4_f32[1])) != 0); + #elif defined(_XM_SSE_INTRINSICS_) + // Test if less than or equal + XMVECTOR vTemp1 = _mm_cmple_ps(V,Bounds); + // Negate the bounds + XMVECTOR vTemp2 = _mm_mul_ps(Bounds,g_XMNegativeOne); + // Test if greater or equal (Reversed) + vTemp2 = _mm_cmple_ps(vTemp2,V); + // Blend answers + vTemp1 = _mm_and_ps(vTemp1,vTemp2); + // x and y in bounds? (z and w are don't care) + return (((_mm_movemask_ps(vTemp1)&0x3)==0x3) != 0); +#else // _XM_VMX128_INTRINSICS_ + return XMComparisonAllInBounds(XMVector2InBoundsR(V, Bounds)); +#endif +} + +//------------------------------------------------------------------------------ + +XMFINLINE UINT XMVector2InBoundsR +( + FXMVECTOR V, + FXMVECTOR Bounds +) +{ +#if defined(_XM_NO_INTRINSICS_) + UINT CR = 0; + if ((V.vector4_f32[0] <= Bounds.vector4_f32[0] && V.vector4_f32[0] >= -Bounds.vector4_f32[0]) && + (V.vector4_f32[1] <= Bounds.vector4_f32[1] && V.vector4_f32[1] >= -Bounds.vector4_f32[1])) + { + CR = XM_CRMASK_CR6BOUNDS; + } + return CR; + +#elif defined(_XM_SSE_INTRINSICS_) + // Test if less than or equal + XMVECTOR vTemp1 = _mm_cmple_ps(V,Bounds); + // Negate the bounds + XMVECTOR vTemp2 = _mm_mul_ps(Bounds,g_XMNegativeOne); + // Test if greater or equal (Reversed) + vTemp2 = _mm_cmple_ps(vTemp2,V); + // Blend answers + vTemp1 = _mm_and_ps(vTemp1,vTemp2); + // x and y in bounds? (z and w are don't care) + return ((_mm_movemask_ps(vTemp1)&0x3)==0x3) ? XM_CRMASK_CR6BOUNDS : 0; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE BOOL XMVector2IsNaN +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + return (XMISNAN(V.vector4_f32[0]) || + XMISNAN(V.vector4_f32[1])); +#elif defined(_XM_SSE_INTRINSICS_) + // Mask off the exponent + __m128i vTempInf = _mm_and_si128(reinterpret_cast(&V)[0],g_XMInfinity); + // Mask off the mantissa + __m128i vTempNan = _mm_and_si128(reinterpret_cast(&V)[0],g_XMQNaNTest); + // Are any of the exponents == 0x7F800000? + vTempInf = _mm_cmpeq_epi32(vTempInf,g_XMInfinity); + // Are any of the mantissa's zero? (SSE2 doesn't have a neq test) + vTempNan = _mm_cmpeq_epi32(vTempNan,g_XMZero); + // Perform a not on the NaN test to be true on NON-zero mantissas + vTempNan = _mm_andnot_si128(vTempNan,vTempInf); + // If x or y are NaN, the signs are true after the merge above + return ((_mm_movemask_ps(reinterpret_cast(&vTempNan)[0])&3) != 0); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE BOOL XMVector2IsInfinite +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + return (XMISINF(V.vector4_f32[0]) || + XMISINF(V.vector4_f32[1])); +#elif defined(_XM_SSE_INTRINSICS_) + // Mask off the sign bit + __m128 vTemp = _mm_and_ps(V,g_XMAbsMask); + // Compare to infinity + vTemp = _mm_cmpeq_ps(vTemp,g_XMInfinity); + // If x or z are infinity, the signs are true. + return ((_mm_movemask_ps(vTemp)&3) != 0); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ +// Computation operations +//------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector2Dot +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Result; + + Result.vector4_f32[0] = + Result.vector4_f32[1] = + Result.vector4_f32[2] = + Result.vector4_f32[3] = V1.vector4_f32[0] * V2.vector4_f32[0] + V1.vector4_f32[1] * V2.vector4_f32[1]; + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + // Perform the dot product on x and y + XMVECTOR vLengthSq = _mm_mul_ps(V1,V2); + // vTemp has y splatted + XMVECTOR vTemp = _mm_shuffle_ps(vLengthSq,vLengthSq,_MM_SHUFFLE(1,1,1,1)); + // x+y + vLengthSq = _mm_add_ss(vLengthSq,vTemp); + vLengthSq = _mm_shuffle_ps(vLengthSq,vLengthSq,_MM_SHUFFLE(0,0,0,0)); + return vLengthSq; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector2Cross +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + FLOAT fCross = (V1.vector4_f32[0] * V2.vector4_f32[1]) - (V1.vector4_f32[1] * V2.vector4_f32[0]); + XMVECTOR vResult = { + fCross, + fCross, + fCross, + fCross + }; + return vResult; +#elif defined(_XM_SSE_INTRINSICS_) + // Swap x and y + XMVECTOR vResult = _mm_shuffle_ps(V2,V2,_MM_SHUFFLE(0,1,0,1)); + // Perform the muls + vResult = _mm_mul_ps(vResult,V1); + // Splat y + XMVECTOR vTemp = _mm_shuffle_ps(vResult,vResult,_MM_SHUFFLE(1,1,1,1)); + // Sub the values + vResult = _mm_sub_ss(vResult,vTemp); + // Splat the cross product + vResult = _mm_shuffle_ps(vResult,vResult,_MM_SHUFFLE(0,0,0,0)); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector2LengthSq +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + return XMVector2Dot(V, V); +#elif defined(_XM_SSE_INTRINSICS_) + // Perform the dot product on x and y + XMVECTOR vLengthSq = _mm_mul_ps(V,V); + // vTemp has y splatted + XMVECTOR vTemp = _mm_shuffle_ps(vLengthSq,vLengthSq,_MM_SHUFFLE(1,1,1,1)); + // x+y + vLengthSq = _mm_add_ss(vLengthSq,vTemp); + vLengthSq = _mm_shuffle_ps(vLengthSq,vLengthSq,_MM_SHUFFLE(0,0,0,0)); + return vLengthSq; +#else + return XMVector2Dot(V, V); +#endif +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector2ReciprocalLengthEst +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Result; + + Result = XMVector2LengthSq(V); + Result = XMVectorReciprocalSqrtEst(Result); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + // Perform the dot product on x and y + XMVECTOR vLengthSq = _mm_mul_ps(V,V); + // vTemp has y splatted + XMVECTOR vTemp = _mm_shuffle_ps(vLengthSq,vLengthSq,_MM_SHUFFLE(1,1,1,1)); + // x+y + vLengthSq = _mm_add_ss(vLengthSq,vTemp); + vLengthSq = _mm_rsqrt_ss(vLengthSq); + vLengthSq = _mm_shuffle_ps(vLengthSq,vLengthSq,_MM_SHUFFLE(0,0,0,0)); + return vLengthSq; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector2ReciprocalLength +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Result; + + Result = XMVector2LengthSq(V); + Result = XMVectorReciprocalSqrt(Result); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + // Perform the dot product on x and y + XMVECTOR vLengthSq = _mm_mul_ps(V,V); + // vTemp has y splatted + XMVECTOR vTemp = _mm_shuffle_ps(vLengthSq,vLengthSq,_MM_SHUFFLE(1,1,1,1)); + // x+y + vLengthSq = _mm_add_ss(vLengthSq,vTemp); + vLengthSq = _mm_sqrt_ss(vLengthSq); + vLengthSq = _mm_div_ss(g_XMOne,vLengthSq); + vLengthSq = _mm_shuffle_ps(vLengthSq,vLengthSq,_MM_SHUFFLE(0,0,0,0)); + return vLengthSq; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector2LengthEst +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + XMVECTOR Result; + Result = XMVector2LengthSq(V); + Result = XMVectorSqrtEst(Result); + return Result; +#elif defined(_XM_SSE_INTRINSICS_) + // Perform the dot product on x and y + XMVECTOR vLengthSq = _mm_mul_ps(V,V); + // vTemp has y splatted + XMVECTOR vTemp = _mm_shuffle_ps(vLengthSq,vLengthSq,_MM_SHUFFLE(1,1,1,1)); + // x+y + vLengthSq = _mm_add_ss(vLengthSq,vTemp); + vLengthSq = _mm_sqrt_ss(vLengthSq); + vLengthSq = _mm_shuffle_ps(vLengthSq,vLengthSq,_MM_SHUFFLE(0,0,0,0)); + return vLengthSq; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector2Length +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Result; + Result = XMVector2LengthSq(V); + Result = XMVectorSqrt(Result); + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + // Perform the dot product on x and y + XMVECTOR vLengthSq = _mm_mul_ps(V,V); + // vTemp has y splatted + XMVECTOR vTemp = _mm_shuffle_ps(vLengthSq,vLengthSq,_MM_SHUFFLE(1,1,1,1)); + // x+y + vLengthSq = _mm_add_ss(vLengthSq,vTemp); + vLengthSq = _mm_shuffle_ps(vLengthSq,vLengthSq,_MM_SHUFFLE(0,0,0,0)); + vLengthSq = _mm_sqrt_ps(vLengthSq); + return vLengthSq; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ +// XMVector2NormalizeEst uses a reciprocal estimate and +// returns QNaN on zero and infinite vectors. + +XMFINLINE XMVECTOR XMVector2NormalizeEst +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Result; + Result = XMVector2ReciprocalLength(V); + Result = XMVectorMultiply(V, Result); + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + // Perform the dot product on x and y + XMVECTOR vLengthSq = _mm_mul_ps(V,V); + // vTemp has y splatted + XMVECTOR vTemp = _mm_shuffle_ps(vLengthSq,vLengthSq,_MM_SHUFFLE(1,1,1,1)); + // x+y + vLengthSq = _mm_add_ss(vLengthSq,vTemp); + vLengthSq = _mm_rsqrt_ss(vLengthSq); + vLengthSq = _mm_shuffle_ps(vLengthSq,vLengthSq,_MM_SHUFFLE(0,0,0,0)); + vLengthSq = _mm_mul_ps(vLengthSq,V); + return vLengthSq; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector2Normalize +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + FLOAT fLength; + XMVECTOR vResult; + + vResult = XMVector2Length( V ); + fLength = vResult.vector4_f32[0]; + + // Prevent divide by zero + if (fLength > 0) { + fLength = 1.0f/fLength; + } + + vResult.vector4_f32[0] = V.vector4_f32[0]*fLength; + vResult.vector4_f32[1] = V.vector4_f32[1]*fLength; + vResult.vector4_f32[2] = V.vector4_f32[2]*fLength; + vResult.vector4_f32[3] = V.vector4_f32[3]*fLength; + return vResult; + +#elif defined(_XM_SSE_INTRINSICS_) + // Perform the dot product on x and y only + XMVECTOR vLengthSq = _mm_mul_ps(V,V); + XMVECTOR vTemp = _mm_shuffle_ps(vLengthSq,vLengthSq,_MM_SHUFFLE(1,1,1,1)); + vLengthSq = _mm_add_ss(vLengthSq,vTemp); + vLengthSq = _mm_shuffle_ps(vLengthSq,vLengthSq,_MM_SHUFFLE(0,0,0,0)); + // Prepare for the division + XMVECTOR vResult = _mm_sqrt_ps(vLengthSq); + // Create zero with a single instruction + XMVECTOR vZeroMask = _mm_setzero_ps(); + // Test for a divide by zero (Must be FP to detect -0.0) + vZeroMask = _mm_cmpneq_ps(vZeroMask,vResult); + // Failsafe on zero (Or epsilon) length planes + // If the length is infinity, set the elements to zero + vLengthSq = _mm_cmpneq_ps(vLengthSq,g_XMInfinity); + // Reciprocal mul to perform the normalization + vResult = _mm_div_ps(V,vResult); + // Any that are infinity, set to zero + vResult = _mm_and_ps(vResult,vZeroMask); + // Select qnan or result based on infinite length + XMVECTOR vTemp1 = _mm_andnot_ps(vLengthSq,g_XMQNaN); + XMVECTOR vTemp2 = _mm_and_ps(vResult,vLengthSq); + vResult = _mm_or_ps(vTemp1,vTemp2); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector2ClampLength +( + FXMVECTOR V, + FLOAT LengthMin, + FLOAT LengthMax +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR ClampMax; + XMVECTOR ClampMin; + + ClampMax = XMVectorReplicate(LengthMax); + ClampMin = XMVectorReplicate(LengthMin); + + return XMVector2ClampLengthV(V, ClampMin, ClampMax); + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR ClampMax = _mm_set_ps1(LengthMax); + XMVECTOR ClampMin = _mm_set_ps1(LengthMin); + return XMVector2ClampLengthV(V, ClampMin, ClampMax); +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector2ClampLengthV +( + FXMVECTOR V, + FXMVECTOR LengthMin, + FXMVECTOR LengthMax +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR ClampLength; + XMVECTOR LengthSq; + XMVECTOR RcpLength; + XMVECTOR Length; + XMVECTOR Normal; + XMVECTOR Zero; + XMVECTOR InfiniteLength; + XMVECTOR ZeroLength; + XMVECTOR Select; + XMVECTOR ControlMax; + XMVECTOR ControlMin; + XMVECTOR Control; + XMVECTOR Result; + + XMASSERT((LengthMin.vector4_f32[1] == LengthMin.vector4_f32[0])); + XMASSERT((LengthMax.vector4_f32[1] == LengthMax.vector4_f32[0])); + XMASSERT(XMVector2GreaterOrEqual(LengthMin, XMVectorZero())); + XMASSERT(XMVector2GreaterOrEqual(LengthMax, XMVectorZero())); + XMASSERT(XMVector2GreaterOrEqual(LengthMax, LengthMin)); + + LengthSq = XMVector2LengthSq(V); + + Zero = XMVectorZero(); + + RcpLength = XMVectorReciprocalSqrt(LengthSq); + + InfiniteLength = XMVectorEqualInt(LengthSq, g_XMInfinity.v); + ZeroLength = XMVectorEqual(LengthSq, Zero); + + Length = XMVectorMultiply(LengthSq, RcpLength); + + Normal = XMVectorMultiply(V, RcpLength); + + Select = XMVectorEqualInt(InfiniteLength, ZeroLength); + Length = XMVectorSelect(LengthSq, Length, Select); + Normal = XMVectorSelect(LengthSq, Normal, Select); + + ControlMax = XMVectorGreater(Length, LengthMax); + ControlMin = XMVectorLess(Length, LengthMin); + + ClampLength = XMVectorSelect(Length, LengthMax, ControlMax); + ClampLength = XMVectorSelect(ClampLength, LengthMin, ControlMin); + + Result = XMVectorMultiply(Normal, ClampLength); + + // Preserve the original vector (with no precision loss) if the length falls within the given range + Control = XMVectorEqualInt(ControlMax, ControlMin); + Result = XMVectorSelect(Result, V, Control); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR ClampLength; + XMVECTOR LengthSq; + XMVECTOR RcpLength; + XMVECTOR Length; + XMVECTOR Normal; + XMVECTOR InfiniteLength; + XMVECTOR ZeroLength; + XMVECTOR Select; + XMVECTOR ControlMax; + XMVECTOR ControlMin; + XMVECTOR Control; + XMVECTOR Result; + + XMASSERT((XMVectorGetY(LengthMin) == XMVectorGetX(LengthMin))); + XMASSERT((XMVectorGetY(LengthMax) == XMVectorGetX(LengthMax))); + XMASSERT(XMVector2GreaterOrEqual(LengthMin, g_XMZero)); + XMASSERT(XMVector2GreaterOrEqual(LengthMax, g_XMZero)); + XMASSERT(XMVector2GreaterOrEqual(LengthMax, LengthMin)); + LengthSq = XMVector2LengthSq(V); + RcpLength = XMVectorReciprocalSqrt(LengthSq); + InfiniteLength = XMVectorEqualInt(LengthSq, g_XMInfinity); + ZeroLength = XMVectorEqual(LengthSq, g_XMZero); + Length = _mm_mul_ps(LengthSq, RcpLength); + Normal = _mm_mul_ps(V, RcpLength); + Select = XMVectorEqualInt(InfiniteLength, ZeroLength); + Length = XMVectorSelect(LengthSq, Length, Select); + Normal = XMVectorSelect(LengthSq, Normal, Select); + ControlMax = XMVectorGreater(Length, LengthMax); + ControlMin = XMVectorLess(Length, LengthMin); + ClampLength = XMVectorSelect(Length, LengthMax, ControlMax); + ClampLength = XMVectorSelect(ClampLength, LengthMin, ControlMin); + Result = _mm_mul_ps(Normal, ClampLength); + // Preserve the original vector (with no precision loss) if the length falls within the given range + Control = XMVectorEqualInt(ControlMax, ControlMin); + Result = XMVectorSelect(Result, V, Control); + return Result; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector2Reflect +( + FXMVECTOR Incident, + FXMVECTOR Normal +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Result; + + // Result = Incident - (2 * dot(Incident, Normal)) * Normal + Result = XMVector2Dot(Incident, Normal); + Result = XMVectorAdd(Result, Result); + Result = XMVectorNegativeMultiplySubtract(Result, Normal, Incident); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + // Result = Incident - (2 * dot(Incident, Normal)) * Normal + XMVECTOR Result = XMVector2Dot(Incident,Normal); + Result = _mm_add_ps(Result, Result); + Result = _mm_mul_ps(Result, Normal); + Result = _mm_sub_ps(Incident,Result); + return Result; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector2Refract +( + FXMVECTOR Incident, + FXMVECTOR Normal, + FLOAT RefractionIndex +) +{ +#if defined(_XM_NO_INTRINSICS_) + XMVECTOR Index; + Index = XMVectorReplicate(RefractionIndex); + return XMVector2RefractV(Incident, Normal, Index); + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR Index = _mm_set_ps1(RefractionIndex); + return XMVector2RefractV(Incident,Normal,Index); +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +// Return the refraction of a 2D vector +XMFINLINE XMVECTOR XMVector2RefractV +( + FXMVECTOR Incident, + FXMVECTOR Normal, + FXMVECTOR RefractionIndex +) +{ +#if defined(_XM_NO_INTRINSICS_) + float IDotN; + float RX,RY; + XMVECTOR vResult; + // Result = RefractionIndex * Incident - Normal * (RefractionIndex * dot(Incident, Normal) + + // sqrt(1 - RefractionIndex * RefractionIndex * (1 - dot(Incident, Normal) * dot(Incident, Normal)))) + IDotN = (Incident.vector4_f32[0]*Normal.vector4_f32[0])+(Incident.vector4_f32[1]*Normal.vector4_f32[1]); + // R = 1.0f - RefractionIndex * RefractionIndex * (1.0f - IDotN * IDotN) + RY = 1.0f-(IDotN*IDotN); + RX = 1.0f-(RY*RefractionIndex.vector4_f32[0]*RefractionIndex.vector4_f32[0]); + RY = 1.0f-(RY*RefractionIndex.vector4_f32[1]*RefractionIndex.vector4_f32[1]); + if (RX>=0.0f) { + RX = (RefractionIndex.vector4_f32[0]*Incident.vector4_f32[0])-(Normal.vector4_f32[0]*((RefractionIndex.vector4_f32[0]*IDotN)+sqrtf(RX))); + } else { + RX = 0.0f; + } + if (RY>=0.0f) { + RY = (RefractionIndex.vector4_f32[1]*Incident.vector4_f32[1])-(Normal.vector4_f32[1]*((RefractionIndex.vector4_f32[1]*IDotN)+sqrtf(RY))); + } else { + RY = 0.0f; + } + vResult.vector4_f32[0] = RX; + vResult.vector4_f32[1] = RY; + vResult.vector4_f32[2] = 0.0f; + vResult.vector4_f32[3] = 0.0f; + return vResult; +#elif defined(_XM_SSE_INTRINSICS_) + // Result = RefractionIndex * Incident - Normal * (RefractionIndex * dot(Incident, Normal) + + // sqrt(1 - RefractionIndex * RefractionIndex * (1 - dot(Incident, Normal) * dot(Incident, Normal)))) + // Get the 2D Dot product of Incident-Normal + XMVECTOR IDotN = _mm_mul_ps(Incident,Normal); + XMVECTOR vTemp = _mm_shuffle_ps(IDotN,IDotN,_MM_SHUFFLE(1,1,1,1)); + IDotN = _mm_add_ss(IDotN,vTemp); + IDotN = _mm_shuffle_ps(IDotN,IDotN,_MM_SHUFFLE(0,0,0,0)); + // vTemp = 1.0f - RefractionIndex * RefractionIndex * (1.0f - IDotN * IDotN) + vTemp = _mm_mul_ps(IDotN,IDotN); + vTemp = _mm_sub_ps(g_XMOne,vTemp); + vTemp = _mm_mul_ps(vTemp,RefractionIndex); + vTemp = _mm_mul_ps(vTemp,RefractionIndex); + vTemp = _mm_sub_ps(g_XMOne,vTemp); + // If any terms are <=0, sqrt() will fail, punt to zero + XMVECTOR vMask = _mm_cmpgt_ps(vTemp,g_XMZero); + // R = RefractionIndex * IDotN + sqrt(R) + vTemp = _mm_sqrt_ps(vTemp); + XMVECTOR vResult = _mm_mul_ps(RefractionIndex,IDotN); + vTemp = _mm_add_ps(vTemp,vResult); + // Result = RefractionIndex * Incident - Normal * R + vResult = _mm_mul_ps(RefractionIndex,Incident); + vTemp = _mm_mul_ps(vTemp,Normal); + vResult = _mm_sub_ps(vResult,vTemp); + vResult = _mm_and_ps(vResult,vMask); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector2Orthogonal +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Result; + + Result.vector4_f32[0] = -V.vector4_f32[1]; + Result.vector4_f32[1] = V.vector4_f32[0]; + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vResult = _mm_shuffle_ps(V,V,_MM_SHUFFLE(3,2,0,1)); + vResult = _mm_mul_ps(vResult,g_XMNegateX); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector2AngleBetweenNormalsEst +( + FXMVECTOR N1, + FXMVECTOR N2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR NegativeOne; + XMVECTOR One; + XMVECTOR Result; + + Result = XMVector2Dot(N1, N2); + NegativeOne = XMVectorSplatConstant(-1, 0); + One = XMVectorSplatOne(); + Result = XMVectorClamp(Result, NegativeOne, One); + Result = XMVectorACosEst(Result); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vResult = XMVector2Dot(N1,N2); + // Clamp to -1.0f to 1.0f + vResult = _mm_max_ps(vResult,g_XMNegativeOne); + vResult = _mm_min_ps(vResult,g_XMOne);; + vResult = XMVectorACosEst(vResult); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector2AngleBetweenNormals +( + FXMVECTOR N1, + FXMVECTOR N2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR NegativeOne; + XMVECTOR One; + XMVECTOR Result; + + Result = XMVector2Dot(N1, N2); + NegativeOne = XMVectorSplatConstant(-1, 0); + One = XMVectorSplatOne(); + Result = XMVectorClamp(Result, NegativeOne, One); + Result = XMVectorACos(Result); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vResult = XMVector2Dot(N1,N2); + // Clamp to -1.0f to 1.0f + vResult = _mm_max_ps(vResult,g_XMNegativeOne); + vResult = _mm_min_ps(vResult,g_XMOne);; + vResult = XMVectorACos(vResult); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector2AngleBetweenVectors +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR L1; + XMVECTOR L2; + XMVECTOR Dot; + XMVECTOR CosAngle; + XMVECTOR NegativeOne; + XMVECTOR One; + XMVECTOR Result; + + L1 = XMVector2ReciprocalLength(V1); + L2 = XMVector2ReciprocalLength(V2); + + Dot = XMVector2Dot(V1, V2); + + L1 = XMVectorMultiply(L1, L2); + + CosAngle = XMVectorMultiply(Dot, L1); + NegativeOne = XMVectorSplatConstant(-1, 0); + One = XMVectorSplatOne(); + CosAngle = XMVectorClamp(CosAngle, NegativeOne, One); + + Result = XMVectorACos(CosAngle); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR L1; + XMVECTOR L2; + XMVECTOR Dot; + XMVECTOR CosAngle; + XMVECTOR Result; + L1 = XMVector2ReciprocalLength(V1); + L2 = XMVector2ReciprocalLength(V2); + Dot = XMVector2Dot(V1, V2); + L1 = _mm_mul_ps(L1, L2); + CosAngle = _mm_mul_ps(Dot, L1); + CosAngle = XMVectorClamp(CosAngle, g_XMNegativeOne,g_XMOne); + Result = XMVectorACos(CosAngle); + return Result; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector2LinePointDistance +( + FXMVECTOR LinePoint1, + FXMVECTOR LinePoint2, + FXMVECTOR Point +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR PointVector; + XMVECTOR LineVector; + XMVECTOR ReciprocalLengthSq; + XMVECTOR PointProjectionScale; + XMVECTOR DistanceVector; + XMVECTOR Result; + + // Given a vector PointVector from LinePoint1 to Point and a vector + // LineVector from LinePoint1 to LinePoint2, the scaled distance + // PointProjectionScale from LinePoint1 to the perpendicular projection + // of PointVector onto the line is defined as: + // + // PointProjectionScale = dot(PointVector, LineVector) / LengthSq(LineVector) + + PointVector = XMVectorSubtract(Point, LinePoint1); + LineVector = XMVectorSubtract(LinePoint2, LinePoint1); + + ReciprocalLengthSq = XMVector2LengthSq(LineVector); + ReciprocalLengthSq = XMVectorReciprocal(ReciprocalLengthSq); + + PointProjectionScale = XMVector2Dot(PointVector, LineVector); + PointProjectionScale = XMVectorMultiply(PointProjectionScale, ReciprocalLengthSq); + + DistanceVector = XMVectorMultiply(LineVector, PointProjectionScale); + DistanceVector = XMVectorSubtract(PointVector, DistanceVector); + + Result = XMVector2Length(DistanceVector); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR PointVector = _mm_sub_ps(Point,LinePoint1); + XMVECTOR LineVector = _mm_sub_ps(LinePoint2,LinePoint1); + XMVECTOR ReciprocalLengthSq = XMVector2LengthSq(LineVector); + XMVECTOR vResult = XMVector2Dot(PointVector,LineVector); + vResult = _mm_div_ps(vResult,ReciprocalLengthSq); + vResult = _mm_mul_ps(vResult,LineVector); + vResult = _mm_sub_ps(PointVector,vResult); + vResult = XMVector2Length(vResult); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector2IntersectLine +( + FXMVECTOR Line1Point1, + FXMVECTOR Line1Point2, + FXMVECTOR Line2Point1, + CXMVECTOR Line2Point2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V1; + XMVECTOR V2; + XMVECTOR V3; + XMVECTOR C1; + XMVECTOR C2; + XMVECTOR Result; + CONST XMVECTOR Zero = XMVectorZero(); + + V1 = XMVectorSubtract(Line1Point2, Line1Point1); + V2 = XMVectorSubtract(Line2Point2, Line2Point1); + V3 = XMVectorSubtract(Line1Point1, Line2Point1); + + C1 = XMVector2Cross(V1, V2); + C2 = XMVector2Cross(V2, V3); + + if (XMVector2NearEqual(C1, Zero, g_XMEpsilon.v)) + { + if (XMVector2NearEqual(C2, Zero, g_XMEpsilon.v)) + { + // Coincident + Result = g_XMInfinity.v; + } + else + { + // Parallel + Result = g_XMQNaN.v; + } + } + else + { + // Intersection point = Line1Point1 + V1 * (C2 / C1) + XMVECTOR Scale; + Scale = XMVectorReciprocal(C1); + Scale = XMVectorMultiply(C2, Scale); + Result = XMVectorMultiplyAdd(V1, Scale, Line1Point1); + } + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR V1 = _mm_sub_ps(Line1Point2, Line1Point1); + XMVECTOR V2 = _mm_sub_ps(Line2Point2, Line2Point1); + XMVECTOR V3 = _mm_sub_ps(Line1Point1, Line2Point1); + // Generate the cross products + XMVECTOR C1 = XMVector2Cross(V1, V2); + XMVECTOR C2 = XMVector2Cross(V2, V3); + // If C1 is not close to epsilon, use the calculated value + XMVECTOR vResultMask = _mm_setzero_ps(); + vResultMask = _mm_sub_ps(vResultMask,C1); + vResultMask = _mm_max_ps(vResultMask,C1); + // 0xFFFFFFFF if the calculated value is to be used + vResultMask = _mm_cmpgt_ps(vResultMask,g_XMEpsilon); + // If C1 is close to epsilon, which fail type is it? INFINITY or NAN? + XMVECTOR vFailMask = _mm_setzero_ps(); + vFailMask = _mm_sub_ps(vFailMask,C2); + vFailMask = _mm_max_ps(vFailMask,C2); + vFailMask = _mm_cmple_ps(vFailMask,g_XMEpsilon); + XMVECTOR vFail = _mm_and_ps(vFailMask,g_XMInfinity); + vFailMask = _mm_andnot_ps(vFailMask,g_XMQNaN); + // vFail is NAN or INF + vFail = _mm_or_ps(vFail,vFailMask); + // Intersection point = Line1Point1 + V1 * (C2 / C1) + XMVECTOR vResult = _mm_div_ps(C2,C1); + vResult = _mm_mul_ps(vResult,V1); + vResult = _mm_add_ps(vResult,Line1Point1); + // Use result, or failure value + vResult = _mm_and_ps(vResult,vResultMask); + vResultMask = _mm_andnot_ps(vResultMask,vFail); + vResult = _mm_or_ps(vResult,vResultMask); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector2Transform +( + FXMVECTOR V, + CXMMATRIX M +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR X; + XMVECTOR Y; + XMVECTOR Result; + + Y = XMVectorSplatY(V); + X = XMVectorSplatX(V); + + Result = XMVectorMultiplyAdd(Y, M.r[1], M.r[3]); + Result = XMVectorMultiplyAdd(X, M.r[0], Result); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vResult = _mm_shuffle_ps(V,V,_MM_SHUFFLE(0,0,0,0)); + vResult = _mm_mul_ps(vResult,M.r[0]); + XMVECTOR vTemp = _mm_shuffle_ps(V,V,_MM_SHUFFLE(1,1,1,1)); + vTemp = _mm_mul_ps(vTemp,M.r[1]); + vResult = _mm_add_ps(vResult,vTemp); + vResult = _mm_add_ps(vResult,M.r[3]); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMINLINE XMFLOAT4* XMVector2TransformStream +( + XMFLOAT4* pOutputStream, + UINT OutputStride, + CONST XMFLOAT2* pInputStream, + UINT InputStride, + UINT VectorCount, + CXMMATRIX M +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V; + XMVECTOR X; + XMVECTOR Y; + XMVECTOR Result; + UINT i; + BYTE* pInputVector = (BYTE*)pInputStream; + BYTE* pOutputVector = (BYTE*)pOutputStream; + + XMASSERT(pOutputStream); + XMASSERT(pInputStream); + + for (i = 0; i < VectorCount; i++) + { + V = XMLoadFloat2((XMFLOAT2*)pInputVector); + Y = XMVectorSplatY(V); + X = XMVectorSplatX(V); +// Y = XMVectorReplicate(((XMFLOAT2*)pInputVector)->y); +// X = XMVectorReplicate(((XMFLOAT2*)pInputVector)->x); + + Result = XMVectorMultiplyAdd(Y, M.r[1], M.r[3]); + Result = XMVectorMultiplyAdd(X, M.r[0], Result); + + XMStoreFloat4((XMFLOAT4*)pOutputVector, Result); + + pInputVector += InputStride; + pOutputVector += OutputStride; + } + + return pOutputStream; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pOutputStream); + XMASSERT(pInputStream); + UINT i; + const BYTE* pInputVector = (const BYTE*)pInputStream; + BYTE* pOutputVector = (BYTE*)pOutputStream; + + for (i = 0; i < VectorCount; i++) + { + XMVECTOR X = _mm_load_ps1(&reinterpret_cast(pInputVector)->x); + XMVECTOR vResult = _mm_load_ps1(&reinterpret_cast(pInputVector)->y); + vResult = _mm_mul_ps(vResult,M.r[1]); + vResult = _mm_add_ps(vResult,M.r[3]); + X = _mm_mul_ps(X,M.r[0]); + vResult = _mm_add_ps(vResult,X); + _mm_storeu_ps(reinterpret_cast(pOutputVector),vResult); + pInputVector += InputStride; + pOutputVector += OutputStride; + } + return pOutputStream; +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMINLINE XMFLOAT4* XMVector2TransformStreamNC +( + XMFLOAT4* pOutputStream, + UINT OutputStride, + CONST XMFLOAT2* pInputStream, + UINT InputStride, + UINT VectorCount, + CXMMATRIX M +) +{ +#if defined(_XM_NO_INTRINSICS_) || defined(XM_NO_MISALIGNED_VECTOR_ACCESS) || defined(_XM_SSE_INTRINSICS_) + return XMVector2TransformStream( pOutputStream, OutputStride, pInputStream, InputStride, VectorCount, M ); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector2TransformCoord +( + FXMVECTOR V, + CXMMATRIX M +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR X; + XMVECTOR Y; + XMVECTOR InverseW; + XMVECTOR Result; + + Y = XMVectorSplatY(V); + X = XMVectorSplatX(V); + + Result = XMVectorMultiplyAdd(Y, M.r[1], M.r[3]); + Result = XMVectorMultiplyAdd(X, M.r[0], Result); + + InverseW = XMVectorSplatW(Result); + InverseW = XMVectorReciprocal(InverseW); + + Result = XMVectorMultiply(Result, InverseW); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vResult = _mm_shuffle_ps(V,V,_MM_SHUFFLE(0,0,0,0)); + vResult = _mm_mul_ps(vResult,M.r[0]); + XMVECTOR vTemp = _mm_shuffle_ps(V,V,_MM_SHUFFLE(1,1,1,1)); + vTemp = _mm_mul_ps(vTemp,M.r[1]); + vResult = _mm_add_ps(vResult,vTemp); + vResult = _mm_add_ps(vResult,M.r[3]); + vTemp = _mm_shuffle_ps(vResult,vResult,_MM_SHUFFLE(3,3,3,3)); + vResult = _mm_div_ps(vResult,vTemp); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMINLINE XMFLOAT2* XMVector2TransformCoordStream +( + XMFLOAT2* pOutputStream, + UINT OutputStride, + CONST XMFLOAT2* pInputStream, + UINT InputStride, + UINT VectorCount, + CXMMATRIX M +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V; + XMVECTOR X; + XMVECTOR Y; + XMVECTOR InverseW; + XMVECTOR Result; + UINT i; + BYTE* pInputVector = (BYTE*)pInputStream; + BYTE* pOutputVector = (BYTE*)pOutputStream; + + XMASSERT(pOutputStream); + XMASSERT(pInputStream); + + for (i = 0; i < VectorCount; i++) + { + V = XMLoadFloat2((XMFLOAT2*)pInputVector); + Y = XMVectorSplatY(V); + X = XMVectorSplatX(V); +// Y = XMVectorReplicate(((XMFLOAT2*)pInputVector)->y); +// X = XMVectorReplicate(((XMFLOAT2*)pInputVector)->x); + + Result = XMVectorMultiplyAdd(Y, M.r[1], M.r[3]); + Result = XMVectorMultiplyAdd(X, M.r[0], Result); + + InverseW = XMVectorSplatW(Result); + InverseW = XMVectorReciprocal(InverseW); + + Result = XMVectorMultiply(Result, InverseW); + + XMStoreFloat2((XMFLOAT2*)pOutputVector, Result); + + pInputVector += InputStride; + pOutputVector += OutputStride; + } + + return pOutputStream; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pOutputStream); + XMASSERT(pInputStream); + UINT i; + const BYTE *pInputVector = (BYTE*)pInputStream; + BYTE *pOutputVector = (BYTE*)pOutputStream; + + for (i = 0; i < VectorCount; i++) + { + XMVECTOR X = _mm_load_ps1(&reinterpret_cast(pInputVector)->x); + XMVECTOR vResult = _mm_load_ps1(&reinterpret_cast(pInputVector)->y); + vResult = _mm_mul_ps(vResult,M.r[1]); + vResult = _mm_add_ps(vResult,M.r[3]); + X = _mm_mul_ps(X,M.r[0]); + vResult = _mm_add_ps(vResult,X); + X = _mm_shuffle_ps(vResult,vResult,_MM_SHUFFLE(3,3,3,3)); + vResult = _mm_div_ps(vResult,X); + _mm_store_sd(reinterpret_cast(pOutputVector),reinterpret_cast<__m128d *>(&vResult)[0]); + pInputVector += InputStride; + pOutputVector += OutputStride; + } + return pOutputStream; +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector2TransformNormal +( + FXMVECTOR V, + CXMMATRIX M +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR X; + XMVECTOR Y; + XMVECTOR Result; + + Y = XMVectorSplatY(V); + X = XMVectorSplatX(V); + + Result = XMVectorMultiply(Y, M.r[1]); + Result = XMVectorMultiplyAdd(X, M.r[0], Result); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vResult = _mm_shuffle_ps(V,V,_MM_SHUFFLE(0,0,0,0)); + vResult = _mm_mul_ps(vResult,M.r[0]); + XMVECTOR vTemp = _mm_shuffle_ps(V,V,_MM_SHUFFLE(1,1,1,1)); + vTemp = _mm_mul_ps(vTemp,M.r[1]); + vResult = _mm_add_ps(vResult,vTemp); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMINLINE XMFLOAT2* XMVector2TransformNormalStream +( + XMFLOAT2* pOutputStream, + UINT OutputStride, + CONST XMFLOAT2* pInputStream, + UINT InputStride, + UINT VectorCount, + CXMMATRIX M +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V; + XMVECTOR X; + XMVECTOR Y; + XMVECTOR Result; + UINT i; + BYTE* pInputVector = (BYTE*)pInputStream; + BYTE* pOutputVector = (BYTE*)pOutputStream; + + XMASSERT(pOutputStream); + XMASSERT(pInputStream); + + for (i = 0; i < VectorCount; i++) + { + V = XMLoadFloat2((XMFLOAT2*)pInputVector); + Y = XMVectorSplatY(V); + X = XMVectorSplatX(V); +// Y = XMVectorReplicate(((XMFLOAT2*)pInputVector)->y); +// X = XMVectorReplicate(((XMFLOAT2*)pInputVector)->x); + + Result = XMVectorMultiply(Y, M.r[1]); + Result = XMVectorMultiplyAdd(X, M.r[0], Result); + + XMStoreFloat2((XMFLOAT2*)pOutputVector, Result); + + pInputVector += InputStride; + pOutputVector += OutputStride; + } + + return pOutputStream; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pOutputStream); + XMASSERT(pInputStream); + UINT i; + const BYTE*pInputVector = (const BYTE*)pInputStream; + BYTE *pOutputVector = (BYTE*)pOutputStream; + for (i = 0; i < VectorCount; i++) + { + XMVECTOR X = _mm_load_ps1(&reinterpret_cast(pInputVector)->x); + XMVECTOR vResult = _mm_load_ps1(&reinterpret_cast(pInputVector)->y); + vResult = _mm_mul_ps(vResult,M.r[1]); + X = _mm_mul_ps(X,M.r[0]); + vResult = _mm_add_ps(vResult,X); + _mm_store_sd(reinterpret_cast(pOutputVector),reinterpret_cast(&vResult)[0]); + + pInputVector += InputStride; + pOutputVector += OutputStride; + } + + return pOutputStream; +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +/**************************************************************************** + * + * 3D Vector + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ +// Comparison operations +//------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------ + +XMFINLINE BOOL XMVector3Equal +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + return (((V1.vector4_f32[0] == V2.vector4_f32[0]) && (V1.vector4_f32[1] == V2.vector4_f32[1]) && (V1.vector4_f32[2] == V2.vector4_f32[2])) != 0); +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vTemp = _mm_cmpeq_ps(V1,V2); + return (((_mm_movemask_ps(vTemp)&7)==7) != 0); +#else // _XM_VMX128_INTRINSICS_ + return XMComparisonAllTrue(XMVector3EqualR(V1, V2)); +#endif +} + +//------------------------------------------------------------------------------ + +XMFINLINE UINT XMVector3EqualR +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + UINT CR = 0; + if ((V1.vector4_f32[0] == V2.vector4_f32[0]) && + (V1.vector4_f32[1] == V2.vector4_f32[1]) && + (V1.vector4_f32[2] == V2.vector4_f32[2])) + { + CR = XM_CRMASK_CR6TRUE; + } + else if ((V1.vector4_f32[0] != V2.vector4_f32[0]) && + (V1.vector4_f32[1] != V2.vector4_f32[1]) && + (V1.vector4_f32[2] != V2.vector4_f32[2])) + { + CR = XM_CRMASK_CR6FALSE; + } + return CR; +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vTemp = _mm_cmpeq_ps(V1,V2); + int iTest = _mm_movemask_ps(vTemp)&7; + UINT CR = 0; + if (iTest==7) + { + CR = XM_CRMASK_CR6TRUE; + } + else if (!iTest) + { + CR = XM_CRMASK_CR6FALSE; + } + return CR; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE BOOL XMVector3EqualInt +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + return (((V1.vector4_u32[0] == V2.vector4_u32[0]) && (V1.vector4_u32[1] == V2.vector4_u32[1]) && (V1.vector4_u32[2] == V2.vector4_u32[2])) != 0); +#elif defined(_XM_SSE_INTRINSICS_) + __m128i vTemp = _mm_cmpeq_epi32(reinterpret_cast(&V1)[0],reinterpret_cast(&V2)[0]); + return (((_mm_movemask_ps(reinterpret_cast(&vTemp)[0])&7)==7) != 0); +#else // _XM_VMX128_INTRINSICS_ + return XMComparisonAllTrue(XMVector3EqualIntR(V1, V2)); +#endif +} + +//------------------------------------------------------------------------------ + +XMFINLINE UINT XMVector3EqualIntR +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + UINT CR = 0; + if ((V1.vector4_u32[0] == V2.vector4_u32[0]) && + (V1.vector4_u32[1] == V2.vector4_u32[1]) && + (V1.vector4_u32[2] == V2.vector4_u32[2])) + { + CR = XM_CRMASK_CR6TRUE; + } + else if ((V1.vector4_u32[0] != V2.vector4_u32[0]) && + (V1.vector4_u32[1] != V2.vector4_u32[1]) && + (V1.vector4_u32[2] != V2.vector4_u32[2])) + { + CR = XM_CRMASK_CR6FALSE; + } + return CR; +#elif defined(_XM_SSE_INTRINSICS_) + __m128i vTemp = _mm_cmpeq_epi32(reinterpret_cast(&V1)[0],reinterpret_cast(&V2)[0]); + int iTemp = _mm_movemask_ps(reinterpret_cast(&vTemp)[0])&7; + UINT CR = 0; + if (iTemp==7) + { + CR = XM_CRMASK_CR6TRUE; + } + else if (!iTemp) + { + CR = XM_CRMASK_CR6FALSE; + } + return CR; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE BOOL XMVector3NearEqual +( + FXMVECTOR V1, + FXMVECTOR V2, + FXMVECTOR Epsilon +) +{ +#if defined(_XM_NO_INTRINSICS_) + FLOAT dx, dy, dz; + + dx = fabsf(V1.vector4_f32[0]-V2.vector4_f32[0]); + dy = fabsf(V1.vector4_f32[1]-V2.vector4_f32[1]); + dz = fabsf(V1.vector4_f32[2]-V2.vector4_f32[2]); + return (((dx <= Epsilon.vector4_f32[0]) && + (dy <= Epsilon.vector4_f32[1]) && + (dz <= Epsilon.vector4_f32[2])) != 0); +#elif defined(_XM_SSE_INTRINSICS_) + // Get the difference + XMVECTOR vDelta = _mm_sub_ps(V1,V2); + // Get the absolute value of the difference + XMVECTOR vTemp = _mm_setzero_ps(); + vTemp = _mm_sub_ps(vTemp,vDelta); + vTemp = _mm_max_ps(vTemp,vDelta); + vTemp = _mm_cmple_ps(vTemp,Epsilon); + // w is don't care + return (((_mm_movemask_ps(vTemp)&7)==0x7) != 0); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE BOOL XMVector3NotEqual +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + return (((V1.vector4_f32[0] != V2.vector4_f32[0]) || (V1.vector4_f32[1] != V2.vector4_f32[1]) || (V1.vector4_f32[2] != V2.vector4_f32[2])) != 0); +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vTemp = _mm_cmpeq_ps(V1,V2); + return (((_mm_movemask_ps(vTemp)&7)!=7) != 0); +#else // _XM_VMX128_INTRINSICS_ + return XMComparisonAnyFalse(XMVector3EqualR(V1, V2)); +#endif +} + +//------------------------------------------------------------------------------ + +XMFINLINE BOOL XMVector3NotEqualInt +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + return (((V1.vector4_u32[0] != V2.vector4_u32[0]) || (V1.vector4_u32[1] != V2.vector4_u32[1]) || (V1.vector4_u32[2] != V2.vector4_u32[2])) != 0); +#elif defined(_XM_SSE_INTRINSICS_) + __m128i vTemp = _mm_cmpeq_epi32(reinterpret_cast(&V1)[0],reinterpret_cast(&V2)[0]); + return (((_mm_movemask_ps(reinterpret_cast(&vTemp)[0])&7)!=7) != 0); +#else // _XM_VMX128_INTRINSICS_ + return XMComparisonAnyFalse(XMVector3EqualIntR(V1, V2)); +#endif +} + +//------------------------------------------------------------------------------ + +XMFINLINE BOOL XMVector3Greater +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + return (((V1.vector4_f32[0] > V2.vector4_f32[0]) && (V1.vector4_f32[1] > V2.vector4_f32[1]) && (V1.vector4_f32[2] > V2.vector4_f32[2])) != 0); +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vTemp = _mm_cmpgt_ps(V1,V2); + return (((_mm_movemask_ps(vTemp)&7)==7) != 0); +#else // _XM_VMX128_INTRINSICS_ + return XMComparisonAllTrue(XMVector3GreaterR(V1, V2)); +#endif +} + +//------------------------------------------------------------------------------ + +XMFINLINE UINT XMVector3GreaterR +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + UINT CR = 0; + if ((V1.vector4_f32[0] > V2.vector4_f32[0]) && + (V1.vector4_f32[1] > V2.vector4_f32[1]) && + (V1.vector4_f32[2] > V2.vector4_f32[2])) + { + CR = XM_CRMASK_CR6TRUE; + } + else if ((V1.vector4_f32[0] <= V2.vector4_f32[0]) && + (V1.vector4_f32[1] <= V2.vector4_f32[1]) && + (V1.vector4_f32[2] <= V2.vector4_f32[2])) + { + CR = XM_CRMASK_CR6FALSE; + } + return CR; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vTemp = _mm_cmpgt_ps(V1,V2); + UINT CR = 0; + int iTest = _mm_movemask_ps(vTemp)&7; + if (iTest==7) + { + CR = XM_CRMASK_CR6TRUE; + } + else if (!iTest) + { + CR = XM_CRMASK_CR6FALSE; + } + return CR; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE BOOL XMVector3GreaterOrEqual +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + return (((V1.vector4_f32[0] >= V2.vector4_f32[0]) && (V1.vector4_f32[1] >= V2.vector4_f32[1]) && (V1.vector4_f32[2] >= V2.vector4_f32[2])) != 0); +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vTemp = _mm_cmpge_ps(V1,V2); + return (((_mm_movemask_ps(vTemp)&7)==7) != 0); +#else // _XM_VMX128_INTRINSICS_ + return XMComparisonAllTrue(XMVector3GreaterOrEqualR(V1, V2)); +#endif +} + +//------------------------------------------------------------------------------ + +XMFINLINE UINT XMVector3GreaterOrEqualR +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + + UINT CR = 0; + if ((V1.vector4_f32[0] >= V2.vector4_f32[0]) && + (V1.vector4_f32[1] >= V2.vector4_f32[1]) && + (V1.vector4_f32[2] >= V2.vector4_f32[2])) + { + CR = XM_CRMASK_CR6TRUE; + } + else if ((V1.vector4_f32[0] < V2.vector4_f32[0]) && + (V1.vector4_f32[1] < V2.vector4_f32[1]) && + (V1.vector4_f32[2] < V2.vector4_f32[2])) + { + CR = XM_CRMASK_CR6FALSE; + } + return CR; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vTemp = _mm_cmpge_ps(V1,V2); + UINT CR = 0; + int iTest = _mm_movemask_ps(vTemp)&7; + if (iTest==7) + { + CR = XM_CRMASK_CR6TRUE; + } + else if (!iTest) + { + CR = XM_CRMASK_CR6FALSE; + } + return CR; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE BOOL XMVector3Less +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + return (((V1.vector4_f32[0] < V2.vector4_f32[0]) && (V1.vector4_f32[1] < V2.vector4_f32[1]) && (V1.vector4_f32[2] < V2.vector4_f32[2])) != 0); +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vTemp = _mm_cmplt_ps(V1,V2); + return (((_mm_movemask_ps(vTemp)&7)==7) != 0); +#else // _XM_VMX128_INTRINSICS_ + return XMComparisonAllTrue(XMVector3GreaterR(V2, V1)); +#endif +} + +//------------------------------------------------------------------------------ + +XMFINLINE BOOL XMVector3LessOrEqual +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + return (((V1.vector4_f32[0] <= V2.vector4_f32[0]) && (V1.vector4_f32[1] <= V2.vector4_f32[1]) && (V1.vector4_f32[2] <= V2.vector4_f32[2])) != 0); +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vTemp = _mm_cmple_ps(V1,V2); + return (((_mm_movemask_ps(vTemp)&7)==7) != 0); +#else // _XM_VMX128_INTRINSICS_ + return XMComparisonAllTrue(XMVector3GreaterOrEqualR(V2, V1)); +#endif +} + +//------------------------------------------------------------------------------ + +XMFINLINE BOOL XMVector3InBounds +( + FXMVECTOR V, + FXMVECTOR Bounds +) +{ +#if defined(_XM_NO_INTRINSICS_) + return (((V.vector4_f32[0] <= Bounds.vector4_f32[0] && V.vector4_f32[0] >= -Bounds.vector4_f32[0]) && + (V.vector4_f32[1] <= Bounds.vector4_f32[1] && V.vector4_f32[1] >= -Bounds.vector4_f32[1]) && + (V.vector4_f32[2] <= Bounds.vector4_f32[2] && V.vector4_f32[2] >= -Bounds.vector4_f32[2])) != 0); +#elif defined(_XM_SSE_INTRINSICS_) + // Test if less than or equal + XMVECTOR vTemp1 = _mm_cmple_ps(V,Bounds); + // Negate the bounds + XMVECTOR vTemp2 = _mm_mul_ps(Bounds,g_XMNegativeOne); + // Test if greater or equal (Reversed) + vTemp2 = _mm_cmple_ps(vTemp2,V); + // Blend answers + vTemp1 = _mm_and_ps(vTemp1,vTemp2); + // x,y and z in bounds? (w is don't care) + return (((_mm_movemask_ps(vTemp1)&0x7)==0x7) != 0); +#else + return XMComparisonAllInBounds(XMVector3InBoundsR(V, Bounds)); +#endif +} + +//------------------------------------------------------------------------------ + +XMFINLINE UINT XMVector3InBoundsR +( + FXMVECTOR V, + FXMVECTOR Bounds +) +{ +#if defined(_XM_NO_INTRINSICS_) + UINT CR = 0; + if ((V.vector4_f32[0] <= Bounds.vector4_f32[0] && V.vector4_f32[0] >= -Bounds.vector4_f32[0]) && + (V.vector4_f32[1] <= Bounds.vector4_f32[1] && V.vector4_f32[1] >= -Bounds.vector4_f32[1]) && + (V.vector4_f32[2] <= Bounds.vector4_f32[2] && V.vector4_f32[2] >= -Bounds.vector4_f32[2])) + { + CR = XM_CRMASK_CR6BOUNDS; + } + return CR; + +#elif defined(_XM_SSE_INTRINSICS_) + // Test if less than or equal + XMVECTOR vTemp1 = _mm_cmple_ps(V,Bounds); + // Negate the bounds + XMVECTOR vTemp2 = _mm_mul_ps(Bounds,g_XMNegativeOne); + // Test if greater or equal (Reversed) + vTemp2 = _mm_cmple_ps(vTemp2,V); + // Blend answers + vTemp1 = _mm_and_ps(vTemp1,vTemp2); + // x,y and z in bounds? (w is don't care) + return ((_mm_movemask_ps(vTemp1)&0x7)==0x7) ? XM_CRMASK_CR6BOUNDS : 0; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE BOOL XMVector3IsNaN +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + return (XMISNAN(V.vector4_f32[0]) || + XMISNAN(V.vector4_f32[1]) || + XMISNAN(V.vector4_f32[2])); + +#elif defined(_XM_SSE_INTRINSICS_) + // Mask off the exponent + __m128i vTempInf = _mm_and_si128(reinterpret_cast(&V)[0],g_XMInfinity); + // Mask off the mantissa + __m128i vTempNan = _mm_and_si128(reinterpret_cast(&V)[0],g_XMQNaNTest); + // Are any of the exponents == 0x7F800000? + vTempInf = _mm_cmpeq_epi32(vTempInf,g_XMInfinity); + // Are any of the mantissa's zero? (SSE2 doesn't have a neq test) + vTempNan = _mm_cmpeq_epi32(vTempNan,g_XMZero); + // Perform a not on the NaN test to be true on NON-zero mantissas + vTempNan = _mm_andnot_si128(vTempNan,vTempInf); + // If x, y or z are NaN, the signs are true after the merge above + return ((_mm_movemask_ps(reinterpret_cast(&vTempNan)[0])&7) != 0); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE BOOL XMVector3IsInfinite +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + return (XMISINF(V.vector4_f32[0]) || + XMISINF(V.vector4_f32[1]) || + XMISINF(V.vector4_f32[2])); +#elif defined(_XM_SSE_INTRINSICS_) + // Mask off the sign bit + __m128 vTemp = _mm_and_ps(V,g_XMAbsMask); + // Compare to infinity + vTemp = _mm_cmpeq_ps(vTemp,g_XMInfinity); + // If x,y or z are infinity, the signs are true. + return ((_mm_movemask_ps(vTemp)&7) != 0); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ +// Computation operations +//------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector3Dot +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + FLOAT fValue = V1.vector4_f32[0] * V2.vector4_f32[0] + V1.vector4_f32[1] * V2.vector4_f32[1] + V1.vector4_f32[2] * V2.vector4_f32[2]; + XMVECTOR vResult = { + fValue, + fValue, + fValue, + fValue + }; + return vResult; + +#elif defined(_XM_SSE_INTRINSICS_) + // Perform the dot product + XMVECTOR vDot = _mm_mul_ps(V1,V2); + // x=Dot.vector4_f32[1], y=Dot.vector4_f32[2] + XMVECTOR vTemp = _mm_shuffle_ps(vDot,vDot,_MM_SHUFFLE(2,1,2,1)); + // Result.vector4_f32[0] = x+y + vDot = _mm_add_ss(vDot,vTemp); + // x=Dot.vector4_f32[2] + vTemp = _mm_shuffle_ps(vTemp,vTemp,_MM_SHUFFLE(1,1,1,1)); + // Result.vector4_f32[0] = (x+y)+z + vDot = _mm_add_ss(vDot,vTemp); + // Splat x + return _mm_shuffle_ps(vDot,vDot,_MM_SHUFFLE(0,0,0,0)); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector3Cross +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + XMVECTOR vResult = { + (V1.vector4_f32[1] * V2.vector4_f32[2]) - (V1.vector4_f32[2] * V2.vector4_f32[1]), + (V1.vector4_f32[2] * V2.vector4_f32[0]) - (V1.vector4_f32[0] * V2.vector4_f32[2]), + (V1.vector4_f32[0] * V2.vector4_f32[1]) - (V1.vector4_f32[1] * V2.vector4_f32[0]), + 0.0f + }; + return vResult; + +#elif defined(_XM_SSE_INTRINSICS_) + // y1,z1,x1,w1 + XMVECTOR vTemp1 = _mm_shuffle_ps(V1,V1,_MM_SHUFFLE(3,0,2,1)); + // z2,x2,y2,w2 + XMVECTOR vTemp2 = _mm_shuffle_ps(V2,V2,_MM_SHUFFLE(3,1,0,2)); + // Perform the left operation + XMVECTOR vResult = _mm_mul_ps(vTemp1,vTemp2); + // z1,x1,y1,w1 + vTemp1 = _mm_shuffle_ps(vTemp1,vTemp1,_MM_SHUFFLE(3,0,2,1)); + // y2,z2,x2,w2 + vTemp2 = _mm_shuffle_ps(vTemp2,vTemp2,_MM_SHUFFLE(3,1,0,2)); + // Perform the right operation + vTemp1 = _mm_mul_ps(vTemp1,vTemp2); + // Subract the right from left, and return answer + vResult = _mm_sub_ps(vResult,vTemp1); + // Set w to zero + return _mm_and_ps(vResult,g_XMMask3); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector3LengthSq +( + FXMVECTOR V +) +{ + return XMVector3Dot(V, V); +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector3ReciprocalLengthEst +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Result; + + Result = XMVector3LengthSq(V); + Result = XMVectorReciprocalSqrtEst(Result); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + // Perform the dot product on x,y and z + XMVECTOR vLengthSq = _mm_mul_ps(V,V); + // vTemp has z and y + XMVECTOR vTemp = _mm_shuffle_ps(vLengthSq,vLengthSq,_MM_SHUFFLE(1,2,1,2)); + // x+z, y + vLengthSq = _mm_add_ss(vLengthSq,vTemp); + // y,y,y,y + vTemp = _mm_shuffle_ps(vTemp,vTemp,_MM_SHUFFLE(1,1,1,1)); + // x+z+y,??,??,?? + vLengthSq = _mm_add_ss(vLengthSq,vTemp); + // Splat the length squared + vLengthSq = _mm_shuffle_ps(vLengthSq,vLengthSq,_MM_SHUFFLE(0,0,0,0)); + // Get the reciprocal + vLengthSq = _mm_rsqrt_ps(vLengthSq); + return vLengthSq; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector3ReciprocalLength +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Result; + + Result = XMVector3LengthSq(V); + Result = XMVectorReciprocalSqrt(Result); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + // Perform the dot product + XMVECTOR vDot = _mm_mul_ps(V,V); + // x=Dot.y, y=Dot.z + XMVECTOR vTemp = _mm_shuffle_ps(vDot,vDot,_MM_SHUFFLE(2,1,2,1)); + // Result.x = x+y + vDot = _mm_add_ss(vDot,vTemp); + // x=Dot.z + vTemp = _mm_shuffle_ps(vTemp,vTemp,_MM_SHUFFLE(1,1,1,1)); + // Result.x = (x+y)+z + vDot = _mm_add_ss(vDot,vTemp); + // Splat x + vDot = _mm_shuffle_ps(vDot,vDot,_MM_SHUFFLE(0,0,0,0)); + // Get the reciprocal + vDot = _mm_sqrt_ps(vDot); + // Get the reciprocal + vDot = _mm_div_ps(g_XMOne,vDot); + return vDot; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector3LengthEst +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Result; + + Result = XMVector3LengthSq(V); + Result = XMVectorSqrtEst(Result); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + // Perform the dot product on x,y and z + XMVECTOR vLengthSq = _mm_mul_ps(V,V); + // vTemp has z and y + XMVECTOR vTemp = _mm_shuffle_ps(vLengthSq,vLengthSq,_MM_SHUFFLE(1,2,1,2)); + // x+z, y + vLengthSq = _mm_add_ss(vLengthSq,vTemp); + // y,y,y,y + vTemp = _mm_shuffle_ps(vTemp,vTemp,_MM_SHUFFLE(1,1,1,1)); + // x+z+y,??,??,?? + vLengthSq = _mm_add_ss(vLengthSq,vTemp); + // Splat the length squared + vLengthSq = _mm_shuffle_ps(vLengthSq,vLengthSq,_MM_SHUFFLE(0,0,0,0)); + // Get the length + vLengthSq = _mm_sqrt_ps(vLengthSq); + return vLengthSq; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector3Length +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Result; + + Result = XMVector3LengthSq(V); + Result = XMVectorSqrt(Result); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + // Perform the dot product on x,y and z + XMVECTOR vLengthSq = _mm_mul_ps(V,V); + // vTemp has z and y + XMVECTOR vTemp = _mm_shuffle_ps(vLengthSq,vLengthSq,_MM_SHUFFLE(1,2,1,2)); + // x+z, y + vLengthSq = _mm_add_ss(vLengthSq,vTemp); + // y,y,y,y + vTemp = _mm_shuffle_ps(vTemp,vTemp,_MM_SHUFFLE(1,1,1,1)); + // x+z+y,??,??,?? + vLengthSq = _mm_add_ss(vLengthSq,vTemp); + // Splat the length squared + vLengthSq = _mm_shuffle_ps(vLengthSq,vLengthSq,_MM_SHUFFLE(0,0,0,0)); + // Get the length + vLengthSq = _mm_sqrt_ps(vLengthSq); + return vLengthSq; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ +// XMVector3NormalizeEst uses a reciprocal estimate and +// returns QNaN on zero and infinite vectors. + +XMFINLINE XMVECTOR XMVector3NormalizeEst +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Result; + Result = XMVector3ReciprocalLength(V); + Result = XMVectorMultiply(V, Result); + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + // Perform the dot product + XMVECTOR vDot = _mm_mul_ps(V,V); + // x=Dot.y, y=Dot.z + XMVECTOR vTemp = _mm_shuffle_ps(vDot,vDot,_MM_SHUFFLE(2,1,2,1)); + // Result.x = x+y + vDot = _mm_add_ss(vDot,vTemp); + // x=Dot.z + vTemp = _mm_shuffle_ps(vTemp,vTemp,_MM_SHUFFLE(1,1,1,1)); + // Result.x = (x+y)+z + vDot = _mm_add_ss(vDot,vTemp); + // Splat x + vDot = _mm_shuffle_ps(vDot,vDot,_MM_SHUFFLE(0,0,0,0)); + // Get the reciprocal + vDot = _mm_rsqrt_ps(vDot); + // Perform the normalization + vDot = _mm_mul_ps(vDot,V); + return vDot; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector3Normalize +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + FLOAT fLength; + XMVECTOR vResult; + + vResult = XMVector3Length( V ); + fLength = vResult.vector4_f32[0]; + + // Prevent divide by zero + if (fLength > 0) { + fLength = 1.0f/fLength; + } + + vResult.vector4_f32[0] = V.vector4_f32[0]*fLength; + vResult.vector4_f32[1] = V.vector4_f32[1]*fLength; + vResult.vector4_f32[2] = V.vector4_f32[2]*fLength; + vResult.vector4_f32[3] = V.vector4_f32[3]*fLength; + return vResult; + +#elif defined(_XM_SSE_INTRINSICS_) + // Perform the dot product on x,y and z only + XMVECTOR vLengthSq = _mm_mul_ps(V,V); + XMVECTOR vTemp = _mm_shuffle_ps(vLengthSq,vLengthSq,_MM_SHUFFLE(2,1,2,1)); + vLengthSq = _mm_add_ss(vLengthSq,vTemp); + vTemp = _mm_shuffle_ps(vTemp,vTemp,_MM_SHUFFLE(1,1,1,1)); + vLengthSq = _mm_add_ss(vLengthSq,vTemp); + vLengthSq = _mm_shuffle_ps(vLengthSq,vLengthSq,_MM_SHUFFLE(0,0,0,0)); + // Prepare for the division + XMVECTOR vResult = _mm_sqrt_ps(vLengthSq); + // Create zero with a single instruction + XMVECTOR vZeroMask = _mm_setzero_ps(); + // Test for a divide by zero (Must be FP to detect -0.0) + vZeroMask = _mm_cmpneq_ps(vZeroMask,vResult); + // Failsafe on zero (Or epsilon) length planes + // If the length is infinity, set the elements to zero + vLengthSq = _mm_cmpneq_ps(vLengthSq,g_XMInfinity); + // Divide to perform the normalization + vResult = _mm_div_ps(V,vResult); + // Any that are infinity, set to zero + vResult = _mm_and_ps(vResult,vZeroMask); + // Select qnan or result based on infinite length + XMVECTOR vTemp1 = _mm_andnot_ps(vLengthSq,g_XMQNaN); + XMVECTOR vTemp2 = _mm_and_ps(vResult,vLengthSq); + vResult = _mm_or_ps(vTemp1,vTemp2); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector3ClampLength +( + FXMVECTOR V, + FLOAT LengthMin, + FLOAT LengthMax +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR ClampMax; + XMVECTOR ClampMin; + + ClampMax = XMVectorReplicate(LengthMax); + ClampMin = XMVectorReplicate(LengthMin); + + return XMVector3ClampLengthV(V, ClampMin, ClampMax); + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR ClampMax = _mm_set_ps1(LengthMax); + XMVECTOR ClampMin = _mm_set_ps1(LengthMin); + return XMVector3ClampLengthV(V,ClampMin,ClampMax); +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector3ClampLengthV +( + FXMVECTOR V, + FXMVECTOR LengthMin, + FXMVECTOR LengthMax +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR ClampLength; + XMVECTOR LengthSq; + XMVECTOR RcpLength; + XMVECTOR Length; + XMVECTOR Normal; + XMVECTOR Zero; + XMVECTOR InfiniteLength; + XMVECTOR ZeroLength; + XMVECTOR Select; + XMVECTOR ControlMax; + XMVECTOR ControlMin; + XMVECTOR Control; + XMVECTOR Result; + + XMASSERT((LengthMin.vector4_f32[1] == LengthMin.vector4_f32[0]) && (LengthMin.vector4_f32[2] == LengthMin.vector4_f32[0])); + XMASSERT((LengthMax.vector4_f32[1] == LengthMax.vector4_f32[0]) && (LengthMax.vector4_f32[2] == LengthMax.vector4_f32[0])); + XMASSERT(XMVector3GreaterOrEqual(LengthMin, XMVectorZero())); + XMASSERT(XMVector3GreaterOrEqual(LengthMax, XMVectorZero())); + XMASSERT(XMVector3GreaterOrEqual(LengthMax, LengthMin)); + + LengthSq = XMVector3LengthSq(V); + + Zero = XMVectorZero(); + + RcpLength = XMVectorReciprocalSqrt(LengthSq); + + InfiniteLength = XMVectorEqualInt(LengthSq, g_XMInfinity.v); + ZeroLength = XMVectorEqual(LengthSq, Zero); + + Normal = XMVectorMultiply(V, RcpLength); + + Length = XMVectorMultiply(LengthSq, RcpLength); + + Select = XMVectorEqualInt(InfiniteLength, ZeroLength); + Length = XMVectorSelect(LengthSq, Length, Select); + Normal = XMVectorSelect(LengthSq, Normal, Select); + + ControlMax = XMVectorGreater(Length, LengthMax); + ControlMin = XMVectorLess(Length, LengthMin); + + ClampLength = XMVectorSelect(Length, LengthMax, ControlMax); + ClampLength = XMVectorSelect(ClampLength, LengthMin, ControlMin); + + Result = XMVectorMultiply(Normal, ClampLength); + + // Preserve the original vector (with no precision loss) if the length falls within the given range + Control = XMVectorEqualInt(ControlMax, ControlMin); + Result = XMVectorSelect(Result, V, Control); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR ClampLength; + XMVECTOR LengthSq; + XMVECTOR RcpLength; + XMVECTOR Length; + XMVECTOR Normal; + XMVECTOR InfiniteLength; + XMVECTOR ZeroLength; + XMVECTOR Select; + XMVECTOR ControlMax; + XMVECTOR ControlMin; + XMVECTOR Control; + XMVECTOR Result; + + XMASSERT((XMVectorGetY(LengthMin) == XMVectorGetX(LengthMin)) && (XMVectorGetZ(LengthMin) == XMVectorGetX(LengthMin))); + XMASSERT((XMVectorGetY(LengthMax) == XMVectorGetX(LengthMax)) && (XMVectorGetZ(LengthMax) == XMVectorGetX(LengthMax))); + XMASSERT(XMVector3GreaterOrEqual(LengthMin, g_XMZero)); + XMASSERT(XMVector3GreaterOrEqual(LengthMax, g_XMZero)); + XMASSERT(XMVector3GreaterOrEqual(LengthMax, LengthMin)); + + LengthSq = XMVector3LengthSq(V); + RcpLength = XMVectorReciprocalSqrt(LengthSq); + InfiniteLength = XMVectorEqualInt(LengthSq, g_XMInfinity); + ZeroLength = XMVectorEqual(LengthSq,g_XMZero); + Normal = _mm_mul_ps(V, RcpLength); + Length = _mm_mul_ps(LengthSq, RcpLength); + Select = XMVectorEqualInt(InfiniteLength, ZeroLength); + Length = XMVectorSelect(LengthSq, Length, Select); + Normal = XMVectorSelect(LengthSq, Normal, Select); + ControlMax = XMVectorGreater(Length, LengthMax); + ControlMin = XMVectorLess(Length, LengthMin); + ClampLength = XMVectorSelect(Length, LengthMax, ControlMax); + ClampLength = XMVectorSelect(ClampLength, LengthMin, ControlMin); + Result = _mm_mul_ps(Normal, ClampLength); + // Preserve the original vector (with no precision loss) if the length falls within the given range + Control = XMVectorEqualInt(ControlMax, ControlMin); + Result = XMVectorSelect(Result, V, Control); + return Result; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector3Reflect +( + FXMVECTOR Incident, + FXMVECTOR Normal +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Result; + + // Result = Incident - (2 * dot(Incident, Normal)) * Normal + Result = XMVector3Dot(Incident, Normal); + Result = XMVectorAdd(Result, Result); + Result = XMVectorNegativeMultiplySubtract(Result, Normal, Incident); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + // Result = Incident - (2 * dot(Incident, Normal)) * Normal + XMVECTOR Result = XMVector3Dot(Incident, Normal); + Result = _mm_add_ps(Result, Result); + Result = _mm_mul_ps(Result, Normal); + Result = _mm_sub_ps(Incident,Result); + return Result; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector3Refract +( + FXMVECTOR Incident, + FXMVECTOR Normal, + FLOAT RefractionIndex +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Index; + Index = XMVectorReplicate(RefractionIndex); + return XMVector3RefractV(Incident, Normal, Index); + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR Index = _mm_set_ps1(RefractionIndex); + return XMVector3RefractV(Incident,Normal,Index); +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector3RefractV +( + FXMVECTOR Incident, + FXMVECTOR Normal, + FXMVECTOR RefractionIndex +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR IDotN; + XMVECTOR R; + CONST XMVECTOR Zero = XMVectorZero(); + + // Result = RefractionIndex * Incident - Normal * (RefractionIndex * dot(Incident, Normal) + + // sqrt(1 - RefractionIndex * RefractionIndex * (1 - dot(Incident, Normal) * dot(Incident, Normal)))) + + IDotN = XMVector3Dot(Incident, Normal); + + // R = 1.0f - RefractionIndex * RefractionIndex * (1.0f - IDotN * IDotN) + R = XMVectorNegativeMultiplySubtract(IDotN, IDotN, g_XMOne.v); + R = XMVectorMultiply(R, RefractionIndex); + R = XMVectorNegativeMultiplySubtract(R, RefractionIndex, g_XMOne.v); + + if (XMVector4LessOrEqual(R, Zero)) + { + // Total internal reflection + return Zero; + } + else + { + XMVECTOR Result; + + // R = RefractionIndex * IDotN + sqrt(R) + R = XMVectorSqrt(R); + R = XMVectorMultiplyAdd(RefractionIndex, IDotN, R); + + // Result = RefractionIndex * Incident - Normal * R + Result = XMVectorMultiply(RefractionIndex, Incident); + Result = XMVectorNegativeMultiplySubtract(Normal, R, Result); + + return Result; + } + +#elif defined(_XM_SSE_INTRINSICS_) + // Result = RefractionIndex * Incident - Normal * (RefractionIndex * dot(Incident, Normal) + + // sqrt(1 - RefractionIndex * RefractionIndex * (1 - dot(Incident, Normal) * dot(Incident, Normal)))) + XMVECTOR IDotN = XMVector3Dot(Incident, Normal); + // R = 1.0f - RefractionIndex * RefractionIndex * (1.0f - IDotN * IDotN) + XMVECTOR R = _mm_mul_ps(IDotN, IDotN); + R = _mm_sub_ps(g_XMOne,R); + R = _mm_mul_ps(R, RefractionIndex); + R = _mm_mul_ps(R, RefractionIndex); + R = _mm_sub_ps(g_XMOne,R); + + XMVECTOR vResult = _mm_cmple_ps(R,g_XMZero); + if (_mm_movemask_ps(vResult)==0x0f) + { + // Total internal reflection + vResult = g_XMZero; + } + else + { + // R = RefractionIndex * IDotN + sqrt(R) + R = _mm_sqrt_ps(R); + vResult = _mm_mul_ps(RefractionIndex,IDotN); + R = _mm_add_ps(R,vResult); + // Result = RefractionIndex * Incident - Normal * R + vResult = _mm_mul_ps(RefractionIndex, Incident); + R = _mm_mul_ps(R,Normal); + vResult = _mm_sub_ps(vResult,R); + } + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector3Orthogonal +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR NegativeV; + XMVECTOR Z, YZYY; + XMVECTOR ZIsNegative, YZYYIsNegative; + XMVECTOR S, D; + XMVECTOR R0, R1; + XMVECTOR Select; + XMVECTOR Zero; + XMVECTOR Result; + static CONST XMVECTORU32 Permute1X0X0X0X = {XM_PERMUTE_1X, XM_PERMUTE_0X, XM_PERMUTE_0X, XM_PERMUTE_0X}; + static CONST XMVECTORU32 Permute0Y0Z0Y0Y= {XM_PERMUTE_0Y, XM_PERMUTE_0Z, XM_PERMUTE_0Y, XM_PERMUTE_0Y}; + + Zero = XMVectorZero(); + Z = XMVectorSplatZ(V); + YZYY = XMVectorPermute(V, V, Permute0Y0Z0Y0Y.v); + + NegativeV = XMVectorSubtract(Zero, V); + + ZIsNegative = XMVectorLess(Z, Zero); + YZYYIsNegative = XMVectorLess(YZYY, Zero); + + S = XMVectorAdd(YZYY, Z); + D = XMVectorSubtract(YZYY, Z); + + Select = XMVectorEqualInt(ZIsNegative, YZYYIsNegative); + + R0 = XMVectorPermute(NegativeV, S, Permute1X0X0X0X.v); + R1 = XMVectorPermute(V, D, Permute1X0X0X0X.v); + + Result = XMVectorSelect(R1, R0, Select); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR NegativeV; + XMVECTOR Z, YZYY; + XMVECTOR ZIsNegative, YZYYIsNegative; + XMVECTOR S, D; + XMVECTOR R0, R1; + XMVECTOR Select; + XMVECTOR Zero; + XMVECTOR Result; + static CONST XMVECTORI32 Permute1X0X0X0X = {XM_PERMUTE_1X, XM_PERMUTE_0X, XM_PERMUTE_0X, XM_PERMUTE_0X}; + static CONST XMVECTORI32 Permute0Y0Z0Y0Y= {XM_PERMUTE_0Y, XM_PERMUTE_0Z, XM_PERMUTE_0Y, XM_PERMUTE_0Y}; + + Zero = XMVectorZero(); + Z = XMVectorSplatZ(V); + YZYY = XMVectorPermute(V, V, Permute0Y0Z0Y0Y); + + NegativeV = _mm_sub_ps(Zero, V); + + ZIsNegative = XMVectorLess(Z, Zero); + YZYYIsNegative = XMVectorLess(YZYY, Zero); + + S = _mm_add_ps(YZYY, Z); + D = _mm_sub_ps(YZYY, Z); + + Select = XMVectorEqualInt(ZIsNegative, YZYYIsNegative); + + R0 = XMVectorPermute(NegativeV, S, Permute1X0X0X0X); + R1 = XMVectorPermute(V, D,Permute1X0X0X0X); + Result = XMVectorSelect(R1, R0, Select); + return Result; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector3AngleBetweenNormalsEst +( + FXMVECTOR N1, + FXMVECTOR N2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Result; + XMVECTOR NegativeOne; + XMVECTOR One; + + Result = XMVector3Dot(N1, N2); + NegativeOne = XMVectorSplatConstant(-1, 0); + One = XMVectorSplatOne(); + Result = XMVectorClamp(Result, NegativeOne, One); + Result = XMVectorACosEst(Result); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vResult = XMVector3Dot(N1,N2); + // Clamp to -1.0f to 1.0f + vResult = _mm_max_ps(vResult,g_XMNegativeOne); + vResult = _mm_min_ps(vResult,g_XMOne); + vResult = XMVectorACosEst(vResult); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector3AngleBetweenNormals +( + FXMVECTOR N1, + FXMVECTOR N2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Result; + XMVECTOR NegativeOne; + XMVECTOR One; + + Result = XMVector3Dot(N1, N2); + NegativeOne = XMVectorSplatConstant(-1, 0); + One = XMVectorSplatOne(); + Result = XMVectorClamp(Result, NegativeOne, One); + Result = XMVectorACos(Result); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vResult = XMVector3Dot(N1,N2); + // Clamp to -1.0f to 1.0f + vResult = _mm_max_ps(vResult,g_XMNegativeOne); + vResult = _mm_min_ps(vResult,g_XMOne); + vResult = XMVectorACos(vResult); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector3AngleBetweenVectors +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR L1; + XMVECTOR L2; + XMVECTOR Dot; + XMVECTOR CosAngle; + XMVECTOR NegativeOne; + XMVECTOR One; + XMVECTOR Result; + + L1 = XMVector3ReciprocalLength(V1); + L2 = XMVector3ReciprocalLength(V2); + + Dot = XMVector3Dot(V1, V2); + + L1 = XMVectorMultiply(L1, L2); + + NegativeOne = XMVectorSplatConstant(-1, 0); + One = XMVectorSplatOne(); + + CosAngle = XMVectorMultiply(Dot, L1); + + CosAngle = XMVectorClamp(CosAngle, NegativeOne, One); + + Result = XMVectorACos(CosAngle); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR L1; + XMVECTOR L2; + XMVECTOR Dot; + XMVECTOR CosAngle; + XMVECTOR Result; + + L1 = XMVector3ReciprocalLength(V1); + L2 = XMVector3ReciprocalLength(V2); + Dot = XMVector3Dot(V1, V2); + L1 = _mm_mul_ps(L1, L2); + CosAngle = _mm_mul_ps(Dot, L1); + CosAngle = XMVectorClamp(CosAngle,g_XMNegativeOne,g_XMOne); + Result = XMVectorACos(CosAngle); + return Result; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector3LinePointDistance +( + FXMVECTOR LinePoint1, + FXMVECTOR LinePoint2, + FXMVECTOR Point +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR PointVector; + XMVECTOR LineVector; + XMVECTOR ReciprocalLengthSq; + XMVECTOR PointProjectionScale; + XMVECTOR DistanceVector; + XMVECTOR Result; + + // Given a vector PointVector from LinePoint1 to Point and a vector + // LineVector from LinePoint1 to LinePoint2, the scaled distance + // PointProjectionScale from LinePoint1 to the perpendicular projection + // of PointVector onto the line is defined as: + // + // PointProjectionScale = dot(PointVector, LineVector) / LengthSq(LineVector) + + PointVector = XMVectorSubtract(Point, LinePoint1); + LineVector = XMVectorSubtract(LinePoint2, LinePoint1); + + ReciprocalLengthSq = XMVector3LengthSq(LineVector); + ReciprocalLengthSq = XMVectorReciprocal(ReciprocalLengthSq); + + PointProjectionScale = XMVector3Dot(PointVector, LineVector); + PointProjectionScale = XMVectorMultiply(PointProjectionScale, ReciprocalLengthSq); + + DistanceVector = XMVectorMultiply(LineVector, PointProjectionScale); + DistanceVector = XMVectorSubtract(PointVector, DistanceVector); + + Result = XMVector3Length(DistanceVector); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR PointVector = _mm_sub_ps(Point,LinePoint1); + XMVECTOR LineVector = _mm_sub_ps(LinePoint2,LinePoint1); + XMVECTOR ReciprocalLengthSq = XMVector3LengthSq(LineVector); + XMVECTOR vResult = XMVector3Dot(PointVector,LineVector); + vResult = _mm_div_ps(vResult,ReciprocalLengthSq); + vResult = _mm_mul_ps(vResult,LineVector); + vResult = _mm_sub_ps(PointVector,vResult); + vResult = XMVector3Length(vResult); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE VOID XMVector3ComponentsFromNormal +( + XMVECTOR* pParallel, + XMVECTOR* pPerpendicular, + FXMVECTOR V, + FXMVECTOR Normal +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Parallel; + XMVECTOR Scale; + + XMASSERT(pParallel); + XMASSERT(pPerpendicular); + + Scale = XMVector3Dot(V, Normal); + + Parallel = XMVectorMultiply(Normal, Scale); + + *pParallel = Parallel; + *pPerpendicular = XMVectorSubtract(V, Parallel); + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pParallel); + XMASSERT(pPerpendicular); + XMVECTOR Scale = XMVector3Dot(V, Normal); + XMVECTOR Parallel = _mm_mul_ps(Normal,Scale); + *pParallel = Parallel; + *pPerpendicular = _mm_sub_ps(V,Parallel); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ +// Transform a vector using a rotation expressed as a unit quaternion + +XMFINLINE XMVECTOR XMVector3Rotate +( + FXMVECTOR V, + FXMVECTOR RotationQuaternion +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR A; + XMVECTOR Q; + XMVECTOR Result; + + A = XMVectorSelect(g_XMSelect1110.v, V, g_XMSelect1110.v); + Q = XMQuaternionConjugate(RotationQuaternion); + Result = XMQuaternionMultiply(Q, A); + Result = XMQuaternionMultiply(Result, RotationQuaternion); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR A; + XMVECTOR Q; + XMVECTOR Result; + + A = _mm_and_ps(V,g_XMMask3); + Q = XMQuaternionConjugate(RotationQuaternion); + Result = XMQuaternionMultiply(Q, A); + Result = XMQuaternionMultiply(Result, RotationQuaternion); + return Result; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ +// Transform a vector using the inverse of a rotation expressed as a unit quaternion + +XMFINLINE XMVECTOR XMVector3InverseRotate +( + FXMVECTOR V, + FXMVECTOR RotationQuaternion +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR A; + XMVECTOR Q; + XMVECTOR Result; + + A = XMVectorSelect(g_XMSelect1110.v, V, g_XMSelect1110.v); + Result = XMQuaternionMultiply(RotationQuaternion, A); + Q = XMQuaternionConjugate(RotationQuaternion); + Result = XMQuaternionMultiply(Result, Q); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR A; + XMVECTOR Q; + XMVECTOR Result; + A = _mm_and_ps(V,g_XMMask3); + Result = XMQuaternionMultiply(RotationQuaternion, A); + Q = XMQuaternionConjugate(RotationQuaternion); + Result = XMQuaternionMultiply(Result, Q); + return Result; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector3Transform +( + FXMVECTOR V, + CXMMATRIX M +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR X; + XMVECTOR Y; + XMVECTOR Z; + XMVECTOR Result; + + Z = XMVectorSplatZ(V); + Y = XMVectorSplatY(V); + X = XMVectorSplatX(V); + + Result = XMVectorMultiplyAdd(Z, M.r[2], M.r[3]); + Result = XMVectorMultiplyAdd(Y, M.r[1], Result); + Result = XMVectorMultiplyAdd(X, M.r[0], Result); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vResult = _mm_shuffle_ps(V,V,_MM_SHUFFLE(0,0,0,0)); + vResult = _mm_mul_ps(vResult,M.r[0]); + XMVECTOR vTemp = _mm_shuffle_ps(V,V,_MM_SHUFFLE(1,1,1,1)); + vTemp = _mm_mul_ps(vTemp,M.r[1]); + vResult = _mm_add_ps(vResult,vTemp); + vTemp = _mm_shuffle_ps(V,V,_MM_SHUFFLE(2,2,2,2)); + vTemp = _mm_mul_ps(vTemp,M.r[2]); + vResult = _mm_add_ps(vResult,vTemp); + vResult = _mm_add_ps(vResult,M.r[3]); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMINLINE XMFLOAT4* XMVector3TransformStream +( + XMFLOAT4* pOutputStream, + UINT OutputStride, + CONST XMFLOAT3* pInputStream, + UINT InputStride, + UINT VectorCount, + CXMMATRIX M +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V; + XMVECTOR X; + XMVECTOR Y; + XMVECTOR Z; + XMVECTOR Result; + UINT i; + BYTE* pInputVector = (BYTE*)pInputStream; + BYTE* pOutputVector = (BYTE*)pOutputStream; + + XMASSERT(pOutputStream); + XMASSERT(pInputStream); + + for (i = 0; i < VectorCount; i++) + { + V = XMLoadFloat3((XMFLOAT3*)pInputVector); + Z = XMVectorSplatZ(V); + Y = XMVectorSplatY(V); + X = XMVectorSplatX(V); + + Result = XMVectorMultiplyAdd(Z, M.r[2], M.r[3]); + Result = XMVectorMultiplyAdd(Y, M.r[1], Result); + Result = XMVectorMultiplyAdd(X, M.r[0], Result); + + XMStoreFloat4((XMFLOAT4*)pOutputVector, Result); + + pInputVector += InputStride; + pOutputVector += OutputStride; + } + + return pOutputStream; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pOutputStream); + XMASSERT(pInputStream); + UINT i; + const BYTE* pInputVector = (const BYTE*)pInputStream; + BYTE* pOutputVector = (BYTE*)pOutputStream; + + for (i = 0; i < VectorCount; i++) + { + XMVECTOR X = _mm_load_ps1(&reinterpret_cast(pInputVector)->x); + XMVECTOR Y = _mm_load_ps1(&reinterpret_cast(pInputVector)->y); + XMVECTOR vResult = _mm_load_ps1(&reinterpret_cast(pInputVector)->z); + vResult = _mm_mul_ps(vResult,M.r[2]); + vResult = _mm_add_ps(vResult,M.r[3]); + Y = _mm_mul_ps(Y,M.r[1]); + vResult = _mm_add_ps(vResult,Y); + X = _mm_mul_ps(X,M.r[0]); + vResult = _mm_add_ps(vResult,X); + _mm_storeu_ps(reinterpret_cast(pOutputVector),vResult); + pInputVector += InputStride; + pOutputVector += OutputStride; + } + + return pOutputStream; +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMINLINE XMFLOAT4* XMVector3TransformStreamNC +( + XMFLOAT4* pOutputStream, + UINT OutputStride, + CONST XMFLOAT3* pInputStream, + UINT InputStride, + UINT VectorCount, + CXMMATRIX M +) +{ +#if defined(_XM_NO_INTRINSICS_) || defined(XM_NO_MISALIGNED_VECTOR_ACCESS) || defined(_XM_SSE_INTRINSICS_) + return XMVector3TransformStream( pOutputStream, OutputStride, pInputStream, InputStride, VectorCount, M ); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector3TransformCoord +( + FXMVECTOR V, + CXMMATRIX M +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR X; + XMVECTOR Y; + XMVECTOR Z; + XMVECTOR InverseW; + XMVECTOR Result; + + Z = XMVectorSplatZ(V); + Y = XMVectorSplatY(V); + X = XMVectorSplatX(V); + + Result = XMVectorMultiplyAdd(Z, M.r[2], M.r[3]); + Result = XMVectorMultiplyAdd(Y, M.r[1], Result); + Result = XMVectorMultiplyAdd(X, M.r[0], Result); + + InverseW = XMVectorSplatW(Result); + InverseW = XMVectorReciprocal(InverseW); + + Result = XMVectorMultiply(Result, InverseW); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vResult = _mm_shuffle_ps(V,V,_MM_SHUFFLE(0,0,0,0)); + vResult = _mm_mul_ps(vResult,M.r[0]); + XMVECTOR vTemp = _mm_shuffle_ps(V,V,_MM_SHUFFLE(1,1,1,1)); + vTemp = _mm_mul_ps(vTemp,M.r[1]); + vResult = _mm_add_ps(vResult,vTemp); + vTemp = _mm_shuffle_ps(V,V,_MM_SHUFFLE(2,2,2,2)); + vTemp = _mm_mul_ps(vTemp,M.r[2]); + vResult = _mm_add_ps(vResult,vTemp); + vResult = _mm_add_ps(vResult,M.r[3]); + vTemp = _mm_shuffle_ps(vResult,vResult,_MM_SHUFFLE(3,3,3,3)); + vResult = _mm_div_ps(vResult,vTemp); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMINLINE XMFLOAT3* XMVector3TransformCoordStream +( + XMFLOAT3* pOutputStream, + UINT OutputStride, + CONST XMFLOAT3* pInputStream, + UINT InputStride, + UINT VectorCount, + CXMMATRIX M +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V; + XMVECTOR X; + XMVECTOR Y; + XMVECTOR Z; + XMVECTOR InverseW; + XMVECTOR Result; + UINT i; + BYTE* pInputVector = (BYTE*)pInputStream; + BYTE* pOutputVector = (BYTE*)pOutputStream; + + XMASSERT(pOutputStream); + XMASSERT(pInputStream); + + for (i = 0; i < VectorCount; i++) + { + V = XMLoadFloat3((XMFLOAT3*)pInputVector); + Z = XMVectorSplatZ(V); + Y = XMVectorSplatY(V); + X = XMVectorSplatX(V); +// Z = XMVectorReplicate(((XMFLOAT3*)pInputVector)->z); +// Y = XMVectorReplicate(((XMFLOAT3*)pInputVector)->y); +// X = XMVectorReplicate(((XMFLOAT3*)pInputVector)->x); + + Result = XMVectorMultiplyAdd(Z, M.r[2], M.r[3]); + Result = XMVectorMultiplyAdd(Y, M.r[1], Result); + Result = XMVectorMultiplyAdd(X, M.r[0], Result); + + InverseW = XMVectorSplatW(Result); + InverseW = XMVectorReciprocal(InverseW); + + Result = XMVectorMultiply(Result, InverseW); + + XMStoreFloat3((XMFLOAT3*)pOutputVector, Result); + + pInputVector += InputStride; + pOutputVector += OutputStride; + } + + return pOutputStream; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pOutputStream); + XMASSERT(pInputStream); + + UINT i; + const BYTE *pInputVector = (BYTE*)pInputStream; + BYTE *pOutputVector = (BYTE*)pOutputStream; + + for (i = 0; i < VectorCount; i++) + { + XMVECTOR X = _mm_load_ps1(&reinterpret_cast(pInputVector)->x); + XMVECTOR Y = _mm_load_ps1(&reinterpret_cast(pInputVector)->y); + XMVECTOR vResult = _mm_load_ps1(&reinterpret_cast(pInputVector)->z); + vResult = _mm_mul_ps(vResult,M.r[2]); + vResult = _mm_add_ps(vResult,M.r[3]); + Y = _mm_mul_ps(Y,M.r[1]); + vResult = _mm_add_ps(vResult,Y); + X = _mm_mul_ps(X,M.r[0]); + vResult = _mm_add_ps(vResult,X); + + X = _mm_shuffle_ps(vResult,vResult,_MM_SHUFFLE(3,3,3,3)); + vResult = _mm_div_ps(vResult,X); + _mm_store_ss(&reinterpret_cast(pOutputVector)->x,vResult); + vResult = _mm_shuffle_ps(vResult,vResult,_MM_SHUFFLE(0,3,2,1)); + _mm_store_ss(&reinterpret_cast(pOutputVector)->y,vResult); + vResult = _mm_shuffle_ps(vResult,vResult,_MM_SHUFFLE(0,3,2,1)); + _mm_store_ss(&reinterpret_cast(pOutputVector)->z,vResult); + pInputVector += InputStride; + pOutputVector += OutputStride; + } + + return pOutputStream; +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector3TransformNormal +( + FXMVECTOR V, + CXMMATRIX M +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR X; + XMVECTOR Y; + XMVECTOR Z; + XMVECTOR Result; + + Z = XMVectorSplatZ(V); + Y = XMVectorSplatY(V); + X = XMVectorSplatX(V); + + Result = XMVectorMultiply(Z, M.r[2]); + Result = XMVectorMultiplyAdd(Y, M.r[1], Result); + Result = XMVectorMultiplyAdd(X, M.r[0], Result); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vResult = _mm_shuffle_ps(V,V,_MM_SHUFFLE(0,0,0,0)); + vResult = _mm_mul_ps(vResult,M.r[0]); + XMVECTOR vTemp = _mm_shuffle_ps(V,V,_MM_SHUFFLE(1,1,1,1)); + vTemp = _mm_mul_ps(vTemp,M.r[1]); + vResult = _mm_add_ps(vResult,vTemp); + vTemp = _mm_shuffle_ps(V,V,_MM_SHUFFLE(2,2,2,2)); + vTemp = _mm_mul_ps(vTemp,M.r[2]); + vResult = _mm_add_ps(vResult,vTemp); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMINLINE XMFLOAT3* XMVector3TransformNormalStream +( + XMFLOAT3* pOutputStream, + UINT OutputStride, + CONST XMFLOAT3* pInputStream, + UINT InputStride, + UINT VectorCount, + CXMMATRIX M +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V; + XMVECTOR X; + XMVECTOR Y; + XMVECTOR Z; + XMVECTOR Result; + UINT i; + BYTE* pInputVector = (BYTE*)pInputStream; + BYTE* pOutputVector = (BYTE*)pOutputStream; + + XMASSERT(pOutputStream); + XMASSERT(pInputStream); + + for (i = 0; i < VectorCount; i++) + { + V = XMLoadFloat3((XMFLOAT3*)pInputVector); + Z = XMVectorSplatZ(V); + Y = XMVectorSplatY(V); + X = XMVectorSplatX(V); +// Z = XMVectorReplicate(((XMFLOAT3*)pInputVector)->z); +// Y = XMVectorReplicate(((XMFLOAT3*)pInputVector)->y); +// X = XMVectorReplicate(((XMFLOAT3*)pInputVector)->x); + + Result = XMVectorMultiply(Z, M.r[2]); + Result = XMVectorMultiplyAdd(Y, M.r[1], Result); + Result = XMVectorMultiplyAdd(X, M.r[0], Result); + + XMStoreFloat3((XMFLOAT3*)pOutputVector, Result); + + pInputVector += InputStride; + pOutputVector += OutputStride; + } + + return pOutputStream; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pOutputStream); + XMASSERT(pInputStream); + + UINT i; + const BYTE *pInputVector = (BYTE*)pInputStream; + BYTE *pOutputVector = (BYTE*)pOutputStream; + + for (i = 0; i < VectorCount; i++) + { + XMVECTOR X = _mm_load_ps1(&reinterpret_cast(pInputVector)->x); + XMVECTOR Y = _mm_load_ps1(&reinterpret_cast(pInputVector)->y); + XMVECTOR vResult = _mm_load_ps1(&reinterpret_cast(pInputVector)->z); + vResult = _mm_mul_ps(vResult,M.r[2]); + Y = _mm_mul_ps(Y,M.r[1]); + vResult = _mm_add_ps(vResult,Y); + X = _mm_mul_ps(X,M.r[0]); + vResult = _mm_add_ps(vResult,X); + _mm_store_ss(&reinterpret_cast(pOutputVector)->x,vResult); + vResult = _mm_shuffle_ps(vResult,vResult,_MM_SHUFFLE(0,3,2,1)); + _mm_store_ss(&reinterpret_cast(pOutputVector)->y,vResult); + vResult = _mm_shuffle_ps(vResult,vResult,_MM_SHUFFLE(0,3,2,1)); + _mm_store_ss(&reinterpret_cast(pOutputVector)->z,vResult); + pInputVector += InputStride; + pOutputVector += OutputStride; + } + + return pOutputStream; +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMINLINE XMVECTOR XMVector3Project +( + FXMVECTOR V, + FLOAT ViewportX, + FLOAT ViewportY, + FLOAT ViewportWidth, + FLOAT ViewportHeight, + FLOAT ViewportMinZ, + FLOAT ViewportMaxZ, + CXMMATRIX Projection, + CXMMATRIX View, + CXMMATRIX World +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMMATRIX Transform; + XMVECTOR Scale; + XMVECTOR Offset; + XMVECTOR Result; + FLOAT HalfViewportWidth = ViewportWidth * 0.5f; + FLOAT HalfViewportHeight = ViewportHeight * 0.5f; + + Scale = XMVectorSet(HalfViewportWidth, + -HalfViewportHeight, + ViewportMaxZ - ViewportMinZ, + 0.0f); + + Offset = XMVectorSet(ViewportX + HalfViewportWidth, + ViewportY + HalfViewportHeight, + ViewportMinZ, + 0.0f); + + Transform = XMMatrixMultiply(World, View); + Transform = XMMatrixMultiply(Transform, Projection); + + Result = XMVector3TransformCoord(V, Transform); + + Result = XMVectorMultiplyAdd(Result, Scale, Offset); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + XMMATRIX Transform; + XMVECTOR Scale; + XMVECTOR Offset; + XMVECTOR Result; + FLOAT HalfViewportWidth = ViewportWidth * 0.5f; + FLOAT HalfViewportHeight = ViewportHeight * 0.5f; + + Scale = XMVectorSet(HalfViewportWidth, + -HalfViewportHeight, + ViewportMaxZ - ViewportMinZ, + 0.0f); + + Offset = XMVectorSet(ViewportX + HalfViewportWidth, + ViewportY + HalfViewportHeight, + ViewportMinZ, + 0.0f); + Transform = XMMatrixMultiply(World, View); + Transform = XMMatrixMultiply(Transform, Projection); + Result = XMVector3TransformCoord(V, Transform); + Result = _mm_mul_ps(Result,Scale); + Result = _mm_add_ps(Result,Offset); + return Result; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMINLINE XMFLOAT3* XMVector3ProjectStream +( + XMFLOAT3* pOutputStream, + UINT OutputStride, + CONST XMFLOAT3* pInputStream, + UINT InputStride, + UINT VectorCount, + FLOAT ViewportX, + FLOAT ViewportY, + FLOAT ViewportWidth, + FLOAT ViewportHeight, + FLOAT ViewportMinZ, + FLOAT ViewportMaxZ, + CXMMATRIX Projection, + CXMMATRIX View, + CXMMATRIX World +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMMATRIX Transform; + XMVECTOR V; + XMVECTOR Scale; + XMVECTOR Offset; + XMVECTOR Result; + UINT i; + FLOAT HalfViewportWidth = ViewportWidth * 0.5f; + FLOAT HalfViewportHeight = ViewportHeight * 0.5f; + BYTE* pInputVector = (BYTE*)pInputStream; + BYTE* pOutputVector = (BYTE*)pOutputStream; + + XMASSERT(pOutputStream); + XMASSERT(pInputStream); + + Scale = XMVectorSet(HalfViewportWidth, + -HalfViewportHeight, + ViewportMaxZ - ViewportMinZ, + 1.0f); + + Offset = XMVectorSet(ViewportX + HalfViewportWidth, + ViewportY + HalfViewportHeight, + ViewportMinZ, + 0.0f); + + Transform = XMMatrixMultiply(World, View); + Transform = XMMatrixMultiply(Transform, Projection); + + for (i = 0; i < VectorCount; i++) + { + V = XMLoadFloat3((XMFLOAT3*)pInputVector); + + Result = XMVector3TransformCoord(V, Transform); + + Result = XMVectorMultiplyAdd(Result, Scale, Offset); + + XMStoreFloat3((XMFLOAT3*)pOutputVector, Result); + + pInputVector += InputStride; + pOutputVector += OutputStride; + } + + return pOutputStream; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pOutputStream); + XMASSERT(pInputStream); + XMMATRIX Transform; + XMVECTOR V; + XMVECTOR Scale; + XMVECTOR Offset; + XMVECTOR Result; + UINT i; + FLOAT HalfViewportWidth = ViewportWidth * 0.5f; + FLOAT HalfViewportHeight = ViewportHeight * 0.5f; + BYTE* pInputVector = (BYTE*)pInputStream; + BYTE* pOutputVector = (BYTE*)pOutputStream; + + Scale = XMVectorSet(HalfViewportWidth, + -HalfViewportHeight, + ViewportMaxZ - ViewportMinZ, + 1.0f); + + Offset = XMVectorSet(ViewportX + HalfViewportWidth, + ViewportY + HalfViewportHeight, + ViewportMinZ, + 0.0f); + + Transform = XMMatrixMultiply(World, View); + Transform = XMMatrixMultiply(Transform, Projection); + + for (i = 0; i < VectorCount; i++) + { + V = XMLoadFloat3((XMFLOAT3*)pInputVector); + + Result = XMVector3TransformCoord(V, Transform); + + Result = _mm_mul_ps(Result,Scale); + Result = _mm_add_ps(Result,Offset); + XMStoreFloat3((XMFLOAT3*)pOutputVector, Result); + pInputVector += InputStride; + pOutputVector += OutputStride; + } + return pOutputStream; + +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector3Unproject +( + FXMVECTOR V, + FLOAT ViewportX, + FLOAT ViewportY, + FLOAT ViewportWidth, + FLOAT ViewportHeight, + FLOAT ViewportMinZ, + FLOAT ViewportMaxZ, + CXMMATRIX Projection, + CXMMATRIX View, + CXMMATRIX World +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMMATRIX Transform; + XMVECTOR Scale; + XMVECTOR Offset; + XMVECTOR Determinant; + XMVECTOR Result; + CONST XMVECTOR D = XMVectorSet(-1.0f, 1.0f, 0.0f, 0.0f); + + Scale = XMVectorSet(ViewportWidth * 0.5f, + -ViewportHeight * 0.5f, + ViewportMaxZ - ViewportMinZ, + 1.0f); + Scale = XMVectorReciprocal(Scale); + + Offset = XMVectorSet(-ViewportX, + -ViewportY, + -ViewportMinZ, + 0.0f); + Offset = XMVectorMultiplyAdd(Scale, Offset, D); + + Transform = XMMatrixMultiply(World, View); + Transform = XMMatrixMultiply(Transform, Projection); + Transform = XMMatrixInverse(&Determinant, Transform); + + Result = XMVectorMultiplyAdd(V, Scale, Offset); + + Result = XMVector3TransformCoord(Result, Transform); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + XMMATRIX Transform; + XMVECTOR Scale; + XMVECTOR Offset; + XMVECTOR Determinant; + XMVECTOR Result; + CONST XMVECTORF32 D = {-1.0f, 1.0f, 0.0f, 0.0f}; + + Scale = XMVectorSet(ViewportWidth * 0.5f, + -ViewportHeight * 0.5f, + ViewportMaxZ - ViewportMinZ, + 1.0f); + Scale = XMVectorReciprocal(Scale); + + Offset = XMVectorSet(-ViewportX, + -ViewportY, + -ViewportMinZ, + 0.0f); + Offset = _mm_mul_ps(Offset,Scale); + Offset = _mm_add_ps(Offset,D); + + Transform = XMMatrixMultiply(World, View); + Transform = XMMatrixMultiply(Transform, Projection); + Transform = XMMatrixInverse(&Determinant, Transform); + + Result = _mm_mul_ps(V,Scale); + Result = _mm_add_ps(Result,Offset); + + Result = XMVector3TransformCoord(Result, Transform); + + return Result; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMINLINE XMFLOAT3* XMVector3UnprojectStream +( + XMFLOAT3* pOutputStream, + UINT OutputStride, + CONST XMFLOAT3* pInputStream, + UINT InputStride, + UINT VectorCount, + FLOAT ViewportX, + FLOAT ViewportY, + FLOAT ViewportWidth, + FLOAT ViewportHeight, + FLOAT ViewportMinZ, + FLOAT ViewportMaxZ, + CXMMATRIX Projection, + CXMMATRIX View, + CXMMATRIX World) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMMATRIX Transform; + XMVECTOR Scale; + XMVECTOR Offset; + XMVECTOR V; + XMVECTOR Determinant; + XMVECTOR Result; + UINT i; + BYTE* pInputVector = (BYTE*)pInputStream; + BYTE* pOutputVector = (BYTE*)pOutputStream; + CONST XMVECTOR D = XMVectorSet(-1.0f, 1.0f, 0.0f, 0.0f); + + XMASSERT(pOutputStream); + XMASSERT(pInputStream); + + Scale = XMVectorSet(ViewportWidth * 0.5f, + -ViewportHeight * 0.5f, + ViewportMaxZ - ViewportMinZ, + 1.0f); + Scale = XMVectorReciprocal(Scale); + + Offset = XMVectorSet(-ViewportX, + -ViewportY, + -ViewportMinZ, + 0.0f); + Offset = XMVectorMultiplyAdd(Scale, Offset, D); + + Transform = XMMatrixMultiply(World, View); + Transform = XMMatrixMultiply(Transform, Projection); + Transform = XMMatrixInverse(&Determinant, Transform); + + for (i = 0; i < VectorCount; i++) + { + V = XMLoadFloat3((XMFLOAT3*)pInputVector); + + Result = XMVectorMultiplyAdd(V, Scale, Offset); + + Result = XMVector3TransformCoord(Result, Transform); + + XMStoreFloat3((XMFLOAT3*)pOutputVector, Result); + + pInputVector += InputStride; + pOutputVector += OutputStride; + } + + return pOutputStream; + +#elif defined(_XM_SSE_INTRINSICS_) + XMASSERT(pOutputStream); + XMASSERT(pInputStream); + XMMATRIX Transform; + XMVECTOR Scale; + XMVECTOR Offset; + XMVECTOR V; + XMVECTOR Determinant; + XMVECTOR Result; + UINT i; + BYTE* pInputVector = (BYTE*)pInputStream; + BYTE* pOutputVector = (BYTE*)pOutputStream; + CONST XMVECTORF32 D = {-1.0f, 1.0f, 0.0f, 0.0f}; + + Scale = XMVectorSet(ViewportWidth * 0.5f, + -ViewportHeight * 0.5f, + ViewportMaxZ - ViewportMinZ, + 1.0f); + Scale = XMVectorReciprocal(Scale); + + Offset = XMVectorSet(-ViewportX, + -ViewportY, + -ViewportMinZ, + 0.0f); + Offset = _mm_mul_ps(Offset,Scale); + Offset = _mm_add_ps(Offset,D); + + Transform = XMMatrixMultiply(World, View); + Transform = XMMatrixMultiply(Transform, Projection); + Transform = XMMatrixInverse(&Determinant, Transform); + + for (i = 0; i < VectorCount; i++) + { + V = XMLoadFloat3((XMFLOAT3*)pInputVector); + + Result = XMVectorMultiplyAdd(V, Scale, Offset); + + Result = XMVector3TransformCoord(Result, Transform); + + XMStoreFloat3((XMFLOAT3*)pOutputVector, Result); + + pInputVector += InputStride; + pOutputVector += OutputStride; + } + + return pOutputStream; +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +/**************************************************************************** + * + * 4D Vector + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ +// Comparison operations +//------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------ + +XMFINLINE BOOL XMVector4Equal +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + return (((V1.vector4_f32[0] == V2.vector4_f32[0]) && (V1.vector4_f32[1] == V2.vector4_f32[1]) && (V1.vector4_f32[2] == V2.vector4_f32[2]) && (V1.vector4_f32[3] == V2.vector4_f32[3])) != 0); +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vTemp = _mm_cmpeq_ps(V1,V2); + return ((_mm_movemask_ps(vTemp)==0x0f) != 0); +#else + return XMComparisonAllTrue(XMVector4EqualR(V1, V2)); +#endif +} + +//------------------------------------------------------------------------------ + +XMFINLINE UINT XMVector4EqualR +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + + UINT CR = 0; + + if ((V1.vector4_f32[0] == V2.vector4_f32[0]) && + (V1.vector4_f32[1] == V2.vector4_f32[1]) && + (V1.vector4_f32[2] == V2.vector4_f32[2]) && + (V1.vector4_f32[3] == V2.vector4_f32[3])) + { + CR = XM_CRMASK_CR6TRUE; + } + else if ((V1.vector4_f32[0] != V2.vector4_f32[0]) && + (V1.vector4_f32[1] != V2.vector4_f32[1]) && + (V1.vector4_f32[2] != V2.vector4_f32[2]) && + (V1.vector4_f32[3] != V2.vector4_f32[3])) + { + CR = XM_CRMASK_CR6FALSE; + } + return CR; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vTemp = _mm_cmpeq_ps(V1,V2); + int iTest = _mm_movemask_ps(vTemp); + UINT CR = 0; + if (iTest==0xf) // All equal? + { + CR = XM_CRMASK_CR6TRUE; + } + else if (iTest==0) // All not equal? + { + CR = XM_CRMASK_CR6FALSE; + } + return CR; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE BOOL XMVector4EqualInt +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + return (((V1.vector4_u32[0] == V2.vector4_u32[0]) && (V1.vector4_u32[1] == V2.vector4_u32[1]) && (V1.vector4_u32[2] == V2.vector4_u32[2]) && (V1.vector4_u32[3] == V2.vector4_u32[3])) != 0); +#elif defined(_XM_SSE_INTRINSICS_) + __m128i vTemp = _mm_cmpeq_epi32(reinterpret_cast(&V1)[0],reinterpret_cast(&V2)[0]); + return ((_mm_movemask_ps(reinterpret_cast(&vTemp)[0])==0xf) != 0); +#else + return XMComparisonAllTrue(XMVector4EqualIntR(V1, V2)); +#endif +} + +//------------------------------------------------------------------------------ + +XMFINLINE UINT XMVector4EqualIntR +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + UINT CR = 0; + if (V1.vector4_u32[0] == V2.vector4_u32[0] && + V1.vector4_u32[1] == V2.vector4_u32[1] && + V1.vector4_u32[2] == V2.vector4_u32[2] && + V1.vector4_u32[3] == V2.vector4_u32[3]) + { + CR = XM_CRMASK_CR6TRUE; + } + else if (V1.vector4_u32[0] != V2.vector4_u32[0] && + V1.vector4_u32[1] != V2.vector4_u32[1] && + V1.vector4_u32[2] != V2.vector4_u32[2] && + V1.vector4_u32[3] != V2.vector4_u32[3]) + { + CR = XM_CRMASK_CR6FALSE; + } + return CR; + +#elif defined(_XM_SSE_INTRINSICS_) + __m128i vTemp = _mm_cmpeq_epi32(reinterpret_cast(&V1)[0],reinterpret_cast(&V2)[0]); + int iTest = _mm_movemask_ps(reinterpret_cast(&vTemp)[0]); + UINT CR = 0; + if (iTest==0xf) // All equal? + { + CR = XM_CRMASK_CR6TRUE; + } + else if (iTest==0) // All not equal? + { + CR = XM_CRMASK_CR6FALSE; + } + return CR; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +XMFINLINE BOOL XMVector4NearEqual +( + FXMVECTOR V1, + FXMVECTOR V2, + FXMVECTOR Epsilon +) +{ +#if defined(_XM_NO_INTRINSICS_) + FLOAT dx, dy, dz, dw; + + dx = fabsf(V1.vector4_f32[0]-V2.vector4_f32[0]); + dy = fabsf(V1.vector4_f32[1]-V2.vector4_f32[1]); + dz = fabsf(V1.vector4_f32[2]-V2.vector4_f32[2]); + dw = fabsf(V1.vector4_f32[3]-V2.vector4_f32[3]); + return (((dx <= Epsilon.vector4_f32[0]) && + (dy <= Epsilon.vector4_f32[1]) && + (dz <= Epsilon.vector4_f32[2]) && + (dw <= Epsilon.vector4_f32[3])) != 0); +#elif defined(_XM_SSE_INTRINSICS_) + // Get the difference + XMVECTOR vDelta = _mm_sub_ps(V1,V2); + // Get the absolute value of the difference + XMVECTOR vTemp = _mm_setzero_ps(); + vTemp = _mm_sub_ps(vTemp,vDelta); + vTemp = _mm_max_ps(vTemp,vDelta); + vTemp = _mm_cmple_ps(vTemp,Epsilon); + return ((_mm_movemask_ps(vTemp)==0xf) != 0); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE BOOL XMVector4NotEqual +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + return (((V1.vector4_f32[0] != V2.vector4_f32[0]) || (V1.vector4_f32[1] != V2.vector4_f32[1]) || (V1.vector4_f32[2] != V2.vector4_f32[2]) || (V1.vector4_f32[3] != V2.vector4_f32[3])) != 0); +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vTemp = _mm_cmpneq_ps(V1,V2); + return ((_mm_movemask_ps(vTemp)) != 0); +#else + return XMComparisonAnyFalse(XMVector4EqualR(V1, V2)); +#endif +} + +//------------------------------------------------------------------------------ + +XMFINLINE BOOL XMVector4NotEqualInt +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + return (((V1.vector4_u32[0] != V2.vector4_u32[0]) || (V1.vector4_u32[1] != V2.vector4_u32[1]) || (V1.vector4_u32[2] != V2.vector4_u32[2]) || (V1.vector4_u32[3] != V2.vector4_u32[3])) != 0); +#elif defined(_XM_SSE_INTRINSICS_) + __m128i vTemp = _mm_cmpeq_epi32(reinterpret_cast(&V1)[0],reinterpret_cast(&V2)[0]); + return ((_mm_movemask_ps(reinterpret_cast(&vTemp)[0])!=0xF) != 0); +#else + return XMComparisonAnyFalse(XMVector4EqualIntR(V1, V2)); +#endif +} + +//------------------------------------------------------------------------------ + +XMFINLINE BOOL XMVector4Greater +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + return (((V1.vector4_f32[0] > V2.vector4_f32[0]) && (V1.vector4_f32[1] > V2.vector4_f32[1]) && (V1.vector4_f32[2] > V2.vector4_f32[2]) && (V1.vector4_f32[3] > V2.vector4_f32[3])) != 0); +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vTemp = _mm_cmpgt_ps(V1,V2); + return ((_mm_movemask_ps(vTemp)==0x0f) != 0); +#else + return XMComparisonAllTrue(XMVector4GreaterR(V1, V2)); +#endif +} + +//------------------------------------------------------------------------------ + +XMFINLINE UINT XMVector4GreaterR +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + UINT CR = 0; + if (V1.vector4_f32[0] > V2.vector4_f32[0] && + V1.vector4_f32[1] > V2.vector4_f32[1] && + V1.vector4_f32[2] > V2.vector4_f32[2] && + V1.vector4_f32[3] > V2.vector4_f32[3]) + { + CR = XM_CRMASK_CR6TRUE; + } + else if (V1.vector4_f32[0] <= V2.vector4_f32[0] && + V1.vector4_f32[1] <= V2.vector4_f32[1] && + V1.vector4_f32[2] <= V2.vector4_f32[2] && + V1.vector4_f32[3] <= V2.vector4_f32[3]) + { + CR = XM_CRMASK_CR6FALSE; + } + return CR; + +#elif defined(_XM_SSE_INTRINSICS_) + UINT CR = 0; + XMVECTOR vTemp = _mm_cmpgt_ps(V1,V2); + int iTest = _mm_movemask_ps(vTemp); + if (iTest==0xf) { + CR = XM_CRMASK_CR6TRUE; + } + else if (!iTest) + { + CR = XM_CRMASK_CR6FALSE; + } + return CR; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE BOOL XMVector4GreaterOrEqual +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + return (((V1.vector4_f32[0] >= V2.vector4_f32[0]) && (V1.vector4_f32[1] >= V2.vector4_f32[1]) && (V1.vector4_f32[2] >= V2.vector4_f32[2]) && (V1.vector4_f32[3] >= V2.vector4_f32[3])) != 0); +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vTemp = _mm_cmpge_ps(V1,V2); + return ((_mm_movemask_ps(vTemp)==0x0f) != 0); +#else + return XMComparisonAllTrue(XMVector4GreaterOrEqualR(V1, V2)); +#endif +} + +//------------------------------------------------------------------------------ + +XMFINLINE UINT XMVector4GreaterOrEqualR +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + UINT CR = 0; + if ((V1.vector4_f32[0] >= V2.vector4_f32[0]) && + (V1.vector4_f32[1] >= V2.vector4_f32[1]) && + (V1.vector4_f32[2] >= V2.vector4_f32[2]) && + (V1.vector4_f32[3] >= V2.vector4_f32[3])) + { + CR = XM_CRMASK_CR6TRUE; + } + else if ((V1.vector4_f32[0] < V2.vector4_f32[0]) && + (V1.vector4_f32[1] < V2.vector4_f32[1]) && + (V1.vector4_f32[2] < V2.vector4_f32[2]) && + (V1.vector4_f32[3] < V2.vector4_f32[3])) + { + CR = XM_CRMASK_CR6FALSE; + } + return CR; + +#elif defined(_XM_SSE_INTRINSICS_) + UINT CR = 0; + XMVECTOR vTemp = _mm_cmpge_ps(V1,V2); + int iTest = _mm_movemask_ps(vTemp); + if (iTest==0x0f) + { + CR = XM_CRMASK_CR6TRUE; + } + else if (!iTest) + { + CR = XM_CRMASK_CR6FALSE; + } + return CR; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE BOOL XMVector4Less +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + return (((V1.vector4_f32[0] < V2.vector4_f32[0]) && (V1.vector4_f32[1] < V2.vector4_f32[1]) && (V1.vector4_f32[2] < V2.vector4_f32[2]) && (V1.vector4_f32[3] < V2.vector4_f32[3])) != 0); +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vTemp = _mm_cmplt_ps(V1,V2); + return ((_mm_movemask_ps(vTemp)==0x0f) != 0); +#else + return XMComparisonAllTrue(XMVector4GreaterR(V2, V1)); +#endif +} + +//------------------------------------------------------------------------------ + +XMFINLINE BOOL XMVector4LessOrEqual +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + return (((V1.vector4_f32[0] <= V2.vector4_f32[0]) && (V1.vector4_f32[1] <= V2.vector4_f32[1]) && (V1.vector4_f32[2] <= V2.vector4_f32[2]) && (V1.vector4_f32[3] <= V2.vector4_f32[3])) != 0); +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vTemp = _mm_cmple_ps(V1,V2); + return ((_mm_movemask_ps(vTemp)==0x0f) != 0); +#else + return XMComparisonAllTrue(XMVector4GreaterOrEqualR(V2, V1)); +#endif +} + +//------------------------------------------------------------------------------ + +XMFINLINE BOOL XMVector4InBounds +( + FXMVECTOR V, + FXMVECTOR Bounds +) +{ +#if defined(_XM_NO_INTRINSICS_) + return (((V.vector4_f32[0] <= Bounds.vector4_f32[0] && V.vector4_f32[0] >= -Bounds.vector4_f32[0]) && + (V.vector4_f32[1] <= Bounds.vector4_f32[1] && V.vector4_f32[1] >= -Bounds.vector4_f32[1]) && + (V.vector4_f32[2] <= Bounds.vector4_f32[2] && V.vector4_f32[2] >= -Bounds.vector4_f32[2]) && + (V.vector4_f32[3] <= Bounds.vector4_f32[3] && V.vector4_f32[3] >= -Bounds.vector4_f32[3])) != 0); +#elif defined(_XM_SSE_INTRINSICS_) + // Test if less than or equal + XMVECTOR vTemp1 = _mm_cmple_ps(V,Bounds); + // Negate the bounds + XMVECTOR vTemp2 = _mm_mul_ps(Bounds,g_XMNegativeOne); + // Test if greater or equal (Reversed) + vTemp2 = _mm_cmple_ps(vTemp2,V); + // Blend answers + vTemp1 = _mm_and_ps(vTemp1,vTemp2); + // All in bounds? + return ((_mm_movemask_ps(vTemp1)==0x0f) != 0); +#else + return XMComparisonAllInBounds(XMVector4InBoundsR(V, Bounds)); +#endif +} + +//------------------------------------------------------------------------------ + +XMFINLINE UINT XMVector4InBoundsR +( + FXMVECTOR V, + FXMVECTOR Bounds +) +{ +#if defined(_XM_NO_INTRINSICS_) + + UINT CR = 0; + if ((V.vector4_f32[0] <= Bounds.vector4_f32[0] && V.vector4_f32[0] >= -Bounds.vector4_f32[0]) && + (V.vector4_f32[1] <= Bounds.vector4_f32[1] && V.vector4_f32[1] >= -Bounds.vector4_f32[1]) && + (V.vector4_f32[2] <= Bounds.vector4_f32[2] && V.vector4_f32[2] >= -Bounds.vector4_f32[2]) && + (V.vector4_f32[3] <= Bounds.vector4_f32[3] && V.vector4_f32[3] >= -Bounds.vector4_f32[3])) + { + CR = XM_CRMASK_CR6BOUNDS; + } + return CR; + +#elif defined(_XM_SSE_INTRINSICS_) + // Test if less than or equal + XMVECTOR vTemp1 = _mm_cmple_ps(V,Bounds); + // Negate the bounds + XMVECTOR vTemp2 = _mm_mul_ps(Bounds,g_XMNegativeOne); + // Test if greater or equal (Reversed) + vTemp2 = _mm_cmple_ps(vTemp2,V); + // Blend answers + vTemp1 = _mm_and_ps(vTemp1,vTemp2); + // All in bounds? + return (_mm_movemask_ps(vTemp1)==0x0f) ? XM_CRMASK_CR6BOUNDS : 0; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE BOOL XMVector4IsNaN +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + return (XMISNAN(V.vector4_f32[0]) || + XMISNAN(V.vector4_f32[1]) || + XMISNAN(V.vector4_f32[2]) || + XMISNAN(V.vector4_f32[3])); +#elif defined(_XM_SSE_INTRINSICS_) + // Test against itself. NaN is always not equal + XMVECTOR vTempNan = _mm_cmpneq_ps(V,V); + // If any are NaN, the mask is non-zero + return (_mm_movemask_ps(vTempNan)!=0); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE BOOL XMVector4IsInfinite +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + return (XMISINF(V.vector4_f32[0]) || + XMISINF(V.vector4_f32[1]) || + XMISINF(V.vector4_f32[2]) || + XMISINF(V.vector4_f32[3])); + +#elif defined(_XM_SSE_INTRINSICS_) + // Mask off the sign bit + XMVECTOR vTemp = _mm_and_ps(V,g_XMAbsMask); + // Compare to infinity + vTemp = _mm_cmpeq_ps(vTemp,g_XMInfinity); + // If any are infinity, the signs are true. + return (_mm_movemask_ps(vTemp) != 0); +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ +// Computation operations +//------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector4Dot +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Result; + + Result.vector4_f32[0] = + Result.vector4_f32[1] = + Result.vector4_f32[2] = + Result.vector4_f32[3] = V1.vector4_f32[0] * V2.vector4_f32[0] + V1.vector4_f32[1] * V2.vector4_f32[1] + V1.vector4_f32[2] * V2.vector4_f32[2] + V1.vector4_f32[3] * V2.vector4_f32[3]; + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vTemp2 = V2; + XMVECTOR vTemp = _mm_mul_ps(V1,vTemp2); + vTemp2 = _mm_shuffle_ps(vTemp2,vTemp,_MM_SHUFFLE(1,0,0,0)); // Copy X to the Z position and Y to the W position + vTemp2 = _mm_add_ps(vTemp2,vTemp); // Add Z = X+Z; W = Y+W; + vTemp = _mm_shuffle_ps(vTemp,vTemp2,_MM_SHUFFLE(0,3,0,0)); // Copy W to the Z position + vTemp = _mm_add_ps(vTemp,vTemp2); // Add Z and W together + return _mm_shuffle_ps(vTemp,vTemp,_MM_SHUFFLE(2,2,2,2)); // Splat Z and return +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector4Cross +( + FXMVECTOR V1, + FXMVECTOR V2, + FXMVECTOR V3 +) +{ +#if defined(_XM_NO_INTRINSICS_) + XMVECTOR Result; + + Result.vector4_f32[0] = (((V2.vector4_f32[2]*V3.vector4_f32[3])-(V2.vector4_f32[3]*V3.vector4_f32[2]))*V1.vector4_f32[1])-(((V2.vector4_f32[1]*V3.vector4_f32[3])-(V2.vector4_f32[3]*V3.vector4_f32[1]))*V1.vector4_f32[2])+(((V2.vector4_f32[1]*V3.vector4_f32[2])-(V2.vector4_f32[2]*V3.vector4_f32[1]))*V1.vector4_f32[3]); + Result.vector4_f32[1] = (((V2.vector4_f32[3]*V3.vector4_f32[2])-(V2.vector4_f32[2]*V3.vector4_f32[3]))*V1.vector4_f32[0])-(((V2.vector4_f32[3]*V3.vector4_f32[0])-(V2.vector4_f32[0]*V3.vector4_f32[3]))*V1.vector4_f32[2])+(((V2.vector4_f32[2]*V3.vector4_f32[0])-(V2.vector4_f32[0]*V3.vector4_f32[2]))*V1.vector4_f32[3]); + Result.vector4_f32[2] = (((V2.vector4_f32[1]*V3.vector4_f32[3])-(V2.vector4_f32[3]*V3.vector4_f32[1]))*V1.vector4_f32[0])-(((V2.vector4_f32[0]*V3.vector4_f32[3])-(V2.vector4_f32[3]*V3.vector4_f32[0]))*V1.vector4_f32[1])+(((V2.vector4_f32[0]*V3.vector4_f32[1])-(V2.vector4_f32[1]*V3.vector4_f32[0]))*V1.vector4_f32[3]); + Result.vector4_f32[3] = (((V2.vector4_f32[2]*V3.vector4_f32[1])-(V2.vector4_f32[1]*V3.vector4_f32[2]))*V1.vector4_f32[0])-(((V2.vector4_f32[2]*V3.vector4_f32[0])-(V2.vector4_f32[0]*V3.vector4_f32[2]))*V1.vector4_f32[1])+(((V2.vector4_f32[1]*V3.vector4_f32[0])-(V2.vector4_f32[0]*V3.vector4_f32[1]))*V1.vector4_f32[2]); + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + // V2zwyz * V3wzwy + XMVECTOR vResult = _mm_shuffle_ps(V2,V2,_MM_SHUFFLE(2,1,3,2)); + XMVECTOR vTemp3 = _mm_shuffle_ps(V3,V3,_MM_SHUFFLE(1,3,2,3)); + vResult = _mm_mul_ps(vResult,vTemp3); + // - V2wzwy * V3zwyz + XMVECTOR vTemp2 = _mm_shuffle_ps(V2,V2,_MM_SHUFFLE(1,3,2,3)); + vTemp3 = _mm_shuffle_ps(vTemp3,vTemp3,_MM_SHUFFLE(1,3,0,1)); + vTemp2 = _mm_mul_ps(vTemp2,vTemp3); + vResult = _mm_sub_ps(vResult,vTemp2); + // term1 * V1yxxx + XMVECTOR vTemp1 = _mm_shuffle_ps(V1,V1,_MM_SHUFFLE(0,0,0,1)); + vResult = _mm_mul_ps(vResult,vTemp1); + + // V2ywxz * V3wxwx + vTemp2 = _mm_shuffle_ps(V2,V2,_MM_SHUFFLE(2,0,3,1)); + vTemp3 = _mm_shuffle_ps(V3,V3,_MM_SHUFFLE(0,3,0,3)); + vTemp3 = _mm_mul_ps(vTemp3,vTemp2); + // - V2wxwx * V3ywxz + vTemp2 = _mm_shuffle_ps(vTemp2,vTemp2,_MM_SHUFFLE(2,1,2,1)); + vTemp1 = _mm_shuffle_ps(V3,V3,_MM_SHUFFLE(2,0,3,1)); + vTemp2 = _mm_mul_ps(vTemp2,vTemp1); + vTemp3 = _mm_sub_ps(vTemp3,vTemp2); + // vResult - temp * V1zzyy + vTemp1 = _mm_shuffle_ps(V1,V1,_MM_SHUFFLE(1,1,2,2)); + vTemp1 = _mm_mul_ps(vTemp1,vTemp3); + vResult = _mm_sub_ps(vResult,vTemp1); + + // V2yzxy * V3zxyx + vTemp2 = _mm_shuffle_ps(V2,V2,_MM_SHUFFLE(1,0,2,1)); + vTemp3 = _mm_shuffle_ps(V3,V3,_MM_SHUFFLE(0,1,0,2)); + vTemp3 = _mm_mul_ps(vTemp3,vTemp2); + // - V2zxyx * V3yzxy + vTemp2 = _mm_shuffle_ps(vTemp2,vTemp2,_MM_SHUFFLE(2,0,2,1)); + vTemp1 = _mm_shuffle_ps(V3,V3,_MM_SHUFFLE(1,0,2,1)); + vTemp1 = _mm_mul_ps(vTemp1,vTemp2); + vTemp3 = _mm_sub_ps(vTemp3,vTemp1); + // vResult + term * V1wwwz + vTemp1 = _mm_shuffle_ps(V1,V1,_MM_SHUFFLE(2,3,3,3)); + vTemp3 = _mm_mul_ps(vTemp3,vTemp1); + vResult = _mm_add_ps(vResult,vTemp3); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector4LengthSq +( + FXMVECTOR V +) +{ + return XMVector4Dot(V, V); +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector4ReciprocalLengthEst +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Result; + + Result = XMVector4LengthSq(V); + Result = XMVectorReciprocalSqrtEst(Result); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + // Perform the dot product on x,y,z and w + XMVECTOR vLengthSq = _mm_mul_ps(V,V); + // vTemp has z and w + XMVECTOR vTemp = _mm_shuffle_ps(vLengthSq,vLengthSq,_MM_SHUFFLE(3,2,3,2)); + // x+z, y+w + vLengthSq = _mm_add_ps(vLengthSq,vTemp); + // x+z,x+z,x+z,y+w + vLengthSq = _mm_shuffle_ps(vLengthSq,vLengthSq,_MM_SHUFFLE(1,0,0,0)); + // ??,??,y+w,y+w + vTemp = _mm_shuffle_ps(vTemp,vLengthSq,_MM_SHUFFLE(3,3,0,0)); + // ??,??,x+z+y+w,?? + vLengthSq = _mm_add_ps(vLengthSq,vTemp); + // Splat the length + vLengthSq = _mm_shuffle_ps(vLengthSq,vLengthSq,_MM_SHUFFLE(2,2,2,2)); + // Get the reciprocal + vLengthSq = _mm_rsqrt_ps(vLengthSq); + return vLengthSq; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector4ReciprocalLength +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Result; + + Result = XMVector4LengthSq(V); + Result = XMVectorReciprocalSqrt(Result); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + // Perform the dot product on x,y,z and w + XMVECTOR vLengthSq = _mm_mul_ps(V,V); + // vTemp has z and w + XMVECTOR vTemp = _mm_shuffle_ps(vLengthSq,vLengthSq,_MM_SHUFFLE(3,2,3,2)); + // x+z, y+w + vLengthSq = _mm_add_ps(vLengthSq,vTemp); + // x+z,x+z,x+z,y+w + vLengthSq = _mm_shuffle_ps(vLengthSq,vLengthSq,_MM_SHUFFLE(1,0,0,0)); + // ??,??,y+w,y+w + vTemp = _mm_shuffle_ps(vTemp,vLengthSq,_MM_SHUFFLE(3,3,0,0)); + // ??,??,x+z+y+w,?? + vLengthSq = _mm_add_ps(vLengthSq,vTemp); + // Splat the length + vLengthSq = _mm_shuffle_ps(vLengthSq,vLengthSq,_MM_SHUFFLE(2,2,2,2)); + // Get the reciprocal + vLengthSq = _mm_sqrt_ps(vLengthSq); + // Accurate! + vLengthSq = _mm_div_ps(g_XMOne,vLengthSq); + return vLengthSq; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector4LengthEst +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Result; + + Result = XMVector4LengthSq(V); + Result = XMVectorSqrtEst(Result); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + // Perform the dot product on x,y,z and w + XMVECTOR vLengthSq = _mm_mul_ps(V,V); + // vTemp has z and w + XMVECTOR vTemp = _mm_shuffle_ps(vLengthSq,vLengthSq,_MM_SHUFFLE(3,2,3,2)); + // x+z, y+w + vLengthSq = _mm_add_ps(vLengthSq,vTemp); + // x+z,x+z,x+z,y+w + vLengthSq = _mm_shuffle_ps(vLengthSq,vLengthSq,_MM_SHUFFLE(1,0,0,0)); + // ??,??,y+w,y+w + vTemp = _mm_shuffle_ps(vTemp,vLengthSq,_MM_SHUFFLE(3,3,0,0)); + // ??,??,x+z+y+w,?? + vLengthSq = _mm_add_ps(vLengthSq,vTemp); + // Splat the length + vLengthSq = _mm_shuffle_ps(vLengthSq,vLengthSq,_MM_SHUFFLE(2,2,2,2)); + // Prepare for the division + vLengthSq = _mm_sqrt_ps(vLengthSq); + return vLengthSq; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector4Length +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Result; + + Result = XMVector4LengthSq(V); + Result = XMVectorSqrt(Result); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + // Perform the dot product on x,y,z and w + XMVECTOR vLengthSq = _mm_mul_ps(V,V); + // vTemp has z and w + XMVECTOR vTemp = _mm_shuffle_ps(vLengthSq,vLengthSq,_MM_SHUFFLE(3,2,3,2)); + // x+z, y+w + vLengthSq = _mm_add_ps(vLengthSq,vTemp); + // x+z,x+z,x+z,y+w + vLengthSq = _mm_shuffle_ps(vLengthSq,vLengthSq,_MM_SHUFFLE(1,0,0,0)); + // ??,??,y+w,y+w + vTemp = _mm_shuffle_ps(vTemp,vLengthSq,_MM_SHUFFLE(3,3,0,0)); + // ??,??,x+z+y+w,?? + vLengthSq = _mm_add_ps(vLengthSq,vTemp); + // Splat the length + vLengthSq = _mm_shuffle_ps(vLengthSq,vLengthSq,_MM_SHUFFLE(2,2,2,2)); + // Prepare for the division + vLengthSq = _mm_sqrt_ps(vLengthSq); + return vLengthSq; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ +// XMVector4NormalizeEst uses a reciprocal estimate and +// returns QNaN on zero and infinite vectors. + +XMFINLINE XMVECTOR XMVector4NormalizeEst +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Result; + Result = XMVector4ReciprocalLength(V); + Result = XMVectorMultiply(V, Result); + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + // Perform the dot product on x,y,z and w + XMVECTOR vLengthSq = _mm_mul_ps(V,V); + // vTemp has z and w + XMVECTOR vTemp = _mm_shuffle_ps(vLengthSq,vLengthSq,_MM_SHUFFLE(3,2,3,2)); + // x+z, y+w + vLengthSq = _mm_add_ps(vLengthSq,vTemp); + // x+z,x+z,x+z,y+w + vLengthSq = _mm_shuffle_ps(vLengthSq,vLengthSq,_MM_SHUFFLE(1,0,0,0)); + // ??,??,y+w,y+w + vTemp = _mm_shuffle_ps(vTemp,vLengthSq,_MM_SHUFFLE(3,3,0,0)); + // ??,??,x+z+y+w,?? + vLengthSq = _mm_add_ps(vLengthSq,vTemp); + // Splat the length + vLengthSq = _mm_shuffle_ps(vLengthSq,vLengthSq,_MM_SHUFFLE(2,2,2,2)); + // Get the reciprocal + XMVECTOR vResult = _mm_rsqrt_ps(vLengthSq); + // Reciprocal mul to perform the normalization + vResult = _mm_mul_ps(vResult,V); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector4Normalize +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + FLOAT fLength; + XMVECTOR vResult; + + vResult = XMVector4Length( V ); + fLength = vResult.vector4_f32[0]; + + // Prevent divide by zero + if (fLength > 0) { + fLength = 1.0f/fLength; + } + + vResult.vector4_f32[0] = V.vector4_f32[0]*fLength; + vResult.vector4_f32[1] = V.vector4_f32[1]*fLength; + vResult.vector4_f32[2] = V.vector4_f32[2]*fLength; + vResult.vector4_f32[3] = V.vector4_f32[3]*fLength; + return vResult; + +#elif defined(_XM_SSE_INTRINSICS_) + // Perform the dot product on x,y,z and w + XMVECTOR vLengthSq = _mm_mul_ps(V,V); + // vTemp has z and w + XMVECTOR vTemp = _mm_shuffle_ps(vLengthSq,vLengthSq,_MM_SHUFFLE(3,2,3,2)); + // x+z, y+w + vLengthSq = _mm_add_ps(vLengthSq,vTemp); + // x+z,x+z,x+z,y+w + vLengthSq = _mm_shuffle_ps(vLengthSq,vLengthSq,_MM_SHUFFLE(1,0,0,0)); + // ??,??,y+w,y+w + vTemp = _mm_shuffle_ps(vTemp,vLengthSq,_MM_SHUFFLE(3,3,0,0)); + // ??,??,x+z+y+w,?? + vLengthSq = _mm_add_ps(vLengthSq,vTemp); + // Splat the length + vLengthSq = _mm_shuffle_ps(vLengthSq,vLengthSq,_MM_SHUFFLE(2,2,2,2)); + // Prepare for the division + XMVECTOR vResult = _mm_sqrt_ps(vLengthSq); + // Create zero with a single instruction + XMVECTOR vZeroMask = _mm_setzero_ps(); + // Test for a divide by zero (Must be FP to detect -0.0) + vZeroMask = _mm_cmpneq_ps(vZeroMask,vResult); + // Failsafe on zero (Or epsilon) length planes + // If the length is infinity, set the elements to zero + vLengthSq = _mm_cmpneq_ps(vLengthSq,g_XMInfinity); + // Divide to perform the normalization + vResult = _mm_div_ps(V,vResult); + // Any that are infinity, set to zero + vResult = _mm_and_ps(vResult,vZeroMask); + // Select qnan or result based on infinite length + XMVECTOR vTemp1 = _mm_andnot_ps(vLengthSq,g_XMQNaN); + XMVECTOR vTemp2 = _mm_and_ps(vResult,vLengthSq); + vResult = _mm_or_ps(vTemp1,vTemp2); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector4ClampLength +( + FXMVECTOR V, + FLOAT LengthMin, + FLOAT LengthMax +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR ClampMax; + XMVECTOR ClampMin; + + ClampMax = XMVectorReplicate(LengthMax); + ClampMin = XMVectorReplicate(LengthMin); + + return XMVector4ClampLengthV(V, ClampMin, ClampMax); + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR ClampMax = _mm_set_ps1(LengthMax); + XMVECTOR ClampMin = _mm_set_ps1(LengthMin); + return XMVector4ClampLengthV(V, ClampMin, ClampMax); +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector4ClampLengthV +( + FXMVECTOR V, + FXMVECTOR LengthMin, + FXMVECTOR LengthMax +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR ClampLength; + XMVECTOR LengthSq; + XMVECTOR RcpLength; + XMVECTOR Length; + XMVECTOR Normal; + XMVECTOR Zero; + XMVECTOR InfiniteLength; + XMVECTOR ZeroLength; + XMVECTOR Select; + XMVECTOR ControlMax; + XMVECTOR ControlMin; + XMVECTOR Control; + XMVECTOR Result; + + XMASSERT((LengthMin.vector4_f32[1] == LengthMin.vector4_f32[0]) && (LengthMin.vector4_f32[2] == LengthMin.vector4_f32[0]) && (LengthMin.vector4_f32[3] == LengthMin.vector4_f32[0])); + XMASSERT((LengthMax.vector4_f32[1] == LengthMax.vector4_f32[0]) && (LengthMax.vector4_f32[2] == LengthMax.vector4_f32[0]) && (LengthMax.vector4_f32[3] == LengthMax.vector4_f32[0])); + XMASSERT(XMVector4GreaterOrEqual(LengthMin, XMVectorZero())); + XMASSERT(XMVector4GreaterOrEqual(LengthMax, XMVectorZero())); + XMASSERT(XMVector4GreaterOrEqual(LengthMax, LengthMin)); + + LengthSq = XMVector4LengthSq(V); + + Zero = XMVectorZero(); + + RcpLength = XMVectorReciprocalSqrt(LengthSq); + + InfiniteLength = XMVectorEqualInt(LengthSq, g_XMInfinity.v); + ZeroLength = XMVectorEqual(LengthSq, Zero); + + Normal = XMVectorMultiply(V, RcpLength); + + Length = XMVectorMultiply(LengthSq, RcpLength); + + Select = XMVectorEqualInt(InfiniteLength, ZeroLength); + Length = XMVectorSelect(LengthSq, Length, Select); + Normal = XMVectorSelect(LengthSq, Normal, Select); + + ControlMax = XMVectorGreater(Length, LengthMax); + ControlMin = XMVectorLess(Length, LengthMin); + + ClampLength = XMVectorSelect(Length, LengthMax, ControlMax); + ClampLength = XMVectorSelect(ClampLength, LengthMin, ControlMin); + + Result = XMVectorMultiply(Normal, ClampLength); + + // Preserve the original vector (with no precision loss) if the length falls within the given range + Control = XMVectorEqualInt(ControlMax, ControlMin); + Result = XMVectorSelect(Result, V, Control); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR ClampLength; + XMVECTOR LengthSq; + XMVECTOR RcpLength; + XMVECTOR Length; + XMVECTOR Normal; + XMVECTOR Zero; + XMVECTOR InfiniteLength; + XMVECTOR ZeroLength; + XMVECTOR Select; + XMVECTOR ControlMax; + XMVECTOR ControlMin; + XMVECTOR Control; + XMVECTOR Result; + + XMASSERT((XMVectorGetY(LengthMin) == XMVectorGetX(LengthMin)) && (XMVectorGetZ(LengthMin) == XMVectorGetX(LengthMin)) && (XMVectorGetW(LengthMin) == XMVectorGetX(LengthMin))); + XMASSERT((XMVectorGetY(LengthMax) == XMVectorGetX(LengthMax)) && (XMVectorGetZ(LengthMax) == XMVectorGetX(LengthMax)) && (XMVectorGetW(LengthMax) == XMVectorGetX(LengthMax))); + XMASSERT(XMVector4GreaterOrEqual(LengthMin, g_XMZero)); + XMASSERT(XMVector4GreaterOrEqual(LengthMax, g_XMZero)); + XMASSERT(XMVector4GreaterOrEqual(LengthMax, LengthMin)); + + LengthSq = XMVector4LengthSq(V); + Zero = XMVectorZero(); + RcpLength = XMVectorReciprocalSqrt(LengthSq); + InfiniteLength = XMVectorEqualInt(LengthSq, g_XMInfinity); + ZeroLength = XMVectorEqual(LengthSq, Zero); + Normal = _mm_mul_ps(V, RcpLength); + Length = _mm_mul_ps(LengthSq, RcpLength); + Select = XMVectorEqualInt(InfiniteLength, ZeroLength); + Length = XMVectorSelect(LengthSq, Length, Select); + Normal = XMVectorSelect(LengthSq, Normal, Select); + ControlMax = XMVectorGreater(Length, LengthMax); + ControlMin = XMVectorLess(Length, LengthMin); + ClampLength = XMVectorSelect(Length, LengthMax, ControlMax); + ClampLength = XMVectorSelect(ClampLength, LengthMin, ControlMin); + Result = _mm_mul_ps(Normal, ClampLength); + // Preserve the original vector (with no precision loss) if the length falls within the given range + Control = XMVectorEqualInt(ControlMax,ControlMin); + Result = XMVectorSelect(Result,V,Control); + return Result; + +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector4Reflect +( + FXMVECTOR Incident, + FXMVECTOR Normal +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Result; + + // Result = Incident - (2 * dot(Incident, Normal)) * Normal + Result = XMVector4Dot(Incident, Normal); + Result = XMVectorAdd(Result, Result); + Result = XMVectorNegativeMultiplySubtract(Result, Normal, Incident); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + // Result = Incident - (2 * dot(Incident, Normal)) * Normal + XMVECTOR Result = XMVector4Dot(Incident,Normal); + Result = _mm_add_ps(Result,Result); + Result = _mm_mul_ps(Result,Normal); + Result = _mm_sub_ps(Incident,Result); + return Result; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector4Refract +( + FXMVECTOR Incident, + FXMVECTOR Normal, + FLOAT RefractionIndex +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Index; + Index = XMVectorReplicate(RefractionIndex); + return XMVector4RefractV(Incident, Normal, Index); + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR Index = _mm_set_ps1(RefractionIndex); + return XMVector4RefractV(Incident,Normal,Index); +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector4RefractV +( + FXMVECTOR Incident, + FXMVECTOR Normal, + FXMVECTOR RefractionIndex +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR IDotN; + XMVECTOR R; + CONST XMVECTOR Zero = XMVectorZero(); + + // Result = RefractionIndex * Incident - Normal * (RefractionIndex * dot(Incident, Normal) + + // sqrt(1 - RefractionIndex * RefractionIndex * (1 - dot(Incident, Normal) * dot(Incident, Normal)))) + + IDotN = XMVector4Dot(Incident, Normal); + + // R = 1.0f - RefractionIndex * RefractionIndex * (1.0f - IDotN * IDotN) + R = XMVectorNegativeMultiplySubtract(IDotN, IDotN, g_XMOne.v); + R = XMVectorMultiply(R, RefractionIndex); + R = XMVectorNegativeMultiplySubtract(R, RefractionIndex, g_XMOne.v); + + if (XMVector4LessOrEqual(R, Zero)) + { + // Total internal reflection + return Zero; + } + else + { + XMVECTOR Result; + + // R = RefractionIndex * IDotN + sqrt(R) + R = XMVectorSqrt(R); + R = XMVectorMultiplyAdd(RefractionIndex, IDotN, R); + + // Result = RefractionIndex * Incident - Normal * R + Result = XMVectorMultiply(RefractionIndex, Incident); + Result = XMVectorNegativeMultiplySubtract(Normal, R, Result); + + return Result; + } + +#elif defined(_XM_SSE_INTRINSICS_) + // Result = RefractionIndex * Incident - Normal * (RefractionIndex * dot(Incident, Normal) + + // sqrt(1 - RefractionIndex * RefractionIndex * (1 - dot(Incident, Normal) * dot(Incident, Normal)))) + + XMVECTOR IDotN = XMVector4Dot(Incident,Normal); + + // R = 1.0f - RefractionIndex * RefractionIndex * (1.0f - IDotN * IDotN) + XMVECTOR R = _mm_mul_ps(IDotN,IDotN); + R = _mm_sub_ps(g_XMOne,R); + R = _mm_mul_ps(R, RefractionIndex); + R = _mm_mul_ps(R, RefractionIndex); + R = _mm_sub_ps(g_XMOne,R); + + XMVECTOR vResult = _mm_cmple_ps(R,g_XMZero); + if (_mm_movemask_ps(vResult)==0x0f) + { + // Total internal reflection + vResult = g_XMZero; + } + else + { + // R = RefractionIndex * IDotN + sqrt(R) + R = _mm_sqrt_ps(R); + vResult = _mm_mul_ps(RefractionIndex, IDotN); + R = _mm_add_ps(R,vResult); + // Result = RefractionIndex * Incident - Normal * R + vResult = _mm_mul_ps(RefractionIndex, Incident); + R = _mm_mul_ps(R,Normal); + vResult = _mm_sub_ps(vResult,R); + } + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector4Orthogonal +( + FXMVECTOR V +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR Result; + Result.vector4_f32[0] = V.vector4_f32[2]; + Result.vector4_f32[1] = V.vector4_f32[3]; + Result.vector4_f32[2] = -V.vector4_f32[0]; + Result.vector4_f32[3] = -V.vector4_f32[1]; + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + static const XMVECTORF32 FlipZW = {1.0f,1.0f,-1.0f,-1.0f}; + XMVECTOR vResult = _mm_shuffle_ps(V,V,_MM_SHUFFLE(1,0,3,2)); + vResult = _mm_mul_ps(vResult,FlipZW); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector4AngleBetweenNormalsEst +( + FXMVECTOR N1, + FXMVECTOR N2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR NegativeOne; + XMVECTOR One; + XMVECTOR Result; + + Result = XMVector4Dot(N1, N2); + NegativeOne = XMVectorSplatConstant(-1, 0); + One = XMVectorSplatOne(); + Result = XMVectorClamp(Result, NegativeOne, One); + Result = XMVectorACosEst(Result); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vResult = XMVector4Dot(N1,N2); + // Clamp to -1.0f to 1.0f + vResult = _mm_max_ps(vResult,g_XMNegativeOne); + vResult = _mm_min_ps(vResult,g_XMOne);; + vResult = XMVectorACosEst(vResult); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector4AngleBetweenNormals +( + FXMVECTOR N1, + FXMVECTOR N2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR NegativeOne; + XMVECTOR One; + XMVECTOR Result; + + Result = XMVector4Dot(N1, N2); + NegativeOne = XMVectorSplatConstant(-1, 0); + One = XMVectorSplatOne(); + Result = XMVectorClamp(Result, NegativeOne, One); + Result = XMVectorACos(Result); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR vResult = XMVector4Dot(N1,N2); + // Clamp to -1.0f to 1.0f + vResult = _mm_max_ps(vResult,g_XMNegativeOne); + vResult = _mm_min_ps(vResult,g_XMOne);; + vResult = XMVectorACos(vResult); + return vResult; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector4AngleBetweenVectors +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR L1; + XMVECTOR L2; + XMVECTOR Dot; + XMVECTOR CosAngle; + XMVECTOR NegativeOne; + XMVECTOR One; + XMVECTOR Result; + + L1 = XMVector4ReciprocalLength(V1); + L2 = XMVector4ReciprocalLength(V2); + + Dot = XMVector4Dot(V1, V2); + + L1 = XMVectorMultiply(L1, L2); + + CosAngle = XMVectorMultiply(Dot, L1); + NegativeOne = XMVectorSplatConstant(-1, 0); + One = XMVectorSplatOne(); + CosAngle = XMVectorClamp(CosAngle, NegativeOne, One); + + Result = XMVectorACos(CosAngle); + + return Result; + +#elif defined(_XM_SSE_INTRINSICS_) + XMVECTOR L1; + XMVECTOR L2; + XMVECTOR Dot; + XMVECTOR CosAngle; + XMVECTOR Result; + + L1 = XMVector4ReciprocalLength(V1); + L2 = XMVector4ReciprocalLength(V2); + Dot = XMVector4Dot(V1, V2); + L1 = _mm_mul_ps(L1,L2); + CosAngle = _mm_mul_ps(Dot,L1); + CosAngle = XMVectorClamp(CosAngle, g_XMNegativeOne, g_XMOne); + Result = XMVectorACos(CosAngle); + return Result; + +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR XMVector4Transform +( + FXMVECTOR V, + CXMMATRIX M +) +{ +#if defined(_XM_NO_INTRINSICS_) + FLOAT fX = (M.m[0][0]*V.vector4_f32[0])+(M.m[1][0]*V.vector4_f32[1])+(M.m[2][0]*V.vector4_f32[2])+(M.m[3][0]*V.vector4_f32[3]); + FLOAT fY = (M.m[0][1]*V.vector4_f32[0])+(M.m[1][1]*V.vector4_f32[1])+(M.m[2][1]*V.vector4_f32[2])+(M.m[3][1]*V.vector4_f32[3]); + FLOAT fZ = (M.m[0][2]*V.vector4_f32[0])+(M.m[1][2]*V.vector4_f32[1])+(M.m[2][2]*V.vector4_f32[2])+(M.m[3][2]*V.vector4_f32[3]); + FLOAT fW = (M.m[0][3]*V.vector4_f32[0])+(M.m[1][3]*V.vector4_f32[1])+(M.m[2][3]*V.vector4_f32[2])+(M.m[3][3]*V.vector4_f32[3]); + XMVECTOR vResult = { + fX, + fY, + fZ, + fW + }; + return vResult; + +#elif defined(_XM_SSE_INTRINSICS_) + // Splat x,y,z and w + XMVECTOR vTempX = _mm_shuffle_ps(V,V,_MM_SHUFFLE(0,0,0,0)); + XMVECTOR vTempY = _mm_shuffle_ps(V,V,_MM_SHUFFLE(1,1,1,1)); + XMVECTOR vTempZ = _mm_shuffle_ps(V,V,_MM_SHUFFLE(2,2,2,2)); + XMVECTOR vTempW = _mm_shuffle_ps(V,V,_MM_SHUFFLE(3,3,3,3)); + // Mul by the matrix + vTempX = _mm_mul_ps(vTempX,M.r[0]); + vTempY = _mm_mul_ps(vTempY,M.r[1]); + vTempZ = _mm_mul_ps(vTempZ,M.r[2]); + vTempW = _mm_mul_ps(vTempW,M.r[3]); + // Add them all together + vTempX = _mm_add_ps(vTempX,vTempY); + vTempZ = _mm_add_ps(vTempZ,vTempW); + vTempX = _mm_add_ps(vTempX,vTempZ); + return vTempX; +#else // _XM_VMX128_INTRINSICS_ +#endif // _XM_VMX128_INTRINSICS_ +} + +//------------------------------------------------------------------------------ + +XMINLINE XMFLOAT4* XMVector4TransformStream +( + XMFLOAT4* pOutputStream, + UINT OutputStride, + CONST XMFLOAT4* pInputStream, + UINT InputStride, + UINT VectorCount, + CXMMATRIX M +) +{ +#if defined(_XM_NO_INTRINSICS_) + + XMVECTOR V; + XMVECTOR X; + XMVECTOR Y; + XMVECTOR Z; + XMVECTOR W; + XMVECTOR Result; + UINT i; + BYTE* pInputVector = (BYTE*)pInputStream; + BYTE* pOutputVector = (BYTE*)pOutputStream; + + XMASSERT(pOutputStream); + XMASSERT(pInputStream); + + for (i = 0; i < VectorCount; i++) + { + V = XMLoadFloat4((XMFLOAT4*)pInputVector); + W = XMVectorSplatW(V); + Z = XMVectorSplatZ(V); + Y = XMVectorSplatY(V); + X = XMVectorSplatX(V); +// W = XMVectorReplicate(((XMFLOAT4*)pInputVector)->w); +// Z = XMVectorReplicate(((XMFLOAT4*)pInputVector)->z); +// Y = XMVectorReplicate(((XMFLOAT4*)pInputVector)->y); +// X = XMVectorReplicate(((XMFLOAT4*)pInputVector)->x); + + Result = XMVectorMultiply(W, M.r[3]); + Result = XMVectorMultiplyAdd(Z, M.r[2], Result); + Result = XMVectorMultiplyAdd(Y, M.r[1], Result); + Result = XMVectorMultiplyAdd(X, M.r[0], Result); + + XMStoreFloat4((XMFLOAT4*)pOutputVector, Result); + + pInputVector += InputStride; + pOutputVector += OutputStride; + } + + return pOutputStream; + +#elif defined(_XM_SSE_INTRINSICS_) + UINT i; + + XMASSERT(pOutputStream); + XMASSERT(pInputStream); + + const BYTE*pInputVector = reinterpret_cast(pInputStream); + BYTE* pOutputVector = reinterpret_cast(pOutputStream); + for (i = 0; i < VectorCount; i++) + { + // Fetch the row and splat it + XMVECTOR vTempx = _mm_loadu_ps(reinterpret_cast(pInputVector)); + XMVECTOR vTempy = _mm_shuffle_ps(vTempx,vTempx,_MM_SHUFFLE(1,1,1,1)); + XMVECTOR vTempz = _mm_shuffle_ps(vTempx,vTempx,_MM_SHUFFLE(2,2,2,2)); + XMVECTOR vTempw = _mm_shuffle_ps(vTempx,vTempx,_MM_SHUFFLE(3,3,3,3)); + vTempx = _mm_shuffle_ps(vTempx,vTempx,_MM_SHUFFLE(0,0,0,0)); + vTempx = _mm_mul_ps(vTempx,M.r[0]); + vTempy = _mm_mul_ps(vTempy,M.r[1]); + vTempz = _mm_mul_ps(vTempz,M.r[2]); + vTempw = _mm_mul_ps(vTempw,M.r[3]); + vTempx = _mm_add_ps(vTempx,vTempy); + vTempw = _mm_add_ps(vTempw,vTempz); + vTempw = _mm_add_ps(vTempw,vTempx); + // Store the transformed vector + _mm_storeu_ps(reinterpret_cast(pOutputVector),vTempw); + + pInputVector += InputStride; + pOutputVector += OutputStride; + } + return pOutputStream; +#elif defined(XM_NO_MISALIGNED_VECTOR_ACCESS) +#endif // _XM_VMX128_INTRINSICS_ +} + +#ifdef __cplusplus + +/**************************************************************************** + * + * XMVECTOR operators + * + ****************************************************************************/ + +#ifndef XM_NO_OPERATOR_OVERLOADS + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR operator+ (FXMVECTOR V) +{ + return V; +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR operator- (FXMVECTOR V) +{ + return XMVectorNegate(V); +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR& operator+= +( + XMVECTOR& V1, + FXMVECTOR V2 +) +{ + V1 = XMVectorAdd(V1, V2); + return V1; +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR& operator-= +( + XMVECTOR& V1, + FXMVECTOR V2 +) +{ + V1 = XMVectorSubtract(V1, V2); + return V1; +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR& operator*= +( + XMVECTOR& V1, + FXMVECTOR V2 +) +{ + V1 = XMVectorMultiply(V1, V2); + return V1; +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR& operator/= +( + XMVECTOR& V1, + FXMVECTOR V2 +) +{ + V1 = XMVectorDivide(V1,V2); + return V1; +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR& operator*= +( + XMVECTOR& V, + CONST FLOAT S +) +{ + V = XMVectorScale(V, S); + return V; +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR& operator/= +( + XMVECTOR& V, + CONST FLOAT S +) +{ + V = XMVectorScale(V, 1.0f / S); + return V; +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR operator+ +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ + return XMVectorAdd(V1, V2); +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR operator- +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ + return XMVectorSubtract(V1, V2); +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR operator* +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ + return XMVectorMultiply(V1, V2); +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR operator/ +( + FXMVECTOR V1, + FXMVECTOR V2 +) +{ + return XMVectorDivide(V1,V2); +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR operator* +( + FXMVECTOR V, + CONST FLOAT S +) +{ + return XMVectorScale(V, S); +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR operator/ +( + FXMVECTOR V, + CONST FLOAT S +) +{ + return XMVectorScale(V, 1.0f / S); +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMVECTOR operator* +( + FLOAT S, + FXMVECTOR V +) +{ + return XMVectorScale(V, S); +} + +#endif // !XM_NO_OPERATOR_OVERLOADS + +/**************************************************************************** + * + * XMFLOAT2 operators + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ + +XMFINLINE _XMFLOAT2::_XMFLOAT2 +( + CONST FLOAT* pArray +) +{ + x = pArray[0]; + y = pArray[1]; +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMFLOAT2& _XMFLOAT2::operator= +( + CONST _XMFLOAT2& Float2 +) +{ + x = Float2.x; + y = Float2.y; + return *this; +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMFLOAT2A& XMFLOAT2A::operator= +( + CONST XMFLOAT2A& Float2 +) +{ + x = Float2.x; + y = Float2.y; + return *this; +} + +/**************************************************************************** + * + * XMHALF2 operators + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ + +XMFINLINE _XMHALF2::_XMHALF2 +( + CONST HALF* pArray +) +{ + x = pArray[0]; + y = pArray[1]; +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMHALF2::_XMHALF2 +( + FLOAT _x, + FLOAT _y +) +{ + x = XMConvertFloatToHalf(_x); + y = XMConvertFloatToHalf(_y); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMHALF2::_XMHALF2 +( + CONST FLOAT* pArray +) +{ + x = XMConvertFloatToHalf(pArray[0]); + y = XMConvertFloatToHalf(pArray[1]); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMHALF2& _XMHALF2::operator= +( + CONST _XMHALF2& Half2 +) +{ + x = Half2.x; + y = Half2.y; + return *this; +} + +/**************************************************************************** + * + * XMSHORTN2 operators + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ + +XMFINLINE _XMSHORTN2::_XMSHORTN2 +( + CONST SHORT* pArray +) +{ + x = pArray[0]; + y = pArray[1]; +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMSHORTN2::_XMSHORTN2 +( + FLOAT _x, + FLOAT _y +) +{ + XMStoreShortN2(this, XMVectorSet(_x, _y, 0.0f, 0.0f)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMSHORTN2::_XMSHORTN2 +( + CONST FLOAT* pArray +) +{ + XMStoreShortN2(this, XMLoadFloat2((XMFLOAT2*)pArray)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMSHORTN2& _XMSHORTN2::operator= +( + CONST _XMSHORTN2& ShortN2 +) +{ + x = ShortN2.x; + y = ShortN2.y; + return *this; +} + +/**************************************************************************** + * + * XMSHORT2 operators + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ + +XMFINLINE _XMSHORT2::_XMSHORT2 +( + CONST SHORT* pArray +) +{ + x = pArray[0]; + y = pArray[1]; +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMSHORT2::_XMSHORT2 +( + FLOAT _x, + FLOAT _y +) +{ + XMStoreShort2(this, XMVectorSet(_x, _y, 0.0f, 0.0f)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMSHORT2::_XMSHORT2 +( + CONST FLOAT* pArray +) +{ + XMStoreShort2(this, XMLoadFloat2((XMFLOAT2*)pArray)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMSHORT2& _XMSHORT2::operator= +( + CONST _XMSHORT2& Short2 +) +{ + x = Short2.x; + y = Short2.y; + return *this; +} + +/**************************************************************************** + * + * XMUSHORTN2 operators + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUSHORTN2::_XMUSHORTN2 +( + CONST USHORT* pArray +) +{ + x = pArray[0]; + y = pArray[1]; +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUSHORTN2::_XMUSHORTN2 +( + FLOAT _x, + FLOAT _y +) +{ + XMStoreUShortN2(this, XMVectorSet(_x, _y, 0.0f, 0.0f)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUSHORTN2::_XMUSHORTN2 +( + CONST FLOAT* pArray +) +{ + XMStoreUShortN2(this, XMLoadFloat2((XMFLOAT2*)pArray)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUSHORTN2& _XMUSHORTN2::operator= +( + CONST _XMUSHORTN2& UShortN2 +) +{ + x = UShortN2.x; + y = UShortN2.y; + return *this; +} + +/**************************************************************************** + * + * XMUSHORT2 operators + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUSHORT2::_XMUSHORT2 +( + CONST USHORT* pArray +) +{ + x = pArray[0]; + y = pArray[1]; +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUSHORT2::_XMUSHORT2 +( + FLOAT _x, + FLOAT _y +) +{ + XMStoreUShort2(this, XMVectorSet(_x, _y, 0.0f, 0.0f)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUSHORT2::_XMUSHORT2 +( + CONST FLOAT* pArray +) +{ + XMStoreUShort2(this, XMLoadFloat2((XMFLOAT2*)pArray)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUSHORT2& _XMUSHORT2::operator= +( + CONST _XMUSHORT2& UShort2 +) +{ + x = UShort2.x; + y = UShort2.y; + return *this; +} + +/**************************************************************************** + * + * XMFLOAT3 operators + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ + +XMFINLINE _XMFLOAT3::_XMFLOAT3 +( + CONST FLOAT* pArray +) +{ + x = pArray[0]; + y = pArray[1]; + z = pArray[2]; +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMFLOAT3& _XMFLOAT3::operator= +( + CONST _XMFLOAT3& Float3 +) +{ + x = Float3.x; + y = Float3.y; + z = Float3.z; + return *this; +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMFLOAT3A& XMFLOAT3A::operator= +( + CONST XMFLOAT3A& Float3 +) +{ + x = Float3.x; + y = Float3.y; + z = Float3.z; + return *this; +} + +/**************************************************************************** + * + * XMHENDN3 operators + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ + +XMFINLINE _XMHENDN3::_XMHENDN3 +( + FLOAT _x, + FLOAT _y, + FLOAT _z +) +{ + XMStoreHenDN3(this, XMVectorSet(_x, _y, _z, 0.0f)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMHENDN3::_XMHENDN3 +( + CONST FLOAT* pArray +) +{ + XMStoreHenDN3(this, XMLoadFloat3((XMFLOAT3*)pArray)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMHENDN3& _XMHENDN3::operator= +( + CONST _XMHENDN3& HenDN3 +) +{ + v = HenDN3.v; + return *this; +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMHENDN3& _XMHENDN3::operator= +( + CONST UINT Packed +) +{ + v = Packed; + return *this; +} + +/**************************************************************************** + * + * XMHEND3 operators + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ + +XMFINLINE _XMHEND3::_XMHEND3 +( + FLOAT _x, + FLOAT _y, + FLOAT _z +) +{ + XMStoreHenD3(this, XMVectorSet(_x, _y, _z, 0.0f)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMHEND3::_XMHEND3 +( + CONST FLOAT* pArray +) +{ + XMStoreHenD3(this, XMLoadFloat3((XMFLOAT3*)pArray)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMHEND3& _XMHEND3::operator= +( + CONST _XMHEND3& HenD3 +) +{ + v = HenD3.v; + return *this; +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMHEND3& _XMHEND3::operator= +( + CONST UINT Packed +) +{ + v = Packed; + return *this; +} + +/**************************************************************************** + * + * XMUHENDN3 operators + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUHENDN3::_XMUHENDN3 +( + FLOAT _x, + FLOAT _y, + FLOAT _z +) +{ + XMStoreUHenDN3(this, XMVectorSet(_x, _y, _z, 0.0f)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUHENDN3::_XMUHENDN3 +( + CONST FLOAT* pArray +) +{ + XMStoreUHenDN3(this, XMLoadFloat3((XMFLOAT3*)pArray)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUHENDN3& _XMUHENDN3::operator= +( + CONST _XMUHENDN3& UHenDN3 +) +{ + v = UHenDN3.v; + return *this; +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUHENDN3& _XMUHENDN3::operator= +( + CONST UINT Packed +) +{ + v = Packed; + return *this; +} + +/**************************************************************************** + * + * XMUHEND3 operators + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUHEND3::_XMUHEND3 +( + FLOAT _x, + FLOAT _y, + FLOAT _z +) +{ + XMStoreUHenD3(this, XMVectorSet(_x, _y, _z, 0.0f)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUHEND3::_XMUHEND3 +( + CONST FLOAT* pArray +) +{ + XMStoreUHenD3(this, XMLoadFloat3((XMFLOAT3*)pArray)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUHEND3& _XMUHEND3::operator= +( + CONST _XMUHEND3& UHenD3 +) +{ + v = UHenD3.v; + return *this; +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUHEND3& _XMUHEND3::operator= +( + CONST UINT Packed +) +{ + v = Packed; + return *this; +} + +/**************************************************************************** + * + * XMDHENN3 operators + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ + +XMFINLINE _XMDHENN3::_XMDHENN3 +( + FLOAT _x, + FLOAT _y, + FLOAT _z +) +{ + XMStoreDHenN3(this, XMVectorSet(_x, _y, _z, 0.0f)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMDHENN3::_XMDHENN3 +( + CONST FLOAT* pArray +) +{ + XMStoreDHenN3(this, XMLoadFloat3((XMFLOAT3*)pArray)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMDHENN3& _XMDHENN3::operator= +( + CONST _XMDHENN3& DHenN3 +) +{ + v = DHenN3.v; + return *this; +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMDHENN3& _XMDHENN3::operator= +( + CONST UINT Packed +) +{ + v = Packed; + return *this; +} + +/**************************************************************************** + * + * XMDHEN3 operators + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ + +XMFINLINE _XMDHEN3::_XMDHEN3 +( + FLOAT _x, + FLOAT _y, + FLOAT _z +) +{ + XMStoreDHen3(this, XMVectorSet(_x, _y, _z, 0.0f)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMDHEN3::_XMDHEN3 +( + CONST FLOAT* pArray +) +{ + XMStoreDHen3(this, XMLoadFloat3((XMFLOAT3*)pArray)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMDHEN3& _XMDHEN3::operator= +( + CONST _XMDHEN3& DHen3 +) +{ + v = DHen3.v; + return *this; +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMDHEN3& _XMDHEN3::operator= +( + CONST UINT Packed +) +{ + v = Packed; + return *this; +} + +/**************************************************************************** + * + * XMUDHENN3 operators + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUDHENN3::_XMUDHENN3 +( + FLOAT _x, + FLOAT _y, + FLOAT _z +) +{ + XMStoreUDHenN3(this, XMVectorSet(_x, _y, _z, 0.0f)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUDHENN3::_XMUDHENN3 +( + CONST FLOAT* pArray +) +{ + XMStoreUDHenN3(this, XMLoadFloat3((XMFLOAT3*)pArray)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUDHENN3& _XMUDHENN3::operator= +( + CONST _XMUDHENN3& UDHenN3 +) +{ + v = UDHenN3.v; + return *this; +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUDHENN3& _XMUDHENN3::operator= +( + CONST UINT Packed +) +{ + v = Packed; + return *this; +} + +/**************************************************************************** + * + * XMUDHEN3 operators + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUDHEN3::_XMUDHEN3 +( + FLOAT _x, + FLOAT _y, + FLOAT _z +) +{ + XMStoreUDHen3(this, XMVectorSet(_x, _y, _z, 0.0f)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUDHEN3::_XMUDHEN3 +( + CONST FLOAT* pArray +) +{ + XMStoreUDHen3(this, XMLoadFloat3((XMFLOAT3*)pArray)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUDHEN3& _XMUDHEN3::operator= +( + CONST _XMUDHEN3& UDHen3 +) +{ + v = UDHen3.v; + return *this; +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUDHEN3& _XMUDHEN3::operator= +( + CONST UINT Packed +) +{ + v = Packed; + return *this; +} + +/**************************************************************************** + * + * XMU565 operators + * + ****************************************************************************/ + +XMFINLINE _XMU565::_XMU565 +( + CONST CHAR *pArray +) +{ + x = pArray[0]; + y = pArray[1]; + z = pArray[2]; +} + +XMFINLINE _XMU565::_XMU565 +( + FLOAT _x, + FLOAT _y, + FLOAT _z +) +{ + XMStoreU565(this, XMVectorSet( _x, _y, _z, 0.0f )); +} + +XMFINLINE _XMU565::_XMU565 +( + CONST FLOAT *pArray +) +{ + XMStoreU565(this, XMLoadFloat3((XMFLOAT3*)pArray )); +} + +XMFINLINE _XMU565& _XMU565::operator= +( + CONST _XMU565& U565 +) +{ + v = U565.v; + return *this; +} + +XMFINLINE _XMU565& _XMU565::operator= +( + CONST USHORT Packed +) +{ + v = Packed; + return *this; +} + +/**************************************************************************** + * + * XMFLOAT3PK operators + * + ****************************************************************************/ + +XMFINLINE _XMFLOAT3PK::_XMFLOAT3PK +( + FLOAT _x, + FLOAT _y, + FLOAT _z +) +{ + XMStoreFloat3PK(this, XMVectorSet( _x, _y, _z, 0.0f )); +} + +XMFINLINE _XMFLOAT3PK::_XMFLOAT3PK +( + CONST FLOAT *pArray +) +{ + XMStoreFloat3PK(this, XMLoadFloat3((XMFLOAT3*)pArray )); +} + +XMFINLINE _XMFLOAT3PK& _XMFLOAT3PK::operator= +( + CONST _XMFLOAT3PK& float3pk +) +{ + v = float3pk.v; + return *this; +} + +XMFINLINE _XMFLOAT3PK& _XMFLOAT3PK::operator= +( + CONST UINT Packed +) +{ + v = Packed; + return *this; +} + +/**************************************************************************** + * + * XMFLOAT3SE operators + * + ****************************************************************************/ + +XMFINLINE _XMFLOAT3SE::_XMFLOAT3SE +( + FLOAT _x, + FLOAT _y, + FLOAT _z +) +{ + XMStoreFloat3SE(this, XMVectorSet( _x, _y, _z, 0.0f )); +} + +XMFINLINE _XMFLOAT3SE::_XMFLOAT3SE +( + CONST FLOAT *pArray +) +{ + XMStoreFloat3SE(this, XMLoadFloat3((XMFLOAT3*)pArray )); +} + +XMFINLINE _XMFLOAT3SE& _XMFLOAT3SE::operator= +( + CONST _XMFLOAT3SE& float3se +) +{ + v = float3se.v; + return *this; +} + +XMFINLINE _XMFLOAT3SE& _XMFLOAT3SE::operator= +( + CONST UINT Packed +) +{ + v = Packed; + return *this; +} + +/**************************************************************************** + * + * XMFLOAT4 operators + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ + +XMFINLINE _XMFLOAT4::_XMFLOAT4 +( + CONST FLOAT* pArray +) +{ + x = pArray[0]; + y = pArray[1]; + z = pArray[2]; + w = pArray[3]; +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMFLOAT4& _XMFLOAT4::operator= +( + CONST _XMFLOAT4& Float4 +) +{ + x = Float4.x; + y = Float4.y; + z = Float4.z; + w = Float4.w; + return *this; +} + +//------------------------------------------------------------------------------ + +XMFINLINE XMFLOAT4A& XMFLOAT4A::operator= +( + CONST XMFLOAT4A& Float4 +) +{ + x = Float4.x; + y = Float4.y; + z = Float4.z; + w = Float4.w; + return *this; +} + +/**************************************************************************** + * + * XMHALF4 operators + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ + +XMFINLINE _XMHALF4::_XMHALF4 +( + CONST HALF* pArray +) +{ + x = pArray[0]; + y = pArray[1]; + z = pArray[2]; + w = pArray[3]; +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMHALF4::_XMHALF4 +( + FLOAT _x, + FLOAT _y, + FLOAT _z, + FLOAT _w +) +{ + x = XMConvertFloatToHalf(_x); + y = XMConvertFloatToHalf(_y); + z = XMConvertFloatToHalf(_z); + w = XMConvertFloatToHalf(_w); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMHALF4::_XMHALF4 +( + CONST FLOAT* pArray +) +{ + XMConvertFloatToHalfStream(&x, sizeof(HALF), pArray, sizeof(FLOAT), 4); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMHALF4& _XMHALF4::operator= +( + CONST _XMHALF4& Half4 +) +{ + x = Half4.x; + y = Half4.y; + z = Half4.z; + w = Half4.w; + return *this; +} + +/**************************************************************************** + * + * XMSHORTN4 operators + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ + +XMFINLINE _XMSHORTN4::_XMSHORTN4 +( + CONST SHORT* pArray +) +{ + x = pArray[0]; + y = pArray[1]; + z = pArray[2]; + w = pArray[3]; +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMSHORTN4::_XMSHORTN4 +( + FLOAT _x, + FLOAT _y, + FLOAT _z, + FLOAT _w +) +{ + XMStoreShortN4(this, XMVectorSet(_x, _y, _z, _w)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMSHORTN4::_XMSHORTN4 +( + CONST FLOAT* pArray +) +{ + XMStoreShortN4(this, XMLoadFloat4((XMFLOAT4*)pArray)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMSHORTN4& _XMSHORTN4::operator= +( + CONST _XMSHORTN4& ShortN4 +) +{ + x = ShortN4.x; + y = ShortN4.y; + z = ShortN4.z; + w = ShortN4.w; + return *this; +} + +/**************************************************************************** + * + * XMSHORT4 operators + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ + +XMFINLINE _XMSHORT4::_XMSHORT4 +( + CONST SHORT* pArray +) +{ + x = pArray[0]; + y = pArray[1]; + z = pArray[2]; + w = pArray[3]; +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMSHORT4::_XMSHORT4 +( + FLOAT _x, + FLOAT _y, + FLOAT _z, + FLOAT _w +) +{ + XMStoreShort4(this, XMVectorSet(_x, _y, _z, _w)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMSHORT4::_XMSHORT4 +( + CONST FLOAT* pArray +) +{ + XMStoreShort4(this, XMLoadFloat4((XMFLOAT4*)pArray)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMSHORT4& _XMSHORT4::operator= +( + CONST _XMSHORT4& Short4 +) +{ + x = Short4.x; + y = Short4.y; + z = Short4.z; + w = Short4.w; + return *this; +} + +/**************************************************************************** + * + * XMUSHORTN4 operators + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUSHORTN4::_XMUSHORTN4 +( + CONST USHORT* pArray +) +{ + x = pArray[0]; + y = pArray[1]; + z = pArray[2]; + w = pArray[3]; +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUSHORTN4::_XMUSHORTN4 +( + FLOAT _x, + FLOAT _y, + FLOAT _z, + FLOAT _w +) +{ + XMStoreUShortN4(this, XMVectorSet(_x, _y, _z, _w)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUSHORTN4::_XMUSHORTN4 +( + CONST FLOAT* pArray +) +{ + XMStoreUShortN4(this, XMLoadFloat4((XMFLOAT4*)pArray)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUSHORTN4& _XMUSHORTN4::operator= +( + CONST _XMUSHORTN4& UShortN4 +) +{ + x = UShortN4.x; + y = UShortN4.y; + z = UShortN4.z; + w = UShortN4.w; + return *this; +} + +/**************************************************************************** + * + * XMUSHORT4 operators + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUSHORT4::_XMUSHORT4 +( + CONST USHORT* pArray +) +{ + x = pArray[0]; + y = pArray[1]; + z = pArray[2]; + w = pArray[3]; +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUSHORT4::_XMUSHORT4 +( + FLOAT _x, + FLOAT _y, + FLOAT _z, + FLOAT _w +) +{ + XMStoreUShort4(this, XMVectorSet(_x, _y, _z, _w)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUSHORT4::_XMUSHORT4 +( + CONST FLOAT* pArray +) +{ + XMStoreUShort4(this, XMLoadFloat4((XMFLOAT4*)pArray)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUSHORT4& _XMUSHORT4::operator= +( + CONST _XMUSHORT4& UShort4 +) +{ + x = UShort4.x; + y = UShort4.y; + z = UShort4.z; + w = UShort4.w; + return *this; +} + +/**************************************************************************** + * + * XMXDECN4 operators + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ + +XMFINLINE _XMXDECN4::_XMXDECN4 +( + FLOAT _x, + FLOAT _y, + FLOAT _z, + FLOAT _w +) +{ + XMStoreXDecN4(this, XMVectorSet(_x, _y, _z, _w)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMXDECN4::_XMXDECN4 +( + CONST FLOAT* pArray +) +{ + XMStoreXDecN4(this, XMLoadFloat4((XMFLOAT4*)pArray)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMXDECN4& _XMXDECN4::operator= +( + CONST _XMXDECN4& XDecN4 +) +{ + v = XDecN4.v; + return *this; +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMXDECN4& _XMXDECN4::operator= +( + CONST UINT Packed +) +{ + v = Packed; + return *this; +} + +/**************************************************************************** + * + * XMXDEC4 operators + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ + +XMFINLINE _XMXDEC4::_XMXDEC4 +( + FLOAT _x, + FLOAT _y, + FLOAT _z, + FLOAT _w +) +{ + XMStoreXDec4(this, XMVectorSet(_x, _y, _z, _w)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMXDEC4::_XMXDEC4 +( + CONST FLOAT* pArray +) +{ + XMStoreXDec4(this, XMLoadFloat4((XMFLOAT4*)pArray)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMXDEC4& _XMXDEC4::operator= +( + CONST _XMXDEC4& XDec4 +) +{ + v = XDec4.v; + return *this; +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMXDEC4& _XMXDEC4::operator= +( + CONST UINT Packed +) +{ + v = Packed; + return *this; +} + +/**************************************************************************** + * + * XMDECN4 operators + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ + +XMFINLINE _XMDECN4::_XMDECN4 +( + FLOAT _x, + FLOAT _y, + FLOAT _z, + FLOAT _w +) +{ + XMStoreDecN4(this, XMVectorSet(_x, _y, _z, _w)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMDECN4::_XMDECN4 +( + CONST FLOAT* pArray +) +{ + XMStoreDecN4(this, XMLoadFloat4((XMFLOAT4*)pArray)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMDECN4& _XMDECN4::operator= +( + CONST _XMDECN4& DecN4 +) +{ + v = DecN4.v; + return *this; +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMDECN4& _XMDECN4::operator= +( + CONST UINT Packed +) +{ + v = Packed; + return *this; +} + +/**************************************************************************** + * + * XMDEC4 operators + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ + +XMFINLINE _XMDEC4::_XMDEC4 +( + FLOAT _x, + FLOAT _y, + FLOAT _z, + FLOAT _w +) +{ + XMStoreDec4(this, XMVectorSet(_x, _y, _z, _w)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMDEC4::_XMDEC4 +( + CONST FLOAT* pArray +) +{ + XMStoreDec4(this, XMLoadFloat4((XMFLOAT4*)pArray)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMDEC4& _XMDEC4::operator= +( + CONST _XMDEC4& Dec4 +) +{ + v = Dec4.v; + return *this; +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMDEC4& _XMDEC4::operator= +( + CONST UINT Packed +) +{ + v = Packed; + return *this; +} + +/**************************************************************************** + * + * XMUDECN4 operators + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUDECN4::_XMUDECN4 +( + FLOAT _x, + FLOAT _y, + FLOAT _z, + FLOAT _w +) +{ + XMStoreUDecN4(this, XMVectorSet(_x, _y, _z, _w)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUDECN4::_XMUDECN4 +( + CONST FLOAT* pArray +) +{ + XMStoreUDecN4(this, XMLoadFloat4((XMFLOAT4*)pArray)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUDECN4& _XMUDECN4::operator= +( + CONST _XMUDECN4& UDecN4 +) +{ + v = UDecN4.v; + return *this; +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUDECN4& _XMUDECN4::operator= +( + CONST UINT Packed +) +{ + v = Packed; + return *this; +} + +/**************************************************************************** + * + * XMUDEC4 operators + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUDEC4::_XMUDEC4 +( + FLOAT _x, + FLOAT _y, + FLOAT _z, + FLOAT _w +) +{ + XMStoreUDec4(this, XMVectorSet(_x, _y, _z, _w)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUDEC4::_XMUDEC4 +( + CONST FLOAT* pArray +) +{ + XMStoreUDec4(this, XMLoadFloat4((XMFLOAT4*)pArray)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUDEC4& _XMUDEC4::operator= +( + CONST _XMUDEC4& UDec4 +) +{ + v = UDec4.v; + return *this; +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUDEC4& _XMUDEC4::operator= +( + CONST UINT Packed +) +{ + v = Packed; + return *this; +} + +/**************************************************************************** + * + * XMXICON4 operators + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ + +XMFINLINE _XMXICON4::_XMXICON4 +( + FLOAT _x, + FLOAT _y, + FLOAT _z, + FLOAT _w +) +{ + XMStoreXIcoN4(this, XMVectorSet(_x, _y, _z, _w)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMXICON4::_XMXICON4 +( + CONST FLOAT* pArray +) +{ + XMStoreXIcoN4(this, XMLoadFloat4((XMFLOAT4*)pArray)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMXICON4& _XMXICON4::operator= +( + CONST _XMXICON4& XIcoN4 +) +{ + v = XIcoN4.v; + return *this; +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMXICON4& _XMXICON4::operator= +( + CONST UINT64 Packed +) +{ + v = Packed; + return *this; +} + +/**************************************************************************** + * + * XMXICO4 operators + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ + +XMFINLINE _XMXICO4::_XMXICO4 +( + FLOAT _x, + FLOAT _y, + FLOAT _z, + FLOAT _w +) +{ + XMStoreXIco4(this, XMVectorSet(_x, _y, _z, _w)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMXICO4::_XMXICO4 +( + CONST FLOAT* pArray +) +{ + XMStoreXIco4(this, XMLoadFloat4((XMFLOAT4*)pArray)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMXICO4& _XMXICO4::operator= +( + CONST _XMXICO4& XIco4 +) +{ + v = XIco4.v; + return *this; +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMXICO4& _XMXICO4::operator= +( + CONST UINT64 Packed +) +{ + v = Packed; + return *this; +} + +/**************************************************************************** + * + * XMICON4 operators + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ + +XMFINLINE _XMICON4::_XMICON4 +( + FLOAT _x, + FLOAT _y, + FLOAT _z, + FLOAT _w +) +{ + XMStoreIcoN4(this, XMVectorSet(_x, _y, _z, _w)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMICON4::_XMICON4 +( + CONST FLOAT* pArray +) +{ + XMStoreIcoN4(this, XMLoadFloat4((XMFLOAT4*)pArray)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMICON4& _XMICON4::operator= +( + CONST _XMICON4& IcoN4 +) +{ + v = IcoN4.v; + return *this; +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMICON4& _XMICON4::operator= +( + CONST UINT64 Packed +) +{ + v = Packed; + return *this; +} + +/**************************************************************************** + * + * XMICO4 operators + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ + +XMFINLINE _XMICO4::_XMICO4 +( + FLOAT _x, + FLOAT _y, + FLOAT _z, + FLOAT _w +) +{ + XMStoreIco4(this, XMVectorSet(_x, _y, _z, _w)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMICO4::_XMICO4 +( + CONST FLOAT* pArray +) +{ + XMStoreIco4(this, XMLoadFloat4((XMFLOAT4*)pArray)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMICO4& _XMICO4::operator= +( + CONST _XMICO4& Ico4 +) +{ + v = Ico4.v; + return *this; +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMICO4& _XMICO4::operator= +( + CONST UINT64 Packed +) +{ + v = Packed; + return *this; +} + +/**************************************************************************** + * + * XMUICON4 operators + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUICON4::_XMUICON4 +( + FLOAT _x, + FLOAT _y, + FLOAT _z, + FLOAT _w +) +{ + XMStoreUIcoN4(this, XMVectorSet(_x, _y, _z, _w)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUICON4::_XMUICON4 +( + CONST FLOAT* pArray +) +{ + XMStoreUIcoN4(this, XMLoadFloat4((XMFLOAT4*)pArray)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUICON4& _XMUICON4::operator= +( + CONST _XMUICON4& UIcoN4 +) +{ + v = UIcoN4.v; + return *this; +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUICON4& _XMUICON4::operator= +( + CONST UINT64 Packed +) +{ + v = Packed; + return *this; +} + +/**************************************************************************** + * + * XMUICO4 operators + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUICO4::_XMUICO4 +( + FLOAT _x, + FLOAT _y, + FLOAT _z, + FLOAT _w +) +{ + XMStoreUIco4(this, XMVectorSet(_x, _y, _z, _w)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUICO4::_XMUICO4 +( + CONST FLOAT* pArray +) +{ + XMStoreUIco4(this, XMLoadFloat4((XMFLOAT4*)pArray)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUICO4& _XMUICO4::operator= +( + CONST _XMUICO4& UIco4 +) +{ + v = UIco4.v; + return *this; +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUICO4& _XMUICO4::operator= +( + CONST UINT64 Packed +) +{ + v = Packed; + return *this; +} + +/**************************************************************************** + * + * XMCOLOR4 operators + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ + +XMFINLINE _XMCOLOR::_XMCOLOR +( + FLOAT _r, + FLOAT _g, + FLOAT _b, + FLOAT _a +) +{ + XMStoreColor(this, XMVectorSet(_r, _g, _b, _a)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMCOLOR::_XMCOLOR +( + CONST FLOAT* pArray +) +{ + XMStoreColor(this, XMLoadFloat4((XMFLOAT4*)pArray)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMCOLOR& _XMCOLOR::operator= +( + CONST _XMCOLOR& Color +) +{ + c = Color.c; + return *this; +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMCOLOR& _XMCOLOR::operator= +( + CONST UINT Color +) +{ + c = Color; + return *this; +} + +/**************************************************************************** + * + * XMBYTEN4 operators + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ + +XMFINLINE _XMBYTEN4::_XMBYTEN4 +( + CONST CHAR* pArray +) +{ + x = pArray[0]; + y = pArray[1]; + z = pArray[2]; + w = pArray[3]; +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMBYTEN4::_XMBYTEN4 +( + FLOAT _x, + FLOAT _y, + FLOAT _z, + FLOAT _w +) +{ + XMStoreByteN4(this, XMVectorSet(_x, _y, _z, _w)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMBYTEN4::_XMBYTEN4 +( + CONST FLOAT* pArray +) +{ + XMStoreByteN4(this, XMLoadFloat4((XMFLOAT4*)pArray)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMBYTEN4& _XMBYTEN4::operator= +( + CONST _XMBYTEN4& ByteN4 +) +{ + x = ByteN4.x; + y = ByteN4.y; + z = ByteN4.z; + w = ByteN4.w; + return *this; +} + +/**************************************************************************** + * + * XMBYTE4 operators + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ + +XMFINLINE _XMBYTE4::_XMBYTE4 +( + CONST CHAR* pArray +) +{ + x = pArray[0]; + y = pArray[1]; + z = pArray[2]; + w = pArray[3]; +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMBYTE4::_XMBYTE4 +( + FLOAT _x, + FLOAT _y, + FLOAT _z, + FLOAT _w +) +{ + XMStoreByte4(this, XMVectorSet(_x, _y, _z, _w)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMBYTE4::_XMBYTE4 +( + CONST FLOAT* pArray +) +{ + XMStoreByte4(this, XMLoadFloat4((XMFLOAT4*)pArray)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMBYTE4& _XMBYTE4::operator= +( + CONST _XMBYTE4& Byte4 +) +{ + x = Byte4.x; + y = Byte4.y; + z = Byte4.z; + w = Byte4.w; + return *this; +} + +/**************************************************************************** + * + * XMUBYTEN4 operators + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUBYTEN4::_XMUBYTEN4 +( + CONST BYTE* pArray +) +{ + x = pArray[0]; + y = pArray[1]; + z = pArray[2]; + w = pArray[3]; +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUBYTEN4::_XMUBYTEN4 +( + FLOAT _x, + FLOAT _y, + FLOAT _z, + FLOAT _w +) +{ + XMStoreUByteN4(this, XMVectorSet(_x, _y, _z, _w)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUBYTEN4::_XMUBYTEN4 +( + CONST FLOAT* pArray +) +{ + XMStoreUByteN4(this, XMLoadFloat4((XMFLOAT4*)pArray)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUBYTEN4& _XMUBYTEN4::operator= +( + CONST _XMUBYTEN4& UByteN4 +) +{ + x = UByteN4.x; + y = UByteN4.y; + z = UByteN4.z; + w = UByteN4.w; + return *this; +} + +/**************************************************************************** + * + * XMUBYTE4 operators + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUBYTE4::_XMUBYTE4 +( + CONST BYTE* pArray +) +{ + x = pArray[0]; + y = pArray[1]; + z = pArray[2]; + w = pArray[3]; +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUBYTE4::_XMUBYTE4 +( + FLOAT _x, + FLOAT _y, + FLOAT _z, + FLOAT _w +) +{ + XMStoreUByte4(this, XMVectorSet(_x, _y, _z, _w)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUBYTE4::_XMUBYTE4 +( + CONST FLOAT* pArray +) +{ + XMStoreUByte4(this, XMLoadFloat4((XMFLOAT4*)pArray)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUBYTE4& _XMUBYTE4::operator= +( + CONST _XMUBYTE4& UByte4 +) +{ + x = UByte4.x; + y = UByte4.y; + z = UByte4.z; + w = UByte4.w; + return *this; +} + +/**************************************************************************** + * + * XMUNIBBLE4 operators + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUNIBBLE4::_XMUNIBBLE4 +( + CONST CHAR *pArray +) +{ + x = pArray[0]; + y = pArray[1]; + z = pArray[2]; + w = pArray[3]; +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUNIBBLE4::_XMUNIBBLE4 +( + FLOAT _x, + FLOAT _y, + FLOAT _z, + FLOAT _w +) +{ + XMStoreUNibble4(this, XMVectorSet( _x, _y, _z, _w )); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUNIBBLE4::_XMUNIBBLE4 +( + CONST FLOAT *pArray +) +{ + XMStoreUNibble4(this, XMLoadFloat4((XMFLOAT4*)pArray)); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUNIBBLE4& _XMUNIBBLE4::operator= +( + CONST _XMUNIBBLE4& UNibble4 +) +{ + v = UNibble4.v; + return *this; +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMUNIBBLE4& _XMUNIBBLE4::operator= +( + CONST USHORT Packed +) +{ + v = Packed; + return *this; +} + +/**************************************************************************** + * + * XMU555 operators + * + ****************************************************************************/ + +//------------------------------------------------------------------------------ + +XMFINLINE _XMU555::_XMU555 +( + CONST CHAR *pArray, + BOOL _w +) +{ + x = pArray[0]; + y = pArray[1]; + z = pArray[2]; + w = _w; +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMU555::_XMU555 +( + FLOAT _x, + FLOAT _y, + FLOAT _z, + BOOL _w +) +{ + XMStoreU555(this, XMVectorSet(_x, _y, _z, ((_w) ? 1.0f : 0.0f) )); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMU555::_XMU555 +( + CONST FLOAT *pArray, + BOOL _w +) +{ + XMVECTOR V = XMLoadFloat3((XMFLOAT3*)pArray); + XMStoreU555(this, XMVectorSetW(V, ((_w) ? 1.0f : 0.0f) )); +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMU555& _XMU555::operator= +( + CONST _XMU555& U555 +) +{ + v = U555.v; + return *this; +} + +//------------------------------------------------------------------------------ + +XMFINLINE _XMU555& _XMU555::operator= +( + CONST USHORT Packed +) +{ + v = Packed; + return *this; +} + +#endif // __cplusplus + +#if defined(_XM_NO_INTRINSICS_) +#undef XMISNAN +#undef XMISINF +#endif + +#endif // __XNAMATHVECTOR_INL__ + diff --git a/MediaClient/MediaClient/ffmpeg/include/libavcodec/ac3_parser.h b/MediaClient/MediaClient/ffmpeg/include/libavcodec/ac3_parser.h new file mode 100644 index 0000000..ff8cc4c --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavcodec/ac3_parser.h @@ -0,0 +1,36 @@ +/* + * AC-3 parser prototypes + * Copyright (c) 2003 Fabrice Bellard + * Copyright (c) 2003 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_AC3_PARSER_H +#define AVCODEC_AC3_PARSER_H + +#include +#include + +/** + * Extract the bitstream ID and the frame size from AC-3 data. + */ +int av_ac3_parse_header(const uint8_t *buf, size_t size, + uint8_t *bitstream_id, uint16_t *frame_size); + + +#endif /* AVCODEC_AC3_PARSER_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavcodec/adts_parser.h b/MediaClient/MediaClient/ffmpeg/include/libavcodec/adts_parser.h new file mode 100644 index 0000000..f85becd --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavcodec/adts_parser.h @@ -0,0 +1,37 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_ADTS_PARSER_H +#define AVCODEC_ADTS_PARSER_H + +#include +#include + +#define AV_AAC_ADTS_HEADER_SIZE 7 + +/** + * Extract the number of samples and frames from AAC data. + * @param[in] buf pointer to AAC data buffer + * @param[out] samples Pointer to where number of samples is written + * @param[out] frames Pointer to where number of frames is written + * @return Returns 0 on success, error code on failure. + */ +int av_adts_header_parse(const uint8_t *buf, uint32_t *samples, + uint8_t *frames); + +#endif /* AVCODEC_ADTS_PARSER_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavcodec/avcodec.h b/MediaClient/MediaClient/ffmpeg/include/libavcodec/avcodec.h new file mode 100644 index 0000000..fb0c6fa --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavcodec/avcodec.h @@ -0,0 +1,6146 @@ +/* + * copyright (c) 2001 Fabrice Bellard + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_AVCODEC_H +#define AVCODEC_AVCODEC_H + +/** + * @file + * @ingroup libavc + * Libavcodec external API header + */ + +#include +#include "libavutil/samplefmt.h" +#include "libavutil/attributes.h" +#include "libavutil/avutil.h" +#include "libavutil/buffer.h" +#include "libavutil/cpu.h" +#include "libavutil/channel_layout.h" +#include "libavutil/dict.h" +#include "libavutil/frame.h" +#include "libavutil/hwcontext.h" +#include "libavutil/log.h" +#include "libavutil/pixfmt.h" +#include "libavutil/rational.h" + +#include "version.h" + +/** + * @defgroup libavc libavcodec + * Encoding/Decoding Library + * + * @{ + * + * @defgroup lavc_decoding Decoding + * @{ + * @} + * + * @defgroup lavc_encoding Encoding + * @{ + * @} + * + * @defgroup lavc_codec Codecs + * @{ + * @defgroup lavc_codec_native Native Codecs + * @{ + * @} + * @defgroup lavc_codec_wrappers External library wrappers + * @{ + * @} + * @defgroup lavc_codec_hwaccel Hardware Accelerators bridge + * @{ + * @} + * @} + * @defgroup lavc_internal Internal + * @{ + * @} + * @} + */ + +/** + * @ingroup libavc + * @defgroup lavc_encdec send/receive encoding and decoding API overview + * @{ + * + * The avcodec_send_packet()/avcodec_receive_frame()/avcodec_send_frame()/ + * avcodec_receive_packet() functions provide an encode/decode API, which + * decouples input and output. + * + * The API is very similar for encoding/decoding and audio/video, and works as + * follows: + * - Set up and open the AVCodecContext as usual. + * - Send valid input: + * - For decoding, call avcodec_send_packet() to give the decoder raw + * compressed data in an AVPacket. + * - For encoding, call avcodec_send_frame() to give the encoder an AVFrame + * containing uncompressed audio or video. + * In both cases, it is recommended that AVPackets and AVFrames are + * refcounted, or libavcodec might have to copy the input data. (libavformat + * always returns refcounted AVPackets, and av_frame_get_buffer() allocates + * refcounted AVFrames.) + * - Receive output in a loop. Periodically call one of the avcodec_receive_*() + * functions and process their output: + * - For decoding, call avcodec_receive_frame(). On success, it will return + * an AVFrame containing uncompressed audio or video data. + * - For encoding, call avcodec_receive_packet(). On success, it will return + * an AVPacket with a compressed frame. + * Repeat this call until it returns AVERROR(EAGAIN) or an error. The + * AVERROR(EAGAIN) return value means that new input data is required to + * return new output. In this case, continue with sending input. For each + * input frame/packet, the codec will typically return 1 output frame/packet, + * but it can also be 0 or more than 1. + * + * At the beginning of decoding or encoding, the codec might accept multiple + * input frames/packets without returning a frame, until its internal buffers + * are filled. This situation is handled transparently if you follow the steps + * outlined above. + * + * In theory, sending input can result in EAGAIN - this should happen only if + * not all output was received. You can use this to structure alternative decode + * or encode loops other than the one suggested above. For example, you could + * try sending new input on each iteration, and try to receive output if that + * returns EAGAIN. + * + * End of stream situations. These require "flushing" (aka draining) the codec, + * as the codec might buffer multiple frames or packets internally for + * performance or out of necessity (consider B-frames). + * This is handled as follows: + * - Instead of valid input, send NULL to the avcodec_send_packet() (decoding) + * or avcodec_send_frame() (encoding) functions. This will enter draining + * mode. + * - Call avcodec_receive_frame() (decoding) or avcodec_receive_packet() + * (encoding) in a loop until AVERROR_EOF is returned. The functions will + * not return AVERROR(EAGAIN), unless you forgot to enter draining mode. + * - Before decoding can be resumed again, the codec has to be reset with + * avcodec_flush_buffers(). + * + * Using the API as outlined above is highly recommended. But it is also + * possible to call functions outside of this rigid schema. For example, you can + * call avcodec_send_packet() repeatedly without calling + * avcodec_receive_frame(). In this case, avcodec_send_packet() will succeed + * until the codec's internal buffer has been filled up (which is typically of + * size 1 per output frame, after initial input), and then reject input with + * AVERROR(EAGAIN). Once it starts rejecting input, you have no choice but to + * read at least some output. + * + * Not all codecs will follow a rigid and predictable dataflow; the only + * guarantee is that an AVERROR(EAGAIN) return value on a send/receive call on + * one end implies that a receive/send call on the other end will succeed, or + * at least will not fail with AVERROR(EAGAIN). In general, no codec will + * permit unlimited buffering of input or output. + * + * This API replaces the following legacy functions: + * - avcodec_decode_video2() and avcodec_decode_audio4(): + * Use avcodec_send_packet() to feed input to the decoder, then use + * avcodec_receive_frame() to receive decoded frames after each packet. + * Unlike with the old video decoding API, multiple frames might result from + * a packet. For audio, splitting the input packet into frames by partially + * decoding packets becomes transparent to the API user. You never need to + * feed an AVPacket to the API twice (unless it is rejected with AVERROR(EAGAIN) - then + * no data was read from the packet). + * Additionally, sending a flush/draining packet is required only once. + * - avcodec_encode_video2()/avcodec_encode_audio2(): + * Use avcodec_send_frame() to feed input to the encoder, then use + * avcodec_receive_packet() to receive encoded packets. + * Providing user-allocated buffers for avcodec_receive_packet() is not + * possible. + * - The new API does not handle subtitles yet. + * + * Mixing new and old function calls on the same AVCodecContext is not allowed, + * and will result in undefined behavior. + * + * Some codecs might require using the new API; using the old API will return + * an error when calling it. All codecs support the new API. + * + * A codec is not allowed to return AVERROR(EAGAIN) for both sending and receiving. This + * would be an invalid state, which could put the codec user into an endless + * loop. The API has no concept of time either: it cannot happen that trying to + * do avcodec_send_packet() results in AVERROR(EAGAIN), but a repeated call 1 second + * later accepts the packet (with no other receive/flush API calls involved). + * The API is a strict state machine, and the passage of time is not supposed + * to influence it. Some timing-dependent behavior might still be deemed + * acceptable in certain cases. But it must never result in both send/receive + * returning EAGAIN at the same time at any point. It must also absolutely be + * avoided that the current state is "unstable" and can "flip-flop" between + * the send/receive APIs allowing progress. For example, it's not allowed that + * the codec randomly decides that it actually wants to consume a packet now + * instead of returning a frame, after it just returned AVERROR(EAGAIN) on an + * avcodec_send_packet() call. + * @} + */ + +/** + * @defgroup lavc_core Core functions/structures. + * @ingroup libavc + * + * Basic definitions, functions for querying libavcodec capabilities, + * allocating core structures, etc. + * @{ + */ + + +/** + * Identify the syntax and semantics of the bitstream. + * The principle is roughly: + * Two decoders with the same ID can decode the same streams. + * Two encoders with the same ID can encode compatible streams. + * There may be slight deviations from the principle due to implementation + * details. + * + * If you add a codec ID to this list, add it so that + * 1. no value of an existing codec ID changes (that would break ABI), + * 2. it is as close as possible to similar codecs + * + * After adding new codec IDs, do not forget to add an entry to the codec + * descriptor list and bump libavcodec minor version. + */ +enum AVCodecID { + AV_CODEC_ID_NONE, + + /* video codecs */ + AV_CODEC_ID_MPEG1VIDEO, + AV_CODEC_ID_MPEG2VIDEO, ///< preferred ID for MPEG-1/2 video decoding + AV_CODEC_ID_H261, + AV_CODEC_ID_H263, + AV_CODEC_ID_RV10, + AV_CODEC_ID_RV20, + AV_CODEC_ID_MJPEG, + AV_CODEC_ID_MJPEGB, + AV_CODEC_ID_LJPEG, + AV_CODEC_ID_SP5X, + AV_CODEC_ID_JPEGLS, + AV_CODEC_ID_MPEG4, + AV_CODEC_ID_RAWVIDEO, + AV_CODEC_ID_MSMPEG4V1, + AV_CODEC_ID_MSMPEG4V2, + AV_CODEC_ID_MSMPEG4V3, + AV_CODEC_ID_WMV1, + AV_CODEC_ID_WMV2, + AV_CODEC_ID_H263P, + AV_CODEC_ID_H263I, + AV_CODEC_ID_FLV1, + AV_CODEC_ID_SVQ1, + AV_CODEC_ID_SVQ3, + AV_CODEC_ID_DVVIDEO, + AV_CODEC_ID_HUFFYUV, + AV_CODEC_ID_CYUV, + AV_CODEC_ID_H264, + AV_CODEC_ID_INDEO3, + AV_CODEC_ID_VP3, + AV_CODEC_ID_THEORA, + AV_CODEC_ID_ASV1, + AV_CODEC_ID_ASV2, + AV_CODEC_ID_FFV1, + AV_CODEC_ID_4XM, + AV_CODEC_ID_VCR1, + AV_CODEC_ID_CLJR, + AV_CODEC_ID_MDEC, + AV_CODEC_ID_ROQ, + AV_CODEC_ID_INTERPLAY_VIDEO, + AV_CODEC_ID_XAN_WC3, + AV_CODEC_ID_XAN_WC4, + AV_CODEC_ID_RPZA, + AV_CODEC_ID_CINEPAK, + AV_CODEC_ID_WS_VQA, + AV_CODEC_ID_MSRLE, + AV_CODEC_ID_MSVIDEO1, + AV_CODEC_ID_IDCIN, + AV_CODEC_ID_8BPS, + AV_CODEC_ID_SMC, + AV_CODEC_ID_FLIC, + AV_CODEC_ID_TRUEMOTION1, + AV_CODEC_ID_VMDVIDEO, + AV_CODEC_ID_MSZH, + AV_CODEC_ID_ZLIB, + AV_CODEC_ID_QTRLE, + AV_CODEC_ID_TSCC, + AV_CODEC_ID_ULTI, + AV_CODEC_ID_QDRAW, + AV_CODEC_ID_VIXL, + AV_CODEC_ID_QPEG, + AV_CODEC_ID_PNG, + AV_CODEC_ID_PPM, + AV_CODEC_ID_PBM, + AV_CODEC_ID_PGM, + AV_CODEC_ID_PGMYUV, + AV_CODEC_ID_PAM, + AV_CODEC_ID_FFVHUFF, + AV_CODEC_ID_RV30, + AV_CODEC_ID_RV40, + AV_CODEC_ID_VC1, + AV_CODEC_ID_WMV3, + AV_CODEC_ID_LOCO, + AV_CODEC_ID_WNV1, + AV_CODEC_ID_AASC, + AV_CODEC_ID_INDEO2, + AV_CODEC_ID_FRAPS, + AV_CODEC_ID_TRUEMOTION2, + AV_CODEC_ID_BMP, + AV_CODEC_ID_CSCD, + AV_CODEC_ID_MMVIDEO, + AV_CODEC_ID_ZMBV, + AV_CODEC_ID_AVS, + AV_CODEC_ID_SMACKVIDEO, + AV_CODEC_ID_NUV, + AV_CODEC_ID_KMVC, + AV_CODEC_ID_FLASHSV, + AV_CODEC_ID_CAVS, + AV_CODEC_ID_JPEG2000, + AV_CODEC_ID_VMNC, + AV_CODEC_ID_VP5, + AV_CODEC_ID_VP6, + AV_CODEC_ID_VP6F, + AV_CODEC_ID_TARGA, + AV_CODEC_ID_DSICINVIDEO, + AV_CODEC_ID_TIERTEXSEQVIDEO, + AV_CODEC_ID_TIFF, + AV_CODEC_ID_GIF, + AV_CODEC_ID_DXA, + AV_CODEC_ID_DNXHD, + AV_CODEC_ID_THP, + AV_CODEC_ID_SGI, + AV_CODEC_ID_C93, + AV_CODEC_ID_BETHSOFTVID, + AV_CODEC_ID_PTX, + AV_CODEC_ID_TXD, + AV_CODEC_ID_VP6A, + AV_CODEC_ID_AMV, + AV_CODEC_ID_VB, + AV_CODEC_ID_PCX, + AV_CODEC_ID_SUNRAST, + AV_CODEC_ID_INDEO4, + AV_CODEC_ID_INDEO5, + AV_CODEC_ID_MIMIC, + AV_CODEC_ID_RL2, + AV_CODEC_ID_ESCAPE124, + AV_CODEC_ID_DIRAC, + AV_CODEC_ID_BFI, + AV_CODEC_ID_CMV, + AV_CODEC_ID_MOTIONPIXELS, + AV_CODEC_ID_TGV, + AV_CODEC_ID_TGQ, + AV_CODEC_ID_TQI, + AV_CODEC_ID_AURA, + AV_CODEC_ID_AURA2, + AV_CODEC_ID_V210X, + AV_CODEC_ID_TMV, + AV_CODEC_ID_V210, + AV_CODEC_ID_DPX, + AV_CODEC_ID_MAD, + AV_CODEC_ID_FRWU, + AV_CODEC_ID_FLASHSV2, + AV_CODEC_ID_CDGRAPHICS, + AV_CODEC_ID_R210, + AV_CODEC_ID_ANM, + AV_CODEC_ID_BINKVIDEO, + AV_CODEC_ID_IFF_ILBM, +#define AV_CODEC_ID_IFF_BYTERUN1 AV_CODEC_ID_IFF_ILBM + AV_CODEC_ID_KGV1, + AV_CODEC_ID_YOP, + AV_CODEC_ID_VP8, + AV_CODEC_ID_PICTOR, + AV_CODEC_ID_ANSI, + AV_CODEC_ID_A64_MULTI, + AV_CODEC_ID_A64_MULTI5, + AV_CODEC_ID_R10K, + AV_CODEC_ID_MXPEG, + AV_CODEC_ID_LAGARITH, + AV_CODEC_ID_PRORES, + AV_CODEC_ID_JV, + AV_CODEC_ID_DFA, + AV_CODEC_ID_WMV3IMAGE, + AV_CODEC_ID_VC1IMAGE, + AV_CODEC_ID_UTVIDEO, + AV_CODEC_ID_BMV_VIDEO, + AV_CODEC_ID_VBLE, + AV_CODEC_ID_DXTORY, + AV_CODEC_ID_V410, + AV_CODEC_ID_XWD, + AV_CODEC_ID_CDXL, + AV_CODEC_ID_XBM, + AV_CODEC_ID_ZEROCODEC, + AV_CODEC_ID_MSS1, + AV_CODEC_ID_MSA1, + AV_CODEC_ID_TSCC2, + AV_CODEC_ID_MTS2, + AV_CODEC_ID_CLLC, + AV_CODEC_ID_MSS2, + AV_CODEC_ID_VP9, + AV_CODEC_ID_AIC, + AV_CODEC_ID_ESCAPE130, + AV_CODEC_ID_G2M, + AV_CODEC_ID_WEBP, + AV_CODEC_ID_HNM4_VIDEO, + AV_CODEC_ID_HEVC, +#define AV_CODEC_ID_H265 AV_CODEC_ID_HEVC + AV_CODEC_ID_FIC, + AV_CODEC_ID_ALIAS_PIX, + AV_CODEC_ID_BRENDER_PIX, + AV_CODEC_ID_PAF_VIDEO, + AV_CODEC_ID_EXR, + AV_CODEC_ID_VP7, + AV_CODEC_ID_SANM, + AV_CODEC_ID_SGIRLE, + AV_CODEC_ID_MVC1, + AV_CODEC_ID_MVC2, + AV_CODEC_ID_HQX, + AV_CODEC_ID_TDSC, + AV_CODEC_ID_HQ_HQA, + AV_CODEC_ID_HAP, + AV_CODEC_ID_DDS, + AV_CODEC_ID_DXV, + AV_CODEC_ID_SCREENPRESSO, + AV_CODEC_ID_RSCC, + + AV_CODEC_ID_Y41P = 0x8000, + AV_CODEC_ID_AVRP, + AV_CODEC_ID_012V, + AV_CODEC_ID_AVUI, + AV_CODEC_ID_AYUV, + AV_CODEC_ID_TARGA_Y216, + AV_CODEC_ID_V308, + AV_CODEC_ID_V408, + AV_CODEC_ID_YUV4, + AV_CODEC_ID_AVRN, + AV_CODEC_ID_CPIA, + AV_CODEC_ID_XFACE, + AV_CODEC_ID_SNOW, + AV_CODEC_ID_SMVJPEG, + AV_CODEC_ID_APNG, + AV_CODEC_ID_DAALA, + AV_CODEC_ID_CFHD, + AV_CODEC_ID_TRUEMOTION2RT, + AV_CODEC_ID_M101, + AV_CODEC_ID_MAGICYUV, + AV_CODEC_ID_SHEERVIDEO, + AV_CODEC_ID_YLC, + AV_CODEC_ID_PSD, + AV_CODEC_ID_PIXLET, + AV_CODEC_ID_SPEEDHQ, + AV_CODEC_ID_FMVC, + AV_CODEC_ID_SCPR, + AV_CODEC_ID_CLEARVIDEO, + AV_CODEC_ID_XPM, + AV_CODEC_ID_AV1, + AV_CODEC_ID_BITPACKED, + AV_CODEC_ID_MSCC, + AV_CODEC_ID_SRGC, + AV_CODEC_ID_SVG, + AV_CODEC_ID_GDV, + AV_CODEC_ID_FITS, + + /* various PCM "codecs" */ + AV_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs + AV_CODEC_ID_PCM_S16LE = 0x10000, + AV_CODEC_ID_PCM_S16BE, + AV_CODEC_ID_PCM_U16LE, + AV_CODEC_ID_PCM_U16BE, + AV_CODEC_ID_PCM_S8, + AV_CODEC_ID_PCM_U8, + AV_CODEC_ID_PCM_MULAW, + AV_CODEC_ID_PCM_ALAW, + AV_CODEC_ID_PCM_S32LE, + AV_CODEC_ID_PCM_S32BE, + AV_CODEC_ID_PCM_U32LE, + AV_CODEC_ID_PCM_U32BE, + AV_CODEC_ID_PCM_S24LE, + AV_CODEC_ID_PCM_S24BE, + AV_CODEC_ID_PCM_U24LE, + AV_CODEC_ID_PCM_U24BE, + AV_CODEC_ID_PCM_S24DAUD, + AV_CODEC_ID_PCM_ZORK, + AV_CODEC_ID_PCM_S16LE_PLANAR, + AV_CODEC_ID_PCM_DVD, + AV_CODEC_ID_PCM_F32BE, + AV_CODEC_ID_PCM_F32LE, + AV_CODEC_ID_PCM_F64BE, + AV_CODEC_ID_PCM_F64LE, + AV_CODEC_ID_PCM_BLURAY, + AV_CODEC_ID_PCM_LXF, + AV_CODEC_ID_S302M, + AV_CODEC_ID_PCM_S8_PLANAR, + AV_CODEC_ID_PCM_S24LE_PLANAR, + AV_CODEC_ID_PCM_S32LE_PLANAR, + AV_CODEC_ID_PCM_S16BE_PLANAR, + + AV_CODEC_ID_PCM_S64LE = 0x10800, + AV_CODEC_ID_PCM_S64BE, + AV_CODEC_ID_PCM_F16LE, + AV_CODEC_ID_PCM_F24LE, + + /* various ADPCM codecs */ + AV_CODEC_ID_ADPCM_IMA_QT = 0x11000, + AV_CODEC_ID_ADPCM_IMA_WAV, + AV_CODEC_ID_ADPCM_IMA_DK3, + AV_CODEC_ID_ADPCM_IMA_DK4, + AV_CODEC_ID_ADPCM_IMA_WS, + AV_CODEC_ID_ADPCM_IMA_SMJPEG, + AV_CODEC_ID_ADPCM_MS, + AV_CODEC_ID_ADPCM_4XM, + AV_CODEC_ID_ADPCM_XA, + AV_CODEC_ID_ADPCM_ADX, + AV_CODEC_ID_ADPCM_EA, + AV_CODEC_ID_ADPCM_G726, + AV_CODEC_ID_ADPCM_CT, + AV_CODEC_ID_ADPCM_SWF, + AV_CODEC_ID_ADPCM_YAMAHA, + AV_CODEC_ID_ADPCM_SBPRO_4, + AV_CODEC_ID_ADPCM_SBPRO_3, + AV_CODEC_ID_ADPCM_SBPRO_2, + AV_CODEC_ID_ADPCM_THP, + AV_CODEC_ID_ADPCM_IMA_AMV, + AV_CODEC_ID_ADPCM_EA_R1, + AV_CODEC_ID_ADPCM_EA_R3, + AV_CODEC_ID_ADPCM_EA_R2, + AV_CODEC_ID_ADPCM_IMA_EA_SEAD, + AV_CODEC_ID_ADPCM_IMA_EA_EACS, + AV_CODEC_ID_ADPCM_EA_XAS, + AV_CODEC_ID_ADPCM_EA_MAXIS_XA, + AV_CODEC_ID_ADPCM_IMA_ISS, + AV_CODEC_ID_ADPCM_G722, + AV_CODEC_ID_ADPCM_IMA_APC, + AV_CODEC_ID_ADPCM_VIMA, + + AV_CODEC_ID_ADPCM_AFC = 0x11800, + AV_CODEC_ID_ADPCM_IMA_OKI, + AV_CODEC_ID_ADPCM_DTK, + AV_CODEC_ID_ADPCM_IMA_RAD, + AV_CODEC_ID_ADPCM_G726LE, + AV_CODEC_ID_ADPCM_THP_LE, + AV_CODEC_ID_ADPCM_PSX, + AV_CODEC_ID_ADPCM_AICA, + AV_CODEC_ID_ADPCM_IMA_DAT4, + AV_CODEC_ID_ADPCM_MTAF, + + /* AMR */ + AV_CODEC_ID_AMR_NB = 0x12000, + AV_CODEC_ID_AMR_WB, + + /* RealAudio codecs*/ + AV_CODEC_ID_RA_144 = 0x13000, + AV_CODEC_ID_RA_288, + + /* various DPCM codecs */ + AV_CODEC_ID_ROQ_DPCM = 0x14000, + AV_CODEC_ID_INTERPLAY_DPCM, + AV_CODEC_ID_XAN_DPCM, + AV_CODEC_ID_SOL_DPCM, + + AV_CODEC_ID_SDX2_DPCM = 0x14800, + AV_CODEC_ID_GREMLIN_DPCM, + + /* audio codecs */ + AV_CODEC_ID_MP2 = 0x15000, + AV_CODEC_ID_MP3, ///< preferred ID for decoding MPEG audio layer 1, 2 or 3 + AV_CODEC_ID_AAC, + AV_CODEC_ID_AC3, + AV_CODEC_ID_DTS, + AV_CODEC_ID_VORBIS, + AV_CODEC_ID_DVAUDIO, + AV_CODEC_ID_WMAV1, + AV_CODEC_ID_WMAV2, + AV_CODEC_ID_MACE3, + AV_CODEC_ID_MACE6, + AV_CODEC_ID_VMDAUDIO, + AV_CODEC_ID_FLAC, + AV_CODEC_ID_MP3ADU, + AV_CODEC_ID_MP3ON4, + AV_CODEC_ID_SHORTEN, + AV_CODEC_ID_ALAC, + AV_CODEC_ID_WESTWOOD_SND1, + AV_CODEC_ID_GSM, ///< as in Berlin toast format + AV_CODEC_ID_QDM2, + AV_CODEC_ID_COOK, + AV_CODEC_ID_TRUESPEECH, + AV_CODEC_ID_TTA, + AV_CODEC_ID_SMACKAUDIO, + AV_CODEC_ID_QCELP, + AV_CODEC_ID_WAVPACK, + AV_CODEC_ID_DSICINAUDIO, + AV_CODEC_ID_IMC, + AV_CODEC_ID_MUSEPACK7, + AV_CODEC_ID_MLP, + AV_CODEC_ID_GSM_MS, /* as found in WAV */ + AV_CODEC_ID_ATRAC3, + AV_CODEC_ID_APE, + AV_CODEC_ID_NELLYMOSER, + AV_CODEC_ID_MUSEPACK8, + AV_CODEC_ID_SPEEX, + AV_CODEC_ID_WMAVOICE, + AV_CODEC_ID_WMAPRO, + AV_CODEC_ID_WMALOSSLESS, + AV_CODEC_ID_ATRAC3P, + AV_CODEC_ID_EAC3, + AV_CODEC_ID_SIPR, + AV_CODEC_ID_MP1, + AV_CODEC_ID_TWINVQ, + AV_CODEC_ID_TRUEHD, + AV_CODEC_ID_MP4ALS, + AV_CODEC_ID_ATRAC1, + AV_CODEC_ID_BINKAUDIO_RDFT, + AV_CODEC_ID_BINKAUDIO_DCT, + AV_CODEC_ID_AAC_LATM, + AV_CODEC_ID_QDMC, + AV_CODEC_ID_CELT, + AV_CODEC_ID_G723_1, + AV_CODEC_ID_G729, + AV_CODEC_ID_8SVX_EXP, + AV_CODEC_ID_8SVX_FIB, + AV_CODEC_ID_BMV_AUDIO, + AV_CODEC_ID_RALF, + AV_CODEC_ID_IAC, + AV_CODEC_ID_ILBC, + AV_CODEC_ID_OPUS, + AV_CODEC_ID_COMFORT_NOISE, + AV_CODEC_ID_TAK, + AV_CODEC_ID_METASOUND, + AV_CODEC_ID_PAF_AUDIO, + AV_CODEC_ID_ON2AVC, + AV_CODEC_ID_DSS_SP, + AV_CODEC_ID_CODEC2, + + AV_CODEC_ID_FFWAVESYNTH = 0x15800, + AV_CODEC_ID_SONIC, + AV_CODEC_ID_SONIC_LS, + AV_CODEC_ID_EVRC, + AV_CODEC_ID_SMV, + AV_CODEC_ID_DSD_LSBF, + AV_CODEC_ID_DSD_MSBF, + AV_CODEC_ID_DSD_LSBF_PLANAR, + AV_CODEC_ID_DSD_MSBF_PLANAR, + AV_CODEC_ID_4GV, + AV_CODEC_ID_INTERPLAY_ACM, + AV_CODEC_ID_XMA1, + AV_CODEC_ID_XMA2, + AV_CODEC_ID_DST, + AV_CODEC_ID_ATRAC3AL, + AV_CODEC_ID_ATRAC3PAL, + AV_CODEC_ID_DOLBY_E, + AV_CODEC_ID_APTX, + AV_CODEC_ID_APTX_HD, + AV_CODEC_ID_SBC, + + /* subtitle codecs */ + AV_CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID pointing at the start of subtitle codecs. + AV_CODEC_ID_DVD_SUBTITLE = 0x17000, + AV_CODEC_ID_DVB_SUBTITLE, + AV_CODEC_ID_TEXT, ///< raw UTF-8 text + AV_CODEC_ID_XSUB, + AV_CODEC_ID_SSA, + AV_CODEC_ID_MOV_TEXT, + AV_CODEC_ID_HDMV_PGS_SUBTITLE, + AV_CODEC_ID_DVB_TELETEXT, + AV_CODEC_ID_SRT, + + AV_CODEC_ID_MICRODVD = 0x17800, + AV_CODEC_ID_EIA_608, + AV_CODEC_ID_JACOSUB, + AV_CODEC_ID_SAMI, + AV_CODEC_ID_REALTEXT, + AV_CODEC_ID_STL, + AV_CODEC_ID_SUBVIEWER1, + AV_CODEC_ID_SUBVIEWER, + AV_CODEC_ID_SUBRIP, + AV_CODEC_ID_WEBVTT, + AV_CODEC_ID_MPL2, + AV_CODEC_ID_VPLAYER, + AV_CODEC_ID_PJS, + AV_CODEC_ID_ASS, + AV_CODEC_ID_HDMV_TEXT_SUBTITLE, + + /* other specific kind of codecs (generally used for attachments) */ + AV_CODEC_ID_FIRST_UNKNOWN = 0x18000, ///< A dummy ID pointing at the start of various fake codecs. + AV_CODEC_ID_TTF = 0x18000, + + AV_CODEC_ID_SCTE_35, ///< Contain timestamp estimated through PCR of program stream. + AV_CODEC_ID_BINTEXT = 0x18800, + AV_CODEC_ID_XBIN, + AV_CODEC_ID_IDF, + AV_CODEC_ID_OTF, + AV_CODEC_ID_SMPTE_KLV, + AV_CODEC_ID_DVD_NAV, + AV_CODEC_ID_TIMED_ID3, + AV_CODEC_ID_BIN_DATA, + + + AV_CODEC_ID_PROBE = 0x19000, ///< codec_id is not known (like AV_CODEC_ID_NONE) but lavf should attempt to identify it + + AV_CODEC_ID_MPEG2TS = 0x20000, /**< _FAKE_ codec to indicate a raw MPEG-2 TS + * stream (only used by libavformat) */ + AV_CODEC_ID_MPEG4SYSTEMS = 0x20001, /**< _FAKE_ codec to indicate a MPEG-4 Systems + * stream (only used by libavformat) */ + AV_CODEC_ID_FFMETADATA = 0x21000, ///< Dummy codec for streams containing only metadata information. + AV_CODEC_ID_WRAPPED_AVFRAME = 0x21001, ///< Passthrough codec, AVFrames wrapped in AVPacket +}; + +/** + * This struct describes the properties of a single codec described by an + * AVCodecID. + * @see avcodec_descriptor_get() + */ +typedef struct AVCodecDescriptor { + enum AVCodecID id; + enum AVMediaType type; + /** + * Name of the codec described by this descriptor. It is non-empty and + * unique for each codec descriptor. It should contain alphanumeric + * characters and '_' only. + */ + const char *name; + /** + * A more descriptive name for this codec. May be NULL. + */ + const char *long_name; + /** + * Codec properties, a combination of AV_CODEC_PROP_* flags. + */ + int props; + /** + * MIME type(s) associated with the codec. + * May be NULL; if not, a NULL-terminated array of MIME types. + * The first item is always non-NULL and is the preferred MIME type. + */ + const char *const *mime_types; + /** + * If non-NULL, an array of profiles recognized for this codec. + * Terminated with FF_PROFILE_UNKNOWN. + */ + const struct AVProfile *profiles; +} AVCodecDescriptor; + +/** + * Codec uses only intra compression. + * Video and audio codecs only. + */ +#define AV_CODEC_PROP_INTRA_ONLY (1 << 0) +/** + * Codec supports lossy compression. Audio and video codecs only. + * @note a codec may support both lossy and lossless + * compression modes + */ +#define AV_CODEC_PROP_LOSSY (1 << 1) +/** + * Codec supports lossless compression. Audio and video codecs only. + */ +#define AV_CODEC_PROP_LOSSLESS (1 << 2) +/** + * Codec supports frame reordering. That is, the coded order (the order in which + * the encoded packets are output by the encoders / stored / input to the + * decoders) may be different from the presentation order of the corresponding + * frames. + * + * For codecs that do not have this property set, PTS and DTS should always be + * equal. + */ +#define AV_CODEC_PROP_REORDER (1 << 3) +/** + * Subtitle codec is bitmap based + * Decoded AVSubtitle data can be read from the AVSubtitleRect->pict field. + */ +#define AV_CODEC_PROP_BITMAP_SUB (1 << 16) +/** + * Subtitle codec is text based. + * Decoded AVSubtitle data can be read from the AVSubtitleRect->ass field. + */ +#define AV_CODEC_PROP_TEXT_SUB (1 << 17) + +/** + * @ingroup lavc_decoding + * Required number of additionally allocated bytes at the end of the input bitstream for decoding. + * This is mainly needed because some optimized bitstream readers read + * 32 or 64 bit at once and could read over the end.
+ * Note: If the first 23 bits of the additional bytes are not 0, then damaged + * MPEG bitstreams could cause overread and segfault. + */ +#define AV_INPUT_BUFFER_PADDING_SIZE 64 + +/** + * @ingroup lavc_encoding + * minimum encoding buffer size + * Used to avoid some checks during header writing. + */ +#define AV_INPUT_BUFFER_MIN_SIZE 16384 + +/** + * @ingroup lavc_decoding + */ +enum AVDiscard{ + /* We leave some space between them for extensions (drop some + * keyframes for intra-only or drop just some bidir frames). */ + AVDISCARD_NONE =-16, ///< discard nothing + AVDISCARD_DEFAULT = 0, ///< discard useless packets like 0 size packets in avi + AVDISCARD_NONREF = 8, ///< discard all non reference + AVDISCARD_BIDIR = 16, ///< discard all bidirectional frames + AVDISCARD_NONINTRA= 24, ///< discard all non intra frames + AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes + AVDISCARD_ALL = 48, ///< discard all +}; + +enum AVAudioServiceType { + AV_AUDIO_SERVICE_TYPE_MAIN = 0, + AV_AUDIO_SERVICE_TYPE_EFFECTS = 1, + AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED = 2, + AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED = 3, + AV_AUDIO_SERVICE_TYPE_DIALOGUE = 4, + AV_AUDIO_SERVICE_TYPE_COMMENTARY = 5, + AV_AUDIO_SERVICE_TYPE_EMERGENCY = 6, + AV_AUDIO_SERVICE_TYPE_VOICE_OVER = 7, + AV_AUDIO_SERVICE_TYPE_KARAOKE = 8, + AV_AUDIO_SERVICE_TYPE_NB , ///< Not part of ABI +}; + +/** + * @ingroup lavc_encoding + */ +typedef struct RcOverride{ + int start_frame; + int end_frame; + int qscale; // If this is 0 then quality_factor will be used instead. + float quality_factor; +} RcOverride; + +/* encoding support + These flags can be passed in AVCodecContext.flags before initialization. + Note: Not everything is supported yet. +*/ + +/** + * Allow decoders to produce frames with data planes that are not aligned + * to CPU requirements (e.g. due to cropping). + */ +#define AV_CODEC_FLAG_UNALIGNED (1 << 0) +/** + * Use fixed qscale. + */ +#define AV_CODEC_FLAG_QSCALE (1 << 1) +/** + * 4 MV per MB allowed / advanced prediction for H.263. + */ +#define AV_CODEC_FLAG_4MV (1 << 2) +/** + * Output even those frames that might be corrupted. + */ +#define AV_CODEC_FLAG_OUTPUT_CORRUPT (1 << 3) +/** + * Use qpel MC. + */ +#define AV_CODEC_FLAG_QPEL (1 << 4) +/** + * Use internal 2pass ratecontrol in first pass mode. + */ +#define AV_CODEC_FLAG_PASS1 (1 << 9) +/** + * Use internal 2pass ratecontrol in second pass mode. + */ +#define AV_CODEC_FLAG_PASS2 (1 << 10) +/** + * loop filter. + */ +#define AV_CODEC_FLAG_LOOP_FILTER (1 << 11) +/** + * Only decode/encode grayscale. + */ +#define AV_CODEC_FLAG_GRAY (1 << 13) +/** + * error[?] variables will be set during encoding. + */ +#define AV_CODEC_FLAG_PSNR (1 << 15) +/** + * Input bitstream might be truncated at a random location + * instead of only at frame boundaries. + */ +#define AV_CODEC_FLAG_TRUNCATED (1 << 16) +/** + * Use interlaced DCT. + */ +#define AV_CODEC_FLAG_INTERLACED_DCT (1 << 18) +/** + * Force low delay. + */ +#define AV_CODEC_FLAG_LOW_DELAY (1 << 19) +/** + * Place global headers in extradata instead of every keyframe. + */ +#define AV_CODEC_FLAG_GLOBAL_HEADER (1 << 22) +/** + * Use only bitexact stuff (except (I)DCT). + */ +#define AV_CODEC_FLAG_BITEXACT (1 << 23) +/* Fx : Flag for H.263+ extra options */ +/** + * H.263 advanced intra coding / MPEG-4 AC prediction + */ +#define AV_CODEC_FLAG_AC_PRED (1 << 24) +/** + * interlaced motion estimation + */ +#define AV_CODEC_FLAG_INTERLACED_ME (1 << 29) +#define AV_CODEC_FLAG_CLOSED_GOP (1U << 31) + +/** + * Allow non spec compliant speedup tricks. + */ +#define AV_CODEC_FLAG2_FAST (1 << 0) +/** + * Skip bitstream encoding. + */ +#define AV_CODEC_FLAG2_NO_OUTPUT (1 << 2) +/** + * Place global headers at every keyframe instead of in extradata. + */ +#define AV_CODEC_FLAG2_LOCAL_HEADER (1 << 3) + +/** + * timecode is in drop frame format. DEPRECATED!!!! + */ +#define AV_CODEC_FLAG2_DROP_FRAME_TIMECODE (1 << 13) + +/** + * Input bitstream might be truncated at a packet boundaries + * instead of only at frame boundaries. + */ +#define AV_CODEC_FLAG2_CHUNKS (1 << 15) +/** + * Discard cropping information from SPS. + */ +#define AV_CODEC_FLAG2_IGNORE_CROP (1 << 16) + +/** + * Show all frames before the first keyframe + */ +#define AV_CODEC_FLAG2_SHOW_ALL (1 << 22) +/** + * Export motion vectors through frame side data + */ +#define AV_CODEC_FLAG2_EXPORT_MVS (1 << 28) +/** + * Do not skip samples and export skip information as frame side data + */ +#define AV_CODEC_FLAG2_SKIP_MANUAL (1 << 29) +/** + * Do not reset ASS ReadOrder field on flush (subtitles decoding) + */ +#define AV_CODEC_FLAG2_RO_FLUSH_NOOP (1 << 30) + +/* Unsupported options : + * Syntax Arithmetic coding (SAC) + * Reference Picture Selection + * Independent Segment Decoding */ +/* /Fx */ +/* codec capabilities */ + +/** + * Decoder can use draw_horiz_band callback. + */ +#define AV_CODEC_CAP_DRAW_HORIZ_BAND (1 << 0) +/** + * Codec uses get_buffer() for allocating buffers and supports custom allocators. + * If not set, it might not use get_buffer() at all or use operations that + * assume the buffer was allocated by avcodec_default_get_buffer. + */ +#define AV_CODEC_CAP_DR1 (1 << 1) +#define AV_CODEC_CAP_TRUNCATED (1 << 3) +/** + * Encoder or decoder requires flushing with NULL input at the end in order to + * give the complete and correct output. + * + * NOTE: If this flag is not set, the codec is guaranteed to never be fed with + * with NULL data. The user can still send NULL data to the public encode + * or decode function, but libavcodec will not pass it along to the codec + * unless this flag is set. + * + * Decoders: + * The decoder has a non-zero delay and needs to be fed with avpkt->data=NULL, + * avpkt->size=0 at the end to get the delayed data until the decoder no longer + * returns frames. + * + * Encoders: + * The encoder needs to be fed with NULL data at the end of encoding until the + * encoder no longer returns data. + * + * NOTE: For encoders implementing the AVCodec.encode2() function, setting this + * flag also means that the encoder must set the pts and duration for + * each output packet. If this flag is not set, the pts and duration will + * be determined by libavcodec from the input frame. + */ +#define AV_CODEC_CAP_DELAY (1 << 5) +/** + * Codec can be fed a final frame with a smaller size. + * This can be used to prevent truncation of the last audio samples. + */ +#define AV_CODEC_CAP_SMALL_LAST_FRAME (1 << 6) + +/** + * Codec can output multiple frames per AVPacket + * Normally demuxers return one frame at a time, demuxers which do not do + * are connected to a parser to split what they return into proper frames. + * This flag is reserved to the very rare category of codecs which have a + * bitstream that cannot be split into frames without timeconsuming + * operations like full decoding. Demuxers carrying such bitstreams thus + * may return multiple frames in a packet. This has many disadvantages like + * prohibiting stream copy in many cases thus it should only be considered + * as a last resort. + */ +#define AV_CODEC_CAP_SUBFRAMES (1 << 8) +/** + * Codec is experimental and is thus avoided in favor of non experimental + * encoders + */ +#define AV_CODEC_CAP_EXPERIMENTAL (1 << 9) +/** + * Codec should fill in channel configuration and samplerate instead of container + */ +#define AV_CODEC_CAP_CHANNEL_CONF (1 << 10) +/** + * Codec supports frame-level multithreading. + */ +#define AV_CODEC_CAP_FRAME_THREADS (1 << 12) +/** + * Codec supports slice-based (or partition-based) multithreading. + */ +#define AV_CODEC_CAP_SLICE_THREADS (1 << 13) +/** + * Codec supports changed parameters at any point. + */ +#define AV_CODEC_CAP_PARAM_CHANGE (1 << 14) +/** + * Codec supports avctx->thread_count == 0 (auto). + */ +#define AV_CODEC_CAP_AUTO_THREADS (1 << 15) +/** + * Audio encoder supports receiving a different number of samples in each call. + */ +#define AV_CODEC_CAP_VARIABLE_FRAME_SIZE (1 << 16) +/** + * Decoder is not a preferred choice for probing. + * This indicates that the decoder is not a good choice for probing. + * It could for example be an expensive to spin up hardware decoder, + * or it could simply not provide a lot of useful information about + * the stream. + * A decoder marked with this flag should only be used as last resort + * choice for probing. + */ +#define AV_CODEC_CAP_AVOID_PROBING (1 << 17) +/** + * Codec is intra only. + */ +#define AV_CODEC_CAP_INTRA_ONLY 0x40000000 +/** + * Codec is lossless. + */ +#define AV_CODEC_CAP_LOSSLESS 0x80000000 + +/** + * Codec is backed by a hardware implementation. Typically used to + * identify a non-hwaccel hardware decoder. For information about hwaccels, use + * avcodec_get_hw_config() instead. + */ +#define AV_CODEC_CAP_HARDWARE (1 << 18) + +/** + * Codec is potentially backed by a hardware implementation, but not + * necessarily. This is used instead of AV_CODEC_CAP_HARDWARE, if the + * implementation provides some sort of internal fallback. + */ +#define AV_CODEC_CAP_HYBRID (1 << 19) + +/** + * Pan Scan area. + * This specifies the area which should be displayed. + * Note there may be multiple such areas for one frame. + */ +typedef struct AVPanScan { + /** + * id + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + int id; + + /** + * width and height in 1/16 pel + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + int width; + int height; + + /** + * position of the top left corner in 1/16 pel for up to 3 fields/frames + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + int16_t position[3][2]; +} AVPanScan; + +/** + * This structure describes the bitrate properties of an encoded bitstream. It + * roughly corresponds to a subset the VBV parameters for MPEG-2 or HRD + * parameters for H.264/HEVC. + */ +typedef struct AVCPBProperties { + /** + * Maximum bitrate of the stream, in bits per second. + * Zero if unknown or unspecified. + */ + int max_bitrate; + /** + * Minimum bitrate of the stream, in bits per second. + * Zero if unknown or unspecified. + */ + int min_bitrate; + /** + * Average bitrate of the stream, in bits per second. + * Zero if unknown or unspecified. + */ + int avg_bitrate; + + /** + * The size of the buffer to which the ratecontrol is applied, in bits. + * Zero if unknown or unspecified. + */ + int buffer_size; + + /** + * The delay between the time the packet this structure is associated with + * is received and the time when it should be decoded, in periods of a 27MHz + * clock. + * + * UINT64_MAX when unknown or unspecified. + */ + uint64_t vbv_delay; +} AVCPBProperties; + +/** + * The decoder will keep a reference to the frame and may reuse it later. + */ +#define AV_GET_BUFFER_FLAG_REF (1 << 0) + +/** + * @defgroup lavc_packet AVPacket + * + * Types and functions for working with AVPacket. + * @{ + */ +enum AVPacketSideDataType { + /** + * An AV_PKT_DATA_PALETTE side data packet contains exactly AVPALETTE_SIZE + * bytes worth of palette. This side data signals that a new palette is + * present. + */ + AV_PKT_DATA_PALETTE, + + /** + * The AV_PKT_DATA_NEW_EXTRADATA is used to notify the codec or the format + * that the extradata buffer was changed and the receiving side should + * act upon it appropriately. The new extradata is embedded in the side + * data buffer and should be immediately used for processing the current + * frame or packet. + */ + AV_PKT_DATA_NEW_EXTRADATA, + + /** + * An AV_PKT_DATA_PARAM_CHANGE side data packet is laid out as follows: + * @code + * u32le param_flags + * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT) + * s32le channel_count + * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT) + * u64le channel_layout + * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE) + * s32le sample_rate + * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS) + * s32le width + * s32le height + * @endcode + */ + AV_PKT_DATA_PARAM_CHANGE, + + /** + * An AV_PKT_DATA_H263_MB_INFO side data packet contains a number of + * structures with info about macroblocks relevant to splitting the + * packet into smaller packets on macroblock edges (e.g. as for RFC 2190). + * That is, it does not necessarily contain info about all macroblocks, + * as long as the distance between macroblocks in the info is smaller + * than the target payload size. + * Each MB info structure is 12 bytes, and is laid out as follows: + * @code + * u32le bit offset from the start of the packet + * u8 current quantizer at the start of the macroblock + * u8 GOB number + * u16le macroblock address within the GOB + * u8 horizontal MV predictor + * u8 vertical MV predictor + * u8 horizontal MV predictor for block number 3 + * u8 vertical MV predictor for block number 3 + * @endcode + */ + AV_PKT_DATA_H263_MB_INFO, + + /** + * This side data should be associated with an audio stream and contains + * ReplayGain information in form of the AVReplayGain struct. + */ + AV_PKT_DATA_REPLAYGAIN, + + /** + * This side data contains a 3x3 transformation matrix describing an affine + * transformation that needs to be applied to the decoded video frames for + * correct presentation. + * + * See libavutil/display.h for a detailed description of the data. + */ + AV_PKT_DATA_DISPLAYMATRIX, + + /** + * This side data should be associated with a video stream and contains + * Stereoscopic 3D information in form of the AVStereo3D struct. + */ + AV_PKT_DATA_STEREO3D, + + /** + * This side data should be associated with an audio stream and corresponds + * to enum AVAudioServiceType. + */ + AV_PKT_DATA_AUDIO_SERVICE_TYPE, + + /** + * This side data contains quality related information from the encoder. + * @code + * u32le quality factor of the compressed frame. Allowed range is between 1 (good) and FF_LAMBDA_MAX (bad). + * u8 picture type + * u8 error count + * u16 reserved + * u64le[error count] sum of squared differences between encoder in and output + * @endcode + */ + AV_PKT_DATA_QUALITY_STATS, + + /** + * This side data contains an integer value representing the stream index + * of a "fallback" track. A fallback track indicates an alternate + * track to use when the current track can not be decoded for some reason. + * e.g. no decoder available for codec. + */ + AV_PKT_DATA_FALLBACK_TRACK, + + /** + * This side data corresponds to the AVCPBProperties struct. + */ + AV_PKT_DATA_CPB_PROPERTIES, + + /** + * Recommmends skipping the specified number of samples + * @code + * u32le number of samples to skip from start of this packet + * u32le number of samples to skip from end of this packet + * u8 reason for start skip + * u8 reason for end skip (0=padding silence, 1=convergence) + * @endcode + */ + AV_PKT_DATA_SKIP_SAMPLES, + + /** + * An AV_PKT_DATA_JP_DUALMONO side data packet indicates that + * the packet may contain "dual mono" audio specific to Japanese DTV + * and if it is true, recommends only the selected channel to be used. + * @code + * u8 selected channels (0=mail/left, 1=sub/right, 2=both) + * @endcode + */ + AV_PKT_DATA_JP_DUALMONO, + + /** + * A list of zero terminated key/value strings. There is no end marker for + * the list, so it is required to rely on the side data size to stop. + */ + AV_PKT_DATA_STRINGS_METADATA, + + /** + * Subtitle event position + * @code + * u32le x1 + * u32le y1 + * u32le x2 + * u32le y2 + * @endcode + */ + AV_PKT_DATA_SUBTITLE_POSITION, + + /** + * Data found in BlockAdditional element of matroska container. There is + * no end marker for the data, so it is required to rely on the side data + * size to recognize the end. 8 byte id (as found in BlockAddId) followed + * by data. + */ + AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL, + + /** + * The optional first identifier line of a WebVTT cue. + */ + AV_PKT_DATA_WEBVTT_IDENTIFIER, + + /** + * The optional settings (rendering instructions) that immediately + * follow the timestamp specifier of a WebVTT cue. + */ + AV_PKT_DATA_WEBVTT_SETTINGS, + + /** + * A list of zero terminated key/value strings. There is no end marker for + * the list, so it is required to rely on the side data size to stop. This + * side data includes updated metadata which appeared in the stream. + */ + AV_PKT_DATA_METADATA_UPDATE, + + /** + * MPEGTS stream ID, this is required to pass the stream ID + * information from the demuxer to the corresponding muxer. + */ + AV_PKT_DATA_MPEGTS_STREAM_ID, + + /** + * Mastering display metadata (based on SMPTE-2086:2014). This metadata + * should be associated with a video stream and contains data in the form + * of the AVMasteringDisplayMetadata struct. + */ + AV_PKT_DATA_MASTERING_DISPLAY_METADATA, + + /** + * This side data should be associated with a video stream and corresponds + * to the AVSphericalMapping structure. + */ + AV_PKT_DATA_SPHERICAL, + + /** + * Content light level (based on CTA-861.3). This metadata should be + * associated with a video stream and contains data in the form of the + * AVContentLightMetadata struct. + */ + AV_PKT_DATA_CONTENT_LIGHT_LEVEL, + + /** + * ATSC A53 Part 4 Closed Captions. This metadata should be associated with + * a video stream. A53 CC bitstream is stored as uint8_t in AVPacketSideData.data. + * The number of bytes of CC data is AVPacketSideData.size. + */ + AV_PKT_DATA_A53_CC, + + /** + * This side data is encryption initialization data. + * The format is not part of ABI, use av_encryption_init_info_* methods to + * access. + */ + AV_PKT_DATA_ENCRYPTION_INIT_INFO, + + /** + * This side data contains encryption info for how to decrypt the packet. + * The format is not part of ABI, use av_encryption_info_* methods to access. + */ + AV_PKT_DATA_ENCRYPTION_INFO, + + /** + * The number of side data types. + * This is not part of the public API/ABI in the sense that it may + * change when new side data types are added. + * This must stay the last enum value. + * If its value becomes huge, some code using it + * needs to be updated as it assumes it to be smaller than other limits. + */ + AV_PKT_DATA_NB +}; + +#define AV_PKT_DATA_QUALITY_FACTOR AV_PKT_DATA_QUALITY_STATS //DEPRECATED + +typedef struct AVPacketSideData { + uint8_t *data; + int size; + enum AVPacketSideDataType type; +} AVPacketSideData; + +/** + * This structure stores compressed data. It is typically exported by demuxers + * and then passed as input to decoders, or received as output from encoders and + * then passed to muxers. + * + * For video, it should typically contain one compressed frame. For audio it may + * contain several compressed frames. Encoders are allowed to output empty + * packets, with no compressed data, containing only side data + * (e.g. to update some stream parameters at the end of encoding). + * + * AVPacket is one of the few structs in FFmpeg, whose size is a part of public + * ABI. Thus it may be allocated on stack and no new fields can be added to it + * without libavcodec and libavformat major bump. + * + * The semantics of data ownership depends on the buf field. + * If it is set, the packet data is dynamically allocated and is + * valid indefinitely until a call to av_packet_unref() reduces the + * reference count to 0. + * + * If the buf field is not set av_packet_ref() would make a copy instead + * of increasing the reference count. + * + * The side data is always allocated with av_malloc(), copied by + * av_packet_ref() and freed by av_packet_unref(). + * + * @see av_packet_ref + * @see av_packet_unref + */ +typedef struct AVPacket { + /** + * A reference to the reference-counted buffer where the packet data is + * stored. + * May be NULL, then the packet data is not reference-counted. + */ + AVBufferRef *buf; + /** + * Presentation timestamp in AVStream->time_base units; the time at which + * the decompressed packet will be presented to the user. + * Can be AV_NOPTS_VALUE if it is not stored in the file. + * pts MUST be larger or equal to dts as presentation cannot happen before + * decompression, unless one wants to view hex dumps. Some formats misuse + * the terms dts and pts/cts to mean something different. Such timestamps + * must be converted to true pts/dts before they are stored in AVPacket. + */ + int64_t pts; + /** + * Decompression timestamp in AVStream->time_base units; the time at which + * the packet is decompressed. + * Can be AV_NOPTS_VALUE if it is not stored in the file. + */ + int64_t dts; + uint8_t *data; + int size; + int stream_index; + /** + * A combination of AV_PKT_FLAG values + */ + int flags; + /** + * Additional packet data that can be provided by the container. + * Packet can contain several types of side information. + */ + AVPacketSideData *side_data; + int side_data_elems; + + /** + * Duration of this packet in AVStream->time_base units, 0 if unknown. + * Equals next_pts - this_pts in presentation order. + */ + int64_t duration; + + int64_t pos; ///< byte position in stream, -1 if unknown + +#if FF_API_CONVERGENCE_DURATION + /** + * @deprecated Same as the duration field, but as int64_t. This was required + * for Matroska subtitles, whose duration values could overflow when the + * duration field was still an int. + */ + attribute_deprecated + int64_t convergence_duration; +#endif +} AVPacket; +#define AV_PKT_FLAG_KEY 0x0001 ///< The packet contains a keyframe +#define AV_PKT_FLAG_CORRUPT 0x0002 ///< The packet content is corrupted +/** + * Flag is used to discard packets which are required to maintain valid + * decoder state but are not required for output and should be dropped + * after decoding. + **/ +#define AV_PKT_FLAG_DISCARD 0x0004 +/** + * The packet comes from a trusted source. + * + * Otherwise-unsafe constructs such as arbitrary pointers to data + * outside the packet may be followed. + */ +#define AV_PKT_FLAG_TRUSTED 0x0008 +/** + * Flag is used to indicate packets that contain frames that can + * be discarded by the decoder. I.e. Non-reference frames. + */ +#define AV_PKT_FLAG_DISPOSABLE 0x0010 + + +enum AVSideDataParamChangeFlags { + AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT = 0x0001, + AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT = 0x0002, + AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE = 0x0004, + AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS = 0x0008, +}; +/** + * @} + */ + +struct AVCodecInternal; + +enum AVFieldOrder { + AV_FIELD_UNKNOWN, + AV_FIELD_PROGRESSIVE, + AV_FIELD_TT, //< Top coded_first, top displayed first + AV_FIELD_BB, //< Bottom coded first, bottom displayed first + AV_FIELD_TB, //< Top coded first, bottom displayed first + AV_FIELD_BT, //< Bottom coded first, top displayed first +}; + +/** + * main external API structure. + * New fields can be added to the end with minor version bumps. + * Removal, reordering and changes to existing fields require a major + * version bump. + * You can use AVOptions (av_opt* / av_set/get*()) to access these fields from user + * applications. + * The name string for AVOptions options matches the associated command line + * parameter name and can be found in libavcodec/options_table.h + * The AVOption/command line parameter names differ in some cases from the C + * structure field names for historic reasons or brevity. + * sizeof(AVCodecContext) must not be used outside libav*. + */ +typedef struct AVCodecContext { + /** + * information on struct for av_log + * - set by avcodec_alloc_context3 + */ + const AVClass *av_class; + int log_level_offset; + + enum AVMediaType codec_type; /* see AVMEDIA_TYPE_xxx */ + const struct AVCodec *codec; + enum AVCodecID codec_id; /* see AV_CODEC_ID_xxx */ + + /** + * fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A'). + * This is used to work around some encoder bugs. + * A demuxer should set this to what is stored in the field used to identify the codec. + * If there are multiple such fields in a container then the demuxer should choose the one + * which maximizes the information about the used codec. + * If the codec tag field in a container is larger than 32 bits then the demuxer should + * remap the longer ID to 32 bits with a table or other structure. Alternatively a new + * extra_codec_tag + size could be added but for this a clear advantage must be demonstrated + * first. + * - encoding: Set by user, if not then the default based on codec_id will be used. + * - decoding: Set by user, will be converted to uppercase by libavcodec during init. + */ + unsigned int codec_tag; + + void *priv_data; + + /** + * Private context used for internal data. + * + * Unlike priv_data, this is not codec-specific. It is used in general + * libavcodec functions. + */ + struct AVCodecInternal *internal; + + /** + * Private data of the user, can be used to carry app specific stuff. + * - encoding: Set by user. + * - decoding: Set by user. + */ + void *opaque; + + /** + * the average bitrate + * - encoding: Set by user; unused for constant quantizer encoding. + * - decoding: Set by user, may be overwritten by libavcodec + * if this info is available in the stream + */ + int64_t bit_rate; + + /** + * number of bits the bitstream is allowed to diverge from the reference. + * the reference can be CBR (for CBR pass1) or VBR (for pass2) + * - encoding: Set by user; unused for constant quantizer encoding. + * - decoding: unused + */ + int bit_rate_tolerance; + + /** + * Global quality for codecs which cannot change it per frame. + * This should be proportional to MPEG-1/2/4 qscale. + * - encoding: Set by user. + * - decoding: unused + */ + int global_quality; + + /** + * - encoding: Set by user. + * - decoding: unused + */ + int compression_level; +#define FF_COMPRESSION_DEFAULT -1 + + /** + * AV_CODEC_FLAG_*. + * - encoding: Set by user. + * - decoding: Set by user. + */ + int flags; + + /** + * AV_CODEC_FLAG2_* + * - encoding: Set by user. + * - decoding: Set by user. + */ + int flags2; + + /** + * some codecs need / can use extradata like Huffman tables. + * MJPEG: Huffman tables + * rv10: additional flags + * MPEG-4: global headers (they can be in the bitstream or here) + * The allocated memory should be AV_INPUT_BUFFER_PADDING_SIZE bytes larger + * than extradata_size to avoid problems if it is read with the bitstream reader. + * The bytewise contents of extradata must not depend on the architecture or CPU endianness. + * - encoding: Set/allocated/freed by libavcodec. + * - decoding: Set/allocated/freed by user. + */ + uint8_t *extradata; + int extradata_size; + + /** + * This is the fundamental unit of time (in seconds) in terms + * of which frame timestamps are represented. For fixed-fps content, + * timebase should be 1/framerate and timestamp increments should be + * identically 1. + * This often, but not always is the inverse of the frame rate or field rate + * for video. 1/time_base is not the average frame rate if the frame rate is not + * constant. + * + * Like containers, elementary streams also can store timestamps, 1/time_base + * is the unit in which these timestamps are specified. + * As example of such codec time base see ISO/IEC 14496-2:2001(E) + * vop_time_increment_resolution and fixed_vop_rate + * (fixed_vop_rate == 0 implies that it is different from the framerate) + * + * - encoding: MUST be set by user. + * - decoding: the use of this field for decoding is deprecated. + * Use framerate instead. + */ + AVRational time_base; + + /** + * For some codecs, the time base is closer to the field rate than the frame rate. + * Most notably, H.264 and MPEG-2 specify time_base as half of frame duration + * if no telecine is used ... + * + * Set to time_base ticks per frame. Default 1, e.g., H.264/MPEG-2 set it to 2. + */ + int ticks_per_frame; + + /** + * Codec delay. + * + * Encoding: Number of frames delay there will be from the encoder input to + * the decoder output. (we assume the decoder matches the spec) + * Decoding: Number of frames delay in addition to what a standard decoder + * as specified in the spec would produce. + * + * Video: + * Number of frames the decoded output will be delayed relative to the + * encoded input. + * + * Audio: + * For encoding, this field is unused (see initial_padding). + * + * For decoding, this is the number of samples the decoder needs to + * output before the decoder's output is valid. When seeking, you should + * start decoding this many samples prior to your desired seek point. + * + * - encoding: Set by libavcodec. + * - decoding: Set by libavcodec. + */ + int delay; + + + /* video only */ + /** + * picture width / height. + * + * @note Those fields may not match the values of the last + * AVFrame output by avcodec_decode_video2 due frame + * reordering. + * + * - encoding: MUST be set by user. + * - decoding: May be set by the user before opening the decoder if known e.g. + * from the container. Some decoders will require the dimensions + * to be set by the caller. During decoding, the decoder may + * overwrite those values as required while parsing the data. + */ + int width, height; + + /** + * Bitstream width / height, may be different from width/height e.g. when + * the decoded frame is cropped before being output or lowres is enabled. + * + * @note Those field may not match the value of the last + * AVFrame output by avcodec_receive_frame() due frame + * reordering. + * + * - encoding: unused + * - decoding: May be set by the user before opening the decoder if known + * e.g. from the container. During decoding, the decoder may + * overwrite those values as required while parsing the data. + */ + int coded_width, coded_height; + + /** + * the number of pictures in a group of pictures, or 0 for intra_only + * - encoding: Set by user. + * - decoding: unused + */ + int gop_size; + + /** + * Pixel format, see AV_PIX_FMT_xxx. + * May be set by the demuxer if known from headers. + * May be overridden by the decoder if it knows better. + * + * @note This field may not match the value of the last + * AVFrame output by avcodec_receive_frame() due frame + * reordering. + * + * - encoding: Set by user. + * - decoding: Set by user if known, overridden by libavcodec while + * parsing the data. + */ + enum AVPixelFormat pix_fmt; + + /** + * If non NULL, 'draw_horiz_band' is called by the libavcodec + * decoder to draw a horizontal band. It improves cache usage. Not + * all codecs can do that. You must check the codec capabilities + * beforehand. + * When multithreading is used, it may be called from multiple threads + * at the same time; threads might draw different parts of the same AVFrame, + * or multiple AVFrames, and there is no guarantee that slices will be drawn + * in order. + * The function is also used by hardware acceleration APIs. + * It is called at least once during frame decoding to pass + * the data needed for hardware render. + * In that mode instead of pixel data, AVFrame points to + * a structure specific to the acceleration API. The application + * reads the structure and can change some fields to indicate progress + * or mark state. + * - encoding: unused + * - decoding: Set by user. + * @param height the height of the slice + * @param y the y position of the slice + * @param type 1->top field, 2->bottom field, 3->frame + * @param offset offset into the AVFrame.data from which the slice should be read + */ + void (*draw_horiz_band)(struct AVCodecContext *s, + const AVFrame *src, int offset[AV_NUM_DATA_POINTERS], + int y, int type, int height); + + /** + * callback to negotiate the pixelFormat + * @param fmt is the list of formats which are supported by the codec, + * it is terminated by -1 as 0 is a valid format, the formats are ordered by quality. + * The first is always the native one. + * @note The callback may be called again immediately if initialization for + * the selected (hardware-accelerated) pixel format failed. + * @warning Behavior is undefined if the callback returns a value not + * in the fmt list of formats. + * @return the chosen format + * - encoding: unused + * - decoding: Set by user, if not set the native format will be chosen. + */ + enum AVPixelFormat (*get_format)(struct AVCodecContext *s, const enum AVPixelFormat * fmt); + + /** + * maximum number of B-frames between non-B-frames + * Note: The output will be delayed by max_b_frames+1 relative to the input. + * - encoding: Set by user. + * - decoding: unused + */ + int max_b_frames; + + /** + * qscale factor between IP and B-frames + * If > 0 then the last P-frame quantizer will be used (q= lastp_q*factor+offset). + * If < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset). + * - encoding: Set by user. + * - decoding: unused + */ + float b_quant_factor; + +#if FF_API_PRIVATE_OPT + /** @deprecated use encoder private options instead */ + attribute_deprecated + int b_frame_strategy; +#endif + + /** + * qscale offset between IP and B-frames + * - encoding: Set by user. + * - decoding: unused + */ + float b_quant_offset; + + /** + * Size of the frame reordering buffer in the decoder. + * For MPEG-2 it is 1 IPB or 0 low delay IP. + * - encoding: Set by libavcodec. + * - decoding: Set by libavcodec. + */ + int has_b_frames; + +#if FF_API_PRIVATE_OPT + /** @deprecated use encoder private options instead */ + attribute_deprecated + int mpeg_quant; +#endif + + /** + * qscale factor between P- and I-frames + * If > 0 then the last P-frame quantizer will be used (q = lastp_q * factor + offset). + * If < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset). + * - encoding: Set by user. + * - decoding: unused + */ + float i_quant_factor; + + /** + * qscale offset between P and I-frames + * - encoding: Set by user. + * - decoding: unused + */ + float i_quant_offset; + + /** + * luminance masking (0-> disabled) + * - encoding: Set by user. + * - decoding: unused + */ + float lumi_masking; + + /** + * temporary complexity masking (0-> disabled) + * - encoding: Set by user. + * - decoding: unused + */ + float temporal_cplx_masking; + + /** + * spatial complexity masking (0-> disabled) + * - encoding: Set by user. + * - decoding: unused + */ + float spatial_cplx_masking; + + /** + * p block masking (0-> disabled) + * - encoding: Set by user. + * - decoding: unused + */ + float p_masking; + + /** + * darkness masking (0-> disabled) + * - encoding: Set by user. + * - decoding: unused + */ + float dark_masking; + + /** + * slice count + * - encoding: Set by libavcodec. + * - decoding: Set by user (or 0). + */ + int slice_count; + +#if FF_API_PRIVATE_OPT + /** @deprecated use encoder private options instead */ + attribute_deprecated + int prediction_method; +#define FF_PRED_LEFT 0 +#define FF_PRED_PLANE 1 +#define FF_PRED_MEDIAN 2 +#endif + + /** + * slice offsets in the frame in bytes + * - encoding: Set/allocated by libavcodec. + * - decoding: Set/allocated by user (or NULL). + */ + int *slice_offset; + + /** + * sample aspect ratio (0 if unknown) + * That is the width of a pixel divided by the height of the pixel. + * Numerator and denominator must be relatively prime and smaller than 256 for some video standards. + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + AVRational sample_aspect_ratio; + + /** + * motion estimation comparison function + * - encoding: Set by user. + * - decoding: unused + */ + int me_cmp; + /** + * subpixel motion estimation comparison function + * - encoding: Set by user. + * - decoding: unused + */ + int me_sub_cmp; + /** + * macroblock comparison function (not supported yet) + * - encoding: Set by user. + * - decoding: unused + */ + int mb_cmp; + /** + * interlaced DCT comparison function + * - encoding: Set by user. + * - decoding: unused + */ + int ildct_cmp; +#define FF_CMP_SAD 0 +#define FF_CMP_SSE 1 +#define FF_CMP_SATD 2 +#define FF_CMP_DCT 3 +#define FF_CMP_PSNR 4 +#define FF_CMP_BIT 5 +#define FF_CMP_RD 6 +#define FF_CMP_ZERO 7 +#define FF_CMP_VSAD 8 +#define FF_CMP_VSSE 9 +#define FF_CMP_NSSE 10 +#define FF_CMP_W53 11 +#define FF_CMP_W97 12 +#define FF_CMP_DCTMAX 13 +#define FF_CMP_DCT264 14 +#define FF_CMP_MEDIAN_SAD 15 +#define FF_CMP_CHROMA 256 + + /** + * ME diamond size & shape + * - encoding: Set by user. + * - decoding: unused + */ + int dia_size; + + /** + * amount of previous MV predictors (2a+1 x 2a+1 square) + * - encoding: Set by user. + * - decoding: unused + */ + int last_predictor_count; + +#if FF_API_PRIVATE_OPT + /** @deprecated use encoder private options instead */ + attribute_deprecated + int pre_me; +#endif + + /** + * motion estimation prepass comparison function + * - encoding: Set by user. + * - decoding: unused + */ + int me_pre_cmp; + + /** + * ME prepass diamond size & shape + * - encoding: Set by user. + * - decoding: unused + */ + int pre_dia_size; + + /** + * subpel ME quality + * - encoding: Set by user. + * - decoding: unused + */ + int me_subpel_quality; + + /** + * maximum motion estimation search range in subpel units + * If 0 then no limit. + * + * - encoding: Set by user. + * - decoding: unused + */ + int me_range; + + /** + * slice flags + * - encoding: unused + * - decoding: Set by user. + */ + int slice_flags; +#define SLICE_FLAG_CODED_ORDER 0x0001 ///< draw_horiz_band() is called in coded order instead of display +#define SLICE_FLAG_ALLOW_FIELD 0x0002 ///< allow draw_horiz_band() with field slices (MPEG-2 field pics) +#define SLICE_FLAG_ALLOW_PLANE 0x0004 ///< allow draw_horiz_band() with 1 component at a time (SVQ1) + + /** + * macroblock decision mode + * - encoding: Set by user. + * - decoding: unused + */ + int mb_decision; +#define FF_MB_DECISION_SIMPLE 0 ///< uses mb_cmp +#define FF_MB_DECISION_BITS 1 ///< chooses the one which needs the fewest bits +#define FF_MB_DECISION_RD 2 ///< rate distortion + + /** + * custom intra quantization matrix + * - encoding: Set by user, can be NULL. + * - decoding: Set by libavcodec. + */ + uint16_t *intra_matrix; + + /** + * custom inter quantization matrix + * - encoding: Set by user, can be NULL. + * - decoding: Set by libavcodec. + */ + uint16_t *inter_matrix; + +#if FF_API_PRIVATE_OPT + /** @deprecated use encoder private options instead */ + attribute_deprecated + int scenechange_threshold; + + /** @deprecated use encoder private options instead */ + attribute_deprecated + int noise_reduction; +#endif + + /** + * precision of the intra DC coefficient - 8 + * - encoding: Set by user. + * - decoding: Set by libavcodec + */ + int intra_dc_precision; + + /** + * Number of macroblock rows at the top which are skipped. + * - encoding: unused + * - decoding: Set by user. + */ + int skip_top; + + /** + * Number of macroblock rows at the bottom which are skipped. + * - encoding: unused + * - decoding: Set by user. + */ + int skip_bottom; + + /** + * minimum MB Lagrange multiplier + * - encoding: Set by user. + * - decoding: unused + */ + int mb_lmin; + + /** + * maximum MB Lagrange multiplier + * - encoding: Set by user. + * - decoding: unused + */ + int mb_lmax; + +#if FF_API_PRIVATE_OPT + /** + * @deprecated use encoder private options instead + */ + attribute_deprecated + int me_penalty_compensation; +#endif + + /** + * - encoding: Set by user. + * - decoding: unused + */ + int bidir_refine; + +#if FF_API_PRIVATE_OPT + /** @deprecated use encoder private options instead */ + attribute_deprecated + int brd_scale; +#endif + + /** + * minimum GOP size + * - encoding: Set by user. + * - decoding: unused + */ + int keyint_min; + + /** + * number of reference frames + * - encoding: Set by user. + * - decoding: Set by lavc. + */ + int refs; + +#if FF_API_PRIVATE_OPT + /** @deprecated use encoder private options instead */ + attribute_deprecated + int chromaoffset; +#endif + + /** + * Note: Value depends upon the compare function used for fullpel ME. + * - encoding: Set by user. + * - decoding: unused + */ + int mv0_threshold; + +#if FF_API_PRIVATE_OPT + /** @deprecated use encoder private options instead */ + attribute_deprecated + int b_sensitivity; +#endif + + /** + * Chromaticity coordinates of the source primaries. + * - encoding: Set by user + * - decoding: Set by libavcodec + */ + enum AVColorPrimaries color_primaries; + + /** + * Color Transfer Characteristic. + * - encoding: Set by user + * - decoding: Set by libavcodec + */ + enum AVColorTransferCharacteristic color_trc; + + /** + * YUV colorspace type. + * - encoding: Set by user + * - decoding: Set by libavcodec + */ + enum AVColorSpace colorspace; + + /** + * MPEG vs JPEG YUV range. + * - encoding: Set by user + * - decoding: Set by libavcodec + */ + enum AVColorRange color_range; + + /** + * This defines the location of chroma samples. + * - encoding: Set by user + * - decoding: Set by libavcodec + */ + enum AVChromaLocation chroma_sample_location; + + /** + * Number of slices. + * Indicates number of picture subdivisions. Used for parallelized + * decoding. + * - encoding: Set by user + * - decoding: unused + */ + int slices; + + /** Field order + * - encoding: set by libavcodec + * - decoding: Set by user. + */ + enum AVFieldOrder field_order; + + /* audio only */ + int sample_rate; ///< samples per second + int channels; ///< number of audio channels + + /** + * audio sample format + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + enum AVSampleFormat sample_fmt; ///< sample format + + /* The following data should not be initialized. */ + /** + * Number of samples per channel in an audio frame. + * + * - encoding: set by libavcodec in avcodec_open2(). Each submitted frame + * except the last must contain exactly frame_size samples per channel. + * May be 0 when the codec has AV_CODEC_CAP_VARIABLE_FRAME_SIZE set, then the + * frame size is not restricted. + * - decoding: may be set by some decoders to indicate constant frame size + */ + int frame_size; + + /** + * Frame counter, set by libavcodec. + * + * - decoding: total number of frames returned from the decoder so far. + * - encoding: total number of frames passed to the encoder so far. + * + * @note the counter is not incremented if encoding/decoding resulted in + * an error. + */ + int frame_number; + + /** + * number of bytes per packet if constant and known or 0 + * Used by some WAV based audio codecs. + */ + int block_align; + + /** + * Audio cutoff bandwidth (0 means "automatic") + * - encoding: Set by user. + * - decoding: unused + */ + int cutoff; + + /** + * Audio channel layout. + * - encoding: set by user. + * - decoding: set by user, may be overwritten by libavcodec. + */ + uint64_t channel_layout; + + /** + * Request decoder to use this channel layout if it can (0 for default) + * - encoding: unused + * - decoding: Set by user. + */ + uint64_t request_channel_layout; + + /** + * Type of service that the audio stream conveys. + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + enum AVAudioServiceType audio_service_type; + + /** + * desired sample format + * - encoding: Not used. + * - decoding: Set by user. + * Decoder will decode to this format if it can. + */ + enum AVSampleFormat request_sample_fmt; + + /** + * This callback is called at the beginning of each frame to get data + * buffer(s) for it. There may be one contiguous buffer for all the data or + * there may be a buffer per each data plane or anything in between. What + * this means is, you may set however many entries in buf[] you feel necessary. + * Each buffer must be reference-counted using the AVBuffer API (see description + * of buf[] below). + * + * The following fields will be set in the frame before this callback is + * called: + * - format + * - width, height (video only) + * - sample_rate, channel_layout, nb_samples (audio only) + * Their values may differ from the corresponding values in + * AVCodecContext. This callback must use the frame values, not the codec + * context values, to calculate the required buffer size. + * + * This callback must fill the following fields in the frame: + * - data[] + * - linesize[] + * - extended_data: + * * if the data is planar audio with more than 8 channels, then this + * callback must allocate and fill extended_data to contain all pointers + * to all data planes. data[] must hold as many pointers as it can. + * extended_data must be allocated with av_malloc() and will be freed in + * av_frame_unref(). + * * otherwise extended_data must point to data + * - buf[] must contain one or more pointers to AVBufferRef structures. Each of + * the frame's data and extended_data pointers must be contained in these. That + * is, one AVBufferRef for each allocated chunk of memory, not necessarily one + * AVBufferRef per data[] entry. See: av_buffer_create(), av_buffer_alloc(), + * and av_buffer_ref(). + * - extended_buf and nb_extended_buf must be allocated with av_malloc() by + * this callback and filled with the extra buffers if there are more + * buffers than buf[] can hold. extended_buf will be freed in + * av_frame_unref(). + * + * If AV_CODEC_CAP_DR1 is not set then get_buffer2() must call + * avcodec_default_get_buffer2() instead of providing buffers allocated by + * some other means. + * + * Each data plane must be aligned to the maximum required by the target + * CPU. + * + * @see avcodec_default_get_buffer2() + * + * Video: + * + * If AV_GET_BUFFER_FLAG_REF is set in flags then the frame may be reused + * (read and/or written to if it is writable) later by libavcodec. + * + * avcodec_align_dimensions2() should be used to find the required width and + * height, as they normally need to be rounded up to the next multiple of 16. + * + * Some decoders do not support linesizes changing between frames. + * + * If frame multithreading is used and thread_safe_callbacks is set, + * this callback may be called from a different thread, but not from more + * than one at once. Does not need to be reentrant. + * + * @see avcodec_align_dimensions2() + * + * Audio: + * + * Decoders request a buffer of a particular size by setting + * AVFrame.nb_samples prior to calling get_buffer2(). The decoder may, + * however, utilize only part of the buffer by setting AVFrame.nb_samples + * to a smaller value in the output frame. + * + * As a convenience, av_samples_get_buffer_size() and + * av_samples_fill_arrays() in libavutil may be used by custom get_buffer2() + * functions to find the required data size and to fill data pointers and + * linesize. In AVFrame.linesize, only linesize[0] may be set for audio + * since all planes must be the same size. + * + * @see av_samples_get_buffer_size(), av_samples_fill_arrays() + * + * - encoding: unused + * - decoding: Set by libavcodec, user can override. + */ + int (*get_buffer2)(struct AVCodecContext *s, AVFrame *frame, int flags); + + /** + * If non-zero, the decoded audio and video frames returned from + * avcodec_decode_video2() and avcodec_decode_audio4() are reference-counted + * and are valid indefinitely. The caller must free them with + * av_frame_unref() when they are not needed anymore. + * Otherwise, the decoded frames must not be freed by the caller and are + * only valid until the next decode call. + * + * This is always automatically enabled if avcodec_receive_frame() is used. + * + * - encoding: unused + * - decoding: set by the caller before avcodec_open2(). + */ + attribute_deprecated + int refcounted_frames; + + /* - encoding parameters */ + float qcompress; ///< amount of qscale change between easy & hard scenes (0.0-1.0) + float qblur; ///< amount of qscale smoothing over time (0.0-1.0) + + /** + * minimum quantizer + * - encoding: Set by user. + * - decoding: unused + */ + int qmin; + + /** + * maximum quantizer + * - encoding: Set by user. + * - decoding: unused + */ + int qmax; + + /** + * maximum quantizer difference between frames + * - encoding: Set by user. + * - decoding: unused + */ + int max_qdiff; + + /** + * decoder bitstream buffer size + * - encoding: Set by user. + * - decoding: unused + */ + int rc_buffer_size; + + /** + * ratecontrol override, see RcOverride + * - encoding: Allocated/set/freed by user. + * - decoding: unused + */ + int rc_override_count; + RcOverride *rc_override; + + /** + * maximum bitrate + * - encoding: Set by user. + * - decoding: Set by user, may be overwritten by libavcodec. + */ + int64_t rc_max_rate; + + /** + * minimum bitrate + * - encoding: Set by user. + * - decoding: unused + */ + int64_t rc_min_rate; + + /** + * Ratecontrol attempt to use, at maximum, of what can be used without an underflow. + * - encoding: Set by user. + * - decoding: unused. + */ + float rc_max_available_vbv_use; + + /** + * Ratecontrol attempt to use, at least, times the amount needed to prevent a vbv overflow. + * - encoding: Set by user. + * - decoding: unused. + */ + float rc_min_vbv_overflow_use; + + /** + * Number of bits which should be loaded into the rc buffer before decoding starts. + * - encoding: Set by user. + * - decoding: unused + */ + int rc_initial_buffer_occupancy; + +#if FF_API_CODER_TYPE +#define FF_CODER_TYPE_VLC 0 +#define FF_CODER_TYPE_AC 1 +#define FF_CODER_TYPE_RAW 2 +#define FF_CODER_TYPE_RLE 3 + /** + * @deprecated use encoder private options instead + */ + attribute_deprecated + int coder_type; +#endif /* FF_API_CODER_TYPE */ + +#if FF_API_PRIVATE_OPT + /** @deprecated use encoder private options instead */ + attribute_deprecated + int context_model; +#endif + +#if FF_API_PRIVATE_OPT + /** @deprecated use encoder private options instead */ + attribute_deprecated + int frame_skip_threshold; + + /** @deprecated use encoder private options instead */ + attribute_deprecated + int frame_skip_factor; + + /** @deprecated use encoder private options instead */ + attribute_deprecated + int frame_skip_exp; + + /** @deprecated use encoder private options instead */ + attribute_deprecated + int frame_skip_cmp; +#endif /* FF_API_PRIVATE_OPT */ + + /** + * trellis RD quantization + * - encoding: Set by user. + * - decoding: unused + */ + int trellis; + +#if FF_API_PRIVATE_OPT + /** @deprecated use encoder private options instead */ + attribute_deprecated + int min_prediction_order; + + /** @deprecated use encoder private options instead */ + attribute_deprecated + int max_prediction_order; + + /** @deprecated use encoder private options instead */ + attribute_deprecated + int64_t timecode_frame_start; +#endif + +#if FF_API_RTP_CALLBACK + /** + * @deprecated unused + */ + /* The RTP callback: This function is called */ + /* every time the encoder has a packet to send. */ + /* It depends on the encoder if the data starts */ + /* with a Start Code (it should). H.263 does. */ + /* mb_nb contains the number of macroblocks */ + /* encoded in the RTP payload. */ + attribute_deprecated + void (*rtp_callback)(struct AVCodecContext *avctx, void *data, int size, int mb_nb); +#endif + +#if FF_API_PRIVATE_OPT + /** @deprecated use encoder private options instead */ + attribute_deprecated + int rtp_payload_size; /* The size of the RTP payload: the coder will */ + /* do its best to deliver a chunk with size */ + /* below rtp_payload_size, the chunk will start */ + /* with a start code on some codecs like H.263. */ + /* This doesn't take account of any particular */ + /* headers inside the transmitted RTP payload. */ +#endif + +#if FF_API_STAT_BITS + /* statistics, used for 2-pass encoding */ + attribute_deprecated + int mv_bits; + attribute_deprecated + int header_bits; + attribute_deprecated + int i_tex_bits; + attribute_deprecated + int p_tex_bits; + attribute_deprecated + int i_count; + attribute_deprecated + int p_count; + attribute_deprecated + int skip_count; + attribute_deprecated + int misc_bits; + + /** @deprecated this field is unused */ + attribute_deprecated + int frame_bits; +#endif + + /** + * pass1 encoding statistics output buffer + * - encoding: Set by libavcodec. + * - decoding: unused + */ + char *stats_out; + + /** + * pass2 encoding statistics input buffer + * Concatenated stuff from stats_out of pass1 should be placed here. + * - encoding: Allocated/set/freed by user. + * - decoding: unused + */ + char *stats_in; + + /** + * Work around bugs in encoders which sometimes cannot be detected automatically. + * - encoding: Set by user + * - decoding: Set by user + */ + int workaround_bugs; +#define FF_BUG_AUTODETECT 1 ///< autodetection +#define FF_BUG_XVID_ILACE 4 +#define FF_BUG_UMP4 8 +#define FF_BUG_NO_PADDING 16 +#define FF_BUG_AMV 32 +#define FF_BUG_QPEL_CHROMA 64 +#define FF_BUG_STD_QPEL 128 +#define FF_BUG_QPEL_CHROMA2 256 +#define FF_BUG_DIRECT_BLOCKSIZE 512 +#define FF_BUG_EDGE 1024 +#define FF_BUG_HPEL_CHROMA 2048 +#define FF_BUG_DC_CLIP 4096 +#define FF_BUG_MS 8192 ///< Work around various bugs in Microsoft's broken decoders. +#define FF_BUG_TRUNCATED 16384 +#define FF_BUG_IEDGE 32768 + + /** + * strictly follow the standard (MPEG-4, ...). + * - encoding: Set by user. + * - decoding: Set by user. + * Setting this to STRICT or higher means the encoder and decoder will + * generally do stupid things, whereas setting it to unofficial or lower + * will mean the encoder might produce output that is not supported by all + * spec-compliant decoders. Decoders don't differentiate between normal, + * unofficial and experimental (that is, they always try to decode things + * when they can) unless they are explicitly asked to behave stupidly + * (=strictly conform to the specs) + */ + int strict_std_compliance; +#define FF_COMPLIANCE_VERY_STRICT 2 ///< Strictly conform to an older more strict version of the spec or reference software. +#define FF_COMPLIANCE_STRICT 1 ///< Strictly conform to all the things in the spec no matter what consequences. +#define FF_COMPLIANCE_NORMAL 0 +#define FF_COMPLIANCE_UNOFFICIAL -1 ///< Allow unofficial extensions +#define FF_COMPLIANCE_EXPERIMENTAL -2 ///< Allow nonstandardized experimental things. + + /** + * error concealment flags + * - encoding: unused + * - decoding: Set by user. + */ + int error_concealment; +#define FF_EC_GUESS_MVS 1 +#define FF_EC_DEBLOCK 2 +#define FF_EC_FAVOR_INTER 256 + + /** + * debug + * - encoding: Set by user. + * - decoding: Set by user. + */ + int debug; +#define FF_DEBUG_PICT_INFO 1 +#define FF_DEBUG_RC 2 +#define FF_DEBUG_BITSTREAM 4 +#define FF_DEBUG_MB_TYPE 8 +#define FF_DEBUG_QP 16 +#if FF_API_DEBUG_MV +/** + * @deprecated this option does nothing + */ +#define FF_DEBUG_MV 32 +#endif +#define FF_DEBUG_DCT_COEFF 0x00000040 +#define FF_DEBUG_SKIP 0x00000080 +#define FF_DEBUG_STARTCODE 0x00000100 +#define FF_DEBUG_ER 0x00000400 +#define FF_DEBUG_MMCO 0x00000800 +#define FF_DEBUG_BUGS 0x00001000 +#if FF_API_DEBUG_MV +#define FF_DEBUG_VIS_QP 0x00002000 +#define FF_DEBUG_VIS_MB_TYPE 0x00004000 +#endif +#define FF_DEBUG_BUFFERS 0x00008000 +#define FF_DEBUG_THREADS 0x00010000 +#define FF_DEBUG_GREEN_MD 0x00800000 +#define FF_DEBUG_NOMC 0x01000000 + +#if FF_API_DEBUG_MV + /** + * debug + * - encoding: Set by user. + * - decoding: Set by user. + */ + int debug_mv; +#define FF_DEBUG_VIS_MV_P_FOR 0x00000001 // visualize forward predicted MVs of P-frames +#define FF_DEBUG_VIS_MV_B_FOR 0x00000002 // visualize forward predicted MVs of B-frames +#define FF_DEBUG_VIS_MV_B_BACK 0x00000004 // visualize backward predicted MVs of B-frames +#endif + + /** + * Error recognition; may misdetect some more or less valid parts as errors. + * - encoding: unused + * - decoding: Set by user. + */ + int err_recognition; + +/** + * Verify checksums embedded in the bitstream (could be of either encoded or + * decoded data, depending on the codec) and print an error message on mismatch. + * If AV_EF_EXPLODE is also set, a mismatching checksum will result in the + * decoder returning an error. + */ +#define AV_EF_CRCCHECK (1<<0) +#define AV_EF_BITSTREAM (1<<1) ///< detect bitstream specification deviations +#define AV_EF_BUFFER (1<<2) ///< detect improper bitstream length +#define AV_EF_EXPLODE (1<<3) ///< abort decoding on minor error detection + +#define AV_EF_IGNORE_ERR (1<<15) ///< ignore errors and continue +#define AV_EF_CAREFUL (1<<16) ///< consider things that violate the spec, are fast to calculate and have not been seen in the wild as errors +#define AV_EF_COMPLIANT (1<<17) ///< consider all spec non compliances as errors +#define AV_EF_AGGRESSIVE (1<<18) ///< consider things that a sane encoder should not do as an error + + + /** + * opaque 64-bit number (generally a PTS) that will be reordered and + * output in AVFrame.reordered_opaque + * - encoding: unused + * - decoding: Set by user. + */ + int64_t reordered_opaque; + + /** + * Hardware accelerator in use + * - encoding: unused. + * - decoding: Set by libavcodec + */ + const struct AVHWAccel *hwaccel; + + /** + * Hardware accelerator context. + * For some hardware accelerators, a global context needs to be + * provided by the user. In that case, this holds display-dependent + * data FFmpeg cannot instantiate itself. Please refer to the + * FFmpeg HW accelerator documentation to know how to fill this + * is. e.g. for VA API, this is a struct vaapi_context. + * - encoding: unused + * - decoding: Set by user + */ + void *hwaccel_context; + + /** + * error + * - encoding: Set by libavcodec if flags & AV_CODEC_FLAG_PSNR. + * - decoding: unused + */ + uint64_t error[AV_NUM_DATA_POINTERS]; + + /** + * DCT algorithm, see FF_DCT_* below + * - encoding: Set by user. + * - decoding: unused + */ + int dct_algo; +#define FF_DCT_AUTO 0 +#define FF_DCT_FASTINT 1 +#define FF_DCT_INT 2 +#define FF_DCT_MMX 3 +#define FF_DCT_ALTIVEC 5 +#define FF_DCT_FAAN 6 + + /** + * IDCT algorithm, see FF_IDCT_* below. + * - encoding: Set by user. + * - decoding: Set by user. + */ + int idct_algo; +#define FF_IDCT_AUTO 0 +#define FF_IDCT_INT 1 +#define FF_IDCT_SIMPLE 2 +#define FF_IDCT_SIMPLEMMX 3 +#define FF_IDCT_ARM 7 +#define FF_IDCT_ALTIVEC 8 +#define FF_IDCT_SIMPLEARM 10 +#define FF_IDCT_XVID 14 +#define FF_IDCT_SIMPLEARMV5TE 16 +#define FF_IDCT_SIMPLEARMV6 17 +#define FF_IDCT_FAAN 20 +#define FF_IDCT_SIMPLENEON 22 +#define FF_IDCT_NONE 24 /* Used by XvMC to extract IDCT coefficients with FF_IDCT_PERM_NONE */ +#define FF_IDCT_SIMPLEAUTO 128 + + /** + * bits per sample/pixel from the demuxer (needed for huffyuv). + * - encoding: Set by libavcodec. + * - decoding: Set by user. + */ + int bits_per_coded_sample; + + /** + * Bits per sample/pixel of internal libavcodec pixel/sample format. + * - encoding: set by user. + * - decoding: set by libavcodec. + */ + int bits_per_raw_sample; + +#if FF_API_LOWRES + /** + * low resolution decoding, 1-> 1/2 size, 2->1/4 size + * - encoding: unused + * - decoding: Set by user. + */ + int lowres; +#endif + +#if FF_API_CODED_FRAME + /** + * the picture in the bitstream + * - encoding: Set by libavcodec. + * - decoding: unused + * + * @deprecated use the quality factor packet side data instead + */ + attribute_deprecated AVFrame *coded_frame; +#endif + + /** + * thread count + * is used to decide how many independent tasks should be passed to execute() + * - encoding: Set by user. + * - decoding: Set by user. + */ + int thread_count; + + /** + * Which multithreading methods to use. + * Use of FF_THREAD_FRAME will increase decoding delay by one frame per thread, + * so clients which cannot provide future frames should not use it. + * + * - encoding: Set by user, otherwise the default is used. + * - decoding: Set by user, otherwise the default is used. + */ + int thread_type; +#define FF_THREAD_FRAME 1 ///< Decode more than one frame at once +#define FF_THREAD_SLICE 2 ///< Decode more than one part of a single frame at once + + /** + * Which multithreading methods are in use by the codec. + * - encoding: Set by libavcodec. + * - decoding: Set by libavcodec. + */ + int active_thread_type; + + /** + * Set by the client if its custom get_buffer() callback can be called + * synchronously from another thread, which allows faster multithreaded decoding. + * draw_horiz_band() will be called from other threads regardless of this setting. + * Ignored if the default get_buffer() is used. + * - encoding: Set by user. + * - decoding: Set by user. + */ + int thread_safe_callbacks; + + /** + * The codec may call this to execute several independent things. + * It will return only after finishing all tasks. + * The user may replace this with some multithreaded implementation, + * the default implementation will execute the parts serially. + * @param count the number of things to execute + * - encoding: Set by libavcodec, user can override. + * - decoding: Set by libavcodec, user can override. + */ + int (*execute)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg), void *arg2, int *ret, int count, int size); + + /** + * The codec may call this to execute several independent things. + * It will return only after finishing all tasks. + * The user may replace this with some multithreaded implementation, + * the default implementation will execute the parts serially. + * Also see avcodec_thread_init and e.g. the --enable-pthread configure option. + * @param c context passed also to func + * @param count the number of things to execute + * @param arg2 argument passed unchanged to func + * @param ret return values of executed functions, must have space for "count" values. May be NULL. + * @param func function that will be called count times, with jobnr from 0 to count-1. + * threadnr will be in the range 0 to c->thread_count-1 < MAX_THREADS and so that no + * two instances of func executing at the same time will have the same threadnr. + * @return always 0 currently, but code should handle a future improvement where when any call to func + * returns < 0 no further calls to func may be done and < 0 is returned. + * - encoding: Set by libavcodec, user can override. + * - decoding: Set by libavcodec, user can override. + */ + int (*execute2)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg, int jobnr, int threadnr), void *arg2, int *ret, int count); + + /** + * noise vs. sse weight for the nsse comparison function + * - encoding: Set by user. + * - decoding: unused + */ + int nsse_weight; + + /** + * profile + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + int profile; +#define FF_PROFILE_UNKNOWN -99 +#define FF_PROFILE_RESERVED -100 + +#define FF_PROFILE_AAC_MAIN 0 +#define FF_PROFILE_AAC_LOW 1 +#define FF_PROFILE_AAC_SSR 2 +#define FF_PROFILE_AAC_LTP 3 +#define FF_PROFILE_AAC_HE 4 +#define FF_PROFILE_AAC_HE_V2 28 +#define FF_PROFILE_AAC_LD 22 +#define FF_PROFILE_AAC_ELD 38 +#define FF_PROFILE_MPEG2_AAC_LOW 128 +#define FF_PROFILE_MPEG2_AAC_HE 131 + +#define FF_PROFILE_DNXHD 0 +#define FF_PROFILE_DNXHR_LB 1 +#define FF_PROFILE_DNXHR_SQ 2 +#define FF_PROFILE_DNXHR_HQ 3 +#define FF_PROFILE_DNXHR_HQX 4 +#define FF_PROFILE_DNXHR_444 5 + +#define FF_PROFILE_DTS 20 +#define FF_PROFILE_DTS_ES 30 +#define FF_PROFILE_DTS_96_24 40 +#define FF_PROFILE_DTS_HD_HRA 50 +#define FF_PROFILE_DTS_HD_MA 60 +#define FF_PROFILE_DTS_EXPRESS 70 + +#define FF_PROFILE_MPEG2_422 0 +#define FF_PROFILE_MPEG2_HIGH 1 +#define FF_PROFILE_MPEG2_SS 2 +#define FF_PROFILE_MPEG2_SNR_SCALABLE 3 +#define FF_PROFILE_MPEG2_MAIN 4 +#define FF_PROFILE_MPEG2_SIMPLE 5 + +#define FF_PROFILE_H264_CONSTRAINED (1<<9) // 8+1; constraint_set1_flag +#define FF_PROFILE_H264_INTRA (1<<11) // 8+3; constraint_set3_flag + +#define FF_PROFILE_H264_BASELINE 66 +#define FF_PROFILE_H264_CONSTRAINED_BASELINE (66|FF_PROFILE_H264_CONSTRAINED) +#define FF_PROFILE_H264_MAIN 77 +#define FF_PROFILE_H264_EXTENDED 88 +#define FF_PROFILE_H264_HIGH 100 +#define FF_PROFILE_H264_HIGH_10 110 +#define FF_PROFILE_H264_HIGH_10_INTRA (110|FF_PROFILE_H264_INTRA) +#define FF_PROFILE_H264_MULTIVIEW_HIGH 118 +#define FF_PROFILE_H264_HIGH_422 122 +#define FF_PROFILE_H264_HIGH_422_INTRA (122|FF_PROFILE_H264_INTRA) +#define FF_PROFILE_H264_STEREO_HIGH 128 +#define FF_PROFILE_H264_HIGH_444 144 +#define FF_PROFILE_H264_HIGH_444_PREDICTIVE 244 +#define FF_PROFILE_H264_HIGH_444_INTRA (244|FF_PROFILE_H264_INTRA) +#define FF_PROFILE_H264_CAVLC_444 44 + +#define FF_PROFILE_VC1_SIMPLE 0 +#define FF_PROFILE_VC1_MAIN 1 +#define FF_PROFILE_VC1_COMPLEX 2 +#define FF_PROFILE_VC1_ADVANCED 3 + +#define FF_PROFILE_MPEG4_SIMPLE 0 +#define FF_PROFILE_MPEG4_SIMPLE_SCALABLE 1 +#define FF_PROFILE_MPEG4_CORE 2 +#define FF_PROFILE_MPEG4_MAIN 3 +#define FF_PROFILE_MPEG4_N_BIT 4 +#define FF_PROFILE_MPEG4_SCALABLE_TEXTURE 5 +#define FF_PROFILE_MPEG4_SIMPLE_FACE_ANIMATION 6 +#define FF_PROFILE_MPEG4_BASIC_ANIMATED_TEXTURE 7 +#define FF_PROFILE_MPEG4_HYBRID 8 +#define FF_PROFILE_MPEG4_ADVANCED_REAL_TIME 9 +#define FF_PROFILE_MPEG4_CORE_SCALABLE 10 +#define FF_PROFILE_MPEG4_ADVANCED_CODING 11 +#define FF_PROFILE_MPEG4_ADVANCED_CORE 12 +#define FF_PROFILE_MPEG4_ADVANCED_SCALABLE_TEXTURE 13 +#define FF_PROFILE_MPEG4_SIMPLE_STUDIO 14 +#define FF_PROFILE_MPEG4_ADVANCED_SIMPLE 15 + +#define FF_PROFILE_JPEG2000_CSTREAM_RESTRICTION_0 1 +#define FF_PROFILE_JPEG2000_CSTREAM_RESTRICTION_1 2 +#define FF_PROFILE_JPEG2000_CSTREAM_NO_RESTRICTION 32768 +#define FF_PROFILE_JPEG2000_DCINEMA_2K 3 +#define FF_PROFILE_JPEG2000_DCINEMA_4K 4 + +#define FF_PROFILE_VP9_0 0 +#define FF_PROFILE_VP9_1 1 +#define FF_PROFILE_VP9_2 2 +#define FF_PROFILE_VP9_3 3 + +#define FF_PROFILE_HEVC_MAIN 1 +#define FF_PROFILE_HEVC_MAIN_10 2 +#define FF_PROFILE_HEVC_MAIN_STILL_PICTURE 3 +#define FF_PROFILE_HEVC_REXT 4 + +#define FF_PROFILE_AV1_MAIN 0 +#define FF_PROFILE_AV1_HIGH 1 +#define FF_PROFILE_AV1_PROFESSIONAL 2 + +#define FF_PROFILE_MJPEG_HUFFMAN_BASELINE_DCT 0xc0 +#define FF_PROFILE_MJPEG_HUFFMAN_EXTENDED_SEQUENTIAL_DCT 0xc1 +#define FF_PROFILE_MJPEG_HUFFMAN_PROGRESSIVE_DCT 0xc2 +#define FF_PROFILE_MJPEG_HUFFMAN_LOSSLESS 0xc3 +#define FF_PROFILE_MJPEG_JPEG_LS 0xf7 + +#define FF_PROFILE_SBC_MSBC 1 + + /** + * level + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + int level; +#define FF_LEVEL_UNKNOWN -99 + + /** + * Skip loop filtering for selected frames. + * - encoding: unused + * - decoding: Set by user. + */ + enum AVDiscard skip_loop_filter; + + /** + * Skip IDCT/dequantization for selected frames. + * - encoding: unused + * - decoding: Set by user. + */ + enum AVDiscard skip_idct; + + /** + * Skip decoding for selected frames. + * - encoding: unused + * - decoding: Set by user. + */ + enum AVDiscard skip_frame; + + /** + * Header containing style information for text subtitles. + * For SUBTITLE_ASS subtitle type, it should contain the whole ASS + * [Script Info] and [V4+ Styles] section, plus the [Events] line and + * the Format line following. It shouldn't include any Dialogue line. + * - encoding: Set/allocated/freed by user (before avcodec_open2()) + * - decoding: Set/allocated/freed by libavcodec (by avcodec_open2()) + */ + uint8_t *subtitle_header; + int subtitle_header_size; + +#if FF_API_VBV_DELAY + /** + * VBV delay coded in the last frame (in periods of a 27 MHz clock). + * Used for compliant TS muxing. + * - encoding: Set by libavcodec. + * - decoding: unused. + * @deprecated this value is now exported as a part of + * AV_PKT_DATA_CPB_PROPERTIES packet side data + */ + attribute_deprecated + uint64_t vbv_delay; +#endif + +#if FF_API_SIDEDATA_ONLY_PKT + /** + * Encoding only and set by default. Allow encoders to output packets + * that do not contain any encoded data, only side data. + * + * Some encoders need to output such packets, e.g. to update some stream + * parameters at the end of encoding. + * + * @deprecated this field disables the default behaviour and + * it is kept only for compatibility. + */ + attribute_deprecated + int side_data_only_packets; +#endif + + /** + * Audio only. The number of "priming" samples (padding) inserted by the + * encoder at the beginning of the audio. I.e. this number of leading + * decoded samples must be discarded by the caller to get the original audio + * without leading padding. + * + * - decoding: unused + * - encoding: Set by libavcodec. The timestamps on the output packets are + * adjusted by the encoder so that they always refer to the + * first sample of the data actually contained in the packet, + * including any added padding. E.g. if the timebase is + * 1/samplerate and the timestamp of the first input sample is + * 0, the timestamp of the first output packet will be + * -initial_padding. + */ + int initial_padding; + + /** + * - decoding: For codecs that store a framerate value in the compressed + * bitstream, the decoder may export it here. { 0, 1} when + * unknown. + * - encoding: May be used to signal the framerate of CFR content to an + * encoder. + */ + AVRational framerate; + + /** + * Nominal unaccelerated pixel format, see AV_PIX_FMT_xxx. + * - encoding: unused. + * - decoding: Set by libavcodec before calling get_format() + */ + enum AVPixelFormat sw_pix_fmt; + + /** + * Timebase in which pkt_dts/pts and AVPacket.dts/pts are. + * - encoding unused. + * - decoding set by user. + */ + AVRational pkt_timebase; + + /** + * AVCodecDescriptor + * - encoding: unused. + * - decoding: set by libavcodec. + */ + const AVCodecDescriptor *codec_descriptor; + +#if !FF_API_LOWRES + /** + * low resolution decoding, 1-> 1/2 size, 2->1/4 size + * - encoding: unused + * - decoding: Set by user. + */ + int lowres; +#endif + + /** + * Current statistics for PTS correction. + * - decoding: maintained and used by libavcodec, not intended to be used by user apps + * - encoding: unused + */ + int64_t pts_correction_num_faulty_pts; /// Number of incorrect PTS values so far + int64_t pts_correction_num_faulty_dts; /// Number of incorrect DTS values so far + int64_t pts_correction_last_pts; /// PTS of the last frame + int64_t pts_correction_last_dts; /// DTS of the last frame + + /** + * Character encoding of the input subtitles file. + * - decoding: set by user + * - encoding: unused + */ + char *sub_charenc; + + /** + * Subtitles character encoding mode. Formats or codecs might be adjusting + * this setting (if they are doing the conversion themselves for instance). + * - decoding: set by libavcodec + * - encoding: unused + */ + int sub_charenc_mode; +#define FF_SUB_CHARENC_MODE_DO_NOTHING -1 ///< do nothing (demuxer outputs a stream supposed to be already in UTF-8, or the codec is bitmap for instance) +#define FF_SUB_CHARENC_MODE_AUTOMATIC 0 ///< libavcodec will select the mode itself +#define FF_SUB_CHARENC_MODE_PRE_DECODER 1 ///< the AVPacket data needs to be recoded to UTF-8 before being fed to the decoder, requires iconv +#define FF_SUB_CHARENC_MODE_IGNORE 2 ///< neither convert the subtitles, nor check them for valid UTF-8 + + /** + * Skip processing alpha if supported by codec. + * Note that if the format uses pre-multiplied alpha (common with VP6, + * and recommended due to better video quality/compression) + * the image will look as if alpha-blended onto a black background. + * However for formats that do not use pre-multiplied alpha + * there might be serious artefacts (though e.g. libswscale currently + * assumes pre-multiplied alpha anyway). + * + * - decoding: set by user + * - encoding: unused + */ + int skip_alpha; + + /** + * Number of samples to skip after a discontinuity + * - decoding: unused + * - encoding: set by libavcodec + */ + int seek_preroll; + +#if !FF_API_DEBUG_MV + /** + * debug motion vectors + * - encoding: Set by user. + * - decoding: Set by user. + */ + int debug_mv; +#define FF_DEBUG_VIS_MV_P_FOR 0x00000001 //visualize forward predicted MVs of P frames +#define FF_DEBUG_VIS_MV_B_FOR 0x00000002 //visualize forward predicted MVs of B frames +#define FF_DEBUG_VIS_MV_B_BACK 0x00000004 //visualize backward predicted MVs of B frames +#endif + + /** + * custom intra quantization matrix + * - encoding: Set by user, can be NULL. + * - decoding: unused. + */ + uint16_t *chroma_intra_matrix; + + /** + * dump format separator. + * can be ", " or "\n " or anything else + * - encoding: Set by user. + * - decoding: Set by user. + */ + uint8_t *dump_separator; + + /** + * ',' separated list of allowed decoders. + * If NULL then all are allowed + * - encoding: unused + * - decoding: set by user + */ + char *codec_whitelist; + + /** + * Properties of the stream that gets decoded + * - encoding: unused + * - decoding: set by libavcodec + */ + unsigned properties; +#define FF_CODEC_PROPERTY_LOSSLESS 0x00000001 +#define FF_CODEC_PROPERTY_CLOSED_CAPTIONS 0x00000002 + + /** + * Additional data associated with the entire coded stream. + * + * - decoding: unused + * - encoding: may be set by libavcodec after avcodec_open2(). + */ + AVPacketSideData *coded_side_data; + int nb_coded_side_data; + + /** + * A reference to the AVHWFramesContext describing the input (for encoding) + * or output (decoding) frames. The reference is set by the caller and + * afterwards owned (and freed) by libavcodec - it should never be read by + * the caller after being set. + * + * - decoding: This field should be set by the caller from the get_format() + * callback. The previous reference (if any) will always be + * unreffed by libavcodec before the get_format() call. + * + * If the default get_buffer2() is used with a hwaccel pixel + * format, then this AVHWFramesContext will be used for + * allocating the frame buffers. + * + * - encoding: For hardware encoders configured to use a hwaccel pixel + * format, this field should be set by the caller to a reference + * to the AVHWFramesContext describing input frames. + * AVHWFramesContext.format must be equal to + * AVCodecContext.pix_fmt. + * + * This field should be set before avcodec_open2() is called. + */ + AVBufferRef *hw_frames_ctx; + + /** + * Control the form of AVSubtitle.rects[N]->ass + * - decoding: set by user + * - encoding: unused + */ + int sub_text_format; +#define FF_SUB_TEXT_FMT_ASS 0 +#if FF_API_ASS_TIMING +#define FF_SUB_TEXT_FMT_ASS_WITH_TIMINGS 1 +#endif + + /** + * Audio only. The amount of padding (in samples) appended by the encoder to + * the end of the audio. I.e. this number of decoded samples must be + * discarded by the caller from the end of the stream to get the original + * audio without any trailing padding. + * + * - decoding: unused + * - encoding: unused + */ + int trailing_padding; + + /** + * The number of pixels per image to maximally accept. + * + * - decoding: set by user + * - encoding: set by user + */ + int64_t max_pixels; + + /** + * A reference to the AVHWDeviceContext describing the device which will + * be used by a hardware encoder/decoder. The reference is set by the + * caller and afterwards owned (and freed) by libavcodec. + * + * This should be used if either the codec device does not require + * hardware frames or any that are used are to be allocated internally by + * libavcodec. If the user wishes to supply any of the frames used as + * encoder input or decoder output then hw_frames_ctx should be used + * instead. When hw_frames_ctx is set in get_format() for a decoder, this + * field will be ignored while decoding the associated stream segment, but + * may again be used on a following one after another get_format() call. + * + * For both encoders and decoders this field should be set before + * avcodec_open2() is called and must not be written to thereafter. + * + * Note that some decoders may require this field to be set initially in + * order to support hw_frames_ctx at all - in that case, all frames + * contexts used must be created on the same device. + */ + AVBufferRef *hw_device_ctx; + + /** + * Bit set of AV_HWACCEL_FLAG_* flags, which affect hardware accelerated + * decoding (if active). + * - encoding: unused + * - decoding: Set by user (either before avcodec_open2(), or in the + * AVCodecContext.get_format callback) + */ + int hwaccel_flags; + + /** + * Video decoding only. Certain video codecs support cropping, meaning that + * only a sub-rectangle of the decoded frame is intended for display. This + * option controls how cropping is handled by libavcodec. + * + * When set to 1 (the default), libavcodec will apply cropping internally. + * I.e. it will modify the output frame width/height fields and offset the + * data pointers (only by as much as possible while preserving alignment, or + * by the full amount if the AV_CODEC_FLAG_UNALIGNED flag is set) so that + * the frames output by the decoder refer only to the cropped area. The + * crop_* fields of the output frames will be zero. + * + * When set to 0, the width/height fields of the output frames will be set + * to the coded dimensions and the crop_* fields will describe the cropping + * rectangle. Applying the cropping is left to the caller. + * + * @warning When hardware acceleration with opaque output frames is used, + * libavcodec is unable to apply cropping from the top/left border. + * + * @note when this option is set to zero, the width/height fields of the + * AVCodecContext and output AVFrames have different meanings. The codec + * context fields store display dimensions (with the coded dimensions in + * coded_width/height), while the frame fields store the coded dimensions + * (with the display dimensions being determined by the crop_* fields). + */ + int apply_cropping; + + /* + * Video decoding only. Sets the number of extra hardware frames which + * the decoder will allocate for use by the caller. This must be set + * before avcodec_open2() is called. + * + * Some hardware decoders require all frames that they will use for + * output to be defined in advance before decoding starts. For such + * decoders, the hardware frame pool must therefore be of a fixed size. + * The extra frames set here are on top of any number that the decoder + * needs internally in order to operate normally (for example, frames + * used as reference pictures). + */ + int extra_hw_frames; +} AVCodecContext; + +#if FF_API_CODEC_GET_SET +/** + * Accessors for some AVCodecContext fields. These used to be provided for ABI + * compatibility, and do not need to be used anymore. + */ +attribute_deprecated +AVRational av_codec_get_pkt_timebase (const AVCodecContext *avctx); +attribute_deprecated +void av_codec_set_pkt_timebase (AVCodecContext *avctx, AVRational val); + +attribute_deprecated +const AVCodecDescriptor *av_codec_get_codec_descriptor(const AVCodecContext *avctx); +attribute_deprecated +void av_codec_set_codec_descriptor(AVCodecContext *avctx, const AVCodecDescriptor *desc); + +attribute_deprecated +unsigned av_codec_get_codec_properties(const AVCodecContext *avctx); + +#if FF_API_LOWRES +attribute_deprecated +int av_codec_get_lowres(const AVCodecContext *avctx); +attribute_deprecated +void av_codec_set_lowres(AVCodecContext *avctx, int val); +#endif + +attribute_deprecated +int av_codec_get_seek_preroll(const AVCodecContext *avctx); +attribute_deprecated +void av_codec_set_seek_preroll(AVCodecContext *avctx, int val); + +attribute_deprecated +uint16_t *av_codec_get_chroma_intra_matrix(const AVCodecContext *avctx); +attribute_deprecated +void av_codec_set_chroma_intra_matrix(AVCodecContext *avctx, uint16_t *val); +#endif + +/** + * AVProfile. + */ +typedef struct AVProfile { + int profile; + const char *name; ///< short name for the profile +} AVProfile; + +enum { + /** + * The codec supports this format via the hw_device_ctx interface. + * + * When selecting this format, AVCodecContext.hw_device_ctx should + * have been set to a device of the specified type before calling + * avcodec_open2(). + */ + AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX = 0x01, + /** + * The codec supports this format via the hw_frames_ctx interface. + * + * When selecting this format for a decoder, + * AVCodecContext.hw_frames_ctx should be set to a suitable frames + * context inside the get_format() callback. The frames context + * must have been created on a device of the specified type. + */ + AV_CODEC_HW_CONFIG_METHOD_HW_FRAMES_CTX = 0x02, + /** + * The codec supports this format by some internal method. + * + * This format can be selected without any additional configuration - + * no device or frames context is required. + */ + AV_CODEC_HW_CONFIG_METHOD_INTERNAL = 0x04, + /** + * The codec supports this format by some ad-hoc method. + * + * Additional settings and/or function calls are required. See the + * codec-specific documentation for details. (Methods requiring + * this sort of configuration are deprecated and others should be + * used in preference.) + */ + AV_CODEC_HW_CONFIG_METHOD_AD_HOC = 0x08, +}; + +typedef struct AVCodecHWConfig { + /** + * A hardware pixel format which the codec can use. + */ + enum AVPixelFormat pix_fmt; + /** + * Bit set of AV_CODEC_HW_CONFIG_METHOD_* flags, describing the possible + * setup methods which can be used with this configuration. + */ + int methods; + /** + * The device type associated with the configuration. + * + * Must be set for AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX and + * AV_CODEC_HW_CONFIG_METHOD_HW_FRAMES_CTX, otherwise unused. + */ + enum AVHWDeviceType device_type; +} AVCodecHWConfig; + +typedef struct AVCodecDefault AVCodecDefault; + +struct AVSubtitle; + +/** + * AVCodec. + */ +typedef struct AVCodec { + /** + * Name of the codec implementation. + * The name is globally unique among encoders and among decoders (but an + * encoder and a decoder can share the same name). + * This is the primary way to find a codec from the user perspective. + */ + const char *name; + /** + * Descriptive name for the codec, meant to be more human readable than name. + * You should use the NULL_IF_CONFIG_SMALL() macro to define it. + */ + const char *long_name; + enum AVMediaType type; + enum AVCodecID id; + /** + * Codec capabilities. + * see AV_CODEC_CAP_* + */ + int capabilities; + const AVRational *supported_framerates; ///< array of supported framerates, or NULL if any, array is terminated by {0,0} + const enum AVPixelFormat *pix_fmts; ///< array of supported pixel formats, or NULL if unknown, array is terminated by -1 + const int *supported_samplerates; ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0 + const enum AVSampleFormat *sample_fmts; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1 + const uint64_t *channel_layouts; ///< array of support channel layouts, or NULL if unknown. array is terminated by 0 + uint8_t max_lowres; ///< maximum value for lowres supported by the decoder + const AVClass *priv_class; ///< AVClass for the private context + const AVProfile *profiles; ///< array of recognized profiles, or NULL if unknown, array is terminated by {FF_PROFILE_UNKNOWN} + + /** + * Group name of the codec implementation. + * This is a short symbolic name of the wrapper backing this codec. A + * wrapper uses some kind of external implementation for the codec, such + * as an external library, or a codec implementation provided by the OS or + * the hardware. + * If this field is NULL, this is a builtin, libavcodec native codec. + * If non-NULL, this will be the suffix in AVCodec.name in most cases + * (usually AVCodec.name will be of the form "_"). + */ + const char *wrapper_name; + + /***************************************************************** + * No fields below this line are part of the public API. They + * may not be used outside of libavcodec and can be changed and + * removed at will. + * New public fields should be added right above. + ***************************************************************** + */ + int priv_data_size; + struct AVCodec *next; + /** + * @name Frame-level threading support functions + * @{ + */ + /** + * If defined, called on thread contexts when they are created. + * If the codec allocates writable tables in init(), re-allocate them here. + * priv_data will be set to a copy of the original. + */ + int (*init_thread_copy)(AVCodecContext *); + /** + * Copy necessary context variables from a previous thread context to the current one. + * If not defined, the next thread will start automatically; otherwise, the codec + * must call ff_thread_finish_setup(). + * + * dst and src will (rarely) point to the same context, in which case memcpy should be skipped. + */ + int (*update_thread_context)(AVCodecContext *dst, const AVCodecContext *src); + /** @} */ + + /** + * Private codec-specific defaults. + */ + const AVCodecDefault *defaults; + + /** + * Initialize codec static data, called from avcodec_register(). + * + * This is not intended for time consuming operations as it is + * run for every codec regardless of that codec being used. + */ + void (*init_static_data)(struct AVCodec *codec); + + int (*init)(AVCodecContext *); + int (*encode_sub)(AVCodecContext *, uint8_t *buf, int buf_size, + const struct AVSubtitle *sub); + /** + * Encode data to an AVPacket. + * + * @param avctx codec context + * @param avpkt output AVPacket (may contain a user-provided buffer) + * @param[in] frame AVFrame containing the raw data to be encoded + * @param[out] got_packet_ptr encoder sets to 0 or 1 to indicate that a + * non-empty packet was returned in avpkt. + * @return 0 on success, negative error code on failure + */ + int (*encode2)(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, + int *got_packet_ptr); + int (*decode)(AVCodecContext *, void *outdata, int *outdata_size, AVPacket *avpkt); + int (*close)(AVCodecContext *); + /** + * Encode API with decoupled packet/frame dataflow. The API is the + * same as the avcodec_ prefixed APIs (avcodec_send_frame() etc.), except + * that: + * - never called if the codec is closed or the wrong type, + * - if AV_CODEC_CAP_DELAY is not set, drain frames are never sent, + * - only one drain frame is ever passed down, + */ + int (*send_frame)(AVCodecContext *avctx, const AVFrame *frame); + int (*receive_packet)(AVCodecContext *avctx, AVPacket *avpkt); + + /** + * Decode API with decoupled packet/frame dataflow. This function is called + * to get one output frame. It should call ff_decode_get_packet() to obtain + * input data. + */ + int (*receive_frame)(AVCodecContext *avctx, AVFrame *frame); + /** + * Flush buffers. + * Will be called when seeking + */ + void (*flush)(AVCodecContext *); + /** + * Internal codec capabilities. + * See FF_CODEC_CAP_* in internal.h + */ + int caps_internal; + + /** + * Decoding only, a comma-separated list of bitstream filters to apply to + * packets before decoding. + */ + const char *bsfs; + + /** + * Array of pointers to hardware configurations supported by the codec, + * or NULL if no hardware supported. The array is terminated by a NULL + * pointer. + * + * The user can only access this field via avcodec_get_hw_config(). + */ + const struct AVCodecHWConfigInternal **hw_configs; +} AVCodec; + +#if FF_API_CODEC_GET_SET +attribute_deprecated +int av_codec_get_max_lowres(const AVCodec *codec); +#endif + +struct MpegEncContext; + +/** + * Retrieve supported hardware configurations for a codec. + * + * Values of index from zero to some maximum return the indexed configuration + * descriptor; all other values return NULL. If the codec does not support + * any hardware configurations then it will always return NULL. + */ +const AVCodecHWConfig *avcodec_get_hw_config(const AVCodec *codec, int index); + +/** + * @defgroup lavc_hwaccel AVHWAccel + * + * @note Nothing in this structure should be accessed by the user. At some + * point in future it will not be externally visible at all. + * + * @{ + */ +typedef struct AVHWAccel { + /** + * Name of the hardware accelerated codec. + * The name is globally unique among encoders and among decoders (but an + * encoder and a decoder can share the same name). + */ + const char *name; + + /** + * Type of codec implemented by the hardware accelerator. + * + * See AVMEDIA_TYPE_xxx + */ + enum AVMediaType type; + + /** + * Codec implemented by the hardware accelerator. + * + * See AV_CODEC_ID_xxx + */ + enum AVCodecID id; + + /** + * Supported pixel format. + * + * Only hardware accelerated formats are supported here. + */ + enum AVPixelFormat pix_fmt; + + /** + * Hardware accelerated codec capabilities. + * see AV_HWACCEL_CODEC_CAP_* + */ + int capabilities; + + /***************************************************************** + * No fields below this line are part of the public API. They + * may not be used outside of libavcodec and can be changed and + * removed at will. + * New public fields should be added right above. + ***************************************************************** + */ + + /** + * Allocate a custom buffer + */ + int (*alloc_frame)(AVCodecContext *avctx, AVFrame *frame); + + /** + * Called at the beginning of each frame or field picture. + * + * Meaningful frame information (codec specific) is guaranteed to + * be parsed at this point. This function is mandatory. + * + * Note that buf can be NULL along with buf_size set to 0. + * Otherwise, this means the whole frame is available at this point. + * + * @param avctx the codec context + * @param buf the frame data buffer base + * @param buf_size the size of the frame in bytes + * @return zero if successful, a negative value otherwise + */ + int (*start_frame)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size); + + /** + * Callback for parameter data (SPS/PPS/VPS etc). + * + * Useful for hardware decoders which keep persistent state about the + * video parameters, and need to receive any changes to update that state. + * + * @param avctx the codec context + * @param type the nal unit type + * @param buf the nal unit data buffer + * @param buf_size the size of the nal unit in bytes + * @return zero if successful, a negative value otherwise + */ + int (*decode_params)(AVCodecContext *avctx, int type, const uint8_t *buf, uint32_t buf_size); + + /** + * Callback for each slice. + * + * Meaningful slice information (codec specific) is guaranteed to + * be parsed at this point. This function is mandatory. + * The only exception is XvMC, that works on MB level. + * + * @param avctx the codec context + * @param buf the slice data buffer base + * @param buf_size the size of the slice in bytes + * @return zero if successful, a negative value otherwise + */ + int (*decode_slice)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size); + + /** + * Called at the end of each frame or field picture. + * + * The whole picture is parsed at this point and can now be sent + * to the hardware accelerator. This function is mandatory. + * + * @param avctx the codec context + * @return zero if successful, a negative value otherwise + */ + int (*end_frame)(AVCodecContext *avctx); + + /** + * Size of per-frame hardware accelerator private data. + * + * Private data is allocated with av_mallocz() before + * AVCodecContext.get_buffer() and deallocated after + * AVCodecContext.release_buffer(). + */ + int frame_priv_data_size; + + /** + * Called for every Macroblock in a slice. + * + * XvMC uses it to replace the ff_mpv_reconstruct_mb(). + * Instead of decoding to raw picture, MB parameters are + * stored in an array provided by the video driver. + * + * @param s the mpeg context + */ + void (*decode_mb)(struct MpegEncContext *s); + + /** + * Initialize the hwaccel private data. + * + * This will be called from ff_get_format(), after hwaccel and + * hwaccel_context are set and the hwaccel private data in AVCodecInternal + * is allocated. + */ + int (*init)(AVCodecContext *avctx); + + /** + * Uninitialize the hwaccel private data. + * + * This will be called from get_format() or avcodec_close(), after hwaccel + * and hwaccel_context are already uninitialized. + */ + int (*uninit)(AVCodecContext *avctx); + + /** + * Size of the private data to allocate in + * AVCodecInternal.hwaccel_priv_data. + */ + int priv_data_size; + + /** + * Internal hwaccel capabilities. + */ + int caps_internal; + + /** + * Fill the given hw_frames context with current codec parameters. Called + * from get_format. Refer to avcodec_get_hw_frames_parameters() for + * details. + * + * This CAN be called before AVHWAccel.init is called, and you must assume + * that avctx->hwaccel_priv_data is invalid. + */ + int (*frame_params)(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx); +} AVHWAccel; + +/** + * HWAccel is experimental and is thus avoided in favor of non experimental + * codecs + */ +#define AV_HWACCEL_CODEC_CAP_EXPERIMENTAL 0x0200 + +/** + * Hardware acceleration should be used for decoding even if the codec level + * used is unknown or higher than the maximum supported level reported by the + * hardware driver. + * + * It's generally a good idea to pass this flag unless you have a specific + * reason not to, as hardware tends to under-report supported levels. + */ +#define AV_HWACCEL_FLAG_IGNORE_LEVEL (1 << 0) + +/** + * Hardware acceleration can output YUV pixel formats with a different chroma + * sampling than 4:2:0 and/or other than 8 bits per component. + */ +#define AV_HWACCEL_FLAG_ALLOW_HIGH_DEPTH (1 << 1) + +/** + * Hardware acceleration should still be attempted for decoding when the + * codec profile does not match the reported capabilities of the hardware. + * + * For example, this can be used to try to decode baseline profile H.264 + * streams in hardware - it will often succeed, because many streams marked + * as baseline profile actually conform to constrained baseline profile. + * + * @warning If the stream is actually not supported then the behaviour is + * undefined, and may include returning entirely incorrect output + * while indicating success. + */ +#define AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH (1 << 2) + +/** + * @} + */ + +#if FF_API_AVPICTURE +/** + * @defgroup lavc_picture AVPicture + * + * Functions for working with AVPicture + * @{ + */ + +/** + * Picture data structure. + * + * Up to four components can be stored into it, the last component is + * alpha. + * @deprecated use AVFrame or imgutils functions instead + */ +typedef struct AVPicture { + attribute_deprecated + uint8_t *data[AV_NUM_DATA_POINTERS]; ///< pointers to the image data planes + attribute_deprecated + int linesize[AV_NUM_DATA_POINTERS]; ///< number of bytes per line +} AVPicture; + +/** + * @} + */ +#endif + +enum AVSubtitleType { + SUBTITLE_NONE, + + SUBTITLE_BITMAP, ///< A bitmap, pict will be set + + /** + * Plain text, the text field must be set by the decoder and is + * authoritative. ass and pict fields may contain approximations. + */ + SUBTITLE_TEXT, + + /** + * Formatted text, the ass field must be set by the decoder and is + * authoritative. pict and text fields may contain approximations. + */ + SUBTITLE_ASS, +}; + +#define AV_SUBTITLE_FLAG_FORCED 0x00000001 + +typedef struct AVSubtitleRect { + int x; ///< top left corner of pict, undefined when pict is not set + int y; ///< top left corner of pict, undefined when pict is not set + int w; ///< width of pict, undefined when pict is not set + int h; ///< height of pict, undefined when pict is not set + int nb_colors; ///< number of colors in pict, undefined when pict is not set + +#if FF_API_AVPICTURE + /** + * @deprecated unused + */ + attribute_deprecated + AVPicture pict; +#endif + /** + * data+linesize for the bitmap of this subtitle. + * Can be set for text/ass as well once they are rendered. + */ + uint8_t *data[4]; + int linesize[4]; + + enum AVSubtitleType type; + + char *text; ///< 0 terminated plain UTF-8 text + + /** + * 0 terminated ASS/SSA compatible event line. + * The presentation of this is unaffected by the other values in this + * struct. + */ + char *ass; + + int flags; +} AVSubtitleRect; + +typedef struct AVSubtitle { + uint16_t format; /* 0 = graphics */ + uint32_t start_display_time; /* relative to packet pts, in ms */ + uint32_t end_display_time; /* relative to packet pts, in ms */ + unsigned num_rects; + AVSubtitleRect **rects; + int64_t pts; ///< Same as packet pts, in AV_TIME_BASE +} AVSubtitle; + +/** + * This struct describes the properties of an encoded stream. + * + * sizeof(AVCodecParameters) is not a part of the public ABI, this struct must + * be allocated with avcodec_parameters_alloc() and freed with + * avcodec_parameters_free(). + */ +typedef struct AVCodecParameters { + /** + * General type of the encoded data. + */ + enum AVMediaType codec_type; + /** + * Specific type of the encoded data (the codec used). + */ + enum AVCodecID codec_id; + /** + * Additional information about the codec (corresponds to the AVI FOURCC). + */ + uint32_t codec_tag; + + /** + * Extra binary data needed for initializing the decoder, codec-dependent. + * + * Must be allocated with av_malloc() and will be freed by + * avcodec_parameters_free(). The allocated size of extradata must be at + * least extradata_size + AV_INPUT_BUFFER_PADDING_SIZE, with the padding + * bytes zeroed. + */ + uint8_t *extradata; + /** + * Size of the extradata content in bytes. + */ + int extradata_size; + + /** + * - video: the pixel format, the value corresponds to enum AVPixelFormat. + * - audio: the sample format, the value corresponds to enum AVSampleFormat. + */ + int format; + + /** + * The average bitrate of the encoded data (in bits per second). + */ + int64_t bit_rate; + + /** + * The number of bits per sample in the codedwords. + * + * This is basically the bitrate per sample. It is mandatory for a bunch of + * formats to actually decode them. It's the number of bits for one sample in + * the actual coded bitstream. + * + * This could be for example 4 for ADPCM + * For PCM formats this matches bits_per_raw_sample + * Can be 0 + */ + int bits_per_coded_sample; + + /** + * This is the number of valid bits in each output sample. If the + * sample format has more bits, the least significant bits are additional + * padding bits, which are always 0. Use right shifts to reduce the sample + * to its actual size. For example, audio formats with 24 bit samples will + * have bits_per_raw_sample set to 24, and format set to AV_SAMPLE_FMT_S32. + * To get the original sample use "(int32_t)sample >> 8"." + * + * For ADPCM this might be 12 or 16 or similar + * Can be 0 + */ + int bits_per_raw_sample; + + /** + * Codec-specific bitstream restrictions that the stream conforms to. + */ + int profile; + int level; + + /** + * Video only. The dimensions of the video frame in pixels. + */ + int width; + int height; + + /** + * Video only. The aspect ratio (width / height) which a single pixel + * should have when displayed. + * + * When the aspect ratio is unknown / undefined, the numerator should be + * set to 0 (the denominator may have any value). + */ + AVRational sample_aspect_ratio; + + /** + * Video only. The order of the fields in interlaced video. + */ + enum AVFieldOrder field_order; + + /** + * Video only. Additional colorspace characteristics. + */ + enum AVColorRange color_range; + enum AVColorPrimaries color_primaries; + enum AVColorTransferCharacteristic color_trc; + enum AVColorSpace color_space; + enum AVChromaLocation chroma_location; + + /** + * Video only. Number of delayed frames. + */ + int video_delay; + + /** + * Audio only. The channel layout bitmask. May be 0 if the channel layout is + * unknown or unspecified, otherwise the number of bits set must be equal to + * the channels field. + */ + uint64_t channel_layout; + /** + * Audio only. The number of audio channels. + */ + int channels; + /** + * Audio only. The number of audio samples per second. + */ + int sample_rate; + /** + * Audio only. The number of bytes per coded audio frame, required by some + * formats. + * + * Corresponds to nBlockAlign in WAVEFORMATEX. + */ + int block_align; + /** + * Audio only. Audio frame size, if known. Required by some formats to be static. + */ + int frame_size; + + /** + * Audio only. The amount of padding (in samples) inserted by the encoder at + * the beginning of the audio. I.e. this number of leading decoded samples + * must be discarded by the caller to get the original audio without leading + * padding. + */ + int initial_padding; + /** + * Audio only. The amount of padding (in samples) appended by the encoder to + * the end of the audio. I.e. this number of decoded samples must be + * discarded by the caller from the end of the stream to get the original + * audio without any trailing padding. + */ + int trailing_padding; + /** + * Audio only. Number of samples to skip after a discontinuity. + */ + int seek_preroll; +} AVCodecParameters; + +/** + * Iterate over all registered codecs. + * + * @param opaque a pointer where libavcodec will store the iteration state. Must + * point to NULL to start the iteration. + * + * @return the next registered codec or NULL when the iteration is + * finished + */ +const AVCodec *av_codec_iterate(void **opaque); + +#if FF_API_NEXT +/** + * If c is NULL, returns the first registered codec, + * if c is non-NULL, returns the next registered codec after c, + * or NULL if c is the last one. + */ +attribute_deprecated +AVCodec *av_codec_next(const AVCodec *c); +#endif + +/** + * Return the LIBAVCODEC_VERSION_INT constant. + */ +unsigned avcodec_version(void); + +/** + * Return the libavcodec build-time configuration. + */ +const char *avcodec_configuration(void); + +/** + * Return the libavcodec license. + */ +const char *avcodec_license(void); + +#if FF_API_NEXT +/** + * Register the codec codec and initialize libavcodec. + * + * @warning either this function or avcodec_register_all() must be called + * before any other libavcodec functions. + * + * @see avcodec_register_all() + */ +attribute_deprecated +void avcodec_register(AVCodec *codec); + +/** + * Register all the codecs, parsers and bitstream filters which were enabled at + * configuration time. If you do not call this function you can select exactly + * which formats you want to support, by using the individual registration + * functions. + * + * @see avcodec_register + * @see av_register_codec_parser + * @see av_register_bitstream_filter + */ +attribute_deprecated +void avcodec_register_all(void); +#endif + +/** + * Allocate an AVCodecContext and set its fields to default values. The + * resulting struct should be freed with avcodec_free_context(). + * + * @param codec if non-NULL, allocate private data and initialize defaults + * for the given codec. It is illegal to then call avcodec_open2() + * with a different codec. + * If NULL, then the codec-specific defaults won't be initialized, + * which may result in suboptimal default settings (this is + * important mainly for encoders, e.g. libx264). + * + * @return An AVCodecContext filled with default values or NULL on failure. + */ +AVCodecContext *avcodec_alloc_context3(const AVCodec *codec); + +/** + * Free the codec context and everything associated with it and write NULL to + * the provided pointer. + */ +void avcodec_free_context(AVCodecContext **avctx); + +#if FF_API_GET_CONTEXT_DEFAULTS +/** + * @deprecated This function should not be used, as closing and opening a codec + * context multiple time is not supported. A new codec context should be + * allocated for each new use. + */ +int avcodec_get_context_defaults3(AVCodecContext *s, const AVCodec *codec); +#endif + +/** + * Get the AVClass for AVCodecContext. It can be used in combination with + * AV_OPT_SEARCH_FAKE_OBJ for examining options. + * + * @see av_opt_find(). + */ +const AVClass *avcodec_get_class(void); + +#if FF_API_COPY_CONTEXT +/** + * Get the AVClass for AVFrame. It can be used in combination with + * AV_OPT_SEARCH_FAKE_OBJ for examining options. + * + * @see av_opt_find(). + */ +const AVClass *avcodec_get_frame_class(void); + +/** + * Get the AVClass for AVSubtitleRect. It can be used in combination with + * AV_OPT_SEARCH_FAKE_OBJ for examining options. + * + * @see av_opt_find(). + */ +const AVClass *avcodec_get_subtitle_rect_class(void); + +/** + * Copy the settings of the source AVCodecContext into the destination + * AVCodecContext. The resulting destination codec context will be + * unopened, i.e. you are required to call avcodec_open2() before you + * can use this AVCodecContext to decode/encode video/audio data. + * + * @param dest target codec context, should be initialized with + * avcodec_alloc_context3(NULL), but otherwise uninitialized + * @param src source codec context + * @return AVERROR() on error (e.g. memory allocation error), 0 on success + * + * @deprecated The semantics of this function are ill-defined and it should not + * be used. If you need to transfer the stream parameters from one codec context + * to another, use an intermediate AVCodecParameters instance and the + * avcodec_parameters_from_context() / avcodec_parameters_to_context() + * functions. + */ +attribute_deprecated +int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src); +#endif + +/** + * Allocate a new AVCodecParameters and set its fields to default values + * (unknown/invalid/0). The returned struct must be freed with + * avcodec_parameters_free(). + */ +AVCodecParameters *avcodec_parameters_alloc(void); + +/** + * Free an AVCodecParameters instance and everything associated with it and + * write NULL to the supplied pointer. + */ +void avcodec_parameters_free(AVCodecParameters **par); + +/** + * Copy the contents of src to dst. Any allocated fields in dst are freed and + * replaced with newly allocated duplicates of the corresponding fields in src. + * + * @return >= 0 on success, a negative AVERROR code on failure. + */ +int avcodec_parameters_copy(AVCodecParameters *dst, const AVCodecParameters *src); + +/** + * Fill the parameters struct based on the values from the supplied codec + * context. Any allocated fields in par are freed and replaced with duplicates + * of the corresponding fields in codec. + * + * @return >= 0 on success, a negative AVERROR code on failure + */ +int avcodec_parameters_from_context(AVCodecParameters *par, + const AVCodecContext *codec); + +/** + * Fill the codec context based on the values from the supplied codec + * parameters. Any allocated fields in codec that have a corresponding field in + * par are freed and replaced with duplicates of the corresponding field in par. + * Fields in codec that do not have a counterpart in par are not touched. + * + * @return >= 0 on success, a negative AVERROR code on failure. + */ +int avcodec_parameters_to_context(AVCodecContext *codec, + const AVCodecParameters *par); + +/** + * Initialize the AVCodecContext to use the given AVCodec. Prior to using this + * function the context has to be allocated with avcodec_alloc_context3(). + * + * The functions avcodec_find_decoder_by_name(), avcodec_find_encoder_by_name(), + * avcodec_find_decoder() and avcodec_find_encoder() provide an easy way for + * retrieving a codec. + * + * @warning This function is not thread safe! + * + * @note Always call this function before using decoding routines (such as + * @ref avcodec_receive_frame()). + * + * @code + * avcodec_register_all(); + * av_dict_set(&opts, "b", "2.5M", 0); + * codec = avcodec_find_decoder(AV_CODEC_ID_H264); + * if (!codec) + * exit(1); + * + * context = avcodec_alloc_context3(codec); + * + * if (avcodec_open2(context, codec, opts) < 0) + * exit(1); + * @endcode + * + * @param avctx The context to initialize. + * @param codec The codec to open this context for. If a non-NULL codec has been + * previously passed to avcodec_alloc_context3() or + * for this context, then this parameter MUST be either NULL or + * equal to the previously passed codec. + * @param options A dictionary filled with AVCodecContext and codec-private options. + * On return this object will be filled with options that were not found. + * + * @return zero on success, a negative value on error + * @see avcodec_alloc_context3(), avcodec_find_decoder(), avcodec_find_encoder(), + * av_dict_set(), av_opt_find(). + */ +int avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options); + +/** + * Close a given AVCodecContext and free all the data associated with it + * (but not the AVCodecContext itself). + * + * Calling this function on an AVCodecContext that hasn't been opened will free + * the codec-specific data allocated in avcodec_alloc_context3() with a non-NULL + * codec. Subsequent calls will do nothing. + * + * @note Do not use this function. Use avcodec_free_context() to destroy a + * codec context (either open or closed). Opening and closing a codec context + * multiple times is not supported anymore -- use multiple codec contexts + * instead. + */ +int avcodec_close(AVCodecContext *avctx); + +/** + * Free all allocated data in the given subtitle struct. + * + * @param sub AVSubtitle to free. + */ +void avsubtitle_free(AVSubtitle *sub); + +/** + * @} + */ + +/** + * @addtogroup lavc_packet + * @{ + */ + +/** + * Allocate an AVPacket and set its fields to default values. The resulting + * struct must be freed using av_packet_free(). + * + * @return An AVPacket filled with default values or NULL on failure. + * + * @note this only allocates the AVPacket itself, not the data buffers. Those + * must be allocated through other means such as av_new_packet. + * + * @see av_new_packet + */ +AVPacket *av_packet_alloc(void); + +/** + * Create a new packet that references the same data as src. + * + * This is a shortcut for av_packet_alloc()+av_packet_ref(). + * + * @return newly created AVPacket on success, NULL on error. + * + * @see av_packet_alloc + * @see av_packet_ref + */ +AVPacket *av_packet_clone(const AVPacket *src); + +/** + * Free the packet, if the packet is reference counted, it will be + * unreferenced first. + * + * @param pkt packet to be freed. The pointer will be set to NULL. + * @note passing NULL is a no-op. + */ +void av_packet_free(AVPacket **pkt); + +/** + * Initialize optional fields of a packet with default values. + * + * Note, this does not touch the data and size members, which have to be + * initialized separately. + * + * @param pkt packet + */ +void av_init_packet(AVPacket *pkt); + +/** + * Allocate the payload of a packet and initialize its fields with + * default values. + * + * @param pkt packet + * @param size wanted payload size + * @return 0 if OK, AVERROR_xxx otherwise + */ +int av_new_packet(AVPacket *pkt, int size); + +/** + * Reduce packet size, correctly zeroing padding + * + * @param pkt packet + * @param size new size + */ +void av_shrink_packet(AVPacket *pkt, int size); + +/** + * Increase packet size, correctly zeroing padding + * + * @param pkt packet + * @param grow_by number of bytes by which to increase the size of the packet + */ +int av_grow_packet(AVPacket *pkt, int grow_by); + +/** + * Initialize a reference-counted packet from av_malloc()ed data. + * + * @param pkt packet to be initialized. This function will set the data, size, + * buf and destruct fields, all others are left untouched. + * @param data Data allocated by av_malloc() to be used as packet data. If this + * function returns successfully, the data is owned by the underlying AVBuffer. + * The caller may not access the data through other means. + * @param size size of data in bytes, without the padding. I.e. the full buffer + * size is assumed to be size + AV_INPUT_BUFFER_PADDING_SIZE. + * + * @return 0 on success, a negative AVERROR on error + */ +int av_packet_from_data(AVPacket *pkt, uint8_t *data, int size); + +#if FF_API_AVPACKET_OLD_API +/** + * @warning This is a hack - the packet memory allocation stuff is broken. The + * packet is allocated if it was not really allocated. + * + * @deprecated Use av_packet_ref or av_packet_make_refcounted + */ +attribute_deprecated +int av_dup_packet(AVPacket *pkt); +/** + * Copy packet, including contents + * + * @return 0 on success, negative AVERROR on fail + * + * @deprecated Use av_packet_ref + */ +attribute_deprecated +int av_copy_packet(AVPacket *dst, const AVPacket *src); + +/** + * Copy packet side data + * + * @return 0 on success, negative AVERROR on fail + * + * @deprecated Use av_packet_copy_props + */ +attribute_deprecated +int av_copy_packet_side_data(AVPacket *dst, const AVPacket *src); + +/** + * Free a packet. + * + * @deprecated Use av_packet_unref + * + * @param pkt packet to free + */ +attribute_deprecated +void av_free_packet(AVPacket *pkt); +#endif +/** + * Allocate new information of a packet. + * + * @param pkt packet + * @param type side information type + * @param size side information size + * @return pointer to fresh allocated data or NULL otherwise + */ +uint8_t* av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, + int size); + +/** + * Wrap an existing array as a packet side data. + * + * @param pkt packet + * @param type side information type + * @param data the side data array. It must be allocated with the av_malloc() + * family of functions. The ownership of the data is transferred to + * pkt. + * @param size side information size + * @return a non-negative number on success, a negative AVERROR code on + * failure. On failure, the packet is unchanged and the data remains + * owned by the caller. + */ +int av_packet_add_side_data(AVPacket *pkt, enum AVPacketSideDataType type, + uint8_t *data, size_t size); + +/** + * Shrink the already allocated side data buffer + * + * @param pkt packet + * @param type side information type + * @param size new side information size + * @return 0 on success, < 0 on failure + */ +int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type, + int size); + +/** + * Get side information from packet. + * + * @param pkt packet + * @param type desired side information type + * @param size pointer for side information size to store (optional) + * @return pointer to data if present or NULL otherwise + */ +uint8_t* av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type, + int *size); + +#if FF_API_MERGE_SD_API +attribute_deprecated +int av_packet_merge_side_data(AVPacket *pkt); + +attribute_deprecated +int av_packet_split_side_data(AVPacket *pkt); +#endif + +const char *av_packet_side_data_name(enum AVPacketSideDataType type); + +/** + * Pack a dictionary for use in side_data. + * + * @param dict The dictionary to pack. + * @param size pointer to store the size of the returned data + * @return pointer to data if successful, NULL otherwise + */ +uint8_t *av_packet_pack_dictionary(AVDictionary *dict, int *size); +/** + * Unpack a dictionary from side_data. + * + * @param data data from side_data + * @param size size of the data + * @param dict the metadata storage dictionary + * @return 0 on success, < 0 on failure + */ +int av_packet_unpack_dictionary(const uint8_t *data, int size, AVDictionary **dict); + + +/** + * Convenience function to free all the side data stored. + * All the other fields stay untouched. + * + * @param pkt packet + */ +void av_packet_free_side_data(AVPacket *pkt); + +/** + * Setup a new reference to the data described by a given packet + * + * If src is reference-counted, setup dst as a new reference to the + * buffer in src. Otherwise allocate a new buffer in dst and copy the + * data from src into it. + * + * All the other fields are copied from src. + * + * @see av_packet_unref + * + * @param dst Destination packet + * @param src Source packet + * + * @return 0 on success, a negative AVERROR on error. + */ +int av_packet_ref(AVPacket *dst, const AVPacket *src); + +/** + * Wipe the packet. + * + * Unreference the buffer referenced by the packet and reset the + * remaining packet fields to their default values. + * + * @param pkt The packet to be unreferenced. + */ +void av_packet_unref(AVPacket *pkt); + +/** + * Move every field in src to dst and reset src. + * + * @see av_packet_unref + * + * @param src Source packet, will be reset + * @param dst Destination packet + */ +void av_packet_move_ref(AVPacket *dst, AVPacket *src); + +/** + * Copy only "properties" fields from src to dst. + * + * Properties for the purpose of this function are all the fields + * beside those related to the packet data (buf, data, size) + * + * @param dst Destination packet + * @param src Source packet + * + * @return 0 on success AVERROR on failure. + */ +int av_packet_copy_props(AVPacket *dst, const AVPacket *src); + +/** + * Ensure the data described by a given packet is reference counted. + * + * @note This function does not ensure that the reference will be writable. + * Use av_packet_make_writable instead for that purpose. + * + * @see av_packet_ref + * @see av_packet_make_writable + * + * @param pkt packet whose data should be made reference counted. + * + * @return 0 on success, a negative AVERROR on error. On failure, the + * packet is unchanged. + */ +int av_packet_make_refcounted(AVPacket *pkt); + +/** + * Create a writable reference for the data described by a given packet, + * avoiding data copy if possible. + * + * @param pkt Packet whose data should be made writable. + * + * @return 0 on success, a negative AVERROR on failure. On failure, the + * packet is unchanged. + */ +int av_packet_make_writable(AVPacket *pkt); + +/** + * Convert valid timing fields (timestamps / durations) in a packet from one + * timebase to another. Timestamps with unknown values (AV_NOPTS_VALUE) will be + * ignored. + * + * @param pkt packet on which the conversion will be performed + * @param tb_src source timebase, in which the timing fields in pkt are + * expressed + * @param tb_dst destination timebase, to which the timing fields will be + * converted + */ +void av_packet_rescale_ts(AVPacket *pkt, AVRational tb_src, AVRational tb_dst); + +/** + * @} + */ + +/** + * @addtogroup lavc_decoding + * @{ + */ + +/** + * Find a registered decoder with a matching codec ID. + * + * @param id AVCodecID of the requested decoder + * @return A decoder if one was found, NULL otherwise. + */ +AVCodec *avcodec_find_decoder(enum AVCodecID id); + +/** + * Find a registered decoder with the specified name. + * + * @param name name of the requested decoder + * @return A decoder if one was found, NULL otherwise. + */ +AVCodec *avcodec_find_decoder_by_name(const char *name); + +/** + * The default callback for AVCodecContext.get_buffer2(). It is made public so + * it can be called by custom get_buffer2() implementations for decoders without + * AV_CODEC_CAP_DR1 set. + */ +int avcodec_default_get_buffer2(AVCodecContext *s, AVFrame *frame, int flags); + +/** + * Modify width and height values so that they will result in a memory + * buffer that is acceptable for the codec if you do not use any horizontal + * padding. + * + * May only be used if a codec with AV_CODEC_CAP_DR1 has been opened. + */ +void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height); + +/** + * Modify width and height values so that they will result in a memory + * buffer that is acceptable for the codec if you also ensure that all + * line sizes are a multiple of the respective linesize_align[i]. + * + * May only be used if a codec with AV_CODEC_CAP_DR1 has been opened. + */ +void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height, + int linesize_align[AV_NUM_DATA_POINTERS]); + +/** + * Converts AVChromaLocation to swscale x/y chroma position. + * + * The positions represent the chroma (0,0) position in a coordinates system + * with luma (0,0) representing the origin and luma(1,1) representing 256,256 + * + * @param xpos horizontal chroma sample position + * @param ypos vertical chroma sample position + */ +int avcodec_enum_to_chroma_pos(int *xpos, int *ypos, enum AVChromaLocation pos); + +/** + * Converts swscale x/y chroma position to AVChromaLocation. + * + * The positions represent the chroma (0,0) position in a coordinates system + * with luma (0,0) representing the origin and luma(1,1) representing 256,256 + * + * @param xpos horizontal chroma sample position + * @param ypos vertical chroma sample position + */ +enum AVChromaLocation avcodec_chroma_pos_to_enum(int xpos, int ypos); + +/** + * Decode the audio frame of size avpkt->size from avpkt->data into frame. + * + * Some decoders may support multiple frames in a single AVPacket. Such + * decoders would then just decode the first frame and the return value would be + * less than the packet size. In this case, avcodec_decode_audio4 has to be + * called again with an AVPacket containing the remaining data in order to + * decode the second frame, etc... Even if no frames are returned, the packet + * needs to be fed to the decoder with remaining data until it is completely + * consumed or an error occurs. + * + * Some decoders (those marked with AV_CODEC_CAP_DELAY) have a delay between input + * and output. This means that for some packets they will not immediately + * produce decoded output and need to be flushed at the end of decoding to get + * all the decoded data. Flushing is done by calling this function with packets + * with avpkt->data set to NULL and avpkt->size set to 0 until it stops + * returning samples. It is safe to flush even those decoders that are not + * marked with AV_CODEC_CAP_DELAY, then no samples will be returned. + * + * @warning The input buffer, avpkt->data must be AV_INPUT_BUFFER_PADDING_SIZE + * larger than the actual read bytes because some optimized bitstream + * readers read 32 or 64 bits at once and could read over the end. + * + * @note The AVCodecContext MUST have been opened with @ref avcodec_open2() + * before packets may be fed to the decoder. + * + * @param avctx the codec context + * @param[out] frame The AVFrame in which to store decoded audio samples. + * The decoder will allocate a buffer for the decoded frame by + * calling the AVCodecContext.get_buffer2() callback. + * When AVCodecContext.refcounted_frames is set to 1, the frame is + * reference counted and the returned reference belongs to the + * caller. The caller must release the frame using av_frame_unref() + * when the frame is no longer needed. The caller may safely write + * to the frame if av_frame_is_writable() returns 1. + * When AVCodecContext.refcounted_frames is set to 0, the returned + * reference belongs to the decoder and is valid only until the + * next call to this function or until closing or flushing the + * decoder. The caller may not write to it. + * @param[out] got_frame_ptr Zero if no frame could be decoded, otherwise it is + * non-zero. Note that this field being set to zero + * does not mean that an error has occurred. For + * decoders with AV_CODEC_CAP_DELAY set, no given decode + * call is guaranteed to produce a frame. + * @param[in] avpkt The input AVPacket containing the input buffer. + * At least avpkt->data and avpkt->size should be set. Some + * decoders might also require additional fields to be set. + * @return A negative error code is returned if an error occurred during + * decoding, otherwise the number of bytes consumed from the input + * AVPacket is returned. + * +* @deprecated Use avcodec_send_packet() and avcodec_receive_frame(). + */ +attribute_deprecated +int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame, + int *got_frame_ptr, const AVPacket *avpkt); + +/** + * Decode the video frame of size avpkt->size from avpkt->data into picture. + * Some decoders may support multiple frames in a single AVPacket, such + * decoders would then just decode the first frame. + * + * @warning The input buffer must be AV_INPUT_BUFFER_PADDING_SIZE larger than + * the actual read bytes because some optimized bitstream readers read 32 or 64 + * bits at once and could read over the end. + * + * @warning The end of the input buffer buf should be set to 0 to ensure that + * no overreading happens for damaged MPEG streams. + * + * @note Codecs which have the AV_CODEC_CAP_DELAY capability set have a delay + * between input and output, these need to be fed with avpkt->data=NULL, + * avpkt->size=0 at the end to return the remaining frames. + * + * @note The AVCodecContext MUST have been opened with @ref avcodec_open2() + * before packets may be fed to the decoder. + * + * @param avctx the codec context + * @param[out] picture The AVFrame in which the decoded video frame will be stored. + * Use av_frame_alloc() to get an AVFrame. The codec will + * allocate memory for the actual bitmap by calling the + * AVCodecContext.get_buffer2() callback. + * When AVCodecContext.refcounted_frames is set to 1, the frame is + * reference counted and the returned reference belongs to the + * caller. The caller must release the frame using av_frame_unref() + * when the frame is no longer needed. The caller may safely write + * to the frame if av_frame_is_writable() returns 1. + * When AVCodecContext.refcounted_frames is set to 0, the returned + * reference belongs to the decoder and is valid only until the + * next call to this function or until closing or flushing the + * decoder. The caller may not write to it. + * + * @param[in] avpkt The input AVPacket containing the input buffer. + * You can create such packet with av_init_packet() and by then setting + * data and size, some decoders might in addition need other fields like + * flags&AV_PKT_FLAG_KEY. All decoders are designed to use the least + * fields possible. + * @param[in,out] got_picture_ptr Zero if no frame could be decompressed, otherwise, it is nonzero. + * @return On error a negative value is returned, otherwise the number of bytes + * used or zero if no frame could be decompressed. + * + * @deprecated Use avcodec_send_packet() and avcodec_receive_frame(). + */ +attribute_deprecated +int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture, + int *got_picture_ptr, + const AVPacket *avpkt); + +/** + * Decode a subtitle message. + * Return a negative value on error, otherwise return the number of bytes used. + * If no subtitle could be decompressed, got_sub_ptr is zero. + * Otherwise, the subtitle is stored in *sub. + * Note that AV_CODEC_CAP_DR1 is not available for subtitle codecs. This is for + * simplicity, because the performance difference is expect to be negligible + * and reusing a get_buffer written for video codecs would probably perform badly + * due to a potentially very different allocation pattern. + * + * Some decoders (those marked with AV_CODEC_CAP_DELAY) have a delay between input + * and output. This means that for some packets they will not immediately + * produce decoded output and need to be flushed at the end of decoding to get + * all the decoded data. Flushing is done by calling this function with packets + * with avpkt->data set to NULL and avpkt->size set to 0 until it stops + * returning subtitles. It is safe to flush even those decoders that are not + * marked with AV_CODEC_CAP_DELAY, then no subtitles will be returned. + * + * @note The AVCodecContext MUST have been opened with @ref avcodec_open2() + * before packets may be fed to the decoder. + * + * @param avctx the codec context + * @param[out] sub The Preallocated AVSubtitle in which the decoded subtitle will be stored, + * must be freed with avsubtitle_free if *got_sub_ptr is set. + * @param[in,out] got_sub_ptr Zero if no subtitle could be decompressed, otherwise, it is nonzero. + * @param[in] avpkt The input AVPacket containing the input buffer. + */ +int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, + int *got_sub_ptr, + AVPacket *avpkt); + +/** + * Supply raw packet data as input to a decoder. + * + * Internally, this call will copy relevant AVCodecContext fields, which can + * influence decoding per-packet, and apply them when the packet is actually + * decoded. (For example AVCodecContext.skip_frame, which might direct the + * decoder to drop the frame contained by the packet sent with this function.) + * + * @warning The input buffer, avpkt->data must be AV_INPUT_BUFFER_PADDING_SIZE + * larger than the actual read bytes because some optimized bitstream + * readers read 32 or 64 bits at once and could read over the end. + * + * @warning Do not mix this API with the legacy API (like avcodec_decode_video2()) + * on the same AVCodecContext. It will return unexpected results now + * or in future libavcodec versions. + * + * @note The AVCodecContext MUST have been opened with @ref avcodec_open2() + * before packets may be fed to the decoder. + * + * @param avctx codec context + * @param[in] avpkt The input AVPacket. Usually, this will be a single video + * frame, or several complete audio frames. + * Ownership of the packet remains with the caller, and the + * decoder will not write to the packet. The decoder may create + * a reference to the packet data (or copy it if the packet is + * not reference-counted). + * Unlike with older APIs, the packet is always fully consumed, + * and if it contains multiple frames (e.g. some audio codecs), + * will require you to call avcodec_receive_frame() multiple + * times afterwards before you can send a new packet. + * It can be NULL (or an AVPacket with data set to NULL and + * size set to 0); in this case, it is considered a flush + * packet, which signals the end of the stream. Sending the + * first flush packet will return success. Subsequent ones are + * unnecessary and will return AVERROR_EOF. If the decoder + * still has frames buffered, it will return them after sending + * a flush packet. + * + * @return 0 on success, otherwise negative error code: + * AVERROR(EAGAIN): input is not accepted in the current state - user + * must read output with avcodec_receive_frame() (once + * all output is read, the packet should be resent, and + * the call will not fail with EAGAIN). + * AVERROR_EOF: the decoder has been flushed, and no new packets can + * be sent to it (also returned if more than 1 flush + * packet is sent) + * AVERROR(EINVAL): codec not opened, it is an encoder, or requires flush + * AVERROR(ENOMEM): failed to add packet to internal queue, or similar + * other errors: legitimate decoding errors + */ +int avcodec_send_packet(AVCodecContext *avctx, const AVPacket *avpkt); + +/** + * Return decoded output data from a decoder. + * + * @param avctx codec context + * @param frame This will be set to a reference-counted video or audio + * frame (depending on the decoder type) allocated by the + * decoder. Note that the function will always call + * av_frame_unref(frame) before doing anything else. + * + * @return + * 0: success, a frame was returned + * AVERROR(EAGAIN): output is not available in this state - user must try + * to send new input + * AVERROR_EOF: the decoder has been fully flushed, and there will be + * no more output frames + * AVERROR(EINVAL): codec not opened, or it is an encoder + * other negative values: legitimate decoding errors + */ +int avcodec_receive_frame(AVCodecContext *avctx, AVFrame *frame); + +/** + * Supply a raw video or audio frame to the encoder. Use avcodec_receive_packet() + * to retrieve buffered output packets. + * + * @param avctx codec context + * @param[in] frame AVFrame containing the raw audio or video frame to be encoded. + * Ownership of the frame remains with the caller, and the + * encoder will not write to the frame. The encoder may create + * a reference to the frame data (or copy it if the frame is + * not reference-counted). + * It can be NULL, in which case it is considered a flush + * packet. This signals the end of the stream. If the encoder + * still has packets buffered, it will return them after this + * call. Once flushing mode has been entered, additional flush + * packets are ignored, and sending frames will return + * AVERROR_EOF. + * + * For audio: + * If AV_CODEC_CAP_VARIABLE_FRAME_SIZE is set, then each frame + * can have any number of samples. + * If it is not set, frame->nb_samples must be equal to + * avctx->frame_size for all frames except the last. + * The final frame may be smaller than avctx->frame_size. + * @return 0 on success, otherwise negative error code: + * AVERROR(EAGAIN): input is not accepted in the current state - user + * must read output with avcodec_receive_packet() (once + * all output is read, the packet should be resent, and + * the call will not fail with EAGAIN). + * AVERROR_EOF: the encoder has been flushed, and no new frames can + * be sent to it + * AVERROR(EINVAL): codec not opened, refcounted_frames not set, it is a + * decoder, or requires flush + * AVERROR(ENOMEM): failed to add packet to internal queue, or similar + * other errors: legitimate decoding errors + */ +int avcodec_send_frame(AVCodecContext *avctx, const AVFrame *frame); + +/** + * Read encoded data from the encoder. + * + * @param avctx codec context + * @param avpkt This will be set to a reference-counted packet allocated by the + * encoder. Note that the function will always call + * av_frame_unref(frame) before doing anything else. + * @return 0 on success, otherwise negative error code: + * AVERROR(EAGAIN): output is not available in the current state - user + * must try to send input + * AVERROR_EOF: the encoder has been fully flushed, and there will be + * no more output packets + * AVERROR(EINVAL): codec not opened, or it is an encoder + * other errors: legitimate decoding errors + */ +int avcodec_receive_packet(AVCodecContext *avctx, AVPacket *avpkt); + +/** + * Create and return a AVHWFramesContext with values adequate for hardware + * decoding. This is meant to get called from the get_format callback, and is + * a helper for preparing a AVHWFramesContext for AVCodecContext.hw_frames_ctx. + * This API is for decoding with certain hardware acceleration modes/APIs only. + * + * The returned AVHWFramesContext is not initialized. The caller must do this + * with av_hwframe_ctx_init(). + * + * Calling this function is not a requirement, but makes it simpler to avoid + * codec or hardware API specific details when manually allocating frames. + * + * Alternatively to this, an API user can set AVCodecContext.hw_device_ctx, + * which sets up AVCodecContext.hw_frames_ctx fully automatically, and makes + * it unnecessary to call this function or having to care about + * AVHWFramesContext initialization at all. + * + * There are a number of requirements for calling this function: + * + * - It must be called from get_format with the same avctx parameter that was + * passed to get_format. Calling it outside of get_format is not allowed, and + * can trigger undefined behavior. + * - The function is not always supported (see description of return values). + * Even if this function returns successfully, hwaccel initialization could + * fail later. (The degree to which implementations check whether the stream + * is actually supported varies. Some do this check only after the user's + * get_format callback returns.) + * - The hw_pix_fmt must be one of the choices suggested by get_format. If the + * user decides to use a AVHWFramesContext prepared with this API function, + * the user must return the same hw_pix_fmt from get_format. + * - The device_ref passed to this function must support the given hw_pix_fmt. + * - After calling this API function, it is the user's responsibility to + * initialize the AVHWFramesContext (returned by the out_frames_ref parameter), + * and to set AVCodecContext.hw_frames_ctx to it. If done, this must be done + * before returning from get_format (this is implied by the normal + * AVCodecContext.hw_frames_ctx API rules). + * - The AVHWFramesContext parameters may change every time time get_format is + * called. Also, AVCodecContext.hw_frames_ctx is reset before get_format. So + * you are inherently required to go through this process again on every + * get_format call. + * - It is perfectly possible to call this function without actually using + * the resulting AVHWFramesContext. One use-case might be trying to reuse a + * previously initialized AVHWFramesContext, and calling this API function + * only to test whether the required frame parameters have changed. + * - Fields that use dynamically allocated values of any kind must not be set + * by the user unless setting them is explicitly allowed by the documentation. + * If the user sets AVHWFramesContext.free and AVHWFramesContext.user_opaque, + * the new free callback must call the potentially set previous free callback. + * This API call may set any dynamically allocated fields, including the free + * callback. + * + * The function will set at least the following fields on AVHWFramesContext + * (potentially more, depending on hwaccel API): + * + * - All fields set by av_hwframe_ctx_alloc(). + * - Set the format field to hw_pix_fmt. + * - Set the sw_format field to the most suited and most versatile format. (An + * implication is that this will prefer generic formats over opaque formats + * with arbitrary restrictions, if possible.) + * - Set the width/height fields to the coded frame size, rounded up to the + * API-specific minimum alignment. + * - Only _if_ the hwaccel requires a pre-allocated pool: set the initial_pool_size + * field to the number of maximum reference surfaces possible with the codec, + * plus 1 surface for the user to work (meaning the user can safely reference + * at most 1 decoded surface at a time), plus additional buffering introduced + * by frame threading. If the hwaccel does not require pre-allocation, the + * field is left to 0, and the decoder will allocate new surfaces on demand + * during decoding. + * - Possibly AVHWFramesContext.hwctx fields, depending on the underlying + * hardware API. + * + * Essentially, out_frames_ref returns the same as av_hwframe_ctx_alloc(), but + * with basic frame parameters set. + * + * The function is stateless, and does not change the AVCodecContext or the + * device_ref AVHWDeviceContext. + * + * @param avctx The context which is currently calling get_format, and which + * implicitly contains all state needed for filling the returned + * AVHWFramesContext properly. + * @param device_ref A reference to the AVHWDeviceContext describing the device + * which will be used by the hardware decoder. + * @param hw_pix_fmt The hwaccel format you are going to return from get_format. + * @param out_frames_ref On success, set to a reference to an _uninitialized_ + * AVHWFramesContext, created from the given device_ref. + * Fields will be set to values required for decoding. + * Not changed if an error is returned. + * @return zero on success, a negative value on error. The following error codes + * have special semantics: + * AVERROR(ENOENT): the decoder does not support this functionality. Setup + * is always manual, or it is a decoder which does not + * support setting AVCodecContext.hw_frames_ctx at all, + * or it is a software format. + * AVERROR(EINVAL): it is known that hardware decoding is not supported for + * this configuration, or the device_ref is not supported + * for the hwaccel referenced by hw_pix_fmt. + */ +int avcodec_get_hw_frames_parameters(AVCodecContext *avctx, + AVBufferRef *device_ref, + enum AVPixelFormat hw_pix_fmt, + AVBufferRef **out_frames_ref); + + + +/** + * @defgroup lavc_parsing Frame parsing + * @{ + */ + +enum AVPictureStructure { + AV_PICTURE_STRUCTURE_UNKNOWN, //< unknown + AV_PICTURE_STRUCTURE_TOP_FIELD, //< coded as top field + AV_PICTURE_STRUCTURE_BOTTOM_FIELD, //< coded as bottom field + AV_PICTURE_STRUCTURE_FRAME, //< coded as frame +}; + +typedef struct AVCodecParserContext { + void *priv_data; + struct AVCodecParser *parser; + int64_t frame_offset; /* offset of the current frame */ + int64_t cur_offset; /* current offset + (incremented by each av_parser_parse()) */ + int64_t next_frame_offset; /* offset of the next frame */ + /* video info */ + int pict_type; /* XXX: Put it back in AVCodecContext. */ + /** + * This field is used for proper frame duration computation in lavf. + * It signals, how much longer the frame duration of the current frame + * is compared to normal frame duration. + * + * frame_duration = (1 + repeat_pict) * time_base + * + * It is used by codecs like H.264 to display telecined material. + */ + int repeat_pict; /* XXX: Put it back in AVCodecContext. */ + int64_t pts; /* pts of the current frame */ + int64_t dts; /* dts of the current frame */ + + /* private data */ + int64_t last_pts; + int64_t last_dts; + int fetch_timestamp; + +#define AV_PARSER_PTS_NB 4 + int cur_frame_start_index; + int64_t cur_frame_offset[AV_PARSER_PTS_NB]; + int64_t cur_frame_pts[AV_PARSER_PTS_NB]; + int64_t cur_frame_dts[AV_PARSER_PTS_NB]; + + int flags; +#define PARSER_FLAG_COMPLETE_FRAMES 0x0001 +#define PARSER_FLAG_ONCE 0x0002 +/// Set if the parser has a valid file offset +#define PARSER_FLAG_FETCHED_OFFSET 0x0004 +#define PARSER_FLAG_USE_CODEC_TS 0x1000 + + int64_t offset; ///< byte offset from starting packet start + int64_t cur_frame_end[AV_PARSER_PTS_NB]; + + /** + * Set by parser to 1 for key frames and 0 for non-key frames. + * It is initialized to -1, so if the parser doesn't set this flag, + * old-style fallback using AV_PICTURE_TYPE_I picture type as key frames + * will be used. + */ + int key_frame; + +#if FF_API_CONVERGENCE_DURATION + /** + * @deprecated unused + */ + attribute_deprecated + int64_t convergence_duration; +#endif + + // Timestamp generation support: + /** + * Synchronization point for start of timestamp generation. + * + * Set to >0 for sync point, 0 for no sync point and <0 for undefined + * (default). + * + * For example, this corresponds to presence of H.264 buffering period + * SEI message. + */ + int dts_sync_point; + + /** + * Offset of the current timestamp against last timestamp sync point in + * units of AVCodecContext.time_base. + * + * Set to INT_MIN when dts_sync_point unused. Otherwise, it must + * contain a valid timestamp offset. + * + * Note that the timestamp of sync point has usually a nonzero + * dts_ref_dts_delta, which refers to the previous sync point. Offset of + * the next frame after timestamp sync point will be usually 1. + * + * For example, this corresponds to H.264 cpb_removal_delay. + */ + int dts_ref_dts_delta; + + /** + * Presentation delay of current frame in units of AVCodecContext.time_base. + * + * Set to INT_MIN when dts_sync_point unused. Otherwise, it must + * contain valid non-negative timestamp delta (presentation time of a frame + * must not lie in the past). + * + * This delay represents the difference between decoding and presentation + * time of the frame. + * + * For example, this corresponds to H.264 dpb_output_delay. + */ + int pts_dts_delta; + + /** + * Position of the packet in file. + * + * Analogous to cur_frame_pts/dts + */ + int64_t cur_frame_pos[AV_PARSER_PTS_NB]; + + /** + * Byte position of currently parsed frame in stream. + */ + int64_t pos; + + /** + * Previous frame byte position. + */ + int64_t last_pos; + + /** + * Duration of the current frame. + * For audio, this is in units of 1 / AVCodecContext.sample_rate. + * For all other types, this is in units of AVCodecContext.time_base. + */ + int duration; + + enum AVFieldOrder field_order; + + /** + * Indicate whether a picture is coded as a frame, top field or bottom field. + * + * For example, H.264 field_pic_flag equal to 0 corresponds to + * AV_PICTURE_STRUCTURE_FRAME. An H.264 picture with field_pic_flag + * equal to 1 and bottom_field_flag equal to 0 corresponds to + * AV_PICTURE_STRUCTURE_TOP_FIELD. + */ + enum AVPictureStructure picture_structure; + + /** + * Picture number incremented in presentation or output order. + * This field may be reinitialized at the first picture of a new sequence. + * + * For example, this corresponds to H.264 PicOrderCnt. + */ + int output_picture_number; + + /** + * Dimensions of the decoded video intended for presentation. + */ + int width; + int height; + + /** + * Dimensions of the coded video. + */ + int coded_width; + int coded_height; + + /** + * The format of the coded data, corresponds to enum AVPixelFormat for video + * and for enum AVSampleFormat for audio. + * + * Note that a decoder can have considerable freedom in how exactly it + * decodes the data, so the format reported here might be different from the + * one returned by a decoder. + */ + int format; +} AVCodecParserContext; + +typedef struct AVCodecParser { + int codec_ids[5]; /* several codec IDs are permitted */ + int priv_data_size; + int (*parser_init)(AVCodecParserContext *s); + /* This callback never returns an error, a negative value means that + * the frame start was in a previous packet. */ + int (*parser_parse)(AVCodecParserContext *s, + AVCodecContext *avctx, + const uint8_t **poutbuf, int *poutbuf_size, + const uint8_t *buf, int buf_size); + void (*parser_close)(AVCodecParserContext *s); + int (*split)(AVCodecContext *avctx, const uint8_t *buf, int buf_size); + struct AVCodecParser *next; +} AVCodecParser; + +/** + * Iterate over all registered codec parsers. + * + * @param opaque a pointer where libavcodec will store the iteration state. Must + * point to NULL to start the iteration. + * + * @return the next registered codec parser or NULL when the iteration is + * finished + */ +const AVCodecParser *av_parser_iterate(void **opaque); + +attribute_deprecated +AVCodecParser *av_parser_next(const AVCodecParser *c); + +attribute_deprecated +void av_register_codec_parser(AVCodecParser *parser); +AVCodecParserContext *av_parser_init(int codec_id); + +/** + * Parse a packet. + * + * @param s parser context. + * @param avctx codec context. + * @param poutbuf set to pointer to parsed buffer or NULL if not yet finished. + * @param poutbuf_size set to size of parsed buffer or zero if not yet finished. + * @param buf input buffer. + * @param buf_size buffer size in bytes without the padding. I.e. the full buffer + size is assumed to be buf_size + AV_INPUT_BUFFER_PADDING_SIZE. + To signal EOF, this should be 0 (so that the last frame + can be output). + * @param pts input presentation timestamp. + * @param dts input decoding timestamp. + * @param pos input byte position in stream. + * @return the number of bytes of the input bitstream used. + * + * Example: + * @code + * while(in_len){ + * len = av_parser_parse2(myparser, AVCodecContext, &data, &size, + * in_data, in_len, + * pts, dts, pos); + * in_data += len; + * in_len -= len; + * + * if(size) + * decode_frame(data, size); + * } + * @endcode + */ +int av_parser_parse2(AVCodecParserContext *s, + AVCodecContext *avctx, + uint8_t **poutbuf, int *poutbuf_size, + const uint8_t *buf, int buf_size, + int64_t pts, int64_t dts, + int64_t pos); + +/** + * @return 0 if the output buffer is a subset of the input, 1 if it is allocated and must be freed + * @deprecated use AVBitStreamFilter + */ +int av_parser_change(AVCodecParserContext *s, + AVCodecContext *avctx, + uint8_t **poutbuf, int *poutbuf_size, + const uint8_t *buf, int buf_size, int keyframe); +void av_parser_close(AVCodecParserContext *s); + +/** + * @} + * @} + */ + +/** + * @addtogroup lavc_encoding + * @{ + */ + +/** + * Find a registered encoder with a matching codec ID. + * + * @param id AVCodecID of the requested encoder + * @return An encoder if one was found, NULL otherwise. + */ +AVCodec *avcodec_find_encoder(enum AVCodecID id); + +/** + * Find a registered encoder with the specified name. + * + * @param name name of the requested encoder + * @return An encoder if one was found, NULL otherwise. + */ +AVCodec *avcodec_find_encoder_by_name(const char *name); + +/** + * Encode a frame of audio. + * + * Takes input samples from frame and writes the next output packet, if + * available, to avpkt. The output packet does not necessarily contain data for + * the most recent frame, as encoders can delay, split, and combine input frames + * internally as needed. + * + * @param avctx codec context + * @param avpkt output AVPacket. + * The user can supply an output buffer by setting + * avpkt->data and avpkt->size prior to calling the + * function, but if the size of the user-provided data is not + * large enough, encoding will fail. If avpkt->data and + * avpkt->size are set, avpkt->destruct must also be set. All + * other AVPacket fields will be reset by the encoder using + * av_init_packet(). If avpkt->data is NULL, the encoder will + * allocate it. The encoder will set avpkt->size to the size + * of the output packet. + * + * If this function fails or produces no output, avpkt will be + * freed using av_packet_unref(). + * @param[in] frame AVFrame containing the raw audio data to be encoded. + * May be NULL when flushing an encoder that has the + * AV_CODEC_CAP_DELAY capability set. + * If AV_CODEC_CAP_VARIABLE_FRAME_SIZE is set, then each frame + * can have any number of samples. + * If it is not set, frame->nb_samples must be equal to + * avctx->frame_size for all frames except the last. + * The final frame may be smaller than avctx->frame_size. + * @param[out] got_packet_ptr This field is set to 1 by libavcodec if the + * output packet is non-empty, and to 0 if it is + * empty. If the function returns an error, the + * packet can be assumed to be invalid, and the + * value of got_packet_ptr is undefined and should + * not be used. + * @return 0 on success, negative error code on failure + * + * @deprecated use avcodec_send_frame()/avcodec_receive_packet() instead + */ +attribute_deprecated +int avcodec_encode_audio2(AVCodecContext *avctx, AVPacket *avpkt, + const AVFrame *frame, int *got_packet_ptr); + +/** + * Encode a frame of video. + * + * Takes input raw video data from frame and writes the next output packet, if + * available, to avpkt. The output packet does not necessarily contain data for + * the most recent frame, as encoders can delay and reorder input frames + * internally as needed. + * + * @param avctx codec context + * @param avpkt output AVPacket. + * The user can supply an output buffer by setting + * avpkt->data and avpkt->size prior to calling the + * function, but if the size of the user-provided data is not + * large enough, encoding will fail. All other AVPacket fields + * will be reset by the encoder using av_init_packet(). If + * avpkt->data is NULL, the encoder will allocate it. + * The encoder will set avpkt->size to the size of the + * output packet. The returned data (if any) belongs to the + * caller, he is responsible for freeing it. + * + * If this function fails or produces no output, avpkt will be + * freed using av_packet_unref(). + * @param[in] frame AVFrame containing the raw video data to be encoded. + * May be NULL when flushing an encoder that has the + * AV_CODEC_CAP_DELAY capability set. + * @param[out] got_packet_ptr This field is set to 1 by libavcodec if the + * output packet is non-empty, and to 0 if it is + * empty. If the function returns an error, the + * packet can be assumed to be invalid, and the + * value of got_packet_ptr is undefined and should + * not be used. + * @return 0 on success, negative error code on failure + * + * @deprecated use avcodec_send_frame()/avcodec_receive_packet() instead + */ +attribute_deprecated +int avcodec_encode_video2(AVCodecContext *avctx, AVPacket *avpkt, + const AVFrame *frame, int *got_packet_ptr); + +int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size, + const AVSubtitle *sub); + + +/** + * @} + */ + +#if FF_API_AVPICTURE +/** + * @addtogroup lavc_picture + * @{ + */ + +/** + * @deprecated unused + */ +attribute_deprecated +int avpicture_alloc(AVPicture *picture, enum AVPixelFormat pix_fmt, int width, int height); + +/** + * @deprecated unused + */ +attribute_deprecated +void avpicture_free(AVPicture *picture); + +/** + * @deprecated use av_image_fill_arrays() instead. + */ +attribute_deprecated +int avpicture_fill(AVPicture *picture, const uint8_t *ptr, + enum AVPixelFormat pix_fmt, int width, int height); + +/** + * @deprecated use av_image_copy_to_buffer() instead. + */ +attribute_deprecated +int avpicture_layout(const AVPicture *src, enum AVPixelFormat pix_fmt, + int width, int height, + unsigned char *dest, int dest_size); + +/** + * @deprecated use av_image_get_buffer_size() instead. + */ +attribute_deprecated +int avpicture_get_size(enum AVPixelFormat pix_fmt, int width, int height); + +/** + * @deprecated av_image_copy() instead. + */ +attribute_deprecated +void av_picture_copy(AVPicture *dst, const AVPicture *src, + enum AVPixelFormat pix_fmt, int width, int height); + +/** + * @deprecated unused + */ +attribute_deprecated +int av_picture_crop(AVPicture *dst, const AVPicture *src, + enum AVPixelFormat pix_fmt, int top_band, int left_band); + +/** + * @deprecated unused + */ +attribute_deprecated +int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, enum AVPixelFormat pix_fmt, + int padtop, int padbottom, int padleft, int padright, int *color); + +/** + * @} + */ +#endif + +/** + * @defgroup lavc_misc Utility functions + * @ingroup libavc + * + * Miscellaneous utility functions related to both encoding and decoding + * (or neither). + * @{ + */ + +/** + * @defgroup lavc_misc_pixfmt Pixel formats + * + * Functions for working with pixel formats. + * @{ + */ + +#if FF_API_GETCHROMA +/** + * @deprecated Use av_pix_fmt_get_chroma_sub_sample + */ + +attribute_deprecated +void avcodec_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int *v_shift); +#endif + +/** + * Return a value representing the fourCC code associated to the + * pixel format pix_fmt, or 0 if no associated fourCC code can be + * found. + */ +unsigned int avcodec_pix_fmt_to_codec_tag(enum AVPixelFormat pix_fmt); + +/** + * @deprecated see av_get_pix_fmt_loss() + */ +int avcodec_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt, enum AVPixelFormat src_pix_fmt, + int has_alpha); + +/** + * Find the best pixel format to convert to given a certain source pixel + * format. When converting from one pixel format to another, information loss + * may occur. For example, when converting from RGB24 to GRAY, the color + * information will be lost. Similarly, other losses occur when converting from + * some formats to other formats. avcodec_find_best_pix_fmt_of_2() searches which of + * the given pixel formats should be used to suffer the least amount of loss. + * The pixel formats from which it chooses one, are determined by the + * pix_fmt_list parameter. + * + * + * @param[in] pix_fmt_list AV_PIX_FMT_NONE terminated array of pixel formats to choose from + * @param[in] src_pix_fmt source pixel format + * @param[in] has_alpha Whether the source pixel format alpha channel is used. + * @param[out] loss_ptr Combination of flags informing you what kind of losses will occur. + * @return The best pixel format to convert to or -1 if none was found. + */ +enum AVPixelFormat avcodec_find_best_pix_fmt_of_list(const enum AVPixelFormat *pix_fmt_list, + enum AVPixelFormat src_pix_fmt, + int has_alpha, int *loss_ptr); + +/** + * @deprecated see av_find_best_pix_fmt_of_2() + */ +enum AVPixelFormat avcodec_find_best_pix_fmt_of_2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2, + enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr); + +attribute_deprecated +enum AVPixelFormat avcodec_find_best_pix_fmt2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2, + enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr); + +enum AVPixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum AVPixelFormat * fmt); + +/** + * @} + */ + +#if FF_API_TAG_STRING +/** + * Put a string representing the codec tag codec_tag in buf. + * + * @param buf buffer to place codec tag in + * @param buf_size size in bytes of buf + * @param codec_tag codec tag to assign + * @return the length of the string that would have been generated if + * enough space had been available, excluding the trailing null + * + * @deprecated see av_fourcc_make_string() and av_fourcc2str(). + */ +attribute_deprecated +size_t av_get_codec_tag_string(char *buf, size_t buf_size, unsigned int codec_tag); +#endif + +void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode); + +/** + * Return a name for the specified profile, if available. + * + * @param codec the codec that is searched for the given profile + * @param profile the profile value for which a name is requested + * @return A name for the profile if found, NULL otherwise. + */ +const char *av_get_profile_name(const AVCodec *codec, int profile); + +/** + * Return a name for the specified profile, if available. + * + * @param codec_id the ID of the codec to which the requested profile belongs + * @param profile the profile value for which a name is requested + * @return A name for the profile if found, NULL otherwise. + * + * @note unlike av_get_profile_name(), which searches a list of profiles + * supported by a specific decoder or encoder implementation, this + * function searches the list of profiles from the AVCodecDescriptor + */ +const char *avcodec_profile_name(enum AVCodecID codec_id, int profile); + +int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size); +int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2, int, int),void *arg, int *ret, int count); +//FIXME func typedef + +/** + * Fill AVFrame audio data and linesize pointers. + * + * The buffer buf must be a preallocated buffer with a size big enough + * to contain the specified samples amount. The filled AVFrame data + * pointers will point to this buffer. + * + * AVFrame extended_data channel pointers are allocated if necessary for + * planar audio. + * + * @param frame the AVFrame + * frame->nb_samples must be set prior to calling the + * function. This function fills in frame->data, + * frame->extended_data, frame->linesize[0]. + * @param nb_channels channel count + * @param sample_fmt sample format + * @param buf buffer to use for frame data + * @param buf_size size of buffer + * @param align plane size sample alignment (0 = default) + * @return >=0 on success, negative error code on failure + * @todo return the size in bytes required to store the samples in + * case of success, at the next libavutil bump + */ +int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels, + enum AVSampleFormat sample_fmt, const uint8_t *buf, + int buf_size, int align); + +/** + * Reset the internal decoder state / flush internal buffers. Should be called + * e.g. when seeking or when switching to a different stream. + * + * @note when refcounted frames are not used (i.e. avctx->refcounted_frames is 0), + * this invalidates the frames previously returned from the decoder. When + * refcounted frames are used, the decoder just releases any references it might + * keep internally, but the caller's reference remains valid. + */ +void avcodec_flush_buffers(AVCodecContext *avctx); + +/** + * Return codec bits per sample. + * + * @param[in] codec_id the codec + * @return Number of bits per sample or zero if unknown for the given codec. + */ +int av_get_bits_per_sample(enum AVCodecID codec_id); + +/** + * Return the PCM codec associated with a sample format. + * @param be endianness, 0 for little, 1 for big, + * -1 (or anything else) for native + * @return AV_CODEC_ID_PCM_* or AV_CODEC_ID_NONE + */ +enum AVCodecID av_get_pcm_codec(enum AVSampleFormat fmt, int be); + +/** + * Return codec bits per sample. + * Only return non-zero if the bits per sample is exactly correct, not an + * approximation. + * + * @param[in] codec_id the codec + * @return Number of bits per sample or zero if unknown for the given codec. + */ +int av_get_exact_bits_per_sample(enum AVCodecID codec_id); + +/** + * Return audio frame duration. + * + * @param avctx codec context + * @param frame_bytes size of the frame, or 0 if unknown + * @return frame duration, in samples, if known. 0 if not able to + * determine. + */ +int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes); + +/** + * This function is the same as av_get_audio_frame_duration(), except it works + * with AVCodecParameters instead of an AVCodecContext. + */ +int av_get_audio_frame_duration2(AVCodecParameters *par, int frame_bytes); + +#if FF_API_OLD_BSF +typedef struct AVBitStreamFilterContext { + void *priv_data; + const struct AVBitStreamFilter *filter; + AVCodecParserContext *parser; + struct AVBitStreamFilterContext *next; + /** + * Internal default arguments, used if NULL is passed to av_bitstream_filter_filter(). + * Not for access by library users. + */ + char *args; +} AVBitStreamFilterContext; +#endif + +typedef struct AVBSFInternal AVBSFInternal; + +/** + * The bitstream filter state. + * + * This struct must be allocated with av_bsf_alloc() and freed with + * av_bsf_free(). + * + * The fields in the struct will only be changed (by the caller or by the + * filter) as described in their documentation, and are to be considered + * immutable otherwise. + */ +typedef struct AVBSFContext { + /** + * A class for logging and AVOptions + */ + const AVClass *av_class; + + /** + * The bitstream filter this context is an instance of. + */ + const struct AVBitStreamFilter *filter; + + /** + * Opaque libavcodec internal data. Must not be touched by the caller in any + * way. + */ + AVBSFInternal *internal; + + /** + * Opaque filter-specific private data. If filter->priv_class is non-NULL, + * this is an AVOptions-enabled struct. + */ + void *priv_data; + + /** + * Parameters of the input stream. This field is allocated in + * av_bsf_alloc(), it needs to be filled by the caller before + * av_bsf_init(). + */ + AVCodecParameters *par_in; + + /** + * Parameters of the output stream. This field is allocated in + * av_bsf_alloc(), it is set by the filter in av_bsf_init(). + */ + AVCodecParameters *par_out; + + /** + * The timebase used for the timestamps of the input packets. Set by the + * caller before av_bsf_init(). + */ + AVRational time_base_in; + + /** + * The timebase used for the timestamps of the output packets. Set by the + * filter in av_bsf_init(). + */ + AVRational time_base_out; +} AVBSFContext; + +typedef struct AVBitStreamFilter { + const char *name; + + /** + * A list of codec ids supported by the filter, terminated by + * AV_CODEC_ID_NONE. + * May be NULL, in that case the bitstream filter works with any codec id. + */ + const enum AVCodecID *codec_ids; + + /** + * A class for the private data, used to declare bitstream filter private + * AVOptions. This field is NULL for bitstream filters that do not declare + * any options. + * + * If this field is non-NULL, the first member of the filter private data + * must be a pointer to AVClass, which will be set by libavcodec generic + * code to this class. + */ + const AVClass *priv_class; + + /***************************************************************** + * No fields below this line are part of the public API. They + * may not be used outside of libavcodec and can be changed and + * removed at will. + * New public fields should be added right above. + ***************************************************************** + */ + + int priv_data_size; + int (*init)(AVBSFContext *ctx); + int (*filter)(AVBSFContext *ctx, AVPacket *pkt); + void (*close)(AVBSFContext *ctx); +} AVBitStreamFilter; + +#if FF_API_OLD_BSF +/** + * @deprecated the old bitstream filtering API (using AVBitStreamFilterContext) + * is deprecated. Use the new bitstream filtering API (using AVBSFContext). + */ +attribute_deprecated +void av_register_bitstream_filter(AVBitStreamFilter *bsf); +/** + * @deprecated the old bitstream filtering API (using AVBitStreamFilterContext) + * is deprecated. Use av_bsf_get_by_name(), av_bsf_alloc(), and av_bsf_init() + * from the new bitstream filtering API (using AVBSFContext). + */ +attribute_deprecated +AVBitStreamFilterContext *av_bitstream_filter_init(const char *name); +/** + * @deprecated the old bitstream filtering API (using AVBitStreamFilterContext) + * is deprecated. Use av_bsf_send_packet() and av_bsf_receive_packet() from the + * new bitstream filtering API (using AVBSFContext). + */ +attribute_deprecated +int av_bitstream_filter_filter(AVBitStreamFilterContext *bsfc, + AVCodecContext *avctx, const char *args, + uint8_t **poutbuf, int *poutbuf_size, + const uint8_t *buf, int buf_size, int keyframe); +/** + * @deprecated the old bitstream filtering API (using AVBitStreamFilterContext) + * is deprecated. Use av_bsf_free() from the new bitstream filtering API (using + * AVBSFContext). + */ +attribute_deprecated +void av_bitstream_filter_close(AVBitStreamFilterContext *bsf); +/** + * @deprecated the old bitstream filtering API (using AVBitStreamFilterContext) + * is deprecated. Use av_bsf_iterate() from the new bitstream filtering API (using + * AVBSFContext). + */ +attribute_deprecated +const AVBitStreamFilter *av_bitstream_filter_next(const AVBitStreamFilter *f); +#endif + +/** + * @return a bitstream filter with the specified name or NULL if no such + * bitstream filter exists. + */ +const AVBitStreamFilter *av_bsf_get_by_name(const char *name); + +/** + * Iterate over all registered bitstream filters. + * + * @param opaque a pointer where libavcodec will store the iteration state. Must + * point to NULL to start the iteration. + * + * @return the next registered bitstream filter or NULL when the iteration is + * finished + */ +const AVBitStreamFilter *av_bsf_iterate(void **opaque); +#if FF_API_NEXT +attribute_deprecated +const AVBitStreamFilter *av_bsf_next(void **opaque); +#endif + +/** + * Allocate a context for a given bitstream filter. The caller must fill in the + * context parameters as described in the documentation and then call + * av_bsf_init() before sending any data to the filter. + * + * @param filter the filter for which to allocate an instance. + * @param ctx a pointer into which the pointer to the newly-allocated context + * will be written. It must be freed with av_bsf_free() after the + * filtering is done. + * + * @return 0 on success, a negative AVERROR code on failure + */ +int av_bsf_alloc(const AVBitStreamFilter *filter, AVBSFContext **ctx); + +/** + * Prepare the filter for use, after all the parameters and options have been + * set. + */ +int av_bsf_init(AVBSFContext *ctx); + +/** + * Submit a packet for filtering. + * + * After sending each packet, the filter must be completely drained by calling + * av_bsf_receive_packet() repeatedly until it returns AVERROR(EAGAIN) or + * AVERROR_EOF. + * + * @param pkt the packet to filter. The bitstream filter will take ownership of + * the packet and reset the contents of pkt. pkt is not touched if an error occurs. + * This parameter may be NULL, which signals the end of the stream (i.e. no more + * packets will be sent). That will cause the filter to output any packets it + * may have buffered internally. + * + * @return 0 on success, a negative AVERROR on error. + */ +int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt); + +/** + * Retrieve a filtered packet. + * + * @param[out] pkt this struct will be filled with the contents of the filtered + * packet. It is owned by the caller and must be freed using + * av_packet_unref() when it is no longer needed. + * This parameter should be "clean" (i.e. freshly allocated + * with av_packet_alloc() or unreffed with av_packet_unref()) + * when this function is called. If this function returns + * successfully, the contents of pkt will be completely + * overwritten by the returned data. On failure, pkt is not + * touched. + * + * @return 0 on success. AVERROR(EAGAIN) if more packets need to be sent to the + * filter (using av_bsf_send_packet()) to get more output. AVERROR_EOF if there + * will be no further output from the filter. Another negative AVERROR value if + * an error occurs. + * + * @note one input packet may result in several output packets, so after sending + * a packet with av_bsf_send_packet(), this function needs to be called + * repeatedly until it stops returning 0. It is also possible for a filter to + * output fewer packets than were sent to it, so this function may return + * AVERROR(EAGAIN) immediately after a successful av_bsf_send_packet() call. + */ +int av_bsf_receive_packet(AVBSFContext *ctx, AVPacket *pkt); + +/** + * Free a bitstream filter context and everything associated with it; write NULL + * into the supplied pointer. + */ +void av_bsf_free(AVBSFContext **ctx); + +/** + * Get the AVClass for AVBSFContext. It can be used in combination with + * AV_OPT_SEARCH_FAKE_OBJ for examining options. + * + * @see av_opt_find(). + */ +const AVClass *av_bsf_get_class(void); + +/** + * Structure for chain/list of bitstream filters. + * Empty list can be allocated by av_bsf_list_alloc(). + */ +typedef struct AVBSFList AVBSFList; + +/** + * Allocate empty list of bitstream filters. + * The list must be later freed by av_bsf_list_free() + * or finalized by av_bsf_list_finalize(). + * + * @return Pointer to @ref AVBSFList on success, NULL in case of failure + */ +AVBSFList *av_bsf_list_alloc(void); + +/** + * Free list of bitstream filters. + * + * @param lst Pointer to pointer returned by av_bsf_list_alloc() + */ +void av_bsf_list_free(AVBSFList **lst); + +/** + * Append bitstream filter to the list of bitstream filters. + * + * @param lst List to append to + * @param bsf Filter context to be appended + * + * @return >=0 on success, negative AVERROR in case of failure + */ +int av_bsf_list_append(AVBSFList *lst, AVBSFContext *bsf); + +/** + * Construct new bitstream filter context given it's name and options + * and append it to the list of bitstream filters. + * + * @param lst List to append to + * @param bsf_name Name of the bitstream filter + * @param options Options for the bitstream filter, can be set to NULL + * + * @return >=0 on success, negative AVERROR in case of failure + */ +int av_bsf_list_append2(AVBSFList *lst, const char * bsf_name, AVDictionary **options); +/** + * Finalize list of bitstream filters. + * + * This function will transform @ref AVBSFList to single @ref AVBSFContext, + * so the whole chain of bitstream filters can be treated as single filter + * freshly allocated by av_bsf_alloc(). + * If the call is successful, @ref AVBSFList structure is freed and lst + * will be set to NULL. In case of failure, caller is responsible for + * freeing the structure by av_bsf_list_free() + * + * @param lst Filter list structure to be transformed + * @param[out] bsf Pointer to be set to newly created @ref AVBSFContext structure + * representing the chain of bitstream filters + * + * @return >=0 on success, negative AVERROR in case of failure + */ +int av_bsf_list_finalize(AVBSFList **lst, AVBSFContext **bsf); + +/** + * Parse string describing list of bitstream filters and create single + * @ref AVBSFContext describing the whole chain of bitstream filters. + * Resulting @ref AVBSFContext can be treated as any other @ref AVBSFContext freshly + * allocated by av_bsf_alloc(). + * + * @param str String describing chain of bitstream filters in format + * `bsf1[=opt1=val1:opt2=val2][,bsf2]` + * @param[out] bsf Pointer to be set to newly created @ref AVBSFContext structure + * representing the chain of bitstream filters + * + * @return >=0 on success, negative AVERROR in case of failure + */ +int av_bsf_list_parse_str(const char *str, AVBSFContext **bsf); + +/** + * Get null/pass-through bitstream filter. + * + * @param[out] bsf Pointer to be set to new instance of pass-through bitstream filter + * + * @return + */ +int av_bsf_get_null_filter(AVBSFContext **bsf); + +/* memory */ + +/** + * Same behaviour av_fast_malloc but the buffer has additional + * AV_INPUT_BUFFER_PADDING_SIZE at the end which will always be 0. + * + * In addition the whole buffer will initially and after resizes + * be 0-initialized so that no uninitialized data will ever appear. + */ +void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size); + +/** + * Same behaviour av_fast_padded_malloc except that buffer will always + * be 0-initialized after call. + */ +void av_fast_padded_mallocz(void *ptr, unsigned int *size, size_t min_size); + +/** + * Encode extradata length to a buffer. Used by xiph codecs. + * + * @param s buffer to write to; must be at least (v/255+1) bytes long + * @param v size of extradata in bytes + * @return number of bytes written to the buffer. + */ +unsigned int av_xiphlacing(unsigned char *s, unsigned int v); + +#if FF_API_USER_VISIBLE_AVHWACCEL +/** + * Register the hardware accelerator hwaccel. + * + * @deprecated This function doesn't do anything. + */ +attribute_deprecated +void av_register_hwaccel(AVHWAccel *hwaccel); + +/** + * If hwaccel is NULL, returns the first registered hardware accelerator, + * if hwaccel is non-NULL, returns the next registered hardware accelerator + * after hwaccel, or NULL if hwaccel is the last one. + * + * @deprecated AVHWaccel structures contain no user-serviceable parts, so + * this function should not be used. + */ +attribute_deprecated +AVHWAccel *av_hwaccel_next(const AVHWAccel *hwaccel); +#endif + +#if FF_API_LOCKMGR +/** + * Lock operation used by lockmgr + * + * @deprecated Deprecated together with av_lockmgr_register(). + */ +enum AVLockOp { + AV_LOCK_CREATE, ///< Create a mutex + AV_LOCK_OBTAIN, ///< Lock the mutex + AV_LOCK_RELEASE, ///< Unlock the mutex + AV_LOCK_DESTROY, ///< Free mutex resources +}; + +/** + * Register a user provided lock manager supporting the operations + * specified by AVLockOp. The "mutex" argument to the function points + * to a (void *) where the lockmgr should store/get a pointer to a user + * allocated mutex. It is NULL upon AV_LOCK_CREATE and equal to the + * value left by the last call for all other ops. If the lock manager is + * unable to perform the op then it should leave the mutex in the same + * state as when it was called and return a non-zero value. However, + * when called with AV_LOCK_DESTROY the mutex will always be assumed to + * have been successfully destroyed. If av_lockmgr_register succeeds + * it will return a non-negative value, if it fails it will return a + * negative value and destroy all mutex and unregister all callbacks. + * av_lockmgr_register is not thread-safe, it must be called from a + * single thread before any calls which make use of locking are used. + * + * @param cb User defined callback. av_lockmgr_register invokes calls + * to this callback and the previously registered callback. + * The callback will be used to create more than one mutex + * each of which must be backed by its own underlying locking + * mechanism (i.e. do not use a single static object to + * implement your lock manager). If cb is set to NULL the + * lockmgr will be unregistered. + * + * @deprecated This function does nothing, and always returns 0. Be sure to + * build with thread support to get basic thread safety. + */ +attribute_deprecated +int av_lockmgr_register(int (*cb)(void **mutex, enum AVLockOp op)); +#endif + +/** + * Get the type of the given codec. + */ +enum AVMediaType avcodec_get_type(enum AVCodecID codec_id); + +/** + * Get the name of a codec. + * @return a static string identifying the codec; never NULL + */ +const char *avcodec_get_name(enum AVCodecID id); + +/** + * @return a positive value if s is open (i.e. avcodec_open2() was called on it + * with no corresponding avcodec_close()), 0 otherwise. + */ +int avcodec_is_open(AVCodecContext *s); + +/** + * @return a non-zero number if codec is an encoder, zero otherwise + */ +int av_codec_is_encoder(const AVCodec *codec); + +/** + * @return a non-zero number if codec is a decoder, zero otherwise + */ +int av_codec_is_decoder(const AVCodec *codec); + +/** + * @return descriptor for given codec ID or NULL if no descriptor exists. + */ +const AVCodecDescriptor *avcodec_descriptor_get(enum AVCodecID id); + +/** + * Iterate over all codec descriptors known to libavcodec. + * + * @param prev previous descriptor. NULL to get the first descriptor. + * + * @return next descriptor or NULL after the last descriptor + */ +const AVCodecDescriptor *avcodec_descriptor_next(const AVCodecDescriptor *prev); + +/** + * @return codec descriptor with the given name or NULL if no such descriptor + * exists. + */ +const AVCodecDescriptor *avcodec_descriptor_get_by_name(const char *name); + +/** + * Allocate a CPB properties structure and initialize its fields to default + * values. + * + * @param size if non-NULL, the size of the allocated struct will be written + * here. This is useful for embedding it in side data. + * + * @return the newly allocated struct or NULL on failure + */ +AVCPBProperties *av_cpb_properties_alloc(size_t *size); + +/** + * @} + */ + +#endif /* AVCODEC_AVCODEC_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavcodec/avdct.h b/MediaClient/MediaClient/ffmpeg/include/libavcodec/avdct.h new file mode 100644 index 0000000..272422e --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavcodec/avdct.h @@ -0,0 +1,84 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_AVDCT_H +#define AVCODEC_AVDCT_H + +#include "libavutil/opt.h" + +/** + * AVDCT context. + * @note function pointers can be NULL if the specific features have been + * disabled at build time. + */ +typedef struct AVDCT { + const AVClass *av_class; + + void (*idct)(int16_t *block /* align 16 */); + + /** + * IDCT input permutation. + * Several optimized IDCTs need a permutated input (relative to the + * normal order of the reference IDCT). + * This permutation must be performed before the idct_put/add. + * Note, normally this can be merged with the zigzag/alternate scan
+ * An example to avoid confusion: + * - (->decode coeffs -> zigzag reorder -> dequant -> reference IDCT -> ...) + * - (x -> reference DCT -> reference IDCT -> x) + * - (x -> reference DCT -> simple_mmx_perm = idct_permutation + * -> simple_idct_mmx -> x) + * - (-> decode coeffs -> zigzag reorder -> simple_mmx_perm -> dequant + * -> simple_idct_mmx -> ...) + */ + uint8_t idct_permutation[64]; + + void (*fdct)(int16_t *block /* align 16 */); + + + /** + * DCT algorithm. + * must use AVOptions to set this field. + */ + int dct_algo; + + /** + * IDCT algorithm. + * must use AVOptions to set this field. + */ + int idct_algo; + + void (*get_pixels)(int16_t *block /* align 16 */, + const uint8_t *pixels /* align 8 */, + ptrdiff_t line_size); + + int bits_per_sample; +} AVDCT; + +/** + * Allocates a AVDCT context. + * This needs to be initialized with avcodec_dct_init() after optionally + * configuring it with AVOptions. + * + * To free it use av_free() + */ +AVDCT *avcodec_dct_alloc(void); +int avcodec_dct_init(AVDCT *); + +const AVClass *avcodec_dct_get_class(void); + +#endif /* AVCODEC_AVDCT_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavcodec/avfft.h b/MediaClient/MediaClient/ffmpeg/include/libavcodec/avfft.h new file mode 100644 index 0000000..0c0f9b8 --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavcodec/avfft.h @@ -0,0 +1,118 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_AVFFT_H +#define AVCODEC_AVFFT_H + +/** + * @file + * @ingroup lavc_fft + * FFT functions + */ + +/** + * @defgroup lavc_fft FFT functions + * @ingroup lavc_misc + * + * @{ + */ + +typedef float FFTSample; + +typedef struct FFTComplex { + FFTSample re, im; +} FFTComplex; + +typedef struct FFTContext FFTContext; + +/** + * Set up a complex FFT. + * @param nbits log2 of the length of the input array + * @param inverse if 0 perform the forward transform, if 1 perform the inverse + */ +FFTContext *av_fft_init(int nbits, int inverse); + +/** + * Do the permutation needed BEFORE calling ff_fft_calc(). + */ +void av_fft_permute(FFTContext *s, FFTComplex *z); + +/** + * Do a complex FFT with the parameters defined in av_fft_init(). The + * input data must be permuted before. No 1.0/sqrt(n) normalization is done. + */ +void av_fft_calc(FFTContext *s, FFTComplex *z); + +void av_fft_end(FFTContext *s); + +FFTContext *av_mdct_init(int nbits, int inverse, double scale); +void av_imdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input); +void av_imdct_half(FFTContext *s, FFTSample *output, const FFTSample *input); +void av_mdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input); +void av_mdct_end(FFTContext *s); + +/* Real Discrete Fourier Transform */ + +enum RDFTransformType { + DFT_R2C, + IDFT_C2R, + IDFT_R2C, + DFT_C2R, +}; + +typedef struct RDFTContext RDFTContext; + +/** + * Set up a real FFT. + * @param nbits log2 of the length of the input array + * @param trans the type of transform + */ +RDFTContext *av_rdft_init(int nbits, enum RDFTransformType trans); +void av_rdft_calc(RDFTContext *s, FFTSample *data); +void av_rdft_end(RDFTContext *s); + +/* Discrete Cosine Transform */ + +typedef struct DCTContext DCTContext; + +enum DCTTransformType { + DCT_II = 0, + DCT_III, + DCT_I, + DST_I, +}; + +/** + * Set up DCT. + * + * @param nbits size of the input array: + * (1 << nbits) for DCT-II, DCT-III and DST-I + * (1 << nbits) + 1 for DCT-I + * @param type the type of transform + * + * @note the first element of the input of DST-I is ignored + */ +DCTContext *av_dct_init(int nbits, enum DCTTransformType type); +void av_dct_calc(DCTContext *s, FFTSample *data); +void av_dct_end (DCTContext *s); + +/** + * @} + */ + +#endif /* AVCODEC_AVFFT_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavcodec/bsf.h b/MediaClient/MediaClient/ffmpeg/include/libavcodec/bsf.h new file mode 100644 index 0000000..a0ff028 --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavcodec/bsf.h @@ -0,0 +1,3 @@ +/* This file has no content, it is only compatible with high version of ffmpeg */ + + diff --git a/MediaClient/MediaClient/ffmpeg/include/libavcodec/d3d11va.h b/MediaClient/MediaClient/ffmpeg/include/libavcodec/d3d11va.h new file mode 100644 index 0000000..6816b6c --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavcodec/d3d11va.h @@ -0,0 +1,112 @@ +/* + * Direct3D11 HW acceleration + * + * copyright (c) 2009 Laurent Aimar + * copyright (c) 2015 Steve Lhomme + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_D3D11VA_H +#define AVCODEC_D3D11VA_H + +/** + * @file + * @ingroup lavc_codec_hwaccel_d3d11va + * Public libavcodec D3D11VA header. + */ + +#if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0602 +#undef _WIN32_WINNT +#define _WIN32_WINNT 0x0602 +#endif + +#include +#include + +/** + * @defgroup lavc_codec_hwaccel_d3d11va Direct3D11 + * @ingroup lavc_codec_hwaccel + * + * @{ + */ + +#define FF_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG 1 ///< Work around for Direct3D11 and old UVD/UVD+ ATI video cards +#define FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO 2 ///< Work around for Direct3D11 and old Intel GPUs with ClearVideo interface + +/** + * This structure is used to provides the necessary configurations and data + * to the Direct3D11 FFmpeg HWAccel implementation. + * + * The application must make it available as AVCodecContext.hwaccel_context. + * + * Use av_d3d11va_alloc_context() exclusively to allocate an AVD3D11VAContext. + */ +typedef struct AVD3D11VAContext { + /** + * D3D11 decoder object + */ + ID3D11VideoDecoder *decoder; + + /** + * D3D11 VideoContext + */ + ID3D11VideoContext *video_context; + + /** + * D3D11 configuration used to create the decoder + */ + D3D11_VIDEO_DECODER_CONFIG *cfg; + + /** + * The number of surface in the surface array + */ + unsigned surface_count; + + /** + * The array of Direct3D surfaces used to create the decoder + */ + ID3D11VideoDecoderOutputView **surface; + + /** + * A bit field configuring the workarounds needed for using the decoder + */ + uint64_t workaround; + + /** + * Private to the FFmpeg AVHWAccel implementation + */ + unsigned report_id; + + /** + * Mutex to access video_context + */ + HANDLE context_mutex; +} AVD3D11VAContext; + +/** + * Allocate an AVD3D11VAContext. + * + * @return Newly-allocated AVD3D11VAContext or NULL on failure. + */ +AVD3D11VAContext *av_d3d11va_alloc_context(void); + +/** + * @} + */ + +#endif /* AVCODEC_D3D11VA_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavcodec/dirac.h b/MediaClient/MediaClient/ffmpeg/include/libavcodec/dirac.h new file mode 100644 index 0000000..e6d9d34 --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavcodec/dirac.h @@ -0,0 +1,131 @@ +/* + * Copyright (C) 2007 Marco Gerards + * Copyright (C) 2009 David Conrad + * Copyright (C) 2011 Jordi Ortiz + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_DIRAC_H +#define AVCODEC_DIRAC_H + +/** + * @file + * Interface to Dirac Decoder/Encoder + * @author Marco Gerards + * @author David Conrad + * @author Jordi Ortiz + */ + +#include "avcodec.h" + +/** + * The spec limits the number of wavelet decompositions to 4 for both + * level 1 (VC-2) and 128 (long-gop default). + * 5 decompositions is the maximum before >16-bit buffers are needed. + * Schroedinger allows this for DD 9,7 and 13,7 wavelets only, limiting + * the others to 4 decompositions (or 3 for the fidelity filter). + * + * We use this instead of MAX_DECOMPOSITIONS to save some memory. + */ +#define MAX_DWT_LEVELS 5 + +/** + * Parse code values: + * + * Dirac Specification -> + * 9.6.1 Table 9.1 + * + * VC-2 Specification -> + * 10.4.1 Table 10.1 + */ + +enum DiracParseCodes { + DIRAC_PCODE_SEQ_HEADER = 0x00, + DIRAC_PCODE_END_SEQ = 0x10, + DIRAC_PCODE_AUX = 0x20, + DIRAC_PCODE_PAD = 0x30, + DIRAC_PCODE_PICTURE_CODED = 0x08, + DIRAC_PCODE_PICTURE_RAW = 0x48, + DIRAC_PCODE_PICTURE_LOW_DEL = 0xC8, + DIRAC_PCODE_PICTURE_HQ = 0xE8, + DIRAC_PCODE_INTER_NOREF_CO1 = 0x0A, + DIRAC_PCODE_INTER_NOREF_CO2 = 0x09, + DIRAC_PCODE_INTER_REF_CO1 = 0x0D, + DIRAC_PCODE_INTER_REF_CO2 = 0x0E, + DIRAC_PCODE_INTRA_REF_CO = 0x0C, + DIRAC_PCODE_INTRA_REF_RAW = 0x4C, + DIRAC_PCODE_INTRA_REF_PICT = 0xCC, + DIRAC_PCODE_MAGIC = 0x42424344, +}; + +typedef struct DiracVersionInfo { + int major; + int minor; +} DiracVersionInfo; + +typedef struct AVDiracSeqHeader { + unsigned width; + unsigned height; + uint8_t chroma_format; ///< 0: 444 1: 422 2: 420 + + uint8_t interlaced; + uint8_t top_field_first; + + uint8_t frame_rate_index; ///< index into dirac_frame_rate[] + uint8_t aspect_ratio_index; ///< index into dirac_aspect_ratio[] + + uint16_t clean_width; + uint16_t clean_height; + uint16_t clean_left_offset; + uint16_t clean_right_offset; + + uint8_t pixel_range_index; ///< index into dirac_pixel_range_presets[] + uint8_t color_spec_index; ///< index into dirac_color_spec_presets[] + + int profile; + int level; + + AVRational framerate; + AVRational sample_aspect_ratio; + + enum AVPixelFormat pix_fmt; + enum AVColorRange color_range; + enum AVColorPrimaries color_primaries; + enum AVColorTransferCharacteristic color_trc; + enum AVColorSpace colorspace; + + DiracVersionInfo version; + int bit_depth; +} AVDiracSeqHeader; + +/** + * Parse a Dirac sequence header. + * + * @param dsh this function will allocate and fill an AVDiracSeqHeader struct + * and write it into this pointer. The caller must free it with + * av_free(). + * @param buf the data buffer + * @param buf_size the size of the data buffer in bytes + * @param log_ctx if non-NULL, this function will log errors here + * @return 0 on success, a negative AVERROR code on failure + */ +int av_dirac_parse_sequence_header(AVDiracSeqHeader **dsh, + const uint8_t *buf, size_t buf_size, + void *log_ctx); + +#endif /* AVCODEC_DIRAC_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavcodec/dv_profile.h b/MediaClient/MediaClient/ffmpeg/include/libavcodec/dv_profile.h new file mode 100644 index 0000000..9380a66 --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavcodec/dv_profile.h @@ -0,0 +1,83 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_DV_PROFILE_H +#define AVCODEC_DV_PROFILE_H + +#include + +#include "libavutil/pixfmt.h" +#include "libavutil/rational.h" +#include "avcodec.h" + +/* minimum number of bytes to read from a DV stream in order to + * determine the profile */ +#define DV_PROFILE_BYTES (6 * 80) /* 6 DIF blocks */ + + +/* + * AVDVProfile is used to express the differences between various + * DV flavors. For now it's primarily used for differentiating + * 525/60 and 625/50, but the plans are to use it for various + * DV specs as well (e.g. SMPTE314M vs. IEC 61834). + */ +typedef struct AVDVProfile { + int dsf; /* value of the dsf in the DV header */ + int video_stype; /* stype for VAUX source pack */ + int frame_size; /* total size of one frame in bytes */ + int difseg_size; /* number of DIF segments per DIF channel */ + int n_difchan; /* number of DIF channels per frame */ + AVRational time_base; /* 1/framerate */ + int ltc_divisor; /* FPS from the LTS standpoint */ + int height; /* picture height in pixels */ + int width; /* picture width in pixels */ + AVRational sar[2]; /* sample aspect ratios for 4:3 and 16:9 */ + enum AVPixelFormat pix_fmt; /* picture pixel format */ + int bpm; /* blocks per macroblock */ + const uint8_t *block_sizes; /* AC block sizes, in bits */ + int audio_stride; /* size of audio_shuffle table */ + int audio_min_samples[3]; /* min amount of audio samples */ + /* for 48kHz, 44.1kHz and 32kHz */ + int audio_samples_dist[5]; /* how many samples are supposed to be */ + /* in each frame in a 5 frames window */ + const uint8_t (*audio_shuffle)[9]; /* PCM shuffling table */ +} AVDVProfile; + +/** + * Get a DV profile for the provided compressed frame. + * + * @param sys the profile used for the previous frame, may be NULL + * @param frame the compressed data buffer + * @param buf_size size of the buffer in bytes + * @return the DV profile for the supplied data or NULL on failure + */ +const AVDVProfile *av_dv_frame_profile(const AVDVProfile *sys, + const uint8_t *frame, unsigned buf_size); + +/** + * Get a DV profile for the provided stream parameters. + */ +const AVDVProfile *av_dv_codec_profile(int width, int height, enum AVPixelFormat pix_fmt); + +/** + * Get a DV profile for the provided stream parameters. + * The frame rate is used as a best-effort parameter. + */ +const AVDVProfile *av_dv_codec_profile2(int width, int height, enum AVPixelFormat pix_fmt, AVRational frame_rate); + +#endif /* AVCODEC_DV_PROFILE_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavcodec/dxva2.h b/MediaClient/MediaClient/ffmpeg/include/libavcodec/dxva2.h new file mode 100644 index 0000000..22c9399 --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavcodec/dxva2.h @@ -0,0 +1,93 @@ +/* + * DXVA2 HW acceleration + * + * copyright (c) 2009 Laurent Aimar + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_DXVA2_H +#define AVCODEC_DXVA2_H + +/** + * @file + * @ingroup lavc_codec_hwaccel_dxva2 + * Public libavcodec DXVA2 header. + */ + +#if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0602 +#undef _WIN32_WINNT +#define _WIN32_WINNT 0x0602 +#endif + +#include +#include +#include + +/** + * @defgroup lavc_codec_hwaccel_dxva2 DXVA2 + * @ingroup lavc_codec_hwaccel + * + * @{ + */ + +#define FF_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG 1 ///< Work around for DXVA2 and old UVD/UVD+ ATI video cards +#define FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO 2 ///< Work around for DXVA2 and old Intel GPUs with ClearVideo interface + +/** + * This structure is used to provides the necessary configurations and data + * to the DXVA2 FFmpeg HWAccel implementation. + * + * The application must make it available as AVCodecContext.hwaccel_context. + */ +struct dxva_context { + /** + * DXVA2 decoder object + */ + IDirectXVideoDecoder *decoder; + + /** + * DXVA2 configuration used to create the decoder + */ + const DXVA2_ConfigPictureDecode *cfg; + + /** + * The number of surface in the surface array + */ + unsigned surface_count; + + /** + * The array of Direct3D surfaces used to create the decoder + */ + LPDIRECT3DSURFACE9 *surface; + + /** + * A bit field configuring the workarounds needed for using the decoder + */ + uint64_t workaround; + + /** + * Private to the FFmpeg AVHWAccel implementation + */ + unsigned report_id; +}; + +/** + * @} + */ + +#endif /* AVCODEC_DXVA2_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavcodec/jni.h b/MediaClient/MediaClient/ffmpeg/include/libavcodec/jni.h new file mode 100644 index 0000000..dd99e92 --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavcodec/jni.h @@ -0,0 +1,46 @@ +/* + * JNI public API functions + * + * Copyright (c) 2015-2016 Matthieu Bouron + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_JNI_H +#define AVCODEC_JNI_H + +/* + * Manually set a Java virtual machine which will be used to retrieve the JNI + * environment. Once a Java VM is set it cannot be changed afterwards, meaning + * you can call multiple times av_jni_set_java_vm with the same Java VM pointer + * however it will error out if you try to set a different Java VM. + * + * @param vm Java virtual machine + * @param log_ctx context used for logging, can be NULL + * @return 0 on success, < 0 otherwise + */ +int av_jni_set_java_vm(void *vm, void *log_ctx); + +/* + * Get the Java virtual machine which has been set with av_jni_set_java_vm. + * + * @param vm Java virtual machine + * @return a pointer to the Java virtual machine + */ +void *av_jni_get_java_vm(void *log_ctx); + +#endif /* AVCODEC_JNI_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavcodec/mediacodec.h b/MediaClient/MediaClient/ffmpeg/include/libavcodec/mediacodec.h new file mode 100644 index 0000000..5606d24 --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavcodec/mediacodec.h @@ -0,0 +1,88 @@ +/* + * Android MediaCodec public API + * + * Copyright (c) 2016 Matthieu Bouron + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_MEDIACODEC_H +#define AVCODEC_MEDIACODEC_H + +#include "libavcodec/avcodec.h" + +/** + * This structure holds a reference to a android/view/Surface object that will + * be used as output by the decoder. + * + */ +typedef struct AVMediaCodecContext { + + /** + * android/view/Surface object reference. + */ + void *surface; + +} AVMediaCodecContext; + +/** + * Allocate and initialize a MediaCodec context. + * + * When decoding with MediaCodec is finished, the caller must free the + * MediaCodec context with av_mediacodec_default_free. + * + * @return a pointer to a newly allocated AVMediaCodecContext on success, NULL otherwise + */ +AVMediaCodecContext *av_mediacodec_alloc_context(void); + +/** + * Convenience function that sets up the MediaCodec context. + * + * @param avctx codec context + * @param ctx MediaCodec context to initialize + * @param surface reference to an android/view/Surface + * @return 0 on success, < 0 otherwise + */ +int av_mediacodec_default_init(AVCodecContext *avctx, AVMediaCodecContext *ctx, void *surface); + +/** + * This function must be called to free the MediaCodec context initialized with + * av_mediacodec_default_init(). + * + * @param avctx codec context + */ +void av_mediacodec_default_free(AVCodecContext *avctx); + +/** + * Opaque structure representing a MediaCodec buffer to render. + */ +typedef struct MediaCodecBuffer AVMediaCodecBuffer; + +/** + * Release a MediaCodec buffer and render it to the surface that is associated + * with the decoder. This function should only be called once on a given + * buffer, once released the underlying buffer returns to the codec, thus + * subsequent calls to this function will have no effect. + * + * @param buffer the buffer to render + * @param render 1 to release and render the buffer to the surface or 0 to + * discard the buffer + * @return 0 on success, < 0 otherwise + */ +int av_mediacodec_release_buffer(AVMediaCodecBuffer *buffer, int render); + +#endif /* AVCODEC_MEDIACODEC_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavcodec/qsv.h b/MediaClient/MediaClient/ffmpeg/include/libavcodec/qsv.h new file mode 100644 index 0000000..b77158e --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavcodec/qsv.h @@ -0,0 +1,107 @@ +/* + * Intel MediaSDK QSV public API + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_QSV_H +#define AVCODEC_QSV_H + +#include + +#include "libavutil/buffer.h" + +/** + * This struct is used for communicating QSV parameters between libavcodec and + * the caller. It is managed by the caller and must be assigned to + * AVCodecContext.hwaccel_context. + * - decoding: hwaccel_context must be set on return from the get_format() + * callback + * - encoding: hwaccel_context must be set before avcodec_open2() + */ +typedef struct AVQSVContext { + /** + * If non-NULL, the session to use for encoding or decoding. + * Otherwise, libavcodec will try to create an internal session. + */ + mfxSession session; + + /** + * The IO pattern to use. + */ + int iopattern; + + /** + * Extra buffers to pass to encoder or decoder initialization. + */ + mfxExtBuffer **ext_buffers; + int nb_ext_buffers; + + /** + * Encoding only. If this field is set to non-zero by the caller, libavcodec + * will create an mfxExtOpaqueSurfaceAlloc extended buffer and pass it to + * the encoder initialization. This only makes sense if iopattern is also + * set to MFX_IOPATTERN_IN_OPAQUE_MEMORY. + * + * The number of allocated opaque surfaces will be the sum of the number + * required by the encoder and the user-provided value nb_opaque_surfaces. + * The array of the opaque surfaces will be exported to the caller through + * the opaque_surfaces field. + */ + int opaque_alloc; + + /** + * Encoding only, and only if opaque_alloc is set to non-zero. Before + * calling avcodec_open2(), the caller should set this field to the number + * of extra opaque surfaces to allocate beyond what is required by the + * encoder. + * + * On return from avcodec_open2(), this field will be set by libavcodec to + * the total number of allocated opaque surfaces. + */ + int nb_opaque_surfaces; + + /** + * Encoding only, and only if opaque_alloc is set to non-zero. On return + * from avcodec_open2(), this field will be used by libavcodec to export the + * array of the allocated opaque surfaces to the caller, so they can be + * passed to other parts of the pipeline. + * + * The buffer reference exported here is owned and managed by libavcodec, + * the callers should make their own reference with av_buffer_ref() and free + * it with av_buffer_unref() when it is no longer needed. + * + * The buffer data is an nb_opaque_surfaces-sized array of mfxFrameSurface1. + */ + AVBufferRef *opaque_surfaces; + + /** + * Encoding only, and only if opaque_alloc is set to non-zero. On return + * from avcodec_open2(), this field will be set to the surface type used in + * the opaque allocation request. + */ + int opaque_alloc_type; +} AVQSVContext; + +/** + * Allocate a new context. + * + * It must be freed by the caller with av_free(). + */ +AVQSVContext *av_qsv_alloc_context(void); + +#endif /* AVCODEC_QSV_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavcodec/vaapi.h b/MediaClient/MediaClient/ffmpeg/include/libavcodec/vaapi.h new file mode 100644 index 0000000..2cf7da5 --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavcodec/vaapi.h @@ -0,0 +1,86 @@ +/* + * Video Acceleration API (shared data between FFmpeg and the video player) + * HW decode acceleration for MPEG-2, MPEG-4, H.264 and VC-1 + * + * Copyright (C) 2008-2009 Splitted-Desktop Systems + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_VAAPI_H +#define AVCODEC_VAAPI_H + +/** + * @file + * @ingroup lavc_codec_hwaccel_vaapi + * Public libavcodec VA API header. + */ + +#include +#include "libavutil/attributes.h" +#include "version.h" + +#if FF_API_STRUCT_VAAPI_CONTEXT + +/** + * @defgroup lavc_codec_hwaccel_vaapi VA API Decoding + * @ingroup lavc_codec_hwaccel + * @{ + */ + +/** + * This structure is used to share data between the FFmpeg library and + * the client video application. + * This shall be zero-allocated and available as + * AVCodecContext.hwaccel_context. All user members can be set once + * during initialization or through each AVCodecContext.get_buffer() + * function call. In any case, they must be valid prior to calling + * decoding functions. + * + * Deprecated: use AVCodecContext.hw_frames_ctx instead. + */ +struct attribute_deprecated vaapi_context { + /** + * Window system dependent data + * + * - encoding: unused + * - decoding: Set by user + */ + void *display; + + /** + * Configuration ID + * + * - encoding: unused + * - decoding: Set by user + */ + uint32_t config_id; + + /** + * Context ID (video decode pipeline) + * + * - encoding: unused + * - decoding: Set by user + */ + uint32_t context_id; +}; + +/* @} */ + +#endif /* FF_API_STRUCT_VAAPI_CONTEXT */ + +#endif /* AVCODEC_VAAPI_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavcodec/vdpau.h b/MediaClient/MediaClient/ffmpeg/include/libavcodec/vdpau.h new file mode 100644 index 0000000..4d99943 --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavcodec/vdpau.h @@ -0,0 +1,176 @@ +/* + * The Video Decode and Presentation API for UNIX (VDPAU) is used for + * hardware-accelerated decoding of MPEG-1/2, H.264 and VC-1. + * + * Copyright (C) 2008 NVIDIA + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_VDPAU_H +#define AVCODEC_VDPAU_H + +/** + * @file + * @ingroup lavc_codec_hwaccel_vdpau + * Public libavcodec VDPAU header. + */ + + +/** + * @defgroup lavc_codec_hwaccel_vdpau VDPAU Decoder and Renderer + * @ingroup lavc_codec_hwaccel + * + * VDPAU hardware acceleration has two modules + * - VDPAU decoding + * - VDPAU presentation + * + * The VDPAU decoding module parses all headers using FFmpeg + * parsing mechanisms and uses VDPAU for the actual decoding. + * + * As per the current implementation, the actual decoding + * and rendering (API calls) are done as part of the VDPAU + * presentation (vo_vdpau.c) module. + * + * @{ + */ + +#include + +#include "libavutil/avconfig.h" +#include "libavutil/attributes.h" + +#include "avcodec.h" +#include "version.h" + +struct AVCodecContext; +struct AVFrame; + +typedef int (*AVVDPAU_Render2)(struct AVCodecContext *, struct AVFrame *, + const VdpPictureInfo *, uint32_t, + const VdpBitstreamBuffer *); + +/** + * This structure is used to share data between the libavcodec library and + * the client video application. + * The user shall allocate the structure via the av_alloc_vdpau_hwaccel + * function and make it available as + * AVCodecContext.hwaccel_context. Members can be set by the user once + * during initialization or through each AVCodecContext.get_buffer() + * function call. In any case, they must be valid prior to calling + * decoding functions. + * + * The size of this structure is not a part of the public ABI and must not + * be used outside of libavcodec. Use av_vdpau_alloc_context() to allocate an + * AVVDPAUContext. + */ +typedef struct AVVDPAUContext { + /** + * VDPAU decoder handle + * + * Set by user. + */ + VdpDecoder decoder; + + /** + * VDPAU decoder render callback + * + * Set by the user. + */ + VdpDecoderRender *render; + + AVVDPAU_Render2 render2; +} AVVDPAUContext; + +/** + * @brief allocation function for AVVDPAUContext + * + * Allows extending the struct without breaking API/ABI + */ +AVVDPAUContext *av_alloc_vdpaucontext(void); + +AVVDPAU_Render2 av_vdpau_hwaccel_get_render2(const AVVDPAUContext *); +void av_vdpau_hwaccel_set_render2(AVVDPAUContext *, AVVDPAU_Render2); + +/** + * Associate a VDPAU device with a codec context for hardware acceleration. + * This function is meant to be called from the get_format() codec callback, + * or earlier. It can also be called after avcodec_flush_buffers() to change + * the underlying VDPAU device mid-stream (e.g. to recover from non-transparent + * display preemption). + * + * @note get_format() must return AV_PIX_FMT_VDPAU if this function completes + * successfully. + * + * @param avctx decoding context whose get_format() callback is invoked + * @param device VDPAU device handle to use for hardware acceleration + * @param get_proc_address VDPAU device driver + * @param flags zero of more OR'd AV_HWACCEL_FLAG_* flags + * + * @return 0 on success, an AVERROR code on failure. + */ +int av_vdpau_bind_context(AVCodecContext *avctx, VdpDevice device, + VdpGetProcAddress *get_proc_address, unsigned flags); + +/** + * Gets the parameters to create an adequate VDPAU video surface for the codec + * context using VDPAU hardware decoding acceleration. + * + * @note Behavior is undefined if the context was not successfully bound to a + * VDPAU device using av_vdpau_bind_context(). + * + * @param avctx the codec context being used for decoding the stream + * @param type storage space for the VDPAU video surface chroma type + * (or NULL to ignore) + * @param width storage space for the VDPAU video surface pixel width + * (or NULL to ignore) + * @param height storage space for the VDPAU video surface pixel height + * (or NULL to ignore) + * + * @return 0 on success, a negative AVERROR code on failure. + */ +int av_vdpau_get_surface_parameters(AVCodecContext *avctx, VdpChromaType *type, + uint32_t *width, uint32_t *height); + +/** + * Allocate an AVVDPAUContext. + * + * @return Newly-allocated AVVDPAUContext or NULL on failure. + */ +AVVDPAUContext *av_vdpau_alloc_context(void); + +#if FF_API_VDPAU_PROFILE +/** + * Get a decoder profile that should be used for initializing a VDPAU decoder. + * Should be called from the AVCodecContext.get_format() callback. + * + * @deprecated Use av_vdpau_bind_context() instead. + * + * @param avctx the codec context being used for decoding the stream + * @param profile a pointer into which the result will be written on success. + * The contents of profile are undefined if this function returns + * an error. + * + * @return 0 on success (non-negative), a negative AVERROR on failure. + */ +attribute_deprecated +int av_vdpau_get_profile(AVCodecContext *avctx, VdpDecoderProfile *profile); +#endif + +/* @}*/ + +#endif /* AVCODEC_VDPAU_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavcodec/version.h b/MediaClient/MediaClient/ffmpeg/include/libavcodec/version.h new file mode 100644 index 0000000..6895f1a --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavcodec/version.h @@ -0,0 +1,137 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_VERSION_H +#define AVCODEC_VERSION_H + +/** + * @file + * @ingroup libavc + * Libavcodec version macros. + */ + +#include "libavutil/version.h" + +#define LIBAVCODEC_VERSION_MAJOR 58 +#define LIBAVCODEC_VERSION_MINOR 18 +#define LIBAVCODEC_VERSION_MICRO 100 + +#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ + LIBAVCODEC_VERSION_MINOR, \ + LIBAVCODEC_VERSION_MICRO) +#define LIBAVCODEC_VERSION AV_VERSION(LIBAVCODEC_VERSION_MAJOR, \ + LIBAVCODEC_VERSION_MINOR, \ + LIBAVCODEC_VERSION_MICRO) +#define LIBAVCODEC_BUILD LIBAVCODEC_VERSION_INT + +#define LIBAVCODEC_IDENT "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION) + +/** + * FF_API_* defines may be placed below to indicate public API that will be + * dropped at a future version bump. The defines themselves are not part of + * the public API and may change, break or disappear at any time. + * + * @note, when bumping the major version it is recommended to manually + * disable each FF_API_* in its own commit instead of disabling them all + * at once through the bump. This improves the git bisect-ability of the change. + */ + +#ifndef FF_API_LOWRES +#define FF_API_LOWRES (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_DEBUG_MV +#define FF_API_DEBUG_MV (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_AVCTX_TIMEBASE +#define FF_API_AVCTX_TIMEBASE (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_CODED_FRAME +#define FF_API_CODED_FRAME (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_SIDEDATA_ONLY_PKT +#define FF_API_SIDEDATA_ONLY_PKT (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_VDPAU_PROFILE +#define FF_API_VDPAU_PROFILE (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_CONVERGENCE_DURATION +#define FF_API_CONVERGENCE_DURATION (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_AVPICTURE +#define FF_API_AVPICTURE (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_AVPACKET_OLD_API +#define FF_API_AVPACKET_OLD_API (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_RTP_CALLBACK +#define FF_API_RTP_CALLBACK (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_VBV_DELAY +#define FF_API_VBV_DELAY (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_CODER_TYPE +#define FF_API_CODER_TYPE (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_STAT_BITS +#define FF_API_STAT_BITS (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_PRIVATE_OPT +#define FF_API_PRIVATE_OPT (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_ASS_TIMING +#define FF_API_ASS_TIMING (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_OLD_BSF +#define FF_API_OLD_BSF (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_COPY_CONTEXT +#define FF_API_COPY_CONTEXT (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_GET_CONTEXT_DEFAULTS +#define FF_API_GET_CONTEXT_DEFAULTS (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_NVENC_OLD_NAME +#define FF_API_NVENC_OLD_NAME (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_STRUCT_VAAPI_CONTEXT +#define FF_API_STRUCT_VAAPI_CONTEXT (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_MERGE_SD_API +#define FF_API_MERGE_SD_API (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_TAG_STRING +#define FF_API_TAG_STRING (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_GETCHROMA +#define FF_API_GETCHROMA (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_CODEC_GET_SET +#define FF_API_CODEC_GET_SET (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_USER_VISIBLE_AVHWACCEL +#define FF_API_USER_VISIBLE_AVHWACCEL (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_LOCKMGR +#define FF_API_LOCKMGR (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_NEXT +#define FF_API_NEXT (LIBAVCODEC_VERSION_MAJOR < 59) +#endif + + +#endif /* AVCODEC_VERSION_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavcodec/videotoolbox.h b/MediaClient/MediaClient/ffmpeg/include/libavcodec/videotoolbox.h new file mode 100644 index 0000000..af2db0d --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavcodec/videotoolbox.h @@ -0,0 +1,127 @@ +/* + * Videotoolbox hardware acceleration + * + * copyright (c) 2012 Sebastien Zwickert + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_VIDEOTOOLBOX_H +#define AVCODEC_VIDEOTOOLBOX_H + +/** + * @file + * @ingroup lavc_codec_hwaccel_videotoolbox + * Public libavcodec Videotoolbox header. + */ + +#include + +#define Picture QuickdrawPicture +#include +#undef Picture + +#include "libavcodec/avcodec.h" + +/** + * This struct holds all the information that needs to be passed + * between the caller and libavcodec for initializing Videotoolbox decoding. + * Its size is not a part of the public ABI, it must be allocated with + * av_videotoolbox_alloc_context() and freed with av_free(). + */ +typedef struct AVVideotoolboxContext { + /** + * Videotoolbox decompression session object. + * Created and freed the caller. + */ + VTDecompressionSessionRef session; + + /** + * The output callback that must be passed to the session. + * Set by av_videottoolbox_default_init() + */ + VTDecompressionOutputCallback output_callback; + + /** + * CVPixelBuffer Format Type that Videotoolbox will use for decoded frames. + * set by the caller. If this is set to 0, then no specific format is + * requested from the decoder, and its native format is output. + */ + OSType cv_pix_fmt_type; + + /** + * CoreMedia Format Description that Videotoolbox will use to create the decompression session. + * Set by the caller. + */ + CMVideoFormatDescriptionRef cm_fmt_desc; + + /** + * CoreMedia codec type that Videotoolbox will use to create the decompression session. + * Set by the caller. + */ + int cm_codec_type; +} AVVideotoolboxContext; + +/** + * Allocate and initialize a Videotoolbox context. + * + * This function should be called from the get_format() callback when the caller + * selects the AV_PIX_FMT_VIDETOOLBOX format. The caller must then create + * the decoder object (using the output callback provided by libavcodec) that + * will be used for Videotoolbox-accelerated decoding. + * + * When decoding with Videotoolbox is finished, the caller must destroy the decoder + * object and free the Videotoolbox context using av_free(). + * + * @return the newly allocated context or NULL on failure + */ +AVVideotoolboxContext *av_videotoolbox_alloc_context(void); + +/** + * This is a convenience function that creates and sets up the Videotoolbox context using + * an internal implementation. + * + * @param avctx the corresponding codec context + * + * @return >= 0 on success, a negative AVERROR code on failure + */ +int av_videotoolbox_default_init(AVCodecContext *avctx); + +/** + * This is a convenience function that creates and sets up the Videotoolbox context using + * an internal implementation. + * + * @param avctx the corresponding codec context + * @param vtctx the Videotoolbox context to use + * + * @return >= 0 on success, a negative AVERROR code on failure + */ +int av_videotoolbox_default_init2(AVCodecContext *avctx, AVVideotoolboxContext *vtctx); + +/** + * This function must be called to free the Videotoolbox context initialized with + * av_videotoolbox_default_init(). + * + * @param avctx the corresponding codec context + */ +void av_videotoolbox_default_free(AVCodecContext *avctx); + +/** + * @} + */ + +#endif /* AVCODEC_VIDEOTOOLBOX_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavcodec/vorbis_parser.h b/MediaClient/MediaClient/ffmpeg/include/libavcodec/vorbis_parser.h new file mode 100644 index 0000000..789932a --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavcodec/vorbis_parser.h @@ -0,0 +1,74 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * A public API for Vorbis parsing + * + * Determines the duration for each packet. + */ + +#ifndef AVCODEC_VORBIS_PARSER_H +#define AVCODEC_VORBIS_PARSER_H + +#include + +typedef struct AVVorbisParseContext AVVorbisParseContext; + +/** + * Allocate and initialize the Vorbis parser using headers in the extradata. + */ +AVVorbisParseContext *av_vorbis_parse_init(const uint8_t *extradata, + int extradata_size); + +/** + * Free the parser and everything associated with it. + */ +void av_vorbis_parse_free(AVVorbisParseContext **s); + +#define VORBIS_FLAG_HEADER 0x00000001 +#define VORBIS_FLAG_COMMENT 0x00000002 +#define VORBIS_FLAG_SETUP 0x00000004 + +/** + * Get the duration for a Vorbis packet. + * + * If @p flags is @c NULL, + * special frames are considered invalid. + * + * @param s Vorbis parser context + * @param buf buffer containing a Vorbis frame + * @param buf_size size of the buffer + * @param flags flags for special frames + */ +int av_vorbis_parse_frame_flags(AVVorbisParseContext *s, const uint8_t *buf, + int buf_size, int *flags); + +/** + * Get the duration for a Vorbis packet. + * + * @param s Vorbis parser context + * @param buf buffer containing a Vorbis frame + * @param buf_size size of the buffer + */ +int av_vorbis_parse_frame(AVVorbisParseContext *s, const uint8_t *buf, + int buf_size); + +void av_vorbis_parse_reset(AVVorbisParseContext *s); + +#endif /* AVCODEC_VORBIS_PARSER_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavcodec/xvmc.h b/MediaClient/MediaClient/ffmpeg/include/libavcodec/xvmc.h new file mode 100644 index 0000000..465ee78 --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavcodec/xvmc.h @@ -0,0 +1,170 @@ +/* + * Copyright (C) 2003 Ivan Kalvachev + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_XVMC_H +#define AVCODEC_XVMC_H + +/** + * @file + * @ingroup lavc_codec_hwaccel_xvmc + * Public libavcodec XvMC header. + */ + +#include + +#include "libavutil/attributes.h" +#include "version.h" +#include "avcodec.h" + +/** + * @defgroup lavc_codec_hwaccel_xvmc XvMC + * @ingroup lavc_codec_hwaccel + * + * @{ + */ + +#define AV_XVMC_ID 0x1DC711C0 /**< special value to ensure that regular pixel routines haven't corrupted the struct + the number is 1337 speak for the letters IDCT MCo (motion compensation) */ + +struct attribute_deprecated xvmc_pix_fmt { + /** The field contains the special constant value AV_XVMC_ID. + It is used as a test that the application correctly uses the API, + and that there is no corruption caused by pixel routines. + - application - set during initialization + - libavcodec - unchanged + */ + int xvmc_id; + + /** Pointer to the block array allocated by XvMCCreateBlocks(). + The array has to be freed by XvMCDestroyBlocks(). + Each group of 64 values represents one data block of differential + pixel information (in MoCo mode) or coefficients for IDCT. + - application - set the pointer during initialization + - libavcodec - fills coefficients/pixel data into the array + */ + short* data_blocks; + + /** Pointer to the macroblock description array allocated by + XvMCCreateMacroBlocks() and freed by XvMCDestroyMacroBlocks(). + - application - set the pointer during initialization + - libavcodec - fills description data into the array + */ + XvMCMacroBlock* mv_blocks; + + /** Number of macroblock descriptions that can be stored in the mv_blocks + array. + - application - set during initialization + - libavcodec - unchanged + */ + int allocated_mv_blocks; + + /** Number of blocks that can be stored at once in the data_blocks array. + - application - set during initialization + - libavcodec - unchanged + */ + int allocated_data_blocks; + + /** Indicate that the hardware would interpret data_blocks as IDCT + coefficients and perform IDCT on them. + - application - set during initialization + - libavcodec - unchanged + */ + int idct; + + /** In MoCo mode it indicates that intra macroblocks are assumed to be in + unsigned format; same as the XVMC_INTRA_UNSIGNED flag. + - application - set during initialization + - libavcodec - unchanged + */ + int unsigned_intra; + + /** Pointer to the surface allocated by XvMCCreateSurface(). + It has to be freed by XvMCDestroySurface() on application exit. + It identifies the frame and its state on the video hardware. + - application - set during initialization + - libavcodec - unchanged + */ + XvMCSurface* p_surface; + +/** Set by the decoder before calling ff_draw_horiz_band(), + needed by the XvMCRenderSurface function. */ +//@{ + /** Pointer to the surface used as past reference + - application - unchanged + - libavcodec - set + */ + XvMCSurface* p_past_surface; + + /** Pointer to the surface used as future reference + - application - unchanged + - libavcodec - set + */ + XvMCSurface* p_future_surface; + + /** top/bottom field or frame + - application - unchanged + - libavcodec - set + */ + unsigned int picture_structure; + + /** XVMC_SECOND_FIELD - 1st or 2nd field in the sequence + - application - unchanged + - libavcodec - set + */ + unsigned int flags; +//}@ + + /** Number of macroblock descriptions in the mv_blocks array + that have already been passed to the hardware. + - application - zeroes it on get_buffer(). + A successful ff_draw_horiz_band() may increment it + with filled_mb_block_num or zero both. + - libavcodec - unchanged + */ + int start_mv_blocks_num; + + /** Number of new macroblock descriptions in the mv_blocks array (after + start_mv_blocks_num) that are filled by libavcodec and have to be + passed to the hardware. + - application - zeroes it on get_buffer() or after successful + ff_draw_horiz_band(). + - libavcodec - increment with one of each stored MB + */ + int filled_mv_blocks_num; + + /** Number of the next free data block; one data block consists of + 64 short values in the data_blocks array. + All blocks before this one have already been claimed by placing their + position into the corresponding block description structure field, + that are part of the mv_blocks array. + - application - zeroes it on get_buffer(). + A successful ff_draw_horiz_band() may zero it together + with start_mb_blocks_num. + - libavcodec - each decoded macroblock increases it by the number + of coded blocks it contains. + */ + int next_free_data_block_num; +}; + +/** + * @} + */ + +#endif /* AVCODEC_XVMC_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavdevice/avdevice.h b/MediaClient/MediaClient/ffmpeg/include/libavdevice/avdevice.h new file mode 100644 index 0000000..ee94624 --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavdevice/avdevice.h @@ -0,0 +1,514 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVDEVICE_AVDEVICE_H +#define AVDEVICE_AVDEVICE_H + +#include "version.h" + +/** + * @file + * @ingroup lavd + * Main libavdevice API header + */ + +/** + * @defgroup lavd libavdevice + * Special devices muxing/demuxing library. + * + * Libavdevice is a complementary library to @ref libavf "libavformat". It + * provides various "special" platform-specific muxers and demuxers, e.g. for + * grabbing devices, audio capture and playback etc. As a consequence, the + * (de)muxers in libavdevice are of the AVFMT_NOFILE type (they use their own + * I/O functions). The filename passed to avformat_open_input() often does not + * refer to an actually existing file, but has some special device-specific + * meaning - e.g. for xcbgrab it is the display name. + * + * To use libavdevice, simply call avdevice_register_all() to register all + * compiled muxers and demuxers. They all use standard libavformat API. + * + * @{ + */ + +#include "libavutil/log.h" +#include "libavutil/opt.h" +#include "libavutil/dict.h" +#include "libavformat/avformat.h" + +/** + * Return the LIBAVDEVICE_VERSION_INT constant. + */ +unsigned avdevice_version(void); + +/** + * Return the libavdevice build-time configuration. + */ +const char *avdevice_configuration(void); + +/** + * Return the libavdevice license. + */ +const char *avdevice_license(void); + +/** + * Initialize libavdevice and register all the input and output devices. + */ +void avdevice_register_all(void); + +/** + * Audio input devices iterator. + * + * If d is NULL, returns the first registered input audio/video device, + * if d is non-NULL, returns the next registered input audio/video device after d + * or NULL if d is the last one. + */ +AVInputFormat *av_input_audio_device_next(AVInputFormat *d); + +/** + * Video input devices iterator. + * + * If d is NULL, returns the first registered input audio/video device, + * if d is non-NULL, returns the next registered input audio/video device after d + * or NULL if d is the last one. + */ +AVInputFormat *av_input_video_device_next(AVInputFormat *d); + +/** + * Audio output devices iterator. + * + * If d is NULL, returns the first registered output audio/video device, + * if d is non-NULL, returns the next registered output audio/video device after d + * or NULL if d is the last one. + */ +AVOutputFormat *av_output_audio_device_next(AVOutputFormat *d); + +/** + * Video output devices iterator. + * + * If d is NULL, returns the first registered output audio/video device, + * if d is non-NULL, returns the next registered output audio/video device after d + * or NULL if d is the last one. + */ +AVOutputFormat *av_output_video_device_next(AVOutputFormat *d); + +typedef struct AVDeviceRect { + int x; /**< x coordinate of top left corner */ + int y; /**< y coordinate of top left corner */ + int width; /**< width */ + int height; /**< height */ +} AVDeviceRect; + +/** + * Message types used by avdevice_app_to_dev_control_message(). + */ +enum AVAppToDevMessageType { + /** + * Dummy message. + */ + AV_APP_TO_DEV_NONE = MKBETAG('N','O','N','E'), + + /** + * Window size change message. + * + * Message is sent to the device every time the application changes the size + * of the window device renders to. + * Message should also be sent right after window is created. + * + * data: AVDeviceRect: new window size. + */ + AV_APP_TO_DEV_WINDOW_SIZE = MKBETAG('G','E','O','M'), + + /** + * Repaint request message. + * + * Message is sent to the device when window has to be repainted. + * + * data: AVDeviceRect: area required to be repainted. + * NULL: whole area is required to be repainted. + */ + AV_APP_TO_DEV_WINDOW_REPAINT = MKBETAG('R','E','P','A'), + + /** + * Request pause/play. + * + * Application requests pause/unpause playback. + * Mostly usable with devices that have internal buffer. + * By default devices are not paused. + * + * data: NULL + */ + AV_APP_TO_DEV_PAUSE = MKBETAG('P', 'A', 'U', ' '), + AV_APP_TO_DEV_PLAY = MKBETAG('P', 'L', 'A', 'Y'), + AV_APP_TO_DEV_TOGGLE_PAUSE = MKBETAG('P', 'A', 'U', 'T'), + + /** + * Volume control message. + * + * Set volume level. It may be device-dependent if volume + * is changed per stream or system wide. Per stream volume + * change is expected when possible. + * + * data: double: new volume with range of 0.0 - 1.0. + */ + AV_APP_TO_DEV_SET_VOLUME = MKBETAG('S', 'V', 'O', 'L'), + + /** + * Mute control messages. + * + * Change mute state. It may be device-dependent if mute status + * is changed per stream or system wide. Per stream mute status + * change is expected when possible. + * + * data: NULL. + */ + AV_APP_TO_DEV_MUTE = MKBETAG(' ', 'M', 'U', 'T'), + AV_APP_TO_DEV_UNMUTE = MKBETAG('U', 'M', 'U', 'T'), + AV_APP_TO_DEV_TOGGLE_MUTE = MKBETAG('T', 'M', 'U', 'T'), + + /** + * Get volume/mute messages. + * + * Force the device to send AV_DEV_TO_APP_VOLUME_LEVEL_CHANGED or + * AV_DEV_TO_APP_MUTE_STATE_CHANGED command respectively. + * + * data: NULL. + */ + AV_APP_TO_DEV_GET_VOLUME = MKBETAG('G', 'V', 'O', 'L'), + AV_APP_TO_DEV_GET_MUTE = MKBETAG('G', 'M', 'U', 'T'), +}; + +/** + * Message types used by avdevice_dev_to_app_control_message(). + */ +enum AVDevToAppMessageType { + /** + * Dummy message. + */ + AV_DEV_TO_APP_NONE = MKBETAG('N','O','N','E'), + + /** + * Create window buffer message. + * + * Device requests to create a window buffer. Exact meaning is device- + * and application-dependent. Message is sent before rendering first + * frame and all one-shot initializations should be done here. + * Application is allowed to ignore preferred window buffer size. + * + * @note: Application is obligated to inform about window buffer size + * with AV_APP_TO_DEV_WINDOW_SIZE message. + * + * data: AVDeviceRect: preferred size of the window buffer. + * NULL: no preferred size of the window buffer. + */ + AV_DEV_TO_APP_CREATE_WINDOW_BUFFER = MKBETAG('B','C','R','E'), + + /** + * Prepare window buffer message. + * + * Device requests to prepare a window buffer for rendering. + * Exact meaning is device- and application-dependent. + * Message is sent before rendering of each frame. + * + * data: NULL. + */ + AV_DEV_TO_APP_PREPARE_WINDOW_BUFFER = MKBETAG('B','P','R','E'), + + /** + * Display window buffer message. + * + * Device requests to display a window buffer. + * Message is sent when new frame is ready to be displayed. + * Usually buffers need to be swapped in handler of this message. + * + * data: NULL. + */ + AV_DEV_TO_APP_DISPLAY_WINDOW_BUFFER = MKBETAG('B','D','I','S'), + + /** + * Destroy window buffer message. + * + * Device requests to destroy a window buffer. + * Message is sent when device is about to be destroyed and window + * buffer is not required anymore. + * + * data: NULL. + */ + AV_DEV_TO_APP_DESTROY_WINDOW_BUFFER = MKBETAG('B','D','E','S'), + + /** + * Buffer fullness status messages. + * + * Device signals buffer overflow/underflow. + * + * data: NULL. + */ + AV_DEV_TO_APP_BUFFER_OVERFLOW = MKBETAG('B','O','F','L'), + AV_DEV_TO_APP_BUFFER_UNDERFLOW = MKBETAG('B','U','F','L'), + + /** + * Buffer readable/writable. + * + * Device informs that buffer is readable/writable. + * When possible, device informs how many bytes can be read/write. + * + * @warning Device may not inform when number of bytes than can be read/write changes. + * + * data: int64_t: amount of bytes available to read/write. + * NULL: amount of bytes available to read/write is not known. + */ + AV_DEV_TO_APP_BUFFER_READABLE = MKBETAG('B','R','D',' '), + AV_DEV_TO_APP_BUFFER_WRITABLE = MKBETAG('B','W','R',' '), + + /** + * Mute state change message. + * + * Device informs that mute state has changed. + * + * data: int: 0 for not muted state, non-zero for muted state. + */ + AV_DEV_TO_APP_MUTE_STATE_CHANGED = MKBETAG('C','M','U','T'), + + /** + * Volume level change message. + * + * Device informs that volume level has changed. + * + * data: double: new volume with range of 0.0 - 1.0. + */ + AV_DEV_TO_APP_VOLUME_LEVEL_CHANGED = MKBETAG('C','V','O','L'), +}; + +/** + * Send control message from application to device. + * + * @param s device context. + * @param type message type. + * @param data message data. Exact type depends on message type. + * @param data_size size of message data. + * @return >= 0 on success, negative on error. + * AVERROR(ENOSYS) when device doesn't implement handler of the message. + */ +int avdevice_app_to_dev_control_message(struct AVFormatContext *s, + enum AVAppToDevMessageType type, + void *data, size_t data_size); + +/** + * Send control message from device to application. + * + * @param s device context. + * @param type message type. + * @param data message data. Can be NULL. + * @param data_size size of message data. + * @return >= 0 on success, negative on error. + * AVERROR(ENOSYS) when application doesn't implement handler of the message. + */ +int avdevice_dev_to_app_control_message(struct AVFormatContext *s, + enum AVDevToAppMessageType type, + void *data, size_t data_size); + +/** + * Following API allows user to probe device capabilities (supported codecs, + * pixel formats, sample formats, resolutions, channel counts, etc). + * It is build on top op AVOption API. + * Queried capabilities make it possible to set up converters of video or audio + * parameters that fit to the device. + * + * List of capabilities that can be queried: + * - Capabilities valid for both audio and video devices: + * - codec: supported audio/video codecs. + * type: AV_OPT_TYPE_INT (AVCodecID value) + * - Capabilities valid for audio devices: + * - sample_format: supported sample formats. + * type: AV_OPT_TYPE_INT (AVSampleFormat value) + * - sample_rate: supported sample rates. + * type: AV_OPT_TYPE_INT + * - channels: supported number of channels. + * type: AV_OPT_TYPE_INT + * - channel_layout: supported channel layouts. + * type: AV_OPT_TYPE_INT64 + * - Capabilities valid for video devices: + * - pixel_format: supported pixel formats. + * type: AV_OPT_TYPE_INT (AVPixelFormat value) + * - window_size: supported window sizes (describes size of the window size presented to the user). + * type: AV_OPT_TYPE_IMAGE_SIZE + * - frame_size: supported frame sizes (describes size of provided video frames). + * type: AV_OPT_TYPE_IMAGE_SIZE + * - fps: supported fps values + * type: AV_OPT_TYPE_RATIONAL + * + * Value of the capability may be set by user using av_opt_set() function + * and AVDeviceCapabilitiesQuery object. Following queries will + * limit results to the values matching already set capabilities. + * For example, setting a codec may impact number of formats or fps values + * returned during next query. Setting invalid value may limit results to zero. + * + * Example of the usage basing on opengl output device: + * + * @code + * AVFormatContext *oc = NULL; + * AVDeviceCapabilitiesQuery *caps = NULL; + * AVOptionRanges *ranges; + * int ret; + * + * if ((ret = avformat_alloc_output_context2(&oc, NULL, "opengl", NULL)) < 0) + * goto fail; + * if (avdevice_capabilities_create(&caps, oc, NULL) < 0) + * goto fail; + * + * //query codecs + * if (av_opt_query_ranges(&ranges, caps, "codec", AV_OPT_MULTI_COMPONENT_RANGE)) < 0) + * goto fail; + * //pick codec here and set it + * av_opt_set(caps, "codec", AV_CODEC_ID_RAWVIDEO, 0); + * + * //query format + * if (av_opt_query_ranges(&ranges, caps, "pixel_format", AV_OPT_MULTI_COMPONENT_RANGE)) < 0) + * goto fail; + * //pick format here and set it + * av_opt_set(caps, "pixel_format", AV_PIX_FMT_YUV420P, 0); + * + * //query and set more capabilities + * + * fail: + * //clean up code + * avdevice_capabilities_free(&query, oc); + * avformat_free_context(oc); + * @endcode + */ + +/** + * Structure describes device capabilities. + * + * It is used by devices in conjunction with av_device_capabilities AVOption table + * to implement capabilities probing API based on AVOption API. Should not be used directly. + */ +typedef struct AVDeviceCapabilitiesQuery { + const AVClass *av_class; + AVFormatContext *device_context; + enum AVCodecID codec; + enum AVSampleFormat sample_format; + enum AVPixelFormat pixel_format; + int sample_rate; + int channels; + int64_t channel_layout; + int window_width; + int window_height; + int frame_width; + int frame_height; + AVRational fps; +} AVDeviceCapabilitiesQuery; + +/** + * AVOption table used by devices to implement device capabilities API. Should not be used by a user. + */ +extern const AVOption av_device_capabilities[]; + +/** + * Initialize capabilities probing API based on AVOption API. + * + * avdevice_capabilities_free() must be called when query capabilities API is + * not used anymore. + * + * @param[out] caps Device capabilities data. Pointer to a NULL pointer must be passed. + * @param s Context of the device. + * @param device_options An AVDictionary filled with device-private options. + * On return this parameter will be destroyed and replaced with a dict + * containing options that were not found. May be NULL. + * The same options must be passed later to avformat_write_header() for output + * devices or avformat_open_input() for input devices, or at any other place + * that affects device-private options. + * + * @return >= 0 on success, negative otherwise. + */ +int avdevice_capabilities_create(AVDeviceCapabilitiesQuery **caps, AVFormatContext *s, + AVDictionary **device_options); + +/** + * Free resources created by avdevice_capabilities_create() + * + * @param caps Device capabilities data to be freed. + * @param s Context of the device. + */ +void avdevice_capabilities_free(AVDeviceCapabilitiesQuery **caps, AVFormatContext *s); + +/** + * Structure describes basic parameters of the device. + */ +typedef struct AVDeviceInfo { + char *device_name; /**< device name, format depends on device */ + char *device_description; /**< human friendly name */ +} AVDeviceInfo; + +/** + * List of devices. + */ +typedef struct AVDeviceInfoList { + AVDeviceInfo **devices; /**< list of autodetected devices */ + int nb_devices; /**< number of autodetected devices */ + int default_device; /**< index of default device or -1 if no default */ +} AVDeviceInfoList; + +/** + * List devices. + * + * Returns available device names and their parameters. + * + * @note: Some devices may accept system-dependent device names that cannot be + * autodetected. The list returned by this function cannot be assumed to + * be always completed. + * + * @param s device context. + * @param[out] device_list list of autodetected devices. + * @return count of autodetected devices, negative on error. + */ +int avdevice_list_devices(struct AVFormatContext *s, AVDeviceInfoList **device_list); + +/** + * Convenient function to free result of avdevice_list_devices(). + * + * @param devices device list to be freed. + */ +void avdevice_free_list_devices(AVDeviceInfoList **device_list); + +/** + * List devices. + * + * Returns available device names and their parameters. + * These are convinient wrappers for avdevice_list_devices(). + * Device context is allocated and deallocated internally. + * + * @param device device format. May be NULL if device name is set. + * @param device_name device name. May be NULL if device format is set. + * @param device_options An AVDictionary filled with device-private options. May be NULL. + * The same options must be passed later to avformat_write_header() for output + * devices or avformat_open_input() for input devices, or at any other place + * that affects device-private options. + * @param[out] device_list list of autodetected devices + * @return count of autodetected devices, negative on error. + * @note device argument takes precedence over device_name when both are set. + */ +int avdevice_list_input_sources(struct AVInputFormat *device, const char *device_name, + AVDictionary *device_options, AVDeviceInfoList **device_list); +int avdevice_list_output_sinks(struct AVOutputFormat *device, const char *device_name, + AVDictionary *device_options, AVDeviceInfoList **device_list); + +/** + * @} + */ + +#endif /* AVDEVICE_AVDEVICE_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavdevice/version.h b/MediaClient/MediaClient/ffmpeg/include/libavdevice/version.h new file mode 100644 index 0000000..dbfbfd0 --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavdevice/version.h @@ -0,0 +1,50 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVDEVICE_VERSION_H +#define AVDEVICE_VERSION_H + +/** + * @file + * @ingroup lavd + * Libavdevice version macros + */ + +#include "libavutil/version.h" + +#define LIBAVDEVICE_VERSION_MAJOR 58 +#define LIBAVDEVICE_VERSION_MINOR 3 +#define LIBAVDEVICE_VERSION_MICRO 100 + +#define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_MAJOR, \ + LIBAVDEVICE_VERSION_MINOR, \ + LIBAVDEVICE_VERSION_MICRO) +#define LIBAVDEVICE_VERSION AV_VERSION(LIBAVDEVICE_VERSION_MAJOR, \ + LIBAVDEVICE_VERSION_MINOR, \ + LIBAVDEVICE_VERSION_MICRO) +#define LIBAVDEVICE_BUILD LIBAVDEVICE_VERSION_INT + +#define LIBAVDEVICE_IDENT "Lavd" AV_STRINGIFY(LIBAVDEVICE_VERSION) + +/** + * FF_API_* defines may be placed below to indicate public API that will be + * dropped at a future version bump. The defines themselves are not part of + * the public API and may change, break or disappear at any time. + */ + +#endif /* AVDEVICE_VERSION_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavfilter/avfilter.h b/MediaClient/MediaClient/ffmpeg/include/libavfilter/avfilter.h new file mode 100644 index 0000000..9d70e71 --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavfilter/avfilter.h @@ -0,0 +1,1168 @@ +/* + * filter layer + * Copyright (c) 2007 Bobby Bingham + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVFILTER_AVFILTER_H +#define AVFILTER_AVFILTER_H + +/** + * @file + * @ingroup lavfi + * Main libavfilter public API header + */ + +/** + * @defgroup lavfi libavfilter + * Graph-based frame editing library. + * + * @{ + */ + +#include + +#include "libavutil/attributes.h" +#include "libavutil/avutil.h" +#include "libavutil/buffer.h" +#include "libavutil/dict.h" +#include "libavutil/frame.h" +#include "libavutil/log.h" +#include "libavutil/samplefmt.h" +#include "libavutil/pixfmt.h" +#include "libavutil/rational.h" + +#include "libavfilter/version.h" + +/** + * Return the LIBAVFILTER_VERSION_INT constant. + */ +unsigned avfilter_version(void); + +/** + * Return the libavfilter build-time configuration. + */ +const char *avfilter_configuration(void); + +/** + * Return the libavfilter license. + */ +const char *avfilter_license(void); + +typedef struct AVFilterContext AVFilterContext; +typedef struct AVFilterLink AVFilterLink; +typedef struct AVFilterPad AVFilterPad; +typedef struct AVFilterFormats AVFilterFormats; + +/** + * Get the number of elements in a NULL-terminated array of AVFilterPads (e.g. + * AVFilter.inputs/outputs). + */ +int avfilter_pad_count(const AVFilterPad *pads); + +/** + * Get the name of an AVFilterPad. + * + * @param pads an array of AVFilterPads + * @param pad_idx index of the pad in the array it; is the caller's + * responsibility to ensure the index is valid + * + * @return name of the pad_idx'th pad in pads + */ +const char *avfilter_pad_get_name(const AVFilterPad *pads, int pad_idx); + +/** + * Get the type of an AVFilterPad. + * + * @param pads an array of AVFilterPads + * @param pad_idx index of the pad in the array; it is the caller's + * responsibility to ensure the index is valid + * + * @return type of the pad_idx'th pad in pads + */ +enum AVMediaType avfilter_pad_get_type(const AVFilterPad *pads, int pad_idx); + +/** + * The number of the filter inputs is not determined just by AVFilter.inputs. + * The filter might add additional inputs during initialization depending on the + * options supplied to it. + */ +#define AVFILTER_FLAG_DYNAMIC_INPUTS (1 << 0) +/** + * The number of the filter outputs is not determined just by AVFilter.outputs. + * The filter might add additional outputs during initialization depending on + * the options supplied to it. + */ +#define AVFILTER_FLAG_DYNAMIC_OUTPUTS (1 << 1) +/** + * The filter supports multithreading by splitting frames into multiple parts + * and processing them concurrently. + */ +#define AVFILTER_FLAG_SLICE_THREADS (1 << 2) +/** + * Some filters support a generic "enable" expression option that can be used + * to enable or disable a filter in the timeline. Filters supporting this + * option have this flag set. When the enable expression is false, the default + * no-op filter_frame() function is called in place of the filter_frame() + * callback defined on each input pad, thus the frame is passed unchanged to + * the next filters. + */ +#define AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC (1 << 16) +/** + * Same as AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, except that the filter will + * have its filter_frame() callback(s) called as usual even when the enable + * expression is false. The filter will disable filtering within the + * filter_frame() callback(s) itself, for example executing code depending on + * the AVFilterContext->is_disabled value. + */ +#define AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL (1 << 17) +/** + * Handy mask to test whether the filter supports or no the timeline feature + * (internally or generically). + */ +#define AVFILTER_FLAG_SUPPORT_TIMELINE (AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL) + +/** + * Filter definition. This defines the pads a filter contains, and all the + * callback functions used to interact with the filter. + */ +typedef struct AVFilter { + /** + * Filter name. Must be non-NULL and unique among filters. + */ + const char *name; + + /** + * A description of the filter. May be NULL. + * + * You should use the NULL_IF_CONFIG_SMALL() macro to define it. + */ + const char *description; + + /** + * List of inputs, terminated by a zeroed element. + * + * NULL if there are no (static) inputs. Instances of filters with + * AVFILTER_FLAG_DYNAMIC_INPUTS set may have more inputs than present in + * this list. + */ + const AVFilterPad *inputs; + /** + * List of outputs, terminated by a zeroed element. + * + * NULL if there are no (static) outputs. Instances of filters with + * AVFILTER_FLAG_DYNAMIC_OUTPUTS set may have more outputs than present in + * this list. + */ + const AVFilterPad *outputs; + + /** + * A class for the private data, used to declare filter private AVOptions. + * This field is NULL for filters that do not declare any options. + * + * If this field is non-NULL, the first member of the filter private data + * must be a pointer to AVClass, which will be set by libavfilter generic + * code to this class. + */ + const AVClass *priv_class; + + /** + * A combination of AVFILTER_FLAG_* + */ + int flags; + + /***************************************************************** + * All fields below this line are not part of the public API. They + * may not be used outside of libavfilter and can be changed and + * removed at will. + * New public fields should be added right above. + ***************************************************************** + */ + + /** + * Filter pre-initialization function + * + * This callback will be called immediately after the filter context is + * allocated, to allow allocating and initing sub-objects. + * + * If this callback is not NULL, the uninit callback will be called on + * allocation failure. + * + * @return 0 on success, + * AVERROR code on failure (but the code will be + * dropped and treated as ENOMEM by the calling code) + */ + int (*preinit)(AVFilterContext *ctx); + + /** + * Filter initialization function. + * + * This callback will be called only once during the filter lifetime, after + * all the options have been set, but before links between filters are + * established and format negotiation is done. + * + * Basic filter initialization should be done here. Filters with dynamic + * inputs and/or outputs should create those inputs/outputs here based on + * provided options. No more changes to this filter's inputs/outputs can be + * done after this callback. + * + * This callback must not assume that the filter links exist or frame + * parameters are known. + * + * @ref AVFilter.uninit "uninit" is guaranteed to be called even if + * initialization fails, so this callback does not have to clean up on + * failure. + * + * @return 0 on success, a negative AVERROR on failure + */ + int (*init)(AVFilterContext *ctx); + + /** + * Should be set instead of @ref AVFilter.init "init" by the filters that + * want to pass a dictionary of AVOptions to nested contexts that are + * allocated during init. + * + * On return, the options dict should be freed and replaced with one that + * contains all the options which could not be processed by this filter (or + * with NULL if all the options were processed). + * + * Otherwise the semantics is the same as for @ref AVFilter.init "init". + */ + int (*init_dict)(AVFilterContext *ctx, AVDictionary **options); + + /** + * Filter uninitialization function. + * + * Called only once right before the filter is freed. Should deallocate any + * memory held by the filter, release any buffer references, etc. It does + * not need to deallocate the AVFilterContext.priv memory itself. + * + * This callback may be called even if @ref AVFilter.init "init" was not + * called or failed, so it must be prepared to handle such a situation. + */ + void (*uninit)(AVFilterContext *ctx); + + /** + * Query formats supported by the filter on its inputs and outputs. + * + * This callback is called after the filter is initialized (so the inputs + * and outputs are fixed), shortly before the format negotiation. This + * callback may be called more than once. + * + * This callback must set AVFilterLink.out_formats on every input link and + * AVFilterLink.in_formats on every output link to a list of pixel/sample + * formats that the filter supports on that link. For audio links, this + * filter must also set @ref AVFilterLink.in_samplerates "in_samplerates" / + * @ref AVFilterLink.out_samplerates "out_samplerates" and + * @ref AVFilterLink.in_channel_layouts "in_channel_layouts" / + * @ref AVFilterLink.out_channel_layouts "out_channel_layouts" analogously. + * + * This callback may be NULL for filters with one input, in which case + * libavfilter assumes that it supports all input formats and preserves + * them on output. + * + * @return zero on success, a negative value corresponding to an + * AVERROR code otherwise + */ + int (*query_formats)(AVFilterContext *); + + int priv_size; ///< size of private data to allocate for the filter + + int flags_internal; ///< Additional flags for avfilter internal use only. + + /** + * Used by the filter registration system. Must not be touched by any other + * code. + */ + struct AVFilter *next; + + /** + * Make the filter instance process a command. + * + * @param cmd the command to process, for handling simplicity all commands must be alphanumeric only + * @param arg the argument for the command + * @param res a buffer with size res_size where the filter(s) can return a response. This must not change when the command is not supported. + * @param flags if AVFILTER_CMD_FLAG_FAST is set and the command would be + * time consuming then a filter should treat it like an unsupported command + * + * @returns >=0 on success otherwise an error code. + * AVERROR(ENOSYS) on unsupported commands + */ + int (*process_command)(AVFilterContext *, const char *cmd, const char *arg, char *res, int res_len, int flags); + + /** + * Filter initialization function, alternative to the init() + * callback. Args contains the user-supplied parameters, opaque is + * used for providing binary data. + */ + int (*init_opaque)(AVFilterContext *ctx, void *opaque); + + /** + * Filter activation function. + * + * Called when any processing is needed from the filter, instead of any + * filter_frame and request_frame on pads. + * + * The function must examine inlinks and outlinks and perform a single + * step of processing. If there is nothing to do, the function must do + * nothing and not return an error. If more steps are or may be + * possible, it must use ff_filter_set_ready() to schedule another + * activation. + */ + int (*activate)(AVFilterContext *ctx); +} AVFilter; + +/** + * Process multiple parts of the frame concurrently. + */ +#define AVFILTER_THREAD_SLICE (1 << 0) + +typedef struct AVFilterInternal AVFilterInternal; + +/** An instance of a filter */ +struct AVFilterContext { + const AVClass *av_class; ///< needed for av_log() and filters common options + + const AVFilter *filter; ///< the AVFilter of which this is an instance + + char *name; ///< name of this filter instance + + AVFilterPad *input_pads; ///< array of input pads + AVFilterLink **inputs; ///< array of pointers to input links + unsigned nb_inputs; ///< number of input pads + + AVFilterPad *output_pads; ///< array of output pads + AVFilterLink **outputs; ///< array of pointers to output links + unsigned nb_outputs; ///< number of output pads + + void *priv; ///< private data for use by the filter + + struct AVFilterGraph *graph; ///< filtergraph this filter belongs to + + /** + * Type of multithreading being allowed/used. A combination of + * AVFILTER_THREAD_* flags. + * + * May be set by the caller before initializing the filter to forbid some + * or all kinds of multithreading for this filter. The default is allowing + * everything. + * + * When the filter is initialized, this field is combined using bit AND with + * AVFilterGraph.thread_type to get the final mask used for determining + * allowed threading types. I.e. a threading type needs to be set in both + * to be allowed. + * + * After the filter is initialized, libavfilter sets this field to the + * threading type that is actually used (0 for no multithreading). + */ + int thread_type; + + /** + * An opaque struct for libavfilter internal use. + */ + AVFilterInternal *internal; + + struct AVFilterCommand *command_queue; + + char *enable_str; ///< enable expression string + void *enable; ///< parsed expression (AVExpr*) + double *var_values; ///< variable values for the enable expression + int is_disabled; ///< the enabled state from the last expression evaluation + + /** + * For filters which will create hardware frames, sets the device the + * filter should create them in. All other filters will ignore this field: + * in particular, a filter which consumes or processes hardware frames will + * instead use the hw_frames_ctx field in AVFilterLink to carry the + * hardware context information. + */ + AVBufferRef *hw_device_ctx; + + /** + * Max number of threads allowed in this filter instance. + * If <= 0, its value is ignored. + * Overrides global number of threads set per filter graph. + */ + int nb_threads; + + /** + * Ready status of the filter. + * A non-0 value means that the filter needs activating; + * a higher value suggests a more urgent activation. + */ + unsigned ready; + + /** + * Sets the number of extra hardware frames which the filter will + * allocate on its output links for use in following filters or by + * the caller. + * + * Some hardware filters require all frames that they will use for + * output to be defined in advance before filtering starts. For such + * filters, any hardware frame pools used for output must therefore be + * of fixed size. The extra frames set here are on top of any number + * that the filter needs internally in order to operate normally. + * + * This field must be set before the graph containing this filter is + * configured. + */ + int extra_hw_frames; +}; + +/** + * A link between two filters. This contains pointers to the source and + * destination filters between which this link exists, and the indexes of + * the pads involved. In addition, this link also contains the parameters + * which have been negotiated and agreed upon between the filter, such as + * image dimensions, format, etc. + * + * Applications must not normally access the link structure directly. + * Use the buffersrc and buffersink API instead. + * In the future, access to the header may be reserved for filters + * implementation. + */ +struct AVFilterLink { + AVFilterContext *src; ///< source filter + AVFilterPad *srcpad; ///< output pad on the source filter + + AVFilterContext *dst; ///< dest filter + AVFilterPad *dstpad; ///< input pad on the dest filter + + enum AVMediaType type; ///< filter media type + + /* These parameters apply only to video */ + int w; ///< agreed upon image width + int h; ///< agreed upon image height + AVRational sample_aspect_ratio; ///< agreed upon sample aspect ratio + /* These parameters apply only to audio */ + uint64_t channel_layout; ///< channel layout of current buffer (see libavutil/channel_layout.h) + int sample_rate; ///< samples per second + + int format; ///< agreed upon media format + + /** + * Define the time base used by the PTS of the frames/samples + * which will pass through this link. + * During the configuration stage, each filter is supposed to + * change only the output timebase, while the timebase of the + * input link is assumed to be an unchangeable property. + */ + AVRational time_base; + + /***************************************************************** + * All fields below this line are not part of the public API. They + * may not be used outside of libavfilter and can be changed and + * removed at will. + * New public fields should be added right above. + ***************************************************************** + */ + /** + * Lists of formats and channel layouts supported by the input and output + * filters respectively. These lists are used for negotiating the format + * to actually be used, which will be loaded into the format and + * channel_layout members, above, when chosen. + * + */ + AVFilterFormats *in_formats; + AVFilterFormats *out_formats; + + /** + * Lists of channel layouts and sample rates used for automatic + * negotiation. + */ + AVFilterFormats *in_samplerates; + AVFilterFormats *out_samplerates; + struct AVFilterChannelLayouts *in_channel_layouts; + struct AVFilterChannelLayouts *out_channel_layouts; + + /** + * Audio only, the destination filter sets this to a non-zero value to + * request that buffers with the given number of samples should be sent to + * it. AVFilterPad.needs_fifo must also be set on the corresponding input + * pad. + * Last buffer before EOF will be padded with silence. + */ + int request_samples; + + /** stage of the initialization of the link properties (dimensions, etc) */ + enum { + AVLINK_UNINIT = 0, ///< not started + AVLINK_STARTINIT, ///< started, but incomplete + AVLINK_INIT ///< complete + } init_state; + + /** + * Graph the filter belongs to. + */ + struct AVFilterGraph *graph; + + /** + * Current timestamp of the link, as defined by the most recent + * frame(s), in link time_base units. + */ + int64_t current_pts; + + /** + * Current timestamp of the link, as defined by the most recent + * frame(s), in AV_TIME_BASE units. + */ + int64_t current_pts_us; + + /** + * Index in the age array. + */ + int age_index; + + /** + * Frame rate of the stream on the link, or 1/0 if unknown or variable; + * if left to 0/0, will be automatically copied from the first input + * of the source filter if it exists. + * + * Sources should set it to the best estimation of the real frame rate. + * If the source frame rate is unknown or variable, set this to 1/0. + * Filters should update it if necessary depending on their function. + * Sinks can use it to set a default output frame rate. + * It is similar to the r_frame_rate field in AVStream. + */ + AVRational frame_rate; + + /** + * Buffer partially filled with samples to achieve a fixed/minimum size. + */ + AVFrame *partial_buf; + + /** + * Size of the partial buffer to allocate. + * Must be between min_samples and max_samples. + */ + int partial_buf_size; + + /** + * Minimum number of samples to filter at once. If filter_frame() is + * called with fewer samples, it will accumulate them in partial_buf. + * This field and the related ones must not be changed after filtering + * has started. + * If 0, all related fields are ignored. + */ + int min_samples; + + /** + * Maximum number of samples to filter at once. If filter_frame() is + * called with more samples, it will split them. + */ + int max_samples; + + /** + * Number of channels. + */ + int channels; + + /** + * Link processing flags. + */ + unsigned flags; + + /** + * Number of past frames sent through the link. + */ + int64_t frame_count_in, frame_count_out; + + /** + * A pointer to a FFFramePool struct. + */ + void *frame_pool; + + /** + * True if a frame is currently wanted on the output of this filter. + * Set when ff_request_frame() is called by the output, + * cleared when a frame is filtered. + */ + int frame_wanted_out; + + /** + * For hwaccel pixel formats, this should be a reference to the + * AVHWFramesContext describing the frames. + */ + AVBufferRef *hw_frames_ctx; + +#ifndef FF_INTERNAL_FIELDS + + /** + * Internal structure members. + * The fields below this limit are internal for libavfilter's use + * and must in no way be accessed by applications. + */ + char reserved[0xF000]; + +#else /* FF_INTERNAL_FIELDS */ + + /** + * Queue of frames waiting to be filtered. + */ + FFFrameQueue fifo; + + /** + * If set, the source filter can not generate a frame as is. + * The goal is to avoid repeatedly calling the request_frame() method on + * the same link. + */ + int frame_blocked_in; + + /** + * Link input status. + * If not zero, all attempts of filter_frame will fail with the + * corresponding code. + */ + int status_in; + + /** + * Timestamp of the input status change. + */ + int64_t status_in_pts; + + /** + * Link output status. + * If not zero, all attempts of request_frame will fail with the + * corresponding code. + */ + int status_out; + +#endif /* FF_INTERNAL_FIELDS */ + +}; + +/** + * Link two filters together. + * + * @param src the source filter + * @param srcpad index of the output pad on the source filter + * @param dst the destination filter + * @param dstpad index of the input pad on the destination filter + * @return zero on success + */ +int avfilter_link(AVFilterContext *src, unsigned srcpad, + AVFilterContext *dst, unsigned dstpad); + +/** + * Free the link in *link, and set its pointer to NULL. + */ +void avfilter_link_free(AVFilterLink **link); + +#if FF_API_FILTER_GET_SET +/** + * Get the number of channels of a link. + * @deprecated Use av_buffersink_get_channels() + */ +attribute_deprecated +int avfilter_link_get_channels(AVFilterLink *link); +#endif + +/** + * Set the closed field of a link. + * @deprecated applications are not supposed to mess with links, they should + * close the sinks. + */ +attribute_deprecated +void avfilter_link_set_closed(AVFilterLink *link, int closed); + +/** + * Negotiate the media format, dimensions, etc of all inputs to a filter. + * + * @param filter the filter to negotiate the properties for its inputs + * @return zero on successful negotiation + */ +int avfilter_config_links(AVFilterContext *filter); + +#define AVFILTER_CMD_FLAG_ONE 1 ///< Stop once a filter understood the command (for target=all for example), fast filters are favored automatically +#define AVFILTER_CMD_FLAG_FAST 2 ///< Only execute command when its fast (like a video out that supports contrast adjustment in hw) + +/** + * Make the filter instance process a command. + * It is recommended to use avfilter_graph_send_command(). + */ +int avfilter_process_command(AVFilterContext *filter, const char *cmd, const char *arg, char *res, int res_len, int flags); + +/** + * Iterate over all registered filters. + * + * @param opaque a pointer where libavfilter will store the iteration state. Must + * point to NULL to start the iteration. + * + * @return the next registered filter or NULL when the iteration is + * finished + */ +const AVFilter *av_filter_iterate(void **opaque); + +#if FF_API_NEXT +/** Initialize the filter system. Register all builtin filters. */ +attribute_deprecated +void avfilter_register_all(void); + +/** + * Register a filter. This is only needed if you plan to use + * avfilter_get_by_name later to lookup the AVFilter structure by name. A + * filter can still by instantiated with avfilter_graph_alloc_filter even if it + * is not registered. + * + * @param filter the filter to register + * @return 0 if the registration was successful, a negative value + * otherwise + */ +attribute_deprecated +int avfilter_register(AVFilter *filter); + +/** + * Iterate over all registered filters. + * @return If prev is non-NULL, next registered filter after prev or NULL if + * prev is the last filter. If prev is NULL, return the first registered filter. + */ +attribute_deprecated +const AVFilter *avfilter_next(const AVFilter *prev); +#endif + +/** + * Get a filter definition matching the given name. + * + * @param name the filter name to find + * @return the filter definition, if any matching one is registered. + * NULL if none found. + */ +const AVFilter *avfilter_get_by_name(const char *name); + + +/** + * Initialize a filter with the supplied parameters. + * + * @param ctx uninitialized filter context to initialize + * @param args Options to initialize the filter with. This must be a + * ':'-separated list of options in the 'key=value' form. + * May be NULL if the options have been set directly using the + * AVOptions API or there are no options that need to be set. + * @return 0 on success, a negative AVERROR on failure + */ +int avfilter_init_str(AVFilterContext *ctx, const char *args); + +/** + * Initialize a filter with the supplied dictionary of options. + * + * @param ctx uninitialized filter context to initialize + * @param options An AVDictionary filled with options for this filter. On + * return this parameter will be destroyed and replaced with + * a dict containing options that were not found. This dictionary + * must be freed by the caller. + * May be NULL, then this function is equivalent to + * avfilter_init_str() with the second parameter set to NULL. + * @return 0 on success, a negative AVERROR on failure + * + * @note This function and avfilter_init_str() do essentially the same thing, + * the difference is in manner in which the options are passed. It is up to the + * calling code to choose whichever is more preferable. The two functions also + * behave differently when some of the provided options are not declared as + * supported by the filter. In such a case, avfilter_init_str() will fail, but + * this function will leave those extra options in the options AVDictionary and + * continue as usual. + */ +int avfilter_init_dict(AVFilterContext *ctx, AVDictionary **options); + +/** + * Free a filter context. This will also remove the filter from its + * filtergraph's list of filters. + * + * @param filter the filter to free + */ +void avfilter_free(AVFilterContext *filter); + +/** + * Insert a filter in the middle of an existing link. + * + * @param link the link into which the filter should be inserted + * @param filt the filter to be inserted + * @param filt_srcpad_idx the input pad on the filter to connect + * @param filt_dstpad_idx the output pad on the filter to connect + * @return zero on success + */ +int avfilter_insert_filter(AVFilterLink *link, AVFilterContext *filt, + unsigned filt_srcpad_idx, unsigned filt_dstpad_idx); + +/** + * @return AVClass for AVFilterContext. + * + * @see av_opt_find(). + */ +const AVClass *avfilter_get_class(void); + +typedef struct AVFilterGraphInternal AVFilterGraphInternal; + +/** + * A function pointer passed to the @ref AVFilterGraph.execute callback to be + * executed multiple times, possibly in parallel. + * + * @param ctx the filter context the job belongs to + * @param arg an opaque parameter passed through from @ref + * AVFilterGraph.execute + * @param jobnr the index of the job being executed + * @param nb_jobs the total number of jobs + * + * @return 0 on success, a negative AVERROR on error + */ +typedef int (avfilter_action_func)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs); + +/** + * A function executing multiple jobs, possibly in parallel. + * + * @param ctx the filter context to which the jobs belong + * @param func the function to be called multiple times + * @param arg the argument to be passed to func + * @param ret a nb_jobs-sized array to be filled with return values from each + * invocation of func + * @param nb_jobs the number of jobs to execute + * + * @return 0 on success, a negative AVERROR on error + */ +typedef int (avfilter_execute_func)(AVFilterContext *ctx, avfilter_action_func *func, + void *arg, int *ret, int nb_jobs); + +typedef struct AVFilterGraph { + const AVClass *av_class; + AVFilterContext **filters; + unsigned nb_filters; + + char *scale_sws_opts; ///< sws options to use for the auto-inserted scale filters +#if FF_API_LAVR_OPTS + attribute_deprecated char *resample_lavr_opts; ///< libavresample options to use for the auto-inserted resample filters +#endif + + /** + * Type of multithreading allowed for filters in this graph. A combination + * of AVFILTER_THREAD_* flags. + * + * May be set by the caller at any point, the setting will apply to all + * filters initialized after that. The default is allowing everything. + * + * When a filter in this graph is initialized, this field is combined using + * bit AND with AVFilterContext.thread_type to get the final mask used for + * determining allowed threading types. I.e. a threading type needs to be + * set in both to be allowed. + */ + int thread_type; + + /** + * Maximum number of threads used by filters in this graph. May be set by + * the caller before adding any filters to the filtergraph. Zero (the + * default) means that the number of threads is determined automatically. + */ + int nb_threads; + + /** + * Opaque object for libavfilter internal use. + */ + AVFilterGraphInternal *internal; + + /** + * Opaque user data. May be set by the caller to an arbitrary value, e.g. to + * be used from callbacks like @ref AVFilterGraph.execute. + * Libavfilter will not touch this field in any way. + */ + void *opaque; + + /** + * This callback may be set by the caller immediately after allocating the + * graph and before adding any filters to it, to provide a custom + * multithreading implementation. + * + * If set, filters with slice threading capability will call this callback + * to execute multiple jobs in parallel. + * + * If this field is left unset, libavfilter will use its internal + * implementation, which may or may not be multithreaded depending on the + * platform and build options. + */ + avfilter_execute_func *execute; + + char *aresample_swr_opts; ///< swr options to use for the auto-inserted aresample filters, Access ONLY through AVOptions + + /** + * Private fields + * + * The following fields are for internal use only. + * Their type, offset, number and semantic can change without notice. + */ + + AVFilterLink **sink_links; + int sink_links_count; + + unsigned disable_auto_convert; +} AVFilterGraph; + +/** + * Allocate a filter graph. + * + * @return the allocated filter graph on success or NULL. + */ +AVFilterGraph *avfilter_graph_alloc(void); + +/** + * Create a new filter instance in a filter graph. + * + * @param graph graph in which the new filter will be used + * @param filter the filter to create an instance of + * @param name Name to give to the new instance (will be copied to + * AVFilterContext.name). This may be used by the caller to identify + * different filters, libavfilter itself assigns no semantics to + * this parameter. May be NULL. + * + * @return the context of the newly created filter instance (note that it is + * also retrievable directly through AVFilterGraph.filters or with + * avfilter_graph_get_filter()) on success or NULL on failure. + */ +AVFilterContext *avfilter_graph_alloc_filter(AVFilterGraph *graph, + const AVFilter *filter, + const char *name); + +/** + * Get a filter instance identified by instance name from graph. + * + * @param graph filter graph to search through. + * @param name filter instance name (should be unique in the graph). + * @return the pointer to the found filter instance or NULL if it + * cannot be found. + */ +AVFilterContext *avfilter_graph_get_filter(AVFilterGraph *graph, const char *name); + +/** + * Create and add a filter instance into an existing graph. + * The filter instance is created from the filter filt and inited + * with the parameters args and opaque. + * + * In case of success put in *filt_ctx the pointer to the created + * filter instance, otherwise set *filt_ctx to NULL. + * + * @param name the instance name to give to the created filter instance + * @param graph_ctx the filter graph + * @return a negative AVERROR error code in case of failure, a non + * negative value otherwise + */ +int avfilter_graph_create_filter(AVFilterContext **filt_ctx, const AVFilter *filt, + const char *name, const char *args, void *opaque, + AVFilterGraph *graph_ctx); + +/** + * Enable or disable automatic format conversion inside the graph. + * + * Note that format conversion can still happen inside explicitly inserted + * scale and aresample filters. + * + * @param flags any of the AVFILTER_AUTO_CONVERT_* constants + */ +void avfilter_graph_set_auto_convert(AVFilterGraph *graph, unsigned flags); + +enum { + AVFILTER_AUTO_CONVERT_ALL = 0, /**< all automatic conversions enabled */ + AVFILTER_AUTO_CONVERT_NONE = -1, /**< all automatic conversions disabled */ +}; + +/** + * Check validity and configure all the links and formats in the graph. + * + * @param graphctx the filter graph + * @param log_ctx context used for logging + * @return >= 0 in case of success, a negative AVERROR code otherwise + */ +int avfilter_graph_config(AVFilterGraph *graphctx, void *log_ctx); + +/** + * Free a graph, destroy its links, and set *graph to NULL. + * If *graph is NULL, do nothing. + */ +void avfilter_graph_free(AVFilterGraph **graph); + +/** + * A linked-list of the inputs/outputs of the filter chain. + * + * This is mainly useful for avfilter_graph_parse() / avfilter_graph_parse2(), + * where it is used to communicate open (unlinked) inputs and outputs from and + * to the caller. + * This struct specifies, per each not connected pad contained in the graph, the + * filter context and the pad index required for establishing a link. + */ +typedef struct AVFilterInOut { + /** unique name for this input/output in the list */ + char *name; + + /** filter context associated to this input/output */ + AVFilterContext *filter_ctx; + + /** index of the filt_ctx pad to use for linking */ + int pad_idx; + + /** next input/input in the list, NULL if this is the last */ + struct AVFilterInOut *next; +} AVFilterInOut; + +/** + * Allocate a single AVFilterInOut entry. + * Must be freed with avfilter_inout_free(). + * @return allocated AVFilterInOut on success, NULL on failure. + */ +AVFilterInOut *avfilter_inout_alloc(void); + +/** + * Free the supplied list of AVFilterInOut and set *inout to NULL. + * If *inout is NULL, do nothing. + */ +void avfilter_inout_free(AVFilterInOut **inout); + +/** + * Add a graph described by a string to a graph. + * + * @note The caller must provide the lists of inputs and outputs, + * which therefore must be known before calling the function. + * + * @note The inputs parameter describes inputs of the already existing + * part of the graph; i.e. from the point of view of the newly created + * part, they are outputs. Similarly the outputs parameter describes + * outputs of the already existing filters, which are provided as + * inputs to the parsed filters. + * + * @param graph the filter graph where to link the parsed graph context + * @param filters string to be parsed + * @param inputs linked list to the inputs of the graph + * @param outputs linked list to the outputs of the graph + * @return zero on success, a negative AVERROR code on error + */ +int avfilter_graph_parse(AVFilterGraph *graph, const char *filters, + AVFilterInOut *inputs, AVFilterInOut *outputs, + void *log_ctx); + +/** + * Add a graph described by a string to a graph. + * + * In the graph filters description, if the input label of the first + * filter is not specified, "in" is assumed; if the output label of + * the last filter is not specified, "out" is assumed. + * + * @param graph the filter graph where to link the parsed graph context + * @param filters string to be parsed + * @param inputs pointer to a linked list to the inputs of the graph, may be NULL. + * If non-NULL, *inputs is updated to contain the list of open inputs + * after the parsing, should be freed with avfilter_inout_free(). + * @param outputs pointer to a linked list to the outputs of the graph, may be NULL. + * If non-NULL, *outputs is updated to contain the list of open outputs + * after the parsing, should be freed with avfilter_inout_free(). + * @return non negative on success, a negative AVERROR code on error + */ +int avfilter_graph_parse_ptr(AVFilterGraph *graph, const char *filters, + AVFilterInOut **inputs, AVFilterInOut **outputs, + void *log_ctx); + +/** + * Add a graph described by a string to a graph. + * + * @param[in] graph the filter graph where to link the parsed graph context + * @param[in] filters string to be parsed + * @param[out] inputs a linked list of all free (unlinked) inputs of the + * parsed graph will be returned here. It is to be freed + * by the caller using avfilter_inout_free(). + * @param[out] outputs a linked list of all free (unlinked) outputs of the + * parsed graph will be returned here. It is to be freed by the + * caller using avfilter_inout_free(). + * @return zero on success, a negative AVERROR code on error + * + * @note This function returns the inputs and outputs that are left + * unlinked after parsing the graph and the caller then deals with + * them. + * @note This function makes no reference whatsoever to already + * existing parts of the graph and the inputs parameter will on return + * contain inputs of the newly parsed part of the graph. Analogously + * the outputs parameter will contain outputs of the newly created + * filters. + */ +int avfilter_graph_parse2(AVFilterGraph *graph, const char *filters, + AVFilterInOut **inputs, + AVFilterInOut **outputs); + +/** + * Send a command to one or more filter instances. + * + * @param graph the filter graph + * @param target the filter(s) to which the command should be sent + * "all" sends to all filters + * otherwise it can be a filter or filter instance name + * which will send the command to all matching filters. + * @param cmd the command to send, for handling simplicity all commands must be alphanumeric only + * @param arg the argument for the command + * @param res a buffer with size res_size where the filter(s) can return a response. + * + * @returns >=0 on success otherwise an error code. + * AVERROR(ENOSYS) on unsupported commands + */ +int avfilter_graph_send_command(AVFilterGraph *graph, const char *target, const char *cmd, const char *arg, char *res, int res_len, int flags); + +/** + * Queue a command for one or more filter instances. + * + * @param graph the filter graph + * @param target the filter(s) to which the command should be sent + * "all" sends to all filters + * otherwise it can be a filter or filter instance name + * which will send the command to all matching filters. + * @param cmd the command to sent, for handling simplicity all commands must be alphanumeric only + * @param arg the argument for the command + * @param ts time at which the command should be sent to the filter + * + * @note As this executes commands after this function returns, no return code + * from the filter is provided, also AVFILTER_CMD_FLAG_ONE is not supported. + */ +int avfilter_graph_queue_command(AVFilterGraph *graph, const char *target, const char *cmd, const char *arg, int flags, double ts); + + +/** + * Dump a graph into a human-readable string representation. + * + * @param graph the graph to dump + * @param options formatting options; currently ignored + * @return a string, or NULL in case of memory allocation failure; + * the string must be freed using av_free + */ +char *avfilter_graph_dump(AVFilterGraph *graph, const char *options); + +/** + * Request a frame on the oldest sink link. + * + * If the request returns AVERROR_EOF, try the next. + * + * Note that this function is not meant to be the sole scheduling mechanism + * of a filtergraph, only a convenience function to help drain a filtergraph + * in a balanced way under normal circumstances. + * + * Also note that AVERROR_EOF does not mean that frames did not arrive on + * some of the sinks during the process. + * When there are multiple sink links, in case the requested link + * returns an EOF, this may cause a filter to flush pending frames + * which are sent to another sink link, although unrequested. + * + * @return the return value of ff_request_frame(), + * or AVERROR_EOF if all links returned AVERROR_EOF + */ +int avfilter_graph_request_oldest(AVFilterGraph *graph); + +/** + * @} + */ + +#endif /* AVFILTER_AVFILTER_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavfilter/buffersink.h b/MediaClient/MediaClient/ffmpeg/include/libavfilter/buffersink.h new file mode 100644 index 0000000..21d6bb5 --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavfilter/buffersink.h @@ -0,0 +1,165 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVFILTER_BUFFERSINK_H +#define AVFILTER_BUFFERSINK_H + +/** + * @file + * @ingroup lavfi_buffersink + * memory buffer sink API for audio and video + */ + +#include "avfilter.h" + +/** + * @defgroup lavfi_buffersink Buffer sink API + * @ingroup lavfi + * @{ + */ + +/** + * Get a frame with filtered data from sink and put it in frame. + * + * @param ctx pointer to a buffersink or abuffersink filter context. + * @param frame pointer to an allocated frame that will be filled with data. + * The data must be freed using av_frame_unref() / av_frame_free() + * @param flags a combination of AV_BUFFERSINK_FLAG_* flags + * + * @return >= 0 in for success, a negative AVERROR code for failure. + */ +int av_buffersink_get_frame_flags(AVFilterContext *ctx, AVFrame *frame, int flags); + +/** + * Tell av_buffersink_get_buffer_ref() to read video/samples buffer + * reference, but not remove it from the buffer. This is useful if you + * need only to read a video/samples buffer, without to fetch it. + */ +#define AV_BUFFERSINK_FLAG_PEEK 1 + +/** + * Tell av_buffersink_get_buffer_ref() not to request a frame from its input. + * If a frame is already buffered, it is read (and removed from the buffer), + * but if no frame is present, return AVERROR(EAGAIN). + */ +#define AV_BUFFERSINK_FLAG_NO_REQUEST 2 + +/** + * Struct to use for initializing a buffersink context. + */ +typedef struct AVBufferSinkParams { + const enum AVPixelFormat *pixel_fmts; ///< list of allowed pixel formats, terminated by AV_PIX_FMT_NONE +} AVBufferSinkParams; + +/** + * Create an AVBufferSinkParams structure. + * + * Must be freed with av_free(). + */ +AVBufferSinkParams *av_buffersink_params_alloc(void); + +/** + * Struct to use for initializing an abuffersink context. + */ +typedef struct AVABufferSinkParams { + const enum AVSampleFormat *sample_fmts; ///< list of allowed sample formats, terminated by AV_SAMPLE_FMT_NONE + const int64_t *channel_layouts; ///< list of allowed channel layouts, terminated by -1 + const int *channel_counts; ///< list of allowed channel counts, terminated by -1 + int all_channel_counts; ///< if not 0, accept any channel count or layout + int *sample_rates; ///< list of allowed sample rates, terminated by -1 +} AVABufferSinkParams; + +/** + * Create an AVABufferSinkParams structure. + * + * Must be freed with av_free(). + */ +AVABufferSinkParams *av_abuffersink_params_alloc(void); + +/** + * Set the frame size for an audio buffer sink. + * + * All calls to av_buffersink_get_buffer_ref will return a buffer with + * exactly the specified number of samples, or AVERROR(EAGAIN) if there is + * not enough. The last buffer at EOF will be padded with 0. + */ +void av_buffersink_set_frame_size(AVFilterContext *ctx, unsigned frame_size); + +/** + * @defgroup lavfi_buffersink_accessors Buffer sink accessors + * Get the properties of the stream + * @{ + */ + +enum AVMediaType av_buffersink_get_type (const AVFilterContext *ctx); +AVRational av_buffersink_get_time_base (const AVFilterContext *ctx); +int av_buffersink_get_format (const AVFilterContext *ctx); + +AVRational av_buffersink_get_frame_rate (const AVFilterContext *ctx); +int av_buffersink_get_w (const AVFilterContext *ctx); +int av_buffersink_get_h (const AVFilterContext *ctx); +AVRational av_buffersink_get_sample_aspect_ratio (const AVFilterContext *ctx); + +int av_buffersink_get_channels (const AVFilterContext *ctx); +uint64_t av_buffersink_get_channel_layout (const AVFilterContext *ctx); +int av_buffersink_get_sample_rate (const AVFilterContext *ctx); + +AVBufferRef * av_buffersink_get_hw_frames_ctx (const AVFilterContext *ctx); + +/** @} */ + +/** + * Get a frame with filtered data from sink and put it in frame. + * + * @param ctx pointer to a context of a buffersink or abuffersink AVFilter. + * @param frame pointer to an allocated frame that will be filled with data. + * The data must be freed using av_frame_unref() / av_frame_free() + * + * @return + * - >= 0 if a frame was successfully returned. + * - AVERROR(EAGAIN) if no frames are available at this point; more + * input frames must be added to the filtergraph to get more output. + * - AVERROR_EOF if there will be no more output frames on this sink. + * - A different negative AVERROR code in other failure cases. + */ +int av_buffersink_get_frame(AVFilterContext *ctx, AVFrame *frame); + +/** + * Same as av_buffersink_get_frame(), but with the ability to specify the number + * of samples read. This function is less efficient than + * av_buffersink_get_frame(), because it copies the data around. + * + * @param ctx pointer to a context of the abuffersink AVFilter. + * @param frame pointer to an allocated frame that will be filled with data. + * The data must be freed using av_frame_unref() / av_frame_free() + * frame will contain exactly nb_samples audio samples, except at + * the end of stream, when it can contain less than nb_samples. + * + * @return The return codes have the same meaning as for + * av_buffersink_get_samples(). + * + * @warning do not mix this function with av_buffersink_get_frame(). Use only one or + * the other with a single sink, not both. + */ +int av_buffersink_get_samples(AVFilterContext *ctx, AVFrame *frame, int nb_samples); + +/** + * @} + */ + +#endif /* AVFILTER_BUFFERSINK_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavfilter/buffersrc.h b/MediaClient/MediaClient/ffmpeg/include/libavfilter/buffersrc.h new file mode 100644 index 0000000..0652113 --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavfilter/buffersrc.h @@ -0,0 +1,209 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVFILTER_BUFFERSRC_H +#define AVFILTER_BUFFERSRC_H + +/** + * @file + * @ingroup lavfi_buffersrc + * Memory buffer source API. + */ + +#include "avfilter.h" + +/** + * @defgroup lavfi_buffersrc Buffer source API + * @ingroup lavfi + * @{ + */ + +enum { + + /** + * Do not check for format changes. + */ + AV_BUFFERSRC_FLAG_NO_CHECK_FORMAT = 1, + + /** + * Immediately push the frame to the output. + */ + AV_BUFFERSRC_FLAG_PUSH = 4, + + /** + * Keep a reference to the frame. + * If the frame if reference-counted, create a new reference; otherwise + * copy the frame data. + */ + AV_BUFFERSRC_FLAG_KEEP_REF = 8, + +}; + +/** + * Get the number of failed requests. + * + * A failed request is when the request_frame method is called while no + * frame is present in the buffer. + * The number is reset when a frame is added. + */ +unsigned av_buffersrc_get_nb_failed_requests(AVFilterContext *buffer_src); + +/** + * This structure contains the parameters describing the frames that will be + * passed to this filter. + * + * It should be allocated with av_buffersrc_parameters_alloc() and freed with + * av_free(). All the allocated fields in it remain owned by the caller. + */ +typedef struct AVBufferSrcParameters { + /** + * video: the pixel format, value corresponds to enum AVPixelFormat + * audio: the sample format, value corresponds to enum AVSampleFormat + */ + int format; + /** + * The timebase to be used for the timestamps on the input frames. + */ + AVRational time_base; + + /** + * Video only, the display dimensions of the input frames. + */ + int width, height; + + /** + * Video only, the sample (pixel) aspect ratio. + */ + AVRational sample_aspect_ratio; + + /** + * Video only, the frame rate of the input video. This field must only be + * set to a non-zero value if input stream has a known constant framerate + * and should be left at its initial value if the framerate is variable or + * unknown. + */ + AVRational frame_rate; + + /** + * Video with a hwaccel pixel format only. This should be a reference to an + * AVHWFramesContext instance describing the input frames. + */ + AVBufferRef *hw_frames_ctx; + + /** + * Audio only, the audio sampling rate in samples per secon. + */ + int sample_rate; + + /** + * Audio only, the audio channel layout + */ + uint64_t channel_layout; +} AVBufferSrcParameters; + +/** + * Allocate a new AVBufferSrcParameters instance. It should be freed by the + * caller with av_free(). + */ +AVBufferSrcParameters *av_buffersrc_parameters_alloc(void); + +/** + * Initialize the buffersrc or abuffersrc filter with the provided parameters. + * This function may be called multiple times, the later calls override the + * previous ones. Some of the parameters may also be set through AVOptions, then + * whatever method is used last takes precedence. + * + * @param ctx an instance of the buffersrc or abuffersrc filter + * @param param the stream parameters. The frames later passed to this filter + * must conform to those parameters. All the allocated fields in + * param remain owned by the caller, libavfilter will make internal + * copies or references when necessary. + * @return 0 on success, a negative AVERROR code on failure. + */ +int av_buffersrc_parameters_set(AVFilterContext *ctx, AVBufferSrcParameters *param); + +/** + * Add a frame to the buffer source. + * + * @param ctx an instance of the buffersrc filter + * @param frame frame to be added. If the frame is reference counted, this + * function will make a new reference to it. Otherwise the frame data will be + * copied. + * + * @return 0 on success, a negative AVERROR on error + * + * This function is equivalent to av_buffersrc_add_frame_flags() with the + * AV_BUFFERSRC_FLAG_KEEP_REF flag. + */ +av_warn_unused_result +int av_buffersrc_write_frame(AVFilterContext *ctx, const AVFrame *frame); + +/** + * Add a frame to the buffer source. + * + * @param ctx an instance of the buffersrc filter + * @param frame frame to be added. If the frame is reference counted, this + * function will take ownership of the reference(s) and reset the frame. + * Otherwise the frame data will be copied. If this function returns an error, + * the input frame is not touched. + * + * @return 0 on success, a negative AVERROR on error. + * + * @note the difference between this function and av_buffersrc_write_frame() is + * that av_buffersrc_write_frame() creates a new reference to the input frame, + * while this function takes ownership of the reference passed to it. + * + * This function is equivalent to av_buffersrc_add_frame_flags() without the + * AV_BUFFERSRC_FLAG_KEEP_REF flag. + */ +av_warn_unused_result +int av_buffersrc_add_frame(AVFilterContext *ctx, AVFrame *frame); + +/** + * Add a frame to the buffer source. + * + * By default, if the frame is reference-counted, this function will take + * ownership of the reference(s) and reset the frame. This can be controlled + * using the flags. + * + * If this function returns an error, the input frame is not touched. + * + * @param buffer_src pointer to a buffer source context + * @param frame a frame, or NULL to mark EOF + * @param flags a combination of AV_BUFFERSRC_FLAG_* + * @return >= 0 in case of success, a negative AVERROR code + * in case of failure + */ +av_warn_unused_result +int av_buffersrc_add_frame_flags(AVFilterContext *buffer_src, + AVFrame *frame, int flags); + +/** + * Close the buffer source after EOF. + * + * This is similar to passing NULL to av_buffersrc_add_frame_flags() + * except it takes the timestamp of the EOF, i.e. the timestamp of the end + * of the last frame. + */ +int av_buffersrc_close(AVFilterContext *ctx, int64_t pts, unsigned flags); + +/** + * @} + */ + +#endif /* AVFILTER_BUFFERSRC_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavfilter/version.h b/MediaClient/MediaClient/ffmpeg/include/libavfilter/version.h new file mode 100644 index 0000000..87468df --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavfilter/version.h @@ -0,0 +1,65 @@ +/* + * Version macros. + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVFILTER_VERSION_H +#define AVFILTER_VERSION_H + +/** + * @file + * @ingroup lavfi + * Libavfilter version macros + */ + +#include "libavutil/version.h" + +#define LIBAVFILTER_VERSION_MAJOR 7 +#define LIBAVFILTER_VERSION_MINOR 16 +#define LIBAVFILTER_VERSION_MICRO 100 + +#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ + LIBAVFILTER_VERSION_MINOR, \ + LIBAVFILTER_VERSION_MICRO) +#define LIBAVFILTER_VERSION AV_VERSION(LIBAVFILTER_VERSION_MAJOR, \ + LIBAVFILTER_VERSION_MINOR, \ + LIBAVFILTER_VERSION_MICRO) +#define LIBAVFILTER_BUILD LIBAVFILTER_VERSION_INT + +#define LIBAVFILTER_IDENT "Lavfi" AV_STRINGIFY(LIBAVFILTER_VERSION) + +/** + * FF_API_* defines may be placed below to indicate public API that will be + * dropped at a future version bump. The defines themselves are not part of + * the public API and may change, break or disappear at any time. + */ + +#ifndef FF_API_OLD_FILTER_OPTS_ERROR +#define FF_API_OLD_FILTER_OPTS_ERROR (LIBAVFILTER_VERSION_MAJOR < 8) +#endif +#ifndef FF_API_LAVR_OPTS +#define FF_API_LAVR_OPTS (LIBAVFILTER_VERSION_MAJOR < 8) +#endif +#ifndef FF_API_FILTER_GET_SET +#define FF_API_FILTER_GET_SET (LIBAVFILTER_VERSION_MAJOR < 8) +#endif +#ifndef FF_API_NEXT +#define FF_API_NEXT (LIBAVFILTER_VERSION_MAJOR < 8) +#endif + +#endif /* AVFILTER_VERSION_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavformat/avformat.h b/MediaClient/MediaClient/ffmpeg/include/libavformat/avformat.h new file mode 100644 index 0000000..a2fe7c6 --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavformat/avformat.h @@ -0,0 +1,3067 @@ +/* + * copyright (c) 2001 Fabrice Bellard + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVFORMAT_AVFORMAT_H +#define AVFORMAT_AVFORMAT_H + +/** + * @file + * @ingroup libavf + * Main libavformat public API header + */ + +/** + * @defgroup libavf libavformat + * I/O and Muxing/Demuxing Library + * + * Libavformat (lavf) is a library for dealing with various media container + * formats. Its main two purposes are demuxing - i.e. splitting a media file + * into component streams, and the reverse process of muxing - writing supplied + * data in a specified container format. It also has an @ref lavf_io + * "I/O module" which supports a number of protocols for accessing the data (e.g. + * file, tcp, http and others). Before using lavf, you need to call + * av_register_all() to register all compiled muxers, demuxers and protocols. + * Unless you are absolutely sure you won't use libavformat's network + * capabilities, you should also call avformat_network_init(). + * + * A supported input format is described by an AVInputFormat struct, conversely + * an output format is described by AVOutputFormat. You can iterate over all + * registered input/output formats using the av_iformat_next() / + * av_oformat_next() functions. The protocols layer is not part of the public + * API, so you can only get the names of supported protocols with the + * avio_enum_protocols() function. + * + * Main lavf structure used for both muxing and demuxing is AVFormatContext, + * which exports all information about the file being read or written. As with + * most Libavformat structures, its size is not part of public ABI, so it cannot be + * allocated on stack or directly with av_malloc(). To create an + * AVFormatContext, use avformat_alloc_context() (some functions, like + * avformat_open_input() might do that for you). + * + * Most importantly an AVFormatContext contains: + * @li the @ref AVFormatContext.iformat "input" or @ref AVFormatContext.oformat + * "output" format. It is either autodetected or set by user for input; + * always set by user for output. + * @li an @ref AVFormatContext.streams "array" of AVStreams, which describe all + * elementary streams stored in the file. AVStreams are typically referred to + * using their index in this array. + * @li an @ref AVFormatContext.pb "I/O context". It is either opened by lavf or + * set by user for input, always set by user for output (unless you are dealing + * with an AVFMT_NOFILE format). + * + * @section lavf_options Passing options to (de)muxers + * It is possible to configure lavf muxers and demuxers using the @ref avoptions + * mechanism. Generic (format-independent) libavformat options are provided by + * AVFormatContext, they can be examined from a user program by calling + * av_opt_next() / av_opt_find() on an allocated AVFormatContext (or its AVClass + * from avformat_get_class()). Private (format-specific) options are provided by + * AVFormatContext.priv_data if and only if AVInputFormat.priv_class / + * AVOutputFormat.priv_class of the corresponding format struct is non-NULL. + * Further options may be provided by the @ref AVFormatContext.pb "I/O context", + * if its AVClass is non-NULL, and the protocols layer. See the discussion on + * nesting in @ref avoptions documentation to learn how to access those. + * + * @section urls + * URL strings in libavformat are made of a scheme/protocol, a ':', and a + * scheme specific string. URLs without a scheme and ':' used for local files + * are supported but deprecated. "file:" should be used for local files. + * + * It is important that the scheme string is not taken from untrusted + * sources without checks. + * + * Note that some schemes/protocols are quite powerful, allowing access to + * both local and remote files, parts of them, concatenations of them, local + * audio and video devices and so on. + * + * @{ + * + * @defgroup lavf_decoding Demuxing + * @{ + * Demuxers read a media file and split it into chunks of data (@em packets). A + * @ref AVPacket "packet" contains one or more encoded frames which belongs to a + * single elementary stream. In the lavf API this process is represented by the + * avformat_open_input() function for opening a file, av_read_frame() for + * reading a single packet and finally avformat_close_input(), which does the + * cleanup. + * + * @section lavf_decoding_open Opening a media file + * The minimum information required to open a file is its URL, which + * is passed to avformat_open_input(), as in the following code: + * @code + * const char *url = "file:in.mp3"; + * AVFormatContext *s = NULL; + * int ret = avformat_open_input(&s, url, NULL, NULL); + * if (ret < 0) + * abort(); + * @endcode + * The above code attempts to allocate an AVFormatContext, open the + * specified file (autodetecting the format) and read the header, exporting the + * information stored there into s. Some formats do not have a header or do not + * store enough information there, so it is recommended that you call the + * avformat_find_stream_info() function which tries to read and decode a few + * frames to find missing information. + * + * In some cases you might want to preallocate an AVFormatContext yourself with + * avformat_alloc_context() and do some tweaking on it before passing it to + * avformat_open_input(). One such case is when you want to use custom functions + * for reading input data instead of lavf internal I/O layer. + * To do that, create your own AVIOContext with avio_alloc_context(), passing + * your reading callbacks to it. Then set the @em pb field of your + * AVFormatContext to newly created AVIOContext. + * + * Since the format of the opened file is in general not known until after + * avformat_open_input() has returned, it is not possible to set demuxer private + * options on a preallocated context. Instead, the options should be passed to + * avformat_open_input() wrapped in an AVDictionary: + * @code + * AVDictionary *options = NULL; + * av_dict_set(&options, "video_size", "640x480", 0); + * av_dict_set(&options, "pixel_format", "rgb24", 0); + * + * if (avformat_open_input(&s, url, NULL, &options) < 0) + * abort(); + * av_dict_free(&options); + * @endcode + * This code passes the private options 'video_size' and 'pixel_format' to the + * demuxer. They would be necessary for e.g. the rawvideo demuxer, since it + * cannot know how to interpret raw video data otherwise. If the format turns + * out to be something different than raw video, those options will not be + * recognized by the demuxer and therefore will not be applied. Such unrecognized + * options are then returned in the options dictionary (recognized options are + * consumed). The calling program can handle such unrecognized options as it + * wishes, e.g. + * @code + * AVDictionaryEntry *e; + * if (e = av_dict_get(options, "", NULL, AV_DICT_IGNORE_SUFFIX)) { + * fprintf(stderr, "Option %s not recognized by the demuxer.\n", e->key); + * abort(); + * } + * @endcode + * + * After you have finished reading the file, you must close it with + * avformat_close_input(). It will free everything associated with the file. + * + * @section lavf_decoding_read Reading from an opened file + * Reading data from an opened AVFormatContext is done by repeatedly calling + * av_read_frame() on it. Each call, if successful, will return an AVPacket + * containing encoded data for one AVStream, identified by + * AVPacket.stream_index. This packet may be passed straight into the libavcodec + * decoding functions avcodec_send_packet() or avcodec_decode_subtitle2() if the + * caller wishes to decode the data. + * + * AVPacket.pts, AVPacket.dts and AVPacket.duration timing information will be + * set if known. They may also be unset (i.e. AV_NOPTS_VALUE for + * pts/dts, 0 for duration) if the stream does not provide them. The timing + * information will be in AVStream.time_base units, i.e. it has to be + * multiplied by the timebase to convert them to seconds. + * + * If AVPacket.buf is set on the returned packet, then the packet is + * allocated dynamically and the user may keep it indefinitely. + * Otherwise, if AVPacket.buf is NULL, the packet data is backed by a + * static storage somewhere inside the demuxer and the packet is only valid + * until the next av_read_frame() call or closing the file. If the caller + * requires a longer lifetime, av_dup_packet() will make an av_malloc()ed copy + * of it. + * In both cases, the packet must be freed with av_packet_unref() when it is no + * longer needed. + * + * @section lavf_decoding_seek Seeking + * @} + * + * @defgroup lavf_encoding Muxing + * @{ + * Muxers take encoded data in the form of @ref AVPacket "AVPackets" and write + * it into files or other output bytestreams in the specified container format. + * + * The main API functions for muxing are avformat_write_header() for writing the + * file header, av_write_frame() / av_interleaved_write_frame() for writing the + * packets and av_write_trailer() for finalizing the file. + * + * At the beginning of the muxing process, the caller must first call + * avformat_alloc_context() to create a muxing context. The caller then sets up + * the muxer by filling the various fields in this context: + * + * - The @ref AVFormatContext.oformat "oformat" field must be set to select the + * muxer that will be used. + * - Unless the format is of the AVFMT_NOFILE type, the @ref AVFormatContext.pb + * "pb" field must be set to an opened IO context, either returned from + * avio_open2() or a custom one. + * - Unless the format is of the AVFMT_NOSTREAMS type, at least one stream must + * be created with the avformat_new_stream() function. The caller should fill + * the @ref AVStream.codecpar "stream codec parameters" information, such as the + * codec @ref AVCodecParameters.codec_type "type", @ref AVCodecParameters.codec_id + * "id" and other parameters (e.g. width / height, the pixel or sample format, + * etc.) as known. The @ref AVStream.time_base "stream timebase" should + * be set to the timebase that the caller desires to use for this stream (note + * that the timebase actually used by the muxer can be different, as will be + * described later). + * - It is advised to manually initialize only the relevant fields in + * AVCodecParameters, rather than using @ref avcodec_parameters_copy() during + * remuxing: there is no guarantee that the codec context values remain valid + * for both input and output format contexts. + * - The caller may fill in additional information, such as @ref + * AVFormatContext.metadata "global" or @ref AVStream.metadata "per-stream" + * metadata, @ref AVFormatContext.chapters "chapters", @ref + * AVFormatContext.programs "programs", etc. as described in the + * AVFormatContext documentation. Whether such information will actually be + * stored in the output depends on what the container format and the muxer + * support. + * + * When the muxing context is fully set up, the caller must call + * avformat_write_header() to initialize the muxer internals and write the file + * header. Whether anything actually is written to the IO context at this step + * depends on the muxer, but this function must always be called. Any muxer + * private options must be passed in the options parameter to this function. + * + * The data is then sent to the muxer by repeatedly calling av_write_frame() or + * av_interleaved_write_frame() (consult those functions' documentation for + * discussion on the difference between them; only one of them may be used with + * a single muxing context, they should not be mixed). Do note that the timing + * information on the packets sent to the muxer must be in the corresponding + * AVStream's timebase. That timebase is set by the muxer (in the + * avformat_write_header() step) and may be different from the timebase + * requested by the caller. + * + * Once all the data has been written, the caller must call av_write_trailer() + * to flush any buffered packets and finalize the output file, then close the IO + * context (if any) and finally free the muxing context with + * avformat_free_context(). + * @} + * + * @defgroup lavf_io I/O Read/Write + * @{ + * @section lavf_io_dirlist Directory listing + * The directory listing API makes it possible to list files on remote servers. + * + * Some of possible use cases: + * - an "open file" dialog to choose files from a remote location, + * - a recursive media finder providing a player with an ability to play all + * files from a given directory. + * + * @subsection lavf_io_dirlist_open Opening a directory + * At first, a directory needs to be opened by calling avio_open_dir() + * supplied with a URL and, optionally, ::AVDictionary containing + * protocol-specific parameters. The function returns zero or positive + * integer and allocates AVIODirContext on success. + * + * @code + * AVIODirContext *ctx = NULL; + * if (avio_open_dir(&ctx, "smb://example.com/some_dir", NULL) < 0) { + * fprintf(stderr, "Cannot open directory.\n"); + * abort(); + * } + * @endcode + * + * This code tries to open a sample directory using smb protocol without + * any additional parameters. + * + * @subsection lavf_io_dirlist_read Reading entries + * Each directory's entry (i.e. file, another directory, anything else + * within ::AVIODirEntryType) is represented by AVIODirEntry. + * Reading consecutive entries from an opened AVIODirContext is done by + * repeatedly calling avio_read_dir() on it. Each call returns zero or + * positive integer if successful. Reading can be stopped right after the + * NULL entry has been read -- it means there are no entries left to be + * read. The following code reads all entries from a directory associated + * with ctx and prints their names to standard output. + * @code + * AVIODirEntry *entry = NULL; + * for (;;) { + * if (avio_read_dir(ctx, &entry) < 0) { + * fprintf(stderr, "Cannot list directory.\n"); + * abort(); + * } + * if (!entry) + * break; + * printf("%s\n", entry->name); + * avio_free_directory_entry(&entry); + * } + * @endcode + * @} + * + * @defgroup lavf_codec Demuxers + * @{ + * @defgroup lavf_codec_native Native Demuxers + * @{ + * @} + * @defgroup lavf_codec_wrappers External library wrappers + * @{ + * @} + * @} + * @defgroup lavf_protos I/O Protocols + * @{ + * @} + * @defgroup lavf_internal Internal + * @{ + * @} + * @} + */ + +#include +#include /* FILE */ +#include "libavcodec/avcodec.h" +#include "libavutil/dict.h" +#include "libavutil/log.h" + +#include "avio.h" +#include "libavformat/version.h" + +struct AVFormatContext; + +struct AVDeviceInfoList; +struct AVDeviceCapabilitiesQuery; + +/** + * @defgroup metadata_api Public Metadata API + * @{ + * @ingroup libavf + * The metadata API allows libavformat to export metadata tags to a client + * application when demuxing. Conversely it allows a client application to + * set metadata when muxing. + * + * Metadata is exported or set as pairs of key/value strings in the 'metadata' + * fields of the AVFormatContext, AVStream, AVChapter and AVProgram structs + * using the @ref lavu_dict "AVDictionary" API. Like all strings in FFmpeg, + * metadata is assumed to be UTF-8 encoded Unicode. Note that metadata + * exported by demuxers isn't checked to be valid UTF-8 in most cases. + * + * Important concepts to keep in mind: + * - Keys are unique; there can never be 2 tags with the same key. This is + * also meant semantically, i.e., a demuxer should not knowingly produce + * several keys that are literally different but semantically identical. + * E.g., key=Author5, key=Author6. In this example, all authors must be + * placed in the same tag. + * - Metadata is flat, not hierarchical; there are no subtags. If you + * want to store, e.g., the email address of the child of producer Alice + * and actor Bob, that could have key=alice_and_bobs_childs_email_address. + * - Several modifiers can be applied to the tag name. This is done by + * appending a dash character ('-') and the modifier name in the order + * they appear in the list below -- e.g. foo-eng-sort, not foo-sort-eng. + * - language -- a tag whose value is localized for a particular language + * is appended with the ISO 639-2/B 3-letter language code. + * For example: Author-ger=Michael, Author-eng=Mike + * The original/default language is in the unqualified "Author" tag. + * A demuxer should set a default if it sets any translated tag. + * - sorting -- a modified version of a tag that should be used for + * sorting will have '-sort' appended. E.g. artist="The Beatles", + * artist-sort="Beatles, The". + * - Some protocols and demuxers support metadata updates. After a successful + * call to av_read_packet(), AVFormatContext.event_flags or AVStream.event_flags + * will be updated to indicate if metadata changed. In order to detect metadata + * changes on a stream, you need to loop through all streams in the AVFormatContext + * and check their individual event_flags. + * + * - Demuxers attempt to export metadata in a generic format, however tags + * with no generic equivalents are left as they are stored in the container. + * Follows a list of generic tag names: + * + @verbatim + album -- name of the set this work belongs to + album_artist -- main creator of the set/album, if different from artist. + e.g. "Various Artists" for compilation albums. + artist -- main creator of the work + comment -- any additional description of the file. + composer -- who composed the work, if different from artist. + copyright -- name of copyright holder. + creation_time-- date when the file was created, preferably in ISO 8601. + date -- date when the work was created, preferably in ISO 8601. + disc -- number of a subset, e.g. disc in a multi-disc collection. + encoder -- name/settings of the software/hardware that produced the file. + encoded_by -- person/group who created the file. + filename -- original name of the file. + genre -- . + language -- main language in which the work is performed, preferably + in ISO 639-2 format. Multiple languages can be specified by + separating them with commas. + performer -- artist who performed the work, if different from artist. + E.g for "Also sprach Zarathustra", artist would be "Richard + Strauss" and performer "London Philharmonic Orchestra". + publisher -- name of the label/publisher. + service_name -- name of the service in broadcasting (channel name). + service_provider -- name of the service provider in broadcasting. + title -- name of the work. + track -- number of this work in the set, can be in form current/total. + variant_bitrate -- the total bitrate of the bitrate variant that the current stream is part of + @endverbatim + * + * Look in the examples section for an application example how to use the Metadata API. + * + * @} + */ + +/* packet functions */ + + +/** + * Allocate and read the payload of a packet and initialize its + * fields with default values. + * + * @param s associated IO context + * @param pkt packet + * @param size desired payload size + * @return >0 (read size) if OK, AVERROR_xxx otherwise + */ +int av_get_packet(AVIOContext *s, AVPacket *pkt, int size); + + +/** + * Read data and append it to the current content of the AVPacket. + * If pkt->size is 0 this is identical to av_get_packet. + * Note that this uses av_grow_packet and thus involves a realloc + * which is inefficient. Thus this function should only be used + * when there is no reasonable way to know (an upper bound of) + * the final size. + * + * @param s associated IO context + * @param pkt packet + * @param size amount of data to read + * @return >0 (read size) if OK, AVERROR_xxx otherwise, previous data + * will not be lost even if an error occurs. + */ +int av_append_packet(AVIOContext *s, AVPacket *pkt, int size); + +/*************************************************/ +/* input/output formats */ + +struct AVCodecTag; + +/** + * This structure contains the data a format has to probe a file. + */ +typedef struct AVProbeData { + const char *filename; + unsigned char *buf; /**< Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero. */ + int buf_size; /**< Size of buf except extra allocated bytes */ + const char *mime_type; /**< mime_type, when known. */ +} AVProbeData; + +#define AVPROBE_SCORE_RETRY (AVPROBE_SCORE_MAX/4) +#define AVPROBE_SCORE_STREAM_RETRY (AVPROBE_SCORE_MAX/4-1) + +#define AVPROBE_SCORE_EXTENSION 50 ///< score for file extension +#define AVPROBE_SCORE_MIME 75 ///< score for file mime type +#define AVPROBE_SCORE_MAX 100 ///< maximum score + +#define AVPROBE_PADDING_SIZE 32 ///< extra allocated bytes at the end of the probe buffer + +/// Demuxer will use avio_open, no opened file should be provided by the caller. +#define AVFMT_NOFILE 0x0001 +#define AVFMT_NEEDNUMBER 0x0002 /**< Needs '%d' in filename. */ +#define AVFMT_SHOW_IDS 0x0008 /**< Show format stream IDs numbers. */ +#define AVFMT_GLOBALHEADER 0x0040 /**< Format wants global header. */ +#define AVFMT_NOTIMESTAMPS 0x0080 /**< Format does not need / have any timestamps. */ +#define AVFMT_GENERIC_INDEX 0x0100 /**< Use generic index building code. */ +#define AVFMT_TS_DISCONT 0x0200 /**< Format allows timestamp discontinuities. Note, muxers always require valid (monotone) timestamps */ +#define AVFMT_VARIABLE_FPS 0x0400 /**< Format allows variable fps. */ +#define AVFMT_NODIMENSIONS 0x0800 /**< Format does not need width/height */ +#define AVFMT_NOSTREAMS 0x1000 /**< Format does not require any streams */ +#define AVFMT_NOBINSEARCH 0x2000 /**< Format does not allow to fall back on binary search via read_timestamp */ +#define AVFMT_NOGENSEARCH 0x4000 /**< Format does not allow to fall back on generic search */ +#define AVFMT_NO_BYTE_SEEK 0x8000 /**< Format does not allow seeking by bytes */ +#define AVFMT_ALLOW_FLUSH 0x10000 /**< Format allows flushing. If not set, the muxer will not receive a NULL packet in the write_packet function. */ +#define AVFMT_TS_NONSTRICT 0x20000 /**< Format does not require strictly + increasing timestamps, but they must + still be monotonic */ +#define AVFMT_TS_NEGATIVE 0x40000 /**< Format allows muxing negative + timestamps. If not set the timestamp + will be shifted in av_write_frame and + av_interleaved_write_frame so they + start from 0. + The user or muxer can override this through + AVFormatContext.avoid_negative_ts + */ + +#define AVFMT_SEEK_TO_PTS 0x4000000 /**< Seeking is based on PTS */ + +/** + * @addtogroup lavf_encoding + * @{ + */ +typedef struct AVOutputFormat { + const char *name; + /** + * Descriptive name for the format, meant to be more human-readable + * than name. You should use the NULL_IF_CONFIG_SMALL() macro + * to define it. + */ + const char *long_name; + const char *mime_type; + const char *extensions; /**< comma-separated filename extensions */ + /* output support */ + enum AVCodecID audio_codec; /**< default audio codec */ + enum AVCodecID video_codec; /**< default video codec */ + enum AVCodecID subtitle_codec; /**< default subtitle codec */ + /** + * can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, + * AVFMT_GLOBALHEADER, AVFMT_NOTIMESTAMPS, AVFMT_VARIABLE_FPS, + * AVFMT_NODIMENSIONS, AVFMT_NOSTREAMS, AVFMT_ALLOW_FLUSH, + * AVFMT_TS_NONSTRICT, AVFMT_TS_NEGATIVE + */ + int flags; + + /** + * List of supported codec_id-codec_tag pairs, ordered by "better + * choice first". The arrays are all terminated by AV_CODEC_ID_NONE. + */ + const struct AVCodecTag * const *codec_tag; + + + const AVClass *priv_class; ///< AVClass for the private context + + /***************************************************************** + * No fields below this line are part of the public API. They + * may not be used outside of libavformat and can be changed and + * removed at will. + * New public fields should be added right above. + ***************************************************************** + */ + struct AVOutputFormat *next; + /** + * size of private data so that it can be allocated in the wrapper + */ + int priv_data_size; + + int (*write_header)(struct AVFormatContext *); + /** + * Write a packet. If AVFMT_ALLOW_FLUSH is set in flags, + * pkt can be NULL in order to flush data buffered in the muxer. + * When flushing, return 0 if there still is more data to flush, + * or 1 if everything was flushed and there is no more buffered + * data. + */ + int (*write_packet)(struct AVFormatContext *, AVPacket *pkt); + int (*write_trailer)(struct AVFormatContext *); + /** + * Currently only used to set pixel format if not YUV420P. + */ + int (*interleave_packet)(struct AVFormatContext *, AVPacket *out, + AVPacket *in, int flush); + /** + * Test if the given codec can be stored in this container. + * + * @return 1 if the codec is supported, 0 if it is not. + * A negative number if unknown. + * MKTAG('A', 'P', 'I', 'C') if the codec is only supported as AV_DISPOSITION_ATTACHED_PIC + */ + int (*query_codec)(enum AVCodecID id, int std_compliance); + + void (*get_output_timestamp)(struct AVFormatContext *s, int stream, + int64_t *dts, int64_t *wall); + /** + * Allows sending messages from application to device. + */ + int (*control_message)(struct AVFormatContext *s, int type, + void *data, size_t data_size); + + /** + * Write an uncoded AVFrame. + * + * See av_write_uncoded_frame() for details. + * + * The library will free *frame afterwards, but the muxer can prevent it + * by setting the pointer to NULL. + */ + int (*write_uncoded_frame)(struct AVFormatContext *, int stream_index, + AVFrame **frame, unsigned flags); + /** + * Returns device list with it properties. + * @see avdevice_list_devices() for more details. + */ + int (*get_device_list)(struct AVFormatContext *s, struct AVDeviceInfoList *device_list); + /** + * Initialize device capabilities submodule. + * @see avdevice_capabilities_create() for more details. + */ + int (*create_device_capabilities)(struct AVFormatContext *s, struct AVDeviceCapabilitiesQuery *caps); + /** + * Free device capabilities submodule. + * @see avdevice_capabilities_free() for more details. + */ + int (*free_device_capabilities)(struct AVFormatContext *s, struct AVDeviceCapabilitiesQuery *caps); + enum AVCodecID data_codec; /**< default data codec */ + /** + * Initialize format. May allocate data here, and set any AVFormatContext or + * AVStream parameters that need to be set before packets are sent. + * This method must not write output. + * + * Return 0 if streams were fully configured, 1 if not, negative AVERROR on failure + * + * Any allocations made here must be freed in deinit(). + */ + int (*init)(struct AVFormatContext *); + /** + * Deinitialize format. If present, this is called whenever the muxer is being + * destroyed, regardless of whether or not the header has been written. + * + * If a trailer is being written, this is called after write_trailer(). + * + * This is called if init() fails as well. + */ + void (*deinit)(struct AVFormatContext *); + /** + * Set up any necessary bitstream filtering and extract any extra data needed + * for the global header. + * Return 0 if more packets from this stream must be checked; 1 if not. + */ + int (*check_bitstream)(struct AVFormatContext *, const AVPacket *pkt); +} AVOutputFormat; +/** + * @} + */ + +/** + * @addtogroup lavf_decoding + * @{ + */ +typedef struct AVInputFormat { + /** + * A comma separated list of short names for the format. New names + * may be appended with a minor bump. + */ + const char *name; + + /** + * Descriptive name for the format, meant to be more human-readable + * than name. You should use the NULL_IF_CONFIG_SMALL() macro + * to define it. + */ + const char *long_name; + + /** + * Can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_SHOW_IDS, + * AVFMT_GENERIC_INDEX, AVFMT_TS_DISCONT, AVFMT_NOBINSEARCH, + * AVFMT_NOGENSEARCH, AVFMT_NO_BYTE_SEEK, AVFMT_SEEK_TO_PTS. + */ + int flags; + + /** + * If extensions are defined, then no probe is done. You should + * usually not use extension format guessing because it is not + * reliable enough + */ + const char *extensions; + + const struct AVCodecTag * const *codec_tag; + + const AVClass *priv_class; ///< AVClass for the private context + + /** + * Comma-separated list of mime types. + * It is used check for matching mime types while probing. + * @see av_probe_input_format2 + */ + const char *mime_type; + + /***************************************************************** + * No fields below this line are part of the public API. They + * may not be used outside of libavformat and can be changed and + * removed at will. + * New public fields should be added right above. + ***************************************************************** + */ + struct AVInputFormat *next; + + /** + * Raw demuxers store their codec ID here. + */ + int raw_codec_id; + + /** + * Size of private data so that it can be allocated in the wrapper. + */ + int priv_data_size; + + /** + * Tell if a given file has a chance of being parsed as this format. + * The buffer provided is guaranteed to be AVPROBE_PADDING_SIZE bytes + * big so you do not have to check for that unless you need more. + */ + int (*read_probe)(AVProbeData *); + + /** + * Read the format header and initialize the AVFormatContext + * structure. Return 0 if OK. 'avformat_new_stream' should be + * called to create new streams. + */ + int (*read_header)(struct AVFormatContext *); + + /** + * Read one packet and put it in 'pkt'. pts and flags are also + * set. 'avformat_new_stream' can be called only if the flag + * AVFMTCTX_NOHEADER is used and only in the calling thread (not in a + * background thread). + * @return 0 on success, < 0 on error. + * When returning an error, pkt must not have been allocated + * or must be freed before returning + */ + int (*read_packet)(struct AVFormatContext *, AVPacket *pkt); + + /** + * Close the stream. The AVFormatContext and AVStreams are not + * freed by this function + */ + int (*read_close)(struct AVFormatContext *); + + /** + * Seek to a given timestamp relative to the frames in + * stream component stream_index. + * @param stream_index Must not be -1. + * @param flags Selects which direction should be preferred if no exact + * match is available. + * @return >= 0 on success (but not necessarily the new offset) + */ + int (*read_seek)(struct AVFormatContext *, + int stream_index, int64_t timestamp, int flags); + + /** + * Get the next timestamp in stream[stream_index].time_base units. + * @return the timestamp or AV_NOPTS_VALUE if an error occurred + */ + int64_t (*read_timestamp)(struct AVFormatContext *s, int stream_index, + int64_t *pos, int64_t pos_limit); + + /** + * Start/resume playing - only meaningful if using a network-based format + * (RTSP). + */ + int (*read_play)(struct AVFormatContext *); + + /** + * Pause playing - only meaningful if using a network-based format + * (RTSP). + */ + int (*read_pause)(struct AVFormatContext *); + + /** + * Seek to timestamp ts. + * Seeking will be done so that the point from which all active streams + * can be presented successfully will be closest to ts and within min/max_ts. + * Active streams are all streams that have AVStream.discard < AVDISCARD_ALL. + */ + int (*read_seek2)(struct AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags); + + /** + * Returns device list with it properties. + * @see avdevice_list_devices() for more details. + */ + int (*get_device_list)(struct AVFormatContext *s, struct AVDeviceInfoList *device_list); + + /** + * Initialize device capabilities submodule. + * @see avdevice_capabilities_create() for more details. + */ + int (*create_device_capabilities)(struct AVFormatContext *s, struct AVDeviceCapabilitiesQuery *caps); + + /** + * Free device capabilities submodule. + * @see avdevice_capabilities_free() for more details. + */ + int (*free_device_capabilities)(struct AVFormatContext *s, struct AVDeviceCapabilitiesQuery *caps); +} AVInputFormat; +/** + * @} + */ + +enum AVStreamParseType { + AVSTREAM_PARSE_NONE, + AVSTREAM_PARSE_FULL, /**< full parsing and repack */ + AVSTREAM_PARSE_HEADERS, /**< Only parse headers, do not repack. */ + AVSTREAM_PARSE_TIMESTAMPS, /**< full parsing and interpolation of timestamps for frames not starting on a packet boundary */ + AVSTREAM_PARSE_FULL_ONCE, /**< full parsing and repack of the first frame only, only implemented for H.264 currently */ + AVSTREAM_PARSE_FULL_RAW, /**< full parsing and repack with timestamp and position generation by parser for raw + this assumes that each packet in the file contains no demuxer level headers and + just codec level data, otherwise position generation would fail */ +}; + +typedef struct AVIndexEntry { + int64_t pos; + int64_t timestamp; /**< + * Timestamp in AVStream.time_base units, preferably the time from which on correctly decoded frames are available + * when seeking to this entry. That means preferable PTS on keyframe based formats. + * But demuxers can choose to store a different timestamp, if it is more convenient for the implementation or nothing better + * is known + */ +#define AVINDEX_KEYFRAME 0x0001 +#define AVINDEX_DISCARD_FRAME 0x0002 /** + * Flag is used to indicate which frame should be discarded after decoding. + */ + int flags:2; + int size:30; //Yeah, trying to keep the size of this small to reduce memory requirements (it is 24 vs. 32 bytes due to possible 8-byte alignment). + int min_distance; /**< Minimum distance between this and the previous keyframe, used to avoid unneeded searching. */ +} AVIndexEntry; + +#define AV_DISPOSITION_DEFAULT 0x0001 +#define AV_DISPOSITION_DUB 0x0002 +#define AV_DISPOSITION_ORIGINAL 0x0004 +#define AV_DISPOSITION_COMMENT 0x0008 +#define AV_DISPOSITION_LYRICS 0x0010 +#define AV_DISPOSITION_KARAOKE 0x0020 + +/** + * Track should be used during playback by default. + * Useful for subtitle track that should be displayed + * even when user did not explicitly ask for subtitles. + */ +#define AV_DISPOSITION_FORCED 0x0040 +#define AV_DISPOSITION_HEARING_IMPAIRED 0x0080 /**< stream for hearing impaired audiences */ +#define AV_DISPOSITION_VISUAL_IMPAIRED 0x0100 /**< stream for visual impaired audiences */ +#define AV_DISPOSITION_CLEAN_EFFECTS 0x0200 /**< stream without voice */ +/** + * The stream is stored in the file as an attached picture/"cover art" (e.g. + * APIC frame in ID3v2). The first (usually only) packet associated with it + * will be returned among the first few packets read from the file unless + * seeking takes place. It can also be accessed at any time in + * AVStream.attached_pic. + */ +#define AV_DISPOSITION_ATTACHED_PIC 0x0400 +/** + * The stream is sparse, and contains thumbnail images, often corresponding + * to chapter markers. Only ever used with AV_DISPOSITION_ATTACHED_PIC. + */ +#define AV_DISPOSITION_TIMED_THUMBNAILS 0x0800 + +typedef struct AVStreamInternal AVStreamInternal; + +/** + * To specify text track kind (different from subtitles default). + */ +#define AV_DISPOSITION_CAPTIONS 0x10000 +#define AV_DISPOSITION_DESCRIPTIONS 0x20000 +#define AV_DISPOSITION_METADATA 0x40000 +#define AV_DISPOSITION_DEPENDENT 0x80000 ///< dependent audio stream (mix_type=0 in mpegts) + +/** + * Options for behavior on timestamp wrap detection. + */ +#define AV_PTS_WRAP_IGNORE 0 ///< ignore the wrap +#define AV_PTS_WRAP_ADD_OFFSET 1 ///< add the format specific offset on wrap detection +#define AV_PTS_WRAP_SUB_OFFSET -1 ///< subtract the format specific offset on wrap detection + +/** + * Stream structure. + * New fields can be added to the end with minor version bumps. + * Removal, reordering and changes to existing fields require a major + * version bump. + * sizeof(AVStream) must not be used outside libav*. + */ +typedef struct AVStream { + int index; /**< stream index in AVFormatContext */ + /** + * Format-specific stream ID. + * decoding: set by libavformat + * encoding: set by the user, replaced by libavformat if left unset + */ + int id; +#if FF_API_LAVF_AVCTX + /** + * @deprecated use the codecpar struct instead + */ + attribute_deprecated + AVCodecContext *codec; +#endif + void *priv_data; + + /** + * This is the fundamental unit of time (in seconds) in terms + * of which frame timestamps are represented. + * + * decoding: set by libavformat + * encoding: May be set by the caller before avformat_write_header() to + * provide a hint to the muxer about the desired timebase. In + * avformat_write_header(), the muxer will overwrite this field + * with the timebase that will actually be used for the timestamps + * written into the file (which may or may not be related to the + * user-provided one, depending on the format). + */ + AVRational time_base; + + /** + * Decoding: pts of the first frame of the stream in presentation order, in stream time base. + * Only set this if you are absolutely 100% sure that the value you set + * it to really is the pts of the first frame. + * This may be undefined (AV_NOPTS_VALUE). + * @note The ASF header does NOT contain a correct start_time the ASF + * demuxer must NOT set this. + */ + int64_t start_time; + + /** + * Decoding: duration of the stream, in stream time base. + * If a source file does not specify a duration, but does specify + * a bitrate, this value will be estimated from bitrate and file size. + * + * Encoding: May be set by the caller before avformat_write_header() to + * provide a hint to the muxer about the estimated duration. + */ + int64_t duration; + + int64_t nb_frames; ///< number of frames in this stream if known or 0 + + int disposition; /**< AV_DISPOSITION_* bit field */ + + enum AVDiscard discard; ///< Selects which packets can be discarded at will and do not need to be demuxed. + + /** + * sample aspect ratio (0 if unknown) + * - encoding: Set by user. + * - decoding: Set by libavformat. + */ + AVRational sample_aspect_ratio; + + AVDictionary *metadata; + + /** + * Average framerate + * + * - demuxing: May be set by libavformat when creating the stream or in + * avformat_find_stream_info(). + * - muxing: May be set by the caller before avformat_write_header(). + */ + AVRational avg_frame_rate; + + /** + * For streams with AV_DISPOSITION_ATTACHED_PIC disposition, this packet + * will contain the attached picture. + * + * decoding: set by libavformat, must not be modified by the caller. + * encoding: unused + */ + AVPacket attached_pic; + + /** + * An array of side data that applies to the whole stream (i.e. the + * container does not allow it to change between packets). + * + * There may be no overlap between the side data in this array and side data + * in the packets. I.e. a given side data is either exported by the muxer + * (demuxing) / set by the caller (muxing) in this array, then it never + * appears in the packets, or the side data is exported / sent through + * the packets (always in the first packet where the value becomes known or + * changes), then it does not appear in this array. + * + * - demuxing: Set by libavformat when the stream is created. + * - muxing: May be set by the caller before avformat_write_header(). + * + * Freed by libavformat in avformat_free_context(). + * + * @see av_format_inject_global_side_data() + */ + AVPacketSideData *side_data; + /** + * The number of elements in the AVStream.side_data array. + */ + int nb_side_data; + + /** + * Flags for the user to detect events happening on the stream. Flags must + * be cleared by the user once the event has been handled. + * A combination of AVSTREAM_EVENT_FLAG_*. + */ + int event_flags; +#define AVSTREAM_EVENT_FLAG_METADATA_UPDATED 0x0001 ///< The call resulted in updated metadata. + + /** + * Real base framerate of the stream. + * This is the lowest framerate with which all timestamps can be + * represented accurately (it is the least common multiple of all + * framerates in the stream). Note, this value is just a guess! + * For example, if the time base is 1/90000 and all frames have either + * approximately 3600 or 1800 timer ticks, then r_frame_rate will be 50/1. + */ + AVRational r_frame_rate; + +#if FF_API_LAVF_FFSERVER + /** + * String containing pairs of key and values describing recommended encoder configuration. + * Pairs are separated by ','. + * Keys are separated from values by '='. + * + * @deprecated unused + */ + attribute_deprecated + char *recommended_encoder_configuration; +#endif + + /** + * Codec parameters associated with this stream. Allocated and freed by + * libavformat in avformat_new_stream() and avformat_free_context() + * respectively. + * + * - demuxing: filled by libavformat on stream creation or in + * avformat_find_stream_info() + * - muxing: filled by the caller before avformat_write_header() + */ + AVCodecParameters *codecpar; + + /***************************************************************** + * All fields below this line are not part of the public API. They + * may not be used outside of libavformat and can be changed and + * removed at will. + * Internal note: be aware that physically removing these fields + * will break ABI. Replace removed fields with dummy fields, and + * add new fields to AVStreamInternal. + ***************************************************************** + */ + +#define MAX_STD_TIMEBASES (30*12+30+3+6) + /** + * Stream information used internally by avformat_find_stream_info() + */ + struct { + int64_t last_dts; + int64_t duration_gcd; + int duration_count; + int64_t rfps_duration_sum; + double (*duration_error)[2][MAX_STD_TIMEBASES]; + int64_t codec_info_duration; + int64_t codec_info_duration_fields; + int frame_delay_evidence; + + /** + * 0 -> decoder has not been searched for yet. + * >0 -> decoder found + * <0 -> decoder with codec_id == -found_decoder has not been found + */ + int found_decoder; + + int64_t last_duration; + + /** + * Those are used for average framerate estimation. + */ + int64_t fps_first_dts; + int fps_first_dts_idx; + int64_t fps_last_dts; + int fps_last_dts_idx; + + } *info; + + int pts_wrap_bits; /**< number of bits in pts (used for wrapping control) */ + + // Timestamp generation support: + /** + * Timestamp corresponding to the last dts sync point. + * + * Initialized when AVCodecParserContext.dts_sync_point >= 0 and + * a DTS is received from the underlying container. Otherwise set to + * AV_NOPTS_VALUE by default. + */ + int64_t first_dts; + int64_t cur_dts; + int64_t last_IP_pts; + int last_IP_duration; + + /** + * Number of packets to buffer for codec probing + */ + int probe_packets; + + /** + * Number of frames that have been demuxed during avformat_find_stream_info() + */ + int codec_info_nb_frames; + + /* av_read_frame() support */ + enum AVStreamParseType need_parsing; + struct AVCodecParserContext *parser; + + /** + * last packet in packet_buffer for this stream when muxing. + */ + struct AVPacketList *last_in_packet_buffer; + AVProbeData probe_data; +#define MAX_REORDER_DELAY 16 + int64_t pts_buffer[MAX_REORDER_DELAY+1]; + + AVIndexEntry *index_entries; /**< Only used if the format does not + support seeking natively. */ + int nb_index_entries; + unsigned int index_entries_allocated_size; + + /** + * Stream Identifier + * This is the MPEG-TS stream identifier +1 + * 0 means unknown + */ + int stream_identifier; + + int64_t interleaver_chunk_size; + int64_t interleaver_chunk_duration; + + /** + * stream probing state + * -1 -> probing finished + * 0 -> no probing requested + * rest -> perform probing with request_probe being the minimum score to accept. + * NOT PART OF PUBLIC API + */ + int request_probe; + /** + * Indicates that everything up to the next keyframe + * should be discarded. + */ + int skip_to_keyframe; + + /** + * Number of samples to skip at the start of the frame decoded from the next packet. + */ + int skip_samples; + + /** + * If not 0, the number of samples that should be skipped from the start of + * the stream (the samples are removed from packets with pts==0, which also + * assumes negative timestamps do not happen). + * Intended for use with formats such as mp3 with ad-hoc gapless audio + * support. + */ + int64_t start_skip_samples; + + /** + * If not 0, the first audio sample that should be discarded from the stream. + * This is broken by design (needs global sample count), but can't be + * avoided for broken by design formats such as mp3 with ad-hoc gapless + * audio support. + */ + int64_t first_discard_sample; + + /** + * The sample after last sample that is intended to be discarded after + * first_discard_sample. Works on frame boundaries only. Used to prevent + * early EOF if the gapless info is broken (considered concatenated mp3s). + */ + int64_t last_discard_sample; + + /** + * Number of internally decoded frames, used internally in libavformat, do not access + * its lifetime differs from info which is why it is not in that structure. + */ + int nb_decoded_frames; + + /** + * Timestamp offset added to timestamps before muxing + * NOT PART OF PUBLIC API + */ + int64_t mux_ts_offset; + + /** + * Internal data to check for wrapping of the time stamp + */ + int64_t pts_wrap_reference; + + /** + * Options for behavior, when a wrap is detected. + * + * Defined by AV_PTS_WRAP_ values. + * + * If correction is enabled, there are two possibilities: + * If the first time stamp is near the wrap point, the wrap offset + * will be subtracted, which will create negative time stamps. + * Otherwise the offset will be added. + */ + int pts_wrap_behavior; + + /** + * Internal data to prevent doing update_initial_durations() twice + */ + int update_initial_durations_done; + + /** + * Internal data to generate dts from pts + */ + int64_t pts_reorder_error[MAX_REORDER_DELAY+1]; + uint8_t pts_reorder_error_count[MAX_REORDER_DELAY+1]; + + /** + * Internal data to analyze DTS and detect faulty mpeg streams + */ + int64_t last_dts_for_order_check; + uint8_t dts_ordered; + uint8_t dts_misordered; + + /** + * Internal data to inject global side data + */ + int inject_global_side_data; + + /** + * display aspect ratio (0 if unknown) + * - encoding: unused + * - decoding: Set by libavformat to calculate sample_aspect_ratio internally + */ + AVRational display_aspect_ratio; + + /** + * An opaque field for libavformat internal usage. + * Must not be accessed in any way by callers. + */ + AVStreamInternal *internal; +} AVStream; + +#if FF_API_FORMAT_GET_SET +/** + * Accessors for some AVStream fields. These used to be provided for ABI + * compatibility, and do not need to be used anymore. + */ +attribute_deprecated +AVRational av_stream_get_r_frame_rate(const AVStream *s); +attribute_deprecated +void av_stream_set_r_frame_rate(AVStream *s, AVRational r); +#if FF_API_LAVF_FFSERVER +attribute_deprecated +char* av_stream_get_recommended_encoder_configuration(const AVStream *s); +attribute_deprecated +void av_stream_set_recommended_encoder_configuration(AVStream *s, char *configuration); +#endif +#endif + +struct AVCodecParserContext *av_stream_get_parser(const AVStream *s); + +/** + * Returns the pts of the last muxed packet + its duration + * + * the retuned value is undefined when used with a demuxer. + */ +int64_t av_stream_get_end_pts(const AVStream *st); + +#define AV_PROGRAM_RUNNING 1 + +/** + * New fields can be added to the end with minor version bumps. + * Removal, reordering and changes to existing fields require a major + * version bump. + * sizeof(AVProgram) must not be used outside libav*. + */ +typedef struct AVProgram { + int id; + int flags; + enum AVDiscard discard; ///< selects which program to discard and which to feed to the caller + unsigned int *stream_index; + unsigned int nb_stream_indexes; + AVDictionary *metadata; + + int program_num; + int pmt_pid; + int pcr_pid; + + /***************************************************************** + * All fields below this line are not part of the public API. They + * may not be used outside of libavformat and can be changed and + * removed at will. + * New public fields should be added right above. + ***************************************************************** + */ + int64_t start_time; + int64_t end_time; + + int64_t pts_wrap_reference; ///< reference dts for wrap detection + int pts_wrap_behavior; ///< behavior on wrap detection +} AVProgram; + +#define AVFMTCTX_NOHEADER 0x0001 /**< signal that no header is present + (streams are added dynamically) */ +#define AVFMTCTX_UNSEEKABLE 0x0002 /**< signal that the stream is definitely + not seekable, and attempts to call the + seek function will fail. For some + network protocols (e.g. HLS), this can + change dynamically at runtime. */ + +typedef struct AVChapter { + int id; ///< unique ID to identify the chapter + AVRational time_base; ///< time base in which the start/end timestamps are specified + int64_t start, end; ///< chapter start/end time in time_base units + AVDictionary *metadata; +} AVChapter; + + +/** + * Callback used by devices to communicate with application. + */ +typedef int (*av_format_control_message)(struct AVFormatContext *s, int type, + void *data, size_t data_size); + +typedef int (*AVOpenCallback)(struct AVFormatContext *s, AVIOContext **pb, const char *url, int flags, + const AVIOInterruptCB *int_cb, AVDictionary **options); + +/** + * The duration of a video can be estimated through various ways, and this enum can be used + * to know how the duration was estimated. + */ +enum AVDurationEstimationMethod { + AVFMT_DURATION_FROM_PTS, ///< Duration accurately estimated from PTSes + AVFMT_DURATION_FROM_STREAM, ///< Duration estimated from a stream with a known duration + AVFMT_DURATION_FROM_BITRATE ///< Duration estimated from bitrate (less accurate) +}; + +typedef struct AVFormatInternal AVFormatInternal; + +/** + * Format I/O context. + * New fields can be added to the end with minor version bumps. + * Removal, reordering and changes to existing fields require a major + * version bump. + * sizeof(AVFormatContext) must not be used outside libav*, use + * avformat_alloc_context() to create an AVFormatContext. + * + * Fields can be accessed through AVOptions (av_opt*), + * the name string used matches the associated command line parameter name and + * can be found in libavformat/options_table.h. + * The AVOption/command line parameter names differ in some cases from the C + * structure field names for historic reasons or brevity. + */ +typedef struct AVFormatContext { + /** + * A class for logging and @ref avoptions. Set by avformat_alloc_context(). + * Exports (de)muxer private options if they exist. + */ + const AVClass *av_class; + + /** + * The input container format. + * + * Demuxing only, set by avformat_open_input(). + */ + struct AVInputFormat *iformat; + + /** + * The output container format. + * + * Muxing only, must be set by the caller before avformat_write_header(). + */ + struct AVOutputFormat *oformat; + + /** + * Format private data. This is an AVOptions-enabled struct + * if and only if iformat/oformat.priv_class is not NULL. + * + * - muxing: set by avformat_write_header() + * - demuxing: set by avformat_open_input() + */ + void *priv_data; + + /** + * I/O context. + * + * - demuxing: either set by the user before avformat_open_input() (then + * the user must close it manually) or set by avformat_open_input(). + * - muxing: set by the user before avformat_write_header(). The caller must + * take care of closing / freeing the IO context. + * + * Do NOT set this field if AVFMT_NOFILE flag is set in + * iformat/oformat.flags. In such a case, the (de)muxer will handle + * I/O in some other way and this field will be NULL. + */ + AVIOContext *pb; + + /* stream info */ + /** + * Flags signalling stream properties. A combination of AVFMTCTX_*. + * Set by libavformat. + */ + int ctx_flags; + + /** + * Number of elements in AVFormatContext.streams. + * + * Set by avformat_new_stream(), must not be modified by any other code. + */ + unsigned int nb_streams; + /** + * A list of all streams in the file. New streams are created with + * avformat_new_stream(). + * + * - demuxing: streams are created by libavformat in avformat_open_input(). + * If AVFMTCTX_NOHEADER is set in ctx_flags, then new streams may also + * appear in av_read_frame(). + * - muxing: streams are created by the user before avformat_write_header(). + * + * Freed by libavformat in avformat_free_context(). + */ + AVStream **streams; + +#if FF_API_FORMAT_FILENAME + /** + * input or output filename + * + * - demuxing: set by avformat_open_input() + * - muxing: may be set by the caller before avformat_write_header() + * + * @deprecated Use url instead. + */ + attribute_deprecated + char filename[1024]; +#endif + + /** + * input or output URL. Unlike the old filename field, this field has no + * length restriction. + * + * - demuxing: set by avformat_open_input(), initialized to an empty + * string if url parameter was NULL in avformat_open_input(). + * - muxing: may be set by the caller before calling avformat_write_header() + * (or avformat_init_output() if that is called first) to a string + * which is freeable by av_free(). Set to an empty string if it + * was NULL in avformat_init_output(). + * + * Freed by libavformat in avformat_free_context(). + */ + char *url; + + /** + * Position of the first frame of the component, in + * AV_TIME_BASE fractional seconds. NEVER set this value directly: + * It is deduced from the AVStream values. + * + * Demuxing only, set by libavformat. + */ + int64_t start_time; + + /** + * Duration of the stream, in AV_TIME_BASE fractional + * seconds. Only set this value if you know none of the individual stream + * durations and also do not set any of them. This is deduced from the + * AVStream values if not set. + * + * Demuxing only, set by libavformat. + */ + int64_t duration; + + /** + * Total stream bitrate in bit/s, 0 if not + * available. Never set it directly if the file_size and the + * duration are known as FFmpeg can compute it automatically. + */ + int64_t bit_rate; + + unsigned int packet_size; + int max_delay; + + /** + * Flags modifying the (de)muxer behaviour. A combination of AVFMT_FLAG_*. + * Set by the user before avformat_open_input() / avformat_write_header(). + */ + int flags; +#define AVFMT_FLAG_GENPTS 0x0001 ///< Generate missing pts even if it requires parsing future frames. +#define AVFMT_FLAG_IGNIDX 0x0002 ///< Ignore index. +#define AVFMT_FLAG_NONBLOCK 0x0004 ///< Do not block when reading packets from input. +#define AVFMT_FLAG_IGNDTS 0x0008 ///< Ignore DTS on frames that contain both DTS & PTS +#define AVFMT_FLAG_NOFILLIN 0x0010 ///< Do not infer any values from other values, just return what is stored in the container +#define AVFMT_FLAG_NOPARSE 0x0020 ///< Do not use AVParsers, you also must set AVFMT_FLAG_NOFILLIN as the fillin code works on frames and no parsing -> no frames. Also seeking to frames can not work if parsing to find frame boundaries has been disabled +#define AVFMT_FLAG_NOBUFFER 0x0040 ///< Do not buffer frames when possible +#define AVFMT_FLAG_CUSTOM_IO 0x0080 ///< The caller has supplied a custom AVIOContext, don't avio_close() it. +#define AVFMT_FLAG_DISCARD_CORRUPT 0x0100 ///< Discard frames marked corrupted +#define AVFMT_FLAG_FLUSH_PACKETS 0x0200 ///< Flush the AVIOContext every packet. +/** + * When muxing, try to avoid writing any random/volatile data to the output. + * This includes any random IDs, real-time timestamps/dates, muxer version, etc. + * + * This flag is mainly intended for testing. + */ +#define AVFMT_FLAG_BITEXACT 0x0400 +#define AVFMT_FLAG_MP4A_LATM 0x8000 ///< Enable RTP MP4A-LATM payload +#define AVFMT_FLAG_SORT_DTS 0x10000 ///< try to interleave outputted packets by dts (using this flag can slow demuxing down) +#define AVFMT_FLAG_PRIV_OPT 0x20000 ///< Enable use of private options by delaying codec open (this could be made default once all code is converted) +#if FF_API_LAVF_KEEPSIDE_FLAG +#define AVFMT_FLAG_KEEP_SIDE_DATA 0x40000 ///< Deprecated, does nothing. +#endif +#define AVFMT_FLAG_FAST_SEEK 0x80000 ///< Enable fast, but inaccurate seeks for some formats +#define AVFMT_FLAG_SHORTEST 0x100000 ///< Stop muxing when the shortest stream stops. +#define AVFMT_FLAG_AUTO_BSF 0x200000 ///< Add bitstream filters as requested by the muxer + + /** + * Maximum size of the data read from input for determining + * the input container format. + * Demuxing only, set by the caller before avformat_open_input(). + */ + int64_t probesize; + + /** + * Maximum duration (in AV_TIME_BASE units) of the data read + * from input in avformat_find_stream_info(). + * Demuxing only, set by the caller before avformat_find_stream_info(). + * Can be set to 0 to let avformat choose using a heuristic. + */ + int64_t max_analyze_duration; + + const uint8_t *key; + int keylen; + + unsigned int nb_programs; + AVProgram **programs; + + /** + * Forced video codec_id. + * Demuxing: Set by user. + */ + enum AVCodecID video_codec_id; + + /** + * Forced audio codec_id. + * Demuxing: Set by user. + */ + enum AVCodecID audio_codec_id; + + /** + * Forced subtitle codec_id. + * Demuxing: Set by user. + */ + enum AVCodecID subtitle_codec_id; + + /** + * Maximum amount of memory in bytes to use for the index of each stream. + * If the index exceeds this size, entries will be discarded as + * needed to maintain a smaller size. This can lead to slower or less + * accurate seeking (depends on demuxer). + * Demuxers for which a full in-memory index is mandatory will ignore + * this. + * - muxing: unused + * - demuxing: set by user + */ + unsigned int max_index_size; + + /** + * Maximum amount of memory in bytes to use for buffering frames + * obtained from realtime capture devices. + */ + unsigned int max_picture_buffer; + + /** + * Number of chapters in AVChapter array. + * When muxing, chapters are normally written in the file header, + * so nb_chapters should normally be initialized before write_header + * is called. Some muxers (e.g. mov and mkv) can also write chapters + * in the trailer. To write chapters in the trailer, nb_chapters + * must be zero when write_header is called and non-zero when + * write_trailer is called. + * - muxing: set by user + * - demuxing: set by libavformat + */ + unsigned int nb_chapters; + AVChapter **chapters; + + /** + * Metadata that applies to the whole file. + * + * - demuxing: set by libavformat in avformat_open_input() + * - muxing: may be set by the caller before avformat_write_header() + * + * Freed by libavformat in avformat_free_context(). + */ + AVDictionary *metadata; + + /** + * Start time of the stream in real world time, in microseconds + * since the Unix epoch (00:00 1st January 1970). That is, pts=0 in the + * stream was captured at this real world time. + * - muxing: Set by the caller before avformat_write_header(). If set to + * either 0 or AV_NOPTS_VALUE, then the current wall-time will + * be used. + * - demuxing: Set by libavformat. AV_NOPTS_VALUE if unknown. Note that + * the value may become known after some number of frames + * have been received. + */ + int64_t start_time_realtime; + + /** + * The number of frames used for determining the framerate in + * avformat_find_stream_info(). + * Demuxing only, set by the caller before avformat_find_stream_info(). + */ + int fps_probe_size; + + /** + * Error recognition; higher values will detect more errors but may + * misdetect some more or less valid parts as errors. + * Demuxing only, set by the caller before avformat_open_input(). + */ + int error_recognition; + + /** + * Custom interrupt callbacks for the I/O layer. + * + * demuxing: set by the user before avformat_open_input(). + * muxing: set by the user before avformat_write_header() + * (mainly useful for AVFMT_NOFILE formats). The callback + * should also be passed to avio_open2() if it's used to + * open the file. + */ + AVIOInterruptCB interrupt_callback; + + /** + * Flags to enable debugging. + */ + int debug; +#define FF_FDEBUG_TS 0x0001 + + /** + * Maximum buffering duration for interleaving. + * + * To ensure all the streams are interleaved correctly, + * av_interleaved_write_frame() will wait until it has at least one packet + * for each stream before actually writing any packets to the output file. + * When some streams are "sparse" (i.e. there are large gaps between + * successive packets), this can result in excessive buffering. + * + * This field specifies the maximum difference between the timestamps of the + * first and the last packet in the muxing queue, above which libavformat + * will output a packet regardless of whether it has queued a packet for all + * the streams. + * + * Muxing only, set by the caller before avformat_write_header(). + */ + int64_t max_interleave_delta; + + /** + * Allow non-standard and experimental extension + * @see AVCodecContext.strict_std_compliance + */ + int strict_std_compliance; + + /** + * Flags for the user to detect events happening on the file. Flags must + * be cleared by the user once the event has been handled. + * A combination of AVFMT_EVENT_FLAG_*. + */ + int event_flags; +#define AVFMT_EVENT_FLAG_METADATA_UPDATED 0x0001 ///< The call resulted in updated metadata. + + /** + * Maximum number of packets to read while waiting for the first timestamp. + * Decoding only. + */ + int max_ts_probe; + + /** + * Avoid negative timestamps during muxing. + * Any value of the AVFMT_AVOID_NEG_TS_* constants. + * Note, this only works when using av_interleaved_write_frame. (interleave_packet_per_dts is in use) + * - muxing: Set by user + * - demuxing: unused + */ + int avoid_negative_ts; +#define AVFMT_AVOID_NEG_TS_AUTO -1 ///< Enabled when required by target format +#define AVFMT_AVOID_NEG_TS_MAKE_NON_NEGATIVE 1 ///< Shift timestamps so they are non negative +#define AVFMT_AVOID_NEG_TS_MAKE_ZERO 2 ///< Shift timestamps so that they start at 0 + + /** + * Transport stream id. + * This will be moved into demuxer private options. Thus no API/ABI compatibility + */ + int ts_id; + + /** + * Audio preload in microseconds. + * Note, not all formats support this and unpredictable things may happen if it is used when not supported. + * - encoding: Set by user + * - decoding: unused + */ + int audio_preload; + + /** + * Max chunk time in microseconds. + * Note, not all formats support this and unpredictable things may happen if it is used when not supported. + * - encoding: Set by user + * - decoding: unused + */ + int max_chunk_duration; + + /** + * Max chunk size in bytes + * Note, not all formats support this and unpredictable things may happen if it is used when not supported. + * - encoding: Set by user + * - decoding: unused + */ + int max_chunk_size; + + /** + * forces the use of wallclock timestamps as pts/dts of packets + * This has undefined results in the presence of B frames. + * - encoding: unused + * - decoding: Set by user + */ + int use_wallclock_as_timestamps; + + /** + * avio flags, used to force AVIO_FLAG_DIRECT. + * - encoding: unused + * - decoding: Set by user + */ + int avio_flags; + + /** + * The duration field can be estimated through various ways, and this field can be used + * to know how the duration was estimated. + * - encoding: unused + * - decoding: Read by user + */ + enum AVDurationEstimationMethod duration_estimation_method; + + /** + * Skip initial bytes when opening stream + * - encoding: unused + * - decoding: Set by user + */ + int64_t skip_initial_bytes; + + /** + * Correct single timestamp overflows + * - encoding: unused + * - decoding: Set by user + */ + unsigned int correct_ts_overflow; + + /** + * Force seeking to any (also non key) frames. + * - encoding: unused + * - decoding: Set by user + */ + int seek2any; + + /** + * Flush the I/O context after each packet. + * - encoding: Set by user + * - decoding: unused + */ + int flush_packets; + + /** + * format probing score. + * The maximal score is AVPROBE_SCORE_MAX, its set when the demuxer probes + * the format. + * - encoding: unused + * - decoding: set by avformat, read by user + */ + int probe_score; + + /** + * number of bytes to read maximally to identify format. + * - encoding: unused + * - decoding: set by user + */ + int format_probesize; + + /** + * ',' separated list of allowed decoders. + * If NULL then all are allowed + * - encoding: unused + * - decoding: set by user + */ + char *codec_whitelist; + + /** + * ',' separated list of allowed demuxers. + * If NULL then all are allowed + * - encoding: unused + * - decoding: set by user + */ + char *format_whitelist; + + /** + * An opaque field for libavformat internal usage. + * Must not be accessed in any way by callers. + */ + AVFormatInternal *internal; + + /** + * IO repositioned flag. + * This is set by avformat when the underlaying IO context read pointer + * is repositioned, for example when doing byte based seeking. + * Demuxers can use the flag to detect such changes. + */ + int io_repositioned; + + /** + * Forced video codec. + * This allows forcing a specific decoder, even when there are multiple with + * the same codec_id. + * Demuxing: Set by user + */ + AVCodec *video_codec; + + /** + * Forced audio codec. + * This allows forcing a specific decoder, even when there are multiple with + * the same codec_id. + * Demuxing: Set by user + */ + AVCodec *audio_codec; + + /** + * Forced subtitle codec. + * This allows forcing a specific decoder, even when there are multiple with + * the same codec_id. + * Demuxing: Set by user + */ + AVCodec *subtitle_codec; + + /** + * Forced data codec. + * This allows forcing a specific decoder, even when there are multiple with + * the same codec_id. + * Demuxing: Set by user + */ + AVCodec *data_codec; + + /** + * Number of bytes to be written as padding in a metadata header. + * Demuxing: Unused. + * Muxing: Set by user via av_format_set_metadata_header_padding. + */ + int metadata_header_padding; + + /** + * User data. + * This is a place for some private data of the user. + */ + void *opaque; + + /** + * Callback used by devices to communicate with application. + */ + av_format_control_message control_message_cb; + + /** + * Output timestamp offset, in microseconds. + * Muxing: set by user + */ + int64_t output_ts_offset; + + /** + * dump format separator. + * can be ", " or "\n " or anything else + * - muxing: Set by user. + * - demuxing: Set by user. + */ + uint8_t *dump_separator; + + /** + * Forced Data codec_id. + * Demuxing: Set by user. + */ + enum AVCodecID data_codec_id; + +#if FF_API_OLD_OPEN_CALLBACKS + /** + * Called to open further IO contexts when needed for demuxing. + * + * This can be set by the user application to perform security checks on + * the URLs before opening them. + * The function should behave like avio_open2(), AVFormatContext is provided + * as contextual information and to reach AVFormatContext.opaque. + * + * If NULL then some simple checks are used together with avio_open2(). + * + * Must not be accessed directly from outside avformat. + * @See av_format_set_open_cb() + * + * Demuxing: Set by user. + * + * @deprecated Use io_open and io_close. + */ + attribute_deprecated + int (*open_cb)(struct AVFormatContext *s, AVIOContext **p, const char *url, int flags, const AVIOInterruptCB *int_cb, AVDictionary **options); +#endif + + /** + * ',' separated list of allowed protocols. + * - encoding: unused + * - decoding: set by user + */ + char *protocol_whitelist; + + /** + * A callback for opening new IO streams. + * + * Whenever a muxer or a demuxer needs to open an IO stream (typically from + * avformat_open_input() for demuxers, but for certain formats can happen at + * other times as well), it will call this callback to obtain an IO context. + * + * @param s the format context + * @param pb on success, the newly opened IO context should be returned here + * @param url the url to open + * @param flags a combination of AVIO_FLAG_* + * @param options a dictionary of additional options, with the same + * semantics as in avio_open2() + * @return 0 on success, a negative AVERROR code on failure + * + * @note Certain muxers and demuxers do nesting, i.e. they open one or more + * additional internal format contexts. Thus the AVFormatContext pointer + * passed to this callback may be different from the one facing the caller. + * It will, however, have the same 'opaque' field. + */ + int (*io_open)(struct AVFormatContext *s, AVIOContext **pb, const char *url, + int flags, AVDictionary **options); + + /** + * A callback for closing the streams opened with AVFormatContext.io_open(). + */ + void (*io_close)(struct AVFormatContext *s, AVIOContext *pb); + + /** + * ',' separated list of disallowed protocols. + * - encoding: unused + * - decoding: set by user + */ + char *protocol_blacklist; + + /** + * The maximum number of streams. + * - encoding: unused + * - decoding: set by user + */ + int max_streams; +} AVFormatContext; + +#if FF_API_FORMAT_GET_SET +/** + * Accessors for some AVFormatContext fields. These used to be provided for ABI + * compatibility, and do not need to be used anymore. + */ +attribute_deprecated +int av_format_get_probe_score(const AVFormatContext *s); +attribute_deprecated +AVCodec * av_format_get_video_codec(const AVFormatContext *s); +attribute_deprecated +void av_format_set_video_codec(AVFormatContext *s, AVCodec *c); +attribute_deprecated +AVCodec * av_format_get_audio_codec(const AVFormatContext *s); +attribute_deprecated +void av_format_set_audio_codec(AVFormatContext *s, AVCodec *c); +attribute_deprecated +AVCodec * av_format_get_subtitle_codec(const AVFormatContext *s); +attribute_deprecated +void av_format_set_subtitle_codec(AVFormatContext *s, AVCodec *c); +attribute_deprecated +AVCodec * av_format_get_data_codec(const AVFormatContext *s); +attribute_deprecated +void av_format_set_data_codec(AVFormatContext *s, AVCodec *c); +attribute_deprecated +int av_format_get_metadata_header_padding(const AVFormatContext *s); +attribute_deprecated +void av_format_set_metadata_header_padding(AVFormatContext *s, int c); +attribute_deprecated +void * av_format_get_opaque(const AVFormatContext *s); +attribute_deprecated +void av_format_set_opaque(AVFormatContext *s, void *opaque); +attribute_deprecated +av_format_control_message av_format_get_control_message_cb(const AVFormatContext *s); +attribute_deprecated +void av_format_set_control_message_cb(AVFormatContext *s, av_format_control_message callback); +#if FF_API_OLD_OPEN_CALLBACKS +attribute_deprecated AVOpenCallback av_format_get_open_cb(const AVFormatContext *s); +attribute_deprecated void av_format_set_open_cb(AVFormatContext *s, AVOpenCallback callback); +#endif +#endif + +/** + * This function will cause global side data to be injected in the next packet + * of each stream as well as after any subsequent seek. + */ +void av_format_inject_global_side_data(AVFormatContext *s); + +/** + * Returns the method used to set ctx->duration. + * + * @return AVFMT_DURATION_FROM_PTS, AVFMT_DURATION_FROM_STREAM, or AVFMT_DURATION_FROM_BITRATE. + */ +enum AVDurationEstimationMethod av_fmt_ctx_get_duration_estimation_method(const AVFormatContext* ctx); + +typedef struct AVPacketList { + AVPacket pkt; + struct AVPacketList *next; +} AVPacketList; + + +/** + * @defgroup lavf_core Core functions + * @ingroup libavf + * + * Functions for querying libavformat capabilities, allocating core structures, + * etc. + * @{ + */ + +/** + * Return the LIBAVFORMAT_VERSION_INT constant. + */ +unsigned avformat_version(void); + +/** + * Return the libavformat build-time configuration. + */ +const char *avformat_configuration(void); + +/** + * Return the libavformat license. + */ +const char *avformat_license(void); + +#if FF_API_NEXT +/** + * Initialize libavformat and register all the muxers, demuxers and + * protocols. If you do not call this function, then you can select + * exactly which formats you want to support. + * + * @see av_register_input_format() + * @see av_register_output_format() + */ +attribute_deprecated +void av_register_all(void); + +attribute_deprecated +void av_register_input_format(AVInputFormat *format); +attribute_deprecated +void av_register_output_format(AVOutputFormat *format); +#endif + +/** + * Do global initialization of network libraries. This is optional, + * and not recommended anymore. + * + * This functions only exists to work around thread-safety issues + * with older GnuTLS or OpenSSL libraries. If libavformat is linked + * to newer versions of those libraries, or if you do not use them, + * calling this function is unnecessary. Otherwise, you need to call + * this function before any other threads using them are started. + * + * This function will be deprecated once support for older GnuTLS and + * OpenSSL libraries is removed, and this function has no purpose + * anymore. + */ +int avformat_network_init(void); + +/** + * Undo the initialization done by avformat_network_init. Call it only + * once for each time you called avformat_network_init. + */ +int avformat_network_deinit(void); + +#if FF_API_NEXT +/** + * If f is NULL, returns the first registered input format, + * if f is non-NULL, returns the next registered input format after f + * or NULL if f is the last one. + */ +attribute_deprecated +AVInputFormat *av_iformat_next(const AVInputFormat *f); + +/** + * If f is NULL, returns the first registered output format, + * if f is non-NULL, returns the next registered output format after f + * or NULL if f is the last one. + */ +attribute_deprecated +AVOutputFormat *av_oformat_next(const AVOutputFormat *f); +#endif + +/** + * Iterate over all registered muxers. + * + * @param opaque a pointer where libavformat will store the iteration state. Must + * point to NULL to start the iteration. + * + * @return the next registered muxer or NULL when the iteration is + * finished + */ +const AVOutputFormat *av_muxer_iterate(void **opaque); + +/** + * Iterate over all registered demuxers. + * + * @param opaque a pointer where libavformat will store the iteration state. Must + * point to NULL to start the iteration. + * + * @return the next registered demuxer or NULL when the iteration is + * finished + */ +const AVInputFormat *av_demuxer_iterate(void **opaque); + +/** + * Allocate an AVFormatContext. + * avformat_free_context() can be used to free the context and everything + * allocated by the framework within it. + */ +AVFormatContext *avformat_alloc_context(void); + +/** + * Free an AVFormatContext and all its streams. + * @param s context to free + */ +void avformat_free_context(AVFormatContext *s); + +/** + * Get the AVClass for AVFormatContext. It can be used in combination with + * AV_OPT_SEARCH_FAKE_OBJ for examining options. + * + * @see av_opt_find(). + */ +const AVClass *avformat_get_class(void); + +/** + * Add a new stream to a media file. + * + * When demuxing, it is called by the demuxer in read_header(). If the + * flag AVFMTCTX_NOHEADER is set in s.ctx_flags, then it may also + * be called in read_packet(). + * + * When muxing, should be called by the user before avformat_write_header(). + * + * User is required to call avcodec_close() and avformat_free_context() to + * clean up the allocation by avformat_new_stream(). + * + * @param s media file handle + * @param c If non-NULL, the AVCodecContext corresponding to the new stream + * will be initialized to use this codec. This is needed for e.g. codec-specific + * defaults to be set, so codec should be provided if it is known. + * + * @return newly created stream or NULL on error. + */ +AVStream *avformat_new_stream(AVFormatContext *s, const AVCodec *c); + +/** + * Wrap an existing array as stream side data. + * + * @param st stream + * @param type side information type + * @param data the side data array. It must be allocated with the av_malloc() + * family of functions. The ownership of the data is transferred to + * st. + * @param size side information size + * @return zero on success, a negative AVERROR code on failure. On failure, + * the stream is unchanged and the data remains owned by the caller. + */ +int av_stream_add_side_data(AVStream *st, enum AVPacketSideDataType type, + uint8_t *data, size_t size); + +/** + * Allocate new information from stream. + * + * @param stream stream + * @param type desired side information type + * @param size side information size + * @return pointer to fresh allocated data or NULL otherwise + */ +uint8_t *av_stream_new_side_data(AVStream *stream, + enum AVPacketSideDataType type, int size); +/** + * Get side information from stream. + * + * @param stream stream + * @param type desired side information type + * @param size pointer for side information size to store (optional) + * @return pointer to data if present or NULL otherwise + */ +uint8_t *av_stream_get_side_data(const AVStream *stream, + enum AVPacketSideDataType type, int *size); + +AVProgram *av_new_program(AVFormatContext *s, int id); + +/** + * @} + */ + + +/** + * Allocate an AVFormatContext for an output format. + * avformat_free_context() can be used to free the context and + * everything allocated by the framework within it. + * + * @param *ctx is set to the created format context, or to NULL in + * case of failure + * @param oformat format to use for allocating the context, if NULL + * format_name and filename are used instead + * @param format_name the name of output format to use for allocating the + * context, if NULL filename is used instead + * @param filename the name of the filename to use for allocating the + * context, may be NULL + * @return >= 0 in case of success, a negative AVERROR code in case of + * failure + */ +int avformat_alloc_output_context2(AVFormatContext **ctx, AVOutputFormat *oformat, + const char *format_name, const char *filename); + +/** + * @addtogroup lavf_decoding + * @{ + */ + +/** + * Find AVInputFormat based on the short name of the input format. + */ +AVInputFormat *av_find_input_format(const char *short_name); + +/** + * Guess the file format. + * + * @param pd data to be probed + * @param is_opened Whether the file is already opened; determines whether + * demuxers with or without AVFMT_NOFILE are probed. + */ +AVInputFormat *av_probe_input_format(AVProbeData *pd, int is_opened); + +/** + * Guess the file format. + * + * @param pd data to be probed + * @param is_opened Whether the file is already opened; determines whether + * demuxers with or without AVFMT_NOFILE are probed. + * @param score_max A probe score larger that this is required to accept a + * detection, the variable is set to the actual detection + * score afterwards. + * If the score is <= AVPROBE_SCORE_MAX / 4 it is recommended + * to retry with a larger probe buffer. + */ +AVInputFormat *av_probe_input_format2(AVProbeData *pd, int is_opened, int *score_max); + +/** + * Guess the file format. + * + * @param is_opened Whether the file is already opened; determines whether + * demuxers with or without AVFMT_NOFILE are probed. + * @param score_ret The score of the best detection. + */ +AVInputFormat *av_probe_input_format3(AVProbeData *pd, int is_opened, int *score_ret); + +/** + * Probe a bytestream to determine the input format. Each time a probe returns + * with a score that is too low, the probe buffer size is increased and another + * attempt is made. When the maximum probe size is reached, the input format + * with the highest score is returned. + * + * @param pb the bytestream to probe + * @param fmt the input format is put here + * @param url the url of the stream + * @param logctx the log context + * @param offset the offset within the bytestream to probe from + * @param max_probe_size the maximum probe buffer size (zero for default) + * @return the score in case of success, a negative value corresponding to an + * the maximal score is AVPROBE_SCORE_MAX + * AVERROR code otherwise + */ +int av_probe_input_buffer2(AVIOContext *pb, AVInputFormat **fmt, + const char *url, void *logctx, + unsigned int offset, unsigned int max_probe_size); + +/** + * Like av_probe_input_buffer2() but returns 0 on success + */ +int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt, + const char *url, void *logctx, + unsigned int offset, unsigned int max_probe_size); + +/** + * Open an input stream and read the header. The codecs are not opened. + * The stream must be closed with avformat_close_input(). + * + * @param ps Pointer to user-supplied AVFormatContext (allocated by avformat_alloc_context). + * May be a pointer to NULL, in which case an AVFormatContext is allocated by this + * function and written into ps. + * Note that a user-supplied AVFormatContext will be freed on failure. + * @param url URL of the stream to open. + * @param fmt If non-NULL, this parameter forces a specific input format. + * Otherwise the format is autodetected. + * @param options A dictionary filled with AVFormatContext and demuxer-private options. + * On return this parameter will be destroyed and replaced with a dict containing + * options that were not found. May be NULL. + * + * @return 0 on success, a negative AVERROR on failure. + * + * @note If you want to use custom IO, preallocate the format context and set its pb field. + */ +int avformat_open_input(AVFormatContext **ps, const char *url, AVInputFormat *fmt, AVDictionary **options); + +attribute_deprecated +int av_demuxer_open(AVFormatContext *ic); + +/** + * Read packets of a media file to get stream information. This + * is useful for file formats with no headers such as MPEG. This + * function also computes the real framerate in case of MPEG-2 repeat + * frame mode. + * The logical file position is not changed by this function; + * examined packets may be buffered for later processing. + * + * @param ic media file handle + * @param options If non-NULL, an ic.nb_streams long array of pointers to + * dictionaries, where i-th member contains options for + * codec corresponding to i-th stream. + * On return each dictionary will be filled with options that were not found. + * @return >=0 if OK, AVERROR_xxx on error + * + * @note this function isn't guaranteed to open all the codecs, so + * options being non-empty at return is a perfectly normal behavior. + * + * @todo Let the user decide somehow what information is needed so that + * we do not waste time getting stuff the user does not need. + */ +int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options); + +/** + * Find the programs which belong to a given stream. + * + * @param ic media file handle + * @param last the last found program, the search will start after this + * program, or from the beginning if it is NULL + * @param s stream index + * @return the next program which belongs to s, NULL if no program is found or + * the last program is not among the programs of ic. + */ +AVProgram *av_find_program_from_stream(AVFormatContext *ic, AVProgram *last, int s); + +void av_program_add_stream_index(AVFormatContext *ac, int progid, unsigned int idx); + +/** + * Find the "best" stream in the file. + * The best stream is determined according to various heuristics as the most + * likely to be what the user expects. + * If the decoder parameter is non-NULL, av_find_best_stream will find the + * default decoder for the stream's codec; streams for which no decoder can + * be found are ignored. + * + * @param ic media file handle + * @param type stream type: video, audio, subtitles, etc. + * @param wanted_stream_nb user-requested stream number, + * or -1 for automatic selection + * @param related_stream try to find a stream related (eg. in the same + * program) to this one, or -1 if none + * @param decoder_ret if non-NULL, returns the decoder for the + * selected stream + * @param flags flags; none are currently defined + * @return the non-negative stream number in case of success, + * AVERROR_STREAM_NOT_FOUND if no stream with the requested type + * could be found, + * AVERROR_DECODER_NOT_FOUND if streams were found but no decoder + * @note If av_find_best_stream returns successfully and decoder_ret is not + * NULL, then *decoder_ret is guaranteed to be set to a valid AVCodec. + */ +int av_find_best_stream(AVFormatContext *ic, + enum AVMediaType type, + int wanted_stream_nb, + int related_stream, + AVCodec **decoder_ret, + int flags); + +/** + * Return the next frame of a stream. + * This function returns what is stored in the file, and does not validate + * that what is there are valid frames for the decoder. It will split what is + * stored in the file into frames and return one for each call. It will not + * omit invalid data between valid frames so as to give the decoder the maximum + * information possible for decoding. + * + * If pkt->buf is NULL, then the packet is valid until the next + * av_read_frame() or until avformat_close_input(). Otherwise the packet + * is valid indefinitely. In both cases the packet must be freed with + * av_packet_unref when it is no longer needed. For video, the packet contains + * exactly one frame. For audio, it contains an integer number of frames if each + * frame has a known fixed size (e.g. PCM or ADPCM data). If the audio frames + * have a variable size (e.g. MPEG audio), then it contains one frame. + * + * pkt->pts, pkt->dts and pkt->duration are always set to correct + * values in AVStream.time_base units (and guessed if the format cannot + * provide them). pkt->pts can be AV_NOPTS_VALUE if the video format + * has B-frames, so it is better to rely on pkt->dts if you do not + * decompress the payload. + * + * @return 0 if OK, < 0 on error or end of file + */ +int av_read_frame(AVFormatContext *s, AVPacket *pkt); + +/** + * Seek to the keyframe at timestamp. + * 'timestamp' in 'stream_index'. + * + * @param s media file handle + * @param stream_index If stream_index is (-1), a default + * stream is selected, and timestamp is automatically converted + * from AV_TIME_BASE units to the stream specific time_base. + * @param timestamp Timestamp in AVStream.time_base units + * or, if no stream is specified, in AV_TIME_BASE units. + * @param flags flags which select direction and seeking mode + * @return >= 0 on success + */ +int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp, + int flags); + +/** + * Seek to timestamp ts. + * Seeking will be done so that the point from which all active streams + * can be presented successfully will be closest to ts and within min/max_ts. + * Active streams are all streams that have AVStream.discard < AVDISCARD_ALL. + * + * If flags contain AVSEEK_FLAG_BYTE, then all timestamps are in bytes and + * are the file position (this may not be supported by all demuxers). + * If flags contain AVSEEK_FLAG_FRAME, then all timestamps are in frames + * in the stream with stream_index (this may not be supported by all demuxers). + * Otherwise all timestamps are in units of the stream selected by stream_index + * or if stream_index is -1, in AV_TIME_BASE units. + * If flags contain AVSEEK_FLAG_ANY, then non-keyframes are treated as + * keyframes (this may not be supported by all demuxers). + * If flags contain AVSEEK_FLAG_BACKWARD, it is ignored. + * + * @param s media file handle + * @param stream_index index of the stream which is used as time base reference + * @param min_ts smallest acceptable timestamp + * @param ts target timestamp + * @param max_ts largest acceptable timestamp + * @param flags flags + * @return >=0 on success, error code otherwise + * + * @note This is part of the new seek API which is still under construction. + * Thus do not use this yet. It may change at any time, do not expect + * ABI compatibility yet! + */ +int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags); + +/** + * Discard all internally buffered data. This can be useful when dealing with + * discontinuities in the byte stream. Generally works only with formats that + * can resync. This includes headerless formats like MPEG-TS/TS but should also + * work with NUT, Ogg and in a limited way AVI for example. + * + * The set of streams, the detected duration, stream parameters and codecs do + * not change when calling this function. If you want a complete reset, it's + * better to open a new AVFormatContext. + * + * This does not flush the AVIOContext (s->pb). If necessary, call + * avio_flush(s->pb) before calling this function. + * + * @param s media file handle + * @return >=0 on success, error code otherwise + */ +int avformat_flush(AVFormatContext *s); + +/** + * Start playing a network-based stream (e.g. RTSP stream) at the + * current position. + */ +int av_read_play(AVFormatContext *s); + +/** + * Pause a network-based stream (e.g. RTSP stream). + * + * Use av_read_play() to resume it. + */ +int av_read_pause(AVFormatContext *s); + +/** + * Close an opened input AVFormatContext. Free it and all its contents + * and set *s to NULL. + */ +void avformat_close_input(AVFormatContext **s); +/** + * @} + */ + +#define AVSEEK_FLAG_BACKWARD 1 ///< seek backward +#define AVSEEK_FLAG_BYTE 2 ///< seeking based on position in bytes +#define AVSEEK_FLAG_ANY 4 ///< seek to any frame, even non-keyframes +#define AVSEEK_FLAG_FRAME 8 ///< seeking based on frame number + +/** + * @addtogroup lavf_encoding + * @{ + */ + +#define AVSTREAM_INIT_IN_WRITE_HEADER 0 ///< stream parameters initialized in avformat_write_header +#define AVSTREAM_INIT_IN_INIT_OUTPUT 1 ///< stream parameters initialized in avformat_init_output + +/** + * Allocate the stream private data and write the stream header to + * an output media file. + * + * @param s Media file handle, must be allocated with avformat_alloc_context(). + * Its oformat field must be set to the desired output format; + * Its pb field must be set to an already opened AVIOContext. + * @param options An AVDictionary filled with AVFormatContext and muxer-private options. + * On return this parameter will be destroyed and replaced with a dict containing + * options that were not found. May be NULL. + * + * @return AVSTREAM_INIT_IN_WRITE_HEADER on success if the codec had not already been fully initialized in avformat_init, + * AVSTREAM_INIT_IN_INIT_OUTPUT on success if the codec had already been fully initialized in avformat_init, + * negative AVERROR on failure. + * + * @see av_opt_find, av_dict_set, avio_open, av_oformat_next, avformat_init_output. + */ +av_warn_unused_result +int avformat_write_header(AVFormatContext *s, AVDictionary **options); + +/** + * Allocate the stream private data and initialize the codec, but do not write the header. + * May optionally be used before avformat_write_header to initialize stream parameters + * before actually writing the header. + * If using this function, do not pass the same options to avformat_write_header. + * + * @param s Media file handle, must be allocated with avformat_alloc_context(). + * Its oformat field must be set to the desired output format; + * Its pb field must be set to an already opened AVIOContext. + * @param options An AVDictionary filled with AVFormatContext and muxer-private options. + * On return this parameter will be destroyed and replaced with a dict containing + * options that were not found. May be NULL. + * + * @return AVSTREAM_INIT_IN_WRITE_HEADER on success if the codec requires avformat_write_header to fully initialize, + * AVSTREAM_INIT_IN_INIT_OUTPUT on success if the codec has been fully initialized, + * negative AVERROR on failure. + * + * @see av_opt_find, av_dict_set, avio_open, av_oformat_next, avformat_write_header. + */ +av_warn_unused_result +int avformat_init_output(AVFormatContext *s, AVDictionary **options); + +/** + * Write a packet to an output media file. + * + * This function passes the packet directly to the muxer, without any buffering + * or reordering. The caller is responsible for correctly interleaving the + * packets if the format requires it. Callers that want libavformat to handle + * the interleaving should call av_interleaved_write_frame() instead of this + * function. + * + * @param s media file handle + * @param pkt The packet containing the data to be written. Note that unlike + * av_interleaved_write_frame(), this function does not take + * ownership of the packet passed to it (though some muxers may make + * an internal reference to the input packet). + *
+ * This parameter can be NULL (at any time, not just at the end), in + * order to immediately flush data buffered within the muxer, for + * muxers that buffer up data internally before writing it to the + * output. + *
+ * Packet's @ref AVPacket.stream_index "stream_index" field must be + * set to the index of the corresponding stream in @ref + * AVFormatContext.streams "s->streams". + *
+ * The timestamps (@ref AVPacket.pts "pts", @ref AVPacket.dts "dts") + * must be set to correct values in the stream's timebase (unless the + * output format is flagged with the AVFMT_NOTIMESTAMPS flag, then + * they can be set to AV_NOPTS_VALUE). + * The dts for subsequent packets passed to this function must be strictly + * increasing when compared in their respective timebases (unless the + * output format is flagged with the AVFMT_TS_NONSTRICT, then they + * merely have to be nondecreasing). @ref AVPacket.duration + * "duration") should also be set if known. + * @return < 0 on error, = 0 if OK, 1 if flushed and there is no more data to flush + * + * @see av_interleaved_write_frame() + */ +int av_write_frame(AVFormatContext *s, AVPacket *pkt); + +/** + * Write a packet to an output media file ensuring correct interleaving. + * + * This function will buffer the packets internally as needed to make sure the + * packets in the output file are properly interleaved in the order of + * increasing dts. Callers doing their own interleaving should call + * av_write_frame() instead of this function. + * + * Using this function instead of av_write_frame() can give muxers advance + * knowledge of future packets, improving e.g. the behaviour of the mp4 + * muxer for VFR content in fragmenting mode. + * + * @param s media file handle + * @param pkt The packet containing the data to be written. + *
+ * If the packet is reference-counted, this function will take + * ownership of this reference and unreference it later when it sees + * fit. + * The caller must not access the data through this reference after + * this function returns. If the packet is not reference-counted, + * libavformat will make a copy. + *
+ * This parameter can be NULL (at any time, not just at the end), to + * flush the interleaving queues. + *
+ * Packet's @ref AVPacket.stream_index "stream_index" field must be + * set to the index of the corresponding stream in @ref + * AVFormatContext.streams "s->streams". + *
+ * The timestamps (@ref AVPacket.pts "pts", @ref AVPacket.dts "dts") + * must be set to correct values in the stream's timebase (unless the + * output format is flagged with the AVFMT_NOTIMESTAMPS flag, then + * they can be set to AV_NOPTS_VALUE). + * The dts for subsequent packets in one stream must be strictly + * increasing (unless the output format is flagged with the + * AVFMT_TS_NONSTRICT, then they merely have to be nondecreasing). + * @ref AVPacket.duration "duration") should also be set if known. + * + * @return 0 on success, a negative AVERROR on error. Libavformat will always + * take care of freeing the packet, even if this function fails. + * + * @see av_write_frame(), AVFormatContext.max_interleave_delta + */ +int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt); + +/** + * Write an uncoded frame to an output media file. + * + * The frame must be correctly interleaved according to the container + * specification; if not, then av_interleaved_write_frame() must be used. + * + * See av_interleaved_write_frame() for details. + */ +int av_write_uncoded_frame(AVFormatContext *s, int stream_index, + AVFrame *frame); + +/** + * Write an uncoded frame to an output media file. + * + * If the muxer supports it, this function makes it possible to write an AVFrame + * structure directly, without encoding it into a packet. + * It is mostly useful for devices and similar special muxers that use raw + * video or PCM data and will not serialize it into a byte stream. + * + * To test whether it is possible to use it with a given muxer and stream, + * use av_write_uncoded_frame_query(). + * + * The caller gives up ownership of the frame and must not access it + * afterwards. + * + * @return >=0 for success, a negative code on error + */ +int av_interleaved_write_uncoded_frame(AVFormatContext *s, int stream_index, + AVFrame *frame); + +/** + * Test whether a muxer supports uncoded frame. + * + * @return >=0 if an uncoded frame can be written to that muxer and stream, + * <0 if not + */ +int av_write_uncoded_frame_query(AVFormatContext *s, int stream_index); + +/** + * Write the stream trailer to an output media file and free the + * file private data. + * + * May only be called after a successful call to avformat_write_header. + * + * @param s media file handle + * @return 0 if OK, AVERROR_xxx on error + */ +int av_write_trailer(AVFormatContext *s); + +/** + * Return the output format in the list of registered output formats + * which best matches the provided parameters, or return NULL if + * there is no match. + * + * @param short_name if non-NULL checks if short_name matches with the + * names of the registered formats + * @param filename if non-NULL checks if filename terminates with the + * extensions of the registered formats + * @param mime_type if non-NULL checks if mime_type matches with the + * MIME type of the registered formats + */ +AVOutputFormat *av_guess_format(const char *short_name, + const char *filename, + const char *mime_type); + +/** + * Guess the codec ID based upon muxer and filename. + */ +enum AVCodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name, + const char *filename, const char *mime_type, + enum AVMediaType type); + +/** + * Get timing information for the data currently output. + * The exact meaning of "currently output" depends on the format. + * It is mostly relevant for devices that have an internal buffer and/or + * work in real time. + * @param s media file handle + * @param stream stream in the media file + * @param[out] dts DTS of the last packet output for the stream, in stream + * time_base units + * @param[out] wall absolute time when that packet whas output, + * in microsecond + * @return 0 if OK, AVERROR(ENOSYS) if the format does not support it + * Note: some formats or devices may not allow to measure dts and wall + * atomically. + */ +int av_get_output_timestamp(struct AVFormatContext *s, int stream, + int64_t *dts, int64_t *wall); + + +/** + * @} + */ + + +/** + * @defgroup lavf_misc Utility functions + * @ingroup libavf + * @{ + * + * Miscellaneous utility functions related to both muxing and demuxing + * (or neither). + */ + +/** + * Send a nice hexadecimal dump of a buffer to the specified file stream. + * + * @param f The file stream pointer where the dump should be sent to. + * @param buf buffer + * @param size buffer size + * + * @see av_hex_dump_log, av_pkt_dump2, av_pkt_dump_log2 + */ +void av_hex_dump(FILE *f, const uint8_t *buf, int size); + +/** + * Send a nice hexadecimal dump of a buffer to the log. + * + * @param avcl A pointer to an arbitrary struct of which the first field is a + * pointer to an AVClass struct. + * @param level The importance level of the message, lower values signifying + * higher importance. + * @param buf buffer + * @param size buffer size + * + * @see av_hex_dump, av_pkt_dump2, av_pkt_dump_log2 + */ +void av_hex_dump_log(void *avcl, int level, const uint8_t *buf, int size); + +/** + * Send a nice dump of a packet to the specified file stream. + * + * @param f The file stream pointer where the dump should be sent to. + * @param pkt packet to dump + * @param dump_payload True if the payload must be displayed, too. + * @param st AVStream that the packet belongs to + */ +void av_pkt_dump2(FILE *f, const AVPacket *pkt, int dump_payload, const AVStream *st); + + +/** + * Send a nice dump of a packet to the log. + * + * @param avcl A pointer to an arbitrary struct of which the first field is a + * pointer to an AVClass struct. + * @param level The importance level of the message, lower values signifying + * higher importance. + * @param pkt packet to dump + * @param dump_payload True if the payload must be displayed, too. + * @param st AVStream that the packet belongs to + */ +void av_pkt_dump_log2(void *avcl, int level, const AVPacket *pkt, int dump_payload, + const AVStream *st); + +/** + * Get the AVCodecID for the given codec tag tag. + * If no codec id is found returns AV_CODEC_ID_NONE. + * + * @param tags list of supported codec_id-codec_tag pairs, as stored + * in AVInputFormat.codec_tag and AVOutputFormat.codec_tag + * @param tag codec tag to match to a codec ID + */ +enum AVCodecID av_codec_get_id(const struct AVCodecTag * const *tags, unsigned int tag); + +/** + * Get the codec tag for the given codec id id. + * If no codec tag is found returns 0. + * + * @param tags list of supported codec_id-codec_tag pairs, as stored + * in AVInputFormat.codec_tag and AVOutputFormat.codec_tag + * @param id codec ID to match to a codec tag + */ +unsigned int av_codec_get_tag(const struct AVCodecTag * const *tags, enum AVCodecID id); + +/** + * Get the codec tag for the given codec id. + * + * @param tags list of supported codec_id - codec_tag pairs, as stored + * in AVInputFormat.codec_tag and AVOutputFormat.codec_tag + * @param id codec id that should be searched for in the list + * @param tag A pointer to the found tag + * @return 0 if id was not found in tags, > 0 if it was found + */ +int av_codec_get_tag2(const struct AVCodecTag * const *tags, enum AVCodecID id, + unsigned int *tag); + +int av_find_default_stream_index(AVFormatContext *s); + +/** + * Get the index for a specific timestamp. + * + * @param st stream that the timestamp belongs to + * @param timestamp timestamp to retrieve the index for + * @param flags if AVSEEK_FLAG_BACKWARD then the returned index will correspond + * to the timestamp which is <= the requested one, if backward + * is 0, then it will be >= + * if AVSEEK_FLAG_ANY seek to any frame, only keyframes otherwise + * @return < 0 if no such timestamp could be found + */ +int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags); + +/** + * Add an index entry into a sorted list. Update the entry if the list + * already contains it. + * + * @param timestamp timestamp in the time base of the given stream + */ +int av_add_index_entry(AVStream *st, int64_t pos, int64_t timestamp, + int size, int distance, int flags); + + +/** + * Split a URL string into components. + * + * The pointers to buffers for storing individual components may be null, + * in order to ignore that component. Buffers for components not found are + * set to empty strings. If the port is not found, it is set to a negative + * value. + * + * @param proto the buffer for the protocol + * @param proto_size the size of the proto buffer + * @param authorization the buffer for the authorization + * @param authorization_size the size of the authorization buffer + * @param hostname the buffer for the host name + * @param hostname_size the size of the hostname buffer + * @param port_ptr a pointer to store the port number in + * @param path the buffer for the path + * @param path_size the size of the path buffer + * @param url the URL to split + */ +void av_url_split(char *proto, int proto_size, + char *authorization, int authorization_size, + char *hostname, int hostname_size, + int *port_ptr, + char *path, int path_size, + const char *url); + + +/** + * Print detailed information about the input or output format, such as + * duration, bitrate, streams, container, programs, metadata, side data, + * codec and time base. + * + * @param ic the context to analyze + * @param index index of the stream to dump information about + * @param url the URL to print, such as source or destination file + * @param is_output Select whether the specified context is an input(0) or output(1) + */ +void av_dump_format(AVFormatContext *ic, + int index, + const char *url, + int is_output); + + +#define AV_FRAME_FILENAME_FLAGS_MULTIPLE 1 ///< Allow multiple %d + +/** + * Return in 'buf' the path with '%d' replaced by a number. + * + * Also handles the '%0nd' format where 'n' is the total number + * of digits and '%%'. + * + * @param buf destination buffer + * @param buf_size destination buffer size + * @param path numbered sequence string + * @param number frame number + * @param flags AV_FRAME_FILENAME_FLAGS_* + * @return 0 if OK, -1 on format error + */ +int av_get_frame_filename2(char *buf, int buf_size, + const char *path, int number, int flags); + +int av_get_frame_filename(char *buf, int buf_size, + const char *path, int number); + +/** + * Check whether filename actually is a numbered sequence generator. + * + * @param filename possible numbered sequence string + * @return 1 if a valid numbered sequence string, 0 otherwise + */ +int av_filename_number_test(const char *filename); + +/** + * Generate an SDP for an RTP session. + * + * Note, this overwrites the id values of AVStreams in the muxer contexts + * for getting unique dynamic payload types. + * + * @param ac array of AVFormatContexts describing the RTP streams. If the + * array is composed by only one context, such context can contain + * multiple AVStreams (one AVStream per RTP stream). Otherwise, + * all the contexts in the array (an AVCodecContext per RTP stream) + * must contain only one AVStream. + * @param n_files number of AVCodecContexts contained in ac + * @param buf buffer where the SDP will be stored (must be allocated by + * the caller) + * @param size the size of the buffer + * @return 0 if OK, AVERROR_xxx on error + */ +int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size); + +/** + * Return a positive value if the given filename has one of the given + * extensions, 0 otherwise. + * + * @param filename file name to check against the given extensions + * @param extensions a comma-separated list of filename extensions + */ +int av_match_ext(const char *filename, const char *extensions); + +/** + * Test if the given container can store a codec. + * + * @param ofmt container to check for compatibility + * @param codec_id codec to potentially store in container + * @param std_compliance standards compliance level, one of FF_COMPLIANCE_* + * + * @return 1 if codec with ID codec_id can be stored in ofmt, 0 if it cannot. + * A negative number if this information is not available. + */ +int avformat_query_codec(const AVOutputFormat *ofmt, enum AVCodecID codec_id, + int std_compliance); + +/** + * @defgroup riff_fourcc RIFF FourCCs + * @{ + * Get the tables mapping RIFF FourCCs to libavcodec AVCodecIDs. The tables are + * meant to be passed to av_codec_get_id()/av_codec_get_tag() as in the + * following code: + * @code + * uint32_t tag = MKTAG('H', '2', '6', '4'); + * const struct AVCodecTag *table[] = { avformat_get_riff_video_tags(), 0 }; + * enum AVCodecID id = av_codec_get_id(table, tag); + * @endcode + */ +/** + * @return the table mapping RIFF FourCCs for video to libavcodec AVCodecID. + */ +const struct AVCodecTag *avformat_get_riff_video_tags(void); +/** + * @return the table mapping RIFF FourCCs for audio to AVCodecID. + */ +const struct AVCodecTag *avformat_get_riff_audio_tags(void); +/** + * @return the table mapping MOV FourCCs for video to libavcodec AVCodecID. + */ +const struct AVCodecTag *avformat_get_mov_video_tags(void); +/** + * @return the table mapping MOV FourCCs for audio to AVCodecID. + */ +const struct AVCodecTag *avformat_get_mov_audio_tags(void); + +/** + * @} + */ + +/** + * Guess the sample aspect ratio of a frame, based on both the stream and the + * frame aspect ratio. + * + * Since the frame aspect ratio is set by the codec but the stream aspect ratio + * is set by the demuxer, these two may not be equal. This function tries to + * return the value that you should use if you would like to display the frame. + * + * Basic logic is to use the stream aspect ratio if it is set to something sane + * otherwise use the frame aspect ratio. This way a container setting, which is + * usually easy to modify can override the coded value in the frames. + * + * @param format the format context which the stream is part of + * @param stream the stream which the frame is part of + * @param frame the frame with the aspect ratio to be determined + * @return the guessed (valid) sample_aspect_ratio, 0/1 if no idea + */ +AVRational av_guess_sample_aspect_ratio(AVFormatContext *format, AVStream *stream, AVFrame *frame); + +/** + * Guess the frame rate, based on both the container and codec information. + * + * @param ctx the format context which the stream is part of + * @param stream the stream which the frame is part of + * @param frame the frame for which the frame rate should be determined, may be NULL + * @return the guessed (valid) frame rate, 0/1 if no idea + */ +AVRational av_guess_frame_rate(AVFormatContext *ctx, AVStream *stream, AVFrame *frame); + +/** + * Check if the stream st contained in s is matched by the stream specifier + * spec. + * + * See the "stream specifiers" chapter in the documentation for the syntax + * of spec. + * + * @return >0 if st is matched by spec; + * 0 if st is not matched by spec; + * AVERROR code if spec is invalid + * + * @note A stream specifier can match several streams in the format. + */ +int avformat_match_stream_specifier(AVFormatContext *s, AVStream *st, + const char *spec); + +int avformat_queue_attached_pictures(AVFormatContext *s); + +#if FF_API_OLD_BSF +/** + * Apply a list of bitstream filters to a packet. + * + * @param codec AVCodecContext, usually from an AVStream + * @param pkt the packet to apply filters to. If, on success, the returned + * packet has size == 0 and side_data_elems == 0, it indicates that + * the packet should be dropped + * @param bsfc a NULL-terminated list of filters to apply + * @return >=0 on success; + * AVERROR code on failure + */ +attribute_deprecated +int av_apply_bitstream_filters(AVCodecContext *codec, AVPacket *pkt, + AVBitStreamFilterContext *bsfc); +#endif + +enum AVTimebaseSource { + AVFMT_TBCF_AUTO = -1, + AVFMT_TBCF_DECODER, + AVFMT_TBCF_DEMUXER, +#if FF_API_R_FRAME_RATE + AVFMT_TBCF_R_FRAMERATE, +#endif +}; + +/** + * Transfer internal timing information from one stream to another. + * + * This function is useful when doing stream copy. + * + * @param ofmt target output format for ost + * @param ost output stream which needs timings copy and adjustments + * @param ist reference input stream to copy timings from + * @param copy_tb define from where the stream codec timebase needs to be imported + */ +int avformat_transfer_internal_stream_timing_info(const AVOutputFormat *ofmt, + AVStream *ost, const AVStream *ist, + enum AVTimebaseSource copy_tb); + +/** + * Get the internal codec timebase from a stream. + * + * @param st input stream to extract the timebase from + */ +AVRational av_stream_get_codec_timebase(const AVStream *st); + +/** + * @} + */ + +#endif /* AVFORMAT_AVFORMAT_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavformat/avio.h b/MediaClient/MediaClient/ffmpeg/include/libavformat/avio.h new file mode 100644 index 0000000..75912ce --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavformat/avio.h @@ -0,0 +1,861 @@ +/* + * copyright (c) 2001 Fabrice Bellard + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ +#ifndef AVFORMAT_AVIO_H +#define AVFORMAT_AVIO_H + +/** + * @file + * @ingroup lavf_io + * Buffered I/O operations + */ + +#include + +#include "libavutil/common.h" +#include "libavutil/dict.h" +#include "libavutil/log.h" + +#include "libavformat/version.h" + +/** + * Seeking works like for a local file. + */ +#define AVIO_SEEKABLE_NORMAL (1 << 0) + +/** + * Seeking by timestamp with avio_seek_time() is possible. + */ +#define AVIO_SEEKABLE_TIME (1 << 1) + +/** + * Callback for checking whether to abort blocking functions. + * AVERROR_EXIT is returned in this case by the interrupted + * function. During blocking operations, callback is called with + * opaque as parameter. If the callback returns 1, the + * blocking operation will be aborted. + * + * No members can be added to this struct without a major bump, if + * new elements have been added after this struct in AVFormatContext + * or AVIOContext. + */ +typedef struct AVIOInterruptCB { + int (*callback)(void*); + void *opaque; +} AVIOInterruptCB; + +/** + * Directory entry types. + */ +enum AVIODirEntryType { + AVIO_ENTRY_UNKNOWN, + AVIO_ENTRY_BLOCK_DEVICE, + AVIO_ENTRY_CHARACTER_DEVICE, + AVIO_ENTRY_DIRECTORY, + AVIO_ENTRY_NAMED_PIPE, + AVIO_ENTRY_SYMBOLIC_LINK, + AVIO_ENTRY_SOCKET, + AVIO_ENTRY_FILE, + AVIO_ENTRY_SERVER, + AVIO_ENTRY_SHARE, + AVIO_ENTRY_WORKGROUP, +}; + +/** + * Describes single entry of the directory. + * + * Only name and type fields are guaranteed be set. + * Rest of fields are protocol or/and platform dependent and might be unknown. + */ +typedef struct AVIODirEntry { + char *name; /**< Filename */ + int type; /**< Type of the entry */ + int utf8; /**< Set to 1 when name is encoded with UTF-8, 0 otherwise. + Name can be encoded with UTF-8 even though 0 is set. */ + int64_t size; /**< File size in bytes, -1 if unknown. */ + int64_t modification_timestamp; /**< Time of last modification in microseconds since unix + epoch, -1 if unknown. */ + int64_t access_timestamp; /**< Time of last access in microseconds since unix epoch, + -1 if unknown. */ + int64_t status_change_timestamp; /**< Time of last status change in microseconds since unix + epoch, -1 if unknown. */ + int64_t user_id; /**< User ID of owner, -1 if unknown. */ + int64_t group_id; /**< Group ID of owner, -1 if unknown. */ + int64_t filemode; /**< Unix file mode, -1 if unknown. */ +} AVIODirEntry; + +typedef struct AVIODirContext { + struct URLContext *url_context; +} AVIODirContext; + +/** + * Different data types that can be returned via the AVIO + * write_data_type callback. + */ +enum AVIODataMarkerType { + /** + * Header data; this needs to be present for the stream to be decodeable. + */ + AVIO_DATA_MARKER_HEADER, + /** + * A point in the output bytestream where a decoder can start decoding + * (i.e. a keyframe). A demuxer/decoder given the data flagged with + * AVIO_DATA_MARKER_HEADER, followed by any AVIO_DATA_MARKER_SYNC_POINT, + * should give decodeable results. + */ + AVIO_DATA_MARKER_SYNC_POINT, + /** + * A point in the output bytestream where a demuxer can start parsing + * (for non self synchronizing bytestream formats). That is, any + * non-keyframe packet start point. + */ + AVIO_DATA_MARKER_BOUNDARY_POINT, + /** + * This is any, unlabelled data. It can either be a muxer not marking + * any positions at all, it can be an actual boundary/sync point + * that the muxer chooses not to mark, or a later part of a packet/fragment + * that is cut into multiple write callbacks due to limited IO buffer size. + */ + AVIO_DATA_MARKER_UNKNOWN, + /** + * Trailer data, which doesn't contain actual content, but only for + * finalizing the output file. + */ + AVIO_DATA_MARKER_TRAILER, + /** + * A point in the output bytestream where the underlying AVIOContext might + * flush the buffer depending on latency or buffering requirements. Typically + * means the end of a packet. + */ + AVIO_DATA_MARKER_FLUSH_POINT, +}; + +/** + * Bytestream IO Context. + * New fields can be added to the end with minor version bumps. + * Removal, reordering and changes to existing fields require a major + * version bump. + * sizeof(AVIOContext) must not be used outside libav*. + * + * @note None of the function pointers in AVIOContext should be called + * directly, they should only be set by the client application + * when implementing custom I/O. Normally these are set to the + * function pointers specified in avio_alloc_context() + */ +typedef struct AVIOContext { + /** + * A class for private options. + * + * If this AVIOContext is created by avio_open2(), av_class is set and + * passes the options down to protocols. + * + * If this AVIOContext is manually allocated, then av_class may be set by + * the caller. + * + * warning -- this field can be NULL, be sure to not pass this AVIOContext + * to any av_opt_* functions in that case. + */ + const AVClass *av_class; + + /* + * The following shows the relationship between buffer, buf_ptr, + * buf_ptr_max, buf_end, buf_size, and pos, when reading and when writing + * (since AVIOContext is used for both): + * + ********************************************************************************** + * READING + ********************************************************************************** + * + * | buffer_size | + * |---------------------------------------| + * | | + * + * buffer buf_ptr buf_end + * +---------------+-----------------------+ + * |/ / / / / / / /|/ / / / / / /| | + * read buffer: |/ / consumed / | to be read /| | + * |/ / / / / / / /|/ / / / / / /| | + * +---------------+-----------------------+ + * + * pos + * +-------------------------------------------+-----------------+ + * input file: | | | + * +-------------------------------------------+-----------------+ + * + * + ********************************************************************************** + * WRITING + ********************************************************************************** + * + * | buffer_size | + * |--------------------------------------| + * | | + * + * buf_ptr_max + * buffer (buf_ptr) buf_end + * +-----------------------+--------------+ + * |/ / / / / / / / / / / /| | + * write buffer: | / / to be flushed / / | | + * |/ / / / / / / / / / / /| | + * +-----------------------+--------------+ + * buf_ptr can be in this + * due to a backward seek + * + * pos + * +-------------+----------------------------------------------+ + * output file: | | | + * +-------------+----------------------------------------------+ + * + */ + unsigned char *buffer; /**< Start of the buffer. */ + int buffer_size; /**< Maximum buffer size */ + unsigned char *buf_ptr; /**< Current position in the buffer */ + unsigned char *buf_end; /**< End of the data, may be less than + buffer+buffer_size if the read function returned + less data than requested, e.g. for streams where + no more data has been received yet. */ + void *opaque; /**< A private pointer, passed to the read/write/seek/... + functions. */ + int (*read_packet)(void *opaque, uint8_t *buf, int buf_size); + int (*write_packet)(void *opaque, uint8_t *buf, int buf_size); + int64_t (*seek)(void *opaque, int64_t offset, int whence); + int64_t pos; /**< position in the file of the current buffer */ + int eof_reached; /**< true if eof reached */ + int write_flag; /**< true if open for writing */ + int max_packet_size; + unsigned long checksum; + unsigned char *checksum_ptr; + unsigned long (*update_checksum)(unsigned long checksum, const uint8_t *buf, unsigned int size); + int error; /**< contains the error code or 0 if no error happened */ + /** + * Pause or resume playback for network streaming protocols - e.g. MMS. + */ + int (*read_pause)(void *opaque, int pause); + /** + * Seek to a given timestamp in stream with the specified stream_index. + * Needed for some network streaming protocols which don't support seeking + * to byte position. + */ + int64_t (*read_seek)(void *opaque, int stream_index, + int64_t timestamp, int flags); + /** + * A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable. + */ + int seekable; + + /** + * max filesize, used to limit allocations + * This field is internal to libavformat and access from outside is not allowed. + */ + int64_t maxsize; + + /** + * avio_read and avio_write should if possible be satisfied directly + * instead of going through a buffer, and avio_seek will always + * call the underlying seek function directly. + */ + int direct; + + /** + * Bytes read statistic + * This field is internal to libavformat and access from outside is not allowed. + */ + int64_t bytes_read; + + /** + * seek statistic + * This field is internal to libavformat and access from outside is not allowed. + */ + int seek_count; + + /** + * writeout statistic + * This field is internal to libavformat and access from outside is not allowed. + */ + int writeout_count; + + /** + * Original buffer size + * used internally after probing and ensure seekback to reset the buffer size + * This field is internal to libavformat and access from outside is not allowed. + */ + int orig_buffer_size; + + /** + * Threshold to favor readahead over seek. + * This is current internal only, do not use from outside. + */ + int short_seek_threshold; + + /** + * ',' separated list of allowed protocols. + */ + const char *protocol_whitelist; + + /** + * ',' separated list of disallowed protocols. + */ + const char *protocol_blacklist; + + /** + * A callback that is used instead of write_packet. + */ + int (*write_data_type)(void *opaque, uint8_t *buf, int buf_size, + enum AVIODataMarkerType type, int64_t time); + /** + * If set, don't call write_data_type separately for AVIO_DATA_MARKER_BOUNDARY_POINT, + * but ignore them and treat them as AVIO_DATA_MARKER_UNKNOWN (to avoid needlessly + * small chunks of data returned from the callback). + */ + int ignore_boundary_point; + + /** + * Internal, not meant to be used from outside of AVIOContext. + */ + enum AVIODataMarkerType current_type; + int64_t last_time; + + /** + * A callback that is used instead of short_seek_threshold. + * This is current internal only, do not use from outside. + */ + int (*short_seek_get)(void *opaque); + + int64_t written; + + /** + * Maximum reached position before a backward seek in the write buffer, + * used keeping track of already written data for a later flush. + */ + unsigned char *buf_ptr_max; + + /** + * Try to buffer at least this amount of data before flushing it + */ + int min_packet_size; +} AVIOContext; + +/** + * Return the name of the protocol that will handle the passed URL. + * + * NULL is returned if no protocol could be found for the given URL. + * + * @return Name of the protocol or NULL. + */ +const char *avio_find_protocol_name(const char *url); + +/** + * Return AVIO_FLAG_* access flags corresponding to the access permissions + * of the resource in url, or a negative value corresponding to an + * AVERROR code in case of failure. The returned access flags are + * masked by the value in flags. + * + * @note This function is intrinsically unsafe, in the sense that the + * checked resource may change its existence or permission status from + * one call to another. Thus you should not trust the returned value, + * unless you are sure that no other processes are accessing the + * checked resource. + */ +int avio_check(const char *url, int flags); + +/** + * Move or rename a resource. + * + * @note url_src and url_dst should share the same protocol and authority. + * + * @param url_src url to resource to be moved + * @param url_dst new url to resource if the operation succeeded + * @return >=0 on success or negative on error. + */ +int avpriv_io_move(const char *url_src, const char *url_dst); + +/** + * Delete a resource. + * + * @param url resource to be deleted. + * @return >=0 on success or negative on error. + */ +int avpriv_io_delete(const char *url); + +/** + * Open directory for reading. + * + * @param s directory read context. Pointer to a NULL pointer must be passed. + * @param url directory to be listed. + * @param options A dictionary filled with protocol-private options. On return + * this parameter will be destroyed and replaced with a dictionary + * containing options that were not found. May be NULL. + * @return >=0 on success or negative on error. + */ +int avio_open_dir(AVIODirContext **s, const char *url, AVDictionary **options); + +/** + * Get next directory entry. + * + * Returned entry must be freed with avio_free_directory_entry(). In particular + * it may outlive AVIODirContext. + * + * @param s directory read context. + * @param[out] next next entry or NULL when no more entries. + * @return >=0 on success or negative on error. End of list is not considered an + * error. + */ +int avio_read_dir(AVIODirContext *s, AVIODirEntry **next); + +/** + * Close directory. + * + * @note Entries created using avio_read_dir() are not deleted and must be + * freeded with avio_free_directory_entry(). + * + * @param s directory read context. + * @return >=0 on success or negative on error. + */ +int avio_close_dir(AVIODirContext **s); + +/** + * Free entry allocated by avio_read_dir(). + * + * @param entry entry to be freed. + */ +void avio_free_directory_entry(AVIODirEntry **entry); + +/** + * Allocate and initialize an AVIOContext for buffered I/O. It must be later + * freed with avio_context_free(). + * + * @param buffer Memory block for input/output operations via AVIOContext. + * The buffer must be allocated with av_malloc() and friends. + * It may be freed and replaced with a new buffer by libavformat. + * AVIOContext.buffer holds the buffer currently in use, + * which must be later freed with av_free(). + * @param buffer_size The buffer size is very important for performance. + * For protocols with fixed blocksize it should be set to this blocksize. + * For others a typical size is a cache page, e.g. 4kb. + * @param write_flag Set to 1 if the buffer should be writable, 0 otherwise. + * @param opaque An opaque pointer to user-specific data. + * @param read_packet A function for refilling the buffer, may be NULL. + * For stream protocols, must never return 0 but rather + * a proper AVERROR code. + * @param write_packet A function for writing the buffer contents, may be NULL. + * The function may not change the input buffers content. + * @param seek A function for seeking to specified byte position, may be NULL. + * + * @return Allocated AVIOContext or NULL on failure. + */ +AVIOContext *avio_alloc_context( + unsigned char *buffer, + int buffer_size, + int write_flag, + void *opaque, + int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), + int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), + int64_t (*seek)(void *opaque, int64_t offset, int whence)); + +/** + * Free the supplied IO context and everything associated with it. + * + * @param s Double pointer to the IO context. This function will write NULL + * into s. + */ +void avio_context_free(AVIOContext **s); + +void avio_w8(AVIOContext *s, int b); +void avio_write(AVIOContext *s, const unsigned char *buf, int size); +void avio_wl64(AVIOContext *s, uint64_t val); +void avio_wb64(AVIOContext *s, uint64_t val); +void avio_wl32(AVIOContext *s, unsigned int val); +void avio_wb32(AVIOContext *s, unsigned int val); +void avio_wl24(AVIOContext *s, unsigned int val); +void avio_wb24(AVIOContext *s, unsigned int val); +void avio_wl16(AVIOContext *s, unsigned int val); +void avio_wb16(AVIOContext *s, unsigned int val); + +/** + * Write a NULL-terminated string. + * @return number of bytes written. + */ +int avio_put_str(AVIOContext *s, const char *str); + +/** + * Convert an UTF-8 string to UTF-16LE and write it. + * @param s the AVIOContext + * @param str NULL-terminated UTF-8 string + * + * @return number of bytes written. + */ +int avio_put_str16le(AVIOContext *s, const char *str); + +/** + * Convert an UTF-8 string to UTF-16BE and write it. + * @param s the AVIOContext + * @param str NULL-terminated UTF-8 string + * + * @return number of bytes written. + */ +int avio_put_str16be(AVIOContext *s, const char *str); + +/** + * Mark the written bytestream as a specific type. + * + * Zero-length ranges are omitted from the output. + * + * @param time the stream time the current bytestream pos corresponds to + * (in AV_TIME_BASE units), or AV_NOPTS_VALUE if unknown or not + * applicable + * @param type the kind of data written starting at the current pos + */ +void avio_write_marker(AVIOContext *s, int64_t time, enum AVIODataMarkerType type); + +/** + * ORing this as the "whence" parameter to a seek function causes it to + * return the filesize without seeking anywhere. Supporting this is optional. + * If it is not supported then the seek function will return <0. + */ +#define AVSEEK_SIZE 0x10000 + +/** + * Passing this flag as the "whence" parameter to a seek function causes it to + * seek by any means (like reopening and linear reading) or other normally unreasonable + * means that can be extremely slow. + * This may be ignored by the seek code. + */ +#define AVSEEK_FORCE 0x20000 + +/** + * fseek() equivalent for AVIOContext. + * @return new position or AVERROR. + */ +int64_t avio_seek(AVIOContext *s, int64_t offset, int whence); + +/** + * Skip given number of bytes forward + * @return new position or AVERROR. + */ +int64_t avio_skip(AVIOContext *s, int64_t offset); + +/** + * ftell() equivalent for AVIOContext. + * @return position or AVERROR. + */ +static av_always_inline int64_t avio_tell(AVIOContext *s) +{ + return avio_seek(s, 0, SEEK_CUR); +} + +/** + * Get the filesize. + * @return filesize or AVERROR + */ +int64_t avio_size(AVIOContext *s); + +/** + * feof() equivalent for AVIOContext. + * @return non zero if and only if end of file + */ +int avio_feof(AVIOContext *s); + +/** @warning Writes up to 4 KiB per call */ +int avio_printf(AVIOContext *s, const char *fmt, ...) av_printf_format(2, 3); + +/** + * Force flushing of buffered data. + * + * For write streams, force the buffered data to be immediately written to the output, + * without to wait to fill the internal buffer. + * + * For read streams, discard all currently buffered data, and advance the + * reported file position to that of the underlying stream. This does not + * read new data, and does not perform any seeks. + */ +void avio_flush(AVIOContext *s); + +/** + * Read size bytes from AVIOContext into buf. + * @return number of bytes read or AVERROR + */ +int avio_read(AVIOContext *s, unsigned char *buf, int size); + +/** + * Read size bytes from AVIOContext into buf. Unlike avio_read(), this is allowed + * to read fewer bytes than requested. The missing bytes can be read in the next + * call. This always tries to read at least 1 byte. + * Useful to reduce latency in certain cases. + * @return number of bytes read or AVERROR + */ +int avio_read_partial(AVIOContext *s, unsigned char *buf, int size); + +/** + * @name Functions for reading from AVIOContext + * @{ + * + * @note return 0 if EOF, so you cannot use it if EOF handling is + * necessary + */ +int avio_r8 (AVIOContext *s); +unsigned int avio_rl16(AVIOContext *s); +unsigned int avio_rl24(AVIOContext *s); +unsigned int avio_rl32(AVIOContext *s); +uint64_t avio_rl64(AVIOContext *s); +unsigned int avio_rb16(AVIOContext *s); +unsigned int avio_rb24(AVIOContext *s); +unsigned int avio_rb32(AVIOContext *s); +uint64_t avio_rb64(AVIOContext *s); +/** + * @} + */ + +/** + * Read a string from pb into buf. The reading will terminate when either + * a NULL character was encountered, maxlen bytes have been read, or nothing + * more can be read from pb. The result is guaranteed to be NULL-terminated, it + * will be truncated if buf is too small. + * Note that the string is not interpreted or validated in any way, it + * might get truncated in the middle of a sequence for multi-byte encodings. + * + * @return number of bytes read (is always <= maxlen). + * If reading ends on EOF or error, the return value will be one more than + * bytes actually read. + */ +int avio_get_str(AVIOContext *pb, int maxlen, char *buf, int buflen); + +/** + * Read a UTF-16 string from pb and convert it to UTF-8. + * The reading will terminate when either a null or invalid character was + * encountered or maxlen bytes have been read. + * @return number of bytes read (is always <= maxlen) + */ +int avio_get_str16le(AVIOContext *pb, int maxlen, char *buf, int buflen); +int avio_get_str16be(AVIOContext *pb, int maxlen, char *buf, int buflen); + + +/** + * @name URL open modes + * The flags argument to avio_open must be one of the following + * constants, optionally ORed with other flags. + * @{ + */ +#define AVIO_FLAG_READ 1 /**< read-only */ +#define AVIO_FLAG_WRITE 2 /**< write-only */ +#define AVIO_FLAG_READ_WRITE (AVIO_FLAG_READ|AVIO_FLAG_WRITE) /**< read-write pseudo flag */ +/** + * @} + */ + +/** + * Use non-blocking mode. + * If this flag is set, operations on the context will return + * AVERROR(EAGAIN) if they can not be performed immediately. + * If this flag is not set, operations on the context will never return + * AVERROR(EAGAIN). + * Note that this flag does not affect the opening/connecting of the + * context. Connecting a protocol will always block if necessary (e.g. on + * network protocols) but never hang (e.g. on busy devices). + * Warning: non-blocking protocols is work-in-progress; this flag may be + * silently ignored. + */ +#define AVIO_FLAG_NONBLOCK 8 + +/** + * Use direct mode. + * avio_read and avio_write should if possible be satisfied directly + * instead of going through a buffer, and avio_seek will always + * call the underlying seek function directly. + */ +#define AVIO_FLAG_DIRECT 0x8000 + +/** + * Create and initialize a AVIOContext for accessing the + * resource indicated by url. + * @note When the resource indicated by url has been opened in + * read+write mode, the AVIOContext can be used only for writing. + * + * @param s Used to return the pointer to the created AVIOContext. + * In case of failure the pointed to value is set to NULL. + * @param url resource to access + * @param flags flags which control how the resource indicated by url + * is to be opened + * @return >= 0 in case of success, a negative value corresponding to an + * AVERROR code in case of failure + */ +int avio_open(AVIOContext **s, const char *url, int flags); + +/** + * Create and initialize a AVIOContext for accessing the + * resource indicated by url. + * @note When the resource indicated by url has been opened in + * read+write mode, the AVIOContext can be used only for writing. + * + * @param s Used to return the pointer to the created AVIOContext. + * In case of failure the pointed to value is set to NULL. + * @param url resource to access + * @param flags flags which control how the resource indicated by url + * is to be opened + * @param int_cb an interrupt callback to be used at the protocols level + * @param options A dictionary filled with protocol-private options. On return + * this parameter will be destroyed and replaced with a dict containing options + * that were not found. May be NULL. + * @return >= 0 in case of success, a negative value corresponding to an + * AVERROR code in case of failure + */ +int avio_open2(AVIOContext **s, const char *url, int flags, + const AVIOInterruptCB *int_cb, AVDictionary **options); + +/** + * Close the resource accessed by the AVIOContext s and free it. + * This function can only be used if s was opened by avio_open(). + * + * The internal buffer is automatically flushed before closing the + * resource. + * + * @return 0 on success, an AVERROR < 0 on error. + * @see avio_closep + */ +int avio_close(AVIOContext *s); + +/** + * Close the resource accessed by the AVIOContext *s, free it + * and set the pointer pointing to it to NULL. + * This function can only be used if s was opened by avio_open(). + * + * The internal buffer is automatically flushed before closing the + * resource. + * + * @return 0 on success, an AVERROR < 0 on error. + * @see avio_close + */ +int avio_closep(AVIOContext **s); + + +/** + * Open a write only memory stream. + * + * @param s new IO context + * @return zero if no error. + */ +int avio_open_dyn_buf(AVIOContext **s); + +/** + * Return the written size and a pointer to the buffer. + * The AVIOContext stream is left intact. + * The buffer must NOT be freed. + * No padding is added to the buffer. + * + * @param s IO context + * @param pbuffer pointer to a byte buffer + * @return the length of the byte buffer + */ +int avio_get_dyn_buf(AVIOContext *s, uint8_t **pbuffer); + +/** + * Return the written size and a pointer to the buffer. The buffer + * must be freed with av_free(). + * Padding of AV_INPUT_BUFFER_PADDING_SIZE is added to the buffer. + * + * @param s IO context + * @param pbuffer pointer to a byte buffer + * @return the length of the byte buffer + */ +int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer); + +/** + * Iterate through names of available protocols. + * + * @param opaque A private pointer representing current protocol. + * It must be a pointer to NULL on first iteration and will + * be updated by successive calls to avio_enum_protocols. + * @param output If set to 1, iterate over output protocols, + * otherwise over input protocols. + * + * @return A static string containing the name of current protocol or NULL + */ +const char *avio_enum_protocols(void **opaque, int output); + +/** + * Pause and resume playing - only meaningful if using a network streaming + * protocol (e.g. MMS). + * + * @param h IO context from which to call the read_pause function pointer + * @param pause 1 for pause, 0 for resume + */ +int avio_pause(AVIOContext *h, int pause); + +/** + * Seek to a given timestamp relative to some component stream. + * Only meaningful if using a network streaming protocol (e.g. MMS.). + * + * @param h IO context from which to call the seek function pointers + * @param stream_index The stream index that the timestamp is relative to. + * If stream_index is (-1) the timestamp should be in AV_TIME_BASE + * units from the beginning of the presentation. + * If a stream_index >= 0 is used and the protocol does not support + * seeking based on component streams, the call will fail. + * @param timestamp timestamp in AVStream.time_base units + * or if there is no stream specified then in AV_TIME_BASE units. + * @param flags Optional combination of AVSEEK_FLAG_BACKWARD, AVSEEK_FLAG_BYTE + * and AVSEEK_FLAG_ANY. The protocol may silently ignore + * AVSEEK_FLAG_BACKWARD and AVSEEK_FLAG_ANY, but AVSEEK_FLAG_BYTE will + * fail if used and not supported. + * @return >= 0 on success + * @see AVInputFormat::read_seek + */ +int64_t avio_seek_time(AVIOContext *h, int stream_index, + int64_t timestamp, int flags); + +/* Avoid a warning. The header can not be included because it breaks c++. */ +struct AVBPrint; + +/** + * Read contents of h into print buffer, up to max_size bytes, or up to EOF. + * + * @return 0 for success (max_size bytes read or EOF reached), negative error + * code otherwise + */ +int avio_read_to_bprint(AVIOContext *h, struct AVBPrint *pb, size_t max_size); + +/** + * Accept and allocate a client context on a server context. + * @param s the server context + * @param c the client context, must be unallocated + * @return >= 0 on success or a negative value corresponding + * to an AVERROR on failure + */ +int avio_accept(AVIOContext *s, AVIOContext **c); + +/** + * Perform one step of the protocol handshake to accept a new client. + * This function must be called on a client returned by avio_accept() before + * using it as a read/write context. + * It is separate from avio_accept() because it may block. + * A step of the handshake is defined by places where the application may + * decide to change the proceedings. + * For example, on a protocol with a request header and a reply header, each + * one can constitute a step because the application may use the parameters + * from the request to change parameters in the reply; or each individual + * chunk of the request can constitute a step. + * If the handshake is already finished, avio_handshake() does nothing and + * returns 0 immediately. + * + * @param c the client context to perform the handshake on + * @return 0 on a complete and successful handshake + * > 0 if the handshake progressed, but is not complete + * < 0 for an AVERROR code + */ +int avio_handshake(AVIOContext *c); +#endif /* AVFORMAT_AVIO_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavformat/version.h b/MediaClient/MediaClient/ffmpeg/include/libavformat/version.h new file mode 100644 index 0000000..a0a26d5 --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavformat/version.h @@ -0,0 +1,102 @@ +/* + * Version macros. + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVFORMAT_VERSION_H +#define AVFORMAT_VERSION_H + +/** + * @file + * @ingroup libavf + * Libavformat version macros + */ + +#include "libavutil/version.h" + +// Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium) +// Also please add any ticket numbers that you believe might be affected here +#define LIBAVFORMAT_VERSION_MAJOR 58 +#define LIBAVFORMAT_VERSION_MINOR 12 +#define LIBAVFORMAT_VERSION_MICRO 100 + +#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ + LIBAVFORMAT_VERSION_MINOR, \ + LIBAVFORMAT_VERSION_MICRO) +#define LIBAVFORMAT_VERSION AV_VERSION(LIBAVFORMAT_VERSION_MAJOR, \ + LIBAVFORMAT_VERSION_MINOR, \ + LIBAVFORMAT_VERSION_MICRO) +#define LIBAVFORMAT_BUILD LIBAVFORMAT_VERSION_INT + +#define LIBAVFORMAT_IDENT "Lavf" AV_STRINGIFY(LIBAVFORMAT_VERSION) + +/** + * FF_API_* defines may be placed below to indicate public API that will be + * dropped at a future version bump. The defines themselves are not part of + * the public API and may change, break or disappear at any time. + * + * @note, when bumping the major version it is recommended to manually + * disable each FF_API_* in its own commit instead of disabling them all + * at once through the bump. This improves the git bisect-ability of the change. + * + */ +#ifndef FF_API_COMPUTE_PKT_FIELDS2 +#define FF_API_COMPUTE_PKT_FIELDS2 (LIBAVFORMAT_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_OLD_OPEN_CALLBACKS +#define FF_API_OLD_OPEN_CALLBACKS (LIBAVFORMAT_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_LAVF_AVCTX +#define FF_API_LAVF_AVCTX (LIBAVFORMAT_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_HTTP_USER_AGENT +#define FF_API_HTTP_USER_AGENT (LIBAVFORMAT_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_HLS_WRAP +#define FF_API_HLS_WRAP (LIBAVFORMAT_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_LAVF_KEEPSIDE_FLAG +#define FF_API_LAVF_KEEPSIDE_FLAG (LIBAVFORMAT_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_OLD_ROTATE_API +#define FF_API_OLD_ROTATE_API (LIBAVFORMAT_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_FORMAT_GET_SET +#define FF_API_FORMAT_GET_SET (LIBAVFORMAT_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_OLD_AVIO_EOF_0 +#define FF_API_OLD_AVIO_EOF_0 (LIBAVFORMAT_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_LAVF_FFSERVER +#define FF_API_LAVF_FFSERVER (LIBAVFORMAT_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_FORMAT_FILENAME +#define FF_API_FORMAT_FILENAME (LIBAVFORMAT_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_OLD_RTSP_OPTIONS +#define FF_API_OLD_RTSP_OPTIONS (LIBAVFORMAT_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_NEXT +#define FF_API_NEXT (LIBAVFORMAT_VERSION_MAJOR < 59) +#endif + + +#ifndef FF_API_R_FRAME_RATE +#define FF_API_R_FRAME_RATE 1 +#endif +#endif /* AVFORMAT_VERSION_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/adler32.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/adler32.h new file mode 100644 index 0000000..a1f035b --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/adler32.h @@ -0,0 +1,60 @@ +/* + * copyright (c) 2006 Mans Rullgard + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * @ingroup lavu_adler32 + * Public header for Adler-32 hash function implementation. + */ + +#ifndef AVUTIL_ADLER32_H +#define AVUTIL_ADLER32_H + +#include +#include "attributes.h" + +/** + * @defgroup lavu_adler32 Adler-32 + * @ingroup lavu_hash + * Adler-32 hash function implementation. + * + * @{ + */ + +/** + * Calculate the Adler32 checksum of a buffer. + * + * Passing the return value to a subsequent av_adler32_update() call + * allows the checksum of multiple buffers to be calculated as though + * they were concatenated. + * + * @param adler initial checksum value + * @param buf pointer to input buffer + * @param len size of input buffer + * @return updated checksum + */ +unsigned long av_adler32_update(unsigned long adler, const uint8_t *buf, + unsigned int len) av_pure; + +/** + * @} + */ + +#endif /* AVUTIL_ADLER32_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/aes.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/aes.h new file mode 100644 index 0000000..09efbda --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/aes.h @@ -0,0 +1,65 @@ +/* + * copyright (c) 2007 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_AES_H +#define AVUTIL_AES_H + +#include + +#include "attributes.h" +#include "version.h" + +/** + * @defgroup lavu_aes AES + * @ingroup lavu_crypto + * @{ + */ + +extern const int av_aes_size; + +struct AVAES; + +/** + * Allocate an AVAES context. + */ +struct AVAES *av_aes_alloc(void); + +/** + * Initialize an AVAES context. + * @param key_bits 128, 192 or 256 + * @param decrypt 0 for encryption, 1 for decryption + */ +int av_aes_init(struct AVAES *a, const uint8_t *key, int key_bits, int decrypt); + +/** + * Encrypt or decrypt a buffer using a previously initialized context. + * @param count number of 16 byte blocks + * @param dst destination array, can be equal to src + * @param src source array, can be equal to dst + * @param iv initialization vector for CBC mode, if NULL then ECB will be used + * @param decrypt 0 for encryption, 1 for decryption + */ +void av_aes_crypt(struct AVAES *a, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt); + +/** + * @} + */ + +#endif /* AVUTIL_AES_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/aes_ctr.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/aes_ctr.h new file mode 100644 index 0000000..e4aae12 --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/aes_ctr.h @@ -0,0 +1,88 @@ +/* + * AES-CTR cipher + * Copyright (c) 2015 Eran Kornblau + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_AES_CTR_H +#define AVUTIL_AES_CTR_H + +#include + +#include "attributes.h" +#include "version.h" + +#define AES_CTR_KEY_SIZE (16) +#define AES_CTR_IV_SIZE (8) + +struct AVAESCTR; + +/** + * Allocate an AVAESCTR context. + */ +struct AVAESCTR *av_aes_ctr_alloc(void); + +/** + * Initialize an AVAESCTR context. + * @param key encryption key, must have a length of AES_CTR_KEY_SIZE + */ +int av_aes_ctr_init(struct AVAESCTR *a, const uint8_t *key); + +/** + * Release an AVAESCTR context. + */ +void av_aes_ctr_free(struct AVAESCTR *a); + +/** + * Process a buffer using a previously initialized context. + * @param dst destination array, can be equal to src + * @param src source array, can be equal to dst + * @param size the size of src and dst + */ +void av_aes_ctr_crypt(struct AVAESCTR *a, uint8_t *dst, const uint8_t *src, int size); + +/** + * Get the current iv + */ +const uint8_t* av_aes_ctr_get_iv(struct AVAESCTR *a); + +/** + * Generate a random iv + */ +void av_aes_ctr_set_random_iv(struct AVAESCTR *a); + +/** + * Forcefully change the 8-byte iv + */ +void av_aes_ctr_set_iv(struct AVAESCTR *a, const uint8_t* iv); + +/** + * Forcefully change the "full" 16-byte iv, including the counter + */ +void av_aes_ctr_set_full_iv(struct AVAESCTR *a, const uint8_t* iv); + +/** + * Increment the top 64 bit of the iv (performed after each frame) + */ +void av_aes_ctr_increment_iv(struct AVAESCTR *a); + +/** + * @} + */ + +#endif /* AVUTIL_AES_CTR_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/attributes.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/attributes.h new file mode 100644 index 0000000..ced108a --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/attributes.h @@ -0,0 +1,167 @@ +/* + * copyright (c) 2006 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * Macro definitions for various function/variable attributes + */ + +#ifndef AVUTIL_ATTRIBUTES_H +#define AVUTIL_ATTRIBUTES_H + +#ifdef __GNUC__ +# define AV_GCC_VERSION_AT_LEAST(x,y) (__GNUC__ > (x) || __GNUC__ == (x) && __GNUC_MINOR__ >= (y)) +# define AV_GCC_VERSION_AT_MOST(x,y) (__GNUC__ < (x) || __GNUC__ == (x) && __GNUC_MINOR__ <= (y)) +#else +# define AV_GCC_VERSION_AT_LEAST(x,y) 0 +# define AV_GCC_VERSION_AT_MOST(x,y) 0 +#endif + +#ifndef av_always_inline +#if AV_GCC_VERSION_AT_LEAST(3,1) +# define av_always_inline __attribute__((always_inline)) inline +#elif defined(_MSC_VER) +# define av_always_inline __forceinline +#else +# define av_always_inline inline +#endif +#endif + +#ifndef av_extern_inline +#if defined(__ICL) && __ICL >= 1210 || defined(__GNUC_STDC_INLINE__) +# define av_extern_inline extern inline +#else +# define av_extern_inline inline +#endif +#endif + +#if AV_GCC_VERSION_AT_LEAST(3,4) +# define av_warn_unused_result __attribute__((warn_unused_result)) +#else +# define av_warn_unused_result +#endif + +#if AV_GCC_VERSION_AT_LEAST(3,1) +# define av_noinline __attribute__((noinline)) +#elif defined(_MSC_VER) +# define av_noinline __declspec(noinline) +#else +# define av_noinline +#endif + +#if AV_GCC_VERSION_AT_LEAST(3,1) || defined(__clang__) +# define av_pure __attribute__((pure)) +#else +# define av_pure +#endif + +#if AV_GCC_VERSION_AT_LEAST(2,6) || defined(__clang__) +# define av_const __attribute__((const)) +#else +# define av_const +#endif + +#if AV_GCC_VERSION_AT_LEAST(4,3) || defined(__clang__) +# define av_cold __attribute__((cold)) +#else +# define av_cold +#endif + +#if AV_GCC_VERSION_AT_LEAST(4,1) && !defined(__llvm__) +# define av_flatten __attribute__((flatten)) +#else +# define av_flatten +#endif + +#if AV_GCC_VERSION_AT_LEAST(3,1) +# define attribute_deprecated __attribute__((deprecated)) +#elif defined(_MSC_VER) +# define attribute_deprecated __declspec(deprecated) +#else +# define attribute_deprecated +#endif + +/** + * Disable warnings about deprecated features + * This is useful for sections of code kept for backward compatibility and + * scheduled for removal. + */ +#ifndef AV_NOWARN_DEPRECATED +#if AV_GCC_VERSION_AT_LEAST(4,6) +# define AV_NOWARN_DEPRECATED(code) \ + _Pragma("GCC diagnostic push") \ + _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") \ + code \ + _Pragma("GCC diagnostic pop") +#elif defined(_MSC_VER) +# define AV_NOWARN_DEPRECATED(code) \ + __pragma(warning(push)) \ + __pragma(warning(disable : 4996)) \ + code; \ + __pragma(warning(pop)) +#else +# define AV_NOWARN_DEPRECATED(code) code +#endif +#endif + +#if defined(__GNUC__) || defined(__clang__) +# define av_unused __attribute__((unused)) +#else +# define av_unused +#endif + +/** + * Mark a variable as used and prevent the compiler from optimizing it + * away. This is useful for variables accessed only from inline + * assembler without the compiler being aware. + */ +#if AV_GCC_VERSION_AT_LEAST(3,1) || defined(__clang__) +# define av_used __attribute__((used)) +#else +# define av_used +#endif + +#if AV_GCC_VERSION_AT_LEAST(3,3) || defined(__clang__) +# define av_alias __attribute__((may_alias)) +#else +# define av_alias +#endif + +#if (defined(__GNUC__) || defined(__clang__)) && !defined(__INTEL_COMPILER) +# define av_uninit(x) x=x +#else +# define av_uninit(x) x +#endif + +#if defined(__GNUC__) || defined(__clang__) +# define av_builtin_constant_p __builtin_constant_p +# define av_printf_format(fmtpos, attrpos) __attribute__((__format__(__printf__, fmtpos, attrpos))) +#else +# define av_builtin_constant_p(x) 0 +# define av_printf_format(fmtpos, attrpos) +#endif + +#if AV_GCC_VERSION_AT_LEAST(2,5) || defined(__clang__) +# define av_noreturn __attribute__((noreturn)) +#else +# define av_noreturn +#endif + +#endif /* AVUTIL_ATTRIBUTES_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/audio_fifo.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/audio_fifo.h new file mode 100644 index 0000000..d8a9194 --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/audio_fifo.h @@ -0,0 +1,187 @@ +/* + * Audio FIFO + * Copyright (c) 2012 Justin Ruggles + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * Audio FIFO Buffer + */ + +#ifndef AVUTIL_AUDIO_FIFO_H +#define AVUTIL_AUDIO_FIFO_H + +#include "avutil.h" +#include "fifo.h" +#include "samplefmt.h" + +/** + * @addtogroup lavu_audio + * @{ + * + * @defgroup lavu_audiofifo Audio FIFO Buffer + * @{ + */ + +/** + * Context for an Audio FIFO Buffer. + * + * - Operates at the sample level rather than the byte level. + * - Supports multiple channels with either planar or packed sample format. + * - Automatic reallocation when writing to a full buffer. + */ +typedef struct AVAudioFifo AVAudioFifo; + +/** + * Free an AVAudioFifo. + * + * @param af AVAudioFifo to free + */ +void av_audio_fifo_free(AVAudioFifo *af); + +/** + * Allocate an AVAudioFifo. + * + * @param sample_fmt sample format + * @param channels number of channels + * @param nb_samples initial allocation size, in samples + * @return newly allocated AVAudioFifo, or NULL on error + */ +AVAudioFifo *av_audio_fifo_alloc(enum AVSampleFormat sample_fmt, int channels, + int nb_samples); + +/** + * Reallocate an AVAudioFifo. + * + * @param af AVAudioFifo to reallocate + * @param nb_samples new allocation size, in samples + * @return 0 if OK, or negative AVERROR code on failure + */ +av_warn_unused_result +int av_audio_fifo_realloc(AVAudioFifo *af, int nb_samples); + +/** + * Write data to an AVAudioFifo. + * + * The AVAudioFifo will be reallocated automatically if the available space + * is less than nb_samples. + * + * @see enum AVSampleFormat + * The documentation for AVSampleFormat describes the data layout. + * + * @param af AVAudioFifo to write to + * @param data audio data plane pointers + * @param nb_samples number of samples to write + * @return number of samples actually written, or negative AVERROR + * code on failure. If successful, the number of samples + * actually written will always be nb_samples. + */ +int av_audio_fifo_write(AVAudioFifo *af, void **data, int nb_samples); + +/** + * Peek data from an AVAudioFifo. + * + * @see enum AVSampleFormat + * The documentation for AVSampleFormat describes the data layout. + * + * @param af AVAudioFifo to read from + * @param data audio data plane pointers + * @param nb_samples number of samples to peek + * @return number of samples actually peek, or negative AVERROR code + * on failure. The number of samples actually peek will not + * be greater than nb_samples, and will only be less than + * nb_samples if av_audio_fifo_size is less than nb_samples. + */ +int av_audio_fifo_peek(AVAudioFifo *af, void **data, int nb_samples); + +/** + * Peek data from an AVAudioFifo. + * + * @see enum AVSampleFormat + * The documentation for AVSampleFormat describes the data layout. + * + * @param af AVAudioFifo to read from + * @param data audio data plane pointers + * @param nb_samples number of samples to peek + * @param offset offset from current read position + * @return number of samples actually peek, or negative AVERROR code + * on failure. The number of samples actually peek will not + * be greater than nb_samples, and will only be less than + * nb_samples if av_audio_fifo_size is less than nb_samples. + */ +int av_audio_fifo_peek_at(AVAudioFifo *af, void **data, int nb_samples, int offset); + +/** + * Read data from an AVAudioFifo. + * + * @see enum AVSampleFormat + * The documentation for AVSampleFormat describes the data layout. + * + * @param af AVAudioFifo to read from + * @param data audio data plane pointers + * @param nb_samples number of samples to read + * @return number of samples actually read, or negative AVERROR code + * on failure. The number of samples actually read will not + * be greater than nb_samples, and will only be less than + * nb_samples if av_audio_fifo_size is less than nb_samples. + */ +int av_audio_fifo_read(AVAudioFifo *af, void **data, int nb_samples); + +/** + * Drain data from an AVAudioFifo. + * + * Removes the data without reading it. + * + * @param af AVAudioFifo to drain + * @param nb_samples number of samples to drain + * @return 0 if OK, or negative AVERROR code on failure + */ +int av_audio_fifo_drain(AVAudioFifo *af, int nb_samples); + +/** + * Reset the AVAudioFifo buffer. + * + * This empties all data in the buffer. + * + * @param af AVAudioFifo to reset + */ +void av_audio_fifo_reset(AVAudioFifo *af); + +/** + * Get the current number of samples in the AVAudioFifo available for reading. + * + * @param af the AVAudioFifo to query + * @return number of samples available for reading + */ +int av_audio_fifo_size(AVAudioFifo *af); + +/** + * Get the current number of samples in the AVAudioFifo available for writing. + * + * @param af the AVAudioFifo to query + * @return number of samples available for writing + */ +int av_audio_fifo_space(AVAudioFifo *af); + +/** + * @} + * @} + */ + +#endif /* AVUTIL_AUDIO_FIFO_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/avassert.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/avassert.h new file mode 100644 index 0000000..46f3fea --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/avassert.h @@ -0,0 +1,75 @@ +/* + * copyright (c) 2010 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * simple assert() macros that are a bit more flexible than ISO C assert(). + * @author Michael Niedermayer + */ + +#ifndef AVUTIL_AVASSERT_H +#define AVUTIL_AVASSERT_H + +#include +#include "avutil.h" +#include "log.h" + +/** + * assert() equivalent, that is always enabled. + */ +#define av_assert0(cond) do { \ + if (!(cond)) { \ + av_log(NULL, AV_LOG_PANIC, "Assertion %s failed at %s:%d\n", \ + AV_STRINGIFY(cond), __FILE__, __LINE__); \ + abort(); \ + } \ +} while (0) + + +/** + * assert() equivalent, that does not lie in speed critical code. + * These asserts() thus can be enabled without fearing speed loss. + */ +#if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 0 +#define av_assert1(cond) av_assert0(cond) +#else +#define av_assert1(cond) ((void)0) +#endif + + +/** + * assert() equivalent, that does lie in speed critical code. + */ +#if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 1 +#define av_assert2(cond) av_assert0(cond) +#define av_assert2_fpu() av_assert0_fpu() +#else +#define av_assert2(cond) ((void)0) +#define av_assert2_fpu() ((void)0) +#endif + +/** + * Assert that floating point opperations can be executed. + * + * This will av_assert0() that the cpu is not in MMX state on X86 + */ +void av_assert0_fpu(void); + +#endif /* AVUTIL_AVASSERT_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/avconfig.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/avconfig.h new file mode 100644 index 0000000..c289fbb --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/avconfig.h @@ -0,0 +1,6 @@ +/* Generated by ffmpeg configure */ +#ifndef AVUTIL_AVCONFIG_H +#define AVUTIL_AVCONFIG_H +#define AV_HAVE_BIGENDIAN 0 +#define AV_HAVE_FAST_UNALIGNED 1 +#endif /* AVUTIL_AVCONFIG_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/avstring.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/avstring.h new file mode 100644 index 0000000..04d2695 --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/avstring.h @@ -0,0 +1,407 @@ +/* + * Copyright (c) 2007 Mans Rullgard + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_AVSTRING_H +#define AVUTIL_AVSTRING_H + +#include +#include +#include "attributes.h" + +/** + * @addtogroup lavu_string + * @{ + */ + +/** + * Return non-zero if pfx is a prefix of str. If it is, *ptr is set to + * the address of the first character in str after the prefix. + * + * @param str input string + * @param pfx prefix to test + * @param ptr updated if the prefix is matched inside str + * @return non-zero if the prefix matches, zero otherwise + */ +int av_strstart(const char *str, const char *pfx, const char **ptr); + +/** + * Return non-zero if pfx is a prefix of str independent of case. If + * it is, *ptr is set to the address of the first character in str + * after the prefix. + * + * @param str input string + * @param pfx prefix to test + * @param ptr updated if the prefix is matched inside str + * @return non-zero if the prefix matches, zero otherwise + */ +int av_stristart(const char *str, const char *pfx, const char **ptr); + +/** + * Locate the first case-independent occurrence in the string haystack + * of the string needle. A zero-length string needle is considered to + * match at the start of haystack. + * + * This function is a case-insensitive version of the standard strstr(). + * + * @param haystack string to search in + * @param needle string to search for + * @return pointer to the located match within haystack + * or a null pointer if no match + */ +char *av_stristr(const char *haystack, const char *needle); + +/** + * Locate the first occurrence of the string needle in the string haystack + * where not more than hay_length characters are searched. A zero-length + * string needle is considered to match at the start of haystack. + * + * This function is a length-limited version of the standard strstr(). + * + * @param haystack string to search in + * @param needle string to search for + * @param hay_length length of string to search in + * @return pointer to the located match within haystack + * or a null pointer if no match + */ +char *av_strnstr(const char *haystack, const char *needle, size_t hay_length); + +/** + * Copy the string src to dst, but no more than size - 1 bytes, and + * null-terminate dst. + * + * This function is the same as BSD strlcpy(). + * + * @param dst destination buffer + * @param src source string + * @param size size of destination buffer + * @return the length of src + * + * @warning since the return value is the length of src, src absolutely + * _must_ be a properly 0-terminated string, otherwise this will read beyond + * the end of the buffer and possibly crash. + */ +size_t av_strlcpy(char *dst, const char *src, size_t size); + +/** + * Append the string src to the string dst, but to a total length of + * no more than size - 1 bytes, and null-terminate dst. + * + * This function is similar to BSD strlcat(), but differs when + * size <= strlen(dst). + * + * @param dst destination buffer + * @param src source string + * @param size size of destination buffer + * @return the total length of src and dst + * + * @warning since the return value use the length of src and dst, these + * absolutely _must_ be a properly 0-terminated strings, otherwise this + * will read beyond the end of the buffer and possibly crash. + */ +size_t av_strlcat(char *dst, const char *src, size_t size); + +/** + * Append output to a string, according to a format. Never write out of + * the destination buffer, and always put a terminating 0 within + * the buffer. + * @param dst destination buffer (string to which the output is + * appended) + * @param size total size of the destination buffer + * @param fmt printf-compatible format string, specifying how the + * following parameters are used + * @return the length of the string that would have been generated + * if enough space had been available + */ +size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...) av_printf_format(3, 4); + +/** + * Get the count of continuous non zero chars starting from the beginning. + * + * @param len maximum number of characters to check in the string, that + * is the maximum value which is returned by the function + */ +static inline size_t av_strnlen(const char *s, size_t len) +{ + size_t i; + for (i = 0; i < len && s[i]; i++) + ; + return i; +} + +/** + * Print arguments following specified format into a large enough auto + * allocated buffer. It is similar to GNU asprintf(). + * @param fmt printf-compatible format string, specifying how the + * following parameters are used. + * @return the allocated string + * @note You have to free the string yourself with av_free(). + */ +char *av_asprintf(const char *fmt, ...) av_printf_format(1, 2); + +/** + * Convert a number to an av_malloced string. + */ +char *av_d2str(double d); + +/** + * Unescape the given string until a non escaped terminating char, + * and return the token corresponding to the unescaped string. + * + * The normal \ and ' escaping is supported. Leading and trailing + * whitespaces are removed, unless they are escaped with '\' or are + * enclosed between ''. + * + * @param buf the buffer to parse, buf will be updated to point to the + * terminating char + * @param term a 0-terminated list of terminating chars + * @return the malloced unescaped string, which must be av_freed by + * the user, NULL in case of allocation failure + */ +char *av_get_token(const char **buf, const char *term); + +/** + * Split the string into several tokens which can be accessed by + * successive calls to av_strtok(). + * + * A token is defined as a sequence of characters not belonging to the + * set specified in delim. + * + * On the first call to av_strtok(), s should point to the string to + * parse, and the value of saveptr is ignored. In subsequent calls, s + * should be NULL, and saveptr should be unchanged since the previous + * call. + * + * This function is similar to strtok_r() defined in POSIX.1. + * + * @param s the string to parse, may be NULL + * @param delim 0-terminated list of token delimiters, must be non-NULL + * @param saveptr user-provided pointer which points to stored + * information necessary for av_strtok() to continue scanning the same + * string. saveptr is updated to point to the next character after the + * first delimiter found, or to NULL if the string was terminated + * @return the found token, or NULL when no token is found + */ +char *av_strtok(char *s, const char *delim, char **saveptr); + +/** + * Locale-independent conversion of ASCII isdigit. + */ +static inline av_const int av_isdigit(int c) +{ + return c >= '0' && c <= '9'; +} + +/** + * Locale-independent conversion of ASCII isgraph. + */ +static inline av_const int av_isgraph(int c) +{ + return c > 32 && c < 127; +} + +/** + * Locale-independent conversion of ASCII isspace. + */ +static inline av_const int av_isspace(int c) +{ + return c == ' ' || c == '\f' || c == '\n' || c == '\r' || c == '\t' || + c == '\v'; +} + +/** + * Locale-independent conversion of ASCII characters to uppercase. + */ +static inline av_const int av_toupper(int c) +{ + if (c >= 'a' && c <= 'z') + c ^= 0x20; + return c; +} + +/** + * Locale-independent conversion of ASCII characters to lowercase. + */ +static inline av_const int av_tolower(int c) +{ + if (c >= 'A' && c <= 'Z') + c ^= 0x20; + return c; +} + +/** + * Locale-independent conversion of ASCII isxdigit. + */ +static inline av_const int av_isxdigit(int c) +{ + c = av_tolower(c); + return av_isdigit(c) || (c >= 'a' && c <= 'f'); +} + +/** + * Locale-independent case-insensitive compare. + * @note This means only ASCII-range characters are case-insensitive + */ +int av_strcasecmp(const char *a, const char *b); + +/** + * Locale-independent case-insensitive compare. + * @note This means only ASCII-range characters are case-insensitive + */ +int av_strncasecmp(const char *a, const char *b, size_t n); + +/** + * Locale-independent strings replace. + * @note This means only ASCII-range characters are replace + */ +char *av_strireplace(const char *str, const char *from, const char *to); + +/** + * Thread safe basename. + * @param path the path, on DOS both \ and / are considered separators. + * @return pointer to the basename substring. + */ +const char *av_basename(const char *path); + +/** + * Thread safe dirname. + * @param path the path, on DOS both \ and / are considered separators. + * @return the path with the separator replaced by the string terminator or ".". + * @note the function may change the input string. + */ +const char *av_dirname(char *path); + +/** + * Match instances of a name in a comma-separated list of names. + * List entries are checked from the start to the end of the names list, + * the first match ends further processing. If an entry prefixed with '-' + * matches, then 0 is returned. The "ALL" list entry is considered to + * match all names. + * + * @param name Name to look for. + * @param names List of names. + * @return 1 on match, 0 otherwise. + */ +int av_match_name(const char *name, const char *names); + +/** + * Append path component to the existing path. + * Path separator '/' is placed between when needed. + * Resulting string have to be freed with av_free(). + * @param path base path + * @param component component to be appended + * @return new path or NULL on error. + */ +char *av_append_path_component(const char *path, const char *component); + +enum AVEscapeMode { + AV_ESCAPE_MODE_AUTO, ///< Use auto-selected escaping mode. + AV_ESCAPE_MODE_BACKSLASH, ///< Use backslash escaping. + AV_ESCAPE_MODE_QUOTE, ///< Use single-quote escaping. +}; + +/** + * Consider spaces special and escape them even in the middle of the + * string. + * + * This is equivalent to adding the whitespace characters to the special + * characters lists, except it is guaranteed to use the exact same list + * of whitespace characters as the rest of libavutil. + */ +#define AV_ESCAPE_FLAG_WHITESPACE (1 << 0) + +/** + * Escape only specified special characters. + * Without this flag, escape also any characters that may be considered + * special by av_get_token(), such as the single quote. + */ +#define AV_ESCAPE_FLAG_STRICT (1 << 1) + +/** + * Escape string in src, and put the escaped string in an allocated + * string in *dst, which must be freed with av_free(). + * + * @param dst pointer where an allocated string is put + * @param src string to escape, must be non-NULL + * @param special_chars string containing the special characters which + * need to be escaped, can be NULL + * @param mode escape mode to employ, see AV_ESCAPE_MODE_* macros. + * Any unknown value for mode will be considered equivalent to + * AV_ESCAPE_MODE_BACKSLASH, but this behaviour can change without + * notice. + * @param flags flags which control how to escape, see AV_ESCAPE_FLAG_ macros + * @return the length of the allocated string, or a negative error code in case of error + * @see av_bprint_escape() + */ +av_warn_unused_result +int av_escape(char **dst, const char *src, const char *special_chars, + enum AVEscapeMode mode, int flags); + +#define AV_UTF8_FLAG_ACCEPT_INVALID_BIG_CODES 1 ///< accept codepoints over 0x10FFFF +#define AV_UTF8_FLAG_ACCEPT_NON_CHARACTERS 2 ///< accept non-characters - 0xFFFE and 0xFFFF +#define AV_UTF8_FLAG_ACCEPT_SURROGATES 4 ///< accept UTF-16 surrogates codes +#define AV_UTF8_FLAG_EXCLUDE_XML_INVALID_CONTROL_CODES 8 ///< exclude control codes not accepted by XML + +#define AV_UTF8_FLAG_ACCEPT_ALL \ + AV_UTF8_FLAG_ACCEPT_INVALID_BIG_CODES|AV_UTF8_FLAG_ACCEPT_NON_CHARACTERS|AV_UTF8_FLAG_ACCEPT_SURROGATES + +/** + * Read and decode a single UTF-8 code point (character) from the + * buffer in *buf, and update *buf to point to the next byte to + * decode. + * + * In case of an invalid byte sequence, the pointer will be updated to + * the next byte after the invalid sequence and the function will + * return an error code. + * + * Depending on the specified flags, the function will also fail in + * case the decoded code point does not belong to a valid range. + * + * @note For speed-relevant code a carefully implemented use of + * GET_UTF8() may be preferred. + * + * @param codep pointer used to return the parsed code in case of success. + * The value in *codep is set even in case the range check fails. + * @param bufp pointer to the address the first byte of the sequence + * to decode, updated by the function to point to the + * byte next after the decoded sequence + * @param buf_end pointer to the end of the buffer, points to the next + * byte past the last in the buffer. This is used to + * avoid buffer overreads (in case of an unfinished + * UTF-8 sequence towards the end of the buffer). + * @param flags a collection of AV_UTF8_FLAG_* flags + * @return >= 0 in case a sequence was successfully read, a negative + * value in case of invalid sequence + */ +av_warn_unused_result +int av_utf8_decode(int32_t *codep, const uint8_t **bufp, const uint8_t *buf_end, + unsigned int flags); + +/** + * Check if a name is in a list. + * @returns 0 if not found, or the 1 based index where it has been found in the + * list. + */ +int av_match_list(const char *name, const char *list, char separator); + +/** + * @} + */ + +#endif /* AVUTIL_AVSTRING_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/avutil.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/avutil.h new file mode 100644 index 0000000..4d63315 --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/avutil.h @@ -0,0 +1,365 @@ +/* + * copyright (c) 2006 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_AVUTIL_H +#define AVUTIL_AVUTIL_H + +/** + * @file + * @ingroup lavu + * Convenience header that includes @ref lavu "libavutil"'s core. + */ + +/** + * @mainpage + * + * @section ffmpeg_intro Introduction + * + * This document describes the usage of the different libraries + * provided by FFmpeg. + * + * @li @ref libavc "libavcodec" encoding/decoding library + * @li @ref lavfi "libavfilter" graph-based frame editing library + * @li @ref libavf "libavformat" I/O and muxing/demuxing library + * @li @ref lavd "libavdevice" special devices muxing/demuxing library + * @li @ref lavu "libavutil" common utility library + * @li @ref lswr "libswresample" audio resampling, format conversion and mixing + * @li @ref lpp "libpostproc" post processing library + * @li @ref libsws "libswscale" color conversion and scaling library + * + * @section ffmpeg_versioning Versioning and compatibility + * + * Each of the FFmpeg libraries contains a version.h header, which defines a + * major, minor and micro version number with the + * LIBRARYNAME_VERSION_{MAJOR,MINOR,MICRO} macros. The major version + * number is incremented with backward incompatible changes - e.g. removing + * parts of the public API, reordering public struct members, etc. The minor + * version number is incremented for backward compatible API changes or major + * new features - e.g. adding a new public function or a new decoder. The micro + * version number is incremented for smaller changes that a calling program + * might still want to check for - e.g. changing behavior in a previously + * unspecified situation. + * + * FFmpeg guarantees backward API and ABI compatibility for each library as long + * as its major version number is unchanged. This means that no public symbols + * will be removed or renamed. Types and names of the public struct members and + * values of public macros and enums will remain the same (unless they were + * explicitly declared as not part of the public API). Documented behavior will + * not change. + * + * In other words, any correct program that works with a given FFmpeg snapshot + * should work just as well without any changes with any later snapshot with the + * same major versions. This applies to both rebuilding the program against new + * FFmpeg versions or to replacing the dynamic FFmpeg libraries that a program + * links against. + * + * However, new public symbols may be added and new members may be appended to + * public structs whose size is not part of public ABI (most public structs in + * FFmpeg). New macros and enum values may be added. Behavior in undocumented + * situations may change slightly (and be documented). All those are accompanied + * by an entry in doc/APIchanges and incrementing either the minor or micro + * version number. + */ + +/** + * @defgroup lavu libavutil + * Common code shared across all FFmpeg libraries. + * + * @note + * libavutil is designed to be modular. In most cases, in order to use the + * functions provided by one component of libavutil you must explicitly include + * the specific header containing that feature. If you are only using + * media-related components, you could simply include libavutil/avutil.h, which + * brings in most of the "core" components. + * + * @{ + * + * @defgroup lavu_crypto Crypto and Hashing + * + * @{ + * @} + * + * @defgroup lavu_math Mathematics + * @{ + * + * @} + * + * @defgroup lavu_string String Manipulation + * + * @{ + * + * @} + * + * @defgroup lavu_mem Memory Management + * + * @{ + * + * @} + * + * @defgroup lavu_data Data Structures + * @{ + * + * @} + * + * @defgroup lavu_video Video related + * + * @{ + * + * @} + * + * @defgroup lavu_audio Audio related + * + * @{ + * + * @} + * + * @defgroup lavu_error Error Codes + * + * @{ + * + * @} + * + * @defgroup lavu_log Logging Facility + * + * @{ + * + * @} + * + * @defgroup lavu_misc Other + * + * @{ + * + * @defgroup preproc_misc Preprocessor String Macros + * + * @{ + * + * @} + * + * @defgroup version_utils Library Version Macros + * + * @{ + * + * @} + */ + + +/** + * @addtogroup lavu_ver + * @{ + */ + +/** + * Return the LIBAVUTIL_VERSION_INT constant. + */ +unsigned avutil_version(void); + +/** + * Return an informative version string. This usually is the actual release + * version number or a git commit description. This string has no fixed format + * and can change any time. It should never be parsed by code. + */ +const char *av_version_info(void); + +/** + * Return the libavutil build-time configuration. + */ +const char *avutil_configuration(void); + +/** + * Return the libavutil license. + */ +const char *avutil_license(void); + +/** + * @} + */ + +/** + * @addtogroup lavu_media Media Type + * @brief Media Type + */ + +enum AVMediaType { + AVMEDIA_TYPE_UNKNOWN = -1, ///< Usually treated as AVMEDIA_TYPE_DATA + AVMEDIA_TYPE_VIDEO, + AVMEDIA_TYPE_AUDIO, + AVMEDIA_TYPE_DATA, ///< Opaque data information usually continuous + AVMEDIA_TYPE_SUBTITLE, + AVMEDIA_TYPE_ATTACHMENT, ///< Opaque data information usually sparse + AVMEDIA_TYPE_NB +}; + +/** + * Return a string describing the media_type enum, NULL if media_type + * is unknown. + */ +const char *av_get_media_type_string(enum AVMediaType media_type); + +/** + * @defgroup lavu_const Constants + * @{ + * + * @defgroup lavu_enc Encoding specific + * + * @note those definition should move to avcodec + * @{ + */ + +#define FF_LAMBDA_SHIFT 7 +#define FF_LAMBDA_SCALE (1< + +/** + * @defgroup lavu_base64 Base64 + * @ingroup lavu_crypto + * @{ + */ + +/** + * Decode a base64-encoded string. + * + * @param out buffer for decoded data + * @param in null-terminated input string + * @param out_size size in bytes of the out buffer, must be at + * least 3/4 of the length of in, that is AV_BASE64_DECODE_SIZE(strlen(in)) + * @return number of bytes written, or a negative value in case of + * invalid input + */ +int av_base64_decode(uint8_t *out, const char *in, int out_size); + +/** + * Calculate the output size in bytes needed to decode a base64 string + * with length x to a data buffer. + */ +#define AV_BASE64_DECODE_SIZE(x) ((x) * 3LL / 4) + +/** + * Encode data to base64 and null-terminate. + * + * @param out buffer for encoded data + * @param out_size size in bytes of the out buffer (including the + * null terminator), must be at least AV_BASE64_SIZE(in_size) + * @param in input buffer containing the data to encode + * @param in_size size in bytes of the in buffer + * @return out or NULL in case of error + */ +char *av_base64_encode(char *out, int out_size, const uint8_t *in, int in_size); + +/** + * Calculate the output size needed to base64-encode x bytes to a + * null-terminated string. + */ +#define AV_BASE64_SIZE(x) (((x)+2) / 3 * 4 + 1) + + /** + * @} + */ + +#endif /* AVUTIL_BASE64_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/blowfish.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/blowfish.h new file mode 100644 index 0000000..9e289a4 --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/blowfish.h @@ -0,0 +1,82 @@ +/* + * Blowfish algorithm + * Copyright (c) 2012 Samuel Pitoiset + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_BLOWFISH_H +#define AVUTIL_BLOWFISH_H + +#include + +/** + * @defgroup lavu_blowfish Blowfish + * @ingroup lavu_crypto + * @{ + */ + +#define AV_BF_ROUNDS 16 + +typedef struct AVBlowfish { + uint32_t p[AV_BF_ROUNDS + 2]; + uint32_t s[4][256]; +} AVBlowfish; + +/** + * Allocate an AVBlowfish context. + */ +AVBlowfish *av_blowfish_alloc(void); + +/** + * Initialize an AVBlowfish context. + * + * @param ctx an AVBlowfish context + * @param key a key + * @param key_len length of the key + */ +void av_blowfish_init(struct AVBlowfish *ctx, const uint8_t *key, int key_len); + +/** + * Encrypt or decrypt a buffer using a previously initialized context. + * + * @param ctx an AVBlowfish context + * @param xl left four bytes halves of input to be encrypted + * @param xr right four bytes halves of input to be encrypted + * @param decrypt 0 for encryption, 1 for decryption + */ +void av_blowfish_crypt_ecb(struct AVBlowfish *ctx, uint32_t *xl, uint32_t *xr, + int decrypt); + +/** + * Encrypt or decrypt a buffer using a previously initialized context. + * + * @param ctx an AVBlowfish context + * @param dst destination array, can be equal to src + * @param src source array, can be equal to dst + * @param count number of 8 byte blocks + * @param iv initialization vector for CBC mode, if NULL ECB will be used + * @param decrypt 0 for encryption, 1 for decryption + */ +void av_blowfish_crypt(struct AVBlowfish *ctx, uint8_t *dst, const uint8_t *src, + int count, uint8_t *iv, int decrypt); + +/** + * @} + */ + +#endif /* AVUTIL_BLOWFISH_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/bprint.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/bprint.h new file mode 100644 index 0000000..c09b1ac --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/bprint.h @@ -0,0 +1,219 @@ +/* + * Copyright (c) 2012 Nicolas George + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_BPRINT_H +#define AVUTIL_BPRINT_H + +#include + +#include "attributes.h" +#include "avstring.h" + +/** + * Define a structure with extra padding to a fixed size + * This helps ensuring binary compatibility with future versions. + */ + +#define FF_PAD_STRUCTURE(name, size, ...) \ +struct ff_pad_helper_##name { __VA_ARGS__ }; \ +typedef struct name { \ + __VA_ARGS__ \ + char reserved_padding[size - sizeof(struct ff_pad_helper_##name)]; \ +} name; + +/** + * Buffer to print data progressively + * + * The string buffer grows as necessary and is always 0-terminated. + * The content of the string is never accessed, and thus is + * encoding-agnostic and can even hold binary data. + * + * Small buffers are kept in the structure itself, and thus require no + * memory allocation at all (unless the contents of the buffer is needed + * after the structure goes out of scope). This is almost as lightweight as + * declaring a local "char buf[512]". + * + * The length of the string can go beyond the allocated size: the buffer is + * then truncated, but the functions still keep account of the actual total + * length. + * + * In other words, buf->len can be greater than buf->size and records the + * total length of what would have been to the buffer if there had been + * enough memory. + * + * Append operations do not need to be tested for failure: if a memory + * allocation fails, data stop being appended to the buffer, but the length + * is still updated. This situation can be tested with + * av_bprint_is_complete(). + * + * The size_max field determines several possible behaviours: + * + * size_max = -1 (= UINT_MAX) or any large value will let the buffer be + * reallocated as necessary, with an amortized linear cost. + * + * size_max = 0 prevents writing anything to the buffer: only the total + * length is computed. The write operations can then possibly be repeated in + * a buffer with exactly the necessary size + * (using size_init = size_max = len + 1). + * + * size_max = 1 is automatically replaced by the exact size available in the + * structure itself, thus ensuring no dynamic memory allocation. The + * internal buffer is large enough to hold a reasonable paragraph of text, + * such as the current paragraph. + */ + +FF_PAD_STRUCTURE(AVBPrint, 1024, + char *str; /**< string so far */ + unsigned len; /**< length so far */ + unsigned size; /**< allocated memory */ + unsigned size_max; /**< maximum allocated memory */ + char reserved_internal_buffer[1]; +) + +/** + * Convenience macros for special values for av_bprint_init() size_max + * parameter. + */ +#define AV_BPRINT_SIZE_UNLIMITED ((unsigned)-1) +#define AV_BPRINT_SIZE_AUTOMATIC 1 +#define AV_BPRINT_SIZE_COUNT_ONLY 0 + +/** + * Init a print buffer. + * + * @param buf buffer to init + * @param size_init initial size (including the final 0) + * @param size_max maximum size; + * 0 means do not write anything, just count the length; + * 1 is replaced by the maximum value for automatic storage; + * any large value means that the internal buffer will be + * reallocated as needed up to that limit; -1 is converted to + * UINT_MAX, the largest limit possible. + * Check also AV_BPRINT_SIZE_* macros. + */ +void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max); + +/** + * Init a print buffer using a pre-existing buffer. + * + * The buffer will not be reallocated. + * + * @param buf buffer structure to init + * @param buffer byte buffer to use for the string data + * @param size size of buffer + */ +void av_bprint_init_for_buffer(AVBPrint *buf, char *buffer, unsigned size); + +/** + * Append a formatted string to a print buffer. + */ +void av_bprintf(AVBPrint *buf, const char *fmt, ...) av_printf_format(2, 3); + +/** + * Append a formatted string to a print buffer. + */ +void av_vbprintf(AVBPrint *buf, const char *fmt, va_list vl_arg); + +/** + * Append char c n times to a print buffer. + */ +void av_bprint_chars(AVBPrint *buf, char c, unsigned n); + +/** + * Append data to a print buffer. + * + * param buf bprint buffer to use + * param data pointer to data + * param size size of data + */ +void av_bprint_append_data(AVBPrint *buf, const char *data, unsigned size); + +struct tm; +/** + * Append a formatted date and time to a print buffer. + * + * param buf bprint buffer to use + * param fmt date and time format string, see strftime() + * param tm broken-down time structure to translate + * + * @note due to poor design of the standard strftime function, it may + * produce poor results if the format string expands to a very long text and + * the bprint buffer is near the limit stated by the size_max option. + */ +void av_bprint_strftime(AVBPrint *buf, const char *fmt, const struct tm *tm); + +/** + * Allocate bytes in the buffer for external use. + * + * @param[in] buf buffer structure + * @param[in] size required size + * @param[out] mem pointer to the memory area + * @param[out] actual_size size of the memory area after allocation; + * can be larger or smaller than size + */ +void av_bprint_get_buffer(AVBPrint *buf, unsigned size, + unsigned char **mem, unsigned *actual_size); + +/** + * Reset the string to "" but keep internal allocated data. + */ +void av_bprint_clear(AVBPrint *buf); + +/** + * Test if the print buffer is complete (not truncated). + * + * It may have been truncated due to a memory allocation failure + * or the size_max limit (compare size and size_max if necessary). + */ +static inline int av_bprint_is_complete(const AVBPrint *buf) +{ + return buf->len < buf->size; +} + +/** + * Finalize a print buffer. + * + * The print buffer can no longer be used afterwards, + * but the len and size fields are still valid. + * + * @arg[out] ret_str if not NULL, used to return a permanent copy of the + * buffer contents, or NULL if memory allocation fails; + * if NULL, the buffer is discarded and freed + * @return 0 for success or error code (probably AVERROR(ENOMEM)) + */ +int av_bprint_finalize(AVBPrint *buf, char **ret_str); + +/** + * Escape the content in src and append it to dstbuf. + * + * @param dstbuf already inited destination bprint buffer + * @param src string containing the text to escape + * @param special_chars string containing the special characters which + * need to be escaped, can be NULL + * @param mode escape mode to employ, see AV_ESCAPE_MODE_* macros. + * Any unknown value for mode will be considered equivalent to + * AV_ESCAPE_MODE_BACKSLASH, but this behaviour can change without + * notice. + * @param flags flags which control how to escape, see AV_ESCAPE_FLAG_* macros + */ +void av_bprint_escape(AVBPrint *dstbuf, const char *src, const char *special_chars, + enum AVEscapeMode mode, int flags); + +#endif /* AVUTIL_BPRINT_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/bswap.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/bswap.h new file mode 100644 index 0000000..91cb795 --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/bswap.h @@ -0,0 +1,109 @@ +/* + * copyright (c) 2006 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * byte swapping routines + */ + +#ifndef AVUTIL_BSWAP_H +#define AVUTIL_BSWAP_H + +#include +#include "libavutil/avconfig.h" +#include "attributes.h" + +#ifdef HAVE_AV_CONFIG_H + +#include "config.h" + +#if ARCH_AARCH64 +# include "aarch64/bswap.h" +#elif ARCH_ARM +# include "arm/bswap.h" +#elif ARCH_AVR32 +# include "avr32/bswap.h" +#elif ARCH_SH4 +# include "sh4/bswap.h" +#elif ARCH_X86 +# include "x86/bswap.h" +#endif + +#endif /* HAVE_AV_CONFIG_H */ + +#define AV_BSWAP16C(x) (((x) << 8 & 0xff00) | ((x) >> 8 & 0x00ff)) +#define AV_BSWAP32C(x) (AV_BSWAP16C(x) << 16 | AV_BSWAP16C((x) >> 16)) +#define AV_BSWAP64C(x) (AV_BSWAP32C(x) << 32 | AV_BSWAP32C((x) >> 32)) + +#define AV_BSWAPC(s, x) AV_BSWAP##s##C(x) + +#ifndef av_bswap16 +static av_always_inline av_const uint16_t av_bswap16(uint16_t x) +{ + x= (x>>8) | (x<<8); + return x; +} +#endif + +#ifndef av_bswap32 +static av_always_inline av_const uint32_t av_bswap32(uint32_t x) +{ + return AV_BSWAP32C(x); +} +#endif + +#ifndef av_bswap64 +static inline uint64_t av_const av_bswap64(uint64_t x) +{ + return (uint64_t)av_bswap32(x) << 32 | av_bswap32(x >> 32); +} +#endif + +// be2ne ... big-endian to native-endian +// le2ne ... little-endian to native-endian + +#if AV_HAVE_BIGENDIAN +#define av_be2ne16(x) (x) +#define av_be2ne32(x) (x) +#define av_be2ne64(x) (x) +#define av_le2ne16(x) av_bswap16(x) +#define av_le2ne32(x) av_bswap32(x) +#define av_le2ne64(x) av_bswap64(x) +#define AV_BE2NEC(s, x) (x) +#define AV_LE2NEC(s, x) AV_BSWAPC(s, x) +#else +#define av_be2ne16(x) av_bswap16(x) +#define av_be2ne32(x) av_bswap32(x) +#define av_be2ne64(x) av_bswap64(x) +#define av_le2ne16(x) (x) +#define av_le2ne32(x) (x) +#define av_le2ne64(x) (x) +#define AV_BE2NEC(s, x) AV_BSWAPC(s, x) +#define AV_LE2NEC(s, x) (x) +#endif + +#define AV_BE2NE16C(x) AV_BE2NEC(16, x) +#define AV_BE2NE32C(x) AV_BE2NEC(32, x) +#define AV_BE2NE64C(x) AV_BE2NEC(64, x) +#define AV_LE2NE16C(x) AV_LE2NEC(16, x) +#define AV_LE2NE32C(x) AV_LE2NEC(32, x) +#define AV_LE2NE64C(x) AV_LE2NEC(64, x) + +#endif /* AVUTIL_BSWAP_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/buffer.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/buffer.h new file mode 100644 index 0000000..73b6bd0 --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/buffer.h @@ -0,0 +1,291 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * @ingroup lavu_buffer + * refcounted data buffer API + */ + +#ifndef AVUTIL_BUFFER_H +#define AVUTIL_BUFFER_H + +#include + +/** + * @defgroup lavu_buffer AVBuffer + * @ingroup lavu_data + * + * @{ + * AVBuffer is an API for reference-counted data buffers. + * + * There are two core objects in this API -- AVBuffer and AVBufferRef. AVBuffer + * represents the data buffer itself; it is opaque and not meant to be accessed + * by the caller directly, but only through AVBufferRef. However, the caller may + * e.g. compare two AVBuffer pointers to check whether two different references + * are describing the same data buffer. AVBufferRef represents a single + * reference to an AVBuffer and it is the object that may be manipulated by the + * caller directly. + * + * There are two functions provided for creating a new AVBuffer with a single + * reference -- av_buffer_alloc() to just allocate a new buffer, and + * av_buffer_create() to wrap an existing array in an AVBuffer. From an existing + * reference, additional references may be created with av_buffer_ref(). + * Use av_buffer_unref() to free a reference (this will automatically free the + * data once all the references are freed). + * + * The convention throughout this API and the rest of FFmpeg is such that the + * buffer is considered writable if there exists only one reference to it (and + * it has not been marked as read-only). The av_buffer_is_writable() function is + * provided to check whether this is true and av_buffer_make_writable() will + * automatically create a new writable buffer when necessary. + * Of course nothing prevents the calling code from violating this convention, + * however that is safe only when all the existing references are under its + * control. + * + * @note Referencing and unreferencing the buffers is thread-safe and thus + * may be done from multiple threads simultaneously without any need for + * additional locking. + * + * @note Two different references to the same buffer can point to different + * parts of the buffer (i.e. their AVBufferRef.data will not be equal). + */ + +/** + * A reference counted buffer type. It is opaque and is meant to be used through + * references (AVBufferRef). + */ +typedef struct AVBuffer AVBuffer; + +/** + * A reference to a data buffer. + * + * The size of this struct is not a part of the public ABI and it is not meant + * to be allocated directly. + */ +typedef struct AVBufferRef { + AVBuffer *buffer; + + /** + * The data buffer. It is considered writable if and only if + * this is the only reference to the buffer, in which case + * av_buffer_is_writable() returns 1. + */ + uint8_t *data; + /** + * Size of data in bytes. + */ + int size; +} AVBufferRef; + +/** + * Allocate an AVBuffer of the given size using av_malloc(). + * + * @return an AVBufferRef of given size or NULL when out of memory + */ +AVBufferRef *av_buffer_alloc(int size); + +/** + * Same as av_buffer_alloc(), except the returned buffer will be initialized + * to zero. + */ +AVBufferRef *av_buffer_allocz(int size); + +/** + * Always treat the buffer as read-only, even when it has only one + * reference. + */ +#define AV_BUFFER_FLAG_READONLY (1 << 0) + +/** + * Create an AVBuffer from an existing array. + * + * If this function is successful, data is owned by the AVBuffer. The caller may + * only access data through the returned AVBufferRef and references derived from + * it. + * If this function fails, data is left untouched. + * @param data data array + * @param size size of data in bytes + * @param free a callback for freeing this buffer's data + * @param opaque parameter to be got for processing or passed to free + * @param flags a combination of AV_BUFFER_FLAG_* + * + * @return an AVBufferRef referring to data on success, NULL on failure. + */ +AVBufferRef *av_buffer_create(uint8_t *data, int size, + void (*free)(void *opaque, uint8_t *data), + void *opaque, int flags); + +/** + * Default free callback, which calls av_free() on the buffer data. + * This function is meant to be passed to av_buffer_create(), not called + * directly. + */ +void av_buffer_default_free(void *opaque, uint8_t *data); + +/** + * Create a new reference to an AVBuffer. + * + * @return a new AVBufferRef referring to the same AVBuffer as buf or NULL on + * failure. + */ +AVBufferRef *av_buffer_ref(AVBufferRef *buf); + +/** + * Free a given reference and automatically free the buffer if there are no more + * references to it. + * + * @param buf the reference to be freed. The pointer is set to NULL on return. + */ +void av_buffer_unref(AVBufferRef **buf); + +/** + * @return 1 if the caller may write to the data referred to by buf (which is + * true if and only if buf is the only reference to the underlying AVBuffer). + * Return 0 otherwise. + * A positive answer is valid until av_buffer_ref() is called on buf. + */ +int av_buffer_is_writable(const AVBufferRef *buf); + +/** + * @return the opaque parameter set by av_buffer_create. + */ +void *av_buffer_get_opaque(const AVBufferRef *buf); + +int av_buffer_get_ref_count(const AVBufferRef *buf); + +/** + * Create a writable reference from a given buffer reference, avoiding data copy + * if possible. + * + * @param buf buffer reference to make writable. On success, buf is either left + * untouched, or it is unreferenced and a new writable AVBufferRef is + * written in its place. On failure, buf is left untouched. + * @return 0 on success, a negative AVERROR on failure. + */ +int av_buffer_make_writable(AVBufferRef **buf); + +/** + * Reallocate a given buffer. + * + * @param buf a buffer reference to reallocate. On success, buf will be + * unreferenced and a new reference with the required size will be + * written in its place. On failure buf will be left untouched. *buf + * may be NULL, then a new buffer is allocated. + * @param size required new buffer size. + * @return 0 on success, a negative AVERROR on failure. + * + * @note the buffer is actually reallocated with av_realloc() only if it was + * initially allocated through av_buffer_realloc(NULL) and there is only one + * reference to it (i.e. the one passed to this function). In all other cases + * a new buffer is allocated and the data is copied. + */ +int av_buffer_realloc(AVBufferRef **buf, int size); + +/** + * @} + */ + +/** + * @defgroup lavu_bufferpool AVBufferPool + * @ingroup lavu_data + * + * @{ + * AVBufferPool is an API for a lock-free thread-safe pool of AVBuffers. + * + * Frequently allocating and freeing large buffers may be slow. AVBufferPool is + * meant to solve this in cases when the caller needs a set of buffers of the + * same size (the most obvious use case being buffers for raw video or audio + * frames). + * + * At the beginning, the user must call av_buffer_pool_init() to create the + * buffer pool. Then whenever a buffer is needed, call av_buffer_pool_get() to + * get a reference to a new buffer, similar to av_buffer_alloc(). This new + * reference works in all aspects the same way as the one created by + * av_buffer_alloc(). However, when the last reference to this buffer is + * unreferenced, it is returned to the pool instead of being freed and will be + * reused for subsequent av_buffer_pool_get() calls. + * + * When the caller is done with the pool and no longer needs to allocate any new + * buffers, av_buffer_pool_uninit() must be called to mark the pool as freeable. + * Once all the buffers are released, it will automatically be freed. + * + * Allocating and releasing buffers with this API is thread-safe as long as + * either the default alloc callback is used, or the user-supplied one is + * thread-safe. + */ + +/** + * The buffer pool. This structure is opaque and not meant to be accessed + * directly. It is allocated with av_buffer_pool_init() and freed with + * av_buffer_pool_uninit(). + */ +typedef struct AVBufferPool AVBufferPool; + +/** + * Allocate and initialize a buffer pool. + * + * @param size size of each buffer in this pool + * @param alloc a function that will be used to allocate new buffers when the + * pool is empty. May be NULL, then the default allocator will be used + * (av_buffer_alloc()). + * @return newly created buffer pool on success, NULL on error. + */ +AVBufferPool *av_buffer_pool_init(int size, AVBufferRef* (*alloc)(int size)); + +/** + * Allocate and initialize a buffer pool with a more complex allocator. + * + * @param size size of each buffer in this pool + * @param opaque arbitrary user data used by the allocator + * @param alloc a function that will be used to allocate new buffers when the + * pool is empty. + * @param pool_free a function that will be called immediately before the pool + * is freed. I.e. after av_buffer_pool_uninit() is called + * by the caller and all the frames are returned to the pool + * and freed. It is intended to uninitialize the user opaque + * data. + * @return newly created buffer pool on success, NULL on error. + */ +AVBufferPool *av_buffer_pool_init2(int size, void *opaque, + AVBufferRef* (*alloc)(void *opaque, int size), + void (*pool_free)(void *opaque)); + +/** + * Mark the pool as being available for freeing. It will actually be freed only + * once all the allocated buffers associated with the pool are released. Thus it + * is safe to call this function while some of the allocated buffers are still + * in use. + * + * @param pool pointer to the pool to be freed. It will be set to NULL. + */ +void av_buffer_pool_uninit(AVBufferPool **pool); + +/** + * Allocate a new AVBuffer, reusing an old buffer from the pool when available. + * This function may be called simultaneously from multiple threads. + * + * @return a reference to the new buffer on success, NULL on error. + */ +AVBufferRef *av_buffer_pool_get(AVBufferPool *pool); + +/** + * @} + */ + +#endif /* AVUTIL_BUFFER_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/camellia.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/camellia.h new file mode 100644 index 0000000..e674c9b --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/camellia.h @@ -0,0 +1,70 @@ +/* + * An implementation of the CAMELLIA algorithm as mentioned in RFC3713 + * Copyright (c) 2014 Supraja Meedinti + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_CAMELLIA_H +#define AVUTIL_CAMELLIA_H + +#include + + +/** + * @file + * @brief Public header for libavutil CAMELLIA algorithm + * @defgroup lavu_camellia CAMELLIA + * @ingroup lavu_crypto + * @{ + */ + +extern const int av_camellia_size; + +struct AVCAMELLIA; + +/** + * Allocate an AVCAMELLIA context + * To free the struct: av_free(ptr) + */ +struct AVCAMELLIA *av_camellia_alloc(void); + +/** + * Initialize an AVCAMELLIA context. + * + * @param ctx an AVCAMELLIA context + * @param key a key of 16, 24, 32 bytes used for encryption/decryption + * @param key_bits number of keybits: possible are 128, 192, 256 + */ +int av_camellia_init(struct AVCAMELLIA *ctx, const uint8_t *key, int key_bits); + +/** + * Encrypt or decrypt a buffer using a previously initialized context + * + * @param ctx an AVCAMELLIA context + * @param dst destination array, can be equal to src + * @param src source array, can be equal to dst + * @param count number of 16 byte blocks + * @paran iv initialization vector for CBC mode, NULL for ECB mode + * @param decrypt 0 for encryption, 1 for decryption + */ +void av_camellia_crypt(struct AVCAMELLIA *ctx, uint8_t *dst, const uint8_t *src, int count, uint8_t* iv, int decrypt); + +/** + * @} + */ +#endif /* AVUTIL_CAMELLIA_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/cast5.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/cast5.h new file mode 100644 index 0000000..ad5b347 --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/cast5.h @@ -0,0 +1,80 @@ +/* + * An implementation of the CAST128 algorithm as mentioned in RFC2144 + * Copyright (c) 2014 Supraja Meedinti + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_CAST5_H +#define AVUTIL_CAST5_H + +#include + + +/** + * @file + * @brief Public header for libavutil CAST5 algorithm + * @defgroup lavu_cast5 CAST5 + * @ingroup lavu_crypto + * @{ + */ + +extern const int av_cast5_size; + +struct AVCAST5; + +/** + * Allocate an AVCAST5 context + * To free the struct: av_free(ptr) + */ +struct AVCAST5 *av_cast5_alloc(void); +/** + * Initialize an AVCAST5 context. + * + * @param ctx an AVCAST5 context + * @param key a key of 5,6,...16 bytes used for encryption/decryption + * @param key_bits number of keybits: possible are 40,48,...,128 + * @return 0 on success, less than 0 on failure + */ +int av_cast5_init(struct AVCAST5 *ctx, const uint8_t *key, int key_bits); + +/** + * Encrypt or decrypt a buffer using a previously initialized context, ECB mode only + * + * @param ctx an AVCAST5 context + * @param dst destination array, can be equal to src + * @param src source array, can be equal to dst + * @param count number of 8 byte blocks + * @param decrypt 0 for encryption, 1 for decryption + */ +void av_cast5_crypt(struct AVCAST5 *ctx, uint8_t *dst, const uint8_t *src, int count, int decrypt); + +/** + * Encrypt or decrypt a buffer using a previously initialized context + * + * @param ctx an AVCAST5 context + * @param dst destination array, can be equal to src + * @param src source array, can be equal to dst + * @param count number of 8 byte blocks + * @param iv initialization vector for CBC mode, NULL for ECB mode + * @param decrypt 0 for encryption, 1 for decryption + */ +void av_cast5_crypt2(struct AVCAST5 *ctx, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt); +/** + * @} + */ +#endif /* AVUTIL_CAST5_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/channel_layout.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/channel_layout.h new file mode 100644 index 0000000..50bb8f0 --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/channel_layout.h @@ -0,0 +1,232 @@ +/* + * Copyright (c) 2006 Michael Niedermayer + * Copyright (c) 2008 Peter Ross + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_CHANNEL_LAYOUT_H +#define AVUTIL_CHANNEL_LAYOUT_H + +#include + +/** + * @file + * audio channel layout utility functions + */ + +/** + * @addtogroup lavu_audio + * @{ + */ + +/** + * @defgroup channel_masks Audio channel masks + * + * A channel layout is a 64-bits integer with a bit set for every channel. + * The number of bits set must be equal to the number of channels. + * The value 0 means that the channel layout is not known. + * @note this data structure is not powerful enough to handle channels + * combinations that have the same channel multiple times, such as + * dual-mono. + * + * @{ + */ +#define AV_CH_FRONT_LEFT 0x00000001 +#define AV_CH_FRONT_RIGHT 0x00000002 +#define AV_CH_FRONT_CENTER 0x00000004 +#define AV_CH_LOW_FREQUENCY 0x00000008 +#define AV_CH_BACK_LEFT 0x00000010 +#define AV_CH_BACK_RIGHT 0x00000020 +#define AV_CH_FRONT_LEFT_OF_CENTER 0x00000040 +#define AV_CH_FRONT_RIGHT_OF_CENTER 0x00000080 +#define AV_CH_BACK_CENTER 0x00000100 +#define AV_CH_SIDE_LEFT 0x00000200 +#define AV_CH_SIDE_RIGHT 0x00000400 +#define AV_CH_TOP_CENTER 0x00000800 +#define AV_CH_TOP_FRONT_LEFT 0x00001000 +#define AV_CH_TOP_FRONT_CENTER 0x00002000 +#define AV_CH_TOP_FRONT_RIGHT 0x00004000 +#define AV_CH_TOP_BACK_LEFT 0x00008000 +#define AV_CH_TOP_BACK_CENTER 0x00010000 +#define AV_CH_TOP_BACK_RIGHT 0x00020000 +#define AV_CH_STEREO_LEFT 0x20000000 ///< Stereo downmix. +#define AV_CH_STEREO_RIGHT 0x40000000 ///< See AV_CH_STEREO_LEFT. +#define AV_CH_WIDE_LEFT 0x0000000080000000ULL +#define AV_CH_WIDE_RIGHT 0x0000000100000000ULL +#define AV_CH_SURROUND_DIRECT_LEFT 0x0000000200000000ULL +#define AV_CH_SURROUND_DIRECT_RIGHT 0x0000000400000000ULL +#define AV_CH_LOW_FREQUENCY_2 0x0000000800000000ULL + +/** Channel mask value used for AVCodecContext.request_channel_layout + to indicate that the user requests the channel order of the decoder output + to be the native codec channel order. */ +#define AV_CH_LAYOUT_NATIVE 0x8000000000000000ULL + +/** + * @} + * @defgroup channel_mask_c Audio channel layouts + * @{ + * */ +#define AV_CH_LAYOUT_MONO (AV_CH_FRONT_CENTER) +#define AV_CH_LAYOUT_STEREO (AV_CH_FRONT_LEFT|AV_CH_FRONT_RIGHT) +#define AV_CH_LAYOUT_2POINT1 (AV_CH_LAYOUT_STEREO|AV_CH_LOW_FREQUENCY) +#define AV_CH_LAYOUT_2_1 (AV_CH_LAYOUT_STEREO|AV_CH_BACK_CENTER) +#define AV_CH_LAYOUT_SURROUND (AV_CH_LAYOUT_STEREO|AV_CH_FRONT_CENTER) +#define AV_CH_LAYOUT_3POINT1 (AV_CH_LAYOUT_SURROUND|AV_CH_LOW_FREQUENCY) +#define AV_CH_LAYOUT_4POINT0 (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_CENTER) +#define AV_CH_LAYOUT_4POINT1 (AV_CH_LAYOUT_4POINT0|AV_CH_LOW_FREQUENCY) +#define AV_CH_LAYOUT_2_2 (AV_CH_LAYOUT_STEREO|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT) +#define AV_CH_LAYOUT_QUAD (AV_CH_LAYOUT_STEREO|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT) +#define AV_CH_LAYOUT_5POINT0 (AV_CH_LAYOUT_SURROUND|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT) +#define AV_CH_LAYOUT_5POINT1 (AV_CH_LAYOUT_5POINT0|AV_CH_LOW_FREQUENCY) +#define AV_CH_LAYOUT_5POINT0_BACK (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT) +#define AV_CH_LAYOUT_5POINT1_BACK (AV_CH_LAYOUT_5POINT0_BACK|AV_CH_LOW_FREQUENCY) +#define AV_CH_LAYOUT_6POINT0 (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_CENTER) +#define AV_CH_LAYOUT_6POINT0_FRONT (AV_CH_LAYOUT_2_2|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER) +#define AV_CH_LAYOUT_HEXAGONAL (AV_CH_LAYOUT_5POINT0_BACK|AV_CH_BACK_CENTER) +#define AV_CH_LAYOUT_6POINT1 (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_CENTER) +#define AV_CH_LAYOUT_6POINT1_BACK (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_BACK_CENTER) +#define AV_CH_LAYOUT_6POINT1_FRONT (AV_CH_LAYOUT_6POINT0_FRONT|AV_CH_LOW_FREQUENCY) +#define AV_CH_LAYOUT_7POINT0 (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT) +#define AV_CH_LAYOUT_7POINT0_FRONT (AV_CH_LAYOUT_5POINT0|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER) +#define AV_CH_LAYOUT_7POINT1 (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT) +#define AV_CH_LAYOUT_7POINT1_WIDE (AV_CH_LAYOUT_5POINT1|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER) +#define AV_CH_LAYOUT_7POINT1_WIDE_BACK (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER) +#define AV_CH_LAYOUT_OCTAGONAL (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_CENTER|AV_CH_BACK_RIGHT) +#define AV_CH_LAYOUT_HEXADECAGONAL (AV_CH_LAYOUT_OCTAGONAL|AV_CH_WIDE_LEFT|AV_CH_WIDE_RIGHT|AV_CH_TOP_BACK_LEFT|AV_CH_TOP_BACK_RIGHT|AV_CH_TOP_BACK_CENTER|AV_CH_TOP_FRONT_CENTER|AV_CH_TOP_FRONT_LEFT|AV_CH_TOP_FRONT_RIGHT) +#define AV_CH_LAYOUT_STEREO_DOWNMIX (AV_CH_STEREO_LEFT|AV_CH_STEREO_RIGHT) + +enum AVMatrixEncoding { + AV_MATRIX_ENCODING_NONE, + AV_MATRIX_ENCODING_DOLBY, + AV_MATRIX_ENCODING_DPLII, + AV_MATRIX_ENCODING_DPLIIX, + AV_MATRIX_ENCODING_DPLIIZ, + AV_MATRIX_ENCODING_DOLBYEX, + AV_MATRIX_ENCODING_DOLBYHEADPHONE, + AV_MATRIX_ENCODING_NB +}; + +/** + * Return a channel layout id that matches name, or 0 if no match is found. + * + * name can be one or several of the following notations, + * separated by '+' or '|': + * - the name of an usual channel layout (mono, stereo, 4.0, quad, 5.0, + * 5.0(side), 5.1, 5.1(side), 7.1, 7.1(wide), downmix); + * - the name of a single channel (FL, FR, FC, LFE, BL, BR, FLC, FRC, BC, + * SL, SR, TC, TFL, TFC, TFR, TBL, TBC, TBR, DL, DR); + * - a number of channels, in decimal, followed by 'c', yielding + * the default channel layout for that number of channels (@see + * av_get_default_channel_layout); + * - a channel layout mask, in hexadecimal starting with "0x" (see the + * AV_CH_* macros). + * + * Example: "stereo+FC" = "2c+FC" = "2c+1c" = "0x7" + */ +uint64_t av_get_channel_layout(const char *name); + +/** + * Return a channel layout and the number of channels based on the specified name. + * + * This function is similar to (@see av_get_channel_layout), but can also parse + * unknown channel layout specifications. + * + * @param[in] name channel layout specification string + * @param[out] channel_layout parsed channel layout (0 if unknown) + * @param[out] nb_channels number of channels + * + * @return 0 on success, AVERROR(EINVAL) if the parsing fails. + */ +int av_get_extended_channel_layout(const char *name, uint64_t* channel_layout, int* nb_channels); + +/** + * Return a description of a channel layout. + * If nb_channels is <= 0, it is guessed from the channel_layout. + * + * @param buf put here the string containing the channel layout + * @param buf_size size in bytes of the buffer + */ +void av_get_channel_layout_string(char *buf, int buf_size, int nb_channels, uint64_t channel_layout); + +struct AVBPrint; +/** + * Append a description of a channel layout to a bprint buffer. + */ +void av_bprint_channel_layout(struct AVBPrint *bp, int nb_channels, uint64_t channel_layout); + +/** + * Return the number of channels in the channel layout. + */ +int av_get_channel_layout_nb_channels(uint64_t channel_layout); + +/** + * Return default channel layout for a given number of channels. + */ +int64_t av_get_default_channel_layout(int nb_channels); + +/** + * Get the index of a channel in channel_layout. + * + * @param channel a channel layout describing exactly one channel which must be + * present in channel_layout. + * + * @return index of channel in channel_layout on success, a negative AVERROR + * on error. + */ +int av_get_channel_layout_channel_index(uint64_t channel_layout, + uint64_t channel); + +/** + * Get the channel with the given index in channel_layout. + */ +uint64_t av_channel_layout_extract_channel(uint64_t channel_layout, int index); + +/** + * Get the name of a given channel. + * + * @return channel name on success, NULL on error. + */ +const char *av_get_channel_name(uint64_t channel); + +/** + * Get the description of a given channel. + * + * @param channel a channel layout with a single channel + * @return channel description on success, NULL on error + */ +const char *av_get_channel_description(uint64_t channel); + +/** + * Get the value and name of a standard channel layout. + * + * @param[in] index index in an internal list, starting at 0 + * @param[out] layout channel layout mask + * @param[out] name name of the layout + * @return 0 if the layout exists, + * <0 if index is beyond the limits + */ +int av_get_standard_channel_layout(unsigned index, uint64_t *layout, + const char **name); + +/** + * @} + * @} + */ + +#endif /* AVUTIL_CHANNEL_LAYOUT_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/common.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/common.h new file mode 100644 index 0000000..8db0291 --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/common.h @@ -0,0 +1,560 @@ +/* + * copyright (c) 2006 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * common internal and external API header + */ + +#ifndef AVUTIL_COMMON_H +#define AVUTIL_COMMON_H + +#if defined(__cplusplus) && !defined(__STDC_CONSTANT_MACROS) && !defined(UINT64_C) +#error missing -D__STDC_CONSTANT_MACROS / #define __STDC_CONSTANT_MACROS +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "attributes.h" +#include "macros.h" +#include "version.h" +#include "libavutil/avconfig.h" + +#if AV_HAVE_BIGENDIAN +# define AV_NE(be, le) (be) +#else +# define AV_NE(be, le) (le) +#endif + +//rounded division & shift +#define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b)) +/* assume b>0 */ +#define ROUNDED_DIV(a,b) (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b)) +/* Fast a/(1<=0 and b>=0 */ +#define AV_CEIL_RSHIFT(a,b) (!av_builtin_constant_p(b) ? -((-(a)) >> (b)) \ + : ((a) + (1<<(b)) - 1) >> (b)) +/* Backwards compat. */ +#define FF_CEIL_RSHIFT AV_CEIL_RSHIFT + +#define FFUDIV(a,b) (((a)>0 ?(a):(a)-(b)+1) / (b)) +#define FFUMOD(a,b) ((a)-(b)*FFUDIV(a,b)) + +/** + * Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they + * are not representable as absolute values of their type. This is the same + * as with *abs() + * @see FFNABS() + */ +#define FFABS(a) ((a) >= 0 ? (a) : (-(a))) +#define FFSIGN(a) ((a) > 0 ? 1 : -1) + +/** + * Negative Absolute value. + * this works for all integers of all types. + * As with many macros, this evaluates its argument twice, it thus must not have + * a sideeffect, that is FFNABS(x++) has undefined behavior. + */ +#define FFNABS(a) ((a) <= 0 ? (a) : (-(a))) + +/** + * Comparator. + * For two numerical expressions x and y, gives 1 if x > y, -1 if x < y, and 0 + * if x == y. This is useful for instance in a qsort comparator callback. + * Furthermore, compilers are able to optimize this to branchless code, and + * there is no risk of overflow with signed types. + * As with many macros, this evaluates its argument multiple times, it thus + * must not have a side-effect. + */ +#define FFDIFFSIGN(x,y) (((x)>(y)) - ((x)<(y))) + +#define FFMAX(a,b) ((a) > (b) ? (a) : (b)) +#define FFMAX3(a,b,c) FFMAX(FFMAX(a,b),c) +#define FFMIN(a,b) ((a) > (b) ? (b) : (a)) +#define FFMIN3(a,b,c) FFMIN(FFMIN(a,b),c) + +#define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0) +#define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0])) + +/* misc math functions */ + +#ifdef HAVE_AV_CONFIG_H +# include "config.h" +# include "intmath.h" +#endif + +/* Pull in unguarded fallback defines at the end of this file. */ +#include "common.h" + +#ifndef av_log2 +av_const int av_log2(unsigned v); +#endif + +#ifndef av_log2_16bit +av_const int av_log2_16bit(unsigned v); +#endif + +/** + * Clip a signed integer value into the amin-amax range. + * @param a value to clip + * @param amin minimum value of the clip range + * @param amax maximum value of the clip range + * @return clipped value + */ +static av_always_inline av_const int av_clip_c(int a, int amin, int amax) +{ +#if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2 + if (amin > amax) abort(); +#endif + if (a < amin) return amin; + else if (a > amax) return amax; + else return a; +} + +/** + * Clip a signed 64bit integer value into the amin-amax range. + * @param a value to clip + * @param amin minimum value of the clip range + * @param amax maximum value of the clip range + * @return clipped value + */ +static av_always_inline av_const int64_t av_clip64_c(int64_t a, int64_t amin, int64_t amax) +{ +#if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2 + if (amin > amax) abort(); +#endif + if (a < amin) return amin; + else if (a > amax) return amax; + else return a; +} + +/** + * Clip a signed integer value into the 0-255 range. + * @param a value to clip + * @return clipped value + */ +static av_always_inline av_const uint8_t av_clip_uint8_c(int a) +{ + if (a&(~0xFF)) return (~a)>>31; + else return a; +} + +/** + * Clip a signed integer value into the -128,127 range. + * @param a value to clip + * @return clipped value + */ +static av_always_inline av_const int8_t av_clip_int8_c(int a) +{ + if ((a+0x80U) & ~0xFF) return (a>>31) ^ 0x7F; + else return a; +} + +/** + * Clip a signed integer value into the 0-65535 range. + * @param a value to clip + * @return clipped value + */ +static av_always_inline av_const uint16_t av_clip_uint16_c(int a) +{ + if (a&(~0xFFFF)) return (~a)>>31; + else return a; +} + +/** + * Clip a signed integer value into the -32768,32767 range. + * @param a value to clip + * @return clipped value + */ +static av_always_inline av_const int16_t av_clip_int16_c(int a) +{ + if ((a+0x8000U) & ~0xFFFF) return (a>>31) ^ 0x7FFF; + else return a; +} + +/** + * Clip a signed 64-bit integer value into the -2147483648,2147483647 range. + * @param a value to clip + * @return clipped value + */ +static av_always_inline av_const int32_t av_clipl_int32_c(int64_t a) +{ + if ((a+0x80000000u) & ~UINT64_C(0xFFFFFFFF)) return (int32_t)((a>>63) ^ 0x7FFFFFFF); + else return (int32_t)a; +} + +/** + * Clip a signed integer into the -(2^p),(2^p-1) range. + * @param a value to clip + * @param p bit position to clip at + * @return clipped value + */ +static av_always_inline av_const int av_clip_intp2_c(int a, int p) +{ + if (((unsigned)a + (1 << p)) & ~((2 << p) - 1)) + return (a >> 31) ^ ((1 << p) - 1); + else + return a; +} + +/** + * Clip a signed integer to an unsigned power of two range. + * @param a value to clip + * @param p bit position to clip at + * @return clipped value + */ +static av_always_inline av_const unsigned av_clip_uintp2_c(int a, int p) +{ + if (a & ~((1<> 31 & ((1<= 2 + if (amin > amax) abort(); +#endif + if (a < amin) return amin; + else if (a > amax) return amax; + else return a; +} + +/** + * Clip a double value into the amin-amax range. + * @param a value to clip + * @param amin minimum value of the clip range + * @param amax maximum value of the clip range + * @return clipped value + */ +static av_always_inline av_const double av_clipd_c(double a, double amin, double amax) +{ +#if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2 + if (amin > amax) abort(); +#endif + if (a < amin) return amin; + else if (a > amax) return amax; + else return a; +} + +/** Compute ceil(log2(x)). + * @param x value used to compute ceil(log2(x)) + * @return computed ceiling of log2(x) + */ +static av_always_inline av_const int av_ceil_log2_c(int x) +{ + return av_log2((x - 1) << 1); +} + +/** + * Count number of bits set to one in x + * @param x value to count bits of + * @return the number of bits set to one in x + */ +static av_always_inline av_const int av_popcount_c(uint32_t x) +{ + x -= (x >> 1) & 0x55555555; + x = (x & 0x33333333) + ((x >> 2) & 0x33333333); + x = (x + (x >> 4)) & 0x0F0F0F0F; + x += x >> 8; + return (x + (x >> 16)) & 0x3F; +} + +/** + * Count number of bits set to one in x + * @param x value to count bits of + * @return the number of bits set to one in x + */ +static av_always_inline av_const int av_popcount64_c(uint64_t x) +{ + return av_popcount((uint32_t)x) + av_popcount((uint32_t)(x >> 32)); +} + +static av_always_inline av_const int av_parity_c(uint32_t v) +{ + return av_popcount(v) & 1; +} + +#define MKTAG(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((unsigned)(d) << 24)) +#define MKBETAG(a,b,c,d) ((d) | ((c) << 8) | ((b) << 16) | ((unsigned)(a) << 24)) + +/** + * Convert a UTF-8 character (up to 4 bytes) to its 32-bit UCS-4 encoded form. + * + * @param val Output value, must be an lvalue of type uint32_t. + * @param GET_BYTE Expression reading one byte from the input. + * Evaluated up to 7 times (4 for the currently + * assigned Unicode range). With a memory buffer + * input, this could be *ptr++. + * @param ERROR Expression to be evaluated on invalid input, + * typically a goto statement. + * + * @warning ERROR should not contain a loop control statement which + * could interact with the internal while loop, and should force an + * exit from the macro code (e.g. through a goto or a return) in order + * to prevent undefined results. + */ +#define GET_UTF8(val, GET_BYTE, ERROR)\ + val= (GET_BYTE);\ + {\ + uint32_t top = (val & 128) >> 1;\ + if ((val & 0xc0) == 0x80 || val >= 0xFE)\ + ERROR\ + while (val & top) {\ + int tmp= (GET_BYTE) - 128;\ + if(tmp>>6)\ + ERROR\ + val= (val<<6) + tmp;\ + top <<= 5;\ + }\ + val &= (top << 1) - 1;\ + } + +/** + * Convert a UTF-16 character (2 or 4 bytes) to its 32-bit UCS-4 encoded form. + * + * @param val Output value, must be an lvalue of type uint32_t. + * @param GET_16BIT Expression returning two bytes of UTF-16 data converted + * to native byte order. Evaluated one or two times. + * @param ERROR Expression to be evaluated on invalid input, + * typically a goto statement. + */ +#define GET_UTF16(val, GET_16BIT, ERROR)\ + val = GET_16BIT;\ + {\ + unsigned int hi = val - 0xD800;\ + if (hi < 0x800) {\ + val = GET_16BIT - 0xDC00;\ + if (val > 0x3FFU || hi > 0x3FFU)\ + ERROR\ + val += (hi<<10) + 0x10000;\ + }\ + }\ + +/** + * @def PUT_UTF8(val, tmp, PUT_BYTE) + * Convert a 32-bit Unicode character to its UTF-8 encoded form (up to 4 bytes long). + * @param val is an input-only argument and should be of type uint32_t. It holds + * a UCS-4 encoded Unicode character that is to be converted to UTF-8. If + * val is given as a function it is executed only once. + * @param tmp is a temporary variable and should be of type uint8_t. It + * represents an intermediate value during conversion that is to be + * output by PUT_BYTE. + * @param PUT_BYTE writes the converted UTF-8 bytes to any proper destination. + * It could be a function or a statement, and uses tmp as the input byte. + * For example, PUT_BYTE could be "*output++ = tmp;" PUT_BYTE will be + * executed up to 4 times for values in the valid UTF-8 range and up to + * 7 times in the general case, depending on the length of the converted + * Unicode character. + */ +#define PUT_UTF8(val, tmp, PUT_BYTE)\ + {\ + int bytes, shift;\ + uint32_t in = val;\ + if (in < 0x80) {\ + tmp = in;\ + PUT_BYTE\ + } else {\ + bytes = (av_log2(in) + 4) / 5;\ + shift = (bytes - 1) * 6;\ + tmp = (256 - (256 >> bytes)) | (in >> shift);\ + PUT_BYTE\ + while (shift >= 6) {\ + shift -= 6;\ + tmp = 0x80 | ((in >> shift) & 0x3f);\ + PUT_BYTE\ + }\ + }\ + } + +/** + * @def PUT_UTF16(val, tmp, PUT_16BIT) + * Convert a 32-bit Unicode character to its UTF-16 encoded form (2 or 4 bytes). + * @param val is an input-only argument and should be of type uint32_t. It holds + * a UCS-4 encoded Unicode character that is to be converted to UTF-16. If + * val is given as a function it is executed only once. + * @param tmp is a temporary variable and should be of type uint16_t. It + * represents an intermediate value during conversion that is to be + * output by PUT_16BIT. + * @param PUT_16BIT writes the converted UTF-16 data to any proper destination + * in desired endianness. It could be a function or a statement, and uses tmp + * as the input byte. For example, PUT_BYTE could be "*output++ = tmp;" + * PUT_BYTE will be executed 1 or 2 times depending on input character. + */ +#define PUT_UTF16(val, tmp, PUT_16BIT)\ + {\ + uint32_t in = val;\ + if (in < 0x10000) {\ + tmp = in;\ + PUT_16BIT\ + } else {\ + tmp = 0xD800 | ((in - 0x10000) >> 10);\ + PUT_16BIT\ + tmp = 0xDC00 | ((in - 0x10000) & 0x3FF);\ + PUT_16BIT\ + }\ + }\ + + + +#include "mem.h" + +#ifdef HAVE_AV_CONFIG_H +# include "internal.h" +#endif /* HAVE_AV_CONFIG_H */ + +#endif /* AVUTIL_COMMON_H */ + +/* + * The following definitions are outside the multiple inclusion guard + * to ensure they are immediately available in intmath.h. + */ + +#ifndef av_ceil_log2 +# define av_ceil_log2 av_ceil_log2_c +#endif +#ifndef av_clip +# define av_clip av_clip_c +#endif +#ifndef av_clip64 +# define av_clip64 av_clip64_c +#endif +#ifndef av_clip_uint8 +# define av_clip_uint8 av_clip_uint8_c +#endif +#ifndef av_clip_int8 +# define av_clip_int8 av_clip_int8_c +#endif +#ifndef av_clip_uint16 +# define av_clip_uint16 av_clip_uint16_c +#endif +#ifndef av_clip_int16 +# define av_clip_int16 av_clip_int16_c +#endif +#ifndef av_clipl_int32 +# define av_clipl_int32 av_clipl_int32_c +#endif +#ifndef av_clip_intp2 +# define av_clip_intp2 av_clip_intp2_c +#endif +#ifndef av_clip_uintp2 +# define av_clip_uintp2 av_clip_uintp2_c +#endif +#ifndef av_mod_uintp2 +# define av_mod_uintp2 av_mod_uintp2_c +#endif +#ifndef av_sat_add32 +# define av_sat_add32 av_sat_add32_c +#endif +#ifndef av_sat_dadd32 +# define av_sat_dadd32 av_sat_dadd32_c +#endif +#ifndef av_sat_sub32 +# define av_sat_sub32 av_sat_sub32_c +#endif +#ifndef av_sat_dsub32 +# define av_sat_dsub32 av_sat_dsub32_c +#endif +#ifndef av_clipf +# define av_clipf av_clipf_c +#endif +#ifndef av_clipd +# define av_clipd av_clipd_c +#endif +#ifndef av_popcount +# define av_popcount av_popcount_c +#endif +#ifndef av_popcount64 +# define av_popcount64 av_popcount64_c +#endif +#ifndef av_parity +# define av_parity av_parity_c +#endif diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/cpu.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/cpu.h new file mode 100644 index 0000000..8bb9eb6 --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/cpu.h @@ -0,0 +1,130 @@ +/* + * Copyright (c) 2000, 2001, 2002 Fabrice Bellard + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_CPU_H +#define AVUTIL_CPU_H + +#include + +#include "attributes.h" + +#define AV_CPU_FLAG_FORCE 0x80000000 /* force usage of selected flags (OR) */ + + /* lower 16 bits - CPU features */ +#define AV_CPU_FLAG_MMX 0x0001 ///< standard MMX +#define AV_CPU_FLAG_MMXEXT 0x0002 ///< SSE integer functions or AMD MMX ext +#define AV_CPU_FLAG_MMX2 0x0002 ///< SSE integer functions or AMD MMX ext +#define AV_CPU_FLAG_3DNOW 0x0004 ///< AMD 3DNOW +#define AV_CPU_FLAG_SSE 0x0008 ///< SSE functions +#define AV_CPU_FLAG_SSE2 0x0010 ///< PIV SSE2 functions +#define AV_CPU_FLAG_SSE2SLOW 0x40000000 ///< SSE2 supported, but usually not faster + ///< than regular MMX/SSE (e.g. Core1) +#define AV_CPU_FLAG_3DNOWEXT 0x0020 ///< AMD 3DNowExt +#define AV_CPU_FLAG_SSE3 0x0040 ///< Prescott SSE3 functions +#define AV_CPU_FLAG_SSE3SLOW 0x20000000 ///< SSE3 supported, but usually not faster + ///< than regular MMX/SSE (e.g. Core1) +#define AV_CPU_FLAG_SSSE3 0x0080 ///< Conroe SSSE3 functions +#define AV_CPU_FLAG_SSSE3SLOW 0x4000000 ///< SSSE3 supported, but usually not faster +#define AV_CPU_FLAG_ATOM 0x10000000 ///< Atom processor, some SSSE3 instructions are slower +#define AV_CPU_FLAG_SSE4 0x0100 ///< Penryn SSE4.1 functions +#define AV_CPU_FLAG_SSE42 0x0200 ///< Nehalem SSE4.2 functions +#define AV_CPU_FLAG_AESNI 0x80000 ///< Advanced Encryption Standard functions +#define AV_CPU_FLAG_AVX 0x4000 ///< AVX functions: requires OS support even if YMM registers aren't used +#define AV_CPU_FLAG_AVXSLOW 0x8000000 ///< AVX supported, but slow when using YMM registers (e.g. Bulldozer) +#define AV_CPU_FLAG_XOP 0x0400 ///< Bulldozer XOP functions +#define AV_CPU_FLAG_FMA4 0x0800 ///< Bulldozer FMA4 functions +#define AV_CPU_FLAG_CMOV 0x1000 ///< supports cmov instruction +#define AV_CPU_FLAG_AVX2 0x8000 ///< AVX2 functions: requires OS support even if YMM registers aren't used +#define AV_CPU_FLAG_FMA3 0x10000 ///< Haswell FMA3 functions +#define AV_CPU_FLAG_BMI1 0x20000 ///< Bit Manipulation Instruction Set 1 +#define AV_CPU_FLAG_BMI2 0x40000 ///< Bit Manipulation Instruction Set 2 +#define AV_CPU_FLAG_AVX512 0x100000 ///< AVX-512 functions: requires OS support even if YMM/ZMM registers aren't used + +#define AV_CPU_FLAG_ALTIVEC 0x0001 ///< standard +#define AV_CPU_FLAG_VSX 0x0002 ///< ISA 2.06 +#define AV_CPU_FLAG_POWER8 0x0004 ///< ISA 2.07 + +#define AV_CPU_FLAG_ARMV5TE (1 << 0) +#define AV_CPU_FLAG_ARMV6 (1 << 1) +#define AV_CPU_FLAG_ARMV6T2 (1 << 2) +#define AV_CPU_FLAG_VFP (1 << 3) +#define AV_CPU_FLAG_VFPV3 (1 << 4) +#define AV_CPU_FLAG_NEON (1 << 5) +#define AV_CPU_FLAG_ARMV8 (1 << 6) +#define AV_CPU_FLAG_VFP_VM (1 << 7) ///< VFPv2 vector mode, deprecated in ARMv7-A and unavailable in various CPUs implementations +#define AV_CPU_FLAG_SETEND (1 <<16) + +/** + * Return the flags which specify extensions supported by the CPU. + * The returned value is affected by av_force_cpu_flags() if that was used + * before. So av_get_cpu_flags() can easily be used in an application to + * detect the enabled cpu flags. + */ +int av_get_cpu_flags(void); + +/** + * Disables cpu detection and forces the specified flags. + * -1 is a special case that disables forcing of specific flags. + */ +void av_force_cpu_flags(int flags); + +/** + * Set a mask on flags returned by av_get_cpu_flags(). + * This function is mainly useful for testing. + * Please use av_force_cpu_flags() and av_get_cpu_flags() instead which are more flexible + */ +attribute_deprecated void av_set_cpu_flags_mask(int mask); + +/** + * Parse CPU flags from a string. + * + * The returned flags contain the specified flags as well as related unspecified flags. + * + * This function exists only for compatibility with libav. + * Please use av_parse_cpu_caps() when possible. + * @return a combination of AV_CPU_* flags, negative on error. + */ +attribute_deprecated +int av_parse_cpu_flags(const char *s); + +/** + * Parse CPU caps from a string and update the given AV_CPU_* flags based on that. + * + * @return negative on error. + */ +int av_parse_cpu_caps(unsigned *flags, const char *s); + +/** + * @return the number of logical CPU cores present. + */ +int av_cpu_count(void); + +/** + * Get the maximum data alignment that may be required by FFmpeg. + * + * Note that this is affected by the build configuration and the CPU flags mask, + * so e.g. if the CPU supports AVX, but libavutil has been built with + * --disable-avx or the AV_CPU_FLAG_AVX flag has been disabled through + * av_set_cpu_flags_mask(), then this function will behave as if AVX is not + * present. + */ +size_t av_cpu_max_align(void); + +#endif /* AVUTIL_CPU_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/crc.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/crc.h new file mode 100644 index 0000000..47e22b4 --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/crc.h @@ -0,0 +1,100 @@ +/* + * copyright (c) 2006 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * @ingroup lavu_crc32 + * Public header for CRC hash function implementation. + */ + +#ifndef AVUTIL_CRC_H +#define AVUTIL_CRC_H + +#include +#include +#include "attributes.h" +#include "version.h" + +/** + * @defgroup lavu_crc32 CRC + * @ingroup lavu_hash + * CRC (Cyclic Redundancy Check) hash function implementation. + * + * This module supports numerous CRC polynomials, in addition to the most + * widely used CRC-32-IEEE. See @ref AVCRCId for a list of available + * polynomials. + * + * @{ + */ + +typedef uint32_t AVCRC; + +typedef enum { + AV_CRC_8_ATM, + AV_CRC_16_ANSI, + AV_CRC_16_CCITT, + AV_CRC_32_IEEE, + AV_CRC_32_IEEE_LE, /*< reversed bitorder version of AV_CRC_32_IEEE */ + AV_CRC_16_ANSI_LE, /*< reversed bitorder version of AV_CRC_16_ANSI */ + AV_CRC_24_IEEE, + AV_CRC_8_EBU, + AV_CRC_MAX, /*< Not part of public API! Do not use outside libavutil. */ +}AVCRCId; + +/** + * Initialize a CRC table. + * @param ctx must be an array of size sizeof(AVCRC)*257 or sizeof(AVCRC)*1024 + * @param le If 1, the lowest bit represents the coefficient for the highest + * exponent of the corresponding polynomial (both for poly and + * actual CRC). + * If 0, you must swap the CRC parameter and the result of av_crc + * if you need the standard representation (can be simplified in + * most cases to e.g. bswap16): + * av_bswap32(crc << (32-bits)) + * @param bits number of bits for the CRC + * @param poly generator polynomial without the x**bits coefficient, in the + * representation as specified by le + * @param ctx_size size of ctx in bytes + * @return <0 on failure + */ +int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size); + +/** + * Get an initialized standard CRC table. + * @param crc_id ID of a standard CRC + * @return a pointer to the CRC table or NULL on failure + */ +const AVCRC *av_crc_get_table(AVCRCId crc_id); + +/** + * Calculate the CRC of a block. + * @param crc CRC of previous blocks if any or initial value for CRC + * @return CRC updated with the data from the given block + * + * @see av_crc_init() "le" parameter + */ +uint32_t av_crc(const AVCRC *ctx, uint32_t crc, + const uint8_t *buffer, size_t length) av_pure; + +/** + * @} + */ + +#endif /* AVUTIL_CRC_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/des.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/des.h new file mode 100644 index 0000000..4cf11f5 --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/des.h @@ -0,0 +1,77 @@ +/* + * DES encryption/decryption + * Copyright (c) 2007 Reimar Doeffinger + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_DES_H +#define AVUTIL_DES_H + +#include + +/** + * @defgroup lavu_des DES + * @ingroup lavu_crypto + * @{ + */ + +typedef struct AVDES { + uint64_t round_keys[3][16]; + int triple_des; +} AVDES; + +/** + * Allocate an AVDES context. + */ +AVDES *av_des_alloc(void); + +/** + * @brief Initializes an AVDES context. + * + * @param key_bits must be 64 or 192 + * @param decrypt 0 for encryption/CBC-MAC, 1 for decryption + * @return zero on success, negative value otherwise + */ +int av_des_init(struct AVDES *d, const uint8_t *key, int key_bits, int decrypt); + +/** + * @brief Encrypts / decrypts using the DES algorithm. + * + * @param count number of 8 byte blocks + * @param dst destination array, can be equal to src, must be 8-byte aligned + * @param src source array, can be equal to dst, must be 8-byte aligned, may be NULL + * @param iv initialization vector for CBC mode, if NULL then ECB will be used, + * must be 8-byte aligned + * @param decrypt 0 for encryption, 1 for decryption + */ +void av_des_crypt(struct AVDES *d, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt); + +/** + * @brief Calculates CBC-MAC using the DES algorithm. + * + * @param count number of 8 byte blocks + * @param dst destination array, can be equal to src, must be 8-byte aligned + * @param src source array, can be equal to dst, must be 8-byte aligned, may be NULL + */ +void av_des_mac(struct AVDES *d, uint8_t *dst, const uint8_t *src, int count); + +/** + * @} + */ + +#endif /* AVUTIL_DES_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/dict.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/dict.h new file mode 100644 index 0000000..118f1f0 --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/dict.h @@ -0,0 +1,200 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * Public dictionary API. + * @deprecated + * AVDictionary is provided for compatibility with libav. It is both in + * implementation as well as API inefficient. It does not scale and is + * extremely slow with large dictionaries. + * It is recommended that new code uses our tree container from tree.c/h + * where applicable, which uses AVL trees to achieve O(log n) performance. + */ + +#ifndef AVUTIL_DICT_H +#define AVUTIL_DICT_H + +#include + +#include "version.h" + +/** + * @addtogroup lavu_dict AVDictionary + * @ingroup lavu_data + * + * @brief Simple key:value store + * + * @{ + * Dictionaries are used for storing key:value pairs. To create + * an AVDictionary, simply pass an address of a NULL pointer to + * av_dict_set(). NULL can be used as an empty dictionary wherever + * a pointer to an AVDictionary is required. + * Use av_dict_get() to retrieve an entry or iterate over all + * entries and finally av_dict_free() to free the dictionary + * and all its contents. + * + @code + AVDictionary *d = NULL; // "create" an empty dictionary + AVDictionaryEntry *t = NULL; + + av_dict_set(&d, "foo", "bar", 0); // add an entry + + char *k = av_strdup("key"); // if your strings are already allocated, + char *v = av_strdup("value"); // you can avoid copying them like this + av_dict_set(&d, k, v, AV_DICT_DONT_STRDUP_KEY | AV_DICT_DONT_STRDUP_VAL); + + while (t = av_dict_get(d, "", t, AV_DICT_IGNORE_SUFFIX)) { + <....> // iterate over all entries in d + } + av_dict_free(&d); + @endcode + */ + +#define AV_DICT_MATCH_CASE 1 /**< Only get an entry with exact-case key match. Only relevant in av_dict_get(). */ +#define AV_DICT_IGNORE_SUFFIX 2 /**< Return first entry in a dictionary whose first part corresponds to the search key, + ignoring the suffix of the found key string. Only relevant in av_dict_get(). */ +#define AV_DICT_DONT_STRDUP_KEY 4 /**< Take ownership of a key that's been + allocated with av_malloc() or another memory allocation function. */ +#define AV_DICT_DONT_STRDUP_VAL 8 /**< Take ownership of a value that's been + allocated with av_malloc() or another memory allocation function. */ +#define AV_DICT_DONT_OVERWRITE 16 ///< Don't overwrite existing entries. +#define AV_DICT_APPEND 32 /**< If the entry already exists, append to it. Note that no + delimiter is added, the strings are simply concatenated. */ +#define AV_DICT_MULTIKEY 64 /**< Allow to store several equal keys in the dictionary */ + +typedef struct AVDictionaryEntry { + char *key; + char *value; +} AVDictionaryEntry; + +typedef struct AVDictionary AVDictionary; + +/** + * Get a dictionary entry with matching key. + * + * The returned entry key or value must not be changed, or it will + * cause undefined behavior. + * + * To iterate through all the dictionary entries, you can set the matching key + * to the null string "" and set the AV_DICT_IGNORE_SUFFIX flag. + * + * @param prev Set to the previous matching element to find the next. + * If set to NULL the first matching element is returned. + * @param key matching key + * @param flags a collection of AV_DICT_* flags controlling how the entry is retrieved + * @return found entry or NULL in case no matching entry was found in the dictionary + */ +AVDictionaryEntry *av_dict_get(const AVDictionary *m, const char *key, + const AVDictionaryEntry *prev, int flags); + +/** + * Get number of entries in dictionary. + * + * @param m dictionary + * @return number of entries in dictionary + */ +int av_dict_count(const AVDictionary *m); + +/** + * Set the given entry in *pm, overwriting an existing entry. + * + * Note: If AV_DICT_DONT_STRDUP_KEY or AV_DICT_DONT_STRDUP_VAL is set, + * these arguments will be freed on error. + * + * Warning: Adding a new entry to a dictionary invalidates all existing entries + * previously returned with av_dict_get. + * + * @param pm pointer to a pointer to a dictionary struct. If *pm is NULL + * a dictionary struct is allocated and put in *pm. + * @param key entry key to add to *pm (will either be av_strduped or added as a new key depending on flags) + * @param value entry value to add to *pm (will be av_strduped or added as a new key depending on flags). + * Passing a NULL value will cause an existing entry to be deleted. + * @return >= 0 on success otherwise an error code <0 + */ +int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags); + +/** + * Convenience wrapper for av_dict_set that converts the value to a string + * and stores it. + * + * Note: If AV_DICT_DONT_STRDUP_KEY is set, key will be freed on error. + */ +int av_dict_set_int(AVDictionary **pm, const char *key, int64_t value, int flags); + +/** + * Parse the key/value pairs list and add the parsed entries to a dictionary. + * + * In case of failure, all the successfully set entries are stored in + * *pm. You may need to manually free the created dictionary. + * + * @param key_val_sep a 0-terminated list of characters used to separate + * key from value + * @param pairs_sep a 0-terminated list of characters used to separate + * two pairs from each other + * @param flags flags to use when adding to dictionary. + * AV_DICT_DONT_STRDUP_KEY and AV_DICT_DONT_STRDUP_VAL + * are ignored since the key/value tokens will always + * be duplicated. + * @return 0 on success, negative AVERROR code on failure + */ +int av_dict_parse_string(AVDictionary **pm, const char *str, + const char *key_val_sep, const char *pairs_sep, + int flags); + +/** + * Copy entries from one AVDictionary struct into another. + * @param dst pointer to a pointer to a AVDictionary struct. If *dst is NULL, + * this function will allocate a struct for you and put it in *dst + * @param src pointer to source AVDictionary struct + * @param flags flags to use when setting entries in *dst + * @note metadata is read using the AV_DICT_IGNORE_SUFFIX flag + * @return 0 on success, negative AVERROR code on failure. If dst was allocated + * by this function, callers should free the associated memory. + */ +int av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags); + +/** + * Free all the memory allocated for an AVDictionary struct + * and all keys and values. + */ +void av_dict_free(AVDictionary **m); + +/** + * Get dictionary entries as a string. + * + * Create a string containing dictionary's entries. + * Such string may be passed back to av_dict_parse_string(). + * @note String is escaped with backslashes ('\'). + * + * @param[in] m dictionary + * @param[out] buffer Pointer to buffer that will be allocated with string containg entries. + * Buffer must be freed by the caller when is no longer needed. + * @param[in] key_val_sep character used to separate key from value + * @param[in] pairs_sep character used to separate two pairs from each other + * @return >= 0 on success, negative on error + * @warning Separators cannot be neither '\\' nor '\0'. They also cannot be the same. + */ +int av_dict_get_string(const AVDictionary *m, char **buffer, + const char key_val_sep, const char pairs_sep); + +/** + * @} + */ + +#endif /* AVUTIL_DICT_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/display.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/display.h new file mode 100644 index 0000000..515adad --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/display.h @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2014 Vittorio Giovara + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * Display matrix + */ + +#ifndef AVUTIL_DISPLAY_H +#define AVUTIL_DISPLAY_H + +#include +#include "common.h" + +/** + * @addtogroup lavu_video + * @{ + * + * @defgroup lavu_video_display Display transformation matrix functions + * @{ + */ + +/** + * @addtogroup lavu_video_display + * The display transformation matrix specifies an affine transformation that + * should be applied to video frames for correct presentation. It is compatible + * with the matrices stored in the ISO/IEC 14496-12 container format. + * + * The data is a 3x3 matrix represented as a 9-element array: + * + * @code{.unparsed} + * | a b u | + * (a, b, u, c, d, v, x, y, w) -> | c d v | + * | x y w | + * @endcode + * + * All numbers are stored in native endianness, as 16.16 fixed-point values, + * except for u, v and w, which are stored as 2.30 fixed-point values. + * + * The transformation maps a point (p, q) in the source (pre-transformation) + * frame to the point (p', q') in the destination (post-transformation) frame as + * follows: + * + * @code{.unparsed} + * | a b u | + * (p, q, 1) . | c d v | = z * (p', q', 1) + * | x y w | + * @endcode + * + * The transformation can also be more explicitly written in components as + * follows: + * + * @code{.unparsed} + * p' = (a * p + c * q + x) / z; + * q' = (b * p + d * q + y) / z; + * z = u * p + v * q + w + * @endcode + */ + +/** + * Extract the rotation component of the transformation matrix. + * + * @param matrix the transformation matrix + * @return the angle (in degrees) by which the transformation rotates the frame + * counterclockwise. The angle will be in range [-180.0, 180.0], + * or NaN if the matrix is singular. + * + * @note floating point numbers are inherently inexact, so callers are + * recommended to round the return value to nearest integer before use. + */ +double av_display_rotation_get(const int32_t matrix[9]); + +/** + * Initialize a transformation matrix describing a pure counterclockwise + * rotation by the specified angle (in degrees). + * + * @param matrix an allocated transformation matrix (will be fully overwritten + * by this function) + * @param angle rotation angle in degrees. + */ +void av_display_rotation_set(int32_t matrix[9], double angle); + +/** + * Flip the input matrix horizontally and/or vertically. + * + * @param matrix an allocated transformation matrix + * @param hflip whether the matrix should be flipped horizontally + * @param vflip whether the matrix should be flipped vertically + */ +void av_display_matrix_flip(int32_t matrix[9], int hflip, int vflip); + +/** + * @} + * @} + */ + +#endif /* AVUTIL_DISPLAY_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/downmix_info.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/downmix_info.h new file mode 100644 index 0000000..221cf5b --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/downmix_info.h @@ -0,0 +1,115 @@ +/* + * Copyright (c) 2014 Tim Walker + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_DOWNMIX_INFO_H +#define AVUTIL_DOWNMIX_INFO_H + +#include "frame.h" + +/** + * @file + * audio downmix medatata + */ + +/** + * @addtogroup lavu_audio + * @{ + */ + +/** + * @defgroup downmix_info Audio downmix metadata + * @{ + */ + +/** + * Possible downmix types. + */ +enum AVDownmixType { + AV_DOWNMIX_TYPE_UNKNOWN, /**< Not indicated. */ + AV_DOWNMIX_TYPE_LORO, /**< Lo/Ro 2-channel downmix (Stereo). */ + AV_DOWNMIX_TYPE_LTRT, /**< Lt/Rt 2-channel downmix, Dolby Surround compatible. */ + AV_DOWNMIX_TYPE_DPLII, /**< Lt/Rt 2-channel downmix, Dolby Pro Logic II compatible. */ + AV_DOWNMIX_TYPE_NB /**< Number of downmix types. Not part of ABI. */ +}; + +/** + * This structure describes optional metadata relevant to a downmix procedure. + * + * All fields are set by the decoder to the value indicated in the audio + * bitstream (if present), or to a "sane" default otherwise. + */ +typedef struct AVDownmixInfo { + /** + * Type of downmix preferred by the mastering engineer. + */ + enum AVDownmixType preferred_downmix_type; + + /** + * Absolute scale factor representing the nominal level of the center + * channel during a regular downmix. + */ + double center_mix_level; + + /** + * Absolute scale factor representing the nominal level of the center + * channel during an Lt/Rt compatible downmix. + */ + double center_mix_level_ltrt; + + /** + * Absolute scale factor representing the nominal level of the surround + * channels during a regular downmix. + */ + double surround_mix_level; + + /** + * Absolute scale factor representing the nominal level of the surround + * channels during an Lt/Rt compatible downmix. + */ + double surround_mix_level_ltrt; + + /** + * Absolute scale factor representing the level at which the LFE data is + * mixed into L/R channels during downmixing. + */ + double lfe_mix_level; +} AVDownmixInfo; + +/** + * Get a frame's AV_FRAME_DATA_DOWNMIX_INFO side data for editing. + * + * If the side data is absent, it is created and added to the frame. + * + * @param frame the frame for which the side data is to be obtained or created + * + * @return the AVDownmixInfo structure to be edited by the caller, or NULL if + * the structure cannot be allocated. + */ +AVDownmixInfo *av_downmix_info_update_side_data(AVFrame *frame); + +/** + * @} + */ + +/** + * @} + */ + +#endif /* AVUTIL_DOWNMIX_INFO_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/encryption_info.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/encryption_info.h new file mode 100644 index 0000000..47dc3a3 --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/encryption_info.h @@ -0,0 +1,200 @@ +/** + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_ENCRYPTION_INFO_H +#define AVUTIL_ENCRYPTION_INFO_H + +#include +#include + +typedef struct AVSubsampleEncryptionInfo { + /** The number of bytes that are clear. */ + unsigned int bytes_of_clear_data; + + /** + * The number of bytes that are protected. If using pattern encryption, + * the pattern applies to only the protected bytes; if not using pattern + * encryption, all these bytes are encrypted. + */ + unsigned int bytes_of_protected_data; +} AVSubsampleEncryptionInfo; + +/** + * This describes encryption info for a packet. This contains frame-specific + * info for how to decrypt the packet before passing it to the decoder. + * + * The size of this struct is not part of the public ABI. + */ +typedef struct AVEncryptionInfo { + /** The fourcc encryption scheme. */ + uint32_t scheme; + + /** + * Only used for pattern encryption. This is the number of 16-byte blocks + * that are encrypted. + */ + uint32_t crypt_byte_block; + + /** + * Only used for pattern encryption. This is the number of 16-byte blocks + * that are clear. + */ + uint32_t skip_byte_block; + + /** + * The ID of the key used to encrypt the packet. This should always be + * 16 bytes long, but may be changed in the future. + */ + uint8_t *key_id; + uint32_t key_id_size; + + /** + * The initialization vector. This may have been zero-filled to be the + * correct block size. This should always be 16 bytes long, but may be + * changed in the future. + */ + uint8_t *iv; + uint32_t iv_size; + + /** + * An array of subsample encryption info specifying how parts of the sample + * are encrypted. If there are no subsamples, then the whole sample is + * encrypted. + */ + AVSubsampleEncryptionInfo *subsamples; + uint32_t subsample_count; +} AVEncryptionInfo; + +/** + * This describes info used to initialize an encryption key system. + * + * The size of this struct is not part of the public ABI. + */ +typedef struct AVEncryptionInitInfo { + /** + * A unique identifier for the key system this is for, can be NULL if it + * is not known. This should always be 16 bytes, but may change in the + * future. + */ + uint8_t* system_id; + uint32_t system_id_size; + + /** + * An array of key IDs this initialization data is for. All IDs are the + * same length. Can be NULL if there are no known key IDs. + */ + uint8_t** key_ids; + /** The number of key IDs. */ + uint32_t num_key_ids; + /** + * The number of bytes in each key ID. This should always be 16, but may + * change in the future. + */ + uint32_t key_id_size; + + /** + * Key-system specific initialization data. This data is copied directly + * from the file and the format depends on the specific key system. This + * can be NULL if there is no initialization data; in that case, there + * will be at least one key ID. + */ + uint8_t* data; + uint32_t data_size; +} AVEncryptionInitInfo; + +/** + * Allocates an AVEncryptionInfo structure and sub-pointers to hold the given + * number of subsamples. This will allocate pointers for the key ID, IV, + * and subsample entries, set the size members, and zero-initialize the rest. + * + * @param subsample_count The number of subsamples. + * @param key_id_size The number of bytes in the key ID, should be 16. + * @param key_id_size The number of bytes in the IV, should be 16. + * + * @return The new AVEncryptionInfo structure, or NULL on error. + */ +AVEncryptionInfo *av_encryption_info_alloc(uint32_t subsample_count, uint32_t key_id_size, uint32_t iv_size); + +/** + * Allocates an AVEncryptionInfo structure with a copy of the given data. + * @return The new AVEncryptionInfo structure, or NULL on error. + */ +AVEncryptionInfo *av_encryption_info_clone(const AVEncryptionInfo *info); + +/** + * Frees the given encryption info object. This MUST NOT be used to free the + * side-data data pointer, that should use normal side-data methods. + */ +void av_encryption_info_free(AVEncryptionInfo *info); + +/** + * Creates a copy of the AVEncryptionInfo that is contained in the given side + * data. The resulting object should be passed to av_encryption_info_free() + * when done. + * + * @return The new AVEncryptionInfo structure, or NULL on error. + */ +AVEncryptionInfo *av_encryption_info_get_side_data(const uint8_t *side_data, size_t side_data_size); + +/** + * Allocates and initializes side data that holds a copy of the given encryption + * info. The resulting pointer should be either freed using av_free or given + * to av_packet_add_side_data(). + * + * @return The new side-data pointer, or NULL. + */ +uint8_t *av_encryption_info_add_side_data( + const AVEncryptionInfo *info, size_t *side_data_size); + + +/** + * Allocates an AVEncryptionInitInfo structure and sub-pointers to hold the + * given sizes. This will allocate pointers and set all the fields. + * + * @return The new AVEncryptionInitInfo structure, or NULL on error. + */ +AVEncryptionInitInfo *av_encryption_init_info_alloc( + uint32_t system_id_size, uint32_t num_key_ids, uint32_t key_id_size, uint32_t data_size); + +/** + * Frees the given encryption init info object. This MUST NOT be used to free + * the side-data data pointer, that should use normal side-data methods. + */ +void av_encryption_init_info_free(AVEncryptionInitInfo* info); + +/** + * Creates a copy of the AVEncryptionInitInfo that is contained in the given + * side data. The resulting object should be passed to + * av_encryption_init_info_free() when done. + * + * @return The new AVEncryptionInitInfo structure, or NULL on error. + */ +AVEncryptionInitInfo *av_encryption_init_info_get_side_data( + const uint8_t* side_data, size_t side_data_size); + +/** + * Allocates and initializes side data that holds a copy of the given encryption + * init info. The resulting pointer should be either freed using av_free or + * given to av_packet_add_side_data(). + * + * @return The new side-data pointer, or NULL. + */ +uint8_t *av_encryption_init_info_add_side_data( + const AVEncryptionInitInfo *info, size_t *side_data_size); + +#endif /* AVUTIL_ENCRYPTION_INFO_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/error.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/error.h new file mode 100644 index 0000000..71df4da --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/error.h @@ -0,0 +1,126 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * error code definitions + */ + +#ifndef AVUTIL_ERROR_H +#define AVUTIL_ERROR_H + +#include +#include + +/** + * @addtogroup lavu_error + * + * @{ + */ + + +/* error handling */ +#if EDOM > 0 +#define AVERROR(e) (-(e)) ///< Returns a negative error code from a POSIX error code, to return from library functions. +#define AVUNERROR(e) (-(e)) ///< Returns a POSIX error code from a library function error return value. +#else +/* Some platforms have E* and errno already negated. */ +#define AVERROR(e) (e) +#define AVUNERROR(e) (e) +#endif + +#define FFERRTAG(a, b, c, d) (-(int)MKTAG(a, b, c, d)) + +#define AVERROR_BSF_NOT_FOUND FFERRTAG(0xF8,'B','S','F') ///< Bitstream filter not found +#define AVERROR_BUG FFERRTAG( 'B','U','G','!') ///< Internal bug, also see AVERROR_BUG2 +#define AVERROR_BUFFER_TOO_SMALL FFERRTAG( 'B','U','F','S') ///< Buffer too small +#define AVERROR_DECODER_NOT_FOUND FFERRTAG(0xF8,'D','E','C') ///< Decoder not found +#define AVERROR_DEMUXER_NOT_FOUND FFERRTAG(0xF8,'D','E','M') ///< Demuxer not found +#define AVERROR_ENCODER_NOT_FOUND FFERRTAG(0xF8,'E','N','C') ///< Encoder not found +#define AVERROR_EOF FFERRTAG( 'E','O','F',' ') ///< End of file +#define AVERROR_EXIT FFERRTAG( 'E','X','I','T') ///< Immediate exit was requested; the called function should not be restarted +#define AVERROR_EXTERNAL FFERRTAG( 'E','X','T',' ') ///< Generic error in an external library +#define AVERROR_FILTER_NOT_FOUND FFERRTAG(0xF8,'F','I','L') ///< Filter not found +#define AVERROR_INVALIDDATA FFERRTAG( 'I','N','D','A') ///< Invalid data found when processing input +#define AVERROR_MUXER_NOT_FOUND FFERRTAG(0xF8,'M','U','X') ///< Muxer not found +#define AVERROR_OPTION_NOT_FOUND FFERRTAG(0xF8,'O','P','T') ///< Option not found +#define AVERROR_PATCHWELCOME FFERRTAG( 'P','A','W','E') ///< Not yet implemented in FFmpeg, patches welcome +#define AVERROR_PROTOCOL_NOT_FOUND FFERRTAG(0xF8,'P','R','O') ///< Protocol not found + +#define AVERROR_STREAM_NOT_FOUND FFERRTAG(0xF8,'S','T','R') ///< Stream not found +/** + * This is semantically identical to AVERROR_BUG + * it has been introduced in Libav after our AVERROR_BUG and with a modified value. + */ +#define AVERROR_BUG2 FFERRTAG( 'B','U','G',' ') +#define AVERROR_UNKNOWN FFERRTAG( 'U','N','K','N') ///< Unknown error, typically from an external library +#define AVERROR_EXPERIMENTAL (-0x2bb2afa8) ///< Requested feature is flagged experimental. Set strict_std_compliance if you really want to use it. +#define AVERROR_INPUT_CHANGED (-0x636e6701) ///< Input changed between calls. Reconfiguration is required. (can be OR-ed with AVERROR_OUTPUT_CHANGED) +#define AVERROR_OUTPUT_CHANGED (-0x636e6702) ///< Output changed between calls. Reconfiguration is required. (can be OR-ed with AVERROR_INPUT_CHANGED) +/* HTTP & RTSP errors */ +#define AVERROR_HTTP_BAD_REQUEST FFERRTAG(0xF8,'4','0','0') +#define AVERROR_HTTP_UNAUTHORIZED FFERRTAG(0xF8,'4','0','1') +#define AVERROR_HTTP_FORBIDDEN FFERRTAG(0xF8,'4','0','3') +#define AVERROR_HTTP_NOT_FOUND FFERRTAG(0xF8,'4','0','4') +#define AVERROR_HTTP_OTHER_4XX FFERRTAG(0xF8,'4','X','X') +#define AVERROR_HTTP_SERVER_ERROR FFERRTAG(0xF8,'5','X','X') + +#define AV_ERROR_MAX_STRING_SIZE 64 + +/** + * Put a description of the AVERROR code errnum in errbuf. + * In case of failure the global variable errno is set to indicate the + * error. Even in case of failure av_strerror() will print a generic + * error message indicating the errnum provided to errbuf. + * + * @param errnum error code to describe + * @param errbuf buffer to which description is written + * @param errbuf_size the size in bytes of errbuf + * @return 0 on success, a negative value if a description for errnum + * cannot be found + */ +int av_strerror(int errnum, char *errbuf, size_t errbuf_size); + +/** + * Fill the provided buffer with a string containing an error string + * corresponding to the AVERROR code errnum. + * + * @param errbuf a buffer + * @param errbuf_size size in bytes of errbuf + * @param errnum error code to describe + * @return the buffer in input, filled with the error description + * @see av_strerror() + */ +static inline char *av_make_error_string(char *errbuf, size_t errbuf_size, int errnum) +{ + av_strerror(errnum, errbuf, errbuf_size); + return errbuf; +} + +/** + * Convenience macro, the return value should be used only directly in + * function arguments but never stand-alone. + */ +#define av_err2str(errnum) \ + av_make_error_string((char[AV_ERROR_MAX_STRING_SIZE]){0}, AV_ERROR_MAX_STRING_SIZE, errnum) + +/** + * @} + */ + +#endif /* AVUTIL_ERROR_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/eval.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/eval.h new file mode 100644 index 0000000..dacd22b --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/eval.h @@ -0,0 +1,113 @@ +/* + * Copyright (c) 2002 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * simple arithmetic expression evaluator + */ + +#ifndef AVUTIL_EVAL_H +#define AVUTIL_EVAL_H + +#include "avutil.h" + +typedef struct AVExpr AVExpr; + +/** + * Parse and evaluate an expression. + * Note, this is significantly slower than av_expr_eval(). + * + * @param res a pointer to a double where is put the result value of + * the expression, or NAN in case of error + * @param s expression as a zero terminated string, for example "1+2^3+5*5+sin(2/3)" + * @param const_names NULL terminated array of zero terminated strings of constant identifiers, for example {"PI", "E", 0} + * @param const_values a zero terminated array of values for the identifiers from const_names + * @param func1_names NULL terminated array of zero terminated strings of funcs1 identifiers + * @param funcs1 NULL terminated array of function pointers for functions which take 1 argument + * @param func2_names NULL terminated array of zero terminated strings of funcs2 identifiers + * @param funcs2 NULL terminated array of function pointers for functions which take 2 arguments + * @param opaque a pointer which will be passed to all functions from funcs1 and funcs2 + * @param log_ctx parent logging context + * @return >= 0 in case of success, a negative value corresponding to an + * AVERROR code otherwise + */ +int av_expr_parse_and_eval(double *res, const char *s, + const char * const *const_names, const double *const_values, + const char * const *func1_names, double (* const *funcs1)(void *, double), + const char * const *func2_names, double (* const *funcs2)(void *, double, double), + void *opaque, int log_offset, void *log_ctx); + +/** + * Parse an expression. + * + * @param expr a pointer where is put an AVExpr containing the parsed + * value in case of successful parsing, or NULL otherwise. + * The pointed to AVExpr must be freed with av_expr_free() by the user + * when it is not needed anymore. + * @param s expression as a zero terminated string, for example "1+2^3+5*5+sin(2/3)" + * @param const_names NULL terminated array of zero terminated strings of constant identifiers, for example {"PI", "E", 0} + * @param func1_names NULL terminated array of zero terminated strings of funcs1 identifiers + * @param funcs1 NULL terminated array of function pointers for functions which take 1 argument + * @param func2_names NULL terminated array of zero terminated strings of funcs2 identifiers + * @param funcs2 NULL terminated array of function pointers for functions which take 2 arguments + * @param log_ctx parent logging context + * @return >= 0 in case of success, a negative value corresponding to an + * AVERROR code otherwise + */ +int av_expr_parse(AVExpr **expr, const char *s, + const char * const *const_names, + const char * const *func1_names, double (* const *funcs1)(void *, double), + const char * const *func2_names, double (* const *funcs2)(void *, double, double), + int log_offset, void *log_ctx); + +/** + * Evaluate a previously parsed expression. + * + * @param const_values a zero terminated array of values for the identifiers from av_expr_parse() const_names + * @param opaque a pointer which will be passed to all functions from funcs1 and funcs2 + * @return the value of the expression + */ +double av_expr_eval(AVExpr *e, const double *const_values, void *opaque); + +/** + * Free a parsed expression previously created with av_expr_parse(). + */ +void av_expr_free(AVExpr *e); + +/** + * Parse the string in numstr and return its value as a double. If + * the string is empty, contains only whitespaces, or does not contain + * an initial substring that has the expected syntax for a + * floating-point number, no conversion is performed. In this case, + * returns a value of zero and the value returned in tail is the value + * of numstr. + * + * @param numstr a string representing a number, may contain one of + * the International System number postfixes, for example 'K', 'M', + * 'G'. If 'i' is appended after the postfix, powers of 2 are used + * instead of powers of 10. The 'B' postfix multiplies the value by + * 8, and can be appended after another postfix or used alone. This + * allows using for example 'KB', 'MiB', 'G' and 'B' as postfix. + * @param tail if non-NULL puts here the pointer to the char next + * after the last parsed character + */ +double av_strtod(const char *numstr, char **tail); + +#endif /* AVUTIL_EVAL_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/ffversion.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/ffversion.h new file mode 100644 index 0000000..cc6acf9 --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/ffversion.h @@ -0,0 +1,5 @@ +/* Automatically generated by version.sh, do not manually edit! */ +#ifndef AVUTIL_FFVERSION_H +#define AVUTIL_FFVERSION_H +#define FFMPEG_VERSION "4.0.2" +#endif /* AVUTIL_FFVERSION_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/fifo.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/fifo.h new file mode 100644 index 0000000..dc7bc6f --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/fifo.h @@ -0,0 +1,179 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * a very simple circular buffer FIFO implementation + */ + +#ifndef AVUTIL_FIFO_H +#define AVUTIL_FIFO_H + +#include +#include "avutil.h" +#include "attributes.h" + +typedef struct AVFifoBuffer { + uint8_t *buffer; + uint8_t *rptr, *wptr, *end; + uint32_t rndx, wndx; +} AVFifoBuffer; + +/** + * Initialize an AVFifoBuffer. + * @param size of FIFO + * @return AVFifoBuffer or NULL in case of memory allocation failure + */ +AVFifoBuffer *av_fifo_alloc(unsigned int size); + +/** + * Initialize an AVFifoBuffer. + * @param nmemb number of elements + * @param size size of the single element + * @return AVFifoBuffer or NULL in case of memory allocation failure + */ +AVFifoBuffer *av_fifo_alloc_array(size_t nmemb, size_t size); + +/** + * Free an AVFifoBuffer. + * @param f AVFifoBuffer to free + */ +void av_fifo_free(AVFifoBuffer *f); + +/** + * Free an AVFifoBuffer and reset pointer to NULL. + * @param f AVFifoBuffer to free + */ +void av_fifo_freep(AVFifoBuffer **f); + +/** + * Reset the AVFifoBuffer to the state right after av_fifo_alloc, in particular it is emptied. + * @param f AVFifoBuffer to reset + */ +void av_fifo_reset(AVFifoBuffer *f); + +/** + * Return the amount of data in bytes in the AVFifoBuffer, that is the + * amount of data you can read from it. + * @param f AVFifoBuffer to read from + * @return size + */ +int av_fifo_size(const AVFifoBuffer *f); + +/** + * Return the amount of space in bytes in the AVFifoBuffer, that is the + * amount of data you can write into it. + * @param f AVFifoBuffer to write into + * @return size + */ +int av_fifo_space(const AVFifoBuffer *f); + +/** + * Feed data at specific position from an AVFifoBuffer to a user-supplied callback. + * Similar as av_fifo_gereric_read but without discarding data. + * @param f AVFifoBuffer to read from + * @param offset offset from current read position + * @param buf_size number of bytes to read + * @param func generic read function + * @param dest data destination + */ +int av_fifo_generic_peek_at(AVFifoBuffer *f, void *dest, int offset, int buf_size, void (*func)(void*, void*, int)); + +/** + * Feed data from an AVFifoBuffer to a user-supplied callback. + * Similar as av_fifo_gereric_read but without discarding data. + * @param f AVFifoBuffer to read from + * @param buf_size number of bytes to read + * @param func generic read function + * @param dest data destination + */ +int av_fifo_generic_peek(AVFifoBuffer *f, void *dest, int buf_size, void (*func)(void*, void*, int)); + +/** + * Feed data from an AVFifoBuffer to a user-supplied callback. + * @param f AVFifoBuffer to read from + * @param buf_size number of bytes to read + * @param func generic read function + * @param dest data destination + */ +int av_fifo_generic_read(AVFifoBuffer *f, void *dest, int buf_size, void (*func)(void*, void*, int)); + +/** + * Feed data from a user-supplied callback to an AVFifoBuffer. + * @param f AVFifoBuffer to write to + * @param src data source; non-const since it may be used as a + * modifiable context by the function defined in func + * @param size number of bytes to write + * @param func generic write function; the first parameter is src, + * the second is dest_buf, the third is dest_buf_size. + * func must return the number of bytes written to dest_buf, or <= 0 to + * indicate no more data available to write. + * If func is NULL, src is interpreted as a simple byte array for source data. + * @return the number of bytes written to the FIFO + */ +int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int (*func)(void*, void*, int)); + +/** + * Resize an AVFifoBuffer. + * In case of reallocation failure, the old FIFO is kept unchanged. + * + * @param f AVFifoBuffer to resize + * @param size new AVFifoBuffer size in bytes + * @return <0 for failure, >=0 otherwise + */ +int av_fifo_realloc2(AVFifoBuffer *f, unsigned int size); + +/** + * Enlarge an AVFifoBuffer. + * In case of reallocation failure, the old FIFO is kept unchanged. + * The new fifo size may be larger than the requested size. + * + * @param f AVFifoBuffer to resize + * @param additional_space the amount of space in bytes to allocate in addition to av_fifo_size() + * @return <0 for failure, >=0 otherwise + */ +int av_fifo_grow(AVFifoBuffer *f, unsigned int additional_space); + +/** + * Read and discard the specified amount of data from an AVFifoBuffer. + * @param f AVFifoBuffer to read from + * @param size amount of data to read in bytes + */ +void av_fifo_drain(AVFifoBuffer *f, int size); + +/** + * Return a pointer to the data stored in a FIFO buffer at a certain offset. + * The FIFO buffer is not modified. + * + * @param f AVFifoBuffer to peek at, f must be non-NULL + * @param offs an offset in bytes, its absolute value must be less + * than the used buffer size or the returned pointer will + * point outside to the buffer data. + * The used buffer size can be checked with av_fifo_size(). + */ +static inline uint8_t *av_fifo_peek2(const AVFifoBuffer *f, int offs) +{ + uint8_t *ptr = f->rptr + offs; + if (ptr >= f->end) + ptr = f->buffer + (ptr - f->end); + else if (ptr < f->buffer) + ptr = f->end - (f->buffer - ptr); + return ptr; +} + +#endif /* AVUTIL_FIFO_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/file.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/file.h new file mode 100644 index 0000000..8666c7b --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/file.h @@ -0,0 +1,69 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_FILE_H +#define AVUTIL_FILE_H + +#include + +#include "avutil.h" + +/** + * @file + * Misc file utilities. + */ + +/** + * Read the file with name filename, and put its content in a newly + * allocated buffer or map it with mmap() when available. + * In case of success set *bufptr to the read or mmapped buffer, and + * *size to the size in bytes of the buffer in *bufptr. + * The returned buffer must be released with av_file_unmap(). + * + * @param log_offset loglevel offset used for logging + * @param log_ctx context used for logging + * @return a non negative number in case of success, a negative value + * corresponding to an AVERROR error code in case of failure + */ +av_warn_unused_result +int av_file_map(const char *filename, uint8_t **bufptr, size_t *size, + int log_offset, void *log_ctx); + +/** + * Unmap or free the buffer bufptr created by av_file_map(). + * + * @param size size in bytes of bufptr, must be the same as returned + * by av_file_map() + */ +void av_file_unmap(uint8_t *bufptr, size_t size); + +/** + * Wrapper to work around the lack of mkstemp() on mingw. + * Also, tries to create file in /tmp first, if possible. + * *prefix can be a character constant; *filename will be allocated internally. + * @return file descriptor of opened file (or negative value corresponding to an + * AVERROR code on error) + * and opened file name in **filename. + * @note On very old libcs it is necessary to set a secure umask before + * calling this, av_tempfile() can't call umask itself as it is used in + * libraries and could interfere with the calling application. + * @deprecated as fd numbers cannot be passed saftely between libs on some platforms + */ +int av_tempfile(const char *prefix, char **filename, int log_offset, void *log_ctx); + +#endif /* AVUTIL_FILE_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/frame.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/frame.h new file mode 100644 index 0000000..9d57d6c --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/frame.h @@ -0,0 +1,893 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * @ingroup lavu_frame + * reference-counted frame API + */ + +#ifndef AVUTIL_FRAME_H +#define AVUTIL_FRAME_H + +#include +#include + +#include "avutil.h" +#include "buffer.h" +#include "dict.h" +#include "rational.h" +#include "samplefmt.h" +#include "pixfmt.h" +#include "version.h" + + +/** + * @defgroup lavu_frame AVFrame + * @ingroup lavu_data + * + * @{ + * AVFrame is an abstraction for reference-counted raw multimedia data. + */ + +enum AVFrameSideDataType { + /** + * The data is the AVPanScan struct defined in libavcodec. + */ + AV_FRAME_DATA_PANSCAN, + /** + * ATSC A53 Part 4 Closed Captions. + * A53 CC bitstream is stored as uint8_t in AVFrameSideData.data. + * The number of bytes of CC data is AVFrameSideData.size. + */ + AV_FRAME_DATA_A53_CC, + /** + * Stereoscopic 3d metadata. + * The data is the AVStereo3D struct defined in libavutil/stereo3d.h. + */ + AV_FRAME_DATA_STEREO3D, + /** + * The data is the AVMatrixEncoding enum defined in libavutil/channel_layout.h. + */ + AV_FRAME_DATA_MATRIXENCODING, + /** + * Metadata relevant to a downmix procedure. + * The data is the AVDownmixInfo struct defined in libavutil/downmix_info.h. + */ + AV_FRAME_DATA_DOWNMIX_INFO, + /** + * ReplayGain information in the form of the AVReplayGain struct. + */ + AV_FRAME_DATA_REPLAYGAIN, + /** + * This side data contains a 3x3 transformation matrix describing an affine + * transformation that needs to be applied to the frame for correct + * presentation. + * + * See libavutil/display.h for a detailed description of the data. + */ + AV_FRAME_DATA_DISPLAYMATRIX, + /** + * Active Format Description data consisting of a single byte as specified + * in ETSI TS 101 154 using AVActiveFormatDescription enum. + */ + AV_FRAME_DATA_AFD, + /** + * Motion vectors exported by some codecs (on demand through the export_mvs + * flag set in the libavcodec AVCodecContext flags2 option). + * The data is the AVMotionVector struct defined in + * libavutil/motion_vector.h. + */ + AV_FRAME_DATA_MOTION_VECTORS, + /** + * Recommmends skipping the specified number of samples. This is exported + * only if the "skip_manual" AVOption is set in libavcodec. + * This has the same format as AV_PKT_DATA_SKIP_SAMPLES. + * @code + * u32le number of samples to skip from start of this packet + * u32le number of samples to skip from end of this packet + * u8 reason for start skip + * u8 reason for end skip (0=padding silence, 1=convergence) + * @endcode + */ + AV_FRAME_DATA_SKIP_SAMPLES, + /** + * This side data must be associated with an audio frame and corresponds to + * enum AVAudioServiceType defined in avcodec.h. + */ + AV_FRAME_DATA_AUDIO_SERVICE_TYPE, + /** + * Mastering display metadata associated with a video frame. The payload is + * an AVMasteringDisplayMetadata type and contains information about the + * mastering display color volume. + */ + AV_FRAME_DATA_MASTERING_DISPLAY_METADATA, + /** + * The GOP timecode in 25 bit timecode format. Data format is 64-bit integer. + * This is set on the first frame of a GOP that has a temporal reference of 0. + */ + AV_FRAME_DATA_GOP_TIMECODE, + + /** + * The data represents the AVSphericalMapping structure defined in + * libavutil/spherical.h. + */ + AV_FRAME_DATA_SPHERICAL, + + /** + * Content light level (based on CTA-861.3). This payload contains data in + * the form of the AVContentLightMetadata struct. + */ + AV_FRAME_DATA_CONTENT_LIGHT_LEVEL, + + /** + * The data contains an ICC profile as an opaque octet buffer following the + * format described by ISO 15076-1 with an optional name defined in the + * metadata key entry "name". + */ + AV_FRAME_DATA_ICC_PROFILE, + +#if FF_API_FRAME_QP + /** + * Implementation-specific description of the format of AV_FRAME_QP_TABLE_DATA. + * The contents of this side data are undocumented and internal; use + * av_frame_set_qp_table() and av_frame_get_qp_table() to access this in a + * meaningful way instead. + */ + AV_FRAME_DATA_QP_TABLE_PROPERTIES, + + /** + * Raw QP table data. Its format is described by + * AV_FRAME_DATA_QP_TABLE_PROPERTIES. Use av_frame_set_qp_table() and + * av_frame_get_qp_table() to access this instead. + */ + AV_FRAME_DATA_QP_TABLE_DATA, +#endif +}; + +enum AVActiveFormatDescription { + AV_AFD_SAME = 8, + AV_AFD_4_3 = 9, + AV_AFD_16_9 = 10, + AV_AFD_14_9 = 11, + AV_AFD_4_3_SP_14_9 = 13, + AV_AFD_16_9_SP_14_9 = 14, + AV_AFD_SP_4_3 = 15, +}; + + +/** + * Structure to hold side data for an AVFrame. + * + * sizeof(AVFrameSideData) is not a part of the public ABI, so new fields may be added + * to the end with a minor bump. + */ +typedef struct AVFrameSideData { + enum AVFrameSideDataType type; + uint8_t *data; + int size; + AVDictionary *metadata; + AVBufferRef *buf; +} AVFrameSideData; + +/** + * This structure describes decoded (raw) audio or video data. + * + * AVFrame must be allocated using av_frame_alloc(). Note that this only + * allocates the AVFrame itself, the buffers for the data must be managed + * through other means (see below). + * AVFrame must be freed with av_frame_free(). + * + * AVFrame is typically allocated once and then reused multiple times to hold + * different data (e.g. a single AVFrame to hold frames received from a + * decoder). In such a case, av_frame_unref() will free any references held by + * the frame and reset it to its original clean state before it + * is reused again. + * + * The data described by an AVFrame is usually reference counted through the + * AVBuffer API. The underlying buffer references are stored in AVFrame.buf / + * AVFrame.extended_buf. An AVFrame is considered to be reference counted if at + * least one reference is set, i.e. if AVFrame.buf[0] != NULL. In such a case, + * every single data plane must be contained in one of the buffers in + * AVFrame.buf or AVFrame.extended_buf. + * There may be a single buffer for all the data, or one separate buffer for + * each plane, or anything in between. + * + * sizeof(AVFrame) is not a part of the public ABI, so new fields may be added + * to the end with a minor bump. + * + * Fields can be accessed through AVOptions, the name string used, matches the + * C structure field name for fields accessible through AVOptions. The AVClass + * for AVFrame can be obtained from avcodec_get_frame_class() + */ +typedef struct AVFrame { +#define AV_NUM_DATA_POINTERS 8 + /** + * pointer to the picture/channel planes. + * This might be different from the first allocated byte + * + * Some decoders access areas outside 0,0 - width,height, please + * see avcodec_align_dimensions2(). Some filters and swscale can read + * up to 16 bytes beyond the planes, if these filters are to be used, + * then 16 extra bytes must be allocated. + * + * NOTE: Except for hwaccel formats, pointers not needed by the format + * MUST be set to NULL. + */ + uint8_t *data[AV_NUM_DATA_POINTERS]; + + /** + * For video, size in bytes of each picture line. + * For audio, size in bytes of each plane. + * + * For audio, only linesize[0] may be set. For planar audio, each channel + * plane must be the same size. + * + * For video the linesizes should be multiples of the CPUs alignment + * preference, this is 16 or 32 for modern desktop CPUs. + * Some code requires such alignment other code can be slower without + * correct alignment, for yet other it makes no difference. + * + * @note The linesize may be larger than the size of usable data -- there + * may be extra padding present for performance reasons. + */ + int linesize[AV_NUM_DATA_POINTERS]; + + /** + * pointers to the data planes/channels. + * + * For video, this should simply point to data[]. + * + * For planar audio, each channel has a separate data pointer, and + * linesize[0] contains the size of each channel buffer. + * For packed audio, there is just one data pointer, and linesize[0] + * contains the total size of the buffer for all channels. + * + * Note: Both data and extended_data should always be set in a valid frame, + * but for planar audio with more channels that can fit in data, + * extended_data must be used in order to access all channels. + */ + uint8_t **extended_data; + + /** + * @name Video dimensions + * Video frames only. The coded dimensions (in pixels) of the video frame, + * i.e. the size of the rectangle that contains some well-defined values. + * + * @note The part of the frame intended for display/presentation is further + * restricted by the @ref cropping "Cropping rectangle". + * @{ + */ + int width, height; + /** + * @} + */ + + /** + * number of audio samples (per channel) described by this frame + */ + int nb_samples; + + /** + * format of the frame, -1 if unknown or unset + * Values correspond to enum AVPixelFormat for video frames, + * enum AVSampleFormat for audio) + */ + int format; + + /** + * 1 -> keyframe, 0-> not + */ + int key_frame; + + /** + * Picture type of the frame. + */ + enum AVPictureType pict_type; + + /** + * Sample aspect ratio for the video frame, 0/1 if unknown/unspecified. + */ + AVRational sample_aspect_ratio; + + /** + * Presentation timestamp in time_base units (time when frame should be shown to user). + */ + int64_t pts; + +#if FF_API_PKT_PTS + /** + * PTS copied from the AVPacket that was decoded to produce this frame. + * @deprecated use the pts field instead + */ + attribute_deprecated + int64_t pkt_pts; +#endif + + /** + * DTS copied from the AVPacket that triggered returning this frame. (if frame threading isn't used) + * This is also the Presentation time of this AVFrame calculated from + * only AVPacket.dts values without pts values. + */ + int64_t pkt_dts; + + /** + * picture number in bitstream order + */ + int coded_picture_number; + /** + * picture number in display order + */ + int display_picture_number; + + /** + * quality (between 1 (good) and FF_LAMBDA_MAX (bad)) + */ + int quality; + + /** + * for some private data of the user + */ + void *opaque; + +#if FF_API_ERROR_FRAME + /** + * @deprecated unused + */ + attribute_deprecated + uint64_t error[AV_NUM_DATA_POINTERS]; +#endif + + /** + * When decoding, this signals how much the picture must be delayed. + * extra_delay = repeat_pict / (2*fps) + */ + int repeat_pict; + + /** + * The content of the picture is interlaced. + */ + int interlaced_frame; + + /** + * If the content is interlaced, is top field displayed first. + */ + int top_field_first; + + /** + * Tell user application that palette has changed from previous frame. + */ + int palette_has_changed; + + /** + * reordered opaque 64 bits (generally an integer or a double precision float + * PTS but can be anything). + * The user sets AVCodecContext.reordered_opaque to represent the input at + * that time, + * the decoder reorders values as needed and sets AVFrame.reordered_opaque + * to exactly one of the values provided by the user through AVCodecContext.reordered_opaque + * @deprecated in favor of pkt_pts + */ + int64_t reordered_opaque; + + /** + * Sample rate of the audio data. + */ + int sample_rate; + + /** + * Channel layout of the audio data. + */ + uint64_t channel_layout; + + /** + * AVBuffer references backing the data for this frame. If all elements of + * this array are NULL, then this frame is not reference counted. This array + * must be filled contiguously -- if buf[i] is non-NULL then buf[j] must + * also be non-NULL for all j < i. + * + * There may be at most one AVBuffer per data plane, so for video this array + * always contains all the references. For planar audio with more than + * AV_NUM_DATA_POINTERS channels, there may be more buffers than can fit in + * this array. Then the extra AVBufferRef pointers are stored in the + * extended_buf array. + */ + AVBufferRef *buf[AV_NUM_DATA_POINTERS]; + + /** + * For planar audio which requires more than AV_NUM_DATA_POINTERS + * AVBufferRef pointers, this array will hold all the references which + * cannot fit into AVFrame.buf. + * + * Note that this is different from AVFrame.extended_data, which always + * contains all the pointers. This array only contains the extra pointers, + * which cannot fit into AVFrame.buf. + * + * This array is always allocated using av_malloc() by whoever constructs + * the frame. It is freed in av_frame_unref(). + */ + AVBufferRef **extended_buf; + /** + * Number of elements in extended_buf. + */ + int nb_extended_buf; + + AVFrameSideData **side_data; + int nb_side_data; + +/** + * @defgroup lavu_frame_flags AV_FRAME_FLAGS + * @ingroup lavu_frame + * Flags describing additional frame properties. + * + * @{ + */ + +/** + * The frame data may be corrupted, e.g. due to decoding errors. + */ +#define AV_FRAME_FLAG_CORRUPT (1 << 0) +/** + * A flag to mark the frames which need to be decoded, but shouldn't be output. + */ +#define AV_FRAME_FLAG_DISCARD (1 << 2) +/** + * @} + */ + + /** + * Frame flags, a combination of @ref lavu_frame_flags + */ + int flags; + + /** + * MPEG vs JPEG YUV range. + * - encoding: Set by user + * - decoding: Set by libavcodec + */ + enum AVColorRange color_range; + + enum AVColorPrimaries color_primaries; + + enum AVColorTransferCharacteristic color_trc; + + /** + * YUV colorspace type. + * - encoding: Set by user + * - decoding: Set by libavcodec + */ + enum AVColorSpace colorspace; + + enum AVChromaLocation chroma_location; + + /** + * frame timestamp estimated using various heuristics, in stream time base + * - encoding: unused + * - decoding: set by libavcodec, read by user. + */ + int64_t best_effort_timestamp; + + /** + * reordered pos from the last AVPacket that has been input into the decoder + * - encoding: unused + * - decoding: Read by user. + */ + int64_t pkt_pos; + + /** + * duration of the corresponding packet, expressed in + * AVStream->time_base units, 0 if unknown. + * - encoding: unused + * - decoding: Read by user. + */ + int64_t pkt_duration; + + /** + * metadata. + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + AVDictionary *metadata; + + /** + * decode error flags of the frame, set to a combination of + * FF_DECODE_ERROR_xxx flags if the decoder produced a frame, but there + * were errors during the decoding. + * - encoding: unused + * - decoding: set by libavcodec, read by user. + */ + int decode_error_flags; +#define FF_DECODE_ERROR_INVALID_BITSTREAM 1 +#define FF_DECODE_ERROR_MISSING_REFERENCE 2 + + /** + * number of audio channels, only used for audio. + * - encoding: unused + * - decoding: Read by user. + */ + int channels; + + /** + * size of the corresponding packet containing the compressed + * frame. + * It is set to a negative value if unknown. + * - encoding: unused + * - decoding: set by libavcodec, read by user. + */ + int pkt_size; + +#if FF_API_FRAME_QP + /** + * QP table + */ + attribute_deprecated + int8_t *qscale_table; + /** + * QP store stride + */ + attribute_deprecated + int qstride; + + attribute_deprecated + int qscale_type; + + attribute_deprecated + AVBufferRef *qp_table_buf; +#endif + /** + * For hwaccel-format frames, this should be a reference to the + * AVHWFramesContext describing the frame. + */ + AVBufferRef *hw_frames_ctx; + + /** + * AVBufferRef for free use by the API user. FFmpeg will never check the + * contents of the buffer ref. FFmpeg calls av_buffer_unref() on it when + * the frame is unreferenced. av_frame_copy_props() calls create a new + * reference with av_buffer_ref() for the target frame's opaque_ref field. + * + * This is unrelated to the opaque field, although it serves a similar + * purpose. + */ + AVBufferRef *opaque_ref; + + /** + * @anchor cropping + * @name Cropping + * Video frames only. The number of pixels to discard from the the + * top/bottom/left/right border of the frame to obtain the sub-rectangle of + * the frame intended for presentation. + * @{ + */ + size_t crop_top; + size_t crop_bottom; + size_t crop_left; + size_t crop_right; + /** + * @} + */ + + /** + * AVBufferRef for internal use by a single libav* library. + * Must not be used to transfer data between libraries. + * Has to be NULL when ownership of the frame leaves the respective library. + * + * Code outside the FFmpeg libs should never check or change the contents of the buffer ref. + * + * FFmpeg calls av_buffer_unref() on it when the frame is unreferenced. + * av_frame_copy_props() calls create a new reference with av_buffer_ref() + * for the target frame's private_ref field. + */ + AVBufferRef *private_ref; +} AVFrame; + +#if FF_API_FRAME_GET_SET +/** + * Accessors for some AVFrame fields. These used to be provided for ABI + * compatibility, and do not need to be used anymore. + */ +attribute_deprecated +int64_t av_frame_get_best_effort_timestamp(const AVFrame *frame); +attribute_deprecated +void av_frame_set_best_effort_timestamp(AVFrame *frame, int64_t val); +attribute_deprecated +int64_t av_frame_get_pkt_duration (const AVFrame *frame); +attribute_deprecated +void av_frame_set_pkt_duration (AVFrame *frame, int64_t val); +attribute_deprecated +int64_t av_frame_get_pkt_pos (const AVFrame *frame); +attribute_deprecated +void av_frame_set_pkt_pos (AVFrame *frame, int64_t val); +attribute_deprecated +int64_t av_frame_get_channel_layout (const AVFrame *frame); +attribute_deprecated +void av_frame_set_channel_layout (AVFrame *frame, int64_t val); +attribute_deprecated +int av_frame_get_channels (const AVFrame *frame); +attribute_deprecated +void av_frame_set_channels (AVFrame *frame, int val); +attribute_deprecated +int av_frame_get_sample_rate (const AVFrame *frame); +attribute_deprecated +void av_frame_set_sample_rate (AVFrame *frame, int val); +attribute_deprecated +AVDictionary *av_frame_get_metadata (const AVFrame *frame); +attribute_deprecated +void av_frame_set_metadata (AVFrame *frame, AVDictionary *val); +attribute_deprecated +int av_frame_get_decode_error_flags (const AVFrame *frame); +attribute_deprecated +void av_frame_set_decode_error_flags (AVFrame *frame, int val); +attribute_deprecated +int av_frame_get_pkt_size(const AVFrame *frame); +attribute_deprecated +void av_frame_set_pkt_size(AVFrame *frame, int val); +#if FF_API_FRAME_QP +attribute_deprecated +int8_t *av_frame_get_qp_table(AVFrame *f, int *stride, int *type); +attribute_deprecated +int av_frame_set_qp_table(AVFrame *f, AVBufferRef *buf, int stride, int type); +#endif +attribute_deprecated +enum AVColorSpace av_frame_get_colorspace(const AVFrame *frame); +attribute_deprecated +void av_frame_set_colorspace(AVFrame *frame, enum AVColorSpace val); +attribute_deprecated +enum AVColorRange av_frame_get_color_range(const AVFrame *frame); +attribute_deprecated +void av_frame_set_color_range(AVFrame *frame, enum AVColorRange val); +#endif + +/** + * Get the name of a colorspace. + * @return a static string identifying the colorspace; can be NULL. + */ +const char *av_get_colorspace_name(enum AVColorSpace val); + +/** + * Allocate an AVFrame and set its fields to default values. The resulting + * struct must be freed using av_frame_free(). + * + * @return An AVFrame filled with default values or NULL on failure. + * + * @note this only allocates the AVFrame itself, not the data buffers. Those + * must be allocated through other means, e.g. with av_frame_get_buffer() or + * manually. + */ +AVFrame *av_frame_alloc(void); + +/** + * Free the frame and any dynamically allocated objects in it, + * e.g. extended_data. If the frame is reference counted, it will be + * unreferenced first. + * + * @param frame frame to be freed. The pointer will be set to NULL. + */ +void av_frame_free(AVFrame **frame); + +/** + * Set up a new reference to the data described by the source frame. + * + * Copy frame properties from src to dst and create a new reference for each + * AVBufferRef from src. + * + * If src is not reference counted, new buffers are allocated and the data is + * copied. + * + * @warning: dst MUST have been either unreferenced with av_frame_unref(dst), + * or newly allocated with av_frame_alloc() before calling this + * function, or undefined behavior will occur. + * + * @return 0 on success, a negative AVERROR on error + */ +int av_frame_ref(AVFrame *dst, const AVFrame *src); + +/** + * Create a new frame that references the same data as src. + * + * This is a shortcut for av_frame_alloc()+av_frame_ref(). + * + * @return newly created AVFrame on success, NULL on error. + */ +AVFrame *av_frame_clone(const AVFrame *src); + +/** + * Unreference all the buffers referenced by frame and reset the frame fields. + */ +void av_frame_unref(AVFrame *frame); + +/** + * Move everything contained in src to dst and reset src. + * + * @warning: dst is not unreferenced, but directly overwritten without reading + * or deallocating its contents. Call av_frame_unref(dst) manually + * before calling this function to ensure that no memory is leaked. + */ +void av_frame_move_ref(AVFrame *dst, AVFrame *src); + +/** + * Allocate new buffer(s) for audio or video data. + * + * The following fields must be set on frame before calling this function: + * - format (pixel format for video, sample format for audio) + * - width and height for video + * - nb_samples and channel_layout for audio + * + * This function will fill AVFrame.data and AVFrame.buf arrays and, if + * necessary, allocate and fill AVFrame.extended_data and AVFrame.extended_buf. + * For planar formats, one buffer will be allocated for each plane. + * + * @warning: if frame already has been allocated, calling this function will + * leak memory. In addition, undefined behavior can occur in certain + * cases. + * + * @param frame frame in which to store the new buffers. + * @param align Required buffer size alignment. If equal to 0, alignment will be + * chosen automatically for the current CPU. It is highly + * recommended to pass 0 here unless you know what you are doing. + * + * @return 0 on success, a negative AVERROR on error. + */ +int av_frame_get_buffer(AVFrame *frame, int align); + +/** + * Check if the frame data is writable. + * + * @return A positive value if the frame data is writable (which is true if and + * only if each of the underlying buffers has only one reference, namely the one + * stored in this frame). Return 0 otherwise. + * + * If 1 is returned the answer is valid until av_buffer_ref() is called on any + * of the underlying AVBufferRefs (e.g. through av_frame_ref() or directly). + * + * @see av_frame_make_writable(), av_buffer_is_writable() + */ +int av_frame_is_writable(AVFrame *frame); + +/** + * Ensure that the frame data is writable, avoiding data copy if possible. + * + * Do nothing if the frame is writable, allocate new buffers and copy the data + * if it is not. + * + * @return 0 on success, a negative AVERROR on error. + * + * @see av_frame_is_writable(), av_buffer_is_writable(), + * av_buffer_make_writable() + */ +int av_frame_make_writable(AVFrame *frame); + +/** + * Copy the frame data from src to dst. + * + * This function does not allocate anything, dst must be already initialized and + * allocated with the same parameters as src. + * + * This function only copies the frame data (i.e. the contents of the data / + * extended data arrays), not any other properties. + * + * @return >= 0 on success, a negative AVERROR on error. + */ +int av_frame_copy(AVFrame *dst, const AVFrame *src); + +/** + * Copy only "metadata" fields from src to dst. + * + * Metadata for the purpose of this function are those fields that do not affect + * the data layout in the buffers. E.g. pts, sample rate (for audio) or sample + * aspect ratio (for video), but not width/height or channel layout. + * Side data is also copied. + */ +int av_frame_copy_props(AVFrame *dst, const AVFrame *src); + +/** + * Get the buffer reference a given data plane is stored in. + * + * @param plane index of the data plane of interest in frame->extended_data. + * + * @return the buffer reference that contains the plane or NULL if the input + * frame is not valid. + */ +AVBufferRef *av_frame_get_plane_buffer(AVFrame *frame, int plane); + +/** + * Add a new side data to a frame. + * + * @param frame a frame to which the side data should be added + * @param type type of the added side data + * @param size size of the side data + * + * @return newly added side data on success, NULL on error + */ +AVFrameSideData *av_frame_new_side_data(AVFrame *frame, + enum AVFrameSideDataType type, + int size); + +/** + * Add a new side data to a frame from an existing AVBufferRef + * + * @param frame a frame to which the side data should be added + * @param type the type of the added side data + * @param buf an AVBufferRef to add as side data. The ownership of + * the reference is transferred to the frame. + * + * @return newly added side data on success, NULL on error. On failure + * the frame is unchanged and the AVBufferRef remains owned by + * the caller. + */ +AVFrameSideData *av_frame_new_side_data_from_buf(AVFrame *frame, + enum AVFrameSideDataType type, + AVBufferRef *buf); + +/** + * @return a pointer to the side data of a given type on success, NULL if there + * is no side data with such type in this frame. + */ +AVFrameSideData *av_frame_get_side_data(const AVFrame *frame, + enum AVFrameSideDataType type); + +/** + * If side data of the supplied type exists in the frame, free it and remove it + * from the frame. + */ +void av_frame_remove_side_data(AVFrame *frame, enum AVFrameSideDataType type); + + +/** + * Flags for frame cropping. + */ +enum { + /** + * Apply the maximum possible cropping, even if it requires setting the + * AVFrame.data[] entries to unaligned pointers. Passing unaligned data + * to FFmpeg API is generally not allowed, and causes undefined behavior + * (such as crashes). You can pass unaligned data only to FFmpeg APIs that + * are explicitly documented to accept it. Use this flag only if you + * absolutely know what you are doing. + */ + AV_FRAME_CROP_UNALIGNED = 1 << 0, +}; + +/** + * Crop the given video AVFrame according to its crop_left/crop_top/crop_right/ + * crop_bottom fields. If cropping is successful, the function will adjust the + * data pointers and the width/height fields, and set the crop fields to 0. + * + * In all cases, the cropping boundaries will be rounded to the inherent + * alignment of the pixel format. In some cases, such as for opaque hwaccel + * formats, the left/top cropping is ignored. The crop fields are set to 0 even + * if the cropping was rounded or ignored. + * + * @param frame the frame which should be cropped + * @param flags Some combination of AV_FRAME_CROP_* flags, or 0. + * + * @return >= 0 on success, a negative AVERROR on error. If the cropping fields + * were invalid, AVERROR(ERANGE) is returned, and nothing is changed. + */ +int av_frame_apply_cropping(AVFrame *frame, int flags); + +/** + * @return a string identifying the side data type + */ +const char *av_frame_side_data_name(enum AVFrameSideDataType type); + +/** + * @} + */ + +#endif /* AVUTIL_FRAME_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/hash.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/hash.h new file mode 100644 index 0000000..7693e6b --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/hash.h @@ -0,0 +1,269 @@ +/* + * Copyright (C) 2013 Reimar Döffinger + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * @ingroup lavu_hash_generic + * Generic hashing API + */ + +#ifndef AVUTIL_HASH_H +#define AVUTIL_HASH_H + +#include + +#include "version.h" + +/** + * @defgroup lavu_hash Hash Functions + * @ingroup lavu_crypto + * Hash functions useful in multimedia. + * + * Hash functions are widely used in multimedia, from error checking and + * concealment to internal regression testing. libavutil has efficient + * implementations of a variety of hash functions that may be useful for + * FFmpeg and other multimedia applications. + * + * @{ + * + * @defgroup lavu_hash_generic Generic Hashing API + * An abstraction layer for all hash functions supported by libavutil. + * + * If your application needs to support a wide range of different hash + * functions, then the Generic Hashing API is for you. It provides a generic, + * reusable API for @ref lavu_hash "all hash functions" implemented in libavutil. + * If you just need to use one particular hash function, use the @ref lavu_hash + * "individual hash" directly. + * + * @section Sample Code + * + * A basic template for using the Generic Hashing API follows: + * + * @code + * struct AVHashContext *ctx = NULL; + * const char *hash_name = NULL; + * uint8_t *output_buf = NULL; + * + * // Select from a string returned by av_hash_names() + * hash_name = ...; + * + * // Allocate a hash context + * ret = av_hash_alloc(&ctx, hash_name); + * if (ret < 0) + * return ret; + * + * // Initialize the hash context + * av_hash_init(ctx); + * + * // Update the hash context with data + * while (data_left) { + * av_hash_update(ctx, data, size); + * } + * + * // Now we have no more data, so it is time to finalize the hash and get the + * // output. But we need to first allocate an output buffer. Note that you can + * // use any memory allocation function, including malloc(), not just + * // av_malloc(). + * output_buf = av_malloc(av_hash_get_size(ctx)); + * if (!output_buf) + * return AVERROR(ENOMEM); + * + * // Finalize the hash context. + * // You can use any of the av_hash_final*() functions provided, for other + * // output formats. If you do so, be sure to adjust the memory allocation + * // above. See the function documentation below for the exact amount of extra + * // memory needed. + * av_hash_final(ctx, output_buffer); + * + * // Free the context + * av_hash_freep(&ctx); + * @endcode + * + * @section Hash Function-Specific Information + * If the CRC32 hash is selected, the #AV_CRC_32_IEEE polynomial will be + * used. + * + * If the Murmur3 hash is selected, the default seed will be used. See @ref + * lavu_murmur3_seedinfo "Murmur3" for more information. + * + * @{ + */ + +/** + * @example ffhash.c + * This example is a simple command line application that takes one or more + * arguments. It demonstrates a typical use of the hashing API with allocation, + * initialization, updating, and finalizing. + */ + +struct AVHashContext; + +/** + * Allocate a hash context for the algorithm specified by name. + * + * @return >= 0 for success, a negative error code for failure + * + * @note The context is not initialized after a call to this function; you must + * call av_hash_init() to do so. + */ +int av_hash_alloc(struct AVHashContext **ctx, const char *name); + +/** + * Get the names of available hash algorithms. + * + * This function can be used to enumerate the algorithms. + * + * @param[in] i Index of the hash algorithm, starting from 0 + * @return Pointer to a static string or `NULL` if `i` is out of range + */ +const char *av_hash_names(int i); + +/** + * Get the name of the algorithm corresponding to the given hash context. + */ +const char *av_hash_get_name(const struct AVHashContext *ctx); + +/** + * Maximum value that av_hash_get_size() will currently return. + * + * You can use this if you absolutely want or need to use static allocation for + * the output buffer and are fine with not supporting hashes newly added to + * libavutil without recompilation. + * + * @warning + * Adding new hashes with larger sizes, and increasing the macro while doing + * so, will not be considered an ABI change. To prevent your code from + * overflowing a buffer, either dynamically allocate the output buffer with + * av_hash_get_size(), or limit your use of the Hashing API to hashes that are + * already in FFmpeg during the time of compilation. + */ +#define AV_HASH_MAX_SIZE 64 + +/** + * Get the size of the resulting hash value in bytes. + * + * The maximum value this function will currently return is available as macro + * #AV_HASH_MAX_SIZE. + * + * @param[in] ctx Hash context + * @return Size of the hash value in bytes + */ +int av_hash_get_size(const struct AVHashContext *ctx); + +/** + * Initialize or reset a hash context. + * + * @param[in,out] ctx Hash context + */ +void av_hash_init(struct AVHashContext *ctx); + +/** + * Update a hash context with additional data. + * + * @param[in,out] ctx Hash context + * @param[in] src Data to be added to the hash context + * @param[in] len Size of the additional data + */ +#if FF_API_CRYPTO_SIZE_T +void av_hash_update(struct AVHashContext *ctx, const uint8_t *src, int len); +#else +void av_hash_update(struct AVHashContext *ctx, const uint8_t *src, size_t len); +#endif + +/** + * Finalize a hash context and compute the actual hash value. + * + * The minimum size of `dst` buffer is given by av_hash_get_size() or + * #AV_HASH_MAX_SIZE. The use of the latter macro is discouraged. + * + * It is not safe to update or finalize a hash context again, if it has already + * been finalized. + * + * @param[in,out] ctx Hash context + * @param[out] dst Where the final hash value will be stored + * + * @see av_hash_final_bin() provides an alternative API + */ +void av_hash_final(struct AVHashContext *ctx, uint8_t *dst); + +/** + * Finalize a hash context and store the actual hash value in a buffer. + * + * It is not safe to update or finalize a hash context again, if it has already + * been finalized. + * + * If `size` is smaller than the hash size (given by av_hash_get_size()), the + * hash is truncated; if size is larger, the buffer is padded with 0. + * + * @param[in,out] ctx Hash context + * @param[out] dst Where the final hash value will be stored + * @param[in] size Number of bytes to write to `dst` + */ +void av_hash_final_bin(struct AVHashContext *ctx, uint8_t *dst, int size); + +/** + * Finalize a hash context and store the hexadecimal representation of the + * actual hash value as a string. + * + * It is not safe to update or finalize a hash context again, if it has already + * been finalized. + * + * The string is always 0-terminated. + * + * If `size` is smaller than `2 * hash_size + 1`, where `hash_size` is the + * value returned by av_hash_get_size(), the string will be truncated. + * + * @param[in,out] ctx Hash context + * @param[out] dst Where the string will be stored + * @param[in] size Maximum number of bytes to write to `dst` + */ +void av_hash_final_hex(struct AVHashContext *ctx, uint8_t *dst, int size); + +/** + * Finalize a hash context and store the Base64 representation of the + * actual hash value as a string. + * + * It is not safe to update or finalize a hash context again, if it has already + * been finalized. + * + * The string is always 0-terminated. + * + * If `size` is smaller than AV_BASE64_SIZE(hash_size), where `hash_size` is + * the value returned by av_hash_get_size(), the string will be truncated. + * + * @param[in,out] ctx Hash context + * @param[out] dst Where the final hash value will be stored + * @param[in] size Maximum number of bytes to write to `dst` + */ +void av_hash_final_b64(struct AVHashContext *ctx, uint8_t *dst, int size); + +/** + * Free hash context and set hash context pointer to `NULL`. + * + * @param[in,out] ctx Pointer to hash context + */ +void av_hash_freep(struct AVHashContext **ctx); + +/** + * @} + * @} + */ + +#endif /* AVUTIL_HASH_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/hmac.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/hmac.h new file mode 100644 index 0000000..412e950 --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/hmac.h @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2012 Martin Storsjo + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_HMAC_H +#define AVUTIL_HMAC_H + +#include + +#include "version.h" +/** + * @defgroup lavu_hmac HMAC + * @ingroup lavu_crypto + * @{ + */ + +enum AVHMACType { + AV_HMAC_MD5, + AV_HMAC_SHA1, + AV_HMAC_SHA224, + AV_HMAC_SHA256, + AV_HMAC_SHA384, + AV_HMAC_SHA512, +}; + +typedef struct AVHMAC AVHMAC; + +/** + * Allocate an AVHMAC context. + * @param type The hash function used for the HMAC. + */ +AVHMAC *av_hmac_alloc(enum AVHMACType type); + +/** + * Free an AVHMAC context. + * @param ctx The context to free, may be NULL + */ +void av_hmac_free(AVHMAC *ctx); + +/** + * Initialize an AVHMAC context with an authentication key. + * @param ctx The HMAC context + * @param key The authentication key + * @param keylen The length of the key, in bytes + */ +void av_hmac_init(AVHMAC *ctx, const uint8_t *key, unsigned int keylen); + +/** + * Hash data with the HMAC. + * @param ctx The HMAC context + * @param data The data to hash + * @param len The length of the data, in bytes + */ +void av_hmac_update(AVHMAC *ctx, const uint8_t *data, unsigned int len); + +/** + * Finish hashing and output the HMAC digest. + * @param ctx The HMAC context + * @param out The output buffer to write the digest into + * @param outlen The length of the out buffer, in bytes + * @return The number of bytes written to out, or a negative error code. + */ +int av_hmac_final(AVHMAC *ctx, uint8_t *out, unsigned int outlen); + +/** + * Hash an array of data with a key. + * @param ctx The HMAC context + * @param data The data to hash + * @param len The length of the data, in bytes + * @param key The authentication key + * @param keylen The length of the key, in bytes + * @param out The output buffer to write the digest into + * @param outlen The length of the out buffer, in bytes + * @return The number of bytes written to out, or a negative error code. + */ +int av_hmac_calc(AVHMAC *ctx, const uint8_t *data, unsigned int len, + const uint8_t *key, unsigned int keylen, + uint8_t *out, unsigned int outlen); + +/** + * @} + */ + +#endif /* AVUTIL_HMAC_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/hwcontext.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/hwcontext.h new file mode 100644 index 0000000..f5a4b62 --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/hwcontext.h @@ -0,0 +1,584 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_HWCONTEXT_H +#define AVUTIL_HWCONTEXT_H + +#include "buffer.h" +#include "frame.h" +#include "log.h" +#include "pixfmt.h" + +enum AVHWDeviceType { + AV_HWDEVICE_TYPE_NONE, + AV_HWDEVICE_TYPE_VDPAU, + AV_HWDEVICE_TYPE_CUDA, + AV_HWDEVICE_TYPE_VAAPI, + AV_HWDEVICE_TYPE_DXVA2, + AV_HWDEVICE_TYPE_QSV, + AV_HWDEVICE_TYPE_VIDEOTOOLBOX, + AV_HWDEVICE_TYPE_D3D11VA, + AV_HWDEVICE_TYPE_DRM, + AV_HWDEVICE_TYPE_OPENCL, + AV_HWDEVICE_TYPE_MEDIACODEC, +}; + +typedef struct AVHWDeviceInternal AVHWDeviceInternal; + +/** + * This struct aggregates all the (hardware/vendor-specific) "high-level" state, + * i.e. state that is not tied to a concrete processing configuration. + * E.g., in an API that supports hardware-accelerated encoding and decoding, + * this struct will (if possible) wrap the state that is common to both encoding + * and decoding and from which specific instances of encoders or decoders can be + * derived. + * + * This struct is reference-counted with the AVBuffer mechanism. The + * av_hwdevice_ctx_alloc() constructor yields a reference, whose data field + * points to the actual AVHWDeviceContext. Further objects derived from + * AVHWDeviceContext (such as AVHWFramesContext, describing a frame pool with + * specific properties) will hold an internal reference to it. After all the + * references are released, the AVHWDeviceContext itself will be freed, + * optionally invoking a user-specified callback for uninitializing the hardware + * state. + */ +typedef struct AVHWDeviceContext { + /** + * A class for logging. Set by av_hwdevice_ctx_alloc(). + */ + const AVClass *av_class; + + /** + * Private data used internally by libavutil. Must not be accessed in any + * way by the caller. + */ + AVHWDeviceInternal *internal; + + /** + * This field identifies the underlying API used for hardware access. + * + * This field is set when this struct is allocated and never changed + * afterwards. + */ + enum AVHWDeviceType type; + + /** + * The format-specific data, allocated and freed by libavutil along with + * this context. + * + * Should be cast by the user to the format-specific context defined in the + * corresponding header (hwcontext_*.h) and filled as described in the + * documentation before calling av_hwdevice_ctx_init(). + * + * After calling av_hwdevice_ctx_init() this struct should not be modified + * by the caller. + */ + void *hwctx; + + /** + * This field may be set by the caller before calling av_hwdevice_ctx_init(). + * + * If non-NULL, this callback will be called when the last reference to + * this context is unreferenced, immediately before it is freed. + * + * @note when other objects (e.g an AVHWFramesContext) are derived from this + * struct, this callback will be invoked after all such child objects + * are fully uninitialized and their respective destructors invoked. + */ + void (*free)(struct AVHWDeviceContext *ctx); + + /** + * Arbitrary user data, to be used e.g. by the free() callback. + */ + void *user_opaque; +} AVHWDeviceContext; + +typedef struct AVHWFramesInternal AVHWFramesInternal; + +/** + * This struct describes a set or pool of "hardware" frames (i.e. those with + * data not located in normal system memory). All the frames in the pool are + * assumed to be allocated in the same way and interchangeable. + * + * This struct is reference-counted with the AVBuffer mechanism and tied to a + * given AVHWDeviceContext instance. The av_hwframe_ctx_alloc() constructor + * yields a reference, whose data field points to the actual AVHWFramesContext + * struct. + */ +typedef struct AVHWFramesContext { + /** + * A class for logging. + */ + const AVClass *av_class; + + /** + * Private data used internally by libavutil. Must not be accessed in any + * way by the caller. + */ + AVHWFramesInternal *internal; + + /** + * A reference to the parent AVHWDeviceContext. This reference is owned and + * managed by the enclosing AVHWFramesContext, but the caller may derive + * additional references from it. + */ + AVBufferRef *device_ref; + + /** + * The parent AVHWDeviceContext. This is simply a pointer to + * device_ref->data provided for convenience. + * + * Set by libavutil in av_hwframe_ctx_init(). + */ + AVHWDeviceContext *device_ctx; + + /** + * The format-specific data, allocated and freed automatically along with + * this context. + * + * Should be cast by the user to the format-specific context defined in the + * corresponding header (hwframe_*.h) and filled as described in the + * documentation before calling av_hwframe_ctx_init(). + * + * After any frames using this context are created, the contents of this + * struct should not be modified by the caller. + */ + void *hwctx; + + /** + * This field may be set by the caller before calling av_hwframe_ctx_init(). + * + * If non-NULL, this callback will be called when the last reference to + * this context is unreferenced, immediately before it is freed. + */ + void (*free)(struct AVHWFramesContext *ctx); + + /** + * Arbitrary user data, to be used e.g. by the free() callback. + */ + void *user_opaque; + + /** + * A pool from which the frames are allocated by av_hwframe_get_buffer(). + * This field may be set by the caller before calling av_hwframe_ctx_init(). + * The buffers returned by calling av_buffer_pool_get() on this pool must + * have the properties described in the documentation in the corresponding hw + * type's header (hwcontext_*.h). The pool will be freed strictly before + * this struct's free() callback is invoked. + * + * This field may be NULL, then libavutil will attempt to allocate a pool + * internally. Note that certain device types enforce pools allocated at + * fixed size (frame count), which cannot be extended dynamically. In such a + * case, initial_pool_size must be set appropriately. + */ + AVBufferPool *pool; + + /** + * Initial size of the frame pool. If a device type does not support + * dynamically resizing the pool, then this is also the maximum pool size. + * + * May be set by the caller before calling av_hwframe_ctx_init(). Must be + * set if pool is NULL and the device type does not support dynamic pools. + */ + int initial_pool_size; + + /** + * The pixel format identifying the underlying HW surface type. + * + * Must be a hwaccel format, i.e. the corresponding descriptor must have the + * AV_PIX_FMT_FLAG_HWACCEL flag set. + * + * Must be set by the user before calling av_hwframe_ctx_init(). + */ + enum AVPixelFormat format; + + /** + * The pixel format identifying the actual data layout of the hardware + * frames. + * + * Must be set by the caller before calling av_hwframe_ctx_init(). + * + * @note when the underlying API does not provide the exact data layout, but + * only the colorspace/bit depth, this field should be set to the fully + * planar version of that format (e.g. for 8-bit 420 YUV it should be + * AV_PIX_FMT_YUV420P, not AV_PIX_FMT_NV12 or anything else). + */ + enum AVPixelFormat sw_format; + + /** + * The allocated dimensions of the frames in this pool. + * + * Must be set by the user before calling av_hwframe_ctx_init(). + */ + int width, height; +} AVHWFramesContext; + +/** + * Look up an AVHWDeviceType by name. + * + * @param name String name of the device type (case-insensitive). + * @return The type from enum AVHWDeviceType, or AV_HWDEVICE_TYPE_NONE if + * not found. + */ +enum AVHWDeviceType av_hwdevice_find_type_by_name(const char *name); + +/** Get the string name of an AVHWDeviceType. + * + * @param type Type from enum AVHWDeviceType. + * @return Pointer to a static string containing the name, or NULL if the type + * is not valid. + */ +const char *av_hwdevice_get_type_name(enum AVHWDeviceType type); + +/** + * Iterate over supported device types. + * + * @param type AV_HWDEVICE_TYPE_NONE initially, then the previous type + * returned by this function in subsequent iterations. + * @return The next usable device type from enum AVHWDeviceType, or + * AV_HWDEVICE_TYPE_NONE if there are no more. + */ +enum AVHWDeviceType av_hwdevice_iterate_types(enum AVHWDeviceType prev); + +/** + * Allocate an AVHWDeviceContext for a given hardware type. + * + * @param type the type of the hardware device to allocate. + * @return a reference to the newly created AVHWDeviceContext on success or NULL + * on failure. + */ +AVBufferRef *av_hwdevice_ctx_alloc(enum AVHWDeviceType type); + +/** + * Finalize the device context before use. This function must be called after + * the context is filled with all the required information and before it is + * used in any way. + * + * @param ref a reference to the AVHWDeviceContext + * @return 0 on success, a negative AVERROR code on failure + */ +int av_hwdevice_ctx_init(AVBufferRef *ref); + +/** + * Open a device of the specified type and create an AVHWDeviceContext for it. + * + * This is a convenience function intended to cover the simple cases. Callers + * who need to fine-tune device creation/management should open the device + * manually and then wrap it in an AVHWDeviceContext using + * av_hwdevice_ctx_alloc()/av_hwdevice_ctx_init(). + * + * The returned context is already initialized and ready for use, the caller + * should not call av_hwdevice_ctx_init() on it. The user_opaque/free fields of + * the created AVHWDeviceContext are set by this function and should not be + * touched by the caller. + * + * @param device_ctx On success, a reference to the newly-created device context + * will be written here. The reference is owned by the caller + * and must be released with av_buffer_unref() when no longer + * needed. On failure, NULL will be written to this pointer. + * @param type The type of the device to create. + * @param device A type-specific string identifying the device to open. + * @param opts A dictionary of additional (type-specific) options to use in + * opening the device. The dictionary remains owned by the caller. + * @param flags currently unused + * + * @return 0 on success, a negative AVERROR code on failure. + */ +int av_hwdevice_ctx_create(AVBufferRef **device_ctx, enum AVHWDeviceType type, + const char *device, AVDictionary *opts, int flags); + +/** + * Create a new device of the specified type from an existing device. + * + * If the source device is a device of the target type or was originally + * derived from such a device (possibly through one or more intermediate + * devices of other types), then this will return a reference to the + * existing device of the same type as is requested. + * + * Otherwise, it will attempt to derive a new device from the given source + * device. If direct derivation to the new type is not implemented, it will + * attempt the same derivation from each ancestor of the source device in + * turn looking for an implemented derivation method. + * + * @param dst_ctx On success, a reference to the newly-created + * AVHWDeviceContext. + * @param type The type of the new device to create. + * @param src_ctx A reference to an existing AVHWDeviceContext which will be + * used to create the new device. + * @param flags Currently unused; should be set to zero. + * @return Zero on success, a negative AVERROR code on failure. + */ +int av_hwdevice_ctx_create_derived(AVBufferRef **dst_ctx, + enum AVHWDeviceType type, + AVBufferRef *src_ctx, int flags); + + +/** + * Allocate an AVHWFramesContext tied to a given device context. + * + * @param device_ctx a reference to a AVHWDeviceContext. This function will make + * a new reference for internal use, the one passed to the + * function remains owned by the caller. + * @return a reference to the newly created AVHWFramesContext on success or NULL + * on failure. + */ +AVBufferRef *av_hwframe_ctx_alloc(AVBufferRef *device_ctx); + +/** + * Finalize the context before use. This function must be called after the + * context is filled with all the required information and before it is attached + * to any frames. + * + * @param ref a reference to the AVHWFramesContext + * @return 0 on success, a negative AVERROR code on failure + */ +int av_hwframe_ctx_init(AVBufferRef *ref); + +/** + * Allocate a new frame attached to the given AVHWFramesContext. + * + * @param hwframe_ctx a reference to an AVHWFramesContext + * @param frame an empty (freshly allocated or unreffed) frame to be filled with + * newly allocated buffers. + * @param flags currently unused, should be set to zero + * @return 0 on success, a negative AVERROR code on failure + */ +int av_hwframe_get_buffer(AVBufferRef *hwframe_ctx, AVFrame *frame, int flags); + +/** + * Copy data to or from a hw surface. At least one of dst/src must have an + * AVHWFramesContext attached. + * + * If src has an AVHWFramesContext attached, then the format of dst (if set) + * must use one of the formats returned by av_hwframe_transfer_get_formats(src, + * AV_HWFRAME_TRANSFER_DIRECTION_FROM). + * If dst has an AVHWFramesContext attached, then the format of src must use one + * of the formats returned by av_hwframe_transfer_get_formats(dst, + * AV_HWFRAME_TRANSFER_DIRECTION_TO) + * + * dst may be "clean" (i.e. with data/buf pointers unset), in which case the + * data buffers will be allocated by this function using av_frame_get_buffer(). + * If dst->format is set, then this format will be used, otherwise (when + * dst->format is AV_PIX_FMT_NONE) the first acceptable format will be chosen. + * + * The two frames must have matching allocated dimensions (i.e. equal to + * AVHWFramesContext.width/height), since not all device types support + * transferring a sub-rectangle of the whole surface. The display dimensions + * (i.e. AVFrame.width/height) may be smaller than the allocated dimensions, but + * also have to be equal for both frames. When the display dimensions are + * smaller than the allocated dimensions, the content of the padding in the + * destination frame is unspecified. + * + * @param dst the destination frame. dst is not touched on failure. + * @param src the source frame. + * @param flags currently unused, should be set to zero + * @return 0 on success, a negative AVERROR error code on failure. + */ +int av_hwframe_transfer_data(AVFrame *dst, const AVFrame *src, int flags); + +enum AVHWFrameTransferDirection { + /** + * Transfer the data from the queried hw frame. + */ + AV_HWFRAME_TRANSFER_DIRECTION_FROM, + + /** + * Transfer the data to the queried hw frame. + */ + AV_HWFRAME_TRANSFER_DIRECTION_TO, +}; + +/** + * Get a list of possible source or target formats usable in + * av_hwframe_transfer_data(). + * + * @param hwframe_ctx the frame context to obtain the information for + * @param dir the direction of the transfer + * @param formats the pointer to the output format list will be written here. + * The list is terminated with AV_PIX_FMT_NONE and must be freed + * by the caller when no longer needed using av_free(). + * If this function returns successfully, the format list will + * have at least one item (not counting the terminator). + * On failure, the contents of this pointer are unspecified. + * @param flags currently unused, should be set to zero + * @return 0 on success, a negative AVERROR code on failure. + */ +int av_hwframe_transfer_get_formats(AVBufferRef *hwframe_ctx, + enum AVHWFrameTransferDirection dir, + enum AVPixelFormat **formats, int flags); + + +/** + * This struct describes the constraints on hardware frames attached to + * a given device with a hardware-specific configuration. This is returned + * by av_hwdevice_get_hwframe_constraints() and must be freed by + * av_hwframe_constraints_free() after use. + */ +typedef struct AVHWFramesConstraints { + /** + * A list of possible values for format in the hw_frames_ctx, + * terminated by AV_PIX_FMT_NONE. This member will always be filled. + */ + enum AVPixelFormat *valid_hw_formats; + + /** + * A list of possible values for sw_format in the hw_frames_ctx, + * terminated by AV_PIX_FMT_NONE. Can be NULL if this information is + * not known. + */ + enum AVPixelFormat *valid_sw_formats; + + /** + * The minimum size of frames in this hw_frames_ctx. + * (Zero if not known.) + */ + int min_width; + int min_height; + + /** + * The maximum size of frames in this hw_frames_ctx. + * (INT_MAX if not known / no limit.) + */ + int max_width; + int max_height; +} AVHWFramesConstraints; + +/** + * Allocate a HW-specific configuration structure for a given HW device. + * After use, the user must free all members as required by the specific + * hardware structure being used, then free the structure itself with + * av_free(). + * + * @param device_ctx a reference to the associated AVHWDeviceContext. + * @return The newly created HW-specific configuration structure on + * success or NULL on failure. + */ +void *av_hwdevice_hwconfig_alloc(AVBufferRef *device_ctx); + +/** + * Get the constraints on HW frames given a device and the HW-specific + * configuration to be used with that device. If no HW-specific + * configuration is provided, returns the maximum possible capabilities + * of the device. + * + * @param ref a reference to the associated AVHWDeviceContext. + * @param hwconfig a filled HW-specific configuration structure, or NULL + * to return the maximum possible capabilities of the device. + * @return AVHWFramesConstraints structure describing the constraints + * on the device, or NULL if not available. + */ +AVHWFramesConstraints *av_hwdevice_get_hwframe_constraints(AVBufferRef *ref, + const void *hwconfig); + +/** + * Free an AVHWFrameConstraints structure. + * + * @param constraints The (filled or unfilled) AVHWFrameConstraints structure. + */ +void av_hwframe_constraints_free(AVHWFramesConstraints **constraints); + + +/** + * Flags to apply to frame mappings. + */ +enum { + /** + * The mapping must be readable. + */ + AV_HWFRAME_MAP_READ = 1 << 0, + /** + * The mapping must be writeable. + */ + AV_HWFRAME_MAP_WRITE = 1 << 1, + /** + * The mapped frame will be overwritten completely in subsequent + * operations, so the current frame data need not be loaded. Any values + * which are not overwritten are unspecified. + */ + AV_HWFRAME_MAP_OVERWRITE = 1 << 2, + /** + * The mapping must be direct. That is, there must not be any copying in + * the map or unmap steps. Note that performance of direct mappings may + * be much lower than normal memory. + */ + AV_HWFRAME_MAP_DIRECT = 1 << 3, +}; + +/** + * Map a hardware frame. + * + * This has a number of different possible effects, depending on the format + * and origin of the src and dst frames. On input, src should be a usable + * frame with valid buffers and dst should be blank (typically as just created + * by av_frame_alloc()). src should have an associated hwframe context, and + * dst may optionally have a format and associated hwframe context. + * + * If src was created by mapping a frame from the hwframe context of dst, + * then this function undoes the mapping - dst is replaced by a reference to + * the frame that src was originally mapped from. + * + * If both src and dst have an associated hwframe context, then this function + * attempts to map the src frame from its hardware context to that of dst and + * then fill dst with appropriate data to be usable there. This will only be + * possible if the hwframe contexts and associated devices are compatible - + * given compatible devices, av_hwframe_ctx_create_derived() can be used to + * create a hwframe context for dst in which mapping should be possible. + * + * If src has a hwframe context but dst does not, then the src frame is + * mapped to normal memory and should thereafter be usable as a normal frame. + * If the format is set on dst, then the mapping will attempt to create dst + * with that format and fail if it is not possible. If format is unset (is + * AV_PIX_FMT_NONE) then dst will be mapped with whatever the most appropriate + * format to use is (probably the sw_format of the src hwframe context). + * + * A return value of AVERROR(ENOSYS) indicates that the mapping is not + * possible with the given arguments and hwframe setup, while other return + * values indicate that it failed somehow. + * + * @param dst Destination frame, to contain the mapping. + * @param src Source frame, to be mapped. + * @param flags Some combination of AV_HWFRAME_MAP_* flags. + * @return Zero on success, negative AVERROR code on failure. + */ +int av_hwframe_map(AVFrame *dst, const AVFrame *src, int flags); + + +/** + * Create and initialise an AVHWFramesContext as a mapping of another existing + * AVHWFramesContext on a different device. + * + * av_hwframe_ctx_init() should not be called after this. + * + * @param derived_frame_ctx On success, a reference to the newly created + * AVHWFramesContext. + * @param derived_device_ctx A reference to the device to create the new + * AVHWFramesContext on. + * @param source_frame_ctx A reference to an existing AVHWFramesContext + * which will be mapped to the derived context. + * @param flags Some combination of AV_HWFRAME_MAP_* flags, defining the + * mapping parameters to apply to frames which are allocated + * in the derived device. + * @return Zero on success, negative AVERROR code on failure. + */ +int av_hwframe_ctx_create_derived(AVBufferRef **derived_frame_ctx, + enum AVPixelFormat format, + AVBufferRef *derived_device_ctx, + AVBufferRef *source_frame_ctx, + int flags); + +#endif /* AVUTIL_HWCONTEXT_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/hwcontext_cuda.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/hwcontext_cuda.h new file mode 100644 index 0000000..12dae84 --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/hwcontext_cuda.h @@ -0,0 +1,51 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#ifndef AVUTIL_HWCONTEXT_CUDA_H +#define AVUTIL_HWCONTEXT_CUDA_H + +#ifndef CUDA_VERSION +#include +#endif + +#include "pixfmt.h" + +/** + * @file + * An API-specific header for AV_HWDEVICE_TYPE_CUDA. + * + * This API supports dynamic frame pools. AVHWFramesContext.pool must return + * AVBufferRefs whose data pointer is a CUdeviceptr. + */ + +typedef struct AVCUDADeviceContextInternal AVCUDADeviceContextInternal; + +/** + * This struct is allocated as AVHWDeviceContext.hwctx + */ +typedef struct AVCUDADeviceContext { + CUcontext cuda_ctx; + AVCUDADeviceContextInternal *internal; +} AVCUDADeviceContext; + +/** + * AVHWFramesContext.hwctx is currently not used + */ + +#endif /* AVUTIL_HWCONTEXT_CUDA_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/hwcontext_d3d11va.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/hwcontext_d3d11va.h new file mode 100644 index 0000000..9f91e9b --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/hwcontext_d3d11va.h @@ -0,0 +1,169 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_HWCONTEXT_D3D11VA_H +#define AVUTIL_HWCONTEXT_D3D11VA_H + +/** + * @file + * An API-specific header for AV_HWDEVICE_TYPE_D3D11VA. + * + * The default pool implementation will be fixed-size if initial_pool_size is + * set (and allocate elements from an array texture). Otherwise it will allocate + * individual textures. Be aware that decoding requires a single array texture. + * + * Using sw_format==AV_PIX_FMT_YUV420P has special semantics, and maps to + * DXGI_FORMAT_420_OPAQUE. av_hwframe_transfer_data() is not supported for + * this format. Refer to MSDN for details. + * + * av_hwdevice_ctx_create() for this device type supports a key named "debug" + * for the AVDictionary entry. If this is set to any value, the device creation + * code will try to load various supported D3D debugging layers. + */ + +#include +#include + +/** + * This struct is allocated as AVHWDeviceContext.hwctx + */ +typedef struct AVD3D11VADeviceContext { + /** + * Device used for texture creation and access. This can also be used to + * set the libavcodec decoding device. + * + * Must be set by the user. This is the only mandatory field - the other + * device context fields are set from this and are available for convenience. + * + * Deallocating the AVHWDeviceContext will always release this interface, + * and it does not matter whether it was user-allocated. + */ + ID3D11Device *device; + + /** + * If unset, this will be set from the device field on init. + * + * Deallocating the AVHWDeviceContext will always release this interface, + * and it does not matter whether it was user-allocated. + */ + ID3D11DeviceContext *device_context; + + /** + * If unset, this will be set from the device field on init. + * + * Deallocating the AVHWDeviceContext will always release this interface, + * and it does not matter whether it was user-allocated. + */ + ID3D11VideoDevice *video_device; + + /** + * If unset, this will be set from the device_context field on init. + * + * Deallocating the AVHWDeviceContext will always release this interface, + * and it does not matter whether it was user-allocated. + */ + ID3D11VideoContext *video_context; + + /** + * Callbacks for locking. They protect accesses to device_context and + * video_context calls. They also protect access to the internal staging + * texture (for av_hwframe_transfer_data() calls). They do NOT protect + * access to hwcontext or decoder state in general. + * + * If unset on init, the hwcontext implementation will set them to use an + * internal mutex. + * + * The underlying lock must be recursive. lock_ctx is for free use by the + * locking implementation. + */ + void (*lock)(void *lock_ctx); + void (*unlock)(void *lock_ctx); + void *lock_ctx; +} AVD3D11VADeviceContext; + +/** + * D3D11 frame descriptor for pool allocation. + * + * In user-allocated pools, AVHWFramesContext.pool must return AVBufferRefs + * with the data pointer pointing at an object of this type describing the + * planes of the frame. + * + * This has no use outside of custom allocation, and AVFrame AVBufferRef do not + * necessarily point to an instance of this struct. + */ +typedef struct AVD3D11FrameDescriptor { + /** + * The texture in which the frame is located. The reference count is + * managed by the AVBufferRef, and destroying the reference will release + * the interface. + * + * Normally stored in AVFrame.data[0]. + */ + ID3D11Texture2D *texture; + + /** + * The index into the array texture element representing the frame, or 0 + * if the texture is not an array texture. + * + * Normally stored in AVFrame.data[1] (cast from intptr_t). + */ + intptr_t index; +} AVD3D11FrameDescriptor; + +/** + * This struct is allocated as AVHWFramesContext.hwctx + */ +typedef struct AVD3D11VAFramesContext { + /** + * The canonical texture used for pool allocation. If this is set to NULL + * on init, the hwframes implementation will allocate and set an array + * texture if initial_pool_size > 0. + * + * The only situation when the API user should set this is: + * - the user wants to do manual pool allocation (setting + * AVHWFramesContext.pool), instead of letting AVHWFramesContext + * allocate the pool + * - of an array texture + * - and wants it to use it for decoding + * - this has to be done before calling av_hwframe_ctx_init() + * + * Deallocating the AVHWFramesContext will always release this interface, + * and it does not matter whether it was user-allocated. + * + * This is in particular used by the libavcodec D3D11VA hwaccel, which + * requires a single array texture. It will create ID3D11VideoDecoderOutputView + * objects for each array texture element on decoder initialization. + */ + ID3D11Texture2D *texture; + + /** + * D3D11_TEXTURE2D_DESC.BindFlags used for texture creation. The user must + * at least set D3D11_BIND_DECODER if the frames context is to be used for + * video decoding. + * This field is ignored/invalid if a user-allocated texture is provided. + */ + UINT BindFlags; + + /** + * D3D11_TEXTURE2D_DESC.MiscFlags used for texture creation. + * This field is ignored/invalid if a user-allocated texture is provided. + */ + UINT MiscFlags; +} AVD3D11VAFramesContext; + +#endif /* AVUTIL_HWCONTEXT_D3D11VA_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/hwcontext_drm.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/hwcontext_drm.h new file mode 100644 index 0000000..42709f2 --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/hwcontext_drm.h @@ -0,0 +1,169 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_HWCONTEXT_DRM_H +#define AVUTIL_HWCONTEXT_DRM_H + +#include +#include + +/** + * @file + * API-specific header for AV_HWDEVICE_TYPE_DRM. + * + * Internal frame allocation is not currently supported - all frames + * must be allocated by the user. Thus AVHWFramesContext is always + * NULL, though this may change if support for frame allocation is + * added in future. + */ + +enum { + /** + * The maximum number of layers/planes in a DRM frame. + */ + AV_DRM_MAX_PLANES = 4 +}; + +/** + * DRM object descriptor. + * + * Describes a single DRM object, addressing it as a PRIME file + * descriptor. + */ +typedef struct AVDRMObjectDescriptor { + /** + * DRM PRIME fd for the object. + */ + int fd; + /** + * Total size of the object. + * + * (This includes any parts not which do not contain image data.) + */ + size_t size; + /** + * Format modifier applied to the object (DRM_FORMAT_MOD_*). + * + * If the format modifier is unknown then this should be set to + * DRM_FORMAT_MOD_INVALID. + */ + uint64_t format_modifier; +} AVDRMObjectDescriptor; + +/** + * DRM plane descriptor. + * + * Describes a single plane of a layer, which is contained within + * a single object. + */ +typedef struct AVDRMPlaneDescriptor { + /** + * Index of the object containing this plane in the objects + * array of the enclosing frame descriptor. + */ + int object_index; + /** + * Offset within that object of this plane. + */ + ptrdiff_t offset; + /** + * Pitch (linesize) of this plane. + */ + ptrdiff_t pitch; +} AVDRMPlaneDescriptor; + +/** + * DRM layer descriptor. + * + * Describes a single layer within a frame. This has the structure + * defined by its format, and will contain one or more planes. + */ +typedef struct AVDRMLayerDescriptor { + /** + * Format of the layer (DRM_FORMAT_*). + */ + uint32_t format; + /** + * Number of planes in the layer. + * + * This must match the number of planes required by format. + */ + int nb_planes; + /** + * Array of planes in this layer. + */ + AVDRMPlaneDescriptor planes[AV_DRM_MAX_PLANES]; +} AVDRMLayerDescriptor; + +/** + * DRM frame descriptor. + * + * This is used as the data pointer for AV_PIX_FMT_DRM_PRIME frames. + * It is also used by user-allocated frame pools - allocating in + * AVHWFramesContext.pool must return AVBufferRefs which contain + * an object of this type. + * + * The fields of this structure should be set such it can be + * imported directly by EGL using the EGL_EXT_image_dma_buf_import + * and EGL_EXT_image_dma_buf_import_modifiers extensions. + * (Note that the exact layout of a particular format may vary between + * platforms - we only specify that the same platform should be able + * to import it.) + * + * The total number of planes must not exceed AV_DRM_MAX_PLANES, and + * the order of the planes by increasing layer index followed by + * increasing plane index must be the same as the order which would + * be used for the data pointers in the equivalent software format. + */ +typedef struct AVDRMFrameDescriptor { + /** + * Number of DRM objects making up this frame. + */ + int nb_objects; + /** + * Array of objects making up the frame. + */ + AVDRMObjectDescriptor objects[AV_DRM_MAX_PLANES]; + /** + * Number of layers in the frame. + */ + int nb_layers; + /** + * Array of layers in the frame. + */ + AVDRMLayerDescriptor layers[AV_DRM_MAX_PLANES]; +} AVDRMFrameDescriptor; + +/** + * DRM device. + * + * Allocated as AVHWDeviceContext.hwctx. + */ +typedef struct AVDRMDeviceContext { + /** + * File descriptor of DRM device. + * + * This is used as the device to create frames on, and may also be + * used in some derivation and mapping operations. + * + * If no device is required, set to -1. + */ + int fd; +} AVDRMDeviceContext; + +#endif /* AVUTIL_HWCONTEXT_DRM_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/hwcontext_dxva2.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/hwcontext_dxva2.h new file mode 100644 index 0000000..e1b79bc --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/hwcontext_dxva2.h @@ -0,0 +1,75 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#ifndef AVUTIL_HWCONTEXT_DXVA2_H +#define AVUTIL_HWCONTEXT_DXVA2_H + +/** + * @file + * An API-specific header for AV_HWDEVICE_TYPE_DXVA2. + * + * Only fixed-size pools are supported. + * + * For user-allocated pools, AVHWFramesContext.pool must return AVBufferRefs + * with the data pointer set to a pointer to IDirect3DSurface9. + */ + +#include +#include + +/** + * This struct is allocated as AVHWDeviceContext.hwctx + */ +typedef struct AVDXVA2DeviceContext { + IDirect3DDeviceManager9 *devmgr; +} AVDXVA2DeviceContext; + +/** + * This struct is allocated as AVHWFramesContext.hwctx + */ +typedef struct AVDXVA2FramesContext { + /** + * The surface type (e.g. DXVA2_VideoProcessorRenderTarget or + * DXVA2_VideoDecoderRenderTarget). Must be set by the caller. + */ + DWORD surface_type; + + /** + * The surface pool. When an external pool is not provided by the caller, + * this will be managed (allocated and filled on init, freed on uninit) by + * libavutil. + */ + IDirect3DSurface9 **surfaces; + int nb_surfaces; + + /** + * Certain drivers require the decoder to be destroyed before the surfaces. + * To allow internally managed pools to work properly in such cases, this + * field is provided. + * + * If it is non-NULL, libavutil will call IDirectXVideoDecoder_Release() on + * it just before the internal surface pool is freed. + * + * This is for convenience only. Some code uses other methods to manage the + * decoder reference. + */ + IDirectXVideoDecoder *decoder_to_release; +} AVDXVA2FramesContext; + +#endif /* AVUTIL_HWCONTEXT_DXVA2_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/hwcontext_mediacodec.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/hwcontext_mediacodec.h new file mode 100644 index 0000000..101a980 --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/hwcontext_mediacodec.h @@ -0,0 +1,36 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_HWCONTEXT_MEDIACODEC_H +#define AVUTIL_HWCONTEXT_MEDIACODEC_H + +/** + * MediaCodec details. + * + * Allocated as AVHWDeviceContext.hwctx + */ +typedef struct AVMediaCodecDeviceContext { + /** + * android/view/Surface handle, to be filled by the user. + * + * This is the default surface used by decoders on this device. + */ + void *surface; +} AVMediaCodecDeviceContext; + +#endif /* AVUTIL_HWCONTEXT_MEDIACODEC_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/hwcontext_qsv.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/hwcontext_qsv.h new file mode 100644 index 0000000..b98d611 --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/hwcontext_qsv.h @@ -0,0 +1,53 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_HWCONTEXT_QSV_H +#define AVUTIL_HWCONTEXT_QSV_H + +#include + +/** + * @file + * An API-specific header for AV_HWDEVICE_TYPE_QSV. + * + * This API does not support dynamic frame pools. AVHWFramesContext.pool must + * contain AVBufferRefs whose data pointer points to an mfxFrameSurface1 struct. + */ + +/** + * This struct is allocated as AVHWDeviceContext.hwctx + */ +typedef struct AVQSVDeviceContext { + mfxSession session; +} AVQSVDeviceContext; + +/** + * This struct is allocated as AVHWFramesContext.hwctx + */ +typedef struct AVQSVFramesContext { + mfxFrameSurface1 *surfaces; + int nb_surfaces; + + /** + * A combination of MFX_MEMTYPE_* describing the frame pool. + */ + int frame_type; +} AVQSVFramesContext; + +#endif /* AVUTIL_HWCONTEXT_QSV_H */ + diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/hwcontext_vaapi.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/hwcontext_vaapi.h new file mode 100644 index 0000000..0b2e071 --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/hwcontext_vaapi.h @@ -0,0 +1,117 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_HWCONTEXT_VAAPI_H +#define AVUTIL_HWCONTEXT_VAAPI_H + +#include + +/** + * @file + * API-specific header for AV_HWDEVICE_TYPE_VAAPI. + * + * Dynamic frame pools are supported, but note that any pool used as a render + * target is required to be of fixed size in order to be be usable as an + * argument to vaCreateContext(). + * + * For user-allocated pools, AVHWFramesContext.pool must return AVBufferRefs + * with the data pointer set to a VASurfaceID. + */ + +enum { + /** + * The quirks field has been set by the user and should not be detected + * automatically by av_hwdevice_ctx_init(). + */ + AV_VAAPI_DRIVER_QUIRK_USER_SET = (1 << 0), + /** + * The driver does not destroy parameter buffers when they are used by + * vaRenderPicture(). Additional code will be required to destroy them + * separately afterwards. + */ + AV_VAAPI_DRIVER_QUIRK_RENDER_PARAM_BUFFERS = (1 << 1), + + /** + * The driver does not support the VASurfaceAttribMemoryType attribute, + * so the surface allocation code will not try to use it. + */ + AV_VAAPI_DRIVER_QUIRK_ATTRIB_MEMTYPE = (1 << 2), + + /** + * The driver does not support surface attributes at all. + * The surface allocation code will never pass them to surface allocation, + * and the results of the vaQuerySurfaceAttributes() call will be faked. + */ + AV_VAAPI_DRIVER_QUIRK_SURFACE_ATTRIBUTES = (1 << 3), +}; + +/** + * VAAPI connection details. + * + * Allocated as AVHWDeviceContext.hwctx + */ +typedef struct AVVAAPIDeviceContext { + /** + * The VADisplay handle, to be filled by the user. + */ + VADisplay display; + /** + * Driver quirks to apply - this is filled by av_hwdevice_ctx_init(), + * with reference to a table of known drivers, unless the + * AV_VAAPI_DRIVER_QUIRK_USER_SET bit is already present. The user + * may need to refer to this field when performing any later + * operations using VAAPI with the same VADisplay. + */ + unsigned int driver_quirks; +} AVVAAPIDeviceContext; + +/** + * VAAPI-specific data associated with a frame pool. + * + * Allocated as AVHWFramesContext.hwctx. + */ +typedef struct AVVAAPIFramesContext { + /** + * Set by the user to apply surface attributes to all surfaces in + * the frame pool. If null, default settings are used. + */ + VASurfaceAttrib *attributes; + int nb_attributes; + /** + * The surfaces IDs of all surfaces in the pool after creation. + * Only valid if AVHWFramesContext.initial_pool_size was positive. + * These are intended to be used as the render_targets arguments to + * vaCreateContext(). + */ + VASurfaceID *surface_ids; + int nb_surfaces; +} AVVAAPIFramesContext; + +/** + * VAAPI hardware pipeline configuration details. + * + * Allocated with av_hwdevice_hwconfig_alloc(). + */ +typedef struct AVVAAPIHWConfig { + /** + * ID of a VAAPI pipeline configuration. + */ + VAConfigID config_id; +} AVVAAPIHWConfig; + +#endif /* AVUTIL_HWCONTEXT_VAAPI_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/hwcontext_vdpau.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/hwcontext_vdpau.h new file mode 100644 index 0000000..1b7ea1e --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/hwcontext_vdpau.h @@ -0,0 +1,44 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_HWCONTEXT_VDPAU_H +#define AVUTIL_HWCONTEXT_VDPAU_H + +#include + +/** + * @file + * An API-specific header for AV_HWDEVICE_TYPE_VDPAU. + * + * This API supports dynamic frame pools. AVHWFramesContext.pool must return + * AVBufferRefs whose data pointer is a VdpVideoSurface. + */ + +/** + * This struct is allocated as AVHWDeviceContext.hwctx + */ +typedef struct AVVDPAUDeviceContext { + VdpDevice device; + VdpGetProcAddress *get_proc_address; +} AVVDPAUDeviceContext; + +/** + * AVHWFramesContext.hwctx is currently not used + */ + +#endif /* AVUTIL_HWCONTEXT_VDPAU_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/hwcontext_videotoolbox.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/hwcontext_videotoolbox.h new file mode 100644 index 0000000..380918d --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/hwcontext_videotoolbox.h @@ -0,0 +1,54 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_HWCONTEXT_VIDEOTOOLBOX_H +#define AVUTIL_HWCONTEXT_VIDEOTOOLBOX_H + +#include + +#include + +#include "pixfmt.h" + +/** + * @file + * An API-specific header for AV_HWDEVICE_TYPE_VIDEOTOOLBOX. + * + * This API currently does not support frame allocation, as the raw VideoToolbox + * API does allocation, and FFmpeg itself never has the need to allocate frames. + * + * If the API user sets a custom pool, AVHWFramesContext.pool must return + * AVBufferRefs whose data pointer is a CVImageBufferRef or CVPixelBufferRef. + * + * Currently AVHWDeviceContext.hwctx and AVHWFramesContext.hwctx are always + * NULL. + */ + +/** + * Convert a VideoToolbox (actually CoreVideo) format to AVPixelFormat. + * Returns AV_PIX_FMT_NONE if no known equivalent was found. + */ +enum AVPixelFormat av_map_videotoolbox_format_to_pixfmt(uint32_t cv_fmt); + +/** + * Convert an AVPixelFormat to a VideoToolbox (actually CoreVideo) format. + * Returns 0 if no known equivalent was found. + */ +uint32_t av_map_videotoolbox_format_from_pixfmt(enum AVPixelFormat pix_fmt); + +#endif /* AVUTIL_HWCONTEXT_VIDEOTOOLBOX_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/imgutils.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/imgutils.h new file mode 100644 index 0000000..5b790ec --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/imgutils.h @@ -0,0 +1,277 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_IMGUTILS_H +#define AVUTIL_IMGUTILS_H + +/** + * @file + * misc image utilities + * + * @addtogroup lavu_picture + * @{ + */ + +#include "avutil.h" +#include "pixdesc.h" +#include "rational.h" + +/** + * Compute the max pixel step for each plane of an image with a + * format described by pixdesc. + * + * The pixel step is the distance in bytes between the first byte of + * the group of bytes which describe a pixel component and the first + * byte of the successive group in the same plane for the same + * component. + * + * @param max_pixsteps an array which is filled with the max pixel step + * for each plane. Since a plane may contain different pixel + * components, the computed max_pixsteps[plane] is relative to the + * component in the plane with the max pixel step. + * @param max_pixstep_comps an array which is filled with the component + * for each plane which has the max pixel step. May be NULL. + */ +void av_image_fill_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4], + const AVPixFmtDescriptor *pixdesc); + +/** + * Compute the size of an image line with format pix_fmt and width + * width for the plane plane. + * + * @return the computed size in bytes + */ +int av_image_get_linesize(enum AVPixelFormat pix_fmt, int width, int plane); + +/** + * Fill plane linesizes for an image with pixel format pix_fmt and + * width width. + * + * @param linesizes array to be filled with the linesize for each plane + * @return >= 0 in case of success, a negative error code otherwise + */ +int av_image_fill_linesizes(int linesizes[4], enum AVPixelFormat pix_fmt, int width); + +/** + * Fill plane data pointers for an image with pixel format pix_fmt and + * height height. + * + * @param data pointers array to be filled with the pointer for each image plane + * @param ptr the pointer to a buffer which will contain the image + * @param linesizes the array containing the linesize for each + * plane, should be filled by av_image_fill_linesizes() + * @return the size in bytes required for the image buffer, a negative + * error code in case of failure + */ +int av_image_fill_pointers(uint8_t *data[4], enum AVPixelFormat pix_fmt, int height, + uint8_t *ptr, const int linesizes[4]); + +/** + * Allocate an image with size w and h and pixel format pix_fmt, and + * fill pointers and linesizes accordingly. + * The allocated image buffer has to be freed by using + * av_freep(&pointers[0]). + * + * @param align the value to use for buffer size alignment + * @return the size in bytes required for the image buffer, a negative + * error code in case of failure + */ +int av_image_alloc(uint8_t *pointers[4], int linesizes[4], + int w, int h, enum AVPixelFormat pix_fmt, int align); + +/** + * Copy image plane from src to dst. + * That is, copy "height" number of lines of "bytewidth" bytes each. + * The first byte of each successive line is separated by *_linesize + * bytes. + * + * bytewidth must be contained by both absolute values of dst_linesize + * and src_linesize, otherwise the function behavior is undefined. + * + * @param dst_linesize linesize for the image plane in dst + * @param src_linesize linesize for the image plane in src + */ +void av_image_copy_plane(uint8_t *dst, int dst_linesize, + const uint8_t *src, int src_linesize, + int bytewidth, int height); + +/** + * Copy image in src_data to dst_data. + * + * @param dst_linesizes linesizes for the image in dst_data + * @param src_linesizes linesizes for the image in src_data + */ +void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4], + const uint8_t *src_data[4], const int src_linesizes[4], + enum AVPixelFormat pix_fmt, int width, int height); + +/** + * Copy image data located in uncacheable (e.g. GPU mapped) memory. Where + * available, this function will use special functionality for reading from such + * memory, which may result in greatly improved performance compared to plain + * av_image_copy(). + * + * The data pointers and the linesizes must be aligned to the maximum required + * by the CPU architecture. + * + * @note The linesize parameters have the type ptrdiff_t here, while they are + * int for av_image_copy(). + * @note On x86, the linesizes currently need to be aligned to the cacheline + * size (i.e. 64) to get improved performance. + */ +void av_image_copy_uc_from(uint8_t *dst_data[4], const ptrdiff_t dst_linesizes[4], + const uint8_t *src_data[4], const ptrdiff_t src_linesizes[4], + enum AVPixelFormat pix_fmt, int width, int height); + +/** + * Setup the data pointers and linesizes based on the specified image + * parameters and the provided array. + * + * The fields of the given image are filled in by using the src + * address which points to the image data buffer. Depending on the + * specified pixel format, one or multiple image data pointers and + * line sizes will be set. If a planar format is specified, several + * pointers will be set pointing to the different picture planes and + * the line sizes of the different planes will be stored in the + * lines_sizes array. Call with src == NULL to get the required + * size for the src buffer. + * + * To allocate the buffer and fill in the dst_data and dst_linesize in + * one call, use av_image_alloc(). + * + * @param dst_data data pointers to be filled in + * @param dst_linesize linesizes for the image in dst_data to be filled in + * @param src buffer which will contain or contains the actual image data, can be NULL + * @param pix_fmt the pixel format of the image + * @param width the width of the image in pixels + * @param height the height of the image in pixels + * @param align the value used in src for linesize alignment + * @return the size in bytes required for src, a negative error code + * in case of failure + */ +int av_image_fill_arrays(uint8_t *dst_data[4], int dst_linesize[4], + const uint8_t *src, + enum AVPixelFormat pix_fmt, int width, int height, int align); + +/** + * Return the size in bytes of the amount of data required to store an + * image with the given parameters. + * + * @param pix_fmt the pixel format of the image + * @param width the width of the image in pixels + * @param height the height of the image in pixels + * @param align the assumed linesize alignment + * @return the buffer size in bytes, a negative error code in case of failure + */ +int av_image_get_buffer_size(enum AVPixelFormat pix_fmt, int width, int height, int align); + +/** + * Copy image data from an image into a buffer. + * + * av_image_get_buffer_size() can be used to compute the required size + * for the buffer to fill. + * + * @param dst a buffer into which picture data will be copied + * @param dst_size the size in bytes of dst + * @param src_data pointers containing the source image data + * @param src_linesize linesizes for the image in src_data + * @param pix_fmt the pixel format of the source image + * @param width the width of the source image in pixels + * @param height the height of the source image in pixels + * @param align the assumed linesize alignment for dst + * @return the number of bytes written to dst, or a negative value + * (error code) on error + */ +int av_image_copy_to_buffer(uint8_t *dst, int dst_size, + const uint8_t * const src_data[4], const int src_linesize[4], + enum AVPixelFormat pix_fmt, int width, int height, int align); + +/** + * Check if the given dimension of an image is valid, meaning that all + * bytes of the image can be addressed with a signed int. + * + * @param w the width of the picture + * @param h the height of the picture + * @param log_offset the offset to sum to the log level for logging with log_ctx + * @param log_ctx the parent logging context, it may be NULL + * @return >= 0 if valid, a negative error code otherwise + */ +int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx); + +/** + * Check if the given dimension of an image is valid, meaning that all + * bytes of a plane of an image with the specified pix_fmt can be addressed + * with a signed int. + * + * @param w the width of the picture + * @param h the height of the picture + * @param max_pixels the maximum number of pixels the user wants to accept + * @param pix_fmt the pixel format, can be AV_PIX_FMT_NONE if unknown. + * @param log_offset the offset to sum to the log level for logging with log_ctx + * @param log_ctx the parent logging context, it may be NULL + * @return >= 0 if valid, a negative error code otherwise + */ +int av_image_check_size2(unsigned int w, unsigned int h, int64_t max_pixels, enum AVPixelFormat pix_fmt, int log_offset, void *log_ctx); + +/** + * Check if the given sample aspect ratio of an image is valid. + * + * It is considered invalid if the denominator is 0 or if applying the ratio + * to the image size would make the smaller dimension less than 1. If the + * sar numerator is 0, it is considered unknown and will return as valid. + * + * @param w width of the image + * @param h height of the image + * @param sar sample aspect ratio of the image + * @return 0 if valid, a negative AVERROR code otherwise + */ +int av_image_check_sar(unsigned int w, unsigned int h, AVRational sar); + +/** + * Overwrite the image data with black. This is suitable for filling a + * sub-rectangle of an image, meaning the padding between the right most pixel + * and the left most pixel on the next line will not be overwritten. For some + * formats, the image size might be rounded up due to inherent alignment. + * + * If the pixel format has alpha, the alpha is cleared to opaque. + * + * This can return an error if the pixel format is not supported. Normally, all + * non-hwaccel pixel formats should be supported. + * + * Passing NULL for dst_data is allowed. Then the function returns whether the + * operation would have succeeded. (It can return an error if the pix_fmt is + * not supported.) + * + * @param dst_data data pointers to destination image + * @param dst_linesize linesizes for the destination image + * @param pix_fmt the pixel format of the image + * @param range the color range of the image (important for colorspaces such as YUV) + * @param width the width of the image in pixels + * @param height the height of the image in pixels + * @return 0 if the image data was cleared, a negative AVERROR code otherwise + */ +int av_image_fill_black(uint8_t *dst_data[4], const ptrdiff_t dst_linesize[4], + enum AVPixelFormat pix_fmt, enum AVColorRange range, + int width, int height); + +/** + * @} + */ + + +#endif /* AVUTIL_IMGUTILS_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/intfloat.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/intfloat.h new file mode 100644 index 0000000..fe3d7ec --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/intfloat.h @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2011 Mans Rullgard + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_INTFLOAT_H +#define AVUTIL_INTFLOAT_H + +#include +#include "attributes.h" + +union av_intfloat32 { + uint32_t i; + float f; +}; + +union av_intfloat64 { + uint64_t i; + double f; +}; + +/** + * Reinterpret a 32-bit integer as a float. + */ +static av_always_inline float av_int2float(uint32_t i) +{ + union av_intfloat32 v; + v.i = i; + return v.f; +} + +/** + * Reinterpret a float as a 32-bit integer. + */ +static av_always_inline uint32_t av_float2int(float f) +{ + union av_intfloat32 v; + v.f = f; + return v.i; +} + +/** + * Reinterpret a 64-bit integer as a double. + */ +static av_always_inline double av_int2double(uint64_t i) +{ + union av_intfloat64 v; + v.i = i; + return v.f; +} + +/** + * Reinterpret a double as a 64-bit integer. + */ +static av_always_inline uint64_t av_double2int(double f) +{ + union av_intfloat64 v; + v.f = f; + return v.i; +} + +#endif /* AVUTIL_INTFLOAT_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/intreadwrite.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/intreadwrite.h new file mode 100644 index 0000000..67c763b --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/intreadwrite.h @@ -0,0 +1,629 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_INTREADWRITE_H +#define AVUTIL_INTREADWRITE_H + +#include +#include "libavutil/avconfig.h" +#include "attributes.h" +#include "bswap.h" + +typedef union { + uint64_t u64; + uint32_t u32[2]; + uint16_t u16[4]; + uint8_t u8 [8]; + double f64; + float f32[2]; +} av_alias av_alias64; + +typedef union { + uint32_t u32; + uint16_t u16[2]; + uint8_t u8 [4]; + float f32; +} av_alias av_alias32; + +typedef union { + uint16_t u16; + uint8_t u8 [2]; +} av_alias av_alias16; + +/* + * Arch-specific headers can provide any combination of + * AV_[RW][BLN](16|24|32|48|64) and AV_(COPY|SWAP|ZERO)(64|128) macros. + * Preprocessor symbols must be defined, even if these are implemented + * as inline functions. + * + * R/W means read/write, B/L/N means big/little/native endianness. + * The following macros require aligned access, compared to their + * unaligned variants: AV_(COPY|SWAP|ZERO)(64|128), AV_[RW]N[8-64]A. + * Incorrect usage may range from abysmal performance to crash + * depending on the platform. + * + * The unaligned variants are AV_[RW][BLN][8-64] and AV_COPY*U. + */ + +#ifdef HAVE_AV_CONFIG_H + +#include "config.h" + +#if ARCH_ARM +# include "arm/intreadwrite.h" +#elif ARCH_AVR32 +# include "avr32/intreadwrite.h" +#elif ARCH_MIPS +# include "mips/intreadwrite.h" +#elif ARCH_PPC +# include "ppc/intreadwrite.h" +#elif ARCH_TOMI +# include "tomi/intreadwrite.h" +#elif ARCH_X86 +# include "x86/intreadwrite.h" +#endif + +#endif /* HAVE_AV_CONFIG_H */ + +/* + * Map AV_RNXX <-> AV_R[BL]XX for all variants provided by per-arch headers. + */ + +#if AV_HAVE_BIGENDIAN + +# if defined(AV_RN16) && !defined(AV_RB16) +# define AV_RB16(p) AV_RN16(p) +# elif !defined(AV_RN16) && defined(AV_RB16) +# define AV_RN16(p) AV_RB16(p) +# endif + +# if defined(AV_WN16) && !defined(AV_WB16) +# define AV_WB16(p, v) AV_WN16(p, v) +# elif !defined(AV_WN16) && defined(AV_WB16) +# define AV_WN16(p, v) AV_WB16(p, v) +# endif + +# if defined(AV_RN24) && !defined(AV_RB24) +# define AV_RB24(p) AV_RN24(p) +# elif !defined(AV_RN24) && defined(AV_RB24) +# define AV_RN24(p) AV_RB24(p) +# endif + +# if defined(AV_WN24) && !defined(AV_WB24) +# define AV_WB24(p, v) AV_WN24(p, v) +# elif !defined(AV_WN24) && defined(AV_WB24) +# define AV_WN24(p, v) AV_WB24(p, v) +# endif + +# if defined(AV_RN32) && !defined(AV_RB32) +# define AV_RB32(p) AV_RN32(p) +# elif !defined(AV_RN32) && defined(AV_RB32) +# define AV_RN32(p) AV_RB32(p) +# endif + +# if defined(AV_WN32) && !defined(AV_WB32) +# define AV_WB32(p, v) AV_WN32(p, v) +# elif !defined(AV_WN32) && defined(AV_WB32) +# define AV_WN32(p, v) AV_WB32(p, v) +# endif + +# if defined(AV_RN48) && !defined(AV_RB48) +# define AV_RB48(p) AV_RN48(p) +# elif !defined(AV_RN48) && defined(AV_RB48) +# define AV_RN48(p) AV_RB48(p) +# endif + +# if defined(AV_WN48) && !defined(AV_WB48) +# define AV_WB48(p, v) AV_WN48(p, v) +# elif !defined(AV_WN48) && defined(AV_WB48) +# define AV_WN48(p, v) AV_WB48(p, v) +# endif + +# if defined(AV_RN64) && !defined(AV_RB64) +# define AV_RB64(p) AV_RN64(p) +# elif !defined(AV_RN64) && defined(AV_RB64) +# define AV_RN64(p) AV_RB64(p) +# endif + +# if defined(AV_WN64) && !defined(AV_WB64) +# define AV_WB64(p, v) AV_WN64(p, v) +# elif !defined(AV_WN64) && defined(AV_WB64) +# define AV_WN64(p, v) AV_WB64(p, v) +# endif + +#else /* AV_HAVE_BIGENDIAN */ + +# if defined(AV_RN16) && !defined(AV_RL16) +# define AV_RL16(p) AV_RN16(p) +# elif !defined(AV_RN16) && defined(AV_RL16) +# define AV_RN16(p) AV_RL16(p) +# endif + +# if defined(AV_WN16) && !defined(AV_WL16) +# define AV_WL16(p, v) AV_WN16(p, v) +# elif !defined(AV_WN16) && defined(AV_WL16) +# define AV_WN16(p, v) AV_WL16(p, v) +# endif + +# if defined(AV_RN24) && !defined(AV_RL24) +# define AV_RL24(p) AV_RN24(p) +# elif !defined(AV_RN24) && defined(AV_RL24) +# define AV_RN24(p) AV_RL24(p) +# endif + +# if defined(AV_WN24) && !defined(AV_WL24) +# define AV_WL24(p, v) AV_WN24(p, v) +# elif !defined(AV_WN24) && defined(AV_WL24) +# define AV_WN24(p, v) AV_WL24(p, v) +# endif + +# if defined(AV_RN32) && !defined(AV_RL32) +# define AV_RL32(p) AV_RN32(p) +# elif !defined(AV_RN32) && defined(AV_RL32) +# define AV_RN32(p) AV_RL32(p) +# endif + +# if defined(AV_WN32) && !defined(AV_WL32) +# define AV_WL32(p, v) AV_WN32(p, v) +# elif !defined(AV_WN32) && defined(AV_WL32) +# define AV_WN32(p, v) AV_WL32(p, v) +# endif + +# if defined(AV_RN48) && !defined(AV_RL48) +# define AV_RL48(p) AV_RN48(p) +# elif !defined(AV_RN48) && defined(AV_RL48) +# define AV_RN48(p) AV_RL48(p) +# endif + +# if defined(AV_WN48) && !defined(AV_WL48) +# define AV_WL48(p, v) AV_WN48(p, v) +# elif !defined(AV_WN48) && defined(AV_WL48) +# define AV_WN48(p, v) AV_WL48(p, v) +# endif + +# if defined(AV_RN64) && !defined(AV_RL64) +# define AV_RL64(p) AV_RN64(p) +# elif !defined(AV_RN64) && defined(AV_RL64) +# define AV_RN64(p) AV_RL64(p) +# endif + +# if defined(AV_WN64) && !defined(AV_WL64) +# define AV_WL64(p, v) AV_WN64(p, v) +# elif !defined(AV_WN64) && defined(AV_WL64) +# define AV_WN64(p, v) AV_WL64(p, v) +# endif + +#endif /* !AV_HAVE_BIGENDIAN */ + +/* + * Define AV_[RW]N helper macros to simplify definitions not provided + * by per-arch headers. + */ + +#if defined(__GNUC__) + +union unaligned_64 { uint64_t l; } __attribute__((packed)) av_alias; +union unaligned_32 { uint32_t l; } __attribute__((packed)) av_alias; +union unaligned_16 { uint16_t l; } __attribute__((packed)) av_alias; + +# define AV_RN(s, p) (((const union unaligned_##s *) (p))->l) +# define AV_WN(s, p, v) ((((union unaligned_##s *) (p))->l) = (v)) + +#elif defined(_MSC_VER) && (defined(_M_ARM) || defined(_M_X64) || defined(_M_ARM64)) && AV_HAVE_FAST_UNALIGNED + +# define AV_RN(s, p) (*((const __unaligned uint##s##_t*)(p))) +# define AV_WN(s, p, v) (*((__unaligned uint##s##_t*)(p)) = (v)) + +#elif AV_HAVE_FAST_UNALIGNED + +# define AV_RN(s, p) (((const av_alias##s*)(p))->u##s) +# define AV_WN(s, p, v) (((av_alias##s*)(p))->u##s = (v)) + +#else + +#ifndef AV_RB16 +# define AV_RB16(x) \ + ((((const uint8_t*)(x))[0] << 8) | \ + ((const uint8_t*)(x))[1]) +#endif +#ifndef AV_WB16 +# define AV_WB16(p, val) do { \ + uint16_t d = (val); \ + ((uint8_t*)(p))[1] = (d); \ + ((uint8_t*)(p))[0] = (d)>>8; \ + } while(0) +#endif + +#ifndef AV_RL16 +# define AV_RL16(x) \ + ((((const uint8_t*)(x))[1] << 8) | \ + ((const uint8_t*)(x))[0]) +#endif +#ifndef AV_WL16 +# define AV_WL16(p, val) do { \ + uint16_t d = (val); \ + ((uint8_t*)(p))[0] = (d); \ + ((uint8_t*)(p))[1] = (d)>>8; \ + } while(0) +#endif + +#ifndef AV_RB32 +# define AV_RB32(x) \ + (((uint32_t)((const uint8_t*)(x))[0] << 24) | \ + (((const uint8_t*)(x))[1] << 16) | \ + (((const uint8_t*)(x))[2] << 8) | \ + ((const uint8_t*)(x))[3]) +#endif +#ifndef AV_WB32 +# define AV_WB32(p, val) do { \ + uint32_t d = (val); \ + ((uint8_t*)(p))[3] = (d); \ + ((uint8_t*)(p))[2] = (d)>>8; \ + ((uint8_t*)(p))[1] = (d)>>16; \ + ((uint8_t*)(p))[0] = (d)>>24; \ + } while(0) +#endif + +#ifndef AV_RL32 +# define AV_RL32(x) \ + (((uint32_t)((const uint8_t*)(x))[3] << 24) | \ + (((const uint8_t*)(x))[2] << 16) | \ + (((const uint8_t*)(x))[1] << 8) | \ + ((const uint8_t*)(x))[0]) +#endif +#ifndef AV_WL32 +# define AV_WL32(p, val) do { \ + uint32_t d = (val); \ + ((uint8_t*)(p))[0] = (d); \ + ((uint8_t*)(p))[1] = (d)>>8; \ + ((uint8_t*)(p))[2] = (d)>>16; \ + ((uint8_t*)(p))[3] = (d)>>24; \ + } while(0) +#endif + +#ifndef AV_RB64 +# define AV_RB64(x) \ + (((uint64_t)((const uint8_t*)(x))[0] << 56) | \ + ((uint64_t)((const uint8_t*)(x))[1] << 48) | \ + ((uint64_t)((const uint8_t*)(x))[2] << 40) | \ + ((uint64_t)((const uint8_t*)(x))[3] << 32) | \ + ((uint64_t)((const uint8_t*)(x))[4] << 24) | \ + ((uint64_t)((const uint8_t*)(x))[5] << 16) | \ + ((uint64_t)((const uint8_t*)(x))[6] << 8) | \ + (uint64_t)((const uint8_t*)(x))[7]) +#endif +#ifndef AV_WB64 +# define AV_WB64(p, val) do { \ + uint64_t d = (val); \ + ((uint8_t*)(p))[7] = (d); \ + ((uint8_t*)(p))[6] = (d)>>8; \ + ((uint8_t*)(p))[5] = (d)>>16; \ + ((uint8_t*)(p))[4] = (d)>>24; \ + ((uint8_t*)(p))[3] = (d)>>32; \ + ((uint8_t*)(p))[2] = (d)>>40; \ + ((uint8_t*)(p))[1] = (d)>>48; \ + ((uint8_t*)(p))[0] = (d)>>56; \ + } while(0) +#endif + +#ifndef AV_RL64 +# define AV_RL64(x) \ + (((uint64_t)((const uint8_t*)(x))[7] << 56) | \ + ((uint64_t)((const uint8_t*)(x))[6] << 48) | \ + ((uint64_t)((const uint8_t*)(x))[5] << 40) | \ + ((uint64_t)((const uint8_t*)(x))[4] << 32) | \ + ((uint64_t)((const uint8_t*)(x))[3] << 24) | \ + ((uint64_t)((const uint8_t*)(x))[2] << 16) | \ + ((uint64_t)((const uint8_t*)(x))[1] << 8) | \ + (uint64_t)((const uint8_t*)(x))[0]) +#endif +#ifndef AV_WL64 +# define AV_WL64(p, val) do { \ + uint64_t d = (val); \ + ((uint8_t*)(p))[0] = (d); \ + ((uint8_t*)(p))[1] = (d)>>8; \ + ((uint8_t*)(p))[2] = (d)>>16; \ + ((uint8_t*)(p))[3] = (d)>>24; \ + ((uint8_t*)(p))[4] = (d)>>32; \ + ((uint8_t*)(p))[5] = (d)>>40; \ + ((uint8_t*)(p))[6] = (d)>>48; \ + ((uint8_t*)(p))[7] = (d)>>56; \ + } while(0) +#endif + +#if AV_HAVE_BIGENDIAN +# define AV_RN(s, p) AV_RB##s(p) +# define AV_WN(s, p, v) AV_WB##s(p, v) +#else +# define AV_RN(s, p) AV_RL##s(p) +# define AV_WN(s, p, v) AV_WL##s(p, v) +#endif + +#endif /* HAVE_FAST_UNALIGNED */ + +#ifndef AV_RN16 +# define AV_RN16(p) AV_RN(16, p) +#endif + +#ifndef AV_RN32 +# define AV_RN32(p) AV_RN(32, p) +#endif + +#ifndef AV_RN64 +# define AV_RN64(p) AV_RN(64, p) +#endif + +#ifndef AV_WN16 +# define AV_WN16(p, v) AV_WN(16, p, v) +#endif + +#ifndef AV_WN32 +# define AV_WN32(p, v) AV_WN(32, p, v) +#endif + +#ifndef AV_WN64 +# define AV_WN64(p, v) AV_WN(64, p, v) +#endif + +#if AV_HAVE_BIGENDIAN +# define AV_RB(s, p) AV_RN##s(p) +# define AV_WB(s, p, v) AV_WN##s(p, v) +# define AV_RL(s, p) av_bswap##s(AV_RN##s(p)) +# define AV_WL(s, p, v) AV_WN##s(p, av_bswap##s(v)) +#else +# define AV_RB(s, p) av_bswap##s(AV_RN##s(p)) +# define AV_WB(s, p, v) AV_WN##s(p, av_bswap##s(v)) +# define AV_RL(s, p) AV_RN##s(p) +# define AV_WL(s, p, v) AV_WN##s(p, v) +#endif + +#define AV_RB8(x) (((const uint8_t*)(x))[0]) +#define AV_WB8(p, d) do { ((uint8_t*)(p))[0] = (d); } while(0) + +#define AV_RL8(x) AV_RB8(x) +#define AV_WL8(p, d) AV_WB8(p, d) + +#ifndef AV_RB16 +# define AV_RB16(p) AV_RB(16, p) +#endif +#ifndef AV_WB16 +# define AV_WB16(p, v) AV_WB(16, p, v) +#endif + +#ifndef AV_RL16 +# define AV_RL16(p) AV_RL(16, p) +#endif +#ifndef AV_WL16 +# define AV_WL16(p, v) AV_WL(16, p, v) +#endif + +#ifndef AV_RB32 +# define AV_RB32(p) AV_RB(32, p) +#endif +#ifndef AV_WB32 +# define AV_WB32(p, v) AV_WB(32, p, v) +#endif + +#ifndef AV_RL32 +# define AV_RL32(p) AV_RL(32, p) +#endif +#ifndef AV_WL32 +# define AV_WL32(p, v) AV_WL(32, p, v) +#endif + +#ifndef AV_RB64 +# define AV_RB64(p) AV_RB(64, p) +#endif +#ifndef AV_WB64 +# define AV_WB64(p, v) AV_WB(64, p, v) +#endif + +#ifndef AV_RL64 +# define AV_RL64(p) AV_RL(64, p) +#endif +#ifndef AV_WL64 +# define AV_WL64(p, v) AV_WL(64, p, v) +#endif + +#ifndef AV_RB24 +# define AV_RB24(x) \ + ((((const uint8_t*)(x))[0] << 16) | \ + (((const uint8_t*)(x))[1] << 8) | \ + ((const uint8_t*)(x))[2]) +#endif +#ifndef AV_WB24 +# define AV_WB24(p, d) do { \ + ((uint8_t*)(p))[2] = (d); \ + ((uint8_t*)(p))[1] = (d)>>8; \ + ((uint8_t*)(p))[0] = (d)>>16; \ + } while(0) +#endif + +#ifndef AV_RL24 +# define AV_RL24(x) \ + ((((const uint8_t*)(x))[2] << 16) | \ + (((const uint8_t*)(x))[1] << 8) | \ + ((const uint8_t*)(x))[0]) +#endif +#ifndef AV_WL24 +# define AV_WL24(p, d) do { \ + ((uint8_t*)(p))[0] = (d); \ + ((uint8_t*)(p))[1] = (d)>>8; \ + ((uint8_t*)(p))[2] = (d)>>16; \ + } while(0) +#endif + +#ifndef AV_RB48 +# define AV_RB48(x) \ + (((uint64_t)((const uint8_t*)(x))[0] << 40) | \ + ((uint64_t)((const uint8_t*)(x))[1] << 32) | \ + ((uint64_t)((const uint8_t*)(x))[2] << 24) | \ + ((uint64_t)((const uint8_t*)(x))[3] << 16) | \ + ((uint64_t)((const uint8_t*)(x))[4] << 8) | \ + (uint64_t)((const uint8_t*)(x))[5]) +#endif +#ifndef AV_WB48 +# define AV_WB48(p, darg) do { \ + uint64_t d = (darg); \ + ((uint8_t*)(p))[5] = (d); \ + ((uint8_t*)(p))[4] = (d)>>8; \ + ((uint8_t*)(p))[3] = (d)>>16; \ + ((uint8_t*)(p))[2] = (d)>>24; \ + ((uint8_t*)(p))[1] = (d)>>32; \ + ((uint8_t*)(p))[0] = (d)>>40; \ + } while(0) +#endif + +#ifndef AV_RL48 +# define AV_RL48(x) \ + (((uint64_t)((const uint8_t*)(x))[5] << 40) | \ + ((uint64_t)((const uint8_t*)(x))[4] << 32) | \ + ((uint64_t)((const uint8_t*)(x))[3] << 24) | \ + ((uint64_t)((const uint8_t*)(x))[2] << 16) | \ + ((uint64_t)((const uint8_t*)(x))[1] << 8) | \ + (uint64_t)((const uint8_t*)(x))[0]) +#endif +#ifndef AV_WL48 +# define AV_WL48(p, darg) do { \ + uint64_t d = (darg); \ + ((uint8_t*)(p))[0] = (d); \ + ((uint8_t*)(p))[1] = (d)>>8; \ + ((uint8_t*)(p))[2] = (d)>>16; \ + ((uint8_t*)(p))[3] = (d)>>24; \ + ((uint8_t*)(p))[4] = (d)>>32; \ + ((uint8_t*)(p))[5] = (d)>>40; \ + } while(0) +#endif + +/* + * The AV_[RW]NA macros access naturally aligned data + * in a type-safe way. + */ + +#define AV_RNA(s, p) (((const av_alias##s*)(p))->u##s) +#define AV_WNA(s, p, v) (((av_alias##s*)(p))->u##s = (v)) + +#ifndef AV_RN16A +# define AV_RN16A(p) AV_RNA(16, p) +#endif + +#ifndef AV_RN32A +# define AV_RN32A(p) AV_RNA(32, p) +#endif + +#ifndef AV_RN64A +# define AV_RN64A(p) AV_RNA(64, p) +#endif + +#ifndef AV_WN16A +# define AV_WN16A(p, v) AV_WNA(16, p, v) +#endif + +#ifndef AV_WN32A +# define AV_WN32A(p, v) AV_WNA(32, p, v) +#endif + +#ifndef AV_WN64A +# define AV_WN64A(p, v) AV_WNA(64, p, v) +#endif + +/* + * The AV_COPYxxU macros are suitable for copying data to/from unaligned + * memory locations. + */ + +#define AV_COPYU(n, d, s) AV_WN##n(d, AV_RN##n(s)); + +#ifndef AV_COPY16U +# define AV_COPY16U(d, s) AV_COPYU(16, d, s) +#endif + +#ifndef AV_COPY32U +# define AV_COPY32U(d, s) AV_COPYU(32, d, s) +#endif + +#ifndef AV_COPY64U +# define AV_COPY64U(d, s) AV_COPYU(64, d, s) +#endif + +#ifndef AV_COPY128U +# define AV_COPY128U(d, s) \ + do { \ + AV_COPY64U(d, s); \ + AV_COPY64U((char *)(d) + 8, (const char *)(s) + 8); \ + } while(0) +#endif + +/* Parameters for AV_COPY*, AV_SWAP*, AV_ZERO* must be + * naturally aligned. They may be implemented using MMX, + * so emms_c() must be called before using any float code + * afterwards. + */ + +#define AV_COPY(n, d, s) \ + (((av_alias##n*)(d))->u##n = ((const av_alias##n*)(s))->u##n) + +#ifndef AV_COPY16 +# define AV_COPY16(d, s) AV_COPY(16, d, s) +#endif + +#ifndef AV_COPY32 +# define AV_COPY32(d, s) AV_COPY(32, d, s) +#endif + +#ifndef AV_COPY64 +# define AV_COPY64(d, s) AV_COPY(64, d, s) +#endif + +#ifndef AV_COPY128 +# define AV_COPY128(d, s) \ + do { \ + AV_COPY64(d, s); \ + AV_COPY64((char*)(d)+8, (char*)(s)+8); \ + } while(0) +#endif + +#define AV_SWAP(n, a, b) FFSWAP(av_alias##n, *(av_alias##n*)(a), *(av_alias##n*)(b)) + +#ifndef AV_SWAP64 +# define AV_SWAP64(a, b) AV_SWAP(64, a, b) +#endif + +#define AV_ZERO(n, d) (((av_alias##n*)(d))->u##n = 0) + +#ifndef AV_ZERO16 +# define AV_ZERO16(d) AV_ZERO(16, d) +#endif + +#ifndef AV_ZERO32 +# define AV_ZERO32(d) AV_ZERO(32, d) +#endif + +#ifndef AV_ZERO64 +# define AV_ZERO64(d) AV_ZERO(64, d) +#endif + +#ifndef AV_ZERO128 +# define AV_ZERO128(d) \ + do { \ + AV_ZERO64(d); \ + AV_ZERO64((char*)(d)+8); \ + } while(0) +#endif + +#endif /* AVUTIL_INTREADWRITE_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/lfg.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/lfg.h new file mode 100644 index 0000000..03f779a --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/lfg.h @@ -0,0 +1,71 @@ +/* + * Lagged Fibonacci PRNG + * Copyright (c) 2008 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_LFG_H +#define AVUTIL_LFG_H + +#include + +typedef struct AVLFG { + unsigned int state[64]; + int index; +} AVLFG; + +void av_lfg_init(AVLFG *c, unsigned int seed); + +/** + * Seed the state of the ALFG using binary data. + * + * Return value: 0 on success, negative value (AVERROR) on failure. + */ +int av_lfg_init_from_data(AVLFG *c, const uint8_t *data, unsigned int length); + +/** + * Get the next random unsigned 32-bit number using an ALFG. + * + * Please also consider a simple LCG like state= state*1664525+1013904223, + * it may be good enough and faster for your specific use case. + */ +static inline unsigned int av_lfg_get(AVLFG *c){ + c->state[c->index & 63] = c->state[(c->index-24) & 63] + c->state[(c->index-55) & 63]; + return c->state[c->index++ & 63]; +} + +/** + * Get the next random unsigned 32-bit number using a MLFG. + * + * Please also consider av_lfg_get() above, it is faster. + */ +static inline unsigned int av_mlfg_get(AVLFG *c){ + unsigned int a= c->state[(c->index-55) & 63]; + unsigned int b= c->state[(c->index-24) & 63]; + return c->state[c->index++ & 63] = 2*a*b+a+b; +} + +/** + * Get the next two numbers generated by a Box-Muller Gaussian + * generator using the random numbers issued by lfg. + * + * @param out array where the two generated numbers are placed + */ +void av_bmg_get(AVLFG *lfg, double out[2]); + +#endif /* AVUTIL_LFG_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/log.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/log.h new file mode 100644 index 0000000..d9554e6 --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/log.h @@ -0,0 +1,362 @@ +/* + * copyright (c) 2006 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_LOG_H +#define AVUTIL_LOG_H + +#include +#include "avutil.h" +#include "attributes.h" +#include "version.h" + +typedef enum { + AV_CLASS_CATEGORY_NA = 0, + AV_CLASS_CATEGORY_INPUT, + AV_CLASS_CATEGORY_OUTPUT, + AV_CLASS_CATEGORY_MUXER, + AV_CLASS_CATEGORY_DEMUXER, + AV_CLASS_CATEGORY_ENCODER, + AV_CLASS_CATEGORY_DECODER, + AV_CLASS_CATEGORY_FILTER, + AV_CLASS_CATEGORY_BITSTREAM_FILTER, + AV_CLASS_CATEGORY_SWSCALER, + AV_CLASS_CATEGORY_SWRESAMPLER, + AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT = 40, + AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT, + AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT, + AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT, + AV_CLASS_CATEGORY_DEVICE_OUTPUT, + AV_CLASS_CATEGORY_DEVICE_INPUT, + AV_CLASS_CATEGORY_NB ///< not part of ABI/API +}AVClassCategory; + +#define AV_IS_INPUT_DEVICE(category) \ + (((category) == AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT) || \ + ((category) == AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT) || \ + ((category) == AV_CLASS_CATEGORY_DEVICE_INPUT)) + +#define AV_IS_OUTPUT_DEVICE(category) \ + (((category) == AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT) || \ + ((category) == AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT) || \ + ((category) == AV_CLASS_CATEGORY_DEVICE_OUTPUT)) + +struct AVOptionRanges; + +/** + * Describe the class of an AVClass context structure. That is an + * arbitrary struct of which the first field is a pointer to an + * AVClass struct (e.g. AVCodecContext, AVFormatContext etc.). + */ +typedef struct AVClass { + /** + * The name of the class; usually it is the same name as the + * context structure type to which the AVClass is associated. + */ + const char* class_name; + + /** + * A pointer to a function which returns the name of a context + * instance ctx associated with the class. + */ + const char* (*item_name)(void* ctx); + + /** + * a pointer to the first option specified in the class if any or NULL + * + * @see av_set_default_options() + */ + const struct AVOption *option; + + /** + * LIBAVUTIL_VERSION with which this structure was created. + * This is used to allow fields to be added without requiring major + * version bumps everywhere. + */ + + int version; + + /** + * Offset in the structure where log_level_offset is stored. + * 0 means there is no such variable + */ + int log_level_offset_offset; + + /** + * Offset in the structure where a pointer to the parent context for + * logging is stored. For example a decoder could pass its AVCodecContext + * to eval as such a parent context, which an av_log() implementation + * could then leverage to display the parent context. + * The offset can be NULL. + */ + int parent_log_context_offset; + + /** + * Return next AVOptions-enabled child or NULL + */ + void* (*child_next)(void *obj, void *prev); + + /** + * Return an AVClass corresponding to the next potential + * AVOptions-enabled child. + * + * The difference between child_next and this is that + * child_next iterates over _already existing_ objects, while + * child_class_next iterates over _all possible_ children. + */ + const struct AVClass* (*child_class_next)(const struct AVClass *prev); + + /** + * Category used for visualization (like color) + * This is only set if the category is equal for all objects using this class. + * available since version (51 << 16 | 56 << 8 | 100) + */ + AVClassCategory category; + + /** + * Callback to return the category. + * available since version (51 << 16 | 59 << 8 | 100) + */ + AVClassCategory (*get_category)(void* ctx); + + /** + * Callback to return the supported/allowed ranges. + * available since version (52.12) + */ + int (*query_ranges)(struct AVOptionRanges **, void *obj, const char *key, int flags); +} AVClass; + +/** + * @addtogroup lavu_log + * + * @{ + * + * @defgroup lavu_log_constants Logging Constants + * + * @{ + */ + +/** + * Print no output. + */ +#define AV_LOG_QUIET -8 + +/** + * Something went really wrong and we will crash now. + */ +#define AV_LOG_PANIC 0 + +/** + * Something went wrong and recovery is not possible. + * For example, no header was found for a format which depends + * on headers or an illegal combination of parameters is used. + */ +#define AV_LOG_FATAL 8 + +/** + * Something went wrong and cannot losslessly be recovered. + * However, not all future data is affected. + */ +#define AV_LOG_ERROR 16 + +/** + * Something somehow does not look correct. This may or may not + * lead to problems. An example would be the use of '-vstrict -2'. + */ +#define AV_LOG_WARNING 24 + +/** + * Standard information. + */ +#define AV_LOG_INFO 32 + +/** + * Detailed information. + */ +#define AV_LOG_VERBOSE 40 + +/** + * Stuff which is only useful for libav* developers. + */ +#define AV_LOG_DEBUG 48 + +/** + * Extremely verbose debugging, useful for libav* development. + */ +#define AV_LOG_TRACE 56 + +#define AV_LOG_MAX_OFFSET (AV_LOG_TRACE - AV_LOG_QUIET) + +/** + * @} + */ + +/** + * Sets additional colors for extended debugging sessions. + * @code + av_log(ctx, AV_LOG_DEBUG|AV_LOG_C(134), "Message in purple\n"); + @endcode + * Requires 256color terminal support. Uses outside debugging is not + * recommended. + */ +#define AV_LOG_C(x) ((x) << 8) + +/** + * Send the specified message to the log if the level is less than or equal + * to the current av_log_level. By default, all logging messages are sent to + * stderr. This behavior can be altered by setting a different logging callback + * function. + * @see av_log_set_callback + * + * @param avcl A pointer to an arbitrary struct of which the first field is a + * pointer to an AVClass struct or NULL if general log. + * @param level The importance level of the message expressed using a @ref + * lavu_log_constants "Logging Constant". + * @param fmt The format string (printf-compatible) that specifies how + * subsequent arguments are converted to output. + */ +void av_log(void *avcl, int level, const char *fmt, ...) av_printf_format(3, 4); + + +/** + * Send the specified message to the log if the level is less than or equal + * to the current av_log_level. By default, all logging messages are sent to + * stderr. This behavior can be altered by setting a different logging callback + * function. + * @see av_log_set_callback + * + * @param avcl A pointer to an arbitrary struct of which the first field is a + * pointer to an AVClass struct. + * @param level The importance level of the message expressed using a @ref + * lavu_log_constants "Logging Constant". + * @param fmt The format string (printf-compatible) that specifies how + * subsequent arguments are converted to output. + * @param vl The arguments referenced by the format string. + */ +void av_vlog(void *avcl, int level, const char *fmt, va_list vl); + +/** + * Get the current log level + * + * @see lavu_log_constants + * + * @return Current log level + */ +int av_log_get_level(void); + +/** + * Set the log level + * + * @see lavu_log_constants + * + * @param level Logging level + */ +void av_log_set_level(int level); + +/** + * Set the logging callback + * + * @note The callback must be thread safe, even if the application does not use + * threads itself as some codecs are multithreaded. + * + * @see av_log_default_callback + * + * @param callback A logging function with a compatible signature. + */ +void av_log_set_callback(void (*callback)(void*, int, const char*, va_list)); + +/** + * Default logging callback + * + * It prints the message to stderr, optionally colorizing it. + * + * @param avcl A pointer to an arbitrary struct of which the first field is a + * pointer to an AVClass struct. + * @param level The importance level of the message expressed using a @ref + * lavu_log_constants "Logging Constant". + * @param fmt The format string (printf-compatible) that specifies how + * subsequent arguments are converted to output. + * @param vl The arguments referenced by the format string. + */ +void av_log_default_callback(void *avcl, int level, const char *fmt, + va_list vl); + +/** + * Return the context name + * + * @param ctx The AVClass context + * + * @return The AVClass class_name + */ +const char* av_default_item_name(void* ctx); +AVClassCategory av_default_get_category(void *ptr); + +/** + * Format a line of log the same way as the default callback. + * @param line buffer to receive the formatted line + * @param line_size size of the buffer + * @param print_prefix used to store whether the prefix must be printed; + * must point to a persistent integer initially set to 1 + */ +void av_log_format_line(void *ptr, int level, const char *fmt, va_list vl, + char *line, int line_size, int *print_prefix); + +/** + * Format a line of log the same way as the default callback. + * @param line buffer to receive the formatted line; + * may be NULL if line_size is 0 + * @param line_size size of the buffer; at most line_size-1 characters will + * be written to the buffer, plus one null terminator + * @param print_prefix used to store whether the prefix must be printed; + * must point to a persistent integer initially set to 1 + * @return Returns a negative value if an error occurred, otherwise returns + * the number of characters that would have been written for a + * sufficiently large buffer, not including the terminating null + * character. If the return value is not less than line_size, it means + * that the log message was truncated to fit the buffer. + */ +int av_log_format_line2(void *ptr, int level, const char *fmt, va_list vl, + char *line, int line_size, int *print_prefix); + +/** + * Skip repeated messages, this requires the user app to use av_log() instead of + * (f)printf as the 2 would otherwise interfere and lead to + * "Last message repeated x times" messages below (f)printf messages with some + * bad luck. + * Also to receive the last, "last repeated" line if any, the user app must + * call av_log(NULL, AV_LOG_QUIET, "%s", ""); at the end + */ +#define AV_LOG_SKIP_REPEATED 1 + +/** + * Include the log severity in messages originating from codecs. + * + * Results in messages such as: + * [rawvideo @ 0xDEADBEEF] [error] encode did not produce valid pts + */ +#define AV_LOG_PRINT_LEVEL 2 + +void av_log_set_flags(int arg); +int av_log_get_flags(void); + +/** + * @} + */ + +#endif /* AVUTIL_LOG_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/lzo.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/lzo.h new file mode 100644 index 0000000..c034039 --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/lzo.h @@ -0,0 +1,66 @@ +/* + * LZO 1x decompression + * copyright (c) 2006 Reimar Doeffinger + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_LZO_H +#define AVUTIL_LZO_H + +/** + * @defgroup lavu_lzo LZO + * @ingroup lavu_crypto + * + * @{ + */ + +#include + +/** @name Error flags returned by av_lzo1x_decode + * @{ */ +/// end of the input buffer reached before decoding finished +#define AV_LZO_INPUT_DEPLETED 1 +/// decoded data did not fit into output buffer +#define AV_LZO_OUTPUT_FULL 2 +/// a reference to previously decoded data was wrong +#define AV_LZO_INVALID_BACKPTR 4 +/// a non-specific error in the compressed bitstream +#define AV_LZO_ERROR 8 +/** @} */ + +#define AV_LZO_INPUT_PADDING 8 +#define AV_LZO_OUTPUT_PADDING 12 + +/** + * @brief Decodes LZO 1x compressed data. + * @param out output buffer + * @param outlen size of output buffer, number of bytes left are returned here + * @param in input buffer + * @param inlen size of input buffer, number of bytes left are returned here + * @return 0 on success, otherwise a combination of the error flags above + * + * Make sure all buffers are appropriately padded, in must provide + * AV_LZO_INPUT_PADDING, out must provide AV_LZO_OUTPUT_PADDING additional bytes. + */ +int av_lzo1x_decode(void *out, int *outlen, const void *in, int *inlen); + +/** + * @} + */ + +#endif /* AVUTIL_LZO_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/macros.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/macros.h new file mode 100644 index 0000000..2007ee5 --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/macros.h @@ -0,0 +1,50 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * @ingroup lavu + * Utility Preprocessor macros + */ + +#ifndef AVUTIL_MACROS_H +#define AVUTIL_MACROS_H + +/** + * @addtogroup preproc_misc Preprocessor String Macros + * + * String manipulation macros + * + * @{ + */ + +#define AV_STRINGIFY(s) AV_TOSTRING(s) +#define AV_TOSTRING(s) #s + +#define AV_GLUE(a, b) a ## b +#define AV_JOIN(a, b) AV_GLUE(a, b) + +/** + * @} + */ + +#define AV_PRAGMA(s) _Pragma(#s) + +#define FFALIGN(x, a) (((x)+(a)-1)&~((a)-1)) + +#endif /* AVUTIL_MACROS_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/mastering_display_metadata.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/mastering_display_metadata.h new file mode 100644 index 0000000..c23b07c --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/mastering_display_metadata.h @@ -0,0 +1,128 @@ +/* + * Copyright (c) 2016 Neil Birkbeck + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_MASTERING_DISPLAY_METADATA_H +#define AVUTIL_MASTERING_DISPLAY_METADATA_H + +#include "frame.h" +#include "rational.h" + + +/** + * Mastering display metadata capable of representing the color volume of + * the display used to master the content (SMPTE 2086:2014). + * + * To be used as payload of a AVFrameSideData or AVPacketSideData with the + * appropriate type. + * + * @note The struct should be allocated with av_mastering_display_metadata_alloc() + * and its size is not a part of the public ABI. + */ +typedef struct AVMasteringDisplayMetadata { + /** + * CIE 1931 xy chromaticity coords of color primaries (r, g, b order). + */ + AVRational display_primaries[3][2]; + + /** + * CIE 1931 xy chromaticity coords of white point. + */ + AVRational white_point[2]; + + /** + * Min luminance of mastering display (cd/m^2). + */ + AVRational min_luminance; + + /** + * Max luminance of mastering display (cd/m^2). + */ + AVRational max_luminance; + + /** + * Flag indicating whether the display primaries (and white point) are set. + */ + int has_primaries; + + /** + * Flag indicating whether the luminance (min_ and max_) have been set. + */ + int has_luminance; + +} AVMasteringDisplayMetadata; + +/** + * Allocate an AVMasteringDisplayMetadata structure and set its fields to + * default values. The resulting struct can be freed using av_freep(). + * + * @return An AVMasteringDisplayMetadata filled with default values or NULL + * on failure. + */ +AVMasteringDisplayMetadata *av_mastering_display_metadata_alloc(void); + +/** + * Allocate a complete AVMasteringDisplayMetadata and add it to the frame. + * + * @param frame The frame which side data is added to. + * + * @return The AVMasteringDisplayMetadata structure to be filled by caller. + */ +AVMasteringDisplayMetadata *av_mastering_display_metadata_create_side_data(AVFrame *frame); + +/** + * Content light level needed by to transmit HDR over HDMI (CTA-861.3). + * + * To be used as payload of a AVFrameSideData or AVPacketSideData with the + * appropriate type. + * + * @note The struct should be allocated with av_content_light_metadata_alloc() + * and its size is not a part of the public ABI. + */ +typedef struct AVContentLightMetadata { + /** + * Max content light level (cd/m^2). + */ + unsigned MaxCLL; + + /** + * Max average light level per frame (cd/m^2). + */ + unsigned MaxFALL; +} AVContentLightMetadata; + +/** + * Allocate an AVContentLightMetadata structure and set its fields to + * default values. The resulting struct can be freed using av_freep(). + * + * @return An AVContentLightMetadata filled with default values or NULL + * on failure. + */ +AVContentLightMetadata *av_content_light_metadata_alloc(size_t *size); + +/** + * Allocate a complete AVContentLightMetadata and add it to the frame. + * + * @param frame The frame which side data is added to. + * + * @return The AVContentLightMetadata structure to be filled by caller. + */ +AVContentLightMetadata *av_content_light_metadata_create_side_data(AVFrame *frame); + +#endif /* AVUTIL_MASTERING_DISPLAY_METADATA_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/mathematics.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/mathematics.h new file mode 100644 index 0000000..5490180 --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/mathematics.h @@ -0,0 +1,242 @@ +/* + * copyright (c) 2005-2012 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * @addtogroup lavu_math + * Mathematical utilities for working with timestamp and time base. + */ + +#ifndef AVUTIL_MATHEMATICS_H +#define AVUTIL_MATHEMATICS_H + +#include +#include +#include "attributes.h" +#include "rational.h" +#include "intfloat.h" + +#ifndef M_E +#define M_E 2.7182818284590452354 /* e */ +#endif +#ifndef M_LN2 +#define M_LN2 0.69314718055994530942 /* log_e 2 */ +#endif +#ifndef M_LN10 +#define M_LN10 2.30258509299404568402 /* log_e 10 */ +#endif +#ifndef M_LOG2_10 +#define M_LOG2_10 3.32192809488736234787 /* log_2 10 */ +#endif +#ifndef M_PHI +#define M_PHI 1.61803398874989484820 /* phi / golden ratio */ +#endif +#ifndef M_PI +#define M_PI 3.14159265358979323846 /* pi */ +#endif +#ifndef M_PI_2 +#define M_PI_2 1.57079632679489661923 /* pi/2 */ +#endif +#ifndef M_SQRT1_2 +#define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */ +#endif +#ifndef M_SQRT2 +#define M_SQRT2 1.41421356237309504880 /* sqrt(2) */ +#endif +#ifndef NAN +#define NAN av_int2float(0x7fc00000) +#endif +#ifndef INFINITY +#define INFINITY av_int2float(0x7f800000) +#endif + +/** + * @addtogroup lavu_math + * + * @{ + */ + +/** + * Rounding methods. + */ +enum AVRounding { + AV_ROUND_ZERO = 0, ///< Round toward zero. + AV_ROUND_INF = 1, ///< Round away from zero. + AV_ROUND_DOWN = 2, ///< Round toward -infinity. + AV_ROUND_UP = 3, ///< Round toward +infinity. + AV_ROUND_NEAR_INF = 5, ///< Round to nearest and halfway cases away from zero. + /** + * Flag telling rescaling functions to pass `INT64_MIN`/`MAX` through + * unchanged, avoiding special cases for #AV_NOPTS_VALUE. + * + * Unlike other values of the enumeration AVRounding, this value is a + * bitmask that must be used in conjunction with another value of the + * enumeration through a bitwise OR, in order to set behavior for normal + * cases. + * + * @code{.c} + * av_rescale_rnd(3, 1, 2, AV_ROUND_UP | AV_ROUND_PASS_MINMAX); + * // Rescaling 3: + * // Calculating 3 * 1 / 2 + * // 3 / 2 is rounded up to 2 + * // => 2 + * + * av_rescale_rnd(AV_NOPTS_VALUE, 1, 2, AV_ROUND_UP | AV_ROUND_PASS_MINMAX); + * // Rescaling AV_NOPTS_VALUE: + * // AV_NOPTS_VALUE == INT64_MIN + * // AV_NOPTS_VALUE is passed through + * // => AV_NOPTS_VALUE + * @endcode + */ + AV_ROUND_PASS_MINMAX = 8192, +}; + +/** + * Compute the greatest common divisor of two integer operands. + * + * @param a,b Operands + * @return GCD of a and b up to sign; if a >= 0 and b >= 0, return value is >= 0; + * if a == 0 and b == 0, returns 0. + */ +int64_t av_const av_gcd(int64_t a, int64_t b); + +/** + * Rescale a 64-bit integer with rounding to nearest. + * + * The operation is mathematically equivalent to `a * b / c`, but writing that + * directly can overflow. + * + * This function is equivalent to av_rescale_rnd() with #AV_ROUND_NEAR_INF. + * + * @see av_rescale_rnd(), av_rescale_q(), av_rescale_q_rnd() + */ +int64_t av_rescale(int64_t a, int64_t b, int64_t c) av_const; + +/** + * Rescale a 64-bit integer with specified rounding. + * + * The operation is mathematically equivalent to `a * b / c`, but writing that + * directly can overflow, and does not support different rounding methods. + * + * @see av_rescale(), av_rescale_q(), av_rescale_q_rnd() + */ +int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding rnd) av_const; + +/** + * Rescale a 64-bit integer by 2 rational numbers. + * + * The operation is mathematically equivalent to `a * bq / cq`. + * + * This function is equivalent to av_rescale_q_rnd() with #AV_ROUND_NEAR_INF. + * + * @see av_rescale(), av_rescale_rnd(), av_rescale_q_rnd() + */ +int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) av_const; + +/** + * Rescale a 64-bit integer by 2 rational numbers with specified rounding. + * + * The operation is mathematically equivalent to `a * bq / cq`. + * + * @see av_rescale(), av_rescale_rnd(), av_rescale_q() + */ +int64_t av_rescale_q_rnd(int64_t a, AVRational bq, AVRational cq, + enum AVRounding rnd) av_const; + +/** + * Compare two timestamps each in its own time base. + * + * @return One of the following values: + * - -1 if `ts_a` is before `ts_b` + * - 1 if `ts_a` is after `ts_b` + * - 0 if they represent the same position + * + * @warning + * The result of the function is undefined if one of the timestamps is outside + * the `int64_t` range when represented in the other's timebase. + */ +int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b); + +/** + * Compare the remainders of two integer operands divided by a common divisor. + * + * In other words, compare the least significant `log2(mod)` bits of integers + * `a` and `b`. + * + * @code{.c} + * av_compare_mod(0x11, 0x02, 0x10) < 0 // since 0x11 % 0x10 (0x1) < 0x02 % 0x10 (0x2) + * av_compare_mod(0x11, 0x02, 0x20) > 0 // since 0x11 % 0x20 (0x11) > 0x02 % 0x20 (0x02) + * @endcode + * + * @param a,b Operands + * @param mod Divisor; must be a power of 2 + * @return + * - a negative value if `a % mod < b % mod` + * - a positive value if `a % mod > b % mod` + * - zero if `a % mod == b % mod` + */ +int64_t av_compare_mod(uint64_t a, uint64_t b, uint64_t mod); + +/** + * Rescale a timestamp while preserving known durations. + * + * This function is designed to be called per audio packet to scale the input + * timestamp to a different time base. Compared to a simple av_rescale_q() + * call, this function is robust against possible inconsistent frame durations. + * + * The `last` parameter is a state variable that must be preserved for all + * subsequent calls for the same stream. For the first call, `*last` should be + * initialized to #AV_NOPTS_VALUE. + * + * @param[in] in_tb Input time base + * @param[in] in_ts Input timestamp + * @param[in] fs_tb Duration time base; typically this is finer-grained + * (greater) than `in_tb` and `out_tb` + * @param[in] duration Duration till the next call to this function (i.e. + * duration of the current packet/frame) + * @param[in,out] last Pointer to a timestamp expressed in terms of + * `fs_tb`, acting as a state variable + * @param[in] out_tb Output timebase + * @return Timestamp expressed in terms of `out_tb` + * + * @note In the context of this function, "duration" is in term of samples, not + * seconds. + */ +int64_t av_rescale_delta(AVRational in_tb, int64_t in_ts, AVRational fs_tb, int duration, int64_t *last, AVRational out_tb); + +/** + * Add a value to a timestamp. + * + * This function guarantees that when the same value is repeatly added that + * no accumulation of rounding errors occurs. + * + * @param[in] ts Input timestamp + * @param[in] ts_tb Input timestamp time base + * @param[in] inc Value to be added + * @param[in] inc_tb Time base of `inc` + */ +int64_t av_add_stable(AVRational ts_tb, int64_t ts, AVRational inc_tb, int64_t inc); + + +/** + * @} + */ + +#endif /* AVUTIL_MATHEMATICS_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/md5.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/md5.h new file mode 100644 index 0000000..ca72ccb --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/md5.h @@ -0,0 +1,98 @@ +/* + * copyright (c) 2006 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * @ingroup lavu_md5 + * Public header for MD5 hash function implementation. + */ + +#ifndef AVUTIL_MD5_H +#define AVUTIL_MD5_H + +#include +#include + +#include "attributes.h" +#include "version.h" + +/** + * @defgroup lavu_md5 MD5 + * @ingroup lavu_hash + * MD5 hash function implementation. + * + * @{ + */ + +extern const int av_md5_size; + +struct AVMD5; + +/** + * Allocate an AVMD5 context. + */ +struct AVMD5 *av_md5_alloc(void); + +/** + * Initialize MD5 hashing. + * + * @param ctx pointer to the function context (of size av_md5_size) + */ +void av_md5_init(struct AVMD5 *ctx); + +/** + * Update hash value. + * + * @param ctx hash function context + * @param src input data to update hash with + * @param len input data length + */ +#if FF_API_CRYPTO_SIZE_T +void av_md5_update(struct AVMD5 *ctx, const uint8_t *src, int len); +#else +void av_md5_update(struct AVMD5 *ctx, const uint8_t *src, size_t len); +#endif + +/** + * Finish hashing and output digest value. + * + * @param ctx hash function context + * @param dst buffer where output digest value is stored + */ +void av_md5_final(struct AVMD5 *ctx, uint8_t *dst); + +/** + * Hash an array of data. + * + * @param dst The output buffer to write the digest into + * @param src The data to hash + * @param len The length of the data, in bytes + */ +#if FF_API_CRYPTO_SIZE_T +void av_md5_sum(uint8_t *dst, const uint8_t *src, const int len); +#else +void av_md5_sum(uint8_t *dst, const uint8_t *src, size_t len); +#endif + +/** + * @} + */ + +#endif /* AVUTIL_MD5_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/mem.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/mem.h new file mode 100644 index 0000000..7e0b12a --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/mem.h @@ -0,0 +1,700 @@ +/* + * copyright (c) 2006 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * @ingroup lavu_mem + * Memory handling functions + */ + +#ifndef AVUTIL_MEM_H +#define AVUTIL_MEM_H + +#include +#include + +#include "attributes.h" +#include "error.h" +#include "avutil.h" + +/** + * @addtogroup lavu_mem + * Utilities for manipulating memory. + * + * FFmpeg has several applications of memory that are not required of a typical + * program. For example, the computing-heavy components like video decoding and + * encoding can be sped up significantly through the use of aligned memory. + * + * However, for each of FFmpeg's applications of memory, there might not be a + * recognized or standardized API for that specific use. Memory alignment, for + * instance, varies wildly depending on operating systems, architectures, and + * compilers. Hence, this component of @ref libavutil is created to make + * dealing with memory consistently possible on all platforms. + * + * @{ + * + * @defgroup lavu_mem_macros Alignment Macros + * Helper macros for declaring aligned variables. + * @{ + */ + +/** + * @def DECLARE_ALIGNED(n,t,v) + * Declare a variable that is aligned in memory. + * + * @code{.c} + * DECLARE_ALIGNED(16, uint16_t, aligned_int) = 42; + * DECLARE_ALIGNED(32, uint8_t, aligned_array)[128]; + * + * // The default-alignment equivalent would be + * uint16_t aligned_int = 42; + * uint8_t aligned_array[128]; + * @endcode + * + * @param n Minimum alignment in bytes + * @param t Type of the variable (or array element) + * @param v Name of the variable + */ + +/** + * @def DECLARE_ASM_ALIGNED(n,t,v) + * Declare an aligned variable appropriate for use in inline assembly code. + * + * @code{.c} + * DECLARE_ASM_ALIGNED(16, uint64_t, pw_08) = UINT64_C(0x0008000800080008); + * @endcode + * + * @param n Minimum alignment in bytes + * @param t Type of the variable (or array element) + * @param v Name of the variable + */ + +/** + * @def DECLARE_ASM_CONST(n,t,v) + * Declare a static constant aligned variable appropriate for use in inline + * assembly code. + * + * @code{.c} + * DECLARE_ASM_CONST(16, uint64_t, pw_08) = UINT64_C(0x0008000800080008); + * @endcode + * + * @param n Minimum alignment in bytes + * @param t Type of the variable (or array element) + * @param v Name of the variable + */ + +#if defined(__INTEL_COMPILER) && __INTEL_COMPILER < 1110 || defined(__SUNPRO_C) + #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v + #define DECLARE_ASM_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v + #define DECLARE_ASM_CONST(n,t,v) const t __attribute__ ((aligned (n))) v +#elif defined(__DJGPP__) + #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (FFMIN(n, 16)))) v + #define DECLARE_ASM_ALIGNED(n,t,v) t av_used __attribute__ ((aligned (FFMIN(n, 16)))) v + #define DECLARE_ASM_CONST(n,t,v) static const t av_used __attribute__ ((aligned (FFMIN(n, 16)))) v +#elif defined(__GNUC__) || defined(__clang__) + #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v + #define DECLARE_ASM_ALIGNED(n,t,v) t av_used __attribute__ ((aligned (n))) v + #define DECLARE_ASM_CONST(n,t,v) static const t av_used __attribute__ ((aligned (n))) v +#elif defined(_MSC_VER) + #define DECLARE_ALIGNED(n,t,v) __declspec(align(n)) t v + #define DECLARE_ASM_ALIGNED(n,t,v) __declspec(align(n)) t v + #define DECLARE_ASM_CONST(n,t,v) __declspec(align(n)) static const t v +#else + #define DECLARE_ALIGNED(n,t,v) t v + #define DECLARE_ASM_ALIGNED(n,t,v) t v + #define DECLARE_ASM_CONST(n,t,v) static const t v +#endif + +/** + * @} + */ + +/** + * @defgroup lavu_mem_attrs Function Attributes + * Function attributes applicable to memory handling functions. + * + * These function attributes can help compilers emit more useful warnings, or + * generate better code. + * @{ + */ + +/** + * @def av_malloc_attrib + * Function attribute denoting a malloc-like function. + * + * @see Function attribute `malloc` in GCC's documentation + */ + +#if AV_GCC_VERSION_AT_LEAST(3,1) + #define av_malloc_attrib __attribute__((__malloc__)) +#else + #define av_malloc_attrib +#endif + +/** + * @def av_alloc_size(...) + * Function attribute used on a function that allocates memory, whose size is + * given by the specified parameter(s). + * + * @code{.c} + * void *av_malloc(size_t size) av_alloc_size(1); + * void *av_calloc(size_t nmemb, size_t size) av_alloc_size(1, 2); + * @endcode + * + * @param ... One or two parameter indexes, separated by a comma + * + * @see Function attribute `alloc_size` in GCC's documentation + */ + +#if AV_GCC_VERSION_AT_LEAST(4,3) + #define av_alloc_size(...) __attribute__((alloc_size(__VA_ARGS__))) +#else + #define av_alloc_size(...) +#endif + +/** + * @} + */ + +/** + * @defgroup lavu_mem_funcs Heap Management + * Functions responsible for allocating, freeing, and copying memory. + * + * All memory allocation functions have a built-in upper limit of `INT_MAX` + * bytes. This may be changed with av_max_alloc(), although exercise extreme + * caution when doing so. + * + * @{ + */ + +/** + * Allocate a memory block with alignment suitable for all memory accesses + * (including vectors if available on the CPU). + * + * @param size Size in bytes for the memory block to be allocated + * @return Pointer to the allocated block, or `NULL` if the block cannot + * be allocated + * @see av_mallocz() + */ +void *av_malloc(size_t size) av_malloc_attrib av_alloc_size(1); + +/** + * Allocate a memory block with alignment suitable for all memory accesses + * (including vectors if available on the CPU) and zero all the bytes of the + * block. + * + * @param size Size in bytes for the memory block to be allocated + * @return Pointer to the allocated block, or `NULL` if it cannot be allocated + * @see av_malloc() + */ +void *av_mallocz(size_t size) av_malloc_attrib av_alloc_size(1); + +/** + * Allocate a memory block for an array with av_malloc(). + * + * The allocated memory will have size `size * nmemb` bytes. + * + * @param nmemb Number of element + * @param size Size of a single element + * @return Pointer to the allocated block, or `NULL` if the block cannot + * be allocated + * @see av_malloc() + */ +av_alloc_size(1, 2) void *av_malloc_array(size_t nmemb, size_t size); + +/** + * Allocate a memory block for an array with av_mallocz(). + * + * The allocated memory will have size `size * nmemb` bytes. + * + * @param nmemb Number of elements + * @param size Size of the single element + * @return Pointer to the allocated block, or `NULL` if the block cannot + * be allocated + * + * @see av_mallocz() + * @see av_malloc_array() + */ +av_alloc_size(1, 2) void *av_mallocz_array(size_t nmemb, size_t size); + +/** + * Non-inlined equivalent of av_mallocz_array(). + * + * Created for symmetry with the calloc() C function. + */ +void *av_calloc(size_t nmemb, size_t size) av_malloc_attrib; + +/** + * Allocate, reallocate, or free a block of memory. + * + * If `ptr` is `NULL` and `size` > 0, allocate a new block. If `size` is + * zero, free the memory block pointed to by `ptr`. Otherwise, expand or + * shrink that block of memory according to `size`. + * + * @param ptr Pointer to a memory block already allocated with + * av_realloc() or `NULL` + * @param size Size in bytes of the memory block to be allocated or + * reallocated + * + * @return Pointer to a newly-reallocated block or `NULL` if the block + * cannot be reallocated or the function is used to free the memory block + * + * @warning Unlike av_malloc(), the returned pointer is not guaranteed to be + * correctly aligned. + * @see av_fast_realloc() + * @see av_reallocp() + */ +void *av_realloc(void *ptr, size_t size) av_alloc_size(2); + +/** + * Allocate, reallocate, or free a block of memory through a pointer to a + * pointer. + * + * If `*ptr` is `NULL` and `size` > 0, allocate a new block. If `size` is + * zero, free the memory block pointed to by `*ptr`. Otherwise, expand or + * shrink that block of memory according to `size`. + * + * @param[in,out] ptr Pointer to a pointer to a memory block already allocated + * with av_realloc(), or a pointer to `NULL`. The pointer + * is updated on success, or freed on failure. + * @param[in] size Size in bytes for the memory block to be allocated or + * reallocated + * + * @return Zero on success, an AVERROR error code on failure + * + * @warning Unlike av_malloc(), the allocated memory is not guaranteed to be + * correctly aligned. + */ +av_warn_unused_result +int av_reallocp(void *ptr, size_t size); + +/** + * Allocate, reallocate, or free a block of memory. + * + * This function does the same thing as av_realloc(), except: + * - It takes two size arguments and allocates `nelem * elsize` bytes, + * after checking the result of the multiplication for integer overflow. + * - It frees the input block in case of failure, thus avoiding the memory + * leak with the classic + * @code{.c} + * buf = realloc(buf); + * if (!buf) + * return -1; + * @endcode + * pattern. + */ +void *av_realloc_f(void *ptr, size_t nelem, size_t elsize); + +/** + * Allocate, reallocate, or free an array. + * + * If `ptr` is `NULL` and `nmemb` > 0, allocate a new block. If + * `nmemb` is zero, free the memory block pointed to by `ptr`. + * + * @param ptr Pointer to a memory block already allocated with + * av_realloc() or `NULL` + * @param nmemb Number of elements in the array + * @param size Size of the single element of the array + * + * @return Pointer to a newly-reallocated block or NULL if the block + * cannot be reallocated or the function is used to free the memory block + * + * @warning Unlike av_malloc(), the allocated memory is not guaranteed to be + * correctly aligned. + * @see av_reallocp_array() + */ +av_alloc_size(2, 3) void *av_realloc_array(void *ptr, size_t nmemb, size_t size); + +/** + * Allocate, reallocate, or free an array through a pointer to a pointer. + * + * If `*ptr` is `NULL` and `nmemb` > 0, allocate a new block. If `nmemb` is + * zero, free the memory block pointed to by `*ptr`. + * + * @param[in,out] ptr Pointer to a pointer to a memory block already + * allocated with av_realloc(), or a pointer to `NULL`. + * The pointer is updated on success, or freed on failure. + * @param[in] nmemb Number of elements + * @param[in] size Size of the single element + * + * @return Zero on success, an AVERROR error code on failure + * + * @warning Unlike av_malloc(), the allocated memory is not guaranteed to be + * correctly aligned. + */ +av_alloc_size(2, 3) int av_reallocp_array(void *ptr, size_t nmemb, size_t size); + +/** + * Reallocate the given buffer if it is not large enough, otherwise do nothing. + * + * If the given buffer is `NULL`, then a new uninitialized buffer is allocated. + * + * If the given buffer is not large enough, and reallocation fails, `NULL` is + * returned and `*size` is set to 0, but the original buffer is not changed or + * freed. + * + * A typical use pattern follows: + * + * @code{.c} + * uint8_t *buf = ...; + * uint8_t *new_buf = av_fast_realloc(buf, ¤t_size, size_needed); + * if (!new_buf) { + * // Allocation failed; clean up original buffer + * av_freep(&buf); + * return AVERROR(ENOMEM); + * } + * @endcode + * + * @param[in,out] ptr Already allocated buffer, or `NULL` + * @param[in,out] size Pointer to current size of buffer `ptr`. `*size` is + * changed to `min_size` in case of success or 0 in + * case of failure + * @param[in] min_size New size of buffer `ptr` + * @return `ptr` if the buffer is large enough, a pointer to newly reallocated + * buffer if the buffer was not large enough, or `NULL` in case of + * error + * @see av_realloc() + * @see av_fast_malloc() + */ +void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size); + +/** + * Allocate a buffer, reusing the given one if large enough. + * + * Contrary to av_fast_realloc(), the current buffer contents might not be + * preserved and on error the old buffer is freed, thus no special handling to + * avoid memleaks is necessary. + * + * `*ptr` is allowed to be `NULL`, in which case allocation always happens if + * `size_needed` is greater than 0. + * + * @code{.c} + * uint8_t *buf = ...; + * av_fast_malloc(&buf, ¤t_size, size_needed); + * if (!buf) { + * // Allocation failed; buf already freed + * return AVERROR(ENOMEM); + * } + * @endcode + * + * @param[in,out] ptr Pointer to pointer to an already allocated buffer. + * `*ptr` will be overwritten with pointer to new + * buffer on success or `NULL` on failure + * @param[in,out] size Pointer to current size of buffer `*ptr`. `*size` is + * changed to `min_size` in case of success or 0 in + * case of failure + * @param[in] min_size New size of buffer `*ptr` + * @see av_realloc() + * @see av_fast_mallocz() + */ +void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size); + +/** + * Allocate and clear a buffer, reusing the given one if large enough. + * + * Like av_fast_malloc(), but all newly allocated space is initially cleared. + * Reused buffer is not cleared. + * + * `*ptr` is allowed to be `NULL`, in which case allocation always happens if + * `size_needed` is greater than 0. + * + * @param[in,out] ptr Pointer to pointer to an already allocated buffer. + * `*ptr` will be overwritten with pointer to new + * buffer on success or `NULL` on failure + * @param[in,out] size Pointer to current size of buffer `*ptr`. `*size` is + * changed to `min_size` in case of success or 0 in + * case of failure + * @param[in] min_size New size of buffer `*ptr` + * @see av_fast_malloc() + */ +void av_fast_mallocz(void *ptr, unsigned int *size, size_t min_size); + +/** + * Free a memory block which has been allocated with a function of av_malloc() + * or av_realloc() family. + * + * @param ptr Pointer to the memory block which should be freed. + * + * @note `ptr = NULL` is explicitly allowed. + * @note It is recommended that you use av_freep() instead, to prevent leaving + * behind dangling pointers. + * @see av_freep() + */ +void av_free(void *ptr); + +/** + * Free a memory block which has been allocated with a function of av_malloc() + * or av_realloc() family, and set the pointer pointing to it to `NULL`. + * + * @code{.c} + * uint8_t *buf = av_malloc(16); + * av_free(buf); + * // buf now contains a dangling pointer to freed memory, and accidental + * // dereference of buf will result in a use-after-free, which may be a + * // security risk. + * + * uint8_t *buf = av_malloc(16); + * av_freep(&buf); + * // buf is now NULL, and accidental dereference will only result in a + * // NULL-pointer dereference. + * @endcode + * + * @param ptr Pointer to the pointer to the memory block which should be freed + * @note `*ptr = NULL` is safe and leads to no action. + * @see av_free() + */ +void av_freep(void *ptr); + +/** + * Duplicate a string. + * + * @param s String to be duplicated + * @return Pointer to a newly-allocated string containing a + * copy of `s` or `NULL` if the string cannot be allocated + * @see av_strndup() + */ +char *av_strdup(const char *s) av_malloc_attrib; + +/** + * Duplicate a substring of a string. + * + * @param s String to be duplicated + * @param len Maximum length of the resulting string (not counting the + * terminating byte) + * @return Pointer to a newly-allocated string containing a + * substring of `s` or `NULL` if the string cannot be allocated + */ +char *av_strndup(const char *s, size_t len) av_malloc_attrib; + +/** + * Duplicate a buffer with av_malloc(). + * + * @param p Buffer to be duplicated + * @param size Size in bytes of the buffer copied + * @return Pointer to a newly allocated buffer containing a + * copy of `p` or `NULL` if the buffer cannot be allocated + */ +void *av_memdup(const void *p, size_t size); + +/** + * Overlapping memcpy() implementation. + * + * @param dst Destination buffer + * @param back Number of bytes back to start copying (i.e. the initial size of + * the overlapping window); must be > 0 + * @param cnt Number of bytes to copy; must be >= 0 + * + * @note `cnt > back` is valid, this will copy the bytes we just copied, + * thus creating a repeating pattern with a period length of `back`. + */ +void av_memcpy_backptr(uint8_t *dst, int back, int cnt); + +/** + * @} + */ + +/** + * @defgroup lavu_mem_dynarray Dynamic Array + * + * Utilities to make an array grow when needed. + * + * Sometimes, the programmer would want to have an array that can grow when + * needed. The libavutil dynamic array utilities fill that need. + * + * libavutil supports two systems of appending elements onto a dynamically + * allocated array, the first one storing the pointer to the value in the + * array, and the second storing the value directly. In both systems, the + * caller is responsible for maintaining a variable containing the length of + * the array, as well as freeing of the array after use. + * + * The first system stores pointers to values in a block of dynamically + * allocated memory. Since only pointers are stored, the function does not need + * to know the size of the type. Both av_dynarray_add() and + * av_dynarray_add_nofree() implement this system. + * + * @code + * type **array = NULL; //< an array of pointers to values + * int nb = 0; //< a variable to keep track of the length of the array + * + * type to_be_added = ...; + * type to_be_added2 = ...; + * + * av_dynarray_add(&array, &nb, &to_be_added); + * if (nb == 0) + * return AVERROR(ENOMEM); + * + * av_dynarray_add(&array, &nb, &to_be_added2); + * if (nb == 0) + * return AVERROR(ENOMEM); + * + * // Now: + * // nb == 2 + * // &to_be_added == array[0] + * // &to_be_added2 == array[1] + * + * av_freep(&array); + * @endcode + * + * The second system stores the value directly in a block of memory. As a + * result, the function has to know the size of the type. av_dynarray2_add() + * implements this mechanism. + * + * @code + * type *array = NULL; //< an array of values + * int nb = 0; //< a variable to keep track of the length of the array + * + * type to_be_added = ...; + * type to_be_added2 = ...; + * + * type *addr = av_dynarray2_add((void **)&array, &nb, sizeof(*array), NULL); + * if (!addr) + * return AVERROR(ENOMEM); + * memcpy(addr, &to_be_added, sizeof(to_be_added)); + * + * // Shortcut of the above. + * type *addr = av_dynarray2_add((void **)&array, &nb, sizeof(*array), + * (const void *)&to_be_added2); + * if (!addr) + * return AVERROR(ENOMEM); + * + * // Now: + * // nb == 2 + * // to_be_added == array[0] + * // to_be_added2 == array[1] + * + * av_freep(&array); + * @endcode + * + * @{ + */ + +/** + * Add the pointer to an element to a dynamic array. + * + * The array to grow is supposed to be an array of pointers to + * structures, and the element to add must be a pointer to an already + * allocated structure. + * + * The array is reallocated when its size reaches powers of 2. + * Therefore, the amortized cost of adding an element is constant. + * + * In case of success, the pointer to the array is updated in order to + * point to the new grown array, and the number pointed to by `nb_ptr` + * is incremented. + * In case of failure, the array is freed, `*tab_ptr` is set to `NULL` and + * `*nb_ptr` is set to 0. + * + * @param[in,out] tab_ptr Pointer to the array to grow + * @param[in,out] nb_ptr Pointer to the number of elements in the array + * @param[in] elem Element to add + * @see av_dynarray_add_nofree(), av_dynarray2_add() + */ +void av_dynarray_add(void *tab_ptr, int *nb_ptr, void *elem); + +/** + * Add an element to a dynamic array. + * + * Function has the same functionality as av_dynarray_add(), + * but it doesn't free memory on fails. It returns error code + * instead and leave current buffer untouched. + * + * @return >=0 on success, negative otherwise + * @see av_dynarray_add(), av_dynarray2_add() + */ +av_warn_unused_result +int av_dynarray_add_nofree(void *tab_ptr, int *nb_ptr, void *elem); + +/** + * Add an element of size `elem_size` to a dynamic array. + * + * The array is reallocated when its number of elements reaches powers of 2. + * Therefore, the amortized cost of adding an element is constant. + * + * In case of success, the pointer to the array is updated in order to + * point to the new grown array, and the number pointed to by `nb_ptr` + * is incremented. + * In case of failure, the array is freed, `*tab_ptr` is set to `NULL` and + * `*nb_ptr` is set to 0. + * + * @param[in,out] tab_ptr Pointer to the array to grow + * @param[in,out] nb_ptr Pointer to the number of elements in the array + * @param[in] elem_size Size in bytes of an element in the array + * @param[in] elem_data Pointer to the data of the element to add. If + * `NULL`, the space of the newly added element is + * allocated but left uninitialized. + * + * @return Pointer to the data of the element to copy in the newly allocated + * space + * @see av_dynarray_add(), av_dynarray_add_nofree() + */ +void *av_dynarray2_add(void **tab_ptr, int *nb_ptr, size_t elem_size, + const uint8_t *elem_data); + +/** + * @} + */ + +/** + * @defgroup lavu_mem_misc Miscellaneous Functions + * + * Other functions related to memory allocation. + * + * @{ + */ + +/** + * Multiply two `size_t` values checking for overflow. + * + * @param[in] a,b Operands of multiplication + * @param[out] r Pointer to the result of the operation + * @return 0 on success, AVERROR(EINVAL) on overflow + */ +static inline int av_size_mult(size_t a, size_t b, size_t *r) +{ + size_t t = a * b; + /* Hack inspired from glibc: don't try the division if nelem and elsize + * are both less than sqrt(SIZE_MAX). */ + if ((a | b) >= ((size_t)1 << (sizeof(size_t) * 4)) && a && t / a != b) + return AVERROR(EINVAL); + *r = t; + return 0; +} + +/** + * Set the maximum size that may be allocated in one block. + * + * The value specified with this function is effective for all libavutil's @ref + * lavu_mem_funcs "heap management functions." + * + * By default, the max value is defined as `INT_MAX`. + * + * @param max Value to be set as the new maximum size + * + * @warning Exercise extreme caution when using this function. Don't touch + * this if you do not understand the full consequence of doing so. + */ +void av_max_alloc(size_t max); + +/** + * @} + * @} + */ + +#endif /* AVUTIL_MEM_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/motion_vector.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/motion_vector.h new file mode 100644 index 0000000..ec29556 --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/motion_vector.h @@ -0,0 +1,57 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_MOTION_VECTOR_H +#define AVUTIL_MOTION_VECTOR_H + +#include + +typedef struct AVMotionVector { + /** + * Where the current macroblock comes from; negative value when it comes + * from the past, positive value when it comes from the future. + * XXX: set exact relative ref frame reference instead of a +/- 1 "direction". + */ + int32_t source; + /** + * Width and height of the block. + */ + uint8_t w, h; + /** + * Absolute source position. Can be outside the frame area. + */ + int16_t src_x, src_y; + /** + * Absolute destination position. Can be outside the frame area. + */ + int16_t dst_x, dst_y; + /** + * Extra flag information. + * Currently unused. + */ + uint64_t flags; + /** + * Motion vector + * src_x = dst_x + motion_x / motion_scale + * src_y = dst_y + motion_y / motion_scale + */ + int32_t motion_x, motion_y; + uint16_t motion_scale; +} AVMotionVector; + +#endif /* AVUTIL_MOTION_VECTOR_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/murmur3.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/murmur3.h new file mode 100644 index 0000000..1b09175 --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/murmur3.h @@ -0,0 +1,120 @@ +/* + * Copyright (C) 2013 Reimar Döffinger + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * @ingroup lavu_murmur3 + * Public header for MurmurHash3 hash function implementation. + */ + +#ifndef AVUTIL_MURMUR3_H +#define AVUTIL_MURMUR3_H + +#include + +#include "version.h" + +/** + * @defgroup lavu_murmur3 Murmur3 + * @ingroup lavu_hash + * MurmurHash3 hash function implementation. + * + * MurmurHash3 is a non-cryptographic hash function, of which three + * incompatible versions were created by its inventor Austin Appleby: + * + * - 32-bit output + * - 128-bit output for 32-bit platforms + * - 128-bit output for 64-bit platforms + * + * FFmpeg only implements the last variant: 128-bit output designed for 64-bit + * platforms. Even though the hash function was designed for 64-bit platforms, + * the function in reality works on 32-bit systems too, only with reduced + * performance. + * + * @anchor lavu_murmur3_seedinfo + * By design, MurmurHash3 requires a seed to operate. In response to this, + * libavutil provides two functions for hash initiation, one that requires a + * seed (av_murmur3_init_seeded()) and one that uses a fixed arbitrary integer + * as the seed, and therefore does not (av_murmur3_init()). + * + * To make hashes comparable, you should provide the same seed for all calls to + * this hash function -- if you are supplying one yourself, that is. + * + * @{ + */ + +/** + * Allocate an AVMurMur3 hash context. + * + * @return Uninitialized hash context or `NULL` in case of error + */ +struct AVMurMur3 *av_murmur3_alloc(void); + +/** + * Initialize or reinitialize an AVMurMur3 hash context with a seed. + * + * @param[out] c Hash context + * @param[in] seed Random seed + * + * @see av_murmur3_init() + * @see @ref lavu_murmur3_seedinfo "Detailed description" on a discussion of + * seeds for MurmurHash3. + */ +void av_murmur3_init_seeded(struct AVMurMur3 *c, uint64_t seed); + +/** + * Initialize or reinitialize an AVMurMur3 hash context. + * + * Equivalent to av_murmur3_init_seeded() with a built-in seed. + * + * @param[out] c Hash context + * + * @see av_murmur3_init_seeded() + * @see @ref lavu_murmur3_seedinfo "Detailed description" on a discussion of + * seeds for MurmurHash3. + */ +void av_murmur3_init(struct AVMurMur3 *c); + +/** + * Update hash context with new data. + * + * @param[out] c Hash context + * @param[in] src Input data to update hash with + * @param[in] len Number of bytes to read from `src` + */ +#if FF_API_CRYPTO_SIZE_T +void av_murmur3_update(struct AVMurMur3 *c, const uint8_t *src, int len); +#else +void av_murmur3_update(struct AVMurMur3 *c, const uint8_t *src, size_t len); +#endif + +/** + * Finish hashing and output digest value. + * + * @param[in,out] c Hash context + * @param[out] dst Buffer where output digest value is stored + */ +void av_murmur3_final(struct AVMurMur3 *c, uint8_t dst[16]); + +/** + * @} + */ + +#endif /* AVUTIL_MURMUR3_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/opt.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/opt.h new file mode 100644 index 0000000..07da68e --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/opt.h @@ -0,0 +1,864 @@ +/* + * AVOptions + * copyright (c) 2005 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_OPT_H +#define AVUTIL_OPT_H + +/** + * @file + * AVOptions + */ + +#include "rational.h" +#include "avutil.h" +#include "dict.h" +#include "log.h" +#include "pixfmt.h" +#include "samplefmt.h" +#include "version.h" + +/** + * @defgroup avoptions AVOptions + * @ingroup lavu_data + * @{ + * AVOptions provide a generic system to declare options on arbitrary structs + * ("objects"). An option can have a help text, a type and a range of possible + * values. Options may then be enumerated, read and written to. + * + * @section avoptions_implement Implementing AVOptions + * This section describes how to add AVOptions capabilities to a struct. + * + * All AVOptions-related information is stored in an AVClass. Therefore + * the first member of the struct should be a pointer to an AVClass describing it. + * The option field of the AVClass must be set to a NULL-terminated static array + * of AVOptions. Each AVOption must have a non-empty name, a type, a default + * value and for number-type AVOptions also a range of allowed values. It must + * also declare an offset in bytes from the start of the struct, where the field + * associated with this AVOption is located. Other fields in the AVOption struct + * should also be set when applicable, but are not required. + * + * The following example illustrates an AVOptions-enabled struct: + * @code + * typedef struct test_struct { + * const AVClass *class; + * int int_opt; + * char *str_opt; + * uint8_t *bin_opt; + * int bin_len; + * } test_struct; + * + * static const AVOption test_options[] = { + * { "test_int", "This is a test option of int type.", offsetof(test_struct, int_opt), + * AV_OPT_TYPE_INT, { .i64 = -1 }, INT_MIN, INT_MAX }, + * { "test_str", "This is a test option of string type.", offsetof(test_struct, str_opt), + * AV_OPT_TYPE_STRING }, + * { "test_bin", "This is a test option of binary type.", offsetof(test_struct, bin_opt), + * AV_OPT_TYPE_BINARY }, + * { NULL }, + * }; + * + * static const AVClass test_class = { + * .class_name = "test class", + * .item_name = av_default_item_name, + * .option = test_options, + * .version = LIBAVUTIL_VERSION_INT, + * }; + * @endcode + * + * Next, when allocating your struct, you must ensure that the AVClass pointer + * is set to the correct value. Then, av_opt_set_defaults() can be called to + * initialize defaults. After that the struct is ready to be used with the + * AVOptions API. + * + * When cleaning up, you may use the av_opt_free() function to automatically + * free all the allocated string and binary options. + * + * Continuing with the above example: + * + * @code + * test_struct *alloc_test_struct(void) + * { + * test_struct *ret = av_mallocz(sizeof(*ret)); + * ret->class = &test_class; + * av_opt_set_defaults(ret); + * return ret; + * } + * void free_test_struct(test_struct **foo) + * { + * av_opt_free(*foo); + * av_freep(foo); + * } + * @endcode + * + * @subsection avoptions_implement_nesting Nesting + * It may happen that an AVOptions-enabled struct contains another + * AVOptions-enabled struct as a member (e.g. AVCodecContext in + * libavcodec exports generic options, while its priv_data field exports + * codec-specific options). In such a case, it is possible to set up the + * parent struct to export a child's options. To do that, simply + * implement AVClass.child_next() and AVClass.child_class_next() in the + * parent struct's AVClass. + * Assuming that the test_struct from above now also contains a + * child_struct field: + * + * @code + * typedef struct child_struct { + * AVClass *class; + * int flags_opt; + * } child_struct; + * static const AVOption child_opts[] = { + * { "test_flags", "This is a test option of flags type.", + * offsetof(child_struct, flags_opt), AV_OPT_TYPE_FLAGS, { .i64 = 0 }, INT_MIN, INT_MAX }, + * { NULL }, + * }; + * static const AVClass child_class = { + * .class_name = "child class", + * .item_name = av_default_item_name, + * .option = child_opts, + * .version = LIBAVUTIL_VERSION_INT, + * }; + * + * void *child_next(void *obj, void *prev) + * { + * test_struct *t = obj; + * if (!prev && t->child_struct) + * return t->child_struct; + * return NULL + * } + * const AVClass child_class_next(const AVClass *prev) + * { + * return prev ? NULL : &child_class; + * } + * @endcode + * Putting child_next() and child_class_next() as defined above into + * test_class will now make child_struct's options accessible through + * test_struct (again, proper setup as described above needs to be done on + * child_struct right after it is created). + * + * From the above example it might not be clear why both child_next() + * and child_class_next() are needed. The distinction is that child_next() + * iterates over actually existing objects, while child_class_next() + * iterates over all possible child classes. E.g. if an AVCodecContext + * was initialized to use a codec which has private options, then its + * child_next() will return AVCodecContext.priv_data and finish + * iterating. OTOH child_class_next() on AVCodecContext.av_class will + * iterate over all available codecs with private options. + * + * @subsection avoptions_implement_named_constants Named constants + * It is possible to create named constants for options. Simply set the unit + * field of the option the constants should apply to a string and + * create the constants themselves as options of type AV_OPT_TYPE_CONST + * with their unit field set to the same string. + * Their default_val field should contain the value of the named + * constant. + * For example, to add some named constants for the test_flags option + * above, put the following into the child_opts array: + * @code + * { "test_flags", "This is a test option of flags type.", + * offsetof(child_struct, flags_opt), AV_OPT_TYPE_FLAGS, { .i64 = 0 }, INT_MIN, INT_MAX, "test_unit" }, + * { "flag1", "This is a flag with value 16", 0, AV_OPT_TYPE_CONST, { .i64 = 16 }, 0, 0, "test_unit" }, + * @endcode + * + * @section avoptions_use Using AVOptions + * This section deals with accessing options in an AVOptions-enabled struct. + * Such structs in FFmpeg are e.g. AVCodecContext in libavcodec or + * AVFormatContext in libavformat. + * + * @subsection avoptions_use_examine Examining AVOptions + * The basic functions for examining options are av_opt_next(), which iterates + * over all options defined for one object, and av_opt_find(), which searches + * for an option with the given name. + * + * The situation is more complicated with nesting. An AVOptions-enabled struct + * may have AVOptions-enabled children. Passing the AV_OPT_SEARCH_CHILDREN flag + * to av_opt_find() will make the function search children recursively. + * + * For enumerating there are basically two cases. The first is when you want to + * get all options that may potentially exist on the struct and its children + * (e.g. when constructing documentation). In that case you should call + * av_opt_child_class_next() recursively on the parent struct's AVClass. The + * second case is when you have an already initialized struct with all its + * children and you want to get all options that can be actually written or read + * from it. In that case you should call av_opt_child_next() recursively (and + * av_opt_next() on each result). + * + * @subsection avoptions_use_get_set Reading and writing AVOptions + * When setting options, you often have a string read directly from the + * user. In such a case, simply passing it to av_opt_set() is enough. For + * non-string type options, av_opt_set() will parse the string according to the + * option type. + * + * Similarly av_opt_get() will read any option type and convert it to a string + * which will be returned. Do not forget that the string is allocated, so you + * have to free it with av_free(). + * + * In some cases it may be more convenient to put all options into an + * AVDictionary and call av_opt_set_dict() on it. A specific case of this + * are the format/codec open functions in lavf/lavc which take a dictionary + * filled with option as a parameter. This makes it possible to set some options + * that cannot be set otherwise, since e.g. the input file format is not known + * before the file is actually opened. + */ + +enum AVOptionType{ + AV_OPT_TYPE_FLAGS, + AV_OPT_TYPE_INT, + AV_OPT_TYPE_INT64, + AV_OPT_TYPE_DOUBLE, + AV_OPT_TYPE_FLOAT, + AV_OPT_TYPE_STRING, + AV_OPT_TYPE_RATIONAL, + AV_OPT_TYPE_BINARY, ///< offset must point to a pointer immediately followed by an int for the length + AV_OPT_TYPE_DICT, + AV_OPT_TYPE_UINT64, + AV_OPT_TYPE_CONST, + AV_OPT_TYPE_IMAGE_SIZE, ///< offset must point to two consecutive integers + AV_OPT_TYPE_PIXEL_FMT, + AV_OPT_TYPE_SAMPLE_FMT, + AV_OPT_TYPE_VIDEO_RATE, ///< offset must point to AVRational + AV_OPT_TYPE_DURATION, + AV_OPT_TYPE_COLOR, + AV_OPT_TYPE_CHANNEL_LAYOUT, + AV_OPT_TYPE_BOOL, +}; + +/** + * AVOption + */ +typedef struct AVOption { + const char *name; + + /** + * short English help text + * @todo What about other languages? + */ + const char *help; + + /** + * The offset relative to the context structure where the option + * value is stored. It should be 0 for named constants. + */ + int offset; + enum AVOptionType type; + + /** + * the default value for scalar options + */ + union { + int64_t i64; + double dbl; + const char *str; + /* TODO those are unused now */ + AVRational q; + } default_val; + double min; ///< minimum valid value for the option + double max; ///< maximum valid value for the option + + int flags; +#define AV_OPT_FLAG_ENCODING_PARAM 1 ///< a generic parameter which can be set by the user for muxing or encoding +#define AV_OPT_FLAG_DECODING_PARAM 2 ///< a generic parameter which can be set by the user for demuxing or decoding +#define AV_OPT_FLAG_AUDIO_PARAM 8 +#define AV_OPT_FLAG_VIDEO_PARAM 16 +#define AV_OPT_FLAG_SUBTITLE_PARAM 32 +/** + * The option is intended for exporting values to the caller. + */ +#define AV_OPT_FLAG_EXPORT 64 +/** + * The option may not be set through the AVOptions API, only read. + * This flag only makes sense when AV_OPT_FLAG_EXPORT is also set. + */ +#define AV_OPT_FLAG_READONLY 128 +#define AV_OPT_FLAG_BSF_PARAM (1<<8) ///< a generic parameter which can be set by the user for bit stream filtering +#define AV_OPT_FLAG_FILTERING_PARAM (1<<16) ///< a generic parameter which can be set by the user for filtering +//FIXME think about enc-audio, ... style flags + + /** + * The logical unit to which the option belongs. Non-constant + * options and corresponding named constants share the same + * unit. May be NULL. + */ + const char *unit; +} AVOption; + +/** + * A single allowed range of values, or a single allowed value. + */ +typedef struct AVOptionRange { + const char *str; + /** + * Value range. + * For string ranges this represents the min/max length. + * For dimensions this represents the min/max pixel count or width/height in multi-component case. + */ + double value_min, value_max; + /** + * Value's component range. + * For string this represents the unicode range for chars, 0-127 limits to ASCII. + */ + double component_min, component_max; + /** + * Range flag. + * If set to 1 the struct encodes a range, if set to 0 a single value. + */ + int is_range; +} AVOptionRange; + +/** + * List of AVOptionRange structs. + */ +typedef struct AVOptionRanges { + /** + * Array of option ranges. + * + * Most of option types use just one component. + * Following describes multi-component option types: + * + * AV_OPT_TYPE_IMAGE_SIZE: + * component index 0: range of pixel count (width * height). + * component index 1: range of width. + * component index 2: range of height. + * + * @note To obtain multi-component version of this structure, user must + * provide AV_OPT_MULTI_COMPONENT_RANGE to av_opt_query_ranges or + * av_opt_query_ranges_default function. + * + * Multi-component range can be read as in following example: + * + * @code + * int range_index, component_index; + * AVOptionRanges *ranges; + * AVOptionRange *range[3]; //may require more than 3 in the future. + * av_opt_query_ranges(&ranges, obj, key, AV_OPT_MULTI_COMPONENT_RANGE); + * for (range_index = 0; range_index < ranges->nb_ranges; range_index++) { + * for (component_index = 0; component_index < ranges->nb_components; component_index++) + * range[component_index] = ranges->range[ranges->nb_ranges * component_index + range_index]; + * //do something with range here. + * } + * av_opt_freep_ranges(&ranges); + * @endcode + */ + AVOptionRange **range; + /** + * Number of ranges per component. + */ + int nb_ranges; + /** + * Number of componentes. + */ + int nb_components; +} AVOptionRanges; + +/** + * Show the obj options. + * + * @param req_flags requested flags for the options to show. Show only the + * options for which it is opt->flags & req_flags. + * @param rej_flags rejected flags for the options to show. Show only the + * options for which it is !(opt->flags & req_flags). + * @param av_log_obj log context to use for showing the options + */ +int av_opt_show2(void *obj, void *av_log_obj, int req_flags, int rej_flags); + +/** + * Set the values of all AVOption fields to their default values. + * + * @param s an AVOption-enabled struct (its first member must be a pointer to AVClass) + */ +void av_opt_set_defaults(void *s); + +/** + * Set the values of all AVOption fields to their default values. Only these + * AVOption fields for which (opt->flags & mask) == flags will have their + * default applied to s. + * + * @param s an AVOption-enabled struct (its first member must be a pointer to AVClass) + * @param mask combination of AV_OPT_FLAG_* + * @param flags combination of AV_OPT_FLAG_* + */ +void av_opt_set_defaults2(void *s, int mask, int flags); + +/** + * Parse the key/value pairs list in opts. For each key/value pair + * found, stores the value in the field in ctx that is named like the + * key. ctx must be an AVClass context, storing is done using + * AVOptions. + * + * @param opts options string to parse, may be NULL + * @param key_val_sep a 0-terminated list of characters used to + * separate key from value + * @param pairs_sep a 0-terminated list of characters used to separate + * two pairs from each other + * @return the number of successfully set key/value pairs, or a negative + * value corresponding to an AVERROR code in case of error: + * AVERROR(EINVAL) if opts cannot be parsed, + * the error code issued by av_opt_set() if a key/value pair + * cannot be set + */ +int av_set_options_string(void *ctx, const char *opts, + const char *key_val_sep, const char *pairs_sep); + +/** + * Parse the key-value pairs list in opts. For each key=value pair found, + * set the value of the corresponding option in ctx. + * + * @param ctx the AVClass object to set options on + * @param opts the options string, key-value pairs separated by a + * delimiter + * @param shorthand a NULL-terminated array of options names for shorthand + * notation: if the first field in opts has no key part, + * the key is taken from the first element of shorthand; + * then again for the second, etc., until either opts is + * finished, shorthand is finished or a named option is + * found; after that, all options must be named + * @param key_val_sep a 0-terminated list of characters used to separate + * key from value, for example '=' + * @param pairs_sep a 0-terminated list of characters used to separate + * two pairs from each other, for example ':' or ',' + * @return the number of successfully set key=value pairs, or a negative + * value corresponding to an AVERROR code in case of error: + * AVERROR(EINVAL) if opts cannot be parsed, + * the error code issued by av_set_string3() if a key/value pair + * cannot be set + * + * Options names must use only the following characters: a-z A-Z 0-9 - . / _ + * Separators must use characters distinct from option names and from each + * other. + */ +int av_opt_set_from_string(void *ctx, const char *opts, + const char *const *shorthand, + const char *key_val_sep, const char *pairs_sep); +/** + * Free all allocated objects in obj. + */ +void av_opt_free(void *obj); + +/** + * Check whether a particular flag is set in a flags field. + * + * @param field_name the name of the flag field option + * @param flag_name the name of the flag to check + * @return non-zero if the flag is set, zero if the flag isn't set, + * isn't of the right type, or the flags field doesn't exist. + */ +int av_opt_flag_is_set(void *obj, const char *field_name, const char *flag_name); + +/** + * Set all the options from a given dictionary on an object. + * + * @param obj a struct whose first element is a pointer to AVClass + * @param options options to process. This dictionary will be freed and replaced + * by a new one containing all options not found in obj. + * Of course this new dictionary needs to be freed by caller + * with av_dict_free(). + * + * @return 0 on success, a negative AVERROR if some option was found in obj, + * but could not be set. + * + * @see av_dict_copy() + */ +int av_opt_set_dict(void *obj, struct AVDictionary **options); + + +/** + * Set all the options from a given dictionary on an object. + * + * @param obj a struct whose first element is a pointer to AVClass + * @param options options to process. This dictionary will be freed and replaced + * by a new one containing all options not found in obj. + * Of course this new dictionary needs to be freed by caller + * with av_dict_free(). + * @param search_flags A combination of AV_OPT_SEARCH_*. + * + * @return 0 on success, a negative AVERROR if some option was found in obj, + * but could not be set. + * + * @see av_dict_copy() + */ +int av_opt_set_dict2(void *obj, struct AVDictionary **options, int search_flags); + +/** + * Extract a key-value pair from the beginning of a string. + * + * @param ropts pointer to the options string, will be updated to + * point to the rest of the string (one of the pairs_sep + * or the final NUL) + * @param key_val_sep a 0-terminated list of characters used to separate + * key from value, for example '=' + * @param pairs_sep a 0-terminated list of characters used to separate + * two pairs from each other, for example ':' or ',' + * @param flags flags; see the AV_OPT_FLAG_* values below + * @param rkey parsed key; must be freed using av_free() + * @param rval parsed value; must be freed using av_free() + * + * @return >=0 for success, or a negative value corresponding to an + * AVERROR code in case of error; in particular: + * AVERROR(EINVAL) if no key is present + * + */ +int av_opt_get_key_value(const char **ropts, + const char *key_val_sep, const char *pairs_sep, + unsigned flags, + char **rkey, char **rval); + +enum { + + /** + * Accept to parse a value without a key; the key will then be returned + * as NULL. + */ + AV_OPT_FLAG_IMPLICIT_KEY = 1, +}; + +/** + * @defgroup opt_eval_funcs Evaluating option strings + * @{ + * This group of functions can be used to evaluate option strings + * and get numbers out of them. They do the same thing as av_opt_set(), + * except the result is written into the caller-supplied pointer. + * + * @param obj a struct whose first element is a pointer to AVClass. + * @param o an option for which the string is to be evaluated. + * @param val string to be evaluated. + * @param *_out value of the string will be written here. + * + * @return 0 on success, a negative number on failure. + */ +int av_opt_eval_flags (void *obj, const AVOption *o, const char *val, int *flags_out); +int av_opt_eval_int (void *obj, const AVOption *o, const char *val, int *int_out); +int av_opt_eval_int64 (void *obj, const AVOption *o, const char *val, int64_t *int64_out); +int av_opt_eval_float (void *obj, const AVOption *o, const char *val, float *float_out); +int av_opt_eval_double(void *obj, const AVOption *o, const char *val, double *double_out); +int av_opt_eval_q (void *obj, const AVOption *o, const char *val, AVRational *q_out); +/** + * @} + */ + +#define AV_OPT_SEARCH_CHILDREN (1 << 0) /**< Search in possible children of the + given object first. */ +/** + * The obj passed to av_opt_find() is fake -- only a double pointer to AVClass + * instead of a required pointer to a struct containing AVClass. This is + * useful for searching for options without needing to allocate the corresponding + * object. + */ +#define AV_OPT_SEARCH_FAKE_OBJ (1 << 1) + +/** + * In av_opt_get, return NULL if the option has a pointer type and is set to NULL, + * rather than returning an empty string. + */ +#define AV_OPT_ALLOW_NULL (1 << 2) + +/** + * Allows av_opt_query_ranges and av_opt_query_ranges_default to return more than + * one component for certain option types. + * @see AVOptionRanges for details. + */ +#define AV_OPT_MULTI_COMPONENT_RANGE (1 << 12) + +/** + * Look for an option in an object. Consider only options which + * have all the specified flags set. + * + * @param[in] obj A pointer to a struct whose first element is a + * pointer to an AVClass. + * Alternatively a double pointer to an AVClass, if + * AV_OPT_SEARCH_FAKE_OBJ search flag is set. + * @param[in] name The name of the option to look for. + * @param[in] unit When searching for named constants, name of the unit + * it belongs to. + * @param opt_flags Find only options with all the specified flags set (AV_OPT_FLAG). + * @param search_flags A combination of AV_OPT_SEARCH_*. + * + * @return A pointer to the option found, or NULL if no option + * was found. + * + * @note Options found with AV_OPT_SEARCH_CHILDREN flag may not be settable + * directly with av_opt_set(). Use special calls which take an options + * AVDictionary (e.g. avformat_open_input()) to set options found with this + * flag. + */ +const AVOption *av_opt_find(void *obj, const char *name, const char *unit, + int opt_flags, int search_flags); + +/** + * Look for an option in an object. Consider only options which + * have all the specified flags set. + * + * @param[in] obj A pointer to a struct whose first element is a + * pointer to an AVClass. + * Alternatively a double pointer to an AVClass, if + * AV_OPT_SEARCH_FAKE_OBJ search flag is set. + * @param[in] name The name of the option to look for. + * @param[in] unit When searching for named constants, name of the unit + * it belongs to. + * @param opt_flags Find only options with all the specified flags set (AV_OPT_FLAG). + * @param search_flags A combination of AV_OPT_SEARCH_*. + * @param[out] target_obj if non-NULL, an object to which the option belongs will be + * written here. It may be different from obj if AV_OPT_SEARCH_CHILDREN is present + * in search_flags. This parameter is ignored if search_flags contain + * AV_OPT_SEARCH_FAKE_OBJ. + * + * @return A pointer to the option found, or NULL if no option + * was found. + */ +const AVOption *av_opt_find2(void *obj, const char *name, const char *unit, + int opt_flags, int search_flags, void **target_obj); + +/** + * Iterate over all AVOptions belonging to obj. + * + * @param obj an AVOptions-enabled struct or a double pointer to an + * AVClass describing it. + * @param prev result of the previous call to av_opt_next() on this object + * or NULL + * @return next AVOption or NULL + */ +const AVOption *av_opt_next(const void *obj, const AVOption *prev); + +/** + * Iterate over AVOptions-enabled children of obj. + * + * @param prev result of a previous call to this function or NULL + * @return next AVOptions-enabled child or NULL + */ +void *av_opt_child_next(void *obj, void *prev); + +/** + * Iterate over potential AVOptions-enabled children of parent. + * + * @param prev result of a previous call to this function or NULL + * @return AVClass corresponding to next potential child or NULL + */ +const AVClass *av_opt_child_class_next(const AVClass *parent, const AVClass *prev); + +/** + * @defgroup opt_set_funcs Option setting functions + * @{ + * Those functions set the field of obj with the given name to value. + * + * @param[in] obj A struct whose first element is a pointer to an AVClass. + * @param[in] name the name of the field to set + * @param[in] val The value to set. In case of av_opt_set() if the field is not + * of a string type, then the given string is parsed. + * SI postfixes and some named scalars are supported. + * If the field is of a numeric type, it has to be a numeric or named + * scalar. Behavior with more than one scalar and +- infix operators + * is undefined. + * If the field is of a flags type, it has to be a sequence of numeric + * scalars or named flags separated by '+' or '-'. Prefixing a flag + * with '+' causes it to be set without affecting the other flags; + * similarly, '-' unsets a flag. + * @param search_flags flags passed to av_opt_find2. I.e. if AV_OPT_SEARCH_CHILDREN + * is passed here, then the option may be set on a child of obj. + * + * @return 0 if the value has been set, or an AVERROR code in case of + * error: + * AVERROR_OPTION_NOT_FOUND if no matching option exists + * AVERROR(ERANGE) if the value is out of range + * AVERROR(EINVAL) if the value is not valid + */ +int av_opt_set (void *obj, const char *name, const char *val, int search_flags); +int av_opt_set_int (void *obj, const char *name, int64_t val, int search_flags); +int av_opt_set_double (void *obj, const char *name, double val, int search_flags); +int av_opt_set_q (void *obj, const char *name, AVRational val, int search_flags); +int av_opt_set_bin (void *obj, const char *name, const uint8_t *val, int size, int search_flags); +int av_opt_set_image_size(void *obj, const char *name, int w, int h, int search_flags); +int av_opt_set_pixel_fmt (void *obj, const char *name, enum AVPixelFormat fmt, int search_flags); +int av_opt_set_sample_fmt(void *obj, const char *name, enum AVSampleFormat fmt, int search_flags); +int av_opt_set_video_rate(void *obj, const char *name, AVRational val, int search_flags); +int av_opt_set_channel_layout(void *obj, const char *name, int64_t ch_layout, int search_flags); +/** + * @note Any old dictionary present is discarded and replaced with a copy of the new one. The + * caller still owns val is and responsible for freeing it. + */ +int av_opt_set_dict_val(void *obj, const char *name, const AVDictionary *val, int search_flags); + +/** + * Set a binary option to an integer list. + * + * @param obj AVClass object to set options on + * @param name name of the binary option + * @param val pointer to an integer list (must have the correct type with + * regard to the contents of the list) + * @param term list terminator (usually 0 or -1) + * @param flags search flags + */ +#define av_opt_set_int_list(obj, name, val, term, flags) \ + (av_int_list_length(val, term) > INT_MAX / sizeof(*(val)) ? \ + AVERROR(EINVAL) : \ + av_opt_set_bin(obj, name, (const uint8_t *)(val), \ + av_int_list_length(val, term) * sizeof(*(val)), flags)) + +/** + * @} + */ + +/** + * @defgroup opt_get_funcs Option getting functions + * @{ + * Those functions get a value of the option with the given name from an object. + * + * @param[in] obj a struct whose first element is a pointer to an AVClass. + * @param[in] name name of the option to get. + * @param[in] search_flags flags passed to av_opt_find2. I.e. if AV_OPT_SEARCH_CHILDREN + * is passed here, then the option may be found in a child of obj. + * @param[out] out_val value of the option will be written here + * @return >=0 on success, a negative error code otherwise + */ +/** + * @note the returned string will be av_malloc()ed and must be av_free()ed by the caller + * + * @note if AV_OPT_ALLOW_NULL is set in search_flags in av_opt_get, and the option has + * AV_OPT_TYPE_STRING or AV_OPT_TYPE_BINARY and is set to NULL, *out_val will be set + * to NULL instead of an allocated empty string. + */ +int av_opt_get (void *obj, const char *name, int search_flags, uint8_t **out_val); +int av_opt_get_int (void *obj, const char *name, int search_flags, int64_t *out_val); +int av_opt_get_double (void *obj, const char *name, int search_flags, double *out_val); +int av_opt_get_q (void *obj, const char *name, int search_flags, AVRational *out_val); +int av_opt_get_image_size(void *obj, const char *name, int search_flags, int *w_out, int *h_out); +int av_opt_get_pixel_fmt (void *obj, const char *name, int search_flags, enum AVPixelFormat *out_fmt); +int av_opt_get_sample_fmt(void *obj, const char *name, int search_flags, enum AVSampleFormat *out_fmt); +int av_opt_get_video_rate(void *obj, const char *name, int search_flags, AVRational *out_val); +int av_opt_get_channel_layout(void *obj, const char *name, int search_flags, int64_t *ch_layout); +/** + * @param[out] out_val The returned dictionary is a copy of the actual value and must + * be freed with av_dict_free() by the caller + */ +int av_opt_get_dict_val(void *obj, const char *name, int search_flags, AVDictionary **out_val); +/** + * @} + */ +/** + * Gets a pointer to the requested field in a struct. + * This function allows accessing a struct even when its fields are moved or + * renamed since the application making the access has been compiled, + * + * @returns a pointer to the field, it can be cast to the correct type and read + * or written to. + */ +void *av_opt_ptr(const AVClass *avclass, void *obj, const char *name); + +/** + * Free an AVOptionRanges struct and set it to NULL. + */ +void av_opt_freep_ranges(AVOptionRanges **ranges); + +/** + * Get a list of allowed ranges for the given option. + * + * The returned list may depend on other fields in obj like for example profile. + * + * @param flags is a bitmask of flags, undefined flags should not be set and should be ignored + * AV_OPT_SEARCH_FAKE_OBJ indicates that the obj is a double pointer to a AVClass instead of a full instance + * AV_OPT_MULTI_COMPONENT_RANGE indicates that function may return more than one component, @see AVOptionRanges + * + * The result must be freed with av_opt_freep_ranges. + * + * @return number of compontents returned on success, a negative errro code otherwise + */ +int av_opt_query_ranges(AVOptionRanges **, void *obj, const char *key, int flags); + +/** + * Copy options from src object into dest object. + * + * Options that require memory allocation (e.g. string or binary) are malloc'ed in dest object. + * Original memory allocated for such options is freed unless both src and dest options points to the same memory. + * + * @param dest Object to copy from + * @param src Object to copy into + * @return 0 on success, negative on error + */ +int av_opt_copy(void *dest, const void *src); + +/** + * Get a default list of allowed ranges for the given option. + * + * This list is constructed without using the AVClass.query_ranges() callback + * and can be used as fallback from within the callback. + * + * @param flags is a bitmask of flags, undefined flags should not be set and should be ignored + * AV_OPT_SEARCH_FAKE_OBJ indicates that the obj is a double pointer to a AVClass instead of a full instance + * AV_OPT_MULTI_COMPONENT_RANGE indicates that function may return more than one component, @see AVOptionRanges + * + * The result must be freed with av_opt_free_ranges. + * + * @return number of compontents returned on success, a negative errro code otherwise + */ +int av_opt_query_ranges_default(AVOptionRanges **, void *obj, const char *key, int flags); + +/** + * Check if given option is set to its default value. + * + * Options o must belong to the obj. This function must not be called to check child's options state. + * @see av_opt_is_set_to_default_by_name(). + * + * @param obj AVClass object to check option on + * @param o option to be checked + * @return >0 when option is set to its default, + * 0 when option is not set its default, + * <0 on error + */ +int av_opt_is_set_to_default(void *obj, const AVOption *o); + +/** + * Check if given option is set to its default value. + * + * @param obj AVClass object to check option on + * @param name option name + * @param search_flags combination of AV_OPT_SEARCH_* + * @return >0 when option is set to its default, + * 0 when option is not set its default, + * <0 on error + */ +int av_opt_is_set_to_default_by_name(void *obj, const char *name, int search_flags); + + +#define AV_OPT_SERIALIZE_SKIP_DEFAULTS 0x00000001 ///< Serialize options that are not set to default values only. +#define AV_OPT_SERIALIZE_OPT_FLAGS_EXACT 0x00000002 ///< Serialize options that exactly match opt_flags only. + +/** + * Serialize object's options. + * + * Create a string containing object's serialized options. + * Such string may be passed back to av_opt_set_from_string() in order to restore option values. + * A key/value or pairs separator occurring in the serialized value or + * name string are escaped through the av_escape() function. + * + * @param[in] obj AVClass object to serialize + * @param[in] opt_flags serialize options with all the specified flags set (AV_OPT_FLAG) + * @param[in] flags combination of AV_OPT_SERIALIZE_* flags + * @param[out] buffer Pointer to buffer that will be allocated with string containg serialized options. + * Buffer must be freed by the caller when is no longer needed. + * @param[in] key_val_sep character used to separate key from value + * @param[in] pairs_sep character used to separate two pairs from each other + * @return >= 0 on success, negative on error + * @warning Separators cannot be neither '\\' nor '\0'. They also cannot be the same. + */ +int av_opt_serialize(void *obj, int opt_flags, int flags, char **buffer, + const char key_val_sep, const char pairs_sep); +/** + * @} + */ + +#endif /* AVUTIL_OPT_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/parseutils.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/parseutils.h new file mode 100644 index 0000000..e66d24b --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/parseutils.h @@ -0,0 +1,193 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_PARSEUTILS_H +#define AVUTIL_PARSEUTILS_H + +#include + +#include "rational.h" + +/** + * @file + * misc parsing utilities + */ + +/** + * Parse str and store the parsed ratio in q. + * + * Note that a ratio with infinite (1/0) or negative value is + * considered valid, so you should check on the returned value if you + * want to exclude those values. + * + * The undefined value can be expressed using the "0:0" string. + * + * @param[in,out] q pointer to the AVRational which will contain the ratio + * @param[in] str the string to parse: it has to be a string in the format + * num:den, a float number or an expression + * @param[in] max the maximum allowed numerator and denominator + * @param[in] log_offset log level offset which is applied to the log + * level of log_ctx + * @param[in] log_ctx parent logging context + * @return >= 0 on success, a negative error code otherwise + */ +int av_parse_ratio(AVRational *q, const char *str, int max, + int log_offset, void *log_ctx); + +#define av_parse_ratio_quiet(rate, str, max) \ + av_parse_ratio(rate, str, max, AV_LOG_MAX_OFFSET, NULL) + +/** + * Parse str and put in width_ptr and height_ptr the detected values. + * + * @param[in,out] width_ptr pointer to the variable which will contain the detected + * width value + * @param[in,out] height_ptr pointer to the variable which will contain the detected + * height value + * @param[in] str the string to parse: it has to be a string in the format + * width x height or a valid video size abbreviation. + * @return >= 0 on success, a negative error code otherwise + */ +int av_parse_video_size(int *width_ptr, int *height_ptr, const char *str); + +/** + * Parse str and store the detected values in *rate. + * + * @param[in,out] rate pointer to the AVRational which will contain the detected + * frame rate + * @param[in] str the string to parse: it has to be a string in the format + * rate_num / rate_den, a float number or a valid video rate abbreviation + * @return >= 0 on success, a negative error code otherwise + */ +int av_parse_video_rate(AVRational *rate, const char *str); + +/** + * Put the RGBA values that correspond to color_string in rgba_color. + * + * @param color_string a string specifying a color. It can be the name of + * a color (case insensitive match) or a [0x|#]RRGGBB[AA] sequence, + * possibly followed by "@" and a string representing the alpha + * component. + * The alpha component may be a string composed by "0x" followed by an + * hexadecimal number or a decimal number between 0.0 and 1.0, which + * represents the opacity value (0x00/0.0 means completely transparent, + * 0xff/1.0 completely opaque). + * If the alpha component is not specified then 0xff is assumed. + * The string "random" will result in a random color. + * @param slen length of the initial part of color_string containing the + * color. It can be set to -1 if color_string is a null terminated string + * containing nothing else than the color. + * @return >= 0 in case of success, a negative value in case of + * failure (for example if color_string cannot be parsed). + */ +int av_parse_color(uint8_t *rgba_color, const char *color_string, int slen, + void *log_ctx); + +/** + * Get the name of a color from the internal table of hard-coded named + * colors. + * + * This function is meant to enumerate the color names recognized by + * av_parse_color(). + * + * @param color_idx index of the requested color, starting from 0 + * @param rgbp if not NULL, will point to a 3-elements array with the color value in RGB + * @return the color name string or NULL if color_idx is not in the array + */ +const char *av_get_known_color_name(int color_idx, const uint8_t **rgb); + +/** + * Parse timestr and return in *time a corresponding number of + * microseconds. + * + * @param timeval puts here the number of microseconds corresponding + * to the string in timestr. If the string represents a duration, it + * is the number of microseconds contained in the time interval. If + * the string is a date, is the number of microseconds since 1st of + * January, 1970 up to the time of the parsed date. If timestr cannot + * be successfully parsed, set *time to INT64_MIN. + + * @param timestr a string representing a date or a duration. + * - If a date the syntax is: + * @code + * [{YYYY-MM-DD|YYYYMMDD}[T|t| ]]{{HH:MM:SS[.m...]]]}|{HHMMSS[.m...]]]}}[Z] + * now + * @endcode + * If the value is "now" it takes the current time. + * Time is local time unless Z is appended, in which case it is + * interpreted as UTC. + * If the year-month-day part is not specified it takes the current + * year-month-day. + * - If a duration the syntax is: + * @code + * [-][HH:]MM:SS[.m...] + * [-]S+[.m...] + * @endcode + * @param duration flag which tells how to interpret timestr, if not + * zero timestr is interpreted as a duration, otherwise as a date + * @return >= 0 in case of success, a negative value corresponding to an + * AVERROR code otherwise + */ +int av_parse_time(int64_t *timeval, const char *timestr, int duration); + +/** + * Attempt to find a specific tag in a URL. + * + * syntax: '?tag1=val1&tag2=val2...'. Little URL decoding is done. + * Return 1 if found. + */ +int av_find_info_tag(char *arg, int arg_size, const char *tag1, const char *info); + +/** + * Simplified version of strptime + * + * Parse the input string p according to the format string fmt and + * store its results in the structure dt. + * This implementation supports only a subset of the formats supported + * by the standard strptime(). + * + * The supported input field descriptors are listed below. + * - %H: the hour as a decimal number, using a 24-hour clock, in the + * range '00' through '23' + * - %J: hours as a decimal number, in the range '0' through INT_MAX + * - %M: the minute as a decimal number, using a 24-hour clock, in the + * range '00' through '59' + * - %S: the second as a decimal number, using a 24-hour clock, in the + * range '00' through '59' + * - %Y: the year as a decimal number, using the Gregorian calendar + * - %m: the month as a decimal number, in the range '1' through '12' + * - %d: the day of the month as a decimal number, in the range '1' + * through '31' + * - %T: alias for '%H:%M:%S' + * - %%: a literal '%' + * + * @return a pointer to the first character not processed in this function + * call. In case the input string contains more characters than + * required by the format string the return value points right after + * the last consumed input character. In case the whole input string + * is consumed the return value points to the null byte at the end of + * the string. On failure NULL is returned. + */ +char *av_small_strptime(const char *p, const char *fmt, struct tm *dt); + +/** + * Convert the decomposed UTC time in tm to a time_t value. + */ +time_t av_timegm(struct tm *tm); + +#endif /* AVUTIL_PARSEUTILS_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/pixdesc.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/pixdesc.h new file mode 100644 index 0000000..1ab3727 --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/pixdesc.h @@ -0,0 +1,433 @@ +/* + * pixel format descriptor + * Copyright (c) 2009 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_PIXDESC_H +#define AVUTIL_PIXDESC_H + +#include + +#include "attributes.h" +#include "pixfmt.h" +#include "version.h" + +typedef struct AVComponentDescriptor { + /** + * Which of the 4 planes contains the component. + */ + int plane; + + /** + * Number of elements between 2 horizontally consecutive pixels. + * Elements are bits for bitstream formats, bytes otherwise. + */ + int step; + + /** + * Number of elements before the component of the first pixel. + * Elements are bits for bitstream formats, bytes otherwise. + */ + int offset; + + /** + * Number of least significant bits that must be shifted away + * to get the value. + */ + int shift; + + /** + * Number of bits in the component. + */ + int depth; + +#if FF_API_PLUS1_MINUS1 + /** deprecated, use step instead */ + attribute_deprecated int step_minus1; + + /** deprecated, use depth instead */ + attribute_deprecated int depth_minus1; + + /** deprecated, use offset instead */ + attribute_deprecated int offset_plus1; +#endif +} AVComponentDescriptor; + +/** + * Descriptor that unambiguously describes how the bits of a pixel are + * stored in the up to 4 data planes of an image. It also stores the + * subsampling factors and number of components. + * + * @note This is separate of the colorspace (RGB, YCbCr, YPbPr, JPEG-style YUV + * and all the YUV variants) AVPixFmtDescriptor just stores how values + * are stored not what these values represent. + */ +typedef struct AVPixFmtDescriptor { + const char *name; + uint8_t nb_components; ///< The number of components each pixel has, (1-4) + + /** + * Amount to shift the luma width right to find the chroma width. + * For YV12 this is 1 for example. + * chroma_width = AV_CEIL_RSHIFT(luma_width, log2_chroma_w) + * The note above is needed to ensure rounding up. + * This value only refers to the chroma components. + */ + uint8_t log2_chroma_w; + + /** + * Amount to shift the luma height right to find the chroma height. + * For YV12 this is 1 for example. + * chroma_height= AV_CEIL_RSHIFT(luma_height, log2_chroma_h) + * The note above is needed to ensure rounding up. + * This value only refers to the chroma components. + */ + uint8_t log2_chroma_h; + + /** + * Combination of AV_PIX_FMT_FLAG_... flags. + */ + uint64_t flags; + + /** + * Parameters that describe how pixels are packed. + * If the format has 1 or 2 components, then luma is 0. + * If the format has 3 or 4 components: + * if the RGB flag is set then 0 is red, 1 is green and 2 is blue; + * otherwise 0 is luma, 1 is chroma-U and 2 is chroma-V. + * + * If present, the Alpha channel is always the last component. + */ + AVComponentDescriptor comp[4]; + + /** + * Alternative comma-separated names. + */ + const char *alias; +} AVPixFmtDescriptor; + +/** + * Pixel format is big-endian. + */ +#define AV_PIX_FMT_FLAG_BE (1 << 0) +/** + * Pixel format has a palette in data[1], values are indexes in this palette. + */ +#define AV_PIX_FMT_FLAG_PAL (1 << 1) +/** + * All values of a component are bit-wise packed end to end. + */ +#define AV_PIX_FMT_FLAG_BITSTREAM (1 << 2) +/** + * Pixel format is an HW accelerated format. + */ +#define AV_PIX_FMT_FLAG_HWACCEL (1 << 3) +/** + * At least one pixel component is not in the first data plane. + */ +#define AV_PIX_FMT_FLAG_PLANAR (1 << 4) +/** + * The pixel format contains RGB-like data (as opposed to YUV/grayscale). + */ +#define AV_PIX_FMT_FLAG_RGB (1 << 5) + +/** + * The pixel format is "pseudo-paletted". This means that it contains a + * fixed palette in the 2nd plane but the palette is fixed/constant for each + * PIX_FMT. This allows interpreting the data as if it was PAL8, which can + * in some cases be simpler. Or the data can be interpreted purely based on + * the pixel format without using the palette. + * An example of a pseudo-paletted format is AV_PIX_FMT_GRAY8 + * + * @deprecated This flag is deprecated, and will be removed. When it is removed, + * the extra palette allocation in AVFrame.data[1] is removed as well. Only + * actual paletted formats (as indicated by AV_PIX_FMT_FLAG_PAL) will have a + * palette. Starting with FFmpeg versions which have this flag deprecated, the + * extra "pseudo" palette is already ignored, and API users are not required to + * allocate a palette for AV_PIX_FMT_FLAG_PSEUDOPAL formats (it was required + * before the deprecation, though). + */ +#define AV_PIX_FMT_FLAG_PSEUDOPAL (1 << 6) + +/** + * The pixel format has an alpha channel. This is set on all formats that + * support alpha in some way. The exception is AV_PIX_FMT_PAL8, which can + * carry alpha as part of the palette. Details are explained in the + * AVPixelFormat enum, and are also encoded in the corresponding + * AVPixFmtDescriptor. + * + * The alpha is always straight, never pre-multiplied. + * + * If a codec or a filter does not support alpha, it should set all alpha to + * opaque, or use the equivalent pixel formats without alpha component, e.g. + * AV_PIX_FMT_RGB0 (or AV_PIX_FMT_RGB24 etc.) instead of AV_PIX_FMT_RGBA. + */ +#define AV_PIX_FMT_FLAG_ALPHA (1 << 7) + +/** + * The pixel format is following a Bayer pattern + */ +#define AV_PIX_FMT_FLAG_BAYER (1 << 8) + +/** + * The pixel format contains IEEE-754 floating point values. Precision (double, + * single, or half) should be determined by the pixel size (64, 32, or 16 bits). + */ +#define AV_PIX_FMT_FLAG_FLOAT (1 << 9) + +/** + * Return the number of bits per pixel used by the pixel format + * described by pixdesc. Note that this is not the same as the number + * of bits per sample. + * + * The returned number of bits refers to the number of bits actually + * used for storing the pixel information, that is padding bits are + * not counted. + */ +int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc); + +/** + * Return the number of bits per pixel for the pixel format + * described by pixdesc, including any padding or unused bits. + */ +int av_get_padded_bits_per_pixel(const AVPixFmtDescriptor *pixdesc); + +/** + * @return a pixel format descriptor for provided pixel format or NULL if + * this pixel format is unknown. + */ +const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt); + +/** + * Iterate over all pixel format descriptors known to libavutil. + * + * @param prev previous descriptor. NULL to get the first descriptor. + * + * @return next descriptor or NULL after the last descriptor + */ +const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev); + +/** + * @return an AVPixelFormat id described by desc, or AV_PIX_FMT_NONE if desc + * is not a valid pointer to a pixel format descriptor. + */ +enum AVPixelFormat av_pix_fmt_desc_get_id(const AVPixFmtDescriptor *desc); + +/** + * Utility function to access log2_chroma_w log2_chroma_h from + * the pixel format AVPixFmtDescriptor. + * + * @param[in] pix_fmt the pixel format + * @param[out] h_shift store log2_chroma_w (horizontal/width shift) + * @param[out] v_shift store log2_chroma_h (vertical/height shift) + * + * @return 0 on success, AVERROR(ENOSYS) on invalid or unknown pixel format + */ +int av_pix_fmt_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, + int *h_shift, int *v_shift); + +/** + * @return number of planes in pix_fmt, a negative AVERROR if pix_fmt is not a + * valid pixel format. + */ +int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt); + +/** + * @return the name for provided color range or NULL if unknown. + */ +const char *av_color_range_name(enum AVColorRange range); + +/** + * @return the AVColorRange value for name or an AVError if not found. + */ +int av_color_range_from_name(const char *name); + +/** + * @return the name for provided color primaries or NULL if unknown. + */ +const char *av_color_primaries_name(enum AVColorPrimaries primaries); + +/** + * @return the AVColorPrimaries value for name or an AVError if not found. + */ +int av_color_primaries_from_name(const char *name); + +/** + * @return the name for provided color transfer or NULL if unknown. + */ +const char *av_color_transfer_name(enum AVColorTransferCharacteristic transfer); + +/** + * @return the AVColorTransferCharacteristic value for name or an AVError if not found. + */ +int av_color_transfer_from_name(const char *name); + +/** + * @return the name for provided color space or NULL if unknown. + */ +const char *av_color_space_name(enum AVColorSpace space); + +/** + * @return the AVColorSpace value for name or an AVError if not found. + */ +int av_color_space_from_name(const char *name); + +/** + * @return the name for provided chroma location or NULL if unknown. + */ +const char *av_chroma_location_name(enum AVChromaLocation location); + +/** + * @return the AVChromaLocation value for name or an AVError if not found. + */ +int av_chroma_location_from_name(const char *name); + +/** + * Return the pixel format corresponding to name. + * + * If there is no pixel format with name name, then looks for a + * pixel format with the name corresponding to the native endian + * format of name. + * For example in a little-endian system, first looks for "gray16", + * then for "gray16le". + * + * Finally if no pixel format has been found, returns AV_PIX_FMT_NONE. + */ +enum AVPixelFormat av_get_pix_fmt(const char *name); + +/** + * Return the short name for a pixel format, NULL in case pix_fmt is + * unknown. + * + * @see av_get_pix_fmt(), av_get_pix_fmt_string() + */ +const char *av_get_pix_fmt_name(enum AVPixelFormat pix_fmt); + +/** + * Print in buf the string corresponding to the pixel format with + * number pix_fmt, or a header if pix_fmt is negative. + * + * @param buf the buffer where to write the string + * @param buf_size the size of buf + * @param pix_fmt the number of the pixel format to print the + * corresponding info string, or a negative value to print the + * corresponding header. + */ +char *av_get_pix_fmt_string(char *buf, int buf_size, + enum AVPixelFormat pix_fmt); + +/** + * Read a line from an image, and write the values of the + * pixel format component c to dst. + * + * @param data the array containing the pointers to the planes of the image + * @param linesize the array containing the linesizes of the image + * @param desc the pixel format descriptor for the image + * @param x the horizontal coordinate of the first pixel to read + * @param y the vertical coordinate of the first pixel to read + * @param w the width of the line to read, that is the number of + * values to write to dst + * @param read_pal_component if not zero and the format is a paletted + * format writes the values corresponding to the palette + * component c in data[1] to dst, rather than the palette indexes in + * data[0]. The behavior is undefined if the format is not paletted. + */ +void av_read_image_line(uint16_t *dst, const uint8_t *data[4], + const int linesize[4], const AVPixFmtDescriptor *desc, + int x, int y, int c, int w, int read_pal_component); + +/** + * Write the values from src to the pixel format component c of an + * image line. + * + * @param src array containing the values to write + * @param data the array containing the pointers to the planes of the + * image to write into. It is supposed to be zeroed. + * @param linesize the array containing the linesizes of the image + * @param desc the pixel format descriptor for the image + * @param x the horizontal coordinate of the first pixel to write + * @param y the vertical coordinate of the first pixel to write + * @param w the width of the line to write, that is the number of + * values to write to the image line + */ +void av_write_image_line(const uint16_t *src, uint8_t *data[4], + const int linesize[4], const AVPixFmtDescriptor *desc, + int x, int y, int c, int w); + +/** + * Utility function to swap the endianness of a pixel format. + * + * @param[in] pix_fmt the pixel format + * + * @return pixel format with swapped endianness if it exists, + * otherwise AV_PIX_FMT_NONE + */ +enum AVPixelFormat av_pix_fmt_swap_endianness(enum AVPixelFormat pix_fmt); + +#define FF_LOSS_RESOLUTION 0x0001 /**< loss due to resolution change */ +#define FF_LOSS_DEPTH 0x0002 /**< loss due to color depth change */ +#define FF_LOSS_COLORSPACE 0x0004 /**< loss due to color space conversion */ +#define FF_LOSS_ALPHA 0x0008 /**< loss of alpha bits */ +#define FF_LOSS_COLORQUANT 0x0010 /**< loss due to color quantization */ +#define FF_LOSS_CHROMA 0x0020 /**< loss of chroma (e.g. RGB to gray conversion) */ + +/** + * Compute what kind of losses will occur when converting from one specific + * pixel format to another. + * When converting from one pixel format to another, information loss may occur. + * For example, when converting from RGB24 to GRAY, the color information will + * be lost. Similarly, other losses occur when converting from some formats to + * other formats. These losses can involve loss of chroma, but also loss of + * resolution, loss of color depth, loss due to the color space conversion, loss + * of the alpha bits or loss due to color quantization. + * av_get_fix_fmt_loss() informs you about the various types of losses + * which will occur when converting from one pixel format to another. + * + * @param[in] dst_pix_fmt destination pixel format + * @param[in] src_pix_fmt source pixel format + * @param[in] has_alpha Whether the source pixel format alpha channel is used. + * @return Combination of flags informing you what kind of losses will occur + * (maximum loss for an invalid dst_pix_fmt). + */ +int av_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt, + enum AVPixelFormat src_pix_fmt, + int has_alpha); + +/** + * Compute what kind of losses will occur when converting from one specific + * pixel format to another. + * When converting from one pixel format to another, information loss may occur. + * For example, when converting from RGB24 to GRAY, the color information will + * be lost. Similarly, other losses occur when converting from some formats to + * other formats. These losses can involve loss of chroma, but also loss of + * resolution, loss of color depth, loss due to the color space conversion, loss + * of the alpha bits or loss due to color quantization. + * av_get_fix_fmt_loss() informs you about the various types of losses + * which will occur when converting from one pixel format to another. + * + * @param[in] dst_pix_fmt destination pixel format + * @param[in] src_pix_fmt source pixel format + * @param[in] has_alpha Whether the source pixel format alpha channel is used. + * @return Combination of flags informing you what kind of losses will occur + * (maximum loss for an invalid dst_pix_fmt). + */ +enum AVPixelFormat av_find_best_pix_fmt_of_2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2, + enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr); + +#endif /* AVUTIL_PIXDESC_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/pixelutils.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/pixelutils.h new file mode 100644 index 0000000..a8dbc15 --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/pixelutils.h @@ -0,0 +1,52 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_PIXELUTILS_H +#define AVUTIL_PIXELUTILS_H + +#include +#include +#include "common.h" + +/** + * Sum of abs(src1[x] - src2[x]) + */ +typedef int (*av_pixelutils_sad_fn)(const uint8_t *src1, ptrdiff_t stride1, + const uint8_t *src2, ptrdiff_t stride2); + +/** + * Get a potentially optimized pointer to a Sum-of-absolute-differences + * function (see the av_pixelutils_sad_fn prototype). + * + * @param w_bits 1< + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_PIXFMT_H +#define AVUTIL_PIXFMT_H + +/** + * @file + * pixel format definitions + */ + +#include "libavutil/avconfig.h" +#include "version.h" + +#define AVPALETTE_SIZE 1024 +#define AVPALETTE_COUNT 256 + +/** + * Pixel format. + * + * @note + * AV_PIX_FMT_RGB32 is handled in an endian-specific manner. An RGBA + * color is put together as: + * (A << 24) | (R << 16) | (G << 8) | B + * This is stored as BGRA on little-endian CPU architectures and ARGB on + * big-endian CPUs. + * + * @par + * When the pixel format is palettized RGB32 (AV_PIX_FMT_PAL8), the palettized + * image data is stored in AVFrame.data[0]. The palette is transported in + * AVFrame.data[1], is 1024 bytes long (256 4-byte entries) and is + * formatted the same as in AV_PIX_FMT_RGB32 described above (i.e., it is + * also endian-specific). Note also that the individual RGB32 palette + * components stored in AVFrame.data[1] should be in the range 0..255. + * This is important as many custom PAL8 video codecs that were designed + * to run on the IBM VGA graphics adapter use 6-bit palette components. + * + * @par + * For all the 8 bits per pixel formats, an RGB32 palette is in data[1] like + * for pal8. This palette is filled in automatically by the function + * allocating the picture. + */ +enum AVPixelFormat { + AV_PIX_FMT_NONE = -1, + AV_PIX_FMT_YUV420P, ///< planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples) + AV_PIX_FMT_YUYV422, ///< packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr + AV_PIX_FMT_RGB24, ///< packed RGB 8:8:8, 24bpp, RGBRGB... + AV_PIX_FMT_BGR24, ///< packed RGB 8:8:8, 24bpp, BGRBGR... + AV_PIX_FMT_YUV422P, ///< planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples) + AV_PIX_FMT_YUV444P, ///< planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples) + AV_PIX_FMT_YUV410P, ///< planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples) + AV_PIX_FMT_YUV411P, ///< planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) + AV_PIX_FMT_GRAY8, ///< Y , 8bpp + AV_PIX_FMT_MONOWHITE, ///< Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb + AV_PIX_FMT_MONOBLACK, ///< Y , 1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb + AV_PIX_FMT_PAL8, ///< 8 bits with AV_PIX_FMT_RGB32 palette + AV_PIX_FMT_YUVJ420P, ///< planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting color_range + AV_PIX_FMT_YUVJ422P, ///< planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting color_range + AV_PIX_FMT_YUVJ444P, ///< planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting color_range + AV_PIX_FMT_UYVY422, ///< packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1 + AV_PIX_FMT_UYYVYY411, ///< packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3 + AV_PIX_FMT_BGR8, ///< packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb) + AV_PIX_FMT_BGR4, ///< packed RGB 1:2:1 bitstream, 4bpp, (msb)1B 2G 1R(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits + AV_PIX_FMT_BGR4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb) + AV_PIX_FMT_RGB8, ///< packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb) + AV_PIX_FMT_RGB4, ///< packed RGB 1:2:1 bitstream, 4bpp, (msb)1R 2G 1B(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits + AV_PIX_FMT_RGB4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb) + AV_PIX_FMT_NV12, ///< planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (first byte U and the following byte V) + AV_PIX_FMT_NV21, ///< as above, but U and V bytes are swapped + + AV_PIX_FMT_ARGB, ///< packed ARGB 8:8:8:8, 32bpp, ARGBARGB... + AV_PIX_FMT_RGBA, ///< packed RGBA 8:8:8:8, 32bpp, RGBARGBA... + AV_PIX_FMT_ABGR, ///< packed ABGR 8:8:8:8, 32bpp, ABGRABGR... + AV_PIX_FMT_BGRA, ///< packed BGRA 8:8:8:8, 32bpp, BGRABGRA... + + AV_PIX_FMT_GRAY16BE, ///< Y , 16bpp, big-endian + AV_PIX_FMT_GRAY16LE, ///< Y , 16bpp, little-endian + AV_PIX_FMT_YUV440P, ///< planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples) + AV_PIX_FMT_YUVJ440P, ///< planar YUV 4:4:0 full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV440P and setting color_range + AV_PIX_FMT_YUVA420P, ///< planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples) + AV_PIX_FMT_RGB48BE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big-endian + AV_PIX_FMT_RGB48LE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as little-endian + + AV_PIX_FMT_RGB565BE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), big-endian + AV_PIX_FMT_RGB565LE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian + AV_PIX_FMT_RGB555BE, ///< packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), big-endian , X=unused/undefined + AV_PIX_FMT_RGB555LE, ///< packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), little-endian, X=unused/undefined + + AV_PIX_FMT_BGR565BE, ///< packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), big-endian + AV_PIX_FMT_BGR565LE, ///< packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), little-endian + AV_PIX_FMT_BGR555BE, ///< packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), big-endian , X=unused/undefined + AV_PIX_FMT_BGR555LE, ///< packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), little-endian, X=unused/undefined + +#if FF_API_VAAPI + /** @name Deprecated pixel formats */ + /**@{*/ + AV_PIX_FMT_VAAPI_MOCO, ///< HW acceleration through VA API at motion compensation entry-point, Picture.data[3] contains a vaapi_render_state struct which contains macroblocks as well as various fields extracted from headers + AV_PIX_FMT_VAAPI_IDCT, ///< HW acceleration through VA API at IDCT entry-point, Picture.data[3] contains a vaapi_render_state struct which contains fields extracted from headers + AV_PIX_FMT_VAAPI_VLD, ///< HW decoding through VA API, Picture.data[3] contains a VASurfaceID + /**@}*/ + AV_PIX_FMT_VAAPI = AV_PIX_FMT_VAAPI_VLD, +#else + /** + * Hardware acceleration through VA-API, data[3] contains a + * VASurfaceID. + */ + AV_PIX_FMT_VAAPI, +#endif + + AV_PIX_FMT_YUV420P16LE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian + AV_PIX_FMT_YUV420P16BE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian + AV_PIX_FMT_YUV422P16LE, ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian + AV_PIX_FMT_YUV422P16BE, ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian + AV_PIX_FMT_YUV444P16LE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian + AV_PIX_FMT_YUV444P16BE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian + AV_PIX_FMT_DXVA2_VLD, ///< HW decoding through DXVA2, Picture.data[3] contains a LPDIRECT3DSURFACE9 pointer + + AV_PIX_FMT_RGB444LE, ///< packed RGB 4:4:4, 16bpp, (msb)4X 4R 4G 4B(lsb), little-endian, X=unused/undefined + AV_PIX_FMT_RGB444BE, ///< packed RGB 4:4:4, 16bpp, (msb)4X 4R 4G 4B(lsb), big-endian, X=unused/undefined + AV_PIX_FMT_BGR444LE, ///< packed BGR 4:4:4, 16bpp, (msb)4X 4B 4G 4R(lsb), little-endian, X=unused/undefined + AV_PIX_FMT_BGR444BE, ///< packed BGR 4:4:4, 16bpp, (msb)4X 4B 4G 4R(lsb), big-endian, X=unused/undefined + AV_PIX_FMT_YA8, ///< 8 bits gray, 8 bits alpha + + AV_PIX_FMT_Y400A = AV_PIX_FMT_YA8, ///< alias for AV_PIX_FMT_YA8 + AV_PIX_FMT_GRAY8A= AV_PIX_FMT_YA8, ///< alias for AV_PIX_FMT_YA8 + + AV_PIX_FMT_BGR48BE, ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as big-endian + AV_PIX_FMT_BGR48LE, ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as little-endian + + /** + * The following 12 formats have the disadvantage of needing 1 format for each bit depth. + * Notice that each 9/10 bits sample is stored in 16 bits with extra padding. + * If you want to support multiple bit depths, then using AV_PIX_FMT_YUV420P16* with the bpp stored separately is better. + */ + AV_PIX_FMT_YUV420P9BE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian + AV_PIX_FMT_YUV420P9LE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian + AV_PIX_FMT_YUV420P10BE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian + AV_PIX_FMT_YUV420P10LE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian + AV_PIX_FMT_YUV422P10BE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian + AV_PIX_FMT_YUV422P10LE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian + AV_PIX_FMT_YUV444P9BE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian + AV_PIX_FMT_YUV444P9LE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian + AV_PIX_FMT_YUV444P10BE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian + AV_PIX_FMT_YUV444P10LE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian + AV_PIX_FMT_YUV422P9BE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian + AV_PIX_FMT_YUV422P9LE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian + AV_PIX_FMT_GBRP, ///< planar GBR 4:4:4 24bpp + AV_PIX_FMT_GBR24P = AV_PIX_FMT_GBRP, // alias for #AV_PIX_FMT_GBRP + AV_PIX_FMT_GBRP9BE, ///< planar GBR 4:4:4 27bpp, big-endian + AV_PIX_FMT_GBRP9LE, ///< planar GBR 4:4:4 27bpp, little-endian + AV_PIX_FMT_GBRP10BE, ///< planar GBR 4:4:4 30bpp, big-endian + AV_PIX_FMT_GBRP10LE, ///< planar GBR 4:4:4 30bpp, little-endian + AV_PIX_FMT_GBRP16BE, ///< planar GBR 4:4:4 48bpp, big-endian + AV_PIX_FMT_GBRP16LE, ///< planar GBR 4:4:4 48bpp, little-endian + AV_PIX_FMT_YUVA422P, ///< planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples) + AV_PIX_FMT_YUVA444P, ///< planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples) + AV_PIX_FMT_YUVA420P9BE, ///< planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per 2x2 Y & A samples), big-endian + AV_PIX_FMT_YUVA420P9LE, ///< planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per 2x2 Y & A samples), little-endian + AV_PIX_FMT_YUVA422P9BE, ///< planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), big-endian + AV_PIX_FMT_YUVA422P9LE, ///< planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), little-endian + AV_PIX_FMT_YUVA444P9BE, ///< planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), big-endian + AV_PIX_FMT_YUVA444P9LE, ///< planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), little-endian + AV_PIX_FMT_YUVA420P10BE, ///< planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian) + AV_PIX_FMT_YUVA420P10LE, ///< planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian) + AV_PIX_FMT_YUVA422P10BE, ///< planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian) + AV_PIX_FMT_YUVA422P10LE, ///< planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian) + AV_PIX_FMT_YUVA444P10BE, ///< planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian) + AV_PIX_FMT_YUVA444P10LE, ///< planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian) + AV_PIX_FMT_YUVA420P16BE, ///< planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian) + AV_PIX_FMT_YUVA420P16LE, ///< planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian) + AV_PIX_FMT_YUVA422P16BE, ///< planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian) + AV_PIX_FMT_YUVA422P16LE, ///< planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian) + AV_PIX_FMT_YUVA444P16BE, ///< planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian) + AV_PIX_FMT_YUVA444P16LE, ///< planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian) + + AV_PIX_FMT_VDPAU, ///< HW acceleration through VDPAU, Picture.data[3] contains a VdpVideoSurface + + AV_PIX_FMT_XYZ12LE, ///< packed XYZ 4:4:4, 36 bpp, (msb) 12X, 12Y, 12Z (lsb), the 2-byte value for each X/Y/Z is stored as little-endian, the 4 lower bits are set to 0 + AV_PIX_FMT_XYZ12BE, ///< packed XYZ 4:4:4, 36 bpp, (msb) 12X, 12Y, 12Z (lsb), the 2-byte value for each X/Y/Z is stored as big-endian, the 4 lower bits are set to 0 + AV_PIX_FMT_NV16, ///< interleaved chroma YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples) + AV_PIX_FMT_NV20LE, ///< interleaved chroma YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian + AV_PIX_FMT_NV20BE, ///< interleaved chroma YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian + + AV_PIX_FMT_RGBA64BE, ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is stored as big-endian + AV_PIX_FMT_RGBA64LE, ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is stored as little-endian + AV_PIX_FMT_BGRA64BE, ///< packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is stored as big-endian + AV_PIX_FMT_BGRA64LE, ///< packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is stored as little-endian + + AV_PIX_FMT_YVYU422, ///< packed YUV 4:2:2, 16bpp, Y0 Cr Y1 Cb + + AV_PIX_FMT_YA16BE, ///< 16 bits gray, 16 bits alpha (big-endian) + AV_PIX_FMT_YA16LE, ///< 16 bits gray, 16 bits alpha (little-endian) + + AV_PIX_FMT_GBRAP, ///< planar GBRA 4:4:4:4 32bpp + AV_PIX_FMT_GBRAP16BE, ///< planar GBRA 4:4:4:4 64bpp, big-endian + AV_PIX_FMT_GBRAP16LE, ///< planar GBRA 4:4:4:4 64bpp, little-endian + /** + * HW acceleration through QSV, data[3] contains a pointer to the + * mfxFrameSurface1 structure. + */ + AV_PIX_FMT_QSV, + /** + * HW acceleration though MMAL, data[3] contains a pointer to the + * MMAL_BUFFER_HEADER_T structure. + */ + AV_PIX_FMT_MMAL, + + AV_PIX_FMT_D3D11VA_VLD, ///< HW decoding through Direct3D11 via old API, Picture.data[3] contains a ID3D11VideoDecoderOutputView pointer + + /** + * HW acceleration through CUDA. data[i] contain CUdeviceptr pointers + * exactly as for system memory frames. + */ + AV_PIX_FMT_CUDA, + + AV_PIX_FMT_0RGB, ///< packed RGB 8:8:8, 32bpp, XRGBXRGB... X=unused/undefined + AV_PIX_FMT_RGB0, ///< packed RGB 8:8:8, 32bpp, RGBXRGBX... X=unused/undefined + AV_PIX_FMT_0BGR, ///< packed BGR 8:8:8, 32bpp, XBGRXBGR... X=unused/undefined + AV_PIX_FMT_BGR0, ///< packed BGR 8:8:8, 32bpp, BGRXBGRX... X=unused/undefined + + AV_PIX_FMT_YUV420P12BE, ///< planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian + AV_PIX_FMT_YUV420P12LE, ///< planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian + AV_PIX_FMT_YUV420P14BE, ///< planar YUV 4:2:0,21bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian + AV_PIX_FMT_YUV420P14LE, ///< planar YUV 4:2:0,21bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian + AV_PIX_FMT_YUV422P12BE, ///< planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian + AV_PIX_FMT_YUV422P12LE, ///< planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian + AV_PIX_FMT_YUV422P14BE, ///< planar YUV 4:2:2,28bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian + AV_PIX_FMT_YUV422P14LE, ///< planar YUV 4:2:2,28bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian + AV_PIX_FMT_YUV444P12BE, ///< planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian + AV_PIX_FMT_YUV444P12LE, ///< planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian + AV_PIX_FMT_YUV444P14BE, ///< planar YUV 4:4:4,42bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian + AV_PIX_FMT_YUV444P14LE, ///< planar YUV 4:4:4,42bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian + AV_PIX_FMT_GBRP12BE, ///< planar GBR 4:4:4 36bpp, big-endian + AV_PIX_FMT_GBRP12LE, ///< planar GBR 4:4:4 36bpp, little-endian + AV_PIX_FMT_GBRP14BE, ///< planar GBR 4:4:4 42bpp, big-endian + AV_PIX_FMT_GBRP14LE, ///< planar GBR 4:4:4 42bpp, little-endian + AV_PIX_FMT_YUVJ411P, ///< planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV411P and setting color_range + + AV_PIX_FMT_BAYER_BGGR8, ///< bayer, BGBG..(odd line), GRGR..(even line), 8-bit samples */ + AV_PIX_FMT_BAYER_RGGB8, ///< bayer, RGRG..(odd line), GBGB..(even line), 8-bit samples */ + AV_PIX_FMT_BAYER_GBRG8, ///< bayer, GBGB..(odd line), RGRG..(even line), 8-bit samples */ + AV_PIX_FMT_BAYER_GRBG8, ///< bayer, GRGR..(odd line), BGBG..(even line), 8-bit samples */ + AV_PIX_FMT_BAYER_BGGR16LE, ///< bayer, BGBG..(odd line), GRGR..(even line), 16-bit samples, little-endian */ + AV_PIX_FMT_BAYER_BGGR16BE, ///< bayer, BGBG..(odd line), GRGR..(even line), 16-bit samples, big-endian */ + AV_PIX_FMT_BAYER_RGGB16LE, ///< bayer, RGRG..(odd line), GBGB..(even line), 16-bit samples, little-endian */ + AV_PIX_FMT_BAYER_RGGB16BE, ///< bayer, RGRG..(odd line), GBGB..(even line), 16-bit samples, big-endian */ + AV_PIX_FMT_BAYER_GBRG16LE, ///< bayer, GBGB..(odd line), RGRG..(even line), 16-bit samples, little-endian */ + AV_PIX_FMT_BAYER_GBRG16BE, ///< bayer, GBGB..(odd line), RGRG..(even line), 16-bit samples, big-endian */ + AV_PIX_FMT_BAYER_GRBG16LE, ///< bayer, GRGR..(odd line), BGBG..(even line), 16-bit samples, little-endian */ + AV_PIX_FMT_BAYER_GRBG16BE, ///< bayer, GRGR..(odd line), BGBG..(even line), 16-bit samples, big-endian */ + + AV_PIX_FMT_XVMC,///< XVideo Motion Acceleration via common packet passing + + AV_PIX_FMT_YUV440P10LE, ///< planar YUV 4:4:0,20bpp, (1 Cr & Cb sample per 1x2 Y samples), little-endian + AV_PIX_FMT_YUV440P10BE, ///< planar YUV 4:4:0,20bpp, (1 Cr & Cb sample per 1x2 Y samples), big-endian + AV_PIX_FMT_YUV440P12LE, ///< planar YUV 4:4:0,24bpp, (1 Cr & Cb sample per 1x2 Y samples), little-endian + AV_PIX_FMT_YUV440P12BE, ///< planar YUV 4:4:0,24bpp, (1 Cr & Cb sample per 1x2 Y samples), big-endian + AV_PIX_FMT_AYUV64LE, ///< packed AYUV 4:4:4,64bpp (1 Cr & Cb sample per 1x1 Y & A samples), little-endian + AV_PIX_FMT_AYUV64BE, ///< packed AYUV 4:4:4,64bpp (1 Cr & Cb sample per 1x1 Y & A samples), big-endian + + AV_PIX_FMT_VIDEOTOOLBOX, ///< hardware decoding through Videotoolbox + + AV_PIX_FMT_P010LE, ///< like NV12, with 10bpp per component, data in the high bits, zeros in the low bits, little-endian + AV_PIX_FMT_P010BE, ///< like NV12, with 10bpp per component, data in the high bits, zeros in the low bits, big-endian + + AV_PIX_FMT_GBRAP12BE, ///< planar GBR 4:4:4:4 48bpp, big-endian + AV_PIX_FMT_GBRAP12LE, ///< planar GBR 4:4:4:4 48bpp, little-endian + + AV_PIX_FMT_GBRAP10BE, ///< planar GBR 4:4:4:4 40bpp, big-endian + AV_PIX_FMT_GBRAP10LE, ///< planar GBR 4:4:4:4 40bpp, little-endian + + AV_PIX_FMT_MEDIACODEC, ///< hardware decoding through MediaCodec + + AV_PIX_FMT_GRAY12BE, ///< Y , 12bpp, big-endian + AV_PIX_FMT_GRAY12LE, ///< Y , 12bpp, little-endian + AV_PIX_FMT_GRAY10BE, ///< Y , 10bpp, big-endian + AV_PIX_FMT_GRAY10LE, ///< Y , 10bpp, little-endian + + AV_PIX_FMT_P016LE, ///< like NV12, with 16bpp per component, little-endian + AV_PIX_FMT_P016BE, ///< like NV12, with 16bpp per component, big-endian + + /** + * Hardware surfaces for Direct3D11. + * + * This is preferred over the legacy AV_PIX_FMT_D3D11VA_VLD. The new D3D11 + * hwaccel API and filtering support AV_PIX_FMT_D3D11 only. + * + * data[0] contains a ID3D11Texture2D pointer, and data[1] contains the + * texture array index of the frame as intptr_t if the ID3D11Texture2D is + * an array texture (or always 0 if it's a normal texture). + */ + AV_PIX_FMT_D3D11, + + AV_PIX_FMT_GRAY9BE, ///< Y , 9bpp, big-endian + AV_PIX_FMT_GRAY9LE, ///< Y , 9bpp, little-endian + + AV_PIX_FMT_GBRPF32BE, ///< IEEE-754 single precision planar GBR 4:4:4, 96bpp, big-endian + AV_PIX_FMT_GBRPF32LE, ///< IEEE-754 single precision planar GBR 4:4:4, 96bpp, little-endian + AV_PIX_FMT_GBRAPF32BE, ///< IEEE-754 single precision planar GBRA 4:4:4:4, 128bpp, big-endian + AV_PIX_FMT_GBRAPF32LE, ///< IEEE-754 single precision planar GBRA 4:4:4:4, 128bpp, little-endian + + /** + * DRM-managed buffers exposed through PRIME buffer sharing. + * + * data[0] points to an AVDRMFrameDescriptor. + */ + AV_PIX_FMT_DRM_PRIME, + /** + * Hardware surfaces for OpenCL. + * + * data[i] contain 2D image objects (typed in C as cl_mem, used + * in OpenCL as image2d_t) for each plane of the surface. + */ + AV_PIX_FMT_OPENCL, + + AV_PIX_FMT_NB ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions +}; + +#if AV_HAVE_BIGENDIAN +# define AV_PIX_FMT_NE(be, le) AV_PIX_FMT_##be +#else +# define AV_PIX_FMT_NE(be, le) AV_PIX_FMT_##le +#endif + +#define AV_PIX_FMT_RGB32 AV_PIX_FMT_NE(ARGB, BGRA) +#define AV_PIX_FMT_RGB32_1 AV_PIX_FMT_NE(RGBA, ABGR) +#define AV_PIX_FMT_BGR32 AV_PIX_FMT_NE(ABGR, RGBA) +#define AV_PIX_FMT_BGR32_1 AV_PIX_FMT_NE(BGRA, ARGB) +#define AV_PIX_FMT_0RGB32 AV_PIX_FMT_NE(0RGB, BGR0) +#define AV_PIX_FMT_0BGR32 AV_PIX_FMT_NE(0BGR, RGB0) + +#define AV_PIX_FMT_GRAY9 AV_PIX_FMT_NE(GRAY9BE, GRAY9LE) +#define AV_PIX_FMT_GRAY10 AV_PIX_FMT_NE(GRAY10BE, GRAY10LE) +#define AV_PIX_FMT_GRAY12 AV_PIX_FMT_NE(GRAY12BE, GRAY12LE) +#define AV_PIX_FMT_GRAY16 AV_PIX_FMT_NE(GRAY16BE, GRAY16LE) +#define AV_PIX_FMT_YA16 AV_PIX_FMT_NE(YA16BE, YA16LE) +#define AV_PIX_FMT_RGB48 AV_PIX_FMT_NE(RGB48BE, RGB48LE) +#define AV_PIX_FMT_RGB565 AV_PIX_FMT_NE(RGB565BE, RGB565LE) +#define AV_PIX_FMT_RGB555 AV_PIX_FMT_NE(RGB555BE, RGB555LE) +#define AV_PIX_FMT_RGB444 AV_PIX_FMT_NE(RGB444BE, RGB444LE) +#define AV_PIX_FMT_RGBA64 AV_PIX_FMT_NE(RGBA64BE, RGBA64LE) +#define AV_PIX_FMT_BGR48 AV_PIX_FMT_NE(BGR48BE, BGR48LE) +#define AV_PIX_FMT_BGR565 AV_PIX_FMT_NE(BGR565BE, BGR565LE) +#define AV_PIX_FMT_BGR555 AV_PIX_FMT_NE(BGR555BE, BGR555LE) +#define AV_PIX_FMT_BGR444 AV_PIX_FMT_NE(BGR444BE, BGR444LE) +#define AV_PIX_FMT_BGRA64 AV_PIX_FMT_NE(BGRA64BE, BGRA64LE) + +#define AV_PIX_FMT_YUV420P9 AV_PIX_FMT_NE(YUV420P9BE , YUV420P9LE) +#define AV_PIX_FMT_YUV422P9 AV_PIX_FMT_NE(YUV422P9BE , YUV422P9LE) +#define AV_PIX_FMT_YUV444P9 AV_PIX_FMT_NE(YUV444P9BE , YUV444P9LE) +#define AV_PIX_FMT_YUV420P10 AV_PIX_FMT_NE(YUV420P10BE, YUV420P10LE) +#define AV_PIX_FMT_YUV422P10 AV_PIX_FMT_NE(YUV422P10BE, YUV422P10LE) +#define AV_PIX_FMT_YUV440P10 AV_PIX_FMT_NE(YUV440P10BE, YUV440P10LE) +#define AV_PIX_FMT_YUV444P10 AV_PIX_FMT_NE(YUV444P10BE, YUV444P10LE) +#define AV_PIX_FMT_YUV420P12 AV_PIX_FMT_NE(YUV420P12BE, YUV420P12LE) +#define AV_PIX_FMT_YUV422P12 AV_PIX_FMT_NE(YUV422P12BE, YUV422P12LE) +#define AV_PIX_FMT_YUV440P12 AV_PIX_FMT_NE(YUV440P12BE, YUV440P12LE) +#define AV_PIX_FMT_YUV444P12 AV_PIX_FMT_NE(YUV444P12BE, YUV444P12LE) +#define AV_PIX_FMT_YUV420P14 AV_PIX_FMT_NE(YUV420P14BE, YUV420P14LE) +#define AV_PIX_FMT_YUV422P14 AV_PIX_FMT_NE(YUV422P14BE, YUV422P14LE) +#define AV_PIX_FMT_YUV444P14 AV_PIX_FMT_NE(YUV444P14BE, YUV444P14LE) +#define AV_PIX_FMT_YUV420P16 AV_PIX_FMT_NE(YUV420P16BE, YUV420P16LE) +#define AV_PIX_FMT_YUV422P16 AV_PIX_FMT_NE(YUV422P16BE, YUV422P16LE) +#define AV_PIX_FMT_YUV444P16 AV_PIX_FMT_NE(YUV444P16BE, YUV444P16LE) + +#define AV_PIX_FMT_GBRP9 AV_PIX_FMT_NE(GBRP9BE , GBRP9LE) +#define AV_PIX_FMT_GBRP10 AV_PIX_FMT_NE(GBRP10BE, GBRP10LE) +#define AV_PIX_FMT_GBRP12 AV_PIX_FMT_NE(GBRP12BE, GBRP12LE) +#define AV_PIX_FMT_GBRP14 AV_PIX_FMT_NE(GBRP14BE, GBRP14LE) +#define AV_PIX_FMT_GBRP16 AV_PIX_FMT_NE(GBRP16BE, GBRP16LE) +#define AV_PIX_FMT_GBRAP10 AV_PIX_FMT_NE(GBRAP10BE, GBRAP10LE) +#define AV_PIX_FMT_GBRAP12 AV_PIX_FMT_NE(GBRAP12BE, GBRAP12LE) +#define AV_PIX_FMT_GBRAP16 AV_PIX_FMT_NE(GBRAP16BE, GBRAP16LE) + +#define AV_PIX_FMT_BAYER_BGGR16 AV_PIX_FMT_NE(BAYER_BGGR16BE, BAYER_BGGR16LE) +#define AV_PIX_FMT_BAYER_RGGB16 AV_PIX_FMT_NE(BAYER_RGGB16BE, BAYER_RGGB16LE) +#define AV_PIX_FMT_BAYER_GBRG16 AV_PIX_FMT_NE(BAYER_GBRG16BE, BAYER_GBRG16LE) +#define AV_PIX_FMT_BAYER_GRBG16 AV_PIX_FMT_NE(BAYER_GRBG16BE, BAYER_GRBG16LE) + +#define AV_PIX_FMT_GBRPF32 AV_PIX_FMT_NE(GBRPF32BE, GBRPF32LE) +#define AV_PIX_FMT_GBRAPF32 AV_PIX_FMT_NE(GBRAPF32BE, GBRAPF32LE) + +#define AV_PIX_FMT_YUVA420P9 AV_PIX_FMT_NE(YUVA420P9BE , YUVA420P9LE) +#define AV_PIX_FMT_YUVA422P9 AV_PIX_FMT_NE(YUVA422P9BE , YUVA422P9LE) +#define AV_PIX_FMT_YUVA444P9 AV_PIX_FMT_NE(YUVA444P9BE , YUVA444P9LE) +#define AV_PIX_FMT_YUVA420P10 AV_PIX_FMT_NE(YUVA420P10BE, YUVA420P10LE) +#define AV_PIX_FMT_YUVA422P10 AV_PIX_FMT_NE(YUVA422P10BE, YUVA422P10LE) +#define AV_PIX_FMT_YUVA444P10 AV_PIX_FMT_NE(YUVA444P10BE, YUVA444P10LE) +#define AV_PIX_FMT_YUVA420P16 AV_PIX_FMT_NE(YUVA420P16BE, YUVA420P16LE) +#define AV_PIX_FMT_YUVA422P16 AV_PIX_FMT_NE(YUVA422P16BE, YUVA422P16LE) +#define AV_PIX_FMT_YUVA444P16 AV_PIX_FMT_NE(YUVA444P16BE, YUVA444P16LE) + +#define AV_PIX_FMT_XYZ12 AV_PIX_FMT_NE(XYZ12BE, XYZ12LE) +#define AV_PIX_FMT_NV20 AV_PIX_FMT_NE(NV20BE, NV20LE) +#define AV_PIX_FMT_AYUV64 AV_PIX_FMT_NE(AYUV64BE, AYUV64LE) +#define AV_PIX_FMT_P010 AV_PIX_FMT_NE(P010BE, P010LE) +#define AV_PIX_FMT_P016 AV_PIX_FMT_NE(P016BE, P016LE) + +/** + * Chromaticity coordinates of the source primaries. + * These values match the ones defined by ISO/IEC 23001-8_2013 § 7.1. + */ +enum AVColorPrimaries { + AVCOL_PRI_RESERVED0 = 0, + AVCOL_PRI_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP177 Annex B + AVCOL_PRI_UNSPECIFIED = 2, + AVCOL_PRI_RESERVED = 3, + AVCOL_PRI_BT470M = 4, ///< also FCC Title 47 Code of Federal Regulations 73.682 (a)(20) + + AVCOL_PRI_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM + AVCOL_PRI_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC + AVCOL_PRI_SMPTE240M = 7, ///< functionally identical to above + AVCOL_PRI_FILM = 8, ///< colour filters using Illuminant C + AVCOL_PRI_BT2020 = 9, ///< ITU-R BT2020 + AVCOL_PRI_SMPTE428 = 10, ///< SMPTE ST 428-1 (CIE 1931 XYZ) + AVCOL_PRI_SMPTEST428_1 = AVCOL_PRI_SMPTE428, + AVCOL_PRI_SMPTE431 = 11, ///< SMPTE ST 431-2 (2011) / DCI P3 + AVCOL_PRI_SMPTE432 = 12, ///< SMPTE ST 432-1 (2010) / P3 D65 / Display P3 + AVCOL_PRI_JEDEC_P22 = 22, ///< JEDEC P22 phosphors + AVCOL_PRI_NB ///< Not part of ABI +}; + +/** + * Color Transfer Characteristic. + * These values match the ones defined by ISO/IEC 23001-8_2013 § 7.2. + */ +enum AVColorTransferCharacteristic { + AVCOL_TRC_RESERVED0 = 0, + AVCOL_TRC_BT709 = 1, ///< also ITU-R BT1361 + AVCOL_TRC_UNSPECIFIED = 2, + AVCOL_TRC_RESERVED = 3, + AVCOL_TRC_GAMMA22 = 4, ///< also ITU-R BT470M / ITU-R BT1700 625 PAL & SECAM + AVCOL_TRC_GAMMA28 = 5, ///< also ITU-R BT470BG + AVCOL_TRC_SMPTE170M = 6, ///< also ITU-R BT601-6 525 or 625 / ITU-R BT1358 525 or 625 / ITU-R BT1700 NTSC + AVCOL_TRC_SMPTE240M = 7, + AVCOL_TRC_LINEAR = 8, ///< "Linear transfer characteristics" + AVCOL_TRC_LOG = 9, ///< "Logarithmic transfer characteristic (100:1 range)" + AVCOL_TRC_LOG_SQRT = 10, ///< "Logarithmic transfer characteristic (100 * Sqrt(10) : 1 range)" + AVCOL_TRC_IEC61966_2_4 = 11, ///< IEC 61966-2-4 + AVCOL_TRC_BT1361_ECG = 12, ///< ITU-R BT1361 Extended Colour Gamut + AVCOL_TRC_IEC61966_2_1 = 13, ///< IEC 61966-2-1 (sRGB or sYCC) + AVCOL_TRC_BT2020_10 = 14, ///< ITU-R BT2020 for 10-bit system + AVCOL_TRC_BT2020_12 = 15, ///< ITU-R BT2020 for 12-bit system + AVCOL_TRC_SMPTE2084 = 16, ///< SMPTE ST 2084 for 10-, 12-, 14- and 16-bit systems + AVCOL_TRC_SMPTEST2084 = AVCOL_TRC_SMPTE2084, + AVCOL_TRC_SMPTE428 = 17, ///< SMPTE ST 428-1 + AVCOL_TRC_SMPTEST428_1 = AVCOL_TRC_SMPTE428, + AVCOL_TRC_ARIB_STD_B67 = 18, ///< ARIB STD-B67, known as "Hybrid log-gamma" + AVCOL_TRC_NB ///< Not part of ABI +}; + +/** + * YUV colorspace type. + * These values match the ones defined by ISO/IEC 23001-8_2013 § 7.3. + */ +enum AVColorSpace { + AVCOL_SPC_RGB = 0, ///< order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB) + AVCOL_SPC_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B + AVCOL_SPC_UNSPECIFIED = 2, + AVCOL_SPC_RESERVED = 3, + AVCOL_SPC_FCC = 4, ///< FCC Title 47 Code of Federal Regulations 73.682 (a)(20) + AVCOL_SPC_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601 + AVCOL_SPC_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC + AVCOL_SPC_SMPTE240M = 7, ///< functionally identical to above + AVCOL_SPC_YCGCO = 8, ///< Used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16 + AVCOL_SPC_YCOCG = AVCOL_SPC_YCGCO, + AVCOL_SPC_BT2020_NCL = 9, ///< ITU-R BT2020 non-constant luminance system + AVCOL_SPC_BT2020_CL = 10, ///< ITU-R BT2020 constant luminance system + AVCOL_SPC_SMPTE2085 = 11, ///< SMPTE 2085, Y'D'zD'x + AVCOL_SPC_CHROMA_DERIVED_NCL = 12, ///< Chromaticity-derived non-constant luminance system + AVCOL_SPC_CHROMA_DERIVED_CL = 13, ///< Chromaticity-derived constant luminance system + AVCOL_SPC_ICTCP = 14, ///< ITU-R BT.2100-0, ICtCp + AVCOL_SPC_NB ///< Not part of ABI +}; + +/** + * MPEG vs JPEG YUV range. + */ +enum AVColorRange { + AVCOL_RANGE_UNSPECIFIED = 0, + AVCOL_RANGE_MPEG = 1, ///< the normal 219*2^(n-8) "MPEG" YUV ranges + AVCOL_RANGE_JPEG = 2, ///< the normal 2^n-1 "JPEG" YUV ranges + AVCOL_RANGE_NB ///< Not part of ABI +}; + +/** + * Location of chroma samples. + * + * Illustration showing the location of the first (top left) chroma sample of the + * image, the left shows only luma, the right + * shows the location of the chroma sample, the 2 could be imagined to overlay + * each other but are drawn separately due to limitations of ASCII + * + * 1st 2nd 1st 2nd horizontal luma sample positions + * v v v v + * ______ ______ + *1st luma line > |X X ... |3 4 X ... X are luma samples, + * | |1 2 1-6 are possible chroma positions + *2nd luma line > |X X ... |5 6 X ... 0 is undefined/unknown position + */ +enum AVChromaLocation { + AVCHROMA_LOC_UNSPECIFIED = 0, + AVCHROMA_LOC_LEFT = 1, ///< MPEG-2/4 4:2:0, H.264 default for 4:2:0 + AVCHROMA_LOC_CENTER = 2, ///< MPEG-1 4:2:0, JPEG 4:2:0, H.263 4:2:0 + AVCHROMA_LOC_TOPLEFT = 3, ///< ITU-R 601, SMPTE 274M 296M S314M(DV 4:1:1), mpeg2 4:2:2 + AVCHROMA_LOC_TOP = 4, + AVCHROMA_LOC_BOTTOMLEFT = 5, + AVCHROMA_LOC_BOTTOM = 6, + AVCHROMA_LOC_NB ///< Not part of ABI +}; + +#endif /* AVUTIL_PIXFMT_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/random_seed.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/random_seed.h new file mode 100644 index 0000000..0462a04 --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/random_seed.h @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2009 Baptiste Coudurier + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_RANDOM_SEED_H +#define AVUTIL_RANDOM_SEED_H + +#include +/** + * @addtogroup lavu_crypto + * @{ + */ + +/** + * Get a seed to use in conjunction with random functions. + * This function tries to provide a good seed at a best effort bases. + * Its possible to call this function multiple times if more bits are needed. + * It can be quite slow, which is why it should only be used as seed for a faster + * PRNG. The quality of the seed depends on the platform. + */ +uint32_t av_get_random_seed(void); + +/** + * @} + */ + +#endif /* AVUTIL_RANDOM_SEED_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/rational.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/rational.h new file mode 100644 index 0000000..5c6b67b --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/rational.h @@ -0,0 +1,214 @@ +/* + * rational numbers + * Copyright (c) 2003 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * @ingroup lavu_math_rational + * Utilties for rational number calculation. + * @author Michael Niedermayer + */ + +#ifndef AVUTIL_RATIONAL_H +#define AVUTIL_RATIONAL_H + +#include +#include +#include "attributes.h" + +/** + * @defgroup lavu_math_rational AVRational + * @ingroup lavu_math + * Rational number calculation. + * + * While rational numbers can be expressed as floating-point numbers, the + * conversion process is a lossy one, so are floating-point operations. On the + * other hand, the nature of FFmpeg demands highly accurate calculation of + * timestamps. This set of rational number utilities serves as a generic + * interface for manipulating rational numbers as pairs of numerators and + * denominators. + * + * Many of the functions that operate on AVRational's have the suffix `_q`, in + * reference to the mathematical symbol "ℚ" (Q) which denotes the set of all + * rational numbers. + * + * @{ + */ + +/** + * Rational number (pair of numerator and denominator). + */ +typedef struct AVRational{ + int num; ///< Numerator + int den; ///< Denominator +} AVRational; + +/** + * Create an AVRational. + * + * Useful for compilers that do not support compound literals. + * + * @note The return value is not reduced. + * @see av_reduce() + */ +static inline AVRational av_make_q(int num, int den) +{ + AVRational r = { num, den }; + return r; +} + +/** + * Compare two rationals. + * + * @param a First rational + * @param b Second rational + * + * @return One of the following values: + * - 0 if `a == b` + * - 1 if `a > b` + * - -1 if `a < b` + * - `INT_MIN` if one of the values is of the form `0 / 0` + */ +static inline int av_cmp_q(AVRational a, AVRational b){ + const int64_t tmp= a.num * (int64_t)b.den - b.num * (int64_t)a.den; + + if(tmp) return (int)((tmp ^ a.den ^ b.den)>>63)|1; + else if(b.den && a.den) return 0; + else if(a.num && b.num) return (a.num>>31) - (b.num>>31); + else return INT_MIN; +} + +/** + * Convert an AVRational to a `double`. + * @param a AVRational to convert + * @return `a` in floating-point form + * @see av_d2q() + */ +static inline double av_q2d(AVRational a){ + return a.num / (double) a.den; +} + +/** + * Reduce a fraction. + * + * This is useful for framerate calculations. + * + * @param[out] dst_num Destination numerator + * @param[out] dst_den Destination denominator + * @param[in] num Source numerator + * @param[in] den Source denominator + * @param[in] max Maximum allowed values for `dst_num` & `dst_den` + * @return 1 if the operation is exact, 0 otherwise + */ +int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max); + +/** + * Multiply two rationals. + * @param b First rational + * @param c Second rational + * @return b*c + */ +AVRational av_mul_q(AVRational b, AVRational c) av_const; + +/** + * Divide one rational by another. + * @param b First rational + * @param c Second rational + * @return b/c + */ +AVRational av_div_q(AVRational b, AVRational c) av_const; + +/** + * Add two rationals. + * @param b First rational + * @param c Second rational + * @return b+c + */ +AVRational av_add_q(AVRational b, AVRational c) av_const; + +/** + * Subtract one rational from another. + * @param b First rational + * @param c Second rational + * @return b-c + */ +AVRational av_sub_q(AVRational b, AVRational c) av_const; + +/** + * Invert a rational. + * @param q value + * @return 1 / q + */ +static av_always_inline AVRational av_inv_q(AVRational q) +{ + AVRational r = { q.den, q.num }; + return r; +} + +/** + * Convert a double precision floating point number to a rational. + * + * In case of infinity, the returned value is expressed as `{1, 0}` or + * `{-1, 0}` depending on the sign. + * + * @param d `double` to convert + * @param max Maximum allowed numerator and denominator + * @return `d` in AVRational form + * @see av_q2d() + */ +AVRational av_d2q(double d, int max) av_const; + +/** + * Find which of the two rationals is closer to another rational. + * + * @param q Rational to be compared against + * @param q1,q2 Rationals to be tested + * @return One of the following values: + * - 1 if `q1` is nearer to `q` than `q2` + * - -1 if `q2` is nearer to `q` than `q1` + * - 0 if they have the same distance + */ +int av_nearer_q(AVRational q, AVRational q1, AVRational q2); + +/** + * Find the value in a list of rationals nearest a given reference rational. + * + * @param q Reference rational + * @param q_list Array of rationals terminated by `{0, 0}` + * @return Index of the nearest value found in the array + */ +int av_find_nearest_q_idx(AVRational q, const AVRational* q_list); + +/** + * Convert an AVRational to a IEEE 32-bit `float` expressed in fixed-point + * format. + * + * @param q Rational to be converted + * @return Equivalent floating-point value, expressed as an unsigned 32-bit + * integer. + * @note The returned value is platform-indepedant. + */ +uint32_t av_q2intfloat(AVRational q); + +/** + * @} + */ + +#endif /* AVUTIL_RATIONAL_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/rc4.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/rc4.h new file mode 100644 index 0000000..029cd2a --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/rc4.h @@ -0,0 +1,66 @@ +/* + * RC4 encryption/decryption/pseudo-random number generator + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_RC4_H +#define AVUTIL_RC4_H + +#include + +/** + * @defgroup lavu_rc4 RC4 + * @ingroup lavu_crypto + * @{ + */ + +typedef struct AVRC4 { + uint8_t state[256]; + int x, y; +} AVRC4; + +/** + * Allocate an AVRC4 context. + */ +AVRC4 *av_rc4_alloc(void); + +/** + * @brief Initializes an AVRC4 context. + * + * @param key_bits must be a multiple of 8 + * @param decrypt 0 for encryption, 1 for decryption, currently has no effect + * @return zero on success, negative value otherwise + */ +int av_rc4_init(struct AVRC4 *d, const uint8_t *key, int key_bits, int decrypt); + +/** + * @brief Encrypts / decrypts using the RC4 algorithm. + * + * @param count number of bytes + * @param dst destination array, can be equal to src + * @param src source array, can be equal to dst, may be NULL + * @param iv not (yet) used for RC4, should be NULL + * @param decrypt 0 for encryption, 1 for decryption, not (yet) used + */ +void av_rc4_crypt(struct AVRC4 *d, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt); + +/** + * @} + */ + +#endif /* AVUTIL_RC4_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/replaygain.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/replaygain.h new file mode 100644 index 0000000..b49bf1a --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/replaygain.h @@ -0,0 +1,50 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_REPLAYGAIN_H +#define AVUTIL_REPLAYGAIN_H + +#include + +/** + * ReplayGain information (see + * http://wiki.hydrogenaudio.org/index.php?title=ReplayGain_1.0_specification). + * The size of this struct is a part of the public ABI. + */ +typedef struct AVReplayGain { + /** + * Track replay gain in microbels (divide by 100000 to get the value in dB). + * Should be set to INT32_MIN when unknown. + */ + int32_t track_gain; + /** + * Peak track amplitude, with 100000 representing full scale (but values + * may overflow). 0 when unknown. + */ + uint32_t track_peak; + /** + * Same as track_gain, but for the whole album. + */ + int32_t album_gain; + /** + * Same as track_peak, but for the whole album, + */ + uint32_t album_peak; +} AVReplayGain; + +#endif /* AVUTIL_REPLAYGAIN_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/ripemd.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/ripemd.h new file mode 100644 index 0000000..0db6858 --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/ripemd.h @@ -0,0 +1,87 @@ +/* + * Copyright (C) 2007 Michael Niedermayer + * Copyright (C) 2013 James Almer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * @ingroup lavu_ripemd + * Public header for RIPEMD hash function implementation. + */ + +#ifndef AVUTIL_RIPEMD_H +#define AVUTIL_RIPEMD_H + +#include + +#include "attributes.h" +#include "version.h" + +/** + * @defgroup lavu_ripemd RIPEMD + * @ingroup lavu_hash + * RIPEMD hash function implementation. + * + * @{ + */ + +extern const int av_ripemd_size; + +struct AVRIPEMD; + +/** + * Allocate an AVRIPEMD context. + */ +struct AVRIPEMD *av_ripemd_alloc(void); + +/** + * Initialize RIPEMD hashing. + * + * @param context pointer to the function context (of size av_ripemd_size) + * @param bits number of bits in digest (128, 160, 256 or 320 bits) + * @return zero if initialization succeeded, -1 otherwise + */ +int av_ripemd_init(struct AVRIPEMD* context, int bits); + +/** + * Update hash value. + * + * @param context hash function context + * @param data input data to update hash with + * @param len input data length + */ +#if FF_API_CRYPTO_SIZE_T +void av_ripemd_update(struct AVRIPEMD* context, const uint8_t* data, unsigned int len); +#else +void av_ripemd_update(struct AVRIPEMD* context, const uint8_t* data, size_t len); +#endif + +/** + * Finish hashing and output digest value. + * + * @param context hash function context + * @param digest buffer where output digest value is stored + */ +void av_ripemd_final(struct AVRIPEMD* context, uint8_t *digest); + +/** + * @} + */ + +#endif /* AVUTIL_RIPEMD_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/samplefmt.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/samplefmt.h new file mode 100644 index 0000000..8cd43ae --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/samplefmt.h @@ -0,0 +1,272 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_SAMPLEFMT_H +#define AVUTIL_SAMPLEFMT_H + +#include + +#include "avutil.h" +#include "attributes.h" + +/** + * @addtogroup lavu_audio + * @{ + * + * @defgroup lavu_sampfmts Audio sample formats + * + * Audio sample format enumeration and related convenience functions. + * @{ + */ + +/** + * Audio sample formats + * + * - The data described by the sample format is always in native-endian order. + * Sample values can be expressed by native C types, hence the lack of a signed + * 24-bit sample format even though it is a common raw audio data format. + * + * - The floating-point formats are based on full volume being in the range + * [-1.0, 1.0]. Any values outside this range are beyond full volume level. + * + * - The data layout as used in av_samples_fill_arrays() and elsewhere in FFmpeg + * (such as AVFrame in libavcodec) is as follows: + * + * @par + * For planar sample formats, each audio channel is in a separate data plane, + * and linesize is the buffer size, in bytes, for a single plane. All data + * planes must be the same size. For packed sample formats, only the first data + * plane is used, and samples for each channel are interleaved. In this case, + * linesize is the buffer size, in bytes, for the 1 plane. + * + */ +enum AVSampleFormat { + AV_SAMPLE_FMT_NONE = -1, + AV_SAMPLE_FMT_U8, ///< unsigned 8 bits + AV_SAMPLE_FMT_S16, ///< signed 16 bits + AV_SAMPLE_FMT_S32, ///< signed 32 bits + AV_SAMPLE_FMT_FLT, ///< float + AV_SAMPLE_FMT_DBL, ///< double + + AV_SAMPLE_FMT_U8P, ///< unsigned 8 bits, planar + AV_SAMPLE_FMT_S16P, ///< signed 16 bits, planar + AV_SAMPLE_FMT_S32P, ///< signed 32 bits, planar + AV_SAMPLE_FMT_FLTP, ///< float, planar + AV_SAMPLE_FMT_DBLP, ///< double, planar + AV_SAMPLE_FMT_S64, ///< signed 64 bits + AV_SAMPLE_FMT_S64P, ///< signed 64 bits, planar + + AV_SAMPLE_FMT_NB ///< Number of sample formats. DO NOT USE if linking dynamically +}; + +/** + * Return the name of sample_fmt, or NULL if sample_fmt is not + * recognized. + */ +const char *av_get_sample_fmt_name(enum AVSampleFormat sample_fmt); + +/** + * Return a sample format corresponding to name, or AV_SAMPLE_FMT_NONE + * on error. + */ +enum AVSampleFormat av_get_sample_fmt(const char *name); + +/** + * Return the planar<->packed alternative form of the given sample format, or + * AV_SAMPLE_FMT_NONE on error. If the passed sample_fmt is already in the + * requested planar/packed format, the format returned is the same as the + * input. + */ +enum AVSampleFormat av_get_alt_sample_fmt(enum AVSampleFormat sample_fmt, int planar); + +/** + * Get the packed alternative form of the given sample format. + * + * If the passed sample_fmt is already in packed format, the format returned is + * the same as the input. + * + * @return the packed alternative form of the given sample format or + AV_SAMPLE_FMT_NONE on error. + */ +enum AVSampleFormat av_get_packed_sample_fmt(enum AVSampleFormat sample_fmt); + +/** + * Get the planar alternative form of the given sample format. + * + * If the passed sample_fmt is already in planar format, the format returned is + * the same as the input. + * + * @return the planar alternative form of the given sample format or + AV_SAMPLE_FMT_NONE on error. + */ +enum AVSampleFormat av_get_planar_sample_fmt(enum AVSampleFormat sample_fmt); + +/** + * Generate a string corresponding to the sample format with + * sample_fmt, or a header if sample_fmt is negative. + * + * @param buf the buffer where to write the string + * @param buf_size the size of buf + * @param sample_fmt the number of the sample format to print the + * corresponding info string, or a negative value to print the + * corresponding header. + * @return the pointer to the filled buffer or NULL if sample_fmt is + * unknown or in case of other errors + */ +char *av_get_sample_fmt_string(char *buf, int buf_size, enum AVSampleFormat sample_fmt); + +/** + * Return number of bytes per sample. + * + * @param sample_fmt the sample format + * @return number of bytes per sample or zero if unknown for the given + * sample format + */ +int av_get_bytes_per_sample(enum AVSampleFormat sample_fmt); + +/** + * Check if the sample format is planar. + * + * @param sample_fmt the sample format to inspect + * @return 1 if the sample format is planar, 0 if it is interleaved + */ +int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt); + +/** + * Get the required buffer size for the given audio parameters. + * + * @param[out] linesize calculated linesize, may be NULL + * @param nb_channels the number of channels + * @param nb_samples the number of samples in a single channel + * @param sample_fmt the sample format + * @param align buffer size alignment (0 = default, 1 = no alignment) + * @return required buffer size, or negative error code on failure + */ +int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, + enum AVSampleFormat sample_fmt, int align); + +/** + * @} + * + * @defgroup lavu_sampmanip Samples manipulation + * + * Functions that manipulate audio samples + * @{ + */ + +/** + * Fill plane data pointers and linesize for samples with sample + * format sample_fmt. + * + * The audio_data array is filled with the pointers to the samples data planes: + * for planar, set the start point of each channel's data within the buffer, + * for packed, set the start point of the entire buffer only. + * + * The value pointed to by linesize is set to the aligned size of each + * channel's data buffer for planar layout, or to the aligned size of the + * buffer for all channels for packed layout. + * + * The buffer in buf must be big enough to contain all the samples + * (use av_samples_get_buffer_size() to compute its minimum size), + * otherwise the audio_data pointers will point to invalid data. + * + * @see enum AVSampleFormat + * The documentation for AVSampleFormat describes the data layout. + * + * @param[out] audio_data array to be filled with the pointer for each channel + * @param[out] linesize calculated linesize, may be NULL + * @param buf the pointer to a buffer containing the samples + * @param nb_channels the number of channels + * @param nb_samples the number of samples in a single channel + * @param sample_fmt the sample format + * @param align buffer size alignment (0 = default, 1 = no alignment) + * @return >=0 on success or a negative error code on failure + * @todo return minimum size in bytes required for the buffer in case + * of success at the next bump + */ +int av_samples_fill_arrays(uint8_t **audio_data, int *linesize, + const uint8_t *buf, + int nb_channels, int nb_samples, + enum AVSampleFormat sample_fmt, int align); + +/** + * Allocate a samples buffer for nb_samples samples, and fill data pointers and + * linesize accordingly. + * The allocated samples buffer can be freed by using av_freep(&audio_data[0]) + * Allocated data will be initialized to silence. + * + * @see enum AVSampleFormat + * The documentation for AVSampleFormat describes the data layout. + * + * @param[out] audio_data array to be filled with the pointer for each channel + * @param[out] linesize aligned size for audio buffer(s), may be NULL + * @param nb_channels number of audio channels + * @param nb_samples number of samples per channel + * @param align buffer size alignment (0 = default, 1 = no alignment) + * @return >=0 on success or a negative error code on failure + * @todo return the size of the allocated buffer in case of success at the next bump + * @see av_samples_fill_arrays() + * @see av_samples_alloc_array_and_samples() + */ +int av_samples_alloc(uint8_t **audio_data, int *linesize, int nb_channels, + int nb_samples, enum AVSampleFormat sample_fmt, int align); + +/** + * Allocate a data pointers array, samples buffer for nb_samples + * samples, and fill data pointers and linesize accordingly. + * + * This is the same as av_samples_alloc(), but also allocates the data + * pointers array. + * + * @see av_samples_alloc() + */ +int av_samples_alloc_array_and_samples(uint8_t ***audio_data, int *linesize, int nb_channels, + int nb_samples, enum AVSampleFormat sample_fmt, int align); + +/** + * Copy samples from src to dst. + * + * @param dst destination array of pointers to data planes + * @param src source array of pointers to data planes + * @param dst_offset offset in samples at which the data will be written to dst + * @param src_offset offset in samples at which the data will be read from src + * @param nb_samples number of samples to be copied + * @param nb_channels number of audio channels + * @param sample_fmt audio sample format + */ +int av_samples_copy(uint8_t **dst, uint8_t * const *src, int dst_offset, + int src_offset, int nb_samples, int nb_channels, + enum AVSampleFormat sample_fmt); + +/** + * Fill an audio buffer with silence. + * + * @param audio_data array of pointers to data planes + * @param offset offset in samples at which to start filling + * @param nb_samples number of samples to fill + * @param nb_channels number of audio channels + * @param sample_fmt audio sample format + */ +int av_samples_set_silence(uint8_t **audio_data, int offset, int nb_samples, + int nb_channels, enum AVSampleFormat sample_fmt); + +/** + * @} + * @} + */ +#endif /* AVUTIL_SAMPLEFMT_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/sha.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/sha.h new file mode 100644 index 0000000..c0180e5 --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/sha.h @@ -0,0 +1,95 @@ +/* + * Copyright (C) 2007 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * @ingroup lavu_sha + * Public header for SHA-1 & SHA-256 hash function implementations. + */ + +#ifndef AVUTIL_SHA_H +#define AVUTIL_SHA_H + +#include +#include + +#include "attributes.h" +#include "version.h" + +/** + * @defgroup lavu_sha SHA + * @ingroup lavu_hash + * SHA-1 and SHA-256 (Secure Hash Algorithm) hash function implementations. + * + * This module supports the following SHA hash functions: + * + * - SHA-1: 160 bits + * - SHA-224: 224 bits, as a variant of SHA-2 + * - SHA-256: 256 bits, as a variant of SHA-2 + * + * @see For SHA-384, SHA-512, and variants thereof, see @ref lavu_sha512. + * + * @{ + */ + +extern const int av_sha_size; + +struct AVSHA; + +/** + * Allocate an AVSHA context. + */ +struct AVSHA *av_sha_alloc(void); + +/** + * Initialize SHA-1 or SHA-2 hashing. + * + * @param context pointer to the function context (of size av_sha_size) + * @param bits number of bits in digest (SHA-1 - 160 bits, SHA-2 224 or 256 bits) + * @return zero if initialization succeeded, -1 otherwise + */ +int av_sha_init(struct AVSHA* context, int bits); + +/** + * Update hash value. + * + * @param ctx hash function context + * @param data input data to update hash with + * @param len input data length + */ +#if FF_API_CRYPTO_SIZE_T +void av_sha_update(struct AVSHA *ctx, const uint8_t *data, unsigned int len); +#else +void av_sha_update(struct AVSHA *ctx, const uint8_t *data, size_t len); +#endif + +/** + * Finish hashing and output digest value. + * + * @param context hash function context + * @param digest buffer where output digest value is stored + */ +void av_sha_final(struct AVSHA* context, uint8_t *digest); + +/** + * @} + */ + +#endif /* AVUTIL_SHA_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/sha512.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/sha512.h new file mode 100644 index 0000000..bef714b --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/sha512.h @@ -0,0 +1,97 @@ +/* + * Copyright (C) 2007 Michael Niedermayer + * Copyright (C) 2013 James Almer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * @ingroup lavu_sha512 + * Public header for SHA-512 implementation. + */ + +#ifndef AVUTIL_SHA512_H +#define AVUTIL_SHA512_H + +#include +#include + +#include "attributes.h" +#include "version.h" + +/** + * @defgroup lavu_sha512 SHA-512 + * @ingroup lavu_hash + * SHA-512 (Secure Hash Algorithm) hash function implementations. + * + * This module supports the following SHA-2 hash functions: + * + * - SHA-512/224: 224 bits + * - SHA-512/256: 256 bits + * - SHA-384: 384 bits + * - SHA-512: 512 bits + * + * @see For SHA-1, SHA-256, and variants thereof, see @ref lavu_sha. + * + * @{ + */ + +extern const int av_sha512_size; + +struct AVSHA512; + +/** + * Allocate an AVSHA512 context. + */ +struct AVSHA512 *av_sha512_alloc(void); + +/** + * Initialize SHA-2 512 hashing. + * + * @param context pointer to the function context (of size av_sha512_size) + * @param bits number of bits in digest (224, 256, 384 or 512 bits) + * @return zero if initialization succeeded, -1 otherwise + */ +int av_sha512_init(struct AVSHA512* context, int bits); + +/** + * Update hash value. + * + * @param context hash function context + * @param data input data to update hash with + * @param len input data length + */ +#if FF_API_CRYPTO_SIZE_T +void av_sha512_update(struct AVSHA512* context, const uint8_t* data, unsigned int len); +#else +void av_sha512_update(struct AVSHA512* context, const uint8_t* data, size_t len); +#endif + +/** + * Finish hashing and output digest value. + * + * @param context hash function context + * @param digest buffer where output digest value is stored + */ +void av_sha512_final(struct AVSHA512* context, uint8_t *digest); + +/** + * @} + */ + +#endif /* AVUTIL_SHA512_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/spherical.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/spherical.h new file mode 100644 index 0000000..cef759c --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/spherical.h @@ -0,0 +1,232 @@ +/* + * Copyright (c) 2016 Vittorio Giovara + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * Spherical video + */ + +#ifndef AVUTIL_SPHERICAL_H +#define AVUTIL_SPHERICAL_H + +#include +#include + +/** + * @addtogroup lavu_video + * @{ + * + * @defgroup lavu_video_spherical Spherical video mapping + * @{ + */ + +/** + * @addtogroup lavu_video_spherical + * A spherical video file contains surfaces that need to be mapped onto a + * sphere. Depending on how the frame was converted, a different distortion + * transformation or surface recomposition function needs to be applied before + * the video should be mapped and displayed. + */ + +/** + * Projection of the video surface(s) on a sphere. + */ +enum AVSphericalProjection { + /** + * Video represents a sphere mapped on a flat surface using + * equirectangular projection. + */ + AV_SPHERICAL_EQUIRECTANGULAR, + + /** + * Video frame is split into 6 faces of a cube, and arranged on a + * 3x2 layout. Faces are oriented upwards for the front, left, right, + * and back faces. The up face is oriented so the top of the face is + * forwards and the down face is oriented so the top of the face is + * to the back. + */ + AV_SPHERICAL_CUBEMAP, + + /** + * Video represents a portion of a sphere mapped on a flat surface + * using equirectangular projection. The @ref bounding fields indicate + * the position of the current video in a larger surface. + */ + AV_SPHERICAL_EQUIRECTANGULAR_TILE, +}; + +/** + * This structure describes how to handle spherical videos, outlining + * information about projection, initial layout, and any other view modifier. + * + * @note The struct must be allocated with av_spherical_alloc() and + * its size is not a part of the public ABI. + */ +typedef struct AVSphericalMapping { + /** + * Projection type. + */ + enum AVSphericalProjection projection; + + /** + * @name Initial orientation + * @{ + * There fields describe additional rotations applied to the sphere after + * the video frame is mapped onto it. The sphere is rotated around the + * viewer, who remains stationary. The order of transformation is always + * yaw, followed by pitch, and finally by roll. + * + * The coordinate system matches the one defined in OpenGL, where the + * forward vector (z) is coming out of screen, and it is equivalent to + * a rotation matrix of R = r_y(yaw) * r_x(pitch) * r_z(roll). + * + * A positive yaw rotates the portion of the sphere in front of the viewer + * toward their right. A positive pitch rotates the portion of the sphere + * in front of the viewer upwards. A positive roll tilts the portion of + * the sphere in front of the viewer to the viewer's right. + * + * These values are exported as 16.16 fixed point. + * + * See this equirectangular projection as example: + * + * @code{.unparsed} + * Yaw + * -180 0 180 + * 90 +-------------+-------------+ 180 + * | | | up + * P | | | y| forward + * i | ^ | | /z + * t 0 +-------------X-------------+ 0 Roll | / + * c | | | | / + * h | | | 0|/_____right + * | | | x + * -90 +-------------+-------------+ -180 + * + * X - the default camera center + * ^ - the default up vector + * @endcode + */ + int32_t yaw; ///< Rotation around the up vector [-180, 180]. + int32_t pitch; ///< Rotation around the right vector [-90, 90]. + int32_t roll; ///< Rotation around the forward vector [-180, 180]. + /** + * @} + */ + + /** + * @name Bounding rectangle + * @anchor bounding + * @{ + * These fields indicate the location of the current tile, and where + * it should be mapped relative to the original surface. They are + * exported as 0.32 fixed point, and can be converted to classic + * pixel values with av_spherical_bounds(). + * + * @code{.unparsed} + * +----------------+----------+ + * | |bound_top | + * | +--------+ | + * | bound_left |tile | | + * +<---------->| |<--->+bound_right + * | +--------+ | + * | | | + * | bound_bottom| | + * +----------------+----------+ + * @endcode + * + * If needed, the original video surface dimensions can be derived + * by adding the current stream or frame size to the related bounds, + * like in the following example: + * + * @code{c} + * original_width = tile->width + bound_left + bound_right; + * original_height = tile->height + bound_top + bound_bottom; + * @endcode + * + * @note These values are valid only for the tiled equirectangular + * projection type (@ref AV_SPHERICAL_EQUIRECTANGULAR_TILE), + * and should be ignored in all other cases. + */ + uint32_t bound_left; ///< Distance from the left edge + uint32_t bound_top; ///< Distance from the top edge + uint32_t bound_right; ///< Distance from the right edge + uint32_t bound_bottom; ///< Distance from the bottom edge + /** + * @} + */ + + /** + * Number of pixels to pad from the edge of each cube face. + * + * @note This value is valid for only for the cubemap projection type + * (@ref AV_SPHERICAL_CUBEMAP), and should be ignored in all other + * cases. + */ + uint32_t padding; +} AVSphericalMapping; + +/** + * Allocate a AVSphericalVideo structure and initialize its fields to default + * values. + * + * @return the newly allocated struct or NULL on failure + */ +AVSphericalMapping *av_spherical_alloc(size_t *size); + +/** + * Convert the @ref bounding fields from an AVSphericalVideo + * from 0.32 fixed point to pixels. + * + * @param map The AVSphericalVideo map to read bound values from. + * @param width Width of the current frame or stream. + * @param height Height of the current frame or stream. + * @param left Pixels from the left edge. + * @param top Pixels from the top edge. + * @param right Pixels from the right edge. + * @param bottom Pixels from the bottom edge. + */ +void av_spherical_tile_bounds(const AVSphericalMapping *map, + size_t width, size_t height, + size_t *left, size_t *top, + size_t *right, size_t *bottom); + +/** + * Provide a human-readable name of a given AVSphericalProjection. + * + * @param projection The input AVSphericalProjection. + * + * @return The name of the AVSphericalProjection, or "unknown". + */ +const char *av_spherical_projection_name(enum AVSphericalProjection projection); + +/** + * Get the AVSphericalProjection form a human-readable name. + * + * @param name The input string. + * + * @return The AVSphericalProjection value, or -1 if not found. + */ +int av_spherical_from_name(const char *name); +/** + * @} + * @} + */ + +#endif /* AVUTIL_SPHERICAL_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/stereo3d.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/stereo3d.h new file mode 100644 index 0000000..d421aac --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/stereo3d.h @@ -0,0 +1,233 @@ +/* + * Copyright (c) 2013 Vittorio Giovara + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * Stereoscopic video + */ + +#ifndef AVUTIL_STEREO3D_H +#define AVUTIL_STEREO3D_H + +#include + +#include "frame.h" + +/** + * @addtogroup lavu_video + * @{ + * + * @defgroup lavu_video_stereo3d Stereo3D types and functions + * @{ + */ + +/** + * @addtogroup lavu_video_stereo3d + * A stereoscopic video file consists in multiple views embedded in a single + * frame, usually describing two views of a scene. This file describes all + * possible codec-independent view arrangements. + * */ + +/** + * List of possible 3D Types + */ +enum AVStereo3DType { + /** + * Video is not stereoscopic (and metadata has to be there). + */ + AV_STEREO3D_2D, + + /** + * Views are next to each other. + * + * @code{.unparsed} + * LLLLRRRR + * LLLLRRRR + * LLLLRRRR + * ... + * @endcode + */ + AV_STEREO3D_SIDEBYSIDE, + + /** + * Views are on top of each other. + * + * @code{.unparsed} + * LLLLLLLL + * LLLLLLLL + * RRRRRRRR + * RRRRRRRR + * @endcode + */ + AV_STEREO3D_TOPBOTTOM, + + /** + * Views are alternated temporally. + * + * @code{.unparsed} + * frame0 frame1 frame2 ... + * LLLLLLLL RRRRRRRR LLLLLLLL + * LLLLLLLL RRRRRRRR LLLLLLLL + * LLLLLLLL RRRRRRRR LLLLLLLL + * ... ... ... + * @endcode + */ + AV_STEREO3D_FRAMESEQUENCE, + + /** + * Views are packed in a checkerboard-like structure per pixel. + * + * @code{.unparsed} + * LRLRLRLR + * RLRLRLRL + * LRLRLRLR + * ... + * @endcode + */ + AV_STEREO3D_CHECKERBOARD, + + /** + * Views are next to each other, but when upscaling + * apply a checkerboard pattern. + * + * @code{.unparsed} + * LLLLRRRR L L L L R R R R + * LLLLRRRR => L L L L R R R R + * LLLLRRRR L L L L R R R R + * LLLLRRRR L L L L R R R R + * @endcode + */ + AV_STEREO3D_SIDEBYSIDE_QUINCUNX, + + /** + * Views are packed per line, as if interlaced. + * + * @code{.unparsed} + * LLLLLLLL + * RRRRRRRR + * LLLLLLLL + * ... + * @endcode + */ + AV_STEREO3D_LINES, + + /** + * Views are packed per column. + * + * @code{.unparsed} + * LRLRLRLR + * LRLRLRLR + * LRLRLRLR + * ... + * @endcode + */ + AV_STEREO3D_COLUMNS, +}; + +/** + * List of possible view types. + */ +enum AVStereo3DView { + /** + * Frame contains two packed views. + */ + AV_STEREO3D_VIEW_PACKED, + + /** + * Frame contains only the left view. + */ + AV_STEREO3D_VIEW_LEFT, + + /** + * Frame contains only the right view. + */ + AV_STEREO3D_VIEW_RIGHT, +}; + +/** + * Inverted views, Right/Bottom represents the left view. + */ +#define AV_STEREO3D_FLAG_INVERT (1 << 0) + +/** + * Stereo 3D type: this structure describes how two videos are packed + * within a single video surface, with additional information as needed. + * + * @note The struct must be allocated with av_stereo3d_alloc() and + * its size is not a part of the public ABI. + */ +typedef struct AVStereo3D { + /** + * How views are packed within the video. + */ + enum AVStereo3DType type; + + /** + * Additional information about the frame packing. + */ + int flags; + + /** + * Determines which views are packed. + */ + enum AVStereo3DView view; +} AVStereo3D; + +/** + * Allocate an AVStereo3D structure and set its fields to default values. + * The resulting struct can be freed using av_freep(). + * + * @return An AVStereo3D filled with default values or NULL on failure. + */ +AVStereo3D *av_stereo3d_alloc(void); + +/** + * Allocate a complete AVFrameSideData and add it to the frame. + * + * @param frame The frame which side data is added to. + * + * @return The AVStereo3D structure to be filled by caller. + */ +AVStereo3D *av_stereo3d_create_side_data(AVFrame *frame); + +/** + * Provide a human-readable name of a given stereo3d type. + * + * @param type The input stereo3d type value. + * + * @return The name of the stereo3d value, or "unknown". + */ +const char *av_stereo3d_type_name(unsigned int type); + +/** + * Get the AVStereo3DType form a human-readable name. + * + * @param name The input string. + * + * @return The AVStereo3DType value, or -1 if not found. + */ +int av_stereo3d_from_name(const char *name); + +/** + * @} + * @} + */ + +#endif /* AVUTIL_STEREO3D_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/tea.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/tea.h new file mode 100644 index 0000000..dd929bd --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/tea.h @@ -0,0 +1,71 @@ +/* + * A 32-bit implementation of the TEA algorithm + * Copyright (c) 2015 Vesselin Bontchev + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_TEA_H +#define AVUTIL_TEA_H + +#include + +/** + * @file + * @brief Public header for libavutil TEA algorithm + * @defgroup lavu_tea TEA + * @ingroup lavu_crypto + * @{ + */ + +extern const int av_tea_size; + +struct AVTEA; + +/** + * Allocate an AVTEA context + * To free the struct: av_free(ptr) + */ +struct AVTEA *av_tea_alloc(void); + +/** + * Initialize an AVTEA context. + * + * @param ctx an AVTEA context + * @param key a key of 16 bytes used for encryption/decryption + * @param rounds the number of rounds in TEA (64 is the "standard") + */ +void av_tea_init(struct AVTEA *ctx, const uint8_t key[16], int rounds); + +/** + * Encrypt or decrypt a buffer using a previously initialized context. + * + * @param ctx an AVTEA context + * @param dst destination array, can be equal to src + * @param src source array, can be equal to dst + * @param count number of 8 byte blocks + * @param iv initialization vector for CBC mode, if NULL then ECB will be used + * @param decrypt 0 for encryption, 1 for decryption + */ +void av_tea_crypt(struct AVTEA *ctx, uint8_t *dst, const uint8_t *src, + int count, uint8_t *iv, int decrypt); + +/** + * @} + */ + +#endif /* AVUTIL_TEA_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/threadmessage.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/threadmessage.h new file mode 100644 index 0000000..8480a0a --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/threadmessage.h @@ -0,0 +1,107 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with FFmpeg; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_THREADMESSAGE_H +#define AVUTIL_THREADMESSAGE_H + +typedef struct AVThreadMessageQueue AVThreadMessageQueue; + +typedef enum AVThreadMessageFlags { + + /** + * Perform non-blocking operation. + * If this flag is set, send and recv operations are non-blocking and + * return AVERROR(EAGAIN) immediately if they can not proceed. + */ + AV_THREAD_MESSAGE_NONBLOCK = 1, + +} AVThreadMessageFlags; + +/** + * Allocate a new message queue. + * + * @param mq pointer to the message queue + * @param nelem maximum number of elements in the queue + * @param elsize size of each element in the queue + * @return >=0 for success; <0 for error, in particular AVERROR(ENOSYS) if + * lavu was built without thread support + */ +int av_thread_message_queue_alloc(AVThreadMessageQueue **mq, + unsigned nelem, + unsigned elsize); + +/** + * Free a message queue. + * + * The message queue must no longer be in use by another thread. + */ +void av_thread_message_queue_free(AVThreadMessageQueue **mq); + +/** + * Send a message on the queue. + */ +int av_thread_message_queue_send(AVThreadMessageQueue *mq, + void *msg, + unsigned flags); + +/** + * Receive a message from the queue. + */ +int av_thread_message_queue_recv(AVThreadMessageQueue *mq, + void *msg, + unsigned flags); + +/** + * Set the sending error code. + * + * If the error code is set to non-zero, av_thread_message_queue_send() will + * return it immediately. Conventional values, such as AVERROR_EOF or + * AVERROR(EAGAIN), can be used to cause the sending thread to stop or + * suspend its operation. + */ +void av_thread_message_queue_set_err_send(AVThreadMessageQueue *mq, + int err); + +/** + * Set the receiving error code. + * + * If the error code is set to non-zero, av_thread_message_queue_recv() will + * return it immediately when there are no longer available messages. + * Conventional values, such as AVERROR_EOF or AVERROR(EAGAIN), can be used + * to cause the receiving thread to stop or suspend its operation. + */ +void av_thread_message_queue_set_err_recv(AVThreadMessageQueue *mq, + int err); + +/** + * Set the optional free message callback function which will be called if an + * operation is removing messages from the queue. + */ +void av_thread_message_queue_set_free_func(AVThreadMessageQueue *mq, + void (*free_func)(void *msg)); + +/** + * Flush the message queue + * + * This function is mostly equivalent to reading and free-ing every message + * except that it will be done in a single operation (no lock/unlock between + * reads). + */ +void av_thread_message_flush(AVThreadMessageQueue *mq); + +#endif /* AVUTIL_THREADMESSAGE_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/time.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/time.h new file mode 100644 index 0000000..dc169b0 --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/time.h @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2000-2003 Fabrice Bellard + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_TIME_H +#define AVUTIL_TIME_H + +#include + +/** + * Get the current time in microseconds. + */ +int64_t av_gettime(void); + +/** + * Get the current time in microseconds since some unspecified starting point. + * On platforms that support it, the time comes from a monotonic clock + * This property makes this time source ideal for measuring relative time. + * The returned values may not be monotonic on platforms where a monotonic + * clock is not available. + */ +int64_t av_gettime_relative(void); + +/** + * Indicates with a boolean result if the av_gettime_relative() time source + * is monotonic. + */ +int av_gettime_relative_is_monotonic(void); + +/** + * Sleep for a period of time. Although the duration is expressed in + * microseconds, the actual delay may be rounded to the precision of the + * system timer. + * + * @param usec Number of microseconds to sleep. + * @return zero on success or (negative) error code. + */ +int av_usleep(unsigned usec); + +#endif /* AVUTIL_TIME_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/timecode.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/timecode.h new file mode 100644 index 0000000..37c1361 --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/timecode.h @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2006 Smartjog S.A.S, Baptiste Coudurier + * Copyright (c) 2011-2012 Smartjog S.A.S, Clément BÅ“sch + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * Timecode helpers header + */ + +#ifndef AVUTIL_TIMECODE_H +#define AVUTIL_TIMECODE_H + +#include +#include "rational.h" + +#define AV_TIMECODE_STR_SIZE 23 + +enum AVTimecodeFlag { + AV_TIMECODE_FLAG_DROPFRAME = 1<<0, ///< timecode is drop frame + AV_TIMECODE_FLAG_24HOURSMAX = 1<<1, ///< timecode wraps after 24 hours + AV_TIMECODE_FLAG_ALLOWNEGATIVE = 1<<2, ///< negative time values are allowed +}; + +typedef struct { + int start; ///< timecode frame start (first base frame number) + uint32_t flags; ///< flags such as drop frame, +24 hours support, ... + AVRational rate; ///< frame rate in rational form + unsigned fps; ///< frame per second; must be consistent with the rate field +} AVTimecode; + +/** + * Adjust frame number for NTSC drop frame time code. + * + * @param framenum frame number to adjust + * @param fps frame per second, 30 or 60 + * @return adjusted frame number + * @warning adjustment is only valid in NTSC 29.97 and 59.94 + */ +int av_timecode_adjust_ntsc_framenum2(int framenum, int fps); + +/** + * Convert frame number to SMPTE 12M binary representation. + * + * @param tc timecode data correctly initialized + * @param framenum frame number + * @return the SMPTE binary representation + * + * @note Frame number adjustment is automatically done in case of drop timecode, + * you do NOT have to call av_timecode_adjust_ntsc_framenum2(). + * @note The frame number is relative to tc->start. + * @note Color frame (CF), binary group flags (BGF) and biphase mark polarity + * correction (PC) bits are set to zero. + */ +uint32_t av_timecode_get_smpte_from_framenum(const AVTimecode *tc, int framenum); + +/** + * Load timecode string in buf. + * + * @param buf destination buffer, must be at least AV_TIMECODE_STR_SIZE long + * @param tc timecode data correctly initialized + * @param framenum frame number + * @return the buf parameter + * + * @note Timecode representation can be a negative timecode and have more than + * 24 hours, but will only be honored if the flags are correctly set. + * @note The frame number is relative to tc->start. + */ +char *av_timecode_make_string(const AVTimecode *tc, char *buf, int framenum); + +/** + * Get the timecode string from the SMPTE timecode format. + * + * @param buf destination buffer, must be at least AV_TIMECODE_STR_SIZE long + * @param tcsmpte the 32-bit SMPTE timecode + * @param prevent_df prevent the use of a drop flag when it is known the DF bit + * is arbitrary + * @return the buf parameter + */ +char *av_timecode_make_smpte_tc_string(char *buf, uint32_t tcsmpte, int prevent_df); + +/** + * Get the timecode string from the 25-bit timecode format (MPEG GOP format). + * + * @param buf destination buffer, must be at least AV_TIMECODE_STR_SIZE long + * @param tc25bit the 25-bits timecode + * @return the buf parameter + */ +char *av_timecode_make_mpeg_tc_string(char *buf, uint32_t tc25bit); + +/** + * Init a timecode struct with the passed parameters. + * + * @param log_ctx a pointer to an arbitrary struct of which the first field + * is a pointer to an AVClass struct (used for av_log) + * @param tc pointer to an allocated AVTimecode + * @param rate frame rate in rational form + * @param flags miscellaneous flags such as drop frame, +24 hours, ... + * (see AVTimecodeFlag) + * @param frame_start the first frame number + * @return 0 on success, AVERROR otherwise + */ +int av_timecode_init(AVTimecode *tc, AVRational rate, int flags, int frame_start, void *log_ctx); + +/** + * Parse timecode representation (hh:mm:ss[:;.]ff). + * + * @param log_ctx a pointer to an arbitrary struct of which the first field is a + * pointer to an AVClass struct (used for av_log). + * @param tc pointer to an allocated AVTimecode + * @param rate frame rate in rational form + * @param str timecode string which will determine the frame start + * @return 0 on success, AVERROR otherwise + */ +int av_timecode_init_from_string(AVTimecode *tc, AVRational rate, const char *str, void *log_ctx); + +/** + * Check if the timecode feature is available for the given frame rate + * + * @return 0 if supported, <0 otherwise + */ +int av_timecode_check_frame_rate(AVRational rate); + +#endif /* AVUTIL_TIMECODE_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/timestamp.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/timestamp.h new file mode 100644 index 0000000..e082f01 --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/timestamp.h @@ -0,0 +1,78 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * timestamp utils, mostly useful for debugging/logging purposes + */ + +#ifndef AVUTIL_TIMESTAMP_H +#define AVUTIL_TIMESTAMP_H + +#include "common.h" + +#if defined(__cplusplus) && !defined(__STDC_FORMAT_MACROS) && !defined(PRId64) +#error missing -D__STDC_FORMAT_MACROS / #define __STDC_FORMAT_MACROS +#endif + +#define AV_TS_MAX_STRING_SIZE 32 + +/** + * Fill the provided buffer with a string containing a timestamp + * representation. + * + * @param buf a buffer with size in bytes of at least AV_TS_MAX_STRING_SIZE + * @param ts the timestamp to represent + * @return the buffer in input + */ +static inline char *av_ts_make_string(char *buf, int64_t ts) +{ + if (ts == AV_NOPTS_VALUE) snprintf(buf, AV_TS_MAX_STRING_SIZE, "NOPTS"); + else snprintf(buf, AV_TS_MAX_STRING_SIZE, "%" PRId64, ts); + return buf; +} + +/** + * Convenience macro, the return value should be used only directly in + * function arguments but never stand-alone. + */ +#define av_ts2str(ts) av_ts_make_string((char[AV_TS_MAX_STRING_SIZE]){0}, ts) + +/** + * Fill the provided buffer with a string containing a timestamp time + * representation. + * + * @param buf a buffer with size in bytes of at least AV_TS_MAX_STRING_SIZE + * @param ts the timestamp to represent + * @param tb the timebase of the timestamp + * @return the buffer in input + */ +static inline char *av_ts_make_time_string(char *buf, int64_t ts, AVRational *tb) +{ + if (ts == AV_NOPTS_VALUE) snprintf(buf, AV_TS_MAX_STRING_SIZE, "NOPTS"); + else snprintf(buf, AV_TS_MAX_STRING_SIZE, "%.6g", av_q2d(*tb) * ts); + return buf; +} + +/** + * Convenience macro, the return value should be used only directly in + * function arguments but never stand-alone. + */ +#define av_ts2timestr(ts, tb) av_ts_make_time_string((char[AV_TS_MAX_STRING_SIZE]){0}, ts, tb) + +#endif /* AVUTIL_TIMESTAMP_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/tree.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/tree.h new file mode 100644 index 0000000..d5e0aeb --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/tree.h @@ -0,0 +1,138 @@ +/* + * copyright (c) 2006 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * A tree container. + * @author Michael Niedermayer + */ + +#ifndef AVUTIL_TREE_H +#define AVUTIL_TREE_H + +#include "attributes.h" +#include "version.h" + +/** + * @addtogroup lavu_tree AVTree + * @ingroup lavu_data + * + * Low-complexity tree container + * + * Insertion, removal, finding equal, largest which is smaller than and + * smallest which is larger than, all have O(log n) worst-case complexity. + * @{ + */ + + +struct AVTreeNode; +extern const int av_tree_node_size; + +/** + * Allocate an AVTreeNode. + */ +struct AVTreeNode *av_tree_node_alloc(void); + +/** + * Find an element. + * @param root a pointer to the root node of the tree + * @param next If next is not NULL, then next[0] will contain the previous + * element and next[1] the next element. If either does not exist, + * then the corresponding entry in next is unchanged. + * @param cmp compare function used to compare elements in the tree, + * API identical to that of Standard C's qsort + * It is guaranteed that the first and only the first argument to cmp() + * will be the key parameter to av_tree_find(), thus it could if the + * user wants, be a different type (like an opaque context). + * @return An element with cmp(key, elem) == 0 or NULL if no such element + * exists in the tree. + */ +void *av_tree_find(const struct AVTreeNode *root, void *key, + int (*cmp)(const void *key, const void *b), void *next[2]); + +/** + * Insert or remove an element. + * + * If *next is NULL, then the supplied element will be removed if it exists. + * If *next is non-NULL, then the supplied element will be inserted, unless + * it already exists in the tree. + * + * @param rootp A pointer to a pointer to the root node of the tree; note that + * the root node can change during insertions, this is required + * to keep the tree balanced. + * @param key pointer to the element key to insert in the tree + * @param next Used to allocate and free AVTreeNodes. For insertion the user + * must set it to an allocated and zeroed object of at least + * av_tree_node_size bytes size. av_tree_insert() will set it to + * NULL if it has been consumed. + * For deleting elements *next is set to NULL by the user and + * av_tree_insert() will set it to the AVTreeNode which was + * used for the removed element. + * This allows the use of flat arrays, which have + * lower overhead compared to many malloced elements. + * You might want to define a function like: + * @code + * void *tree_insert(struct AVTreeNode **rootp, void *key, + * int (*cmp)(void *key, const void *b), + * AVTreeNode **next) + * { + * if (!*next) + * *next = av_mallocz(av_tree_node_size); + * return av_tree_insert(rootp, key, cmp, next); + * } + * void *tree_remove(struct AVTreeNode **rootp, void *key, + * int (*cmp)(void *key, const void *b, AVTreeNode **next)) + * { + * av_freep(next); + * return av_tree_insert(rootp, key, cmp, next); + * } + * @endcode + * @param cmp compare function used to compare elements in the tree, API identical + * to that of Standard C's qsort + * @return If no insertion happened, the found element; if an insertion or + * removal happened, then either key or NULL will be returned. + * Which one it is depends on the tree state and the implementation. You + * should make no assumptions that it's one or the other in the code. + */ +void *av_tree_insert(struct AVTreeNode **rootp, void *key, + int (*cmp)(const void *key, const void *b), + struct AVTreeNode **next); + +void av_tree_destroy(struct AVTreeNode *t); + +/** + * Apply enu(opaque, &elem) to all the elements in the tree in a given range. + * + * @param cmp a comparison function that returns < 0 for an element below the + * range, > 0 for an element above the range and == 0 for an + * element inside the range + * + * @note The cmp function should use the same ordering used to construct the + * tree. + */ +void av_tree_enumerate(struct AVTreeNode *t, void *opaque, + int (*cmp)(void *opaque, void *elem), + int (*enu)(void *opaque, void *elem)); + +/** + * @} + */ + +#endif /* AVUTIL_TREE_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/twofish.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/twofish.h new file mode 100644 index 0000000..813cfec --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/twofish.h @@ -0,0 +1,70 @@ +/* + * An implementation of the TwoFish algorithm + * Copyright (c) 2015 Supraja Meedinti + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_TWOFISH_H +#define AVUTIL_TWOFISH_H + +#include + + +/** + * @file + * @brief Public header for libavutil TWOFISH algorithm + * @defgroup lavu_twofish TWOFISH + * @ingroup lavu_crypto + * @{ + */ + +extern const int av_twofish_size; + +struct AVTWOFISH; + +/** + * Allocate an AVTWOFISH context + * To free the struct: av_free(ptr) + */ +struct AVTWOFISH *av_twofish_alloc(void); + +/** + * Initialize an AVTWOFISH context. + * + * @param ctx an AVTWOFISH context + * @param key a key of size ranging from 1 to 32 bytes used for encryption/decryption + * @param key_bits number of keybits: 128, 192, 256 If less than the required, padded with zeroes to nearest valid value; return value is 0 if key_bits is 128/192/256, -1 if less than 0, 1 otherwise + */ +int av_twofish_init(struct AVTWOFISH *ctx, const uint8_t *key, int key_bits); + +/** + * Encrypt or decrypt a buffer using a previously initialized context + * + * @param ctx an AVTWOFISH context + * @param dst destination array, can be equal to src + * @param src source array, can be equal to dst + * @param count number of 16 byte blocks + * @paran iv initialization vector for CBC mode, NULL for ECB mode + * @param decrypt 0 for encryption, 1 for decryption + */ +void av_twofish_crypt(struct AVTWOFISH *ctx, uint8_t *dst, const uint8_t *src, int count, uint8_t* iv, int decrypt); + +/** + * @} + */ +#endif /* AVUTIL_TWOFISH_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/version.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/version.h new file mode 100644 index 0000000..3a63e63 --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/version.h @@ -0,0 +1,139 @@ +/* + * copyright (c) 2003 Fabrice Bellard + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * @ingroup lavu + * Libavutil version macros + */ + +#ifndef AVUTIL_VERSION_H +#define AVUTIL_VERSION_H + +#include "macros.h" + +/** + * @addtogroup version_utils + * + * Useful to check and match library version in order to maintain + * backward compatibility. + * + * The FFmpeg libraries follow a versioning sheme very similar to + * Semantic Versioning (http://semver.org/) + * The difference is that the component called PATCH is called MICRO in FFmpeg + * and its value is reset to 100 instead of 0 to keep it above or equal to 100. + * Also we do not increase MICRO for every bugfix or change in git master. + * + * Prior to FFmpeg 3.2 point releases did not change any lib version number to + * avoid aliassing different git master checkouts. + * Starting with FFmpeg 3.2, the released library versions will occupy + * a separate MAJOR.MINOR that is not used on the master development branch. + * That is if we branch a release of master 55.10.123 we will bump to 55.11.100 + * for the release and master will continue at 55.12.100 after it. Each new + * point release will then bump the MICRO improving the usefulness of the lib + * versions. + * + * @{ + */ + +#define AV_VERSION_INT(a, b, c) ((a)<<16 | (b)<<8 | (c)) +#define AV_VERSION_DOT(a, b, c) a ##.## b ##.## c +#define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c) + +/** + * Extract version components from the full ::AV_VERSION_INT int as returned + * by functions like ::avformat_version() and ::avcodec_version() + */ +#define AV_VERSION_MAJOR(a) ((a) >> 16) +#define AV_VERSION_MINOR(a) (((a) & 0x00FF00) >> 8) +#define AV_VERSION_MICRO(a) ((a) & 0xFF) + +/** + * @} + */ + +/** + * @defgroup lavu_ver Version and Build diagnostics + * + * Macros and function useful to check at compiletime and at runtime + * which version of libavutil is in use. + * + * @{ + */ + +#define LIBAVUTIL_VERSION_MAJOR 56 +#define LIBAVUTIL_VERSION_MINOR 14 +#define LIBAVUTIL_VERSION_MICRO 100 + +#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ + LIBAVUTIL_VERSION_MINOR, \ + LIBAVUTIL_VERSION_MICRO) +#define LIBAVUTIL_VERSION AV_VERSION(LIBAVUTIL_VERSION_MAJOR, \ + LIBAVUTIL_VERSION_MINOR, \ + LIBAVUTIL_VERSION_MICRO) +#define LIBAVUTIL_BUILD LIBAVUTIL_VERSION_INT + +#define LIBAVUTIL_IDENT "Lavu" AV_STRINGIFY(LIBAVUTIL_VERSION) + +/** + * @defgroup lavu_depr_guards Deprecation Guards + * FF_API_* defines may be placed below to indicate public API that will be + * dropped at a future version bump. The defines themselves are not part of + * the public API and may change, break or disappear at any time. + * + * @note, when bumping the major version it is recommended to manually + * disable each FF_API_* in its own commit instead of disabling them all + * at once through the bump. This improves the git bisect-ability of the change. + * + * @{ + */ + +#ifndef FF_API_VAAPI +#define FF_API_VAAPI (LIBAVUTIL_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_FRAME_QP +#define FF_API_FRAME_QP (LIBAVUTIL_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_PLUS1_MINUS1 +#define FF_API_PLUS1_MINUS1 (LIBAVUTIL_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_ERROR_FRAME +#define FF_API_ERROR_FRAME (LIBAVUTIL_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_PKT_PTS +#define FF_API_PKT_PTS (LIBAVUTIL_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_CRYPTO_SIZE_T +#define FF_API_CRYPTO_SIZE_T (LIBAVUTIL_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_FRAME_GET_SET +#define FF_API_FRAME_GET_SET (LIBAVUTIL_VERSION_MAJOR < 57) +#endif +#ifndef FF_API_PSEUDOPAL +#define FF_API_PSEUDOPAL (LIBAVUTIL_VERSION_MAJOR < 57) +#endif + + +/** + * @} + * @} + */ + +#endif /* AVUTIL_VERSION_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libavutil/xtea.h b/MediaClient/MediaClient/ffmpeg/include/libavutil/xtea.h new file mode 100644 index 0000000..735427c --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libavutil/xtea.h @@ -0,0 +1,94 @@ +/* + * A 32-bit implementation of the XTEA algorithm + * Copyright (c) 2012 Samuel Pitoiset + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_XTEA_H +#define AVUTIL_XTEA_H + +#include + +/** + * @file + * @brief Public header for libavutil XTEA algorithm + * @defgroup lavu_xtea XTEA + * @ingroup lavu_crypto + * @{ + */ + +typedef struct AVXTEA { + uint32_t key[16]; +} AVXTEA; + +/** + * Allocate an AVXTEA context. + */ +AVXTEA *av_xtea_alloc(void); + +/** + * Initialize an AVXTEA context. + * + * @param ctx an AVXTEA context + * @param key a key of 16 bytes used for encryption/decryption, + * interpreted as big endian 32 bit numbers + */ +void av_xtea_init(struct AVXTEA *ctx, const uint8_t key[16]); + +/** + * Initialize an AVXTEA context. + * + * @param ctx an AVXTEA context + * @param key a key of 16 bytes used for encryption/decryption, + * interpreted as little endian 32 bit numbers + */ +void av_xtea_le_init(struct AVXTEA *ctx, const uint8_t key[16]); + +/** + * Encrypt or decrypt a buffer using a previously initialized context, + * in big endian format. + * + * @param ctx an AVXTEA context + * @param dst destination array, can be equal to src + * @param src source array, can be equal to dst + * @param count number of 8 byte blocks + * @param iv initialization vector for CBC mode, if NULL then ECB will be used + * @param decrypt 0 for encryption, 1 for decryption + */ +void av_xtea_crypt(struct AVXTEA *ctx, uint8_t *dst, const uint8_t *src, + int count, uint8_t *iv, int decrypt); + +/** + * Encrypt or decrypt a buffer using a previously initialized context, + * in little endian format. + * + * @param ctx an AVXTEA context + * @param dst destination array, can be equal to src + * @param src source array, can be equal to dst + * @param count number of 8 byte blocks + * @param iv initialization vector for CBC mode, if NULL then ECB will be used + * @param decrypt 0 for encryption, 1 for decryption + */ +void av_xtea_le_crypt(struct AVXTEA *ctx, uint8_t *dst, const uint8_t *src, + int count, uint8_t *iv, int decrypt); + +/** + * @} + */ + +#endif /* AVUTIL_XTEA_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libpostproc/postprocess.h b/MediaClient/MediaClient/ffmpeg/include/libpostproc/postprocess.h new file mode 100644 index 0000000..348ee7c --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libpostproc/postprocess.h @@ -0,0 +1,107 @@ +/* + * Copyright (C) 2001-2003 Michael Niedermayer (michaelni@gmx.at) + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef POSTPROC_POSTPROCESS_H +#define POSTPROC_POSTPROCESS_H + +/** + * @file + * @ingroup lpp + * external API header + */ + +/** + * @defgroup lpp libpostproc + * Video postprocessing library. + * + * @{ + */ + +#include "libpostproc/version.h" + +/** + * Return the LIBPOSTPROC_VERSION_INT constant. + */ +unsigned postproc_version(void); + +/** + * Return the libpostproc build-time configuration. + */ +const char *postproc_configuration(void); + +/** + * Return the libpostproc license. + */ +const char *postproc_license(void); + +#define PP_QUALITY_MAX 6 + +#include + +typedef void pp_context; +typedef void pp_mode; + +#if LIBPOSTPROC_VERSION_INT < (52<<16) +typedef pp_context pp_context_t; +typedef pp_mode pp_mode_t; +extern const char *const pp_help; ///< a simple help text +#else +extern const char pp_help[]; ///< a simple help text +#endif + +void pp_postprocess(const uint8_t * src[3], const int srcStride[3], + uint8_t * dst[3], const int dstStride[3], + int horizontalSize, int verticalSize, + const int8_t *QP_store, int QP_stride, + pp_mode *mode, pp_context *ppContext, int pict_type); + + +/** + * Return a pp_mode or NULL if an error occurred. + * + * @param name the string after "-pp" on the command line + * @param quality a number from 0 to PP_QUALITY_MAX + */ +pp_mode *pp_get_mode_by_name_and_quality(const char *name, int quality); +void pp_free_mode(pp_mode *mode); + +pp_context *pp_get_context(int width, int height, int flags); +void pp_free_context(pp_context *ppContext); + +#define PP_CPU_CAPS_MMX 0x80000000 +#define PP_CPU_CAPS_MMX2 0x20000000 +#define PP_CPU_CAPS_3DNOW 0x40000000 +#define PP_CPU_CAPS_ALTIVEC 0x10000000 +#define PP_CPU_CAPS_AUTO 0x00080000 + +#define PP_FORMAT 0x00000008 +#define PP_FORMAT_420 (0x00000011|PP_FORMAT) +#define PP_FORMAT_422 (0x00000001|PP_FORMAT) +#define PP_FORMAT_411 (0x00000002|PP_FORMAT) +#define PP_FORMAT_444 (0x00000000|PP_FORMAT) +#define PP_FORMAT_440 (0x00000010|PP_FORMAT) + +#define PP_PICT_TYPE_QP2 0x00000010 ///< MPEG2 style QScale + +/** + * @} + */ + +#endif /* POSTPROC_POSTPROCESS_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libpostproc/version.h b/MediaClient/MediaClient/ffmpeg/include/libpostproc/version.h new file mode 100644 index 0000000..c677205 --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libpostproc/version.h @@ -0,0 +1,45 @@ +/* + * Version macros. + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef POSTPROC_VERSION_H +#define POSTPROC_VERSION_H + +/** + * @file + * Libpostproc version macros + */ + +#include "libavutil/avutil.h" + +#define LIBPOSTPROC_VERSION_MAJOR 55 +#define LIBPOSTPROC_VERSION_MINOR 1 +#define LIBPOSTPROC_VERSION_MICRO 100 + +#define LIBPOSTPROC_VERSION_INT AV_VERSION_INT(LIBPOSTPROC_VERSION_MAJOR, \ + LIBPOSTPROC_VERSION_MINOR, \ + LIBPOSTPROC_VERSION_MICRO) +#define LIBPOSTPROC_VERSION AV_VERSION(LIBPOSTPROC_VERSION_MAJOR, \ + LIBPOSTPROC_VERSION_MINOR, \ + LIBPOSTPROC_VERSION_MICRO) +#define LIBPOSTPROC_BUILD LIBPOSTPROC_VERSION_INT + +#define LIBPOSTPROC_IDENT "postproc" AV_STRINGIFY(LIBPOSTPROC_VERSION) + +#endif /* POSTPROC_VERSION_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libswresample/swresample.h b/MediaClient/MediaClient/ffmpeg/include/libswresample/swresample.h new file mode 100644 index 0000000..c7b84fb --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libswresample/swresample.h @@ -0,0 +1,579 @@ +/* + * Copyright (C) 2011-2013 Michael Niedermayer (michaelni@gmx.at) + * + * This file is part of libswresample + * + * libswresample is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * libswresample is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with libswresample; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef SWRESAMPLE_SWRESAMPLE_H +#define SWRESAMPLE_SWRESAMPLE_H + +/** + * @file + * @ingroup lswr + * libswresample public header + */ + +/** + * @defgroup lswr libswresample + * @{ + * + * Audio resampling, sample format conversion and mixing library. + * + * Interaction with lswr is done through SwrContext, which is + * allocated with swr_alloc() or swr_alloc_set_opts(). It is opaque, so all parameters + * must be set with the @ref avoptions API. + * + * The first thing you will need to do in order to use lswr is to allocate + * SwrContext. This can be done with swr_alloc() or swr_alloc_set_opts(). If you + * are using the former, you must set options through the @ref avoptions API. + * The latter function provides the same feature, but it allows you to set some + * common options in the same statement. + * + * For example the following code will setup conversion from planar float sample + * format to interleaved signed 16-bit integer, downsampling from 48kHz to + * 44.1kHz and downmixing from 5.1 channels to stereo (using the default mixing + * matrix). This is using the swr_alloc() function. + * @code + * SwrContext *swr = swr_alloc(); + * av_opt_set_channel_layout(swr, "in_channel_layout", AV_CH_LAYOUT_5POINT1, 0); + * av_opt_set_channel_layout(swr, "out_channel_layout", AV_CH_LAYOUT_STEREO, 0); + * av_opt_set_int(swr, "in_sample_rate", 48000, 0); + * av_opt_set_int(swr, "out_sample_rate", 44100, 0); + * av_opt_set_sample_fmt(swr, "in_sample_fmt", AV_SAMPLE_FMT_FLTP, 0); + * av_opt_set_sample_fmt(swr, "out_sample_fmt", AV_SAMPLE_FMT_S16, 0); + * @endcode + * + * The same job can be done using swr_alloc_set_opts() as well: + * @code + * SwrContext *swr = swr_alloc_set_opts(NULL, // we're allocating a new context + * AV_CH_LAYOUT_STEREO, // out_ch_layout + * AV_SAMPLE_FMT_S16, // out_sample_fmt + * 44100, // out_sample_rate + * AV_CH_LAYOUT_5POINT1, // in_ch_layout + * AV_SAMPLE_FMT_FLTP, // in_sample_fmt + * 48000, // in_sample_rate + * 0, // log_offset + * NULL); // log_ctx + * @endcode + * + * Once all values have been set, it must be initialized with swr_init(). If + * you need to change the conversion parameters, you can change the parameters + * using @ref AVOptions, as described above in the first example; or by using + * swr_alloc_set_opts(), but with the first argument the allocated context. + * You must then call swr_init() again. + * + * The conversion itself is done by repeatedly calling swr_convert(). + * Note that the samples may get buffered in swr if you provide insufficient + * output space or if sample rate conversion is done, which requires "future" + * samples. Samples that do not require future input can be retrieved at any + * time by using swr_convert() (in_count can be set to 0). + * At the end of conversion the resampling buffer can be flushed by calling + * swr_convert() with NULL in and 0 in_count. + * + * The samples used in the conversion process can be managed with the libavutil + * @ref lavu_sampmanip "samples manipulation" API, including av_samples_alloc() + * function used in the following example. + * + * The delay between input and output, can at any time be found by using + * swr_get_delay(). + * + * The following code demonstrates the conversion loop assuming the parameters + * from above and caller-defined functions get_input() and handle_output(): + * @code + * uint8_t **input; + * int in_samples; + * + * while (get_input(&input, &in_samples)) { + * uint8_t *output; + * int out_samples = av_rescale_rnd(swr_get_delay(swr, 48000) + + * in_samples, 44100, 48000, AV_ROUND_UP); + * av_samples_alloc(&output, NULL, 2, out_samples, + * AV_SAMPLE_FMT_S16, 0); + * out_samples = swr_convert(swr, &output, out_samples, + * input, in_samples); + * handle_output(output, out_samples); + * av_freep(&output); + * } + * @endcode + * + * When the conversion is finished, the conversion + * context and everything associated with it must be freed with swr_free(). + * A swr_close() function is also available, but it exists mainly for + * compatibility with libavresample, and is not required to be called. + * + * There will be no memory leak if the data is not completely flushed before + * swr_free(). + */ + +#include +#include "libavutil/channel_layout.h" +#include "libavutil/frame.h" +#include "libavutil/samplefmt.h" + +#include "libswresample/version.h" + +/** + * @name Option constants + * These constants are used for the @ref avoptions interface for lswr. + * @{ + * + */ + +#define SWR_FLAG_RESAMPLE 1 ///< Force resampling even if equal sample rate +//TODO use int resample ? +//long term TODO can we enable this dynamically? + +/** Dithering algorithms */ +enum SwrDitherType { + SWR_DITHER_NONE = 0, + SWR_DITHER_RECTANGULAR, + SWR_DITHER_TRIANGULAR, + SWR_DITHER_TRIANGULAR_HIGHPASS, + + SWR_DITHER_NS = 64, ///< not part of API/ABI + SWR_DITHER_NS_LIPSHITZ, + SWR_DITHER_NS_F_WEIGHTED, + SWR_DITHER_NS_MODIFIED_E_WEIGHTED, + SWR_DITHER_NS_IMPROVED_E_WEIGHTED, + SWR_DITHER_NS_SHIBATA, + SWR_DITHER_NS_LOW_SHIBATA, + SWR_DITHER_NS_HIGH_SHIBATA, + SWR_DITHER_NB, ///< not part of API/ABI +}; + +/** Resampling Engines */ +enum SwrEngine { + SWR_ENGINE_SWR, /**< SW Resampler */ + SWR_ENGINE_SOXR, /**< SoX Resampler */ + SWR_ENGINE_NB, ///< not part of API/ABI +}; + +/** Resampling Filter Types */ +enum SwrFilterType { + SWR_FILTER_TYPE_CUBIC, /**< Cubic */ + SWR_FILTER_TYPE_BLACKMAN_NUTTALL, /**< Blackman Nuttall windowed sinc */ + SWR_FILTER_TYPE_KAISER, /**< Kaiser windowed sinc */ +}; + +/** + * @} + */ + +/** + * The libswresample context. Unlike libavcodec and libavformat, this structure + * is opaque. This means that if you would like to set options, you must use + * the @ref avoptions API and cannot directly set values to members of the + * structure. + */ +typedef struct SwrContext SwrContext; + +/** + * Get the AVClass for SwrContext. It can be used in combination with + * AV_OPT_SEARCH_FAKE_OBJ for examining options. + * + * @see av_opt_find(). + * @return the AVClass of SwrContext + */ +const AVClass *swr_get_class(void); + +/** + * @name SwrContext constructor functions + * @{ + */ + +/** + * Allocate SwrContext. + * + * If you use this function you will need to set the parameters (manually or + * with swr_alloc_set_opts()) before calling swr_init(). + * + * @see swr_alloc_set_opts(), swr_init(), swr_free() + * @return NULL on error, allocated context otherwise + */ +struct SwrContext *swr_alloc(void); + +/** + * Initialize context after user parameters have been set. + * @note The context must be configured using the AVOption API. + * + * @see av_opt_set_int() + * @see av_opt_set_dict() + * + * @param[in,out] s Swr context to initialize + * @return AVERROR error code in case of failure. + */ +int swr_init(struct SwrContext *s); + +/** + * Check whether an swr context has been initialized or not. + * + * @param[in] s Swr context to check + * @see swr_init() + * @return positive if it has been initialized, 0 if not initialized + */ +int swr_is_initialized(struct SwrContext *s); + +/** + * Allocate SwrContext if needed and set/reset common parameters. + * + * This function does not require s to be allocated with swr_alloc(). On the + * other hand, swr_alloc() can use swr_alloc_set_opts() to set the parameters + * on the allocated context. + * + * @param s existing Swr context if available, or NULL if not + * @param out_ch_layout output channel layout (AV_CH_LAYOUT_*) + * @param out_sample_fmt output sample format (AV_SAMPLE_FMT_*). + * @param out_sample_rate output sample rate (frequency in Hz) + * @param in_ch_layout input channel layout (AV_CH_LAYOUT_*) + * @param in_sample_fmt input sample format (AV_SAMPLE_FMT_*). + * @param in_sample_rate input sample rate (frequency in Hz) + * @param log_offset logging level offset + * @param log_ctx parent logging context, can be NULL + * + * @see swr_init(), swr_free() + * @return NULL on error, allocated context otherwise + */ +struct SwrContext *swr_alloc_set_opts(struct SwrContext *s, + int64_t out_ch_layout, enum AVSampleFormat out_sample_fmt, int out_sample_rate, + int64_t in_ch_layout, enum AVSampleFormat in_sample_fmt, int in_sample_rate, + int log_offset, void *log_ctx); + +/** + * @} + * + * @name SwrContext destructor functions + * @{ + */ + +/** + * Free the given SwrContext and set the pointer to NULL. + * + * @param[in] s a pointer to a pointer to Swr context + */ +void swr_free(struct SwrContext **s); + +/** + * Closes the context so that swr_is_initialized() returns 0. + * + * The context can be brought back to life by running swr_init(), + * swr_init() can also be used without swr_close(). + * This function is mainly provided for simplifying the usecase + * where one tries to support libavresample and libswresample. + * + * @param[in,out] s Swr context to be closed + */ +void swr_close(struct SwrContext *s); + +/** + * @} + * + * @name Core conversion functions + * @{ + */ + +/** Convert audio. + * + * in and in_count can be set to 0 to flush the last few samples out at the + * end. + * + * If more input is provided than output space, then the input will be buffered. + * You can avoid this buffering by using swr_get_out_samples() to retrieve an + * upper bound on the required number of output samples for the given number of + * input samples. Conversion will run directly without copying whenever possible. + * + * @param s allocated Swr context, with parameters set + * @param out output buffers, only the first one need be set in case of packed audio + * @param out_count amount of space available for output in samples per channel + * @param in input buffers, only the first one need to be set in case of packed audio + * @param in_count number of input samples available in one channel + * + * @return number of samples output per channel, negative value on error + */ +int swr_convert(struct SwrContext *s, uint8_t **out, int out_count, + const uint8_t **in , int in_count); + +/** + * Convert the next timestamp from input to output + * timestamps are in 1/(in_sample_rate * out_sample_rate) units. + * + * @note There are 2 slightly differently behaving modes. + * @li When automatic timestamp compensation is not used, (min_compensation >= FLT_MAX) + * in this case timestamps will be passed through with delays compensated + * @li When automatic timestamp compensation is used, (min_compensation < FLT_MAX) + * in this case the output timestamps will match output sample numbers. + * See ffmpeg-resampler(1) for the two modes of compensation. + * + * @param s[in] initialized Swr context + * @param pts[in] timestamp for the next input sample, INT64_MIN if unknown + * @see swr_set_compensation(), swr_drop_output(), and swr_inject_silence() are + * function used internally for timestamp compensation. + * @return the output timestamp for the next output sample + */ +int64_t swr_next_pts(struct SwrContext *s, int64_t pts); + +/** + * @} + * + * @name Low-level option setting functions + * These functons provide a means to set low-level options that is not possible + * with the AVOption API. + * @{ + */ + +/** + * Activate resampling compensation ("soft" compensation). This function is + * internally called when needed in swr_next_pts(). + * + * @param[in,out] s allocated Swr context. If it is not initialized, + * or SWR_FLAG_RESAMPLE is not set, swr_init() is + * called with the flag set. + * @param[in] sample_delta delta in PTS per sample + * @param[in] compensation_distance number of samples to compensate for + * @return >= 0 on success, AVERROR error codes if: + * @li @c s is NULL, + * @li @c compensation_distance is less than 0, + * @li @c compensation_distance is 0 but sample_delta is not, + * @li compensation unsupported by resampler, or + * @li swr_init() fails when called. + */ +int swr_set_compensation(struct SwrContext *s, int sample_delta, int compensation_distance); + +/** + * Set a customized input channel mapping. + * + * @param[in,out] s allocated Swr context, not yet initialized + * @param[in] channel_map customized input channel mapping (array of channel + * indexes, -1 for a muted channel) + * @return >= 0 on success, or AVERROR error code in case of failure. + */ +int swr_set_channel_mapping(struct SwrContext *s, const int *channel_map); + +/** + * Generate a channel mixing matrix. + * + * This function is the one used internally by libswresample for building the + * default mixing matrix. It is made public just as a utility function for + * building custom matrices. + * + * @param in_layout input channel layout + * @param out_layout output channel layout + * @param center_mix_level mix level for the center channel + * @param surround_mix_level mix level for the surround channel(s) + * @param lfe_mix_level mix level for the low-frequency effects channel + * @param rematrix_maxval if 1.0, coefficients will be normalized to prevent + * overflow. if INT_MAX, coefficients will not be + * normalized. + * @param[out] matrix mixing coefficients; matrix[i + stride * o] is + * the weight of input channel i in output channel o. + * @param stride distance between adjacent input channels in the + * matrix array + * @param matrix_encoding matrixed stereo downmix mode (e.g. dplii) + * @param log_ctx parent logging context, can be NULL + * @return 0 on success, negative AVERROR code on failure + */ +int swr_build_matrix(uint64_t in_layout, uint64_t out_layout, + double center_mix_level, double surround_mix_level, + double lfe_mix_level, double rematrix_maxval, + double rematrix_volume, double *matrix, + int stride, enum AVMatrixEncoding matrix_encoding, + void *log_ctx); + +/** + * Set a customized remix matrix. + * + * @param s allocated Swr context, not yet initialized + * @param matrix remix coefficients; matrix[i + stride * o] is + * the weight of input channel i in output channel o + * @param stride offset between lines of the matrix + * @return >= 0 on success, or AVERROR error code in case of failure. + */ +int swr_set_matrix(struct SwrContext *s, const double *matrix, int stride); + +/** + * @} + * + * @name Sample handling functions + * @{ + */ + +/** + * Drops the specified number of output samples. + * + * This function, along with swr_inject_silence(), is called by swr_next_pts() + * if needed for "hard" compensation. + * + * @param s allocated Swr context + * @param count number of samples to be dropped + * + * @return >= 0 on success, or a negative AVERROR code on failure + */ +int swr_drop_output(struct SwrContext *s, int count); + +/** + * Injects the specified number of silence samples. + * + * This function, along with swr_drop_output(), is called by swr_next_pts() + * if needed for "hard" compensation. + * + * @param s allocated Swr context + * @param count number of samples to be dropped + * + * @return >= 0 on success, or a negative AVERROR code on failure + */ +int swr_inject_silence(struct SwrContext *s, int count); + +/** + * Gets the delay the next input sample will experience relative to the next output sample. + * + * Swresample can buffer data if more input has been provided than available + * output space, also converting between sample rates needs a delay. + * This function returns the sum of all such delays. + * The exact delay is not necessarily an integer value in either input or + * output sample rate. Especially when downsampling by a large value, the + * output sample rate may be a poor choice to represent the delay, similarly + * for upsampling and the input sample rate. + * + * @param s swr context + * @param base timebase in which the returned delay will be: + * @li if it's set to 1 the returned delay is in seconds + * @li if it's set to 1000 the returned delay is in milliseconds + * @li if it's set to the input sample rate then the returned + * delay is in input samples + * @li if it's set to the output sample rate then the returned + * delay is in output samples + * @li if it's the least common multiple of in_sample_rate and + * out_sample_rate then an exact rounding-free delay will be + * returned + * @returns the delay in 1 / @c base units. + */ +int64_t swr_get_delay(struct SwrContext *s, int64_t base); + +/** + * Find an upper bound on the number of samples that the next swr_convert + * call will output, if called with in_samples of input samples. This + * depends on the internal state, and anything changing the internal state + * (like further swr_convert() calls) will may change the number of samples + * swr_get_out_samples() returns for the same number of input samples. + * + * @param in_samples number of input samples. + * @note any call to swr_inject_silence(), swr_convert(), swr_next_pts() + * or swr_set_compensation() invalidates this limit + * @note it is recommended to pass the correct available buffer size + * to all functions like swr_convert() even if swr_get_out_samples() + * indicates that less would be used. + * @returns an upper bound on the number of samples that the next swr_convert + * will output or a negative value to indicate an error + */ +int swr_get_out_samples(struct SwrContext *s, int in_samples); + +/** + * @} + * + * @name Configuration accessors + * @{ + */ + +/** + * Return the @ref LIBSWRESAMPLE_VERSION_INT constant. + * + * This is useful to check if the build-time libswresample has the same version + * as the run-time one. + * + * @returns the unsigned int-typed version + */ +unsigned swresample_version(void); + +/** + * Return the swr build-time configuration. + * + * @returns the build-time @c ./configure flags + */ +const char *swresample_configuration(void); + +/** + * Return the swr license. + * + * @returns the license of libswresample, determined at build-time + */ +const char *swresample_license(void); + +/** + * @} + * + * @name AVFrame based API + * @{ + */ + +/** + * Convert the samples in the input AVFrame and write them to the output AVFrame. + * + * Input and output AVFrames must have channel_layout, sample_rate and format set. + * + * If the output AVFrame does not have the data pointers allocated the nb_samples + * field will be set using av_frame_get_buffer() + * is called to allocate the frame. + * + * The output AVFrame can be NULL or have fewer allocated samples than required. + * In this case, any remaining samples not written to the output will be added + * to an internal FIFO buffer, to be returned at the next call to this function + * or to swr_convert(). + * + * If converting sample rate, there may be data remaining in the internal + * resampling delay buffer. swr_get_delay() tells the number of + * remaining samples. To get this data as output, call this function or + * swr_convert() with NULL input. + * + * If the SwrContext configuration does not match the output and + * input AVFrame settings the conversion does not take place and depending on + * which AVFrame is not matching AVERROR_OUTPUT_CHANGED, AVERROR_INPUT_CHANGED + * or the result of a bitwise-OR of them is returned. + * + * @see swr_delay() + * @see swr_convert() + * @see swr_get_delay() + * + * @param swr audio resample context + * @param output output AVFrame + * @param input input AVFrame + * @return 0 on success, AVERROR on failure or nonmatching + * configuration. + */ +int swr_convert_frame(SwrContext *swr, + AVFrame *output, const AVFrame *input); + +/** + * Configure or reconfigure the SwrContext using the information + * provided by the AVFrames. + * + * The original resampling context is reset even on failure. + * The function calls swr_close() internally if the context is open. + * + * @see swr_close(); + * + * @param swr audio resample context + * @param output output AVFrame + * @param input input AVFrame + * @return 0 on success, AVERROR on failure. + */ +int swr_config_frame(SwrContext *swr, const AVFrame *out, const AVFrame *in); + +/** + * @} + * @} + */ + +#endif /* SWRESAMPLE_SWRESAMPLE_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libswresample/version.h b/MediaClient/MediaClient/ffmpeg/include/libswresample/version.h new file mode 100644 index 0000000..efc462f --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libswresample/version.h @@ -0,0 +1,45 @@ +/* + * Version macros. + * + * This file is part of libswresample + * + * libswresample is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * libswresample is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with libswresample; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef SWRESAMPLE_VERSION_H +#define SWRESAMPLE_VERSION_H + +/** + * @file + * Libswresample version macros + */ + +#include "libavutil/avutil.h" + +#define LIBSWRESAMPLE_VERSION_MAJOR 3 +#define LIBSWRESAMPLE_VERSION_MINOR 1 +#define LIBSWRESAMPLE_VERSION_MICRO 100 + +#define LIBSWRESAMPLE_VERSION_INT AV_VERSION_INT(LIBSWRESAMPLE_VERSION_MAJOR, \ + LIBSWRESAMPLE_VERSION_MINOR, \ + LIBSWRESAMPLE_VERSION_MICRO) +#define LIBSWRESAMPLE_VERSION AV_VERSION(LIBSWRESAMPLE_VERSION_MAJOR, \ + LIBSWRESAMPLE_VERSION_MINOR, \ + LIBSWRESAMPLE_VERSION_MICRO) +#define LIBSWRESAMPLE_BUILD LIBSWRESAMPLE_VERSION_INT + +#define LIBSWRESAMPLE_IDENT "SwR" AV_STRINGIFY(LIBSWRESAMPLE_VERSION) + +#endif /* SWRESAMPLE_VERSION_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libswscale/swscale.h b/MediaClient/MediaClient/ffmpeg/include/libswscale/swscale.h new file mode 100644 index 0000000..7713f51 --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libswscale/swscale.h @@ -0,0 +1,336 @@ +/* + * Copyright (C) 2001-2011 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef SWSCALE_SWSCALE_H +#define SWSCALE_SWSCALE_H + +/** + * @file + * @ingroup libsws + * external API header + */ + +#include + +#include "libavutil/avutil.h" +#include "libavutil/log.h" +#include "libavutil/pixfmt.h" +#include "version.h" + +/** + * @defgroup libsws libswscale + * Color conversion and scaling library. + * + * @{ + * + * Return the LIBSWSCALE_VERSION_INT constant. + */ +unsigned swscale_version(void); + +/** + * Return the libswscale build-time configuration. + */ +const char *swscale_configuration(void); + +/** + * Return the libswscale license. + */ +const char *swscale_license(void); + +/* values for the flags, the stuff on the command line is different */ +#define SWS_FAST_BILINEAR 1 +#define SWS_BILINEAR 2 +#define SWS_BICUBIC 4 +#define SWS_X 8 +#define SWS_POINT 0x10 +#define SWS_AREA 0x20 +#define SWS_BICUBLIN 0x40 +#define SWS_GAUSS 0x80 +#define SWS_SINC 0x100 +#define SWS_LANCZOS 0x200 +#define SWS_SPLINE 0x400 + +#define SWS_SRC_V_CHR_DROP_MASK 0x30000 +#define SWS_SRC_V_CHR_DROP_SHIFT 16 + +#define SWS_PARAM_DEFAULT 123456 + +#define SWS_PRINT_INFO 0x1000 + +//the following 3 flags are not completely implemented +//internal chrominance subsampling info +#define SWS_FULL_CHR_H_INT 0x2000 +//input subsampling info +#define SWS_FULL_CHR_H_INP 0x4000 +#define SWS_DIRECT_BGR 0x8000 +#define SWS_ACCURATE_RND 0x40000 +#define SWS_BITEXACT 0x80000 +#define SWS_ERROR_DIFFUSION 0x800000 + +#define SWS_MAX_REDUCE_CUTOFF 0.002 + +#define SWS_CS_ITU709 1 +#define SWS_CS_FCC 4 +#define SWS_CS_ITU601 5 +#define SWS_CS_ITU624 5 +#define SWS_CS_SMPTE170M 5 +#define SWS_CS_SMPTE240M 7 +#define SWS_CS_DEFAULT 5 +#define SWS_CS_BT2020 9 + +/** + * Return a pointer to yuv<->rgb coefficients for the given colorspace + * suitable for sws_setColorspaceDetails(). + * + * @param colorspace One of the SWS_CS_* macros. If invalid, + * SWS_CS_DEFAULT is used. + */ +const int *sws_getCoefficients(int colorspace); + +// when used for filters they must have an odd number of elements +// coeffs cannot be shared between vectors +typedef struct SwsVector { + double *coeff; ///< pointer to the list of coefficients + int length; ///< number of coefficients in the vector +} SwsVector; + +// vectors can be shared +typedef struct SwsFilter { + SwsVector *lumH; + SwsVector *lumV; + SwsVector *chrH; + SwsVector *chrV; +} SwsFilter; + +struct SwsContext; + +/** + * Return a positive value if pix_fmt is a supported input format, 0 + * otherwise. + */ +int sws_isSupportedInput(enum AVPixelFormat pix_fmt); + +/** + * Return a positive value if pix_fmt is a supported output format, 0 + * otherwise. + */ +int sws_isSupportedOutput(enum AVPixelFormat pix_fmt); + +/** + * @param[in] pix_fmt the pixel format + * @return a positive value if an endianness conversion for pix_fmt is + * supported, 0 otherwise. + */ +int sws_isSupportedEndiannessConversion(enum AVPixelFormat pix_fmt); + +/** + * Allocate an empty SwsContext. This must be filled and passed to + * sws_init_context(). For filling see AVOptions, options.c and + * sws_setColorspaceDetails(). + */ +struct SwsContext *sws_alloc_context(void); + +/** + * Initialize the swscaler context sws_context. + * + * @return zero or positive value on success, a negative value on + * error + */ +av_warn_unused_result +int sws_init_context(struct SwsContext *sws_context, SwsFilter *srcFilter, SwsFilter *dstFilter); + +/** + * Free the swscaler context swsContext. + * If swsContext is NULL, then does nothing. + */ +void sws_freeContext(struct SwsContext *swsContext); + +/** + * Allocate and return an SwsContext. You need it to perform + * scaling/conversion operations using sws_scale(). + * + * @param srcW the width of the source image + * @param srcH the height of the source image + * @param srcFormat the source image format + * @param dstW the width of the destination image + * @param dstH the height of the destination image + * @param dstFormat the destination image format + * @param flags specify which algorithm and options to use for rescaling + * @param param extra parameters to tune the used scaler + * For SWS_BICUBIC param[0] and [1] tune the shape of the basis + * function, param[0] tunes f(1) and param[1] f´(1) + * For SWS_GAUSS param[0] tunes the exponent and thus cutoff + * frequency + * For SWS_LANCZOS param[0] tunes the width of the window function + * @return a pointer to an allocated context, or NULL in case of error + * @note this function is to be removed after a saner alternative is + * written + */ +struct SwsContext *sws_getContext(int srcW, int srcH, enum AVPixelFormat srcFormat, + int dstW, int dstH, enum AVPixelFormat dstFormat, + int flags, SwsFilter *srcFilter, + SwsFilter *dstFilter, const double *param); + +/** + * Scale the image slice in srcSlice and put the resulting scaled + * slice in the image in dst. A slice is a sequence of consecutive + * rows in an image. + * + * Slices have to be provided in sequential order, either in + * top-bottom or bottom-top order. If slices are provided in + * non-sequential order the behavior of the function is undefined. + * + * @param c the scaling context previously created with + * sws_getContext() + * @param srcSlice the array containing the pointers to the planes of + * the source slice + * @param srcStride the array containing the strides for each plane of + * the source image + * @param srcSliceY the position in the source image of the slice to + * process, that is the number (counted starting from + * zero) in the image of the first row of the slice + * @param srcSliceH the height of the source slice, that is the number + * of rows in the slice + * @param dst the array containing the pointers to the planes of + * the destination image + * @param dstStride the array containing the strides for each plane of + * the destination image + * @return the height of the output slice + */ +int sws_scale(struct SwsContext *c, const uint8_t *const srcSlice[], + const int srcStride[], int srcSliceY, int srcSliceH, + uint8_t *const dst[], const int dstStride[]); + +/** + * @param dstRange flag indicating the while-black range of the output (1=jpeg / 0=mpeg) + * @param srcRange flag indicating the while-black range of the input (1=jpeg / 0=mpeg) + * @param table the yuv2rgb coefficients describing the output yuv space, normally ff_yuv2rgb_coeffs[x] + * @param inv_table the yuv2rgb coefficients describing the input yuv space, normally ff_yuv2rgb_coeffs[x] + * @param brightness 16.16 fixed point brightness correction + * @param contrast 16.16 fixed point contrast correction + * @param saturation 16.16 fixed point saturation correction + * @return -1 if not supported + */ +int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4], + int srcRange, const int table[4], int dstRange, + int brightness, int contrast, int saturation); + +/** + * @return -1 if not supported + */ +int sws_getColorspaceDetails(struct SwsContext *c, int **inv_table, + int *srcRange, int **table, int *dstRange, + int *brightness, int *contrast, int *saturation); + +/** + * Allocate and return an uninitialized vector with length coefficients. + */ +SwsVector *sws_allocVec(int length); + +/** + * Return a normalized Gaussian curve used to filter stuff + * quality = 3 is high quality, lower is lower quality. + */ +SwsVector *sws_getGaussianVec(double variance, double quality); + +/** + * Scale all the coefficients of a by the scalar value. + */ +void sws_scaleVec(SwsVector *a, double scalar); + +/** + * Scale all the coefficients of a so that their sum equals height. + */ +void sws_normalizeVec(SwsVector *a, double height); + +#if FF_API_SWS_VECTOR +attribute_deprecated SwsVector *sws_getConstVec(double c, int length); +attribute_deprecated SwsVector *sws_getIdentityVec(void); +attribute_deprecated void sws_convVec(SwsVector *a, SwsVector *b); +attribute_deprecated void sws_addVec(SwsVector *a, SwsVector *b); +attribute_deprecated void sws_subVec(SwsVector *a, SwsVector *b); +attribute_deprecated void sws_shiftVec(SwsVector *a, int shift); +attribute_deprecated SwsVector *sws_cloneVec(SwsVector *a); +attribute_deprecated void sws_printVec2(SwsVector *a, AVClass *log_ctx, int log_level); +#endif + +void sws_freeVec(SwsVector *a); + +SwsFilter *sws_getDefaultFilter(float lumaGBlur, float chromaGBlur, + float lumaSharpen, float chromaSharpen, + float chromaHShift, float chromaVShift, + int verbose); +void sws_freeFilter(SwsFilter *filter); + +/** + * Check if context can be reused, otherwise reallocate a new one. + * + * If context is NULL, just calls sws_getContext() to get a new + * context. Otherwise, checks if the parameters are the ones already + * saved in context. If that is the case, returns the current + * context. Otherwise, frees context and gets a new context with + * the new parameters. + * + * Be warned that srcFilter and dstFilter are not checked, they + * are assumed to remain the same. + */ +struct SwsContext *sws_getCachedContext(struct SwsContext *context, + int srcW, int srcH, enum AVPixelFormat srcFormat, + int dstW, int dstH, enum AVPixelFormat dstFormat, + int flags, SwsFilter *srcFilter, + SwsFilter *dstFilter, const double *param); + +/** + * Convert an 8-bit paletted frame into a frame with a color depth of 32 bits. + * + * The output frame will have the same packed format as the palette. + * + * @param src source frame buffer + * @param dst destination frame buffer + * @param num_pixels number of pixels to convert + * @param palette array with [256] entries, which must match color arrangement (RGB or BGR) of src + */ +void sws_convertPalette8ToPacked32(const uint8_t *src, uint8_t *dst, int num_pixels, const uint8_t *palette); + +/** + * Convert an 8-bit paletted frame into a frame with a color depth of 24 bits. + * + * With the palette format "ABCD", the destination frame ends up with the format "ABC". + * + * @param src source frame buffer + * @param dst destination frame buffer + * @param num_pixels number of pixels to convert + * @param palette array with [256] entries, which must match color arrangement (RGB or BGR) of src + */ +void sws_convertPalette8ToPacked24(const uint8_t *src, uint8_t *dst, int num_pixels, const uint8_t *palette); + +/** + * Get the AVClass for swsContext. It can be used in combination with + * AV_OPT_SEARCH_FAKE_OBJ for examining options. + * + * @see av_opt_find(). + */ +const AVClass *sws_get_class(void); + +/** + * @} + */ + +#endif /* SWSCALE_SWSCALE_H */ diff --git a/MediaClient/MediaClient/ffmpeg/include/libswscale/version.h b/MediaClient/MediaClient/ffmpeg/include/libswscale/version.h new file mode 100644 index 0000000..6d80527 --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/include/libswscale/version.h @@ -0,0 +1,53 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef SWSCALE_VERSION_H +#define SWSCALE_VERSION_H + +/** + * @file + * swscale version macros + */ + +#include "libavutil/version.h" + +#define LIBSWSCALE_VERSION_MAJOR 5 +#define LIBSWSCALE_VERSION_MINOR 1 +#define LIBSWSCALE_VERSION_MICRO 100 + +#define LIBSWSCALE_VERSION_INT AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \ + LIBSWSCALE_VERSION_MINOR, \ + LIBSWSCALE_VERSION_MICRO) +#define LIBSWSCALE_VERSION AV_VERSION(LIBSWSCALE_VERSION_MAJOR, \ + LIBSWSCALE_VERSION_MINOR, \ + LIBSWSCALE_VERSION_MICRO) +#define LIBSWSCALE_BUILD LIBSWSCALE_VERSION_INT + +#define LIBSWSCALE_IDENT "SwS" AV_STRINGIFY(LIBSWSCALE_VERSION) + +/** + * FF_API_* defines may be placed below to indicate public API that will be + * dropped at a future version bump. The defines themselves are not part of + * the public API and may change, break or disappear at any time. + */ + +#ifndef FF_API_SWS_VECTOR +#define FF_API_SWS_VECTOR (LIBSWSCALE_VERSION_MAJOR < 6) +#endif + +#endif /* SWSCALE_VERSION_H */ diff --git a/MediaClient/MediaClient/ffmpeg/inttypes.h b/MediaClient/MediaClient/ffmpeg/inttypes.h new file mode 100644 index 0000000..e34769a --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/inttypes.h @@ -0,0 +1,214 @@ + +#ifndef _INTTYPES_H +#define _INTTYPES_H + +#include + +/* fprintf() macros for signed integers */ + +#define PRId8 "d" +#define PRId16 "d" +#define PRId32 "ld" +#define PRId64 "lld" + +#define PRIdLEAST8 "d" +#define PRIdLEAST16 "d" +#define PRIdLEAST32 "ld" +#define PRIdLEAST64 "lld" + +#define PRIdFAST8 "d" +#define PRIdFAST16 "ld" +#define PRIdFAST32 "ld" +#define PRIdFAST64 "lld" + +#define PRIdMAX "lld" +#define PRIdPTR "ld" + +#define PRIi8 "i" +#define PRIi16 "i" +#define PRIi32 "li" +#define PRIi64 "lli" + +#define PRIiLEAST8 "i" +#define PRIiLEAST16 "i" +#define PRIiLEAST32 "li" +#define PRIiLEAST64 "lli" + +#define PRIiFAST8 "i" +#define PRIiFAST16 "li" +#define PRIiFAST32 "li" +#define PRIiFAST64 "lli" + +#define PRIiMAX "lli" +#define PRIiPTR "li" + +/* fprintf() macros for unsigned integers */ + +#define PRIo8 "o" +#define PRIo16 "o" +#define PRIo32 "lo" +#define PRIo64 "llo" + +#define PRIoLEAST8 "o" +#define PRIoLEAST16 "o" +#define PRIoLEAST32 "lo" +#define PRIoLEAST64 "llo" + +#define PRIoFAST8 "o" +#define PRIoFAST16 "lo" +#define PRIoFAST32 "lo" +#define PRIoFAST64 "llo" + +#define PRIoMAX "llo" +#define PRIoPTR "lo" + +#define PRIu8 "u" +#define PRIu16 "u" +#define PRIu32 "lu" +#define PRIu64 "llu" + +#define PRIuLEAST8 "u" +#define PRIuLEAST16 "u" +#define PRIuLEAST32 "lu" +#define PRIuLEAST64 "llu" + +#define PRIuFAST8 "u" +#define PRIuFAST16 "lu" +#define PRIuFAST32 "lu" +#define PRIuFAST64 "llu" + +#define PRIuMAX "llu" +#define PRIuPTR "lu" + +#define PRIx8 "x" +#define PRIx16 "x" +#define PRIx32 "lx" +#define PRIx64 "llx" + +#define PRIxLEAST8 "x" +#define PRIxLEAST16 "x" +#define PRIxLEAST32 "lx" +#define PRIxLEAST64 "llx" + +#define PRIxFAST8 "x" +#define PRIxFAST16 "lx" +#define PRIxFAST32 "lx" +#define PRIxFAST64 "llx" + +#define PRIxMAX "llx" +#define PRIxPTR "lx" + +#define PRIX8 "X" +#define PRIX16 "X" +#define PRIX32 "lX" +#define PRIX64 "llX" + +#define PRIXLEAST8 "X" +#define PRIXLEAST16 "X" +#define PRIXLEAST32 "lX" +#define PRIXLEAST64 "llX" + +#define PRIXFAST8 "X" +#define PRIXFAST16 "lX" +#define PRIXFAST32 "lX" +#define PRIXFAST64 "llX" + +#define PRIXMAX "llX" +#define PRIXPTR "lX" + +/* fscanf() macros for signed integers */ + +#define SCNd8 "hhd" +#define SCNd16 "hd" +#define SCNd32 "ld" +#define SCNd64 "lld" + +#define SCNdLEAST8 "hhd" +#define SCNdLEAST16 "hd" +#define SCNdLEAST32 "ld" +#define SCNdLEAST64 "lld" + +#define SCNdFAST8 "hhd" +#define SCNdFAST16 "ld" +#define SCNdFAST32 "ld" +#define SCNdFAST64 "lld" + +#define SCNdMAX "lld" +#define SCNdPTR "ld" + +#define SCNi8 "hhi" +#define SCNi16 "hi" +#define SCNi32 "li" +#define SCNi64 "lli" + +#define SCNiLEAST8 "hhi" +#define SCNiLEAST16 "hi" +#define SCNiLEAST32 "li" +#define SCNiLEAST64 "lli" + +#define SCNiFAST8 "hhi" +#define SCNiFAST16 "li" +#define SCNiFAST32 "li" +#define SCNiFAST64 "lli" + +#define SCNiMAX "lli" +#define SCNiPTR "li" + +/* fscanf() macros for unsigned integers */ + +#define SCNo8 "hho" +#define SCNo16 "ho" +#define SCNo32 "lo" +#define SCNo64 "llo" + +#define SCNoLEAST8 "hho" +#define SCNoLEAST16 "ho" +#define SCNoLEAST32 "lo" +#define SCNoLEAST64 "llo" + +#define SCNoFAST8 "hho" +#define SCNoFAST16 "lo" +#define SCNoFAST32 "lo" +#define SCNoFAST64 "llo" + +#define SCNoMAX "llo" +#define SCNoPTR "lo" + +#define SCNu8 "hhu" +#define SCNu16 "hu" +#define SCNu32 "lu" +#define SCNu64 "llu" + +#define SCNuLEAST8 "hhu" +#define SCNuLEAST16 "hu" +#define SCNuLEAST32 "lu" +#define SCNuLEAST64 "llu" + +#define SCNuFAST8 "hhu" +#define SCNuFAST16 "lu" +#define SCNuFAST32 "lu" +#define SCNuFAST64 "llu" + +#define SCNuMAX "llu" +#define SCNuPTR "lu" + +#define SCNx8 "hhx" +#define SCNx16 "hx" +#define SCNx32 "lx" +#define SCNx64 "llx" + +#define SCNxLEAST8 "hhx" +#define SCNxLEAST16 "hx" +#define SCNxLEAST32 "lx" +#define SCNxLEAST64 "llx" + +#define SCNxFAST8 "hhx" +#define SCNxFAST16 "lx" +#define SCNxFAST32 "lx" +#define SCNxFAST64 "llx" + +#define SCNxMAX "llx" +#define SCNxPTR "lx" + + +#endif /* _INTTYPES_H */ diff --git a/MediaClient/MediaClient/ffmpeg/lib/linux/libavcodec.so.58.18.100 b/MediaClient/MediaClient/ffmpeg/lib/linux/libavcodec.so.58.18.100 new file mode 100644 index 0000000..3e962c5 Binary files /dev/null and b/MediaClient/MediaClient/ffmpeg/lib/linux/libavcodec.so.58.18.100 differ diff --git a/MediaClient/MediaClient/ffmpeg/lib/linux/libavdevice.so.58.3.100 b/MediaClient/MediaClient/ffmpeg/lib/linux/libavdevice.so.58.3.100 new file mode 100644 index 0000000..3295d07 Binary files /dev/null and b/MediaClient/MediaClient/ffmpeg/lib/linux/libavdevice.so.58.3.100 differ diff --git a/MediaClient/MediaClient/ffmpeg/lib/linux/libavfilter.so.7.16.100 b/MediaClient/MediaClient/ffmpeg/lib/linux/libavfilter.so.7.16.100 new file mode 100644 index 0000000..80c42b6 Binary files /dev/null and b/MediaClient/MediaClient/ffmpeg/lib/linux/libavfilter.so.7.16.100 differ diff --git a/MediaClient/MediaClient/ffmpeg/lib/linux/libavformat.so.58.12.100 b/MediaClient/MediaClient/ffmpeg/lib/linux/libavformat.so.58.12.100 new file mode 100644 index 0000000..9a89552 Binary files /dev/null and b/MediaClient/MediaClient/ffmpeg/lib/linux/libavformat.so.58.12.100 differ diff --git a/MediaClient/MediaClient/ffmpeg/lib/linux/libavutil.so.56.14.100 b/MediaClient/MediaClient/ffmpeg/lib/linux/libavutil.so.56.14.100 new file mode 100644 index 0000000..9f395cf Binary files /dev/null and b/MediaClient/MediaClient/ffmpeg/lib/linux/libavutil.so.56.14.100 differ diff --git a/MediaClient/MediaClient/ffmpeg/lib/linux/libopus.so.0.8.0 b/MediaClient/MediaClient/ffmpeg/lib/linux/libopus.so.0.8.0 new file mode 100644 index 0000000..5a48a30 Binary files /dev/null and b/MediaClient/MediaClient/ffmpeg/lib/linux/libopus.so.0.8.0 differ diff --git a/MediaClient/MediaClient/ffmpeg/lib/linux/libpostproc.so.55.1.100 b/MediaClient/MediaClient/ffmpeg/lib/linux/libpostproc.so.55.1.100 new file mode 100644 index 0000000..3ff76c1 Binary files /dev/null and b/MediaClient/MediaClient/ffmpeg/lib/linux/libpostproc.so.55.1.100 differ diff --git a/MediaClient/MediaClient/ffmpeg/lib/linux/libswresample.so.3.1.100 b/MediaClient/MediaClient/ffmpeg/lib/linux/libswresample.so.3.1.100 new file mode 100644 index 0000000..179ce07 Binary files /dev/null and b/MediaClient/MediaClient/ffmpeg/lib/linux/libswresample.so.3.1.100 differ diff --git a/MediaClient/MediaClient/ffmpeg/lib/linux/libswscale.so.5.1.100 b/MediaClient/MediaClient/ffmpeg/lib/linux/libswscale.so.5.1.100 new file mode 100644 index 0000000..d39bfd2 Binary files /dev/null and b/MediaClient/MediaClient/ffmpeg/lib/linux/libswscale.so.5.1.100 differ diff --git a/MediaClient/MediaClient/ffmpeg/lib/linux/libx264.so.161 b/MediaClient/MediaClient/ffmpeg/lib/linux/libx264.so.161 new file mode 100644 index 0000000..7702caf Binary files /dev/null and b/MediaClient/MediaClient/ffmpeg/lib/linux/libx264.so.161 differ diff --git a/MediaClient/MediaClient/ffmpeg/lib/linux/libx265.so.116 b/MediaClient/MediaClient/ffmpeg/lib/linux/libx265.so.116 new file mode 100644 index 0000000..dce7d8a Binary files /dev/null and b/MediaClient/MediaClient/ffmpeg/lib/linux/libx265.so.116 differ diff --git a/MediaClient/MediaClient/ffmpeg/stdint.h b/MediaClient/MediaClient/ffmpeg/stdint.h new file mode 100644 index 0000000..b370659 --- /dev/null +++ b/MediaClient/MediaClient/ffmpeg/stdint.h @@ -0,0 +1,164 @@ + +#ifndef _STDINT_H +#define _STDINT_H + +/* Exact-width integer types */ + +#ifndef __int8_t_defined +#define __int8_t_defined +typedef signed char int8_t; +typedef short int16_t; +typedef signed __int32 int32_t; + +typedef __int64 int64_t; +#endif + +typedef unsigned char uint8_t; +typedef unsigned short uint16_t; +#ifndef __uint32_t_defined +#define __uint32_t_defined +typedef unsigned __int32 uint32_t; +#endif +typedef unsigned __int64 uint64_t; + +/* Minimum-width integer types */ + +typedef signed char int_least8_t; +typedef short int_least16_t; +typedef long int_least32_t; +typedef __int64 int_least64_t; + +typedef unsigned char uint_least8_t; +typedef unsigned short uint_least16_t; +typedef unsigned long uint_least32_t; +typedef unsigned __int64 uint_least64_t; + +/* Fastest minimum-width integer types */ + +typedef signed char int_fast8_t; +typedef long int_fast16_t; +typedef long int_fast32_t; +typedef __int64 int_fast64_t; + +typedef unsigned char uint_fast8_t; +typedef unsigned long uint_fast16_t; +typedef unsigned long uint_fast32_t; +typedef unsigned __int64 uint_fast64_t; + +/* Greatest-width integer types */ + +typedef __int64 intmax_t; + +typedef unsigned __int64 uintmax_t; + +/* Limits of exact-width integer types */ + +#define INT8_MIN (-128) +#define INT16_MIN (-32768) +#define INT32_MIN (-2147483647 - 1) +#define INT64_MIN (-9223372036854775807L - 1L) + +#define INT8_MAX (127) +#define INT16_MAX (32767) +#define INT32_MAX (2147483647) +#define INT64_MAX (9223372036854775807L) + +#define UINT8_MAX (255) +#define UINT16_MAX (65535) +#define UINT32_MAX (4294967295UL) +#define UINT64_MAX (18446744073709551615ULL) + +/* Limits of minimum-width integer types */ + +#define INT_LEAST8_MIN (-128) +#define INT_LEAST16_MIN (-32768) +#define INT_LEAST32_MIN (-2147483647 - 1) +#define INT_LEAST64_MIN (-9223372036854775807LL - 1LL) + +#define INT_LEAST8_MAX (127) +#define INT_LEAST16_MAX (32767) +#define INT_LEAST32_MAX (2147483647) +#define INT_LEAST64_MAX (9223372036854775807LL) + +#define UINT_LEAST8_MAX (255) +#define UINT_LEAST16_MAX (65535) +#define UINT_LEAST32_MAX (4294967295UL) +#define UINT_LEAST64_MAX (18446744073709551615ULL) + +/* Limits of fastest minimum-width integer types */ + +#define INT_FAST8_MIN (-128) +#define INT_FAST16_MIN (-2147483647 - 1) +#define INT_FAST32_MIN (-2147483647 - 1) +#define INT_FAST64_MIN (-9223372036854775807LL - 1LL) + +#define INT_FAST8_MAX (127) +#define INT_FAST16_MAX (2147483647) +#define INT_FAST32_MAX (2147483647) +#define INT_FAST64_MAX (9223372036854775807LL) + +#define UINT_FAST8_MAX (255) +#define UINT_FAST16_MAX (4294967295UL) +#define UINT_FAST32_MAX (4294967295UL) +#define UINT_FAST64_MAX (18446744073709551615ULL) + +/* Limits of integer types capable of holding object pointers */ + +#define INTPTR_MIN (-2147483647 - 1) +#define INTPTR_MAX (2147483647) +#define UINTPTR_MAX (4294967295UL) + +/* Limits of greatest-width integer types */ + +#define INTMAX_MIN (-9223372036854775807LL - 1LL) +#define INTMAX_MAX (9223372036854775807LL) +#define UINTMAX_MAX (18446744073709551615ULL) + +/* Limits of other integer types */ + +#ifndef PTRDIFF_MIN +#define PTRDIFF_MIN (-2147483647 - 1) +#define PTRDIFF_MAX (2147483647) +#endif + +#ifndef SIG_ATOMIC_MIN +#define SIG_ATOMIC_MIN (-2147483647 - 1) +#endif +#ifndef SIG_ATOMIC_MAX +#define SIG_ATOMIC_MAX (2147483647) +#endif + +#ifndef SIZE_MAX +#define SIZE_MAX (4294967295UL) +#endif + +#ifndef WCHAR_MIN +#ifdef __WCHAR_MIN__ +#define WCHAR_MIN __WCHAR_MIN__ +#define WCHAR_MAX __WCHAR_MAX__ +#endif +#endif + +#ifndef WINT_MIN +#define WINT_MIN 0U +#define WINT_MAX UINT_MAX +#endif + +/* Macros for minimum-width integer constant expressions */ + +#define INT8_C(x) x +#define INT16_C(x) x +#define INT32_C(x) x ## L +#define INT64_C(x) x ## L + +#define UINT8_C(x) x +#define UINT16_C(x) x +#define UINT32_C(x) x ## UL +#define UINT64_C(x) x ## UL + +/* Macros for greatest-width integer constant expressions */ + +#define INTMAX_C(x) x ## L +#define UINTMAX_C(x) x ## UL + +#endif /* _STDINT_H */ diff --git a/MediaClient/MediaClient/formClass/CustomLayoutWidget.cpp b/MediaClient/MediaClient/formClass/CustomLayoutWidget.cpp new file mode 100644 index 0000000..77c936b --- /dev/null +++ b/MediaClient/MediaClient/formClass/CustomLayoutWidget.cpp @@ -0,0 +1,105 @@ +/*************************************************************************************** + * + * 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 "CustomLayoutWidget.h" + + +CustomLayoutWidget::CustomLayoutWidget(QWidget *parent, Qt::WindowFlags flags) +: DialogTitleBar(parent, flags) +{ + ui.setupUi(this); + + initCustomLayoutWidget(); + + connSignalSlot(); +} + + +CustomLayoutWidget::~CustomLayoutWidget() +{ +} + + +void CustomLayoutWidget::initCustomLayoutWidget() +{ + int i; + + for (i = 1; i <= MAX_GRID_ROWS; i++) + { + ui.cmbGridRows->addItem(QString("%1").arg(i), i); + } + + for (i = 1; i <= MAX_GRID_COLS; i++) + { + ui.cmbGridCols->addItem(QString("%1").arg(i), i); + } + + ui.cmbGridRows->setCurrentIndex(DEF_GRID_ROWS-1); + ui.cmbGridCols->setCurrentIndex(DEF_GRID_COLS-1); +} + + +void CustomLayoutWidget::connSignalSlot() +{ + connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(close())); + connect(ui.btnConfirm, SIGNAL(clicked()), this, SLOT(slotConfirm())); + + connect(ui.cmbGridRows, SIGNAL(currentIndexChanged(int)), this, SLOT(slotGridRowsChanged(int))); + connect(ui.cmbGridCols, SIGNAL(currentIndexChanged(int)), this, SLOT(slotGridColsChanged(int))); +} + + +Layout CustomLayoutWidget::getLayout() +{ + Layout layout; + + layout.rows = ui.cmbGridRows->itemData(ui.cmbGridRows->currentIndex()).toInt(); + layout.cols = ui.cmbGridCols->itemData(ui.cmbGridCols->currentIndex()).toInt(); + layout.zones = ui.zoneWidget->getZoneList(); + + return layout; +} + +void CustomLayoutWidget::slotConfirm() +{ + accept(); +} + + +void CustomLayoutWidget::slotGridRowsChanged(int index) +{ + int rows = ui.cmbGridRows->itemData(index).toInt(); + int cols = ui.cmbGridCols->itemData(ui.cmbGridCols->currentIndex()).toInt(); + + ui.zoneWidget->setGridSize(rows, cols); +} + + +void CustomLayoutWidget::slotGridColsChanged(int index) +{ + int rows = ui.cmbGridRows->itemData(ui.cmbGridRows->currentIndex()).toInt(); + int cols = ui.cmbGridCols->itemData(index).toInt(); + + ui.zoneWidget->setGridSize(rows, cols); +} + + + + diff --git a/MediaClient/MediaClient/formClass/CustomLayoutWidget.h b/MediaClient/MediaClient/formClass/CustomLayoutWidget.h new file mode 100644 index 0000000..7c861dc --- /dev/null +++ b/MediaClient/MediaClient/formClass/CustomLayoutWidget.h @@ -0,0 +1,52 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef CUSTOM_LAYOUT_WIDGET_H +#define CUSTOM_LAYOUT_WIDGET_H + +#include +#include "ui_CustomLayoutWidget.h" +#include "DialogTitle.h" + +class CustomLayoutWidget : public DialogTitleBar +{ + Q_OBJECT + +public: + CustomLayoutWidget(QWidget *parent = 0, Qt::WindowFlags flags = Qt::Widget); + ~CustomLayoutWidget(); + + Layout getLayout(); + +public slots: + void slotConfirm(); + void slotGridRowsChanged(int index); + void slotGridColsChanged(int index); + +private: + void initCustomLayoutWidget(); + void connSignalSlot(); + +private: + Ui::CustomLayoutWidget ui; +}; + +#endif + + diff --git a/MediaClient/MediaClient/formClass/DialogTitle.cpp b/MediaClient/MediaClient/formClass/DialogTitle.cpp new file mode 100644 index 0000000..aa3daa4 --- /dev/null +++ b/MediaClient/MediaClient/formClass/DialogTitle.cpp @@ -0,0 +1,540 @@ +/*************************************************************************************** + * + * 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 "DialogTitle.h" +#include +#include +#include +#include +#include + +#ifdef _MSC_VER +#include +#endif + +DialogTitleBar::DialogTitleBar(QWidget *parent, Qt::WindowFlags flags) : QDialog(parent, flags) +{ + m_bSysMenu = (flags & Qt::WindowSystemMenuHint) ? true : false; + m_bCanMax = (flags & Qt::WindowMaximizeButtonHint) ? true : false; + m_bCanMin = (flags & Qt::WindowMinimizeButtonHint) ? true : false; + + m_bHiClose = m_bHiMax = m_bHiMin = false; + + m_bkColor = QColor(42, 46, 51); + m_textColor = QColor(255, 255, 255); +} + +DialogTitleBar::~DialogTitleBar() +{ +} + +void DialogTitleBar::keyPressEvent(QKeyEvent *event) +{ + switch (event->key()) + { + case Qt::Key_Escape: + return; + } + + QDialog::keyPressEvent(event); +} + +#ifdef _MSC_VER + +#define WM_NCDRAWCAPTION 0xae +#define WM_NCDRAWFRAME 0xaf + + +bool DialogTitleBar::nativeEvent(const QByteArray &eventType, void *message, qintptr *result) +{ + if (strcmp(eventType.data(), "windows_generic_MSG") != 0) + { + return false; + } + + MSG* p_msg = reinterpret_cast(message); + + if (p_msg->message == WM_MOVING) + { + return false; + } + + if (p_msg->message == WM_NCPAINT || + p_msg->message == WM_NCDRAWCAPTION || + p_msg->message == WM_NCDRAWFRAME) + { + paintTitle(); + *result = 0; + return true; + } + else if (p_msg->message == WM_NCACTIVATE) + { + *result = true; + return true; + } + else if (p_msg->message == WM_NCHITTEST) + { + onNcHitTest(p_msg, result); + return true; + } + else if (p_msg->message == WM_NCMOUSEMOVE) + { + onNcMouseMove(p_msg); + *result = 0; + return true; + } + else if (p_msg->message == WM_NCMOUSELEAVE) + { + onNcMouseLeave(p_msg); + *result = 0; + return true; + } + else if (p_msg->message == WM_NCLBUTTONDOWN) + { + if (onNcLButtonDown(p_msg, result)) + return true; + } + else if (p_msg->message == WM_NCLBUTTONUP) + { + onNcLButtonUp(p_msg, result); + return true; + } + else if (p_msg->message == WM_NCLBUTTONDBLCLK) + { + onNcLButtonDblClk(p_msg, result); + return true; + } + + return false; +} + + +#define RIGHT_MARGIN 10 +#define TOP_MARGIN 6 +#define LEFT_MARGIN 6 +#define BTN_SPACE 0 +#define TEXT_SPACE 4 + +#define HL_OPACITY 0.6 + +void DialogTitleBar::paintTitle() +{ + RECT rcWindow, rcClient; + + ::GetWindowRect((HWND)winId(), &rcWindow); + ::GetClientRect((HWND)winId(), &rcClient); + + HDC hDC = ::GetWindowDC((HWND)winId()); + LONG lStyle = ::GetWindowLong((HWND)winId(), GWL_STYLE); + + int hframe = GetSystemMetrics(SM_CXFRAME); + int vframe = GetSystemMetrics(SM_CYFRAME); + int caption = GetSystemMetrics(SM_CYCAPTION); + int cxsize = GetSystemMetrics(SM_CXSIZE); + int cysize = GetSystemMetrics(SM_CYSIZE); + int cxicon = GetSystemMetrics(SM_CXSMICON); + int cyicon = GetSystemMetrics(SM_CYSMICON); + int cycaption = GetSystemMetrics(SM_CYCAPTION); + + int width = rcWindow.right - rcWindow.left; + + POINT ptTopLeft = {rcClient.left, rcClient.top}; + POINT ptBottomRight = {rcClient.right, rcClient.bottom}; + + ::ClientToScreen((HWND)winId(), &ptTopLeft); + ::ClientToScreen((HWND)winId(), &ptBottomRight); + + rcClient.left = ptTopLeft.x - rcWindow.left; + rcClient.top = ptTopLeft.y - rcWindow.top; + rcClient.right = ptBottomRight.x - rcWindow.left; + rcClient.bottom = ptBottomRight.y - rcWindow.top; + + rcWindow.right = rcWindow.right - rcWindow.left; + rcWindow.bottom = rcWindow.bottom - rcWindow.top; + rcWindow.top = 0; + rcWindow.left = 0; + + HRGN hRgnOuter = ::CreateRectRgn(rcWindow.left, rcWindow.top, rcWindow.right, rcWindow.bottom); + HRGN hRgnInner = ::CreateRectRgn(rcClient.left, rcClient.top, rcClient.right, rcClient.bottom); + HRGN hRgnCombine = ::CreateRectRgn(rcWindow.left, rcWindow.top, rcWindow.right, rcWindow.bottom); + + ::CombineRgn(hRgnCombine, hRgnOuter, hRgnInner, RGN_DIFF); + ::SelectClipRgn(hDC, hRgnCombine); + + QPixmap back(rcWindow.right, rcWindow.bottom); + QPainter paint(&back); + QRect rc(0, 0, rcWindow.right, rcWindow.bottom); + + paint.fillRect(rc, m_bkColor); + + QRect rcClose(width - RIGHT_MARGIN - cxsize, TOP_MARGIN, cxsize, cysize); + + if (m_bHiClose) + { + paint.drawPixmap(rcClose, QPixmap(":/res/Resources/btn_close.png")); + } + else + { + paint.setOpacity(HL_OPACITY); + paint.drawPixmap(rcClose, QPixmap(":/res/Resources/btn_close.png")); + paint.setOpacity(1); + } + + if (m_bCanMax) + { + QRect rcMax; + + rcMax.setLeft(width - RIGHT_MARGIN - 2*cxsize - BTN_SPACE); + rcMax.setTop(TOP_MARGIN); + rcMax.setWidth(cxsize); + rcMax.setHeight(cysize); + + if (m_bHiMax) + { + paint.drawPixmap(rcMax, !IsZoomed((HWND)winId()) ? + QPixmap(":/res/Resources/btn_max.png") : + QPixmap(":/res/Resources/btn_max_hot.png")); + } + else + { + paint.setOpacity(HL_OPACITY); + paint.drawPixmap(rcMax, !IsZoomed((HWND)winId()) ? + QPixmap(":/res/Resources/btn_max.png") : + QPixmap(":/res/Resources/btn_max_hot.png")); + paint.setOpacity(1); + } + } + + if (m_bCanMin) + { + QRect rcMin; + + rcMin.setLeft(width - RIGHT_MARGIN - 3*cxsize - 2*BTN_SPACE); + rcMin.setTop(TOP_MARGIN); + rcMin.setWidth(cxsize); + rcMin.setHeight(cysize); + + if (m_bHiMin) + { + paint.drawPixmap(rcMin, QPixmap(":/res/Resources/btn_min.png")); + } + else + { + paint.setOpacity(HL_OPACITY); + paint.drawPixmap(rcMin, QPixmap(":/res/Resources/btn_min.png")); + paint.setOpacity(1); + } + } + + if (m_bSysMenu) + { + QRect rcSysIcon(hframe + LEFT_MARGIN, (cycaption - cyicon) / 2 + vframe, cxicon, cyicon); + + paint.drawPixmap(rcSysIcon, QPixmap(":/res/Resources/main.png")); + } + + if (!windowTitle().isEmpty()) + { + QRect rcText; + + rcText.setLeft(hframe + LEFT_MARGIN + TEXT_SPACE + (m_bSysMenu ? cxicon : 0)); + rcText.setTop(vframe); + rcText.setWidth(width - 4 * cxsize - hframe - 2 * TEXT_SPACE - RIGHT_MARGIN - 2 * BTN_SPACE); + rcText.setHeight(cycaption); + + const float DEFAULT_DPI = 96.0; + HDC screen = GetDC(NULL); + FLOAT dpiX = static_cast(GetDeviceCaps(screen, LOGPIXELSX)); + ReleaseDC(0, screen); + float scale = dpiX / DEFAULT_DPI; + + QFont font = paint.font(); + font.setPointSize(font.pointSize()*scale); + + paint.setFont(font); + + paint.setPen(m_textColor); + paint.drawText(rcText, Qt::AlignLeft | Qt::AlignVCenter, windowTitle()); + } + + HBITMAP hBmp = back.toImage().toHBITMAP(); + HDC hMemDC = ::CreateCompatibleDC(hDC); + + ::SelectObject(hMemDC, hBmp); + ::BitBlt(hDC, rcWindow.left, rcWindow.top, rcWindow.right, rcWindow.bottom, hMemDC, 0, 0, SRCCOPY); + ::DeleteDC(hMemDC); + ::DeleteObject(hBmp); + + ::DeleteObject(hRgnOuter); + ::DeleteObject(hRgnInner); + ::DeleteObject(hRgnCombine); + + ::ReleaseDC((HWND)winId(), hDC); +} + +void DialogTitleBar::onNcHitTest(MSG* pMessage, qintptr *result) +{ + RECT rcWindow; + + ::GetWindowRect((HWND)winId(), &rcWindow); + + int hframe = GetSystemMetrics(SM_CXFRAME); + int vframe = GetSystemMetrics(SM_CYFRAME); + int caption = GetSystemMetrics(SM_CYCAPTION); + int cxsize = GetSystemMetrics(SM_CXSIZE); + int cysize = GetSystemMetrics(SM_CYSIZE); + int cxicon = GetSystemMetrics(SM_CXSMICON); + int cyicon = GetSystemMetrics(SM_CYSMICON); + + QRect rcCaption(rcWindow.left, rcWindow.top, rcWindow.right-rcWindow.left, caption); + QRect rcClose(rcWindow.right - RIGHT_MARGIN - cxsize, rcWindow.top + TOP_MARGIN, cxsize, cysize); + QRect rcMax(rcWindow.right - RIGHT_MARGIN - 2*cxsize - BTN_SPACE, rcWindow.top + TOP_MARGIN, cxsize, cysize); + QRect rcMin(rcWindow.right - RIGHT_MARGIN - 3*cxsize - 2*BTN_SPACE, rcWindow.top + TOP_MARGIN, cxsize, cysize); + QRect rcSysIcon(rcWindow.left + LEFT_MARGIN, rcWindow.top + TOP_MARGIN, cxicon, cyicon); + QRect rcClient(rcWindow.left+hframe, rcWindow.top+vframe+caption, + rcWindow.right-rcWindow.left-2*hframe, rcWindow.bottom-rcWindow.top-2*vframe-caption); + + QPoint pt(LOWORD(pMessage->lParam), HIWORD(pMessage->lParam)); + + if (rcClose.contains(pt)) + { + *result = HTCLOSE; + } + else if (m_bCanMax && rcMax.contains(pt)) + { + *result = HTMAXBUTTON; + } + else if (m_bCanMin && rcMin.contains(pt)) + { + *result = HTMINBUTTON; + } + else if (m_bSysMenu && rcSysIcon.contains(pt)) + { + *result = HTSYSMENU; + } + else if (m_bCanMax) + { + QRect rcLeftBorder(rcWindow.left, rcWindow.top+vframe, hframe, rcWindow.bottom-2*vframe); + QRect rcRightBorder(rcWindow.right-hframe, rcWindow.top+vframe, hframe, rcWindow.bottom-2*vframe); + QRect rcLeftBottom(rcWindow.left, rcWindow.bottom-vframe, hframe, vframe); + QRect rcLeftTop(rcWindow.left, rcWindow.top, hframe, vframe); + QRect rcRightTop(rcWindow.right-hframe, rcWindow.top, hframe, vframe); + QRect rcRightBottom(rcWindow.right-hframe, rcWindow.bottom-vframe, hframe, vframe); + QRect rcBottomBorder(rcWindow.left+hframe, rcWindow.bottom-vframe, rcWindow.right-rcWindow.left-2*hframe, vframe); + QRect rcTopBorder(rcWindow.left+hframe, rcWindow.top, rcWindow.right-rcWindow.left-2*hframe, vframe); + + if (rcLeftBottom.contains(pt)) + { + *result = HTBOTTOMLEFT; + } + else if (rcLeftTop.contains(pt)) + { + *result = HTTOPLEFT; + } + else if (rcLeftBorder.contains(pt)) + { + *result = HTLEFT; + } + else if (rcRightTop.contains(pt)) + { + *result = HTTOPRIGHT; + } + else if (rcRightBottom.contains(pt)) + { + *result = HTBOTTOMRIGHT; + } + else if (rcRightBorder.contains(pt)) + { + *result = HTRIGHT; + } + else if (rcBottomBorder.contains(pt)) + { + *result = HTBOTTOM; + } + else if (rcTopBorder.contains(pt)) + { + *result = HTTOP; + } + else if (rcCaption.contains(pt)) + { + *result = HTCAPTION; + } + else if (rcClient.contains(pt)) + { + *result = HTCLIENT; + } + else + { + *result = 0; + } + } + else if (rcCaption.contains(pt)) + { + *result = HTCAPTION; + } + else if (rcClient.contains(pt)) + { + *result = HTCLIENT; + } + else + { + *result = 0; + } +} + + +bool DialogTitleBar::onNcLButtonDown(MSG* pMessage, qintptr *result) +{ + if (pMessage->wParam == HTSYSMENU) + { + if (m_bSysMenu) + { + SendMessage((HWND)winId(), WM_SYSCOMMAND, SC_MOUSEMENU, MAKELPARAM(pMessage->pt.x, pMessage->pt.y)); + } + + *result = 0; + return true; + } + else if (pMessage->wParam == HTCLOSE || pMessage->wParam == HTMAXBUTTON || pMessage->wParam == HTMINBUTTON) + { + *result = 0; + return true; + } + + return false; +} + + + +void DialogTitleBar::onNcLButtonUp(MSG* pMessage, qintptr *result) +{ + if (pMessage->wParam == HTCLOSE) + { + SendMessage((HWND)winId(), WM_CLOSE, 0, 0); + } + else if (pMessage->wParam == HTMAXBUTTON && m_bCanMax) + { + m_bHiMax = false; + SendMessage((HWND)winId(), WM_SYSCOMMAND, IsZoomed((HWND)winId()) ? SC_RESTORE : SC_MAXIMIZE, MAKELPARAM(pMessage->pt.x, pMessage->pt.y)); + } + else if (pMessage->wParam == HTMINBUTTON && m_bCanMin) + { + m_bHiMin = false; + SendMessage((HWND)winId(), WM_SYSCOMMAND, SC_MINIMIZE, MAKELPARAM(pMessage->pt.x, pMessage->pt.y)); + } + + *result = 0; +} + + +void DialogTitleBar::onNcLButtonDblClk(MSG* pMessage, qintptr *result) +{ + if (pMessage->wParam == HTCAPTION && m_bCanMax) + { + SendMessage((HWND)winId(), WM_SYSCOMMAND, IsZoomed((HWND)winId()) ? SC_RESTORE : SC_MAXIMIZE, MAKELPARAM(pMessage->pt.x, pMessage->pt.y)); + } + + *result = 0; +} + +void DialogTitleBar::onNcMouseMove(MSG* pMessage) +{ + bool bRepaint = false; + + if (pMessage->wParam == HTCLOSE) + { + if (!m_bHiClose) + { + bRepaint = true; + m_bHiClose = true; + } + } + else if (m_bHiClose) + { + bRepaint = true; + m_bHiClose = false; + } + + if (pMessage->wParam == HTMAXBUTTON) + { + if (!m_bHiMax) + { + bRepaint = true; + m_bHiMax = true; + } + } + else if (m_bHiMax) + { + bRepaint = true; + m_bHiMax = false; + } + + if (pMessage->wParam == HTMINBUTTON) + { + if (!m_bHiMin) + { + bRepaint = true; + m_bHiMin = true; + } + } + else if (m_bHiMin) + { + bRepaint = true; + m_bHiMin = false; + } + + if (bRepaint) + { + paintTitle(); + } +} + +void DialogTitleBar::onNcMouseLeave(MSG* pMessage) +{ + bool bRepaint = false; + + if (m_bHiClose) + { + bRepaint = true; + m_bHiClose = false; + } + + if (m_bHiMax) + { + bRepaint = true; + m_bHiMax = false; + } + + if (m_bHiMin) + { + bRepaint = true; + m_bHiMin = false; + } + + if (bRepaint) + { + paintTitle(); + } +} + +#endif + + + diff --git a/MediaClient/MediaClient/formClass/DialogTitle.h b/MediaClient/MediaClient/formClass/DialogTitle.h new file mode 100644 index 0000000..67a801c --- /dev/null +++ b/MediaClient/MediaClient/formClass/DialogTitle.h @@ -0,0 +1,70 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef DIALOG_TITLEBAR_H +#define DIALOG_TITLEBAR_H + +#include + +class DialogTitleBar : public QDialog +{ + Q_OBJECT + +public: + DialogTitleBar(QWidget *parent = 0, Qt::WindowFlags flags = Qt::Widget); + ~DialogTitleBar(); + + void setCaptionBkColor(QColor color) { m_bkColor = color; } + void setCaptionTextColor(QColor color) { m_textColor = color; } + +protected: + void keyPressEvent(QKeyEvent *event); + +#ifdef _MSC_VER + bool nativeEvent(const QByteArray &eventType, void *message, qintptr *result); +#endif + +private: + +#ifdef _MSC_VER + void paintTitle(); + void onNcHitTest(MSG* pMessage, qintptr *result); + bool onNcLButtonDown(MSG* pMessage, qintptr *result); + void onNcLButtonUp(MSG* pMessage, qintptr *result); + void onNcLButtonDblClk(MSG* pMessage, qintptr *result); + void onNcMouseMove(MSG* pMessage); + void onNcMouseLeave(MSG* pMessage); +#endif + +private: + bool m_bSysMenu; + bool m_bCanMax; + bool m_bCanMin; + + bool m_bHiClose; + bool m_bHiMax; + bool m_bHiMin; + + QColor m_bkColor; + QColor m_textColor; +}; + +#endif // _DialogTitleBarTITLEBAR_H_ + + diff --git a/MediaClient/MediaClient/formClass/FloatWidget.cpp b/MediaClient/MediaClient/formClass/FloatWidget.cpp new file mode 100644 index 0000000..df1de47 --- /dev/null +++ b/MediaClient/MediaClient/formClass/FloatWidget.cpp @@ -0,0 +1,156 @@ +/*************************************************************************************** + * + * 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 "FloatWidget.h" +#include +#include + + +FloatWidget::FloatWidget(QWidget *parent, Qt::WindowFlags flags) +: QWidget(parent, flags | Qt::FramelessWindowHint | Qt::Tool) +{ + ui.setupUi(this); + + initWidget(); +} + +FloatWidget::~FloatWidget() +{ + +} + +void FloatWidget::initWidget() +{ + setAttribute(Qt::WA_TranslucentBackground); + setAttribute(Qt::WA_TransparentForMouseEvents); + + QObject::connect(ui.btnPlay, SIGNAL(clicked()), this, SIGNAL(play())); + QObject::connect(ui.btnPause, SIGNAL(clicked()), this, SIGNAL(pause())); + QObject::connect(ui.btnStop, SIGNAL(clicked()), this, SIGNAL(stop())); + QObject::connect(ui.btnMic, SIGNAL(clicked()), this, SIGNAL(micphone())); + QObject::connect(ui.btnSnapshot, SIGNAL(clicked()), this, SIGNAL(snapshot())); + QObject::connect(ui.btnRecord, SIGNAL(clicked()), this, SIGNAL(record())); + QObject::connect(ui.btnVolume, SIGNAL(clicked()), this, SIGNAL(volume())); + QObject::connect(ui.sliderVolume, SIGNAL(actionTriggered(int)), this, SIGNAL(volumeChanged(int))); + QObject::connect(ui.sliderProgress, SIGNAL(actionTriggered(int)), this, SIGNAL(progressChanged(int))); +} + +void FloatWidget::showPause(bool show) +{ + ui.btnPause->setVisible(show); +} + +void FloatWidget::showMicphone(bool show) +{ + ui.btnMic->setVisible(show); +} + +void FloatWidget::showRecord(bool show) +{ + ui.btnRecord->setVisible(show); +} + +void FloatWidget::showProgress(bool show) +{ + ui.labElapse->setVisible(show); + ui.labDuration->setVisible(show); + ui.sliderProgress->setVisible(show); + + if (show) + { + ui.horizontalSpacer1->changeSize(10, 20, QSizePolicy::Ignored, QSizePolicy::Minimum); + ui.horizontalSpacer2->changeSize(10, 20, QSizePolicy::Ignored, QSizePolicy::Minimum); + } + else + { + ui.horizontalSpacer1->changeSize(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); + ui.horizontalSpacer2->changeSize(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); + } +} + +void FloatWidget::setDuration(int64 duration) +{ + int seconds = duration / 1000; + int minutes = seconds / 60; + int hour = minutes / 60; + + seconds %= 60; + minutes %= 60; + + if (hour > 0) + { + ui.labDuration->setText(QString("%1:%2:%3") + .arg(hour, 2, 10, QLatin1Char('0')) + .arg(minutes, 2, 10, QLatin1Char('0')) + .arg(seconds, 2, 10, QLatin1Char('0'))); + } + else + { + ui.labDuration->setText(QString("%1:%2") + .arg(minutes, 2, 10, QLatin1Char('0')) + .arg(seconds, 2, 10, QLatin1Char('0'))); + } +} + +void FloatWidget::setElapse(int64 elapse) +{ + int seconds = elapse / 1000; + int minutes = seconds / 60; + int hour = minutes / 60; + + seconds %= 60; + minutes %= 60; + + if (hour > 0) + { + ui.labElapse->setText(QString("%1:%2:%3") + .arg(hour, 2, 10, QLatin1Char('0')) + .arg(minutes, 2, 10, QLatin1Char('0')) + .arg(seconds, 2, 10, QLatin1Char('0'))); + } + else + { + ui.labElapse->setText(QString("%1:%2") + .arg(minutes, 2, 10, QLatin1Char('0')) + .arg(seconds, 2, 10, QLatin1Char('0'))); + } +} + +/* On linux platform, Qt::WA_TransparentForMouseEvents does not work and it needs to handle mouse events */ + +void FloatWidget::mousePressEvent(QMouseEvent *event) +{ + emit widgetSelecting(); + + if (event->button() == Qt::RightButton) + { + emit contextMenu(event->globalPos()); + } +} + +void FloatWidget::mouseDoubleClickEvent(QMouseEvent * event) +{ + emit doubleClicked(); +} + + + + + diff --git a/MediaClient/MediaClient/formClass/FloatWidget.h b/MediaClient/MediaClient/formClass/FloatWidget.h new file mode 100644 index 0000000..30aba6a --- /dev/null +++ b/MediaClient/MediaClient/formClass/FloatWidget.h @@ -0,0 +1,67 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#pragma once + +#include "sys_inc.h" +#include +#include "ui_FloatWidget.h" + + +class FloatWidget : public QWidget +{ + Q_OBJECT + +public: + FloatWidget(QWidget *parent = NULL, Qt::WindowFlags flags = Qt::Widget); + ~FloatWidget(); + + void showPause(bool show); + void showMicphone(bool show); + void showRecord(bool show); + void showProgress(bool show); + void setDuration(int64 duration); + void setElapse(int64 elapse); + +signals: + void play(); + void pause(); + void stop(); + void micphone(); + void snapshot(); + void record(); + void volume(); + void volumeChanged(int); + void progressChanged(int); + void widgetSelecting(); + void doubleClicked(); + void contextMenu(QPoint); + +protected: + void mousePressEvent(QMouseEvent *event); + void mouseDoubleClickEvent(QMouseEvent * event); + +private: + void initWidget(); + +public: + Ui::FloatWidget ui; +}; + + diff --git a/MediaClient/MediaClient/formClass/Layout.h b/MediaClient/MediaClient/formClass/Layout.h new file mode 100644 index 0000000..90be0f8 --- /dev/null +++ b/MediaClient/MediaClient/formClass/Layout.h @@ -0,0 +1,68 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef _LAYOUT_H_ +#define _LAYOUT_H_ + +#include +#include + +#define LAYOUT_MODE_1 1 +#define LAYOUT_MODE_2 2 +#define LAYOUT_MODE_3 3 +#define LAYOUT_MODE_4 4 +#define LAYOUT_MODE_5 5 +#define LAYOUT_MODE_6 6 +#define LAYOUT_MODE_7 7 +#define LAYOUT_MODE_8 8 +#define LAYOUT_MODE_9 9 +#define LAYOUT_MODE_10 10 +#define LAYOUT_MODE_11 11 +#define LAYOUT_MODE_13 13 +#define LAYOUT_MODE_16 16 +#define LAYOUT_MODE_19 19 +#define LAYOUT_MODE_22 22 +#define LAYOUT_MODE_25 25 + + +typedef struct +{ + int left; + int right; + int top; + int bottom; + + QString url; + QString acct; + QString pass; +} LayoutZone; + +typedef QList LayoutZoneList; + +typedef struct +{ + int rows; + int cols; + LayoutZoneList zones; +} Layout; + + +#endif + + diff --git a/MediaClient/MediaClient/formClass/MediaClient.cpp b/MediaClient/MediaClient/formClass/MediaClient.cpp new file mode 100644 index 0000000..fd68560 --- /dev/null +++ b/MediaClient/MediaClient/formClass/MediaClient.cpp @@ -0,0 +1,289 @@ +/*************************************************************************************** + * + * 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 "MediaClient.h" +#include "CustomLayoutWidget.h" +#include "SystemSetting.h" +#include "utils.h" +#include +#include +#include + +/***************************************************************************************/ + +QTranslator g_translator; + +/***************************************************************************************/ + +MediaClient::MediaClient(QWidget *parent, Qt::WindowFlags flags) +: DialogTitleBar(parent, flags) +{ + loadSystemConfig(); + + setLanguage(m_syscfg.sysLang); + + ui.setupUi(this); + + initDialog(); + + connSignalSlot(); + + if (m_syscfg.enableLog) + { + log_time_init("mediaclient"); + log_set_level(m_syscfg.logLevel); + } + +#ifdef DEMO + QDesktopServices::openUrl(QUrl("https://happytimesoft.com", QUrl::TolerantMode)); +#endif +} + +void MediaClient::initDialog() +{ + setWindowFlags(Qt::WindowSystemMenuHint|Qt::WindowTitleHint| + Qt::WindowMinMaxButtonsHint|Qt::WindowCloseButtonHint); + + setWindowTitle(QString("Happytime media client %1").arg(VERSION_STRING)); + + loadVideoWindowLayout(); + +#ifdef IOS + resize(QSize(1080, 720)); +#endif +} + +void MediaClient::setLanguage(int newLang) +{ + if (newLang == LANG_SYS) + { + if (QLocale::system().language() == QLocale::Chinese) + { + if (g_translator.load(QCoreApplication::applicationDirPath() + "/mediaclient_zh.qm")) + { + QCoreApplication::installTranslator(&g_translator); + } + } + } + else if (newLang == LANG_ZH) + { + if (g_translator.load(QCoreApplication::applicationDirPath() + "/mediaclient_zh.qm")) + { + QCoreApplication::installTranslator(&g_translator); + } + } +} + +void MediaClient::connSignalSlot() +{ + connect(ui.btnLayoutOne, SIGNAL(clicked()), this, SLOT(slotLayoutOne())); + connect(ui.btnLayoutFour, SIGNAL(clicked()), this, SLOT(slotLayoutFour())); + connect(ui.btnLayoutSix, SIGNAL(clicked()), this, SLOT(slotLayoutSix())); + connect(ui.btnLayoutNine, SIGNAL(clicked()), this, SLOT(slotLayoutNine())); + connect(ui.btnLayoutSixteen, SIGNAL(clicked()), this, SLOT(slotLayoutSixteen())); + connect(ui.btnLayoutCustom, SIGNAL(clicked()), this, SLOT(slotLayoutCustom())); + connect(ui.btnFullScreen, SIGNAL(clicked()), this, SLOT(slotFullScreen())); + connect(ui.btnStopAll, SIGNAL(clicked()), this, SLOT(slotStopAll())); + connect(ui.btnSystemSetting, SIGNAL(clicked()), this, SLOT(slotSystemSetting())); + connect(ui.btnOnlineHelp, SIGNAL(clicked()), this, SLOT(slotOnlineHelp())); +} + +/* one window layout */ +void MediaClient::slotLayoutOne() +{ + ui.widgetManager->setLayoutMode(LAYOUT_MODE_1); +} + +/* four window layout */ +void MediaClient::slotLayoutFour() +{ + ui.widgetManager->setLayoutMode(LAYOUT_MODE_4); +} + +/* six window layout */ +void MediaClient::slotLayoutSix() +{ + ui.widgetManager->setLayoutMode(LAYOUT_MODE_6); +} + +/* nine window layout */ +void MediaClient::slotLayoutNine() +{ + ui.widgetManager->setLayoutMode(LAYOUT_MODE_9); +} + +/* sixteen window layout */ +void MediaClient::slotLayoutSixteen() +{ + ui.widgetManager->setLayoutMode(LAYOUT_MODE_16); +} + +/* custom window layout */ +void MediaClient::slotLayoutCustom() +{ + CustomLayoutWidget dlg(this); + + if (QDialog::Accepted == dlg.exec()) + { + Layout layout = dlg.getLayout(); + + ui.widgetManager->setLayout(layout.rows, layout.cols, layout.zones); + } +} + +void MediaClient::slotFullScreen() +{ + ui.widgetManager->setWindowFlags(Qt::FramelessWindowHint); + ui.widgetManager->setParent(0); + ui.widgetManager->showMaximized(); + + this->hide(); + this->grabKeyboard(); +} + +void MediaClient::slotStopAll() +{ + ui.widgetManager->closeAll(); +} + +void MediaClient::slotSystemSetting() +{ + SystemSetting dlg(m_syscfg, this); + + if (QDialog::Accepted == dlg.exec()) + { + SysConfig config = dlg.getSysConfig(); + + /* apply system config parameter */ + + if (m_syscfg.enableLog != config.enableLog) + { + if (m_syscfg.enableLog) + { + log_close(); + } + else + { + log_time_init("mediaclient"); + } + } + + log_set_level(config.logLevel); + + /* update system config parameter */ + m_syscfg.enableLog = config.enableLog; + m_syscfg.recordPath = config.recordPath; + m_syscfg.snapshotPath = config.snapshotPath; + m_syscfg.audioDevice = config.audioDevice; + m_syscfg.videoRenderMode = config.videoRenderMode; + m_syscfg.rtpMulticast = config.rtpMulticast; + m_syscfg.rtpOverUdp = config.rtpOverUdp; + m_syscfg.rtspOverHttp = config.rtspOverHttp; + m_syscfg.rtspOverHttpPort = config.rtspOverHttpPort; + m_syscfg.rtspOverWs = config.rtspOverWs; + m_syscfg.rtspOverWsPort = config.rtspOverWsPort; + m_syscfg.logLevel = config.logLevel; + m_syscfg.sysLang = config.sysLang; + m_syscfg.recordTime = config.recordTime; + m_syscfg.recordSize = config.recordSize; + m_syscfg.hwDecoding = config.hwDecoding; + } +} + +void MediaClient::slotOnlineHelp() +{ + QDesktopServices::openUrl(QUrl("https://www.happytimesoft.com/support/media-client/index.html", QUrl::TolerantMode)); +} + +void MediaClient::keyPressEvent(QKeyEvent * event) +{ + if (event->key() == Qt::Key_Escape) + { + if (ui.widgetManager->isMaximized()) + { + resumeVideoWidget(); + } + } +} + +void MediaClient::closeEvent(QCloseEvent * event) +{ + saveVideoWindowLayout(); + + ui.widgetManager->closeAll(); + + event->accept(); +} + +void MediaClient::resumeVideoWidget() +{ + ui.widgetManager->showNormal(); + ui.widgetManager->setParent(this); + this->layout()->removeItem(ui.layoutLayout); + this->layout()->addWidget(ui.widgetManager); + this->layout()->addItem(ui.layoutLayout); + + this->show(); + releaseKeyboard(); +} + +/* load video window layout mode */ +void MediaClient::loadVideoWindowLayout() +{ + Layout layout; + + getLayout(layout); + + if (layout.zones.size() > 0) + { + ui.widgetManager->setLayout(layout.rows, layout.cols, layout.zones); + } +} + +/* save video window layout mode */ +void MediaClient::saveVideoWindowLayout() +{ + Layout layout; + + ui.widgetManager->getLayout(layout.rows, layout.cols, layout.zones); + + saveLayout(layout); +} + +/* load system config information */ +void MediaClient::loadSystemConfig() +{ + m_syscfg.snapshotPath = getSnapshotPath(); + m_syscfg.recordPath = getRecordPath(); + m_syscfg.audioDevice = getAudioDevice(); + m_syscfg.enableLog = getEnableLogFlag(); + m_syscfg.videoRenderMode = getVideoRenderMode(); + m_syscfg.rtpMulticast = getRtpMulticast(); + m_syscfg.rtpOverUdp = getRtpOverUdp(); + m_syscfg.rtspOverHttp = getRtspOverHttp(); + m_syscfg.rtspOverHttpPort = getRtspOverHttpPort(); + m_syscfg.rtspOverWs = getRtspOverWs(); + m_syscfg.rtspOverWsPort = getRtspOverWsPort(); + m_syscfg.logLevel = getLogLevel(); + m_syscfg.sysLang = getSysLang(); + m_syscfg.recordTime = getRecordTime(); + m_syscfg.recordSize = getRecordSize(); + m_syscfg.hwDecoding = getHWDecoding(); +} + diff --git a/MediaClient/MediaClient/formClass/MediaClient.h b/MediaClient/MediaClient/formClass/MediaClient.h new file mode 100644 index 0000000..4d54ada --- /dev/null +++ b/MediaClient/MediaClient/formClass/MediaClient.h @@ -0,0 +1,64 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#pragma once + +#include +#include "ui_MediaClient.h" +#include "DialogTitle.h" +#include "config.h" + + +class MediaClient : public DialogTitleBar +{ + Q_OBJECT + +public: + MediaClient(QWidget *parent = Q_NULLPTR, Qt::WindowFlags flags = Qt::Widget); + +private slots: + void slotLayoutOne(); + void slotLayoutFour(); + void slotLayoutSix(); + void slotLayoutNine(); + void slotLayoutSixteen(); + void slotLayoutCustom(); + void slotFullScreen(); + void slotStopAll(); + void slotSystemSetting(); + void slotOnlineHelp(); + +private: + void initDialog(); + void connSignalSlot(); + void setLanguage(int newLang); + void resumeVideoWidget(); + void keyPressEvent(QKeyEvent * event); + void closeEvent(QCloseEvent * event); + void loadVideoWindowLayout(); + void saveVideoWindowLayout(); + void loadSystemConfig(); + +private: + Ui::MediaClient ui; + SysConfig m_syscfg; +}; + + + diff --git a/MediaClient/MediaClient/formClass/MediaInfo.cpp b/MediaClient/MediaClient/formClass/MediaInfo.cpp new file mode 100644 index 0000000..863c51c --- /dev/null +++ b/MediaClient/MediaClient/formClass/MediaInfo.cpp @@ -0,0 +1,154 @@ +/*************************************************************************************** + * + * 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 "MediaInfo.h" +#include "media_format.h" +#include + + +MediaInfo::MediaInfo(QWidget *parent, Qt::WindowFlags flags) +: DialogTitleBar(parent, flags) +{ + ui.setupUi(this); + + initDialog(); + connSignalSlot(); +} + +MediaInfo::~MediaInfo() +{ +} + +void MediaInfo::initDialog() +{ +} + +void MediaInfo::connSignalSlot() +{ + connect(ui.btnClose, SIGNAL(clicked()), this, SLOT(slotClose())); +} + +void MediaInfo::setUrl(QString url) +{ + ui.editUrl->setText(url); +} + +void MediaInfo::setVideoInfo(int codec, int width, int height, int framerate) +{ + switch(codec) + { + case VIDEO_CODEC_H264: + ui.editVideoCodec->setText("H264"); + break; + + case VIDEO_CODEC_H265: + ui.editVideoCodec->setText("H265"); + break; + + case VIDEO_CODEC_MP4: + ui.editVideoCodec->setText("MP4"); + break; + + case VIDEO_CODEC_JPEG: + ui.editVideoCodec->setText("MJPEG"); + break; + + case VIDEO_CODEC_NONE: + ui.editVideoCodec->setText("N/A"); + break; + + default: + ui.editVideoCodec->setText(tr("Unknow")); + break; + } + + if (width > 0 && height > 0) + { + ui.editResolution->setText(QString("%1 x %2").arg(width).arg(height)); + } + + if (framerate > 1) + { + ui.editFrameRate->setText(QString("%1").arg(framerate)); + } +} + +void MediaInfo::setAudioInfo(int codec, int samplerate, int channel) +{ + switch(codec) + { + case AUDIO_CODEC_AAC: + ui.editAudioCodec->setText("AAC"); + break; + + case AUDIO_CODEC_G711A: + ui.editAudioCodec->setText("G711A"); + break; + + case AUDIO_CODEC_G711U: + ui.editAudioCodec->setText("G711U"); + break; + + case AUDIO_CODEC_G726: + ui.editAudioCodec->setText("G726"); + break; + + case AUDIO_CODEC_G722: + ui.editAudioCodec->setText("G722"); + break; + + case AUDIO_CODEC_OPUS: + ui.editAudioCodec->setText("OPUS"); + break; + + case AUDIO_CODEC_NONE: + ui.editAudioCodec->setText("N/A"); + break; + + default: + ui.editAudioCodec->setText(tr("Unknow")); + break; + } + + if (samplerate > 0) + { + ui.editSampleRate->setText(QString("%1 Hz").arg(samplerate)); + } + + if (channel == 1) + { + ui.editChannel->setText(tr("Mono")); + } + else if (channel == 2) + { + ui.editChannel->setText(tr("Stereo")); + } + else if (channel > 0) + { + ui.editChannel->setText(QString("%1").arg(channel)); + } +} + +void MediaInfo::slotClose() +{ + close(); +} + + + diff --git a/MediaClient/MediaClient/formClass/MediaInfo.h b/MediaClient/MediaClient/formClass/MediaInfo.h new file mode 100644 index 0000000..2373cd1 --- /dev/null +++ b/MediaClient/MediaClient/formClass/MediaInfo.h @@ -0,0 +1,55 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef MEDIA_INFO_H +#define MEDIA_INFO_H + +#include "sys_inc.h" +#include +#include "ui_MediaInfo.h" +#include "DialogTitle.h" + +class MediaInfo : public DialogTitleBar +{ + Q_OBJECT + +public: + MediaInfo(QWidget *parent = 0, Qt::WindowFlags flags = Qt::Widget); + ~MediaInfo(); + + void setUrl(QString url); + void setVideoInfo(int codec, int width, int height, int framerate); + void setAudioInfo(int codec, int samplerate, int channel); + +private slots: + void slotClose(); + +private: + void initDialog(); + void connSignalSlot(); + +private: + Ui::MediaInfo ui; +}; + +#endif + + + + diff --git a/MediaClient/MediaClient/formClass/OpenMedia.cpp b/MediaClient/MediaClient/formClass/OpenMedia.cpp new file mode 100644 index 0000000..5b8a410 --- /dev/null +++ b/MediaClient/MediaClient/formClass/OpenMedia.cpp @@ -0,0 +1,121 @@ +/*************************************************************************************** + * + * 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 "OpenMedia.h" +#include "utils.h" +#include +#include + +OpenMedia::OpenMedia(QString &url, QString &user, QString &pass, QWidget *parent, Qt::WindowFlags flags) +: DialogTitleBar(parent, flags) +, m_url(url) +, m_user(user) +, m_pass(pass) +{ + ui.setupUi(this); + + if (isUrl(m_url)) + { + ui.editUrl->setText(m_url); + ui.tabWidget->setCurrentIndex(1); + } + else + { + ui.editFilePath->setText(m_url); + ui.tabWidget->setCurrentIndex(0); + } + + ui.editUser->setText(m_user); + ui.editPass->setText(m_pass); + + connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(close())); + connect(ui.btnConfirm, SIGNAL(clicked()), this, SLOT(slotConfirm())); + connect(ui.btnSelect, SIGNAL(clicked()), this, SLOT(slotSelect())); +} + +OpenMedia::~OpenMedia() +{ +} + +void OpenMedia::slotSelect() +{ + static QString path = getOpenFilePath(); + + QString filter = "*.m4v *.m4a *.m4b *.m4p *.m4r *.aa *.aax *.amr *.mod *.tod " + "*.mts *.ts *.m2ts *.tp *.trp *.avi *.mpg *.mpeg *.mp4 *.m4v " + "*.dpg *.3gp *.3g2 *.asf *.wma *.wmv *.ra *.ram *.rm *.rmvb " + "*.dat *.mov *.flv *.f4v *.mkv *.dv *.dvr-ms *.nut *.264 *.h264 " + "*.nsv *.vob *.gif *.mp2 *.mp3 *.mpa *.m4a *.aac *.ac3 *.mka " + "*.ogg *.aif *.aiff *.tivo *.ape *.flac *.wav *.webm"; + + QFileDialog::Options options(QFileDialog::HideNameFilterDetails); + + QString fileName = QFileDialog::getOpenFileName(this, tr("Select media file"), path, filter, NULL, options); + if (!fileName.isEmpty()) + { + QFileInfo fileInfo(fileName); + path = fileInfo.absoluteFilePath(); + + saveOpenFilePath(path); + + ui.editFilePath->setText(fileName); + } +} + +void OpenMedia::slotConfirm() +{ + int idx = ui.tabWidget->currentIndex(); + if (idx == 0) + { + m_url = ui.editFilePath->text(); + m_user = QString(); + m_pass = QString(); + + if (m_url.isEmpty()) + { + ui.editFilePath->setFocus(); + return; + } + } + else + { + m_url = ui.editUrl->text(); + m_user = ui.editUser->text(); + m_pass = ui.editPass->text(); + + if (m_url.isEmpty()) + { + ui.editUrl->setFocus(); + return; + } + else if (!isUrl(m_url)) + { + QMessageBox::information(NULL, tr("Tips"), tr("Invalid URL format!")); + ui.editUrl->setFocus(); + return; + } + } + + accept(); +} + + + + diff --git a/MediaClient/MediaClient/formClass/OpenMedia.h b/MediaClient/MediaClient/formClass/OpenMedia.h new file mode 100644 index 0000000..2705d90 --- /dev/null +++ b/MediaClient/MediaClient/formClass/OpenMedia.h @@ -0,0 +1,51 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef OPEN_MEDIA_H +#define OPEN_MEDIA_H + +#include +#include "ui_OpenMedia.h" +#include "DialogTitle.h" + +class OpenMedia : public DialogTitleBar +{ + Q_OBJECT + +public: + OpenMedia(QString &url, QString &user, QString &pass, QWidget *parent = 0, Qt::WindowFlags flags = Qt::Widget); + ~OpenMedia(); + + QString getUrl() { return m_url; } + QString getUser() { return m_user; } + QString getPass() { return m_pass; } + +public slots: + void slotSelect(); + void slotConfirm(); + +private: + Ui::OpenMedia ui; + QString m_url; + QString m_user; + QString m_pass; +}; + +#endif + diff --git a/MediaClient/MediaClient/formClass/SystemSetting.cpp b/MediaClient/MediaClient/formClass/SystemSetting.cpp new file mode 100644 index 0000000..7af1ea2 --- /dev/null +++ b/MediaClient/MediaClient/formClass/SystemSetting.cpp @@ -0,0 +1,276 @@ +/*************************************************************************************** + * + * 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 "SystemSetting.h" +#include "utils.h" +#include "video_decoder.h" +#include +#include +#include +#include + +#if __WINDOWS_OS__ +#include "audio_capture_win.h" +#elif defined(IOS) +#include "audio_capture_mac.h" +#elif defined(ANDROID) +#include "audio_capture_android.h" +#elif __LINUX_OS__ +#include "audio_capture_linux.h" +#endif + +SystemSetting::SystemSetting(SysConfig &config, QWidget *parent, Qt::WindowFlags flags) +: DialogTitleBar(parent, flags) +, m_syscfg(config) +{ + ui.setupUi(this); + + initDialog(); + connSignalSlot(); +} + +SystemSetting::~SystemSetting() +{ +} + +void SystemSetting::initDialog() +{ + ui.cmbLogLevel->addItem(tr("TRACE")); + ui.cmbLogLevel->addItem(tr("DEBUG")); + ui.cmbLogLevel->addItem(tr("INFO")); + ui.cmbLogLevel->addItem(tr("WARNING")); + ui.cmbLogLevel->addItem(tr("ERROR")); + ui.cmbLogLevel->addItem(tr("FATAL")); + + ui.cmbLanguage->addItem(tr("System")); + ui.cmbLanguage->addItem(tr("English")); + ui.cmbLanguage->addItem(tr("Chinese")); + + ui.cmbVideoRenderMode->addItem(tr("Keep the original aspect ratio")); + ui.cmbVideoRenderMode->addItem(tr("Fill the whole window")); + + ui.cmbHWDecoding->addItem(tr("Automatic"), HW_DECODING_AUTO); +#if __WINDOWS_OS__ + ui.cmbHWDecoding->addItem(tr("Direct3D11 Video Acceleration"), HW_DECODING_D3D11); + ui.cmbHWDecoding->addItem(tr("DirectX Video Acceleration (DXVA) 2.0"), HW_DECODING_DXVA); +#elif defined(IOS) + ui.cmbHWDecoding->addItem(tr("Video Tool Box"), HW_DECODING_VIDEOTOOLBOX); + ui.cmbHWDecoding->addItem(tr("OPENCL"), HW_DECODING_OPENCL); +#elif defined(ANDROID) + ui.cmbHWDecoding->addItem(tr("Media Codec"), HW_DECODING_MEDIACODEC); +#elif __LINUX_OS__ + ui.cmbHWDecoding->addItem(tr("VAAPI"), HW_DECODING_VAAPI); + ui.cmbHWDecoding->addItem(tr("OPENCL"), HW_DECODING_OPENCL); +#endif + ui.cmbHWDecoding->addItem(tr("Disable"), HW_DECODING_DISABLE); + + int i, count; + char name[256] = {'\0'}; + + ui.cmbAudioDevice->addItem("Default device"); + +#if __WINDOWS_OS__ + count = CWAudioCapture::getDeviceNums(); + + for (i = 0; i < count; i++) + { + if (CWAudioCapture::getDeviceName(i, name, sizeof(name)-1)) + { + ui.cmbAudioDevice->addItem(QString::fromLocal8Bit(name)); + } + } +#elif defined(IOS) + count = CMAudioCapture::getDeviceNums(); + + for (i = 0; i < count; i++) + { + if (CMAudioCapture::getDeviceName(i, name, sizeof(name)-1)) + { + ui.cmbAudioDevice->addItem(QString::fromLocal8Bit(name)); + } + } +#elif __LINUX_OS__ + count = CLAudioCapture::getDeviceNums(); + + for (i = 0; i < count; i++) + { + if (CLAudioCapture::getDeviceName(i, name, sizeof(name)-1)) + { + ui.cmbAudioDevice->addItem(QString::fromLocal8Bit(name)); + } + } +#endif + + ui.editSnapshotPath->setText(m_syscfg.snapshotPath); + ui.editRecordPath->setText(m_syscfg.recordPath); + ui.chkEnableLog->setChecked(m_syscfg.enableLog); + ui.chkRtpMulticast->setChecked(m_syscfg.rtpMulticast); + ui.chkRtpOverUdp->setChecked(m_syscfg.rtpOverUdp); + ui.chkRtspOverHttp->setChecked(m_syscfg.rtspOverHttp); + ui.spinHttpPort->setValue(m_syscfg.rtspOverHttpPort); + ui.chkRtspOverWs->setChecked(m_syscfg.rtspOverWs); + ui.spinWsPort->setValue(m_syscfg.rtspOverWsPort); + ui.cmbVideoRenderMode->setCurrentIndex(m_syscfg.videoRenderMode); + ui.cmbLogLevel->setCurrentIndex(m_syscfg.logLevel); + ui.cmbLanguage->setCurrentIndex(m_syscfg.sysLang); + ui.timeRecordTime->setTime(QTime(0,0,0,0).addSecs(m_syscfg.recordTime)); + ui.spinRecordSize->setValue(m_syscfg.recordSize); + + for (i = 0; i < ui.cmbHWDecoding->count(); i++) + { + if (ui.cmbHWDecoding->itemData(i).toInt() == m_syscfg.hwDecoding) + { + ui.cmbHWDecoding->setCurrentIndex(i); + break; + } + } + + for (i = 0; i < ui.cmbAudioDevice->count(); i++) + { + if (ui.cmbAudioDevice->itemText(i) == m_syscfg.audioDevice) + { + ui.cmbAudioDevice->setCurrentIndex(i); + break; + } + } +} + +void SystemSetting::connSignalSlot() +{ + connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(close())); + connect(ui.btnConfirm, SIGNAL(clicked()), this, SLOT(slotConfirm())); + connect(ui.btnOpenSnapshotPath, SIGNAL(clicked()), this, SLOT(slotOpenSnapshotPath())); + connect(ui.btnOpenRecordPath, SIGNAL(clicked()), this, SLOT(slotOpenRecordPath())); + connect(ui.btnBrowseSnapshotPath, SIGNAL(clicked()), this, SLOT(slotBrowseSnapshotPath())); + connect(ui.btnBrowseRecordPath, SIGNAL(clicked()), this, SLOT(slotBrowseRecordPath())); +} + +void SystemSetting::slotOpenSnapshotPath() +{ + QString path = ui.editSnapshotPath->text(); + if (path.isEmpty()) + { + return; + } + + if (!QFile::exists(path)) + { + QMessageBox::information(this, tr("Tips"), tr("Snapshot path not exist")); + return; + } + + QDesktopServices::openUrl(QUrl("file:///" + path, QUrl::TolerantMode)); +} + +void SystemSetting::slotOpenRecordPath() +{ + QString path = ui.editRecordPath->text(); + if (path.isEmpty()) + { + return; + } + + if (!QFile::exists(path)) + { + QMessageBox::information(this, tr("Tips"), tr("Record path not exist")); + return; + } + + QDesktopServices::openUrl(QUrl("file:///" + path, QUrl::TolerantMode)); +} + +void SystemSetting::slotBrowseSnapshotPath() +{ + QFileDialog::Options options = QFileDialog::DontResolveSymlinks | QFileDialog::ShowDirsOnly; + QString path = ui.editSnapshotPath->text(); + + path = QFileDialog::getExistingDirectory(this, tr("Select snapshot save path"), path, options); + if (!path.isEmpty()) + { + ui.editSnapshotPath->setText(path); + } +} + +void SystemSetting::slotBrowseRecordPath() +{ + QFileDialog::Options options = QFileDialog::DontResolveSymlinks | QFileDialog::ShowDirsOnly; + QString path = ui.editRecordPath->text(); + + path = QFileDialog::getExistingDirectory(this, tr("Select record save path"), path, options); + if (!path.isEmpty()) + { + ui.editRecordPath->setText(path); + } +} + +void SystemSetting::slotConfirm() +{ + m_syscfg.recordPath = ui.editRecordPath->text(); + m_syscfg.snapshotPath = ui.editSnapshotPath->text(); + m_syscfg.audioDevice = ui.cmbAudioDevice->currentText(); + m_syscfg.enableLog = ui.chkEnableLog->isChecked(); + m_syscfg.logLevel = ui.cmbLogLevel->currentIndex(); + m_syscfg.rtpMulticast = ui.chkRtpMulticast->isChecked(); + m_syscfg.rtpOverUdp = ui.chkRtpOverUdp->isChecked(); + m_syscfg.rtspOverHttp = ui.chkRtspOverHttp->isChecked(); + m_syscfg.rtspOverHttpPort = ui.spinHttpPort->value(); + m_syscfg.rtspOverWs = ui.chkRtspOverWs->isChecked(); + m_syscfg.rtspOverWsPort = ui.spinWsPort->value(); + m_syscfg.videoRenderMode = ui.cmbVideoRenderMode->currentIndex(); + m_syscfg.sysLang = ui.cmbLanguage->currentIndex(); + m_syscfg.recordTime = QTime(0, 0, 0, 0).secsTo(ui.timeRecordTime->time()); + m_syscfg.recordSize = ui.spinRecordSize->value(); + m_syscfg.hwDecoding = ui.cmbHWDecoding->currentData().toInt(); + + if (!QFile::exists(m_syscfg.snapshotPath)) + { + QMessageBox::information(this, tr("Tips"), tr("Please specify the correct snapshot path")); + ui.editSnapshotPath->setFocus(); + return; + } + + if (!QFile::exists(m_syscfg.recordPath)) + { + QMessageBox::information(this, tr("Tips"), tr("Please specify the correct video recording path")); + ui.editRecordPath->setFocus(); + return; + } + + saveSnapshotPath(m_syscfg.snapshotPath); + saveRecordPath(m_syscfg.recordPath); + saveAudioDevice(m_syscfg.audioDevice); + saveEnableLogFlag(m_syscfg.enableLog); + saveLogLevel(m_syscfg.logLevel); + saveRtpMulticast(m_syscfg.rtpMulticast); + saveRtpOverUdp(m_syscfg.rtpOverUdp); + saveRtspOverHttp(m_syscfg.rtspOverHttp); + saveRtspOverHttpPort(m_syscfg.rtspOverHttpPort); + saveRtspOverWs(m_syscfg.rtspOverWs); + saveRtspOverWsPort(m_syscfg.rtspOverWsPort); + saveVideoRenderMode(m_syscfg.videoRenderMode); + saveSysLang(m_syscfg.sysLang); + saveRecordTime(m_syscfg.recordTime); + saveRecordSize(m_syscfg.recordSize); + saveHWDecoding(m_syscfg.hwDecoding); + + accept(); +} + + + diff --git a/MediaClient/MediaClient/formClass/SystemSetting.h b/MediaClient/MediaClient/formClass/SystemSetting.h new file mode 100644 index 0000000..c90b20c --- /dev/null +++ b/MediaClient/MediaClient/formClass/SystemSetting.h @@ -0,0 +1,60 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef _SYSTEM_SETTING_H_ +#define _SYSTEM_SETTING_H_ + +#include "sys_inc.h" +#include +#include "ui_SystemSetting.h" +#include "config.h" +#include "DialogTitle.h" + +class SystemSetting : public DialogTitleBar +{ + Q_OBJECT + +public: + SystemSetting(SysConfig &config, QWidget *parent = 0, Qt::WindowFlags flags = Qt::Widget); + ~SystemSetting(); + + SysConfig getSysConfig(){return m_syscfg;} + +private slots: + void slotConfirm(); + void slotOpenSnapshotPath(); + void slotOpenRecordPath(); + void slotBrowseSnapshotPath(); + void slotBrowseRecordPath(); + +private: + void initDialog(); + void connSignalSlot(); + +private: + Ui::SystemSetting ui; + + SysConfig m_syscfg; +}; + +#endif + + + + diff --git a/MediaClient/MediaClient/formClass/UMSlider.cpp b/MediaClient/MediaClient/formClass/UMSlider.cpp new file mode 100644 index 0000000..281d809 --- /dev/null +++ b/MediaClient/MediaClient/formClass/UMSlider.cpp @@ -0,0 +1,54 @@ +/*************************************************************************************** + * + * 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 "UMSlider.h" + + +UMSlider::UMSlider(QWidget *parent) : QSlider(parent) +{ + setMouseTracking(true); +} + +UMSlider::UMSlider(Qt::Orientation orientation, QWidget * parent) : QSlider(orientation, parent) +{ + setMouseTracking(true); +} + +void UMSlider::mousePressEvent(QMouseEvent *event) +{ + blockSignals(true); + QSlider::mousePressEvent(event); + blockSignals(false); + + double ro = event->x() / (double)width(); + setSliderPosition(ro * (maximum() - minimum()) + minimum()); +} + +void UMSlider::mouseMoveEvent(QMouseEvent *event) +{ + int ro = event->x() * 100 / (double)width(); + + setToolTip(QString("%1%").arg(ro)); + + QSlider::mouseMoveEvent(event); +} + + + diff --git a/MediaClient/MediaClient/formClass/UMSlider.h b/MediaClient/MediaClient/formClass/UMSlider.h new file mode 100644 index 0000000..4b19d35 --- /dev/null +++ b/MediaClient/MediaClient/formClass/UMSlider.h @@ -0,0 +1,41 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef _UM_SLIDER_H_ +#define _UM_SLIDER_H_ + +#include +#include + +class UMSlider : public QSlider +{ + Q_OBJECT + +public: + UMSlider(QWidget *parent = 0); + UMSlider(Qt::Orientation orientation, QWidget * parent = 0); + +protected: + void mousePressEvent(QMouseEvent *event); + void mouseMoveEvent(QMouseEvent *event); +}; + +#endif + + diff --git a/MediaClient/MediaClient/formClass/VideoSubWidget.cpp b/MediaClient/MediaClient/formClass/VideoSubWidget.cpp new file mode 100644 index 0000000..c2c0b7e --- /dev/null +++ b/MediaClient/MediaClient/formClass/VideoSubWidget.cpp @@ -0,0 +1,130 @@ +/*************************************************************************************** + * + * 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 "VideoSubWidget.h" +#include +#include +#include + + +VideoSubWidget::VideoSubWidget(QWidget *parent, Qt::WindowFlags flags) + : QWidget(parent, flags) +{ + setAcceptDrops(true); + setAutoFillBackground(false); + setContextMenuPolicy(Qt::CustomContextMenu); +} + + +VideoSubWidget::~VideoSubWidget() +{ + +} + +void VideoSubWidget::dragEnterEvent(QDragEnterEvent *event) +{ + if (event->mimeData()->hasUrls()) + { + event->acceptProposedAction(); + } + else + { + event->ignore(); + } +} + +void VideoSubWidget::dropEvent(QDropEvent *event) +{ + const QMimeData * mimeData = event->mimeData(); + if (mimeData->hasUrls()) + { + QList urls = mimeData->urls(); + QString fileName = urls.at(0).toLocalFile(); + + int i; + QStringList filter = { ".m4v", ".m4a", ".m4b", ".m4p", ".m4r", ".aa", ".aax", ".amr", ".mod", ".tod", + ".mts", ".ts", ".m2ts", ".tp", ".trp", ".avi", ".mpg", ".mpeg", ".mp4", ".m4v", + ".dpg", ".3gp", ".3g2", ".asf", ".wma", ".wmv", ".ra", ".ram", ".rm", ".rmvb", + ".dat", ".mov", ".flv", ".f4v", ".mkv", ".dv", ".dvr-ms", ".nut", ".264", ".h264", + ".nsv", ".vob", ".gif", ".mp2", ".mp3", ".mpa", ".m4a", ".aac", ".ac3", ".mka", + ".ogg", ".aif", ".aiff", ".tivo", ".ape", ".flac", ".wav", ".webm"}; + + for (i = 0; i < filter.size(); i++) + { + if (fileName.endsWith(filter.at(i))) + { + event->acceptProposedAction(); + + emit dragDroped(fileName); + } + } + } +} + +void VideoSubWidget::paintEvent(QPaintEvent * event) +{ + QPainter painter(this); + + painter.setClipRegion(event->rect()); + + painter.fillRect(rect(), Qt::SolidPattern); + + if (!m_tips.isEmpty()) + { + QPen pen(Qt::red, 5); + QRect rect = this->rect(); + + painter.setPen(pen); + painter.drawText(QRect(rect.left(), rect.top()+rect.height()/2-10, rect.width(), 20), Qt::AlignCenter, m_tips); + } +} + +void VideoSubWidget::mouseDoubleClickEvent(QMouseEvent * event) +{ + emit doubleClicked(); +} + +void VideoSubWidget::mousePressEvent(QMouseEvent *event) +{ + emit widgetSelecting(); + + if (event->button() == Qt::RightButton) + { + emit contextMenu(event->globalPos()); + } +} + +void VideoSubWidget::resizeEvent(QResizeEvent *event) +{ + QWidget::resizeEvent(event); + + emit sizeChanged(event->size()); +} + +void VideoSubWidget::setTips(QString tips) +{ + m_tips = tips; + + update(); +} + + + + diff --git a/MediaClient/MediaClient/formClass/VideoSubWidget.h b/MediaClient/MediaClient/formClass/VideoSubWidget.h new file mode 100644 index 0000000..37397cb --- /dev/null +++ b/MediaClient/MediaClient/formClass/VideoSubWidget.h @@ -0,0 +1,56 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef VIDEO_SUB_WIDGET_H +#define VIDEO_SUB_WIDGET_H + +#include + + +class VideoSubWidget : public QWidget +{ + Q_OBJECT + +public: + VideoSubWidget(QWidget *parent = 0, Qt::WindowFlags flags = Qt::Widget); + ~VideoSubWidget(); + + void setTips(QString tips); + +signals: + void widgetSelecting(); + void doubleClicked(); + void dragDroped(QString); + void contextMenu(QPoint); + void sizeChanged(QSize); + +protected: + void dragEnterEvent(QDragEnterEvent *event); + void dropEvent(QDropEvent *event); + void paintEvent(QPaintEvent * event); + void mouseDoubleClickEvent(QMouseEvent * event); + void mousePressEvent(QMouseEvent *event); + void resizeEvent(QResizeEvent *event); + +private: + QString m_tips; +}; + +#endif + diff --git a/MediaClient/MediaClient/formClass/VideoWidget.cpp b/MediaClient/MediaClient/formClass/VideoWidget.cpp new file mode 100644 index 0000000..8687f5e --- /dev/null +++ b/MediaClient/MediaClient/formClass/VideoWidget.cpp @@ -0,0 +1,1121 @@ +/*************************************************************************************** + * + * 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 "VideoWidget.h" +#include "rtsp_player.h" +#include "rtmp_player.h" +#include "http_flv_player.h" +#include "http_mjpeg_player.h" +#include "srt_player.h" +#include "file_player.h" +#include "http_test.h" +#include "utils.h" +#include "OpenMedia.h" +#include "MediaInfo.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef BACKCHANNEL +#if __WINDOWS_OS__ +#include "audio_capture_win.h" +#elif defined(IOS) +#include "audio_capture_mac.h" +#elif defined(ANDROID) +#include "audio_capture_android.h" +#elif __LINUX_OS__ +#include "audio_capture_linux.h" +#endif +#endif + +/***********************************************************************/ + +VideoWidget::VideoWidget(QWidget *parent, Qt::WindowFlags flags) +: QWidget(parent, flags) +, m_bSelected(false) +, m_bFullScreen(false) +, m_bRecording(false) +, m_bRtsp(false) +, m_pParent(NULL) +, m_pPlayer(NULL) +, m_pFloatWidget(NULL) +, m_nRenderMode(RENDER_MODE_KEEP) +#ifdef BACKCHANNEL +, m_nBackChannelFlag(0) +#endif +{ + ui.setupUi(this); + + initVideoWidget(); + initActions(); +} + + +VideoWidget::~VideoWidget() +{ + m_timerFloatWidget.stop(); + + if (m_pFloatWidget) + { + delete m_pFloatWidget; + m_pFloatWidget = NULL; + } + + closeVideo(); +} + +void VideoWidget::initVideoWidget() +{ + setMouseTracking(true); + setAcceptDrops(true); + setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + setAutoFillBackground(false); + + m_timerReconn.setSingleShot(true); + + m_timerFloatWidget.setParent(this); + m_timerFloatWidget.start(1000); + + connect(&m_timerReconn, SIGNAL(timeout()), this, SLOT(slotReconn())); + connect(&m_timerFloatWidget, SIGNAL(timeout()), this, SLOT(slotFloatWidget())); + connect(&m_timerProgress, SIGNAL(timeout()), this, SLOT(slotProgress())); + + QObject::connect(ui.widgetVideo, SIGNAL(widgetSelecting()), this, SLOT(slotWidgetSelecting())); + QObject::connect(ui.widgetVideo, SIGNAL(doubleClicked()), this, SLOT(slotFullscreen())); + QObject::connect(ui.widgetVideo, SIGNAL(dragDroped(QString)), this, SLOT(slotDragDroped(QString))); + QObject::connect(ui.widgetVideo, SIGNAL(contextMenu(QPoint)), this, SLOT(slotContextMenu(QPoint))); + QObject::connect(ui.widgetVideo, SIGNAL(sizeChanged(QSize)), this, SLOT(slotSizeChanged(QSize))); +} + +void VideoWidget::initActions() +{ + m_actionCloseVideo = new QAction(this); + m_actionCloseVideo->setText(tr("Close Video")); + m_actionCloseVideo->setStatusTip(tr("Close Video")); + + m_actionFullScreen = new QAction(this); + m_actionFullScreen->setText(tr("Full Screen")); + m_actionFullScreen->setStatusTip(tr("Full Screen")); + + m_actionResumeNormal = new QAction(this); + m_actionResumeNormal->setText(tr("Exit Full Screen")); + m_actionResumeNormal->setStatusTip(tr("Exit Full Screen")); + + m_actionFillWhole = new QAction(this); + m_actionFillWhole->setText(tr("Fill the whole window")); + m_actionFillWhole->setStatusTip(tr("Fill the whole window")); + + m_actionKeepAspectRatio = new QAction(this); + m_actionKeepAspectRatio->setText(tr("Keep the original aspect ratio")); + m_actionKeepAspectRatio->setStatusTip(tr("Keep the original aspect ratio")); + + m_actionMediaInfo = new QAction(this); + m_actionMediaInfo->setText(tr("Media information ...")); + m_actionMediaInfo->setStatusTip(tr("Media information")); + + connect(m_actionCloseVideo, SIGNAL(triggered()), this, SLOT(slotCloseVideo())); + connect(m_actionFullScreen, SIGNAL(triggered()), this, SLOT(slotFullscreen())); + connect(m_actionResumeNormal, SIGNAL(triggered()), this, SLOT(slotResumeNormal())); + connect(m_actionFillWhole, SIGNAL(triggered()), this, SLOT(slotFillWhole())); + connect(m_actionKeepAspectRatio, SIGNAL(triggered()), this, SLOT(slotKeepAspectRatio())); + connect(m_actionMediaInfo, SIGNAL(triggered()), this, SLOT(slotMediaInfo())); +} + +void VideoWidget::paintEvent(QPaintEvent * event) +{ + QPainter painter(this); + + if (m_bSelected && !m_bFullScreen) + { + painter.fillRect(rect(), QBrush(QColor(170, 85, 255))); + } + else + { + painter.fillRect(rect(), QBrush(QColor(20, 20, 20))); + } +} + +void VideoWidget::resizeEvent(QResizeEvent * event) +{ + if (m_pFloatWidget) + { + QRect rect = ui.widgetVideo->geometry(); + QPoint pt = mapToGlobal(rect.topLeft()); + + m_pFloatWidget->setGeometry(pt.x(), pt.y(), ui.widgetVideo->width(), ui.widgetVideo->height()); + } +} + +void VideoWidget::mousePressEvent(QMouseEvent *event) +{ + qDebug() << "VideoWidget::mousePressEvent"; + + slotWidgetSelecting(); +} + +void VideoWidget::keyPressEvent(QKeyEvent * event) +{ + if (event->key() == Qt::Key_Escape) + { + if (m_bFullScreen) + { + resumeWidget(); + } + } +} + +bool VideoWidget::canMaximized() +{ + // The parent window is full screen, it cannot be full screen + QWidget * pParentWidget; + QObject * pParent = parent(); + while (pParent) + { + if (pParent->isWidgetType()) + { + pParentWidget = (QWidget *)pParent; + if (pParentWidget->inherits("MediaClient")) + { + break; + } + + if (pParentWidget->isMaximized()) + { + return false; + } + } + + pParent = pParent->parent(); + } + + return true; +} + +void VideoWidget::showParent(bool show) +{ + // show parent widget + QWidget * pParentWidget; + QObject * pParent = parent(); + while (pParent) + { + if (pParent->isWidgetType()) + { + pParentWidget = (QWidget *)pParent; + + if (show) + pParentWidget->show(); + else + pParentWidget->hide(); + } + + pParent = pParent->parent(); + } +} + +void VideoWidget::fullScreen() +{ + if (!canMaximized()) + { + return; + } + + // hide parent widget + showParent(false); + + m_rect = geometry(); + m_pParent = (QWidget *)parent(); + setParent(NULL); + setWindowFlags(Qt::FramelessWindowHint); + + showMaximized(); + + if (m_pFloatWidget) + { + m_pFloatWidget->hide(); + } + + grabKeyboard(); + + m_bFullScreen = true; +} + +void VideoWidget::resumeWidget() +{ + setParent(m_pParent); + + // show parent widget + showParent(true); + + showNormal(); + + setGeometry(m_rect); + + if (m_pFloatWidget) + { + m_pFloatWidget->hide(); + } + + releaseKeyboard(); + + m_bFullScreen = false; +} + +void VideoWidget::closePlayer() +{ + m_timerReconn.stop(); + m_timerProgress.stop(); + + if (m_pPlayer) + { + stopRecord(); + + setMicphone(0); + + delete m_pPlayer; + m_pPlayer = NULL; + } +} + +void VideoWidget::closeVideo() +{ + closePlayer(); + + m_url = ""; + m_acct = ""; + m_pass = ""; + m_bRtsp = false; + m_bRecording = false; + + ui.widgetVideo->setTips(""); + + if (m_pFloatWidget) + { + m_pFloatWidget->ui.btnPause->setIcon(QIcon(QString::fromUtf8(":/res/Resources/btn_pause.png"))); + m_pFloatWidget->ui.btnPause->setToolTip(tr("Pause")); + + m_pFloatWidget->setElapse(0); + m_pFloatWidget->setDuration(0); + } +} + +void VideoWidget::slotCloseVideo() +{ + closeVideo(); +} + +void VideoWidget::slotResumeNormal() +{ + resumeWidget(); +} + +void VideoWidget::slotFillWhole() +{ + m_nRenderMode = RENDER_MODE_FILL; + + if (m_pPlayer) + { + m_pPlayer->setRenderMode(m_nRenderMode); + } +} + +void VideoWidget::slotKeepAspectRatio() +{ + m_nRenderMode = RENDER_MODE_KEEP; + + if (m_pPlayer) + { + m_pPlayer->setRenderMode(m_nRenderMode); + } +} + +void VideoWidget::slotMediaInfo() +{ + MediaInfo dlg; + + if (m_pPlayer) + { + dlg.setUrl(m_url); + dlg.setVideoInfo(m_pPlayer->getVideoCodec(), m_pPlayer->getVideoWidth(), + m_pPlayer->getVideoHeight(), m_pPlayer->getFrameRate()); + dlg.setAudioInfo(m_pPlayer->getAudioCodec(), m_pPlayer->getSampleRate(), + m_pPlayer->getChannel()); + } + + dlg.exec(); +} + +void VideoWidget::setSelected(bool flag) +{ + m_bSelected = flag; + + update(); +} + +void VideoWidget::setMediaInfo(QString url, QString acct, QString pass, int bcflag) +{ + if (m_url == url && m_acct == acct && m_pass == pass) + { + return; + } + + closeVideo(); + + m_url = url; + m_acct = acct; + m_pass = pass; + m_base = getBaseName(url); + +#ifdef BACKCHANNEL + m_nBackChannelFlag = bcflag; +#endif + + if (!m_url.isEmpty()) + { + makeCall(); + } +} + +void VideoWidget::setRenderMode(int mode) +{ + m_nRenderMode = mode; +} + +void VideoWidget::slotWidgetSelecting() +{ + if (!m_bSelected) + { + emit widgetSelecting(this); + } +} + +void VideoWidget::slotFullscreen() +{ + if (m_bFullScreen) + { + resumeWidget(); + } + else + { + fullScreen(); + } +} + +void VideoWidget::slotDragDroped(QString url) +{ + setMediaInfo(url, QString(), QString(), 0); +} + +void VideoWidget::makeCall() +{ + BOOL isFile = 0; + + if (m_bRtsp || isRtspUrl(m_url)) + { + m_bRtsp = true; + m_pPlayer = new CRtspPlayer(this); + } + else if (isRtmpUrl(m_url)) + { + m_pPlayer = new CRtmpPlayer(this); + } + else if (isHttpUrl(m_url)) + { + HTTPCTT ctt; + + if (http_test(m_url.toStdString().c_str(), m_acct.toStdString().c_str(), m_pass.toStdString().c_str(), &ctt, 2*1000)) + { + if (CTT_RTSP_TUNNELLED == ctt) + { + m_bRtsp = true; + m_pPlayer = new CRtspPlayer(this); + } + else if (CTT_FLV == ctt) + { + m_pPlayer = new CHttpFlvPlayer(this); + } + else if (CTT_MULTIPART == ctt) + { + m_pPlayer = new CHttpMjpegPlayer(this); + } + } + else + { + m_pPlayer = new CHttpFlvPlayer(this); + } + } + else if (isSrtUrl(m_url)) + { + m_pPlayer = new CSrtPlayer(this); + } + else + { + isFile = 1; + m_pPlayer = new CFilePlayer(this); + +#ifdef IOS + ui.widgetVideo->setTips(m_url); +#endif + } + + if (NULL == m_pPlayer) + { + return; + } + + connect(m_pPlayer, SIGNAL(notify(int)), this, SLOT(slotPlayerNotify(int)), Qt::QueuedConnection); + connect(m_pPlayer, SIGNAL(snapshoted(AVFrame*)), this, SLOT(slotSnapshoted(AVFrame*)), Qt::QueuedConnection); + + if (m_pPlayer->open(m_url, ui.widgetVideo->winId())) + { + m_pPlayer->setAuthInfo(m_acct, m_pass); + m_pPlayer->setRenderMode(m_nRenderMode); + m_pPlayer->setHWDecoding(getHWDecoding()); + + if (m_bRtsp) + { + m_pPlayer->setRtpOverUdp(getRtpOverUdp()); + m_pPlayer->setRtpMulticast(getRtpMulticast()); + +#ifdef OVER_HTTP + m_pPlayer->setRtspOverHttp(getRtspOverHttp(), getRtspOverHttpPort()); +#endif +#ifdef OVER_WEBSOCKET + m_pPlayer->setRtspOverWs(getRtspOverWs(), getRtspOverWsPort()); +#endif +#ifdef BACKCHANNEL + if (m_nBackChannelFlag) + { + int index = 0; +#if __WINDOWS_OS__ + index = CWAudioCapture::getDeviceIndex(getAudioDevice().toLocal8Bit()); +#elif defined(IOS) + index = CMAudioCapture::getDeviceIndex(getAudioDevice().toLocal8Bit()); +#elif defined(ANDROID) + index = CAAudioCapture::getDeviceIndex(getAudioDevice().toLocal8Bit()); +#elif __LINUX_OS__ + index = CLAudioCapture::getDeviceIndex(getAudioDevice().toLocal8Bit()); +#endif + m_pPlayer->setAudioDevice(index); + } + + m_pPlayer->setBCFlag(m_nBackChannelFlag); +#endif + } + + m_timerProgress.start(1000); + + m_pPlayer->play(); + } + else + { + closePlayer(); + + ui.widgetVideo->setTips("Invalid url"); + } +} + +void VideoWidget::setVolume() +{ + if (m_pFloatWidget && m_pPlayer) + { + if (m_pFloatWidget->ui.btnVolume->property("mute").toBool()) + { + m_pPlayer->setVolume(0); + } + else + { + m_pPlayer->setVolume(m_pFloatWidget->ui.sliderVolume->value()); + } + } +} + +void VideoWidget::showFloatWidget(bool show) +{ + if (show) + { + if (NULL == m_pFloatWidget) + { + m_pFloatWidget = new FloatWidget(this); + + QObject::connect(m_pFloatWidget, SIGNAL(play()), this, SLOT(slotPlay())); + QObject::connect(m_pFloatWidget, SIGNAL(pause()), this, SLOT(slotPause())); + QObject::connect(m_pFloatWidget, SIGNAL(stop()), this, SLOT(slotStop())); + QObject::connect(m_pFloatWidget, SIGNAL(micphone()), this, SLOT(slotMicphone())); + QObject::connect(m_pFloatWidget, SIGNAL(snapshot()), this, SLOT(slotSnapshot())); + QObject::connect(m_pFloatWidget, SIGNAL(record()), this, SLOT(slotRecord())); + QObject::connect(m_pFloatWidget, SIGNAL(volume()), this, SLOT(slotVolume())); + QObject::connect(m_pFloatWidget, SIGNAL(volumeChanged(int)), this, SLOT(slotVolumeChanged(int))); + + QObject::connect(m_pFloatWidget, SIGNAL(widgetSelecting()), this, SLOT(slotWidgetSelecting())); + QObject::connect(m_pFloatWidget, SIGNAL(doubleClicked()), this, SLOT(slotFullscreen())); + QObject::connect(m_pFloatWidget, SIGNAL(contextMenu(QPoint)), this, SLOT(slotContextMenu(QPoint))); + QObject::connect(m_pFloatWidget, SIGNAL(progressChanged(int)), this, SLOT(slotProgressChanged(int))); + } + + QRect rect = ui.widgetVideo->geometry(); + QPoint pt = mapToGlobal(rect.topLeft()); + + m_pFloatWidget->setGeometry(pt.x(), pt.y(), ui.widgetVideo->width(), ui.widgetVideo->height()); + + if (m_pPlayer) + { + m_pFloatWidget->setDuration(m_pPlayer->getDuration()); + } + + if (m_url.isEmpty()) + { + m_pFloatWidget->showMicphone(0); + m_pFloatWidget->showPause(1); + m_pFloatWidget->showRecord(1); + } + else if (m_bRtsp || isRtspUrl(m_url)) + { +#ifdef BACKCHANNEL + m_pFloatWidget->showMicphone(1); +#else + m_pFloatWidget->showMicphone(0); +#endif + m_pFloatWidget->showPause(1); + m_pFloatWidget->showRecord(1); + } + else + { + m_pFloatWidget->showMicphone(0); + + if (isRtmpUrl(m_url) || isHttpUrl(m_url)) + { + m_pFloatWidget->showPause(1); + m_pFloatWidget->showRecord(1); + } + else if (isSrtUrl(m_url)) + { + m_pFloatWidget->showPause(0); + m_pFloatWidget->showRecord(1); + } + else + { + m_pFloatWidget->showPause(1); + m_pFloatWidget->showRecord(1); + } + } + + m_pFloatWidget->showProgress(1); + m_pFloatWidget->show(); + } + else if (m_pFloatWidget) + { + QRect rect = m_pFloatWidget->geometry(); + + if (!rect.contains(QCursor::pos())) + { + m_pFloatWidget->hide(); + } + } +} + +void VideoWidget::slotPlayerNotify(int event) +{ + QString tips; + + if (event == RTSP_EVE_CONNECTING || + event == RTMP_EVE_CONNECTING || + event == HTTP_FLV_EVE_CONNECTING || + event == MJPEG_EVE_CONNECTING || + event == SRT_EVE_CONNECTING || + event == FILE_EVE_CONNECTING) + { + tips = tr("Connecting"); + } + else if (event == RTSP_EVE_CONNFAIL || + event == RTMP_EVE_CONNFAIL || + event == HTTP_FLV_EVE_CONNFAIL || + event == MJPEG_EVE_CONNFAIL || + event == SRT_EVE_CONNFAIL || + event == FILE_EVE_CONNFAIL) + { + tips = tr("Connect failed"); + + m_timerReconn.start(5 * 1000); + } + else if (event == RTSP_EVE_CONNSUCC || + event == MJPEG_EVE_CONNSUCC || + event == FILE_EVE_CONNSUCC) + { +#ifdef IOS + tips = m_url; +#else + tips = ""; +#endif + + setVolume(); + + // Re-record after reconnect + if (m_bRecording) + { + startRecord(); + } + } + else if (event == RTMP_EVE_VIDEOREADY || + event == HTTP_FLV_EVE_VIDEOREADY || + event == SRT_EVE_VIDEOREADY) + { +#ifdef IOS + tips = m_url; +#else + tips = ""; +#endif + + // Re-record after reconnect + if (m_bRecording) + { + startRecord(); + } + } + else if (event == RTMP_EVE_AUDIOREADY || + event == HTTP_FLV_EVE_AUDIOREADY || + event == SRT_EVE_AUDIOREADY) + { +#ifdef IOS + tips = m_url; +#else + tips = ""; +#endif + + setVolume(); + } + else if (event == RTSP_EVE_NOSIGNAL || + event == RTMP_EVE_NOSIGNAL || + event == HTTP_FLV_EVE_NOSIGNAL || + event == MJPEG_EVE_NOSIGNAL || + event == SRT_EVE_NOSIGNAL || + event == FILE_EVE_NOSIGNAL) + { + tips = tr("NO Signal"); + + m_timerReconn.start(5 * 1000); + } + else if (event == RTSP_EVE_NODATA || + event == RTMP_EVE_NODATA || + event == HTTP_FLV_EVE_NODATA || + event == MJPEG_EVE_NODATA || + event == SRT_EVE_NODATA || + event == FILE_EVE_NODATA) + { + tips = tr("NO Data"); + + m_timerReconn.start(5 * 1000); + } + else if (event == RTSP_EVE_RESUME || + event == RTMP_EVE_RESUME || + event == HTTP_FLV_EVE_RESUME || + event == MJPEG_EVE_RESUME || + event == SRT_EVE_RESUME || + event == FILE_EVE_RESUME) + { +#ifdef IOS + tips = m_url; +#else + tips = ""; +#endif + + m_timerReconn.stop(); + } + else if (event == RTSP_EVE_STOPPED || + event == RTMP_EVE_STOPPED || + event == HTTP_FLV_EVE_STOPPED || + event == MJPEG_EVE_STOPPED || + event == SRT_EVE_STOPPED || + event == FILE_EVE_STOPPED) + { + m_timerReconn.start(5 * 1000); + + return; + } + else if (event == RTSP_EVE_AUTHFAILED || + event == RTMP_EVE_AUTHFAILED || + event == HTTP_FLV_EVE_AUTHFAILED || + event == MJPEG_EVE_AUTHFAILED || + event == SRT_EVE_AUTHFAILED || + event == FILE_EVE_AUTHFAILED) + { + tips = tr("Authenticate failed"); + } + + ui.widgetVideo->setTips(tips); +} + +void VideoWidget::slotReconn() +{ + closePlayer(); + + makeCall(); +} + +void VideoWidget::slotPlay() +{ + OpenMedia dlg(m_url, m_acct, m_pass, NULL, Qt::WindowCloseButtonHint); + + if (QDialog::Accepted == dlg.exec()) + { + setMediaInfo(dlg.getUrl(), dlg.getUser(), dlg.getPass()); + } +} + +void VideoWidget::slotPause() +{ + if (m_pPlayer) + { + if (m_pPlayer->pause()) + { + m_pFloatWidget->ui.btnPause->setIcon(QIcon(QString::fromUtf8(":/res/Resources/btn_play.png"))); + m_pFloatWidget->ui.btnPause->setToolTip(tr("Play")); + } + else + { + m_pFloatWidget->ui.btnPause->setIcon(QIcon(QString::fromUtf8(":/res/Resources/btn_pause.png"))); + m_pFloatWidget->ui.btnPause->setToolTip(tr("Pause")); + } + } +} + +void VideoWidget::slotStop() +{ + closeVideo(); +} + +void VideoWidget::slotMicphone() +{ +#ifdef BACKCHANNEL + if (NULL == m_pPlayer) + { + return; + } + + closePlayer(); + + ui.widgetVideo->setTips(""); + + if (m_nBackChannelFlag) + { + m_nBackChannelFlag = 0; + } + else + { + m_nBackChannelFlag = 1; + } + + makeCall(); + + if (m_pPlayer) + { + setMicphone(!m_pPlayer->getBCDataFlag()); + } +#endif +} + +void VideoWidget::slotVolume() +{ + if (NULL == m_pPlayer || NULL == m_pFloatWidget) + { + return; + } + + if (m_pFloatWidget->ui.btnVolume->property("mute").toBool()) + { + m_pFloatWidget->ui.btnVolume->setProperty("mute", false); + m_pFloatWidget->ui.btnVolume->setIcon(QIcon(QString::fromUtf8(":/res/Resources/volume.png"))); + + m_pPlayer->setVolume(m_pFloatWidget->ui.sliderVolume->value()); + } + else + { + m_pFloatWidget->ui.btnVolume->setProperty("mute", true); + m_pFloatWidget->ui.btnVolume->setIcon(QIcon(QString::fromUtf8(":/res/Resources/mute.png"))); + + m_pPlayer->setVolume(0); + } +} + +void VideoWidget::slotVolumeChanged(int action) +{ + int pos = m_pFloatWidget->ui.sliderVolume->sliderPosition(); + + // not mute + if (!m_pFloatWidget->ui.btnVolume->property("mute").toBool()) + { + if (m_pPlayer) + { + m_pPlayer->setVolume(pos); + } + } +} + +void VideoWidget::slotProgressChanged(int action) +{ + int pos = m_pFloatWidget->ui.sliderProgress->sliderPosition(); + + if (m_pPlayer) + { + m_pPlayer->seek(pos); + } +} + +void VideoWidget::slotSnapshot() +{ + if (m_pPlayer) + { + m_pPlayer->snapshot(VIDEO_FMT_RGB24); + } +} + +void VideoWidget::slotSnapshoted(AVFrame * frame) +{ + QImage image = QImage(frame->data[0], frame->width, frame->height, frame->linesize[0], QImage::Format_RGB888); + QString path = getSnapshotPath(); + QString file = getTempFile(m_base, ".jpg"); + + if (!image.save(path + "/" + file, "JPG")) + { + QMessageBox::information(NULL, tr("Tips"), tr("Write file failed to check the file path, save path:\n") + path); + } + else + { + QMessageBox::information(NULL, tr("Tips"), tr("Snapshot successful. save path:\n") + path); + } +} + +void VideoWidget::slotRecord() +{ + if (NULL == m_pPlayer) + { + return; + } + + if (m_pPlayer->isRecording()) + { + stopRecord(); + } + else + { + startRecord(); + } + + m_bRecording = m_pPlayer->isRecording(); +} + +void VideoWidget::startRecord() +{ + if (NULL == m_pPlayer) + { + return; + } + + if (m_pPlayer->isRecording()) + { + return; + } + + if (m_pPlayer->record(m_base)) + { + if (m_pFloatWidget) + { + QIcon icon; + icon.addFile(QString::fromUtf8(":/res/Resources/stop_record.png")); + m_pFloatWidget->ui.btnRecord->setIcon(icon); + m_pFloatWidget->ui.btnRecord->setToolTip(tr("Stop video record")); + } + } +} + +void VideoWidget::stopRecord() +{ + if (NULL == m_pPlayer) + { + return; + } + + if (m_pPlayer->isRecording()) + { + m_pPlayer->stopRecord(); + + if (m_pFloatWidget) + { + QIcon icon; + icon.addFile(QString::fromUtf8(":/res/Resources/video_record.png")); + m_pFloatWidget->ui.btnRecord->setIcon(icon); + m_pFloatWidget->ui.btnRecord->setToolTip(tr("Video record")); + } + } +} + +void VideoWidget::setMicphone(int flag) +{ +#ifdef BACKCHANNEL + if (m_pPlayer) + { + m_pPlayer->setBCDataFlag(flag); + } + + if (m_pFloatWidget) + { + if (flag) + { + m_pFloatWidget->ui.btnMic->setToolTip(tr("Stop micphone")); + m_pFloatWidget->ui.btnMic->setIcon(QIcon(QString::fromUtf8(":/res/Resources/stopmic.png"))); + } + else + { + m_pFloatWidget->ui.btnMic->setToolTip(tr("Micphone")); + m_pFloatWidget->ui.btnMic->setIcon(QIcon(QString::fromUtf8(":/res/Resources/mic.png"))); + } + } +#endif +} + +void VideoWidget::slotSizeChanged(QSize size) +{ + if (m_pPlayer) + { + m_pPlayer->setWindowSize(size); + } +} + +void VideoWidget::slotContextMenu(QPoint pt) +{ + if (m_url.isEmpty()) + { + return; + } + + QMenu * popMenu = new QMenu(); + + popMenu->addAction(m_actionCloseVideo); + + if (m_nRenderMode == RENDER_MODE_KEEP) + { + popMenu->addAction(m_actionFillWhole); + } + else + { + popMenu->addAction(m_actionKeepAspectRatio); + } + + if (m_bFullScreen) + { + popMenu->addAction(m_actionResumeNormal); + } + else if (canMaximized()) + { + popMenu->addAction(m_actionFullScreen); + } + + popMenu->addAction(m_actionMediaInfo); + + popMenu->exec(pt); + + delete popMenu; +} + +void VideoWidget::slotFloatWidget() +{ + if (NULL == m_pFloatWidget) + { + return; + } + + QRect rect = m_pFloatWidget->geometry(); + + if (!rect.contains(QCursor::pos())) + { + m_pFloatWidget->hide(); + } +} + +void VideoWidget::slotProgress() +{ + if (m_pPlayer && m_pPlayer->isPlaying() && m_pFloatWidget) + { + int64 elapse = m_pPlayer->getElapse(); + int64 duration = m_pPlayer->getDuration(); + int progress = 0; + + if (duration != 0) + { + progress = elapse * 100 / duration; + } + + m_pFloatWidget->ui.sliderProgress->setValue(progress); + m_pFloatWidget->setElapse(elapse); + } +} + +bool VideoWidget::event(QEvent * event) +{ + QEvent::Type tp = event->type(); + + switch (event->type()) + { + case QEvent::Enter: + showFloatWidget(true); + break; + + case QEvent::Leave: + case QEvent::Hide: + showFloatWidget(false); + break; + + case QEvent::Show: + //showFloatWidget(true); + break; + + default: + break; + } + + return QWidget::event(event); +} + +QString VideoWidget::getBaseName(QString &url) +{ + if (isUrl(url)) + { + char host[100] = {'\0'}; + + url_split(url.toStdString().c_str(), NULL, 0, NULL, 0, NULL, 0, host, sizeof(host), NULL, NULL, 0); + + return QString(host); + } + else + { + QFileInfo fileInfo(url); + + return fileInfo.baseName(); + } +} + + + diff --git a/MediaClient/MediaClient/formClass/VideoWidget.h b/MediaClient/MediaClient/formClass/VideoWidget.h new file mode 100644 index 0000000..966f41f --- /dev/null +++ b/MediaClient/MediaClient/formClass/VideoWidget.h @@ -0,0 +1,139 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef _VIDEO_WIDGET_H_ +#define _VIDEO_WIDGET_H_ + +#include +#include "ui_VideoWidget.h" +#include "FloatWidget.h" +#include "video_player.h" +#include + + +/******************************************************************/ +class VideoWidget : public QWidget +{ + Q_OBJECT + +public: + VideoWidget(QWidget *parent = 0, Qt::WindowFlags flags = Qt::Widget); + ~VideoWidget(); + + bool isSelected() {return m_bSelected;} + void setSelected(bool flag); + + QString getUrl() { return m_url; } + QString getAcct() { return m_acct; } + QString getPass() { return m_pass; } + + void setMediaInfo(QString url, QString acct, QString pass, int bcflag = 0); + void setRenderMode(int mode); + +public slots: + void slotCloseVideo(); + void slotResumeNormal(); + void slotFillWhole(); + void slotKeepAspectRatio(); + void slotMediaInfo(); + void slotWidgetSelecting(); + void slotFullscreen(); + void slotDragDroped(QString url); + void slotPlayerNotify(int event); + void slotReconn(); + void slotFloatWidget(); + void slotProgress(); + void slotPlay(); + void slotPause(); + void slotStop(); + void slotMicphone(); + void slotSnapshot(); + void slotRecord(); + void slotVolume(); + void slotVolumeChanged(int); + void slotProgressChanged(int action); + void slotContextMenu(QPoint); + void slotSnapshoted(AVFrame * frame); + void slotSizeChanged(QSize); + +signals: + void widgetSelecting(QWidget *); + +protected: + void paintEvent(QPaintEvent * event); + void resizeEvent(QResizeEvent * event); + void keyPressEvent(QKeyEvent * event); + void mousePressEvent(QMouseEvent * event); + bool event(QEvent * event); + + void fullScreen(); + void resumeWidget(); + void closePlayer(); + void closeVideo(); + void makeCall(); + void setVolume(); + void showFloatWidget(bool show); + +private: + void initVideoWidget(); + void initActions(); + bool canMaximized(); + void showParent(bool show); + void startRecord(); + void stopRecord(); + void setMicphone(int flag); + QString getBaseName(QString &url); + +private: + Ui::VideoWidget ui; + bool m_bSelected; + bool m_bFullScreen; + bool m_bRecording; + bool m_bRtsp; + QWidget * m_pParent; + QRect m_rect; + + QString m_url; + QString m_acct; + QString m_pass; + QString m_base; + + CVideoPlayer * m_pPlayer; + FloatWidget * m_pFloatWidget; + int m_nRenderMode; + + QTimer m_timerReconn; + QTimer m_timerFloatWidget; + QTimer m_timerProgress; + + QAction * m_actionCloseVideo; + QAction * m_actionFullScreen; + QAction * m_actionResumeNormal; + QAction * m_actionFillWhole; + QAction * m_actionKeepAspectRatio; + QAction * m_actionMediaInfo; + +#ifdef BACKCHANNEL + int m_nBackChannelFlag; +#endif +}; + +#endif + + diff --git a/MediaClient/MediaClient/formClass/WidgetManager.cpp b/MediaClient/MediaClient/formClass/WidgetManager.cpp new file mode 100644 index 0000000..2d8883c --- /dev/null +++ b/MediaClient/MediaClient/formClass/WidgetManager.cpp @@ -0,0 +1,434 @@ +/*************************************************************************************** + * + * 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 "utils.h" +#include "WidgetManager.h" +#include +#include + + +WidgetManager::WidgetManager(QWidget *parent, Qt::WindowFlags flags) +: QWidget(parent, flags) +{ + initWidgetManager(); + + setAutoFillBackground(false); +} + + +WidgetManager::~WidgetManager() +{ +} + + +void WidgetManager::initWidgetManager() +{ + setLayoutMode(LAYOUT_MODE_4); +} + + +void WidgetManager::paintEvent(QPaintEvent * event) +{ + QPainter painter(this); +} + +void WidgetManager::resizeEvent(QResizeEvent * event) +{ + resizeVideoWidgets(event->size().width(), event->size().height()); +} + +void WidgetManager::closeEvent(QCloseEvent *event) +{ + QWidget::closeEvent(event); +} + +void WidgetManager::resizeVideoWidgets(int w, int h) +{ + QRect rect; + + for (int i = 0; i < m_WidgetLayout.zones.size(); ++i) + { + WidgetZone & widgetZone = m_WidgetLayout.zones[i]; + + rect = getZoneRect(w, h, widgetZone.zone); + + widgetZone.widget->setGeometry(rect); + } +} + +void WidgetManager::setLayoutMode(int layoutMode) +{ + LayoutZoneList zones; + + switch (layoutMode) + { + case LAYOUT_MODE_1: + addZone(zones, 0, 0, 0, 0); + + setLayout(1, 1, zones); + break; + + case LAYOUT_MODE_4: + addZone(zones, 0, 0, 0, 0); + addZone(zones, 1, 1, 0, 0); + addZone(zones, 0, 0, 1, 1); + addZone(zones, 1, 1, 1, 1); + + setLayout(2, 2, zones); + break; + + case LAYOUT_MODE_6: + addZone(zones, 0, 1, 0, 1); + addZone(zones, 2, 2, 0, 0); + addZone(zones, 2, 2, 1, 1); + addZone(zones, 0, 0, 2, 2); + addZone(zones, 1, 1, 2, 2); + addZone(zones, 2, 2, 2, 2); + + setLayout(3, 3, zones); + break; + + case LAYOUT_MODE_8: + addZone(zones, 0, 2, 0, 2); + addZone(zones, 3, 3, 0, 0); + addZone(zones, 3, 3, 1, 1); + addZone(zones, 3, 3, 2, 2); + addZone(zones, 0, 0, 3, 3); + addZone(zones, 1, 1, 3, 3); + addZone(zones, 2, 2, 3, 3); + addZone(zones, 3, 3, 3, 3); + + setLayout(4, 4, zones); + break; + + case LAYOUT_MODE_9: + addZone(zones, 0, 0, 0, 0); + addZone(zones, 1, 1, 0, 0); + addZone(zones, 2, 2, 0, 0); + addZone(zones, 0, 0, 1, 1); + addZone(zones, 1, 1, 1, 1); + addZone(zones, 2, 2, 1, 1); + addZone(zones, 0, 0, 2, 2); + addZone(zones, 1, 1, 2, 2); + addZone(zones, 2, 2, 2, 2); + + setLayout(3, 3, zones); + break; + + case LAYOUT_MODE_16: + addZone(zones, 0, 0, 0, 0); + addZone(zones, 1, 1, 0, 0); + addZone(zones, 2, 2, 0, 0); + addZone(zones, 3, 3, 0, 0); + addZone(zones, 0, 0, 1, 1); + addZone(zones, 1, 1, 1, 1); + addZone(zones, 2, 2, 1, 1); + addZone(zones, 3, 3, 1, 1); + addZone(zones, 0, 0, 2, 2); + addZone(zones, 1, 1, 2, 2); + addZone(zones, 2, 2, 2, 2); + addZone(zones, 3, 3, 2, 2); + addZone(zones, 0, 0, 3, 3); + addZone(zones, 1, 1, 3, 3); + addZone(zones, 2, 2, 3, 3); + addZone(zones, 3, 3, 3, 3); + + setLayout(4, 4, zones); + break; + + case LAYOUT_MODE_25: + addZone(zones, 0, 0, 0, 0); + addZone(zones, 1, 1, 0, 0); + addZone(zones, 2, 2, 0, 0); + addZone(zones, 3, 3, 0, 0); + addZone(zones, 4, 4, 0, 0); + addZone(zones, 0, 0, 1, 1); + addZone(zones, 1, 1, 1, 1); + addZone(zones, 2, 2, 1, 1); + addZone(zones, 3, 3, 1, 1); + addZone(zones, 4, 4, 1, 1); + addZone(zones, 0, 0, 2, 2); + addZone(zones, 1, 1, 2, 2); + addZone(zones, 2, 2, 2, 2); + addZone(zones, 3, 3, 2, 2); + addZone(zones, 4, 4, 2, 2); + addZone(zones, 0, 0, 3, 3); + addZone(zones, 1, 1, 3, 3); + addZone(zones, 2, 2, 3, 3); + addZone(zones, 3, 3, 3, 3); + addZone(zones, 4, 4, 3, 3); + addZone(zones, 0, 0, 4, 4); + addZone(zones, 1, 1, 4, 4); + addZone(zones, 2, 2, 4, 4); + addZone(zones, 3, 3, 4, 4); + addZone(zones, 4, 4, 4, 4); + + setLayout(5, 5, zones); + break; + } +} + + +void WidgetManager::addZone(LayoutZoneList & zones, int l, int r, int t, int b) +{ + LayoutZone zone; + + zone.left = l; + zone.right = r; + zone.top = t; + zone.bottom = b; + + zones.push_back(zone); +} + + +void WidgetManager::setLayout(int rows, int cols, LayoutZoneList & zones, bool syncFlag) +{ + m_WidgetLayout.rows = rows; + m_WidgetLayout.cols = cols; + + int i, j, index = 0; + WidgetZone widgetZone; + VideoWidget * widget = 0; + + for (i = 0; i < m_WidgetLayout.zones.size(); ++i) + { + widgetZone = m_WidgetLayout.zones[i]; + + if (widgetZone.widget->getUrl().isEmpty()) + { + delete widgetZone.widget; + } + else + { + widgetZone.widget->hide(); + m_VideoWidgets.insert(index++, widgetZone.widget); + } + } + + m_WidgetLayout.zones.clear(); + + for (i = 0; i < zones.size(); ++i) + { + widget = NULL; + + widgetZone.zone.left = zones[i].left; + widgetZone.zone.right = zones[i].right; + widgetZone.zone.top = zones[i].top; + widgetZone.zone.bottom = zones[i].bottom; + widgetZone.zone.url = zones[i].url; + widgetZone.zone.acct = zones[i].acct; + widgetZone.zone.pass = zones[i].pass; + + if (!zones[i].url.isEmpty()) + { + for (j = 0; j < m_VideoWidgets.size(); ++j) + { + if (m_VideoWidgets[j]->getUrl() == zones[i].url) + { + widget = m_VideoWidgets.takeAt(j); + break; + } + } + } + + if (!syncFlag && !widget && !m_VideoWidgets.isEmpty()) + { + widget = m_VideoWidgets.takeAt(0); + } + + initVideoWidget(widget, widgetZone); + + m_WidgetLayout.zones.push_back(widgetZone); + } + + if (syncFlag) + { + for (i = 0; i < m_VideoWidgets.size(); ++i) + { + widget = m_VideoWidgets[i]; + delete widget; + } + + m_VideoWidgets.clear(); + } + + update(); +} + +void WidgetManager::getLayout(int & rows, int & cols, LayoutZoneList & zones) +{ + rows = m_WidgetLayout.rows; + cols = m_WidgetLayout.cols; + + zones.clear(); + + for (int i = 0; i < m_WidgetLayout.zones.size(); i++) + { + if (m_WidgetLayout.zones[i].widget) + { + m_WidgetLayout.zones[i].zone.url = m_WidgetLayout.zones[i].widget->getUrl(); + m_WidgetLayout.zones[i].zone.acct = m_WidgetLayout.zones[i].widget->getAcct(); + m_WidgetLayout.zones[i].zone.pass = m_WidgetLayout.zones[i].widget->getPass(); + } + else + { + m_WidgetLayout.zones[i].zone.url = QString(); + m_WidgetLayout.zones[i].zone.acct = QString(); + m_WidgetLayout.zones[i].zone.pass = QString(); + } + + zones.push_back(m_WidgetLayout.zones[i].zone); + } +} + +void WidgetManager::initVideoWidget(VideoWidget * widget, WidgetZone & widgetZone) +{ + if (widget) + { + widgetZone.widget = widget; + } + else + { + widgetZone.widget = new VideoWidget(this); + + widgetZone.widget->setRenderMode(getVideoRenderMode()); + widgetZone.widget->setMediaInfo(widgetZone.zone.url, + widgetZone.zone.acct, widgetZone.zone.pass); + + connect(widgetZone.widget, SIGNAL(widgetSelecting(QWidget*)), this, SLOT(slotWidgetSelecting(QWidget*))); + } + + setVideoWidgetRect(widgetZone); + + widgetZone.widget->show(); +} + +void WidgetManager::setVideoWidgetRect(WidgetZone & widgetZone) +{ + QRect rect = getZoneRect(width(), height(), widgetZone.zone); + + widgetZone.widget->setGeometry(rect); +} + + +QRect WidgetManager::getZoneRect(int w, int h, LayoutZone & zone) +{ + return getGridRect(w, h, zone.left, zone.right, zone.top, zone.bottom); +} + +QRect WidgetManager::getGridRect(int w, int h, int left, int right, int top, int bottom) +{ + float gridWidth = w / (float) m_WidgetLayout.cols; + float gridHeight = h / (float) m_WidgetLayout.rows; + + int x1 = left * gridWidth; + int y1 = top * gridHeight; + + int x2 = (right + 1) * gridWidth; + int y2 = (bottom + 1) * gridHeight; + + return QRect(x1, y1, x2 - x1, y2 - y1); +} + +VideoWidget * WidgetManager::getSelectedWidget() +{ + VideoWidget * pSelectedWidget = NULL; + + for (int i = 0; i < m_WidgetLayout.zones.size(); ++i) + { + WidgetZone & widgetZone = m_WidgetLayout.zones[i]; + + if (widgetZone.widget->isSelected()) + { + pSelectedWidget = widgetZone.widget; + break; + } + } + + return pSelectedWidget; +} + +VideoWidget * WidgetManager::getIdleWidget() +{ + VideoWidget * pIdleWidget = NULL; + + for (int i = 0; i < m_WidgetLayout.zones.size(); ++i) + { + WidgetZone & widgetZone = m_WidgetLayout.zones[i]; + + if (widgetZone.widget->getUrl().isEmpty()) + { + pIdleWidget = widgetZone.widget; + break; + } + } + + return pIdleWidget; +} + +VideoWidget * WidgetManager::getWidget(int index) +{ + if (index < 0 || index >= m_WidgetLayout.zones.size()) + { + return NULL; + } + + return m_WidgetLayout.zones[index].widget; +} + +int WidgetManager::getWidgetNums() +{ + return m_WidgetLayout.zones.size(); +} + +void WidgetManager::slotWidgetSelecting(QWidget * pWidget) +{ + VideoWidget * pSelectedWidget = getSelectedWidget(); + if (pSelectedWidget != pWidget) + { + if (pSelectedWidget) + { + pSelectedWidget->setSelected(false); + } + + pSelectedWidget = (VideoWidget *) pWidget; + pSelectedWidget->setSelected(true); + } +} + +void WidgetManager::closeAll() +{ + for (int i = 0; i < m_WidgetLayout.zones.size(); ++i) + { + WidgetZone & widgetZone = m_WidgetLayout.zones[i]; + + if (!widgetZone.widget->getUrl().isEmpty()) + { + widgetZone.widget->slotCloseVideo(); + } + } +} + + + + + + diff --git a/MediaClient/MediaClient/formClass/WidgetManager.h b/MediaClient/MediaClient/formClass/WidgetManager.h new file mode 100644 index 0000000..84670bb --- /dev/null +++ b/MediaClient/MediaClient/formClass/WidgetManager.h @@ -0,0 +1,91 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef _VIDEO_WIDGET_MANAGER_H_ +#define _VIDEO_WIDGET_MANAGER_H_ + + +#include +#include "VideoWidget.h" +#include "Layout.h" + + +typedef struct +{ + LayoutZone zone; + VideoWidget * widget; +} WidgetZone; + +typedef QList WidgetZoneList; + +typedef struct +{ + int rows; + int cols; + WidgetZoneList zones; +} WidgetLayout; + + +typedef QList VideoWidgetList; + + +class WidgetManager : public QWidget +{ + Q_OBJECT + +public: + WidgetManager(QWidget *parent = 0, Qt::WindowFlags flags = Qt::Widget); + ~WidgetManager(); + + void setLayoutMode(int layoutMode); + void setLayout(int rows, int cols, LayoutZoneList & zones, bool syncFlag = false); + void getLayout(int & rows, int & cols, LayoutZoneList & zones); + int getWidgetNums(); + void closeAll(); + + VideoWidget * getSelectedWidget(); + VideoWidget * getIdleWidget(); + VideoWidget * getWidget(int index); + +public slots: + void slotWidgetSelecting(QWidget * pWidget); + +protected: + void paintEvent(QPaintEvent * event); + void resizeEvent(QResizeEvent * event); + void closeEvent(QCloseEvent *event); + +private: + void drawGrid(QPainter & painter, int rows, int cols); + void initWidgetManager(); + void addZone(LayoutZoneList & zones, int l, int r, int t, int b); + QRect getGridRect(int w, int h, int left, int right, int top, int bottom); + QRect getZoneRect(int w, int h, LayoutZone & zone); + void setVideoWidgetRect(WidgetZone & widgetZone); + void resizeVideoWidgets(int w, int h); + void initVideoWidget(VideoWidget * widget, WidgetZone & widgetZone); + +private: + WidgetLayout m_WidgetLayout; + VideoWidgetList m_VideoWidgets; +}; + +#endif + + diff --git a/MediaClient/MediaClient/formClass/ZoneConfig.cpp b/MediaClient/MediaClient/formClass/ZoneConfig.cpp new file mode 100644 index 0000000..e7a91ec --- /dev/null +++ b/MediaClient/MediaClient/formClass/ZoneConfig.cpp @@ -0,0 +1,617 @@ +/*************************************************************************************** + * + * 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 "ZoneConfig.h" +#include +#include +#include +#include +#include + + +#define GRID_LINE_WIDTH 1 +#define ZONE_COLOR QColor(0, 0, 32) +#define GRID_LINE_COLOR QColor(64, 64, 64) + + +ZoneConfig::ZoneConfig(QWidget *parent) +: QWidget(parent) +, m_gridRows(DEF_GRID_ROWS) +, m_gridCols(DEF_GRID_COLS) +, m_mouseMoving(false) +{ + initZoneConfig(); + + initActions(); +} + + +ZoneConfig::~ZoneConfig() +{ +} + + +void ZoneConfig::initZoneConfig() +{ + setMouseTracking(true); + setAcceptDrops(true); + + setContextMenuPolicy(Qt::DefaultContextMenu); + + initGridFlag(); +} + + +void ZoneConfig::initGridFlag() +{ + for (int i = 0; i < m_gridCols; i++) + { + for (int j = 0; j < m_gridRows; j++) + { + m_gridFlag[i][j] = false; + } + } +} + +void ZoneConfig::initActions() +{ + m_actionDelZone = new QAction(this); + m_actionDelZone->setText(QString::fromLocal8Bit("Del Zone")); + + m_actionClearZone = new QAction(this); + m_actionClearZone->setText(QString::fromLocal8Bit("Clear Zones")); + + connect(m_actionDelZone, SIGNAL(triggered()), this, SLOT(slotDelZone())); + connect(m_actionClearZone, SIGNAL(triggered()), this, SLOT(slotClearZone())); +} + + +void ZoneConfig::paintEvent(QPaintEvent * event) +{ + QPainter painter(this); + + painter.fillRect(rect(), Qt::SolidPattern); + + // draw grid + drawGrid(painter, m_gridRows, m_gridCols); + + drawZone(painter); + + if (m_mouseMoving) + { + drawDragingZone(painter); + } +} + + +void ZoneConfig::drawGrid(QPainter & painter, int rows, int cols) +{ + int x, y, x1, y1, i; + int w = width(); + int h = height(); + + float gridWidth = width() / (float) cols; + float gridHeight = height() / (float) rows; + + painter.setPen(QPen(GRID_LINE_COLOR, GRID_LINE_WIDTH, Qt::DotLine)); + + for (i = 0; i < cols; i++) + { + x = x1 = i * gridWidth; + y = 0; + y1 = h; + + painter.drawLine(x, y, x1, y1); + } + + painter.drawLine(w-1, 0, w-1, h); + + for (i = 0; i < rows; i++) + { + x = 0; + y = y1 = i * gridHeight; + x1 = w; + + painter.drawLine(x, y, x1, y1); + } + + painter.drawLine(0, h-1, w, h-1); +} + + +void ZoneConfig::dragEnterEvent(QDragEnterEvent *event) +{ + if (event->mimeData()->hasFormat("text/plain")) + { + event->acceptProposedAction(); + } +} + +void ZoneConfig::dropEvent(QDropEvent *event) +{ + event->acceptProposedAction(); + + LayoutZone * zone = getZone(event->pos()); + if (zone) + { + QString mimeData = event->mimeData()->data("text/plain"); + + zone->url = mimeData; + + update(); + } +} + + +void ZoneConfig::contextMenuEvent(QContextMenuEvent * event) +{ + QMenu * pMenu = 0; + + if (getZone(event->pos())) + { + pMenu = new QMenu(this); + + pMenu->addAction(m_actionDelZone); + pMenu->addAction(m_actionClearZone); + } + else if (m_zones.size() > 0) + { + pMenu = new QMenu(this); + + pMenu->addAction(m_actionClearZone); + } + + m_ContextMenuPos = event->pos(); + + if (pMenu) + { + pMenu->exec(event->globalPos()); + delete pMenu; + } +} + + +void ZoneConfig::mouseMoveEvent(QMouseEvent * event) +{ + if (!(event->buttons() & Qt::LeftButton)) + { + return; + } + + if (m_pressPos.isNull() || !isValidPos(m_pressPos) || !isValidPos(event->pos())) + { + return; + } + + int left, right, top, bottom; + + getDragingGrids(m_pressPos, event->pos(), left, right, top, bottom); + + if (!isValidGridRect(left, right, top, bottom)) + { + return; + } + + m_curPos = event->pos(); + m_mouseMoving = true; + + update(); +} + + +void ZoneConfig::mousePressEvent(QMouseEvent * event) +{ + if (event->buttons() & Qt::LeftButton) + { + m_pressPos = event->pos(); + } + else + { + m_pressPos.setX(0); + m_pressPos.setY(0); + } +} + +void ZoneConfig::mouseReleaseEvent(QMouseEvent * event) +{ + if (m_mouseMoving) + { + addZone(); + m_mouseMoving = false; + } +} + +void ZoneConfig::getDragingGrids(QPoint pos1, QPoint pos2, int &left, int &right, int &top, int &bottom) +{ + float gridWidth = width() / (float) m_gridCols; + float gridHeight = height() / (float) m_gridRows; + + if (pos1.x() < pos2.x()) + { + left = pos1.x() / gridWidth; + right = pos2.x() / gridWidth; + } + else + { + left = pos2.x() / gridWidth; + right = pos1.x() / gridWidth; + } + + if (left < 0) + { + left = 0; + } + else if (left >= m_gridCols) + { + left = m_gridCols - 1; + } + + if (right < 0) + { + right = 0; + } + else if (right >= m_gridCols) + { + right = m_gridCols - 1; + } + + if (pos1.y() < pos2.y()) + { + top = pos1.y() / gridHeight; + bottom = pos2.y() / gridHeight; + } + else + { + top = pos2.y() / gridHeight; + bottom = pos1.y() / gridHeight; + } + + if (top < 0) + { + top = 0; + } + else if (top >= m_gridRows) + { + top = m_gridRows - 1; + } + + if (bottom < 0) + { + bottom = 0; + } + else if (bottom >= m_gridRows) + { + bottom = m_gridRows - 1; + } +} + + +QRect ZoneConfig::getGridRect(int left, int right, int top, int bottom) +{ + float gridWidth = width() / (float) m_gridCols; + float gridHeight = height() / (float) m_gridRows; + + int x1 = left * gridWidth + GRID_LINE_WIDTH; + int y1 = top * gridHeight + GRID_LINE_WIDTH; + + int x2 = (right + 1) * gridWidth - GRID_LINE_WIDTH; + int y2 = (bottom + 1) * gridHeight - GRID_LINE_WIDTH; + + return QRect(x1, y1, x2 - x1, y2 - y1); +} + + +void ZoneConfig::drawDragingZone(QPainter & painter) +{ + int left, right, top, bottom; + + getDragingGrids(m_pressPos, m_curPos, left, right, top, bottom); + + painter.fillRect(getGridRect(left, right, top, bottom), ZONE_COLOR); +} + +void ZoneConfig::setGridFlag(int left, int right, int top, int bottom, bool flag) +{ + for (int i = left; i <= right; i++) + { + for (int j = top; j <= bottom; j++) + { + m_gridFlag[i][j] = flag; + } + } +} + + +void ZoneConfig::addZone() +{ + LayoutZone zone; + + getDragingGrids(m_pressPos, m_curPos, zone.left, zone.right, zone.top, zone.bottom); + + setGridFlag(zone.left, zone.right, zone.top, zone.bottom, true); + + m_zones.push_back(zone); +} + + +void ZoneConfig::drawZone(QPainter & painter) +{ + QRect rect; + + for (int i = 0; i < m_zones.size(); i++) + { + const LayoutZone & zone = m_zones.at(i); + + rect = getGridRect(zone.left, zone.right, zone.top, zone.bottom); + + painter.fillRect(rect, ZONE_COLOR); + + if (!zone.url.isEmpty()) + { + painter.drawText(rect, Qt::AlignCenter, zone.url); + } + } +} + + +bool ZoneConfig::isValidPos(QPoint pos) +{ + QRect rect; + + for (int i = 0; i < m_zones.size(); i++) + { + const LayoutZone & zone = m_zones.at(i); + + rect = getGridRect(zone.left, zone.right, zone.top, zone.bottom); + + if (rect.adjusted(-GRID_LINE_WIDTH, -GRID_LINE_WIDTH, GRID_LINE_WIDTH, GRID_LINE_WIDTH).contains(pos)) + { + return false; + } + } + + return true; +} + +bool ZoneConfig::isValidGridRect(int left, int right, int top, int bottom) +{ + for (int i = left; i <= right; i++) + { + for (int j = top; j <= bottom; j++) + { + if (m_gridFlag[i][j]) + { + return false; + } + } + } + + return true; +} + +void ZoneConfig::delZone(LayoutZone * zone) +{ + setGridFlag(zone->left, zone->right, zone->top, zone->bottom, false); + + for (int i = 0; i < m_zones.size(); i++) + { + LayoutZone & layoutZone = m_zones[i]; + + if (zone == &layoutZone) + { + m_zones.removeAt(i); + break; + } + } +} + +void ZoneConfig::slotDelZone() +{ + LayoutZone * zone = getZone(m_ContextMenuPos); + if (zone) + { + delZone(zone); + + update(); + } +} + +void ZoneConfig::slotClearZone() +{ + m_zones.clear(); + + initGridFlag(); + + update(); +} + + +LayoutZone * ZoneConfig::getZone(QPoint pos) +{ + QRect rect; + + for (int i = 0; i < m_zones.size(); i++) + { + LayoutZone & zone = m_zones[i]; + + rect = getGridRect(zone.left, zone.right, zone.top, zone.bottom); + if (rect.adjusted(-GRID_LINE_WIDTH, -GRID_LINE_WIDTH, GRID_LINE_WIDTH, GRID_LINE_WIDTH).contains(pos)) + { + return &zone; + } + } + + return 0; +} + +ZoneList ZoneConfig::getZoneList() +{ + return m_zones; +} + +void ZoneConfig::setZoneList(ZoneList & zones) +{ + m_zones = zones; + + initGridFlag(); + + for (int i = 0; i < m_zones.size(); i++) + { + setGridFlag(m_zones[i].left, m_zones[i].right, m_zones[i].top, m_zones[i].bottom, true); + } + + update(); +} + + +void ZoneConfig::addZone(ZoneList & zones, int l, int r, int t, int b) +{ + LayoutZone zone; + + zone.left = l; + zone.right = r; + zone.top = t; + zone.bottom = b; + + zones.push_back(zone); +} + +void ZoneConfig::setLayoutMode(int layoutMode) +{ + ZoneList zones; + + switch (layoutMode) + { + case LAYOUT_MODE_1: + setGridSize(1, 1); + + addZone(zones, 0, 0, 0, 0); + + setZoneList(zones); + break; + + case LAYOUT_MODE_4: + setGridSize(2, 2); + + addZone(zones, 0, 0, 0, 0); + addZone(zones, 1, 1, 0, 0); + addZone(zones, 0, 0, 1, 1); + addZone(zones, 1, 1, 1, 1); + + setZoneList(zones); + break; + + case LAYOUT_MODE_6: + setGridSize(3, 3); + + addZone(zones, 0, 1, 0, 1); + addZone(zones, 2, 2, 0, 0); + addZone(zones, 2, 2, 1, 1); + addZone(zones, 0, 0, 2, 2); + addZone(zones, 1, 1, 2, 2); + addZone(zones, 2, 2, 2, 2); + + setZoneList(zones); + break; + + case LAYOUT_MODE_8: + setGridSize(4, 4); + + addZone(zones, 0, 2, 0, 2); + addZone(zones, 3, 3, 0, 0); + addZone(zones, 3, 3, 1, 1); + addZone(zones, 3, 3, 2, 2); + addZone(zones, 0, 0, 3, 3); + addZone(zones, 1, 1, 3, 3); + addZone(zones, 2, 2, 3, 3); + addZone(zones, 3, 3, 3, 3); + + setZoneList(zones); + break; + + case LAYOUT_MODE_9: + setGridSize(3, 3); + + addZone(zones, 0, 0, 0, 0); + addZone(zones, 1, 1, 0, 0); + addZone(zones, 2, 2, 0, 0); + addZone(zones, 0, 0, 1, 1); + addZone(zones, 1, 1, 1, 1); + addZone(zones, 2, 2, 1, 1); + addZone(zones, 0, 0, 2, 2); + addZone(zones, 1, 1, 2, 2); + addZone(zones, 2, 2, 2, 2); + + setZoneList(zones); + break; + + case LAYOUT_MODE_16: + setGridSize(4, 4); + + addZone(zones, 0, 0, 0, 0); + addZone(zones, 1, 1, 0, 0); + addZone(zones, 2, 2, 0, 0); + addZone(zones, 3, 3, 0, 0); + addZone(zones, 0, 0, 1, 1); + addZone(zones, 1, 1, 1, 1); + addZone(zones, 2, 2, 1, 1); + addZone(zones, 3, 3, 1, 1); + addZone(zones, 0, 0, 2, 2); + addZone(zones, 1, 1, 2, 2); + addZone(zones, 2, 2, 2, 2); + addZone(zones, 3, 3, 2, 2); + addZone(zones, 0, 0, 3, 3); + addZone(zones, 1, 1, 3, 3); + addZone(zones, 2, 2, 3, 3); + addZone(zones, 3, 3, 3, 3); + + setZoneList(zones); + break; + } +} + +void ZoneConfig::setGridSize(int rows, int cols) +{ + if (rows < 0 || cols < 0) + { + return; + } + else if (rows == m_gridRows && cols == m_gridCols) + { + return; + } + + m_gridRows = rows; + m_gridCols = cols; + + initGridFlag(); + + m_zones.clear(); + + update(); +} + + + + + + + + diff --git a/MediaClient/MediaClient/formClass/ZoneConfig.h b/MediaClient/MediaClient/formClass/ZoneConfig.h new file mode 100644 index 0000000..ad8e3e3 --- /dev/null +++ b/MediaClient/MediaClient/formClass/ZoneConfig.h @@ -0,0 +1,100 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef _ZONE_CONFIG_H_ +#define _ZONE_CONFIG_H_ + +#include +#include +#include "Layout.h" + +#define DEF_GRID_ROWS 9 +#define DEF_GRID_COLS 16 + +#define MAX_GRID_ROWS 64 +#define MAX_GRID_COLS 64 + +typedef LayoutZoneList ZoneList; + +class ZoneConfig : public QWidget +{ + Q_OBJECT + +public: + ZoneConfig(QWidget *parent); + ~ZoneConfig(); + + ZoneList getZoneList(); + void setZoneList(ZoneList & zones); + void setLayoutMode(int layoutMode); + int getGridRows() {return m_gridRows;} + int getGridCols() {return m_gridCols;} + void setGridSize(int rows, int cols); + +protected: + virtual void paintEvent(QPaintEvent * event); + virtual void dropEvent(QDropEvent *event); + virtual void dragEnterEvent(QDragEnterEvent *event); + virtual void mouseMoveEvent(QMouseEvent * event); + virtual void mousePressEvent(QMouseEvent * event); + virtual void mouseReleaseEvent(QMouseEvent * event); + virtual void contextMenuEvent(QContextMenuEvent * event); + +public slots: + void slotDelZone(); + void slotClearZone(); + +private: + void initActions(); + void initZoneConfig(); + void initGridFlag(); + void drawGrid(QPainter & painter, int rows, int cols); + void drawDragingZone(QPainter & painter); + void addZone(); + void addZone(ZoneList & zones, int l, int r, int t, int b); + void delZone(LayoutZone * zone); + void drawZone(QPainter & painter); + QRect getGridRect(int left, int right, int top, int bottom); + bool isValidPos(QPoint pos); + void getDragingGrids(QPoint pos1, QPoint pos2, int &left, int &right, int &top, int &bottom); + void setGridFlag(int left, int right, int top, int bottom, bool flag); + bool isValidGridRect(int left, int right, int top, int bottom); + LayoutZone* getZone(QPoint pos); + +private: + QPoint m_pressPos; + QPoint m_curPos; + QPoint m_ContextMenuPos; + + int m_gridRows; + int m_gridCols; + + ZoneList m_zones; + bool m_mouseMoving; + + bool m_gridFlag[MAX_GRID_ROWS][MAX_GRID_COLS]; + + QAction * m_actionDelZone; + QAction * m_actionClearZone; +}; + + +#endif // _ZONE_CONFIG_H_ + + diff --git a/MediaClient/MediaClient/http/http.h b/MediaClient/MediaClient/http/http.h new file mode 100644 index 0000000..8021d29 --- /dev/null +++ b/MediaClient/MediaClient/http/http.h @@ -0,0 +1,221 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef __H_HTTP_H__ +#define __H_HTTP_H__ + +#include "sys_buf.h" +#include "ppstack.h" + +#ifdef HTTPS +#include "openssl/ssl.h" +#endif + +/***************************************************************************************/ +typedef enum http_request_msg_type +{ + HTTP_MT_NULL = 0, + HTTP_MT_GET, + HTTP_MT_HEAD, + HTTP_MT_MPOST, + HTTP_MT_MSEARCH, + HTTP_MT_NOTIFY, + HTTP_MT_POST, + HTTP_MT_SUBSCRIBE, + HTTP_MT_UNSUBSCRIBE, +} HTTP_MT; + +/***************************************************************************************/ +typedef enum http_content_type +{ + CTT_NULL = 0, + CTT_SDP, + CTT_TXT, + CTT_HTM, + CTT_XML, + CTT_BIN, + CTT_JPG, + CTT_RTSP_TUNNELLED, + CTT_MULTIPART, + CTT_FLV +} HTTPCTT; + +#define ctt_is_string(type) (type == CTT_XML || type == CTT_HTM || type == CTT_TXT || type == CTT_SDP) + + +typedef struct _http_msg_content +{ + uint32 msg_type; + uint32 msg_sub_type; + HDRV first_line; + + PPSN_CTX hdr_ctx; + PPSN_CTX ctt_ctx; + + int hdr_len; + int ctt_len; + HTTPCTT ctt_type; + char boundary[256]; + + char * msg_buf; + int buf_offset; + + uint32 remote_ip; + uint16 remote_port; +} HTTPMSG; + +/*************************************************************************/ +typedef struct http_client +{ + uint32 pass_through : 1; // pass through received data flag + uint32 https : 1; // https flag + uint32 resv : 30; + + SOCKET cfd; // client socket + uint32 rip; // remote ip, network byte order + uint32 rport; // remote port + + char rcv_buf[2052]; // static receiving buffer + char * dyn_recv_buf; // dynamic receiving buffer + int rcv_dlen; // received data length + int hdr_len; // http header length + int ctt_len; // context length + HTTPCTT ctt_type; // context type + char * rbuf; // pointer to rcv_buf or dyn_recv_buf + int mlen; // sizeof(rcv_buf) or size of dyn_recv_buf + + void * p_srv; // pointer to HTTPSRV + int use_count; // use count + + void * userdata; // user data + void * userdata_mutex; // user data mutex + uint32 protocol; // protocol, rtsp over http, websocket etc + +#ifdef HTTPS + SSL * ssl; // https SSL + void * ssl_mutex; // https SSL mutex +#endif +} HTTPCLN; + +typedef struct http_req +{ + uint32 need_auth : 1; // need auth flag + uint32 https : 1; // https flag + uint32 resv : 30; + + SOCKET cfd; // client socket + uint32 port; // server port + char host[256]; // server host + char url[256]; // the request url + + char action[256]; // action + char rcv_buf[2052]; // static receiving buffer + char * dyn_recv_buf; // dynamic receiving buffer + int rcv_dlen; // received data length + int hdr_len; // http header length + int ctt_len; // context length + char boundary[256]; // boundary, for CTT_MULTIPART + char * rbuf; // pointer to rcv_buf or dyn_recv_buf + int mlen; // sizeof(rcv_buf) or size of dyn_recv_buf + + HTTPMSG * rx_msg; // rx message + + int auth_mode; // 0 - baisc; 1 - digest + HD_AUTH_INFO auth_info; // http auth information + +#ifdef HTTPS + SSL * ssl; // https SSL + void * ssl_mutex; // https SSL mutex +#endif +} HTTPREQ; + +/*************************************************************************/ + +/* + * If rx_msg is NULL, the callback should call the http_free_used_cln function to delete p_cln + * If the callback is responsible for deleting rx_msg, it returns TRUE, otherwise it returns FALSE + */ +typedef BOOL (*http_msg_callback)(void * p_srv, HTTPCLN * p_cln, HTTPMSG * rx_msg, void * userdata); + +/* + * Raw data received by http + * p_srv : HTTPSRV + * p_cln : http client user agent + * buff : data buffer + * buflen : data buffer length + * + */ +typedef void (*http_data_callback)(void * p_srv, HTTPCLN * p_cln, char * buff, int buflen, void * userdata); + +/* + * http new connection callback + * p_srv : HTTPSRV + * addr : http client connection address, network byte order + * port : http client connection port, host byte order + * + * Return TRUE, accept the new connection, return FALSE, reject the new connection + */ +typedef BOOL (*http_conn_callback)(void * p_srv, uint32 addr, int port, void * userdata); + +typedef struct http_srv_s +{ + uint32 r_flag : 1; // data receiving flag + uint32 https : 1; // https flag + uint32 resv : 30; + + SOCKET sfd; // server socket + + char host[128]; // local server address + int sport; // server port + uint32 saddr; // server address, network byte order + uint32 max_cln_nums; // max client number + + PPSN_CTX * cln_fl; // client free list + PPSN_CTX * cln_ul; // client used list + + pthread_t rx_tid; // data receiving thread id + + void * mutex_cb; // cabllback mutex + http_msg_callback msg_cb; // http message callback + http_data_callback data_cb; // http data callback + http_conn_callback conn_cb; // http connection callback + void * msg_user; // http message callback user data + void * data_user; // http data callback user data + void * conn_user; // http connection callback user data + +#ifdef EPOLL + int ep_fd; // epoll fd + struct epoll_event * ep_events; // epoll events + int ep_event_num; // epoll event number +#endif + +#ifdef HTTPS + char cert_file[256]; // cert file name + char key_file[256]; // key file name + SSL_CTX * ssl_ctx; // ssl context +#endif +} HTTPSRV; + + + +#endif // __H_HTTP_H__ + + + + diff --git a/MediaClient/MediaClient/http/http_cln.cpp b/MediaClient/MediaClient/http/http_cln.cpp new file mode 100644 index 0000000..95d993a --- /dev/null +++ b/MediaClient/MediaClient/http/http_cln.cpp @@ -0,0 +1,791 @@ +/*************************************************************************************** + * + * 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.h" +#include "http_parse.h" +#include "http_cln.h" +#include "rfc_md5.h" +#include "sha256.h" +#include "base64.h" + +/***************************************************************************************/ + +#ifdef HTTPS +#if __WINDOWS_OS__ +#pragma comment(lib, "libcrypto.lib") +#pragma comment(lib, "libssl.lib") +#endif +#endif + +/***************************************************************************************/ + +#define MAX_CTT_LEN (2*1024*1024) + + +/***************************************************************************************/ + +static inline int http_isspace(int c) +{ + return c == ' ' || c == '\f' || c == '\n' || + c == '\r' || c == '\t' || c == '\v'; +} + +void http_choose_qop(char * qop, int size) +{ + char * ptr = strstr(qop, "auth"); + char * end = ptr + strlen("auth"); + + if (ptr && (!*end || http_isspace(*end) || *end == ',') && + (ptr == qop || http_isspace(ptr[-1]) || ptr[-1] == ',')) + { + strncpy(qop, "auth", size); + } + else + { + qop[0] = 0; + } +} + +BOOL http_get_digest_params(char * p, int len, HD_AUTH_INFO * p_auth) +{ + char word_buf[128]; + + if (GetNameValuePair(p, len, "algorithm", word_buf, sizeof(word_buf))) + { + strncpy(p_auth->auth_algorithm, word_buf, sizeof(p_auth->auth_algorithm)-1); + } + else + { + p_auth->auth_algorithm[0] = '\0'; + } + + if (GetNameValuePair(p, len, "realm", word_buf, sizeof(word_buf))) + { + strncpy(p_auth->auth_realm, word_buf, sizeof(p_auth->auth_realm)-1); + } + else + { + return FALSE; + } + + if (GetNameValuePair(p, len, "nonce", word_buf, sizeof(word_buf))) + { + strncpy(p_auth->auth_nonce, word_buf, sizeof(p_auth->auth_nonce)-1); + } + else + { + return FALSE; + } + + if (GetNameValuePair(p, len, "qop", word_buf, sizeof(word_buf))) + { + strncpy(p_auth->auth_qop, word_buf, sizeof(p_auth->auth_qop)-1); + } + else + { + p_auth->auth_qop[0] = '\0'; + } + + http_choose_qop(p_auth->auth_qop, sizeof(p_auth->auth_qop)); + + if (GetNameValuePair(p, len, "opaque", word_buf, sizeof(word_buf))) + { + p_auth->auth_opaque_flag = 1; + strncpy(p_auth->auth_opaque, word_buf, sizeof(p_auth->auth_opaque)-1); + } + else + { + p_auth->auth_opaque_flag = 0; + p_auth->auth_opaque[0] = '\0'; + } + + return TRUE; +} + +BOOL http_get_digest_info(HTTPMSG * rx_msg, HD_AUTH_INFO * p_auth) +{ + int len; + int next_offset; + char word_buf[128]; + HDRV * chap_id = NULL; + char * p; + + p_auth->auth_response[0] = '\0'; + +RETRY: + + if (chap_id) + { + chap_id = http_find_headline_next(rx_msg, "WWW-Authenticate", chap_id); + } + else + { + chap_id = http_find_headline(rx_msg, "WWW-Authenticate"); + } + + if (chap_id == NULL) + { + return FALSE; + } + + GetLineWord(chap_id->value_string, 0, (int)strlen(chap_id->value_string), + word_buf, sizeof(word_buf), &next_offset, WORD_TYPE_STRING); + if (strcasecmp(word_buf, "digest") != 0) + { + goto RETRY; + } + + p = chap_id->value_string + next_offset; + len = (int)strlen(chap_id->value_string) - next_offset; + + if (!http_get_digest_params(p, len, p_auth)) + { + goto RETRY; + } + + if (p_auth->auth_algorithm[0] != '\0' && + strncasecmp(p_auth->auth_algorithm, "MD5", 3) && + strncasecmp(p_auth->auth_algorithm, "SHA-256", 7)) + { + goto RETRY; + } + + return TRUE; +} + +BOOL http_calc_auth_md5_digest(HD_AUTH_INFO * p_auth, const char * method) +{ + uint8 HA1[16]; + uint8 HA2[16]; + uint8 HA3[16]; + char HA1Hex[33]; + char HA2Hex[33]; + char HA3Hex[33]; + md5_context ctx; + + md5_starts(&ctx); + md5_update(&ctx, (uint8 *)p_auth->auth_name, strlen(p_auth->auth_name)); + md5_update(&ctx, (uint8 *)&(":"), 1); + md5_update(&ctx, (uint8 *)p_auth->auth_realm, strlen(p_auth->auth_realm)); + md5_update(&ctx, (uint8 *)&(":"), 1); + md5_update(&ctx, (uint8 *)p_auth->auth_pwd, strlen(p_auth->auth_pwd)); + md5_finish(&ctx, HA1); + + bin_to_hex_str(HA1, 16, HA1Hex, 33); + + if (!strcasecmp(p_auth->auth_algorithm, "MD5-sess")) + { + md5_starts(&ctx); + md5_update(&ctx, (uint8 *)HA1Hex, 32); + md5_update(&ctx, (uint8 *)&(":"), 1); + md5_update(&ctx, (uint8 *)p_auth->auth_nonce, strlen(p_auth->auth_nonce)); + md5_update(&ctx, (uint8 *)&(":"), 1); + md5_update(&ctx, (uint8 *)p_auth->auth_cnonce, strlen(p_auth->auth_cnonce)); + md5_finish(&ctx, HA1); + + bin_to_hex_str(HA1, 16, HA1Hex, 33); + } + + md5_starts(&ctx); + md5_update(&ctx, (uint8 *)method, strlen(method)); + md5_update(&ctx, (uint8 *)&(":"), 1); + md5_update(&ctx, (uint8 *)p_auth->auth_uri, strlen(p_auth->auth_uri)); + md5_finish(&ctx, HA2); + + bin_to_hex_str(HA2, 16, HA2Hex, 33); + + md5_starts(&ctx); + md5_update(&ctx, (uint8 *)HA1Hex, 32); + md5_update(&ctx, (uint8 *)&(":"), 1); + md5_update(&ctx, (uint8 *)p_auth->auth_nonce, strlen(p_auth->auth_nonce)); + md5_update(&ctx, (uint8 *)&(":"), 1); + + if (p_auth->auth_qop[0] != '\0') + { + md5_update(&ctx, (uint8 *)p_auth->auth_ncstr, strlen(p_auth->auth_ncstr)); + md5_update(&ctx, (uint8 *)&(":"), 1); + md5_update(&ctx, (uint8 *)p_auth->auth_cnonce, strlen(p_auth->auth_cnonce)); + md5_update(&ctx, (uint8 *)&(":"), 1); + md5_update(&ctx, (uint8 *)p_auth->auth_qop, strlen(p_auth->auth_qop)); + md5_update(&ctx, (uint8 *)&(":"), 1); + }; + + md5_update(&ctx, (uint8 *)HA2Hex, 32); + md5_finish(&ctx, HA3); + + bin_to_hex_str(HA3, 16, HA3Hex, 33); + + strcpy(p_auth->auth_response, HA3Hex); + + return TRUE; +} + +BOOL http_calc_auth_sha256_digest(HD_AUTH_INFO * p_auth, const char * method) +{ + uint8 HA1[32]; + uint8 HA2[32]; + uint8 HA3[32]; + char HA1Hex[65]; + char HA2Hex[65]; + char HA3Hex[65]; + sha256_context ctx; + + sha256_starts(&ctx); + sha256_update(&ctx, (uint8 *)p_auth->auth_name, strlen(p_auth->auth_name)); + sha256_update(&ctx, (uint8 *)&(":"), 1); + sha256_update(&ctx, (uint8 *)p_auth->auth_realm, strlen(p_auth->auth_realm)); + sha256_update(&ctx, (uint8 *)&(":"), 1); + sha256_update(&ctx, (uint8 *)p_auth->auth_pwd, strlen(p_auth->auth_pwd)); + sha256_finish(&ctx, HA1); + + bin_to_hex_str(HA1, 32, HA1Hex, 65); + + if (!strcasecmp(p_auth->auth_algorithm, "SHA-256-sess")) + { + sha256_starts(&ctx); + sha256_update(&ctx, (uint8 *)HA1Hex, 64); + sha256_update(&ctx, (uint8 *)&(":"), 1); + sha256_update(&ctx, (uint8 *)p_auth->auth_nonce, strlen(p_auth->auth_nonce)); + sha256_update(&ctx, (uint8 *)&(":"), 1); + sha256_update(&ctx, (uint8 *)p_auth->auth_cnonce, strlen(p_auth->auth_cnonce)); + sha256_finish(&ctx, HA1); + + bin_to_hex_str(HA1, 32, HA1Hex, 65); + } + + sha256_starts(&ctx); + sha256_update(&ctx, (uint8 *)method, strlen(method)); + sha256_update(&ctx, (uint8 *)&(":"), 1); + sha256_update(&ctx, (uint8 *)p_auth->auth_uri, strlen(p_auth->auth_uri)); + sha256_finish(&ctx, HA2); + + bin_to_hex_str(HA2, 32, HA2Hex, 65); + + sha256_starts(&ctx); + sha256_update(&ctx, (uint8 *)HA1Hex, 64); + sha256_update(&ctx, (uint8 *)&(":"), 1); + sha256_update(&ctx, (uint8 *)p_auth->auth_nonce, strlen(p_auth->auth_nonce)); + sha256_update(&ctx, (uint8 *)&(":"), 1); + + if (p_auth->auth_qop[0] != '\0') + { + sha256_update(&ctx, (uint8 *)p_auth->auth_ncstr, strlen(p_auth->auth_ncstr)); + sha256_update(&ctx, (uint8 *)&(":"), 1); + sha256_update(&ctx, (uint8 *)p_auth->auth_cnonce, strlen(p_auth->auth_cnonce)); + sha256_update(&ctx, (uint8 *)&(":"), 1); + sha256_update(&ctx, (uint8 *)p_auth->auth_qop, strlen(p_auth->auth_qop)); + sha256_update(&ctx, (uint8 *)&(":"), 1); + }; + + sha256_update(&ctx, (uint8 *)HA2Hex, 64); + sha256_finish(&ctx, HA3); + + bin_to_hex_str(HA3, 32, HA3Hex, 65); + + strcpy(p_auth->auth_response, HA3Hex); + + return TRUE; +} + +BOOL http_calc_auth_digest(HD_AUTH_INFO * p_auth, const char * method) +{ + BOOL ret = FALSE; + + p_auth->auth_nc++; + sprintf(p_auth->auth_ncstr, "%08X", p_auth->auth_nc); + sprintf(p_auth->auth_cnonce, "%08X%08X", rand(), rand()); + + if (p_auth->auth_algorithm[0] == '\0' || + strncasecmp(p_auth->auth_algorithm, "MD5", 3) == 0) + { + ret = http_calc_auth_md5_digest(p_auth, method); + } + else if (strncasecmp(p_auth->auth_algorithm, "SHA-256", 7) == 0) + { + ret = http_calc_auth_sha256_digest(p_auth, method); + } + + return ret; +} + +int http_build_auth_msg(HTTPREQ * p_http, const char * method, char * buff, int buflen) +{ + int offset = 0; + HD_AUTH_INFO * p_auth = &p_http->auth_info; + + if (p_http->auth_mode == 1) // digest auth + { + http_calc_auth_digest(p_auth, method); + + offset += snprintf(buff+offset, buflen-offset, + "Authorization: Digest username=\"%s\", realm=\"%s\", " + "nonce=\"%s\", uri=\"%s\", response=\"%s\"", + p_auth->auth_name, p_auth->auth_realm, + p_auth->auth_nonce, p_auth->auth_uri, p_auth->auth_response); + + if (p_auth->auth_opaque_flag) + { + offset += snprintf(buff+offset, buflen-offset, + ", opaque=\"%s\"", p_auth->auth_opaque); + } + + if (p_auth->auth_qop[0] != '\0') + { + offset += snprintf(buff+offset, buflen-offset, + ", qop=\"%s\", cnonce=\"%s\", nc=%s", + p_auth->auth_qop, p_auth->auth_cnonce, p_auth->auth_ncstr); + } + + if (p_auth->auth_algorithm[0] != '\0') + { + offset += snprintf(buff+offset, buflen-offset, + ", algorithm=%s", p_auth->auth_algorithm); + } + + offset += snprintf(buff+offset, buflen-offset, "\r\n"); + } + else if (p_http->auth_mode == 0) // basic auth + { + char auth[128] = {'\0'}; + char basic[256] = {'\0'}; + + snprintf(auth, sizeof(auth), "%s:%s", p_auth->auth_name, p_auth->auth_pwd); + + base64_encode((uint8 *)auth, (int)strlen(auth), basic, sizeof(basic)); + + offset += snprintf(buff+offset, buflen-offset, "Authorization: Basic %s\r\n", basic); + } + + return offset; +} + +int http_cln_auth_set(HTTPREQ * p_http, const char * user, const char * pass) +{ + if (user) + { + strncpy(p_http->auth_info.auth_name, user, sizeof(p_http->auth_info.auth_name)-1); + } + + if (pass) + { + strncpy(p_http->auth_info.auth_pwd, pass, sizeof(p_http->auth_info.auth_pwd)-1); + } + + if (http_get_digest_info(p_http->rx_msg, &p_http->auth_info)) + { + p_http->auth_mode = 1; // digest + strcpy(p_http->auth_info.auth_uri, p_http->url); + } + else + { + p_http->auth_mode = 0; // basic + } + + p_http->need_auth = TRUE; + + return p_http->auth_mode; +} + +BOOL http_cln_ssl_conn(HTTPREQ * p_http, int timeout) +{ +#ifdef HTTPS + SSL_CTX * ctx = NULL; + const SSL_METHOD * method = NULL; + + SSLeay_add_ssl_algorithms(); + SSL_load_error_strings(); + + method = SSLv23_client_method(); + ctx = SSL_CTX_new(method); + if (NULL == ctx) + { + log_print(HT_LOG_ERR, "%s, SSL_CTX_new failed!\r\n", __FUNCTION__); + return FALSE; + } + +#if __WINDOWS_OS__ + int tv = timeout; +#else + struct timeval tv = {timeout / 1000, (timeout % 1000) * 1000}; +#endif + + setsockopt(p_http->cfd, SOL_SOCKET, SO_RCVTIMEO, (char*)&tv, sizeof(tv)); + + p_http->ssl = SSL_new(ctx); + if (NULL == p_http->ssl) + { + SSL_CTX_free(ctx); + log_print(HT_LOG_ERR, "%s, SSL_new failed!\r\n", __FUNCTION__); + return FALSE; + } + + SSL_set_fd(p_http->ssl, p_http->cfd); + + if (SSL_connect(p_http->ssl) == -1) + { + SSL_CTX_free(ctx); + log_print(HT_LOG_ERR, "%s, SSL_connect failed!\r\n", __FUNCTION__); + return FALSE; + } + + SSL_CTX_free(ctx); + + p_http->ssl_mutex = sys_os_create_mutex(); + + return TRUE; +#else + return FALSE; +#endif +} + +BOOL http_cln_rx(HTTPREQ * p_http) +{ + int rlen = 0; + HTTPMSG * rx_msg; + + if (p_http->rbuf == NULL) + { + p_http->rbuf = p_http->rcv_buf; + p_http->mlen = sizeof(p_http->rcv_buf)-4; + p_http->rcv_dlen = 0; + p_http->ctt_len = 0; + p_http->hdr_len = 0; + } + +#ifdef HTTPS + if (p_http->https) + { + sys_os_mutex_enter(p_http->ssl_mutex); + if (p_http->ssl) + { + rlen = SSL_read(p_http->ssl, p_http->rbuf+p_http->rcv_dlen, p_http->mlen-p_http->rcv_dlen); + } + sys_os_mutex_leave(p_http->ssl_mutex); + } + else +#endif + rlen = recv(p_http->cfd, p_http->rbuf+p_http->rcv_dlen, p_http->mlen-p_http->rcv_dlen, 0); + + if (rlen < 0) + { + log_print(HT_LOG_INFO, "%s, recv return = %d, dlen[%d], mlen[%d]\r\n", + __FUNCTION__, rlen, p_http->rcv_dlen, p_http->mlen); + return FALSE; + } + + p_http->rcv_dlen += rlen; + p_http->rbuf[p_http->rcv_dlen] = '\0'; + + if (0 == rlen) + { + if (p_http->rcv_dlen < p_http->ctt_len + p_http->hdr_len && p_http->ctt_len == MAX_CTT_LEN) + { + // without Content-Length filed, when recv finish, fix the ctt length + p_http->ctt_len = p_http->rcv_dlen - p_http->hdr_len; + } + else + { + log_print(HT_LOG_INFO, "%s, recv return = %d, dlen[%d], mlen[%d]\r\n", + __FUNCTION__, rlen, p_http->rcv_dlen, p_http->mlen); + return FALSE; + } + } + + if (p_http->rcv_dlen < 16) + { + return TRUE; + } + + if (http_is_http_msg(p_http->rbuf) == FALSE) + { + return FALSE; + } + + rx_msg = NULL; + + if (p_http->hdr_len == 0) + { + int parse_len; + int http_pkt_len; + + http_pkt_len = http_pkt_find_end(p_http->rbuf); + if (http_pkt_len == 0) + { + return TRUE; + } + p_http->hdr_len = http_pkt_len; + + rx_msg = http_get_msg_buf(http_pkt_len+1); + if (rx_msg == NULL) + { + log_print(HT_LOG_ERR, "%s, get msg buf failed\r\n", __FUNCTION__); + return FALSE; + } + + memcpy(rx_msg->msg_buf, p_http->rbuf, http_pkt_len); + rx_msg->msg_buf[http_pkt_len] = '\0'; + + log_print(HT_LOG_DBG, "RX from %s << %s\r\n", p_http->host, rx_msg->msg_buf); + + parse_len = http_msg_parse_part1(rx_msg->msg_buf, http_pkt_len, rx_msg); + if (parse_len != http_pkt_len) + { + log_print(HT_LOG_ERR, "%s, http_msg_parse_part1=%d, http_pkt_len=%d!!!\r\n", + __FUNCTION__, parse_len, http_pkt_len); + + http_free_msg(rx_msg); + return FALSE; + } + + p_http->ctt_len = rx_msg->ctt_len; + } + + if (p_http->ctt_len == 0 && p_http->rcv_dlen > p_http->hdr_len) + { + // without Content-Length field + p_http->ctt_len = MAX_CTT_LEN; + } + + if ((p_http->ctt_len + p_http->hdr_len) > p_http->mlen) + { + if (p_http->dyn_recv_buf) + { + free(p_http->dyn_recv_buf); + } + + p_http->dyn_recv_buf = (char *)malloc(p_http->ctt_len + p_http->hdr_len + 1); + if (NULL == p_http->dyn_recv_buf) + { + http_free_msg(rx_msg); + return FALSE; + } + + memcpy(p_http->dyn_recv_buf, p_http->rcv_buf, p_http->rcv_dlen); + p_http->rbuf = p_http->dyn_recv_buf; + p_http->mlen = p_http->ctt_len + p_http->hdr_len; + + http_free_msg(rx_msg); + + // Need more data + return TRUE; + } + + if (p_http->rcv_dlen >= (p_http->ctt_len + p_http->hdr_len)) + { + if (rx_msg == NULL) + { + int nlen; + int parse_len; + + nlen = p_http->ctt_len + p_http->hdr_len; + + rx_msg = http_get_msg_buf(nlen+1); + if (rx_msg == NULL) + { + log_print(HT_LOG_ERR, "%s, get msg buf failed\r\n", __FUNCTION__); + return FALSE; + } + + memcpy(rx_msg->msg_buf, p_http->rbuf, p_http->hdr_len); + rx_msg->msg_buf[p_http->hdr_len] = '\0'; + + parse_len = http_msg_parse_part1(rx_msg->msg_buf, p_http->hdr_len, rx_msg); + if (parse_len != p_http->hdr_len) + { + log_print(HT_LOG_ERR, "%s, http_msg_parse_part1=%d, sip_pkt_len=%d!!!\r\n", __FUNCTION__, parse_len, p_http->hdr_len); + + http_free_msg(rx_msg); + return FALSE; + } + } + + if (p_http->ctt_len > 0) + { + int parse_len; + + memcpy(rx_msg->msg_buf+p_http->hdr_len, p_http->rbuf+p_http->hdr_len, p_http->ctt_len); + rx_msg->msg_buf[p_http->hdr_len + p_http->ctt_len] = '\0'; + + if (ctt_is_string(rx_msg->ctt_type)) + { + log_print(HT_LOG_DBG, "%s\r\n\r\n", rx_msg->msg_buf+p_http->hdr_len); + } + + parse_len = http_msg_parse_part2(rx_msg->msg_buf+p_http->hdr_len, p_http->ctt_len, rx_msg); + if (parse_len != p_http->ctt_len) + { + log_print(HT_LOG_ERR, "%s, http_msg_parse_part2=%d, sdp_pkt_len=%d!!!\r\n", __FUNCTION__, parse_len, p_http->ctt_len); + + http_free_msg(rx_msg); + return FALSE; + } + } + + p_http->rx_msg = rx_msg; + } + + if (p_http->rx_msg != rx_msg) + { + http_free_msg(rx_msg); + } + + return TRUE; +} + +int http_cln_tx(HTTPREQ * p_http, const char * p_data, int len) +{ + int slen = 0; + + if (p_http->cfd <= 0) + { + return -1; + } + +#ifdef HTTPS + if (p_http->https) + { + sys_os_mutex_enter(p_http->ssl_mutex); + if (p_http->ssl) + { + slen = SSL_write(p_http->ssl, p_data, len); + } + sys_os_mutex_leave(p_http->ssl_mutex); + } + else +#endif + slen = send(p_http->cfd, p_data, len, 0); + + return slen; +} + +BOOL http_cln_rx_timeout(HTTPREQ * p_http, int timeout) +{ + int count = 0; + int sret; + BOOL ret = FALSE; + fd_set fdr; + struct timeval tv; + + while (1) + { +#ifdef HTTPS + if (p_http->https && SSL_pending(p_http->ssl) > 0) + { + // There is data to read + } + else +#endif + { + tv.tv_sec = 1; + tv.tv_usec = 0; + + FD_ZERO(&fdr); + FD_SET(p_http->cfd, &fdr); + + sret = select((int)(p_http->cfd+1), &fdr, NULL, NULL, &tv); + if (sret == 0) + { + count++; + + if (count >= timeout / 1000) + { + log_print(HT_LOG_WARN, "%s, timeout!!!\r\n", __FUNCTION__); + break; + } + + continue; + } + else if (sret < 0) + { + log_print(HT_LOG_ERR, "%s, select err[%s], sret[%d]!!!\r\n", + __FUNCTION__, sys_os_get_socket_error(), sret); + break; + } + else if (!FD_ISSET(p_http->cfd, &fdr)) + { + continue; + } + } + + if (http_cln_rx(p_http) == FALSE) + { + break; + } + else if (p_http->rx_msg != NULL) + { + ret = TRUE; + break; + } + } + + return ret; +} + +void http_cln_free_req(HTTPREQ * p_http) +{ + if (p_http->cfd > 0) + { + closesocket(p_http->cfd); + p_http->cfd = 0; + } + +#ifdef HTTPS + if (p_http->https) + { + if (p_http->ssl) + { + sys_os_mutex_enter(p_http->ssl_mutex); + SSL_free(p_http->ssl); + p_http->ssl = NULL; + sys_os_mutex_leave(p_http->ssl_mutex); + } + + if (p_http->ssl_mutex) + { + sys_os_destroy_sig_mutex(p_http->ssl_mutex); + p_http->ssl_mutex = NULL; + } + } +#endif + + if (p_http->dyn_recv_buf) + { + free(p_http->dyn_recv_buf); + p_http->dyn_recv_buf = NULL; + } + + if (p_http->rx_msg) + { + http_free_msg(p_http->rx_msg); + p_http->rx_msg = NULL; + } + + p_http->rcv_dlen = 0; + p_http->hdr_len = 0; + p_http->ctt_len = 0; + p_http->rbuf = NULL; + p_http->mlen = 0; +} + + + + + + diff --git a/MediaClient/MediaClient/http/http_cln.h b/MediaClient/MediaClient/http/http_cln.h new file mode 100644 index 0000000..0ba585c --- /dev/null +++ b/MediaClient/MediaClient/http/http_cln.h @@ -0,0 +1,46 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef HTTP_CLN_H +#define HTTP_CLN_H + +#include "http.h" + +#ifdef __cplusplus +extern "C" { +#endif + +BOOL http_get_digest_params(char * p, int len, HD_AUTH_INFO * p_auth); +BOOL http_get_digest_info(HTTPMSG * rx_msg, HD_AUTH_INFO * auth_info); +BOOL http_calc_auth_digest(HD_AUTH_INFO * auth_info, const char * method); +int http_build_auth_msg(HTTPREQ * p_http, const char * method, char * buff, int buflen); +int http_cln_auth_set(HTTPREQ * p_http, const char * user, const char * pass); +BOOL http_cln_ssl_conn(HTTPREQ * p_http, int timeout); +BOOL http_cln_rx(HTTPREQ * p_http); +int http_cln_tx(HTTPREQ * p_http, const char * p_data, int len); +BOOL http_cln_rx_timeout(HTTPREQ * p_http, int timeout); +void http_cln_free_req(HTTPREQ * p_http); + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/MediaClient/MediaClient/http/http_flv_cln.cpp b/MediaClient/MediaClient/http/http_flv_cln.cpp new file mode 100644 index 0000000..02e38e7 --- /dev/null +++ b/MediaClient/MediaClient/http/http_flv_cln.cpp @@ -0,0 +1,1449 @@ +/*************************************************************************************** + * + * 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 "h264.h" +#include "h265.h" +#include "media_format.h" +#include "http_cln.h" +#include "http_parse.h" + + +void * http_flv_rx_thread(void * argv) +{ + CHttpFlvClient * pRtmpClient = (CHttpFlvClient *) argv; + + pRtmpClient->rx_thread(); + + return NULL; +} + +CHttpFlvClient::CHttpFlvClient() +: m_bRunning(FALSE) +, m_bVideoReady(FALSE) +, m_bAudioReady(FALSE) +, m_bChunked(FALSE) +, m_bFlvHeader(FALSE) +, m_tidRx(0) +, m_nVpsLen(0) +, m_nSpsLen(0) +, m_nPpsLen(0) +, m_nAudioConfigLen(0) +, m_nVideoCodec(VIDEO_CODEC_NONE) +, m_nWidth(0) +, m_nHeight(0) +, m_nFrameRate(0) +, m_nAudioCodec(AUDIO_CODEC_NONE) +, m_nSamplerate(44100) +, m_nChannels(2) +, m_nVideoInitTS(0) +, m_nAudioInitTS(0) +, m_pNotify(NULL) +, m_pUserdata(NULL) +, m_pVideoCB(NULL) +, m_pAudioCB(NULL) +, m_nRxTimeout(10) +{ + memset(m_url, 0, sizeof(m_url)); + memset(m_user, 0, sizeof(m_user)); + memset(m_pass, 0, sizeof(m_pass)); + + memset(&m_pVps, 0, sizeof(m_pVps)); + memset(&m_pSps, 0, sizeof(m_pVps)); + memset(&m_pPps, 0, sizeof(m_pVps)); + memset(&m_pAudioConfig, 0, sizeof(m_pAudioConfig)); + + memset(&m_http, 0, sizeof(HTTPREQ)); + + m_pMutex = sys_os_create_mutex(); +} + +CHttpFlvClient::~CHttpFlvClient() +{ + http_flv_close(); + + if (m_pMutex) + { + sys_os_destroy_sig_mutex(m_pMutex); + m_pMutex = NULL; + } +} + +BOOL CHttpFlvClient::http_flv_start(const char * url, const char * user, const char * pass) +{ + if (url && url[0] != '\0') + { + strncpy(m_url, url, sizeof(m_url)-1); + } + + if (user && user[0] != '\0') + { + strncpy(m_user, user, sizeof(m_user)-1); + } + + if (pass && pass[0] != '\0') + { + strncpy(m_pass, pass, sizeof(m_pass)-1); + } + + m_bRunning = TRUE; + m_tidRx = sys_os_create_thread((void *)http_flv_rx_thread, this); + + return TRUE; +} + +BOOL CHttpFlvClient::http_flv_play() +{ + return FALSE; +} + +BOOL CHttpFlvClient::http_flv_stop() +{ + return http_flv_close(); +} + +BOOL CHttpFlvClient::http_flv_pause() +{ + return FALSE; +} + +BOOL CHttpFlvClient::http_flv_close() +{ + sys_os_mutex_enter(m_pMutex); + m_pAudioCB = NULL; + m_pVideoCB = NULL; + m_pNotify = NULL; + m_pUserdata = NULL; + sys_os_mutex_leave(m_pMutex); + +#ifdef HTTPS + if (m_http.https && m_http.ssl) + { + SSL_shutdown(m_http.ssl); + } +#endif + + if (m_http.cfd > 0) + { + closesocket(m_http.cfd); + m_http.cfd = 0; + } + + m_bRunning = FALSE; + + while (m_tidRx) + { + usleep(10*1000); + } + + http_cln_free_req(&m_http); + + m_bVideoReady = FALSE; + m_bAudioReady = FALSE; + + return TRUE; +} + +BOOL CHttpFlvClient::http_flv_req(HTTPREQ * p_http) +{ + int slen; + int offset = 0; + char bufs[2048] = {'\0'}; + int buflen = sizeof(bufs); + + offset += snprintf(bufs+offset, buflen-offset, "GET %s HTTP/1.1\r\n", p_http->url); + offset += snprintf(bufs+offset, buflen-offset, "Host: %s:%u\r\n", p_http->host, p_http->port); + offset += snprintf(bufs+offset, buflen-offset, "Accept: */*\r\n"); + offset += snprintf(bufs+offset, buflen-offset, "User-Agent: Happytime http-flv 1.0\r\n"); + + if (p_http->need_auth) + { + offset += http_build_auth_msg(p_http, "GET", bufs+offset, buflen-offset); + } + + offset += snprintf(bufs+offset, buflen-offset, "Connection: keep-alive\r\n\r\n"); + + log_print(HT_LOG_DBG, "TX >> %s\r\n\r\n", bufs); + + slen = http_cln_tx(p_http, bufs, offset); + + return (slen == offset) ? TRUE : FALSE; +} + +BOOL CHttpFlvClient::http_flv_connect() +{ + http_flv_send_notify(HTTP_FLV_EVE_CONNECTING); + + memset(&m_http, 0, sizeof(HTTPREQ)); + + int port; + char proto[32], username[100], password[100], host[100], path[200]; + + url_split(m_url, proto, sizeof(proto), username, sizeof(username), + password, sizeof(password), host, sizeof(host), &port, path, sizeof(path)); + + if (strcasecmp(proto, "https") == 0) + { + m_http.https = 1; + } + else if (strcasecmp(proto, "http") != 0) + { + log_print(HT_LOG_ERR, "%s, invalid url %s\r\n", __FUNCTION__, m_url); + return FALSE; + } + + if (host[0] == '\0') + { + log_print(HT_LOG_ERR, "%s, invalid url %s\r\n", __FUNCTION__, m_url); + return FALSE; + } + + if (port == -1) + { + if (m_http.https) + { + port = 443; + } + else + { + port = 80; + } + } + + strcpy(m_http.host, host); + m_http.port = port; + strcpy(m_http.url, path); + + int timeout = 10*1000; + + m_http.cfd = tcp_connect_timeout(get_address_by_name(host), port, timeout); + if (m_http.cfd <= 0) + { + log_print(HT_LOG_ERR, "%s, connect failed. %s\r\n", __FUNCTION__, m_url); + return FALSE; + } + + if (m_http.https) + { +#ifdef HTTPS + if (!http_cln_ssl_conn(&m_http, timeout)) + { + http_cln_free_req(&m_http); + return FALSE; + } +#else + http_cln_free_req(&m_http); + log_print(HT_LOG_ERR, "%s, the server require ssl connection, unsupport!\r\n", __FUNCTION__); + return FALSE; +#endif + } + + if (!http_flv_req(&m_http)) + { + http_cln_free_req(&m_http); + log_print(HT_LOG_ERR, "%s, send request failed.\r\n", __FUNCTION__); + return FALSE; + } + + return TRUE; +} + +int CHttpFlvClient::http_flv_h264_rx(uint8 * data, uint32 size, uint32 ts) +{ + if (data[1] == 0x00) // AVC sequence header + { + if (size < 15) + { + log_print(HT_LOG_WARN, "%s, dataLen=%d\r\n", __FUNCTION__, size); + return 0; + } + + uint32 offset = 10; + int spsnum = (data[offset++] & 0x1f); + int i = 0; + + while (i < spsnum) + { + uint32 spslen = (data[offset] & 0x000000FF) << 8 | (data[offset + 1] & 0x000000FF); + + offset += 2; + + if (offset + spslen > size) + { + return -1; + } + + if (0 == m_nSpsLen && spslen <= sizeof(m_pSps) + 4) + { + m_pSps[0] = 0; + m_pSps[1] = 0; + m_pSps[2] = 0; + m_pSps[3] = 1; + m_nSpsLen = spslen + 4; + memcpy(m_pSps + 4, data + offset, spslen); + } + + offset += spslen; + i++; + } + + int ppsnum = (data[offset++] & 0x1f); + i = 0; + + while (i < ppsnum) + { + uint32 ppslen = (data[offset] & 0x000000FF) << 8 | (data[offset + 1] & 0x000000FF); + + offset += 2; + + if (offset + ppslen > size) + { + return -1; + } + + if (0 == m_nPpsLen && ppslen <= sizeof(m_pPps) + 4) + { + m_pPps[0] = 0; + m_pPps[1] = 0; + m_pPps[2] = 0; + m_pPps[3] = 1; + m_nPpsLen = ppslen + 4; + memcpy(m_pPps + 4, data + offset, ppslen); + } + + offset += ppslen; + i++; + } + + if (!m_bVideoReady) + { + m_bVideoReady = TRUE; + http_flv_send_notify(HTTP_FLV_EVE_VIDEOREADY); + } + + if (m_nSpsLen > 0 && m_nPpsLen > 0) + { + http_flv_video_data_cb(m_pSps, m_nSpsLen, 0); + http_flv_video_data_cb(m_pPps, m_nPpsLen, 0); + } + } + else if (data[1] == 0x01) // AVC NALU + { + if (size < 10) + { + log_print(HT_LOG_WARN, "%s, dataLen=%d\r\n", __FUNCTION__, size); + return 0; + } + + int len = 0; + int num = 5; + + while (num < (int)size) + { + len = (data[num] & 0x000000FF) << 24 | (data[num + 1] & 0x000000FF) << 16 | + (data[num + 2] & 0x000000FF) << 8 | (data[num + 3] & 0x000000FF); + + num = num + 4; + + data[num-4]= 0; + data[num-3]= 0; + data[num-2]= 0; + data[num-1]= 1; + + http_flv_video_data_cb(data + num - 4, len + 4, ts); + + num = num + len; + } + } + else + { + log_print(HT_LOG_WARN, "%s, tag type [%02x]!!!\r\n", __FUNCTION__, data[1]); + } + + return 0; +} + +int CHttpFlvClient::http_flv_h265_rx(uint8 * data, uint32 size, uint32 ts) +{ + if (data[1] == 0x00) // AVC sequence header + { + if (size < 32) + { + log_print(HT_LOG_WARN, "%s, dataLen=%d\r\n", __FUNCTION__, size); + return 0; + } + + uint32 offset = 5 + 22; + int numOfArrays = data[offset++]; + + for (int i=0; i size) + { + return -1; + } + + if (naluType == HEVC_NAL_VPS && 0 == m_nVpsLen && naluLen <= sizeof(m_pVps) + 4) + { + m_pVps[0] = 0; + m_pVps[1] = 0; + m_pVps[2] = 0; + m_pVps[3] = 1; + memcpy(m_pVps+4, data+offset, naluLen); + m_nVpsLen = naluLen + 4; + } + else if (naluType == HEVC_NAL_SPS && 0 == m_nSpsLen && naluLen <= sizeof(m_pSps) + 4) + { + m_pSps[0] = 0; + m_pSps[1] = 0; + m_pSps[2] = 0; + m_pSps[3] = 1; + memcpy(m_pSps+4, data+offset, naluLen); + m_nSpsLen = naluLen + 4; + } + else if (naluType == HEVC_NAL_PPS && 0 == m_nPpsLen && naluLen <= sizeof(m_pPps) + 4) + { + m_pPps[0] = 0; + m_pPps[1] = 0; + m_pPps[2] = 0; + m_pPps[3] = 1; + memcpy(m_pPps+4, data+offset, naluLen); + m_nPpsLen = naluLen + 4; + } + + offset += naluLen; + } + } + + if (!m_bVideoReady) + { + m_bVideoReady = TRUE; + http_flv_send_notify(HTTP_FLV_EVE_VIDEOREADY); + } + + if (m_nVpsLen > 0 && m_nSpsLen > 0 && m_nPpsLen > 0) + { + http_flv_video_data_cb(m_pVps, m_nVpsLen, 0); + http_flv_video_data_cb(m_pSps, m_nSpsLen, 0); + http_flv_video_data_cb(m_pPps, m_nPpsLen, 0); + } + } + else if (data[1] == 0x01) // AVC NALU + { + if (size < 10) + { + log_print(HT_LOG_WARN, "%s, dataLen=%d\r\n", __FUNCTION__, size); + return 0; + } + + int len = 0; + int num = 5; + + while (num < (int)size) + { + len = (data[num] & 0x000000FF) << 24 | (data[num + 1] & 0x000000FF) << 16 | + (data[num + 2] & 0x000000FF) << 8 | (data[num + 3] & 0x000000FF); + + num = num + 4; + + data[num-4]= 0; + data[num-3]= 0; + data[num-2]= 0; + data[num-1]= 1; + + http_flv_video_data_cb(data + num - 4, len + 4, ts); + + num = num + len; + } + } + else + { + log_print(HT_LOG_WARN, "%s, tag type [%02x]!!!\r\n", __FUNCTION__, data[1]); + } + + return 0; +} + +int CHttpFlvClient::http_flv_video_rx(uint8 * data, uint32 size, uint32 ts) +{ + int ret = 0; + uint8 v_type = data[0]; + v_type = (v_type & 0x0f); + + if (v_type == 2) // Sorenson H.263 + { + } + else if (v_type == 3) // Screen video + { + } + else if (v_type == 4) // On2 VP6 + { + } + else if (v_type == 5) // On2 VP6 with alpha channel + { + } + else if (v_type == 6) // Screen video version 2 + { + } + else if (v_type == 7) // AVC + { + m_nVideoCodec = VIDEO_CODEC_H264; + + ret = http_flv_h264_rx(data, size, ts); + } + else if (v_type == 12) // H265 + { + m_nVideoCodec = VIDEO_CODEC_H265; + + ret = http_flv_h265_rx(data, size, ts); + } + + return ret; +} + +int CHttpFlvClient::http_flv_g711_rx(uint8 * data, uint32 size, uint32 ts) +{ + if (!m_bAudioReady) + { + m_nChannels = ((data[0] & 0x01) ? 2 : 1); + m_nSamplerate = 8000; + m_bAudioReady = TRUE; + + http_flv_send_notify(HTTP_FLV_EVE_AUDIOREADY); + } + + http_flv_audio_data_cb(data + 1, size - 1, ts); + + return 0; +} + +int CHttpFlvClient::http_flv_aac_rx(uint8 * data, uint32 size, uint32 ts) +{ + if (size < 4) + { + return -1; + } + + // AAC Packet Type: 0x00 - AAC Sequence Header; 0x01 - AAC Raw + if (data[1] == 0x00) + { + int nAudioSampleType; + + log_print(HT_LOG_DBG, "%s, len[%u] data[%02X %02X %02X %02X]\r\n", + __FUNCTION__, size, data[0], data[1], data[2], data[3]); + + memcpy(m_pAudioConfig, data+2, 2); + m_nAudioConfigLen = 2; + m_nChannels = ((data[0] & 0x01) ? 2 : 1); // Whether stereo (0: Mono, 1: Stereo) + nAudioSampleType = (data[0] & 0x0c) >> 2; // Audio sample rate (0: 5.5kHz, 1:11KHz, 2:22 kHz, 3:44 kHz) + + switch (nAudioSampleType) + { + case 0: + m_nSamplerate = 5500; + break; + + case 1: + m_nSamplerate = 11025; + break; + + case 2: + m_nSamplerate = 22050; + break; + + case 3: + m_nSamplerate = 44100; + break; + + default: + m_nSamplerate = 44100; + break; + } + + uint16 audioSpecificConfig = 0; + + audioSpecificConfig = (data[2] & 0xff) << 8; + audioSpecificConfig += 0x00ff & data[3]; + + uint8 nSampleFrequencyIndex = (audioSpecificConfig & 0x0780) >> 7; + uint8 nChannels = (audioSpecificConfig & 0x78) >> 3; + + m_nChannels = nChannels; + + switch (nSampleFrequencyIndex) + { + case 0: + m_nSamplerate = 96000; + break; + + case 1: + m_nSamplerate = 88200; + break; + + case 2: + m_nSamplerate = 64000; + break; + + case 3: + m_nSamplerate = 48000; + break; + + case 4: + m_nSamplerate = 44100; + break; + + case 5: + m_nSamplerate = 32000; + break; + + case 6: + m_nSamplerate = 24000; + break; + + case 7: + m_nSamplerate = 22050; + break; + + case 8: + m_nSamplerate = 16000; + break; + + case 9: + m_nSamplerate = 12000; + break; + + case 10: + m_nSamplerate = 11025; + break; + + case 11: + m_nSamplerate = 8000; + break; + + case 12: + m_nSamplerate = 7350; + break; + + default: + m_nSamplerate = 44100; + break; + } + + if (!m_bAudioReady) + { + m_bAudioReady = TRUE; + http_flv_send_notify(HTTP_FLV_EVE_AUDIOREADY); + } + } + else if (data[1] == 0x01) + { + http_flv_audio_data_cb(data + 2, size - 2, ts); + } + + return 0; +} + +int CHttpFlvClient::http_flv_audio_rx(uint8 * data, uint32 size, uint32 ts) +{ + int ret = 0; + uint8 a_type = data[0]; + a_type = a_type >> 4; + + if (a_type == 0) // Linear PCM, platform endian + { + } + else if (a_type == 1) // ADPCM + { + } + else if (a_type == 2) // MP3 + { + } + else if (a_type == 3) // Linear PCM, little endian + { + } + else if (a_type == 7) // G711A + { + m_nAudioCodec = AUDIO_CODEC_G711A; + + ret = http_flv_g711_rx(data, size, ts); + } + else if (a_type == 8) // G711U + { + m_nAudioCodec = AUDIO_CODEC_G711U; + + ret = http_flv_g711_rx(data, size, ts); + } + else if (a_type == 10) // AAC + { + m_nAudioCodec = AUDIO_CODEC_AAC; + + ret = http_flv_aac_rx(data, size, ts); + } + else if (a_type == 11) // Speex + { + } + else if (a_type == 14) // MP3 8-Khz + { + } + + return ret; +} + +int CHttpFlvClient::http_flv_metadata_rx(uint8 * data, uint32 size) +{ + AMFObject obj; + AVal val; + AMFObjectProperty * property; + AMFObject subObject; + + int nRes = AMF_Decode(&obj, (char*)data, size, FALSE); + if (nRes < 0) + { + log_print(HT_LOG_ERR, "%s, error decoding invoke packet\r\n", __FUNCTION__); + return -1; + } + + AMF_Dump(&obj); + + for (int n = 0; n < obj.o_num; n++) + { + property = AMF_GetProp(&obj, NULL, n); + if (NULL == property) + { + continue; + } + + if (property->p_type == AMF_OBJECT || property->p_type == AMF_ECMA_ARRAY) + { + AMFProp_GetObject(property, &subObject); + + for (int m = 0; m < subObject.o_num; m++) + { + property = AMF_GetProp(&subObject, NULL, m); + if (NULL == property) + { + continue; + } + + if (property->p_type == AMF_OBJECT) + { + } + else if (property->p_type == AMF_BOOLEAN) + { + int bVal = AMFProp_GetBoolean(property); + if (strncmp("stereo", property->p_name.av_val, property->p_name.av_len) == 0) + { + m_nChannels = bVal > 0 ? 2 : 1; + } + } + else if (property->p_type == AMF_NUMBER) + { + double dVal = AMFProp_GetNumber(property); + if (strncmp("width", property->p_name.av_val, property->p_name.av_len) == 0) + { + m_nWidth = (int)dVal; + } + else if (strcasecmp("height", property->p_name.av_val) == 0) + { + m_nHeight = (int)dVal; + } + else if (strcasecmp("framerate", property->p_name.av_val) == 0) + { + m_nFrameRate = dVal; + } + else if (strcasecmp("videocodecid", property->p_name.av_val) == 0) + { + switch ((int)dVal) + { + case 7: + m_nVideoCodec = VIDEO_CODEC_H264; + break; + case 12: + m_nVideoCodec = VIDEO_CODEC_H265; + break; + } + } + else if (strcasecmp("audiosamplerate", property->p_name.av_val) == 0) + { + m_nSamplerate = (int)dVal; + } + else if (strcasecmp("audiosamplesize", property->p_name.av_val) == 0) + { + } + else if (strcasecmp("audiocodecid", property->p_name.av_val) == 0) + { + switch ((int)dVal) + { + case 7: + m_nAudioCodec = AUDIO_CODEC_G711A; + break; + case 8: + m_nAudioCodec = AUDIO_CODEC_G711U; + break; + case 10: + m_nAudioCodec = AUDIO_CODEC_AAC; + break; + } + } + else if (strcasecmp("filesize", property->p_name.av_val) == 0) + { + } + } + else if (property->p_type == AMF_STRING) + { + AMFProp_GetString(property, &val); + } + } + } + else + { + AMFProp_GetString(property, &val); + } + } + + AMF_Reset(&obj); + + if (m_nVideoCodec != VIDEO_CODEC_NONE && !m_bVideoReady) + { + m_bVideoReady = TRUE; + http_flv_send_notify(HTTP_FLV_EVE_VIDEOREADY); + } + + if (m_nAudioCodec != AUDIO_CODEC_NONE && !m_bAudioReady) + { + m_bAudioReady = TRUE; + http_flv_send_notify(HTTP_FLV_EVE_AUDIOREADY); + } + + return 0; +} + +BOOL CHttpFlvClient::http_flv_res_rx(HTTPREQ * p_http) +{ + if (http_is_http_msg(p_http->rbuf) == FALSE) + { + log_print(HT_LOG_ERR, "%s, invalid http msg\r\n", __FUNCTION__); + return FALSE; + } + + int http_pkt_len = http_pkt_find_end(p_http->rbuf); + if (http_pkt_len == 0) + { + return TRUE; + } + + p_http->hdr_len = http_pkt_len; + + HTTPMSG * rx_msg = http_get_msg_buf(http_pkt_len + 1); + if (rx_msg == NULL) + { + log_print(HT_LOG_ERR, "%s, get_msg_buf ret null!!!\r\n", __FUNCTION__); + return FALSE; + } + + memcpy(rx_msg->msg_buf, p_http->rbuf, http_pkt_len); + rx_msg->msg_buf[http_pkt_len] = '\0'; + + log_print(HT_LOG_DBG, "RX from %s << %s\r\n", p_http->host, rx_msg->msg_buf); + + int parse_len = http_msg_parse_part1(rx_msg->msg_buf, http_pkt_len, rx_msg); + if (parse_len != http_pkt_len) + { + log_print(HT_LOG_ERR, "%s, http_msg_parse_part1=%d, http_pkt_len=%d!!!\r\n", + __FUNCTION__, parse_len, http_pkt_len); + + http_free_msg(rx_msg); + return FALSE; + } + + if (rx_msg->msg_sub_type != 200) + { + http_free_msg(rx_msg); + return FALSE; + } + + if (rx_msg->ctt_type != CTT_FLV) + { + http_free_msg(rx_msg); + return FALSE; + } + + char * p_encoding = http_get_headline(rx_msg, "Transfer-Encoding"); + if (p_encoding) + { + if (strcasecmp(p_encoding, "chunked") == 0) + { + m_bChunked = TRUE; + } + } + + http_free_msg(rx_msg); + + p_http->rcv_dlen -= p_http->hdr_len; + + if (p_http->rcv_dlen > 0) + { + memmove(p_http->rbuf, p_http->rbuf+p_http->hdr_len, p_http->rcv_dlen); + } + else + { + if (p_http->dyn_recv_buf) + { + free(p_http->dyn_recv_buf); + p_http->dyn_recv_buf = NULL; + } + + p_http->rbuf = NULL; + p_http->rcv_dlen = 0; + p_http->mlen = 0; + } + + return TRUE; +} + +BOOL CHttpFlvClient::http_flv_data_handler(HTTPREQ * p_http) +{ + // At least received FLV TAG header length + if (p_http->rcv_dlen < 11) + { + return TRUE; + } + + uint8 * p = (uint8 *)p_http->rbuf; + uint32 size = (uint32)((p[1] << 16) | (p[2] << 8) | p[3]); + + // Tag header length + data size + PreviousTagSize + (chunked '\r\n') + int tlen = 11 + size + 4 + (m_bChunked ? 2 : 0); + + if (p_http->rcv_dlen < tlen) + { + // The receive buffer is not enough, allocate memory + + if (p_http->mlen < tlen) + { + char * old_recv_buf = p_http->dyn_recv_buf; + + p_http->dyn_recv_buf = (char *)malloc(tlen); + if (NULL == p_http->dyn_recv_buf) + { + if (old_recv_buf) + { + free(old_recv_buf); + } + + return FALSE; + } + else + { + memmove(p_http->dyn_recv_buf, p_http->rbuf, p_http->rcv_dlen); + + p_http->mlen = tlen; + p_http->rbuf = p_http->dyn_recv_buf; + + // Free the old receive buffer + if (old_recv_buf) + { + free(old_recv_buf); + } + } + } + } + else + { + int ret = 0; + int type = p[0]; + uint32 ts = (uint32)((p[4] << 16) | (p[5] << 8) | p[6] | (p[7] << 24)); + + if (8 == type) + { + ret = http_flv_audio_rx((uint8 *)p+11, size, ts); + } + else if (9 == type) + { + ret = http_flv_video_rx((uint8 *)p+11, size, ts); + } + else if (18 == type) + { + ret = http_flv_metadata_rx((uint8 *)p+11, size); + } + + p_http->rcv_dlen -= tlen; + + if (p_http->rcv_dlen > 0) + { + memmove(p_http->rbuf, p_http->rbuf+tlen, p_http->rcv_dlen); + } + else + { + if (p_http->dyn_recv_buf) + { + free(p_http->dyn_recv_buf); + p_http->dyn_recv_buf = NULL; + } + + p_http->rbuf = NULL; + p_http->rcv_dlen = 0; + p_http->mlen = 0; + } + + if (ret < 0) + { + return FALSE; + } + } + + return TRUE; +} + +BOOL CHttpFlvClient::http_flv_header_rx(HTTPREQ * p_http) +{ + if (p_http->rbuf[0] != 'F' || p_http->rbuf[1] != 'L' || p_http->rbuf[2] != 'V') + { + return FALSE; + } + + m_bFlvHeader = TRUE; + + return TRUE; +} + +BOOL CHttpFlvClient::http_flv_chunked(HTTPREQ * p_http) +{ + int i = 0; + char buff[32] = {'\0'}; + char * p = p_http->rbuf; + + // Get the data length of the hexadecimal string + + while (i < p_http->rcv_dlen - 1) + { + if (p[i] == '\r' && p[i+1] == '\n') + { + i += 2; + break; + } + else if (i < 31) + { + buff[i] = p[i]; + } + + ++i; + } + + // Need more data + if (i >= p_http->rcv_dlen - 1) + { + return FALSE; + } + + int len = strtol(buff, NULL, 16); // data length + int tlen = len + i + 2; // Data length + length itself +'\r\n' + + if (p_http->rcv_dlen < tlen) + { + // The receive buffer is not enough, allocate memory + + if (p_http->mlen < tlen) + { + char * old_recv_buf = p_http->dyn_recv_buf; + + p_http->dyn_recv_buf = (char *)malloc(tlen); + if (NULL == p_http->dyn_recv_buf) + { + // What should do if the allocation fails? + + // Free the old receive buffer + if (old_recv_buf) + { + free(old_recv_buf); + } + + return FALSE; + } + else + { + memmove(p_http->dyn_recv_buf, p_http->rbuf, p_http->rcv_dlen); + + p_http->mlen = tlen; + p_http->rbuf = p_http->dyn_recv_buf; + + // Free the old receive buffer + if (old_recv_buf) + { + free(old_recv_buf); + } + } + } + + // Need more data + return FALSE; + } + + // skip length + p_http->mlen -= i; + p_http->rcv_dlen -= i; + p_http->rbuf += i; + + return TRUE; +} + +BOOL CHttpFlvClient::http_flv_data_rx(HTTPREQ * p_http) +{ + if (m_bChunked) + { + if (!http_flv_chunked(p_http)) + { + return TRUE; + } + } + + if (!m_bFlvHeader) + { + // Receive FLV header + + int headsize = 13 + (m_bChunked ? 2 : 0); + + if (p_http->rcv_dlen >= headsize) + { + if (!http_flv_header_rx(p_http)) + { + return FALSE; + } + else + { + // skip flv header + p_http->mlen -= headsize; + p_http->rcv_dlen -= headsize; + p_http->rbuf += headsize; + + if (m_bChunked) + { + if (!http_flv_chunked(p_http)) + { + return TRUE; + } + } + } + } + else + { + // Need more data + return TRUE; + } + } + + if (m_bFlvHeader) + { + return http_flv_data_handler(p_http); + } + + return TRUE; +} + +int CHttpFlvClient::http_flv_rx(HTTPREQ * p_http) +{ + int rlen; + int sret; + fd_set fdread; + struct timeval tv = {1, 0}; + + FD_ZERO(&fdread); + FD_SET(p_http->cfd, &fdread); + +#ifdef HTTPS + if (p_http->https && SSL_pending(p_http->ssl) > 0) + { + // There is data to read + } + else +#endif + { + sret = select((int)(p_http->cfd+1), &fdread, NULL, NULL, &tv); + if (sret == 0) // Time expired + { + return HTTP_FLV_RX_TIMEOUT; + } + else if (!FD_ISSET(p_http->cfd, &fdread)) + { + return HTTP_FLV_RX_TIMEOUT; + } + } + + if (p_http->rbuf == NULL) + { + p_http->rbuf = p_http->rcv_buf; + p_http->mlen = sizeof(p_http->rcv_buf)-4; + p_http->rcv_dlen = 0; + } + +#ifdef HTTPS + if (p_http->https) + { + rlen = SSL_read(p_http->ssl, p_http->rbuf+p_http->rcv_dlen, p_http->mlen-p_http->rcv_dlen); + } + else +#endif + rlen = recv(p_http->cfd, p_http->rbuf+p_http->rcv_dlen, p_http->mlen-p_http->rcv_dlen, 0); + + if (rlen <= 0) + { + log_print(HT_LOG_INFO, "%s, recv return = %d, dlen[%d], mlen[%d]\r\n", + __FUNCTION__, rlen, p_http->rcv_dlen, p_http->mlen); + return HTTP_FLV_RX_FAIL; + } + + p_http->rcv_dlen += rlen; + + if (p_http->rcv_dlen < 16) + { + return HTTP_FLV_RX_SUCC; + } + + if (p_http->hdr_len == 0) + { + // Receive GET request response + + if (!http_flv_res_rx(p_http)) + { + return HTTP_FLV_RX_FAIL; + } + else if (p_http->hdr_len > 0 && p_http->rcv_dlen > 0) + { + // There is still data that has not been processed + + if (!http_flv_data_rx(p_http)) + { + return HTTP_FLV_RX_FAIL; + } + } + } + else if (!http_flv_data_rx(p_http)) + { + return HTTP_FLV_RX_FAIL; + } + + // Need to receive more data + + return HTTP_FLV_RX_SUCC; +} + +void CHttpFlvClient::rx_thread() +{ + int ret = 0; + int tm_count = 0; + BOOL nodata_notify = FALSE; + + if (!http_flv_connect()) + { + m_tidRx = 0; + http_flv_send_notify(HTTP_FLV_EVE_CONNFAIL); + return; + } + + while (m_bRunning) + { + ret = http_flv_rx(&m_http); + if (ret == HTTP_FLV_RX_FAIL) + { + break; + } + else + { + if (ret == HTTP_FLV_RX_TIMEOUT) + { + tm_count++; + if (tm_count >= m_nRxTimeout && !nodata_notify) // in 10s without data + { + nodata_notify = TRUE; + http_flv_send_notify(HTTP_FLV_EVE_NODATA); + } + } + else // should be HTTP_FLV_RX_SUCC + { + if (nodata_notify) + { + nodata_notify = FALSE; + http_flv_send_notify(HTTP_FLV_EVE_RESUME); + } + + tm_count = 0; + } + } + } + + m_tidRx = 0; + http_flv_send_notify(HTTP_FLV_EVE_STOPPED); + + log_print(HT_LOG_INFO, "%s, exit\r\n", __FUNCTION__); +} + +void CHttpFlvClient::http_flv_send_notify(int event) +{ + sys_os_mutex_enter(m_pMutex); + + if (m_pNotify) + { + m_pNotify(event, m_pUserdata); + } + + sys_os_mutex_leave(m_pMutex); +} + +void CHttpFlvClient::http_flv_video_data_cb(uint8 * p_data, int len, uint32 ts) +{ + if (m_nVideoInitTS == 0 && ts != 0) + { + m_nVideoInitTS = ts; + } + + sys_os_mutex_enter(m_pMutex); + if (m_pVideoCB) + { + m_pVideoCB(p_data, len, ts, m_pUserdata); + } + sys_os_mutex_leave(m_pMutex); +} + +void CHttpFlvClient::http_flv_audio_data_cb(uint8 * p_data, int len, uint32 ts) +{ + if (m_nAudioInitTS == 0 && ts != 0) + { + m_nAudioInitTS = ts; + } + + sys_os_mutex_enter(m_pMutex); + if (m_pAudioCB) + { + m_pAudioCB(p_data, len, ts, m_pUserdata); + } + sys_os_mutex_leave(m_pMutex); +} + +void CHttpFlvClient::get_h264_params() +{ + if (m_nSpsLen > 0) + { + http_flv_video_data_cb(m_pSps, m_nSpsLen, 0); + } + + if (m_nPpsLen > 0) + { + http_flv_video_data_cb(m_pPps, m_nPpsLen, 0); + } +} + +BOOL CHttpFlvClient::get_h264_params(uint8 * p_sps, int * sps_len, uint8 * p_pps, int * pps_len) +{ + if (m_nSpsLen > 0) + { + *sps_len = m_nSpsLen; + memcpy(p_sps, m_pSps, m_nSpsLen); + } + + if (m_nPpsLen > 0) + { + *pps_len = m_nPpsLen; + memcpy(p_pps, m_pPps, m_nPpsLen); + } + + return TRUE; +} + +void CHttpFlvClient::get_h265_params() +{ + if (m_nVpsLen > 0) + { + http_flv_video_data_cb(m_pVps, m_nVpsLen, 0); + } + + if (m_nSpsLen > 0) + { + http_flv_video_data_cb(m_pSps, m_nSpsLen, 0); + } + + if (m_nPpsLen > 0) + { + http_flv_video_data_cb(m_pPps, m_nPpsLen, 0); + } +} + +BOOL CHttpFlvClient::get_h265_params(uint8 * p_sps, int * sps_len, uint8 * p_pps, int * pps_len, uint8 * p_vps, int * vps_len) +{ + if (m_nVpsLen > 0) + { + *vps_len = m_nVpsLen; + memcpy(p_vps, m_pVps, m_nVpsLen); + } + + if (m_nSpsLen > 0) + { + *sps_len = m_nSpsLen; + memcpy(p_sps, m_pSps, m_nSpsLen); + } + + if (m_nPpsLen > 0) + { + *pps_len = m_nPpsLen; + memcpy(p_pps, m_pPps, m_nPpsLen); + } + + return TRUE; +} + +void CHttpFlvClient::set_notify_cb(http_flv_notify_cb notify, void * userdata) +{ + sys_os_mutex_enter(m_pMutex); + m_pNotify = notify; + m_pUserdata = userdata; + sys_os_mutex_leave(m_pMutex); +} + +void CHttpFlvClient::set_video_cb(http_flv_video_cb cb) +{ + sys_os_mutex_enter(m_pMutex); + m_pVideoCB = cb; + sys_os_mutex_leave(m_pMutex); +} + +void CHttpFlvClient::set_audio_cb(http_flv_audio_cb cb) +{ + sys_os_mutex_enter(m_pMutex); + m_pAudioCB = cb; + sys_os_mutex_leave(m_pMutex); +} + +void CHttpFlvClient::set_rx_timeout(int timeout) +{ + m_nRxTimeout = timeout; +} + + + diff --git a/MediaClient/MediaClient/http/http_flv_cln.h b/MediaClient/MediaClient/http/http_flv_cln.h new file mode 100644 index 0000000..bd098e2 --- /dev/null +++ b/MediaClient/MediaClient/http/http_flv_cln.h @@ -0,0 +1,151 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef HTTP_FLV_CLN_H +#define HTTP_FLV_CLN_H + +#include "rtmp.h" +#include "http.h" + + +#define HTTP_FLV_EVE_STOPPED 80 +#define HTTP_FLV_EVE_CONNECTING 81 +#define HTTP_FLV_EVE_CONNFAIL 82 +#define HTTP_FLV_EVE_NOSIGNAL 83 +#define HTTP_FLV_EVE_RESUME 84 +#define HTTP_FLV_EVE_AUTHFAILED 85 +#define HTTP_FLV_EVE_NODATA 86 +#define HTTP_FLV_EVE_VIDEOREADY 87 +#define HTTP_FLV_EVE_AUDIOREADY 88 + +#define HTTP_FLV_RX_FAIL -1 +#define HTTP_FLV_RX_TIMEOUT 1 +#define HTTP_FLV_RX_SUCC 2 + +typedef int (*http_flv_notify_cb)(int, void *); +typedef int (*http_flv_video_cb)(uint8 *, int, uint32, void *); +typedef int (*http_flv_audio_cb)(uint8 *, int, uint32, void *); + + +class CHttpFlvClient +{ +public: + CHttpFlvClient(void); + ~CHttpFlvClient(void); + +public: + BOOL http_flv_start(const char * url, const char * user, const char * pass); + BOOL http_flv_play(); + BOOL http_flv_stop(); + BOOL http_flv_pause(); + BOOL http_flv_close(); + + char * get_url() {return m_url;} + char * get_user() {return m_user;} + char * get_pass() {return m_pass;} + int audio_codec() {return m_nAudioCodec;} + int video_codec() {return m_nVideoCodec;} + void get_h264_params(); + BOOL get_h264_params(uint8 * p_sps, int * sps_len, uint8 * p_pps, int * pps_len); + void get_h265_params(); + BOOL get_h265_params(uint8 * p_sps, int * sps_len, uint8 * p_pps, int * pps_len, uint8 * p_vps, int * vps_len); + int get_video_width() {return m_nWidth;} + int get_video_height() {return m_nHeight;} + double get_video_framerate() {return m_nFrameRate;} + int get_audio_samplerate() {return m_nSamplerate;} + int get_audio_channels() {return m_nChannels;} + uint8 * get_audio_config() {return m_pAudioConfig;} + int get_audio_config_len() {return m_nAudioConfigLen;} + uint32 get_video_init_ts() {return m_nVideoInitTS;} + uint32 get_audio_init_ts() {return m_nAudioInitTS;} + + void set_notify_cb(http_flv_notify_cb notify, void * userdata); + void set_video_cb(http_flv_video_cb cb); + void set_audio_cb(http_flv_audio_cb cb); + void set_rx_timeout(int timeout); + + void rx_thread(); + void http_flv_video_data_cb(uint8 * p_data, int len, uint32 ts); + void http_flv_audio_data_cb(uint8 * p_data, int len, uint32 ts); + +private: + BOOL http_flv_req(HTTPREQ * p_http); + BOOL http_flv_connect(); + int http_flv_h264_rx(uint8 * data, uint32 size, uint32 ts); + int http_flv_h265_rx(uint8 * data, uint32 size, uint32 ts); + int http_flv_video_rx(uint8 * data, uint32 size, uint32 ts); + int http_flv_g711_rx(uint8 * data, uint32 size, uint32 ts); + int http_flv_aac_rx(uint8 * data, uint32 size, uint32 ts); + int http_flv_audio_rx(uint8 * data, uint32 size, uint32 ts); + int http_flv_metadata_rx(uint8 * data, uint32 size); + BOOL http_flv_res_rx(HTTPREQ * p_http); + BOOL http_flv_data_handler(HTTPREQ * p_http); + BOOL http_flv_header_rx(HTTPREQ * p_http); + BOOL http_flv_chunked(HTTPREQ * p_http); + BOOL http_flv_data_rx(HTTPREQ * p_http); + int http_flv_rx(HTTPREQ * p_http); + void http_flv_send_notify(int event); + +private: + char m_url[512]; + char m_user[64]; + char m_pass[64]; + + HTTPREQ m_http; + BOOL m_bRunning; + BOOL m_bVideoReady; + BOOL m_bAudioReady; + BOOL m_bChunked; + BOOL m_bFlvHeader; + pthread_t m_tidRx; + + uint8 m_pVps[256]; + int m_nVpsLen; + uint8 m_pSps[256]; + int m_nSpsLen; + uint8 m_pPps[256]; + int m_nPpsLen; + + uint8 m_pAudioConfig[32]; + uint32 m_nAudioConfigLen; + + int m_nVideoCodec; + int m_nWidth; + int m_nHeight; + double m_nFrameRate; + int m_nAudioCodec; + int m_nSamplerate; + int m_nChannels; + + uint32 m_nVideoInitTS; + uint32 m_nAudioInitTS; + + http_flv_notify_cb m_pNotify; + void * m_pUserdata; + http_flv_video_cb m_pVideoCB; + http_flv_audio_cb m_pAudioCB; + void * m_pMutex; + int m_nRxTimeout; +}; + +#endif + + + + diff --git a/MediaClient/MediaClient/http/http_mjpeg_cln.cpp b/MediaClient/MediaClient/http/http_mjpeg_cln.cpp new file mode 100644 index 0000000..61b9882 --- /dev/null +++ b/MediaClient/MediaClient/http/http_mjpeg_cln.cpp @@ -0,0 +1,674 @@ +/*************************************************************************************** + * + * 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.h" +#include "http_parse.h" +#include "http_cln.h" +#include "http_mjpeg_cln.h" + + +void * mjpeg_rx_thread(void * argv) +{ + CHttpMjpeg * p_mjpeg = (CHttpMjpeg *)argv; + + p_mjpeg->rx_thread(); + + return NULL; +} + + +CHttpMjpeg::CHttpMjpeg(void) +: m_running(FALSE) +, m_rx_tid(0) +, m_header(FALSE) +, m_pNotify(NULL) +, m_pUserdata(NULL) +, m_pVideoCB(NULL) +, m_pMutex(NULL) +, m_nRxTimeout(10) +{ + memset(&m_http, 0, sizeof(m_http)); + memset(m_url, 0, sizeof(m_url)); + + m_pMutex = sys_os_create_mutex(); +} + +CHttpMjpeg::~CHttpMjpeg(void) +{ + mjpeg_close(); + + if (m_pMutex) + { + sys_os_destroy_sig_mutex(m_pMutex); + m_pMutex = NULL; + } +} + +BOOL CHttpMjpeg::mjpeg_start(const char * url, const char * user, const char * pass) +{ + int port, https=0; + char proto[32], username[64], password[64], host[100], path[200]; + + url_split(url, proto, sizeof(proto), username, sizeof(username), + password, sizeof(password), host, sizeof(host), &port, path, sizeof(path)); + + if (strcasecmp(proto, "https") == 0) + { + https = 1; + port = (port == -1) ? 443 : port; + } + else if (strcasecmp(proto, "http") == 0) + { + port = (port == -1) ? 80 : port; + } + else + { + return FALSE; + } + + if (host[0] == '\0') + { + return FALSE; + } + + strncpy(m_http.host, host, sizeof(m_http.host) - 1); + + if (username[0] != '\0') + { + strcpy(m_http.auth_info.auth_name, username); + } + else if (user && user[0] != '\0') + { + strcpy(m_http.auth_info.auth_name, user); + } + + if (password[0] != '\0') + { + strcpy(m_http.auth_info.auth_pwd, password); + } + else if (pass && pass[0] != '\0') + { + strcpy(m_http.auth_info.auth_pwd, pass); + } + + if (path[0] != '\0') + { + strcpy(m_http.url, path); + strcpy(m_http.auth_info.auth_uri, path); + } + + m_http.port = port; + m_http.https = https; + strncpy(m_url, url, sizeof(m_url)-1); + + m_running = TRUE; + m_rx_tid = sys_os_create_thread((void *)mjpeg_rx_thread, this); + if (m_rx_tid == 0) + { + log_print(HT_LOG_ERR, "%s, sys_os_create_thread failed!!!\r\n", __FUNCTION__); + return FALSE; + } + + return TRUE; +} + +BOOL CHttpMjpeg::mjpeg_stop() +{ + return mjpeg_close(); +} + +BOOL CHttpMjpeg::mjpeg_close() +{ + sys_os_mutex_enter(m_pMutex); + m_pVideoCB = NULL; + m_pNotify = NULL; + m_pUserdata = NULL; + sys_os_mutex_leave(m_pMutex); + +#ifdef HTTPS + if (m_http.https && m_http.ssl) + { + SSL_shutdown(m_http.ssl); + } +#endif + + if (m_http.cfd > 0) + { + closesocket(m_http.cfd); + m_http.cfd = 0; + } + + m_running = FALSE; + + while (m_rx_tid != 0) + { + usleep(10*1000); + } + + http_cln_free_req(&m_http); + + m_header = 0; + memset(&m_http, 0, sizeof(m_http)); + + return TRUE; +} + +BOOL CHttpMjpeg::mjpeg_req(HTTPREQ * p_http) +{ + int ret; + int offset = 0; + char bufs[1024]; + int buflen = sizeof(bufs); + + offset += snprintf(bufs+offset, buflen-offset, "GET %s HTTP/1.1\r\n", p_http->url); + offset += snprintf(bufs+offset, buflen-offset, "Host: %s:%u\r\n", p_http->host, p_http->port); + offset += snprintf(bufs+offset, buflen-offset, "Accept: */*\r\n"); + offset += snprintf(bufs+offset, buflen-offset, "User-Agent: happytimesoft/1.0\r\n"); + offset += snprintf(bufs+offset, buflen-offset, "Range: bytes=0-\r\n"); + + if (p_http->need_auth) + { + offset += http_build_auth_msg(p_http, "GET", bufs+offset, buflen-offset); + } + + offset += snprintf(bufs+offset, buflen-offset, "\r\n"); + + bufs[offset] = '\0'; + + log_print(HT_LOG_DBG, "TX >> %s\r\n", bufs); + + ret = http_cln_tx(p_http, bufs, offset); + + return (ret == offset) ? TRUE : FALSE; +} + +BOOL CHttpMjpeg::mjpeg_conn(HTTPREQ * p_http, int timeout) +{ + p_http->cfd = tcp_connect_timeout(inet_addr(p_http->host), p_http->port, timeout); + if (p_http->cfd <= 0) + { + log_print(HT_LOG_ERR, "%s, tcp_connect_timeout\r\n", __FUNCTION__); + return FALSE; + } + + if (p_http->https) + { +#ifdef HTTPS + if (!http_cln_ssl_conn(p_http, timeout)) + { + return FALSE; + } +#else + log_print(HT_LOG_ERR, "%s, the server require ssl connection, unsupport!\r\n", __FUNCTION__); + return FALSE; +#endif + } + + return TRUE; +} + +int CHttpMjpeg::mjpeg_parse_header(HTTPREQ * p_http) +{ + if (http_is_http_msg(p_http->rbuf) == FALSE) + { + return -1; + } + + HTTPMSG * rx_msg = NULL; + + int parse_len; + int http_pkt_len; + + http_pkt_len = http_pkt_find_end(p_http->rbuf); + if (http_pkt_len == 0) + { + return 0; + } + + rx_msg = http_get_msg_buf(http_pkt_len+1); + if (rx_msg == NULL) + { + log_print(HT_LOG_ERR, "%s, get msg buf failed\r\n", __FUNCTION__); + return -1; + } + + memcpy(rx_msg->msg_buf, p_http->rbuf, http_pkt_len); + rx_msg->msg_buf[http_pkt_len] = '\0'; + + log_print(HT_LOG_DBG, "RX from %s << %s\r\n", p_http->host, rx_msg->msg_buf); + + parse_len = http_msg_parse_part1(rx_msg->msg_buf, http_pkt_len, rx_msg); + if (parse_len != http_pkt_len) + { + log_print(HT_LOG_ERR, "%s, http_msg_parse_part1=%d, http_pkt_len=%d!!!\r\n", + __FUNCTION__, parse_len, http_pkt_len); + + http_free_msg(rx_msg); + return -1; + } + + p_http->rx_msg = rx_msg; + + p_http->rcv_dlen -= parse_len; + if (p_http->rcv_dlen > 0) + { + memmove(p_http->rbuf, p_http->rbuf+parse_len, p_http->rcv_dlen); + } + + return 1; +} + +int CHttpMjpeg::mjpeg_parse_header_ex(HTTPREQ * p_http) +{ + HTTPMSG * rx_msg = NULL; + + int offset = 0; + int http_pkt_len; + int line_len = 0; + BOOL bHaveNextLine; + char * p_buf; + + while (*(p_http->rbuf+offset) == '\r' || *(p_http->rbuf+offset) == '\n') + { + offset++; + } + + http_pkt_len = http_pkt_find_end(p_http->rbuf+offset); + if (http_pkt_len == 0) + { + return 0; + } + p_http->hdr_len = http_pkt_len+offset; + + rx_msg = http_get_msg_buf(http_pkt_len+1); + if (rx_msg == NULL) + { + log_print(HT_LOG_ERR, "%s, get msg buf failed\r\n", __FUNCTION__); + return -1; + } + + memcpy(rx_msg->msg_buf, p_http->rbuf+offset, http_pkt_len); + rx_msg->msg_buf[http_pkt_len] = '\0'; + + // log_print(HT_LOG_DBG, "RX from %s << %s\r\n", p_http->host, rx_msg->msg_buf); + + p_buf = rx_msg->msg_buf; + +READ_LINE: + + if (GetSipLine(p_buf, http_pkt_len, &line_len, &bHaveNextLine) == FALSE) + { + return -1; + } + + if (line_len < 2) + { + return -1; + } + + offset = 0; + while (*(p_buf+offset) == '-') + { + offset++; + } + + if (strncmp(p_buf+offset, p_http->boundary, strlen(p_http->boundary))) + { + p_buf += line_len; + goto READ_LINE; + } + + p_buf += line_len; + rx_msg->hdr_len = http_line_parse(p_buf, http_pkt_len-line_len, ':', &(rx_msg->hdr_ctx)); + if (rx_msg->hdr_len <= 0) + { + return -1; + } + + http_ctt_parse(rx_msg); + + p_http->rx_msg = rx_msg; + p_http->ctt_len = rx_msg->ctt_len; + + return 1; +} + +void CHttpMjpeg::mjpeg_data_rx(uint8 * data, int len) +{ + sys_os_mutex_enter(m_pMutex); + if (m_pVideoCB) + { + m_pVideoCB(data, len, m_pUserdata); + } + sys_os_mutex_leave(m_pMutex); +} + +int CHttpMjpeg::mjpeg_rx(HTTPREQ * p_http) +{ + int ret; + int rlen; + + if (p_http->rbuf == NULL) + { + p_http->rbuf = p_http->rcv_buf; + p_http->mlen = sizeof(p_http->rcv_buf)-4; + p_http->rcv_dlen = 0; + p_http->ctt_len = 0; + p_http->hdr_len = 0; + } + +#ifdef HTTPS + if (p_http->https) + { + sys_os_mutex_enter(p_http->ssl_mutex); + rlen = SSL_read(p_http->ssl, p_http->rbuf+p_http->rcv_dlen, p_http->mlen-p_http->rcv_dlen); + sys_os_mutex_leave(p_http->ssl_mutex); + } + else +#endif + rlen = recv(p_http->cfd, p_http->rbuf+p_http->rcv_dlen, p_http->mlen-p_http->rcv_dlen, 0); + + if (rlen <= 0) + { + log_print(HT_LOG_INFO, "%s, recv return = %d, dlen[%d], mlen[%d]\r\n", + __FUNCTION__, rlen, p_http->rcv_dlen, p_http->mlen); + + closesocket(p_http->cfd); + p_http->cfd = 0; + return MJPEG_RX_ERR; + } + + p_http->rcv_dlen += rlen; + p_http->rbuf[p_http->rcv_dlen] = '\0'; + +rx_analyse_point: + + if (p_http->rcv_dlen < 16) + { + return MJPEG_MORE_DATA; + } + + if (!m_header) + { + ret = mjpeg_parse_header(p_http); + if (ret > 0) + { + if (p_http->rx_msg->msg_sub_type == 401 && p_http->need_auth == FALSE) + { + http_cln_auth_set(p_http, NULL, NULL); + + http_cln_free_req(p_http); + + return MJPEG_NEED_AUTH; + } + else if (p_http->rx_msg->msg_sub_type == 401 && p_http->need_auth == TRUE) + { + return MJPEG_AUTH_ERR; + } + + if (p_http->rx_msg->ctt_type != CTT_MULTIPART) + { + http_free_msg(p_http->rx_msg); + p_http->rx_msg = NULL; + + return MJPEG_PARSE_ERR; + } + + m_header = 1; + strcpy(p_http->boundary, p_http->rx_msg->boundary); + + http_free_msg(p_http->rx_msg); + p_http->rx_msg = NULL; + + send_notify(MJPEG_EVE_CONNSUCC); + } + else if (ret < 0) + { + return MJPEG_PARSE_ERR; + } + } + + if (!m_header) + { + return MJPEG_MORE_DATA; + } + + if (p_http->rcv_dlen < 16) + { + return MJPEG_MORE_DATA; + } + + if (p_http->hdr_len == 0) + { + ret = mjpeg_parse_header_ex(p_http); + if (ret < 0) + { + return MJPEG_PARSE_ERR; + } + else if (ret == 0) + { + return MJPEG_MORE_DATA; + } + else + { + if (p_http->rx_msg->ctt_type != CTT_JPG) + { + http_free_msg(p_http->rx_msg); + p_http->rx_msg = NULL; + + return MJPEG_PARSE_ERR; + } + + http_free_msg(p_http->rx_msg); + p_http->rx_msg = NULL; + } + } + + if ((p_http->ctt_len + p_http->hdr_len) > p_http->mlen) + { + if (p_http->dyn_recv_buf) + { + free(p_http->dyn_recv_buf); + } + + p_http->dyn_recv_buf = (char *)malloc(p_http->ctt_len + p_http->hdr_len + 1); + if (NULL == p_http->dyn_recv_buf) + { + return MJPEG_MALLOC_ERR; + } + + memcpy(p_http->dyn_recv_buf, p_http->rcv_buf, p_http->rcv_dlen); + p_http->rbuf = p_http->dyn_recv_buf; + p_http->mlen = p_http->ctt_len + p_http->hdr_len; + + return MJPEG_MORE_DATA; + } + + if (p_http->rcv_dlen >= (p_http->ctt_len + p_http->hdr_len)) + { + mjpeg_data_rx((uint8 *)p_http->rbuf+p_http->hdr_len, p_http->ctt_len); + + p_http->rcv_dlen -= p_http->hdr_len + p_http->ctt_len; + + if (p_http->dyn_recv_buf == NULL) + { + if (p_http->rcv_dlen > 0) + { + memmove(p_http->rcv_buf, p_http->rcv_buf+p_http->hdr_len + p_http->ctt_len, p_http->rcv_dlen); + p_http->rcv_buf[p_http->rcv_dlen] = '\0'; + } + + p_http->rbuf = p_http->rcv_buf; + p_http->mlen = sizeof(p_http->rcv_buf)-4; + p_http->hdr_len = 0; + p_http->ctt_len = 0; + + if (p_http->rcv_dlen > 16) + { + goto rx_analyse_point; + } + } + else + { + free(p_http->dyn_recv_buf); + p_http->dyn_recv_buf = NULL; + p_http->hdr_len = 0; + p_http->ctt_len = 0; + p_http->rbuf = NULL; + p_http->rcv_dlen = 0; + } + } + + return MJPEG_RX_SUCC; +} + +void CHttpMjpeg::rx_thread() +{ + int ret; + int tm_count = 0; + BOOL nodata_notify = FALSE; + int sret; + fd_set fdr; + struct timeval tv; + + send_notify(MJPEG_EVE_CONNECTING); + +RETRY: + + if (!mjpeg_conn(&m_http, 10*1000)) + { + send_notify(MJPEG_EVE_CONNFAIL); + goto FAILED; + } + + if (!mjpeg_req(&m_http)) + { + send_notify(MJPEG_EVE_CONNFAIL); + goto FAILED; + } + + while (m_running) + { +#ifdef HTTPS + if (m_http.https && SSL_pending(m_http.ssl) > 0) + { + // There is data to read + } + else +#endif + { + tv.tv_sec = 1; + tv.tv_usec = 0; + + FD_ZERO(&fdr); + FD_SET(m_http.cfd, &fdr); + + sret = select((int)(m_http.cfd+1), &fdr, NULL, NULL, &tv); + if (sret == 0) + { + tm_count++; + if (tm_count >= m_nRxTimeout && !nodata_notify) // in 10s without data + { + nodata_notify = TRUE; + send_notify(MJPEG_EVE_NODATA); + } + + continue; + } + else if (sret < 0) + { + log_print(HT_LOG_ERR, "%s, select err[%s], sret[%d]!!!\r\n", + __FUNCTION__, sys_os_get_socket_error(), sret); + break; + } + else if (!FD_ISSET(m_http.cfd, &fdr)) + { + continue; + } + else + { + if (nodata_notify) + { + nodata_notify = FALSE; + send_notify(MJPEG_EVE_RESUME); + } + + tm_count = 0; + } + } + + ret = mjpeg_rx(&m_http); + if (ret < 0) + { + if (ret == MJPEG_AUTH_ERR) + { + send_notify(MJPEG_EVE_AUTHFAILED); + } + + log_print(HT_LOG_ERR, "%s, mjpeg_rx failed. ret = %d\r\n", __FUNCTION__, ret); + break; + } + else if (ret == MJPEG_NEED_AUTH) + { + goto RETRY; + } + } + + send_notify(MJPEG_EVE_STOPPED); + +FAILED: + + m_rx_tid = 0; + + log_print(HT_LOG_DBG, "%s, exit\r\n", __FUNCTION__); +} + +void CHttpMjpeg::set_notify_cb(mjpeg_notify_cb notify, void * userdata) +{ + sys_os_mutex_enter(m_pMutex); + m_pNotify = notify; + m_pUserdata = userdata; + sys_os_mutex_leave(m_pMutex); +} + +void CHttpMjpeg::set_video_cb(mjpeg_video_cb cb) +{ + sys_os_mutex_enter(m_pMutex); + m_pVideoCB = cb; + sys_os_mutex_leave(m_pMutex); +} + +void CHttpMjpeg::set_rx_timeout(int timeout) +{ + m_nRxTimeout = timeout; +} + +void CHttpMjpeg::send_notify(int event) +{ + sys_os_mutex_enter(m_pMutex); + if (m_pNotify) + { + m_pNotify(event, m_pUserdata); + } + sys_os_mutex_leave(m_pMutex); +} + + + diff --git a/MediaClient/MediaClient/http/http_mjpeg_cln.h b/MediaClient/MediaClient/http/http_mjpeg_cln.h new file mode 100644 index 0000000..a6231c8 --- /dev/null +++ b/MediaClient/MediaClient/http/http_mjpeg_cln.h @@ -0,0 +1,95 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef HTTP_MJPEG_CLN_H +#define HTTP_MJPEG_CLN_H + +#include "http.h" +#include "http_parse.h" + + +typedef int (*mjpeg_notify_cb)(int, void *); +typedef int (*mjpeg_video_cb)(uint8 *, int, void *); + +#define MJPEG_EVE_STOPPED 20 +#define MJPEG_EVE_CONNECTING 21 +#define MJPEG_EVE_CONNFAIL 22 +#define MJPEG_EVE_CONNSUCC 23 +#define MJPEG_EVE_NOSIGNAL 24 +#define MJPEG_EVE_RESUME 25 +#define MJPEG_EVE_AUTHFAILED 26 +#define MJPEG_EVE_NODATA 27 + +#define MJPEG_RX_ERR -1 +#define MJPEG_PARSE_ERR -2 +#define MJPEG_AUTH_ERR -3 +#define MJPEG_MALLOC_ERR -4 +#define MJPEG_MORE_DATA 0 +#define MJPEG_RX_SUCC 1 +#define MJPEG_NEED_AUTH 2 + + +class CHttpMjpeg +{ +public: + CHttpMjpeg(void); + ~CHttpMjpeg(void); + +public: + BOOL mjpeg_start(const char * url, const char * user, const char * pass); + BOOL mjpeg_stop(); + BOOL mjpeg_close(); + + char * get_url() {return m_url;} + char * get_user() {return m_http.auth_info.auth_name;} + char * get_pass() {return m_http.auth_info.auth_pwd;} + + void set_notify_cb(mjpeg_notify_cb notify, void * userdata); + void set_video_cb(mjpeg_video_cb cb); + void set_rx_timeout(int timeout); + + void rx_thread(); + +private: + BOOL mjpeg_req(HTTPREQ * p_http); + BOOL mjpeg_conn(HTTPREQ * p_http, int timeout); + void mjpeg_data_rx(uint8 * data, int len); + int mjpeg_parse_header(HTTPREQ * p_http); + int mjpeg_parse_header_ex(HTTPREQ * p_http); + int mjpeg_rx(HTTPREQ * p_http); + + void send_notify(int event); + +private: + HTTPREQ m_http; + BOOL m_running; + pthread_t m_rx_tid; + BOOL m_header; + char m_url[512]; + + mjpeg_notify_cb m_pNotify; + void * m_pUserdata; + mjpeg_video_cb m_pVideoCB; + void * m_pMutex; + int m_nRxTimeout; +}; + +#endif // end of HTTP_MJPEG_CLN_H + + diff --git a/MediaClient/MediaClient/http/http_parse.cpp b/MediaClient/MediaClient/http/http_parse.cpp new file mode 100644 index 0000000..04a4a21 --- /dev/null +++ b/MediaClient/MediaClient/http/http_parse.cpp @@ -0,0 +1,839 @@ +/*************************************************************************************** + * + * 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.h" +#include "http_parse.h" +#include "sys_buf.h" + + +typedef struct +{ + HTTP_MT msg_type; + char msg_str[32]; + int msg_len; +} REQMTV; + +static const REQMTV req_mtvs[] = +{ + {HTTP_MT_GET, "GET", 3}, + {HTTP_MT_POST, "POST", 4}, + {HTTP_MT_HEAD, "HEAD", 4}, + {HTTP_MT_MPOST, "M-POST", 6}, + {HTTP_MT_MSEARCH, "M-SEARCH", 8}, + {HTTP_MT_NOTIFY, "NOTIFY", 6}, + {HTTP_MT_SUBSCRIBE, "SUBSCRIBE", 9}, + {HTTP_MT_UNSUBSCRIBE, "UNSUBSCRIBE", 11} +}; + +HT_API BOOL http_is_http_msg(char * msg_buf) +{ + uint32 i; + + for (i=0; i 0 && word_len < 31) + { + memcpy(p_msg->first_line.header, pline, word_len); + p_msg->first_line.header[word_len] = '\0'; + + while (pline[next_word_offset] == ' ') + { + next_word_offset++; + } + + p_msg->first_line.value_string = pline+next_word_offset; + + if (strcasecmp(word_buf,"HTTP/1.1") == 0 || strcasecmp(word_buf,"HTTP/1.0") == 0) + { + if (bHaveNextWord) + { + bHaveNextWord = GetLineWord(pline, next_word_offset, llen, word_buf, sizeof(word_buf), &next_word_offset, WORD_TYPE_NUM); + word_len = (int)strlen(word_buf); + if (word_len > 0) + { + p_msg->msg_type = 1; + p_msg->msg_sub_type = atoi(word_buf); + } + } + } + else + { + uint32 i; + + p_msg->msg_type = 0; + + for (i=0; imsg_sub_type = req_mtvs[i].msg_type; + break; + } + } + } + } +} + +HT_API int http_line_parse(char * p_buf, int max_len, char sep_char, PPSN_CTX * p_ctx) +{ + char word_buf[256]; + BOOL bHaveNextLine = TRUE; + int line_len = 0; + int parse_len = 0; + + char * ptr = p_buf; + + do { + int next_word_offset = 0; + char nchar; + HDRV * pHdrV; + + if (GetSipLine(ptr, max_len, &line_len, &bHaveNextLine) == FALSE) + { + log_print(HT_LOG_ERR, "%s, get sip line error!!!\r\n", __FUNCTION__); + return -1; + } + + if (line_len == 2) + { + return (parse_len + 2); + } + + + GetLineWord(ptr, 0, line_len-2, word_buf, sizeof(word_buf), &next_word_offset, WORD_TYPE_STRING); + + while (ptr[next_word_offset] == ' ') + { + next_word_offset++; + } + + nchar = *(ptr + next_word_offset); + + if (nchar != sep_char) // SIP is ':',SDP is '=' + { + log_print(HT_LOG_ERR, "%s, format error!!!\r\n", __FUNCTION__); + return -1; + } + + next_word_offset++; + + while (ptr[next_word_offset] == ' ') + { + next_word_offset++; + } + + pHdrV = hdrv_buf_get_idle(); + if (pHdrV == NULL) + { + log_print(HT_LOG_ERR, "%s, hdrv_buf_get_idle return NULL!!!\r\n", __FUNCTION__); + return -1; + } + + strncpy(pHdrV->header, word_buf, 32); + pHdrV->value_string = ptr+next_word_offset; + pps_ctx_ul_add(p_ctx, pHdrV); + + ptr += line_len; + max_len -= line_len; + parse_len += line_len; + + } while (bHaveNextLine); + + return parse_len; +} + +HT_API BOOL http_get_headline_uri(HTTPMSG * rx_msg, char * p_uri, int size) +{ + int len; + char * p_end; + char * p_ptr = rx_msg->first_line.value_string; + if (p_ptr == NULL) + { + return FALSE; + } + + p_end = p_ptr; + while (*p_end != ' ') p_end++; + + len = (int) (p_end - p_ptr); + if (len >= size) + { + return FALSE; + } + + memcpy(p_uri, p_ptr, len); + p_uri[len] = '\0'; + + return TRUE; +} + +HT_API int http_ctt_parse(HTTPMSG * p_msg) +{ + int flag = 0; + HTTPCTT w_ctx_type; + + HDRV * pHdrV = (HDRV *)pps_lookup_start(&(p_msg->hdr_ctx)); + while (pHdrV != NULL) + { + if (strcasecmp(pHdrV->header, "Content-Length") == 0) + { + p_msg->ctt_len = atol(pHdrV->value_string); + flag++; + } + else if (strcasecmp(pHdrV->header, "Content-Type") == 0) + { + char type_word[64]; + int next_tmp; + + GetLineWord(pHdrV->value_string, 0, (int)strlen(pHdrV->value_string), + type_word, sizeof(type_word), &next_tmp, WORD_TYPE_STRING); + + if (strcasecmp(type_word, "application/sdp") == 0) + { + w_ctx_type = CTT_SDP; + } + else if (strcasecmp(type_word, "application/soap+xml") == 0 || + strcasecmp(type_word, "text/xml") == 0) + { + w_ctx_type = CTT_XML; + } + else if (strcasecmp(type_word, "text/plain") == 0) + { + w_ctx_type = CTT_TXT; + } + else if (strcasecmp(type_word, "text/html") == 0) + { + w_ctx_type = CTT_HTM; + } + else if (strcasecmp(type_word, "application/octet-stream") == 0) + { + w_ctx_type = CTT_BIN; + } + else if (strcasecmp(type_word, "image/jpeg") == 0) + { + w_ctx_type = CTT_JPG; + } + else if (strcasecmp(type_word, "application/x-rtsp-tunnelled") == 0) + { + w_ctx_type = CTT_RTSP_TUNNELLED; + } + else if (strcasecmp(type_word, "multipart/x-mixed-replace") == 0) + { + char * boundary = NULL; + + w_ctx_type = CTT_MULTIPART; + + boundary = strstr(pHdrV->value_string, "boundary="); + if (boundary) + { + int offset = 0; + while (*(boundary+9+offset) == '-') + { + offset++; + } + + strcpy(p_msg->boundary, boundary+9+offset); + } + } + else if (strcasecmp(type_word, "video/x-flv") == 0) + { + w_ctx_type = CTT_FLV; + } + else + { + w_ctx_type = CTT_NULL; + } + + p_msg->ctt_type = w_ctx_type; + flag++; + } + + pHdrV = (HDRV *)pps_lookup_next(&(p_msg->hdr_ctx), pHdrV); + } + pps_lookup_end(&(p_msg->hdr_ctx)); + + if (p_msg->ctt_type && p_msg->ctt_len) + { + return 1; + } + + return 0; +} + +HT_API int http_msg_parse(char * msg_buf, int msg_buf_len, HTTPMSG * msg) +{ + BOOL bHaveNextLine; + int line_len = 0; + char * p_buf = msg_buf; + + msg->msg_type = (uint32) -1; + + if (GetSipLine(p_buf, msg_buf_len, &line_len, &bHaveNextLine) == FALSE) + { + return -1; + } + + if (line_len > 0) + { + http_headl_parse(p_buf, line_len-2, msg); + } + + if (msg->msg_type == (uint32) -1) + { + return -1; + } + + p_buf += line_len; + msg->hdr_len = http_line_parse(p_buf, msg_buf_len-line_len, ':', &(msg->hdr_ctx)); + if (msg->hdr_len <= 0) + { + return -1; + } + + p_buf += msg->hdr_len; + + if (http_ctt_parse(msg) == 1 && msg->ctt_len > 0) + { + int slen; + HDRV * pHdrV; + + pHdrV = hdrv_buf_get_idle(); + if (pHdrV == NULL) + { + log_print(HT_LOG_ERR, "%s, hdrv_buf_get_idle return NULL!!!\r\n", __FUNCTION__); + return -1; + } + + strcpy(pHdrV->header, ""); + pHdrV->value_string = p_buf; + + pps_ctx_ul_add(&(msg->ctt_ctx), pHdrV); + + slen = (int)strlen(p_buf); + if (slen != msg->ctt_len) + { + log_print(HT_LOG_ERR, "%s, text xml strlen[%d] != ctx len[%d]!!!\r\n", __FUNCTION__, slen, msg->ctt_len); + } + } + + return (line_len + msg->hdr_len + msg->ctt_len); +} + +HT_API int http_msg_parse_part1(char * p_buf, int buf_len, HTTPMSG * msg) +{ + BOOL bHaveNextLine; + int line_len = 0; + + msg->msg_type = (uint32) -1; + + if (GetSipLine(p_buf, buf_len, &line_len, &bHaveNextLine) == FALSE) + { + return -1; + } + + if (line_len > 0) + { + http_headl_parse(p_buf, line_len-2, msg); + } + + if (msg->msg_type == (uint32) -1) + { + return -1; + } + + p_buf += line_len; + msg->hdr_len = http_line_parse(p_buf, buf_len-line_len, ':', &(msg->hdr_ctx)); + if (msg->hdr_len <= 0) + { + return -1; + } + + http_ctt_parse(msg); + + return (line_len + msg->hdr_len); +} + +HT_API int http_msg_parse_part2(char * p_buf, int buf_len, HTTPMSG * msg) +{ + int slen; + HDRV * pHdrV; + + pHdrV = hdrv_buf_get_idle(); + if (pHdrV == NULL) + { + log_print(HT_LOG_ERR, "%s, hdrv_buf_get_idle return NULL!!!\r\n", __FUNCTION__); + return -1; + } + + strcpy(pHdrV->header, ""); + pHdrV->value_string = p_buf; + + pps_ctx_ul_add(&(msg->ctt_ctx), pHdrV); + + slen = buf_len; + + if (ctt_is_string(msg->ctt_type)) + { + slen = (int)strlen(p_buf); + + if (slen != msg->ctt_len) + { + log_print(HT_LOG_ERR, "%s, text xml strlen[%d] != ctx len[%d]!!!\r\n", __FUNCTION__, slen, msg->ctt_len); + } + } + + return slen; +} + +HT_API HDRV * http_find_headline(HTTPMSG * msg, const char * head) +{ + HDRV * line; + + if (msg == NULL || head == NULL) + { + return NULL; + } + + line = (HDRV *)pps_lookup_start(&(msg->hdr_ctx)); + while (line != NULL) + { + if (strcasecmp(line->header, head) == 0) + { + pps_lookup_end(&(msg->hdr_ctx)); + return line; + } + + line = (HDRV *)pps_lookup_next(&(msg->hdr_ctx), line); + } + pps_lookup_end(&(msg->hdr_ctx)); + + return NULL; +} + +HT_API HDRV * http_find_headline_next(HTTPMSG * msg, const char * head, HDRV * hrv) +{ + HDRV * line; + + if (msg == NULL || head == NULL) + { + return NULL; + } + + line = (HDRV *)pps_lookup_start(&(msg->hdr_ctx)); + while (line != NULL) + { + if (line == hrv) + { + line = (HDRV *)pps_lookup_next(&(msg->hdr_ctx), line); + break; + } + + line = (HDRV *)pps_lookup_next(&(msg->hdr_ctx), line); + } + + while (line != NULL) + { + if (strcasecmp(line->header, head) == 0) + { + pps_lookup_end(&(msg->hdr_ctx)); + return line; + } + + line = (HDRV *)pps_lookup_next(&(msg->hdr_ctx), line); + } + pps_lookup_end(&(msg->hdr_ctx)); + + return NULL; +} + +HT_API char * http_get_headline(HTTPMSG * msg, const char * head) +{ + HDRV * p_hdrv = http_find_headline(msg, head); + if (p_hdrv == NULL) + { + return NULL; + } + + return p_hdrv->value_string; +} + +void http_add_tx_line(HTTPMSG * tx_msg, const char * msg_hdr, const char * msg_fmt,...) +{ + va_list argptr; + int slen; + HDRV *pHdrV; + + if (tx_msg == NULL || tx_msg->msg_buf == NULL) + { + return; + } + + pHdrV = hdrv_buf_get_idle(); + if (pHdrV == NULL) + { + log_print(HT_LOG_ERR, "%s, hdrv_buf_get_idle return NULL!!!\r\n", __FUNCTION__); + return; + } + + pHdrV->value_string = tx_msg->msg_buf + tx_msg->buf_offset; + + strncpy(pHdrV->header, msg_hdr, 31); + + va_start(argptr, msg_fmt); +#if __LINUX_OS__ + slen = vsnprintf(pHdrV->value_string, 1600-tx_msg->buf_offset, msg_fmt, argptr); +#else + slen = vsprintf(pHdrV->value_string, msg_fmt, argptr); +#endif + va_end(argptr); + + if (slen < 0) + { + log_print(HT_LOG_ERR, "%s, vsnprintf return %d !!!\r\n", __FUNCTION__, slen); + hdrv_buf_free(pHdrV); + return; + } + + pHdrV->value_string[slen] = '\0'; + tx_msg->buf_offset += slen + 1; + + pps_ctx_ul_add(&(tx_msg->hdr_ctx), pHdrV); +} + +HT_API HDRV * http_find_ctt_headline(HTTPMSG * msg, const char * head) +{ + HDRV * line; + + if (msg == NULL || head == NULL) + { + return NULL; + } + + line = (HDRV *)pps_lookup_start(&(msg->ctt_ctx)); + while (line != NULL) + { + if (strcasecmp(line->header, head) == 0) + { + pps_lookup_end(&(msg->ctt_ctx)); + return line; + } + + line = (HDRV *)pps_lookup_next(&(msg->ctt_ctx), line); + } + pps_lookup_end(&(msg->ctt_ctx)); + + return NULL; +} + +HT_API char * http_get_ctt(HTTPMSG * msg) +{ + HDRV * line; + + if (msg == NULL) + { + return NULL; + } + + line = (HDRV *)pps_lookup_start(&(msg->ctt_ctx)); + pps_lookup_end(&(msg->ctt_ctx)); + + if (line) + { + return line->value_string; + } + + return NULL; +} + +HT_API BOOL http_get_auth_digest_info(HTTPMSG * rx_msg, HD_AUTH_INFO * p_auth) +{ + int len; + int next_offset; + char word_buf[128]; + char * p; + + HDRV * res_line = http_find_headline(rx_msg, "Authorization"); + if (res_line == NULL) + { + return FALSE; + } + + GetLineWord(res_line->value_string, 0, (int)strlen(res_line->value_string), + word_buf, sizeof(word_buf), &next_offset, WORD_TYPE_STRING); + + if (strcasecmp(word_buf, "digest") != 0) + { + return FALSE; + } + + p = res_line->value_string+next_offset; + len = (int)strlen(res_line->value_string)-next_offset; + + if (!GetNameValuePair(p, len, "username", p_auth->auth_name, sizeof(p_auth->auth_name))) + { + return FALSE; + } + + if (!GetNameValuePair(p, len, "realm", p_auth->auth_realm, sizeof(p_auth->auth_realm))) + { + return FALSE; + } + + if (!GetNameValuePair(p, len, "nonce", p_auth->auth_nonce, sizeof(p_auth->auth_nonce))) + { + return FALSE; + } + + if (!GetNameValuePair(p, len, "uri", p_auth->auth_uri, sizeof(p_auth->auth_uri))) + { + return FALSE; + } + + if (!GetNameValuePair(p, len, "response", p_auth->auth_response, sizeof(p_auth->auth_response))) + { + return FALSE; + } + + if (!GetNameValuePair(p, len, "algorithm", p_auth->auth_algorithm, sizeof(p_auth->auth_algorithm))) + { + p_auth->auth_algorithm[0] = '\0'; + } + + if (GetNameValuePair(p, len, "qop", p_auth->auth_qop, sizeof(p_auth->auth_qop))) + { + char * stop_string; + + if (!GetNameValuePair(p, len, "cnonce", p_auth->auth_cnonce, sizeof(p_auth->auth_cnonce))) + { + p_auth->auth_cnonce[0] = '\0'; + } + + if (!GetNameValuePair(p, len, "nc", p_auth->auth_ncstr, sizeof(p_auth->auth_ncstr))) + { + p_auth->auth_ncstr[0] = '\0'; + } + + p_auth->auth_nc = strtol(p_auth->auth_ncstr, &stop_string, 16); + + if (strlen(stop_string) > 0) + { + return FALSE; + } + } + else + { + p_auth->auth_qop[0] = '\0'; + p_auth->auth_cnonce[0] = '\0'; + p_auth->auth_ncstr[0] = '\0'; + p_auth->auth_nc = 0; + } + + return TRUE; +} + +/***********************************************************************/ +static PPSN_CTX * msg_buf_fl = NULL; +static int http_msg_buf_init_count = 0; +HT_API BOOL http_msg_buf_init(int num) +{ + http_msg_buf_init_count++; + if (msg_buf_fl) + { + return TRUE; + } + + msg_buf_fl = pps_ctx_fl_init(num, sizeof(HTTPMSG), TRUE); + if (msg_buf_fl == NULL) + { + return FALSE; + } + + return TRUE; +} + +HT_API void http_msg_buf_deinit() +{ + http_msg_buf_init_count--; + if (http_msg_buf_init_count == 0) { + if (msg_buf_fl) + { + pps_fl_free(msg_buf_fl); + msg_buf_fl = NULL; + } + } + if (http_msg_buf_init_count < 0)http_msg_buf_init_count = 0;//Reset + +} + +HT_API HTTPMSG * http_get_msg_buf(int size) +{ + HTTPMSG * tx_msg = (HTTPMSG *)pps_fl_pop(msg_buf_fl); + if (tx_msg == NULL) + { + log_print(HT_LOG_ERR, "%s, pop null!!!\r\n", __FUNCTION__); + return NULL; + } + + memset(tx_msg, 0, sizeof(HTTPMSG)); + + if (size > (int) net_buf_get_size()) + { + tx_msg->msg_buf = (char *)malloc(size); + } + else + { + tx_msg->msg_buf = net_buf_get_idle(); + } + + if (tx_msg->msg_buf == NULL) + { + log_print(HT_LOG_ERR, "%s, net_buf_get_idle failed\r\n", __FUNCTION__); + + http_free_msg_buf(tx_msg); + return NULL; + } + + http_msg_ctx_init(tx_msg); + + return tx_msg; +} + +HT_API void http_msg_ctx_init(HTTPMSG * msg) +{ + pps_ctx_ul_init_nm(hdrv_buf_fl, &(msg->hdr_ctx)); + pps_ctx_ul_init_nm(hdrv_buf_fl, &(msg->ctt_ctx)); +} + +HT_API void http_free_msg_buf(HTTPMSG * msg) +{ + pps_fl_push(msg_buf_fl, msg); +} + +HT_API uint32 http_idle_msg_buf_num() +{ + return msg_buf_fl->node_num; +} + +HT_API void http_free_msg(HTTPMSG * msg) +{ + if (msg == NULL) + { + return; + } + + http_free_msg_content(msg); + http_free_msg_buf(msg); +} + +HT_API void http_free_msg_content(HTTPMSG * msg) +{ + if (msg == NULL) + { + return; + } + + http_free_msg_ctx(msg, 0); + http_free_msg_ctx(msg, 1); + + net_buf_free(msg->msg_buf); +} + +HT_API void http_free_msg_ctx(HTTPMSG * msg, int type) +{ + PPSN_CTX * p_free_ctx = NULL; + + switch (type) + { + case 0: + p_free_ctx = &(msg->hdr_ctx); + break; + + case 1: + p_free_ctx = &(msg->ctt_ctx); + break; + } + + if (p_free_ctx == NULL) + { + return; + } + + hdrv_ctx_free(p_free_ctx); +} + + + diff --git a/MediaClient/MediaClient/http/http_parse.h b/MediaClient/MediaClient/http/http_parse.h new file mode 100644 index 0000000..5267035 --- /dev/null +++ b/MediaClient/MediaClient/http/http_parse.h @@ -0,0 +1,70 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef HTTP_PARSE_H +#define HTTP_PARSE_H + +#include "sys_inc.h" +#include "http.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +/***********************************************************************/ +HT_API BOOL http_msg_buf_init(int num); +HT_API void http_msg_buf_deinit(); + +/***********************************************************************/ +HT_API BOOL http_is_http_msg(char * msg_buf); +HT_API int http_pkt_find_end(char * p_buf); +HT_API void http_headl_parse(char * pline, int llen, HTTPMSG * p_msg); +HT_API int http_line_parse(char * p_buf, int max_len, char sep_char, PPSN_CTX * p_ctx); +HT_API BOOL http_get_headline_uri(HTTPMSG * rx_msg, char * p_uri, int size); +HT_API int http_ctt_parse(HTTPMSG * p_msg); +HT_API int http_msg_parse(char * msg_buf, int msg_buf_len, HTTPMSG * msg); +HT_API int http_msg_parse_part1(char * p_buf, int buf_len, HTTPMSG * msg); +HT_API int http_msg_parse_part2(char * p_buf, int buf_len, HTTPMSG * msg); +HT_API HDRV * http_find_headline(HTTPMSG * msg, const char * head); +HT_API HDRV * http_find_headline_next(HTTPMSG * msg, const char * head, HDRV * hrv); +HT_API char * http_get_headline(HTTPMSG * msg, const char * head); +HT_API HDRV * http_find_ctt_headline(HTTPMSG * msg, const char * head); +HT_API char * http_get_ctt(HTTPMSG * msg); +HT_API BOOL http_get_auth_digest_info(HTTPMSG * rx_msg, HD_AUTH_INFO * p_auth); + +HT_API HTTPMSG * http_get_msg_buf(int size); +HT_API void http_msg_ctx_init(HTTPMSG * msg); +HT_API void http_free_msg_buf(HTTPMSG * msg); +HT_API uint32 http_idle_msg_buf_num(); + +/***********************************************************************/ +HT_API void http_free_msg(HTTPMSG * msg); +HT_API void http_free_msg_content(HTTPMSG * msg); +HT_API void http_free_msg_ctx(HTTPMSG * msg, int type); + + +#ifdef __cplusplus +} +#endif + +#endif + + + diff --git a/MediaClient/MediaClient/http/http_test.cpp b/MediaClient/MediaClient/http/http_test.cpp new file mode 100644 index 0000000..c085cad --- /dev/null +++ b/MediaClient/MediaClient/http/http_test.cpp @@ -0,0 +1,304 @@ +/*************************************************************************************** + * + * 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_test.h" +#include "http.h" +#include "http_cln.h" +#include "http_parse.h" + + +BOOL http_test_req(HTTPREQ * p_http) +{ + int ret; + int offset = 0; + char bufs[1024]; + char cookie[100]; + int buflen = sizeof(bufs); + + snprintf(cookie, sizeof(cookie), "%x%x%x", rand(), rand(), sys_os_get_ms()); + + offset += snprintf(bufs+offset, buflen-offset, "GET %s HTTP/1.1\r\n", p_http->url); + offset += snprintf(bufs+offset, buflen-offset, "Host: %s:%u\r\n", p_http->host, p_http->port); + offset += snprintf(bufs+offset, buflen-offset, "Accept: */*\r\n"); + offset += snprintf(bufs+offset, buflen-offset, "x-sessioncookie: %s\r\n", cookie); + offset += snprintf(bufs+offset, buflen-offset, "User-Agent: happytimesoft/1.0\r\n"); + + if (p_http->need_auth) + { + offset += http_build_auth_msg(p_http, "GET", bufs+offset, buflen-offset); + } + + offset += snprintf(bufs+offset, buflen-offset, "\r\n"); + + bufs[offset] = '\0'; + + log_print(HT_LOG_DBG, "TX >> %s\r\n", bufs); + + ret = http_cln_tx(p_http, bufs, offset); + + return (ret == offset) ? TRUE : FALSE; +} + +BOOL http_test_rx_timeout(HTTPREQ * p_http, int timeout) +{ + int sret, rlen; + BOOL ret = FALSE; + fd_set fdr; + struct timeval tv; + + while (1) + { +#ifdef HTTPS + if (p_http->https && SSL_pending(p_http->ssl) > 0) + { + // There is data to read + } + else +#endif + { + tv.tv_sec = timeout / 1000; + tv.tv_usec = (timeout % 1000) * 1000; + + FD_ZERO(&fdr); + FD_SET(p_http->cfd, &fdr); + + sret = select((int)(p_http->cfd+1), &fdr, NULL, NULL, &tv); + if (sret == 0) + { + log_print(HT_LOG_WARN, "%s, timeout!!!\r\n", __FUNCTION__); + break; + } + else if (sret < 0) + { + log_print(HT_LOG_ERR, "%s, select err[%s], sret[%d]!!!\r\n", + __FUNCTION__, sys_os_get_socket_error(), sret); + break; + } + else if (!FD_ISSET(p_http->cfd, &fdr)) + { + continue; + } + } + + if (p_http->rbuf == NULL) + { + p_http->rbuf = p_http->rcv_buf; + p_http->mlen = sizeof(p_http->rcv_buf)-4; + p_http->rcv_dlen = 0; + p_http->ctt_len = 0; + p_http->hdr_len = 0; + } + +#ifdef HTTPS + if (p_http->https) + { + sys_os_mutex_enter(p_http->ssl_mutex); + rlen = SSL_read(p_http->ssl, p_http->rbuf+p_http->rcv_dlen, p_http->mlen-p_http->rcv_dlen); + sys_os_mutex_leave(p_http->ssl_mutex); + } + else +#endif + rlen = recv(p_http->cfd, p_http->rbuf+p_http->rcv_dlen, p_http->mlen-p_http->rcv_dlen, 0); + + if (rlen < 0) + { + log_print(HT_LOG_INFO, "%s, recv return = %d, dlen[%d], mlen[%d]\r\n", + __FUNCTION__, rlen, p_http->rcv_dlen, p_http->mlen); + return FALSE; + } + + p_http->rcv_dlen += rlen; + p_http->rbuf[p_http->rcv_dlen] = '\0'; + + if (p_http->rcv_dlen < 16) + { + continue; + } + + if (http_is_http_msg(p_http->rbuf) == FALSE) + { + break; + } + + if (p_http->hdr_len == 0) + { + int parse_len; + int http_pkt_len; + + http_pkt_len = http_pkt_find_end(p_http->rbuf); + if (http_pkt_len == 0) + { + continue; + } + p_http->hdr_len = http_pkt_len; + + HTTPMSG * rx_msg = http_get_msg_buf(http_pkt_len+1); + if (rx_msg == NULL) + { + log_print(HT_LOG_ERR, "%s, get msg buf failed\r\n", __FUNCTION__); + return FALSE; + } + + memcpy(rx_msg->msg_buf, p_http->rbuf, http_pkt_len); + rx_msg->msg_buf[http_pkt_len] = '\0'; + + log_print(HT_LOG_DBG, "RX from %s << %s\r\n", p_http->host, rx_msg->msg_buf); + + parse_len = http_msg_parse_part1(rx_msg->msg_buf, http_pkt_len, rx_msg); + if (parse_len != http_pkt_len) + { + log_print(HT_LOG_ERR, "%s, http_msg_parse_part1=%d, http_pkt_len=%d!!!\r\n", + __FUNCTION__, parse_len, http_pkt_len); + + http_free_msg(rx_msg); + return FALSE; + } + + p_http->ctt_len = rx_msg->ctt_len; + p_http->rx_msg = rx_msg; + + ret = TRUE; + break; + } + } + + return ret; +} + +BOOL http_test(const char * url, const char * user, const char * pass, HTTPCTT * ctt, int timeout) +{ + BOOL ret = FALSE; + int port, https=0; + char proto[32], username[64], password[64], host[100], path[200]; + + url_split(url, proto, sizeof(proto), username, sizeof(username), + password, sizeof(password), host, sizeof(host), &port, path, sizeof(path)); + + if (strcasecmp(proto, "https") == 0) + { + https = 1; + port = (port == -1) ? 443 : port; + } + else if (strcasecmp(proto, "http") == 0) + { + port = (port == -1) ? 80 : port; + } + else + { + return FALSE; + } + + if (host[0] == '\0') + { + return FALSE; + } + + HTTPREQ hreq; + memset(&hreq, 0, sizeof(hreq)); + + strncpy(hreq.host, host, sizeof(hreq.host) - 1); + + if (username[0] != '\0') + { + strcpy(hreq.auth_info.auth_name, username); + } + else if (user && user[0] != '\0') + { + strcpy(hreq.auth_info.auth_name, user); + } + + if (password[0] != '\0') + { + strcpy(hreq.auth_info.auth_pwd, password); + } + else if (pass && pass[0] != '\0') + { + strcpy(hreq.auth_info.auth_pwd, pass); + } + + if (path[0] != '\0') + { + strcpy(hreq.url, path); + strcpy(hreq.auth_info.auth_uri, path); + } + + hreq.port = port; + hreq.https = https; + +RETRY: + + hreq.cfd = tcp_connect_timeout(inet_addr(hreq.host), hreq.port, timeout); + if (hreq.cfd <= 0) + { + log_print(HT_LOG_ERR, "%s, tcp_connect_timeout\r\n", __FUNCTION__); + return FALSE; + } + + if (hreq.https) + { +#ifdef HTTPS + if (!http_cln_ssl_conn(&hreq, timeout)) + { + return FALSE; + } +#else + log_print(HT_LOG_ERR, "%s, the server require ssl connection, unsupport!\r\n", __FUNCTION__); + return FALSE; +#endif + } + + if (!http_test_req(&hreq)) + { + return FALSE; + } + + if (!http_test_rx_timeout(&hreq, timeout)) + { + return FALSE; + } + + if (hreq.rx_msg->msg_sub_type == 200) + { + if (ctt) + { + *ctt = hreq.rx_msg->ctt_type; + } + + ret = TRUE; + } + else if (hreq.rx_msg->msg_sub_type == 401) + { + if (!hreq.need_auth) + { + http_cln_auth_set(&hreq, NULL, NULL); + + http_cln_free_req(&hreq); + + goto RETRY; + } + } + + http_cln_free_req(&hreq); + + return ret; +} + + + diff --git a/MediaClient/MediaClient/http/http_test.h b/MediaClient/MediaClient/http/http_test.h new file mode 100644 index 0000000..6cee5a7 --- /dev/null +++ b/MediaClient/MediaClient/http/http_test.h @@ -0,0 +1,39 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef HTTP_TEST_H +#define HTTP_TEST_H + +#include "sys_inc.h" +#include "http.h" + +#ifdef __cplusplus +extern "C" { +#endif + +BOOL http_test(const char * url, const char * user, const char * pass, HTTPCTT * ctt, int timeout = 5*1000); + +#ifdef __cplusplus +} +#endif + + +#endif + + diff --git a/MediaClient/MediaClient/librtmp/COPYING b/MediaClient/MediaClient/librtmp/COPYING new file mode 100644 index 0000000..00b4fed --- /dev/null +++ b/MediaClient/MediaClient/librtmp/COPYING @@ -0,0 +1,504 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + diff --git a/MediaClient/MediaClient/librtmp/amf.c b/MediaClient/MediaClient/librtmp/amf.c new file mode 100644 index 0000000..b402410 --- /dev/null +++ b/MediaClient/MediaClient/librtmp/amf.c @@ -0,0 +1,1311 @@ +/* + * Copyright (C) 2005-2008 Team XBMC + * http://www.xbmc.org + * Copyright (C) 2008-2009 Andrej Stepanchuk + * Copyright (C) 2009-2010 Howard Chu + * + * This file is part of librtmp. + * + * librtmp is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1, + * or (at your option) any later version. + * + * librtmp is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with librtmp see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * http://www.gnu.org/copyleft/lgpl.html + */ + +#include +#include +#include + +#include "rtmp_sys.h" +#include "amf.h" +#include "log.h" +#include "bytes.h" + +static const AMFObjectProperty AMFProp_Invalid = { {0, 0}, AMF_INVALID }; +static const AMFObject AMFObj_Invalid = { 0, 0 }; +static const AVal AV_empty = { 0, 0 }; + +/* Data is Big-Endian */ +unsigned short +AMF_DecodeInt16(const char *data) +{ + unsigned char *c = (unsigned char *) data; + unsigned short val; + val = (c[0] << 8) | c[1]; + return val; +} + +unsigned int +AMF_DecodeInt24(const char *data) +{ + unsigned char *c = (unsigned char *) data; + unsigned int val; + val = (c[0] << 16) | (c[1] << 8) | c[2]; + return val; +} + +unsigned int +AMF_DecodeInt32(const char *data) +{ + unsigned char *c = (unsigned char *)data; + unsigned int val; + val = (c[0] << 24) | (c[1] << 16) | (c[2] << 8) | c[3]; + return val; +} + +void +AMF_DecodeString(const char *data, AVal *bv) +{ + bv->av_len = AMF_DecodeInt16(data); + bv->av_val = (bv->av_len > 0) ? (char *)data + 2 : NULL; +} + +void +AMF_DecodeLongString(const char *data, AVal *bv) +{ + bv->av_len = AMF_DecodeInt32(data); + bv->av_val = (bv->av_len > 0) ? (char *)data + 4 : NULL; +} + +double +AMF_DecodeNumber(const char *data) +{ + double dVal; +#if __FLOAT_WORD_ORDER == __BYTE_ORDER +#if __BYTE_ORDER == __BIG_ENDIAN + memcpy(&dVal, data, 8); +#elif __BYTE_ORDER == __LITTLE_ENDIAN + unsigned char *ci, *co; + ci = (unsigned char *)data; + co = (unsigned char *)&dVal; + co[0] = ci[7]; + co[1] = ci[6]; + co[2] = ci[5]; + co[3] = ci[4]; + co[4] = ci[3]; + co[5] = ci[2]; + co[6] = ci[1]; + co[7] = ci[0]; +#endif +#else +#if __BYTE_ORDER == __LITTLE_ENDIAN /* __FLOAT_WORD_ORER == __BIG_ENDIAN */ + unsigned char *ci, *co; + ci = (unsigned char *)data; + co = (unsigned char *)&dVal; + co[0] = ci[3]; + co[1] = ci[2]; + co[2] = ci[1]; + co[3] = ci[0]; + co[4] = ci[7]; + co[5] = ci[6]; + co[6] = ci[5]; + co[7] = ci[4]; +#else /* __BYTE_ORDER == __BIG_ENDIAN && __FLOAT_WORD_ORER == __LITTLE_ENDIAN */ + unsigned char *ci, *co; + ci = (unsigned char *)data; + co = (unsigned char *)&dVal; + co[0] = ci[4]; + co[1] = ci[5]; + co[2] = ci[6]; + co[3] = ci[7]; + co[4] = ci[0]; + co[5] = ci[1]; + co[6] = ci[2]; + co[7] = ci[3]; +#endif +#endif + return dVal; +} + +int +AMF_DecodeBoolean(const char *data) +{ + return *data != 0; +} + +char * +AMF_EncodeInt16(char *output, char *outend, short nVal) +{ + if (output+2 > outend) + return NULL; + + output[1] = nVal & 0xff; + output[0] = nVal >> 8; + return output+2; +} + +char * +AMF_EncodeInt24(char *output, char *outend, int nVal) +{ + if (output+3 > outend) + return NULL; + + output[2] = nVal & 0xff; + output[1] = nVal >> 8; + output[0] = nVal >> 16; + return output+3; +} + +char * +AMF_EncodeInt32(char *output, char *outend, int nVal) +{ + if (output+4 > outend) + return NULL; + + output[3] = nVal & 0xff; + output[2] = nVal >> 8; + output[1] = nVal >> 16; + output[0] = nVal >> 24; + return output+4; +} + +char * +AMF_EncodeString(char *output, char *outend, const AVal *bv) +{ + if ((bv->av_len < 65536 && output + 1 + 2 + bv->av_len > outend) || + output + 1 + 4 + bv->av_len > outend) + return NULL; + + if (bv->av_len < 65536) + { + *output++ = AMF_STRING; + + output = AMF_EncodeInt16(output, outend, bv->av_len); + } + else + { + *output++ = AMF_LONG_STRING; + + output = AMF_EncodeInt32(output, outend, bv->av_len); + } + memcpy(output, bv->av_val, bv->av_len); + output += bv->av_len; + + return output; +} + +char * +AMF_EncodeNumber(char *output, char *outend, double dVal) +{ + if (output+1+8 > outend) + return NULL; + + *output++ = AMF_NUMBER; /* type: Number */ + +#if __FLOAT_WORD_ORDER == __BYTE_ORDER +#if __BYTE_ORDER == __BIG_ENDIAN + memcpy(output, &dVal, 8); +#elif __BYTE_ORDER == __LITTLE_ENDIAN + { + unsigned char *ci, *co; + ci = (unsigned char *)&dVal; + co = (unsigned char *)output; + co[0] = ci[7]; + co[1] = ci[6]; + co[2] = ci[5]; + co[3] = ci[4]; + co[4] = ci[3]; + co[5] = ci[2]; + co[6] = ci[1]; + co[7] = ci[0]; + } +#endif +#else +#if __BYTE_ORDER == __LITTLE_ENDIAN /* __FLOAT_WORD_ORER == __BIG_ENDIAN */ + { + unsigned char *ci, *co; + ci = (unsigned char *)&dVal; + co = (unsigned char *)output; + co[0] = ci[3]; + co[1] = ci[2]; + co[2] = ci[1]; + co[3] = ci[0]; + co[4] = ci[7]; + co[5] = ci[6]; + co[6] = ci[5]; + co[7] = ci[4]; + } +#else /* __BYTE_ORDER == __BIG_ENDIAN && __FLOAT_WORD_ORER == __LITTLE_ENDIAN */ + { + unsigned char *ci, *co; + ci = (unsigned char *)&dVal; + co = (unsigned char *)output; + co[0] = ci[4]; + co[1] = ci[5]; + co[2] = ci[6]; + co[3] = ci[7]; + co[4] = ci[0]; + co[5] = ci[1]; + co[6] = ci[2]; + co[7] = ci[3]; + } +#endif +#endif + + return output+8; +} + +char * +AMF_EncodeBoolean(char *output, char *outend, int bVal) +{ + if (output+2 > outend) + return NULL; + + *output++ = AMF_BOOLEAN; + + *output++ = bVal ? 0x01 : 0x00; + + return output; +} + +char * +AMF_EncodeNamedString(char *output, char *outend, const AVal *strName, const AVal *strValue) +{ + if (output+2+strName->av_len > outend) + return NULL; + output = AMF_EncodeInt16(output, outend, strName->av_len); + + memcpy(output, strName->av_val, strName->av_len); + output += strName->av_len; + + return AMF_EncodeString(output, outend, strValue); +} + +char * +AMF_EncodeNamedNumber(char *output, char *outend, const AVal *strName, double dVal) +{ + if (output+2+strName->av_len > outend) + return NULL; + output = AMF_EncodeInt16(output, outend, strName->av_len); + + memcpy(output, strName->av_val, strName->av_len); + output += strName->av_len; + + return AMF_EncodeNumber(output, outend, dVal); +} + +char * +AMF_EncodeNamedBoolean(char *output, char *outend, const AVal *strName, int bVal) +{ + if (output+2+strName->av_len > outend) + return NULL; + output = AMF_EncodeInt16(output, outend, strName->av_len); + + memcpy(output, strName->av_val, strName->av_len); + output += strName->av_len; + + return AMF_EncodeBoolean(output, outend, bVal); +} + +void +AMFProp_GetName(AMFObjectProperty *prop, AVal *name) +{ + *name = prop->p_name; +} + +void +AMFProp_SetName(AMFObjectProperty *prop, AVal *name) +{ + prop->p_name = *name; +} + +AMFDataType +AMFProp_GetType(AMFObjectProperty *prop) +{ + return prop->p_type; +} + +double +AMFProp_GetNumber(AMFObjectProperty *prop) +{ + return prop->p_vu.p_number; +} + +int +AMFProp_GetBoolean(AMFObjectProperty *prop) +{ + return prop->p_vu.p_number != 0; +} + +void +AMFProp_GetString(AMFObjectProperty *prop, AVal *str) +{ + if (prop->p_type == AMF_STRING) + *str = prop->p_vu.p_aval; + else + *str = AV_empty; +} + +void +AMFProp_GetObject(AMFObjectProperty *prop, AMFObject *obj) +{ + if (prop->p_type == AMF_OBJECT || prop->p_type == AMF_ECMA_ARRAY) + *obj = prop->p_vu.p_object; + else + *obj = AMFObj_Invalid; +} + +int +AMFProp_IsValid(AMFObjectProperty *prop) +{ + return prop->p_type != AMF_INVALID; +} + +char * +AMFProp_Encode(AMFObjectProperty *prop, char *pBuffer, char *pBufEnd) +{ + if (prop->p_type == AMF_INVALID) + return NULL; + + if (prop->p_type != AMF_NULL && pBuffer + prop->p_name.av_len + 2 + 1 >= pBufEnd) + return NULL; + + if (prop->p_type != AMF_NULL && prop->p_name.av_len) + { + *pBuffer++ = prop->p_name.av_len >> 8; + *pBuffer++ = prop->p_name.av_len & 0xff; + memcpy(pBuffer, prop->p_name.av_val, prop->p_name.av_len); + pBuffer += prop->p_name.av_len; + } + + switch (prop->p_type) + { + case AMF_NUMBER: + pBuffer = AMF_EncodeNumber(pBuffer, pBufEnd, prop->p_vu.p_number); + break; + + case AMF_BOOLEAN: + pBuffer = AMF_EncodeBoolean(pBuffer, pBufEnd, prop->p_vu.p_number != 0); + break; + + case AMF_STRING: + pBuffer = AMF_EncodeString(pBuffer, pBufEnd, &prop->p_vu.p_aval); + break; + + case AMF_NULL: + if (pBuffer+1 >= pBufEnd) + return NULL; + *pBuffer++ = AMF_NULL; + break; + + case AMF_OBJECT: + pBuffer = AMF_Encode(&prop->p_vu.p_object, pBuffer, pBufEnd); + break; + + case AMF_ECMA_ARRAY: + pBuffer = AMF_EncodeEcmaArray(&prop->p_vu.p_object, pBuffer, pBufEnd); + break; + + case AMF_STRICT_ARRAY: + pBuffer = AMF_EncodeArray(&prop->p_vu.p_object, pBuffer, pBufEnd); + break; + + default: + RTMP_Log(RTMP_LOGERROR, "%s, invalid type. %d", __FUNCTION__, prop->p_type); + pBuffer = NULL; + }; + + return pBuffer; +} + +#define AMF3_INTEGER_MAX 268435455 +#define AMF3_INTEGER_MIN -268435456 + +int +AMF3ReadInteger(const char *data, int32_t *valp) +{ + int i = 0; + int32_t val = 0; + + while (i <= 2) + { /* handle first 3 bytes */ + if (data[i] & 0x80) + { /* byte used */ + val <<= 7; /* shift up */ + val |= (data[i] & 0x7f); /* add bits */ + i++; + } + else + { + break; + } + } + + if (i > 2) + { /* use 4th byte, all 8bits */ + val <<= 8; + val |= data[3]; + + /* range check */ + if (val > AMF3_INTEGER_MAX) + val -= (1 << 29); + } + else + { /* use 7bits of last unparsed byte (0xxxxxxx) */ + val <<= 7; + val |= data[i]; + } + + *valp = val; + + return i > 2 ? 4 : i + 1; +} + +int +AMF3ReadString(const char *data, AVal *str) +{ + int32_t ref = 0; + int len; + assert(str != 0); + + len = AMF3ReadInteger(data, &ref); + data += len; + + if ((ref & 0x1) == 0) + { /* reference: 0xxx */ + uint32_t refIndex = (ref >> 1); + RTMP_Log(RTMP_LOGDEBUG, + "%s, string reference, index: %d, not supported, ignoring!", + __FUNCTION__, refIndex); + str->av_val = NULL; + str->av_len = 0; + return len; + } + else + { + uint32_t nSize = (ref >> 1); + + str->av_val = (char *)data; + str->av_len = nSize; + + return len + nSize; + } + return len; +} + +int +AMF3Prop_Decode(AMFObjectProperty *prop, const char *pBuffer, int nSize, + int bDecodeName) +{ + int nOriginalSize = nSize; + AMF3DataType type; + + prop->p_name.av_len = 0; + prop->p_name.av_val = NULL; + + if (nSize == 0 || !pBuffer) + { + RTMP_Log(RTMP_LOGDEBUG, "empty buffer/no buffer pointer!"); + return -1; + } + + /* decode name */ + if (bDecodeName) + { + AVal name; + int nRes = AMF3ReadString(pBuffer, &name); + + if (name.av_len <= 0) + return nRes; + + nSize -= nRes; + if (nSize <= 0) + return -1; + prop->p_name = name; + pBuffer += nRes; + } + + /* decode */ + type = *pBuffer++; + nSize--; + + switch (type) + { + case AMF3_UNDEFINED: + case AMF3_NULL: + prop->p_type = AMF_NULL; + break; + case AMF3_FALSE: + prop->p_type = AMF_BOOLEAN; + prop->p_vu.p_number = 0.0; + break; + case AMF3_TRUE: + prop->p_type = AMF_BOOLEAN; + prop->p_vu.p_number = 1.0; + break; + case AMF3_INTEGER: + { + int32_t res = 0; + int len = AMF3ReadInteger(pBuffer, &res); + prop->p_vu.p_number = (double)res; + prop->p_type = AMF_NUMBER; + nSize -= len; + break; + } + case AMF3_DOUBLE: + if (nSize < 8) + return -1; + prop->p_vu.p_number = AMF_DecodeNumber(pBuffer); + prop->p_type = AMF_NUMBER; + nSize -= 8; + break; + case AMF3_STRING: + case AMF3_XML_DOC: + case AMF3_XML: + { + int len = AMF3ReadString(pBuffer, &prop->p_vu.p_aval); + prop->p_type = AMF_STRING; + nSize -= len; + break; + } + case AMF3_DATE: + { + int32_t res = 0; + int len = AMF3ReadInteger(pBuffer, &res); + + nSize -= len; + pBuffer += len; + + if ((res & 0x1) == 0) + { /* reference */ + uint32_t nIndex = (res >> 1); + RTMP_Log(RTMP_LOGDEBUG, "AMF3_DATE reference: %d, not supported!", nIndex); + } + else + { + if (nSize < 8) + return -1; + + prop->p_vu.p_number = AMF_DecodeNumber(pBuffer); + nSize -= 8; + prop->p_type = AMF_NUMBER; + } + break; + } + case AMF3_OBJECT: + { + int nRes = AMF3_Decode(&prop->p_vu.p_object, pBuffer, nSize, TRUE); + if (nRes == -1) + return -1; + nSize -= nRes; + prop->p_type = AMF_OBJECT; + break; + } + case AMF3_ARRAY: + case AMF3_BYTE_ARRAY: + default: + RTMP_Log(RTMP_LOGDEBUG, "%s - AMF3 unknown/unsupported datatype 0x%02x, @%p", + __FUNCTION__, (unsigned char)(*pBuffer), pBuffer); + return -1; + } + if (nSize < 0) + return -1; + + return nOriginalSize - nSize; +} + +int +AMFProp_Decode(AMFObjectProperty *prop, const char *pBuffer, int nSize, + int bDecodeName) +{ + int nOriginalSize = nSize; + int nRes; + + prop->p_name.av_len = 0; + prop->p_name.av_val = NULL; + + if (nSize == 0 || !pBuffer) + { + RTMP_Log(RTMP_LOGDEBUG, "%s: Empty buffer/no buffer pointer!", __FUNCTION__); + return -1; + } + + if (bDecodeName && nSize < 4) + { /* at least name (length + at least 1 byte) and 1 byte of data */ + RTMP_Log(RTMP_LOGDEBUG, + "%s: Not enough data for decoding with name, less than 4 bytes!", + __FUNCTION__); + return -1; + } + + if (bDecodeName) + { + unsigned short nNameSize = AMF_DecodeInt16(pBuffer); + if (nNameSize > nSize - 2) + { + RTMP_Log(RTMP_LOGDEBUG, + "%s: Name size out of range: namesize (%d) > len (%d) - 2", + __FUNCTION__, nNameSize, nSize); + return -1; + } + + AMF_DecodeString(pBuffer, &prop->p_name); + nSize -= 2 + nNameSize; + pBuffer += 2 + nNameSize; + } + + if (nSize == 0) + { + return -1; + } + + nSize--; + + prop->p_type = *pBuffer++; + switch (prop->p_type) + { + case AMF_NUMBER: + if (nSize < 8) + return -1; + prop->p_vu.p_number = AMF_DecodeNumber(pBuffer); + nSize -= 8; + break; + case AMF_BOOLEAN: + if (nSize < 1) + return -1; + prop->p_vu.p_number = (double)AMF_DecodeBoolean(pBuffer); + nSize--; + break; + case AMF_STRING: + { + unsigned short nStringSize = AMF_DecodeInt16(pBuffer); + + if (nSize < (long)nStringSize + 2) + return -1; + AMF_DecodeString(pBuffer, &prop->p_vu.p_aval); + nSize -= (2 + nStringSize); + break; + } + case AMF_OBJECT: + { + int nRes = AMF_Decode(&prop->p_vu.p_object, pBuffer, nSize, TRUE); + if (nRes == -1) + return -1; + nSize -= nRes; + break; + } + case AMF_MOVIECLIP: + { + RTMP_Log(RTMP_LOGERROR, "AMF_MOVIECLIP reserved!"); + return -1; + break; + } + case AMF_NULL: + case AMF_UNDEFINED: + case AMF_UNSUPPORTED: + prop->p_type = AMF_NULL; + break; + case AMF_REFERENCE: + { + RTMP_Log(RTMP_LOGERROR, "AMF_REFERENCE not supported!"); + return -1; + break; + } + case AMF_ECMA_ARRAY: + { + nSize -= 4; + + /* next comes the rest, mixed array has a final 0x000009 mark and names, so its an object */ + nRes = AMF_Decode(&prop->p_vu.p_object, pBuffer + 4, nSize, TRUE); + if (nRes == -1) + return -1; + nSize -= nRes; + break; + } + case AMF_OBJECT_END: + { + return -1; + break; + } + case AMF_STRICT_ARRAY: + { + unsigned int nArrayLen = AMF_DecodeInt32(pBuffer); + nSize -= 4; + + nRes = AMF_DecodeArray(&prop->p_vu.p_object, pBuffer + 4, nSize, + nArrayLen, FALSE); + if (nRes == -1) + return -1; + nSize -= nRes; + break; + } + case AMF_DATE: + { + RTMP_Log(RTMP_LOGDEBUG, "AMF_DATE"); + + if (nSize < 10) + return -1; + + prop->p_vu.p_number = AMF_DecodeNumber(pBuffer); + prop->p_UTCoffset = AMF_DecodeInt16(pBuffer + 8); + + nSize -= 10; + break; + } + case AMF_LONG_STRING: + case AMF_XML_DOC: + { + unsigned int nStringSize = AMF_DecodeInt32(pBuffer); + if (nSize < (long)nStringSize + 4) + return -1; + AMF_DecodeLongString(pBuffer, &prop->p_vu.p_aval); + nSize -= (4 + nStringSize); + if (prop->p_type == AMF_LONG_STRING) + prop->p_type = AMF_STRING; + break; + } + case AMF_RECORDSET: + { + RTMP_Log(RTMP_LOGERROR, "AMF_RECORDSET reserved!"); + return -1; + break; + } + case AMF_TYPED_OBJECT: + { + RTMP_Log(RTMP_LOGERROR, "AMF_TYPED_OBJECT not supported!"); + return -1; + break; + } + case AMF_AVMPLUS: + { + int nRes = AMF3_Decode(&prop->p_vu.p_object, pBuffer, nSize, TRUE); + if (nRes == -1) + return -1; + nSize -= nRes; + prop->p_type = AMF_OBJECT; + break; + } + default: + RTMP_Log(RTMP_LOGDEBUG, "%s - unknown datatype 0x%02x, @%p", __FUNCTION__, + prop->p_type, pBuffer - 1); + return -1; + } + + return nOriginalSize - nSize; +} + +void +AMFProp_Dump(AMFObjectProperty *prop) +{ + char strRes[256]; + char str[256]; + AVal name; + + if (prop->p_type == AMF_INVALID) + { + RTMP_Log(RTMP_LOGDEBUG, "Property: INVALID"); + return; + } + + if (prop->p_type == AMF_NULL) + { + RTMP_Log(RTMP_LOGDEBUG, "Property: NULL"); + return; + } + + if (prop->p_name.av_len) + { + name = prop->p_name; + } + else + { + name.av_val = "no-name."; + name.av_len = sizeof("no-name.") - 1; + } + if (name.av_len > 18) + name.av_len = 18; + + snprintf(strRes, 255, "Name: %18.*s, ", name.av_len, name.av_val); + + if (prop->p_type == AMF_OBJECT) + { + RTMP_Log(RTMP_LOGDEBUG, "Property: <%sOBJECT>", strRes); + AMF_Dump(&prop->p_vu.p_object); + return; + } + else if (prop->p_type == AMF_ECMA_ARRAY) + { + RTMP_Log(RTMP_LOGDEBUG, "Property: <%sECMA_ARRAY>", strRes); + AMF_Dump(&prop->p_vu.p_object); + return; + } + else if (prop->p_type == AMF_STRICT_ARRAY) + { + RTMP_Log(RTMP_LOGDEBUG, "Property: <%sSTRICT_ARRAY>", strRes); + AMF_Dump(&prop->p_vu.p_object); + return; + } + + switch (prop->p_type) + { + case AMF_NUMBER: + snprintf(str, 255, "NUMBER:\t%.2f", prop->p_vu.p_number); + break; + case AMF_BOOLEAN: + snprintf(str, 255, "BOOLEAN:\t%s", + prop->p_vu.p_number != 0.0 ? "TRUE" : "FALSE"); + break; + case AMF_STRING: + snprintf(str, 255, "STRING:\t%.*s", prop->p_vu.p_aval.av_len, + prop->p_vu.p_aval.av_val); + break; + case AMF_DATE: + snprintf(str, 255, "DATE:\ttimestamp: %.2f, UTC offset: %d", + prop->p_vu.p_number, prop->p_UTCoffset); + break; + default: + snprintf(str, 255, "INVALID TYPE 0x%02x", (unsigned char)prop->p_type); + } + + RTMP_Log(RTMP_LOGDEBUG, "Property: <%s%s>", strRes, str); +} + +void +AMFProp_Reset(AMFObjectProperty *prop) +{ + if (prop->p_type == AMF_OBJECT || prop->p_type == AMF_ECMA_ARRAY || + prop->p_type == AMF_STRICT_ARRAY) + AMF_Reset(&prop->p_vu.p_object); + else + { + prop->p_vu.p_aval.av_len = 0; + prop->p_vu.p_aval.av_val = NULL; + } + prop->p_type = AMF_INVALID; +} + +/* AMFObject */ + +char * +AMF_Encode(AMFObject *obj, char *pBuffer, char *pBufEnd) +{ + int i; + + if (pBuffer+4 >= pBufEnd) + return NULL; + + *pBuffer++ = AMF_OBJECT; + + for (i = 0; i < obj->o_num; i++) + { + char *res = AMFProp_Encode(&obj->o_props[i], pBuffer, pBufEnd); + if (res == NULL) + { + RTMP_Log(RTMP_LOGERROR, "AMF_Encode - failed to encode property in index %d", + i); + break; + } + else + { + pBuffer = res; + } + } + + if (pBuffer + 3 >= pBufEnd) + return NULL; /* no room for the end marker */ + + pBuffer = AMF_EncodeInt24(pBuffer, pBufEnd, AMF_OBJECT_END); + + return pBuffer; +} + +char * +AMF_EncodeEcmaArray(AMFObject *obj, char *pBuffer, char *pBufEnd) +{ + int i; + + if (pBuffer+4 >= pBufEnd) + return NULL; + + *pBuffer++ = AMF_ECMA_ARRAY; + + pBuffer = AMF_EncodeInt32(pBuffer, pBufEnd, obj->o_num); + + for (i = 0; i < obj->o_num; i++) + { + char *res = AMFProp_Encode(&obj->o_props[i], pBuffer, pBufEnd); + if (res == NULL) + { + RTMP_Log(RTMP_LOGERROR, "AMF_Encode - failed to encode property in index %d", + i); + break; + } + else + { + pBuffer = res; + } + } + + if (pBuffer + 3 >= pBufEnd) + return NULL; /* no room for the end marker */ + + pBuffer = AMF_EncodeInt24(pBuffer, pBufEnd, AMF_OBJECT_END); + + return pBuffer; +} + +char * +AMF_EncodeArray(AMFObject *obj, char *pBuffer, char *pBufEnd) +{ + int i; + + if (pBuffer+4 >= pBufEnd) + return NULL; + + *pBuffer++ = AMF_STRICT_ARRAY; + + pBuffer = AMF_EncodeInt32(pBuffer, pBufEnd, obj->o_num); + + for (i = 0; i < obj->o_num; i++) + { + char *res = AMFProp_Encode(&obj->o_props[i], pBuffer, pBufEnd); + if (res == NULL) + { + RTMP_Log(RTMP_LOGERROR, "AMF_Encode - failed to encode property in index %d", + i); + break; + } + else + { + pBuffer = res; + } + } + + //if (pBuffer + 3 >= pBufEnd) + // return NULL; /* no room for the end marker */ + + //pBuffer = AMF_EncodeInt24(pBuffer, pBufEnd, AMF_OBJECT_END); + + return pBuffer; +} + +int +AMF_DecodeArray(AMFObject *obj, const char *pBuffer, int nSize, + int nArrayLen, int bDecodeName) +{ + int nOriginalSize = nSize; + int bError = FALSE; + + obj->o_num = 0; + obj->o_props = NULL; + while (nArrayLen > 0) + { + AMFObjectProperty prop; + int nRes; + nArrayLen--; + + if (nSize <= 0) + { + bError = TRUE; + break; + } + nRes = AMFProp_Decode(&prop, pBuffer, nSize, bDecodeName); + if (nRes == -1) + { + bError = TRUE; + break; + } + else + { + nSize -= nRes; + pBuffer += nRes; + AMF_AddProp(obj, &prop); + } + } + if (bError) + return -1; + + return nOriginalSize - nSize; +} + +int +AMF3_Decode(AMFObject *obj, const char *pBuffer, int nSize, int bAMFData) +{ + int nOriginalSize = nSize; + int32_t ref; + int len; + + obj->o_num = 0; + obj->o_props = NULL; + if (bAMFData) + { + if (*pBuffer != AMF3_OBJECT) + RTMP_Log(RTMP_LOGERROR, + "AMF3 Object encapsulated in AMF stream does not start with AMF3_OBJECT!"); + pBuffer++; + nSize--; + } + + ref = 0; + len = AMF3ReadInteger(pBuffer, &ref); + pBuffer += len; + nSize -= len; + + if ((ref & 1) == 0) + { /* object reference, 0xxx */ + uint32_t objectIndex = (ref >> 1); + + RTMP_Log(RTMP_LOGDEBUG, "Object reference, index: %d", objectIndex); + } + else /* object instance */ + { + int32_t classRef = (ref >> 1); + + AMF3ClassDef cd = { {0, 0} + }; + AMFObjectProperty prop; + + if ((classRef & 0x1) == 0) + { /* class reference */ + uint32_t classIndex = (classRef >> 1); + RTMP_Log(RTMP_LOGDEBUG, "Class reference: %d", classIndex); + } + else + { + int32_t classExtRef = (classRef >> 1); + int i, cdnum; + + cd.cd_externalizable = (classExtRef & 0x1) == 1; + cd.cd_dynamic = ((classExtRef >> 1) & 0x1) == 1; + + cdnum = classExtRef >> 2; + + /* class name */ + + len = AMF3ReadString(pBuffer, &cd.cd_name); + nSize -= len; + pBuffer += len; + + /*std::string str = className; */ + + RTMP_Log(RTMP_LOGDEBUG, + "Class name: %s, externalizable: %d, dynamic: %d, classMembers: %d", + cd.cd_name.av_val, cd.cd_externalizable, cd.cd_dynamic, + cd.cd_num); + + for (i = 0; i < cdnum; i++) + { + AVal memberName; + if (nSize <=0) + { +invalid: + RTMP_Log(RTMP_LOGDEBUG, "%s, invalid class encoding!", + __FUNCTION__); + return nOriginalSize; + } + len = AMF3ReadString(pBuffer, &memberName); + RTMP_Log(RTMP_LOGDEBUG, "Member: %s", memberName.av_val); + AMF3CD_AddProp(&cd, &memberName); + nSize -= len; + pBuffer += len; + } + } + + /* add as referencable object */ + + if (cd.cd_externalizable) + { + int nRes; + AVal name = AVC("DEFAULT_ATTRIBUTE"); + + RTMP_Log(RTMP_LOGDEBUG, "Externalizable, TODO check"); + + nRes = AMF3Prop_Decode(&prop, pBuffer, nSize, FALSE); + if (nRes == -1) + RTMP_Log(RTMP_LOGDEBUG, "%s, failed to decode AMF3 property!", + __FUNCTION__); + else + { + nSize -= nRes; + pBuffer += nRes; + } + + AMFProp_SetName(&prop, &name); + AMF_AddProp(obj, &prop); + } + else + { + int nRes, i; + for (i = 0; i < cd.cd_num; i++) /* non-dynamic */ + { + if (nSize <=0) + goto invalid; + nRes = AMF3Prop_Decode(&prop, pBuffer, nSize, FALSE); + if (nRes == -1) + RTMP_Log(RTMP_LOGDEBUG, "%s, failed to decode AMF3 property!", + __FUNCTION__); + + AMFProp_SetName(&prop, AMF3CD_GetProp(&cd, i)); + AMF_AddProp(obj, &prop); + + pBuffer += nRes; + nSize -= nRes; + } + if (cd.cd_dynamic) + { + int len = 0; + + do + { + if (nSize <=0) + goto invalid; + nRes = AMF3Prop_Decode(&prop, pBuffer, nSize, TRUE); + AMF_AddProp(obj, &prop); + + pBuffer += nRes; + nSize -= nRes; + + len = prop.p_name.av_len; + } + while (len > 0); + } + } + RTMP_Log(RTMP_LOGDEBUG, "class object!"); + } + return nOriginalSize - nSize; +} + +int +AMF_Decode(AMFObject *obj, const char *pBuffer, int nSize, int bDecodeName) +{ + int nOriginalSize = nSize; + int bError = FALSE; /* if there is an error while decoding - try to at least find the end mark AMF_OBJECT_END */ + + obj->o_num = 0; + obj->o_props = NULL; + while (nSize > 0) + { + AMFObjectProperty prop; + int nRes; + + if (nSize >=3 && AMF_DecodeInt24(pBuffer) == AMF_OBJECT_END) + { + nSize -= 3; + bError = FALSE; + break; + } + + if (bError) + { + RTMP_Log(RTMP_LOGERROR, + "DECODING ERROR, IGNORING BYTES UNTIL NEXT KNOWN PATTERN!"); + nSize--; + pBuffer++; + continue; + } + + nRes = AMFProp_Decode(&prop, pBuffer, nSize, bDecodeName); + if (nRes == -1) + { + bError = TRUE; + break; + } + else + { + nSize -= nRes; + if (nSize < 0) + { + bError = TRUE; + break; + } + pBuffer += nRes; + AMF_AddProp(obj, &prop); + } + } + + if (bError) + return -1; + + return nOriginalSize - nSize; +} + +void +AMF_AddProp(AMFObject *obj, const AMFObjectProperty *prop) +{ + if (!(obj->o_num & 0x0f)) + obj->o_props = + realloc(obj->o_props, (obj->o_num + 16) * sizeof(AMFObjectProperty)); + memcpy(&obj->o_props[obj->o_num++], prop, sizeof(AMFObjectProperty)); +} + +int +AMF_CountProp(AMFObject *obj) +{ + return obj->o_num; +} + +AMFObjectProperty * +AMF_GetProp(AMFObject *obj, const AVal *name, int nIndex) +{ + if (nIndex >= 0) + { + if (nIndex < obj->o_num) + return &obj->o_props[nIndex]; + } + else + { + int n; + for (n = 0; n < obj->o_num; n++) + { + if (AVMATCH(&obj->o_props[n].p_name, name)) + return &obj->o_props[n]; + } + } + + return (AMFObjectProperty *)&AMFProp_Invalid; +} + +void +AMF_Dump(AMFObject *obj) +{ + int n; + RTMP_Log(RTMP_LOGDEBUG, "(object begin)"); + for (n = 0; n < obj->o_num; n++) + { + AMFProp_Dump(&obj->o_props[n]); + } + RTMP_Log(RTMP_LOGDEBUG, "(object end)"); +} + +void +AMF_Reset(AMFObject *obj) +{ + int n; + for (n = 0; n < obj->o_num; n++) + { + AMFProp_Reset(&obj->o_props[n]); + } + free(obj->o_props); + obj->o_props = NULL; + obj->o_num = 0; +} + + +/* AMF3ClassDefinition */ + +void +AMF3CD_AddProp(AMF3ClassDef *cd, AVal *prop) +{ + if (!(cd->cd_num & 0x0f)) + cd->cd_props = realloc(cd->cd_props, (cd->cd_num + 16) * sizeof(AVal)); + cd->cd_props[cd->cd_num++] = *prop; +} + +AVal * +AMF3CD_GetProp(AMF3ClassDef *cd, int nIndex) +{ + if (nIndex >= cd->cd_num) + return (AVal *)&AV_empty; + return &cd->cd_props[nIndex]; +} diff --git a/MediaClient/MediaClient/librtmp/amf.h b/MediaClient/MediaClient/librtmp/amf.h new file mode 100644 index 0000000..cca11fa --- /dev/null +++ b/MediaClient/MediaClient/librtmp/amf.h @@ -0,0 +1,164 @@ +#ifndef __AMF_H__ +#define __AMF_H__ +/* + * Copyright (C) 2005-2008 Team XBMC + * http://www.xbmc.org + * Copyright (C) 2008-2009 Andrej Stepanchuk + * Copyright (C) 2009-2010 Howard Chu + * + * This file is part of librtmp. + * + * librtmp is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1, + * or (at your option) any later version. + * + * librtmp is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with librtmp see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * http://www.gnu.org/copyleft/lgpl.html + */ + +#include + +#ifndef TRUE +#define TRUE 1 +#define FALSE 0 +#endif + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef enum + { AMF_NUMBER = 0, AMF_BOOLEAN, AMF_STRING, AMF_OBJECT, + AMF_MOVIECLIP, /* reserved, not used */ + AMF_NULL, AMF_UNDEFINED, AMF_REFERENCE, AMF_ECMA_ARRAY, AMF_OBJECT_END, + AMF_STRICT_ARRAY, AMF_DATE, AMF_LONG_STRING, AMF_UNSUPPORTED, + AMF_RECORDSET, /* reserved, not used */ + AMF_XML_DOC, AMF_TYPED_OBJECT, + AMF_AVMPLUS, /* switch to AMF3 */ + AMF_INVALID = 0xff + } AMFDataType; + + typedef enum + { AMF3_UNDEFINED = 0, AMF3_NULL, AMF3_FALSE, AMF3_TRUE, + AMF3_INTEGER, AMF3_DOUBLE, AMF3_STRING, AMF3_XML_DOC, AMF3_DATE, + AMF3_ARRAY, AMF3_OBJECT, AMF3_XML, AMF3_BYTE_ARRAY + } AMF3DataType; + + typedef struct AVal + { + char *av_val; + int av_len; + } AVal; +#define AVC(str) {(char*)str,sizeof(str)-1} +#define AVMATCH(a1,a2) ((a1)->av_len == (a2)->av_len && !memcmp((a1)->av_val,(a2)->av_val,(a1)->av_len)) + + struct AMFObjectProperty; + + typedef struct AMFObject + { + int o_num; + struct AMFObjectProperty *o_props; + } AMFObject; + + typedef struct AMFObjectProperty + { + AVal p_name; + AMFDataType p_type; + union + { + double p_number; + AVal p_aval; + AMFObject p_object; + } p_vu; + int16_t p_UTCoffset; + } AMFObjectProperty; + + char *AMF_EncodeString(char *output, char *outend, const AVal * str); + char *AMF_EncodeNumber(char *output, char *outend, double dVal); + char *AMF_EncodeInt16(char *output, char *outend, short nVal); + char *AMF_EncodeInt24(char *output, char *outend, int nVal); + char *AMF_EncodeInt32(char *output, char *outend, int nVal); + char *AMF_EncodeBoolean(char *output, char *outend, int bVal); + + /* Shortcuts for AMFProp_Encode */ + char *AMF_EncodeNamedString(char *output, char *outend, const AVal * name, const AVal * value); + char *AMF_EncodeNamedNumber(char *output, char *outend, const AVal * name, double dVal); + char *AMF_EncodeNamedBoolean(char *output, char *outend, const AVal * name, int bVal); + + unsigned short AMF_DecodeInt16(const char *data); + unsigned int AMF_DecodeInt24(const char *data); + unsigned int AMF_DecodeInt32(const char *data); + void AMF_DecodeString(const char *data, AVal * str); + void AMF_DecodeLongString(const char *data, AVal * str); + int AMF_DecodeBoolean(const char *data); + double AMF_DecodeNumber(const char *data); + + char *AMF_Encode(AMFObject * obj, char *pBuffer, char *pBufEnd); + char *AMF_EncodeEcmaArray(AMFObject *obj, char *pBuffer, char *pBufEnd); + char *AMF_EncodeArray(AMFObject *obj, char *pBuffer, char *pBufEnd); + + int AMF_Decode(AMFObject * obj, const char *pBuffer, int nSize, + int bDecodeName); + int AMF_DecodeArray(AMFObject * obj, const char *pBuffer, int nSize, + int nArrayLen, int bDecodeName); + int AMF3_Decode(AMFObject * obj, const char *pBuffer, int nSize, + int bDecodeName); + void AMF_Dump(AMFObject * obj); + void AMF_Reset(AMFObject * obj); + + void AMF_AddProp(AMFObject * obj, const AMFObjectProperty * prop); + int AMF_CountProp(AMFObject * obj); + AMFObjectProperty *AMF_GetProp(AMFObject * obj, const AVal * name, + int nIndex); + + AMFDataType AMFProp_GetType(AMFObjectProperty * prop); + void AMFProp_SetNumber(AMFObjectProperty * prop, double dval); + void AMFProp_SetBoolean(AMFObjectProperty * prop, int bflag); + void AMFProp_SetString(AMFObjectProperty * prop, AVal * str); + void AMFProp_SetObject(AMFObjectProperty * prop, AMFObject * obj); + + void AMFProp_GetName(AMFObjectProperty * prop, AVal * name); + void AMFProp_SetName(AMFObjectProperty * prop, AVal * name); + double AMFProp_GetNumber(AMFObjectProperty * prop); + int AMFProp_GetBoolean(AMFObjectProperty * prop); + void AMFProp_GetString(AMFObjectProperty * prop, AVal * str); + void AMFProp_GetObject(AMFObjectProperty * prop, AMFObject * obj); + + int AMFProp_IsValid(AMFObjectProperty * prop); + + char *AMFProp_Encode(AMFObjectProperty * prop, char *pBuffer, char *pBufEnd); + int AMF3Prop_Decode(AMFObjectProperty * prop, const char *pBuffer, + int nSize, int bDecodeName); + int AMFProp_Decode(AMFObjectProperty * prop, const char *pBuffer, + int nSize, int bDecodeName); + + void AMFProp_Dump(AMFObjectProperty * prop); + void AMFProp_Reset(AMFObjectProperty * prop); + + typedef struct AMF3ClassDef + { + AVal cd_name; + char cd_externalizable; + char cd_dynamic; + int cd_num; + AVal *cd_props; + } AMF3ClassDef; + + void AMF3CD_AddProp(AMF3ClassDef * cd, AVal * prop); + AVal *AMF3CD_GetProp(AMF3ClassDef * cd, int idx); + +#ifdef __cplusplus +} +#endif + +#endif /* __AMF_H__ */ diff --git a/MediaClient/MediaClient/librtmp/bytes.h b/MediaClient/MediaClient/librtmp/bytes.h new file mode 100644 index 0000000..0afa366 --- /dev/null +++ b/MediaClient/MediaClient/librtmp/bytes.h @@ -0,0 +1,93 @@ +/* + * Copyright (C) 2005-2008 Team XBMC + * http://www.xbmc.org + * Copyright (C) 2008-2009 Andrej Stepanchuk + * Copyright (C) 2009-2010 Howard Chu + * + * This file is part of librtmp. + * + * librtmp is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1, + * or (at your option) any later version. + * + * librtmp is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with librtmp see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * http://www.gnu.org/copyleft/lgpl.html + */ + +#ifndef __BYTES_H__ +#define __BYTES_H__ + +#include + +#ifdef _WIN32 +/* Windows is little endian only */ +#define __LITTLE_ENDIAN 1234 +#define __BIG_ENDIAN 4321 +#define __BYTE_ORDER __LITTLE_ENDIAN +#define __FLOAT_WORD_ORDER __BYTE_ORDER + +typedef unsigned char uint8_t; + +#else /* !_WIN32 */ + +#include + +#if defined(BYTE_ORDER) && !defined(__BYTE_ORDER) +#define __BYTE_ORDER BYTE_ORDER +#endif + +#if defined(BIG_ENDIAN) && !defined(__BIG_ENDIAN) +#define __BIG_ENDIAN BIG_ENDIAN +#endif + +#if defined(LITTLE_ENDIAN) && !defined(__LITTLE_ENDIAN) +#define __LITTLE_ENDIAN LITTLE_ENDIAN +#endif + +#define __FLOAT_WORD_ORDER __BYTE_ORDER + +#endif /* !_WIN32 */ + +/* define default endianness */ +#ifndef __LITTLE_ENDIAN +#define __LITTLE_ENDIAN 1234 +#endif + +#ifndef __BIG_ENDIAN +#define __BIG_ENDIAN 4321 +#endif + +#ifndef __BYTE_ORDER +#warning "Byte order not defined on your system, assuming little endian!" +#define __BYTE_ORDER __LITTLE_ENDIAN +#endif + +/* ok, we assume to have the same float word order and byte order if float word order is not defined */ +#ifndef __FLOAT_WORD_ORDER +#warning "Float word order not defined, assuming the same as byte order!" +#define __FLOAT_WORD_ORDER __BYTE_ORDER +#endif + +#if !defined(__BYTE_ORDER) || !defined(__FLOAT_WORD_ORDER) +#error "Undefined byte or float word order!" +#endif + +#if __FLOAT_WORD_ORDER != __BIG_ENDIAN && __FLOAT_WORD_ORDER != __LITTLE_ENDIAN +#error "Unknown/unsupported float word order!" +#endif + +#if __BYTE_ORDER != __BIG_ENDIAN && __BYTE_ORDER != __LITTLE_ENDIAN +#error "Unknown/unsupported byte order!" +#endif + +#endif + diff --git a/MediaClient/MediaClient/librtmp/dh.h b/MediaClient/MediaClient/librtmp/dh.h new file mode 100644 index 0000000..cba535a --- /dev/null +++ b/MediaClient/MediaClient/librtmp/dh.h @@ -0,0 +1,386 @@ +/* RTMPDump - Diffie-Hellmann Key Exchange + * Copyright (C) 2009 Andrej Stepanchuk + * Copyright (C) 2009-2010 Howard Chu + * + * This file is part of librtmp. + * + * librtmp is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1, + * or (at your option) any later version. + * + * librtmp is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with librtmp see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * http://www.gnu.org/copyleft/lgpl.html + */ + +#include +#include +#include +#include +#include + +#ifdef USE_POLARSSL +#include +typedef mpi * MP_t; +#define MP_new(m) m = malloc(sizeof(mpi)); mpi_init(m) +#define MP_set_w(mpi, w) mpi_lset(mpi, w) +#define MP_cmp(u, v) mpi_cmp_mpi(u, v) +#define MP_set(u, v) mpi_copy(u, v) +#define MP_sub_w(mpi, w) mpi_sub_int(mpi, mpi, w) +#define MP_cmp_1(mpi) mpi_cmp_int(mpi, 1) +#define MP_modexp(r, y, q, p) mpi_exp_mod(r, y, q, p, NULL) +#define MP_free(mpi) mpi_free(mpi); free(mpi) +#define MP_gethex(u, hex, res) MP_new(u); res = mpi_read_string(u, 16, hex) == 0 +#define MP_bytes(u) mpi_size(u) +#define MP_setbin(u,buf,len) mpi_write_binary(u,buf,len) +#define MP_getbin(u,buf,len) MP_new(u); mpi_read_binary(u,buf,len) + +typedef struct MDH { + MP_t p; + MP_t g; + MP_t pub_key; + MP_t priv_key; + long length; + dhm_context ctx; +} MDH; + +#define MDH_new() calloc(1,sizeof(MDH)) +#define MDH_free(vp) {MDH *_dh = vp; dhm_free(&_dh->ctx); MP_free(_dh->p); MP_free(_dh->g); MP_free(_dh->pub_key); MP_free(_dh->priv_key); free(_dh);} + +static int MDH_generate_key(MDH *dh) +{ + unsigned char out[2]; + MP_set(&dh->ctx.P, dh->p); + MP_set(&dh->ctx.G, dh->g); + dh->ctx.len = 128; + dhm_make_public(&dh->ctx, 1024, out, 1, havege_random, &RTMP_TLS_ctx->hs); + MP_new(dh->pub_key); + MP_new(dh->priv_key); + MP_set(dh->pub_key, &dh->ctx.GX); + MP_set(dh->priv_key, &dh->ctx.X); + return 1; +} + +static int MDH_compute_key(uint8_t *secret, size_t len, MP_t pub, MDH *dh) +{ + MP_set(&dh->ctx.GY, pub); + dhm_calc_secret(&dh->ctx, secret, &len); + return 0; +} + +#elif defined(USE_GNUTLS) +#include +#include +#include +typedef mpz_ptr MP_t; +#define MP_new(m) m = malloc(sizeof(*m)); mpz_init2(m, 1) +#define MP_set_w(mpi, w) mpz_set_ui(mpi, w) +#define MP_cmp(u, v) mpz_cmp(u, v) +#define MP_set(u, v) mpz_set(u, v) +#define MP_sub_w(mpi, w) mpz_sub_ui(mpi, mpi, w) +#define MP_cmp_1(mpi) mpz_cmp_ui(mpi, 1) +#define MP_modexp(r, y, q, p) mpz_powm(r, y, q, p) +#define MP_free(mpi) mpz_clear(mpi); free(mpi) +#define MP_gethex(u, hex, res) u = malloc(sizeof(*u)); mpz_init2(u, 1); res = (mpz_set_str(u, hex, 16) == 0) +#define MP_bytes(u) (mpz_sizeinbase(u, 2) + 7) / 8 +#define MP_setbin(u,buf,len) nettle_mpz_get_str_256(len,buf,u) +#define MP_getbin(u,buf,len) u = malloc(sizeof(*u)); mpz_init2(u, 1); nettle_mpz_set_str_256_u(u,len,buf) + +typedef struct MDH { + MP_t p; + MP_t g; + MP_t pub_key; + MP_t priv_key; + long length; +} MDH; + +#define MDH_new() calloc(1,sizeof(MDH)) +#define MDH_free(dh) do {MP_free(((MDH*)(dh))->p); MP_free(((MDH*)(dh))->g); MP_free(((MDH*)(dh))->pub_key); MP_free(((MDH*)(dh))->priv_key); free(dh);} while(0) + +static int MDH_generate_key(MDH *dh) +{ + int num_bytes; + uint32_t seed; + gmp_randstate_t rs; + + num_bytes = (mpz_sizeinbase(dh->p, 2) + 7) / 8 - 1; + if (num_bytes <= 0 || num_bytes > 18000) + return 0; + + dh->priv_key = calloc(1, sizeof(*dh->priv_key)); + if (!dh->priv_key) + return 0; + mpz_init2(dh->priv_key, 1); + gnutls_rnd(GNUTLS_RND_RANDOM, &seed, sizeof(seed)); + gmp_randinit_mt(rs); + gmp_randseed_ui(rs, seed); + mpz_urandomb(dh->priv_key, rs, num_bytes); + gmp_randclear(rs); + + dh->pub_key = calloc(1, sizeof(*dh->pub_key)); + if (!dh->pub_key) + return 0; + mpz_init2(dh->pub_key, 1); + if (!dh->pub_key) { + mpz_clear(dh->priv_key); + free(dh->priv_key); + return 0; + } + + mpz_powm(dh->pub_key, dh->g, dh->priv_key, dh->p); + + return 1; +} + +static int MDH_compute_key(uint8_t *secret, size_t len, MP_t pub, MDH *dh) +{ + mpz_ptr k; + int num_bytes; + + num_bytes = (mpz_sizeinbase(dh->p, 2) + 7) / 8; + if (num_bytes <= 0 || num_bytes > 18000) + return -1; + + k = calloc(1, sizeof(*k)); + if (!k) + return -1; + mpz_init2(k, 1); + + mpz_powm(k, pub, dh->priv_key, dh->p); + nettle_mpz_get_str_256(len, secret, k); + mpz_clear(k); + free(k); + + /* return the length of the shared secret key like DH_compute_key */ + return len; +} + +#else /* USE_OPENSSL */ +#include +#include + +typedef BIGNUM * MP_t; +#define MP_new(m) m = BN_new() +#define MP_set_w(mpi, w) BN_set_word(mpi, w) +#define MP_cmp(u, v) BN_cmp(u, v) +#define MP_set(u, v) BN_copy(u, v) +#define MP_sub_w(mpi, w) BN_sub_word(mpi, w) +#define MP_cmp_1(mpi) BN_cmp(mpi, BN_value_one()) +#define MP_modexp(r, y, q, p) do {BN_CTX *ctx = BN_CTX_new(); BN_mod_exp(r, y, q, p, ctx); BN_CTX_free(ctx);} while(0) +#define MP_free(mpi) BN_free(mpi) +#define MP_gethex(u, hex, res) res = BN_hex2bn(&u, hex) +#define MP_bytes(u) BN_num_bytes(u) +#define MP_setbin(u,buf,len) BN_bn2bin(u,buf) +#define MP_getbin(u,buf,len) u = BN_bin2bn(buf,len,0) + +#define MDH DH +#define MDH_new() DH_new() +#define MDH_free(dh) DH_free(dh) +#define MDH_generate_key(dh) DH_generate_key(dh) +#define MDH_compute_key(secret, seclen, pub, dh) DH_compute_key(secret, pub, dh) + +#endif + +#include "log.h" +#include "dhgroups.h" + +/* RFC 2631, Section 2.1.5, http://www.ietf.org/rfc/rfc2631.txt */ +static int +isValidPublicKey(MP_t y, MP_t p, MP_t q) +{ + int ret = TRUE; + MP_t bn; + assert(y); + + MP_new(bn); + assert(bn); + + /* y must lie in [2,p-1] */ + MP_set_w(bn, 1); + if (MP_cmp(y, bn) < 0) + { + RTMP_Log(RTMP_LOGERROR, "DH public key must be at least 2"); + ret = FALSE; + goto failed; + } + + /* bn = p-2 */ + MP_set(bn, p); + MP_sub_w(bn, 1); + if (MP_cmp(y, bn) > 0) + { + RTMP_Log(RTMP_LOGERROR, "DH public key must be at most p-2"); + ret = FALSE; + goto failed; + } + + /* Verify with Sophie-Germain prime + * + * This is a nice test to make sure the public key position is calculated + * correctly. This test will fail in about 50% of the cases if applied to + * random data. + */ + if (q) + { + /* y must fulfill y^q mod p = 1 */ + MP_modexp(bn, y, q, p); + + if (MP_cmp_1(bn) != 0) + { + RTMP_Log(RTMP_LOGWARNING, "DH public key does not fulfill y^q mod p = 1"); + } + } + +failed: + MP_free(bn); + return ret; +} + +static MDH * +DHInit(int nKeyBits) +{ + size_t res; + MDH *dh = MDH_new(); + + if (!dh) + goto failed; + + BIGNUM *p; + BIGNUM *g; + DH_get0_pqg(dh,(const BIGNUM **)&p,NULL,(const BIGNUM **)&g); + MP_new(g); + + if (!g) + goto failed; + + MP_gethex(p, P1024, res); /* prime P1024, see dhgroups.h */ + if (!res) + { + goto failed; + } + + MP_set_w(g, 2); /* base 2 */ + + DH_set_length(dh, nKeyBits); + return dh; + +failed: + if (dh) + MDH_free(dh); + + return 0; +} + +static int +DHGenerateKey(MDH *dh) +{ + size_t res = 0; + if (!dh) + return 0; + + while (!res) + { + MP_t q1 = NULL; + + if (!MDH_generate_key(dh)) + return 0; + + MP_gethex(q1, Q1024, res); + assert(res); + + BIGNUM *pub_key, *priv_key, *p; + DH_get0_key(dh, (const BIGNUM **)&pub_key, (const BIGNUM **)&priv_key); + DH_get0_pqg(dh,(const BIGNUM **)&p,NULL,NULL); + res = isValidPublicKey(pub_key, p, q1); + if (!res) + { + MP_free(pub_key); + MP_free(priv_key); + DH_set0_key(dh, 0, 0); + } + + MP_free(q1); + } + return 1; +} + +/* fill pubkey with the public key in BIG ENDIAN order + * 00 00 00 00 00 x1 x2 x3 ..... + */ + +static int +DHGetPublicKey(MDH *dh, uint8_t *pubkey, size_t nPubkeyLen) +{ + int len; + BIGNUM *pub_key; + DH_get0_key(dh, (const BIGNUM **)&pub_key, NULL); + if (!dh || !pub_key) + return 0; + + len = MP_bytes(pub_key); + if (len <= 0 || len > (int) nPubkeyLen) + return 0; + + memset(pubkey, 0, nPubkeyLen); + MP_setbin(pub_key, pubkey + (nPubkeyLen - len), len); + return 1; +} + +#if 0 /* unused */ +static int +DHGetPrivateKey(MDH *dh, uint8_t *privkey, size_t nPrivkeyLen) +{ + if (!dh || !dh->priv_key) + return 0; + + int len = MP_bytes(dh->priv_key); + if (len <= 0 || len > (int) nPrivkeyLen) + return 0; + + memset(privkey, 0, nPrivkeyLen); + MP_setbin(dh->priv_key, privkey + (nPrivkeyLen - len), len); + return 1; +} +#endif + +/* computes the shared secret key from the private MDH value and the + * other party's public key (pubkey) + */ +static int +DHComputeSharedSecretKey(MDH *dh, uint8_t *pubkey, size_t nPubkeyLen, + uint8_t *secret) +{ + MP_t q1 = NULL, pubkeyBn = NULL; + size_t len; + int res; + + if (!dh || !secret || nPubkeyLen >= INT_MAX) + return -1; + + MP_getbin(pubkeyBn, pubkey, nPubkeyLen); + if (!pubkeyBn) + return -1; + + MP_gethex(q1, Q1024, len); + assert(len); + + BIGNUM *p; + DH_get0_pqg(dh,(const BIGNUM **)&p,NULL,NULL); + if (isValidPublicKey(pubkeyBn, p, q1)) + res = MDH_compute_key(secret, nPubkeyLen, pubkeyBn, dh); + else + res = -1; + + MP_free(q1); + MP_free(pubkeyBn); + + return res; +} diff --git a/MediaClient/MediaClient/librtmp/dhgroups.h b/MediaClient/MediaClient/librtmp/dhgroups.h new file mode 100644 index 0000000..2db3989 --- /dev/null +++ b/MediaClient/MediaClient/librtmp/dhgroups.h @@ -0,0 +1,199 @@ +/* librtmp - Diffie-Hellmann Key Exchange + * Copyright (C) 2009 Andrej Stepanchuk + * + * This file is part of librtmp. + * + * librtmp is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1, + * or (at your option) any later version. + * + * librtmp is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with librtmp see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * http://www.gnu.org/copyleft/lgpl.html + */ + +/* from RFC 3526, see http://www.ietf.org/rfc/rfc3526.txt */ + +/* 2^768 - 2 ^704 - 1 + 2^64 * { [2^638 pi] + 149686 } */ +#define P768 \ + "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1" \ + "29024E088A67CC74020BBEA63B139B22514A08798E3404DD" \ + "EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245" \ + "E485B576625E7EC6F44C42E9A63A3620FFFFFFFFFFFFFFFF" + +/* 2^1024 - 2^960 - 1 + 2^64 * { [2^894 pi] + 129093 } */ +#define P1024 \ + "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1" \ + "29024E088A67CC74020BBEA63B139B22514A08798E3404DD" \ + "EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245" \ + "E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED" \ + "EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE65381" \ + "FFFFFFFFFFFFFFFF" + +/* Group morder largest prime factor: */ +#define Q1024 \ + "7FFFFFFFFFFFFFFFE487ED5110B4611A62633145C06E0E68" \ + "948127044533E63A0105DF531D89CD9128A5043CC71A026E" \ + "F7CA8CD9E69D218D98158536F92F8A1BA7F09AB6B6A8E122" \ + "F242DABB312F3F637A262174D31BF6B585FFAE5B7A035BF6" \ + "F71C35FDAD44CFD2D74F9208BE258FF324943328F67329C0" \ + "FFFFFFFFFFFFFFFF" + +/* 2^1536 - 2^1472 - 1 + 2^64 * { [2^1406 pi] + 741804 } */ +#define P1536 \ + "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1" \ + "29024E088A67CC74020BBEA63B139B22514A08798E3404DD" \ + "EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245" \ + "E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED" \ + "EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3D" \ + "C2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F" \ + "83655D23DCA3AD961C62F356208552BB9ED529077096966D" \ + "670C354E4ABC9804F1746C08CA237327FFFFFFFFFFFFFFFF" + +/* 2^2048 - 2^1984 - 1 + 2^64 * { [2^1918 pi] + 124476 } */ +#define P2048 \ + "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1" \ + "29024E088A67CC74020BBEA63B139B22514A08798E3404DD" \ + "EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245" \ + "E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED" \ + "EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3D" \ + "C2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F" \ + "83655D23DCA3AD961C62F356208552BB9ED529077096966D" \ + "670C354E4ABC9804F1746C08CA18217C32905E462E36CE3B" \ + "E39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9" \ + "DE2BCBF6955817183995497CEA956AE515D2261898FA0510" \ + "15728E5A8AACAA68FFFFFFFFFFFFFFFF" + +/* 2^3072 - 2^3008 - 1 + 2^64 * { [2^2942 pi] + 1690314 } */ +#define P3072 \ + "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1" \ + "29024E088A67CC74020BBEA63B139B22514A08798E3404DD" \ + "EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245" \ + "E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED" \ + "EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3D" \ + "C2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F" \ + "83655D23DCA3AD961C62F356208552BB9ED529077096966D" \ + "670C354E4ABC9804F1746C08CA18217C32905E462E36CE3B" \ + "E39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9" \ + "DE2BCBF6955817183995497CEA956AE515D2261898FA0510" \ + "15728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64" \ + "ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7" \ + "ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6B" \ + "F12FFA06D98A0864D87602733EC86A64521F2B18177B200C" \ + "BBE117577A615D6C770988C0BAD946E208E24FA074E5AB31" \ + "43DB5BFCE0FD108E4B82D120A93AD2CAFFFFFFFFFFFFFFFF" + +/* 2^4096 - 2^4032 - 1 + 2^64 * { [2^3966 pi] + 240904 } */ +#define P4096 \ + "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1" \ + "29024E088A67CC74020BBEA63B139B22514A08798E3404DD" \ + "EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245" \ + "E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED" \ + "EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3D" \ + "C2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F" \ + "83655D23DCA3AD961C62F356208552BB9ED529077096966D" \ + "670C354E4ABC9804F1746C08CA18217C32905E462E36CE3B" \ + "E39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9" \ + "DE2BCBF6955817183995497CEA956AE515D2261898FA0510" \ + "15728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64" \ + "ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7" \ + "ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6B" \ + "F12FFA06D98A0864D87602733EC86A64521F2B18177B200C" \ + "BBE117577A615D6C770988C0BAD946E208E24FA074E5AB31" \ + "43DB5BFCE0FD108E4B82D120A92108011A723C12A787E6D7" \ + "88719A10BDBA5B2699C327186AF4E23C1A946834B6150BDA" \ + "2583E9CA2AD44CE8DBBBC2DB04DE8EF92E8EFC141FBECAA6" \ + "287C59474E6BC05D99B2964FA090C3A2233BA186515BE7ED" \ + "1F612970CEE2D7AFB81BDD762170481CD0069127D5B05AA9" \ + "93B4EA988D8FDDC186FFB7DC90A6C08F4DF435C934063199" \ + "FFFFFFFFFFFFFFFF" + +/* 2^6144 - 2^6080 - 1 + 2^64 * { [2^6014 pi] + 929484 } */ +#define P6144 \ + "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1" \ + "29024E088A67CC74020BBEA63B139B22514A08798E3404DD" \ + "EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245" \ + "E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED" \ + "EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3D" \ + "C2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F" \ + "83655D23DCA3AD961C62F356208552BB9ED529077096966D" \ + "670C354E4ABC9804F1746C08CA18217C32905E462E36CE3B" \ + "E39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9" \ + "DE2BCBF6955817183995497CEA956AE515D2261898FA0510" \ + "15728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64" \ + "ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7" \ + "ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6B" \ + "F12FFA06D98A0864D87602733EC86A64521F2B18177B200C" \ + "BBE117577A615D6C770988C0BAD946E208E24FA074E5AB31" \ + "43DB5BFCE0FD108E4B82D120A92108011A723C12A787E6D7" \ + "88719A10BDBA5B2699C327186AF4E23C1A946834B6150BDA" \ + "2583E9CA2AD44CE8DBBBC2DB04DE8EF92E8EFC141FBECAA6" \ + "287C59474E6BC05D99B2964FA090C3A2233BA186515BE7ED" \ + "1F612970CEE2D7AFB81BDD762170481CD0069127D5B05AA9" \ + "93B4EA988D8FDDC186FFB7DC90A6C08F4DF435C934028492" \ + "36C3FAB4D27C7026C1D4DCB2602646DEC9751E763DBA37BD" \ + "F8FF9406AD9E530EE5DB382F413001AEB06A53ED9027D831" \ + "179727B0865A8918DA3EDBEBCF9B14ED44CE6CBACED4BB1B" \ + "DB7F1447E6CC254B332051512BD7AF426FB8F401378CD2BF" \ + "5983CA01C64B92ECF032EA15D1721D03F482D7CE6E74FEF6" \ + "D55E702F46980C82B5A84031900B1C9E59E7C97FBEC7E8F3" \ + "23A97A7E36CC88BE0F1D45B7FF585AC54BD407B22B4154AA" \ + "CC8F6D7EBF48E1D814CC5ED20F8037E0A79715EEF29BE328" \ + "06A1D58BB7C5DA76F550AA3D8A1FBFF0EB19CCB1A313D55C" \ + "DA56C9EC2EF29632387FE8D76E3C0468043E8F663F4860EE" \ + "12BF2D5B0B7474D6E694F91E6DCC4024FFFFFFFFFFFFFFFF" + +/* 2^8192 - 2^8128 - 1 + 2^64 * { [2^8062 pi] + 4743158 } */ +#define P8192 \ + "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1" \ + "29024E088A67CC74020BBEA63B139B22514A08798E3404DD" \ + "EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245" \ + "E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED" \ + "EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3D" \ + "C2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F" \ + "83655D23DCA3AD961C62F356208552BB9ED529077096966D" \ + "670C354E4ABC9804F1746C08CA18217C32905E462E36CE3B" \ + "E39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9" \ + "DE2BCBF6955817183995497CEA956AE515D2261898FA0510" \ + "15728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64" \ + "ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7" \ + "ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6B" \ + "F12FFA06D98A0864D87602733EC86A64521F2B18177B200C" \ + "BBE117577A615D6C770988C0BAD946E208E24FA074E5AB31" \ + "43DB5BFCE0FD108E4B82D120A92108011A723C12A787E6D7" \ + "88719A10BDBA5B2699C327186AF4E23C1A946834B6150BDA" \ + "2583E9CA2AD44CE8DBBBC2DB04DE8EF92E8EFC141FBECAA6" \ + "287C59474E6BC05D99B2964FA090C3A2233BA186515BE7ED" \ + "1F612970CEE2D7AFB81BDD762170481CD0069127D5B05AA9" \ + "93B4EA988D8FDDC186FFB7DC90A6C08F4DF435C934028492" \ + "36C3FAB4D27C7026C1D4DCB2602646DEC9751E763DBA37BD" \ + "F8FF9406AD9E530EE5DB382F413001AEB06A53ED9027D831" \ + "179727B0865A8918DA3EDBEBCF9B14ED44CE6CBACED4BB1B" \ + "DB7F1447E6CC254B332051512BD7AF426FB8F401378CD2BF" \ + "5983CA01C64B92ECF032EA15D1721D03F482D7CE6E74FEF6" \ + "D55E702F46980C82B5A84031900B1C9E59E7C97FBEC7E8F3" \ + "23A97A7E36CC88BE0F1D45B7FF585AC54BD407B22B4154AA" \ + "CC8F6D7EBF48E1D814CC5ED20F8037E0A79715EEF29BE328" \ + "06A1D58BB7C5DA76F550AA3D8A1FBFF0EB19CCB1A313D55C" \ + "DA56C9EC2EF29632387FE8D76E3C0468043E8F663F4860EE" \ + "12BF2D5B0B7474D6E694F91E6DBE115974A3926F12FEE5E4" \ + "38777CB6A932DF8CD8BEC4D073B931BA3BC832B68D9DD300" \ + "741FA7BF8AFC47ED2576F6936BA424663AAB639C5AE4F568" \ + "3423B4742BF1C978238F16CBE39D652DE3FDB8BEFC848AD9" \ + "22222E04A4037C0713EB57A81A23F0C73473FC646CEA306B" \ + "4BCBC8862F8385DDFA9D4B7FA2C087E879683303ED5BDD3A" \ + "062B3CF5B3A278A66D2A13F83F44F82DDF310EE074AB6A36" \ + "4597E899A0255DC164F31CC50846851DF9AB48195DED7EA1" \ + "B1D510BD7EE74D73FAF36BC31ECFA268359046F4EB879F92" \ + "4009438B481C6CD7889A002ED5EE382BC9190DA6FC026E47" \ + "9558E4475677E9AA9E3050E2765694DFC81F56E880B96E71" \ + "60C980DD98EDD3DFFFFFFFFFFFFFFFFF" + diff --git a/MediaClient/MediaClient/librtmp/handshake.h b/MediaClient/MediaClient/librtmp/handshake.h new file mode 100644 index 0000000..cc933fc --- /dev/null +++ b/MediaClient/MediaClient/librtmp/handshake.h @@ -0,0 +1,1423 @@ +/* + * Copyright (C) 2008-2009 Andrej Stepanchuk + * Copyright (C) 2009-2010 Howard Chu + * Copyright (C) 2010 2a665470ced7adb7156fcef47f8199a6371c117b8a79e399a2771e0b36384090 + * + * This file is part of librtmp. + * + * librtmp is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1, + * or (at your option) any later version. + * + * librtmp is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with librtmp see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * http://www.gnu.org/copyleft/lgpl.html + */ + +/* This file is #included in rtmp.c, it is not meant to be compiled alone */ + +#ifdef USE_POLARSSL +#include +#include +#ifndef SHA256_DIGEST_LENGTH +#define SHA256_DIGEST_LENGTH 32 +#endif +#define HMAC_CTX sha2_context +#define HMAC_setup(ctx, key, len) sha2_hmac_starts(&ctx, (unsigned char *)key, len, 0) +#define HMAC_crunch(ctx, buf, len) sha2_hmac_update(&ctx, buf, len) +#define HMAC_finish(ctx, dig, dlen) dlen = SHA256_DIGEST_LENGTH; sha2_hmac_finish(&ctx, dig) + +typedef arc4_context * RC4_handle; +#define RC4_alloc(h) *h = malloc(sizeof(arc4_context)) +#define RC4_setkey(h,l,k) arc4_setup(h,k,l) +#define RC4_encrypt(h,l,d) arc4_crypt(h,l,(unsigned char *)d,(unsigned char *)d) +#define RC4_encrypt2(h,l,s,d) arc4_crypt(h,l,(unsigned char *)s,(unsigned char *)d) +#define RC4_free(h) free(h) + +#elif defined(USE_GNUTLS) +#include +#include +#ifndef SHA256_DIGEST_LENGTH +#define SHA256_DIGEST_LENGTH 32 +#endif +#undef HMAC_CTX +#define HMAC_CTX struct hmac_sha256_ctx +#define HMAC_setup(ctx, key, len) hmac_sha256_set_key(&ctx, len, key) +#define HMAC_crunch(ctx, buf, len) hmac_sha256_update(&ctx, len, buf) +#define HMAC_finish(ctx, dig, dlen) dlen = SHA256_DIGEST_LENGTH; hmac_sha256_digest(&ctx, SHA256_DIGEST_LENGTH, dig) +#define HMAC_close(ctx) + +typedef struct arcfour_ctx* RC4_handle; +#define RC4_alloc(h) *h = malloc(sizeof(struct arcfour_ctx)) +#define RC4_setkey(h,l,k) arcfour_set_key(h, l, k) +#define RC4_encrypt(h,l,d) arcfour_crypt(h,l,(uint8_t *)d,(uint8_t *)d) +#define RC4_encrypt2(h,l,s,d) arcfour_crypt(h,l,(uint8_t *)d,(uint8_t *)s) +#define RC4_free(h) free(h) + +#else /* USE_OPENSSL */ +#include +#include +#include +#if OPENSSL_VERSION_NUMBER < 0x0090800 || !defined(SHA256_DIGEST_LENGTH) +#error Your OpenSSL is too old, need 0.9.8 or newer with SHA256 +#endif +#define HMAC_setup(ctx, key, len) HMAC_Init_ex(ctx, key, len, EVP_sha256(), 0) +#define HMAC_crunch(ctx, buf, len) HMAC_Update(ctx, buf, len) +#define HMAC_finish(ctx, dig, dlen) HMAC_Final(ctx, dig, &dlen); HMAC_CTX_free(ctx) + +typedef RC4_KEY * RC4_handle; +#define RC4_alloc(h) *h = malloc(sizeof(RC4_KEY)) +#define RC4_setkey(h,l,k) RC4_set_key(h,l,k) +#define RC4_encrypt(h,l,d) RC4(h,l,(uint8_t *)d,(uint8_t *)d) +#define RC4_encrypt2(h,l,s,d) RC4(h,l,(uint8_t *)s,(uint8_t *)d) +#define RC4_free(h) free(h) +#endif + +#define FP10 + +#include "dh.h" + +static const uint8_t GenuineFMSKey[] = { + 0x47, 0x65, 0x6e, 0x75, 0x69, 0x6e, 0x65, 0x20, 0x41, 0x64, 0x6f, 0x62, + 0x65, 0x20, 0x46, 0x6c, + 0x61, 0x73, 0x68, 0x20, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x20, 0x53, 0x65, + 0x72, 0x76, 0x65, 0x72, + 0x20, 0x30, 0x30, 0x31, /* Genuine Adobe Flash Media Server 001 */ + + 0xf0, 0xee, 0xc2, 0x4a, 0x80, 0x68, 0xbe, 0xe8, 0x2e, 0x00, 0xd0, 0xd1, + 0x02, 0x9e, 0x7e, 0x57, 0x6e, 0xec, 0x5d, 0x2d, 0x29, 0x80, 0x6f, 0xab, + 0x93, 0xb8, 0xe6, 0x36, + 0xcf, 0xeb, 0x31, 0xae +}; /* 68 */ + +static const uint8_t GenuineFPKey[] = { + 0x47, 0x65, 0x6E, 0x75, 0x69, 0x6E, 0x65, 0x20, 0x41, 0x64, 0x6F, 0x62, + 0x65, 0x20, 0x46, 0x6C, + 0x61, 0x73, 0x68, 0x20, 0x50, 0x6C, 0x61, 0x79, 0x65, 0x72, 0x20, 0x30, + 0x30, 0x31, /* Genuine Adobe Flash Player 001 */ + 0xF0, 0xEE, + 0xC2, 0x4A, 0x80, 0x68, 0xBE, 0xE8, 0x2E, 0x00, 0xD0, 0xD1, 0x02, 0x9E, + 0x7E, 0x57, 0x6E, 0xEC, + 0x5D, 0x2D, 0x29, 0x80, 0x6F, 0xAB, 0x93, 0xB8, 0xE6, 0x36, 0xCF, 0xEB, + 0x31, 0xAE +}; /* 62 */ + +static void InitRC4Encryption + (uint8_t * secretKey, + uint8_t * pubKeyIn, + uint8_t * pubKeyOut, RC4_handle *rc4keyIn, RC4_handle *rc4keyOut) +{ + uint8_t digest[SHA256_DIGEST_LENGTH]; + unsigned int digestLen = 0; + HMAC_CTX *ctx = HMAC_CTX_new(); + + RC4_alloc(rc4keyIn); + RC4_alloc(rc4keyOut); + + HMAC_setup(ctx, secretKey, 128); + HMAC_crunch(ctx, pubKeyIn, 128); + HMAC_finish(ctx, digest, digestLen); + + RTMP_Log(RTMP_LOGDEBUG, "RC4 Out Key: "); + RTMP_LogHex(RTMP_LOGDEBUG, digest, 16); + + RC4_setkey(*rc4keyOut, 16, digest); + + HMAC_setup(ctx, secretKey, 128); + HMAC_crunch(ctx, pubKeyOut, 128); + HMAC_finish(ctx, digest, digestLen); + + RTMP_Log(RTMP_LOGDEBUG, "RC4 In Key: "); + RTMP_LogHex(RTMP_LOGDEBUG, digest, 16); + + RC4_setkey(*rc4keyIn, 16, digest); +} + +typedef unsigned int (getoff)(uint8_t *buf, unsigned int len); + +static unsigned int +GetDHOffset2(uint8_t *handshake, unsigned int len) +{ + unsigned int offset = 0; + uint8_t *ptr = handshake + 768; + unsigned int res; + + assert(RTMP_SIG_SIZE <= len); + + offset += (*ptr); + ptr++; + offset += (*ptr); + ptr++; + offset += (*ptr); + ptr++; + offset += (*ptr); + + res = (offset % 632) + 8; + + if (res + 128 > 767) + { + RTMP_Log(RTMP_LOGERROR, + "%s: Couldn't calculate correct DH offset (got %d), exiting!", + __FUNCTION__, res); + exit(1); + } + return res; +} + +static unsigned int +GetDigestOffset2(uint8_t *handshake, unsigned int len) +{ + unsigned int offset = 0; + uint8_t *ptr = handshake + 772; + unsigned int res; + + offset += (*ptr); + ptr++; + offset += (*ptr); + ptr++; + offset += (*ptr); + ptr++; + offset += (*ptr); + + res = (offset % 728) + 776; + + if (res + 32 > 1535) + { + RTMP_Log(RTMP_LOGERROR, + "%s: Couldn't calculate correct digest offset (got %d), exiting", + __FUNCTION__, res); + exit(1); + } + return res; +} + +static unsigned int +GetDHOffset1(uint8_t *handshake, unsigned int len) +{ + unsigned int offset = 0; + uint8_t *ptr = handshake + 1532; + unsigned int res; + + assert(RTMP_SIG_SIZE <= len); + + offset += (*ptr); + ptr++; + offset += (*ptr); + ptr++; + offset += (*ptr); + ptr++; + offset += (*ptr); + + res = (offset % 632) + 772; + + if (res + 128 > 1531) + { + RTMP_Log(RTMP_LOGERROR, "%s: Couldn't calculate DH offset (got %d), exiting!", + __FUNCTION__, res); + exit(1); + } + + return res; +} + +static unsigned int +GetDigestOffset1(uint8_t *handshake, unsigned int len) +{ + unsigned int offset = 0; + uint8_t *ptr = handshake + 8; + unsigned int res; + + assert(12 <= len); + + offset += (*ptr); + ptr++; + offset += (*ptr); + ptr++; + offset += (*ptr); + ptr++; + offset += (*ptr); + + res = (offset % 728) + 12; + + if (res + 32 > 771) + { + RTMP_Log(RTMP_LOGERROR, + "%s: Couldn't calculate digest offset (got %d), exiting!", + __FUNCTION__, res); + exit(1); + } + + return res; +} + +static getoff *digoff[] = {GetDigestOffset1, GetDigestOffset2}; +static getoff *dhoff[] = {GetDHOffset1, GetDHOffset2}; + +static void +HMACsha256(const uint8_t *message, size_t messageLen, const uint8_t *key, + size_t keylen, uint8_t *digest) +{ + unsigned int digestLen; + HMAC_CTX *ctx = HMAC_CTX_new(); + + HMAC_setup(ctx, key, keylen); + HMAC_crunch(ctx, message, messageLen); + HMAC_finish(ctx, digest, digestLen); + + assert(digestLen == 32); +} + +static void +CalculateDigest(unsigned int digestPos, uint8_t *handshakeMessage, + const uint8_t *key, size_t keyLen, uint8_t *digest) +{ + const int messageLen = RTMP_SIG_SIZE - SHA256_DIGEST_LENGTH; + uint8_t message[RTMP_SIG_SIZE - SHA256_DIGEST_LENGTH]; + + memcpy(message, handshakeMessage, digestPos); + memcpy(message + digestPos, + &handshakeMessage[digestPos + SHA256_DIGEST_LENGTH], + messageLen - digestPos); + + HMACsha256(message, messageLen, key, keyLen, digest); +} + +static int +VerifyDigest(unsigned int digestPos, uint8_t *handshakeMessage, const uint8_t *key, + size_t keyLen) +{ + uint8_t calcDigest[SHA256_DIGEST_LENGTH]; + + CalculateDigest(digestPos, handshakeMessage, key, keyLen, calcDigest); + + return memcmp(&handshakeMessage[digestPos], calcDigest, + SHA256_DIGEST_LENGTH) == 0; +} + +/* handshake + * + * Type = [1 bytes] plain: 0x03, encrypted: 0x06, 0x08, 0x09 + * -------------------------------------------------------------------- [1536 bytes] + * Uptime = [4 bytes] big endian unsigned number, uptime + * Version = [4 bytes] each byte represents a version number, e.g. 9.0.124.0 + * ... + * + */ + +static const uint32_t rtmpe8_keys[16][4] = { + {0xbff034b2, 0x11d9081f, 0xccdfb795, 0x748de732}, + {0x086a5eb6, 0x1743090e, 0x6ef05ab8, 0xfe5a39e2}, + {0x7b10956f, 0x76ce0521, 0x2388a73a, 0x440149a1}, + {0xa943f317, 0xebf11bb2, 0xa691a5ee, 0x17f36339}, + {0x7a30e00a, 0xb529e22c, 0xa087aea5, 0xc0cb79ac}, + {0xbdce0c23, 0x2febdeff, 0x1cfaae16, 0x1123239d}, + {0x55dd3f7b, 0x77e7e62e, 0x9bb8c499, 0xc9481ee4}, + {0x407bb6b4, 0x71e89136, 0xa7aebf55, 0xca33b839}, + {0xfcf6bdc3, 0xb63c3697, 0x7ce4f825, 0x04d959b2}, + {0x28e091fd, 0x41954c4c, 0x7fb7db00, 0xe3a066f8}, + {0x57845b76, 0x4f251b03, 0x46d45bcd, 0xa2c30d29}, + {0x0acceef8, 0xda55b546, 0x03473452, 0x5863713b}, + {0xb82075dc, 0xa75f1fee, 0xd84268e8, 0xa72a44cc}, + {0x07cf6e9e, 0xa16d7b25, 0x9fa7ae6c, 0xd92f5629}, + {0xfeb1eae4, 0x8c8c3ce1, 0x4e0064a7, 0x6a387c2a}, + {0x893a9427, 0xcc3013a2, 0xf106385b, 0xa829f927} +}; + +/* RTMPE type 8 uses XTEA on the regular signature + * http://en.wikipedia.org/wiki/XTEA + */ +static void rtmpe8_sig(uint8_t *in, uint8_t *out, int keyid) +{ + unsigned int i, num_rounds = 32; + uint32_t v0, v1, sum=0, delta=0x9E3779B9; + uint32_t const *k; + + v0 = in[0] | (in[1] << 8) | (in[2] << 16) | (in[3] << 24); + v1 = in[4] | (in[5] << 8) | (in[6] << 16) | (in[7] << 24); + k = rtmpe8_keys[keyid]; + + for (i=0; i < num_rounds; i++) { + v0 += (((v1 << 4) ^ (v1 >> 5)) + v1) ^ (sum + k[sum & 3]); + sum += delta; + v1 += (((v0 << 4) ^ (v0 >> 5)) + v0) ^ (sum + k[(sum>>11) & 3]); + } + + out[0] = v0; v0 >>= 8; + out[1] = v0; v0 >>= 8; + out[2] = v0; v0 >>= 8; + out[3] = v0; + + out[4] = v1; v1 >>= 8; + out[5] = v1; v1 >>= 8; + out[6] = v1; v1 >>= 8; + out[7] = v1; +} + +/* RTMPE type 9 uses Blowfish on the regular signature + * http://en.wikipedia.org/wiki/Blowfish_(cipher) + */ +#define BF_ROUNDS 16 +typedef struct bf_key { + uint32_t s[4][256]; + uint32_t p[BF_ROUNDS+2]; +} bf_key; + +static const uint32_t bf_sinit[][256] = { + + /* S-Box 0 */ + { 0xd1310ba6, 0x98dfb5ac, 0x2ffd72db, 0xd01adfb7, 0xb8e1afed, 0x6a267e96, + 0xba7c9045, 0xf12c7f99, 0x24a19947, 0xb3916cf7, 0x0801f2e2, 0x858efc16, + 0x636920d8, 0x71574e69, 0xa458fea3, 0xf4933d7e, 0x0d95748f, 0x728eb658, + 0x718bcd58, 0x82154aee, 0x7b54a41d, 0xc25a59b5, 0x9c30d539, 0x2af26013, + 0xc5d1b023, 0x286085f0, 0xca417918, 0xb8db38ef, 0x8e79dcb0, 0x603a180e, + 0x6c9e0e8b, 0xb01e8a3e, 0xd71577c1, 0xbd314b27, 0x78af2fda, 0x55605c60, + 0xe65525f3, 0xaa55ab94, 0x57489862, 0x63e81440, 0x55ca396a, 0x2aab10b6, + 0xb4cc5c34, 0x1141e8ce, 0xa15486af, 0x7c72e993, 0xb3ee1411, 0x636fbc2a, + 0x2ba9c55d, 0x741831f6, 0xce5c3e16, 0x9b87931e, 0xafd6ba33, 0x6c24cf5c, + 0x7a325381, 0x28958677, 0x3b8f4898, 0x6b4bb9af, 0xc4bfe81b, 0x66282193, + 0x61d809cc, 0xfb21a991, 0x487cac60, 0x5dec8032, 0xef845d5d, 0xe98575b1, + 0xdc262302, 0xeb651b88, 0x23893e81, 0xd396acc5, 0x0f6d6ff3, 0x83f44239, + 0x2e0b4482, 0xa4842004, 0x69c8f04a, 0x9e1f9b5e, 0x21c66842, 0xf6e96c9a, + 0x670c9c61, 0xabd388f0, 0x6a51a0d2, 0xd8542f68, 0x960fa728, 0xab5133a3, + 0x6eef0b6c, 0x137a3be4, 0xba3bf050, 0x7efb2a98, 0xa1f1651d, 0x39af0176, + 0x66ca593e, 0x82430e88, 0x8cee8619, 0x456f9fb4, 0x7d84a5c3, 0x3b8b5ebe, + 0xe06f75d8, 0x85c12073, 0x401a449f, 0x56c16aa6, 0x4ed3aa62, 0x363f7706, + 0x1bfedf72, 0x429b023d, 0x37d0d724, 0xd00a1248, 0xdb0fead3, 0x49f1c09b, + 0x075372c9, 0x80991b7b, 0x25d479d8, 0xf6e8def7, 0xe3fe501a, 0xb6794c3b, + 0x976ce0bd, 0x04c006ba, 0xc1a94fb6, 0x409f60c4, 0x5e5c9ec2, 0x196a2463, + 0x68fb6faf, 0x3e6c53b5, 0x1339b2eb, 0x3b52ec6f, 0x6dfc511f, 0x9b30952c, + 0xcc814544, 0xaf5ebd09, 0xbee3d004, 0xde334afd, 0x660f2807, 0x192e4bb3, + 0xc0cba857, 0x45c8740f, 0xd20b5f39, 0xb9d3fbdb, 0x5579c0bd, 0x1a60320a, + 0xd6a100c6, 0x402c7279, 0x679f25fe, 0xfb1fa3cc, 0x8ea5e9f8, 0xdb3222f8, + 0x3c7516df, 0xfd616b15, 0x2f501ec8, 0xad0552ab, 0x323db5fa, 0xfd238760, + 0x53317b48, 0x3e00df82, 0x9e5c57bb, 0xca6f8ca0, 0x1a87562e, 0xdf1769db, + 0xd542a8f6, 0x287effc3, 0xac6732c6, 0x8c4f5573, 0x695b27b0, 0xbbca58c8, + 0xe1ffa35d, 0xb8f011a0, 0x10fa3d98, 0xfd2183b8, 0x4afcb56c, 0x2dd1d35b, + 0x9a53e479, 0xb6f84565, 0xd28e49bc, 0x4bfb9790, 0xe1ddf2da, 0xa4cb7e33, + 0x62fb1341, 0xcee4c6e8, 0xef20cada, 0x36774c01, 0xd07e9efe, 0x2bf11fb4, + 0x95dbda4d, 0xae909198, 0xeaad8e71, 0x6b93d5a0, 0xd08ed1d0, 0xafc725e0, + 0x8e3c5b2f, 0x8e7594b7, 0x8ff6e2fb, 0xf2122b64, 0x8888b812, 0x900df01c, + 0x4fad5ea0, 0x688fc31c, 0xd1cff191, 0xb3a8c1ad, 0x2f2f2218, 0xbe0e1777, + 0xea752dfe, 0x8b021fa1, 0xe5a0cc0f, 0xb56f74e8, 0x18acf3d6, 0xce89e299, + 0xb4a84fe0, 0xfd13e0b7, 0x7cc43b81, 0xd2ada8d9, 0x165fa266, 0x80957705, + 0x93cc7314, 0x211a1477, 0xe6ad2065, 0x77b5fa86, 0xc75442f5, 0xfb9d35cf, + 0xebcdaf0c, 0x7b3e89a0, 0xd6411bd3, 0xae1e7e49, 0x00250e2d, 0x2071b35e, + 0x226800bb, 0x57b8e0af, 0x2464369b, 0xf009b91e, 0x5563911d, 0x59dfa6aa, + 0x78c14389, 0xd95a537f, 0x207d5ba2, 0x02e5b9c5, 0x83260376, 0x6295cfa9, + 0x11c81968, 0x4e734a41, 0xb3472dca, 0x7b14a94a, 0x1b510052, 0x9a532915, + 0xd60f573f, 0xbc9bc6e4, 0x2b60a476, 0x81e67400, 0x08ba6fb5, 0x571be91f, + 0xf296ec6b, 0x2a0dd915, 0xb6636521, 0xe7b9f9b6, 0xff34052e, 0xc5855664, + 0x53b02d5d, 0xa99f8fa1, 0x08ba4799, 0x6e85076a, }, + + /* S-Box 1 */ + { 0x4b7a70e9, 0xb5b32944, 0xdb75092e, 0xc4192623, 0xad6ea6b0, 0x49a7df7d, + 0x9cee60b8, 0x8fedb266, 0xecaa8c71, 0x699a17ff, 0x5664526c, 0xc2b19ee1, + 0x193602a5, 0x75094c29, 0xa0591340, 0xe4183a3e, 0x3f54989a, 0x5b429d65, + 0x6b8fe4d6, 0x99f73fd6, 0xa1d29c07, 0xefe830f5, 0x4d2d38e6, 0xf0255dc1, + 0x4cdd2086, 0x8470eb26, 0x6382e9c6, 0x021ecc5e, 0x09686b3f, 0x3ebaefc9, + 0x3c971814, 0x6b6a70a1, 0x687f3584, 0x52a0e286, 0xb79c5305, 0xaa500737, + 0x3e07841c, 0x7fdeae5c, 0x8e7d44ec, 0x5716f2b8, 0xb03ada37, 0xf0500c0d, + 0xf01c1f04, 0x0200b3ff, 0xae0cf51a, 0x3cb574b2, 0x25837a58, 0xdc0921bd, + 0xd19113f9, 0x7ca92ff6, 0x94324773, 0x22f54701, 0x3ae5e581, 0x37c2dadc, + 0xc8b57634, 0x9af3dda7, 0xa9446146, 0x0fd0030e, 0xecc8c73e, 0xa4751e41, + 0xe238cd99, 0x3bea0e2f, 0x3280bba1, 0x183eb331, 0x4e548b38, 0x4f6db908, + 0x6f420d03, 0xf60a04bf, 0x2cb81290, 0x24977c79, 0x5679b072, 0xbcaf89af, + 0xde9a771f, 0xd9930810, 0xb38bae12, 0xdccf3f2e, 0x5512721f, 0x2e6b7124, + 0x501adde6, 0x9f84cd87, 0x7a584718, 0x7408da17, 0xbc9f9abc, 0xe94b7d8c, + 0xec7aec3a, 0xdb851dfa, 0x63094366, 0xc464c3d2, 0xef1c1847, 0x3215d908, + 0xdd433b37, 0x24c2ba16, 0x12a14d43, 0x2a65c451, 0x50940002, 0x133ae4dd, + 0x71dff89e, 0x10314e55, 0x81ac77d6, 0x5f11199b, 0x043556f1, 0xd7a3c76b, + 0x3c11183b, 0x5924a509, 0xf28fe6ed, 0x97f1fbfa, 0x9ebabf2c, 0x1e153c6e, + 0x86e34570, 0xeae96fb1, 0x860e5e0a, 0x5a3e2ab3, 0x771fe71c, 0x4e3d06fa, + 0x2965dcb9, 0x99e71d0f, 0x803e89d6, 0x5266c825, 0x2e4cc978, 0x9c10b36a, + 0xc6150eba, 0x94e2ea78, 0xa5fc3c53, 0x1e0a2df4, 0xf2f74ea7, 0x361d2b3d, + 0x1939260f, 0x19c27960, 0x5223a708, 0xf71312b6, 0xebadfe6e, 0xeac31f66, + 0xe3bc4595, 0xa67bc883, 0xb17f37d1, 0x018cff28, 0xc332ddef, 0xbe6c5aa5, + 0x65582185, 0x68ab9802, 0xeecea50f, 0xdb2f953b, 0x2aef7dad, 0x5b6e2f84, + 0x1521b628, 0x29076170, 0xecdd4775, 0x619f1510, 0x13cca830, 0xeb61bd96, + 0x0334fe1e, 0xaa0363cf, 0xb5735c90, 0x4c70a239, 0xd59e9e0b, 0xcbaade14, + 0xeecc86bc, 0x60622ca7, 0x9cab5cab, 0xb2f3846e, 0x648b1eaf, 0x19bdf0ca, + 0xa02369b9, 0x655abb50, 0x40685a32, 0x3c2ab4b3, 0x319ee9d5, 0xc021b8f7, + 0x9b540b19, 0x875fa099, 0x95f7997e, 0x623d7da8, 0xf837889a, 0x97e32d77, + 0x11ed935f, 0x16681281, 0x0e358829, 0xc7e61fd6, 0x96dedfa1, 0x7858ba99, + 0x57f584a5, 0x1b227263, 0x9b83c3ff, 0x1ac24696, 0xcdb30aeb, 0x532e3054, + 0x8fd948e4, 0x6dbc3128, 0x58ebf2ef, 0x34c6ffea, 0xfe28ed61, 0xee7c3c73, + 0x5d4a14d9, 0xe864b7e3, 0x42105d14, 0x203e13e0, 0x45eee2b6, 0xa3aaabea, + 0xdb6c4f15, 0xfacb4fd0, 0xc742f442, 0xef6abbb5, 0x654f3b1d, 0x41cd2105, + 0xd81e799e, 0x86854dc7, 0xe44b476a, 0x3d816250, 0xcf62a1f2, 0x5b8d2646, + 0xfc8883a0, 0xc1c7b6a3, 0x7f1524c3, 0x69cb7492, 0x47848a0b, 0x5692b285, + 0x095bbf00, 0xad19489d, 0x1462b174, 0x23820e00, 0x58428d2a, 0x0c55f5ea, + 0x1dadf43e, 0x233f7061, 0x3372f092, 0x8d937e41, 0xd65fecf1, 0x6c223bdb, + 0x7cde3759, 0xcbee7460, 0x4085f2a7, 0xce77326e, 0xa6078084, 0x19f8509e, + 0xe8efd855, 0x61d99735, 0xa969a7aa, 0xc50c06c2, 0x5a04abfc, 0x800bcadc, + 0x9e447a2e, 0xc3453484, 0xfdd56705, 0x0e1e9ec9, 0xdb73dbd3, 0x105588cd, + 0x675fda79, 0xe3674340, 0xc5c43465, 0x713e38d8, 0x3d28f89e, 0xf16dff20, + 0x153e21e7, 0x8fb03d4a, 0xe6e39f2b, 0xdb83adf7, }, + + /* S-Box 2 */ + { 0xe93d5a68, 0x948140f7, 0xf64c261c, 0x94692934, 0x411520f7, 0x7602d4f7, + 0xbcf46b2e, 0xd4a20068, 0xd4082471, 0x3320f46a, 0x43b7d4b7, 0x500061af, + 0x1e39f62e, 0x97244546, 0x14214f74, 0xbf8b8840, 0x4d95fc1d, 0x96b591af, + 0x70f4ddd3, 0x66a02f45, 0xbfbc09ec, 0x03bd9785, 0x7fac6dd0, 0x31cb8504, + 0x96eb27b3, 0x55fd3941, 0xda2547e6, 0xabca0a9a, 0x28507825, 0x530429f4, + 0x0a2c86da, 0xe9b66dfb, 0x68dc1462, 0xd7486900, 0x680ec0a4, 0x27a18dee, + 0x4f3ffea2, 0xe887ad8c, 0xb58ce006, 0x7af4d6b6, 0xaace1e7c, 0xd3375fec, + 0xce78a399, 0x406b2a42, 0x20fe9e35, 0xd9f385b9, 0xee39d7ab, 0x3b124e8b, + 0x1dc9faf7, 0x4b6d1856, 0x26a36631, 0xeae397b2, 0x3a6efa74, 0xdd5b4332, + 0x6841e7f7, 0xca7820fb, 0xfb0af54e, 0xd8feb397, 0x454056ac, 0xba489527, + 0x55533a3a, 0x20838d87, 0xfe6ba9b7, 0xd096954b, 0x55a867bc, 0xa1159a58, + 0xcca92963, 0x99e1db33, 0xa62a4a56, 0x3f3125f9, 0x5ef47e1c, 0x9029317c, + 0xfdf8e802, 0x04272f70, 0x80bb155c, 0x05282ce3, 0x95c11548, 0xe4c66d22, + 0x48c1133f, 0xc70f86dc, 0x07f9c9ee, 0x41041f0f, 0x404779a4, 0x5d886e17, + 0x325f51eb, 0xd59bc0d1, 0xf2bcc18f, 0x41113564, 0x257b7834, 0x602a9c60, + 0xdff8e8a3, 0x1f636c1b, 0x0e12b4c2, 0x02e1329e, 0xaf664fd1, 0xcad18115, + 0x6b2395e0, 0x333e92e1, 0x3b240b62, 0xeebeb922, 0x85b2a20e, 0xe6ba0d99, + 0xde720c8c, 0x2da2f728, 0xd0127845, 0x95b794fd, 0x647d0862, 0xe7ccf5f0, + 0x5449a36f, 0x877d48fa, 0xc39dfd27, 0xf33e8d1e, 0x0a476341, 0x992eff74, + 0x3a6f6eab, 0xf4f8fd37, 0xa812dc60, 0xa1ebddf8, 0x991be14c, 0xdb6e6b0d, + 0xc67b5510, 0x6d672c37, 0x2765d43b, 0xdcd0e804, 0xf1290dc7, 0xcc00ffa3, + 0xb5390f92, 0x690fed0b, 0x667b9ffb, 0xcedb7d9c, 0xa091cf0b, 0xd9155ea3, + 0xbb132f88, 0x515bad24, 0x7b9479bf, 0x763bd6eb, 0x37392eb3, 0xcc115979, + 0x8026e297, 0xf42e312d, 0x6842ada7, 0xc66a2b3b, 0x12754ccc, 0x782ef11c, + 0x6a124237, 0xb79251e7, 0x06a1bbe6, 0x4bfb6350, 0x1a6b1018, 0x11caedfa, + 0x3d25bdd8, 0xe2e1c3c9, 0x44421659, 0x0a121386, 0xd90cec6e, 0xd5abea2a, + 0x64af674e, 0xda86a85f, 0xbebfe988, 0x64e4c3fe, 0x9dbc8057, 0xf0f7c086, + 0x60787bf8, 0x6003604d, 0xd1fd8346, 0xf6381fb0, 0x7745ae04, 0xd736fccc, + 0x83426b33, 0xf01eab71, 0xb0804187, 0x3c005e5f, 0x77a057be, 0xbde8ae24, + 0x55464299, 0xbf582e61, 0x4e58f48f, 0xf2ddfda2, 0xf474ef38, 0x8789bdc2, + 0x5366f9c3, 0xc8b38e74, 0xb475f255, 0x46fcd9b9, 0x7aeb2661, 0x8b1ddf84, + 0x846a0e79, 0x915f95e2, 0x466e598e, 0x20b45770, 0x8cd55591, 0xc902de4c, + 0xb90bace1, 0xbb8205d0, 0x11a86248, 0x7574a99e, 0xb77f19b6, 0xe0a9dc09, + 0x662d09a1, 0xc4324633, 0xe85a1f02, 0x09f0be8c, 0x4a99a025, 0x1d6efe10, + 0x1ab93d1d, 0x0ba5a4df, 0xa186f20f, 0x2868f169, 0xdcb7da83, 0x573906fe, + 0xa1e2ce9b, 0x4fcd7f52, 0x50115e01, 0xa70683fa, 0xa002b5c4, 0x0de6d027, + 0x9af88c27, 0x773f8641, 0xc3604c06, 0x61a806b5, 0xf0177a28, 0xc0f586e0, + 0x006058aa, 0x30dc7d62, 0x11e69ed7, 0x2338ea63, 0x53c2dd94, 0xc2c21634, + 0xbbcbee56, 0x90bcb6de, 0xebfc7da1, 0xce591d76, 0x6f05e409, 0x4b7c0188, + 0x39720a3d, 0x7c927c24, 0x86e3725f, 0x724d9db9, 0x1ac15bb4, 0xd39eb8fc, + 0xed545578, 0x08fca5b5, 0xd83d7cd3, 0x4dad0fc4, 0x1e50ef5e, 0xb161e6f8, + 0xa28514d9, 0x6c51133c, 0x6fd5c7e7, 0x56e14ec4, 0x362abfce, 0xddc6c837, + 0xd79a3234, 0x92638212, 0x670efa8e, 0x406000e0, }, + + /* S-Box 3 */ + { 0x3a39ce37, 0xd3faf5cf, 0xabc27737, 0x5ac52d1b, 0x5cb0679e, 0x4fa33742, + 0xd3822740, 0x99bc9bbe, 0xd5118e9d, 0xbf0f7315, 0xd62d1c7e, 0xc700c47b, + 0xb78c1b6b, 0x21a19045, 0xb26eb1be, 0x6a366eb4, 0x5748ab2f, 0xbc946e79, + 0xc6a376d2, 0x6549c2c8, 0x530ff8ee, 0x468dde7d, 0xd5730a1d, 0x4cd04dc6, + 0x2939bbdb, 0xa9ba4650, 0xac9526e8, 0xbe5ee304, 0xa1fad5f0, 0x6a2d519a, + 0x63ef8ce2, 0x9a86ee22, 0xc089c2b8, 0x43242ef6, 0xa51e03aa, 0x9cf2d0a4, + 0x83c061ba, 0x9be96a4d, 0x8fe51550, 0xba645bd6, 0x2826a2f9, 0xa73a3ae1, + 0x4ba99586, 0xef5562e9, 0xc72fefd3, 0xf752f7da, 0x3f046f69, 0x77fa0a59, + 0x80e4a915, 0x87b08601, 0x9b09e6ad, 0x3b3ee593, 0xe990fd5a, 0x9e34d797, + 0x2cf0b7d9, 0x022b8b51, 0x96d5ac3a, 0x017da67d, 0xd1cf3ed6, 0x7c7d2d28, + 0x1f9f25cf, 0xadf2b89b, 0x5ad6b472, 0x5a88f54c, 0xe029ac71, 0xe019a5e6, + 0x47b0acfd, 0xed93fa9b, 0xe8d3c48d, 0x283b57cc, 0xf8d56629, 0x79132e28, + 0x785f0191, 0xed756055, 0xf7960e44, 0xe3d35e8c, 0x15056dd4, 0x88f46dba, + 0x03a16125, 0x0564f0bd, 0xc3eb9e15, 0x3c9057a2, 0x97271aec, 0xa93a072a, + 0x1b3f6d9b, 0x1e6321f5, 0xf59c66fb, 0x26dcf319, 0x7533d928, 0xb155fdf5, + 0x03563482, 0x8aba3cbb, 0x28517711, 0xc20ad9f8, 0xabcc5167, 0xccad925f, + 0x4de81751, 0x3830dc8e, 0x379d5862, 0x9320f991, 0xea7a90c2, 0xfb3e7bce, + 0x5121ce64, 0x774fbe32, 0xa8b6e37e, 0xc3293d46, 0x48de5369, 0x6413e680, + 0xa2ae0810, 0xdd6db224, 0x69852dfd, 0x09072166, 0xb39a460a, 0x6445c0dd, + 0x586cdecf, 0x1c20c8ae, 0x5bbef7dd, 0x1b588d40, 0xccd2017f, 0x6bb4e3bb, + 0xdda26a7e, 0x3a59ff45, 0x3e350a44, 0xbcb4cdd5, 0x72eacea8, 0xfa6484bb, + 0x8d6612ae, 0xbf3c6f47, 0xd29be463, 0x542f5d9e, 0xaec2771b, 0xf64e6370, + 0x740e0d8d, 0xe75b1357, 0xf8721671, 0xaf537d5d, 0x4040cb08, 0x4eb4e2cc, + 0x34d2466a, 0x0115af84, 0xe1b00428, 0x95983a1d, 0x06b89fb4, 0xce6ea048, + 0x6f3f3b82, 0x3520ab82, 0x011a1d4b, 0x277227f8, 0x611560b1, 0xe7933fdc, + 0xbb3a792b, 0x344525bd, 0xa08839e1, 0x51ce794b, 0x2f32c9b7, 0xa01fbac9, + 0xe01cc87e, 0xbcc7d1f6, 0xcf0111c3, 0xa1e8aac7, 0x1a908749, 0xd44fbd9a, + 0xd0dadecb, 0xd50ada38, 0x0339c32a, 0xc6913667, 0x8df9317c, 0xe0b12b4f, + 0xf79e59b7, 0x43f5bb3a, 0xf2d519ff, 0x27d9459c, 0xbf97222c, 0x15e6fc2a, + 0x0f91fc71, 0x9b941525, 0xfae59361, 0xceb69ceb, 0xc2a86459, 0x12baa8d1, + 0xb6c1075e, 0xe3056a0c, 0x10d25065, 0xcb03a442, 0xe0ec6e0e, 0x1698db3b, + 0x4c98a0be, 0x3278e964, 0x9f1f9532, 0xe0d392df, 0xd3a0342b, 0x8971f21e, + 0x1b0a7441, 0x4ba3348c, 0xc5be7120, 0xc37632d8, 0xdf359f8d, 0x9b992f2e, + 0xe60b6f47, 0x0fe3f11d, 0xe54cda54, 0x1edad891, 0xce6279cf, 0xcd3e7e6f, + 0x1618b166, 0xfd2c1d05, 0x848fd2c5, 0xf6fb2299, 0xf523f357, 0xa6327623, + 0x93a83531, 0x56cccd02, 0xacf08162, 0x5a75ebb5, 0x6e163697, 0x88d273cc, + 0xde966292, 0x81b949d0, 0x4c50901b, 0x71c65614, 0xe6c6c7bd, 0x327a140a, + 0x45e1d006, 0xc3f27b9a, 0xc9aa53fd, 0x62a80f00, 0xbb25bfe2, 0x35bdd2f6, + 0x71126905, 0xb2040222, 0xb6cbcf7c, 0xcd769c2b, 0x53113ec0, 0x1640e3d3, + 0x38abbd60, 0x2547adf0, 0xba38209c, 0xf746ce76, 0x77afa1c5, 0x20756060, + 0x85cbfe4e, 0x8ae88dd8, 0x7aaaf9b0, 0x4cf9aa7e, 0x1948c25c, 0x02fb8a8c, + 0x01c36ae4, 0xd6ebe1f9, 0x90d4f869, 0xa65cdea0, 0x3f09252d, 0xc208e69f, + 0xb74e6132, 0xce77e25b, 0x578fdfe3, 0x3ac372e6, }, +}; + +static const uint32_t bf_pinit[] = { + /* P-Box */ + 0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344, 0xa4093822, 0x299f31d0, + 0x082efa98, 0xec4e6c89, 0x452821e6, 0x38d01377, 0xbe5466cf, 0x34e90c6c, + 0xc0ac29b7, 0xc97c50dd, 0x3f84d5b5, 0xb5470917, 0x9216d5d9, 0x8979fb1b, +}; + +#define KEYBYTES 24 + +static const unsigned char rtmpe9_keys[16][KEYBYTES] = { + { 0x79, 0x34, 0x77, 0x4c, 0x67, 0xd1, 0x38, 0x3a, 0xdf, 0xb3, 0x56, 0xbe, + 0x8b, 0x7b, 0xd0, 0x24, 0x38, 0xe0, 0x73, 0x58, 0x41, 0x5d, 0x69, 0x67, }, + { 0x46, 0xf6, 0xb4, 0xcc, 0x01, 0x93, 0xe3, 0xa1, 0x9e, 0x7d, 0x3c, 0x65, + 0x55, 0x86, 0xfd, 0x09, 0x8f, 0xf7, 0xb3, 0xc4, 0x6f, 0x41, 0xca, 0x5c, }, + { 0x1a, 0xe7, 0xe2, 0xf3, 0xf9, 0x14, 0x79, 0x94, 0xc0, 0xd3, 0x97, 0x43, + 0x08, 0x7b, 0xb3, 0x84, 0x43, 0x2f, 0x9d, 0x84, 0x3f, 0x21, 0x01, 0x9b, }, + { 0xd3, 0xe3, 0x54, 0xb0, 0xf7, 0x1d, 0xf6, 0x2b, 0x5a, 0x43, 0x4d, 0x04, + 0x83, 0x64, 0x3e, 0x0d, 0x59, 0x2f, 0x61, 0xcb, 0xb1, 0x6a, 0x59, 0x0d, }, + { 0xc8, 0xc1, 0xe9, 0xb8, 0x16, 0x56, 0x99, 0x21, 0x7b, 0x5b, 0x36, 0xb7, + 0xb5, 0x9b, 0xdf, 0x06, 0x49, 0x2c, 0x97, 0xf5, 0x95, 0x48, 0x85, 0x7e, }, + { 0xeb, 0xe5, 0xe6, 0x2e, 0xa4, 0xba, 0xd4, 0x2c, 0xf2, 0x16, 0xe0, 0x8f, + 0x66, 0x23, 0xa9, 0x43, 0x41, 0xce, 0x38, 0x14, 0x84, 0x95, 0x00, 0x53, }, + { 0x66, 0xdb, 0x90, 0xf0, 0x3b, 0x4f, 0xf5, 0x6f, 0xe4, 0x9c, 0x20, 0x89, + 0x35, 0x5e, 0xd2, 0xb2, 0xc3, 0x9e, 0x9f, 0x7f, 0x63, 0xb2, 0x28, 0x81, }, + { 0xbb, 0x20, 0xac, 0xed, 0x2a, 0x04, 0x6a, 0x19, 0x94, 0x98, 0x9b, 0xc8, + 0xff, 0xcd, 0x93, 0xef, 0xc6, 0x0d, 0x56, 0xa7, 0xeb, 0x13, 0xd9, 0x30, }, + { 0xbc, 0xf2, 0x43, 0x82, 0x09, 0x40, 0x8a, 0x87, 0x25, 0x43, 0x6d, 0xe6, + 0xbb, 0xa4, 0xb9, 0x44, 0x58, 0x3f, 0x21, 0x7c, 0x99, 0xbb, 0x3f, 0x24, }, + { 0xec, 0x1a, 0xaa, 0xcd, 0xce, 0xbd, 0x53, 0x11, 0xd2, 0xfb, 0x83, 0xb6, + 0xc3, 0xba, 0xab, 0x4f, 0x62, 0x79, 0xe8, 0x65, 0xa9, 0x92, 0x28, 0x76, }, + { 0xc6, 0x0c, 0x30, 0x03, 0x91, 0x18, 0x2d, 0x7b, 0x79, 0xda, 0xe1, 0xd5, + 0x64, 0x77, 0x9a, 0x12, 0xc5, 0xb1, 0xd7, 0x91, 0x4f, 0x96, 0x4c, 0xa3, }, + { 0xd7, 0x7c, 0x2a, 0xbf, 0xa6, 0xe7, 0x85, 0x7c, 0x45, 0xad, 0xff, 0x12, + 0x94, 0xd8, 0xde, 0xa4, 0x5c, 0x3d, 0x79, 0xa4, 0x44, 0x02, 0x5d, 0x22, }, + { 0x16, 0x19, 0x0d, 0x81, 0x6a, 0x4c, 0xc7, 0xf8, 0xb8, 0xf9, 0x4e, 0xcd, + 0x2c, 0x9e, 0x90, 0x84, 0xb2, 0x08, 0x25, 0x60, 0xe1, 0x1e, 0xae, 0x18, }, + { 0xe9, 0x7c, 0x58, 0x26, 0x1b, 0x51, 0x9e, 0x49, 0x82, 0x60, 0x61, 0xfc, + 0xa0, 0xa0, 0x1b, 0xcd, 0xf5, 0x05, 0xd6, 0xa6, 0x6d, 0x07, 0x88, 0xa3, }, + { 0x2b, 0x97, 0x11, 0x8b, 0xd9, 0x4e, 0xd9, 0xdf, 0x20, 0xe3, 0x9c, 0x10, + 0xe6, 0xa1, 0x35, 0x21, 0x11, 0xf9, 0x13, 0x0d, 0x0b, 0x24, 0x65, 0xb2, }, + { 0x53, 0x6a, 0x4c, 0x54, 0xac, 0x8b, 0x9b, 0xb8, 0x97, 0x29, 0xfc, 0x60, + 0x2c, 0x5b, 0x3a, 0x85, 0x68, 0xb5, 0xaa, 0x6a, 0x44, 0xcd, 0x3f, 0xa7, }, +}; + +#define BF_ENC(X,S) \ + (((S[0][X>>24] + S[1][X>>16 & 0xff]) ^ S[2][(X>>8) & 0xff]) + S[3][X & 0xff]) + +static void bf_enc(uint32_t *x, bf_key *key) +{ + uint32_t Xl; + uint32_t Xr; + uint32_t temp; + int i; + + Xl = x[0]; + Xr = x[1]; + + for (i = 0; i < BF_ROUNDS; ++i) { + Xl ^= key->p[i]; + Xr ^= BF_ENC(Xl,key->s); + + temp = Xl; + Xl = Xr; + Xr = temp; + } + + Xl ^= key->p[BF_ROUNDS]; + Xr ^= key->p[BF_ROUNDS + 1]; + + x[0] = Xr; + x[1] = Xl; +} + +static void bf_setkey(const unsigned char *kp, int keybytes, bf_key *key) +{ + int i; + int j; + int k; + uint32_t data; + uint32_t d[2]; + + memcpy(key->p, bf_pinit, sizeof(key->p)); + memcpy(key->s, bf_sinit, sizeof(key->s)); + + j = 0; + for (i = 0; i < BF_ROUNDS + 2; ++i) { + data = 0x00000000; + for (k = 0; k < 4; ++k) { + data = (data << 8) | kp[j]; + j = j + 1; + if (j >= keybytes) { + j = 0; + } + } + key->p[i] ^= data; + } + + d[0] = 0x00000000; + d[1] = 0x00000000; + + for (i = 0; i < BF_ROUNDS + 2; i += 2) { + bf_enc(d, key); + + key->p[i] = d[0]; + key->p[i + 1] = d[1]; + } + + for (i = 0; i < 4; ++i) { + for (j = 0; j < 256; j += 2) { + + bf_enc(d, key); + + key->s[i][j] = d[0]; + key->s[i][j + 1] = d[1]; + } + } +} + +static void rtmpe9_sig(uint8_t *in, uint8_t *out, int keyid) +{ + uint32_t d[2]; + bf_key key; + + bf_setkey(rtmpe9_keys[keyid], KEYBYTES, &key); + + /* input is little-endian */ + d[0] = in[0] | (in[1] << 8) | (in[2] << 16) | (in[3] << 24); + d[1] = in[4] | (in[5] << 8) | (in[6] << 16) | (in[7] << 24); + bf_enc(d, &key); + out[0] = d[0] & 0xff; + out[1] = (d[0] >> 8) & 0xff; + out[2] = (d[0] >> 16) & 0xff; + out[3] = (d[0] >> 24) & 0xff; + out[4] = d[1] & 0xff; + out[5] = (d[1] >> 8) & 0xff; + out[6] = (d[1] >> 16) & 0xff; + out[7] = (d[1] >> 24) & 0xff; +} + +static int +HandShake(RTMP * r, int FP9HandShake) +{ + int i, offalg = 0; + int dhposClient = 0; + int digestPosClient = 0; + int encrypted = r->Link.protocol & RTMP_FEATURE_ENC; + + RC4_handle keyIn = 0; + RC4_handle keyOut = 0; + +#ifndef _DEBUG + int32_t *ip; +#endif + uint32_t uptime; + + uint8_t clientbuf[RTMP_SIG_SIZE + 4], *clientsig=clientbuf+4; + uint8_t serversig[RTMP_SIG_SIZE], client2[RTMP_SIG_SIZE], *reply; + uint8_t type; + getoff *getdh = NULL, *getdig = NULL; + + if (encrypted || r->Link.SWFSize) + FP9HandShake = TRUE; + else + FP9HandShake = FALSE; + + r->Link.rc4keyIn = r->Link.rc4keyOut = 0; + + if (encrypted) + { + clientsig[-1] = 0x06; /* 0x08 is RTMPE as well */ + offalg = 1; + } + else + clientsig[-1] = 0x03; + + uptime = htonl(RTMP_GetTime()); + memcpy(clientsig, &uptime, 4); + + if (FP9HandShake) + { + /* set version to at least 9.0.115.0 */ + if (encrypted) + { + clientsig[4] = 128; + clientsig[6] = 3; + } + else + { + clientsig[4] = 10; + clientsig[6] = 45; + } + clientsig[5] = 0; + clientsig[7] = 2; + + RTMP_Log(RTMP_LOGDEBUG, "%s: Client type: %02X", __FUNCTION__, clientsig[-1]); + getdig = digoff[offalg]; + getdh = dhoff[offalg]; + } + else + { + memset(&clientsig[4], 0, 4); + } + + /* generate random data */ +#ifdef _DEBUG + memset(clientsig+8, 0, RTMP_SIG_SIZE-8); +#else + ip = (int32_t *)(clientsig+8); + for (i = 2; i < RTMP_SIG_SIZE/4; i++) + *ip++ = rand(); +#endif + + /* set handshake digest */ + if (FP9HandShake) + { + if (encrypted) + { + /* generate Diffie-Hellmann parameters */ + r->Link.dh = DHInit(1024); + if (!r->Link.dh) + { + RTMP_Log(RTMP_LOGERROR, "%s: Couldn't initialize Diffie-Hellmann!", + __FUNCTION__); + return FALSE; + } + + dhposClient = getdh(clientsig, RTMP_SIG_SIZE); + RTMP_Log(RTMP_LOGDEBUG, "%s: DH pubkey position: %d", __FUNCTION__, dhposClient); + + if (!DHGenerateKey(r->Link.dh)) + { + RTMP_Log(RTMP_LOGERROR, "%s: Couldn't generate Diffie-Hellmann public key!", + __FUNCTION__); + return FALSE; + } + + if (!DHGetPublicKey(r->Link.dh, &clientsig[dhposClient], 128)) + { + RTMP_Log(RTMP_LOGERROR, "%s: Couldn't write public key!", __FUNCTION__); + return FALSE; + } + } + + digestPosClient = getdig(clientsig, RTMP_SIG_SIZE); /* reuse this value in verification */ + RTMP_Log(RTMP_LOGDEBUG, "%s: Client digest offset: %d", __FUNCTION__, + digestPosClient); + + CalculateDigest(digestPosClient, clientsig, GenuineFPKey, 30, + &clientsig[digestPosClient]); + + RTMP_Log(RTMP_LOGDEBUG, "%s: Initial client digest: ", __FUNCTION__); + RTMP_LogHex(RTMP_LOGDEBUG, clientsig + digestPosClient, + SHA256_DIGEST_LENGTH); + } + +#ifdef _DEBUG + RTMP_Log(RTMP_LOGDEBUG, "Clientsig: "); + RTMP_LogHex(RTMP_LOGDEBUG, clientsig, RTMP_SIG_SIZE); +#endif + + if (!WriteN(r, (char *)clientsig-1, RTMP_SIG_SIZE + 1)) + return FALSE; + + if (ReadN(r, (char *)&type, 1) != 1) /* 0x03 or 0x06 */ + return FALSE; + + RTMP_Log(RTMP_LOGDEBUG, "%s: Type Answer : %02X", __FUNCTION__, type); + + if (type != clientsig[-1]) + RTMP_Log(RTMP_LOGWARNING, "%s: Type mismatch: client sent %d, server answered %d", + __FUNCTION__, clientsig[-1], type); + + if (ReadN(r, (char *)serversig, RTMP_SIG_SIZE) != RTMP_SIG_SIZE) + return FALSE; + + /* decode server response */ + memcpy(&uptime, serversig, 4); + uptime = ntohl(uptime); + + RTMP_Log(RTMP_LOGDEBUG, "%s: Server Uptime : %d", __FUNCTION__, uptime); + RTMP_Log(RTMP_LOGDEBUG, "%s: FMS Version : %d.%d.%d.%d", __FUNCTION__, serversig[4], + serversig[5], serversig[6], serversig[7]); + + if (FP9HandShake && type == 3 && !serversig[4]) + FP9HandShake = FALSE; + +#ifdef _DEBUG + RTMP_Log(RTMP_LOGDEBUG, "Server signature:"); + RTMP_LogHex(RTMP_LOGDEBUG, serversig, RTMP_SIG_SIZE); +#endif + + if (FP9HandShake) + { + uint8_t digestResp[SHA256_DIGEST_LENGTH]; + uint8_t *signatureResp = NULL; + + /* we have to use this signature now to find the correct algorithms for getting the digest and DH positions */ + int digestPosServer = getdig(serversig, RTMP_SIG_SIZE); + + if (!VerifyDigest(digestPosServer, serversig, GenuineFMSKey, 36)) + { + RTMP_Log(RTMP_LOGWARNING, "Trying different position for server digest!"); + offalg ^= 1; + getdig = digoff[offalg]; + getdh = dhoff[offalg]; + digestPosServer = getdig(serversig, RTMP_SIG_SIZE); + + if (!VerifyDigest(digestPosServer, serversig, GenuineFMSKey, 36)) + { + RTMP_Log(RTMP_LOGERROR, "Couldn't verify the server digest"); /* continuing anyway will probably fail */ + return FALSE; + } + } + + /* generate SWFVerification token (SHA256 HMAC hash of decompressed SWF, key are the last 32 bytes of the server handshake) */ + if (r->Link.SWFSize) + { + const char swfVerify[] = { 0x01, 0x01 }; + char *vend = r->Link.SWFVerificationResponse+sizeof(r->Link.SWFVerificationResponse); + + memcpy(r->Link.SWFVerificationResponse, swfVerify, 2); + AMF_EncodeInt32(&r->Link.SWFVerificationResponse[2], vend, r->Link.SWFSize); + AMF_EncodeInt32(&r->Link.SWFVerificationResponse[6], vend, r->Link.SWFSize); + HMACsha256(r->Link.SWFHash, SHA256_DIGEST_LENGTH, + &serversig[RTMP_SIG_SIZE - SHA256_DIGEST_LENGTH], + SHA256_DIGEST_LENGTH, + (uint8_t *)&r->Link.SWFVerificationResponse[10]); + } + + /* do Diffie-Hellmann Key exchange for encrypted RTMP */ + if (encrypted) + { + /* compute secret key */ + uint8_t secretKey[128] = { 0 }; + int len, dhposServer; + + dhposServer = getdh(serversig, RTMP_SIG_SIZE); + RTMP_Log(RTMP_LOGDEBUG, "%s: Server DH public key offset: %d", __FUNCTION__, + dhposServer); + len = DHComputeSharedSecretKey(r->Link.dh, &serversig[dhposServer], + 128, secretKey); + if (len < 0) + { + RTMP_Log(RTMP_LOGDEBUG, "%s: Wrong secret key position!", __FUNCTION__); + return FALSE; + } + + RTMP_Log(RTMP_LOGDEBUG, "%s: Secret key: ", __FUNCTION__); + RTMP_LogHex(RTMP_LOGDEBUG, secretKey, 128); + + InitRC4Encryption(secretKey, + (uint8_t *) & serversig[dhposServer], + (uint8_t *) & clientsig[dhposClient], + &keyIn, &keyOut); + } + + + reply = client2; +#ifdef _DEBUG + memset(reply, 0xff, RTMP_SIG_SIZE); +#else + ip = (int32_t *)reply; + for (i = 0; i < RTMP_SIG_SIZE/4; i++) + *ip++ = rand(); +#endif + /* calculate response now */ + signatureResp = reply+RTMP_SIG_SIZE-SHA256_DIGEST_LENGTH; + + HMACsha256(&serversig[digestPosServer], SHA256_DIGEST_LENGTH, + GenuineFPKey, sizeof(GenuineFPKey), digestResp); + HMACsha256(reply, RTMP_SIG_SIZE - SHA256_DIGEST_LENGTH, digestResp, + SHA256_DIGEST_LENGTH, signatureResp); + + /* some info output */ + RTMP_Log(RTMP_LOGDEBUG, + "%s: Calculated digest key from secure key and server digest: ", + __FUNCTION__); + RTMP_LogHex(RTMP_LOGDEBUG, digestResp, SHA256_DIGEST_LENGTH); + +#ifdef FP10 + if (type == 8 ) + { + uint8_t *dptr = digestResp; + uint8_t *sig = signatureResp; + /* encrypt signatureResp */ + for (i=0; iLink.rc4keyIn = keyIn; + r->Link.rc4keyOut = keyOut; + + + /* update the keystreams */ + if (r->Link.rc4keyIn) + { + RC4_encrypt(r->Link.rc4keyIn, RTMP_SIG_SIZE, (uint8_t *) buff); + } + + if (r->Link.rc4keyOut) + { + RC4_encrypt(r->Link.rc4keyOut, RTMP_SIG_SIZE, (uint8_t *) buff); + } + } + } + else + { + if (memcmp(serversig, clientsig, RTMP_SIG_SIZE) != 0) + { + RTMP_Log(RTMP_LOGWARNING, "%s: client signature does not match!", + __FUNCTION__); + } + } + + RTMP_Log(RTMP_LOGDEBUG, "%s: Handshaking finished....", __FUNCTION__); + return TRUE; +} + +static int +SHandShake(RTMP * r) +{ + int i, offalg = 0; + int dhposServer = 0; + int digestPosServer = 0; + RC4_handle keyIn = 0; + RC4_handle keyOut = 0; + int FP9HandShake = FALSE; + int encrypted; +#ifndef _DEBUG + int32_t *ip; +#endif + + uint8_t clientsig[RTMP_SIG_SIZE]; + uint8_t serverbuf[RTMP_SIG_SIZE + 4], *serversig = serverbuf+4; + uint8_t type; + uint32_t uptime; + getoff *getdh = NULL, *getdig = NULL; + + if (ReadN(r, (char *)&type, 1) != 1) /* 0x03 or 0x06 */ + return FALSE; + + if (ReadN(r, (char *)clientsig, RTMP_SIG_SIZE) != RTMP_SIG_SIZE) + return FALSE; + + RTMP_Log(RTMP_LOGDEBUG, "%s: Type Requested : %02X", __FUNCTION__, type); + RTMP_LogHex(RTMP_LOGDEBUG2, clientsig, RTMP_SIG_SIZE); + + if (type == 3) + { + encrypted = FALSE; + } + else if (type == 6 || type == 8) + { + offalg = 1; + encrypted = TRUE; + FP9HandShake = TRUE; + r->Link.protocol |= RTMP_FEATURE_ENC; + /* use FP10 if client is capable */ + if (clientsig[4] == 128) + type = 8; + } + else + { + RTMP_Log(RTMP_LOGERROR, "%s: Unknown version %02x", + __FUNCTION__, type); + return FALSE; + } + + if (!FP9HandShake && clientsig[4]) + FP9HandShake = TRUE; + + serversig[-1] = type; + + r->Link.rc4keyIn = r->Link.rc4keyOut = 0; + + uptime = htonl(RTMP_GetTime()); + memcpy(serversig, &uptime, 4); + + if (FP9HandShake) + { + /* Server version */ + serversig[4] = 3; + serversig[5] = 5; + serversig[6] = 1; + serversig[7] = 1; + + getdig = digoff[offalg]; + getdh = dhoff[offalg]; + } + else + { + memset(&serversig[4], 0, 4); + } + + /* generate random data */ +#ifdef _DEBUG + memset(serversig+8, 0, RTMP_SIG_SIZE-8); +#else + ip = (int32_t *)(serversig+8); + for (i = 2; i < RTMP_SIG_SIZE/4; i++) + *ip++ = rand(); +#endif + + /* set handshake digest */ + if (FP9HandShake) + { + if (encrypted) + { + /* generate Diffie-Hellmann parameters */ + r->Link.dh = DHInit(1024); + if (!r->Link.dh) + { + RTMP_Log(RTMP_LOGERROR, "%s: Couldn't initialize Diffie-Hellmann!", + __FUNCTION__); + return FALSE; + } + + dhposServer = getdh(serversig, RTMP_SIG_SIZE); + RTMP_Log(RTMP_LOGDEBUG, "%s: DH pubkey position: %d", __FUNCTION__, dhposServer); + + if (!DHGenerateKey(r->Link.dh)) + { + RTMP_Log(RTMP_LOGERROR, "%s: Couldn't generate Diffie-Hellmann public key!", + __FUNCTION__); + return FALSE; + } + + if (!DHGetPublicKey + (r->Link.dh, (uint8_t *) &serversig[dhposServer], 128)) + { + RTMP_Log(RTMP_LOGERROR, "%s: Couldn't write public key!", __FUNCTION__); + return FALSE; + } + } + + digestPosServer = getdig(serversig, RTMP_SIG_SIZE); /* reuse this value in verification */ + RTMP_Log(RTMP_LOGDEBUG, "%s: Server digest offset: %d", __FUNCTION__, + digestPosServer); + + CalculateDigest(digestPosServer, serversig, GenuineFMSKey, 36, + &serversig[digestPosServer]); + + RTMP_Log(RTMP_LOGDEBUG, "%s: Initial server digest: ", __FUNCTION__); + RTMP_LogHex(RTMP_LOGDEBUG, serversig + digestPosServer, + SHA256_DIGEST_LENGTH); + } + + RTMP_Log(RTMP_LOGDEBUG2, "Serversig: "); + RTMP_LogHex(RTMP_LOGDEBUG2, serversig, RTMP_SIG_SIZE); + + if (!WriteN(r, (char *)serversig-1, RTMP_SIG_SIZE + 1)) + return FALSE; + + /* decode client response */ + memcpy(&uptime, clientsig, 4); + uptime = ntohl(uptime); + + RTMP_Log(RTMP_LOGDEBUG, "%s: Client Uptime : %d", __FUNCTION__, uptime); + RTMP_Log(RTMP_LOGDEBUG, "%s: Player Version: %d.%d.%d.%d", __FUNCTION__, clientsig[4], + clientsig[5], clientsig[6], clientsig[7]); + + if (FP9HandShake) + { + uint8_t digestResp[SHA256_DIGEST_LENGTH]; + uint8_t *signatureResp = NULL; + + /* we have to use this signature now to find the correct algorithms for getting the digest and DH positions */ + int digestPosClient = getdig(clientsig, RTMP_SIG_SIZE); + + if (!VerifyDigest(digestPosClient, clientsig, GenuineFPKey, 30)) + { + RTMP_Log(RTMP_LOGWARNING, "Trying different position for client digest!"); + offalg ^= 1; + getdig = digoff[offalg]; + getdh = dhoff[offalg]; + + digestPosClient = getdig(clientsig, RTMP_SIG_SIZE); + + if (!VerifyDigest(digestPosClient, clientsig, GenuineFPKey, 30)) + { + RTMP_Log(RTMP_LOGERROR, "Couldn't verify the client digest"); /* continuing anyway will probably fail */ + return FALSE; + } + } + + /* generate SWFVerification token (SHA256 HMAC hash of decompressed SWF, key are the last 32 bytes of the server handshake) */ + if (r->Link.SWFSize) + { + const char swfVerify[] = { 0x01, 0x01 }; + char *vend = r->Link.SWFVerificationResponse+sizeof(r->Link.SWFVerificationResponse); + + memcpy(r->Link.SWFVerificationResponse, swfVerify, 2); + AMF_EncodeInt32(&r->Link.SWFVerificationResponse[2], vend, r->Link.SWFSize); + AMF_EncodeInt32(&r->Link.SWFVerificationResponse[6], vend, r->Link.SWFSize); + HMACsha256(r->Link.SWFHash, SHA256_DIGEST_LENGTH, + &serversig[RTMP_SIG_SIZE - SHA256_DIGEST_LENGTH], + SHA256_DIGEST_LENGTH, + (uint8_t *)&r->Link.SWFVerificationResponse[10]); + } + + /* do Diffie-Hellmann Key exchange for encrypted RTMP */ + if (encrypted) + { + int dhposClient, len; + /* compute secret key */ + uint8_t secretKey[128] = { 0 }; + + dhposClient = getdh(clientsig, RTMP_SIG_SIZE); + RTMP_Log(RTMP_LOGDEBUG, "%s: Client DH public key offset: %d", __FUNCTION__, + dhposClient); + len = + DHComputeSharedSecretKey(r->Link.dh, + (uint8_t *) &clientsig[dhposClient], 128, + secretKey); + if (len < 0) + { + RTMP_Log(RTMP_LOGDEBUG, "%s: Wrong secret key position!", __FUNCTION__); + return FALSE; + } + + RTMP_Log(RTMP_LOGDEBUG, "%s: Secret key: ", __FUNCTION__); + RTMP_LogHex(RTMP_LOGDEBUG, secretKey, 128); + + InitRC4Encryption(secretKey, + (uint8_t *) &clientsig[dhposClient], + (uint8_t *) &serversig[dhposServer], + &keyIn, &keyOut); + } + + + /* calculate response now */ + signatureResp = clientsig+RTMP_SIG_SIZE-SHA256_DIGEST_LENGTH; + + HMACsha256(&clientsig[digestPosClient], SHA256_DIGEST_LENGTH, + GenuineFMSKey, sizeof(GenuineFMSKey), digestResp); + HMACsha256(clientsig, RTMP_SIG_SIZE - SHA256_DIGEST_LENGTH, digestResp, + SHA256_DIGEST_LENGTH, signatureResp); +#ifdef FP10 + if (type == 8 ) + { + uint8_t *dptr = digestResp; + uint8_t *sig = signatureResp; + /* encrypt signatureResp */ + for (i=0; iLink.rc4keyIn = keyIn; + r->Link.rc4keyOut = keyOut; + + /* update the keystreams */ + if (r->Link.rc4keyIn) + { + RC4_encrypt(r->Link.rc4keyIn, RTMP_SIG_SIZE, (uint8_t *) buff); + } + + if (r->Link.rc4keyOut) + { + RC4_encrypt(r->Link.rc4keyOut, RTMP_SIG_SIZE, (uint8_t *) buff); + } + } + } + else + { + if (memcmp(serversig, clientsig, RTMP_SIG_SIZE) != 0) + { + RTMP_Log(RTMP_LOGWARNING, "%s: client signature does not match!", + __FUNCTION__); + } + } + + RTMP_Log(RTMP_LOGDEBUG, "%s: Handshaking finished....", __FUNCTION__); + return TRUE; +} diff --git a/MediaClient/MediaClient/librtmp/hashswf.c b/MediaClient/MediaClient/librtmp/hashswf.c new file mode 100644 index 0000000..110d18e --- /dev/null +++ b/MediaClient/MediaClient/librtmp/hashswf.c @@ -0,0 +1,675 @@ +/* + * Copyright (C) 2009-2010 Howard Chu + * + * This file is part of librtmp. + * + * librtmp is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1, + * or (at your option) any later version. + * + * librtmp is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with librtmp see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * http://www.gnu.org/copyleft/lgpl.html + */ + +#include +#include +#include +#include +#include + +#include "rtmp_sys.h" +#include "log.h" +#include "http.h" + +#ifdef CRYPTO +#ifdef USE_POLARSSL +#include +#ifndef SHA256_DIGEST_LENGTH +#define SHA256_DIGEST_LENGTH 32 +#endif +#define HMAC_CTX sha2_context +#define HMAC_setup(ctx, key, len) sha2_hmac_starts(&ctx, (unsigned char *)key, len, 0) +#define HMAC_crunch(ctx, buf, len) sha2_hmac_update(&ctx, buf, len) +#define HMAC_finish(ctx, dig, dlen) dlen = SHA256_DIGEST_LENGTH; sha2_hmac_finish(&ctx, dig) +#define HMAC_close(ctx) +#elif defined(USE_GNUTLS) +#include +#ifndef SHA256_DIGEST_LENGTH +#define SHA256_DIGEST_LENGTH 32 +#endif +#undef HMAC_CTX +#define HMAC_CTX struct hmac_sha256_ctx +#define HMAC_setup(ctx, key, len) hmac_sha256_set_key(&ctx, len, key) +#define HMAC_crunch(ctx, buf, len) hmac_sha256_update(&ctx, len, buf) +#define HMAC_finish(ctx, dig, dlen) dlen = SHA256_DIGEST_LENGTH; hmac_sha256_digest(&ctx, SHA256_DIGEST_LENGTH, dig) +#define HMAC_close(ctx) +#else /* USE_OPENSSL */ +#include +#include +#include +#include +#define HMAC_setup(ctx, key, len) HMAC_Init_ex(ctx, (unsigned char *)key, len, EVP_sha256(), 0) +#define HMAC_crunch(ctx, buf, len) HMAC_Update(ctx, (unsigned char *)buf, len) +#define HMAC_finish(ctx, dig, dlen) HMAC_Final(ctx, (unsigned char *)dig, &dlen); +#define HMAC_close(ctx) HMAC_CTX_free(ctx) +#endif + +extern void RTMP_TLS_Init(); +extern TLS_CTX RTMP_TLS_ctx; + +#include + +#endif /* CRYPTO */ + +#define DATELEN 64 + +#define AGENT "Mozilla/5.0" + +HTTPResult +HTTP_get(struct HTTP_ctx *http, const char *url, HTTP_read_callback *cb) +{ + char *host, *path; + char *p1, *p2; + char hbuf[256]; + int port = 80; +#ifdef CRYPTO + int ssl = 0; +#endif + int hlen; + long flen = 0; + int rc, i; + int len_known; + HTTPResult ret = HTTPRES_OK; + struct sockaddr_in sa; + RTMPSockBuf sb = {0}; + + http->status = -1; + + memset(&sa, 0, sizeof(struct sockaddr_in)); + sa.sin_family = AF_INET; + + /* we only handle http here */ + if (strncasecmp(url, "http", 4)) + return HTTPRES_BAD_REQUEST; + + if (url[4] == 's') + { +#ifdef CRYPTO + ssl = 1; + port = 443; + if (!RTMP_TLS_ctx) + RTMP_TLS_Init(); +#else + return HTTPRES_BAD_REQUEST; +#endif + } + + p1 = strchr(url + 4, ':'); + if (!p1 || strncmp(p1, "://", 3)) + return HTTPRES_BAD_REQUEST; + + host = p1 + 3; + path = strchr(host, '/'); + hlen = path - host; + strncpy(hbuf, host, hlen); + hbuf[hlen] = '\0'; + host = hbuf; + p1 = strrchr(host, ':'); + if (p1) + { + *p1++ = '\0'; + port = atoi(p1); + } + + sa.sin_addr.s_addr = inet_addr(host); + if (sa.sin_addr.s_addr == INADDR_NONE) + { + struct hostent *hp = gethostbyname(host); + if (!hp || !hp->h_addr) + return HTTPRES_LOST_CONNECTION; + sa.sin_addr = *(struct in_addr *)hp->h_addr; + } + sa.sin_port = htons(port); + sb.sb_socket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); + if (sb.sb_socket == -1) + return HTTPRES_LOST_CONNECTION; + i = + sprintf(sb.sb_buf, + "GET %s HTTP/1.0\r\nUser-Agent: %s\r\nHost: %s\r\nReferer: %.*s\r\n", + path, AGENT, host, (int)(path - url + 1), url); + if (http->date[0]) + i += sprintf(sb.sb_buf + i, "If-Modified-Since: %s\r\n", http->date); + i += sprintf(sb.sb_buf + i, "\r\n"); + + if (connect + (sb.sb_socket, (struct sockaddr *)&sa, sizeof(struct sockaddr)) < 0) + { + ret = HTTPRES_LOST_CONNECTION; + goto leave; + } +#ifdef CRYPTO + if (ssl) + { +#ifdef NO_SSL + RTMP_Log(RTMP_LOGERROR, "%s, No SSL/TLS support", __FUNCTION__); + ret = HTTPRES_BAD_REQUEST; + goto leave; +#else + TLS_client(RTMP_TLS_ctx, sb.sb_ssl); + TLS_setfd(sb.sb_ssl, sb.sb_socket); + if (TLS_connect(sb.sb_ssl) < 0) + { + RTMP_Log(RTMP_LOGERROR, "%s, TLS_Connect failed", __FUNCTION__); + ret = HTTPRES_LOST_CONNECTION; + goto leave; + } +#endif + } +#endif + RTMPSockBuf_Send(&sb, sb.sb_buf, i); + + /* set timeout */ +#define HTTP_TIMEOUT 5 + { + SET_RCVTIMEO(tv, HTTP_TIMEOUT); + if (setsockopt + (sb.sb_socket, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof(tv))) + { + RTMP_Log(RTMP_LOGERROR, "%s, Setting socket timeout to %ds failed!", + __FUNCTION__, HTTP_TIMEOUT); + } + } + + sb.sb_size = 0; + sb.sb_timedout = FALSE; + if (RTMPSockBuf_Fill(&sb) < 1) + { + ret = HTTPRES_LOST_CONNECTION; + goto leave; + } + if (strncmp(sb.sb_buf, "HTTP/1", 6)) + { + ret = HTTPRES_BAD_REQUEST; + goto leave; + } + + p1 = strchr(sb.sb_buf, ' '); + rc = atoi(p1 + 1); + http->status = rc; + + if (rc >= 300) + { + if (rc == 304) + { + ret = HTTPRES_OK_NOT_MODIFIED; + goto leave; + } + else if (rc == 404) + ret = HTTPRES_NOT_FOUND; + else if (rc >= 500) + ret = HTTPRES_SERVER_ERROR; + else if (rc >= 400) + ret = HTTPRES_BAD_REQUEST; + else + ret = HTTPRES_REDIRECTED; + } + + p1 = memchr(sb.sb_buf, '\n', sb.sb_size); + if (!p1) + { + ret = HTTPRES_BAD_REQUEST; + goto leave; + } + sb.sb_start = p1 + 1; + sb.sb_size -= sb.sb_start - sb.sb_buf; + + while ((p2 = memchr(sb.sb_start, '\r', sb.sb_size))) + { + if (*sb.sb_start == '\r') + { + sb.sb_start += 2; + sb.sb_size -= 2; + break; + } + else + if (!strncasecmp + (sb.sb_start, "Content-Length: ", sizeof("Content-Length: ") - 1)) + { + flen = strtol(sb.sb_start + sizeof("Content-Length: ") - 1, NULL, 10); + if (flen < 1 || flen > INT_MAX) + { + ret = HTTPRES_BAD_REQUEST; + goto leave; + } + } + else + if (!strncasecmp + (sb.sb_start, "Last-Modified: ", sizeof("Last-Modified: ") - 1)) + { + *p2 = '\0'; + strncpy(http->date, sb.sb_start + sizeof("Last-Modified: ") - 1, DATELEN-1); + http->date[DATELEN-1] = '\0'; + } + p2 += 2; + sb.sb_size -= p2 - sb.sb_start; + sb.sb_start = p2; + if (sb.sb_size < 1) + { + if (RTMPSockBuf_Fill(&sb) < 1) + { + ret = HTTPRES_LOST_CONNECTION; + goto leave; + } + } + } + + len_known = flen > 0; + while ((!len_known || flen > 0) && + (sb.sb_size > 0 || RTMPSockBuf_Fill(&sb) > 0)) + { + cb(sb.sb_start, 1, sb.sb_size, http->data); + if (len_known) + flen -= sb.sb_size; + http->size += sb.sb_size; + sb.sb_size = 0; + } + + if (flen > 0) + ret = HTTPRES_LOST_CONNECTION; + +leave: + RTMPSockBuf_Close(&sb); + return ret; +} + +#ifdef CRYPTO + +#define CHUNK 16384 + +struct info +{ + z_stream *zs; + HMAC_CTX *ctx; + int first; + int zlib; + int size; +}; + +static size_t +swfcrunch(void *ptr, size_t size, size_t nmemb, void *stream) +{ + struct info *i = stream; + char *p = ptr; + size_t len = size * nmemb; + + if (i->first) + { + i->first = 0; + /* compressed? */ + if (!strncmp(p, "CWS", 3)) + { + *p = 'F'; + i->zlib = 1; + } + HMAC_crunch(i->ctx, (unsigned char *)p, 8); + p += 8; + len -= 8; + i->size = 8; + } + + if (i->zlib) + { + unsigned char out[CHUNK]; + i->zs->next_in = (unsigned char *)p; + i->zs->avail_in = len; + do + { + i->zs->avail_out = CHUNK; + i->zs->next_out = out; + inflate(i->zs, Z_NO_FLUSH); + len = CHUNK - i->zs->avail_out; + i->size += len; + HMAC_crunch(i->ctx, out, len); + } + while (i->zs->avail_out == 0); + } + else + { + i->size += len; + HMAC_crunch(i->ctx, (unsigned char *)p, len); + } + return size * nmemb; +} + +static int tzoff; +static int tzchecked; + +#define JAN02_1980 318340800 + +static const char *monthtab[12] = { "Jan", "Feb", "Mar", + "Apr", "May", "Jun", + "Jul", "Aug", "Sep", + "Oct", "Nov", "Dec" +}; +static const char *days[] = + { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; + +/* Parse an HTTP datestamp into Unix time */ +static time_t +make_unix_time(char *s) +{ + struct tm time; + int i, ysub = 1900, fmt = 0; + char *month; + char *n; + time_t res; + + if (s[3] != ' ') + { + fmt = 1; + if (s[3] != ',') + ysub = 0; + } + for (n = s; *n; ++n) + if (*n == '-' || *n == ':') + *n = ' '; + + time.tm_mon = 0; + n = strchr(s, ' '); + if (fmt) + { + /* Day, DD-MMM-YYYY HH:MM:SS GMT */ + time.tm_mday = strtol(n + 1, &n, 0); + month = n + 1; + n = strchr(month, ' '); + time.tm_year = strtol(n + 1, &n, 0); + time.tm_hour = strtol(n + 1, &n, 0); + time.tm_min = strtol(n + 1, &n, 0); + time.tm_sec = strtol(n + 1, NULL, 0); + } + else + { + /* Unix ctime() format. Does not conform to HTTP spec. */ + /* Day MMM DD HH:MM:SS YYYY */ + month = n + 1; + n = strchr(month, ' '); + while (isspace(*n)) + n++; + time.tm_mday = strtol(n, &n, 0); + time.tm_hour = strtol(n + 1, &n, 0); + time.tm_min = strtol(n + 1, &n, 0); + time.tm_sec = strtol(n + 1, &n, 0); + time.tm_year = strtol(n + 1, NULL, 0); + } + if (time.tm_year > 100) + time.tm_year -= ysub; + + for (i = 0; i < 12; i++) + if (!strncasecmp(month, monthtab[i], 3)) + { + time.tm_mon = i; + break; + } + time.tm_isdst = 0; /* daylight saving is never in effect in GMT */ + + /* this is normally the value of extern int timezone, but some + * braindead C libraries don't provide it. + */ + if (!tzchecked) + { + struct tm *tc; + time_t then = JAN02_1980; + tc = localtime(&then); + tzoff = (12 - tc->tm_hour) * 3600 + tc->tm_min * 60 + tc->tm_sec; + tzchecked = 1; + } + res = mktime(&time); + /* Unfortunately, mktime() assumes the input is in local time, + * not GMT, so we have to correct it here. + */ + if (res != -1) + res += tzoff; + return res; +} + +/* Convert a Unix time to a network time string + * Weekday, DD-MMM-YYYY HH:MM:SS GMT + */ +static void +strtime(time_t * t, char *s) +{ + struct tm *tm; + + tm = gmtime((time_t *) t); + sprintf(s, "%s, %02d %s %d %02d:%02d:%02d GMT", + days[tm->tm_wday], tm->tm_mday, monthtab[tm->tm_mon], + tm->tm_year + 1900, tm->tm_hour, tm->tm_min, tm->tm_sec); +} + +#define HEX2BIN(a) (((a)&0x40)?((a)&0xf)+9:((a)&0xf)) + +int +RTMP_HashSWF(const char *url, unsigned int *size, unsigned char *hash, + int age) +{ + FILE *f = NULL; + char *path, date[DATELEN], cctim[DATELEN]; + long pos = 0; + time_t ctim = -1, cnow; + int i, got = 0, ret = 0; + unsigned int hlen; + struct info in = { 0 }; + struct HTTP_ctx http = { 0 }; + HTTPResult httpres; + z_stream zs = { 0 }; + AVal home, hpre; + + date[0] = '\0'; +#ifdef _WIN32 +#ifdef XBMC4XBOX + hpre.av_val = "Q:"; + hpre.av_len = 2; + home.av_val = "\\UserData"; +#else + hpre.av_val = getenv("HOMEDRIVE"); + hpre.av_len = strlen(hpre.av_val); + home.av_val = getenv("HOMEPATH"); +#endif +#define DIRSEP "\\" + +#else /* !_WIN32 */ + hpre.av_val = ""; + hpre.av_len = 0; + home.av_val = getenv("HOME"); +#define DIRSEP "/" +#endif + if (!home.av_val) + home.av_val = "."; + home.av_len = strlen(home.av_val); + + /* SWF hash info is cached in a fixed-format file. + * url: + * ctim: HTTP datestamp of when we last checked it. + * date: HTTP datestamp of the SWF's last modification. + * size: SWF size in hex + * hash: SWF hash in hex + * + * These fields must be present in this order. All fields + * besides URL are fixed size. + */ + path = malloc(hpre.av_len + home.av_len + sizeof(DIRSEP ".swfinfo")); + sprintf(path, "%s%s" DIRSEP ".swfinfo", hpre.av_val, home.av_val); + + f = fopen(path, "r+"); + while (f) + { + char buf[4096], *file, *p; + + file = strchr(url, '/'); + if (!file) + break; + file += 2; + file = strchr(file, '/'); + if (!file) + break; + file++; + hlen = file - url; + p = strrchr(file, '/'); + if (p) + file = p; + else + file--; + + while (fgets(buf, sizeof(buf), f)) + { + char *r1; + + got = 0; + + if (strncmp(buf, "url: ", 5)) + continue; + if (strncmp(buf + 5, url, hlen)) + continue; + r1 = strrchr(buf, '/'); + i = strlen(r1); + r1[--i] = '\0'; + if (strncmp(r1, file, i)) + continue; + pos = ftell(f); + while (got < 4 && fgets(buf, sizeof(buf), f)) + { + if (!strncmp(buf, "size: ", 6)) + { + *size = strtol(buf + 6, NULL, 16); + got++; + } + else if (!strncmp(buf, "hash: ", 6)) + { + unsigned char *ptr = hash, *in = (unsigned char *)buf + 6; + int l = strlen((char *)in) - 1; + for (i = 0; i < l; i += 2) + *ptr++ = (HEX2BIN(in[i]) << 4) | HEX2BIN(in[i + 1]); + got++; + } + else if (!strncmp(buf, "date: ", 6)) + { + buf[strlen(buf) - 1] = '\0'; + strncpy(date, buf + 6, sizeof(date)-1); + date[DATELEN-1] = '\0'; + got++; + } + else if (!strncmp(buf, "ctim: ", 6)) + { + buf[strlen(buf) - 1] = '\0'; + ctim = make_unix_time(buf + 6); + got++; + } + else if (!strncmp(buf, "url: ", 5)) + break; + } + break; + } + break; + } + + cnow = time(NULL); + /* If we got a cache time, see if it's young enough to use directly */ + if (age && ctim > 0) + { + ctim = cnow - ctim; + ctim /= 3600 * 24; /* seconds to days */ + if (ctim < age) /* ok, it's new enough */ + goto out; + } + + in.first = 1; + HMAC_setup(in.ctx, "Genuine Adobe Flash Player 001", 30); + inflateInit(&zs); + in.zs = &zs; + + http.date = date; + http.data = ∈ + + httpres = HTTP_get(&http, url, swfcrunch); + + inflateEnd(&zs); + + if (httpres != HTTPRES_OK && httpres != HTTPRES_OK_NOT_MODIFIED) + { + ret = -1; + if (httpres == HTTPRES_LOST_CONNECTION) + RTMP_Log(RTMP_LOGERROR, "%s: connection lost while downloading swfurl %s", + __FUNCTION__, url); + else if (httpres == HTTPRES_NOT_FOUND) + RTMP_Log(RTMP_LOGERROR, "%s: swfurl %s not found", __FUNCTION__, url); + else + RTMP_Log(RTMP_LOGERROR, "%s: couldn't contact swfurl %s (HTTP error %d)", + __FUNCTION__, url, http.status); + } + else + { + if (got && pos) + fseek(f, pos, SEEK_SET); + else + { + char *q; + if (!f) + f = fopen(path, "w"); + if (!f) + { + int err = errno; + RTMP_Log(RTMP_LOGERROR, + "%s: couldn't open %s for writing, errno %d (%s)", + __FUNCTION__, path, err, strerror(err)); + ret = -1; + goto out; + } + fseek(f, 0, SEEK_END); + q = strchr(url, '?'); + if (q) + i = q - url; + else + i = strlen(url); + + fprintf(f, "url: %.*s\n", i, url); + } + strtime(&cnow, cctim); + fprintf(f, "ctim: %s\n", cctim); + + if (!in.first) + { + HMAC_finish(in.ctx, hash, hlen); + *size = in.size; + + fprintf(f, "date: %s\n", date); + fprintf(f, "size: %08x\n", in.size); + fprintf(f, "hash: "); + for (i = 0; i < SHA256_DIGEST_LENGTH; i++) + fprintf(f, "%02x", hash[i]); + fprintf(f, "\n"); + } + } + HMAC_close(in.ctx); +out: + free(path); + if (f) + fclose(f); + return ret; +} +#else +int +RTMP_HashSWF(const char *url, unsigned int *size, unsigned char *hash, + int age) +{ + return -1; +} +#endif diff --git a/MediaClient/MediaClient/librtmp/http.h b/MediaClient/MediaClient/librtmp/http.h new file mode 100644 index 0000000..cf3d903 --- /dev/null +++ b/MediaClient/MediaClient/librtmp/http.h @@ -0,0 +1,47 @@ +#ifndef __RTMP_HTTP_H__ +#define __RTMP_HTTP_H__ +/* + * Copyright (C) 2010 Howard Chu + * Copyright (C) 2010 Antti Ajanki + * + * This file is part of librtmp. + * + * librtmp is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1, + * or (at your option) any later version. + * + * librtmp is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with librtmp see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * http://www.gnu.org/copyleft/lgpl.html + */ + +typedef enum { + HTTPRES_OK, /* result OK */ + HTTPRES_OK_NOT_MODIFIED, /* not modified since last request */ + HTTPRES_NOT_FOUND, /* not found */ + HTTPRES_BAD_REQUEST, /* client error */ + HTTPRES_SERVER_ERROR, /* server reported an error */ + HTTPRES_REDIRECTED, /* resource has been moved */ + HTTPRES_LOST_CONNECTION /* connection lost while waiting for data */ +} HTTPResult; + +struct HTTP_ctx { + char *date; + int size; + int status; + void *data; +}; + +typedef size_t (HTTP_read_callback)(void *ptr, size_t size, size_t nmemb, void *stream); + +HTTPResult HTTP_get(struct HTTP_ctx *http, const char *url, HTTP_read_callback *cb); + +#endif diff --git a/MediaClient/MediaClient/librtmp/librtmp.3 b/MediaClient/MediaClient/librtmp/librtmp.3 new file mode 100644 index 0000000..7c424aa --- /dev/null +++ b/MediaClient/MediaClient/librtmp/librtmp.3 @@ -0,0 +1,210 @@ +.TH LIBRTMP 3 "2011-07-20" "RTMPDump v2.4" +.\" Copyright 2011 Howard Chu. +.\" Copying permitted according to the GNU General Public License V2. +.SH NAME +librtmp \- RTMPDump Real-Time Messaging Protocol API +.SH LIBRARY +RTMPDump RTMP (librtmp, -lrtmp) +.SH SYNOPSIS +.B #include +.SH DESCRIPTION +The Real-Time Messaging Protocol (RTMP) is used for streaming +multimedia content across a TCP/IP network. This API provides most client +functions and a few server functions needed to support RTMP, RTMP tunneled +in HTTP (RTMPT), encrypted RTMP (RTMPE), RTMP over SSL/TLS (RTMPS) and +tunneled variants of these encrypted types (RTMPTE, RTMPTS). The basic +RTMP specification has been published by Adobe but this API was +reverse-engineered without use of the Adobe specification. As such, it may +deviate from any published specifications but it usually duplicates the +actual behavior of the original Adobe clients. + +The RTMPDump software package includes a basic client utility program +in +.BR rtmpdump (1), +some sample servers, and a library used to provide programmatic access +to the RTMP protocol. This man page gives an overview of the RTMP +library routines. These routines are found in the -lrtmp library. Many +other routines are also available, but they are not documented yet. + +The basic interaction is as follows. A session handle is created using +.BR RTMP_Alloc () +and initialized using +.BR RTMP_Init (). +All session parameters are provided using +.BR RTMP_SetupURL (). +The network connection is established using +.BR RTMP_Connect (), +and then the RTMP session is established using +.BR RTMP_ConnectStream (). +The stream is read using +.BR RTMP_Read (). +A client can publish a stream by calling +.BR RTMP_EnableWrite () +before the +.BR RTMP_Connect () +call, and then using +.BR RTMP_Write () +after the session is established. +While a stream is playing it may be paused and unpaused using +.BR RTMP_Pause (). +The stream playback position can be moved using +.BR RTMP_Seek (). +When +.BR RTMP_Read () +returns 0 bytes, the stream is complete and may be closed using +.BR RTMP_Close (). +The session handle is freed using +.BR RTMP_Free (). + +All data is transferred using FLV format. The basic session requires +an RTMP URL. The RTMP URL format is of the form +.nf + rtmp[t][e|s]://hostname[:port][/app[/playpath]] +.fi + +Plain rtmp, as well as tunneled and encrypted sessions are supported. + +Additional options may be specified by appending space-separated +key=value pairs to the URL. Special characters in values may need +to be escaped to prevent misinterpretation by the option parser. +The escape encoding uses a backslash followed by two hexadecimal digits +representing the ASCII value of the character. E.g., spaces must +be escaped as \fB\\20\fP and backslashes must be escaped as \fB\\5c\fP. +.SH OPTIONS +.SS "Network Parameters" +These options define how to connect to the media server. +.TP +.BI socks= host:port +Use the specified SOCKS4 proxy. +.SS "Connection Parameters" +These options define the content of the RTMP Connect request packet. +If correct values are not provided, the media server will reject the +connection attempt. +.TP +.BI app= name +Name of application to connect to on the RTMP server. Overrides +the app in the RTMP URL. Sometimes the librtmp URL parser cannot +determine the app name automatically, so it must be given explicitly +using this option. +.TP +.BI tcUrl= url +URL of the target stream. Defaults to rtmp[t][e|s]://host[:port]/app. +.TP +.BI pageUrl= url +URL of the web page in which the media was embedded. By default no +value will be sent. +.TP +.BI swfUrl= url +URL of the SWF player for the media. By default no value will be sent. +.TP +.BI flashVer= version +Version of the Flash plugin used to run the SWF player. The +default is "LNX 10,0,32,18". +.TP +.BI conn= type:data +Append arbitrary AMF data to the Connect message. The type +must be B for Boolean, N for number, S for string, O for object, or Z +for null. For Booleans the data must be either 0 or 1 for FALSE or TRUE, +respectively. Likewise for Objects the data must be 0 or 1 to end or +begin an object, respectively. Data items in subobjects may be named, by +prefixing the type with 'N' and specifying the name before the value, e.g. +NB:myFlag:1. This option may be used multiple times to construct arbitrary +AMF sequences. E.g. +.nf + conn=B:1 conn=S:authMe conn=O:1 conn=NN:code:1.23 conn=NS:flag:ok conn=O:0 +.fi +.SS "Session Parameters" +These options take effect after the Connect request has succeeded. +.TP +.BI playpath= path +Overrides the playpath parsed from the RTMP URL. Sometimes the +rtmpdump URL parser cannot determine the correct playpath +automatically, so it must be given explicitly using this option. +.TP +.BI playlist= 0|1 +If the value is 1 or TRUE, issue a set_playlist command before sending the +play command. The playlist will just contain the current playpath. If the +value is 0 or FALSE, the set_playlist command will not be sent. The +default is FALSE. +.TP +.BI live= 0|1 +Specify that the media is a live stream. No resuming or seeking in +live streams is possible. +.TP +.BI subscribe= path +Name of live stream to subscribe to. Defaults to +.IR playpath . +.TP +.BI start= num +Start at +.I num +seconds into the stream. Not valid for live streams. +.TP +.BI stop= num +Stop at +.I num +seconds into the stream. +.TP +.BI buffer= num +Set buffer time to +.I num +milliseconds. The default is 30000. +.TP +.BI timeout= num +Timeout the session after +.I num +seconds without receiving any data from the server. The default is 120. +.SS "Security Parameters" +These options handle additional authentication requests from the server. +.TP +.BI token= key +Key for SecureToken response, used if the server requires SecureToken +authentication. +.TP +.BI jtv= JSON +JSON token used by legacy Justin.tv servers. Invokes NetStream.Authenticate.UsherToken +.TP +.BI swfVfy= 0|1 +If the value is 1 or TRUE, the SWF player is retrieved from the +specified +.I swfUrl +for performing SWF Verification. The SWF hash and size (used in the +verification step) are computed automatically. Also the SWF information is +cached in a +.I .swfinfo +file in the user's home directory, so that it doesn't need to be retrieved +and recalculated every time. The .swfinfo file records +the SWF URL, the time it was fetched, the modification timestamp of the SWF +file, its size, and its hash. By default, the cached info will be used +for 30 days before re-checking. +.TP +.BI swfAge= days +Specify how many days to use the cached SWF info before re-checking. Use +0 to always check the SWF URL. Note that if the check shows that the +SWF file has the same modification timestamp as before, it will not be +retrieved again. +.SH EXAMPLES +An example character string suitable for use with +.BR RTMP_SetupURL (): +.nf + "rtmp://flashserver:1935/ondemand/thefile swfUrl=http://flashserver/player.swf swfVfy=1" +.fi +.SH ENVIRONMENT +.TP +.B HOME +The value of +.RB $ HOME +is used as the location for the +.I .swfinfo +file. +.SH FILES +.TP +.I $HOME/.swfinfo +Cache of SWF Verification information +.SH "SEE ALSO" +.BR rtmpdump (1), +.BR rtmpgw (8) +.SH AUTHORS +Andrej Stepanchuk, Howard Chu, The Flvstreamer Team +.br + diff --git a/MediaClient/MediaClient/librtmp/librtmp.3.html b/MediaClient/MediaClient/librtmp/librtmp.3.html new file mode 100644 index 0000000..6f59851 --- /dev/null +++ b/MediaClient/MediaClient/librtmp/librtmp.3.html @@ -0,0 +1,312 @@ + + +LIBRTMP(3): + + + + + +
LIBRTMP(3)LIBRTMP(3) +
RTMPDump v2.42011-07-20LIBRTMP(3) +


    + +
+ +

NAME

    +librtmp − RTMPDump Real-Time Messaging Protocol API +
+ +

LIBRARY

    +RTMPDump RTMP (librtmp, -lrtmp) +
+ +

SYNOPSIS

    +#include <librtmp/rtmp.h> +
+ +

DESCRIPTION

    +The Real-Time Messaging Protocol (RTMP) is used for streaming +multimedia content across a TCP/IP network. This API provides most client +functions and a few server functions needed to support RTMP, RTMP tunneled +in HTTP (RTMPT), encrypted RTMP (RTMPE), RTMP over SSL/TLS (RTMPS) and +tunneled variants of these encrypted types (RTMPTE, RTMPTS). The basic +RTMP specification has been published by Adobe but this API was +reverse-engineered without use of the Adobe specification. As such, it may +deviate from any published specifications but it usually duplicates the +actual behavior of the original Adobe clients. +

    +The RTMPDump software package includes a basic client utility program +in +rtmpdump(1), +some sample servers, and a library used to provide programmatic access +to the RTMP protocol. This man page gives an overview of the RTMP +library routines. These routines are found in the -lrtmp library. Many +other routines are also available, but they are not documented yet. +

    +The basic interaction is as follows. A session handle is created using +RTMP_Alloc() +and initialized using +RTMP_Init(). +All session parameters are provided using +RTMP_SetupURL(). +The network connection is established using +RTMP_Connect(), +and then the RTMP session is established using +RTMP_ConnectStream(). +The stream is read using +RTMP_Read(). +A client can publish a stream by calling +RTMP_EnableWrite() +before the +RTMP_Connect() +call, and then using +RTMP_Write() +after the session is established. +While a stream is playing it may be paused and unpaused using +RTMP_Pause(). +The stream playback position can be moved using +RTMP_Seek(). +When +RTMP_Read() +returns 0 bytes, the stream is complete and may be closed using +RTMP_Close(). +The session handle is freed using +RTMP_Free(). +

    +All data is transferred using FLV format. The basic session requires +an RTMP URL. The RTMP URL format is of the form +

    +  rtmp[t][e|s]://hostname[:port][/app[/playpath]]
    +
    +

    +Plain rtmp, as well as tunneled and encrypted sessions are supported. +

    +Additional options may be specified by appending space-separated +key=value pairs to the URL. Special characters in values may need +to be escaped to prevent misinterpretation by the option parser. +The escape encoding uses a backslash followed by two hexadecimal digits +representing the ASCII value of the character. E.g., spaces must +be escaped as \20 and backslashes must be escaped as \5c. +

+ +

OPTIONS

    +
+ +

Network Parameters

    +These options define how to connect to the media server. +

    +

    +socks=host:port +
    +Use the specified SOCKS4 proxy. +
    +
+ +

Connection Parameters

    +These options define the content of the RTMP Connect request packet. +If correct values are not provided, the media server will reject the +connection attempt. +

    +

    +app=name +
    +Name of application to connect to on the RTMP server. Overrides +the app in the RTMP URL. Sometimes the librtmp URL parser cannot +determine the app name automatically, so it must be given explicitly +using this option. +
    +

    +

    +tcUrl=url +
    +URL of the target stream. Defaults to rtmp[t][e|s]://host[:port]/app. +
    +

    +

    +pageUrl=url +
    +URL of the web page in which the media was embedded. By default no +value will be sent. +
    +

    +

    +swfUrl=url +
    +URL of the SWF player for the media. By default no value will be sent. +
    +

    +

    +flashVer=version +
    +Version of the Flash plugin used to run the SWF player. The +default is "LNX 10,0,32,18". +
    +

    +

    +conn=type:data +
    +Append arbitrary AMF data to the Connect message. The type +must be B for Boolean, N for number, S for string, O for object, or Z +for null. For Booleans the data must be either 0 or 1 for FALSE or TRUE, +respectively. Likewise for Objects the data must be 0 or 1 to end or +begin an object, respectively. Data items in subobjects may be named, by +prefixing the type with 'N' and specifying the name before the value, e.g. +NB:myFlag:1. This option may be used multiple times to construct arbitrary +AMF sequences. E.g. +
    +  conn=B:1 conn=S:authMe conn=O:1 conn=NN:code:1.23 conn=NS:flag:ok conn=O:0
    +
    +
    +
+ +

Session Parameters

    +These options take effect after the Connect request has succeeded. +

    +

    +playpath=path +
    +Overrides the playpath parsed from the RTMP URL. Sometimes the +rtmpdump URL parser cannot determine the correct playpath +automatically, so it must be given explicitly using this option. +
    +

    +

    +playlist=0|1 +
    +If the value is 1 or TRUE, issue a set_playlist command before sending the +play command. The playlist will just contain the current playpath. If the +value is 0 or FALSE, the set_playlist command will not be sent. The +default is FALSE. +
    +

    +

    +live=0|1 +
    +Specify that the media is a live stream. No resuming or seeking in +live streams is possible. +
    +

    +

    +subscribe=path +
    +Name of live stream to subscribe to. Defaults to +playpath. +
    +

    +

    +start=num +
    +Start at +num +seconds into the stream. Not valid for live streams. +
    +

    +

    +stop=num +
    +Stop at +num +seconds into the stream. +
    +

    +

    +buffer=num +
    +Set buffer time to +num +milliseconds. The default is 30000. +
    +

    +

    +timeout=num +
    +Timeout the session after +num +seconds without receiving any data from the server. The default is 120. +
    +
+ +

Security Parameters

    +These options handle additional authentication requests from the server. +

    +

    +token=key +
    +Key for SecureToken response, used if the server requires SecureToken +authentication. +
    +

    +

    +jtv=JSON +
    +JSON token used by legacy Justin.tv servers. Invokes NetStream.Authenticate.UsherToken +
    +

    +

    +swfVfy=0|1 +
    +If the value is 1 or TRUE, the SWF player is retrieved from the +specified +swfUrl +for performing SWF Verification. The SWF hash and size (used in the +verification step) are computed automatically. Also the SWF information is +cached in a +.swfinfo +file in the user's home directory, so that it doesn't need to be retrieved +and recalculated every time. The .swfinfo file records +the SWF URL, the time it was fetched, the modification timestamp of the SWF +file, its size, and its hash. By default, the cached info will be used +for 30 days before re-checking. +
    +

    +

    +swfAge=days +
    +Specify how many days to use the cached SWF info before re-checking. Use +0 to always check the SWF URL. Note that if the check shows that the +SWF file has the same modification timestamp as before, it will not be +retrieved again. +
    +
+ +

EXAMPLES

    +An example character string suitable for use with +RTMP_SetupURL(): +
    +  "rtmp://flashserver:1935/ondemand/thefile swfUrl=http://flashserver/player.swf swfVfy=1"
    +
    +
+ +

ENVIRONMENT

    +

    +

    +HOME +
    +The value of +$HOME +is used as the location for the +.swfinfo +file. +
    +
+ +

FILES

    +

    +

    +$HOME/.swfinfo +
    +Cache of SWF Verification information +
    +
+ +

SEE ALSO

+ +

AUTHORS

diff --git a/MediaClient/MediaClient/librtmp/librtmp.pc.in b/MediaClient/MediaClient/librtmp/librtmp.pc.in new file mode 100644 index 0000000..551b4d9 --- /dev/null +++ b/MediaClient/MediaClient/librtmp/librtmp.pc.in @@ -0,0 +1,13 @@ +prefix=@prefix@ +exec_prefix=${prefix} +libdir=@libdir@ +incdir=${prefix}/include + +Name: librtmp +Description: RTMP implementation +Version: @VERSION@ +Requires: @CRYPTO_REQ@ +URL: http://rtmpdump.mplayerhq.hu +Libs: -L${libdir} -lrtmp -lz @PUBLIC_LIBS@ +Libs.private: @PRIVATE_LIBS@ +Cflags: -I${incdir} diff --git a/MediaClient/MediaClient/librtmp/log.c b/MediaClient/MediaClient/librtmp/log.c new file mode 100644 index 0000000..1b52000 --- /dev/null +++ b/MediaClient/MediaClient/librtmp/log.c @@ -0,0 +1,224 @@ +/* + * Copyright (C) 2008-2009 Andrej Stepanchuk + * Copyright (C) 2009-2010 Howard Chu + * + * This file is part of librtmp. + * + * librtmp is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1, + * or (at your option) any later version. + * + * librtmp is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with librtmp see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * http://www.gnu.org/copyleft/lgpl.html + */ + +#include +#include +#include +#include +#include + +#include "rtmp_sys.h" +#include "log.h" + +#define MAX_PRINT_LEN 2048 + +RTMP_LogLevel RTMP_debuglevel = RTMP_LOGERROR; + +static int neednl; + +static FILE *fmsg; + +static RTMP_LogCallback rtmp_log_default, *cb = rtmp_log_default; + +static const char *levels[] = { + "CRIT", "ERROR", "WARNING", "INFO", + "DEBUG", "DEBUG2" +}; + +static void rtmp_log_default(int level, const char *format, va_list vl) +{ + char str[MAX_PRINT_LEN]=""; + + vsnprintf(str, MAX_PRINT_LEN-1, format, vl); + + /* Filter out 'no-name' */ + if ( RTMP_debuglevel RTMP_debuglevel ) + return; + + va_start(args, format); + cb(level, format, args); + va_end(args); +} + +static const char hexdig[] = "0123456789abcdef"; + +void RTMP_LogHex(int level, const uint8_t *data, unsigned long len) +{ + unsigned long i; + char line[50], *ptr; + + if ( level > RTMP_debuglevel ) + return; + + ptr = line; + + for(i=0; i> 4)]; + *ptr++ = hexdig[0x0f & data[i]]; + if ((i & 0x0f) == 0x0f) { + *ptr = '\0'; + ptr = line; + RTMP_Log(level, "%s", line); + } else { + *ptr++ = ' '; + } + } + if (i & 0x0f) { + *ptr = '\0'; + RTMP_Log(level, "%s", line); + } +} + +void RTMP_LogHexString(int level, const uint8_t *data, unsigned long len) +{ +#define BP_OFFSET 9 +#define BP_GRAPH 60 +#define BP_LEN 80 + char line[BP_LEN]; + unsigned long i; + + if ( !data || level > RTMP_debuglevel ) + return; + + /* in case len is zero */ + line[0] = '\0'; + + for ( i = 0 ; i < len ; i++ ) { + int n = i % 16; + unsigned off; + + if( !n ) { + if( i ) RTMP_Log( level, "%s", line ); + memset( line, ' ', sizeof(line)-2 ); + line[sizeof(line)-2] = '\0'; + + off = i % 0x0ffffU; + + line[2] = hexdig[0x0f & (off >> 12)]; + line[3] = hexdig[0x0f & (off >> 8)]; + line[4] = hexdig[0x0f & (off >> 4)]; + line[5] = hexdig[0x0f & off]; + line[6] = ':'; + } + + off = BP_OFFSET + n*3 + ((n >= 8)?1:0); + line[off] = hexdig[0x0f & ( data[i] >> 4 )]; + line[off+1] = hexdig[0x0f & data[i]]; + + off = BP_GRAPH + n + ((n >= 8)?1:0); + + if ( isprint( data[i] )) { + line[BP_GRAPH + n] = data[i]; + } else { + line[BP_GRAPH + n] = '.'; + } + } + + RTMP_Log( level, "%s", line ); +} + +/* These should only be used by apps, never by the library itself */ +void RTMP_LogPrintf(const char *format, ...) +{ + char str[MAX_PRINT_LEN]=""; + int len; + va_list args; + va_start(args, format); + len = vsnprintf(str, MAX_PRINT_LEN-1, format, args); + va_end(args); + + if ( RTMP_debuglevel==RTMP_LOGCRIT ) + return; + + if ( !fmsg ) fmsg = stderr; + + if (neednl) { + putc('\n', fmsg); + neednl = 0; + } + + if (len > MAX_PRINT_LEN-1) + len = MAX_PRINT_LEN-1; + fprintf(fmsg, "%s", str); + if (str[len-1] == '\n') + fflush(fmsg); +} + +void RTMP_LogStatus(const char *format, ...) +{ + char str[MAX_PRINT_LEN]=""; + va_list args; + va_start(args, format); + vsnprintf(str, MAX_PRINT_LEN-1, format, args); + va_end(args); + + if ( RTMP_debuglevel==RTMP_LOGCRIT ) + return; + + if ( !fmsg ) fmsg = stderr; + + fprintf(fmsg, "%s", str); + fflush(fmsg); + neednl = 1; +} diff --git a/MediaClient/MediaClient/librtmp/log.h b/MediaClient/MediaClient/librtmp/log.h new file mode 100644 index 0000000..2adb111 --- /dev/null +++ b/MediaClient/MediaClient/librtmp/log.h @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2008-2009 Andrej Stepanchuk + * Copyright (C) 2009-2010 Howard Chu + * + * This file is part of librtmp. + * + * librtmp is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1, + * or (at your option) any later version. + * + * librtmp is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with librtmp see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * http://www.gnu.org/copyleft/lgpl.html + */ + +#ifndef __RTMP_LOG_H__ +#define __RTMP_LOG_H__ + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif +/* Enable this to get full debugging output */ +/* #define _DEBUG */ + +#ifdef _DEBUG +#undef NODEBUG +#endif + +typedef enum +{ RTMP_LOGCRIT=0, RTMP_LOGERROR, RTMP_LOGWARNING, RTMP_LOGINFO, + RTMP_LOGDEBUG, RTMP_LOGDEBUG2, RTMP_LOGALL +} RTMP_LogLevel; + +extern RTMP_LogLevel RTMP_debuglevel; + +typedef void (RTMP_LogCallback)(int level, const char *fmt, va_list); +void RTMP_LogSetCallback(RTMP_LogCallback *cb); +void RTMP_LogSetOutput(FILE *file); +#ifdef __GNUC__ +void RTMP_LogPrintf(const char *format, ...) __attribute__ ((__format__ (__printf__, 1, 2))); +void RTMP_LogStatus(const char *format, ...) __attribute__ ((__format__ (__printf__, 1, 2))); +void RTMP_Log(int level, const char *format, ...) __attribute__ ((__format__ (__printf__, 2, 3))); +#else +void RTMP_LogPrintf(const char *format, ...); +void RTMP_LogStatus(const char *format, ...); +void RTMP_Log(int level, const char *format, ...); +#endif +void RTMP_LogHex(int level, const uint8_t *data, unsigned long len); +void RTMP_LogHexString(int level, const uint8_t *data, unsigned long len); +void RTMP_LogSetLevel(RTMP_LogLevel lvl); +RTMP_LogLevel RTMP_LogGetLevel(void); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/MediaClient/MediaClient/librtmp/parseurl.c b/MediaClient/MediaClient/librtmp/parseurl.c new file mode 100644 index 0000000..402455a --- /dev/null +++ b/MediaClient/MediaClient/librtmp/parseurl.c @@ -0,0 +1,314 @@ +/* + * Copyright (C) 2009 Andrej Stepanchuk + * Copyright (C) 2009-2010 Howard Chu + * + * This file is part of librtmp. + * + * librtmp is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1, + * or (at your option) any later version. + * + * librtmp is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with librtmp see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * http://www.gnu.org/copyleft/lgpl.html + */ + +#include +#include + +#include +#include + +#include "rtmp_sys.h" +#include "log.h" + +int RTMP_ParseURL(const char *url, int *protocol, AVal *host, unsigned int *port, + AVal *playpath, AVal *app, AVal *user, AVal *pass) +{ + char *p, *end, *col, *ques, *slash, *at; + + RTMP_Log(RTMP_LOGDEBUG, "Parsing..."); + + *protocol = RTMP_PROTOCOL_RTMP; + *port = 0; + playpath->av_len = 0; + playpath->av_val = NULL; + app->av_len = 0; + app->av_val = NULL; + + /* Old School Parsing */ + + /* look for usual :// pattern */ + p = strstr(url, "://"); + if(!p) { + RTMP_Log(RTMP_LOGERROR, "RTMP URL: No :// in url!"); + return FALSE; + } + { + int len = (int)(p-url); + + if(len == 4 && strncasecmp(url, "rtmp", 4)==0) + *protocol = RTMP_PROTOCOL_RTMP; + else if(len == 5 && strncasecmp(url, "rtmpt", 5)==0) + *protocol = RTMP_PROTOCOL_RTMPT; + else if(len == 5 && strncasecmp(url, "rtmps", 5)==0) + *protocol = RTMP_PROTOCOL_RTMPS; + else if(len == 5 && strncasecmp(url, "rtmpe", 5)==0) + *protocol = RTMP_PROTOCOL_RTMPE; + else if(len == 5 && strncasecmp(url, "rtmfp", 5)==0) + *protocol = RTMP_PROTOCOL_RTMFP; + else if(len == 6 && strncasecmp(url, "rtmpte", 6)==0) + *protocol = RTMP_PROTOCOL_RTMPTE; + else if(len == 6 && strncasecmp(url, "rtmpts", 6)==0) + *protocol = RTMP_PROTOCOL_RTMPTS; + else { + RTMP_Log(RTMP_LOGWARNING, "Unknown protocol!\n"); + goto parsehost; + } + } + + RTMP_Log(RTMP_LOGDEBUG, "Parsed protocol: %d", *protocol); + +parsehost: + /* let's get the hostname */ + p+=3; + + /* check for sudden death */ + if(*p==0) { + RTMP_Log(RTMP_LOGWARNING, "No hostname in URL!"); + return FALSE; + } + + at = strchr(p, '@'); + if (at) + { + col = strchr(p, ':'); + if (col) + { + int userlen = col - p; + int passlen = at - col - 1; + + if (user) + { + user->av_val = p; + user->av_len = userlen; + } + + if (pass) + { + pass->av_val = col + 1; + pass->av_len = passlen; + } + } + + p = at + 1; + } + + end = p + strlen(p); + col = strchr(p, ':'); + ques = strchr(p, '?'); + slash = strchr(p, '/'); + + { + int hostlen; + if(slash) + hostlen = slash - p; + else + hostlen = end - p; + if(col && col -p < hostlen) + hostlen = col - p; + + if(hostlen < 256) { + host->av_val = p; + host->av_len = hostlen; + RTMP_Log(RTMP_LOGDEBUG, "Parsed host : %.*s", hostlen, host->av_val); + } else { + RTMP_Log(RTMP_LOGWARNING, "Hostname exceeds 255 characters!"); + } + + p+=hostlen; + } + + /* get the port number if available */ + if(*p == ':') { + unsigned int p2; + p++; + p2 = atoi(p); + if(p2 > 65535) { + RTMP_Log(RTMP_LOGWARNING, "Invalid port number!"); + } else { + *port = p2; + } + } + + if(!slash) { + RTMP_Log(RTMP_LOGWARNING, "No application or playpath in URL!"); + return TRUE; + } + p = slash+1; + + { + /* parse application + * + * rtmp://host[:port]/app[/appinstance][/...] + * application = app[/appinstance] + */ + + char *slash2, *slash3 = NULL, *slash4 = NULL; + int applen, appnamelen; + + slash2 = strchr(p, '/'); + if(slash2) + slash3 = strchr(slash2+1, '/'); + if(slash3) + slash4 = strchr(slash3+1, '/'); + + applen = end-p; /* ondemand, pass all parameters as app */ + appnamelen = applen; /* ondemand length */ + + if(ques && strstr(p, "slist=")) { /* whatever it is, the '?' and slist= means we need to use everything as app and parse plapath from slist= */ + appnamelen = ques-p; + } + else if(strncmp(p, "ondemand/", 9)==0) { + /* app = ondemand/foobar, only pass app=ondemand */ + applen = 8; + appnamelen = 8; + } + else { /* app!=ondemand, so app is app[/appinstance] */ + if(slash4) + appnamelen = slash4-p; + else if(slash3) + appnamelen = slash3-p; + else if(slash2) + appnamelen = slash2-p; + + applen = appnamelen; + } + + app->av_val = p; + app->av_len = applen; + RTMP_Log(RTMP_LOGDEBUG, "Parsed app : %.*s", applen, p); + + p += appnamelen; + } + + if (*p == '/') + p++; + + if (end-p) { + AVal av = {p, end-p}; + RTMP_ParsePlaypath(&av, playpath); + } + + return TRUE; +} + +/* + * Extracts playpath from RTMP URL. playpath is the file part of the + * URL, i.e. the part that comes after rtmp://host:port/app/ + * + * Returns the stream name in a format understood by FMS. The name is + * the playpath part of the URL with formatting depending on the stream + * type: + * + * mp4 streams: prepend "mp4:", remove extension + * mp3 streams: prepend "mp3:", remove extension + * flv streams: remove extension + */ +void RTMP_ParsePlaypath(AVal *in, AVal *out) { + int addMP4 = 0; + int addMP3 = 0; + int subExt = 0; + const char *playpath = in->av_val; + const char *temp, *q, *ext = NULL; + const char *ppstart = playpath; + char *streamname, *destptr, *p; + + int pplen = in->av_len; + + out->av_val = NULL; + out->av_len = 0; + + if ((*ppstart == '?') && + (temp=strstr(ppstart, "slist=")) != 0) { + ppstart = temp+6; + pplen = strlen(ppstart); + + temp = strchr(ppstart, '&'); + if (temp) { + pplen = temp-ppstart; + } + } + + q = strchr(ppstart, '?'); + if (pplen >= 4) { + if (q) + ext = q-4; + else + ext = &ppstart[pplen-4]; + if ((strncmp(ext, ".f4v", 4) == 0) || + (strncmp(ext, ".mp4", 4) == 0)) { + addMP4 = 1; + subExt = 1; + /* Only remove .flv from rtmp URL, not slist params */ + } else if ((ppstart == playpath) && + (strncmp(ext, ".flv", 4) == 0)) { + subExt = 1; + } else if (strncmp(ext, ".mp3", 4) == 0) { + addMP3 = 1; + subExt = 1; + } + } + + streamname = (char *)malloc((pplen+4+1)*sizeof(char)); + if (!streamname) + return; + + destptr = streamname; + if (addMP4) { + if (strncmp(ppstart, "mp4:", 4)) { + strcpy(destptr, "mp4:"); + destptr += 4; + } else { + subExt = 0; + } + } else if (addMP3) { + if (strncmp(ppstart, "mp3:", 4)) { + strcpy(destptr, "mp3:"); + destptr += 4; + } else { + subExt = 0; + } + } + + for (p=(char *)ppstart; pplen >0;) { + /* skip extension */ + if (subExt && p == ext) { + p += 4; + pplen -= 4; + continue; + } + if (*p == '%') { + unsigned int c; + sscanf(p+1, "%02x", &c); + *destptr++ = c; + pplen -= 3; + p += 3; + } else { + *destptr++ = *p++; + pplen--; + } + } + *destptr = '\0'; + + out->av_val = streamname; + out->av_len = destptr - streamname; +} diff --git a/MediaClient/MediaClient/librtmp/rtmp.c b/MediaClient/MediaClient/librtmp/rtmp.c new file mode 100644 index 0000000..c652757 --- /dev/null +++ b/MediaClient/MediaClient/librtmp/rtmp.c @@ -0,0 +1,5319 @@ +/* + * Copyright (C) 2005-2008 Team XBMC + * http://www.xbmc.org + * Copyright (C) 2008-2009 Andrej Stepanchuk + * Copyright (C) 2009-2010 Howard Chu + * + * This file is part of librtmp. + * + * librtmp is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1, + * or (at your option) any later version. + * + * librtmp is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with librtmp see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * http://www.gnu.org/copyleft/lgpl.html + */ + +#include +#include +#include +#include +#include +#if !defined(_WIN32) +#include +#endif + +#include "rtmp_sys.h" +#include "log.h" + +#ifdef CRYPTO +#ifdef USE_POLARSSL +#include +#include +#include +#define MD5_DIGEST_LENGTH 16 + +static const char *my_dhm_P = + "E4004C1F94182000103D883A448B3F80" \ + "2CE4B44A83301270002C20D0321CFD00" \ + "11CCEF784C26A400F43DFB901BCA7538" \ + "F2C6B176001CF5A0FD16D2C48B1D0C1C" \ + "F6AC8E1DA6BCC3B4E1F96B0564965300" \ + "FFA1D0B601EB2800F489AA512C4B248C" \ + "01F76949A60BB7F00A40B1EAB64BDD48" \ + "E8A700D60B7F1200FA8E77B0A979DABF"; + +static const char *my_dhm_G = "4"; + +#elif defined(USE_GNUTLS) +#include +#define MD5_DIGEST_LENGTH 16 +#include +#include +#else /* USE_OPENSSL */ +#include +#include +#include +#include +#include +#endif +TLS_CTX RTMP_TLS_ctx; +#endif + +#define RTMP_SIG_SIZE 1536 +#define RTMP_LARGE_HEADER_SIZE 12 + +static const int packetSize[] = { 12, 8, 4, 1 }; + +int RTMP_ctrlC; + +const char RTMPProtocolStrings[][7] = { + "RTMP", + "RTMPT", + "RTMPE", + "RTMPTE", + "RTMPS", + "RTMPTS", + "", + "", + "RTMFP" +}; + +const char RTMPProtocolStringsLower[][7] = { + "rtmp", + "rtmpt", + "rtmpe", + "rtmpte", + "rtmps", + "rtmpts", + "", + "", + "rtmfp" +}; + +static const char *RTMPT_cmds[] = { + "open", + "send", + "idle", + "close" +}; + +typedef enum { + RTMPT_OPEN=0, RTMPT_SEND, RTMPT_IDLE, RTMPT_CLOSE +} RTMPTCmd; + +static int DumpMetaData(AMFObject *obj); +static int HandShake(RTMP *r, int FP9HandShake); +static int SocksNegotiate(RTMP *r); + +static int SendConnectPacket(RTMP *r, RTMPPacket *cp); +static int SendCheckBW(RTMP *r); +static int SendCheckBWResult(RTMP *r, double txn); +static int SendDeleteStream(RTMP *r, double dStreamId); +static int SendFCSubscribe(RTMP *r, AVal *subscribepath); +static int SendPlay(RTMP *r); +static int SendBytesReceived(RTMP *r); +static int SendUsherToken(RTMP *r, AVal *usherToken); + +#if 0 /* unused */ +static int SendBGHasStream(RTMP *r, double dId, AVal *playpath); +#endif + +static int HandleInvoke(RTMP *r, const char *body, unsigned int nBodySize); +static int HandleMetadata(RTMP *r, char *body, unsigned int len); +//static void HandleChangeChunkSize(RTMP *r, const RTMPPacket *packet); +static void HandleAudio(RTMP *r, const RTMPPacket *packet); +static void HandleVideo(RTMP *r, const RTMPPacket *packet); +static void HandleCtrl(RTMP *r, const RTMPPacket *packet); +static void HandleServerBW(RTMP *r, const RTMPPacket *packet); +static void HandleClientBW(RTMP *r, const RTMPPacket *packet); + +static int ReadN(RTMP *r, char *buffer, int n); +static int WriteN(RTMP *r, const char *buffer, int n); + +static void DecodeTEA(AVal *key, AVal *text); + +static int HTTP_Post(RTMP *r, RTMPTCmd cmd, const char *buf, int len); +static int HTTP_read(RTMP *r, int fill); + +static void CloseInternal(RTMP *r, int reconnect); + +#ifndef _WIN32 +static int clk_tck; +#endif + +#ifdef CRYPTO +#include "handshake.h" +#endif + +uint32_t +RTMP_GetTime() +{ +#if defined(_WIN32) + return timeGetTime(); +#else + struct tms t; + if (!clk_tck) clk_tck = sysconf(_SC_CLK_TCK); + return times(&t) * 1000 / clk_tck; +#endif +} + +void +RTMP_UserInterrupt() +{ + RTMP_ctrlC = TRUE; +} + +void +RTMPPacket_Reset(RTMPPacket *p) +{ + p->m_headerType = 0; + p->m_packetType = 0; + p->m_nChannel = 0; + p->m_nTimeStamp = 0; + p->m_nInfoField2 = 0; + p->m_hasAbsTimestamp = FALSE; + p->m_nBodySize = 0; + p->m_nBytesRead = 0; +} + +int +RTMPPacket_Alloc(RTMPPacket *p, uint32_t nSize) +{ + char *ptr; + if (nSize > (uint32_t)(SIZE_MAX - RTMP_MAX_HEADER_SIZE)) + return FALSE; + ptr = calloc(1, nSize + RTMP_MAX_HEADER_SIZE); + if (!ptr) + return FALSE; + p->m_body = ptr + RTMP_MAX_HEADER_SIZE; + p->m_nBytesRead = 0; + return TRUE; +} + +void +RTMPPacket_Free(RTMPPacket *p) +{ + if (p->m_body) + { + free(p->m_body - RTMP_MAX_HEADER_SIZE); + p->m_body = NULL; + } +} + +void +RTMPPacket_Dump(RTMPPacket *p) +{ + RTMP_Log(RTMP_LOGDEBUG, + "RTMP PACKET: packet type: 0x%02x. channel: 0x%02x. info 1: %d info 2: %d. Body size: %u. body: 0x%02x", + p->m_packetType, p->m_nChannel, p->m_nTimeStamp, p->m_nInfoField2, + p->m_nBodySize, p->m_body ? (unsigned char)p->m_body[0] : 0); +} + +int +RTMP_LibVersion() +{ + return RTMP_LIB_VERSION; +} + +void +RTMP_TLS_Init() +{ +#ifdef CRYPTO +#ifdef USE_POLARSSL + /* Do this regardless of NO_SSL, we use havege for rtmpe too */ + RTMP_TLS_ctx = calloc(1,sizeof(struct tls_ctx)); + havege_init(&RTMP_TLS_ctx->hs); +#elif defined(USE_GNUTLS) && !defined(NO_SSL) + /* Technically we need to initialize libgcrypt ourselves if + * we're not going to call gnutls_global_init(). Ignoring this + * for now. + */ + gnutls_global_init(); + RTMP_TLS_ctx = malloc(sizeof(struct tls_ctx)); + gnutls_certificate_allocate_credentials(&RTMP_TLS_ctx->cred); + gnutls_priority_init(&RTMP_TLS_ctx->prios, "NORMAL", NULL); + gnutls_certificate_set_x509_trust_file(RTMP_TLS_ctx->cred, + "ca.pem", GNUTLS_X509_FMT_PEM); +#elif !defined(NO_SSL) /* USE_OPENSSL */ + /* libcrypto doesn't need anything special */ + SSL_load_error_strings(); + SSL_library_init(); + OpenSSL_add_all_digests(); + RTMP_TLS_ctx = SSL_CTX_new(SSLv23_method()); + SSL_CTX_set_options(RTMP_TLS_ctx, SSL_OP_ALL); + SSL_CTX_set_default_verify_paths(RTMP_TLS_ctx); +#endif +#endif +} + +void * +RTMP_TLS_AllocServerContext(const char* cert, const char* key) +{ + void *ctx = NULL; +#ifdef CRYPTO + if (!RTMP_TLS_ctx) + RTMP_TLS_Init(); +#ifdef USE_POLARSSL + tls_server_ctx *tc = ctx = calloc(1, sizeof(struct tls_server_ctx)); + tc->dhm_P = my_dhm_P; + tc->dhm_G = my_dhm_G; + tc->hs = &RTMP_TLS_ctx->hs; + if (x509parse_crtfile(&tc->cert, cert)) { + free(tc); + return NULL; + } + if (x509parse_keyfile(&tc->key, key, NULL)) { + x509_free(&tc->cert); + free(tc); + return NULL; + } +#elif defined(USE_GNUTLS) && !defined(NO_SSL) + gnutls_certificate_allocate_credentials((gnutls_certificate_credentials*) &ctx); + if (gnutls_certificate_set_x509_key_file(ctx, cert, key, GNUTLS_X509_FMT_PEM) != 0) { + gnutls_certificate_free_credentials(ctx); + return NULL; + } +#elif !defined(NO_SSL) /* USE_OPENSSL */ + ctx = SSL_CTX_new(SSLv23_server_method()); + if (!SSL_CTX_use_certificate_chain_file(ctx, cert)) { + SSL_CTX_free(ctx); + return NULL; + } + if (!SSL_CTX_use_PrivateKey_file(ctx, key, SSL_FILETYPE_PEM)) { + SSL_CTX_free(ctx); + return NULL; + } +#endif +#endif + return ctx; +} + +void +RTMP_TLS_FreeServerContext(void *ctx) +{ +#ifdef CRYPTO +#ifdef USE_POLARSSL + x509_free(&((tls_server_ctx*)ctx)->cert); + rsa_free(&((tls_server_ctx*)ctx)->key); + free(ctx); +#elif defined(USE_GNUTLS) && !defined(NO_SSL) + gnutls_certificate_free_credentials(ctx); +#elif !defined(NO_SSL) /* USE_OPENSSL */ + SSL_CTX_free(ctx); +#endif +#endif +} + +RTMP * +RTMP_Alloc() +{ + return calloc(1, sizeof(RTMP)); +} + +void +RTMP_Free(RTMP *r) +{ + free(r); +} + +void +RTMP_Init(RTMP *r) +{ +#ifdef CRYPTO + if (!RTMP_TLS_ctx) + RTMP_TLS_Init(); +#endif + + memset(r, 0, sizeof(RTMP)); + r->m_sb.sb_socket = -1; + r->m_inChunkSize = RTMP_DEFAULT_CHUNKSIZE; + r->m_outChunkSize = RTMP_DEFAULT_CHUNKSIZE; + r->m_nBufferMS = 30000; + r->m_nClientBW = 2500000; + r->m_nClientBW2 = 2; + r->m_nServerBW = 2500000; + r->m_fAudioCodecs = 3191.0; + r->m_fVideoCodecs = 252.0; + r->Link.timeout = 30; + r->Link.swfAge = 30; +} + +void +RTMP_EnableWrite(RTMP *r) +{ + r->Link.protocol |= RTMP_FEATURE_WRITE; +} + +double +RTMP_GetDuration(RTMP *r) +{ + return r->m_fDuration; +} + +int +RTMP_IsConnected(RTMP *r) +{ + return r->m_sb.sb_socket != -1; +} + +int +RTMP_Socket(RTMP *r) +{ + return r->m_sb.sb_socket; +} + +int +RTMP_IsTimedout(RTMP *r) +{ + return r->m_sb.sb_timedout; +} + +void +RTMP_SetBufferMS(RTMP *r, int size) +{ + r->m_nBufferMS = size; +} + +void +RTMP_UpdateBufferMS(RTMP *r) +{ + RTMP_SendCtrl(r, 3, r->m_stream_id, r->m_nBufferMS); +} + +#undef OSS +#ifdef _WIN32 +#define OSS "WIN" +#elif defined(__sun__) +#define OSS "SOL" +#elif defined(__APPLE__) +#define OSS "MAC" +#elif defined(__linux__) +#define OSS "LNX" +#else +#define OSS "GNU" +#endif +#define DEF_VERSTR OSS " 10,0,32,18" +static const char DEFAULT_FLASH_VER[] = DEF_VERSTR; +const AVal RTMP_DefaultFlashVer = + { (char *)DEFAULT_FLASH_VER, sizeof(DEFAULT_FLASH_VER) - 1 }; +static const char FLASH_VER[] = "FMLE/3.0"; +const AVal RTMP_FlashVer = + { (char *)FLASH_VER, sizeof(FLASH_VER) - 1 }; + +static void +SocksSetup(RTMP *r, AVal *sockshost) +{ + if (sockshost->av_len) + { + const char *socksport = strchr(sockshost->av_val, ':'); + char *hostname = strdup(sockshost->av_val); + + if (socksport) + hostname[socksport - sockshost->av_val] = '\0'; + r->Link.sockshost.av_val = hostname; + r->Link.sockshost.av_len = strlen(hostname); + + r->Link.socksport = socksport ? atoi(socksport + 1) : 1080; + RTMP_Log(RTMP_LOGDEBUG, "Connecting via SOCKS proxy: %s:%d", r->Link.sockshost.av_val, + r->Link.socksport); + } + else + { + r->Link.sockshost.av_val = NULL; + r->Link.sockshost.av_len = 0; + r->Link.socksport = 0; + } +} + +void +RTMP_SetupStream(RTMP *r, + int protocol, + AVal *host, + unsigned int port, + AVal *sockshost, + AVal *playpath, + AVal *tcUrl, + AVal *swfUrl, + AVal *pageUrl, + AVal *app, + AVal *auth, + AVal *swfSHA256Hash, + uint32_t swfSize, + AVal *flashVer, + AVal *subscribepath, + AVal *usherToken, + int dStart, + int dStop, int bLiveStream, long int timeout) +{ + RTMP_Log(RTMP_LOGDEBUG, "Protocol : %s", RTMPProtocolStrings[protocol&7]); + RTMP_Log(RTMP_LOGDEBUG, "Hostname : %.*s", host->av_len, host->av_val); + RTMP_Log(RTMP_LOGDEBUG, "Port : %d", port); + RTMP_Log(RTMP_LOGDEBUG, "Playpath : %s", playpath->av_val); + + if (tcUrl && tcUrl->av_val) + RTMP_Log(RTMP_LOGDEBUG, "tcUrl : %s", tcUrl->av_val); + if (swfUrl && swfUrl->av_val) + RTMP_Log(RTMP_LOGDEBUG, "swfUrl : %s", swfUrl->av_val); + if (pageUrl && pageUrl->av_val) + RTMP_Log(RTMP_LOGDEBUG, "pageUrl : %s", pageUrl->av_val); + if (app && app->av_val) + RTMP_Log(RTMP_LOGDEBUG, "app : %.*s", app->av_len, app->av_val); + if (auth && auth->av_val) + RTMP_Log(RTMP_LOGDEBUG, "auth : %s", auth->av_val); + if (subscribepath && subscribepath->av_val) + RTMP_Log(RTMP_LOGDEBUG, "subscribepath : %s", subscribepath->av_val); + if (usherToken && usherToken->av_val) + RTMP_Log(RTMP_LOGDEBUG, "NetStream.Authenticate.UsherToken : %s", usherToken->av_val); + if (flashVer && flashVer->av_val) + RTMP_Log(RTMP_LOGDEBUG, "flashVer : %s", flashVer->av_val); + if (dStart > 0) + RTMP_Log(RTMP_LOGDEBUG, "StartTime : %d msec", dStart); + if (dStop > 0) + RTMP_Log(RTMP_LOGDEBUG, "StopTime : %d msec", dStop); + + RTMP_Log(RTMP_LOGDEBUG, "live : %s", bLiveStream ? "yes" : "no"); + RTMP_Log(RTMP_LOGDEBUG, "timeout : %ld sec", timeout); + +#ifdef CRYPTO + if (swfSHA256Hash != NULL && swfSize > 0) + { + memcpy(r->Link.SWFHash, swfSHA256Hash->av_val, sizeof(r->Link.SWFHash)); + r->Link.SWFSize = swfSize; + RTMP_Log(RTMP_LOGDEBUG, "SWFSHA256:"); + RTMP_LogHex(RTMP_LOGDEBUG, r->Link.SWFHash, sizeof(r->Link.SWFHash)); + RTMP_Log(RTMP_LOGDEBUG, "SWFSize : %u", r->Link.SWFSize); + } + else + { + r->Link.SWFSize = 0; + } +#endif + + SocksSetup(r, sockshost); + + if (tcUrl && tcUrl->av_len) + r->Link.tcUrl = *tcUrl; + if (swfUrl && swfUrl->av_len) + r->Link.swfUrl = *swfUrl; + if (pageUrl && pageUrl->av_len) + r->Link.pageUrl = *pageUrl; + if (app && app->av_len) + r->Link.app = *app; + if (auth && auth->av_len) + { + r->Link.auth = *auth; + r->Link.lFlags |= RTMP_LF_AUTH; + } + if (flashVer && flashVer->av_len) + r->Link.flashVer = *flashVer; + else + r->Link.flashVer = RTMP_DefaultFlashVer; + if (subscribepath && subscribepath->av_len) + r->Link.subscribepath = *subscribepath; + if (usherToken && usherToken->av_len) + r->Link.usherToken = *usherToken; + r->Link.seekTime = dStart; + r->Link.stopTime = dStop; + if (bLiveStream) + r->Link.lFlags |= RTMP_LF_LIVE; + r->Link.timeout = timeout; + + r->Link.protocol = protocol; + r->Link.hostname = *host; + r->Link.port = port; + r->Link.playpath = *playpath; + + if (r->Link.port == 0) + { + if (protocol & RTMP_FEATURE_SSL) + r->Link.port = 443; + else if (protocol & RTMP_FEATURE_HTTP) + r->Link.port = 80; + else + r->Link.port = 1935; + } +} + +enum { OPT_STR=0, OPT_INT, OPT_BOOL, OPT_CONN }; +static const char *optinfo[] = { + "string", "integer", "boolean", "AMF" }; + +#define OFF(x) offsetof(struct RTMP,x) + +static struct urlopt { + AVal name; + long int off; + int otype; + int omisc; + char *use; +} options[] = { + { AVC("socks"), OFF(Link.sockshost), OPT_STR, 0, + "Use the specified SOCKS proxy" }, + { AVC("app"), OFF(Link.app), OPT_STR, 0, + "Name of target app on server" }, + { AVC("tcUrl"), OFF(Link.tcUrl), OPT_STR, 0, + "URL to played stream" }, + { AVC("pageUrl"), OFF(Link.pageUrl), OPT_STR, 0, + "URL of played media's web page" }, + { AVC("swfUrl"), OFF(Link.swfUrl), OPT_STR, 0, + "URL to player SWF file" }, + { AVC("flashver"), OFF(Link.flashVer), OPT_STR, 0, + "Flash version string (default " DEF_VERSTR ")" }, + { AVC("conn"), OFF(Link.extras), OPT_CONN, 0, + "Append arbitrary AMF data to Connect message" }, + { AVC("playpath"), OFF(Link.playpath), OPT_STR, 0, + "Path to target media on server" }, + { AVC("playlist"), OFF(Link.lFlags), OPT_BOOL, RTMP_LF_PLST, + "Set playlist before play command" }, + { AVC("live"), OFF(Link.lFlags), OPT_BOOL, RTMP_LF_LIVE, + "Stream is live, no seeking possible" }, + { AVC("subscribe"), OFF(Link.subscribepath), OPT_STR, 0, + "Stream to subscribe to" }, + { AVC("jtv"), OFF(Link.usherToken), OPT_STR, 0, + "Justin.tv authentication token" }, + { AVC("token"), OFF(Link.token), OPT_STR, 0, + "Key for SecureToken response" }, + { AVC("swfVfy"), OFF(Link.lFlags), OPT_BOOL, RTMP_LF_SWFV, + "Perform SWF Verification" }, + { AVC("swfAge"), OFF(Link.swfAge), OPT_INT, 0, + "Number of days to use cached SWF hash" }, + { AVC("start"), OFF(Link.seekTime), OPT_INT, 0, + "Stream start position in milliseconds" }, + { AVC("stop"), OFF(Link.stopTime), OPT_INT, 0, + "Stream stop position in milliseconds" }, + { AVC("buffer"), OFF(m_nBufferMS), OPT_INT, 0, + "Buffer time in milliseconds" }, + { AVC("timeout"), OFF(Link.timeout), OPT_INT, 0, + "Session timeout in seconds" }, + { AVC("pubUser"), OFF(Link.pubUser), OPT_STR, 0, + "Publisher username" }, + { AVC("pubPasswd"), OFF(Link.pubPasswd), OPT_STR, 0, + "Publisher password" }, + { {NULL,0}, 0, 0} +}; + +static const AVal truth[] = { + AVC("1"), + AVC("on"), + AVC("yes"), + AVC("true"), + {0,0} +}; + +static void RTMP_OptUsage() +{ + int i; + + RTMP_Log(RTMP_LOGERROR, "Valid RTMP options are:\n"); + for (i=0; options[i].name.av_len; i++) { + RTMP_Log(RTMP_LOGERROR, "%10s %-7s %s\n", options[i].name.av_val, + optinfo[options[i].otype], options[i].use); + } +} + +static int +parseAMF(AMFObject *obj, AVal *av, int *depth) +{ + AMFObjectProperty prop = {{0,0}}; + int i; + char *p, *arg = av->av_val; + + if (arg[1] == ':') + { + p = (char *)arg+2; + switch(arg[0]) + { + case 'B': + prop.p_type = AMF_BOOLEAN; + prop.p_vu.p_number = atoi(p); + break; + case 'S': + prop.p_type = AMF_STRING; + prop.p_vu.p_aval.av_val = p; + prop.p_vu.p_aval.av_len = av->av_len - (p-arg); + break; + case 'N': + prop.p_type = AMF_NUMBER; + prop.p_vu.p_number = strtod(p, NULL); + break; + case 'Z': + prop.p_type = AMF_NULL; + break; + case 'O': + i = atoi(p); + if (i) + { + prop.p_type = AMF_OBJECT; + } + else + { + (*depth)--; + return 0; + } + break; + default: + return -1; + } + } + else if (arg[2] == ':' && arg[0] == 'N') + { + p = strchr(arg+3, ':'); + if (!p || !*depth) + return -1; + prop.p_name.av_val = (char *)arg+3; + prop.p_name.av_len = p - (arg+3); + + p++; + switch(arg[1]) + { + case 'B': + prop.p_type = AMF_BOOLEAN; + prop.p_vu.p_number = atoi(p); + break; + case 'S': + prop.p_type = AMF_STRING; + prop.p_vu.p_aval.av_val = p; + prop.p_vu.p_aval.av_len = av->av_len - (p-arg); + break; + case 'N': + prop.p_type = AMF_NUMBER; + prop.p_vu.p_number = strtod(p, NULL); + break; + case 'O': + prop.p_type = AMF_OBJECT; + break; + default: + return -1; + } + } + else + return -1; + + if (*depth) + { + AMFObject *o2; + for (i=0; i<*depth; i++) + { + o2 = &obj->o_props[obj->o_num-1].p_vu.p_object; + obj = o2; + } + } + AMF_AddProp(obj, &prop); + if (prop.p_type == AMF_OBJECT) + (*depth)++; + return 0; +} + +int RTMP_SetOpt(RTMP *r, const AVal *opt, AVal *arg) +{ + int i; + void *v; + + for (i=0; options[i].name.av_len; i++) { + if (opt->av_len != options[i].name.av_len) continue; + if (strcasecmp(opt->av_val, options[i].name.av_val)) continue; + v = (char *)r + options[i].off; + switch(options[i].otype) { + case OPT_STR: { + AVal *aptr = v; + *aptr = *arg; } + break; + case OPT_INT: { + long l = strtol(arg->av_val, NULL, 0); + *(int *)v = l; } + break; + case OPT_BOOL: { + int j, fl; + fl = *(int *)v; + for (j=0; truth[j].av_len; j++) { + if (arg->av_len != truth[j].av_len) continue; + if (strcasecmp(arg->av_val, truth[j].av_val)) continue; + fl |= options[i].omisc; break; } + *(int *)v = fl; + } + break; + case OPT_CONN: + if (parseAMF(&r->Link.extras, arg, &r->Link.edepth)) + return FALSE; + break; + } + break; + } + if (!options[i].name.av_len) { + RTMP_Log(RTMP_LOGERROR, "Unknown option %s", opt->av_val); + RTMP_OptUsage(); + return FALSE; + } + + return TRUE; +} + +int RTMP_SetupURL(RTMP *r, char *url) +{ + AVal opt, arg; + char *p1, *p2, *ptr = strchr(url, ' '); + int ret, len; + unsigned int port = 0; + + if (ptr) + *ptr = '\0'; + + len = strlen(url); + ret = RTMP_ParseURL(url, &r->Link.protocol, &r->Link.hostname, + &port, &r->Link.playpath0, &r->Link.app, &r->Link.pubUser, &r->Link.pubPasswd); + if (!ret) + return ret; + r->Link.port = port; + r->Link.playpath = r->Link.playpath0; + + while (ptr) { + *ptr++ = '\0'; + p1 = ptr; + p2 = strchr(p1, '='); + if (!p2) + break; + opt.av_val = p1; + opt.av_len = p2 - p1; + *p2++ = '\0'; + arg.av_val = p2; + ptr = strchr(p2, ' '); + if (ptr) { + *ptr = '\0'; + arg.av_len = ptr - p2; + /* skip repeated spaces */ + while(ptr[1] == ' ') + *ptr++ = '\0'; + } else { + arg.av_len = strlen(p2); + } + + /* unescape */ + port = arg.av_len; + for (p1=p2; port >0;) { + if (*p1 == '\\') { + unsigned int c; + if (port < 3) + return FALSE; + sscanf(p1+1, "%02x", &c); + *p2++ = c; + port -= 3; + p1 += 3; + } else { + *p2++ = *p1++; + port--; + } + } + arg.av_len = p2 - arg.av_val; + + ret = RTMP_SetOpt(r, &opt, &arg); + if (!ret) + return ret; + } + + if (!r->Link.tcUrl.av_len) + { + r->Link.tcUrl.av_val = url; + if (r->Link.app.av_len) + { + if (r->Link.app.av_val < url + len) + { + /* if app is part of original url, just use it */ + r->Link.tcUrl.av_len = r->Link.app.av_len + (r->Link.app.av_val - url); + } + else + { + len = r->Link.hostname.av_len + r->Link.app.av_len + + sizeof("rtmpte://:65535/"); + r->Link.tcUrl.av_val = malloc(len); + r->Link.tcUrl.av_len = snprintf(r->Link.tcUrl.av_val, len, + "%s://%.*s:%d/%.*s", + RTMPProtocolStringsLower[r->Link.protocol], + r->Link.hostname.av_len, r->Link.hostname.av_val, + r->Link.port, + r->Link.app.av_len, r->Link.app.av_val); + r->Link.lFlags |= RTMP_LF_FTCU; + } + } + else + { + r->Link.tcUrl.av_len = strlen(url); + } + } + +#ifdef CRYPTO + if ((r->Link.lFlags & RTMP_LF_SWFV) && r->Link.swfUrl.av_len) + RTMP_HashSWF(r->Link.swfUrl.av_val, &r->Link.SWFSize, + (unsigned char *)r->Link.SWFHash, r->Link.swfAge); +#endif + + SocksSetup(r, &r->Link.sockshost); + + if (r->Link.port == 0) + { + if (r->Link.protocol & RTMP_FEATURE_SSL) + r->Link.port = 443; + else if (r->Link.protocol & RTMP_FEATURE_HTTP) + r->Link.port = 80; + else + r->Link.port = 1935; + } + return TRUE; +} + +static int +add_addr_info(struct sockaddr_in *service, AVal *host, int port) +{ + char *hostname; + int ret = TRUE; + if (host->av_val[host->av_len]) + { + hostname = malloc(host->av_len+1); + memcpy(hostname, host->av_val, host->av_len); + hostname[host->av_len] = '\0'; + } + else + { + hostname = host->av_val; + } + + service->sin_addr.s_addr = inet_addr(hostname); + if (service->sin_addr.s_addr == INADDR_NONE) + { + struct hostent *host = gethostbyname(hostname); + if (host == NULL || host->h_addr == NULL) + { + RTMP_Log(RTMP_LOGERROR, "Problem accessing the DNS. (addr: %s)", hostname); + ret = FALSE; + goto finish; + } + service->sin_addr = *(struct in_addr *)host->h_addr; + } + + service->sin_port = htons(port); +finish: + if (hostname != host->av_val) + free(hostname); + return ret; +} + +unsigned int RTMP_get_ms() +{ + unsigned int ms = 0; + +#if !defined(_WIN32) + + struct timeval tv; + gettimeofday(&tv, NULL); + + ms = tv.tv_sec * 1000 + tv.tv_usec/1000; + +#else + + ms = GetTickCount(); + +#endif + + return ms; +} + +int RTMP_connect_timeout(int cfd, struct sockaddr * service, int timeout) +{ +#if !defined(_WIN32) + unsigned int starttime = RTMP_get_ms(); + struct timeval tv; +#else + int flag = 0; + unsigned long ul = 1; +#endif + +#if !defined(_WIN32) + + tv.tv_sec = timeout/1000; + tv.tv_usec = (timeout%1000) * 1000; + + setsockopt(cfd, SOL_SOCKET, SO_SNDTIMEO, (char*)&tv, sizeof(tv)); + + while (connect(cfd, service, sizeof(struct sockaddr)) == -1 && errno != EISCONN) + { + if (RTMP_get_ms() > starttime + timeout) + { + return -1; + } + + if (errno != EINTR) + { + return -1; + } + } + + return 0; + +#else + + ioctlsocket(cfd, FIONBIO, &ul); + + if (connect(cfd, service, sizeof(struct sockaddr)) != 0) + { + fd_set set; + struct timeval tv; + + tv.tv_sec = timeout/1000; + tv.tv_usec = (timeout%1000) * 1000; + + FD_ZERO(&set); + FD_SET(cfd, &set); + + if (select((int)(cfd+1), NULL, &set, NULL, &tv) > 0) + { + int err = 0, len = sizeof(int); + + getsockopt(cfd, SOL_SOCKET, SO_ERROR, (char *)&err, (socklen_t*) &len); + + if (err == 0) + { + flag = 1; + } + } + } + else + { + flag = 1; + } + + ul = 0; + ioctlsocket(cfd, FIONBIO, &ul); + + if (flag == 1) + { + return 0; + } + else + { + return -1; + } + +#endif +} + +int +RTMP_Connect0(RTMP *r, struct sockaddr * service) +{ + int len = 1024 * 1024; + int on = 1; + r->m_sb.sb_timedout = FALSE; + r->m_pausing = 0; + r->m_fDuration = 0.0; + + r->m_sb.sb_socket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); + if (r->m_sb.sb_socket != -1) + { + if (RTMP_connect_timeout(r->m_sb.sb_socket, service, 5000) < 0) + { + int err = GetSockError(); + RTMP_Log(RTMP_LOGERROR, "%s, failed to connect socket. %d (%s)", + __FUNCTION__, err, strerror(err)); + RTMP_Close(r); + return FALSE; + } + + if (r->Link.socksport) + { + RTMP_Log(RTMP_LOGDEBUG, "%s ... SOCKS negotiation", __FUNCTION__); + if (!SocksNegotiate(r)) + { + RTMP_Log(RTMP_LOGERROR, "%s, SOCKS negotiation failed.", __FUNCTION__); + RTMP_Close(r); + return FALSE; + } + } + } + else + { + RTMP_Log(RTMP_LOGERROR, "%s, failed to create socket. Error: %d", __FUNCTION__, + GetSockError()); + return FALSE; + } + +#if 0 + /* set timeout */ + { + SET_RCVTIMEO(tv, r->Link.timeout); + if (setsockopt + (r->m_sb.sb_socket, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof(tv))) + { + RTMP_Log(RTMP_LOGERROR, "%s, Setting socket timeout to %ds failed!", + __FUNCTION__, r->Link.timeout); + } + } +#endif + + setsockopt(r->m_sb.sb_socket, IPPROTO_TCP, TCP_NODELAY, (char *) &on, sizeof(on)); + + setsockopt(r->m_sb.sb_socket, SOL_SOCKET, SO_SNDBUF, (char*)&len, sizeof(int)); + + setsockopt(r->m_sb.sb_socket, SOL_SOCKET, SO_RCVBUF, (char*)&len, sizeof(int)); + + return TRUE; +} + +int +RTMP_TLS_Accept(RTMP *r, void *ctx) +{ +#if defined(CRYPTO) && !defined(NO_SSL) + TLS_server(ctx, r->m_sb.sb_ssl); + TLS_setfd(r->m_sb.sb_ssl, r->m_sb.sb_socket); + if (TLS_accept(r->m_sb.sb_ssl) < 0) + { + RTMP_Log(RTMP_LOGERROR, "%s, TLS_Connect failed", __FUNCTION__); + return FALSE; + } + return TRUE; +#else + return FALSE; +#endif +} + +int +RTMP_Connect1(RTMP *r, RTMPPacket *cp) +{ + if (r->Link.protocol & RTMP_FEATURE_SSL) + { +#if defined(CRYPTO) && !defined(NO_SSL) + TLS_client(RTMP_TLS_ctx, r->m_sb.sb_ssl); + TLS_setfd(r->m_sb.sb_ssl, r->m_sb.sb_socket); + if (TLS_connect(r->m_sb.sb_ssl) < 0) + { + RTMP_Log(RTMP_LOGERROR, "%s, TLS_Connect failed", __FUNCTION__); + RTMP_Close(r); + return FALSE; + } +#else + RTMP_Log(RTMP_LOGERROR, "%s, no SSL/TLS support", __FUNCTION__); + RTMP_Close(r); + return FALSE; + +#endif + } + if (r->Link.protocol & RTMP_FEATURE_HTTP) + { + r->m_msgCounter = 1; + r->m_clientID.av_val = NULL; + r->m_clientID.av_len = 0; + HTTP_Post(r, RTMPT_OPEN, "", 1); + if (HTTP_read(r, 1) != 0) + { + r->m_msgCounter = 0; + RTMP_Log(RTMP_LOGDEBUG, "%s, Could not connect for handshake", __FUNCTION__); + RTMP_Close(r); + return 0; + } + r->m_msgCounter = 0; + } + RTMP_Log(RTMP_LOGDEBUG, "%s, ... connected, handshaking", __FUNCTION__); + if (!HandShake(r, TRUE)) + { + RTMP_Log(RTMP_LOGERROR, "%s, handshake failed.", __FUNCTION__); + RTMP_Close(r); + return FALSE; + } + RTMP_Log(RTMP_LOGDEBUG, "%s, handshaked", __FUNCTION__); + + if (!SendConnectPacket(r, cp)) + { + RTMP_Log(RTMP_LOGERROR, "%s, RTMP connect failed.", __FUNCTION__); + RTMP_Close(r); + return FALSE; + } + return TRUE; +} + +int +RTMP_Connect(RTMP *r, RTMPPacket *cp) +{ + struct sockaddr_in service; + if (!r->Link.hostname.av_len) + return FALSE; + + memset(&service, 0, sizeof(struct sockaddr_in)); + service.sin_family = AF_INET; + + if (r->Link.socksport) + { + /* Connect via SOCKS */ + if (!add_addr_info(&service, &r->Link.sockshost, r->Link.socksport)) + return FALSE; + } + else + { + /* Connect directly */ + if (!add_addr_info(&service, &r->Link.hostname, r->Link.port)) + return FALSE; + } + + if (!RTMP_Connect0(r, (struct sockaddr *)&service)) + return FALSE; + + r->m_bSendCounter = TRUE; + + return RTMP_Connect1(r, cp); +} + +static int +SocksNegotiate(RTMP *r) +{ + unsigned long addr; + struct sockaddr_in service; + memset(&service, 0, sizeof(struct sockaddr_in)); + + add_addr_info(&service, &r->Link.hostname, r->Link.port); + addr = htonl(service.sin_addr.s_addr); + + { + char packet[] = { + 4, 1, /* SOCKS 4, connect */ + (r->Link.port >> 8) & 0xFF, + (r->Link.port) & 0xFF, + (char)(addr >> 24) & 0xFF, (char)(addr >> 16) & 0xFF, + (char)(addr >> 8) & 0xFF, (char)addr & 0xFF, + 0 + }; /* NULL terminate */ + + WriteN(r, packet, sizeof packet); + + if (ReadN(r, packet, 8) != 8) + return FALSE; + + if (packet[0] == 0 && packet[1] == 90) + { + return TRUE; + } + else + { + RTMP_Log(RTMP_LOGERROR, "%s, SOCKS returned error code %d", __FUNCTION__, packet[1]); + return FALSE; + } + } +} + +int +RTMP_ConnectStream(RTMP *r, int seekTime) +{ + RTMPPacket packet = { 0 }; + + /* seekTime was already set by SetupStream / SetupURL. + * This is only needed by ReconnectStream. + */ + if (seekTime > 0) + r->Link.seekTime = seekTime; + + r->m_mediaChannel = 0; + + while (!r->m_bPlaying && RTMP_IsConnected(r) && RTMP_ReadPacket(r, &packet)) + { + if (RTMPPacket_IsReady(&packet)) + { + if (!packet.m_nBodySize) + continue; + if ((packet.m_packetType == RTMP_PACKET_TYPE_AUDIO) || + (packet.m_packetType == RTMP_PACKET_TYPE_VIDEO) || + (packet.m_packetType == RTMP_PACKET_TYPE_INFO)) + { + RTMP_Log(RTMP_LOGWARNING, "Received FLV packet before play()! Ignoring."); + RTMPPacket_Free(&packet); + continue; + } + + RTMP_ClientPacket(r, &packet); + RTMPPacket_Free(&packet); + } + } + + return r->m_bPlaying; +} + +int +RTMP_ReconnectStream(RTMP *r, int seekTime) +{ + RTMP_DeleteStream(r); + + RTMP_SendCreateStream(r); + + return RTMP_ConnectStream(r, seekTime); +} + +int +RTMP_ToggleStream(RTMP *r) +{ + int res; + + if (!r->m_pausing) + { + if (RTMP_IsTimedout(r) && r->m_read.status == RTMP_READ_EOF) + r->m_read.status = 0; + + res = RTMP_SendPause(r, TRUE, r->m_pauseStamp); + if (!res) + return res; + + r->m_pausing = 1; + sleep(1); + } + res = RTMP_SendPause(r, FALSE, r->m_pauseStamp); + r->m_pausing = 3; + return res; +} + +void +RTMP_DeleteStream(RTMP *r) +{ + if (r->m_stream_id < 0) + return; + + r->m_bPlaying = FALSE; + + SendDeleteStream(r, r->m_stream_id); + r->m_stream_id = -1; +} + +int +RTMP_GetNextMediaPacket(RTMP *r, RTMPPacket *packet) +{ + int bHasMediaPacket = 0; + + while (!bHasMediaPacket && RTMP_IsConnected(r) + && RTMP_ReadPacket(r, packet)) + { + if (!RTMPPacket_IsReady(packet) || !packet->m_nBodySize) + { + continue; + } + + bHasMediaPacket = RTMP_ClientPacket(r, packet); + + if (!bHasMediaPacket) + { + RTMPPacket_Free(packet); + } + else if (r->m_pausing == 3) + { + if (packet->m_nTimeStamp <= r->m_mediaStamp) + { + bHasMediaPacket = 0; +#ifdef _DEBUG + RTMP_Log(RTMP_LOGDEBUG, + "Skipped type: %02X, size: %d, TS: %d ms, abs TS: %d, pause: %d ms", + packet->m_packetType, packet->m_nBodySize, + packet->m_nTimeStamp, packet->m_hasAbsTimestamp, + r->m_mediaStamp); +#endif + RTMPPacket_Free(packet); + continue; + } + r->m_pausing = 0; + } + } + + if (bHasMediaPacket) + r->m_bPlaying = TRUE; + else if (r->m_sb.sb_timedout && !r->m_pausing) + r->m_pauseStamp = r->m_mediaChannel < r->m_channelsAllocatedIn ? + r->m_channelTimestamp[r->m_mediaChannel] : 0; + + return bHasMediaPacket; +} + +int +RTMP_ClientPacket(RTMP *r, RTMPPacket *packet) +{ + int bHasMediaPacket = 0; + switch (packet->m_packetType) + { + case RTMP_PACKET_TYPE_CHUNK_SIZE: + /* chunk size */ + HandleChangeChunkSize(r, packet); + break; + + case RTMP_PACKET_TYPE_BYTES_READ_REPORT: + /* bytes read report */ + RTMP_Log(RTMP_LOGDEBUG, "%s, received: bytes read report", __FUNCTION__); + break; + + case RTMP_PACKET_TYPE_CONTROL: + /* ctrl */ + HandleCtrl(r, packet); + break; + + case RTMP_PACKET_TYPE_SERVER_BW: + /* server bw */ + HandleServerBW(r, packet); + break; + + case RTMP_PACKET_TYPE_CLIENT_BW: + /* client bw */ + HandleClientBW(r, packet); + break; + + case RTMP_PACKET_TYPE_AUDIO: + /* audio data */ + /*RTMP_Log(RTMP_LOGDEBUG, "%s, received: audio %lu bytes", __FUNCTION__, packet.m_nBodySize); */ + HandleAudio(r, packet); + bHasMediaPacket = 1; + if (!r->m_mediaChannel) + r->m_mediaChannel = packet->m_nChannel; + if (!r->m_pausing) + r->m_mediaStamp = packet->m_nTimeStamp; + break; + + case RTMP_PACKET_TYPE_VIDEO: + /* video data */ + /*RTMP_Log(RTMP_LOGDEBUG, "%s, received: video %lu bytes", __FUNCTION__, packet.m_nBodySize); */ + HandleVideo(r, packet); + bHasMediaPacket = 1; + if (!r->m_mediaChannel) + r->m_mediaChannel = packet->m_nChannel; + if (!r->m_pausing) + r->m_mediaStamp = packet->m_nTimeStamp; + break; + + case RTMP_PACKET_TYPE_FLEX_STREAM_SEND: + /* flex stream send */ + RTMP_Log(RTMP_LOGDEBUG, + "%s, flex stream send, size %u bytes, not supported, ignoring", + __FUNCTION__, packet->m_nBodySize); + break; + + case RTMP_PACKET_TYPE_FLEX_SHARED_OBJECT: + /* flex shared object */ + RTMP_Log(RTMP_LOGDEBUG, + "%s, flex shared object, size %u bytes, not supported, ignoring", + __FUNCTION__, packet->m_nBodySize); + break; + + case RTMP_PACKET_TYPE_FLEX_MESSAGE: + /* flex message */ + { + RTMP_Log(RTMP_LOGDEBUG, + "%s, flex message, size %u bytes, not fully supported", + __FUNCTION__, packet->m_nBodySize); + /*RTMP_LogHex(packet.m_body, packet.m_nBodySize); */ + + /* some DEBUG code */ +#if 0 + RTMP_LIB_AMFObject obj; + int nRes = obj.Decode(packet.m_body+1, packet.m_nBodySize-1); + if(nRes < 0) { + RTMP_Log(RTMP_LOGERROR, "%s, error decoding AMF3 packet", __FUNCTION__); + /*return; */ + } + + obj.Dump(); +#endif + + if (HandleInvoke(r, packet->m_body + 1, packet->m_nBodySize - 1) == 1) + bHasMediaPacket = 2; + break; + } + case RTMP_PACKET_TYPE_INFO: + /* metadata (notify) */ + RTMP_Log(RTMP_LOGDEBUG, "%s, received: notify %u bytes", __FUNCTION__, + packet->m_nBodySize); + if (HandleMetadata(r, packet->m_body, packet->m_nBodySize)) + bHasMediaPacket = 1; + break; + + case RTMP_PACKET_TYPE_SHARED_OBJECT: + RTMP_Log(RTMP_LOGDEBUG, "%s, shared object, not supported, ignoring", + __FUNCTION__); + break; + + case RTMP_PACKET_TYPE_INVOKE: + /* invoke */ + RTMP_Log(RTMP_LOGDEBUG, "%s, received: invoke %u bytes", __FUNCTION__, + packet->m_nBodySize); + /*RTMP_LogHex(packet.m_body, packet.m_nBodySize); */ + + if (HandleInvoke(r, packet->m_body, packet->m_nBodySize) == 1) + bHasMediaPacket = 2; + break; + + case RTMP_PACKET_TYPE_FLASH_VIDEO: + { + /* go through FLV packets and handle metadata packets */ + unsigned int pos = 0; + uint32_t nTimeStamp = packet->m_nTimeStamp; + + while (pos + 11 < packet->m_nBodySize) + { + uint32_t dataSize = AMF_DecodeInt24(packet->m_body + pos + 1); /* size without header (11) and prevTagSize (4) */ + + if (pos + 11 + dataSize + 4 > packet->m_nBodySize) + { + RTMP_Log(RTMP_LOGWARNING, "Stream corrupt?!"); + break; + } + if (packet->m_body[pos] == 0x12) + { + HandleMetadata(r, packet->m_body + pos + 11, dataSize); + } + else if (packet->m_body[pos] == 8 || packet->m_body[pos] == 9) + { + nTimeStamp = AMF_DecodeInt24(packet->m_body + pos + 4); + nTimeStamp |= (packet->m_body[pos + 7] << 24); + } + pos += (11 + dataSize + 4); + } + if (!r->m_pausing) + r->m_mediaStamp = nTimeStamp; + + /* FLV tag(s) */ + /*RTMP_Log(RTMP_LOGDEBUG, "%s, received: FLV tag(s) %lu bytes", __FUNCTION__, packet.m_nBodySize); */ + bHasMediaPacket = 1; + break; + } + default: + RTMP_Log(RTMP_LOGDEBUG, "%s, unknown packet type received: 0x%02x", __FUNCTION__, + packet->m_packetType); +#ifdef _DEBUG + RTMP_LogHex(RTMP_LOGDEBUG, packet->m_body, packet->m_nBodySize); +#endif + } + + return bHasMediaPacket; +} + +#ifdef _DEBUG +FILE *netstackdump = NULL; +FILE *netstackdump_read = NULL; +//extern FILE *netstackdump; +//extern FILE *netstackdump_read; +#endif + +static int +ReadN(RTMP *r, char *buffer, int n) +{ + int nOriginalSize = n; + int avail; + char *ptr; + + r->m_sb.sb_timedout = FALSE; + +#ifdef _DEBUG + memset(buffer, 0, n); +#endif + + ptr = buffer; + while (n > 0) + { + int nBytes = 0, nRead; + if (r->Link.protocol & RTMP_FEATURE_HTTP) + { + int refill = 0; + while (!r->m_resplen) + { + int ret; + if (r->m_sb.sb_size < 13 || refill) + { + if (!r->m_unackd) + HTTP_Post(r, RTMPT_IDLE, "", 1); + if (RTMPSockBuf_Fill(&r->m_sb) < 1) + { + if (!r->m_sb.sb_timedout) + RTMP_Close(r); + return 0; + } + } + if ((ret = HTTP_read(r, 0)) == -1) + { + RTMP_Log(RTMP_LOGDEBUG, "%s, No valid HTTP response found", __FUNCTION__); + RTMP_Close(r); + return 0; + } + else if (ret == -2) + { + refill = 1; + } + else + { + refill = 0; + } + } + if (r->m_resplen && !r->m_sb.sb_size) + RTMPSockBuf_Fill(&r->m_sb); + avail = r->m_sb.sb_size; + if (avail > r->m_resplen) + avail = r->m_resplen; + } + else + { + avail = r->m_sb.sb_size; + if (avail == 0) + { + if (RTMPSockBuf_Fill(&r->m_sb) < 1) + { + if (!r->m_sb.sb_timedout) + RTMP_Close(r); + return 0; + } + avail = r->m_sb.sb_size; + } + } + nRead = ((n < avail) ? n : avail); + if (nRead > 0) + { + memcpy(ptr, r->m_sb.sb_start, nRead); + r->m_sb.sb_start += nRead; + r->m_sb.sb_size -= nRead; + nBytes = nRead; + r->m_nBytesIn += nRead; + if (r->m_bSendCounter + && r->m_nBytesIn > ( r->m_nBytesInSent + r->m_nClientBW / 10)) + if (!SendBytesReceived(r)) + return FALSE; + } + /*RTMP_Log(RTMP_LOGDEBUG, "%s: %d bytes\n", __FUNCTION__, nBytes); */ +#ifdef _DEBUG + if (netstackdump_read) + fwrite(ptr, 1, nBytes, netstackdump_read); +#endif + + if (nBytes == 0) + { + RTMP_Log(RTMP_LOGDEBUG, "%s, RTMP socket closed by peer", __FUNCTION__); + /*goto again; */ + RTMP_Close(r); + break; + } + + if (r->Link.protocol & RTMP_FEATURE_HTTP) + r->m_resplen -= nBytes; + +#ifdef CRYPTO + if (r->Link.rc4keyIn) + { + RC4_encrypt(r->Link.rc4keyIn, nBytes, ptr); + } +#endif + + n -= nBytes; + ptr += nBytes; + } + + return nOriginalSize - n; +} + +static int +WriteN(RTMP *r, const char *buffer, int n) +{ + const char *ptr = buffer; +#ifdef CRYPTO + char *encrypted = 0; + char buf[RTMP_BUFFER_CACHE_SIZE]; + + if (r->Link.rc4keyOut) + { + if (n > sizeof(buf)) + encrypted = (char *)malloc(n); + else + encrypted = (char *)buf; + ptr = encrypted; + RC4_encrypt2(r->Link.rc4keyOut, n, buffer, ptr); + } +#endif + + while (n > 0) + { + int nBytes; + + if (r->Link.protocol & RTMP_FEATURE_HTTP) + nBytes = HTTP_Post(r, RTMPT_SEND, ptr, n); + else + nBytes = RTMPSockBuf_Send(&r->m_sb, ptr, n); + /*RTMP_Log(RTMP_LOGDEBUG, "%s: %d\n", __FUNCTION__, nBytes); */ + + if (nBytes < 0) + { + int sockerr = GetSockError(); + RTMP_Log(RTMP_LOGERROR, "%s, RTMP send error %d (%d bytes)", __FUNCTION__, + sockerr, n); + + if (sockerr == EINTR && !RTMP_ctrlC) + continue; + + if (sockerr == EAGAIN) + { +#if defined(_WIN32) || defined(_WIN64) + Sleep(1); +#else + usleep(1000); +#endif + continue; + } + + RTMP_Close(r); + n = 1; + break; + } + + if (nBytes == 0) + break; + + n -= nBytes; + ptr += nBytes; + } + +#ifdef CRYPTO + if (encrypted && encrypted != buf) + free(encrypted); +#endif + + return n == 0; +} + +#define SAVC(x) static const AVal av_##x = AVC(#x) + +SAVC(app); +SAVC(connect); +SAVC(flashVer); +SAVC(swfUrl); +SAVC(pageUrl); +SAVC(tcUrl); +SAVC(fpad); +SAVC(capabilities); +SAVC(audioCodecs); +SAVC(videoCodecs); +SAVC(videoFunction); +SAVC(objectEncoding); +SAVC(secureToken); +SAVC(secureTokenResponse); +SAVC(type); +SAVC(nonprivate); + +static int +SendConnectPacket(RTMP *r, RTMPPacket *cp) +{ + RTMPPacket packet; + char pbuf[4096], *pend = pbuf + sizeof(pbuf); + char *enc; + + if (cp) + return RTMP_SendPacket(r, cp, TRUE); + + packet.m_nChannel = 0x03; /* control channel (invoke) */ + packet.m_headerType = RTMP_PACKET_SIZE_LARGE; + packet.m_packetType = RTMP_PACKET_TYPE_INVOKE; + packet.m_nTimeStamp = 0; + packet.m_nInfoField2 = 0; + packet.m_hasAbsTimestamp = 0; + packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE; + + enc = packet.m_body; + enc = AMF_EncodeString(enc, pend, &av_connect); + enc = AMF_EncodeNumber(enc, pend, ++r->m_numInvokes); + *enc++ = AMF_OBJECT; + + enc = AMF_EncodeNamedString(enc, pend, &av_app, &r->Link.app); + if (!enc) + return FALSE; + if (r->Link.protocol & RTMP_FEATURE_WRITE) + { + enc = AMF_EncodeNamedString(enc, pend, &av_type, &av_nonprivate); + if (!enc) + return FALSE; + } + if (r->Link.flashVer.av_len) + { + enc = AMF_EncodeNamedString(enc, pend, &av_flashVer, &r->Link.flashVer); + if (!enc) + return FALSE; + } + if (r->Link.swfUrl.av_len) + { + enc = AMF_EncodeNamedString(enc, pend, &av_swfUrl, &r->Link.swfUrl); + if (!enc) + return FALSE; + } + if (r->Link.tcUrl.av_len) + { + enc = AMF_EncodeNamedString(enc, pend, &av_tcUrl, &r->Link.tcUrl); + if (!enc) + return FALSE; + } + if (!(r->Link.protocol & RTMP_FEATURE_WRITE)) + { + enc = AMF_EncodeNamedBoolean(enc, pend, &av_fpad, FALSE); + if (!enc) + return FALSE; + enc = AMF_EncodeNamedNumber(enc, pend, &av_capabilities, 15.0); + if (!enc) + return FALSE; + enc = AMF_EncodeNamedNumber(enc, pend, &av_audioCodecs, r->m_fAudioCodecs); + if (!enc) + return FALSE; + enc = AMF_EncodeNamedNumber(enc, pend, &av_videoCodecs, r->m_fVideoCodecs); + if (!enc) + return FALSE; + enc = AMF_EncodeNamedNumber(enc, pend, &av_videoFunction, 1.0); + if (!enc) + return FALSE; + if (r->Link.pageUrl.av_len) + { + enc = AMF_EncodeNamedString(enc, pend, &av_pageUrl, &r->Link.pageUrl); + if (!enc) + return FALSE; + } + } + if (r->m_fEncoding != 0.0 || r->m_bSendEncoding) + { /* AMF0, AMF3 not fully supported yet */ + enc = AMF_EncodeNamedNumber(enc, pend, &av_objectEncoding, r->m_fEncoding); + if (!enc) + return FALSE; + } + if (enc + 3 >= pend) + return FALSE; + *enc++ = 0; + *enc++ = 0; /* end of object - 0x00 0x00 0x09 */ + *enc++ = AMF_OBJECT_END; + + /* add auth string */ + if (r->Link.auth.av_len) + { + enc = AMF_EncodeBoolean(enc, pend, r->Link.lFlags & RTMP_LF_AUTH); + if (!enc) + return FALSE; + enc = AMF_EncodeString(enc, pend, &r->Link.auth); + if (!enc) + return FALSE; + } + if (r->Link.extras.o_num) + { + int i; + for (i = 0; i < r->Link.extras.o_num; i++) + { + enc = AMFProp_Encode(&r->Link.extras.o_props[i], enc, pend); + if (!enc) + return FALSE; + } + } + packet.m_nBodySize = enc - packet.m_body; + + return RTMP_SendPacket(r, &packet, TRUE); +} + +#if 0 /* unused */ +SAVC(bgHasStream); + +static int +SendBGHasStream(RTMP *r, double dId, AVal *playpath) +{ + RTMPPacket packet; + char pbuf[1024], *pend = pbuf + sizeof(pbuf); + char *enc; + + packet.m_nChannel = 0x03; /* control channel (invoke) */ + packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM; + packet.m_packetType = RTMP_PACKET_TYPE_INVOKE; + packet.m_nTimeStamp = 0; + packet.m_nInfoField2 = 0; + packet.m_hasAbsTimestamp = 0; + packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE; + + enc = packet.m_body; + enc = AMF_EncodeString(enc, pend, &av_bgHasStream); + enc = AMF_EncodeNumber(enc, pend, dId); + *enc++ = AMF_NULL; + + enc = AMF_EncodeString(enc, pend, playpath); + if (enc == NULL) + return FALSE; + + packet.m_nBodySize = enc - packet.m_body; + + return RTMP_SendPacket(r, &packet, TRUE); +} +#endif + +SAVC(createStream); + +int +RTMP_SendCreateStream(RTMP *r) +{ + RTMPPacket packet; + char pbuf[256], *pend = pbuf + sizeof(pbuf); + char *enc; + + packet.m_nChannel = 0x03; /* control channel (invoke) */ + packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM; + packet.m_packetType = RTMP_PACKET_TYPE_INVOKE; + packet.m_nTimeStamp = 0; + packet.m_nInfoField2 = 0; + packet.m_hasAbsTimestamp = 0; + packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE; + + enc = packet.m_body; + enc = AMF_EncodeString(enc, pend, &av_createStream); + enc = AMF_EncodeNumber(enc, pend, ++r->m_numInvokes); + *enc++ = AMF_NULL; /* NULL */ + + packet.m_nBodySize = enc - packet.m_body; + + return RTMP_SendPacket(r, &packet, TRUE); +} + +SAVC(FCSubscribe); + +static int +SendFCSubscribe(RTMP *r, AVal *subscribepath) +{ + RTMPPacket packet; + char pbuf[512], *pend = pbuf + sizeof(pbuf); + char *enc; + packet.m_nChannel = 0x03; /* control channel (invoke) */ + packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM; + packet.m_packetType = RTMP_PACKET_TYPE_INVOKE; + packet.m_nTimeStamp = 0; + packet.m_nInfoField2 = 0; + packet.m_hasAbsTimestamp = 0; + packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE; + + RTMP_Log(RTMP_LOGDEBUG, "FCSubscribe: %s", subscribepath->av_val); + enc = packet.m_body; + enc = AMF_EncodeString(enc, pend, &av_FCSubscribe); + enc = AMF_EncodeNumber(enc, pend, ++r->m_numInvokes); + *enc++ = AMF_NULL; + enc = AMF_EncodeString(enc, pend, subscribepath); + + if (!enc) + return FALSE; + + packet.m_nBodySize = enc - packet.m_body; + + return RTMP_SendPacket(r, &packet, TRUE); +} + +/* Justin.tv specific authentication */ +static const AVal av_NetStream_Authenticate_UsherToken = AVC("NetStream.Authenticate.UsherToken"); + +static int +SendUsherToken(RTMP *r, AVal *usherToken) +{ + RTMPPacket packet; + char pbuf[1024], *pend = pbuf + sizeof(pbuf); + char *enc; + packet.m_nChannel = 0x03; /* control channel (invoke) */ + packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM; + packet.m_packetType = RTMP_PACKET_TYPE_INVOKE; + packet.m_nTimeStamp = 0; + packet.m_nInfoField2 = 0; + packet.m_hasAbsTimestamp = 0; + packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE; + + RTMP_Log(RTMP_LOGDEBUG, "UsherToken: %s", usherToken->av_val); + enc = packet.m_body; + enc = AMF_EncodeString(enc, pend, &av_NetStream_Authenticate_UsherToken); + enc = AMF_EncodeNumber(enc, pend, ++r->m_numInvokes); + *enc++ = AMF_NULL; + enc = AMF_EncodeString(enc, pend, usherToken); + + if (!enc) + return FALSE; + + packet.m_nBodySize = enc - packet.m_body; + + return RTMP_SendPacket(r, &packet, FALSE); +} +/******************************************/ + +SAVC(releaseStream); + +static int +SendReleaseStream(RTMP *r) +{ + RTMPPacket packet; + char pbuf[1024], *pend = pbuf + sizeof(pbuf); + char *enc; + + packet.m_nChannel = 0x03; /* control channel (invoke) */ + packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM; + packet.m_packetType = RTMP_PACKET_TYPE_INVOKE; + packet.m_nTimeStamp = 0; + packet.m_nInfoField2 = 0; + packet.m_hasAbsTimestamp = 0; + packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE; + + enc = packet.m_body; + enc = AMF_EncodeString(enc, pend, &av_releaseStream); + enc = AMF_EncodeNumber(enc, pend, ++r->m_numInvokes); + *enc++ = AMF_NULL; + enc = AMF_EncodeString(enc, pend, &r->Link.playpath); + if (!enc) + return FALSE; + + packet.m_nBodySize = enc - packet.m_body; + + return RTMP_SendPacket(r, &packet, FALSE); +} + +SAVC(FCPublish); + +static int +SendFCPublish(RTMP *r) +{ + RTMPPacket packet; + char pbuf[1024], *pend = pbuf + sizeof(pbuf); + char *enc; + + packet.m_nChannel = 0x03; /* control channel (invoke) */ + packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM; + packet.m_packetType = RTMP_PACKET_TYPE_INVOKE; + packet.m_nTimeStamp = 0; + packet.m_nInfoField2 = 0; + packet.m_hasAbsTimestamp = 0; + packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE; + + enc = packet.m_body; + enc = AMF_EncodeString(enc, pend, &av_FCPublish); + enc = AMF_EncodeNumber(enc, pend, ++r->m_numInvokes); + *enc++ = AMF_NULL; + enc = AMF_EncodeString(enc, pend, &r->Link.playpath); + if (!enc) + return FALSE; + + packet.m_nBodySize = enc - packet.m_body; + + return RTMP_SendPacket(r, &packet, FALSE); +} + +SAVC(FCUnpublish); + +static int +SendFCUnpublish(RTMP *r) +{ + RTMPPacket packet; + char pbuf[1024], *pend = pbuf + sizeof(pbuf); + char *enc; + + packet.m_nChannel = 0x03; /* control channel (invoke) */ + packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM; + packet.m_packetType = RTMP_PACKET_TYPE_INVOKE; + packet.m_nTimeStamp = 0; + packet.m_nInfoField2 = 0; + packet.m_hasAbsTimestamp = 0; + packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE; + + enc = packet.m_body; + enc = AMF_EncodeString(enc, pend, &av_FCUnpublish); + enc = AMF_EncodeNumber(enc, pend, ++r->m_numInvokes); + *enc++ = AMF_NULL; + enc = AMF_EncodeString(enc, pend, &r->Link.playpath); + if (!enc) + return FALSE; + + packet.m_nBodySize = enc - packet.m_body; + + return RTMP_SendPacket(r, &packet, FALSE); +} + +SAVC(publish); +SAVC(live); + +static int +SendPublish(RTMP *r) +{ + RTMPPacket packet; + char pbuf[1024], *pend = pbuf + sizeof(pbuf); + char *enc; + + packet.m_nChannel = 0x04; /* source channel (invoke) */ + packet.m_headerType = RTMP_PACKET_SIZE_LARGE; + packet.m_packetType = RTMP_PACKET_TYPE_INVOKE; + packet.m_nTimeStamp = 0; + packet.m_nInfoField2 = r->m_stream_id; + packet.m_hasAbsTimestamp = 0; + packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE; + + enc = packet.m_body; + enc = AMF_EncodeString(enc, pend, &av_publish); + enc = AMF_EncodeNumber(enc, pend, ++r->m_numInvokes); + *enc++ = AMF_NULL; + enc = AMF_EncodeString(enc, pend, &r->Link.playpath); + if (!enc) + return FALSE; + + /* FIXME: should we choose live based on Link.lFlags & RTMP_LF_LIVE? */ + enc = AMF_EncodeString(enc, pend, &av_live); + if (!enc) + return FALSE; + + packet.m_nBodySize = enc - packet.m_body; + + return RTMP_SendPacket(r, &packet, TRUE); +} + +SAVC(deleteStream); + +static int +SendDeleteStream(RTMP *r, double dStreamId) +{ + RTMPPacket packet; + char pbuf[256], *pend = pbuf + sizeof(pbuf); + char *enc; + + packet.m_nChannel = 0x03; /* control channel (invoke) */ + packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM; + packet.m_packetType = RTMP_PACKET_TYPE_INVOKE; + packet.m_nTimeStamp = 0; + packet.m_nInfoField2 = 0; + packet.m_hasAbsTimestamp = 0; + packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE; + + enc = packet.m_body; + enc = AMF_EncodeString(enc, pend, &av_deleteStream); + enc = AMF_EncodeNumber(enc, pend, ++r->m_numInvokes); + *enc++ = AMF_NULL; + enc = AMF_EncodeNumber(enc, pend, dStreamId); + + packet.m_nBodySize = enc - packet.m_body; + + /* no response expected */ + return RTMP_SendPacket(r, &packet, FALSE); +} + +SAVC(pause); + +int +RTMP_SendPause(RTMP *r, int DoPause, int iTime) +{ + RTMPPacket packet; + char pbuf[256], *pend = pbuf + sizeof(pbuf); + char *enc; + + packet.m_nChannel = 0x08; /* video channel */ + packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM; + packet.m_packetType = RTMP_PACKET_TYPE_INVOKE; + packet.m_nTimeStamp = 0; + packet.m_nInfoField2 = 0; + packet.m_hasAbsTimestamp = 0; + packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE; + + enc = packet.m_body; + enc = AMF_EncodeString(enc, pend, &av_pause); + enc = AMF_EncodeNumber(enc, pend, ++r->m_numInvokes); + *enc++ = AMF_NULL; + enc = AMF_EncodeBoolean(enc, pend, DoPause); + enc = AMF_EncodeNumber(enc, pend, (double)iTime); + + packet.m_nBodySize = enc - packet.m_body; + + RTMP_Log(RTMP_LOGDEBUG, "%s, %d, pauseTime=%d", __FUNCTION__, DoPause, iTime); + return RTMP_SendPacket(r, &packet, TRUE); +} + +int RTMP_Pause(RTMP *r, int DoPause) +{ + if (DoPause) + r->m_pauseStamp = r->m_mediaChannel < r->m_channelsAllocatedIn ? + r->m_channelTimestamp[r->m_mediaChannel] : 0; + return RTMP_SendPause(r, DoPause, r->m_pauseStamp); +} + +SAVC(seek); + +int +RTMP_SendSeek(RTMP *r, int iTime) +{ + RTMPPacket packet; + char pbuf[256], *pend = pbuf + sizeof(pbuf); + char *enc; + + packet.m_nChannel = 0x08; /* video channel */ + packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM; + packet.m_packetType = RTMP_PACKET_TYPE_INVOKE; + packet.m_nTimeStamp = 0; + packet.m_nInfoField2 = 0; + packet.m_hasAbsTimestamp = 0; + packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE; + + enc = packet.m_body; + enc = AMF_EncodeString(enc, pend, &av_seek); + enc = AMF_EncodeNumber(enc, pend, ++r->m_numInvokes); + *enc++ = AMF_NULL; + enc = AMF_EncodeNumber(enc, pend, (double)iTime); + + packet.m_nBodySize = enc - packet.m_body; + + r->m_read.flags |= RTMP_READ_SEEKING; + r->m_read.nResumeTS = 0; + + return RTMP_SendPacket(r, &packet, TRUE); +} + +int +RTMP_SendServerBW(RTMP *r) +{ + RTMPPacket packet; + char pbuf[256], *pend = pbuf + sizeof(pbuf); + + packet.m_nChannel = 0x02; /* control channel (invoke) */ + packet.m_headerType = RTMP_PACKET_SIZE_LARGE; + packet.m_packetType = RTMP_PACKET_TYPE_SERVER_BW; + packet.m_nTimeStamp = 0; + packet.m_nInfoField2 = 0; + packet.m_hasAbsTimestamp = 0; + packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE; + + packet.m_nBodySize = 4; + + AMF_EncodeInt32(packet.m_body, pend, r->m_nServerBW); + return RTMP_SendPacket(r, &packet, FALSE); +} + +int +RTMP_SendClientBW(RTMP *r) +{ + RTMPPacket packet; + char pbuf[256], *pend = pbuf + sizeof(pbuf); + + packet.m_nChannel = 0x02; /* control channel (invoke) */ + packet.m_headerType = RTMP_PACKET_SIZE_LARGE; + packet.m_packetType = RTMP_PACKET_TYPE_CLIENT_BW; + packet.m_nTimeStamp = 0; + packet.m_nInfoField2 = 0; + packet.m_hasAbsTimestamp = 0; + packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE; + + packet.m_nBodySize = 5; + + AMF_EncodeInt32(packet.m_body, pend, r->m_nClientBW); + packet.m_body[4] = r->m_nClientBW2; + return RTMP_SendPacket(r, &packet, FALSE); +} + +int RTMP_SendChunkSize(RTMP *r, int size) +{ + RTMPPacket packet; + char pbuf[256], *pend = pbuf + sizeof(pbuf); + + packet.m_nChannel = 0x02; /* control channel (invoke) */ + packet.m_headerType = RTMP_PACKET_SIZE_LARGE; + packet.m_packetType = RTMP_PACKET_TYPE_CHUNK_SIZE; + packet.m_nTimeStamp = 0; + packet.m_nInfoField2 = 0; + packet.m_hasAbsTimestamp = 0; + packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE; + + packet.m_nBodySize = 4; + + AMF_EncodeInt32(packet.m_body, pend, size); + return RTMP_SendPacket(r, &packet, FALSE); +} + +static int +SendBytesReceived(RTMP *r) +{ + RTMPPacket packet; + char pbuf[256], *pend = pbuf + sizeof(pbuf); + + packet.m_nChannel = 0x02; /* control channel (invoke) */ + packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM; + packet.m_packetType = RTMP_PACKET_TYPE_BYTES_READ_REPORT; + packet.m_nTimeStamp = 0; + packet.m_nInfoField2 = 0; + packet.m_hasAbsTimestamp = 0; + packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE; + + packet.m_nBodySize = 4; + + AMF_EncodeInt32(packet.m_body, pend, r->m_nBytesIn); /* hard coded for now */ + r->m_nBytesInSent = r->m_nBytesIn; + + /*RTMP_Log(RTMP_LOGDEBUG, "Send bytes report. 0x%x (%d bytes)", (unsigned int)m_nBytesIn, m_nBytesIn); */ + return RTMP_SendPacket(r, &packet, FALSE); +} + +SAVC(_checkbw); + +static int +SendCheckBW(RTMP *r) +{ + RTMPPacket packet; + char pbuf[256], *pend = pbuf + sizeof(pbuf); + char *enc; + + packet.m_nChannel = 0x03; /* control channel (invoke) */ + packet.m_headerType = RTMP_PACKET_SIZE_LARGE; + packet.m_packetType = RTMP_PACKET_TYPE_INVOKE; + packet.m_nTimeStamp = 0; /* RTMP_GetTime(); */ + packet.m_nInfoField2 = 0; + packet.m_hasAbsTimestamp = 0; + packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE; + + enc = packet.m_body; + enc = AMF_EncodeString(enc, pend, &av__checkbw); + enc = AMF_EncodeNumber(enc, pend, ++r->m_numInvokes); + *enc++ = AMF_NULL; + + packet.m_nBodySize = enc - packet.m_body; + + /* triggers _onbwcheck and eventually results in _onbwdone */ + return RTMP_SendPacket(r, &packet, FALSE); +} + +SAVC(_result); + +static int +SendCheckBWResult(RTMP *r, double txn) +{ + RTMPPacket packet; + char pbuf[256], *pend = pbuf + sizeof(pbuf); + char *enc; + + packet.m_nChannel = 0x03; /* control channel (invoke) */ + packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM; + packet.m_packetType = RTMP_PACKET_TYPE_INVOKE; + packet.m_nTimeStamp = 0x16 * r->m_nBWCheckCounter; /* temp inc value. till we figure it out. */ + packet.m_nInfoField2 = 0; + packet.m_hasAbsTimestamp = 0; + packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE; + + enc = packet.m_body; + enc = AMF_EncodeString(enc, pend, &av__result); + enc = AMF_EncodeNumber(enc, pend, txn); + *enc++ = AMF_NULL; + enc = AMF_EncodeNumber(enc, pend, (double)r->m_nBWCheckCounter++); + + packet.m_nBodySize = enc - packet.m_body; + + return RTMP_SendPacket(r, &packet, FALSE); +} + +SAVC(ping); +SAVC(pong); + +static int +SendPong(RTMP *r, double txn) +{ + RTMPPacket packet; + char pbuf[256], *pend = pbuf + sizeof(pbuf); + char *enc; + + packet.m_nChannel = 0x03; /* control channel (invoke) */ + packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM; + packet.m_packetType = RTMP_PACKET_TYPE_INVOKE; + packet.m_nTimeStamp = 0x16 * r->m_nBWCheckCounter; /* temp inc value. till we figure it out. */ + packet.m_nInfoField2 = 0; + packet.m_hasAbsTimestamp = 0; + packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE; + + enc = packet.m_body; + enc = AMF_EncodeString(enc, pend, &av_pong); + enc = AMF_EncodeNumber(enc, pend, txn); + *enc++ = AMF_NULL; + + packet.m_nBodySize = enc - packet.m_body; + + return RTMP_SendPacket(r, &packet, FALSE); +} + +SAVC(play); + +static int +SendPlay(RTMP *r) +{ + RTMPPacket packet; + char pbuf[1024], *pend = pbuf + sizeof(pbuf); + char *enc; + + packet.m_nChannel = 0x08; /* we make 8 our stream channel */ + packet.m_headerType = RTMP_PACKET_SIZE_LARGE; + packet.m_packetType = RTMP_PACKET_TYPE_INVOKE; + packet.m_nTimeStamp = 0; + packet.m_nInfoField2 = r->m_stream_id; /*0x01000000; */ + packet.m_hasAbsTimestamp = 0; + packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE; + + enc = packet.m_body; + enc = AMF_EncodeString(enc, pend, &av_play); + enc = AMF_EncodeNumber(enc, pend, ++r->m_numInvokes); + *enc++ = AMF_NULL; + + RTMP_Log(RTMP_LOGDEBUG, "%s, seekTime=%d, stopTime=%d, sending play: %s", + __FUNCTION__, r->Link.seekTime, r->Link.stopTime, + r->Link.playpath.av_val); + enc = AMF_EncodeString(enc, pend, &r->Link.playpath); + if (!enc) + return FALSE; + + /* Optional parameters start and len. + * + * start: -2, -1, 0, positive number + * -2: looks for a live stream, then a recorded stream, + * if not found any open a live stream + * -1: plays a live stream + * >=0: plays a recorded streams from 'start' milliseconds + */ + if (r->Link.lFlags & RTMP_LF_LIVE) + enc = AMF_EncodeNumber(enc, pend, -1000.0); + else + { + if (r->Link.seekTime > 0.0) + enc = AMF_EncodeNumber(enc, pend, r->Link.seekTime); /* resume from here */ + else + enc = AMF_EncodeNumber(enc, pend, 0.0); /*-2000.0);*/ /* recorded as default, -2000.0 is not reliable since that freezes the player if the stream is not found */ + } + if (!enc) + return FALSE; + + /* len: -1, 0, positive number + * -1: plays live or recorded stream to the end (default) + * 0: plays a frame 'start' ms away from the beginning + * >0: plays a live or recoded stream for 'len' milliseconds + */ + /*enc += EncodeNumber(enc, -1.0); */ /* len */ + if (r->Link.stopTime) + { + enc = AMF_EncodeNumber(enc, pend, r->Link.stopTime - r->Link.seekTime); + if (!enc) + return FALSE; + } + + packet.m_nBodySize = enc - packet.m_body; + + return RTMP_SendPacket(r, &packet, TRUE); +} + +SAVC(set_playlist); +SAVC(0); + +static int +SendPlaylist(RTMP *r) +{ + RTMPPacket packet; + char pbuf[1024], *pend = pbuf + sizeof(pbuf); + char *enc; + + packet.m_nChannel = 0x08; /* we make 8 our stream channel */ + packet.m_headerType = RTMP_PACKET_SIZE_LARGE; + packet.m_packetType = RTMP_PACKET_TYPE_INVOKE; + packet.m_nTimeStamp = 0; + packet.m_nInfoField2 = r->m_stream_id; /*0x01000000; */ + packet.m_hasAbsTimestamp = 0; + packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE; + + enc = packet.m_body; + enc = AMF_EncodeString(enc, pend, &av_set_playlist); + enc = AMF_EncodeNumber(enc, pend, 0); + *enc++ = AMF_NULL; + *enc++ = AMF_ECMA_ARRAY; + *enc++ = 0; + *enc++ = 0; + *enc++ = 0; + *enc++ = AMF_OBJECT; + enc = AMF_EncodeNamedString(enc, pend, &av_0, &r->Link.playpath); + if (!enc) + return FALSE; + if (enc + 3 >= pend) + return FALSE; + *enc++ = 0; + *enc++ = 0; + *enc++ = AMF_OBJECT_END; + + packet.m_nBodySize = enc - packet.m_body; + + return RTMP_SendPacket(r, &packet, TRUE); +} + +static int +SendSecureTokenResponse(RTMP *r, AVal *resp) +{ + RTMPPacket packet; + char pbuf[1024], *pend = pbuf + sizeof(pbuf); + char *enc; + + packet.m_nChannel = 0x03; /* control channel (invoke) */ + packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM; + packet.m_packetType = RTMP_PACKET_TYPE_INVOKE; + packet.m_nTimeStamp = 0; + packet.m_nInfoField2 = 0; + packet.m_hasAbsTimestamp = 0; + packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE; + + enc = packet.m_body; + enc = AMF_EncodeString(enc, pend, &av_secureTokenResponse); + enc = AMF_EncodeNumber(enc, pend, 0.0); + *enc++ = AMF_NULL; + enc = AMF_EncodeString(enc, pend, resp); + if (!enc) + return FALSE; + + packet.m_nBodySize = enc - packet.m_body; + + return RTMP_SendPacket(r, &packet, FALSE); +} + +/* +from http://jira.red5.org/confluence/display/docs/Ping: + +Ping is the most mysterious message in RTMP and till now we haven't fully interpreted it yet. In summary, Ping message is used as a special command that are exchanged between client and server. This page aims to document all known Ping messages. Expect the list to grow. + +The type of Ping packet is 0x4 and contains two mandatory parameters and two optional parameters. The first parameter is the type of Ping and in short integer. The second parameter is the target of the ping. As Ping is always sent in Channel 2 (control channel) and the target object in RTMP header is always 0 which means the Connection object, it's necessary to put an extra parameter to indicate the exact target object the Ping is sent to. The second parameter takes this responsibility. The value has the same meaning as the target object field in RTMP header. (The second value could also be used as other purposes, like RTT Ping/Pong. It is used as the timestamp.) The third and fourth parameters are optional and could be looked upon as the parameter of the Ping packet. Below is an unexhausted list of Ping messages. + + * type 0: Clear the stream. No third and fourth parameters. The second parameter could be 0. After the connection is established, a Ping 0,0 will be sent from server to client. The message will also be sent to client on the start of Play and in response of a Seek or Pause/Resume request. This Ping tells client to re-calibrate the clock with the timestamp of the next packet server sends. + * type 1: Tell the stream to clear the playing buffer. + * type 3: Buffer time of the client. The third parameter is the buffer time in millisecond. + * type 4: Reset a stream. Used together with type 0 in the case of VOD. Often sent before type 0. + * type 6: Ping the client from server. The second parameter is the current time. + * type 7: Pong reply from client. The second parameter is the time the server sent with his ping request. + * type 26: SWFVerification request + * type 27: SWFVerification response +*/ +int +RTMP_SendCtrl(RTMP *r, short nType, unsigned int nObject, unsigned int nTime) +{ + RTMPPacket packet; + char pbuf[256], *pend = pbuf + sizeof(pbuf); + int nSize; + char *buf; + + RTMP_Log(RTMP_LOGDEBUG, "sending ctrl. type: 0x%04x", (unsigned short)nType); + + packet.m_nChannel = 0x02; /* control channel (ping) */ + packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM; + packet.m_packetType = RTMP_PACKET_TYPE_CONTROL; + packet.m_nTimeStamp = 0; /* RTMP_GetTime(); */ + packet.m_nInfoField2 = 0; + packet.m_hasAbsTimestamp = 0; + packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE; + + switch(nType) { + case 0x03: nSize = 10; break; /* buffer time */ + case 0x1A: nSize = 3; break; /* SWF verify request */ + case 0x1B: nSize = 44; break; /* SWF verify response */ + default: nSize = 6; break; + } + + packet.m_nBodySize = nSize; + + buf = packet.m_body; + buf = AMF_EncodeInt16(buf, pend, nType); + + if (nType == 0x1B) + { +#ifdef CRYPTO + memcpy(buf, r->Link.SWFVerificationResponse, 42); + RTMP_Log(RTMP_LOGDEBUG, "Sending SWFVerification response: "); + RTMP_LogHex(RTMP_LOGDEBUG, (uint8_t *)packet.m_body, packet.m_nBodySize); +#endif + } + else if (nType == 0x1A) + { + *buf = nObject & 0xff; + } + else + { + if (nSize > 2) + buf = AMF_EncodeInt32(buf, pend, nObject); + + if (nSize > 6) + buf = AMF_EncodeInt32(buf, pend, nTime); + } + + return RTMP_SendPacket(r, &packet, FALSE); +} + +static void +AV_erase(RTMP_METHOD *vals, int *num, int i, int freeit) +{ + if (freeit) + free(vals[i].name.av_val); + (*num)--; + for (; i < *num; i++) + { + vals[i] = vals[i + 1]; + } + vals[i].name.av_val = NULL; + vals[i].name.av_len = 0; + vals[i].num = 0; +} + +void +RTMP_DropRequest(RTMP *r, int i, int freeit) +{ + AV_erase(r->m_methodCalls, &r->m_numCalls, i, freeit); +} + +static void +AV_queue(RTMP_METHOD **vals, int *num, AVal *av, int txn) +{ + char *tmp; + if (!(*num & 0x0f)) + *vals = realloc(*vals, (*num + 16) * sizeof(RTMP_METHOD)); + tmp = malloc(av->av_len + 1); + memcpy(tmp, av->av_val, av->av_len); + tmp[av->av_len] = '\0'; + (*vals)[*num].num = txn; + (*vals)[*num].name.av_len = av->av_len; + (*vals)[(*num)++].name.av_val = tmp; +} + +static void +AV_clear(RTMP_METHOD *vals, int num) +{ + int i; + for (i = 0; i < num; i++) + free(vals[i].name.av_val); + free(vals); +} + + +#ifdef CRYPTO +static int +b64enc(const unsigned char *input, int length, char *output, int maxsize) +{ +#ifdef USE_POLARSSL + size_t buf_size = maxsize; + if(base64_encode((unsigned char *) output, &buf_size, input, length) == 0) + { + output[buf_size] = '\0'; + return 1; + } + else + { + RTMP_Log(RTMP_LOGDEBUG, "%s, error", __FUNCTION__); + return 0; + } +#elif defined(USE_GNUTLS) + if (BASE64_ENCODE_RAW_LENGTH(length) <= maxsize) + base64_encode_raw((uint8_t*) output, length, input); + else + { + RTMP_Log(RTMP_LOGDEBUG, "%s, error", __FUNCTION__); + return 0; + } +#else /* USE_OPENSSL */ + BIO *bmem, *b64; + BUF_MEM *bptr; + + b64 = BIO_new(BIO_f_base64()); + bmem = BIO_new(BIO_s_mem()); + b64 = BIO_push(b64, bmem); + BIO_write(b64, input, length); + if (BIO_flush(b64) == 1) + { + BIO_get_mem_ptr(b64, &bptr); + memcpy(output, bptr->data, bptr->length-1); + output[bptr->length-1] = '\0'; + } + else + { + RTMP_Log(RTMP_LOGDEBUG, "%s, error", __FUNCTION__); + return 0; + } + BIO_free_all(b64); +#endif + return 1; +} + +#ifdef USE_POLARSSL +#define MD5_CTX md5_context +#define MD5_Init(ctx) md5_starts(ctx) +#define MD5_Update(ctx,data,len) md5_update(ctx,(unsigned char *)data,len) +#define MD5_Final(dig,ctx) md5_finish(ctx,dig) +#elif defined(USE_GNUTLS) +typedef struct md5_ctx MD5_CTX; +#define MD5_Init(ctx) md5_init(ctx) +#define MD5_Update(ctx,data,len) md5_update(ctx,len,data) +#define MD5_Final(dig,ctx) md5_digest(ctx,MD5_DIGEST_LENGTH,dig) +#else +#endif + +static const AVal av_authmod_adobe = AVC("authmod=adobe"); +static const AVal av_authmod_llnw = AVC("authmod=llnw"); + +static void hexenc(unsigned char *inbuf, int len, char *dst) +{ + char *ptr = dst; + while(len--) { + sprintf(ptr, "%02x", *inbuf++); + ptr += 2; + } + *ptr = '\0'; +} + +static char * +AValChr(AVal *av, char c) +{ + int i; + for (i = 0; i < av->av_len; i++) + if (av->av_val[i] == c) + return &av->av_val[i]; + return NULL; +} + +static int +PublisherAuth(RTMP *r, AVal *description) +{ + char *token_in = NULL; + char *ptr; + unsigned char md5sum_val[MD5_DIGEST_LENGTH+1]; + MD5_CTX md5ctx; + int challenge2_data; +#define RESPONSE_LEN 32 +#define CHALLENGE2_LEN 16 +#define SALTED2_LEN (32+8+8+8) +#define B64DIGEST_LEN 24 /* 16 byte digest => 22 b64 chars + 2 chars padding */ +#define B64INT_LEN 8 /* 4 byte int => 6 b64 chars + 2 chars padding */ +#define HEXHASH_LEN (2*MD5_DIGEST_LENGTH) + char response[RESPONSE_LEN]; + char challenge2[CHALLENGE2_LEN]; + char salted2[SALTED2_LEN]; + AVal pubToken; + + if (strstr(description->av_val, av_authmod_adobe.av_val) != NULL) + { + if(strstr(description->av_val, "code=403 need auth") != NULL) + { + if (strstr(r->Link.app.av_val, av_authmod_adobe.av_val) != NULL) { + RTMP_Log(RTMP_LOGERROR, "%s, wrong pubUser & pubPasswd for publisher auth", __FUNCTION__); + return 0; + } else if(r->Link.pubUser.av_len && r->Link.pubPasswd.av_len) { + pubToken.av_val = malloc(r->Link.pubUser.av_len + av_authmod_adobe.av_len + 8); + pubToken.av_len = sprintf(pubToken.av_val, "?%s&user=%s", + av_authmod_adobe.av_val, + r->Link.pubUser.av_val); + RTMP_Log(RTMP_LOGDEBUG, "%s, pubToken1: %s", __FUNCTION__, pubToken.av_val); + } else { + RTMP_Log(RTMP_LOGERROR, "%s, need to set pubUser & pubPasswd for publisher auth", __FUNCTION__); + return 0; + } + } + else if((token_in = strstr(description->av_val, "?reason=needauth")) != NULL) + { + char *par, *val = NULL, *orig_ptr; + AVal user, salt, opaque, challenge, *aptr = NULL; + opaque.av_len = 0; + challenge.av_len = 0; + + ptr = orig_ptr = strdup(token_in); + while (ptr) + { + par = ptr; + ptr = strchr(par, '&'); + if(ptr) + *ptr++ = '\0'; + + val = strchr(par, '='); + if(val) + *val++ = '\0'; + + if (aptr) { + aptr->av_len = par - aptr->av_val - 1; + aptr = NULL; + } + if (strcmp(par, "user") == 0){ + user.av_val = val; + aptr = &user; + } else if (strcmp(par, "salt") == 0){ + salt.av_val = val; + aptr = &salt; + } else if (strcmp(par, "opaque") == 0){ + opaque.av_val = val; + aptr = &opaque; + } else if (strcmp(par, "challenge") == 0){ + challenge.av_val = val; + aptr = &challenge; + } + + RTMP_Log(RTMP_LOGDEBUG, "%s, par:\"%s\" = val:\"%s\"", __FUNCTION__, par, val); + } + if (aptr) + aptr->av_len = strlen(aptr->av_val); + + /* hash1 = base64enc(md5(user + _aodbeAuthSalt + password)) */ + MD5_Init(&md5ctx); + MD5_Update(&md5ctx, user.av_val, user.av_len); + MD5_Update(&md5ctx, salt.av_val, salt.av_len); + MD5_Update(&md5ctx, r->Link.pubPasswd.av_val, r->Link.pubPasswd.av_len); + MD5_Final(md5sum_val, &md5ctx); + RTMP_Log(RTMP_LOGDEBUG, "%s, md5(%s%s%s) =>", __FUNCTION__, + user.av_val, salt.av_val, r->Link.pubPasswd.av_val); + RTMP_LogHexString(RTMP_LOGDEBUG, md5sum_val, MD5_DIGEST_LENGTH); + + b64enc(md5sum_val, MD5_DIGEST_LENGTH, salted2, SALTED2_LEN); + RTMP_Log(RTMP_LOGDEBUG, "%s, b64(md5_1) = %s", __FUNCTION__, salted2); + + challenge2_data = rand(); + + b64enc((unsigned char *) &challenge2_data, sizeof(int), challenge2, CHALLENGE2_LEN); + RTMP_Log(RTMP_LOGDEBUG, "%s, b64(%d) = %s", __FUNCTION__, challenge2_data, challenge2); + + MD5_Init(&md5ctx); + MD5_Update(&md5ctx, salted2, B64DIGEST_LEN); + /* response = base64enc(md5(hash1 + opaque + challenge2)) */ + if (opaque.av_len) + MD5_Update(&md5ctx, opaque.av_val, opaque.av_len); + else if (challenge.av_len) + MD5_Update(&md5ctx, challenge.av_val, challenge.av_len); + MD5_Update(&md5ctx, challenge2, B64INT_LEN); + MD5_Final(md5sum_val, &md5ctx); + + RTMP_Log(RTMP_LOGDEBUG, "%s, md5(%s%s%s) =>", __FUNCTION__, + salted2, opaque.av_len ? opaque.av_val : "", challenge2); + RTMP_LogHexString(RTMP_LOGDEBUG, md5sum_val, MD5_DIGEST_LENGTH); + + b64enc(md5sum_val, MD5_DIGEST_LENGTH, response, RESPONSE_LEN); + RTMP_Log(RTMP_LOGDEBUG, "%s, b64(md5_2) = %s", __FUNCTION__, response); + + /* have all hashes, create auth token for the end of app */ + pubToken.av_val = malloc(32 + B64INT_LEN + B64DIGEST_LEN + opaque.av_len); + pubToken.av_len = sprintf(pubToken.av_val, + "&challenge=%s&response=%s&opaque=%s", + challenge2, + response, + opaque.av_len ? opaque.av_val : ""); + RTMP_Log(RTMP_LOGDEBUG, "%s, pubToken2: %s", __FUNCTION__, pubToken.av_val); + free(orig_ptr); + } + else if(strstr(description->av_val, "?reason=authfailed") != NULL) + { + RTMP_Log(RTMP_LOGERROR, "%s, Authentication failed: wrong password", __FUNCTION__); + return 0; + } + else if(strstr(description->av_val, "?reason=nosuchuser") != NULL) + { + RTMP_Log(RTMP_LOGERROR, "%s, Authentication failed: no such user", __FUNCTION__); + return 0; + } + else + { + RTMP_Log(RTMP_LOGERROR, "%s, Authentication failed: unknown auth mode: %s", + __FUNCTION__, description->av_val); + return 0; + } + + ptr = malloc(r->Link.app.av_len + pubToken.av_len); + strncpy(ptr, r->Link.app.av_val, r->Link.app.av_len); + strncpy(ptr + r->Link.app.av_len, pubToken.av_val, pubToken.av_len); + r->Link.app.av_len += pubToken.av_len; + if(r->Link.lFlags & RTMP_LF_FAPU) + free(r->Link.app.av_val); + r->Link.app.av_val = ptr; + + ptr = malloc(r->Link.tcUrl.av_len + pubToken.av_len); + strncpy(ptr, r->Link.tcUrl.av_val, r->Link.tcUrl.av_len); + strncpy(ptr + r->Link.tcUrl.av_len, pubToken.av_val, pubToken.av_len); + r->Link.tcUrl.av_len += pubToken.av_len; + if(r->Link.lFlags & RTMP_LF_FTCU) + free(r->Link.tcUrl.av_val); + r->Link.tcUrl.av_val = ptr; + + free(pubToken.av_val); + r->Link.lFlags |= RTMP_LF_FTCU | RTMP_LF_FAPU; + + RTMP_Log(RTMP_LOGDEBUG, "%s, new app: %.*s tcUrl: %.*s playpath: %s", __FUNCTION__, + r->Link.app.av_len, r->Link.app.av_val, + r->Link.tcUrl.av_len, r->Link.tcUrl.av_val, + r->Link.playpath.av_val); + } + else if (strstr(description->av_val, av_authmod_llnw.av_val) != NULL) + { + if(strstr(description->av_val, "code=403 need auth") != NULL) + { + /* This part seems to be the same for llnw and adobe */ + + if (strstr(r->Link.app.av_val, av_authmod_llnw.av_val) != NULL) { + RTMP_Log(RTMP_LOGERROR, "%s, wrong pubUser & pubPasswd for publisher auth", __FUNCTION__); + return 0; + } else if(r->Link.pubUser.av_len && r->Link.pubPasswd.av_len) { + pubToken.av_val = malloc(r->Link.pubUser.av_len + av_authmod_llnw.av_len + 8); + pubToken.av_len = sprintf(pubToken.av_val, "?%s&user=%s", + av_authmod_llnw.av_val, + r->Link.pubUser.av_val); + RTMP_Log(RTMP_LOGDEBUG, "%s, pubToken1: %s", __FUNCTION__, pubToken.av_val); + } else { + RTMP_Log(RTMP_LOGERROR, "%s, need to set pubUser & pubPasswd for publisher auth", __FUNCTION__); + return 0; + } + } + else if((token_in = strstr(description->av_val, "?reason=needauth")) != NULL) + { + char *orig_ptr; + char *par, *val = NULL; + char hash1[HEXHASH_LEN+1], hash2[HEXHASH_LEN+1], hash3[HEXHASH_LEN+1]; + AVal user, nonce, *aptr = NULL; + AVal apptmp; + + /* llnw auth method + * Seems to be closely based on HTTP Digest Auth: + * http://tools.ietf.org/html/rfc2617 + * http://en.wikipedia.org/wiki/Digest_access_authentication + */ + + const char authmod[] = "llnw"; + const char realm[] = "live"; + const char method[] = "publish"; + const char qop[] = "auth"; + /* nc = 1..connection count (or rather, number of times cnonce has been reused) */ + int nc = 1; + /* nchex = hexenc(nc) (8 hex digits according to RFC 2617) */ + char nchex[9]; + /* cnonce = hexenc(4 random bytes) (initialized on first connection) */ + char cnonce[9]; + + ptr = orig_ptr = strdup(token_in); + /* Extract parameters (we need user and nonce) */ + while (ptr) + { + par = ptr; + ptr = strchr(par, '&'); + if(ptr) + *ptr++ = '\0'; + + val = strchr(par, '='); + if(val) + *val++ = '\0'; + + if (aptr) { + aptr->av_len = par - aptr->av_val - 1; + aptr = NULL; + } + if (strcmp(par, "user") == 0){ + user.av_val = val; + aptr = &user; + } else if (strcmp(par, "nonce") == 0){ + nonce.av_val = val; + aptr = &nonce; + } + + RTMP_Log(RTMP_LOGDEBUG, "%s, par:\"%s\" = val:\"%s\"", __FUNCTION__, par, val); + } + if (aptr) + aptr->av_len = strlen(aptr->av_val); + + /* FIXME: handle case where user==NULL or nonce==NULL */ + + sprintf(nchex, "%08x", nc); + sprintf(cnonce, "%08x", rand()); + + /* hash1 = hexenc(md5(user + ":" + realm + ":" + password)) */ + MD5_Init(&md5ctx); + MD5_Update(&md5ctx, user.av_val, user.av_len); + MD5_Update(&md5ctx, ":", 1); + MD5_Update(&md5ctx, realm, sizeof(realm)-1); + MD5_Update(&md5ctx, ":", 1); + MD5_Update(&md5ctx, r->Link.pubPasswd.av_val, r->Link.pubPasswd.av_len); + MD5_Final(md5sum_val, &md5ctx); + RTMP_Log(RTMP_LOGDEBUG, "%s, md5(%s:%s:%s) =>", __FUNCTION__, + user.av_val, realm, r->Link.pubPasswd.av_val); + RTMP_LogHexString(RTMP_LOGDEBUG, md5sum_val, MD5_DIGEST_LENGTH); + hexenc(md5sum_val, MD5_DIGEST_LENGTH, hash1); + + /* hash2 = hexenc(md5(method + ":/" + app + "/" + appInstance)) */ + /* Extract appname + appinstance without query parameters */ + apptmp = r->Link.app; + ptr = AValChr(&apptmp, '?'); + if (ptr) + apptmp.av_len = ptr - apptmp.av_val; + + MD5_Init(&md5ctx); + MD5_Update(&md5ctx, method, sizeof(method)-1); + MD5_Update(&md5ctx, ":/", 2); + MD5_Update(&md5ctx, apptmp.av_val, apptmp.av_len); + if (!AValChr(&apptmp, '/')) + MD5_Update(&md5ctx, "/_definst_", sizeof("/_definst_") - 1); + MD5_Final(md5sum_val, &md5ctx); + RTMP_Log(RTMP_LOGDEBUG, "%s, md5(%s:/%.*s) =>", __FUNCTION__, + method, apptmp.av_len, apptmp.av_val); + RTMP_LogHexString(RTMP_LOGDEBUG, md5sum_val, MD5_DIGEST_LENGTH); + hexenc(md5sum_val, MD5_DIGEST_LENGTH, hash2); + + /* hash3 = hexenc(md5(hash1 + ":" + nonce + ":" + nchex + ":" + cnonce + ":" + qop + ":" + hash2)) */ + MD5_Init(&md5ctx); + MD5_Update(&md5ctx, hash1, HEXHASH_LEN); + MD5_Update(&md5ctx, ":", 1); + MD5_Update(&md5ctx, nonce.av_val, nonce.av_len); + MD5_Update(&md5ctx, ":", 1); + MD5_Update(&md5ctx, nchex, sizeof(nchex)-1); + MD5_Update(&md5ctx, ":", 1); + MD5_Update(&md5ctx, cnonce, sizeof(cnonce)-1); + MD5_Update(&md5ctx, ":", 1); + MD5_Update(&md5ctx, qop, sizeof(qop)-1); + MD5_Update(&md5ctx, ":", 1); + MD5_Update(&md5ctx, hash2, HEXHASH_LEN); + MD5_Final(md5sum_val, &md5ctx); + RTMP_Log(RTMP_LOGDEBUG, "%s, md5(%s:%s:%s:%s:%s:%s) =>", __FUNCTION__, + hash1, nonce.av_val, nchex, cnonce, qop, hash2); + RTMP_LogHexString(RTMP_LOGDEBUG, md5sum_val, MD5_DIGEST_LENGTH); + hexenc(md5sum_val, MD5_DIGEST_LENGTH, hash3); + + /* pubToken = &authmod=&user=&nonce=&cnonce=&nc=&response= */ + /* Append nonces and response to query string which already contains + * user + authmod */ + pubToken.av_val = malloc(64 + sizeof(authmod)-1 + user.av_len + nonce.av_len + sizeof(cnonce)-1 + sizeof(nchex)-1 + HEXHASH_LEN); + sprintf(pubToken.av_val, + "&nonce=%s&cnonce=%s&nc=%s&response=%s", + nonce.av_val, cnonce, nchex, hash3); + pubToken.av_len = strlen(pubToken.av_val); + RTMP_Log(RTMP_LOGDEBUG, "%s, pubToken2: %s", __FUNCTION__, pubToken.av_val); + + free(orig_ptr); + } + else if(strstr(description->av_val, "?reason=authfail") != NULL) + { + RTMP_Log(RTMP_LOGERROR, "%s, Authentication failed", __FUNCTION__); + return 0; + } + else if(strstr(description->av_val, "?reason=nosuchuser") != NULL) + { + RTMP_Log(RTMP_LOGERROR, "%s, Authentication failed: no such user", __FUNCTION__); + return 0; + } + else + { + RTMP_Log(RTMP_LOGERROR, "%s, Authentication failed: unknown auth mode: %s", + __FUNCTION__, description->av_val); + return 0; + } + + ptr = malloc(r->Link.app.av_len + pubToken.av_len); + strncpy(ptr, r->Link.app.av_val, r->Link.app.av_len); + strncpy(ptr + r->Link.app.av_len, pubToken.av_val, pubToken.av_len); + r->Link.app.av_len += pubToken.av_len; + if(r->Link.lFlags & RTMP_LF_FAPU) + free(r->Link.app.av_val); + r->Link.app.av_val = ptr; + + ptr = malloc(r->Link.tcUrl.av_len + pubToken.av_len); + strncpy(ptr, r->Link.tcUrl.av_val, r->Link.tcUrl.av_len); + strncpy(ptr + r->Link.tcUrl.av_len, pubToken.av_val, pubToken.av_len); + r->Link.tcUrl.av_len += pubToken.av_len; + if(r->Link.lFlags & RTMP_LF_FTCU) + free(r->Link.tcUrl.av_val); + r->Link.tcUrl.av_val = ptr; + + free(pubToken.av_val); + r->Link.lFlags |= RTMP_LF_FTCU | RTMP_LF_FAPU; + + RTMP_Log(RTMP_LOGDEBUG, "%s, new app: %.*s tcUrl: %.*s playpath: %s", __FUNCTION__, + r->Link.app.av_len, r->Link.app.av_val, + r->Link.tcUrl.av_len, r->Link.tcUrl.av_val, + r->Link.playpath.av_val); + } + else + { + return 0; + } + return 1; +} +#endif + + +SAVC(onBWDone); +SAVC(onFCSubscribe); +SAVC(onFCUnsubscribe); +SAVC(_onbwcheck); +SAVC(_onbwdone); +SAVC(_error); +SAVC(close); +SAVC(code); +SAVC(level); +SAVC(description); +SAVC(onStatus); +SAVC(playlist_ready); +static const AVal av_NetStream_Failed = AVC("NetStream.Failed"); +static const AVal av_NetStream_Play_Failed = AVC("NetStream.Play.Failed"); +static const AVal av_NetStream_Play_StreamNotFound = +AVC("NetStream.Play.StreamNotFound"); +static const AVal av_NetConnection_Connect_InvalidApp = +AVC("NetConnection.Connect.InvalidApp"); +static const AVal av_NetStream_Play_Start = AVC("NetStream.Play.Start"); +static const AVal av_NetStream_Play_Complete = AVC("NetStream.Play.Complete"); +static const AVal av_NetStream_Play_Stop = AVC("NetStream.Play.Stop"); +static const AVal av_NetStream_Seek_Notify = AVC("NetStream.Seek.Notify"); +static const AVal av_NetStream_Pause_Notify = AVC("NetStream.Pause.Notify"); +static const AVal av_NetStream_Play_PublishNotify = +AVC("NetStream.Play.PublishNotify"); +static const AVal av_NetStream_Play_UnpublishNotify = +AVC("NetStream.Play.UnpublishNotify"); +static const AVal av_NetStream_Publish_Start = AVC("NetStream.Publish.Start"); + +/* Returns 0 for OK/Failed/error, 1 for 'Stop or Complete' */ +static int +HandleInvoke(RTMP *r, const char *body, unsigned int nBodySize) +{ + AMFObject obj; + AVal method; + double txn; + int ret = 0, nRes; + if (body[0] != 0x02) /* make sure it is a string method name we start with */ + { + RTMP_Log(RTMP_LOGWARNING, "%s, Sanity failed. no string method in invoke packet", + __FUNCTION__); + return 0; + } + + nRes = AMF_Decode(&obj, body, nBodySize, FALSE); + if (nRes < 0) + { + RTMP_Log(RTMP_LOGERROR, "%s, error decoding invoke packet", __FUNCTION__); + return 0; + } + + AMF_Dump(&obj); + AMFProp_GetString(AMF_GetProp(&obj, NULL, 0), &method); + txn = AMFProp_GetNumber(AMF_GetProp(&obj, NULL, 1)); + RTMP_Log(RTMP_LOGDEBUG, "%s, server invoking <%s>", __FUNCTION__, method.av_val); + + if (AVMATCH(&method, &av__result)) + { + AVal methodInvoked = {0}; + int i; + + for (i=0; im_numCalls; i++) { + if (r->m_methodCalls[i].num == (int)txn) { + methodInvoked = r->m_methodCalls[i].name; + AV_erase(r->m_methodCalls, &r->m_numCalls, i, FALSE); + break; + } + } + if (!methodInvoked.av_val) { + RTMP_Log(RTMP_LOGDEBUG, "%s, received result id %f without matching request", + __FUNCTION__, txn); + goto leave; + } + + RTMP_Log(RTMP_LOGDEBUG, "%s, received result for method call <%s>", __FUNCTION__, + methodInvoked.av_val); + + if (AVMATCH(&methodInvoked, &av_connect)) + { + if (r->Link.token.av_len) + { + AMFObjectProperty p; + if (RTMP_FindFirstMatchingProperty(&obj, &av_secureToken, &p)) + { + DecodeTEA(&r->Link.token, &p.p_vu.p_aval); + SendSecureTokenResponse(r, &p.p_vu.p_aval); + } + } + if (r->Link.protocol & RTMP_FEATURE_WRITE) + { + SendReleaseStream(r); + SendFCPublish(r); + } + else + { + RTMP_SendServerBW(r); + RTMP_SendCtrl(r, 3, 0, 300); + } + RTMP_SendCreateStream(r); + + if (!(r->Link.protocol & RTMP_FEATURE_WRITE)) + { + /* Authenticate on Justin.tv legacy servers before sending FCSubscribe */ + if (r->Link.usherToken.av_len) + SendUsherToken(r, &r->Link.usherToken); + /* Send the FCSubscribe if live stream or if subscribepath is set */ + if (r->Link.subscribepath.av_len) + SendFCSubscribe(r, &r->Link.subscribepath); + else if (r->Link.lFlags & RTMP_LF_LIVE) + SendFCSubscribe(r, &r->Link.playpath); + } + } + else if (AVMATCH(&methodInvoked, &av_createStream)) + { + r->m_stream_id = (int)AMFProp_GetNumber(AMF_GetProp(&obj, NULL, 3)); + + if (r->Link.protocol & RTMP_FEATURE_WRITE) + { + SendPublish(r); + } + else + { + if (r->Link.lFlags & RTMP_LF_PLST) + SendPlaylist(r); + SendPlay(r); + RTMP_SendCtrl(r, 3, r->m_stream_id, r->m_nBufferMS); + } + } + else if (AVMATCH(&methodInvoked, &av_play) || + AVMATCH(&methodInvoked, &av_publish)) + { + r->m_bPlaying = TRUE; + } + free(methodInvoked.av_val); + } + else if (AVMATCH(&method, &av_onBWDone)) + { + if (!r->m_nBWCheckCounter) + SendCheckBW(r); + } + else if (AVMATCH(&method, &av_onFCSubscribe)) + { + /* SendOnFCSubscribe(); */ + } + else if (AVMATCH(&method, &av_onFCUnsubscribe)) + { + RTMP_Close(r); + ret = 1; + } + else if (AVMATCH(&method, &av_ping)) + { + SendPong(r, txn); + } + else if (AVMATCH(&method, &av__onbwcheck)) + { + SendCheckBWResult(r, txn); + } + else if (AVMATCH(&method, &av__onbwdone)) + { + int i; + for (i = 0; i < r->m_numCalls; i++) + if (AVMATCH(&r->m_methodCalls[i].name, &av__checkbw)) + { + AV_erase(r->m_methodCalls, &r->m_numCalls, i, TRUE); + break; + } + } + else if (AVMATCH(&method, &av__error)) + { +#ifdef CRYPTO + AVal methodInvoked = {0}; + int i; + + if (r->Link.protocol & RTMP_FEATURE_WRITE) + { + for (i=0; im_numCalls; i++) + { + if (r->m_methodCalls[i].num == txn) + { + methodInvoked = r->m_methodCalls[i].name; + AV_erase(r->m_methodCalls, &r->m_numCalls, i, FALSE); + break; + } + } + if (!methodInvoked.av_val) + { + RTMP_Log(RTMP_LOGDEBUG, "%s, received result id %f without matching request", + __FUNCTION__, txn); + goto leave; + } + + RTMP_Log(RTMP_LOGDEBUG, "%s, received error for method call <%s>", __FUNCTION__, + methodInvoked.av_val); + + if (AVMATCH(&methodInvoked, &av_connect)) + { + AMFObject obj2; + AVal code, level, description; + AMFProp_GetObject(AMF_GetProp(&obj, NULL, 3), &obj2); + AMFProp_GetString(AMF_GetProp(&obj2, &av_code, -1), &code); + AMFProp_GetString(AMF_GetProp(&obj2, &av_level, -1), &level); + AMFProp_GetString(AMF_GetProp(&obj2, &av_description, -1), &description); + RTMP_Log(RTMP_LOGDEBUG, "%s, error description: %s", __FUNCTION__, description.av_val); + /* if PublisherAuth returns 1, then reconnect */ + if (PublisherAuth(r, &description) == 1) + { + CloseInternal(r, 1); + if (!RTMP_Connect(r, NULL) || !RTMP_ConnectStream(r, 0)) + goto leave; + } + } + } + else + { + RTMP_Log(RTMP_LOGERROR, "rtmp server sent error"); + } + free(methodInvoked.av_val); +#else + RTMP_Log(RTMP_LOGERROR, "rtmp server sent error"); +#endif + } + else if (AVMATCH(&method, &av_close)) + { + RTMP_Log(RTMP_LOGERROR, "rtmp server requested close"); + RTMP_Close(r); + } + else if (AVMATCH(&method, &av_onStatus)) + { + AMFObject obj2; + AVal code, level; + AMFProp_GetObject(AMF_GetProp(&obj, NULL, 3), &obj2); + AMFProp_GetString(AMF_GetProp(&obj2, &av_code, -1), &code); + AMFProp_GetString(AMF_GetProp(&obj2, &av_level, -1), &level); + + RTMP_Log(RTMP_LOGDEBUG, "%s, onStatus: %s", __FUNCTION__, code.av_val); + if (AVMATCH(&code, &av_NetStream_Failed) + || AVMATCH(&code, &av_NetStream_Play_Failed) + || AVMATCH(&code, &av_NetStream_Play_StreamNotFound) + || AVMATCH(&code, &av_NetConnection_Connect_InvalidApp)) + { + r->m_stream_id = -1; + RTMP_Close(r); + RTMP_Log(RTMP_LOGERROR, "Closing connection: %s", code.av_val); + } + + else if (AVMATCH(&code, &av_NetStream_Play_Start) + || AVMATCH(&code, &av_NetStream_Play_PublishNotify)) + { + int i; + r->m_bPlaying = TRUE; + for (i = 0; i < r->m_numCalls; i++) + { + if (AVMATCH(&r->m_methodCalls[i].name, &av_play)) + { + AV_erase(r->m_methodCalls, &r->m_numCalls, i, TRUE); + break; + } + } + } + + else if (AVMATCH(&code, &av_NetStream_Publish_Start)) + { + int i; + r->m_bPlaying = TRUE; + for (i = 0; i < r->m_numCalls; i++) + { + if (AVMATCH(&r->m_methodCalls[i].name, &av_publish)) + { + AV_erase(r->m_methodCalls, &r->m_numCalls, i, TRUE); + break; + } + } + } + + /* Return 1 if this is a Play.Complete or Play.Stop */ + else if (AVMATCH(&code, &av_NetStream_Play_Complete) + || AVMATCH(&code, &av_NetStream_Play_Stop) + || AVMATCH(&code, &av_NetStream_Play_UnpublishNotify)) + { + RTMP_Close(r); + ret = 1; + } + + else if (AVMATCH(&code, &av_NetStream_Seek_Notify)) + { + r->m_read.flags &= ~RTMP_READ_SEEKING; + } + + else if (AVMATCH(&code, &av_NetStream_Pause_Notify)) + { + if (r->m_pausing == 1 || r->m_pausing == 2) + { + RTMP_SendPause(r, FALSE, r->m_pauseStamp); + r->m_pausing = 3; + } + } + } + else if (AVMATCH(&method, &av_playlist_ready)) + { + int i; + for (i = 0; i < r->m_numCalls; i++) + { + if (AVMATCH(&r->m_methodCalls[i].name, &av_set_playlist)) + { + AV_erase(r->m_methodCalls, &r->m_numCalls, i, TRUE); + break; + } + } + } + else + { + + } +leave: + AMF_Reset(&obj); + return ret; +} + +int +RTMP_FindFirstMatchingProperty(AMFObject *obj, const AVal *name, + AMFObjectProperty * p) +{ + int n; + /* this is a small object search to locate the "duration" property */ + for (n = 0; n < obj->o_num; n++) + { + AMFObjectProperty *prop = AMF_GetProp(obj, NULL, n); + + if (AVMATCH(&prop->p_name, name)) + { + memcpy(p, prop, sizeof(*prop)); + return TRUE; + } + + if (prop->p_type == AMF_OBJECT || prop->p_type == AMF_ECMA_ARRAY) + { + if (RTMP_FindFirstMatchingProperty(&prop->p_vu.p_object, name, p)) + return TRUE; + } + } + return FALSE; +} + +/* Like above, but only check if name is a prefix of property */ +int +RTMP_FindPrefixProperty(AMFObject *obj, const AVal *name, + AMFObjectProperty * p) +{ + int n; + for (n = 0; n < obj->o_num; n++) + { + AMFObjectProperty *prop = AMF_GetProp(obj, NULL, n); + + if (prop->p_name.av_len > name->av_len && + !memcmp(prop->p_name.av_val, name->av_val, name->av_len)) + { + memcpy(p, prop, sizeof(*prop)); + return TRUE; + } + + if (prop->p_type == AMF_OBJECT) + { + if (RTMP_FindPrefixProperty(&prop->p_vu.p_object, name, p)) + return TRUE; + } + } + return FALSE; +} + +static int +DumpMetaData(AMFObject *obj) +{ + AMFObjectProperty *prop; + int n, len; + for (n = 0; n < obj->o_num; n++) + { + char str[256] = ""; + prop = AMF_GetProp(obj, NULL, n); + switch (prop->p_type) + { + case AMF_OBJECT: + case AMF_ECMA_ARRAY: + case AMF_STRICT_ARRAY: + if (prop->p_name.av_len) + RTMP_Log(RTMP_LOGINFO, "%.*s:", prop->p_name.av_len, prop->p_name.av_val); + DumpMetaData(&prop->p_vu.p_object); + break; + case AMF_NUMBER: + snprintf(str, 255, "%.2f", prop->p_vu.p_number); + break; + case AMF_BOOLEAN: + snprintf(str, 255, "%s", + prop->p_vu.p_number != 0. ? "TRUE" : "FALSE"); + break; + case AMF_STRING: + len = snprintf(str, 255, "%.*s", prop->p_vu.p_aval.av_len, + prop->p_vu.p_aval.av_val); + if (len >= 1 && str[len-1] == '\n') + str[len-1] = '\0'; + break; + case AMF_DATE: + snprintf(str, 255, "timestamp:%.2f", prop->p_vu.p_number); + break; + default: + snprintf(str, 255, "INVALID TYPE 0x%02x", + (unsigned char)prop->p_type); + } + if (str[0] && prop->p_name.av_len) + { + RTMP_Log(RTMP_LOGINFO, " %-22.*s%s", prop->p_name.av_len, + prop->p_name.av_val, str); + } + } + return FALSE; +} + +SAVC(onMetaData); +SAVC(duration); +SAVC(video); +SAVC(audio); + +static int +HandleMetadata(RTMP *r, char *body, unsigned int len) +{ + /* allright we get some info here, so parse it and print it */ + /* also keep duration or filesize to make a nice progress bar */ + + AMFObject obj; + AVal metastring; + int ret = FALSE; + + int nRes = AMF_Decode(&obj, body, len, FALSE); + if (nRes < 0) + { + RTMP_Log(RTMP_LOGERROR, "%s, error decoding meta data packet", __FUNCTION__); + return FALSE; + } + + AMF_Dump(&obj); + AMFProp_GetString(AMF_GetProp(&obj, NULL, 0), &metastring); + + if (AVMATCH(&metastring, &av_onMetaData)) + { + AMFObjectProperty prop; + /* Show metadata */ + RTMP_Log(RTMP_LOGINFO, "Metadata:"); + DumpMetaData(&obj); + if (RTMP_FindFirstMatchingProperty(&obj, &av_duration, &prop)) + { + r->m_fDuration = prop.p_vu.p_number; + /*RTMP_Log(RTMP_LOGDEBUG, "Set duration: %.2f", m_fDuration); */ + } + /* Search for audio or video tags */ + if (RTMP_FindPrefixProperty(&obj, &av_video, &prop)) + r->m_read.dataType |= 1; + if (RTMP_FindPrefixProperty(&obj, &av_audio, &prop)) + r->m_read.dataType |= 4; + ret = TRUE; + } + AMF_Reset(&obj); + return ret; +} + +void +HandleChangeChunkSize(RTMP *r, const RTMPPacket *packet) +{ + if (packet->m_nBodySize >= 4) + { + r->m_inChunkSize = AMF_DecodeInt32(packet->m_body); + RTMP_Log(RTMP_LOGDEBUG, "%s, received: chunk size change to %d", __FUNCTION__, + r->m_inChunkSize); + } +} + +static void +HandleAudio(RTMP *r, const RTMPPacket *packet) +{ +} + +static void +HandleVideo(RTMP *r, const RTMPPacket *packet) +{ +} + +static void +HandleCtrl(RTMP *r, const RTMPPacket *packet) +{ + short nType = -1; + unsigned int tmp; + if (packet->m_body && packet->m_nBodySize >= 2) + nType = AMF_DecodeInt16(packet->m_body); + RTMP_Log(RTMP_LOGDEBUG, "%s, received ctrl. type: %d, len: %d", __FUNCTION__, nType, + packet->m_nBodySize); + /*RTMP_LogHex(packet.m_body, packet.m_nBodySize); */ + + if (packet->m_nBodySize >= 6) + { + switch (nType) + { + case 0: + tmp = AMF_DecodeInt32(packet->m_body + 2); + RTMP_Log(RTMP_LOGDEBUG, "%s, Stream Begin %d", __FUNCTION__, tmp); + break; + + case 1: + tmp = AMF_DecodeInt32(packet->m_body + 2); + RTMP_Log(RTMP_LOGDEBUG, "%s, Stream EOF %d", __FUNCTION__, tmp); + if (r->m_pausing == 1) + r->m_pausing = 2; + break; + + case 2: + tmp = AMF_DecodeInt32(packet->m_body + 2); + RTMP_Log(RTMP_LOGDEBUG, "%s, Stream Dry %d", __FUNCTION__, tmp); + break; + + case 4: + tmp = AMF_DecodeInt32(packet->m_body + 2); + RTMP_Log(RTMP_LOGDEBUG, "%s, Stream IsRecorded %d", __FUNCTION__, tmp); + break; + + case 6: /* server ping. reply with pong. */ + tmp = AMF_DecodeInt32(packet->m_body + 2); + RTMP_Log(RTMP_LOGDEBUG, "%s, Ping %d", __FUNCTION__, tmp); + RTMP_SendCtrl(r, 0x07, tmp, 0); + break; + + /* FMS 3.5 servers send the following two controls to let the client + * know when the server has sent a complete buffer. I.e., when the + * server has sent an amount of data equal to m_nBufferMS in duration. + * The server meters its output so that data arrives at the client + * in realtime and no faster. + * + * The rtmpdump program tries to set m_nBufferMS as large as + * possible, to force the server to send data as fast as possible. + * In practice, the server appears to cap this at about 1 hour's + * worth of data. After the server has sent a complete buffer, and + * sends this BufferEmpty message, it will wait until the play + * duration of that buffer has passed before sending a new buffer. + * The BufferReady message will be sent when the new buffer starts. + * (There is no BufferReady message for the very first buffer; + * presumably the Stream Begin message is sufficient for that + * purpose.) + * + * If the network speed is much faster than the data bitrate, then + * there may be long delays between the end of one buffer and the + * start of the next. + * + * Since usually the network allows data to be sent at + * faster than realtime, and rtmpdump wants to download the data + * as fast as possible, we use this RTMP_LF_BUFX hack: when we + * get the BufferEmpty message, we send a Pause followed by an + * Unpause. This causes the server to send the next buffer immediately + * instead of waiting for the full duration to elapse. (That's + * also the purpose of the ToggleStream function, which rtmpdump + * calls if we get a read timeout.) + * + * Media player apps don't need this hack since they are just + * going to play the data in realtime anyway. It also doesn't work + * for live streams since they obviously can only be sent in + * realtime. And it's all moot if the network speed is actually + * slower than the media bitrate. + */ + case 31: + tmp = AMF_DecodeInt32(packet->m_body + 2); + RTMP_Log(RTMP_LOGDEBUG, "%s, Stream BufferEmpty %d", __FUNCTION__, tmp); + if (!(r->Link.lFlags & RTMP_LF_BUFX)) + break; + if (!r->m_pausing) + { + r->m_pauseStamp = r->m_mediaChannel < r->m_channelsAllocatedIn ? + r->m_channelTimestamp[r->m_mediaChannel] : 0; + RTMP_SendPause(r, TRUE, r->m_pauseStamp); + r->m_pausing = 1; + } + else if (r->m_pausing == 2) + { + RTMP_SendPause(r, FALSE, r->m_pauseStamp); + r->m_pausing = 3; + } + break; + + case 32: + tmp = AMF_DecodeInt32(packet->m_body + 2); + RTMP_Log(RTMP_LOGDEBUG, "%s, Stream BufferReady %d", __FUNCTION__, tmp); + break; + + default: + tmp = AMF_DecodeInt32(packet->m_body + 2); + RTMP_Log(RTMP_LOGDEBUG, "%s, Stream xx %d", __FUNCTION__, tmp); + break; + } + + } + + if (nType == 0x1A) + { + RTMP_Log(RTMP_LOGDEBUG, "%s, SWFVerification ping received: ", __FUNCTION__); + if (packet->m_nBodySize > 2 && packet->m_body[2] > 0x01) + { + RTMP_Log(RTMP_LOGERROR, + "%s: SWFVerification Type %d request not supported! Patches welcome...", + __FUNCTION__, packet->m_body[2]); + } +#ifdef CRYPTO + /*RTMP_LogHex(packet.m_body, packet.m_nBodySize); */ + + /* respond with HMAC SHA256 of decompressed SWF, key is the 30byte player key, also the last 30 bytes of the server handshake are applied */ + else if (r->Link.SWFSize) + { + RTMP_SendCtrl(r, 0x1B, 0, 0); + } + else + { + RTMP_Log(RTMP_LOGERROR, + "%s: Ignoring SWFVerification request, use --swfVfy!", + __FUNCTION__); + } +#else + RTMP_Log(RTMP_LOGERROR, + "%s: Ignoring SWFVerification request, no CRYPTO support!", + __FUNCTION__); +#endif + } +} + +static void +HandleServerBW(RTMP *r, const RTMPPacket *packet) +{ + r->m_nServerBW = AMF_DecodeInt32(packet->m_body); + RTMP_Log(RTMP_LOGDEBUG, "%s: server BW = %d", __FUNCTION__, r->m_nServerBW); +} + +static void +HandleClientBW(RTMP *r, const RTMPPacket *packet) +{ + r->m_nClientBW = AMF_DecodeInt32(packet->m_body); + if (packet->m_nBodySize > 4) + r->m_nClientBW2 = packet->m_body[4]; + else + r->m_nClientBW2 = -1; + RTMP_Log(RTMP_LOGDEBUG, "%s: client BW = %d %d", __FUNCTION__, r->m_nClientBW, + r->m_nClientBW2); +} + +static int +DecodeInt32LE(const char *data) +{ + unsigned char *c = (unsigned char *)data; + unsigned int val; + + val = (c[3] << 24) | (c[2] << 16) | (c[1] << 8) | c[0]; + return val; +} + +static int +EncodeInt32LE(char *output, int nVal) +{ + output[0] = nVal; + nVal >>= 8; + output[1] = nVal; + nVal >>= 8; + output[2] = nVal; + nVal >>= 8; + output[3] = nVal; + return 4; +} + +int +RTMP_ReadPacket(RTMP *r, RTMPPacket *packet) +{ + uint8_t hbuf[RTMP_MAX_HEADER_SIZE] = { 0 }; + char *header = (char *)hbuf; + int nSize, hSize, nToRead, nChunk; + int extendedTimestamp; + + RTMP_Log(RTMP_LOGDEBUG2, "%s: fd=%d", __FUNCTION__, r->m_sb.sb_socket); + + if (ReadN(r, (char *)hbuf, 1) == 0) + { + RTMP_Log(RTMP_LOGERROR, "%s, failed to read RTMP packet header", __FUNCTION__); + return FALSE; + } + + packet->m_headerType = (hbuf[0] & 0xc0) >> 6; + packet->m_nChannel = (hbuf[0] & 0x3f); + header++; + if (packet->m_nChannel == 0) + { + if (ReadN(r, (char *)&hbuf[1], 1) != 1) + { + RTMP_Log(RTMP_LOGERROR, "%s, failed to read RTMP packet header 2nd byte", + __FUNCTION__); + return FALSE; + } + packet->m_nChannel = hbuf[1]; + packet->m_nChannel += 64; + header++; + } + else if (packet->m_nChannel == 1) + { + int tmp; + if (ReadN(r, (char *)&hbuf[1], 2) != 2) + { + RTMP_Log(RTMP_LOGERROR, "%s, failed to read RTMP packet header 3nd byte", + __FUNCTION__); + return FALSE; + } + tmp = (hbuf[2] << 8) + hbuf[1]; + packet->m_nChannel = tmp + 64; + RTMP_Log(RTMP_LOGDEBUG, "%s, m_nChannel: %0x", __FUNCTION__, packet->m_nChannel); + header += 2; + } + + nSize = packetSize[packet->m_headerType]; + + if (packet->m_nChannel >= r->m_channelsAllocatedIn) + { + int n = packet->m_nChannel + 10; + int *timestamp = realloc(r->m_channelTimestamp, sizeof(int) * n); + RTMPPacket **packets = realloc(r->m_vecChannelsIn, sizeof(RTMPPacket*) * n); + if (!timestamp) + free(r->m_channelTimestamp); + if (!packets) + free(r->m_vecChannelsIn); + r->m_channelTimestamp = timestamp; + r->m_vecChannelsIn = packets; + if (!timestamp || !packets) { + r->m_channelsAllocatedIn = 0; + return FALSE; + } + memset(r->m_channelTimestamp + r->m_channelsAllocatedIn, 0, sizeof(int) * (n - r->m_channelsAllocatedIn)); + memset(r->m_vecChannelsIn + r->m_channelsAllocatedIn, 0, sizeof(RTMPPacket*) * (n - r->m_channelsAllocatedIn)); + r->m_channelsAllocatedIn = n; + } + + if (nSize == RTMP_LARGE_HEADER_SIZE) /* if we get a full header the timestamp is absolute */ + packet->m_hasAbsTimestamp = TRUE; + + else if (nSize < RTMP_LARGE_HEADER_SIZE) + { /* using values from the last message of this channel */ + if (r->m_vecChannelsIn[packet->m_nChannel]) + memcpy(packet, r->m_vecChannelsIn[packet->m_nChannel], + sizeof(RTMPPacket)); + } + + nSize--; + + if (nSize > 0 && ReadN(r, header, nSize) != nSize) + { + RTMP_Log(RTMP_LOGERROR, "%s, failed to read RTMP packet header. type: %x", + __FUNCTION__, (unsigned int)hbuf[0]); + return FALSE; + } + + hSize = nSize + (header - (char *)hbuf); + + if (nSize >= 3) + { + packet->m_nTimeStamp = AMF_DecodeInt24(header); + + /*RTMP_Log(RTMP_LOGDEBUG, "%s, reading RTMP packet chunk on channel %x, headersz %i, timestamp %i, abs timestamp %i", __FUNCTION__, packet.m_nChannel, nSize, packet.m_nTimeStamp, packet.m_hasAbsTimestamp); */ + + if (nSize >= 6) + { + packet->m_nBodySize = AMF_DecodeInt24(header + 3); + packet->m_nBytesRead = 0; + + if (nSize > 6) + { + packet->m_packetType = header[6]; + + if (nSize == 11) + packet->m_nInfoField2 = DecodeInt32LE(header + 7); + } + } + } + + extendedTimestamp = packet->m_nTimeStamp == 0xffffff; + if (extendedTimestamp) + { + if (ReadN(r, header + nSize, 4) != 4) + { + RTMP_Log(RTMP_LOGERROR, "%s, failed to read extended timestamp", + __FUNCTION__); + return FALSE; + } + packet->m_nTimeStamp = AMF_DecodeInt32(header + nSize); + hSize += 4; + } + + RTMP_LogHexString(RTMP_LOGDEBUG2, (uint8_t *)hbuf, hSize); + + if (packet->m_nBodySize > 0 && packet->m_body == NULL) + { + if (!RTMPPacket_Alloc(packet, packet->m_nBodySize)) + { + RTMP_Log(RTMP_LOGDEBUG, "%s, failed to allocate packet", __FUNCTION__); + return FALSE; + } + packet->m_headerType = (hbuf[0] & 0xc0) >> 6; + } + + nToRead = packet->m_nBodySize - packet->m_nBytesRead; + nChunk = r->m_inChunkSize; + if (nToRead < nChunk) + nChunk = nToRead; + + /* Does the caller want the raw chunk? */ + if (packet->m_chunk) + { + packet->m_chunk->c_headerSize = hSize; + memcpy(packet->m_chunk->c_header, hbuf, hSize); + packet->m_chunk->c_chunk = packet->m_body + packet->m_nBytesRead; + packet->m_chunk->c_chunkSize = nChunk; + } + + if (ReadN(r, packet->m_body + packet->m_nBytesRead, nChunk) != nChunk) + { + RTMP_Log(RTMP_LOGERROR, "%s, failed to read RTMP packet body. len: %u", + __FUNCTION__, packet->m_nBodySize); + return FALSE; + } + + RTMP_LogHexString(RTMP_LOGDEBUG2, (uint8_t *)packet->m_body + packet->m_nBytesRead, nChunk); + + packet->m_nBytesRead += nChunk; + + /* keep the packet as ref for other packets on this channel */ + if (!r->m_vecChannelsIn[packet->m_nChannel]) + r->m_vecChannelsIn[packet->m_nChannel] = malloc(sizeof(RTMPPacket)); + memcpy(r->m_vecChannelsIn[packet->m_nChannel], packet, sizeof(RTMPPacket)); + if (extendedTimestamp) + { + r->m_vecChannelsIn[packet->m_nChannel]->m_nTimeStamp = 0xffffff; + } + + if (RTMPPacket_IsReady(packet)) + { + /* make packet's timestamp absolute */ + if (!packet->m_hasAbsTimestamp) + packet->m_nTimeStamp += r->m_channelTimestamp[packet->m_nChannel]; /* timestamps seem to be always relative!! */ + + r->m_channelTimestamp[packet->m_nChannel] = packet->m_nTimeStamp; + + /* reset the data from the stored packet. we keep the header since we may use it later if a new packet for this channel */ + /* arrives and requests to re-use some info (small packet header) */ + r->m_vecChannelsIn[packet->m_nChannel]->m_body = NULL; + r->m_vecChannelsIn[packet->m_nChannel]->m_nBytesRead = 0; + r->m_vecChannelsIn[packet->m_nChannel]->m_hasAbsTimestamp = FALSE; /* can only be false if we reuse header */ + } + else + { + packet->m_body = NULL; /* so it won't be erased on free */ + } + + return TRUE; +} + +#ifndef CRYPTO +static int +HandShake(RTMP *r, int FP9HandShake) +{ + int i; + uint32_t uptime, suptime; + int bMatch; + char type; + char clientbuf[RTMP_SIG_SIZE + 1], *clientsig = clientbuf + 1; + char serversig[RTMP_SIG_SIZE]; + + clientbuf[0] = 0x03; /* not encrypted */ + + uptime = htonl(RTMP_GetTime()); + memcpy(clientsig, &uptime, 4); + + memset(&clientsig[4], 0, 4); + +#ifdef _DEBUG + for (i = 8; i < RTMP_SIG_SIZE; i++) + clientsig[i] = 0xff; +#else + for (i = 8; i < RTMP_SIG_SIZE; i++) + clientsig[i] = (char)(rand() % 256); +#endif + + if (!WriteN(r, clientbuf, RTMP_SIG_SIZE + 1)) + return FALSE; + + if (ReadN(r, &type, 1) != 1) /* 0x03 or 0x06 */ + return FALSE; + + RTMP_Log(RTMP_LOGDEBUG, "%s: Type Answer : %02X", __FUNCTION__, type); + + if (type != clientbuf[0]) + RTMP_Log(RTMP_LOGWARNING, "%s: Type mismatch: client sent %d, server answered %d", + __FUNCTION__, clientbuf[0], type); + + if (ReadN(r, serversig, RTMP_SIG_SIZE) != RTMP_SIG_SIZE) + return FALSE; + + /* decode server response */ + + memcpy(&suptime, serversig, 4); + suptime = ntohl(suptime); + + RTMP_Log(RTMP_LOGDEBUG, "%s: Server Uptime : %d", __FUNCTION__, suptime); + RTMP_Log(RTMP_LOGDEBUG, "%s: FMS Version : %d.%d.%d.%d", __FUNCTION__, + serversig[4], serversig[5], serversig[6], serversig[7]); + + /* 2nd part of handshake */ + if (!WriteN(r, serversig, RTMP_SIG_SIZE)) + return FALSE; + + if (ReadN(r, serversig, RTMP_SIG_SIZE) != RTMP_SIG_SIZE) + return FALSE; + + bMatch = (memcmp(serversig, clientsig, RTMP_SIG_SIZE) == 0); + if (!bMatch) + { + RTMP_Log(RTMP_LOGWARNING, "%s, client signature does not match!", __FUNCTION__); + } + return TRUE; +} + +static int +SHandShake(RTMP *r) +{ + int i; + char serverbuf[RTMP_SIG_SIZE + 1], *serversig = serverbuf + 1; + char clientsig[RTMP_SIG_SIZE]; + uint32_t uptime; + int bMatch; + + if (ReadN(r, serverbuf, 1) != 1) /* 0x03 or 0x06 */ + return FALSE; + + RTMP_Log(RTMP_LOGDEBUG, "%s: Type Request : %02X", __FUNCTION__, serverbuf[0]); + + if (serverbuf[0] != 3) + { + RTMP_Log(RTMP_LOGERROR, "%s: Type unknown: client sent %02X", + __FUNCTION__, serverbuf[0]); + return FALSE; + } + + uptime = htonl(RTMP_GetTime()); + memcpy(serversig, &uptime, 4); + + memset(&serversig[4], 0, 4); +#ifdef _DEBUG + for (i = 8; i < RTMP_SIG_SIZE; i++) + serversig[i] = 0xff; +#else + for (i = 8; i < RTMP_SIG_SIZE; i++) + serversig[i] = (char)(rand() % 256); +#endif + + if (!WriteN(r, serverbuf, RTMP_SIG_SIZE + 1)) + return FALSE; + + if (ReadN(r, clientsig, RTMP_SIG_SIZE) != RTMP_SIG_SIZE) + return FALSE; + + /* decode client response */ + + memcpy(&uptime, clientsig, 4); + uptime = ntohl(uptime); + + RTMP_Log(RTMP_LOGDEBUG, "%s: Client Uptime : %d", __FUNCTION__, uptime); + RTMP_Log(RTMP_LOGDEBUG, "%s: Player Version: %d.%d.%d.%d", __FUNCTION__, + clientsig[4], clientsig[5], clientsig[6], clientsig[7]); + + /* 2nd part of handshake */ + if (!WriteN(r, clientsig, RTMP_SIG_SIZE)) + return FALSE; + + if (ReadN(r, clientsig, RTMP_SIG_SIZE) != RTMP_SIG_SIZE) + return FALSE; + + bMatch = (memcmp(serversig, clientsig, RTMP_SIG_SIZE) == 0); + if (!bMatch) + { + RTMP_Log(RTMP_LOGWARNING, "%s, client signature does not match!", __FUNCTION__); + } + return TRUE; +} +#endif + +int +RTMP_SendChunk(RTMP *r, RTMPChunk *chunk) +{ + int wrote; + char hbuf[RTMP_MAX_HEADER_SIZE]; + + RTMP_Log(RTMP_LOGDEBUG2, "%s: fd=%d, size=%d", __FUNCTION__, r->m_sb.sb_socket, + chunk->c_chunkSize); + RTMP_LogHexString(RTMP_LOGDEBUG2, (uint8_t *)chunk->c_header, chunk->c_headerSize); + if (chunk->c_chunkSize) + { + char *ptr = chunk->c_chunk - chunk->c_headerSize; + RTMP_LogHexString(RTMP_LOGDEBUG2, (uint8_t *)chunk->c_chunk, chunk->c_chunkSize); + /* save header bytes we're about to overwrite */ + memcpy(hbuf, ptr, chunk->c_headerSize); + memcpy(ptr, chunk->c_header, chunk->c_headerSize); + wrote = WriteN(r, ptr, chunk->c_headerSize + chunk->c_chunkSize); + memcpy(ptr, hbuf, chunk->c_headerSize); + } + else + wrote = WriteN(r, chunk->c_header, chunk->c_headerSize); + return wrote; +} + +int +RTMP_SendPacket(RTMP *r, RTMPPacket *packet, int queue) +{ + const RTMPPacket *prevPacket; + uint32_t last = 0; + int nSize; + int hSize, cSize; + char *header, *hptr, *hend, hbuf[RTMP_MAX_HEADER_SIZE], c; + uint32_t t; + char *buffer, *tbuf = NULL, *toff = NULL; + int nChunkSize; + int tlen; + + if (packet->m_nChannel >= r->m_channelsAllocatedOut) + { + int n = packet->m_nChannel + 10; + RTMPPacket **packets = realloc(r->m_vecChannelsOut, sizeof(RTMPPacket*) * n); + if (!packets) { + free(r->m_vecChannelsOut); + r->m_vecChannelsOut = NULL; + r->m_channelsAllocatedOut = 0; + return FALSE; + } + r->m_vecChannelsOut = packets; + memset(r->m_vecChannelsOut + r->m_channelsAllocatedOut, 0, sizeof(RTMPPacket*) * (n - r->m_channelsAllocatedOut)); + r->m_channelsAllocatedOut = n; + } + + prevPacket = r->m_vecChannelsOut[packet->m_nChannel]; + if (prevPacket && packet->m_headerType != RTMP_PACKET_SIZE_LARGE) + { + /* compress a bit by using the prev packet's attributes */ + if (prevPacket->m_nBodySize == packet->m_nBodySize + && prevPacket->m_packetType == packet->m_packetType + && packet->m_headerType == RTMP_PACKET_SIZE_MEDIUM) + packet->m_headerType = RTMP_PACKET_SIZE_SMALL; + + if (prevPacket->m_nTimeStamp == packet->m_nTimeStamp + && packet->m_headerType == RTMP_PACKET_SIZE_SMALL) + packet->m_headerType = RTMP_PACKET_SIZE_MINIMUM; + last = prevPacket->m_nTimeStamp; + } + + if (packet->m_headerType > 3) /* sanity */ + { + RTMP_Log(RTMP_LOGERROR, "sanity failed!! trying to send header of type: 0x%02x.", + (unsigned char)packet->m_headerType); + return FALSE; + } + + nSize = packetSize[packet->m_headerType]; + hSize = nSize; cSize = 0; + t = packet->m_nTimeStamp - last; + + if (packet->m_body) + { + header = packet->m_body - nSize; + hend = packet->m_body; + } + else + { + header = hbuf + 6; + hend = hbuf + sizeof(hbuf); + } + + if (packet->m_nChannel > 319) + cSize = 2; + else if (packet->m_nChannel > 63) + cSize = 1; + if (cSize) + { + header -= cSize; + hSize += cSize; + } + + if (t >= 0xffffff) + { + header -= 4; + hSize += 4; + // RTMP_Log(RTMP_LOGWARNING, "Larger timestamp than 24-bit: 0x%x", t); + } + + hptr = header; + c = packet->m_headerType << 6; + switch (cSize) + { + case 0: + c |= packet->m_nChannel; + break; + case 1: + break; + case 2: + c |= 1; + break; + } + *hptr++ = c; + if (cSize) + { + int tmp = packet->m_nChannel - 64; + *hptr++ = tmp & 0xff; + if (cSize == 2) + *hptr++ = tmp >> 8; + } + + if (nSize > 1) + { + hptr = AMF_EncodeInt24(hptr, hend, t > 0xffffff ? 0xffffff : t); + } + + if (nSize > 4) + { + hptr = AMF_EncodeInt24(hptr, hend, packet->m_nBodySize); + *hptr++ = packet->m_packetType; + } + + if (nSize > 8) + hptr += EncodeInt32LE(hptr, packet->m_nInfoField2); + + if (t >= 0xffffff) + hptr = AMF_EncodeInt32(hptr, hend, t); + + nSize = packet->m_nBodySize; + buffer = packet->m_body; + nChunkSize = r->m_outChunkSize; + + RTMP_Log(RTMP_LOGDEBUG2, "%s: fd=%d, size=%d", __FUNCTION__, r->m_sb.sb_socket, + nSize); + /* send all chunks in one HTTP request */ + if (r->Link.protocol & RTMP_FEATURE_HTTP) + { + int chunks = (nSize+nChunkSize-1) / nChunkSize; + if (chunks > 1) + { + tlen = chunks * (cSize + 1) + nSize + hSize; + tbuf = malloc(tlen); + if (!tbuf) + return FALSE; + toff = tbuf; + } + } + while (nSize + hSize) + { + int wrote; + + if (nSize < nChunkSize) + nChunkSize = nSize; + + RTMP_LogHexString(RTMP_LOGDEBUG2, (uint8_t *)header, hSize); + RTMP_LogHexString(RTMP_LOGDEBUG2, (uint8_t *)buffer, nChunkSize); + if (tbuf) + { + memcpy(toff, header, nChunkSize + hSize); + toff += nChunkSize + hSize; + } + else + { + wrote = WriteN(r, header, nChunkSize + hSize); + if (!wrote) + return FALSE; + } + nSize -= nChunkSize; + buffer += nChunkSize; + hSize = 0; + + if (nSize > 0) + { + header = buffer - 1; + hSize = 1; + if (cSize) + { + header -= cSize; + hSize += cSize; + } + if (t >= 0xffffff) + { + header -= 4; + hSize += 4; + } + *header = (0xc0 | c); + if (cSize) + { + int tmp = packet->m_nChannel - 64; + header[1] = tmp & 0xff; + if (cSize == 2) + header[2] = tmp >> 8; + } + if (t >= 0xffffff) + { + char* extendedTimestamp = header + 1 + cSize; + AMF_EncodeInt32(extendedTimestamp, extendedTimestamp + 4, t); + } + } + } + if (tbuf) + { + int wrote = WriteN(r, tbuf, toff-tbuf); + free(tbuf); + tbuf = NULL; + if (!wrote) + return FALSE; + } + + /* we invoked a remote method */ + if (packet->m_packetType == RTMP_PACKET_TYPE_INVOKE) + { + AVal method; + char *ptr; + ptr = packet->m_body + 1; + AMF_DecodeString(ptr, &method); + RTMP_Log(RTMP_LOGDEBUG, "Invoking %s", method.av_val); + /* keep it in call queue till result arrives */ + if (queue) { + int txn; + ptr += 3 + method.av_len; + txn = (int)AMF_DecodeNumber(ptr); + AV_queue(&r->m_methodCalls, &r->m_numCalls, &method, txn); + } + } + + if (!r->m_vecChannelsOut[packet->m_nChannel]) + r->m_vecChannelsOut[packet->m_nChannel] = malloc(sizeof(RTMPPacket)); + memcpy(r->m_vecChannelsOut[packet->m_nChannel], packet, sizeof(RTMPPacket)); + return TRUE; +} + +int +RTMP_Serve(RTMP *r) +{ + return SHandShake(r); +} + +void +RTMP_Close(RTMP *r) +{ + CloseInternal(r, 0); +} + +static void +CloseInternal(RTMP *r, int reconnect) +{ + int i; + + if (RTMP_IsConnected(r)) + { + if (r->m_stream_id > 0) + { + i = r->m_stream_id; + r->m_stream_id = 0; + if ((r->Link.protocol & RTMP_FEATURE_WRITE)) + SendFCUnpublish(r); + SendDeleteStream(r, i); + } + if (r->m_clientID.av_val) + { + HTTP_Post(r, RTMPT_CLOSE, "", 1); + free(r->m_clientID.av_val); + r->m_clientID.av_val = NULL; + r->m_clientID.av_len = 0; + } + RTMPSockBuf_Close(&r->m_sb); + } + + r->m_stream_id = -1; + r->m_sb.sb_socket = -1; + r->m_nBWCheckCounter = 0; + r->m_nBytesIn = 0; + r->m_nBytesInSent = 0; + + if (r->m_read.flags & RTMP_READ_HEADER) { + free(r->m_read.buf); + r->m_read.buf = NULL; + } + r->m_read.dataType = 0; + r->m_read.flags = 0; + r->m_read.status = 0; + r->m_read.nResumeTS = 0; + r->m_read.nIgnoredFrameCounter = 0; + r->m_read.nIgnoredFlvFrameCounter = 0; + + r->m_write.m_nBytesRead = 0; + RTMPPacket_Free(&r->m_write); + + for (i = 0; i < r->m_channelsAllocatedIn; i++) + { + if (r->m_vecChannelsIn[i]) + { + RTMPPacket_Free(r->m_vecChannelsIn[i]); + free(r->m_vecChannelsIn[i]); + r->m_vecChannelsIn[i] = NULL; + } + } + free(r->m_vecChannelsIn); + r->m_vecChannelsIn = NULL; + free(r->m_channelTimestamp); + r->m_channelTimestamp = NULL; + r->m_channelsAllocatedIn = 0; + for (i = 0; i < r->m_channelsAllocatedOut; i++) + { + if (r->m_vecChannelsOut[i]) + { + free(r->m_vecChannelsOut[i]); + r->m_vecChannelsOut[i] = NULL; + } + } + free(r->m_vecChannelsOut); + r->m_vecChannelsOut = NULL; + r->m_channelsAllocatedOut = 0; + AV_clear(r->m_methodCalls, r->m_numCalls); + r->m_methodCalls = NULL; + r->m_numCalls = 0; + r->m_numInvokes = 0; + + r->m_bPlaying = FALSE; + r->m_sb.sb_size = 0; + + r->m_msgCounter = 0; + r->m_resplen = 0; + r->m_unackd = 0; + + if (r->Link.lFlags & RTMP_LF_FTCU && !reconnect) + { + free(r->Link.tcUrl.av_val); + r->Link.tcUrl.av_val = NULL; + r->Link.lFlags ^= RTMP_LF_FTCU; + } + if (r->Link.lFlags & RTMP_LF_FAPU && !reconnect) + { + free(r->Link.app.av_val); + r->Link.app.av_val = NULL; + r->Link.lFlags ^= RTMP_LF_FAPU; + } + + if (!reconnect) + { + free(r->Link.playpath0.av_val); + r->Link.playpath0.av_val = NULL; + } +#ifdef CRYPTO + if (r->Link.dh) + { + MDH_free(r->Link.dh); + r->Link.dh = NULL; + } + if (r->Link.rc4keyIn) + { + RC4_free(r->Link.rc4keyIn); + r->Link.rc4keyIn = NULL; + } + if (r->Link.rc4keyOut) + { + RC4_free(r->Link.rc4keyOut); + r->Link.rc4keyOut = NULL; + } +#endif +} + +int +RTMPSockBuf_Fill(RTMPSockBuf *sb) +{ + int nBytes; + + if (!sb->sb_size) + sb->sb_start = sb->sb_buf; + + while (1) + { + nBytes = sizeof(sb->sb_buf) - 1 - sb->sb_size - (sb->sb_start - sb->sb_buf); +#if defined(CRYPTO) && !defined(NO_SSL) + if (sb->sb_ssl) + { + nBytes = TLS_read(sb->sb_ssl, sb->sb_start + sb->sb_size, nBytes); + } + else +#endif + { + nBytes = recv(sb->sb_socket, sb->sb_start + sb->sb_size, nBytes, 0); + } + if (nBytes != -1) + { + sb->sb_size += nBytes; + } + else + { + int sockerr = GetSockError(); + RTMP_Log(RTMP_LOGDEBUG, "%s, recv returned %d. GetSockError(): %d (%s)", + __FUNCTION__, nBytes, sockerr, strerror(sockerr)); + if (sockerr == EINTR && !RTMP_ctrlC) + continue; + + if (sockerr == EWOULDBLOCK || sockerr == EAGAIN) + { + sb->sb_timedout = TRUE; + nBytes = 0; + } + } + break; + } + + return nBytes; +} + +int +RTMPSockBuf_Send(RTMPSockBuf *sb, const char *buf, int len) +{ + int rc; + +#ifdef _DEBUG + if (netstackdump) + fwrite(buf, 1, len, netstackdump); +#endif + +#if defined(CRYPTO) && !defined(NO_SSL) + if (sb->sb_ssl) + { + rc = TLS_write(sb->sb_ssl, buf, len); + } + else +#endif + { + rc = send(sb->sb_socket, buf, len, 0); + } + return rc; +} + +int +RTMPSockBuf_Close(RTMPSockBuf *sb) +{ +#if defined(CRYPTO) && !defined(NO_SSL) + if (sb->sb_ssl) + { + TLS_shutdown(sb->sb_ssl); + TLS_close(sb->sb_ssl); + sb->sb_ssl = NULL; + } +#endif + if (sb->sb_socket != -1) + return closesocket(sb->sb_socket); + return 0; +} + +#define HEX2BIN(a) (((a)&0x40)?((a)&0xf)+9:((a)&0xf)) + +static void +DecodeTEA(AVal *key, AVal *text) +{ + uint32_t *v, k[4] = { 0 }, u; + uint32_t z, y, sum = 0, e, DELTA = 0x9e3779b9; + int32_t p, q; + int i, n; + unsigned char *ptr, *out; + + /* prep key: pack 1st 16 chars into 4 LittleEndian ints */ + ptr = (unsigned char *)key->av_val; + u = 0; + n = 0; + v = k; + p = key->av_len > 16 ? 16 : key->av_len; + for (i = 0; i < p; i++) + { + u |= ptr[i] << (n * 8); + if (n == 3) + { + *v++ = u; + u = 0; + n = 0; + } + else + { + n++; + } + } + /* any trailing chars */ + if (u) + *v = u; + + /* prep text: hex2bin, multiples of 4 */ + n = (text->av_len + 7) / 8; + out = malloc(n * 8); + ptr = (unsigned char *)text->av_val; + v = (uint32_t *) out; + for (i = 0; i < n; i++) + { + u = (HEX2BIN(ptr[0]) << 4) + HEX2BIN(ptr[1]); + u |= ((HEX2BIN(ptr[2]) << 4) + HEX2BIN(ptr[3])) << 8; + u |= ((HEX2BIN(ptr[4]) << 4) + HEX2BIN(ptr[5])) << 16; + u |= ((HEX2BIN(ptr[6]) << 4) + HEX2BIN(ptr[7])) << 24; + *v++ = u; + ptr += 8; + } + v = (uint32_t *) out; + + /* http://www.movable-type.co.uk/scripts/tea-block.html */ +#define MX (((z>>5)^(y<<2)) + ((y>>3)^(z<<4))) ^ ((sum^y) + (k[(p&3)^e]^z)); + z = v[n - 1]; + y = v[0]; + q = 6 + 52 / n; + sum = q * DELTA; + while (sum != 0) + { + e = sum >> 2 & 3; + for (p = n - 1; p > 0; p--) + z = v[p - 1], y = v[p] -= MX; + z = v[n - 1]; + y = v[0] -= MX; + sum -= DELTA; + } + + text->av_len /= 2; + memcpy(text->av_val, out, text->av_len); + free(out); +} + +static int +HTTP_Post(RTMP *r, RTMPTCmd cmd, const char *buf, int len) +{ + char hbuf[512]; + int hlen = snprintf(hbuf, sizeof(hbuf), "POST /%s%s/%d HTTP/1.1\r\n" + "Host: %.*s:%d\r\n" + "Accept: */*\r\n" + "User-Agent: Shockwave Flash\r\n" + "Connection: Keep-Alive\r\n" + "Cache-Control: no-cache\r\n" + "Content-type: application/x-fcs\r\n" + "Content-length: %d\r\n\r\n", RTMPT_cmds[cmd], + r->m_clientID.av_val ? r->m_clientID.av_val : "", + r->m_msgCounter, r->Link.hostname.av_len, r->Link.hostname.av_val, + r->Link.port, len); + RTMPSockBuf_Send(&r->m_sb, hbuf, hlen); + hlen = RTMPSockBuf_Send(&r->m_sb, buf, len); + r->m_msgCounter++; + r->m_unackd++; + return hlen; +} + +static int +HTTP_read(RTMP *r, int fill) +{ + char *ptr; + long hlen; + +restart: + if (fill) + RTMPSockBuf_Fill(&r->m_sb); + if (r->m_sb.sb_size < 13) { + if (fill) + goto restart; + return -2; + } + if (strncmp(r->m_sb.sb_start, "HTTP/1.1 200 ", 13)) + return -1; + r->m_sb.sb_start[r->m_sb.sb_size] = '\0'; + if (!strstr(r->m_sb.sb_start, "\r\n\r\n")) { + if (fill) + goto restart; + return -2; + } + + ptr = r->m_sb.sb_start + sizeof("HTTP/1.1 200"); + while ((ptr = strstr(ptr, "Content-"))) { + if (!strncasecmp(ptr+8, "length:", 7)) break; + ptr += 8; + } + if (!ptr) + return -1; + hlen = strtol(ptr+16, NULL, 10); + if (hlen < 1 || hlen > INT_MAX) + return -1; + ptr = strstr(ptr+16, "\r\n\r\n"); + if (!ptr) + return -1; + ptr += 4; + if (ptr + (r->m_clientID.av_val ? 1 : hlen) > r->m_sb.sb_start + r->m_sb.sb_size) + { + if (fill) + goto restart; + return -2; + } + r->m_sb.sb_size -= ptr - r->m_sb.sb_start; + r->m_sb.sb_start = ptr; + r->m_unackd--; + + if (!r->m_clientID.av_val) + { + r->m_clientID.av_len = hlen; + r->m_clientID.av_val = malloc(hlen+1); + if (!r->m_clientID.av_val) + return -1; + r->m_clientID.av_val[0] = '/'; + memcpy(r->m_clientID.av_val+1, ptr, hlen-1); + r->m_clientID.av_val[hlen] = 0; + r->m_sb.sb_size = 0; + } + else + { + r->m_polling = *ptr++; + r->m_resplen = hlen - 1; + r->m_sb.sb_start++; + r->m_sb.sb_size--; + } + return 0; +} + +#define MAX_IGNORED_FRAMES 50 + +/* Read from the stream until we get a media packet. + * Returns -3 if Play.Close/Stop, -2 if fatal error, -1 if no more media + * packets, 0 if ignorable error, >0 if there is a media packet + */ +static int +Read_1_Packet(RTMP *r, char *buf, unsigned int buflen) +{ + uint32_t prevTagSize = 0; + int rtnGetNextMediaPacket = 0, ret = RTMP_READ_EOF; + RTMPPacket packet = { 0 }; + int recopy = FALSE; + unsigned int size; + char *ptr, *pend; + uint32_t nTimeStamp = 0; + unsigned int len; + + rtnGetNextMediaPacket = RTMP_GetNextMediaPacket(r, &packet); + while (rtnGetNextMediaPacket) + { + char *packetBody = packet.m_body; + unsigned int nPacketLen = packet.m_nBodySize; + + /* Return RTMP_READ_COMPLETE if this was completed nicely with + * invoke message Play.Stop or Play.Complete + */ + if (rtnGetNextMediaPacket == 2) + { + RTMP_Log(RTMP_LOGDEBUG, + "Got Play.Complete or Play.Stop from server. " + "Assuming stream is complete"); + ret = RTMP_READ_COMPLETE; + break; + } + + r->m_read.dataType |= (((packet.m_packetType == RTMP_PACKET_TYPE_AUDIO) << 2) | + (packet.m_packetType == RTMP_PACKET_TYPE_VIDEO)); + + if (packet.m_packetType == RTMP_PACKET_TYPE_VIDEO && nPacketLen <= 5) + { + RTMP_Log(RTMP_LOGDEBUG, "ignoring too small video packet: size: %d", + nPacketLen); + ret = RTMP_READ_IGNORE; + break; + } + if (packet.m_packetType == RTMP_PACKET_TYPE_AUDIO && nPacketLen <= 1) + { + RTMP_Log(RTMP_LOGDEBUG, "ignoring too small audio packet: size: %d", + nPacketLen); + ret = RTMP_READ_IGNORE; + break; + } + + if (r->m_read.flags & RTMP_READ_SEEKING) + { + ret = RTMP_READ_IGNORE; + break; + } +#ifdef _DEBUG + RTMP_Log(RTMP_LOGDEBUG, "type: %02X, size: %d, TS: %d ms, abs TS: %d", + packet.m_packetType, nPacketLen, packet.m_nTimeStamp, + packet.m_hasAbsTimestamp); + if (packet.m_packetType == RTMP_PACKET_TYPE_VIDEO) + RTMP_Log(RTMP_LOGDEBUG, "frametype: %02X", (*packetBody & 0xf0)); +#endif + + if (r->m_read.flags & RTMP_READ_RESUME) + { + /* check the header if we get one */ + if (packet.m_nTimeStamp == 0) + { + if (r->m_read.nMetaHeaderSize > 0 + && packet.m_packetType == RTMP_PACKET_TYPE_INFO) + { + AMFObject metaObj; + int nRes = + AMF_Decode(&metaObj, packetBody, nPacketLen, FALSE); + if (nRes >= 0) + { + AVal metastring; + AMFProp_GetString(AMF_GetProp(&metaObj, NULL, 0), + &metastring); + + if (AVMATCH(&metastring, &av_onMetaData)) + { + /* compare */ + if ((r->m_read.nMetaHeaderSize != nPacketLen) || + (memcmp + (r->m_read.metaHeader, packetBody, + r->m_read.nMetaHeaderSize) != 0)) + { + ret = RTMP_READ_ERROR; + } + } + AMF_Reset(&metaObj); + if (ret == RTMP_READ_ERROR) + break; + } + } + + /* check first keyframe to make sure we got the right position + * in the stream! (the first non ignored frame) + */ + if (r->m_read.nInitialFrameSize > 0) + { + /* video or audio data */ + if (packet.m_packetType == r->m_read.initialFrameType + && r->m_read.nInitialFrameSize == nPacketLen) + { + /* we don't compare the sizes since the packet can + * contain several FLV packets, just make sure the + * first frame is our keyframe (which we are going + * to rewrite) + */ + if (memcmp + (r->m_read.initialFrame, packetBody, + r->m_read.nInitialFrameSize) == 0) + { + RTMP_Log(RTMP_LOGDEBUG, "Checked keyframe successfully!"); + r->m_read.flags |= RTMP_READ_GOTKF; + /* ignore it! (what about audio data after it? it is + * handled by ignoring all 0ms frames, see below) + */ + ret = RTMP_READ_IGNORE; + break; + } + } + + /* hande FLV streams, even though the server resends the + * keyframe as an extra video packet it is also included + * in the first FLV stream chunk and we have to compare + * it and filter it out !! + */ + if (packet.m_packetType == RTMP_PACKET_TYPE_FLASH_VIDEO) + { + /* basically we have to find the keyframe with the + * correct TS being nResumeTS + */ + unsigned int pos = 0; + uint32_t ts = 0; + + while (pos + 11 < nPacketLen) + { + /* size without header (11) and prevTagSize (4) */ + uint32_t dataSize = + AMF_DecodeInt24(packetBody + pos + 1); + ts = AMF_DecodeInt24(packetBody + pos + 4); + ts |= (packetBody[pos + 7] << 24); + +#ifdef _DEBUG + RTMP_Log(RTMP_LOGDEBUG, + "keyframe search: FLV Packet: type %02X, dataSize: %d, timeStamp: %d ms", + packetBody[pos], dataSize, ts); +#endif + /* ok, is it a keyframe?: + * well doesn't work for audio! + */ + if (packetBody[pos /*6928, test 0 */ ] == + r->m_read.initialFrameType + /* && (packetBody[11]&0xf0) == 0x10 */ ) + { + if (ts == r->m_read.nResumeTS) + { + RTMP_Log(RTMP_LOGDEBUG, + "Found keyframe with resume-keyframe timestamp!"); + if (r->m_read.nInitialFrameSize != dataSize + || memcmp(r->m_read.initialFrame, + packetBody + pos + 11, + r->m_read. + nInitialFrameSize) != 0) + { + RTMP_Log(RTMP_LOGERROR, + "FLV Stream: Keyframe doesn't match!"); + ret = RTMP_READ_ERROR; + break; + } + r->m_read.flags |= RTMP_READ_GOTFLVK; + + /* skip this packet? + * check whether skippable: + */ + if (pos + 11 + dataSize + 4 > nPacketLen) + { + RTMP_Log(RTMP_LOGWARNING, + "Non skipable packet since it doesn't end with chunk, stream corrupt!"); + ret = RTMP_READ_ERROR; + break; + } + packetBody += (pos + 11 + dataSize + 4); + nPacketLen -= (pos + 11 + dataSize + 4); + + goto stopKeyframeSearch; + + } + else if (r->m_read.nResumeTS < ts) + { + /* the timestamp ts will only increase with + * further packets, wait for seek + */ + goto stopKeyframeSearch; + } + } + pos += (11 + dataSize + 4); + } + if (ts < r->m_read.nResumeTS) + { + RTMP_Log(RTMP_LOGERROR, + "First packet does not contain keyframe, all " + "timestamps are smaller than the keyframe " + "timestamp; probably the resume seek failed?"); + } + stopKeyframeSearch: + ; + if (!(r->m_read.flags & RTMP_READ_GOTFLVK)) + { + RTMP_Log(RTMP_LOGERROR, + "Couldn't find the seeked keyframe in this chunk!"); + ret = RTMP_READ_IGNORE; + break; + } + } + } + } + + if (packet.m_nTimeStamp > 0 + && (r->m_read.flags & (RTMP_READ_GOTKF|RTMP_READ_GOTFLVK))) + { + /* another problem is that the server can actually change from + * 09/08 video/audio packets to an FLV stream or vice versa and + * our keyframe check will prevent us from going along with the + * new stream if we resumed. + * + * in this case set the 'found keyframe' variables to true. + * We assume that if we found one keyframe somewhere and were + * already beyond TS > 0 we have written data to the output + * which means we can accept all forthcoming data including the + * change between 08/09 <-> FLV packets + */ + r->m_read.flags |= (RTMP_READ_GOTKF|RTMP_READ_GOTFLVK); + } + + /* skip till we find our keyframe + * (seeking might put us somewhere before it) + */ + if (!(r->m_read.flags & RTMP_READ_GOTKF) && + packet.m_packetType != RTMP_PACKET_TYPE_FLASH_VIDEO) + { + RTMP_Log(RTMP_LOGWARNING, + "Stream does not start with requested frame, ignoring data... "); + r->m_read.nIgnoredFrameCounter++; + if (r->m_read.nIgnoredFrameCounter > MAX_IGNORED_FRAMES) + ret = RTMP_READ_ERROR; /* fatal error, couldn't continue stream */ + else + ret = RTMP_READ_IGNORE; + break; + } + /* ok, do the same for FLV streams */ + if (!(r->m_read.flags & RTMP_READ_GOTFLVK) && + packet.m_packetType == RTMP_PACKET_TYPE_FLASH_VIDEO) + { + RTMP_Log(RTMP_LOGWARNING, + "Stream does not start with requested FLV frame, ignoring data... "); + r->m_read.nIgnoredFlvFrameCounter++; + if (r->m_read.nIgnoredFlvFrameCounter > MAX_IGNORED_FRAMES) + ret = RTMP_READ_ERROR; + else + ret = RTMP_READ_IGNORE; + break; + } + + /* we have to ignore the 0ms frames since these are the first + * keyframes; we've got these so don't mess around with multiple + * copies sent by the server to us! (if the keyframe is found at a + * later position there is only one copy and it will be ignored by + * the preceding if clause) + */ + if (!(r->m_read.flags & RTMP_READ_NO_IGNORE) && + packet.m_packetType != RTMP_PACKET_TYPE_FLASH_VIDEO) + { + /* exclude type RTMP_PACKET_TYPE_FLASH_VIDEO since it can + * contain several FLV packets + */ + if (packet.m_nTimeStamp == 0) + { + ret = RTMP_READ_IGNORE; + break; + } + else + { + /* stop ignoring packets */ + r->m_read.flags |= RTMP_READ_NO_IGNORE; + } + } + } + + /* calculate packet size and allocate slop buffer if necessary */ + size = nPacketLen + + ((packet.m_packetType == RTMP_PACKET_TYPE_AUDIO + || packet.m_packetType == RTMP_PACKET_TYPE_VIDEO + || packet.m_packetType == RTMP_PACKET_TYPE_INFO) ? 11 : 0) + + (packet.m_packetType != RTMP_PACKET_TYPE_FLASH_VIDEO ? 4 : 0); + + if (size + 4 > buflen) + { + /* the extra 4 is for the case of an FLV stream without a last + * prevTagSize (we need extra 4 bytes to append it) */ + r->m_read.buf = malloc(size + 4); + if (r->m_read.buf == 0) + { + RTMP_Log(RTMP_LOGERROR, "Couldn't allocate memory!"); + ret = RTMP_READ_ERROR; /* fatal error */ + break; + } + recopy = TRUE; + ptr = r->m_read.buf; + } + else + { + ptr = buf; + } + pend = ptr + size + 4; + + /* use to return timestamp of last processed packet */ + + /* audio (0x08), video (0x09) or metadata (0x12) packets : + * construct 11 byte header then add rtmp packet's data */ + if (packet.m_packetType == RTMP_PACKET_TYPE_AUDIO + || packet.m_packetType == RTMP_PACKET_TYPE_VIDEO + || packet.m_packetType == RTMP_PACKET_TYPE_INFO) + { + nTimeStamp = r->m_read.nResumeTS + packet.m_nTimeStamp; + prevTagSize = 11 + nPacketLen; + + *ptr = packet.m_packetType; + ptr++; + ptr = AMF_EncodeInt24(ptr, pend, nPacketLen); + +#if 0 + if(packet.m_packetType == RTMP_PACKET_TYPE_VIDEO) { + + /* H264 fix: */ + if((packetBody[0] & 0x0f) == 7) { /* CodecId = H264 */ + uint8_t packetType = *(packetBody+1); + + uint32_t ts = AMF_DecodeInt24(packetBody+2); /* composition time */ + int32_t cts = (ts+0xff800000)^0xff800000; + RTMP_Log(RTMP_LOGDEBUG, "cts : %d\n", cts); + + nTimeStamp -= cts; + /* get rid of the composition time */ + CRTMP::EncodeInt24(packetBody+2, 0); + } + RTMP_Log(RTMP_LOGDEBUG, "VIDEO: nTimeStamp: 0x%08X (%d)\n", nTimeStamp, nTimeStamp); + } +#endif + + ptr = AMF_EncodeInt24(ptr, pend, nTimeStamp); + *ptr = (char)((nTimeStamp & 0xFF000000) >> 24); + ptr++; + + /* stream id */ + ptr = AMF_EncodeInt24(ptr, pend, 0); + } + + memcpy(ptr, packetBody, nPacketLen); + len = nPacketLen; + + /* correct tagSize and obtain timestamp if we have an FLV stream */ + if (packet.m_packetType == RTMP_PACKET_TYPE_FLASH_VIDEO) + { + unsigned int pos = 0; + int delta; + + /* grab first timestamp and see if it needs fixing */ + nTimeStamp = AMF_DecodeInt24(packetBody + 4); + nTimeStamp |= (packetBody[7] << 24); + delta = packet.m_nTimeStamp - nTimeStamp + r->m_read.nResumeTS; + + while (pos + 11 < nPacketLen) + { + /* size without header (11) and without prevTagSize (4) */ + uint32_t dataSize = AMF_DecodeInt24(packetBody + pos + 1); + nTimeStamp = AMF_DecodeInt24(packetBody + pos + 4); + nTimeStamp |= (packetBody[pos + 7] << 24); + + if (delta) + { + nTimeStamp += delta; + AMF_EncodeInt24(ptr+pos+4, pend, nTimeStamp); + ptr[pos+7] = nTimeStamp>>24; + } + + /* set data type */ + r->m_read.dataType |= (((*(packetBody + pos) == 0x08) << 2) | + (*(packetBody + pos) == 0x09)); + + if (pos + 11 + dataSize + 4 > nPacketLen) + { + if (pos + 11 + dataSize > nPacketLen) + { + RTMP_Log(RTMP_LOGERROR, + "Wrong data size (%u), stream corrupted, aborting!", + dataSize); + ret = RTMP_READ_ERROR; + break; + } + RTMP_Log(RTMP_LOGWARNING, "No tagSize found, appending!"); + + /* we have to append a last tagSize! */ + prevTagSize = dataSize + 11; + AMF_EncodeInt32(ptr + pos + 11 + dataSize, pend, + prevTagSize); + size += 4; + len += 4; + } + else + { + prevTagSize = + AMF_DecodeInt32(packetBody + pos + 11 + dataSize); + +#ifdef _DEBUG + RTMP_Log(RTMP_LOGDEBUG, + "FLV Packet: type %02X, dataSize: %lu, tagSize: %lu, timeStamp: %lu ms", + (unsigned char)packetBody[pos], dataSize, prevTagSize, + nTimeStamp); +#endif + + if (prevTagSize != (dataSize + 11)) + { +#ifdef _DEBUG + RTMP_Log(RTMP_LOGWARNING, + "Tag and data size are not consitent, writing tag size according to dataSize+11: %d", + dataSize + 11); +#endif + + prevTagSize = dataSize + 11; + AMF_EncodeInt32(ptr + pos + 11 + dataSize, pend, + prevTagSize); + } + } + + pos += prevTagSize + 4; /*(11+dataSize+4); */ + } + } + ptr += len; + + if (packet.m_packetType != RTMP_PACKET_TYPE_FLASH_VIDEO) + { + /* FLV tag packets contain their own prevTagSize */ + AMF_EncodeInt32(ptr, pend, prevTagSize); + } + + /* In non-live this nTimeStamp can contain an absolute TS. + * Update ext timestamp with this absolute offset in non-live mode + * otherwise report the relative one + */ + /* RTMP_Log(RTMP_LOGDEBUG, "type: %02X, size: %d, pktTS: %dms, TS: %dms, bLiveStream: %d", packet.m_packetType, nPacketLen, packet.m_nTimeStamp, nTimeStamp, r->Link.lFlags & RTMP_LF_LIVE); */ + r->m_read.timestamp = (r->Link.lFlags & RTMP_LF_LIVE) ? packet.m_nTimeStamp : nTimeStamp; + + ret = size; + break; + } + + if (rtnGetNextMediaPacket) + RTMPPacket_Free(&packet); + + if (recopy) + { + len = ret > (int)buflen ? buflen : ret; + memcpy(buf, r->m_read.buf, len); + r->m_read.bufpos = r->m_read.buf + len; + r->m_read.buflen = ret - len; + } + return ret; +} + +static const char flvHeader[] = { 'F', 'L', 'V', 0x01, + 0x00, /* 0x04 == audio, 0x01 == video */ + 0x00, 0x00, 0x00, 0x09, + 0x00, 0x00, 0x00, 0x00 +}; + +#define HEADERBUF (128*1024) +int +RTMP_Read(RTMP *r, char *buf, int size) +{ + int nRead = 0, total = 0; + + /* can't continue */ +fail: + switch (r->m_read.status) { + case RTMP_READ_EOF: + case RTMP_READ_COMPLETE: + return 0; + case RTMP_READ_ERROR: /* corrupted stream, resume failed */ + SetSockError(EINVAL); + return -1; + default: + break; + } + + /* first time thru */ + if (!(r->m_read.flags & RTMP_READ_HEADER)) + { + if (!(r->m_read.flags & RTMP_READ_RESUME)) + { + char *mybuf = malloc(HEADERBUF), *end = mybuf + HEADERBUF; + int cnt = 0; + r->m_read.buf = mybuf; + r->m_read.buflen = HEADERBUF; + + memcpy(mybuf, flvHeader, sizeof(flvHeader)); + r->m_read.buf += sizeof(flvHeader); + r->m_read.buflen -= sizeof(flvHeader); + cnt += sizeof(flvHeader); + + while (r->m_read.timestamp == 0) + { + nRead = Read_1_Packet(r, r->m_read.buf, r->m_read.buflen); + if (nRead < 0) + { + free(mybuf); + r->m_read.buf = NULL; + r->m_read.buflen = 0; + r->m_read.status = nRead; + goto fail; + } + /* buffer overflow, fix buffer and give up */ + if (r->m_read.buf < mybuf || r->m_read.buf > end) { + mybuf = realloc(mybuf, cnt + nRead); + memcpy(mybuf+cnt, r->m_read.buf, nRead); + free(r->m_read.buf); + r->m_read.buf = mybuf+cnt+nRead; + break; + } + cnt += nRead; + r->m_read.buf += nRead; + r->m_read.buflen -= nRead; + if (r->m_read.dataType == 5) + break; + } + mybuf[4] = r->m_read.dataType; + r->m_read.buflen = r->m_read.buf - mybuf; + r->m_read.buf = mybuf; + r->m_read.bufpos = mybuf; + } + r->m_read.flags |= RTMP_READ_HEADER; + } + + if ((r->m_read.flags & RTMP_READ_SEEKING) && r->m_read.buf) + { + /* drop whatever's here */ + free(r->m_read.buf); + r->m_read.buf = NULL; + r->m_read.bufpos = NULL; + r->m_read.buflen = 0; + } + + /* If there's leftover data buffered, use it up */ + if (r->m_read.buf) + { + nRead = r->m_read.buflen; + if (nRead > size) + nRead = size; + memcpy(buf, r->m_read.bufpos, nRead); + r->m_read.buflen -= nRead; + if (!r->m_read.buflen) + { + free(r->m_read.buf); + r->m_read.buf = NULL; + r->m_read.bufpos = NULL; + } + else + { + r->m_read.bufpos += nRead; + } + buf += nRead; + total += nRead; + size -= nRead; + } + + while (size > 0 && (nRead = Read_1_Packet(r, buf, size)) >= 0) + { + if (!nRead) continue; + buf += nRead; + total += nRead; + size -= nRead; + break; + } + if (nRead < 0) + r->m_read.status = nRead; + + if (size < 0) + total += size; + return total; +} + +static const AVal av_setDataFrame = AVC("@setDataFrame"); + +int +RTMP_Write(RTMP *r, const char *buf, int size) +{ + RTMPPacket *pkt = &r->m_write; + char *pend, *enc; + int s2 = size, ret, num; + + pkt->m_nChannel = 0x04; /* source channel */ + pkt->m_nInfoField2 = r->m_stream_id; + + while (s2) + { + if (!pkt->m_nBytesRead) + { + if (size < 11) { + /* FLV pkt too small */ + return 0; + } + + if (buf[0] == 'F' && buf[1] == 'L' && buf[2] == 'V') + { + buf += 13; + s2 -= 13; + } + + pkt->m_packetType = *buf++; + pkt->m_nBodySize = AMF_DecodeInt24(buf); + buf += 3; + pkt->m_nTimeStamp = AMF_DecodeInt24(buf); + buf += 3; + pkt->m_nTimeStamp |= *buf++ << 24; + buf += 3; + s2 -= 11; + + if (((pkt->m_packetType == RTMP_PACKET_TYPE_AUDIO + || pkt->m_packetType == RTMP_PACKET_TYPE_VIDEO) && + !pkt->m_nTimeStamp) || pkt->m_packetType == RTMP_PACKET_TYPE_INFO) + { + pkt->m_headerType = RTMP_PACKET_SIZE_LARGE; + if (pkt->m_packetType == RTMP_PACKET_TYPE_INFO) + pkt->m_nBodySize += 16; + } + else + { + pkt->m_headerType = RTMP_PACKET_SIZE_MEDIUM; + } + + if (!RTMPPacket_Alloc(pkt, pkt->m_nBodySize)) + { + RTMP_Log(RTMP_LOGDEBUG, "%s, failed to allocate packet", __FUNCTION__); + return FALSE; + } + enc = pkt->m_body; + pend = enc + pkt->m_nBodySize; + if (pkt->m_packetType == RTMP_PACKET_TYPE_INFO) + { + enc = AMF_EncodeString(enc, pend, &av_setDataFrame); + pkt->m_nBytesRead = enc - pkt->m_body; + } + } + else + { + enc = pkt->m_body + pkt->m_nBytesRead; + } + num = pkt->m_nBodySize - pkt->m_nBytesRead; + if (num > s2) + num = s2; + memcpy(enc, buf, num); + pkt->m_nBytesRead += num; + s2 -= num; + buf += num; + if (pkt->m_nBytesRead == pkt->m_nBodySize) + { + ret = RTMP_SendPacket(r, pkt, FALSE); + RTMPPacket_Free(pkt); + pkt->m_nBytesRead = 0; + if (!ret) + return -1; + buf += 4; + s2 -= 4; + if (s2 < 0) + break; + } + } + return size+s2; +} diff --git a/MediaClient/MediaClient/librtmp/rtmp.h b/MediaClient/MediaClient/librtmp/rtmp.h new file mode 100644 index 0000000..caa0f98 --- /dev/null +++ b/MediaClient/MediaClient/librtmp/rtmp.h @@ -0,0 +1,382 @@ +#ifndef __RTMP_H__ +#define __RTMP_H__ +/* + * Copyright (C) 2005-2008 Team XBMC + * http://www.xbmc.org + * Copyright (C) 2008-2009 Andrej Stepanchuk + * Copyright (C) 2009-2010 Howard Chu + * + * This file is part of librtmp. + * + * librtmp is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1, + * or (at your option) any later version. + * + * librtmp is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with librtmp see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * http://www.gnu.org/copyleft/lgpl.html + */ + +#if !defined(NO_CRYPTO) && !defined(CRYPTO) +#define CRYPTO +#endif + +#include +#include +#include + +#include "amf.h" + +#ifdef __cplusplus +extern "C" +{ +#endif + +#define RTMP_LIB_VERSION 0x020300 /* 2.3 */ + +#define RTMP_FEATURE_HTTP 0x01 +#define RTMP_FEATURE_ENC 0x02 +#define RTMP_FEATURE_SSL 0x04 +#define RTMP_FEATURE_MFP 0x08 /* not yet supported */ +#define RTMP_FEATURE_WRITE 0x10 /* publish, not play */ +#define RTMP_FEATURE_HTTP2 0x20 /* server-side rtmpt */ + +#define RTMP_PROTOCOL_UNDEFINED -1 +#define RTMP_PROTOCOL_RTMP 0 +#define RTMP_PROTOCOL_RTMPE RTMP_FEATURE_ENC +#define RTMP_PROTOCOL_RTMPT RTMP_FEATURE_HTTP +#define RTMP_PROTOCOL_RTMPS RTMP_FEATURE_SSL +#define RTMP_PROTOCOL_RTMPTE (RTMP_FEATURE_HTTP|RTMP_FEATURE_ENC) +#define RTMP_PROTOCOL_RTMPTS (RTMP_FEATURE_HTTP|RTMP_FEATURE_SSL) +#define RTMP_PROTOCOL_RTMFP RTMP_FEATURE_MFP + +#define RTMP_DEFAULT_CHUNKSIZE 128 + +/* needs to fit largest number of bytes recv() may return */ +#define RTMP_BUFFER_CACHE_SIZE (16*1024) + +#define RTMP_CHANNELS 65600 + + extern const char RTMPProtocolStringsLower[][7]; + extern const AVal RTMP_DefaultFlashVer; + extern const AVal RTMP_FlashVer; + extern int RTMP_ctrlC; + + uint32_t RTMP_GetTime(void); + +/* RTMP_PACKET_TYPE_... 0x00 */ +#define RTMP_PACKET_TYPE_CHUNK_SIZE 0x01 +/* RTMP_PACKET_TYPE_... 0x02 */ +#define RTMP_PACKET_TYPE_BYTES_READ_REPORT 0x03 +#define RTMP_PACKET_TYPE_CONTROL 0x04 +#define RTMP_PACKET_TYPE_SERVER_BW 0x05 +#define RTMP_PACKET_TYPE_CLIENT_BW 0x06 +/* RTMP_PACKET_TYPE_... 0x07 */ +#define RTMP_PACKET_TYPE_AUDIO 0x08 +#define RTMP_PACKET_TYPE_VIDEO 0x09 +/* RTMP_PACKET_TYPE_... 0x0A */ +/* RTMP_PACKET_TYPE_... 0x0B */ +/* RTMP_PACKET_TYPE_... 0x0C */ +/* RTMP_PACKET_TYPE_... 0x0D */ +/* RTMP_PACKET_TYPE_... 0x0E */ +#define RTMP_PACKET_TYPE_FLEX_STREAM_SEND 0x0F +#define RTMP_PACKET_TYPE_FLEX_SHARED_OBJECT 0x10 +#define RTMP_PACKET_TYPE_FLEX_MESSAGE 0x11 +#define RTMP_PACKET_TYPE_INFO 0x12 +#define RTMP_PACKET_TYPE_SHARED_OBJECT 0x13 +#define RTMP_PACKET_TYPE_INVOKE 0x14 +/* RTMP_PACKET_TYPE_... 0x15 */ +#define RTMP_PACKET_TYPE_FLASH_VIDEO 0x16 + +#define RTMP_MAX_HEADER_SIZE 18 + +#define RTMP_PACKET_SIZE_LARGE 0 +#define RTMP_PACKET_SIZE_MEDIUM 1 +#define RTMP_PACKET_SIZE_SMALL 2 +#define RTMP_PACKET_SIZE_MINIMUM 3 + + typedef struct RTMPChunk + { + int c_headerSize; + int c_chunkSize; + char *c_chunk; + char c_header[RTMP_MAX_HEADER_SIZE]; + } RTMPChunk; + + typedef struct RTMPPacket + { + uint8_t m_headerType; + uint8_t m_packetType; + uint8_t m_hasAbsTimestamp; /* timestamp absolute or relative? */ + int m_nChannel; + uint32_t m_nTimeStamp; /* timestamp */ + int32_t m_nInfoField2; /* last 4 bytes in a long header */ + uint32_t m_nBodySize; + uint32_t m_nBytesRead; + RTMPChunk *m_chunk; + char *m_body; + } RTMPPacket; + + typedef struct RTMPSockBuf + { + int sb_socket; + int sb_size; /* number of unprocessed bytes in buffer */ + char *sb_start; /* pointer into sb_pBuffer of next byte to process */ + char sb_buf[RTMP_BUFFER_CACHE_SIZE]; /* data read from socket */ + int sb_timedout; + void *sb_ssl; + } RTMPSockBuf; + + void RTMPPacket_Reset(RTMPPacket *p); + void RTMPPacket_Dump(RTMPPacket *p); + int RTMPPacket_Alloc(RTMPPacket *p, uint32_t nSize); + void RTMPPacket_Free(RTMPPacket *p); + +#define RTMPPacket_IsReady(a) ((a)->m_nBytesRead == (a)->m_nBodySize) + + typedef struct RTMP_LNK + { + AVal hostname; + AVal sockshost; + + AVal playpath0; /* parsed from URL */ + AVal playpath; /* passed in explicitly */ + AVal tcUrl; + AVal swfUrl; + AVal pageUrl; + AVal app; + AVal auth; + AVal flashVer; + AVal subscribepath; + AVal usherToken; + AVal token; + AVal pubUser; + AVal pubPasswd; + AMFObject extras; + int edepth; + + int seekTime; + int stopTime; + +#define RTMP_LF_AUTH 0x0001 /* using auth param */ +#define RTMP_LF_LIVE 0x0002 /* stream is live */ +#define RTMP_LF_SWFV 0x0004 /* do SWF verification */ +#define RTMP_LF_PLST 0x0008 /* send playlist before play */ +#define RTMP_LF_BUFX 0x0010 /* toggle stream on BufferEmpty msg */ +#define RTMP_LF_FTCU 0x0020 /* free tcUrl on close */ +#define RTMP_LF_FAPU 0x0040 /* free app on close */ + int lFlags; + + int swfAge; + + int protocol; + int timeout; /* connection timeout in seconds */ + + int pFlags; /* unused, but kept to avoid breaking ABI */ + + unsigned short socksport; + unsigned short port; + +#ifdef CRYPTO +#define RTMP_SWF_HASHLEN 32 + void *dh; /* for encryption */ + void *rc4keyIn; + void *rc4keyOut; + + uint32_t SWFSize; + uint8_t SWFHash[RTMP_SWF_HASHLEN]; + char SWFVerificationResponse[RTMP_SWF_HASHLEN+10]; +#endif + } RTMP_LNK; + + /* state for read() wrapper */ + typedef struct RTMP_READ + { + char *buf; + char *bufpos; + unsigned int buflen; + uint32_t timestamp; + uint8_t dataType; + uint8_t flags; +#define RTMP_READ_HEADER 0x01 +#define RTMP_READ_RESUME 0x02 +#define RTMP_READ_NO_IGNORE 0x04 +#define RTMP_READ_GOTKF 0x08 +#define RTMP_READ_GOTFLVK 0x10 +#define RTMP_READ_SEEKING 0x20 + int8_t status; +#define RTMP_READ_COMPLETE -3 +#define RTMP_READ_ERROR -2 +#define RTMP_READ_EOF -1 +#define RTMP_READ_IGNORE 0 + + /* if bResume == TRUE */ + uint8_t initialFrameType; + uint32_t nResumeTS; + char *metaHeader; + char *initialFrame; + uint32_t nMetaHeaderSize; + uint32_t nInitialFrameSize; + uint32_t nIgnoredFrameCounter; + uint32_t nIgnoredFlvFrameCounter; + } RTMP_READ; + + typedef struct RTMP_METHOD + { + AVal name; + int num; + } RTMP_METHOD; + + typedef struct RTMP + { + int m_inChunkSize; + int m_outChunkSize; + int m_nBWCheckCounter; + int m_nBytesIn; + int m_nBytesInSent; + int m_nBufferMS; + int m_stream_id; /* returned in _result from createStream */ + int m_mediaChannel; + uint32_t m_mediaStamp; + uint32_t m_pauseStamp; + int m_pausing; + int m_nServerBW; + int m_nClientBW; + uint8_t m_nClientBW2; + uint8_t m_bPlaying; + uint8_t m_bSendEncoding; + uint8_t m_bSendCounter; + + int m_numInvokes; + int m_numCalls; + RTMP_METHOD *m_methodCalls; /* remote method calls queue */ + + int m_channelsAllocatedIn; + int m_channelsAllocatedOut; + RTMPPacket **m_vecChannelsIn; + RTMPPacket **m_vecChannelsOut; + int *m_channelTimestamp; /* abs timestamp of last packet */ + + double m_fAudioCodecs; /* audioCodecs for the connect packet */ + double m_fVideoCodecs; /* videoCodecs for the connect packet */ + double m_fEncoding; /* AMF0 or AMF3 */ + + double m_fDuration; /* duration of stream in seconds */ + + int m_msgCounter; /* RTMPT stuff */ + int m_polling; + int m_resplen; + int m_unackd; + AVal m_clientID; + + RTMP_READ m_read; + RTMPPacket m_write; + RTMPSockBuf m_sb; + RTMP_LNK Link; + } RTMP; + + int RTMP_ParseURL(const char *url, int *protocol, AVal *host, + unsigned int *port, AVal *playpath, AVal *app, AVal *user, AVal *pass); + + void RTMP_ParsePlaypath(AVal *in, AVal *out); + void RTMP_SetBufferMS(RTMP *r, int size); + void RTMP_UpdateBufferMS(RTMP *r); + + int RTMP_SetOpt(RTMP *r, const AVal *opt, AVal *arg); + int RTMP_SetupURL(RTMP *r, char *url); + void RTMP_SetupStream(RTMP *r, int protocol, + AVal *hostname, + unsigned int port, + AVal *sockshost, + AVal *playpath, + AVal *tcUrl, + AVal *swfUrl, + AVal *pageUrl, + AVal *app, + AVal *auth, + AVal *swfSHA256Hash, + uint32_t swfSize, + AVal *flashVer, + AVal *subscribepath, + AVal *usherToken, + int dStart, + int dStop, int bLiveStream, long int timeout); + + int RTMP_Connect(RTMP *r, RTMPPacket *cp); + struct sockaddr; + int RTMP_Connect0(RTMP *r, struct sockaddr *svc); + int RTMP_Connect1(RTMP *r, RTMPPacket *cp); + int RTMP_Serve(RTMP *r); + int RTMP_TLS_Accept(RTMP *r, void *ctx); + + int RTMP_ReadPacket(RTMP *r, RTMPPacket *packet); + int RTMP_SendPacket(RTMP *r, RTMPPacket *packet, int queue); + int RTMP_SendChunk(RTMP *r, RTMPChunk *chunk); + int RTMP_IsConnected(RTMP *r); + int RTMP_Socket(RTMP *r); + int RTMP_IsTimedout(RTMP *r); + double RTMP_GetDuration(RTMP *r); + int RTMP_ToggleStream(RTMP *r); + + int RTMP_ConnectStream(RTMP *r, int seekTime); + int RTMP_ReconnectStream(RTMP *r, int seekTime); + void RTMP_DeleteStream(RTMP *r); + int RTMP_GetNextMediaPacket(RTMP *r, RTMPPacket *packet); + int RTMP_ClientPacket(RTMP *r, RTMPPacket *packet); + + void RTMP_Init(RTMP *r); + void RTMP_Close(RTMP *r); + RTMP *RTMP_Alloc(void); + void RTMP_Free(RTMP *r); + void RTMP_EnableWrite(RTMP *r); + + void *RTMP_TLS_AllocServerContext(const char* cert, const char* key); + void RTMP_TLS_FreeServerContext(void *ctx); + + int RTMP_LibVersion(void); + void RTMP_UserInterrupt(void); /* user typed Ctrl-C */ + + int RTMP_SendCtrl(RTMP *r, short nType, unsigned int nObject, + unsigned int nTime); + + /* caller probably doesn't know current timestamp, should + * just use RTMP_Pause instead + */ + int RTMP_SendPause(RTMP *r, int DoPause, int dTime); + int RTMP_Pause(RTMP *r, int DoPause); + + int RTMP_FindFirstMatchingProperty(AMFObject *obj, const AVal *name, + AMFObjectProperty * p); + + int RTMPSockBuf_Fill(RTMPSockBuf *sb); + int RTMPSockBuf_Send(RTMPSockBuf *sb, const char *buf, int len); + int RTMPSockBuf_Close(RTMPSockBuf *sb); + + int RTMP_SendCreateStream(RTMP *r); + int RTMP_SendSeek(RTMP *r, int dTime); + int RTMP_SendServerBW(RTMP *r); + int RTMP_SendClientBW(RTMP *r); + int RTMP_SendChunkSize(RTMP *r, int size); + void RTMP_DropRequest(RTMP *r, int i, int freeit); + int RTMP_Read(RTMP *r, char *buf, int size); + int RTMP_Write(RTMP *r, const char *buf, int size); + +/* hashswf.c */ + int RTMP_HashSWF(const char *url, unsigned int *size, unsigned char *hash, + int age); + + void HandleChangeChunkSize(RTMP *r, const RTMPPacket *packet); + +#ifdef __cplusplus +}; +#endif + +#endif diff --git a/MediaClient/MediaClient/librtmp/rtmp_sys.h b/MediaClient/MediaClient/librtmp/rtmp_sys.h new file mode 100644 index 0000000..463070b --- /dev/null +++ b/MediaClient/MediaClient/librtmp/rtmp_sys.h @@ -0,0 +1,139 @@ +#ifndef __RTMP_SYS_H__ +#define __RTMP_SYS_H__ +/* + * Copyright (C) 2010 Howard Chu + * + * This file is part of librtmp. + * + * librtmp is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1, + * or (at your option) any later version. + * + * librtmp is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with librtmp see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * http://www.gnu.org/copyleft/lgpl.html + */ + +#ifdef _WIN32 + +#include +#include + +#ifdef _MSC_VER /* MSVC */ +//#define snprintf _snprintf +#define strcasecmp stricmp +#define strncasecmp strnicmp +//#define vsnprintf _vsnprintf +#endif + +#define GetSockError() WSAGetLastError() +#define SetSockError(e) WSASetLastError(e) +#define setsockopt(a,b,c,d,e) (setsockopt)(a,b,c,(const char *)d,(int)e) +//#define EWOULDBLOCK WSAETIMEDOUT /* we don't use nonblocking, but we do use timeouts */ +#define sleep(n) Sleep(n*1000) +#define msleep(n) Sleep(n) +#define SET_RCVTIMEO(tv,s) int tv = s*1000 +#else /* !_WIN32 */ +#include +#include +#include +#include +#include +#include +#include +#include +#define GetSockError() errno +#define SetSockError(e) errno = e +#undef closesocket +#define closesocket(s) close(s) +#define msleep(n) usleep(n*1000) +#define SET_RCVTIMEO(tv,s) struct timeval tv = {s,0} +#endif + +#include "rtmp.h" + +#ifdef USE_POLARSSL +#include +#include +#include +#include +#if POLARSSL_VERSION_NUMBER < 0x01010000 +#define havege_random havege_rand +#endif +#if POLARSSL_VERSION_NUMBER >= 0x01020000 +#define SSL_SET_SESSION(S,resume,timeout,ctx) ssl_set_session(S,ctx) +#else +#define SSL_SET_SESSION(S,resume,timeout,ctx) ssl_set_session(S,resume,timeout,ctx) +#endif +typedef struct tls_ctx { + havege_state hs; + ssl_session ssn; +} tls_ctx; +typedef struct tls_server_ctx { + havege_state *hs; + x509_cert cert; + rsa_context key; + ssl_session ssn; + const char *dhm_P, *dhm_G; +} tls_server_ctx; + +#define TLS_CTX tls_ctx * +#define TLS_client(ctx,s) s = malloc(sizeof(ssl_context)); ssl_init(s);\ + ssl_set_endpoint(s, SSL_IS_CLIENT); ssl_set_authmode(s, SSL_VERIFY_NONE);\ + ssl_set_rng(s, havege_random, &ctx->hs);\ + ssl_set_ciphersuites(s, ssl_default_ciphersuites);\ + SSL_SET_SESSION(s, 1, 600, &ctx->ssn) +#define TLS_server(ctx,s) s = malloc(sizeof(ssl_context)); ssl_init(s);\ + ssl_set_endpoint(s, SSL_IS_SERVER); ssl_set_authmode(s, SSL_VERIFY_NONE);\ + ssl_set_rng(s, havege_random, ((tls_server_ctx*)ctx)->hs);\ + ssl_set_ciphersuites(s, ssl_default_ciphersuites);\ + SSL_SET_SESSION(s, 1, 600, &((tls_server_ctx*)ctx)->ssn);\ + ssl_set_own_cert(s, &((tls_server_ctx*)ctx)->cert, &((tls_server_ctx*)ctx)->key);\ + ssl_set_dh_param(s, ((tls_server_ctx*)ctx)->dhm_P, ((tls_server_ctx*)ctx)->dhm_G) +#define TLS_setfd(s,fd) ssl_set_bio(s, net_recv, &fd, net_send, &fd) +#define TLS_connect(s) ssl_handshake(s) +#define TLS_accept(s) ssl_handshake(s) +#define TLS_read(s,b,l) ssl_read(s,(unsigned char *)b,l) +#define TLS_write(s,b,l) ssl_write(s,(unsigned char *)b,l) +#define TLS_shutdown(s) ssl_close_notify(s) +#define TLS_close(s) ssl_free(s); free(s) + +#elif defined(USE_GNUTLS) +#include +typedef struct tls_ctx { + gnutls_certificate_credentials_t cred; + gnutls_priority_t prios; +} tls_ctx; +#define TLS_CTX tls_ctx * +#define TLS_client(ctx,s) gnutls_init((gnutls_session_t *)(&s), GNUTLS_CLIENT); gnutls_priority_set(s, ctx->prios); gnutls_credentials_set(s, GNUTLS_CRD_CERTIFICATE, ctx->cred) +#define TLS_server(ctx,s) gnutls_init((gnutls_session_t *)(&s), GNUTLS_SERVER); gnutls_priority_set_direct(s, "NORMAL", NULL); gnutls_credentials_set(s, GNUTLS_CRD_CERTIFICATE, ctx) +#define TLS_setfd(s,fd) gnutls_transport_set_ptr(s, (gnutls_transport_ptr_t)(long)fd) +#define TLS_connect(s) gnutls_handshake(s) +#define TLS_accept(s) gnutls_handshake(s) +#define TLS_read(s,b,l) gnutls_record_recv(s,b,l) +#define TLS_write(s,b,l) gnutls_record_send(s,b,l) +#define TLS_shutdown(s) gnutls_bye(s, GNUTLS_SHUT_RDWR) +#define TLS_close(s) gnutls_deinit(s) + +#else /* USE_OPENSSL */ +#define TLS_CTX SSL_CTX * +#define TLS_client(ctx,s) s = SSL_new(ctx) +#define TLS_server(ctx,s) s = SSL_new(ctx) +#define TLS_setfd(s,fd) SSL_set_fd(s,fd) +#define TLS_connect(s) SSL_connect(s) +#define TLS_accept(s) SSL_accept(s) +#define TLS_read(s,b,l) SSL_read(s,b,l) +#define TLS_write(s,b,l) SSL_write(s,b,l) +#define TLS_shutdown(s) SSL_shutdown(s) +#define TLS_close(s) SSL_free(s) + +#endif +#endif diff --git a/MediaClient/MediaClient/libsrt/include/srt/access_control.h b/MediaClient/MediaClient/libsrt/include/srt/access_control.h new file mode 100644 index 0000000..97a1104 --- /dev/null +++ b/MediaClient/MediaClient/libsrt/include/srt/access_control.h @@ -0,0 +1,79 @@ +/* + * SRT - Secure, Reliable, Transport + * Copyright (c) 2020 Haivision Systems Inc. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ + +/***************************************************************************** +written by + Haivision Systems Inc. + *****************************************************************************/ + +#ifndef INC_F_ACCESS_CONTROL_H +#define INC_F_ACCESS_CONTROL_H + +// A list of rejection codes that are SRT specific. + +#define SRT_REJX_FALLBACK 1000 // A code used in case when the application wants to report some problem, but can't precisely specify it. +#define SRT_REJX_KEY_NOTSUP 1001 // The key used in the StreamID keyed string is not supported by the service. +#define SRT_REJX_FILEPATH 1002 // The resource type designates a file and the path is either wrong syntax or not found +#define SRT_REJX_HOSTNOTFOUND 1003 // The `h` host specification was not recognized by the service + +// The list of http codes adopted for SRT. +// An example C++ header for HTTP codes can be found at: +// https://github.com/j-ulrich/http-status-codes-cpp + +// Some of the unused code can be revived in the future, if there +// happens to be a good reason for it. + +#define SRT_REJX_BAD_REQUEST 1400 // General syntax error in the SocketID specification (also a fallback code for undefined cases) +#define SRT_REJX_UNAUTHORIZED 1401 // Authentication failed, provided that the user was correctly identified and access to the required resource would be granted +#define SRT_REJX_OVERLOAD 1402 // The server is too heavily loaded, or you have exceeded credits for accessing the service and the resource. +#define SRT_REJX_FORBIDDEN 1403 // Access denied to the resource by any kind of reason. +#define SRT_REJX_NOTFOUND 1404 // Resource not found at this time. +#define SRT_REJX_BAD_MODE 1405 // The mode specified in `m` key in StreamID is not supported for this request. +#define SRT_REJX_UNACCEPTABLE 1406 // The requested parameters specified in SocketID cannot be satisfied for the requested resource. Also when m=publish and the data format is not acceptable. +// CODE NOT IN USE 407: unused: proxy functionality not predicted +// CODE NOT IN USE 408: unused: no timeout predicted for listener callback +#define SRT_REJX_CONFLICT 1409 // The resource being accessed is already locked for modification. This is in case of m=publish and the specified resource is currently read-only. +// CODE NOT IN USE 410: unused: treated as a specific case of 404 +// CODE NOT IN USE 411: unused: no reason to include lenght in the protocol +// CODE NOT IN USE 412: unused: preconditions not predicted in AC +// CODE NOT IN USE 413: unused: AC size is already defined as 512 +// CODE NOT IN USE 414: unused: AC size is already defined as 512 +#define SRT_REJX_NOTSUP_MEDIA 1415 // The media type is not supported by the application. This is the `t` key that specifies the media type as stream, file and auth, possibly extended by the application. +// CODE NOT IN USE 416: unused: no detailed specification defined +// CODE NOT IN USE 417: unused: expectations not supported +// CODE NOT IN USE 418: unused: sharks do not drink tea +// CODE NOT IN USE 419: not defined in HTTP +// CODE NOT IN USE 420: not defined in HTTP +// CODE NOT IN USE 421: unused: misdirection not supported +// CODE NOT IN USE 422: unused: aligned to general 400 +#define SRT_REJX_LOCKED 1423 // The resource being accessed is locked for any access. +#define SRT_REJX_FAILED_DEPEND 1424 // The request failed because it specified a dependent session ID that has been disconnected. +// CODE NOT IN USE 425: unused: replaying not supported +// CODE NOT IN USE 426: unused: tempting, but it requires resend in connected +// CODE NOT IN USE 427: not defined in HTTP +// CODE NOT IN USE 428: unused: renders to 409 +// CODE NOT IN USE 429: unused: renders to 402 +// CODE NOT IN USE 451: unused: renders to 403 +#define SRT_REJX_ISE 1500 // Unexpected internal server error +#define SRT_REJX_UNIMPLEMENTED 1501 // The request was recognized, but the current version doesn't support it. +#define SRT_REJX_GW 1502 // The server acts as a gateway and the target endpoint rejected the connection. +#define SRT_REJX_DOWN 1503 // The service has been temporarily taken over by a stub reporting this error. The real service can be down for maintenance or crashed. +// CODE NOT IN USE 504: unused: timeout not supported +#define SRT_REJX_VERSION 1505 // SRT version not supported. This might be either unsupported backward compatibility, or an upper value of a version. +// CODE NOT IN USE 506: unused: negotiation and references not supported +#define SRT_REJX_NOROOM 1507 // The data stream cannot be archived due to lacking storage space. This is in case when the request type was to send a file or the live stream to be archived. +// CODE NOT IN USE 508: unused: no redirection supported +// CODE NOT IN USE 509: not defined in HTTP +// CODE NOT IN USE 510: unused: extensions not supported +// CODE NOT IN USE 511: unused: intercepting proxies not supported + + + +#endif diff --git a/MediaClient/MediaClient/libsrt/include/srt/logging_api.h b/MediaClient/MediaClient/libsrt/include/srt/logging_api.h new file mode 100644 index 0000000..4fc3b81 --- /dev/null +++ b/MediaClient/MediaClient/libsrt/include/srt/logging_api.h @@ -0,0 +1,107 @@ +/* + * SRT - Secure, Reliable, Transport + * Copyright (c) 2018 Haivision Systems Inc. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ + +/***************************************************************************** +written by + Haivision Systems Inc. + *****************************************************************************/ + +#ifndef INC_SRT_LOGGING_API_H +#define INC_SRT_LOGGING_API_H + +// These are required for access functions: +// - adding FA (requires set) +// - setting a log stream (requires iostream) +#ifdef __cplusplus +#include +#include +#endif + +#ifdef _WIN32 +#include "win/syslog_defs.h" +#else +#include +#endif + +// Syslog is included so that it provides log level names. +// Haivision log standard requires the same names plus extra one: +#ifndef LOG_DEBUG_TRACE +#define LOG_DEBUG_TRACE 8 +#endif +// It's unused anyway, just for the record. +#define SRT_LOG_LEVEL_MIN LOG_CRIT +#define SRT_LOG_LEVEL_MAX LOG_DEBUG + +// Flags +#define SRT_LOGF_DISABLE_TIME 1 +#define SRT_LOGF_DISABLE_THREADNAME 2 +#define SRT_LOGF_DISABLE_SEVERITY 4 +#define SRT_LOGF_DISABLE_EOL 8 + +// Handler type. +typedef void SRT_LOG_HANDLER_FN(void* opaque, int level, const char* file, int line, const char* area, const char* message); + +#ifdef __cplusplus +namespace srt_logging +{ + + +struct LogFA +{ +private: + int value; +public: + operator int() const { return value; } + + LogFA(int v): value(v) + { + // Generally this was what it has to be used for. + // Unfortunately it couldn't be agreed with the + //logging_fa_all.insert(v); + } +}; + +const LogFA LOGFA_GENERAL = 0; + + + +namespace LogLevel +{ + // There are 3 general levels: + + // A. fatal - this means the application WILL crash. + // B. unexpected: + // - error: this was unexpected for the library + // - warning: this was expected by the library, but may be harmful for the application + // C. expected: + // - note: a significant, but rarely occurring event + // - debug: may occur even very often and enabling it can harm performance + + enum type + { + fatal = LOG_CRIT, + // Fatal vs. Error: with Error, you can still continue. + error = LOG_ERR, + // Error vs. Warning: Warning isn't considered a problem for the library. + warning = LOG_WARNING, + // Warning vs. Note: Note means something unusual, but completely correct behavior. + note = LOG_NOTICE, + // Note vs. Debug: Debug may occur even multiple times in a millisecond. + // (Well, worth noting that Error and Warning potentially also can). + debug = LOG_DEBUG + }; +} + +class Logger; + +} +#endif + +#endif diff --git a/MediaClient/MediaClient/libsrt/include/srt/platform_sys.h b/MediaClient/MediaClient/libsrt/include/srt/platform_sys.h new file mode 100644 index 0000000..cb5d0af --- /dev/null +++ b/MediaClient/MediaClient/libsrt/include/srt/platform_sys.h @@ -0,0 +1,123 @@ +/* + * SRT - Secure, Reliable, Transport + * Copyright (c) 2018 Haivision Systems Inc. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +#ifndef INC_SRT_PLATFORM_SYS_H +#define INC_SRT_PLATFORM_SYS_H + +// INFORMATION +// +// This file collects all required platform-specific declarations +// required to provide everything that the SRT library needs from system. +// +// There's also semi-modular system implemented using SRT_IMPORT_* macros. +// To require a module to be imported, #define SRT_IMPORT_* where * is +// the module name. Currently handled module macros: +// +// SRT_IMPORT_TIME (mach time on Mac, portability gettimeofday on WIN32) +// SRT_IMPORT_EVENT (includes kevent on Mac) + + +#ifdef _WIN32 + #define _CRT_SECURE_NO_WARNINGS 1 // silences windows complaints for sscanf + #include + #include + #include + #include + +#ifndef __MINGW32__ + #include +#endif + + #ifdef SRT_IMPORT_TIME + #include + #endif + + #include + #include + #if defined(_MSC_VER) + #pragma warning(disable: 4251 26812) + #endif +#else + +#if defined(__APPLE__) && __APPLE__ +// Warning: please keep this test as it is, do not make it +// "#if __APPLE__" or "#ifdef __APPLE__". In applications with +// a strict "no warning policy", "#if __APPLE__" triggers an "undef" +// error. With GCC, an old & never fixed bug prevents muting this +// warning (see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53431). +// Before this fix, the solution was to "#define __APPLE__ 0" before +// including srt.h. So, don't use "#ifdef __APPLE__" either. + +// XXX Check if this condition doesn't require checking of +// also other macros, like TARGET_OS_IOS etc. + +#include "TargetConditionals.h" +#define __APPLE_USE_RFC_3542 /* IPV6_PKTINFO */ + +#ifdef SRT_IMPORT_TIME + #include +#endif + +#ifdef SRT_IMPORT_EVENT + #include + #include + #include + #include +#endif + +#endif + +#ifdef BSD +#ifdef SRT_IMPORT_EVENT + #include + #include + #include + #include +#endif +#endif + +#ifdef LINUX + +#ifdef SRT_IMPORT_EVENT + #include + #include +#endif + +#endif + +#ifdef __ANDROID__ + +#ifdef SRT_IMPORT_EVENT + #include +#endif + +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef __cplusplus +// Headers for errno, string and stdlib are +// included indirectly correct C++ way. +#else +#include +#include +#include +#endif + +#endif + +#endif diff --git a/MediaClient/MediaClient/libsrt/include/srt/srt.h b/MediaClient/MediaClient/libsrt/include/srt/srt.h new file mode 100644 index 0000000..c5f60d7 --- /dev/null +++ b/MediaClient/MediaClient/libsrt/include/srt/srt.h @@ -0,0 +1,1001 @@ +/* + * SRT - Secure, Reliable, Transport + * Copyright (c) 2018 Haivision Systems Inc. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ + +/***************************************************************************** +written by + Haivision Systems Inc. + *****************************************************************************/ + +#ifndef INC_SRTC_H +#define INC_SRTC_H + +#include "version.h" + +#include "platform_sys.h" + +#include +#include + +#include "logging_api.h" + +//////////////////////////////////////////////////////////////////////////////// + +//if compiling on VC6.0 or pre-WindowsXP systems +//use -DLEGACY_WIN32 + +//if compiling with MinGW, it only works on XP or above +//use -D_WIN32_WINNT=0x0501 + + +#ifdef _WIN32 + #ifndef __MINGW32__ + // Explicitly define 32-bit and 64-bit numbers + typedef __int32 int32_t; + typedef __int64 int64_t; + typedef unsigned __int32 uint32_t; + #ifndef LEGACY_WIN32 + typedef unsigned __int64 uint64_t; + #else + // VC 6.0 does not support unsigned __int64: may cause potential problems. + typedef __int64 uint64_t; + #endif + + #ifdef SRT_DYNAMIC + #ifdef SRT_EXPORTS + #define SRT_API __declspec(dllexport) + #else + #define SRT_API __declspec(dllimport) + #endif + #else + #define SRT_API + #endif + #else // __MINGW32__ + #define SRT_API + #endif +#else + #define SRT_API __attribute__ ((visibility("default"))) +#endif + + +// For feature tests if you need. +// You can use these constants with SRTO_MINVERSION option. +#define SRT_VERSION_FEAT_HSv5 0x010300 + +#if defined(__cplusplus) && __cplusplus > 201406 +#define SRT_HAVE_CXX17 1 +#else +#define SRT_HAVE_CXX17 0 +#endif + + +// Stadnard attributes + +// When compiling in C++17 mode, use the standard C++17 attributes +// (out of these, only [[deprecated]] is supported in C++14, so +// for all lesser standard use compiler-specific attributes). +#if SRT_HAVE_CXX17 + +// Unused: DO NOT issue a warning if this entity is unused. +#define SRT_ATR_UNUSED [[maybe_unused]] + +// Nodiscard: issue a warning if the return value was discarded. +#define SRT_ATR_NODISCARD [[nodiscard]] + +// GNUG is GNU C/C++; this syntax is also supported by Clang +#elif defined(__GNUC__) +#define SRT_ATR_UNUSED __attribute__((unused)) +#define SRT_ATR_NODISCARD __attribute__((warn_unused_result)) +#elif defined(_MSC_VER) +#define SRT_ATR_UNUSED __pragma(warning(suppress: 4100 4101)) +#define SRT_ATR_NODISCARD _Check_return_ +#else +#define SRT_ATR_UNUSED +#define SRT_ATR_NODISCARD +#endif + + +// DEPRECATED attributes + +// There's needed DEPRECATED and DEPRECATED_PX, as some compilers require them +// before the entity, others after the entity. +// The *_PX version is the prefix attribute, which applies only +// to functions (Microsoft compilers). + +// When deprecating a function, mark it: +// +// SRT_ATR_DEPRECATED_PX retval function(arguments) SRT_ATR_DEPRECATED; +// + +// When SRT_NO_DEPRECATED defined, do not issue any deprecation warnings. +// Regardless of the compiler type. +#if defined(SRT_NO_DEPRECATED) + +#define SRT_ATR_DEPRECATED +#define SRT_ATR_DEPRECATED_PX + +#elif SRT_HAVE_CXX17 + +#define SRT_ATR_DEPRECATED +#define SRT_ATR_DEPRECATED_PX [[deprecated]] + +// GNUG is GNU C/C++; this syntax is also supported by Clang +#elif defined(__GNUC__) +#define SRT_ATR_DEPRECATED_PX +#define SRT_ATR_DEPRECATED __attribute__((deprecated)) +#elif defined(_MSC_VER) +#define SRT_ATR_DEPRECATED_PX __declspec(deprecated) +#define SRT_ATR_DEPRECATED // no postfix-type modifier +#else +#define SRT_ATR_DEPRECATED_PX +#define SRT_ATR_DEPRECATED +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +typedef int32_t SRTSOCKET; + +// The most significant bit 31 (sign bit actually) is left unused, +// so that all people who check the value for < 0 instead of -1 +// still get what they want. The bit 30 is reserved for marking +// the "socket group". Most of the API functions should work +// transparently with the socket descriptor designating a single +// socket or a socket group. +static const int32_t SRTGROUP_MASK = (1 << 30); + +#ifdef _WIN32 + typedef SOCKET SYSSOCKET; +#else + typedef int SYSSOCKET; +#endif + +#ifndef ENABLE_BONDING +#define ENABLE_BONDING 0 +#endif + +typedef SYSSOCKET UDPSOCKET; + + +// Values returned by srt_getsockstate() +typedef enum SRT_SOCKSTATUS { + SRTS_INIT = 1, + SRTS_OPENED, + SRTS_LISTENING, + SRTS_CONNECTING, + SRTS_CONNECTED, + SRTS_BROKEN, + SRTS_CLOSING, + SRTS_CLOSED, + SRTS_NONEXIST +} SRT_SOCKSTATUS; + +// This is a duplicate enum. Must be kept in sync with the original UDT enum for +// backward compatibility until all compat is destroyed. +typedef enum SRT_SOCKOPT { + + SRTO_MSS = 0, // the Maximum Transfer Unit + SRTO_SNDSYN = 1, // if sending is blocking + SRTO_RCVSYN = 2, // if receiving is blocking + SRTO_ISN = 3, // Initial Sequence Number (valid only after srt_connect or srt_accept-ed sockets) + SRTO_FC = 4, // Flight flag size (window size) + SRTO_SNDBUF = 5, // maximum buffer in sending queue + SRTO_RCVBUF = 6, // UDT receiving buffer size + SRTO_LINGER = 7, // waiting for unsent data when closing + SRTO_UDP_SNDBUF = 8, // UDP sending buffer size + SRTO_UDP_RCVBUF = 9, // UDP receiving buffer size + // (some space left) + SRTO_RENDEZVOUS = 12, // rendezvous connection mode + SRTO_SNDTIMEO = 13, // send() timeout + SRTO_RCVTIMEO = 14, // recv() timeout + SRTO_REUSEADDR = 15, // reuse an existing port or create a new one + SRTO_MAXBW = 16, // maximum bandwidth (bytes per second) that the connection can use + SRTO_STATE = 17, // current socket state, see UDTSTATUS, read only + SRTO_EVENT = 18, // current available events associated with the socket + SRTO_SNDDATA = 19, // size of data in the sending buffer + SRTO_RCVDATA = 20, // size of data available for recv + SRTO_SENDER = 21, // Sender mode (independent of conn mode), for encryption, tsbpd handshake. + SRTO_TSBPDMODE = 22, // Enable/Disable TsbPd. Enable -> Tx set origin timestamp, Rx deliver packet at origin time + delay + SRTO_LATENCY = 23, // NOT RECOMMENDED. SET: to both SRTO_RCVLATENCY and SRTO_PEERLATENCY. GET: same as SRTO_RCVLATENCY. + SRTO_INPUTBW = 24, // Estimated input stream rate. + SRTO_OHEADBW, // MaxBW ceiling based on % over input stream rate. Applies when UDT_MAXBW=0 (auto). + SRTO_PASSPHRASE = 26, // Crypto PBKDF2 Passphrase (must be 10..79 characters, or empty to disable encryption) + SRTO_PBKEYLEN, // Crypto key len in bytes {16,24,32} Default: 16 (AES-128) + SRTO_KMSTATE, // Key Material exchange status (UDT_SRTKmState) + SRTO_IPTTL = 29, // IP Time To Live (passthru for system sockopt IPPROTO_IP/IP_TTL) + SRTO_IPTOS, // IP Type of Service (passthru for system sockopt IPPROTO_IP/IP_TOS) + SRTO_TLPKTDROP = 31, // Enable receiver pkt drop + SRTO_SNDDROPDELAY = 32, // Extra delay towards latency for sender TLPKTDROP decision (-1 to off) + SRTO_NAKREPORT = 33, // Enable receiver to send periodic NAK reports + SRTO_VERSION = 34, // Local SRT Version + SRTO_PEERVERSION, // Peer SRT Version (from SRT Handshake) + SRTO_CONNTIMEO = 36, // Connect timeout in msec. Caller default: 3000, rendezvous (x 10) + SRTO_DRIFTTRACER = 37, // Enable or disable drift tracer + SRTO_MININPUTBW = 38, // Minimum estimate of input stream rate. + // (some space left) + SRTO_SNDKMSTATE = 40, // (GET) the current state of the encryption at the peer side + SRTO_RCVKMSTATE, // (GET) the current state of the encryption at the agent side + SRTO_LOSSMAXTTL, // Maximum possible packet reorder tolerance (number of packets to receive after loss to send lossreport) + SRTO_RCVLATENCY, // TsbPd receiver delay (mSec) to absorb burst of missed packet retransmission + SRTO_PEERLATENCY, // Minimum value of the TsbPd receiver delay (mSec) for the opposite side (peer) + SRTO_MINVERSION, // Minimum SRT version needed for the peer (peers with less version will get connection reject) + SRTO_STREAMID, // A string set to a socket and passed to the listener's accepted socket + SRTO_CONGESTION, // Congestion controller type selection + SRTO_MESSAGEAPI, // In File mode, use message API (portions of data with boundaries) + SRTO_PAYLOADSIZE, // Maximum payload size sent in one UDP packet (0 if unlimited) + SRTO_TRANSTYPE = 50, // Transmission type (set of options required for given transmission type) + SRTO_KMREFRESHRATE, // After sending how many packets the encryption key should be flipped to the new key + SRTO_KMPREANNOUNCE, // How many packets before key flip the new key is annnounced and after key flip the old one decommissioned + SRTO_ENFORCEDENCRYPTION, // Connection to be rejected or quickly broken when one side encryption set or bad password + SRTO_IPV6ONLY, // IPV6_V6ONLY mode + SRTO_PEERIDLETIMEO, // Peer-idle timeout (max time of silence heard from peer) in [ms] + SRTO_BINDTODEVICE, // Forward the SOL_SOCKET/SO_BINDTODEVICE option on socket (pass packets only from that device) + SRTO_GROUPCONNECT, // Set on a listener to allow group connection (ENABLE_BONDING) + SRTO_GROUPMINSTABLETIMEO, // Minimum Link Stability timeout (backup mode) in milliseconds (ENABLE_BONDING) + SRTO_GROUPTYPE, // Group type to which an accepted socket is about to be added, available in the handshake (ENABLE_BONDING) + SRTO_PACKETFILTER = 60, // Add and configure a packet filter + SRTO_RETRANSMITALGO = 61, // An option to select packet retransmission algorithm + + SRTO_E_SIZE // Always last element, not a valid option. +} SRT_SOCKOPT; + + +#ifdef __cplusplus + + +#if __cplusplus > 199711L // C++11 + // Newer compilers report error when [[deprecated]] is applied to types, + // and C++11 and higher uses this. + // Note that this doesn't exactly use the 'deprecated' attribute, + // as it's introduced in C++14. What is actually used here is the + // fact that unknown attributes are ignored, but still warned about. + // This should only catch an eye - and that's what it does. +#define SRT_DEPRECATED_OPTION(value) ((SRT_SOCKOPT [[deprecated]])value) +#else + // Older (pre-C++11) compilers use gcc deprecated applied to a typedef + typedef SRT_ATR_DEPRECATED_PX SRT_SOCKOPT SRT_SOCKOPT_DEPRECATED SRT_ATR_DEPRECATED; +#define SRT_DEPRECATED_OPTION(value) ((SRT_SOCKOPT_DEPRECATED)value) +#endif + + +#else + +// deprecated enum labels are supported only since gcc 6, so in C there +// will be a whole deprecated enum type, as it's not an error in C to mix +// enum types +enum SRT_ATR_DEPRECATED SRT_SOCKOPT_DEPRECATED +{ + + // Dummy last option, as every entry ends with a comma + SRTO_DEPRECATED_END = 0 + +}; +#define SRT_DEPRECATED_OPTION(value) ((enum SRT_SOCKOPT_DEPRECATED)value) +#endif + +// Note that there are no deprecated options at the moment, but the mechanism +// stays so that it can be used in future. Example: +// #define SRTO_STRICTENC SRT_DEPRECATED_OPTION(53) + +typedef enum SRT_TRANSTYPE +{ + SRTT_LIVE, + SRTT_FILE, + SRTT_INVALID +} SRT_TRANSTYPE; + +// These sizes should be used for Live mode. In Live mode you should not +// exceed the size that fits in a single MTU. + +// This is for MPEG TS and it's a default SRTO_PAYLOADSIZE for SRTT_LIVE. +static const int SRT_LIVE_DEF_PLSIZE = 1316; // = 188*7, recommended for MPEG TS + +// This is the maximum payload size for Live mode, should you have a different +// payload type than MPEG TS. +static const int SRT_LIVE_MAX_PLSIZE = 1456; // MTU(1500) - UDP.hdr(28) - SRT.hdr(16) + +// Latency for Live transmission: default is 120 +static const int SRT_LIVE_DEF_LATENCY_MS = 120; + +// Importrant note: please add new fields to this structure to the end and don't remove any existing fields +struct CBytePerfMon +{ + // global measurements + int64_t msTimeStamp; // time since the UDT entity is started, in milliseconds + int64_t pktSentTotal; // total number of sent data packets, including retransmissions + int64_t pktRecvTotal; // total number of received packets + int pktSndLossTotal; // total number of lost packets (sender side) + int pktRcvLossTotal; // total number of lost packets (receiver side) + int pktRetransTotal; // total number of retransmitted packets + int pktSentACKTotal; // total number of sent ACK packets + int pktRecvACKTotal; // total number of received ACK packets + int pktSentNAKTotal; // total number of sent NAK packets + int pktRecvNAKTotal; // total number of received NAK packets + int64_t usSndDurationTotal; // total time duration when UDT is sending data (idle time exclusive) + //>new + int pktSndDropTotal; // number of too-late-to-send dropped packets + int pktRcvDropTotal; // number of too-late-to play missing packets + int pktRcvUndecryptTotal; // number of undecrypted packets + uint64_t byteSentTotal; // total number of sent data bytes, including retransmissions + uint64_t byteRecvTotal; // total number of received bytes + uint64_t byteRcvLossTotal; // total number of lost bytes + uint64_t byteRetransTotal; // total number of retransmitted bytes + uint64_t byteSndDropTotal; // number of too-late-to-send dropped bytes + uint64_t byteRcvDropTotal; // number of too-late-to play missing bytes (estimate based on average packet size) + uint64_t byteRcvUndecryptTotal; // number of undecrypted bytes + //< + + // local measurements + int64_t pktSent; // number of sent data packets, including retransmissions + int64_t pktRecv; // number of received packets + int pktSndLoss; // number of lost packets (sender side) + int pktRcvLoss; // number of lost packets (receiver side) + int pktRetrans; // number of retransmitted packets + int pktRcvRetrans; // number of retransmitted packets received + int pktSentACK; // number of sent ACK packets + int pktRecvACK; // number of received ACK packets + int pktSentNAK; // number of sent NAK packets + int pktRecvNAK; // number of received NAK packets + double mbpsSendRate; // sending rate in Mb/s + double mbpsRecvRate; // receiving rate in Mb/s + int64_t usSndDuration; // busy sending time (i.e., idle time exclusive) + int pktReorderDistance; // size of order discrepancy in received sequences + double pktRcvAvgBelatedTime; // average time of packet delay for belated packets (packets with sequence past the ACK) + int64_t pktRcvBelated; // number of received AND IGNORED packets due to having come too late + //>new + int pktSndDrop; // number of too-late-to-send dropped packets + int pktRcvDrop; // number of too-late-to play missing packets + int pktRcvUndecrypt; // number of undecrypted packets + uint64_t byteSent; // number of sent data bytes, including retransmissions + uint64_t byteRecv; // number of received bytes + uint64_t byteRcvLoss; // number of retransmitted bytes + uint64_t byteRetrans; // number of retransmitted bytes + uint64_t byteSndDrop; // number of too-late-to-send dropped bytes + uint64_t byteRcvDrop; // number of too-late-to play missing bytes (estimate based on average packet size) + uint64_t byteRcvUndecrypt; // number of undecrypted bytes + //< + + // instant measurements + double usPktSndPeriod; // packet sending period, in microseconds + int pktFlowWindow; // flow window size, in number of packets + int pktCongestionWindow; // congestion window size, in number of packets + int pktFlightSize; // number of packets on flight + double msRTT; // RTT, in milliseconds + double mbpsBandwidth; // estimated bandwidth, in Mb/s + int byteAvailSndBuf; // available UDT sender buffer size + int byteAvailRcvBuf; // available UDT receiver buffer size + //>new + double mbpsMaxBW; // Transmit Bandwidth ceiling (Mbps) + int byteMSS; // MTU + + int pktSndBuf; // UnACKed packets in UDT sender + int byteSndBuf; // UnACKed bytes in UDT sender + int msSndBuf; // UnACKed timespan (msec) of UDT sender + int msSndTsbPdDelay; // Timestamp-based Packet Delivery Delay + + int pktRcvBuf; // Undelivered packets in UDT receiver + int byteRcvBuf; // Undelivered bytes of UDT receiver + int msRcvBuf; // Undelivered timespan (msec) of UDT receiver + int msRcvTsbPdDelay; // Timestamp-based Packet Delivery Delay + + int pktSndFilterExtraTotal; // number of control packets supplied by packet filter + int pktRcvFilterExtraTotal; // number of control packets received and not supplied back + int pktRcvFilterSupplyTotal; // number of packets that the filter supplied extra (e.g. FEC rebuilt) + int pktRcvFilterLossTotal; // number of packet loss not coverable by filter + + int pktSndFilterExtra; // number of control packets supplied by packet filter + int pktRcvFilterExtra; // number of control packets received and not supplied back + int pktRcvFilterSupply; // number of packets that the filter supplied extra (e.g. FEC rebuilt) + int pktRcvFilterLoss; // number of packet loss not coverable by filter + int pktReorderTolerance; // packet reorder tolerance value + //< + + // New stats in 1.5.0 + + // Total + int64_t pktSentUniqueTotal; // total number of data packets sent by the application + int64_t pktRecvUniqueTotal; // total number of packets to be received by the application + uint64_t byteSentUniqueTotal; // total number of data bytes, sent by the application + uint64_t byteRecvUniqueTotal; // total number of data bytes to be received by the application + + // Local + int64_t pktSentUnique; // number of data packets sent by the application + int64_t pktRecvUnique; // number of packets to be received by the application + uint64_t byteSentUnique; // number of data bytes, sent by the application + uint64_t byteRecvUnique; // number of data bytes to be received by the application +}; + +//////////////////////////////////////////////////////////////////////////////// + +// Error codes - define outside the CUDTException class +// because otherwise you'd have to use CUDTException::MJ_SUCCESS etc. +// in all throw CUDTException expressions. +enum CodeMajor +{ + MJ_UNKNOWN = -1, + MJ_SUCCESS = 0, + MJ_SETUP = 1, + MJ_CONNECTION = 2, + MJ_SYSTEMRES = 3, + MJ_FILESYSTEM = 4, + MJ_NOTSUP = 5, + MJ_AGAIN = 6, + MJ_PEERERROR = 7 +}; + +enum CodeMinor +{ + // These are "minor" error codes from various "major" categories + // MJ_SETUP + MN_NONE = 0, + MN_TIMEOUT = 1, + MN_REJECTED = 2, + MN_NORES = 3, + MN_SECURITY = 4, + MN_CLOSED = 5, + // MJ_CONNECTION + MN_CONNLOST = 1, + MN_NOCONN = 2, + // MJ_SYSTEMRES + MN_THREAD = 1, + MN_MEMORY = 2, + MN_OBJECT = 3, + // MJ_FILESYSTEM + MN_SEEKGFAIL = 1, + MN_READFAIL = 2, + MN_SEEKPFAIL = 3, + MN_WRITEFAIL = 4, + // MJ_NOTSUP + MN_ISBOUND = 1, + MN_ISCONNECTED = 2, + MN_INVAL = 3, + MN_SIDINVAL = 4, + MN_ISUNBOUND = 5, + MN_NOLISTEN = 6, + MN_ISRENDEZVOUS = 7, + MN_ISRENDUNBOUND = 8, + MN_INVALMSGAPI = 9, + MN_INVALBUFFERAPI = 10, + MN_BUSY = 11, + MN_XSIZE = 12, + MN_EIDINVAL = 13, + MN_EEMPTY = 14, + MN_BUSYPORT = 15, + // MJ_AGAIN + MN_WRAVAIL = 1, + MN_RDAVAIL = 2, + MN_XMTIMEOUT = 3, + MN_CONGESTION = 4 +}; + + +// Stupid, but effective. This will be #undefined, so don't worry. +#define MJ(major) (1000 * MJ_##major) +#define MN(major, minor) (1000 * MJ_##major + MN_##minor) + +// Some better way to define it, and better for C language. +typedef enum SRT_ERRNO +{ + SRT_EUNKNOWN = -1, + SRT_SUCCESS = MJ_SUCCESS, + + SRT_ECONNSETUP = MJ(SETUP), + SRT_ENOSERVER = MN(SETUP, TIMEOUT), + SRT_ECONNREJ = MN(SETUP, REJECTED), + SRT_ESOCKFAIL = MN(SETUP, NORES), + SRT_ESECFAIL = MN(SETUP, SECURITY), + SRT_ESCLOSED = MN(SETUP, CLOSED), + + SRT_ECONNFAIL = MJ(CONNECTION), + SRT_ECONNLOST = MN(CONNECTION, CONNLOST), + SRT_ENOCONN = MN(CONNECTION, NOCONN), + + SRT_ERESOURCE = MJ(SYSTEMRES), + SRT_ETHREAD = MN(SYSTEMRES, THREAD), + SRT_ENOBUF = MN(SYSTEMRES, MEMORY), + SRT_ESYSOBJ = MN(SYSTEMRES, OBJECT), + + SRT_EFILE = MJ(FILESYSTEM), + SRT_EINVRDOFF = MN(FILESYSTEM, SEEKGFAIL), + SRT_ERDPERM = MN(FILESYSTEM, READFAIL), + SRT_EINVWROFF = MN(FILESYSTEM, SEEKPFAIL), + SRT_EWRPERM = MN(FILESYSTEM, WRITEFAIL), + + SRT_EINVOP = MJ(NOTSUP), + SRT_EBOUNDSOCK = MN(NOTSUP, ISBOUND), + SRT_ECONNSOCK = MN(NOTSUP, ISCONNECTED), + SRT_EINVPARAM = MN(NOTSUP, INVAL), + SRT_EINVSOCK = MN(NOTSUP, SIDINVAL), + SRT_EUNBOUNDSOCK = MN(NOTSUP, ISUNBOUND), + SRT_ENOLISTEN = MN(NOTSUP, NOLISTEN), + SRT_ERDVNOSERV = MN(NOTSUP, ISRENDEZVOUS), + SRT_ERDVUNBOUND = MN(NOTSUP, ISRENDUNBOUND), + SRT_EINVALMSGAPI = MN(NOTSUP, INVALMSGAPI), + SRT_EINVALBUFFERAPI = MN(NOTSUP, INVALBUFFERAPI), + SRT_EDUPLISTEN = MN(NOTSUP, BUSY), + SRT_ELARGEMSG = MN(NOTSUP, XSIZE), + SRT_EINVPOLLID = MN(NOTSUP, EIDINVAL), + SRT_EPOLLEMPTY = MN(NOTSUP, EEMPTY), + SRT_EBINDCONFLICT = MN(NOTSUP, BUSYPORT), + + SRT_EASYNCFAIL = MJ(AGAIN), + SRT_EASYNCSND = MN(AGAIN, WRAVAIL), + SRT_EASYNCRCV = MN(AGAIN, RDAVAIL), + SRT_ETIMEOUT = MN(AGAIN, XMTIMEOUT), + SRT_ECONGEST = MN(AGAIN, CONGESTION), + + SRT_EPEERERR = MJ(PEERERROR) +} SRT_ERRNO; + + +#undef MJ +#undef MN + +enum SRT_REJECT_REASON +{ + SRT_REJ_UNKNOWN, // initial set when in progress + SRT_REJ_SYSTEM, // broken due to system function error + SRT_REJ_PEER, // connection was rejected by peer + SRT_REJ_RESOURCE, // internal problem with resource allocation + SRT_REJ_ROGUE, // incorrect data in handshake messages + SRT_REJ_BACKLOG, // listener's backlog exceeded + SRT_REJ_IPE, // internal program error + SRT_REJ_CLOSE, // socket is closing + SRT_REJ_VERSION, // peer is older version than agent's minimum set + SRT_REJ_RDVCOOKIE, // rendezvous cookie collision + SRT_REJ_BADSECRET, // wrong password + SRT_REJ_UNSECURE, // password required or unexpected + SRT_REJ_MESSAGEAPI, // streamapi/messageapi collision + SRT_REJ_CONGESTION, // incompatible congestion-controller type + SRT_REJ_FILTER, // incompatible packet filter + SRT_REJ_GROUP, // incompatible group + SRT_REJ_TIMEOUT, // connection timeout + + SRT_REJ_E_SIZE, +}; + +// XXX This value remains for some time, but it's deprecated +// Planned deprecation removal: rel1.6.0. +#define SRT_REJ__SIZE SRT_REJ_E_SIZE + +// Reject category codes: + +#define SRT_REJC_VALUE(code) (1000 * (code/1000)) +#define SRT_REJC_INTERNAL 0 // Codes from above SRT_REJECT_REASON enum +#define SRT_REJC_PREDEFINED 1000 // Standard server error codes +#define SRT_REJC_USERDEFINED 2000 // User defined error codes + + +// Logging API - specialization for SRT. + +// WARNING: This part is generated. + +// Logger Functional Areas +// Note that 0 is "general". + +// Values 0* - general, unqualified +// Values 1* - control +// Values 2* - receiving +// Values 3* - sending +// Values 4* - management + +// Made by #define so that it's available also for C API. + +// Use ../scripts/generate-logging-defs.tcl to regenerate. + +// SRT_LOGFA BEGIN GENERATED SECTION { + +#define SRT_LOGFA_GENERAL 0 // gglog: General uncategorized log, for serious issues only +#define SRT_LOGFA_SOCKMGMT 1 // smlog: Socket create/open/close/configure activities +#define SRT_LOGFA_CONN 2 // cnlog: Connection establishment and handshake +#define SRT_LOGFA_XTIMER 3 // xtlog: The checkTimer and around activities +#define SRT_LOGFA_TSBPD 4 // tslog: The TsBPD thread +#define SRT_LOGFA_RSRC 5 // rslog: System resource allocation and management + +#define SRT_LOGFA_CONGEST 7 // cclog: Congestion control module +#define SRT_LOGFA_PFILTER 8 // pflog: Packet filter module + +#define SRT_LOGFA_API_CTRL 11 // aclog: API part for socket and library managmenet + +#define SRT_LOGFA_QUE_CTRL 13 // qclog: Queue control activities + +#define SRT_LOGFA_EPOLL_UPD 16 // eilog: EPoll, internal update activities + +#define SRT_LOGFA_API_RECV 21 // arlog: API part for receiving +#define SRT_LOGFA_BUF_RECV 22 // brlog: Buffer, receiving side +#define SRT_LOGFA_QUE_RECV 23 // qrlog: Queue, receiving side +#define SRT_LOGFA_CHN_RECV 24 // krlog: CChannel, receiving side +#define SRT_LOGFA_GRP_RECV 25 // grlog: Group, receiving side + +#define SRT_LOGFA_API_SEND 31 // aslog: API part for sending +#define SRT_LOGFA_BUF_SEND 32 // bslog: Buffer, sending side +#define SRT_LOGFA_QUE_SEND 33 // qslog: Queue, sending side +#define SRT_LOGFA_CHN_SEND 34 // kslog: CChannel, sending side +#define SRT_LOGFA_GRP_SEND 35 // gslog: Group, sending side + +#define SRT_LOGFA_INTERNAL 41 // inlog: Internal activities not connected directly to a socket + +#define SRT_LOGFA_QUE_MGMT 43 // qmlog: Queue, management part +#define SRT_LOGFA_CHN_MGMT 44 // kmlog: CChannel, management part +#define SRT_LOGFA_GRP_MGMT 45 // gmlog: Group, management part +#define SRT_LOGFA_EPOLL_API 46 // ealog: EPoll, API part + +#define SRT_LOGFA_HAICRYPT 6 // hclog: Haicrypt module area +#define SRT_LOGFA_APPLOG 10 // aplog: Applications + +// } SRT_LOGFA END GENERATED SECTION + +// To make a typical int64_t size, although still use std::bitset. +// C API will carry it over. +#define SRT_LOGFA_LASTNONE 63 + +enum SRT_KM_STATE +{ + SRT_KM_S_UNSECURED = 0, //No encryption + SRT_KM_S_SECURING = 1, //Stream encrypted, exchanging Keying Material + SRT_KM_S_SECURED = 2, //Stream encrypted, keying Material exchanged, decrypting ok. + SRT_KM_S_NOSECRET = 3, //Stream encrypted and no secret to decrypt Keying Material + SRT_KM_S_BADSECRET = 4 //Stream encrypted and wrong secret, cannot decrypt Keying Material +}; + +enum SRT_EPOLL_OPT +{ + SRT_EPOLL_OPT_NONE = 0x0, // fallback + + // Values intended to be the same as in ``. + // so that if system values are used by mistake, they should have the same effect + // This applies to: IN, OUT, ERR and ET. + + /// Ready for 'recv' operation: + /// + /// - For stream mode it means that at least 1 byte is available. + /// In this mode the buffer may extract only a part of the packet, + /// leaving next data possible for extraction later. + /// + /// - For message mode it means that there is at least one packet + /// available (this may change in future, as it is desired that + /// one full message should only wake up, not single packet of a + /// not yet extractable message). + /// + /// - For live mode it means that there's at least one packet + /// ready to play. + /// + /// - For listener sockets, this means that there is a new connection + /// waiting for pickup through the `srt_accept()` call, that is, + /// the next call to `srt_accept()` will succeed without blocking + /// (see an alias SRT_EPOLL_ACCEPT below). + SRT_EPOLL_IN = 0x1, + + /// Ready for 'send' operation. + /// + /// - For stream mode it means that there's a free space in the + /// sender buffer for at least 1 byte of data. The next send + /// operation will only allow to send as much data as it is free + /// space in the buffer. + /// + /// - For message mode it means that there's a free space for at + /// least one UDP packet. The edge-triggered mode can be used to + /// pick up updates as the free space in the sender buffer grows. + /// + /// - For live mode it means that there's a free space for at least + /// one UDP packet. On the other hand, no readiness for OUT usually + /// means an extraordinary congestion on the link, meaning also that + /// you should immediately slow down the sending rate or you may get + /// a connection break soon. + /// + /// - For non-blocking sockets used with `srt_connect*` operation, + /// this flag simply means that the connection was established. + SRT_EPOLL_OUT = 0x4, + + /// The socket has encountered an error in the last operation + /// and the next operation on that socket will end up with error. + /// You can retry the operation, but getting the error from it + /// is certain, so you may as well close the socket. + SRT_EPOLL_ERR = 0x8, + + // To avoid confusion in the internal code, the following + // duplicates are introduced to improve clarity. + SRT_EPOLL_CONNECT = SRT_EPOLL_OUT, + SRT_EPOLL_ACCEPT = SRT_EPOLL_IN, + + SRT_EPOLL_UPDATE = 0x10, + SRT_EPOLL_ET = 1u << 31 +}; +// These are actually flags - use a bit container: +typedef int32_t SRT_EPOLL_T; + +// Define which epoll flags determine events. All others are special flags. +#define SRT_EPOLL_EVENTTYPES (SRT_EPOLL_IN | SRT_EPOLL_OUT | SRT_EPOLL_UPDATE | SRT_EPOLL_ERR) +#define SRT_EPOLL_ETONLY (SRT_EPOLL_UPDATE) + +enum SRT_EPOLL_FLAGS +{ + /// This allows the EID container to be empty when calling the waiting + /// function with infinite time. This means an infinite hangup, although + /// a socket can be added to this EID from a separate thread. + SRT_EPOLL_ENABLE_EMPTY = 1, + + /// This makes the waiting function check if there is output container + /// passed to it, and report an error if it isn't. By default it is allowed + /// that the output container is 0 size or NULL and therefore the readiness + /// state is reported only as a number of ready sockets from return value. + SRT_EPOLL_ENABLE_OUTPUTCHECK = 2 +}; + +#ifdef __cplusplus +// In C++ these enums cannot be treated as int and glued by operator |. +// Unless this operator is defined. +inline SRT_EPOLL_OPT operator|(SRT_EPOLL_OPT a1, SRT_EPOLL_OPT a2) +{ + return SRT_EPOLL_OPT( (int)a1 | (int)a2 ); +} + +#endif + +typedef struct CBytePerfMon SRT_TRACEBSTATS; + +static const SRTSOCKET SRT_INVALID_SOCK = -1; +static const int SRT_ERROR = -1; + +// library initialization +SRT_API int srt_startup(void); +SRT_API int srt_cleanup(void); + +// +// Socket operations +// +// DEPRECATED: srt_socket with 3 arguments. All these arguments are ignored +// and socket creation doesn't need any arguments. Use srt_create_socket(). +// Planned deprecation removal: rel1.6.0 +SRT_ATR_DEPRECATED_PX SRT_API SRTSOCKET srt_socket(int, int, int) SRT_ATR_DEPRECATED; +SRT_API SRTSOCKET srt_create_socket(void); + +SRT_API int srt_bind (SRTSOCKET u, const struct sockaddr* name, int namelen); +SRT_API int srt_bind_acquire (SRTSOCKET u, UDPSOCKET sys_udp_sock); +// Old name of srt_bind_acquire(), please don't use +// Planned deprecation removal: rel1.6.0 +SRT_ATR_DEPRECATED_PX static inline int srt_bind_peerof(SRTSOCKET u, UDPSOCKET sys_udp_sock) SRT_ATR_DEPRECATED; +static inline int srt_bind_peerof (SRTSOCKET u, UDPSOCKET sys_udp_sock) { return srt_bind_acquire(u, sys_udp_sock); } +SRT_API int srt_listen (SRTSOCKET u, int backlog); +SRT_API SRTSOCKET srt_accept (SRTSOCKET u, struct sockaddr* addr, int* addrlen); +SRT_API SRTSOCKET srt_accept_bond (const SRTSOCKET listeners[], int lsize, int64_t msTimeOut); +typedef int srt_listen_callback_fn (void* opaq, SRTSOCKET ns, int hsversion, const struct sockaddr* peeraddr, const char* streamid); +SRT_API int srt_listen_callback(SRTSOCKET lsn, srt_listen_callback_fn* hook_fn, void* hook_opaque); +typedef void srt_connect_callback_fn (void* opaq, SRTSOCKET ns, int errorcode, const struct sockaddr* peeraddr, int token); +SRT_API int srt_connect_callback(SRTSOCKET clr, srt_connect_callback_fn* hook_fn, void* hook_opaque); +SRT_API int srt_connect (SRTSOCKET u, const struct sockaddr* name, int namelen); +SRT_API int srt_connect_debug(SRTSOCKET u, const struct sockaddr* name, int namelen, int forced_isn); +SRT_API int srt_connect_bind (SRTSOCKET u, const struct sockaddr* source, + const struct sockaddr* target, int len); +SRT_API int srt_rendezvous (SRTSOCKET u, const struct sockaddr* local_name, int local_namelen, + const struct sockaddr* remote_name, int remote_namelen); + +SRT_API int srt_close (SRTSOCKET u); +SRT_API int srt_getpeername (SRTSOCKET u, struct sockaddr* name, int* namelen); +SRT_API int srt_getsockname (SRTSOCKET u, struct sockaddr* name, int* namelen); +SRT_API int srt_getsockopt (SRTSOCKET u, int level /*ignored*/, SRT_SOCKOPT optname, void* optval, int* optlen); +SRT_API int srt_setsockopt (SRTSOCKET u, int level /*ignored*/, SRT_SOCKOPT optname, const void* optval, int optlen); +SRT_API int srt_getsockflag (SRTSOCKET u, SRT_SOCKOPT opt, void* optval, int* optlen); +SRT_API int srt_setsockflag (SRTSOCKET u, SRT_SOCKOPT opt, const void* optval, int optlen); + +typedef struct SRT_SocketGroupData_ SRT_SOCKGROUPDATA; + +typedef struct SRT_MsgCtrl_ +{ + int flags; // Left for future + int msgttl; // TTL for a message (millisec), default -1 (no TTL limitation) + int inorder; // Whether a message is allowed to supersede partially lost one. Unused in stream and live mode. + int boundary; // 0:mid pkt, 1(01b):end of frame, 2(11b):complete frame, 3(10b): start of frame + int64_t srctime; // source time since epoch (usec), 0: use internal time (sender) + int32_t pktseq; // sequence number of the first packet in received message (unused for sending) + int32_t msgno; // message number (output value for both sending and receiving) + SRT_SOCKGROUPDATA* grpdata; + size_t grpdata_size; +} SRT_MSGCTRL; + +// Trap representation for sequence and message numbers +// This value means that this is "unset", and it's never +// a result of an operation made on this number. +static const int32_t SRT_SEQNO_NONE = -1; // -1: no seq (0 is a valid seqno!) +static const int32_t SRT_MSGNO_NONE = -1; // -1: unset +static const int32_t SRT_MSGNO_CONTROL = 0; // 0: control (used by packet filter) + +static const int SRT_MSGTTL_INF = -1; // unlimited TTL specification for message TTL + +// XXX Might be useful also other special uses of -1: +// - -1 as infinity for srt_epoll_wait +// - -1 as a trap index value used in list.cpp + +// You are free to use either of these two methods to set SRT_MSGCTRL object +// to default values: either call srt_msgctrl_init(&obj) or obj = srt_msgctrl_default. +SRT_API void srt_msgctrl_init(SRT_MSGCTRL* mctrl); +SRT_API extern const SRT_MSGCTRL srt_msgctrl_default; + +// The send/receive functions. +// These functions have different names due to different sets of parameters +// to be supplied. Not all of them are needed or make sense in all modes: + +// Plain: supply only the buffer and its size. +// Msg: supply additionally +// - TTL (message is not delivered when exceeded) and +// - INORDER (when false, the message is allowed to be delivered in different +// order than when it was sent, when the later message is earlier ready to +// deliver) +// Msg2: Supply extra parameters in SRT_MSGCTRL. When receiving, these +// parameters will be filled, as needed. NULL is acceptable, in which case +// the defaults are used. + +// +// Sending functions +// +SRT_API int srt_send (SRTSOCKET u, const char* buf, int len); +SRT_API int srt_sendmsg (SRTSOCKET u, const char* buf, int len, int ttl/* = -1*/, int inorder/* = false*/); +SRT_API int srt_sendmsg2(SRTSOCKET u, const char* buf, int len, SRT_MSGCTRL *mctrl); + +// +// Receiving functions +// +SRT_API int srt_recv (SRTSOCKET u, char* buf, int len); + +// srt_recvmsg is actually an alias to srt_recv, it stays under the old name for compat reasons. +SRT_API int srt_recvmsg (SRTSOCKET u, char* buf, int len); +SRT_API int srt_recvmsg2(SRTSOCKET u, char *buf, int len, SRT_MSGCTRL *mctrl); + + +// Special send/receive functions for files only. +#define SRT_DEFAULT_SENDFILE_BLOCK 364000 +#define SRT_DEFAULT_RECVFILE_BLOCK 7280000 +SRT_API int64_t srt_sendfile(SRTSOCKET u, const char* path, int64_t* offset, int64_t size, int block); +SRT_API int64_t srt_recvfile(SRTSOCKET u, const char* path, int64_t* offset, int64_t size, int block); + + +// last error detection +SRT_API const char* srt_getlasterror_str(void); +SRT_API int srt_getlasterror(int* errno_loc); +SRT_API const char* srt_strerror(int code, int errnoval); +SRT_API void srt_clearlasterror(void); + +// Performance tracking +// Performance monitor with Byte counters for better bitrate estimation. +SRT_API int srt_bstats(SRTSOCKET u, SRT_TRACEBSTATS * perf, int clear); +// Performance monitor with Byte counters and instantaneous stats instead of moving averages for Snd/Rcvbuffer sizes. +SRT_API int srt_bistats(SRTSOCKET u, SRT_TRACEBSTATS * perf, int clear, int instantaneous); + +// Socket Status (for problem tracking) +SRT_API SRT_SOCKSTATUS srt_getsockstate(SRTSOCKET u); + +SRT_API int srt_epoll_create(void); +SRT_API int srt_epoll_clear_usocks(int eid); +SRT_API int srt_epoll_add_usock(int eid, SRTSOCKET u, const int* events); +SRT_API int srt_epoll_add_ssock(int eid, SYSSOCKET s, const int* events); +SRT_API int srt_epoll_remove_usock(int eid, SRTSOCKET u); +SRT_API int srt_epoll_remove_ssock(int eid, SYSSOCKET s); +SRT_API int srt_epoll_update_usock(int eid, SRTSOCKET u, const int* events); +SRT_API int srt_epoll_update_ssock(int eid, SYSSOCKET s, const int* events); + +SRT_API int srt_epoll_wait(int eid, SRTSOCKET* readfds, int* rnum, SRTSOCKET* writefds, int* wnum, int64_t msTimeOut, + SYSSOCKET* lrfds, int* lrnum, SYSSOCKET* lwfds, int* lwnum); +typedef struct SRT_EPOLL_EVENT_STR +{ + SRTSOCKET fd; + int events; // SRT_EPOLL_IN | SRT_EPOLL_OUT | SRT_EPOLL_ERR +#ifdef __cplusplus + SRT_EPOLL_EVENT_STR(SRTSOCKET s, int ev): fd(s), events(ev) {} + SRT_EPOLL_EVENT_STR(): fd(-1), events(0) {} // NOTE: allows singular values, no init. +#endif +} SRT_EPOLL_EVENT; +SRT_API int srt_epoll_uwait(int eid, SRT_EPOLL_EVENT* fdsSet, int fdsSize, int64_t msTimeOut); + +SRT_API int32_t srt_epoll_set(int eid, int32_t flags); +SRT_API int srt_epoll_release(int eid); + +// Logging control + +SRT_API void srt_setloglevel(int ll); +SRT_API void srt_addlogfa(int fa); +SRT_API void srt_dellogfa(int fa); +SRT_API void srt_resetlogfa(const int* fara, size_t fara_size); +// This isn't predicted, will be only available in SRT C++ API. +// For the time being, until this API is ready, use UDT::setlogstream. +// SRT_API void srt_setlogstream(std::ostream& stream); +SRT_API void srt_setloghandler(void* opaque, SRT_LOG_HANDLER_FN* handler); +SRT_API void srt_setlogflags(int flags); + + +SRT_API int srt_getsndbuffer(SRTSOCKET sock, size_t* blocks, size_t* bytes); + +SRT_API int srt_getrejectreason(SRTSOCKET sock); +SRT_API int srt_setrejectreason(SRTSOCKET sock, int value); +// The srt_rejectreason_msg[] array is deprecated (as unsafe). +// Planned removal: v1.6.0. +SRT_API SRT_ATR_DEPRECATED extern const char* const srt_rejectreason_msg []; +SRT_API const char* srt_rejectreason_str(int id); + +SRT_API uint32_t srt_getversion(void); + +SRT_API int64_t srt_time_now(void); + +SRT_API int64_t srt_connection_time(SRTSOCKET sock); + +// Possible internal clock types +#define SRT_SYNC_CLOCK_STDCXX_STEADY 0 // C++11 std::chrono::steady_clock +#define SRT_SYNC_CLOCK_GETTIME_MONOTONIC 1 // clock_gettime with CLOCK_MONOTONIC +#define SRT_SYNC_CLOCK_WINQPC 2 +#define SRT_SYNC_CLOCK_MACH_ABSTIME 3 +#define SRT_SYNC_CLOCK_POSIX_GETTIMEOFDAY 4 +#define SRT_SYNC_CLOCK_AMD64_RDTSC 5 +#define SRT_SYNC_CLOCK_IA32_RDTSC 6 +#define SRT_SYNC_CLOCK_IA64_ITC 7 + +SRT_API int srt_clock_type(void); + +// SRT Socket Groups API (ENABLE_BONDING) + +typedef enum SRT_GROUP_TYPE +{ + SRT_GTYPE_UNDEFINED, + SRT_GTYPE_BROADCAST, + SRT_GTYPE_BACKUP, + // ... + SRT_GTYPE_E_END +} SRT_GROUP_TYPE; + +// Free-form flags for groups +// Flags may be type-specific! +static const uint32_t SRT_GFLAG_SYNCONMSG = 1; + +typedef enum SRT_MemberStatus +{ + SRT_GST_PENDING, // The socket is created correctly, but not yet ready for getting data. + SRT_GST_IDLE, // The socket is ready to be activated + SRT_GST_RUNNING, // The socket was already activated and is in use + SRT_GST_BROKEN // The last operation broke the socket, it should be closed. +} SRT_MEMBERSTATUS; + +struct SRT_SocketGroupData_ +{ + SRTSOCKET id; + struct sockaddr_storage peeraddr; // Don't want to expose sockaddr_any to public API + SRT_SOCKSTATUS sockstate; + uint16_t weight; + SRT_MEMBERSTATUS memberstate; + int result; + int token; +}; + +typedef struct SRT_SocketOptionObject SRT_SOCKOPT_CONFIG; + +typedef struct SRT_GroupMemberConfig_ +{ + SRTSOCKET id; + struct sockaddr_storage srcaddr; + struct sockaddr_storage peeraddr; // Don't want to expose sockaddr_any to public API + uint16_t weight; + SRT_SOCKOPT_CONFIG* config; + int errorcode; + int token; +} SRT_SOCKGROUPCONFIG; + +SRT_API SRTSOCKET srt_create_group(SRT_GROUP_TYPE); +SRT_API SRTSOCKET srt_groupof(SRTSOCKET socket); +SRT_API int srt_group_data(SRTSOCKET socketgroup, SRT_SOCKGROUPDATA* output, size_t* inoutlen); + +SRT_API SRT_SOCKOPT_CONFIG* srt_create_config(void); +SRT_API void srt_delete_config(SRT_SOCKOPT_CONFIG* config /*nullable*/); +SRT_API int srt_config_add(SRT_SOCKOPT_CONFIG* config, SRT_SOCKOPT option, const void* contents, int len); + +SRT_API SRT_SOCKGROUPCONFIG srt_prepare_endpoint(const struct sockaddr* src /*nullable*/, const struct sockaddr* adr, int namelen); +SRT_API int srt_connect_group(SRTSOCKET group, SRT_SOCKGROUPCONFIG name[], int arraysize); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/MediaClient/MediaClient/libsrt/include/srt/udt.h b/MediaClient/MediaClient/libsrt/include/srt/udt.h new file mode 100644 index 0000000..ee4c02f --- /dev/null +++ b/MediaClient/MediaClient/libsrt/include/srt/udt.h @@ -0,0 +1,274 @@ +/* + * SRT - Secure, Reliable, Transport + * Copyright (c) 2018 Haivision Systems Inc. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ + +/***************************************************************************** +Copyright (c) 2001 - 2011, The Board of Trustees of the University of Illinois. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +* Redistributions of source code must retain the above + copyright notice, this list of conditions and the + following disclaimer. + +* Redistributions in binary form must reproduce the + above copyright notice, this list of conditions + and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of the University of Illinois + nor the names of its contributors may be used to + endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +/***************************************************************************** +written by + Yunhong Gu, last updated 01/18/2011 +modified by + Haivision Systems Inc. +*****************************************************************************/ + +/* WARNING!!! + * Since now this file is a "C and C++ header". + * It should be then able to be interpreted by C compiler, so + * all C++-oriented things must be ifdef'd-out by __cplusplus. + * + * Mind also comments - to prevent any portability problems, + * B/C++ comments (// -> EOL) should not be used unless the + * area is under __cplusplus condition already. + * + * NOTE: this file contains _STRUCTURES_ that are common to C and C++, + * plus some functions and other functionalities ONLY FOR C++. This + * file doesn't contain _FUNCTIONS_ predicted to be used in C - see udtc.h + */ + +#ifndef INC_SRT_UDT_H +#define INC_SRT_UDT_H + +#include "srt.h" + +/* +* SRT_ENABLE_THREADCHECK IS SET IN MAKEFILE, NOT HERE +*/ +#if defined(SRT_ENABLE_THREADCHECK) +#include "threadcheck.h" +#else +#define THREAD_STATE_INIT(name) +#define THREAD_EXIT() +#define THREAD_PAUSED() +#define THREAD_RESUMED() +#define INCREMENT_THREAD_ITERATIONS() +#endif + +#ifdef __cplusplus +#include +#include +#include +#include +#endif + +//////////////////////////////////////////////////////////////////////////////// + +//if compiling on VC6.0 or pre-WindowsXP systems +//use -DLEGACY_WIN32 + +//if compiling with MinGW, it only works on XP or above +//use -D_WIN32_WINNT=0x0501 + +//////////////////////////////////////////////////////////////////////////////// + +struct CPerfMon +{ + // global measurements + int64_t msTimeStamp; // time since the UDT entity is started, in milliseconds + int64_t pktSentTotal; // total number of sent data packets, including retransmissions + int64_t pktRecvTotal; // total number of received packets + int pktSndLossTotal; // total number of lost packets (sender side) + int pktRcvLossTotal; // total number of lost packets (receiver side) + int pktRetransTotal; // total number of retransmitted packets + int pktRcvRetransTotal; // total number of retransmitted packets received + int pktSentACKTotal; // total number of sent ACK packets + int pktRecvACKTotal; // total number of received ACK packets + int pktSentNAKTotal; // total number of sent NAK packets + int pktRecvNAKTotal; // total number of received NAK packets + int64_t usSndDurationTotal; // total time duration when UDT is sending data (idle time exclusive) + + // local measurements + int64_t pktSent; // number of sent data packets, including retransmissions + int64_t pktRecv; // number of received packets + int pktSndLoss; // number of lost packets (sender side) + int pktRcvLoss; // number of lost packets (receiver side) + int pktRetrans; // number of retransmitted packets + int pktRcvRetrans; // number of retransmitted packets received + int pktSentACK; // number of sent ACK packets + int pktRecvACK; // number of received ACK packets + int pktSentNAK; // number of sent NAK packets + int pktRecvNAK; // number of received NAK packets + double mbpsSendRate; // sending rate in Mb/s + double mbpsRecvRate; // receiving rate in Mb/s + int64_t usSndDuration; // busy sending time (i.e., idle time exclusive) + int pktReorderDistance; // size of order discrepancy in received sequences + double pktRcvAvgBelatedTime; // average time of packet delay for belated packets (packets with sequence past the ACK) + int64_t pktRcvBelated; // number of received AND IGNORED packets due to having come too late + + // instant measurements + double usPktSndPeriod; // packet sending period, in microseconds + int pktFlowWindow; // flow window size, in number of packets + int pktCongestionWindow; // congestion window size, in number of packets + int pktFlightSize; // number of packets on flight + double msRTT; // RTT, in milliseconds + double mbpsBandwidth; // estimated bandwidth, in Mb/s + int byteAvailSndBuf; // available UDT sender buffer size + int byteAvailRcvBuf; // available UDT receiver buffer size +}; + +typedef SRTSOCKET UDTSOCKET; //legacy alias + +#ifdef __cplusplus + +namespace srt { class CUDTException; } + +namespace UDT +{ + +typedef srt::CUDTException ERRORINFO; +typedef CPerfMon TRACEINFO; + +// This facility is used only for select() function. +// This is considered obsolete and the epoll() functionality rather should be used. +typedef std::set UDSET; +#define UD_CLR(u, uset) ((uset)->erase(u)) +#define UD_ISSET(u, uset) ((uset)->find(u) != (uset)->end()) +#define UD_SET(u, uset) ((uset)->insert(u)) +#define UD_ZERO(uset) ((uset)->clear()) + +SRT_API extern const SRTSOCKET INVALID_SOCK; +#undef ERROR +SRT_API extern const int ERROR; + +SRT_API int startup(); +SRT_API int cleanup(); +SRT_API SRTSOCKET socket(); +inline SRTSOCKET socket(int , int , int ) { return socket(); } +SRT_API int bind(SRTSOCKET u, const struct sockaddr* name, int namelen); +SRT_API int bind2(SRTSOCKET u, UDPSOCKET udpsock); +SRT_API int listen(SRTSOCKET u, int backlog); +SRT_API SRTSOCKET accept(SRTSOCKET u, struct sockaddr* addr, int* addrlen); +SRT_API int connect(SRTSOCKET u, const struct sockaddr* name, int namelen); +SRT_API int close(SRTSOCKET u); +SRT_API int getpeername(SRTSOCKET u, struct sockaddr* name, int* namelen); +SRT_API int getsockname(SRTSOCKET u, struct sockaddr* name, int* namelen); +SRT_API int getsockopt(SRTSOCKET u, int level, SRT_SOCKOPT optname, void* optval, int* optlen); +SRT_API int setsockopt(SRTSOCKET u, int level, SRT_SOCKOPT optname, const void* optval, int optlen); +SRT_API int send(SRTSOCKET u, const char* buf, int len, int flags); +SRT_API int recv(SRTSOCKET u, char* buf, int len, int flags); + +SRT_API int sendmsg(SRTSOCKET u, const char* buf, int len, int ttl = -1, bool inorder = false, int64_t srctime = 0); +SRT_API int recvmsg(SRTSOCKET u, char* buf, int len, uint64_t& srctime); +SRT_API int recvmsg(SRTSOCKET u, char* buf, int len); + +SRT_API int64_t sendfile(SRTSOCKET u, std::fstream& ifs, int64_t& offset, int64_t size, int block = 364000); +SRT_API int64_t recvfile(SRTSOCKET u, std::fstream& ofs, int64_t& offset, int64_t size, int block = 7280000); +SRT_API int64_t sendfile2(SRTSOCKET u, const char* path, int64_t* offset, int64_t size, int block = 364000); +SRT_API int64_t recvfile2(SRTSOCKET u, const char* path, int64_t* offset, int64_t size, int block = 7280000); + +// select and selectEX are DEPRECATED; please use epoll. +SRT_API int select(int nfds, UDSET* readfds, UDSET* writefds, UDSET* exceptfds, const struct timeval* timeout); +SRT_API int selectEx(const std::vector& fds, std::vector* readfds, + std::vector* writefds, std::vector* exceptfds, int64_t msTimeOut); + +SRT_API int epoll_create(); +SRT_API int epoll_add_usock(int eid, SRTSOCKET u, const int* events = NULL); +SRT_API int epoll_add_ssock(int eid, SYSSOCKET s, const int* events = NULL); +SRT_API int epoll_remove_usock(int eid, SRTSOCKET u); +SRT_API int epoll_remove_ssock(int eid, SYSSOCKET s); +SRT_API int epoll_update_usock(int eid, SRTSOCKET u, const int* events = NULL); +SRT_API int epoll_update_ssock(int eid, SYSSOCKET s, const int* events = NULL); +SRT_API int epoll_wait(int eid, std::set* readfds, std::set* writefds, int64_t msTimeOut, + std::set* lrfds = NULL, std::set* wrfds = NULL); +SRT_API int epoll_wait2(int eid, SRTSOCKET* readfds, int* rnum, SRTSOCKET* writefds, int* wnum, int64_t msTimeOut, + SYSSOCKET* lrfds = NULL, int* lrnum = NULL, SYSSOCKET* lwfds = NULL, int* lwnum = NULL); +SRT_API int epoll_uwait(const int eid, SRT_EPOLL_EVENT* fdsSet, int fdsSize, int64_t msTimeOut); +SRT_API int epoll_release(int eid); +SRT_API ERRORINFO& getlasterror(); +SRT_API int getlasterror_code(); +SRT_API const char* getlasterror_desc(); +SRT_API int bstats(SRTSOCKET u, SRT_TRACEBSTATS* perf, bool clear = true); +SRT_API SRT_SOCKSTATUS getsockstate(SRTSOCKET u); + +} // namespace UDT + +// This is a log configuration used inside SRT. +// Applications using SRT, if they want to use the logging mechanism +// are free to create their own logger configuration objects for their +// own logger FA objects, or create their own. The object of this type +// is required to initialize the logger FA object. +namespace srt_logging { struct LogConfig; } +SRT_API extern srt_logging::LogConfig srt_logger_config; + +namespace srt +{ + +// This is a C++ SRT API extension. This is not a part of legacy UDT API. +SRT_API void setloglevel(srt_logging::LogLevel::type ll); +SRT_API void addlogfa(srt_logging::LogFA fa); +SRT_API void dellogfa(srt_logging::LogFA fa); +SRT_API void resetlogfa(std::set fas); +SRT_API void resetlogfa(const int* fara, size_t fara_size); +SRT_API void setlogstream(std::ostream& stream); +SRT_API void setloghandler(void* opaque, SRT_LOG_HANDLER_FN* handler); +SRT_API void setlogflags(int flags); + +SRT_API bool setstreamid(SRTSOCKET u, const std::string& sid); +SRT_API std::string getstreamid(SRTSOCKET u); + +// Namespace alias +namespace logging { + using namespace srt_logging; +} + +} // namespace srt + +// Planned deprecated removal: rel1.6.0 +// There's also no portable way possible to enforce a deprecation +// compiler warning, so leaving as is. +namespace UDT +{ + // Backward-compatible aliases, just for a case someone was using it. + using srt::setloglevel; + using srt::addlogfa; + using srt::dellogfa; + using srt::resetlogfa; + using srt::setlogstream; + using srt::setloghandler; + using srt::setlogflags; + using srt::setstreamid; + using srt::getstreamid; +} + + +#endif /* __cplusplus */ + +#endif diff --git a/MediaClient/MediaClient/libsrt/include/srt/version.h b/MediaClient/MediaClient/libsrt/include/srt/version.h new file mode 100644 index 0000000..02002de --- /dev/null +++ b/MediaClient/MediaClient/libsrt/include/srt/version.h @@ -0,0 +1,34 @@ +/* + * SRT - Secure, Reliable, Transport + * Copyright (c) 2018 Haivision Systems Inc. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ + +/***************************************************************************** +written by + Haivision Systems Inc. + *****************************************************************************/ + +#ifndef INC_SRT_VERSION_H +#define INC_SRT_VERSION_H + +// To construct version value +#define SRT_MAKE_VERSION(major, minor, patch) \ + ((patch) + ((minor)*0x100) + ((major)*0x10000)) +#define SRT_MAKE_VERSION_VALUE SRT_MAKE_VERSION + +#define SRT_VERSION_MAJOR 1 +#define SRT_VERSION_MINOR 5 +#define SRT_VERSION_PATCH 0 +/* #undef SRT_VERSION_BUILD */ + +#define SRT_VERSION_STRING "1.5.0" +#define SRT_VERSION_VALUE \ + SRT_MAKE_VERSION_VALUE( \ + SRT_VERSION_MAJOR, SRT_VERSION_MINOR, SRT_VERSION_PATCH ) + +#endif // INC_SRT_VERSION_H diff --git a/MediaClient/MediaClient/libsrt/include/srt/win/syslog_defs.h b/MediaClient/MediaClient/libsrt/include/srt/win/syslog_defs.h new file mode 100644 index 0000000..7d83126 --- /dev/null +++ b/MediaClient/MediaClient/libsrt/include/srt/win/syslog_defs.h @@ -0,0 +1,45 @@ +#ifndef INC_SRT_WINDOWS_SYSLOG_DEFS_H +#define INC_SRT_WINDOWS_SYSLOG_DEFS_H + +#define LOG_EMERG 0 +#define LOG_ALERT 1 +#define LOG_CRIT 2 +#define LOG_ERR 3 +#define LOG_WARNING 4 +#define LOG_NOTICE 5 +#define LOG_INFO 6 +#define LOG_DEBUG 7 + +#define LOG_PRIMASK 0x07 + +#define LOG_PRI(p) ((p) & LOG_PRIMASK) +#define LOG_MAKEPRI(fac, pri) (((fac) << 3) | (pri)) + +#define LOG_KERN (0<<3) +#define LOG_USER (1<<3) +#define LOG_MAIL (2<<3) +#define LOG_DAEMON (3<<3) +#define LOG_AUTH (4<<3) +#define LOG_SYSLOG (5<<3) +#define LOG_LPR (6<<3) +#define LOG_NEWS (7<<3) +#define LOG_UUCP (8<<3) +#define LOG_CRON (9<<3) +#define LOG_AUTHPRIV (10<<3) +#define LOG_FTP (11<<3) + +/* Codes through 15 are reserved for system use */ +#define LOG_LOCAL0 (16<<3) +#define LOG_LOCAL1 (17<<3) +#define LOG_LOCAL2 (18<<3) +#define LOG_LOCAL3 (19<<3) +#define LOG_LOCAL4 (20<<3) +#define LOG_LOCAL5 (21<<3) +#define LOG_LOCAL6 (22<<3) +#define LOG_LOCAL7 (23<<3) + +#define LOG_NFACILITIES 24 +#define LOG_FACMASK 0x03f8 +#define LOG_FAC(p) (((p) & LOG_FACMASK) >> 3) + +#endif diff --git a/MediaClient/MediaClient/libsrt/lib/linux/libsrt.so.1.5.0 b/MediaClient/MediaClient/libsrt/lib/linux/libsrt.so.1.5.0 new file mode 100644 index 0000000..c101b71 Binary files /dev/null and b/MediaClient/MediaClient/libsrt/lib/linux/libsrt.so.1.5.0 differ diff --git a/MediaClient/MediaClient/main.cpp b/MediaClient/MediaClient/main.cpp new file mode 100644 index 0000000..81d6096 --- /dev/null +++ b/MediaClient/MediaClient/main.cpp @@ -0,0 +1,125 @@ +/*************************************************************************************** + * + * 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 "MediaClient.h" +#include "rtsp_parse.h" +#include "http_parse.h" +#include +#include +#if __LINUX_OS__ +#include +#endif + +/**************************************************************************************/ + + +#if defined(_DEBUG) || defined(DEBUG) +static void av_log_callback(void* ptr, int level, const char* fmt, va_list vl) +{ + int htlv = HT_LOG_INFO; + char buff[4096]; + + if (av_log_get_level() < level) + { + return; + } + + vsnprintf(buff, sizeof(buff), fmt, vl); + + if (AV_LOG_TRACE == level || AV_LOG_VERBOSE == level) + { + htlv = HT_LOG_TRC; + } + else if (AV_LOG_DEBUG == level) + { + htlv = HT_LOG_DBG; + } + else if (AV_LOG_INFO == level) + { + htlv = HT_LOG_INFO; + } + else if (AV_LOG_WARNING == level) + { + htlv = HT_LOG_WARN; + } + else if (AV_LOG_ERROR == level) + { + htlv = HT_LOG_ERR; + } + else if (AV_LOG_FATAL == level || AV_LOG_PANIC == level) + { + htlv = HT_LOG_FATAL; + } + + log_print(htlv, "%s", buff); +} +#endif + +void setAppStyleSheet(QApplication & app) +{ + QFile file(QCoreApplication::applicationDirPath() + "/MediaClient.css"); + + file.open(QFile::ReadOnly); + + app.setStyleSheet(QLatin1String(file.readAll())); +} + +int main(int argc, char *argv[]) +{ + QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); + + QApplication a(argc, argv); + + QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath()); + QCoreApplication::setApplicationName("mediaclient"); + QCoreApplication::setOrganizationName("happytimesoft"); + + setAppStyleSheet(a); + + network_init(); + +#if __LINUX_OS__ + // Ignore broken pipes + signal(SIGPIPE, SIG_IGN); + + SDL_Init(SDL_INIT_AUDIO | SDL_INIT_VIDEO); +#endif + +#if defined(_DEBUG) || defined(DEBUG) + av_log_set_callback(av_log_callback); + av_log_set_level(AV_LOG_QUIET); +#endif + + sys_buf_init(200); + rtsp_parse_buf_init(200); + http_msg_buf_init(200); + + MediaClient w(0, Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint); + +#ifdef IOS + w.show(); +#else + w.showMaximized(); +#endif + + return a.exec(); +} + + + diff --git a/MediaClient/MediaClient/media/alsa.cpp b/MediaClient/MediaClient/media/alsa.cpp new file mode 100644 index 0000000..dd4c2bd --- /dev/null +++ b/MediaClient/MediaClient/media/alsa.cpp @@ -0,0 +1,214 @@ +/*************************************************************************************** + * + * 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 "alsa.h" + + +BOOL alsa_get_device_name(int index, char * filename, int len) +{ + int card = -1, count = 0, ret; + snd_ctl_card_info_t * info; + + snd_ctl_card_info_alloca(&info); + + ret = snd_card_next(&card); + + while (ret == 0 && card != -1) + { + char name[16]; + snd_ctl_t * ctl; + + snprintf(name, sizeof(name), "hw:%d", card); + + if (snd_ctl_open(&ctl, name, SND_CTL_NONBLOCK) < 0) + { + ret = snd_card_next(&card); + continue; + } + + if (snd_ctl_card_info(ctl, info) < 0) + { + snd_ctl_close(ctl); + ret = snd_card_next(&card); + continue; + } + + snd_ctl_close(ctl); + + if (index == count) + { + strncpy(filename, name, len); + return TRUE; + } + + ret = snd_card_next(&card); + } + + return FALSE; +} + +BOOL alsa_open_device(ALSACTX * p_alsa, snd_pcm_stream_t mode, uint32 * sample_rate, int channels) +{ + int res, flags; + snd_pcm_format_t format; + snd_pcm_t *h; + snd_pcm_hw_params_t *hw_params; + snd_pcm_uframes_t buffer_size, period_size = 0; + + if (NULL == p_alsa) + { + return FALSE; + } + + flags = SND_PCM_NONBLOCK; + format = SND_PCM_FORMAT_S16_LE; + + p_alsa->framesize = 16 / 8 * channels; + + res = snd_pcm_open(&h, p_alsa->devname, mode, flags); + if (res < 0) + { + log_print(HT_LOG_ERR, "cannot open audio device %s (%s)\r\n", p_alsa->devname, snd_strerror(res)); + return FALSE; + } + + snd_pcm_hw_params_alloca(&hw_params); + + res = snd_pcm_hw_params_any(h, hw_params); + if (res < 0) + { + log_print(HT_LOG_ERR, "cannot initialize hardware parameter structure (%s)\r\n", snd_strerror(res)); + goto fail; + } + + res = snd_pcm_hw_params_set_access(h, hw_params, SND_PCM_ACCESS_RW_INTERLEAVED); + if (res < 0) + { + log_print(HT_LOG_ERR, "cannot set access type (%s)\r\n", snd_strerror(res)); + goto fail; + } + + res = snd_pcm_hw_params_set_format(h, hw_params, format); + if (res < 0) + { + log_print(HT_LOG_ERR, "cannot set sample format %d (%s)\r\n", format, snd_strerror(res)); + goto fail; + } + + res = snd_pcm_hw_params_set_rate_near(h, hw_params, sample_rate, 0); + if (res < 0) + { + log_print(HT_LOG_ERR, "cannot set sample rate (%s)\r\n", snd_strerror(res)); + goto fail; + } + + res = snd_pcm_hw_params_set_channels(h, hw_params, channels); + if (res < 0) + { + log_print(HT_LOG_ERR, "cannot set channel count to %d (%s)\r\n", channels, snd_strerror(res)); + goto fail; + } + + snd_pcm_hw_params_get_buffer_size_max(hw_params, &buffer_size); + + buffer_size = (buffer_size > ALSA_BUFFER_SIZE_MAX ? ALSA_BUFFER_SIZE_MAX : buffer_size); + + res = snd_pcm_hw_params_set_buffer_size_near(h, hw_params, &buffer_size); + if (res < 0) + { + log_print(HT_LOG_ERR, "cannot set ALSA buffer size (%s)\r\n", snd_strerror(res)); + goto fail; + } + + snd_pcm_hw_params_get_period_size_min(hw_params, &period_size, NULL); + + if (!period_size) + { + period_size = buffer_size / 4; + } + + if (period_size < 64) + { + period_size = 64; + } + + res = snd_pcm_hw_params_set_period_size_near(h, hw_params, &period_size, NULL); + if (res < 0) + { + log_print(HT_LOG_ERR, "cannot set ALSA period size (%s)\r\n", snd_strerror(res)); + goto fail; + } + + p_alsa->period_size = period_size; + + res = snd_pcm_hw_params(h, hw_params); + if (res < 0) + { + log_print(HT_LOG_ERR, "cannot set parameters (%s)\r\n", snd_strerror(res)); + goto fail; + } + + p_alsa->handler = h; + + return TRUE; + +fail: + snd_pcm_close(h); + return FALSE; +} + +void alsa_close_device(ALSACTX * p_alsa) +{ + if (p_alsa->handler) + { + if (snd_pcm_stream(p_alsa->handler) == SND_PCM_STREAM_PLAYBACK) + { + snd_pcm_nonblock(p_alsa->handler, 0); + snd_pcm_drain(p_alsa->handler); + } + + snd_pcm_close(p_alsa->handler); + p_alsa->handler = NULL; + } +} + +int alsa_xrun_recover(snd_pcm_t * handler, int err) +{ + if (err == -EPIPE) + { + err = snd_pcm_prepare(handler); + if (err < 0) + { + log_print(HT_LOG_ERR, "snd_pcm_prepare failed: %s\r\n", snd_strerror(err)); + } + else + { + return 0; + } + } + else if (err == -ESTRPIPE) + { + log_print(HT_LOG_ERR, "-ESTRPIPE... Unsupported!\n"); + } + + return err; +} + + diff --git a/MediaClient/MediaClient/media/alsa.h b/MediaClient/MediaClient/media/alsa.h new file mode 100644 index 0000000..2ec99d0 --- /dev/null +++ b/MediaClient/MediaClient/media/alsa.h @@ -0,0 +1,59 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef ALSA_H +#define ALSA_H + +#include "sys_inc.h" +#include + +/***************************************************************************************/ + +#define ALSA_BUFFER_SIZE_MAX 131072 + +/***************************************************************************************/ + +typedef struct +{ + char devname[32]; // device name + snd_pcm_t * handler; // device handler + int period_size; // preferred size for reads and writes, in frames + int framesize; // bytes per sample * channels +} ALSACTX; + + +#ifdef __cplusplus +extern "C" { +#endif + +BOOL alsa_get_device_name(int index, char * filename, int len); +BOOL alsa_open_device(ALSACTX * p_alsa, snd_pcm_stream_t mode, uint32 * sample_rate, int channels); +void alsa_close_device(ALSACTX * p_alsa); +int alsa_xrun_recover(snd_pcm_t * handler, int err); + + +#ifdef __cplusplus +} +#endif + + +#endif + + + diff --git a/MediaClient/MediaClient/media/audio_capture.cpp b/MediaClient/MediaClient/media/audio_capture.cpp new file mode 100644 index 0000000..44e464a --- /dev/null +++ b/MediaClient/MediaClient/media/audio_capture.cpp @@ -0,0 +1,119 @@ +/*************************************************************************************** + * + * 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 "audio_capture.h" +#include "lock.h" + +/***************************************************************************************/ + +CAudioCapture * CAudioCapture::m_pInstance[] = {NULL, NULL, NULL, NULL}; +void * CAudioCapture::m_pInstMutex = sys_os_create_mutex(); + +/***************************************************************************************/ + +CAudioCapture::CAudioCapture() +{ + m_nDevIndex = 0; + m_nRefCnt = 0; + + m_nChannels = 2; + m_nSampleRate = 8000; + m_nBitrate = 0; + m_nSampleSize = 16; + + m_pMutex = sys_os_create_mutex(); + m_bInited = FALSE; + m_bCapture = FALSE; + m_hCapture = 0; +} + +CAudioCapture::~CAudioCapture() +{ + sys_os_destroy_sig_mutex(m_pMutex); +} + +CAudioCapture * CAudioCapture::getInstance(int devid) +{ + return NULL; +} + +void CAudioCapture::freeInstance(int devid) +{ + if (devid < 0 || devid >= MAX_AUDIO_DEV_NUMS) + { + return; + } + + if (m_pInstance[devid]) + { + sys_os_mutex_enter(m_pInstMutex); + + if (m_pInstance[devid]) + { + m_pInstance[devid]->m_nRefCnt--; + + if (m_pInstance[devid]->m_nRefCnt <= 0) + { + delete m_pInstance[devid]; + m_pInstance[devid] = NULL; + } + } + + sys_os_mutex_leave(m_pInstMutex); + } +} + +char * CAudioCapture::getAuxSDPLine(int rtp_pt) +{ + return m_encoder.getAuxSDPLine(rtp_pt); +} + +int CAudioCapture::getDeviceNums() +{ + return 0; +} + +BOOL CAudioCapture::initCapture(int codec, int samplerate, int channels, int bitrate) +{ + return FALSE; +} + +BOOL CAudioCapture::startCapture() +{ + return FALSE; +} + +void CAudioCapture::stopCapture(void) +{ + +} + +void CAudioCapture::addCallback(AudioDataCallback pCallback, void * pUserdata) +{ + m_encoder.addCallback(pCallback, pUserdata); +} + +void CAudioCapture::delCallback(AudioDataCallback pCallback, void * pUserdata) +{ + m_encoder.delCallback(pCallback, pUserdata); +} + + + diff --git a/MediaClient/MediaClient/media/audio_capture.h b/MediaClient/MediaClient/media/audio_capture.h new file mode 100644 index 0000000..abaf9c2 --- /dev/null +++ b/MediaClient/MediaClient/media/audio_capture.h @@ -0,0 +1,87 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef _AUDIO_CAPTURE_H +#define _AUDIO_CAPTURE_H + +/***************************************************************************************/ + +#include "audio_encoder.h" + +/***************************************************************************************/ + +#define MAX_AUDIO_DEV_NUMS 8 +#define DEF_AUDIO_CAP_DEV (MAX_AUDIO_DEV_NUMS-1) + +/***************************************************************************************/ + +class CAudioCapture +{ +public: + virtual ~CAudioCapture(); + + // get audio capture devcie nubmers + static int getDeviceNums(); + + // get single instance + static CAudioCapture * getInstance(int devid); + // free instance + virtual void freeInstance(int devid); + + virtual BOOL initCapture(int codec, int sampleRate, int channels, int bitrate); + virtual BOOL startCapture(); + + virtual char * getAuxSDPLine(int rtp_pt); + + virtual void addCallback(AudioDataCallback pCallback, void * pUserdata); + virtual void delCallback(AudioDataCallback pCallback, void * pUserdata); + + virtual BOOL isCapturing() {return m_bCapture;} + +protected: + CAudioCapture(); + CAudioCapture(CAudioCapture &obj); + + virtual void stopCapture(); + +public: + int m_nDevIndex; + int m_nRefCnt; // single instance ref count + + static void * m_pInstMutex; // instance mutex + static CAudioCapture * m_pInstance[MAX_AUDIO_DEV_NUMS]; + +protected: + int m_nChannels; // channel number + int m_nSampleRate; // sample rate + int m_nBitrate; // bitrate + int m_nSampleSize; // sample size + + CAudioEncoder m_encoder; // audio encoder + + void * m_pMutex; // mutex + BOOL m_bInited; // inited flag + BOOL m_bCapture; // capturing flag + pthread_t m_hCapture; // capture thread handler +}; + + +#endif + + diff --git a/MediaClient/MediaClient/media/audio_capture_android.cpp b/MediaClient/MediaClient/media/audio_capture_android.cpp new file mode 100644 index 0000000..c41f78f --- /dev/null +++ b/MediaClient/MediaClient/media/audio_capture_android.cpp @@ -0,0 +1,176 @@ +/*************************************************************************************** + * + * 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 "lock.h" +#include "audio_capture_android.h" + + +void dataCallback(uint8 * pdata, int len, void * puser) +{ + CAAudioCapture * pthis = (CAAudioCapture *) puser; + + pthis->dataCallback(pdata, len); +} + +CAAudioCapture::CAAudioCapture() +: CAudioCapture() +, m_pInput(0) +{ +} + +CAAudioCapture::~CAAudioCapture() +{ + stopCapture(); +} + +CAudioCapture * CAAudioCapture::getInstance(int devid) +{ + if (devid < 0 || devid >= MAX_AUDIO_DEV_NUMS) + { + return NULL; + } + + sys_os_mutex_enter(m_pInstMutex); + + if (NULL == m_pInstance[devid]) + { + m_pInstance[devid] = new CAAudioCapture; + if (m_pInstance[devid]) + { + m_pInstance[devid]->m_nRefCnt++; + m_pInstance[devid]->m_nDevIndex = devid; + } + } + else + { + m_pInstance[devid]->m_nRefCnt++; + } + + sys_os_mutex_leave(m_pInstMutex); + + return m_pInstance[devid]; +} + +int CAAudioCapture::getDeviceNums() +{ + return 1; +} + +void CAAudioCapture::listDevice() +{ +} + +int CAAudioCapture::getDeviceIndex(const char * name) +{ + return 0; +} + +BOOL CAAudioCapture::getDeviceName(int index, char * name, int namesize) +{ + strncpy(name, "Default", namesize); + + return TRUE; +} + +BOOL CAAudioCapture::initCapture(int codec, int samplerate, int channels, int bitrate) +{ + CLock lock(m_pMutex); + + if (m_bInited) + { + return TRUE; + } + + m_nChannels = channels; + m_nSampleRate = samplerate; + m_nBitrate = bitrate; + + AudioEncoderParam params; + memset(¶ms, 0, sizeof(params)); + + params.SrcChannels = 2; + params.SrcSamplefmt = AV_SAMPLE_FMT_S16; + params.SrcSamplerate = samplerate; + params.DstChannels = channels; + params.DstSamplefmt = AV_SAMPLE_FMT_S16; + params.DstSamplerate = samplerate; + params.DstBitrate = bitrate; + params.DstCodec = codec; + + if (m_encoder.init(¶ms) == FALSE) + { + return FALSE; + } + + m_bInited = TRUE; + + return TRUE; +} + +BOOL CAAudioCapture::startCapture() +{ + CLock lock(m_pMutex); + + if (!m_bInited) + { + return FALSE; + } + + if (m_pInput) + { + return TRUE; + } + + m_pInput = new GlesInput(); + if (NULL == m_pInput) + { + return FALSE; + } + + m_pInput->setCallback(::dataCallback, this); + if (!m_pInput->start(m_nSampleRate)) + { + log_print(HT_LOG_ERR, "%s, start audio recoding failed\r\n", __FUNCTION__); + return FALSE; + } + + return TRUE; +} + +void CAAudioCapture::stopCapture(void) +{ + CLock lock(m_pMutex); + + if (m_pInput) + { + delete m_pInput; + m_pInput = NULL; + } + + m_bInited = FALSE; +} + +void CAAudioCapture::dataCallback(uint8 * pdata, int len) +{ + m_encoder.encode(pdata, len); +} + + + diff --git a/MediaClient/MediaClient/media/audio_capture_android.h b/MediaClient/MediaClient/media/audio_capture_android.h new file mode 100644 index 0000000..33e776e --- /dev/null +++ b/MediaClient/MediaClient/media/audio_capture_android.h @@ -0,0 +1,61 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef AUDIO_CAPTURE_ANDROID_H +#define AUDIO_CAPTURE_ANDROID_H + +#include "sys_inc.h" +#include "audio_capture.h" +#include "gles_input.h" + + +class CAAudioCapture : public CAudioCapture +{ +public: + + // get audio capture devcie nubmers + static int getDeviceNums(); + // list avaivalbe video capture device + static void listDevice(); + // get device index by device name + static int getDeviceIndex(const char * name); + // get device name by device index + static BOOL getDeviceName(int index, char * name, int namesize); + + // get single instance + static CAudioCapture * getInstance(int devid); + + BOOL initCapture(int codec, int sampleRate, int channels, int bitrate); + BOOL startCapture(); + + void dataCallback(uint8 * pdata, int len); + +private: + CAAudioCapture(); + CAAudioCapture(CAAudioCapture &obj); + ~CAAudioCapture(); + + void stopCapture(); + +private: + GlesInput * m_pInput; +}; + +#endif + diff --git a/MediaClient/MediaClient/media/audio_capture_avf.h b/MediaClient/MediaClient/media/audio_capture_avf.h new file mode 100644 index 0000000..a224ad5 --- /dev/null +++ b/MediaClient/MediaClient/media/audio_capture_avf.h @@ -0,0 +1,57 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef AUDIO_CAPTURE_AVF_H +#define AUDIO_CAPTURE_AVF_H + +typedef struct +{ + uint8 *data[4]; + int linesize[4]; + int samplerate; + int channels; + int format; + int samples; +} avf_audio_data; + +typedef void (*avf_audio_callback)(avf_audio_data * data, void * userdata); + +#ifdef __cplusplus +extern "C" { +#endif + +int avf_audio_device_nums(); +void avf_audio_device_list(); +int avf_audio_device_get_index(const char * name); +BOOL avf_audio_device_get_name(int index, char * name, int namesize); +void * avf_audio_init(int device_index, int samplerate, int channels); +void avf_audio_uninit(void * ctx); +void avf_audio_set_callback(void * ctx, avf_audio_callback cb, void * userdata); +int avf_audio_get_samplerate(void * ctx); +int avf_audio_get_channels(void * ctx); +int avf_audio_get_samplefmt(void * ctx); +BOOL avf_audio_read(void * ctx, int * samples); + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/MediaClient/MediaClient/media/audio_capture_avf.mm b/MediaClient/MediaClient/media/audio_capture_avf.mm new file mode 100644 index 0000000..72c8ba9 --- /dev/null +++ b/MediaClient/MediaClient/media/audio_capture_avf.mm @@ -0,0 +1,1091 @@ +/*************************************************************************************** + * + * 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 "audio_capture_avf.h" +#include +#include +#include + +/***************************************************************************************/ + +typedef struct +{ + BOOL capture_flag; + pthread_t capture_thread; + AudioQueueRef audio_queue; + int num_audio_buffers; + AudioQueueBufferRef * audio_buffer; + void * buffer; + uint32 buffer_offset; + uint32 buffer_size; + AudioStreamBasicDescription strdesc; + AudioDeviceID device_id; + int device_index; + int samplerate; + uint16 channels; + uint16 samples; + int samplefmt; + avf_audio_callback callback; + void * userdata; + void * mutex_cb; +} AVFAudioContext; + +static const AudioObjectPropertyAddress devlist_address = +{ + kAudioHardwarePropertyDevices, + kAudioObjectPropertyScopeGlobal, + kAudioObjectPropertyElementMain +}; + +/***************************************************************************************/ + +int avf_audio_device_nums() +{ + int count = 0; + OSStatus result = noErr; + uint32 size = 0; + AudioDeviceID *devs = NULL; + uint32 i = 0; + uint32 max = 0; + + result = AudioObjectGetPropertyDataSize(kAudioObjectSystemObject, + &devlist_address, 0, NULL, &size); + if (result != kAudioHardwareNoError) + { + return 0; + } + + devs = (AudioDeviceID *) alloca(size); + if (devs == NULL) + { + return 0; + } + + result = AudioObjectGetPropertyData(kAudioObjectSystemObject, + &devlist_address, 0, NULL, &size, devs); + if (result != kAudioHardwareNoError) + { + return 0; + } + + max = size / sizeof (AudioDeviceID); + + for (i = 0; i < max; i++) + { + CFStringRef cfstr = NULL; + char *ptr = NULL; + AudioDeviceID dev = devs[i]; + AudioBufferList *buflist = NULL; + int usable = 0; + CFIndex len = 0; + const AudioObjectPropertyAddress addr = { + kAudioDevicePropertyStreamConfiguration, + kAudioDevicePropertyScopeInput, + kAudioObjectPropertyElementMain + }; + + const AudioObjectPropertyAddress nameaddr = { + kAudioObjectPropertyName, + kAudioDevicePropertyScopeInput, + kAudioObjectPropertyElementMain + }; + + result = AudioObjectGetPropertyDataSize(dev, &addr, 0, NULL, &size); + if (result != noErr) + { + continue; + } + + buflist = (AudioBufferList *) malloc(size); + if (buflist == NULL) + { + continue; + } + + result = AudioObjectGetPropertyData(dev, &addr, 0, NULL, &size, buflist); + if (result == noErr) + { + uint32 j; + + for (j = 0; j < buflist->mNumberBuffers; j++) + { + if (buflist->mBuffers[j].mNumberChannels > 0) + { + usable = 1; + break; + } + } + } + + free(buflist); + + if (!usable) + { + continue; + } + + size = sizeof (CFStringRef); + result = AudioObjectGetPropertyData(dev, &nameaddr, 0, NULL, &size, &cfstr); + if (result != kAudioHardwareNoError) + { + continue; + } + + len = CFStringGetMaximumSizeForEncoding(CFStringGetLength(cfstr), + kCFStringEncodingUTF8); + + ptr = (char *) malloc(len + 1); + usable = ((ptr != NULL) && + (CFStringGetCString + (cfstr, ptr, len + 1, kCFStringEncodingUTF8))); + + CFRelease(cfstr); + + if (usable) + { + len = strlen(ptr); + + /* Some devices have whitespace at the end...trim it. */ + while ((len > 0) && (ptr[len - 1] == ' ')) + { + len--; + } + + usable = (len > 0); + } + + if (usable) + { + count++; + } + + free(ptr); + } + + return count; +} + +void avf_audio_device_list() +{ + int count = 0; + OSStatus result = noErr; + uint32 size = 0; + AudioDeviceID *devs = NULL; + uint32 i = 0; + uint32 max = 0; + + result = AudioObjectGetPropertyDataSize(kAudioObjectSystemObject, + &devlist_address, 0, NULL, &size); + if (result != kAudioHardwareNoError) + { + return; + } + + devs = (AudioDeviceID *) alloca(size); + if (devs == NULL) + { + return; + } + + result = AudioObjectGetPropertyData(kAudioObjectSystemObject, + &devlist_address, 0, NULL, &size, devs); + if (result != kAudioHardwareNoError) + { + return; + } + + printf("\r\nAvailable audio capture device : \r\n\r\n"); + + max = size / sizeof (AudioDeviceID); + + for (i = 0; i < max; i++) + { + CFStringRef cfstr = NULL; + char *ptr = NULL; + AudioDeviceID dev = devs[i]; + AudioBufferList *buflist = NULL; + int usable = 0; + CFIndex len = 0; + const AudioObjectPropertyAddress addr = { + kAudioDevicePropertyStreamConfiguration, + kAudioDevicePropertyScopeInput, + kAudioObjectPropertyElementMain + }; + + const AudioObjectPropertyAddress nameaddr = { + kAudioObjectPropertyName, + kAudioDevicePropertyScopeInput, + kAudioObjectPropertyElementMain + }; + + result = AudioObjectGetPropertyDataSize(dev, &addr, 0, NULL, &size); + if (result != noErr) + { + continue; + } + + buflist = (AudioBufferList *) malloc(size); + if (buflist == NULL) + { + continue; + } + + result = AudioObjectGetPropertyData(dev, &addr, 0, NULL, &size, buflist); + if (result == noErr) + { + uint32 j; + + for (j = 0; j < buflist->mNumberBuffers; j++) + { + if (buflist->mBuffers[j].mNumberChannels > 0) + { + usable = 1; + break; + } + } + } + + free(buflist); + + if (!usable) + { + continue; + } + + size = sizeof (CFStringRef); + result = AudioObjectGetPropertyData(dev, &nameaddr, 0, NULL, &size, &cfstr); + if (result != kAudioHardwareNoError) + { + continue; + } + + len = CFStringGetMaximumSizeForEncoding(CFStringGetLength(cfstr), + kCFStringEncodingUTF8); + + ptr = (char *) malloc(len + 1); + usable = ((ptr != NULL) && + (CFStringGetCString + (cfstr, ptr, len + 1, kCFStringEncodingUTF8))); + + CFRelease(cfstr); + + if (usable) + { + len = strlen(ptr); + + /* Some devices have whitespace at the end...trim it. */ + while ((len > 0) && (ptr[len - 1] == ' ')) + { + len--; + } + + usable = (len > 0); + } + + if (usable) + { + ptr[len] = '\0'; + + printf("index : %d, name : %s\r\n", count++, ptr); + } + + free(ptr); + } +} + +int avf_audio_device_get_index(const char * name) +{ + int count = 0; + OSStatus result = noErr; + uint32 size = 0; + AudioDeviceID *devs = NULL; + uint32 i = 0; + uint32 max = 0; + + result = AudioObjectGetPropertyDataSize(kAudioObjectSystemObject, + &devlist_address, 0, NULL, &size); + if (result != kAudioHardwareNoError) + { + return 0; + } + + devs = (AudioDeviceID *) alloca(size); + if (devs == NULL) + { + return 0; + } + + result = AudioObjectGetPropertyData(kAudioObjectSystemObject, + &devlist_address, 0, NULL, &size, devs); + if (result != kAudioHardwareNoError) + { + return 0; + } + + max = size / sizeof (AudioDeviceID); + + for (i = 0; i < max; i++) + { + CFStringRef cfstr = NULL; + char *ptr = NULL; + AudioDeviceID dev = devs[i]; + AudioBufferList *buflist = NULL; + int usable = 0; + CFIndex len = 0; + const AudioObjectPropertyAddress addr = { + kAudioDevicePropertyStreamConfiguration, + kAudioDevicePropertyScopeInput, + kAudioObjectPropertyElementMain + }; + + const AudioObjectPropertyAddress nameaddr = { + kAudioObjectPropertyName, + kAudioDevicePropertyScopeInput, + kAudioObjectPropertyElementMain + }; + + result = AudioObjectGetPropertyDataSize(dev, &addr, 0, NULL, &size); + if (result != noErr) + { + continue; + } + + buflist = (AudioBufferList *) malloc(size); + if (buflist == NULL) + { + continue; + } + + result = AudioObjectGetPropertyData(dev, &addr, 0, NULL, &size, buflist); + if (result == noErr) + { + uint32 j; + + for (j = 0; j < buflist->mNumberBuffers; j++) + { + if (buflist->mBuffers[j].mNumberChannels > 0) + { + usable = 1; + break; + } + } + } + + free(buflist); + + if (!usable) + { + continue; + } + + size = sizeof (CFStringRef); + result = AudioObjectGetPropertyData(dev, &nameaddr, 0, NULL, &size, &cfstr); + if (result != kAudioHardwareNoError) + { + continue; + } + + len = CFStringGetMaximumSizeForEncoding(CFStringGetLength(cfstr), + kCFStringEncodingUTF8); + + ptr = (char *) malloc(len + 1); + usable = ((ptr != NULL) && + (CFStringGetCString + (cfstr, ptr, len + 1, kCFStringEncodingUTF8))); + + CFRelease(cfstr); + + if (usable) + { + len = strlen(ptr); + + /* Some devices have whitespace at the end...trim it. */ + while ((len > 0) && (ptr[len - 1] == ' ')) + { + len--; + } + + usable = (len > 0); + } + + if (usable) + { + ptr[len] = '\0'; + + if (strcasecmp(ptr, name) == 0) + { + free(ptr); + break; + } + + count++; + } + + free(ptr); + } + + return count; +} + +BOOL avf_audio_device_get_name(int index, char * name, int namesize) +{ + BOOL ret = FALSE; + OSStatus result = noErr; + uint32 size = 0; + AudioDeviceID *devs = NULL; + uint32 max = 0; + + result = AudioObjectGetPropertyDataSize(kAudioObjectSystemObject, + &devlist_address, 0, NULL, &size); + if (result != kAudioHardwareNoError) + { + return FALSE; + } + + devs = (AudioDeviceID *) alloca(size); + if (devs == NULL) + { + return FALSE; + } + + result = AudioObjectGetPropertyData(kAudioObjectSystemObject, + &devlist_address, 0, NULL, &size, devs); + if (result != kAudioHardwareNoError) + { + return FALSE; + } + + max = size / sizeof (AudioDeviceID); + + if (index < 0 || index >= max) + { + return FALSE; + } + + { + CFStringRef cfstr = NULL; + char *ptr = NULL; + AudioDeviceID dev = devs[index]; + AudioBufferList *buflist = NULL; + int usable = 0; + CFIndex len = 0; + const AudioObjectPropertyAddress addr = { + kAudioDevicePropertyStreamConfiguration, + kAudioDevicePropertyScopeInput, + kAudioObjectPropertyElementMain + }; + + const AudioObjectPropertyAddress nameaddr = { + kAudioObjectPropertyName, + kAudioDevicePropertyScopeInput, + kAudioObjectPropertyElementMain + }; + + result = AudioObjectGetPropertyDataSize(dev, &addr, 0, NULL, &size); + if (result != noErr) + { + return FALSE; + } + + buflist = (AudioBufferList *) malloc(size); + if (buflist == NULL) + { + return FALSE; + } + + result = AudioObjectGetPropertyData(dev, &addr, 0, NULL, &size, buflist); + if (result == noErr) + { + uint32 j; + + for (j = 0; j < buflist->mNumberBuffers; j++) + { + if (buflist->mBuffers[j].mNumberChannels > 0) + { + usable = 1; + break; + } + } + } + + free(buflist); + + if (!usable) + { + return FALSE; + } + + size = sizeof (CFStringRef); + result = AudioObjectGetPropertyData(dev, &nameaddr, 0, NULL, &size, &cfstr); + if (result != kAudioHardwareNoError) + { + return FALSE; + } + + len = CFStringGetMaximumSizeForEncoding(CFStringGetLength(cfstr), + kCFStringEncodingUTF8); + + ptr = (char *) malloc(len + 1); + usable = ((ptr != NULL) && + (CFStringGetCString + (cfstr, ptr, len + 1, kCFStringEncodingUTF8))); + + CFRelease(cfstr); + + if (usable) + { + len = strlen(ptr); + + /* Some devices have whitespace at the end...trim it. */ + while ((len > 0) && (ptr[len - 1] == ' ')) + { + len--; + } + + usable = (len > 0); + } + + if (usable) + { + ptr[len] = '\0'; + + ret = TRUE; + strncpy(name, ptr, namesize); + } + + free(ptr); + } + + return ret; +} + +AudioDeviceID avf_audio_get_deviceid(int index) +{ + int count = 0; + OSStatus result = noErr; + uint32 size = 0; + AudioDeviceID *devs = NULL; + uint32 i = 0; + uint32 max = 0; + + result = AudioObjectGetPropertyDataSize(kAudioObjectSystemObject, + &devlist_address, 0, NULL, &size); + if (result != kAudioHardwareNoError) + { + return 0; + } + + devs = (AudioDeviceID *) alloca(size); + if (devs == NULL) + { + return 0; + } + + result = AudioObjectGetPropertyData(kAudioObjectSystemObject, + &devlist_address, 0, NULL, &size, devs); + if (result != kAudioHardwareNoError) + { + return 0; + } + + max = size / sizeof (AudioDeviceID); + + for (i = 0; i < max; i++) + { + CFStringRef cfstr = NULL; + char *ptr = NULL; + AudioDeviceID dev = devs[i]; + AudioBufferList *buflist = NULL; + int usable = 0; + CFIndex len = 0; + const AudioObjectPropertyAddress addr = { + kAudioDevicePropertyStreamConfiguration, + kAudioDevicePropertyScopeInput, + kAudioObjectPropertyElementMain + }; + + const AudioObjectPropertyAddress nameaddr = { + kAudioObjectPropertyName, + kAudioDevicePropertyScopeInput, + kAudioObjectPropertyElementMain + }; + + result = AudioObjectGetPropertyDataSize(dev, &addr, 0, NULL, &size); + if (result != noErr) + { + continue; + } + + buflist = (AudioBufferList *) malloc(size); + if (buflist == NULL) + { + continue; + } + + result = AudioObjectGetPropertyData(dev, &addr, 0, NULL, &size, buflist); + if (result == noErr) + { + uint32 j; + + for (j = 0; j < buflist->mNumberBuffers; j++) + { + if (buflist->mBuffers[j].mNumberChannels > 0) + { + usable = 1; + break; + } + } + } + + free(buflist); + + if (!usable) + { + continue; + } + + size = sizeof (CFStringRef); + result = AudioObjectGetPropertyData(dev, &nameaddr, 0, NULL, &size, &cfstr); + if (result != kAudioHardwareNoError) + { + continue; + } + + len = CFStringGetMaximumSizeForEncoding(CFStringGetLength(cfstr), + kCFStringEncodingUTF8); + + ptr = (char *) malloc(len + 1); + usable = ((ptr != NULL) && + (CFStringGetCString + (cfstr, ptr, len + 1, kCFStringEncodingUTF8))); + + CFRelease(cfstr); + + if (usable) + { + len = strlen(ptr); + + /* Some devices have whitespace at the end...trim it. */ + while ((len > 0) && (ptr[len - 1] == ' ')) + { + len--; + } + + usable = (len > 0); + } + + if (usable) + { + ptr[len] = '\0'; + + if (count == index) + { + free(ptr); + return dev; + } + + count++; + } + + free(ptr); + } + + return 0; +} + +BOOL avf_audio_prepare_device(AVFAudioContext * context) +{ + AudioDeviceID devid = (AudioDeviceID) avf_audio_get_deviceid(context->device_index); + OSStatus result = noErr; + uint32 size = 0; + uint32 alive = 0; + pid_t pid = 0; + + AudioObjectPropertyAddress addr = { + 0, + kAudioObjectPropertyScopeGlobal, + kAudioObjectPropertyElementMain + }; + + addr.mSelector = kAudioDevicePropertyDeviceIsAlive; + addr.mScope = kAudioDevicePropertyScopeInput; + + size = sizeof (alive); + result = AudioObjectGetPropertyData(devid, &addr, 0, NULL, &size, &alive); + if (result != noErr) + { + log_print(HT_LOG_ERR, "%s, AudioObjectGetPropertyData failed\r\n", __FUNCTION__); + return FALSE; + } + + if (!alive) + { + log_print(HT_LOG_ERR, "%s, requested device exists, but isn't alive\r\n", __FUNCTION__); + return FALSE; + } + + addr.mSelector = kAudioDevicePropertyHogMode; + size = sizeof (pid); + result = AudioObjectGetPropertyData(devid, &addr, 0, NULL, &size, &pid); + + /* some devices don't support this property, so errors are fine here. */ + if ((result == noErr) && (pid != -1)) + { + log_print(HT_LOG_ERR, "%s, requested device is being hogged\r\n", __FUNCTION__); + return FALSE; + } + + context->device_id = devid; + + return TRUE; +} + +int avf_audio_assign_device(AVFAudioContext * context) +{ + const AudioObjectPropertyAddress prop = { + kAudioDevicePropertyDeviceUID, + kAudioDevicePropertyScopeInput, + kAudioObjectPropertyElementMain + }; + + OSStatus result; + CFStringRef devuid; + uint32 devuidsize = sizeof (devuid); + + result = AudioObjectGetPropertyData(context->device_id, &prop, 0, NULL, &devuidsize, &devuid); + if (result != noErr) + { + log_print(HT_LOG_ERR, "%s, AudioObjectGetPropertyData failed\r\n", __FUNCTION__); + return 0; + } + + result = AudioQueueSetProperty(context->audio_queue, kAudioQueueProperty_CurrentDevice, &devuid, devuidsize); + if (result != noErr) + { + log_print(HT_LOG_ERR, "%s, AudioQueueSetProperty failed\r\n", __FUNCTION__); + return 0; + } + + return 1; +} + +void avf_audio_input_cb(void *inUserData, AudioQueueRef inAQ, AudioQueueBufferRef inBuffer, + const AudioTimeStamp *inStartTime, uint32 inNumberPacketDescriptions, + const AudioStreamPacketDescription *inPacketDescs) +{ + AVFAudioContext * context = (AVFAudioContext *) inUserData; + + const uint8 * ptr = (const uint8 *) inBuffer->mAudioData; + uint32 remaining = inBuffer->mAudioDataByteSize; + while (remaining > 0) + { + uint32 len = context->buffer_size - context->buffer_offset; + if (len > remaining) + { + len = remaining; + } + + memcpy((char *)context->buffer + context->buffer_offset, ptr, len); + ptr += len; + remaining -= len; + context->buffer_offset += len; + + if (context->buffer_offset >= context->buffer_size) + { + if (context->callback) + { + avf_audio_data data; + memset(&data, 0, sizeof(data)); + + data.data[0] = (uint8 *)context->buffer; + data.linesize[0] = context->buffer_size; + data.samplerate = context->samplerate; + data.channels = context->channels; + data.samples = context->samples; + data.format = context->samplefmt; + + context->callback(&data, context->userdata); + } + + context->buffer_offset = 0; + } + } + + AudioQueueEnqueueBuffer(context->audio_queue, inBuffer, 0, NULL); +} + +int avf_audio_prepare_queue(AVFAudioContext * context) +{ + int i; + OSStatus result; + const AudioStreamBasicDescription *strdesc = &context->strdesc; + + result = AudioQueueNewInput(strdesc, avf_audio_input_cb, context, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode, 0, &context->audio_queue); + if (result != noErr) + { + log_print(HT_LOG_ERR, "%s, AudioQueueNewInput failed\r\n", __FUNCTION__); + return 0; + } + + if (!avf_audio_assign_device(context)) + { + log_print(HT_LOG_ERR, "%s, avf_audio_assign_device failed\r\n", __FUNCTION__); + return 0; + } + + AudioChannelLayout layout; + memset(&layout, 0, sizeof(layout)); + + layout.mChannelLayoutTag = kAudioChannelLayoutTag_Stereo; + + result = AudioQueueSetProperty(context->audio_queue, kAudioQueueProperty_ChannelLayout, &layout, sizeof(layout)); + if (result != noErr) + { + log_print(HT_LOG_ERR, "%s, AudioQueueSetProperty failed\r\n", __FUNCTION__); + return 0; + } + + uint32 size = strdesc->mBitsPerChannel / 8; + size *= context->channels; + size *= context->samples; + + /* Allocate a sample buffer */ + context->buffer_size = size; + context->buffer_offset = 0; + + context->buffer = malloc(context->buffer_size); + if (context->buffer == NULL) + { + log_print(HT_LOG_ERR, "%s, malloc failed\r\n", __FUNCTION__); + return 0; + } + + /* Make sure we can feed the device a minimum amount of time */ + double MINIMUM_AUDIO_BUFFER_TIME_MS = 15.0; + + const double msecs = (context->samples / ((double) context->samplerate)) * 1000.0; + int num_audio_buffers = 2; + if (msecs < MINIMUM_AUDIO_BUFFER_TIME_MS) + { + /* use more buffers if we have a VERY small sample set. */ + num_audio_buffers = ((int)ceil(MINIMUM_AUDIO_BUFFER_TIME_MS / msecs) * 2); + } + + context->num_audio_buffers = num_audio_buffers; + context->audio_buffer = (AudioQueueBufferRef *) calloc(1, sizeof(AudioQueueBufferRef) * num_audio_buffers); + if (context->audio_buffer == NULL) + { + log_print(HT_LOG_ERR, "%s, calloc failed\r\n", __FUNCTION__); + return 0; + } + + for (i = 0; i < num_audio_buffers; i++) + { + result = AudioQueueAllocateBuffer(context->audio_queue, size, &context->audio_buffer[i]); + if (result != noErr) + { + log_print(HT_LOG_ERR, "%s, AudioQueueAllocateBuffer failed\r\n", __FUNCTION__); + return 0; + } + + memset(context->audio_buffer[i]->mAudioData, 0, context->audio_buffer[i]->mAudioDataBytesCapacity); + context->audio_buffer[i]->mAudioDataByteSize = context->audio_buffer[i]->mAudioDataBytesCapacity; + + result = AudioQueueEnqueueBuffer(context->audio_queue, context->audio_buffer[i], 0, NULL); + if (result != noErr) + { + log_print(HT_LOG_ERR, "%s, AudioQueueEnqueueBuffer failed\r\n", __FUNCTION__); + return 0; + } + } + + result = AudioQueueStart(context->audio_queue, NULL); + if (result != noErr) + { + log_print(HT_LOG_ERR, "%s, AudioQueueStart failed\r\n", __FUNCTION__); + return 0; + } + + /* We're running! */ + return 1; +} + +void * avf_audio_thread(void * argv) +{ + AVFAudioContext * context = (AVFAudioContext *) argv; + + const int rc = avf_audio_prepare_queue(context); + if (!rc) + { + log_print(HT_LOG_ERR, "%s, avf_audio_prepare_queue failed\r\n", __FUNCTION__); + return NULL; + } + + while (context->capture_flag) + { + CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.10, 1); + } + + context->capture_thread = 0; + + return NULL; +} + +void * avf_audio_init(int device_index, int samplerate, int channels) +{ + AVFAudioContext * context = (AVFAudioContext *)malloc(sizeof(AVFAudioContext)); + if (NULL == context) + { + return NULL; + } + + memset(context, 0, sizeof(AVFAudioContext)); + + context->device_index = device_index; + context->samplerate = samplerate; + context->channels = channels; + context->samples = 1024; + context->samplefmt = 1; // AV_SAMPLE_FMT_S16 + + AudioStreamBasicDescription *strdesc = &context->strdesc; + + memset(strdesc, 0, sizeof(AudioStreamBasicDescription)); + + strdesc->mFormatID = kAudioFormatLinearPCM; + strdesc->mFormatFlags = kLinearPCMFormatFlagIsPacked; + strdesc->mChannelsPerFrame = channels; + strdesc->mSampleRate = samplerate; + strdesc->mFramesPerPacket = 1; + strdesc->mFormatFlags |= kLinearPCMFormatFlagIsSignedInteger; + strdesc->mBitsPerChannel = 16; + strdesc->mBytesPerFrame = strdesc->mChannelsPerFrame * strdesc->mBitsPerChannel / 8; + strdesc->mBytesPerPacket = strdesc->mBytesPerFrame * strdesc->mFramesPerPacket; + + if (!avf_audio_prepare_device(context)) + { + log_print(HT_LOG_ERR, "%s, avf_prepare_device failed!\r\n", __FUNCTION__); + goto fail; + } + + context->capture_flag = TRUE; + context->capture_thread = sys_os_create_thread((void *)avf_audio_thread, (void *)context); + if (!context->capture_thread) + { + goto fail; + } + + context->mutex_cb = sys_os_create_mutex(); + + return context; + +fail: + + avf_audio_uninit((void *)context); + + return NULL; +} + +void avf_audio_uninit(void * ctx) +{ + if (NULL == ctx) + { + return; + } + + AVFAudioContext * context = (AVFAudioContext *)ctx; + + if (context->audio_queue) + { + AudioQueueDispose(context->audio_queue, 1); + } + + context->capture_flag = FALSE; + + while (context->capture_thread) + { + usleep(200*1000); + } + + free(context->audio_buffer); + free(context->buffer); + + sys_os_destroy_sig_mutex(context->mutex_cb); + + free(context); +} + +void avf_audio_set_callback(void * ctx, avf_audio_callback cb, void * userdata) +{ + if (NULL == ctx) + { + return; + } + + AVFAudioContext * context = (AVFAudioContext *)ctx; + + sys_os_mutex_enter(context->mutex_cb); + context->callback = cb; + context->userdata = userdata; + sys_os_mutex_leave(context->mutex_cb); +} + +int avf_audio_get_samplerate(void * ctx) +{ + if (NULL == ctx) + { + return 0; + } + + AVFAudioContext * context = (AVFAudioContext *)ctx; + + return context->samplerate; +} + +int avf_audio_get_channels(void * ctx) +{ + if (NULL == ctx) + { + return 0; + } + + AVFAudioContext * context = (AVFAudioContext *)ctx; + + return context->channels; +} + +int avf_audio_get_samplefmt(void * ctx) +{ + if (NULL == ctx) + { + return 0; + } + + AVFAudioContext * context = (AVFAudioContext *)ctx; + + return context->samplefmt; +} + +BOOL avf_audio_read(void * ctx, int * samples) +{ + return FALSE; +} + + + diff --git a/MediaClient/MediaClient/media/audio_capture_linux.cpp b/MediaClient/MediaClient/media/audio_capture_linux.cpp new file mode 100644 index 0000000..146ae36 --- /dev/null +++ b/MediaClient/MediaClient/media/audio_capture_linux.cpp @@ -0,0 +1,425 @@ +/*************************************************************************************** + * + * 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 "audio_capture_linux.h" +#include "lock.h" + + +/***************************************************************************************/ +static void * audioCaptureThread(void * argv) +{ + CLAudioCapture *capture = (CLAudioCapture *)argv; + + capture->captureThread(); + + return NULL; +} + +/***************************************************************************************/ + +CLAudioCapture::CLAudioCapture() : CAudioCapture() +{ + memset(&m_alsa, 0, sizeof(m_alsa)); + + m_alsa.period_size = 64; + m_alsa.framesize = 16 / 8 * 2; + + m_pData = NULL; +} + +CLAudioCapture::~CLAudioCapture() +{ + stopCapture(); +} + +CAudioCapture * CLAudioCapture::getInstance(int devid) +{ + if (devid < 0 || devid >= MAX_AUDIO_DEV_NUMS) + { + return NULL; + } + + sys_os_mutex_enter(m_pInstMutex); + + if (NULL == m_pInstance[devid]) + { + m_pInstance[devid] = new CLAudioCapture(); + if (m_pInstance[devid]) + { + m_pInstance[devid]->m_nRefCnt++; + m_pInstance[devid]->m_nDevIndex = devid; + } + } + else + { + m_pInstance[devid]->m_nRefCnt++; + } + + sys_os_mutex_leave(m_pInstMutex); + + return m_pInstance[devid]; +} + +int CLAudioCapture::getDeviceNums() +{ + int card = -1, count = 0, ret; + snd_ctl_card_info_t * info; + + snd_ctl_card_info_alloca(&info); + + ret = snd_card_next(&card); + + while (ret == 0 && card != -1) + { + char name[16]; + snd_ctl_t * ctl; + + snprintf(name, sizeof(name), "hw:%d", card); + + if (snd_ctl_open(&ctl, name, SND_CTL_NONBLOCK) < 0) + { + ret = snd_card_next(&card); + continue; + } + + if (snd_ctl_card_info(ctl, info) < 0) + { + snd_ctl_close(ctl); + ret = snd_card_next(&card); + continue; + } + + snd_ctl_close(ctl); + + if (++count >= MAX_AUDIO_DEV_NUMS) + { + break; + } + + ret = snd_card_next(&card); + } + + return count > MAX_AUDIO_DEV_NUMS ? MAX_AUDIO_DEV_NUMS : count; +} + +void CLAudioCapture::listDevice() +{ + int card = -1, count = 0, ret; + snd_ctl_card_info_t * info; + + printf("\r\nAvailable audio capture device : \r\n\r\n"); + + snd_ctl_card_info_alloca(&info); + + ret = snd_card_next(&card); + + while (ret == 0 && card != -1) + { + char name[16]; + snd_ctl_t * ctl; + + snprintf(name, sizeof(name), "hw:%d", card); + + if (snd_ctl_open(&ctl, name, SND_CTL_NONBLOCK) < 0) + { + ret = snd_card_next(&card); + continue; + } + + if (snd_ctl_card_info(ctl, info) < 0) + { + snd_ctl_close(ctl); + ret = snd_card_next(&card); + continue; + } + + printf("index : %d, name : %s\r\n", count, snd_ctl_card_info_get_name(info)); + + snd_ctl_close(ctl); + + if (++count >= MAX_AUDIO_DEV_NUMS) + { + break; + } + + ret = snd_card_next(&card); + } +} + +int CLAudioCapture::getDeviceIndex(const char * name) +{ + int card = -1, count = 0, index = 0, ret; + snd_ctl_card_info_t * info; + + snd_ctl_card_info_alloca(&info); + + ret = snd_card_next(&card); + + while (ret == 0 && card != -1) + { + char cname[16]; + snd_ctl_t * ctl; + + snprintf(cname, sizeof(cname), "hw:%d", card); + + if (snd_ctl_open(&ctl, cname, SND_CTL_NONBLOCK) < 0) + { + ret = snd_card_next(&card); + continue; + } + + if (snd_ctl_card_info(ctl, info) < 0) + { + snd_ctl_close(ctl); + ret = snd_card_next(&card); + continue; + } + + if (strcasecmp(snd_ctl_card_info_get_name(info), name) == 0) + { + index = count; + snd_ctl_close(ctl); + break; + } + + snd_ctl_close(ctl); + + if (++count >= MAX_AUDIO_DEV_NUMS) + { + break; + } + + ret = snd_card_next(&card); + } + + return index; +} + +BOOL CLAudioCapture::getDeviceName(int index, char * name, int namesize) +{ + BOOL res = FALSE; + int card = -1, count = 0, ret; + snd_ctl_card_info_t * info; + + snd_ctl_card_info_alloca(&info); + + ret = snd_card_next(&card); + + while (ret == 0 && card != -1) + { + char cname[16]; + snd_ctl_t * ctl; + + snprintf(cname, sizeof(cname), "hw:%d", card); + + if (snd_ctl_open(&ctl, cname, SND_CTL_NONBLOCK) < 0) + { + ret = snd_card_next(&card); + continue; + } + + if (snd_ctl_card_info(ctl, info) < 0) + { + snd_ctl_close(ctl); + ret = snd_card_next(&card); + continue; + } + + if (index == count) + { + res = TRUE; + strncpy(name, snd_ctl_card_info_get_name(info), namesize); + snd_ctl_close(ctl); + break; + } + + snd_ctl_close(ctl); + + if (++count >= MAX_AUDIO_DEV_NUMS) + { + break; + } + + ret = snd_card_next(&card); + } + + return res; +} + +BOOL CLAudioCapture::initCapture(int codec, int samplerate, int channels, int bitrate) +{ + CLock lock(m_pMutex); + + if (m_bInited) + { + return TRUE; + } + + if (alsa_get_device_name(m_nDevIndex, m_alsa.devname, sizeof(m_alsa.devname)) == FALSE) + { + log_print(HT_LOG_ERR, "get device name failed. %d\r\n", m_nDevIndex); + return FALSE; + } + + if (alsa_open_device(&m_alsa, SND_PCM_STREAM_CAPTURE, (uint32 *)&samplerate, 2) == FALSE) + { + log_print(HT_LOG_ERR, "open device (%s) failed\r\n", m_alsa.devname); + return FALSE; + } + + m_pData = (uint8 *)malloc(ALSA_BUFFER_SIZE_MAX); + if (NULL == m_pData) + { + return FALSE; + } + memset(m_pData, 0, ALSA_BUFFER_SIZE_MAX); + + AudioEncoderParam params; + memset(¶ms, 0, sizeof(params)); + + params.SrcChannels = 2; + params.SrcSamplefmt = AV_SAMPLE_FMT_S16; + params.SrcSamplerate = samplerate; + params.DstChannels = channels; + params.DstSamplefmt = AV_SAMPLE_FMT_S16; + params.DstSamplerate = samplerate; + params.DstBitrate = bitrate; + params.DstCodec = codec; + + if (m_encoder.init(¶ms) == FALSE) + { + return FALSE; + } + + m_nChannels = channels; + m_nSampleRate = samplerate; + m_nBitrate = bitrate; + m_bInited = TRUE; + + return TRUE; +} + +BOOL CLAudioCapture::capture() +{ + int res = 0; + + if (NULL == m_alsa.handler) + { + return FALSE; + } + + while (m_bCapture) + { + res = snd_pcm_wait(m_alsa.handler, 100); + if (res < 0) + { + if (alsa_xrun_recover(m_alsa.handler, res) < 0) + { + return FALSE; + } + } + + res = snd_pcm_readi(m_alsa.handler, m_pData, m_alsa.period_size); + if (res == -EAGAIN) + { + continue; + } + else if (res < 0) + { + if (alsa_xrun_recover(m_alsa.handler, res) < 0) + { + return FALSE; + } + } + else if (res > 0) + { + break; + } + } + + return m_encoder.encode(m_pData, res * m_alsa.framesize); +} + +void CLAudioCapture::captureThread() +{ + while (m_bCapture) + { + if (capture()) + { + } + else + { + usleep(10*1000); + } + } + + m_hCapture = 0; + + log_print(HT_LOG_INFO, "%s, exit\r\n", __FUNCTION__); +} + +BOOL CLAudioCapture::startCapture() +{ + CLock lock(m_pMutex); + + if (!m_bInited) + { + return FALSE; + } + + if (m_bCapture) + { + return TRUE; + } + + m_bCapture = TRUE; + m_hCapture = sys_os_create_thread((void *)audioCaptureThread, this); + + return TRUE; +} + +void CLAudioCapture::stopCapture(void) +{ + CLock lock(m_pMutex); + + m_bCapture = FALSE; + + while (m_hCapture) + { + usleep(10*1000); + } + + alsa_close_device(&m_alsa); + + if (m_pData) + { + free(m_pData); + m_pData = NULL; + } + + m_bInited = FALSE; +} + + + + + + + diff --git a/MediaClient/MediaClient/media/audio_capture_linux.h b/MediaClient/MediaClient/media/audio_capture_linux.h new file mode 100644 index 0000000..6728054 --- /dev/null +++ b/MediaClient/MediaClient/media/audio_capture_linux.h @@ -0,0 +1,68 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef _AUDIO_CAPTURE_LINUX_H +#define _AUDIO_CAPTURE_LINUX_H + +/***************************************************************************************/ + +#include "audio_capture.h" +#include +#include "alsa.h" + +/***************************************************************************************/ + +class CLAudioCapture : public CAudioCapture +{ +public: + + // get audio capture devcie nubmers + static int getDeviceNums(); + // list avaivalbe audio capture device + static void listDevice(); + // get device index by device name + static int getDeviceIndex(const char * name); + // get device name by device index + static BOOL getDeviceName(int index, char * name, int namesize); + + // get single instance + static CAudioCapture * getInstance(int devid); + + BOOL initCapture(int codec, int sampleRate, int channels, int bitrate); + BOOL startCapture(); + + void captureThread(); + +private: + CLAudioCapture(); + CLAudioCapture(CLAudioCapture &obj); + ~CLAudioCapture(); + + void stopCapture(); + BOOL capture(); + +private: + ALSACTX m_alsa; + uint8 * m_pData; +}; + + +#endif // _AUDIO_CAPTURE_LINUX_H + + diff --git a/MediaClient/MediaClient/media/audio_capture_mac.cpp b/MediaClient/MediaClient/media/audio_capture_mac.cpp new file mode 100644 index 0000000..ac3f57e --- /dev/null +++ b/MediaClient/MediaClient/media/audio_capture_mac.cpp @@ -0,0 +1,275 @@ +/*************************************************************************************** + * + * 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 "audio_capture_mac.h" +#include "lock.h" + + +/***************************************************************************************/ + +static void avfAudioCallback(avf_audio_data * data, void * userdata) +{ + CMAudioCapture *capture = (CMAudioCapture *)userdata; + + capture->audioCallBack(data); +} + +static void * audioCaptureThread(void * argv) +{ + CMAudioCapture *capture = (CMAudioCapture *)argv; + + capture->captureThread(); + + return NULL; +} + +/***************************************************************************************/ + +CMAudioCapture::CMAudioCapture() : CAudioCapture() +{ + m_pCapture = NULL; +} + +CMAudioCapture::~CMAudioCapture() +{ + stopCapture(); +} + +CAudioCapture * CMAudioCapture::getInstance(int devid) +{ + if (devid < 0 || devid >= MAX_AUDIO_DEV_NUMS) + { + return NULL; + } + + sys_os_mutex_enter(m_pInstMutex); + + if (NULL == m_pInstance[devid]) + { + m_pInstance[devid] = new CMAudioCapture; + if (m_pInstance[devid]) + { + m_pInstance[devid]->m_nRefCnt++; + m_pInstance[devid]->m_nDevIndex = devid; + } + } + else + { + m_pInstance[devid]->m_nRefCnt++; + } + + sys_os_mutex_leave(m_pInstMutex); + + return m_pInstance[devid]; +} + +int CMAudioCapture::getDeviceNums() +{ + int count = avf_audio_device_nums(); + + return count > MAX_AUDIO_DEV_NUMS ? MAX_AUDIO_DEV_NUMS : count; +} + +void CMAudioCapture::listDevice() +{ + avf_audio_device_list(); +} + +int CMAudioCapture::getDeviceIndex(const char * name) +{ + int index = avf_audio_device_get_index(name); + + return index > MAX_AUDIO_DEV_NUMS ? 0 : index; +} + +BOOL CMAudioCapture::getDeviceName(int index, char * name, int namesize) +{ + return avf_audio_device_get_name(index, name, namesize); +} + +BOOL CMAudioCapture::initCapture(int codec, int samplerate, int channels, int bitrate) +{ + CLock lock(m_pMutex); + + if (m_bInited) + { + return TRUE; + } + + m_pCapture = avf_audio_init(m_nDevIndex, samplerate, 2); + if (NULL == m_pCapture) + { + log_print(HT_LOG_ERR, "%s, avf_audio_init failed\r\n", __FUNCTION__); + return FALSE; + } + + avf_audio_set_callback(m_pCapture, avfAudioCallback, this); + + AudioEncoderParam params; + memset(¶ms, 0, sizeof(params)); + + params.SrcChannels = avf_audio_get_channels(m_pCapture); + params.SrcSamplefmt = (AVSampleFormat)avf_audio_get_samplefmt(m_pCapture); + params.SrcSamplerate = avf_audio_get_samplerate(m_pCapture); + params.DstChannels = channels; + params.DstSamplefmt = AV_SAMPLE_FMT_S16; + params.DstSamplerate = samplerate; + params.DstBitrate = bitrate; + params.DstCodec = codec; + + if (m_encoder.init(¶ms) == FALSE) + { + return FALSE; + } + + m_nChannels = params.SrcChannels; + m_nSampleRate = params.SrcSamplerate; + m_nBitrate = bitrate; + m_bInited = TRUE; + + return TRUE; +} + +void CMAudioCapture::audioCallBack(avf_audio_data * data) +{ + int i; + AVFrame frame; + + memset(&frame, 0, sizeof(frame)); + + for (i = 0; i < 4; i++) + { + frame.data[i] = data->data[i]; + frame.linesize[i] = data->linesize[i]; + } + + frame.extended_data = frame.data; + frame.sample_rate = data->samplerate; + frame.channels = data->channels; + frame.format = data->format; + frame.nb_samples = data->samples; + frame.channel_layout = av_get_default_channel_layout(data->channels); + frame.key_frame = 1; + + m_encoder.encode(&frame); +} + +BOOL CMAudioCapture::capture(int *samples) +{ + if (!m_bInited) + { + return FALSE; + } + + BOOL ret = avf_audio_read(m_pCapture, samples); + + return ret; +} + +void CMAudioCapture::captureThread() +{ + int samples = 0; + int samplerate = m_nSampleRate; + int64 cur_delay = 0; + int64 pre_delay = 0; + uint32 cur_time = 0; + uint32 pre_time = 0; + + while (m_bCapture) + { + if (capture(&samples)) + { + cur_time = sys_os_get_ms(); + cur_delay = 1000000.0 / samplerate * samples; + + if (pre_time > 0) + { + cur_delay += pre_delay - (cur_time - pre_time) * 1000; + if (cur_delay < 1000) + { + cur_delay = 0; + } + } + + pre_time = cur_time; + pre_delay = cur_delay; + + if (cur_delay > 0) + { + usleep(cur_delay); + } + } + else + { + usleep(10*1000); + } + } + + m_hCapture = 0; + + log_print(HT_LOG_INFO, "%s, exit\r\n", __FUNCTION__); +} + +BOOL CMAudioCapture::startCapture() +{ + CLock lock(m_pMutex); + + if (!m_bInited) + { + return FALSE; + } + + if (m_bCapture) + { + return TRUE; + } + + // m_bCapture = TRUE; + // m_hCapture = sys_os_create_thread((void *)audioCaptureThread, this); + + return TRUE; +} + +void CMAudioCapture::stopCapture(void) +{ + CLock lock(m_pMutex); + + m_bCapture = FALSE; + + while (m_hCapture) + { + usleep(10*1000); + } + + if (m_pCapture) + { + avf_audio_uninit(m_pCapture); + m_pCapture = NULL; + } + + m_bInited = FALSE; +} + + + + + + + diff --git a/MediaClient/MediaClient/media/audio_capture_mac.h b/MediaClient/MediaClient/media/audio_capture_mac.h new file mode 100644 index 0000000..1e92cc2 --- /dev/null +++ b/MediaClient/MediaClient/media/audio_capture_mac.h @@ -0,0 +1,67 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef AUDIO_CAPTURE_MAC_H +#define AUDIO_CAPTURE_MAC_H + +/***************************************************************************************/ + +#include "audio_capture.h" +#include "audio_capture_avf.h" + +/***************************************************************************************/ + +class CMAudioCapture : public CAudioCapture +{ +public: + + // get audio capture devcie nubmers + static int getDeviceNums(); + // list avaivalbe video capture device + static void listDevice(); + // get device index by device name + static int getDeviceIndex(const char * name); + // get device name by device index + static BOOL getDeviceName(int index, char * name, int namesize); + + // get single instance + static CAudioCapture * getInstance(int devid); + + BOOL initCapture(int codec, int sampleRate, int channels, int bitrate); + BOOL startCapture(); + + void captureThread(); + void audioCallBack(avf_audio_data * data); + +private: + CMAudioCapture(); + CMAudioCapture(CMAudioCapture &obj); + ~CMAudioCapture(); + + void stopCapture(); + BOOL capture(int *samples); + +private: + void * m_pCapture; +}; + + +#endif + + diff --git a/MediaClient/MediaClient/media/audio_capture_win.cpp b/MediaClient/MediaClient/media/audio_capture_win.cpp new file mode 100644 index 0000000..c713a63 --- /dev/null +++ b/MediaClient/MediaClient/media/audio_capture_win.cpp @@ -0,0 +1,627 @@ +/*************************************************************************************** + * + * 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 "audio_capture_win.h" +#include "lock.h" +#include +#include + +/**************************************************************************************/ + +const CLSID CLSID_MMDeviceEnumerator = __uuidof(MMDeviceEnumerator); +const IID IID_IMMDeviceEnumerator = __uuidof(IMMDeviceEnumerator); +const IID IID_IAudioClient = __uuidof(IAudioClient); +const IID IID_IAudioCaptureClient = __uuidof(IAudioCaptureClient); +const IID IID_IMMEndpoint = __uuidof(IMMEndpoint); + +/***************************************************************************************/ +static void * audioCaptureThread(void * argv) +{ + CWAudioCapture *capture = (CWAudioCapture *)argv; + + capture->captureThread(); + + return NULL; +} + + +/***************************************************************************************/ +CWAudioCapture::CWAudioCapture() +: CAudioCapture() +, m_pAudioClient(NULL) +, m_pCaptureClient(NULL) +{ + +} + +CWAudioCapture::~CWAudioCapture() +{ + stopCapture(); +} + +CAudioCapture * CWAudioCapture::getInstance(int devid) +{ + if (devid < 0 || devid >= MAX_AUDIO_DEV_NUMS) + { + return NULL; + } + + sys_os_mutex_enter(m_pInstMutex); + + if (NULL == m_pInstance[devid]) + { + m_pInstance[devid] = new CWAudioCapture; + if (m_pInstance[devid]) + { + m_pInstance[devid]->m_nRefCnt++; + m_pInstance[devid]->m_nDevIndex = devid; + } + } + else + { + m_pInstance[devid]->m_nRefCnt++; + } + + sys_os_mutex_leave(m_pInstMutex); + + return m_pInstance[devid]; +} + +int CWAudioCapture::getDeviceNums() +{ + UINT count = 0; + HRESULT hr; + IMMDeviceCollection * pEndpoints = NULL; + + hr = getDeviceCollection(eAll, &pEndpoints); + if (FAILED(hr)) + { + log_print(HT_LOG_ERR, "%s, getDeviceCollection failed. hr=%ld", __FUNCTION__, hr); + return 0; + } + + hr = pEndpoints->GetCount(&count); + + pEndpoints->Release(); + + return count > MAX_AUDIO_DEV_NUMS ? MAX_AUDIO_DEV_NUMS : count; +} + +void CWAudioCapture::listDevice() +{ + UINT i, count = 0; + HRESULT hr; + IMMDeviceCollection * pEndpoints = NULL; + + printf("\r\nAvailable audio capture device : \r\n\r\n"); + + hr = getDeviceCollection(eAll, &pEndpoints); + if (FAILED(hr)) + { + log_print(HT_LOG_ERR, "%s, getDeviceCollection failed. hr=%ld", __FUNCTION__, hr); + return; + } + + hr = pEndpoints->GetCount(&count); + + for (i = 0; i < count; i++) + { + IMMDevice * pDevice = NULL; + + hr = pEndpoints->Item(i, &pDevice); + if (FAILED(hr)) + { + log_print(HT_LOG_WARN, "%s, pEndpoints->Item failed. hr=%ld", __FUNCTION__, hr); + continue; + } + + PROPVARIANT varName; + // Initialize container for property value. + PropVariantInit(&varName); + + hr = getDeviceName(pDevice, &varName); + if (FAILED(hr)) + { + pDevice->Release(); + log_print(HT_LOG_WARN, "%s, getDeviceName failed. hr=%ld", __FUNCTION__, hr); + continue; + } + + printf("index : %d, name : %ws\r\n", i, varName.pwszVal); + + PropVariantClear(&varName); + pDevice->Release(); + } + + pEndpoints->Release(); +} + +int CWAudioCapture::getDeviceIndex(const char * name) +{ + UINT i, count = 0, index = 0, size; + HRESULT hr; + IMMDeviceCollection * pEndpoints = NULL; + wchar_t * wszname = NULL; + + hr = getDeviceCollection(eAll, &pEndpoints); + if (FAILED(hr)) + { + log_print(HT_LOG_ERR, "%s, getDeviceCollection failed. hr=%ld", __FUNCTION__, hr); + return 0; + } + + size = MultiByteToWideChar(CP_ACP, 0, name, -1, NULL, 0); + wszname = (wchar_t *)malloc(size * sizeof(wchar_t)); + if (wszname) + { + MultiByteToWideChar(CP_ACP, 0, name, -1, wszname, size); + } + + hr = pEndpoints->GetCount(&count); + + for (i = 0; i < count && i < MAX_AUDIO_DEV_NUMS; i++) + { + IMMDevice * pDevice = NULL; + + hr = pEndpoints->Item(i, &pDevice); + if (FAILED(hr)) + { + log_print(HT_LOG_WARN, "%s, pEndpoints->Item failed. hr=%ld", __FUNCTION__, hr); + continue; + } + + PROPVARIANT varName; + // Initialize container for property value. + PropVariantInit(&varName); + + hr = getDeviceName(pDevice, &varName); + if (FAILED(hr)) + { + pDevice->Release(); + log_print(HT_LOG_WARN, "%s, getDeviceName failed. hr=%ld", __FUNCTION__, hr); + continue; + } + + if (wszname != NULL && _wcsicmp(varName.pwszVal, wszname) == 0) + { + index = i; + + PropVariantClear(&varName); + pDevice->Release(); + break; + } + + PropVariantClear(&varName); + pDevice->Release(); + } + + pEndpoints->Release(); + + if (wszname) + { + free(wszname); + } + + return index; +} + +BOOL CWAudioCapture::getDeviceName(int index, char * name, int namesize) +{ + UINT count = 0; + HRESULT hr; + IMMDevice * pDevice = NULL; + IMMDeviceCollection * pEndpoints = NULL; + PROPVARIANT varName; + + hr = getDeviceCollection(eAll, &pEndpoints); + if (FAILED(hr)) + { + log_print(HT_LOG_ERR, "%s, getDeviceCollection failed. hr=%ld", __FUNCTION__, hr); + return FALSE; + } + + hr = pEndpoints->GetCount(&count); + if (FAILED(hr)) + { + pEndpoints->Release(); + log_print(HT_LOG_ERR, "%s, GetCount failed. hr=%ld", __FUNCTION__, hr); + return FALSE; + } + + if (index < 0 || (UINT)index >= count || index >= MAX_AUDIO_DEV_NUMS) + { + pEndpoints->Release(); + log_print(HT_LOG_ERR, "%s, invalid index %d, count=%d\r\n", __FUNCTION__, index, count); + return FALSE; + } + + hr = pEndpoints->Item(index, &pDevice); + if (FAILED(hr)) + { + pEndpoints->Release(); + log_print(HT_LOG_ERR, "%s, pEndpoints->Item failed. hr=%ld", __FUNCTION__, hr); + return FALSE; + } + + pEndpoints->Release(); + + // Initialize container for property value. + PropVariantInit(&varName); + + hr = getDeviceName(pDevice, &varName); + if (FAILED(hr)) + { + pDevice->Release(); + log_print(HT_LOG_WARN, "%s, getDeviceName failed. hr=%ld", __FUNCTION__, hr); + return FALSE; + } + + WideCharToMultiByte(CP_ACP, 0, varName.pwszVal, -1, name, namesize, NULL, NULL); + + PropVariantClear(&varName); + + pDevice->Release(); + + return TRUE; +} + +BOOL CWAudioCapture::initCapture(int codec, int samplerate, int channels, int bitrate) +{ + CLock lock(m_pMutex); + + if (m_bInited) + { + return TRUE; + } + + int samplefmt; + DWORD flags = 0; + HRESULT hr; + IMMDevice * pDevice = NULL; + WAVEFORMATEX * pwfx = NULL; + + hr = getDeviceByIndex(m_nDevIndex, &pDevice); + if (FAILED(hr)) + { + log_print(HT_LOG_ERR, "%s, getDeviceByIndex failed. index=%d, hr=%ld", + __FUNCTION__, m_nDevIndex, hr); + return FALSE; + } + + hr = pDevice->Activate(IID_IAudioClient, CLSCTX_ALL, NULL, (void**)&m_pAudioClient); + if (FAILED(hr)) + { + log_print(HT_LOG_ERR, "%s, pDevice->Activate failed. hr=%ld", __FUNCTION__, hr); + goto done; + } + + hr = m_pAudioClient->GetMixFormat(&pwfx); + if (FAILED(hr)) + { + log_print(HT_LOG_ERR, "%s, m_pAudioClient->GetMixFormat failed. hr=%ld", __FUNCTION__, hr); + goto done; + } + + samplefmt = getSampleFmt(pwfx); + if (samplefmt == AV_SAMPLE_FMT_NONE) + { + log_print(HT_LOG_ERR, "%s, getSampleFmt failed", __FUNCTION__); + goto done; + } + + if (getDataFlow(pDevice) == eRender) + { + flags = AUDCLNT_STREAMFLAGS_LOOPBACK; + } + + hr = m_pAudioClient->Initialize( + AUDCLNT_SHAREMODE_SHARED, + flags, + 1000000, // 100ms + 0, + pwfx, + NULL); + if (FAILED(hr)) + { + log_print(HT_LOG_ERR, "%s, m_pAudioClient->Initialize failed. hr=%ld", __FUNCTION__, hr); + goto done; + } + + hr = m_pAudioClient->GetService(IID_IAudioCaptureClient, (void**)&m_pCaptureClient); + if (FAILED(hr)) + { + log_print(HT_LOG_ERR, "%s, m_pAudioClient->GetService failed. hr=%ld", __FUNCTION__, hr); + goto done; + } + + AudioEncoderParam params; + memset(¶ms, 0, sizeof(params)); + + params.SrcChannels = pwfx->nChannels; + params.SrcSamplefmt = (AVSampleFormat) samplefmt; + params.SrcSamplerate = pwfx->nSamplesPerSec; + params.DstChannels = channels; + params.DstSamplefmt = AV_SAMPLE_FMT_S16; + params.DstSamplerate = samplerate; + params.DstBitrate = bitrate; + params.DstCodec = codec; + + if (m_encoder.init(¶ms) == FALSE) + { + log_print(HT_LOG_ERR, "%s, init encoder failed", __FUNCTION__); + goto done; + } + + m_nChannels = channels; + m_nSampleRate = samplerate; + m_nBitrate = bitrate; + m_nSampleSize = pwfx->wBitsPerSample * pwfx->nChannels; + m_bInited = TRUE; + +done: + + if (pDevice) + { + pDevice->Release(); + } + + if (pwfx) + { + CoTaskMemFree(pwfx); + } + + if (!m_bInited) + { + if (m_pAudioClient) + { + m_pAudioClient->Release(); + m_pAudioClient = NULL; + } + + if (m_pCaptureClient) + { + m_pCaptureClient->Release(); + m_pCaptureClient = NULL; + } + } + + return m_bInited; +} + +BOOL CWAudioCapture::startCapture() +{ + CLock lock(m_pMutex); + + if (!m_bInited) + { + return FALSE; + } + + if (m_bCapture) + { + return TRUE; + } + + HRESULT hr = m_pAudioClient->Start(); + if (FAILED(hr)) + { + log_print(HT_LOG_ERR, "%s, m_pAudioClient->Start failed. hr=%ld", __FUNCTION__, hr); + return FALSE; + } + + m_bCapture = TRUE; + m_hCapture = sys_os_create_thread((void *)audioCaptureThread, this); + + return (m_hCapture ? TRUE : FALSE); +} + +void CWAudioCapture::stopCapture(void) +{ + CLock lock(m_pMutex); + + m_bCapture = FALSE; + + while (m_hCapture) + { + usleep(10*1000); + } + + if (m_pAudioClient) + { + m_pAudioClient->Stop(); + m_pAudioClient->Release(); + m_pAudioClient = NULL; + } + + if (m_pCaptureClient) + { + m_pCaptureClient->Release(); + m_pCaptureClient = NULL; + } + + m_bInited = FALSE; +} + +BOOL CWAudioCapture::capture() +{ + HRESULT hr; + UINT32 packetLength = 0; + + hr = m_pCaptureClient->GetNextPacketSize(&packetLength); + if (FAILED(hr) || packetLength == 0) + { + return FALSE; + } + + BYTE * data; + DWORD flags; + UINT32 size; + + hr = m_pCaptureClient->GetBuffer(&data, &size, &flags, NULL, NULL); + if (FAILED(hr)) + { + return FALSE; + } + + m_encoder.encode(data, size * (m_nSampleSize / 8)); + + hr = m_pCaptureClient->ReleaseBuffer(size); + + return TRUE; +} + +void CWAudioCapture::captureThread() +{ + while (m_bCapture) + { + capture(); + + usleep(10*1000); + } + + m_hCapture = 0; +} + +HRESULT CWAudioCapture::getDeviceCollection(EDataFlow dataFlow, IMMDeviceCollection ** ppEndpoints) +{ + HRESULT hr; + IMMDeviceEnumerator * pEnumerator = NULL; + + hr = CoCreateInstance( + CLSID_MMDeviceEnumerator, NULL, + CLSCTX_ALL, IID_IMMDeviceEnumerator, + (void**)&pEnumerator); + if (FAILED(hr)) + { + return hr; + } + + hr = pEnumerator->EnumAudioEndpoints(dataFlow, DEVICE_STATE_ACTIVE, ppEndpoints); + + pEnumerator->Release(); + + return hr; +} + +HRESULT CWAudioCapture::getDeviceName(IMMDevice * pDevice, PROPVARIANT * pName) +{ + HRESULT hr; + IPropertyStore * pProps = NULL; + + hr = pDevice->OpenPropertyStore(STGM_READ, &pProps); + if (FAILED(hr)) + { + return hr; + } + + // Get the endpoint's friendly-name property. + hr = pProps->GetValue(PKEY_Device_FriendlyName, pName); + + pProps->Release(); + + return hr; +} + +HRESULT CWAudioCapture::getDeviceByIndex(int index, IMMDevice ** ppDevice) +{ + UINT count = 0; + HRESULT hr; + IMMDeviceCollection * pEndpoints = NULL; + + hr = getDeviceCollection(eAll, &pEndpoints); + if (FAILED(hr)) + { + return hr; + } + + hr = pEndpoints->GetCount(&count); + + if ((UINT) index >= count) + { + pEndpoints->Release(); + + return E_INVALIDARG; + } + + hr = pEndpoints->Item(index, ppDevice); + + pEndpoints->Release(); + + return hr; +} + +int CWAudioCapture::getSampleFmt(WAVEFORMATEX * pwfx) +{ + int fmt = AV_SAMPLE_FMT_NONE; + + if ((pwfx->wFormatTag == WAVE_FORMAT_IEEE_FLOAT) && (pwfx->wBitsPerSample == 32)) + { + fmt = AV_SAMPLE_FMT_FLT; + } + else if ((pwfx->wFormatTag == WAVE_FORMAT_PCM) && (pwfx->wBitsPerSample == 16)) + { + fmt = AV_SAMPLE_FMT_S16; + } + else if ((pwfx->wFormatTag == WAVE_FORMAT_PCM) && (pwfx->wBitsPerSample == 32)) + { + fmt = AV_SAMPLE_FMT_S32; + } + else if (pwfx->wFormatTag == WAVE_FORMAT_EXTENSIBLE) + { + const WAVEFORMATEXTENSIBLE * ext = (const WAVEFORMATEXTENSIBLE *) pwfx; + + if (IsEqualGUID(ext->SubFormat, KSDATAFORMAT_SUBTYPE_IEEE_FLOAT) && (pwfx->wBitsPerSample == 32)) + { + fmt = AV_SAMPLE_FMT_FLT; + } + else if (IsEqualGUID(ext->SubFormat, KSDATAFORMAT_SUBTYPE_PCM) && (pwfx->wBitsPerSample == 16)) + { + fmt = AV_SAMPLE_FMT_S16; + } + else if (IsEqualGUID(ext->SubFormat, KSDATAFORMAT_SUBTYPE_PCM) && (pwfx->wBitsPerSample == 32)) + { + fmt = AV_SAMPLE_FMT_S32; + } + } + + return fmt; +} + +int CWAudioCapture::getDataFlow(IMMDevice * pDevice) +{ + HRESULT hr; + EDataFlow dataflow = eCapture; + IMMEndpoint * pEndpoint; + + hr = pDevice->QueryInterface(IID_IMMEndpoint, (void **)&pEndpoint); + if (FAILED(hr)) + { + return dataflow; + } + + hr = pEndpoint->GetDataFlow(&dataflow); + + pEndpoint->Release(); + + return dataflow; +} + + + diff --git a/MediaClient/MediaClient/media/audio_capture_win.h b/MediaClient/MediaClient/media/audio_capture_win.h new file mode 100644 index 0000000..8615479 --- /dev/null +++ b/MediaClient/MediaClient/media/audio_capture_win.h @@ -0,0 +1,76 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef AUDIO_CAPTURE_WIN_H +#define AUDIO_CAPTURE_WIN_H + +/***************************************************************************************/ + +#include "media_format.h" +#include "audio_capture.h" +#include +#include + +/***************************************************************************************/ + +class CWAudioCapture : public CAudioCapture +{ +public: + + // get audio capture devcie nubmers + static int getDeviceNums(); + // list avaivalbe audio capture device + static void listDevice(); + // get device index by device name + static int getDeviceIndex(const char * name); + // get device name by device index + static BOOL getDeviceName(int index, char * name, int namesize); + + // get single instance + static CAudioCapture * getInstance(int devid); + + BOOL initCapture(int codec, int sampleRate, int channels, int bitrate); + BOOL startCapture(); + + void captureThread(); + +private: + CWAudioCapture(); + CWAudioCapture(CWAudioCapture &obj); + ~CWAudioCapture(); + + void stopCapture(); + BOOL capture(); + + static HRESULT getDeviceCollection(EDataFlow dataFlow, IMMDeviceCollection ** ppEndpoints); + static HRESULT getDeviceName(IMMDevice * pDevice, PROPVARIANT * pName); + HRESULT getDeviceByIndex(int index, IMMDevice ** ppDevice); + int getSampleFmt(WAVEFORMATEX * pwfx); + int getDataFlow(IMMDevice * pDevice); + +private: + IAudioClient * m_pAudioClient; + IAudioCaptureClient * m_pCaptureClient; +}; + + +#endif + + + diff --git a/MediaClient/MediaClient/media/audio_decoder.cpp b/MediaClient/MediaClient/media/audio_decoder.cpp new file mode 100644 index 0000000..c847611 --- /dev/null +++ b/MediaClient/MediaClient/media/audio_decoder.cpp @@ -0,0 +1,246 @@ +/*************************************************************************************** + * + * 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 "audio_decoder.h" +#include "avcodec_mutex.h" +#include "media_codec.h" + +CAudioDecoder::CAudioDecoder() +{ + m_bInited = FALSE; + m_nSamplerate = 0; + m_nChannels = 0; + + m_pCodec = NULL; + m_pContext = NULL; + m_pFrame = NULL; + m_pResampleFrame = NULL; + m_pSwrCtx = NULL; + m_nDstFormat = AV_SAMPLE_FMT_S16; + + m_pCallback = NULL; + m_pUserdata = NULL; +} + +CAudioDecoder::~CAudioDecoder() +{ + uninit(); +} + +BOOL CAudioDecoder::init(enum AVCodecID codec, int samplerate, int channels, int bitpersample) +{ + m_pCodec = avcodec_find_decoder(codec); + if (m_pCodec == NULL) + { + log_print(HT_LOG_ERR, "%s, m_pCodec is NULL\r\n", __FUNCTION__); + return FALSE; + } + + m_pContext = avcodec_alloc_context3(m_pCodec); + if (NULL == m_pContext) + { + log_print(HT_LOG_ERR, "%s, avcodec_alloc_context3 failed\r\n", __FUNCTION__); + return FALSE; + } + + m_pContext->sample_rate = samplerate; + m_pContext->channels = channels; + m_pContext->channel_layout = av_get_default_channel_layout(channels); + + if (AV_CODEC_ID_ADPCM_G726 == codec) + { + if (0 == bitpersample) + { + bitpersample = 2; + } + + m_pContext->bits_per_coded_sample = bitpersample; + m_pContext->bit_rate = bitpersample * 8000; + } + + if (avcodec_thread_open(m_pContext, m_pCodec, NULL) < 0) + { + log_print(HT_LOG_ERR, "%s, avcodec_thread_open failed\r\n", __FUNCTION__); + return FALSE; + } + + if (m_pContext->sample_fmt != m_nDstFormat) + { + m_pSwrCtx = swr_alloc_set_opts(NULL, + av_get_default_channel_layout(channels), m_nDstFormat, samplerate, + av_get_default_channel_layout(channels), m_pContext->sample_fmt, samplerate, 0, NULL); + + swr_init(m_pSwrCtx); + } + + m_pFrame = av_frame_alloc(); + if (NULL == m_pFrame) + { + log_print(HT_LOG_ERR, "%s, av_frame_alloc failed\r\n", __FUNCTION__); + return FALSE; + } + + m_nSamplerate = samplerate; + m_nChannels = channels; + + m_bInited = TRUE; + + return TRUE; +} + +BOOL CAudioDecoder::init(int codec, int samplerate, int channels, int bitpersample) +{ + return init(to_audio_avcodecid(codec), samplerate, channels, bitpersample); +} + +BOOL CAudioDecoder::decode(uint8 * data, int len, int64_t pts) +{ + AVPacket packet; + av_init_packet(&packet); + packet.data = data; + packet.size = len; + packet.pts = packet.dts = pts; + return decode(&packet); +} + +BOOL CAudioDecoder::decode(AVPacket *pkt) +{ + int ret; + + if (!m_bInited) + { + return FALSE; + } + + /* send the packet with the compressed data to the decoder */ + ret = avcodec_send_packet(m_pContext, pkt); + if (ret < 0) + { + log_print(HT_LOG_ERR, "%s, error submitting the packet to the decoder\r\n", __FUNCTION__); + return FALSE; + } + + /* read all the output frames (in general there may be any number of them */ + while (ret >= 0) + { + ret = avcodec_receive_frame(m_pContext, m_pFrame); + if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) + { + return TRUE; + } + else if (ret < 0) + { + log_print(HT_LOG_ERR, "%s, error during decoding\r\n", __FUNCTION__); + return FALSE; + } + + render(m_pFrame); + + av_frame_unref(m_pFrame); + } + + return TRUE; +} + +void CAudioDecoder::flush() +{ + if (NULL == m_pContext || + NULL == m_pContext->codec || + !(m_pContext->codec->capabilities | AV_CODEC_CAP_DELAY)) + { + return; + } + + decode(NULL); +} + +void CAudioDecoder::uninit() +{ + flush(); + + if (m_pContext) + { + avcodec_thread_close(m_pContext); + avcodec_free_context(&m_pContext); + } + + if (m_pFrame) + { + av_frame_free(&m_pFrame); + } + + if (m_pResampleFrame) + { + av_frame_free(&m_pResampleFrame); + } + + if (m_pSwrCtx) + { + swr_free(&m_pSwrCtx); + } + + m_bInited = FALSE; +} + +void CAudioDecoder::render(AVFrame * frame) +{ + if (NULL == frame) + { + return; + } + + if (m_pSwrCtx) + { + if (NULL == m_pResampleFrame) + { + m_pResampleFrame = av_frame_alloc(); + if (NULL == m_pResampleFrame) + { + return; + } + } + + m_pResampleFrame->sample_rate = m_nSamplerate; + m_pResampleFrame->format = m_nDstFormat; + m_pResampleFrame->channels = m_nChannels; + m_pResampleFrame->channel_layout = av_get_default_channel_layout(m_nChannels); + + int swrret = swr_convert_frame(m_pSwrCtx, m_pResampleFrame, frame); + if (swrret == 0) + { + if (m_pCallback) + { + m_pResampleFrame->pts = frame->pts; + m_pResampleFrame->pkt_dts = frame->pkt_dts; + + m_pCallback(m_pResampleFrame, m_pUserdata); + } + } + + av_frame_unref(m_pResampleFrame); + } + else if (m_pCallback) + { + m_pCallback(frame, m_pUserdata); + } +} + + + diff --git a/MediaClient/MediaClient/media/audio_decoder.h b/MediaClient/MediaClient/media/audio_decoder.h new file mode 100644 index 0000000..db6a316 --- /dev/null +++ b/MediaClient/MediaClient/media/audio_decoder.h @@ -0,0 +1,73 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef AUDIO_DECODER_H +#define AUDIO_DECODER_H + +#include "sys_inc.h" +#include "media_format.h" + +extern "C" +{ +#include "libavcodec/avcodec.h" +#include "libavutil/avutil.h" +#include "libswscale/swscale.h" +#include "libavformat/avformat.h" +#include +} + +typedef void (*ADCB)(AVFrame * frame, void * userdata); + +class CAudioDecoder +{ +public: + CAudioDecoder(); + ~CAudioDecoder(); + + BOOL init(int codec, int samplerate, int channels, int bitpersample = 0); + BOOL init(enum AVCodecID codec, int samplerate, int channels, int bitpersample = 0); + void uninit(); + + BOOL decode(uint8 * data, int len, int64_t pts = AV_NOPTS_VALUE); + BOOL decode(AVPacket *pkt); + void setCallback(ADCB pCallback, void * pUserdata) {m_pCallback = pCallback; m_pUserdata = pUserdata;} + +private: + void flush(); + void render(AVFrame * frame); + +private: + BOOL m_bInited; + int m_nSamplerate; + int m_nChannels; + + const AVCodec * m_pCodec; + AVCodecContext* m_pContext; + AVFrame * m_pFrame; + AVFrame * m_pResampleFrame; + SwrContext * m_pSwrCtx; + AVSampleFormat m_nDstFormat; + + ADCB m_pCallback; + void * m_pUserdata; +}; + +#endif + + diff --git a/MediaClient/MediaClient/media/audio_encoder.cpp b/MediaClient/MediaClient/media/audio_encoder.cpp new file mode 100644 index 0000000..2a9f4b5 --- /dev/null +++ b/MediaClient/MediaClient/media/audio_encoder.cpp @@ -0,0 +1,577 @@ +/*************************************************************************************** + * + * 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 "audio_encoder.h" +#include "media_format.h" +#include "avcodec_mutex.h" +#include "media_codec.h" + +CAudioEncoder::CAudioEncoder() +{ + m_nCodecId = AV_CODEC_ID_NONE; + m_bInited = FALSE; + + memset(&m_EncoderParams, 0, sizeof(AudioEncoderParam)); + + m_pCodecCtx = NULL; + m_pFrame = NULL; + m_pResampleFrame = NULL; + m_pSwrCtx = NULL; + m_pPkt = NULL; + + memset(&m_AudioBuffer, 0, sizeof(AudioBuffer)); + + m_pCallbackMutex = sys_os_create_mutex(); + m_pCallbackList = h_list_create(FALSE); +} + +CAudioEncoder::~CAudioEncoder() +{ + uninit(); + + h_list_free_container(m_pCallbackList); + + sys_os_destroy_sig_mutex(m_pCallbackMutex); +} + +int CAudioEncoder::computeBitrate(AVCodecID codec, int samplerate, int channels, int quality) +{ + int bitrate; + + if (m_nCodecId == AV_CODEC_ID_ADPCM_G726) + { + bitrate = 16000; // G726 16kbit/s + } + else if (m_nCodecId == AV_CODEC_ID_ADPCM_G722) + { + bitrate = 64000; // G722 64kbit/s + } + else if (m_nCodecId == AV_CODEC_ID_PCM_ALAW || m_nCodecId == AV_CODEC_ID_PCM_MULAW) + { + bitrate = samplerate * channels * 8; + } + else if (m_nCodecId == AV_CODEC_ID_AAC) + { + bitrate = samplerate * channels * 16 / 7; + } + else + { + bitrate = samplerate * channels; + } + + return bitrate; +} + +BOOL CAudioEncoder::init(AudioEncoderParam * params) +{ + memcpy(&m_EncoderParams, params, sizeof(AudioEncoderParam)); + + m_nCodecId = to_audio_avcodecid(params->DstCodec); + + if (AV_CODEC_ID_AAC == m_nCodecId) + { + // the ffmepg AAC encoder only support AV_SAMPLE_FMT_FLTP + m_EncoderParams.DstSamplefmt = AV_SAMPLE_FMT_FLTP; + } + + const AVCodec * pCodec = avcodec_find_encoder(m_nCodecId); + if (pCodec == NULL) + { + log_print(HT_LOG_ERR, "avcodec_find_encoder failed, %d\r\n", m_nCodecId); + return FALSE; + } + + m_pCodecCtx = avcodec_alloc_context3(pCodec); + if (m_pCodecCtx == NULL) + { + log_print(HT_LOG_ERR, "avcodec_alloc_context3 failed\r\n"); + return FALSE; + } + + m_pCodecCtx->codec_id = m_nCodecId; + m_pCodecCtx->codec_type = AVMEDIA_TYPE_AUDIO; + m_pCodecCtx->qblur = 0.5f; + m_pCodecCtx->time_base.num = 1; + m_pCodecCtx->time_base.den = m_EncoderParams.DstSamplerate; + m_pCodecCtx->sample_rate = m_EncoderParams.DstSamplerate; + m_pCodecCtx->channels = m_EncoderParams.DstChannels; + m_pCodecCtx->channel_layout = av_get_default_channel_layout(m_EncoderParams.DstChannels); + m_pCodecCtx->sample_fmt = m_EncoderParams.DstSamplefmt; + + if (m_EncoderParams.DstBitrate > 0) + { + m_pCodecCtx->bit_rate = m_EncoderParams.DstBitrate * 1000; + } + else + { + m_pCodecCtx->bit_rate = computeBitrate(m_nCodecId, m_EncoderParams.DstSamplerate, m_EncoderParams.DstChannels, 80); + } + + m_pCodecCtx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER; + + av_opt_set(m_pCodecCtx->priv_data, "preset", "superfast", 0); + av_opt_set(m_pCodecCtx->priv_data, "tune", "zerolatency", 0); + + if (AV_CODEC_ID_AAC == m_nCodecId) + { + m_pCodecCtx->profile = FF_PROFILE_AAC_LOW; // AAC -LC + } + else if (AV_CODEC_ID_ADPCM_G726 == m_nCodecId) + { + m_pCodecCtx->bits_per_coded_sample = m_pCodecCtx->bit_rate / 8000; + m_pCodecCtx->bit_rate = m_pCodecCtx->bits_per_coded_sample * 8000; + } + + if (avcodec_thread_open(m_pCodecCtx, pCodec, NULL) < 0) + { + log_print(HT_LOG_ERR, "avcodec_thread_open failed, audio encoder\r\n"); + return FALSE; + } + + m_pFrame = av_frame_alloc(); + if (NULL == m_pFrame) + { + return FALSE; + } + + if (m_EncoderParams.SrcSamplerate != m_EncoderParams.DstSamplerate || + m_EncoderParams.SrcChannels != m_EncoderParams.DstChannels || + m_EncoderParams.SrcSamplefmt != m_EncoderParams.DstSamplefmt) + { + m_pSwrCtx = swr_alloc_set_opts(NULL, + av_get_default_channel_layout(m_EncoderParams.DstChannels), m_EncoderParams.DstSamplefmt, m_EncoderParams.DstSamplerate, + av_get_default_channel_layout(m_EncoderParams.SrcChannels), m_EncoderParams.SrcSamplefmt, m_EncoderParams.SrcSamplerate, 0, NULL); + + swr_init(m_pSwrCtx); + } + + if (m_pCodecCtx->frame_size == 0) + { + m_pCodecCtx->frame_size = 1024; + } + + m_AudioBuffer.tlen = 64 * m_pCodecCtx->frame_size * m_EncoderParams.DstChannels * av_get_bytes_per_sample(m_EncoderParams.DstSamplefmt); + m_AudioBuffer.data[0] = (uint8 *)av_malloc(m_AudioBuffer.tlen); + m_AudioBuffer.data[1] = (uint8 *)av_malloc(m_AudioBuffer.tlen); + m_AudioBuffer.size[0] = 0; + m_AudioBuffer.size[1] = 0; + m_AudioBuffer.samples = 0; + + /* packet for holding encoded output */ + m_pPkt = av_packet_alloc(); + if (!m_pPkt) + { + log_print(HT_LOG_ERR, "could not allocate the packet\r\n"); + return FALSE; + } + + m_bInited = TRUE; + + return TRUE; +} + +void CAudioEncoder::uninit() +{ + flush(); + + if (m_pCodecCtx) + { + avcodec_thread_close(m_pCodecCtx); + avcodec_free_context(&m_pCodecCtx); + } + + if (m_pFrame) + { + av_frame_free(&m_pFrame); + } + + if (m_pResampleFrame) + { + av_frame_free(&m_pResampleFrame); + } + + if (m_pSwrCtx) + { + swr_free(&m_pSwrCtx); + } + + if (m_pPkt) + { + av_packet_free(&m_pPkt); + } + + if (m_AudioBuffer.data[0]) + { + av_freep(&m_AudioBuffer.data[0]); + } + + if (m_AudioBuffer.data[1]) + { + av_freep(&m_AudioBuffer.data[1]); + } + + m_bInited = FALSE; +} + +BOOL CAudioEncoder::bufferFrame(AVFrame * pFrame) +{ + BOOL ret = TRUE; + int samplesize = av_get_bytes_per_sample((AVSampleFormat)pFrame->format); + + int size = pFrame->nb_samples * samplesize; + + assert(m_AudioBuffer.size[0] + size <= m_AudioBuffer.tlen); + + if (av_sample_fmt_is_planar((AVSampleFormat)pFrame->format) && m_EncoderParams.DstChannels > 1) + { + memcpy(m_AudioBuffer.data[0]+m_AudioBuffer.size[0], pFrame->data[0], size); + m_AudioBuffer.size[0] += size; + + memcpy(m_AudioBuffer.data[1]+m_AudioBuffer.size[1], pFrame->data[1], size); + m_AudioBuffer.size[1] += size; + } + else + { + memcpy(m_AudioBuffer.data[0]+m_AudioBuffer.size[0], pFrame->data[0], size * m_EncoderParams.DstChannels); + m_AudioBuffer.size[0] += size * m_EncoderParams.DstChannels; + } + + m_AudioBuffer.samples += pFrame->nb_samples; + + while (m_AudioBuffer.samples >= m_pCodecCtx->frame_size) + { + int linesize; + + if (av_sample_fmt_is_planar((AVSampleFormat)pFrame->format) && m_EncoderParams.DstChannels > 1) + { + linesize = samplesize * m_pCodecCtx->frame_size; + } + else + { + linesize = samplesize * m_pCodecCtx->frame_size * m_EncoderParams.DstChannels; + } + + m_pFrame->data[0] = m_AudioBuffer.data[0]; + m_pFrame->data[1] = m_AudioBuffer.data[1]; + m_pFrame->linesize[0] = linesize; + m_pFrame->linesize[1] = linesize; + m_pFrame->nb_samples = m_pCodecCtx->frame_size; + m_pFrame->format = m_EncoderParams.DstSamplefmt; + m_pFrame->key_frame = 1; + m_pFrame->sample_rate = m_EncoderParams.DstSamplerate; + m_pFrame->channels = m_EncoderParams.DstChannels; + m_pFrame->channel_layout = av_get_default_channel_layout(m_EncoderParams.DstChannels); + + ret = encodeInternal(m_pFrame); + + m_AudioBuffer.size[0] -= linesize; + + if (m_AudioBuffer.size[0] > 0) + { + memmove(m_AudioBuffer.data[0], m_AudioBuffer.data[0]+linesize, m_AudioBuffer.size[0]); + } + + if (av_sample_fmt_is_planar((AVSampleFormat)pFrame->format) && m_EncoderParams.DstChannels > 1) + { + m_AudioBuffer.size[1] -= linesize; + + if (m_AudioBuffer.size[1] > 0) + { + memmove(m_AudioBuffer.data[1], m_AudioBuffer.data[1]+linesize, m_AudioBuffer.size[1]); + } + } + + m_AudioBuffer.samples -= m_pCodecCtx->frame_size; + } + + return ret; +} + +void CAudioEncoder::flush() +{ + if (NULL == m_pCodecCtx || + NULL == m_pCodecCtx->codec || + !(m_pCodecCtx->codec->capabilities | AV_CODEC_CAP_DELAY)) + { + return; + } + + encodeInternal(NULL); +} + +BOOL CAudioEncoder::encodeInternal(AVFrame * pFrame) +{ + int ret; + + /* send the frame for encoding */ + ret = avcodec_send_frame(m_pCodecCtx, pFrame); + if (ret < 0) + { + log_print(HT_LOG_ERR, "error sending the frame to the encoder\r\n"); + return FALSE; + } + + /* read all the available output packets (in general there may be any + * number of them */ + while (ret >= 0) + { + ret = avcodec_receive_packet(m_pCodecCtx, m_pPkt); + if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) + { + return TRUE; + } + else if (ret < 0) + { + log_print(HT_LOG_ERR, "error encoding audio frame\r\n"); + return FALSE; + } + + if (m_pPkt->data && m_pPkt->size > 0) + { + procData(m_pPkt->data, m_pPkt->size, pFrame ? pFrame->nb_samples : 0); + } + else + { + log_print(HT_LOG_WARN, "%s, data is null\r\n", __FUNCTION__); + } + + av_packet_unref(m_pPkt); + } + + return TRUE; +} + +BOOL CAudioEncoder::encode(uint8 * data, int size) +{ + if (!m_bInited) + { + return FALSE; + } + + m_pFrame->data[0] = data; + m_pFrame->linesize[0] = size; + m_pFrame->nb_samples = size / (m_EncoderParams.SrcChannels * av_get_bytes_per_sample(m_EncoderParams.SrcSamplefmt)); + m_pFrame->format = m_EncoderParams.SrcSamplefmt; + m_pFrame->key_frame = 1; + m_pFrame->sample_rate = m_EncoderParams.SrcSamplerate; + m_pFrame->channels = m_EncoderParams.SrcChannels; + m_pFrame->channel_layout = av_get_default_channel_layout(m_EncoderParams.SrcChannels); + + return encode(m_pFrame); +} + +BOOL CAudioEncoder::encode(AVFrame * pFrame) +{ + BOOL ret = TRUE; + + if (!m_bInited) + { + return FALSE; + } + + if (m_pSwrCtx) + { + if (NULL == m_pResampleFrame) + { + m_pResampleFrame = av_frame_alloc(); + if (NULL == m_pResampleFrame) + { + return FALSE; + } + } + + m_pResampleFrame->sample_rate = m_EncoderParams.DstSamplerate; + m_pResampleFrame->format = m_EncoderParams.DstSamplefmt; + m_pResampleFrame->channels = m_EncoderParams.DstChannels; + m_pResampleFrame->channel_layout = av_get_default_channel_layout(m_EncoderParams.DstChannels); + + int swrret = swr_convert_frame(m_pSwrCtx, m_pResampleFrame, pFrame); + if (swrret == 0) + { + ret = bufferFrame(m_pResampleFrame); + } + else + { + ret = FALSE; + } + + av_frame_unref(m_pResampleFrame); + } + else + { + ret = bufferFrame(pFrame); + } + + return ret; +} + +void CAudioEncoder::procData(uint8 * data, int size, int nbsamples) +{ + AudioEncoderCB * p_cb = NULL; + LINKED_NODE * p_node = NULL; + + sys_os_mutex_enter(m_pCallbackMutex); + + p_node = h_list_lookup_start(m_pCallbackList); + while (p_node) + { + p_cb = (AudioEncoderCB *) p_node->p_data; + if (p_cb->pCallback != NULL) + { + p_cb->pCallback(data, size, nbsamples, p_cb->pUserdata); + } + + p_node = h_list_lookup_next(m_pCallbackList, p_node); + } + h_list_lookup_end(m_pCallbackList); + + sys_os_mutex_leave(m_pCallbackMutex); +} + +BOOL CAudioEncoder::isCallbackExist(AudioDataCallback pCallback, void *pUserdata) +{ + BOOL exist = FALSE; + AudioEncoderCB * p_cb = NULL; + LINKED_NODE * p_node = NULL; + + sys_os_mutex_enter(m_pCallbackMutex); + + p_node = h_list_lookup_start(m_pCallbackList); + while (p_node) + { + p_cb = (AudioEncoderCB *) p_node->p_data; + if (p_cb->pCallback == pCallback && p_cb->pUserdata == pUserdata) + { + exist = TRUE; + break; + } + + p_node = h_list_lookup_next(m_pCallbackList, p_node); + } + h_list_lookup_end(m_pCallbackList); + + sys_os_mutex_leave(m_pCallbackMutex); + + return exist; +} + +void CAudioEncoder::addCallback(AudioDataCallback pCallback, void *pUserdata) +{ + if (isCallbackExist(pCallback, pUserdata)) + { + return; + } + + AudioEncoderCB * p_cb = (AudioEncoderCB *) malloc(sizeof(AudioEncoderCB)); + if (NULL == p_cb) + { + return; + } + + p_cb->pCallback = pCallback; + p_cb->pUserdata = pUserdata; + p_cb->bFirst = TRUE; + + sys_os_mutex_enter(m_pCallbackMutex); + h_list_add_at_back(m_pCallbackList, p_cb); + sys_os_mutex_leave(m_pCallbackMutex); +} + +void CAudioEncoder::delCallback(AudioDataCallback pCallback, void *pUserdata) +{ + AudioEncoderCB * p_cb = NULL; + LINKED_NODE * p_node = NULL; + + sys_os_mutex_enter(m_pCallbackMutex); + + p_node = h_list_lookup_start(m_pCallbackList); + while (p_node) + { + p_cb = (AudioEncoderCB *) p_node->p_data; + if (p_cb->pCallback == pCallback && p_cb->pUserdata == pUserdata) + { + free(p_cb); + + h_list_remove(m_pCallbackList, p_node); + break; + } + + p_node = h_list_lookup_next(m_pCallbackList, p_node); + } + h_list_lookup_end(m_pCallbackList); + + sys_os_mutex_leave(m_pCallbackMutex); +} + +char * CAudioEncoder::getAACAuxSDPLine(int rtp_pt) +{ + if (NULL == m_pCodecCtx || m_pCodecCtx->extradata_size == 0) + { + return NULL; + } + + char const* fmtpFmt = + "a=fmtp:%d " + "streamtype=5;profile-level-id=1;" + "mode=AAC-hbr;sizelength=13;indexlength=3;indexdeltalength=3;" + "config="; + uint32 fmtpFmtSize = strlen(fmtpFmt) + + 3 /* max char len */ + + 2*m_pCodecCtx->extradata_size; /* 2*, because each byte prints as 2 chars */ + + char* fmtp = new char[fmtpFmtSize+1]; + memset(fmtp, 0, fmtpFmtSize+1); + + sprintf(fmtp, fmtpFmt, rtp_pt); + char* endPtr = &fmtp[strlen(fmtp)]; + for (int i = 0; i < m_pCodecCtx->extradata_size; ++i) + { + sprintf(endPtr, "%02X", m_pCodecCtx->extradata[i]); + endPtr += 2; + } + + return fmtp; +} + +char * CAudioEncoder::getAuxSDPLine(int rtp_pt) +{ + if (m_nCodecId == AV_CODEC_ID_AAC) + { + return getAACAuxSDPLine(rtp_pt); + } + + return NULL; +} + +BOOL CAudioEncoder::getExtraData(uint8 ** extradata, int * extralen) +{ + if (m_pCodecCtx && m_pCodecCtx->extradata_size > 0) + { + *extradata = m_pCodecCtx->extradata; + *extralen = m_pCodecCtx->extradata_size; + + return TRUE; + } + + return FALSE; +} + + + diff --git a/MediaClient/MediaClient/media/audio_encoder.h b/MediaClient/MediaClient/media/audio_encoder.h new file mode 100644 index 0000000..5d194ba --- /dev/null +++ b/MediaClient/MediaClient/media/audio_encoder.h @@ -0,0 +1,111 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef _AUDIO_ENCODER_H +#define _AUDIO_ENCODER_H + +#include "linked_list.h" + +extern "C" +{ +#include +#include +#include +#include +#include +} + +typedef void (*AudioDataCallback)(uint8 *data, int size, int nbsamples, void *pUserdata); + +typedef struct +{ + AudioDataCallback pCallback; // callback function pointer + void * pUserdata; // user data + BOOL bFirst; // +} AudioEncoderCB; + +/** + * Some encoders require a fixed frame size + */ +typedef struct +{ + int tlen; // buffer total length + uint8 * data[2]; // audio data buffer + int size[2]; // audio data size + int samples; // audio sample numbers +} AudioBuffer; + +typedef struct +{ + int SrcSamplerate; // source sample rate + int SrcChannels; // source channels + AVSampleFormat SrcSamplefmt; // source sample format, see AVSampleFormat + + int DstCodec; // output codec + int DstSamplerate; // output sample rate + int DstChannels; // output channels + int DstBitrate; // output bitrate, unit is bits per second + AVSampleFormat DstSamplefmt; // output sample format, see AVSampleFormat +} AudioEncoderParam; + +class CAudioEncoder +{ +public: + CAudioEncoder(); + ~CAudioEncoder(); + + BOOL init(AudioEncoderParam * params); + void uninit(); + BOOL encode(uint8 * data, int size); + BOOL encode(AVFrame * pFrame); + void addCallback(AudioDataCallback pCallback, void *pUserdata); + void delCallback(AudioDataCallback pCallback, void *pUserdata); + char * getAuxSDPLine(int rtp_pt); + BOOL getExtraData(uint8 ** extradata, int * extralen); + +private: + void flush(); + BOOL encodeInternal(AVFrame * pFrame); + void procData(uint8 * data, int size, int nbsamples); + BOOL isCallbackExist(AudioDataCallback pCallback, void *pUserdata); + char * getAACAuxSDPLine(int rtp_pt); + BOOL bufferFrame(AVFrame * pFrame); + int computeBitrate(AVCodecID codec, int samplerate, int channels, int quality); + +private: + AVCodecID m_nCodecId; + BOOL m_bInited; + + AudioEncoderParam m_EncoderParams; + + AVCodecContext * m_pCodecCtx; + AVFrame * m_pFrame; + AVFrame * m_pResampleFrame; + SwrContext * m_pSwrCtx; + AudioBuffer m_AudioBuffer; + AVPacket * m_pPkt; + + void * m_pCallbackMutex; + LINKED_LIST * m_pCallbackList; +}; + +#endif // _AUDIO_ENCODER_H + + + diff --git a/MediaClient/MediaClient/media/audio_play.cpp b/MediaClient/MediaClient/media/audio_play.cpp new file mode 100644 index 0000000..7502987 --- /dev/null +++ b/MediaClient/MediaClient/media/audio_play.cpp @@ -0,0 +1,68 @@ +/*************************************************************************************** + * + * 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 "audio_play.h" + + +CAudioPlay::CAudioPlay() +{ + m_bInited = FALSE; + m_nSamplerate = 8000; + m_nChannels = 1; +} + +CAudioPlay::~CAudioPlay(void) +{ +} + +BOOL CAudioPlay::startPlay(int samplerate, int channels) +{ + m_nSamplerate = samplerate; + m_nChannels = channels; + + return FALSE; +} + +void CAudioPlay::stopPlay(void) +{ + m_bInited = FALSE; +} + +BOOL CAudioPlay::setVolume(int volume) +{ + return FALSE; +} + +int CAudioPlay::getVolume() +{ + return 0; +} + +void CAudioPlay::playAudio(uint8 * data, int size) +{ + if (!m_bInited) + { + return; + } +} + + + + diff --git a/MediaClient/MediaClient/media/audio_play.h b/MediaClient/MediaClient/media/audio_play.h new file mode 100644 index 0000000..adfe3f6 --- /dev/null +++ b/MediaClient/MediaClient/media/audio_play.h @@ -0,0 +1,53 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef _AUDIO_PLAY_H +#define _AUDIO_PLAY_H + +#include "sys_inc.h" +#include "media_format.h" + + +#define HTVOLUME_MIN 0 +#define HTVOLUME_MAX 255 + + +class CAudioPlay +{ +public: + CAudioPlay(); + virtual ~CAudioPlay(); + +public: + virtual BOOL startPlay(int samplerate, int channels); + virtual void stopPlay(); + virtual BOOL setVolume(int volume); + virtual int getVolume(); + virtual void playAudio(uint8 * pData, int len); + +protected: + BOOL m_bInited; + int m_nSamplerate; + int m_nChannels; +}; + +#endif + + + diff --git a/MediaClient/MediaClient/media/audio_play_avf.h b/MediaClient/MediaClient/media/audio_play_avf.h new file mode 100644 index 0000000..a1a84e0 --- /dev/null +++ b/MediaClient/MediaClient/media/audio_play_avf.h @@ -0,0 +1,41 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef AUDIO_PLAY_AVF_H +#define AUDIO_PLAY_AVF_H + +typedef void (*avf_audio_play_callback)(void * buff, uint32 size, void * userdata); + +#ifdef __cplusplus +extern "C" { +#endif + +void * avf_audio_play_init(int samplerate, int channels); +void avf_audio_play_uninit(void * ctx); +void avf_audio_play_set_callback(void * ctx, avf_audio_play_callback cb, void * userdata); +BOOL avf_audio_play_set_volume(void * ctx, double volume); +double avf_audio_play_get_volume(void * ctx); + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/MediaClient/MediaClient/media/audio_play_avf.mm b/MediaClient/MediaClient/media/audio_play_avf.mm new file mode 100644 index 0000000..8c41713 --- /dev/null +++ b/MediaClient/MediaClient/media/audio_play_avf.mm @@ -0,0 +1,439 @@ +/*************************************************************************************** + * + * 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 "audio_play_avf.h" +#include +#include +#include + +/***************************************************************************************/ + +typedef struct +{ + BOOL play_flag; + pthread_t play_thread; + AudioQueueRef audio_queue; + int num_audio_buffers; + AudioQueueBufferRef * audio_buffer; + void * buffer; + uint32 buffer_offset; + uint32 buffer_size; + AudioStreamBasicDescription strdesc; + AudioDeviceID device_id; + int samplerate; + uint16 channels; + uint16 samples; + int samplefmt; + avf_audio_play_callback callback; + void * userdata; + void * mutex_cb; +} AVFAudioPlayContext; + +/***************************************************************************************/ + +BOOL avf_audio_play_prepare_device(AVFAudioPlayContext * context) +{ + AudioDeviceID devid; + OSStatus result = noErr; + uint32 size = 0; + uint32 alive = 0; + pid_t pid = 0; + + AudioObjectPropertyAddress addr = { + 0, + kAudioObjectPropertyScopeGlobal, + kAudioObjectPropertyElementMain + }; + + size = sizeof(AudioDeviceID); + addr.mSelector = kAudioHardwarePropertyDefaultOutputDevice; + result = AudioObjectGetPropertyData(kAudioObjectSystemObject, &addr, + 0, NULL, &size, &devid); + if (result != noErr) + { + log_print(HT_LOG_ERR, "%s, AudioObjectGetPropertyData failed\r\n", __FUNCTION__); + return FALSE; + } + + addr.mSelector = kAudioDevicePropertyDeviceIsAlive; + addr.mScope = kAudioDevicePropertyScopeOutput; + + size = sizeof (alive); + result = AudioObjectGetPropertyData(devid, &addr, 0, NULL, &size, &alive); + if (result != noErr) + { + log_print(HT_LOG_ERR, "%s, AudioObjectGetPropertyData failed\r\n", __FUNCTION__); + return FALSE; + } + + if (!alive) + { + log_print(HT_LOG_ERR, "%s, requested device exists, but isn't alive\r\n", __FUNCTION__); + return FALSE; + } + + addr.mSelector = kAudioDevicePropertyHogMode; + size = sizeof (pid); + result = AudioObjectGetPropertyData(devid, &addr, 0, NULL, &size, &pid); + + /* some devices don't support this property, so errors are fine here. */ + if ((result == noErr) && (pid != -1)) + { + log_print(HT_LOG_ERR, "%s, requested device is being hogged\r\n", __FUNCTION__); + return FALSE; + } + + context->device_id = devid; + + return TRUE; +} + +int avf_audio_play_assign_device(AVFAudioPlayContext * context) +{ + const AudioObjectPropertyAddress prop = { + kAudioDevicePropertyDeviceUID, + kAudioDevicePropertyScopeOutput, + kAudioObjectPropertyElementMain + }; + + OSStatus result; + CFStringRef devuid; + uint32 devuidsize = sizeof (devuid); + + result = AudioObjectGetPropertyData(context->device_id, &prop, 0, NULL, &devuidsize, &devuid); + if (result != noErr) + { + log_print(HT_LOG_ERR, "%s, AudioObjectGetPropertyData failed\r\n", __FUNCTION__); + return 0; + } + + result = AudioQueueSetProperty(context->audio_queue, kAudioQueueProperty_CurrentDevice, &devuid, devuidsize); + if (result != noErr) + { + log_print(HT_LOG_ERR, "%s, AudioQueueSetProperty failed\r\n", __FUNCTION__); + return 0; + } + + return 1; +} + +void avf_audio_play_cb(void *inUserData, AudioQueueRef inAQ, AudioQueueBufferRef inBuffer) +{ + AVFAudioPlayContext * context = (AVFAudioPlayContext *) inUserData; + + uint32 remaining = inBuffer->mAudioDataBytesCapacity; + uint8 *ptr = (uint8 *) inBuffer->mAudioData; + + while (remaining > 0) + { + uint32 len; + + if (context->buffer_offset >= context->buffer_size) + { + sys_os_mutex_enter(context->mutex_cb); + if (context->callback) + { + context->callback(context->buffer, context->buffer_size, context->userdata); + } + sys_os_mutex_leave(context->mutex_cb); + context->buffer_offset = 0; + } + + len = context->buffer_size - context->buffer_offset; + if (len > remaining) + { + len = remaining; + } + memcpy(ptr, (char *)context->buffer + context->buffer_offset, len); + ptr = ptr + len; + remaining -= len; + context->buffer_offset += len; + } + + AudioQueueEnqueueBuffer(context->audio_queue, inBuffer, 0, NULL); + + inBuffer->mAudioDataByteSize = inBuffer->mAudioDataBytesCapacity; +} + +int avf_audio_play_prepare_queue(AVFAudioPlayContext * context) +{ + int i; + OSStatus result; + const AudioStreamBasicDescription *strdesc = &context->strdesc; + + result = AudioQueueNewOutput(strdesc, avf_audio_play_cb, context, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode, 0, &context->audio_queue); + if (result != noErr) + { + log_print(HT_LOG_ERR, "%s, AudioQueueNewOutput failed\r\n", __FUNCTION__); + return 0; + } + + if (!avf_audio_play_assign_device(context)) + { + log_print(HT_LOG_ERR, "%s, avf_audio_play_assign_device failed\r\n", __FUNCTION__); + return 0; + } + + AudioChannelLayout layout; + memset(&layout, 0, sizeof(layout)); + + layout.mChannelLayoutTag = kAudioChannelLayoutTag_Stereo; + + result = AudioQueueSetProperty(context->audio_queue, kAudioQueueProperty_ChannelLayout, &layout, sizeof(layout)); + if (result != noErr) + { + log_print(HT_LOG_ERR, "%s, AudioQueueSetProperty failed\r\n", __FUNCTION__); + return 0; + } + + uint32 size = strdesc->mBitsPerChannel / 8; + size *= context->channels; + size *= context->samples; + + /* Allocate a sample buffer */ + context->buffer_size = size; + context->buffer_offset = context->buffer_size; + + context->buffer = malloc(context->buffer_size); + if (context->buffer == NULL) + { + log_print(HT_LOG_ERR, "%s, malloc failed\r\n", __FUNCTION__); + return 0; + } + + /* Make sure we can feed the device a minimum amount of time */ + double MINIMUM_AUDIO_BUFFER_TIME_MS = 15.0; + + const double msecs = (context->samples / ((double) context->samplerate)) * 1000.0; + int num_audio_buffers = 2; + if (msecs < MINIMUM_AUDIO_BUFFER_TIME_MS) + { + /* use more buffers if we have a VERY small sample set. */ + num_audio_buffers = ((int)ceil(MINIMUM_AUDIO_BUFFER_TIME_MS / msecs) * 2); + } + + context->num_audio_buffers = num_audio_buffers; + context->audio_buffer = (AudioQueueBufferRef *) calloc(1, sizeof(AudioQueueBufferRef) * num_audio_buffers); + if (context->audio_buffer == NULL) + { + log_print(HT_LOG_ERR, "%s, calloc failed\r\n", __FUNCTION__); + return 0; + } + + for (i = 0; i < num_audio_buffers; i++) + { + result = AudioQueueAllocateBuffer(context->audio_queue, size, &context->audio_buffer[i]); + if (result != noErr) + { + log_print(HT_LOG_ERR, "%s, AudioQueueAllocateBuffer failed\r\n", __FUNCTION__); + return 0; + } + + memset(context->audio_buffer[i]->mAudioData, 0, context->audio_buffer[i]->mAudioDataBytesCapacity); + context->audio_buffer[i]->mAudioDataByteSize = context->audio_buffer[i]->mAudioDataBytesCapacity; + + result = AudioQueueEnqueueBuffer(context->audio_queue, context->audio_buffer[i], 0, NULL); + if (result != noErr) + { + log_print(HT_LOG_ERR, "%s, AudioQueueEnqueueBuffer failed\r\n", __FUNCTION__); + return 0; + } + } + + result = AudioQueueStart(context->audio_queue, NULL); + if (result != noErr) + { + log_print(HT_LOG_ERR, "%s, AudioQueueStart failed\r\n", __FUNCTION__); + return 0; + } + + /* We're running! */ + return 1; +} + +void * avf_audio_play_thread(void * argv) +{ + AVFAudioPlayContext * context = (AVFAudioPlayContext *) argv; + + const int rc = avf_audio_play_prepare_queue(context); + if (!rc) + { + log_print(HT_LOG_ERR, "%s, avf_audio_play_prepare_queue failed\r\n", __FUNCTION__); + return NULL; + } + + while (context->play_flag) + { + CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.10, 1); + } + + context->play_thread = 0; + + return NULL; +} + +void * avf_audio_play_init(int samplerate, int channels) +{ + AVFAudioPlayContext * context = (AVFAudioPlayContext *)malloc(sizeof(AVFAudioPlayContext)); + if (NULL == context) + { + return NULL; + } + + memset(context, 0, sizeof(AVFAudioPlayContext)); + + context->samplerate = samplerate; + context->channels = channels; + context->samples = 1024; + context->samplefmt = 1; // AV_SAMPLE_FMT_S16 + + AudioStreamBasicDescription *strdesc = &context->strdesc; + + memset(strdesc, 0, sizeof(AudioStreamBasicDescription)); + + strdesc->mFormatID = kAudioFormatLinearPCM; + strdesc->mFormatFlags = kLinearPCMFormatFlagIsPacked; + strdesc->mChannelsPerFrame = channels; + strdesc->mSampleRate = samplerate; + strdesc->mFramesPerPacket = 1; + strdesc->mFormatFlags |= kLinearPCMFormatFlagIsSignedInteger; + strdesc->mBitsPerChannel = 16; + strdesc->mBytesPerFrame = strdesc->mChannelsPerFrame * strdesc->mBitsPerChannel / 8; + strdesc->mBytesPerPacket = strdesc->mBytesPerFrame * strdesc->mFramesPerPacket; + + if (!avf_audio_play_prepare_device(context)) + { + log_print(HT_LOG_ERR, "%s, avf_prepare_device failed!\r\n", __FUNCTION__); + goto fail; + } + + context->play_flag = TRUE; + context->play_thread = sys_os_create_thread((void *)avf_audio_play_thread, (void *)context); + if (!context->play_thread) + { + goto fail; + } + + context->mutex_cb = sys_os_create_mutex(); + + return context; + +fail: + + avf_audio_play_uninit((void *)context); + + return NULL; +} + +void avf_audio_play_uninit(void * ctx) +{ + if (NULL == ctx) + { + return; + } + + AVFAudioPlayContext * context = (AVFAudioPlayContext *)ctx; + + if (context->audio_queue) + { + AudioQueueDispose(context->audio_queue, 1); + } + + context->play_flag = FALSE; + + while (context->play_thread) + { + usleep(200*1000); + } + + free(context->audio_buffer); + free(context->buffer); + + sys_os_destroy_sig_mutex(context->mutex_cb); + + free(context); +} + +void avf_audio_play_set_callback(void * ctx, avf_audio_play_callback cb, void * userdata) +{ + if (NULL == ctx) + { + return; + } + + AVFAudioPlayContext * context = (AVFAudioPlayContext *)ctx; + + sys_os_mutex_enter(context->mutex_cb); + context->callback = cb; + context->userdata = userdata; + sys_os_mutex_leave(context->mutex_cb); +} + +BOOL avf_audio_play_set_volume(void * ctx, double volume) +{ + if (NULL == ctx) + { + return FALSE; + } + + AVFAudioPlayContext * context = (AVFAudioPlayContext *)ctx; + + if (!context->audio_queue) + { + return FALSE; + } + + OSStatus result = AudioQueueSetParameter(context->audio_queue, kAudioQueueParam_Volume, volume); + if (result != noErr) + { + log_print(HT_LOG_ERR, "%s, AudioQueueSetParameter failed\r\n", __FUNCTION__); + return FALSE; + } + + return TRUE; +} + +double avf_audio_play_get_volume(void * ctx) +{ + if (NULL == ctx) + { + return 0; + } + + double volume = 0; + AVFAudioPlayContext * context = (AVFAudioPlayContext *)ctx; + + if (!context->audio_queue) + { + return 0; + } + + OSStatus result = AudioQueueGetParameter(context->audio_queue, kAudioQueueParam_Volume, (float *)&volume); + if (result != noErr) + { + log_print(HT_LOG_ERR, "%s, AudioQueueGetParameter failed\r\n", __FUNCTION__); + return 0; + } + + return volume; +} + + + diff --git a/MediaClient/MediaClient/media/audio_play_mac.cpp b/MediaClient/MediaClient/media/audio_play_mac.cpp new file mode 100644 index 0000000..394c849 --- /dev/null +++ b/MediaClient/MediaClient/media/audio_play_mac.cpp @@ -0,0 +1,181 @@ +/*************************************************************************************** + * + * 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 "audio_play_mac.h" + + +void audioPlayCb(void * buff, uint32 size, void * userdata) +{ + CMAudioPlay * player = (CMAudioPlay *) userdata; + + player->playCallback(buff, size); +} + +CMAudioPlay::CMAudioPlay() : CAudioPlay() +, m_pMutex(NULL) +, m_pPlayer(NULL) +, m_pBuffer(NULL) +, m_nBufferSize(0) +, m_nOffset(0) +{ + +} + +CMAudioPlay::~CMAudioPlay() +{ + stopPlay(); +} + +BOOL CMAudioPlay::startPlay(int samplerate, int channels) +{ + m_pPlayer = avf_audio_play_init(samplerate, channels); + if (NULL == m_pPlayer) + { + log_print(HT_LOG_ERR, "%s, avf_audio_play_init failed\r\n", __FUNCTION__); + return FALSE; + } + + m_nBufferSize = 8192; + m_pBuffer = (uint8 *) malloc(m_nBufferSize); + if (NULL == m_pBuffer) + { + log_print(HT_LOG_ERR, "%s, malloc failed\r\n", __FUNCTION__); + return FALSE; + } + + avf_audio_play_set_callback(m_pPlayer, audioPlayCb, this); + + m_pMutex = sys_os_create_mutex(); + + m_nSamplerate = samplerate; + m_nChannels = channels; + + m_bInited = TRUE; + + return TRUE; +} + +void CMAudioPlay::stopPlay() +{ + avf_audio_play_uninit(m_pPlayer); + + sys_os_mutex_enter(m_pMutex); + + if (m_pBuffer) + { + free(m_pBuffer); + m_pBuffer = NULL; + } + + m_nOffset = 0; + + sys_os_mutex_leave(m_pMutex); + + sys_os_destroy_sig_mutex(m_pMutex); + + m_bInited = FALSE; +} + +void CMAudioPlay::playAudio(uint8 * data, int size) +{ + if (!m_bInited) + { + return; + } + + while (1) + { + sys_os_mutex_enter(m_pMutex); + + if (m_nOffset + size <= m_nBufferSize) + { + memcpy(m_pBuffer + m_nOffset, data, size); + m_nOffset += size; + + sys_os_mutex_leave(m_pMutex); + break; + } + else + { + sys_os_mutex_leave(m_pMutex); + usleep(10*1000); + continue; + } + } +} + +void CMAudioPlay::playCallback(void * buff, uint32 size) +{ + sys_os_mutex_enter(m_pMutex); + + if (m_nOffset >= size) + { + memcpy(buff, m_pBuffer, size); + m_nOffset -= size; + + if (m_nOffset > 0) + { + memmove(m_pBuffer, m_pBuffer+size, m_nOffset); + } + } + else + { + memset(buff, 0, size); + } + + sys_os_mutex_leave(m_pMutex); +} + +BOOL CMAudioPlay::setVolume(int volume) +{ + if (m_pPlayer) + { + double db = (double) volume / (HTVOLUME_MAX - HTVOLUME_MIN); + if (db < 0) + { + db = 0.0; + } + else if (db > 1.0) + { + db = 1.0; + } + + return avf_audio_play_set_volume((void *)m_pPlayer, db); + } + + return FALSE; +} + +int CMAudioPlay::getVolume() +{ + if (m_pPlayer) + { + double volume = avf_audio_play_get_volume((void *)m_pPlayer); + + int nv = (HTVOLUME_MAX - HTVOLUME_MIN) * volume + HTVOLUME_MIN; + + return nv; + } + + return HTVOLUME_MIN; +} + + + diff --git a/MediaClient/MediaClient/media/audio_play_mac.h b/MediaClient/MediaClient/media/audio_play_mac.h new file mode 100644 index 0000000..abb9121 --- /dev/null +++ b/MediaClient/MediaClient/media/audio_play_mac.h @@ -0,0 +1,53 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef AUDIO_PLAY_MAC_H +#define AUDIO_PLAY_MAC_H + +#include "sys_inc.h" +#include "linked_list.h" +#include "media_format.h" +#include "audio_play.h" +#include "audio_play_avf.h" + + +class CMAudioPlay : public CAudioPlay +{ +public: + CMAudioPlay(); + ~CMAudioPlay(); + + BOOL startPlay(int samplerate, int channels); + void stopPlay(); + BOOL setVolume(int volume); + int getVolume(); + void playAudio(uint8 * pData, int len); + void playCallback(void * buff, uint32 size); + +private: + void * m_pMutex; // mutex + void * m_pPlayer; + uint8 * m_pBuffer; + uint32 m_nBufferSize; + uint32 m_nOffset; +}; + +#endif + + diff --git a/MediaClient/MediaClient/media/audio_play_qt.cpp b/MediaClient/MediaClient/media/audio_play_qt.cpp new file mode 100644 index 0000000..0a2fffc --- /dev/null +++ b/MediaClient/MediaClient/media/audio_play_qt.cpp @@ -0,0 +1,157 @@ +/*************************************************************************************** + * + * 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 "audio_play_qt.h" +#include +#include + + +CQAudioPlay::CQAudioPlay(QObject * parent) : QObject(parent), CAudioPlay() +, m_pSink(NULL) +, m_pBuffer(NULL) +{ + +} + +CQAudioPlay::~CQAudioPlay() +{ + stopPlay(); +} + +BOOL CQAudioPlay::startPlay(int samplerate, int channels) +{ + QAudioFormat format; + + format.setSampleRate(samplerate); + format.setChannelCount(channels); + format.setSampleFormat(QAudioFormat::Int16); + + QAudioDevice device(QMediaDevices::defaultAudioOutput()); + if (!device.isFormatSupported(format)) + { + log_print(HT_LOG_ERR, "Raw audio format not supported by backend, cannot play audio\r\n"); + return FALSE; + } + + m_nSamplerate = samplerate; + m_nChannels = channels; + + m_pSink = new QAudioSink(device, format, NULL); + + m_pSink->setBufferSize(8192); + m_pBuffer = m_pSink->start(); + if (NULL == m_pBuffer) + { + log_print(HT_LOG_ERR, "%s, audio output start failed\r\n", __FUNCTION__); + return FALSE; + } + + m_bInited = TRUE; + + return TRUE; +} + +void CQAudioPlay::stopPlay() +{ + QMutexLocker locker(&m_mutex); + + if (m_pSink) + { + m_pSink->stop(); + delete m_pSink; + + m_pSink = NULL; + } + + m_pBuffer = NULL; + + m_bInited = FALSE; +} + +void CQAudioPlay::playAudio(uint8 * data, int size) +{ + if (!m_bInited) + { + return; + } + + QMutexLocker locker(&m_mutex); + + int rlen = m_pBuffer->write((char *)data, size); + while (rlen < size) + { + if (rlen < 0) + { + break; // error + } + else + { + size -= rlen; + data += rlen; + } + + rlen = m_pBuffer->write((char *)data, size); + } +} + +BOOL CQAudioPlay::setVolume(int volume) +{ + QMutexLocker locker(&m_mutex); + + if (m_pSink) + { + double db = (double) volume / (HTVOLUME_MAX - HTVOLUME_MIN); + if (db < 0) + { + db = 0.0; + } + else if (db > 1.0) + { + db = 1.0; + } + + log_print(HT_LOG_DBG, "%s, volume=%d, db=%f\r\n", __FUNCTION__, volume, db); + + m_pSink->setVolume(db); + + return TRUE; + } + + return FALSE; +} + +int CQAudioPlay::getVolume() +{ + double volume = HTVOLUME_MIN; + + QMutexLocker locker(&m_mutex); + + if (m_pSink) + { + volume = m_pSink->volume(); + } + + int nv = (HTVOLUME_MAX - HTVOLUME_MIN) * volume + HTVOLUME_MIN; + + return nv; +} + + + diff --git a/MediaClient/MediaClient/media/audio_play_qt.h b/MediaClient/MediaClient/media/audio_play_qt.h new file mode 100644 index 0000000..52b6224 --- /dev/null +++ b/MediaClient/MediaClient/media/audio_play_qt.h @@ -0,0 +1,56 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef AUDIO_PLAY_QT_H +#define AUDIO_PLAY_QT_H + +#include "sys_inc.h" +#include "linked_list.h" +#include "media_format.h" +#include "audio_play.h" +#include +#include +#include +#include +#include + + +class CQAudioPlay : public QObject, public CAudioPlay +{ + Q_OBJECT + +public: + CQAudioPlay(QObject * parent = NULL); + ~CQAudioPlay(); + + BOOL startPlay(int samplerate, int channels); + void stopPlay(); + BOOL setVolume(int volume); + int getVolume(); + void playAudio(uint8 * pData, int len); + +private: + QAudioSink * m_pSink; + QIODevice * m_pBuffer; + QMutex m_mutex; +}; + +#endif + + diff --git a/MediaClient/MediaClient/media/audio_play_win.cpp b/MediaClient/MediaClient/media/audio_play_win.cpp new file mode 100644 index 0000000..4422a46 --- /dev/null +++ b/MediaClient/MediaClient/media/audio_play_win.cpp @@ -0,0 +1,349 @@ +/*************************************************************************************** + * + * 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 "audio_play_win.h" + +/**************************************************************************************/ + +#pragma comment(lib, "dsound.lib") + + +/**************************************************************************************/ + +CWAudioPlay::CWAudioPlay() +: CAudioPlay() +, m_pDSound8(NULL) +, m_pDSoundBuffer(NULL) +, m_pMutex(NULL) +, m_pAudioBuff(NULL) +, m_nAudioBuffLen(0) +, m_nLastChunk(0) +, m_nBufferNums(8) +, m_nSampleNums(1024) +, m_nSpecSize(0) +{ + m_pMutex = sys_os_create_mutex(); +} + +CWAudioPlay::~CWAudioPlay(void) +{ + stopPlay(); + + sys_os_destroy_sig_mutex(m_pMutex); + + m_pMutex = NULL; +} + +BOOL CWAudioPlay::startPlay(int samplerate, int channels) +{ + HRESULT ret = DirectSoundCreate8(NULL, &m_pDSound8, NULL); + if (FAILED(ret)) + { + log_print(HT_LOG_ERR, "%s, DirectSoundCreate8 failed\r\n", __FUNCTION__); + return FALSE; + } + + ret = m_pDSound8->SetCooperativeLevel(GetDesktopWindow(), DSSCL_NORMAL); + if (FAILED(ret)) + { + stopPlay(); + log_print(HT_LOG_ERR, "%s, SetCooperativeLevel failed\r\n", __FUNCTION__); + return FALSE; + } + + WAVEFORMATEX format; + memset(&format, 0, sizeof(WAVEFORMATEX)); + + format.wFormatTag = WAVE_FORMAT_PCM; + format.nChannels = channels; + format.wBitsPerSample = 16; + format.nSamplesPerSec = samplerate; + format.nBlockAlign = format.nChannels * format.wBitsPerSample / 8; + format.nAvgBytesPerSec = format.nBlockAlign * format.nSamplesPerSec; + format.cbSize = 0; + + DSBUFFERDESC buf_desc; + memset(&buf_desc, 0, sizeof(DSBUFFERDESC)); + + m_nSpecSize = m_nSampleNums * channels * 2; + + buf_desc.dwSize = sizeof(buf_desc); + buf_desc.dwFlags = DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_GLOBALFOCUS | DSBCAPS_CTRLVOLUME; + buf_desc.dwBufferBytes = m_nBufferNums * m_nSpecSize; + buf_desc.dwReserved = 0; + buf_desc.lpwfxFormat = &format; + + ret = m_pDSound8->CreateSoundBuffer(&buf_desc, &m_pDSoundBuffer, NULL); + if (FAILED(ret)) + { + stopPlay(); + log_print(HT_LOG_ERR, "%s, CreateSoundBuffer failed\r\n", __FUNCTION__); + return FALSE; + } + + m_pDSoundBuffer->SetFormat(&format); + + void * buf1 = NULL; + DWORD len1 = 0; + void * buf2 = NULL; + DWORD len2 = 0; + + /* Silence the initial audio buffer */ + ret = m_pDSoundBuffer->Lock(0, buf_desc.dwBufferBytes, &buf1, &len1, &buf2, &len2, DSBLOCK_ENTIREBUFFER); + if (ret == DS_OK) + { + memset(buf1, 0, len1); + + m_pDSoundBuffer->Unlock(buf1, len1, buf2, len2); + } + + m_pAudioBuff = (uint8 *) malloc(m_nSpecSize); + if (NULL == m_pAudioBuff) + { + stopPlay(); + log_print(HT_LOG_ERR, "%s, memory malloc failed\r\n", __FUNCTION__); + return FALSE; + } + + m_nSamplerate = samplerate; + m_nChannels = channels; + m_bInited = TRUE; + + return TRUE; +} + +void CWAudioPlay::stopPlay() +{ + m_bInited = FALSE; + + sys_os_mutex_enter(m_pMutex); + + if (m_pDSoundBuffer) + { + m_pDSoundBuffer->Stop(); + m_pDSoundBuffer->Release(); + m_pDSoundBuffer = NULL; + } + + if (m_pDSound8) + { + m_pDSound8->Release(); + m_pDSound8 = NULL; + } + + if (m_pAudioBuff) + { + free(m_pAudioBuff); + m_pAudioBuff = NULL; + } + + sys_os_mutex_leave(m_pMutex); + + m_nAudioBuffLen = 0; +} + +BOOL CWAudioPlay::setVolume(int volume) +{ + if (m_pDSoundBuffer) + { + double db = (double) volume / (HTVOLUME_MAX - HTVOLUME_MIN); + if (db < 0) + { + db = -db; + } + + int nv = (DSBVOLUME_MAX - DSBVOLUME_MIN) * db + DSBVOLUME_MIN; + + HRESULT hr = m_pDSoundBuffer->SetVolume(nv); + if (DS_OK == hr) + { + return TRUE; + } + } + + return FALSE; +} + +int CWAudioPlay::getVolume() +{ + if (m_pDSoundBuffer) + { + long volume = 0; + + HRESULT ret = m_pDSoundBuffer->GetVolume(&volume); + if (SUCCEEDED(ret)) + { + double db = (double) volume / (DSBVOLUME_MAX - DSBVOLUME_MIN); + if (db < 0) + { + db = -db; + } + + int nv = (HTVOLUME_MAX - HTVOLUME_MIN) * db + HTVOLUME_MIN; + + return nv; + } + } + + return HTVOLUME_MIN; +} + +void CWAudioPlay::playAudio1(uint8 * data, int size) +{ + DWORD cursor = 0; + DWORD junk = 0; + HRESULT result = DS_OK; + DWORD rawlen = 0; + void * bufptr = NULL; + + /* Figure out which blocks to fill next */ + result = m_pDSoundBuffer->GetCurrentPosition(&junk, &cursor); + if (result == DSERR_BUFFERLOST) + { + m_pDSoundBuffer->Restore(); + result = m_pDSoundBuffer->GetCurrentPosition(&junk, &cursor); + } + + if (result != DS_OK) + { + return; + } + + cursor /= m_nSpecSize; + + m_nLastChunk = cursor; + cursor = (cursor + 1) % m_nBufferNums; + cursor *= m_nSpecSize; + + /* Lock the audio buffer */ + result = m_pDSoundBuffer->Lock(cursor, m_nSpecSize, &bufptr, &rawlen, NULL, &junk, 0); + if (result == DSERR_BUFFERLOST) + { + m_pDSoundBuffer->Restore(); + result = m_pDSoundBuffer->Lock(cursor, m_nSpecSize, &bufptr, &rawlen, NULL, &junk, 0); + } + + if (result != DS_OK) + { + return; + } + + if (bufptr && rawlen > 0) + { + memcpy(bufptr, data, rawlen); + } + + m_pDSoundBuffer->Unlock(bufptr, rawlen, NULL, 0); + + waitDevice(); +} + +void CWAudioPlay::playAudio(uint8 * data, int size) +{ + if (!m_bInited) + { + return; + } + + sys_os_mutex_enter(m_pMutex); + + if (NULL == m_pDSoundBuffer) + { + sys_os_mutex_leave(m_pMutex); + return; + } + + while (m_nAudioBuffLen + size >= (uint32)m_nSpecSize) + { + memcpy(m_pAudioBuff + m_nAudioBuffLen, data, m_nSpecSize - m_nAudioBuffLen); + + playAudio1(m_pAudioBuff, m_nSpecSize); + + size -= m_nSpecSize - m_nAudioBuffLen; + data += m_nSpecSize - m_nAudioBuffLen; + + m_nAudioBuffLen = 0; + } + + if (size > 0) + { + memcpy(m_pAudioBuff + m_nAudioBuffLen, data, size); + m_nAudioBuffLen += size; + } + + sys_os_mutex_leave(m_pMutex); +} + +void CWAudioPlay::waitDevice() +{ + DWORD status = 0; + DWORD cursor = 0; + DWORD junk = 0; + HRESULT result = DS_OK; + + result = m_pDSoundBuffer->GetCurrentPosition(&junk, &cursor); + if (result != DS_OK) + { + if (result == DSERR_BUFFERLOST) + { + m_pDSoundBuffer->Restore(); + } + return; + } + + while ((cursor / m_nSpecSize) == m_nLastChunk) + { + usleep(1000); + + /* Try to restore a lost sound buffer */ + m_pDSoundBuffer->GetStatus(&status); + + if (status & DSBSTATUS_BUFFERLOST) + { + m_pDSoundBuffer->Restore(); + m_pDSoundBuffer->GetStatus(&status); + + if ((status & DSBSTATUS_BUFFERLOST)) + { + break; + } + } + + if (!(status & DSBSTATUS_PLAYING)) + { + result = m_pDSoundBuffer->Play(0, 0, DSBPLAY_LOOPING); + if (result == DS_OK) + { + continue; + } + + return; + } + + /* Find out where we are playing */ + result = m_pDSoundBuffer->GetCurrentPosition(&junk, &cursor); + if (result != DS_OK) + { + return; + } + } +} + + diff --git a/MediaClient/MediaClient/media/audio_play_win.h b/MediaClient/MediaClient/media/audio_play_win.h new file mode 100644 index 0000000..6432773 --- /dev/null +++ b/MediaClient/MediaClient/media/audio_play_win.h @@ -0,0 +1,61 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef AUDIO_PLAY_WIN_H +#define AUDIO_PLAY_WIN_H + +#include "media_format.h" +#include "audio_play.h" +#include + + +class CWAudioPlay : public CAudioPlay +{ +public: + CWAudioPlay(); + ~CWAudioPlay(); + +public: + BOOL startPlay(int samplerate, int channels); + void stopPlay(); + BOOL setVolume(int volume); + int getVolume(); + void playAudio(uint8 * pData, int len); + +private: + void playAudio1(uint8 * data, int size); + void waitDevice(); + +private: + LPDIRECTSOUND8 m_pDSound8; + LPDIRECTSOUNDBUFFER m_pDSoundBuffer; + + void * m_pMutex; + uint8 * m_pAudioBuff; + uint32 m_nAudioBuffLen; + int m_nLastChunk; + int m_nBufferNums; + int m_nSampleNums; + int m_nSpecSize; +}; + +#endif + + + diff --git a/MediaClient/MediaClient/media/avcodec_mutex.cpp b/MediaClient/MediaClient/media/avcodec_mutex.cpp new file mode 100644 index 0000000..75ac307 --- /dev/null +++ b/MediaClient/MediaClient/media/avcodec_mutex.cpp @@ -0,0 +1,48 @@ +/*************************************************************************************** + * + * 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 "avcodec_mutex.h" + +void * g_avcodec_mutex = sys_os_create_mutex(); + +int avcodec_thread_open(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options) +{ + int ret; + + sys_os_mutex_enter(g_avcodec_mutex); + ret = avcodec_open2(avctx, codec, options); + sys_os_mutex_leave(g_avcodec_mutex); + + return ret; +} + +int avcodec_thread_close(AVCodecContext *avctx) +{ + int ret; + + sys_os_mutex_enter(g_avcodec_mutex); + ret = avcodec_close(avctx); + sys_os_mutex_leave(g_avcodec_mutex); + + return ret; +} + + + diff --git a/MediaClient/MediaClient/media/avcodec_mutex.h b/MediaClient/MediaClient/media/avcodec_mutex.h new file mode 100644 index 0000000..195663d --- /dev/null +++ b/MediaClient/MediaClient/media/avcodec_mutex.h @@ -0,0 +1,41 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef AVCODEC_MUTEX_H +#define AVCODEC_MUTEX_H + +extern "C" { +#include "libavcodec/avcodec.h" +} + +#ifdef __cplusplus +extern "C" { +#endif + +int avcodec_thread_open(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options); +int avcodec_thread_close(AVCodecContext *avctx); + +#ifdef __cplusplus +} +#endif + + +#endif + + diff --git a/MediaClient/MediaClient/media/avi.h b/MediaClient/MediaClient/media/avi.h new file mode 100644 index 0000000..ca12ab2 --- /dev/null +++ b/MediaClient/MediaClient/media/avi.h @@ -0,0 +1,188 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef AVI_H +#define AVI_H + +#include "format.h" + +/* Flags in avih */ +#define AVIF_HASINDEX 0x00000010 // Index at end of file? +#define AVIF_ISINTERLEAVED 0x00000100 // is interleaved? +#define AVIF_TRUSTCKTYPE 0x00000800 // Use CKType to find key frames? + +#define AVIIF_KEYFRAME 0x00000010L // this frame is a key frame. + +#pragma pack(push) +#pragma pack(1) + +typedef struct avi_riff +{ + uint32 riff; + uint32 len; + uint32 type; +} AVIRIFF; + +typedef struct avi_pkt +{ + uint32 type; // packet type : PACKET_TYPE_UNKNOW, PACKET_TYPE_VIDEO,PACKET_TYPE_AUDIO + uint8 * rbuf; // buffer pointer + uint32 mlen; // buffer size + uint8 * dbuf; // data pointer + uint32 len; // packet length +} AVIPKT; + +typedef struct avi_main_header +{ + uint32 dwMicroSecPerFrame; // render time for per frame, unit is ns + uint32 dwMaxBytesPerSec; // maximum data transfer rate + uint32 dwPaddingGranularity; // The length of the record block needs to be a multiple of this value, usually 2048 + uint32 dwFlags; // Special attributes of AVI files, such as whether to include index blocks, whether audio and video data is interleaved + uint32 dwTotalFrames; // The total number of frames in the file + uint32 dwInitialFrames; // How much frames is needed before starting to play + uint32 dwStreams; // The number of data streams contained in the file + uint32 dwSuggestedBufferSize; // The recommended size of the buffer, usually the sum of the data needed to store an image and synchronize the sound + uint32 dwWidth; // Image width + uint32 dwHeight; // Image height + uint32 dwReserved[4]; // Reserved +} AVIMHDR; + +typedef struct avi_stream_header +{ + uint32 fccType; // 4 bytes, indicating the type of data stream, vids for video data stream, auds audio data stream + uint32 fccHandler; // 4 bytes, indicating the driver code for data stream decompression + uint32 dwFlags; // Data stream attribute + uint16 wPriority; // Play priority of this stream + uint16 wLanguage; // Audio language code + uint32 dwInitialFrames; // How much frames is needed before starting to play + uint32 dwScale; // The amount of data, the size of each video or the sample size of the audio + uint32 dwRate; // dwScale / dwRate = Number of samples per second + uint32 dwStart; // The location where the data stream starts playing, in dwScale + uint32 dwLength; // The amount of data in the data stream, in dwScale + uint32 dwSuggestedBufferSize; // Recommended buffer size + uint32 dwQuality; // Decompress quality parameters, the larger the value, the better the quality + uint32 dwSampleSize; // Sample size of the audio + + struct + { + short left; + short top; + short right; + short bottom; + } rcFrame; +} AVISHDR; + +typedef struct bitmap_info_header +{ + uint32 biSize; + int biWidth; + int biHeight; + uint16 biPlanes; + uint16 biBitCount; + uint32 biCompression; + uint32 biSizeImage; + int biXPelsPerMeter; + int biYPelsPerMeter; + uint32 biClrUsed; + uint32 biClrImportant; +} BMPHDR; + +typedef struct wave_format +{ + uint16 wFormatTag; // format type + uint16 nChannels; // number of channels (i.e. mono, stereo...) + uint32 nSamplesPerSec; // sample rate + uint32 nAvgBytesPerSec; // for buffer estimation + uint16 nBlockAlign; // block size of data + uint16 wBitsPerSample; // number of bits per sample of mono data + uint16 cbSize; // the count in bytes of the size of + + // extra information (after cbSize) +} WAVEFMT; + +#pragma pack(pop) + +typedef struct avi_file_context +{ + uint32 ctxf_read : 1; // Read mode + uint32 ctxf_write : 1; // Write mode + uint32 ctxf_idx : 1; // File has index + uint32 ctxf_audio : 1; // Has audio stream + uint32 ctxf_video : 1; // Has video stream + uint32 ctxf_idx_m : 1; // Index data write mode: = 1, memory mode; = 0, temporary file + uint32 ctxf_calcfps: 1; // Calc video framerate + uint32 ctxf_nalu : 1; // For H.26x, VPS, SPS,PPS written flag + uint32 ctxf_iframe : 1; // For H.26x, key frame written flag + uint32 ctxf_res : 23; + + AVIMHDR avi_hdr; // AVI main header + AVISHDR str_v; // Video stream header + BMPHDR bmp; // BITMAP format + AVISHDR str_a; // Audio stream header + WAVEFMT wave; // WAVE format + + FILE * fp; // Read and write file handle + uint32 flen; // Total file length, used when reading + char filename[256]; // File full path + void * mutex; // Write, close mutex + + uint32 v_fps; // Video frame rate + char v_fcc[4]; // Video compression standard, "H264","H265","JPEG","MP4V" + int v_width; // Video width + int v_height; // Video height + uint8 * v_extra; // Video extra data + int v_extra_len; // Video extra data length + + int a_rate; // Sampling frequency + uint16 a_fmt; // Audio compression standard + int a_chns; // Number of audio channels + uint8 * a_extra; // Audio extra data + int a_extra_len; // Audio extra data length + + int i_movi; // Where the real data starts + int i_movi_end; // End of data, where the index starts + int i_riff; // After the index, the length of the entire file + + int pkt_offset; // Packet offset when reading + int index_offset; // Index position when reading + int back_index; // The first read index position when reading in reverse order, usually sps/vps + + int i_frame_video; // Video frame read and write count + int i_frame_audio; // Audio frame read and write count + uint32 audio_total_bytes; // Audio total bytes + + uint32 prev_ts; // previous timestamp + uint32 v_s_time; // Video start recording time = first packet write time + uint32 v_e_time; // The time when video package was recently written + uint32 a_s_time; // Audio start recording time = first packet write time + uint32 a_e_time; // The time when audio package was recently written + + int i_idx_max; // The maximum number of indexes currently allocated + int i_idx; // Current index number (video index + audio index) + int * idx; // Index array + + FILE * idx_fp; // Index temporary file + int idx_fix[128]; // Index file data is enough to write once for one sector + int idx_fix_off; // The index data has been stored in the offset of idx_fix +} AVICTX; + +#endif // AVI_H + + + diff --git a/MediaClient/MediaClient/media/avi_write.cpp b/MediaClient/MediaClient/media/avi_write.cpp new file mode 100644 index 0000000..975e6d6 --- /dev/null +++ b/MediaClient/MediaClient/media/avi_write.cpp @@ -0,0 +1,1144 @@ +/*************************************************************************************** + * + * 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 "avi.h" +#include "avi_write.h" +#include "h264.h" +#include "h265.h" +#include "mjpeg.h" +#include "media_util.h" +#include "h264_util.h" +#include "h265_util.h" +#include + + +int avi_write_uint16_(AVICTX * p_ctx, uint16 w) +{ + return fwrite(&w, 2, 1, p_ctx->fp); +} + +int avi_write_uint32_(AVICTX * p_ctx, uint32 dw) +{ + return fwrite(&dw, 4, 1, p_ctx->fp); +} + +int avi_write_fourcc_(AVICTX * p_ctx, const char fcc[4]) +{ + return fwrite(fcc, 4, 1, p_ctx->fp); +} + +int avi_write_buffer_(AVICTX * p_ctx, char * p_data, int len) +{ + return fwrite(p_data, len, 1, p_ctx->fp); +} + +#define avi_write_uint16(p_ctx, w) do{ if(avi_write_uint16_(p_ctx, w) != 1) goto w_err; }while(0) +#define avi_write_uint32(p_ctx, w) do{ if(avi_write_uint32_(p_ctx, w) != 1) goto w_err; }while(0) +#define avi_write_fourcc(p_ctx, fcc) do{ if(avi_write_fourcc_(p_ctx, fcc) != 1) goto w_err; }while(0) +#define avi_write_buffer(p_ctx, p_data, len) do{ if(avi_write_buffer_(p_ctx, p_data, len) != 1) goto w_err; }while(0) + +void avi_free_idx(AVICTX * p_ctx) +{ + if (p_ctx->idx) + { + free(p_ctx->idx); + p_ctx->idx = NULL; + } + + if (p_ctx->idx_fp) + { + fclose(p_ctx->idx_fp); + p_ctx->idx_fp = NULL; + } + + p_ctx->i_idx = 0; + p_ctx->i_idx_max = 0; +} + +int avi_write_idx(AVICTX * p_ctx) +{ + avi_write_fourcc(p_ctx, "idx1"); + avi_write_uint32(p_ctx, p_ctx->i_idx * 16); + + if (p_ctx->ctxf_idx_m == 1) + { + if (p_ctx->i_idx > 0) + { + if (fwrite(p_ctx->idx, p_ctx->i_idx * 16, 1, p_ctx->fp) != 1) + { + return -1; + } + } + } + else if (p_ctx->idx_fp) + { + // Write index data in a fixed buffer to an index file + if (p_ctx->idx_fix_off > 0) + { + if (fwrite(p_ctx->idx_fix, p_ctx->idx_fix_off * 4, 1, p_ctx->idx_fp) != 1) + { + goto w_err; + } + + p_ctx->idx_fix_off = 0; + } + + // Write index temporary file data to the avi file + + fseek(p_ctx->idx_fp, 0, SEEK_END); + + int idx_len = ftell(p_ctx->idx_fp); + + if (idx_len != (p_ctx->i_idx * 16)) + { + log_print(HT_LOG_ERR, "%s, idx real len[%d] != idx file len[%d],idx_fix_off[%d]!!!\r\n", + __FUNCTION__, p_ctx->i_idx * 16, idx_len, p_ctx->idx_fix_off * 4); + return -1; + } + + fseek(p_ctx->fp, 0, SEEK_END); + fseek(p_ctx->idx_fp, 0, SEEK_SET); + + int rlen; + + do + { + rlen = fread(p_ctx->idx_fix, 1, sizeof(p_ctx->idx_fix), p_ctx->idx_fp); + if (rlen <= 0) + { + break; + } + + if (fwrite(p_ctx->idx_fix, rlen, 1, p_ctx->fp) != 1) + { + log_print(HT_LOG_ERR, "%s, write idx into avi file failed!!!\r\n", __FUNCTION__); + return -1; + } + } while(rlen > 0); + } + + return 0; + +w_err: + + return -1; +} + +void avi_set_dw(void * p, uint32 dw) +{ + uint8 * ptr = (uint8 *)p; + + ptr[0] = (dw ) & 0xff; + ptr[1] = (dw >> 8 ) & 0xff; + ptr[2] = (dw >> 16) & 0xff; + ptr[3] = (dw >> 24) & 0xff; +} + +int avi_end(AVICTX * p_ctx) +{ + if (p_ctx->fp == NULL) + { + return -1; + } + + p_ctx->i_movi_end = ftell(p_ctx->fp); + + if (avi_write_idx(p_ctx) < 0) + { + goto end_err; + } + + p_ctx->i_riff = ftell(p_ctx->fp); + + if (avi_write_header(p_ctx) < 0) + { + goto end_err; + } + + // AVI file has been completed, delete the temporary index file + if (p_ctx->idx_fp) + { + fclose(p_ctx->idx_fp); + p_ctx->idx_fp = NULL; + +#if defined(ANDROID) + char cmds[512]; + snprintf(cmds, sizeof(cmds)-1, "rm -f %s.idx", p_ctx->filename); + system(cmds); +#else + char filename[512]; + snprintf(filename, sizeof(filename)-1, "%s.idx", p_ctx->filename); + remove(filename); +#endif + } + +end_err: + + if (p_ctx->fp) + { + fclose(p_ctx->fp); + p_ctx->fp = NULL; + } + + avi_free_idx(p_ctx); + + return 0; +} + +/**************************************************************************/ +AVICTX * avi_write_open(const char * filename) +{ + AVICTX * p_ctx = (AVICTX *)malloc(sizeof(AVICTX)); + if (p_ctx == NULL) + { + log_print(HT_LOG_ERR, "%s, malloc fail!!!\r\n", __FUNCTION__); + return NULL; + } + + memset(p_ctx, 0, sizeof(AVICTX)); + + p_ctx->ctxf_write = 1; + + p_ctx->fp = fopen(filename, "wb+"); + if (p_ctx->fp == NULL) + { + free(p_ctx); + log_print(HT_LOG_ERR, "%s, fopen [%s] failed!!!\r\n", __FUNCTION__, filename); + return NULL; + } + + strncpy(p_ctx->filename, filename, sizeof(p_ctx->filename)); + + char idx_path[256]; + snprintf(idx_path, sizeof(idx_path), "%s.idx", filename); + + p_ctx->idx_fp = fopen(idx_path, "wb+"); + if (p_ctx->idx_fp == NULL) + { + fclose(p_ctx->fp); + free(p_ctx); + log_print(HT_LOG_ERR, "%s, fopen [%s] failed!!!\r\n", __FUNCTION__, idx_path); + return NULL; + } + + p_ctx->mutex = sys_os_create_mutex(); + + return p_ctx; +} + +int avi_write_video_frame(AVICTX * p_ctx, void * p_data, uint32 len, uint32 ts, int b_key, int frame) +{ + int ret = -1; + + if (NULL == p_ctx || NULL == p_ctx->fp) + { + return -1; + } + + int i_pos = ftell(p_ctx->fp); + + avi_write_fourcc(p_ctx, "00dc"); + avi_write_uint32(p_ctx, len); + + if (fwrite(p_data, len, 1, p_ctx->fp) != 1) + { + goto w_err; + } + + if (len & 0x01) /* pad */ + { + fputc(0, p_ctx->fp); + } + + if (p_ctx->ctxf_idx_m == 1) + { + if (p_ctx->i_idx_max <= p_ctx->i_idx) + { + p_ctx->i_idx_max += 1000; + p_ctx->idx = (int *)realloc(p_ctx->idx, p_ctx->i_idx_max * 16); + if (p_ctx->idx == NULL) + { + log_print(HT_LOG_ERR, "%s, realloc ret null!!!\r\n", __FUNCTION__); + } + } + + if (p_ctx->idx) + { + memcpy(&p_ctx->idx[4*p_ctx->i_idx+0], "00dc", 4); + avi_set_dw(&p_ctx->idx[4*p_ctx->i_idx+1], b_key ? AVIIF_KEYFRAME : 0); + avi_set_dw(&p_ctx->idx[4*p_ctx->i_idx+2], i_pos); + avi_set_dw(&p_ctx->idx[4*p_ctx->i_idx+3], len); + + p_ctx->i_idx++; + } + } + else if (p_ctx->idx_fp) + { + memcpy(&p_ctx->idx_fix[p_ctx->idx_fix_off + 0], "00dc", 4); + avi_set_dw(&p_ctx->idx_fix[p_ctx->idx_fix_off + 1], b_key ? AVIIF_KEYFRAME : 0); + avi_set_dw(&p_ctx->idx_fix[p_ctx->idx_fix_off + 2], i_pos); + avi_set_dw(&p_ctx->idx_fix[p_ctx->idx_fix_off + 3], len); + + p_ctx->idx_fix_off += 4; + + if (p_ctx->idx_fix_off == (sizeof(p_ctx->idx_fix) / sizeof(int))) + { + if (fwrite(p_ctx->idx_fix, sizeof(p_ctx->idx_fix), 1, p_ctx->idx_fp) != 1) + { + goto w_err; + } + + p_ctx->idx_fix_off = 0; + } + + p_ctx->i_idx++; + } + + if (frame) + { + p_ctx->i_frame_video++; + + if (p_ctx->v_s_time == 0) + { + p_ctx->v_s_time = sys_os_get_ms(); + p_ctx->v_e_time = p_ctx->v_s_time; + } + else + { + p_ctx->v_e_time = sys_os_get_ms(); + } + } + + p_ctx->prev_ts = ts; + + ret = ftell(p_ctx->fp); + +w_err: + + if (ret < 0) + { + log_print(HT_LOG_ERR, "%s, ret[%d] err[%d] [%s]!!!\r\n", __FUNCTION__, ret, errno, strerror(errno)); + + if (p_ctx->fp) + { + fclose(p_ctx->fp); + p_ctx->fp = NULL; + } + + if (p_ctx->idx_fp) + { + fclose(p_ctx->idx_fp); + p_ctx->idx_fp = NULL; + } + } + + return ret; +} + +int avi_write_h264_nalu(AVICTX * p_ctx, uint8 * sps, int sps_len, uint8 * pps, int pps_len) +{ + int flag = 0; + + if (sps_len > 0 && sps) + { + if (avi_write_video_frame(p_ctx, sps, sps_len, 0, 0, 0) > 0) + { + flag = 1; + } + } + + if (pps_len > 0 && pps) + { + if (avi_write_video_frame(p_ctx, pps, pps_len, 0, 0, 0) > 0) + { + flag = 1; + } + } + + p_ctx->ctxf_nalu = flag; + + return flag; +} + +int avi_write_h265_nalu(AVICTX * p_ctx, uint8 * vps, int vps_len, uint8 * sps, int sps_len, uint8 * pps, int pps_len) +{ + int flag = 0; + + if (vps_len > 0 && vps) + { + if (avi_write_video_frame(p_ctx, vps, vps_len, 0, 0, 0) > 0) + { + flag = 1; + } + } + + if (sps_len > 0 && sps) + { + if (avi_write_video_frame(p_ctx, sps, sps_len, 0, 0, 0) > 0) + { + flag = 1; + } + } + + if (pps_len > 0 && pps) + { + if (avi_write_video_frame(p_ctx, pps, pps_len, 0, 0, 0) > 0) + { + flag = 1; + } + } + + p_ctx->ctxf_nalu = flag; + + return flag; +} + +int avi_write_h264(AVICTX * p_ctx, void * p_data, uint32 len, uint32 ts, int b_key) +{ + if (p_ctx->ctxf_nalu) + { + if (!p_ctx->ctxf_iframe) + { + if (b_key) + { + if (avi_write_video_frame(p_ctx, p_data, len, ts, b_key, 1) < 0) + { + log_print(HT_LOG_ERR, "%s, avi_write_video_frame failed\r\n", __FUNCTION__); + return -1; + } + else + { + p_ctx->ctxf_iframe = 1; + } + } + } + else + { + if (avi_write_video_frame(p_ctx, p_data, len, ts, b_key, 1) < 0) + { + log_print(HT_LOG_ERR, "%s, avi_write_video_frame failed\r\n", __FUNCTION__); + return -1; + } + } + } + + return 0; +} + +int avi_write_h265(AVICTX * p_ctx, void * p_data, uint32 len, uint32 ts, int b_key) +{ + if (p_ctx->ctxf_nalu) + { + if (!p_ctx->ctxf_iframe) + { + if (b_key) + { + if (avi_write_video_frame(p_ctx, p_data, len, ts, b_key, 1) < 0) + { + log_print(HT_LOG_ERR, "%s, avi_write_video_frame failed\r\n", __FUNCTION__); + return -1; + } + else + { + p_ctx->ctxf_iframe = 1; + } + } + } + else + { + if (avi_write_video_frame(p_ctx, p_data, len, ts, b_key, 1) < 0) + { + log_print(HT_LOG_ERR, "%s, avi_write_video_frame failed\r\n", __FUNCTION__); + return -1; + } + } + } + + return 0; +} + +int avi_write_video(AVICTX * p_ctx, uint8 * p_data, uint32 len, uint32 ts, int b_key) +{ + int ret = 0; + + sys_os_mutex_enter(p_ctx->mutex); + + if (p_ctx->v_fps == 0) + { + avi_calc_fps(p_ctx); + } + + if (memcmp(p_ctx->v_fcc, "H264", 4) == 0) + { + ret = avi_write_h264(p_ctx, p_data, len, ts, b_key); + } + else if (memcmp(p_ctx->v_fcc, "H265", 4) == 0) + { + ret = avi_write_h265(p_ctx, p_data, len, ts, b_key); + } + else + { + ret = avi_write_video_frame(p_ctx, p_data, len, ts, b_key, 1); + } + + sys_os_mutex_leave(p_ctx->mutex); + + return ret; +} + +int avi_write_nalu(AVICTX * p_ctx, uint8 * vps, int vps_len, uint8 * sps, int sps_len, uint8 * pps, int pps_len) +{ + int ret = 0; + + if (p_ctx->ctxf_nalu) + { + return 0; + } + + sys_os_mutex_enter(p_ctx->mutex); + + if (memcmp(p_ctx->v_fcc, "H264", 4) == 0) + { + ret = avi_write_h264_nalu(p_ctx, sps, sps_len, pps, pps_len); + } + else if (memcmp(p_ctx->v_fcc, "H265", 4) == 0) + { + ret = avi_write_h265_nalu(p_ctx, vps, vps_len, sps, sps_len, pps, pps_len); + } + + sys_os_mutex_leave(p_ctx->mutex); + + return ret; +} + +int avi_write_audio(AVICTX * p_ctx, uint8 * p_data, uint32 len, uint32 ts) +{ + int ret = -1; + + if (NULL == p_ctx) + { + return -1; + } + + if (p_ctx->ctxf_video) + { + if (memcmp(p_ctx->v_fcc, "H264", 4) == 0 || + memcmp(p_ctx->v_fcc, "H265", 4) == 0) + { + if (!p_ctx->ctxf_iframe) + { + return 0; + } + } + } + + if (p_ctx->a_fmt == AUDIO_FORMAT_AAC) // AAC + { + if (p_data[0] == 0xFF && (p_data[1] & 0xF0) == 0xF0) + { + // skip ADTS header + p_data += 7; + len -= 7; + } + } + + sys_os_mutex_enter(p_ctx->mutex); + + if (NULL == p_ctx->fp) + { + sys_os_mutex_leave(p_ctx->mutex); + return -1; + } + + int i_pos = ftell(p_ctx->fp); + + /* chunk header */ + avi_write_fourcc(p_ctx, "01wb"); + avi_write_uint32(p_ctx, len); + + if (fwrite(p_data, len, 1, p_ctx->fp) != 1) + { + goto w_err; + } + + if (len & 0x01) /* pad */ + { + fputc(0, p_ctx->fp); + } + + if (p_ctx->ctxf_idx_m == 1) + { + if (p_ctx->i_idx_max <= p_ctx->i_idx) + { + p_ctx->i_idx_max += 1000; + p_ctx->idx = (int *)realloc(p_ctx->idx, p_ctx->i_idx_max * 16); + if (p_ctx->idx == NULL) + { + log_print(HT_LOG_ERR, "%s, realloc ret null!!!\r\n", __FUNCTION__); + } + } + + if (p_ctx->idx) + { + memcpy(&p_ctx->idx[4*p_ctx->i_idx+0], "01wb", 4); + avi_set_dw(&p_ctx->idx[4*p_ctx->i_idx+1], AVIIF_KEYFRAME); + avi_set_dw(&p_ctx->idx[4*p_ctx->i_idx+2], i_pos); + avi_set_dw(&p_ctx->idx[4*p_ctx->i_idx+3], len); + + p_ctx->i_idx++; + } + } + else if (p_ctx->idx_fp) + { + memcpy(&p_ctx->idx_fix[p_ctx->idx_fix_off + 0], "01wb", 4); + avi_set_dw(&p_ctx->idx_fix[p_ctx->idx_fix_off + 1], AVIIF_KEYFRAME); + avi_set_dw(&p_ctx->idx_fix[p_ctx->idx_fix_off + 2], i_pos); + avi_set_dw(&p_ctx->idx_fix[p_ctx->idx_fix_off + 3], len); + + p_ctx->idx_fix_off += 4; + + if (p_ctx->idx_fix_off == (sizeof(p_ctx->idx_fix) / sizeof(int))) + { + if (fwrite(p_ctx->idx_fix, sizeof(p_ctx->idx_fix), 1, p_ctx->idx_fp) != 1) + { + goto w_err; + } + + p_ctx->idx_fix_off = 0; + } + + p_ctx->i_idx++; + } + + p_ctx->i_frame_audio++; + p_ctx->audio_total_bytes += len; + + if (p_ctx->a_s_time == 0) + { + p_ctx->a_s_time = sys_os_get_ms(); + p_ctx->a_e_time = p_ctx->a_s_time; + } + else + { + p_ctx->a_e_time = sys_os_get_ms(); + } + + ret = ftell(p_ctx->fp); + +w_err: + + if (ret < 0) + { + log_print(HT_LOG_ERR, "%s, ret[%d]!!!\r\n", __FUNCTION__, ret); + + if (p_ctx->fp) + { + fclose(p_ctx->fp); + p_ctx->fp = NULL; + } + + if (p_ctx->idx_fp) + { + fclose(p_ctx->idx_fp); + p_ctx->idx_fp = NULL; + } + } + + sys_os_mutex_leave(p_ctx->mutex); + + return ret; +} + +void avi_write_close(AVICTX * p_ctx) +{ + if (NULL == p_ctx) + { + return; + } + + sys_os_mutex_enter(p_ctx->mutex); + + avi_end(p_ctx); + avi_free_idx(p_ctx); + + if (p_ctx->v_extra) + { + free(p_ctx->v_extra); + } + + if (p_ctx->a_extra) + { + free(p_ctx->a_extra); + } + + sys_os_mutex_leave(p_ctx->mutex); + + sys_os_destroy_sig_mutex(p_ctx->mutex); + + free(p_ctx); +} + +void avi_set_video_info(AVICTX * p_ctx, int fps, int width, int height, const char fcc[4]) +{ + memcpy(p_ctx->v_fcc, fcc, 4); // "H264","H265","JPEG","MP4V" + p_ctx->v_fps = fps; + p_ctx->v_width = width; + p_ctx->v_height = height; + + p_ctx->ctxf_video = 1; + p_ctx->ctxf_calcfps = fps > 0 ? 0 : 1; +} + +void avi_set_video_extra_info(AVICTX * p_ctx, uint8 * extra, int extra_len) +{ + if (NULL != extra && extra_len > 0) + { + if (p_ctx->v_extra) + { + free(p_ctx->v_extra); + } + + p_ctx->v_extra_len = 0; + + p_ctx->v_extra = (uint8*) malloc(extra_len); + if (p_ctx->v_extra) + { + memcpy(p_ctx->v_extra, extra, extra_len); + p_ctx->v_extra_len = extra_len; + } + } +} + +void avi_set_audio_info(AVICTX * p_ctx, int chns, int rate, uint16 fmt) +{ + p_ctx->a_chns = chns; + p_ctx->a_rate = rate; + p_ctx->a_fmt = fmt; + + p_ctx->ctxf_audio = 1; +} + +void avi_set_audio_extra_info(AVICTX * p_ctx, uint8 * extra, int extra_len) +{ + if (NULL != extra && extra_len > 0) + { + if (p_ctx->a_extra) + { + free(p_ctx->a_extra); + } + + p_ctx->a_extra_len = 0; + + p_ctx->a_extra = (uint8*) malloc(extra_len); + if (p_ctx->a_extra) + { + memcpy(p_ctx->a_extra, extra, extra_len); + p_ctx->a_extra_len = extra_len; + } + } +} + +void avi_build_video_hdr(AVICTX * p_ctx) +{ + if (p_ctx->ctxf_video == 0) + { + return; + } + + avi_calc_fps(p_ctx); + + memcpy(&p_ctx->str_v.fccHandler, p_ctx->v_fcc, 4); + + p_ctx->str_v.fccType = mmioFOURCC('v','i','d','s'); + p_ctx->str_v.dwFlags = 0; // Contains AVITF_ flags + p_ctx->str_v.wPriority = 0; + p_ctx->str_v.wLanguage = 0; + p_ctx->str_v.dwInitialFrames = 0; + p_ctx->str_v.dwScale = 1; + p_ctx->str_v.dwRate = (p_ctx->v_fps == 0) ? 25 : p_ctx->v_fps; // dwRate / dwScale == samplessecond + p_ctx->str_v.dwStart = 0; + p_ctx->str_v.dwLength = p_ctx->i_frame_video; // In units above.. + p_ctx->str_v.dwSuggestedBufferSize = 1024*1024; + p_ctx->str_v.dwQuality = -1; + p_ctx->str_v.dwSampleSize = 0; + p_ctx->str_v.rcFrame.left = 0; + p_ctx->str_v.rcFrame.top = 0; + p_ctx->str_v.rcFrame.right = p_ctx->v_width; + p_ctx->str_v.rcFrame.bottom = p_ctx->v_height; + + memcpy(&p_ctx->bmp.biCompression, p_ctx->v_fcc, 4); + + p_ctx->bmp.biSize = sizeof(BMPHDR); + p_ctx->bmp.biWidth = p_ctx->v_width; + p_ctx->bmp.biHeight = p_ctx->v_height; + p_ctx->bmp.biPlanes = 1; + p_ctx->bmp.biBitCount = 24; + p_ctx->bmp.biSizeImage = p_ctx->v_width * p_ctx->v_height * 3; + p_ctx->bmp.biXPelsPerMeter = 0; + p_ctx->bmp.biYPelsPerMeter = 0; + p_ctx->bmp.biClrUsed = 0; + p_ctx->bmp.biClrImportant = 0; +} + +void avi_build_audio_hdr(AVICTX * p_ctx) +{ + if (p_ctx->ctxf_audio == 0) + { + return; + } + + int bps, blkalign, bytespersec; + uint32 scale = 1; + uint32 length; + + if (p_ctx->a_fmt == AUDIO_FORMAT_ALAW) // G711A + { + bps = 8; + blkalign = p_ctx->a_chns; + bytespersec = p_ctx->a_rate * p_ctx->a_chns; + length = p_ctx->audio_total_bytes / blkalign; + } + else if (p_ctx->a_fmt == AUDIO_FORMAT_MULAW) // G711U + { + bps = 8; + blkalign = p_ctx->a_chns; + bytespersec = p_ctx->a_rate * p_ctx->a_chns; + length = p_ctx->audio_total_bytes / blkalign; + } + else if (p_ctx->a_fmt == AUDIO_FORMAT_AAC) // AAC + { + bps = 16; + blkalign = 768 * p_ctx->a_chns; /* maximum bytes per frame */ + bytespersec = p_ctx->a_rate * p_ctx->a_chns / 8; + scale = 1024; + length = p_ctx->i_frame_audio; + } + else if (p_ctx->a_fmt == AUDIO_FORMAT_G726) // G726 + { + bps = 8; + blkalign = p_ctx->a_chns; + bytespersec = p_ctx->a_rate * p_ctx->a_chns; + length = p_ctx->audio_total_bytes / blkalign; + } + else if (p_ctx->a_fmt == AUDIO_FORMAT_G722) // G722 + { + bps = 4; + blkalign = p_ctx->a_chns; + bytespersec = p_ctx->a_rate * p_ctx->a_chns; + length = p_ctx->audio_total_bytes / blkalign; + } + else + { + bps = 8; + blkalign = p_ctx->a_chns; + bytespersec = p_ctx->a_rate * p_ctx->a_chns; + length = p_ctx->audio_total_bytes / blkalign; + } + + if (p_ctx->audio_total_bytes > 0 && p_ctx->a_e_time > p_ctx->a_s_time + 5000) + { + bytespersec = p_ctx->audio_total_bytes / ((p_ctx->a_e_time - p_ctx->a_s_time) / 1000); + } + + p_ctx->str_a.fccType = mmioFOURCC('a','u','d','s'); + p_ctx->str_a.fccHandler = 1; + p_ctx->str_a.dwFlags = 0; // Contains AVITF_ flags + p_ctx->str_a.wPriority = 0; + p_ctx->str_a.wLanguage = 0; + p_ctx->str_a.dwInitialFrames = 0; + p_ctx->str_a.dwScale = scale; + p_ctx->str_a.dwRate = p_ctx->a_rate; + p_ctx->str_a.dwStart = 0; + p_ctx->str_a.dwLength = length; + p_ctx->str_a.dwSuggestedBufferSize = 12*1024; + p_ctx->str_a.dwQuality = -1; + p_ctx->str_a.dwSampleSize = blkalign; + p_ctx->str_a.rcFrame.left = 0; + p_ctx->str_a.rcFrame.top = 0; + p_ctx->str_a.rcFrame.right = 0; + p_ctx->str_a.rcFrame.bottom = 0; + + p_ctx->wave.wFormatTag = p_ctx->a_fmt; + p_ctx->wave.nChannels = p_ctx->a_chns; + p_ctx->wave.nSamplesPerSec = p_ctx->a_rate; + p_ctx->wave.nAvgBytesPerSec = bytespersec; + p_ctx->wave.nBlockAlign = blkalign; + p_ctx->wave.wBitsPerSample = bps; + p_ctx->wave.cbSize = p_ctx->a_extra_len; +} + +int avi_write_header(AVICTX * p_ctx) +{ + if (p_ctx->fp == NULL) + { + return -1; + } + + log_print(HT_LOG_DBG, "%s, enter...\r\n", __FUNCTION__); + + avi_build_video_hdr(p_ctx); + avi_build_audio_hdr(p_ctx); + + fseek(p_ctx->fp, 0, SEEK_SET); + + int tlen; + int avih_len = sizeof(AVIMHDR) + 8; + int strl_v_len = sizeof(AVISHDR) + 8 + sizeof(BMPHDR) + 8; + int strl_a_len = sizeof(AVISHDR) + 8 + sizeof(WAVEFMT) + 8; + int s_v_ll = strl_v_len + 12; + int s_a_ll = strl_a_len + 12; + int a_extra_len = 0; + int a_pad_len = 0; + int v_extra_len = 0; + int v_pad_len = 0; + + if (p_ctx->a_extra && p_ctx->a_extra_len) + { + a_extra_len = p_ctx->a_extra_len; + + if (a_extra_len & 0x01) + { + a_pad_len = 1; + } + } + + if (p_ctx->v_extra && p_ctx->v_extra_len) + { + v_extra_len = p_ctx->v_extra_len; + + if (v_extra_len & 0x01) + { + v_pad_len = 1; + } + } + + avi_write_fourcc(p_ctx, "RIFF"); + avi_write_uint32(p_ctx, p_ctx->i_riff > 0 ? p_ctx->i_riff - 8 : 0xFFFFFFFF); // Total file length - ('RIFF') - 4 + avi_write_fourcc(p_ctx, "AVI "); + + avi_write_fourcc(p_ctx, "LIST"); + + tlen = 4 + avih_len; + + if (p_ctx->ctxf_video == 1) + { + tlen += s_v_ll + v_extra_len + v_pad_len; + } + + if (p_ctx->ctxf_audio == 1) + { + tlen += s_a_ll + a_extra_len + a_pad_len; + } + + avi_write_uint32(p_ctx, tlen); + + avi_write_fourcc(p_ctx, "hdrl"); + + avi_write_fourcc(p_ctx, "avih"); + avi_write_uint32(p_ctx, sizeof(AVIMHDR)); + + if (p_ctx->v_fps == 0) + { + p_ctx->avi_hdr.dwMicroSecPerFrame = 1000000 / 25; // Video frame interval (in microseconds) + } + else + { + p_ctx->avi_hdr.dwMicroSecPerFrame = 1000000 / p_ctx->v_fps; // Video frame interval (in microseconds) + } + + p_ctx->avi_hdr.dwMaxBytesPerSec = 0xffffffff; // The maximum data rate of this AVI file + p_ctx->avi_hdr.dwPaddingGranularity = 0; // Granularity of data padding + p_ctx->avi_hdr.dwFlags = AVIF_HASINDEX|AVIF_ISINTERLEAVED|AVIF_TRUSTCKTYPE; + p_ctx->avi_hdr.dwTotalFrames = p_ctx->i_frame_video; // Total number of frames + p_ctx->avi_hdr.dwInitialFrames = 0; // Specify the initial number of frames for the interactive format + + if (p_ctx->ctxf_audio == 1) + { + p_ctx->avi_hdr.dwStreams = 2; // The number of streams included in this file + } + else + { + p_ctx->avi_hdr.dwStreams = 1; // The number of streams included in this file + } + + p_ctx->avi_hdr.dwSuggestedBufferSize= 1024*1024; // It is recommended to read the cache size of this file (should be able to accommodate the largest block) + p_ctx->avi_hdr.dwWidth = p_ctx->v_width; // The width of the video in pixels + p_ctx->avi_hdr.dwHeight = p_ctx->v_height; // The height of the video in pixels + + avi_write_buffer(p_ctx, (char*)&p_ctx->avi_hdr, sizeof(AVIMHDR)); + + if (p_ctx->ctxf_video == 1) + { + avi_write_fourcc(p_ctx, "LIST"); + avi_write_uint32(p_ctx, 4 + strl_v_len + v_extra_len + v_pad_len); + avi_write_fourcc(p_ctx, "strl"); // How many streams are there in the file, and how many 'strl' sublists there are + + avi_write_fourcc(p_ctx, "strh"); + avi_write_uint32(p_ctx, sizeof(AVISHDR)); + avi_write_buffer(p_ctx, (char*)&p_ctx->str_v, sizeof(AVISHDR)); + + avi_write_fourcc(p_ctx, "strf"); + avi_write_uint32(p_ctx, sizeof(BMPHDR) + v_extra_len); + avi_write_buffer(p_ctx, (char*)&p_ctx->bmp, sizeof(BMPHDR)); + + // Write video extra information + + if (p_ctx->v_extra && p_ctx->v_extra_len) + { + avi_write_buffer(p_ctx, (char*)p_ctx->v_extra, p_ctx->v_extra_len); + + if (v_pad_len) /* pad */ + { + fputc(0, p_ctx->fp); + } + } + } + + if (p_ctx->ctxf_audio == 1) + { + avi_write_fourcc(p_ctx, "LIST"); + avi_write_uint32(p_ctx, 4 + strl_a_len + a_extra_len + a_pad_len); + avi_write_fourcc(p_ctx, "strl"); + + avi_write_fourcc(p_ctx, "strh"); + avi_write_uint32(p_ctx, sizeof(AVISHDR)); + avi_write_buffer(p_ctx, (char*)&p_ctx->str_a, sizeof(AVISHDR)); + + avi_write_fourcc(p_ctx, "strf"); + avi_write_uint32(p_ctx, sizeof(WAVEFMT) + a_extra_len); + avi_write_buffer(p_ctx, (char*)&p_ctx->wave, sizeof(WAVEFMT)); + + // Write audio extra information + + if (p_ctx->a_extra && p_ctx->a_extra_len) + { + avi_write_buffer(p_ctx, (char*)p_ctx->a_extra, p_ctx->a_extra_len); + + if (a_pad_len) /* pad */ + { + fputc(0, p_ctx->fp); + } + } + } + + avi_write_fourcc(p_ctx, "LIST"); + avi_write_uint32(p_ctx, p_ctx->i_movi_end > 0 ? (p_ctx->i_movi_end - p_ctx->i_movi + 4) : 0xFFFFFFFF); + avi_write_fourcc(p_ctx, "movi"); + + p_ctx->i_movi = ftell(p_ctx->fp); + + if (p_ctx->i_movi < 0) + { + goto w_err; + } + + return 0; + +w_err: + + if (p_ctx->fp) + { + fclose(p_ctx->fp); + p_ctx->fp = NULL; + } + + return -1; +} + +int avi_update_header(AVICTX * p_ctx) +{ + log_print(HT_LOG_DBG, "%s, enter...\r\n", __FUNCTION__); + + if (NULL == p_ctx) + { + return -1; + } + + sys_os_mutex_enter(p_ctx->mutex); + + if (NULL == p_ctx->fp) + { + sys_os_mutex_leave(p_ctx->mutex); + return -1; + } + + if (avi_write_header(p_ctx) == 0) + { + if (p_ctx->fp) + { + fseek(p_ctx->fp, 0, SEEK_END); + + sys_os_mutex_leave(p_ctx->mutex); + return 0; + } + } + + sys_os_mutex_leave(p_ctx->mutex); + return -1; +} + +int avi_calc_fps(AVICTX * p_ctx) +{ + if (p_ctx->ctxf_calcfps && p_ctx->i_frame_video >= 100) + { + float fps = (float) (p_ctx->i_frame_video * 1000.0) / (p_ctx->v_e_time - p_ctx->v_s_time); + p_ctx->v_fps = (uint32)(fps - 0.5); + + log_print(HT_LOG_DBG, "%s, stime=%u, etime=%u, frames=%d, fps=%d\r\n", + __FUNCTION__, p_ctx->v_s_time, p_ctx->v_e_time, p_ctx->i_frame_video, p_ctx->v_fps); + } + + return 0; +} + +uint64 avi_get_file_length(AVICTX * p_ctx) +{ + if (p_ctx && p_ctx->fp) + { + return ftell(p_ctx->fp); + } + + return 0; +} + +uint32 avi_get_media_time(AVICTX * p_ctx) +{ + if (NULL == p_ctx) + { + return 0; + } + + uint32 vtime = 0, atime = 0; + + if (p_ctx->ctxf_video) + { + vtime = p_ctx->v_e_time - p_ctx->v_s_time; + } + + if (p_ctx->ctxf_audio) + { + atime = p_ctx->a_e_time - p_ctx->a_s_time; + } + + return vtime > atime ? vtime : atime; +} + + + diff --git a/MediaClient/MediaClient/media/avi_write.h b/MediaClient/MediaClient/media/avi_write.h new file mode 100644 index 0000000..40932a1 --- /dev/null +++ b/MediaClient/MediaClient/media/avi_write.h @@ -0,0 +1,61 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef AVI_WRITE_H +#define AVI_WRITE_H + +#include "sys_inc.h" +#include "avi.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +void avi_free_idx(AVICTX * p_ctx); +int avi_write_idx(AVICTX * p_ctx); +void avi_set_dw(void * p, uint32 dw); +int avi_end(AVICTX * p_ctx); +AVICTX* avi_write_open(const char * filename); +int avi_write_video(AVICTX * p_ctx, uint8 * p_data, uint32 len, uint32 ts, int b_key); +int avi_write_nalu(AVICTX * p_ctx, uint8 * vps, int vps_len, uint8 * sps, int sps_len, uint8 * pps, int pps_len); +int avi_write_audio(AVICTX * p_ctx, uint8 * p_data, uint32 len, uint32 ts); +void avi_write_close(AVICTX * p_ctx); +void avi_set_video_info(AVICTX * p_ctx, int fps, int width, int height, const char fcc[4]); +void avi_set_video_extra_info(AVICTX * p_ctx, uint8 * extra, int extra_len); +void avi_set_audio_info(AVICTX * p_ctx, int chns, int rate, uint16 fmt); +void avi_set_audio_extra_info(AVICTX * p_ctx, uint8 * extra, int extra_len); +void avi_build_video_hdr(AVICTX * p_ctx); +void avi_build_audio_hdr(AVICTX * p_ctx); +int avi_write_header(AVICTX * p_ctx); +int avi_update_header(AVICTX * p_ctx); +int avi_calc_fps(AVICTX * p_ctx); +uint64 avi_get_file_length(AVICTX * p_ctx); +uint32 avi_get_media_time(AVICTX * p_ctx); + + +#ifdef __cplusplus +} +#endif + + +#endif // AVI_WRITE_H + + + diff --git a/MediaClient/MediaClient/media/file_player.cpp b/MediaClient/MediaClient/media/file_player.cpp new file mode 100644 index 0000000..edbc39c --- /dev/null +++ b/MediaClient/MediaClient/media/file_player.cpp @@ -0,0 +1,917 @@ +/*************************************************************************************** + * + * 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 "file_player.h" +#include "utils.h" +#include "media_codec.h" + + +void * readThread(void * argv) +{ + CFilePlayer * pPlayer = (CFilePlayer *) argv; + + pPlayer->readThread(); + + return NULL; +} + +void * videoThread(void * argv) +{ + CFilePlayer * pPlayer = (CFilePlayer *) argv; + + pPlayer->videoThread(); + + return NULL; +} + +void * audioThread(void * argv) +{ + CFilePlayer * pPlayer = (CFilePlayer *) argv; + + pPlayer->audioThread(); + + return NULL; +} + + +CFilePlayer::CFilePlayer() +: CVideoPlayer() +, m_nAudioIndex(-1) +, m_nVideoIndex(-1) +, m_nDuration(0) +, m_nCurPos(0) +, m_bSeek(0) +, m_dSeekPos(0) +, m_nNalLength(0) +, m_pFormatContext(NULL) +, m_hReadThread(0) +, m_hVideoThread(0) +, m_hAudioThread(0) +, m_pVideoQueue(NULL) +, m_pAudioQueue(NULL) +{ + +} + +CFilePlayer::~CFilePlayer() +{ + close(); +} + +BOOL CFilePlayer::openFile(const char * filename) +{ + if (avformat_open_input(&m_pFormatContext, filename, NULL, NULL) != 0) + { + log_print(HT_LOG_ERR, "avformat_open_input failed, %s\r\n", filename); + return FALSE; + } + + avformat_find_stream_info(m_pFormatContext, NULL); + + if (m_pFormatContext->duration != AV_NOPTS_VALUE) + { + m_nDuration = m_pFormatContext->duration; + } + + // find audio & video stream index + for (uint32 i=0; i < m_pFormatContext->nb_streams; i++) + { + if (m_pFormatContext->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) + { + m_nVideoIndex = i; + + if (m_nDuration < m_pFormatContext->streams[i]->duration) + { + m_nDuration = m_pFormatContext->streams[i]->duration; + } + } + else if (m_pFormatContext->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) + { + m_nAudioIndex = i; + + if (m_nDuration < m_pFormatContext->streams[i]->duration) + { + m_nDuration = m_pFormatContext->streams[i]->duration; + } + } + } + + m_nDuration /= 1000; // to millisecond + + // has video stream + if (m_nVideoIndex != -1) + { + AVCodecParameters * codecpar = m_pFormatContext->streams[m_nVideoIndex]->codecpar; + + if (codecpar->codec_id == AV_CODEC_ID_H264) + { + if (codecpar->extradata && codecpar->extradata_size > 8) + { + if (codecpar->extradata[0] == 1) + { + // Store right nal length size that will be used to parse all other nals + m_nNalLength = (codecpar->extradata[4] & 0x03) + 1; + } + } + + const AVBitStreamFilter * bsfc = av_bsf_get_by_name("h264_mp4toannexb"); + if (bsfc) + { + int ret; + + AVBSFContext *bsf; + av_bsf_alloc(bsfc, &bsf); + + ret = avcodec_parameters_copy(bsf->par_in, codecpar); + if (ret < 0) + { + return FALSE; + } + + ret = av_bsf_init(bsf); + if (ret < 0) + { + return FALSE; + } + + ret = avcodec_parameters_copy(codecpar, bsf->par_out); + if (ret < 0) + { + return FALSE; + } + + av_bsf_free(&bsf); + } + } + else if (codecpar->codec_id == AV_CODEC_ID_HEVC) + { + if (codecpar->extradata && codecpar->extradata_size > 8) + { + if (codecpar->extradata[0] || codecpar->extradata[1] || codecpar->extradata[2] > 1) + { + m_nNalLength = 4; + } + } + + const AVBitStreamFilter * bsfc = av_bsf_get_by_name("hevc_mp4toannexb"); + if (bsfc) + { + int ret; + + AVBSFContext *bsf; + av_bsf_alloc(bsfc, &bsf); + + ret = avcodec_parameters_copy(bsf->par_in, codecpar); + if (ret < 0) + { + return FALSE; + } + + ret = av_bsf_init(bsf); + if (ret < 0) + { + return FALSE; + } + + ret = avcodec_parameters_copy(codecpar, bsf->par_out); + if (ret < 0) + { + return FALSE; + } + + av_bsf_free(&bsf); + } + } + } + + return TRUE; +} + +BOOL CFilePlayer::open(std::string fileName) +{ + BOOL ret = FALSE; + close(); + CVideoPlayer::open(fileName); + ret = openFile(fileName.c_str()); + if (ret) + { + if (m_nVideoIndex >= 0) + { + AVCodecParameters * codecpar = m_pFormatContext->streams[m_nVideoIndex]->codecpar; + + openVideo(codecpar->codec_id, codecpar->extradata, codecpar->extradata_size); + } + + if (m_nAudioIndex >= 0) + { + AVCodecParameters * codecpar = m_pFormatContext->streams[m_nAudioIndex]->codecpar; + + openAudio(codecpar->codec_id, codecpar->sample_rate, codecpar->channels, codecpar->bits_per_coded_sample); + } + } + return ret; +} + +void CFilePlayer::close() +{ + m_bPlaying = FALSE; + + HTPACKET packet; + memset(&packet, 0, sizeof(packet)); + + clearQueue(m_pAudioQueue); + clearQueue(m_pVideoQueue); + + hqBufPut(m_pAudioQueue, (char *)&packet); + hqBufPut(m_pVideoQueue, (char *)&packet); + + while (m_hAudioThread) + { + usleep(100*1000); + } + + while (m_hVideoThread) + { + usleep(100*1000); + } + + while (m_hReadThread) + { + usleep(100*1000); + } + + clearQueue(m_pAudioQueue); + clearQueue(m_pVideoQueue); + + hqDelete(m_pAudioQueue); + m_pAudioQueue = NULL; + + hqDelete(m_pVideoQueue); + m_pVideoQueue = NULL; + + if (m_pFormatContext) + { + avformat_close_input(&m_pFormatContext); + } + + CVideoPlayer::close(); +} + +BOOL CFilePlayer::play() +{ + m_bPaused = FALSE; + if (m_bPlaying) + { + return TRUE; + } + + m_bPlaying = TRUE; + + if (m_nVideoIndex >= 0) + { + m_pVideoQueue = hqCreate(30, sizeof(HTPACKET), HQ_PUT_WAIT | HQ_GET_WAIT); + + m_hVideoThread = sys_os_create_thread((void *)::videoThread, this); + + AVCodecParameters * codecpar = m_pFormatContext->streams[m_nVideoIndex]->codecpar; + + if (codecpar->codec_id == AV_CODEC_ID_H264 || codecpar->codec_id == AV_CODEC_ID_HEVC) + { + if (codecpar->extradata && codecpar->extradata_size > 8) + { + playVideo(codecpar->extradata, codecpar->extradata_size, 0, 0); + } + } + } + + if (m_nAudioIndex >= 0) + { + m_pAudioQueue = hqCreate(30, sizeof(HTPACKET), HQ_PUT_WAIT | HQ_GET_WAIT); + + m_hAudioThread = sys_os_create_thread((void *)::audioThread, this); + } + + m_hReadThread = sys_os_create_thread((void *)::readThread, this); + + // Start the video decoder thread — required for getImage() to return frames. + // Without this, the decoder stays stopped and g_frameQueue remains empty. + // (Matches CRtspPlayer::play() which calls StartVideoDecoder() after rtsp_start().) + CVideoPlayer::StartVideoDecoder(); + + return TRUE; +} + +void CFilePlayer::stop() +{ + close(); +} + +BOOL CFilePlayer::pause() +{ + + m_bPaused = TRUE; + return m_bPaused; +} + +BOOL CFilePlayer::seek(int pos) +{ + if (pos < 0 || pos > 100) + { + return FALSE; + } + + m_bSeek = 1; + m_dSeekPos = m_nDuration / 100 * pos; + + return TRUE; +} +void CFilePlayer::setBbox(cv::Rect bbox) { + CVideoPlayer::setBbox(bbox); +} +void CFilePlayer::setCrop(bool crop) { + CVideoPlayer::setCrop(crop); +} + +int CFilePlayer::getVideoCodec() +{ + int codec = VIDEO_CODEC_NONE; + + if (m_nVideoIndex >= 0 && m_pFormatContext) + { + AVCodecParameters * codecpar = m_pFormatContext->streams[m_nVideoIndex]->codecpar; + + codec = to_video_codec(codecpar->codec_id); + } + + return codec; +} + +int CFilePlayer::getAudioCodec() +{ + int codec = AUDIO_CODEC_NONE; + + if (m_nAudioIndex >= 0 && m_pFormatContext) + { + AVCodecParameters * codecpar = m_pFormatContext->streams[m_nAudioIndex]->codecpar; + + codec = to_audio_codec(codecpar->codec_id); + } + + return codec; +} + +void CFilePlayer::videoData(uint8 * data, int size, int64 pts, int waitnext) +{ + HTPACKET packet; + + packet.data = (uint8 *) malloc(size); + if (packet.data) + { + memcpy(packet.data, data, size); + packet.size = size; + packet.ts = pts; + packet.waitnext = waitnext; + + if (!hqBufPut(m_pVideoQueue, (char *)&packet)) + { + free(packet.data); + } + } +} + +void CFilePlayer::audioData(uint8 * data, int size, int64 pts) +{ + HTPACKET packet; + + packet.data = (uint8 *) malloc(size); + if (packet.data) + { + memcpy(packet.data, data, size); + packet.size = size; + packet.ts = pts; + packet.waitnext = 0; + + if (!hqBufPut(m_pAudioQueue, (char *)&packet)) + { + free(packet.data); + } + } +} + +BOOL CFilePlayer::readFrame() +{ + int rret = 0; + AVPacket pkt; + + if (NULL == m_pFormatContext) + { + return FALSE; + } + + av_init_packet(&pkt); + pkt.data = 0; + pkt.size = 0; + + rret = av_read_frame(m_pFormatContext, &pkt); + if (AVERROR_EOF == rret) + { + rret = av_seek_frame(m_pFormatContext, 0, m_pFormatContext->streams[0]->start_time, 0); + if (rret < 0) + { + rret = av_seek_frame(m_pFormatContext, 0, 0, AVSEEK_FLAG_BYTE | AVSEEK_FLAG_BACKWARD); + if (rret < 0) + { + return FALSE; + } + } + + if (av_read_frame(m_pFormatContext, &pkt) != 0) + { + return FALSE; + } + } + else if (0 != rret) + { + return FALSE; + } + + int64 pts = AV_NOPTS_VALUE; + + if (pkt.pts != AV_NOPTS_VALUE) + { + pts = pkt.pts; + + if (m_pFormatContext->start_time != AV_NOPTS_VALUE) + { + pts -= m_pFormatContext->start_time; + } + } + else if (pkt.dts != AV_NOPTS_VALUE) + { + pts = pkt.dts; + + if (m_pFormatContext->start_time != AV_NOPTS_VALUE) + { + pts -= m_pFormatContext->start_time; + } + } + + if (pkt.stream_index == m_nVideoIndex) + { + AVCodecParameters * codecpar = m_pFormatContext->streams[m_nVideoIndex]->codecpar; + + if (codecpar->codec_id == AV_CODEC_ID_H264 || codecpar->codec_id == AV_CODEC_ID_HEVC) + { + if (m_nNalLength) + { + uint8 * data = pkt.data; + int size = pkt.size; + + while (pkt.size >= m_nNalLength) + { + int len = 0; + int nal_length = m_nNalLength; + uint8 * pdata = pkt.data; + + while (nal_length--) + { + len = (len << 8) | *pdata++; + } + + if (len > pkt.size - m_nNalLength || len <= 0) + { + log_print(HT_LOG_DBG, "len=%d, pkt.size=%d\r\n", len, pkt.size); + break; + } + + nal_length = m_nNalLength; + pkt.data[nal_length-1] = 1; + nal_length--; + while (nal_length--) + { + pkt.data[nal_length] = 0; + } + + pkt.data += len + m_nNalLength; + pkt.size -= len + m_nNalLength; + } + + videoData(data, size, pts, 1); + } + else if (pkt.data[0] == 0 && pkt.data[1] == 0 && pkt.data[2] == 0 && pkt.data[3] == 1) + { + videoData(pkt.data, pkt.size, pts, 1); + } + else if (pkt.data[0] == 0 && pkt.data[1] == 0 && pkt.data[2] == 1) + { + videoData(pkt.data, pkt.size, pts, 1); + } + else + { + log_print(HT_LOG_ERR, "%s, unknown format\r\n", __FUNCTION__); + } + } + else + { + videoData(pkt.data, pkt.size, pts, 1); + } + } + else if (pkt.stream_index == m_nAudioIndex) + { + audioData(pkt.data, pkt.size, pts); + } + + av_packet_unref(&pkt); + + return TRUE; +} + +void CFilePlayer::readThread() +{ + while (m_bPlaying) + { + if (m_bPaused) + { + usleep(100*1000); + continue; + } + + if (m_bSeek) + { + if (seekStream(m_dSeekPos)) + { + clearQueue(m_pVideoQueue); + clearQueue(m_pAudioQueue); + } + + m_bSeek = 0; + } + + if (!readFrame()) + { + break; + } + } + + log_print(HT_LOG_INFO, "%s, exit!\r\n", __FUNCTION__); + + m_hReadThread = 0; +} + +void CFilePlayer::videoThread() +{ + HTPACKET packet; + int64 pts = 0; + int64 cur_delay = 0; + int64 pre_delay = 0; + uint32 cur_time = 0; + uint32 pre_time = 0; + int timeout = 1000000.0 / getFramerate(); + while (m_bPlaying) + { + if (m_bPaused) + { + pre_time = 0; + usleep(100*1000); + continue; + } + + if (hqBufGet(m_pVideoQueue, (char *)&packet)) + { + if (NULL == packet.data || 0 == packet.size) + { + break; + } + + if (packet.ts != AV_NOPTS_VALUE) + { + AVRational q = {1, AV_TIME_BASE}; + pts = av_rescale_q (packet.ts, m_pFormatContext->streams[m_nVideoIndex]->time_base, q); + pts /= 1000; + + m_nCurPos = pts; + } + + playVideo(packet.data, packet.size, pts, 0); + + free(packet.data); + + if (packet.waitnext) + { + cur_time = sys_os_get_ms(); + cur_delay = timeout; + + if (pre_time > 0) + { + cur_delay += pre_delay - (cur_time - pre_time) * 1000; + if (cur_delay < 1000) + { + cur_delay = 0; + } + } + + pre_time = cur_time; + pre_delay = cur_delay; + + if (cur_delay > 0) + { + usleep(cur_delay); + } + } + } + } + log_print(HT_LOG_INFO, "%s, exit!\r\n", __FUNCTION__); + m_hVideoThread = 0; +} + +void CFilePlayer::audioThread() +{ + HTPACKET packet; + int64 pts = 0; + + while (m_bPlaying) + { + if (m_bPaused) + { + usleep(100*1000); + continue; + } + + if (hqBufGet(m_pAudioQueue, (char *)&packet)) + { + if (NULL == packet.data || 0 == packet.size) + { + break; + } + + if (packet.ts != AV_NOPTS_VALUE) + { + AVRational q = {1, AV_TIME_BASE}; + pts = av_rescale_q (packet.ts, m_pFormatContext->streams[m_nAudioIndex]->time_base, q); + pts /= 1000; + + m_nCurPos = pts; + } + + playAudio(packet.data, packet.size, pts, 0); + + free(packet.data); + } + } + + log_print(HT_LOG_INFO, "%s, exit!\r\n", __FUNCTION__); + + m_hAudioThread = 0; +} + +void CFilePlayer::clearQueue(HQUEUE * queue) +{ + HTPACKET packet; + + while (!hqBufIsEmpty(queue)) + { + if (hqBufGet(queue, (char *)&packet)) + { + if (packet.data != NULL && packet.size != 0) + { + free(packet.data); + } + } + else + { + // should be not to here + log_print(HT_LOG_ERR, "%s, hqBufGet failed\r\n", __FUNCTION__); + break; + } + } +} + +BOOL CFilePlayer::seekStream(double pos) +{ + if (pos < 0) + { + return FALSE; + } + + if (pos == m_nCurPos) + { + return TRUE; + } + + int stream = -1; + int64 seekpos = pos * 1000; + + if (m_nAudioIndex >= 0) + { + stream = m_nAudioIndex; + } + else if (m_nVideoIndex >= 0) + { + stream = m_nVideoIndex; + } + + if (m_pFormatContext->start_time != AV_NOPTS_VALUE) + { + seekpos += m_pFormatContext->start_time; + } + + if (stream >= 0) + { + AVRational q = {1, AV_TIME_BASE}; + + seekpos = av_rescale_q(seekpos, q, m_pFormatContext->streams[stream]->time_base); + } + + if (av_seek_frame(m_pFormatContext, stream, seekpos, AVSEEK_FLAG_BACKWARD) < 0) + { + return FALSE; + } + + // Accurate seek to the specified position + AVPacket pkt; + + av_init_packet(&pkt); + pkt.data = 0; + pkt.size = 0; + + while (av_read_frame(m_pFormatContext, &pkt) == 0) + { + if (pkt.stream_index != stream) + { + av_packet_unref(&pkt); + continue; + } + + if (pkt.pts != AV_NOPTS_VALUE) + { + if (pkt.pts < seekpos) + { + av_packet_unref(&pkt); + continue; + } + else + { + break; + } + } + else if (pkt.dts != AV_NOPTS_VALUE) + { + if (pkt.dts < seekpos) + { + av_packet_unref(&pkt); + continue; + } + else + { + break; + } + } + else + { + break; + } + + av_packet_unref(&pkt); + } + + av_packet_unref(&pkt); + + m_nCurPos = pos; + + return TRUE; +} + +double CFilePlayer::getFramerate() +{ + double framerate = 25; + + if (m_nVideoIndex != -1) + { + if (m_pFormatContext->streams[m_nVideoIndex]->r_frame_rate.den > 0) + { + framerate = m_pFormatContext->streams[m_nVideoIndex]->r_frame_rate.num / + (double)m_pFormatContext->streams[m_nVideoIndex]->r_frame_rate.den; + } + + if ((framerate < 1 || framerate > 60) && + m_pFormatContext->streams[m_nVideoIndex]->avg_frame_rate.den > 0) + { + framerate = m_pFormatContext->streams[m_nVideoIndex]->avg_frame_rate.num / + (double)m_pFormatContext->streams[m_nVideoIndex]->avg_frame_rate.den; + } + + if (framerate < 1 || framerate > 60) + { + framerate = 25; + } + } + + return framerate; +} + +BOOL CFilePlayer::onRecord() +{ + AVICTX * p_avictx = m_pAviCtx; + + int vcodec = getVideoCodec(); + int v_extra_len = 0; + uint8 * v_extra = NULL; + + if (VIDEO_CODEC_H264 == vcodec) + { + AVCodecParameters * codecpar = m_pFormatContext->streams[m_nVideoIndex]->codecpar; + + v_extra = codecpar->extradata; + v_extra_len = codecpar->extradata_size; + + avi_set_video_info(p_avictx, 0, 0, 0, "H264"); + + avi_set_video_extra_info(p_avictx, codecpar->extradata, codecpar->extradata_size); + } + else if (VIDEO_CODEC_H265 == vcodec) + { + AVCodecParameters * codecpar = m_pFormatContext->streams[m_nVideoIndex]->codecpar; + + v_extra = codecpar->extradata; + v_extra_len = codecpar->extradata_size; + + avi_set_video_info(p_avictx, 0, 0, 0, "H265"); + + avi_set_video_extra_info(p_avictx, codecpar->extradata, codecpar->extradata_size); + } + else if (VIDEO_CODEC_JPEG == vcodec) + { + avi_set_video_info(p_avictx, 0, 0, 0, "JPEG"); + } + else if (VIDEO_CODEC_MP4 == vcodec) + { + avi_set_video_info(p_avictx, 0, 0, 0, "MP4V"); + } + + int acodec = getAudioCodec(); + int sr = 0; + int ch = 0; + + if (m_nAudioIndex >= 0 && m_pFormatContext) + { + AVCodecParameters * codecpar = m_pFormatContext->streams[m_nAudioIndex]->codecpar; + + sr = codecpar->sample_rate; + ch = codecpar->channels; + } + + if (AUDIO_CODEC_G711A == acodec) + { + avi_set_audio_info(p_avictx, ch, sr, AUDIO_FORMAT_ALAW); + } + else if (AUDIO_CODEC_G711U == acodec) + { + avi_set_audio_info(p_avictx, ch, sr, AUDIO_FORMAT_MULAW); + } + else if (AUDIO_CODEC_G726 == acodec) + { + avi_set_audio_info(p_avictx, ch, sr, AUDIO_FORMAT_G726); + } + else if (AUDIO_CODEC_G722 == acodec) + { + avi_set_audio_info(p_avictx, ch, sr, AUDIO_FORMAT_G722); + } + else if (AUDIO_CODEC_AAC == acodec) + { + AVCodecParameters * codecpar = m_pFormatContext->streams[m_nAudioIndex]->codecpar; + + avi_set_audio_info(p_avictx, ch, sr, AUDIO_FORMAT_AAC); + avi_set_audio_extra_info(p_avictx, codecpar->extradata, codecpar->extradata_size); + } + + avi_update_header(p_avictx); + + if (p_avictx->ctxf_video) + { + if (v_extra && v_extra_len > 0) + { + recordVideo(v_extra, v_extra_len, 0, 0); + } + } + + return TRUE; +} + + + diff --git a/MediaClient/MediaClient/media/file_player.h b/MediaClient/MediaClient/media/file_player.h new file mode 100644 index 0000000..fe5f29a --- /dev/null +++ b/MediaClient/MediaClient/media/file_player.h @@ -0,0 +1,95 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef FILE_PLAYER_H +#define FILE_PLAYER_H + +#include "video_player.h" + +#define FILE_EVE_STOPPED 80 // stopped +#define FILE_EVE_CONNECTING 81 // connecting +#define FILE_EVE_CONNFAIL 82 // connect failed +#define FILE_EVE_CONNSUCC 83 // connect success +#define FILE_EVE_NOSIGNAL 84 // no signal +#define FILE_EVE_RESUME 85 // resume +#define FILE_EVE_AUTHFAILED 86 // authentication failed +#define FILE_EVE_NODATA 87 // No data received within the timeout period + +typedef struct +{ + uint8 * data; + int size; + int64 ts; + int waitnext; +} HTPACKET; + +class CFilePlayer : public CVideoPlayer +{ +public: + CFilePlayer(); + virtual ~CFilePlayer(); + + BOOL open(std::string fileName); + void close(); + BOOL play(); + void stop(); + BOOL pause(); + BOOL seek(int pos); + int64 getElapse() {return m_nCurPos;}; + int64 getDuration() {return m_nDuration;} + int getVideoCodec(); + int getAudioCodec(); + BOOL onRecord(); + void setBbox(cv::Rect bbox); + void setCrop(bool crop);; + void readThread(); + void videoThread(); + void audioThread(); + +private: + BOOL openFile(const char * filename); + BOOL readFrame(); + void videoData(uint8 * data, int size, int64 pts, int waitnext); + void audioData(uint8 * data, int size, int64 pts); + void clearQueue(HQUEUE * queue); + BOOL seekStream(double pos); + double getFramerate(); + +private: + int m_nAudioIndex; // audio stream index + int m_nVideoIndex; // video stream index + int64 m_nDuration; // the stream duration, unit is millisecond + int64 m_nCurPos; // the current play position, unit is millisecond + int m_bSeek; // seek request + double m_dSeekPos; // seek position, nit is millisecond + int m_nNalLength; + + AVFormatContext * m_pFormatContext; // format context + + pthread_t m_hReadThread; // read thread + pthread_t m_hVideoThread; // video thread + pthread_t m_hAudioThread; // audio thread + + HQUEUE * m_pVideoQueue; // video queue + HQUEUE * m_pAudioQueue; // audio queue +}; + +#endif + + diff --git a/MediaClient/MediaClient/media/format.h b/MediaClient/MediaClient/media/format.h new file mode 100644 index 0000000..c1e5535 --- /dev/null +++ b/MediaClient/MediaClient/media/format.h @@ -0,0 +1,45 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef FORMAT_H +#define FORMAT_H + +#define PACKET_TYPE_UNKNOW -1 +#define PACKET_TYPE_VIDEO 0 +#define PACKET_TYPE_AUDIO 1 + +#define AUDIO_FORMAT_PCM (0x0001) +#define AUDIO_FORMAT_G726 (0x0064) +#define AUDIO_FORMAT_G722 (0x028F) +#define AUDIO_FORMAT_MP3 (0x0055) +#define AUDIO_FORMAT_AAC (0x00FF) +#define AUDIO_FORMAT_ALAW (0x0006) +#define AUDIO_FORMAT_MULAW (0x0007) +#define AUDIO_FORMAT_OPUS (0x00AD) + +#ifndef MAKEFOURCC +#define MAKEFOURCC(ch0, ch1, ch2, ch3) \ + ((uint32)(uint8)(ch0) | ((uint32)(uint8)(ch1) << 8) | \ + ((uint32)(uint8)(ch2) << 16) | ((uint32)(uint8)(ch3) << 24 )) +#define mmioFOURCC(ch0, ch1, ch2, ch3) MAKEFOURCC(ch0, ch1, ch2, ch3) +#endif + +#endif + + diff --git a/MediaClient/MediaClient/media/gles_engine.cpp b/MediaClient/MediaClient/media/gles_engine.cpp new file mode 100644 index 0000000..220084c --- /dev/null +++ b/MediaClient/MediaClient/media/gles_engine.cpp @@ -0,0 +1,94 @@ +/*************************************************************************************** + * + * 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 "gles_engine.h" + +#include + +#define CheckError(message) if (result != SL_RESULT_SUCCESS) { log_print(HT_LOG_ERR, "%s\r\n", message); return; } + + +static GlesEngine * g_glesEngine; + +GlesEngine::GlesEngine() +: m_engineObject(0) +, m_engine(0) +{ + SLresult result; + + result = slCreateEngine(&m_engineObject, 0, 0, 0, 0, 0); + CheckError("Failed to create engine"); + + result = (*m_engineObject)->Realize(m_engineObject, SL_BOOLEAN_FALSE); + CheckError("Failed to realize engine"); + + result = (*m_engineObject)->GetInterface(m_engineObject, SL_IID_ENGINE, &m_engine); + CheckError("Failed to get engine interface"); +} + +GlesEngine::~GlesEngine() +{ + if (m_engineObject) + { + (*m_engineObject)->Destroy(m_engineObject); + } +} + +GlesEngine *GlesEngine::instance() +{ + if (NULL == g_glesEngine) + { + g_glesEngine = new GlesEngine(); + } + + return g_glesEngine; +} + +bool GlesEngine::inputFormatIsSupported(SLDataFormat_PCM format) +{ + SLresult result; + SLObjectItf recorder = 0; + SLDataLocator_IODevice loc_dev = { SL_DATALOCATOR_IODEVICE, SL_IODEVICE_AUDIOINPUT, + SL_DEFAULTDEVICEID_AUDIOINPUT, NULL }; + SLDataSource audioSrc = { &loc_dev, NULL }; + +#ifdef ANDROID + SLDataLocator_AndroidSimpleBufferQueue loc_bq = { SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE, 1 }; +#else + SLDataLocator_BufferQueue loc_bq = { SL_DATALOCATOR_BUFFERQUEUE, 1 }; +#endif + SLDataSink audioSnk = { &loc_bq, &format }; + + result = (*m_engine)->CreateAudioRecorder(m_engine, &recorder, &audioSrc, &audioSnk, 0, 0, 0); + if (result == SL_RESULT_SUCCESS) + { + result = (*recorder)->Realize(recorder, false); + } + + if (result == SL_RESULT_SUCCESS) + { + (*recorder)->Destroy(recorder); + return true; + } + + return false; +} + + diff --git a/MediaClient/MediaClient/media/gles_engine.h b/MediaClient/MediaClient/media/gles_engine.h new file mode 100644 index 0000000..9cd0147 --- /dev/null +++ b/MediaClient/MediaClient/media/gles_engine.h @@ -0,0 +1,43 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef _GLES_ENGINE_H_ +#define _GLES_ENGINE_H_ + +#include + +class GlesEngine +{ +public: + GlesEngine(); + ~GlesEngine(); + + static GlesEngine *instance(); + + SLEngineItf slEngine() const { return m_engine; } + + bool inputFormatIsSupported(SLDataFormat_PCM format); + + SLObjectItf m_engineObject; + SLEngineItf m_engine; +}; + +#endif + + diff --git a/MediaClient/MediaClient/media/gles_input.cpp b/MediaClient/MediaClient/media/gles_input.cpp new file mode 100644 index 0000000..12e5867 --- /dev/null +++ b/MediaClient/MediaClient/media/gles_input.cpp @@ -0,0 +1,325 @@ +/*************************************************************************************** + * + * 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 "gles_input.h" +#include "gles_engine.h" + +#ifdef ANDROID +#include +#endif + + +#ifdef ANDROID +static void bufferQueueCallback(SLAndroidSimpleBufferQueueItf, void *context) +#else +static void bufferQueueCallback(SLBufferQueueItf, void *context) +#endif +{ + GlesInput *audioInput = reinterpret_cast(context); + + audioInput->processBuffer(); +} + +GlesInput::GlesInput() +: m_recorderObject(0) +, m_recorder(0) +, m_bufferQueue(0) +, m_bufferSize(1600) +, m_currentBuffer(0) +, m_pCallback(NULL) +, m_pUserdata(NULL) +{ +#ifdef ANDROID + m_recorderPreset = SL_ANDROID_RECORDING_PRESET_GENERIC; +#endif + + for (int i = 0; i < NUM_BUFFERS; i++) + { + m_buffers[i] = NULL; + } +} + +GlesInput::~GlesInput() +{ + stop(); +} + +bool GlesInput::start(int samplerete) +{ + bool ret = false; + + if (startRecording(samplerete)) + { + ret = true; + } + else + { + log_print(HT_LOG_ERR, "start audio recoding faild\r\n"); + + stopRecording(); + } + + return ret; +} + +void GlesInput::stop() +{ + stopRecording(); +} + +bool GlesInput::startRecording(int samplerete) +{ + SLEngineItf engine = GlesEngine::instance()->slEngine(); + if (!engine) + { + log_print(HT_LOG_ERR, "No engine\r\n"); + return false; + } + + SLresult result; + + // configure audio source + SLDataLocator_IODevice loc_dev = { SL_DATALOCATOR_IODEVICE, SL_IODEVICE_AUDIOINPUT, + SL_DEFAULTDEVICEID_AUDIOINPUT, NULL }; + SLDataSource audioSrc = { &loc_dev, NULL }; + + // configure audio sink +#ifdef ANDROID + SLDataLocator_AndroidSimpleBufferQueue loc_bq = { SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE, + NUM_BUFFERS }; +#else + SLDataLocator_BufferQueue loc_bq = { SL_DATALOCATOR_BUFFERQUEUE, NUM_BUFFERS }; +#endif + + SLDataFormat_PCM format_pcm; + + format_pcm.formatType = SL_DATAFORMAT_PCM; + format_pcm.numChannels = 2; + format_pcm.samplesPerSec = samplerete * 1000; + format_pcm.bitsPerSample = SL_PCMSAMPLEFORMAT_FIXED_16; + format_pcm.containerSize = SL_PCMSAMPLEFORMAT_FIXED_16; + format_pcm.channelMask = (SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT); + format_pcm.endianness = SL_BYTEORDER_LITTLEENDIAN; + + SLDataSink audioSnk = { &loc_bq, &format_pcm }; + + // create audio recorder + // (requires the RECORD_AUDIO permission) +#ifdef ANDROID + const SLInterfaceID id[2] = { SL_IID_ANDROIDSIMPLEBUFFERQUEUE, SL_IID_ANDROIDCONFIGURATION }; + const SLboolean req[2] = { SL_BOOLEAN_TRUE, SL_BOOLEAN_TRUE }; +#else + const SLInterfaceID id[1] = { SL_IID_BUFFERQUEUE }; + const SLboolean req[1] = { SL_BOOLEAN_TRUE }; +#endif + + result = (*engine)->CreateAudioRecorder(engine, &m_recorderObject, + &audioSrc, &audioSnk, + sizeof(req) / sizeof(SLboolean), id, req); + if (result != SL_RESULT_SUCCESS) + { + log_print(HT_LOG_ERR, "create audio recorder failed\r\n"); + return false; + } + +#ifdef ANDROID + // configure recorder source + SLAndroidConfigurationItf configItf; + result = (*m_recorderObject)->GetInterface(m_recorderObject, SL_IID_ANDROIDCONFIGURATION, + &configItf); + if (result != SL_RESULT_SUCCESS) + { + log_print(HT_LOG_ERR, "get audio configuration interface failed\r\n"); + return false; + } + + result = (*configItf)->SetConfiguration(configItf, SL_ANDROID_KEY_RECORDING_PRESET, + &m_recorderPreset, sizeof(SLuint32)); + + SLuint32 presetValue = SL_ANDROID_RECORDING_PRESET_NONE; + SLuint32 presetSize = 2*sizeof(SLuint32); // intentionally too big + result = (*configItf)->GetConfiguration(configItf, SL_ANDROID_KEY_RECORDING_PRESET, + &presetSize, (void*)&presetValue); + + if (result != SL_RESULT_SUCCESS || presetValue == SL_ANDROID_RECORDING_PRESET_NONE) + { + log_print(HT_LOG_ERR, "set audio record configuration failed\r\n"); + return false; + } +#endif + + // realize the audio recorder + result = (*m_recorderObject)->Realize(m_recorderObject, SL_BOOLEAN_FALSE); + if (result != SL_RESULT_SUCCESS) + { + log_print(HT_LOG_ERR, "realize audio record object failed\r\n"); + return false; + } + + // get the record interface + result = (*m_recorderObject)->GetInterface(m_recorderObject, SL_IID_RECORD, &m_recorder); + if (result != SL_RESULT_SUCCESS) + { + log_print(HT_LOG_ERR, "get audio record object failed\r\n"); + return false; + } + + // get the buffer queue interface +#ifdef ANDROID + SLInterfaceID bufferqueueItfID = SL_IID_ANDROIDSIMPLEBUFFERQUEUE; +#else + SLInterfaceID bufferqueueItfID = SL_IID_BUFFERQUEUE; +#endif + result = (*m_recorderObject)->GetInterface(m_recorderObject, bufferqueueItfID, &m_bufferQueue); + if (result != SL_RESULT_SUCCESS) + { + log_print(HT_LOG_ERR, "get audio record buff queue failed\r\n"); + return false; + } + + // register callback on the buffer queue + result = (*m_bufferQueue)->RegisterCallback(m_bufferQueue, ::bufferQueueCallback, this); + if (result != SL_RESULT_SUCCESS) + { + log_print(HT_LOG_ERR, "set buffer queue callback failed\r\n"); + return false; + } + + if (m_bufferSize <= 0) + { + m_bufferSize = (16*2/8)*50*samplerete/1000; + } + else + { + int minimumBufSize = (16*2/8)*5*samplerete/1000; + if (m_bufferSize < minimumBufSize) + m_bufferSize = minimumBufSize; + } + + // enqueue empty buffers to be filled by the recorder + for (int i = 0; i < NUM_BUFFERS; ++i) + { + m_buffers[i] = (uint8 *)malloc(m_bufferSize); + if (NULL == m_buffers[i]) + { + return false; + } + + memset(m_buffers[i], 0, m_bufferSize); + + result = (*m_bufferQueue)->Enqueue(m_bufferQueue, m_buffers[i], m_bufferSize); + if (result != SL_RESULT_SUCCESS) + { + log_print(HT_LOG_ERR, "audio record enqueue failed\r\n"); + return false; + } + } + + // start recording + result = (*m_recorder)->SetRecordState(m_recorder, SL_RECORDSTATE_RECORDING); + if (result != SL_RESULT_SUCCESS) + { + log_print(HT_LOG_ERR, "set audio record state failed\r\n"); + return false; + } + + return true; +} + +void GlesInput::stopRecording() +{ + if (m_recorder) + { + (*m_recorder)->SetRecordState(m_recorder, SL_RECORDSTATE_STOPPED); + } + + if (m_bufferQueue) + { + (*m_bufferQueue)->Clear(m_bufferQueue); + } + + if (m_recorderObject) + { + (*m_recorderObject)->Destroy(m_recorderObject); + } + + m_recorder = NULL; + m_bufferQueue = NULL; + m_recorderObject = NULL; + + for (int i = 0; i < NUM_BUFFERS; ++i) + { + if (m_buffers[i]) + { + free(m_buffers[i]); + m_buffers[i] = NULL; + } + } + + m_currentBuffer = 0; +} + +void GlesInput::setBufferSize(int value) +{ + m_bufferSize = value; +} + +int GlesInput::bufferSize() const +{ + return m_bufferSize; +} + +void GlesInput::processBuffer() +{ + uint8 *processedBuffer = m_buffers[m_currentBuffer]; + + if (m_pCallback) + { + m_pCallback(processedBuffer, m_bufferSize, m_pUserdata); + } + + // Re-enqueue the buffer + SLresult result = (*m_bufferQueue)->Enqueue(m_bufferQueue, + processedBuffer, + m_bufferSize); + + m_currentBuffer = (m_currentBuffer + 1) % NUM_BUFFERS; + + // If the buffer queue is empty (shouldn't happen), stop recording. +#ifdef ANDROID + SLAndroidSimpleBufferQueueState state; +#else + SLBufferQueueState state; +#endif + result = (*m_bufferQueue)->GetState(m_bufferQueue, &state); + if (result != SL_RESULT_SUCCESS || state.count == 0) + { + log_print(HT_LOG_ERR, "processBuffer::state.count == 0\r\n"); + } +} + +void GlesInput::setCallback(GlesInputCB cb, void * puser) +{ + m_pCallback = cb; + m_pUserdata = puser; +} + + + diff --git a/MediaClient/MediaClient/media/gles_input.h b/MediaClient/MediaClient/media/gles_input.h new file mode 100644 index 0000000..5c370da --- /dev/null +++ b/MediaClient/MediaClient/media/gles_input.h @@ -0,0 +1,72 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef _GLES_INPUT_H_ +#define _GLES_INPUT_H_ + +#include "sys_inc.h" +#include +#ifdef ANDROID +#include +#endif + +#define NUM_BUFFERS 2 + +typedef void (*GlesInputCB)(uint8 * pdata, int len, void * puser); + + +class GlesInput +{ +public: + GlesInput(); + ~GlesInput(); + + bool start(int samplerete); + void stop(); + void setCallback(GlesInputCB cb, void * puser); + + void setBufferSize(int value); + int bufferSize() const; + void processBuffer(); + +private: + bool startRecording(int samplerete); + void stopRecording(); + + +private: + SLObjectItf m_recorderObject; + SLRecordItf m_recorder; +#ifdef ANDROID + SLuint32 m_recorderPreset; + SLAndroidSimpleBufferQueueItf m_bufferQueue; +#else + SLBufferQueueItf m_bufferQueue; +#endif + + int m_bufferSize; + uint8 * m_buffers[NUM_BUFFERS]; + int m_currentBuffer; + + GlesInputCB m_pCallback; + void * m_pUserdata; +}; + +#endif + diff --git a/MediaClient/MediaClient/media/http_flv_player.cpp b/MediaClient/MediaClient/media/http_flv_player.cpp new file mode 100644 index 0000000..dc99051 --- /dev/null +++ b/MediaClient/MediaClient/media/http_flv_player.cpp @@ -0,0 +1,396 @@ +/*************************************************************************************** + * + * 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 "http_flv_player.h" +#include "utils.h" + +/***************************************************************************************/ + +int http_flv_notify_callback(int evt, void * puser) +{ + CHttpFlvPlayer * pPlayer = (CHttpFlvPlayer *) puser; + + pPlayer->onNotify(evt); + return 0; +} + +int http_flv_audio_callback(uint8 * pdata, int len, uint32 ts, void *puser) +{ + CHttpFlvPlayer * pPlayer = (CHttpFlvPlayer *) puser; + + pPlayer->onAudio(pdata, len, ts); + return 0; +} + +int http_flv_video_callback(uint8 * pdata, int len, uint32 ts, void *puser) +{ + CHttpFlvPlayer * pPlayer = (CHttpFlvPlayer *) puser; + + pPlayer->onVideo(pdata, len, ts); + return 0; +} + +/***************************************************************************************/ + +CHttpFlvPlayer::CHttpFlvPlayer(): CVideoPlayer() +{ + memset(m_ip, 0, sizeof(m_ip)); +} + +CHttpFlvPlayer::~CHttpFlvPlayer() +{ + close(); +} +std::string CHttpFlvPlayer::createNewFLVUrl(const std::string& username, + const std::string& password, + const std::string& url) { + // Copy the original strings to avoid modifying the originals + std::string modUsername = username; + std::string modPassword = password; + + // Replace '@' with '_' in username and password + std::replace(modUsername.begin(), modUsername.end(), '@', '_'); + std::replace(modPassword.begin(), modPassword.end(), '@', '_'); + + // Extract the protocol and rest of the URL + size_t protocolEndPos = url.find("://") + 3; // Find the position right after "://" + std::string protocol = url.substr(0, protocolEndPos); // Include "://" + + // Construct the new URL with modified credentials + std::string newUrl = protocol; + newUrl += modUsername + ":" + modPassword + "@"; + newUrl += url.substr(protocolEndPos); + return newUrl; +} +BOOL CHttpFlvPlayer::open(std::string fileName) +{ + close(); + + CVideoPlayer::open(fileName); + + char host[100]; + + url_split(fileName.c_str(), NULL, 0, NULL, 0, NULL, 0, host, sizeof(host), NULL, NULL, 0); + + if (host[0] == '\0') + { + return FALSE; + } + + strncpy(m_ip, host, sizeof(m_ip) - 1); + + m_httpflv.set_notify_cb(http_flv_notify_callback, this); + m_httpflv.set_audio_cb(http_flv_audio_callback); + m_httpflv.set_video_cb(http_flv_video_callback); + + return TRUE; +} + +BOOL CHttpFlvPlayer::open(std::string _username, std::string _password, std::string _url) +{ + close(); + CVideoPlayer::open(_username, _password, _url); + char host[100]; + std::string fileName = createNewFLVUrl(_username, _password, _url); + url_split(fileName.c_str(), NULL, 0, NULL, 0, NULL, 0, host, sizeof(host), NULL, NULL, 0); + + if (host[0] == '\0') + { + return FALSE; + } + + strncpy(m_ip, host, sizeof(m_ip) - 1); + m_httpflv.set_notify_cb(http_flv_notify_callback, this); + m_httpflv.set_audio_cb(http_flv_audio_callback); + m_httpflv.set_video_cb(http_flv_video_callback); + + return TRUE; +} + +void CHttpFlvPlayer::setBbox(cv::Rect bbox) { + CVideoPlayer::setBbox(bbox); +} +void CHttpFlvPlayer::setCrop(bool crop) { + CVideoPlayer::setCrop(crop); +} +void CHttpFlvPlayer::close() +{ + // stop http-flv connection + m_httpflv.http_flv_stop(); + m_httpflv.http_flv_close(); + + m_bPlaying = FALSE; + m_bPaused = FALSE; + CVideoPlayer::StopVideoDecoder(); + + CVideoPlayer::close(); +} + +BOOL CHttpFlvPlayer::play() +{ + if (m_httpflv.http_flv_start(m_sFileName.c_str(), m_acct.c_str(), m_pass.c_str())) + { + m_bPlaying = TRUE; + m_bPaused = FALSE; + } + CVideoPlayer::StartVideoDecoder();// Start the video decoder + + return m_bPlaying; +} + +void CHttpFlvPlayer::stop() +{ + if (m_bPlaying || m_bPaused) + { + m_httpflv.http_flv_stop(); + } + // Set flags BEFORE stopping decoder so rx thread stops calling decode() + m_bPlaying = FALSE; + m_bPaused = FALSE; + CVideoPlayer::StopVideoDecoder(); // Stop the video decoder + +} + +BOOL CHttpFlvPlayer::pause() +{ + if (m_bPlaying) + { + if (m_httpflv.http_flv_pause()) + { + m_bPaused = TRUE; + m_bPlaying = FALSE; + } + } + else if (m_bPaused) + { + if (m_httpflv.http_flv_play()) + { + m_bPaused = FALSE; + m_bPlaying = TRUE; + } + } + CVideoPlayer::StopVideoDecoder(); // Stop the video decoder + + return m_bPaused; +} + +BOOL CHttpFlvPlayer::seek(int pos) +{ + return FALSE; +} + +int64 CHttpFlvPlayer::getElapse() +{ + uint32 cur_ts; + uint32 init_ts; + int frequency; + + if (m_videoClock.SyncTime.tv_sec > m_audioClock.SyncTime.tv_sec) + { + cur_ts = m_videoClock.SyncTimestamp; + init_ts = m_httpflv.get_video_init_ts(); + frequency = getVideoClock(); + } + else if (m_videoClock.SyncTime.tv_sec == m_audioClock.SyncTime.tv_sec && + m_videoClock.SyncTime.tv_usec > m_audioClock.SyncTime.tv_usec) + { + cur_ts = m_videoClock.SyncTimestamp; + init_ts = m_httpflv.get_video_init_ts(); + frequency = getVideoClock(); + } + else + { + cur_ts = m_audioClock.SyncTimestamp; + init_ts = m_httpflv.get_audio_init_ts(); + frequency = getAudioClock(); + } + + if (init_ts == 0) + { + return 0; + } + + int64 elapse; + int timestampDiff = cur_ts - init_ts; + + // Divide this by the timestamp frequency to get real time: + double timeDiff = timestampDiff / (double)frequency; + + if (timeDiff >= 0.0) + { + elapse = timeDiff * 1000; + } + else + { + timeDiff = -timeDiff; + elapse = timeDiff * 1000; + } + + return elapse; +} + +int64 CHttpFlvPlayer::getDuration() +{ + return 0; +} + +int CHttpFlvPlayer::getVideoCodec() +{ + return m_httpflv.video_codec(); +} + +int CHttpFlvPlayer::getAudioCodec() +{ + return m_httpflv.audio_codec(); +} + +void CHttpFlvPlayer::onNotify(int evt) +{ + if (evt == HTTP_FLV_EVE_VIDEOREADY) + { + int videoCodec = m_httpflv.video_codec(); + + if (VIDEO_CODEC_NONE != videoCodec) + { + openVideo(videoCodec); + } + } + else if (evt == HTTP_FLV_EVE_AUDIOREADY) + { + int audioCodec = m_httpflv.audio_codec(); + + if (AUDIO_CODEC_NONE != audioCodec) + { + openAudio(audioCodec, m_httpflv.get_audio_samplerate(), m_httpflv.get_audio_channels()); + } + } +} + +void CHttpFlvPlayer::onAudio(uint8 * pdata, int len, uint32 ts) +{ + playAudio(pdata, len, ts, 0); +} + +void CHttpFlvPlayer::onVideo(uint8 * pdata, int len, uint32 ts) +{ + playVideo(pdata, len, ts, 0); +} + +BOOL CHttpFlvPlayer::onRecord() +{ + CHttpFlvClient * p_httpflv = &m_httpflv; + AVICTX * p_avictx = m_pAviCtx; + + int vcodec = p_httpflv->video_codec(); + int fps = p_httpflv->get_video_framerate(); + int v_extra_len = 0; + uint8 v_extra[1024]; + + if (VIDEO_CODEC_H264 == vcodec) + { + avi_set_video_info(p_avictx, fps, 0, 0, "H264"); + + uint8 sps[512], pps[512]; + int sps_len = 0, pps_len = 0; + + if (p_httpflv->get_h264_params(sps, &sps_len, pps, &pps_len)) + { + memcpy(v_extra, sps, sps_len); + memcpy(v_extra + sps_len, pps, pps_len); + + v_extra_len = sps_len + pps_len; + } + + if (v_extra_len > 0) + { + avi_set_video_extra_info(p_avictx, v_extra, v_extra_len); + } + } + else if (VIDEO_CODEC_H265 == vcodec) + { + avi_set_video_info(p_avictx, fps, 0, 0, "H265"); + + uint8 vps[512], sps[512], pps[512]; + int vps_len = 0, sps_len = 0, pps_len = 0; + + if (p_httpflv->get_h265_params(sps, &sps_len, pps, &pps_len, vps, &vps_len)) + { + memcpy(v_extra, vps, vps_len); + memcpy(v_extra + vps_len, sps, sps_len); + memcpy(v_extra + vps_len + sps_len, pps, pps_len); + + v_extra_len = vps_len + sps_len + pps_len; + } + + if (v_extra_len > 0) + { + avi_set_video_extra_info(p_avictx, v_extra, v_extra_len); + } + } + else if (VIDEO_CODEC_JPEG == vcodec) + { + avi_set_video_info(p_avictx, fps, 0, 0, "JPEG"); + } + else if (VIDEO_CODEC_MP4 == vcodec) + { + avi_set_video_info(p_avictx, fps, 0, 0, "MP4V"); + } + + int acodec = p_httpflv->audio_codec(); + int sr = p_httpflv->get_audio_samplerate(); + int ch = p_httpflv->get_audio_channels(); + + if (AUDIO_CODEC_G711A == acodec) + { + avi_set_audio_info(p_avictx, ch, sr, AUDIO_FORMAT_ALAW); + } + else if (AUDIO_CODEC_G711U == acodec) + { + avi_set_audio_info(p_avictx, ch, sr, AUDIO_FORMAT_MULAW); + } + else if (AUDIO_CODEC_G726 == acodec) + { + avi_set_audio_info(p_avictx, ch, sr, AUDIO_FORMAT_G726); + } + else if (AUDIO_CODEC_G722 == acodec) + { + avi_set_audio_info(p_avictx, ch, sr, AUDIO_FORMAT_G722); + } + else if (AUDIO_CODEC_AAC == acodec) + { + avi_set_audio_info(p_avictx, ch, sr, AUDIO_FORMAT_AAC); + avi_set_audio_extra_info(p_avictx, p_httpflv->get_audio_config(), p_httpflv->get_audio_config_len()); + } + + avi_update_header(p_avictx); + + if (p_avictx->ctxf_video) + { + if (v_extra_len > 0) + { + recordVideo(v_extra, v_extra_len, 0, 0); + } + } + + return TRUE; +} + + + + diff --git a/MediaClient/MediaClient/media/http_flv_player.h b/MediaClient/MediaClient/media/http_flv_player.h new file mode 100644 index 0000000..22d555b --- /dev/null +++ b/MediaClient/MediaClient/media/http_flv_player.h @@ -0,0 +1,63 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef HTTP_FLV_PLAYER_H +#define HTTP_FLV_PLAYER_H + +#include "video_player.h" +#include "http_flv_cln.h" + + +class CHttpFlvPlayer : public CVideoPlayer +{ + +public: + CHttpFlvPlayer(); + virtual ~CHttpFlvPlayer(); + + BOOL open(std::string fileName); + BOOL open(std::string _username, std::string _password, std::string _url); + void close(); + BOOL play(); + void stop(); + BOOL pause(); + BOOL seek(int pos); + int64 getElapse(); + int64 getDuration(); + int getVideoCodec(); + int getAudioCodec(); + void setBbox(cv::Rect bbox); + void setCrop(bool crop); + void onNotify(int evt); + void onAudio(uint8 * pdata, int len, uint32 ts); + void onVideo(uint8 * pdata, int len, uint32 ts); + BOOL onRecord(); + +private: + char m_ip[32]; + CHttpFlvClient m_httpflv; + std::string createNewFLVUrl(const std::string& username, + const std::string& password, + const std::string& url); +}; + +#endif + + + diff --git a/MediaClient/MediaClient/media/http_mjpeg_player.cpp b/MediaClient/MediaClient/media/http_mjpeg_player.cpp new file mode 100644 index 0000000..02752ba --- /dev/null +++ b/MediaClient/MediaClient/media/http_mjpeg_player.cpp @@ -0,0 +1,204 @@ +/*************************************************************************************** + * + * 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 "http_mjpeg_player.h" +#include "utils.h" + +/***************************************************************************************/ + +int http_mjpeg_notify_callback(int evt, void * puser) +{ + CHttpMjpegPlayer * pPlayer = (CHttpMjpegPlayer *) puser; + + pPlayer->onNotify(evt); + return 0; +} + +int http_mjpeg_video_callback(uint8 * pdata, int len, void *puser) +{ + CHttpMjpegPlayer * pPlayer = (CHttpMjpegPlayer *) puser; + + pPlayer->onVideo(pdata, len, 0); + return 0; +} + + +/***************************************************************************************/ + +CHttpMjpegPlayer::CHttpMjpegPlayer(): CVideoPlayer() +{ + memset(m_ip, 0, sizeof(m_ip)); +} + +CHttpMjpegPlayer::~CHttpMjpegPlayer() +{ + close(); +} + +std::string CHttpMjpegPlayer::createNewMJPEGUrl(const std::string& username, + const std::string& password, + const std::string& url) { + // Copy the original strings to avoid modifying the originals + std::string modUsername = username; + std::string modPassword = password; + + // Replace '@' with '_' in username and password + std::replace(modUsername.begin(), modUsername.end(), '@', '_'); + std::replace(modPassword.begin(), modPassword.end(), '@', '_'); + + // Extract the protocol and rest of the URL + size_t protocolEndPos = url.find("://") + 3; // Find the position right after "://" + std::string protocol = url.substr(0, protocolEndPos); // Include "://" + + // Construct the new URL with modified credentials + std::string newUrl = protocol; + newUrl += modUsername + ":" + modPassword + "@"; + newUrl += url.substr(protocolEndPos); + return newUrl; +} +BOOL CHttpMjpegPlayer::open(std::string fileName) +{ + close(); + + CVideoPlayer::open(fileName); + + char host[100]; + + url_split(fileName.c_str(), NULL, 0, NULL, 0, NULL, 0, host, sizeof(host), NULL, NULL, 0); + + if (host[0] == '\0') + { + return FALSE; + } + + strncpy(m_ip, host, sizeof(m_ip) - 1); + + m_httpmjpeg.set_notify_cb(http_mjpeg_notify_callback, this); + m_httpmjpeg.set_video_cb(http_mjpeg_video_callback); + + return TRUE; +} + +BOOL CHttpMjpegPlayer::open(std::string _username, std::string _password, std::string _url) +{ + close(); + + CVideoPlayer::open(_username, _password, _url); + + char host[100]; + std::string fileName = createNewMJPEGUrl(_username, _password, _url); + + url_split(fileName.c_str(), NULL, 0, NULL, 0, NULL, 0, host, sizeof(host), NULL, NULL, 0); + + if (host[0] == '\0') + { + return FALSE; + } + + strncpy(m_ip, host, sizeof(m_ip) - 1); + + m_httpmjpeg.set_notify_cb(http_mjpeg_notify_callback, this); + m_httpmjpeg.set_video_cb(http_mjpeg_video_callback); + + return TRUE; +} +void CHttpMjpegPlayer::close() +{ + // stop http-mjpeg connection + m_httpmjpeg.mjpeg_stop(); + m_httpmjpeg.mjpeg_close(); + + m_bPlaying = FALSE; + m_bPaused = FALSE; + CVideoPlayer::StopVideoDecoder(); + + CVideoPlayer::close(); +} +void CHttpMjpegPlayer::setBbox(cv::Rect bbox) { + CVideoPlayer::setBbox(bbox); +} +void CHttpMjpegPlayer::setCrop(bool crop) { + CVideoPlayer::setCrop(crop); +} +BOOL CHttpMjpegPlayer::play() +{ + if (m_httpmjpeg.mjpeg_start(m_sFileName.c_str(), m_acct.c_str(), m_pass.c_str())) + { + m_bPlaying = TRUE; + m_bPaused = FALSE; + } + CVideoPlayer::StartVideoDecoder();// Start the video decoder + return m_bPlaying; +} + +void CHttpMjpegPlayer::stop() +{ + if (m_bPlaying || m_bPaused) + { + m_httpmjpeg.mjpeg_stop(); + } + // Set flags BEFORE stopping decoder so rx thread stops calling decode() + m_bPlaying = FALSE; + m_bPaused = FALSE; + CVideoPlayer::StopVideoDecoder(); // Stop the video decoder +} + +BOOL CHttpMjpegPlayer::pause() +{ + CVideoPlayer::StopVideoDecoder(); // Stop the video decoder + return m_bPaused; +} + +BOOL CHttpMjpegPlayer::seek(int pos) +{ + return FALSE; +} + +int CHttpMjpegPlayer::getVideoCodec() +{ + return VIDEO_CODEC_JPEG; +} + +void CHttpMjpegPlayer::onNotify(int evt) +{ + if (evt == MJPEG_EVE_CONNSUCC) + { + openVideo(VIDEO_CODEC_JPEG); + } + +} + +void CHttpMjpegPlayer::onVideo(uint8 * pdata, int len, uint32 ts) +{ + playVideo(pdata, len, ts, 0); +} + +BOOL CHttpMjpegPlayer::onRecord() +{ + avi_set_video_info(m_pAviCtx, 0, 0, 0, "JPEG"); + + avi_update_header(m_pAviCtx); + + return TRUE; +} + + + + + diff --git a/MediaClient/MediaClient/media/http_mjpeg_player.h b/MediaClient/MediaClient/media/http_mjpeg_player.h new file mode 100644 index 0000000..d2320c5 --- /dev/null +++ b/MediaClient/MediaClient/media/http_mjpeg_player.h @@ -0,0 +1,59 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef HTTP_MJPEG_PLAYER_H +#define HTTP_MJPEG_PLAYER_H + +#include "video_player.h" +#include "http_mjpeg_cln.h" + + +class CHttpMjpegPlayer : public CVideoPlayer +{ + +public: + CHttpMjpegPlayer(); + virtual ~CHttpMjpegPlayer(); + + BOOL open(std::string fileName); + BOOL open(std::string _username, std::string _password, std::string _url); + void close(); + BOOL play(); + void stop(); + BOOL pause(); + BOOL seek(int pos); + int getVideoCodec(); + void setBbox(cv::Rect bbox); + void setCrop(bool crop); + void onNotify(int evt); + void onVideo(uint8 * pdata, int len, uint32 ts); + BOOL onRecord(); + +private: + char m_ip[32]; + CHttpMjpeg m_httpmjpeg; + std::string createNewMJPEGUrl(const std::string& username, + const std::string& password, + const std::string& url); +}; + +#endif + + + diff --git a/MediaClient/MediaClient/media/lock.h b/MediaClient/MediaClient/media/lock.h new file mode 100644 index 0000000..ba106dd --- /dev/null +++ b/MediaClient/MediaClient/media/lock.h @@ -0,0 +1,37 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef _LOCK_H +#define _LOCK_H + +#include "sys_inc.h" + +class CLock +{ +public: + CLock(void * pMutex) : m_pMutex(pMutex) {sys_os_mutex_enter(m_pMutex);} + ~CLock() {sys_os_mutex_leave(m_pMutex);} + +private: + void * m_pMutex; +}; + +#endif // _LOCK_H + + diff --git a/MediaClient/MediaClient/media/media_codec.cpp b/MediaClient/MediaClient/media/media_codec.cpp new file mode 100644 index 0000000..2b83a74 --- /dev/null +++ b/MediaClient/MediaClient/media/media_codec.cpp @@ -0,0 +1,215 @@ +/*************************************************************************************** + * + * 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 "media_codec.h" +#include "media_format.h" + + +AVCodecID to_audio_avcodecid(int codec) +{ + AVCodecID codecid = AV_CODEC_ID_NONE; + + switch (codec) + { + case AUDIO_CODEC_G711A: + codecid = AV_CODEC_ID_PCM_ALAW; + break; + + case AUDIO_CODEC_G711U: + codecid = AV_CODEC_ID_PCM_MULAW; + break; + + case AUDIO_CODEC_G726: + codecid = AV_CODEC_ID_ADPCM_G726; + break; + + case AUDIO_CODEC_G722: + codecid = AV_CODEC_ID_ADPCM_G722; + break; + + case AUDIO_CODEC_OPUS: + codecid = AV_CODEC_ID_OPUS; + break; + + case AUDIO_CODEC_AAC: + codecid = AV_CODEC_ID_AAC; + break; + } + + return codecid; +} + +AVCodecID to_video_avcodecid(int codec) +{ + AVCodecID codecid = AV_CODEC_ID_NONE; + + switch (codec) + { + case VIDEO_CODEC_H264: + codecid = AV_CODEC_ID_H264; + break; + + case VIDEO_CODEC_H265: + codecid = AV_CODEC_ID_HEVC; + break; + + case VIDEO_CODEC_MP4: + codecid = AV_CODEC_ID_MPEG4; + break; + + case VIDEO_CODEC_JPEG: + codecid = AV_CODEC_ID_MJPEG; + break; + } + + return codecid; +} + +int to_audio_codec(AVCodecID codecid) +{ + int codec = AUDIO_CODEC_NONE; + + switch (codecid) + { + case AV_CODEC_ID_PCM_ALAW: + codec = AUDIO_CODEC_G711A; + break; + + case AV_CODEC_ID_PCM_MULAW: + codec = AUDIO_CODEC_G711U; + break; + + case AV_CODEC_ID_ADPCM_G726: + codec = AUDIO_CODEC_G726; + break; + + case AV_CODEC_ID_ADPCM_G722: + codec = AUDIO_CODEC_G722; + break; + + case AV_CODEC_ID_OPUS: + codec = AUDIO_CODEC_OPUS; + break; + + case AV_CODEC_ID_AAC: + codec = AUDIO_CODEC_AAC; + break; + + default: + break; + } + + return codec; +} + +int to_video_codec(AVCodecID codecid) +{ + int codec = VIDEO_CODEC_NONE; + + switch (codecid) + { + case AV_CODEC_ID_H264: + codec = VIDEO_CODEC_H264; + break; + + case AV_CODEC_ID_HEVC: + codec = VIDEO_CODEC_H265; + break; + + case AV_CODEC_ID_MPEG4: + codec = VIDEO_CODEC_MP4; + break; + + case AV_CODEC_ID_MJPEG: + codec = VIDEO_CODEC_JPEG; + break; + + default: + break; + } + + return codec; +} + +AVPixelFormat to_avpixelformat(int fmt) +{ + AVPixelFormat pixfmt = AV_PIX_FMT_NONE; + + if (VIDEO_FMT_BGR24 == fmt) + { + pixfmt = AV_PIX_FMT_BGR24; + } + else if (VIDEO_FMT_YUV420P == fmt) + { + pixfmt = AV_PIX_FMT_YUV420P; + } + else if (VIDEO_FMT_YUYV422 == fmt) + { + pixfmt = AV_PIX_FMT_YUYV422; + } + else if (VIDEO_FMT_YVYU422 == fmt) + { + pixfmt = AV_PIX_FMT_YVYU422; + } + else if (VIDEO_FMT_UYVY422 == fmt) + { + pixfmt = AV_PIX_FMT_UYVY422; + } + else if (VIDEO_FMT_NV12 == fmt) + { + pixfmt = AV_PIX_FMT_NV12; + } + else if (VIDEO_FMT_NV21 == fmt) + { + pixfmt = AV_PIX_FMT_NV21; + } + else if (VIDEO_FMT_RGB24 == fmt) + { + pixfmt = AV_PIX_FMT_RGB24; + } + else if (VIDEO_FMT_RGB32 == fmt) + { + pixfmt = AV_PIX_FMT_RGB32; + } + else if (VIDEO_FMT_ARGB == fmt) + { + pixfmt = AV_PIX_FMT_ARGB; + } + else if (VIDEO_FMT_BGRA == fmt) + { + pixfmt = AV_PIX_FMT_BGRA; + } + else if (VIDEO_FMT_YV12 == fmt) + { + pixfmt = AV_PIX_FMT_YUV420P; + } + else if (VIDEO_FMT_BGR32 == fmt) + { + pixfmt = AV_PIX_FMT_BGR32; + } + else if (VIDEO_FMT_YUV422P == fmt) + { + pixfmt = AV_PIX_FMT_YUV422P; + } + + return pixfmt; +} + + + diff --git a/MediaClient/MediaClient/media/media_codec.h b/MediaClient/MediaClient/media/media_codec.h new file mode 100644 index 0000000..151944d --- /dev/null +++ b/MediaClient/MediaClient/media/media_codec.h @@ -0,0 +1,43 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef MEDIA_CODEC_H +#define MEDIA_CODEC_H + +extern "C" { +#include +} + +#ifdef __cplusplus +extern "C" { +#endif + +AVCodecID to_audio_avcodecid(int codec); +AVCodecID to_video_avcodecid(int codec); +int to_audio_codec(AVCodecID codecid); +int to_video_codec(AVCodecID codecid); +AVPixelFormat to_avpixelformat(int fmt); + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/MediaClient/MediaClient/media/media_format.h b/MediaClient/MediaClient/media/media_format.h new file mode 100644 index 0000000..a505dc2 --- /dev/null +++ b/MediaClient/MediaClient/media/media_format.h @@ -0,0 +1,64 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef _MEDIA_FORMAT_H +#define _MEDIA_FORMAT_H + +// video pixel format +#define VIDEO_FMT_NONE 0 +#define VIDEO_FMT_YUYV422 1 +#define VIDEO_FMT_YUV420P 2 +#define VIDEO_FMT_YVYU422 3 +#define VIDEO_FMT_UYVY422 4 +#define VIDEO_FMT_NV12 5 +#define VIDEO_FMT_NV21 6 +#define VIDEO_FMT_RGB24 7 +#define VIDEO_FMT_RGB32 8 +#define VIDEO_FMT_ARGB 9 +#define VIDEO_FMT_BGRA 10 +#define VIDEO_FMT_YV12 11 +#define VIDEO_FMT_BGR24 12 +#define VIDEO_FMT_BGR32 13 +#define VIDEO_FMT_YUV422P 14 +#define VIDEO_FMT_MJPG 15 + +// video codec +#define VIDEO_CODEC_NONE 0 +#define VIDEO_CODEC_H264 1 +#define VIDEO_CODEC_MP4 2 +#define VIDEO_CODEC_JPEG 3 +#define VIDEO_CODEC_H265 4 + +// audio codec +#define AUDIO_CODEC_NONE 0 +#define AUDIO_CODEC_G711A 1 +#define AUDIO_CODEC_G711U 2 +#define AUDIO_CODEC_G726 3 +#define AUDIO_CODEC_AAC 4 +#define AUDIO_CODEC_G722 5 +#define AUDIO_CODEC_OPUS 6 + + +#define DATA_TYPE_VIDEO 0 +#define DATA_TYPE_AUDIO 1 +#define DATA_TYPE_METADATA 2 + +#endif // _MEDIA_FORMAT_H + + diff --git a/MediaClient/MediaClient/media/media_parse.cpp b/MediaClient/MediaClient/media/media_parse.cpp new file mode 100644 index 0000000..8d14b7b --- /dev/null +++ b/MediaClient/MediaClient/media/media_parse.cpp @@ -0,0 +1,259 @@ +/*************************************************************************************** + * + * 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 "media_parse.h" +#include "media_format.h" +#include "media_util.h" +#include "h264.h" +#include "h265.h" +#include "mjpeg.h" +#include "h264_util.h" +#include "h265_util.h" +#include "bs.h" +#include + + +int avc_parse_video_size(int codec, uint8 * p_data, uint32 len, int * width, int * height) +{ + uint8 nalu_t; + + if (p_data == NULL || len < 5) + { + return -1; + } + + // Need to parse width X height + + if (VIDEO_CODEC_H264 == codec) + { + int s_len = 0, n_len = 0, parse_len = len; + uint8 * p_cur = p_data; + uint8 * p_end = p_data + len; + + while (p_cur && p_cur < p_end && parse_len > 0) + { + uint8 * p_next = avc_split_nalu(p_cur, parse_len, &s_len, &n_len); + + nalu_t = (p_cur[s_len] & 0x1F); + + int b_start; + nal_t nal; + + nal.i_payload = n_len-s_len-1; + nal.p_payload = p_cur+s_len+1; + nal.i_type = nalu_t; + + if (nalu_t == H264_NAL_SPS) + { + h264_t parse; + h264_parser_init(&parse); + + h264_parser_parse(&parse, &nal, &b_start); + log_print(HT_LOG_INFO, "%s, H264 width[%d],height[%d]\r\n", __FUNCTION__, parse.i_width, parse.i_height); + *width = parse.i_width; + *height = parse.i_height; + return 0; + } + + parse_len -= n_len; + p_cur = p_next; + } + } + else if (VIDEO_CODEC_H265 == codec) + { + int s_len, n_len = 0, parse_len = len; + uint8 * p_cur = p_data; + uint8 * p_end = p_data + len; + + while (p_cur && p_cur < p_end && parse_len > 0) + { + uint8 * p_next = avc_split_nalu(p_cur, parse_len, &s_len, &n_len); + + nalu_t = (p_cur[s_len] >> 1) & 0x3F; + + if (nalu_t == HEVC_NAL_SPS) + { + h265_t parse; + h265_parser_init(&parse); + + if (h265_parser_parse(&parse, p_cur+s_len, n_len-s_len) == 0) + { + log_print(HT_LOG_INFO, "%s, H265 width[%d],height[%d]\r\n", __FUNCTION__, parse.pic_width_in_luma_samples, parse.pic_height_in_luma_samples); + *width = parse.pic_width_in_luma_samples; + *height = parse.pic_height_in_luma_samples; + return 0; + } + } + + parse_len -= n_len; + p_cur = p_next; + } + } + else if (VIDEO_CODEC_JPEG == codec) + { + uint32 offset = 0; + int size_chunk = 0; + + while (offset < len - 8 && p_data[offset] == 0xFF) + { + if (p_data[offset+1] == MARKER_SOF0) + { + int h = ((p_data[offset+5] << 8) | p_data[offset+6]); + int w = ((p_data[offset+7] << 8) | p_data[offset+8]); + log_print(HT_LOG_INFO, "%s, MJPEG width[%d],height[%d]\r\n", __FUNCTION__, w, h); + *width = w; + *height = h; + break; + } + else if (p_data[offset+1] == MARKER_SOI) + { + offset += 2; + } + else + { + size_chunk = ((p_data[offset+2] << 8) | p_data[offset+3]); + offset += 2 + size_chunk; + } + } + } + else if (VIDEO_CODEC_MP4 == codec) + { + uint32 pos = 0; + int vol_f = 0; + int vol_pos = 0; + int vol_len = 0; + + while (pos < len - 4) + { + if (p_data[pos] == 0 && p_data[pos+1] == 0 && p_data[pos+2] == 1) + { + if (p_data[pos+3] >= 0x20 && p_data[pos+3] <= 0x2F) + { + vol_f = 1; + vol_pos = pos+4; + } + else if (vol_f) + { + vol_len = pos - vol_pos; + break; + } + } + + pos++; + } + + if (!vol_f) + { + return 0; + } + else if (vol_len <= 0) + { + vol_len = len - vol_pos; + } + + int vo_ver_id = 0; + + bs_t bs; + bs_init(&bs, &p_data[vol_pos], vol_len * 8); + + bs_skip(&bs, 1); /* random access */ + bs_skip(&bs, 8); /* vo_type */ + + if (bs_read1(&bs)) /* is_ol_id */ + { + vo_ver_id = bs_read(&bs, 4); /* vo_ver_id */ + bs_skip(&bs, 3); /* vo_priority */ + } + + if (bs_read(&bs, 4) == 15) // aspect_ratio_info + { + bs_skip(&bs, 8); // par_width + bs_skip(&bs, 8); // par_height + } + + if (bs_read1(&bs)) /* vol control parameter */ + { + bs_read(&bs, 2); + + bs_skip(&bs, 1); /* low_delay */ + + if (bs_read1(&bs)) + { + /* vbv parameters */ + bs_read(&bs, 15); /* first_half_bitrate */ + bs_skip(&bs, 1); + bs_read(&bs, 15); /* latter_half_bitrate */ + bs_skip(&bs, 1); + bs_read(&bs, 15); /* first_half_vbv_buffer_size */ + bs_skip(&bs, 1); + bs_read(&bs, 3); /* latter_half_vbv_buffer_size */ + bs_read(&bs, 11); /* first_half_vbv_occupancy */ + bs_skip(&bs, 1); + bs_read(&bs, 15); /* latter_half_vbv_occupancy */ + bs_skip(&bs, 1); + } + } + + int shape = bs_read(&bs, 2); /* vol shape */ + + if (shape == 3 && vo_ver_id != 1) + { + bs_skip(&bs, 4); /* video_object_layer_shape_extension */ + } + + bs_skip(&bs, 1); + + int framerate = bs_read(&bs, 16); + + int time_increment_bits = (int) (log(framerate - 1.0) * 1.44269504088896340736 + 1); // log2(framerate - 1) + 1 + if (time_increment_bits < 1) + { + time_increment_bits = 1; + } + + bs_skip(&bs, 1); + + if (bs_read1(&bs) != 0) /* fixed_vop_rate */ + { + bs_skip(&bs, time_increment_bits); + } + + if (shape != 2) + { + if (shape == 0) + { + bs_skip(&bs, 1); + int w = bs_read(&bs, 13); + bs_skip(&bs, 1); + int h = bs_read(&bs, 13); + + log_print(HT_LOG_INFO, "%s, MPEG4 width[%d],height[%d]\r\n", __FUNCTION__, w, h); + *width = w; + *height = h; + return 0; + } + } + } + + return -1; +} + + + + diff --git a/MediaClient/MediaClient/media/media_parse.h b/MediaClient/MediaClient/media/media_parse.h new file mode 100644 index 0000000..4a6ec91 --- /dev/null +++ b/MediaClient/MediaClient/media/media_parse.h @@ -0,0 +1,37 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef MEDIA_PARSE_H +#define MEDIA_PARSE_H + +#include "sys_inc.h" + +#ifdef __cplusplus +extern "C" { +#endif + +int avc_parse_video_size(int codec, uint8 * p_data, uint32 len, int * width, int * height); + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/MediaClient/MediaClient/media/media_util.cpp b/MediaClient/MediaClient/media/media_util.cpp new file mode 100644 index 0000000..095d5ac --- /dev/null +++ b/MediaClient/MediaClient/media/media_util.cpp @@ -0,0 +1,253 @@ +/*************************************************************************************** + * + * 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 "media_util.h" +#include "media_format.h" +#include "h264.h" +#include "h265.h" + +uint32 remove_emulation_bytes(uint8* to, uint32 toMaxSize, uint8* from, uint32 fromSize) +{ + uint32 toSize = 0; + uint32 i = 0; + + while (i < fromSize && toSize+1 < toMaxSize) + { + if (i+2 < fromSize && from[i] == 0 && from[i+1] == 0 && from[i+2] == 3) + { + to[toSize] = to[toSize+1] = 0; + toSize += 2; + i += 3; + } + else + { + to[toSize] = from[i]; + toSize += 1; + i += 1; + } + } + + return toSize; +} + +static uint8 * avc_find_startcode_internal(uint8 *p, uint8 *end) +{ + uint8 *a = p + 4 - ((intptr_t)p & 3); + + for (end -= 3; p < a && p < end; p++) + { + if (p[0] == 0 && p[1] == 0 && p[2] == 1) + { + return p; + } + } + + for (end -= 3; p < end; p += 4) + { + uint32 x = *(const uint32*)p; + + if ((x - 0x01010101) & (~x) & 0x80808080) + { // generic + if (p[1] == 0) + { + if (p[0] == 0 && p[2] == 1) + { + return p; + } + + if (p[2] == 0 && p[3] == 1) + { + return p+1; + } + } + + if (p[3] == 0) + { + if (p[2] == 0 && p[4] == 1) + { + return p+2; + } + + if (p[4] == 0 && p[5] == 1) + { + return p+3; + } + } + } + } + + for (end += 3; p < end; p++) + { + if (p[0] == 0 && p[1] == 0 && p[2] == 1) + { + return p; + } + } + + return end + 3; +} + +uint8 * avc_find_startcode(uint8 *p, uint8 *end) +{ + uint8 *out = avc_find_startcode_internal(p, end); + if (p 4 && e_buf[0] == 0 && e_buf[1] == 0 && e_buf[2] == 0 && e_buf[3] == 1) + { + return (e_buf[4] & 0x1f); + } + else if (len > 3 && e_buf[0] == 0 && e_buf[1] == 0 && e_buf[2] == 1) + { + return (e_buf[3] & 0x1f); + } + else if (len > 0) + { + return (e_buf[0] & 0x1f); + } + + return 0; +} + +uint8 avc_h265_nalu_type(uint8 * e_buf, int len) +{ + if (len > 4 && e_buf[0] == 0 && e_buf[1] == 0 && e_buf[2] == 0 && e_buf[3] == 1) + { + return ((e_buf[4] >> 1) & 0x3f); + } + else if (len > 3 && e_buf[0] == 0 && e_buf[1] == 0 && e_buf[2] == 1) + { + return ((e_buf[3] >> 1) & 0x3f); + } + else if (len > 0) + { + return ((e_buf[0] >> 1) & 0x3f); + } + + return 0; +} + +BOOL avc_get_h26x_paramsets(uint8 * data, int len, int codec, H26XParamSets * ps) +{ + BOOL ret = FALSE; + int s_len = 0, n_len = 0, parse_len = len; + uint8 * p_cur = data; + uint8 * p_end = data + len; + + while (p_cur && p_cur < p_end && parse_len > 0) + { + uint8 nalu; + uint8 * p_next = avc_split_nalu(p_cur, parse_len, &s_len, &n_len); + + if (VIDEO_CODEC_H264 == codec) + { + nalu = avc_h264_nalu_type(p_cur, n_len); + + if (nalu == H264_NAL_SPS && ps->sps_size == 0 && n_len <= (int)sizeof(ps->sps)) + { + memcpy(ps->sps, p_cur, n_len); + ps->sps_size = n_len; + } + else if (nalu == H264_NAL_PPS && ps->pps_size == 0 && n_len <= (int)sizeof(ps->pps)) + { + memcpy(ps->pps, p_cur, n_len); + ps->pps_size = n_len; + } + + if (ps->sps_size > 0 && ps->pps_size > 0) + { + ret = TRUE; + break; + } + } + else if (VIDEO_CODEC_H265 == codec) + { + nalu = avc_h265_nalu_type(p_cur, n_len); + + if (nalu == HEVC_NAL_VPS && ps->vps_size == 0 && n_len <= (int)sizeof(ps->vps)) + { + memcpy(ps->vps, p_cur, n_len); + ps->vps_size = n_len; + } + else if (nalu == HEVC_NAL_SPS && ps->sps_size == 0 && n_len <= (int)sizeof(ps->sps)) + { + memcpy(ps->sps, p_cur, n_len); + ps->sps_size = n_len; + } + else if (nalu == HEVC_NAL_PPS && ps->pps_size == 0 && n_len <= (int)sizeof(ps->pps)) + { + memcpy(ps->pps, p_cur, n_len); + ps->pps_size = n_len; + } + + if (ps->vps_size > 0 && ps->sps_size > 0 && ps->pps_size > 0) + { + ret = TRUE; + break; + } + } + + parse_len -= n_len; + p_cur = p_next; + } + + return ret; +} + + diff --git a/MediaClient/MediaClient/media/media_util.h b/MediaClient/MediaClient/media/media_util.h new file mode 100644 index 0000000..231bc92 --- /dev/null +++ b/MediaClient/MediaClient/media/media_util.h @@ -0,0 +1,53 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef MEDIA_UTIL_H +#define MEDIA_UTIL_H + +#include "sys_inc.h" + +typedef struct +{ + uint8 vps[512]; + int vps_size; + uint8 sps[512]; + int sps_size; + uint8 pps[512]; + int pps_size; +} H26XParamSets; + +#ifdef __cplusplus +extern "C" { +#endif + +uint32 remove_emulation_bytes(uint8* to, uint32 toMaxSize, uint8* from, uint32 fromSize); +uint8 * avc_find_startcode(uint8 *p, uint8 *end); +uint8 * avc_split_nalu(uint8 * e_buf, int e_len, int * s_len, int * d_len); +uint8 avc_h264_nalu_type(uint8 * e_buf, int len); +uint8 avc_h265_nalu_type(uint8 * e_buf, int len); +BOOL avc_get_h26x_paramsets(uint8 * data, int len, int codec, H26XParamSets * ps); + +#ifdef __cplusplus +} +#endif + +#endif + + + diff --git a/MediaClient/MediaClient/media/rtmp_player.cpp b/MediaClient/MediaClient/media/rtmp_player.cpp new file mode 100644 index 0000000..063d9d1 --- /dev/null +++ b/MediaClient/MediaClient/media/rtmp_player.cpp @@ -0,0 +1,407 @@ +/*************************************************************************************** + * + * 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 "rtmp_player.h" +#include "utils.h" + +/***************************************************************************************/ + +int rtmp_notify_callback(int evt, void * puser) +{ + CRtmpPlayer * pPlayer = (CRtmpPlayer *) puser; + + pPlayer->onNotify(evt); + return 0; +} + +int rtmp_audio_callback(uint8 * pdata, int len, uint32 ts, void *puser) +{ + CRtmpPlayer * pPlayer = (CRtmpPlayer *) puser; + + pPlayer->onAudio(pdata, len, ts); + return 0; +} + +int rtmp_video_callback(uint8 * pdata, int len, uint32 ts, void *puser) +{ + CRtmpPlayer * pPlayer = (CRtmpPlayer *) puser; + + pPlayer->onVideo(pdata, len, ts); + return 0; +} + +/***************************************************************************************/ + +CRtmpPlayer::CRtmpPlayer() +: CVideoPlayer() +{ + memset(m_ip, 0, sizeof(m_ip)); +} + +CRtmpPlayer::~CRtmpPlayer() +{ + close(); +} + +std::string CRtmpPlayer::createNewRTMPUrl(const std::string& username, + const std::string& password, + const std::string& url) { + // Copy the original strings to avoid modifying the originals + std::string modUsername = username; + std::string modPassword = password; + + // Replace '@' with '_' in username and password + std::replace(modUsername.begin(), modUsername.end(), '@', '_'); + std::replace(modPassword.begin(), modPassword.end(), '@', '_'); + + // Extract the protocol and rest of the URL + size_t protocolEndPos = url.find("://") + 3; // Find the position right after "://" + std::string protocol = url.substr(0, protocolEndPos); // Include "://" + + // Construct the new URL with modified credentials + std::string newUrl = protocol; + newUrl += modUsername + ":" + modPassword + "@"; + newUrl += url.substr(protocolEndPos); + return newUrl; +} + +BOOL CRtmpPlayer::open(std::string fileName) +{ + close(); + + CVideoPlayer::open(fileName); + + char host[100]; + + url_split(fileName.c_str(), NULL, 0, NULL, 0, NULL, 0, host, sizeof(host), NULL, NULL, 0); + + if (host[0] == '\0') + { + return FALSE; + } + + strncpy(m_ip, host, sizeof(m_ip) - 1); + + m_rtmp.set_notify_cb(rtmp_notify_callback, this); + m_rtmp.set_audio_cb(rtmp_audio_callback); + m_rtmp.set_video_cb(rtmp_video_callback); + + return TRUE; +} + +BOOL CRtmpPlayer::open(std::string _username, std::string _password, std::string _url) +{ + close(); + CVideoPlayer::open(_username, _password, _url); + int port; + char proto[32], username[100], password[100], host[100], path[200]; + std::string fileName = createNewRTMPUrl(_username, _password, _url); + + url_split(fileName.c_str(), + proto, sizeof(proto), + username, sizeof(username), + password, sizeof(password), + host, sizeof(host), + &port, + path, sizeof(path)); + + if (host[0] == '\0') + { + return FALSE; + } + strncpy(m_ip, host, sizeof(m_ip) - 1); + + m_rtmp.set_notify_cb(rtmp_notify_callback, this); + m_rtmp.set_audio_cb(rtmp_audio_callback); + m_rtmp.set_video_cb(rtmp_video_callback); + + return TRUE; + } +void CRtmpPlayer::close() +{ + // stop rtmp connection + m_rtmp.rtmp_stop(); + m_rtmp.rtmp_close(); + + m_bPlaying = FALSE; + m_bPaused = FALSE; + CVideoPlayer::StopVideoDecoder(); + + CVideoPlayer::close(); +} + +BOOL CRtmpPlayer::play() +{ + if (m_rtmp.rtmp_start(m_sFileName.c_str(), m_acct.c_str(), m_pass.c_str())) + { + m_bPlaying = TRUE; + m_bPaused = FALSE; + } + CVideoPlayer::StartVideoDecoder();// Start the video decoder + + return m_bPlaying; +} + +void CRtmpPlayer::stop() +{ + if (m_bPlaying || m_bPaused) + { + m_rtmp.rtmp_stop(); + } + // Set flags BEFORE stopping decoder so rx thread stops calling decode() + m_bPlaying = FALSE; + m_bPaused = FALSE; + CVideoPlayer::StopVideoDecoder(); // Stop the video decoder +} + +BOOL CRtmpPlayer::pause() +{ + if (m_bPlaying) + { + if (m_rtmp.rtmp_pause()) + { + m_bPaused = TRUE; + m_bPlaying = FALSE; + } + } + else if (m_bPaused) + { + if (m_rtmp.rtmp_play()) + { + m_bPaused = FALSE; + m_bPlaying = TRUE; + } + } + CVideoPlayer::StopVideoDecoder(); // Stop the video decoder + return m_bPaused; +} + +BOOL CRtmpPlayer::seek(int pos) +{ + return FALSE; +} + +int64 CRtmpPlayer::getElapse() +{ + uint32 cur_ts; + uint32 init_ts; + int frequency; + + if (m_videoClock.SyncTime.tv_sec > m_audioClock.SyncTime.tv_sec) + { + cur_ts = m_videoClock.SyncTimestamp; + init_ts = m_rtmp.get_video_init_ts(); + frequency = getVideoClock(); + } + else if (m_videoClock.SyncTime.tv_sec == m_audioClock.SyncTime.tv_sec && + m_videoClock.SyncTime.tv_usec > m_audioClock.SyncTime.tv_usec) + { + cur_ts = m_videoClock.SyncTimestamp; + init_ts = m_rtmp.get_video_init_ts(); + frequency = getVideoClock(); + } + else + { + cur_ts = m_audioClock.SyncTimestamp; + init_ts = m_rtmp.get_audio_init_ts(); + frequency = getAudioClock(); + } + + if (init_ts == 0) + { + return 0; + } + + int64 elapse; + int timestampDiff = cur_ts - init_ts; + + // Divide this by the timestamp frequency to get real time: + double timeDiff = timestampDiff / (double)frequency; + + if (timeDiff >= 0.0) + { + elapse = timeDiff * 1000; + } + else + { + timeDiff = -timeDiff; + elapse = timeDiff * 1000; + } + + return elapse; +} + +int64 CRtmpPlayer::getDuration() +{ + return 0; +} + +int CRtmpPlayer::getVideoCodec() +{ + return m_rtmp.video_codec(); +} + +int CRtmpPlayer::getAudioCodec() +{ + return m_rtmp.audio_codec(); +} + +void CRtmpPlayer::setBbox(cv::Rect bbox) { + CVideoPlayer::setBbox(bbox); +} +void CRtmpPlayer::setCrop(bool crop) { + CVideoPlayer::setCrop(crop); +} + +void CRtmpPlayer::onNotify(int evt) +{ + if (evt == RTMP_EVE_VIDEOREADY) + { + int videoCodec = m_rtmp.video_codec(); + + if (VIDEO_CODEC_NONE != videoCodec) + { + openVideo(videoCodec); + } + } + else if (evt == RTMP_EVE_AUDIOREADY) + { + int audioCodec = m_rtmp.audio_codec(); + + if (AUDIO_CODEC_NONE != audioCodec) + { + openAudio(audioCodec, m_rtmp.get_audio_samplerate(), m_rtmp.get_audio_channels()); + } + } + + //emit notify(evt); +} + +void CRtmpPlayer::onAudio(uint8 * pdata, int len, uint32 ts) +{ + playAudio(pdata, len, ts, 0); +} + +void CRtmpPlayer::onVideo(uint8 * pdata, int len, uint32 ts) +{ + playVideo(pdata, len, ts, 0); +} + +BOOL CRtmpPlayer::onRecord() +{ + CRtmpClient * p_rtmp = &m_rtmp; + AVICTX * p_avictx = m_pAviCtx; + + int vcodec = p_rtmp->video_codec(); + int fps = p_rtmp->get_video_framerate(); + int v_extra_len = 0; + uint8 v_extra[1024]; + + if (VIDEO_CODEC_H264 == vcodec) + { + avi_set_video_info(p_avictx, fps, 0, 0, "H264"); + + uint8 sps[512], pps[512]; + int sps_len = 0, pps_len = 0; + + if (p_rtmp->get_h264_params(sps, &sps_len, pps, &pps_len)) + { + memcpy(v_extra, sps, sps_len); + memcpy(v_extra + sps_len, pps, pps_len); + + v_extra_len = sps_len + pps_len; + } + + if (v_extra_len > 0) + { + avi_set_video_extra_info(p_avictx, v_extra, v_extra_len); + } + } + else if (VIDEO_CODEC_H265 == vcodec) + { + avi_set_video_info(p_avictx, fps, 0, 0, "H265"); + + uint8 vps[512], sps[512], pps[512]; + int vps_len = 0, sps_len = 0, pps_len = 0; + + if (p_rtmp->get_h265_params(sps, &sps_len, pps, &pps_len, vps, &vps_len)) + { + memcpy(v_extra, vps, vps_len); + memcpy(v_extra + vps_len, sps, sps_len); + memcpy(v_extra + vps_len + sps_len, pps, pps_len); + + v_extra_len = vps_len + sps_len + pps_len; + } + + if (v_extra_len > 0) + { + avi_set_video_extra_info(p_avictx, v_extra, v_extra_len); + } + } + else if (VIDEO_CODEC_JPEG == vcodec) + { + avi_set_video_info(p_avictx, fps, 0, 0, "JPEG"); + } + else if (VIDEO_CODEC_MP4 == vcodec) + { + avi_set_video_info(p_avictx, fps, 0, 0, "MP4V"); + } + + int acodec = p_rtmp->audio_codec(); + int sr = p_rtmp->get_audio_samplerate(); + int ch = p_rtmp->get_audio_channels(); + + if (AUDIO_CODEC_G711A == acodec) + { + avi_set_audio_info(p_avictx, ch, sr, AUDIO_FORMAT_ALAW); + } + else if (AUDIO_CODEC_G711U == acodec) + { + avi_set_audio_info(p_avictx, ch, sr, AUDIO_FORMAT_MULAW); + } + else if (AUDIO_CODEC_G726 == acodec) + { + avi_set_audio_info(p_avictx, ch, sr, AUDIO_FORMAT_G726); + } + else if (AUDIO_CODEC_G722 == acodec) + { + avi_set_audio_info(p_avictx, ch, sr, AUDIO_FORMAT_G722); + } + else if (AUDIO_CODEC_AAC == acodec) + { + avi_set_audio_info(p_avictx, ch, sr, AUDIO_FORMAT_AAC); + avi_set_audio_extra_info(p_avictx, p_rtmp->get_audio_config(), p_rtmp->get_audio_config_len()); + } + + avi_update_header(p_avictx); + + if (p_avictx->ctxf_video) + { + if (v_extra_len > 0) + { + recordVideo(v_extra, v_extra_len, 0, 0); + } + } + + return TRUE; +} + + + + diff --git a/MediaClient/MediaClient/media/rtmp_player.h b/MediaClient/MediaClient/media/rtmp_player.h new file mode 100644 index 0000000..b1c68c0 --- /dev/null +++ b/MediaClient/MediaClient/media/rtmp_player.h @@ -0,0 +1,62 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef RTMP_PLAYER_H +#define RTMP_PLAYER_H + +#include "video_player.h" +#include "rtmp_cln.h" + +class CRtmpPlayer : public CVideoPlayer +{ + +public: + CRtmpPlayer(); + virtual ~CRtmpPlayer(); + + BOOL open(std::string fileName); + BOOL open(std::string _username, std::string _password, std::string _url); + void close(); + BOOL play(); + void stop(); + BOOL pause(); + BOOL seek(int pos); + int64 getElapse(); + int64 getDuration(); + int getVideoCodec(); + int getAudioCodec(); + void setBbox(cv::Rect bbox); + void setCrop(bool crop); + void onNotify(int evt); + void onAudio(uint8 * pdata, int len, uint32 ts); + void onVideo(uint8 * pdata, int len, uint32 ts); + BOOL onRecord(); + +private: + char m_ip[32]; + CRtmpClient m_rtmp; + std::string createNewRTMPUrl(const std::string& username, + const std::string& password, + const std::string& url); +}; + +#endif + + + diff --git a/MediaClient/MediaClient/media/rtsp_player.cpp b/MediaClient/MediaClient/media/rtsp_player.cpp new file mode 100644 index 0000000..e572856 --- /dev/null +++ b/MediaClient/MediaClient/media/rtsp_player.cpp @@ -0,0 +1,674 @@ +/*************************************************************************************** + * + * 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 "rtsp_player.h" +#include "rtp.h" +#include + +/***************************************************************************************/ + +int rtsp_notify_cb(int evt, void * puser) +{ + CRtspPlayer * pPlayer = (CRtspPlayer *) puser; + pPlayer->onNotify(evt); + return 0; +} + +int rtsp_audio_cb(uint8 * pdata, int len, uint32 ts, uint16 seq, void *puser) +{ + CRtspPlayer * pPlayer = (CRtspPlayer *) puser; + //pPlayer->onAudio(pdata, len, ts, seq); // Disable audio for now + return 0; +} + +int rtsp_video_cb(uint8 * pdata, int len, uint32 ts, uint16 seq, void *puser) +{ + CRtspPlayer * pPlayer = (CRtspPlayer *) puser; + pPlayer->onVideo(pdata, len, ts, seq); + return 0; +} + +int rtsp_rtcp_cb(uint8 * pdata, int len, int type, void *puser) +{ + CRtspPlayer * pPlayer = (CRtspPlayer *) puser; + pPlayer->onRtcp(pdata, len, type); + return 0; +} + +int rtsp_metadata_cb(uint8 * pdata, int len, uint32 ts, uint16 seq, void *puser) +{ + CRtspPlayer * pPlayer = (CRtspPlayer *) puser; + return 0; +} + + +/***************************************************************************************/ + +CRtspPlayer::CRtspPlayer(): CVideoPlayer(),m_port(554) +{ + memset(m_ip, 0, sizeof(m_ip)); +} + +CRtspPlayer::~CRtspPlayer() +{ + close(); +} + +BOOL CRtspPlayer::open(std::string fileName) +{ + close(); + CVideoPlayer::open(fileName); + int port; + char proto[32], username[100], password[100], host[100], path[200]; + url_split(fileName.c_str(), + proto, sizeof(proto), + username, sizeof(username), + password, sizeof(password), + host, sizeof(host), + &port, + path, sizeof(path)); + if (strcasecmp(proto, "rtsp") == 0) + { + port = (port == -1) ? 554 : port; + } + else if (strcasecmp(proto, "http") == 0) + { + port = (port == -1) ? 80 : port; + } + else if (strcasecmp(proto, "https") == 0) + { + port = (port == -1) ? 443 : port; + } + + else if (strcasecmp(proto, "ws") == 0) + { + port = (port == -1) ? 80 : port; + } + else if (strcasecmp(proto, "wss") == 0) + { + port = (port == -1) ? 443 : port; + } + + else + { + return FALSE; + } + + if (host[0] == '\0') + { + return FALSE; + } + + if (username[0] != '\0') + { + m_acct = username; + } + + if (password[0] != '\0') + { + m_pass = password; + } + + strncpy(m_ip, host, sizeof(m_ip) - 1); + m_port = port; + m_rtsp.set_notify_cb(rtsp_notify_cb, this); + m_rtsp.set_audio_cb(rtsp_audio_cb); + m_rtsp.set_video_cb(rtsp_video_cb); + m_rtsp.set_rtcp_cb(rtsp_rtcp_cb); + m_rtsp.set_metadata_cb(rtsp_metadata_cb); + m_rtsp.set_rx_timeout(10); // No data within 10s, receiving timeout + m_rtsp.set_conn_timeout(5); + return TRUE; +} + +std::string CRtspPlayer::createNewRTSPUrl(const std::string& username, + const std::string& password, + const std::string& url) { + // Copy the original strings to avoid modifying the originals + std::string modUsername = username; + std::string modPassword = password; + + // Replace '@' with '_' in username and password + std::replace(modUsername.begin(), modUsername.end(), '@', '_'); + std::replace(modPassword.begin(), modPassword.end(), '@', '_'); + + // Extract the protocol and rest of the URL + size_t protocolEndPos = url.find("://") + 3; // Find the position right after "://" + std::string protocol = url.substr(0, protocolEndPos); // Include "://" + + // Construct the new URL with modified credentials + std::string newUrl = protocol; + newUrl += modUsername + ":" + modPassword + "@"; + newUrl += url.substr(protocolEndPos); + return newUrl; +} + + +BOOL CRtspPlayer::open(std::string _username, std::string _password, std::string _url) +{ + close(); + CVideoPlayer::open(_username, _password, _url); + int port; + char proto[32], username[100], password[100], host[100], path[200]; + std::string fileName = createNewRTSPUrl(_username,_password,_url); + + url_split(fileName.c_str(), + proto, sizeof(proto), + username, sizeof(username), + password, sizeof(password), + host, sizeof(host), + &port, + path, sizeof(path)); + + if (strcasecmp(proto, "rtsp") == 0) + { + port = (port == -1) ? 554 : port; + } + else if (strcasecmp(proto, "http") == 0) + { + port = (port == -1) ? 80 : port; + } + else if (strcasecmp(proto, "https") == 0) + { + port = (port == -1) ? 443 : port; + } + else if (strcasecmp(proto, "ws") == 0) + { + port = (port == -1) ? 80 : port; + } + else if (strcasecmp(proto, "wss") == 0) + { + port = (port == -1) ? 443 : port; + } + else + { + return FALSE; + } + + if (host[0] == '\0') + { + return FALSE; + } + + strncpy(m_ip, host, sizeof(m_ip) - 1); + m_port = port; + m_rtsp.set_notify_cb(rtsp_notify_cb, this); + m_rtsp.set_audio_cb(rtsp_audio_cb); + m_rtsp.set_video_cb(rtsp_video_cb); + m_rtsp.set_rtcp_cb(rtsp_rtcp_cb); + m_rtsp.set_metadata_cb(rtsp_metadata_cb); + m_rtsp.set_rx_timeout(10); // No data within 10s, receiving timeout + m_rtsp.set_conn_timeout(5); + return TRUE; +} + +void CRtspPlayer::close() +{ + m_rtsp.rtsp_stop(); + m_rtsp.rtsp_close(); + // Stop video decoder AFTER RTSP threads are dead (rtsp_close waits for them) + // but BEFORE CVideoPlayer::close(). This flushes the hardware decoder cleanly + // and prevents the destructor-time flush from blocking on the GPU. + m_bPlaying = FALSE; + m_bPaused = FALSE; + CVideoPlayer::StopVideoDecoder(); + m_port = 554; + memset(m_ip, 0, sizeof(m_ip)); + CVideoPlayer::close(); +} +void CRtspPlayer::setBbox(cv::Rect bbox) { + CVideoPlayer::setBbox(bbox); +} +void CRtspPlayer::setCrop(bool crop) { + CVideoPlayer::setCrop(crop); +} +BOOL CRtspPlayer::play() +{ + if (m_rtsp.rtsp_start(m_sFileName.c_str(), m_acct.c_str(), m_pass.c_str())) + { + m_bPlaying = TRUE; + m_bPaused = FALSE; + } + CVideoPlayer::StartVideoDecoder();// Start the video decoder + return m_bPlaying; +} + +void CRtspPlayer::stop() +{ + if (m_bPlaying || m_bPaused) + { + m_rtsp.rtsp_stop(); + } + // Set flags BEFORE stopping decoder so TCP rx thread stops calling decode() + m_bPlaying = FALSE; + m_bPaused = FALSE; + CVideoPlayer::StopVideoDecoder(); // Stop the video decoder +} + +BOOL CRtspPlayer::pause() +{ + if (m_bPlaying) + { + if (m_rtsp.rtsp_pause()) + { + m_bPaused = TRUE; + m_bPlaying = FALSE; + } + } + else if (m_bPaused) + { + if (m_rtsp.rtsp_play(0)) + { + m_bPaused = FALSE; + m_bPlaying = TRUE; + } + } + CVideoPlayer::StopVideoDecoder(); // Stop the video decoder + return m_bPaused; +} + +BOOL CRtspPlayer::seek(int pos) +{ + if (pos < 0 || pos > 100) + { + return FALSE; + } + + int64 duration = getDuration(); + if (duration <= 0) + { + return FALSE; + } + + int ntp_pos = duration / 100 * pos; + + m_rtsp.rtsp_play(ntp_pos); + + return TRUE; +} + +int64 CRtspPlayer::getElapse() +{ + uint32 cur_ts; + uint32 init_ts; + int frequency; + RCUA * p_rua = m_rtsp.get_rua(); + if (NULL == p_rua) + { + return 0; + } + + if (m_videoClock.SyncTime.tv_sec > m_audioClock.SyncTime.tv_sec) + { + cur_ts = m_videoClock.SyncTimestamp; + init_ts = p_rua->video_init_ts; + frequency = getVideoClock(); + } + else if (m_videoClock.SyncTime.tv_sec == m_audioClock.SyncTime.tv_sec && + m_videoClock.SyncTime.tv_usec > m_audioClock.SyncTime.tv_usec) + { + cur_ts = m_videoClock.SyncTimestamp; + init_ts = p_rua->video_init_ts; + frequency = getVideoClock(); + } + else + { + cur_ts = m_audioClock.SyncTimestamp; + init_ts = p_rua->audio_init_ts; + frequency = getAudioClock(); + } + + if (init_ts == (uint32)-1) + { + return 0; + } + + int64 elapse; + int timestampDiff = cur_ts - init_ts; + + // Divide this by the timestamp frequency to get real time: + double timeDiff = timestampDiff / (double)frequency; + + if (timeDiff >= 0.0) + { + elapse = p_rua->media_start + timeDiff * 1000; + } + else + { + timeDiff = -timeDiff; + elapse = p_rua->media_start + timeDiff * 1000; + } + + return elapse; +} + +int64 CRtspPlayer::getDuration() +{ + RCUA * p_rua = m_rtsp.get_rua(); + if (p_rua) + { + return p_rua->play_end - p_rua->play_start; + } + + return 0; +} + +int CRtspPlayer::getVideoClock() +{ + return 90000; +} + +int CRtspPlayer::getAudioClock() +{ + return m_nSampleRate; +} + +int CRtspPlayer::getVideoCodec() +{ + return m_rtsp.video_codec(); +} + +int CRtspPlayer::getAudioCodec() +{ + return m_rtsp.audio_codec(); +} + +void CRtspPlayer::setRtpMulticast(BOOL flag) +{ + m_rtsp.set_rtp_multicast(flag); +} + +void CRtspPlayer::setRtpOverUdp(BOOL flag) +{ + m_rtsp.set_rtp_over_udp(flag); +} + +#ifdef BACKCHANNEL + +int CRtspPlayer::getBCFlag() +{ + return m_rtsp.get_bc_flag(); +} + +void CRtspPlayer::setBCFlag(int flag) +{ + m_rtsp.set_bc_flag(flag); +} + +int CRtspPlayer::getBCDataFlag() +{ + return m_rtsp.get_bc_data_flag(); +} + +void CRtspPlayer::setBCDataFlag(int flag) +{ + if (m_rtsp.get_bc_data_flag()) + { + m_rtsp.set_bc_data_flag(0); + } + else + { + m_rtsp.set_bc_data_flag(1); + } +} + +void CRtspPlayer::setAudioDevice(int index) +{ + m_rtsp.set_audio_device(index); +} + +#endif // end of BACKCHANNEL + +#ifdef REPLAY + +int CRtspPlayer::getReplayFlag() +{ + return m_rtsp.get_replay_flag(); +} + +void CRtspPlayer::setReplayFlag(int flag) +{ + m_rtsp.set_replay_flag(flag); +} + +void CRtspPlayer::setScale(double scale) +{ + m_rtsp.set_scale(scale); +} + +void CRtspPlayer::setRateControlFlag(int flag) +{ + m_rtsp.set_rate_control_flag(flag); +} + +void CRtspPlayer::setImmediateFlag(int flag) +{ + m_rtsp.set_immediate_flag(flag); +} + +void CRtspPlayer::setFramesFlag(int flag, int interval) +{ + m_rtsp.set_frames_flag(flag, interval); +} + +void CRtspPlayer::setReplayRange(time_t start, time_t end) +{ + m_rtsp.set_replay_range(start, end); +} + +#endif // end of REPLAY + +#ifdef OVER_HTTP + +void CRtspPlayer::setRtspOverHttp(int flag, int port) +{ + m_rtsp.set_rtsp_over_http(flag, port); +} + +#endif // OVER_HTTP + +#ifdef OVER_WEBSOCKET + +void CRtspPlayer::setRtspOverWs(int flag, int port) +{ + m_rtsp.set_rtsp_over_ws(flag, port); +} + +#endif // OVER_WEBSOCKET + +void CRtspPlayer::onNotify(int evt) +{ + if (evt == RTSP_EVE_CONNSUCC) + { + int videoCodec = m_rtsp.video_codec(); + int audioCodec = m_rtsp.audio_codec(); + + if (VIDEO_CODEC_NONE != videoCodec) + { + openVideo(videoCodec); + } + + if (AUDIO_CODEC_NONE != audioCodec) + { + openAudio(audioCodec, + m_rtsp.get_audio_samplerate(), + m_rtsp.get_audio_channels(), + m_rtsp.get_audio_bitpersample()); + } + } + + //emit notify(evt); +} + +void CRtspPlayer::onAudio(uint8 * pdata, int len, uint32 ts, uint16 seq) +{ + playAudio(pdata, len, ts, seq); +} + +void CRtspPlayer::onVideo(uint8 * pdata, int len, uint32 ts, uint16 seq) +{ + playVideo(pdata, len, ts, seq); +} + +void CRtspPlayer::onRtcp(uint8 * pdata, int len, int type) +{ + uint8 * p_rtp = pdata; + uint32 rtp_len = len; + + // Check for the 20-byte RTCP header: + if (rtp_len < 20) + { + return; + } + + uint8 pt = p_rtp[1]; + uint32 rtpHdr = ntohl(*(uint32*)p_rtp); p_rtp += 4; rtp_len -= 4; + uint32 ssrc = ntohl(*(uint32*)(p_rtp)); p_rtp += 4; rtp_len -= 4; + uint32 ntpMSW = ntohl(*(uint32*)(p_rtp)); p_rtp += 4; rtp_len -= 4; + uint32 ntpLSW = ntohl(*(uint32*)(p_rtp)); p_rtp += 4; rtp_len -= 4; + uint32 rtpTimestamp = ntohl(*(uint32*)(p_rtp)); + + if (pt != RTCP_SR) + { + return; + } + + // Check the RTP version number (it should be 2) + if ((rtpHdr & 0xC0000000) != 0x80000000) + { + return; + } + + if (AV_TYPE_AUDIO == type) + { + m_audioClock.SyncTimestamp = rtpTimestamp; + m_audioClock.SyncTime.tv_sec = ntpMSW - 0x83AA7E80; // 1/1/1900 -> 1/1/1970 + double microseconds = (ntpLSW * 15625.0) / 0x04000000; // 10^6/2^32 + m_audioClock.SyncTime.tv_usec = (unsigned)(microseconds+0.5); + } + else if (AV_TYPE_VIDEO == type) + { + m_videoClock.SyncTimestamp = rtpTimestamp; + m_videoClock.SyncTime.tv_sec = ntpMSW - 0x83AA7E80; // 1/1/1900 -> 1/1/1970 + double microseconds = (ntpLSW * 15625.0) / 0x04000000; // 10^6/2^32 + m_videoClock.SyncTime.tv_usec = (unsigned)(microseconds+0.5); + } +} + +BOOL CRtspPlayer::onRecord() +{ + CRtspClient * p_rtsp = &m_rtsp; + AVICTX * p_avictx = m_pAviCtx; + + int vcodec = p_rtsp->video_codec(); + int v_extra_len = 0; + uint8 v_extra[1024]; + + if (VIDEO_CODEC_H264 == vcodec) + { + avi_set_video_info(p_avictx, 0, 0, 0, "H264"); + + uint8 sps[512], pps[512]; + int sps_len = 0, pps_len = 0; + + if (p_rtsp->get_h264_params(sps, &sps_len, pps, &pps_len)) + { + memcpy(v_extra, sps, sps_len); + memcpy(v_extra + sps_len, pps, pps_len); + + v_extra_len = sps_len + pps_len; + } + + if (v_extra_len > 0) + { + avi_set_video_extra_info(p_avictx, v_extra, v_extra_len); + } + } + else if (VIDEO_CODEC_H265 == vcodec) + { + avi_set_video_info(p_avictx, 0, 0, 0, "H265"); + + uint8 vps[512], sps[512], pps[512]; + int vps_len = 0, sps_len = 0, pps_len = 0; + + if (p_rtsp->get_h265_params(sps, &sps_len, pps, &pps_len, vps, &vps_len)) + { + memcpy(v_extra, vps, vps_len); + memcpy(v_extra + vps_len, sps, sps_len); + memcpy(v_extra + vps_len + sps_len, pps, pps_len); + + v_extra_len = vps_len + sps_len + pps_len; + } + + if (v_extra_len > 0) + { + avi_set_video_extra_info(p_avictx, v_extra, v_extra_len); + } + } + else if (VIDEO_CODEC_JPEG == vcodec) + { + avi_set_video_info(p_avictx, 0, 0, 0, "JPEG"); + } + else if (VIDEO_CODEC_MP4 == vcodec) + { + avi_set_video_info(p_avictx, 0, 0, 0, "MP4V"); + } + + int acodec = p_rtsp->audio_codec(); + int sr = p_rtsp->get_audio_samplerate(); + int ch = p_rtsp->get_audio_channels(); + + if (AUDIO_CODEC_G711A == acodec) + { + avi_set_audio_info(p_avictx, ch, sr, AUDIO_FORMAT_ALAW); + } + else if (AUDIO_CODEC_G711U == acodec) + { + avi_set_audio_info(p_avictx, ch, sr, AUDIO_FORMAT_MULAW); + } + else if (AUDIO_CODEC_G726 == acodec) + { + avi_set_audio_info(p_avictx, ch, sr, AUDIO_FORMAT_G726); + } + else if (AUDIO_CODEC_G722 == acodec) + { + avi_set_audio_info(p_avictx, ch, sr, AUDIO_FORMAT_G722); + } + else if (AUDIO_CODEC_AAC == acodec) + { + avi_set_audio_info(p_avictx, ch, sr, AUDIO_FORMAT_AAC); + avi_set_audio_extra_info(p_avictx, p_rtsp->get_audio_config(), p_rtsp->get_audio_config_len()); + } + + avi_update_header(p_avictx); + + if (p_avictx->ctxf_video) + { + if (v_extra_len > 0) + { + recordVideo(v_extra, v_extra_len, 0, 0); + } + } + + return TRUE; +} + + + + diff --git a/MediaClient/MediaClient/media/rtsp_player.h b/MediaClient/MediaClient/media/rtsp_player.h new file mode 100644 index 0000000..cdd5b50 --- /dev/null +++ b/MediaClient/MediaClient/media/rtsp_player.h @@ -0,0 +1,91 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef RTSP_PLAYER_H +#define RTSP_PLAYER_H + +#include "video_player.h" +#include "rtsp_cln.h" +#include + + +class CRtspPlayer : public CVideoPlayer +{ +public: + CRtspPlayer(); + virtual ~CRtspPlayer(); + BOOL open(std::string fileName); + BOOL open(std::string _username, std::string _password, std::string _url); + void close(); + BOOL play(); + void stop(); + BOOL pause(); + BOOL seek(int pos); + int64 getElapse(); + int64 getDuration(); + int getVideoClock(); + int getAudioClock(); + int getVideoCodec(); + int getAudioCodec(); + void setRtpMulticast(BOOL flag); + void setRtpOverUdp(BOOL flag); + void setBbox(cv::Rect bbox); + void setCrop(bool crop); +#ifdef OVER_HTTP + void setRtspOverHttp(int flag, int port); +#endif + +#ifdef OVER_WEBSOCKET + void setRtspOverWs(int flag, int port); +#endif + +#ifdef BACKCHANNEL + int getBCFlag(); + void setBCFlag(int flag); + int getBCDataFlag(); + void setBCDataFlag(int flag); + void setAudioDevice(int index); +#endif + +#ifdef REPLAY + int getReplayFlag(); + void setReplayFlag(int flag); + void setScale(double scale); + void setRateControlFlag(int flag); + void setImmediateFlag(int flag); + void setFramesFlag(int flag, int interval); + void setReplayRange(time_t start, time_t end); +#endif + void onNotify(int evt); + void onAudio(uint8 * pdata, int len, uint32 ts, uint16 seq); + void onVideo(uint8 * pdata, int len, uint32 ts, uint16 seq); + void onRtcp(uint8 * pdata, int len, int type); + BOOL onRecord(); + +private: + char m_ip[32]; + int m_port; + std::string createNewRTSPUrl(const std::string& username, const std::string& password, const std::string& url); + CRtspClient m_rtsp; +}; + +#endif + + + diff --git a/MediaClient/MediaClient/media/srt_player.cpp b/MediaClient/MediaClient/media/srt_player.cpp new file mode 100644 index 0000000..e2620ba --- /dev/null +++ b/MediaClient/MediaClient/media/srt_player.cpp @@ -0,0 +1,412 @@ +/*************************************************************************************** + * + * 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 "srt_player.h" +#include "utils.h" + +/***************************************************************************************/ + +int srt_notify_callback(int evt, void * puser) +{ + CSrtPlayer * pPlayer = (CSrtPlayer *) puser; + + pPlayer->onNotify(evt); + return 0; +} + +int srt_audio_callback(uint8 * pdata, int len, uint32 ts, void *puser) +{ + CSrtPlayer * pPlayer = (CSrtPlayer *) puser; + + pPlayer->onAudio(pdata, len, ts); + return 0; +} + +int srt_video_callback(uint8 * pdata, int len, uint32 ts, void *puser) +{ + CSrtPlayer * pPlayer = (CSrtPlayer *) puser; + + pPlayer->onVideo(pdata, len, ts); + return 0; +} + +/***************************************************************************************/ + +CSrtPlayer::CSrtPlayer(): CVideoPlayer() +, m_port(-1) +{ + memset(m_ip, 0, sizeof(m_ip)); +} + +CSrtPlayer::~CSrtPlayer() +{ + close(); +} +std::string CSrtPlayer::createNewSRTUrl(const std::string& username, + const std::string& password, + const std::string& url) { + // Copy the original strings to avoid modifying the originals + std::string modUsername = username; + std::string modPassword = password; + + // Replace '@' with '_' in username and password + std::replace(modUsername.begin(), modUsername.end(), '@', '_'); + std::replace(modPassword.begin(), modPassword.end(), '@', '_'); + + // Extract the protocol and rest of the URL + size_t protocolEndPos = url.find("://") + 3; // Find the position right after "://" + std::string protocol = url.substr(0, protocolEndPos); // Include "://" + + // Construct the new URL with modified credentials + std::string newUrl = protocol; + newUrl += modUsername + ":" + modPassword + "@"; + newUrl += url.substr(protocolEndPos); + return newUrl; +} + +BOOL CSrtPlayer::open(std::string fileName) +{ + close(); + + CVideoPlayer::open(fileName); + + int port; + char proto[32], username[100], password[100], host[100], path[200]; + + url_split(fileName.c_str(), proto, sizeof(proto), username, sizeof(username), + password, sizeof(password), host, sizeof(host), &port, path, sizeof(path)); + + if (host[0] == '\0') + { + return FALSE; + } + + if (port <= 0) + { + return FALSE; + } + + if (username[0] != '\0') + { + m_acct = username; + } + + if (password[0] != '\0') + { + m_pass = password; + } + + strncpy(m_ip, host, sizeof(m_ip) - 1); + + m_port = port; + + m_srt.set_notify_cb(srt_notify_callback, this); + m_srt.set_audio_cb(srt_audio_callback); + m_srt.set_video_cb(srt_video_callback); + + return TRUE; +} + +BOOL CSrtPlayer::open(std::string _username, std::string _password, std::string _url) +{ + close(); + + CVideoPlayer::open(_username, _password, _url); + + int port; + char proto[32], username[100], password[100], host[100], path[200]; + std::string fileName = createNewSRTUrl(_username, _password, _url); + + url_split(fileName.c_str(), proto, sizeof(proto), username, sizeof(username), + password, sizeof(password), host, sizeof(host), &port, path, sizeof(path)); + + if (host[0] == '\0') + { + return FALSE; + } + + if (port <= 0) + { + return FALSE; + } + + + strncpy(m_ip, host, sizeof(m_ip) - 1); + + m_port = port; + + m_srt.set_notify_cb(srt_notify_callback, this); + m_srt.set_audio_cb(srt_audio_callback); + m_srt.set_video_cb(srt_video_callback); + + return TRUE; +} +void CSrtPlayer::close() +{ + // stop connection + m_srt.srt_stop(); + m_srt.srt_close(); + + m_bPlaying = FALSE; + m_bPaused = FALSE; + CVideoPlayer::StopVideoDecoder(); + m_port = -1; + + memset(m_ip, 0, sizeof(m_ip)); + + CVideoPlayer::close(); +} + +BOOL CSrtPlayer::play() +{ + if (m_srt.srt_start(m_sFileName.c_str(), m_acct.c_str(), m_pass.c_str())) + { + m_bPlaying = TRUE; + m_bPaused = FALSE; + } + CVideoPlayer::StartVideoDecoder();// Start the video decoder + return m_bPlaying; +} + +void CSrtPlayer::stop() +{ + if (m_bPlaying || m_bPaused) + { + m_srt.srt_stop(); + } + + // Set flags BEFORE stopping decoder so rx thread stops calling decode() + m_bPlaying = FALSE; + m_bPaused = FALSE; + CVideoPlayer::StopVideoDecoder(); // Stop the video decoder +} + +BOOL CSrtPlayer::pause() +{ + if (m_bPlaying) + { + if (m_srt.srt_pause()) + { + m_bPaused = TRUE; + m_bPlaying = FALSE; + } + } + else if (m_bPaused) + { + if (m_srt.srt_play()) + { + m_bPaused = FALSE; + m_bPlaying = TRUE; + } + } + + CVideoPlayer::StopVideoDecoder(); // Stop the video decoder + return m_bPaused; +} + +BOOL CSrtPlayer::seek(int pos) +{ + if (pos < 0 || pos > 100) + { + return FALSE; + } + + int64 duration = getDuration(); + if (duration <= 0) + { + return FALSE; + } + + int ntp_pos = duration / 100 * pos; + + // m_srt.srt_play(); + + return TRUE; +} + +int64 CSrtPlayer::getElapse() +{ + return 0; +} + +int64 CSrtPlayer::getDuration() +{ + return 0; +} + +int CSrtPlayer::getVideoClock() +{ + return 90000; +} + +int CSrtPlayer::getAudioClock() +{ + return 90000; +} + +int CSrtPlayer::getVideoCodec() +{ + return m_srt.video_codec(); +} + +int CSrtPlayer::getAudioCodec() +{ + return m_srt.audio_codec(); +} + +void CSrtPlayer::onNotify(int evt) +{ + if (evt == SRT_EVE_VIDEOREADY) + { + int videoCodec = m_srt.video_codec(); + + if (VIDEO_CODEC_NONE != videoCodec) + { + openVideo(videoCodec); + } + } + else if (evt == SRT_EVE_AUDIOREADY) + { + int audioCodec = m_srt.audio_codec(); + + if (AUDIO_CODEC_NONE != audioCodec) + { + openAudio(audioCodec, m_srt.get_audio_samplerate(), m_srt.get_audio_channels()); + } + } +} + +void CSrtPlayer::onAudio(uint8 * pdata, int len, uint32 ts) +{ + playAudio(pdata, len, ts, 0); +} + +void CSrtPlayer::onVideo(uint8 * pdata, int len, uint32 ts) +{ + playVideo(pdata, len, ts, 0); +} + +void CSrtPlayer::setBbox(cv::Rect bbox) { + CVideoPlayer::setBbox(bbox); +} +void CSrtPlayer::setCrop(bool crop) { + CVideoPlayer::setCrop(crop); +} + +BOOL CSrtPlayer::onRecord() +{ + CSrtClient * p_srt = &m_srt; + AVICTX * p_avictx = m_pAviCtx; + + int vcodec = p_srt->video_codec(); + int v_extra_len = 0; + uint8 v_extra[1024]; + + if (VIDEO_CODEC_H264 == vcodec) + { + avi_set_video_info(p_avictx, 0, 0, 0, "H264"); + + uint8 sps[512], pps[512]; + int sps_len = 0, pps_len = 0; + + if (p_srt->get_h264_params(sps, &sps_len, pps, &pps_len)) + { + memcpy(v_extra, sps, sps_len); + memcpy(v_extra + sps_len, pps, pps_len); + + v_extra_len = sps_len + pps_len; + } + + if (v_extra_len > 0) + { + avi_set_video_extra_info(p_avictx, v_extra, v_extra_len); + } + } + else if (VIDEO_CODEC_H265 == vcodec) + { + avi_set_video_info(p_avictx, 0, 0, 0, "H265"); + + uint8 vps[512], sps[512], pps[512]; + int vps_len = 0, sps_len = 0, pps_len = 0; + + if (p_srt->get_h265_params(sps, &sps_len, pps, &pps_len, vps, &vps_len)) + { + memcpy(v_extra, vps, vps_len); + memcpy(v_extra + vps_len, sps, sps_len); + memcpy(v_extra + vps_len + sps_len, pps, pps_len); + + v_extra_len = vps_len + sps_len + pps_len; + } + + if (v_extra_len > 0) + { + avi_set_video_extra_info(p_avictx, v_extra, v_extra_len); + } + } + else if (VIDEO_CODEC_JPEG == vcodec) + { + avi_set_video_info(p_avictx, 0, 0, 0, "JPEG"); + } + else if (VIDEO_CODEC_MP4 == vcodec) + { + avi_set_video_info(p_avictx, 0, 0, 0, "MP4V"); + } + + int acodec = p_srt->audio_codec(); + int sr = p_srt->get_audio_samplerate(); + int ch = p_srt->get_audio_channels(); + + if (AUDIO_CODEC_G711A == acodec) + { + avi_set_audio_info(p_avictx, ch, sr, AUDIO_FORMAT_ALAW); + } + else if (AUDIO_CODEC_G711U == acodec) + { + avi_set_audio_info(p_avictx, ch, sr, AUDIO_FORMAT_MULAW); + } + else if (AUDIO_CODEC_G726 == acodec) + { + avi_set_audio_info(p_avictx, ch, sr, AUDIO_FORMAT_G726); + } + else if (AUDIO_CODEC_G722 == acodec) + { + avi_set_audio_info(p_avictx, ch, sr, AUDIO_FORMAT_G722); + } + else if (AUDIO_CODEC_AAC == acodec) + { + avi_set_audio_info(p_avictx, ch, sr, AUDIO_FORMAT_AAC); + avi_set_audio_extra_info(p_avictx, p_srt->get_audio_config(), p_srt->get_audio_config_len()); + } + + avi_update_header(p_avictx); + + if (p_avictx->ctxf_video) + { + if (v_extra_len > 0) + { + recordVideo(v_extra, v_extra_len, 0, 0); + } + } + + return TRUE; +} + + + + diff --git a/MediaClient/MediaClient/media/srt_player.h b/MediaClient/MediaClient/media/srt_player.h new file mode 100644 index 0000000..336cb31 --- /dev/null +++ b/MediaClient/MediaClient/media/srt_player.h @@ -0,0 +1,66 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef SRT_PLAYER_H +#define SRT_PLAYER_H + +#include "video_player.h" +#include "srt_cln.h" + + +class CSrtPlayer : public CVideoPlayer +{ + +public: + CSrtPlayer(); + virtual ~CSrtPlayer(); + + BOOL open(std::string fileName); + BOOL open(std::string _username, std::string _password, std::string _url); + void close(); + BOOL play(); + void stop(); + BOOL pause(); + BOOL seek(int pos); + int64 getElapse(); + int64 getDuration(); + int getVideoClock(); + int getAudioClock(); + int getVideoCodec(); + int getAudioCodec(); + void setBbox(cv::Rect bbox); + void setCrop(bool crop); + void onNotify(int evt); + void onAudio(uint8 * pdata, int len, uint32 ts); + void onVideo(uint8 * pdata, int len, uint32 ts); + BOOL onRecord(); + +private: + char m_ip[32]; + int m_port; + CSrtClient m_srt; + std::string createNewSRTUrl(const std::string& username, + const std::string& password, + const std::string& url); +}; + +#endif + + + diff --git a/MediaClient/MediaClient/media/video_decoder.cpp b/MediaClient/MediaClient/media/video_decoder.cpp new file mode 100644 index 0000000..ce3dc07 --- /dev/null +++ b/MediaClient/MediaClient/media/video_decoder.cpp @@ -0,0 +1,989 @@ + +#include "video_decoder.h" +#include "avcodec_mutex.h" +#include "lock.h" +#include "media_codec.h" +#include "media_parse.h" +#include + +uint32 g_hw_decoder_nums = 0; +uint32 g_hw_decoder_max = 4; // Hardware decoding resources are limited, Limit up to 4 hardware decoding sessions +void* g_hw_decoder_mutex = sys_os_create_mutex(); + +// --------------------------------------------------------------------------- +// HWDecoderPool implementation +// --------------------------------------------------------------------------- +HWDecoderPool& HWDecoderPool::instance() { + static HWDecoderPool pool; + return pool; +} + +void HWDecoderPool::configure(int numGpus, int maxPerGpu) { + // Uniform limit: same max for all GPUs + std::vector limits(numGpus, maxPerGpu); + configure(limits); +} + +void HWDecoderPool::configure(const std::vector& maxPerGpuList) { + std::lock_guard lock(m_mutex); + m_maxPerGpu = maxPerGpuList; + m_activePerGpu.assign(maxPerGpuList.size(), 0); + m_configured = true; + // Also update legacy global for backward compatibility + int total = 0; + for (int m : m_maxPerGpu) total += m; + g_hw_decoder_max = static_cast(total); + for (int i = 0; i < static_cast(m_maxPerGpu.size()); ++i) { + fprintf(stderr, "[HWDecode] HWDecoderPool: GPU[%d] max=%d sessions\n", i, m_maxPerGpu[i]); + } + fprintf(stderr, "[HWDecode] HWDecoderPool: configured %d GPU(s), %d total sessions\n", + static_cast(m_maxPerGpu.size()), total); +} + +bool HWDecoderPool::isConfigured() const { + return m_configured; +} + +int HWDecoderPool::acquireSlot(int preferredGpu) { + std::lock_guard lock(m_mutex); + if (!m_configured || m_activePerGpu.empty()) return -1; + + // If caller requested a specific GPU (e.g. to match inference GPU for NV12 zero-copy), + // try that GPU first. This avoids cross-GPU device pointer access which causes + // "illegal memory access" sticky CUDA errors. + if (preferredGpu >= 0 && preferredGpu < static_cast(m_activePerGpu.size())) { + if (m_activePerGpu[preferredGpu] < m_maxPerGpu[preferredGpu]) { + m_activePerGpu[preferredGpu]++; + fprintf(stderr, "[HWDecode] HWDecoderPool: acquired slot on PREFERRED GPU[%d] (%d/%d)\n", + preferredGpu, m_activePerGpu[preferredGpu], m_maxPerGpu[preferredGpu]); + return preferredGpu; + } + fprintf(stderr, "[HWDecode] HWDecoderPool: preferred GPU[%d] at capacity (%d/%d), falling back to least-loaded\n", + preferredGpu, m_activePerGpu[preferredGpu], m_maxPerGpu[preferredGpu]); + } + + // Fallback: find the GPU with the fewest active sessions that still has capacity + int bestGpu = -1; + int bestCount = INT_MAX; + for (int i = 0; i < static_cast(m_activePerGpu.size()); ++i) { + if (m_activePerGpu[i] < m_maxPerGpu[i] && m_activePerGpu[i] < bestCount) { + bestCount = m_activePerGpu[i]; + bestGpu = i; + } + } + + if (bestGpu >= 0) { + m_activePerGpu[bestGpu]++; + fprintf(stderr, "[HWDecode] HWDecoderPool: acquired slot on GPU[%d] (%d/%d)\n", + bestGpu, m_activePerGpu[bestGpu], m_maxPerGpu[bestGpu]); + } + return bestGpu; +} + +void HWDecoderPool::releaseSlot(int gpuIndex) { + std::lock_guard lock(m_mutex); + if (!m_configured) return; + if (gpuIndex >= 0 && gpuIndex < static_cast(m_activePerGpu.size())) { + if (m_activePerGpu[gpuIndex] > 0) { + m_activePerGpu[gpuIndex]--; + fprintf(stderr, "[HWDecode] HWDecoderPool: released slot on GPU[%d] (%d/%d)\n", + gpuIndex, m_activePerGpu[gpuIndex], m_maxPerGpu[gpuIndex]); + } + } +} + +int HWDecoderPool::getTotalMax() const { + int total = 0; + for (int m : m_maxPerGpu) total += m; + return total; +} + +int HWDecoderPool::getTotalActive() const { + int total = 0; + for (int c : m_activePerGpu) total += c; + return total; +} + +// --------------------------------------------------------------------------- +// SharedHWDeviceCtx implementation +// --------------------------------------------------------------------------- +SharedHWDeviceCtx& SharedHWDeviceCtx::instance() { + static SharedHWDeviceCtx inst; + return inst; +} + +SharedHWDeviceCtx::~SharedHWDeviceCtx() { + // Intentionally empty — do NOT release GPU/D3D11 resources here. + // This destructor runs during DLL_PROCESS_DETACH while the OS loader + // lock is held. Releasing D3D11/NVIDIA resources requires driver + // worker threads that also need the loader lock → deadlock. + // The OS reclaims all GPU resources when the process exits. +} + +AVBufferRef* SharedHWDeviceCtx::acquire(int gpuIndex, AVHWDeviceType type) { + std::lock_guard lock(m_mutex); + + // Grow cache if needed + if (gpuIndex < 0) gpuIndex = 0; + if (static_cast(m_cache.size()) <= gpuIndex) { + m_cache.resize(gpuIndex + 1); + } + + GpuCtx& slot = m_cache[gpuIndex]; + + // If already created for this GPU and same type, return a new reference + if (slot.ctx && slot.type == type) { + fprintf(stderr, "[HWDecode] SharedHWDeviceCtx: reusing shared context for GPU[%d]\n", gpuIndex); + return av_buffer_ref(slot.ctx); + } + + // Release old context if type changed + if (slot.ctx) { + av_buffer_unref(&slot.ctx); + slot.ctx = nullptr; + } + + // Create new HW device context for this GPU + char adapterStr[16] = {}; + snprintf(adapterStr, sizeof(adapterStr), "%d", gpuIndex); + + int err = av_hwdevice_ctx_create(&slot.ctx, type, adapterStr, nullptr, 0); + if (err < 0) { + char error_buf[AV_ERROR_MAX_STRING_SIZE]; + av_strerror(err, error_buf, sizeof(error_buf)); + fprintf(stderr, "[HWDecode] SharedHWDeviceCtx: FAILED to create context for GPU[%d]: %s\n", + gpuIndex, error_buf); + slot.ctx = nullptr; + return nullptr; + } + + slot.type = type; + fprintf(stderr, "[HWDecode] SharedHWDeviceCtx: created shared context for GPU[%d] type=%s\n", + gpuIndex, av_hwdevice_get_type_name(type)); + + // Return a new reference (caller owns it) + return av_buffer_ref(slot.ctx); +} + +void SharedHWDeviceCtx::releaseAll() { + std::lock_guard lock(m_mutex); + for (auto& slot : m_cache) { + if (slot.ctx) { + av_buffer_unref(&slot.ctx); + slot.ctx = nullptr; + } + } + m_cache.clear(); +} + +enum AVPixelFormat getHWFormat(AVCodecContext* ctx, const enum AVPixelFormat* pix_fmts) +{ + CVideoDecoder* pthis = (CVideoDecoder*)ctx->opaque; + + AVPixelFormat dst_pix_fmt = AV_PIX_FMT_NONE; + + pthis->getHWFormat(ctx, pix_fmts, &dst_pix_fmt); + + return dst_pix_fmt; +} + +enum AVPixelFormat get_hw_format(AVCodecContext* ctx, const enum AVPixelFormat* pix_fmts) +{ + for (const enum AVPixelFormat* p = pix_fmts; *p != -1; p++) { + if (*p == AV_PIX_FMT_YUVJ420P) { + return AV_PIX_FMT_YUVJ420P; + } + } + // If YUVJ420P is not available, fall back to default + return ctx->pix_fmt; +} + +CVideoDecoder::CVideoDecoder() +{ + m_bInited = FALSE; + m_bRunning = FALSE; + m_bHardwareDecoderEnabled = FALSE; + m_bCudaHWAccel = false; + m_hwGpuIndex = -1; + + m_pCodec = NULL; + m_pContext = NULL; + m_pFrame = NULL; + m_pSoftFrame = NULL; + m_pCudaHWFrame = NULL; + + m_pCallback = NULL; + m_pUserdata = NULL; + + m_hwPixFmt = AV_PIX_FMT_NONE; + m_pHWDeviceCtx = NULL; +} + +AVFrame* CVideoDecoder::takeCudaHWFrame() { + std::lock_guard lock(_mutex); + AVFrame* result = m_pCudaHWFrame; + m_pCudaHWFrame = nullptr; + return result; +} + +AVFrame* CVideoDecoder::cloneCudaHWFrame_unlocked() { + // Caller MUST already hold _mutex (called from decode thread's callback chain). + // Returns a clone so the original m_pCudaHWFrame stays valid for the decode loop. + return m_pCudaHWFrame ? av_frame_clone(m_pCudaHWFrame) : nullptr; +} + +CVideoDecoder::~CVideoDecoder() +{ + uninit(); +} + +void CVideoDecoder::uninit() +{ + std::lock_guard lock(_mutex); + + // Stop processing first + // Backup first + BOOL wasRunning = m_bRunning; + m_bRunning = FALSE; + + flush(); + + // FIXED: Clean up frames before context to avoid use-after-free + if (m_pFrame) + { + av_frame_free(&m_pFrame); + m_pFrame = NULL; + } + + if (m_pSoftFrame) + { + av_frame_free(&m_pSoftFrame); + m_pSoftFrame = NULL; + } + + if (m_pCudaHWFrame) + { + av_frame_free(&m_pCudaHWFrame); + m_pCudaHWFrame = NULL; + } + + if (m_pContext) + { + // FIXED: Free extradata before freeing context + if (m_pContext->extradata) { + av_free(m_pContext->extradata); + m_pContext->extradata = NULL; + m_pContext->extradata_size = 0; + } + + // FIXED: Properly release hardware context reference + if (m_pContext->hw_device_ctx) { + av_buffer_unref(&m_pContext->hw_device_ctx); + m_pContext->hw_device_ctx = NULL; + } + + // FIXED: Close codec before freeing context + avcodec_close(m_pContext); + avcodec_free_context(&m_pContext); + m_pContext = NULL; + } + + // Only decrement hardware decoder count if it was actually enabled + if (m_pHWDeviceCtx && m_bHardwareDecoderEnabled) + { + av_buffer_unref(&m_pHWDeviceCtx); + m_pHWDeviceCtx = NULL; + + // Release via per-GPU pool or legacy global counter + HWDecoderPool& pool = HWDecoderPool::instance(); + if (pool.isConfigured() && m_hwGpuIndex >= 0) { + pool.releaseSlot(m_hwGpuIndex); + } else { + CLock hw_lock(g_hw_decoder_mutex); + if (g_hw_decoder_nums > 0) { + g_hw_decoder_nums--; + } + } + m_hwGpuIndex = -1; + m_bHardwareDecoderEnabled = FALSE; + } + // Restore running state if needed + m_bRunning = wasRunning; + m_pCodec = NULL; + m_bInited = FALSE; +} + +BOOL CVideoDecoder::init(enum AVCodecID codec, uint8* extradata, int extradata_size, int hwMode, int preferredGpu) +{ + std::lock_guard lock(_mutex); + + // Clean up any existing state + if (m_bInited) { + uninit(); + } + + int width = 0; + int height = 0; + + if (extradata && extradata_size > 0) + { + int vcodec = VIDEO_CODEC_NONE; + + if (AV_CODEC_ID_H264 == codec) + { + vcodec = VIDEO_CODEC_H264; + } + else if (AV_CODEC_ID_HEVC == codec) + { + vcodec = VIDEO_CODEC_H265; + } + else if (AV_CODEC_ID_MJPEG == codec) + { + vcodec = VIDEO_CODEC_JPEG; + } + else if (AV_CODEC_ID_MPEG4 == codec) + { + vcodec = VIDEO_CODEC_MP4; + } + + avc_parse_video_size(vcodec, extradata, extradata_size, &width, &height); + } + +#ifdef ANDROID + if (HW_DECODING_DISABLE != hwMode && width * height >= 320 * 240) + { + if (AV_CODEC_ID_H264 == codec) + { + m_pCodec = avcodec_find_decoder_by_name("h264_mediacodec"); + } + else if (AV_CODEC_ID_HEVC == codec) + { + m_pCodec = avcodec_find_decoder_by_name("hevc_mediacodec"); + } + else if (AV_CODEC_ID_MPEG4 == codec) + { + m_pCodec = avcodec_find_decoder_by_name("mpeg4_mediacodec"); + } + } + + if (NULL == m_pCodec) + { + m_pCodec = avcodec_find_decoder(codec); + } +#else + m_pCodec = avcodec_find_decoder(codec); +#endif + + if (NULL == m_pCodec) + { + log_print(HT_LOG_ERR, "%s, m_pCodec is NULL for codec %d\r\n", __FUNCTION__, codec); + return FALSE; + } + + m_pContext = avcodec_alloc_context3(m_pCodec); + if (NULL == m_pContext) + { + log_print(HT_LOG_ERR, "%s, avcodec_alloc_context3 failed\r\n", __FUNCTION__); + return FALSE; + } + + m_pContext->width = width; + m_pContext->height = height; + + m_pContext->flags |= AV_CODEC_FLAG_LOW_DELAY; + m_pContext->flags2 |= AV_CODEC_FLAG2_FAST; + m_pContext->flags |= AV_CODEC_FLAG_OUTPUT_CORRUPT; + m_pContext->err_recognition = AV_EF_IGNORE_ERR; + + av_opt_set_int(m_pContext, "refcounted_frames", 1, 0); + + // Initialize hardware decoder + if (HW_DECODING_DISABLE != hwMode) { + int hw_ret = hwDecoderInit(m_pContext, hwMode, preferredGpu); + if (hw_ret < 0) { + log_print(HT_LOG_WARN, "%s, hwDecoderInit failed with error %d, falling back to software decoding\r\n", __FUNCTION__, hw_ret); + } + } + + // Handle extradata + if (extradata && extradata_size > 0) + { + int size = extradata_size + AV_INPUT_BUFFER_PADDING_SIZE; + + m_pContext->extradata = (uint8*)av_mallocz(size); + if (m_pContext->extradata) + { + m_pContext->extradata_size = extradata_size; + memcpy(m_pContext->extradata, extradata, extradata_size); + } + else + { + log_print(HT_LOG_ERR, "%s, Failed to allocate extradata\r\n", __FUNCTION__); + uninit(); // FIXED: Clean up on failure + return FALSE; + } + } + + // FIXED: Use avcodec_open2 instead of avcodec_thread_open + if (avcodec_open2(m_pContext, m_pCodec, NULL) < 0) + { + log_print(HT_LOG_ERR, "%s, avcodec_open2 failed\r\n", __FUNCTION__); + uninit(); // FIXED: Clean up on failure + return FALSE; + } + + m_pFrame = av_frame_alloc(); + if (NULL == m_pFrame) + { + log_print(HT_LOG_ERR, "%s, av_frame_alloc failed for m_pFrame\r\n", __FUNCTION__); + uninit(); // FIXED: Clean up on failure + return FALSE; + } + + m_pSoftFrame = av_frame_alloc(); + if (NULL == m_pSoftFrame) + { + log_print(HT_LOG_ERR, "%s, av_frame_alloc failed for m_pSoftFrame\r\n", __FUNCTION__); + uninit(); // FIXED: Clean up on failure + return FALSE; + } + + m_bInited = TRUE; + //m_bRunning = TRUE; + return TRUE; +} + +BOOL CVideoDecoder::init(int codec, uint8* extradata, int extradata_size, int hwMode, int preferredGpu) +{ + BOOL result = init(to_video_avcodecid(codec), extradata, extradata_size, hwMode, preferredGpu); + if (result) { + m_bRunning = TRUE; // Set running only if initialization succeeded + } + return result; +} + +int CVideoDecoder::hwDecoderInit(AVCodecContext* ctx, int hwMode, int preferredGpu) { + int err = 0; + std::string hwtype; + enum AVHWDeviceType type = AV_HWDEVICE_TYPE_NONE; + + if (hwMode == HW_DECODING_DISABLE) { + return 0; // Hardware decoding is disabled + } + + // -- Per-GPU pool path (preferred) or legacy global path ---------------- + int assignedGpu = -1; + HWDecoderPool& pool = HWDecoderPool::instance(); + + if (pool.isConfigured()) { + // Per-GPU: acquire a slot, preferring the caller's requested GPU + // (e.g. inference GPU for NV12 zero-copy alignment) + assignedGpu = pool.acquireSlot(preferredGpu); + if (assignedGpu < 0) { + log_print(HT_LOG_WARN, "%s, All GPU HW decoder slots full (%d/%d total)\r\n", + __FUNCTION__, pool.getTotalActive(), pool.getTotalMax()); + return -1; + } + } else { + // Legacy: single global counter + CLock lock(g_hw_decoder_mutex); + if (g_hw_decoder_max > 0 && g_hw_decoder_nums >= g_hw_decoder_max) { + log_print(HT_LOG_WARN, "%s, Maximum number of hardware decoders reached (%d/%d)\r\n", + __FUNCTION__, g_hw_decoder_nums, g_hw_decoder_max); + return -1; + } + } + + // Determine the hardware type based on platform and hardware mode + if (!getHardwareTypeForPlatform(hwMode, hwtype)) { + log_print(HT_LOG_WARN, "%s, Unsupported hardware mode %d for the current platform\r\n", __FUNCTION__, hwMode); + if (assignedGpu >= 0) pool.releaseSlot(assignedGpu); + return -1; + } + + // Find the hardware device type by name + type = av_hwdevice_find_type_by_name(hwtype.c_str()); + if (type == AV_HWDEVICE_TYPE_NONE) { + log_print(HT_LOG_WARN, "%s, Hardware device type %s is not supported\r\n", __FUNCTION__, hwtype.c_str()); + logSupportedHwTypes(); + if (assignedGpu >= 0) pool.releaseSlot(assignedGpu); + return -1; + } + + // Find a hardware configuration that supports the specified device type + if (!findHwConfigForDeviceType(type)) { + log_print(HT_LOG_WARN, "%s, Decoder %s does not support the specified hardware device type %s\r\n", + __FUNCTION__, m_pCodec->long_name, av_hwdevice_get_type_name(type)); + if (assignedGpu >= 0) pool.releaseSlot(assignedGpu); + return -1; + } + + // Get or create a shared HW device context for this GPU. + // NVIDIA recommends sharing CUDA contexts across decode sessions to minimize + // GPU memory overhead (each CUDA context costs ~50-100MB). + // See: NVDEC Video Decoder API Programming Guide, Section "Multi-session decoding" + int gpuIdx = (assignedGpu >= 0) ? assignedGpu : 0; + m_pHWDeviceCtx = SharedHWDeviceCtx::instance().acquire(gpuIdx, type); + if (!m_pHWDeviceCtx) { + log_print(HT_LOG_ERR, "%s, Failed to acquire shared HW device context, type=%s, gpu=%d\r\n", + __FUNCTION__, av_hwdevice_get_type_name(type), gpuIdx); + if (assignedGpu >= 0) pool.releaseSlot(assignedGpu); + return -1; + } + + // Configure the codec context to use the shared hardware device + ctx->opaque = this; + ctx->get_format = ::getHWFormat; + ctx->hw_device_ctx = av_buffer_ref(m_pHWDeviceCtx); + ctx->err_recognition = AV_EF_IGNORE_ERR; + ctx->flags2 |= AV_CODEC_FLAG2_EXPORT_MVS; + + // Reserve extra NVDEC surfaces for application-held av_frame_clone() references. + // The clone chain (decoder → player → registry) holds ~2 surfaces simultaneously + // (decoder's clone + registry's clone; getCudaHWFrame uses ownership transfer). + // Without this, the default pool (num_decode_surfaces + 2) can run out under + // load with many concurrent streams, causing the decoder to stall. + ctx->extra_hw_frames = 2; + + // Track which GPU this decoder is on + m_hwGpuIndex = assignedGpu; + m_bHardwareDecoderEnabled = TRUE; + m_bCudaHWAccel = (type == AV_HWDEVICE_TYPE_CUDA); + + // Legacy counter (for backward compatibility) + if (!pool.isConfigured()) { + CLock lock(g_hw_decoder_mutex); + g_hw_decoder_nums++; + } + + log_print(HT_LOG_INFO, "%s, Successfully initialized hardware decoder %s on GPU[%d] (%d/%d)\r\n", + __FUNCTION__, av_hwdevice_get_type_name(type), + gpuIdx, + pool.isConfigured() ? pool.getTotalActive() : g_hw_decoder_nums, + pool.isConfigured() ? pool.getTotalMax() : g_hw_decoder_max); + + return 0; +} + +void CVideoDecoder::Start() { + std::lock_guard lock(_mutex); + if (m_pContext) { + avcodec_flush_buffers(m_pContext); + } + m_bRunning = TRUE; + log_print(HT_LOG_INFO, "%s, Video decoder started\r\n", __FUNCTION__); +} + +void CVideoDecoder::Stop() { + std::lock_guard lock(_mutex); + m_bRunning = FALSE; + log_print(HT_LOG_INFO, "%s, Video decoder stopped\r\n", __FUNCTION__); +} + +// Log all supported hardware types +void CVideoDecoder::logSupportedHwTypes() { + enum AVHWDeviceType type = AV_HWDEVICE_TYPE_NONE; + log_print(HT_LOG_INFO, "%s, Available hardware device types:\r\n", __FUNCTION__); + while ((type = av_hwdevice_iterate_types(type)) != AV_HWDEVICE_TYPE_NONE) { + log_print(HT_LOG_INFO, "%s, - %s\r\n", __FUNCTION__, av_hwdevice_get_type_name(type)); + } +} + +// Platform-specific function to determine the hardware type based on the mode +bool CVideoDecoder::getHardwareTypeForPlatform(int hwMode, std::string& hwtype) { +#if __WINDOWS_OS__ + switch (hwMode) { + case HW_DECODING_D3D11: hwtype = "d3d11va"; break; + case HW_DECODING_DXVA: hwtype = "dxva2"; break; + case HW_DECODING_CUDA: hwtype = "cuda"; break; + case HW_DECODING_AUTO: + hwtype = "cuda"; + if (av_hwdevice_find_type_by_name(hwtype.c_str()) == AV_HWDEVICE_TYPE_NONE) { + hwtype = "d3d11va"; + if (av_hwdevice_find_type_by_name(hwtype.c_str()) == AV_HWDEVICE_TYPE_NONE) { + hwtype = "dxva2"; + } + } + break; + default: return false; + } +#elif defined(IOS) + switch (hwMode) { + case HW_DECODING_VIDEOTOOLBOX: hwtype = "videotoolbox"; break; + case HW_DECODING_OPENCL: hwtype = "opencl"; break; + case HW_DECODING_AUTO: + hwtype = "videotoolbox"; + if (av_hwdevice_find_type_by_name(hwtype.c_str()) == AV_HWDEVICE_TYPE_NONE) { + hwtype = "opencl"; + } + break; + default: return false; + } +#elif defined(ANDROID) + if (hwMode == HW_DECODING_MEDIACODEC || hwMode == HW_DECODING_AUTO) { + hwtype = "mediacodec"; + } + else { + return false; + } +#elif __LINUX_OS__ + switch (hwMode) { + case HW_DECODING_VAAPI: hwtype = "vaapi"; break; + case HW_DECODING_OPENCL: hwtype = "opencl"; break; + case HW_DECODING_AUTO: + hwtype = "vaapi"; + if (av_hwdevice_find_type_by_name(hwtype.c_str()) == AV_HWDEVICE_TYPE_NONE) { + hwtype = "opencl"; + } + break; + default: return false; + } +#else + return false; // Unsupported platform +#endif + return true; +} + +// Find a hardware configuration that matches the specified device type +bool CVideoDecoder::findHwConfigForDeviceType(AVHWDeviceType type) { + for (int i = 0;; i++) { + const AVCodecHWConfig* config = avcodec_get_hw_config(m_pCodec, i); + if (!config) { + return false; // No matching hardware configuration found + } + if (config->methods & AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX && config->device_type == type) { + m_hwPixFmt = config->pix_fmt; + return true; + } + } +} + +BOOL CVideoDecoder::getHWFormat(AVCodecContext* ctx, const AVPixelFormat* pix_fmts, AVPixelFormat* dst) +{ + const AVPixelFormat* p; + *dst = AV_PIX_FMT_NONE; + + // First, attempt to use hardware pixel format if available + for (p = pix_fmts; *p != -1; p++) + { + if (*p == m_hwPixFmt) + { + *dst = *p; + return TRUE; + } + } + + // If hardware format is not supported, fall back to YUVJ420P + for (p = pix_fmts; *p != -1; p++) + { + if (*p == AV_PIX_FMT_YUVJ420P || + *p == AV_PIX_FMT_YUVJ422P || + *p == AV_PIX_FMT_YUVJ444P) + { + *dst = *p; + return TRUE; + } + } + + // As a last resort, use other formats (YUV420P) + for (p = pix_fmts; *p != -1; p++) + { + if (*p == AV_PIX_FMT_YUV420P || + *p == AV_PIX_FMT_YUV422P || + *p == AV_PIX_FMT_YUV444P) + { + *dst = *p; + return TRUE; + } + } + + if (*pix_fmts != -1) + { + *dst = *pix_fmts; + return TRUE; + } + + log_print(HT_LOG_ERR, "%s, Failed to get HW surface format\r\n", __FUNCTION__); + + return FALSE; +} + +int CVideoDecoder::getWidth() +{ + std::lock_guard lock(_mutex); + if (m_pContext) + { + return m_pContext->width; + } + return 0; +} + +int CVideoDecoder::getHeight() +{ + std::lock_guard lock(_mutex); + if (m_pContext) + { + return m_pContext->height; + } + return 0; +} + +double CVideoDecoder::getFrameRate() +{ + std::lock_guard lock(_mutex); + if (m_pContext) + { + if (m_pContext->framerate.den > 0) + { + return (double)((double)(m_pContext->framerate.num) / m_pContext->framerate.den); + } + } + return 0; +} + +BOOL CVideoDecoder::decode(AVPacket* pkt) +{ + std::lock_guard lock(_mutex); + + if (!m_bInited) + { + log_print(HT_LOG_ERR, "%s, Decoder not initialized\r\n", __FUNCTION__); + return FALSE; + } + + if (!m_bRunning) + { + log_print(HT_LOG_WARN, "%s, Decoder not running\r\n", __FUNCTION__); + return FALSE; + } + + if (!m_pContext) { + log_print(HT_LOG_ERR, "%s, Context is NULL\r\n", __FUNCTION__); + return FALSE; + } + + int ret; + int retryCount = 0; + const int maxRetries = 3; + + // Attempt to send packet to decoder + while ((ret = avcodec_send_packet(m_pContext, pkt)) == AVERROR(EAGAIN) && + retryCount < maxRetries) + { + if (!readFrame()) + { + log_print(HT_LOG_ERR, "%s, Failed to read frame during retry %d\r\n", __FUNCTION__, retryCount); + return FALSE; + } + Sleep(1); // Reduced sleep time + retryCount++; + } + + // Check for other errors + if (ret < 0 && ret != AVERROR_EOF) + { + char error_buf[AV_ERROR_MAX_STRING_SIZE]; + av_strerror(ret, error_buf, sizeof(error_buf)); + log_print(HT_LOG_ERR, "%s, avcodec_send_packet failed: %s (ret=%d)\r\n", __FUNCTION__, error_buf, ret); + return FALSE; + } + + // If the packet was successfully sent, proceed to read frame + return readFrame(); +} +BOOL CVideoDecoder::decode(uint8* data, int len, int64_t pts) +{ + std::lock_guard lock(_mutex); + + if (!m_bInited) + { + log_print(HT_LOG_ERR, "%s, Decoder not initialized\r\n", __FUNCTION__); + return FALSE; + } + + if (!m_bRunning) + { + log_print(HT_LOG_WARN, "%s, Decoder not running\r\n", __FUNCTION__); + return FALSE; + } + + if (!data || len <= 0) { + log_print(HT_LOG_ERR, "%s, Invalid input data\r\n", __FUNCTION__); + return FALSE; + } + + // Allocate packet + AVPacket* packet = av_packet_alloc(); + if (!packet) { + log_print(HT_LOG_ERR, "%s, Failed to allocate AVPacket\r\n", __FUNCTION__); + return FALSE; + } + + // FIXED: Use av_new_packet() to properly allocate and manage packet data + int ret = av_new_packet(packet, len); + if (ret < 0) { + char error_buf[AV_ERROR_MAX_STRING_SIZE]; + av_strerror(ret, error_buf, sizeof(error_buf)); + log_print(HT_LOG_ERR, "%s, Failed to allocate packet data: %s\r\n", __FUNCTION__, error_buf); + av_packet_free(&packet); + return FALSE; + } + + // Copy data - av_new_packet() already allocated the buffer with proper padding + memcpy(packet->data, data, len); + + // Set packet timing information + packet->pts = pts; + packet->dts = pts; + + // Call decode function + BOOL result = decode(packet); + + // Clean up - av_packet_free will properly handle the data buffer + av_packet_free(&packet); + + return result; +} + +BOOL CVideoDecoder::readFrame() +{ + int ret = 0; + AVFrame* tmp_frame = NULL; + BOOL frame_processed = FALSE; + + while (ret >= 0) + { + ret = avcodec_receive_frame(m_pContext, m_pFrame); + if (ret == AVERROR(EAGAIN)) { + // Need more input data + return frame_processed ? TRUE : FALSE; + } + else if (ret == AVERROR_EOF) { + // End of stream + return TRUE; + } + else if (ret < 0) { + char error_buf[AV_ERROR_MAX_STRING_SIZE]; + av_strerror(ret, error_buf, sizeof(error_buf)); + log_print(HT_LOG_ERR, "%s, avcodec_receive_frame failed: %s (ret=%d)\r\n", __FUNCTION__, error_buf, ret); + return FALSE; + } + + // Check if we got a valid frame + if (!m_pFrame || m_pFrame->width <= 0 || m_pFrame->height <= 0) { + log_print(HT_LOG_WARN, "%s, Received invalid frame\r\n", __FUNCTION__); + av_frame_unref(m_pFrame); + continue; + } + + if (m_pFrame->format == m_hwPixFmt) + { + // CUDA HW accel: clone the HW frame BEFORE transfer so inference + // can use CUDA device pointers directly (zero-copy, no upload). + if (m_bCudaHWAccel) { + if (m_pCudaHWFrame) av_frame_free(&m_pCudaHWFrame); + m_pCudaHWFrame = av_frame_clone(m_pFrame); + } + + // FIXED: Ensure m_pSoftFrame is properly initialized before transfer + av_frame_unref(m_pSoftFrame); // Clear any previous data + + // Hardware frame - transfer to software (needed for display) + ret = av_hwframe_transfer_data(m_pSoftFrame, m_pFrame, 0); + if (ret < 0) + { + char error_buf[AV_ERROR_MAX_STRING_SIZE]; + av_strerror(ret, error_buf, sizeof(error_buf)); + log_print(HT_LOG_ERR, "%s, Error transferring hardware frame to system memory: %s (ret=%d)\r\n", + __FUNCTION__, error_buf, ret); + av_frame_unref(m_pFrame); + if (m_pCudaHWFrame) av_frame_free(&m_pCudaHWFrame); + continue; + } + + // Copy timing information + m_pSoftFrame->pts = m_pFrame->pts; + m_pSoftFrame->pkt_dts = m_pFrame->pkt_dts; + m_pSoftFrame->best_effort_timestamp = m_pFrame->best_effort_timestamp; + + tmp_frame = m_pSoftFrame; + } + else + { + // Software frame - use directly + tmp_frame = m_pFrame; + } + + // Render the frame + if (tmp_frame) { + render(tmp_frame); + frame_processed = TRUE; + } + + // FIXED: Ensure proper cleanup of frame references + if (tmp_frame == m_pSoftFrame) { + av_frame_unref(m_pSoftFrame); + } + av_frame_unref(m_pFrame); + } + + return TRUE; +} + +int CVideoDecoder::render(AVFrame* frame) +{ + if (!m_bRunning || !frame) + { + return 0; + } + + if (m_pCallback) + { + try { + m_pCallback(frame, m_pUserdata); + } + catch (...) { + log_print(HT_LOG_ERR, "%s, Exception in callback function\r\n", __FUNCTION__); + return 0; + } + } + return 1; +} + +void CVideoDecoder::flush() +{ + std::lock_guard lock(_mutex); + + if (NULL == m_pContext || + NULL == m_pContext->codec || + !(m_pContext->codec->capabilities & AV_CODEC_CAP_DELAY)) + { + return; + } + + log_print(HT_LOG_INFO, "%s, Flushing decoder buffers\r\n", __FUNCTION__); + + // Send NULL packet to flush + avcodec_send_packet(m_pContext, NULL); + + // FIXED: Drain all frames after flushing + while (true) { + int ret = avcodec_receive_frame(m_pContext, m_pFrame); + if (ret == AVERROR_EOF || ret == AVERROR(EAGAIN)) { + break; + } + if (ret < 0) { + char error_buf[AV_ERROR_MAX_STRING_SIZE]; + av_strerror(ret, error_buf, sizeof(error_buf)); + log_print(HT_LOG_WARN, "%s, Error during flush: %s\r\n", __FUNCTION__, error_buf); + break; + } + // Process the frame if needed, or just unref it + av_frame_unref(m_pFrame); + } + + // Also flush the codec buffers + if (m_pContext) { + avcodec_flush_buffers(m_pContext); + } +} diff --git a/MediaClient/MediaClient/media/video_decoder.h b/MediaClient/MediaClient/media/video_decoder.h new file mode 100644 index 0000000..0e894e0 --- /dev/null +++ b/MediaClient/MediaClient/media/video_decoder.h @@ -0,0 +1,172 @@ +#ifndef VIDEO_DECODER_H +#define VIDEO_DECODER_H +#include "sys_inc.h" +#include "media_format.h" +#include +#include +#include +extern "C" +{ +#include "libavcodec/avcodec.h" +#include "libavutil/avutil.h" +#include "libswscale/swscale.h" +#include "libavformat/avformat.h" +#include +} + +#define HW_DECODING_AUTO 0 // automatic select video acceleration hardware +#define HW_DECODING_D3D11 1 // D3D11 video acceleration +#define HW_DECODING_DXVA 2 // DXVA video acceleration +#define HW_DECODING_VAAPI 3 // VAAPI video acceleration +#define HW_DECODING_OPENCL 4 // OPENCL video acceleration +#define HW_DECODING_VIDEOTOOLBOX 5 // VideoToolBox video acceleration +#define HW_DECODING_MEDIACODEC 6 // MediaCodec video acceleration +#define HW_DECODING_CUDA 7 // CUDA/NVDEC — decoded NV12 stays in GPU VRAM +#define HW_DECODING_DISABLE -1 // disable video acceleration + +// Legacy global limit (default: 4). Still works if HWDecoderPool is not configured. +extern uint32 g_hw_decoder_max; + +// --------------------------------------------------------------------------- +// HWDecoderPool -- per-GPU hardware decoder session manager +// +// Tracks active HW decoder sessions per GPU and distributes new sessions +// to the GPU with the fewest active decoders (least-loaded). +// +// Usage: +// // Auto-configure from outside (e.g., ANSRTSP): +// HWDecoderPool::instance().configure(numGpus, maxSessionsPerGpu); +// +// // Or leave unconfigured -- falls back to legacy g_hw_decoder_max behaviour. +// --------------------------------------------------------------------------- +class HWDecoderPool { +public: + static HWDecoderPool& instance(); + + // Configure uniform per-GPU limits. Call once at startup before creating decoders. + void configure(int numGpus, int maxPerGpu); + + // Configure per-GPU limits individually (different GPUs may have different capabilities). + void configure(const std::vector& maxPerGpuList); + + // Is the pool configured with per-GPU tracking? + bool isConfigured() const; + + // Try to acquire a HW decoder slot. Returns the GPU index to use, + // or -1 if all GPUs are at capacity. + // If preferredGpu >= 0, prefer that GPU (e.g. to match inference GPU for zero-copy). + // Falls back to least-loaded if preferred GPU is at capacity. + int acquireSlot(int preferredGpu = -1); + + // Release a HW decoder slot on the given GPU. + void releaseSlot(int gpuIndex); + + // Get total max sessions across all GPUs. + int getTotalMax() const; + + // Get number of active sessions across all GPUs. + int getTotalActive() const; + +private: + HWDecoderPool() = default; + + std::mutex m_mutex; + bool m_configured = false; + std::vector m_maxPerGpu; // max session limit per GPU + std::vector m_activePerGpu; // active session count per GPU +}; + +// --------------------------------------------------------------------------- +// SharedHWDeviceCtx -- per-GPU shared AVHWDeviceContext cache +// +// NVIDIA recommends sharing CUDA contexts across decode sessions to reduce +// GPU memory overhead. This cache creates one AVHWDeviceContext per GPU +// and shares it (via av_buffer_ref) across all decoder sessions on that GPU. +// +// Thread-safe: all methods lock internally. +// --------------------------------------------------------------------------- +class SharedHWDeviceCtx { +public: + static SharedHWDeviceCtx& instance(); + + // Get (or create) a shared HW device context for the given GPU index and device type. + // Returns a new av_buffer_ref to the shared context (caller must av_buffer_unref). + // Returns nullptr on failure. + AVBufferRef* acquire(int gpuIndex, AVHWDeviceType type); + + // Release all cached contexts (call at shutdown). + void releaseAll(); + +private: + SharedHWDeviceCtx() = default; + ~SharedHWDeviceCtx(); + + struct GpuCtx { + AVBufferRef* ctx = nullptr; + AVHWDeviceType type = AV_HWDEVICE_TYPE_NONE; + }; + + std::mutex m_mutex; + std::vector m_cache; +}; + +typedef void (*VDCB)(AVFrame* frame, void* pUserdata); + +class CVideoDecoder +{ +public: + CVideoDecoder(); + ~CVideoDecoder(); +public: + BOOL init(int codec, uint8* extradata = NULL, int extradata_size = 0, int hwMode = HW_DECODING_AUTO, int preferredGpu = -1); + BOOL init(enum AVCodecID codec, uint8* extradata = NULL, int extradata_size = 0, int hwMode = HW_DECODING_AUTO, int preferredGpu = -1); + void uninit(); + int getWidth(); + int getHeight(); + double getFrameRate(); + + BOOL decode(uint8* data, int len, int64_t pts = AV_NOPTS_VALUE); + BOOL decode(AVPacket* pkt); + void setCallback(VDCB pCallback, void* pUserdata) { m_pCallback = pCallback; m_pUserdata = pUserdata; } + BOOL getHWFormat(AVCodecContext* ctx, const AVPixelFormat* pix_fmts, AVPixelFormat* dst); + bool getHardwareTypeForPlatform(int hwMode, std::string& hwtype); + bool findHwConfigForDeviceType(AVHWDeviceType type); + void logSupportedHwTypes(); + BOOL isHardwareDecoderEnabled() const { return m_bHardwareDecoderEnabled; } + int getHWGpuIndex() const { return m_hwGpuIndex; } + bool isCudaHWAccel() const { return m_bCudaHWAccel; } + // Returns the CUDA HW frame (device pointers). Caller takes ownership. + AVFrame* takeCudaHWFrame(); + // Clone CUDA HW frame without locking — caller MUST already hold _mutex + // (used by onVideoFrame callback which runs inside decode()'s lock scope). + AVFrame* cloneCudaHWFrame_unlocked(); + void Start(); + void Stop(); + void flush(); + AVCodecContext* getAVCodeContext() { + return m_pContext; + } +private: + BOOL readFrame(); + int render(AVFrame* frame); + int hwDecoderInit(AVCodecContext* ctx, int hwMode, int preferredGpu = -1); +private: + BOOL m_bInited; + BOOL m_bRunning; + BOOL m_bHardwareDecoderEnabled; // Track if hardware decoder is enabled + bool m_bCudaHWAccel; // true when using AV_HWDEVICE_TYPE_CUDA + int m_hwGpuIndex; // GPU index assigned by HWDecoderPool (-1 = legacy) + AVFrame* m_pCudaHWFrame; // Cloned CUDA HW frame (device ptrs) for inference + const AVCodec* m_pCodec; + AVCodecContext* m_pContext; + AVFrame* m_pFrame; + AVFrame* m_pSoftFrame; + VDCB m_pCallback; + void* m_pUserdata; + AVPixelFormat m_hwPixFmt; + AVBufferRef* m_pHWDeviceCtx; + std::recursive_mutex _mutex; +}; +#endif + + diff --git a/MediaClient/MediaClient/media/video_player.cpp b/MediaClient/MediaClient/media/video_player.cpp new file mode 100644 index 0000000..09d5019 --- /dev/null +++ b/MediaClient/MediaClient/media/video_player.cpp @@ -0,0 +1,2290 @@ +#include "sys_inc.h" +#include "media_util.h" +#include "media_parse.h" +#include "media_codec.h" +#include "h264.h" +#include "h265.h" +#include "video_player.h" +extern "C" +{ +#include +#include +#include +#include +#include +#include +#include +#include +} +#if __WINDOWS_OS__ +#include "audio_play_win.h" +#elif defined(IOS) +#include "video_render_sdl.h" +#include "audio_play_mac.h" +#elif __LINUX_OS__ +#include "video_render_sdl.h" +#include "audio_play_qt.h" +#endif +#include +#include +#include +#include +#if defined(__SSE2__) || defined(_M_X64) || defined(_M_AMD64) +#include +#define HAS_SSE2 1 +#endif + + + +void VideoDecoderCallback(AVFrame* frame, void* userdata) +{ + CVideoPlayer* pPlayer = (CVideoPlayer*)userdata; + pPlayer->onVideoFrame(frame); +} + +void AudioDecoderCallback(AVFrame* frame, void* userdata) +{ + CVideoPlayer* pPlayer = (CVideoPlayer*)userdata; + pPlayer->onAudioFrame(frame); +} + + +void CVideoPlayer::setBbox(cv::Rect bbox) { + std::lock_guard lock(_mutex); + m_Bbox = bbox; +} +void CVideoPlayer::setCrop(bool crop) { + std::lock_guard lock(_mutex); + m_bCrop = crop; +} +AVFrame* CVideoPlayer::cropFrame(const AVFrame* srcFrame, cv::Rect bBox, bool cropFlag) { + std::lock_guard lock(_mutex); + try { + // Validate prerequisites + if (!cropFlag || !srcFrame || !m_bPlaying) { + return nullptr; + } + + // Ensure the bounding box is within the source frame's boundaries + bBox.x = std::clamp(bBox.x, 0, srcFrame->width); + bBox.y = std::clamp(bBox.y, 0, srcFrame->height); + bBox.width = std::clamp(bBox.width, 0, srcFrame->width - bBox.x); + bBox.height = std::clamp(bBox.height, 0, srcFrame->height - bBox.y); + + // Validate the bounding box dimensions + if (bBox.width <= 10 || bBox.height <= 10) { + std::cerr << "Invalid bounding box dimensions for cropping." << std::endl; + return nullptr; + } + + // Allocate memory for the cropped frame + AVFrame* croppedFrame = av_frame_alloc(); + if (!croppedFrame) { + std::cerr << "Failed to allocate memory for the cropped frame." << std::endl; + return nullptr; + } + + // Set cropped frame attributes + croppedFrame->format = srcFrame->format; + croppedFrame->width = bBox.width; + croppedFrame->height = bBox.height; + + // *** REMOVED: Don't allocate buffer since we're only setting pointers *** + // The cropFrameData() function will set pointers to the original frame's data + + // Crop the frame based on its format + if (!cropFrameData(srcFrame, croppedFrame, bBox)) { + av_frame_free(&croppedFrame); + return nullptr; + } + + return croppedFrame; + } + catch (const std::exception& e) { + std::cerr << "Exception in CVideoPlayer::cropFrame: " << e.what() << std::endl; + return nullptr; + } +} + + +// Helper function to crop frame data +bool CVideoPlayer::cropFrameData(const AVFrame* srcFrame, AVFrame* croppedFrame, const cv::Rect& bBox) { + std::lock_guard lock(_mutex); + try { + switch (srcFrame->format) { + case AV_PIX_FMT_YUVJ444P: + case AV_PIX_FMT_YUV444P: + // Full chroma resolution (No subsampling) + cropPlane(srcFrame, croppedFrame, 0, bBox.x, bBox.y, 1, 1); // Y plane + cropPlane(srcFrame, croppedFrame, 1, bBox.x, bBox.y, 1, 1); // U plane + cropPlane(srcFrame, croppedFrame, 2, bBox.x, bBox.y, 1, 1); // V plane + break; + + case AV_PIX_FMT_YUVJ422P: + case AV_PIX_FMT_YUV422P: + // Horizontal chroma subsampling (chroma resolution is half in X direction) + cropPlane(srcFrame, croppedFrame, 0, bBox.x, bBox.y, 1, 1); // Y plane + cropPlane(srcFrame, croppedFrame, 1, bBox.x / 2, bBox.y, 1, 1); // U plane + cropPlane(srcFrame, croppedFrame, 2, bBox.x / 2, bBox.y, 1, 1); // V plane + break; + + case AV_PIX_FMT_YUVJ420P: + case AV_PIX_FMT_YUV420P: + // Both horizontal and vertical chroma subsampling (chroma is 1/4 of Y resolution) + cropPlane(srcFrame, croppedFrame, 0, bBox.x, bBox.y, 1, 1); // Y plane + cropPlane(srcFrame, croppedFrame, 1, bBox.x / 2, bBox.y / 2, 1, 1); // U plane + cropPlane(srcFrame, croppedFrame, 2, bBox.x / 2, bBox.y / 2, 1, 1); // V plane + break; + + case AV_PIX_FMT_NV12: + // NV12 has a **single interleaved UV plane** + cropPlane(srcFrame, croppedFrame, 0, bBox.x, bBox.y, 1, 1); // Y plane + cropPlane(srcFrame, croppedFrame, 1, bBox.x / 2, bBox.y / 2, 2, 1); // UV plane (interleaved, stepX=2) + break; + + default: + std::cerr << "Unsupported pixel format: " << av_get_pix_fmt_name((AVPixelFormat)srcFrame->format) << std::endl; + return false; + } + return true; + } + catch (const std::exception& e) { + std::cerr << "Exception in cropFrameData: " << e.what() << std::endl; + return false; + } +} + +// Helper function to crop individual planes +void CVideoPlayer::cropPlane(const AVFrame* srcFrame, AVFrame* croppedFrame, int planeIndex, int offsetX, int offsetY, int subsampleX, int subsampleY) { + std::lock_guard lock(_mutex); + try { + croppedFrame->data[planeIndex] = srcFrame->data[planeIndex] + + offsetY * srcFrame->linesize[planeIndex] + + offsetX * subsampleX; + croppedFrame->linesize[planeIndex] = srcFrame->linesize[planeIndex]; + } + catch (const std::exception& e) { + std::cerr << "Exception in cropPlane: " << e.what() << std::endl; + } + +} + +// Convert NV12 AVFrame to YUVJ420P +AVFrame* CVideoPlayer::convertNV12ToYUVJ420P(const AVFrame* nv12Frame) { + std::lock_guard lock(_mutex); + + AVFrame* yuvjFrame = nullptr; + + try { + if (!nv12Frame || !nv12Frame->data[0] || nv12Frame->width <= 10 || nv12Frame->height <= 10) { + std::cerr << "Invalid or empty NV12 frame data, or invalid dimensions." << std::endl; + return nullptr; + } + + int width = nv12Frame->width; + int height = nv12Frame->height; + + // ✅ Allocate new YUVJ420P frame + yuvjFrame = av_frame_alloc(); + if (!yuvjFrame) { + std::cerr << "Failed to allocate YUVJ420P frame" << std::endl; + return nullptr; + } + + yuvjFrame->format = AV_PIX_FMT_YUVJ420P; + yuvjFrame->width = width; + yuvjFrame->height = height; + + // ✅ Allocate buffer for YUVJ420P frame + if (av_frame_get_buffer(yuvjFrame, 32) < 0) { + std::cerr << "Failed to allocate buffer for YUVJ420P" << std::endl; + av_frame_free(&yuvjFrame); + return nullptr; + } + + // ✅ Copy Y plane (Luma) row by row (prevents memory corruption) + for (int j = 0; j < height; ++j) { + memcpy(yuvjFrame->data[0] + j * yuvjFrame->linesize[0], + nv12Frame->data[0] + j * nv12Frame->linesize[0], width); + } + + // ✅ Correctly extract UV planes from interleaved NV12 + uint8_t* nv12_uv = nv12Frame->data[1]; + uint8_t* yuvj_u = yuvjFrame->data[1]; + uint8_t* yuvj_v = yuvjFrame->data[2]; + + int uvWidth = width / 2; + int uvHeight = height / 2; + + for (int j = 0; j < uvHeight; ++j) { + uint8_t* nv12Row = nv12_uv + j * nv12Frame->linesize[1]; + uint8_t* uRow = yuvj_u + j * yuvjFrame->linesize[1]; + uint8_t* vRow = yuvj_v + j * yuvjFrame->linesize[2]; + + for (int i = 0; i < uvWidth; ++i) { + uRow[i] = nv12Row[i * 2]; // Extract U + vRow[i] = nv12Row[i * 2 + 1]; // Extract V + } + } + + return yuvjFrame; + } + catch (const std::exception& e) { + std::cerr << "Exception in convertNV12ToYUVJ420P: " << e.what() << std::endl; + + // ✅ Prevent Memory Leak by Freeing the Allocated Frame + if (yuvjFrame) { + av_frame_free(&yuvjFrame); + } + + return nullptr; + } +} +std::string CVideoPlayer::avframeYUVJ420PToJpegStringUsingFFMpeg(const AVFrame* pFrame) { + std::lock_guard lock(_mutex); + try { + if (!m_bPlaying) { + return ""; + } + if (!pFrame || !pFrame->data[0] || pFrame->width <= 10 || pFrame->height <= 10) { + std::cerr << "Invalid or empty frame data, or invalid dimensions." << std::endl; + return ""; + } + AVCodec* jpegCodec = avcodec_find_encoder(AV_CODEC_ID_MJPEG); + if (!jpegCodec) { + std::cerr << "Failed to find MJPEG encoder." << std::endl; + return ""; + } + AVCodecContext* jpegContext = avcodec_alloc_context3(jpegCodec); + if (!jpegContext) { + std::cerr << "Failed to allocate codec context." << std::endl; + return ""; + } + int imageSize = std::max(pFrame->width, pFrame->height); + AVPixelFormat pixFmt = AV_PIX_FMT_YUVJ420P;// Fix to use YUVJ420P for all resolutions + jpegContext->pix_fmt = pixFmt; + jpegContext->time_base.num = 1; + jpegContext->time_base.den = 30; + jpegContext->compression_level = 10; + jpegContext->flags |= AV_CODEC_FLAG_QSCALE; // Enable quality scale + jpegContext->global_quality = 90 * FF_QP2LAMBDA; // Adjust quality (90 is near lossless) + + AVFrame* convertedFrame = nullptr; + AVPacket packet; + av_init_packet(&packet); + packet.data = nullptr; + packet.size = 0; + bool isSuccess = false; + std::string jpegData; + + // Determine if conversion is needed based on the pixel format + if ((pFrame->format == AV_PIX_FMT_YUVJ420P) || + (pFrame->format == AV_PIX_FMT_YUV420P)) + { + jpegContext->width = pFrame->width; + jpegContext->height = pFrame->height; + if (avcodec_open2(jpegContext, jpegCodec, NULL) >= 0) { + if (avcodec_send_frame(jpegContext, pFrame) >= 0) { + if (avcodec_receive_packet(jpegContext, &packet) >= 0) { + jpegData.assign(reinterpret_cast(packet.data), packet.size); + m_Width = pFrame->width; + m_Height = pFrame->height; + m_pts = m_pts + 1; + isSuccess = true; + } + } + } + } + else { + // Conversion is needed to AV_PIX_FMT_YUVJ420P + initSwsContext(pFrame->width, pFrame->height, static_cast(pFrame->format)); + convertedFrame = av_frame_alloc(); + if (convertedFrame) { + convertedFrame->format = pixFmt; + convertedFrame->width = pFrame->width; + convertedFrame->height = pFrame->height; + convertedFrame->color_range = AVCOL_RANGE_JPEG; + + if (av_frame_get_buffer(convertedFrame, 32) >= 0) { + sws_scale(swsCtx, pFrame->data, pFrame->linesize, 0, pFrame->height, + convertedFrame->data, convertedFrame->linesize); + jpegContext->width = convertedFrame->width; + jpegContext->height = convertedFrame->height; + + if (avcodec_open2(jpegContext, jpegCodec, NULL) >= 0) { + if (avcodec_send_frame(jpegContext, convertedFrame) >= 0) { + if (avcodec_receive_packet(jpegContext, &packet) >= 0) { + // Successfully encoded to JPEG + jpegData.assign(reinterpret_cast(packet.data), packet.size); + m_Width = convertedFrame->width; + m_Height = convertedFrame->height; + m_pts = m_pts + 1; + isSuccess = true; + } + } + } + } + } + av_frame_free(&convertedFrame); // Free the converted frame if allocated + } + // Cleanup + av_packet_unref(&packet); // Free the packet data + avcodec_free_context(&jpegContext); // Free the codec context + // Return the JPEG data as a string if successful, otherwise an empty string + return isSuccess ? jpegData : ""; + } + catch (const std::exception& e) { + std::cerr << "Exception in avframeToJpegString: " << e.what() << std::endl; + return ""; // Return empty string on error + } +} +std::string CVideoPlayer::avframeYUVJ420PToJpegStringUsingTurboJPEG(const AVFrame* pFrame) { + std::lock_guard lock(_mutex); + try { + if (!m_bPlaying || !pFrame || !pFrame->data[0] || pFrame->width <= 10 || pFrame->height <= 10) { + return ""; + } + // Ensure TurboJPEG instance is valid + if (!_tjInstance) { + return ""; + } + unsigned char* yuvPlanes[3] = { pFrame->data[0], pFrame->data[1], pFrame->data[2] }; + int strides[3] = { pFrame->linesize[0], pFrame->linesize[1], pFrame->linesize[2] }; + int width = pFrame->width; + int height = pFrame->height; + constexpr int subsampling = TJSAMP_420; + constexpr int quality = 85; + + // Use thread-local buffers to avoid malloc/free overhead + static thread_local std::vector jpegBuffer; + static thread_local std::vector yuvBuffer; + + // Estimate required buffer sizes + unsigned long jpegBufferSize = tjBufSize(width, height, subsampling); + unsigned long yuvBufferSize = tjBufSizeYUV(width, height, subsampling); + + // Resize buffers only if necessary + if (jpegBuffer.size() < jpegBufferSize) { + jpegBuffer.resize(jpegBufferSize); + } + if (yuvBuffer.size() < yuvBufferSize) { + yuvBuffer.resize(yuvBufferSize); + } + + // Pointers for JPEG output + unsigned char* jpegDataPtr = jpegBuffer.data(); + unsigned long jpegSize = 0; + + // Convert YUV to JPEG using TurboJPEG + int ret = tjCompressFromYUVPlanes( + _tjInstance, + (const unsigned char**)yuvPlanes, + width, + strides, + height, + subsampling, + &jpegDataPtr, // Using preallocated buffer + &jpegSize, + quality, + TJFLAG_FASTDCT | TJFLAG_FASTUPSAMPLE + ); + + // Check if TurboJPEG reallocated the buffer + if (ret < 0) { + return ""; + } + + // If TurboJPEG allocated a new buffer, we must free it + if (jpegDataPtr != jpegBuffer.data()) { + std::string jpegString(reinterpret_cast(jpegDataPtr), jpegSize); + tjFree(jpegDataPtr); // Free the buffer allocated by TurboJPEG + return jpegString; + } + + // Convert to std::string (without extra allocations) + return std::string(reinterpret_cast(jpegDataPtr), jpegSize); + } + catch (const std::exception& e) { + std::cerr << "Exception in avframeToJpegString: " << e.what() << std::endl; + return ""; // Return empty string on error + } +} +std::string CVideoPlayer::encodeYUVJ420PToJPEG(AVFrame* frame, int quality) { + std::lock_guard lock(_mutex); + try { + if (!frame || frame->format != AV_PIX_FMT_YUVJ420P) { + std::cerr << "Invalid frame format (must be YUVJ420P)" << std::endl; + return ""; + } + + // Find MJPEG encoder + AVCodec* codec = avcodec_find_encoder(AV_CODEC_ID_MJPEG); + if (!codec) { + std::cerr << "JPEG encoder not found" << std::endl; + return ""; + } + + // Allocate codec context + AVCodecContext* codecCtx = avcodec_alloc_context3(codec); + if (!codecCtx) { + std::cerr << "Failed to allocate codec context" << std::endl; + return ""; + } + + // Set encoding parameters + codecCtx->pix_fmt = AV_PIX_FMT_YUVJ420P; // Use full-range YUV for better quality + codecCtx->width = frame->width; + codecCtx->height = frame->height; + codecCtx->time_base.num = 1; + codecCtx->time_base.den = 30; + codecCtx->gop_size = 1; + codecCtx->max_b_frames = 0; + codecCtx->compression_level = 10; // Increase quality + codecCtx->flags |= AV_CODEC_FLAG_QSCALE; // Enable quality scale + codecCtx->global_quality = quality * FF_QP2LAMBDA; // Adjust quality (90 is near lossless) + + // Enable optimal Huffman tables + AVDictionary* opts = nullptr; + av_dict_set(&opts, "huffman", "optimal", 0); + + // Open codec + if (avcodec_open2(codecCtx, codec, &opts) < 0) { + std::cerr << "Failed to open JPEG encoder" << std::endl; + avcodec_free_context(&codecCtx); + return ""; + } + + AVPacket pkt; + av_init_packet(&pkt); + pkt.data = nullptr; + pkt.size = 0; + + // Send frame to encoder + if (avcodec_send_frame(codecCtx, frame) < 0) { + std::cerr << "Failed to send frame for encoding" << std::endl; + avcodec_free_context(&codecCtx); + return ""; + } + + // Receive encoded packet + if (avcodec_receive_packet(codecCtx, &pkt) < 0) { + std::cerr << "Failed to receive encoded packet" << std::endl; + avcodec_free_context(&codecCtx); + return ""; + } + + // Convert to string and clean up + std::string jpegString(reinterpret_cast(pkt.data), pkt.size); + av_packet_unref(&pkt); + avcodec_free_context(&codecCtx); + av_dict_free(&opts); + + return jpegString; + } + catch (const std::exception& e) { + std::cerr << "Exception in encodeYUVJ420PToJPEG: " << e.what() << std::endl; + return ""; // Return empty string on error + } +} + +std::string CVideoPlayer::avframeYUVJ420PToJpegString(const AVFrame* spFrame) { + std::lock_guard lock(_mutex); + + AVFrame* croppedFrame = nullptr; + AVFrame* convertedFrame = nullptr; + AVFrame* convertedNV12Frame = nullptr; + AVFrame* pFrame = const_cast(spFrame); // Default to original frame + bool isSuccess = false; + std::string jpegData; + + try { + if (!m_bPlaying) { + return ""; + } + + if (!spFrame || !spFrame->data[0] || spFrame->width <= 10 || spFrame->height <= 10) { + std::cerr << "Invalid or empty frame data, or invalid dimensions." << std::endl; + return ""; + } + + // ✅ Convert NV12 to YUVJ420P if needed + if (pFrame->format == AV_PIX_FMT_NV12) { + convertedNV12Frame = convertNV12ToYUVJ420P(spFrame); + if (convertedNV12Frame) { + pFrame = convertedNV12Frame; // Use the converted frame + } + } + + // ✅ Process the frame if it's already in YUVJ420P or YUV420P + if ((pFrame->format == AV_PIX_FMT_YUVJ420P) || (pFrame->format == AV_PIX_FMT_YUV420P)) { + croppedFrame = cropFrame(pFrame, m_Bbox, m_bCrop); + if (!croppedFrame) { + croppedFrame = pFrame; // Use original frame if cropping failed + } + + // TurboJPEG handles all resolutions efficiently + jpegData = avframeYUVJ420PToJpegStringUsingTurboJPEG(croppedFrame); + + if (!jpegData.empty()) { + m_Width = croppedFrame->width; + m_Height = croppedFrame->height; + m_pts = m_pts + 1; + isSuccess = true; + } + + // ✅ Free cropped frame if allocated + if (croppedFrame != pFrame) { + av_frame_free(&croppedFrame); + croppedFrame = nullptr; + } + } + else { // ✅ Convert non-YUVJ420P frames + initSwsContext(pFrame->width, pFrame->height, static_cast(pFrame->format)); + convertedFrame = av_frame_alloc(); + if (convertedFrame) { + convertedFrame->format = AV_PIX_FMT_YUVJ420P; + convertedFrame->width = pFrame->width; + convertedFrame->height = pFrame->height; + convertedFrame->color_range = AVCOL_RANGE_JPEG; + + if (av_frame_get_buffer(convertedFrame, 32) >= 0) { + sws_scale(swsCtx, pFrame->data, pFrame->linesize, 0, pFrame->height, + convertedFrame->data, convertedFrame->linesize); + + croppedFrame = cropFrame(convertedFrame, m_Bbox, m_bCrop); + if (!croppedFrame) { + croppedFrame = convertedFrame; // Use converted frame if cropping failed + } + + // TurboJPEG handles all resolutions efficiently + jpegData = avframeYUVJ420PToJpegStringUsingTurboJPEG(croppedFrame); + + if (!jpegData.empty()) { + m_Width = croppedFrame->width; + m_Height = croppedFrame->height; + m_pts = m_pts + 1; + isSuccess = true; + } + + // ✅ Free cropped frame if allocated + if (croppedFrame != convertedFrame) { + av_frame_free(&croppedFrame); + croppedFrame = nullptr; + } + } + } + // ✅ Free converted frame if allocated + if (convertedFrame) { + av_frame_free(&convertedFrame); + convertedFrame = nullptr; + } + } + + // ✅ Free the NV12 converted frame if used + if (convertedNV12Frame) { + av_frame_free(&convertedNV12Frame); + convertedNV12Frame = nullptr; + } + + return isSuccess ? jpegData : ""; + } + catch (const std::exception& e) { + std::cerr << "Exception in avframeYUVJ420PToJpegString: " << e.what() << std::endl; + + // ✅ Ensure all allocated frames are freed in case of an exception + if (croppedFrame && croppedFrame != pFrame && croppedFrame != convertedFrame) { + av_frame_free(&croppedFrame); + } + if (convertedFrame) { + av_frame_free(&convertedFrame); + } + if (convertedNV12Frame) { + av_frame_free(&convertedNV12Frame); + } + + return ""; + } +} + + +// Direct conversion of AVFrame to JPEG using TurboJPEG +std::string CVideoPlayer::encodeNV12ToJPEG_TurboJPEG(const AVFrame* pFrame, int quality) { + // NOTE: caller (avframeToJpegString) already holds _mutex — no lock needed here + try { + if (!m_bPlaying || !pFrame || !pFrame->data[0] || pFrame->width <= 10 || pFrame->height <= 10) { + return ""; + } + // Ensure TurboJPEG instance is valid + if (!_tjInstance) { + std::cerr << "TurboJPEG instance is not initialized." << std::endl; + return ""; + } + + // Ensure the frame format is NV12 + if (pFrame->format != AV_PIX_FMT_NV12) { + std::cerr << "Unsupported format! Expected NV12, got: " + << av_get_pix_fmt_name((AVPixelFormat)pFrame->format) << std::endl; + return ""; + } + + int width = pFrame->width; + int height = pFrame->height; + // Use caller's quality parameter (default 90 from function signature) + + // NV12 has interleaved UV, but TurboJPEG requires separate U and V planes + unsigned char* yuvPlanes[3]; + int strides[3]; + + yuvPlanes[0] = pFrame->data[0]; // Y plane (full resolution) + strides[0] = pFrame->linesize[0]; + + // **Convert NV12 interleaved UV to separate U and V planes** + int uvWidth = width / 2; + int uvHeight = height / 2; + int uvSize = uvWidth * uvHeight; + + static thread_local std::vector uPlane(uvSize); + static thread_local std::vector vPlane(uvSize); + + // Deinterleave NV12 UV plane into separate U and V planes + unsigned char* uvData = pFrame->data[1]; + int uvStride = pFrame->linesize[1]; + for (int j = 0; j < uvHeight; j++) { + const unsigned char* uvRow = uvData + j * uvStride; + unsigned char* uRow = uPlane.data() + j * uvWidth; + unsigned char* vRow = vPlane.data() + j * uvWidth; + int i = 0; +#ifdef HAS_SSE2 + // SSE2: process 16 UV pairs (32 bytes) at a time + for (; i + 15 < uvWidth; i += 16) { + __m128i uv0 = _mm_loadu_si128((__m128i*)(uvRow + i * 2)); + __m128i uv1 = _mm_loadu_si128((__m128i*)(uvRow + i * 2 + 16)); + // Deinterleave: even bytes = U, odd bytes = V + __m128i mask = _mm_set1_epi16(0x00FF); + __m128i u0 = _mm_and_si128(uv0, mask); + __m128i u1 = _mm_and_si128(uv1, mask); + __m128i v0 = _mm_srli_epi16(uv0, 8); + __m128i v1 = _mm_srli_epi16(uv1, 8); + __m128i uPacked = _mm_packus_epi16(u0, u1); + __m128i vPacked = _mm_packus_epi16(v0, v1); + _mm_storeu_si128((__m128i*)(uRow + i), uPacked); + _mm_storeu_si128((__m128i*)(vRow + i), vPacked); + } +#endif + // Scalar fallback for remaining pixels + for (; i < uvWidth; i++) { + uRow[i] = uvRow[i * 2]; + vRow[i] = uvRow[i * 2 + 1]; + } + } + + // Assign separate planes to TurboJPEG input + yuvPlanes[1] = uPlane.data(); + yuvPlanes[2] = vPlane.data(); + strides[1] = uvWidth; + strides[2] = uvWidth; + + // Use thread-local buffers to avoid malloc/free overhead + static thread_local std::vector jpegBuffer; + + // Estimate required buffer size for JPEG + unsigned long jpegBufferSize = tjBufSize(width, height, TJSAMP_420); + + // Resize JPEG buffer only if necessary + if (jpegBuffer.size() < jpegBufferSize) { + jpegBuffer.resize(jpegBufferSize); + } + + // Pointer for JPEG output + unsigned char* jpegDataPtr = jpegBuffer.data(); + unsigned long jpegSize = 0; + + // Convert NV12 (separated into YUV420P) to JPEG using TurboJPEG + int ret = tjCompressFromYUVPlanes( + _tjInstance, + (const unsigned char**)yuvPlanes, + width, + strides, + height, + TJSAMP_420, // Explicitly define subsampling format for NV12 + &jpegDataPtr, // Preallocated buffer + &jpegSize, + quality, + TJFLAG_FASTDCT | TJFLAG_FASTUPSAMPLE + ); + + if (ret < 0) { + std::cerr << "TurboJPEG compression failed: " << tjGetErrorStr() << std::endl; + return ""; + } + + // If TurboJPEG allocated a new buffer, free it after copying + if (jpegDataPtr != jpegBuffer.data()) { + std::string jpegString(reinterpret_cast(jpegDataPtr), jpegSize); + tjFree(jpegDataPtr); + return jpegString; + } + + // Convert to std::string without extra allocations + return std::string(reinterpret_cast(jpegDataPtr), jpegSize); + } + catch (const std::exception& e) { + std::cerr << "Exception in avframeNV12ToJpegStringUsingTurboJPEG: " << e.what() << std::endl; + return ""; // Return empty string on error + } +} +std::string CVideoPlayer::encodeNV12ToJPEG_FFmpeg(const AVFrame* nv12Frame, int quality) { + // NOTE: caller (avframeToJpegString) already holds _mutex — no lock needed here + AVCodecContext* codecCtx = nullptr; + AVFrame* yuvjFrame = nullptr; + AVPacket pkt; + try { + if (!m_bPlaying || !nv12Frame || !nv12Frame->data[0] || nv12Frame->width <= 10 || nv12Frame->height <= 10) { + return ""; + } + + if (nv12Frame->format != AV_PIX_FMT_NV12) { + std::cerr << "Invalid frame format! Expected NV12." << std::endl; + return ""; + } + + int width = nv12Frame->width; + int height = nv12Frame->height; + + // ✅ Find and allocate MJPEG encoder + AVCodec* jpegCodec = avcodec_find_encoder(AV_CODEC_ID_MJPEG); + if (!jpegCodec) { + std::cerr << "MJPEG encoder not found!" << std::endl; + return ""; + } + + codecCtx = avcodec_alloc_context3(jpegCodec); + if (!codecCtx) { + std::cerr << "Failed to allocate codec context!" << std::endl; + return ""; + } + + // ✅ Set encoding parameters + codecCtx->pix_fmt = AV_PIX_FMT_YUVJ420P; + codecCtx->width = width; + codecCtx->height = height; + codecCtx->time_base = { 1, 25 }; + codecCtx->gop_size = 1; + codecCtx->max_b_frames = 0; + codecCtx->compression_level = 10; + codecCtx->flags |= AV_CODEC_FLAG_QSCALE; + codecCtx->global_quality = quality * FF_QP2LAMBDA; + + if (avcodec_open2(codecCtx, jpegCodec, nullptr) < 0) { + std::cerr << "Failed to open MJPEG encoder!" << std::endl; + avcodec_free_context(&codecCtx); + return ""; + } + + // ✅ Allocate YUVJ420P frame + yuvjFrame = av_frame_alloc(); + if (!yuvjFrame) { + std::cerr << "Failed to allocate YUVJ420P frame!" << std::endl; + avcodec_free_context(&codecCtx); + return ""; + } + + yuvjFrame->format = AV_PIX_FMT_YUVJ420P; + yuvjFrame->width = width; + yuvjFrame->height = height; + + if (av_frame_get_buffer(yuvjFrame, 32) < 0) { + std::cerr << "Failed to allocate buffer for YUVJ420P frame!" << std::endl; + av_frame_free(&yuvjFrame); + avcodec_free_context(&codecCtx); + return ""; + } + + // ✅ Copy Y plane row by row (Prevents memory corruption) + for (int j = 0; j < height; ++j) { + memcpy(yuvjFrame->data[0] + j * yuvjFrame->linesize[0], + nv12Frame->data[0] + j * nv12Frame->linesize[0], width); + } + + // ✅ Correctly extract UV planes from NV12 + uint8_t* nv12_uv = nv12Frame->data[1]; + uint8_t* yuvj_u = yuvjFrame->data[1]; + uint8_t* yuvj_v = yuvjFrame->data[2]; + + int uvWidth = width / 2; + int uvHeight = height / 2; + + for (int j = 0; j < uvHeight; ++j) { + uint8_t* nv12Row = nv12_uv + j * nv12Frame->linesize[1]; + uint8_t* uRow = yuvj_u + j * yuvjFrame->linesize[1]; + uint8_t* vRow = yuvj_v + j * yuvjFrame->linesize[2]; + + for (int i = 0; i < uvWidth; ++i) { + uRow[i] = nv12Row[i * 2]; // Extract U + vRow[i] = nv12Row[i * 2 + 1]; // Extract V + } + } + + // ✅ Encode frame to JPEG + av_init_packet(&pkt); + pkt.data = nullptr; + pkt.size = 0; + + bool isSuccess = false; + std::string jpegData; + + if (avcodec_send_frame(codecCtx, yuvjFrame) >= 0) { + if (avcodec_receive_packet(codecCtx, &pkt) >= 0) { + jpegData.assign(reinterpret_cast(pkt.data), pkt.size); + isSuccess = true; + } + } + + // ✅ Cleanup + av_packet_unref(&pkt); + av_frame_free(&yuvjFrame); + avcodec_free_context(&codecCtx); + + return isSuccess ? jpegData : ""; + } + catch (const std::exception& e) { + std::cerr << "Exception in encodeNV12ToJPEG_FFmpeg: " << e.what() << std::endl; + } + + // ✅ Ensure memory cleanup in case of exceptions + if (yuvjFrame) av_frame_free(&yuvjFrame); + if (codecCtx) avcodec_free_context(&codecCtx); + av_packet_unref(&pkt); + + return ""; // Return empty string on error +} +std::string CVideoPlayer::avframeToJpegString(const AVFrame* spFrame) { + std::lock_guard lock(_mutex); + + AVFrame* croppedFrame = nullptr; + AVFrame* convertedFrame = nullptr; + AVFrame* pFrame = const_cast(spFrame); + bool isSuccess = false; + std::string jpegData; + + try { + if (!m_bPlaying) { + return ""; + } + + if (!spFrame || !spFrame->data[0] || spFrame->width <= 10 || spFrame->height <= 10) { + std::cerr << "Invalid or empty frame data, or invalid dimensions." << std::endl; + return ""; + } + + // ✅ Process NV12 frames directly + if (pFrame->format == AV_PIX_FMT_NV12) { + croppedFrame = cropFrame(pFrame, m_Bbox, m_bCrop); + if (!croppedFrame) { + croppedFrame = pFrame; // Use original frame if cropping failed + } + + // TurboJPEG handles all resolutions — no need for slow FFmpeg MJPEG path + jpegData = encodeNV12ToJPEG_TurboJPEG(croppedFrame); + + if (!jpegData.empty()) { + m_Width = croppedFrame->width; + m_Height = croppedFrame->height; + m_pts = m_pts + 1; + isSuccess = true; + } + + // ✅ Free cropped frame if allocated + if (croppedFrame != pFrame) { + av_frame_free(&croppedFrame); + croppedFrame = nullptr; + } + } + else { // ✅ Convert other formats to NV12 before processing + initSwsContext(pFrame->width, pFrame->height, static_cast(pFrame->format), AV_PIX_FMT_NV12); + convertedFrame = av_frame_alloc(); + if (convertedFrame) { + convertedFrame->format = AV_PIX_FMT_NV12; + convertedFrame->width = pFrame->width; + convertedFrame->height = pFrame->height; + convertedFrame->color_range = AVCOL_RANGE_JPEG; + + if (av_frame_get_buffer(convertedFrame, 32) >= 0) { + sws_scale(swsCtx, pFrame->data, pFrame->linesize, 0, pFrame->height, + convertedFrame->data, convertedFrame->linesize); + + croppedFrame = cropFrame(convertedFrame, m_Bbox, m_bCrop); + if (!croppedFrame) { + croppedFrame = convertedFrame; // Use converted frame if cropping failed + } + + // TurboJPEG handles all resolutions + jpegData = encodeNV12ToJPEG_TurboJPEG(croppedFrame); + + if (!jpegData.empty()) { + m_Width = croppedFrame->width; + m_Height = croppedFrame->height; + m_pts = m_pts + 1; + isSuccess = true; + } + + // ✅ Free cropped frame if allocated + if (croppedFrame != convertedFrame) { + av_frame_free(&croppedFrame); + croppedFrame = nullptr; + } + } + } + // ✅ Free converted frame if allocated + if (convertedFrame) { + av_frame_free(&convertedFrame); + convertedFrame = nullptr; + } + } + + return isSuccess ? jpegData : ""; + } + catch (const std::exception& e) { + std::cerr << "Exception in avframeToJpegString: " << e.what() << std::endl; + + // ✅ Cleanup memory in case of exceptions + if (croppedFrame && croppedFrame != pFrame && croppedFrame != convertedFrame) { + av_frame_free(&croppedFrame); + } + if (convertedFrame) { + av_frame_free(&convertedFrame); + } + + return ""; + } +} + +bool CVideoPlayer::areFramesIdentical(AVFrame* frame1, AVFrame* frame2) { + std::lock_guard lock(_mutex); + try { + if (!frame1 || !frame2) return false; + + // Ensure the frames have the same width, height, and format + if (frame1->width != frame2->width || frame1->height != frame2->height || frame1->format != frame2->format) { + return false; + } + + int height = frame1->height; + int width = frame1->width; + + // Compare Y plane (Luma) + for (int y = 0; y < height; y++) { + if (std::memcmp(frame1->data[0] + y * frame1->linesize[0], + frame2->data[0] + y * frame2->linesize[0], + width) != 0) { + return false; + } + } + + if (frame1->format == AV_PIX_FMT_NV12) { + // Compare UV plane (Interleaved) + int chromaHeight = height / 2; + for (int y = 0; y < chromaHeight; y++) { + if (std::memcmp(frame1->data[1] + y * frame1->linesize[1], + frame2->data[1] + y * frame2->linesize[1], + width) != 0) { + return false; + } + } + } + else if (frame1->format == AV_PIX_FMT_YUVJ420P) { + // Compare U and V planes separately + int chromaWidth = width / 2; + int chromaHeight = height / 2; + for (int y = 0; y < chromaHeight; y++) { + if (std::memcmp(frame1->data[1] + y * frame1->linesize[1], // U + frame2->data[1] + y * frame2->linesize[1], + chromaWidth) != 0) { + return false; + } + if (std::memcmp(frame1->data[2] + y * frame1->linesize[2], // V + frame2->data[2] + y * frame2->linesize[2], + chromaWidth) != 0) { + return false; + } + } + } + + return true; // If all planes match + } + catch (const std::exception& e) { + std::cerr << "Exception in areFramesIdentical: " << e.what() << std::endl; + return false; + } +} + +void CVideoPlayer::initSwsContext(int width, int height, AVPixelFormat pixFmt, AVPixelFormat outputPixFmt) { + std::lock_guard lock(_mutex); + try { + // Validate input dimensions and pixel format + if (width <= 0 || height <= 0 || pixFmt == AV_PIX_FMT_NONE) { + std::cerr << "Invalid parameters: width=" << width + << ", height=" << height + << ", pixFmt=" << pixFmt << std::endl; + return; + } + + // Check if reinitialization is required + bool needsReinit = (swsCtx == nullptr) || + (width != lastWidth || height != lastHeight || pixFmt != lastPixFmt || outputPixFmt != lastOutPixFmt); + + if (!needsReinit) { + // SwsContext is already up-to-date + return; + } + + // Free the existing SwsContext if it exists + if (swsCtx) { + sws_freeContext(swsCtx); + swsCtx = nullptr; + } + // Determine output pixel format and scaling options based on resolution + int scalingFlags = SWS_BILINEAR; // Fast scaling — LANCZOS is too slow for real-time + // Create a new SwsContext + swsCtx = sws_getContext(width, height, pixFmt, + width, height, outputPixFmt, + scalingFlags, + nullptr, nullptr, nullptr); + + // Check for errors in SwsContext creation + if (!swsCtx) { + std::cerr << "Failed to create SwsContext: width=" << width + << ", height=" << height + << ", inputPixFmt=" << pixFmt + << ", outputPixFmt=" << outputPixFmt << std::endl; + return; + } + + // Update last known parameters + lastWidth = width; + lastHeight = height; + lastPixFmt = pixFmt; + lastOutPixFmt = outputPixFmt; + } + catch (const std::exception& e) { + std::cerr << "Exception in initSwsContext: " << e.what() << std::endl; + } + catch (...) { + std::cerr << "Unknown exception in initSwsContext." << std::endl; + } +} +cv::Mat CVideoPlayer::avframeAnyToCvmat(const AVFrame* frame) { + std::lock_guard lock(_mutex); // Protect against concurrent access + try { + if (!frame || !frame->data[0] || frame->width <= 10 || frame->height <= 10) { + std::cerr << "Invalid or empty frame data, or invalid dimensions." << std::endl; + return cv::Mat(); // Return an empty matrix if the frame is invalid + } + initSwsContext(frame->width, frame->height, static_cast(frame->format), AV_PIX_FMT_BGR24); + + // Create OpenCV Mat to store the resulting image + cv::Mat image(frame->height, frame->width, CV_8UC3); + + uint8_t* dst[1] = { image.data }; + int dstStride[1] = { static_cast(image.step[0]) }; // OpenCV's stride + + // Perform the conversion using sws_scale + int result = sws_scale(swsCtx, frame->data, frame->linesize, 0, frame->height, dst, dstStride); + if (result < 0) { + std::cerr << "Failed to scale the frame." << std::endl; + return cv::Mat(); // Return an empty matrix if scaling fails + } + + return image; // Return the successfully converted OpenCV Mat + } + catch (const std::exception& e) { + std::cerr << "Exception in avframeToCvmat: " << e.what() << std::endl; + return cv::Mat(); // Return an empty matrix on error + } +} + + +cv::Mat CVideoPlayer::avframeYUVJ420PToCvmat(const AVFrame* frame) { + std::lock_guard lock(_mutex); + try { + if (!frame || !frame->data[0] || frame->width <= 10 || frame->height <= 10) { + std::cerr << "Invalid or empty frame data, or invalid dimensions." << std::endl; + return cv::Mat(); + } + + // Create OpenCV Mat for the output image (RGB) + cv::Mat image(frame->height, frame->width, CV_8UC3); // 8-bit 3 channels for RGB image + + // Pointer to Y, U, V data from AVFrame + uint8_t* yPlane = frame->data[0]; // Y plane (luminance) + uint8_t* uPlane = frame->data[1]; // U plane (chrominance) + uint8_t* vPlane = frame->data[2]; // V plane (chrominance) + + int yStride = frame->linesize[0]; // Stride of Y plane + int uStride = frame->linesize[1]; // Stride of U plane + int vStride = frame->linesize[2]; // Stride of V plane + + // Precompute offsets for U and V channels + int uvWidth = frame->width / 2; // U and V are subsampled (half resolution) + int uvHeight = frame->height / 2; + + // Loop through each pixel and convert YUV to RGB + for (int y = 0; y < frame->height; ++y) { + for (int x = 0; x < frame->width; ++x) { + // Y, U, V values for each pixel + int yVal = yPlane[y * yStride + x]; + int uVal = uPlane[(y / 2) * uStride + (x / 2)]; + int vVal = vPlane[(y / 2) * vStride + (x / 2)]; + + // Precompute differences for speed + int uDiff = uVal - 128; + int vDiff = vVal - 128; + + // Convert YUV to RGB (clamping values inline) + int r = yVal + (1.402 * vDiff); + int g = yVal - (0.344136 * uDiff) - (0.714136 * vDiff); + int b = yVal + (1.772 * uDiff); + + // Clamp the values to the valid range for RGB (0-255) + r = std::clamp(r, 0, 255); + g = std::clamp(g, 0, 255); + b = std::clamp(b, 0, 255); + + // Store the result in the OpenCV Mat (BGR format) + image.at(y, x) = cv::Vec3b(b, g, r); // OpenCV uses BGR by default + } + } + + return image; // Return the converted OpenCV Mat (BGR) + } + catch (const std::exception& e) { + std::cerr << "Exception in avframeToCvmatYUVJ420P: " << e.what() << std::endl; + return cv::Mat(); // Return an empty matrix on error + } +} +// Initialize a dedicated SwsContext for NV12→BGR with correct color space +void CVideoPlayer::initNV12SwsContext(const AVFrame* frame) { + int width = frame->width; + int height = frame->height; + + // Detect color space from frame metadata (BT.709 for HD/4K, BT.601 for SD) + int colorspace = SWS_CS_ITU709; // Default to BT.709 for HD/4K + if (frame->colorspace == AVCOL_SPC_BT470BG || frame->colorspace == AVCOL_SPC_SMPTE170M) { + colorspace = SWS_CS_ITU601; + } + else if (frame->colorspace == AVCOL_SPC_BT2020_NCL || frame->colorspace == AVCOL_SPC_BT2020_CL) { + colorspace = SWS_CS_BT2020; + } + else if (frame->colorspace == AVCOL_SPC_BT709) { + colorspace = SWS_CS_ITU709; + } + else if (width >= 1280 || height >= 720) { + // Auto-detect: HD and above → BT.709 (most common for IP cameras) + colorspace = SWS_CS_ITU709; + } + else { + colorspace = SWS_CS_ITU601; // SD content + } + + // Detect color range: limited (16-235) vs full (0-255) + int srcRange = (frame->color_range == AVCOL_RANGE_JPEG) ? 1 : 0; // 0=limited, 1=full + int dstRange = 1; // Output always full range (0-255) for display/AI processing + + // Check if reinit needed + if (m_nv12SwsCtx && width == m_nv12LastWidth && height == m_nv12LastHeight + && colorspace == m_nv12LastColorspace && srcRange == m_nv12LastRange) { + return; // Already configured + } + + // Free old context + if (m_nv12SwsCtx) { + sws_freeContext(m_nv12SwsCtx); + m_nv12SwsCtx = nullptr; + } + + // Create context: NV12 → BGR24, same dimensions (no scaling) + // SWS_BILINEAR + SWS_FULL_CHR_H_INT: good quality chroma upsampling (~12ms for 4K) + // SWS_ACCURATE_RND: better rounding for color precision + // Note: SWS_LANCZOS gives VLC-matching quality but costs 50-80ms — too slow. + // VLC achieves its quality via GPU shaders, not CPU processing. + m_nv12SwsCtx = sws_getContext(width, height, AV_PIX_FMT_NV12, + width, height, AV_PIX_FMT_BGR24, + SWS_BILINEAR | SWS_ACCURATE_RND | SWS_FULL_CHR_H_INT, + nullptr, nullptr, nullptr); + + if (!m_nv12SwsCtx) { + std::cerr << "Failed to create NV12 SwsContext" << std::endl; + return; + } + + // Configure correct color space and range + const int* coefficients = sws_getCoefficients(colorspace); + int* inv_table; int* table; + int curSrcRange, curDstRange, brightness, contrast, saturation; + sws_getColorspaceDetails(m_nv12SwsCtx, &inv_table, &curSrcRange, &table, &curDstRange, + &brightness, &contrast, &saturation); + sws_setColorspaceDetails(m_nv12SwsCtx, coefficients, srcRange, coefficients, dstRange, + brightness, contrast, saturation); + + m_nv12LastWidth = width; + m_nv12LastHeight = height; + m_nv12LastColorspace = colorspace; + m_nv12LastRange = srcRange; + +} + +cv::Mat CVideoPlayer::avframeNV12ToCvMat(const AVFrame* frame) +{ + try { + if (!frame || frame->width <= 0 || frame->height <= 0) { + std::cerr << "Invalid frame! Either null, incorrect format, or zero dimensions." << std::endl; + return cv::Mat(); + } + // Software decode handler + if (frame->format != AV_PIX_FMT_NV12) return avframeAnyToCvmat(frame); + + int width = frame->width; + int height = frame->height; + + // Store original NV12 dimensions for inference coordinate mapping + m_nv12OrigWidth = width; + m_nv12OrigHeight = height; + + // Display optimization: resize NV12 planes to max 1080p before color conversion. + // For 4K (3840x2160), this reduces pixel count by 4x: + // - 4K NV12→BGR: ~13-76ms on slow CPU (Xeon 2GHz), ~2ms on fast CPU + // - 1080p NV12→BGR: ~3-5ms on slow CPU, ~0.5ms on fast CPU + // The full-res NV12 is preserved separately for inference (m_currentNV12Frame). + const int MAX_DISPLAY_HEIGHT = 1080; + bool needsResize = (height > MAX_DISPLAY_HEIGHT); + + cv::Mat yPlane(height, width, CV_8UC1, frame->data[0], frame->linesize[0]); + cv::Mat uvPlane(height / 2, width / 2, CV_8UC2, frame->data[1], frame->linesize[1]); + + if (needsResize) { + // Scale to fit within 1080p, maintaining aspect ratio + double scale = (double)MAX_DISPLAY_HEIGHT / height; + int dstW = (int)(width * scale) & ~1; // even width for NV12 + int dstH = (int)(height * scale) & ~1; // even height for NV12 + + cv::Mat yResized, uvResized; + cv::resize(yPlane, yResized, cv::Size(dstW, dstH), 0, 0, cv::INTER_LINEAR); + cv::resize(uvPlane, uvResized, cv::Size(dstW / 2, dstH / 2), 0, 0, cv::INTER_LINEAR); + + cv::Mat bgrImage; + cv::cvtColorTwoPlane(yResized, uvResized, bgrImage, cv::COLOR_YUV2BGR_NV12); + + if (m_nImageQuality == 1) { + bgrImage.convertTo(bgrImage, -1, 255.0 / 219.0, -16.0 * 255.0 / 219.0); + } + return bgrImage; + } + + // No resize needed (already <= 1080p) + if (m_nImageQuality == 0) { + cv::Mat bgrImage; + cv::cvtColorTwoPlane(yPlane, uvPlane, bgrImage, cv::COLOR_YUV2BGR_NV12); + return bgrImage; + } + + // Quality path with range expansion + { + cv::Mat bgrImage; + cv::cvtColorTwoPlane(yPlane, uvPlane, bgrImage, cv::COLOR_YUV2BGR_NV12); + bgrImage.convertTo(bgrImage, -1, 255.0 / 219.0, -16.0 * 255.0 / 219.0); + return bgrImage; + } + } + catch (const std::exception& e) { + std::cerr << "Exception in avframeNV12ToCvMat: " << e.what() << std::endl; + return cv::Mat(); + } +} +cv::Mat CVideoPlayer::avframeToCVMat(const AVFrame* pFrame) { + std::lock_guard lock(_mutex); + try { + // 1. Validate input frame + if (!pFrame || !pFrame->data[0] || pFrame->width <= 10 || pFrame->height <= 10) { + std::cerr << "Invalid or empty frame data, or invalid dimensions." << std::endl; + return cv::Mat(); + } + + switch (pFrame->format) { + case AV_PIX_FMT_NV12: + return avframeNV12ToCvMat(pFrame); + case AV_PIX_FMT_YUVJ420P: + return avframeAnyToCvmat(pFrame); + default: + return avframeAnyToCvmat(pFrame); + + } + } + catch (const std::exception& e) { + std::cerr << "Exception in avframeToCvMat: " << e.what() << std::endl; + return cv::Mat(); // Return an empty matrix on error + } +} + +CVideoPlayer::CVideoPlayer() : + m_bVideoInited(FALSE) + , m_bAudioInited(FALSE) + , m_bPlaying(FALSE) + , m_bPaused(FALSE) + , m_nHWDecoding(HW_DECODING_AUTO)//(HW_DECODING_AUTO)// HW_DECODING_D3D11 //HW_DECODING_DISABLE + , m_bUpdown(FALSE) + , m_bSnapshot(FALSE) + , m_nSnapVideoFmt(AV_PIX_FMT_YUVJ420P) + , m_nVideoCodec(VIDEO_CODEC_NONE) + , m_nAudioCodec(AUDIO_CODEC_NONE) + , m_nSampleRate(0) + , m_nChannel(0) + , m_nBitPerSample(0) + , m_pSnapFrame(NULL) + , m_bRecording(FALSE) + , m_bNalFlag(FALSE) + , m_pAviCtx(NULL) + , m_pAudioListMutex(NULL) + , m_audioPlayFlag(FALSE) + //, m_audioPlayThread(0) + , m_pVideoListMutex(NULL) + , m_videoPlayFlag(FALSE) + //, m_videoPlayThread(0) + , m_nLastAudioPts(AV_NOPTS_VALUE) + , m_lastAudioTS(0) +{ + m_Bbox.x = 0; + m_Bbox.y = 0; + m_Bbox.width = 0; + m_Bbox.height = 0; + m_bCrop = false; + m_pRecordMutex = sys_os_create_mutex(); + m_lastJpegImage = ""; + m_jpegImage = ""; + m_pts = 0; + memset(&m_h26XParamSets, 0, sizeof(H26XParamSets)); + memset(&m_audioClock, 0, sizeof(HTCLOCK)); + memset(&m_videoClock, 0, sizeof(HTCLOCK)); + this->_tjInstance = tjInitCompress(); +} +CVideoPlayer::~CVideoPlayer() +{ + // Lock to ensure no other thread is mid-operation (getImage, getJpegImage, onVideoFrame) + // before we free resources. close() stops the decoder which prevents new callbacks. + { + std::lock_guard lock(_mutex); + close(); // Stop decoder first — prevents new onVideoFrame callbacks + g_frameQueue.clearQueue(); + if (swsCtx != nullptr) { + sws_freeContext(swsCtx); + swsCtx = nullptr; + } + if (m_nv12SwsCtx != nullptr) { + sws_freeContext(m_nv12SwsCtx); + m_nv12SwsCtx = nullptr; + } + if (this->_tjInstance) { + tjDestroy(this->_tjInstance); + this->_tjInstance = nullptr; + } + } + // _mutex is destroyed after this block — no other thread should be accessing this object +} + + +BOOL CVideoPlayer::open(std::string fileName) +{ + m_sFileName = fileName; + return TRUE; +} +BOOL CVideoPlayer::open(std::string _username, std::string _password, std::string _url) +{ + m_acct = _username; + m_pass = _password; + m_sFileName = _url; + return TRUE; +} +AVFrame* CVideoPlayer::getNV12Frame() { + // Return a CLONE so multiple consumers (tasks sharing the same stream) + // each get their own copy. The original m_currentNV12Frame stays valid + // until the next getImage() call overwrites it. + // (Previously used ownership transfer — only the first caller got NV12, + // and the second caller fell back to BGR.) + std::lock_guard lock(_mutex); + return m_currentNV12Frame ? av_frame_clone(m_currentNV12Frame) : nullptr; +} + +AVFrame* CVideoPlayer::getCudaHWFrame() { + // Return a clone of the CUDA HW frame captured by onVideoFrame(). + // Clone (not ownership transfer) because multiple callers may request + // the frame between onVideoFrame updates (e.g., during warmup when + // GetRTSPCVImage is called faster than the decode rate). + // extra_hw_frames=2 in the decoder provides surface pool headroom + // for the 3 concurrent clones (decoder + player + registry). + std::lock_guard lock(_mutex); + return m_currentCudaHWFrame ? av_frame_clone(m_currentCudaHWFrame) : nullptr; +} + +bool CVideoPlayer::isCudaHWAccel() const { + return m_pVideoDecoder && m_pVideoDecoder->isCudaHWAccel(); +} + +void CVideoPlayer::close() +{ + closeVideo(); + closeAudio(); + if (m_currentNV12Frame) { + av_frame_free(&m_currentNV12Frame); + m_currentNV12Frame = nullptr; + } + if (m_currentCudaHWFrame) { + av_frame_free(&m_currentCudaHWFrame); + m_currentCudaHWFrame = nullptr; + } + if (m_pSnapFrame) + { + av_frame_free(&m_pSnapFrame); + m_pSnapFrame = nullptr; + } + stopRecord(); + if (m_pRecordMutex) { + sys_os_destroy_sig_mutex(m_pRecordMutex); + m_pRecordMutex = NULL; + } +} + +void CVideoPlayer::setVolume(int volume) +{ + if (m_pAudioPlay) + { + m_pAudioPlay->setVolume(volume); + } +} +void CVideoPlayer::snapshot(int videofmt) +{ + m_bSnapshot = TRUE; + m_nSnapVideoFmt = videofmt; +} +BOOL CVideoPlayer::record(std::string baseName) +{ + if (m_bRecording) + { + return TRUE; + } + //std::string path = getRecordPath(); + std::string file = baseName;// path + "/" + getTempFile(baseName, ".avi"); + + m_sBaseName = baseName; + + m_pAviCtx = avi_write_open(file.c_str()); + if (NULL == m_pAviCtx) + { + log_print(HT_LOG_ERR, "%s, avi_write_open failed. %s\r\n", + __FUNCTION__, file.c_str()); + return FALSE; + } + + if (!onRecord()) + { + avi_write_close(m_pAviCtx); + m_pAviCtx = NULL; + + return FALSE; + } + + m_bRecording = TRUE; + + return m_bRecording; +} +void CVideoPlayer::stopRecord() +{ + sys_os_mutex_enter(m_pRecordMutex); + + m_bRecording = FALSE; + m_bNalFlag = FALSE; + + memset(&m_h26XParamSets, 0, sizeof(H26XParamSets)); + + if (m_pAviCtx) + { + avi_write_close(m_pAviCtx); + m_pAviCtx = NULL; + } + + sys_os_mutex_leave(m_pRecordMutex); +} +void CVideoPlayer::recordVideo(uint8* data, int len, uint32 ts, uint16 seq) +{ + int codec = VIDEO_CODEC_NONE; + + if (!memcmp(m_pAviCtx->v_fcc, "H264", 4)) + { + codec = VIDEO_CODEC_H264; + } + else if (!memcmp(m_pAviCtx->v_fcc, "H265", 4)) + { + codec = VIDEO_CODEC_H265; + } + + if ((VIDEO_CODEC_H264 == codec || VIDEO_CODEC_H265 == codec) && !m_bNalFlag) + { + if (avc_get_h26x_paramsets(data, len, codec, &m_h26XParamSets)) + { + avi_write_nalu(m_pAviCtx, + m_h26XParamSets.vps, m_h26XParamSets.vps_size, + m_h26XParamSets.sps, m_h26XParamSets.sps_size, + m_h26XParamSets.pps, m_h26XParamSets.pps_size); + m_bNalFlag = 1; + } + } + + recordVideoEx(data, len, ts, seq); + + if (recordSwitchCheck()) + { + recordFileSwitch(); + } +} +void CVideoPlayer::recordVideoEx(uint8* data, int len, uint32 ts, uint16 seq) +{ + AVICTX* p_avictx = m_pAviCtx; + + if (p_avictx->v_width == 0 || p_avictx->v_height == 0) + { + int codec = VIDEO_CODEC_NONE; + + if (memcmp(p_avictx->v_fcc, "H264", 4) == 0) + { + codec = VIDEO_CODEC_H264; + } + else if (memcmp(p_avictx->v_fcc, "H265", 4) == 0) + { + codec = VIDEO_CODEC_H265; + } + else if (memcmp(p_avictx->v_fcc, "JPEG", 4) == 0) + { + codec = VIDEO_CODEC_JPEG; + } + else if (memcmp(p_avictx->v_fcc, "MP4V", 4) == 0) + { + codec = VIDEO_CODEC_MP4; + } + + avc_parse_video_size(codec, data, len, &p_avictx->v_width, &p_avictx->v_height); + + if (p_avictx->v_width && p_avictx->v_height) + { + avi_update_header(p_avictx); + } + } + + int key = 0; + + if (memcmp(p_avictx->v_fcc, "H264", 4) == 0) + { + uint8 nalu_t = (data[4] & 0x1F); + key = (nalu_t == 5 || nalu_t == 7 || nalu_t == 8); + } + else if (memcmp(p_avictx->v_fcc, "H265", 4) == 0) + { + uint8 nalu_t = (data[4] >> 1) & 0x3F; + key = ((nalu_t >= 16 && nalu_t <= 21) || nalu_t == 32 || nalu_t == 33 || nalu_t == 34); + } + else if (memcmp(p_avictx->v_fcc, "MP4V", 4) == 0) + { + key = 1; + } + else if (memcmp(p_avictx->v_fcc, "JPEG", 4) == 0) + { + key = 1; + } + + avi_write_video(p_avictx, data, len, ts, key); +} +void CVideoPlayer::recordAudio(uint8* data, int len, uint32 ts, uint16 seq) +{ + AVICTX* p_avictx = m_pAviCtx; + + avi_write_audio(p_avictx, data, len, ts); + + if (recordSwitchCheck()) + { + recordFileSwitch(); + } +} +BOOL CVideoPlayer::recordSwitchCheck() +{ + uint64 tlen = avi_get_file_length(m_pAviCtx); + uint32 mtime = avi_get_media_time(m_pAviCtx); + uint32 recordSize = 0;// getRecordSize(); + if (recordSize == 0) + { + recordSize = 1048576; // max 1G file size + } + // Switch according to the recording size + if (tlen > recordSize * 1024) + { + return TRUE; + } + + uint32 recordTime = 0;// getRecordTime(); + + // Switch according to the recording duration + if (recordTime > 0 && mtime > recordTime * 1000) + { + return TRUE; + } + + return FALSE; +} +void CVideoPlayer::recordFileSwitch() +{ + AVICTX* p_ctx; + AVICTX* p_oldctx = m_pAviCtx; + + //std::string path = getRecordPath(); + std::string file = m_sBaseName;// path + "/" + getTempFile(m_sBaseName, ".avi"); + + p_ctx = avi_write_open(file.c_str()); + if (NULL == p_ctx) + { + return; + } + + p_ctx->ctxf_video = p_oldctx->ctxf_video; + p_ctx->ctxf_audio = p_oldctx->ctxf_audio; + + if (p_ctx->ctxf_video) + { + avi_calc_fps(p_oldctx); + avi_set_video_info(p_ctx, p_oldctx->v_fps, p_oldctx->v_width, p_oldctx->v_height, p_oldctx->v_fcc); + avi_set_video_extra_info(p_ctx, p_oldctx->v_extra, p_oldctx->v_extra_len); + } + + if (p_ctx->ctxf_audio) + { + avi_set_audio_info(p_ctx, p_oldctx->a_chns, p_oldctx->a_rate, p_oldctx->a_fmt); + avi_set_audio_extra_info(p_ctx, p_oldctx->a_extra, p_oldctx->a_extra_len); + } + + avi_write_close(p_oldctx); + + avi_update_header(p_ctx); + + m_pAviCtx = p_ctx; + + if (m_h26XParamSets.vps_size > 0 || + m_h26XParamSets.sps_size > 0 || + m_h26XParamSets.pps_size > 0) + { + avi_write_nalu(m_pAviCtx, + m_h26XParamSets.vps, m_h26XParamSets.vps_size, + m_h26XParamSets.sps, m_h26XParamSets.sps_size, + m_h26XParamSets.pps, m_h26XParamSets.pps_size); + } +} +BOOL CVideoPlayer::openVideo(enum AVCodecID codec, uint8* extradata, int extradata_size) +{ + if (m_bVideoInited) + { + return TRUE; + } + if (m_pVideoDecoder) + { + m_bVideoInited = m_pVideoDecoder->init(codec, extradata, extradata_size, m_nHWDecoding, m_nPreferredGpu); + } + + if (m_bVideoInited) + { + m_pVideoDecoder->setCallback(VideoDecoderCallback, this); + m_pVideoListMutex = sys_os_create_mutex(); + m_videoPlayFlag = TRUE; + //m_videoPlayThread = sys_os_create_thread((void*)VideoPlayThread, this); + } + m_nVideoCodec = to_video_codec(codec); + return m_bVideoInited; +} + + +BOOL CVideoPlayer::openVideo(int codec, uint8* extradata, int extradata_size) +{ + return openVideo(to_video_avcodecid(codec), extradata, extradata_size); +} +void CVideoPlayer::closeVideo() +{ + // Stop decoder outside the player lock to avoid the same lock-ordering + // deadlock as StopVideoDecoder() (see comment there). + CVideoDecoder* decoder = nullptr; + { + std::lock_guard lock(_mutex); + decoder = m_pVideoDecoder.get(); + } + if (decoder) + { + decoder->Stop(); + decoder->flush(); + } + // Now clean up resources under the lock + std::lock_guard lock(_mutex); + m_videoPlayFlag = FALSE; + if (m_pVideoListMutex) + { + sys_os_destroy_sig_mutex(m_pVideoListMutex); + m_pVideoListMutex = NULL; + } + if (!g_frameQueue.isEmpty())g_frameQueue.clearQueue(); + m_bVideoInited = FALSE; +} + + +void CVideoPlayer::StartVideoDecoder() { + std::lock_guard lock(_mutex); + // Clear queue but KEEP m_currentImage — it holds the last good frame + // which we'll return while the decoder stabilizes after restart + g_frameQueue.clearQueue(); + m_lastFrameSeq = 0; + m_bWaitingForKeyframe = true; // Skip frames until first keyframe + m_cleanFrameCount = 0; // Reset settle counter + if (m_pVideoDecoder) + { + m_pVideoDecoder->Start(); + } +} +void CVideoPlayer::StopVideoDecoder() { + // Get decoder pointer under lock, then release BEFORE calling decoder methods. + // This avoids a lock-ordering deadlock: + // Thread 1 (here): CVideoPlayer::_mutex -> CVideoDecoder::_mutex + // Thread 2 (TCP rx decode -> onVideoFrame callback): CVideoDecoder::_mutex -> CVideoPlayer::_mutex + CVideoDecoder* decoder = nullptr; + { + std::lock_guard lock(_mutex); + decoder = m_pVideoDecoder.get(); + } + if (decoder) + { + decoder->Stop(); + // Flush decoder to drain and discard any buffered frames, + // so stale reference frames don't corrupt the next session + decoder->flush(); + } + // Clear queue but KEEP m_currentImage and m_lastJpegImage — + // getImage()/getJpegImage() will return the last good frame while decoder stabilizes + { + std::lock_guard lock(_mutex); + g_frameQueue.clearQueue(); + m_lastFrameSeq = 0; + } +} +BOOL CVideoPlayer::openAudio(enum AVCodecID codec, int samplerate, int channels, int bitpersample) +{ + if (m_bAudioInited) + { + return TRUE; + } + if (m_pAudioDecoder) + { + m_bAudioInited = m_pAudioDecoder->init(codec, samplerate, channels, bitpersample); + } + + if (m_bAudioInited) + { + m_pAudioDecoder->setCallback(AudioDecoderCallback, this); + +#if __WINDOWS_OS__ + m_pAudioPlay = std::make_unique();/// new CWAudioPlay(); +#elif defined(IOS) + m_pAudioPlay = std::make_unique(); +#elif __LINUX_OS__ + m_pAudioPlay = std::make_unique(); +#endif + if (m_pAudioPlay) + { + m_pAudioPlay->startPlay(samplerate, channels); + } + + m_pAudioListMutex = sys_os_create_mutex(); + + m_audioPlayFlag = FALSE;//disable by default + //m_audioPlayThread = sys_os_create_thread((void*)AudioPlayThread, this); + } + + m_nAudioCodec = to_audio_codec(codec); + m_nSampleRate = samplerate; + m_nChannel = channels; + m_nBitPerSample = bitpersample; + + return m_bAudioInited; +} +void CVideoPlayer::enableAudio(bool status) { + if (status)m_audioPlayFlag = TRUE; + else m_audioPlayFlag = FALSE; +} +BOOL CVideoPlayer::openAudio(int codec, int samplerate, int channels, int bitpersample) +{ + return openAudio(to_audio_avcodecid(codec), samplerate, channels, bitpersample); +} +void CVideoPlayer::closeAudio() +{ + m_audioPlayFlag = FALSE; + if (m_pAudioListMutex) + { + sys_os_destroy_sig_mutex(m_pAudioListMutex); + m_pAudioListMutex = NULL; + } + + if (!a_frameQueue.isEmpty())a_frameQueue.clearQueue(); + m_bAudioInited = FALSE; +} +int CVideoPlayer::getVideoWidth() +{ + if (m_pVideoDecoder) + { + return m_pVideoDecoder->getWidth(); + } + + return 0; +} +int CVideoPlayer::getVideoHeight() +{ + if (m_pVideoDecoder) + { + return m_pVideoDecoder->getHeight(); + } + + return 0; +} +double CVideoPlayer::getFrameRate() +{ + if (m_pVideoDecoder) + { + return m_pVideoDecoder->getFrameRate(); + } + + return 0; +} +void CVideoPlayer::playVideo(uint8* data, int len, uint32 ts, uint16 seq) +{ + if (m_bRecording) + { + sys_os_mutex_enter(m_pRecordMutex); + recordVideo(data, len, ts, seq); + sys_os_mutex_leave(m_pRecordMutex); + } + + updateClock(&m_videoClock, ts, getVideoClock()); + + if (m_bVideoInited) + { + if (m_bPlaying) { + m_pVideoDecoder->decode(data, len, m_videoClock.SyncTime.tv_sec * 1000000 + m_videoClock.SyncTime.tv_usec); + } + } +} +void CVideoPlayer::playAudio(uint8* data, int len, uint32 ts, uint16 seq) +{ + if (m_bRecording) + { + sys_os_mutex_enter(m_pRecordMutex); + recordAudio(data, len, ts, seq); + sys_os_mutex_leave(m_pRecordMutex); + } + + updateClock(&m_audioClock, ts, getAudioClock()); + + if (m_bAudioInited) + { + m_pAudioDecoder->decode(data, len, m_audioClock.SyncTime.tv_sec * 1000000 + m_audioClock.SyncTime.tv_usec); + } +} +void CVideoPlayer::updateClock(HTCLOCK* clock, uint32 ts, int frequency) +{ + if (ts == 0) + { + return; + } + + if (clock->SyncTime.tv_sec == 0 && clock->SyncTime.tv_usec == 0) + { + clock->SyncTimestamp = ts; + gettimeofday(&clock->SyncTime, NULL); + } + + int timestampDiff = ts - clock->SyncTimestamp; + + // Divide this by the timestamp frequency to get real time: + double timeDiff = timestampDiff / (double)frequency; + + uint32 const million = 1000000; + uint32 seconds, uSeconds; + + if (timeDiff >= 0.0) + { + seconds = clock->SyncTime.tv_sec + (uint32)(timeDiff); + uSeconds = clock->SyncTime.tv_usec + (uint32)((timeDiff - (uint32)timeDiff) * million); + if (uSeconds >= million) + { + uSeconds -= million; + ++seconds; + } + } + else + { + timeDiff = -timeDiff; + seconds = clock->SyncTime.tv_sec - (uint32)(timeDiff); + uSeconds = clock->SyncTime.tv_usec - (uint32)((timeDiff - (uint32)timeDiff) * million); + if ((int)uSeconds < 0) + { + uSeconds += million; + --seconds; + } + } + // Save these as the new synchronization timestamp & time: + clock->SyncTimestamp = ts; + clock->SyncTime.tv_sec = seconds; + clock->SyncTime.tv_usec = uSeconds; +} +BOOL CVideoPlayer::initFrame(AVFrame*& frame, int width, int height, AVPixelFormat pixfmt) +{ + if (width == 0 || height == 0 || pixfmt == AV_PIX_FMT_NONE) + { + return FALSE; + } + + if (NULL == frame || frame->width != width || frame->height != height || frame->format != pixfmt) + { + if (frame) + { + av_frame_free(&frame); + } + + frame = av_frame_alloc(); + if (NULL == frame) + { + return FALSE; + } + + frame->format = pixfmt; + frame->width = width; + frame->height = height; + + if (0 != av_frame_get_buffer(frame, 0)) + { + av_frame_free(&frame); + return FALSE; + } + + av_frame_make_writable(frame); + } + + return TRUE; +} +BOOL CVideoPlayer::doSnapshot(AVFrame* frame) +{ + if (m_pSnapFrame) { + av_frame_free(&m_pSnapFrame); // Free the previous snapshot frame if it exists + } + + if (!initFrame(m_pSnapFrame, + frame->width, + frame->height, + to_avpixelformat(m_nSnapVideoFmt))) + { + return FALSE; + } + + if (NULL == convertFrame(frame, m_pSnapFrame, FALSE)) + { + return FALSE; + } + + return TRUE; +} +AVFrame* CVideoPlayer::convertFrame(AVFrame* srcframe, AVFrame* dstframe, BOOL updown) +{ + if (!srcframe || !dstframe) { + return NULL; + } + + SwsContext* _swsctx = sws_getContext(srcframe->width, + srcframe->height, + (enum AVPixelFormat)srcframe->format, + srcframe->width, + srcframe->height, + (enum AVPixelFormat)dstframe->format, + SWS_BICUBIC, NULL, NULL, NULL); + + if (!_swsctx) { + return NULL; + } + + if (updown) { + srcframe->data[0] += srcframe->linesize[0] * (srcframe->height - 1); + srcframe->linesize[0] *= -1; + srcframe->data[1] += srcframe->linesize[1] * (srcframe->height / 2 - 1); + srcframe->linesize[1] *= -1; + srcframe->data[2] += srcframe->linesize[2] * (srcframe->height / 2 - 1); + srcframe->linesize[2] *= -1; + } + + int ret = sws_scale(_swsctx, + srcframe->data, + srcframe->linesize, 0, + srcframe->height, + dstframe->data, + dstframe->linesize); + + sws_freeContext(_swsctx); // Free context after scaling attempt + + if (ret > 0) { + dstframe->pts = srcframe->pts; + dstframe->pkt_dts = srcframe->pkt_dts; + return dstframe; + } + else { + log_print(HT_LOG_ERR, "%s, sws_scale failed\r\n", __FUNCTION__); + return NULL; + } +} + + +void CVideoPlayer::onVideoFrame(AVFrame* frame) +{ + std::lock_guard lock(_mutex); // Protect against concurrent access + + if (!frame) return; // Check for null pointer + + if (m_bSnapshot) + { + if (doSnapshot(frame)) + { + m_bSnapshot = FALSE; + } + } + + if (m_bPlaying && m_videoPlayFlag) { + // Drop any frame with decode errors (corrupted reference frames, etc.) + if (frame->decode_error_flags != 0) { + fprintf(stderr, "[HWDecode] Dropping frame with decode errors (flags=0x%x)\n", frame->decode_error_flags); + return; + } + + // After start/restart, skip corrupted frames until first keyframe (IDR) arrives. + // HEVC/H.264 P/B frames received before the first I-frame will produce visual + // corruption ("Could not find ref with POC", green/grey artifacts). + if (m_bWaitingForKeyframe) { + if (frame->key_frame || frame->pict_type == AV_PICTURE_TYPE_I) { + m_bWaitingForKeyframe = false; + m_cleanFrameCount = 0; + fprintf(stderr, "[HWDecode] First keyframe received, settling for %d frames\n", SETTLE_FRAME_COUNT); + } else { + return; // Drop this frame — not yet safe to decode + } + } + + // Push frame to queue; during settle period getImage() will ignore the queue + // and keep returning the last good cached image + g_frameQueue.pushFrame(frame); // pushFrame() clones the frame internally + + // Capture CUDA HW frame for zero-copy inference. + // We're inside decode()'s lock scope (decoder._mutex held) AND onVideoFrame + // holds player._mutex — so this is the ONE place where both locks are held + // and we can safely clone the CUDA frame without deadlock risk. + // cloneCudaHWFrame_unlocked() is safe because decoder._mutex is already held. + if (m_pVideoDecoder && m_pVideoDecoder->isCudaHWAccel()) { + if (m_currentCudaHWFrame) av_frame_free(&m_currentCudaHWFrame); + m_currentCudaHWFrame = m_pVideoDecoder->cloneCudaHWFrame_unlocked(); + } + + // Track how many clean frames have arrived since keyframe + if (m_cleanFrameCount < SETTLE_FRAME_COUNT) { + m_cleanFrameCount++; + if (m_cleanFrameCount == SETTLE_FRAME_COUNT) { + fprintf(stderr, "[HWDecode] Settle complete, delivering new frames\n"); + } + } + } +} + + + +void CVideoPlayer::onAudioFrame(AVFrame* frame) +{ + // Support for audio playback + std::lock_guard lock(_mutex); // Protect against concurrent access + + if (!frame) return; // Check for null pointer + + if (m_bSnapshot) + { + if (doSnapshot(frame)) + { + m_bSnapshot = FALSE; + } + } + + if (m_bPlaying && m_audioPlayFlag) { + a_frameQueue.pushFrame(frame); // pushFrame() clones the frame internally + } +} + + +cv::Mat CVideoPlayer::getImage(int& width, int& height, int64_t& pts) { + try { + // Lock the mutex using RAII (ensures unlock even in exceptions) + std::lock_guard lock(_mutex); // Protect against concurrent access + + if (!m_bPlaying) { + // Return the last valid frame if playback is stopped + width = m_currentImage.cols; + height = m_currentImage.rows; + pts = m_pts; + return m_currentImage; // Shallow copy (reference counted, safe under mutex) + } + + // While waiting for keyframe or during settle period after restart, + // return the last good cached image to avoid showing corrupted frames + if (m_bWaitingForKeyframe || m_cleanFrameCount < SETTLE_FRAME_COUNT) { + width = m_currentImage.cols; + height = m_currentImage.rows; + pts = m_pts; + return m_currentImage; // Last good frame (may be empty on first-ever start) + } + + // Fast path: check if a new frame has arrived using sequence counter + // This avoids expensive av_frame_clone + NV12→BGR conversion when frame hasn't changed + uint64_t currentSeq = g_frameQueue.getSequence(); + if (currentSeq == m_lastFrameSeq && !m_currentImage.empty()) { + width = m_currentImage.cols; + height = m_currentImage.rows; + pts = m_pts; + return m_currentImage; // Same frame, skip all conversion + } + + // Get latest frame from queue + if (g_frameQueue.isEmpty()) { + width = m_currentImage.cols; + height = m_currentImage.rows; + pts = m_pts; + std::cerr << "No frame available in getImage()" << std::endl; + return cv::Mat(); // Return an empty cv::Mat() if no frame is available + } + AVFrame* frameToProcess = g_frameQueue.getLatestFrame(); + if (!frameToProcess) { + // If no frame available, return last valid image + width = m_currentImage.cols; + height = m_currentImage.rows; + pts = m_pts; + return cv::Mat(); // Return an empty cv::Mat() if no frame is available + } + + try { + // Convert AVFrame to cv::Mat + m_currentImage = avframeToCVMat(frameToProcess); + + // Update timestamp and sequence if conversion is successful + if (!m_currentImage.empty()) { + m_pts++; + m_lastFrameSeq = currentSeq; // Mark this sequence as processed + } + } + catch (const std::exception& e) { + std::cerr << "Exception while converting AVFrame to cv::Mat: " << e.what() << std::endl; + } + + // Preserve raw YUV/NV12 frame for GPU fast-path inference + // (NV12 from HW decode, YUV420P/YUVJ420P from SW decode) + if (frameToProcess && + (frameToProcess->format == AV_PIX_FMT_NV12 || + frameToProcess->format == AV_PIX_FMT_YUV420P || + frameToProcess->format == AV_PIX_FMT_YUVJ420P)) { + if (m_currentNV12Frame) av_frame_free(&m_currentNV12Frame); + m_currentNV12Frame = av_frame_clone(frameToProcess); + } + + // Free the cloned frame to avoid memory leaks + av_frame_free(&frameToProcess); + + // Update frame dimensions and PTS + width = m_currentImage.cols; + height = m_currentImage.rows; + pts = m_pts; + + // Return the processed image (shallow copy — caller gets reference-counted Mat) + return m_currentImage; + } + catch (const std::exception& e) { + std::cerr << "Unexpected exception in getImage(): " << e.what() << std::endl; + return cv::Mat(); // Return an empty cv::Mat if an exception occurs + } + catch (...) { + std::cerr << "Unknown exception in getImage()" << std::endl; + return cv::Mat(); // Return an empty cv::Mat if an exception occurs + + } +} + +std::string CVideoPlayer::getJpegImage(int& width, int& height, int64_t& pts) { + try { + // Use same _mutex as getImage() to protect shared state consistently + // recursive_mutex allows nested calls to avframeToJpegString → _mutex + std::lock_guard lock(_mutex); + + // While waiting for keyframe or during settle period after restart, + // return the last good cached JPEG to avoid showing corrupted frames + if (m_bWaitingForKeyframe || m_cleanFrameCount < SETTLE_FRAME_COUNT) { + width = m_Width; + height = m_Height; + pts = m_pts; + return m_lastJpegImage; // Last good JPEG (may be empty on first-ever start) + } + + AVFrame* frameToProcess = g_frameQueue.getLatestFrame(); // Get a safe copy + if (!frameToProcess) { + return m_lastJpegImage; // Return the last valid JPEG image if no frame is available + } + + try { + if (frameToProcess->format == AV_PIX_FMT_NV12) { + m_jpegImage = avframeToJpegString(frameToProcess); // Convert frame to JPEG from NV12 + } + else { + m_jpegImage = avframeYUVJ420PToJpegString(frameToProcess); // Convert frame to JPEG from YUVJ420P + } + } + catch (const std::exception& e) { + std::cerr << "Exception while converting AVFrame to JPEG string: " << e.what() << std::endl; + av_frame_free(&frameToProcess); + return m_lastJpegImage; + } + + av_frame_free(&frameToProcess); + + if (m_pts < INT64_MAX) { + m_pts++; + } + else { + m_pts = 0; // Reset to zero when max is reached + } + + // Update the width, height, and pts + width = m_Width; + height = m_Height; + pts = m_pts; + + if (!m_jpegImage.empty()) { + m_lastJpegImage = std::move(m_jpegImage); // Move instead of copy + } + + // Return the most recent valid JPEG image + return m_lastJpegImage; + } + catch (const std::exception& e) { + std::cerr << "Unexpected exception in getJpegImage(): " << e.what() << std::endl; + } + catch (...) { + std::cerr << "Unknown exception in getJpegImage()" << std::endl; + } + + // If any exception occurs, return the last valid JPEG image + return m_lastJpegImage; +} + diff --git a/MediaClient/MediaClient/media/video_player.h b/MediaClient/MediaClient/media/video_player.h new file mode 100644 index 0000000..a860384 --- /dev/null +++ b/MediaClient/MediaClient/media/video_player.h @@ -0,0 +1,340 @@ + +#ifndef VIDEO_PLAYER_H +#define VIDEO_PLAYER_H + +#include "sys_inc.h" +#include "hqueue.h" +#include "video_decoder.h" +#include "audio_decoder.h" +#include "audio_play.h" +#include "avi_write.h" +#include "media_util.h" +#include +#include +#include +#include +#include +#include + +typedef struct +{ + uint32 SyncTimestamp; + struct timeval SyncTime; +} HTCLOCK; + +typedef std::list FRAMELIST; + +// Thread-safe queue for AVFrame +class FrameQueue { +private: + std::queue frameQueue; + std::mutex queueMutex; + const size_t maxFrames = 20; // Increased buffer size for better performance + uint64_t m_frameSeq = 0; // Sequence counter — increments on each new frame push + +public: + // Push a new frame to the queue (removes oldest if full) + void pushFrame(AVFrame* newFrame) { + if (!newFrame) return; + + std::lock_guard lock(queueMutex); + + // Clone the frame to ensure proper ownership transfer + AVFrame* frameCopy = av_frame_clone(newFrame); + if (!frameCopy) { + std::cerr << "Failed to clone AVFrame!" << std::endl; + return; + } + + frameQueue.push(frameCopy); + m_frameSeq++; // New frame arrived + + // If queue exceeds max size, remove the oldest frame + if (frameQueue.size() > maxFrames) { + AVFrame* oldFrame = frameQueue.front(); + frameQueue.pop(); + av_frame_free(&oldFrame); + } + } + + // Get current sequence number (check if new frames arrived) + uint64_t getSequence() { + std::lock_guard lock(queueMutex); + return m_frameSeq; + } + + // Retrieve latest frame (returns a clone for thread safety) + AVFrame* getLatestFrame() { + std::lock_guard lock(queueMutex); + + if (frameQueue.empty()) { + return nullptr; // No frames available + } + + // Clone the latest frame before returning it + return av_frame_clone(frameQueue.back()); + } + + // Retrieve and remove the oldest frame from the queue + AVFrame* popFrame() { + std::lock_guard lock(queueMutex); + + if (frameQueue.empty()) { + return nullptr; + } + + AVFrame* frontFrame = frameQueue.front(); + frameQueue.pop(); + return frontFrame; // Caller must free the returned frame + } + + // Check if the queue is empty + bool isEmpty() { + std::lock_guard lock(queueMutex); + return frameQueue.empty(); + } + + // Clear the queue (e.g., when shutting down) + void clearQueue() { + std::lock_guard lock(queueMutex); + while (!frameQueue.empty()) { + AVFrame* frame = frameQueue.front(); + frameQueue.pop(); + av_frame_free(&frame); + } + m_frameSeq = 0; + } +}; + +class CVideoPlayer +{ + +public: + CVideoPlayer(); + virtual ~CVideoPlayer(); + virtual BOOL open(std::string fileName); + virtual BOOL open(std::string username, std::string password, std::string url); + virtual BOOL play() = 0; + virtual void stop() = 0; + virtual BOOL pause() = 0; + virtual void close(); + virtual BOOL seek(int pos) { return FALSE; } + virtual BOOL isPlaying() { return m_bPlaying; } + virtual BOOL isPaused() { return m_bPaused; } + virtual void setVolume(int volume); + virtual void snapshot(int videofmt); + virtual BOOL record(std::string baseName); + virtual void stopRecord(); + virtual BOOL isRecording() { return m_bRecording; } + virtual BOOL onRecord() { return FALSE; } + virtual int getVideoClock() { return 1000; } + virtual int getAudioClock() { return 1000; } + //virtual void setWindowSize(int size); + virtual int64 getElapse() { return 0; } + virtual int64 getDuration() { return 0; } + virtual int getVideoCodec() { return m_nVideoCodec; } + virtual int getAudioCodec() { return m_nAudioCodec; } + + virtual void setAuthInfo(std::string acct, std::string pass) { m_acct = acct; m_pass = pass; } + //virtual void setRenderMode(int mode) { m_nRenderMode = mode; } + virtual void setHWDecoding(int mode, int preferredGpu = -1) { m_nHWDecoding = mode; m_nPreferredGpu = preferredGpu; } + virtual bool isHWDecodingActive() const { + return m_pVideoDecoder && m_pVideoDecoder->isHardwareDecoderEnabled(); + } + virtual int getHWDecodingGpuIndex() const { + return m_pVideoDecoder ? m_pVideoDecoder->getHWGpuIndex() : -1; + } + // Image quality mode: 0=fast (OpenCV BT.601, ~2ms), 1=quality (sws BT.709+range, ~12ms) + virtual void setImageQuality(int mode) { m_nImageQuality = mode; } + virtual void setRtpMulticast(BOOL flag) {} + virtual void setRtpOverUdp(BOOL flag) {} + +#ifdef OVER_HTTP + virtual void setRtspOverHttp(int flag, int port) {} +#endif + +#ifdef OVER_WEBSOCKET + virtual void setRtspOverWs(int flag, int port) {} +#endif + +#ifdef BACKCHANNEL + virtual int getBCFlag() { return 0; } + virtual void setBCFlag(int flag) {} + virtual int getBCDataFlag() { return 0; } + virtual void setBCDataFlag(int flag) {} + virtual void setAudioDevice(int index) {} +#endif + +#ifdef REPLAY + virtual int getReplayFlag() { return 0; } + virtual void setReplayFlag(int flag) {} + virtual void setScale(double scale) {} + virtual void setRateControlFlag(int flag) {} + virtual void setImmediateFlag(int flag) {} + virtual void setFramesFlag(int flag, int interval) {} + virtual void setReplayRange(time_t start, time_t end) {} +#endif + + BOOL openVideo(int codec, uint8* extradata = NULL, int extradata_size = 0); + BOOL openVideo(enum AVCodecID codec, uint8* extradata = NULL, int extradata_size = 0); + void closeVideo(); + BOOL openAudio(int codec, int samplerate, int channels, int bitpersample = 0); + BOOL openAudio(enum AVCodecID codec, int samplerate, int channels, int bitpersample = 0); + void closeAudio(); + void enableAudio(bool status); + void playVideo(uint8* data, int len, uint32 ts, uint16 seq); + void playAudio(uint8* data, int len, uint32 ts, uint16 seq); + + void recordVideo(uint8* data, int len, uint32 ts, uint16 seq); + void recordAudio(uint8* data, int len, uint32 ts, uint16 seq); + + int getVideoWidth(); + int getVideoHeight(); + int getOriginalWidth() { return m_nv12OrigWidth; } // Full NV12 resolution (before display downscale) + int getOriginalHeight() { return m_nv12OrigHeight; } // Full NV12 resolution (before display downscale) + double getFrameRate(); + int getSampleRate() { return m_nSampleRate; } + int getChannel() { return m_nChannel; } + + void onVideoFrame(AVFrame* frame); + void onAudioFrame(AVFrame* frame); + void StartVideoDecoder(); + void StopVideoDecoder(); + + + cv::Mat getImage(int& width, int& height, int64_t& pts);// Get image + std::string getJpegImage(int& width, int& height, int64_t& pts);// Get image + AVFrame* getNV12Frame(); // Transfers ownership of NV12/YUV frame for GPU fast-path (caller must av_frame_free) + AVFrame* getCudaHWFrame(); // Returns clone of CUDA HW frame (device ptrs); caller must av_frame_free + bool isCudaHWAccel() const; + void setBbox(cv::Rect bbox); + void setCrop(bool crop); +protected: + void updateClock(HTCLOCK* clock, uint32 ts, int frequency); + BOOL initFrame(AVFrame*& frame, int width, int height, AVPixelFormat pixfmt); + BOOL doSnapshot(AVFrame* srcframe); + AVFrame* convertFrame(AVFrame* srcframe, AVFrame* dstframe, BOOL updown); + void recordVideoEx(uint8* data, int len, uint32 ts, uint16 seq); + BOOL recordSwitchCheck(); + void recordFileSwitch(); + AVFrame* cropFrame(const AVFrame* srcFrame, cv::Rect bBox, bool cropFlag); + + cv::Mat avframeAnyToCvmat(const AVFrame* frame); + cv::Mat avframeNV12ToCvMat(const AVFrame* frame); + cv::Mat avframeYUVJ420PToCvmat(const AVFrame* frame); + cv::Mat avframeToCVMat(const AVFrame* frame); + + // YUVJ420P to JPEG + std::string avframeYUVJ420PToJpegString(const AVFrame* pFrame); + std::string avframeYUVJ420PToJpegStringUsingTurboJPEG(const AVFrame* pFrame); + std::string avframeYUVJ420PToJpegStringUsingFFMpeg(const AVFrame* pFrame); + AVFrame* convertNV12ToYUVJ420P(const AVFrame* nv12Frame); + std::string encodeYUVJ420PToJPEG(AVFrame* frame, int quality = 90); + + //Direct conversion from NV12 to JPEG + std::string avframeToJpegString(const AVFrame* pFrame); + std::string encodeNV12ToJPEG_TurboJPEG(const AVFrame* frame, int quality = 90); + std::string encodeNV12ToJPEG_FFmpeg(const AVFrame* pFrame, int quality = 90); + + + // Check if frame are identical + bool areFramesIdentical(AVFrame* frame1, AVFrame* frame2); +protected: + // Use a constant for the maximum queue size + //const int MAX_VIDEO_FRAMES = 10; + //const int MAX_AUDIO_FRAMES = 2; + BOOL m_bVideoInited; + BOOL m_bAudioInited; + tjhandle _tjInstance; + + std::recursive_mutex _mutex; + + std::unique_ptr m_pVideoDecoder = std::make_unique(); + std::unique_ptr m_pAudioDecoder = std::make_unique(); + std::unique_ptr m_pAudioPlay = nullptr; + + cv::Mat m_currentImage; + AVFrame* m_currentNV12Frame = nullptr; // Preserved NV12/YUV frame for GPU fast-path + AVFrame* m_currentCudaHWFrame = nullptr; // CUDA HW frame with device ptrs for zero-copy + int m_Width; + int m_Height; + int m_nv12OrigWidth = 0; // Original NV12 frame width (before display resize) + int m_nv12OrigHeight = 0; // Original NV12 frame height (before display resize) + int64_t m_pts; + uint64_t m_lastFrameSeq = 0; // Last processed frame sequence number + bool m_bWaitingForKeyframe = true; // Skip frames until first keyframe after start/restart + int m_cleanFrameCount = 0; // Count of clean frames after keyframe + static const int SETTLE_FRAME_COUNT = 5; // Number of clean frames before delivering new frames + + BOOL m_bPlaying; + BOOL m_bPaused; + + std::string m_acct; + std::string m_pass; + std::string m_sFileName; + std::string m_sBaseName; + std::string m_jpegImage; + std::string m_lastJpegImage; + + int m_nHWDecoding; + int m_nPreferredGpu = -1; // -1=auto (least-loaded), >=0 = prefer this GPU for NVDEC + int m_nImageQuality = 0; // 0=fast (default), 1=quality BT.709 + //AVPixelFormat m_nDstVideoFmt; + BOOL m_bUpdown; + BOOL m_bSnapshot; + int m_nSnapVideoFmt; + + H26XParamSets m_h26XParamSets; + + int m_nVideoCodec; + int m_nAudioCodec; + int m_nSampleRate; + int m_nChannel; + int m_nBitPerSample; + + AVFrame* m_pSnapFrame; + FrameQueue g_frameQueue; + FrameQueue a_frameQueue; + + BOOL m_bRecording; + BOOL m_bNalFlag; + AVICTX* m_pAviCtx; + void* m_pRecordMutex; + + HTCLOCK m_audioClock; + void* m_pAudioListMutex; + //FRAMELIST m_audioFrameList; + BOOL m_audioPlayFlag; + //pthread_t m_audioPlayThread; + + HTCLOCK m_videoClock; + void* m_pVideoListMutex; + //FRAMELIST m_videoFrameList; + BOOL m_videoPlayFlag; + //pthread_t m_videoPlayThread; + + uint64 m_nLastAudioPts; + time_t m_lastAudioTS; + cv::Rect m_Bbox; + bool m_bCrop; + SwsContext* swsCtx = nullptr; // Shared SwsContext + int lastWidth = 0, lastHeight = 0; + AVPixelFormat lastPixFmt = AV_PIX_FMT_NONE; + AVPixelFormat lastOutPixFmt = AV_PIX_FMT_NONE; + + // Dedicated NV12→BGR context with correct color space (BT.709 for HD/4K) + SwsContext* m_nv12SwsCtx = nullptr; + int m_nv12LastWidth = 0, m_nv12LastHeight = 0; + int m_nv12LastColorspace = -1; + int m_nv12LastRange = -1; + + void initSwsContext(int width, int height, AVPixelFormat pixFmt, AVPixelFormat outputPixFmt = AV_PIX_FMT_YUVJ420P); + void initNV12SwsContext(const AVFrame* frame); + void cropPlane(const AVFrame* srcFrame, AVFrame* croppedFrame, int planeIndex, int offsetX, int offsetY, int subsampleX, int subsampleY); + bool cropFrameData(const AVFrame* srcFrame, AVFrame* croppedFrame, const cv::Rect& bBox); +}; + +#endif // end of VIDEO_PLAYER_H + + + diff --git a/MediaClient/MediaClient/media/video_player.mm b/MediaClient/MediaClient/media/video_player.mm new file mode 100644 index 0000000..157b524 --- /dev/null +++ b/MediaClient/MediaClient/media/video_player.mm @@ -0,0 +1,1101 @@ +/*************************************************************************************** + * + * 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 "video_player.h" +#include "utils.h" +#include "media_util.h" +#include "media_parse.h" +#include "media_codec.h" +#include "h264.h" +#include "h265.h" + +extern "C" +{ +#include +#include +#include +#include +#include +#include +#include +#include +} + +#if __WINDOWS_OS__ +#include "video_render_d3d.h" +#include "video_render_gdi.h" +#include "audio_play_win.h" +#elif defined(IOS) +#include "video_render_sdl.h" +#include "audio_play_mac.h" +#include +#elif __LINUX_OS__ +#include "video_render_sdl.h" +#include "audio_play_qt.h" +#endif + +void VideoDecoderCallback(AVFrame * frame, void * userdata) +{ + CVideoPlayer * pPlayer = (CVideoPlayer *) userdata; + + pPlayer->onVideoFrame(frame); +} + +void AudioDecoderCallback(AVFrame * frame, void * userdata) +{ + CVideoPlayer * pPlayer = (CVideoPlayer *) userdata; + + pPlayer->onAudioFrame(frame); +} + +void * AudioPlayThread(void * argv) +{ + CVideoPlayer * pPlayer = (CVideoPlayer *) argv; + + pPlayer->audioPlayThread(); + + return NULL; +} + +void * VideoPlayThread(void * argv) +{ + CVideoPlayer * pPlayer = (CVideoPlayer *) argv; + + pPlayer->videoPlayThread(); + + return NULL; +} + +CVideoPlayer::CVideoPlayer(QObject * parent) +: QObject(parent) +, m_bVideoInited(FALSE) +, m_bAudioInited(FALSE) +, m_pVideoDecoder(NULL) +, m_pAudioDecoder(NULL) +, m_pVideoRender(NULL) +, m_pAudioPlay(NULL) +, m_bPlaying(FALSE) +, m_bPaused(FALSE) +, m_nVideoWnd(0) +, m_bSizeChanged(FALSE) +, m_nRenderMode(RENDER_MODE_KEEP) +, m_nHWDecoding(HW_DECODING_AUTO) +, m_nDstVideoFmt(AV_PIX_FMT_YUV420P) +, m_bUpdown(FALSE) +, m_bSnapshot(FALSE) +, m_nSnapVideoFmt(VIDEO_FMT_BGR24) +, m_nVideoCodec(VIDEO_CODEC_NONE) +, m_nAudioCodec(AUDIO_CODEC_NONE) +, m_nSampleRate(0) +, m_nChannel(0) +, m_nBitPerSample(0) +, m_pSnapFrame(NULL) +, m_pRenderFrame(NULL) +, m_bRecording(FALSE) +, m_bNalFlag(FALSE) +, m_pAviCtx(NULL) +, m_pAudioListMutex(NULL) +, m_audioPlayFlag(FALSE) +, m_audioPlayThread(0) +, m_pVideoListMutex(NULL) +, m_videoPlayFlag(FALSE) +, m_videoPlayThread(0) +, m_nLastAudioPts(AV_NOPTS_VALUE) +, m_lastAudioTS(0) +{ + m_pRecordMutex = sys_os_create_mutex(); + + memset(&m_h26XParamSets, 0, sizeof(H26XParamSets)); + memset(&m_audioClock, 0, sizeof(HTCLOCK)); + memset(&m_videoClock, 0, sizeof(HTCLOCK)); +} + +CVideoPlayer::~CVideoPlayer() +{ + close(); +} + +BOOL CVideoPlayer::open(QString fileName, WId hWnd) +{ + m_sFileName = fileName; + m_nVideoWnd = hWnd; + + return TRUE; +} + +void CVideoPlayer::close() +{ + closeVideo(); + closeAudio(); + + if (m_pSnapFrame) + { + av_frame_free(&m_pSnapFrame); + } + + if (m_pRenderFrame) + { + av_frame_free(&m_pRenderFrame); + } + + stopRecord(); + + sys_os_destroy_sig_mutex(m_pRecordMutex); + m_pRecordMutex = NULL; +} + +void CVideoPlayer::setVolume(int volume) +{ + if (m_pAudioPlay) + { + m_pAudioPlay->setVolume(volume); + } +} + +void CVideoPlayer::snapshot(int videofmt) +{ + m_bSnapshot = TRUE; + m_nSnapVideoFmt = videofmt; +} + +BOOL CVideoPlayer::record(QString baseName) +{ + if (m_bRecording) + { + return TRUE; + } + + QString path = getRecordPath(); + QString file = path + "/" + getTempFile(baseName, ".avi"); + + m_sBaseName = baseName; + + m_pAviCtx = avi_write_open(file.toLocal8Bit().toStdString().c_str()); + if (NULL == m_pAviCtx) + { + log_print(HT_LOG_ERR, "%s, avi_write_open failed. %s\r\n", + __FUNCTION__, file.toLocal8Bit().toStdString().c_str()); + return FALSE; + } + + if (!onRecord()) + { + avi_write_close(m_pAviCtx); + m_pAviCtx = NULL; + + return FALSE; + } + + m_bRecording = TRUE; + + return m_bRecording; +} + +void CVideoPlayer::stopRecord() +{ + sys_os_mutex_enter(m_pRecordMutex); + + m_bRecording = FALSE; + m_bNalFlag = FALSE; + + memset(&m_h26XParamSets, 0, sizeof(H26XParamSets)); + + if (m_pAviCtx) + { + avi_write_close(m_pAviCtx); + m_pAviCtx = NULL; + } + + sys_os_mutex_leave(m_pRecordMutex); +} + +void CVideoPlayer::recordVideo(uint8 * data, int len, uint32 ts, uint16 seq) +{ + int codec = VIDEO_CODEC_NONE; + + if (!memcmp(m_pAviCtx->v_fcc, "H264", 4)) + { + codec = VIDEO_CODEC_H264; + } + else if (!memcmp(m_pAviCtx->v_fcc, "H265", 4)) + { + codec = VIDEO_CODEC_H265; + } + + if ((VIDEO_CODEC_H264 == codec || VIDEO_CODEC_H265 == codec) && !m_bNalFlag) + { + if (avc_get_h26x_paramsets(data, len, codec, &m_h26XParamSets)) + { + avi_write_nalu(m_pAviCtx, + m_h26XParamSets.vps, m_h26XParamSets.vps_size, + m_h26XParamSets.sps, m_h26XParamSets.sps_size, + m_h26XParamSets.pps, m_h26XParamSets.pps_size); + m_bNalFlag = 1; + } + } + + recordVideoEx(data, len, ts, seq); + + if (recordSwitchCheck()) + { + recordFileSwitch(); + } +} + +void CVideoPlayer::recordVideoEx(uint8 * data, int len, uint32 ts, uint16 seq) +{ + AVICTX * p_avictx = m_pAviCtx; + + if (p_avictx->v_width == 0 || p_avictx->v_height == 0) + { + int codec = VIDEO_CODEC_NONE; + + if (memcmp(p_avictx->v_fcc, "H264", 4) == 0) + { + codec = VIDEO_CODEC_H264; + } + else if (memcmp(p_avictx->v_fcc, "H265", 4) == 0) + { + codec = VIDEO_CODEC_H265; + } + else if (memcmp(p_avictx->v_fcc, "JPEG", 4) == 0) + { + codec = VIDEO_CODEC_JPEG; + } + else if (memcmp(p_avictx->v_fcc, "MP4V", 4) == 0) + { + codec = VIDEO_CODEC_MP4; + } + + avc_parse_video_size(codec, data, len, &p_avictx->v_width, &p_avictx->v_height); + + if (p_avictx->v_width && p_avictx->v_height) + { + avi_update_header(p_avictx); + } + } + + int key = 0; + + if (memcmp(p_avictx->v_fcc, "H264", 4) == 0) + { + uint8 nalu_t = (data[4] & 0x1F); + key = (nalu_t == 5 || nalu_t == 7 || nalu_t == 8); + } + else if (memcmp(p_avictx->v_fcc, "H265", 4) == 0) + { + uint8 nalu_t = (data[4] >> 1) & 0x3F; + key = ((nalu_t >= 16 && nalu_t <= 21) || nalu_t == 32 || nalu_t == 33 || nalu_t == 34); + } + else if (memcmp(p_avictx->v_fcc, "MP4V", 4) == 0) + { + key = 1; + } + else if (memcmp(p_avictx->v_fcc, "JPEG", 4) == 0) + { + key = 1; + } + + avi_write_video(p_avictx, data, len, ts, key); +} + +void CVideoPlayer::recordAudio(uint8 * data, int len, uint32 ts, uint16 seq) +{ + AVICTX * p_avictx = m_pAviCtx; + + avi_write_audio(p_avictx, data, len, ts); + + if (recordSwitchCheck()) + { + recordFileSwitch(); + } +} + +BOOL CVideoPlayer::recordSwitchCheck() +{ + uint64 tlen = avi_get_file_length(m_pAviCtx); + uint32 mtime = avi_get_media_time(m_pAviCtx); + + uint32 recordSize = getRecordSize(); + if (recordSize == 0) + { + recordSize = 1048576; // max 1G file size + } + + // Switch according to the recording size + if (tlen > recordSize * 1024) + { + return TRUE; + } + + uint32 recordTime = getRecordTime(); + + // Switch according to the recording duration + if (recordTime > 0 && mtime > recordTime * 1000) + { + return TRUE; + } + + return FALSE; +} + +void CVideoPlayer::recordFileSwitch() +{ + AVICTX * p_ctx; + AVICTX * p_oldctx = m_pAviCtx; + + QString path = getRecordPath(); + QString file = path + "/" + getTempFile(m_sBaseName, ".avi"); + + p_ctx = avi_write_open(file.toLocal8Bit().toStdString().c_str()); + if (NULL == p_ctx) + { + return; + } + + p_ctx->ctxf_video = p_oldctx->ctxf_video; + p_ctx->ctxf_audio = p_oldctx->ctxf_audio; + + if (p_ctx->ctxf_video) + { + avi_calc_fps(p_oldctx); + avi_set_video_info(p_ctx, p_oldctx->v_fps, p_oldctx->v_width, p_oldctx->v_height, p_oldctx->v_fcc); + avi_set_video_extra_info(p_ctx, p_oldctx->v_extra, p_oldctx->v_extra_len); + } + + if (p_ctx->ctxf_audio) + { + avi_set_audio_info(p_ctx, p_oldctx->a_chns, p_oldctx->a_rate, p_oldctx->a_fmt); + avi_set_audio_extra_info(p_ctx, p_oldctx->a_extra, p_oldctx->a_extra_len); + } + + avi_write_close(p_oldctx); + + avi_update_header(p_ctx); + + m_pAviCtx = p_ctx; + + if (m_h26XParamSets.vps_size > 0 || + m_h26XParamSets.sps_size > 0 || + m_h26XParamSets.pps_size > 0) + { + avi_write_nalu(m_pAviCtx, + m_h26XParamSets.vps, m_h26XParamSets.vps_size, + m_h26XParamSets.sps, m_h26XParamSets.sps_size, + m_h26XParamSets.pps, m_h26XParamSets.pps_size); + } +} + +BOOL CVideoPlayer::openVideo(enum AVCodecID codec, uint8 * extradata, int extradata_size) +{ + if (m_bVideoInited) + { + return TRUE; + } + + m_pVideoDecoder = new CVideoDecoder(); + if (m_pVideoDecoder) + { + m_bVideoInited = m_pVideoDecoder->init(codec, extradata, extradata_size, m_nHWDecoding, m_nPreferredGpu); + } + + if (m_bVideoInited) + { + m_pVideoDecoder->setCallback(VideoDecoderCallback, this); + + m_pVideoListMutex = sys_os_create_mutex(); + + m_videoPlayFlag = TRUE; + m_videoPlayThread = sys_os_create_thread((void *)VideoPlayThread, this); + } + + m_nVideoCodec = to_video_codec(codec); + + return m_bVideoInited; +} + +BOOL CVideoPlayer::openVideo(int codec, uint8 * extradata, int extradata_size) +{ + return openVideo(to_video_avcodecid(codec), extradata, extradata_size); +} + +void CVideoPlayer::closeVideo() +{ + m_videoPlayFlag = FALSE; + + // Wait for the video playback thread to exit + while (m_videoPlayThread) + { + usleep(10*1000); + } + + if (m_pVideoDecoder) + { + delete m_pVideoDecoder; + m_pVideoDecoder = NULL; + } + + if (m_pVideoRender) + { + delete m_pVideoRender; + m_pVideoRender = NULL; + } + + // Released video frame + while (m_videoFrameList.size() > 0) + { + AVFrame * pFrame = m_videoFrameList.front(); + + m_videoFrameList.pop_front(); + + av_frame_free(&pFrame); + } + + if (m_pVideoListMutex) + { + sys_os_destroy_sig_mutex(m_pVideoListMutex); + m_pVideoListMutex = NULL; + } + + m_bVideoInited = FALSE; +} + +BOOL CVideoPlayer::openAudio(enum AVCodecID codec, int samplerate, int channels, int bitpersample) +{ + if (m_bAudioInited) + { + return TRUE; + } + + m_pAudioDecoder = new CAudioDecoder(); + if (m_pAudioDecoder) + { + m_bAudioInited = m_pAudioDecoder->init(codec, samplerate, channels, bitpersample); + } + + if (m_bAudioInited) + { + m_pAudioDecoder->setCallback(AudioDecoderCallback, this); + +#if __WINDOWS_OS__ + m_pAudioPlay = new CWAudioPlay(); +#elif defined(IOS) + m_pAudioPlay = new CMAudioPlay(); +#elif __LINUX_OS__ + m_pAudioPlay = new CQAudioPlay(); +#endif + if (m_pAudioPlay) + { + m_pAudioPlay->startPlay(samplerate, channels); + } + + m_pAudioListMutex = sys_os_create_mutex(); + + m_audioPlayFlag = TRUE; + m_audioPlayThread = sys_os_create_thread((void *)AudioPlayThread, this); + } + + m_nAudioCodec = to_audio_codec(codec); + m_nSampleRate = samplerate; + m_nChannel = channels; + m_nBitPerSample = bitpersample; + + return m_bAudioInited; +} + +BOOL CVideoPlayer::openAudio(int codec, int samplerate, int channels, int bitpersample) +{ + return openAudio(to_audio_avcodecid(codec), samplerate, channels, bitpersample); +} + +void CVideoPlayer::closeAudio() +{ + m_audioPlayFlag = FALSE; + + // Wait for the audio playback thread to exit + while (m_audioPlayThread) + { + usleep(10*1000); + } + + if (m_pAudioDecoder) + { + delete m_pAudioDecoder; + m_pAudioDecoder = NULL; + } + + if (m_pAudioPlay) + { + delete m_pAudioPlay; + m_pAudioPlay = NULL; + } + + // Released audio frame + while (m_audioFrameList.size() > 0) + { + AVFrame * pFrame = m_audioFrameList.front(); + + m_audioFrameList.pop_front(); + + av_frame_free(&pFrame); + } + + if (m_pAudioListMutex) + { + sys_os_destroy_sig_mutex(m_pAudioListMutex); + m_pAudioListMutex = NULL; + } + + m_bAudioInited = FALSE; +} + +void CVideoPlayer::setWindowSize(QSize size) +{ + m_bSizeChanged = TRUE; + m_size = size; +} + +int CVideoPlayer::getVideoWidth() +{ + if (m_pVideoDecoder) + { + return m_pVideoDecoder->getWidth(); + } + + return 0; +} + +int CVideoPlayer::getVideoHeight() +{ + if (m_pVideoDecoder) + { + return m_pVideoDecoder->getHeight(); + } + + return 0; +} + +double CVideoPlayer::getFrameRate() +{ + if (m_pVideoDecoder) + { + return m_pVideoDecoder->getFrameRate(); + } + + return 0; +} + +void CVideoPlayer::playVideo(uint8 * data, int len, uint32 ts, uint16 seq) +{ + if (m_bRecording) + { + sys_os_mutex_enter(m_pRecordMutex); + recordVideo(data, len, ts, seq); + sys_os_mutex_leave(m_pRecordMutex); + } + + updateClock(&m_videoClock, ts, getVideoClock()); + + if (m_bVideoInited) + { + m_pVideoDecoder->decode(data, len, m_videoClock.SyncTime.tv_sec * 1000000 + m_videoClock.SyncTime.tv_usec); + } +} + +void CVideoPlayer::playAudio(uint8 * data, int len, uint32 ts, uint16 seq) +{ + if (m_bRecording) + { + sys_os_mutex_enter(m_pRecordMutex); + recordAudio(data, len, ts, seq); + sys_os_mutex_leave(m_pRecordMutex); + } + + updateClock(&m_audioClock, ts, getAudioClock()); + + if (m_bAudioInited) + { + m_pAudioDecoder->decode(data, len, m_audioClock.SyncTime.tv_sec * 1000000 + m_audioClock.SyncTime.tv_usec); + } +} + +void CVideoPlayer::updateClock(HTCLOCK * clock, uint32 ts, int frequency) +{ + if (ts == 0) + { + return; + } + + if (clock->SyncTime.tv_sec == 0 && clock->SyncTime.tv_usec == 0) + { + clock->SyncTimestamp = ts; + gettimeofday(&clock->SyncTime, NULL); + } + + int timestampDiff = ts - clock->SyncTimestamp; + + // Divide this by the timestamp frequency to get real time: + double timeDiff = timestampDiff / (double)frequency; + + uint32 const million = 1000000; + uint32 seconds, uSeconds; + + if (timeDiff >= 0.0) + { + seconds = clock->SyncTime.tv_sec + (uint32)(timeDiff); + uSeconds = clock->SyncTime.tv_usec + (uint32)((timeDiff - (uint32)timeDiff)*million); + if (uSeconds >= million) + { + uSeconds -= million; + ++seconds; + } + } + else + { + timeDiff = -timeDiff; + seconds = clock->SyncTime.tv_sec - (uint32)(timeDiff); + uSeconds = clock->SyncTime.tv_usec - (uint32)((timeDiff - (uint32)timeDiff)*million); + if ((int)uSeconds < 0) + { + uSeconds += million; + --seconds; + } + } + + // Save these as the new synchronization timestamp & time: + clock->SyncTimestamp = ts; + clock->SyncTime.tv_sec = seconds; + clock->SyncTime.tv_usec = uSeconds; +} + +BOOL CVideoPlayer::initFrame(AVFrame *& frame, int width, int height, AVPixelFormat pixfmt) +{ + if (width == 0 || height == 0 || pixfmt == AV_PIX_FMT_NONE) + { + return FALSE; + } + + if (NULL == frame || frame->width != width || frame->height != height || frame->format != pixfmt) + { + if (frame) + { + av_frame_free(&frame); + } + + frame = av_frame_alloc(); + if (NULL == frame) + { + return FALSE; + } + + frame->format = pixfmt; + frame->width = width; + frame->height = height; + + if (0 != av_frame_get_buffer(frame, 0)) + { + av_frame_free(&frame); + return FALSE; + } + + av_frame_make_writable(frame); + } + + return TRUE; +} + +BOOL CVideoPlayer::initVideoRender(int width, int height) +{ + BOOL init = FALSE; + +#if __WINDOWS_OS__ + m_pVideoRender = new CD3DVideoRender(); +#elif __LINUX_OS__ + m_pVideoRender = new CSDLVideoRender(); +#endif + if (m_pVideoRender) + { + init = m_pVideoRender->init(m_nVideoWnd, width, height, VIDEO_FMT_YUV420P); +#ifdef IOS + if (init) + { + m_pVideoRender->setWindowTitle(m_sFileName.toStdString().c_str()); + } +#endif + } + +#if __WINDOWS_OS__ + if (!init) + { + if (m_pVideoRender) + { + delete m_pVideoRender; + } + + m_pVideoRender = new CGDIVideoRender(); + if (m_pVideoRender) + { + init = m_pVideoRender->init(m_nVideoWnd, width, height, VIDEO_FMT_BGR24); + if (init) + { + m_bUpdown = TRUE; + m_nDstVideoFmt = to_avpixelformat(VIDEO_FMT_BGR24); + log_print(HT_LOG_INFO, "%s, use GDI to render video\r\n", __FUNCTION__); + } + else + { + delete m_pVideoRender; + m_pVideoRender = NULL; + } + } + } + else + { + log_print(HT_LOG_INFO, "%s, use D3D to render video\r\n", __FUNCTION__); + } +#endif + + return init; +} + +BOOL CVideoPlayer::doSnapshot(AVFrame * frame) +{ + if (!initFrame(m_pSnapFrame, frame->width, frame->height, to_avpixelformat(m_nSnapVideoFmt))) + { + return FALSE; + } + + if (NULL == convertFrame(frame, m_pSnapFrame, FALSE)) + { + return FALSE; + } + + emit snapshoted(m_pSnapFrame); + + return TRUE; +} + +AVFrame * CVideoPlayer::convertFrame(AVFrame * srcframe, AVFrame * dstframe, BOOL updown) +{ + if (NULL == srcframe || NULL == dstframe) + { + return NULL; + } + + SwsContext * swsctx = sws_getContext(srcframe->width, srcframe->height, (enum AVPixelFormat)srcframe->format, + srcframe->width, srcframe->height, (enum AVPixelFormat)dstframe->format, SWS_BICUBIC, NULL, NULL, NULL); + if (swsctx) + { + if (updown) + { + srcframe->data[0] += srcframe->linesize[0] * (srcframe->height - 1); + srcframe->linesize[0] *= -1; + srcframe->data[1] += srcframe->linesize[1] * (srcframe->height / 2 - 1); + srcframe->linesize[1] *= -1; + srcframe->data[2] += srcframe->linesize[2] * (srcframe->height / 2 - 1); + srcframe->linesize[2] *= -1; + } + + int ret = sws_scale(swsctx, srcframe->data, srcframe->linesize, 0, srcframe->height, dstframe->data, dstframe->linesize); + if (ret > 0) + { + dstframe->pts = srcframe->pts; + dstframe->pkt_dts = srcframe->pkt_dts; + + sws_freeContext(swsctx); + return dstframe; + } + else + { + log_print(HT_LOG_ERR, "%s, sws_scale failed\r\n", __FUNCTION__); + + sws_freeContext(swsctx); + return NULL; + } + } + + return NULL; +} + +void CVideoPlayer::onVideoFrame(AVFrame * frame) +{ + // Perform snapshot request + if (m_bSnapshot) + { + if (doSnapshot(frame)) + { + m_bSnapshot = FALSE; + } + } + + AVFrame * dst = NULL; + + if (m_nDstVideoFmt != frame->format) + { + if (initFrame(m_pRenderFrame, frame->width, frame->height, m_nDstVideoFmt)) + { + if (NULL != convertFrame(frame, m_pRenderFrame, m_bUpdown)) + { + dst = av_frame_clone(m_pRenderFrame); + } + } + } + else + { + dst = av_frame_clone(frame); + } + + if (dst) + { + sys_os_mutex_enter(m_pVideoListMutex); + + if (m_videoFrameList.size() >= 10) + { + AVFrame * frame = m_videoFrameList.front(); + if (frame) + { + av_frame_free(&frame); + } + + m_videoFrameList.pop_front(); + } + + m_videoFrameList.push_back(dst); + + sys_os_mutex_leave(m_pVideoListMutex); + } +} + +void CVideoPlayer::onAudioFrame(AVFrame * frame) +{ + AVFrame * dst = av_frame_clone(frame); + if (dst) + { + while (m_audioPlayFlag && m_audioFrameList.size() >= 10) + { + usleep(10*1000); + } + + sys_os_mutex_enter(m_pAudioListMutex); + m_audioFrameList.push_back(dst); + sys_os_mutex_leave(m_pAudioListMutex); + } +} + +/* Audio play thread */ +void CVideoPlayer::audioPlayThread() +{ + while (m_audioPlayFlag) + { + AVFrame * pFrame = NULL; + + sys_os_mutex_enter(m_pAudioListMutex); + if (m_audioFrameList.size() > 0) + { + pFrame = m_audioFrameList.front(); + + m_audioFrameList.pop_front(); + } + sys_os_mutex_leave(m_pAudioListMutex); + + if (pFrame) + { + // Save audio PTS and play time stamp + m_lastAudioTS = sys_os_get_ms(); + m_nLastAudioPts = pFrame->pts; + + if (m_pAudioPlay) + { + // Will wait for the playback to complete before returning + m_pAudioPlay->playAudio(pFrame->data[0], pFrame->nb_samples * pFrame->channels * 2); + } + else + { + usleep(1000000 * pFrame->nb_samples / m_nSampleRate); + } + + av_frame_free(&pFrame); + } + else + { + // Fill the silence data + + uint8 buff[1024] = {0}; + m_pAudioPlay->playAudio(buff, 1024); + } + } + + m_audioPlayThread = 0; +} + +/* Video rendering thread */ +void CVideoPlayer::videoPlayThread() +{ + int64 cur_delay = 0; + int64 pre_delay = 0; + uint32 cur_time = 0; + uint32 pre_time = 0; + AVFrame * pLastFrame = NULL; + + while (m_videoPlayFlag) + { + int size, fast = 0, slow = 0; + AVFrame * pFrame = NULL; + + sys_os_mutex_enter(m_pVideoListMutex); + size = m_videoFrameList.size(); + if (size > 0) + { + pFrame = m_videoFrameList.front(); + + m_videoFrameList.pop_front(); + } + else + { + pFrame = pLastFrame; + } + sys_os_mutex_leave(m_pVideoListMutex); + + if (pFrame) + { + // The Mac platform needs to initialize the SDL window on the UI main thread + if (NULL == m_pVideoRender) + { + dispatch_sync(dispatch_get_main_queue(), ^{ + initVideoRender(pFrame->width, pFrame->height); + }); + } + + if (pFrame->format != m_nDstVideoFmt) + { + av_frame_free(&pFrame); + continue; + } + + // If there is audio, synchronize with audio + if (m_nLastAudioPts != (uint64) AV_NOPTS_VALUE) + { + int diff = sys_os_get_ms() - m_lastAudioTS; + uint64 vpts = pFrame->pts; + uint64 epts = m_nLastAudioPts + diff * 1000; + + int ptsdiff = vpts - epts; + + // Video ahead of audio 200ms + // If the video is 3 minutes ahead of the audio, the RTP timestamp may be incorrect, so skip it + if (ptsdiff >= 200 * 1000 && ptsdiff <= 180 * 1000 * 1000) + { + fast = 1; + } + // Video is behind audio 200ms + // If the video is 3 minutes behind the audio, the RTP timestamp may be inaccurate, so skip it + else if (ptsdiff <= -200 * 1000 && ptsdiff >= -180 * 1000 *1000) + { + slow = 1; + } + } + + if (m_pVideoRender) + { + if (m_bSizeChanged) + { + dispatch_sync(dispatch_get_main_queue(), ^{ + m_pVideoRender->setWindowSize(m_size); + m_bSizeChanged = FALSE; + }); + } + + m_pVideoRender->render(pFrame, m_nRenderMode); + } + + // Keep the last frame + if (size > 1) + { + av_frame_free(&pFrame); + av_frame_free(&pLastFrame); + pLastFrame = NULL; + } + else if (pLastFrame != pFrame) + { + av_frame_free(&pLastFrame); + + pLastFrame = pFrame; + } + + if (fast) + { + cur_delay = 1000/10.0 * 1000; // The rendering fps is 10 + } + else if (slow) + { + // don't sleep + cur_delay = 0; + } + else + { + float fps = 30.0; + + if (m_pVideoDecoder) + { + fps = m_pVideoDecoder->getFrameRate(); + if (fps == 0) + { + fps = 30.0; + } + } + + cur_delay = 1000/fps * 1000; // The default rendering fps + } + + cur_time = sys_os_get_ms(); + + if (pre_time > 0) + { + cur_delay += pre_delay - (cur_time - pre_time) * 1000; + if (cur_delay < 1000) + { + cur_delay = 0; + } + } + + pre_time = cur_time; + pre_delay = cur_delay; + + if (cur_delay > 0) + { + usleep(cur_delay); + } + } + else + { + usleep(1000); + } + } + + if (pLastFrame) + { + av_frame_free(&pLastFrame); + } + + m_videoPlayThread = 0; +} + + + diff --git a/MediaClient/MediaClient/media/video_render.cpp b/MediaClient/MediaClient/media/video_render.cpp new file mode 100644 index 0000000..f944be7 --- /dev/null +++ b/MediaClient/MediaClient/media/video_render.cpp @@ -0,0 +1,60 @@ +/*************************************************************************************** + * + * 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 "video_render.h" + + +CVideoRender::CVideoRender() +: m_bInited(FALSE) +, m_hWnd(0) +, m_nVideoWidth(0) +, m_nVideoHeight(0) +, m_nVideoFmt(VIDEO_FMT_YUV420P) +{ + +} + +CVideoRender::~CVideoRender() +{ + unInit(); +} + +BOOL CVideoRender::init(WId hWnd, int w, int h, int videofmt) +{ + m_hWnd = hWnd; + m_nVideoWidth = w; + m_nVideoHeight = h; + m_nVideoFmt = videofmt; + + return TRUE; +} + +void CVideoRender::unInit() +{ + m_bInited = FALSE; +} + +BOOL CVideoRender::render(AVFrame * frame, int mode) +{ + return FALSE; +} + + + diff --git a/MediaClient/MediaClient/media/video_render.h b/MediaClient/MediaClient/media/video_render.h new file mode 100644 index 0000000..211d4b7 --- /dev/null +++ b/MediaClient/MediaClient/media/video_render.h @@ -0,0 +1,63 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef VIDEO_RENDER_H +#define VIDEO_RENDER_H + +#include "media_format.h" +#include +extern "C" +{ +#include +} + +/***************************************************************************************/ + +#define RENDER_MODE_KEEP 0 +#define RENDER_MODE_FILL 1 + +/***************************************************************************************/ + +class CVideoRender +{ +public: + CVideoRender(); + virtual ~CVideoRender(); + + virtual BOOL init(WId hWnd, int w, int h, int videofmt); + virtual void unInit(); + + virtual BOOL render(AVFrame * frame, int mode); + virtual void setWindowSize(QSize size) {} + virtual void setWindowTitle(const char * title) {} + +protected: + BOOL m_bInited; + WId m_hWnd; + int m_nVideoWidth; + int m_nVideoHeight; + int m_nVideoFmt; +}; + + +#endif // end of VIDEO_RENDER_H + + + + diff --git a/MediaClient/MediaClient/media/video_render_d3d.cpp b/MediaClient/MediaClient/media/video_render_d3d.cpp new file mode 100644 index 0000000..4bc3638 --- /dev/null +++ b/MediaClient/MediaClient/media/video_render_d3d.cpp @@ -0,0 +1,829 @@ +/*************************************************************************************** + * + * 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 "video_render_d3d.h" +#include "lock.h" + +/***************************************************************************************/ + +static void * g_d3d_mutex = sys_os_create_mutex(); + +const DWORD g_YUV420ps30_main[] = +{ + 0xffff0300, 0x003ffffe, 0x42415443, 0x0000001c, 0x000000c7, 0xffff0300, + 0x00000004, 0x0000001c, 0x20000102, 0x000000c0, 0x0000006c, 0x00010003, + 0x00000001, 0x00000074, 0x00000000, 0x00000084, 0x00020003, 0x00000001, + 0x00000074, 0x00000000, 0x0000008c, 0x00000003, 0x00000001, 0x00000074, + 0x00000000, 0x00000094, 0x00000002, 0x00000001, 0x000000a0, 0x000000b0, + 0x78655455, 0x00657574, 0x000c0004, 0x00010001, 0x00000001, 0x00000000, + 0x78655456, 0x00657574, 0x78655459, 0x00657574, 0x6e617274, 0x72617073, + 0x00746e65, 0x00030000, 0x00010001, 0x00000001, 0x00000000, 0x3f800000, + 0x00000000, 0x00000000, 0x00000000, 0x335f7370, 0x4d00305f, 0x6f726369, + 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, + 0x656c6970, 0x2e392072, 0x392e3432, 0x322e3934, 0x00373033, 0x05000051, + 0xa00f0001, 0x3f950a81, 0x3fcc4a9d, 0xbf5fcbb4, 0x00000000, 0x05000051, + 0xa00f0002, 0x3f950a81, 0xbec89507, 0xbf501eac, 0x3f081b65, 0x05000051, + 0xa00f0003, 0x3f950a81, 0x40011a54, 0xbf8af5f5, 0x00000000, 0x05000051, + 0xa00f0004, 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x0200001f, + 0x80000005, 0x90030000, 0x0200001f, 0x80010005, 0x90030001, 0x0200001f, + 0x80020005, 0x90030002, 0x0200001f, 0x90000000, 0xa00f0800, 0x0200001f, + 0x90000000, 0xa00f0801, 0x0200001f, 0x90000000, 0xa00f0802, 0x03000042, + 0x800f0000, 0x90e40002, 0xa0e40802, 0x02000001, 0x80040000, 0x80000000, + 0x03000042, 0x800f0001, 0x90e40000, 0xa0e40800, 0x04000004, 0x80090000, + 0x80000001, 0xa0640004, 0xa0250004, 0x03000008, 0x80010800, 0xa0e40001, + 0x80f80000, 0x03000042, 0x800f0001, 0x90e40001, 0xa0e40801, 0x02000001, + 0x80020000, 0x80000001, 0x03000009, 0x80020800, 0xa0e40002, 0x80e40000, + 0x03000008, 0x80040800, 0xa0e40003, 0x80f40000, 0x02000001, 0x80080800, + 0xa0000000, 0x0000ffff +}; + +const DWORD g_YUV420ps20_main[] = +{ + 0xffff0200, 0x003ffffe, 0x42415443, 0x0000001c, 0x000000c7, 0xffff0200, + 0x00000004, 0x0000001c, 0x20000102, 0x000000c0, 0x0000006c, 0x00010003, + 0x00000001, 0x00000074, 0x00000000, 0x00000084, 0x00020003, 0x00000001, + 0x00000074, 0x00000000, 0x0000008c, 0x00000003, 0x00000001, 0x00000074, + 0x00000000, 0x00000094, 0x00000002, 0x00000001, 0x000000a0, 0x000000b0, + 0x78655455, 0x00657574, 0x000c0004, 0x00010001, 0x00000001, 0x00000000, + 0x78655456, 0x00657574, 0x78655459, 0x00657574, 0x6e617274, 0x72617073, + 0x00746e65, 0x00030000, 0x00010001, 0x00000001, 0x00000000, 0x3f800000, + 0x00000000, 0x00000000, 0x00000000, 0x325f7370, 0x4d00305f, 0x6f726369, + 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, + 0x656c6970, 0x2e392072, 0x392e3432, 0x322e3934, 0x00373033, 0x05000051, + 0xa00f0001, 0x3f950a81, 0x00000000, 0x3fcc4a9d, 0xbf5fcbb4, 0x05000051, + 0xa00f0002, 0x3f950a81, 0xbec89507, 0xbf501eac, 0x3f081b65, 0x05000051, + 0xa00f0003, 0x3f950a81, 0x40011a54, 0x00000000, 0xbf8af5f5, 0x05000051, + 0xa00f0004, 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x0200001f, + 0x80000000, 0xb0030000, 0x0200001f, 0x80000000, 0xb0030001, 0x0200001f, + 0x80000000, 0xb0030002, 0x0200001f, 0x90000000, 0xa00f0800, 0x0200001f, + 0x90000000, 0xa00f0801, 0x0200001f, 0x90000000, 0xa00f0802, 0x03000042, + 0x800f0000, 0xb0e40000, 0xa0e40800, 0x03000042, 0x800f0001, 0xb0e40001, + 0xa0e40801, 0x03000042, 0x800f0002, 0xb0e40002, 0xa0e40802, 0x02000001, + 0x80080003, 0xa0000000, 0x02000001, 0x80020000, 0x80000001, 0x02000001, + 0x80040000, 0x80000002, 0x02000001, 0x80080000, 0xa0000004, 0x03000009, + 0x80010003, 0xa0e40001, 0x80e40000, 0x03000009, 0x80020003, 0xa0e40002, + 0x80e40000, 0x03000009, 0x80040003, 0xa0e40003, 0x80e40000, 0x02000001, + 0x800f0800, 0x80e40003, 0x0000ffff +}; + +/***************************************************************************************/ + +CD3DVideoRender::CD3DVideoRender() +: CVideoRender() +, m_pD3D9(NULL) +, m_pD3DD9(NULL) +, m_pRenderSurface(NULL) +, m_pVertices(NULL) +, m_pPixelShader(NULL) +, m_pPixelConstTable(NULL) +, m_hTransparent(NULL) +, m_nFlip(GS_NONE) +, m_dTransparent(0.0f) +, m_dwColor(0) +, m_bReset(FALSE) +{ + m_pTexture[0] = NULL; + m_pTexture[1] = NULL; + m_pTexture[2] = NULL; + + m_pTexTemp[0] = NULL; + m_pTexTemp[1] = NULL; + m_pTexTemp[2] = NULL; + + m_hYUVTexture[0] = NULL; + m_hYUVTexture[1] = NULL; + m_hYUVTexture[2] = NULL; + + memset(&m_dstRect, 0, sizeof(RECT)); + memset(&m_srcRect, 0, sizeof(RECT)); +} + +CD3DVideoRender::~CD3DVideoRender() +{ + unInit(); +} + +BOOL CD3DVideoRender::init(WId wid, int w, int h, int videofmt) +{ + HWND hWnd = (HWND)wid; + + CLock lock(g_d3d_mutex); + + m_pD3D9 = Direct3DCreate9(D3D_SDK_VERSION); + if (NULL == m_pD3D9) + { + log_print(HT_LOG_ERR, "%s, Direct3DCreate9 failed\r\n", __FUNCTION__); + return FALSE; + } + + HRESULT hr; + D3DPRESENT_PARAMETERS D3DPP; + + initD3DPP(&D3DPP, hWnd); + + if (!initDevice(&D3DPP, hWnd)) + { + log_print(HT_LOG_ERR, "%s, initDevice failed\r\n", __FUNCTION__); + return FALSE; + } + + hr = m_pD3DD9->SetFVF(D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_TEX3); + if (FAILED(hr)) + { + log_print(HT_LOG_ERR, "%s, SetFVF failed\r\n", __FUNCTION__); + return FALSE; + } + + if (initShader(g_YUV420ps30_main, g_YUV420ps20_main) == FALSE) + { + log_print(HT_LOG_ERR, "%s, initShader failed\r\n", __FUNCTION__); + return FALSE; + } + + hr = m_pD3DD9->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0); + if (FAILED(hr)) + { + log_print(HT_LOG_ERR, "%s, Clear failed\r\n", __FUNCTION__); + return FALSE; + } + + CVideoRender::init(wid, w, h, videofmt); + + m_bInited = initImageBuffer(w, h, videofmt); + + return m_bInited; +} + +void CD3DVideoRender::unInit() +{ + CLock lock(g_d3d_mutex); + + freeImageBuffer(); + + if (m_pPixelShader) + { + m_pPixelShader->Release(); + m_pPixelShader = NULL; + } + + if (m_pPixelConstTable) + { + m_pPixelConstTable->Release(); + m_pPixelConstTable = NULL; + } + + if (m_pD3DD9) + { + m_pD3DD9->Release(); + m_pD3DD9 = NULL; + } + + if (m_pD3D9) + { + m_pD3D9->Release(); + m_pD3D9 = NULL; + } + + m_bInited = FALSE; +} + +BOOL CD3DVideoRender::initD3DPP(D3DPRESENT_PARAMETERS * pD3DPP, HWND hWnd) +{ + memset(pD3DPP, 0, sizeof(D3DPRESENT_PARAMETERS)); + + pD3DPP->Windowed = TRUE; + pD3DPP->hDeviceWindow = hWnd; + + pD3DPP->Flags = D3DPRESENTFLAG_VIDEO; + pD3DPP->PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT; + pD3DPP->BackBufferCount = 1; + pD3DPP->BackBufferFormat = D3DFMT_UNKNOWN; + + pD3DPP->BackBufferWidth = GetSystemMetrics(SM_CXVIRTUALSCREEN); + pD3DPP->BackBufferHeight = GetSystemMetrics(SM_CYVIRTUALSCREEN); + + // + // Mark the back buffer lockable if software DXVA2 could be used. + // This is because software DXVA2 device requires a lockable render target + // for the optimal performance. + // + pD3DPP->Flags |= D3DPRESENTFLAG_LOCKABLE_BACKBUFFER; + + pD3DPP->SwapEffect = D3DSWAPEFFECT_DISCARD; + + return TRUE; +} + +BOOL CD3DVideoRender::initDevice(D3DPRESENT_PARAMETERS * pD3DPP, HWND hWnd) +{ + HRESULT hr; + UINT AdapterToUse = D3DADAPTER_DEFAULT; + D3DDEVTYPE DeviceType = D3DDEVTYPE_HAL; + + DWORD thread_modes[] = { D3DCREATE_MULTITHREADED, 0 }; + DWORD vertex_modes[] = { D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_PUREDEVICE, + D3DCREATE_HARDWARE_VERTEXPROCESSING, + D3DCREATE_MIXED_VERTEXPROCESSING, + D3DCREATE_SOFTWARE_VERTEXPROCESSING }; + + for (size_t t = 0; t < ARRAY_SIZE(thread_modes); t++) + { + for (size_t v = 0; v < ARRAY_SIZE(vertex_modes); v++) + { + DWORD creationFlags = thread_modes[t] | vertex_modes[v]; + + hr = m_pD3D9->CreateDevice(AdapterToUse, + DeviceType, hWnd, + creationFlags, + pD3DPP, &m_pD3DD9); + if (SUCCEEDED(hr)) + { + return TRUE; + } + } + } + + return FALSE; +} + +BOOL CD3DVideoRender::initImageBuffer(int w, int h, int videofmt) +{ + RECT rect; + GetClientRect((HWND)m_hWnd, &rect); + + m_srcRect.left = m_srcRect.top = 0; + m_srcRect.right = w; + m_srcRect.bottom = h; + + m_dstRect.left = rect.left; + m_dstRect.top = rect.top; + m_dstRect.right = rect.right; + m_dstRect.bottom = rect.bottom; + + m_verPoint[0] = D3DXVECTOR4(m_dstRect.left-0.5f, m_dstRect.top-0.5f, 0.0f, 1.0f); + m_verPoint[1] = D3DXVECTOR4(m_dstRect.right-0.5f, m_dstRect.top-0.5f, 0.0f, 1.0f); + m_verPoint[2] = D3DXVECTOR4(m_dstRect.right-0.5f, m_dstRect.bottom-0.5f, 0.0f, 1.0f); + m_verPoint[3] = D3DXVECTOR4(m_dstRect.left-0.5f, m_dstRect.bottom-0.5f, 0.0f, 1.0f); + + float dx = 1.0f / w; + float dy = 1.0f / h; + + m_texPoint[0] = D3DXVECTOR2(dx * m_srcRect.left, dy * m_srcRect.top); + m_texPoint[1] = D3DXVECTOR2(dx * m_srcRect.right, dy * m_srcRect.top); + m_texPoint[2] = D3DXVECTOR2(dx * m_srcRect.right, dy * m_srcRect.bottom); + m_texPoint[3] = D3DXVECTOR2(dx * m_srcRect.left, dy * m_srcRect.bottom); + + HRESULT hr = m_pD3DD9->CreateVertexBuffer(4 * sizeof(YUV_VERTEX), + D3DUSAGE_WRITEONLY | D3DUSAGE_DYNAMIC, + D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_TEX3, D3DPOOL_DEFAULT, &m_pVertices, NULL); + if (FAILED(hr)) + { + log_print(HT_LOG_ERR, "%s, CreateVertexBuffer failed\r\n", __FUNCTION__); + goto done; + } + + int i; + YUV_VERTEX * pVB; + + hr = m_pVertices->Lock(0, 0, (void**)&pVB, 0); + if (FAILED(hr)) + { + goto done; + } + + for (i = 0; i < 4; i++) + { + pVB[i].pos = m_verPoint[i]; + pVB[i].color = m_dwColor; + pVB[i].tex1 = pVB[i].tex2 = pVB[i].tex3 = m_texPoint[i]; + } + + hr = m_pVertices->Unlock(); + if (FAILED(hr)) + { + goto done; + } + + for (i = 0; i < 3; i++) + { + int Width = w; + int Height = h; + + if (i != 0) + { + Width /= 2; + Height /= 2; + } + + hr = m_pD3DD9->CreateTexture(Width, Height, 1, D3DUSAGE_DYNAMIC, D3DFMT_L8, D3DPOOL_DEFAULT, &m_pTexture[i], NULL); + if (FAILED(hr)) + { + log_print(HT_LOG_ERR, "%s, CreateTexture failed\r\n", __FUNCTION__); + goto done; + } + } + + m_pTexTemp[Y_TEX] = m_pTexture[Y_TEX]; + + if (VIDEO_FMT_YV12 == videofmt) + { + m_pTexTemp[U_TEX] = m_pTexture[V_TEX]; + m_pTexTemp[V_TEX] = m_pTexture[U_TEX]; + } + else if (VIDEO_FMT_YUV420P == videofmt) + { + m_pTexTemp[U_TEX] = m_pTexture[U_TEX]; + m_pTexTemp[V_TEX] = m_pTexture[V_TEX]; + } + + return TRUE; + +done: + + return FALSE; +} + +void CD3DVideoRender::freeImageBuffer() +{ + if (m_pVertices) + { + m_pVertices->Release(); + m_pVertices = NULL; + } + + for (int i = 0 ; i < COUNT_YUV_TEX; i++) + { + if (m_pTexture[i]) + { + m_pTexture[i]->Release(); + m_pTexture[i] = NULL; + } + } +} + +BOOL CD3DVideoRender::initShader(const DWORD * pCode3, const DWORD * pCode2) +{ + D3DCAPS9 caps; + HRESULT hr = S_OK; + + hr = m_pD3DD9->GetDeviceCaps(&caps); + if (FAILED(hr)) + { + goto done; + } + + const DWORD * pCode; + + if (caps.PixelShaderVersion >= D3DPS_VERSION(3, 0)) + { + pCode = pCode3; + } + else + { + pCode = pCode2; + } + + hr = m_pD3DD9->CreatePixelShader(pCode, &m_pPixelShader); + if (FAILED(hr)) + { + goto done; + } + + hr = D3DXGetShaderConstantTable(pCode, &m_pPixelConstTable); + if (FAILED(hr)) + { + goto done; + } + + m_hYUVTexture[Y_TEX] = m_pPixelConstTable->GetConstantByName(NULL, "YTextue"); + if (m_hYUVTexture[Y_TEX] == NULL) + { + goto done; + } + + m_hYUVTexture[U_TEX] = m_pPixelConstTable->GetConstantByName(NULL, "UTextue"); + if (m_hYUVTexture[U_TEX] == NULL) + { + goto done; + } + + m_hYUVTexture[V_TEX] = m_pPixelConstTable->GetConstantByName(NULL, "VTextue"); + if (m_hYUVTexture[V_TEX] == NULL) + { + goto done; + } + + UINT count; + + hr = m_pPixelConstTable->GetConstantDesc(m_hYUVTexture[Y_TEX], &m_dYUVTexture[Y_TEX], &count); + if (FAILED(hr)) + { + goto done; + } + + hr = m_pPixelConstTable->GetConstantDesc(m_hYUVTexture[U_TEX], &m_dYUVTexture[U_TEX], &count); + if (FAILED(hr)) + { + goto done; + } + + hr = m_pPixelConstTable->GetConstantDesc(m_hYUVTexture[V_TEX], &m_dYUVTexture[V_TEX], &count); + if (FAILED(hr)) + { + goto done; + } + + m_hTransparent = m_pPixelConstTable->GetConstantByName(NULL, "transparent"); + if (m_hTransparent == NULL) + { + goto done; + } + + hr = m_pPixelConstTable->SetDefaults(m_pD3DD9); + +done: + + return SUCCEEDED(hr) ? TRUE : FALSE; +} + +BOOL CD3DVideoRender::resetDevice() +{ + freeImageBuffer(); + + if (m_pPixelShader) + { + m_pPixelShader->Release(); + m_pPixelShader = NULL; + } + + if (m_pPixelConstTable) + { + m_pPixelConstTable->Release(); + m_pPixelConstTable = NULL; + } + + HRESULT hr; + D3DPRESENT_PARAMETERS D3DPP; + + initD3DPP(&D3DPP, (HWND)m_hWnd); + + hr = m_pD3DD9->Reset(&D3DPP); + if (FAILED(hr)) + { + return FALSE; + } + + hr = m_pD3DD9->SetFVF(D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_TEX3); + if (FAILED(hr)) + { + log_print(HT_LOG_ERR, "%s, SetFVF failed\r\n", __FUNCTION__); + return FALSE; + } + + if (initShader(g_YUV420ps30_main, g_YUV420ps20_main) == FALSE) + { + log_print(HT_LOG_ERR, "%s, initShader failed\r\n", __FUNCTION__); + return FALSE; + } + + hr = m_pD3DD9->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0); + if (FAILED(hr)) + { + log_print(HT_LOG_ERR, "%s, Clear failed\r\n", __FUNCTION__); + return FALSE; + } + + return initImageBuffer(m_nVideoWidth, m_nVideoHeight, m_nVideoFmt); +} + +BOOL CD3DVideoRender::setImageArgs(float Transparent, GEOMETRICTRANSFORMATION flip, RECT * pDstRect, RECT * pSrcRect) +{ + BOOL bSet = FALSE; + + if (m_dTransparent != Transparent) + { + m_dTransparent = Transparent; + m_dwColor = ((DWORD)( 255 * Transparent ) << 24) | 0x00ffffff; + bSet = TRUE; + } + + if (memcmp(&m_dstRect, pDstRect, sizeof(RECT)) != 0) + { + memcpy(&m_dstRect, pDstRect, sizeof(RECT)); + + m_verPoint[0] = D3DXVECTOR4(m_dstRect.left-0.5f, m_dstRect.top-0.5f, 0.0f, 1.0f); + m_verPoint[1] = D3DXVECTOR4(m_dstRect.right-0.5f, m_dstRect.top-0.5f, 0.0f, 1.0f); + m_verPoint[2] = D3DXVECTOR4(m_dstRect.right-0.5f, m_dstRect.bottom-0.5f, 0.0f, 1.0f); + m_verPoint[3] = D3DXVECTOR4(m_dstRect.left-0.5f, m_dstRect.bottom-0.5f, 0.0f, 1.0f); + bSet = TRUE; + } + + if (memcmp(&m_srcRect, pSrcRect, sizeof(RECT)) != 0 || flip != m_nFlip) + { + float dx = 1.0f / m_nVideoWidth; + float dy = 1.0f / m_nVideoHeight; + + memcpy(&m_srcRect, pSrcRect, sizeof(RECT)); + + m_texPoint[0] = D3DXVECTOR2(dx * m_srcRect.left, dy * m_srcRect.top); + m_texPoint[1] = D3DXVECTOR2(dx * m_srcRect.right, dy * m_srcRect.top); + m_texPoint[2] = D3DXVECTOR2(dx * m_srcRect.right, dy * m_srcRect.bottom); + m_texPoint[3] = D3DXVECTOR2(dx * m_srcRect.left, dy * m_srcRect.bottom); + + if (flip & GS_UPPER_DOWN_FLIP) + { + D3DXVECTOR2 temp = m_texPoint[0]; + m_texPoint[0] = m_texPoint[3]; + m_texPoint[3] = temp; + + temp = m_texPoint[1]; + m_texPoint[1] = m_texPoint[2]; + m_texPoint[2] = temp; + } + + if (flip & GS_LEFT_RIGHT_FLIP) + { + D3DXVECTOR2 temp = m_texPoint[0]; + m_texPoint[0] = m_texPoint[1]; + m_texPoint[1] = temp; + + temp = m_texPoint[2]; + m_texPoint[2] = m_texPoint[3]; + m_texPoint[3] = temp; + } + + m_nFlip = flip; + bSet = TRUE; + } + + return bSet; +} + +BOOL CD3DVideoRender::setImage(GEOMETRICTRANSFORMATION flip, RECT * pDstRect, RECT * pSrcRect) +{ + if (!setImageArgs(1.0f, flip, pDstRect, pSrcRect)) + { + return TRUE; + } + + YUV_VERTEX * pVB; + HRESULT hr = m_pVertices->Lock(0, 0, (void**)&pVB, D3DLOCK_DISCARD); + if (FAILED(hr)) + { + return FALSE; + } + + for (int i = 0 ; i < 4 ; i++) + { + pVB[i].pos = m_verPoint[i]; + pVB[i].color = m_dwColor; + pVB[i].tex1 = pVB[i].tex2 = pVB[i].tex3 = m_texPoint[i]; + } + + hr = m_pVertices->Unlock(); + + if (FAILED(hr)) + { + return FALSE; + } + + return TRUE; +} + +BOOL CD3DVideoRender::render(AVFrame * frame, int mode) +{ + HRESULT hr = S_OK; + + if (m_bReset) + { + if (resetDevice()) + { + m_bReset = FALSE; + } + } + + if (!m_bInited || m_bReset || NULL == frame) + { + return FALSE; + } + + if (m_pD3DD9) + { + hr = m_pD3DD9->TestCooperativeLevel(); + } + else + { + return FALSE; + } + + if (FAILED(hr)) + { + log_print(HT_LOG_ERR, "%s, TestCooperativeLevel failed. (hr=0x%0lx)\r\n", __FUNCTION__, hr); + goto done; + } + + if (m_nVideoWidth != frame->width || m_nVideoHeight != frame->height) + { + freeImageBuffer(); + + if (!initImageBuffer(frame->width, frame->height, m_nVideoFmt)) + { + log_print(HT_LOG_ERR, "%s, initImageBuffer failed\r\n", __FUNCTION__); + return FALSE; + } + + m_nVideoWidth = frame->width; + m_nVideoHeight = frame->height; + } + + RECT rect; + GetClientRect((HWND)m_hWnd, &rect); + + RECT targetRect; + RECT sourceRect; + + sourceRect.left = 0; + sourceRect.top = 0; + sourceRect.right = frame->width; + sourceRect.bottom = frame->height; + + if (mode == RENDER_MODE_KEEP) + { + int rectw = rect.right - rect.left; + int recth = rect.bottom - rect.top; + + double dw = rectw / (double) m_nVideoWidth; + double dh = recth / (double) m_nVideoHeight; + double rate = (dw > dh) ? dh : dw; + + int rw = (int)(m_nVideoWidth * rate); + int rh = (int)(m_nVideoHeight * rate); + + targetRect.left = (rectw - rw) / 2; + targetRect.top = (recth - rh) / 2; + targetRect.right = targetRect.left + rw; + targetRect.bottom = targetRect.top + rh; + } + else + { + targetRect = rect; + } + + for (int i = 0 ; i < 3 ; i++) + { + int w = m_nVideoWidth; + int h = m_nVideoHeight; + + if (i != 0) + { + w /= 2; + h /= 2; + } + + BYTE * pSrc = frame->data[i]; + D3DLOCKED_RECT lrect; + + hr = m_pTexture[i]->LockRect(0, &lrect, NULL, D3DLOCK_DISCARD); + if (SUCCEEDED(hr)) + { + BYTE * pDest = (BYTE*) lrect.pBits; + + for (int j = 0 ; j < h; j++) + { + memcpy(pDest, pSrc, w); + + pDest += lrect.Pitch; + pSrc += frame->linesize[i]; + } + + hr = m_pTexture[i]->UnlockRect(0); + if (FAILED(hr)) + { + goto done; + } + } + else + { + if (FAILED(hr)) + { + log_print(HT_LOG_ERR, "%s, LockRect failed\r\n", __FUNCTION__); + goto done; + } + } + } + + // begin draw + hr = m_pD3DD9->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &m_pRenderSurface); + if (SUCCEEDED(hr)) + { + m_pD3DD9->ColorFill(m_pRenderSurface, &rect, D3DCOLOR_ARGB(0xff,0x0,0x0,0x0)); + m_pD3DD9->SetRenderTarget(0, m_pRenderSurface); + m_pRenderSurface->Release(); + } + + hr = m_pD3DD9->BeginScene(); + if (FAILED(hr)) + { + log_print(HT_LOG_ERR, "%s, BeginScene failed\r\n", __FUNCTION__); + goto done; + } + + hr = m_pD3DD9->SetFVF(D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_TEX3); + if (FAILED(hr)) + { + log_print(HT_LOG_ERR, "%s, SetFVF failed\r\n", __FUNCTION__); + goto done; + } + + hr = m_pD3DD9->SetPixelShader(m_pPixelShader); + if (FAILED(hr)) + { + log_print(HT_LOG_ERR, "%s, SetPixelShader failed\r\n", __FUNCTION__); + goto done; + } + + hr = m_pPixelConstTable->SetFloat(m_pD3DD9, m_hTransparent, 1.0); + if (FAILED(hr)) + { + log_print(HT_LOG_ERR, "%s, SetFloat failed\r\n", __FUNCTION__); + goto done; + } + + setImage(GS_NONE, &targetRect, &sourceRect); + + hr = m_pD3DD9->SetTexture(m_dYUVTexture[Y_TEX].RegisterIndex, m_pTexTemp[Y_TEX]); + if (FAILED(hr)) + { + log_print(HT_LOG_ERR, "%s, SetTexture failed\r\n", __FUNCTION__); + goto done; + } + + hr = m_pD3DD9->SetTexture(m_dYUVTexture[U_TEX].RegisterIndex, m_pTexTemp[U_TEX]); + if (FAILED(hr)) + { + log_print(HT_LOG_ERR, "%s, SetTexture failed\r\n", __FUNCTION__); + goto done; + } + + hr = m_pD3DD9->SetTexture(m_dYUVTexture[V_TEX].RegisterIndex, m_pTexTemp[V_TEX]); + if (FAILED(hr)) + { + log_print(HT_LOG_ERR, "%s, SetTexture failed\r\n", __FUNCTION__); + goto done; + } + + hr = m_pD3DD9->SetStreamSource(0, m_pVertices, 0, sizeof(YUV_VERTEX)); + if (FAILED(hr)) + { + log_print(HT_LOG_ERR, "%s, SetStreamSource failed\r\n", __FUNCTION__); + goto done; + } + + hr = m_pD3DD9->DrawPrimitive(D3DPT_TRIANGLEFAN, 0, 2); + if (FAILED(hr)) + { + log_print(HT_LOG_ERR, "%s, DrawPrimitive failed\r\n", __FUNCTION__); + goto done; + } + + hr = m_pD3DD9->EndScene(); + if (FAILED(hr)) + { + log_print(HT_LOG_ERR, "%s, EndScene failed\r\n", __FUNCTION__); + goto done; + } + + hr = m_pD3DD9->Present(&rect, &rect, NULL, NULL); + +done: + + if (hr == D3DERR_DEVICELOST || hr == D3DERR_DEVICENOTRESET) + { + log_print(HT_LOG_DBG, "%s, device lost!\r\n", __FUNCTION__); + + m_bReset = TRUE; + return FALSE; + } + + return SUCCEEDED(hr) ? TRUE : FALSE; +} + + + diff --git a/MediaClient/MediaClient/media/video_render_d3d.h b/MediaClient/MediaClient/media/video_render_d3d.h new file mode 100644 index 0000000..47084b6 --- /dev/null +++ b/MediaClient/MediaClient/media/video_render_d3d.h @@ -0,0 +1,101 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef VIDEO_RENDER_D3D_H +#define VIDEO_RENDER_D3D_H + +#include "video_render.h" +#include +#include + +/***************************************************************************************/ + +typedef struct _YUV_VERTEX +{ + D3DXVECTOR4 pos; + DWORD color; + D3DXVECTOR2 tex1; + D3DXVECTOR2 tex2; + D3DXVECTOR2 tex3; +} YUV_VERTEX; + +enum GEOMETRICTRANSFORMATION +{ + GS_NONE = 0, + GS_UPPER_DOWN_FLIP = 1, + GS_LEFT_RIGHT_FLIP = 2 +}; + +#define Y_TEX 0 +#define U_TEX 1 +#define V_TEX 2 +#define COUNT_YUV_TEX 3 + +/***************************************************************************************/ + +class CD3DVideoRender : public CVideoRender +{ +public: + CD3DVideoRender(); + ~CD3DVideoRender(); + + BOOL init(WId wid, int w, int h, int videofmt); + void unInit(); + + BOOL render(AVFrame * frame, int mode); + +private: + BOOL initDevice(D3DPRESENT_PARAMETERS * pD3DPP, HWND hWnd); + BOOL initD3DPP(D3DPRESENT_PARAMETERS * pD3DPP, HWND hWnd); + BOOL initShader(const DWORD * pCode3, const DWORD * pCode2); + BOOL initImageBuffer(int w, int h, int videofmt); + void freeImageBuffer(); + BOOL resetDevice(); + BOOL setImage(GEOMETRICTRANSFORMATION flip, RECT * pDstRect, RECT * pSrcRect); + BOOL setImageArgs(float Transparent, GEOMETRICTRANSFORMATION flip, RECT * pDstRect, RECT * pSrcRect); + +private: + IDirect3D9 * m_pD3D9; + IDirect3DDevice9 * m_pD3DD9; + IDirect3DSurface9 * m_pRenderSurface; + IDirect3DTexture9 * m_pTexture[3]; + IDirect3DTexture9 * m_pTexTemp[3]; + D3DXVECTOR2 m_texPoint[4]; + D3DXVECTOR4 m_verPoint[4]; + LPDIRECT3DVERTEXBUFFER9 m_pVertices; + LPDIRECT3DPIXELSHADER9 m_pPixelShader; + LPD3DXCONSTANTTABLE m_pPixelConstTable; + D3DXHANDLE m_hYUVTexture[3]; + D3DXCONSTANT_DESC m_dYUVTexture[3]; + D3DXHANDLE m_hTransparent; + GEOMETRICTRANSFORMATION m_nFlip; + float m_dTransparent; + DWORD m_dwColor; + + BOOL m_bReset; + RECT m_dstRect; + RECT m_srcRect; +}; + + +#endif // end of VIDEO_RENDER_D3D_H + + + + diff --git a/MediaClient/MediaClient/media/video_render_gdi.cpp b/MediaClient/MediaClient/media/video_render_gdi.cpp new file mode 100644 index 0000000..f464412 --- /dev/null +++ b/MediaClient/MediaClient/media/video_render_gdi.cpp @@ -0,0 +1,254 @@ +/*************************************************************************************** + * + * 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 "video_render_gdi.h" + + +/***************************************************************************************/ +#pragma comment(lib, "vfw32") + +/***************************************************************************************/ + +CGDIVideoRender::CGDIVideoRender() +: CVideoRender() +, m_hDC(NULL) +, m_hCompatDC(NULL) +, m_hCompatBitmap(NULL) +, m_hDib(NULL) +, m_bReinit(FALSE) +{ + memset(&m_bmpHdr, 0, sizeof(m_bmpHdr)); + memset(&m_dstRect, 0, sizeof(RECT)); +} + +CGDIVideoRender::~CGDIVideoRender() +{ + unInit(); +} + +BOOL CGDIVideoRender::init(WId wid, int w, int h, int videofmt) +{ + HWND hWnd = (HWND)wid; + + m_hDC = ::GetDC(hWnd); + if (NULL == m_hDC) + { + return FALSE; + } + + m_hCompatDC = ::CreateCompatibleDC(m_hDC); + if (NULL == m_hCompatDC) + { + log_print(HT_LOG_ERR, "%s, CreateCompatibleDC failed\r\n", __FUNCTION__); + return FALSE; + } + + ::SetStretchBltMode(m_hDC, HALFTONE); + ::SetStretchBltMode(m_hCompatDC, HALFTONE); + + RECT rect; + ::GetClientRect(hWnd, &rect); + + m_hCompatBitmap = ::CreateCompatibleBitmap(m_hDC, rect.right - rect.left, rect.bottom - rect.top); + if (NULL == m_hCompatBitmap) + { + log_print(HT_LOG_ERR, "%s, CreateCompatibleBitmap failed\r\n", __FUNCTION__); + return FALSE; + } + + ::SelectObject(m_hCompatDC, m_hCompatBitmap); + + memset(&m_bmpHdr, 0, sizeof(BITMAPINFOHEADER)); + + m_bmpHdr.biSize = 40; + m_bmpHdr.biWidth = w; + m_bmpHdr.biHeight = h; + m_bmpHdr.biBitCount = 24; + m_bmpHdr.biPlanes = 1; + m_bmpHdr.biSizeImage = w * h * m_bmpHdr.biBitCount / 8; + + m_hDib = ::DrawDibOpen(); + if (NULL == m_hDib) + { + log_print(HT_LOG_ERR, "%s, DrawDibOpen failed\r\n", __FUNCTION__); + return FALSE; + } + + int rectw = rect.right - rect.left; + int recth = rect.bottom - rect.top; + + double dw = rectw / (double) w; + double dh = recth / (double) h; + double rate = (dw > dh)? dh : dw; + + int rw = (int)(w * rate); + int rh = (int)(h * rate); + + m_dstRect.left = (rectw - rw) / 2; + m_dstRect.top = (recth - rh) / 2; + m_dstRect.right = m_dstRect.left + rw; + m_dstRect.bottom = m_dstRect.top + rh; + + CVideoRender::init(wid, w, h, videofmt); + + m_bInited = ::DrawDibBegin(m_hDib, m_hCompatDC, rw, rh, &m_bmpHdr, w, h, 0); + + return m_bInited; +} + +void CGDIVideoRender::unInit() +{ + if (m_hCompatDC) + { + ::DeleteDC(m_hCompatDC); + m_hCompatDC = NULL; + } + + if (m_hDC) + { + ::ReleaseDC((HWND)m_hWnd, m_hDC); + m_hDC = NULL; + } + + if (m_hCompatBitmap) + { + ::DeleteObject(m_hCompatBitmap); + m_hCompatBitmap = NULL; + } + + if (m_hDib) + { + ::DrawDibEnd(m_hDib); + ::DrawDibClose(m_hDib); + m_hDib = NULL; + } + + m_bInited = FALSE; +} + +BOOL CGDIVideoRender::render(AVFrame * frame, int mode) +{ + if (NULL == frame) + { + return FALSE; + } + + if (m_bReinit) + { + unInit(); + + if (init(m_hWnd, frame->width, frame->height, m_nVideoFmt)) + { + m_bReinit = FALSE; + } + } + + if (!m_bInited) + { + return FALSE; + } + + BOOL ret = FALSE; + RECT rect; + GetClientRect((HWND)m_hWnd, &rect); + + RECT targetRect; + RECT sourceRect; + + sourceRect.left = 0; + sourceRect.top = 0; + sourceRect.right = frame->width; + sourceRect.bottom = frame->height; + + if (mode == RENDER_MODE_KEEP) + { + int rectw = rect.right - rect.left; + int recth = rect.bottom - rect.top; + + double dw = rectw / (double) frame->width; + double dh = recth / (double) frame->height; + double rate = (dw > dh) ? dh : dw; + + int rw = (int)(frame->width * rate); + int rh = (int)(frame->height * rate); + + targetRect.left = (rectw - rw) / 2; + targetRect.top = (recth - rh) / 2; + targetRect.right = targetRect.left + rw; + targetRect.bottom = targetRect.top + rh; + } + else + { + targetRect = rect; + } + + if (memcmp(&m_dstRect, &targetRect, sizeof(RECT)) != 0) + { + m_bReinit = TRUE; + memcpy(&m_dstRect, &targetRect, sizeof(RECT)); + } + + if (m_nVideoWidth != frame->width || m_nVideoHeight != frame->height) + { + m_bReinit = TRUE; + } + + if (m_bReinit) + { + unInit(); + + if (!init(m_hWnd, frame->width, frame->height, m_nVideoFmt)) + { + log_print(HT_LOG_ERR, "%s, init failed\r\n", __FUNCTION__); + return FALSE; + } + + m_bReinit = FALSE; + } + + ::FillRect(m_hCompatDC, &rect, (HBRUSH) ::GetStockObject(BLACK_BRUSH)); + + if (RENDER_MODE_KEEP == mode) + { + ret = ::DrawDibDraw(m_hDib, m_hCompatDC, targetRect.left, targetRect.top, + targetRect.right - targetRect.left, targetRect.bottom - targetRect.top, + &m_bmpHdr, frame->data[0], + sourceRect.left, sourceRect.top, sourceRect.right - sourceRect.left, + sourceRect.bottom - sourceRect.top, DDF_BACKGROUNDPAL); + } + else + { + ret = ::DrawDibDraw(m_hDib, m_hCompatDC, rect.left, rect.top, + rect.right - rect.left, rect.bottom - rect.top, + &m_bmpHdr, frame->data[0], + sourceRect.left, sourceRect.top, sourceRect.right - sourceRect.left, + sourceRect.bottom - sourceRect.top, DDF_BACKGROUNDPAL); + } + + if (ret) + { + ret = ::BitBlt(m_hDC, 0, 0, rect.right - rect.left, rect.bottom - rect.top , m_hCompatDC, 0, 0, SRCCOPY); + } + + return ret; +} + + + diff --git a/MediaClient/MediaClient/media/video_render_gdi.h b/MediaClient/MediaClient/media/video_render_gdi.h new file mode 100644 index 0000000..a12f178 --- /dev/null +++ b/MediaClient/MediaClient/media/video_render_gdi.h @@ -0,0 +1,58 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef VIDEO_RENDER_GDI_H +#define VIDEO_RENDER_GDI_H + +#include "video_render.h" + + +/***************************************************************************************/ + + +/***************************************************************************************/ + +class CGDIVideoRender : public CVideoRender +{ +public: + CGDIVideoRender(); + ~CGDIVideoRender(); + + BOOL init(WId wid, int w, int h, int videofmt); + void unInit(); + + BOOL render(AVFrame * frame, int mode); + +private: + HDC m_hDC; + HDC m_hCompatDC; + HBITMAP m_hCompatBitmap; + HDRAWDIB m_hDib; + BITMAPINFOHEADER m_bmpHdr; + + BOOL m_bReinit; + RECT m_dstRect; +}; + + +#endif // end of VIDEO_RENDER_GDI_H + + + + diff --git a/MediaClient/MediaClient/media/video_render_sdl.cpp b/MediaClient/MediaClient/media/video_render_sdl.cpp new file mode 100644 index 0000000..0f46339 --- /dev/null +++ b/MediaClient/MediaClient/media/video_render_sdl.cpp @@ -0,0 +1,244 @@ +/*************************************************************************************** + * + * 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 "video_render_sdl.h" +#include "lock.h" +extern "C" +{ +#include +} + + +/***************************************************************************************/ + +static void * g_sdl_mutex = sys_os_create_mutex(); + +/***************************************************************************************/ + +CSDLVideoRender::CSDLVideoRender() +: CVideoRender() +, m_pWindow(NULL) +, m_pRenderer(NULL) +, m_pTexture(NULL) +{ +} + +CSDLVideoRender::~CSDLVideoRender() +{ + unInit(); +} + +BOOL CSDLVideoRender::init(WId hWnd, int w, int h, int videofmt) +{ + CVideoRender::init(hWnd, w, h, videofmt); + + CLock lock(g_sdl_mutex); + + m_bInited = initTexture(); + + return m_bInited; +} + +void CSDLVideoRender::unInit() +{ + CLock lock(g_sdl_mutex); + + if (m_pTexture) + { + SDL_DestroyTexture(m_pTexture); + m_pTexture = NULL; + } + + if (m_pRenderer) + { + SDL_DestroyRenderer(m_pRenderer); + m_pRenderer = NULL; + } + + if (m_pWindow) + { + SDL_DestroyWindow(m_pWindow); + m_pWindow = NULL; + } + + m_bInited = FALSE; +} + +BOOL CSDLVideoRender::reInit(WId hWnd, int w, int h, int videofmt) +{ + BOOL ret; +#ifdef IOS + char title[512] = {'\0'}; + + if (m_pWindow) + { + const char * p_title = SDL_GetWindowTitle(m_pWindow); + if (p_title) + { + strncpy(title, p_title, sizeof(title)-1); + } + } +#endif + + unInit(); + + ret = init(m_hWnd, w, h, m_nVideoFmt); + +#ifdef IOS + if (ret && m_pWindow) + { + SDL_SetWindowTitle(m_pWindow, title); + } +#endif + + return ret; +} + +BOOL CSDLVideoRender::render(AVFrame * frame, int mode) +{ + if (!m_bInited || NULL == frame) + { + return FALSE; + } + + return renderTexture(frame, mode); +} + +BOOL CSDLVideoRender::initTexture() +{ +#ifdef IOS + // On Mac platform, SDL does not support rendering videos on child windows + // and must be presented on a separate top-level window + m_pWindow = SDL_CreateWindow("", 0, 0, 400, 300, SDL_WINDOW_SHOWN|SDL_WINDOW_RESIZABLE); +#else + m_pWindow = SDL_CreateWindowFrom((void *)m_hWnd); +#endif + if (NULL == m_pWindow) + { + return FALSE; + } + + m_pRenderer = SDL_CreateRenderer(m_pWindow, -1, 0); + if (NULL == m_pRenderer) + { + return FALSE; + } + + m_pTexture = SDL_CreateTexture(m_pRenderer, SDL_PIXELFORMAT_YV12, SDL_TEXTUREACCESS_STREAMING, m_nVideoWidth, m_nVideoHeight); + if (NULL == m_pTexture) + { + return FALSE; + } + + SDL_ShowWindow(m_pWindow); + + return TRUE; +} + +BOOL CSDLVideoRender::renderTexture(AVFrame * frame, int mode) +{ + int pitch; + uint8 * ptr; + uint8 * pixels; + AVFrame dstFrame; + + if (m_nVideoWidth != frame->width || m_nVideoHeight != frame->height) + { + if (!reInit(m_hWnd, frame->width, frame->height, m_nVideoFmt)) + { + return TRUE; + } + + m_nVideoWidth = frame->width; + m_nVideoHeight = frame->height; + } + + memset(&dstFrame, 0, sizeof(AVFrame)); + + SDL_LockTexture(m_pTexture, NULL, (void **)&pixels, &pitch); + + av_image_fill_arrays(dstFrame.data, dstFrame.linesize, pixels, AV_PIX_FMT_YUV420P, m_nVideoWidth, m_nVideoHeight, 1); + + // swap UV plane + ptr = dstFrame.data[1]; + dstFrame.data[1] = dstFrame.data[2]; + dstFrame.data[2] = ptr; + + av_image_copy(dstFrame.data, dstFrame.linesize, (const uint8_t**)frame->data, frame->linesize, AV_PIX_FMT_YUV420P, m_nVideoWidth, m_nVideoHeight); + + SDL_UnlockTexture(m_pTexture); + + SDL_RenderClear(m_pRenderer); + + int w, h; + SDL_Rect rect; + + SDL_GetRendererOutputSize(m_pRenderer, &w, &h); + + if (mode == RENDER_MODE_KEEP) + { + double dw = w / (double) m_nVideoWidth; + double dh = h / (double) m_nVideoHeight; + double rate = (dw > dh) ? dh : dw; + + int rw = (int)(m_nVideoWidth * rate); + int rh = (int)(m_nVideoHeight * rate); + + rect.x = (w - rw) / 2; + rect.y = (h - rh) / 2; + rect.w = rw; + rect.h = rh; + } + else + { + rect.x = 0; + rect.y = 0; + rect.w = w; + rect.h = h; + } + + SDL_RenderCopy(m_pRenderer, m_pTexture, NULL, &rect); + + SDL_RenderPresent(m_pRenderer); + + return TRUE; +} + +void CSDLVideoRender::setWindowSize(QSize size) +{ + reInit(m_hWnd, m_nVideoWidth, m_nVideoHeight, m_nVideoFmt); +} + +void CSDLVideoRender::setWindowTitle(const char * title) +{ + if (m_pWindow) + { + if (title) + { + SDL_SetWindowTitle(m_pWindow, title); + } + else + { + SDL_SetWindowTitle(m_pWindow, ""); + } + } +} + + diff --git a/MediaClient/MediaClient/media/video_render_sdl.h b/MediaClient/MediaClient/media/video_render_sdl.h new file mode 100644 index 0000000..0a1a1ed --- /dev/null +++ b/MediaClient/MediaClient/media/video_render_sdl.h @@ -0,0 +1,57 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef VIDEO_RENDER_SDL_H +#define VIDEO_RENDER_SDL_H + +#include "video_render.h" +#include +#include + +/***************************************************************************************/ + +class CSDLVideoRender : public CVideoRender +{ +public: + CSDLVideoRender(); + ~CSDLVideoRender(); + + BOOL init(WId hWnd, int w, int h, int videofmt); + void unInit(); + + BOOL render(AVFrame * frame, int mode); + void setWindowSize(QSize size); + void setWindowTitle(const char * title); + +private: + BOOL reInit(WId hWnd, int w, int h, int videofmt); + BOOL initTexture(); + BOOL renderTexture(AVFrame * frame, int mode); + +private: + SDL_Window * m_pWindow; + SDL_Renderer * m_pRenderer; + SDL_Texture * m_pTexture; +}; + + +#endif + + + diff --git a/MediaClient/MediaClient/mediaclient_zh.qm b/MediaClient/MediaClient/mediaclient_zh.qm new file mode 100644 index 0000000..49eaab4 Binary files /dev/null and b/MediaClient/MediaClient/mediaclient_zh.qm differ diff --git a/MediaClient/MediaClient/mediaclient_zh.ts b/MediaClient/MediaClient/mediaclient_zh.ts new file mode 100644 index 0000000..6e9475a --- /dev/null +++ b/MediaClient/MediaClient/mediaclient_zh.ts @@ -0,0 +1,643 @@ + + + + + CustomLayoutWidget + + + Custom layout setting + 自定义窗å£å¸ƒå±€è®¾ç½® + + + + Gird size + ç½‘æ ¼å¤§å° + + + + Row + 行 + + + + Col + 列 + + + + OK + + + + + Cancel + å–æ¶ˆ + + + + FloatWidget + + + Pause + æš‚åœ + + + + Stop + åœæ­¢ + + + + Micphone + 麦克风 + + + + Snapshot + 截图 + + + + Video record + 视频录制 + + + + + 00:00 + + + + + Volume + éŸ³é‡ + + + + Play + 播放 + + + + MediaClient + + + Stop all videos + åœæ­¢æ‰€æœ‰è§†é¢‘ + + + + Full Screen + å…¨å± + + + + One + 1ç”»é¢ + + + + Four + 4ç”»é¢ + + + + Six + 6ç”»é¢ + + + + Nine + 9ç”»é¢ + + + + Sixteen + 16ç”»é¢ + + + + Custom Layout + 自定义布局 + + + + + System setting + 系统设置 + + + + MediaInfo + + + Media Information + åª’ä½“ä¿¡æ¯ + + + + Video + 视频 + + + + + Codec + ç¼–ç  + + + + Resolution + 分辨率 + + + + Frame rate + 帧率 + + + + Audio + 音频 + + + + Sample rate + 采样率 + + + + Channels + å£°é“ + + + + Url : + æºåœ°å€ + + + + Close + 关闭 + + + + + Unknow + 未知 + + + + Mono + å•å£°é“ + + + + Stereo + 立体声 + + + + OpenMedia + + + Open Media + 打开媒体 + + + + Open File + 打开文件 + + + + Select + é€‰å– + + + + File Path : + 文件路径 + + + + Open Url + 打开URL + + + + Password + å¯†ç  + + + + Username + 用户å + + + + Url + URL + + + + OK + + + + + Cancel + å–æ¶ˆ + + + + Select media file + 选å–媒体文件 + + + + Tips + æç¤º + + + + Invalid URL format! + 无效URLæ ¼å¼ + + + + SystemSetting + + + System Settings + 系统设置 + + + + Language + 语言 + + + + Take effect after restart + é‡å¯åŽç”Ÿæ•ˆ + + + + Enable Log + 开坿—¥å¿— + + + + Log Level + 日志级别 + + + + Prefer to use RTP over UDP + 优先使用RTP over UDP + + + + Force multicast RTP via RTSP + 强制多播RTP + + + + Tunnel RTSP and RTP over HTTP + RTSPå’ŒRTP使用HTTPéš§é“ + + + + HTTP port + HTTPç«¯å£ + + + + Tunnel RTSP and RTP over Websocket + RTSPå’ŒRTP使用Websocketéš§é“ + + + + Websocket port + Websocketç«¯å£ + + + + Hardware-accelerated decoding + ç¡¬ä»¶åŠ é€Ÿè§£ç  + + + + Default video render mode + é»˜è®¤è§†é¢‘æ¸²æŸ“æ¨¡å¼ + + + + Audio capture device + 音频æ•获设备 + + + + Snapshot Path + 截图ä¿å­˜è·¯å¾„ + + + + + Select snapshot save path + 选择截图ä¿å­˜è·¯å¾„ + + + + Open snapshot path + 打开截图ä¿å­˜è·¯å¾„ + + + + Recording Path + 录åƒä¿å­˜è·¯å¾„ + + + + Select video recording save path + 选择录åƒä¿å­˜è·¯å¾„ + + + + Open video recording path + 打开录åƒä¿å­˜è·¯å¾„ + + + + Max recording time + 最大录制时间 + + + + HH:mm:ss + + + + + Max file size (KB) + æœ€å¤§æ–‡ä»¶å¤§å° (KB) + + + + Confirm + 确认 + + + + Cancel + å–æ¶ˆ + + + + TRACE + + + + + DEBUG + + + + + INFO + + + + + WARNING + + + + + ERROR + + + + + FATAL + + + + + System + 系统 + + + + English + 英语 + + + + Chinese + 中文 + + + + Keep the original aspect ratio + ä¿æŒåŽŸå§‹çºµæ¨ªæ¯”çŽ‡ + + + + Fill the whole window + å¡«å……æ•´ä¸ªçª—å£ + + + + Automatic + 自动 + + + + Direct3D11 Video Acceleration + Direct3D11 视频加速 + + + + DirectX Video Acceleration (DXVA) 2.0 + DirectX 视频加速 (DXVA) 2.0 + + + + Video Tool Box + + + + + + OPENCL + + + + + Media Codec + + + + + VAAPI + + + + + Disable + ç¦ç”¨ + + + + + + + Tips + æç¤º + + + + Snapshot path not exist + 截图ä¿å­˜è·¯å¾„ä¸å­˜åœ¨ + + + + Record path not exist + 视频录制ä¿å­˜è·¯å¾„ä¸å­˜åœ¨ + + + + Select record save path + 选择视频录制ä¿å­˜è·¯å¾„ + + + + Please specify the correct snapshot path + 请指定正确的截图ä¿å­˜è·¯å¾„ + + + + Please specify the correct video recording path + 请指定正确的视频录制ä¿å­˜è·¯å¾„ + + + + VideoWidget + + + + Close Video + 关闭视频 + + + + + Full Screen + å…¨å± + + + + + Exit Full Screen + é€€å‡ºå…¨å± + + + + + Fill the whole window + å¡«å……æ•´ä¸ªçª—å£ + + + + + Keep the original aspect ratio + ä¿æŒåŽŸå§‹çºµæ¨ªæ¯”çŽ‡ + + + + Media information ... + åª’ä½“ä¿¡æ¯ ... + + + + Media information + åª’ä½“ä¿¡æ¯ + + + + + Pause + æš‚åœ + + + + Connecting + 正在连接... + + + + Connect failed + 连接失败 + + + + NO Signal + æ— ä¿¡å· + + + + NO Data + æ— æ•°æ® + + + + Authenticate failed + 认è¯å¤±è´¥ + + + + Play + 播放 + + + + + Tips + æç¤º + + + + Write file failed to check the file path, save path: + + 写入文件失败,请检查文件路径,ä¿å­˜è·¯å¾„: + + + + Snapshot successful. save path: + + 截图æˆåŠŸ.ä¿å­˜è·¯å¾„: + + + + Stop video record + åœæ­¢è§†é¢‘录制 + + + + Video record + 视频录制 + + + + Stop micphone + åœæ­¢éº¦å…‹é£Ž + + + + Micphone + 麦克风 + + + diff --git a/MediaClient/MediaClient/mklinks.sh b/MediaClient/MediaClient/mklinks.sh new file mode 100644 index 0000000..7bcae06 --- /dev/null +++ b/MediaClient/MediaClient/mklinks.sh @@ -0,0 +1,117 @@ +#! /bin/sh + +CUR=$PWD + +if [ ! -f $CUR/ffmpeg/lib/linux/libavcodec.so.58 ]; then +ln -s $CUR/ffmpeg/lib/linux/libavcodec.so.58.18.100 $CUR/ffmpeg/lib/linux/libavcodec.so.58 +fi + +if [ ! -f $CUR/ffmpeg/lib/linux/libavcodec.so ]; then +ln -s $CUR/ffmpeg/lib/linux/libavcodec.so.58.18.100 $CUR/ffmpeg/lib/linux/libavcodec.so +fi + +if [ ! -f $CUR/ffmpeg/lib/linux/libavdevice.so.58 ]; then +ln -s $CUR/ffmpeg/lib/linux/libavdevice.so.58.3.100 $CUR/ffmpeg/lib/linux/libavdevice.so.58 +fi + +if [ ! -f $CUR/ffmpeg/lib/linux/libavdevice.so ]; then +ln -s $CUR/ffmpeg/lib/linux/libavdevice.so.58.3.100 $CUR/ffmpeg/lib/linux/libavdevice.so +fi + +if [ ! -f $CUR/ffmpeg/lib/linux/libavfilter.so.7 ]; then +ln -s $CUR/ffmpeg/lib/linux/libavfilter.so.7.16.100 $CUR/ffmpeg/lib/linux/libavfilter.so.7 +fi + +if [ ! -f $CUR/ffmpeg/lib/linux/libavfilter.so ]; then +ln -s $CUR/ffmpeg/lib/linux/libavfilter.so.7.16.100 $CUR/ffmpeg/lib/linux/libavfilter.so +fi + +if [ ! -f $CUR/ffmpeg/lib/linux/libavformat.so.58 ]; then +ln -s $CUR/ffmpeg/lib/linux/libavformat.so.58.12.100 $CUR/ffmpeg/lib/linux/libavformat.so.58 +fi + +if [ ! -f $CUR/ffmpeg/lib/linux/libavformat.so ]; then +ln -s $CUR/ffmpeg/lib/linux/libavformat.so.58.12.100 $CUR/ffmpeg/lib/linux/libavformat.so +fi + +if [ ! -f $CUR/ffmpeg/lib/linux/libavutil.so.56 ]; then +ln -s $CUR/ffmpeg/lib/linux/libavutil.so.56.14.100 $CUR/ffmpeg/lib/linux/libavutil.so.56 +fi + +if [ ! -f $CUR/ffmpeg/lib/linux/libavutil.so ]; then +ln -s $CUR/ffmpeg/lib/linux/libavutil.so.56.14.100 $CUR/ffmpeg/lib/linux/libavutil.so +fi + +if [ ! -f $CUR/ffmpeg/lib/linux/libpostproc.so.55 ]; then +ln -s $CUR/ffmpeg/lib/linux/libpostproc.so.55.1.100 $CUR/ffmpeg/lib/linux/libpostproc.so.55 +fi + +if [ ! -f $CUR/ffmpeg/lib/linux/libpostproc.so ]; then +ln -s $CUR/ffmpeg/lib/linux/libpostproc.so.55.1.100 $CUR/ffmpeg/lib/linux/libpostproc.so +fi + +if [ ! -f $CUR/ffmpeg/lib/linux/libswresample.so.3 ]; then +ln -s $CUR/ffmpeg/lib/linux/libswresample.so.3.1.100 $CUR/ffmpeg/lib/linux/libswresample.so.3 +fi + +if [ ! -f $CUR/ffmpeg/lib/linux/libswresample.so ]; then +ln -s $CUR/ffmpeg/lib/linux/libswresample.so.3.1.100 $CUR/ffmpeg/lib/linux/libswresample.so +fi + +if [ ! -f $CUR/ffmpeg/lib/linux/libswscale.so.5 ]; then +ln -s $CUR/ffmpeg/lib/linux/libswscale.so.5.1.100 $CUR/ffmpeg/lib/linux/libswscale.so.5 +fi + +if [ ! -f $CUR/ffmpeg/lib/linux/libswscale.so ]; then +ln -s $CUR/ffmpeg/lib/linux/libswscale.so.5.1.100 $CUR/ffmpeg/lib/linux/libswscale.so +fi + +if [ ! -f $CUR/ffmpeg/lib/linux/libopus.so.0 ]; then +ln -s $CUR/ffmpeg/lib/linux/libopus.so.0.8.0 $CUR/ffmpeg/lib/linux/libopus.so.0 +fi + +if [ ! -f $CUR/ffmpeg/lib/linux/libopus.so ]; then +ln -s $CUR/ffmpeg/lib/linux/libopus.so.0.8.0 $CUR/ffmpeg/lib/linux/libopus.so +fi + +if [ ! -f $CUR/ffmpeg/lib/linux/libx264.so ]; then +ln -s $CUR/ffmpeg/lib/linux/libx264.so.161 $CUR/ffmpeg/lib/linux/libx264.so +fi + +if [ ! -f $CUR/ffmpeg/lib/linux/libx265.so ]; then +ln -s $CUR/ffmpeg/lib/linux/libx265.so.116 $CUR/ffmpeg/lib/linux/libx265.so +fi + +if [ ! -f $CUR/openssl/lib/linux/libssl.so ]; then +ln -s $CUR/openssl/lib/linux/libssl.so.1.1 $CUR/openssl/lib/linux/libssl.so +fi + +if [ ! -f $CUR/openssl/lib/linux/libcrypto.so ]; then +ln -s $CUR/openssl/lib/linux/libcrypto.so.1.1 $CUR/openssl/lib/linux/libcrypto.so +fi + +if [ ! -f $CUR/zlib/lib/linux/libz.so.1 ]; then +ln -s $CUR/zlib/lib/linux/libz.so.1.2.11 $CUR/zlib/lib/linux/libz.so.1 +fi + +if [ ! -f $CUR/zlib/lib/linux/libz.so ]; then +ln -s $CUR/zlib/lib/linux/libz.so.1.2.11 $CUR/zlib/lib/linux/libz.so +fi + +if [ ! -f $CUR/sdl/lib/linux/libSDL2-2.0.so.0 ]; then +ln -s $CUR/sdl/lib/linux/libSDL2-2.0.so.0.14.0 $CUR/sdl/lib/linux/libSDL2-2.0.so.0 +fi + +if [ ! -f $CUR/sdl/lib/linux/libSDL2.so ]; then +ln -s $CUR/sdl/lib/linux/libSDL2-2.0.so.0.14.0 $CUR/sdl/lib/linux/libSDL2.so +fi + +if [ ! -f $CUR/libsrt/lib/linux/libsrt.so.1.5 ]; then +ln -s $CUR/libsrt/lib/linux/libsrt.so.1.5.0 $CUR/libsrt/lib/linux/libsrt.so.1.5 +fi + +if [ ! -f $CUR/libsrt/lib/linux/libsrt.so ]; then +ln -s $CUR/libsrt/lib/linux/libsrt.so.1.5 $CUR/libsrt/lib/linux/libsrt.so +fi + +echo "make symbolic link finish!" diff --git a/MediaClient/MediaClient/onvif/onvif.h b/MediaClient/MediaClient/onvif/onvif.h new file mode 100644 index 0000000..6cf10d8 --- /dev/null +++ b/MediaClient/MediaClient/onvif/onvif.h @@ -0,0 +1,534 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef __H_ONVIF_H__ +#define __H_ONVIF_H__ + +#include "sys_inc.h" +#include "http.h" +#include "onvif_cm.h" +#include "onvif_act.h" + + +/***************************************************************************************/ + +// device type +#define ODT_UNKNOWN 0 // Unknow device type +#define ODT_NVT 1 // ONVIF Network Video Transmitter +#define ODT_NVD 2 // ONVIF Network Video Display +#define ODT_NVS 3 // ONVIF Network video Storage +#define ODT_NVA 4 // ONVIF Network video Analytics + +// device flag +#define FLAG_MANUAL (1 << 0) // manual added device, other auto discovery devices + + +/***************************************************************************************/ +typedef struct +{ + int type; // device type + char EndpointReference[100]; // endpoint reference + int MetadataVersion; // metadata version + + uint32 sizeScopes; // sopes numbers + onvif_Scope scopes[MAX_SCOPE_NUMS]; // scopes + + onvif_XAddr XAddr; // xaddr, include port host, url +} DEVICE_BINFO; + +/***************************************************************************************/ + +// video source list +typedef struct _VideoSourceList +{ + struct _VideoSourceList * next; + + onvif_VideoSource VideoSource; +} VideoSourceList; + +// video source mode list +typedef struct _VideoSourceModeList +{ + struct _VideoSourceModeList * next; + + onvif_VideoSourceMode VideoSourceMode; +} VideoSourceModeList; + +// video source configuration list +typedef struct _VideoSourceConfigurationList +{ + struct _VideoSourceConfigurationList * next; + + onvif_VideoSourceConfiguration Configuration; +} VideoSourceConfigurationList; + +// video encoder configuration list +typedef struct _VideoEncoderConfigurationList +{ + struct _VideoEncoderConfigurationList * next; + + onvif_VideoEncoderConfiguration Configuration; +} VideoEncoderConfigurationList; + +// audio source list +typedef struct _AudioSourceList +{ + struct _AudioSourceList * next; + + onvif_AudioSource AudioSource; +} AudioSourceList; + +// audio source configuration list +typedef struct _AudioSourceConfigurationList +{ + struct _AudioSourceConfigurationList * next; + + onvif_AudioSourceConfiguration Configuration; +} AudioSourceConfigurationList; + +// audio encoder configuration list +typedef struct _AudioEncoderConfigurationList +{ + struct _AudioEncoderConfigurationList * next; + + onvif_AudioEncoderConfiguration Configuration; +} AudioEncoderConfigurationList; + +typedef struct _MetadataConfigurationList +{ + struct _MetadataConfigurationList * next; + + onvif_MetadataConfiguration Configuration; +} MetadataConfigurationList; + +// ptz preset list +typedef struct _PTZPresetList +{ + struct _PTZPresetList * next; + + onvif_PTZPreset PTZPreset; +} PTZPresetList; + +// ptz configuration list +typedef struct _PTZConfigurationList +{ + struct _PTZConfigurationList * next; + + onvif_PTZConfiguration Configuration; +} PTZConfigurationList; + +// ptz node list +typedef struct _PTZNodeList +{ + struct _PTZNodeList * next; + + onvif_PTZNode PTZNode; +} PTZNodeList; + +// preset tour list +typedef struct _PresetTourList +{ + struct _PresetTourList * next; + + onvif_PresetTour PresetTour; +} PresetTourList; + +// video analytics configuration list +typedef struct _VideoAnalyticsConfigurationList +{ + struct _VideoAnalyticsConfigurationList * next; + + ConfigList * rules; // video analytics rule configuration + ConfigList * modules; // video analytics module configuration + + onvif_SupportedRules SupportedRules; // supported rules + + onvif_VideoAnalyticsConfiguration Configuration; +} VideoAnalyticsConfigurationList; + +// network interface list +typedef struct _NetworkInterfaceList +{ + struct _NetworkInterfaceList * next; + + onvif_NetworkInterface NetworkInterface; +} NetworkInterfaceList; + +typedef struct +{ + onvif_NetworkProtocol NetworkProtocol; + onvif_DNSInformation DNSInformation; + onvif_NTPInformation NTPInformation; + onvif_HostnameInformation HostnameInformation; + onvif_NetworkGateway NetworkGateway; + onvif_DiscoveryMode DiscoveryMode; + onvif_NetworkZeroConfiguration ZeroConfiguration; + + NetworkInterfaceList * interfaces; +} ONVIF_NET; + +// user list +typedef struct _UserList +{ + struct _UserList * next; + + onvif_User User; +} UserList; + +// osd configuration list +typedef struct _OSDConfigurationList +{ + struct _OSDConfigurationList * next; + + onvif_OSDConfiguration OSD; +} OSDConfigurationList; + +typedef struct _RecordingList +{ + struct _RecordingList * next; + + onvif_Recording Recording; +} RecordingList; + +typedef struct _RecordingJobList +{ + struct _RecordingJobList * next; + + onvif_RecordingJob RecordingJob; +} RecordingJobList; + +typedef struct _NotificationMessageList +{ + struct _NotificationMessageList * next; + + onvif_NotificationMessage NotificationMessage; +} NotificationMessageList; + +typedef struct +{ + BOOL subscribe; // event subscribed flag + BOOL pullpoint; // create pull point flag + + char reference_addr[256]; // event comsumer address + char producter_addr[256]; // event producter address + char producter_parameters[512]; // event producter reference parameters + + int init_term_time; // termination time, unit is second + time_t renew_time; // the previous renew timestamp + + uint32 notify_nums; // event notify numbers + + NotificationMessageList * notify; // event notify messages +} ONVIF_EVENT; + +typedef struct _ONVIF_PROFILE +{ + struct _ONVIF_PROFILE * next; + + VideoSourceConfigurationList * v_src_cfg; // video source configuration + VideoEncoderConfigurationList * v_enc_cfg; // video encoder configuration + AudioSourceConfigurationList * a_src_cfg; // audio source configuration + AudioEncoderConfigurationList * a_enc_cfg; // audio encoder configuration + PTZConfigurationList * ptz_cfg; // ptz configuration + VideoAnalyticsConfigurationList * va_cfg; // video analytics configuration + MetadataConfigurationList * metadata_cfg; // metadata configuration + + char name[ONVIF_NAME_LEN]; // profile name + char token[ONVIF_TOKEN_LEN]; // profile token + char stream_uri[ONVIF_URI_LEN]; // rtsp stream address + BOOL fixed; // fixed profile flag +} ONVIF_PROFILE; + +typedef struct +{ + uint32 local_ip; // local ip address to connect to server, network byte order + + DEVICE_BINFO binfo; // device basic information + + int timeType; // the device datatime type, 0-invalid time, 1-local time, 2-utc time + onvif_DateTime devTime; // the device datatime + time_t fetchTime; // fetch time + + // request + char username[32]; // login user name, set by user + char password[32]; // login password, set by user + int timeout; // request timeout, uinit is millisecond + + BOOL needAuth; // whether need auth, If TRUE, it indicates that the ws-username-token authentication method is used for authentication + BOOL authFailed; // when login auth failed, set by onvif stack + ONVIF_RET errCode; // error code, set by onvif stack + onvif_Fault fault; // the onvif fault, set by onvif stack, valid when errCode is ONVIF_ERR_HttpResponseError, or please skip it + int retry_cnt; + + ONVIF_PROFILE * curProfile; // current profile pointer, the default pointer the first profile, user can set it (for media service) + + /********************************************************/ + + VideoSourceList * v_src; // the list of video source + AudioSourceList * a_src; // the list of audio source + ONVIF_PROFILE * profiles; // the list of profile (for media service) + MediaProfileList * media_profiles; // the list of media profile (for media service 2) + VideoSourceConfigurationList * v_src_cfg; // the list of video source configuration + AudioSourceConfigurationList * a_src_cfg; // the list of audio source configuration + VideoEncoderConfigurationList * v_enc_cfg; // the list of video encoder configuration + AudioEncoderConfigurationList * a_enc_cfg; // the list of audio encoder configuration + PTZNodeList * ptz_node; // the list of ptz node + PTZConfigurationList * ptz_cfg; // the list of ptz configuration + + /********************************************************/ + ONVIF_EVENT events; // event information + onvif_DeviceInformation DeviceInformation;// device information + onvif_Capabilities Capabilities; // device capabilities +} ONVIF_DEVICE; + + +#ifdef __cplusplus +extern "C" { +#endif + +HT_API void onvif_free_device(ONVIF_DEVICE * p_dev); + +HT_API UserList * onvif_add_User(UserList ** p_head); +HT_API void onvif_free_Users(UserList ** p_head); + +HT_API LocationEntityList * onvif_add_LocationEntity(LocationEntityList ** p_head); +HT_API void onvif_free_LocationEntitis(LocationEntityList ** p_head); + +HT_API StorageConfigurationList * onvif_add_StorageConfiguration(StorageConfigurationList ** p_head); +HT_API void onvif_free_StorageConfigurations(StorageConfigurationList ** p_head); + +HT_API ONVIF_PROFILE * onvif_add_profile(ONVIF_PROFILE ** p_head); +HT_API ONVIF_PROFILE * onvif_find_profile(ONVIF_PROFILE * p_head, const char * token); +HT_API void onvif_free_profile(ONVIF_PROFILE * p_profile); +HT_API void onvif_free_profiles(ONVIF_PROFILE ** p_head); + +HT_API MediaProfileList * onvif_add_MediaProfile(MediaProfileList ** p_head); +HT_API MediaProfileList * onvif_find_MediaProfile(MediaProfileList * p_head, const char * token); +HT_API void onvif_free_MediaProfiles(MediaProfileList ** p_head); + +HT_API VideoSourceList * onvif_add_VideoSource(VideoSourceList ** p_head); +HT_API VideoSourceList * onvif_find_VideoSource(VideoSourceList * p_head, const char * token); +HT_API void onvif_free_VideoSources(VideoSourceList ** p_head); +HT_API VideoSourceList * onvif_get_cur_VideoSource(ONVIF_DEVICE * p_dev); + +HT_API VideoSourceModeList * onvif_add_VideoSourceMode(VideoSourceModeList ** p_head); +HT_API void onvif_free_VideoSourceModes(VideoSourceModeList ** p_head); + +HT_API VideoSourceConfigurationList * onvif_add_VideoSourceConfiguration(VideoSourceConfigurationList ** p_head); +HT_API VideoSourceConfigurationList * onvif_find_VideoSourceConfiguration(VideoSourceConfigurationList * p_head, const char * token); +HT_API void onvif_free_VideoSourceConfigurations(VideoSourceConfigurationList ** p_head); + +HT_API VideoEncoder2ConfigurationList * onvif_add_VideoEncoder2Configuration(VideoEncoder2ConfigurationList ** p_head); +HT_API VideoEncoder2ConfigurationList * onvif_find_VideoEncoder2Configuration(VideoEncoder2ConfigurationList * p_head, const char * token); +HT_API void onvif_free_VideoEncoder2Configurations(VideoEncoder2ConfigurationList ** p_head); + +HT_API NetworkInterfaceList * onvif_add_NetworkInterface(NetworkInterfaceList ** p_head); +HT_API NetworkInterfaceList * onvif_find_NetworkInterface(NetworkInterfaceList * p_head, const char * token); +HT_API void onvif_free_NetworkInterfaces(NetworkInterfaceList ** p_head); + +HT_API Dot11AvailableNetworksList * onvif_add_Dot11AvailableNetworks(Dot11AvailableNetworksList ** p_head); +HT_API void onvif_free_Dot11AvailableNetworks(Dot11AvailableNetworksList ** p_head); + +HT_API OSDConfigurationList * onvif_add_OSDConfiguration(OSDConfigurationList ** p_head); +HT_API OSDConfigurationList * onvif_find_OSDConfiguration(OSDConfigurationList * p_head, const char * token); +HT_API void onvif_free_OSDConfigurations(OSDConfigurationList ** p_head); + +HT_API MetadataConfigurationList * onvif_add_MetadataConfiguration(MetadataConfigurationList ** p_head); +HT_API MetadataConfigurationList * onvif_find_MetadataConfiguration(MetadataConfigurationList * p_head, const char * token); +HT_API void onvif_free_MetadataConfigurations(MetadataConfigurationList ** p_head); + +HT_API VideoEncoderConfigurationList * onvif_add_VideoEncoderConfiguration(VideoEncoderConfigurationList ** p_head); +HT_API VideoEncoderConfigurationList * onvif_find_VideoEncoderConfiguration(VideoEncoderConfigurationList * p_head, const char * token); +HT_API void onvif_free_VideoEncoderConfigurations(VideoEncoderConfigurationList ** p_head); + +HT_API VideoEncoder2ConfigurationOptionsList * onvif_add_VideoEncoder2ConfigurationOptions(VideoEncoder2ConfigurationOptionsList ** p_head); +HT_API VideoEncoder2ConfigurationOptionsList * onvif_find_VideoEncoder2ConfigurationOptions(VideoEncoder2ConfigurationOptionsList * p_head, const char * encoding); +HT_API void onvif_free_VideoEncoder2ConfigurationOptions(VideoEncoder2ConfigurationOptionsList ** p_head); + +HT_API NotificationMessageList * onvif_add_NotificationMessage(NotificationMessageList ** p_head); +HT_API void onvif_free_NotificationMessage(NotificationMessageList * p_message); +HT_API void onvif_free_NotificationMessages(NotificationMessageList ** p_head); +HT_API int onvif_get_NotificationMessages_nums(NotificationMessageList * p_head); + +HT_API void onvif_device_add_NotificationMessages(ONVIF_DEVICE * p_dev, NotificationMessageList * p_notify); +HT_API int onvif_device_free_NotificationMessages(ONVIF_DEVICE * p_dev, int nums); + +HT_API SimpleItemList * onvif_add_SimpleItem(SimpleItemList ** p_head); +HT_API void onvif_free_SimpleItems(SimpleItemList ** p_head); +HT_API const char * onvif_format_SimpleItem(SimpleItemList * p_item); + +HT_API ElementItemList * onvif_add_ElementItem(ElementItemList ** p_head); +HT_API void onvif_free_ElementItems(ElementItemList ** p_head); + +HT_API ImagingPresetList * onvif_add_ImagingPreset(ImagingPresetList ** p_head); +HT_API ImagingPresetList * onvif_find_ImagingPreset(ImagingPresetList * p_head, const char * token); +HT_API void onvif_free_ImagingPresets(ImagingPresetList ** p_head); + +HT_API AudioSourceList * onvif_add_AudioSource(AudioSourceList ** p_head); +HT_API AudioSourceList * onvif_find_AudioSource(AudioSourceList * p_head, const char * token); +HT_API void onvif_free_AudioSources(AudioSourceList ** p_head); + +HT_API AudioSourceConfigurationList * onvif_add_AudioSourceConfiguration(AudioSourceConfigurationList ** p_head); +HT_API AudioSourceConfigurationList * onvif_find_AudioSourceConfiguration(AudioSourceConfigurationList * p_head, const char * token); +HT_API void onvif_free_AudioSourceConfigurations(AudioSourceConfigurationList ** p_head); + +HT_API AudioEncoderConfigurationList * onvif_add_AudioEncoderConfiguration(AudioEncoderConfigurationList ** p_head); +HT_API AudioEncoderConfigurationList * onvif_find_AudioEncoderConfiguration(AudioEncoderConfigurationList * p_head, const char * token); +HT_API void onvif_free_AudioEncoderConfigurations(AudioEncoderConfigurationList ** p_head); + +HT_API AudioEncoder2ConfigurationList * onvif_add_AudioEncoder2Configuration(AudioEncoder2ConfigurationList ** p_head); +HT_API AudioEncoder2ConfigurationList * onvif_find_AudioEncoder2Configuration(AudioEncoder2ConfigurationList * p_head, const char * token); +HT_API void onvif_free_AudioEncoder2Configurations(AudioEncoder2ConfigurationList ** p_head); + +HT_API AudioEncoder2ConfigurationOptionsList * onvif_add_AudioEncoder2ConfigurationOptions(AudioEncoder2ConfigurationOptionsList ** p_head); +HT_API AudioEncoder2ConfigurationOptionsList * onvif_find_AudioEncoder2ConfigurationOptions(AudioEncoder2ConfigurationOptionsList * p_head, const char * encoding); +HT_API void onvif_free_AudioEncoder2ConfigurationOptions(AudioEncoder2ConfigurationOptionsList ** p_head); + +HT_API AudioDecoderConfigurationList * onvif_add_AudioDecoderConfiguration(AudioDecoderConfigurationList ** p_head); +HT_API void onvif_free_AudioDecoderConfigurations(AudioDecoderConfigurationList ** p_head); + +HT_API MaskList * onvif_add_Mask(MaskList ** p_head); +HT_API MaskList * onvif_find_Mask(MaskList * p_head, const char * token); +HT_API void onvif_free_Masks(MaskList ** p_head); + +HT_API PTZNodeList * onvif_add_PTZNode(PTZNodeList ** p_head); +HT_API PTZNodeList * onvif_find_PTZNode(PTZNodeList * p_head, const char * token); +HT_API void onvif_free_PTZNodes(PTZNodeList ** p_head); + +HT_API PTZConfigurationList * onvif_add_PTZConfiguration(PTZConfigurationList ** p_head); +HT_API PTZConfigurationList * onvif_find_PTZConfiguration(PTZConfigurationList * p_head, const char * token); +HT_API void onvif_free_PTZConfigurations(PTZConfigurationList ** p_head); + +HT_API PTZPresetList * onvif_add_PTZPreset(PTZPresetList ** p_head); +HT_API void onvif_free_PTZPresets(PTZPresetList ** p_head); + +HT_API PTZPresetTourSpotList * onvif_add_PTZPresetTourSpot(PTZPresetTourSpotList ** p_head); +HT_API void onvif_free_PTZPresetTourSpots(PTZPresetTourSpotList ** p_head); + +HT_API PresetTourList * onvif_add_PresetTour(PresetTourList ** p_head); +HT_API void onvif_free_PresetTours(PresetTourList ** p_head); + +HT_API ConfigList * onvif_add_Config(ConfigList ** p_head); +HT_API void onvif_free_Config(ConfigList * p_head); +HT_API void onvif_free_Configs(ConfigList ** p_head); +HT_API ConfigList * onvif_find_Config(ConfigList * p_head, const char * name); +HT_API void onvif_remove_Config(ConfigList ** p_head, ConfigList * p_remove); +HT_API ConfigList * onvif_get_prev_Config(ConfigList * p_head, ConfigList * p_found); + +HT_API ConfigDescriptionList * onvif_add_ConfigDescription(ConfigDescriptionList ** p_head); +HT_API void onvif_free_ConfigDescriptions(ConfigDescriptionList ** p_head); + +HT_API ConfigDescription_MessagesList * onvif_add_ConfigDescription_Message(ConfigDescription_MessagesList ** p_head); +HT_API void onvif_free_ConfigDescription_Message(ConfigDescription_MessagesList * p_item); +HT_API void onvif_free_ConfigDescription_Messages(ConfigDescription_MessagesList ** p_head); + +HT_API ConfigOptionsList * onvif_add_ConfigOptions(ConfigOptionsList ** p_head); +HT_API void onvif_free_ConfigOptions(ConfigOptionsList ** p_head); + +HT_API SimpleItemDescriptionList * onvif_add_SimpleItemDescription(SimpleItemDescriptionList ** p_head); +HT_API void onvif_free_SimpleItemDescriptions(SimpleItemDescriptionList ** p_head); + +HT_API VideoAnalyticsConfigurationList * onvif_add_VideoAnalyticsConfiguration(VideoAnalyticsConfigurationList ** p_head); +HT_API void onvif_free_VideoAnalyticsConfiguration(VideoAnalyticsConfigurationList * p_head); +HT_API void onvif_free_VideoAnalyticsConfigurations(VideoAnalyticsConfigurationList ** p_head); + +HT_API AnalyticsModuleConfigOptionsList * onvif_add_AnalyticsModuleConfigOptions(AnalyticsModuleConfigOptionsList ** p_head); +HT_API void onvif_free_AnalyticsModuleConfigOptions(AnalyticsModuleConfigOptionsList ** p_head); + +HT_API MetadataInfoList * onvif_add_MetadataInfo(MetadataInfoList ** p_head); +HT_API void onvif_free_MetadataInfo(MetadataInfoList ** p_head); + +HT_API RecordingList * onvif_add_Recording(RecordingList ** p_head); +HT_API RecordingList * onvif_find_Recording(RecordingList * p_head, const char * token); +HT_API void onvif_free_Recordings(RecordingList ** p_head); + +HT_API TrackList * onvif_add_Track(TrackList ** p_head); +HT_API void onvif_free_Tracks(TrackList ** p_head); +HT_API TrackList * onvif_find_Track(TrackList * p_head, const char * token); + +HT_API RecordingJobList * onvif_add_RecordingJob(RecordingJobList ** p_head); +HT_API RecordingJobList * onvif_find_RecordingJob(RecordingJobList * p_head, const char * token); +HT_API void onvif_free_RecordingJobs(RecordingJobList ** p_head); + +HT_API TrackAttributesList * onvif_add_TrackAttributes(TrackAttributesList ** p_head); +HT_API void onvif_free_TrackAttributes(TrackAttributesList ** p_head); + +HT_API RecordingInformationList * onvif_add_RecordingInformation(RecordingInformationList ** p_head); +HT_API void onvif_free_RecordingInformations(RecordingInformationList ** p_head); + +HT_API FindEventResultList * onvif_add_FindEventResult(FindEventResultList ** p_head); +HT_API void onvif_free_FindEventResults(FindEventResultList ** p_head); + +HT_API FindMetadataResultList * onvif_add_FindMetadataResult(FindMetadataResultList ** p_head); +HT_API void onvif_free_FindMetadataResults(FindMetadataResultList ** p_head); + +HT_API FindPTZPositionResultList * onvif_add_FindPTZPositionResult(FindPTZPositionResultList ** p_head); +HT_API void onvif_free_FindPTZPositionResults(FindPTZPositionResultList ** p_head); + +HT_API AccessPointList * onvif_add_AccessPoint(AccessPointList ** p_head); +HT_API AccessPointList * onvif_find_AccessPoint(AccessPointList * p_head, const char * token); +HT_API void onvif_free_AccessPoints(AccessPointList ** p_head); + +HT_API DoorInfoList * onvif_add_DoorInfo(DoorInfoList ** p_head); +HT_API DoorInfoList * onvif_find_DoorInfo(DoorInfoList * p_head, const char * token); +HT_API void onvif_free_DoorInfos(DoorInfoList ** p_head); + +HT_API DoorList * onvif_add_Door(DoorList ** p_head); +HT_API DoorList * onvif_find_Door(DoorList * p_head, const char * token); +HT_API void onvif_free_Doors(DoorList ** p_head); + +HT_API AreaList * onvif_add_Area(AreaList ** p_head); +HT_API AreaList * onvif_find_Area(AreaList * p_head, const char * token); +HT_API void onvif_free_Areas(AreaList ** p_head); + +HT_API AudioOutputList * onvif_add_AudioOutput(AudioOutputList ** p_head); +HT_API void onvif_free_AudioOutputs(AudioOutputList ** p_head); + +HT_API AudioOutputConfigurationList * onvif_add_AudioOutputConfiguration(AudioOutputConfigurationList ** p_head); +HT_API void onvif_free_AudioOutputConfigurations(AudioOutputConfigurationList ** p_head); + +HT_API RelayOutputOptionsList * onvif_add_RelayOutputOptions(RelayOutputOptionsList ** p_head); +HT_API void onvif_free_RelayOutputOptions(RelayOutputOptionsList ** p_head); + +HT_API RelayOutputList * onvif_add_RelayOutput(RelayOutputList ** p_head); +HT_API RelayOutputList * onvif_find_RelayOutput(RelayOutputList * p_head, const char * token); +HT_API void onvif_free_RelayOutputs(RelayOutputList ** p_head); + +HT_API DigitalInputList * onvif_add_DigitalInput(DigitalInputList ** p_head); +HT_API DigitalInputList * onvif_find_DigitalInput(DigitalInputList * p_head, const char * token); +HT_API void onvif_free_DigitalInputs(DigitalInputList ** p_head); + +HT_API ThermalConfigurationList * onvif_add_ThermalConfiguration(ThermalConfigurationList ** p_head); +HT_API void onvif_free_ThermalConfigurations(ThermalConfigurationList ** p_head); +HT_API ColorPaletteList * onvif_add_ColorPalette(ColorPaletteList ** p_head); +HT_API void onvif_free_ColorPalettes(ColorPaletteList ** p_head); +HT_API NUCTableList * onvif_add_NUCTable(NUCTableList ** p_head); +HT_API void onvif_free_NUCTables(NUCTableList ** p_head); + +HT_API ReceiverList * onvif_add_Receiver(ReceiverList ** p_head); +HT_API ReceiverList * onvif_find_Receiver(ReceiverList * p_head, const char * token); +HT_API void onvif_free_Receivers(ReceiverList ** p_head); + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/MediaClient/MediaClient/onvif/onvif_act.h b/MediaClient/MediaClient/onvif/onvif_act.h new file mode 100644 index 0000000..1677f8f --- /dev/null +++ b/MediaClient/MediaClient/onvif/onvif_act.h @@ -0,0 +1,489 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef ONVIF_ACT_H +#define ONVIF_ACT_H + +/*************************************************************************/ +typedef enum +{ + eActionNull = 0, + + // onvif device service interfaces + etdsGetCapabilities, + etdsGetServices, + etdsGetServiceCapabilities, + etdsGetDeviceInformation, + etdsGetUsers, + etdsCreateUsers, + etdsDeleteUsers, + etdsSetUser, + etdsGetRemoteUser, + etdsSetRemoteUser, + etdsGetNetworkInterfaces, + etdsSetNetworkInterfaces, + etdsGetNTP, + etdsSetNTP, + etdsGetHostname, + etdsSetHostname, + etdsSetHostnameFromDHCP, + etdsGetDNS, + etdsSetDNS, + etdsGetDynamicDNS, + etdsSetDynamicDNS, + etdsGetNetworkProtocols, + etdsSetNetworkProtocols, + etdsGetDiscoveryMode, + etdsSetDiscoveryMode, + etdsGetNetworkDefaultGateway, + etdsSetNetworkDefaultGateway, + etdsGetZeroConfiguration, + etdsSetZeroConfiguration, + etdsGetEndpointReference, + etdsSendAuxiliaryCommand, + etdsGetRelayOutputs, + etdsSetRelayOutputSettings, + etdsSetRelayOutputState, + etdsGetSystemDateAndTime, + etdsSetSystemDateAndTime, + etdsSystemReboot, + etdsSetSystemFactoryDefault, + etdsGetSystemLog, + etdsGetScopes, + etdsSetScopes, + etdsAddScopes, + etdsRemoveScopes, + etdsStartFirmwareUpgrade, + etdsGetSystemUris, + etdsStartSystemRestore, + etdsGetWsdlUrl, + etdsGetDot11Capabilities, + etdsGetDot11Status, + etdsScanAvailableDot11Networks, + etdsGetGeoLocation, + etdsSetGeoLocation, + etdsDeleteGeoLocation, + etdsSetHashingAlgorithm, + etdsGetIPAddressFilter, + etdsSetIPAddressFilter, + etdsAddIPAddressFilter, + etdsRemoveIPAddressFilter, + etdsGetAccessPolicy, + etdsSetAccessPolicy, + etdsGetStorageConfigurations, + etdsCreateStorageConfiguration, + etdsGetStorageConfiguration, + etdsSetStorageConfiguration, + etdsDeleteStorageConfiguration, + + // onvif media service interfaces + etrtGetServiceCapabilities, + etrtGetVideoSources, + etrtGetAudioSources, + etrtCreateProfile, + etrtGetProfile, + etrtGetProfiles, + etrtAddVideoEncoderConfiguration, + etrtAddVideoSourceConfiguration, + etrtAddAudioEncoderConfiguration, + etrtAddAudioSourceConfiguration, + etrtGetVideoSourceModes, + etrtSetVideoSourceMode, + etrtAddPTZConfiguration, + etrtRemoveVideoEncoderConfiguration, + etrtRemoveVideoSourceConfiguration, + etrtRemoveAudioEncoderConfiguration, + etrtRemoveAudioSourceConfiguration, + etrtRemovePTZConfiguration, + etrtDeleteProfile, + etrtGetVideoSourceConfigurations, + etrtGetVideoEncoderConfigurations, + etrtGetAudioSourceConfigurations, + etrtGetAudioEncoderConfigurations, + etrtGetVideoSourceConfiguration, + etrtGetVideoEncoderConfiguration, + etrtGetAudioSourceConfiguration, + etrtGetAudioEncoderConfiguration, + etrtSetVideoSourceConfiguration, + etrtSetVideoEncoderConfiguration, + etrtSetAudioSourceConfiguration, + etrtSetAudioEncoderConfiguration, + etrtGetVideoSourceConfigurationOptions, + etrtGetVideoEncoderConfigurationOptions, + etrtGetAudioSourceConfigurationOptions, + etrtGetAudioEncoderConfigurationOptions, + etrtGetStreamUri, + etrtSetSynchronizationPoint, + etrtGetSnapshotUri, + etrtGetGuaranteedNumberOfVideoEncoderInstances, + etrtGetAudioOutputs, + etrtGetAudioOutputConfigurations, + etrtGetAudioOutputConfiguration, + etrtGetAudioOutputConfigurationOptions, + etrtSetAudioOutputConfiguration, + etrtGetAudioDecoderConfigurations, + etrtGetAudioDecoderConfiguration, + etrtGetAudioDecoderConfigurationOptions, + etrtSetAudioDecoderConfiguration, + etrtAddAudioOutputConfiguration, + etrtAddAudioDecoderConfiguration, + etrtRemoveAudioOutputConfiguration, + etrtRemoveAudioDecoderConfiguration, + etrtGetOSDs, + etrtGetOSD, + etrtSetOSD, + etrtGetOSDOptions, + etrtCreateOSD, + etrtDeleteOSD, + etrtGetVideoAnalyticsConfigurations, + etrtAddVideoAnalyticsConfiguration, + etrtGetVideoAnalyticsConfiguration, + etrtRemoveVideoAnalyticsConfiguration, + etrtSetVideoAnalyticsConfiguration, + etrtGetMetadataConfigurations, + etrtAddMetadataConfiguration, + etrtGetMetadataConfiguration, + etrtRemoveMetadataConfiguration, + etrtSetMetadataConfiguration, + etrtGetMetadataConfigurationOptions, + etrtGetCompatibleVideoEncoderConfigurations, + etrtGetCompatibleAudioEncoderConfigurations, + etrtGetCompatibleVideoAnalyticsConfigurations, + etrtGetCompatibleMetadataConfigurations, + + // onvif media 2 service interfaces + etr2GetServiceCapabilities, + etr2GetVideoEncoderConfigurations, + etr2SetVideoEncoderConfiguration, + etr2GetVideoEncoderConfigurationOptions, + etr2GetProfiles, + etr2CreateProfile, + etr2DeleteProfile, + etr2GetStreamUri, + etr2GetVideoSourceConfigurations, + etr2GetVideoSourceConfigurationOptions, + etr2SetVideoSourceConfiguration, + etr2SetSynchronizationPoint, + etr2GetMetadataConfigurations, + etr2GetMetadataConfigurationOptions, + etr2SetMetadataConfiguration, + etr2GetAudioEncoderConfigurations, + etr2GetAudioSourceConfigurations, + etr2GetAudioSourceConfigurationOptions, + etr2SetAudioSourceConfiguration, + etr2SetAudioEncoderConfiguration, + etr2GetAudioEncoderConfigurationOptions, + etr2AddConfiguration, + etr2RemoveConfiguration, + etr2GetVideoEncoderInstances, + etr2GetAudioOutputConfigurations, + etr2GetAudioOutputConfigurationOptions, + etr2SetAudioOutputConfiguration, + etr2GetAudioDecoderConfigurations, + etr2GetAudioDecoderConfigurationOptions, + etr2SetAudioDecoderConfiguration, + etr2GetSnapshotUri, + etr2StartMulticastStreaming, + etr2StopMulticastStreaming, + etr2GetVideoSourceModes, + etr2SetVideoSourceMode, + etr2CreateOSD, + etr2DeleteOSD, + etr2GetOSDs, + etr2SetOSD, + etr2GetOSDOptions, + etr2GetAnalyticsConfigurations, + etr2GetMasks, + etr2SetMask, + etr2CreateMask, + etr2DeleteMask, + etr2GetMaskOptions, + + // onvif ptz service interfaces + eptzGetServiceCapabilities, + eptzGetNodes, + eptzGetNode, + eptzGetPresets, + eptzSetPreset, + eptzRemovePreset, + eptzGotoPreset, + eptzGotoHomePosition, + eptzSetHomePosition, + eptzGetStatus, + eptzContinuousMove, + eptzRelativeMove, + eptzAbsoluteMove, + eptzStop, + eptzGetConfigurations, + eptzGetConfiguration, + eptzSetConfiguration, + eptzGetConfigurationOptions, + eptzGetPresetTours, + eptzGetPresetTour, + eptzGetPresetTourOptions, + eptzCreatePresetTour, + eptzModifyPresetTour, + eptzOperatePresetTour, + eptzRemovePresetTour, + eptzSendAuxiliaryCommand, + eptzGeoMove, + + // onvif event service interfaces + etevGetServiceCapabilities, + etevGetEventProperties, + etevRenew, + etevUnsubscribe, + etevSubscribe, + etevPauseSubscription, + etevResumeSubscription, + etevCreatePullPointSubscription, + etevDestroyPullPoint, + etevPullMessages, + etevGetMessages, + etevSeek, + etevSetSynchronizationPoint, + + // onvif imaging service interfaces + eimgGetServiceCapabilities, + eimgGetImagingSettings, + eimgSetImagingSettings, + eimgGetOptions, + eimgMove, + eimgStop, + eimgGetStatus, + eimgGetMoveOptions, + eimgGetPresets, + eimgGetCurrentPreset, + eimgSetCurrentPreset, + + // onvif device IO service interfaces + etmdGetServiceCapabilities, + etmdGetRelayOutputs, + etmdGetRelayOutputOptions, + etmdSetRelayOutputSettings, + etmdSetRelayOutputState, + etmdGetDigitalInputs, + etmdGetDigitalInputConfigurationOptions, + etmdSetDigitalInputConfigurations, + + // onvif recording service interfaces + etrcGetServiceCapabilities, + etrcCreateRecording, + etrcDeleteRecording, + etrcGetRecordings, + etrcSetRecordingConfiguration, + etrcGetRecordingConfiguration, + etrcGetRecordingOptions, + etrcCreateTrack, + etrcDeleteTrack, + etrcGetTrackConfiguration, + etrcSetTrackConfiguration, + etrcCreateRecordingJob, + etrcDeleteRecordingJob, + etrcGetRecordingJobs, + etrcSetRecordingJobConfiguration, + etrcGetRecordingJobConfiguration, + etrcSetRecordingJobMode, + etrcGetRecordingJobState, + etrcExportRecordedData, + etrcStopExportRecordedData, + etrcGetExportRecordedDataState, + + // onvif replay service interfaces + etrpGetServiceCapabilities, + etrpGetReplayUri, + etrpGetReplayConfiguration, + etrpSetReplayConfiguration, + + // onvif search service interfaces + etseGetServiceCapabilities, + etseGetRecordingSummary, + etseGetRecordingInformation, + etseGetMediaAttributes, + etseFindRecordings, + etseGetRecordingSearchResults, + etseFindEvents, + etseGetEventSearchResults, + etseFindMetadata, + etseGetMetadataSearchResults, + etseFindPTZPosition, + etseGetPTZPositionSearchResults, + etseGetSearchState, + etseEndSearch, + + // onvif analytics service interfaces + etanGetServiceCapabilities, + etanGetSupportedRules, + etanCreateRules, + etanDeleteRules, + etanGetRules, + etanModifyRules, + etanCreateAnalyticsModules, + etanDeleteAnalyticsModules, + etanGetAnalyticsModules, + etanModifyAnalyticsModules, + etanGetSupportedAnalyticsModules, + etanGetRuleOptions, + etanGetAnalyticsModuleOptions, + etanGetSupportedMetadata, + + // onvif access control service interface + etacGetServiceCapabilities, + etacGetAccessPointInfoList, + etacGetAccessPointInfo, + etacGetAccessPointList, + etacGetAccessPoints, + etacCreateAccessPoint, + etacSetAccessPoint, + etacModifyAccessPoint, + etacDeleteAccessPoint, + etacGetAreaInfoList, + etacGetAreaInfo, + etacGetAreaList, + etacGetAreas, + etacCreateArea, + etacSetArea, + etacModifyArea, + etacDeleteArea, + etacGetAccessPointState, + etacEnableAccessPoint, + etacDisableAccessPoint, + + // onvif door control service interface + etdcGetServiceCapabilities, + etdcGetDoorInfoList, + etdcGetDoorInfo, + etdcGetDoorState, + etdcAccessDoor, + etdcLockDoor, + etdcUnlockDoor, + etdcDoubleLockDoor, + etdcBlockDoor, + etdcLockDownDoor, + etdcLockDownReleaseDoor, + etdcLockOpenDoor, + etdcLockOpenReleaseDoor, + etdcGetDoors, + etdcGetDoorList, + etdcCreateDoor, + etdcSetDoor, + etdcModifyDoor, + etdcDeleteDoor, + + // onvif thermal service interfaces + etthGetServiceCapabilities, + etthGetConfigurations, + etthGetConfiguration, + etthSetConfiguration, + etthGetConfigurationOptions, + etthGetRadiometryConfiguration, + etthSetRadiometryConfiguration, + etthGetRadiometryConfigurationOptions, + + // onvif credential service interfaces + etcrGetServiceCapabilities, + etcrGetCredentialInfo, + etcrGetCredentialInfoList, + etcrGetCredentials, + etcrGetCredentialList, + etcrCreateCredential, + etcrModifyCredential, + etcrDeleteCredential, + etcrGetCredentialState, + etcrEnableCredential, + etcrDisableCredential, + etcrResetAntipassbackViolation, + etcrGetSupportedFormatTypes, + etcrGetCredentialIdentifiers, + etcrSetCredentialIdentifier, + etcrDeleteCredentialIdentifier, + etcrGetCredentialAccessProfiles, + etcrSetCredentialAccessProfiles, + etcrDeleteCredentialAccessProfiles, + + // onvif access rules service interfaces + etarGetServiceCapabilities, + etarGetAccessProfileInfo, + etarGetAccessProfileInfoList, + etarGetAccessProfiles, + etarGetAccessProfileList, + etarCreateAccessProfile, + etarModifyAccessProfile, + etarDeleteAccessProfile, + + // onvif schedule service interface + etscGetServiceCapabilities, + etscGetScheduleInfo, + etscGetScheduleInfoList, + etscGetSchedules, + etscGetScheduleList, + etscCreateSchedule, + etscModifySchedule, + etscDeleteSchedule, + etscGetSpecialDayGroupInfo, + etscGetSpecialDayGroupInfoList, + etscGetSpecialDayGroups, + etscGetSpecialDayGroupList, + etscCreateSpecialDayGroup, + etscModifySpecialDayGroup, + etscDeleteSpecialDayGroup, + etscGetScheduleState, + + // onvif receiver service interface + etrvGetServiceCapabilities, + etrvGetReceivers, + etrvGetReceiver, + etrvCreateReceiver, + etrvDeleteReceiver, + etrvConfigureReceiver, + etrvSetReceiverMode, + etrvGetReceiverState, + + // onvif provisioning service interface + etpvGetServiceCapabilities, + etpvPanMove, + etpvTiltMove, + etpvZoomMove, + etpvRollMove, + etpvFocusMove, + etpvStop, + etpvGetUsage, + + eActionMax +} eOnvifAction; + +typedef struct +{ + eOnvifAction type; + char action_url[256]; +} OVFACTS; + +#ifdef __cplusplus +extern "C" { +#endif + +HT_API OVFACTS * onvif_find_action_by_type(eOnvifAction type); + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/MediaClient/MediaClient/onvif/onvif_api.h b/MediaClient/MediaClient/onvif/onvif_api.h new file mode 100644 index 0000000..d5d7e75 --- /dev/null +++ b/MediaClient/MediaClient/onvif/onvif_api.h @@ -0,0 +1,117 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ +#ifndef ONVIF_API_H +#define ONVIF_API_H + +#include "sys_inc.h" +#include "onvif.h" +#include "onvif_cln.h" + +#ifdef __cplusplus +extern "C" { +#endif + +HT_API BOOL GetCapabilities(ONVIF_DEVICE * p_dev); +HT_API BOOL GetServices(ONVIF_DEVICE * p_dev); +HT_API BOOL GetSystemDateAndTime(ONVIF_DEVICE * p_dev); +HT_API BOOL SetSystemDateAndTime(ONVIF_DEVICE * p_dev); +HT_API BOOL GetDeviceInformation(ONVIF_DEVICE * p_dev); +HT_API BOOL GetProfiles(ONVIF_DEVICE * p_dev); +HT_API BOOL GetStreamUris(ONVIF_DEVICE * p_dev, onvif_TransportProtocol proto); +HT_API BOOL GetVideoSourceConfigurations(ONVIF_DEVICE * p_dev); +HT_API BOOL GetAudioSourceConfigurations(ONVIF_DEVICE * p_dev); +HT_API BOOL GetVideoEncoderConfigurations(ONVIF_DEVICE * p_dev); +HT_API BOOL GetAudioEncoderConfigurations(ONVIF_DEVICE * p_dev); +HT_API BOOL GetNodes(ONVIF_DEVICE * p_dev); +HT_API BOOL GetConfigurations(ONVIF_DEVICE * p_dev); +HT_API BOOL GetVideoSources(ONVIF_DEVICE * p_dev); +HT_API BOOL GetAudioSources(ONVIF_DEVICE * p_dev); +HT_API BOOL GetImagingSettings(ONVIF_DEVICE * p_dev); +HT_API BOOL Subscribe(ONVIF_DEVICE * p_dev, int index); +HT_API BOOL Unsubscribe(ONVIF_DEVICE * p_dev); +HT_API BOOL CreatePullPointSubscription(ONVIF_DEVICE * p_dev); +HT_API BOOL PullMessages(ONVIF_DEVICE * p_dev, int timeout, int message_limit, tev_PullMessages_RES * p_res); + +/** + * @desc Get the device snapshot + * @param + * p_buf [out] return the snapshot buffer + * buflen [out] return the snapshot buffer length + * + * @note if call success, the caller should call FreeSnapshotBuff to free the snapshot buffer + * + */ +HT_API BOOL GetSnapshot(ONVIF_DEVICE * p_dev, const char * profile_token, unsigned char ** p_buf, int * buflen); + +/** + * @desc Free the buffer + * @param + * p_buf the buffer + * + */ +HT_API void FreeBuff(unsigned char * p_buf); + +/** + * @desc Firmware upgrade + * @param + * filename the upgrade filename + * + */ +HT_API BOOL FirmwareUpgrade(ONVIF_DEVICE * p_dev, const char * filename); + +/** + * @desc backup system settings + * @param + * filename , save as system backup + * + */ +HT_API BOOL SystemBackup(ONVIF_DEVICE * p_dev, const char * filename); + +/** + * @desc restore system settings + * @param + * filename the system backup filename + * + */ +HT_API BOOL SystemRestore(ONVIF_DEVICE * p_dev, const char * filename); + +// media service 2 interface +HT_API BOOL tr2_GetProfiles(ONVIF_DEVICE * p_dev); + +/** + * @desc GetStreamUris + * @param + * proto: + * RtspUnicast -- RTSP streaming RTP as UDP Unicast + * RtspMulticast -- RTSP streaming RTP as UDP Multicast + * RTSP -- RTSP streaming RTP over TCP + * RtspOverHttp -- Tunneling both the RTSP control channel and the RTP stream over HTTP or HTTPS + */ +HT_API BOOL tr2_GetStreamUris(ONVIF_DEVICE * p_dev, const char * proto); +HT_API BOOL tr2_GetVideoSourceConfigurations(ONVIF_DEVICE * p_dev); +HT_API BOOL tr2_GetAudioSourceConfigurations(ONVIF_DEVICE * p_dev); + +#ifdef __cplusplus +} +#endif + +#endif + + + diff --git a/MediaClient/MediaClient/onvif/onvif_cln.h b/MediaClient/MediaClient/onvif/onvif_cln.h new file mode 100644 index 0000000..ee7ab7d --- /dev/null +++ b/MediaClient/MediaClient/onvif/onvif_cln.h @@ -0,0 +1,487 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef ONVIF_CLIENT_H +#define ONVIF_CLIENT_H + +#include "onvif.h" +#include "onvif_req.h" +#include "onvif_res.h" + +#ifdef __cplusplus +extern "C" { +#endif + +HT_API void onvif_SetAuthInfo(ONVIF_DEVICE * p_dev, const char * user, const char * pass); +HT_API void onvif_SetAuthMethod(ONVIF_DEVICE * p_dev, onvif_AuthMethod method); +HT_API void onvif_SetReqTimeout(ONVIF_DEVICE * p_dev, int timeout /* millisecond */); +HT_API char * onvif_GetErrString(ONVIF_DEVICE * p_dev); + +// onvif device service interfaces +HT_API BOOL onvif_tds_GetCapabilities(ONVIF_DEVICE * p_dev, tds_GetCapabilities_REQ * p_req, tds_GetCapabilities_RES * p_res); +HT_API BOOL onvif_tds_GetServices(ONVIF_DEVICE * p_dev, tds_GetServices_REQ * p_req, tds_GetServices_RES * p_res); +HT_API BOOL onvif_tds_GetServiceCapabilities(ONVIF_DEVICE * p_dev, tds_GetServiceCapabilities_REQ * p_req, tds_GetServiceCapabilities_RES * p_res); +HT_API BOOL onvif_tds_GetDeviceInformation(ONVIF_DEVICE * p_dev, tds_GetDeviceInformation_REQ * p_req, tds_GetDeviceInformation_RES * p_res); +HT_API BOOL onvif_tds_GetUsers(ONVIF_DEVICE * p_dev, tds_GetUsers_REQ * p_req, tds_GetUsers_RES * p_res); +HT_API BOOL onvif_tds_CreateUsers(ONVIF_DEVICE * p_dev, tds_CreateUsers_REQ * p_req, tds_CreateUsers_RES * p_res); +HT_API BOOL onvif_tds_DeleteUsers(ONVIF_DEVICE * p_dev, tds_DeleteUsers_REQ * p_req, tds_DeleteUsers_RES * p_res); +HT_API BOOL onvif_tds_SetUser(ONVIF_DEVICE * p_dev, tds_SetUser_REQ * p_req, tds_SetUser_RES * p_res); +HT_API BOOL onvif_tds_GetRemoteUser(ONVIF_DEVICE * p_dev, tds_GetRemoteUser_REQ * p_req, tds_GetRemoteUser_RES * p_res); +HT_API BOOL onvif_tds_SetRemoteUser(ONVIF_DEVICE * p_dev, tds_SetRemoteUser_REQ * p_req, tds_SetRemoteUser_RES * p_res); +HT_API BOOL onvif_tds_GetNetworkInterfaces(ONVIF_DEVICE * p_dev, tds_GetNetworkInterfaces_REQ * p_req, tds_GetNetworkInterfaces_RES * p_res); +HT_API BOOL onvif_tds_SetNetworkInterfaces(ONVIF_DEVICE * p_dev, tds_SetNetworkInterfaces_REQ * p_req, tds_SetNetworkInterfaces_RES * p_res); +HT_API BOOL onvif_tds_GetNTP(ONVIF_DEVICE * p_dev, tds_GetNTP_REQ * p_req, tds_GetNTP_RES * p_res); +HT_API BOOL onvif_tds_SetNTP(ONVIF_DEVICE * p_dev, tds_SetNTP_REQ * p_req, tds_SetNTP_RES * p_res); +HT_API BOOL onvif_tds_GetHostname(ONVIF_DEVICE * p_dev, tds_GetHostname_REQ * p_req, tds_GetHostname_RES * p_res); +HT_API BOOL onvif_tds_SetHostname(ONVIF_DEVICE * p_dev, tds_SetHostname_REQ * p_req, tds_SetHostname_RES * p_res); +HT_API BOOL onvif_tds_SetHostnameFromDHCP(ONVIF_DEVICE * p_dev, tds_SetHostnameFromDHCP_REQ * p_req, tds_SetHostnameFromDHCP_RES * p_res); +HT_API BOOL onvif_tds_GetDNS(ONVIF_DEVICE * p_dev, tds_GetDNS_REQ * p_req, tds_GetDNS_RES * p_res); +HT_API BOOL onvif_tds_SetDNS(ONVIF_DEVICE * p_dev, tds_SetDNS_REQ * p_req, tds_SetDNS_RES * p_res); +HT_API BOOL onvif_tds_GetDynamicDNS(ONVIF_DEVICE * p_dev, tds_GetDynamicDNS_REQ * p_req, tds_GetDynamicDNS_RES * p_res); +HT_API BOOL onvif_tds_SetDynamicDNS(ONVIF_DEVICE * p_dev, tds_SetDynamicDNS_REQ * p_req, tds_SetDynamicDNS_RES * p_res); +HT_API BOOL onvif_tds_GetNetworkProtocols(ONVIF_DEVICE * p_dev, tds_GetNetworkProtocols_REQ * p_req, tds_GetNetworkProtocols_RES * p_res); +HT_API BOOL onvif_tds_SetNetworkProtocols(ONVIF_DEVICE * p_dev, tds_SetNetworkProtocols_REQ * p_req, tds_SetNetworkProtocols_RES * p_res); +HT_API BOOL onvif_tds_GetDiscoveryMode(ONVIF_DEVICE * p_dev, tds_GetDiscoveryMode_REQ * p_req, tds_GetDiscoveryMode_RES * p_res); +HT_API BOOL onvif_tds_SetDiscoveryMode(ONVIF_DEVICE * p_dev, tds_SetDiscoveryMode_REQ * p_req, tds_SetDiscoveryMode_RES * p_res); +HT_API BOOL onvif_tds_GetNetworkDefaultGateway(ONVIF_DEVICE * p_dev, tds_GetNetworkDefaultGateway_REQ * p_req, tds_GetNetworkDefaultGateway_RES * p_res); +HT_API BOOL onvif_tds_SetNetworkDefaultGateway(ONVIF_DEVICE * p_dev, tds_SetNetworkDefaultGateway_REQ * p_req, tds_SetNetworkDefaultGateway_RES * p_res); +HT_API BOOL onvif_tds_GetZeroConfiguration(ONVIF_DEVICE * p_dev, tds_GetZeroConfiguration_REQ * p_req, tds_GetZeroConfiguration_RES * p_res); +HT_API BOOL onvif_tds_SetZeroConfiguration(ONVIF_DEVICE * p_dev, tds_SetZeroConfiguration_REQ * p_req, tds_SetZeroConfiguration_RES * p_res); +HT_API BOOL onvif_tds_GetEndpointReference(ONVIF_DEVICE * p_dev, tds_GetEndpointReference_REQ * p_req, tds_GetEndpointReference_RES * p_res); +HT_API BOOL onvif_tds_SendAuxiliaryCommand(ONVIF_DEVICE * p_dev, tds_SendAuxiliaryCommand_REQ * p_req, tds_SendAuxiliaryCommand_RES * p_res); +HT_API BOOL onvif_tds_GetRelayOutputs(ONVIF_DEVICE * p_dev, tds_GetRelayOutputs_REQ * p_req, tds_GetRelayOutputs_RES * p_res); +HT_API BOOL onvif_tds_SetRelayOutputSettings(ONVIF_DEVICE * p_dev, tds_SetRelayOutputSettings_REQ * p_req, tds_SetRelayOutputSettings_RES * p_res); +HT_API BOOL onvif_tds_SetRelayOutputState(ONVIF_DEVICE * p_dev, tds_SetRelayOutputState_REQ * p_req, tds_SetRelayOutputState_RES * p_res); +HT_API BOOL onvif_tds_GetSystemDateAndTime(ONVIF_DEVICE * p_dev, tds_GetSystemDateAndTime_REQ * p_req, tds_GetSystemDateAndTime_RES * p_res); +HT_API BOOL onvif_tds_SetSystemDateAndTime(ONVIF_DEVICE * p_dev, tds_SetSystemDateAndTime_REQ * p_req, tds_SetSystemDateAndTime_RES * p_res); +HT_API BOOL onvif_tds_SystemReboot(ONVIF_DEVICE * p_dev, tds_SystemReboot_REQ * p_req, tds_SystemReboot_RES * p_res); +HT_API BOOL onvif_tds_SetSystemFactoryDefault(ONVIF_DEVICE * p_dev, tds_SetSystemFactoryDefault_REQ * p_req, tds_SetSystemFactoryDefault_RES * p_res); +HT_API BOOL onvif_tds_GetSystemLog(ONVIF_DEVICE * p_dev, tds_GetSystemLog_REQ * p_req, tds_GetSystemLog_RES * p_res); +HT_API BOOL onvif_tds_GetScopes(ONVIF_DEVICE * p_dev, tds_GetScopes_REQ * p_req, tds_GetScopes_RES * p_res); +HT_API BOOL onvif_tds_SetScopes(ONVIF_DEVICE * p_dev, tds_SetScopes_REQ * p_req, tds_SetScopes_RES * p_res); +HT_API BOOL onvif_tds_AddScopes(ONVIF_DEVICE * p_dev, tds_AddScopes_REQ * p_req, tds_AddScopes_RES * p_res); +HT_API BOOL onvif_tds_RemoveScopes(ONVIF_DEVICE * p_dev, tds_RemoveScopes_REQ * p_req, tds_RemoveScopes_RES * p_res); +HT_API BOOL onvif_tds_StartFirmwareUpgrade(ONVIF_DEVICE * p_dev, tds_StartFirmwareUpgrade_REQ * p_req, tds_StartFirmwareUpgrade_RES * p_res); +HT_API BOOL onvif_tds_GetSystemUris(ONVIF_DEVICE * p_dev, tds_GetSystemUris_REQ * p_req, tds_GetSystemUris_RES * p_res); +HT_API BOOL onvif_tds_StartSystemRestore(ONVIF_DEVICE * p_dev, tds_StartSystemRestore_REQ * p_req, tds_StartSystemRestore_RES * p_res); +HT_API BOOL onvif_tds_GetWsdlUrl(ONVIF_DEVICE * p_dev, tds_GetWsdlUrl_REQ * p_req, tds_GetWsdlUrl_RES * p_res); +HT_API BOOL onvif_tds_GetDot11Capabilities(ONVIF_DEVICE * p_dev, tds_GetDot11Capabilities_REQ * p_req, tds_GetDot11Capabilities_RES * p_res); +HT_API BOOL onvif_tds_GetDot11Status(ONVIF_DEVICE * p_dev, tds_GetDot11Status_REQ * p_req, tds_GetDot11Status_RES * p_res); +HT_API BOOL onvif_tds_ScanAvailableDot11Networks(ONVIF_DEVICE * p_dev, tds_ScanAvailableDot11Networks_REQ * p_req, tds_ScanAvailableDot11Networks_RES * p_res); +HT_API BOOL onvif_tds_GetGeoLocation(ONVIF_DEVICE * p_dev, tds_GetGeoLocation_REQ * p_req, tds_GetGeoLocation_RES * p_res); +HT_API BOOL onvif_tds_SetGeoLocation(ONVIF_DEVICE * p_dev, tds_SetGeoLocation_REQ * p_req, tds_SetGeoLocation_RES * p_res); +HT_API BOOL onvif_tds_DeleteGeoLocation(ONVIF_DEVICE * p_dev, tds_DeleteGeoLocation_REQ * p_req, tds_DeleteGeoLocation_RES * p_res); +HT_API BOOL onvif_tds_SetHashingAlgorithm(ONVIF_DEVICE * p_dev, tds_SetHashingAlgorithm_REQ * p_req, tds_SetHashingAlgorithm_RES * p_res); + +// IP address filter interfaces +HT_API BOOL onvif_tds_GetIPAddressFilter(ONVIF_DEVICE * p_dev, tds_GetIPAddressFilter_REQ * p_req, tds_GetIPAddressFilter_RES * p_res); +HT_API BOOL onvif_tds_SetIPAddressFilter(ONVIF_DEVICE * p_dev, tds_SetIPAddressFilter_REQ * p_req, tds_SetIPAddressFilter_RES * p_res); +HT_API BOOL onvif_tds_AddIPAddressFilter(ONVIF_DEVICE * p_dev, tds_AddIPAddressFilter_REQ * p_req, tds_AddIPAddressFilter_RES * p_res); +HT_API BOOL onvif_tds_RemoveIPAddressFilter(ONVIF_DEVICE * p_dev, tds_RemoveIPAddressFilter_REQ * p_req, tds_RemoveIPAddressFilter_RES * p_res); + +// If call succesful, should call free to free p_res->PolicyFile.Data.ptr +HT_API BOOL onvif_tds_GetAccessPolicy(ONVIF_DEVICE * p_dev, tds_GetAccessPolicy_REQ * p_req, tds_GetAccessPolicy_RES * p_res); +HT_API BOOL onvif_tds_SetAccessPolicy(ONVIF_DEVICE * p_dev, tds_SetAccessPolicy_REQ * p_req, tds_SetAccessPolicy_RES * p_res); +HT_API BOOL onvif_tds_GetStorageConfigurations(ONVIF_DEVICE * p_dev, tds_GetStorageConfigurations_REQ * p_req, tds_GetStorageConfigurations_RES * p_res); +HT_API BOOL onvif_tds_CreateStorageConfiguration(ONVIF_DEVICE * p_dev, tds_CreateStorageConfiguration_REQ * p_req, tds_CreateStorageConfiguration_RES * p_res); +HT_API BOOL onvif_tds_GetStorageConfiguration(ONVIF_DEVICE * p_dev, tds_GetStorageConfiguration_REQ * p_req, tds_GetStorageConfiguration_RES * p_res); +HT_API BOOL onvif_tds_SetStorageConfiguration(ONVIF_DEVICE * p_dev, tds_SetStorageConfiguration_REQ * p_req, tds_SetStorageConfiguration_RES * p_res); +HT_API BOOL onvif_tds_DeleteStorageConfiguration(ONVIF_DEVICE * p_dev, tds_DeleteStorageConfiguration_REQ * p_req, tds_DeleteStorageConfiguration_RES * p_res); + +// onvif media service interfaces +HT_API BOOL onvif_trt_GetServiceCapabilities(ONVIF_DEVICE * p_dev, trt_GetServiceCapabilities_REQ * p_req, trt_GetServiceCapabilities_RES * p_res); +HT_API BOOL onvif_trt_GetVideoSources(ONVIF_DEVICE * p_dev, trt_GetVideoSources_REQ * p_req, trt_GetVideoSources_RES * p_res); +HT_API BOOL onvif_trt_GetAudioSources(ONVIF_DEVICE * p_dev, trt_GetAudioSources_REQ * p_req, trt_GetAudioSources_RES * p_res); +HT_API BOOL onvif_trt_CreateProfile(ONVIF_DEVICE * p_dev, trt_CreateProfile_REQ * p_req, trt_CreateProfile_RES * p_res); +HT_API BOOL onvif_trt_GetProfile(ONVIF_DEVICE * p_dev, trt_GetProfile_REQ * p_req, trt_GetProfile_RES * p_res); +HT_API BOOL onvif_trt_GetProfiles(ONVIF_DEVICE * p_dev, trt_GetProfiles_REQ * p_req, trt_GetProfiles_RES * p_res); +HT_API BOOL onvif_trt_AddVideoEncoderConfiguration(ONVIF_DEVICE * p_dev, trt_AddVideoEncoderConfiguration_REQ * p_req, trt_AddVideoEncoderConfiguration_RES * p_res); +HT_API BOOL onvif_trt_AddVideoSourceConfiguration(ONVIF_DEVICE * p_dev, trt_AddVideoSourceConfiguration_REQ * p_req, trt_AddVideoSourceConfiguration_RES * p_res); +HT_API BOOL onvif_trt_AddAudioEncoderConfiguration(ONVIF_DEVICE * p_dev, trt_AddAudioEncoderConfiguration_REQ * p_req, trt_AddAudioEncoderConfiguration_RES * p_res); +HT_API BOOL onvif_trt_AddAudioSourceConfiguration(ONVIF_DEVICE * p_dev, trt_AddAudioSourceConfiguration_REQ * p_req, trt_AddAudioSourceConfiguration_RES * p_res); +HT_API BOOL onvif_trt_GetVideoSourceModes(ONVIF_DEVICE * p_dev, trt_GetVideoSourceModes_REQ * p_req, trt_GetVideoSourceModes_RES * p_res); +HT_API BOOL onvif_trt_SetVideoSourceMode(ONVIF_DEVICE * p_dev, trt_SetVideoSourceMode_REQ * p_req, trt_SetVideoSourceMode_RES * p_res); +HT_API BOOL onvif_trt_AddPTZConfiguration(ONVIF_DEVICE * p_dev, trt_AddPTZConfiguration_REQ * p_req, trt_AddPTZConfiguration_RES * p_res); +HT_API BOOL onvif_trt_RemoveVideoEncoderConfiguration(ONVIF_DEVICE * p_dev, trt_RemoveVideoEncoderConfiguration_REQ * p_req, trt_RemoveVideoEncoderConfiguration_RES * p_res); +HT_API BOOL onvif_trt_RemoveVideoSourceConfiguration(ONVIF_DEVICE * p_dev, trt_RemoveVideoSourceConfiguration_REQ * p_req, trt_RemoveVideoSourceConfiguration_RES * p_res); +HT_API BOOL onvif_trt_RemoveAudioEncoderConfiguration(ONVIF_DEVICE * p_dev, trt_RemoveAudioEncoderConfiguration_REQ * p_req, trt_RemoveAudioEncoderConfiguration_RES * p_res); +HT_API BOOL onvif_trt_RemoveAudioSourceConfiguration(ONVIF_DEVICE * p_dev, trt_RemoveAudioSourceConfiguration_REQ * p_req, trt_RemoveAudioSourceConfiguration_RES * p_res); +HT_API BOOL onvif_trt_RemovePTZConfiguration(ONVIF_DEVICE * p_dev, trt_RemovePTZConfiguration_REQ * p_req, trt_RemovePTZConfiguration_RES * p_res); +HT_API BOOL onvif_trt_DeleteProfile(ONVIF_DEVICE * p_dev, trt_DeleteProfile_REQ * p_req, trt_DeleteProfile_RES * p_res); +HT_API BOOL onvif_trt_GetVideoSourceConfigurations(ONVIF_DEVICE * p_dev, trt_GetVideoSourceConfigurations_REQ * p_req, trt_GetVideoSourceConfigurations_RES * p_res); +HT_API BOOL onvif_trt_GetVideoEncoderConfigurations(ONVIF_DEVICE * p_dev, trt_GetVideoEncoderConfigurations_REQ * p_req, trt_GetVideoEncoderConfigurations_RES * p_res); +HT_API BOOL onvif_trt_GetAudioSourceConfigurations(ONVIF_DEVICE * p_dev, trt_GetAudioSourceConfigurations_REQ * p_req, trt_GetAudioSourceConfigurations_RES * p_res); +HT_API BOOL onvif_trt_GetAudioEncoderConfigurations(ONVIF_DEVICE * p_dev, trt_GetAudioEncoderConfigurations_REQ * p_req, trt_GetAudioEncoderConfigurations_RES * p_res); +HT_API BOOL onvif_trt_GetVideoSourceConfiguration(ONVIF_DEVICE * p_dev, trt_GetVideoSourceConfiguration_REQ * p_req, trt_GetVideoSourceConfiguration_RES * p_res); +HT_API BOOL onvif_trt_GetVideoEncoderConfiguration(ONVIF_DEVICE * p_dev, trt_GetVideoEncoderConfiguration_REQ * p_req, trt_GetVideoEncoderConfiguration_RES * p_res); +HT_API BOOL onvif_trt_GetAudioSourceConfiguration(ONVIF_DEVICE * p_dev, trt_GetAudioSourceConfiguration_REQ * p_req, trt_GetAudioSourceConfiguration_RES * p_res); +HT_API BOOL onvif_trt_GetAudioEncoderConfiguration(ONVIF_DEVICE * p_dev, trt_GetAudioEncoderConfiguration_REQ * p_req, trt_GetAudioEncoderConfiguration_RES * p_res); +HT_API BOOL onvif_trt_SetVideoSourceConfiguration(ONVIF_DEVICE * p_dev, trt_SetVideoSourceConfiguration_REQ * p_req, trt_SetVideoSourceConfiguration_RES * p_res); +HT_API BOOL onvif_trt_SetVideoEncoderConfiguration(ONVIF_DEVICE * p_dev, trt_SetVideoEncoderConfiguration_REQ * p_req, trt_SetVideoEncoderConfiguration_RES * p_res); +HT_API BOOL onvif_trt_SetAudioSourceConfiguration(ONVIF_DEVICE * p_dev, trt_SetAudioSourceConfiguration_REQ * p_req, trt_SetAudioSourceConfiguration_RES * p_res); +HT_API BOOL onvif_trt_SetAudioEncoderConfiguration(ONVIF_DEVICE * p_dev, trt_SetAudioEncoderConfiguration_REQ * p_req, trt_SetAudioEncoderConfiguration_RES * p_res); +HT_API BOOL onvif_trt_GetVideoSourceConfigurationOptions(ONVIF_DEVICE * p_dev, trt_GetVideoSourceConfigurationOptions_REQ * p_req, trt_GetVideoSourceConfigurationOptions_RES * p_res); +HT_API BOOL onvif_trt_GetVideoEncoderConfigurationOptions(ONVIF_DEVICE * p_dev, trt_GetVideoEncoderConfigurationOptions_REQ * p_req, trt_GetVideoEncoderConfigurationOptions_RES * p_res); +HT_API BOOL onvif_trt_GetAudioSourceConfigurationOptions(ONVIF_DEVICE * p_dev, trt_GetAudioSourceConfigurationOptions_REQ * p_req, trt_GetAudioSourceConfigurationOptions_RES * p_res); +HT_API BOOL onvif_trt_GetAudioEncoderConfigurationOptions(ONVIF_DEVICE * p_dev, trt_GetAudioEncoderConfigurationOptions_REQ * p_req, trt_GetAudioEncoderConfigurationOptions_RES * p_res); +HT_API BOOL onvif_trt_GetStreamUri(ONVIF_DEVICE * p_dev, trt_GetStreamUri_REQ * p_req, trt_GetStreamUri_RES * p_res); +HT_API BOOL onvif_trt_SetSynchronizationPoint(ONVIF_DEVICE * p_dev, trt_SetSynchronizationPoint_REQ * p_req, trt_SetSynchronizationPoint_RES * p_res); +HT_API BOOL onvif_trt_GetSnapshotUri(ONVIF_DEVICE * p_dev, trt_GetSnapshotUri_REQ * p_req, trt_GetSnapshotUri_RES * p_res); +HT_API BOOL onvif_trt_GetGuaranteedNumberOfVideoEncoderInstances(ONVIF_DEVICE * p_dev, trt_GetGuaranteedNumberOfVideoEncoderInstances_REQ * p_req, trt_GetGuaranteedNumberOfVideoEncoderInstances_RES * p_res); +HT_API BOOL onvif_trt_GetAudioOutputs(ONVIF_DEVICE * p_dev, trt_GetAudioOutputs_REQ * p_req, trt_GetAudioOutputs_RES * p_res); +HT_API BOOL onvif_trt_GetAudioOutputConfigurations(ONVIF_DEVICE * p_dev, trt_GetAudioOutputConfigurations_REQ * p_req, trt_GetAudioOutputConfigurations_RES * p_res); +HT_API BOOL onvif_trt_GetAudioOutputConfiguration(ONVIF_DEVICE * p_dev, trt_GetAudioOutputConfiguration_REQ * p_req, trt_GetAudioOutputConfiguration_RES * p_res); +HT_API BOOL onvif_trt_GetAudioOutputConfigurationOptions(ONVIF_DEVICE * p_dev, trt_GetAudioOutputConfigurationOptions_REQ * p_req, trt_GetAudioOutputConfigurationOptions_RES * p_res); +HT_API BOOL onvif_trt_SetAudioOutputConfiguration(ONVIF_DEVICE * p_dev, trt_SetAudioOutputConfiguration_REQ * p_req, trt_SetAudioOutputConfiguration_RES * p_res); +HT_API BOOL onvif_trt_GetAudioDecoderConfigurations(ONVIF_DEVICE * p_dev, trt_GetAudioDecoderConfigurations_REQ * p_req, trt_GetAudioDecoderConfigurations_RES * p_res); +HT_API BOOL onvif_trt_GetAudioDecoderConfiguration(ONVIF_DEVICE * p_dev, trt_GetAudioDecoderConfiguration_REQ * p_req, trt_GetAudioDecoderConfiguration_RES * p_res); +HT_API BOOL onvif_trt_GetAudioDecoderConfigurationOptions(ONVIF_DEVICE * p_dev, trt_GetAudioDecoderConfigurationOptions_REQ * p_req, trt_GetAudioDecoderConfigurationOptions_RES * p_res); +HT_API BOOL onvif_trt_SetAudioDecoderConfiguration(ONVIF_DEVICE * p_dev, trt_SetAudioDecoderConfiguration_REQ * p_req, trt_SetAudioDecoderConfiguration_RES * p_res); +HT_API BOOL onvif_trt_AddAudioOutputConfiguration(ONVIF_DEVICE * p_dev, trt_AddAudioOutputConfiguration_REQ * p_req, trt_AddAudioOutputConfiguration_RES * p_res); +HT_API BOOL onvif_trt_AddAudioDecoderConfiguration(ONVIF_DEVICE * p_dev, trt_AddAudioDecoderConfiguration_REQ * p_req, trt_AddAudioDecoderConfiguration_RES * p_res); +HT_API BOOL onvif_trt_RemoveAudioOutputConfiguration(ONVIF_DEVICE * p_dev, trt_RemoveAudioOutputConfiguration_REQ * p_req, trt_RemoveAudioOutputConfiguration_RES * p_res); +HT_API BOOL onvif_trt_RemoveAudioDecoderConfiguration(ONVIF_DEVICE * p_dev, trt_RemoveAudioDecoderConfiguration_REQ * p_req, trt_RemoveAudioDecoderConfiguration_RES * p_res); +HT_API BOOL onvif_trt_GetOSDs(ONVIF_DEVICE * p_dev, trt_GetOSDs_REQ * p_req, trt_GetOSDs_RES * p_res); +HT_API BOOL onvif_trt_GetOSD(ONVIF_DEVICE * p_dev, trt_GetOSD_REQ * p_req, trt_GetOSD_RES * p_res); +HT_API BOOL onvif_trt_SetOSD(ONVIF_DEVICE * p_dev, trt_SetOSD_REQ * p_req, trt_SetOSD_RES * p_res); +HT_API BOOL onvif_trt_GetOSDOptions(ONVIF_DEVICE * p_dev, trt_GetOSDOptions_REQ * p_req, trt_GetOSDOptions_RES * p_res); +HT_API BOOL onvif_trt_CreateOSD(ONVIF_DEVICE * p_dev, trt_CreateOSD_REQ * p_req, trt_CreateOSD_RES * p_res); +HT_API BOOL onvif_trt_DeleteOSD(ONVIF_DEVICE * p_dev, trt_DeleteOSD_REQ * p_req, trt_DeleteOSD_RES * p_res); +HT_API BOOL onvif_trt_GetVideoAnalyticsConfigurations(ONVIF_DEVICE * p_dev, trt_GetVideoAnalyticsConfigurations_REQ * p_req, trt_GetVideoAnalyticsConfigurations_RES * p_res); +HT_API BOOL onvif_trt_AddVideoAnalyticsConfiguration(ONVIF_DEVICE * p_dev, trt_AddVideoAnalyticsConfiguration_REQ * p_req, trt_AddVideoAnalyticsConfiguration_RES * p_res); +HT_API BOOL onvif_trt_GetVideoAnalyticsConfiguration(ONVIF_DEVICE * p_dev, trt_GetVideoAnalyticsConfiguration_REQ * p_req, trt_GetVideoAnalyticsConfiguration_RES * p_res); +HT_API BOOL onvif_trt_RemoveVideoAnalyticsConfiguration(ONVIF_DEVICE * p_dev, trt_RemoveVideoAnalyticsConfiguration_REQ * p_req, trt_RemoveVideoAnalyticsConfiguration_RES * p_res); +HT_API BOOL onvif_trt_SetVideoAnalyticsConfiguration(ONVIF_DEVICE * p_dev, trt_SetVideoAnalyticsConfiguration_REQ * p_req, trt_SetVideoAnalyticsConfiguration_RES * p_res); +HT_API BOOL onvif_trt_GetMetadataConfigurations(ONVIF_DEVICE * p_dev, trt_GetMetadataConfigurations_REQ * p_req, trt_GetMetadataConfigurations_RES * p_res); +HT_API BOOL onvif_trt_AddMetadataConfiguration(ONVIF_DEVICE * p_dev, trt_AddMetadataConfiguration_REQ * p_req, trt_AddMetadataConfiguration_RES * p_res); +HT_API BOOL onvif_trt_GetMetadataConfiguration(ONVIF_DEVICE * p_dev, trt_GetMetadataConfiguration_REQ * p_req, trt_GetMetadataConfiguration_RES * p_res); +HT_API BOOL onvif_trt_RemoveMetadataConfiguration(ONVIF_DEVICE * p_dev, trt_RemoveMetadataConfiguration_REQ * p_req, trt_RemoveMetadataConfiguration_RES * p_res); +HT_API BOOL onvif_trt_SetMetadataConfiguration(ONVIF_DEVICE * p_dev, trt_SetMetadataConfiguration_REQ * p_req, trt_SetMetadataConfiguration_RES * p_res); +HT_API BOOL onvif_trt_GetMetadataConfigurationOptions(ONVIF_DEVICE * p_dev, trt_GetMetadataConfigurationOptions_REQ * p_req, trt_GetMetadataConfigurationOptions_RES * p_res); +HT_API BOOL onvif_trt_GetCompatibleVideoEncoderConfigurations(ONVIF_DEVICE * p_dev, trt_GetCompatibleVideoEncoderConfigurations_REQ * p_req, trt_GetCompatibleVideoEncoderConfigurations_RES * p_res); +HT_API BOOL onvif_trt_GetCompatibleAudioEncoderConfigurations(ONVIF_DEVICE * p_dev, trt_GetCompatibleAudioEncoderConfigurations_REQ * p_req, trt_GetCompatibleAudioEncoderConfigurations_RES * p_res); +HT_API BOOL onvif_trt_GetCompatibleVideoAnalyticsConfigurations(ONVIF_DEVICE * p_dev, trt_GetCompatibleVideoAnalyticsConfigurations_REQ * p_req, trt_GetCompatibleVideoAnalyticsConfigurations_RES * p_res); +HT_API BOOL onvif_trt_GetCompatibleMetadataConfigurations(ONVIF_DEVICE * p_dev, trt_GetCompatibleMetadataConfigurations_REQ * p_req, trt_GetCompatibleMetadataConfigurations_RES * p_res); + +// onvif ptz service interfaces +HT_API BOOL onvif_ptz_GetServiceCapabilities(ONVIF_DEVICE * p_dev, ptz_GetServiceCapabilities_REQ * p_req, ptz_GetServiceCapabilities_RES * p_res); +HT_API BOOL onvif_ptz_GetNodes(ONVIF_DEVICE * p_dev, ptz_GetNodes_REQ * p_req, ptz_GetNodes_RES * p_res); +HT_API BOOL onvif_ptz_GetNode(ONVIF_DEVICE * p_dev, ptz_GetNode_REQ * p_req, ptz_GetNode_RES * p_res); +HT_API BOOL onvif_ptz_GetPresets(ONVIF_DEVICE * p_dev, ptz_GetPresets_REQ * p_req, ptz_GetPresets_RES * p_res); +HT_API BOOL onvif_ptz_SetPreset(ONVIF_DEVICE * p_dev, ptz_SetPreset_REQ * p_req, ptz_SetPreset_RES * p_res); +HT_API BOOL onvif_ptz_RemovePreset(ONVIF_DEVICE * p_dev, ptz_RemovePreset_REQ * p_req, ptz_RemovePreset_RES * p_res); +HT_API BOOL onvif_ptz_GotoPreset(ONVIF_DEVICE * p_dev, ptz_GotoPreset_REQ * p_req, ptz_GotoPreset_RES * p_res); +HT_API BOOL onvif_ptz_GotoHomePosition(ONVIF_DEVICE * p_dev, ptz_GotoHomePosition_REQ * p_req, ptz_GotoHomePosition_RES * p_res); +HT_API BOOL onvif_ptz_SetHomePosition(ONVIF_DEVICE * p_dev, ptz_SetHomePosition_REQ * p_req, ptz_SetHomePosition_RES * p_res); +HT_API BOOL onvif_ptz_GetStatus(ONVIF_DEVICE * p_dev, ptz_GetStatus_REQ * p_req, ptz_GetStatus_RES * p_res); +HT_API BOOL onvif_ptz_ContinuousMove(ONVIF_DEVICE * p_dev, ptz_ContinuousMove_REQ * p_req, ptz_ContinuousMove_RES * p_res); +HT_API BOOL onvif_ptz_RelativeMove(ONVIF_DEVICE * p_dev, ptz_RelativeMove_REQ * p_req, ptz_RelativeMove_RES * p_res); +HT_API BOOL onvif_ptz_AbsoluteMove(ONVIF_DEVICE * p_dev, ptz_AbsoluteMove_REQ * p_req, ptz_AbsoluteMove_RES * p_res); +HT_API BOOL onvif_ptz_Stop(ONVIF_DEVICE * p_dev, ptz_Stop_REQ * p_req, ptz_Stop_RES * p_res); +HT_API BOOL onvif_ptz_GetConfigurations(ONVIF_DEVICE * p_dev, ptz_GetConfigurations_REQ * p_req, ptz_GetConfigurations_RES * p_res); +HT_API BOOL onvif_ptz_GetConfiguration(ONVIF_DEVICE * p_dev, ptz_GetConfiguration_REQ * p_req, ptz_GetConfiguration_RES * p_res); +HT_API BOOL onvif_ptz_SetConfiguration(ONVIF_DEVICE * p_dev, ptz_SetConfiguration_REQ * p_req, ptz_SetConfiguration_RES * p_res); +HT_API BOOL onvif_ptz_GetConfigurationOptions(ONVIF_DEVICE * p_dev, ptz_GetConfigurationOptions_REQ * p_req, ptz_GetConfigurationOptions_RES * p_res); +HT_API BOOL onvif_ptz_GetPresetTours(ONVIF_DEVICE * p_dev, ptz_GetPresetTours_REQ * p_req, ptz_GetPresetTours_RES * p_res); +HT_API BOOL onvif_ptz_GetPresetTour(ONVIF_DEVICE * p_dev, ptz_GetPresetTour_REQ * p_req, ptz_GetPresetTour_RES * p_res); +HT_API BOOL onvif_ptz_GetPresetTourOptions(ONVIF_DEVICE * p_dev, ptz_GetPresetTourOptions_REQ * p_req, ptz_GetPresetTourOptions_RES * p_res); +HT_API BOOL onvif_ptz_CreatePresetTour(ONVIF_DEVICE * p_dev, ptz_CreatePresetTour_REQ * p_req, ptz_CreatePresetTour_RES * p_res); +HT_API BOOL onvif_ptz_ModifyPresetTour(ONVIF_DEVICE * p_dev, ptz_ModifyPresetTour_REQ * p_req, ptz_ModifyPresetTour_RES * p_res); +HT_API BOOL onvif_ptz_OperatePresetTour(ONVIF_DEVICE * p_dev, ptz_OperatePresetTour_REQ * p_req, ptz_OperatePresetTour_RES * p_res); +HT_API BOOL onvif_ptz_RemovePresetTour(ONVIF_DEVICE * p_dev, ptz_RemovePresetTour_REQ * p_req, ptz_RemovePresetTour_RES * p_res); +HT_API BOOL onvif_ptz_SendAuxiliaryCommand(ONVIF_DEVICE * p_dev, ptz_SendAuxiliaryCommand_REQ * p_req, ptz_SendAuxiliaryCommand_RES * p_res); +HT_API BOOL onvif_ptz_GeoMove(ONVIF_DEVICE * p_dev, ptz_GeoMove_REQ * p_req, ptz_GeoMove_RES * p_res); + +// onvif event service interfaces +HT_API BOOL onvif_tev_GetServiceCapabilities(ONVIF_DEVICE * p_dev, tev_GetServiceCapabilities_REQ * p_req, tev_GetServiceCapabilities_RES * p_res); +HT_API BOOL onvif_tev_GetEventProperties(ONVIF_DEVICE * p_dev, tev_GetEventProperties_REQ * p_req, tev_GetEventProperties_RES * p_res); +HT_API BOOL onvif_tev_Renew(ONVIF_DEVICE * p_dev, tev_Renew_REQ * p_req, tev_Renew_RES * p_res); +HT_API BOOL onvif_tev_Unsubscribe(ONVIF_DEVICE * p_dev, tev_Unsubscribe_REQ * p_req, tev_Unsubscribe_RES * p_res); +HT_API BOOL onvif_tev_Subscribe(ONVIF_DEVICE * p_dev, tev_Subscribe_REQ * p_req, tev_Subscribe_RES * p_res); +HT_API BOOL onvif_tev_PauseSubscription(ONVIF_DEVICE * p_dev, tev_PauseSubscription_REQ * p_req, tev_PauseSubscription_RES * p_res); +HT_API BOOL onvif_tev_ResumeSubscription(ONVIF_DEVICE * p_dev, tev_ResumeSubscription_REQ * p_req, tev_ResumeSubscription_RES * p_res); +HT_API BOOL onvif_tev_CreatePullPointSubscription(ONVIF_DEVICE * p_dev, tev_CreatePullPointSubscription_REQ * p_req, tev_CreatePullPointSubscription_RES * p_res); +HT_API BOOL onvif_tev_DestroyPullPoint(ONVIF_DEVICE * p_dev, tev_DestroyPullPoint_REQ * p_req, tev_DestroyPullPoint_RES * p_res); +HT_API BOOL onvif_tev_PullMessages(ONVIF_DEVICE * p_dev, tev_PullMessages_REQ * p_req, tev_PullMessages_RES * p_res); +HT_API BOOL onvif_tev_GetMessages(ONVIF_DEVICE * p_dev, tev_GetMessages_REQ * p_req, tev_GetMessages_RES * p_res); +HT_API BOOL onvif_tev_Seek(ONVIF_DEVICE * p_dev, tev_Seek_REQ * p_req, tev_Seek_RES * p_res); +HT_API BOOL onvif_tev_SetSynchronizationPoint(ONVIF_DEVICE * p_dev, tev_SetSynchronizationPoint_REQ * p_req, tev_SetSynchronizationPoint_RES * p_res); + +// onvif imaging service interfaces +HT_API BOOL onvif_img_GetServiceCapabilities(ONVIF_DEVICE * p_dev, img_GetServiceCapabilities_REQ * p_req, img_GetServiceCapabilities_RES * p_res); +HT_API BOOL onvif_img_GetImagingSettings(ONVIF_DEVICE * p_dev, img_GetImagingSettings_REQ * p_req, img_GetImagingSettings_RES * p_res); +HT_API BOOL onvif_img_SetImagingSettings(ONVIF_DEVICE * p_dev, img_SetImagingSettings_REQ * p_req, img_SetImagingSettings_RES * p_res); +HT_API BOOL onvif_img_GetOptions(ONVIF_DEVICE * p_dev, img_GetOptions_REQ * p_req, img_GetOptions_RES * p_res); +HT_API BOOL onvif_img_Move(ONVIF_DEVICE * p_dev, img_Move_REQ * p_req, img_Move_RES * p_res); +HT_API BOOL onvif_img_Stop(ONVIF_DEVICE * p_dev, img_Stop_REQ * p_req, img_Stop_RES * p_res); +HT_API BOOL onvif_img_GetStatus(ONVIF_DEVICE * p_dev, img_GetStatus_REQ * p_req, img_GetStatus_RES * p_res); +HT_API BOOL onvif_img_GetMoveOptions(ONVIF_DEVICE * p_dev, img_GetMoveOptions_REQ * p_req, img_GetMoveOptions_RES * p_res); +HT_API BOOL onvif_img_GetPresets(ONVIF_DEVICE * p_dev, img_GetPresets_REQ * p_req, img_GetPresets_RES * p_res); +HT_API BOOL onvif_img_GetCurrentPreset(ONVIF_DEVICE * p_dev, img_GetCurrentPreset_REQ * p_req, img_GetCurrentPreset_RES * p_res); +HT_API BOOL onvif_img_SetCurrentPreset(ONVIF_DEVICE * p_dev, img_SetCurrentPreset_REQ * p_req, img_SetCurrentPreset_RES * p_res); + +// onvif device IO service interfaces +HT_API BOOL onvif_tmd_GetServiceCapabilities(ONVIF_DEVICE * p_dev, tmd_GetServiceCapabilities_REQ * p_req, tmd_GetServiceCapabilities_RES * p_res); +HT_API BOOL onvif_tmd_GetRelayOutputs(ONVIF_DEVICE * p_dev, tmd_GetRelayOutputs_REQ * p_req, tmd_GetRelayOutputs_RES * p_res); +HT_API BOOL onvif_tmd_GetRelayOutputOptions(ONVIF_DEVICE * p_dev, tmd_GetRelayOutputOptions_REQ * p_req, tmd_GetRelayOutputOptions_RES * p_res); +HT_API BOOL onvif_tmd_SetRelayOutputSettings(ONVIF_DEVICE * p_dev, tmd_SetRelayOutputSettings_REQ * p_req, tmd_SetRelayOutputSettings_RES * p_res); +HT_API BOOL onvif_tmd_SetRelayOutputState(ONVIF_DEVICE * p_dev, tmd_SetRelayOutputState_REQ * p_req, tmd_SetRelayOutputState_RES * p_res); +HT_API BOOL onvif_tmd_GetDigitalInputs(ONVIF_DEVICE * p_dev, tmd_GetDigitalInputs_REQ * p_req, tmd_GetDigitalInputs_RES * p_res); +HT_API BOOL onvif_tmd_GetDigitalInputConfigurationOptions(ONVIF_DEVICE * p_dev, tmd_GetDigitalInputConfigurationOptions_REQ * p_req, tmd_GetDigitalInputConfigurationOptions_RES * p_res); +HT_API BOOL onvif_tmd_SetDigitalInputConfigurations(ONVIF_DEVICE * p_dev, tmd_SetDigitalInputConfigurations_REQ * p_req, tmd_SetDigitalInputConfigurations_RES * p_res); + +// onvif recording service interfaces +HT_API BOOL onvif_trc_GetServiceCapabilities(ONVIF_DEVICE * p_dev, trc_GetServiceCapabilities_REQ * p_req, trc_GetServiceCapabilities_RES * p_res); +HT_API BOOL onvif_trc_CreateRecording(ONVIF_DEVICE * p_dev, trc_CreateRecording_REQ * p_req, trc_CreateRecording_RES * p_res); +HT_API BOOL onvif_trc_DeleteRecording(ONVIF_DEVICE * p_dev, trc_DeleteRecording_REQ * p_req, trc_DeleteRecording_RES * p_res); +HT_API BOOL onvif_trc_GetRecordings(ONVIF_DEVICE * p_dev, trc_GetRecordings_REQ * p_req, trc_GetRecordings_RES * p_res); +HT_API BOOL onvif_trc_SetRecordingConfiguration(ONVIF_DEVICE * p_dev, trc_SetRecordingConfiguration_REQ * p_req, trc_SetRecordingConfiguration_RES * p_res); +HT_API BOOL onvif_trc_GetRecordingConfiguration(ONVIF_DEVICE * p_dev, trc_GetRecordingConfiguration_REQ * p_req, trc_GetRecordingConfiguration_RES * p_res); +HT_API BOOL onvif_trc_GetRecordingOptions(ONVIF_DEVICE * p_dev, trc_GetRecordingOptions_REQ * p_req, trc_GetRecordingOptions_RES * p_res); +HT_API BOOL onvif_trc_CreateTrack(ONVIF_DEVICE * p_dev, trc_CreateTrack_REQ * p_req, trc_CreateTrack_RES * p_res); +HT_API BOOL onvif_trc_DeleteTrack(ONVIF_DEVICE * p_dev, trc_DeleteTrack_REQ * p_req, trc_DeleteTrack_RES * p_res); +HT_API BOOL onvif_trc_GetTrackConfiguration(ONVIF_DEVICE * p_dev, trc_GetTrackConfiguration_REQ * p_req, trc_GetTrackConfiguration_RES * p_res); +HT_API BOOL onvif_trc_SetTrackConfiguration(ONVIF_DEVICE * p_dev, trc_SetTrackConfiguration_REQ * p_req, trc_SetTrackConfiguration_RES * p_res); +HT_API BOOL onvif_trc_CreateRecordingJob(ONVIF_DEVICE * p_dev, trc_CreateRecordingJob_REQ * p_req, trc_CreateRecordingJob_RES * p_res); +HT_API BOOL onvif_trc_DeleteRecordingJob(ONVIF_DEVICE * p_dev, trc_DeleteRecordingJob_REQ * p_req, trc_DeleteRecordingJob_RES * p_res); +HT_API BOOL onvif_trc_GetRecordingJobs(ONVIF_DEVICE * p_dev, trc_GetRecordingJobs_REQ * p_req, trc_GetRecordingJobs_RES * p_res); +HT_API BOOL onvif_trc_SetRecordingJobConfiguration(ONVIF_DEVICE * p_dev, trc_SetRecordingJobConfiguration_REQ * p_req, trc_SetRecordingJobConfiguration_RES * p_res); +HT_API BOOL onvif_trc_GetRecordingJobConfiguration(ONVIF_DEVICE * p_dev, trc_GetRecordingJobConfiguration_REQ * p_req, trc_GetRecordingJobConfiguration_RES * p_res); +HT_API BOOL onvif_trc_SetRecordingJobMode(ONVIF_DEVICE * p_dev, trc_SetRecordingJobMode_REQ * p_req, trc_SetRecordingJobMode_RES * p_res); +HT_API BOOL onvif_trc_GetRecordingJobState(ONVIF_DEVICE * p_dev, trc_GetRecordingJobState_REQ * p_req, trc_GetRecordingJobState_RES * p_res); +HT_API BOOL onvif_trc_ExportRecordedData(ONVIF_DEVICE * p_dev, trc_ExportRecordedData_REQ * p_req, trc_ExportRecordedData_RES * p_res); +HT_API BOOL onvif_trc_StopExportRecordedData(ONVIF_DEVICE * p_dev, trc_StopExportRecordedData_REQ * p_req, trc_StopExportRecordedData_RES * p_res); +HT_API BOOL onvif_trc_GetExportRecordedDataState(ONVIF_DEVICE * p_dev, trc_GetExportRecordedDataState_REQ * p_req, trc_GetExportRecordedDataState_RES * p_res); + +// onvif replay service interfaces +HT_API BOOL onvif_trp_GetServiceCapabilities(ONVIF_DEVICE * p_dev, trp_GetServiceCapabilities_REQ * p_req, trp_GetServiceCapabilities_RES * p_res); +HT_API BOOL onvif_trp_GetReplayUri(ONVIF_DEVICE * p_dev, trp_GetReplayUri_REQ * p_req, trp_GetReplayUri_RES * p_res); +HT_API BOOL onvif_trp_GetReplayConfiguration(ONVIF_DEVICE * p_dev, trp_GetReplayConfiguration_REQ * p_req, trp_GetReplayConfiguration_RES * p_res); +HT_API BOOL onvif_trp_SetReplayConfiguration(ONVIF_DEVICE * p_dev, trp_SetReplayConfiguration_REQ * p_req, trp_SetReplayConfiguration_RES * p_res); + +// onvif search service interfaces +HT_API BOOL onvif_tse_GetServiceCapabilities(ONVIF_DEVICE * p_dev, tse_GetServiceCapabilities_REQ * p_req, tse_GetServiceCapabilities_RES * p_res); +HT_API BOOL onvif_tse_GetRecordingSummary(ONVIF_DEVICE * p_dev, tse_GetRecordingSummary_REQ * p_req, tse_GetRecordingSummary_RES * p_res); +HT_API BOOL onvif_tse_GetRecordingInformation(ONVIF_DEVICE * p_dev, tse_GetRecordingInformation_REQ * p_req, tse_GetRecordingInformation_RES * p_res); +HT_API BOOL onvif_tse_GetMediaAttributes(ONVIF_DEVICE * p_dev, tse_GetMediaAttributes_REQ * p_req, tse_GetMediaAttributes_RES * p_res); +HT_API BOOL onvif_tse_FindRecordings(ONVIF_DEVICE * p_dev, tse_FindRecordings_REQ * p_req, tse_FindRecordings_RES * p_res); +HT_API BOOL onvif_tse_GetRecordingSearchResults(ONVIF_DEVICE * p_dev, tse_GetRecordingSearchResults_REQ * p_req, tse_GetRecordingSearchResults_RES * p_res); +HT_API BOOL onvif_tse_FindEvents(ONVIF_DEVICE * p_dev, tse_FindEvents_REQ * p_req, tse_FindEvents_RES * p_res); +HT_API BOOL onvif_tse_GetEventSearchResults(ONVIF_DEVICE * p_dev, tse_GetEventSearchResults_REQ * p_req, tse_GetEventSearchResults_RES * p_res); +HT_API BOOL onvif_tse_FindMetadata(ONVIF_DEVICE * p_dev, tse_FindMetadata_REQ * p_req, tse_FindMetadata_RES * p_res); +HT_API BOOL onvif_tse_GetMetadataSearchResults(ONVIF_DEVICE * p_dev, tse_GetMetadataSearchResults_REQ * p_req, tse_GetMetadataSearchResults_RES * p_res); +HT_API BOOL onvif_tse_FindPTZPosition(ONVIF_DEVICE * p_dev, tse_FindPTZPosition_REQ * p_req, tse_FindPTZPosition_RES * p_res); +HT_API BOOL onvif_tse_GetPTZPositionSearchResults(ONVIF_DEVICE * p_dev, tse_GetPTZPositionSearchResults_REQ * p_req, tse_GetPTZPositionSearchResults_RES * p_res); +HT_API BOOL onvif_tse_GetSearchState(ONVIF_DEVICE * p_dev, tse_GetSearchState_REQ * p_req, tse_GetSearchState_RES * p_res); +HT_API BOOL onvif_tse_EndSearch(ONVIF_DEVICE * p_dev, tse_EndSearch_REQ * p_req, tse_EndSearch_RES * p_res); + +// onvif analytics service interfaces +HT_API BOOL onvif_tan_GetServiceCapabilities(ONVIF_DEVICE * p_dev, tan_GetServiceCapabilities_REQ * p_req, tan_GetServiceCapabilities_RES * p_res); +HT_API BOOL onvif_tan_GetSupportedRules(ONVIF_DEVICE * p_dev, tan_GetSupportedRules_REQ * p_req, tan_GetSupportedRules_RES * p_res); +HT_API BOOL onvif_tan_CreateRules(ONVIF_DEVICE * p_dev, tan_CreateRules_REQ * p_req, tan_CreateRules_RES * p_res); +HT_API BOOL onvif_tan_DeleteRules(ONVIF_DEVICE * p_dev, tan_DeleteRules_REQ * p_req, tan_DeleteRules_RES * p_res); +HT_API BOOL onvif_tan_GetRules(ONVIF_DEVICE * p_dev, tan_GetRules_REQ * p_req, tan_GetRules_RES * p_res); +HT_API BOOL onvif_tan_ModifyRules(ONVIF_DEVICE * p_dev, tan_ModifyRules_REQ * p_req, tan_ModifyRules_RES * p_res); +HT_API BOOL onvif_tan_CreateAnalyticsModules(ONVIF_DEVICE * p_dev, tan_CreateAnalyticsModules_REQ * p_req, tan_CreateAnalyticsModules_RES * p_res); +HT_API BOOL onvif_tan_DeleteAnalyticsModules(ONVIF_DEVICE * p_dev, tan_DeleteAnalyticsModules_REQ * p_req, tan_DeleteAnalyticsModules_RES * p_res); +HT_API BOOL onvif_tan_GetAnalyticsModules(ONVIF_DEVICE * p_dev, tan_GetAnalyticsModules_REQ * p_req, tan_GetAnalyticsModules_RES * p_res); +HT_API BOOL onvif_tan_ModifyAnalyticsModules(ONVIF_DEVICE * p_dev, tan_ModifyAnalyticsModules_REQ * p_req, tan_ModifyAnalyticsModules_RES * p_res); +HT_API BOOL onvif_tan_GetSupportedAnalyticsModules(ONVIF_DEVICE * p_dev, tan_GetSupportedAnalyticsModules_REQ * p_req, tan_GetSupportedAnalyticsModules_RES * p_res); +HT_API BOOL onvif_tan_GetRuleOptions(ONVIF_DEVICE * p_dev, tan_GetRuleOptions_REQ * p_req, tan_GetRuleOptions_RES * p_res); +HT_API BOOL onvif_tan_GetAnalyticsModuleOptions(ONVIF_DEVICE * p_dev, tan_GetAnalyticsModuleOptions_REQ * p_req, tan_GetAnalyticsModuleOptions_RES * p_res); +HT_API BOOL onvif_tan_GetSupportedMetadata(ONVIF_DEVICE * p_dev, tan_GetSupportedMetadata_REQ * p_req, tan_GetSupportedMetadata_RES * p_res); + +// onvif media 2 service interfaces +HT_API BOOL onvif_tr2_GetServiceCapabilities(ONVIF_DEVICE * p_dev, tr2_GetServiceCapabilities_REQ * p_req, tr2_GetServiceCapabilities_RES * p_res); +HT_API BOOL onvif_tr2_GetVideoEncoderConfigurations(ONVIF_DEVICE * p_dev, tr2_GetVideoEncoderConfigurations_REQ * p_req, tr2_GetVideoEncoderConfigurations_RES * p_res); +HT_API BOOL onvif_tr2_SetVideoEncoderConfiguration(ONVIF_DEVICE * p_dev, tr2_SetVideoEncoderConfiguration_REQ * p_req, tr2_SetVideoEncoderConfiguration_RES * p_res); +HT_API BOOL onvif_tr2_GetVideoEncoderConfigurationOptions(ONVIF_DEVICE * p_dev, tr2_GetVideoEncoderConfigurationOptions_REQ * p_req, tr2_GetVideoEncoderConfigurationOptions_RES * p_res); +HT_API BOOL onvif_tr2_GetProfiles(ONVIF_DEVICE * p_dev, tr2_GetProfiles_REQ * p_req, tr2_GetProfiles_RES * p_res); +HT_API BOOL onvif_tr2_CreateProfile(ONVIF_DEVICE * p_dev, tr2_CreateProfile_REQ * p_req, tr2_CreateProfile_RES * p_res); +HT_API BOOL onvif_tr2_DeleteProfile(ONVIF_DEVICE * p_dev, tr2_DeleteProfile_REQ * p_req, tr2_DeleteProfile_RES * p_res); +HT_API BOOL onvif_tr2_GetStreamUri(ONVIF_DEVICE * p_dev, tr2_GetStreamUri_REQ * p_req, tr2_GetStreamUri_RES * p_res); +HT_API BOOL onvif_tr2_GetVideoSourceConfigurations(ONVIF_DEVICE * p_dev, tr2_GetVideoSourceConfigurations_REQ * p_req, tr2_GetVideoSourceConfigurations_RES * p_res); +HT_API BOOL onvif_tr2_GetVideoSourceConfigurationOptions(ONVIF_DEVICE * p_dev, tr2_GetVideoSourceConfigurationOptions_REQ * p_req, tr2_GetVideoSourceConfigurationOptions_RES * p_res); +HT_API BOOL onvif_tr2_SetVideoSourceConfiguration(ONVIF_DEVICE * p_dev, tr2_SetVideoSourceConfiguration_REQ * p_req, tr2_SetVideoSourceConfiguration_RES * p_res); +HT_API BOOL onvif_tr2_SetSynchronizationPoint(ONVIF_DEVICE * p_dev, tr2_SetSynchronizationPoint_REQ * p_req, tr2_SetSynchronizationPoint_RES * p_res); +HT_API BOOL onvif_tr2_GetMetadataConfigurations(ONVIF_DEVICE * p_dev, tr2_GetMetadataConfigurations_REQ * p_req, tr2_GetMetadataConfigurations_RES * p_res); +HT_API BOOL onvif_tr2_GetMetadataConfigurationOptions(ONVIF_DEVICE * p_dev, tr2_GetMetadataConfigurationOptions_REQ * p_req, tr2_GetMetadataConfigurationOptions_RES * p_res); +HT_API BOOL onvif_tr2_SetMetadataConfiguration(ONVIF_DEVICE * p_dev, tr2_SetMetadataConfiguration_REQ * p_req, tr2_SetMetadataConfiguration_RES * p_res); +HT_API BOOL onvif_tr2_GetAudioEncoderConfigurations(ONVIF_DEVICE * p_dev, tr2_GetAudioEncoderConfigurations_REQ * p_req, tr2_GetAudioEncoderConfigurations_RES * p_res); +HT_API BOOL onvif_tr2_GetAudioSourceConfigurations(ONVIF_DEVICE * p_dev, tr2_GetAudioSourceConfigurations_REQ * p_req, tr2_GetAudioSourceConfigurations_RES * p_res); +HT_API BOOL onvif_tr2_GetAudioSourceConfigurationOptions(ONVIF_DEVICE * p_dev, tr2_GetAudioSourceConfigurationOptions_REQ * p_req, tr2_GetAudioSourceConfigurationOptions_RES * p_res); +HT_API BOOL onvif_tr2_SetAudioSourceConfiguration(ONVIF_DEVICE * p_dev, tr2_SetAudioSourceConfiguration_REQ * p_req, tr2_SetAudioSourceConfiguration_RES * p_res); +HT_API BOOL onvif_tr2_SetAudioEncoderConfiguration(ONVIF_DEVICE * p_dev, tr2_SetAudioEncoderConfiguration_REQ * p_req, tr2_SetAudioEncoderConfiguration_RES * p_res); +HT_API BOOL onvif_tr2_GetAudioEncoderConfigurationOptions(ONVIF_DEVICE * p_dev, tr2_GetAudioEncoderConfigurationOptions_REQ * p_req, tr2_GetAudioEncoderConfigurationOptions_RES * p_res); +HT_API BOOL onvif_tr2_AddConfiguration(ONVIF_DEVICE * p_dev, tr2_AddConfiguration_REQ * p_req, tr2_AddConfiguration_RES * p_res); +HT_API BOOL onvif_tr2_RemoveConfiguration(ONVIF_DEVICE * p_dev, tr2_RemoveConfiguration_REQ * p_req, tr2_RemoveConfiguration_RES * p_res); +HT_API BOOL onvif_tr2_GetVideoEncoderInstances(ONVIF_DEVICE * p_dev, tr2_GetVideoEncoderInstances_REQ * p_req, tr2_GetVideoEncoderInstances_RES * p_res); +HT_API BOOL onvif_tr2_GetAudioOutputConfigurations(ONVIF_DEVICE * p_dev, tr2_GetAudioOutputConfigurations_REQ * p_req, tr2_GetAudioOutputConfigurations_RES * p_res); +HT_API BOOL onvif_tr2_GetAudioOutputConfigurationOptions(ONVIF_DEVICE * p_dev, tr2_GetAudioOutputConfigurationOptions_REQ * p_req, tr2_GetAudioOutputConfigurationOptions_RES * p_res); +HT_API BOOL onvif_tr2_SetAudioOutputConfiguration(ONVIF_DEVICE * p_dev, tr2_SetAudioOutputConfiguration_REQ * p_req, tr2_SetAudioOutputConfiguration_RES * p_res); +HT_API BOOL onvif_tr2_GetAudioDecoderConfigurations(ONVIF_DEVICE * p_dev, tr2_GetAudioDecoderConfigurations_REQ * p_req, tr2_GetAudioDecoderConfigurations_RES * p_res); +HT_API BOOL onvif_tr2_GetAudioDecoderConfigurationOptions(ONVIF_DEVICE * p_dev, tr2_GetAudioDecoderConfigurationOptions_REQ * p_req, tr2_GetAudioDecoderConfigurationOptions_RES * p_res); +HT_API BOOL onvif_tr2_SetAudioDecoderConfiguration(ONVIF_DEVICE * p_dev, tr2_SetAudioDecoderConfiguration_REQ * p_req, tr2_SetAudioDecoderConfiguration_RES * p_res); +HT_API BOOL onvif_tr2_GetSnapshotUri(ONVIF_DEVICE * p_dev, tr2_GetSnapshotUri_REQ * p_req, tr2_GetSnapshotUri_RES * p_res); +HT_API BOOL onvif_tr2_StartMulticastStreaming(ONVIF_DEVICE * p_dev, tr2_StartMulticastStreaming_REQ * p_req, tr2_StartMulticastStreaming_RES * p_res); +HT_API BOOL onvif_tr2_StopMulticastStreaming(ONVIF_DEVICE * p_dev, tr2_StopMulticastStreaming_REQ * p_req, tr2_StopMulticastStreaming_RES * p_res); +HT_API BOOL onvif_tr2_GetVideoSourceModes(ONVIF_DEVICE * p_dev, tr2_GetVideoSourceModes_REQ * p_req, tr2_GetVideoSourceModes_RES * p_res); +HT_API BOOL onvif_tr2_SetVideoSourceMode(ONVIF_DEVICE * p_dev, tr2_SetVideoSourceMode_REQ * p_req, tr2_SetVideoSourceMode_RES * p_res); +HT_API BOOL onvif_tr2_CreateOSD(ONVIF_DEVICE * p_dev, tr2_CreateOSD_REQ * p_req, tr2_CreateOSD_RES * p_res); +HT_API BOOL onvif_tr2_DeleteOSD(ONVIF_DEVICE * p_dev, tr2_DeleteOSD_REQ * p_req, tr2_DeleteOSD_RES * p_res); +HT_API BOOL onvif_tr2_GetOSDs(ONVIF_DEVICE * p_dev, tr2_GetOSDs_REQ * p_req, tr2_GetOSDs_RES * p_res); +HT_API BOOL onvif_tr2_SetOSD(ONVIF_DEVICE * p_dev, tr2_SetOSD_REQ * p_req, tr2_SetOSD_RES * p_res); +HT_API BOOL onvif_tr2_GetOSDOptions(ONVIF_DEVICE * p_dev, tr2_GetOSDOptions_REQ * p_req, tr2_GetOSDOptions_RES * p_res); +HT_API BOOL onvif_tr2_GetAnalyticsConfigurations(ONVIF_DEVICE * p_dev, tr2_GetAnalyticsConfigurations_REQ * p_req, tr2_GetAnalyticsConfigurations_RES * p_res); +HT_API BOOL onvif_tr2_GetMasks(ONVIF_DEVICE * p_dev, tr2_GetMasks_REQ * p_req, tr2_GetMasks_RES * p_res); +HT_API BOOL onvif_tr2_SetMask(ONVIF_DEVICE * p_dev, tr2_SetMask_REQ * p_req, tr2_SetMask_RES * p_res); +HT_API BOOL onvif_tr2_CreateMask(ONVIF_DEVICE * p_dev, tr2_CreateMask_REQ * p_req, tr2_CreateMask_RES * p_res); +HT_API BOOL onvif_tr2_DeleteMask(ONVIF_DEVICE * p_dev, tr2_DeleteMask_REQ * p_req, tr2_DeleteMask_RES * p_res); +HT_API BOOL onvif_tr2_GetMaskOptions(ONVIF_DEVICE * p_dev, tr2_GetMaskOptions_REQ * p_req, tr2_GetMaskOptions_RES * p_res); + +// access control service interfaces +HT_API BOOL onvif_tac_GetServiceCapabilities(ONVIF_DEVICE * p_dev, tac_GetServiceCapabilities_REQ * p_req, tac_GetServiceCapabilities_RES * p_res); +HT_API BOOL onvif_tac_GetAccessPointInfoList(ONVIF_DEVICE * p_dev, tac_GetAccessPointInfoList_REQ * p_req, tac_GetAccessPointInfoList_RES * p_res); +HT_API BOOL onvif_tac_GetAccessPointInfo(ONVIF_DEVICE * p_dev, tac_GetAccessPointInfo_REQ * p_req, tac_GetAccessPointInfo_RES * p_res); +HT_API BOOL onvif_tac_GetAccessPointList(ONVIF_DEVICE * p_dev, tac_GetAccessPointList_REQ * p_req, tac_GetAccessPointList_RES * p_res); +HT_API BOOL onvif_tac_GetAccessPoints(ONVIF_DEVICE * p_dev, tac_GetAccessPoints_REQ * p_req, tac_GetAccessPoints_RES * p_res); +HT_API BOOL onvif_tac_CreateAccessPoint(ONVIF_DEVICE * p_dev, tac_CreateAccessPoint_REQ * p_req, tac_CreateAccessPoint_RES * p_res); +HT_API BOOL onvif_tac_SetAccessPoint(ONVIF_DEVICE * p_dev, tac_SetAccessPoint_REQ * p_req, tac_SetAccessPoint_RES * p_res); +HT_API BOOL onvif_tac_ModifyAccessPoint(ONVIF_DEVICE * p_dev, tac_ModifyAccessPoint_REQ * p_req, tac_ModifyAccessPoint_RES * p_res); +HT_API BOOL onvif_tac_DeleteAccessPoint(ONVIF_DEVICE * p_dev, tac_DeleteAccessPoint_REQ * p_req, tac_DeleteAccessPoint_RES * p_res); +HT_API BOOL onvif_tac_GetAreaInfoList(ONVIF_DEVICE * p_dev, tac_GetAreaInfoList_REQ * p_req, tac_GetAreaInfoList_RES * p_res); +HT_API BOOL onvif_tac_GetAreaInfo(ONVIF_DEVICE * p_dev, tac_GetAreaInfo_REQ * p_req, tac_GetAreaInfo_RES * p_res); +HT_API BOOL onvif_tac_GetAreaList(ONVIF_DEVICE * p_dev, tac_GetAreaList_REQ * p_req, tac_GetAreaList_RES * p_res); +HT_API BOOL onvif_tac_GetAreas(ONVIF_DEVICE * p_dev, tac_GetAreas_REQ * p_req, tac_GetAreas_RES * p_res); +HT_API BOOL onvif_tac_CreateArea(ONVIF_DEVICE * p_dev, tac_CreateArea_REQ * p_req, tac_CreateArea_RES * p_res); +HT_API BOOL onvif_tac_SetArea(ONVIF_DEVICE * p_dev, tac_SetArea_REQ * p_req, tac_SetArea_RES * p_res); +HT_API BOOL onvif_tac_ModifyArea(ONVIF_DEVICE * p_dev, tac_ModifyArea_REQ * p_req, tac_ModifyArea_RES * p_res); +HT_API BOOL onvif_tac_DeleteArea(ONVIF_DEVICE * p_dev, tac_DeleteArea_REQ * p_req, tac_DeleteArea_RES * p_res); +HT_API BOOL onvif_tac_GetAccessPointState(ONVIF_DEVICE * p_dev, tac_GetAccessPointState_REQ * p_req, tac_GetAccessPointState_RES * p_res); +HT_API BOOL onvif_tac_EnableAccessPoint(ONVIF_DEVICE * p_dev, tac_EnableAccessPoint_REQ * p_req, tac_EnableAccessPoint_RES * p_res); +HT_API BOOL onvif_tac_DisableAccessPoint(ONVIF_DEVICE * p_dev, tac_DisableAccessPoint_REQ * p_req, tac_DisableAccessPoint_RES * p_res); + +// door control service interfaces +HT_API BOOL onvif_tdc_GetServiceCapabilities(ONVIF_DEVICE * p_dev, tdc_GetServiceCapabilities_REQ * p_req, tdc_GetServiceCapabilities_RES * p_res); +HT_API BOOL onvif_tdc_GetDoorInfoList(ONVIF_DEVICE * p_dev, tdc_GetDoorInfoList_REQ * p_req, tdc_GetDoorInfoList_RES * p_res); +HT_API BOOL onvif_tdc_GetDoorInfo(ONVIF_DEVICE * p_dev, tdc_GetDoorInfo_REQ * p_req, tdc_GetDoorInfo_RES * p_res); +HT_API BOOL onvif_tdc_GetDoorState(ONVIF_DEVICE * p_dev, tdc_GetDoorState_REQ * p_req, tdc_GetDoorState_RES * p_res); +HT_API BOOL onvif_tdc_AccessDoor(ONVIF_DEVICE * p_dev, tdc_AccessDoor_REQ * p_req, tdc_AccessDoor_RES * p_res); +HT_API BOOL onvif_tdc_LockDoor(ONVIF_DEVICE * p_dev, tdc_LockDoor_REQ * p_req, tdc_LockDoor_RES * p_res); +HT_API BOOL onvif_tdc_UnlockDoor(ONVIF_DEVICE * p_dev, tdc_UnlockDoor_REQ * p_req, tdc_UnlockDoor_RES * p_res); +HT_API BOOL onvif_tdc_DoubleLockDoor(ONVIF_DEVICE * p_dev, tdc_DoubleLockDoor_REQ * p_req, tdc_DoubleLockDoor_RES * p_res); +HT_API BOOL onvif_tdc_BlockDoor(ONVIF_DEVICE * p_dev, tdc_BlockDoor_REQ * p_req, tdc_BlockDoor_RES * p_res); +HT_API BOOL onvif_tdc_LockDownDoor(ONVIF_DEVICE * p_dev, tdc_LockDownDoor_REQ * p_req, tdc_LockDownDoor_RES * p_res); +HT_API BOOL onvif_tdc_LockDownReleaseDoor(ONVIF_DEVICE * p_dev, tdc_LockDownReleaseDoor_REQ * p_req, tdc_LockDownReleaseDoor_RES * p_res); +HT_API BOOL onvif_tdc_LockOpenDoor(ONVIF_DEVICE * p_dev, tdc_LockOpenDoor_REQ * p_req, tdc_LockOpenDoor_RES * p_res); +HT_API BOOL onvif_tdc_LockOpenReleaseDoor(ONVIF_DEVICE * p_dev, tdc_LockOpenReleaseDoor_REQ * p_req, tdc_LockOpenReleaseDoor_RES * p_res); +HT_API BOOL onvif_tdc_GetDoors(ONVIF_DEVICE * p_dev, tdc_GetDoors_REQ * p_req, tdc_GetDoors_RES * p_res); +HT_API BOOL onvif_tdc_GetDoorList(ONVIF_DEVICE * p_dev, tdc_GetDoorList_REQ * p_req, tdc_GetDoorList_RES * p_res); +HT_API BOOL onvif_tdc_CreateDoor(ONVIF_DEVICE * p_dev, tdc_CreateDoor_REQ * p_req, tdc_CreateDoor_RES * p_res); +HT_API BOOL onvif_tdc_SetDoor(ONVIF_DEVICE * p_dev, tdc_SetDoor_REQ * p_req, tdc_SetDoor_RES * p_res); +HT_API BOOL onvif_tdc_ModifyDoor(ONVIF_DEVICE * p_dev, tdc_ModifyDoor_REQ * p_req, tdc_ModifyDoor_RES * p_res); +HT_API BOOL onvif_tdc_DeleteDoor(ONVIF_DEVICE * p_dev, tdc_DeleteDoor_REQ * p_req, tdc_DeleteDoor_RES * p_res); + +// thermal service interfaces +HT_API BOOL onvif_tth_GetServiceCapabilities(ONVIF_DEVICE * p_dev, tth_GetServiceCapabilities_REQ * p_req, tth_GetServiceCapabilities_RES * p_res); +HT_API BOOL onvif_tth_GetConfigurations(ONVIF_DEVICE * p_dev, tth_GetConfigurations_REQ * p_req, tth_GetConfigurations_RES * p_res); +HT_API BOOL onvif_tth_GetConfiguration(ONVIF_DEVICE * p_dev, tth_GetConfiguration_REQ * p_req, tth_GetConfiguration_RES * p_res); +HT_API BOOL onvif_tth_SetConfiguration(ONVIF_DEVICE * p_dev, tth_SetConfiguration_REQ * p_req, tth_SetConfiguration_RES * p_res); +HT_API BOOL onvif_tth_GetConfigurationOptions(ONVIF_DEVICE * p_dev, tth_GetConfigurationOptions_REQ * p_req, tth_GetConfigurationOptions_RES * p_res); +HT_API BOOL onvif_tth_GetRadiometryConfiguration(ONVIF_DEVICE * p_dev, tth_GetRadiometryConfiguration_REQ * p_req, tth_GetRadiometryConfiguration_RES * p_res); +HT_API BOOL onvif_tth_SetRadiometryConfiguration(ONVIF_DEVICE * p_dev, tth_SetRadiometryConfiguration_REQ * p_req, tth_SetRadiometryConfiguration_RES * p_res); +HT_API BOOL onvif_tth_GetRadiometryConfigurationOptions(ONVIF_DEVICE * p_dev, tth_GetRadiometryConfigurationOptions_REQ * p_req, tth_GetRadiometryConfigurationOptions_RES * p_res); + +// credential service interfaces +HT_API BOOL onvif_tcr_GetServiceCapabilities(ONVIF_DEVICE * p_dev, tcr_GetServiceCapabilities_REQ * p_req, tcr_GetServiceCapabilities_RES * p_res); +HT_API BOOL onvif_tcr_GetCredentialInfo(ONVIF_DEVICE * p_dev, tcr_GetCredentialInfo_REQ * p_req, tcr_GetCredentialInfo_RES * p_res); +HT_API BOOL onvif_tcr_GetCredentialInfoList(ONVIF_DEVICE * p_dev, tcr_GetCredentialInfoList_REQ * p_req, tcr_GetCredentialInfoList_RES * p_res); +HT_API BOOL onvif_tcr_GetCredentials(ONVIF_DEVICE * p_dev, tcr_GetCredentials_REQ * p_req, tcr_GetCredentials_RES * p_res); +HT_API BOOL onvif_tcr_GetCredentialList(ONVIF_DEVICE * p_dev, tcr_GetCredentialList_REQ * p_req, tcr_GetCredentialList_RES * p_res); +HT_API BOOL onvif_tcr_CreateCredential(ONVIF_DEVICE * p_dev, tcr_CreateCredential_REQ * p_req, tcr_CreateCredential_RES * p_res); +HT_API BOOL onvif_tcr_ModifyCredential(ONVIF_DEVICE * p_dev, tcr_ModifyCredential_REQ * p_req, tcr_ModifyCredential_RES * p_res); +HT_API BOOL onvif_tcr_DeleteCredential(ONVIF_DEVICE * p_dev, tcr_DeleteCredential_REQ * p_req, tcr_DeleteCredential_RES * p_res); +HT_API BOOL onvif_tcr_GetCredentialState(ONVIF_DEVICE * p_dev, tcr_GetCredentialState_REQ * p_req, tcr_GetCredentialState_RES * p_res); +HT_API BOOL onvif_tcr_EnableCredential(ONVIF_DEVICE * p_dev, tcr_EnableCredential_REQ * p_req, tcr_EnableCredential_RES * p_res); +HT_API BOOL onvif_tcr_DisableCredential(ONVIF_DEVICE * p_dev, tcr_DisableCredential_REQ * p_req, tcr_DisableCredential_RES * p_res); +HT_API BOOL onvif_tcr_ResetAntipassbackViolation(ONVIF_DEVICE * p_dev, tcr_ResetAntipassbackViolation_REQ * p_req, tcr_ResetAntipassbackViolation_RES * p_res); +HT_API BOOL onvif_tcr_GetSupportedFormatTypes(ONVIF_DEVICE * p_dev, tcr_GetSupportedFormatTypes_REQ * p_req, tcr_GetSupportedFormatTypes_RES * p_res); +HT_API BOOL onvif_tcr_GetCredentialIdentifiers(ONVIF_DEVICE * p_dev, tcr_GetCredentialIdentifiers_REQ * p_req, tcr_GetCredentialIdentifiers_RES * p_res); +HT_API BOOL onvif_tcr_SetCredentialIdentifier(ONVIF_DEVICE * p_dev, tcr_SetCredentialIdentifier_REQ * p_req, tcr_SetCredentialIdentifier_RES * p_res); +HT_API BOOL onvif_tcr_DeleteCredentialIdentifier(ONVIF_DEVICE * p_dev, tcr_DeleteCredentialIdentifier_REQ * p_req, tcr_DeleteCredentialIdentifier_RES * p_res); +HT_API BOOL onvif_tcr_GetCredentialAccessProfiles(ONVIF_DEVICE * p_dev, tcr_GetCredentialAccessProfiles_REQ * p_req, tcr_GetCredentialAccessProfiles_RES * p_res); +HT_API BOOL onvif_tcr_SetCredentialAccessProfiles(ONVIF_DEVICE * p_dev, tcr_SetCredentialAccessProfiles_REQ * p_req, tcr_SetCredentialAccessProfiles_RES * p_res); +HT_API BOOL onvif_tcr_DeleteCredentialAccessProfiles(ONVIF_DEVICE * p_dev, tcr_DeleteCredentialAccessProfiles_REQ * p_req, tcr_DeleteCredentialAccessProfiles_RES * p_res); + +// access rules service interfaces +HT_API BOOL onvif_tar_GetServiceCapabilities(ONVIF_DEVICE * p_dev, tar_GetServiceCapabilities_REQ * p_req, tar_GetServiceCapabilities_RES * p_res); +HT_API BOOL onvif_tar_GetAccessProfileInfo(ONVIF_DEVICE * p_dev, tar_GetAccessProfileInfo_REQ * p_req, tar_GetAccessProfileInfo_RES * p_res); +HT_API BOOL onvif_tar_GetAccessProfileInfoList(ONVIF_DEVICE * p_dev, tar_GetAccessProfileInfoList_REQ * p_req, tar_GetAccessProfileInfoList_RES * p_res); +HT_API BOOL onvif_tar_GetAccessProfiles(ONVIF_DEVICE * p_dev, tar_GetAccessProfiles_REQ * p_req, tar_GetAccessProfiles_RES * p_res); +HT_API BOOL onvif_tar_GetAccessProfileList(ONVIF_DEVICE * p_dev, tar_GetAccessProfileList_REQ * p_req, tar_GetAccessProfileList_RES * p_res); +HT_API BOOL onvif_tar_CreateAccessProfile(ONVIF_DEVICE * p_dev, tar_CreateAccessProfile_REQ * p_req, tar_CreateAccessProfile_RES * p_res); +HT_API BOOL onvif_tar_ModifyAccessProfile(ONVIF_DEVICE * p_dev, tar_ModifyAccessProfile_REQ * p_req, tar_ModifyAccessProfile_RES * p_res); +HT_API BOOL onvif_tar_DeleteAccessProfile(ONVIF_DEVICE * p_dev, tar_DeleteAccessProfile_REQ * p_req, tar_DeleteAccessProfile_RES * p_res); + +// schedule service interface +HT_API BOOL onvif_tsc_GetServiceCapabilities(ONVIF_DEVICE * p_dev, tsc_GetServiceCapabilities_REQ * p_req, tsc_GetServiceCapabilities_RES * p_res); +HT_API BOOL onvif_tsc_GetScheduleInfo(ONVIF_DEVICE * p_dev, tsc_GetScheduleInfo_REQ * p_req, tsc_GetScheduleInfo_RES * p_res); +HT_API BOOL onvif_tsc_GetScheduleInfoList(ONVIF_DEVICE * p_dev, tsc_GetScheduleInfoList_REQ * p_req, tsc_GetScheduleInfoList_RES * p_res); +HT_API BOOL onvif_tsc_GetSchedules(ONVIF_DEVICE * p_dev, tsc_GetSchedules_REQ * p_req, tsc_GetSchedules_RES * p_res); +HT_API BOOL onvif_tsc_GetScheduleList(ONVIF_DEVICE * p_dev, tsc_GetScheduleList_REQ * p_req, tsc_GetScheduleList_RES * p_res); +HT_API BOOL onvif_tsc_CreateSchedule(ONVIF_DEVICE * p_dev, tsc_CreateSchedule_REQ * p_req, tsc_CreateSchedule_RES * p_res); +HT_API BOOL onvif_tsc_ModifySchedule(ONVIF_DEVICE * p_dev, tsc_ModifySchedule_REQ * p_req, tsc_ModifySchedule_RES * p_res); +HT_API BOOL onvif_tsc_DeleteSchedule(ONVIF_DEVICE * p_dev, tsc_DeleteSchedule_REQ * p_req, tsc_DeleteSchedule_RES * p_res); +HT_API BOOL onvif_tsc_GetSpecialDayGroupInfo(ONVIF_DEVICE * p_dev, tsc_GetSpecialDayGroupInfo_REQ * p_req, tsc_GetSpecialDayGroupInfo_RES * p_res); +HT_API BOOL onvif_tsc_GetSpecialDayGroupInfoList(ONVIF_DEVICE * p_dev, tsc_GetSpecialDayGroupInfoList_REQ * p_req, tsc_GetSpecialDayGroupInfoList_RES * p_res); +HT_API BOOL onvif_tsc_GetSpecialDayGroups(ONVIF_DEVICE * p_dev, tsc_GetSpecialDayGroups_REQ * p_req, tsc_GetSpecialDayGroups_RES * p_res); +HT_API BOOL onvif_tsc_GetSpecialDayGroupList(ONVIF_DEVICE * p_dev, tsc_GetSpecialDayGroupList_REQ * p_req, tsc_GetSpecialDayGroupList_RES * p_res); +HT_API BOOL onvif_tsc_CreateSpecialDayGroup(ONVIF_DEVICE * p_dev, tsc_CreateSpecialDayGroup_REQ * p_req, tsc_CreateSpecialDayGroup_RES * p_res); +HT_API BOOL onvif_tsc_ModifySpecialDayGroup(ONVIF_DEVICE * p_dev, tsc_ModifySpecialDayGroup_REQ * p_req, tsc_ModifySpecialDayGroup_RES * p_res); +HT_API BOOL onvif_tsc_DeleteSpecialDayGroup(ONVIF_DEVICE * p_dev, tsc_DeleteSpecialDayGroup_REQ * p_req, tsc_DeleteSpecialDayGroup_RES * p_res); +HT_API BOOL onvif_tsc_GetScheduleState(ONVIF_DEVICE * p_dev, tsc_GetScheduleState_REQ * p_req, tsc_GetScheduleState_RES * p_res); + +// receiver service interfaces +HT_API BOOL onvif_trv_GetServiceCapabilities(ONVIF_DEVICE * p_dev, trv_GetServiceCapabilities_REQ * p_req, trv_GetServiceCapabilities_RES * p_res); +HT_API BOOL onvif_trv_GetReceivers(ONVIF_DEVICE * p_dev, trv_GetReceivers_REQ * p_req, trv_GetReceivers_RES * p_res); +HT_API BOOL onvif_trv_GetReceiver(ONVIF_DEVICE * p_dev, trv_GetReceiver_REQ * p_req, trv_GetReceiver_RES * p_res); +HT_API BOOL onvif_trv_CreateReceiver(ONVIF_DEVICE * p_dev, trv_CreateReceiver_REQ * p_req, trv_CreateReceiver_RES * p_res); +HT_API BOOL onvif_trv_DeleteReceiver(ONVIF_DEVICE * p_dev, trv_DeleteReceiver_REQ * p_req, trv_DeleteReceiver_RES * p_res); +HT_API BOOL onvif_trv_ConfigureReceiver(ONVIF_DEVICE * p_dev, trv_ConfigureReceiver_REQ * p_req, trv_ConfigureReceiver_RES * p_res); +HT_API BOOL onvif_trv_SetReceiverMode(ONVIF_DEVICE * p_dev, trv_SetReceiverMode_REQ * p_req, trv_SetReceiverMode_RES * p_res); +HT_API BOOL onvif_trv_GetReceiverState(ONVIF_DEVICE * p_dev, trv_GetReceiverState_REQ * p_req, trv_GetReceiverState_RES * p_res); + +// provisioning interfaces +HT_API BOOL onvif_tpv_GetServiceCapabilities(ONVIF_DEVICE * p_dev, tpv_GetServiceCapabilities_REQ * p_req, tpv_GetServiceCapabilities_RES * p_res); +HT_API BOOL onvif_tpv_PanMove(ONVIF_DEVICE * p_dev, tpv_PanMove_REQ * p_req, tpv_PanMove_RES * p_res); +HT_API BOOL onvif_tpv_TiltMove(ONVIF_DEVICE * p_dev, tpv_TiltMove_REQ * p_req, tpv_TiltMove_RES * p_res); +HT_API BOOL onvif_tpv_ZoomMove(ONVIF_DEVICE * p_dev, tpv_ZoomMove_REQ * p_req, tpv_ZoomMove_RES * p_res); +HT_API BOOL onvif_tpv_RollMove(ONVIF_DEVICE * p_dev, tpv_RollMove_REQ * p_req, tpv_RollMove_RES * p_res); +HT_API BOOL onvif_tpv_FocusMove(ONVIF_DEVICE * p_dev, tpv_FocusMove_REQ * p_req, tpv_FocusMove_RES * p_res); +HT_API BOOL onvif_tpv_Stop(ONVIF_DEVICE * p_dev, tpv_Stop_REQ * p_req, tpv_Stop_RES * p_res); +HT_API BOOL onvif_tpv_GetUsage(ONVIF_DEVICE * p_dev, tpv_GetUsage_REQ * p_req, tpv_GetUsage_RES * p_res); + + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/MediaClient/MediaClient/onvif/onvif_cm.h b/MediaClient/MediaClient/onvif/onvif_cm.h new file mode 100644 index 0000000..ed7b78a --- /dev/null +++ b/MediaClient/MediaClient/onvif/onvif_cm.h @@ -0,0 +1,5227 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef ONVIF_COMM_H +#define ONVIF_COMM_H + +/***************************************************************************************/ +#define ONVIF_TOKEN_LEN 100 +#define ONVIF_NAME_LEN 100 +#define ONVIF_URI_LEN 300 +#define ONVIF_SCOPE_LEN 128 + +#define MAX_PTZ_PRESETS 100 +#define MAX_DNS_SERVER 2 +#define MAX_SEARCHDOMAIN 4 +#define MAX_NTP_SERVER 2 +#define MAX_SERVER_PORT 4 +#define MAX_GATEWAY 2 +#define MAX_RES_NUMS 32 +#define MAX_SCOPE_NUMS 100 +#define MAX_USERS 10 +#define MAX_IP_ADDRS 4 + +/* Floating point precision */ +#define FPP 0.01 + +#define ACCESS_CTRL_MAX_LIMIT 10 +#define DOOR_CTRL_MAX_LIMIT 10 +#define CREDENTIAL_MAX_LIMIT 10 +#define ACCESSRULES_MAX_LIMIT 10 +#define SCHEDULE_MAX_LIMIT 10 + +/***************************************************************************************/ +typedef enum +{ + ONVIF_OK = 0, + ONVIF_ERR_ConnFailure = -1, // Connection failed + ONVIF_ERR_MallocFailure = -2, // Failed to allocate memory + ONVIF_ERR_NotSupportHttps = -3, // The device requires an HTTPS connection, but the onvif client library does not support it (the HTTPS compilation macro is not enabled) + ONVIF_ERR_RecvTimeout = -4, // Message receiving timeout + ONVIF_ERR_InvalidContentType = -5, // Device response message content is invalid + ONVIF_ERR_NullContent = -6, // Device response message has no content + ONVIF_ERR_ParseFailed = -7, // Parsing the message failed + ONVIF_ERR_HandleFailed = -8, // Message handling failed + ONVIF_ERR_HttpResponseError = -9, // The device responded with an error message +} ONVIF_RET; + +typedef enum +{ + AuthMethod_HttpDigest = 0, // Http digest auth method + AuthMethod_UsernameToken = 1 // Username Token auth method +} onvif_AuthMethod; + +/***************************************************************************************/ + +typedef enum +{ + CapabilityCategory_Invalid = -1, + CapabilityCategory_All = 0, + CapabilityCategory_Analytics = 1, + CapabilityCategory_Device = 2, + CapabilityCategory_Events = 3, + CapabilityCategory_Imaging = 4, + CapabilityCategory_Media = 5, + CapabilityCategory_PTZ = 6, + CapabilityCategory_Recording = 7, + CapabilityCategory_Search = 8, + CapabilityCategory_Replay = 9, + CapabilityCategory_AccessControl = 10, + CapabilityCategory_DoorControl = 11, + CapabilityCategory_DeviceIO = 12, + CapabilityCategory_Media2 = 13, + CapabilityCategory_Thermal = 14, + CapabilityCategory_Credential = 15, + CapabilityCategory_AccessRules = 16, + CapabilityCategory_Schedule = 17, + CapabilityCategory_Receiver = 18, + CapabilityCategory_Provisioning = 19, +} onvif_CapabilityCategory; + +typedef enum +{ + FactoryDefaultType_Hard = 0, // Indicates that a hard factory default is requested + FactoryDefaultType_Soft = 1 // Indicates that a soft factory default is requested +} onvif_FactoryDefaultType; + +typedef enum +{ + SystemLogType_System = 0, // Indicates that a system log is requested + SystemLogType_Access = 1 // Indicates that a access log is requested +} onvif_SystemLogType; + +typedef enum +{ + VideoEncoding_Unknown = -1, + VideoEncoding_JPEG = 0, + VideoEncoding_MPEG4 = 1, + VideoEncoding_H264 = 2 +} onvif_VideoEncoding; + +typedef enum +{ + AudioEncoding_Unknown = -1, + AudioEncoding_G711 = 0, + AudioEncoding_G726 = 1, + AudioEncoding_AAC = 2 +} onvif_AudioEncoding; + +typedef enum H264Profile +{ + H264Profile_Baseline = 0, + H264Profile_Main = 1, + H264Profile_Extended = 2, + H264Profile_High = 3 +} onvif_H264Profile; + +typedef enum +{ + Mpeg4Profile_SP = 0, + Mpeg4Profile_ASP = 1 +} onvif_Mpeg4Profile; + +typedef enum +{ + UserLevel_Administrator = 0, + UserLevel_Operator = 1, + UserLevel_User = 2, + UserLevel_Anonymous = 3, + UserLevel_Extended = 4 +} onvif_UserLevel; + +typedef enum +{ + IPAddressFilterType_Allow = 0, + IPAddressFilterType_Deny = 1 +} onvif_IPAddressFilterType; + +typedef enum MoveStatus +{ + MoveStatus_IDLE = 0, + MoveStatus_MOVING = 1, + MoveStatus_UNKNOWN = 2 +} onvif_MoveStatus; + +// OSD type +typedef enum +{ + OSDType_Text = 0, + OSDType_Image = 1, + OSDType_Extended =2 +} onvif_OSDType; + +// OSD position type +typedef enum +{ + OSDPosType_UpperLeft = 0, + OSDPosType_UpperRight = 1, + OSDPosType_LowerLeft = 2, + OSDPosType_LowerRight = 3, + OSDPosType_Custom = 4 +} onvif_OSDPosType; + +typedef enum +{ + OSDTextType_Plain, // The Plain type means the OSD is shown as a text string which defined in the "PlainText" item + OSDTextType_Date, // The Date type means the OSD is shown as a date, format of which should be present in the "DateFormat" item + OSDTextType_Time, // The Time type means the OSD is shown as a time, format of which should be present in the "TimeFormat" item + OSDTextType_DateAndTime, // The DateAndTime type means the OSD is shown as date and time, format of which should be present in the "DateFormat" and the "TimeFormat" item +} onvif_OSDTextType; + +// BacklightCompensation mode +typedef enum +{ + BacklightCompensationMode_OFF = 0, // Backlight compensation is disabled + BacklightCompensationMode_ON = 1 // Backlight compensation is enabled +} onvif_BacklightCompensationMode; + +// Exposure mode +typedef enum +{ + ExposureMode_AUTO = 0, + ExposureMode_MANUAL = 1 +} onvif_ExposureMode; + +// Exposure Priority +typedef enum +{ + ExposurePriority_LowNoise = 0, + ExposurePriority_FrameRate = 1 +} onvif_ExposurePriority; + +// AutoFocus Mode +typedef enum +{ + AutoFocusMode_AUTO = 0, + AutoFocusMode_MANUAL = 1 +} onvif_AutoFocusMode; + +typedef enum +{ + WideDynamicMode_OFF = 0, + WideDynamicMode_ON = 1 +} onvif_WideDynamicMode; + +typedef enum +{ + IrCutFilterMode_ON = 0, + IrCutFilterMode_OFF = 1, + IrCutFilterMode_AUTO = 2 +} onvif_IrCutFilterMode; + +typedef enum WhiteBalanceMode +{ + WhiteBalanceMode_AUTO = 0, + WhiteBalanceMode_MANUAL = 1 +} onvif_WhiteBalanceMode; + +typedef enum onvif_EFlipMode +{ + EFlipMode_OFF = 0, + EFlipMode_ON = 1, + EFlipMode_Extended = 2 +} onvif_EFlipMode; + +typedef enum +{ + ReverseMode_OFF = 0, + ReverseMode_ON = 1, + ReverseMode_AUTO = 2, + ReverseMode_Extended = 3 +} onvif_ReverseMode; + +typedef enum +{ + DiscoveryMode_Discoverable = 0, + DiscoveryMode_NonDiscoverable = 1 +} onvif_DiscoveryMode; + +typedef enum +{ + SetDateTimeType_Manual = 0, // Indicates that the date and time are set manually + SetDateTimeType_NTP = 1 // Indicates that the date and time are set through NTP +} onvif_SetDateTimeType; + +typedef enum +{ + StreamType_Invalid = -1, + StreamType_RTP_Unicast = 0, + StreamType_RTP_Multicast = 1 +} onvif_StreamType; + +typedef enum +{ + TransportProtocol_Invalid = -1, + TransportProtocol_UDP = 0, + TransportProtocol_TCP = 1, + TransportProtocol_RTSP = 2, + TransportProtocol_HTTP = 3 +} onvif_TransportProtocol; + +typedef enum +{ + TrackType_Invalid = -1, + TrackType_Video = 0, + TrackType_Audio = 1, + TrackType_Metadata = 2, + TrackType_Extended = 3 +} onvif_TrackType; + +typedef enum +{ + DynamicDNSType_NoUpdate = 0, + DynamicDNSType_ClientUpdates = 1, + DynamicDNSType_ServerUpdates = 2 +} onvif_DynamicDNSType; + +typedef enum +{ + PropertyOperation_Invalid = -1, + PropertyOperation_Initialized = 0, + PropertyOperation_Deleted = 1, + PropertyOperation_Changed = 2 +} onvif_PropertyOperation; + +typedef enum +{ + RecordingStatus_Initiated = 0, + RecordingStatus_Recording = 1, + RecordingStatus_Stopped = 2, + RecordingStatus_Removing = 3, + RecordingStatus_Removed = 4, + RecordingStatus_Unknown = 5 +} onvif_RecordingStatus; + +typedef enum +{ + SearchState_Queued = 0, // The search is queued and not yet started. + SearchState_Searching = 1, // The search is underway and not yet completed + SearchState_Completed = 2, // The search has been completed and no new results will be found + SearchState_Unknown = 3 // The state of the search is unknown. (This is not a valid response from GetSearchState.) +} onvif_SearchState; + +typedef enum +{ + RotateMode_OFF = 0, // Enable the Rotate feature. Degree of rotation is specified Degree parameter + RotateMode_ON = 1, // Disable the Rotate feature + RotateMode_AUTO = 2 // Rotate feature is automatically activated by the device +} onvif_RotateMode; + +typedef enum +{ + ScopeDefinition_Fixed = 0, + ScopeDefinition_Configurable = 1 +} onvif_ScopeDefinition; + +// The physical state of a Door +typedef enum +{ + DoorPhysicalState_Unknown = 0, // Value is currently unknown (possibly due to initialization or monitors not giving a conclusive result) + DoorPhysicalState_Open = 1, // Door is open + DoorPhysicalState_Closed = 2, // Door is closed + DoorPhysicalState_Fault = 3 // Door monitor fault is detected +} onvif_DoorPhysicalState; + +// The physical state of a Lock (including Double Lock) +typedef enum +{ + LockPhysicalState_Unknown = 0, // Value is currently not known + LockPhysicalState_Locked = 1, // Lock is activated + LockPhysicalState_Unlocked = 2, // Lock is not activated + LockPhysicalState_Fault = 3 // Lock fault is detected +} onvif_LockPhysicalState; + +// Describes the state of a Door with regard to alarms +typedef enum +{ + DoorAlarmState_Normal = 0, // No alarm + DoorAlarmState_DoorForcedOpen = 1, // Door is forced open + DoorAlarmState_DoorOpenTooLong = 2 // Door is held open too long +} onvif_DoorAlarmState; + +// Describes the state of a Tamper detector +typedef enum +{ + DoorTamperState_Unknown = 0, // Value is currently not known + DoorTamperState_NotInTamper = 1, // No tampering is detected + DoorTamperState_TamperDetected = 2 // Tampering is detected +} onvif_DoorTamperState; + +// Describes the state of a Door fault +typedef enum +{ + DoorFaultState_Unknown = 0, // Fault state is unknown + DoorFaultState_NotInFault = 1, // No fault is detected + DoorFaultState_FaultDetected = 2 // Fault is detected +} onvif_DoorFaultState; + +// DoorMode parameters describe current Door mode from a logical perspective +typedef enum +{ + DoorMode_Unknown = 0, // The Door is in an Unknown state + DoorMode_Locked = 1, // The Door is in a Locked state. In this mode the device shall provide momentary access using the AccessDoor method if supported by the Door instance + DoorMode_Unlocked = 2, // The Door is in an Unlocked (Permanent Access) state. Alarms related to door timing operations such as open too long or forced are masked in this mode + DoorMode_Accessed = 3, // The Door is in an Accessed state (momentary/temporary access). Alarms related to timing operations such as "door forced" are masked in this mode + DoorMode_Blocked = 4, // The Door is in a Blocked state (Door is locked, and AccessDoor requests are ignored, i.e., it is not possible for door to go to Accessed state) + DoorMode_LockedDown = 5, // The Door is in a LockedDown state (Door is locked) until released using the LockDownReleaseDoor command. AccessDoor, LockDoor, UnlockDoor, BlockDoor and + // LockOpenDoor requests are ignored, i.e., it is not possible for door to go to Accessed, Locked, Unlocked, Blocked or LockedOpen state + DoorMode_LockedOpen = 6, // The Door is in a LockedOpen state (Door is unlocked) until released using the LockOpenReleaseDoor command. AccessDoor, LockDoor, UnlockDoor, BlockDoor and + // LockDownDoor requests are ignored, i.e., it is not possible for door to go to Accessed, Locked, Unlocked, Blocked or LockedDown state + DoorMode_DoubleLocked = 7 // The Door is in a Double Locked state - for doors with multiple locks. If the door does not have any DoubleLock, this shall be treated as a normal Locked mode. + // When changing to an Unlocked mode from the DoubleLocked mode, the door may first go to Locked state before unlocking +} onvif_DoorMode; + +typedef enum +{ + RelayMode_Monostable = 0, // After setting the state, the relay returns to its idle state after the specified time + RelayMode_Bistable = 1, // After setting the state, the relay remains in this state +} onvif_RelayMode; + +typedef enum +{ + RelayIdleState_closed = 0, // means that the relay is closed when the relay state is set to 'inactive' through the trigger command and open when the state is set to 'active' through the same command + RelayIdleState_open = 1, // means that the relay is open when the relay state is set to 'inactive' through the trigger command and closed when the state is set to 'active' through the same command +} onvif_RelayIdleState; + +typedef enum +{ + RelayLogicalState_active = 0, // + RelayLogicalState_inactive = 1, // +} onvif_RelayLogicalState; + +typedef enum +{ + DigitalIdleState_closed = 0, + DigitalIdleState_open = 1, +} onvif_DigitalIdleState; + +typedef enum +{ + ParityBit_None = 0, + ParityBit_Even = 1, + ParityBit_Odd = 2, + ParityBit_Mark = 3, + ParityBit_Space = 4, + ParityBit_Extended = 5 +} onvif_ParityBit; + +typedef enum +{ + SerialPortType_RS232 = 0, + SerialPortType_RS422HalfDuplex = 1, + SerialPortType_RS422FullDuplex = 2, + SerialPortType_RS485HalfDuplex = 3, + SerialPortType_RS485FullDuplex = 4, + SerialPortType_Generic = 5 +} onvif_SerialPortType; + +typedef enum +{ + PTZPresetTourOperation_Start = 0, + PTZPresetTourOperation_Stop = 1, + PTZPresetTourOperation_Pause = 2, + PTZPresetTourOperation_Extended = 3 +} onvif_PTZPresetTourOperation; + +typedef enum +{ + PTZPresetTourState_Idle = 0, + PTZPresetTourState_Touring = 1, + PTZPresetTourState_Paused = 2, + PTZPresetTourState_Extended = 3 +} onvif_PTZPresetTourState; + +typedef enum +{ + PTZPresetTourDirection_Forward = 0, + PTZPresetTourDirection_Backward = 1, + PTZPresetTourDirection_Extended = 2 +} onvif_PTZPresetTourDirection; + +typedef enum +{ + Dot11AuthAndMangementSuite_None = 0, + Dot11AuthAndMangementSuite_Dot1X = 1, + Dot11AuthAndMangementSuite_PSK = 2, + Dot11AuthAndMangementSuite_Extended = 3 +} onvif_Dot11AuthAndMangementSuite; + +typedef enum +{ + Dot11Cipher_CCMP = 0, + Dot11Cipher_TKIP = 1, + Dot11Cipher_Any = 2, + Dot11Cipher_Extended = 3 +} onvif_Dot11Cipher; + +typedef enum +{ + Dot11SignalStrength_None = 0, + Dot11SignalStrength_VeryBad = 1, + Dot11SignalStrength_Bad = 2, + Dot11SignalStrength_Good = 3, + Dot11SignalStrength_VeryGood = 4, + Dot11SignalStrength_Extended = 5 +} onvif_Dot11SignalStrength; + +typedef enum +{ + Dot11StationMode_Ad_hoc = 0, + Dot11StationMode_Infrastructure = 1, + Dot11StationMode_Extended = 2 +} onvif_Dot11StationMode; + +typedef enum +{ + Dot11SecurityMode_None = 0, + Dot11SecurityMode_WEP = 1, + Dot11SecurityMode_PSK = 2, + Dot11SecurityMode_Dot1X = 3, + Dot11SecurityMode_Extended = 4 +} onvif_Dot11SecurityMode; + +typedef enum +{ + ReceiverMode_AutoConnect = 0, // The receiver connects on demand, as required by consumers of the media streams + ReceiverMode_AlwaysConnect = 1, // The receiver attempts to maintain a persistent connection to the configured endpoint + ReceiverMode_NeverConnect = 2, // The receiver does not attempt to connect + ReceiverMode_Unknown = 3 // This case should never happen +} onvif_ReceiverMode; + +typedef enum +{ + ReceiverState_NotConnected = 0, // The receiver is not connected + ReceiverState_Connecting = 1, // The receiver is attempting to connect + ReceiverState_Connected = 2, // The receiver is connected + ReceiverState_Unknown = 3 // This case should never happen +} onvif_ReceiverState; + +typedef enum +{ + PanDirection_Left = 0, // Move left in relation to the video source image + PanDirection_Right = 1 // Move right in relation to the video source image +} onvif_PanDirection; + +typedef enum +{ + TiltDirection_Up = 0, // Move up in relation to the video source image + TiltDirection_Down = 1 // Move down in relation to the video source image +} onvif_TiltDirection; + +typedef enum +{ + ZoomDirection_Wide = 0, // Move video source lens toward a wider field of view + ZoomDirection_Telephoto = 1 // Move video source lens toward a narrower field of view +} onvif_ZoomDirection; + +typedef enum +{ + RollDirection_Clockwise = 0, // Move clockwise in relation to the video source image + RollDirection_Counterclockwise = 1, // Move counterclockwise in relation to the video source image + RollDirection_Auto = 2 // Automatically level the device in relation to the video source image +} onvif_RollDirection; + +typedef enum +{ + FocusDirection_Near = 0, // Move to focus on close objects + FocusDirection_Far = 1, // Move to focus on distant objects + FocusDirection_Auto = 2 // Automatically focus for the sharpest video source image +} onvif_FocusDirection; + +/***************************************************************************************/ +typedef struct +{ + char Code[128]; + char Subcode[128]; + char Reason[256]; +} onvif_Fault; + +typedef struct +{ + int https; // https connection + int port; // onvif port + char host[128]; // ip of xaddrs + char url[128]; // /onvif/device_service +} onvif_XAddr; + +typedef struct +{ + int Major; // required + int Minor; // required +} onvif_Version; + +typedef struct +{ + float Min; // required + float Max; // required +} onvif_FloatRange; + +typedef struct +{ + uint32 spaceFlag : 1; // Indicates whether the field space is valid + uint32 reserved : 31; + + float x; // required + float y; // required + char space[256]; // optional +} onvif_Vector; + +typedef struct +{ + uint32 sizeItems; + int Items[10]; // optional +} onvif_IntList; + +typedef struct +{ + int sizeItems; + float Items[10]; // optional +} onvif_FloatList; + +typedef struct +{ + int sizeItems; + + onvif_ParityBit Items[10]; // optional +} onvif_ParityBitList; + +/* device capabilities */ +typedef struct +{ + // network capabilities + uint32 IPFilter : 1; // Indicates support for IP filtering + uint32 ZeroConfiguration : 1; // Indicates support for zeroconf + uint32 IPVersion6 : 1; // Indicates support for IPv6 + uint32 DynDNS : 1; // Indicates support for dynamic DNS configuration + uint32 Dot11Configuration : 1; // Indicates support for IEEE 802.11 configuration + uint32 HostnameFromDHCP : 1; // Indicates support for retrieval of hostname from DHCP + uint32 DHCPv6 : 1; // Indicates support for Stateful IPv6 DHCP + + // system capabilities + uint32 DiscoveryResolve : 1; // Indicates support for WS Discovery resolve requests + uint32 DiscoveryBye : 1; // Indicates support for WS-Discovery Bye + uint32 RemoteDiscovery : 1; // Indicates support for remote discovery + uint32 SystemBackup : 1; // Indicates support for system backup through MTOM + uint32 SystemLogging : 1; // Indicates support for retrieval of system logging through MTOM + uint32 FirmwareUpgrade : 1; // Indicates support for firmware upgrade through MTOM + uint32 HttpFirmwareUpgrade : 1; // Indicates support for system backup through MTOM + uint32 HttpSystemBackup : 1; // Indicates support for system backup through HTTP + uint32 HttpSystemLogging : 1; // Indicates support for retrieval of system logging through HTTP + uint32 HttpSupportInformation : 1; // Indicates support for retrieving support information through HTTP + uint32 StorageConfiguration: 1; // Indicates support for storage configuration interfaces + uint32 DiscoveryNotSupported : 1; // Indicates no support for network discovery + uint32 NetworkConfigNotSupported : 1; // Indicates no support for network configuration + uint32 UserConfigNotSupported : 1; // Indicates no support for user configuration + + // scurity capabilities + uint32 TLS10 : 1; // Indicates support for TLS 1.0 + uint32 TLS11 : 1; // Indicates support for TLS 1.1 + uint32 TLS12 : 1; // Indicates support for TLS 1.2 + uint32 OnboardKeyGeneration: 1; // Indicates support for onboard key generation + uint32 AccessPolicyConfig : 1; // Indicates support for access policy configuration + uint32 DefaultAccessPolicy : 1; // Indicates support for the ONVIF default access policy + uint32 Dot1X : 1; // Indicates support for IEEE 802.1X configuration + uint32 RemoteUserHandling : 1; // Indicates support for remote user configuration. Used when accessing another device + uint32 X509Token : 1; // Indicates support for WS-Security X.509 token + uint32 SAMLToken : 1; // Indicates support for WS-Security SAML token + uint32 KerberosToken : 1; // Indicates support for WS-Security Kerberos token + uint32 UsernameToken : 1; // Indicates support for WS-Security Username token + uint32 HttpDigest : 1; // Indicates support for WS over HTTP digest authenticated communication layer + uint32 RELToken : 1; // Indicates support for WS-Security REL token + uint32 JsonWebToken : 1; // Indicates support for JWT-based authentication with WS-Security Binary Security token + uint32 Auxiliary : 1; // Auxiliary commaond + uint32 Reserved : 27; + + // IO + int InputConnectors; // optional, Number of input connectors + int RelayOutputs; // optional, Number of relay outputs + + int Dot1XConfigurations; // Indicates the maximum number of Dot1X configurations supported by the device + int NTP; // Maximum number of NTP servers supported by the devices SetNTP command + + int SupportedEAPMethods; // EAP Methods supported by the device. + // The int values refer to the IANA EAP Registry + int MaxUsers; // The maximum number of users that the device supports + int MaxUserNameLength; // Maximum number of characters supported for the username by CreateUsers + int MaxPasswordLength; // Maximum number of characters supported for the password by CreateUsers and SetUser + char SecurityPolicies[100]; // Indicates which security policies are supported. + // Options are: ModifyPassword (to be extended with: PasswordComplexity, PasswordHistory, AuthFailureWarning) + char HashingAlgorithms[32]; // Supported hashing algorithms as part of HTTP and RTSP Digest authentication.Example: MD5,SHA-256 + + int MaxStorageConfigurations; // Indicates maximum number of storage configurations supported + int GeoLocationEntries; // If present signals support for geo location. The value signals the supported number of entries + char AutoGeo[256]; // List of supported automatic GeoLocation adjustment supported by the device. Valid items are defined by tds:AutoGeoMode + // Location:Automatic adjustment of the device location + // Heading:Automatic adjustment of the device orientation relative to the compass also called yaw + // Leveling:Automatic adjustment of the deviation from the horizon also called pitch and roll + char StorageTypesSupported[256]; // Enumerates the supported StorageTypes, see tds:StorageType: + // NFS,CIFS,CDMI,FTP + char Addons[256]; // List of supported Addons by the device + + // misc capabilities + char AuxiliaryCommands[256]; // Lists of commands supported by SendAuxiliaryCommand + + uint32 sizeSupportedVersions; // number of Supported Versions + onvif_Version SupportedVersions[10]; // Supported Versions + onvif_Version Version; // required + onvif_XAddr XAddr; +} onvif_DevicesCapabilities; + +/* media capabilities */ +typedef struct +{ + uint32 SnapshotUri : 1; // Indicates if GetSnapshotUri is supported + uint32 Rotation : 1; // Indicates whether or not Rotation feature is supported + uint32 VideoSourceMode : 1; // Indicates the support for changing video source mode + uint32 OSD : 1; // Indicates if OSD is supported + uint32 TemporaryOSDText : 1; // Indicates if TemporaryOSDText is supported + uint32 EXICompression : 1; // Indicates the support for the Efficient XML Interchange (EXI) binary XML format + uint32 RTPMulticast : 1; // Indicates support for RTP multicast + uint32 RTP_TCP : 1; // Indicates support for RTP over TCP + uint32 RTP_RTSP_TCP : 1; // Indicates support for RTP/RTSP/TCP + uint32 NonAggregateControl : 1; // Indicates support for non aggregate RTSP control + uint32 NoRTSPStreaming : 1; // Indicates the device does not support live media streaming via RTSP + uint32 support : 1; // Indication if the device supports media service + uint32 reserved : 20; + + int MaximumNumberOfProfiles; // Maximum number of profiles supported + + onvif_Version Version; // required + onvif_XAddr XAddr; +} onvif_MediaCapabilities; + +/* PTZ capabilities */ +typedef struct +{ + uint32 EFlip : 1; // Indicates whether or not EFlip is supported + uint32 Reverse : 1; // Indicates whether or not reversing of PT control direction is supported + uint32 GetCompatibleConfigurations : 1; // Indicates support for the GetCompatibleConfigurations command + uint32 MoveStatus : 1; // Indicates that the PTZVector includes MoveStatus information + uint32 StatusPosition : 1; // Indicates that the PTZVector includes Position information + uint32 support : 1; // Indication if the device supports ptz service + uint32 reserved : 26; + + char MoveAndTrack[64]; // Indication of the methods of MoveAndTrack that are supported, acceptable values are defined in tt:MoveAndTrackMethod + // PresetToken + // GeoLocation + // PTZVector + // ObjectID + + onvif_Version Version; // required + onvif_XAddr XAddr; +} onvif_PTZCapabilities; + +/* event capabilities */ +typedef struct +{ + uint32 WSSubscriptionPolicySupport : 1; // Indicates that the WS Subscription policy is supported + uint32 WSPullPointSupport : 1; // Indicates that the WS Pull Point is supported + uint32 WSPausableSubscriptionManagerInterfaceSupport : 1; // Indicates that the WS Pausable Subscription Manager Interface is supported + uint32 PersistentNotificationStorage : 1; // Indication if the device supports persistent notification storage + uint32 MetadataOverMQTT : 1; // Indicates that metadata streaming over MQTT is supported + uint32 support : 1; // Indication if the device supports events service + uint32 reserved : 26; + + int MaxNotificationProducers; // Maximum number of supported notification producers as defined by WS-BaseNotification + int MaxPullPoints; // Maximum supported number of notification pull points + char EventBrokerProtocols[100]; // A space separated list of supported event broker protocols as defined by the tev:EventBrokerProtocol datatype + // mqtt + // mqtts + // ws + // wss + int MaxEventBrokers; // Maxiumum number of event broker configurations that can be added to the device + + onvif_Version Version; // required + onvif_XAddr XAddr; +} onvif_EventCapabilities; + +/* image capabilities */ +typedef struct +{ + uint32 ImageStabilization : 1; // Indicates whether or not Image Stabilization feature is supported + uint32 Presets : 1; // Indicates whether or not Presets feature is supported + uint32 AdaptablePreset : 1; // Indicates whether or not imaging preset settings can be updated + uint32 support : 1; // Indication if the device supports image service + uint32 reserved : 28; + + onvif_Version Version; // required + onvif_XAddr XAddr; +} onvif_ImagingCapabilities; + +/* analytics capabilities*/ +typedef struct +{ + uint32 RuleSupport : 1; // Indication that the device supports the rules interface and the rules syntax + uint32 AnalyticsModuleSupport : 1; // Indication that the device supports the scene analytics module interface + uint32 CellBasedSceneDescriptionSupported : 1; // Indication that the device produces the cell based scene description + uint32 RuleOptionsSupported: 1; // Indication that the device supports the GetRuleOptions operation on the rules interface + uint32 AnalyticsModuleOptionsSupported : 1; // Indication that the device supports the GetAnalyticsModuleOptions operation on the analytics interface + uint32 SupportedMetadata : 1; // Indication that the device supports the GetSupportedMetadata operation + uint32 support : 1; // Indication if the device supports Analytics service + uint32 reserved : 25; + + char ImageSendingType[100]; // Indication what kinds of method that the device support for sending image + // Embedded, LocalStorage, RemoteStorage + + onvif_Version Version; // required + onvif_XAddr XAddr; +} onvif_AnalyticsCapabilities; + +/* recording capabilities */ +typedef struct +{ + uint32 ReceiverSource : 1; + uint32 MediaProfileSource : 1; + uint32 DynamicRecordings : 1; // Indication if the device supports dynamic creation and deletion of recordings + uint32 DynamicTracks : 1; // Indication if the device supports dynamic creation and deletion of tracks + uint32 Options : 1; // Indication if the device supports the GetRecordingOptions command + uint32 MetadataRecording : 1; // Indication if the device supports recording metadata + uint32 EventRecording : 1; // Indication that the device supports event triggered recording + uint32 JPEG : 1; // Indication if supports JPEG encoding + uint32 MPEG4 : 1; // Indication if supports MPEG4 encoding + uint32 H264 : 1; // Indication if supports H264 encoding + uint32 H265 : 1; // Indication if supports H265 encoding + uint32 G711 : 1; // Indication if supports G711 encoding + uint32 G726 : 1; // Indication if supports G726 encoding + uint32 AAC : 1; // Indication if supports AAC encoding + uint32 SupportedTargetFormatsFlag : 1; // Indicates whether the field SupportedTargetFormats is valid + uint32 EncryptionEntryLimitFlag : 1; // Indicates whether the field EncryptionEntryLimit is valid + uint32 SupportedEncryptionModesFlag : 1; // Indicates whether the field SupportedEncryptionModes is valid + uint32 support : 1; // Indication if the device supports recording service + uint32 reserved : 14; + + uint32 MaxStringLength; + float MaxRate; // optional, Maximum supported bit rate for all tracks of a recording in kBit/s + float MaxTotalRate; // optional, Maximum supported bit rate for all recordings in kBit/s. + int MaxRecordings; // optional, Maximum number of recordings supported. + int MaxRecordingJobs; // optional, Maximum total number of supported recording jobs by the device + char SupportedExportFileFormats[100]; // optional, Indication that the device supports ExportRecordedData command for the listed export file formats. + // The list shall return at least one export file format value. The value of 'ONVIF' refers to + // ONVIF Export File Format specification + int BeforeEventLimit; // optional, If present a device shall support configuring before event durations up to the given value + int AfterEventLimit; // optional, If present a device shall support configuring after event durations up to the given value + char SupportedTargetFormats[32]; // optional, List of formats supported by the device for recording to an external target. See tt:TargetFormat for a list of definitions + // MP4 - MP4 files with all tracks in a single file + // CMAF - CMAF compliant MP4 files with 1 track per file + int EncryptionEntryLimit; // optional, Number of encryption entries supported per recording. + // By specifying multiple encryption entries per recording, + // different tracks can be encrypted with different configurations + char SupportedEncryptionModes[32]; // optional, Indicates supported encryption modes. See tt:EncryptionMode for a list of definitions. + // CENC - AES-CTR mode full sample and video NAL Subsample encryption, defined in ISO/IEC 23001-7 + // CBCS - AES-CBC mode partial video NAL pattern encryption, defined in ISO/IEC 23001-7 + + onvif_Version Version; // required + onvif_XAddr XAddr; +} onvif_RecordingCapabilities; + +/* search capabilities */ +typedef struct +{ + uint32 MetadataSearch : 1; + uint32 GeneralStartEvents : 1; // Indicates support for general virtual property events in the FindEvents method + uint32 support : 1; // Indication if the device supports search service + uint32 reserved : 29; + + onvif_Version Version; // required + onvif_XAddr XAddr; +} onvif_SearchCapabilities; + +/* replay capabilities */ +typedef struct +{ + uint32 ReversePlayback : 1; // Indicator that the Device supports reverse playback as defined in the ONVIF Streaming Specification + uint32 RTP_RTSP_TCP : 1; // Indicates support for RTP/RTSP/TCP + uint32 support : 1; // Indication if the device supports replay service + uint32 reserved : 29; + + onvif_FloatRange SessionTimeoutRange; // The minimum and maximum valid values supported as session timeout in seconds + + char RTSPWebSocketUri[256]; // If playback streaming over WebSocket is supported, this shall return the RTSP WebSocket URI + + onvif_Version Version; // required + onvif_XAddr XAddr; +} onvif_ReplayCapabilities; + +/* accesscontrol capabilities */ +typedef struct +{ + uint32 support : 1; // Indication if the device supports accesscontrol service + uint32 ClientSuppliedTokenSupported : 1; // Indicates that the client is allowed to supply the token when creating access points and areas + // To enable the use of the commands SetAccessPoint and SetArea, the value must be set to true + uint32 AccessPointManagementSupported : 1; // Indicates that the client can perform CRUD operations (create, read, update and delete) on access points + uint32 AreaManagementSupported : 1; // Indicates that the client can perform CRUD operations (create, read, update and delete) on areas + uint32 reserved : 28; + + int MaxLimit; // The maximum number of entries returned by a single GetList request. + // The device shall never return more than this number of entities in a single response + int MaxAccessPoints; // Indicates the maximum number of access points supported by the device + int MaxAreas; // Indicates the maximum number of areas supported by the device + + + onvif_Version Version; // required + onvif_XAddr XAddr; +} onvif_AccessControlCapabilities; + +/* doorcontrol capabilities */ +typedef struct +{ + uint32 support : 1; // Indication if the device supports doorcontrol service + uint32 ClientSuppliedTokenSupported : 1; // Indicates that the client is allowed to supply the token when creating doors. + // To enable the use of the command SetDoor, the value must be set to true + uint32 DoorManagementSupported : 1; // Indicates that the client can perform CRUD operations (create, read, update and delete) on doors. + // To enable the use of the commands GetDoors, GetDoorList, CreateDoor, ModifyDoor + // and DeleteDoor, the value must be set to true + uint32 reserved : 29; + + int MaxLimit; // The maximum number of entries returned by a single GetList or Get request. + // The device shall never return more than this number of entities in a single response + int MaxDoors; // Indicates the maximum number of doors supported by the device + + onvif_Version Version; // required + onvif_XAddr XAddr; +} onvif_DoorControlCapabilities; + +typedef struct +{ + uint32 VideoSourcesFlag : 1; // Indicates whether the field VideoSources is valid + uint32 VideoOutputsFlag : 1; // Indicates whether the field VideoSources is valid + uint32 AudioSourcesFlag : 1; // Indicates whether the field VideoSources is valid + uint32 AudioOutputsFlag : 1; // Indicates whether the field VideoSources is valid + uint32 RelayOutputsFlag : 1; // Indicates whether the field VideoSources is valid + uint32 SerialPortsFlag : 1; // Indicates whether the field VideoSources is valid + uint32 DigitalInputsFlag : 1; // Indicates whether the field VideoSources is valid + uint32 DigitalInputOptionsFlag : 1; // Indicates whether the field VideoSources is valid + uint32 support : 1; // Indication if the device supports deviceIO service + uint32 reserved : 23; + + int VideoSources; // optional, Number of video sources (defaults to none) + int VideoOutputs; // optional, Number of video outputs (defaults to none) + int AudioSources; // optional, Number of audio sources (defaults to none) + int AudioOutputs; // optional, Number of audio outputs (defaults to none) + int RelayOutputs; // optional, Number of relay outputs (defaults to none) + int SerialPorts; // optional, Number of serial ports (defaults to none) + int DigitalInputs; // optional, Number of digital inputs (defaults to none) + BOOL DigitalInputOptions; // optional, Indicates support for DigitalInput configuration of the idle state (defaults to false) + + onvif_Version Version; // required + onvif_XAddr XAddr; +} onvif_DeviceIOCapabilities; + +typedef struct +{ + uint32 MaximumNumberOfProfilesFlag : 1; // Indicates whether the field MaximumNumberOfProfiles is valid + uint32 ConfigurationsSupportedFlag : 1; // Indicates whether the field ConfigurationsSupported is valid + uint32 Reserved : 30; + + int MaximumNumberOfProfiles; // optional, Maximum number of profiles supported + char ConfigurationsSupported[256]; // optional, Enumerates the configurations supported +} onvif_ProfileCapabilities; + +typedef struct +{ + uint32 RTSPStreaming : 1; // Indicates support for live media streaming via RTSP + uint32 RTPMulticast : 1; // Indicates support for RTP multicast + uint32 RTP_RTSP_TCP : 1; // Indicates support for RTP/RTSP/TCP + uint32 NonAggregateControl : 1; // Indicates support for non aggregate RTSP control + uint32 AutoStartMulticast : 1; // Indicates support for non-RTSP controlled multicast streaming + uint32 SecureRTSPStreaming : 1; // Indicates support for live media streaming via RTSPS and SRTP + uint32 Reserved : 26; + + char RTSPWebSocketUri[256]; // optional, If streaming over websocket supported, RTSP websocket URI is provided. + // The scheme and IP part shall match the one used in the request (e.g. the GetServices request) +} onvif_StreamingCapabilities; + +typedef struct +{ + uint32 TKIP : 1; // required + uint32 ScanAvailableNetworks : 1; // required + uint32 MultipleConfiguration : 1; // required + uint32 AdHocStationMode : 1; // required + uint32 WEP : 1; // required + uint32 Reserved : 27; +} onvif_Dot11Capabilities; + +typedef struct +{ + uint32 SnapshotUri : 1; // Indicates if GetSnapshotUri is supported + uint32 Rotation : 1; // Indicates whether or not Rotation feature is supported + uint32 VideoSourceMode : 1; // Indicates the support for changing video source mode + uint32 OSD : 1; // Indicates if OSD is supported + uint32 TemporaryOSDText : 1; // Indicates if TemporaryOSDText is supported + uint32 Mask : 1; // Indicates if Masking is supported, Indicates support for mask configuration + uint32 SourceMask : 1; // Indicates if SourceMask is supported + // Indicates that privacy masks are only supported at the video source level + // and not the video source configuration level. If this is true any addition, + // deletion or change of a privacy mask done for one video source configuration + // will automatically be applied by the device to a corresponding privacy mask + // for all other video source configuration associated with the same video source. + uint32 support : 1; // Indication if the device supports media service2 + uint32 Reserved : 24; + + onvif_ProfileCapabilities ProfileCapabilities; // required, Media profile capabilities + onvif_StreamingCapabilities StreamingCapabilities; // required, Streaming capabilities + + onvif_Version Version; // required + onvif_XAddr XAddr; +} onvif_MediaCapabilities2; + +typedef struct +{ + uint32 Radiometry : 1; // Indicates whether or not radiometric thermal measurements are supported by the thermal devic + uint32 support : 1; // Indication if the device supports thermal service + uint32 Reserved : 30; + + onvif_Version Version; // required + onvif_XAddr XAddr; +} onvif_ThermalCapabilities; + +typedef struct +{ + uint32 sizeSupportedExemptionType; // sequence of elements + char SupportedExemptionType[10][32]; // optional, A list of exemptions that the device supports. Supported exemptions starting with the + // prefix pt: are reserved to define PACS specific exemption types and these reserved + // exemption types shall all share "pt:" syntax + // pt:ExemptFromAuthentication Supports ExemptedFromAuthentication +} onvif_CredentialCapabilitiesExtension; + +typedef struct +{ + uint32 ExtensionFlag : 1; + uint32 CredentialValiditySupported : 1; // required, Indicates that the device supports credential validity + uint32 CredentialAccessProfileValiditySupported: 1;// required, Indicates that the device supports validity on the association + // between a credential and an access profile + uint32 ValiditySupportsTimeValue : 1; // required, Indicates that the device supports both date and time value for validity. + // If set to false, then the time value is ignored + uint32 ResetAntipassbackSupported : 1; // required, Indicates the device supports resetting of anti-passback violations + // and notifying on anti-passback violations + uint32 ClientSuppliedTokenSupported: 1; // Indicates that the client is allowed to supply the token when creating credentials. + // To enable the use of the command SetCredential, the value must be set to true + uint32 support : 1; // Indication if the device supports credential service + uint32 Reserved : 25; + + uint32 sizeSupportedIdentifierType; // sequence of elements + char SupportedIdentifierType[10][32]; // required, A list of identifier types that the device supports. Supported identifiers starting with + // the prefix pt: are reserved to define PACS specific identifier types and these reserved + // identifier types shall all share the "pt:" syntax + // pt:Card Supports Card identifier type + // pt:PIN Supports PIN identifier type + // pt:Fingerprint Supports Fingerprint biometric identifier type + // pt:Face Supports Face biometric identifier type + // pt:Iris Supports Iris biometric identifier type + // pt:Vein Supports Vein biometric identifier type + // pt:Palm Supports Palm biometric identifier type + // pt:Retina Supports Retina biometric identifier type + uint32 MaxLimit; // required, The maximum number of entries returned by a single request. + // The device shall never return more than this number of entities in a single response + uint32 MaxCredentials; // required, The maximum number of credential supported by the device + uint32 MaxAccessProfilesPerCredential; // required, The maximum number of access profiles for a credential + + char DefaultCredentialSuspensionDuration[20]; // The default time period that the credential will temporary be suspended (e.g. by using the wrong PIN a predetermined number of times). + // The time period is defined as an [ISO 8601] duration string (e.g. PT5M). + + uint32 MaxWhitelistedItems; // optional, The maximum number of whitelisted credential identifiers supported by the device + uint32 MaxBlacklistedItems; // optional, The maximum number of blacklisted credential identifiers supported by the device + + onvif_CredentialCapabilitiesExtension Extension; // optional + + onvif_Version Version; // required + onvif_XAddr XAddr; +} onvif_CredentialCapabilities; + +typedef struct +{ + uint32 MultipleSchedulesPerAccessPointSupported: 1;// required, Indicates whether or not several access policies can refer to the same access point in + // an access profile + uint32 ClientSuppliedTokenSupported : 1; // Indicates that the client is allowed to supply the token when creating access profiles. + // To enable the use of the command SetAccessProfile, the value must be set to true + uint32 support : 1; // Indication if the device supports access rules service + uint32 Reserved : 29; + + uint32 MaxLimit; // required, The maximum number of entries returned by a single GetList or Get + // request. The device shall never return more than this number of entities in a single response + uint32 MaxAccessProfiles; // required, Indicates the maximum number of access profiles supported by the device + uint32 MaxAccessPoliciesPerAccessProfile; // required, Indicates the maximum number of access policies per access profile supported by the device + + onvif_Version Version; // required + onvif_XAddr XAddr; +} onvif_AccessRulesCapabilities; + +typedef struct +{ + uint32 ExtendedRecurrenceSupported : 1; // required, If this capability is supported, then all iCalendar recurrence types shall be supported by the device + uint32 SpecialDaysSupported : 1; // required, If this capability is supported, then the device shall support special days + uint32 StateReportingSupported : 1; // required, If this capability is set to true, the device shall implement the GetScheduleState command, + // and shall notify subscribing clients whenever schedules become active or inactive + uint32 ClientSuppliedTokenSupported : 1; // Indicates that the client is allowed to supply the token when creating schedules and special day groups. + // To enable the use of the commands SetSchedule and SetSpecialDayGroup, the value must be set to true + uint32 support : 1; // Indication if the device supports schedule service + uint32 Reserved : 27; + + uint32 MaxLimit; // required, + uint32 MaxSchedules; // required, + uint32 MaxTimePeriodsPerDay; // required, + uint32 MaxSpecialDayGroups; // required, + uint32 MaxDaysInSpecialDayGroup; // required, + uint32 MaxSpecialDaysSchedules; // required, + + onvif_Version Version; // required + onvif_XAddr XAddr; +} onvif_ScheduleCapabilities; + +typedef struct +{ + uint32 RTP_USCOREMulticast : 1; // required, Indicates that the device can receive RTP multicast streams + uint32 RTP_USCORETCP : 1; // required, Indicates that the device can receive RTP/TCP streams + uint32 RTP_USCORERTSP_USCORETCP : 1; // required, Indicates that the device can receive RTP/RTSP/TCP streams + uint32 support : 1; // Indication if the device supports receiver service + uint32 Reserved : 28; + + int SupportedReceivers; // required, The maximum number of receivers supported by the device + int MaximumRTSPURILength; // required, The maximum allowed length for RTSP URIs (Minimum and default value is 128 octet) + + onvif_Version Version; // required + onvif_XAddr XAddr; +} onvif_ReceiverCapabilities; + +typedef struct +{ + uint32 MaximumPanMovesFlag : 1; // Indicates whether the field MaximumPanMoves is valid + uint32 MaximumTiltMovesFlag : 1; // Indicates whether the field MaximumTiltMoves is valid + uint32 MaximumZoomMovesFlag : 1; // Indicates whether the field MaximumZoomMoves is valid + uint32 MaximumRollMovesFlag : 1; // Indicates whether the field MaximumRollMoves is valid + uint32 AutoLevelFlag : 1; // Indicates whether the field AutoLevel is valid + uint32 MaximumFocusMovesFlag : 1; // Indicates whether the field MaximumFocusMoves is valid + uint32 AutoFocusFlag : 1; // Indicates whether the field AutoFocus is valid + uint32 Reserved : 25; + + char VideoSourceToken[ONVIF_TOKEN_LEN]; // required, Unique identifier of a video source + int MaximumPanMoves; // optional, Lifetime limit of pan moves for this video source. Presence of this attribute indicates support of pan move + int MaximumTiltMoves; // optional, Lifetime limit of tilt moves for this video source. Presence of this attribute indicates support of tilt move + int MaximumZoomMoves; // optional, Lifetime limit of zoom moves for this video source. Presence of this attribute indicates support of zoom move + int MaximumRollMoves; // optional, Lifetime limit of roll moves for this video source. Presence of this attribute indicates support of roll move + BOOL AutoLevel; // optional, Indicates "auto" as a valid enum for Direction in RollMove + int MaximumFocusMoves; // optional, Lifetime limit of focus moves for this video source. Presence of this attribute indicates support of focus move + BOOL AutoFocus; // optional, Indicates "auto" as a valid enum for Direction in FocusMove +} onvif_SourceCapabilities; + +typedef struct +{ + uint32 support : 1; // Indication if the device supports provisioning service + uint32 Reserved : 31; + + int DefaultTimeout; // external, Maximum time before stopping movement after a move operation + + uint32 sizeSource; // sequence of elements + + onvif_SourceCapabilities Source[4]; // optional, Capabilities per video source + + onvif_Version Version; // required + onvif_XAddr XAddr; +} onvif_ProvisioningCapabilities; + +typedef struct +{ + onvif_DevicesCapabilities device; // The capabilities for the device service is returned in the Capabilities element + onvif_EventCapabilities events; // The capabilities for the event service is returned in the Capabilities element + onvif_Dot11Capabilities dot11; // The capabilities for the dot11 + onvif_MediaCapabilities media; // The capabilities for the media service is returned in the Capabilities element + onvif_MediaCapabilities2 media2; // The capabilities for the media service2 is returned in the Capabilities element + onvif_ImagingCapabilities image; // The capabilities for the imaging service is returned in the Capabilities element + onvif_PTZCapabilities ptz; // The capabilities for the PTZ service is returned in the Capabilities element + onvif_AnalyticsCapabilities analytics; // The capabilities for the analytics service is returned in the Capabilities element + onvif_RecordingCapabilities recording; // The capabilities for the recording service is returned in the Capabilities element + onvif_SearchCapabilities search; // The capabilities for the search service is returned in the Capabilities element + onvif_ReplayCapabilities replay; // The capabilities for the replay service is returned in the Capabilities element + onvif_AccessControlCapabilities accesscontrol; // The capabilities for the accesscontrol service is returned in the Capabilities element + onvif_DoorControlCapabilities doorcontrol; // The capabilities for the doorcontrol service is returned in the Capabilities element + onvif_DeviceIOCapabilities deviceIO; // The capabilities for the deviceIO service is returned in the Capabilities element + onvif_ThermalCapabilities thermal; // The capabilities for the thermal service is returned in the Capabilities element + onvif_CredentialCapabilities credential; // The capabilities for the credential service is returned in the Capabilities element + onvif_AccessRulesCapabilities accessrules; // The capabilities for the access rules service is returned in the Capabilities element + onvif_ScheduleCapabilities schedule; // The capabilities for the schedule service is returned in the Capabilities element + onvif_ReceiverCapabilities receiver; // The capabilities for the receiver service is returned in the Capabilities element + onvif_ProvisioningCapabilities provisioning; // The capabilities for the provisioning service is returned in the Capabilities element +} onvif_Capabilities; + +typedef struct +{ + char Manufacturer[64]; // required, The manufactor of the device + char Model[64]; // required, The device model + char FirmwareVersion[64]; // required, The firmware version in the device + char SerialNumber[64]; // required, The serial number of the device + char HardwareId[64]; // required, The hardware ID of the device +} onvif_DeviceInformation; + +typedef struct +{ + int Width; // required + int Height; // required +} onvif_VideoResolution; + +typedef struct +{ + int Min; // required + int Max; // required +} onvif_IntRange; + +typedef struct +{ + int x; // required + int y; // required + int width; // required + int height; // required +} onvif_IntRectangle; + +typedef struct +{ + float bottom; // required + float top; // required + float right; // required + float left; // required +} onvif_Rectangle; + +typedef struct +{ + uint32 LevelFlag : 1; // Indicates whether the field Level is valid + uint32 Reserved : 31; + + onvif_BacklightCompensationMode Mode; // required, Backlight compensation mode (on/off) + float Level; // optional, Optional level parameter (unit unspecified) +} onvif_BacklightCompensation; + +typedef struct +{ + uint32 PriorityFlag : 1; // Indicates whether the field Priority is valid + uint32 MinExposureTimeFlag : 1; // Indicates whether the field MinExposureTime is valid + uint32 MaxExposureTimeFlag : 1; // Indicates whether the field MaxExposureTime is valid + uint32 MinGainFlag : 1; // Indicates whether the field MinGain is valid + uint32 MaxGainFlag : 1; // Indicates whether the field MaxGain is valid + uint32 MinIrisFlag : 1; // Indicates whether the field MinIris is valid + uint32 MaxIrisFlag : 1; // Indicates whether the field MaxIris is valid + uint32 ExposureTimeFlag : 1; // Indicates whether the field ExposureTime is valid + uint32 GainFlag : 1; // Indicates whether the field Gain is valid + uint32 IrisFlag : 1; // Indicates whether the field Iris is valid + uint32 Reserved : 22; + + onvif_ExposureMode Mode; // required, Auto - Enabled the exposure algorithm on the device; Manual - Disabled exposure algorithm on the device + onvif_ExposurePriority Priority; // optional, The exposure priority mode (low noise/framerate) + onvif_Rectangle Window; // required, + + float MinExposureTime; // optional, Minimum value of exposure time range allowed to be used by the algorithm + float MaxExposureTime; // optional, Maximum value of exposure time range allowed to be used by the algorithm + float MinGain; // optional, Minimum value of the sensor gain range that is allowed to be used by the algorithm + float MaxGain; // optional, Maximum value of the sensor gain range that is allowed to be used by the algorithm + float MinIris; // optional, Minimum value of the iris range allowed to be used by the algorithm + float MaxIris; // optional, Maximum value of the iris range allowed to be used by the algorithm + float ExposureTime; // optional, The fixed exposure time used by the image sensor + float Gain; // optional, The fixed gain used by the image sensor (dB) + float Iris; // optional, The fixed attenuation of input light affected by the iris (dB). 0dB maps to a fully opened iris +} onvif_Exposure; + +typedef struct +{ + uint32 DefaultSpeedFlag : 1; // Indicates whether the field DefaultSpeed is valid + uint32 NearLimitFlag : 1; // Indicates whether the field NearLimit is valid + uint32 FarLimitFlag : 1; // Indicates whether the field FarLimit is valid + uint32 Reserved : 29; + + onvif_AutoFocusMode AutoFocusMode; // required, Mode of auto fucus + + float DefaultSpeed; // optional, + float NearLimit; // optional, Parameter to set autofocus near limit (unit: meter) + float FarLimit; // optional, Parameter to set autofocus far limit (unit: meter) +} onvif_FocusConfiguration; + +typedef struct +{ + uint32 LevelFlag : 1; // Indicates whether the field Level is valid + uint32 Reserved : 31; + + onvif_WideDynamicMode Mode; // required, Wide dynamic range mode (on/off), 0-OFF, 1-ON + float Level; // optional, Optional level parameter (unit unspecified) +} onvif_WideDynamicRange; + +typedef struct +{ + uint32 CrGainFlag : 1; // Indicates whether the field CrGain is valid + uint32 CbGainFlag : 1; // Indicates whether the field CbGain is valid + uint32 Reserved : 30; + + onvif_WhiteBalanceMode Mode; // required, 'AUTO' or 'MANUAL' + + float CrGain; // optional, Rgain (unitless) + float CbGain; // optional, Bgain (unitless) +} onvif_WhiteBalance; + +typedef struct +{ + uint32 BacklightCompensationFlag : 1; // Indicates whether the field BacklightCompensation is valid + uint32 BrightnessFlag : 1; // Indicates whether the field Brightness is valid + uint32 ColorSaturationFlag : 1; // Indicates whether the field ColorSaturation is valid + uint32 ContrastFlag : 1; // Indicates whether the field Contrast is valid + uint32 ExposureFlag : 1; // Indicates whether the field Exposure is valid + uint32 FocusFlag : 1; // Indicates whether the field Focus is valid + uint32 IrCutFilterFlag : 1; // Indicates whether the field IrCutFilter is valid + uint32 SharpnessFlag : 1; // Indicates whether the field Sharpness is valid + uint32 WideDynamicRangeFlag : 1; // Indicates whether the field WideDynamicRange is valid + uint32 WhiteBalanceFlag : 1; // Indicates whether the field WhiteBalance is valid + uint32 Reserved : 22; + + onvif_BacklightCompensation BacklightCompensation; // optional, Enabled/disabled BLC mode (on/off) + float Brightness; // optional, Image brightness (unit unspecified) + float ColorSaturation; // optional, Color saturation of the image (unit unspecified) + float Contrast; // optional, Contrast of the image (unit unspecified) + onvif_Exposure Exposure; // optional, Exposure mode of the device + onvif_FocusConfiguration Focus; // optional, Focus configuration + onvif_IrCutFilterMode IrCutFilter; // optional, Infrared Cutoff Filter settings + float Sharpness; // optional, Sharpness of the Video image + onvif_WideDynamicRange WideDynamicRange; // optional, WDR settings + onvif_WhiteBalance WhiteBalance; // optional, White balance settings +} onvif_ImagingSettings; + +typedef struct +{ + uint32 Mode_ON : 1; // Indicates whether mode ON is valid + uint32 Mode_OFF : 1; // Indicates whether mode OFF is valid + uint32 LevelFlag : 1; // Indicates whether the field LevelFlag is valid + uint32 Reserved : 29; + + onvif_FloatRange Level; // optional, Level range of BacklightCompensation +} onvif_BacklightCompensationOptions; + +typedef struct +{ + uint32 Mode_AUTO : 1; // Indicates whether mode AUTO is valid + uint32 Mode_MANUAL : 1; // Indicates whether mode Manual is valid + uint32 Priority_LowNoise : 1; // Indicates whether Priority LowNoise is valid + uint32 Priority_FrameRate : 1; // Indicates whether Priority FrameRate is valid + uint32 MinExposureTimeFlag : 1; // Indicates whether the field MinExposureTime is valid + uint32 MaxExposureTimeFlag : 1; // Indicates whether the field MaxExposureTime is valid + uint32 MinGainFlag : 1; // Indicates whether the field MinGain is valid + uint32 MaxGainFlag : 1; // Indicates whether the field MaxGain is valid + uint32 MinIrisFlag : 1; // Indicates whether the field MinIris is valid + uint32 MaxIrisFlag : 1; // Indicates whether the field MaxIris is valid + uint32 ExposureTimeFlag : 1; // Indicates whether the field ExposureTime is valid + uint32 GainFlag : 1; // Indicates whether the field Gain is valid + uint32 IrisFlag : 1; // Indicates whether the field Iris is valid + uint32 Reserved : 19; + + onvif_FloatRange MinExposureTime; // optional, Valid range of the Minimum ExposureTime + onvif_FloatRange MaxExposureTime; // optional, Valid range of the Maximum ExposureTime + onvif_FloatRange MinGain; // optional, Valid range of the Minimum Gain + onvif_FloatRange MaxGain; // optional, Valid range of the Maximum Gain + onvif_FloatRange MinIris; // optional, Valid range of the Minimum Iris + onvif_FloatRange MaxIris; // optional, Valid range of the Maximum Iris + onvif_FloatRange ExposureTime; // optional, Valid range of the ExposureTime + onvif_FloatRange Gain; // optional, Valid range of the Gain + onvif_FloatRange Iris; // optional, Valid range of the Iris +} onvif_ExposureOptions; + +typedef struct +{ + uint32 AutoFocusModes_AUTO : 1; // Indicates whether mode aUTO is valid + uint32 AutoFocusModes_MANUAL : 1; // Indicates whether mode Manual is valid + uint32 DefaultSpeedFlag : 1; // Indicates whether the field DefaultSpeed is valid + uint32 NearLimitFlag : 1; // Indicates whether the field NearLimit is valid + uint32 FarLimitFlag : 1; // Indicates whether the field FarLimit is valid + uint32 Reserved : 27; + + onvif_FloatRange DefaultSpeed; // optional, Valid range of DefaultSpeed + onvif_FloatRange NearLimit; // optional, Valid range of NearLimit + onvif_FloatRange FarLimit; // optional, Valid range of FarLimit +} onvif_FocusOptions; + +typedef struct +{ + uint32 Mode_ON : 1; // Indicates whether mode ON is valid + uint32 Mode_OFF : 1; // Indicates whether mode OFF is valid + uint32 LevelFlag : 1; // Indicates whether the field Level is valid + uint32 Reserved : 29; + + onvif_FloatRange Level; // optional, Valid range of Level +} onvif_WideDynamicRangeOptions; + +typedef struct +{ + uint32 Mode_AUTO : 1; // Indicates whether mode AUDO is valid + uint32 Mode_MANUAL : 1; // Indicates whether mode Manual is valid + uint32 YrGainFlag : 1; // Indicates whether the field CrGain is valid + uint32 YbGainFlag : 1; // Indicates whether the field CbGain is valid + uint32 Reserved : 28; + + onvif_FloatRange YrGain; // optional, Valid range of YrGain + onvif_FloatRange YbGain; // optional, Valid range of YbGain +} onvif_WhiteBalanceOptions; + +typedef struct +{ + uint32 IrCutFilterMode_ON : 1; // Indicates whether IrCutFilter mode ON is valid + uint32 IrCutFilterMode_OFF : 1; // Indicates whether IrCutFilter mode OFF is valid + uint32 IrCutFilterMode_AUTO : 1; // Indicates whether IrCutFilter mode AUTO is valid + uint32 BacklightCompensationFlag : 1; // Indicates whether the field BacklightCompensation is valid + uint32 BrightnessFlag : 1; // Indicates whether the field Brightness is valid + uint32 ColorSaturationFlag : 1; // Indicates whether the field ColorSaturation is valid + uint32 ContrastFlag : 1; // Indicates whether the field Contrast is valid + uint32 ExposureFlag : 1; // Indicates whether the field Exposure is valid + uint32 FocusFlag : 1; // Indicates whether the field Focus is valid + uint32 SharpnessFlag : 1; // Indicates whether the field Sharpness is valid + uint32 WideDynamicRangeFlag : 1; // Indicates whether the field WideDynamicRange is valid + uint32 WhiteBalanceFlag : 1; // Indicates whether the field WhiteBalance is valid + uint32 Reserved : 20; + + onvif_BacklightCompensationOptions BacklightCompensation; // optional, Valid range of Backlight Compensation + + onvif_FloatRange Brightness; // optional, Valid range of Brightness + onvif_FloatRange ColorSaturation; // optional, alid range of Color Saturation + onvif_FloatRange Contrast; // optional, Valid range of Contrast + + onvif_ExposureOptions Exposure; // optional, Valid range of Exposure + onvif_FocusOptions Focus; // optional, Valid range of Focus + + onvif_FloatRange Sharpness; // optional, Valid range of Sharpness + + onvif_WideDynamicRangeOptions WideDynamicRange; // optional, Valid range of WideDynamicRange + onvif_WhiteBalanceOptions WhiteBalance; // optional, Valid range of WhiteBalance +} onvif_ImagingOptions; + +typedef struct +{ + uint32 ErrorFlag : 1; // Indicates whether the field Error is valid + uint32 Reserved : 31; + + float Position; // required, Status of focus position + onvif_MoveStatus MoveStatus; // required, Status of focus MoveStatus + char Error[100]; // optional, Error status of focus +} onvif_FocusStatus; + +typedef struct +{ + uint32 FocusStatusFlag : 1; // Indicates whether the field FocusStatus is valid + uint32 Reserved : 31; + + onvif_FocusStatus FocusStatus; // optional, Status of focus +} onvif_ImagingStatus; + +typedef struct +{ + uint32 SpeedFlag : 1; + uint32 Reserved : 31; + + onvif_FloatRange Position; // required, Valid ranges of the position + onvif_FloatRange Speed; // optional, Valid ranges of the speed +} onvif_AbsoluteFocusOptions; + +typedef struct +{ + uint32 SpeedFlag : 1; + uint32 Reserved : 31; + + onvif_FloatRange Distance; // required, valid ranges of the distance + onvif_FloatRange Speed; // optional, Valid ranges of the speed +} onvif_RelativeFocusOptions20; + +typedef struct +{ + onvif_FloatRange Speed; // required, Valid ranges of the speed +} onvif_ContinuousFocusOptions; + +typedef struct +{ + uint32 AbsoluteFlag : 1; + uint32 RelativeFlag : 1; + uint32 ContinuousFlag : 1; + uint32 Reserved : 29; + + onvif_AbsoluteFocusOptions Absolute; // optional, Valid ranges for the absolute control + onvif_RelativeFocusOptions20 Relative; // optional, Valid ranges for the relative control + onvif_ContinuousFocusOptions Continuous; // optional, Valid ranges for the continuous control +} onvif_MoveOptions20; + +typedef struct +{ + uint32 SpeedFlag : 1; // Indicates whether the field Speed is valid + uint32 Reserved : 31; + + float Position; // required, Position parameter for the absolute focus control + float Speed; // optional, Speed parameter for the absolute focus control +} onvif_AbsoluteFocus; + +typedef struct +{ + uint32 SpeedFlag : 1; // Indicates whether the field Speed is valid + uint32 Reserved : 31; + + float Distance; // required, Distance parameter for the relative focus control + float Speed; // optional, Speed parameter for the relative focus control +} onvif_RelativeFocus; + +typedef struct +{ + float Speed; // required, Speed parameter for the Continuous focus control +} onvif_ContinuousFocus; + +typedef struct +{ + uint32 AbsoluteFlag : 1; // Indicates whether the field Absolute is valid + uint32 RelativeFlag : 1; // Indicates whether the field Relative is valid + uint32 ContinuousFlag : 1; // Indicates whether the field Continuous is valid + uint32 Reserved : 29; + + onvif_AbsoluteFocus Absolute; // optional, Parameters for the absolute focus control + onvif_RelativeFocus Relative; // optional, Parameters for the relative focus control + onvif_ContinuousFocus Continuous; // optional, Parameter for the continuous focus control +} onvif_FocusMove; + +typedef struct +{ + char Name[ONVIF_NAME_LEN]; // required, Human readable name of the Imaging Preset + char token[ONVIF_TOKEN_LEN]; // required, Unique identifier of this Imaging Preset + char type[64]; // required, Indicates Imaging Preset Type. Use ImagingPresetType + // Describes standard Imaging Preset types, + // used to facilitate Multi-language support and client display. + // "Custom" Type shall be used when Imaging Preset Name does not + // match any of the types included in the standard classification + // Custom + // ClearWeather + // Cloudy + // Fog + // Rain + // Snowing + // Snow + // WDR + // Shade + // Night + // Indoor + // Fluorescent + // Incandescent + // Sodium(Natrium) + // Sunrise(Horizon) + // Sunset(Rear) + // ExtremeHot + // ExtremeCold + // Underwater + // CloseUp + // Motion + // FlickerFree50 + // FlickerFree60 +} onvif_ImagingPreset; + +typedef struct _ImagingPresetList +{ + struct _ImagingPresetList * next; + + onvif_ImagingPreset Preset; +} ImagingPresetList; + +typedef struct +{ + uint32 PasswordFlag : 1; // Indicates whether the field Password is valid + uint32 Reserved : 31; + + char Username[ONVIF_NAME_LEN]; // required + char Password[ONVIF_NAME_LEN]; // optional + + onvif_UserLevel UserLevel; // required +} onvif_User; + +typedef struct +{ + uint32 PasswordFlag : 1; // Indicates whether the field Password is valid + uint32 Reserved : 31; + + char Username[ONVIF_NAME_LEN]; // required + char Password[ONVIF_NAME_LEN]; // optional + + BOOL UseDerivedPassword; // required +} onvif_RemoteUser; + +typedef struct +{ + char Address[100]; // required + int PrefixLength; // required +} onvif_PrefixedIPAddress; + +typedef struct +{ + onvif_IPAddressFilterType Type; // required + onvif_PrefixedIPAddress IPv4Address[20]; // optional + onvif_PrefixedIPAddress IPv6Address[20]; // optional +} onvif_IPAddressFilter; + +typedef struct +{ + uint32 ImagingSettingsFlag : 1; // Indicates whether the field ImagingSettings is valid + uint32 Reserved : 31; + + char token[ONVIF_TOKEN_LEN]; // required + float Framerate; // required, Frame rate in frames per second + + onvif_VideoResolution Resolution; // required, Horizontal and vertical resolution + onvif_ImagingSettings ImagingSettings; // optional +} onvif_VideoSource; + +typedef struct +{ + uint32 DescriptionFlag : 1; // Indicates whether the field Description is valid + uint32 Enabled : 1; //optional, Indication of whether this mode is active. If active this value is true. In case of non-indication, it means as false. + // The value of true shall be had by only one video source mode + uint32 Reboot : 1; // required, After setting the mode if a device starts to reboot this value is true. If a device change the mode without rebooting this value is false. + // If true, configured parameters may not be guaranteed by the device after rebooting + uint32 Reserved : 29; + + float MaxFramerate; // required, Max frame rate in frames per second for this video source mode + + char Encodings[32]; // required, Indication which encodings are supported for this video source. + char Description[128]; // optional, Informative description of this video source mode. This field should be described in English + char token[ONVIF_TOKEN_LEN]; // required, Indicate token for video source mode + + onvif_VideoResolution MaxResolution; // required, Max horizontal and vertical resolution for this video source mode +} onvif_VideoSourceMode; + +typedef struct +{ + uint32 DegreeFlag : 1; // Indicates whether the field Degree is valid + uint32 Reserved : 31; + + onvif_RotateMode Mode; // required, Parameter to enable/disable Rotation feature + + int Degree; // optional, Optional parameter to configure how much degree of clockwise rotation of image for On mode. Omitting this parameter for On mode means 180 degree rotation +} onvif_Rotate; + +typedef struct +{ + uint32 RotateFlag : 1; // Indicates whether the field Rotate is valid + uint32 Reserved : 31; + + onvif_Rotate Rotate; // optional, Optional element to configure rotation of captured image +} onvif_VideoSourceConfigurationExtension; + +typedef struct +{ + uint32 ExtensionFlag : 1; // Indicates whether the field Extension is valid + uint32 Reserved : 31; + + char Name[ONVIF_NAME_LEN]; // required, User readable name. Length up to 64 characters + int UseCount; // required, Number of internal references currently using this configuration. This parameter is read-only and cannot be changed by a set request + char token[ONVIF_TOKEN_LEN]; // required, Token that uniquely refernces this configuration. Length up to 64 characters + char SourceToken[ONVIF_TOKEN_LEN]; // required, Reference to the physical input + + onvif_IntRectangle Bounds; // required, Rectangle specifying the Video capturing area. The capturing area shall not be larger than the whole Video source area + onvif_VideoSourceConfigurationExtension Extension; // optional +} onvif_VideoSourceConfiguration; + + +typedef struct +{ + onvif_IntRange XRange; // required + onvif_IntRange YRange; // required + onvif_IntRange WidthRange; // required + onvif_IntRange HeightRange; // required +} onvif_IntRectangleRange; + +typedef struct +{ + uint32 RotateMode_OFF : 1; // Indicates whether the mode RotateMode_OFF is valid + uint32 RotateMode_ON : 1; // Indicates whether the mode RotateMode_ON is valid + uint32 RotateMode_AUTO : 1; // Indicates whether the mode RotateMode_AUTO is valid + uint32 Reboot : 1; // Signals if a device requires a reboot after changing the rotation. + // If a device can handle rotation changes without rebooting this value shall be set to false. + uint32 Reserved : 28; + + uint32 sizeDegreeList; + int DegreeList[10]; // optional, List of supported degree value for rotation +} onvif_RotateOptions; + +typedef struct +{ + uint32 RotateFlag : 1; // Indicates whether the field Rotate is valid + uint32 Reserved : 31; + + onvif_RotateOptions Rotate; // optional, Options of parameters for Rotation feature +} onvif_VideoSourceConfigurationOptionsExtension; + +typedef struct +{ + uint32 ExtensionFlag : 1; // Indicates whether the field Extension is valid + uint32 MaximumNumberOfProfilesFlag : 1; // Indicates whether the field MaximumNumberOfProfiles is valid + uint32 Reserved : 30; + + onvif_IntRectangleRange BoundsRange; // required + + uint32 sizeVideoSourceTokensAvailable; + char VideoSourceTokensAvailable[10][ONVIF_TOKEN_LEN]; // required + + onvif_VideoSourceConfigurationOptionsExtension Extension; // optional + + int MaximumNumberOfProfiles; // optional, Maximum number of profiles +} onvif_VideoSourceConfigurationOptions; + +typedef struct +{ + uint32 ConstantBitRateFlag : 1; // Indicates whether the field ConstantBitRate is valid + uint32 Reserved : 31; + + int FrameRateLimit; // required, Maximum output framerate in fps. If an EncodingInterval is provided the resulting encoded framerate will be reduced by the given factor + int EncodingInterval; // required, Interval at which images are encoded and transmitted. (A value of 1 means that every frame is encoded, a value of 2 means that every 2nd frame is encoded ...) + int BitrateLimit; // required, the maximum output bitrate in kbps + BOOL ConstantBitRate; // optional, Enforce constant bitrate +} onvif_VideoRateControl; + +typedef struct +{ + int GovLength; // required, Determines the interval in which the I-Frames will be coded. An entry of 1 indicates I-Frames are continuously generated. + // An entry of 2 indicates that every 2nd image is an I-Frame, and 3 only every 3rd frame, etc. The frames in between are coded as P or B Frames. + onvif_Mpeg4Profile Mpeg4Profile; // required, the Mpeg4 profile, either simple profile (SP) or advanced simple profile (ASP) +} onvif_Mpeg4Configuration; + +typedef struct +{ + int GovLength; // required, Group of Video frames length. Determines typically the interval in which the I-Frames will be coded. An entry of 1 indicates I-Frames are continuously generated. + // An entry of 2 indicates that every 2nd image is an I-Frame, and 3 only every 3rd frame, etc. The frames in between are coded as P or B Frames + onvif_H264Profile H264Profile; // required, the H.264 profile, either baseline, main, extended or high +} onvif_H264Configuration; + +typedef struct +{ + char IPv4Address[32]; // required, The multicast address + int Port; // required, The RTP mutlicast destination port. A device may support RTCP. In this case the port value shall be even to allow the corresponding RTCP stream to be mapped + // to the next higher (odd) destination port number as defined in the RTSP specification + int TTL; // required, In case of IPv6 the TTL value is assumed as the hop limit. Note that for IPV6 and administratively scoped IPv4 multicast the primary use for hop limit / TTL is + // to prevent packets from (endlessly) circulating and not limiting scope. In these cases the address contains the scope + BOOL AutoStart; // required, Read only property signalling that streaming is persistant. Use the methods StartMulticastStreaming and StopMulticastStreaming to switch its state +} onvif_MulticastConfiguration; + +typedef struct +{ + uint32 RateControlFlag : 1; // Indicates whether the field RateControl is valid + uint32 MPEG4Flag : 1; // Indicates whether the field MPEG4 is valid + uint32 H264Flag : 1; // Indicates whether the field H264 is valid + uint32 Reserved : 29; + + char Name[ONVIF_NAME_LEN]; // required, User readable name. Length up to 64 characters + int UseCount; // required, Number of internal references currently using this configuration. This parameter is read-only and cannot be changed by a set request + char token[ONVIF_TOKEN_LEN]; // required, Token that uniquely refernces this configuration. Length up to 64 characters + + onvif_VideoEncoding Encoding; // required, Used video codec, either Jpeg, H.264 or Mpeg4 + onvif_VideoResolution Resolution; // required, Configured video resolution + + int Quality; // required, Relative value for the video quantizers and the quality of the video. A high value within supported quality range means higher quality + + onvif_VideoRateControl RateControl; // optional, Optional element to configure rate control related parameters + onvif_Mpeg4Configuration MPEG4; // optional, Optional element to configure Mpeg4 related parameters + onvif_H264Configuration H264; // optional, Optional element to configure H.264 related parameters + + onvif_MulticastConfiguration Multicast; // required, Defines the multicast settings that could be used for video streaming + + int SessionTimeout; // required, The rtsp session timeout for the related video stream, unit is second +} onvif_VideoEncoderConfiguration; + +typedef struct +{ + char token[ONVIF_TOKEN_LEN]; // required + int Channels; // required, number of available audio channels. (1: mono, 2: stereo) +} onvif_AudioSource; + +typedef struct +{ + char Name[ONVIF_NAME_LEN]; // required, User readable name. Length up to 64 characters + int UseCount; // required, Number of internal references currently using this configuration. This parameter is read-only and cannot be changed by a set request + char token[ONVIF_TOKEN_LEN]; // required, Token that uniquely refernces this configuration. Length up to 64 characters + + char SourceToken[ONVIF_TOKEN_LEN]; // required, Token of the Audio Source the configuration applies to +} onvif_AudioSourceConfiguration; + + +typedef struct +{ + char Name[ONVIF_NAME_LEN]; // required, User readable name. Length up to 64 characters + int UseCount; // required, Number of internal references currently using this configuration. This parameter is read-only and cannot be changed by a set request + char token[ONVIF_TOKEN_LEN]; // required, Token that uniquely refernces this configuration. Length up to 64 characters + + onvif_AudioEncoding Encoding; // required, Audio codec used for encoding the audio input (either G.711, G.726 or AAC) + + int Bitrate; // required, The output bitrate in kbps + int SampleRate; // required, The output sample rate in kHz + + onvif_MulticastConfiguration Multicast; // required, Defines the multicast settings that could be used for video streaming + + int SessionTimeout; // required, The rtsp session timeout for the related audio stream, unit is second +} onvif_AudioEncoderConfiguration; + +typedef struct +{ + onvif_AudioEncoding Encoding; // required, The enoding used for audio data (either G.711, G.726 or AAC) + + onvif_IntList BitrateList; // required, List of supported bitrates in kbps for the specified Encoding + onvif_IntList SampleRateList; // required, List of supported Sample Rates in kHz for the specified Encoding +} onvif_AudioEncoderConfigurationOption; + +typedef struct +{ + uint32 sizeOptions; // required, valid Options numbers + onvif_AudioEncoderConfigurationOption Options[3]; // optional, list of supported AudioEncoderConfigurations +} onvif_AudioEncoderConfigurationOptions; + +typedef struct +{ + onvif_VideoResolution ResolutionsAvailable[MAX_RES_NUMS]; // required, List of supported image sizes + + onvif_IntRange FrameRateRange; // required, Supported frame rate in fps (frames per second) + onvif_IntRange EncodingIntervalRange; // required, Supported encoding interval range. The encoding interval corresponds to the number of frames devided by the encoded frames. An encoding interval value of "1" means that all frames are encoded +} onvif_JpegOptions; + +typedef struct +{ + uint32 Mpeg4Profile_SP : 1; // required, Indicates whether the SP profile is valid + uint32 Mpeg4Profile_ASP : 1; // required, Indicates whether the ASP profile is valid + uint32 Reserverd : 30; + + onvif_VideoResolution ResolutionsAvailable[MAX_RES_NUMS]; // required, List of supported image sizes + + onvif_IntRange GovLengthRange; // required, Supported group of Video frames length. This value typically corresponds to the I-Frame distance + onvif_IntRange FrameRateRange; // required, Supported frame rate in fps (frames per second) + onvif_IntRange EncodingIntervalRange; // required, Supported encoding interval range. The encoding interval corresponds to the number of frames devided by the encoded frames. An encoding interval value of "1" means that all frames are encoded +} onvif_Mpeg4Options; + +typedef struct +{ + uint32 H264Profile_Baseline : 1; // required, Indicates whether the Baseline profile is valid + uint32 H264Profile_Main : 1; // required, Indicates whether the Main profile is valid + uint32 H264Profile_Extended : 1; // required, Indicates whether the Extended profile is valid + uint32 H264Profile_High : 1; // required, Indicates whether the High profile is valid + uint32 Reserverd : 28; + + onvif_VideoResolution ResolutionsAvailable[MAX_RES_NUMS]; // required, List of supported image sizes + + onvif_IntRange GovLengthRange; // required, Supported group of Video frames length. This value typically corresponds to the I-Frame distance + onvif_IntRange FrameRateRange; // required, Supported frame rate in fps (frames per second) + onvif_IntRange EncodingIntervalRange; // required, Supported encoding interval range. The encoding interval corresponds to the number of frames devided by the encoded frames. An encoding interval value of "1" means that all frames are encoded +} onvif_H264Options; + +typedef struct +{ + onvif_JpegOptions JpegOptions; // required + onvif_IntRange BitrateRange; // required +} onvif_JpegOptions2; + +typedef struct +{ + onvif_Mpeg4Options Mpeg4Options; // required + onvif_IntRange BitrateRange; // required +} onvif_Mpeg4Options2; + +typedef struct +{ + onvif_H264Options H264Options; // required + onvif_IntRange BitrateRange; // required +} onvif_H264Options2; + +typedef struct +{ + uint32 JPEGFlag : 1; // Indicates whether the field JPEG is valid + uint32 MPEG4Flag : 1; // Indicates whether the field MPEG4 is valid + uint32 H264Flag : 1; // Indicates whether the field H264 is valid + uint32 Reserved : 29; + + onvif_JpegOptions2 JPEG; // optional + onvif_Mpeg4Options2 MPEG4; // optional + onvif_H264Options2 H264; // optional +} onvif_VideoEncoderOptionsExtension; + +typedef struct +{ + uint32 JPEGFlag : 1; // Indicates whether the field JPEG is valid + uint32 MPEG4Flag : 1; // Indicates whether the field MPEG4 is valid + uint32 H264Flag : 1; // Indicates whether the field H264 is valid + uint32 ExtensionFlag : 1; // Indicates whether the field Extension is valid + uint32 Reserved : 28; + + onvif_IntRange QualityRange; // required, Range of the quality values. A high value means higher quality + + onvif_JpegOptions JPEG; // optional, Optional JPEG encoder settings ranges + onvif_Mpeg4Options MPEG4; // optional, Optional MPEG-4 encoder settings ranges + onvif_H264Options H264; // optional, Optional H.264 encoder settings ranges + + onvif_VideoEncoderOptionsExtension Extension; // optional +} onvif_VideoEncoderConfigurationOptions; + +typedef struct +{ + BOOL Status; // required, True if the metadata stream shall contain the PTZ status (IDLE, MOVING or UNKNOWN) + BOOL Position; // required, True if the metadata stream shall contain the PTZ position +} onvif_PTZFilter; + +typedef struct +{ + char Dialect[1024]; // Dialect + char TopicExpression[256]; // TopicExpression +} onvif_EventSubscription; + +typedef struct +{ + uint32 PanTiltStatusSupported : 1; // required, True if the device is able to stream pan or tilt status information + uint32 ZoomStatusSupported : 1; // required, True if the device is able to stream zoom status inforamtion + uint32 PanTiltPositionSupported : 1; // optional, True if the device is able to stream the pan or tilt position + uint32 ZoomPositionSupported : 1; // optional, True if the device is able to stream zoom position information + uint32 Reserved : 28; +} onvif_PTZStatusFilterOptions; + +typedef struct +{ + uint32 sizeCompressionType; // sequence of elements + char CompressionType[4][32]; // optional, List of supported metadata compression type. Its options shall be chosen from tt:MetadataCompressionType +} onvif_MetadataConfigurationOptionsExtension; + +typedef struct +{ + uint32 GeoLocation : 1; // Optional, True if the device is able to stream the Geo Located positions of each target + uint32 ExtensionFlag : 1; // Indicates whether the field Extension is valid + uint32 Reserved : 30; + + onvif_PTZStatusFilterOptions PTZStatusFilterOptions;// required, This message contains the metadata configuration options. If a metadata configuration is specified, + // the options shall concern that particular configuration. If a media profile is specified, the options shall be compatible with that media profile. + // If no tokens are specified, the options shall be considered generic for the device + onvif_MetadataConfigurationOptionsExtension Extension; // Optional +} onvif_MetadataConfigurationOptions; + +typedef struct +{ + uint32 PosFlag : 1; // Indicates whether the field Pos is valid + uint32 Reserved : 31; + + onvif_OSDPosType Type; // required, For OSD position type + + onvif_Vector Pos; // Optional, when Type is Custom, this field is valid +} onvif_OSDPosConfiguration; + + +typedef struct +{ + uint32 ColorspaceFlag : 1; // Indicates whether the field Colorspace is valid + uint32 TransparentFlag : 1; // Indicates whether the field Transparent is valid + uint32 Reserved : 30; + + float X; // required, + float Y; // required, + float Z; // required, + + int Transparent; // Optional, The value range of "Transparent" could be defined by vendors only should follow this rule: the minimum value means non-transparent and the maximum value maens fully transparent + char Colorspace[256]; // Optional, support the following colorspace + // http://www.onvif.org/ver10/colorspace/YCbCr + // http://www.onvif.org/ver10/colorspace/CIELUV + // http://www.onvif.org/ver10/colorspace/CIELAB + // http://www.onvif.org/ver10/colorspace/HSV +} onvif_OSDColor; + +typedef struct +{ + uint32 DateFormatFlag : 1; // Indicates whether the field DateFormat is valid + uint32 TimeFormatFlag : 1; // Indicates whether the field TimeFormat is valid + uint32 FontSizeFlag : 1; // Indicates whether the field FontSize is valid + uint32 FontColorFlag : 1; // Indicates whether the field FontColor is valid + uint32 BackgroundColorFlag : 1; // Indicates whether the field BackgroundColor is valid + uint32 PlainTextFlag : 1; // Indicates whether the field PlainText is valid + uint32 Reserved : 26; + + onvif_OSDTextType Type; // required, + + char DateFormat[64]; // Optional, List of supported OSD date formats. This element shall be present when the value of Type field has Date or DateAndTime. The following DateFormat are defined: + /* + M/d/yyyy - e.g. 3/6/2013 + MM/dd/yyyy - e.g. 03/06/2013 + dd/MM/yyyy - e.g. 06/03/2013 + yyyy/MM/dd - e.g. 2013/03/06 + yyyy-MM-dd - e.g. 2013-06-03 + dddd, MMMM dd, yyyy - e.g. Wednesday, March 06, 2013 + MMMM dd, yyyy - e.g. March 06, 2013 + dd MMMM, yyyy - e.g. 06 March, 2013 + */ + char TimeFormat[64]; // Optional, List of supported OSD time formats. This element shall be present when the value of Type field has Time or DateAndTime. The following TimeFormat are defined: + /* + h:mm:ss tt - e.g. 2:14:21 PM + hh:mm:ss tt - e.g. 02:14:21 PM + H:mm:ss - e.g. 14:14:21 + HH:mm:ss - e.g. 14:14:21 + */ + + int FontSize; // Optional, Font size of the text in pt + + onvif_OSDColor FontColor; // Optional, Font color of the text + onvif_OSDColor BackgroundColor; // Optional, Background color of the text + + char PlainText[256]; // Optional, The content of text to be displayed +} onvif_OSDTextConfiguration; + +typedef struct +{ + char ImgPath[256]; // required, The URI of the image which to be displayed +} onvif_OSDImgConfiguration; + +typedef struct +{ + uint32 TextStringFlag : 1; // Indicates whether the field TextString is valid + uint32 ImageFlag : 1; // Indicates whether the field Image is valid + uint32 Reserved : 30; + + char token[ONVIF_TOKEN_LEN]; // required, OSD config token + char VideoSourceConfigurationToken[ONVIF_TOKEN_LEN]; // required, Reference to the video source configuration + + onvif_OSDType Type; // required, Type of OSD + + onvif_OSDPosConfiguration Position; // required, Position configuration of OSD + onvif_OSDTextConfiguration TextString; // Optional, Text configuration of OSD. It shall be present when the value of Type field is Text + onvif_OSDImgConfiguration Image; // Optional, Image configuration of OSD. It shall be present when the value of Type field is Image +} onvif_OSDConfiguration; + +typedef struct +{ + uint32 ImageFlag : 1; // Indicates whether the field Image is valid + uint32 PlainTextFlag : 1; // Indicates whether the field PlainText is valid + uint32 DateFlag : 1; // Indicates whether the field Date is valid + uint32 TimeFlag : 1; // Indicates whether the field Time is valid + uint32 DateAndTimeFlag : 1; // Indicates whether the field DateAndTime is valid + uint32 Reserved : 27; + + int Total; // required + int Image; // optional + int PlainText; // optional + int Date; // optional + int Time; // optional + int DateAndTime; // optional +} onvif_MaximumNumberOfOSDs; + +typedef struct +{ + uint32 ColorspaceFlag : 1; // Indicates whether the field Colorspace is valid + uint32 LikelihoodFlag : 1; // Indicates whether the field Likelihood is valid + uint32 Reserved : 30; + + float X; // required, + float Y; // required, + float Z; // required, + + char Colorspace[128]; // optional, The following values are acceptable for Colourspace attribute + // http://www.onvif.org/ver10/colorspace/YCbCr - YCbCr + // http://www.onvif.org/ver10/colorspace/RGB - RGB + float Likelihood; // optional, Likelihood that the color is correct +} onvif_Color; + +typedef struct +{ + onvif_FloatRange X; // required + onvif_FloatRange Y; // required + onvif_FloatRange Z; // required + + char Colorspace[128]; // required, The following values are acceptable for Colourspace attribute + // http://www.onvif.org/ver10/colorspace/YCbCr + // http://www.onvif.org/ver10/colorspace/CIELUV + // http://www.onvif.org/ver10/colorspace/CIELAB + // http://www.onvif.org/ver10/colorspace/HSV +} onvif_ColorspaceRange; + +typedef struct +{ + uint32 sizeColorList; + onvif_Color ColorList[10]; // optional, List the supported color + + uint32 sizeColorspaceRange; + onvif_ColorspaceRange ColorspaceRange[10]; // optional, Define the rang of color supported +} onvif_ColorOptions; + +typedef struct +{ + uint32 ColorFlag : 1; // Indicates whether the field Color is valid + uint32 TransparentFlag : 1; // Indicates whether the field Transparent is valid + uint32 Reserved : 30; + + onvif_ColorOptions Color; // optional, Optional list of supported colors + onvif_IntRange Transparent; // optional, Range of the transparent level. Larger means more tranparent +} onvif_OSDColorOptions; + +typedef struct +{ + uint32 OSDTextType_Plain : 1; // Indicates whether support OSD text type plain + uint32 OSDTextType_Date : 1; // Indicates whether support OSD text type date + uint32 OSDTextType_Time : 1; // Indicates whether support OSD text type time + uint32 OSDTextType_DateAndTime : 1; // Indicates whether support OSD text type dateandtime + uint32 FontSizeRangeFlag : 1; // Indicates whether the field FontSizeRange is valid + uint32 FontColorFlag : 1; // Indicates whether the field FontColor is valid + uint32 BackgroundColorFlag : 1; // Indicates whether the field BackgroundColor is valid + uint32 Reserved : 25; + + onvif_IntRange FontSizeRange; // optional, range of the font size value + + uint32 DateFormatSize; + char DateFormat[10][64]; // optional, List of supported date format + + uint32 TimeFormatSize; + char TimeFormat[10][64]; // optional, List of supported time format + + onvif_OSDColorOptions FontColor; // optional, List of supported font color + onvif_OSDColorOptions BackgroundColor; // optional, List of supported background color +} onvif_OSDTextOptions; + +typedef struct +{ + uint32 ImagePathSize; + char ImagePath[10][256]; // required, List of avaiable uris of image +} onvif_OSDImgOptions; + +typedef struct +{ + uint32 OSDType_Text : 1; // Indicates whether support OSD text type + uint32 OSDType_Image : 1; // Indicates whether support OSD image type + uint32 OSDType_Extended : 1; // Indicates whether support OSD extended type + uint32 OSDPosType_UpperLeft : 1; // Indicates whether support OSD position UpperLeft type + uint32 OSDPosType_UpperRight : 1; // Indicates whether support OSD position UpperRight type + uint32 OSDPosType_LowerLeft : 1; // Indicates whether support OSD position LowerLeft type + uint32 OSDPosType_LowerRight : 1; // Indicates whether support OSD position LowerRight type + uint32 OSDPosType_Custom : 1; // Indicates whether support OSD position Custom type + uint32 TextOptionFlag : 1; // Indicates whether the field TextOption is valid + uint32 ImageOptionFlag : 1; // Indicates whether the field ImageOption is valid + uint32 Reserved : 22; + + onvif_MaximumNumberOfOSDs MaximumNumberOfOSDs; // required, The maximum number of OSD configurations supported for the specificate video source configuration. + // If a device limits the number of instances by OSDType, it should indicate the supported number via the related attribute + onvif_OSDTextOptions TextOption; // optional, Option of the OSD text configuration. This element shall be returned if the device is signaling the support for Text + onvif_OSDImgOptions ImageOption; // optional, Option of the OSD image configuration. This element shall be returned if the device is signaling the support for Image +} onvif_OSDConfigurationOptions; + +typedef struct +{ + uint32 spaceFlag : 1; // Indicates whether the field space is valid + uint32 reserved : 31; + + float x; // required + char space[256]; // optional +} onvif_Vector1D; + +typedef struct +{ + uint32 PanTiltFlag : 1; // Indicates whether the field PanTilt is valid + uint32 ZoomFlag : 1; // Indicates whether the field Zoom is valid + uint32 Reserved : 30; + + onvif_Vector PanTilt; // optional, Pan and tilt position. The x component corresponds to pan and the y component to tilt + onvif_Vector1D Zoom; // optional, A zoom position +} onvif_PTZVector; + +typedef struct +{ + uint32 PanTiltFlag : 1; // Indicates whether the field PanTilt is valid + uint32 ZoomFlag : 1; // Indicates whether the field Zoom is valid + uint32 Reserved : 30; + + onvif_Vector PanTilt; // optional, Pan and tilt speed. The x component corresponds to pan and the y component to tilt. If omitted in a request, the current (if any) PanTilt movement should not be affected + onvif_Vector1D Zoom; // optional, A zoom speed. If omitted in a request, the current (if any) Zoom movement should not be affected +} onvif_PTZSpeed; + +typedef struct +{ + uint32 PTZPositionFlag : 1; // Indicates whether the field PTZPosition is valid + uint32 Reserved : 31; + + char Name[ONVIF_NAME_LEN]; // required, A list of preset position name + char token[ONVIF_TOKEN_LEN]; // required + + onvif_PTZVector PTZPosition; // optional, A list of preset position +} onvif_PTZPreset; + +typedef struct +{ + onvif_FloatRange XRange; // required + onvif_FloatRange YRange; // required +} onvif_PanTiltLimits; + +typedef struct +{ + onvif_FloatRange XRange; // required +} onvif_ZoomLimits; + +typedef struct onvif_PTControlDirection +{ + uint32 EFlipFlag : 1; // Indicates whether the field EFlip is valid + uint32 ReverseFlag : 1; // Indicates whether the field Reverse is valid + uint32 Reserved : 30; + + onvif_EFlipMode EFlip; // optional, Optional element to configure related parameters for E-Flip + onvif_ReverseMode Reverse; // optional, Optional element to configure related parameters for reversing of PT Control Direction +} onvif_PTControlDirection; + +typedef struct +{ + uint32 PTControlDirectionFlag : 1; // Indicates whether the field PTControlDirection is valid + uint32 Reserved : 31; + + onvif_PTControlDirection PTControlDirection; // optional, Optional element to configure PT Control Direction related features +} onvif_PTZConfigurationExtension; + +typedef struct +{ + uint32 DefaultPTZSpeedFlag : 1; // Indicates whether the field DefaultPTZSpeed is valid + uint32 DefaultPTZTimeoutFlag : 1; // Indicates whether the field DefaultPTZTimeout is valid + uint32 PanTiltLimitsFlag : 1; // Indicates whether the field PanTiltLimits is valid + uint32 ZoomLimitsFlag : 1; // Indicates whether the field ZoomLimits is valid + uint32 ExtensionFlag : 1; // Indicates whether the field Extension is valid + uint32 MoveRampFlag : 1; // Indicates whether the field MoveRamp is valid + uint32 PresetRampFlag : 1; // Indicates whether the field PresetRamp is valid + uint32 PresetTourRampFlag : 1; // Indicates whether the field PresetTourRamp is valid + uint32 Reserved : 24; + + char Name[ONVIF_NAME_LEN]; // required + int UseCount; // required + char token[ONVIF_TOKEN_LEN]; // required + char NodeToken[ONVIF_TOKEN_LEN]; // required, A mandatory reference to the PTZ Node that the PTZ Configuration belongs to + + onvif_PTZSpeed DefaultPTZSpeed; // optional, If the PTZ Node supports absolute or relative PTZ movements, it shall specify corresponding default Pan/Tilt and Zoom speeds + int DefaultPTZTimeout; // optional, If the PTZ Node supports continuous movements, it shall specify a default timeout, after which the movement stops + onvif_PanTiltLimits PanTiltLimits; // optional, The Pan/Tilt limits element should be present for a PTZ Node that supports an absolute Pan/Tilt. If the element is present it signals the support for configurable Pan/Tilt limits. + // If limits are enabled, the Pan/Tilt movements shall always stay within the specified range. The Pan/Tilt limits are disabled by setting the limits to -INF or +INF + onvif_ZoomLimits ZoomLimits; // optional, The Zoom limits element should be present for a PTZ Node that supports absolute zoom. If the element is present it signals the supports for configurable Zoom limits. + // If limits are enabled the zoom movements shall always stay within the specified range. The Zoom limits are disabled by settings the limits to -INF and +INF + + onvif_PTZConfigurationExtension Extension; // optional + + int MoveRamp; // optional, The optional acceleration ramp used by the device when moving + int PresetRamp; // optional, The optional acceleration ramp used by the device when recalling presets + int PresetTourRamp; // optional, The optional acceleration ramp used by the device when executing PresetTours +} onvif_PTZConfiguration; + +typedef struct +{ + // Indicates which preset tour operations are available for this PTZ Node + + uint32 PTZPresetTourOperation_Start : 1; + uint32 PTZPresetTourOperation_Stop : 1; + uint32 PTZPresetTourOperation_Pause : 1; + uint32 PTZPresetTourOperation_Extended : 1; + uint32 Reserved : 28; + + int MaximumNumberOfPresetTours; // required, Indicates number of preset tours that can be created. Required preset tour operations shall be available for this PTZ Node if one or more preset tour is supported +} onvif_PTZPresetTourSupported; + +typedef struct +{ + uint32 SupportedPresetTourFlag : 1; // Indicates whether the field SupportedPresetTour is valid + uint32 Reserved : 31; + + onvif_PTZPresetTourSupported SupportedPresetTour;// optional, Detail of supported Preset Tour feature +} onvif_PTZNodeExtension; + +typedef struct +{ + char URI[256]; // required, A URI of coordinate systems. + + onvif_FloatRange XRange; // required, A range of x-axis + onvif_FloatRange YRange; // required, A range of y-axis +} onvif_Space2DDescription; + +typedef struct +{ + char URI[256]; // required, A URI of coordinate systems + + onvif_FloatRange XRange; // required, A range of x-axis +} onvif_Space1DDescription; + +typedef struct +{ + uint32 AbsolutePanTiltPositionSpaceFlag : 1; // Indicates whether the field AbsolutePanTiltPositionSpace is valid + uint32 AbsoluteZoomPositionSpaceFlag : 1; // Indicates whether the field AbsoluteZoomPositionSpace is valid + uint32 RelativePanTiltTranslationSpaceFlag : 1; // Indicates whether the field RelativePanTiltTranslationSpace is valid + uint32 RelativeZoomTranslationSpaceFlag : 1; // Indicates whether the field RelativeZoomTranslationSpace is valid + uint32 ContinuousPanTiltVelocitySpaceFlag : 1; // Indicates whether the field ContinuousPanTiltVelocitySpace is valid + uint32 ContinuousZoomVelocitySpaceFlag : 1; // Indicates whether the field ContinuousZoomVelocitySpace is valid + uint32 PanTiltSpeedSpaceFlag : 1; // Indicates whether the field PanTiltSpeedSpace is valid + uint32 ZoomSpeedSpaceFlag : 1; // Indicates whether the field ZoomSpeedSpace is valid + uint32 Reserved : 24; + + onvif_Space2DDescription AbsolutePanTiltPositionSpace; // optional, The Generic Pan/Tilt Position space is provided by every PTZ node that supports absolute Pan/Tilt, since it does not relate to a specific physical range. + // Instead, the range should be defined as the full range of the PTZ unit normalized to the range -1 to 1 resulting in the following space description + onvif_Space1DDescription AbsoluteZoomPositionSpace; // optional, The Generic Zoom Position Space is provided by every PTZ node that supports absolute Zoom, since it does not relate to a specific physical range. + // Instead, the range should be defined as the full range of the Zoom normalized to the range 0 (wide) to 1 (tele). + // There is no assumption about how the generic zoom range is mapped to magnification, FOV or other physical zoom dimension + onvif_Space2DDescription RelativePanTiltTranslationSpace;// optional, The Generic Pan/Tilt translation space is provided by every PTZ node that supports relative Pan/Tilt, since it does not relate to a specific physical range. + // Instead, the range should be defined as the full positive and negative translation range of the PTZ unit normalized to the range -1 to 1, + // where positive translation would mean clockwise rotation or movement in right/up direction resulting in the following space description + onvif_Space1DDescription RelativeZoomTranslationSpace; // optional, The Generic Zoom Translation Space is provided by every PTZ node that supports relative Zoom, since it does not relate to a specific physical range. + // Instead, the corresponding absolute range should be defined as the full positive and negative translation range of the Zoom normalized to the range -1 to1, + // where a positive translation maps to a movement in TELE direction. The translation is signed to indicate direction (negative is to wide, positive is to tele). + // There is no assumption about how the generic zoom range is mapped to magnification, FOV or other physical zoom dimension. This results in the following space description + onvif_Space2DDescription ContinuousPanTiltVelocitySpace; // optional, The generic Pan/Tilt velocity space shall be provided by every PTZ node, since it does not relate to a specific physical range. + // Instead, the range should be defined as a range of the PTZ unit's speed normalized to the range -1 to 1, where a positive velocity would map to clockwise + // rotation or movement in the right/up direction. A signed speed can be independently specified for the pan and tilt component resulting in the following space description + onvif_Space1DDescription ContinuousZoomVelocitySpace; // optional, The generic zoom velocity space specifies a zoom factor velocity without knowing the underlying physical model. The range should be normalized from -1 to 1, + // where a positive velocity would map to TELE direction. A generic zoom velocity space description resembles the following + onvif_Space1DDescription PanTiltSpeedSpace; // optional, The speed space specifies the speed for a Pan/Tilt movement when moving to an absolute position or to a relative translation. + // In contrast to the velocity spaces, speed spaces do not contain any directional information. The speed of a combined Pan/Tilt + // movement is represented by a single non-negative scalar value + onvif_Space1DDescription ZoomSpeedSpace; // optional, The speed space specifies the speed for a Zoom movement when moving to an absolute position or to a relative translation. + // In contrast to the velocity spaces, speed spaces do not contain any directional information +} onvif_PTZSpaces; + +typedef struct +{ + uint32 NameFlag : 1; // Indicates whether the field Name is valid + uint32 ExtensionFlag : 1; // Indicates whether the field Extension is valid + uint32 Reserved : 30; + + char token[ONVIF_TOKEN_LEN]; // required + char Name[ONVIF_NAME_LEN]; // optional, A unique identifier that is used to reference PTZ Nodes + + onvif_PTZSpaces SupportedPTZSpaces; // required, A list of Coordinate Systems available for the PTZ Node. For each Coordinate System, the PTZ Node MUST specify its allowed range + + int MaximumNumberOfPresets; // required, All preset operations MUST be available for this PTZ Node if one preset is supported + BOOL HomeSupported; // required, A boolean operator specifying the availability of a home position. If set to true, the Home Position Operations MUST be available for this PTZ Node + + onvif_PTZNodeExtension Extension; // optional + + BOOL FixedHomePosition; // optional, Indication whether the HomePosition of a Node is fixed or it can be changed via the SetHomePosition command + BOOL GeoMove; // optional, Indication whether the Node supports the geo-referenced move command + + uint32 sizeAuxiliaryCommands; // sequence of elements + char AuxiliaryCommands[10][64]; // optional +} onvif_PTZNode; + + +typedef struct +{ + // Supported options for EFlip feature + uint32 EFlipMode_OFF : 1; + uint32 EFlipMode_ON : 1; + uint32 EFlipMode_Extended : 1; + + // Supported options for Reverse feature + uint32 ReverseMode_OFF : 1; + uint32 ReverseMode_ON : 1; + uint32 ReverseMode_AUTO : 1; + uint32 ReverseMode_Extended : 1; + uint32 Reserved : 25; +} onvif_PTControlDirectionOptions; + +typedef struct +{ + uint32 PTControlDirectionFlag : 1; // Indicates whether the field PTControlDirection is valid + uint32 Reserved : 31; + + onvif_PTZSpaces Spaces; // required, + onvif_IntRange PTZTimeout; // required, A timeout Range within which Timeouts are accepted by the PTZ Node + onvif_PTControlDirectionOptions PTControlDirection; // optional, +} onvif_PTZConfigurationOptions; + +typedef struct +{ + uint32 PanTiltFlag : 1; // Indicates whether the field PanTilt is valid + uint32 ZoomFlag : 1; // Indicates whether the field Zoom is valid + uint32 Reserved : 30; + + onvif_MoveStatus PanTilt; // optional + onvif_MoveStatus Zoom; // optional +} onvif_PTZMoveStatus; + +typedef struct +{ + uint32 PositionFlag : 1; // Indicates whether the field Position is valid + uint32 MoveStatusFlag : 1; // Indicates whether the field MoveStatus is valid + uint32 ErrorFlag : 1; // Indicates whether the field MoveStatus is valid + uint32 Reserved : 29; + + onvif_PTZVector Position; // optional, Specifies the absolute position of the PTZ unit together with the Space references. The default absolute spaces of the corresponding PTZ configuration MUST be referenced within the Position element + onvif_PTZMoveStatus MoveStatus; // optional, Indicates if the Pan/Tilt/Zoom device unit is currently moving, idle or in an unknown state + + char Error[100]; // optional, States a current PTZ error + time_t UtcTime; // required, Specifies the UTC time when this status was generated +} onvif_PTZStatus; + + +typedef struct +{ + uint32 PresetTokenFlag : 1; // Indicates whether the field PresetToken is valid + uint32 HomeFlag : 1; // Indicates whether the field Home is valid + uint32 PTZPositionFlag : 1; // Indicates whether the field PTZPosition is valid + uint32 Reserved : 29; + + char PresetToken[ONVIF_TOKEN_LEN]; // optional, Option to specify the preset position with Preset Token defined in advance + BOOL Home; // optional, Option to specify the preset position with the home position of this PTZ Node. "False" to this parameter shall be treated as an invalid argument + + onvif_PTZVector PTZPosition; // optional, Option to specify the preset position with vector of PTZ node directly +} onvif_PTZPresetTourPresetDetail; + +typedef struct +{ + uint32 SpeedFlag : 1; // Indicates whether the field Speed is valid + uint32 StayTimeFlag : 1; // Indicates whether the field StayTime is valid + uint32 Reserved : 30; + + onvif_PTZPresetTourPresetDetail PresetDetail; // required, Detail definition of preset position of the tour spot + onvif_PTZSpeed Speed; // optional, Optional parameter to specify Pan/Tilt and Zoom speed on moving toward this tour spot + + int StayTime; // optional, Optional parameter to specify time duration of staying on this tour sport +} onvif_PTZPresetTourSpot; + +typedef struct _PTZPresetTourSpotList +{ + struct _PTZPresetTourSpotList * next; + + onvif_PTZPresetTourSpot PTZPresetTourSpot; +} PTZPresetTourSpotList; + +typedef struct +{ + uint32 CurrentTourSpotFlag : 1; // Indicates whether the field CurrentTourSpot is valid + uint32 Reserved : 31; + + onvif_PTZPresetTourState State; // required, Indicates state of this preset tour by Idle/Touring/Paused + onvif_PTZPresetTourSpot CurrentTourSpot; // optional, Indicates a tour spot currently staying +} onvif_PTZPresetTourStatus; + +typedef struct +{ + uint32 RecurringTimeFlag : 1; // Indicates whether the field RecurringTime is valid + uint32 RecurringDurationFlag : 1; // Indicates whether the field RecurringDuration is valid + uint32 DirectionFlag : 1; // Indicates whether the field Direction is valid + uint32 RandomPresetOrderFlag : 1; // Indicates whether the field RandomPresetOrder is valid + uint32 Reserved : 28; + + int RecurringTime; // optional, Optional parameter to specify how many times the preset tour is recurred + int RecurringDuration; // optional, Optional parameter to specify how long time duration the preset tour is recurred + + onvif_PTZPresetTourDirection Direction; // optional, Optional parameter to choose which direction the preset tour goes. Forward shall be chosen in case it is omitted + + BOOL RandomPresetOrder; // optional, Execute presets in random order. If set to true and Direction is also present, Direction will be ignored and presets of the Tour will be recalled randomly +} onvif_PTZPresetTourStartingCondition; + +typedef struct +{ + char Name[ONVIF_NAME_LEN]; // optional, Readable name of the preset tour + char token[ONVIF_TOKEN_LEN]; // required, Unique identifier of this preset tour + + BOOL AutoStart; // required, Auto Start flag of the preset tour. True allows the preset tour to be activated always + + onvif_PTZPresetTourStatus Status; // required, Read only parameters to indicate the status of the preset tour + + onvif_PTZPresetTourStartingCondition StartingCondition; // required, Parameters to specify the detail behavior of the preset tour + + PTZPresetTourSpotList * TourSpot; // optional, A list of detail of touring spots including preset positions + +} onvif_PresetTour; + +typedef struct +{ + int Min; // required, unit is second + int Max; // required, unit is second +} onvif_DurationRange; + +typedef struct +{ + uint32 RecurringTimeFlag : 1; // Indicates whether the field RecurringTime is valid + uint32 RecurringDurationFlag : 1; // Indicates whether the field RecurringDuration is valid + uint32 PTZPresetTourDirection_Forward : 1; // + uint32 PTZPresetTourDirection_Backward : 1; // + uint32 PTZPresetTourDirection_Extended : 1; // + uint32 Reserved : 27; + + onvif_IntRange RecurringTime; // optional, Supported range of Recurring Time + onvif_DurationRange RecurringDuration; // optional, Supported range of Recurring Duration +} onvif_PTZPresetTourStartingConditionOptions; + +typedef struct +{ + uint32 HomeFlag : 1; // Indicates whether the field Home is valid + uint32 PanTiltPositionSpaceFlag : 1; // Indicates whether the field PanTiltPositionSpace is valid + uint32 ZoomPositionSpaceFlag : 1; // Indicates whether the field ZoomPositionSpace is valid + uint32 Reserved : 29; + + uint32 sizePresetToken; + char PresetToken[MAX_PTZ_PRESETS][ONVIF_TOKEN_LEN]; // optional, A list of available Preset Tokens for tour spots + + BOOL Home; // optional, An option to indicate Home postion for tour spots + + onvif_Space2DDescription PanTiltPositionSpace; // optional, Supported range of Pan and Tilt for tour spots + onvif_Space1DDescription ZoomPositionSpace; // optional, Supported range of Zoom for a tour spot +} onvif_PTZPresetTourPresetDetailOptions; + +typedef struct +{ + onvif_PTZPresetTourPresetDetailOptions PresetDetail; // required, Supported options for detail definition of preset position of the tour spot + onvif_DurationRange StayTime; // required, Supported range of stay time for a tour spot +} onvif_PTZPresetTourSpotOptions; + +typedef struct +{ + BOOL AutoStart; // required, Indicates whether or not the AutoStart is supported + + onvif_PTZPresetTourStartingConditionOptions StartingCondition; // required, Supported options for Preset Tour Starting Condition + onvif_PTZPresetTourSpotOptions TourSpot; // required, Supported options for Preset Tour Spot +} onvif_PTZPresetTourOptions; + + +typedef struct +{ + uint32 NameFlag : 1; // Indicates whether the field Name is valid + uint32 MTUFlag : 1; // Indicates whether the field MTU is valid + uint32 Reserved : 30; + + char Name[ONVIF_NAME_LEN]; // optional, Network interface name, for example eth0 + char HwAddress[32]; // required, Network interface MAC address + int MTU; // optional, Maximum transmission unit +} onvif_NetworkInterfaceInfo; + +typedef struct +{ + char Address[32]; // required + int PrefixLength; // required + + BOOL DHCP; // required, Indicates whether or not DHCP is used +} onvif_IPv4Configuration; + +typedef struct +{ + BOOL Enabled; // required, Indicates whether or not IPv4 is enabled + + onvif_IPv4Configuration Config; // required, IPv4 configuration +} onvif_IPv4NetworkInterface; + +typedef struct +{ + uint32 KeyFlag : 1; // Indicates whether the field Key is valid + uint32 PassphraseFlag : 1; // Indicates whether the field Passphrase is valid + uint32 Reserved : 30; + + char Key[256]; // optional, hexBinary, + // According to IEEE802.11-2007 H.4.1 the RSNA PSK consists of 256 bits, + // or 64 octets when represented in hex + // Either Key or Passphrase shall be given, + // if both are supplied Key shall be used by the device and Passphrase ignored. + char Passphrase[128]; // optional, + // According to IEEE802.11-2007 H.4.1 a pass-phrase is + // a sequence of between 8 and 63 ASCII-encoded characters and + // each character in the pass-phrase must have an encoding in the range of 32 to 126 (decimal),inclusive. + // If only Passpharse is supplied the Key shall be derived using the algorithm described in + // IEEE802.11-2007 section H.4 +} onvif_Dot11PSKSet; + +typedef struct +{ + uint32 AlgorithmFlag : 1; // Indicates whether the field Algorithm is valid + uint32 PSKFlag : 1; // Indicates whether the field PSK is valid + uint32 Dot1XFlag : 1; // // Indicates whether the field Dot1X is valid + uint32 Reserved : 29; + + onvif_Dot11SecurityMode Mode; // required + onvif_Dot11Cipher Algorithm; // optional + onvif_Dot11PSKSet PSK; // optional + + char Dot1X[ONVIF_TOKEN_LEN]; // optional +} onvif_Dot11SecurityConfiguration; + +typedef struct +{ + char SSID[32]; // required, hexBinary + + onvif_Dot11StationMode Mode; // required + + char Alias[32]; // required + int Priority; // required, range is 0-31 + + onvif_Dot11SecurityConfiguration Security; // required element of type ns2:Dot11SecurityConfiguration */ +} onvif_Dot11Configuration; + +typedef struct +{ + int InterfaceType; // required, tt:IANA-IfTypes, Integer indicating interface type, for example: 6 is ethernet + // ieee80211(71) + // For valid numbers, please refer to http://www.iana.org/assignments/ianaiftype-mib + uint32 sizeDot11; // sequence of elements + onvif_Dot11Configuration Dot11[4]; // optional +} onvif_NetworkInterfaceExtension; + +typedef struct +{ + uint32 InfoFlag : 1; // Indicates whether the field Info is valid + uint32 IPv4Flag : 1; // Indicates whether the field IPv4 is valid + uint32 ExtensionFlag : 1; // Indicates whether the field Extension is valid + uint32 Reserved : 29; + + char token[ONVIF_TOKEN_LEN]; // required + BOOL Enabled; // required, Indicates whether or not an interface is enabled + + onvif_NetworkInterfaceInfo Info; // optional, Network interface information + onvif_IPv4NetworkInterface IPv4; // optional, IPv4 network interface configuration + onvif_NetworkInterfaceExtension Extension; // optional, +} onvif_NetworkInterface; + +typedef struct +{ + BOOL HTTPFlag; // Indicates if the http protocol required + BOOL HTTPEnabled; // Indicates if the http protocol is enabled or not + BOOL HTTPSFlag; // Indicates if the https protocol required + BOOL HTTPSEnabled; // Indicates if the https protocol is enabled or not + BOOL RTSPFlag; // Indicates if the rtsp protocol required + BOOL RTSPEnabled; // Indicates if the rtsp protocol is enabled or not + + int HTTPPort[MAX_SERVER_PORT]; // The port that is used by the protocol + int HTTPSPort[MAX_SERVER_PORT]; // The port that is used by the protocol + int RTSPPort[MAX_SERVER_PORT]; // The port that is used by the protocol +} onvif_NetworkProtocol; + +typedef struct +{ + uint32 SearchDomainFlag : 1; // Indicates whether the field SearchDomain is valid + uint32 Reserved : 31; + + BOOL FromDHCP; // required, Indicates whether or not DNS information is retrieved from DHCP + char SearchDomain[MAX_SEARCHDOMAIN][64]; // optional, Search domain + char DNSServer[MAX_DNS_SERVER][32]; // required +} onvif_DNSInformation; + +typedef struct +{ + uint32 NameFlag : 1; // Indicates whether the field Name is valid + uint32 TTLFlag : 1; // Indicates whether the field TTL is valid + uint32 Reserved : 30; + + onvif_DynamicDNSType Type; // required, Dynamic DNS type + + char Name[ONVIF_NAME_LEN]; // optional, DNS name + int TTL; // optional, DNS record time to live +} onvif_DynamicDNSInformation; + +typedef struct +{ + BOOL FromDHCP; // required, Indicates if NTP information is to be retrieved by using DHCP + char NTPServer[MAX_NTP_SERVER][32]; // required +} onvif_NTPInformation; + +typedef struct +{ + uint32 NameFlag : 1; // Indicates whether the field Name is valid + uint32 Reserved : 31; + + BOOL FromDHCP; // required, Indicates whether the hostname is obtained from DHCP or not + BOOL RebootNeeded; // required, Indicates whether or not a reboot is required after configuration updates + char Name[ONVIF_NAME_LEN]; // optional, Indicates the hostname +} onvif_HostnameInformation; + +typedef struct +{ + char IPv4Address[MAX_GATEWAY][32]; // required, IPv4 address string +} onvif_NetworkGateway; + +typedef struct +{ + char InterfaceToken[ONVIF_TOKEN_LEN]; // required, Unique identifier of network interface + BOOL Enabled; // required, Indicates whether the zero-configuration is enabled or not + uint32 sizeAddresses; // sequence of elements + char Addresses[4][32]; // optional, The zero-configuration IPv4 address(es) +} onvif_NetworkZeroConfiguration; + +typedef struct +{ + char Uri[ONVIF_URI_LEN]; // required + BOOL InvalidAfterConnect; // required + BOOL InvalidAfterReboot; // required + int Timeout; // required, unit is second +} onvif_MediaUri; + +typedef struct +{ + uint32 BSSIDFlag : 1; + uint32 PairCipherFlag : 1; + uint32 GroupCipherFlag : 1; + uint32 SignalStrengthFlag : 1; + uint32 Reserved : 28; + + char SSID[32]; // required, hexBinary + char BSSID[64]; // optional + + onvif_Dot11Cipher PairCipher; // optional + onvif_Dot11Cipher GroupCipher; // optional + onvif_Dot11SignalStrength SignalStrength; // optional + + char ActiveConfigAlias[32]; // required +} onvif_Dot11Status; + +typedef struct +{ + uint32 BSSIDFlag : 1; + uint32 SignalStrengthFlag : 1; + uint32 Reserved : 30; + + char SSID[32]; // required, hexBinary + char BSSID[64]; // optional + + uint32 sizeAuthAndMangementSuite; // sequence of elements + onvif_Dot11AuthAndMangementSuite AuthAndMangementSuite[4]; // optional + + uint32 sizePairCipher; // sequence of elements + onvif_Dot11Cipher PairCipher[4]; // optional + + uint32 sizeGroupCipher; // sequence of elements + onvif_Dot11Cipher GroupCipher[4]; // optional + + onvif_Dot11SignalStrength SignalStrength; // optional +} onvif_Dot11AvailableNetworks; + +typedef struct _Dot11AvailableNetworksList +{ + struct _Dot11AvailableNetworksList * next; + + onvif_Dot11AvailableNetworks Networks; +} Dot11AvailableNetworksList; + +typedef struct +{ + char TZ[128]; // required, Posix timezone string +} onvif_TimeZone; + +typedef struct +{ + int Hour; // Range is 0 to 23 + int Minute; // Range is 0 to 59 + int Second; // Range is 0 to 61 (typically 59) +} onvif_Time; + +typedef struct +{ + int Year; // + int Month; // Range is 1 to 12 + int Day; // Range is 1 to 31 +} onvif_Date; + +typedef struct +{ + onvif_Time Time; // required + onvif_Date Date; // required +} onvif_DateTime; + +typedef struct +{ + uint32 TimeZoneFlag : 1; // Indicates whether the field TimeZone is valid + uint32 Reserved : 31; + + BOOL DaylightSavings; // required, Informative indicator whether daylight savings is currently on/off + + onvif_SetDateTimeType DateTimeType; // required, Indicates if the time is set manully or through NTP + onvif_TimeZone TimeZone; // optional, Timezone information in Posix format +} onvif_SystemDateTime; + +typedef struct +{ + onvif_ScopeDefinition ScopeDef; // required + + char ScopeItem[128]; // required +} onvif_Scope; + +typedef struct +{ + uint32 lonFlag : 1; // Indicates whether the field lon is valid + uint32 latFlag : 1; // Indicates whether the field lat is valid + uint32 elevationFlag : 1; // Indicates whether the field elevation is valid + uint32 Reserved : 29; + + double lon; // optional, East west location as angle + double lat; // optional, North south location as angle + float elevation; // optional, Hight in meters above sea level +} onvif_GeoLocation; + +typedef struct +{ + uint32 rollFlag : 1; // Indicates whether the field roll is valid + uint32 pitchFlag : 1; // Indicates whether the field pitch is valid + uint32 yawFlag : 1; // Indicates whether the field yaw is valid + uint32 Reserved : 29; + + float roll; // optional, Rotation around the x axis + float pitch; // optional, Rotation around the y axis + float yaw; // optional, Rotation around the z axis +} onvif_GeoOrientation; + +typedef struct +{ + uint32 xFlag : 1; // Indicates whether the field x is valid + uint32 yFlag : 1; // Indicates whether the field y is valid + uint32 zFlag : 1; // Indicates whether the field z is valid + uint32 Reserved : 29; + + float x; // optional, East west location as angle + float y; // optional, North south location as angle + float z; // optional, Offset in meters from the sea level +} onvif_LocalLocation; + +typedef struct +{ + uint32 panFlag : 1; // Indicates whether the field pan is valid + uint32 tiltFlag : 1; // Indicates whether the field tilt is valid + uint32 rollFlag : 1; // Indicates whether the field roll is valid + uint32 Reserved : 29; + + float pan; // optional, Rotation around the y axis + float tilt; // optional, Rotation around the z axis + float roll; // optional, Rotation around the x axis +} onvif_LocalOrientation; + +typedef struct +{ + uint32 GeoLocationFlag : 1; // Indicates whether the field GeoLocation is valid + uint32 GeoOrientationFlag : 1; // Indicates whether the field GeoOrientation is valid + uint32 LocalLocationFlag : 1; // Indicates whether the field LocalLocation is valid + uint32 LocalOrientationFlag : 1; // Indicates whether the field LocalOrientation is valid + uint32 EntityFlag : 1; // Indicates whether the field Entity is valid + uint32 TokenFlag : 1; // Indicates whether the field Token is valid + uint32 FixedFlag : 1; // Indicates whether the field Fixed is valid + uint32 GeoSourceFlag : 1; // Indicates whether the field GeoSource is valid + uint32 AutoGeoFlag : 1; // Indicates whether the field AutoGeo is valid + uint32 Reserved : 23; + + onvif_GeoLocation GeoLocation; // optional, Location on earth + onvif_GeoOrientation GeoOrientation; // optional, Orientation relative to earth + onvif_LocalLocation LocalLocation; // optional, Indoor location offset + onvif_LocalOrientation LocalOrientation; // optional, Indoor orientation offset + + char Entity[200]; // optional, Entity type the entry refers to as defined in tds:Entity + char Token[ONVIF_TOKEN_LEN]; // optional, Optional entity token + BOOL Fixed; // optional, If this value is true the entity cannot be deleted + char GeoSource[256]; // optional, Optional reference to the XAddr of another devices DeviceManagement service + BOOL AutoGeo; // optional, If set the geo location is obtained internally +} onvif_LocationEntity; + +typedef struct _LocationEntityList +{ + struct _LocationEntityList * next; + + onvif_LocationEntity Location; +} LocationEntityList; + +typedef struct +{ + char * ptr; // required, need call free to free the buffer + int size; // required, the ptr buffer length +} onvif_base64Binary; + +typedef struct +{ + uint32 contentTypeFlag : 1; // Indicates whether the field contentType is valid + uint32 Reserved : 31; + + onvif_base64Binary Data; // required, base64 encoded binary data + char contentType[100]; // optional +} onvif_BinaryData; + +typedef struct +{ + uint32 PasswordFlag : 1; // Indicates whether the field Password is valid + uint32 Reserved : 31; + + char UserName[64]; // required, User name + char Password[64]; // optional, optional password +} onvif_UserCredential; + +typedef struct +{ + uint32 LocalPathFlag : 1; // Indicates whether the field LocalPath is valid + uint32 StorageUriFlag : 1; // Indicates whether the field StorageUri is valid + uint32 UserFlag : 1; // Indicates whether the field User is valid + uint32 RegionFlag : 1; // Indicates whether the field Region is valid + uint32 Reserved : 28; + + char LocalPath[256]; // optional, local path + char StorageUri[256]; // optional, Storage server address + + onvif_UserCredential User; // optional, User credential for the storage server + + char type[100]; // required, StorageType lists the acceptable values for type attribute + // NFS, CIFS, CDMI, FTP, ObjectStorageS3, ObjectStorageAzure + char Region[100]; // optinal, Optional region of the storage server +} onvif_StorageConfigurationData; + +typedef struct +{ + char token[ONVIF_TOKEN_LEN]; // required + onvif_StorageConfigurationData Data; // required +} onvif_StorageConfiguration; + +typedef struct _StorageConfigurationList +{ + struct _StorageConfigurationList *next; + + onvif_StorageConfiguration Configuration; +} StorageConfigurationList; + +typedef struct +{ + onvif_TransportProtocol Protocol; // required, Defines the network protocol for streaming, either UDP=RTP/UDP, RTSP=RTP/RTSP/TCP or HTTP=RTP/RTSP/HTTP/TCP +} onvif_Transport; + +typedef struct +{ + onvif_StreamType Stream; // required, Defines if a multicast or unicast stream is requested + onvif_Transport Transport; // required +} onvif_StreamSetup; + +typedef struct +{ + int SessionTimeout; // required, The RTSP session timeout, unit is second +} onvif_ReplayConfiguration; + +typedef struct +{ + char SourceId[128]; // required, Identifier for the source chosen by the client that creates the structure. + // This identifier is opaque to the device. Clients may use any type of URI for this field. A device shall support at least 128 characters + char Name[ONVIF_NAME_LEN]; // required, Informative user readable name of the source, e.g. "Camera23". A device shall support at least 20 characters + char Location[100]; // required, Informative description of the physical location of the source, e.g. the coordinates on a map + char Description[128]; // required, Informative description of the source + char Address[128]; // required, URI provided by the service supplying data to be recorded. A device shall support at least 128 characters +} onvif_RecordingSourceInformation; + +typedef struct +{ + uint32 KeyFlag : 1; // Indicates whether the field Key is valid + uint32 Reserved : 31; + + char KID[64]; // required, Key ID of the associated key for encryption + char Key[1024]; // optional element of type xsd:hexBinary, Key for encrypting content.The device shall not include this parameter when reading + uint32 sizeTrack; // sequence of elements + char Track[4][32]; // optional, Optional list of track tokens to be encrypted + // If no track tokens are specified, all tracks are encrypted and + // no other encryption configurations shall exist for the recording. + // Each track shall only be contained in one encryption configuration. + char Mode[32]; // required, Mode of encryption. See tt:EncryptionMode for a list of definitions and capability trc:SupportedEncryptionModes for the supported encryption modes + // CENC - AES-CTR mode full sample and video NAL Subsample encryption, defined in ISO/IEC 23001-7 + // CBCS - AES-CBC mode partial video NAL pattern encryption, defined in ISO/IEC 23001-7 +} onvif_RecordingEncryption; + +typedef struct +{ + uint32 PrefixFlag : 1; // Indicates whether the field Prefix is valid + uint32 PostfixFlag : 1; // Indicates whether the field Postfix is valid + uint32 SpanDurationFlag : 1; // Indicates whether the field SpanDuration is valid + uint32 SegmentDurationFlag : 1; // Indicates whether the field SegmentDuration is valid + uint32 Reserved : 28; + + char Storage[ONVIF_TOKEN_LEN]; // required , Token of a storage configuration + char Format[32]; // required , Format of the recording.See tt:TargetFormat for a list of definitions and capability trc:SupportedTargetFormats for the supported formats. + // MP4 - MP4 files with all tracks in a single file + // CMAF - CMAF compliant MP4 files with 1 track per file + char Prefix[64]; // optional, Path prefix to be inserted in the object key + char Postfix[64]; // optional, Path postfix to be inserted in the object key + uint32 SpanDuration; // optional, Maximum duration of a span, unit is second + uint32 SegmentDuration; // external, Maximum duration of a segment, unit is second + + uint32 sizeEncryption; // sequence of elements + onvif_RecordingEncryption Encryption[4]; // optional, Optional encryption configuration. + // See capability trc:EncryptionEntryLimit for the number of supported entries. + // By specifying multiple encryption entries per recording, different tracks + // can be encrypted with different configurations. + // Each track shall only be contained in one encryption configuration. +} onvif_RecordingTargetConfiguration; + +typedef struct +{ + uint32 MaximumRetentionTimeFlag : 1; // Indicates whether the field MaximumRetentionTime is valid + uint32 TargetFlag : 1; // Indicates whether the field Target is valid + uint32 Reserved : 30; + + onvif_RecordingSourceInformation Source; // required, Information about the source of the recording + char Content[256]; // required, Informative description of the source + uint32 MaximumRetentionTime; // optional, specifies the maximum time that data in any track within the + // recording shall be stored. The device shall delete any data older than the maximum retention + // time. Such data shall not be accessible anymore. If the MaximumRetentionPeriod is set to 0, + // the device shall not limit the retention time of stored data, except by resource constraints. + // Whatever the value of MaximumRetentionTime, the device may automatically delete + // recordings to free up storage space for new recordings. + // unit is second + onvif_RecordingTargetConfiguration Target; // optional, Optional external storage target configuration +} onvif_RecordingConfiguration; + +typedef struct +{ + onvif_TrackType TrackType; // required, Type of the track. It shall be equal to the strings "Video", "Audio" or "Metadata" + + char Description[100]; // required, Informative description of the track +} onvif_TrackConfiguration; + +typedef struct +{ + uint32 TypeFlag : 1; // Indicates whether the field Type is valid + uint32 Reserved : 31; + + char Token[ONVIF_TOKEN_LEN]; // required, + char Type[256]; // optional, default is "http://www.onvif.org/ver10/schema/Receiver", "http://www.onvif.org/ver10/schema/Profile" +} onvif_SourceReference; + +typedef struct +{ + char SourceTag[64]; // required, If the received RTSP stream contains multiple tracks of the same type, the + // SourceTag differentiates between those Tracks. This field can be ignored in case of recording a local source + char Destination[ONVIF_TOKEN_LEN]; // required, The destination is the tracktoken of the track to which the device shall store the received data +} onvif_RecordingJobTrack; + +typedef struct +{ + uint32 SourceTokenFlag : 1; // Indicates whether the field SourceToken is valid + uint32 AutoCreateReceiverFlag : 1; // Indicates whether the field AutoCreateReceiver is valid + uint32 Reserved : 30; + + onvif_SourceReference SourceToken; // optional, This field shall be a reference to the source of the data. The type of the source + // is determined by the attribute Type in the SourceToken structure. If Type is + // http://www.onvif.org/ver10/schema/Receiver, the token is a ReceiverReference. In this case + // the device shall receive the data over the network. If Type is + // http://www.onvif.org/ver10/schema/Profile, the token identifies a media profile, instructing the + // device to obtain data from a profile that exists on the local device + BOOL AutoCreateReceiver; // optional, If this field is TRUE, and if the SourceToken is omitted, the device + // shall create a receiver object (through the receiver service) and assign the + // ReceiverReference to the SourceToken field. When retrieving the RecordingJobConfiguration + // from the device, the AutoCreateReceiver field shall never be present + + uint32 sizeTracks; + + onvif_RecordingJobTrack Tracks[5]; // optional, List of tracks associated with the recording +} onvif_RecordingJobSource; + +typedef struct +{ + char RecordingToken[ONVIF_TOKEN_LEN]; // required, Identifies the recording to which this job shall store the received data + char Mode[16]; // required, The mode of the job. If it is idle, nothing shall happen. If it is active, the device shall try to obtain data from the receivers. + // A client shall use GetRecordingJobState to determine if data transfer is really taking place + // The only valid values for Mode shall be "Idle" or "Active" + int Priority; // required, This shall be a non-negative number. If there are multiple recording jobs that store data to + // the same track, the device will only store the data for the recording job with the highest + // priority. The priority is specified per recording job, but the device shall determine the priority + // of each track individually. If there are two recording jobs with the same priority, the device + // shall record the data corresponding to the recording job that was activated the latest + uint32 sizeSource; + onvif_RecordingJobSource Source[5]; // optional, Source of the recording + + char ScheduleToken[ONVIF_TOKEN_LEN]; // optional, This attribute adds an additional requirement for activating the recording job. + // If this optional field is provided the job shall only record if the schedule exists and is active. +} onvif_RecordingJobConfiguration; + +typedef struct +{ + uint32 ErrorFlag : 1; // Indicates whether the field Error is valid + uint32 Reserved : 31; + + char SourceTag[64]; // required, Identifies the track of the data source that provides the data + char Destination[ONVIF_TOKEN_LEN]; // required, Indicates the destination track + char Error[100]; // optional, Optionally holds an implementation defined string value that describes the error. The string should be in the English language + char State[16]; // required, Provides the job state of the track. + // The valid values of state shall be "Idle", "Active" and "Error". If state equals "Error", the Error field may be filled in with an implementation defined value +} onvif_RecordingJobStateTrack; + +typedef struct +{ + onvif_SourceReference SourceToken; // required, Identifies the data source of the recording job + char State[16]; // required, Holds the aggregated state over all substructures of RecordingJobStateSource + // Idle : All state values in sub-nodes are "Idle" + // PartiallyActive : The state of some sub-nodes are "active" and some sub-nodes are "idle" + // Active : The state of all sub-nodes is "Active" + // Error : At least one of the sub-nodes has state "Error" + uint32 sizeTrack; + + onvif_RecordingJobStateTrack Track[5]; // optional, +} onvif_RecordingJobStateSource; + +typedef struct +{ + char RecordingToken[ONVIF_TOKEN_LEN]; // required, Identification of the recording that the recording job records to + char State[16]; // required, Holds the aggregated state over the whole RecordingJobInformation structure + // Idle : All state values in sub-nodes are "Idle" + // PartiallyActive : The state of some sub-nodes are "active" and some sub-nodes are "idle" + // Active : The state of all sub-nodes is "Active" + // Error : At least one of the sub-nodes has state "Error" + + uint32 sizeSources; + + onvif_RecordingJobStateSource Sources[5]; // optional, Identifies the data source of the recording job +} onvif_RecordingJobStateInformation; + +typedef struct +{ + uint32 SpareFlag : 1; // Indicates whether the field Spare is valid + uint32 CompatibleSourcesFlag : 1; // Indicates whether the field CompatibleSources is valid + uint32 Reserved : 30; + + int Spare; // optional, Number of spare jobs that can be created for the recording + char CompatibleSources[160]; // optional, A device that supports recording of a restricted set of Media Service Profiles returns the list of profiles that can be recorded on the given Recording +} onvif_JobOptions; + +typedef struct +{ + uint32 SpareTotalFlag : 1; // Indicates whether the field SpareTotal is valid + uint32 SpareVideoFlag : 1; // Indicates whether the field SpareVideo is valid + uint32 SpareAudioFlag : 1; // Indicates whether the field SpareAudio is valid + uint32 SpareMetadataFlag : 1; // Indicates whether the field SpareMetadata is valid + uint32 Reserved : 28; + + int SpareTotal; // optional, Total spare number of tracks that can be added to this recording + int SpareVideo; // optional, Number of spare Video tracks that can be added to this recording + int SpareAudio; // optional, Number of spare Aduio tracks that can be added to this recording + int SpareMetadata; // optional, Number of spare Metadata tracks that can be added to this recording +} onvif_TrackOptions; + +typedef struct +{ + onvif_JobOptions Job; // required, + onvif_TrackOptions Track; // required, +} onvif_RecordingOptions; + +typedef struct +{ + char TrackToken[ONVIF_TOKEN_LEN]; // required + + onvif_TrackConfiguration Configuration; // required +} onvif_Track; + +typedef struct _TrackList +{ + struct _TrackList * next; + + onvif_Track Track; +} TrackList; + +typedef struct +{ + char RecordingToken[ONVIF_TOKEN_LEN]; // required + + onvif_RecordingConfiguration Configuration; // required + + TrackList * Tracks; +} onvif_Recording; + +typedef struct +{ + char JobToken[ONVIF_TOKEN_LEN]; // required + + onvif_RecordingJobConfiguration JobConfiguration; // required +} onvif_RecordingJob; + +typedef struct +{ + char Name[ONVIF_NAME_LEN]; // required, Item name + char Value[ONVIF_TOKEN_LEN]; // required, Item value. The type is defined in the corresponding description +} onvif_SimpleItem; + +typedef struct _SimpleItemList +{ + struct _SimpleItemList * next; + + onvif_SimpleItem SimpleItem; // Value name pair as defined by the corresponding description +} SimpleItemList; + +typedef struct +{ + uint32 AnyFlag : 1; + uint32 Reserverd : 31; + + char Name[ONVIF_NAME_LEN]; // required, Item name + char * Any; // optional +} onvif_ElementItem; + +typedef struct _ElementItemList +{ + struct _ElementItemList * next; + + onvif_ElementItem ElementItem; // Value name pair as defined by the corresponding description +} ElementItemList; + +typedef struct +{ + SimpleItemList * SimpleItem; // optional + ElementItemList * ElementItem; // optional +} onvif_ItemList; + +typedef struct +{ + uint32 PropertyOperationFlag : 1; // Indicates whether the field PropertyOperation is valid + uint32 SourceFlag : 1; // Indicates whether the field Source is valid + uint32 KeyFlag : 1; // Indicates whether the field Key is valid + uint32 DataFlag : 1; // Indicates whether the field Data is valid + uint32 Reserved : 28; + + time_t UtcTime; // required + + onvif_ItemList Source; // optional, Token value pairs that triggered this message. Typically only one item is present + onvif_ItemList Key; // optional element of type tt:ItemList */ + onvif_ItemList Data; // optional element of type tt:ItemList */ + + onvif_PropertyOperation PropertyOperation; // optional +} onvif_Message; + +typedef struct +{ + char ConsumerAddress[256]; // required, + char ProducterAddress[256]; // required, + + char Dialect[256]; // required, + char Topic[256]; // required, + + onvif_Message Message; // required +} onvif_NotificationMessage; + +typedef struct +{ + time_t DataFrom; // required, The earliest point in time where there is recorded data on the device + time_t DataUntil; // required, The most recent point in time where there is recorded data on the device + int NumberRecordings; // required, The device contains this many recordings +} onvif_RecordingSummary; + +typedef struct +{ + char TrackToken[ONVIF_TOKEN_LEN]; // required, + + onvif_TrackType TrackType; // required, Type of the track: "Video", "Audio" or "Metadata". + // The track shall only be able to hold data of that type + + char Description[100]; // required, Informative description of the contents of the track + time_t DataFrom; // required, The start date and time of the oldest recorded data in the track + time_t DataTo; // required, The stop date and time of the newest recorded data in the track +} onvif_TrackInformation; + +typedef struct +{ + uint32 EarliestRecordingFlag : 1; // Indicates whether the field EarliestRecording is valid + uint32 LatestRecordingFlag : 1; // Indicates whether the field LatestRecording is valid + uint32 Reserved : 30; + + char RecordingToken[ONVIF_TOKEN_LEN]; // required, + + onvif_RecordingSourceInformation Source; // required, Information about the source of the recording + + time_t EarliestRecording; // optional, + time_t LatestRecording; // optional, + char Content[256]; // required, + + uint32 sizeTrack; + onvif_TrackInformation Track[5]; // optional, Basic information about the track. Note that a track may represent a single contiguous time span or consist of multiple slices + + onvif_RecordingStatus RecordingStatus; // required, +} onvif_RecordingInformation; + +typedef struct +{ + uint32 BitrateFlag : 1; // Indicates whether the field Bitrate is valid + uint32 Reserved : 31; + + int Bitrate; // optional, Average bitrate in kbps + int Width; // required, The width of the video in pixels + int Height; // required, The height of the video in pixels + + onvif_VideoEncoding Encoding; // required, Used video codec, either Jpeg, H.264 or Mpeg4 + + float Framerate; // required, Average framerate in frames per second +} onvif_VideoAttributes; + +typedef struct +{ + uint32 BitrateFlag : 1; // Indicates whether the field Bitrate is valid + uint32 Reserved : 31; + + int Bitrate; // optional, The bitrate in kbps + + onvif_AudioEncoding Encoding; // required, Audio codec used for encoding the audio (either G.711, G.726 or AAC) + + int Samplerate; // required, The sample rate in kHz +} onvif_AudioAttributes; + +typedef struct +{ + uint32 PtzSpacesFlag : 1; // Indicates whether the field PtzSpaces is valid + uint32 Reserved : 31; + + BOOL CanContainPTZ; // required, Indicates that there can be PTZ data in the metadata track in the specified time interval + BOOL CanContainAnalytics; // required, Indicates that there can be analytics data in the metadata track in the specified time interval + BOOL CanContainNotifications; // required, Indicates that there can be notifications in the metadata track in the specified time interval + char PtzSpaces[256]; // optional, List of all PTZ spaces active for recording. Note that events are only recorded on position changes and + // the actual point of recording may not necessarily contain an event of the specified type +} onvif_MetadataAttributes; + +typedef struct +{ + uint32 VideoAttributesFlag : 1; // Indicates whether the field VideoAttributes is valid + uint32 AudioAttributesFlag : 1; // Indicates whether the field AudioAttributes is valid + uint32 MetadataAttributesFlag : 1; // Indicates whether the field MetadataAttributes is valid + uint32 Reserved : 29; + + onvif_TrackInformation TrackInformation; // required, The basic information about the track. Note that a track may represent a single contiguous time span or consist of multiple slices + onvif_VideoAttributes VideoAttributes; // optional, If the track is a video track, exactly one of this structure shall be present and contain the video attributes + onvif_AudioAttributes AudioAttributes; // optional, If the track is an audio track, exactly one of this structure shall be present and contain the audio attributes + onvif_MetadataAttributes MetadataAttributes; // optional, If the track is an metadata track, exactly one of this structure shall be present and contain the metadata attributes +} onvif_TrackAttributes; + +typedef struct _TrackAttributesList +{ + struct _TrackAttributesList * next; + + onvif_TrackAttributes TrackAttributes; +} TrackAttributesList; + +typedef struct +{ + char RecordingToken[ONVIF_TOKEN_LEN]; // required, A reference to the recording that has these attributes + + uint32 sizeTrackAttributes; + onvif_TrackAttributes TrackAttributes[5]; // optional, A set of attributes for each track + + time_t From; // required, The attributes are valid from this point in time in the recording + time_t Until; // required, The attributes are valid until this point in time in the recording. + // Can be equal to 'From' to indicate that the attributes are only known to be valid for this particular point in time +} onvif_MediaAttributes; + +typedef struct +{ + char StorageToken[ONVIF_TOKEN_LEN]; // required, + char RelativePath[256]; // optional, +} onvif_StorageReferencePath; + +typedef struct +{ + char FileName[256]; // required, Exported file name + float Progress; // required, Normalized percentage completion for uploading the exported file +} onvif_FileProgress; + +typedef struct +{ + uint32 sizeFileProgress; // sequence of elements + onvif_FileProgress FileProgress[100]; // optional, Exported file name and export progress information +} onvif_ArrayOfFileProgress; + +typedef struct +{ + uint32 RecordingInformationFilterFlag : 1; // Indicates whether the field RecordingInformationFilter is valid + uint32 Reserved : 31; + + int sizeIncludedSources; + onvif_SourceReference IncludedSources[10]; // optional, A list of sources that are included in the scope. If this list is included, only data from one of these sources shall be searched + + int sizeIncludedRecordings; + char IncludedRecordings[10][ONVIF_TOKEN_LEN]; // optional, A list of recordings that are included in the scope. If this list is included, only data from one of these recordings shall be searched + + char RecordingInformationFilter[128]; // optional, An xpath expression used to specify what recordings to search. + // Only those recordings with an RecordingInformation structure that matches the filter shall be searched +} onvif_SearchScope; + +typedef struct +{ + onvif_PTZVector MinPosition; // required, + onvif_PTZVector MaxPosition; // required, + + BOOL EnterOrExit; // required, +} onvif_PTZPositionFilter; + +typedef struct +{ + char MetadataStreamFilter[100]; // required +} onvif_MetadataFilter; + +typedef struct _RecordingInformationList +{ + struct _RecordingInformationList * next; + + onvif_RecordingInformation RecordingInformation; +} RecordingInformationList; + +typedef struct +{ + onvif_SearchState SearchState; // required, The state of the search when the result is returned. Indicates if there can be more results, or if the search is completed + + RecordingInformationList * RecordInformation; // optional, A RecordingInformation structure for each found recording matching the search +} onvif_FindRecordingResultList; + +typedef struct +{ + char Address[128]; // required, +} onvif_EndpointReferenceType; + +typedef struct +{ + char Dialect[128]; // required, + char Topic[128]; // required, +} onvif_TopicExpressionType; + +typedef struct +{ + uint32 SubscriptionReferenceFlag : 1; // Indicates whether the field SubscriptionReference is valid + uint32 TopicFlag : 1; // Indicates whether the field Topic is valid + uint32 ProducerReferenceFlag : 1; // Indicates whether the field ProducerReference is valid + uint32 Reserved : 31; + + onvif_EndpointReferenceType SubscriptionReference; // optional, + onvif_TopicExpressionType Topic; // optional, + onvif_EndpointReferenceType ProducerReference; // optional, + onvif_Message Message; // required +} onvif_NotificationMessageHolderType; + +typedef struct +{ + char RecordingToken[ONVIF_TOKEN_LEN]; // required, The recording where this event was found. Empty string if no recording is associated with this event + char TrackToken[ONVIF_TOKEN_LEN]; // required, A reference to the track where this event was found. Empty string if no track is associated with this event + time_t Time; // required, The time when the event occured + + onvif_NotificationMessageHolderType Event; // required, The description of the event + + BOOL StartStateEvent; // required, If true, indicates that the event is a virtual event generated for this particular search session to give the state of a property at the start time of the search +} onvif_FindEventResult; + +typedef struct _FindEventResultList +{ + struct _FindEventResultList * next; + + onvif_FindEventResult Result; +} FindEventResultList; + +typedef struct +{ + onvif_SearchState SearchState; // required, The state of the search when the result is returned. Indicates if there can be more results, or if the search is completed + + FindEventResultList * Result; // optional +} onvif_FindEventResultList; + +typedef struct +{ + char RecordingToken[ONVIF_TOKEN_LEN]; // required, The recording where this event was found. Empty string if no recording is associated with this event + char TrackToken[ONVIF_TOKEN_LEN]; // required, A reference to the track where this event was found. Empty string if no track is associated with this event + time_t Time; // required, The time when the event occured +} onvif_FindMetadataResult; + +typedef struct _FindMetadataResultList +{ + struct _FindMetadataResultList * next; + + onvif_FindMetadataResult Result; +} FindMetadataResultList; + +typedef struct +{ + onvif_SearchState SearchState; // required, The state of the search when the result is returned. Indicates if there can be more results, or if the search is completed + + FindMetadataResultList * Result; // optional +} onvif_FindMetadataResultList; + +typedef struct +{ + char RecordingToken[ONVIF_TOKEN_LEN]; // required + char TrackToken[ONVIF_TOKEN_LEN]; // required + time_t Time; // required + + onvif_PTZVector Position; // required +} onvif_FindPTZPositionResult; + +typedef struct _FindPTZPositionResultList +{ + struct _FindPTZPositionResultList * next; + + onvif_FindPTZPositionResult Result; +} FindPTZPositionResultList; + +typedef struct +{ + onvif_SearchState SearchState; // required, The state of the search when the result is returned. Indicates if there can be more results, or if the search is completed + + FindPTZPositionResultList * Result; // optional +} onvif_FindPTZPositionResultList; + + +////////////////////////////////////////////////////////////////////////// +// Video analytics struct defines +////////////////////////////////////////////////////////////////////////// + +typedef struct +{ + uint32 attrFlag : 1; + uint32 reserved : 31; + + onvif_ItemList Parameters; // required + + char Name[ONVIF_NAME_LEN]; // required + char Type[100]; // required + char attr[256]; +} onvif_Config; + +typedef struct _ConfigList +{ + struct _ConfigList * next; + + onvif_Config Config; +} ConfigList; + +typedef struct +{ + ConfigList * AnalyticsModule; // optional +} onvif_AnalyticsEngineConfiguration; + +typedef struct +{ + ConfigList * Rule; // optional +} onvif_RuleEngineConfiguration; + +typedef struct +{ + char Name[ONVIF_NAME_LEN]; // required + int UseCount; // required + char token[ONVIF_TOKEN_LEN]; // required + + onvif_AnalyticsEngineConfiguration AnalyticsEngineConfiguration; // required + onvif_RuleEngineConfiguration RuleEngineConfiguration; // required +} onvif_VideoAnalyticsConfiguration; + +typedef struct +{ + char Name[ONVIF_NAME_LEN]; // required + char Type[100]; // required +} onvif_SimpleItemDescription; + +typedef struct _SimpleItemDescriptionList +{ + struct _SimpleItemDescriptionList * next; + + onvif_SimpleItemDescription SimpleItemDescription; +} SimpleItemDescriptionList; + +typedef struct +{ + SimpleItemDescriptionList * SimpleItemDescription; + SimpleItemDescriptionList * ElementItemDescription; +} onvif_ItemListDescription; + +typedef struct +{ + uint32 SourceFlag : 1; // Indicates whether the field Source is valid + uint32 KeyFlag : 1; // Indicates whether the field Source is valid + uint32 DataFlag : 1; // Indicates whether the field Source is valid + uint32 IsPropertyFlag : 1; // Indicates whether the field Source is valid + uint32 Reserved : 28; + + onvif_ItemListDescription Source; // optional + onvif_ItemListDescription Key; // optional + onvif_ItemListDescription Data; // optional + + BOOL IsProperty; // optional + char ParentTopic[100]; // required +} onvif_ConfigDescription_Messages; + +typedef struct _ConfigDescription_MessagesList +{ + struct _ConfigDescription_MessagesList * next; + + onvif_ConfigDescription_Messages Messages; +} ConfigDescription_MessagesList; + +typedef struct +{ + uint32 fixedFlag : 1; // Indicates whether the field fixed is valid + uint32 maxInstancesFlag : 1; // Indicates whether the field maxInstances is valid + uint32 Reserved : 30; + + onvif_ItemListDescription Parameters; // required + + ConfigDescription_MessagesList * Messages; + + char Name[ONVIF_NAME_LEN]; // required, The Name attribute (e.g. "tt::LineDetector") uniquely identifies the type of rule, not a type definition in a schema + BOOL fixed; // optional, The fixed attribute signals that it is not allowed to add or remove this type of configuration + int maxInstances; // optional, The maxInstances attribute signals the maximum number of instances per configuration +} onvif_ConfigDescription; + +typedef struct +{ + uint32 RuleTypeFlag : 1; // Indicates whether the field RuleType is valid + uint32 AnalyticsModuleFlag : 1; // Indicates whether the field AnalyticsModule is valid + uint32 Reserved : 30; + + char RuleType[100]; // optional, The RuleType the ConfigOptions applies to if the Name attribute is ambiguous. + char Name[ONVIF_NAME_LEN]; // required, The Name of the SimpleItemDescription/ElementItemDescription + // the ConfigOptions applies to + char Type[100]; // required, Type of the Rule Options represented by a unique QName. + // The Type defines the element contained in this structure + char AnalyticsModule[100]; // optional, Optional name of the analytics module this constraint applies to. + // This option is only necessary in cases where different constraints for elements with the same Name exist. + char * any; +} onvif_ConfigOptions; + +typedef struct _ConfigOptionsList +{ + struct _ConfigOptionsList * next; + + onvif_ConfigOptions Options; +} ConfigOptionsList; + +typedef struct _ConfigDescriptionList +{ + struct _ConfigDescriptionList * next; + + onvif_ConfigDescription ConfigDescription; +} ConfigDescriptionList; + +typedef struct +{ + uint32 LimitFlag : 1; // Indicates whether the field Limit is valid + uint32 Reserved : 31; + + uint32 sizeRuleContentSchemaLocation; + char RuleContentSchemaLocation[10][256]; // optional, Lists the location of all schemas that are referenced in the rules + + ConfigDescriptionList * RuleDescription; // List of rules supported by the Video Analytics configuration + + int Limit; // optional, Maximum number of concurrent instances +} onvif_SupportedRules; + +typedef struct +{ + uint32 sizeAnalyticsModuleContentSchemaLocation; // sequence of elements + char AnalyticsModuleContentSchemaLocation[10][128]; // It optionally contains a list of URLs that provide the location of schema files + // These schema files describe the types and elements used in the analytics module descriptions. + // If the analytics module descriptions reference types or elements of the ONVIF schema file, + // the ONVIF schema file MUST be explicitly listed + + ConfigDescriptionList * AnalyticsModuleDescription; // optional, +} onvif_SupportedAnalyticsModules; + +typedef struct +{ + char Type[128]; // required, Type of the Analytics Module Options represented by a unique QName. + // The Type defines the element contained in this structure +} onvif_AnalyticsModuleConfigOptions; + +typedef struct _AnalyticsModuleConfigOptionsList +{ + struct _AnalyticsModuleConfigOptionsList * next; + + onvif_AnalyticsModuleConfigOptions Options; +} AnalyticsModuleConfigOptionsList; + +typedef struct +{ + char Dialect[128]; + char Expression[256]; +} onvif_EventFilterItem; + +typedef struct +{ + int sizeTopicExpression; + int sizeMessageContent; + + onvif_EventFilterItem TopicExpression[5]; + onvif_EventFilterItem MessageContent[5]; +} onvif_EventFilter; + +typedef struct +{ + uint32 AnalyticsFlag : 1; // Indicates whether the field Analytics is valid + uint32 PTZStatusFlag : 1; // Indicates whether the field PTZStatus is valid + uint32 EventsFlag : 1; // Indicates whether the field Events is valid + uint32 CompressionTypeFlag : 1; // Indicates whether the field CompressionType is valid + uint32 AnalyticsEngineConfigurationFlag : 1; // Indicates whether the field AnalyticsEngineConfiguration is valid + uint32 GeoLocation : 1; // Optional parameter to configure if the metadata stream shall contain the Geo Location coordinates of each target + uint32 ShapePolygon : 1; // Optional parameter to configure if the generated metadata stream should contain shape information as polygon + uint32 Reserved : 25; + + char Name[ONVIF_NAME_LEN]; // required , User readable name. Length up to 64 characters + int UseCount; // required, Number of internal references currently using this configuration. This parameter is read-only and cannot be changed by a set request + char token[ONVIF_TOKEN_LEN]; // required, Token that uniquely refernces this configuration. Length up to 64 characters + BOOL Analytics; // optional, Defines whether the streamed metadata will include metadata from the analytics engines (video, cell motion, audio etc.) + int SessionTimeout; // required, The rtsp session timeout for the related audio stream, unit is second + char CompressionType[100]; // optional, Optional parameter to configure compression type of Metadata payload. Use values from enumeration MetadataCompressionType + // None,GZIP,EXI + + onvif_PTZFilter PTZStatus; // optional, optional element to configure which PTZ related data is to include in the metadata stream + onvif_EventSubscription Events; // optional, Optional element to configure the streaming of events. A client might be interested in receiving all, + // none or some of the events produced by the device: + // To get all events: Include the Events element but do not include a filter. + // To get no events: Do not include the Events element. + // To get only some events: Include the Events element and include a filter in the element. + onvif_MulticastConfiguration Multicast; // required, defines the multicast settings that could be used for video streaming + onvif_AnalyticsEngineConfiguration AnalyticsEngineConfiguration; //optional, Defines whether the streamed metadata will include metadata from the analytics engines (video, cell motion, audio etc.) +} onvif_MetadataConfiguration; + +typedef struct +{ + uint32 attrFlag : 1; + uint32 reserved : 31; + + char Type[128]; // required, Reference to an AnalyticsModule Type + char attr[256]; + char * Frame; // required, Sample frame content starting with the tt:Frame node +} onvif_MetadataInfo; + +typedef struct _MetadataInfoList +{ + struct _MetadataInfoList * next; + + onvif_MetadataInfo MetadataInfo; +} MetadataInfoList; + +// PROFILE C Define Begin + +/** + * The AccessPoint capabilities reflect optional functionality of a particular physical entity. + * Different AccessPoint instances may have different set of capabilities. + * This information maychange during device operation, e.g. if hardware settings are changed. + */ +typedef struct +{ + uint32 DisableAccessPoint : 1; // required, Indicates whether or not this AccessPoint instance supports EnableAccessPoint and DisableAccessPoint commands + uint32 Duress : 1; // optional, Indicates whether or not this AccessPoint instance supports generation of duress events + uint32 AnonymousAccess : 1; // optional, Indicates whether or not this AccessPoint has a REX switch or other input that allows anonymous access + uint32 AccessTaken : 1; // optional, Indicates whether or not this AccessPoint instance supports generation of AccessTaken and AccessNotTaken events. + // If AnonymousAccess and AccessTaken are both true, it indicates that the Anonymous versions of AccessTaken and AccessNotTaken are supported + uint32 ExternalAuthorization : 1; // optional, Indicates whether or not this AccessPoint instance supports the ExternalAuthorization operation and the generation of Request events. + // If AnonymousAccess and ExternalAuthorization are both true, it indicates that the Anonymous version is supported as well + uint32 IdentifierAccess : 1; // optional, Indicates whether or not this access point supports the AccessControl/Request/Identifier + // event to request external authorization. + uint32 SupportedRecognitionTypesFlag : 1; // Indicates whether the field SupportedRecognitionTypes is valid + uint32 SupportedFeedbackTypesFlag : 1; // Indicates whether the field SupportedFeedbackTypes is valid + uint32 Reserved : 24; + + char SupportedRecognitionTypes[200]; // optional, A list of recognition types that the device supports + char SupportedFeedbackTypes[200]; // optional, List of supported feedback types +} onvif_AccessPointCapabilities; + +/** + * The AccessPointInfo structure contains basic information about an AccessPoint instance. + * An AccessPoint defines an entity a Credential can be granted or denied access to. + * TheAccessPointInfo provides basic information on how access is controlled in one direction for adoor (from which area to which area). + * door is the typical device involved, but other type ofdevices may be supported as well. + * Multiple AccessPoints may cover the same Door.A typical case is one AccessPoint for entry and another for exit, both referencingthe same Door. + * An ONVIF compliant device shall provide the following fields for each AccessPoint instance + */ +typedef struct +{ + uint32 DescriptionFlag : 1; // Indicates whether the field Description is valid + uint32 AreaFromFlag : 1; // Indicates whether the field AreaFrom is valid + uint32 AreaToFlag : 1; // Indicates whether the field AreaTo is valid + uint32 EntityTypeFlag : 1; // Indicates whether the field EntityType is valid + uint32 EntityTypeAttrFlag : 1; // Indicates whether the field EntityTypeAttr is valid + uint32 Reserved : 27; + + char token[ONVIF_TOKEN_LEN]; // required + char Name[ONVIF_NAME_LEN]; // required, A user readable name. It shall be up to 64 characters + char Description[1024]; // optional, Optional user readable description for the AccessPoint. It shall be up to 1024 characters + char AreaFrom[ONVIF_TOKEN_LEN]; // optional, Optional reference to the Area from which access is requested + char AreaTo[ONVIF_TOKEN_LEN]; // optional, Optional reference to the Area to which access is requested + char EntityType[100]; // optional, Optional entity type; if missing, a Door type as defined by the ONVIF DoorControl service should be assumed. + // This can also be represented by the QName value "tdc:Door" - where tdc is the namespace of the Door Control service. + // This field is provided for future extensions; it will allow an AccessPoint being extended to cover entity types other than Doors as well + char EntityTypeAttr[256]; + char Entity[ONVIF_TOKEN_LEN]; // required, Reference to the entity used to control access; the entity type may be specified by the optional EntityType field explained below but is typically a Door + + onvif_AccessPointCapabilities Capabilities; // required, The capabilities for the AccessPoint +} onvif_AccessPointInfo; + +typedef struct _AccessPointList +{ + struct _AccessPointList * next; + + uint32 Enabled : 1; // Indicates that the AccessPoint is enabled. By default this field value shall be True, if the DisableAccessPoint capabilities is not supported + uint32 AuthenticationProfileTokenFlag : 1; // Indicates whether the field AuthenticationProfileToken is valid + uint32 Reserved : 30; + + onvif_AccessPointInfo AccessPointInfo; + + char AuthenticationProfileToken[ONVIF_TOKEN_LEN]; // A reference to an authentication profile which defines the authentication behavior of the access point +} AccessPointList; + +/** + * DoorCapabilities reflect optional functionality of a particular physical entity. + * Different door instances may have different set of capabilities. + * This information may change during device operation, e.g. if hardware settings are changed + */ +typedef struct +{ + BOOL Access; // optional, Indicates whether or not this Door instance supports AccessDoor command to perform momentary access + BOOL AccessTimingOverride; // optional, Indicates that this Door instance supports overriding configured timing in the AccessDoor command + BOOL Lock; // optional, Indicates that this Door instance supports LockDoor command to lock the door + BOOL Unlock; // optional, Indicates that this Door instance supports UnlockDoor command to unlock the door + BOOL Block; // optional, Indicates that this Door instance supports BlockDoor command to block the door + BOOL DoubleLock; // optional, Indicates that this Door instance supports DoubleLockDoor command to lock multiple locks on the door + BOOL LockDown; // optional, Indicates that this Door instance supports LockDown (and LockDownRelease) commands to lock the door and put it in LockedDown mode + BOOL LockOpen; // optional, Indicates that this Door instance supports LockOpen (and LockOpenRelease) commands to unlock the door and put it in LockedOpen mode + BOOL DoorMonitor; // optional, Indicates that this Door instance has a DoorMonitor and supports the DoorPhysicalState event + BOOL LockMonitor; // optional, Indicates that this Door instance has a LockMonitor and supports the LockPhysicalState event + BOOL DoubleLockMonitor; // optional, Indicates that this Door instance has a DoubleLockMonitor and supports the DoubleLockPhysicalState event + BOOL Alarm; // optional, Indicates that this Door instance supports door alarm and the DoorAlarm event + BOOL Tamper; // optional, Indicates that this Door instance has a Tamper detector and supports the DoorTamper event + BOOL Fault; // optional, Indicates that this Door instance supports door fault and the DoorFault event +} onvif_DoorCapabilities; + +// Tampering information for a Door +typedef struct +{ + uint32 ReasonFlag : 1; // Indicates whether the field Reason is valid + uint32 Reserved : 31; + + char Reason[100]; // optional, Optional field; Details describing tampering state change (e.g., reason, place and time). + // NOTE: All fields (including this one) which are designed to give end-user prompts can be localized to the customers's native language + onvif_DoorTamperState State; // required, State of the tamper detector +} onvif_DoorTamper; + +// Fault information for a Door +typedef struct +{ + uint32 ReasonFlag : 1; // Indicates whether the field Reason is valid + uint32 Reserved : 31; + + char Reason[100]; // optional, Optional reason for fault + + onvif_DoorFaultState State; // required, Overall fault state for the door; it is of type DoorFaultState. If there are any faults, the value shall be: FaultDetected. + // Details of the detected fault shall be found in the Reason field, and/or the various DoorState fields and/or in extensions to this structure +} onvif_DoorFault; + +// The DoorState structure contains current aggregate runtime status of Door +typedef struct +{ + uint32 DoorPhysicalStateFlag : 1; // Indicates whether the field DoorPhysicalState is valid + uint32 LockPhysicalStateFlag : 1; // Indicates whether the field LockPhysicalState is valid + uint32 DoubleLockPhysicalStateFlag : 1; // Indicates whether the field DoubleLockPhysicalState is valid + uint32 AlarmFlag : 1; // Indicates whether the field Alarm is valid + uint32 TamperFlag : 1; // Indicates whether the field Tamper is valid + uint32 FaultFlag : 1; // Indicates whether the field Fault is valid + uint32 Reserved : 26; + + onvif_DoorPhysicalState DoorPhysicalState; // optional, Physical state of Door; it is of type DoorPhysicalState. + // A device that signals support for DoorMonitor capability for a particular door instance shall provide this field + onvif_LockPhysicalState LockPhysicalState; // optional, Physical state of the Lock; it is of type LockPhysicalState. + // A device that signals support for LockMonitor capability for a particular door instance shall provide this field + onvif_LockPhysicalState DoubleLockPhysicalState; // optional, Physical state of the DoubleLock; it is of type LockPhysicalState. + // A device that signals support for DoubleLockMonitor capability for a particular door instance shall provide this field + onvif_DoorAlarmState Alarm; // optional, Alarm state of the door; it is of type DoorAlarmState. + // A device that signals support for Alarm capability for a particular door instance shall provide this field + onvif_DoorTamper Tamper; // optional, Tampering state of the door; it is of type DoorTamper. + // A device that signals support for Tamper capability for a particular door instance shall provide this field + onvif_DoorFault Fault; // optional, Fault information for door; it is of type DoorFault. + // A device that signals support for Fault capability for a particular door instance shall provide this field + onvif_DoorMode DoorMode; // required, The logical operating mode of the door; it is of type DoorMode. An ONVIF compatible device shall report current operating mode in this field +} onvif_DoorState; + +typedef struct +{ + uint32 ExtendedReleaseTimeFlag : 1; // Indicates whether the field ExtendedReleaseTime is valid + uint32 DelayTimeBeforeRelockFlag : 1; // Indicates whether the field DelayTimeBeforeRelock is valid + uint32 ExtendedOpenTimeFlag : 1; // Indicates whether the field ExtendedOpenTime is valid + uint32 PreAlarmTimeFlag : 1; // Indicates whether the field PreAlarmTime is valid + uint32 Reserved : 28; + + uint32 ReleaseTime; // external, When access is granted (door mode becomes Accessed), the latch is unlocked. + // ReleaseTime is the time from when the latch is unlocked until it is + // relocked again (unless the door is physically opened), unit is second + uint32 OpenTime; // external, The time from when the door is physically opened until the door is set in the + // DoorOpenTooLong alarm state, unit is second + uint32 ExtendedReleaseTime; // optional, Some individuals need extra time to open the door before the latch relocks. + // If supported, ExtendedReleaseTime shall be added to ReleaseTime if UseExtendedTime + // is set to true in the AccessDoor command, unit is second + uint32 DelayTimeBeforeRelock; // optional, If the door is physically opened after access is granted, then DelayTimeBeforeRelock is the time from when the door is physically + // opened until the latch goes back to locked state, unit is second + uint32 ExtendedOpenTime; // optional, Some individuals need extra time to pass through the door. If supported, + // ExtendedOpenTime shall be added to OpenTime if UseExtendedTime + // is set to true in the AccessDoor command. unit is second + uint32 PreAlarmTime; // optional, Before a DoorOpenTooLong alarm state is generated, a signal will sound to indicate that the door must be closed. + // PreAlarmTime defines how long before DoorOpenTooLong the warning signal shall sound, unit is second +} onvif_Timings; + +/** + * The DoorInfo type represents the Door as a physical object. + * The structure contains information and capabilities of a specific door instance + */ +typedef struct +{ + uint32 DescriptionFlag : 1; // Indicates whether the field Description is valid + uint32 Reserved : 31; + + char token[ONVIF_TOKEN_LEN]; // required + char Name[ONVIF_NAME_LEN]; // required, A user readable name. It shall be up to 64 characters + char Description[1024]; // optional, A user readable description. It shall be up to 1024 characters + + onvif_DoorCapabilities Capabilities; // required, The capabilities of the Door +} onvif_DoorInfo; + +typedef struct _DoorInfoList +{ + struct _DoorInfoList * next; + + onvif_DoorInfo DoorInfo; +} DoorInfoList; + +typedef struct +{ + onvif_DoorInfo DoorInfo; // Door information + + char DoorType[64]; // required, The type of door. Is of type text. Can be either one of the following reserved ONVIF types: + // "pt:Door", "pt:ManTrap", "pt:Turnstile", "pt:RevolvingDoor", + // "pt:Barrier", or a custom defined type + onvif_Timings Timings; // required, A structure defining times such as how long the door is unlocked when accessed, extended grant time, etc. +} onvif_Door; + +typedef struct _DoorList +{ + struct _DoorList * next; + + onvif_Door Door; +} DoorList; + +/** + * The AreaInfo structure contains basic information about an Area + */ +typedef struct +{ + uint32 DescriptionFlag : 1; // Indicates whether the field Description is valid + uint32 Reserved : 31; + + char token[ONVIF_TOKEN_LEN]; // required + char Name[ONVIF_NAME_LEN]; // required, A user readable name. It shall be up to 64 characters + char Description[1024]; // optional, A user readable description. It shall be up to 1024 characters +} onvif_AreaInfo; + +typedef struct _AreaList +{ + struct _AreaList * next; + + onvif_AreaInfo AreaInfo; +} AreaList; + + +// PROFILE C Define End + +// DEVICEIO Define Begin + +// A pane layout describes one Video window of a display. It links a pane configuration to a region of the screen +typedef struct +{ + char Pane[ONVIF_TOKEN_LEN]; // required, Reference to the configuration of the streaming and coding parameters + + onvif_Rectangle Area; // required, Describes the location and size of the area on the monitor. + // The area coordinate values are espressed in normalized units [-1.0, 1.0] +} onvif_PaneLayout; + +typedef struct _PaneLayoutList +{ + struct _PaneLayoutList * next; + + onvif_PaneLayout PaneLayout; // required +} PaneLayoutList; + +// A layout describes a set of Video windows that are displayed simultaniously on a display +typedef struct +{ + PaneLayoutList * PaneLayout; // required, List of panes assembling the display layout +} onvif_Layout; + +// Representation of a physical video outputs +typedef struct +{ + uint32 ResolutionFlag : 1; // Indicates whether the field Resolution is valid + uint32 RefreshRateFlag : 1; // Indicates whether the field RefreshRate is valid + uint32 AspectRatioFlag : 1; // Indicates whether the field AspectRatio is valid + uint32 Reserved : 29; + + char token[ONVIF_TOKEN_LEN]; // required, + + onvif_Layout Layout; // required, + onvif_VideoResolution Resolution; // optional, Resolution of the display in Pixel + + float RefreshRate; // optional, Refresh rate of the display in Hertz + float AspectRatio; // optional, Aspect ratio of the display as physical extent of width divided by height +} onvif_VideoOutput; + +typedef struct _VideoOutputList +{ + struct _VideoOutputList * next; + + onvif_VideoOutput VideoOutput; +} VideoOutputList; + +typedef struct +{ + char Name[ONVIF_NAME_LEN]; // required + int UseCount; // required + char token[ONVIF_TOKEN_LEN]; // required + char OutputToken[ONVIF_TOKEN_LEN]; // required +} onvif_VideoOutputConfiguration; + +typedef struct _VideoOutputConfigurationList +{ + struct _VideoOutputConfigurationList * next; + + onvif_VideoOutputConfiguration Configuration; +} VideoOutputConfigurationList; + +typedef struct +{ + char token[ONVIF_TOKEN_LEN]; // required, +} onvif_AudioOutput; + +typedef struct _AudioOutputList +{ + struct _AudioOutputList * next; + + onvif_AudioOutput AudioOutput; +} AudioOutputList; + +typedef struct +{ + uint32 sizeOutputTokensAvailable; + char OutputTokensAvailable[5][ONVIF_TOKEN_LEN]; // required, Tokens of the physical Audio outputs (typically one) + uint32 sizeSendPrimacyOptions; + char SendPrimacyOptions[5][100]; // optional, The following modes for the Send-Primacy are defined: + // www.onvif.org/ver20/HalfDuplex/Server + // www.onvif.org/ver20/HalfDuplex/Client + // www.onvif.org/ver20/HalfDuplex/Auto + + onvif_IntRange OutputLevelRange; // required, Minimum and maximum level range supported for this Output +} onvif_AudioOutputConfigurationOptions; + +typedef struct +{ + uint32 SendPrimacyFlag : 1; // Indicates whether the field SendPrimacy is valid + uint32 Reserved : 31; + + char Name[ONVIF_NAME_LEN]; // required, + int UseCount; // required, + char token[ONVIF_TOKEN_LEN]; // required, + char OutputToken[ONVIF_TOKEN_LEN]; // required, Token of the phsycial Audio output + char SendPrimacy[100]; // optional, The following modes for the Send-Primacy are defined: + // www.onvif.org/ver20/HalfDuplex/Server + // www.onvif.org/ver20/HalfDuplex/Client + // www.onvif.org/ver20/HalfDuplex/Auto + int OutputLevel; // required, Volume setting of the output. The applicable range is defined via the option AudioOutputOptions.OutputLevelRange +} onvif_AudioOutputConfiguration; + +typedef struct _AudioOutputConfigurationList +{ + struct _AudioOutputConfigurationList * next; + + onvif_AudioOutputConfigurationOptions Options; + onvif_AudioOutputConfiguration Configuration; +} AudioOutputConfigurationList; + +typedef struct +{ + onvif_RelayMode Mode; // required, 'Bistable' or 'Monostable' + int DelayTime; // external, Time after which the relay returns to its idle state if it is in monostable mode. + // If the Mode field is set to bistable mode the value of the parameter can be ignored + onvif_RelayIdleState IdleState; // required, 'open' or 'closed' +} onvif_RelayOutputSettings; + +typedef struct +{ + uint32 RelayMode_BistableFlag : 1; + uint32 RelayMode_MonostableFlag : 1; + uint32 DelayTimesFlag : 1; // Indicates whether the field DelayTimes is valid + uint32 DiscreteFlag : 1; // Indicates whether the field Discrete is valid + uint32 Reserved : 28; + + char DelayTimes[100]; // optional, Supported delay time range or discrete values in seconds. This element must be present if MonoStable mode is supported. + BOOL Discrete; // optional, True if the relay only supports the exact values for the DelayTimes listed. Default is false + char token[ONVIF_TOKEN_LEN]; // required, Token of the relay output +} onvif_RelayOutputOptions; + +typedef struct _RelayOutputOptionsList +{ + struct _RelayOutputOptionsList * next; + + onvif_RelayOutputOptions Options; +} RelayOutputOptionsList; + +typedef struct +{ + char token[ONVIF_TOKEN_LEN]; // required + + onvif_RelayOutputSettings Properties; // required +} onvif_RelayOutput; + +typedef struct _RelayOutputList +{ + struct _RelayOutputList * next; + + onvif_RelayOutput RelayOutput; +} RelayOutputList; + +typedef struct +{ + uint32 IdleStateFlag : 1; // Indicates whether the field IdleState is valid + uint32 Reserved : 31; + + char token[ONVIF_TOKEN_LEN]; // required + + onvif_DigitalIdleState IdleState; // optional, Indicate the Digital IdleState status +} onvif_DigitalInput; + +typedef struct +{ + uint32 DigitalIdleState_closedFlag : 1; + uint32 DigitalIdleState_openFlag : 1; + uint32 Reserved : 30; +} onvif_DigitalInputConfigurationOptions; + +typedef struct _DigitalInputList +{ + struct _DigitalInputList * next; + + onvif_DigitalInput DigitalInput; +} DigitalInputList; + +typedef struct +{ + int BaudRate; // required, The transfer bitrate + int CharacterLength; // required, The bit length for each character + float StopBit; // required, The number of stop bits used to terminate each character + char token[ONVIF_TOKEN_LEN]; // required, + + onvif_ParityBit ParityBit; // required, The parity for the data error detection + onvif_SerialPortType type; // required, +} onvif_SerialPortConfiguration; + +typedef struct +{ + onvif_IntList BaudRateList; // required, The list of configurable transfer bitrate + onvif_ParityBitList ParityBitList; // required, The list of configurable parity for the data error detection + onvif_IntList CharacterLengthList; // required, The list of configurable bit length for each character + onvif_FloatList StopBitList; // required, The list of configurable number of stop bits used to terminate each character + + char token[ONVIF_TOKEN_LEN]; // required, +} onvif_SerialPortConfigurationOptions; + +typedef struct +{ + char token[ONVIF_TOKEN_LEN]; // required +} onvif_SerialPort; + +typedef struct _SerialPortList +{ + struct _SerialPortList * next; + + onvif_SerialPortConfiguration Configuration; + onvif_SerialPortConfigurationOptions Options; + onvif_SerialPort SerialPort; +} SerialPortList; + +typedef union +{ + char * Binary; + char * String; +} onvif_union_SerialData; + +typedef struct +{ + int _union_SerialData; // 0 - Binary; 1 - String + + onvif_union_SerialData union_SerialData; +} onvif_SerialData; + +typedef struct +{ + uint32 SerialDataFlag : 1; // Indicates whether the field SerialData is valid + uint32 TimeOutFlag : 1; // Indicates whether the field TimeOut is valid + uint32 DataLengthFlag : 1; // Indicates whether the field DataLength is valid + uint32 DelimiterFlag : 1; // Indicates whether the field Delimiter is valid + uint32 Reserved : 28; + + onvif_SerialData SerialData; // optional, The serial port data + + uint32 TimeOut; // optional, Indicates that the command should be responded back within the specified period of time + int DataLength; // optional, This element may be put in the case that data length returned from the connected serial device is already determined as some fixed bytes length. + // It indicates the length of received data which can be regarded as available + char Delimiter[100]; // optional, This element may be put in the case that the delimiter codes returned from the connected serial device is already known. + // It indicates the termination data sequence of the responded data. In case the string has more than one character a device shall interpret the whole string as a single delimiter. + // Furthermore a device shall return the delimiter character(s) to the client +} onvif_SendReceiveSerialCommand; + + +// DEVICEIO Define End + +// MEDIA2 Define Begin + +typedef struct +{ + uint32 GovLengthRangeFlag : 1; // Indicates whether the field GovLengthRange is valid + uint32 FrameRatesSupportedFlag : 1; // Indicates whether the field FrameRatesSupported is valid + uint32 ProfilesSupportedFlag : 1; // Indicates whether the field ProfilesSupported is valid + uint32 ConstantBitRateSupportedFlag : 1; // Indicates whether the field ConstantBitRateSupported is valid + uint32 MaxAnchorFrameDistanceFlag : 1; // Indicates whether the field MaxAnchorFrameDistance is valid + uint32 ConstantBitRateSupported : 1; // optional, Signal whether enforcing constant bitrate is supported + uint32 GuaranteedFrameRateSupported : 1; // Indicates the support for the GuaranteedFrameRate attribute on the VideoEncoder2Configuration element + uint32 Reserved : 25; + + char Encoding[64]; // required, Mime name of the supported Video format + // JPEG, MP4V-ES, H264, H265 + + onvif_VideoEncoding VideoEncoding; // media server 1 field + + onvif_FloatRange QualityRange; // required, Range of the quality values. A high value means higher quality + onvif_VideoResolution ResolutionsAvailable[MAX_RES_NUMS]; // required, List of supported image sizes + onvif_IntRange BitrateRange; // required, Supported range of encoded bitrate in kbps + + char GovLengthRange[100]; // optional, Lower and Upper bounds for the supported group of Video frames length. + // This value typically corresponds to the I-Frame distance + int MaxAnchorFrameDistance; // optional, Signals support for B-Frames. Upper bound for the supported anchor frame distance (must be larger than one) + char FrameRatesSupported[100]; // optional, List of supported target frame rates in fps (frames per second). + // The list shall be sorted with highest values first + char ProfilesSupported[256]; // optional, List of supported encoder profiles + // Simple + // AdvancedSimple + // Baseline + // Main + // Main10 + // Extended + // High +} onvif_VideoEncoder2ConfigurationOptions; + +typedef struct _VideoEncoder2ConfigurationOptionsList +{ + struct _VideoEncoder2ConfigurationOptionsList * next; + + onvif_VideoEncoder2ConfigurationOptions Options; +} VideoEncoder2ConfigurationOptionsList; + +typedef struct +{ + uint32 ConstantBitRateFlag : 1; // Indicates whether the field ConstantBitRate is valid + uint32 Reserved : 31; + + float FrameRateLimit; // required, Desired frame rate in fps. The actual rate may be lower due to e.g. performance limitations + int BitrateLimit; // required, the maximum output bitrate in kbps + BOOL ConstantBitRate; // optional, Enforce constant bitrate + + int EncodingInterval; // required, The media server field +} onvif_VideoRateControl2; + +typedef struct +{ + uint32 RateControlFlag : 1; // Indicates whether the field RateControl is valid + uint32 MulticastFlag : 1; // Indicates whether the field Multicast is valid + uint32 GovLengthFlag : 1; // Indicates whether the field GovLength is valid + uint32 ProfileFlag : 1; // Indicates whether the field Profile is valid + uint32 AnchorFrameDistanceFlag : 1; // Indicates whether the field AnchorFrameDistance is valid + uint32 GuaranteedFrameRate : 1; // A value of true indicates that frame rate is a fixed value rather than an upper limit, + // and that the video encoder shall prioritize frame rate over all other adaptable + // configuration values such as bitrate. Default is false. + uint32 Reserved : 26; + + char Name[ONVIF_NAME_LEN]; // required + int UseCount; // required + char token[ONVIF_TOKEN_LEN]; // required + char Encoding[64]; // required, Mime name of the supported video format. + // JPEG, MP4V-ES, H264, H265 + onvif_VideoEncoding VideoEncoding; // required, the media 1 service field + + onvif_VideoResolution Resolution; // required, Configured video resolution + onvif_VideoRateControl2 RateControl; // optional, Optional element to configure rate control related parameters + onvif_MulticastConfiguration Multicast; // optional, Defines the multicast settings that could be used for video streaming + + float Quality; // required, Relative value for the video quantizers and the quality of the video. + // A high value within supported quality range means higher quality + int GovLength; // optional, Group of Video frames length. Determines typically the interval in which the I-Frames will be coded. + // An entry of 1 indicates I-Frames are continuously generated. An entry of 2 indicates that every 2nd image is an I-Frame, and 3 only every 3rd frame, etc. + // The frames in between are coded as P or B Frames + char Profile[64]; // optional, The encoder profile + // Simple + // AdvancedSimple + // Baseline + // Main + // Main10 + // Extended + // High + + int AnchorFrameDistance; // Distance between anchor frames of type I-Frame and P-Frame. '1' indicates no B-Frames, '2' indicates that every 2nd frame is encoded as B-Frame, '3' indicates a structure like IBBPBBP..., etc. + + int SessionTimeout; // required, the media service field +} onvif_VideoEncoder2Configuration; + +typedef struct _VideoEncoder2ConfigurationList +{ + struct _VideoEncoder2ConfigurationList * next; + + onvif_VideoEncoder2Configuration Configuration; +} VideoEncoder2ConfigurationList; + +typedef struct +{ + uint32 MulticastFlag : 1; // Indicates whether the field Multicast is valid + uint32 Reserved : 31; + + char Name[ONVIF_NAME_LEN]; // required + int UseCount; // required + char token[ONVIF_TOKEN_LEN]; // required + char Encoding[32]; // required, Mime name of the supported audio format + // PCMU, G726, MP4A-LATM(AAC) + + onvif_AudioEncoding AudioEncoding; // required, the media service field + + onvif_MulticastConfiguration Multicast; // optional, Optional multicast configuration of the audio stream + int Bitrate; // required, The output bitrate in kbps + int SampleRate; // required, The output sample rate in kHz + + int SessionTimeout; // required, the media service field +} onvif_AudioEncoder2Configuration; + +typedef struct +{ + char Encoding[32]; // required, Mime name of the supported audio format + // PCMU, G726, MP4A-LATM(AAC) + onvif_AudioEncoding AudioEncoding; // media server 1 field + + onvif_IntList BitrateList; // required, List of supported bitrates in kbps for the specified Encoding + onvif_IntList SampleRateList; // required, List of supported Sample Rates in kHz for the specified Encoding +} onvif_AudioEncoder2ConfigurationOptions; + +typedef struct _AudioEncoder2ConfigurationOptionsList +{ + struct _AudioEncoder2ConfigurationOptionsList * next; + + onvif_AudioEncoder2ConfigurationOptions Options; +} AudioEncoder2ConfigurationOptionsList; + +typedef struct _AudioEncoder2ConfigurationList +{ + struct _AudioEncoder2ConfigurationList * next; + + onvif_AudioEncoder2Configuration Configuration; +} AudioEncoder2ConfigurationList; + +typedef struct +{ + uint32 TokenFlag : 1; // Indicates whether the field Token is valid + uint32 Reserved : 31; + + char Type[32]; // required, Type of the configuration + // All, VideoSource, VideoEncoder, AudioSource, AudioEncoder, + // AudioOutput, AudioDecoder, Metadata, Analytics, PTZ + char Token[ONVIF_TOKEN_LEN]; // optional, Reference token of an existing configuration +} onvif_ConfigurationRef; + +typedef struct +{ + char Encoding[32]; // required, + int Number; // required, +} onvif_EncoderInstance; + +typedef struct +{ + uint32 sizeCodec; + onvif_EncoderInstance Codec[10]; // optional, If a device limits the number of instances for respective Video Codecs the response + // contains the information how many streams can be set up at the same time per VideoSource + + int Total; // required, The minimum guaranteed total number of encoder instances (applications) per VideoSourceConfiguration. + // The device is able to deliver the Total number of streams +} onvif_EncoderInstanceInfo; + +typedef struct +{ + char Name[ONVIF_NAME_LEN]; // required, + int UseCount; // required, + char token[ONVIF_TOKEN_LEN]; // required, +} onvif_ConfigurationEntity; + +typedef struct +{ + onvif_IntList Bitrate; // required + onvif_IntList SampleRateRange; // required +} onvif_AACDecOptions; + +typedef struct +{ + onvif_IntList Bitrate; // required + onvif_IntList SampleRateRange; // required +} onvif_G711DecOptions; + +typedef struct +{ + onvif_IntList Bitrate; // required + onvif_IntList SampleRateRange; // required +} onvif_G726DecOptions; + +typedef struct +{ + uint32 AACDecOptionsFlag : 1; // Indicates whether the field AACDecOptions is valid + uint32 G711DecOptionsFlag : 1; // Indicates whether the field G711DecOptions is valid + uint32 G726DecOptionsFlag : 1; // Indicates whether the field G726DecOptions is valid + uint32 Reserved : 29; + + onvif_AACDecOptions AACDecOptions; // optional + onvif_G711DecOptions G711DecOptions; // optional + onvif_G726DecOptions G726DecOptions; // optional +} onvif_AudioDecoderConfigurationOptions; + +typedef struct +{ + char Name[ONVIF_NAME_LEN]; // required, + int UseCount; // required, + char token[ONVIF_TOKEN_LEN]; // required, +} onvif_AudioDecoderConfiguration; + +typedef struct _AudioDecoderConfigurationList +{ + struct _AudioDecoderConfigurationList * next; + + onvif_AudioDecoderConfiguration Configuration; +} AudioDecoderConfigurationList; + +typedef struct +{ + uint32 VideoSourceFlag : 1; // Indicates whether the field VideoSource is valid + uint32 AudioSourceFlag : 1; // Indicates whether the field AudioSource is valid + uint32 VideoEncoderFlag : 1; // Indicates whether the field VideoEncoder is valid + uint32 AudioEncoderFlag : 1; // Indicates whether the field AudioEncoder is valid + uint32 AnalyticsFlag : 1; // Indicates whether the field Analytics is valid + uint32 PTZFlag : 1; // Indicates whether the field PTZ is valid + uint32 MetadataFlag : 1; // Indicates whether the field Metadata is valid + uint32 AudioOutputFlag : 1; // Indicates whether the field AudioOutput is valid + uint32 AudioDecoderFlag : 1; // Indicates whether the field AudioDecoder is valid + uint32 Reserved : 23; + + onvif_VideoSourceConfiguration VideoSource; // optional, Optional configuration of the Video input + onvif_AudioSourceConfiguration AudioSource; // optional, Optional configuration of the Audio input + onvif_VideoEncoder2Configuration VideoEncoder; // optional, Optional configuration of the Video encoder + onvif_AudioEncoder2Configuration AudioEncoder; // optional, Optional configuration of the Audio encoder + onvif_VideoAnalyticsConfiguration Analytics; // optional, Optional configuration of the analytics module and rule engine + onvif_PTZConfiguration PTZ; // optional, Optional configuration of the pan tilt zoom unit + onvif_MetadataConfiguration Metadata; // optional, Optional configuration of the metadata stream + onvif_AudioOutputConfiguration AudioOutput; // optional, Optional configuration of the Audio output + onvif_AudioDecoderConfiguration AudioDecoder; // optional, Optional configuration of the Audio decoder +} onvif_ConfigurationSet; + +typedef struct +{ + char Name[ONVIF_NAME_LEN]; // required, User readable name of the profile + + onvif_ConfigurationSet Configurations; // required, The configurations assigned to the profile + + char token[ONVIF_TOKEN_LEN]; // required, Unique identifier of the profile + BOOL fixed; // optional, A value of true signals that the profile cannot be deleted. Default is false + char stream_uri[ONVIF_URI_LEN]; // this profile stream url address +} onvif_MediaProfile; + +typedef struct _MediaProfileList +{ + struct _MediaProfileList * next; + + onvif_MediaProfile MediaProfile; +} MediaProfileList; + +typedef struct +{ + uint32 sizePoint; // sequence of elements + onvif_Vector Point[100]; // required, +} onvif_Polygon; + +typedef struct +{ + uint32 ColorFlag : 1; // Indicates whether the field Color is valid + uint32 Reserved : 31; + + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Token of the VideoSourceConfiguration the Mask is associated with + + onvif_Polygon Polygon; // required, Geometric representation of the mask area + + char Type[64]; // required, + // Color - The masked area is colored with color defined by the Color field + // Pixelated - The masked area is filled in mosaic style to hide details + // Blurred - The masked area is low pass filtered to hide details + onvif_Color Color; // optional, Color of the masked area + + BOOL Enabled; // required, If set the mask will cover the image, otherwise it will be fully transparent + char token[ONVIF_TOKEN_LEN]; // required, Token of the mask +} onvif_Mask; + +typedef struct +{ + int MaxMasks; // required, Maximum supported number of masks per VideoSourceConfiguration + int MaxPoints; // required, Maximum supported number of points per mask + + uint32 sizeTypes; // sequence, + char Types[10][64]; // required, Information which types of tr2:MaskType are supported. + // Valid values are 'Color', 'Pixelated' and 'Blurred' + + onvif_ColorOptions Color; // required, Colors supported + + BOOL RectangleOnly; // optional, Information whether the polygon must have four points and a rectangular shape + BOOL SingleColorOnly; // optional, Indicates the device capability of change in color of privacy mask for one video source + // configuration will automatically be applied to all the privacy masks associated with the same + // video source configuration +} onvif_MaskOptions; + +typedef struct _MaskList +{ + struct _MaskList * next; + + onvif_Mask Mask; +} MaskList; + +// MEDIA2 Define End + +// Thermal Define Begin + +typedef struct +{ + char Name[ONVIF_NAME_LEN]; // required, User readable Color Palette name + char token[ONVIF_TOKEN_LEN]; // required, Unique identifier of this Color Palette + char Type[32]; // required, Indicates Color Palette Type. Can use the following value: + // Custom,Grayscale,BlackHot,WhiteHot,Sepia,Red,Iron,Rain,Rainbow,Isotherm +} onvif_ColorPalette; + +typedef enum +{ + Polarity_WhiteHot = 0, + Polarity_BlackHot = 1 +} onvif_Polarity; + +typedef struct +{ + uint32 LowTemperatureFlag : 1; // Indicates whether the field LowTemperature is valid + uint32 HighTemperatureFlag : 1; // Indicates whether the field HighTemperature is valid + uint32 Reserved : 30; + + char Name[ONVIF_NAME_LEN]; // required, User reabable name for the Non-Uniformity Correction (NUC) Table + char token[ONVIF_TOKEN_LEN]; // required, Unique identifier of this NUC Table + float LowTemperature; // optional, Low Temperature limit for application of NUC Table, in Kelvin + float HighTemperature; // optional, High Temperature limit for application of NUC Table, in Kelvin +} onvif_NUCTable; + +typedef struct +{ + uint32 RunTimeFlag : 1; // Indicates whether the field RunTime is valid + uint32 Reserved : 31; + + BOOL Enabled; // required, Indicates whether the Cooler is enabled (running) or not + float RunTime; // optional, Number of hours the Cooler has been running (unit: hours). Read-only +} onvif_Cooler; + +typedef struct +{ + uint32 NUCTableFlag : 1; // Indicates whether the field NUCTable is valid + uint32 CoolerFlag : 1; // Indicates whether the field Cooler is valid + uint32 Reserved : 30; + + onvif_ColorPalette ColorPalette; // required, Current Color Palette in use by the Thermal Device + onvif_Polarity Polarity; // required, Polarity configuration of the Thermal Device + onvif_NUCTable NUCTable; // optional, Current Non-Uniformity Correction (NUC) Table in use by the Thermal Device + onvif_Cooler Cooler; // optional, Cooler settings of the Thermal Device +} onvif_ThermalConfiguration; + +typedef struct _ThermalConfigurationList +{ + struct _ThermalConfigurationList * next; + + char token[ONVIF_TOKEN_LEN]; // required, Reference token to the thermal VideoSource + + onvif_ThermalConfiguration Configuration; +} ThermalConfigurationList; + +typedef struct _ColorPaletteList +{ + struct _ColorPaletteList * next; + + onvif_ColorPalette ColorPalette; +} ColorPaletteList; + +typedef struct _NUCTableList +{ + struct _NUCTableList * next; + + onvif_NUCTable NUCTable; +} NUCTableList; + +typedef struct +{ + BOOL Enabled; // optional, Indicates the Device allows cooler status to be changed from running (Enabled) to stopped (Disabled), and viceversa +} onvif_CoolerOptions; + +typedef struct +{ + uint32 CoolerOptionsFlag : 1; // Indicates whether the field CoolerOptions is valid + uint32 Reserved : 31; + + ColorPaletteList * ColorPalette; // required, List of Color Palettes available for the requested Thermal VideoSource + NUCTableList * NUCTable; // optional, List of Non-Uniformity Correction (NUC) Tables available for the requested Thermal VideoSource + onvif_CoolerOptions CoolerOptions; // optional, Specifies Cooler Options for cooled thermal devices +} onvif_ThermalConfigurationOptions; + +typedef struct +{ + uint32 RelativeHumidityFlag : 1; // Indicates whether the field RelativeHumidity is valid + uint32 AtmosphericTemperatureFlag : 1; // Indicates whether the field AtmosphericTemperature is valid + uint32 AtmosphericTransmittanceFlag : 1; // Indicates whether the field AtmosphericTransmittance is valid + uint32 ExtOpticsTemperatureFlag : 1; // Indicates whether the field ExtOpticsTemperature is valid + uint32 ExtOpticsTransmittanceFlag : 1; // Indicates whether the field ExtOpticsTransmittance is valid + uint32 Reserved : 27; + + float ReflectedAmbientTemperature; // required, Reflected Ambient Temperature for the environment in which the thermal device and the object being measured is located + float Emissivity; // required, Emissivity of the surface of the object on which temperature is being measured + float DistanceToObject; // required, Distance from the thermal device to the measured object + float RelativeHumidity; // optional, Relative Humidity in the environment in which the measurement is located + float AtmosphericTemperature; // optional, Temperature of the atmosphere between the thermal device and the object being measured + float AtmosphericTransmittance; // optional, Transmittance value for the atmosphere between the thermal device and the object being measured + float ExtOpticsTemperature; // optional, Temperature of the optics elements between the thermal device and the object being measured + float ExtOpticsTransmittance; // optional, Transmittance value for the optics elements between the thermal device and the object being measured +} onvif_RadiometryGlobalParameters; + +typedef struct +{ + uint32 RadiometryGlobalParametersFlag : 1; // Indicates whether the field RadiometryGlobalParameters is valid + uint32 Reserved : 31; + + onvif_RadiometryGlobalParameters RadiometryGlobalParameters; // optional, Global Parameters for Radiometry Measurements. + // Shall exist if Radiometry Capability is reported, and Global Parameters are supported by the device +} onvif_RadiometryConfiguration; + +typedef struct +{ + uint32 RelativeHumidityFlag : 1; // Indicates whether the field RelativeHumidity is valid + uint32 AtmosphericTemperatureFlag : 1; // Indicates whether the field AtmosphericTemperature is valid + uint32 AtmosphericTransmittanceFlag : 1; // Indicates whether the field AtmosphericTransmittance is valid + uint32 ExtOpticsTemperatureFlag : 1; // Indicates whether the field ExtOpticsTemperature is valid + uint32 ExtOpticsTransmittanceFlag : 1; // Indicates whether the field ExtOpticsTransmittance is valid + uint32 Reserved : 27; + + onvif_FloatRange ReflectedAmbientTemperature; // required, Valid range of temperature values, in Kelvin + onvif_FloatRange Emissivity; // required, Valid range of emissivity values for the objects to measure + onvif_FloatRange DistanceToObject; // required, Valid range of distance between camera and object for a valid temperature reading, in meters + onvif_FloatRange RelativeHumidity; // optional, Valid range of relative humidity values, in percentage + onvif_FloatRange AtmosphericTemperature; // optional, Valid range of temperature values, in Kelvin + onvif_FloatRange AtmosphericTransmittance; // optional, Valid range of atmospheric transmittance values + onvif_FloatRange ExtOpticsTemperature; // optional, Valid range of temperature values, in Kelvin + onvif_FloatRange ExtOpticsTransmittance; // optional, Valid range of external optics transmittance +} onvif_RadiometryGlobalParameterOptions; + +typedef struct +{ + uint32 RadiometryGlobalParameterOptionsFlag : 1; // Indicates whether the field RadiometryGlobalParameterOptions is valid + uint32 Reserved : 31; + + onvif_RadiometryGlobalParameterOptions RadiometryGlobalParameterOptions; // optional, Specifies valid ranges and options for the global radiometry parameters + // used as default parameter values for temperature measurement modules (spots and boxes) +} onvif_RadiometryConfigurationOptions; + +// Thermal Define End + +// Credential define start + +typedef struct +{ + uint32 DescriptionFlag : 1; // Indicates whether the field Description is valid + uint32 ValidFromFlag : 1; // Indicates whether the field ValidFrom is valid + uint32 ValidToFlag : 1; // Indicates whether the field ValidTo is valid + uint32 Reserved : 29; + + char token[ONVIF_TOKEN_LEN]; // required, + char Description[1024]; // optional, User readable description for the credential. It shall be up to 1024 characters + char CredentialHolderReference[ONVIF_TOKEN_LEN]; // required, An external reference to a person holding this credential. + // The reference is a username or used ID in an external system, such as a directory + // service + char ValidFrom[64]; // optional, The start date/time validity of the credential. If the + // ValiditySupportsTimeValue capability is set to false, then only date is + // supported (time is ignored) + char ValidTo[64]; // optional, The expiration date/time validity of the credential. If the + // ValiditySupportsTimeValue capability is set to false, then only date is + // supported (time is ignored) +} onvif_CredentialInfo; + +typedef struct +{ + char Name[ONVIF_NAME_LEN]; // required, The name of the credential identifier type, such as pt:Card, pt:PIN, etc + char FormatType[100]; // required, Specifies the format of the credential value for the specified identifier type name +} onvif_CredentialIdentifierType; + +// A credential identifier is a card number, unique card information, PIN or +// biometric information such as fingerprint, iris, vein, face recognition, that can be validated +// in an access point +typedef struct +{ + BOOL Used; // used flag + + onvif_CredentialIdentifierType Type; // required, Contains the details of the credential identifier type. Is of type CredentialIdentifierType + + BOOL ExemptedFromAuthentication; // required, If set to true, this credential identifier is not considered for authentication + + char Value[2048]; // required, The value of the identifier in hexadecimal representation +} onvif_CredentialIdentifier; + +typedef struct +{ + onvif_CredentialIdentifierType Type; // required, Contains the details of the credential identifier type. Is of type CredentialIdentifierType + + char Value[2048]; // required, The value of the identifier in hexadecimal representation +} onvif_CredentialIdentifierItem; + +typedef struct _CredentialIdentifierItemList +{ + struct _CredentialIdentifierItemList * next; + + onvif_CredentialIdentifierItem Item; +} CredentialIdentifierItemList; + +// The association between a credential and an access profile +typedef struct +{ + uint32 Used : 1; // used flag + uint32 ValidFromFlag : 1; // Indicates whether the field ValidFrom is valid + uint32 ValidToFlag : 1; // Indicates whether the field ValidTo is valid + uint32 Reserved : 29; + + char AccessProfileToken[ONVIF_TOKEN_LEN]; // required, The reference token of the associated access profile + char ValidFrom[64]; // optional, The start date/time of the validity for the association between the + // credential and the access profile. If the ValiditySupportsTimeValue capability is set to + // false, then only date is supported (time is ignored) + char ValidTo[64]; // optional, The end date/time of the validity for the association between the + // credential and the access profile. If the ValiditySupportsTimeValue capability is set to + // false, then only date is supported (time is ignored) +} onvif_CredentialAccessProfile; + +typedef struct +{ + uint32 Used : 1; // used flag + uint32 ValueFlag : 1; // Indicates whether the field Value is valid + uint32 Reserved : 30; + + char Name[ONVIF_NAME_LEN]; // required, + char Value[100]; // optional, +} onvif_Attribute; + +// A Credential is a physical/tangible object, a piece of knowledge, or a facet of a person's +// physical being, that enables an individual access to a given physical facility or computer-based +// information system. A credential holds one or more credential identifiers. To gain access one or +// more identifiers may be required + +typedef struct +{ + uint32 DescriptionFlag : 1; // Indicates whether the field Description is valid + uint32 ValidFromFlag : 1; // Indicates whether the field ValidFrom is valid + uint32 ValidToFlag : 1; // Indicates whether the field ValidTo is valid + uint32 Reserved : 29; + + char token[ONVIF_TOKEN_LEN]; // required, + char Description[1024]; // optional, User readable description for the credential. It shall be up to 1024 characters + char CredentialHolderReference[ONVIF_TOKEN_LEN]; // required, An external reference to a person holding this credential. + // The reference is a username or used ID in an external system, such as a directory + // service + char ValidFrom[64]; // optional, The start date/time validity of the credential. If the + // ValiditySupportsTimeValue capability is set to false, then only date is + // supported (time is ignored) + char ValidTo[64]; // optional, The expiration date/time validity of the credential. If the + // ValiditySupportsTimeValue capability is set to false, then only date is + // supported (time is ignored) + + uint32 sizeCredentialIdentifier; // sequence of elements + onvif_CredentialIdentifier CredentialIdentifier[CREDENTIAL_MAX_LIMIT]; // required, A list of credential identifier structures. At least one + // credential identifier is required. Maximum one credential identifier structure + // per type is allowed + + uint32 sizeCredentialAccessProfile; // sequence of elements + onvif_CredentialAccessProfile CredentialAccessProfile[CREDENTIAL_MAX_LIMIT]; // optional, A list of credential access profile structures + + BOOL ExtendedGrantTime; // optional, A boolean indicating that the credential holder needs extra time to get through the door. + // ExtendedReleaseTime will be added to ReleaseTime, and ExtendedOpenTime will be added to OpenTime + + uint32 sizeAttribute; // sequence of elements + onvif_Attribute Attribute[CREDENTIAL_MAX_LIMIT]; // optional, A list of credential attributes as name value pairs. Key names + // starting with the prefix pt: are reserved to define PACS specific attributes + // following the "pt:" syntax +} onvif_Credential; + +typedef struct +{ + BOOL AntipassbackViolated; // required, Indicates if anti-passback is violated for the credential +} onvif_AntipassbackState; + +// The CredentialState structure contains information about the state of the credential and +// optionally the reason of why the credential was disabled + +typedef struct +{ + uint32 ReasonFlag : 1; // Indicates whether the field Reason is valid + uint32 AntipassbackStateFlag : 1; // Indicates whether the field AntipassbackState is valid + uint32 Reserved : 30; + + BOOL Enabled; // required, True if the credential is enabled or false if the credential is disabled + char Reason[100]; // optional, Predefined ONVIF reasons. For any other reason, free text can be used + // pt:CredentialLockedOut + // Access is denied due to credential locked out. + // pt:CredentialBlocked + // Access is denied because the credential has deliberately been blocked by the operator. + // pt:CredentialLost + // Access is denied due to the credential being reported as lost. + // pt:CredentialStolen + // Access is denied due to the credential being reported as stolen + // pt:CredentialDamaged + // Access is denied due to the credential being reported as damaged. + // pt:CredentialDestroyed + // Access is denied due to the credential being reported as destroyed + // pt:CredentialInactivity + // Access is denied due to credential inactivity + // pt:CredentialExpired + // Access is denied because the credential has expired + // pt:CredentialRenewalNeeded + // Access is denied because the credential requires a renewal (e.g. new PIN or + // fingerprint enrollment). + + onvif_AntipassbackState AntipassbackState; // optional, A structure indicating the anti-passback state. This field shall be + // supported if the ResetAntipassbackSupported capability is set to true +} onvif_CredentialState; + +typedef struct +{ + onvif_Credential Credential; // required, A format type supported by the device + onvif_CredentialState CredentialState; // required, User readable description of the credential identifier format type +} onvif_CredentialData; + +typedef struct +{ + char FormatType[100]; // required, A format type supported by the device. A list of supported format types is + // provided in [ISO 16484-5:2014-09 Annex P]. The BACnet type "CUSTOM" is not used. + // Instead device manufacturers can define their own format types + char Description[1024]; // required, User readable description of the credential identifier format type. It + // shall be up to 1024 characters +} onvif_CredentialIdentifierFormatTypeInfo; + +typedef struct _CredentialList +{ + struct _CredentialList * next; + + onvif_Credential Credential; + onvif_CredentialState State; +} CredentialList; + +// Credential define end + +// Access Rules define begin + +typedef struct +{ + uint32 DescriptionFlag : 1; // Indicates whether the field Description is valid + uint32 Reserved : 31; + + char token[ONVIF_TOKEN_LEN]; // required, + char Name[ONVIF_NAME_LEN]; // required, A user readable name. It shall be up to 64 characters + char Description[1024]; // optional, User readable description for the access profile. It shall be up to 1024 characters +} onvif_AccessProfileInfo; + +typedef struct +{ + uint32 EntityTypeFlag : 1; // Indicates whether the field EntityType is valid + uint32 Reserved : 31; + + char ScheduleToken[ONVIF_TOKEN_LEN]; // required, Reference to the schedule used by the access policy + char Entity[ONVIF_TOKEN_LEN]; // required, Reference to the entity used by the rule engine, + // the entity type may be specified by the optional EntityType field + // explained below but is typically an access point + char EntityType[64]; // optional, Optional entity type; if missing, an access point type as defined + // by the ONVIF Access Control service should be assumed. + // This can also be represented by the QName value tac:AccessPoint + // where tac is the namespace of Access Control Service Specification. + // This field is provided for future extensions; + // it will allow an access policy being extended to cover entity types + // other than access points as well +} onvif_AccessPolicy; + +typedef struct +{ + uint32 DescriptionFlag : 1; // Indicates whether the field Description is valid + uint32 Reserved : 31; + + char token[ONVIF_TOKEN_LEN]; // required, + char Name[ONVIF_NAME_LEN]; // required, A user readable name. It shall be up to 64 characters + char Description[1024]; // optional, User readable description for the access profile. It shall be up to 1024 characters + + uint32 sizeAccessPolicy; // sequence of elements + onvif_AccessPolicy AccessPolicy[ACCESSRULES_MAX_LIMIT]; // optional, A list of access policy structures, + // where each access policy defines during which schedule an access point can be accessed +} onvif_AccessProfile; + +typedef struct _AccessProfileList +{ + struct _AccessProfileList * next; + + onvif_AccessProfile AccessProfile; +} AccessProfileList; + + +// Access Rules define end + +// Schedule define begin + +typedef struct +{ + uint32 DescriptionFlag : 1; // Indicates whether the field Description is valid + uint32 Reserved : 31; + + char token[ONVIF_TOKEN_LEN]; // required + char Name[ONVIF_NAME_LEN]; // required, A user readable name. It shall be up to 64 characters + char Description[1024]; // optional, User readable description for the schedule. It shall be up to 1024 characters +} onvif_ScheduleInfo; + +typedef struct +{ + uint32 UntilFlag : 1; // Indicates whether the field Until is valid + uint32 Reserved : 31; + + char From[32]; // required, Indicates the start time + char Until[32]; // optional, Indicates the end time. Is optional, if omitted, the period ends at midnight. + // The end time is exclusive, meaning that that exact moment in time is not + // part of the period. To determine if a moment in time (t) is part of a time period, + // the formula StartTime ≤ t < EndTime is used. +} onvif_TimePeriod; + +typedef struct +{ + char GroupToken[ONVIF_TOKEN_LEN]; // required, Indicates the list of special days in a schedule + + uint32 sizeTimeRange; // sequence of elements + + onvif_TimePeriod TimeRange[SCHEDULE_MAX_LIMIT]; // optional, Indicates the alternate time periods for the list of special days + // (overrides the regular schedule). For example, the regular schedule indicates + // that it is active from 8AM to 5PM on Mondays. However, this particular + // Monday is a special day, and the alternate time periods state that the + // schedule is active from 9 AM to 11 AM and 1 PM to 4 PM. + // If no time periods are defined, then no access is allowed. + // Is of type TimePeriod +} onvif_SpecialDaysSchedule; + +typedef struct +{ + uint32 DescriptionFlag : 1; // Indicates whether the field Description is valid + uint32 Reserved : 31; + + char token[ONVIF_TOKEN_LEN]; // required + char Name[ONVIF_NAME_LEN]; // required, A user readable name. It shall be up to 64 characters + char Description[1024]; // optional, User readable description for the schedule. It shall be up to 1024 characters + char Standard[10*1024]; // required, An iCalendar structure that defines a number of events. Events + // can be recurring or non-recurring. The events can, for instance, + // be used to control when a camera should record or when a facility + // is accessible. Some devices might not be able to fully support + // all the features of iCalendar. Setting the service capability + // ExtendedRecurrenceSupported to false will enable more devices + // to be ONVIF compliant. Is of type string (but contains an iCalendar structure) + uint32 sizeSpecialDays; // sequence of elements + + onvif_SpecialDaysSchedule SpecialDays[SCHEDULE_MAX_LIMIT]; // optional, For devices that are not able to support all the features of iCalendar, + // supporting special days is essential. Each SpecialDaysSchedule + // instance defines an alternate set of time periods that overrides + // the regular schedule for a specified list of special days. + // Is of type SpecialDaysSchedule +} onvif_Schedule; + +typedef struct +{ + uint32 DescriptionFlag : 1; // Indicates whether the field Description is valid + uint32 Reserved : 31; + + char token[ONVIF_TOKEN_LEN]; // required + char Name[ONVIF_NAME_LEN]; // required, A user readable name. It shall be up to 64 characters + char Description[1024]; // optional, User readable description for the schedule. It shall be up to 1024 characters +} onvif_SpecialDayGroupInfo; + +typedef struct +{ + uint32 DescriptionFlag : 1; // Indicates whether the field Description is valid + uint32 DaysFlag : 1; // Indicates whether the field Days is valid + uint32 Reserved : 30; + + char token[ONVIF_TOKEN_LEN]; // required + char Name[ONVIF_NAME_LEN]; // required, A user readable name. It shall be up to 64 characters + char Description[1024]; // optional, User readable description for the schedule. It shall be up to 1024 characters + char Days[4*1024]; // optional, An iCalendar structure that contains a group of special days. + // Is of type string (containing an iCalendar structure) +} onvif_SpecialDayGroup; + +typedef struct +{ + uint32 SpecialDayFlag : 1; // Indicates whether the field SpecialDay is valid + uint32 Reserved : 31; + + BOOL Active; // required, Indicates that the current time is within the boundaries of the schedule + // or its special days schedules's time periods. For example, if this + // schedule is being used for triggering automatic recording on a video source, + // the Active flag will be true when the schedule-based recording is supposed to record + BOOL SpecialDay; // optional, Indicates that the current time is within the boundaries of its special + // days schedules's time periods. For example, if this schedule is being used + // for recording at a lower frame rate on a video source during special days, + // the SpecialDay flag will be true. If special days are not supported by the device, + // this field may be omitted and interpreted as false by the client +} onvif_ScheduleState; + +typedef struct _ScheduleList +{ + struct _ScheduleList * next; + + onvif_Schedule Schedule; + onvif_ScheduleState ScheduleState; + +#ifdef LIBICAL + icalcomponent * comp; +#endif +} ScheduleList; + +typedef struct _SpecialDayGroupList +{ + struct _SpecialDayGroupList * next; + + onvif_SpecialDayGroup SpecialDayGroup; + +#ifdef LIBICAL + icalcomponent * comp; +#endif +} SpecialDayGroupList; + +// Schedule define end + +// Receiver define begin + +typedef struct +{ + onvif_ReceiverMode Mode; // required, connection modes + char MediaUri[256]; // required, Details of the URI to which the receiver should connect + onvif_StreamSetup StreamSetup; // required, Stream connection parameters +} onvif_ReceiverConfiguration; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, Unique identifier of the receiver + + onvif_ReceiverConfiguration Configuration; // required, Describes the configuration of the receiver +} onvif_Receiver; + +typedef struct +{ + onvif_ReceiverState State; // required, The connection state of the receiver + + BOOL AutoCreated; // required, Indicates whether or not the receiver was created automatically +} onvif_ReceiverStateInformation; + +typedef struct _ReceiverList +{ + struct _ReceiverList * next; + + onvif_Receiver Receiver; + onvif_ReceiverStateInformation StateInformation; +} ReceiverList; + +// Receiver define end + +// Provision define begin + +typedef struct +{ + uint32 PanFlag : 1; // Indicates whether the field Pan is valid + uint32 TiltFlag : 1; // Indicates whether the field Tilt is valid + uint32 ZoomFlag : 1; // Indicates whether the field Zoom is valid + uint32 RollFlag : 1; // Indicates whether the field Roll is valid + uint32 FocusFlag : 1; // Indicates whether the field Focus is valid + uint32 Reserved : 27; + + int Pan; // optional, The quantity of pan movement events over the life of the device + int Tilt; // optional, The quantity of tilt movement events over the life of the device + int Zoom; // optional, The quantity of zoom movement events over the life of the device + int Roll; // optional, The quantity of roll movement events over the life of the device + int Focus; // optional, The quantity of focus movement events over the life of the device +} onvif_Usage; + +// Provision define end + +#ifdef __cplusplus +extern "C" { +#endif + + +HT_API const char * onvif_CapabilityCategoryToString(onvif_CapabilityCategory category); +HT_API onvif_CapabilityCategory onvif_StringToCapabilityCategory(const char * str); + +HT_API const char * onvif_FactoryDefaultTypeToString(onvif_FactoryDefaultType type); +HT_API onvif_FactoryDefaultType onvif_StringToFactoryDefaultType(const char * str); + +HT_API const char * onvif_SystemLogTypeToString(onvif_SystemLogType type); +HT_API onvif_SystemLogType onvif_StringToSystemLogType(const char * str); + +HT_API const char * onvif_VideoEncodingToString(onvif_VideoEncoding encoding); +HT_API onvif_VideoEncoding onvif_StringToVideoEncoding(const char * str); + +HT_API const char * onvif_AudioEncodingToString(onvif_AudioEncoding encoding); +HT_API onvif_AudioEncoding onvif_StringToAudioEncoding(const char * str); + +HT_API const char * onvif_H264ProfileToString(onvif_H264Profile profile); +HT_API onvif_H264Profile onvif_StringToH264Profile(const char * str); + +HT_API const char * onvif_Mpeg4ProfileToString(onvif_Mpeg4Profile profile); +HT_API onvif_Mpeg4Profile onvif_StringToMpeg4Profile(const char * str); + +HT_API const char * onvif_UserLevelToString(onvif_UserLevel level); +HT_API onvif_UserLevel onvif_StringToUserLevel(const char * str); + +HT_API const char * onvif_MoveStatusToString(onvif_MoveStatus status); +HT_API onvif_MoveStatus onvif_StringToMoveStatus(const char * str); + +HT_API const char * onvif_OSDTypeToString(onvif_OSDType type); +HT_API onvif_OSDType onvif_StringToOSDType(const char * type); + +HT_API const char * onvif_OSDPosTypeToString(onvif_OSDPosType type); +HT_API onvif_OSDPosType onvif_StringToOSDPosType(const char * type); + +HT_API const char * onvif_OSDTextTypeToString(onvif_OSDTextType type); +HT_API onvif_OSDTextType onvif_StringToOSDTextType(const char * type); + +HT_API const char * onvif_BacklightCompensationModeToString(onvif_BacklightCompensationMode mode); +HT_API onvif_BacklightCompensationMode onvif_StringToBacklightCompensationMode(const char * str); + +HT_API const char * onvif_ExposureModeToString(onvif_ExposureMode mode); +HT_API onvif_ExposureMode onvif_StringToExposureMode(const char * str); + +HT_API const char * onvif_ExposurePriorityToString(onvif_ExposurePriority mode); +HT_API onvif_ExposurePriority onvif_StringToExposurePriority(const char * str); + +HT_API const char * onvif_AutoFocusModeToString(onvif_AutoFocusMode mode); +HT_API onvif_AutoFocusMode onvif_StringToAutoFocusMode(const char * str); + +HT_API const char * onvif_WideDynamicModeToString(onvif_WideDynamicMode mode); +HT_API onvif_WideDynamicMode onvif_StringToWideDynamicMode(const char * str); + +HT_API const char * onvif_IrCutFilterModeToString(onvif_IrCutFilterMode mode); +HT_API onvif_IrCutFilterMode onvif_StringToIrCutFilterMode(const char * str); + +HT_API const char * onvif_WhiteBalanceModeToString(onvif_WhiteBalanceMode mode); +HT_API onvif_WhiteBalanceMode onvif_StringToWhiteBalanceMode(const char * str); + +HT_API const char * onvif_EFlipModeToString(onvif_EFlipMode mode); +HT_API onvif_EFlipMode onvif_StringToEFlipMode(const char * str); + +HT_API const char * onvif_ReverseModeToString(onvif_ReverseMode mode); +HT_API onvif_ReverseMode onvif_StringToReverseMode(const char * str); + +HT_API const char * onvif_DiscoveryModeToString(onvif_DiscoveryMode mode); +HT_API onvif_DiscoveryMode onvif_StringToDiscoveryMode(const char * str); + +HT_API const char * onvif_SetDateTimeTypeToString(onvif_SetDateTimeType type); +HT_API onvif_SetDateTimeType onvif_StringToSetDateTimeType(const char * str); + +HT_API const char * onvif_StreamTypeToString(onvif_StreamType type); +HT_API onvif_StreamType onvif_StringToStreamType(const char * str); + +HT_API const char * onvif_TransportProtocolToString(onvif_TransportProtocol type); +HT_API onvif_TransportProtocol onvif_StringToTransportProtocol(const char * str); + +HT_API const char * onvif_DynamicDNSTypeToString(onvif_DynamicDNSType type); +HT_API onvif_DynamicDNSType onvif_StringToDynamicDNSType(const char * str); + +HT_API const char * onvif_TrackTypeToString(onvif_TrackType type); +HT_API onvif_TrackType onvif_StringToTrackType(const char * str); + +HT_API const char * onvif_PropertyOperationToString(onvif_PropertyOperation type); +HT_API onvif_PropertyOperation onvif_StringToPropertyOperation(const char * str); + +HT_API const char * onvif_RecordingStatusToString(onvif_RecordingStatus status); +HT_API onvif_RecordingStatus onvif_StringToRecordingStatus(const char * str); + +HT_API const char * onvif_SearchStateToString(onvif_SearchState state); +HT_API onvif_SearchState onvif_StringToSearchState(const char * str); + +HT_API const char * onvif_RotateModeToString(onvif_RotateMode mode); +HT_API onvif_RotateMode onvif_StringToRotateMode(const char * str); + +HT_API const char * onvif_ScopeDefinitionToString(onvif_ScopeDefinition def); +HT_API onvif_ScopeDefinition onvif_StringToScopeDefinition(const char * str); + +HT_API const char * onvif_Dot11AuthAndMangementSuiteToString(onvif_Dot11AuthAndMangementSuite req); +HT_API onvif_Dot11AuthAndMangementSuite onvif_StringToDot11AuthAndMangementSuite(const char * str); + +HT_API const char * onvif_Dot11CipherToString(onvif_Dot11Cipher req); +HT_API onvif_Dot11Cipher onvif_StringToDot11Cipher(const char * str); + +HT_API const char * onvif_Dot11SignalStrengthToString(onvif_Dot11SignalStrength req); +HT_API onvif_Dot11SignalStrength onvif_StringToDot11SignalStrength(const char * str); + +HT_API const char * onvif_Dot11StationModeToString(onvif_Dot11StationMode req); +HT_API onvif_Dot11StationMode onvif_StringToDot11StationMode(const char * str); + +HT_API const char * onvif_Dot11SecurityModeToString(onvif_Dot11SecurityMode req); +HT_API onvif_Dot11SecurityMode onvif_StringToDot11SecurityMode(const char * str); + +HT_API const char * onvif_PTZPresetTourOperationToString(onvif_PTZPresetTourOperation op); +HT_API onvif_PTZPresetTourOperation onvif_StringToPTZPresetTourOperation(const char * str); + +HT_API const char * onvif_PTZPresetTourStateToString(onvif_PTZPresetTourState st); +HT_API onvif_PTZPresetTourState onvif_StringToPTZPresetTourState(const char * str); + +HT_API const char * onvif_PTZPresetTourDirectionToString(onvif_PTZPresetTourDirection dir); +HT_API onvif_PTZPresetTourDirection onvif_StringToPTZPresetTourDirection(const char * str); + +HT_API const char * onvif_DoorPhysicalStateToString(onvif_DoorPhysicalState state); +HT_API onvif_DoorPhysicalState onvif_StringToDoorPhysicalState(const char * str); + +HT_API const char * onvif_LockPhysicalStateToString(onvif_LockPhysicalState state); +HT_API onvif_LockPhysicalState onvif_StringToLockPhysicalState(const char * str); + +HT_API const char * onvif_DoorAlarmStateToString(onvif_DoorAlarmState state); +HT_API onvif_DoorAlarmState onvif_StringToDoorAlarmState(const char * str); + +HT_API const char * onvif_DoorTamperStateToString(onvif_DoorTamperState state); +HT_API onvif_DoorTamperState onvif_StringToDoorTamperState(const char * str); + +HT_API const char * onvif_DoorFaultStateToString(onvif_DoorFaultState state); +HT_API onvif_DoorFaultState onvif_StringToDoorFaultState(const char * str); + +HT_API const char * onvif_DoorModeToString(onvif_DoorMode mode); +HT_API onvif_DoorMode onvif_StringToDoorMode(const char * str); + +HT_API const char * onvif_RelayModeToString(onvif_RelayMode mode); +HT_API onvif_RelayMode onvif_StringToRelayMode(const char * str); + +HT_API const char * onvif_RelayIdleStateToString(onvif_RelayIdleState state); +HT_API onvif_RelayIdleState onvif_StringToRelayIdleState(const char * str); + +HT_API const char * onvif_RelayLogicalStateToString(onvif_RelayLogicalState state); +HT_API onvif_RelayLogicalState onvif_StringToRelayLogicalState(const char * str); + +HT_API const char * onvif_DigitalIdleStateToString(onvif_DigitalIdleState state); +HT_API onvif_DigitalIdleState onvif_StringToDigitalIdleState(const char * str); + +HT_API const char * onvif_ParityBitToString(onvif_ParityBit type); +HT_API onvif_ParityBit onvif_StringToParityBit(const char * str); + +HT_API const char * onvif_SerialPortTypeToString(onvif_SerialPortType type); +HT_API onvif_SerialPortType onvif_StringToSerialPortType(const char * str); + +HT_API const char * onvif_PolarityToString(onvif_Polarity type); +HT_API onvif_Polarity onvif_StringToPolarity(const char * str); + +HT_API const char * onvif_ReceiverModeToString(onvif_ReceiverMode mode); +HT_API onvif_ReceiverMode onvif_StringToReceiverMode(const char * str); + +HT_API const char * onvif_ReceiverStateToString(onvif_ReceiverState state); +HT_API onvif_ReceiverState onvif_StringToReceiverState(const char * str); + +HT_API const char * onvif_IPAddressFilterTypeToString(onvif_IPAddressFilterType type); +HT_API onvif_IPAddressFilterType onvif_StringToIPAddressFilterType(const char * str); + +HT_API const char * onvif_PanDirectionToString(onvif_PanDirection dir); +HT_API onvif_PanDirection onvif_StringToPanDirection(const char * str); +HT_API const char * onvif_TiltDirectionToString(onvif_TiltDirection dir); +HT_API onvif_TiltDirection onvif_StringToTiltDirection(const char * str); +HT_API const char * onvif_ZoomDirectionToString(onvif_ZoomDirection dir); +HT_API onvif_ZoomDirection onvif_StringToZoomDirection(const char * str); +HT_API const char * onvif_RollDirectionToString(onvif_RollDirection dir); +HT_API onvif_RollDirection onvif_StringToRollDirection(const char * str); +HT_API const char * onvif_FocusDirectionToString(onvif_FocusDirection dir); +HT_API onvif_FocusDirection onvif_StringToFocusDirection(const char * str); + + +#ifdef __cplusplus +} +#endif + +#endif /* end of ONVIF_COMM_H */ + + + + + diff --git a/MediaClient/MediaClient/onvif/onvif_event.h b/MediaClient/MediaClient/onvif/onvif_event.h new file mode 100644 index 0000000..77a5b40 --- /dev/null +++ b/MediaClient/MediaClient/onvif/onvif_event.h @@ -0,0 +1,117 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef ONVIF_EVENT_H +#define ONVIF_EVENT_H + +#include "sys_inc.h" +#include "onvif.h" +#include "xml_node.h" +#include "onvif_req.h" +#include "http.h" + +typedef struct +{ + BOOL used_flag; + + ONVIF_DEVICE * p_dev; +} ONVIF_TIMER_DEV; + +typedef void (* onvif_event_notify_cb)(Notify_REQ * p_req, void * pdata); +typedef void (* onvif_subscribe_disconnect_cb)(ONVIF_DEVICE * p_dev, void * pdata); + +typedef struct +{ + onvif_event_notify_cb notify_cb; + void * notify_cb_data; + void * notify_cb_mutex; + + onvif_subscribe_disconnect_cb disconnect_cb; + void * disconnect_cb_data; + void * disconnect_cb_mutex; + + HTTPSRV http_srv; // http server for receiving event notify + pthread_t event_timer_id; + int event_timer_run; + PPSN_CTX * event_dev_fl; + PPSN_CTX * event_dev_ul; + int event_dev_max; +} ONVIF_EVENT_CLS; + + +#ifdef __cplusplus +extern "C" { +#endif + + +/** + * init event handler + * + * init http server for receiving event notify messages + * + * http_srv_addr : http server listen address, NULL means listening on all interfaces + * http_srv_port : http server listen port + * max_clients : max support client numbers + * + */ +HT_API BOOL onvif_event_init(const char * http_srv_addr, uint16 http_srv_port, int max_clients); + +/** + * deinit event handler + */ +HT_API void onvif_event_deinit(); + +/** + * set event notify callback + * + * set cb to NULL, disable callback + */ +HT_API void onvif_set_event_notify_cb(onvif_event_notify_cb cb, void * pdata); + +/** + * set event subscribe disconnect callback + * + * set cb to NULL, disable callback + */ +HT_API void onvif_set_subscribe_disconnect_cb(onvif_subscribe_disconnect_cb cb, void * pdata); + +/** + * event notify handler, called by http_soap_process + */ +HT_API void onvif_event_notify(HTTPCLN * p_user, HTTPMSG * rx_msg, XMLN * p_xml); + +/** + * add p_dev to event timer list, send renew request + */ +HT_API BOOL onvif_event_timer_add(ONVIF_DEVICE * p_dev); + +/** + * del p_dev from event timer list + */ +HT_API BOOL onvif_event_timer_del(ONVIF_DEVICE * p_dev); + +#ifdef __cplusplus +} +#endif + + +#endif + + + diff --git a/MediaClient/MediaClient/onvif/onvif_http.h b/MediaClient/MediaClient/onvif/onvif_http.h new file mode 100644 index 0000000..a444aaf --- /dev/null +++ b/MediaClient/MediaClient/onvif/onvif_http.h @@ -0,0 +1,41 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef ONVIF_HTTP_H +#define ONVIF_HTTP_H + +#include "onvif.h" +#include "http.h" + +#ifdef __cplusplus +extern "C" { +#endif + +HT_API BOOL http_onvif_trans(HTTPREQ * p_http, int timeout, eOnvifAction act, ONVIF_DEVICE * p_dev, void * p_req, void * p_res); +HT_API BOOL http_onvif_file_upload(HTTPREQ * p_http, int timeout, const char * filename, ONVIF_DEVICE * p_dev); +HT_API BOOL http_onvif_download(HTTPREQ * p_http, int timeout, uint8 ** pp_buf, int * buflen, ONVIF_DEVICE * p_dev); + +#ifdef __cplusplus +} +#endif + +#endif + + + diff --git a/MediaClient/MediaClient/onvif/onvif_pkt.h b/MediaClient/MediaClient/onvif/onvif_pkt.h new file mode 100644 index 0000000..29e0b76 --- /dev/null +++ b/MediaClient/MediaClient/onvif/onvif_pkt.h @@ -0,0 +1,38 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef ONVIF_PKT_H +#define ONVIF_PKT_H + +#include "sys_inc.h" +#include "onvif.h" + +#ifdef __cplusplus +extern "C" { +#endif + +int build_onvif_req_xml(char * p_buf, int mlen, eOnvifAction type, ONVIF_DEVICE * p_dev, void * p_req); + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/MediaClient/MediaClient/onvif/onvif_probe.h b/MediaClient/MediaClient/onvif/onvif_probe.h new file mode 100644 index 0000000..be01d15 --- /dev/null +++ b/MediaClient/MediaClient/onvif/onvif_probe.h @@ -0,0 +1,123 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef __H_ONVIF_PROBE_H__ +#define __H_ONVIF_PROBE_H__ + +#include "onvif.h" + +#define PROBE_MSGTYPE_MATCH 0 +#define PROBE_MSGTYPE_HELLO 1 +#define PROBE_MSGTYPE_BYE 2 + +#define MAX_PROBE_FD 8 + +/* + * onvif probe callback function + * p_res : the DEVICE_BINFO struct point + * pdata : the user data + * msgypte : + * PROBE_MSGTYPE_MATCH - probe match + * PROBE_MSGTYPE_HELLO - hello + * PROBE_MSGTYPE_BYE - bye + * note : if msgtype = PROBE_MSGTYPE_BYE, only p_res->EndpointReference field is valid, the other fields is invalid + */ +typedef void (* onvif_probe_cb)(DEVICE_BINFO * p_res, int msgtype, void * pdata); + +typedef struct +{ + onvif_probe_cb probe_cb; + void * probe_cb_data; + void * probe_mutex; + pthread_t probe_thread; + SOCKET probe_fd[MAX_PROBE_FD]; + int probe_interval; + BOOL probe_running; + char monitor_reference[100]; + int monitor_msgtype; + onvif_probe_cb monitor_cb; + void * monitor_cb_data; + void * monitor_mutex; +} ONVIF_PROBE_CLS; + + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @desc, set monitor callback function + * + * @param, + * reference - endpoint reference + * msgtype - probe message type + * cb - callback function + * pdata - user data + * +**/ +HT_API void set_monitor_cb(char * reference, int msgtype, onvif_probe_cb cb, void * pdata); + +/** + * @desc, set probe callback function + * + * @param, + * cb - callback function + * pdata - user data + * +**/ +HT_API void set_probe_cb(onvif_probe_cb cb, void * pdata); + +/** + * @desc, set probe interval + * + * @param, + * interval - probe interval, unit is second, default is 30s + * +**/ +HT_API void set_probe_interval(int interval); + +/** + * @desc, start probe thread + * + * @param, + * ip - start probe thread on the specify ip address, it can be NULL, if ip is NULL, it will use the default ip + * interval - probe interval, unit is second, default is 30s +**/ +HT_API int start_probe(const char * ip, int interval); + +/** + * @desc, stop probe thread + * +**/ +HT_API void stop_probe(); + +/** + * @desc, send probe request + * +**/ +HT_API void send_probe_req(); + + +#ifdef __cplusplus +} +#endif + +#endif // __H_ONVIF_PROBE_H__ + + diff --git a/MediaClient/MediaClient/onvif/onvif_req.h b/MediaClient/MediaClient/onvif/onvif_req.h new file mode 100644 index 0000000..a00edcf --- /dev/null +++ b/MediaClient/MediaClient/onvif/onvif_req.h @@ -0,0 +1,2596 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef ONVIF_REQ_H +#define ONVIF_REQ_H + + +/************************************************************************* + * + * onvif request structure + * +**************************************************************************/ + +typedef struct +{ + onvif_CapabilityCategory Category; // optional, List of categories to retrieve capability information on +} tds_GetCapabilities_REQ; + +typedef struct +{ + BOOL IncludeCapability; // required, Indicates if the service capabilities (untyped) should be included in the response. +} tds_GetServices_REQ; + +typedef struct +{ + int dummy; +} tds_GetServiceCapabilities_REQ; + +typedef struct +{ + int dummy; +} tds_GetDeviceInformation_REQ; + +typedef struct +{ + int dummy; +} tds_GetUsers_REQ; + +typedef struct +{ + onvif_User User; // required +} tds_CreateUsers_REQ; + +typedef struct +{ + char Username[ONVIF_NAME_LEN]; // required +} tds_DeleteUsers_REQ; + +typedef struct +{ + onvif_User User; // required +} tds_SetUser_REQ; + +typedef struct +{ + int dummy; +} tds_GetRemoteUser_REQ; + +typedef struct +{ + uint32 RemoteUserFlag : 1; // Indicates whether the field RemoteUser is valid + uint32 Reserved : 31; + + onvif_RemoteUser RemoteUser; // optional +} tds_SetRemoteUser_REQ; + +typedef struct +{ + int dummy; +} tds_GetNetworkInterfaces_REQ; + +typedef struct +{ + onvif_NetworkInterface NetworkInterface; +} tds_SetNetworkInterfaces_REQ; + +typedef struct +{ + int dummy; +} tds_GetNTP_REQ; + +typedef struct +{ + onvif_NTPInformation NTPInformation; +} tds_SetNTP_REQ; + +typedef struct +{ + int dummy; +} tds_GetHostname_REQ; + +typedef struct +{ + char Name[ONVIF_NAME_LEN]; // required +} tds_SetHostname_REQ; + +typedef struct +{ + BOOL FromDHCP; // required, True if the hostname shall be obtained via DHCP +} tds_SetHostnameFromDHCP_REQ; + +typedef struct +{ + int dummy; +} tds_GetDNS_REQ; + +typedef struct +{ + onvif_DNSInformation DNSInformation; +} tds_SetDNS_REQ; + +typedef struct +{ + int dummy; +} tds_GetDynamicDNS_REQ; + +typedef struct +{ + onvif_DynamicDNSInformation DynamicDNSInformation; +} tds_SetDynamicDNS_REQ; + +typedef struct +{ + int dummy; +} tds_GetNetworkProtocols_REQ; + +typedef struct +{ + onvif_NetworkProtocol NetworkProtocol; +} tds_SetNetworkProtocols_REQ; + +typedef struct +{ + int dummy; +} tds_GetDiscoveryMode_REQ; + +typedef struct +{ + onvif_DiscoveryMode DiscoveryMode; // required, Indicator of discovery mode: Discoverable, NonDiscoverable +} tds_SetDiscoveryMode_REQ; + +typedef struct +{ + int dummy; +} tds_GetNetworkDefaultGateway_REQ; + +typedef struct +{ + char IPv4Address[MAX_GATEWAY][32]; // optional, Sets IPv4 gateway address used as default setting +} tds_SetNetworkDefaultGateway_REQ; + +typedef struct +{ + int dummy; +} tds_GetZeroConfiguration_REQ; + +typedef struct +{ + char InterfaceToken[ONVIF_TOKEN_LEN]; // requied, Unique identifier referencing the physical interface + BOOL Enabled; // requied, Specifies if the zero-configuration should be enabled or not +} tds_SetZeroConfiguration_REQ; + +typedef struct +{ + int dummy; +} tds_GetEndpointReference_REQ; + +typedef struct +{ + char AuxiliaryCommand[1024]; // required +} tds_SendAuxiliaryCommand_REQ; + +typedef struct +{ + int dummy; +} tds_GetRelayOutputs_REQ; + +typedef struct +{ + char RelayOutputToken[ONVIF_TOKEN_LEN]; // required + + onvif_RelayOutputSettings Properties; // required +} tds_SetRelayOutputSettings_REQ; + +typedef struct +{ + char RelayOutputToken[ONVIF_TOKEN_LEN]; // required + + onvif_RelayLogicalState LogicalState; // required +} tds_SetRelayOutputState_REQ; + +typedef struct +{ + int dummy; +} tds_GetSystemDateAndTime_REQ; + +typedef struct +{ + uint32 UTCDateTimeFlag : 1; // Indicates whether the field UTCDateTime is valid + uint32 Reserved : 31; + + onvif_SystemDateTime SystemDateTime; // required, + onvif_DateTime UTCDateTime; // optional, Date and time in UTC. If time is obtained via NTP, UTCDateTime has no meaning +} tds_SetSystemDateAndTime_REQ; + +typedef struct +{ + int dummy; +} tds_SystemReboot_REQ; + +typedef struct +{ + onvif_FactoryDefaultType FactoryDefault; // required +} tds_SetSystemFactoryDefault_REQ; + +typedef struct +{ + onvif_SystemLogType LogType; // required, Specifies the type of system log to get +} tds_GetSystemLog_REQ; + +typedef struct +{ + int dummy; +} tds_GetScopes_REQ; + +typedef struct +{ + int sizeScopes; + char Scopes[MAX_SCOPE_NUMS][100]; +} tds_SetScopes_REQ; + +typedef struct +{ + int sizeScopeItem; + char ScopeItem[MAX_SCOPE_NUMS][100]; // required +} tds_AddScopes_REQ; + +typedef struct +{ + int sizeScopeItem; + char ScopeItem[MAX_SCOPE_NUMS][100]; // required +} tds_RemoveScopes_REQ; + +typedef struct +{ + int dummy; +} tds_StartFirmwareUpgrade_REQ; + +typedef struct +{ + int dummy; +} tds_GetSystemUris_REQ; + +typedef struct +{ + int dummy; +} tds_StartSystemRestore_REQ; + +typedef struct +{ + int dummy; +} tds_GetWsdlUrl_REQ; + +typedef struct +{ + int dummy; +} tds_GetDot11Capabilities_REQ; + +typedef struct +{ + char InterfaceToken[ONVIF_TOKEN_LEN]; // required +} tds_GetDot11Status_REQ; + +typedef struct +{ + char InterfaceToken[ONVIF_TOKEN_LEN]; // required +} tds_ScanAvailableDot11Networks_REQ; + +typedef struct +{ + int dummy; +} tds_GetGeoLocation_REQ; + +typedef struct +{ + LocationEntityList * Location; // required +} tds_SetGeoLocation_REQ; + +typedef struct +{ + LocationEntityList * Location; // required +} tds_DeleteGeoLocation_REQ; + +typedef struct +{ + char Algorithm[64]; // required, Hashing algorithm(s) used in HTTP and RTSP Digest Authentication +} tds_SetHashingAlgorithm_REQ; + +typedef struct +{ + int dummy; +} tds_GetIPAddressFilter_REQ; + +typedef struct +{ + onvif_IPAddressFilter IPAddressFilter; // required +} tds_SetIPAddressFilter_REQ; + +typedef struct +{ + onvif_IPAddressFilter IPAddressFilter; // required +} tds_AddIPAddressFilter_REQ; + +typedef struct +{ + onvif_IPAddressFilter IPAddressFilter; // required +} tds_RemoveIPAddressFilter_REQ; + +typedef struct +{ + int dummy; +} tds_GetAccessPolicy_REQ; + +typedef struct +{ + onvif_BinaryData PolicyFile; // required +} tds_SetAccessPolicy_REQ; + +typedef struct +{ + int dummy; +} tds_GetStorageConfigurations_REQ; + +typedef struct +{ + onvif_StorageConfigurationData StorageConfiguration; // required +} tds_CreateStorageConfiguration_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required +} tds_GetStorageConfiguration_REQ; + +typedef struct +{ + onvif_StorageConfiguration StorageConfiguration; // required +} tds_SetStorageConfiguration_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required +} tds_DeleteStorageConfiguration_REQ; + +typedef struct +{ + int dummy; +} trt_GetServiceCapabilities_REQ; + +typedef struct +{ + int dummy; +} trt_GetVideoSources_REQ; + +typedef struct +{ + int dummy; +} trt_GetAudioSources_REQ; + +typedef struct +{ + uint32 TokenFlag : 1; // Indicates whether the field Token is valid + uint32 Reserved : 31; + + char Name[ONVIF_NAME_LEN]; // required, friendly name of the profile to be created + char Token[ONVIF_TOKEN_LEN]; // optional, Optional token, specifying the unique identifier of the new profile +} trt_CreateProfile_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, this command requests a specific profile +} trt_GetProfile_REQ; + +typedef struct +{ + int dummy; +} trt_GetProfiles_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, Reference to the profile where the configuration should be added + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Contains a reference to the VideoEncoderConfiguration to add +} trt_AddVideoEncoderConfiguration_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, Reference to the profile where the configuration should be added + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Contains a reference to the VideoEncoderConfiguration to add +} trt_AddVideoSourceConfiguration_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, Reference to the profile where the configuration should be added + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Contains a reference to the VideoEncoderConfiguration to add +} trt_AddAudioEncoderConfiguration_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, Reference to the profile where the configuration should be added + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Contains a reference to the VideoEncoderConfiguration to add +} trt_AddAudioSourceConfiguration_REQ; + +typedef struct +{ + char VideoSourceToken[ONVIF_TOKEN_LEN]; // required, Contains a video source reference for which a video source mode is requested +} trt_GetVideoSourceModes_REQ; + +typedef struct +{ + char VideoSourceToken[ONVIF_TOKEN_LEN]; // required, Contains a video source reference for which a video source mode is requested + char VideoSourceModeToken[ONVIF_TOKEN_LEN]; // required, Indicate video source mode +} trt_SetVideoSourceMode_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, Reference to the profile where the configuration should be added + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Contains a reference to the VideoEncoderConfiguration to add +} trt_AddPTZConfiguration_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, Contains a reference to the media profile from which the VideoEncoderConfiguration shall be removed +} trt_RemoveVideoEncoderConfiguration_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, Contains a reference to the media profile from which the VideoSourceConfiguration shall be removed +} trt_RemoveVideoSourceConfiguration_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, Contains a reference to the media profile from which the AudioEncoderConfiguration shall be removed +} trt_RemoveAudioEncoderConfiguration_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, Contains a reference to the media profile from which the AudioSourceConfiguration shall be removed +} trt_RemoveAudioSourceConfiguration_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, Contains a reference to the media profile from which the PTZConfiguration shall be removed +} trt_RemovePTZConfiguration_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, This element contains a reference to the profile that should be deleted +} trt_DeleteProfile_REQ; + +typedef struct +{ + int dummy; +} trt_GetVideoSourceConfigurations_REQ; + +typedef struct +{ + int dummy; +} trt_GetVideoEncoderConfigurations_REQ; + +typedef struct +{ + int dummy; +} trt_GetAudioSourceConfigurations_REQ; + +typedef struct +{ + int dummy; +} trt_GetAudioEncoderConfigurations_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Token of the requested video source configuration +} trt_GetVideoSourceConfiguration_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Token of the requested video encoder configuration +} trt_GetVideoEncoderConfiguration_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Token of the requested audio source configuration +} trt_GetAudioSourceConfiguration_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Token of the requested audio encoder configuration +} trt_GetAudioEncoderConfiguration_REQ; + +typedef struct +{ + onvif_VideoSourceConfiguration VideoSourceConfiguration; + + BOOL ForcePersistence; // required, The ForcePersistence element is obsolete and should always be assumed to be true +} trt_SetVideoSourceConfiguration_REQ; + +typedef struct +{ + onvif_VideoEncoderConfiguration VideoEncoderConfiguration; + + BOOL ForcePersistence; // required, The ForcePersistence element is obsolete and should always be assumed to be true +} trt_SetVideoEncoderConfiguration_REQ; + +typedef struct +{ + onvif_AudioSourceConfiguration AudioSourceConfiguration; + + BOOL ForcePersistence; // required, The ForcePersistence element is obsolete and should always be assumed to be true +} trt_SetAudioSourceConfiguration_REQ; + +typedef struct +{ + onvif_AudioEncoderConfiguration AudioEncoderConfiguration; + + BOOL ForcePersistence; // required, The ForcePersistence element is obsolete and should always be assumed to be true +} trt_SetAudioEncoderConfiguration_REQ; + +typedef struct +{ + uint32 ProfileTokenFlag : 1; // Indicates whether the field ProfileToken is valid + uint32 ConfigurationTokenFlag : 1; // Indicates whether the field ConfigurationToken is valid + uint32 Reserved : 30; + + char ProfileToken[ONVIF_TOKEN_LEN]; // optional, Optional ProfileToken that specifies an existing media profile that the options shall be compatible with + char ConfigurationToken[ONVIF_TOKEN_LEN]; // optional, Optional video source configurationToken that specifies an existing configuration that the options are intended for +} trt_GetVideoSourceConfigurationOptions_REQ; + +typedef struct +{ + uint32 ProfileTokenFlag : 1; // Indicates whether the field ProfileToken is valid + uint32 ConfigurationTokenFlag : 1; // Indicates whether the field ConfigurationToken is valid + uint32 Reserved : 30; + + char ProfileToken[ONVIF_TOKEN_LEN]; // optional, Optional ProfileToken that specifies an existing media profile that the options shall be compatible with + char ConfigurationToken[ONVIF_TOKEN_LEN]; // optional, Optional video encoder configuration token that specifies an existing configuration that the options are intended for +} trt_GetVideoEncoderConfigurationOptions_REQ; + +typedef struct +{ + uint32 ProfileTokenFlag : 1; // Indicates whether the field ProfileToken is valid + uint32 ConfigurationTokenFlag : 1; // Indicates whether the field ConfigurationToken is valid + uint32 Reserved : 30; + + char ProfileToken[ONVIF_TOKEN_LEN]; // optional, Optional ProfileToken that specifies an existing media profile that the options shall be compatible with + char ConfigurationToken[ONVIF_TOKEN_LEN]; // optional, Optional audio source configuration token that specifies an existing configuration that the options are intended for +} trt_GetAudioSourceConfigurationOptions_REQ; + +typedef struct +{ + uint32 ProfileTokenFlag : 1; // Indicates whether the field ProfileToken is valid + uint32 ConfigurationTokenFlag : 1; // Indicates whether the field ConfigurationToken is valid + uint32 Reserved : 30; + + char ProfileToken[ONVIF_TOKEN_LEN]; // optional, Optional ProfileToken that specifies an existing media profile that the options shall be compatible with + char ConfigurationToken[ONVIF_TOKEN_LEN]; // optional, Optional audio encoder configuration token that specifies an existing configuration that the options are intended for +} trt_GetAudioEncoderConfigurationOptions_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, The ProfileToken element indicates the media profile to use and will define the configuration of the content of the stream + + onvif_StreamSetup StreamSetup; // required, Stream Setup that should be used with the uri +} trt_GetStreamUri_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, Contains a Profile reference for which a Synchronization Point is requested +} trt_SetSynchronizationPoint_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, The ProfileToken element indicates the media profile to use and will define the source and dimensions of the snapshot +} trt_GetSnapshotUri_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Token of the video source configuration +} trt_GetGuaranteedNumberOfVideoEncoderInstances_REQ; + +typedef struct +{ + int dummy; +} trt_GetAudioOutputs_REQ; + +typedef struct +{ + int dummy; +} trt_GetAudioOutputConfigurations_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Token of the requested audio output configuration +} trt_GetAudioOutputConfiguration_REQ; + +typedef struct +{ + uint32 ConfigurationTokenFlag : 1; // Indicates whether the field ConfigurationToken is valid + uint32 ProfileTokenFlag : 1; // Indicates whether the field ProfileToken is valid + uint32 Reserved : 30; + + char ConfigurationToken[ONVIF_TOKEN_LEN]; // optional, Optional audio output configuration token that specifies an existing configuration that the options are intended for + char ProfileToken[ONVIF_TOKEN_LEN]; // optional, Optional ProfileToken that specifies an existing media profile that the options shall be compatible with +} trt_GetAudioOutputConfigurationOptions_REQ; + +typedef struct +{ + onvif_AudioOutputConfiguration Configuration; // required, Contains the modified audio output configuration. The configuration shall exist in the device + + BOOL ForcePersistence; // required, The ForcePersistence element is obsolete and should always be assumed to be true +} trt_SetAudioOutputConfiguration_REQ; + +typedef struct +{ + int dummy; +} trt_GetAudioDecoderConfigurations_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Token of the requested audio decoder configuration +} trt_GetAudioDecoderConfiguration_REQ; + +typedef struct +{ + uint32 ConfigurationTokenFlag : 1; // Indicates whether the field ConfigurationToken is valid + uint32 ProfileTokenFlag : 1; // Indicates whether the field ProfileToken is valid + uint32 Reserved : 30; + + char ConfigurationToken[ONVIF_TOKEN_LEN]; // optional, Optional audio decoder configuration token that specifies an existing configuration that the options are intended for + char ProfileToken[ONVIF_TOKEN_LEN]; // optional, Optional ProfileToken that specifies an existing media profile that the options shall be compatible with +} trt_GetAudioDecoderConfigurationOptions_REQ; + +typedef struct +{ + onvif_AudioDecoderConfiguration Configuration; // required, Contains the modified audio decoder configuration. The configuration shall exist in the device + + BOOL ForcePersistence; // required, The ForcePersistence element is obsolete and should always be assumed to be true +} trt_SetAudioDecoderConfiguration_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, Reference to the profile where the configuration should be added + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Contains a reference to the AudioOutputConfiguration to add +} trt_AddAudioOutputConfiguration_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, This element contains a reference to the profile where the configuration should be added + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, This element contains a reference to the AudioDecoderConfiguration to add +} trt_AddAudioDecoderConfiguration_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, Contains a reference to the media profile from which the AudioOutputConfiguration shall be removed +} trt_RemoveAudioOutputConfiguration_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, This element contains a reference to the media profile from which the AudioDecoderConfiguration shall be removed +} trt_RemoveAudioDecoderConfiguration_REQ; + +typedef struct +{ + uint32 ConfigurationTokenFlag : 1; // Indicates whether the field ConfigurationToken is valid + uint32 Reserved : 31; + + char ConfigurationToken[ONVIF_TOKEN_LEN]; // optional, Token of the Video Source Configuration, which has OSDs associated with are requested. If token not exist, request all available OSDs +} trt_GetOSDs_REQ; + +typedef struct +{ + char OSDToken[ONVIF_TOKEN_LEN]; // required, The GetOSD command fetches the OSD configuration if the OSD token is known +} trt_GetOSD_REQ; + +typedef struct +{ + onvif_OSDConfiguration OSD; // required, Contains the modified OSD configuration +} trt_SetOSD_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Video Source Configuration Token that specifies an existing video source configuration that the options shall be compatible with +} trt_GetOSDOptions_REQ; + +typedef struct +{ + onvif_OSDConfiguration OSD; // required, Contain the initial OSD configuration for create +} trt_CreateOSD_REQ; + +typedef struct +{ + char OSDToken[ONVIF_TOKEN_LEN]; // required, This element contains a reference to the OSD configuration that should be deleted +} trt_DeleteOSD_REQ; + + +typedef struct +{ + int dummy; +} trt_GetVideoAnalyticsConfigurations_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, Reference to the profile where the configuration should be added + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Contains a reference to the VideoAnalyticsConfiguration to add +} trt_AddVideoAnalyticsConfiguration_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, The requested video analytics configuration +} trt_GetVideoAnalyticsConfiguration_REQ; + +typedef struct +{ + onvif_VideoAnalyticsConfiguration Configuration; // required, Contains the modified video analytics configuration. The configuration shall exist in the device + + BOOL ForcePersistence; // required, The ForcePersistence element is obsolete and should always be assumed to be true +} trt_SetVideoAnalyticsConfiguration_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, Contains a reference to the media profile from which the VideoAnalyticsConfiguration shall be removed +} trt_RemoveVideoAnalyticsConfiguration_REQ; + +typedef struct +{ + int dummy; +} trt_GetMetadataConfigurations_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, Reference to the profile where the configuration should be added + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Contains a reference to the MetadataConfiguration to add +} trt_AddMetadataConfiguration_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, The requested metadata configuration +} trt_GetMetadataConfiguration_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, Contains a reference to the media profile from which the MetadataConfiguration shall be removed +} trt_RemoveMetadataConfiguration_REQ; + +typedef struct +{ + onvif_MetadataConfiguration Configuration; // required, Contains the modified metadata configuration. The configuration shall exist in the device + BOOL ForcePersistence; // required, The ForcePersistence element is obsolete and should always be assumed to be true +} trt_SetMetadataConfiguration_REQ; + +typedef struct +{ + uint32 ConfigurationTokenFlag : 1; // Indicates whether the field ConfigurationToken is valid + uint32 ProfileTokenFlag : 1; // Indicates whether the field ProfileToken is valid + uint32 Reserved : 30; + + char ConfigurationToken[ONVIF_TOKEN_LEN]; // optional, Optional metadata configuration token that specifies an existing configuration that the options are intended for + char ProfileToken[ONVIF_TOKEN_LEN]; // optional, Optional ProfileToken that specifies an existing media profile that the options shall be compatible with +} trt_GetMetadataConfigurationOptions_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required +} trt_GetCompatibleVideoEncoderConfigurations_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required +} trt_GetCompatibleAudioEncoderConfigurations_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required +} trt_GetCompatibleVideoAnalyticsConfigurations_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required +} trt_GetCompatibleMetadataConfigurations_REQ; + +typedef struct +{ + int dummy; +} ptz_GetServiceCapabilities_REQ; + +typedef struct +{ + int dummy; +} ptz_GetNodes_REQ; + +typedef struct +{ + char NodeToken[ONVIF_TOKEN_LEN]; // required, Token of the requested PTZNode +} ptz_GetNode_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, A reference to the MediaProfile where the operation should take place +} ptz_GetPresets_REQ; + +typedef struct +{ + uint32 PresetTokenFlag : 1; // Indicates whether the field PresetToken is valid + uint32 PresetNameFlag : 1; // Indicates whether the field PresetName is valid + uint32 Reserved : 30; + + char ProfileToken[ONVIF_TOKEN_LEN]; // required, A reference to the MediaProfile where the operation should take place + char PresetToken[ONVIF_TOKEN_LEN]; // optional, A requested preset token + char PresetName[ONVIF_NAME_LEN]; // optional, A requested preset name +} ptz_SetPreset_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, A reference to the MediaProfile where the operation should take place + char PresetToken[ONVIF_TOKEN_LEN]; // required, A requested preset token +} ptz_RemovePreset_REQ; + +typedef struct +{ + uint32 SpeedFlag : 1; // Indicates whether the field Speed is valid + uint32 Reserved : 31; + + char ProfileToken[ONVIF_TOKEN_LEN]; // required, A reference to the MediaProfile where the operation should take place + char PresetToken[ONVIF_TOKEN_LEN]; // required, A requested preset token + + onvif_PTZSpeed Speed; // optional, A requested speed.The speed parameter can only be specified when Speed Spaces are available for the PTZ Node +} ptz_GotoPreset_REQ; + +typedef struct +{ + uint32 SpeedFlag : 1; // Indicates whether the field Speed is valid + uint32 Reserved : 31; + + char ProfileToken[ONVIF_TOKEN_LEN]; // required, A reference to the MediaProfile where the operation should take place + + onvif_PTZSpeed Speed; // optional, A requested speed.The speed parameter can only be specified when Speed Spaces are available for the PTZ Node +} ptz_GotoHomePosition_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, A reference to the MediaProfile where the home position should be set +} ptz_SetHomePosition_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, A reference to the MediaProfile where the PTZStatus should be requested +} ptz_GetStatus_REQ; + +typedef struct +{ + uint32 TimeoutFlag : 1; // Indicates whether the field Timeout is valid + uint32 Reserved : 31; + + char ProfileToken[ONVIF_TOKEN_LEN]; // required, A reference to the MediaProfile + + onvif_PTZSpeed Velocity; // required, A Velocity vector specifying the velocity of pan, tilt and zoom + + int Timeout; // optional, An optional Timeout parameter, unit is second +} ptz_ContinuousMove_REQ; + +typedef struct +{ + uint32 SpeedFlag : 1; // Indicates whether the field Speed is valid + uint32 Reserved : 31; + + char ProfileToken[ONVIF_TOKEN_LEN]; // required, A reference to the MediaProfile + + onvif_PTZVector Translation; // required, A positional Translation relative to the current position + onvif_PTZSpeed Speed; // optional, An optional Speed parameter +} ptz_RelativeMove_REQ; + +typedef struct +{ + uint32 SpeedFlag : 1; // Indicates whether the field Speed is valid + uint32 Reserved : 31; + + char ProfileToken[ONVIF_TOKEN_LEN]; // required, A reference to the MediaProfile + + onvif_PTZVector Position; // required, A Position vector specifying the absolute target position + onvif_PTZSpeed Speed; // optional, An optional Speed +} ptz_AbsoluteMove_REQ; + +typedef struct +{ + uint32 PanTiltFlag : 1; // Indicates whether the field PanTilt is valid + uint32 ZoomFlag : 1; // Indicates whether the field Zoom is valid + uint32 Reserved : 30; + + char ProfileToken[ONVIF_TOKEN_LEN]; // required, A reference to the MediaProfile that indicate what should be stopped + + BOOL PanTilt; // optional, Set true when we want to stop ongoing pan and tilt movements.If PanTilt arguments are not present, this command stops these movements + BOOL Zoom; // optional, Set true when we want to stop ongoing zoom movement.If Zoom arguments are not present, this command stops ongoing zoom movement +} ptz_Stop_REQ; + +typedef struct +{ + int dummy; +} ptz_GetConfigurations_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Token of the requested PTZConfiguration +} ptz_GetConfiguration_REQ; + +typedef struct +{ + onvif_PTZConfiguration PTZConfiguration; // required + + BOOL ForcePersistence; // required, Flag that makes configuration persistent. Example: User wants the configuration to exist after reboot +} ptz_SetConfiguration_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Token of an existing configuration that the options are intended for +} ptz_GetConfigurationOptions_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required +} ptz_GetPresetTours_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required + char PresetTourToken[ONVIF_TOKEN_LEN]; // required +} ptz_GetPresetTour_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required + char PresetTourToken[ONVIF_TOKEN_LEN]; // optional +} ptz_GetPresetTourOptions_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required +} ptz_CreatePresetTour_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required + + onvif_PresetTour PresetTour; // required +} ptz_ModifyPresetTour_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required + char PresetTourToken[ONVIF_TOKEN_LEN]; // required + + onvif_PTZPresetTourOperation Operation; // required +} ptz_OperatePresetTour_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required + char PresetTourToken[ONVIF_TOKEN_LEN]; // required +} ptz_RemovePresetTour_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, A reference to the MediaProfile where the operation should take place + char AuxiliaryData[1024]; // required, The Auxiliary request data +} ptz_SendAuxiliaryCommand_REQ; + +typedef struct +{ + uint32 SpeedFlag : 1; // Indicates whether the field Speed is valid + uint32 AreaHeightFlag : 1; // Indicates whether the field AreaHeight is valid + uint32 AreaWidthFlag : 1; // Indicates whether the field AreaHeight is valid + uint32 Reserved : 29; + + char ProfileToken[ONVIF_TOKEN_LEN]; // required, A reference to the MediaProfile + + onvif_GeoLocation Target; // required, The geolocation of the target position + onvif_PTZSpeed Speed; // optional, An optional Speed + + float AreaHeight; // optional, An optional indication of the height of the target/area + float AreaWidth; // optional, An optional indication of the width of the target/area +} ptz_GeoMove_REQ; + +typedef struct +{ + int dummy; +} tev_GetServiceCapabilities_REQ; + +typedef struct +{ + int dummy; +} tev_GetEventProperties_REQ; + +typedef struct +{ + int TerminationTime; +} tev_Renew_REQ; + +typedef struct +{ + int dummy; +} tev_Unsubscribe_REQ; + +typedef struct +{ + uint32 FiltersFlag : 1; + uint32 Reserved : 31; + + char ConsumerReference[256]; + int InitialTerminationTime; // InitialTerminationTime, unit is second + + onvif_EventFilter Filter; +} tev_Subscribe_REQ; + +typedef struct +{ + int dummy; +} tev_PauseSubscription_REQ; + +typedef struct +{ + int dummy; +} tev_ResumeSubscription_REQ; + +typedef struct +{ + uint32 FiltersFlag : 1; + uint32 Reserved : 31; + + int InitialTerminationTime; // InitialTerminationTime, unit is second + + onvif_EventFilter Filter; +} tev_CreatePullPointSubscription_REQ; + +typedef struct +{ + int dummy; +} tev_DestroyPullPoint_REQ; + +typedef struct +{ + int Timeout; // required, Maximum time to block until this method returns, unit is second + int MessageLimit; // required, Upper limit for the number of messages to return at once. A server implementation may decide to return less messages +} tev_PullMessages_REQ; + +typedef struct +{ + int MaximumNumber; // required, Upper limit for the number of messages to return at once. A server implementation may decide to return less messages +} tev_GetMessages_REQ; + +typedef struct +{ + time_t UtcTime; // required, The date and time to match against stored messages. + // When Seek is used in the forward mode a device shall position the pull pointer to include all NotificationMessages in the persistent storage with a UtcTime attribute greater than or equal to the Seek argument. + // When Seek is used in reverse mode a device shall position the pull pointer to include all NotificationMessages in the in the persistent storage with a UtcTime attribute less than or equal to the Seek argument. + BOOL Reverse; // optional, Reverse the pull direction of PullMessages +} tev_Seek_REQ; + +typedef struct +{ + int dummy; +} tev_SetSynchronizationPoint_REQ; + +typedef struct +{ + char PostUrl[200]; + + NotificationMessageList * notify; +} Notify_REQ; + +// imaging service + +typedef struct +{ + int dummy; +} img_GetServiceCapabilities_REQ; + +typedef struct +{ + char VideoSourceToken[ONVIF_TOKEN_LEN]; // required +} img_GetImagingSettings_REQ; + +typedef struct +{ + uint32 ForcePersistenceFlag : 1; // Indicates whether the field ForcePersistence is valid + uint32 Reserved : 31; + + char VideoSourceToken[ONVIF_TOKEN_LEN]; // required + BOOL ForcePersistence; // optional + + onvif_ImagingSettings ImagingSettings; // required +} img_SetImagingSettings_REQ; + +typedef struct +{ + char VideoSourceToken[ONVIF_TOKEN_LEN]; // required, Reference token to the VideoSource for which the imaging parameter options are requested +} img_GetOptions_REQ; + +typedef struct +{ + char VideoSourceToken[ONVIF_TOKEN_LEN]; // required, Reference to the VideoSource for the requested move (focus) operation + + onvif_FocusMove Focus; // required, Content of the requested move (focus) operation +} img_Move_REQ; + +typedef struct +{ + char VideoSourceToken[ONVIF_TOKEN_LEN]; // required, Reference to the VideoSource +} img_Stop_REQ; + +typedef struct +{ + char VideoSourceToken[ONVIF_TOKEN_LEN]; // required, Reference to the VideoSource +} img_GetStatus_REQ; + +typedef struct +{ + char VideoSourceToken[ONVIF_TOKEN_LEN]; // required, Reference to the VideoSource +} img_GetMoveOptions_REQ; + +typedef struct +{ + char VideoSourceToken[ONVIF_TOKEN_LEN]; // required, Reference to the VideoSource +} img_GetPresets_REQ; + +typedef struct +{ + char VideoSourceToken[ONVIF_TOKEN_LEN]; // required, Reference to the VideoSource +} img_GetCurrentPreset_REQ; + +typedef struct +{ + char VideoSourceToken[ONVIF_TOKEN_LEN]; //required, , Reference to the VideoSource + char PresetToken[ONVIF_TOKEN_LEN]; //required, Reference token to the Imaging Preset to be applied to the specified Video Source +} img_SetCurrentPreset_REQ; + +// device IO + +typedef struct +{ + int dummy; +} tmd_GetServiceCapabilities_REQ; + +typedef struct +{ + int dummy; +} tmd_GetRelayOutputs_REQ; + +typedef struct +{ + uint32 RelayOutputTokenFlag : 1; + uint32 Reserved : 31; + + char RelayOutputToken[ONVIF_TOKEN_LEN]; // optional, Optional reference token to the relay for which the options are requested +} tmd_GetRelayOutputOptions_REQ; + +typedef struct +{ + onvif_RelayOutput RelayOutput; // required +} tmd_SetRelayOutputSettings_REQ; + +typedef struct +{ + char RelayOutputToken[ONVIF_TOKEN_LEN]; // required + + onvif_RelayLogicalState LogicalState; // required +} tmd_SetRelayOutputState_REQ; + +typedef struct +{ + int dummy; +} tmd_GetDigitalInputs_REQ; + +typedef struct +{ + uint32 TokenFlag : 1; + uint32 Reserved : 31; + + char Token[ONVIF_TOKEN_LEN]; // optional, +} tmd_GetDigitalInputConfigurationOptions_REQ; + +typedef struct +{ + DigitalInputList * DigitalInputs; +} tmd_SetDigitalInputConfigurations_REQ; + +// recording + +typedef struct +{ + int dummy; +} trc_GetServiceCapabilities_REQ; + +typedef struct +{ + onvif_RecordingConfiguration RecordingConfiguration;// required, Initial configuration for the recording +} trc_CreateRecording_REQ; + +typedef struct +{ + char RecordingToken[ONVIF_TOKEN_LEN]; // required, +} trc_DeleteRecording_REQ; + +typedef struct +{ + int dummy; +} trc_GetRecordings_REQ; + +typedef struct +{ + char RecordingToken[ONVIF_TOKEN_LEN]; // required, Token of the recording that shall be changed + + onvif_RecordingConfiguration RecordingConfiguration;// required, The new configuration +} trc_SetRecordingConfiguration_REQ; + +typedef struct +{ + char RecordingToken[ONVIF_TOKEN_LEN]; // required, +} trc_GetRecordingConfiguration_REQ; + +typedef struct +{ + char RecordingToken[ONVIF_TOKEN_LEN]; // required, +} trc_GetRecordingOptions_REQ; + +typedef struct +{ + char RecordingToken[ONVIF_TOKEN_LEN]; // required, Identifies the recording to which a track shall be added + + onvif_TrackConfiguration TrackConfiguration; // required, The configuration of the new track +} trc_CreateTrack_REQ; + +typedef struct +{ + char RecordingToken[ONVIF_TOKEN_LEN]; // required, Token of the recording the track belongs to + char TrackToken[ONVIF_TOKEN_LEN]; // required, Token of the track to be deleted +} trc_DeleteTrack_REQ; + +typedef struct +{ + char RecordingToken[ONVIF_TOKEN_LEN]; // required, Token of the recording the track belongs to + char TrackToken[ONVIF_TOKEN_LEN]; // required, Token of the track +} trc_GetTrackConfiguration_REQ; + +typedef struct +{ + char RecordingToken[ONVIF_TOKEN_LEN]; // required, Token of the recording the track belongs to + char TrackToken[ONVIF_TOKEN_LEN]; // required, Token of the track to be modified + + onvif_TrackConfiguration TrackConfiguration; // required, New configuration for the track +} trc_SetTrackConfiguration_REQ; + +typedef struct +{ + onvif_RecordingJobConfiguration JobConfiguration; // required, The initial configuration of the new recording job +} trc_CreateRecordingJob_REQ; + +typedef struct +{ + char JobToken[ONVIF_TOKEN_LEN]; // required +} trc_DeleteRecordingJob_REQ; + +typedef struct +{ + int dummy; +} trc_GetRecordingJobs_REQ; + +typedef struct +{ + char JobToken[ONVIF_TOKEN_LEN]; // required, Token of the job to be modified + + onvif_RecordingJobConfiguration JobConfiguration; // required, New configuration of the recording job +} trc_SetRecordingJobConfiguration_REQ; + +typedef struct +{ + char JobToken[ONVIF_TOKEN_LEN]; // required +} trc_GetRecordingJobConfiguration_REQ; + +typedef struct +{ + char JobToken[ONVIF_TOKEN_LEN]; // required, Token of the recording job + char Mode[16]; // required, The new mode for the recording job, The only valid values for Mode shall be "Idle" or "Active" +} trc_SetRecordingJobMode_REQ; + +typedef struct +{ + char JobToken[ONVIF_TOKEN_LEN]; // required +} trc_GetRecordingJobState_REQ; + +typedef struct +{ + time_t StartPoint; // optional, Optional parameter that specifies start time for the exporting + time_t EndPoint; // optional, Optional parameter that specifies end time for the exporting + onvif_SearchScope SearchScope; // required, Indicates the selection criterion on the existing recordings + char FileFormat[32]; // required, Indicates which export file format to be used + onvif_StorageReferencePath StorageDestination; // required, Indicates the target storage and relative directory path +} trc_ExportRecordedData_REQ; + +typedef struct +{ + char OperationToken[ONVIF_TOKEN_LEN]; // required, Unique ExportRecordedData operation token +} trc_StopExportRecordedData_REQ; + +typedef struct +{ + char OperationToken[ONVIF_TOKEN_LEN]; // required, Unique ExportRecordedData operation token +} trc_GetExportRecordedDataState_REQ; + +typedef struct +{ + int dummy; +} trp_GetServiceCapabilities_REQ; + +typedef struct +{ + onvif_StreamSetup StreamSetup; + + char RecordingToken[ONVIF_TOKEN_LEN]; // required. The identifier of the recording to be streamed +} trp_GetReplayUri_REQ; + +typedef struct +{ + int dummy; +} trp_GetReplayConfiguration_REQ; + +typedef struct +{ + onvif_ReplayConfiguration Configuration; // required, Description of the new replay configuration parameters +} trp_SetReplayConfiguration_REQ; + +typedef struct +{ + int dummy; +} tse_GetServiceCapabilities_REQ; + +typedef struct +{ + int dummy; +} tse_GetRecordingSummary_REQ; + +typedef struct +{ + char RecordingToken[ONVIF_TOKEN_LEN]; // Required +} tse_GetRecordingInformation_REQ; + +typedef struct +{ + char RecordingTokens[10][ONVIF_TOKEN_LEN]; // optional + time_t Time; // required +} tse_GetMediaAttributes_REQ; + +typedef struct +{ + uint32 MaxMatchesFlag : 1; // Indicates whether the field MaxMatches is valid + uint32 Reserved : 31; + + onvif_SearchScope Scope; // required + + int MaxMatches; // optional, The search will be completed after this many matches. If not specified, the search will continue until reaching the endpoint or until the session expires + int KeepAliveTime; // required, The time the search session will be kept alive after responding to this and subsequent requests. A device shall support at least values up to ten seconds +} tse_FindRecordings_REQ; + +typedef struct +{ + uint32 MinResultsFlag : 1; // Indicates whether the field MinResults is valid + uint32 MaxResultsFlag : 1; // Indicates whether the field MaxResults is valid + uint32 WaitTimeFlag : 1; // Indicates whether the field WaitTime is valid + uint32 Reserved : 29; + + char SearchToken[ONVIF_TOKEN_LEN]; // required, The search session to get results from + int MinResults; // optional, The minimum number of results to return in one response + int MaxResults; // optional, The maximum number of results to return in one response + int WaitTime; // optional, The maximum time before responding to the request, even if the MinResults parameter is not fulfilled +} tse_GetRecordingSearchResults_REQ; + +typedef struct +{ + uint32 EndPointFlag : 1; // Indicates whether the field EndPoint is valid + uint32 MaxMatchesFlag : 1; // Indicates whether the field MaxMatches is valid + uint32 Reserved : 30; + + time_t StartPoint; // required, The point of time where the search will start + time_t EndPoint; // optional, The point of time where the search will stop. This can be a time before the StartPoint, in which case the search is performed backwards in time + + onvif_SearchScope Scope; // required, + onvif_EventFilter SearchFilter; // required, + + BOOL IncludeStartState; // required, Setting IncludeStartState to true means that the server should return virtual events representing the start state for any recording included in the scope. Start state events are limited to the topics defined in the SearchFilter that have the IsProperty flag set to true + int MaxMatches; // optional, The search will be completed after this many matches. If not specified, the search will continue until reaching the endpoint or until the session expires + int KeepAliveTime; // required, The time the search session will be kept alive after responding to this and subsequent requests. A device shall support at least values up to ten seconds +} tse_FindEvents_REQ; + +typedef struct +{ + uint32 MinResultsFlag : 1; // Indicates whether the field MinResults is valid + uint32 MaxResultsFlag : 1; // Indicates whether the field MaxResults is valid + uint32 WaitTimeFlag : 1; // Indicates whether the field WaitTime is valid + uint32 Reserved : 29; + + char SearchToken[ONVIF_TOKEN_LEN]; // required, The search session to get results from + int MinResults; // optional, The minimum number of results to return in one response + int MaxResults; // optional, The maximum number of results to return in one response + int WaitTime; // optional, The maximum time before responding to the request, even if the MinResults parameter is not fulfilled +} tse_GetEventSearchResults_REQ; + +typedef struct +{ + uint32 EndPointFlag : 1; // Indicates whether the field EndPoint is valid + uint32 MaxMatchesFlag : 1; // Indicates whether the field MaxMatches is valid + uint32 Reserved : 30; + + time_t StartPoint; // required, The point of time where the search will start + time_t EndPoint; // optional, The point of time where the search will stop. This can be a time before the StartPoint, in which case the search is performed backwards in time + + onvif_SearchScope Scope; // required, + onvif_MetadataFilter MetadataFilter; // required, + + int MaxMatches; // optional, The search will be completed after this many matches. If not specified, the search will continue until reaching the endpoint or until the session expires + int KeepAliveTime; // required, The time the search session will be kept alive after responding to this and subsequent requests. A device shall support at least values up to ten seconds +} tse_FindMetadata_REQ; + +typedef struct +{ + uint32 MinResultsFlag : 1; // Indicates whether the field MinResults is valid + uint32 MaxResultsFlag : 1; // Indicates whether the field MaxResults is valid + uint32 WaitTimeFlag : 1; // Indicates whether the field WaitTime is valid + uint32 Reserved : 29; + + char SearchToken[ONVIF_TOKEN_LEN]; // required, The search session to get results from + int MinResults; // optional, The minimum number of results to return in one response + int MaxResults; // optional, The maximum number of results to return in one response + int WaitTime; // optional, The maximum time before responding to the request, even if the MinResults parameter is not fulfilled +} tse_GetMetadataSearchResults_REQ; + +typedef struct +{ + uint32 EndPointFlag : 1; // Indicates whether the field EndPoint is valid + uint32 MaxMatchesFlag : 1; // Indicates whether the field MaxMatches is valid + uint32 Reserved : 30; + + time_t StartPoint; // required, The point of time where the search will start + time_t EndPoint; // optional, The point of time where the search will stop. This can be a time before the StartPoint, in which case the search is performed backwards in time + + onvif_SearchScope Scope; // required, + onvif_PTZPositionFilter SearchFilter; // required, + + int MaxMatches; // optional, The search will be completed after this many matches. If not specified, the search will continue until reaching the endpoint or until the session expires + int KeepAliveTime; // required, The time the search session will be kept alive after responding to this and subsequent requests. A device shall support at least values up to ten seconds +} tse_FindPTZPosition_REQ; + +typedef struct +{ + uint32 MinResultsFlag : 1; // Indicates whether the field MinResults is valid + uint32 MaxResultsFlag : 1; // Indicates whether the field MaxResults is valid + uint32 WaitTimeFlag : 1; // Indicates whether the field WaitTime is valid + uint32 Reserved : 29; + + char SearchToken[ONVIF_TOKEN_LEN]; // required, The search session to get results from + int MinResults; // optional, The minimum number of results to return in one response + int MaxResults; // optional, The maximum number of results to return in one response + int WaitTime; // optional, The maximum time before responding to the request, even if the MinResults parameter is not fulfilled +} tse_GetPTZPositionSearchResults_REQ; + +typedef struct +{ + char SearchToken[ONVIF_TOKEN_LEN]; // required, The search session to get the state from +} tse_GetSearchState_REQ; + +typedef struct +{ + char SearchToken[ONVIF_TOKEN_LEN]; // required, The search session to end +} tse_EndSearch_REQ; + +typedef struct +{ + int dummy; +} tan_GetServiceCapabilities_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, References an existing Video Analytics configuration. The list of available tokens can be obtained + // via the Media service GetVideoAnalyticsConfigurations method +} tan_GetSupportedRules_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Reference to an existing VideoAnalyticsConfiguration + + ConfigList * Rule; // required +} tan_CreateRules_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Reference to an existing VideoAnalyticsConfiguration + + int sizeRuleName; + char RuleName[10][ONVIF_NAME_LEN]; // required, References the specific rule to be deleted (e.g. "MyLineDetector"). +} tan_DeleteRules_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Reference to an existing VideoAnalyticsConfiguration +} tan_GetRules_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Reference to an existing VideoAnalyticsConfiguration + + ConfigList * Rule; // required +} tan_ModifyRules_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Reference to an existing VideoAnalyticsConfiguration + + ConfigList * AnalyticsModule; // required +} tan_CreateAnalyticsModules_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Reference to an existing Video Analytics configuration + + int sizeAnalyticsModuleName; + char AnalyticsModuleName[10][ONVIF_NAME_LEN]; //required, name of the AnalyticsModule to be deleted +} tan_DeleteAnalyticsModules_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Reference to an existing VideoAnalyticsConfiguration +} tan_GetAnalyticsModules_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Reference to an existing VideoAnalyticsConfiguration + + ConfigList * AnalyticsModule; // required +} tan_ModifyAnalyticsModules_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Reference to an existing VideoAnalyticsConfiguration +} tan_GetSupportedAnalyticsModules_REQ; + +typedef struct +{ + uint32 RuleTypeFlag : 1; // Indicates whether the field RuleType is valid + uint32 Reserved : 31; + + char RuleType[128]; // optional, Reference to an SupportedRule Type returned from GetSupportedRules + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, +} tan_GetRuleOptions_REQ; + +typedef struct +{ + char Type[128]; // optional, Reference to an SupportedAnalyticsModule Type returned from GetSupportedAnalyticsModules + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Reference to an existing AnalyticsConfiguration +} tan_GetAnalyticsModuleOptions_REQ; + +typedef struct +{ + char Type[128]; // optional, reference to an AnalyticsModule Type returned from GetSupportedAnalyticsModules +} tan_GetSupportedMetadata_REQ; + +// onvif media service 2 interfaces + +#define TR2_MAX_TYPE 10 +#define TR2_MAX_CONFIGURATION 10 + +typedef struct +{ + int dummy; +} tr2_GetServiceCapabilities_REQ; + +typedef struct +{ + uint32 ConfigurationTokenFlag : 1; + uint32 ProfileTokenFlag : 1; + uint32 Reserved : 30; + + char ConfigurationToken[ONVIF_TOKEN_LEN]; // optional, Token of the requested configuration + char ProfileToken[ONVIF_TOKEN_LEN]; // optional, Contains the token of an existing media profile the configurations shall be compatible with +} tr2_GetConfiguration; + +typedef struct +{ + char Name[ONVIF_NAME_LEN]; // required, friendly name of the profile to be created + + int sizeConfiguration; + onvif_ConfigurationRef Configuration[TR2_MAX_CONFIGURATION]; // optional, Optional set of configurations to be assigned to the profile +} tr2_CreateProfile_REQ; + +typedef struct +{ + uint32 TokenFlag : 1; + uint32 Reserved : 31; + + char Token[ONVIF_TOKEN_LEN]; // optional, Optional token of the requested profile + + int sizeType; + char Type[TR2_MAX_TYPE][32]; // optional, The types shall be provided as defined by tr2:ConfigurationEnumeration + // All, VideoSource, VideoEncoder, AudioSource, AudioEncoder, AudioOutput, + // AudioDecoder, Metadata, Analytics, PTZ +} tr2_GetProfiles_REQ; + +typedef struct +{ + uint32 NameFlag : 1; + uint32 Reserved : 31; + + char ProfileToken[ONVIF_TOKEN_LEN]; // required, Reference to the profile where the configuration should be added + char Name[ONVIF_NAME_LEN]; // optional, Optional item. If present updates the Name property of the profile + + int sizeConfiguration; + onvif_ConfigurationRef Configuration[TR2_MAX_CONFIGURATION]; // optional, List of configurations to be added +} tr2_AddConfiguration_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, This element contains a reference to the media profile + + int sizeConfiguration; + onvif_ConfigurationRef Configuration[TR2_MAX_CONFIGURATION]; // required, List of configurations to be removed +} tr2_RemoveConfiguration_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, This element contains a reference to the profile that should be deleted +} tr2_DeleteProfile_REQ; + +typedef struct +{ + tr2_GetConfiguration GetConfiguration; +} tr2_GetVideoEncoderConfigurations_REQ; + +typedef struct +{ + tr2_GetConfiguration GetConfiguration; +} tr2_GetVideoSourceConfigurations_REQ; + +typedef struct +{ + tr2_GetConfiguration GetConfiguration; +} tr2_GetAudioEncoderConfigurations_REQ; + +typedef struct +{ + tr2_GetConfiguration GetConfiguration; +} tr2_GetAudioSourceConfigurations_REQ; + +typedef struct +{ + tr2_GetConfiguration GetConfiguration; +} tr2_GetMetadataConfigurations_REQ; + +typedef struct +{ + tr2_GetConfiguration GetConfiguration; +} tr2_GetAudioOutputConfigurations_REQ; + +typedef struct +{ + tr2_GetConfiguration GetConfiguration; +} tr2_GetAudioDecoderConfigurations_REQ; + +typedef struct +{ + onvif_VideoEncoder2Configuration Configuration; // Contains the modified video encoder configuration. The configuration shall exist in the device +} tr2_SetVideoEncoderConfiguration_REQ; + +typedef struct +{ + onvif_VideoSourceConfiguration Configuration; // required, Contains the modified video source configuration. The configuration shall exist in the device +} tr2_SetVideoSourceConfiguration_REQ; + +typedef struct +{ + onvif_AudioEncoder2Configuration Configuration; // required, Contains the modified audio encoder configuration. The configuration shall exist in the device +} tr2_SetAudioEncoderConfiguration_REQ; + +typedef struct +{ + onvif_AudioSourceConfiguration Configuration; // required, Contains the modified audio source configuration. The configuration shall exist in the device +} tr2_SetAudioSourceConfiguration_REQ; + +typedef struct +{ + onvif_MetadataConfiguration Configuration; // required, Contains the modified metadata configuration. The configuration shall exist in the device +} tr2_SetMetadataConfiguration_REQ; + +typedef struct +{ + onvif_AudioOutputConfiguration Configuration; // required, Contains the modified audio output configuration. The configuration shall exist in the device +} tr2_SetAudioOutputConfiguration_REQ; + +typedef struct +{ + tr2_GetConfiguration GetConfiguration; +} tr2_GetVideoSourceConfigurationOptions_REQ; + +typedef struct +{ + tr2_GetConfiguration GetConfiguration; +} tr2_GetVideoEncoderConfigurationOptions_REQ; + +typedef struct +{ + tr2_GetConfiguration GetConfiguration; +} tr2_GetAudioSourceConfigurationOptions_REQ; + +typedef struct +{ + tr2_GetConfiguration GetConfiguration; +} tr2_GetAudioEncoderConfigurationOptions_REQ; + +typedef struct +{ + tr2_GetConfiguration GetConfiguration; +} tr2_GetMetadataConfigurationOptions_REQ; + +typedef struct +{ + tr2_GetConfiguration GetConfiguration; +} tr2_GetAudioOutputConfigurationOptions_REQ; + +typedef struct +{ + tr2_GetConfiguration GetConfiguration; +} tr2_GetAudioDecoderConfigurationOptions_REQ; + +typedef struct +{ + onvif_AudioDecoderConfiguration Configuration; +} tr2_SetAudioDecoderConfiguration_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, +} tr2_GetSnapshotUri_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, +} tr2_StartMulticastStreaming_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, +} tr2_StopMulticastStreaming_REQ; + +typedef struct +{ + char VideoSourceToken[ONVIF_TOKEN_LEN]; // required, +} tr2_GetVideoSourceModes_REQ; + +typedef struct +{ + char VideoSourceToken[ONVIF_TOKEN_LEN]; // required, + char VideoSourceModeToken[ONVIF_TOKEN_LEN]; // required, +} tr2_SetVideoSourceMode_REQ; + +typedef struct +{ + onvif_OSDConfiguration OSD; // required, +} tr2_CreateOSD_REQ; + +typedef struct +{ + char OSDToken[ONVIF_TOKEN_LEN]; // required, +} tr2_DeleteOSD_REQ; + +typedef struct +{ + uint32 OSDTokenFlag : 1; + uint32 ConfigurationTokenFlag : 1; + uint32 Reserved : 30; + + char OSDToken[ONVIF_TOKEN_LEN]; // optional, + char ConfigurationToken[ONVIF_TOKEN_LEN]; // optional, +} tr2_GetOSDs_REQ; + +typedef struct +{ + onvif_OSDConfiguration OSD; // required +} tr2_SetOSD_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Video Source Configuration Token that specifies an existing video source configuration that the options shall be compatible with +} tr2_GetOSDOptions_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Token of the video source configuration +} tr2_GetVideoEncoderInstances_REQ; + +typedef struct +{ + char Protocol[32]; // required, Defines the network protocol + // RtspUnicast -- RTSP streaming RTP as UDP Unicast + // RtspMulticast -- RTSP streaming RTP as UDP Multicast + // RTSP -- RTSP streaming RTP over TCP + // RtspOverHttp -- Tunneling both the RTSP control channel and the RTP stream over HTTP or HTTPS + char ProfileToken[ONVIF_TOKEN_LEN]; // required, The ProfileToken element indicates the media profile + // to use and will define the configuration of the content of the stream +} tr2_GetStreamUri_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, Contains a Profile reference for which a Synchronization Point is requested +} tr2_SetSynchronizationPoint_REQ; + +typedef struct +{ + tr2_GetConfiguration GetConfiguration; // optional, +} tr2_GetAnalyticsConfigurations_REQ; + +typedef struct +{ + onvif_Mask Mask; // required, Contain the initial mask configuration for create +} tr2_CreateMask_REQ; + +typedef struct +{ + uint32 TokenFlag : 1; // Indicates whether the field Token is valid + uint32 ConfigurationTokenFlag : 1; // Indicates whether the field ConfigurationToken is valid + uint32 Reserved : 30; + + char Token[ONVIF_TOKEN_LEN]; // optional, Optional mask token of an existing mask + char ConfigurationToken[ONVIF_TOKEN_LEN]; // optional, Optional token of a Video Source Configuration +} tr2_GetMasks_REQ; + +typedef struct +{ + onvif_Mask Mask; // required, Mask to be updated +} tr2_SetMask_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, This element contains a reference to the Mask configuration that should be deleted +} tr2_DeleteMask_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Video Source Configuration Token that specifies an existing video source configuration that the options shall be compatible with +} tr2_GetMaskOptions_REQ; + +// end of onvif media 2 interfaces + +typedef struct +{ + int dummy; +} tac_GetServiceCapabilities_REQ; + +typedef struct +{ + uint32 LimitFlag : 1; + uint32 StartReferenceFlag : 1; + uint32 Reserved : 30; + + int Limit; // optional, Maximum number of entries to return. If not specified, less than one or higher than what the device supports, the number of items is determined by the device + char StartReference[256]; // optional, Start returning entries from this start reference. If not specified, entries shall start from the beginning of the dataset +} tac_GetAccessPointInfoList_REQ; + +typedef struct +{ + char token[ACCESS_CTRL_MAX_LIMIT][ONVIF_TOKEN_LEN]; // Tokens of AccessPointInfo items to get +} tac_GetAccessPointInfo_REQ; + +typedef struct +{ + uint32 LimitFlag : 1; + uint32 StartReferenceFlag : 1; + uint32 Reserved : 30; + + int Limit; // optional, Maximum number of entries to return. If not specified, less than one or higher than what the device supports, the number of items is determined by the device + char StartReference[256]; // optional, Start returning entries from this start reference. If not specified, entries shall start from the beginning of the dataset +} tac_GetAccessPointList_REQ; + +typedef struct +{ + char token[ACCESS_CTRL_MAX_LIMIT][ONVIF_TOKEN_LEN]; // Tokens of AccessPoint items to get +} tac_GetAccessPoints_REQ; + +typedef struct +{ + uint32 AuthenticationProfileTokenFlag : 1; + uint32 Reserved : 31; + + onvif_AccessPointInfo AccessPoint; // required + + char AuthenticationProfileToken[ONVIF_TOKEN_LEN]; // optional +} tac_CreateAccessPoint_REQ; + +typedef struct +{ + uint32 AuthenticationProfileTokenFlag : 1; + uint32 Reserved : 31; + + onvif_AccessPointInfo AccessPoint; // required + + char AuthenticationProfileToken[ONVIF_TOKEN_LEN]; // optional +} tac_SetAccessPoint_REQ; + +typedef struct +{ + uint32 AuthenticationProfileTokenFlag : 1; + uint32 Reserved : 31; + + onvif_AccessPointInfo AccessPoint; // required + + char AuthenticationProfileToken[ONVIF_TOKEN_LEN]; // optional +} tac_ModifyAccessPoint_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, Token of AccessPoint item to delete +} tac_DeleteAccessPoint_REQ; + +typedef struct +{ + uint32 LimitFlag : 1; + uint32 StartReferenceFlag : 1; + uint32 Reserved : 30; + + int Limit; // optional, Maximum number of entries to return. If not specified, or higher than what the device supports, the number of items shall be determined by the device + char StartReference[256]; // optional, Start returning entries from this start reference. If not specified, entries shall start from the beginning of the dataset +} tac_GetAreaInfoList_REQ; + +typedef struct +{ + char token[ACCESS_CTRL_MAX_LIMIT][ONVIF_TOKEN_LEN]; // Tokens of DoorInfo items to get +} tac_GetAreaInfo_REQ; + +typedef struct +{ + uint32 LimitFlag : 1; + uint32 StartReferenceFlag : 1; + uint32 Reserved : 30; + + int Limit; // optional, Maximum number of entries to return. If not specified, less than one or higher than what the device supports, the number of items is determined by the device + char StartReference[256]; // optional, Start returning entries from this start reference. If not specified, entries shall start from the beginning of the dataset +} tac_GetAreaList_REQ; + +typedef struct +{ + char token[ACCESS_CTRL_MAX_LIMIT][ONVIF_TOKEN_LEN]; // Tokens of Area items to get +} tac_GetAreas_REQ; + +typedef struct +{ + onvif_AreaInfo Area; // required +} tac_CreateArea_REQ; + +typedef struct +{ + onvif_AreaInfo Area; // required +} tac_SetArea_REQ; + +typedef struct +{ + onvif_AreaInfo Area; // required +} tac_ModifyArea_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, Token of Area item to delete +} tac_DeleteArea_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, Token of AccessPoint instance to get AccessPointState for +} tac_GetAccessPointState_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, Token of the AccessPoint instance to enable +} tac_EnableAccessPoint_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, Token of the AccessPoint instance to disable +} tac_DisableAccessPoint_REQ; + +typedef struct +{ + int dummy; +} tdc_GetServiceCapabilities_REQ; + +typedef struct +{ + uint32 LimitFlag : 1; + uint32 StartReferenceFlag : 1; + uint32 Reserved : 30; + + int Limit; // optional, Maximum number of entries to return. If not specified, + // or higher than what the device supports, + // the number of items shall be determined by the device + char StartReference[256]; // optional, Start returning entries from this start reference. If not specified, + // entries shall start from the beginning of the dataset +} tdc_GetDoorInfoList_REQ; + +typedef struct +{ + char token[DOOR_CTRL_MAX_LIMIT][ONVIF_TOKEN_LEN]; // Tokens of DoorInfo items to get +} tdc_GetDoorInfo_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, Token of the Door instance to get the state for +} tdc_GetDoorState_REQ; + +typedef struct +{ + uint32 UseExtendedTimeFlag : 1; + uint32 AccessTimeFlag : 1; + uint32 OpenTooLongTimeFlag : 1; + uint32 PreAlarmTimeFlag : 1; + uint32 Reserved : 28; + + char Token[ONVIF_TOKEN_LEN]; // required, Token of the Door instance to control + BOOL UseExtendedTime; // optional, Indicates that the configured extended time should be used + int AccessTime; // optional, overrides AccessTime if specified + int OpenTooLongTime; // optional, overrides OpenTooLongTime if specified (DOTL) + int PreAlarmTime; // optional, overrides PreAlarmTime if specified +} tdc_AccessDoor_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, Token of the Door instance to control +} tdc_LockDoor_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, Token of the Door instance to control +} tdc_UnlockDoor_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, Token of the Door instance to control +} tdc_DoubleLockDoor_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, Token of the Door instance to control +} tdc_BlockDoor_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, Token of the Door instance to control +} tdc_LockDownDoor_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, Token of the Door instance to control +} tdc_LockDownReleaseDoor_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, Token of the Door instance to control +} tdc_LockOpenDoor_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, Token of the Door instance to control +} tdc_LockOpenReleaseDoor_REQ; + +typedef struct +{ + char token[DOOR_CTRL_MAX_LIMIT][ONVIF_TOKEN_LEN]; // Tokens of Door items to get +} tdc_GetDoors_REQ; + +typedef struct +{ + uint32 LimitFlag : 1; + uint32 StartReferenceFlag : 1; + uint32 Reserved : 30; + + int Limit; // optional, aximum number of entries to return. If not specified, less than one + // or higher than what the device supports, + // the number of items is determined by the device + char StartReference[256]; // optional, Start returning entries from this start reference. If not specified, + // entries shall start from the beginning of the dataset +} tdc_GetDoorList_REQ; + +typedef struct +{ + onvif_Door Door; // required, Door item to create +} tdc_CreateDoor_REQ; + +typedef struct +{ + onvif_Door Door; // required, The Door item to create or modify +} tdc_SetDoor_REQ; + +typedef struct +{ + onvif_Door Door; // required, The details of the door +} tdc_ModifyDoor_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, The Token of the door to delete +} tdc_DeleteDoor_REQ; + +typedef struct +{ + int dummy; +} tth_GetServiceCapabilities_REQ; + +typedef struct +{ + int dummy; +} tth_GetConfigurations_REQ; + +typedef struct +{ + char VideoSourceToken[ONVIF_TOKEN_LEN]; // requied, Reference token to the VideoSource for which the Thermal Settings are requested +} tth_GetConfiguration_REQ; + +typedef struct +{ + char VideoSourceToken[ONVIF_TOKEN_LEN]; // requied, Reference token to the VideoSource for which the Thermal Settings are configured + + onvif_ThermalConfiguration Configuration; // requied, Thermal Settings to be configured +} tth_SetConfiguration_REQ; + +typedef struct +{ + char VideoSourceToken[ONVIF_TOKEN_LEN]; // requied, Reference token to the VideoSource for which the Thermal Configuration Options are requested +} tth_GetConfigurationOptions_REQ; + +typedef struct +{ + char VideoSourceToken[ONVIF_TOKEN_LEN]; // required, Reference token to the VideoSource for which the Radiometry Configuration is requested +} tth_GetRadiometryConfiguration_REQ; + +typedef struct +{ + char VideoSourceToken[ONVIF_TOKEN_LEN]; // required, Reference token to the VideoSource for which the Radiometry settings are configured + + onvif_RadiometryConfiguration Configuration; // required, Radiometry settings to be configured +} tth_SetRadiometryConfiguration_REQ; + +typedef struct +{ + char VideoSourceToken[ONVIF_TOKEN_LEN]; // required, Reference token to the VideoSource for which the Thermal Radiometry Options are requested +} tth_GetRadiometryConfigurationOptions_REQ; + +typedef struct +{ + int dummy; +} tcr_GetServiceCapabilities_REQ; + +typedef struct +{ + int sizeToken; // sequence of elements + char Token[CREDENTIAL_MAX_LIMIT][ONVIF_TOKEN_LEN]; // required, Tokens of CredentialInfo items to get +} tcr_GetCredentialInfo_REQ; + +typedef struct +{ + uint32 LimitFlag : 1; // Indicates whether the field Limit is valid + uint32 StartReferenceFlag : 1; // Indicates whether the field StartReference is valid + uint32 Reserved : 30; + + int Limit; // optional, Maximum number of entries to return. If not specified, less than one or higher + // than what the device supports, the number of items is determined by the device + char StartReference[ONVIF_TOKEN_LEN]; // optional, Start returning entries from this start reference. If not specified, + // entries shall start from the beginning of the dataset +} tcr_GetCredentialInfoList_REQ; + +typedef struct +{ + int sizeToken; // sequence of elements + char Token[CREDENTIAL_MAX_LIMIT][ONVIF_TOKEN_LEN]; // required, Token of Credentials to get +} tcr_GetCredentials_REQ; + +typedef struct +{ + uint32 LimitFlag : 1; // Indicates whether the field Limit is valid + uint32 StartReferenceFlag : 1; // Indicates whether the field StartReference is valid + uint32 Reserved : 30; + + int Limit; // optional, Maximum number of entries to return. If not specified, less than one or higher + // than what the device supports, the number of items is determined by the device + char StartReference[ONVIF_TOKEN_LEN]; // optional, Start returning entries from this start reference. If not specified, + // entries shall start from the beginning of the dataset +} tcr_GetCredentialList_REQ; + +typedef struct +{ + onvif_Credential Credential; // required, The credential to create + onvif_CredentialState State; // required, The state of the credential +} tcr_CreateCredential_REQ; + +typedef struct +{ + onvif_Credential Credential; // required, Details of the credential +} tcr_ModifyCredential_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, The token of the credential to delete +} tcr_DeleteCredential_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, Token of Credential +} tcr_GetCredentialState_REQ; + +typedef struct +{ + uint32 ReasonFlag : 1; // Indicates whether the field ReasonFlag is valid + uint32 Reserved : 31; + + char Token[ONVIF_TOKEN_LEN]; // required, The token of the credential + char Reason[200]; // optional, Reason for enabling the credential +} tcr_EnableCredential_REQ; + +typedef struct +{ + uint32 ReasonFlag : 1; // Indicates whether the field ReasonFlag is valid + uint32 Reserved : 31; + + char Token[ONVIF_TOKEN_LEN]; // required, The token of the credential + char Reason[200]; // optional, Reason for disabling the credential +} tcr_DisableCredential_REQ; + +typedef struct +{ + char CredentialToken[ONVIF_TOKEN_LEN]; // required, Token of the Credential +} tcr_ResetAntipassbackViolation_REQ; + +typedef struct +{ + char CredentialIdentifierTypeName[100]; // required, Name of the credential identifier type +} tcr_GetSupportedFormatTypes_REQ; + +typedef struct +{ + char CredentialToken[ONVIF_TOKEN_LEN]; // required, Token of the Credential +} tcr_GetCredentialIdentifiers_REQ; + +typedef struct +{ + char CredentialToken[ONVIF_TOKEN_LEN]; // required, Token of the Credential + + onvif_CredentialIdentifier CredentialIdentifier; // required, Identifier of the credential +} tcr_SetCredentialIdentifier_REQ; + +typedef struct +{ + char CredentialToken[ONVIF_TOKEN_LEN]; // required, Token of the Credential + char CredentialIdentifierTypeName[100]; // required, Identifier type name of a credential +} tcr_DeleteCredentialIdentifier_REQ; + +typedef struct +{ + char CredentialToken[ONVIF_TOKEN_LEN]; // required, Token of the Credential +} tcr_GetCredentialAccessProfiles_REQ; + +typedef struct +{ + char CredentialToken[ONVIF_TOKEN_LEN]; // required, Token of the Credential + int sizeCredentialAccessProfile; // sequence of elements + + onvif_CredentialAccessProfile CredentialAccessProfile[CREDENTIAL_MAX_LIMIT]; // required, Access Profiles of the credential +} tcr_SetCredentialAccessProfiles_REQ; + +typedef struct +{ + char CredentialToken[ONVIF_TOKEN_LEN]; // required, Token of the Credential + int sizeAccessProfileToken; // sequence of elements + + char AccessProfileToken[CREDENTIAL_MAX_LIMIT][ONVIF_TOKEN_LEN]; // required, Tokens of Access Profiles +} tcr_DeleteCredentialAccessProfiles_REQ; + +typedef struct +{ + int dummy; +} tar_GetServiceCapabilities_REQ; + +typedef struct +{ + int sizeToken; // sequence of elements + char Token[ACCESSRULES_MAX_LIMIT][ONVIF_TOKEN_LEN]; // required, Tokens of CredentialInfo items to get +} tar_GetAccessProfileInfo_REQ; + +typedef struct +{ + uint32 LimitFlag : 1; // Indicates whether the field Limit is valid + uint32 StartReferenceFlag : 1; // Indicates whether the field StartReference is valid + uint32 Reserved : 30; + + int Limit; // optional, Maximum number of entries to return. If not specified, less than one or higher + // than what the device supports, the number of items is determined by the device + char StartReference[ONVIF_TOKEN_LEN]; // optional, Start returning entries from this start reference. If not specified, + // entries shall start from the beginning of the dataset +} tar_GetAccessProfileInfoList_REQ; + +typedef struct +{ + int sizeToken; // sequence of elements + char Token[ACCESSRULES_MAX_LIMIT][ONVIF_TOKEN_LEN]; // required, Tokens of CredentialInfo items to get +} tar_GetAccessProfiles_REQ; + +typedef struct +{ + uint32 LimitFlag : 1; // Indicates whether the field Limit is valid + uint32 StartReferenceFlag : 1; // Indicates whether the field StartReference is valid + uint32 Reserved : 30; + + int Limit; // optional, Maximum number of entries to return. If not specified, less than one or higher + // than what the device supports, the number of items is determined by the device + char StartReference[ONVIF_TOKEN_LEN]; // optional, Start returning entries from this start reference. If not specified, + // entries shall start from the beginning of the dataset +} tar_GetAccessProfileList_REQ; + +typedef struct +{ + onvif_AccessProfile AccessProfile; // required, The AccessProfile to create +} tar_CreateAccessProfile_REQ; + +typedef struct +{ + onvif_AccessProfile AccessProfile; // required, The details of Access Profile +} tar_ModifyAccessProfile_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, The token of the access profile to delete +} tar_DeleteAccessProfile_REQ; + +typedef struct +{ + int dummy; +} tsc_GetServiceCapabilities_REQ; + +typedef struct +{ + int sizeToken; // sequence of elements + char Token[SCHEDULE_MAX_LIMIT][ONVIF_TOKEN_LEN]; // required, Tokens of ScheduleInfo items to get +} tsc_GetScheduleInfo_REQ; + +typedef struct +{ + uint32 LimitFlag : 1; // Indicates whether the field Limit is valid + uint32 StartReferenceFlag : 1; // Indicates whether the field StartReference is valid + uint32 Reserved : 30; + + int Limit; // optional, Maximum number of entries to return. If not specified, less than one + // or higher than what the device supports, the number of items is + // determined by the device + char StartReference[ONVIF_TOKEN_LEN]; // optional, Start returning entries from this start reference. + // If not specified, entries shall start from the beginning of the dataset +} tsc_GetScheduleInfoList_REQ; + +typedef struct +{ + int sizeToken; // sequence of elements + char Token[SCHEDULE_MAX_LIMIT][ONVIF_TOKEN_LEN]; // required, Tokens of Schedule items to get +} tsc_GetSchedules_REQ; + +typedef struct +{ + uint32 LimitFlag : 1; // Indicates whether the field Limit is valid + uint32 StartReferenceFlag : 1; // Indicates whether the field StartReference is valid + uint32 Reserved : 30; + + int Limit; // optional, Maximum number of entries to return. If not specified, less than one + // or higher than what the device supports, the number of items is + // determined by the device + char StartReference[ONVIF_TOKEN_LEN]; // optional, Start returning entries from this start reference. + // If not specified, entries shall start from the beginning of the dataset +} tsc_GetScheduleList_REQ; + +typedef struct +{ + onvif_Schedule Schedule; // required, The Schedule to create +} tsc_CreateSchedule_REQ; + +typedef struct +{ + onvif_Schedule Schedule; // required, The Schedule to modify/update +} tsc_ModifySchedule_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, The token of the schedule to delete +} tsc_DeleteSchedule_REQ; + +typedef struct +{ + int sizeToken; // sequence of elements + char Token[SCHEDULE_MAX_LIMIT][ONVIF_TOKEN_LEN]; // required, Tokens of SpecialDayGroupInfo items to get +} tsc_GetSpecialDayGroupInfo_REQ; + +typedef struct +{ + uint32 LimitFlag : 1; // Indicates whether the field Limit is valid + uint32 StartReferenceFlag : 1; // Indicates whether the field StartReference is valid + uint32 Reserved : 30; + + int Limit; // optional, Maximum number of entries to return. If not specified, less than one + // or higher than what the device supports, the number of items is + // determined by the device + char StartReference[ONVIF_TOKEN_LEN]; // optional, Start returning entries from this start reference. + // If not specified, entries shall start from the beginning of the dataset +} tsc_GetSpecialDayGroupInfoList_REQ; + +typedef struct +{ + int sizeToken; // sequence of elements + char Token[SCHEDULE_MAX_LIMIT][ONVIF_TOKEN_LEN]; // required, Tokens of the SpecialDayGroup items to get +} tsc_GetSpecialDayGroups_REQ; + +typedef struct +{ + uint32 LimitFlag : 1; // Indicates whether the field Limit is valid + uint32 StartReferenceFlag : 1; // Indicates whether the field StartReference is valid + uint32 Reserved : 30; + + int Limit; // optional, Maximum number of entries to return. If not specified, less than one + // or higher than what the device supports, the number of items is + // determined by the device + char StartReference[ONVIF_TOKEN_LEN]; // optional, Start returning entries from this start reference. + // If not specified, entries shall start from the beginning of the dataset +} tsc_GetSpecialDayGroupList_REQ; + +typedef struct +{ + onvif_SpecialDayGroup SpecialDayGroup; // required, The special day group to create +} tsc_CreateSpecialDayGroup_REQ; + +typedef struct +{ + onvif_SpecialDayGroup SpecialDayGroup; // required, The special day group to modify/update +} tsc_ModifySpecialDayGroup_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, The token of the special day group item to delete +} tsc_DeleteSpecialDayGroup_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, Token of schedule instance to get ScheduleState +} tsc_GetScheduleState_REQ; + +typedef struct +{ + int dummy; +} trv_GetServiceCapabilities_REQ; + +typedef struct +{ + int dummy; +} trv_GetReceivers_REQ; + +typedef struct +{ + char ReceiverToken[ONVIF_TOKEN_LEN]; // required, The token of the receiver to be retrieved +} trv_GetReceiver_REQ; + +typedef struct +{ + onvif_ReceiverConfiguration Configuration; // required, The initial configuration for the new receiver +} trv_CreateReceiver_REQ; + +typedef struct +{ + char ReceiverToken[ONVIF_TOKEN_LEN]; // required, The token of the receiver to be deleted +} trv_DeleteReceiver_REQ; + +typedef struct +{ + char ReceiverToken[ONVIF_TOKEN_LEN]; // required, The token of the receiver to be configured + + onvif_ReceiverConfiguration Configuration; // required, The new configuration for the receiver +} trv_ConfigureReceiver_REQ; + +typedef struct +{ + char ReceiverToken[ONVIF_TOKEN_LEN]; // required, The token of the receiver to be changed + + onvif_ReceiverMode Mode; // required, The new receiver mode +} trv_SetReceiverMode_REQ; + +typedef struct +{ + char ReceiverToken[ONVIF_TOKEN_LEN]; // required, The token of the receiver to be queried +} trv_GetReceiverState_REQ; + +typedef struct +{ + int dummy; +} tpv_GetServiceCapabilities_REQ; + +typedef struct +{ + uint32 TimeoutFlag : 1; // Indicates whether the field Timeout is valid + uint32 Reserved : 31; + + char VideoSource[100]; // required, The video source associated with the provisioning. + + onvif_PanDirection Direction; // required, The direction for PanMove to move the device, "left" or "right" + + int Timeout; // optional, Operation timeout, if less than default timeout, unit is second +} tpv_PanMove_REQ; + +typedef struct +{ + uint32 TimeoutFlag : 1; // Indicates whether the field Timeout is valid + uint32 Reserved : 31; + + char VideoSource[100]; // required, The video source associated with the provisioning + + onvif_TiltDirection Direction; // required, "up" or "down" + + int Timeout; // optional, Operation timeout, if less than default timeout, unit is second +} tpv_TiltMove_REQ; + +typedef struct +{ + uint32 TimeoutFlag : 1; // Indicates whether the field Timeout is valid + uint32 Reserved : 31; + + char VideoSource[100]; // required, The video source associated with the provisioning + + onvif_ZoomDirection Direction; // required, "wide" or "telephoto" + + int Timeout; // optional, Operation timeout, if less than default timeout, unit is second +} tpv_ZoomMove_REQ; + +typedef struct +{ + uint32 TimeoutFlag : 1; // Indicates whether the field Timeout is valid + uint32 Reserved : 31; + + char VideoSource[100]; // required, The video source associated with the provisioning + + onvif_RollDirection Direction; // required, "clockwise", "counterclockwise", or "auto" + + int Timeout; // optional, Operation timeout, if less than default timeout, unit is second +} tpv_RollMove_REQ; + +typedef struct +{ + uint32 TimeoutFlag : 1; // Indicates whether the field Timeout is valid + uint32 Reserved : 31; + + char VideoSource[100]; // required, The video source associated with the provisioning + + onvif_FocusDirection Direction; // required, "near", "far", or "auto" + + int Timeout; // optional, Operation timeout, if less than default timeout, unit is second +} tpv_FocusMove_REQ; + +typedef struct +{ + char VideoSource[100]; // required, The video source associated with the provisioning +} tpv_Stop_REQ; + +typedef struct +{ + char VideoSource[100]; // required, The video source associated with the provisioning +} tpv_GetUsage_REQ; + + +#endif // end of ONVIF_REQ_H + + + diff --git a/MediaClient/MediaClient/onvif/onvif_res.h b/MediaClient/MediaClient/onvif/onvif_res.h new file mode 100644 index 0000000..ea49365 --- /dev/null +++ b/MediaClient/MediaClient/onvif/onvif_res.h @@ -0,0 +1,2263 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef ONVIF_RES_H +#define ONVIF_RES_H + + + +/************************************************************************* + * + * onvif response structure + * +**************************************************************************/ +typedef struct +{ + onvif_Capabilities Capabilities; // required, Capability information +} tds_GetCapabilities_RES; + +typedef struct +{ + onvif_Capabilities Capabilities; // required, Capability information +} tds_GetServices_RES; + +typedef struct +{ + onvif_DevicesCapabilities Capabilities; // required, he capabilities for the device service is returned in the Capabilities element +} tds_GetServiceCapabilities_RES; + +typedef struct +{ + onvif_DeviceInformation DeviceInformation; // required, Device information +} tds_GetDeviceInformation_RES; + +typedef struct +{ + UserList * User; +} tds_GetUsers_RES; + +typedef struct +{ + int dummy; +} tds_CreateUsers_RES; + +typedef struct +{ + int dummy; +} tds_DeleteUsers_RES; + +typedef struct +{ + int dummy; +} tds_SetUser_RES; + +typedef struct +{ + uint32 RemoteUserFlag : 1; // Indicates whether the field RemoteUser is valid + uint32 Reserved : 31; + + onvif_RemoteUser RemoteUser; // optional +} tds_GetRemoteUser_RES; + +typedef struct +{ + int dummy; +} tds_SetRemoteUser_RES; + +typedef struct +{ + NetworkInterfaceList * NetworkInterfaces; // required, List of network interfaces +} tds_GetNetworkInterfaces_RES; + +typedef struct +{ + BOOL RebootNeeded; // required, Indicates whether or not a reboot is required after configuration updates, +} tds_SetNetworkInterfaces_RES; + +typedef struct +{ + onvif_NTPInformation NTPInformation; // required, NTP information +} tds_GetNTP_RES; + +typedef struct +{ + int dummy; +} tds_SetNTP_RES; + +typedef struct +{ + onvif_HostnameInformation HostnameInformation; // required, Host name information +} tds_GetHostname_RES; + +typedef struct +{ + int dummy; +} tds_SetHostname_RES; + +typedef struct +{ + BOOL RebootNeeded; // required, Indicates whether or not a reboot is required after configuration updates +} tds_SetHostnameFromDHCP_RES; + +typedef struct +{ + onvif_DNSInformation DNSInformation; // required, DNS information +} tds_GetDNS_RES; + +typedef struct +{ + int dummy; +} tds_SetDNS_RES; + +typedef struct +{ + onvif_DynamicDNSInformation DynamicDNSInformation; // Dynamic DNS information +} tds_GetDynamicDNS_RES; + +typedef struct +{ + int dummy; +} tds_SetDynamicDNS_RES; + +typedef struct +{ + onvif_NetworkProtocol NetworkProtocols; // Contains defined protocols supported by the device +} tds_GetNetworkProtocols_RES; + +typedef struct +{ + int dummy; +} tds_SetNetworkProtocols_RES; + +typedef struct +{ + onvif_DiscoveryMode DiscoveryMode; // required, Indicator of discovery mode: Discoverable, NonDiscoverable +} tds_GetDiscoveryMode_RES; + +typedef struct +{ + int dummy; +} tds_SetDiscoveryMode_RES; + +typedef struct +{ + char IPv4Address[MAX_GATEWAY][32]; // required, Gets the default IPv4 and IPv6 gateway settings from the device +} tds_GetNetworkDefaultGateway_RES; + +typedef struct +{ + int dummy; +} tds_SetNetworkDefaultGateway_RES; + +typedef struct +{ + onvif_NetworkZeroConfiguration ZeroConfiguration; // Contains the zero-configuration +} tds_GetZeroConfiguration_RES; + +typedef struct +{ + int dummy; +} tds_SetZeroConfiguration_RES; + +typedef struct +{ + char GUID[128]; +} tds_GetEndpointReference_RES; + +typedef struct +{ + uint32 AuxiliaryCommandResponseFlag : 1; // Indicates whether the field AuxiliaryCommandResponse is valid + uint32 Reserved : 31; + + char AuxiliaryCommandResponse[1024]; // optional +} tds_SendAuxiliaryCommand_RES; + +typedef struct +{ + RelayOutputList * RelayOutputs; +} tds_GetRelayOutputs_RES; + +typedef struct +{ + int dummy; +} tds_SetRelayOutputSettings_RES; + +typedef struct +{ + int dummy; +} tds_SetRelayOutputState_RES; + +typedef struct +{ + uint32 UTCDateTimeFlag : 1; // Indicates whether the field UTCDateTime is valid + uint32 LocalDateTimeFlag : 1; // Indicates whether the field LocalDateTime is valid + uint32 Reserved : 30; + + onvif_SystemDateTime SystemDateTime; // required, + onvif_DateTime UTCDateTime; // optional, Date and time in UTC. If time is obtained via NTP, UTCDateTime has no meaning + onvif_DateTime LocalDateTime; // optional, +} tds_GetSystemDateAndTime_RES; + +typedef struct +{ + int dummy; +} tds_SetSystemDateAndTime_RES; + +typedef struct +{ + int dummy; +} tds_SystemReboot_RES; + +typedef struct +{ + int dummy; +} tds_SetSystemFactoryDefault_RES; + +typedef struct +{ + char * String; // optional, Contains the system log information + // The caller should call FreeBuff to free the memory +} tds_GetSystemLog_RES; + +typedef struct +{ + uint32 sizeScopes; + + onvif_Scope Scopes[MAX_SCOPE_NUMS]; +} tds_GetScopes_RES; + +typedef struct +{ + int dummy; +} tds_SetScopes_RES; + +typedef struct +{ + int dummy; +} tds_AddScopes_RES; + +typedef struct +{ + int dummy; +} tds_RemoveScopes_RES; + +typedef struct +{ + char UploadUri[256]; // required + int UploadDelay; // required + int ExpectedDownTime; // required +} tds_StartFirmwareUpgrade_RES; + +typedef struct +{ + uint32 SystemLogUriFlag : 1; // Indicates whether the field SystemLogUri is valid + uint32 AccessLogUriFlag : 1; // Indicates whether the field AccessLogUri is valid + uint32 SupportInfoUriFlag : 1; // Indicates whether the field SupportInfoUri is valid + uint32 SystemBackupUriFlag : 1; // Indicates whether the field SystemBackupUri is valid + uint32 Reserved : 28; + + char SystemLogUri[256]; // optional + char AccessLogUri[256]; // optional + char SupportInfoUri[256]; // optional + char SystemBackupUri[256]; // optional +} tds_GetSystemUris_RES; + +typedef struct +{ + char UploadUri[256]; // required + int ExpectedDownTime; // required +} tds_StartSystemRestore_RES; + +typedef struct +{ + char WsdlUrl[256]; // required +} tds_GetWsdlUrl_RES; + +typedef struct +{ + onvif_Dot11Capabilities Capabilities; // required +} tds_GetDot11Capabilities_RES; + +typedef struct +{ + onvif_Dot11Status Status; // required +} tds_GetDot11Status_RES; + +typedef struct +{ + Dot11AvailableNetworksList * Networks; // optional +} tds_ScanAvailableDot11Networks_RES; + +typedef struct +{ + LocationEntityList * Location; // optional +} tds_GetGeoLocation_RES; + +typedef struct +{ + int dummy; +} tds_SetGeoLocation_RES; + +typedef struct +{ + int dummy; +} tds_DeleteGeoLocation_RES; + +typedef struct +{ + int dummy; +} tds_SetHashingAlgorithm_RES; + +typedef struct +{ + onvif_IPAddressFilter IPAddressFilter; // required +} tds_GetIPAddressFilter_RES; + +typedef struct +{ + int dummy; +} tds_SetIPAddressFilter_RES; + +typedef struct +{ + int dummy; +} tds_AddIPAddressFilter_RES; + +typedef struct +{ + int dummy; +} tds_RemoveIPAddressFilter_RES; + +typedef struct +{ + onvif_BinaryData PolicyFile; // required, need call free function to free PolicyFile.Data.ptr buffer +} tds_GetAccessPolicy_RES; + +typedef struct +{ + int dummy; +} tds_SetAccessPolicy_RES; + +typedef struct +{ + StorageConfigurationList * StorageConfigurations; // optional +} tds_GetStorageConfigurations_RES; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required +} tds_CreateStorageConfiguration_RES; + +typedef struct +{ + onvif_StorageConfiguration StorageConfiguration; // required +} tds_GetStorageConfiguration_RES; + +typedef struct +{ + int dummy; +} tds_SetStorageConfiguration_RES; + +typedef struct +{ + int dummy; +} tds_DeleteStorageConfiguration_RES; + +typedef struct +{ + onvif_MediaCapabilities Capabilities; // required, the capabilities for the media service is returned +} trt_GetServiceCapabilities_RES; + +typedef struct +{ + VideoSourceList * VideoSources; // List of existing Video Sources +} trt_GetVideoSources_RES; + +typedef struct +{ + AudioSourceList * AudioSources; // List of existing Audio Sources +} trt_GetAudioSources_RES; + +typedef struct +{ + ONVIF_PROFILE Profile; // required, returns the new created profile +} trt_CreateProfile_RES; + +typedef struct +{ + ONVIF_PROFILE Profile; // required, returns the requested media profile +} trt_GetProfile_RES; + +typedef struct +{ + ONVIF_PROFILE * Profiles; // lists all profiles that exist in the media service +} trt_GetProfiles_RES; + +typedef struct +{ + int dummy; +} trt_AddVideoEncoderConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_AddVideoSourceConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_AddAudioEncoderConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_AddAudioSourceConfiguration_RES; + +typedef struct +{ + VideoSourceModeList * VideoSourceModes; // Return the information for specified video source mode +} trt_GetVideoSourceModes_RES; + +typedef struct +{ + BOOL Reboot; // The response contains information about rebooting after returning response. When Reboot is set true, a device will reboot automatically after setting mode +} trt_SetVideoSourceMode_RES; + +typedef struct +{ + int dummy; +} trt_AddPTZConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_RemoveVideoEncoderConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_RemoveVideoSourceConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_RemoveAudioEncoderConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_RemoveAudioSourceConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_RemovePTZConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_DeleteProfile_RES; + +typedef struct +{ + VideoSourceConfigurationList * Configurations; // This element contains a list of video source configurations +} trt_GetVideoSourceConfigurations_RES; + +typedef struct +{ + VideoEncoderConfigurationList * Configurations; // This element contains a list of video encoder configurations +} trt_GetVideoEncoderConfigurations_RES; + +typedef struct +{ + AudioSourceConfigurationList * Configurations; // This element contains a list of audio source configurations +} trt_GetAudioSourceConfigurations_RES; + +typedef struct +{ + AudioEncoderConfigurationList * Configurations; // This element contains a list of audio encoder configurations +} trt_GetAudioEncoderConfigurations_RES; + +typedef struct +{ + onvif_VideoSourceConfiguration Configuration; // required, The requested video source configuration +} trt_GetVideoSourceConfiguration_RES; + +typedef struct +{ + onvif_VideoEncoderConfiguration Configuration; // required, The requested video encoder configuration +} trt_GetVideoEncoderConfiguration_RES; + +typedef struct +{ + onvif_AudioSourceConfiguration Configuration; // required, The requested audio source configuration +} trt_GetAudioSourceConfiguration_RES; + +typedef struct +{ + onvif_AudioEncoderConfiguration Configuration; // required, The requested audio encorder configuration +} trt_GetAudioEncoderConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_SetVideoSourceConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_SetVideoEncoderConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_SetAudioSourceConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_SetAudioEncoderConfiguration_RES; + +typedef struct +{ + onvif_VideoSourceConfigurationOptions Options; +} trt_GetVideoSourceConfigurationOptions_RES; + +typedef struct +{ + onvif_VideoEncoderConfigurationOptions Options; // required +} trt_GetVideoEncoderConfigurationOptions_RES; + +typedef struct +{ + int dummy; +} trt_GetAudioSourceConfigurationOptions_RES; + + +typedef struct +{ + onvif_AudioEncoderConfigurationOptions Options; // required +} trt_GetAudioEncoderConfigurationOptions_RES; + +typedef struct +{ + char Uri[ONVIF_URI_LEN]; // required, Stable Uri to be used for requesting the media stream + + int Timeout; // required, Duration how long the Uri is valid. This parameter shall be set to PT0S to indicate that this stream URI is indefinitely valid even if the profile changes + + BOOL InvalidAfterConnect; // required, Indicates if the Uri is only valid until the connection is established. The value shall be set to "false" + BOOL InvalidAfterReboot; // required, Indicates if the Uri is invalid after a reboot of the device. The value shall be set to "false" +} trt_GetStreamUri_RES; + +typedef struct +{ + int dummy; +} trt_SetSynchronizationPoint_RES; + +typedef struct +{ + char Uri[ONVIF_URI_LEN]; // required, Stable Uri to be used for requesting the media stream + + int Timeout; // required, Duration how long the Uri is valid. This parameter shall be set to PT0S to indicate that this stream URI is indefinitely valid even if the profile changes + + BOOL InvalidAfterConnect; // required, Indicates if the Uri is only valid until the connection is established. The value shall be set to "false" + BOOL InvalidAfterReboot; // required, Indicates if the Uri is invalid after a reboot of the device. The value shall be set to "false" +} trt_GetSnapshotUri_RES; + +typedef struct +{ + uint32 JPEGFlag : 1; // Indicates whether the field JPEG is valid + uint32 H264Flag : 1; // Indicates whether the field H264 is valid + uint32 MPEG4Flag : 1; // Indicates whether the field SupportInfoUri is valid + uint32 Reserved : 29; + + int TotalNumber; // required, The minimum guaranteed total number of encoder instances (applications) per VideoSourceConfiguration. The device is able to deliver the TotalNumber of streams + int JPEG; // optional, If a device limits the number of instances for respective Video Codecs the response contains the information how many Jpeg streams can be set up at the same time per VideoSource + int H264; // optional, If a device limits the number of instances for respective Video Codecs the response contains the information how many H264 streams can be set up at the same time per VideoSource + int MPEG4; // optional, If a device limits the number of instances for respective Video Codecs the response contains the information how many Mpeg4 streams can be set up at the same time per VideoSource +} trt_GetGuaranteedNumberOfVideoEncoderInstances_RES; + +typedef struct +{ + AudioOutputList * AudioOutputs; // optional, List of existing Audio Outputs +} trt_GetAudioOutputs_RES; + +typedef struct +{ + AudioOutputConfigurationList * Configurations; // optional, This element contains a list of audio output configurations +} trt_GetAudioOutputConfigurations_RES; + +typedef struct +{ + onvif_AudioOutputConfiguration Configuration; // The requested audio output configuration +} trt_GetAudioOutputConfiguration_RES; + +typedef struct +{ + onvif_AudioOutputConfigurationOptions Options; // required, This message contains the audio output configuration options. + // If a audio output configuration is specified, the options shall concern that particular configuration. + // If a media profile is specified, the options shall be compatible with that media profile. + // If no tokens are specified, the options shall be considered generic for the device +} trt_GetAudioOutputConfigurationOptions_RES; + +typedef struct +{ + int dummy; +} trt_SetAudioOutputConfiguration_RES; + +typedef struct +{ + AudioDecoderConfigurationList * Configurations; // optional, This element contains a list of audio decoder configurations +} trt_GetAudioDecoderConfigurations_RES; + +typedef struct +{ + onvif_AudioDecoderConfiguration Configuration; // The requested audio decoder configuration +} trt_GetAudioDecoderConfiguration_RES; + +typedef struct +{ + onvif_AudioDecoderConfigurationOptions Options; // required, This message contains the audio decoder configuration options. + // If a audio decoder configuration is specified, the options shall concern that particular configuration. + // If a media profile is specified, the options shall be compatible with that media profile. + // If no tokens are specified, the options shall be considered generic for the device +} trt_GetAudioDecoderConfigurationOptions_RES; + +typedef struct +{ + int dummy; +} trt_SetAudioDecoderConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_AddAudioOutputConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_AddAudioDecoderConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_RemoveAudioOutputConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_RemoveAudioDecoderConfiguration_RES; + +typedef struct +{ + OSDConfigurationList * OSDs; // This element contains a list of requested OSDs +} trt_GetOSDs_RES; + +typedef struct +{ + onvif_OSDConfiguration OSD; // required, The requested OSD configuration +} trt_GetOSD_RES; + +typedef struct +{ + int dummy; +} trt_SetOSD_RES; + +typedef struct +{ + onvif_OSDConfigurationOptions OSDOptions; // required, +} trt_GetOSDOptions_RES; + +typedef struct +{ + char OSDToken[ONVIF_TOKEN_LEN]; // required, Returns Token of the newly created OSD +} trt_CreateOSD_RES; + +typedef struct +{ + int dummy; +} trt_DeleteOSD_RES; + +typedef struct +{ + VideoAnalyticsConfigurationList * Configurations; // list of video analytics configurations +} trt_GetVideoAnalyticsConfigurations_RES; + +typedef struct +{ + int dummy; +} trt_AddVideoAnalyticsConfiguration_RES; + +typedef struct +{ + onvif_VideoAnalyticsConfiguration Configuration; // The requested video analytics configuration +} trt_GetVideoAnalyticsConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_RemoveVideoAnalyticsConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_SetVideoAnalyticsConfiguration_RES; + +typedef struct +{ + MetadataConfigurationList * Configurations; // list of metadata configurations +} trt_GetMetadataConfigurations_RES; + +typedef struct +{ + int dummy; +} trt_AddMetadataConfiguration_RES; + +typedef struct +{ + onvif_MetadataConfiguration Configuration; // The requested metadata configuration +} trt_GetMetadataConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_RemoveMetadataConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_SetMetadataConfiguration_RES; + +typedef struct +{ + onvif_MetadataConfigurationOptions Options; // If a metadata configuration is specified, the options shall concern that particular configuration. + // If a media profile is specified, the options shall be compatible with that media profile. + // If no tokens are specified, the options shall be considered generic for the device +} trt_GetMetadataConfigurationOptions_RES; + +typedef struct +{ + VideoEncoderConfigurationList * Configurations; // list of video encoder configurations +} trt_GetCompatibleVideoEncoderConfigurations_RES; + +typedef struct +{ + AudioEncoderConfigurationList * Configurations; // list of audio encoder configurations +} trt_GetCompatibleAudioEncoderConfigurations_RES; + +typedef struct +{ + VideoAnalyticsConfigurationList * Configurations; // list of video analytics configurations +} trt_GetCompatibleVideoAnalyticsConfigurations_RES; + +typedef struct +{ + MetadataConfigurationList * Configurations; // list of metadata configurations +} trt_GetCompatibleMetadataConfigurations_RES; + +typedef struct +{ + onvif_PTZCapabilities Capabilities; // required, the capabilities for the PTZ service is returned +} ptz_GetServiceCapabilities_RES; + +typedef struct +{ + PTZNodeList * PTZNode; // A list of the existing PTZ Nodes on the device +} ptz_GetNodes_RES; + +typedef struct +{ + onvif_PTZNode PTZNode; // required, A requested PTZNode +} ptz_GetNode_RES; + +typedef struct +{ + PTZPresetList * PTZPresets; // A list of presets which are available for the requested MediaProfile +} ptz_GetPresets_RES; + +typedef struct +{ + char PresetToken[ONVIF_TOKEN_LEN]; // required, A token to the Preset which has been set +} ptz_SetPreset_RES; + +typedef struct +{ + int dummy; +} ptz_RemovePreset_RES; + +typedef struct +{ + int dummy; +} ptz_GotoPreset_RES; + +typedef struct +{ + int dummy; +} ptz_GotoHomePosition_RES; + +typedef struct +{ + int dummy; +} ptz_SetHomePosition_RES; + +typedef struct +{ + onvif_PTZStatus PTZStatus; // required, The PTZStatus for the requested MediaProfile +} ptz_GetStatus_RES; + +typedef struct +{ + int dummy; +} ptz_ContinuousMove_RES; + +typedef struct +{ + int dummy; +} ptz_RelativeMove_RES; + +typedef struct +{ + int dummy; +} ptz_AbsoluteMove_RES; + +typedef struct +{ + int dummy; +} ptz_Stop_RES; + +typedef struct +{ + PTZConfigurationList * PTZConfiguration; // A list of all existing PTZConfigurations on the device +} ptz_GetConfigurations_RES; + +typedef struct +{ + onvif_PTZConfiguration PTZConfiguration; // required, A requested PTZConfiguration +} ptz_GetConfiguration_RES; + +typedef struct +{ + int dummy; +} ptz_SetConfiguration_RES; + +typedef struct +{ + onvif_PTZConfigurationOptions PTZConfigurationOptions; // required, The requested PTZ configuration options +} ptz_GetConfigurationOptions_RES; + +typedef struct +{ + PresetTourList * PresetTour; +} ptz_GetPresetTours_RES; + +typedef struct +{ + onvif_PresetTour PresetTour; +} ptz_GetPresetTour_RES; + +typedef struct +{ + onvif_PTZPresetTourOptions Options; +} ptz_GetPresetTourOptions_RES; + +typedef struct +{ + char PresetTourToken[ONVIF_TOKEN_LEN]; // required, +} ptz_CreatePresetTour_RES; + +typedef struct +{ + int dummy; +} ptz_ModifyPresetTour_RES; + +typedef struct +{ + int dummy; +} ptz_OperatePresetTour_RES; + +typedef struct +{ + int dummy; +} ptz_RemovePresetTour_RES; + +typedef struct +{ + char AuxiliaryResponse[1024]; // required, The response contains the auxiliary response +} ptz_SendAuxiliaryCommand_RES; + +typedef struct +{ + int dummy; +} ptz_GeoMove_RES; + +typedef struct +{ + onvif_EventCapabilities Capabilities; // required, The capabilities for the event service +} tev_GetServiceCapabilities_RES; + +typedef struct +{ + uint32 sizeTopicNamespaceLocation; + char TopicNamespaceLocation[10][256]; // required element of type xsd:anyURI + BOOL FixedTopicSet; // required element of type xsd:anyURI + + char * TopicSet; // required, the caller should free the memory + + uint32 sizeTopicExpressionDialect; + char TopicExpressionDialect[10][256]; // required element of type xsd:anyURI + uint32 sizeMessageContentFilterDialect; + char MessageContentFilterDialect[10][256]; // required element of type xsd:anyURI + uint32 sizeProducerPropertiesFilterDialect; + char ProducerPropertiesFilterDialect[10][256]; // optional element of type xsd:anyURI + uint32 sizeMessageContentSchemaLocation; + char MessageContentSchemaLocation[10][256]; // required element of type xsd:anyURI +} tev_GetEventProperties_RES; + +typedef struct +{ + int dummy; +} tev_Renew_RES; + +typedef struct +{ + int dummy; +} tev_Unsubscribe_RES; + +typedef struct +{ + char producter_addr[256]; // required + char ReferenceParameters[512]; // optional +} tev_Subscribe_RES; + +typedef struct +{ + int dummy; +} tev_PauseSubscription_RES; + +typedef struct +{ + int dummy; +} tev_ResumeSubscription_RES; + +typedef struct +{ + char producter_addr[256]; // required, Endpoint reference of the subscription to be used for pulling the messages + char ReferenceParameters[512]; // optional + + time_t CurrentTime; // required, Current time of the server for synchronization purposes + time_t TerminationTime; // required, Date time when the PullPoint will be shut down without further pull requests +} tev_CreatePullPointSubscription_RES; + +typedef struct +{ + int dummy; +} tev_DestroyPullPoint_RES; + +typedef struct +{ + time_t CurrentTime; // required, The date and time when the messages have been delivered by the web server to the client + time_t TerminationTime; // required, Date time when the PullPoint will be shut down without further pull requests + + NotificationMessageList * NotifyMessages; +} tev_PullMessages_RES; + +typedef struct +{ + NotificationMessageList * NotifyMessages; +} tev_GetMessages_RES; + +typedef struct +{ + int dummy; +} tev_Seek_RES; + +typedef struct +{ + int dummy; +} tev_SetSynchronizationPoint_RES; + +// imaging service + +typedef struct +{ + onvif_ImagingCapabilities Capabilities; // required, The capabilities for the imaging service is returned +} img_GetServiceCapabilities_RES; + +typedef struct +{ + onvif_ImagingSettings ImagingSettings; // required, ImagingSettings for the VideoSource that was requested +} img_GetImagingSettings_RES; + +typedef struct +{ + int dummy; +} img_SetImagingSettings_RES; + +typedef struct +{ + onvif_ImagingOptions ImagingOptions; // required, Valid ranges for the imaging parameters that are categorized as device specific +} img_GetOptions_RES; + +typedef struct +{ + int dummy; +} img_Move_RES; + +typedef struct +{ + int dummy; +} img_Stop_RES; + +typedef struct +{ + onvif_ImagingStatus Status; // required, Requested imaging status +} img_GetStatus_RES; + +typedef struct +{ + onvif_MoveOptions20 MoveOptions; // required, Valid ranges for the focus lens move options +} img_GetMoveOptions_RES; + +typedef struct +{ + ImagingPresetList * Preset; // required, List of Imaging Presets which are available for the requested VideoSource. +} img_GetPresets_RES; + +typedef struct +{ + uint32 PresetFlag : 1; // Indicates whether the field Preset is valid + uint32 Reserved : 31; + + onvif_ImagingPreset Preset; // optional, Current Imaging Preset in use for the specified Video Source +} img_GetCurrentPreset_RES; + +typedef struct +{ + int dummy; +} img_SetCurrentPreset_RES; + +// device IO + +typedef struct +{ + onvif_DeviceIOCapabilities Capabilities; // required, the capabilities for the deviceIO service is returned +} tmd_GetServiceCapabilities_RES; + +typedef struct +{ + RelayOutputList * RelayOutputs; +} tmd_GetRelayOutputs_RES; + +typedef struct +{ + RelayOutputOptionsList * RelayOutputOptions; +} tmd_GetRelayOutputOptions_RES; + +typedef struct +{ + int dummy; +} tmd_SetRelayOutputSettings_RES; + +typedef struct +{ + int dummy; +} tmd_SetRelayOutputState_RES; + +typedef struct +{ + DigitalInputList * DigitalInputs; +} tmd_GetDigitalInputs_RES; + +typedef struct +{ + onvif_DigitalInputConfigurationOptions DigitalInputOptions; +} tmd_GetDigitalInputConfigurationOptions_RES; + +typedef struct +{ + int dummy; +} tmd_SetDigitalInputConfigurations_RES; + + +// recording + +typedef struct +{ + onvif_RecordingCapabilities Capabilities; // required, The capabilities for the recording service +} trc_GetServiceCapabilities_RES; + +typedef struct +{ + char RecordingToken[ONVIF_TOKEN_LEN]; // required +} trc_CreateRecording_RES; + +typedef struct +{ + int dummy; +} trc_DeleteRecording_RES; + +typedef struct +{ + RecordingList * Recordings; +} trc_GetRecordings_RES; + +typedef struct +{ + int dummy; +} trc_SetRecordingConfiguration_RES; + +typedef struct +{ + onvif_RecordingConfiguration RecordingConfiguration; +} trc_GetRecordingConfiguration_RES; + +typedef struct +{ + onvif_RecordingOptions Options; +} trc_GetRecordingOptions_RES; + +typedef struct +{ + char TrackToken[ONVIF_TOKEN_LEN]; // required +} trc_CreateTrack_RES; + +typedef struct +{ + int dummy; +} trc_DeleteTrack_RES; + +typedef struct +{ + onvif_TrackConfiguration TrackConfiguration; // required +} trc_GetTrackConfiguration_RES; + +typedef struct +{ + int dummy; +} trc_SetTrackConfiguration_RES; + +typedef struct +{ + char JobToken[ONVIF_TOKEN_LEN]; // required + + onvif_RecordingJobConfiguration JobConfiguration; // required +} trc_CreateRecordingJob_RES; + +typedef struct +{ + int dummy; +} trc_DeleteRecordingJob_RES; + +typedef struct +{ + RecordingJobList * RecordingJobs; +} trc_GetRecordingJobs_RES; + +typedef struct +{ + onvif_RecordingJobConfiguration JobConfiguration; // required +} trc_SetRecordingJobConfiguration_RES; + +typedef struct +{ + onvif_RecordingJobConfiguration JobConfiguration; // required +} trc_GetRecordingJobConfiguration_RES; + +typedef struct +{ + int dummy; +} trc_SetRecordingJobMode_RES; + +typedef struct +{ + onvif_RecordingJobStateInformation State; // required +} trc_GetRecordingJobState_RES; + +typedef struct +{ + char OperationToken[ONVIF_TOKEN_LEN]; // required, Unique operation token for client to associate the relevant events + uint32 sizeFileNames; // sequence of elements + char FileNames[100][256]; // optional, List of exported file names. The device can also use AsyncronousOperationStatus event to publish this list +} trc_ExportRecordedData_RES; + +typedef struct +{ + float Progress; // required, Progress percentage of ExportRecordedData operation + onvif_ArrayOfFileProgress FileProgressStatus; // required, +} trc_StopExportRecordedData_RES; + +typedef struct +{ + float Progress; // required, Progress percentage of ExportRecordedData operation + onvif_ArrayOfFileProgress FileProgressStatus; // required, +} trc_GetExportRecordedDataState_RES; + +typedef struct +{ + onvif_ReplayCapabilities Capabilities; // required, The capabilities for the replay service +} trp_GetServiceCapabilities_RES; + +typedef struct +{ + char Uri[ONVIF_URI_LEN]; // required. The URI to which the client should connect in order to stream the recording +} trp_GetReplayUri_RES; + +typedef struct +{ + onvif_ReplayConfiguration Configuration; // required, The current replay configuration parameters +} trp_GetReplayConfiguration_RES; + +typedef struct +{ + int dummy; +} trp_SetReplayConfiguration_RES; + +typedef struct +{ + onvif_SearchCapabilities Capabilities; // required, The capabilities for the search service +} tse_GetServiceCapabilities_RES; + +typedef struct +{ + time_t DataFrom; // Required. The earliest point in time where there is recorded data on the device. + time_t DataUntil; // Required. The most recent point in time where there is recorded data on the device + int NumberRecordings; // Required. The device contains this many recordings +} tse_GetRecordingSummary_RES; + +typedef struct +{ + onvif_RecordingInformation RecordingInformation; // required +} tse_GetRecordingInformation_RES; + +typedef struct +{ + onvif_MediaAttributes MediaAttributes; +} tse_GetMediaAttributes_RES; + +typedef struct +{ + char SearchToken[ONVIF_TOKEN_LEN]; // Required, A unique reference to the search session created by this request +} tse_FindRecordings_RES; + +typedef struct +{ + onvif_FindRecordingResultList ResultList; +} tse_GetRecordingSearchResults_RES; + +typedef struct +{ + char SearchToken[ONVIF_TOKEN_LEN]; // Required, A unique reference to the search session created by this request +} tse_FindEvents_RES; + +typedef struct +{ + onvif_FindEventResultList ResultList; // Required, +} tse_GetEventSearchResults_RES; + +typedef struct +{ + char SearchToken[ONVIF_TOKEN_LEN]; // Required, A unique reference to the search session created by this request +} tse_FindMetadata_RES; + +typedef struct +{ + onvif_FindMetadataResultList ResultList; // Required, +} tse_GetMetadataSearchResults_RES; + +typedef struct +{ + char SearchToken[ONVIF_TOKEN_LEN]; // Required, A unique reference to the search session created by this request +} tse_FindPTZPosition_RES; + +typedef struct +{ + onvif_FindPTZPositionResultList ResultList; // Required, +} tse_GetPTZPositionSearchResults_RES; + +typedef struct +{ + onvif_SearchState State; +} tse_GetSearchState_RES; + +typedef struct +{ + time_t Endpoint; // Required, The point of time the search had reached when it was ended. It is equal to the EndPoint specified in Find-operation if the search was completed +} tse_EndSearch_RES; + +typedef struct +{ + onvif_AnalyticsCapabilities Capabilities; // required, The capabilities for the Analytics service +} tan_GetServiceCapabilities_RES; + +typedef struct +{ + onvif_SupportedRules SupportedRules; +} tan_GetSupportedRules_RES; + +typedef struct +{ + int dummy; +} tan_CreateRules_RES; + +typedef struct +{ + int dummy; +} tan_DeleteRules_RES; + +typedef struct +{ + ConfigList * Rule; // optional +} tan_GetRules_RES; + +typedef struct +{ + int dummy; +} tan_ModifyRules_RES; + +typedef struct +{ + int dummy; +} tan_CreateAnalyticsModules_RES; + +typedef struct +{ + int dummy; +} tan_DeleteAnalyticsModules_RES; + +typedef struct +{ + ConfigList * AnalyticsModule; // optional +} tan_GetAnalyticsModules_RES; + +typedef struct +{ + int dummy; +} tan_ModifyAnalyticsModules_RES; + +typedef struct +{ + onvif_SupportedAnalyticsModules SupportedAnalyticsModules; // required element of type ns2:SupportedAnalyticsModules +} tan_GetSupportedAnalyticsModules_RES; + +typedef struct +{ + ConfigOptionsList * RuleOptions; // optional, A device shall provide respective ConfigOptions.RuleType for each RuleOption + // if the request does not specify RuleType +} tan_GetRuleOptions_RES; + +typedef struct +{ + AnalyticsModuleConfigOptionsList * Options; // optional, +} tan_GetAnalyticsModuleOptions_RES; + +typedef struct +{ + MetadataInfoList * AnalyticsModule; // optional, +} tan_GetSupportedMetadata_RES; + +// onvif media service 2 interfaces + +typedef struct +{ + onvif_MediaCapabilities2 Capabilities; // required, The capabilities for the medai 2 service +} tr2_GetServiceCapabilities_RES; + +typedef struct +{ + VideoEncoder2ConfigurationList * Configurations; // This element contains a list of video encoder configurations +} tr2_GetVideoEncoderConfigurations_RES; + +typedef struct +{ + VideoEncoder2ConfigurationOptionsList * Options; // required +} tr2_GetVideoEncoderConfigurationOptions_RES; + +typedef struct +{ + int dummy; +} tr2_SetVideoEncoderConfiguration_RES; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, Token assigned by the device for the newly created profile +} tr2_CreateProfile_RES; + +typedef struct +{ + MediaProfileList * Profiles; // Lists all profiles that exist in the media service. + // The response provides the requested types of Configurations as far as available. + // If a profile doesn't contain a type no error shall be provided +} tr2_GetProfiles_RES; + +typedef struct +{ + int dummy; +} tr2_DeleteProfile_RES; + +typedef struct +{ + char Uri[256]; // required, Stable Uri to be used for requesting the media stream +} tr2_GetStreamUri_RES; + +typedef struct +{ + VideoSourceConfigurationList * Configurations; // This element contains a list of video source configurations +} tr2_GetVideoSourceConfigurations_RES; + +typedef struct +{ + onvif_VideoSourceConfigurationOptions Options; // This message contains the video source configuration options. + // If a video source configuration is specified, the options shall concern that particular configuration. + // If a media profile is specified, the options shall be compatible with that media profile. + // If no tokens are specified, the options shall be considered generic for the device +} tr2_GetVideoSourceConfigurationOptions_RES; + +typedef struct +{ + int dummy; +} tr2_SetVideoSourceConfiguration_RES; + +typedef struct +{ + int dummy; +} tr2_SetSynchronizationPoint_RES; + +typedef struct +{ + MetadataConfigurationList * Configurations; // This element contains a list of metadata configurations +} tr2_GetMetadataConfigurations_RES; + +typedef struct +{ + onvif_MetadataConfigurationOptions Options; // This message contains the metadata configuration options. + // If a metadata configuration is specified, the options shall concern that particular configuration. + // If a media profile is specified, the options shall be compatible with that media profile. + // If no tokens are specified, the options shall be considered generic for the device +} tr2_GetMetadataConfigurationOptions_RES; + +typedef struct +{ + int dummy; +} tr2_SetMetadataConfiguration_RES; + +typedef struct +{ + AudioEncoder2ConfigurationList * Configurations; // This element contains a list of audio encoder configurations +} tr2_GetAudioEncoderConfigurations_RES; + +typedef struct +{ + AudioSourceConfigurationList * Configurations; // This element contains a list of audio source configurations +} tr2_GetAudioSourceConfigurations_RES; + +typedef struct +{ + int dummy; +} tr2_GetAudioSourceConfigurationOptions_RES; + +typedef struct +{ + int dummy; +} tr2_SetAudioSourceConfiguration_RES; + +typedef struct +{ + int dummy; +} tr2_SetAudioEncoderConfiguration_RES; + +typedef struct +{ + AudioEncoder2ConfigurationOptionsList * Options; // This message contains the audio encoder configuration options. + // If a audio encoder configuration is specified, the options shall concern that particular configuration. + // If a media profile is specified, the options shall be compatible with that media profile. + // If no tokens are specified, the options shall be considered generic for the device +} tr2_GetAudioEncoderConfigurationOptions_RES; + +typedef struct +{ + int dummy; +} tr2_AddConfiguration_RES; + +typedef struct +{ + int dummy; +} tr2_RemoveConfiguration_RES; + +typedef struct +{ + onvif_EncoderInstanceInfo Info; // required, The minimum guaranteed total number of encoder instances (applications) per VideoSourceConfiguration +} tr2_GetVideoEncoderInstances_RES; + +typedef struct +{ + AudioOutputConfigurationList * Configurations; // optional, This element contains a list of audio output configurations +} tr2_GetAudioOutputConfigurations_RES; + +typedef struct +{ + onvif_AudioOutputConfigurationOptions Options; // required, This message contains the audio output configuration options. + // If a audio output configuration is specified, the options shall concern that particular configuration. + // If a media profile is specified, the options shall be compatible with that media profile. + // If no tokens are specified, the options shall be considered generic for the device +} tr2_GetAudioOutputConfigurationOptions_RES; + +typedef struct +{ + int dummy; +} tr2_SetAudioOutputConfiguration_RES; + +typedef struct +{ + AudioDecoderConfigurationList * Configurations; // optional, This element contains a list of audio decoder configurations +} tr2_GetAudioDecoderConfigurations_RES; + +typedef struct +{ + AudioEncoder2ConfigurationOptionsList * Options; // optional, This message contains the audio decoder configuration options. + // If a audio decoder configuration is specified, the options shall concern that particular configuration. + // If a media profile is specified, the options shall be compatible with that media profile. + // If no tokens are specified, the options shall be considered generic for the device +} tr2_GetAudioDecoderConfigurationOptions_RES; + +typedef struct +{ + int dummy; +} tr2_SetAudioDecoderConfiguration_RES; + +typedef struct +{ + char Uri[512]; // required, Stable Uri to be used for requesting snapshot images +} tr2_GetSnapshotUri_RES; + +typedef struct +{ + int dummy; +} tr2_StartMulticastStreaming_RES; + +typedef struct +{ + int dummy; +} tr2_StopMulticastStreaming_RES; + +typedef struct +{ + VideoSourceModeList * VideoSourceModes; //required, Return the information for specified video source mode +} tr2_GetVideoSourceModes_RES; + +typedef struct +{ + BOOL Reboot; // required, The response contains information about rebooting after returning response. + // When Reboot is set true, a device will reboot automatically after setting mode +} tr2_SetVideoSourceMode_RES; + +typedef struct +{ + char OSDToken[ONVIF_TOKEN_LEN]; // required, Returns Token of the newly created OSD +} tr2_CreateOSD_RES; + +typedef struct +{ + int dummy; +} tr2_DeleteOSD_RES; + +typedef struct +{ + OSDConfigurationList * OSDs; // optional, This element contains a list of requested OSDs +} tr2_GetOSDs_RES; + +typedef struct +{ + int dummy; +} tr2_SetOSD_RES; + +typedef struct +{ + onvif_OSDConfigurationOptions OSDOptions; // required +} tr2_GetOSDOptions_RES; + +typedef struct +{ + VideoAnalyticsConfigurationList * Configurations; // optional, This element contains a list of Analytics configurations +} tr2_GetAnalyticsConfigurations_RES; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, Returns Token of the newly created Mask +} tr2_CreateMask_RES; + +typedef struct +{ + MaskList * Masks; // optional, List of Mask configurations +} tr2_GetMasks_RES; + +typedef struct +{ + int dummy; +} tr2_SetMask_RES; + +typedef struct +{ + int dummy; +} tr2_DeleteMask_RES; + +typedef struct +{ + onvif_MaskOptions Options; // required, +} tr2_GetMaskOptions_RES; + +// end of onvif media 2 interfaces + +typedef struct +{ + onvif_AccessControlCapabilities Capabilities; // required, The capabilities for the access control service +} tac_GetServiceCapabilities_RES; + +typedef struct +{ + uint32 NextStartReferenceFlag : 1; + uint32 Reserved : 31; + + char NextStartReference[ONVIF_TOKEN_LEN]; // optional, StartReference to use in next call to get the following items. If absent, no more items to get + + AccessPointList * AccessPointInfo; // optional, List of AccessPointInfo items +} tac_GetAccessPointInfoList_RES; + +typedef struct +{ + AccessPointList * AccessPointInfo; // List of AccessPointInfo items +} tac_GetAccessPointInfo_RES; + +typedef struct +{ + uint32 NextStartReferenceFlag : 1; + uint32 Reserved : 31; + + char NextStartReference[ONVIF_TOKEN_LEN]; // optional, StartReference to use in next call to get the following items. If absent, no more items to get + + AccessPointList * AccessPoint; // optional, List of AccessPoint items +} tac_GetAccessPointList_RES; + +typedef struct +{ + AccessPointList * AccessPoint; // optional, List of AccessPoint items +} tac_GetAccessPoints_RES; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required +} tac_CreateAccessPoint_RES; + +typedef struct +{ + int dummy; +} tac_SetAccessPoint_RES; + +typedef struct +{ + int dummy; +} tac_ModifyAccessPoint_RES; + +typedef struct +{ + int dummy; +} tac_DeleteAccessPoint_RES; + +typedef struct +{ + uint32 NextStartReferenceFlag : 1; + uint32 Reserved : 31; + + char NextStartReference[ONVIF_TOKEN_LEN]; // optional, StartReference to use in next call to get the following items. If absent, no more items to get + + AreaList * AreaInfo; // optional, List of AreaInfo items +} tac_GetAreaInfoList_RES; + +typedef struct +{ + AreaList * AreaInfo; // List of AreaInfo items +} tac_GetAreaInfo_RES; + +typedef struct +{ + uint32 NextStartReferenceFlag : 1; + uint32 Reserved : 31; + + char NextStartReference[ONVIF_TOKEN_LEN]; // optional, StartReference to use in next call to get the following items. If absent, no more items to get + + AreaList * Area; // optional, List of Area items +} tac_GetAreaList_RES; + +typedef struct +{ + AreaList * Area; // optional, List of Area items +} tac_GetAreas_RES; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required +} tac_CreateArea_RES; + +typedef struct +{ + int dummy; +} tac_SetArea_RES; + +typedef struct +{ + int dummy; +} tac_ModifyArea_RES; + +typedef struct +{ + int dummy; +} tac_DeleteArea_RES; + +typedef struct +{ + BOOL Enabled; // required, Indicates that the AccessPoint is enabled. + // By default this field value shall be True, if the DisableAccessPoint capabilities is not supported +} tac_GetAccessPointState_RES; + +typedef struct +{ + int dummy; +} tac_EnableAccessPoint_RES; + +typedef struct +{ + int dummy; +} tac_DisableAccessPoint_RES; + +typedef struct +{ + onvif_DoorControlCapabilities Capabilities; // required, The capabilities for the door control service +} tdc_GetServiceCapabilities_RES; + +typedef struct +{ + uint32 NextStartReferenceFlag : 1; + uint32 Reserved : 31; + + char NextStartReference[ONVIF_TOKEN_LEN]; // optional, StartReference to use in next call to get the following items. If absent, no more items to get + + DoorInfoList * DoorInfo; // optional, List of DoorInfo items +} tdc_GetDoorInfoList_RES; + +typedef struct +{ + DoorInfoList * DoorInfo; // List of DoorInfo items +} tdc_GetDoorInfo_RES; + +typedef struct +{ + onvif_DoorState DoorState; +} tdc_GetDoorState_RES; + +typedef struct +{ + int dummy; +} tdc_AccessDoor_RES; + +typedef struct +{ + int dummy; +} tdc_LockDoor_RES; + +typedef struct +{ + int dummy; +} tdc_UnlockDoor_RES; + +typedef struct +{ + int dummy; +} tdc_DoubleLockDoor_RES; + +typedef struct +{ + int dummy; +} tdc_BlockDoor_RES; + +typedef struct +{ + int dummy; +} tdc_LockDownDoor_RES; + +typedef struct +{ + int dummy; +} tdc_LockDownReleaseDoor_RES; + +typedef struct +{ + int dummy; +} tdc_LockOpenDoor_RES; + +typedef struct +{ + int dummy; +} tdc_LockOpenReleaseDoor_RES; + +typedef struct +{ + DoorList * Door; // optional, List of Door items +} tdc_GetDoors_RES; + +typedef struct +{ + uint32 NextStartReferenceFlag : 1; + uint32 Reserved : 31; + + char NextStartReference[ONVIF_TOKEN_LEN]; // optional, StartReference to use in next call to get the following items. If absent, no more items to get + + DoorList * Door; // optional, List of Door items +} tdc_GetDoorList_RES; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, Token of created Door item +} tdc_CreateDoor_RES; + +typedef struct +{ + int dummy; +} tdc_SetDoor_RES; + +typedef struct +{ + int dummy; +} tdc_ModifyDoor_RES; + +typedef struct +{ + int dummy; +} tdc_DeleteDoor_RES; + +// thermal service + +typedef struct +{ + onvif_ThermalCapabilities Capabilities; // required, The capabilities for the thermal service +} tth_GetServiceCapabilities_RES; + +typedef struct +{ + ThermalConfigurationList * Configurations; // This element contains a list of thermal VideoSource configurations +} tth_GetConfigurations_RES; + +typedef struct +{ + onvif_ThermalConfiguration Configuration; // required, thermal Settings for the VideoSource that was requested +} tth_GetConfiguration_RES; + +typedef struct +{ + int dummy; +} tth_SetConfiguration_RES; + +typedef struct +{ + onvif_ThermalConfigurationOptions Options; // required, Valid ranges for the Thermal configuration parameters that are categorized as device specific +} tth_GetConfigurationOptions_RES; + +typedef struct +{ + onvif_RadiometryConfiguration Configuration; // required, Radiometry Configuration for the VideoSource that was requested +} tth_GetRadiometryConfiguration_RES; + +typedef struct +{ + int dummy; +} tth_SetRadiometryConfiguration_RES; + +typedef struct +{ + onvif_RadiometryConfigurationOptions Options; // required, Valid ranges for the Thermal Radiometry parameters that are categorized as device specific +} tth_GetRadiometryConfigurationOptions_RES; + +typedef struct +{ + onvif_CredentialCapabilities Capabilities; // required, The capabilities for the credential service +} tcr_GetServiceCapabilities_RES; + +typedef struct +{ + uint32 sizeCredentialInfo; // sequence of elements + + onvif_CredentialInfo CredentialInfo[CREDENTIAL_MAX_LIMIT]; // optional, List of CredentialInfo items +} tcr_GetCredentialInfo_RES; + +typedef struct +{ + uint32 NextStartReferenceFlag : 1; // Indicates whether the field StartReference is valid + uint32 Reserved : 31; + + char NextStartReference[ONVIF_TOKEN_LEN]; // optional, StartReference to use in next call to get the following items. If + // absent, no more items to get + uint32 sizeCredentialInfo; // sequence of elements + + onvif_CredentialInfo CredentialInfo[CREDENTIAL_MAX_LIMIT]; // optional, List of CredentialInfo items +} tcr_GetCredentialInfoList_RES; + +typedef struct +{ + uint32 sizeCredential; // sequence of elements + + onvif_Credential Credential[CREDENTIAL_MAX_LIMIT]; // optional, List of Credential items +} tcr_GetCredentials_RES; + +typedef struct +{ + uint32 NextStartReferenceFlag : 1; // Indicates whether the field StartReference is valid + uint32 Reserved : 31; + + char NextStartReference[ONVIF_TOKEN_LEN]; // optional, StartReference to use in next call to get the following items. If + // absent, no more items to get + uint32 sizeCredential; // sequence of elements + onvif_Credential Credential[CREDENTIAL_MAX_LIMIT]; // optional, List of Credential items +} tcr_GetCredentialList_RES; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, The token of the created credential +} tcr_CreateCredential_RES; + +typedef struct +{ + int dummy; +} tcr_ModifyCredential_RES; + +typedef struct +{ + int dummy; +} tcr_DeleteCredential_RES; + +typedef struct +{ + onvif_CredentialState State; // required, State of the credential +} tcr_GetCredentialState_RES; + +typedef struct +{ + int dummy; +} tcr_EnableCredential_RES; + +typedef struct +{ + int dummy; +} tcr_DisableCredential_RES; + +typedef struct +{ + int dummy; +} tcr_ResetAntipassbackViolation_RES; + +typedef struct +{ + uint32 sizeFormatTypeInfo; // sequence of elements + + onvif_CredentialIdentifierFormatTypeInfo FormatTypeInfo[CREDENTIAL_MAX_LIMIT]; // required, Identifier format types +} tcr_GetSupportedFormatTypes_RES; + +typedef struct +{ + uint32 sizeCredentialIdentifier; // sequence of elements + + onvif_CredentialIdentifier CredentialIdentifier[CREDENTIAL_MAX_LIMIT]; // optional, Identifiers of the credential +} tcr_GetCredentialIdentifiers_RES; + +typedef struct +{ + int dummy; +} tcr_SetCredentialIdentifier_RES; + +typedef struct +{ + int dummy; +} tcr_DeleteCredentialIdentifier_RES; + +typedef struct +{ + uint32 sizeCredentialAccessProfile; // sequence of elements + + onvif_CredentialAccessProfile CredentialAccessProfile[CREDENTIAL_MAX_LIMIT]; // optional, Access Profiles of the credential +} tcr_GetCredentialAccessProfiles_RES; + +typedef struct +{ + int dummy; +} tcr_SetCredentialAccessProfiles_RES; + +typedef struct +{ + int dummy; +} tcr_DeleteCredentialAccessProfiles_RES; + +typedef struct +{ + onvif_AccessRulesCapabilities Capabilities; // required, The capabilities for the access rules service +} tar_GetServiceCapabilities_RES; + +typedef struct +{ + uint32 sizeAccessProfileInfo; // sequence of elements + + onvif_AccessProfileInfo AccessProfileInfo[ACCESSRULES_MAX_LIMIT]; // optional, List of AccessProfileInfo items +} tar_GetAccessProfileInfo_RES; + +typedef struct +{ + uint32 NextStartReferenceFlag : 1; // Indicates whether the field NextStartReference is valid + uint32 Reserved : 31; + + char NextStartReference[ONVIF_TOKEN_LEN]; // optional, + uint32 sizeAccessProfileInfo; // sequence of elements + + onvif_AccessProfileInfo AccessProfileInfo[ACCESSRULES_MAX_LIMIT]; // optional, List of AccessProfileInfo items +} tar_GetAccessProfileInfoList_RES; + +typedef struct +{ + uint32 sizeAccessProfile; // sequence of elements + + onvif_AccessProfile AccessProfile[ACCESSRULES_MAX_LIMIT]; // optional, List of Access Profile items +} tar_GetAccessProfiles_RES; + +typedef struct +{ + uint32 NextStartReferenceFlag : 1; // Indicates whether the field NextStartReference is valid + uint32 Reserved : 31; + + char NextStartReference[ONVIF_TOKEN_LEN]; // optional, + uint32 sizeAccessProfile; // sequence of elements + + onvif_AccessProfile AccessProfile[ACCESSRULES_MAX_LIMIT]; // optional, List of Access Profile items +} tar_GetAccessProfileList_RES; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, The Token of created AccessProfile +} tar_CreateAccessProfile_RES; + +typedef struct +{ + int dummy; +} tar_ModifyAccessProfile_RES; + +typedef struct +{ + int dummy; +} tar_DeleteAccessProfile_RES; + +typedef struct +{ + onvif_ScheduleCapabilities Capabilities; // required, The capabilities for the Schedule service +} tsc_GetServiceCapabilities_RES; + +typedef struct +{ + uint32 sizeScheduleInfo; // sequence of elements + onvif_ScheduleInfo ScheduleInfo[SCHEDULE_MAX_LIMIT]; // optional, List of ScheduleInfo items +} tsc_GetScheduleInfo_RES; + +typedef struct +{ + uint32 NextStartReferenceFlag : 1; // Indicates whether the field StartReference is valid + uint32 Reserved : 31; + + char NextStartReference[ONVIF_TOKEN_LEN]; // optional, StartReference to use in next call to get the following items. If + // absent, no more items to get + uint32 sizeScheduleInfo; // sequence of elements + + onvif_ScheduleInfo ScheduleInfo[SCHEDULE_MAX_LIMIT]; // optional, List of ScheduleInfo items +} tsc_GetScheduleInfoList_RES; + +typedef struct +{ + uint32 sizeSchedule; // sequence of elements + onvif_Schedule Schedule[SCHEDULE_MAX_LIMIT]; // optional, List of schedule items +} tsc_GetSchedules_RES; + +typedef struct +{ + uint32 NextStartReferenceFlag : 1; // Indicates whether the field StartReference is valid + uint32 Reserved : 31; + + char NextStartReference[ONVIF_TOKEN_LEN]; // optional, StartReference to use in next call to get the following items. If + // absent, no more items to get + uint32 sizeSchedule; // sequence of elements + + onvif_Schedule Schedule[SCHEDULE_MAX_LIMIT]; // optional, List of Schedule items +} tsc_GetScheduleList_RES; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, The token of created Schedule +} tsc_CreateSchedule_RES; + +typedef struct +{ + int dummy; +} tsc_ModifySchedule_RES; + +typedef struct +{ + int dummy; +} tsc_DeleteSchedule_RES; + +typedef struct +{ + uint32 sizeSpecialDayGroupInfo; // sequence of elements + onvif_SpecialDayGroupInfo SpecialDayGroupInfo[SCHEDULE_MAX_LIMIT]; // optional, List of SpecialDayGroupInfo items +} tsc_GetSpecialDayGroupInfo_RES; + +typedef struct +{ + uint32 NextStartReferenceFlag : 1; // Indicates whether the field StartReference is valid + uint32 Reserved : 31; + + char NextStartReference[ONVIF_TOKEN_LEN]; // optional, StartReference to use in next call to get the following items. If + // absent, no more items to get + uint32 sizeSpecialDayGroupInfo; // sequence of elements + + onvif_SpecialDayGroupInfo SpecialDayGroupInfo[SCHEDULE_MAX_LIMIT]; // optional, List of SpecialDayGroupInfo items +} tsc_GetSpecialDayGroupInfoList_RES; + +typedef struct +{ + uint32 sizeSpecialDayGroup; // sequence of elements + onvif_SpecialDayGroup SpecialDayGroup[SCHEDULE_MAX_LIMIT]; // optional, List of SpecialDayGroup items +} tsc_GetSpecialDayGroups_RES; + +typedef struct +{ + uint32 NextStartReferenceFlag : 1; // Indicates whether the field StartReference is valid + uint32 Reserved : 31; + + char NextStartReference[ONVIF_TOKEN_LEN]; // optional, StartReference to use in next call to get the following items. If + // absent, no more items to get + uint32 sizeSpecialDayGroup; // sequence of elements + + onvif_SpecialDayGroup SpecialDayGroup[SCHEDULE_MAX_LIMIT]; // optional, List of SpecialDayGroup items +} tsc_GetSpecialDayGroupList_RES; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, The token of created special day group +} tsc_CreateSpecialDayGroup_RES; + +typedef struct +{ + int dummy; +} tsc_ModifySpecialDayGroup_RES; + +typedef struct +{ + int dummy; +} tsc_DeleteSpecialDayGroup_RES; + +typedef struct +{ + onvif_ScheduleState ScheduleState; // required, ScheduleState item +} tsc_GetScheduleState_RES; + +typedef struct +{ + onvif_ReceiverCapabilities Capabilities; // required, The capabilities for the Receiver service +} trv_GetServiceCapabilities_RES; + +typedef struct +{ + ReceiverList * Receivers; // required, A list of all receivers that currently exist on the device +} trv_GetReceivers_RES; + +typedef struct +{ + onvif_Receiver Receiver; // required, The details of the receiver +} trv_GetReceiver_RES; + +typedef struct +{ + onvif_Receiver Receiver; // required, The details of the receiver that was created +} trv_CreateReceiver_RES; + +typedef struct +{ + int dummy; +} trv_DeleteReceiver_RES; + +typedef struct +{ + int dummy; +} trv_ConfigureReceiver_RES; + +typedef struct +{ + int dummy; +} trv_SetReceiverMode_RES; + +typedef struct +{ + onvif_ReceiverStateInformation ReceiverState; // required, Description of the current receiver state +} trv_GetReceiverState_RES; + +typedef struct +{ + onvif_ProvisioningCapabilities Capabilities; // required, The capabilities for the Receiver service +} tpv_GetServiceCapabilities_RES; + +typedef struct +{ + int dummy; +} tpv_PanMove_RES; + +typedef struct +{ + int dummy; +} tpv_TiltMove_RES; + +typedef struct +{ + int dummy; +} tpv_ZoomMove_RES; + +typedef struct +{ +} tpv_RollMove_RES; + +typedef struct +{ + int dummy; +} tpv_FocusMove_RES; + +typedef struct +{ + int dummy; +} tpv_Stop_RES; + +typedef struct +{ + onvif_Usage Usage; // required, The set of lifetime usage values for the provisioning associated with the video source +} tpv_GetUsage_RES; + + +#endif // end of ONVIF_RES_H + + + diff --git a/MediaClient/MediaClient/onvif/onvif_utils.h b/MediaClient/MediaClient/onvif/onvif_utils.h new file mode 100644 index 0000000..181d2c2 --- /dev/null +++ b/MediaClient/MediaClient/onvif/onvif_utils.h @@ -0,0 +1,52 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef _ONVIF_UTILS_H_ +#define _ONVIF_UTILS_H_ + +#include "sys_inc.h" +#include "onvif.h" + +#ifdef __cplusplus +extern "C" { +#endif + +HT_API void onvif_get_time_str(char * buff, int len, int sec_off); +HT_API void onvif_get_time_str_s(char * buff, int len, time_t nowtime, int sec_off); +HT_API BOOL onvif_is_valid_hostname(const char * name); +HT_API BOOL onvif_is_valid_timezone(const char * tz); +HT_API void onvif_get_timezone(char * tz, int len, BOOL * daylight); +HT_API char * onvif_uuid_create(char * uuid, int len); +HT_API time_t onvif_timegm(struct tm *T); +HT_API int onvif_parse_xaddr(const char * pdata, char * host, int hostsize, char * url, int urlsize, int * port, int * https); +HT_API time_t onvif_datetime_to_time_t(onvif_DateTime * p_datetime); +HT_API void onvif_time_t_to_datetime(time_t n, onvif_DateTime * p_datetime); +HT_API char * onvif_format_datetime_str(time_t n, int flag, const char * format, char * buff, int buflen); +HT_API time_t onvif_timegm(struct tm *T); +HT_API int onvif_parse_uri(const char * p_in, char * p_out, int outlen); +HT_API char * onvif_format_float_num(float num, int precision, char * buff, int len); + +#ifdef __cplusplus +} +#endif + + +#endif + + diff --git a/MediaClient/MediaClient/onvif/onvif_ver.h b/MediaClient/MediaClient/onvif/onvif_ver.h new file mode 100644 index 0000000..b455dd9 --- /dev/null +++ b/MediaClient/MediaClient/onvif/onvif_ver.h @@ -0,0 +1,29 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef ONVIF_VER_H +#define ONVIF_VER_H + +#define ONVIF_CLIENT_VERSION "V12.0" + + +#endif + + + diff --git a/MediaClient/MediaClient/onvif/soap.h b/MediaClient/MediaClient/onvif/soap.h new file mode 100644 index 0000000..dc24ec2 --- /dev/null +++ b/MediaClient/MediaClient/onvif/soap.h @@ -0,0 +1,40 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef SOAP_H +#define SOAP_H + +#include "sys_inc.h" +#include "onvif.h" +#include "xml_node.h" + +#ifdef __cplusplus +extern "C" { +#endif + +BOOL onvif_rly_handler(XMLN * p_xml, eOnvifAction act, ONVIF_DEVICE * p_dev, void * p_res); + +#ifdef __cplusplus +} +#endif + + +#endif + + diff --git a/MediaClient/MediaClient/onvif/soap_parser.h b/MediaClient/MediaClient/onvif/soap_parser.h new file mode 100644 index 0000000..82201cd --- /dev/null +++ b/MediaClient/MediaClient/onvif/soap_parser.h @@ -0,0 +1,435 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef SOAP_PARSER_H +#define SOAP_PARSER_H + +#include "sys_inc.h" +#include "onvif.h" +#include "xml_node.h" +#include "onvif_res.h" + +#ifdef __cplusplus +extern "C" { +#endif + +HT_API BOOL parse_Bool(const char * pdata); +HT_API int parse_DeviceType(const char * pdata); +HT_API int parse_XAddr(const char * pdata, onvif_XAddr * p_xaddr); + +int parse_Time(const char * pdata); +BOOL parse_XSDDatetime(const char * s, time_t * p); +BOOL parse_XSDDuration(const char *s, int *a); +BOOL parse_Fault(XMLN * p_node, onvif_Fault * p_res); +BOOL parse_FloatRangeList(const char * p_buff, onvif_FloatRange * p_res); +BOOL parse_IntList(XMLN * p_node, onvif_IntList * p_res); +BOOL parse_IntRange(XMLN * p_node, onvif_IntRange * p_res); +BOOL parse_FloatRange(XMLN * p_node, onvif_FloatRange * p_res); +BOOL parse_EncodingList(const char * p_encoding, onvif_RecordingCapabilities * p_res); +BOOL parse_Vector(XMLN * p_node, onvif_Vector * p_res); +BOOL parse_Vector1D(XMLN * p_node, onvif_Vector1D * p_res); +BOOL parse_PTZSpeed(XMLN * p_node, onvif_PTZSpeed * p_res); +BOOL parse_PTZVector(XMLN * p_node, onvif_PTZVector * p_res); +BOOL parse_AnalyticsCapabilities(XMLN * p_node, onvif_AnalyticsCapabilities * p_res); +BOOL parse_DeviceCapabilities(XMLN * p_node, onvif_DevicesCapabilities * p_res); +BOOL parse_EventsCapabilities(XMLN * p_node, onvif_EventCapabilities * p_res); +BOOL parse_ImageCapabilities(XMLN * p_node, onvif_ImagingCapabilities * p_res); +BOOL parse_MediaCapabilities(XMLN * p_node, onvif_MediaCapabilities * p_res); +BOOL parse_PTZCapabilities(XMLN * p_node, onvif_PTZCapabilities * p_res); +BOOL parse_DeviceIOCapabilities(XMLN * p_node, onvif_DeviceIOCapabilities * p_res); +BOOL parse_RecordingCapabilities(XMLN * p_node, onvif_RecordingCapabilities * p_res); +BOOL parse_SearchCapabilities(XMLN * p_node, onvif_SearchCapabilities * p_res); +BOOL parse_ReplayCapabilities(XMLN * p_node, onvif_ReplayCapabilities * p_res); +BOOL parse_Version(XMLN * p_node, onvif_Version * p_res); +BOOL parse_DeviceServiceCapabilities(XMLN * p_node, onvif_DevicesCapabilities * p_res); +BOOL parse_DeviceService(XMLN * p_node, onvif_DevicesCapabilities * p_res); +BOOL parse_MediaServiceCapabilities(XMLN * p_node, onvif_MediaCapabilities * p_res); +BOOL parse_MediaService(XMLN * p_node, onvif_MediaCapabilities * p_res); +BOOL parse_Media2ServiceCapabilities(XMLN * p_node, onvif_MediaCapabilities2 * p_res); +BOOL parse_Media2Service(XMLN * p_node, onvif_MediaCapabilities2 * p_res); +BOOL parse_EventServiceCapabilities(XMLN * p_node, onvif_EventCapabilities * p_res); +BOOL parse_EventsService(XMLN * p_node, onvif_EventCapabilities * p_res); +BOOL parse_PTZServiceCapabilities(XMLN * p_node, onvif_PTZCapabilities * p_res); +BOOL parse_PTZService(XMLN * p_node, onvif_PTZCapabilities * p_res); +BOOL parse_ImagingServiceCapabilities(XMLN * p_node, onvif_ImagingCapabilities * p_res); +BOOL parse_ImagingService(XMLN * p_node, onvif_ImagingCapabilities * p_res); +BOOL parse_AnalyticsServiceCapabilities(XMLN * p_node, onvif_AnalyticsCapabilities * p_res); +BOOL parse_AnalyticsService(XMLN * p_node, onvif_AnalyticsCapabilities * p_res); +BOOL parse_VideoSourceConfiguration(XMLN * p_node, onvif_VideoSourceConfiguration * p_res); +BOOL parse_AudioSourceConfiguration(XMLN * p_node, onvif_AudioSourceConfiguration * p_res); +BOOL parse_MulticastConfiguration(XMLN * p_node, onvif_MulticastConfiguration * p_res); +BOOL parse_VideoResolution(XMLN * p_node, onvif_VideoResolution * p_res); +BOOL parse_ImagingSettings(XMLN * p_node, onvif_ImagingSettings * p_res); +BOOL parse_VideoSource(XMLN * p_node, onvif_VideoSource * p_res); +BOOL parse_AudioSource(XMLN * p_node, onvif_AudioSource * p_res); +BOOL parse_SimpleItem(XMLN * p_node, onvif_SimpleItem * p_res); +BOOL parse_ElementItem(XMLN * p_node, onvif_ElementItem * p_res); +BOOL parse_ItemList(XMLN * p_node, onvif_ItemList * p_res); +BOOL parse_Config(XMLN * p_node, onvif_Config * p_res); +BOOL parse_VideoEncoderConfiguration(XMLN * p_node, onvif_VideoEncoderConfiguration * p_res); +BOOL parse_AudioEncoderConfiguration(XMLN * p_node, onvif_AudioEncoderConfiguration * p_res); +BOOL parse_PTZConfiguration(XMLN * p_node, onvif_PTZConfiguration * p_res); +BOOL parse_AnalyticsEngineConfiguration(XMLN * p_node, onvif_AnalyticsEngineConfiguration * p_res); +BOOL parse_RuleEngineConfiguration(XMLN * p_node, onvif_RuleEngineConfiguration * p_res); +BOOL parse_VideoAnalyticsConfiguration(XMLN * p_node, onvif_VideoAnalyticsConfiguration * p_res); +BOOL parse_Profile(XMLN * p_node, ONVIF_PROFILE * p_profile); +BOOL parse_Dot11Configuration(XMLN * p_node, onvif_Dot11Configuration * p_res); +BOOL parse_NetworkInterface(XMLN * p_node, onvif_NetworkInterface * p_res); +BOOL parse_User(XMLN * p_node, onvif_User * p_res); +BOOL parse_Datetime(XMLN * p_node, onvif_DateTime * p_datetime); +BOOL parse_Dot11AvailableNetworks(XMLN * p_node, onvif_Dot11AvailableNetworks * p_res); +BOOL parse_LocationEntity(XMLN * p_node, onvif_LocationEntity * p_res); +BOOL parse_PrefixedIPAddress(XMLN * p_node, onvif_PrefixedIPAddress * p_res); +BOOL parse_IPAddressFilter(XMLN * p_node, onvif_IPAddressFilter * p_res); +BOOL parse_UserCredential(XMLN * p_node, onvif_UserCredential * p_res); +BOOL parse_StorageConfigurationData(XMLN * p_node, onvif_StorageConfigurationData * p_res); +BOOL parse_StorageConfiguration(XMLN * p_node, onvif_StorageConfiguration * p_res); +BOOL parse_RelayOutputSettings(XMLN * p_node, onvif_RelayOutputSettings * p_res); + +BOOL parse_tds_GetCapabilities(XMLN * p_node, tds_GetCapabilities_RES * p_res); +BOOL parse_tds_GetServices(XMLN * p_node, tds_GetServices_RES * p_res); +BOOL parse_tds_GetServiceCapabilities(XMLN * p_node, tds_GetServiceCapabilities_RES * p_res); +BOOL parse_tds_GetDeviceInformation(XMLN * p_node, tds_GetDeviceInformation_RES * p_res); +BOOL parse_tds_GetUsers(XMLN * p_node, tds_GetUsers_RES * p_res); +BOOL parse_tds_GetRemoteUser(XMLN * p_node, tds_GetRemoteUser_RES * p_res); +BOOL parse_tds_GetNetworkInterfaces(XMLN * p_node, tds_GetNetworkInterfaces_RES * p_res); +BOOL parse_tds_SetNetworkInterfaces(XMLN * p_node, tds_SetNetworkInterfaces_RES * p_res); +BOOL parse_tds_GetNTP(XMLN * p_node, tds_GetNTP_RES * p_res); +BOOL parse_tds_GetHostname(XMLN * p_node, tds_GetHostname_RES * p_res); +BOOL parse_tds_SetHostnameFromDHCP(XMLN * p_node, tds_SetHostnameFromDHCP_RES * p_res); +BOOL parse_tds_GetDNS(XMLN * p_node, tds_GetDNS_RES * p_res); +BOOL parse_tds_GetDynamicDNS(XMLN * p_node, tds_GetDynamicDNS_RES * p_res); +BOOL parse_tds_GetNetworkProtocols(XMLN * p_node, tds_GetNetworkProtocols_RES * p_res); +BOOL parse_tds_GetDiscoveryMode(XMLN * p_node, tds_GetDiscoveryMode_RES * p_res); +BOOL parse_tds_GetNetworkDefaultGateway(XMLN * p_node, tds_GetNetworkDefaultGateway_RES * p_res); +BOOL parse_tds_GetZeroConfiguration(XMLN * p_node, tds_GetZeroConfiguration_RES * p_res); +BOOL parse_tds_GetEndpointReference(XMLN * p_node, tds_GetEndpointReference_RES * p_res); +BOOL parse_tds_SendAuxiliaryCommand(XMLN * p_node, tds_SendAuxiliaryCommand_RES * p_res); +BOOL parse_tds_GetRelayOutputs(XMLN * p_node, tds_GetRelayOutputs_RES * p_res); +BOOL parse_tds_GetSystemDateAndTime(XMLN * p_node, tds_GetSystemDateAndTime_RES * p_res); +BOOL parse_tds_GetSystemLog(XMLN * p_node, tds_GetSystemLog_RES * p_res); +BOOL parse_tds_GetScopes(XMLN * p_node, tds_GetScopes_RES * p_res); +BOOL parse_tds_StartFirmwareUpgrade(XMLN * p_node, tds_StartFirmwareUpgrade_RES * p_res); +BOOL parse_tds_GetSystemUris(XMLN * p_node, tds_GetSystemUris_RES * p_res); +BOOL parse_tds_StartSystemRestore(XMLN * p_node, tds_StartSystemRestore_RES * p_res); +BOOL parse_tds_GetWsdlUrl(XMLN * p_node, tds_GetWsdlUrl_RES * p_res); +BOOL parse_tds_GetDot11Capabilities(XMLN * p_node, tds_GetDot11Capabilities_RES * p_res); +BOOL parse_tds_GetDot11Status(XMLN * p_node, tds_GetDot11Status_RES * p_res); +BOOL parse_tds_ScanAvailableDot11Networks(XMLN * p_node, tds_ScanAvailableDot11Networks_RES * p_res); +BOOL parse_tds_GetGeoLocation(XMLN * p_node, tds_GetGeoLocation_RES * p_res); +BOOL parse_tds_GetIPAddressFilter(XMLN * p_node, tds_GetIPAddressFilter_RES * p_res); +BOOL parse_tds_GetAccessPolicy(XMLN * p_node, tds_GetAccessPolicy_RES * p_res); +BOOL parse_tds_GetStorageConfigurations(XMLN * p_node, tds_GetStorageConfigurations_RES * p_res); +BOOL parse_tds_CreateStorageConfiguration(XMLN * p_node, tds_CreateStorageConfiguration_RES * p_res); +BOOL parse_tds_GetStorageConfiguration(XMLN * p_node, tds_GetStorageConfiguration_RES * p_res); + +BOOL parse_JPEGOptions(XMLN * p_node, onvif_JpegOptions * p_res); +BOOL parse_MPEG4Options(XMLN * p_node, onvif_Mpeg4Options * p_res); +BOOL parse_H264Options(XMLN * p_node, onvif_H264Options * p_res); +BOOL parse_AudioOutputConfiguration(XMLN * p_node, onvif_AudioOutputConfiguration * p_res); +BOOL parse_AudioDecoderConfiguration(XMLN * p_node, onvif_AudioDecoderConfiguration * p_res); +BOOL parse_VideoSourceMode(XMLN * p_node, onvif_VideoSourceMode * p_res); +BOOL parse_Color(XMLN * p_node, onvif_Color * p_res); +BOOL parse_ColorOptions(XMLN * p_node, onvif_ColorOptions * p_res); +BOOL parse_OSDColorOptions(XMLN * p_node, onvif_OSDColorOptions * p_res); +BOOL parse_OSDOptions(XMLN * p_node, onvif_OSDConfigurationOptions * p_res); +BOOL parse_OSDColor(XMLN * p_node, onvif_OSDColor * p_res); +BOOL parse_OSDConfiguration(XMLN * p_node, onvif_OSDConfiguration * p_res); + +BOOL parse_trt_GetServiceCapabilities(XMLN * p_node, trt_GetServiceCapabilities_RES * p_res); +BOOL parse_trt_GetVideoSources(XMLN * p_node, trt_GetVideoSources_RES * p_res); +BOOL parse_trt_GetAudioSources(XMLN * p_node, trt_GetAudioSources_RES * p_res); +BOOL parse_trt_CreateProfile(XMLN * p_node, trt_CreateProfile_RES * p_res); +BOOL parse_trt_GetProfile(XMLN * p_node, trt_GetProfile_RES * p_res); +BOOL parse_trt_GetProfiles(XMLN * p_node, trt_GetProfiles_RES * p_res); +BOOL parse_trt_GetVideoSourceModes(XMLN * p_node, trt_GetVideoSourceModes_RES * p_res); +BOOL parse_trt_SetVideoSourceMode(XMLN * p_node, trt_SetVideoSourceMode_RES * p_res); +BOOL parse_trt_GetVideoSourceConfigurations(XMLN * p_node, trt_GetVideoSourceConfigurations_RES * p_res); +BOOL parse_trt_GetVideoEncoderConfigurations(XMLN * p_node, trt_GetVideoEncoderConfigurations_RES * p_res); +BOOL parse_trt_GetAudioSourceConfigurations(XMLN * p_node, trt_GetAudioSourceConfigurations_RES * p_res); +BOOL parse_trt_GetAudioEncoderConfigurations(XMLN * p_node, trt_GetAudioEncoderConfigurations_RES * p_res); +BOOL parse_trt_GetVideoSourceConfiguration(XMLN * p_node, trt_GetVideoSourceConfiguration_RES * p_res); +BOOL parse_trt_GetVideoEncoderConfiguration(XMLN * p_node, trt_GetVideoEncoderConfiguration_RES * p_res); +BOOL parse_trt_GetAudioSourceConfiguration(XMLN * p_node, trt_GetAudioSourceConfiguration_RES * p_res); +BOOL parse_trt_GetAudioEncoderConfiguration(XMLN * p_node, trt_GetAudioEncoderConfiguration_RES * p_res); +BOOL parse_trt_GetVideoSourceConfigurationOptions(XMLN * p_node, trt_GetVideoSourceConfigurationOptions_RES * p_res); +BOOL parse_trt_GetVideoEncoderConfigurationOptions(XMLN * p_node, trt_GetVideoEncoderConfigurationOptions_RES * p_res); +BOOL parse_trt_GetAudioEncoderConfigurationOptions(XMLN * p_node, trt_GetAudioEncoderConfigurationOptions_RES * p_res); +BOOL parse_trt_GetStreamUri(XMLN * p_node, trt_GetStreamUri_RES * p_res); +BOOL parse_trt_GetSnapshotUri(XMLN * p_node, trt_GetSnapshotUri_RES * p_res); +BOOL parse_trt_GetGuaranteedNumberOfVideoEncoderInstances(XMLN * p_node, trt_GetGuaranteedNumberOfVideoEncoderInstances_RES * p_res); +BOOL parse_trt_GetAudioOutputs(XMLN * p_node, trt_GetAudioOutputs_RES * p_res); +BOOL parse_trt_GetAudioOutputConfigurations(XMLN * p_node, trt_GetAudioOutputConfigurations_RES * p_res); +BOOL parse_trt_GetAudioOutputConfiguration(XMLN * p_node, trt_GetAudioOutputConfiguration_RES * p_res); +BOOL parse_trt_GetAudioOutputConfigurationOptions(XMLN * p_node, trt_GetAudioOutputConfigurationOptions_RES * p_res); +BOOL parse_trt_GetAudioDecoderConfigurations(XMLN * p_node, trt_GetAudioDecoderConfigurations_RES * p_res); +BOOL parse_trt_GetAudioDecoderConfiguration(XMLN * p_node, trt_GetAudioDecoderConfiguration_RES * p_res); +BOOL parse_trt_GetAudioDecoderConfigurationOptions(XMLN * p_node, trt_GetAudioDecoderConfigurationOptions_RES * p_res); +BOOL parse_trt_GetOSDs(XMLN * p_node, trt_GetOSDs_RES * p_res); +BOOL parse_trt_GetOSD(XMLN * p_node, trt_GetOSD_RES * p_res); +BOOL parse_trt_GetOSDOptions(XMLN * p_node, trt_GetOSDOptions_RES * p_res); +BOOL parse_trt_CreateOSD(XMLN * p_node, trt_CreateOSD_RES * p_res); +BOOL parse_trt_GetVideoAnalyticsConfigurations(XMLN * p_node, trt_GetVideoAnalyticsConfigurations_RES * p_res); +BOOL parse_trt_GetVideoAnalyticsConfiguration(XMLN * p_node, trt_GetVideoAnalyticsConfiguration_RES * p_res); +BOOL parse_trt_GetMetadataConfigurations(XMLN * p_node, trt_GetMetadataConfigurations_RES * p_res); +BOOL parse_trt_GetMetadataConfiguration(XMLN * p_node, trt_GetMetadataConfiguration_RES * p_res); +BOOL parse_trt_GetMetadataConfigurationOptions(XMLN * p_node, trt_GetMetadataConfigurationOptions_RES * p_res); +BOOL parse_trt_GetCompatibleVideoEncoderConfigurations(XMLN * p_node, trt_GetCompatibleVideoEncoderConfigurations_RES * p_res); +BOOL parse_trt_GetCompatibleAudioEncoderConfigurations(XMLN * p_node, trt_GetCompatibleAudioEncoderConfigurations_RES * p_res); +BOOL parse_trt_GetCompatibleVideoAnalyticsConfigurations(XMLN * p_node, trt_GetCompatibleVideoAnalyticsConfigurations_RES * p_res); +BOOL parse_trt_GetCompatibleMetadataConfigurations(XMLN * p_node, trt_GetCompatibleMetadataConfigurations_RES * p_res); + +BOOL parse_Space2DDescription(XMLN * p_node, onvif_Space2DDescription * p_res); +BOOL parse_Space1DDescription(XMLN * p_node, onvif_Space1DDescription * p_res); +BOOL parse_PTZNode(XMLN * p_node, onvif_PTZNode * p_res); +BOOL parse_Preset(XMLN * p_node, onvif_PTZPreset * p_res); +BOOL parse_PTZPresetTourSpot(XMLN * p_node, onvif_PTZPresetTourSpot * p_res); +BOOL parse_PTZPresetTourStatus(XMLN * p_node, onvif_PTZPresetTourStatus * p_res); +BOOL parse_PTZPresetTourStartingCondition(XMLN * p_node, onvif_PTZPresetTourStartingCondition * p_res); +BOOL parse_PresetTour(XMLN * p_node, onvif_PresetTour * p_res); +BOOL parse_DurationRange(XMLN * p_node, onvif_DurationRange * p_res); + +BOOL parse_ptz_GetServiceCapabilities(XMLN * p_node, ptz_GetServiceCapabilities_RES * p_res); +BOOL parse_ptz_GetNodes(XMLN * p_node, ptz_GetNodes_RES * p_res); +BOOL parse_ptz_GetNode(XMLN * p_node, ptz_GetNode_RES * p_res); +BOOL parse_ptz_GetPresets(XMLN * p_node, ptz_GetPresets_RES * p_res); +BOOL parse_ptz_SetPreset(XMLN * p_node, ptz_SetPreset_RES * p_res); +BOOL parse_ptz_GetStatus(XMLN * p_node, ptz_GetStatus_RES * p_res); +BOOL parse_ptz_GetConfigurations(XMLN * p_node, ptz_GetConfigurations_RES * p_res); +BOOL parse_ptz_GetConfiguration(XMLN * p_node, ptz_GetConfiguration_RES * p_res); +BOOL parse_ptz_GetConfigurationOptions(XMLN * p_node, ptz_GetConfigurationOptions_RES * p_res); +BOOL parse_ptz_GetPresetTours(XMLN * p_node, ptz_GetPresetTours_RES * p_res); +BOOL parse_ptz_GetPresetTour(XMLN * p_node, ptz_GetPresetTour_RES * p_res); +BOOL parse_ptz_GetPresetTourOptions(XMLN * p_node, ptz_GetPresetTourOptions_RES * p_res); +BOOL parse_ptz_CreatePresetTour(XMLN * p_node, ptz_CreatePresetTour_RES * p_res); +BOOL parse_ptz_SendAuxiliaryCommand(XMLN * p_node, ptz_SendAuxiliaryCommand_RES * p_res); + +BOOL parse_NotificationMessage(XMLN * p_node, onvif_NotificationMessage * p_res); +BOOL parse_NotifyMessage(XMLN * p_node, NotificationMessageList ** p_res); +BOOL parse_tev_GetServiceCapabilities(XMLN * p_node, tev_GetServiceCapabilities_RES * p_res); +BOOL parse_tev_GetEventProperties(XMLN * p_node, tev_GetEventProperties_RES * p_res); +BOOL parse_tev_Subscribe(XMLN * p_node, tev_Subscribe_RES * p_res); +BOOL parse_tev_CreatePullPointSubscription(XMLN * p_node, tev_CreatePullPointSubscription_RES * p_res); +BOOL parse_tev_PullMessages(XMLN * p_node, tev_PullMessages_RES * p_res); +BOOL parse_tev_GetMessages(XMLN * p_node, tev_GetMessages_RES * p_res); + +BOOL parse_ImagingPreset(XMLN * p_node, onvif_ImagingPreset * p_res); +BOOL parse_img_GetServiceCapabilities(XMLN * p_node, img_GetServiceCapabilities_RES * p_res); +BOOL parse_img_GetImagingSettings(XMLN * p_node, img_GetImagingSettings_RES * p_res); +BOOL parse_img_GetOptions(XMLN * p_node, img_GetOptions_RES * p_res); +BOOL parse_img_GetStatus(XMLN * p_node, img_GetStatus_RES * p_res); +BOOL parse_img_GetMoveOptions(XMLN * p_node, img_GetMoveOptions_RES * p_res); +BOOL parse_img_GetPresets(XMLN * p_node, img_GetPresets_RES * p_res); +BOOL parse_img_GetCurrentPreset(XMLN * p_node, img_GetCurrentPreset_RES * p_res); + +int parse_SimpleItemDescriptions(XMLN * p_node, const char * name, SimpleItemDescriptionList * p_res); +BOOL parse_ItemListDescription(XMLN * p_node, onvif_ItemListDescription * p_res); +BOOL parse_ConfigDescription_Messages(XMLN * p_node, onvif_ConfigDescription_Messages * p_res); +BOOL parse_RuleDescription(XMLN * p_node, onvif_ConfigDescription * p_res); +BOOL parse_ConfigDescription(XMLN * p_node, onvif_ConfigDescription * p_res); +BOOL parse_ConfigOptions(XMLN * p_node, onvif_ConfigOptions * p_res); +BOOL parse_AnalyticsModuleConfigOptions(XMLN * p_node, onvif_AnalyticsModuleConfigOptions * p_res); +BOOL parse_tan_GetServiceCapabilities(XMLN * p_node, tan_GetServiceCapabilities_RES * p_res); +BOOL parse_tan_GetSupportedRules(XMLN * p_node, tan_GetSupportedRules_RES * p_res); +BOOL parse_tan_GetRules(XMLN * p_node, tan_GetRules_RES * p_res); +BOOL parse_tan_GetAnalyticsModules(XMLN * p_node, tan_GetAnalyticsModules_RES * p_res); +BOOL parse_tan_GetSupportedAnalyticsModules(XMLN * p_node, tan_GetSupportedAnalyticsModules_RES * p_res); +BOOL parse_tan_GetRuleOptions(XMLN * p_node, tan_GetRuleOptions_RES * p_res); +BOOL parse_tan_GetAnalyticsModuleOptions(XMLN * p_node, tan_GetAnalyticsModuleOptions_RES * p_res); +BOOL parse_tan_GetSupportedMetadata(XMLN * p_node, tan_GetSupportedMetadata_RES * p_res); + +BOOL parse_VideoEncoder2Configuration(XMLN * p_node, onvif_VideoEncoder2Configuration * p_res); +BOOL parse_VideoEncoder2ConfigurationOptions(XMLN * p_node, onvif_VideoEncoder2ConfigurationOptions * p_res); +BOOL parse_MetadataConfiguration(XMLN * p_node, onvif_MetadataConfiguration * p_res); +BOOL parse_AudioEncoder2Configuration(XMLN * p_node, onvif_AudioEncoder2Configuration * p_res); +BOOL parse_AudioEncoder2ConfigurationOptions(XMLN * p_node, onvif_AudioEncoder2ConfigurationOptions * p_res); +BOOL parse_MediaProfile(XMLN * p_node, onvif_MediaProfile * p_res); +BOOL parse_Polygon(XMLN * p_node, onvif_Polygon * p_res); +BOOL parse_Mask(XMLN * p_node, onvif_Mask * p_res); +BOOL parse_MaskOptions(XMLN * p_node, onvif_MaskOptions * p_res); + +BOOL parse_tr2_GetServiceCapabilities(XMLN * p_node, tr2_GetServiceCapabilities_RES * p_res); +BOOL parse_tr2_GetVideoEncoderConfigurations(XMLN * p_node, tr2_GetVideoEncoderConfigurations_RES * p_res); +BOOL parse_tr2_GetVideoEncoderConfigurationOptions(XMLN * p_node, tr2_GetVideoEncoderConfigurationOptions_RES * p_res); +BOOL parse_tr2_GetProfiles(XMLN * p_node, tr2_GetProfiles_RES * p_res); +BOOL parse_tr2_CreateProfile(XMLN * p_node, tr2_CreateProfile_RES * p_res); +BOOL parse_tr2_GetStreamUri(XMLN * p_node, tr2_GetStreamUri_RES * p_res); +BOOL parse_tr2_GetVideoSourceConfigurations(XMLN * p_node, tr2_GetVideoSourceConfigurations_RES * p_res); +BOOL parse_tr2_GetMetadataConfigurations(XMLN * p_node, tr2_GetMetadataConfigurations_RES * p_res); +BOOL parse_tr2_GetMetadataConfigurationOptions(XMLN * p_node, tr2_GetMetadataConfigurationOptions_RES * p_res); +BOOL parse_tr2_GetAudioEncoderConfigurations(XMLN * p_node, tr2_GetAudioEncoderConfigurations_RES * p_res); +BOOL parse_tr2_GetAudioSourceConfigurations(XMLN * p_node, tr2_GetAudioSourceConfigurations_RES * p_res); +BOOL parse_tr2_GetAudioEncoderConfigurationOptions(XMLN * p_node, tr2_GetAudioEncoderConfigurationOptions_RES * p_res); +BOOL parse_tr2_GetVideoEncoderInstances(XMLN * p_node, tr2_GetVideoEncoderInstances_RES * p_res); +BOOL parse_tr2_GetAudioOutputConfigurations(XMLN * p_node, tr2_GetAudioOutputConfigurations_RES * p_res); +BOOL parse_tr2_GetAudioOutputConfigurationOptions(XMLN * p_node, tr2_GetAudioOutputConfigurationOptions_RES * p_res); +BOOL parse_tr2_GetAudioDecoderConfigurations(XMLN * p_node, tr2_GetAudioDecoderConfigurations_RES * p_res); +BOOL parse_tr2_GetAudioDecoderConfigurationOptions(XMLN * p_node, tr2_GetAudioDecoderConfigurationOptions_RES * p_res); +BOOL parse_tr2_GetSnapshotUri(XMLN * p_node, tr2_GetSnapshotUri_RES * p_res); +BOOL parse_tr2_GetVideoSourceModes(XMLN * p_node, tr2_GetVideoSourceModes_RES * p_res); +BOOL parse_tr2_SetVideoSourceMode(XMLN * p_node, tr2_SetVideoSourceMode_RES * p_res); +BOOL parse_tr2_CreateOSD(XMLN * p_node, tr2_CreateOSD_RES * p_res); +BOOL parse_tr2_GetOSDs(XMLN * p_node, tr2_GetOSDs_RES * p_res); +BOOL parse_tr2_GetOSDOptions(XMLN * p_node, tr2_GetOSDOptions_RES * p_res); +BOOL parse_tr2_GetAnalyticsConfigurations(XMLN * p_node, tr2_GetAnalyticsConfigurations_RES * p_res); +BOOL parse_tr2_GetMasks(XMLN * p_node, tr2_GetMasks_RES * p_res); +BOOL parse_tr2_CreateMask(XMLN * p_node, tr2_CreateMask_RES * p_res); +BOOL parse_tr2_GetMaskOptions(XMLN * p_node, tr2_GetMaskOptions_RES * p_res); + +BOOL parse_DeviceIOServiceCapabilities(XMLN * p_node, onvif_DeviceIOCapabilities * p_res); +BOOL parse_DeviceIOService(XMLN * p_node, onvif_DeviceIOCapabilities * p_res); +BOOL parse_RelayOutput(XMLN * p_node, onvif_RelayOutput * p_res); +BOOL parse_RelayOutputOptions(XMLN * p_node, onvif_RelayOutputOptions * p_res); +BOOL parse_DigitalInput(XMLN * p_node, onvif_DigitalInput * p_res); +BOOL parse_tmd_GetServiceCapabilities(XMLN * p_node, tmd_GetServiceCapabilities_RES * p_res); +BOOL parse_tmd_GetRelayOutputs(XMLN * p_node, tmd_GetRelayOutputs_RES * p_res); +BOOL parse_tmd_GetRelayOutputOptions(XMLN * p_node, tmd_GetRelayOutputOptions_RES * p_res); +BOOL parse_tmd_GetDigitalInputs(XMLN * p_node, tmd_GetDigitalInputs_RES * p_res); +BOOL parse_tmd_GetDigitalInputConfigurationOptions(XMLN * p_node, tmd_GetDigitalInputConfigurationOptions_RES * p_res); + +BOOL parse_RecordingServiceCapabilities(XMLN * p_node, onvif_RecordingCapabilities * p_res); +BOOL parse_RecordingService(XMLN * p_node, onvif_RecordingCapabilities * p_res); +BOOL parse_SearchServiceCapabilities(XMLN * p_node, onvif_SearchCapabilities * p_res); +BOOL parse_SearchService(XMLN * p_node, onvif_SearchCapabilities * p_res); +BOOL parse_ReplayServiceCapabilities(XMLN * p_node, onvif_ReplayCapabilities * p_res); +BOOL parse_ReplayService(XMLN * p_node, onvif_ReplayCapabilities * p_res); +BOOL parse_trc_GetServiceCapabilities(XMLN * p_node, trc_GetServiceCapabilities_RES * p_res); +BOOL parse_trc_CreateRecording(XMLN * p_node, trc_CreateRecording_RES * p_res); +BOOL parse_trc_GetRecordings(XMLN * p_node, trc_GetRecordings_RES * p_res); +BOOL parse_trc_GetRecordingConfiguration(XMLN * p_node, trc_GetRecordingConfiguration_RES * p_res); +BOOL parse_trc_GetRecordingOptions(XMLN * p_node, trc_GetRecordingOptions_RES * p_res); +BOOL parse_trc_CreateTrack(XMLN * p_node, trc_CreateTrack_RES * p_res); +BOOL parse_trc_GetTrackConfiguration(XMLN * p_node, trc_GetTrackConfiguration_RES * p_res); +BOOL parse_trc_CreateRecordingJob(XMLN * p_node, trc_CreateRecordingJob_RES * p_res); +BOOL parse_trc_GetRecordingJobs(XMLN * p_node, trc_GetRecordingJobs_RES * p_res); +BOOL parse_trc_SetRecordingJobConfiguration(XMLN * p_node, trc_SetRecordingJobConfiguration_RES * p_res); +BOOL parse_trc_GetRecordingJobConfiguration(XMLN * p_node, trc_GetRecordingJobConfiguration_RES * p_res); +BOOL parse_trc_GetRecordingJobState(XMLN * p_node, trc_GetRecordingJobState_RES * p_res); +BOOL parse_trc_ExportRecordedData(XMLN * p_node, trc_ExportRecordedData_RES * p_res); +BOOL parse_trc_StopExportRecordedData(XMLN * p_node, trc_StopExportRecordedData_RES * p_res); +BOOL parse_trc_GetExportRecordedDataState(XMLN * p_node, trc_GetExportRecordedDataState_RES * p_res); +BOOL parse_trp_GetServiceCapabilities(XMLN * p_node, trp_GetServiceCapabilities_RES * p_res); +BOOL parse_trp_GetReplayUri(XMLN * p_node, trp_GetReplayUri_RES * p_res); +BOOL parse_trp_GetReplayConfiguration(XMLN * p_node, trp_GetReplayConfiguration_RES * p_res); +BOOL parse_tse_GetServiceCapabilities(XMLN * p_node, tse_GetServiceCapabilities_RES * p_res); +BOOL parse_tse_GetRecordingSummary(XMLN * p_node, tse_GetRecordingSummary_RES * p_res); +BOOL parse_tse_GetRecordingInformation(XMLN * p_node, tse_GetRecordingInformation_RES * p_res); +BOOL parse_tse_GetMediaAttributes(XMLN * p_node, tse_GetMediaAttributes_RES * p_res); +BOOL parse_tse_FindRecordings(XMLN * p_node, tse_FindRecordings_RES * p_res); +BOOL parse_tse_GetRecordingSearchResults(XMLN * p_node, tse_GetRecordingSearchResults_RES * p_res); +BOOL parse_tse_FindEvents(XMLN * p_node, tse_FindEvents_RES * p_res); +BOOL parse_tse_GetEventSearchResults(XMLN * p_node, tse_GetEventSearchResults_RES * p_res); +BOOL parse_tse_FindMetadata(XMLN * p_node, tse_FindMetadata_RES * p_res); +BOOL parse_tse_GetMetadataSearchResults(XMLN * p_node, tse_GetMetadataSearchResults_RES * p_res); +BOOL parse_tse_FindPTZPosition(XMLN * p_node, tse_FindPTZPosition_RES * p_res); +BOOL parse_tse_GetPTZPositionSearchResults(XMLN * p_node, tse_GetPTZPositionSearchResults_RES * p_res); +BOOL parse_tse_GetSearchState(XMLN * p_node, tse_GetSearchState_RES * p_res); +BOOL parse_tse_EndSearch(XMLN * p_node, tse_EndSearch_RES * p_res); + +BOOL parse_AccessControlServiceCapabilities(XMLN * p_node, onvif_AccessControlCapabilities * p_res); +BOOL parse_AccessControlService(XMLN * p_node, onvif_AccessControlCapabilities * p_res); +BOOL parse_DoorControlServiceCapabilities(XMLN * p_node, onvif_DoorControlCapabilities * p_res); +BOOL parse_DoorControlService(XMLN * p_node, onvif_DoorControlCapabilities * p_res); +BOOL parse_tac_GetServiceCapabilities(XMLN * p_node, tac_GetServiceCapabilities_RES * p_res); +BOOL parse_tac_GetAccessPointInfoList(XMLN * p_node, tac_GetAccessPointInfoList_RES * p_res); +BOOL parse_tac_GetAccessPointInfo(XMLN * p_node, tac_GetAccessPointInfo_RES * p_res); +BOOL parse_tac_GetAccessPointList(XMLN * p_node, tac_GetAccessPointList_RES * p_res); +BOOL parse_tac_GetAccessPoints(XMLN * p_node, tac_GetAccessPoints_RES * p_res); +BOOL parse_tac_CreateAccessPoint(XMLN * p_node, tac_CreateAccessPoint_RES * p_res); +BOOL parse_tac_GetAreaInfoList(XMLN * p_node, tac_GetAreaInfoList_RES * p_res); +BOOL parse_tac_GetAreaInfo(XMLN * p_node, tac_GetAreaInfo_RES * p_res); +BOOL parse_tac_GetAreaList(XMLN * p_node, tac_GetAreaList_RES * p_res); +BOOL parse_tac_GetAreas(XMLN * p_node, tac_GetAreas_RES * p_res); +BOOL parse_tac_CreateArea(XMLN * p_node, tac_CreateArea_RES * p_res); +BOOL parse_tac_GetAccessPointState(XMLN * p_node, tac_GetAccessPointState_RES * p_res); +BOOL parse_tdc_GetServiceCapabilities(XMLN * p_node, tdc_GetServiceCapabilities_RES * p_res); +BOOL parse_tdc_GetDoorInfoList(XMLN * p_node, tdc_GetDoorInfoList_RES * p_res); +BOOL parse_tdc_GetDoorInfo(XMLN * p_node, tdc_GetDoorInfo_RES * p_res); +BOOL parse_tdc_GetDoorState(XMLN * p_node, tdc_GetDoorState_RES * p_res); +BOOL parse_tdc_GetDoors(XMLN * p_node, tdc_GetDoors_RES * p_res); +BOOL parse_tdc_GetDoorList(XMLN * p_node, tdc_GetDoorList_RES * p_res); +BOOL parse_tdc_CreateDoor(XMLN * p_node, tdc_CreateDoor_RES * p_res); + +BOOL parse_ThermalServiceCapabilities(XMLN * p_node, onvif_ThermalCapabilities * p_res); +BOOL parse_ThermalService(XMLN * p_node, onvif_ThermalCapabilities * p_res); +BOOL parse_tth_GetServiceCapabilities(XMLN * p_node, tth_GetServiceCapabilities_RES * p_res); +BOOL parse_tth_GetConfigurations(XMLN * p_node, tth_GetConfigurations_RES * p_req); +BOOL parse_tth_GetConfiguration(XMLN * p_node, tth_GetConfiguration_RES * p_req); +BOOL parse_tth_GetConfigurationOptions(XMLN * p_node, tth_GetConfigurationOptions_RES * p_req); +BOOL parse_tth_GetRadiometryConfiguration(XMLN * p_node, tth_GetRadiometryConfiguration_RES * p_req); +BOOL parse_tth_GetRadiometryConfigurationOptions(XMLN * p_node, tth_GetRadiometryConfigurationOptions_RES * p_req); + +BOOL parse_CredentialServiceCapabilities(XMLN * p_node, onvif_CredentialCapabilities * p_res); +BOOL parse_CredentialService(XMLN * p_node, onvif_CredentialCapabilities * p_res); +BOOL parse_tcr_GetServiceCapabilities(XMLN * p_node, tcr_GetServiceCapabilities_RES * p_res); +BOOL parse_tcr_GetCredentialInfo(XMLN * p_node, tcr_GetCredentialInfo_RES * p_res); +BOOL parse_tcr_GetCredentialInfoList(XMLN * p_node, tcr_GetCredentialInfoList_RES * p_res); +BOOL parse_tcr_GetCredentials(XMLN * p_node, tcr_GetCredentials_RES * p_res); +BOOL parse_tcr_GetCredentialList(XMLN * p_node, tcr_GetCredentialList_RES * p_res); +BOOL parse_tcr_CreateCredential(XMLN * p_node, tcr_CreateCredential_RES * p_res); +BOOL parse_tcr_GetCredentialState(XMLN * p_node, tcr_GetCredentialState_RES * p_res); +BOOL parse_tcr_GetSupportedFormatTypes(XMLN * p_node, tcr_GetSupportedFormatTypes_RES * p_res); +BOOL parse_tcr_GetCredentialIdentifiers(XMLN * p_node, tcr_GetCredentialIdentifiers_RES * p_res); +BOOL parse_tcr_GetCredentialAccessProfiles(XMLN * p_node, tcr_GetCredentialAccessProfiles_RES * p_res); + +BOOL parse_AccessRulesServiceCapabilities(XMLN * p_node, onvif_AccessRulesCapabilities * p_res); +BOOL parse_AccessRulesService(XMLN * p_node, onvif_AccessRulesCapabilities * p_res); +BOOL parse_tar_GetServiceCapabilities(XMLN * p_node, tar_GetServiceCapabilities_RES * p_res); +BOOL parse_tar_GetAccessProfileInfo(XMLN * p_node, tar_GetAccessProfileInfo_RES * p_res); +BOOL parse_tar_GetAccessProfileInfoList(XMLN * p_node, tar_GetAccessProfileInfoList_RES * p_res); +BOOL parse_tar_GetAccessProfiles(XMLN * p_node, tar_GetAccessProfiles_RES * p_res); +BOOL parse_tar_GetAccessProfileList(XMLN * p_node, tar_GetAccessProfileList_RES * p_res); +BOOL parse_tar_CreateAccessProfile(XMLN * p_node, tar_CreateAccessProfile_RES * p_res); + +BOOL parse_ScheduleServiceCapabilities(XMLN * p_node, onvif_ScheduleCapabilities * p_res); +BOOL parse_ScheduleService(XMLN * p_node, onvif_ScheduleCapabilities * p_res); +BOOL parse_tsc_GetServiceCapabilities(XMLN * p_node, tsc_GetServiceCapabilities_RES * p_res); +BOOL parse_tsc_GetScheduleInfo(XMLN * p_node, tsc_GetScheduleInfo_RES * p_res); +BOOL parse_tsc_GetScheduleInfoList(XMLN * p_node, tsc_GetScheduleInfoList_RES * p_res); +BOOL parse_tsc_GetSchedules(XMLN * p_node, tsc_GetSchedules_RES * p_res); +BOOL parse_tsc_GetScheduleList(XMLN * p_node, tsc_GetScheduleList_RES * p_res); +BOOL parse_tsc_CreateSchedule(XMLN * p_node, tsc_CreateSchedule_RES * p_res); +BOOL parse_tsc_GetSpecialDayGroupInfo(XMLN * p_node, tsc_GetSpecialDayGroupInfo_RES * p_res); +BOOL parse_tsc_GetSpecialDayGroupInfoList(XMLN * p_node, tsc_GetSpecialDayGroupInfoList_RES * p_res); +BOOL parse_tsc_GetSpecialDayGroups(XMLN * p_node, tsc_GetSpecialDayGroups_RES * p_res); +BOOL parse_tsc_GetSpecialDayGroupList(XMLN * p_node, tsc_GetSpecialDayGroupList_RES * p_res); +BOOL parse_tsc_CreateSpecialDayGroup(XMLN * p_node, tsc_CreateSpecialDayGroup_RES * p_res); +BOOL parse_tsc_GetScheduleState(XMLN * p_node, tsc_GetScheduleState_RES * p_res); + +BOOL parse_ReceiverServiceCapabilities(XMLN * p_node, onvif_ReceiverCapabilities * p_res); +BOOL parse_ReceiverService(XMLN * p_node, onvif_ReceiverCapabilities * p_res); +BOOL parse_trv_GetServiceCapabilities(XMLN * p_node, trv_GetServiceCapabilities_RES * p_res); +BOOL parse_trv_GetReceivers(XMLN * p_node, trv_GetReceivers_RES * p_res); +BOOL parse_trv_GetReceiver(XMLN * p_node, trv_GetReceiver_RES * p_res); +BOOL parse_trv_CreateReceiver(XMLN * p_node, trv_CreateReceiver_RES * p_res); +BOOL parse_trv_GetReceiverState(XMLN * p_node, trv_GetReceiverState_RES * p_res); + +BOOL parse_ProvisioningServiceCapabilities(XMLN * p_node, onvif_ProvisioningCapabilities * p_res); +BOOL parse_ProvisioningService(XMLN * p_node, onvif_ProvisioningCapabilities * p_res); +BOOL parse_tpv_GetServiceCapabilities(XMLN * p_node, tpv_GetServiceCapabilities_RES * p_res); +BOOL parse_tpv_GetUsage(XMLN * p_node, tpv_GetUsage_RES * p_res); + + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/MediaClient/MediaClient/openssl-android-build.txt b/MediaClient/MediaClient/openssl-android-build.txt new file mode 100644 index 0000000..8bea180 --- /dev/null +++ b/MediaClient/MediaClient/openssl-android-build.txt @@ -0,0 +1,7 @@ +export ANDROID_NDK_HOME=/home/android/android-ndk-r20 // modify the android NDK PATH to your +export PATH=/home/android/android-ndk-r20/toolchains/llvm/prebuilt/linux-x86_64/bin:/home/android/android-ndk-r20/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin:$PATH + +./Configure shared android-arm -D__ANDROID_API__=22 + +make clean +make diff --git a/MediaClient/MediaClient/openssl-ios-build.sh b/MediaClient/MediaClient/openssl-ios-build.sh new file mode 100644 index 0000000..809f71b --- /dev/null +++ b/MediaClient/MediaClient/openssl-ios-build.sh @@ -0,0 +1,103 @@ +#!/bin/bash + +set -u + +OPENSSL_COMPRESSED_FN="openssl-1.1.1g.tar.gz" +OPENSSL_SRC_DIR=openssl-1.1.1g +OPENSSL_BUILD_DIR=${PWD}/${OPENSSL_SRC_DIR}-build +OPENSSL_BUILD_LOG_DIR=${OPENSSL_BUILD_DIR}/log +OPENSSL_BUILD_UNIVERSAL_DIR=${OPENSSL_BUILD_DIR}/universal +OPENSSL_UNIVERSAL_LIB_DIR=${OPENSSL_BUILD_UNIVERSAL_DIR}/lib + +rm -rf ${OPENSSL_SRC_DIR} +rm -rf ${OPENSSL_BUILD_DIR} + +tar xfz ${OPENSSL_COMPRESSED_FN} || exit 1 + +if [ ! -d "${OPENSSL_BUILD_UNIVERSAL_DIR}" ]; then +mkdir -p "${OPENSSL_BUILD_UNIVERSAL_DIR}" +fi + +if [ ! -d "${OPENSSL_BUILD_LOG_DIR}" ]; then +mkdir "${OPENSSL_BUILD_LOG_DIR}" +fi + +if [ ! -d "${OPENSSL_UNIVERSAL_LIB_DIR}" ]; then +mkdir "${OPENSSL_UNIVERSAL_LIB_DIR}" +fi + +pushd . + +cd ${OPENSSL_SRC_DIR} + +CLANG=$(xcrun --find clang) + +IPHONE_OS_SDK_PATH=$(xcrun -sdk iphoneos --show-sdk-path) +IPHONE_OS_CROSS_TOP=${IPHONE_OS_SDK_PATH//\/SDKs*/} +IPHONE_OS_CROSS_SDK=${IPHONE_OS_SDK_PATH##*/} + +IPHONE_SIMULATOR_SDK_PATH=$(xcrun -sdk iphonesimulator --show-sdk-path) +IPHONE_SIMULATOR_CROSS_TOP=${IPHONE_SIMULATOR_SDK_PATH//\/SDKs*/} +IPHONE_SIMULATOR_CROSS_SDK=${IPHONE_SIMULATOR_SDK_PATH##*/} + +ARCH_LIST=("armv7" "armv7s" "arm64" "i386" "x86_64") + +ARCH_COUNT=${#ARCH_LIST[@]} + +CROSS_TOP_LIST=(${IPHONE_OS_CROSS_TOP} ${IPHONE_OS_CROSS_TOP} ${IPHONE_OS_CROSS_TOP} ${IPHONE_SIMULATOR_CROSS_TOP} ${IPHONE_SIMULATOR_CROSS_TOP}) + +CROSS_SDK_LIST=(${IPHONE_OS_CROSS_SDK} ${IPHONE_OS_CROSS_SDK} ${IPHONE_OS_CROSS_SDK} ${IPHONE_SIMULATOR_CROSS_SDK} ${IPHONE_SIMULATOR_CROSS_SDK}) + +config_make() +{ +ARCH=$1; +export CROSS_TOP=$2 +export CROSS_SDK=$3 +#export CC="${CLANG} -arch ${ARCH} -miphoneos-version-min=6.0 -embed-bitcode" +export CC="${CLANG} -arch ${ARCH} -miphoneos-version-min=6.0" + +make clean &> ${OPENSSL_BUILD_LOG_DIR}/make_clean.log + +echo "configure for ${ARCH}..." + +if [ "x86_64" == ${ARCH} ]; then +./Configure iphoneos-cross --prefix=${OPENSSL_BUILD_DIR}/${ARCH} no-asm &> ${OPENSSL_BUILD_LOG_DIR}/${ARCH}-conf.log +else +./Configure iphoneos-cross --prefix=${OPENSSL_BUILD_DIR}/${ARCH} &> ${OPENSSL_BUILD_LOG_DIR}/${ARCH}-conf.log +fi + +echo "build for ${ARCH}..." +make &> ${OPENSSL_BUILD_LOG_DIR}/${ARCH}-make.log +make install_sw &> ${OPENSSL_BUILD_LOG_DIR}/${ARCH}-make-install.log + +unset CC +unset CROSS_SDK +unset CROSS_TOP + +echo -e "\n" +} + +for ((i=0; i < ${ARCH_COUNT}; i++)) +do +config_make ${ARCH_LIST[i]} ${CROSS_TOP_LIST[i]} ${CROSS_SDK_LIST[i]} +done + +create_lib() +{ +LIB_SRC=lib/$1 +LIB_DST=${OPENSSL_UNIVERSAL_LIB_DIR}/$1 +LIB_PATHS=( ${ARCH_LIST[@]/#/${OPENSSL_BUILD_DIR}/} ) +LIB_PATHS=( ${LIB_PATHS[@]/%//${LIB_SRC}} ) +lipo ${LIB_PATHS[@]} -create -output ${LIB_DST} +} + +create_lib "libssl.a" +create_lib "libcrypto.a" + +cp -R ${OPENSSL_BUILD_DIR}/armv7/include ${OPENSSL_BUILD_UNIVERSAL_DIR} + +popd + +rm -rf ${OPENSSL_SRC_DIR} + +echo "done." diff --git a/MediaClient/MediaClient/openssl/include/openssl/aes.h b/MediaClient/MediaClient/openssl/include/openssl/aes.h new file mode 100644 index 0000000..245c552 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/aes.h @@ -0,0 +1,92 @@ +/* + * Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_AES_H +# define HEADER_AES_H + +# include + +# include +# ifdef __cplusplus +extern "C" { +# endif + +# define AES_ENCRYPT 1 +# define AES_DECRYPT 0 + +/* + * Because array size can't be a const in C, the following two are macros. + * Both sizes are in bytes. + */ +# define AES_MAXNR 14 +# define AES_BLOCK_SIZE 16 + +/* This should be a hidden type, but EVP requires that the size be known */ +struct aes_key_st { +# ifdef AES_LONG + unsigned long rd_key[4 * (AES_MAXNR + 1)]; +# else + unsigned int rd_key[4 * (AES_MAXNR + 1)]; +# endif + int rounds; +}; +typedef struct aes_key_st AES_KEY; + +const char *AES_options(void); + +int AES_set_encrypt_key(const unsigned char *userKey, const int bits, + AES_KEY *key); +int AES_set_decrypt_key(const unsigned char *userKey, const int bits, + AES_KEY *key); + +void AES_encrypt(const unsigned char *in, unsigned char *out, + const AES_KEY *key); +void AES_decrypt(const unsigned char *in, unsigned char *out, + const AES_KEY *key); + +void AES_ecb_encrypt(const unsigned char *in, unsigned char *out, + const AES_KEY *key, const int enc); +void AES_cbc_encrypt(const unsigned char *in, unsigned char *out, + size_t length, const AES_KEY *key, + unsigned char *ivec, const int enc); +void AES_cfb128_encrypt(const unsigned char *in, unsigned char *out, + size_t length, const AES_KEY *key, + unsigned char *ivec, int *num, const int enc); +void AES_cfb1_encrypt(const unsigned char *in, unsigned char *out, + size_t length, const AES_KEY *key, + unsigned char *ivec, int *num, const int enc); +void AES_cfb8_encrypt(const unsigned char *in, unsigned char *out, + size_t length, const AES_KEY *key, + unsigned char *ivec, int *num, const int enc); +void AES_ofb128_encrypt(const unsigned char *in, unsigned char *out, + size_t length, const AES_KEY *key, + unsigned char *ivec, int *num); +/* NB: the IV is _two_ blocks long */ +void AES_ige_encrypt(const unsigned char *in, unsigned char *out, + size_t length, const AES_KEY *key, + unsigned char *ivec, const int enc); +/* NB: the IV is _four_ blocks long */ +void AES_bi_ige_encrypt(const unsigned char *in, unsigned char *out, + size_t length, const AES_KEY *key, + const AES_KEY *key2, const unsigned char *ivec, + const int enc); + +int AES_wrap_key(AES_KEY *key, const unsigned char *iv, + unsigned char *out, + const unsigned char *in, unsigned int inlen); +int AES_unwrap_key(AES_KEY *key, const unsigned char *iv, + unsigned char *out, + const unsigned char *in, unsigned int inlen); + + +# ifdef __cplusplus +} +# endif + +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/asn1.h b/MediaClient/MediaClient/openssl/include/openssl/asn1.h new file mode 100644 index 0000000..9522eec --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/asn1.h @@ -0,0 +1,886 @@ +/* + * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_ASN1_H +# define HEADER_ASN1_H + +# include +# include +# include +# include +# include +# include +# include + +# include +# if OPENSSL_API_COMPAT < 0x10100000L +# include +# endif + +# ifdef OPENSSL_BUILD_SHLIBCRYPTO +# undef OPENSSL_EXTERN +# define OPENSSL_EXTERN OPENSSL_EXPORT +# endif + +#ifdef __cplusplus +extern "C" { +#endif + +# define V_ASN1_UNIVERSAL 0x00 +# define V_ASN1_APPLICATION 0x40 +# define V_ASN1_CONTEXT_SPECIFIC 0x80 +# define V_ASN1_PRIVATE 0xc0 + +# define V_ASN1_CONSTRUCTED 0x20 +# define V_ASN1_PRIMITIVE_TAG 0x1f +# define V_ASN1_PRIMATIVE_TAG /*compat*/ V_ASN1_PRIMITIVE_TAG + +# define V_ASN1_APP_CHOOSE -2/* let the recipient choose */ +# define V_ASN1_OTHER -3/* used in ASN1_TYPE */ +# define V_ASN1_ANY -4/* used in ASN1 template code */ + +# define V_ASN1_UNDEF -1 +/* ASN.1 tag values */ +# define V_ASN1_EOC 0 +# define V_ASN1_BOOLEAN 1 /**/ +# define V_ASN1_INTEGER 2 +# define V_ASN1_BIT_STRING 3 +# define V_ASN1_OCTET_STRING 4 +# define V_ASN1_NULL 5 +# define V_ASN1_OBJECT 6 +# define V_ASN1_OBJECT_DESCRIPTOR 7 +# define V_ASN1_EXTERNAL 8 +# define V_ASN1_REAL 9 +# define V_ASN1_ENUMERATED 10 +# define V_ASN1_UTF8STRING 12 +# define V_ASN1_SEQUENCE 16 +# define V_ASN1_SET 17 +# define V_ASN1_NUMERICSTRING 18 /**/ +# define V_ASN1_PRINTABLESTRING 19 +# define V_ASN1_T61STRING 20 +# define V_ASN1_TELETEXSTRING 20/* alias */ +# define V_ASN1_VIDEOTEXSTRING 21 /**/ +# define V_ASN1_IA5STRING 22 +# define V_ASN1_UTCTIME 23 +# define V_ASN1_GENERALIZEDTIME 24 /**/ +# define V_ASN1_GRAPHICSTRING 25 /**/ +# define V_ASN1_ISO64STRING 26 /**/ +# define V_ASN1_VISIBLESTRING 26/* alias */ +# define V_ASN1_GENERALSTRING 27 /**/ +# define V_ASN1_UNIVERSALSTRING 28 /**/ +# define V_ASN1_BMPSTRING 30 + +/* + * NB the constants below are used internally by ASN1_INTEGER + * and ASN1_ENUMERATED to indicate the sign. They are *not* on + * the wire tag values. + */ + +# define V_ASN1_NEG 0x100 +# define V_ASN1_NEG_INTEGER (2 | V_ASN1_NEG) +# define V_ASN1_NEG_ENUMERATED (10 | V_ASN1_NEG) + +/* For use with d2i_ASN1_type_bytes() */ +# define B_ASN1_NUMERICSTRING 0x0001 +# define B_ASN1_PRINTABLESTRING 0x0002 +# define B_ASN1_T61STRING 0x0004 +# define B_ASN1_TELETEXSTRING 0x0004 +# define B_ASN1_VIDEOTEXSTRING 0x0008 +# define B_ASN1_IA5STRING 0x0010 +# define B_ASN1_GRAPHICSTRING 0x0020 +# define B_ASN1_ISO64STRING 0x0040 +# define B_ASN1_VISIBLESTRING 0x0040 +# define B_ASN1_GENERALSTRING 0x0080 +# define B_ASN1_UNIVERSALSTRING 0x0100 +# define B_ASN1_OCTET_STRING 0x0200 +# define B_ASN1_BIT_STRING 0x0400 +# define B_ASN1_BMPSTRING 0x0800 +# define B_ASN1_UNKNOWN 0x1000 +# define B_ASN1_UTF8STRING 0x2000 +# define B_ASN1_UTCTIME 0x4000 +# define B_ASN1_GENERALIZEDTIME 0x8000 +# define B_ASN1_SEQUENCE 0x10000 +/* For use with ASN1_mbstring_copy() */ +# define MBSTRING_FLAG 0x1000 +# define MBSTRING_UTF8 (MBSTRING_FLAG) +# define MBSTRING_ASC (MBSTRING_FLAG|1) +# define MBSTRING_BMP (MBSTRING_FLAG|2) +# define MBSTRING_UNIV (MBSTRING_FLAG|4) +# define SMIME_OLDMIME 0x400 +# define SMIME_CRLFEOL 0x800 +# define SMIME_STREAM 0x1000 + struct X509_algor_st; +DEFINE_STACK_OF(X509_ALGOR) + +# define ASN1_STRING_FLAG_BITS_LEFT 0x08/* Set if 0x07 has bits left value */ +/* + * This indicates that the ASN1_STRING is not a real value but just a place + * holder for the location where indefinite length constructed data should be + * inserted in the memory buffer + */ +# define ASN1_STRING_FLAG_NDEF 0x010 + +/* + * This flag is used by the CMS code to indicate that a string is not + * complete and is a place holder for content when it had all been accessed. + * The flag will be reset when content has been written to it. + */ + +# define ASN1_STRING_FLAG_CONT 0x020 +/* + * This flag is used by ASN1 code to indicate an ASN1_STRING is an MSTRING + * type. + */ +# define ASN1_STRING_FLAG_MSTRING 0x040 +/* String is embedded and only content should be freed */ +# define ASN1_STRING_FLAG_EMBED 0x080 +/* String should be parsed in RFC 5280's time format */ +# define ASN1_STRING_FLAG_X509_TIME 0x100 +/* This is the base type that holds just about everything :-) */ +struct asn1_string_st { + int length; + int type; + unsigned char *data; + /* + * The value of the following field depends on the type being held. It + * is mostly being used for BIT_STRING so if the input data has a + * non-zero 'unused bits' value, it will be handled correctly + */ + long flags; +}; + +/* + * ASN1_ENCODING structure: this is used to save the received encoding of an + * ASN1 type. This is useful to get round problems with invalid encodings + * which can break signatures. + */ + +typedef struct ASN1_ENCODING_st { + unsigned char *enc; /* DER encoding */ + long len; /* Length of encoding */ + int modified; /* set to 1 if 'enc' is invalid */ +} ASN1_ENCODING; + +/* Used with ASN1 LONG type: if a long is set to this it is omitted */ +# define ASN1_LONG_UNDEF 0x7fffffffL + +# define STABLE_FLAGS_MALLOC 0x01 +/* + * A zero passed to ASN1_STRING_TABLE_new_add for the flags is interpreted + * as "don't change" and STABLE_FLAGS_MALLOC is always set. By setting + * STABLE_FLAGS_MALLOC only we can clear the existing value. Use the alias + * STABLE_FLAGS_CLEAR to reflect this. + */ +# define STABLE_FLAGS_CLEAR STABLE_FLAGS_MALLOC +# define STABLE_NO_MASK 0x02 +# define DIRSTRING_TYPE \ + (B_ASN1_PRINTABLESTRING|B_ASN1_T61STRING|B_ASN1_BMPSTRING|B_ASN1_UTF8STRING) +# define PKCS9STRING_TYPE (DIRSTRING_TYPE|B_ASN1_IA5STRING) + +typedef struct asn1_string_table_st { + int nid; + long minsize; + long maxsize; + unsigned long mask; + unsigned long flags; +} ASN1_STRING_TABLE; + +DEFINE_STACK_OF(ASN1_STRING_TABLE) + +/* size limits: this stuff is taken straight from RFC2459 */ + +# define ub_name 32768 +# define ub_common_name 64 +# define ub_locality_name 128 +# define ub_state_name 128 +# define ub_organization_name 64 +# define ub_organization_unit_name 64 +# define ub_title 64 +# define ub_email_address 128 + +/* + * Declarations for template structures: for full definitions see asn1t.h + */ +typedef struct ASN1_TEMPLATE_st ASN1_TEMPLATE; +typedef struct ASN1_TLC_st ASN1_TLC; +/* This is just an opaque pointer */ +typedef struct ASN1_VALUE_st ASN1_VALUE; + +/* Declare ASN1 functions: the implement macro in in asn1t.h */ + +# define DECLARE_ASN1_FUNCTIONS(type) DECLARE_ASN1_FUNCTIONS_name(type, type) + +# define DECLARE_ASN1_ALLOC_FUNCTIONS(type) \ + DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, type) + +# define DECLARE_ASN1_FUNCTIONS_name(type, name) \ + DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \ + DECLARE_ASN1_ENCODE_FUNCTIONS(type, name, name) + +# define DECLARE_ASN1_FUNCTIONS_fname(type, itname, name) \ + DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \ + DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) + +# define DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) \ + type *d2i_##name(type **a, const unsigned char **in, long len); \ + int i2d_##name(type *a, unsigned char **out); \ + DECLARE_ASN1_ITEM(itname) + +# define DECLARE_ASN1_ENCODE_FUNCTIONS_const(type, name) \ + type *d2i_##name(type **a, const unsigned char **in, long len); \ + int i2d_##name(const type *a, unsigned char **out); \ + DECLARE_ASN1_ITEM(name) + +# define DECLARE_ASN1_NDEF_FUNCTION(name) \ + int i2d_##name##_NDEF(name *a, unsigned char **out); + +# define DECLARE_ASN1_FUNCTIONS_const(name) \ + DECLARE_ASN1_ALLOC_FUNCTIONS(name) \ + DECLARE_ASN1_ENCODE_FUNCTIONS_const(name, name) + +# define DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \ + type *name##_new(void); \ + void name##_free(type *a); + +# define DECLARE_ASN1_PRINT_FUNCTION(stname) \ + DECLARE_ASN1_PRINT_FUNCTION_fname(stname, stname) + +# define DECLARE_ASN1_PRINT_FUNCTION_fname(stname, fname) \ + int fname##_print_ctx(BIO *out, stname *x, int indent, \ + const ASN1_PCTX *pctx); + +# define D2I_OF(type) type *(*)(type **,const unsigned char **,long) +# define I2D_OF(type) int (*)(type *,unsigned char **) +# define I2D_OF_const(type) int (*)(const type *,unsigned char **) + +# define CHECKED_D2I_OF(type, d2i) \ + ((d2i_of_void*) (1 ? d2i : ((D2I_OF(type))0))) +# define CHECKED_I2D_OF(type, i2d) \ + ((i2d_of_void*) (1 ? i2d : ((I2D_OF(type))0))) +# define CHECKED_NEW_OF(type, xnew) \ + ((void *(*)(void)) (1 ? xnew : ((type *(*)(void))0))) +# define CHECKED_PTR_OF(type, p) \ + ((void*) (1 ? p : (type*)0)) +# define CHECKED_PPTR_OF(type, p) \ + ((void**) (1 ? p : (type**)0)) + +# define TYPEDEF_D2I_OF(type) typedef type *d2i_of_##type(type **,const unsigned char **,long) +# define TYPEDEF_I2D_OF(type) typedef int i2d_of_##type(type *,unsigned char **) +# define TYPEDEF_D2I2D_OF(type) TYPEDEF_D2I_OF(type); TYPEDEF_I2D_OF(type) + +TYPEDEF_D2I2D_OF(void); + +/*- + * The following macros and typedefs allow an ASN1_ITEM + * to be embedded in a structure and referenced. Since + * the ASN1_ITEM pointers need to be globally accessible + * (possibly from shared libraries) they may exist in + * different forms. On platforms that support it the + * ASN1_ITEM structure itself will be globally exported. + * Other platforms will export a function that returns + * an ASN1_ITEM pointer. + * + * To handle both cases transparently the macros below + * should be used instead of hard coding an ASN1_ITEM + * pointer in a structure. + * + * The structure will look like this: + * + * typedef struct SOMETHING_st { + * ... + * ASN1_ITEM_EXP *iptr; + * ... + * } SOMETHING; + * + * It would be initialised as e.g.: + * + * SOMETHING somevar = {...,ASN1_ITEM_ref(X509),...}; + * + * and the actual pointer extracted with: + * + * const ASN1_ITEM *it = ASN1_ITEM_ptr(somevar.iptr); + * + * Finally an ASN1_ITEM pointer can be extracted from an + * appropriate reference with: ASN1_ITEM_rptr(X509). This + * would be used when a function takes an ASN1_ITEM * argument. + * + */ + +# ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION + +/* ASN1_ITEM pointer exported type */ +typedef const ASN1_ITEM ASN1_ITEM_EXP; + +/* Macro to obtain ASN1_ITEM pointer from exported type */ +# define ASN1_ITEM_ptr(iptr) (iptr) + +/* Macro to include ASN1_ITEM pointer from base type */ +# define ASN1_ITEM_ref(iptr) (&(iptr##_it)) + +# define ASN1_ITEM_rptr(ref) (&(ref##_it)) + +# define DECLARE_ASN1_ITEM(name) \ + OPENSSL_EXTERN const ASN1_ITEM name##_it; + +# else + +/* + * Platforms that can't easily handle shared global variables are declared as + * functions returning ASN1_ITEM pointers. + */ + +/* ASN1_ITEM pointer exported type */ +typedef const ASN1_ITEM *ASN1_ITEM_EXP (void); + +/* Macro to obtain ASN1_ITEM pointer from exported type */ +# define ASN1_ITEM_ptr(iptr) (iptr()) + +/* Macro to include ASN1_ITEM pointer from base type */ +# define ASN1_ITEM_ref(iptr) (iptr##_it) + +# define ASN1_ITEM_rptr(ref) (ref##_it()) + +# define DECLARE_ASN1_ITEM(name) \ + const ASN1_ITEM * name##_it(void); + +# endif + +/* Parameters used by ASN1_STRING_print_ex() */ + +/* + * These determine which characters to escape: RFC2253 special characters, + * control characters and MSB set characters + */ + +# define ASN1_STRFLGS_ESC_2253 1 +# define ASN1_STRFLGS_ESC_CTRL 2 +# define ASN1_STRFLGS_ESC_MSB 4 + +/* + * This flag determines how we do escaping: normally RC2253 backslash only, + * set this to use backslash and quote. + */ + +# define ASN1_STRFLGS_ESC_QUOTE 8 + +/* These three flags are internal use only. */ + +/* Character is a valid PrintableString character */ +# define CHARTYPE_PRINTABLESTRING 0x10 +/* Character needs escaping if it is the first character */ +# define CHARTYPE_FIRST_ESC_2253 0x20 +/* Character needs escaping if it is the last character */ +# define CHARTYPE_LAST_ESC_2253 0x40 + +/* + * NB the internal flags are safely reused below by flags handled at the top + * level. + */ + +/* + * If this is set we convert all character strings to UTF8 first + */ + +# define ASN1_STRFLGS_UTF8_CONVERT 0x10 + +/* + * If this is set we don't attempt to interpret content: just assume all + * strings are 1 byte per character. This will produce some pretty odd + * looking output! + */ + +# define ASN1_STRFLGS_IGNORE_TYPE 0x20 + +/* If this is set we include the string type in the output */ +# define ASN1_STRFLGS_SHOW_TYPE 0x40 + +/* + * This determines which strings to display and which to 'dump' (hex dump of + * content octets or DER encoding). We can only dump non character strings or + * everything. If we don't dump 'unknown' they are interpreted as character + * strings with 1 octet per character and are subject to the usual escaping + * options. + */ + +# define ASN1_STRFLGS_DUMP_ALL 0x80 +# define ASN1_STRFLGS_DUMP_UNKNOWN 0x100 + +/* + * These determine what 'dumping' does, we can dump the content octets or the + * DER encoding: both use the RFC2253 #XXXXX notation. + */ + +# define ASN1_STRFLGS_DUMP_DER 0x200 + +/* + * This flag specifies that RC2254 escaping shall be performed. + */ +#define ASN1_STRFLGS_ESC_2254 0x400 + +/* + * All the string flags consistent with RFC2253, escaping control characters + * isn't essential in RFC2253 but it is advisable anyway. + */ + +# define ASN1_STRFLGS_RFC2253 (ASN1_STRFLGS_ESC_2253 | \ + ASN1_STRFLGS_ESC_CTRL | \ + ASN1_STRFLGS_ESC_MSB | \ + ASN1_STRFLGS_UTF8_CONVERT | \ + ASN1_STRFLGS_DUMP_UNKNOWN | \ + ASN1_STRFLGS_DUMP_DER) + +DEFINE_STACK_OF(ASN1_INTEGER) + +DEFINE_STACK_OF(ASN1_GENERALSTRING) + +DEFINE_STACK_OF(ASN1_UTF8STRING) + +typedef struct asn1_type_st { + int type; + union { + char *ptr; + ASN1_BOOLEAN boolean; + ASN1_STRING *asn1_string; + ASN1_OBJECT *object; + ASN1_INTEGER *integer; + ASN1_ENUMERATED *enumerated; + ASN1_BIT_STRING *bit_string; + ASN1_OCTET_STRING *octet_string; + ASN1_PRINTABLESTRING *printablestring; + ASN1_T61STRING *t61string; + ASN1_IA5STRING *ia5string; + ASN1_GENERALSTRING *generalstring; + ASN1_BMPSTRING *bmpstring; + ASN1_UNIVERSALSTRING *universalstring; + ASN1_UTCTIME *utctime; + ASN1_GENERALIZEDTIME *generalizedtime; + ASN1_VISIBLESTRING *visiblestring; + ASN1_UTF8STRING *utf8string; + /* + * set and sequence are left complete and still contain the set or + * sequence bytes + */ + ASN1_STRING *set; + ASN1_STRING *sequence; + ASN1_VALUE *asn1_value; + } value; +} ASN1_TYPE; + +DEFINE_STACK_OF(ASN1_TYPE) + +typedef STACK_OF(ASN1_TYPE) ASN1_SEQUENCE_ANY; + +DECLARE_ASN1_ENCODE_FUNCTIONS_const(ASN1_SEQUENCE_ANY, ASN1_SEQUENCE_ANY) +DECLARE_ASN1_ENCODE_FUNCTIONS_const(ASN1_SEQUENCE_ANY, ASN1_SET_ANY) + +/* This is used to contain a list of bit names */ +typedef struct BIT_STRING_BITNAME_st { + int bitnum; + const char *lname; + const char *sname; +} BIT_STRING_BITNAME; + +# define B_ASN1_TIME \ + B_ASN1_UTCTIME | \ + B_ASN1_GENERALIZEDTIME + +# define B_ASN1_PRINTABLE \ + B_ASN1_NUMERICSTRING| \ + B_ASN1_PRINTABLESTRING| \ + B_ASN1_T61STRING| \ + B_ASN1_IA5STRING| \ + B_ASN1_BIT_STRING| \ + B_ASN1_UNIVERSALSTRING|\ + B_ASN1_BMPSTRING|\ + B_ASN1_UTF8STRING|\ + B_ASN1_SEQUENCE|\ + B_ASN1_UNKNOWN + +# define B_ASN1_DIRECTORYSTRING \ + B_ASN1_PRINTABLESTRING| \ + B_ASN1_TELETEXSTRING|\ + B_ASN1_BMPSTRING|\ + B_ASN1_UNIVERSALSTRING|\ + B_ASN1_UTF8STRING + +# define B_ASN1_DISPLAYTEXT \ + B_ASN1_IA5STRING| \ + B_ASN1_VISIBLESTRING| \ + B_ASN1_BMPSTRING|\ + B_ASN1_UTF8STRING + +DECLARE_ASN1_FUNCTIONS_fname(ASN1_TYPE, ASN1_ANY, ASN1_TYPE) + +int ASN1_TYPE_get(const ASN1_TYPE *a); +void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value); +int ASN1_TYPE_set1(ASN1_TYPE *a, int type, const void *value); +int ASN1_TYPE_cmp(const ASN1_TYPE *a, const ASN1_TYPE *b); + +ASN1_TYPE *ASN1_TYPE_pack_sequence(const ASN1_ITEM *it, void *s, ASN1_TYPE **t); +void *ASN1_TYPE_unpack_sequence(const ASN1_ITEM *it, const ASN1_TYPE *t); + +ASN1_OBJECT *ASN1_OBJECT_new(void); +void ASN1_OBJECT_free(ASN1_OBJECT *a); +int i2d_ASN1_OBJECT(const ASN1_OBJECT *a, unsigned char **pp); +ASN1_OBJECT *d2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp, + long length); + +DECLARE_ASN1_ITEM(ASN1_OBJECT) + +DEFINE_STACK_OF(ASN1_OBJECT) + +ASN1_STRING *ASN1_STRING_new(void); +void ASN1_STRING_free(ASN1_STRING *a); +void ASN1_STRING_clear_free(ASN1_STRING *a); +int ASN1_STRING_copy(ASN1_STRING *dst, const ASN1_STRING *str); +ASN1_STRING *ASN1_STRING_dup(const ASN1_STRING *a); +ASN1_STRING *ASN1_STRING_type_new(int type); +int ASN1_STRING_cmp(const ASN1_STRING *a, const ASN1_STRING *b); + /* + * Since this is used to store all sorts of things, via macros, for now, + * make its data void * + */ +int ASN1_STRING_set(ASN1_STRING *str, const void *data, int len); +void ASN1_STRING_set0(ASN1_STRING *str, void *data, int len); +int ASN1_STRING_length(const ASN1_STRING *x); +void ASN1_STRING_length_set(ASN1_STRING *x, int n); +int ASN1_STRING_type(const ASN1_STRING *x); +DEPRECATEDIN_1_1_0(unsigned char *ASN1_STRING_data(ASN1_STRING *x)) +const unsigned char *ASN1_STRING_get0_data(const ASN1_STRING *x); + +DECLARE_ASN1_FUNCTIONS(ASN1_BIT_STRING) +int ASN1_BIT_STRING_set(ASN1_BIT_STRING *a, unsigned char *d, int length); +int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value); +int ASN1_BIT_STRING_get_bit(const ASN1_BIT_STRING *a, int n); +int ASN1_BIT_STRING_check(const ASN1_BIT_STRING *a, + const unsigned char *flags, int flags_len); + +int ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs, + BIT_STRING_BITNAME *tbl, int indent); +int ASN1_BIT_STRING_num_asc(const char *name, BIT_STRING_BITNAME *tbl); +int ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, const char *name, int value, + BIT_STRING_BITNAME *tbl); + +DECLARE_ASN1_FUNCTIONS(ASN1_INTEGER) +ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a, const unsigned char **pp, + long length); +ASN1_INTEGER *ASN1_INTEGER_dup(const ASN1_INTEGER *x); +int ASN1_INTEGER_cmp(const ASN1_INTEGER *x, const ASN1_INTEGER *y); + +DECLARE_ASN1_FUNCTIONS(ASN1_ENUMERATED) + +int ASN1_UTCTIME_check(const ASN1_UTCTIME *a); +ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t); +ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t, + int offset_day, long offset_sec); +int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, const char *str); +int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t); + +int ASN1_GENERALIZEDTIME_check(const ASN1_GENERALIZEDTIME *a); +ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s, + time_t t); +ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s, + time_t t, int offset_day, + long offset_sec); +int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str); + +int ASN1_TIME_diff(int *pday, int *psec, + const ASN1_TIME *from, const ASN1_TIME *to); + +DECLARE_ASN1_FUNCTIONS(ASN1_OCTET_STRING) +ASN1_OCTET_STRING *ASN1_OCTET_STRING_dup(const ASN1_OCTET_STRING *a); +int ASN1_OCTET_STRING_cmp(const ASN1_OCTET_STRING *a, + const ASN1_OCTET_STRING *b); +int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *str, const unsigned char *data, + int len); + +DECLARE_ASN1_FUNCTIONS(ASN1_VISIBLESTRING) +DECLARE_ASN1_FUNCTIONS(ASN1_UNIVERSALSTRING) +DECLARE_ASN1_FUNCTIONS(ASN1_UTF8STRING) +DECLARE_ASN1_FUNCTIONS(ASN1_NULL) +DECLARE_ASN1_FUNCTIONS(ASN1_BMPSTRING) + +int UTF8_getc(const unsigned char *str, int len, unsigned long *val); +int UTF8_putc(unsigned char *str, int len, unsigned long value); + +DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, ASN1_PRINTABLE) + +DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, DIRECTORYSTRING) +DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, DISPLAYTEXT) +DECLARE_ASN1_FUNCTIONS(ASN1_PRINTABLESTRING) +DECLARE_ASN1_FUNCTIONS(ASN1_T61STRING) +DECLARE_ASN1_FUNCTIONS(ASN1_IA5STRING) +DECLARE_ASN1_FUNCTIONS(ASN1_GENERALSTRING) +DECLARE_ASN1_FUNCTIONS(ASN1_UTCTIME) +DECLARE_ASN1_FUNCTIONS(ASN1_GENERALIZEDTIME) +DECLARE_ASN1_FUNCTIONS(ASN1_TIME) + +DECLARE_ASN1_ITEM(ASN1_OCTET_STRING_NDEF) + +ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s, time_t t); +ASN1_TIME *ASN1_TIME_adj(ASN1_TIME *s, time_t t, + int offset_day, long offset_sec); +int ASN1_TIME_check(const ASN1_TIME *t); +ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(const ASN1_TIME *t, + ASN1_GENERALIZEDTIME **out); +int ASN1_TIME_set_string(ASN1_TIME *s, const char *str); +int ASN1_TIME_set_string_X509(ASN1_TIME *s, const char *str); +int ASN1_TIME_to_tm(const ASN1_TIME *s, struct tm *tm); +int ASN1_TIME_normalize(ASN1_TIME *s); +int ASN1_TIME_cmp_time_t(const ASN1_TIME *s, time_t t); +int ASN1_TIME_compare(const ASN1_TIME *a, const ASN1_TIME *b); + +int i2a_ASN1_INTEGER(BIO *bp, const ASN1_INTEGER *a); +int a2i_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *bs, char *buf, int size); +int i2a_ASN1_ENUMERATED(BIO *bp, const ASN1_ENUMERATED *a); +int a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size); +int i2a_ASN1_OBJECT(BIO *bp, const ASN1_OBJECT *a); +int a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size); +int i2a_ASN1_STRING(BIO *bp, const ASN1_STRING *a, int type); +int i2t_ASN1_OBJECT(char *buf, int buf_len, const ASN1_OBJECT *a); + +int a2d_ASN1_OBJECT(unsigned char *out, int olen, const char *buf, int num); +ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data, int len, + const char *sn, const char *ln); + +int ASN1_INTEGER_get_int64(int64_t *pr, const ASN1_INTEGER *a); +int ASN1_INTEGER_set_int64(ASN1_INTEGER *a, int64_t r); +int ASN1_INTEGER_get_uint64(uint64_t *pr, const ASN1_INTEGER *a); +int ASN1_INTEGER_set_uint64(ASN1_INTEGER *a, uint64_t r); + +int ASN1_INTEGER_set(ASN1_INTEGER *a, long v); +long ASN1_INTEGER_get(const ASN1_INTEGER *a); +ASN1_INTEGER *BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai); +BIGNUM *ASN1_INTEGER_to_BN(const ASN1_INTEGER *ai, BIGNUM *bn); + +int ASN1_ENUMERATED_get_int64(int64_t *pr, const ASN1_ENUMERATED *a); +int ASN1_ENUMERATED_set_int64(ASN1_ENUMERATED *a, int64_t r); + + +int ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v); +long ASN1_ENUMERATED_get(const ASN1_ENUMERATED *a); +ASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(const BIGNUM *bn, ASN1_ENUMERATED *ai); +BIGNUM *ASN1_ENUMERATED_to_BN(const ASN1_ENUMERATED *ai, BIGNUM *bn); + +/* General */ +/* given a string, return the correct type, max is the maximum length */ +int ASN1_PRINTABLE_type(const unsigned char *s, int max); + +unsigned long ASN1_tag2bit(int tag); + +/* SPECIALS */ +int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag, + int *pclass, long omax); +int ASN1_check_infinite_end(unsigned char **p, long len); +int ASN1_const_check_infinite_end(const unsigned char **p, long len); +void ASN1_put_object(unsigned char **pp, int constructed, int length, + int tag, int xclass); +int ASN1_put_eoc(unsigned char **pp); +int ASN1_object_size(int constructed, int length, int tag); + +/* Used to implement other functions */ +void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, void *x); + +# define ASN1_dup_of(type,i2d,d2i,x) \ + ((type*)ASN1_dup(CHECKED_I2D_OF(type, i2d), \ + CHECKED_D2I_OF(type, d2i), \ + CHECKED_PTR_OF(type, x))) + +# define ASN1_dup_of_const(type,i2d,d2i,x) \ + ((type*)ASN1_dup(CHECKED_I2D_OF(const type, i2d), \ + CHECKED_D2I_OF(type, d2i), \ + CHECKED_PTR_OF(const type, x))) + +void *ASN1_item_dup(const ASN1_ITEM *it, void *x); + +/* ASN1 alloc/free macros for when a type is only used internally */ + +# define M_ASN1_new_of(type) (type *)ASN1_item_new(ASN1_ITEM_rptr(type)) +# define M_ASN1_free_of(x, type) \ + ASN1_item_free(CHECKED_PTR_OF(type, x), ASN1_ITEM_rptr(type)) + +# ifndef OPENSSL_NO_STDIO +void *ASN1_d2i_fp(void *(*xnew) (void), d2i_of_void *d2i, FILE *in, void **x); + +# define ASN1_d2i_fp_of(type,xnew,d2i,in,x) \ + ((type*)ASN1_d2i_fp(CHECKED_NEW_OF(type, xnew), \ + CHECKED_D2I_OF(type, d2i), \ + in, \ + CHECKED_PPTR_OF(type, x))) + +void *ASN1_item_d2i_fp(const ASN1_ITEM *it, FILE *in, void *x); +int ASN1_i2d_fp(i2d_of_void *i2d, FILE *out, void *x); + +# define ASN1_i2d_fp_of(type,i2d,out,x) \ + (ASN1_i2d_fp(CHECKED_I2D_OF(type, i2d), \ + out, \ + CHECKED_PTR_OF(type, x))) + +# define ASN1_i2d_fp_of_const(type,i2d,out,x) \ + (ASN1_i2d_fp(CHECKED_I2D_OF(const type, i2d), \ + out, \ + CHECKED_PTR_OF(const type, x))) + +int ASN1_item_i2d_fp(const ASN1_ITEM *it, FILE *out, void *x); +int ASN1_STRING_print_ex_fp(FILE *fp, const ASN1_STRING *str, unsigned long flags); +# endif + +int ASN1_STRING_to_UTF8(unsigned char **out, const ASN1_STRING *in); + +void *ASN1_d2i_bio(void *(*xnew) (void), d2i_of_void *d2i, BIO *in, void **x); + +# define ASN1_d2i_bio_of(type,xnew,d2i,in,x) \ + ((type*)ASN1_d2i_bio( CHECKED_NEW_OF(type, xnew), \ + CHECKED_D2I_OF(type, d2i), \ + in, \ + CHECKED_PPTR_OF(type, x))) + +void *ASN1_item_d2i_bio(const ASN1_ITEM *it, BIO *in, void *x); +int ASN1_i2d_bio(i2d_of_void *i2d, BIO *out, unsigned char *x); + +# define ASN1_i2d_bio_of(type,i2d,out,x) \ + (ASN1_i2d_bio(CHECKED_I2D_OF(type, i2d), \ + out, \ + CHECKED_PTR_OF(type, x))) + +# define ASN1_i2d_bio_of_const(type,i2d,out,x) \ + (ASN1_i2d_bio(CHECKED_I2D_OF(const type, i2d), \ + out, \ + CHECKED_PTR_OF(const type, x))) + +int ASN1_item_i2d_bio(const ASN1_ITEM *it, BIO *out, void *x); +int ASN1_UTCTIME_print(BIO *fp, const ASN1_UTCTIME *a); +int ASN1_GENERALIZEDTIME_print(BIO *fp, const ASN1_GENERALIZEDTIME *a); +int ASN1_TIME_print(BIO *fp, const ASN1_TIME *a); +int ASN1_STRING_print(BIO *bp, const ASN1_STRING *v); +int ASN1_STRING_print_ex(BIO *out, const ASN1_STRING *str, unsigned long flags); +int ASN1_buf_print(BIO *bp, const unsigned char *buf, size_t buflen, int off); +int ASN1_bn_print(BIO *bp, const char *number, const BIGNUM *num, + unsigned char *buf, int off); +int ASN1_parse(BIO *bp, const unsigned char *pp, long len, int indent); +int ASN1_parse_dump(BIO *bp, const unsigned char *pp, long len, int indent, + int dump); +const char *ASN1_tag2str(int tag); + +/* Used to load and write Netscape format cert */ + +int ASN1_UNIVERSALSTRING_to_string(ASN1_UNIVERSALSTRING *s); + +int ASN1_TYPE_set_octetstring(ASN1_TYPE *a, unsigned char *data, int len); +int ASN1_TYPE_get_octetstring(const ASN1_TYPE *a, unsigned char *data, int max_len); +int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num, + unsigned char *data, int len); +int ASN1_TYPE_get_int_octetstring(const ASN1_TYPE *a, long *num, + unsigned char *data, int max_len); + +void *ASN1_item_unpack(const ASN1_STRING *oct, const ASN1_ITEM *it); + +ASN1_STRING *ASN1_item_pack(void *obj, const ASN1_ITEM *it, + ASN1_OCTET_STRING **oct); + +void ASN1_STRING_set_default_mask(unsigned long mask); +int ASN1_STRING_set_default_mask_asc(const char *p); +unsigned long ASN1_STRING_get_default_mask(void); +int ASN1_mbstring_copy(ASN1_STRING **out, const unsigned char *in, int len, + int inform, unsigned long mask); +int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len, + int inform, unsigned long mask, + long minsize, long maxsize); + +ASN1_STRING *ASN1_STRING_set_by_NID(ASN1_STRING **out, + const unsigned char *in, int inlen, + int inform, int nid); +ASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid); +int ASN1_STRING_TABLE_add(int, long, long, unsigned long, unsigned long); +void ASN1_STRING_TABLE_cleanup(void); + +/* ASN1 template functions */ + +/* Old API compatible functions */ +ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it); +void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it); +ASN1_VALUE *ASN1_item_d2i(ASN1_VALUE **val, const unsigned char **in, + long len, const ASN1_ITEM *it); +int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it); +int ASN1_item_ndef_i2d(ASN1_VALUE *val, unsigned char **out, + const ASN1_ITEM *it); + +void ASN1_add_oid_module(void); +void ASN1_add_stable_module(void); + +ASN1_TYPE *ASN1_generate_nconf(const char *str, CONF *nconf); +ASN1_TYPE *ASN1_generate_v3(const char *str, X509V3_CTX *cnf); +int ASN1_str2mask(const char *str, unsigned long *pmask); + +/* ASN1 Print flags */ + +/* Indicate missing OPTIONAL fields */ +# define ASN1_PCTX_FLAGS_SHOW_ABSENT 0x001 +/* Mark start and end of SEQUENCE */ +# define ASN1_PCTX_FLAGS_SHOW_SEQUENCE 0x002 +/* Mark start and end of SEQUENCE/SET OF */ +# define ASN1_PCTX_FLAGS_SHOW_SSOF 0x004 +/* Show the ASN1 type of primitives */ +# define ASN1_PCTX_FLAGS_SHOW_TYPE 0x008 +/* Don't show ASN1 type of ANY */ +# define ASN1_PCTX_FLAGS_NO_ANY_TYPE 0x010 +/* Don't show ASN1 type of MSTRINGs */ +# define ASN1_PCTX_FLAGS_NO_MSTRING_TYPE 0x020 +/* Don't show field names in SEQUENCE */ +# define ASN1_PCTX_FLAGS_NO_FIELD_NAME 0x040 +/* Show structure names of each SEQUENCE field */ +# define ASN1_PCTX_FLAGS_SHOW_FIELD_STRUCT_NAME 0x080 +/* Don't show structure name even at top level */ +# define ASN1_PCTX_FLAGS_NO_STRUCT_NAME 0x100 + +int ASN1_item_print(BIO *out, ASN1_VALUE *ifld, int indent, + const ASN1_ITEM *it, const ASN1_PCTX *pctx); +ASN1_PCTX *ASN1_PCTX_new(void); +void ASN1_PCTX_free(ASN1_PCTX *p); +unsigned long ASN1_PCTX_get_flags(const ASN1_PCTX *p); +void ASN1_PCTX_set_flags(ASN1_PCTX *p, unsigned long flags); +unsigned long ASN1_PCTX_get_nm_flags(const ASN1_PCTX *p); +void ASN1_PCTX_set_nm_flags(ASN1_PCTX *p, unsigned long flags); +unsigned long ASN1_PCTX_get_cert_flags(const ASN1_PCTX *p); +void ASN1_PCTX_set_cert_flags(ASN1_PCTX *p, unsigned long flags); +unsigned long ASN1_PCTX_get_oid_flags(const ASN1_PCTX *p); +void ASN1_PCTX_set_oid_flags(ASN1_PCTX *p, unsigned long flags); +unsigned long ASN1_PCTX_get_str_flags(const ASN1_PCTX *p); +void ASN1_PCTX_set_str_flags(ASN1_PCTX *p, unsigned long flags); + +ASN1_SCTX *ASN1_SCTX_new(int (*scan_cb) (ASN1_SCTX *ctx)); +void ASN1_SCTX_free(ASN1_SCTX *p); +const ASN1_ITEM *ASN1_SCTX_get_item(ASN1_SCTX *p); +const ASN1_TEMPLATE *ASN1_SCTX_get_template(ASN1_SCTX *p); +unsigned long ASN1_SCTX_get_flags(ASN1_SCTX *p); +void ASN1_SCTX_set_app_data(ASN1_SCTX *p, void *data); +void *ASN1_SCTX_get_app_data(ASN1_SCTX *p); + +const BIO_METHOD *BIO_f_asn1(void); + +BIO *BIO_new_NDEF(BIO *out, ASN1_VALUE *val, const ASN1_ITEM *it); + +int i2d_ASN1_bio_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags, + const ASN1_ITEM *it); +int PEM_write_bio_ASN1_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags, + const char *hdr, const ASN1_ITEM *it); +int SMIME_write_ASN1(BIO *bio, ASN1_VALUE *val, BIO *data, int flags, + int ctype_nid, int econt_nid, + STACK_OF(X509_ALGOR) *mdalgs, const ASN1_ITEM *it); +ASN1_VALUE *SMIME_read_ASN1(BIO *bio, BIO **bcont, const ASN1_ITEM *it); +int SMIME_crlf_copy(BIO *in, BIO *out, int flags); +int SMIME_text(BIO *in, BIO *out); + +const ASN1_ITEM *ASN1_ITEM_lookup(const char *name); +const ASN1_ITEM *ASN1_ITEM_get(size_t i); + +# ifdef __cplusplus +} +# endif +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/asn1_mac.h b/MediaClient/MediaClient/openssl/include/openssl/asn1_mac.h new file mode 100644 index 0000000..7ac1782 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/asn1_mac.h @@ -0,0 +1,10 @@ +/* + * Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#error "This file is obsolete; please update your software." diff --git a/MediaClient/MediaClient/openssl/include/openssl/asn1err.h b/MediaClient/MediaClient/openssl/include/openssl/asn1err.h new file mode 100644 index 0000000..faed5a5 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/asn1err.h @@ -0,0 +1,256 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_ASN1ERR_H +# define HEADER_ASN1ERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_ASN1_strings(void); + +/* + * ASN1 function codes. + */ +# define ASN1_F_A2D_ASN1_OBJECT 100 +# define ASN1_F_A2I_ASN1_INTEGER 102 +# define ASN1_F_A2I_ASN1_STRING 103 +# define ASN1_F_APPEND_EXP 176 +# define ASN1_F_ASN1_BIO_INIT 113 +# define ASN1_F_ASN1_BIT_STRING_SET_BIT 183 +# define ASN1_F_ASN1_CB 177 +# define ASN1_F_ASN1_CHECK_TLEN 104 +# define ASN1_F_ASN1_COLLECT 106 +# define ASN1_F_ASN1_D2I_EX_PRIMITIVE 108 +# define ASN1_F_ASN1_D2I_FP 109 +# define ASN1_F_ASN1_D2I_READ_BIO 107 +# define ASN1_F_ASN1_DIGEST 184 +# define ASN1_F_ASN1_DO_ADB 110 +# define ASN1_F_ASN1_DO_LOCK 233 +# define ASN1_F_ASN1_DUP 111 +# define ASN1_F_ASN1_ENC_SAVE 115 +# define ASN1_F_ASN1_EX_C2I 204 +# define ASN1_F_ASN1_FIND_END 190 +# define ASN1_F_ASN1_GENERALIZEDTIME_ADJ 216 +# define ASN1_F_ASN1_GENERATE_V3 178 +# define ASN1_F_ASN1_GET_INT64 224 +# define ASN1_F_ASN1_GET_OBJECT 114 +# define ASN1_F_ASN1_GET_UINT64 225 +# define ASN1_F_ASN1_I2D_BIO 116 +# define ASN1_F_ASN1_I2D_FP 117 +# define ASN1_F_ASN1_ITEM_D2I_FP 206 +# define ASN1_F_ASN1_ITEM_DUP 191 +# define ASN1_F_ASN1_ITEM_EMBED_D2I 120 +# define ASN1_F_ASN1_ITEM_EMBED_NEW 121 +# define ASN1_F_ASN1_ITEM_FLAGS_I2D 118 +# define ASN1_F_ASN1_ITEM_I2D_BIO 192 +# define ASN1_F_ASN1_ITEM_I2D_FP 193 +# define ASN1_F_ASN1_ITEM_PACK 198 +# define ASN1_F_ASN1_ITEM_SIGN 195 +# define ASN1_F_ASN1_ITEM_SIGN_CTX 220 +# define ASN1_F_ASN1_ITEM_UNPACK 199 +# define ASN1_F_ASN1_ITEM_VERIFY 197 +# define ASN1_F_ASN1_MBSTRING_NCOPY 122 +# define ASN1_F_ASN1_OBJECT_NEW 123 +# define ASN1_F_ASN1_OUTPUT_DATA 214 +# define ASN1_F_ASN1_PCTX_NEW 205 +# define ASN1_F_ASN1_PRIMITIVE_NEW 119 +# define ASN1_F_ASN1_SCTX_NEW 221 +# define ASN1_F_ASN1_SIGN 128 +# define ASN1_F_ASN1_STR2TYPE 179 +# define ASN1_F_ASN1_STRING_GET_INT64 227 +# define ASN1_F_ASN1_STRING_GET_UINT64 230 +# define ASN1_F_ASN1_STRING_SET 186 +# define ASN1_F_ASN1_STRING_TABLE_ADD 129 +# define ASN1_F_ASN1_STRING_TO_BN 228 +# define ASN1_F_ASN1_STRING_TYPE_NEW 130 +# define ASN1_F_ASN1_TEMPLATE_EX_D2I 132 +# define ASN1_F_ASN1_TEMPLATE_NEW 133 +# define ASN1_F_ASN1_TEMPLATE_NOEXP_D2I 131 +# define ASN1_F_ASN1_TIME_ADJ 217 +# define ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING 134 +# define ASN1_F_ASN1_TYPE_GET_OCTETSTRING 135 +# define ASN1_F_ASN1_UTCTIME_ADJ 218 +# define ASN1_F_ASN1_VERIFY 137 +# define ASN1_F_B64_READ_ASN1 209 +# define ASN1_F_B64_WRITE_ASN1 210 +# define ASN1_F_BIO_NEW_NDEF 208 +# define ASN1_F_BITSTR_CB 180 +# define ASN1_F_BN_TO_ASN1_STRING 229 +# define ASN1_F_C2I_ASN1_BIT_STRING 189 +# define ASN1_F_C2I_ASN1_INTEGER 194 +# define ASN1_F_C2I_ASN1_OBJECT 196 +# define ASN1_F_C2I_IBUF 226 +# define ASN1_F_C2I_UINT64_INT 101 +# define ASN1_F_COLLECT_DATA 140 +# define ASN1_F_D2I_ASN1_OBJECT 147 +# define ASN1_F_D2I_ASN1_UINTEGER 150 +# define ASN1_F_D2I_AUTOPRIVATEKEY 207 +# define ASN1_F_D2I_PRIVATEKEY 154 +# define ASN1_F_D2I_PUBLICKEY 155 +# define ASN1_F_DO_BUF 142 +# define ASN1_F_DO_CREATE 124 +# define ASN1_F_DO_DUMP 125 +# define ASN1_F_DO_TCREATE 222 +# define ASN1_F_I2A_ASN1_OBJECT 126 +# define ASN1_F_I2D_ASN1_BIO_STREAM 211 +# define ASN1_F_I2D_ASN1_OBJECT 143 +# define ASN1_F_I2D_DSA_PUBKEY 161 +# define ASN1_F_I2D_EC_PUBKEY 181 +# define ASN1_F_I2D_PRIVATEKEY 163 +# define ASN1_F_I2D_PUBLICKEY 164 +# define ASN1_F_I2D_RSA_PUBKEY 165 +# define ASN1_F_LONG_C2I 166 +# define ASN1_F_NDEF_PREFIX 127 +# define ASN1_F_NDEF_SUFFIX 136 +# define ASN1_F_OID_MODULE_INIT 174 +# define ASN1_F_PARSE_TAGGING 182 +# define ASN1_F_PKCS5_PBE2_SET_IV 167 +# define ASN1_F_PKCS5_PBE2_SET_SCRYPT 231 +# define ASN1_F_PKCS5_PBE_SET 202 +# define ASN1_F_PKCS5_PBE_SET0_ALGOR 215 +# define ASN1_F_PKCS5_PBKDF2_SET 219 +# define ASN1_F_PKCS5_SCRYPT_SET 232 +# define ASN1_F_SMIME_READ_ASN1 212 +# define ASN1_F_SMIME_TEXT 213 +# define ASN1_F_STABLE_GET 138 +# define ASN1_F_STBL_MODULE_INIT 223 +# define ASN1_F_UINT32_C2I 105 +# define ASN1_F_UINT32_NEW 139 +# define ASN1_F_UINT64_C2I 112 +# define ASN1_F_UINT64_NEW 141 +# define ASN1_F_X509_CRL_ADD0_REVOKED 169 +# define ASN1_F_X509_INFO_NEW 170 +# define ASN1_F_X509_NAME_ENCODE 203 +# define ASN1_F_X509_NAME_EX_D2I 158 +# define ASN1_F_X509_NAME_EX_NEW 171 +# define ASN1_F_X509_PKEY_NEW 173 + +/* + * ASN1 reason codes. + */ +# define ASN1_R_ADDING_OBJECT 171 +# define ASN1_R_ASN1_PARSE_ERROR 203 +# define ASN1_R_ASN1_SIG_PARSE_ERROR 204 +# define ASN1_R_AUX_ERROR 100 +# define ASN1_R_BAD_OBJECT_HEADER 102 +# define ASN1_R_BMPSTRING_IS_WRONG_LENGTH 214 +# define ASN1_R_BN_LIB 105 +# define ASN1_R_BOOLEAN_IS_WRONG_LENGTH 106 +# define ASN1_R_BUFFER_TOO_SMALL 107 +# define ASN1_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER 108 +# define ASN1_R_CONTEXT_NOT_INITIALISED 217 +# define ASN1_R_DATA_IS_WRONG 109 +# define ASN1_R_DECODE_ERROR 110 +# define ASN1_R_DEPTH_EXCEEDED 174 +# define ASN1_R_DIGEST_AND_KEY_TYPE_NOT_SUPPORTED 198 +# define ASN1_R_ENCODE_ERROR 112 +# define ASN1_R_ERROR_GETTING_TIME 173 +# define ASN1_R_ERROR_LOADING_SECTION 172 +# define ASN1_R_ERROR_SETTING_CIPHER_PARAMS 114 +# define ASN1_R_EXPECTING_AN_INTEGER 115 +# define ASN1_R_EXPECTING_AN_OBJECT 116 +# define ASN1_R_EXPLICIT_LENGTH_MISMATCH 119 +# define ASN1_R_EXPLICIT_TAG_NOT_CONSTRUCTED 120 +# define ASN1_R_FIELD_MISSING 121 +# define ASN1_R_FIRST_NUM_TOO_LARGE 122 +# define ASN1_R_HEADER_TOO_LONG 123 +# define ASN1_R_ILLEGAL_BITSTRING_FORMAT 175 +# define ASN1_R_ILLEGAL_BOOLEAN 176 +# define ASN1_R_ILLEGAL_CHARACTERS 124 +# define ASN1_R_ILLEGAL_FORMAT 177 +# define ASN1_R_ILLEGAL_HEX 178 +# define ASN1_R_ILLEGAL_IMPLICIT_TAG 179 +# define ASN1_R_ILLEGAL_INTEGER 180 +# define ASN1_R_ILLEGAL_NEGATIVE_VALUE 226 +# define ASN1_R_ILLEGAL_NESTED_TAGGING 181 +# define ASN1_R_ILLEGAL_NULL 125 +# define ASN1_R_ILLEGAL_NULL_VALUE 182 +# define ASN1_R_ILLEGAL_OBJECT 183 +# define ASN1_R_ILLEGAL_OPTIONAL_ANY 126 +# define ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE 170 +# define ASN1_R_ILLEGAL_PADDING 221 +# define ASN1_R_ILLEGAL_TAGGED_ANY 127 +# define ASN1_R_ILLEGAL_TIME_VALUE 184 +# define ASN1_R_ILLEGAL_ZERO_CONTENT 222 +# define ASN1_R_INTEGER_NOT_ASCII_FORMAT 185 +# define ASN1_R_INTEGER_TOO_LARGE_FOR_LONG 128 +# define ASN1_R_INVALID_BIT_STRING_BITS_LEFT 220 +# define ASN1_R_INVALID_BMPSTRING_LENGTH 129 +# define ASN1_R_INVALID_DIGIT 130 +# define ASN1_R_INVALID_MIME_TYPE 205 +# define ASN1_R_INVALID_MODIFIER 186 +# define ASN1_R_INVALID_NUMBER 187 +# define ASN1_R_INVALID_OBJECT_ENCODING 216 +# define ASN1_R_INVALID_SCRYPT_PARAMETERS 227 +# define ASN1_R_INVALID_SEPARATOR 131 +# define ASN1_R_INVALID_STRING_TABLE_VALUE 218 +# define ASN1_R_INVALID_UNIVERSALSTRING_LENGTH 133 +# define ASN1_R_INVALID_UTF8STRING 134 +# define ASN1_R_INVALID_VALUE 219 +# define ASN1_R_LIST_ERROR 188 +# define ASN1_R_MIME_NO_CONTENT_TYPE 206 +# define ASN1_R_MIME_PARSE_ERROR 207 +# define ASN1_R_MIME_SIG_PARSE_ERROR 208 +# define ASN1_R_MISSING_EOC 137 +# define ASN1_R_MISSING_SECOND_NUMBER 138 +# define ASN1_R_MISSING_VALUE 189 +# define ASN1_R_MSTRING_NOT_UNIVERSAL 139 +# define ASN1_R_MSTRING_WRONG_TAG 140 +# define ASN1_R_NESTED_ASN1_STRING 197 +# define ASN1_R_NESTED_TOO_DEEP 201 +# define ASN1_R_NON_HEX_CHARACTERS 141 +# define ASN1_R_NOT_ASCII_FORMAT 190 +# define ASN1_R_NOT_ENOUGH_DATA 142 +# define ASN1_R_NO_CONTENT_TYPE 209 +# define ASN1_R_NO_MATCHING_CHOICE_TYPE 143 +# define ASN1_R_NO_MULTIPART_BODY_FAILURE 210 +# define ASN1_R_NO_MULTIPART_BOUNDARY 211 +# define ASN1_R_NO_SIG_CONTENT_TYPE 212 +# define ASN1_R_NULL_IS_WRONG_LENGTH 144 +# define ASN1_R_OBJECT_NOT_ASCII_FORMAT 191 +# define ASN1_R_ODD_NUMBER_OF_CHARS 145 +# define ASN1_R_SECOND_NUMBER_TOO_LARGE 147 +# define ASN1_R_SEQUENCE_LENGTH_MISMATCH 148 +# define ASN1_R_SEQUENCE_NOT_CONSTRUCTED 149 +# define ASN1_R_SEQUENCE_OR_SET_NEEDS_CONFIG 192 +# define ASN1_R_SHORT_LINE 150 +# define ASN1_R_SIG_INVALID_MIME_TYPE 213 +# define ASN1_R_STREAMING_NOT_SUPPORTED 202 +# define ASN1_R_STRING_TOO_LONG 151 +# define ASN1_R_STRING_TOO_SHORT 152 +# define ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 154 +# define ASN1_R_TIME_NOT_ASCII_FORMAT 193 +# define ASN1_R_TOO_LARGE 223 +# define ASN1_R_TOO_LONG 155 +# define ASN1_R_TOO_SMALL 224 +# define ASN1_R_TYPE_NOT_CONSTRUCTED 156 +# define ASN1_R_TYPE_NOT_PRIMITIVE 195 +# define ASN1_R_UNEXPECTED_EOC 159 +# define ASN1_R_UNIVERSALSTRING_IS_WRONG_LENGTH 215 +# define ASN1_R_UNKNOWN_FORMAT 160 +# define ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM 161 +# define ASN1_R_UNKNOWN_OBJECT_TYPE 162 +# define ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE 163 +# define ASN1_R_UNKNOWN_SIGNATURE_ALGORITHM 199 +# define ASN1_R_UNKNOWN_TAG 194 +# define ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE 164 +# define ASN1_R_UNSUPPORTED_CIPHER 228 +# define ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE 167 +# define ASN1_R_UNSUPPORTED_TYPE 196 +# define ASN1_R_WRONG_INTEGER_TYPE 225 +# define ASN1_R_WRONG_PUBLIC_KEY_TYPE 200 +# define ASN1_R_WRONG_TAG 168 + +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/asn1t.h b/MediaClient/MediaClient/openssl/include/openssl/asn1t.h new file mode 100644 index 0000000..a450ba0 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/asn1t.h @@ -0,0 +1,945 @@ +/* + * Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_ASN1T_H +# define HEADER_ASN1T_H + +# include +# include +# include + +# ifdef OPENSSL_BUILD_SHLIBCRYPTO +# undef OPENSSL_EXTERN +# define OPENSSL_EXTERN OPENSSL_EXPORT +# endif + +/* ASN1 template defines, structures and functions */ + +#ifdef __cplusplus +extern "C" { +#endif + +# ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION + +/* Macro to obtain ASN1_ADB pointer from a type (only used internally) */ +# define ASN1_ADB_ptr(iptr) ((const ASN1_ADB *)(iptr)) + +/* Macros for start and end of ASN1_ITEM definition */ + +# define ASN1_ITEM_start(itname) \ + const ASN1_ITEM itname##_it = { + +# define static_ASN1_ITEM_start(itname) \ + static const ASN1_ITEM itname##_it = { + +# define ASN1_ITEM_end(itname) \ + }; + +# else + +/* Macro to obtain ASN1_ADB pointer from a type (only used internally) */ +# define ASN1_ADB_ptr(iptr) ((const ASN1_ADB *)((iptr)())) + +/* Macros for start and end of ASN1_ITEM definition */ + +# define ASN1_ITEM_start(itname) \ + const ASN1_ITEM * itname##_it(void) \ + { \ + static const ASN1_ITEM local_it = { + +# define static_ASN1_ITEM_start(itname) \ + static ASN1_ITEM_start(itname) + +# define ASN1_ITEM_end(itname) \ + }; \ + return &local_it; \ + } + +# endif + +/* Macros to aid ASN1 template writing */ + +# define ASN1_ITEM_TEMPLATE(tname) \ + static const ASN1_TEMPLATE tname##_item_tt + +# define ASN1_ITEM_TEMPLATE_END(tname) \ + ;\ + ASN1_ITEM_start(tname) \ + ASN1_ITYPE_PRIMITIVE,\ + -1,\ + &tname##_item_tt,\ + 0,\ + NULL,\ + 0,\ + #tname \ + ASN1_ITEM_end(tname) +# define static_ASN1_ITEM_TEMPLATE_END(tname) \ + ;\ + static_ASN1_ITEM_start(tname) \ + ASN1_ITYPE_PRIMITIVE,\ + -1,\ + &tname##_item_tt,\ + 0,\ + NULL,\ + 0,\ + #tname \ + ASN1_ITEM_end(tname) + +/* This is a ASN1 type which just embeds a template */ + +/*- + * This pair helps declare a SEQUENCE. We can do: + * + * ASN1_SEQUENCE(stname) = { + * ... SEQUENCE components ... + * } ASN1_SEQUENCE_END(stname) + * + * This will produce an ASN1_ITEM called stname_it + * for a structure called stname. + * + * If you want the same structure but a different + * name then use: + * + * ASN1_SEQUENCE(itname) = { + * ... SEQUENCE components ... + * } ASN1_SEQUENCE_END_name(stname, itname) + * + * This will create an item called itname_it using + * a structure called stname. + */ + +# define ASN1_SEQUENCE(tname) \ + static const ASN1_TEMPLATE tname##_seq_tt[] + +# define ASN1_SEQUENCE_END(stname) ASN1_SEQUENCE_END_name(stname, stname) + +# define static_ASN1_SEQUENCE_END(stname) static_ASN1_SEQUENCE_END_name(stname, stname) + +# define ASN1_SEQUENCE_END_name(stname, tname) \ + ;\ + ASN1_ITEM_start(tname) \ + ASN1_ITYPE_SEQUENCE,\ + V_ASN1_SEQUENCE,\ + tname##_seq_tt,\ + sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ + NULL,\ + sizeof(stname),\ + #tname \ + ASN1_ITEM_end(tname) + +# define static_ASN1_SEQUENCE_END_name(stname, tname) \ + ;\ + static_ASN1_ITEM_start(tname) \ + ASN1_ITYPE_SEQUENCE,\ + V_ASN1_SEQUENCE,\ + tname##_seq_tt,\ + sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ + NULL,\ + sizeof(stname),\ + #stname \ + ASN1_ITEM_end(tname) + +# define ASN1_NDEF_SEQUENCE(tname) \ + ASN1_SEQUENCE(tname) + +# define ASN1_NDEF_SEQUENCE_cb(tname, cb) \ + ASN1_SEQUENCE_cb(tname, cb) + +# define ASN1_SEQUENCE_cb(tname, cb) \ + static const ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0}; \ + ASN1_SEQUENCE(tname) + +# define ASN1_BROKEN_SEQUENCE(tname) \ + static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_BROKEN, 0, 0, 0, 0}; \ + ASN1_SEQUENCE(tname) + +# define ASN1_SEQUENCE_ref(tname, cb) \ + static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_REFCOUNT, offsetof(tname, references), offsetof(tname, lock), cb, 0}; \ + ASN1_SEQUENCE(tname) + +# define ASN1_SEQUENCE_enc(tname, enc, cb) \ + static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_ENCODING, 0, 0, cb, offsetof(tname, enc)}; \ + ASN1_SEQUENCE(tname) + +# define ASN1_NDEF_SEQUENCE_END(tname) \ + ;\ + ASN1_ITEM_start(tname) \ + ASN1_ITYPE_NDEF_SEQUENCE,\ + V_ASN1_SEQUENCE,\ + tname##_seq_tt,\ + sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ + NULL,\ + sizeof(tname),\ + #tname \ + ASN1_ITEM_end(tname) +# define static_ASN1_NDEF_SEQUENCE_END(tname) \ + ;\ + static_ASN1_ITEM_start(tname) \ + ASN1_ITYPE_NDEF_SEQUENCE,\ + V_ASN1_SEQUENCE,\ + tname##_seq_tt,\ + sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ + NULL,\ + sizeof(tname),\ + #tname \ + ASN1_ITEM_end(tname) + +# define ASN1_BROKEN_SEQUENCE_END(stname) ASN1_SEQUENCE_END_ref(stname, stname) +# define static_ASN1_BROKEN_SEQUENCE_END(stname) \ + static_ASN1_SEQUENCE_END_ref(stname, stname) + +# define ASN1_SEQUENCE_END_enc(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname) + +# define ASN1_SEQUENCE_END_cb(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname) +# define static_ASN1_SEQUENCE_END_cb(stname, tname) static_ASN1_SEQUENCE_END_ref(stname, tname) + +# define ASN1_SEQUENCE_END_ref(stname, tname) \ + ;\ + ASN1_ITEM_start(tname) \ + ASN1_ITYPE_SEQUENCE,\ + V_ASN1_SEQUENCE,\ + tname##_seq_tt,\ + sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ + &tname##_aux,\ + sizeof(stname),\ + #tname \ + ASN1_ITEM_end(tname) +# define static_ASN1_SEQUENCE_END_ref(stname, tname) \ + ;\ + static_ASN1_ITEM_start(tname) \ + ASN1_ITYPE_SEQUENCE,\ + V_ASN1_SEQUENCE,\ + tname##_seq_tt,\ + sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ + &tname##_aux,\ + sizeof(stname),\ + #stname \ + ASN1_ITEM_end(tname) + +# define ASN1_NDEF_SEQUENCE_END_cb(stname, tname) \ + ;\ + ASN1_ITEM_start(tname) \ + ASN1_ITYPE_NDEF_SEQUENCE,\ + V_ASN1_SEQUENCE,\ + tname##_seq_tt,\ + sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ + &tname##_aux,\ + sizeof(stname),\ + #stname \ + ASN1_ITEM_end(tname) + +/*- + * This pair helps declare a CHOICE type. We can do: + * + * ASN1_CHOICE(chname) = { + * ... CHOICE options ... + * ASN1_CHOICE_END(chname) + * + * This will produce an ASN1_ITEM called chname_it + * for a structure called chname. The structure + * definition must look like this: + * typedef struct { + * int type; + * union { + * ASN1_SOMETHING *opt1; + * ASN1_SOMEOTHER *opt2; + * } value; + * } chname; + * + * the name of the selector must be 'type'. + * to use an alternative selector name use the + * ASN1_CHOICE_END_selector() version. + */ + +# define ASN1_CHOICE(tname) \ + static const ASN1_TEMPLATE tname##_ch_tt[] + +# define ASN1_CHOICE_cb(tname, cb) \ + static const ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0}; \ + ASN1_CHOICE(tname) + +# define ASN1_CHOICE_END(stname) ASN1_CHOICE_END_name(stname, stname) + +# define static_ASN1_CHOICE_END(stname) static_ASN1_CHOICE_END_name(stname, stname) + +# define ASN1_CHOICE_END_name(stname, tname) ASN1_CHOICE_END_selector(stname, tname, type) + +# define static_ASN1_CHOICE_END_name(stname, tname) static_ASN1_CHOICE_END_selector(stname, tname, type) + +# define ASN1_CHOICE_END_selector(stname, tname, selname) \ + ;\ + ASN1_ITEM_start(tname) \ + ASN1_ITYPE_CHOICE,\ + offsetof(stname,selname) ,\ + tname##_ch_tt,\ + sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\ + NULL,\ + sizeof(stname),\ + #stname \ + ASN1_ITEM_end(tname) + +# define static_ASN1_CHOICE_END_selector(stname, tname, selname) \ + ;\ + static_ASN1_ITEM_start(tname) \ + ASN1_ITYPE_CHOICE,\ + offsetof(stname,selname) ,\ + tname##_ch_tt,\ + sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\ + NULL,\ + sizeof(stname),\ + #stname \ + ASN1_ITEM_end(tname) + +# define ASN1_CHOICE_END_cb(stname, tname, selname) \ + ;\ + ASN1_ITEM_start(tname) \ + ASN1_ITYPE_CHOICE,\ + offsetof(stname,selname) ,\ + tname##_ch_tt,\ + sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\ + &tname##_aux,\ + sizeof(stname),\ + #stname \ + ASN1_ITEM_end(tname) + +/* This helps with the template wrapper form of ASN1_ITEM */ + +# define ASN1_EX_TEMPLATE_TYPE(flags, tag, name, type) { \ + (flags), (tag), 0,\ + #name, ASN1_ITEM_ref(type) } + +/* These help with SEQUENCE or CHOICE components */ + +/* used to declare other types */ + +# define ASN1_EX_TYPE(flags, tag, stname, field, type) { \ + (flags), (tag), offsetof(stname, field),\ + #field, ASN1_ITEM_ref(type) } + +/* implicit and explicit helper macros */ + +# define ASN1_IMP_EX(stname, field, type, tag, ex) \ + ASN1_EX_TYPE(ASN1_TFLG_IMPLICIT | (ex), tag, stname, field, type) + +# define ASN1_EXP_EX(stname, field, type, tag, ex) \ + ASN1_EX_TYPE(ASN1_TFLG_EXPLICIT | (ex), tag, stname, field, type) + +/* Any defined by macros: the field used is in the table itself */ + +# ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION +# define ASN1_ADB_OBJECT(tblname) { ASN1_TFLG_ADB_OID, -1, 0, #tblname, (const ASN1_ITEM *)&(tblname##_adb) } +# define ASN1_ADB_INTEGER(tblname) { ASN1_TFLG_ADB_INT, -1, 0, #tblname, (const ASN1_ITEM *)&(tblname##_adb) } +# else +# define ASN1_ADB_OBJECT(tblname) { ASN1_TFLG_ADB_OID, -1, 0, #tblname, tblname##_adb } +# define ASN1_ADB_INTEGER(tblname) { ASN1_TFLG_ADB_INT, -1, 0, #tblname, tblname##_adb } +# endif +/* Plain simple type */ +# define ASN1_SIMPLE(stname, field, type) ASN1_EX_TYPE(0,0, stname, field, type) +/* Embedded simple type */ +# define ASN1_EMBED(stname, field, type) ASN1_EX_TYPE(ASN1_TFLG_EMBED,0, stname, field, type) + +/* OPTIONAL simple type */ +# define ASN1_OPT(stname, field, type) ASN1_EX_TYPE(ASN1_TFLG_OPTIONAL, 0, stname, field, type) +# define ASN1_OPT_EMBED(stname, field, type) ASN1_EX_TYPE(ASN1_TFLG_OPTIONAL|ASN1_TFLG_EMBED, 0, stname, field, type) + +/* IMPLICIT tagged simple type */ +# define ASN1_IMP(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, 0) +# define ASN1_IMP_EMBED(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_EMBED) + +/* IMPLICIT tagged OPTIONAL simple type */ +# define ASN1_IMP_OPT(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL) +# define ASN1_IMP_OPT_EMBED(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL|ASN1_TFLG_EMBED) + +/* Same as above but EXPLICIT */ + +# define ASN1_EXP(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, 0) +# define ASN1_EXP_EMBED(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_EMBED) +# define ASN1_EXP_OPT(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL) +# define ASN1_EXP_OPT_EMBED(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL|ASN1_TFLG_EMBED) + +/* SEQUENCE OF type */ +# define ASN1_SEQUENCE_OF(stname, field, type) \ + ASN1_EX_TYPE(ASN1_TFLG_SEQUENCE_OF, 0, stname, field, type) + +/* OPTIONAL SEQUENCE OF */ +# define ASN1_SEQUENCE_OF_OPT(stname, field, type) \ + ASN1_EX_TYPE(ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL, 0, stname, field, type) + +/* Same as above but for SET OF */ + +# define ASN1_SET_OF(stname, field, type) \ + ASN1_EX_TYPE(ASN1_TFLG_SET_OF, 0, stname, field, type) + +# define ASN1_SET_OF_OPT(stname, field, type) \ + ASN1_EX_TYPE(ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL, 0, stname, field, type) + +/* Finally compound types of SEQUENCE, SET, IMPLICIT, EXPLICIT and OPTIONAL */ + +# define ASN1_IMP_SET_OF(stname, field, type, tag) \ + ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF) + +# define ASN1_EXP_SET_OF(stname, field, type, tag) \ + ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF) + +# define ASN1_IMP_SET_OF_OPT(stname, field, type, tag) \ + ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL) + +# define ASN1_EXP_SET_OF_OPT(stname, field, type, tag) \ + ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL) + +# define ASN1_IMP_SEQUENCE_OF(stname, field, type, tag) \ + ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF) + +# define ASN1_IMP_SEQUENCE_OF_OPT(stname, field, type, tag) \ + ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL) + +# define ASN1_EXP_SEQUENCE_OF(stname, field, type, tag) \ + ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF) + +# define ASN1_EXP_SEQUENCE_OF_OPT(stname, field, type, tag) \ + ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL) + +/* EXPLICIT using indefinite length constructed form */ +# define ASN1_NDEF_EXP(stname, field, type, tag) \ + ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_NDEF) + +/* EXPLICIT OPTIONAL using indefinite length constructed form */ +# define ASN1_NDEF_EXP_OPT(stname, field, type, tag) \ + ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL|ASN1_TFLG_NDEF) + +/* Macros for the ASN1_ADB structure */ + +# define ASN1_ADB(name) \ + static const ASN1_ADB_TABLE name##_adbtbl[] + +# ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION + +# define ASN1_ADB_END(name, flags, field, adb_cb, def, none) \ + ;\ + static const ASN1_ADB name##_adb = {\ + flags,\ + offsetof(name, field),\ + adb_cb,\ + name##_adbtbl,\ + sizeof(name##_adbtbl) / sizeof(ASN1_ADB_TABLE),\ + def,\ + none\ + } + +# else + +# define ASN1_ADB_END(name, flags, field, adb_cb, def, none) \ + ;\ + static const ASN1_ITEM *name##_adb(void) \ + { \ + static const ASN1_ADB internal_adb = \ + {\ + flags,\ + offsetof(name, field),\ + adb_cb,\ + name##_adbtbl,\ + sizeof(name##_adbtbl) / sizeof(ASN1_ADB_TABLE),\ + def,\ + none\ + }; \ + return (const ASN1_ITEM *) &internal_adb; \ + } \ + void dummy_function(void) + +# endif + +# define ADB_ENTRY(val, template) {val, template} + +# define ASN1_ADB_TEMPLATE(name) \ + static const ASN1_TEMPLATE name##_tt + +/* + * This is the ASN1 template structure that defines a wrapper round the + * actual type. It determines the actual position of the field in the value + * structure, various flags such as OPTIONAL and the field name. + */ + +struct ASN1_TEMPLATE_st { + unsigned long flags; /* Various flags */ + long tag; /* tag, not used if no tagging */ + unsigned long offset; /* Offset of this field in structure */ + const char *field_name; /* Field name */ + ASN1_ITEM_EXP *item; /* Relevant ASN1_ITEM or ASN1_ADB */ +}; + +/* Macro to extract ASN1_ITEM and ASN1_ADB pointer from ASN1_TEMPLATE */ + +# define ASN1_TEMPLATE_item(t) (t->item_ptr) +# define ASN1_TEMPLATE_adb(t) (t->item_ptr) + +typedef struct ASN1_ADB_TABLE_st ASN1_ADB_TABLE; +typedef struct ASN1_ADB_st ASN1_ADB; + +struct ASN1_ADB_st { + unsigned long flags; /* Various flags */ + unsigned long offset; /* Offset of selector field */ + int (*adb_cb)(long *psel); /* Application callback */ + const ASN1_ADB_TABLE *tbl; /* Table of possible types */ + long tblcount; /* Number of entries in tbl */ + const ASN1_TEMPLATE *default_tt; /* Type to use if no match */ + const ASN1_TEMPLATE *null_tt; /* Type to use if selector is NULL */ +}; + +struct ASN1_ADB_TABLE_st { + long value; /* NID for an object or value for an int */ + const ASN1_TEMPLATE tt; /* item for this value */ +}; + +/* template flags */ + +/* Field is optional */ +# define ASN1_TFLG_OPTIONAL (0x1) + +/* Field is a SET OF */ +# define ASN1_TFLG_SET_OF (0x1 << 1) + +/* Field is a SEQUENCE OF */ +# define ASN1_TFLG_SEQUENCE_OF (0x2 << 1) + +/* + * Special case: this refers to a SET OF that will be sorted into DER order + * when encoded *and* the corresponding STACK will be modified to match the + * new order. + */ +# define ASN1_TFLG_SET_ORDER (0x3 << 1) + +/* Mask for SET OF or SEQUENCE OF */ +# define ASN1_TFLG_SK_MASK (0x3 << 1) + +/* + * These flags mean the tag should be taken from the tag field. If EXPLICIT + * then the underlying type is used for the inner tag. + */ + +/* IMPLICIT tagging */ +# define ASN1_TFLG_IMPTAG (0x1 << 3) + +/* EXPLICIT tagging, inner tag from underlying type */ +# define ASN1_TFLG_EXPTAG (0x2 << 3) + +# define ASN1_TFLG_TAG_MASK (0x3 << 3) + +/* context specific IMPLICIT */ +# define ASN1_TFLG_IMPLICIT (ASN1_TFLG_IMPTAG|ASN1_TFLG_CONTEXT) + +/* context specific EXPLICIT */ +# define ASN1_TFLG_EXPLICIT (ASN1_TFLG_EXPTAG|ASN1_TFLG_CONTEXT) + +/* + * If tagging is in force these determine the type of tag to use. Otherwise + * the tag is determined by the underlying type. These values reflect the + * actual octet format. + */ + +/* Universal tag */ +# define ASN1_TFLG_UNIVERSAL (0x0<<6) +/* Application tag */ +# define ASN1_TFLG_APPLICATION (0x1<<6) +/* Context specific tag */ +# define ASN1_TFLG_CONTEXT (0x2<<6) +/* Private tag */ +# define ASN1_TFLG_PRIVATE (0x3<<6) + +# define ASN1_TFLG_TAG_CLASS (0x3<<6) + +/* + * These are for ANY DEFINED BY type. In this case the 'item' field points to + * an ASN1_ADB structure which contains a table of values to decode the + * relevant type + */ + +# define ASN1_TFLG_ADB_MASK (0x3<<8) + +# define ASN1_TFLG_ADB_OID (0x1<<8) + +# define ASN1_TFLG_ADB_INT (0x1<<9) + +/* + * This flag when present in a SEQUENCE OF, SET OF or EXPLICIT causes + * indefinite length constructed encoding to be used if required. + */ + +# define ASN1_TFLG_NDEF (0x1<<11) + +/* Field is embedded and not a pointer */ +# define ASN1_TFLG_EMBED (0x1 << 12) + +/* This is the actual ASN1 item itself */ + +struct ASN1_ITEM_st { + char itype; /* The item type, primitive, SEQUENCE, CHOICE + * or extern */ + long utype; /* underlying type */ + const ASN1_TEMPLATE *templates; /* If SEQUENCE or CHOICE this contains + * the contents */ + long tcount; /* Number of templates if SEQUENCE or CHOICE */ + const void *funcs; /* functions that handle this type */ + long size; /* Structure size (usually) */ + const char *sname; /* Structure name */ +}; + +/*- + * These are values for the itype field and + * determine how the type is interpreted. + * + * For PRIMITIVE types the underlying type + * determines the behaviour if items is NULL. + * + * Otherwise templates must contain a single + * template and the type is treated in the + * same way as the type specified in the template. + * + * For SEQUENCE types the templates field points + * to the members, the size field is the + * structure size. + * + * For CHOICE types the templates field points + * to each possible member (typically a union) + * and the 'size' field is the offset of the + * selector. + * + * The 'funcs' field is used for application + * specific functions. + * + * The EXTERN type uses a new style d2i/i2d. + * The new style should be used where possible + * because it avoids things like the d2i IMPLICIT + * hack. + * + * MSTRING is a multiple string type, it is used + * for a CHOICE of character strings where the + * actual strings all occupy an ASN1_STRING + * structure. In this case the 'utype' field + * has a special meaning, it is used as a mask + * of acceptable types using the B_ASN1 constants. + * + * NDEF_SEQUENCE is the same as SEQUENCE except + * that it will use indefinite length constructed + * encoding if requested. + * + */ + +# define ASN1_ITYPE_PRIMITIVE 0x0 + +# define ASN1_ITYPE_SEQUENCE 0x1 + +# define ASN1_ITYPE_CHOICE 0x2 + +# define ASN1_ITYPE_EXTERN 0x4 + +# define ASN1_ITYPE_MSTRING 0x5 + +# define ASN1_ITYPE_NDEF_SEQUENCE 0x6 + +/* + * Cache for ASN1 tag and length, so we don't keep re-reading it for things + * like CHOICE + */ + +struct ASN1_TLC_st { + char valid; /* Values below are valid */ + int ret; /* return value */ + long plen; /* length */ + int ptag; /* class value */ + int pclass; /* class value */ + int hdrlen; /* header length */ +}; + +/* Typedefs for ASN1 function pointers */ +typedef int ASN1_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, + const ASN1_ITEM *it, int tag, int aclass, char opt, + ASN1_TLC *ctx); + +typedef int ASN1_ex_i2d(ASN1_VALUE **pval, unsigned char **out, + const ASN1_ITEM *it, int tag, int aclass); +typedef int ASN1_ex_new_func(ASN1_VALUE **pval, const ASN1_ITEM *it); +typedef void ASN1_ex_free_func(ASN1_VALUE **pval, const ASN1_ITEM *it); + +typedef int ASN1_ex_print_func(BIO *out, ASN1_VALUE **pval, + int indent, const char *fname, + const ASN1_PCTX *pctx); + +typedef int ASN1_primitive_i2c(ASN1_VALUE **pval, unsigned char *cont, + int *putype, const ASN1_ITEM *it); +typedef int ASN1_primitive_c2i(ASN1_VALUE **pval, const unsigned char *cont, + int len, int utype, char *free_cont, + const ASN1_ITEM *it); +typedef int ASN1_primitive_print(BIO *out, ASN1_VALUE **pval, + const ASN1_ITEM *it, int indent, + const ASN1_PCTX *pctx); + +typedef struct ASN1_EXTERN_FUNCS_st { + void *app_data; + ASN1_ex_new_func *asn1_ex_new; + ASN1_ex_free_func *asn1_ex_free; + ASN1_ex_free_func *asn1_ex_clear; + ASN1_ex_d2i *asn1_ex_d2i; + ASN1_ex_i2d *asn1_ex_i2d; + ASN1_ex_print_func *asn1_ex_print; +} ASN1_EXTERN_FUNCS; + +typedef struct ASN1_PRIMITIVE_FUNCS_st { + void *app_data; + unsigned long flags; + ASN1_ex_new_func *prim_new; + ASN1_ex_free_func *prim_free; + ASN1_ex_free_func *prim_clear; + ASN1_primitive_c2i *prim_c2i; + ASN1_primitive_i2c *prim_i2c; + ASN1_primitive_print *prim_print; +} ASN1_PRIMITIVE_FUNCS; + +/* + * This is the ASN1_AUX structure: it handles various miscellaneous + * requirements. For example the use of reference counts and an informational + * callback. The "informational callback" is called at various points during + * the ASN1 encoding and decoding. It can be used to provide minor + * customisation of the structures used. This is most useful where the + * supplied routines *almost* do the right thing but need some extra help at + * a few points. If the callback returns zero then it is assumed a fatal + * error has occurred and the main operation should be abandoned. If major + * changes in the default behaviour are required then an external type is + * more appropriate. + */ + +typedef int ASN1_aux_cb(int operation, ASN1_VALUE **in, const ASN1_ITEM *it, + void *exarg); + +typedef struct ASN1_AUX_st { + void *app_data; + int flags; + int ref_offset; /* Offset of reference value */ + int ref_lock; /* Lock type to use */ + ASN1_aux_cb *asn1_cb; + int enc_offset; /* Offset of ASN1_ENCODING structure */ +} ASN1_AUX; + +/* For print related callbacks exarg points to this structure */ +typedef struct ASN1_PRINT_ARG_st { + BIO *out; + int indent; + const ASN1_PCTX *pctx; +} ASN1_PRINT_ARG; + +/* For streaming related callbacks exarg points to this structure */ +typedef struct ASN1_STREAM_ARG_st { + /* BIO to stream through */ + BIO *out; + /* BIO with filters appended */ + BIO *ndef_bio; + /* Streaming I/O boundary */ + unsigned char **boundary; +} ASN1_STREAM_ARG; + +/* Flags in ASN1_AUX */ + +/* Use a reference count */ +# define ASN1_AFLG_REFCOUNT 1 +/* Save the encoding of structure (useful for signatures) */ +# define ASN1_AFLG_ENCODING 2 +/* The Sequence length is invalid */ +# define ASN1_AFLG_BROKEN 4 + +/* operation values for asn1_cb */ + +# define ASN1_OP_NEW_PRE 0 +# define ASN1_OP_NEW_POST 1 +# define ASN1_OP_FREE_PRE 2 +# define ASN1_OP_FREE_POST 3 +# define ASN1_OP_D2I_PRE 4 +# define ASN1_OP_D2I_POST 5 +# define ASN1_OP_I2D_PRE 6 +# define ASN1_OP_I2D_POST 7 +# define ASN1_OP_PRINT_PRE 8 +# define ASN1_OP_PRINT_POST 9 +# define ASN1_OP_STREAM_PRE 10 +# define ASN1_OP_STREAM_POST 11 +# define ASN1_OP_DETACHED_PRE 12 +# define ASN1_OP_DETACHED_POST 13 + +/* Macro to implement a primitive type */ +# define IMPLEMENT_ASN1_TYPE(stname) IMPLEMENT_ASN1_TYPE_ex(stname, stname, 0) +# define IMPLEMENT_ASN1_TYPE_ex(itname, vname, ex) \ + ASN1_ITEM_start(itname) \ + ASN1_ITYPE_PRIMITIVE, V_##vname, NULL, 0, NULL, ex, #itname \ + ASN1_ITEM_end(itname) + +/* Macro to implement a multi string type */ +# define IMPLEMENT_ASN1_MSTRING(itname, mask) \ + ASN1_ITEM_start(itname) \ + ASN1_ITYPE_MSTRING, mask, NULL, 0, NULL, sizeof(ASN1_STRING), #itname \ + ASN1_ITEM_end(itname) + +# define IMPLEMENT_EXTERN_ASN1(sname, tag, fptrs) \ + ASN1_ITEM_start(sname) \ + ASN1_ITYPE_EXTERN, \ + tag, \ + NULL, \ + 0, \ + &fptrs, \ + 0, \ + #sname \ + ASN1_ITEM_end(sname) + +/* Macro to implement standard functions in terms of ASN1_ITEM structures */ + +# define IMPLEMENT_ASN1_FUNCTIONS(stname) IMPLEMENT_ASN1_FUNCTIONS_fname(stname, stname, stname) + +# define IMPLEMENT_ASN1_FUNCTIONS_name(stname, itname) IMPLEMENT_ASN1_FUNCTIONS_fname(stname, itname, itname) + +# define IMPLEMENT_ASN1_FUNCTIONS_ENCODE_name(stname, itname) \ + IMPLEMENT_ASN1_FUNCTIONS_ENCODE_fname(stname, itname, itname) + +# define IMPLEMENT_STATIC_ASN1_ALLOC_FUNCTIONS(stname) \ + IMPLEMENT_ASN1_ALLOC_FUNCTIONS_pfname(static, stname, stname, stname) + +# define IMPLEMENT_ASN1_ALLOC_FUNCTIONS(stname) \ + IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, stname, stname) + +# define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_pfname(pre, stname, itname, fname) \ + pre stname *fname##_new(void) \ + { \ + return (stname *)ASN1_item_new(ASN1_ITEM_rptr(itname)); \ + } \ + pre void fname##_free(stname *a) \ + { \ + ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \ + } + +# define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) \ + stname *fname##_new(void) \ + { \ + return (stname *)ASN1_item_new(ASN1_ITEM_rptr(itname)); \ + } \ + void fname##_free(stname *a) \ + { \ + ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \ + } + +# define IMPLEMENT_ASN1_FUNCTIONS_fname(stname, itname, fname) \ + IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname) \ + IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) + +# define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname) \ + stname *d2i_##fname(stname **a, const unsigned char **in, long len) \ + { \ + return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\ + } \ + int i2d_##fname(stname *a, unsigned char **out) \ + { \ + return ASN1_item_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\ + } + +# define IMPLEMENT_ASN1_NDEF_FUNCTION(stname) \ + int i2d_##stname##_NDEF(stname *a, unsigned char **out) \ + { \ + return ASN1_item_ndef_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(stname));\ + } + +# define IMPLEMENT_STATIC_ASN1_ENCODE_FUNCTIONS(stname) \ + static stname *d2i_##stname(stname **a, \ + const unsigned char **in, long len) \ + { \ + return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, \ + ASN1_ITEM_rptr(stname)); \ + } \ + static int i2d_##stname(stname *a, unsigned char **out) \ + { \ + return ASN1_item_i2d((ASN1_VALUE *)a, out, \ + ASN1_ITEM_rptr(stname)); \ + } + +/* + * This includes evil casts to remove const: they will go away when full ASN1 + * constification is done. + */ +# define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(stname, itname, fname) \ + stname *d2i_##fname(stname **a, const unsigned char **in, long len) \ + { \ + return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\ + } \ + int i2d_##fname(const stname *a, unsigned char **out) \ + { \ + return ASN1_item_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\ + } + +# define IMPLEMENT_ASN1_DUP_FUNCTION(stname) \ + stname * stname##_dup(stname *x) \ + { \ + return ASN1_item_dup(ASN1_ITEM_rptr(stname), x); \ + } + +# define IMPLEMENT_ASN1_PRINT_FUNCTION(stname) \ + IMPLEMENT_ASN1_PRINT_FUNCTION_fname(stname, stname, stname) + +# define IMPLEMENT_ASN1_PRINT_FUNCTION_fname(stname, itname, fname) \ + int fname##_print_ctx(BIO *out, stname *x, int indent, \ + const ASN1_PCTX *pctx) \ + { \ + return ASN1_item_print(out, (ASN1_VALUE *)x, indent, \ + ASN1_ITEM_rptr(itname), pctx); \ + } + +# define IMPLEMENT_ASN1_FUNCTIONS_const(name) \ + IMPLEMENT_ASN1_FUNCTIONS_const_fname(name, name, name) + +# define IMPLEMENT_ASN1_FUNCTIONS_const_fname(stname, itname, fname) \ + IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(stname, itname, fname) \ + IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) + +/* external definitions for primitive types */ + +DECLARE_ASN1_ITEM(ASN1_BOOLEAN) +DECLARE_ASN1_ITEM(ASN1_TBOOLEAN) +DECLARE_ASN1_ITEM(ASN1_FBOOLEAN) +DECLARE_ASN1_ITEM(ASN1_SEQUENCE) +DECLARE_ASN1_ITEM(CBIGNUM) +DECLARE_ASN1_ITEM(BIGNUM) +DECLARE_ASN1_ITEM(INT32) +DECLARE_ASN1_ITEM(ZINT32) +DECLARE_ASN1_ITEM(UINT32) +DECLARE_ASN1_ITEM(ZUINT32) +DECLARE_ASN1_ITEM(INT64) +DECLARE_ASN1_ITEM(ZINT64) +DECLARE_ASN1_ITEM(UINT64) +DECLARE_ASN1_ITEM(ZUINT64) + +# if OPENSSL_API_COMPAT < 0x10200000L +/* + * LONG and ZLONG are strongly discouraged for use as stored data, as the + * underlying C type (long) differs in size depending on the architecture. + * They are designed with 32-bit longs in mind. + */ +DECLARE_ASN1_ITEM(LONG) +DECLARE_ASN1_ITEM(ZLONG) +# endif + +DEFINE_STACK_OF(ASN1_VALUE) + +/* Functions used internally by the ASN1 code */ + +int ASN1_item_ex_new(ASN1_VALUE **pval, const ASN1_ITEM *it); +void ASN1_item_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it); + +int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, + const ASN1_ITEM *it, int tag, int aclass, char opt, + ASN1_TLC *ctx); + +int ASN1_item_ex_i2d(ASN1_VALUE **pval, unsigned char **out, + const ASN1_ITEM *it, int tag, int aclass); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/async.h b/MediaClient/MediaClient/openssl/include/openssl/async.h new file mode 100644 index 0000000..7052b89 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/async.h @@ -0,0 +1,76 @@ +/* + * Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#include + +#ifndef HEADER_ASYNC_H +# define HEADER_ASYNC_H + +#if defined(_WIN32) +# if defined(BASETYPES) || defined(_WINDEF_H) +/* application has to include to use this */ +#define OSSL_ASYNC_FD HANDLE +#define OSSL_BAD_ASYNC_FD INVALID_HANDLE_VALUE +# endif +#else +#define OSSL_ASYNC_FD int +#define OSSL_BAD_ASYNC_FD -1 +#endif +# include + + +# ifdef __cplusplus +extern "C" { +# endif + +typedef struct async_job_st ASYNC_JOB; +typedef struct async_wait_ctx_st ASYNC_WAIT_CTX; + +#define ASYNC_ERR 0 +#define ASYNC_NO_JOBS 1 +#define ASYNC_PAUSE 2 +#define ASYNC_FINISH 3 + +int ASYNC_init_thread(size_t max_size, size_t init_size); +void ASYNC_cleanup_thread(void); + +#ifdef OSSL_ASYNC_FD +ASYNC_WAIT_CTX *ASYNC_WAIT_CTX_new(void); +void ASYNC_WAIT_CTX_free(ASYNC_WAIT_CTX *ctx); +int ASYNC_WAIT_CTX_set_wait_fd(ASYNC_WAIT_CTX *ctx, const void *key, + OSSL_ASYNC_FD fd, + void *custom_data, + void (*cleanup)(ASYNC_WAIT_CTX *, const void *, + OSSL_ASYNC_FD, void *)); +int ASYNC_WAIT_CTX_get_fd(ASYNC_WAIT_CTX *ctx, const void *key, + OSSL_ASYNC_FD *fd, void **custom_data); +int ASYNC_WAIT_CTX_get_all_fds(ASYNC_WAIT_CTX *ctx, OSSL_ASYNC_FD *fd, + size_t *numfds); +int ASYNC_WAIT_CTX_get_changed_fds(ASYNC_WAIT_CTX *ctx, OSSL_ASYNC_FD *addfd, + size_t *numaddfds, OSSL_ASYNC_FD *delfd, + size_t *numdelfds); +int ASYNC_WAIT_CTX_clear_fd(ASYNC_WAIT_CTX *ctx, const void *key); +#endif + +int ASYNC_is_capable(void); + +int ASYNC_start_job(ASYNC_JOB **job, ASYNC_WAIT_CTX *ctx, int *ret, + int (*func)(void *), void *args, size_t size); +int ASYNC_pause_job(void); + +ASYNC_JOB *ASYNC_get_current_job(void); +ASYNC_WAIT_CTX *ASYNC_get_wait_ctx(ASYNC_JOB *job); +void ASYNC_block_pause(void); +void ASYNC_unblock_pause(void); + + +# ifdef __cplusplus +} +# endif +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/asyncerr.h b/MediaClient/MediaClient/openssl/include/openssl/asyncerr.h new file mode 100644 index 0000000..91afbbb --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/asyncerr.h @@ -0,0 +1,42 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_ASYNCERR_H +# define HEADER_ASYNCERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_ASYNC_strings(void); + +/* + * ASYNC function codes. + */ +# define ASYNC_F_ASYNC_CTX_NEW 100 +# define ASYNC_F_ASYNC_INIT_THREAD 101 +# define ASYNC_F_ASYNC_JOB_NEW 102 +# define ASYNC_F_ASYNC_PAUSE_JOB 103 +# define ASYNC_F_ASYNC_START_FUNC 104 +# define ASYNC_F_ASYNC_START_JOB 105 +# define ASYNC_F_ASYNC_WAIT_CTX_SET_WAIT_FD 106 + +/* + * ASYNC reason codes. + */ +# define ASYNC_R_FAILED_TO_SET_POOL 101 +# define ASYNC_R_FAILED_TO_SWAP_CONTEXT 102 +# define ASYNC_R_INIT_FAILED 105 +# define ASYNC_R_INVALID_POOL_SIZE 103 + +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/bio.h b/MediaClient/MediaClient/openssl/include/openssl/bio.h new file mode 100644 index 0000000..ae559a5 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/bio.h @@ -0,0 +1,801 @@ +/* + * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_BIO_H +# define HEADER_BIO_H + +# include + +# ifndef OPENSSL_NO_STDIO +# include +# endif +# include + +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + +/* There are the classes of BIOs */ +# define BIO_TYPE_DESCRIPTOR 0x0100 /* socket, fd, connect or accept */ +# define BIO_TYPE_FILTER 0x0200 +# define BIO_TYPE_SOURCE_SINK 0x0400 + +/* These are the 'types' of BIOs */ +# define BIO_TYPE_NONE 0 +# define BIO_TYPE_MEM ( 1|BIO_TYPE_SOURCE_SINK) +# define BIO_TYPE_FILE ( 2|BIO_TYPE_SOURCE_SINK) + +# define BIO_TYPE_FD ( 4|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR) +# define BIO_TYPE_SOCKET ( 5|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR) +# define BIO_TYPE_NULL ( 6|BIO_TYPE_SOURCE_SINK) +# define BIO_TYPE_SSL ( 7|BIO_TYPE_FILTER) +# define BIO_TYPE_MD ( 8|BIO_TYPE_FILTER) +# define BIO_TYPE_BUFFER ( 9|BIO_TYPE_FILTER) +# define BIO_TYPE_CIPHER (10|BIO_TYPE_FILTER) +# define BIO_TYPE_BASE64 (11|BIO_TYPE_FILTER) +# define BIO_TYPE_CONNECT (12|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR) +# define BIO_TYPE_ACCEPT (13|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR) + +# define BIO_TYPE_NBIO_TEST (16|BIO_TYPE_FILTER)/* server proxy BIO */ +# define BIO_TYPE_NULL_FILTER (17|BIO_TYPE_FILTER) +# define BIO_TYPE_BIO (19|BIO_TYPE_SOURCE_SINK)/* half a BIO pair */ +# define BIO_TYPE_LINEBUFFER (20|BIO_TYPE_FILTER) +# define BIO_TYPE_DGRAM (21|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR) +# define BIO_TYPE_ASN1 (22|BIO_TYPE_FILTER) +# define BIO_TYPE_COMP (23|BIO_TYPE_FILTER) +# ifndef OPENSSL_NO_SCTP +# define BIO_TYPE_DGRAM_SCTP (24|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR) +# endif + +#define BIO_TYPE_START 128 + +/* + * BIO_FILENAME_READ|BIO_CLOSE to open or close on free. + * BIO_set_fp(in,stdin,BIO_NOCLOSE); + */ +# define BIO_NOCLOSE 0x00 +# define BIO_CLOSE 0x01 + +/* + * These are used in the following macros and are passed to BIO_ctrl() + */ +# define BIO_CTRL_RESET 1/* opt - rewind/zero etc */ +# define BIO_CTRL_EOF 2/* opt - are we at the eof */ +# define BIO_CTRL_INFO 3/* opt - extra tit-bits */ +# define BIO_CTRL_SET 4/* man - set the 'IO' type */ +# define BIO_CTRL_GET 5/* man - get the 'IO' type */ +# define BIO_CTRL_PUSH 6/* opt - internal, used to signify change */ +# define BIO_CTRL_POP 7/* opt - internal, used to signify change */ +# define BIO_CTRL_GET_CLOSE 8/* man - set the 'close' on free */ +# define BIO_CTRL_SET_CLOSE 9/* man - set the 'close' on free */ +# define BIO_CTRL_PENDING 10/* opt - is their more data buffered */ +# define BIO_CTRL_FLUSH 11/* opt - 'flush' buffered output */ +# define BIO_CTRL_DUP 12/* man - extra stuff for 'duped' BIO */ +# define BIO_CTRL_WPENDING 13/* opt - number of bytes still to write */ +# define BIO_CTRL_SET_CALLBACK 14/* opt - set callback function */ +# define BIO_CTRL_GET_CALLBACK 15/* opt - set callback function */ + +# define BIO_CTRL_PEEK 29/* BIO_f_buffer special */ +# define BIO_CTRL_SET_FILENAME 30/* BIO_s_file special */ + +/* dgram BIO stuff */ +# define BIO_CTRL_DGRAM_CONNECT 31/* BIO dgram special */ +# define BIO_CTRL_DGRAM_SET_CONNECTED 32/* allow for an externally connected + * socket to be passed in */ +# define BIO_CTRL_DGRAM_SET_RECV_TIMEOUT 33/* setsockopt, essentially */ +# define BIO_CTRL_DGRAM_GET_RECV_TIMEOUT 34/* getsockopt, essentially */ +# define BIO_CTRL_DGRAM_SET_SEND_TIMEOUT 35/* setsockopt, essentially */ +# define BIO_CTRL_DGRAM_GET_SEND_TIMEOUT 36/* getsockopt, essentially */ + +# define BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP 37/* flag whether the last */ +# define BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP 38/* I/O operation tiemd out */ + +/* #ifdef IP_MTU_DISCOVER */ +# define BIO_CTRL_DGRAM_MTU_DISCOVER 39/* set DF bit on egress packets */ +/* #endif */ + +# define BIO_CTRL_DGRAM_QUERY_MTU 40/* as kernel for current MTU */ +# define BIO_CTRL_DGRAM_GET_FALLBACK_MTU 47 +# define BIO_CTRL_DGRAM_GET_MTU 41/* get cached value for MTU */ +# define BIO_CTRL_DGRAM_SET_MTU 42/* set cached value for MTU. + * want to use this if asking + * the kernel fails */ + +# define BIO_CTRL_DGRAM_MTU_EXCEEDED 43/* check whether the MTU was + * exceed in the previous write + * operation */ + +# define BIO_CTRL_DGRAM_GET_PEER 46 +# define BIO_CTRL_DGRAM_SET_PEER 44/* Destination for the data */ + +# define BIO_CTRL_DGRAM_SET_NEXT_TIMEOUT 45/* Next DTLS handshake timeout + * to adjust socket timeouts */ +# define BIO_CTRL_DGRAM_SET_DONT_FRAG 48 + +# define BIO_CTRL_DGRAM_GET_MTU_OVERHEAD 49 + +/* Deliberately outside of OPENSSL_NO_SCTP - used in bss_dgram.c */ +# define BIO_CTRL_DGRAM_SCTP_SET_IN_HANDSHAKE 50 +# ifndef OPENSSL_NO_SCTP +/* SCTP stuff */ +# define BIO_CTRL_DGRAM_SCTP_ADD_AUTH_KEY 51 +# define BIO_CTRL_DGRAM_SCTP_NEXT_AUTH_KEY 52 +# define BIO_CTRL_DGRAM_SCTP_AUTH_CCS_RCVD 53 +# define BIO_CTRL_DGRAM_SCTP_GET_SNDINFO 60 +# define BIO_CTRL_DGRAM_SCTP_SET_SNDINFO 61 +# define BIO_CTRL_DGRAM_SCTP_GET_RCVINFO 62 +# define BIO_CTRL_DGRAM_SCTP_SET_RCVINFO 63 +# define BIO_CTRL_DGRAM_SCTP_GET_PRINFO 64 +# define BIO_CTRL_DGRAM_SCTP_SET_PRINFO 65 +# define BIO_CTRL_DGRAM_SCTP_SAVE_SHUTDOWN 70 +# endif + +# define BIO_CTRL_DGRAM_SET_PEEK_MODE 71 + +/* modifiers */ +# define BIO_FP_READ 0x02 +# define BIO_FP_WRITE 0x04 +# define BIO_FP_APPEND 0x08 +# define BIO_FP_TEXT 0x10 + +# define BIO_FLAGS_READ 0x01 +# define BIO_FLAGS_WRITE 0x02 +# define BIO_FLAGS_IO_SPECIAL 0x04 +# define BIO_FLAGS_RWS (BIO_FLAGS_READ|BIO_FLAGS_WRITE|BIO_FLAGS_IO_SPECIAL) +# define BIO_FLAGS_SHOULD_RETRY 0x08 +# ifndef BIO_FLAGS_UPLINK +/* + * "UPLINK" flag denotes file descriptors provided by application. It + * defaults to 0, as most platforms don't require UPLINK interface. + */ +# define BIO_FLAGS_UPLINK 0 +# endif + +# define BIO_FLAGS_BASE64_NO_NL 0x100 + +/* + * This is used with memory BIOs: + * BIO_FLAGS_MEM_RDONLY means we shouldn't free up or change the data in any way; + * BIO_FLAGS_NONCLEAR_RST means we shouldn't clear data on reset. + */ +# define BIO_FLAGS_MEM_RDONLY 0x200 +# define BIO_FLAGS_NONCLEAR_RST 0x400 +# define BIO_FLAGS_IN_EOF 0x800 + +typedef union bio_addr_st BIO_ADDR; +typedef struct bio_addrinfo_st BIO_ADDRINFO; + +int BIO_get_new_index(void); +void BIO_set_flags(BIO *b, int flags); +int BIO_test_flags(const BIO *b, int flags); +void BIO_clear_flags(BIO *b, int flags); + +# define BIO_get_flags(b) BIO_test_flags(b, ~(0x0)) +# define BIO_set_retry_special(b) \ + BIO_set_flags(b, (BIO_FLAGS_IO_SPECIAL|BIO_FLAGS_SHOULD_RETRY)) +# define BIO_set_retry_read(b) \ + BIO_set_flags(b, (BIO_FLAGS_READ|BIO_FLAGS_SHOULD_RETRY)) +# define BIO_set_retry_write(b) \ + BIO_set_flags(b, (BIO_FLAGS_WRITE|BIO_FLAGS_SHOULD_RETRY)) + +/* These are normally used internally in BIOs */ +# define BIO_clear_retry_flags(b) \ + BIO_clear_flags(b, (BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY)) +# define BIO_get_retry_flags(b) \ + BIO_test_flags(b, (BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY)) + +/* These should be used by the application to tell why we should retry */ +# define BIO_should_read(a) BIO_test_flags(a, BIO_FLAGS_READ) +# define BIO_should_write(a) BIO_test_flags(a, BIO_FLAGS_WRITE) +# define BIO_should_io_special(a) BIO_test_flags(a, BIO_FLAGS_IO_SPECIAL) +# define BIO_retry_type(a) BIO_test_flags(a, BIO_FLAGS_RWS) +# define BIO_should_retry(a) BIO_test_flags(a, BIO_FLAGS_SHOULD_RETRY) + +/* + * The next three are used in conjunction with the BIO_should_io_special() + * condition. After this returns true, BIO *BIO_get_retry_BIO(BIO *bio, int + * *reason); will walk the BIO stack and return the 'reason' for the special + * and the offending BIO. Given a BIO, BIO_get_retry_reason(bio) will return + * the code. + */ +/* + * Returned from the SSL bio when the certificate retrieval code had an error + */ +# define BIO_RR_SSL_X509_LOOKUP 0x01 +/* Returned from the connect BIO when a connect would have blocked */ +# define BIO_RR_CONNECT 0x02 +/* Returned from the accept BIO when an accept would have blocked */ +# define BIO_RR_ACCEPT 0x03 + +/* These are passed by the BIO callback */ +# define BIO_CB_FREE 0x01 +# define BIO_CB_READ 0x02 +# define BIO_CB_WRITE 0x03 +# define BIO_CB_PUTS 0x04 +# define BIO_CB_GETS 0x05 +# define BIO_CB_CTRL 0x06 + +/* + * The callback is called before and after the underling operation, The + * BIO_CB_RETURN flag indicates if it is after the call + */ +# define BIO_CB_RETURN 0x80 +# define BIO_CB_return(a) ((a)|BIO_CB_RETURN) +# define BIO_cb_pre(a) (!((a)&BIO_CB_RETURN)) +# define BIO_cb_post(a) ((a)&BIO_CB_RETURN) + +typedef long (*BIO_callback_fn)(BIO *b, int oper, const char *argp, int argi, + long argl, long ret); +typedef long (*BIO_callback_fn_ex)(BIO *b, int oper, const char *argp, + size_t len, int argi, + long argl, int ret, size_t *processed); +BIO_callback_fn BIO_get_callback(const BIO *b); +void BIO_set_callback(BIO *b, BIO_callback_fn callback); + +BIO_callback_fn_ex BIO_get_callback_ex(const BIO *b); +void BIO_set_callback_ex(BIO *b, BIO_callback_fn_ex callback); + +char *BIO_get_callback_arg(const BIO *b); +void BIO_set_callback_arg(BIO *b, char *arg); + +typedef struct bio_method_st BIO_METHOD; + +const char *BIO_method_name(const BIO *b); +int BIO_method_type(const BIO *b); + +typedef int BIO_info_cb(BIO *, int, int); +typedef BIO_info_cb bio_info_cb; /* backward compatibility */ + +DEFINE_STACK_OF(BIO) + +/* Prefix and suffix callback in ASN1 BIO */ +typedef int asn1_ps_func (BIO *b, unsigned char **pbuf, int *plen, + void *parg); + +# ifndef OPENSSL_NO_SCTP +/* SCTP parameter structs */ +struct bio_dgram_sctp_sndinfo { + uint16_t snd_sid; + uint16_t snd_flags; + uint32_t snd_ppid; + uint32_t snd_context; +}; + +struct bio_dgram_sctp_rcvinfo { + uint16_t rcv_sid; + uint16_t rcv_ssn; + uint16_t rcv_flags; + uint32_t rcv_ppid; + uint32_t rcv_tsn; + uint32_t rcv_cumtsn; + uint32_t rcv_context; +}; + +struct bio_dgram_sctp_prinfo { + uint16_t pr_policy; + uint32_t pr_value; +}; +# endif + +/* + * #define BIO_CONN_get_param_hostname BIO_ctrl + */ + +# define BIO_C_SET_CONNECT 100 +# define BIO_C_DO_STATE_MACHINE 101 +# define BIO_C_SET_NBIO 102 +/* # define BIO_C_SET_PROXY_PARAM 103 */ +# define BIO_C_SET_FD 104 +# define BIO_C_GET_FD 105 +# define BIO_C_SET_FILE_PTR 106 +# define BIO_C_GET_FILE_PTR 107 +# define BIO_C_SET_FILENAME 108 +# define BIO_C_SET_SSL 109 +# define BIO_C_GET_SSL 110 +# define BIO_C_SET_MD 111 +# define BIO_C_GET_MD 112 +# define BIO_C_GET_CIPHER_STATUS 113 +# define BIO_C_SET_BUF_MEM 114 +# define BIO_C_GET_BUF_MEM_PTR 115 +# define BIO_C_GET_BUFF_NUM_LINES 116 +# define BIO_C_SET_BUFF_SIZE 117 +# define BIO_C_SET_ACCEPT 118 +# define BIO_C_SSL_MODE 119 +# define BIO_C_GET_MD_CTX 120 +/* # define BIO_C_GET_PROXY_PARAM 121 */ +# define BIO_C_SET_BUFF_READ_DATA 122/* data to read first */ +# define BIO_C_GET_CONNECT 123 +# define BIO_C_GET_ACCEPT 124 +# define BIO_C_SET_SSL_RENEGOTIATE_BYTES 125 +# define BIO_C_GET_SSL_NUM_RENEGOTIATES 126 +# define BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT 127 +# define BIO_C_FILE_SEEK 128 +# define BIO_C_GET_CIPHER_CTX 129 +# define BIO_C_SET_BUF_MEM_EOF_RETURN 130/* return end of input + * value */ +# define BIO_C_SET_BIND_MODE 131 +# define BIO_C_GET_BIND_MODE 132 +# define BIO_C_FILE_TELL 133 +# define BIO_C_GET_SOCKS 134 +# define BIO_C_SET_SOCKS 135 + +# define BIO_C_SET_WRITE_BUF_SIZE 136/* for BIO_s_bio */ +# define BIO_C_GET_WRITE_BUF_SIZE 137 +# define BIO_C_MAKE_BIO_PAIR 138 +# define BIO_C_DESTROY_BIO_PAIR 139 +# define BIO_C_GET_WRITE_GUARANTEE 140 +# define BIO_C_GET_READ_REQUEST 141 +# define BIO_C_SHUTDOWN_WR 142 +# define BIO_C_NREAD0 143 +# define BIO_C_NREAD 144 +# define BIO_C_NWRITE0 145 +# define BIO_C_NWRITE 146 +# define BIO_C_RESET_READ_REQUEST 147 +# define BIO_C_SET_MD_CTX 148 + +# define BIO_C_SET_PREFIX 149 +# define BIO_C_GET_PREFIX 150 +# define BIO_C_SET_SUFFIX 151 +# define BIO_C_GET_SUFFIX 152 + +# define BIO_C_SET_EX_ARG 153 +# define BIO_C_GET_EX_ARG 154 + +# define BIO_C_SET_CONNECT_MODE 155 + +# define BIO_set_app_data(s,arg) BIO_set_ex_data(s,0,arg) +# define BIO_get_app_data(s) BIO_get_ex_data(s,0) + +# define BIO_set_nbio(b,n) BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL) + +# ifndef OPENSSL_NO_SOCK +/* IP families we support, for BIO_s_connect() and BIO_s_accept() */ +/* Note: the underlying operating system may not support some of them */ +# define BIO_FAMILY_IPV4 4 +# define BIO_FAMILY_IPV6 6 +# define BIO_FAMILY_IPANY 256 + +/* BIO_s_connect() */ +# define BIO_set_conn_hostname(b,name) BIO_ctrl(b,BIO_C_SET_CONNECT,0, \ + (char *)(name)) +# define BIO_set_conn_port(b,port) BIO_ctrl(b,BIO_C_SET_CONNECT,1, \ + (char *)(port)) +# define BIO_set_conn_address(b,addr) BIO_ctrl(b,BIO_C_SET_CONNECT,2, \ + (char *)(addr)) +# define BIO_set_conn_ip_family(b,f) BIO_int_ctrl(b,BIO_C_SET_CONNECT,3,f) +# define BIO_get_conn_hostname(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,0)) +# define BIO_get_conn_port(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,1)) +# define BIO_get_conn_address(b) ((const BIO_ADDR *)BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,2)) +# define BIO_get_conn_ip_family(b) BIO_ctrl(b,BIO_C_GET_CONNECT,3,NULL) +# define BIO_set_conn_mode(b,n) BIO_ctrl(b,BIO_C_SET_CONNECT_MODE,(n),NULL) + +/* BIO_s_accept() */ +# define BIO_set_accept_name(b,name) BIO_ctrl(b,BIO_C_SET_ACCEPT,0, \ + (char *)(name)) +# define BIO_set_accept_port(b,port) BIO_ctrl(b,BIO_C_SET_ACCEPT,1, \ + (char *)(port)) +# define BIO_get_accept_name(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,0)) +# define BIO_get_accept_port(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,1)) +# define BIO_get_peer_name(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,2)) +# define BIO_get_peer_port(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,3)) +/* #define BIO_set_nbio(b,n) BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL) */ +# define BIO_set_nbio_accept(b,n) BIO_ctrl(b,BIO_C_SET_ACCEPT,2,(n)?(void *)"a":NULL) +# define BIO_set_accept_bios(b,bio) BIO_ctrl(b,BIO_C_SET_ACCEPT,3, \ + (char *)(bio)) +# define BIO_set_accept_ip_family(b,f) BIO_int_ctrl(b,BIO_C_SET_ACCEPT,4,f) +# define BIO_get_accept_ip_family(b) BIO_ctrl(b,BIO_C_GET_ACCEPT,4,NULL) + +/* Aliases kept for backward compatibility */ +# define BIO_BIND_NORMAL 0 +# define BIO_BIND_REUSEADDR BIO_SOCK_REUSEADDR +# define BIO_BIND_REUSEADDR_IF_UNUSED BIO_SOCK_REUSEADDR +# define BIO_set_bind_mode(b,mode) BIO_ctrl(b,BIO_C_SET_BIND_MODE,mode,NULL) +# define BIO_get_bind_mode(b) BIO_ctrl(b,BIO_C_GET_BIND_MODE,0,NULL) + +/* BIO_s_accept() and BIO_s_connect() */ +# define BIO_do_connect(b) BIO_do_handshake(b) +# define BIO_do_accept(b) BIO_do_handshake(b) +# endif /* OPENSSL_NO_SOCK */ + +# define BIO_do_handshake(b) BIO_ctrl(b,BIO_C_DO_STATE_MACHINE,0,NULL) + +/* BIO_s_datagram(), BIO_s_fd(), BIO_s_socket(), BIO_s_accept() and BIO_s_connect() */ +# define BIO_set_fd(b,fd,c) BIO_int_ctrl(b,BIO_C_SET_FD,c,fd) +# define BIO_get_fd(b,c) BIO_ctrl(b,BIO_C_GET_FD,0,(char *)(c)) + +/* BIO_s_file() */ +# define BIO_set_fp(b,fp,c) BIO_ctrl(b,BIO_C_SET_FILE_PTR,c,(char *)(fp)) +# define BIO_get_fp(b,fpp) BIO_ctrl(b,BIO_C_GET_FILE_PTR,0,(char *)(fpp)) + +/* BIO_s_fd() and BIO_s_file() */ +# define BIO_seek(b,ofs) (int)BIO_ctrl(b,BIO_C_FILE_SEEK,ofs,NULL) +# define BIO_tell(b) (int)BIO_ctrl(b,BIO_C_FILE_TELL,0,NULL) + +/* + * name is cast to lose const, but might be better to route through a + * function so we can do it safely + */ +# ifdef CONST_STRICT +/* + * If you are wondering why this isn't defined, its because CONST_STRICT is + * purely a compile-time kludge to allow const to be checked. + */ +int BIO_read_filename(BIO *b, const char *name); +# else +# define BIO_read_filename(b,name) (int)BIO_ctrl(b,BIO_C_SET_FILENAME, \ + BIO_CLOSE|BIO_FP_READ,(char *)(name)) +# endif +# define BIO_write_filename(b,name) (int)BIO_ctrl(b,BIO_C_SET_FILENAME, \ + BIO_CLOSE|BIO_FP_WRITE,name) +# define BIO_append_filename(b,name) (int)BIO_ctrl(b,BIO_C_SET_FILENAME, \ + BIO_CLOSE|BIO_FP_APPEND,name) +# define BIO_rw_filename(b,name) (int)BIO_ctrl(b,BIO_C_SET_FILENAME, \ + BIO_CLOSE|BIO_FP_READ|BIO_FP_WRITE,name) + +/* + * WARNING WARNING, this ups the reference count on the read bio of the SSL + * structure. This is because the ssl read BIO is now pointed to by the + * next_bio field in the bio. So when you free the BIO, make sure you are + * doing a BIO_free_all() to catch the underlying BIO. + */ +# define BIO_set_ssl(b,ssl,c) BIO_ctrl(b,BIO_C_SET_SSL,c,(char *)(ssl)) +# define BIO_get_ssl(b,sslp) BIO_ctrl(b,BIO_C_GET_SSL,0,(char *)(sslp)) +# define BIO_set_ssl_mode(b,client) BIO_ctrl(b,BIO_C_SSL_MODE,client,NULL) +# define BIO_set_ssl_renegotiate_bytes(b,num) \ + BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_BYTES,num,NULL) +# define BIO_get_num_renegotiates(b) \ + BIO_ctrl(b,BIO_C_GET_SSL_NUM_RENEGOTIATES,0,NULL) +# define BIO_set_ssl_renegotiate_timeout(b,seconds) \ + BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT,seconds,NULL) + +/* defined in evp.h */ +/* #define BIO_set_md(b,md) BIO_ctrl(b,BIO_C_SET_MD,1,(char *)(md)) */ + +# define BIO_get_mem_data(b,pp) BIO_ctrl(b,BIO_CTRL_INFO,0,(char *)(pp)) +# define BIO_set_mem_buf(b,bm,c) BIO_ctrl(b,BIO_C_SET_BUF_MEM,c,(char *)(bm)) +# define BIO_get_mem_ptr(b,pp) BIO_ctrl(b,BIO_C_GET_BUF_MEM_PTR,0, \ + (char *)(pp)) +# define BIO_set_mem_eof_return(b,v) \ + BIO_ctrl(b,BIO_C_SET_BUF_MEM_EOF_RETURN,v,NULL) + +/* For the BIO_f_buffer() type */ +# define BIO_get_buffer_num_lines(b) BIO_ctrl(b,BIO_C_GET_BUFF_NUM_LINES,0,NULL) +# define BIO_set_buffer_size(b,size) BIO_ctrl(b,BIO_C_SET_BUFF_SIZE,size,NULL) +# define BIO_set_read_buffer_size(b,size) BIO_int_ctrl(b,BIO_C_SET_BUFF_SIZE,size,0) +# define BIO_set_write_buffer_size(b,size) BIO_int_ctrl(b,BIO_C_SET_BUFF_SIZE,size,1) +# define BIO_set_buffer_read_data(b,buf,num) BIO_ctrl(b,BIO_C_SET_BUFF_READ_DATA,num,buf) + +/* Don't use the next one unless you know what you are doing :-) */ +# define BIO_dup_state(b,ret) BIO_ctrl(b,BIO_CTRL_DUP,0,(char *)(ret)) + +# define BIO_reset(b) (int)BIO_ctrl(b,BIO_CTRL_RESET,0,NULL) +# define BIO_eof(b) (int)BIO_ctrl(b,BIO_CTRL_EOF,0,NULL) +# define BIO_set_close(b,c) (int)BIO_ctrl(b,BIO_CTRL_SET_CLOSE,(c),NULL) +# define BIO_get_close(b) (int)BIO_ctrl(b,BIO_CTRL_GET_CLOSE,0,NULL) +# define BIO_pending(b) (int)BIO_ctrl(b,BIO_CTRL_PENDING,0,NULL) +# define BIO_wpending(b) (int)BIO_ctrl(b,BIO_CTRL_WPENDING,0,NULL) +/* ...pending macros have inappropriate return type */ +size_t BIO_ctrl_pending(BIO *b); +size_t BIO_ctrl_wpending(BIO *b); +# define BIO_flush(b) (int)BIO_ctrl(b,BIO_CTRL_FLUSH,0,NULL) +# define BIO_get_info_callback(b,cbp) (int)BIO_ctrl(b,BIO_CTRL_GET_CALLBACK,0, \ + cbp) +# define BIO_set_info_callback(b,cb) (int)BIO_callback_ctrl(b,BIO_CTRL_SET_CALLBACK,cb) + +/* For the BIO_f_buffer() type */ +# define BIO_buffer_get_num_lines(b) BIO_ctrl(b,BIO_CTRL_GET,0,NULL) +# define BIO_buffer_peek(b,s,l) BIO_ctrl(b,BIO_CTRL_PEEK,(l),(s)) + +/* For BIO_s_bio() */ +# define BIO_set_write_buf_size(b,size) (int)BIO_ctrl(b,BIO_C_SET_WRITE_BUF_SIZE,size,NULL) +# define BIO_get_write_buf_size(b,size) (size_t)BIO_ctrl(b,BIO_C_GET_WRITE_BUF_SIZE,size,NULL) +# define BIO_make_bio_pair(b1,b2) (int)BIO_ctrl(b1,BIO_C_MAKE_BIO_PAIR,0,b2) +# define BIO_destroy_bio_pair(b) (int)BIO_ctrl(b,BIO_C_DESTROY_BIO_PAIR,0,NULL) +# define BIO_shutdown_wr(b) (int)BIO_ctrl(b, BIO_C_SHUTDOWN_WR, 0, NULL) +/* macros with inappropriate type -- but ...pending macros use int too: */ +# define BIO_get_write_guarantee(b) (int)BIO_ctrl(b,BIO_C_GET_WRITE_GUARANTEE,0,NULL) +# define BIO_get_read_request(b) (int)BIO_ctrl(b,BIO_C_GET_READ_REQUEST,0,NULL) +size_t BIO_ctrl_get_write_guarantee(BIO *b); +size_t BIO_ctrl_get_read_request(BIO *b); +int BIO_ctrl_reset_read_request(BIO *b); + +/* ctrl macros for dgram */ +# define BIO_ctrl_dgram_connect(b,peer) \ + (int)BIO_ctrl(b,BIO_CTRL_DGRAM_CONNECT,0, (char *)(peer)) +# define BIO_ctrl_set_connected(b,peer) \ + (int)BIO_ctrl(b, BIO_CTRL_DGRAM_SET_CONNECTED, 0, (char *)(peer)) +# define BIO_dgram_recv_timedout(b) \ + (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP, 0, NULL) +# define BIO_dgram_send_timedout(b) \ + (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP, 0, NULL) +# define BIO_dgram_get_peer(b,peer) \ + (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_PEER, 0, (char *)(peer)) +# define BIO_dgram_set_peer(b,peer) \ + (int)BIO_ctrl(b, BIO_CTRL_DGRAM_SET_PEER, 0, (char *)(peer)) +# define BIO_dgram_get_mtu_overhead(b) \ + (unsigned int)BIO_ctrl((b), BIO_CTRL_DGRAM_GET_MTU_OVERHEAD, 0, NULL) + +#define BIO_get_ex_new_index(l, p, newf, dupf, freef) \ + CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_BIO, l, p, newf, dupf, freef) +int BIO_set_ex_data(BIO *bio, int idx, void *data); +void *BIO_get_ex_data(BIO *bio, int idx); +uint64_t BIO_number_read(BIO *bio); +uint64_t BIO_number_written(BIO *bio); + +/* For BIO_f_asn1() */ +int BIO_asn1_set_prefix(BIO *b, asn1_ps_func *prefix, + asn1_ps_func *prefix_free); +int BIO_asn1_get_prefix(BIO *b, asn1_ps_func **pprefix, + asn1_ps_func **pprefix_free); +int BIO_asn1_set_suffix(BIO *b, asn1_ps_func *suffix, + asn1_ps_func *suffix_free); +int BIO_asn1_get_suffix(BIO *b, asn1_ps_func **psuffix, + asn1_ps_func **psuffix_free); + +const BIO_METHOD *BIO_s_file(void); +BIO *BIO_new_file(const char *filename, const char *mode); +# ifndef OPENSSL_NO_STDIO +BIO *BIO_new_fp(FILE *stream, int close_flag); +# endif +BIO *BIO_new(const BIO_METHOD *type); +int BIO_free(BIO *a); +void BIO_set_data(BIO *a, void *ptr); +void *BIO_get_data(BIO *a); +void BIO_set_init(BIO *a, int init); +int BIO_get_init(BIO *a); +void BIO_set_shutdown(BIO *a, int shut); +int BIO_get_shutdown(BIO *a); +void BIO_vfree(BIO *a); +int BIO_up_ref(BIO *a); +int BIO_read(BIO *b, void *data, int dlen); +int BIO_read_ex(BIO *b, void *data, size_t dlen, size_t *readbytes); +int BIO_gets(BIO *bp, char *buf, int size); +int BIO_write(BIO *b, const void *data, int dlen); +int BIO_write_ex(BIO *b, const void *data, size_t dlen, size_t *written); +int BIO_puts(BIO *bp, const char *buf); +int BIO_indent(BIO *b, int indent, int max); +long BIO_ctrl(BIO *bp, int cmd, long larg, void *parg); +long BIO_callback_ctrl(BIO *b, int cmd, BIO_info_cb *fp); +void *BIO_ptr_ctrl(BIO *bp, int cmd, long larg); +long BIO_int_ctrl(BIO *bp, int cmd, long larg, int iarg); +BIO *BIO_push(BIO *b, BIO *append); +BIO *BIO_pop(BIO *b); +void BIO_free_all(BIO *a); +BIO *BIO_find_type(BIO *b, int bio_type); +BIO *BIO_next(BIO *b); +void BIO_set_next(BIO *b, BIO *next); +BIO *BIO_get_retry_BIO(BIO *bio, int *reason); +int BIO_get_retry_reason(BIO *bio); +void BIO_set_retry_reason(BIO *bio, int reason); +BIO *BIO_dup_chain(BIO *in); + +int BIO_nread0(BIO *bio, char **buf); +int BIO_nread(BIO *bio, char **buf, int num); +int BIO_nwrite0(BIO *bio, char **buf); +int BIO_nwrite(BIO *bio, char **buf, int num); + +long BIO_debug_callback(BIO *bio, int cmd, const char *argp, int argi, + long argl, long ret); + +const BIO_METHOD *BIO_s_mem(void); +const BIO_METHOD *BIO_s_secmem(void); +BIO *BIO_new_mem_buf(const void *buf, int len); +# ifndef OPENSSL_NO_SOCK +const BIO_METHOD *BIO_s_socket(void); +const BIO_METHOD *BIO_s_connect(void); +const BIO_METHOD *BIO_s_accept(void); +# endif +const BIO_METHOD *BIO_s_fd(void); +const BIO_METHOD *BIO_s_log(void); +const BIO_METHOD *BIO_s_bio(void); +const BIO_METHOD *BIO_s_null(void); +const BIO_METHOD *BIO_f_null(void); +const BIO_METHOD *BIO_f_buffer(void); +const BIO_METHOD *BIO_f_linebuffer(void); +const BIO_METHOD *BIO_f_nbio_test(void); +# ifndef OPENSSL_NO_DGRAM +const BIO_METHOD *BIO_s_datagram(void); +int BIO_dgram_non_fatal_error(int error); +BIO *BIO_new_dgram(int fd, int close_flag); +# ifndef OPENSSL_NO_SCTP +const BIO_METHOD *BIO_s_datagram_sctp(void); +BIO *BIO_new_dgram_sctp(int fd, int close_flag); +int BIO_dgram_is_sctp(BIO *bio); +int BIO_dgram_sctp_notification_cb(BIO *b, + void (*handle_notifications) (BIO *bio, + void *context, + void *buf), + void *context); +int BIO_dgram_sctp_wait_for_dry(BIO *b); +int BIO_dgram_sctp_msg_waiting(BIO *b); +# endif +# endif + +# ifndef OPENSSL_NO_SOCK +int BIO_sock_should_retry(int i); +int BIO_sock_non_fatal_error(int error); +# endif + +int BIO_fd_should_retry(int i); +int BIO_fd_non_fatal_error(int error); +int BIO_dump_cb(int (*cb) (const void *data, size_t len, void *u), + void *u, const char *s, int len); +int BIO_dump_indent_cb(int (*cb) (const void *data, size_t len, void *u), + void *u, const char *s, int len, int indent); +int BIO_dump(BIO *b, const char *bytes, int len); +int BIO_dump_indent(BIO *b, const char *bytes, int len, int indent); +# ifndef OPENSSL_NO_STDIO +int BIO_dump_fp(FILE *fp, const char *s, int len); +int BIO_dump_indent_fp(FILE *fp, const char *s, int len, int indent); +# endif +int BIO_hex_string(BIO *out, int indent, int width, unsigned char *data, + int datalen); + +# ifndef OPENSSL_NO_SOCK +BIO_ADDR *BIO_ADDR_new(void); +int BIO_ADDR_rawmake(BIO_ADDR *ap, int family, + const void *where, size_t wherelen, unsigned short port); +void BIO_ADDR_free(BIO_ADDR *); +void BIO_ADDR_clear(BIO_ADDR *ap); +int BIO_ADDR_family(const BIO_ADDR *ap); +int BIO_ADDR_rawaddress(const BIO_ADDR *ap, void *p, size_t *l); +unsigned short BIO_ADDR_rawport(const BIO_ADDR *ap); +char *BIO_ADDR_hostname_string(const BIO_ADDR *ap, int numeric); +char *BIO_ADDR_service_string(const BIO_ADDR *ap, int numeric); +char *BIO_ADDR_path_string(const BIO_ADDR *ap); + +const BIO_ADDRINFO *BIO_ADDRINFO_next(const BIO_ADDRINFO *bai); +int BIO_ADDRINFO_family(const BIO_ADDRINFO *bai); +int BIO_ADDRINFO_socktype(const BIO_ADDRINFO *bai); +int BIO_ADDRINFO_protocol(const BIO_ADDRINFO *bai); +const BIO_ADDR *BIO_ADDRINFO_address(const BIO_ADDRINFO *bai); +void BIO_ADDRINFO_free(BIO_ADDRINFO *bai); + +enum BIO_hostserv_priorities { + BIO_PARSE_PRIO_HOST, BIO_PARSE_PRIO_SERV +}; +int BIO_parse_hostserv(const char *hostserv, char **host, char **service, + enum BIO_hostserv_priorities hostserv_prio); +enum BIO_lookup_type { + BIO_LOOKUP_CLIENT, BIO_LOOKUP_SERVER +}; +int BIO_lookup(const char *host, const char *service, + enum BIO_lookup_type lookup_type, + int family, int socktype, BIO_ADDRINFO **res); +int BIO_lookup_ex(const char *host, const char *service, + int lookup_type, int family, int socktype, int protocol, + BIO_ADDRINFO **res); +int BIO_sock_error(int sock); +int BIO_socket_ioctl(int fd, long type, void *arg); +int BIO_socket_nbio(int fd, int mode); +int BIO_sock_init(void); +# if OPENSSL_API_COMPAT < 0x10100000L +# define BIO_sock_cleanup() while(0) continue +# endif +int BIO_set_tcp_ndelay(int sock, int turn_on); + +DEPRECATEDIN_1_1_0(struct hostent *BIO_gethostbyname(const char *name)) +DEPRECATEDIN_1_1_0(int BIO_get_port(const char *str, unsigned short *port_ptr)) +DEPRECATEDIN_1_1_0(int BIO_get_host_ip(const char *str, unsigned char *ip)) +DEPRECATEDIN_1_1_0(int BIO_get_accept_socket(char *host_port, int mode)) +DEPRECATEDIN_1_1_0(int BIO_accept(int sock, char **ip_port)) + +union BIO_sock_info_u { + BIO_ADDR *addr; +}; +enum BIO_sock_info_type { + BIO_SOCK_INFO_ADDRESS +}; +int BIO_sock_info(int sock, + enum BIO_sock_info_type type, union BIO_sock_info_u *info); + +# define BIO_SOCK_REUSEADDR 0x01 +# define BIO_SOCK_V6_ONLY 0x02 +# define BIO_SOCK_KEEPALIVE 0x04 +# define BIO_SOCK_NONBLOCK 0x08 +# define BIO_SOCK_NODELAY 0x10 + +int BIO_socket(int domain, int socktype, int protocol, int options); +int BIO_connect(int sock, const BIO_ADDR *addr, int options); +int BIO_bind(int sock, const BIO_ADDR *addr, int options); +int BIO_listen(int sock, const BIO_ADDR *addr, int options); +int BIO_accept_ex(int accept_sock, BIO_ADDR *addr, int options); +int BIO_closesocket(int sock); + +BIO *BIO_new_socket(int sock, int close_flag); +BIO *BIO_new_connect(const char *host_port); +BIO *BIO_new_accept(const char *host_port); +# endif /* OPENSSL_NO_SOCK*/ + +BIO *BIO_new_fd(int fd, int close_flag); + +int BIO_new_bio_pair(BIO **bio1, size_t writebuf1, + BIO **bio2, size_t writebuf2); +/* + * If successful, returns 1 and in *bio1, *bio2 two BIO pair endpoints. + * Otherwise returns 0 and sets *bio1 and *bio2 to NULL. Size 0 uses default + * value. + */ + +void BIO_copy_next_retry(BIO *b); + +/* + * long BIO_ghbn_ctrl(int cmd,int iarg,char *parg); + */ + +# define ossl_bio__attr__(x) +# if defined(__GNUC__) && defined(__STDC_VERSION__) \ + && !defined(__APPLE__) + /* + * Because we support the 'z' modifier, which made its appearance in C99, + * we can't use __attribute__ with pre C99 dialects. + */ +# if __STDC_VERSION__ >= 199901L +# undef ossl_bio__attr__ +# define ossl_bio__attr__ __attribute__ +# if __GNUC__*10 + __GNUC_MINOR__ >= 44 +# define ossl_bio__printf__ __gnu_printf__ +# else +# define ossl_bio__printf__ __printf__ +# endif +# endif +# endif +int BIO_printf(BIO *bio, const char *format, ...) +ossl_bio__attr__((__format__(ossl_bio__printf__, 2, 3))); +int BIO_vprintf(BIO *bio, const char *format, va_list args) +ossl_bio__attr__((__format__(ossl_bio__printf__, 2, 0))); +int BIO_snprintf(char *buf, size_t n, const char *format, ...) +ossl_bio__attr__((__format__(ossl_bio__printf__, 3, 4))); +int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args) +ossl_bio__attr__((__format__(ossl_bio__printf__, 3, 0))); +# undef ossl_bio__attr__ +# undef ossl_bio__printf__ + + +BIO_METHOD *BIO_meth_new(int type, const char *name); +void BIO_meth_free(BIO_METHOD *biom); +int (*BIO_meth_get_write(const BIO_METHOD *biom)) (BIO *, const char *, int); +int (*BIO_meth_get_write_ex(const BIO_METHOD *biom)) (BIO *, const char *, size_t, + size_t *); +int BIO_meth_set_write(BIO_METHOD *biom, + int (*write) (BIO *, const char *, int)); +int BIO_meth_set_write_ex(BIO_METHOD *biom, + int (*bwrite) (BIO *, const char *, size_t, size_t *)); +int (*BIO_meth_get_read(const BIO_METHOD *biom)) (BIO *, char *, int); +int (*BIO_meth_get_read_ex(const BIO_METHOD *biom)) (BIO *, char *, size_t, size_t *); +int BIO_meth_set_read(BIO_METHOD *biom, + int (*read) (BIO *, char *, int)); +int BIO_meth_set_read_ex(BIO_METHOD *biom, + int (*bread) (BIO *, char *, size_t, size_t *)); +int (*BIO_meth_get_puts(const BIO_METHOD *biom)) (BIO *, const char *); +int BIO_meth_set_puts(BIO_METHOD *biom, + int (*puts) (BIO *, const char *)); +int (*BIO_meth_get_gets(const BIO_METHOD *biom)) (BIO *, char *, int); +int BIO_meth_set_gets(BIO_METHOD *biom, + int (*gets) (BIO *, char *, int)); +long (*BIO_meth_get_ctrl(const BIO_METHOD *biom)) (BIO *, int, long, void *); +int BIO_meth_set_ctrl(BIO_METHOD *biom, + long (*ctrl) (BIO *, int, long, void *)); +int (*BIO_meth_get_create(const BIO_METHOD *bion)) (BIO *); +int BIO_meth_set_create(BIO_METHOD *biom, int (*create) (BIO *)); +int (*BIO_meth_get_destroy(const BIO_METHOD *biom)) (BIO *); +int BIO_meth_set_destroy(BIO_METHOD *biom, int (*destroy) (BIO *)); +long (*BIO_meth_get_callback_ctrl(const BIO_METHOD *biom)) + (BIO *, int, BIO_info_cb *); +int BIO_meth_set_callback_ctrl(BIO_METHOD *biom, + long (*callback_ctrl) (BIO *, int, + BIO_info_cb *)); + +# ifdef __cplusplus +} +# endif +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/bioerr.h b/MediaClient/MediaClient/openssl/include/openssl/bioerr.h new file mode 100644 index 0000000..46e2c96 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/bioerr.h @@ -0,0 +1,124 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_BIOERR_H +# define HEADER_BIOERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_BIO_strings(void); + +/* + * BIO function codes. + */ +# define BIO_F_ACPT_STATE 100 +# define BIO_F_ADDRINFO_WRAP 148 +# define BIO_F_ADDR_STRINGS 134 +# define BIO_F_BIO_ACCEPT 101 +# define BIO_F_BIO_ACCEPT_EX 137 +# define BIO_F_BIO_ACCEPT_NEW 152 +# define BIO_F_BIO_ADDR_NEW 144 +# define BIO_F_BIO_BIND 147 +# define BIO_F_BIO_CALLBACK_CTRL 131 +# define BIO_F_BIO_CONNECT 138 +# define BIO_F_BIO_CONNECT_NEW 153 +# define BIO_F_BIO_CTRL 103 +# define BIO_F_BIO_GETS 104 +# define BIO_F_BIO_GET_HOST_IP 106 +# define BIO_F_BIO_GET_NEW_INDEX 102 +# define BIO_F_BIO_GET_PORT 107 +# define BIO_F_BIO_LISTEN 139 +# define BIO_F_BIO_LOOKUP 135 +# define BIO_F_BIO_LOOKUP_EX 143 +# define BIO_F_BIO_MAKE_PAIR 121 +# define BIO_F_BIO_METH_NEW 146 +# define BIO_F_BIO_NEW 108 +# define BIO_F_BIO_NEW_DGRAM_SCTP 145 +# define BIO_F_BIO_NEW_FILE 109 +# define BIO_F_BIO_NEW_MEM_BUF 126 +# define BIO_F_BIO_NREAD 123 +# define BIO_F_BIO_NREAD0 124 +# define BIO_F_BIO_NWRITE 125 +# define BIO_F_BIO_NWRITE0 122 +# define BIO_F_BIO_PARSE_HOSTSERV 136 +# define BIO_F_BIO_PUTS 110 +# define BIO_F_BIO_READ 111 +# define BIO_F_BIO_READ_EX 105 +# define BIO_F_BIO_READ_INTERN 120 +# define BIO_F_BIO_SOCKET 140 +# define BIO_F_BIO_SOCKET_NBIO 142 +# define BIO_F_BIO_SOCK_INFO 141 +# define BIO_F_BIO_SOCK_INIT 112 +# define BIO_F_BIO_WRITE 113 +# define BIO_F_BIO_WRITE_EX 119 +# define BIO_F_BIO_WRITE_INTERN 128 +# define BIO_F_BUFFER_CTRL 114 +# define BIO_F_CONN_CTRL 127 +# define BIO_F_CONN_STATE 115 +# define BIO_F_DGRAM_SCTP_NEW 149 +# define BIO_F_DGRAM_SCTP_READ 132 +# define BIO_F_DGRAM_SCTP_WRITE 133 +# define BIO_F_DOAPR_OUTCH 150 +# define BIO_F_FILE_CTRL 116 +# define BIO_F_FILE_READ 130 +# define BIO_F_LINEBUFFER_CTRL 129 +# define BIO_F_LINEBUFFER_NEW 151 +# define BIO_F_MEM_WRITE 117 +# define BIO_F_NBIOF_NEW 154 +# define BIO_F_SLG_WRITE 155 +# define BIO_F_SSL_NEW 118 + +/* + * BIO reason codes. + */ +# define BIO_R_ACCEPT_ERROR 100 +# define BIO_R_ADDRINFO_ADDR_IS_NOT_AF_INET 141 +# define BIO_R_AMBIGUOUS_HOST_OR_SERVICE 129 +# define BIO_R_BAD_FOPEN_MODE 101 +# define BIO_R_BROKEN_PIPE 124 +# define BIO_R_CONNECT_ERROR 103 +# define BIO_R_GETHOSTBYNAME_ADDR_IS_NOT_AF_INET 107 +# define BIO_R_GETSOCKNAME_ERROR 132 +# define BIO_R_GETSOCKNAME_TRUNCATED_ADDRESS 133 +# define BIO_R_GETTING_SOCKTYPE 134 +# define BIO_R_INVALID_ARGUMENT 125 +# define BIO_R_INVALID_SOCKET 135 +# define BIO_R_IN_USE 123 +# define BIO_R_LENGTH_TOO_LONG 102 +# define BIO_R_LISTEN_V6_ONLY 136 +# define BIO_R_LOOKUP_RETURNED_NOTHING 142 +# define BIO_R_MALFORMED_HOST_OR_SERVICE 130 +# define BIO_R_NBIO_CONNECT_ERROR 110 +# define BIO_R_NO_ACCEPT_ADDR_OR_SERVICE_SPECIFIED 143 +# define BIO_R_NO_HOSTNAME_OR_SERVICE_SPECIFIED 144 +# define BIO_R_NO_PORT_DEFINED 113 +# define BIO_R_NO_SUCH_FILE 128 +# define BIO_R_NULL_PARAMETER 115 +# define BIO_R_UNABLE_TO_BIND_SOCKET 117 +# define BIO_R_UNABLE_TO_CREATE_SOCKET 118 +# define BIO_R_UNABLE_TO_KEEPALIVE 137 +# define BIO_R_UNABLE_TO_LISTEN_SOCKET 119 +# define BIO_R_UNABLE_TO_NODELAY 138 +# define BIO_R_UNABLE_TO_REUSEADDR 139 +# define BIO_R_UNAVAILABLE_IP_FAMILY 145 +# define BIO_R_UNINITIALIZED 120 +# define BIO_R_UNKNOWN_INFO_TYPE 140 +# define BIO_R_UNSUPPORTED_IP_FAMILY 146 +# define BIO_R_UNSUPPORTED_METHOD 121 +# define BIO_R_UNSUPPORTED_PROTOCOL_FAMILY 131 +# define BIO_R_WRITE_TO_READ_ONLY_BIO 126 +# define BIO_R_WSASTARTUP 122 + +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/blowfish.h b/MediaClient/MediaClient/openssl/include/openssl/blowfish.h new file mode 100644 index 0000000..cd3e460 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/blowfish.h @@ -0,0 +1,61 @@ +/* + * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_BLOWFISH_H +# define HEADER_BLOWFISH_H + +# include + +# ifndef OPENSSL_NO_BF +# include +# ifdef __cplusplus +extern "C" { +# endif + +# define BF_ENCRYPT 1 +# define BF_DECRYPT 0 + +/*- + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * ! BF_LONG has to be at least 32 bits wide. ! + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + */ +# define BF_LONG unsigned int + +# define BF_ROUNDS 16 +# define BF_BLOCK 8 + +typedef struct bf_key_st { + BF_LONG P[BF_ROUNDS + 2]; + BF_LONG S[4 * 256]; +} BF_KEY; + +void BF_set_key(BF_KEY *key, int len, const unsigned char *data); + +void BF_encrypt(BF_LONG *data, const BF_KEY *key); +void BF_decrypt(BF_LONG *data, const BF_KEY *key); + +void BF_ecb_encrypt(const unsigned char *in, unsigned char *out, + const BF_KEY *key, int enc); +void BF_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, + const BF_KEY *schedule, unsigned char *ivec, int enc); +void BF_cfb64_encrypt(const unsigned char *in, unsigned char *out, + long length, const BF_KEY *schedule, + unsigned char *ivec, int *num, int enc); +void BF_ofb64_encrypt(const unsigned char *in, unsigned char *out, + long length, const BF_KEY *schedule, + unsigned char *ivec, int *num); +const char *BF_options(void); + +# ifdef __cplusplus +} +# endif +# endif + +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/bn.h b/MediaClient/MediaClient/openssl/include/openssl/bn.h new file mode 100644 index 0000000..8af05d0 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/bn.h @@ -0,0 +1,539 @@ +/* + * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. + * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_BN_H +# define HEADER_BN_H + +# include +# ifndef OPENSSL_NO_STDIO +# include +# endif +# include +# include +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * 64-bit processor with LP64 ABI + */ +# ifdef SIXTY_FOUR_BIT_LONG +# define BN_ULONG unsigned long +# define BN_BYTES 8 +# endif + +/* + * 64-bit processor other than LP64 ABI + */ +# ifdef SIXTY_FOUR_BIT +# define BN_ULONG unsigned long long +# define BN_BYTES 8 +# endif + +# ifdef THIRTY_TWO_BIT +# define BN_ULONG unsigned int +# define BN_BYTES 4 +# endif + +# define BN_BITS2 (BN_BYTES * 8) +# define BN_BITS (BN_BITS2 * 2) +# define BN_TBIT ((BN_ULONG)1 << (BN_BITS2 - 1)) + +# define BN_FLG_MALLOCED 0x01 +# define BN_FLG_STATIC_DATA 0x02 + +/* + * avoid leaking exponent information through timing, + * BN_mod_exp_mont() will call BN_mod_exp_mont_consttime, + * BN_div() will call BN_div_no_branch, + * BN_mod_inverse() will call BN_mod_inverse_no_branch. + */ +# define BN_FLG_CONSTTIME 0x04 +# define BN_FLG_SECURE 0x08 + +# if OPENSSL_API_COMPAT < 0x00908000L +/* deprecated name for the flag */ +# define BN_FLG_EXP_CONSTTIME BN_FLG_CONSTTIME +# define BN_FLG_FREE 0x8000 /* used for debugging */ +# endif + +void BN_set_flags(BIGNUM *b, int n); +int BN_get_flags(const BIGNUM *b, int n); + +/* Values for |top| in BN_rand() */ +#define BN_RAND_TOP_ANY -1 +#define BN_RAND_TOP_ONE 0 +#define BN_RAND_TOP_TWO 1 + +/* Values for |bottom| in BN_rand() */ +#define BN_RAND_BOTTOM_ANY 0 +#define BN_RAND_BOTTOM_ODD 1 + +/* + * get a clone of a BIGNUM with changed flags, for *temporary* use only (the + * two BIGNUMs cannot be used in parallel!). Also only for *read only* use. The + * value |dest| should be a newly allocated BIGNUM obtained via BN_new() that + * has not been otherwise initialised or used. + */ +void BN_with_flags(BIGNUM *dest, const BIGNUM *b, int flags); + +/* Wrapper function to make using BN_GENCB easier */ +int BN_GENCB_call(BN_GENCB *cb, int a, int b); + +BN_GENCB *BN_GENCB_new(void); +void BN_GENCB_free(BN_GENCB *cb); + +/* Populate a BN_GENCB structure with an "old"-style callback */ +void BN_GENCB_set_old(BN_GENCB *gencb, void (*callback) (int, int, void *), + void *cb_arg); + +/* Populate a BN_GENCB structure with a "new"-style callback */ +void BN_GENCB_set(BN_GENCB *gencb, int (*callback) (int, int, BN_GENCB *), + void *cb_arg); + +void *BN_GENCB_get_arg(BN_GENCB *cb); + +# define BN_prime_checks 0 /* default: select number of iterations based + * on the size of the number */ + +/* + * BN_prime_checks_for_size() returns the number of Miller-Rabin iterations + * that will be done for checking that a random number is probably prime. The + * error rate for accepting a composite number as prime depends on the size of + * the prime |b|. The error rates used are for calculating an RSA key with 2 primes, + * and so the level is what you would expect for a key of double the size of the + * prime. + * + * This table is generated using the algorithm of FIPS PUB 186-4 + * Digital Signature Standard (DSS), section F.1, page 117. + * (https://dx.doi.org/10.6028/NIST.FIPS.186-4) + * + * The following magma script was used to generate the output: + * securitybits:=125; + * k:=1024; + * for t:=1 to 65 do + * for M:=3 to Floor(2*Sqrt(k-1)-1) do + * S:=0; + * // Sum over m + * for m:=3 to M do + * s:=0; + * // Sum over j + * for j:=2 to m do + * s+:=(RealField(32)!2)^-(j+(k-1)/j); + * end for; + * S+:=2^(m-(m-1)*t)*s; + * end for; + * A:=2^(k-2-M*t); + * B:=8*(Pi(RealField(32))^2-6)/3*2^(k-2)*S; + * pkt:=2.00743*Log(2)*k*2^-k*(A+B); + * seclevel:=Floor(-Log(2,pkt)); + * if seclevel ge securitybits then + * printf "k: %5o, security: %o bits (t: %o, M: %o)\n",k,seclevel,t,M; + * break; + * end if; + * end for; + * if seclevel ge securitybits then break; end if; + * end for; + * + * It can be run online at: + * http://magma.maths.usyd.edu.au/calc + * + * And will output: + * k: 1024, security: 129 bits (t: 6, M: 23) + * + * k is the number of bits of the prime, securitybits is the level we want to + * reach. + * + * prime length | RSA key size | # MR tests | security level + * -------------+--------------|------------+--------------- + * (b) >= 6394 | >= 12788 | 3 | 256 bit + * (b) >= 3747 | >= 7494 | 3 | 192 bit + * (b) >= 1345 | >= 2690 | 4 | 128 bit + * (b) >= 1080 | >= 2160 | 5 | 128 bit + * (b) >= 852 | >= 1704 | 5 | 112 bit + * (b) >= 476 | >= 952 | 5 | 80 bit + * (b) >= 400 | >= 800 | 6 | 80 bit + * (b) >= 347 | >= 694 | 7 | 80 bit + * (b) >= 308 | >= 616 | 8 | 80 bit + * (b) >= 55 | >= 110 | 27 | 64 bit + * (b) >= 6 | >= 12 | 34 | 64 bit + */ + +# define BN_prime_checks_for_size(b) ((b) >= 3747 ? 3 : \ + (b) >= 1345 ? 4 : \ + (b) >= 476 ? 5 : \ + (b) >= 400 ? 6 : \ + (b) >= 347 ? 7 : \ + (b) >= 308 ? 8 : \ + (b) >= 55 ? 27 : \ + /* b >= 6 */ 34) + +# define BN_num_bytes(a) ((BN_num_bits(a)+7)/8) + +int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w); +int BN_is_zero(const BIGNUM *a); +int BN_is_one(const BIGNUM *a); +int BN_is_word(const BIGNUM *a, const BN_ULONG w); +int BN_is_odd(const BIGNUM *a); + +# define BN_one(a) (BN_set_word((a),1)) + +void BN_zero_ex(BIGNUM *a); + +# if OPENSSL_API_COMPAT >= 0x00908000L +# define BN_zero(a) BN_zero_ex(a) +# else +# define BN_zero(a) (BN_set_word((a),0)) +# endif + +const BIGNUM *BN_value_one(void); +char *BN_options(void); +BN_CTX *BN_CTX_new(void); +BN_CTX *BN_CTX_secure_new(void); +void BN_CTX_free(BN_CTX *c); +void BN_CTX_start(BN_CTX *ctx); +BIGNUM *BN_CTX_get(BN_CTX *ctx); +void BN_CTX_end(BN_CTX *ctx); +int BN_rand(BIGNUM *rnd, int bits, int top, int bottom); +int BN_priv_rand(BIGNUM *rnd, int bits, int top, int bottom); +int BN_rand_range(BIGNUM *rnd, const BIGNUM *range); +int BN_priv_rand_range(BIGNUM *rnd, const BIGNUM *range); +int BN_pseudo_rand(BIGNUM *rnd, int bits, int top, int bottom); +int BN_pseudo_rand_range(BIGNUM *rnd, const BIGNUM *range); +int BN_num_bits(const BIGNUM *a); +int BN_num_bits_word(BN_ULONG l); +int BN_security_bits(int L, int N); +BIGNUM *BN_new(void); +BIGNUM *BN_secure_new(void); +void BN_clear_free(BIGNUM *a); +BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b); +void BN_swap(BIGNUM *a, BIGNUM *b); +BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret); +int BN_bn2bin(const BIGNUM *a, unsigned char *to); +int BN_bn2binpad(const BIGNUM *a, unsigned char *to, int tolen); +BIGNUM *BN_lebin2bn(const unsigned char *s, int len, BIGNUM *ret); +int BN_bn2lebinpad(const BIGNUM *a, unsigned char *to, int tolen); +BIGNUM *BN_mpi2bn(const unsigned char *s, int len, BIGNUM *ret); +int BN_bn2mpi(const BIGNUM *a, unsigned char *to); +int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); +int BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); +int BN_uadd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); +int BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); +int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); +int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx); +/** BN_set_negative sets sign of a BIGNUM + * \param b pointer to the BIGNUM object + * \param n 0 if the BIGNUM b should be positive and a value != 0 otherwise + */ +void BN_set_negative(BIGNUM *b, int n); +/** BN_is_negative returns 1 if the BIGNUM is negative + * \param b pointer to the BIGNUM object + * \return 1 if a < 0 and 0 otherwise + */ +int BN_is_negative(const BIGNUM *b); + +int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d, + BN_CTX *ctx); +# define BN_mod(rem,m,d,ctx) BN_div(NULL,(rem),(m),(d),(ctx)) +int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx); +int BN_mod_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, + BN_CTX *ctx); +int BN_mod_add_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, + const BIGNUM *m); +int BN_mod_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, + BN_CTX *ctx); +int BN_mod_sub_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, + const BIGNUM *m); +int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, + BN_CTX *ctx); +int BN_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx); +int BN_mod_lshift1(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx); +int BN_mod_lshift1_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *m); +int BN_mod_lshift(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m, + BN_CTX *ctx); +int BN_mod_lshift_quick(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m); + +BN_ULONG BN_mod_word(const BIGNUM *a, BN_ULONG w); +BN_ULONG BN_div_word(BIGNUM *a, BN_ULONG w); +int BN_mul_word(BIGNUM *a, BN_ULONG w); +int BN_add_word(BIGNUM *a, BN_ULONG w); +int BN_sub_word(BIGNUM *a, BN_ULONG w); +int BN_set_word(BIGNUM *a, BN_ULONG w); +BN_ULONG BN_get_word(const BIGNUM *a); + +int BN_cmp(const BIGNUM *a, const BIGNUM *b); +void BN_free(BIGNUM *a); +int BN_is_bit_set(const BIGNUM *a, int n); +int BN_lshift(BIGNUM *r, const BIGNUM *a, int n); +int BN_lshift1(BIGNUM *r, const BIGNUM *a); +int BN_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); + +int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, + const BIGNUM *m, BN_CTX *ctx); +int BN_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, + const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); +int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, + const BIGNUM *m, BN_CTX *ctx, + BN_MONT_CTX *in_mont); +int BN_mod_exp_mont_word(BIGNUM *r, BN_ULONG a, const BIGNUM *p, + const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); +int BN_mod_exp2_mont(BIGNUM *r, const BIGNUM *a1, const BIGNUM *p1, + const BIGNUM *a2, const BIGNUM *p2, const BIGNUM *m, + BN_CTX *ctx, BN_MONT_CTX *m_ctx); +int BN_mod_exp_simple(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, + const BIGNUM *m, BN_CTX *ctx); + +int BN_mask_bits(BIGNUM *a, int n); +# ifndef OPENSSL_NO_STDIO +int BN_print_fp(FILE *fp, const BIGNUM *a); +# endif +int BN_print(BIO *bio, const BIGNUM *a); +int BN_reciprocal(BIGNUM *r, const BIGNUM *m, int len, BN_CTX *ctx); +int BN_rshift(BIGNUM *r, const BIGNUM *a, int n); +int BN_rshift1(BIGNUM *r, const BIGNUM *a); +void BN_clear(BIGNUM *a); +BIGNUM *BN_dup(const BIGNUM *a); +int BN_ucmp(const BIGNUM *a, const BIGNUM *b); +int BN_set_bit(BIGNUM *a, int n); +int BN_clear_bit(BIGNUM *a, int n); +char *BN_bn2hex(const BIGNUM *a); +char *BN_bn2dec(const BIGNUM *a); +int BN_hex2bn(BIGNUM **a, const char *str); +int BN_dec2bn(BIGNUM **a, const char *str); +int BN_asc2bn(BIGNUM **a, const char *str); +int BN_gcd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); +int BN_kronecker(const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); /* returns + * -2 for + * error */ +BIGNUM *BN_mod_inverse(BIGNUM *ret, + const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx); +BIGNUM *BN_mod_sqrt(BIGNUM *ret, + const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx); + +void BN_consttime_swap(BN_ULONG swap, BIGNUM *a, BIGNUM *b, int nwords); + +/* Deprecated versions */ +DEPRECATEDIN_0_9_8(BIGNUM *BN_generate_prime(BIGNUM *ret, int bits, int safe, + const BIGNUM *add, + const BIGNUM *rem, + void (*callback) (int, int, + void *), + void *cb_arg)) +DEPRECATEDIN_0_9_8(int + BN_is_prime(const BIGNUM *p, int nchecks, + void (*callback) (int, int, void *), + BN_CTX *ctx, void *cb_arg)) +DEPRECATEDIN_0_9_8(int + BN_is_prime_fasttest(const BIGNUM *p, int nchecks, + void (*callback) (int, int, void *), + BN_CTX *ctx, void *cb_arg, + int do_trial_division)) + +/* Newer versions */ +int BN_generate_prime_ex(BIGNUM *ret, int bits, int safe, const BIGNUM *add, + const BIGNUM *rem, BN_GENCB *cb); +int BN_is_prime_ex(const BIGNUM *p, int nchecks, BN_CTX *ctx, BN_GENCB *cb); +int BN_is_prime_fasttest_ex(const BIGNUM *p, int nchecks, BN_CTX *ctx, + int do_trial_division, BN_GENCB *cb); + +int BN_X931_generate_Xpq(BIGNUM *Xp, BIGNUM *Xq, int nbits, BN_CTX *ctx); + +int BN_X931_derive_prime_ex(BIGNUM *p, BIGNUM *p1, BIGNUM *p2, + const BIGNUM *Xp, const BIGNUM *Xp1, + const BIGNUM *Xp2, const BIGNUM *e, BN_CTX *ctx, + BN_GENCB *cb); +int BN_X931_generate_prime_ex(BIGNUM *p, BIGNUM *p1, BIGNUM *p2, BIGNUM *Xp1, + BIGNUM *Xp2, const BIGNUM *Xp, const BIGNUM *e, + BN_CTX *ctx, BN_GENCB *cb); + +BN_MONT_CTX *BN_MONT_CTX_new(void); +int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, + BN_MONT_CTX *mont, BN_CTX *ctx); +int BN_to_montgomery(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont, + BN_CTX *ctx); +int BN_from_montgomery(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont, + BN_CTX *ctx); +void BN_MONT_CTX_free(BN_MONT_CTX *mont); +int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx); +BN_MONT_CTX *BN_MONT_CTX_copy(BN_MONT_CTX *to, BN_MONT_CTX *from); +BN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, CRYPTO_RWLOCK *lock, + const BIGNUM *mod, BN_CTX *ctx); + +/* BN_BLINDING flags */ +# define BN_BLINDING_NO_UPDATE 0x00000001 +# define BN_BLINDING_NO_RECREATE 0x00000002 + +BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, BIGNUM *mod); +void BN_BLINDING_free(BN_BLINDING *b); +int BN_BLINDING_update(BN_BLINDING *b, BN_CTX *ctx); +int BN_BLINDING_convert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx); +int BN_BLINDING_invert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx); +int BN_BLINDING_convert_ex(BIGNUM *n, BIGNUM *r, BN_BLINDING *b, BN_CTX *); +int BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b, + BN_CTX *); + +int BN_BLINDING_is_current_thread(BN_BLINDING *b); +void BN_BLINDING_set_current_thread(BN_BLINDING *b); +int BN_BLINDING_lock(BN_BLINDING *b); +int BN_BLINDING_unlock(BN_BLINDING *b); + +unsigned long BN_BLINDING_get_flags(const BN_BLINDING *); +void BN_BLINDING_set_flags(BN_BLINDING *, unsigned long); +BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b, + const BIGNUM *e, BIGNUM *m, BN_CTX *ctx, + int (*bn_mod_exp) (BIGNUM *r, + const BIGNUM *a, + const BIGNUM *p, + const BIGNUM *m, + BN_CTX *ctx, + BN_MONT_CTX *m_ctx), + BN_MONT_CTX *m_ctx); + +DEPRECATEDIN_0_9_8(void BN_set_params(int mul, int high, int low, int mont)) +DEPRECATEDIN_0_9_8(int BN_get_params(int which)) /* 0, mul, 1 high, 2 low, 3 + * mont */ + +BN_RECP_CTX *BN_RECP_CTX_new(void); +void BN_RECP_CTX_free(BN_RECP_CTX *recp); +int BN_RECP_CTX_set(BN_RECP_CTX *recp, const BIGNUM *rdiv, BN_CTX *ctx); +int BN_mod_mul_reciprocal(BIGNUM *r, const BIGNUM *x, const BIGNUM *y, + BN_RECP_CTX *recp, BN_CTX *ctx); +int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, + const BIGNUM *m, BN_CTX *ctx); +int BN_div_recp(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, + BN_RECP_CTX *recp, BN_CTX *ctx); + +# ifndef OPENSSL_NO_EC2M + +/* + * Functions for arithmetic over binary polynomials represented by BIGNUMs. + * The BIGNUM::neg property of BIGNUMs representing binary polynomials is + * ignored. Note that input arguments are not const so that their bit arrays + * can be expanded to the appropriate size if needed. + */ + +/* + * r = a + b + */ +int BN_GF2m_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); +# define BN_GF2m_sub(r, a, b) BN_GF2m_add(r, a, b) +/* + * r=a mod p + */ +int BN_GF2m_mod(BIGNUM *r, const BIGNUM *a, const BIGNUM *p); +/* r = (a * b) mod p */ +int BN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, + const BIGNUM *p, BN_CTX *ctx); +/* r = (a * a) mod p */ +int BN_GF2m_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); +/* r = (1 / b) mod p */ +int BN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *b, const BIGNUM *p, BN_CTX *ctx); +/* r = (a / b) mod p */ +int BN_GF2m_mod_div(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, + const BIGNUM *p, BN_CTX *ctx); +/* r = (a ^ b) mod p */ +int BN_GF2m_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, + const BIGNUM *p, BN_CTX *ctx); +/* r = sqrt(a) mod p */ +int BN_GF2m_mod_sqrt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, + BN_CTX *ctx); +/* r^2 + r = a mod p */ +int BN_GF2m_mod_solve_quad(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, + BN_CTX *ctx); +# define BN_GF2m_cmp(a, b) BN_ucmp((a), (b)) +/*- + * Some functions allow for representation of the irreducible polynomials + * as an unsigned int[], say p. The irreducible f(t) is then of the form: + * t^p[0] + t^p[1] + ... + t^p[k] + * where m = p[0] > p[1] > ... > p[k] = 0. + */ +/* r = a mod p */ +int BN_GF2m_mod_arr(BIGNUM *r, const BIGNUM *a, const int p[]); +/* r = (a * b) mod p */ +int BN_GF2m_mod_mul_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, + const int p[], BN_CTX *ctx); +/* r = (a * a) mod p */ +int BN_GF2m_mod_sqr_arr(BIGNUM *r, const BIGNUM *a, const int p[], + BN_CTX *ctx); +/* r = (1 / b) mod p */ +int BN_GF2m_mod_inv_arr(BIGNUM *r, const BIGNUM *b, const int p[], + BN_CTX *ctx); +/* r = (a / b) mod p */ +int BN_GF2m_mod_div_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, + const int p[], BN_CTX *ctx); +/* r = (a ^ b) mod p */ +int BN_GF2m_mod_exp_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, + const int p[], BN_CTX *ctx); +/* r = sqrt(a) mod p */ +int BN_GF2m_mod_sqrt_arr(BIGNUM *r, const BIGNUM *a, + const int p[], BN_CTX *ctx); +/* r^2 + r = a mod p */ +int BN_GF2m_mod_solve_quad_arr(BIGNUM *r, const BIGNUM *a, + const int p[], BN_CTX *ctx); +int BN_GF2m_poly2arr(const BIGNUM *a, int p[], int max); +int BN_GF2m_arr2poly(const int p[], BIGNUM *a); + +# endif + +/* + * faster mod functions for the 'NIST primes' 0 <= a < p^2 + */ +int BN_nist_mod_192(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); +int BN_nist_mod_224(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); +int BN_nist_mod_256(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); +int BN_nist_mod_384(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); +int BN_nist_mod_521(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); + +const BIGNUM *BN_get0_nist_prime_192(void); +const BIGNUM *BN_get0_nist_prime_224(void); +const BIGNUM *BN_get0_nist_prime_256(void); +const BIGNUM *BN_get0_nist_prime_384(void); +const BIGNUM *BN_get0_nist_prime_521(void); + +int (*BN_nist_mod_func(const BIGNUM *p)) (BIGNUM *r, const BIGNUM *a, + const BIGNUM *field, BN_CTX *ctx); + +int BN_generate_dsa_nonce(BIGNUM *out, const BIGNUM *range, + const BIGNUM *priv, const unsigned char *message, + size_t message_len, BN_CTX *ctx); + +/* Primes from RFC 2409 */ +BIGNUM *BN_get_rfc2409_prime_768(BIGNUM *bn); +BIGNUM *BN_get_rfc2409_prime_1024(BIGNUM *bn); + +/* Primes from RFC 3526 */ +BIGNUM *BN_get_rfc3526_prime_1536(BIGNUM *bn); +BIGNUM *BN_get_rfc3526_prime_2048(BIGNUM *bn); +BIGNUM *BN_get_rfc3526_prime_3072(BIGNUM *bn); +BIGNUM *BN_get_rfc3526_prime_4096(BIGNUM *bn); +BIGNUM *BN_get_rfc3526_prime_6144(BIGNUM *bn); +BIGNUM *BN_get_rfc3526_prime_8192(BIGNUM *bn); + +# if OPENSSL_API_COMPAT < 0x10100000L +# define get_rfc2409_prime_768 BN_get_rfc2409_prime_768 +# define get_rfc2409_prime_1024 BN_get_rfc2409_prime_1024 +# define get_rfc3526_prime_1536 BN_get_rfc3526_prime_1536 +# define get_rfc3526_prime_2048 BN_get_rfc3526_prime_2048 +# define get_rfc3526_prime_3072 BN_get_rfc3526_prime_3072 +# define get_rfc3526_prime_4096 BN_get_rfc3526_prime_4096 +# define get_rfc3526_prime_6144 BN_get_rfc3526_prime_6144 +# define get_rfc3526_prime_8192 BN_get_rfc3526_prime_8192 +# endif + +int BN_bntest_rand(BIGNUM *rnd, int bits, int top, int bottom); + + +# ifdef __cplusplus +} +# endif +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/bnerr.h b/MediaClient/MediaClient/openssl/include/openssl/bnerr.h new file mode 100644 index 0000000..9f3c7cf --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/bnerr.h @@ -0,0 +1,100 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_BNERR_H +# define HEADER_BNERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_BN_strings(void); + +/* + * BN function codes. + */ +# define BN_F_BNRAND 127 +# define BN_F_BNRAND_RANGE 138 +# define BN_F_BN_BLINDING_CONVERT_EX 100 +# define BN_F_BN_BLINDING_CREATE_PARAM 128 +# define BN_F_BN_BLINDING_INVERT_EX 101 +# define BN_F_BN_BLINDING_NEW 102 +# define BN_F_BN_BLINDING_UPDATE 103 +# define BN_F_BN_BN2DEC 104 +# define BN_F_BN_BN2HEX 105 +# define BN_F_BN_COMPUTE_WNAF 142 +# define BN_F_BN_CTX_GET 116 +# define BN_F_BN_CTX_NEW 106 +# define BN_F_BN_CTX_START 129 +# define BN_F_BN_DIV 107 +# define BN_F_BN_DIV_RECP 130 +# define BN_F_BN_EXP 123 +# define BN_F_BN_EXPAND_INTERNAL 120 +# define BN_F_BN_GENCB_NEW 143 +# define BN_F_BN_GENERATE_DSA_NONCE 140 +# define BN_F_BN_GENERATE_PRIME_EX 141 +# define BN_F_BN_GF2M_MOD 131 +# define BN_F_BN_GF2M_MOD_EXP 132 +# define BN_F_BN_GF2M_MOD_MUL 133 +# define BN_F_BN_GF2M_MOD_SOLVE_QUAD 134 +# define BN_F_BN_GF2M_MOD_SOLVE_QUAD_ARR 135 +# define BN_F_BN_GF2M_MOD_SQR 136 +# define BN_F_BN_GF2M_MOD_SQRT 137 +# define BN_F_BN_LSHIFT 145 +# define BN_F_BN_MOD_EXP2_MONT 118 +# define BN_F_BN_MOD_EXP_MONT 109 +# define BN_F_BN_MOD_EXP_MONT_CONSTTIME 124 +# define BN_F_BN_MOD_EXP_MONT_WORD 117 +# define BN_F_BN_MOD_EXP_RECP 125 +# define BN_F_BN_MOD_EXP_SIMPLE 126 +# define BN_F_BN_MOD_INVERSE 110 +# define BN_F_BN_MOD_INVERSE_NO_BRANCH 139 +# define BN_F_BN_MOD_LSHIFT_QUICK 119 +# define BN_F_BN_MOD_SQRT 121 +# define BN_F_BN_MONT_CTX_NEW 149 +# define BN_F_BN_MPI2BN 112 +# define BN_F_BN_NEW 113 +# define BN_F_BN_POOL_GET 147 +# define BN_F_BN_RAND 114 +# define BN_F_BN_RAND_RANGE 122 +# define BN_F_BN_RECP_CTX_NEW 150 +# define BN_F_BN_RSHIFT 146 +# define BN_F_BN_SET_WORDS 144 +# define BN_F_BN_STACK_PUSH 148 +# define BN_F_BN_USUB 115 + +/* + * BN reason codes. + */ +# define BN_R_ARG2_LT_ARG3 100 +# define BN_R_BAD_RECIPROCAL 101 +# define BN_R_BIGNUM_TOO_LONG 114 +# define BN_R_BITS_TOO_SMALL 118 +# define BN_R_CALLED_WITH_EVEN_MODULUS 102 +# define BN_R_DIV_BY_ZERO 103 +# define BN_R_ENCODING_ERROR 104 +# define BN_R_EXPAND_ON_STATIC_BIGNUM_DATA 105 +# define BN_R_INPUT_NOT_REDUCED 110 +# define BN_R_INVALID_LENGTH 106 +# define BN_R_INVALID_RANGE 115 +# define BN_R_INVALID_SHIFT 119 +# define BN_R_NOT_A_SQUARE 111 +# define BN_R_NOT_INITIALIZED 107 +# define BN_R_NO_INVERSE 108 +# define BN_R_NO_SOLUTION 116 +# define BN_R_PRIVATE_KEY_TOO_LARGE 117 +# define BN_R_P_IS_NOT_PRIME 112 +# define BN_R_TOO_MANY_ITERATIONS 113 +# define BN_R_TOO_MANY_TEMPORARY_VARIABLES 109 + +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/buffer.h b/MediaClient/MediaClient/openssl/include/openssl/buffer.h new file mode 100644 index 0000000..d276576 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/buffer.h @@ -0,0 +1,58 @@ +/* + * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_BUFFER_H +# define HEADER_BUFFER_H + +# include +# ifndef HEADER_CRYPTO_H +# include +# endif +# include + + +#ifdef __cplusplus +extern "C" { +#endif + +# include +# include + +/* + * These names are outdated as of OpenSSL 1.1; a future release + * will move them to be deprecated. + */ +# define BUF_strdup(s) OPENSSL_strdup(s) +# define BUF_strndup(s, size) OPENSSL_strndup(s, size) +# define BUF_memdup(data, size) OPENSSL_memdup(data, size) +# define BUF_strlcpy(dst, src, size) OPENSSL_strlcpy(dst, src, size) +# define BUF_strlcat(dst, src, size) OPENSSL_strlcat(dst, src, size) +# define BUF_strnlen(str, maxlen) OPENSSL_strnlen(str, maxlen) + +struct buf_mem_st { + size_t length; /* current number of bytes */ + char *data; + size_t max; /* size of buffer */ + unsigned long flags; +}; + +# define BUF_MEM_FLAG_SECURE 0x01 + +BUF_MEM *BUF_MEM_new(void); +BUF_MEM *BUF_MEM_new_ex(unsigned long flags); +void BUF_MEM_free(BUF_MEM *a); +size_t BUF_MEM_grow(BUF_MEM *str, size_t len); +size_t BUF_MEM_grow_clean(BUF_MEM *str, size_t len); +void BUF_reverse(unsigned char *out, const unsigned char *in, size_t siz); + + +# ifdef __cplusplus +} +# endif +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/buffererr.h b/MediaClient/MediaClient/openssl/include/openssl/buffererr.h new file mode 100644 index 0000000..04f6ff7 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/buffererr.h @@ -0,0 +1,34 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_BUFERR_H +# define HEADER_BUFERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_BUF_strings(void); + +/* + * BUF function codes. + */ +# define BUF_F_BUF_MEM_GROW 100 +# define BUF_F_BUF_MEM_GROW_CLEAN 105 +# define BUF_F_BUF_MEM_NEW 101 + +/* + * BUF reason codes. + */ + +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/camellia.h b/MediaClient/MediaClient/openssl/include/openssl/camellia.h new file mode 100644 index 0000000..151f3c1 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/camellia.h @@ -0,0 +1,83 @@ +/* + * Copyright 2006-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_CAMELLIA_H +# define HEADER_CAMELLIA_H + +# include + +# ifndef OPENSSL_NO_CAMELLIA +# include +#ifdef __cplusplus +extern "C" { +#endif + +# define CAMELLIA_ENCRYPT 1 +# define CAMELLIA_DECRYPT 0 + +/* + * Because array size can't be a const in C, the following two are macros. + * Both sizes are in bytes. + */ + +/* This should be a hidden type, but EVP requires that the size be known */ + +# define CAMELLIA_BLOCK_SIZE 16 +# define CAMELLIA_TABLE_BYTE_LEN 272 +# define CAMELLIA_TABLE_WORD_LEN (CAMELLIA_TABLE_BYTE_LEN / 4) + +typedef unsigned int KEY_TABLE_TYPE[CAMELLIA_TABLE_WORD_LEN]; /* to match + * with WORD */ + +struct camellia_key_st { + union { + double d; /* ensures 64-bit align */ + KEY_TABLE_TYPE rd_key; + } u; + int grand_rounds; +}; +typedef struct camellia_key_st CAMELLIA_KEY; + +int Camellia_set_key(const unsigned char *userKey, const int bits, + CAMELLIA_KEY *key); + +void Camellia_encrypt(const unsigned char *in, unsigned char *out, + const CAMELLIA_KEY *key); +void Camellia_decrypt(const unsigned char *in, unsigned char *out, + const CAMELLIA_KEY *key); + +void Camellia_ecb_encrypt(const unsigned char *in, unsigned char *out, + const CAMELLIA_KEY *key, const int enc); +void Camellia_cbc_encrypt(const unsigned char *in, unsigned char *out, + size_t length, const CAMELLIA_KEY *key, + unsigned char *ivec, const int enc); +void Camellia_cfb128_encrypt(const unsigned char *in, unsigned char *out, + size_t length, const CAMELLIA_KEY *key, + unsigned char *ivec, int *num, const int enc); +void Camellia_cfb1_encrypt(const unsigned char *in, unsigned char *out, + size_t length, const CAMELLIA_KEY *key, + unsigned char *ivec, int *num, const int enc); +void Camellia_cfb8_encrypt(const unsigned char *in, unsigned char *out, + size_t length, const CAMELLIA_KEY *key, + unsigned char *ivec, int *num, const int enc); +void Camellia_ofb128_encrypt(const unsigned char *in, unsigned char *out, + size_t length, const CAMELLIA_KEY *key, + unsigned char *ivec, int *num); +void Camellia_ctr128_encrypt(const unsigned char *in, unsigned char *out, + size_t length, const CAMELLIA_KEY *key, + unsigned char ivec[CAMELLIA_BLOCK_SIZE], + unsigned char ecount_buf[CAMELLIA_BLOCK_SIZE], + unsigned int *num); + +# ifdef __cplusplus +} +# endif +# endif + +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/cast.h b/MediaClient/MediaClient/openssl/include/openssl/cast.h new file mode 100644 index 0000000..2cc89ae --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/cast.h @@ -0,0 +1,53 @@ +/* + * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_CAST_H +# define HEADER_CAST_H + +# include + +# ifndef OPENSSL_NO_CAST +# ifdef __cplusplus +extern "C" { +# endif + +# define CAST_ENCRYPT 1 +# define CAST_DECRYPT 0 + +# define CAST_LONG unsigned int + +# define CAST_BLOCK 8 +# define CAST_KEY_LENGTH 16 + +typedef struct cast_key_st { + CAST_LONG data[32]; + int short_key; /* Use reduced rounds for short key */ +} CAST_KEY; + +void CAST_set_key(CAST_KEY *key, int len, const unsigned char *data); +void CAST_ecb_encrypt(const unsigned char *in, unsigned char *out, + const CAST_KEY *key, int enc); +void CAST_encrypt(CAST_LONG *data, const CAST_KEY *key); +void CAST_decrypt(CAST_LONG *data, const CAST_KEY *key); +void CAST_cbc_encrypt(const unsigned char *in, unsigned char *out, + long length, const CAST_KEY *ks, unsigned char *iv, + int enc); +void CAST_cfb64_encrypt(const unsigned char *in, unsigned char *out, + long length, const CAST_KEY *schedule, + unsigned char *ivec, int *num, int enc); +void CAST_ofb64_encrypt(const unsigned char *in, unsigned char *out, + long length, const CAST_KEY *schedule, + unsigned char *ivec, int *num); + +# ifdef __cplusplus +} +# endif +# endif + +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/cmac.h b/MediaClient/MediaClient/openssl/include/openssl/cmac.h new file mode 100644 index 0000000..3535a9a --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/cmac.h @@ -0,0 +1,41 @@ +/* + * Copyright 2010-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_CMAC_H +# define HEADER_CMAC_H + +# ifndef OPENSSL_NO_CMAC + +#ifdef __cplusplus +extern "C" { +#endif + +# include + +/* Opaque */ +typedef struct CMAC_CTX_st CMAC_CTX; + +CMAC_CTX *CMAC_CTX_new(void); +void CMAC_CTX_cleanup(CMAC_CTX *ctx); +void CMAC_CTX_free(CMAC_CTX *ctx); +EVP_CIPHER_CTX *CMAC_CTX_get0_cipher_ctx(CMAC_CTX *ctx); +int CMAC_CTX_copy(CMAC_CTX *out, const CMAC_CTX *in); + +int CMAC_Init(CMAC_CTX *ctx, const void *key, size_t keylen, + const EVP_CIPHER *cipher, ENGINE *impl); +int CMAC_Update(CMAC_CTX *ctx, const void *data, size_t dlen); +int CMAC_Final(CMAC_CTX *ctx, unsigned char *out, size_t *poutlen); +int CMAC_resume(CMAC_CTX *ctx); + +#ifdef __cplusplus +} +#endif + +# endif +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/cms.h b/MediaClient/MediaClient/openssl/include/openssl/cms.h new file mode 100644 index 0000000..c762796 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/cms.h @@ -0,0 +1,339 @@ +/* + * Copyright 2008-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_CMS_H +# define HEADER_CMS_H + +# include + +# ifndef OPENSSL_NO_CMS +# include +# include +# include +# ifdef __cplusplus +extern "C" { +# endif + +typedef struct CMS_ContentInfo_st CMS_ContentInfo; +typedef struct CMS_SignerInfo_st CMS_SignerInfo; +typedef struct CMS_CertificateChoices CMS_CertificateChoices; +typedef struct CMS_RevocationInfoChoice_st CMS_RevocationInfoChoice; +typedef struct CMS_RecipientInfo_st CMS_RecipientInfo; +typedef struct CMS_ReceiptRequest_st CMS_ReceiptRequest; +typedef struct CMS_Receipt_st CMS_Receipt; +typedef struct CMS_RecipientEncryptedKey_st CMS_RecipientEncryptedKey; +typedef struct CMS_OtherKeyAttribute_st CMS_OtherKeyAttribute; + +DEFINE_STACK_OF(CMS_SignerInfo) +DEFINE_STACK_OF(CMS_RecipientEncryptedKey) +DEFINE_STACK_OF(CMS_RecipientInfo) +DEFINE_STACK_OF(CMS_RevocationInfoChoice) +DECLARE_ASN1_FUNCTIONS(CMS_ContentInfo) +DECLARE_ASN1_FUNCTIONS(CMS_ReceiptRequest) +DECLARE_ASN1_PRINT_FUNCTION(CMS_ContentInfo) + +# define CMS_SIGNERINFO_ISSUER_SERIAL 0 +# define CMS_SIGNERINFO_KEYIDENTIFIER 1 + +# define CMS_RECIPINFO_NONE -1 +# define CMS_RECIPINFO_TRANS 0 +# define CMS_RECIPINFO_AGREE 1 +# define CMS_RECIPINFO_KEK 2 +# define CMS_RECIPINFO_PASS 3 +# define CMS_RECIPINFO_OTHER 4 + +/* S/MIME related flags */ + +# define CMS_TEXT 0x1 +# define CMS_NOCERTS 0x2 +# define CMS_NO_CONTENT_VERIFY 0x4 +# define CMS_NO_ATTR_VERIFY 0x8 +# define CMS_NOSIGS \ + (CMS_NO_CONTENT_VERIFY|CMS_NO_ATTR_VERIFY) +# define CMS_NOINTERN 0x10 +# define CMS_NO_SIGNER_CERT_VERIFY 0x20 +# define CMS_NOVERIFY 0x20 +# define CMS_DETACHED 0x40 +# define CMS_BINARY 0x80 +# define CMS_NOATTR 0x100 +# define CMS_NOSMIMECAP 0x200 +# define CMS_NOOLDMIMETYPE 0x400 +# define CMS_CRLFEOL 0x800 +# define CMS_STREAM 0x1000 +# define CMS_NOCRL 0x2000 +# define CMS_PARTIAL 0x4000 +# define CMS_REUSE_DIGEST 0x8000 +# define CMS_USE_KEYID 0x10000 +# define CMS_DEBUG_DECRYPT 0x20000 +# define CMS_KEY_PARAM 0x40000 +# define CMS_ASCIICRLF 0x80000 + +const ASN1_OBJECT *CMS_get0_type(const CMS_ContentInfo *cms); + +BIO *CMS_dataInit(CMS_ContentInfo *cms, BIO *icont); +int CMS_dataFinal(CMS_ContentInfo *cms, BIO *bio); + +ASN1_OCTET_STRING **CMS_get0_content(CMS_ContentInfo *cms); +int CMS_is_detached(CMS_ContentInfo *cms); +int CMS_set_detached(CMS_ContentInfo *cms, int detached); + +# ifdef HEADER_PEM_H +DECLARE_PEM_rw_const(CMS, CMS_ContentInfo) +# endif +int CMS_stream(unsigned char ***boundary, CMS_ContentInfo *cms); +CMS_ContentInfo *d2i_CMS_bio(BIO *bp, CMS_ContentInfo **cms); +int i2d_CMS_bio(BIO *bp, CMS_ContentInfo *cms); + +BIO *BIO_new_CMS(BIO *out, CMS_ContentInfo *cms); +int i2d_CMS_bio_stream(BIO *out, CMS_ContentInfo *cms, BIO *in, int flags); +int PEM_write_bio_CMS_stream(BIO *out, CMS_ContentInfo *cms, BIO *in, + int flags); +CMS_ContentInfo *SMIME_read_CMS(BIO *bio, BIO **bcont); +int SMIME_write_CMS(BIO *bio, CMS_ContentInfo *cms, BIO *data, int flags); + +int CMS_final(CMS_ContentInfo *cms, BIO *data, BIO *dcont, + unsigned int flags); + +CMS_ContentInfo *CMS_sign(X509 *signcert, EVP_PKEY *pkey, + STACK_OF(X509) *certs, BIO *data, + unsigned int flags); + +CMS_ContentInfo *CMS_sign_receipt(CMS_SignerInfo *si, + X509 *signcert, EVP_PKEY *pkey, + STACK_OF(X509) *certs, unsigned int flags); + +int CMS_data(CMS_ContentInfo *cms, BIO *out, unsigned int flags); +CMS_ContentInfo *CMS_data_create(BIO *in, unsigned int flags); + +int CMS_digest_verify(CMS_ContentInfo *cms, BIO *dcont, BIO *out, + unsigned int flags); +CMS_ContentInfo *CMS_digest_create(BIO *in, const EVP_MD *md, + unsigned int flags); + +int CMS_EncryptedData_decrypt(CMS_ContentInfo *cms, + const unsigned char *key, size_t keylen, + BIO *dcont, BIO *out, unsigned int flags); + +CMS_ContentInfo *CMS_EncryptedData_encrypt(BIO *in, const EVP_CIPHER *cipher, + const unsigned char *key, + size_t keylen, unsigned int flags); + +int CMS_EncryptedData_set1_key(CMS_ContentInfo *cms, const EVP_CIPHER *ciph, + const unsigned char *key, size_t keylen); + +int CMS_verify(CMS_ContentInfo *cms, STACK_OF(X509) *certs, + X509_STORE *store, BIO *dcont, BIO *out, unsigned int flags); + +int CMS_verify_receipt(CMS_ContentInfo *rcms, CMS_ContentInfo *ocms, + STACK_OF(X509) *certs, + X509_STORE *store, unsigned int flags); + +STACK_OF(X509) *CMS_get0_signers(CMS_ContentInfo *cms); + +CMS_ContentInfo *CMS_encrypt(STACK_OF(X509) *certs, BIO *in, + const EVP_CIPHER *cipher, unsigned int flags); + +int CMS_decrypt(CMS_ContentInfo *cms, EVP_PKEY *pkey, X509 *cert, + BIO *dcont, BIO *out, unsigned int flags); + +int CMS_decrypt_set1_pkey(CMS_ContentInfo *cms, EVP_PKEY *pk, X509 *cert); +int CMS_decrypt_set1_key(CMS_ContentInfo *cms, + unsigned char *key, size_t keylen, + const unsigned char *id, size_t idlen); +int CMS_decrypt_set1_password(CMS_ContentInfo *cms, + unsigned char *pass, ossl_ssize_t passlen); + +STACK_OF(CMS_RecipientInfo) *CMS_get0_RecipientInfos(CMS_ContentInfo *cms); +int CMS_RecipientInfo_type(CMS_RecipientInfo *ri); +EVP_PKEY_CTX *CMS_RecipientInfo_get0_pkey_ctx(CMS_RecipientInfo *ri); +CMS_ContentInfo *CMS_EnvelopedData_create(const EVP_CIPHER *cipher); +CMS_RecipientInfo *CMS_add1_recipient_cert(CMS_ContentInfo *cms, + X509 *recip, unsigned int flags); +int CMS_RecipientInfo_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pkey); +int CMS_RecipientInfo_ktri_cert_cmp(CMS_RecipientInfo *ri, X509 *cert); +int CMS_RecipientInfo_ktri_get0_algs(CMS_RecipientInfo *ri, + EVP_PKEY **pk, X509 **recip, + X509_ALGOR **palg); +int CMS_RecipientInfo_ktri_get0_signer_id(CMS_RecipientInfo *ri, + ASN1_OCTET_STRING **keyid, + X509_NAME **issuer, + ASN1_INTEGER **sno); + +CMS_RecipientInfo *CMS_add0_recipient_key(CMS_ContentInfo *cms, int nid, + unsigned char *key, size_t keylen, + unsigned char *id, size_t idlen, + ASN1_GENERALIZEDTIME *date, + ASN1_OBJECT *otherTypeId, + ASN1_TYPE *otherType); + +int CMS_RecipientInfo_kekri_get0_id(CMS_RecipientInfo *ri, + X509_ALGOR **palg, + ASN1_OCTET_STRING **pid, + ASN1_GENERALIZEDTIME **pdate, + ASN1_OBJECT **potherid, + ASN1_TYPE **pothertype); + +int CMS_RecipientInfo_set0_key(CMS_RecipientInfo *ri, + unsigned char *key, size_t keylen); + +int CMS_RecipientInfo_kekri_id_cmp(CMS_RecipientInfo *ri, + const unsigned char *id, size_t idlen); + +int CMS_RecipientInfo_set0_password(CMS_RecipientInfo *ri, + unsigned char *pass, + ossl_ssize_t passlen); + +CMS_RecipientInfo *CMS_add0_recipient_password(CMS_ContentInfo *cms, + int iter, int wrap_nid, + int pbe_nid, + unsigned char *pass, + ossl_ssize_t passlen, + const EVP_CIPHER *kekciph); + +int CMS_RecipientInfo_decrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri); +int CMS_RecipientInfo_encrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri); + +int CMS_uncompress(CMS_ContentInfo *cms, BIO *dcont, BIO *out, + unsigned int flags); +CMS_ContentInfo *CMS_compress(BIO *in, int comp_nid, unsigned int flags); + +int CMS_set1_eContentType(CMS_ContentInfo *cms, const ASN1_OBJECT *oid); +const ASN1_OBJECT *CMS_get0_eContentType(CMS_ContentInfo *cms); + +CMS_CertificateChoices *CMS_add0_CertificateChoices(CMS_ContentInfo *cms); +int CMS_add0_cert(CMS_ContentInfo *cms, X509 *cert); +int CMS_add1_cert(CMS_ContentInfo *cms, X509 *cert); +STACK_OF(X509) *CMS_get1_certs(CMS_ContentInfo *cms); + +CMS_RevocationInfoChoice *CMS_add0_RevocationInfoChoice(CMS_ContentInfo *cms); +int CMS_add0_crl(CMS_ContentInfo *cms, X509_CRL *crl); +int CMS_add1_crl(CMS_ContentInfo *cms, X509_CRL *crl); +STACK_OF(X509_CRL) *CMS_get1_crls(CMS_ContentInfo *cms); + +int CMS_SignedData_init(CMS_ContentInfo *cms); +CMS_SignerInfo *CMS_add1_signer(CMS_ContentInfo *cms, + X509 *signer, EVP_PKEY *pk, const EVP_MD *md, + unsigned int flags); +EVP_PKEY_CTX *CMS_SignerInfo_get0_pkey_ctx(CMS_SignerInfo *si); +EVP_MD_CTX *CMS_SignerInfo_get0_md_ctx(CMS_SignerInfo *si); +STACK_OF(CMS_SignerInfo) *CMS_get0_SignerInfos(CMS_ContentInfo *cms); + +void CMS_SignerInfo_set1_signer_cert(CMS_SignerInfo *si, X509 *signer); +int CMS_SignerInfo_get0_signer_id(CMS_SignerInfo *si, + ASN1_OCTET_STRING **keyid, + X509_NAME **issuer, ASN1_INTEGER **sno); +int CMS_SignerInfo_cert_cmp(CMS_SignerInfo *si, X509 *cert); +int CMS_set1_signers_certs(CMS_ContentInfo *cms, STACK_OF(X509) *certs, + unsigned int flags); +void CMS_SignerInfo_get0_algs(CMS_SignerInfo *si, EVP_PKEY **pk, + X509 **signer, X509_ALGOR **pdig, + X509_ALGOR **psig); +ASN1_OCTET_STRING *CMS_SignerInfo_get0_signature(CMS_SignerInfo *si); +int CMS_SignerInfo_sign(CMS_SignerInfo *si); +int CMS_SignerInfo_verify(CMS_SignerInfo *si); +int CMS_SignerInfo_verify_content(CMS_SignerInfo *si, BIO *chain); + +int CMS_add_smimecap(CMS_SignerInfo *si, STACK_OF(X509_ALGOR) *algs); +int CMS_add_simple_smimecap(STACK_OF(X509_ALGOR) **algs, + int algnid, int keysize); +int CMS_add_standard_smimecap(STACK_OF(X509_ALGOR) **smcap); + +int CMS_signed_get_attr_count(const CMS_SignerInfo *si); +int CMS_signed_get_attr_by_NID(const CMS_SignerInfo *si, int nid, + int lastpos); +int CMS_signed_get_attr_by_OBJ(const CMS_SignerInfo *si, const ASN1_OBJECT *obj, + int lastpos); +X509_ATTRIBUTE *CMS_signed_get_attr(const CMS_SignerInfo *si, int loc); +X509_ATTRIBUTE *CMS_signed_delete_attr(CMS_SignerInfo *si, int loc); +int CMS_signed_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr); +int CMS_signed_add1_attr_by_OBJ(CMS_SignerInfo *si, + const ASN1_OBJECT *obj, int type, + const void *bytes, int len); +int CMS_signed_add1_attr_by_NID(CMS_SignerInfo *si, + int nid, int type, + const void *bytes, int len); +int CMS_signed_add1_attr_by_txt(CMS_SignerInfo *si, + const char *attrname, int type, + const void *bytes, int len); +void *CMS_signed_get0_data_by_OBJ(CMS_SignerInfo *si, const ASN1_OBJECT *oid, + int lastpos, int type); + +int CMS_unsigned_get_attr_count(const CMS_SignerInfo *si); +int CMS_unsigned_get_attr_by_NID(const CMS_SignerInfo *si, int nid, + int lastpos); +int CMS_unsigned_get_attr_by_OBJ(const CMS_SignerInfo *si, + const ASN1_OBJECT *obj, int lastpos); +X509_ATTRIBUTE *CMS_unsigned_get_attr(const CMS_SignerInfo *si, int loc); +X509_ATTRIBUTE *CMS_unsigned_delete_attr(CMS_SignerInfo *si, int loc); +int CMS_unsigned_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr); +int CMS_unsigned_add1_attr_by_OBJ(CMS_SignerInfo *si, + const ASN1_OBJECT *obj, int type, + const void *bytes, int len); +int CMS_unsigned_add1_attr_by_NID(CMS_SignerInfo *si, + int nid, int type, + const void *bytes, int len); +int CMS_unsigned_add1_attr_by_txt(CMS_SignerInfo *si, + const char *attrname, int type, + const void *bytes, int len); +void *CMS_unsigned_get0_data_by_OBJ(CMS_SignerInfo *si, ASN1_OBJECT *oid, + int lastpos, int type); + +int CMS_get1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest **prr); +CMS_ReceiptRequest *CMS_ReceiptRequest_create0(unsigned char *id, int idlen, + int allorfirst, + STACK_OF(GENERAL_NAMES) + *receiptList, STACK_OF(GENERAL_NAMES) + *receiptsTo); +int CMS_add1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest *rr); +void CMS_ReceiptRequest_get0_values(CMS_ReceiptRequest *rr, + ASN1_STRING **pcid, + int *pallorfirst, + STACK_OF(GENERAL_NAMES) **plist, + STACK_OF(GENERAL_NAMES) **prto); +int CMS_RecipientInfo_kari_get0_alg(CMS_RecipientInfo *ri, + X509_ALGOR **palg, + ASN1_OCTET_STRING **pukm); +STACK_OF(CMS_RecipientEncryptedKey) +*CMS_RecipientInfo_kari_get0_reks(CMS_RecipientInfo *ri); + +int CMS_RecipientInfo_kari_get0_orig_id(CMS_RecipientInfo *ri, + X509_ALGOR **pubalg, + ASN1_BIT_STRING **pubkey, + ASN1_OCTET_STRING **keyid, + X509_NAME **issuer, + ASN1_INTEGER **sno); + +int CMS_RecipientInfo_kari_orig_id_cmp(CMS_RecipientInfo *ri, X509 *cert); + +int CMS_RecipientEncryptedKey_get0_id(CMS_RecipientEncryptedKey *rek, + ASN1_OCTET_STRING **keyid, + ASN1_GENERALIZEDTIME **tm, + CMS_OtherKeyAttribute **other, + X509_NAME **issuer, ASN1_INTEGER **sno); +int CMS_RecipientEncryptedKey_cert_cmp(CMS_RecipientEncryptedKey *rek, + X509 *cert); +int CMS_RecipientInfo_kari_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pk); +EVP_CIPHER_CTX *CMS_RecipientInfo_kari_get0_ctx(CMS_RecipientInfo *ri); +int CMS_RecipientInfo_kari_decrypt(CMS_ContentInfo *cms, + CMS_RecipientInfo *ri, + CMS_RecipientEncryptedKey *rek); + +int CMS_SharedInfo_encode(unsigned char **pder, X509_ALGOR *kekalg, + ASN1_OCTET_STRING *ukm, int keylen); + +/* Backward compatibility for spelling errors. */ +# define CMS_R_UNKNOWN_DIGEST_ALGORITM CMS_R_UNKNOWN_DIGEST_ALGORITHM +# define CMS_R_UNSUPPORTED_RECPIENTINFO_TYPE \ + CMS_R_UNSUPPORTED_RECIPIENTINFO_TYPE + +# ifdef __cplusplus +} +# endif +# endif +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/cmserr.h b/MediaClient/MediaClient/openssl/include/openssl/cmserr.h new file mode 100644 index 0000000..7dbc13d --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/cmserr.h @@ -0,0 +1,202 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_CMSERR_H +# define HEADER_CMSERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# include + +# ifndef OPENSSL_NO_CMS + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_CMS_strings(void); + +/* + * CMS function codes. + */ +# define CMS_F_CHECK_CONTENT 99 +# define CMS_F_CMS_ADD0_CERT 164 +# define CMS_F_CMS_ADD0_RECIPIENT_KEY 100 +# define CMS_F_CMS_ADD0_RECIPIENT_PASSWORD 165 +# define CMS_F_CMS_ADD1_RECEIPTREQUEST 158 +# define CMS_F_CMS_ADD1_RECIPIENT_CERT 101 +# define CMS_F_CMS_ADD1_SIGNER 102 +# define CMS_F_CMS_ADD1_SIGNINGTIME 103 +# define CMS_F_CMS_COMPRESS 104 +# define CMS_F_CMS_COMPRESSEDDATA_CREATE 105 +# define CMS_F_CMS_COMPRESSEDDATA_INIT_BIO 106 +# define CMS_F_CMS_COPY_CONTENT 107 +# define CMS_F_CMS_COPY_MESSAGEDIGEST 108 +# define CMS_F_CMS_DATA 109 +# define CMS_F_CMS_DATAFINAL 110 +# define CMS_F_CMS_DATAINIT 111 +# define CMS_F_CMS_DECRYPT 112 +# define CMS_F_CMS_DECRYPT_SET1_KEY 113 +# define CMS_F_CMS_DECRYPT_SET1_PASSWORD 166 +# define CMS_F_CMS_DECRYPT_SET1_PKEY 114 +# define CMS_F_CMS_DIGESTALGORITHM_FIND_CTX 115 +# define CMS_F_CMS_DIGESTALGORITHM_INIT_BIO 116 +# define CMS_F_CMS_DIGESTEDDATA_DO_FINAL 117 +# define CMS_F_CMS_DIGEST_VERIFY 118 +# define CMS_F_CMS_ENCODE_RECEIPT 161 +# define CMS_F_CMS_ENCRYPT 119 +# define CMS_F_CMS_ENCRYPTEDCONTENT_INIT 179 +# define CMS_F_CMS_ENCRYPTEDCONTENT_INIT_BIO 120 +# define CMS_F_CMS_ENCRYPTEDDATA_DECRYPT 121 +# define CMS_F_CMS_ENCRYPTEDDATA_ENCRYPT 122 +# define CMS_F_CMS_ENCRYPTEDDATA_SET1_KEY 123 +# define CMS_F_CMS_ENVELOPEDDATA_CREATE 124 +# define CMS_F_CMS_ENVELOPEDDATA_INIT_BIO 125 +# define CMS_F_CMS_ENVELOPED_DATA_INIT 126 +# define CMS_F_CMS_ENV_ASN1_CTRL 171 +# define CMS_F_CMS_FINAL 127 +# define CMS_F_CMS_GET0_CERTIFICATE_CHOICES 128 +# define CMS_F_CMS_GET0_CONTENT 129 +# define CMS_F_CMS_GET0_ECONTENT_TYPE 130 +# define CMS_F_CMS_GET0_ENVELOPED 131 +# define CMS_F_CMS_GET0_REVOCATION_CHOICES 132 +# define CMS_F_CMS_GET0_SIGNED 133 +# define CMS_F_CMS_MSGSIGDIGEST_ADD1 162 +# define CMS_F_CMS_RECEIPTREQUEST_CREATE0 159 +# define CMS_F_CMS_RECEIPT_VERIFY 160 +# define CMS_F_CMS_RECIPIENTINFO_DECRYPT 134 +# define CMS_F_CMS_RECIPIENTINFO_ENCRYPT 169 +# define CMS_F_CMS_RECIPIENTINFO_KARI_ENCRYPT 178 +# define CMS_F_CMS_RECIPIENTINFO_KARI_GET0_ALG 175 +# define CMS_F_CMS_RECIPIENTINFO_KARI_GET0_ORIG_ID 173 +# define CMS_F_CMS_RECIPIENTINFO_KARI_GET0_REKS 172 +# define CMS_F_CMS_RECIPIENTINFO_KARI_ORIG_ID_CMP 174 +# define CMS_F_CMS_RECIPIENTINFO_KEKRI_DECRYPT 135 +# define CMS_F_CMS_RECIPIENTINFO_KEKRI_ENCRYPT 136 +# define CMS_F_CMS_RECIPIENTINFO_KEKRI_GET0_ID 137 +# define CMS_F_CMS_RECIPIENTINFO_KEKRI_ID_CMP 138 +# define CMS_F_CMS_RECIPIENTINFO_KTRI_CERT_CMP 139 +# define CMS_F_CMS_RECIPIENTINFO_KTRI_DECRYPT 140 +# define CMS_F_CMS_RECIPIENTINFO_KTRI_ENCRYPT 141 +# define CMS_F_CMS_RECIPIENTINFO_KTRI_GET0_ALGS 142 +# define CMS_F_CMS_RECIPIENTINFO_KTRI_GET0_SIGNER_ID 143 +# define CMS_F_CMS_RECIPIENTINFO_PWRI_CRYPT 167 +# define CMS_F_CMS_RECIPIENTINFO_SET0_KEY 144 +# define CMS_F_CMS_RECIPIENTINFO_SET0_PASSWORD 168 +# define CMS_F_CMS_RECIPIENTINFO_SET0_PKEY 145 +# define CMS_F_CMS_SD_ASN1_CTRL 170 +# define CMS_F_CMS_SET1_IAS 176 +# define CMS_F_CMS_SET1_KEYID 177 +# define CMS_F_CMS_SET1_SIGNERIDENTIFIER 146 +# define CMS_F_CMS_SET_DETACHED 147 +# define CMS_F_CMS_SIGN 148 +# define CMS_F_CMS_SIGNED_DATA_INIT 149 +# define CMS_F_CMS_SIGNERINFO_CONTENT_SIGN 150 +# define CMS_F_CMS_SIGNERINFO_SIGN 151 +# define CMS_F_CMS_SIGNERINFO_VERIFY 152 +# define CMS_F_CMS_SIGNERINFO_VERIFY_CERT 153 +# define CMS_F_CMS_SIGNERINFO_VERIFY_CONTENT 154 +# define CMS_F_CMS_SIGN_RECEIPT 163 +# define CMS_F_CMS_SI_CHECK_ATTRIBUTES 183 +# define CMS_F_CMS_STREAM 155 +# define CMS_F_CMS_UNCOMPRESS 156 +# define CMS_F_CMS_VERIFY 157 +# define CMS_F_KEK_UNWRAP_KEY 180 + +/* + * CMS reason codes. + */ +# define CMS_R_ADD_SIGNER_ERROR 99 +# define CMS_R_ATTRIBUTE_ERROR 161 +# define CMS_R_CERTIFICATE_ALREADY_PRESENT 175 +# define CMS_R_CERTIFICATE_HAS_NO_KEYID 160 +# define CMS_R_CERTIFICATE_VERIFY_ERROR 100 +# define CMS_R_CIPHER_INITIALISATION_ERROR 101 +# define CMS_R_CIPHER_PARAMETER_INITIALISATION_ERROR 102 +# define CMS_R_CMS_DATAFINAL_ERROR 103 +# define CMS_R_CMS_LIB 104 +# define CMS_R_CONTENTIDENTIFIER_MISMATCH 170 +# define CMS_R_CONTENT_NOT_FOUND 105 +# define CMS_R_CONTENT_TYPE_MISMATCH 171 +# define CMS_R_CONTENT_TYPE_NOT_COMPRESSED_DATA 106 +# define CMS_R_CONTENT_TYPE_NOT_ENVELOPED_DATA 107 +# define CMS_R_CONTENT_TYPE_NOT_SIGNED_DATA 108 +# define CMS_R_CONTENT_VERIFY_ERROR 109 +# define CMS_R_CTRL_ERROR 110 +# define CMS_R_CTRL_FAILURE 111 +# define CMS_R_DECRYPT_ERROR 112 +# define CMS_R_ERROR_GETTING_PUBLIC_KEY 113 +# define CMS_R_ERROR_READING_MESSAGEDIGEST_ATTRIBUTE 114 +# define CMS_R_ERROR_SETTING_KEY 115 +# define CMS_R_ERROR_SETTING_RECIPIENTINFO 116 +# define CMS_R_INVALID_ENCRYPTED_KEY_LENGTH 117 +# define CMS_R_INVALID_KEY_ENCRYPTION_PARAMETER 176 +# define CMS_R_INVALID_KEY_LENGTH 118 +# define CMS_R_MD_BIO_INIT_ERROR 119 +# define CMS_R_MESSAGEDIGEST_ATTRIBUTE_WRONG_LENGTH 120 +# define CMS_R_MESSAGEDIGEST_WRONG_LENGTH 121 +# define CMS_R_MSGSIGDIGEST_ERROR 172 +# define CMS_R_MSGSIGDIGEST_VERIFICATION_FAILURE 162 +# define CMS_R_MSGSIGDIGEST_WRONG_LENGTH 163 +# define CMS_R_NEED_ONE_SIGNER 164 +# define CMS_R_NOT_A_SIGNED_RECEIPT 165 +# define CMS_R_NOT_ENCRYPTED_DATA 122 +# define CMS_R_NOT_KEK 123 +# define CMS_R_NOT_KEY_AGREEMENT 181 +# define CMS_R_NOT_KEY_TRANSPORT 124 +# define CMS_R_NOT_PWRI 177 +# define CMS_R_NOT_SUPPORTED_FOR_THIS_KEY_TYPE 125 +# define CMS_R_NO_CIPHER 126 +# define CMS_R_NO_CONTENT 127 +# define CMS_R_NO_CONTENT_TYPE 173 +# define CMS_R_NO_DEFAULT_DIGEST 128 +# define CMS_R_NO_DIGEST_SET 129 +# define CMS_R_NO_KEY 130 +# define CMS_R_NO_KEY_OR_CERT 174 +# define CMS_R_NO_MATCHING_DIGEST 131 +# define CMS_R_NO_MATCHING_RECIPIENT 132 +# define CMS_R_NO_MATCHING_SIGNATURE 166 +# define CMS_R_NO_MSGSIGDIGEST 167 +# define CMS_R_NO_PASSWORD 178 +# define CMS_R_NO_PRIVATE_KEY 133 +# define CMS_R_NO_PUBLIC_KEY 134 +# define CMS_R_NO_RECEIPT_REQUEST 168 +# define CMS_R_NO_SIGNERS 135 +# define CMS_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 136 +# define CMS_R_RECEIPT_DECODE_ERROR 169 +# define CMS_R_RECIPIENT_ERROR 137 +# define CMS_R_SIGNER_CERTIFICATE_NOT_FOUND 138 +# define CMS_R_SIGNFINAL_ERROR 139 +# define CMS_R_SMIME_TEXT_ERROR 140 +# define CMS_R_STORE_INIT_ERROR 141 +# define CMS_R_TYPE_NOT_COMPRESSED_DATA 142 +# define CMS_R_TYPE_NOT_DATA 143 +# define CMS_R_TYPE_NOT_DIGESTED_DATA 144 +# define CMS_R_TYPE_NOT_ENCRYPTED_DATA 145 +# define CMS_R_TYPE_NOT_ENVELOPED_DATA 146 +# define CMS_R_UNABLE_TO_FINALIZE_CONTEXT 147 +# define CMS_R_UNKNOWN_CIPHER 148 +# define CMS_R_UNKNOWN_DIGEST_ALGORITHM 149 +# define CMS_R_UNKNOWN_ID 150 +# define CMS_R_UNSUPPORTED_COMPRESSION_ALGORITHM 151 +# define CMS_R_UNSUPPORTED_CONTENT_TYPE 152 +# define CMS_R_UNSUPPORTED_KEK_ALGORITHM 153 +# define CMS_R_UNSUPPORTED_KEY_ENCRYPTION_ALGORITHM 179 +# define CMS_R_UNSUPPORTED_RECIPIENTINFO_TYPE 155 +# define CMS_R_UNSUPPORTED_RECIPIENT_TYPE 154 +# define CMS_R_UNSUPPORTED_TYPE 156 +# define CMS_R_UNWRAP_ERROR 157 +# define CMS_R_UNWRAP_FAILURE 180 +# define CMS_R_VERIFICATION_FAILURE 158 +# define CMS_R_WRAP_ERROR 159 + +# endif +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/comp.h b/MediaClient/MediaClient/openssl/include/openssl/comp.h new file mode 100644 index 0000000..d814d3c --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/comp.h @@ -0,0 +1,53 @@ +/* + * Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_COMP_H +# define HEADER_COMP_H + +# include + +# ifndef OPENSSL_NO_COMP +# include +# include +# ifdef __cplusplus +extern "C" { +# endif + + + +COMP_CTX *COMP_CTX_new(COMP_METHOD *meth); +const COMP_METHOD *COMP_CTX_get_method(const COMP_CTX *ctx); +int COMP_CTX_get_type(const COMP_CTX* comp); +int COMP_get_type(const COMP_METHOD *meth); +const char *COMP_get_name(const COMP_METHOD *meth); +void COMP_CTX_free(COMP_CTX *ctx); + +int COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen, + unsigned char *in, int ilen); +int COMP_expand_block(COMP_CTX *ctx, unsigned char *out, int olen, + unsigned char *in, int ilen); + +COMP_METHOD *COMP_zlib(void); + +#if OPENSSL_API_COMPAT < 0x10100000L +#define COMP_zlib_cleanup() while(0) continue +#endif + +# ifdef HEADER_BIO_H +# ifdef ZLIB +const BIO_METHOD *BIO_f_zlib(void); +# endif +# endif + + +# ifdef __cplusplus +} +# endif +# endif +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/comperr.h b/MediaClient/MediaClient/openssl/include/openssl/comperr.h new file mode 100644 index 0000000..90231e9 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/comperr.h @@ -0,0 +1,44 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_COMPERR_H +# define HEADER_COMPERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# include + +# ifndef OPENSSL_NO_COMP + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_COMP_strings(void); + +/* + * COMP function codes. + */ +# define COMP_F_BIO_ZLIB_FLUSH 99 +# define COMP_F_BIO_ZLIB_NEW 100 +# define COMP_F_BIO_ZLIB_READ 101 +# define COMP_F_BIO_ZLIB_WRITE 102 +# define COMP_F_COMP_CTX_NEW 103 + +/* + * COMP reason codes. + */ +# define COMP_R_ZLIB_DEFLATE_ERROR 99 +# define COMP_R_ZLIB_INFLATE_ERROR 100 +# define COMP_R_ZLIB_NOT_SUPPORTED 101 + +# endif +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/conf.h b/MediaClient/MediaClient/openssl/include/openssl/conf.h new file mode 100644 index 0000000..7336cd2 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/conf.h @@ -0,0 +1,168 @@ +/* + * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_CONF_H +# define HEADER_CONF_H + +# include +# include +# include +# include +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { + char *section; + char *name; + char *value; +} CONF_VALUE; + +DEFINE_STACK_OF(CONF_VALUE) +DEFINE_LHASH_OF(CONF_VALUE); + +struct conf_st; +struct conf_method_st; +typedef struct conf_method_st CONF_METHOD; + +struct conf_method_st { + const char *name; + CONF *(*create) (CONF_METHOD *meth); + int (*init) (CONF *conf); + int (*destroy) (CONF *conf); + int (*destroy_data) (CONF *conf); + int (*load_bio) (CONF *conf, BIO *bp, long *eline); + int (*dump) (const CONF *conf, BIO *bp); + int (*is_number) (const CONF *conf, char c); + int (*to_int) (const CONF *conf, char c); + int (*load) (CONF *conf, const char *name, long *eline); +}; + +/* Module definitions */ + +typedef struct conf_imodule_st CONF_IMODULE; +typedef struct conf_module_st CONF_MODULE; + +DEFINE_STACK_OF(CONF_MODULE) +DEFINE_STACK_OF(CONF_IMODULE) + +/* DSO module function typedefs */ +typedef int conf_init_func (CONF_IMODULE *md, const CONF *cnf); +typedef void conf_finish_func (CONF_IMODULE *md); + +# define CONF_MFLAGS_IGNORE_ERRORS 0x1 +# define CONF_MFLAGS_IGNORE_RETURN_CODES 0x2 +# define CONF_MFLAGS_SILENT 0x4 +# define CONF_MFLAGS_NO_DSO 0x8 +# define CONF_MFLAGS_IGNORE_MISSING_FILE 0x10 +# define CONF_MFLAGS_DEFAULT_SECTION 0x20 + +int CONF_set_default_method(CONF_METHOD *meth); +void CONF_set_nconf(CONF *conf, LHASH_OF(CONF_VALUE) *hash); +LHASH_OF(CONF_VALUE) *CONF_load(LHASH_OF(CONF_VALUE) *conf, const char *file, + long *eline); +# ifndef OPENSSL_NO_STDIO +LHASH_OF(CONF_VALUE) *CONF_load_fp(LHASH_OF(CONF_VALUE) *conf, FILE *fp, + long *eline); +# endif +LHASH_OF(CONF_VALUE) *CONF_load_bio(LHASH_OF(CONF_VALUE) *conf, BIO *bp, + long *eline); +STACK_OF(CONF_VALUE) *CONF_get_section(LHASH_OF(CONF_VALUE) *conf, + const char *section); +char *CONF_get_string(LHASH_OF(CONF_VALUE) *conf, const char *group, + const char *name); +long CONF_get_number(LHASH_OF(CONF_VALUE) *conf, const char *group, + const char *name); +void CONF_free(LHASH_OF(CONF_VALUE) *conf); +#ifndef OPENSSL_NO_STDIO +int CONF_dump_fp(LHASH_OF(CONF_VALUE) *conf, FILE *out); +#endif +int CONF_dump_bio(LHASH_OF(CONF_VALUE) *conf, BIO *out); + +DEPRECATEDIN_1_1_0(void OPENSSL_config(const char *config_name)) + +#if OPENSSL_API_COMPAT < 0x10100000L +# define OPENSSL_no_config() \ + OPENSSL_init_crypto(OPENSSL_INIT_NO_LOAD_CONFIG, NULL) +#endif + +/* + * New conf code. The semantics are different from the functions above. If + * that wasn't the case, the above functions would have been replaced + */ + +struct conf_st { + CONF_METHOD *meth; + void *meth_data; + LHASH_OF(CONF_VALUE) *data; +}; + +CONF *NCONF_new(CONF_METHOD *meth); +CONF_METHOD *NCONF_default(void); +CONF_METHOD *NCONF_WIN32(void); +void NCONF_free(CONF *conf); +void NCONF_free_data(CONF *conf); + +int NCONF_load(CONF *conf, const char *file, long *eline); +# ifndef OPENSSL_NO_STDIO +int NCONF_load_fp(CONF *conf, FILE *fp, long *eline); +# endif +int NCONF_load_bio(CONF *conf, BIO *bp, long *eline); +STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf, + const char *section); +char *NCONF_get_string(const CONF *conf, const char *group, const char *name); +int NCONF_get_number_e(const CONF *conf, const char *group, const char *name, + long *result); +#ifndef OPENSSL_NO_STDIO +int NCONF_dump_fp(const CONF *conf, FILE *out); +#endif +int NCONF_dump_bio(const CONF *conf, BIO *out); + +#define NCONF_get_number(c,g,n,r) NCONF_get_number_e(c,g,n,r) + +/* Module functions */ + +int CONF_modules_load(const CONF *cnf, const char *appname, + unsigned long flags); +int CONF_modules_load_file(const char *filename, const char *appname, + unsigned long flags); +void CONF_modules_unload(int all); +void CONF_modules_finish(void); +#if OPENSSL_API_COMPAT < 0x10100000L +# define CONF_modules_free() while(0) continue +#endif +int CONF_module_add(const char *name, conf_init_func *ifunc, + conf_finish_func *ffunc); + +const char *CONF_imodule_get_name(const CONF_IMODULE *md); +const char *CONF_imodule_get_value(const CONF_IMODULE *md); +void *CONF_imodule_get_usr_data(const CONF_IMODULE *md); +void CONF_imodule_set_usr_data(CONF_IMODULE *md, void *usr_data); +CONF_MODULE *CONF_imodule_get_module(const CONF_IMODULE *md); +unsigned long CONF_imodule_get_flags(const CONF_IMODULE *md); +void CONF_imodule_set_flags(CONF_IMODULE *md, unsigned long flags); +void *CONF_module_get_usr_data(CONF_MODULE *pmod); +void CONF_module_set_usr_data(CONF_MODULE *pmod, void *usr_data); + +char *CONF_get1_default_config_file(void); + +int CONF_parse_list(const char *list, int sep, int nospc, + int (*list_cb) (const char *elem, int len, void *usr), + void *arg); + +void OPENSSL_load_builtin_modules(void); + + +# ifdef __cplusplus +} +# endif +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/conf_api.h b/MediaClient/MediaClient/openssl/include/openssl/conf_api.h new file mode 100644 index 0000000..a0275ad --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/conf_api.h @@ -0,0 +1,40 @@ +/* + * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_CONF_API_H +# define HEADER_CONF_API_H + +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Up until OpenSSL 0.9.5a, this was new_section */ +CONF_VALUE *_CONF_new_section(CONF *conf, const char *section); +/* Up until OpenSSL 0.9.5a, this was get_section */ +CONF_VALUE *_CONF_get_section(const CONF *conf, const char *section); +/* Up until OpenSSL 0.9.5a, this was CONF_get_section */ +STACK_OF(CONF_VALUE) *_CONF_get_section_values(const CONF *conf, + const char *section); + +int _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value); +char *_CONF_get_string(const CONF *conf, const char *section, + const char *name); +long _CONF_get_number(const CONF *conf, const char *section, + const char *name); + +int _CONF_new_data(CONF *conf); +void _CONF_free_data(CONF *conf); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/conferr.h b/MediaClient/MediaClient/openssl/include/openssl/conferr.h new file mode 100644 index 0000000..32b9229 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/conferr.h @@ -0,0 +1,76 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_CONFERR_H +# define HEADER_CONFERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_CONF_strings(void); + +/* + * CONF function codes. + */ +# define CONF_F_CONF_DUMP_FP 104 +# define CONF_F_CONF_LOAD 100 +# define CONF_F_CONF_LOAD_FP 103 +# define CONF_F_CONF_PARSE_LIST 119 +# define CONF_F_DEF_LOAD 120 +# define CONF_F_DEF_LOAD_BIO 121 +# define CONF_F_GET_NEXT_FILE 107 +# define CONF_F_MODULE_ADD 122 +# define CONF_F_MODULE_INIT 115 +# define CONF_F_MODULE_LOAD_DSO 117 +# define CONF_F_MODULE_RUN 118 +# define CONF_F_NCONF_DUMP_BIO 105 +# define CONF_F_NCONF_DUMP_FP 106 +# define CONF_F_NCONF_GET_NUMBER_E 112 +# define CONF_F_NCONF_GET_SECTION 108 +# define CONF_F_NCONF_GET_STRING 109 +# define CONF_F_NCONF_LOAD 113 +# define CONF_F_NCONF_LOAD_BIO 110 +# define CONF_F_NCONF_LOAD_FP 114 +# define CONF_F_NCONF_NEW 111 +# define CONF_F_PROCESS_INCLUDE 116 +# define CONF_F_SSL_MODULE_INIT 123 +# define CONF_F_STR_COPY 101 + +/* + * CONF reason codes. + */ +# define CONF_R_ERROR_LOADING_DSO 110 +# define CONF_R_LIST_CANNOT_BE_NULL 115 +# define CONF_R_MISSING_CLOSE_SQUARE_BRACKET 100 +# define CONF_R_MISSING_EQUAL_SIGN 101 +# define CONF_R_MISSING_INIT_FUNCTION 112 +# define CONF_R_MODULE_INITIALIZATION_ERROR 109 +# define CONF_R_NO_CLOSE_BRACE 102 +# define CONF_R_NO_CONF 105 +# define CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE 106 +# define CONF_R_NO_SECTION 107 +# define CONF_R_NO_SUCH_FILE 114 +# define CONF_R_NO_VALUE 108 +# define CONF_R_NUMBER_TOO_LARGE 121 +# define CONF_R_RECURSIVE_DIRECTORY_INCLUDE 111 +# define CONF_R_SSL_COMMAND_SECTION_EMPTY 117 +# define CONF_R_SSL_COMMAND_SECTION_NOT_FOUND 118 +# define CONF_R_SSL_SECTION_EMPTY 119 +# define CONF_R_SSL_SECTION_NOT_FOUND 120 +# define CONF_R_UNABLE_TO_CREATE_NEW_SECTION 103 +# define CONF_R_UNKNOWN_MODULE_NAME 113 +# define CONF_R_VARIABLE_EXPANSION_TOO_LONG 116 +# define CONF_R_VARIABLE_HAS_NO_VALUE 104 + +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/crypto.h b/MediaClient/MediaClient/openssl/include/openssl/crypto.h new file mode 100644 index 0000000..7d0b526 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/crypto.h @@ -0,0 +1,445 @@ +/* + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_CRYPTO_H +# define HEADER_CRYPTO_H + +# include +# include + +# include + +# ifndef OPENSSL_NO_STDIO +# include +# endif + +# include +# include +# include +# include +# include + +# ifdef CHARSET_EBCDIC +# include +# endif + +/* + * Resolve problems on some operating systems with symbol names that clash + * one way or another + */ +# include + +# if OPENSSL_API_COMPAT < 0x10100000L +# include +# endif + +#ifdef __cplusplus +extern "C" { +#endif + +# if OPENSSL_API_COMPAT < 0x10100000L +# define SSLeay OpenSSL_version_num +# define SSLeay_version OpenSSL_version +# define SSLEAY_VERSION_NUMBER OPENSSL_VERSION_NUMBER +# define SSLEAY_VERSION OPENSSL_VERSION +# define SSLEAY_CFLAGS OPENSSL_CFLAGS +# define SSLEAY_BUILT_ON OPENSSL_BUILT_ON +# define SSLEAY_PLATFORM OPENSSL_PLATFORM +# define SSLEAY_DIR OPENSSL_DIR + +/* + * Old type for allocating dynamic locks. No longer used. Use the new thread + * API instead. + */ +typedef struct { + int dummy; +} CRYPTO_dynlock; + +# endif /* OPENSSL_API_COMPAT */ + +typedef void CRYPTO_RWLOCK; + +CRYPTO_RWLOCK *CRYPTO_THREAD_lock_new(void); +int CRYPTO_THREAD_read_lock(CRYPTO_RWLOCK *lock); +int CRYPTO_THREAD_write_lock(CRYPTO_RWLOCK *lock); +int CRYPTO_THREAD_unlock(CRYPTO_RWLOCK *lock); +void CRYPTO_THREAD_lock_free(CRYPTO_RWLOCK *lock); + +int CRYPTO_atomic_add(int *val, int amount, int *ret, CRYPTO_RWLOCK *lock); + +/* + * The following can be used to detect memory leaks in the library. If + * used, it turns on malloc checking + */ +# define CRYPTO_MEM_CHECK_OFF 0x0 /* Control only */ +# define CRYPTO_MEM_CHECK_ON 0x1 /* Control and mode bit */ +# define CRYPTO_MEM_CHECK_ENABLE 0x2 /* Control and mode bit */ +# define CRYPTO_MEM_CHECK_DISABLE 0x3 /* Control only */ + +struct crypto_ex_data_st { + STACK_OF(void) *sk; +}; +DEFINE_STACK_OF(void) + +/* + * Per class, we have a STACK of function pointers. + */ +# define CRYPTO_EX_INDEX_SSL 0 +# define CRYPTO_EX_INDEX_SSL_CTX 1 +# define CRYPTO_EX_INDEX_SSL_SESSION 2 +# define CRYPTO_EX_INDEX_X509 3 +# define CRYPTO_EX_INDEX_X509_STORE 4 +# define CRYPTO_EX_INDEX_X509_STORE_CTX 5 +# define CRYPTO_EX_INDEX_DH 6 +# define CRYPTO_EX_INDEX_DSA 7 +# define CRYPTO_EX_INDEX_EC_KEY 8 +# define CRYPTO_EX_INDEX_RSA 9 +# define CRYPTO_EX_INDEX_ENGINE 10 +# define CRYPTO_EX_INDEX_UI 11 +# define CRYPTO_EX_INDEX_BIO 12 +# define CRYPTO_EX_INDEX_APP 13 +# define CRYPTO_EX_INDEX_UI_METHOD 14 +# define CRYPTO_EX_INDEX_DRBG 15 +# define CRYPTO_EX_INDEX__COUNT 16 + +/* No longer needed, so this is a no-op */ +#define OPENSSL_malloc_init() while(0) continue + +int CRYPTO_mem_ctrl(int mode); + +# define OPENSSL_malloc(num) \ + CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE) +# define OPENSSL_zalloc(num) \ + CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE) +# define OPENSSL_realloc(addr, num) \ + CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE) +# define OPENSSL_clear_realloc(addr, old_num, num) \ + CRYPTO_clear_realloc(addr, old_num, num, OPENSSL_FILE, OPENSSL_LINE) +# define OPENSSL_clear_free(addr, num) \ + CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE) +# define OPENSSL_free(addr) \ + CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE) +# define OPENSSL_memdup(str, s) \ + CRYPTO_memdup((str), s, OPENSSL_FILE, OPENSSL_LINE) +# define OPENSSL_strdup(str) \ + CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE) +# define OPENSSL_strndup(str, n) \ + CRYPTO_strndup(str, n, OPENSSL_FILE, OPENSSL_LINE) +# define OPENSSL_secure_malloc(num) \ + CRYPTO_secure_malloc(num, OPENSSL_FILE, OPENSSL_LINE) +# define OPENSSL_secure_zalloc(num) \ + CRYPTO_secure_zalloc(num, OPENSSL_FILE, OPENSSL_LINE) +# define OPENSSL_secure_free(addr) \ + CRYPTO_secure_free(addr, OPENSSL_FILE, OPENSSL_LINE) +# define OPENSSL_secure_clear_free(addr, num) \ + CRYPTO_secure_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE) +# define OPENSSL_secure_actual_size(ptr) \ + CRYPTO_secure_actual_size(ptr) + +size_t OPENSSL_strlcpy(char *dst, const char *src, size_t siz); +size_t OPENSSL_strlcat(char *dst, const char *src, size_t siz); +size_t OPENSSL_strnlen(const char *str, size_t maxlen); +char *OPENSSL_buf2hexstr(const unsigned char *buffer, long len); +unsigned char *OPENSSL_hexstr2buf(const char *str, long *len); +int OPENSSL_hexchar2int(unsigned char c); + +# define OPENSSL_MALLOC_MAX_NELEMS(type) (((1U<<(sizeof(int)*8-1))-1)/sizeof(type)) + +unsigned long OpenSSL_version_num(void); +const char *OpenSSL_version(int type); +# define OPENSSL_VERSION 0 +# define OPENSSL_CFLAGS 1 +# define OPENSSL_BUILT_ON 2 +# define OPENSSL_PLATFORM 3 +# define OPENSSL_DIR 4 +# define OPENSSL_ENGINES_DIR 5 + +int OPENSSL_issetugid(void); + +typedef void CRYPTO_EX_new (void *parent, void *ptr, CRYPTO_EX_DATA *ad, + int idx, long argl, void *argp); +typedef void CRYPTO_EX_free (void *parent, void *ptr, CRYPTO_EX_DATA *ad, + int idx, long argl, void *argp); +typedef int CRYPTO_EX_dup (CRYPTO_EX_DATA *to, const CRYPTO_EX_DATA *from, + void *from_d, int idx, long argl, void *argp); +__owur int CRYPTO_get_ex_new_index(int class_index, long argl, void *argp, + CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, + CRYPTO_EX_free *free_func); +/* No longer use an index. */ +int CRYPTO_free_ex_index(int class_index, int idx); + +/* + * Initialise/duplicate/free CRYPTO_EX_DATA variables corresponding to a + * given class (invokes whatever per-class callbacks are applicable) + */ +int CRYPTO_new_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad); +int CRYPTO_dup_ex_data(int class_index, CRYPTO_EX_DATA *to, + const CRYPTO_EX_DATA *from); + +void CRYPTO_free_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad); + +/* + * Get/set data in a CRYPTO_EX_DATA variable corresponding to a particular + * index (relative to the class type involved) + */ +int CRYPTO_set_ex_data(CRYPTO_EX_DATA *ad, int idx, void *val); +void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx); + +# if OPENSSL_API_COMPAT < 0x10100000L +/* + * This function cleans up all "ex_data" state. It mustn't be called under + * potential race-conditions. + */ +# define CRYPTO_cleanup_all_ex_data() while(0) continue + +/* + * The old locking functions have been removed completely without compatibility + * macros. This is because the old functions either could not properly report + * errors, or the returned error values were not clearly documented. + * Replacing the locking functions with no-ops would cause race condition + * issues in the affected applications. It is far better for them to fail at + * compile time. + * On the other hand, the locking callbacks are no longer used. Consequently, + * the callback management functions can be safely replaced with no-op macros. + */ +# define CRYPTO_num_locks() (1) +# define CRYPTO_set_locking_callback(func) +# define CRYPTO_get_locking_callback() (NULL) +# define CRYPTO_set_add_lock_callback(func) +# define CRYPTO_get_add_lock_callback() (NULL) + +/* + * These defines where used in combination with the old locking callbacks, + * they are not called anymore, but old code that's not called might still + * use them. + */ +# define CRYPTO_LOCK 1 +# define CRYPTO_UNLOCK 2 +# define CRYPTO_READ 4 +# define CRYPTO_WRITE 8 + +/* This structure is no longer used */ +typedef struct crypto_threadid_st { + int dummy; +} CRYPTO_THREADID; +/* Only use CRYPTO_THREADID_set_[numeric|pointer]() within callbacks */ +# define CRYPTO_THREADID_set_numeric(id, val) +# define CRYPTO_THREADID_set_pointer(id, ptr) +# define CRYPTO_THREADID_set_callback(threadid_func) (0) +# define CRYPTO_THREADID_get_callback() (NULL) +# define CRYPTO_THREADID_current(id) +# define CRYPTO_THREADID_cmp(a, b) (-1) +# define CRYPTO_THREADID_cpy(dest, src) +# define CRYPTO_THREADID_hash(id) (0UL) + +# if OPENSSL_API_COMPAT < 0x10000000L +# define CRYPTO_set_id_callback(func) +# define CRYPTO_get_id_callback() (NULL) +# define CRYPTO_thread_id() (0UL) +# endif /* OPENSSL_API_COMPAT < 0x10000000L */ + +# define CRYPTO_set_dynlock_create_callback(dyn_create_function) +# define CRYPTO_set_dynlock_lock_callback(dyn_lock_function) +# define CRYPTO_set_dynlock_destroy_callback(dyn_destroy_function) +# define CRYPTO_get_dynlock_create_callback() (NULL) +# define CRYPTO_get_dynlock_lock_callback() (NULL) +# define CRYPTO_get_dynlock_destroy_callback() (NULL) +# endif /* OPENSSL_API_COMPAT < 0x10100000L */ + +int CRYPTO_set_mem_functions( + void *(*m) (size_t, const char *, int), + void *(*r) (void *, size_t, const char *, int), + void (*f) (void *, const char *, int)); +int CRYPTO_set_mem_debug(int flag); +void CRYPTO_get_mem_functions( + void *(**m) (size_t, const char *, int), + void *(**r) (void *, size_t, const char *, int), + void (**f) (void *, const char *, int)); + +void *CRYPTO_malloc(size_t num, const char *file, int line); +void *CRYPTO_zalloc(size_t num, const char *file, int line); +void *CRYPTO_memdup(const void *str, size_t siz, const char *file, int line); +char *CRYPTO_strdup(const char *str, const char *file, int line); +char *CRYPTO_strndup(const char *str, size_t s, const char *file, int line); +void CRYPTO_free(void *ptr, const char *file, int line); +void CRYPTO_clear_free(void *ptr, size_t num, const char *file, int line); +void *CRYPTO_realloc(void *addr, size_t num, const char *file, int line); +void *CRYPTO_clear_realloc(void *addr, size_t old_num, size_t num, + const char *file, int line); + +int CRYPTO_secure_malloc_init(size_t sz, int minsize); +int CRYPTO_secure_malloc_done(void); +void *CRYPTO_secure_malloc(size_t num, const char *file, int line); +void *CRYPTO_secure_zalloc(size_t num, const char *file, int line); +void CRYPTO_secure_free(void *ptr, const char *file, int line); +void CRYPTO_secure_clear_free(void *ptr, size_t num, + const char *file, int line); +int CRYPTO_secure_allocated(const void *ptr); +int CRYPTO_secure_malloc_initialized(void); +size_t CRYPTO_secure_actual_size(void *ptr); +size_t CRYPTO_secure_used(void); + +void OPENSSL_cleanse(void *ptr, size_t len); + +# ifndef OPENSSL_NO_CRYPTO_MDEBUG +# define OPENSSL_mem_debug_push(info) \ + CRYPTO_mem_debug_push(info, OPENSSL_FILE, OPENSSL_LINE) +# define OPENSSL_mem_debug_pop() \ + CRYPTO_mem_debug_pop() +int CRYPTO_mem_debug_push(const char *info, const char *file, int line); +int CRYPTO_mem_debug_pop(void); +void CRYPTO_get_alloc_counts(int *mcount, int *rcount, int *fcount); + +/*- + * Debugging functions (enabled by CRYPTO_set_mem_debug(1)) + * The flag argument has the following significance: + * 0: called before the actual memory allocation has taken place + * 1: called after the actual memory allocation has taken place + */ +void CRYPTO_mem_debug_malloc(void *addr, size_t num, int flag, + const char *file, int line); +void CRYPTO_mem_debug_realloc(void *addr1, void *addr2, size_t num, int flag, + const char *file, int line); +void CRYPTO_mem_debug_free(void *addr, int flag, + const char *file, int line); + +int CRYPTO_mem_leaks_cb(int (*cb) (const char *str, size_t len, void *u), + void *u); +# ifndef OPENSSL_NO_STDIO +int CRYPTO_mem_leaks_fp(FILE *); +# endif +int CRYPTO_mem_leaks(BIO *bio); +# endif + +/* die if we have to */ +ossl_noreturn void OPENSSL_die(const char *assertion, const char *file, int line); +# if OPENSSL_API_COMPAT < 0x10100000L +# define OpenSSLDie(f,l,a) OPENSSL_die((a),(f),(l)) +# endif +# define OPENSSL_assert(e) \ + (void)((e) ? 0 : (OPENSSL_die("assertion failed: " #e, OPENSSL_FILE, OPENSSL_LINE), 1)) + +int OPENSSL_isservice(void); + +int FIPS_mode(void); +int FIPS_mode_set(int r); + +void OPENSSL_init(void); +# ifdef OPENSSL_SYS_UNIX +void OPENSSL_fork_prepare(void); +void OPENSSL_fork_parent(void); +void OPENSSL_fork_child(void); +# endif + +struct tm *OPENSSL_gmtime(const time_t *timer, struct tm *result); +int OPENSSL_gmtime_adj(struct tm *tm, int offset_day, long offset_sec); +int OPENSSL_gmtime_diff(int *pday, int *psec, + const struct tm *from, const struct tm *to); + +/* + * CRYPTO_memcmp returns zero iff the |len| bytes at |a| and |b| are equal. + * It takes an amount of time dependent on |len|, but independent of the + * contents of |a| and |b|. Unlike memcmp, it cannot be used to put elements + * into a defined order as the return value when a != b is undefined, other + * than to be non-zero. + */ +int CRYPTO_memcmp(const void * in_a, const void * in_b, size_t len); + +/* Standard initialisation options */ +# define OPENSSL_INIT_NO_LOAD_CRYPTO_STRINGS 0x00000001L +# define OPENSSL_INIT_LOAD_CRYPTO_STRINGS 0x00000002L +# define OPENSSL_INIT_ADD_ALL_CIPHERS 0x00000004L +# define OPENSSL_INIT_ADD_ALL_DIGESTS 0x00000008L +# define OPENSSL_INIT_NO_ADD_ALL_CIPHERS 0x00000010L +# define OPENSSL_INIT_NO_ADD_ALL_DIGESTS 0x00000020L +# define OPENSSL_INIT_LOAD_CONFIG 0x00000040L +# define OPENSSL_INIT_NO_LOAD_CONFIG 0x00000080L +# define OPENSSL_INIT_ASYNC 0x00000100L +# define OPENSSL_INIT_ENGINE_RDRAND 0x00000200L +# define OPENSSL_INIT_ENGINE_DYNAMIC 0x00000400L +# define OPENSSL_INIT_ENGINE_OPENSSL 0x00000800L +# define OPENSSL_INIT_ENGINE_CRYPTODEV 0x00001000L +# define OPENSSL_INIT_ENGINE_CAPI 0x00002000L +# define OPENSSL_INIT_ENGINE_PADLOCK 0x00004000L +# define OPENSSL_INIT_ENGINE_AFALG 0x00008000L +/* OPENSSL_INIT_ZLIB 0x00010000L */ +# define OPENSSL_INIT_ATFORK 0x00020000L +/* OPENSSL_INIT_BASE_ONLY 0x00040000L */ +# define OPENSSL_INIT_NO_ATEXIT 0x00080000L +/* OPENSSL_INIT flag range 0xfff00000 reserved for OPENSSL_init_ssl() */ +/* Max OPENSSL_INIT flag value is 0x80000000 */ + +/* openssl and dasync not counted as builtin */ +# define OPENSSL_INIT_ENGINE_ALL_BUILTIN \ + (OPENSSL_INIT_ENGINE_RDRAND | OPENSSL_INIT_ENGINE_DYNAMIC \ + | OPENSSL_INIT_ENGINE_CRYPTODEV | OPENSSL_INIT_ENGINE_CAPI | \ + OPENSSL_INIT_ENGINE_PADLOCK) + + +/* Library initialisation functions */ +void OPENSSL_cleanup(void); +int OPENSSL_init_crypto(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings); +int OPENSSL_atexit(void (*handler)(void)); +void OPENSSL_thread_stop(void); + +/* Low-level control of initialization */ +OPENSSL_INIT_SETTINGS *OPENSSL_INIT_new(void); +# ifndef OPENSSL_NO_STDIO +int OPENSSL_INIT_set_config_filename(OPENSSL_INIT_SETTINGS *settings, + const char *config_filename); +void OPENSSL_INIT_set_config_file_flags(OPENSSL_INIT_SETTINGS *settings, + unsigned long flags); +int OPENSSL_INIT_set_config_appname(OPENSSL_INIT_SETTINGS *settings, + const char *config_appname); +# endif +void OPENSSL_INIT_free(OPENSSL_INIT_SETTINGS *settings); + +# if defined(OPENSSL_THREADS) && !defined(CRYPTO_TDEBUG) +# if defined(_WIN32) +# if defined(BASETYPES) || defined(_WINDEF_H) +/* application has to include in order to use this */ +typedef DWORD CRYPTO_THREAD_LOCAL; +typedef DWORD CRYPTO_THREAD_ID; + +typedef LONG CRYPTO_ONCE; +# define CRYPTO_ONCE_STATIC_INIT 0 +# endif +# else +# include +typedef pthread_once_t CRYPTO_ONCE; +typedef pthread_key_t CRYPTO_THREAD_LOCAL; +typedef pthread_t CRYPTO_THREAD_ID; + +# define CRYPTO_ONCE_STATIC_INIT PTHREAD_ONCE_INIT +# endif +# endif + +# if !defined(CRYPTO_ONCE_STATIC_INIT) +typedef unsigned int CRYPTO_ONCE; +typedef unsigned int CRYPTO_THREAD_LOCAL; +typedef unsigned int CRYPTO_THREAD_ID; +# define CRYPTO_ONCE_STATIC_INIT 0 +# endif + +int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void)); + +int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void (*cleanup)(void *)); +void *CRYPTO_THREAD_get_local(CRYPTO_THREAD_LOCAL *key); +int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val); +int CRYPTO_THREAD_cleanup_local(CRYPTO_THREAD_LOCAL *key); + +CRYPTO_THREAD_ID CRYPTO_THREAD_get_current_id(void); +int CRYPTO_THREAD_compare_id(CRYPTO_THREAD_ID a, CRYPTO_THREAD_ID b); + + +# ifdef __cplusplus +} +# endif +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/cryptoerr.h b/MediaClient/MediaClient/openssl/include/openssl/cryptoerr.h new file mode 100644 index 0000000..3db5a4e --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/cryptoerr.h @@ -0,0 +1,57 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_CRYPTOERR_H +# define HEADER_CRYPTOERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_CRYPTO_strings(void); + +/* + * CRYPTO function codes. + */ +# define CRYPTO_F_CMAC_CTX_NEW 120 +# define CRYPTO_F_CRYPTO_DUP_EX_DATA 110 +# define CRYPTO_F_CRYPTO_FREE_EX_DATA 111 +# define CRYPTO_F_CRYPTO_GET_EX_NEW_INDEX 100 +# define CRYPTO_F_CRYPTO_MEMDUP 115 +# define CRYPTO_F_CRYPTO_NEW_EX_DATA 112 +# define CRYPTO_F_CRYPTO_OCB128_COPY_CTX 121 +# define CRYPTO_F_CRYPTO_OCB128_INIT 122 +# define CRYPTO_F_CRYPTO_SET_EX_DATA 102 +# define CRYPTO_F_FIPS_MODE_SET 109 +# define CRYPTO_F_GET_AND_LOCK 113 +# define CRYPTO_F_OPENSSL_ATEXIT 114 +# define CRYPTO_F_OPENSSL_BUF2HEXSTR 117 +# define CRYPTO_F_OPENSSL_FOPEN 119 +# define CRYPTO_F_OPENSSL_HEXSTR2BUF 118 +# define CRYPTO_F_OPENSSL_INIT_CRYPTO 116 +# define CRYPTO_F_OPENSSL_LH_NEW 126 +# define CRYPTO_F_OPENSSL_SK_DEEP_COPY 127 +# define CRYPTO_F_OPENSSL_SK_DUP 128 +# define CRYPTO_F_PKEY_HMAC_INIT 123 +# define CRYPTO_F_PKEY_POLY1305_INIT 124 +# define CRYPTO_F_PKEY_SIPHASH_INIT 125 +# define CRYPTO_F_SK_RESERVE 129 + +/* + * CRYPTO reason codes. + */ +# define CRYPTO_R_FIPS_MODE_NOT_SUPPORTED 101 +# define CRYPTO_R_ILLEGAL_HEX_DIGIT 102 +# define CRYPTO_R_ODD_NUMBER_OF_DIGITS 103 + +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/ct.h b/MediaClient/MediaClient/openssl/include/openssl/ct.h new file mode 100644 index 0000000..ebdba34 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/ct.h @@ -0,0 +1,474 @@ +/* + * Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_CT_H +# define HEADER_CT_H + +# include + +# ifndef OPENSSL_NO_CT +# include +# include +# include +# include +# ifdef __cplusplus +extern "C" { +# endif + + +/* Minimum RSA key size, from RFC6962 */ +# define SCT_MIN_RSA_BITS 2048 + +/* All hashes are SHA256 in v1 of Certificate Transparency */ +# define CT_V1_HASHLEN SHA256_DIGEST_LENGTH + +typedef enum { + CT_LOG_ENTRY_TYPE_NOT_SET = -1, + CT_LOG_ENTRY_TYPE_X509 = 0, + CT_LOG_ENTRY_TYPE_PRECERT = 1 +} ct_log_entry_type_t; + +typedef enum { + SCT_VERSION_NOT_SET = -1, + SCT_VERSION_V1 = 0 +} sct_version_t; + +typedef enum { + SCT_SOURCE_UNKNOWN, + SCT_SOURCE_TLS_EXTENSION, + SCT_SOURCE_X509V3_EXTENSION, + SCT_SOURCE_OCSP_STAPLED_RESPONSE +} sct_source_t; + +typedef enum { + SCT_VALIDATION_STATUS_NOT_SET, + SCT_VALIDATION_STATUS_UNKNOWN_LOG, + SCT_VALIDATION_STATUS_VALID, + SCT_VALIDATION_STATUS_INVALID, + SCT_VALIDATION_STATUS_UNVERIFIED, + SCT_VALIDATION_STATUS_UNKNOWN_VERSION +} sct_validation_status_t; + +DEFINE_STACK_OF(SCT) +DEFINE_STACK_OF(CTLOG) + +/****************************************** + * CT policy evaluation context functions * + ******************************************/ + +/* + * Creates a new, empty policy evaluation context. + * The caller is responsible for calling CT_POLICY_EVAL_CTX_free when finished + * with the CT_POLICY_EVAL_CTX. + */ +CT_POLICY_EVAL_CTX *CT_POLICY_EVAL_CTX_new(void); + +/* Deletes a policy evaluation context and anything it owns. */ +void CT_POLICY_EVAL_CTX_free(CT_POLICY_EVAL_CTX *ctx); + +/* Gets the peer certificate that the SCTs are for */ +X509* CT_POLICY_EVAL_CTX_get0_cert(const CT_POLICY_EVAL_CTX *ctx); + +/* + * Sets the certificate associated with the received SCTs. + * Increments the reference count of cert. + * Returns 1 on success, 0 otherwise. + */ +int CT_POLICY_EVAL_CTX_set1_cert(CT_POLICY_EVAL_CTX *ctx, X509 *cert); + +/* Gets the issuer of the aforementioned certificate */ +X509* CT_POLICY_EVAL_CTX_get0_issuer(const CT_POLICY_EVAL_CTX *ctx); + +/* + * Sets the issuer of the certificate associated with the received SCTs. + * Increments the reference count of issuer. + * Returns 1 on success, 0 otherwise. + */ +int CT_POLICY_EVAL_CTX_set1_issuer(CT_POLICY_EVAL_CTX *ctx, X509 *issuer); + +/* Gets the CT logs that are trusted sources of SCTs */ +const CTLOG_STORE *CT_POLICY_EVAL_CTX_get0_log_store(const CT_POLICY_EVAL_CTX *ctx); + +/* Sets the log store that is in use. It must outlive the CT_POLICY_EVAL_CTX. */ +void CT_POLICY_EVAL_CTX_set_shared_CTLOG_STORE(CT_POLICY_EVAL_CTX *ctx, + CTLOG_STORE *log_store); + +/* + * Gets the time, in milliseconds since the Unix epoch, that will be used as the + * current time when checking whether an SCT was issued in the future. + * Such SCTs will fail validation, as required by RFC6962. + */ +uint64_t CT_POLICY_EVAL_CTX_get_time(const CT_POLICY_EVAL_CTX *ctx); + +/* + * Sets the time to evaluate SCTs against, in milliseconds since the Unix epoch. + * If an SCT's timestamp is after this time, it will be interpreted as having + * been issued in the future. RFC6962 states that "TLS clients MUST reject SCTs + * whose timestamp is in the future", so an SCT will not validate in this case. + */ +void CT_POLICY_EVAL_CTX_set_time(CT_POLICY_EVAL_CTX *ctx, uint64_t time_in_ms); + +/***************** + * SCT functions * + *****************/ + +/* + * Creates a new, blank SCT. + * The caller is responsible for calling SCT_free when finished with the SCT. + */ +SCT *SCT_new(void); + +/* + * Creates a new SCT from some base64-encoded strings. + * The caller is responsible for calling SCT_free when finished with the SCT. + */ +SCT *SCT_new_from_base64(unsigned char version, + const char *logid_base64, + ct_log_entry_type_t entry_type, + uint64_t timestamp, + const char *extensions_base64, + const char *signature_base64); + +/* + * Frees the SCT and the underlying data structures. + */ +void SCT_free(SCT *sct); + +/* + * Free a stack of SCTs, and the underlying SCTs themselves. + * Intended to be compatible with X509V3_EXT_FREE. + */ +void SCT_LIST_free(STACK_OF(SCT) *a); + +/* + * Returns the version of the SCT. + */ +sct_version_t SCT_get_version(const SCT *sct); + +/* + * Set the version of an SCT. + * Returns 1 on success, 0 if the version is unrecognized. + */ +__owur int SCT_set_version(SCT *sct, sct_version_t version); + +/* + * Returns the log entry type of the SCT. + */ +ct_log_entry_type_t SCT_get_log_entry_type(const SCT *sct); + +/* + * Set the log entry type of an SCT. + * Returns 1 on success, 0 otherwise. + */ +__owur int SCT_set_log_entry_type(SCT *sct, ct_log_entry_type_t entry_type); + +/* + * Gets the ID of the log that an SCT came from. + * Ownership of the log ID remains with the SCT. + * Returns the length of the log ID. + */ +size_t SCT_get0_log_id(const SCT *sct, unsigned char **log_id); + +/* + * Set the log ID of an SCT to point directly to the *log_id specified. + * The SCT takes ownership of the specified pointer. + * Returns 1 on success, 0 otherwise. + */ +__owur int SCT_set0_log_id(SCT *sct, unsigned char *log_id, size_t log_id_len); + +/* + * Set the log ID of an SCT. + * This makes a copy of the log_id. + * Returns 1 on success, 0 otherwise. + */ +__owur int SCT_set1_log_id(SCT *sct, const unsigned char *log_id, + size_t log_id_len); + +/* + * Returns the timestamp for the SCT (epoch time in milliseconds). + */ +uint64_t SCT_get_timestamp(const SCT *sct); + +/* + * Set the timestamp of an SCT (epoch time in milliseconds). + */ +void SCT_set_timestamp(SCT *sct, uint64_t timestamp); + +/* + * Return the NID for the signature used by the SCT. + * For CT v1, this will be either NID_sha256WithRSAEncryption or + * NID_ecdsa_with_SHA256 (or NID_undef if incorrect/unset). + */ +int SCT_get_signature_nid(const SCT *sct); + +/* + * Set the signature type of an SCT + * For CT v1, this should be either NID_sha256WithRSAEncryption or + * NID_ecdsa_with_SHA256. + * Returns 1 on success, 0 otherwise. + */ +__owur int SCT_set_signature_nid(SCT *sct, int nid); + +/* + * Set *ext to point to the extension data for the SCT. ext must not be NULL. + * The SCT retains ownership of this pointer. + * Returns length of the data pointed to. + */ +size_t SCT_get0_extensions(const SCT *sct, unsigned char **ext); + +/* + * Set the extensions of an SCT to point directly to the *ext specified. + * The SCT takes ownership of the specified pointer. + */ +void SCT_set0_extensions(SCT *sct, unsigned char *ext, size_t ext_len); + +/* + * Set the extensions of an SCT. + * This takes a copy of the ext. + * Returns 1 on success, 0 otherwise. + */ +__owur int SCT_set1_extensions(SCT *sct, const unsigned char *ext, + size_t ext_len); + +/* + * Set *sig to point to the signature for the SCT. sig must not be NULL. + * The SCT retains ownership of this pointer. + * Returns length of the data pointed to. + */ +size_t SCT_get0_signature(const SCT *sct, unsigned char **sig); + +/* + * Set the signature of an SCT to point directly to the *sig specified. + * The SCT takes ownership of the specified pointer. + */ +void SCT_set0_signature(SCT *sct, unsigned char *sig, size_t sig_len); + +/* + * Set the signature of an SCT to be a copy of the *sig specified. + * Returns 1 on success, 0 otherwise. + */ +__owur int SCT_set1_signature(SCT *sct, const unsigned char *sig, + size_t sig_len); + +/* + * The origin of this SCT, e.g. TLS extension, OCSP response, etc. + */ +sct_source_t SCT_get_source(const SCT *sct); + +/* + * Set the origin of this SCT, e.g. TLS extension, OCSP response, etc. + * Returns 1 on success, 0 otherwise. + */ +__owur int SCT_set_source(SCT *sct, sct_source_t source); + +/* + * Returns a text string describing the validation status of |sct|. + */ +const char *SCT_validation_status_string(const SCT *sct); + +/* + * Pretty-prints an |sct| to |out|. + * It will be indented by the number of spaces specified by |indent|. + * If |logs| is not NULL, it will be used to lookup the CT log that the SCT came + * from, so that the log name can be printed. + */ +void SCT_print(const SCT *sct, BIO *out, int indent, const CTLOG_STORE *logs); + +/* + * Pretty-prints an |sct_list| to |out|. + * It will be indented by the number of spaces specified by |indent|. + * SCTs will be delimited by |separator|. + * If |logs| is not NULL, it will be used to lookup the CT log that each SCT + * came from, so that the log names can be printed. + */ +void SCT_LIST_print(const STACK_OF(SCT) *sct_list, BIO *out, int indent, + const char *separator, const CTLOG_STORE *logs); + +/* + * Gets the last result of validating this SCT. + * If it has not been validated yet, returns SCT_VALIDATION_STATUS_NOT_SET. + */ +sct_validation_status_t SCT_get_validation_status(const SCT *sct); + +/* + * Validates the given SCT with the provided context. + * Sets the "validation_status" field of the SCT. + * Returns 1 if the SCT is valid and the signature verifies. + * Returns 0 if the SCT is invalid or could not be verified. + * Returns -1 if an error occurs. + */ +__owur int SCT_validate(SCT *sct, const CT_POLICY_EVAL_CTX *ctx); + +/* + * Validates the given list of SCTs with the provided context. + * Sets the "validation_status" field of each SCT. + * Returns 1 if there are no invalid SCTs and all signatures verify. + * Returns 0 if at least one SCT is invalid or could not be verified. + * Returns a negative integer if an error occurs. + */ +__owur int SCT_LIST_validate(const STACK_OF(SCT) *scts, + CT_POLICY_EVAL_CTX *ctx); + + +/********************************* + * SCT parsing and serialisation * + *********************************/ + +/* + * Serialize (to TLS format) a stack of SCTs and return the length. + * "a" must not be NULL. + * If "pp" is NULL, just return the length of what would have been serialized. + * If "pp" is not NULL and "*pp" is null, function will allocate a new pointer + * for data that caller is responsible for freeing (only if function returns + * successfully). + * If "pp" is NULL and "*pp" is not NULL, caller is responsible for ensuring + * that "*pp" is large enough to accept all of the serialized data. + * Returns < 0 on error, >= 0 indicating bytes written (or would have been) + * on success. + */ +__owur int i2o_SCT_LIST(const STACK_OF(SCT) *a, unsigned char **pp); + +/* + * Convert TLS format SCT list to a stack of SCTs. + * If "a" or "*a" is NULL, a new stack will be created that the caller is + * responsible for freeing (by calling SCT_LIST_free). + * "**pp" and "*pp" must not be NULL. + * Upon success, "*pp" will point to after the last bytes read, and a stack + * will be returned. + * Upon failure, a NULL pointer will be returned, and the position of "*pp" is + * not defined. + */ +STACK_OF(SCT) *o2i_SCT_LIST(STACK_OF(SCT) **a, const unsigned char **pp, + size_t len); + +/* + * Serialize (to DER format) a stack of SCTs and return the length. + * "a" must not be NULL. + * If "pp" is NULL, just returns the length of what would have been serialized. + * If "pp" is not NULL and "*pp" is null, function will allocate a new pointer + * for data that caller is responsible for freeing (only if function returns + * successfully). + * If "pp" is NULL and "*pp" is not NULL, caller is responsible for ensuring + * that "*pp" is large enough to accept all of the serialized data. + * Returns < 0 on error, >= 0 indicating bytes written (or would have been) + * on success. + */ +__owur int i2d_SCT_LIST(const STACK_OF(SCT) *a, unsigned char **pp); + +/* + * Parses an SCT list in DER format and returns it. + * If "a" or "*a" is NULL, a new stack will be created that the caller is + * responsible for freeing (by calling SCT_LIST_free). + * "**pp" and "*pp" must not be NULL. + * Upon success, "*pp" will point to after the last bytes read, and a stack + * will be returned. + * Upon failure, a NULL pointer will be returned, and the position of "*pp" is + * not defined. + */ +STACK_OF(SCT) *d2i_SCT_LIST(STACK_OF(SCT) **a, const unsigned char **pp, + long len); + +/* + * Serialize (to TLS format) an |sct| and write it to |out|. + * If |out| is null, no SCT will be output but the length will still be returned. + * If |out| points to a null pointer, a string will be allocated to hold the + * TLS-format SCT. It is the responsibility of the caller to free it. + * If |out| points to an allocated string, the TLS-format SCT will be written + * to it. + * The length of the SCT in TLS format will be returned. + */ +__owur int i2o_SCT(const SCT *sct, unsigned char **out); + +/* + * Parses an SCT in TLS format and returns it. + * If |psct| is not null, it will end up pointing to the parsed SCT. If it + * already points to a non-null pointer, the pointer will be free'd. + * |in| should be a pointer to a string containing the TLS-format SCT. + * |in| will be advanced to the end of the SCT if parsing succeeds. + * |len| should be the length of the SCT in |in|. + * Returns NULL if an error occurs. + * If the SCT is an unsupported version, only the SCT's 'sct' and 'sct_len' + * fields will be populated (with |in| and |len| respectively). + */ +SCT *o2i_SCT(SCT **psct, const unsigned char **in, size_t len); + +/******************** + * CT log functions * + ********************/ + +/* + * Creates a new CT log instance with the given |public_key| and |name|. + * Takes ownership of |public_key| but copies |name|. + * Returns NULL if malloc fails or if |public_key| cannot be converted to DER. + * Should be deleted by the caller using CTLOG_free when no longer needed. + */ +CTLOG *CTLOG_new(EVP_PKEY *public_key, const char *name); + +/* + * Creates a new CTLOG instance with the base64-encoded SubjectPublicKeyInfo DER + * in |pkey_base64|. The |name| is a string to help users identify this log. + * Returns 1 on success, 0 on failure. + * Should be deleted by the caller using CTLOG_free when no longer needed. + */ +int CTLOG_new_from_base64(CTLOG ** ct_log, + const char *pkey_base64, const char *name); + +/* + * Deletes a CT log instance and its fields. + */ +void CTLOG_free(CTLOG *log); + +/* Gets the name of the CT log */ +const char *CTLOG_get0_name(const CTLOG *log); +/* Gets the ID of the CT log */ +void CTLOG_get0_log_id(const CTLOG *log, const uint8_t **log_id, + size_t *log_id_len); +/* Gets the public key of the CT log */ +EVP_PKEY *CTLOG_get0_public_key(const CTLOG *log); + +/************************** + * CT log store functions * + **************************/ + +/* + * Creates a new CT log store. + * Should be deleted by the caller using CTLOG_STORE_free when no longer needed. + */ +CTLOG_STORE *CTLOG_STORE_new(void); + +/* + * Deletes a CT log store and all of the CT log instances held within. + */ +void CTLOG_STORE_free(CTLOG_STORE *store); + +/* + * Finds a CT log in the store based on its log ID. + * Returns the CT log, or NULL if no match is found. + */ +const CTLOG *CTLOG_STORE_get0_log_by_id(const CTLOG_STORE *store, + const uint8_t *log_id, + size_t log_id_len); + +/* + * Loads a CT log list into a |store| from a |file|. + * Returns 1 if loading is successful, or 0 otherwise. + */ +__owur int CTLOG_STORE_load_file(CTLOG_STORE *store, const char *file); + +/* + * Loads the default CT log list into a |store|. + * Returns 1 if loading is successful, or 0 otherwise. + */ +__owur int CTLOG_STORE_load_default_file(CTLOG_STORE *store); + +# ifdef __cplusplus +} +# endif +# endif +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/cterr.h b/MediaClient/MediaClient/openssl/include/openssl/cterr.h new file mode 100644 index 0000000..feb7bc5 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/cterr.h @@ -0,0 +1,80 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_CTERR_H +# define HEADER_CTERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# include + +# ifndef OPENSSL_NO_CT + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_CT_strings(void); + +/* + * CT function codes. + */ +# define CT_F_CTLOG_NEW 117 +# define CT_F_CTLOG_NEW_FROM_BASE64 118 +# define CT_F_CTLOG_NEW_FROM_CONF 119 +# define CT_F_CTLOG_STORE_LOAD_CTX_NEW 122 +# define CT_F_CTLOG_STORE_LOAD_FILE 123 +# define CT_F_CTLOG_STORE_LOAD_LOG 130 +# define CT_F_CTLOG_STORE_NEW 131 +# define CT_F_CT_BASE64_DECODE 124 +# define CT_F_CT_POLICY_EVAL_CTX_NEW 133 +# define CT_F_CT_V1_LOG_ID_FROM_PKEY 125 +# define CT_F_I2O_SCT 107 +# define CT_F_I2O_SCT_LIST 108 +# define CT_F_I2O_SCT_SIGNATURE 109 +# define CT_F_O2I_SCT 110 +# define CT_F_O2I_SCT_LIST 111 +# define CT_F_O2I_SCT_SIGNATURE 112 +# define CT_F_SCT_CTX_NEW 126 +# define CT_F_SCT_CTX_VERIFY 128 +# define CT_F_SCT_NEW 100 +# define CT_F_SCT_NEW_FROM_BASE64 127 +# define CT_F_SCT_SET0_LOG_ID 101 +# define CT_F_SCT_SET1_EXTENSIONS 114 +# define CT_F_SCT_SET1_LOG_ID 115 +# define CT_F_SCT_SET1_SIGNATURE 116 +# define CT_F_SCT_SET_LOG_ENTRY_TYPE 102 +# define CT_F_SCT_SET_SIGNATURE_NID 103 +# define CT_F_SCT_SET_VERSION 104 + +/* + * CT reason codes. + */ +# define CT_R_BASE64_DECODE_ERROR 108 +# define CT_R_INVALID_LOG_ID_LENGTH 100 +# define CT_R_LOG_CONF_INVALID 109 +# define CT_R_LOG_CONF_INVALID_KEY 110 +# define CT_R_LOG_CONF_MISSING_DESCRIPTION 111 +# define CT_R_LOG_CONF_MISSING_KEY 112 +# define CT_R_LOG_KEY_INVALID 113 +# define CT_R_SCT_FUTURE_TIMESTAMP 116 +# define CT_R_SCT_INVALID 104 +# define CT_R_SCT_INVALID_SIGNATURE 107 +# define CT_R_SCT_LIST_INVALID 105 +# define CT_R_SCT_LOG_ID_MISMATCH 114 +# define CT_R_SCT_NOT_SET 106 +# define CT_R_SCT_UNSUPPORTED_VERSION 115 +# define CT_R_UNRECOGNIZED_SIGNATURE_NID 101 +# define CT_R_UNSUPPORTED_ENTRY_TYPE 102 +# define CT_R_UNSUPPORTED_VERSION 103 + +# endif +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/des.h b/MediaClient/MediaClient/openssl/include/openssl/des.h new file mode 100644 index 0000000..be4abbd --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/des.h @@ -0,0 +1,174 @@ +/* + * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_DES_H +# define HEADER_DES_H + +# include + +# ifndef OPENSSL_NO_DES +# ifdef __cplusplus +extern "C" { +# endif +# include + +typedef unsigned int DES_LONG; + +# ifdef OPENSSL_BUILD_SHLIBCRYPTO +# undef OPENSSL_EXTERN +# define OPENSSL_EXTERN OPENSSL_EXPORT +# endif + +typedef unsigned char DES_cblock[8]; +typedef /* const */ unsigned char const_DES_cblock[8]; +/* + * With "const", gcc 2.8.1 on Solaris thinks that DES_cblock * and + * const_DES_cblock * are incompatible pointer types. + */ + +typedef struct DES_ks { + union { + DES_cblock cblock; + /* + * make sure things are correct size on machines with 8 byte longs + */ + DES_LONG deslong[2]; + } ks[16]; +} DES_key_schedule; + +# define DES_KEY_SZ (sizeof(DES_cblock)) +# define DES_SCHEDULE_SZ (sizeof(DES_key_schedule)) + +# define DES_ENCRYPT 1 +# define DES_DECRYPT 0 + +# define DES_CBC_MODE 0 +# define DES_PCBC_MODE 1 + +# define DES_ecb2_encrypt(i,o,k1,k2,e) \ + DES_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e)) + +# define DES_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \ + DES_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e)) + +# define DES_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \ + DES_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e)) + +# define DES_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \ + DES_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n)) + +OPENSSL_DECLARE_GLOBAL(int, DES_check_key); /* defaults to false */ +# define DES_check_key OPENSSL_GLOBAL_REF(DES_check_key) + +const char *DES_options(void); +void DES_ecb3_encrypt(const_DES_cblock *input, DES_cblock *output, + DES_key_schedule *ks1, DES_key_schedule *ks2, + DES_key_schedule *ks3, int enc); +DES_LONG DES_cbc_cksum(const unsigned char *input, DES_cblock *output, + long length, DES_key_schedule *schedule, + const_DES_cblock *ivec); +/* DES_cbc_encrypt does not update the IV! Use DES_ncbc_encrypt instead. */ +void DES_cbc_encrypt(const unsigned char *input, unsigned char *output, + long length, DES_key_schedule *schedule, + DES_cblock *ivec, int enc); +void DES_ncbc_encrypt(const unsigned char *input, unsigned char *output, + long length, DES_key_schedule *schedule, + DES_cblock *ivec, int enc); +void DES_xcbc_encrypt(const unsigned char *input, unsigned char *output, + long length, DES_key_schedule *schedule, + DES_cblock *ivec, const_DES_cblock *inw, + const_DES_cblock *outw, int enc); +void DES_cfb_encrypt(const unsigned char *in, unsigned char *out, int numbits, + long length, DES_key_schedule *schedule, + DES_cblock *ivec, int enc); +void DES_ecb_encrypt(const_DES_cblock *input, DES_cblock *output, + DES_key_schedule *ks, int enc); + +/* + * This is the DES encryption function that gets called by just about every + * other DES routine in the library. You should not use this function except + * to implement 'modes' of DES. I say this because the functions that call + * this routine do the conversion from 'char *' to long, and this needs to be + * done to make sure 'non-aligned' memory access do not occur. The + * characters are loaded 'little endian'. Data is a pointer to 2 unsigned + * long's and ks is the DES_key_schedule to use. enc, is non zero specifies + * encryption, zero if decryption. + */ +void DES_encrypt1(DES_LONG *data, DES_key_schedule *ks, int enc); + +/* + * This functions is the same as DES_encrypt1() except that the DES initial + * permutation (IP) and final permutation (FP) have been left out. As for + * DES_encrypt1(), you should not use this function. It is used by the + * routines in the library that implement triple DES. IP() DES_encrypt2() + * DES_encrypt2() DES_encrypt2() FP() is the same as DES_encrypt1() + * DES_encrypt1() DES_encrypt1() except faster :-). + */ +void DES_encrypt2(DES_LONG *data, DES_key_schedule *ks, int enc); + +void DES_encrypt3(DES_LONG *data, DES_key_schedule *ks1, + DES_key_schedule *ks2, DES_key_schedule *ks3); +void DES_decrypt3(DES_LONG *data, DES_key_schedule *ks1, + DES_key_schedule *ks2, DES_key_schedule *ks3); +void DES_ede3_cbc_encrypt(const unsigned char *input, unsigned char *output, + long length, + DES_key_schedule *ks1, DES_key_schedule *ks2, + DES_key_schedule *ks3, DES_cblock *ivec, int enc); +void DES_ede3_cfb64_encrypt(const unsigned char *in, unsigned char *out, + long length, DES_key_schedule *ks1, + DES_key_schedule *ks2, DES_key_schedule *ks3, + DES_cblock *ivec, int *num, int enc); +void DES_ede3_cfb_encrypt(const unsigned char *in, unsigned char *out, + int numbits, long length, DES_key_schedule *ks1, + DES_key_schedule *ks2, DES_key_schedule *ks3, + DES_cblock *ivec, int enc); +void DES_ede3_ofb64_encrypt(const unsigned char *in, unsigned char *out, + long length, DES_key_schedule *ks1, + DES_key_schedule *ks2, DES_key_schedule *ks3, + DES_cblock *ivec, int *num); +char *DES_fcrypt(const char *buf, const char *salt, char *ret); +char *DES_crypt(const char *buf, const char *salt); +void DES_ofb_encrypt(const unsigned char *in, unsigned char *out, int numbits, + long length, DES_key_schedule *schedule, + DES_cblock *ivec); +void DES_pcbc_encrypt(const unsigned char *input, unsigned char *output, + long length, DES_key_schedule *schedule, + DES_cblock *ivec, int enc); +DES_LONG DES_quad_cksum(const unsigned char *input, DES_cblock output[], + long length, int out_count, DES_cblock *seed); +int DES_random_key(DES_cblock *ret); +void DES_set_odd_parity(DES_cblock *key); +int DES_check_key_parity(const_DES_cblock *key); +int DES_is_weak_key(const_DES_cblock *key); +/* + * DES_set_key (= set_key = DES_key_sched = key_sched) calls + * DES_set_key_checked if global variable DES_check_key is set, + * DES_set_key_unchecked otherwise. + */ +int DES_set_key(const_DES_cblock *key, DES_key_schedule *schedule); +int DES_key_sched(const_DES_cblock *key, DES_key_schedule *schedule); +int DES_set_key_checked(const_DES_cblock *key, DES_key_schedule *schedule); +void DES_set_key_unchecked(const_DES_cblock *key, DES_key_schedule *schedule); +void DES_string_to_key(const char *str, DES_cblock *key); +void DES_string_to_2keys(const char *str, DES_cblock *key1, DES_cblock *key2); +void DES_cfb64_encrypt(const unsigned char *in, unsigned char *out, + long length, DES_key_schedule *schedule, + DES_cblock *ivec, int *num, int enc); +void DES_ofb64_encrypt(const unsigned char *in, unsigned char *out, + long length, DES_key_schedule *schedule, + DES_cblock *ivec, int *num); + +# define DES_fixup_key_parity DES_set_odd_parity + +# ifdef __cplusplus +} +# endif +# endif + +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/dh.h b/MediaClient/MediaClient/openssl/include/openssl/dh.h new file mode 100644 index 0000000..3527540 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/dh.h @@ -0,0 +1,340 @@ +/* + * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_DH_H +# define HEADER_DH_H + +# include + +# ifndef OPENSSL_NO_DH +# include +# include +# include +# include +# if OPENSSL_API_COMPAT < 0x10100000L +# include +# endif +# include + +# ifdef __cplusplus +extern "C" { +# endif + +# ifndef OPENSSL_DH_MAX_MODULUS_BITS +# define OPENSSL_DH_MAX_MODULUS_BITS 10000 +# endif + +# define OPENSSL_DH_FIPS_MIN_MODULUS_BITS 1024 + +# define DH_FLAG_CACHE_MONT_P 0x01 + +# if OPENSSL_API_COMPAT < 0x10100000L +/* + * Does nothing. Previously this switched off constant time behaviour. + */ +# define DH_FLAG_NO_EXP_CONSTTIME 0x00 +# endif + +/* + * If this flag is set the DH method is FIPS compliant and can be used in + * FIPS mode. This is set in the validated module method. If an application + * sets this flag in its own methods it is its responsibility to ensure the + * result is compliant. + */ + +# define DH_FLAG_FIPS_METHOD 0x0400 + +/* + * If this flag is set the operations normally disabled in FIPS mode are + * permitted it is then the applications responsibility to ensure that the + * usage is compliant. + */ + +# define DH_FLAG_NON_FIPS_ALLOW 0x0400 + +/* Already defined in ossl_typ.h */ +/* typedef struct dh_st DH; */ +/* typedef struct dh_method DH_METHOD; */ + +DECLARE_ASN1_ITEM(DHparams) + +# define DH_GENERATOR_2 2 +/* #define DH_GENERATOR_3 3 */ +# define DH_GENERATOR_5 5 + +/* DH_check error codes */ +# define DH_CHECK_P_NOT_PRIME 0x01 +# define DH_CHECK_P_NOT_SAFE_PRIME 0x02 +# define DH_UNABLE_TO_CHECK_GENERATOR 0x04 +# define DH_NOT_SUITABLE_GENERATOR 0x08 +# define DH_CHECK_Q_NOT_PRIME 0x10 +# define DH_CHECK_INVALID_Q_VALUE 0x20 +# define DH_CHECK_INVALID_J_VALUE 0x40 + +/* DH_check_pub_key error codes */ +# define DH_CHECK_PUBKEY_TOO_SMALL 0x01 +# define DH_CHECK_PUBKEY_TOO_LARGE 0x02 +# define DH_CHECK_PUBKEY_INVALID 0x04 + +/* + * primes p where (p-1)/2 is prime too are called "safe"; we define this for + * backward compatibility: + */ +# define DH_CHECK_P_NOT_STRONG_PRIME DH_CHECK_P_NOT_SAFE_PRIME + +# define d2i_DHparams_fp(fp,x) \ + (DH *)ASN1_d2i_fp((char *(*)())DH_new, \ + (char *(*)())d2i_DHparams, \ + (fp), \ + (unsigned char **)(x)) +# define i2d_DHparams_fp(fp,x) \ + ASN1_i2d_fp(i2d_DHparams,(fp), (unsigned char *)(x)) +# define d2i_DHparams_bio(bp,x) \ + ASN1_d2i_bio_of(DH, DH_new, d2i_DHparams, bp, x) +# define i2d_DHparams_bio(bp,x) \ + ASN1_i2d_bio_of_const(DH,i2d_DHparams,bp,x) + +# define d2i_DHxparams_fp(fp,x) \ + (DH *)ASN1_d2i_fp((char *(*)())DH_new, \ + (char *(*)())d2i_DHxparams, \ + (fp), \ + (unsigned char **)(x)) +# define i2d_DHxparams_fp(fp,x) \ + ASN1_i2d_fp(i2d_DHxparams,(fp), (unsigned char *)(x)) +# define d2i_DHxparams_bio(bp,x) \ + ASN1_d2i_bio_of(DH, DH_new, d2i_DHxparams, bp, x) +# define i2d_DHxparams_bio(bp,x) \ + ASN1_i2d_bio_of_const(DH, i2d_DHxparams, bp, x) + +DH *DHparams_dup(DH *); + +const DH_METHOD *DH_OpenSSL(void); + +void DH_set_default_method(const DH_METHOD *meth); +const DH_METHOD *DH_get_default_method(void); +int DH_set_method(DH *dh, const DH_METHOD *meth); +DH *DH_new_method(ENGINE *engine); + +DH *DH_new(void); +void DH_free(DH *dh); +int DH_up_ref(DH *dh); +int DH_bits(const DH *dh); +int DH_size(const DH *dh); +int DH_security_bits(const DH *dh); +#define DH_get_ex_new_index(l, p, newf, dupf, freef) \ + CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_DH, l, p, newf, dupf, freef) +int DH_set_ex_data(DH *d, int idx, void *arg); +void *DH_get_ex_data(DH *d, int idx); + +/* Deprecated version */ +DEPRECATEDIN_0_9_8(DH *DH_generate_parameters(int prime_len, int generator, + void (*callback) (int, int, + void *), + void *cb_arg)) + +/* New version */ +int DH_generate_parameters_ex(DH *dh, int prime_len, int generator, + BN_GENCB *cb); + +int DH_check_params_ex(const DH *dh); +int DH_check_ex(const DH *dh); +int DH_check_pub_key_ex(const DH *dh, const BIGNUM *pub_key); +int DH_check_params(const DH *dh, int *ret); +int DH_check(const DH *dh, int *codes); +int DH_check_pub_key(const DH *dh, const BIGNUM *pub_key, int *codes); +int DH_generate_key(DH *dh); +int DH_compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh); +int DH_compute_key_padded(unsigned char *key, const BIGNUM *pub_key, DH *dh); +DH *d2i_DHparams(DH **a, const unsigned char **pp, long length); +int i2d_DHparams(const DH *a, unsigned char **pp); +DH *d2i_DHxparams(DH **a, const unsigned char **pp, long length); +int i2d_DHxparams(const DH *a, unsigned char **pp); +# ifndef OPENSSL_NO_STDIO +int DHparams_print_fp(FILE *fp, const DH *x); +# endif +int DHparams_print(BIO *bp, const DH *x); + +/* RFC 5114 parameters */ +DH *DH_get_1024_160(void); +DH *DH_get_2048_224(void); +DH *DH_get_2048_256(void); + +/* Named parameters, currently RFC7919 */ +DH *DH_new_by_nid(int nid); +int DH_get_nid(const DH *dh); + +# ifndef OPENSSL_NO_CMS +/* RFC2631 KDF */ +int DH_KDF_X9_42(unsigned char *out, size_t outlen, + const unsigned char *Z, size_t Zlen, + ASN1_OBJECT *key_oid, + const unsigned char *ukm, size_t ukmlen, const EVP_MD *md); +# endif + +void DH_get0_pqg(const DH *dh, + const BIGNUM **p, const BIGNUM **q, const BIGNUM **g); +int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g); +void DH_get0_key(const DH *dh, + const BIGNUM **pub_key, const BIGNUM **priv_key); +int DH_set0_key(DH *dh, BIGNUM *pub_key, BIGNUM *priv_key); +const BIGNUM *DH_get0_p(const DH *dh); +const BIGNUM *DH_get0_q(const DH *dh); +const BIGNUM *DH_get0_g(const DH *dh); +const BIGNUM *DH_get0_priv_key(const DH *dh); +const BIGNUM *DH_get0_pub_key(const DH *dh); +void DH_clear_flags(DH *dh, int flags); +int DH_test_flags(const DH *dh, int flags); +void DH_set_flags(DH *dh, int flags); +ENGINE *DH_get0_engine(DH *d); +long DH_get_length(const DH *dh); +int DH_set_length(DH *dh, long length); + +DH_METHOD *DH_meth_new(const char *name, int flags); +void DH_meth_free(DH_METHOD *dhm); +DH_METHOD *DH_meth_dup(const DH_METHOD *dhm); +const char *DH_meth_get0_name(const DH_METHOD *dhm); +int DH_meth_set1_name(DH_METHOD *dhm, const char *name); +int DH_meth_get_flags(const DH_METHOD *dhm); +int DH_meth_set_flags(DH_METHOD *dhm, int flags); +void *DH_meth_get0_app_data(const DH_METHOD *dhm); +int DH_meth_set0_app_data(DH_METHOD *dhm, void *app_data); +int (*DH_meth_get_generate_key(const DH_METHOD *dhm)) (DH *); +int DH_meth_set_generate_key(DH_METHOD *dhm, int (*generate_key) (DH *)); +int (*DH_meth_get_compute_key(const DH_METHOD *dhm)) + (unsigned char *key, const BIGNUM *pub_key, DH *dh); +int DH_meth_set_compute_key(DH_METHOD *dhm, + int (*compute_key) (unsigned char *key, const BIGNUM *pub_key, DH *dh)); +int (*DH_meth_get_bn_mod_exp(const DH_METHOD *dhm)) + (const DH *, BIGNUM *, const BIGNUM *, const BIGNUM *, const BIGNUM *, + BN_CTX *, BN_MONT_CTX *); +int DH_meth_set_bn_mod_exp(DH_METHOD *dhm, + int (*bn_mod_exp) (const DH *, BIGNUM *, const BIGNUM *, const BIGNUM *, + const BIGNUM *, BN_CTX *, BN_MONT_CTX *)); +int (*DH_meth_get_init(const DH_METHOD *dhm))(DH *); +int DH_meth_set_init(DH_METHOD *dhm, int (*init)(DH *)); +int (*DH_meth_get_finish(const DH_METHOD *dhm)) (DH *); +int DH_meth_set_finish(DH_METHOD *dhm, int (*finish) (DH *)); +int (*DH_meth_get_generate_params(const DH_METHOD *dhm)) + (DH *, int, int, BN_GENCB *); +int DH_meth_set_generate_params(DH_METHOD *dhm, + int (*generate_params) (DH *, int, int, BN_GENCB *)); + + +# define EVP_PKEY_CTX_set_dh_paramgen_prime_len(ctx, len) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \ + EVP_PKEY_CTRL_DH_PARAMGEN_PRIME_LEN, len, NULL) + +# define EVP_PKEY_CTX_set_dh_paramgen_subprime_len(ctx, len) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \ + EVP_PKEY_CTRL_DH_PARAMGEN_SUBPRIME_LEN, len, NULL) + +# define EVP_PKEY_CTX_set_dh_paramgen_type(ctx, typ) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \ + EVP_PKEY_CTRL_DH_PARAMGEN_TYPE, typ, NULL) + +# define EVP_PKEY_CTX_set_dh_paramgen_generator(ctx, gen) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \ + EVP_PKEY_CTRL_DH_PARAMGEN_GENERATOR, gen, NULL) + +# define EVP_PKEY_CTX_set_dh_rfc5114(ctx, gen) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, EVP_PKEY_OP_PARAMGEN, \ + EVP_PKEY_CTRL_DH_RFC5114, gen, NULL) + +# define EVP_PKEY_CTX_set_dhx_rfc5114(ctx, gen) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, EVP_PKEY_OP_PARAMGEN, \ + EVP_PKEY_CTRL_DH_RFC5114, gen, NULL) + +# define EVP_PKEY_CTX_set_dh_nid(ctx, nid) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, \ + EVP_PKEY_OP_PARAMGEN | EVP_PKEY_OP_KEYGEN, \ + EVP_PKEY_CTRL_DH_NID, nid, NULL) + +# define EVP_PKEY_CTX_set_dh_pad(ctx, pad) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_DH_PAD, pad, NULL) + +# define EVP_PKEY_CTX_set_dh_kdf_type(ctx, kdf) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_DH_KDF_TYPE, kdf, NULL) + +# define EVP_PKEY_CTX_get_dh_kdf_type(ctx) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_DH_KDF_TYPE, -2, NULL) + +# define EVP_PKEY_CTX_set0_dh_kdf_oid(ctx, oid) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_DH_KDF_OID, 0, (void *)(oid)) + +# define EVP_PKEY_CTX_get0_dh_kdf_oid(ctx, poid) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_GET_DH_KDF_OID, 0, (void *)(poid)) + +# define EVP_PKEY_CTX_set_dh_kdf_md(ctx, md) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_DH_KDF_MD, 0, (void *)(md)) + +# define EVP_PKEY_CTX_get_dh_kdf_md(ctx, pmd) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_GET_DH_KDF_MD, 0, (void *)(pmd)) + +# define EVP_PKEY_CTX_set_dh_kdf_outlen(ctx, len) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_DH_KDF_OUTLEN, len, NULL) + +# define EVP_PKEY_CTX_get_dh_kdf_outlen(ctx, plen) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_GET_DH_KDF_OUTLEN, 0, (void *)(plen)) + +# define EVP_PKEY_CTX_set0_dh_kdf_ukm(ctx, p, plen) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_DH_KDF_UKM, plen, (void *)(p)) + +# define EVP_PKEY_CTX_get0_dh_kdf_ukm(ctx, p) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_GET_DH_KDF_UKM, 0, (void *)(p)) + +# define EVP_PKEY_CTRL_DH_PARAMGEN_PRIME_LEN (EVP_PKEY_ALG_CTRL + 1) +# define EVP_PKEY_CTRL_DH_PARAMGEN_GENERATOR (EVP_PKEY_ALG_CTRL + 2) +# define EVP_PKEY_CTRL_DH_RFC5114 (EVP_PKEY_ALG_CTRL + 3) +# define EVP_PKEY_CTRL_DH_PARAMGEN_SUBPRIME_LEN (EVP_PKEY_ALG_CTRL + 4) +# define EVP_PKEY_CTRL_DH_PARAMGEN_TYPE (EVP_PKEY_ALG_CTRL + 5) +# define EVP_PKEY_CTRL_DH_KDF_TYPE (EVP_PKEY_ALG_CTRL + 6) +# define EVP_PKEY_CTRL_DH_KDF_MD (EVP_PKEY_ALG_CTRL + 7) +# define EVP_PKEY_CTRL_GET_DH_KDF_MD (EVP_PKEY_ALG_CTRL + 8) +# define EVP_PKEY_CTRL_DH_KDF_OUTLEN (EVP_PKEY_ALG_CTRL + 9) +# define EVP_PKEY_CTRL_GET_DH_KDF_OUTLEN (EVP_PKEY_ALG_CTRL + 10) +# define EVP_PKEY_CTRL_DH_KDF_UKM (EVP_PKEY_ALG_CTRL + 11) +# define EVP_PKEY_CTRL_GET_DH_KDF_UKM (EVP_PKEY_ALG_CTRL + 12) +# define EVP_PKEY_CTRL_DH_KDF_OID (EVP_PKEY_ALG_CTRL + 13) +# define EVP_PKEY_CTRL_GET_DH_KDF_OID (EVP_PKEY_ALG_CTRL + 14) +# define EVP_PKEY_CTRL_DH_NID (EVP_PKEY_ALG_CTRL + 15) +# define EVP_PKEY_CTRL_DH_PAD (EVP_PKEY_ALG_CTRL + 16) + +/* KDF types */ +# define EVP_PKEY_DH_KDF_NONE 1 +# ifndef OPENSSL_NO_CMS +# define EVP_PKEY_DH_KDF_X9_42 2 +# endif + + +# ifdef __cplusplus +} +# endif +# endif +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/dherr.h b/MediaClient/MediaClient/openssl/include/openssl/dherr.h new file mode 100644 index 0000000..916b3be --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/dherr.h @@ -0,0 +1,88 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_DHERR_H +# define HEADER_DHERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# include + +# ifndef OPENSSL_NO_DH + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_DH_strings(void); + +/* + * DH function codes. + */ +# define DH_F_COMPUTE_KEY 102 +# define DH_F_DHPARAMS_PRINT_FP 101 +# define DH_F_DH_BUILTIN_GENPARAMS 106 +# define DH_F_DH_CHECK_EX 121 +# define DH_F_DH_CHECK_PARAMS_EX 122 +# define DH_F_DH_CHECK_PUB_KEY_EX 123 +# define DH_F_DH_CMS_DECRYPT 114 +# define DH_F_DH_CMS_SET_PEERKEY 115 +# define DH_F_DH_CMS_SET_SHARED_INFO 116 +# define DH_F_DH_METH_DUP 117 +# define DH_F_DH_METH_NEW 118 +# define DH_F_DH_METH_SET1_NAME 119 +# define DH_F_DH_NEW_BY_NID 104 +# define DH_F_DH_NEW_METHOD 105 +# define DH_F_DH_PARAM_DECODE 107 +# define DH_F_DH_PKEY_PUBLIC_CHECK 124 +# define DH_F_DH_PRIV_DECODE 110 +# define DH_F_DH_PRIV_ENCODE 111 +# define DH_F_DH_PUB_DECODE 108 +# define DH_F_DH_PUB_ENCODE 109 +# define DH_F_DO_DH_PRINT 100 +# define DH_F_GENERATE_KEY 103 +# define DH_F_PKEY_DH_CTRL_STR 120 +# define DH_F_PKEY_DH_DERIVE 112 +# define DH_F_PKEY_DH_INIT 125 +# define DH_F_PKEY_DH_KEYGEN 113 + +/* + * DH reason codes. + */ +# define DH_R_BAD_GENERATOR 101 +# define DH_R_BN_DECODE_ERROR 109 +# define DH_R_BN_ERROR 106 +# define DH_R_CHECK_INVALID_J_VALUE 115 +# define DH_R_CHECK_INVALID_Q_VALUE 116 +# define DH_R_CHECK_PUBKEY_INVALID 122 +# define DH_R_CHECK_PUBKEY_TOO_LARGE 123 +# define DH_R_CHECK_PUBKEY_TOO_SMALL 124 +# define DH_R_CHECK_P_NOT_PRIME 117 +# define DH_R_CHECK_P_NOT_SAFE_PRIME 118 +# define DH_R_CHECK_Q_NOT_PRIME 119 +# define DH_R_DECODE_ERROR 104 +# define DH_R_INVALID_PARAMETER_NAME 110 +# define DH_R_INVALID_PARAMETER_NID 114 +# define DH_R_INVALID_PUBKEY 102 +# define DH_R_KDF_PARAMETER_ERROR 112 +# define DH_R_KEYS_NOT_SET 108 +# define DH_R_MISSING_PUBKEY 125 +# define DH_R_MODULUS_TOO_LARGE 103 +# define DH_R_NOT_SUITABLE_GENERATOR 120 +# define DH_R_NO_PARAMETERS_SET 107 +# define DH_R_NO_PRIVATE_VALUE 100 +# define DH_R_PARAMETER_ENCODING_ERROR 105 +# define DH_R_PEER_KEY_ERROR 111 +# define DH_R_SHARED_INFO_ERROR 113 +# define DH_R_UNABLE_TO_CHECK_GENERATOR 121 + +# endif +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/dsa.h b/MediaClient/MediaClient/openssl/include/openssl/dsa.h new file mode 100644 index 0000000..6d8a18a --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/dsa.h @@ -0,0 +1,244 @@ +/* + * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_DSA_H +# define HEADER_DSA_H + +# include + +# ifndef OPENSSL_NO_DSA +# ifdef __cplusplus +extern "C" { +# endif +# include +# include +# include +# include +# include +# if OPENSSL_API_COMPAT < 0x10100000L +# include +# endif +# include + +# ifndef OPENSSL_DSA_MAX_MODULUS_BITS +# define OPENSSL_DSA_MAX_MODULUS_BITS 10000 +# endif + +# define OPENSSL_DSA_FIPS_MIN_MODULUS_BITS 1024 + +# define DSA_FLAG_CACHE_MONT_P 0x01 +# if OPENSSL_API_COMPAT < 0x10100000L +/* + * Does nothing. Previously this switched off constant time behaviour. + */ +# define DSA_FLAG_NO_EXP_CONSTTIME 0x00 +# endif + +/* + * If this flag is set the DSA method is FIPS compliant and can be used in + * FIPS mode. This is set in the validated module method. If an application + * sets this flag in its own methods it is its responsibility to ensure the + * result is compliant. + */ + +# define DSA_FLAG_FIPS_METHOD 0x0400 + +/* + * If this flag is set the operations normally disabled in FIPS mode are + * permitted it is then the applications responsibility to ensure that the + * usage is compliant. + */ + +# define DSA_FLAG_NON_FIPS_ALLOW 0x0400 +# define DSA_FLAG_FIPS_CHECKED 0x0800 + +/* Already defined in ossl_typ.h */ +/* typedef struct dsa_st DSA; */ +/* typedef struct dsa_method DSA_METHOD; */ + +typedef struct DSA_SIG_st DSA_SIG; + +# define d2i_DSAparams_fp(fp,x) (DSA *)ASN1_d2i_fp((char *(*)())DSA_new, \ + (char *(*)())d2i_DSAparams,(fp),(unsigned char **)(x)) +# define i2d_DSAparams_fp(fp,x) ASN1_i2d_fp(i2d_DSAparams,(fp), \ + (unsigned char *)(x)) +# define d2i_DSAparams_bio(bp,x) ASN1_d2i_bio_of(DSA,DSA_new,d2i_DSAparams,bp,x) +# define i2d_DSAparams_bio(bp,x) ASN1_i2d_bio_of_const(DSA,i2d_DSAparams,bp,x) + +DSA *DSAparams_dup(DSA *x); +DSA_SIG *DSA_SIG_new(void); +void DSA_SIG_free(DSA_SIG *a); +int i2d_DSA_SIG(const DSA_SIG *a, unsigned char **pp); +DSA_SIG *d2i_DSA_SIG(DSA_SIG **v, const unsigned char **pp, long length); +void DSA_SIG_get0(const DSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps); +int DSA_SIG_set0(DSA_SIG *sig, BIGNUM *r, BIGNUM *s); + +DSA_SIG *DSA_do_sign(const unsigned char *dgst, int dlen, DSA *dsa); +int DSA_do_verify(const unsigned char *dgst, int dgst_len, + DSA_SIG *sig, DSA *dsa); + +const DSA_METHOD *DSA_OpenSSL(void); + +void DSA_set_default_method(const DSA_METHOD *); +const DSA_METHOD *DSA_get_default_method(void); +int DSA_set_method(DSA *dsa, const DSA_METHOD *); +const DSA_METHOD *DSA_get_method(DSA *d); + +DSA *DSA_new(void); +DSA *DSA_new_method(ENGINE *engine); +void DSA_free(DSA *r); +/* "up" the DSA object's reference count */ +int DSA_up_ref(DSA *r); +int DSA_size(const DSA *); +int DSA_bits(const DSA *d); +int DSA_security_bits(const DSA *d); + /* next 4 return -1 on error */ +DEPRECATEDIN_1_2_0(int DSA_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp)) +int DSA_sign(int type, const unsigned char *dgst, int dlen, + unsigned char *sig, unsigned int *siglen, DSA *dsa); +int DSA_verify(int type, const unsigned char *dgst, int dgst_len, + const unsigned char *sigbuf, int siglen, DSA *dsa); +#define DSA_get_ex_new_index(l, p, newf, dupf, freef) \ + CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_DSA, l, p, newf, dupf, freef) +int DSA_set_ex_data(DSA *d, int idx, void *arg); +void *DSA_get_ex_data(DSA *d, int idx); + +DSA *d2i_DSAPublicKey(DSA **a, const unsigned char **pp, long length); +DSA *d2i_DSAPrivateKey(DSA **a, const unsigned char **pp, long length); +DSA *d2i_DSAparams(DSA **a, const unsigned char **pp, long length); + +/* Deprecated version */ +DEPRECATEDIN_0_9_8(DSA *DSA_generate_parameters(int bits, + unsigned char *seed, + int seed_len, + int *counter_ret, + unsigned long *h_ret, void + (*callback) (int, int, + void *), + void *cb_arg)) + +/* New version */ +int DSA_generate_parameters_ex(DSA *dsa, int bits, + const unsigned char *seed, int seed_len, + int *counter_ret, unsigned long *h_ret, + BN_GENCB *cb); + +int DSA_generate_key(DSA *a); +int i2d_DSAPublicKey(const DSA *a, unsigned char **pp); +int i2d_DSAPrivateKey(const DSA *a, unsigned char **pp); +int i2d_DSAparams(const DSA *a, unsigned char **pp); + +int DSAparams_print(BIO *bp, const DSA *x); +int DSA_print(BIO *bp, const DSA *x, int off); +# ifndef OPENSSL_NO_STDIO +int DSAparams_print_fp(FILE *fp, const DSA *x); +int DSA_print_fp(FILE *bp, const DSA *x, int off); +# endif + +# define DSS_prime_checks 64 +/* + * Primality test according to FIPS PUB 186-4, Appendix C.3. Since we only + * have one value here we set the number of checks to 64 which is the 128 bit + * security level that is the highest level and valid for creating a 3072 bit + * DSA key. + */ +# define DSA_is_prime(n, callback, cb_arg) \ + BN_is_prime(n, DSS_prime_checks, callback, NULL, cb_arg) + +# ifndef OPENSSL_NO_DH +/* + * Convert DSA structure (key or just parameters) into DH structure (be + * careful to avoid small subgroup attacks when using this!) + */ +DH *DSA_dup_DH(const DSA *r); +# endif + +# define EVP_PKEY_CTX_set_dsa_paramgen_bits(ctx, nbits) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DSA, EVP_PKEY_OP_PARAMGEN, \ + EVP_PKEY_CTRL_DSA_PARAMGEN_BITS, nbits, NULL) +# define EVP_PKEY_CTX_set_dsa_paramgen_q_bits(ctx, qbits) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DSA, EVP_PKEY_OP_PARAMGEN, \ + EVP_PKEY_CTRL_DSA_PARAMGEN_Q_BITS, qbits, NULL) +# define EVP_PKEY_CTX_set_dsa_paramgen_md(ctx, md) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DSA, EVP_PKEY_OP_PARAMGEN, \ + EVP_PKEY_CTRL_DSA_PARAMGEN_MD, 0, (void *)(md)) + +# define EVP_PKEY_CTRL_DSA_PARAMGEN_BITS (EVP_PKEY_ALG_CTRL + 1) +# define EVP_PKEY_CTRL_DSA_PARAMGEN_Q_BITS (EVP_PKEY_ALG_CTRL + 2) +# define EVP_PKEY_CTRL_DSA_PARAMGEN_MD (EVP_PKEY_ALG_CTRL + 3) + +void DSA_get0_pqg(const DSA *d, + const BIGNUM **p, const BIGNUM **q, const BIGNUM **g); +int DSA_set0_pqg(DSA *d, BIGNUM *p, BIGNUM *q, BIGNUM *g); +void DSA_get0_key(const DSA *d, + const BIGNUM **pub_key, const BIGNUM **priv_key); +int DSA_set0_key(DSA *d, BIGNUM *pub_key, BIGNUM *priv_key); +const BIGNUM *DSA_get0_p(const DSA *d); +const BIGNUM *DSA_get0_q(const DSA *d); +const BIGNUM *DSA_get0_g(const DSA *d); +const BIGNUM *DSA_get0_pub_key(const DSA *d); +const BIGNUM *DSA_get0_priv_key(const DSA *d); +void DSA_clear_flags(DSA *d, int flags); +int DSA_test_flags(const DSA *d, int flags); +void DSA_set_flags(DSA *d, int flags); +ENGINE *DSA_get0_engine(DSA *d); + +DSA_METHOD *DSA_meth_new(const char *name, int flags); +void DSA_meth_free(DSA_METHOD *dsam); +DSA_METHOD *DSA_meth_dup(const DSA_METHOD *dsam); +const char *DSA_meth_get0_name(const DSA_METHOD *dsam); +int DSA_meth_set1_name(DSA_METHOD *dsam, const char *name); +int DSA_meth_get_flags(const DSA_METHOD *dsam); +int DSA_meth_set_flags(DSA_METHOD *dsam, int flags); +void *DSA_meth_get0_app_data(const DSA_METHOD *dsam); +int DSA_meth_set0_app_data(DSA_METHOD *dsam, void *app_data); +DSA_SIG *(*DSA_meth_get_sign(const DSA_METHOD *dsam)) + (const unsigned char *, int, DSA *); +int DSA_meth_set_sign(DSA_METHOD *dsam, + DSA_SIG *(*sign) (const unsigned char *, int, DSA *)); +int (*DSA_meth_get_sign_setup(const DSA_METHOD *dsam)) + (DSA *, BN_CTX *, BIGNUM **, BIGNUM **); +int DSA_meth_set_sign_setup(DSA_METHOD *dsam, + int (*sign_setup) (DSA *, BN_CTX *, BIGNUM **, BIGNUM **)); +int (*DSA_meth_get_verify(const DSA_METHOD *dsam)) + (const unsigned char *, int, DSA_SIG *, DSA *); +int DSA_meth_set_verify(DSA_METHOD *dsam, + int (*verify) (const unsigned char *, int, DSA_SIG *, DSA *)); +int (*DSA_meth_get_mod_exp(const DSA_METHOD *dsam)) + (DSA *, BIGNUM *, const BIGNUM *, const BIGNUM *, const BIGNUM *, + const BIGNUM *, const BIGNUM *, BN_CTX *, BN_MONT_CTX *); +int DSA_meth_set_mod_exp(DSA_METHOD *dsam, + int (*mod_exp) (DSA *, BIGNUM *, const BIGNUM *, const BIGNUM *, + const BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *, + BN_MONT_CTX *)); +int (*DSA_meth_get_bn_mod_exp(const DSA_METHOD *dsam)) + (DSA *, BIGNUM *, const BIGNUM *, const BIGNUM *, const BIGNUM *, + BN_CTX *, BN_MONT_CTX *); +int DSA_meth_set_bn_mod_exp(DSA_METHOD *dsam, + int (*bn_mod_exp) (DSA *, BIGNUM *, const BIGNUM *, const BIGNUM *, + const BIGNUM *, BN_CTX *, BN_MONT_CTX *)); +int (*DSA_meth_get_init(const DSA_METHOD *dsam))(DSA *); +int DSA_meth_set_init(DSA_METHOD *dsam, int (*init)(DSA *)); +int (*DSA_meth_get_finish(const DSA_METHOD *dsam)) (DSA *); +int DSA_meth_set_finish(DSA_METHOD *dsam, int (*finish) (DSA *)); +int (*DSA_meth_get_paramgen(const DSA_METHOD *dsam)) + (DSA *, int, const unsigned char *, int, int *, unsigned long *, + BN_GENCB *); +int DSA_meth_set_paramgen(DSA_METHOD *dsam, + int (*paramgen) (DSA *, int, const unsigned char *, int, int *, + unsigned long *, BN_GENCB *)); +int (*DSA_meth_get_keygen(const DSA_METHOD *dsam)) (DSA *); +int DSA_meth_set_keygen(DSA_METHOD *dsam, int (*keygen) (DSA *)); + + +# ifdef __cplusplus +} +# endif +# endif +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/dsaerr.h b/MediaClient/MediaClient/openssl/include/openssl/dsaerr.h new file mode 100644 index 0000000..495a1ac --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/dsaerr.h @@ -0,0 +1,72 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_DSAERR_H +# define HEADER_DSAERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# include + +# ifndef OPENSSL_NO_DSA + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_DSA_strings(void); + +/* + * DSA function codes. + */ +# define DSA_F_DSAPARAMS_PRINT 100 +# define DSA_F_DSAPARAMS_PRINT_FP 101 +# define DSA_F_DSA_BUILTIN_PARAMGEN 125 +# define DSA_F_DSA_BUILTIN_PARAMGEN2 126 +# define DSA_F_DSA_DO_SIGN 112 +# define DSA_F_DSA_DO_VERIFY 113 +# define DSA_F_DSA_METH_DUP 127 +# define DSA_F_DSA_METH_NEW 128 +# define DSA_F_DSA_METH_SET1_NAME 129 +# define DSA_F_DSA_NEW_METHOD 103 +# define DSA_F_DSA_PARAM_DECODE 119 +# define DSA_F_DSA_PRINT_FP 105 +# define DSA_F_DSA_PRIV_DECODE 115 +# define DSA_F_DSA_PRIV_ENCODE 116 +# define DSA_F_DSA_PUB_DECODE 117 +# define DSA_F_DSA_PUB_ENCODE 118 +# define DSA_F_DSA_SIGN 106 +# define DSA_F_DSA_SIGN_SETUP 107 +# define DSA_F_DSA_SIG_NEW 102 +# define DSA_F_OLD_DSA_PRIV_DECODE 122 +# define DSA_F_PKEY_DSA_CTRL 120 +# define DSA_F_PKEY_DSA_CTRL_STR 104 +# define DSA_F_PKEY_DSA_KEYGEN 121 + +/* + * DSA reason codes. + */ +# define DSA_R_BAD_Q_VALUE 102 +# define DSA_R_BN_DECODE_ERROR 108 +# define DSA_R_BN_ERROR 109 +# define DSA_R_DECODE_ERROR 104 +# define DSA_R_INVALID_DIGEST_TYPE 106 +# define DSA_R_INVALID_PARAMETERS 112 +# define DSA_R_MISSING_PARAMETERS 101 +# define DSA_R_MISSING_PRIVATE_KEY 111 +# define DSA_R_MODULUS_TOO_LARGE 103 +# define DSA_R_NO_PARAMETERS_SET 107 +# define DSA_R_PARAMETER_ENCODING_ERROR 105 +# define DSA_R_Q_NOT_PRIME 113 +# define DSA_R_SEED_LEN_SMALL 110 + +# endif +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/dtls1.h b/MediaClient/MediaClient/openssl/include/openssl/dtls1.h new file mode 100644 index 0000000..d55ca9c --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/dtls1.h @@ -0,0 +1,55 @@ +/* + * Copyright 2005-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_DTLS1_H +# define HEADER_DTLS1_H + +#ifdef __cplusplus +extern "C" { +#endif + +# define DTLS1_VERSION 0xFEFF +# define DTLS1_2_VERSION 0xFEFD +# define DTLS_MIN_VERSION DTLS1_VERSION +# define DTLS_MAX_VERSION DTLS1_2_VERSION +# define DTLS1_VERSION_MAJOR 0xFE + +# define DTLS1_BAD_VER 0x0100 + +/* Special value for method supporting multiple versions */ +# define DTLS_ANY_VERSION 0x1FFFF + +/* lengths of messages */ +/* + * Actually the max cookie length in DTLS is 255. But we can't change this now + * due to compatibility concerns. + */ +# define DTLS1_COOKIE_LENGTH 256 + +# define DTLS1_RT_HEADER_LENGTH 13 + +# define DTLS1_HM_HEADER_LENGTH 12 + +# define DTLS1_HM_BAD_FRAGMENT -2 +# define DTLS1_HM_FRAGMENT_RETRY -3 + +# define DTLS1_CCS_HEADER_LENGTH 1 + +# define DTLS1_AL_HEADER_LENGTH 2 + +/* Timeout multipliers */ +# define DTLS1_TMO_READ_COUNT 2 +# define DTLS1_TMO_WRITE_COUNT 2 + +# define DTLS1_TMO_ALERT_COUNT 12 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/e_os2.h b/MediaClient/MediaClient/openssl/include/openssl/e_os2.h new file mode 100644 index 0000000..97a776c --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/e_os2.h @@ -0,0 +1,300 @@ +/* + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_E_OS2_H +# define HEADER_E_OS2_H + +# include + +#ifdef __cplusplus +extern "C" { +#endif + +/****************************************************************************** + * Detect operating systems. This probably needs completing. + * The result is that at least one OPENSSL_SYS_os macro should be defined. + * However, if none is defined, Unix is assumed. + **/ + +# define OPENSSL_SYS_UNIX + +/* --------------------- Microsoft operating systems ---------------------- */ + +/* + * Note that MSDOS actually denotes 32-bit environments running on top of + * MS-DOS, such as DJGPP one. + */ +# if defined(OPENSSL_SYS_MSDOS) +# undef OPENSSL_SYS_UNIX +# endif + +/* + * For 32 bit environment, there seems to be the CygWin environment and then + * all the others that try to do the same thing Microsoft does... + */ +/* + * UEFI lives here because it might be built with a Microsoft toolchain and + * we need to avoid the false positive match on Windows. + */ +# if defined(OPENSSL_SYS_UEFI) +# undef OPENSSL_SYS_UNIX +# elif defined(OPENSSL_SYS_UWIN) +# undef OPENSSL_SYS_UNIX +# define OPENSSL_SYS_WIN32_UWIN +# else +# if defined(__CYGWIN__) || defined(OPENSSL_SYS_CYGWIN) +# define OPENSSL_SYS_WIN32_CYGWIN +# else +# if defined(_WIN32) || defined(OPENSSL_SYS_WIN32) +# undef OPENSSL_SYS_UNIX +# if !defined(OPENSSL_SYS_WIN32) +# define OPENSSL_SYS_WIN32 +# endif +# endif +# if defined(_WIN64) || defined(OPENSSL_SYS_WIN64) +# undef OPENSSL_SYS_UNIX +# if !defined(OPENSSL_SYS_WIN64) +# define OPENSSL_SYS_WIN64 +# endif +# endif +# if defined(OPENSSL_SYS_WINNT) +# undef OPENSSL_SYS_UNIX +# endif +# if defined(OPENSSL_SYS_WINCE) +# undef OPENSSL_SYS_UNIX +# endif +# endif +# endif + +/* Anything that tries to look like Microsoft is "Windows" */ +# if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WIN64) || defined(OPENSSL_SYS_WINNT) || defined(OPENSSL_SYS_WINCE) +# undef OPENSSL_SYS_UNIX +# define OPENSSL_SYS_WINDOWS +# ifndef OPENSSL_SYS_MSDOS +# define OPENSSL_SYS_MSDOS +# endif +# endif + +/* + * DLL settings. This part is a bit tough, because it's up to the + * application implementor how he or she will link the application, so it + * requires some macro to be used. + */ +# ifdef OPENSSL_SYS_WINDOWS +# ifndef OPENSSL_OPT_WINDLL +# if defined(_WINDLL) /* This is used when building OpenSSL to + * indicate that DLL linkage should be used */ +# define OPENSSL_OPT_WINDLL +# endif +# endif +# endif + +/* ------------------------------- OpenVMS -------------------------------- */ +# if defined(__VMS) || defined(VMS) || defined(OPENSSL_SYS_VMS) +# if !defined(OPENSSL_SYS_VMS) +# undef OPENSSL_SYS_UNIX +# endif +# define OPENSSL_SYS_VMS +# if defined(__DECC) +# define OPENSSL_SYS_VMS_DECC +# elif defined(__DECCXX) +# define OPENSSL_SYS_VMS_DECC +# define OPENSSL_SYS_VMS_DECCXX +# else +# define OPENSSL_SYS_VMS_NODECC +# endif +# endif + +/* -------------------------------- Unix ---------------------------------- */ +# ifdef OPENSSL_SYS_UNIX +# if defined(linux) || defined(__linux__) && !defined(OPENSSL_SYS_LINUX) +# define OPENSSL_SYS_LINUX +# endif +# if defined(_AIX) && !defined(OPENSSL_SYS_AIX) +# define OPENSSL_SYS_AIX +# endif +# endif + +/* -------------------------------- VOS ----------------------------------- */ +# if defined(__VOS__) && !defined(OPENSSL_SYS_VOS) +# define OPENSSL_SYS_VOS +# ifdef __HPPA__ +# define OPENSSL_SYS_VOS_HPPA +# endif +# ifdef __IA32__ +# define OPENSSL_SYS_VOS_IA32 +# endif +# endif + +/** + * That's it for OS-specific stuff + *****************************************************************************/ + +/* Specials for I/O an exit */ +# ifdef OPENSSL_SYS_MSDOS +# define OPENSSL_UNISTD_IO +# define OPENSSL_DECLARE_EXIT extern void exit(int); +# else +# define OPENSSL_UNISTD_IO OPENSSL_UNISTD +# define OPENSSL_DECLARE_EXIT /* declared in unistd.h */ +# endif + +/*- + * OPENSSL_EXTERN is normally used to declare a symbol with possible extra + * attributes to handle its presence in a shared library. + * OPENSSL_EXPORT is used to define a symbol with extra possible attributes + * to make it visible in a shared library. + * Care needs to be taken when a header file is used both to declare and + * define symbols. Basically, for any library that exports some global + * variables, the following code must be present in the header file that + * declares them, before OPENSSL_EXTERN is used: + * + * #ifdef SOME_BUILD_FLAG_MACRO + * # undef OPENSSL_EXTERN + * # define OPENSSL_EXTERN OPENSSL_EXPORT + * #endif + * + * The default is to have OPENSSL_EXPORT and OPENSSL_EXTERN + * have some generally sensible values. + */ + +# if defined(OPENSSL_SYS_WINDOWS) && defined(OPENSSL_OPT_WINDLL) +# define OPENSSL_EXPORT extern __declspec(dllexport) +# define OPENSSL_EXTERN extern __declspec(dllimport) +# else +# define OPENSSL_EXPORT extern +# define OPENSSL_EXTERN extern +# endif + +/*- + * Macros to allow global variables to be reached through function calls when + * required (if a shared library version requires it, for example. + * The way it's done allows definitions like this: + * + * // in foobar.c + * OPENSSL_IMPLEMENT_GLOBAL(int,foobar,0) + * // in foobar.h + * OPENSSL_DECLARE_GLOBAL(int,foobar); + * #define foobar OPENSSL_GLOBAL_REF(foobar) + */ +# ifdef OPENSSL_EXPORT_VAR_AS_FUNCTION +# define OPENSSL_IMPLEMENT_GLOBAL(type,name,value) \ + type *_shadow_##name(void) \ + { static type _hide_##name=value; return &_hide_##name; } +# define OPENSSL_DECLARE_GLOBAL(type,name) type *_shadow_##name(void) +# define OPENSSL_GLOBAL_REF(name) (*(_shadow_##name())) +# else +# define OPENSSL_IMPLEMENT_GLOBAL(type,name,value) type _shadow_##name=value; +# define OPENSSL_DECLARE_GLOBAL(type,name) OPENSSL_EXPORT type _shadow_##name +# define OPENSSL_GLOBAL_REF(name) _shadow_##name +# endif + +# ifdef _WIN32 +# ifdef _WIN64 +# define ossl_ssize_t __int64 +# define OSSL_SSIZE_MAX _I64_MAX +# else +# define ossl_ssize_t int +# define OSSL_SSIZE_MAX INT_MAX +# endif +# endif + +# if defined(OPENSSL_SYS_UEFI) && !defined(ossl_ssize_t) +# define ossl_ssize_t INTN +# define OSSL_SSIZE_MAX MAX_INTN +# endif + +# ifndef ossl_ssize_t +# define ossl_ssize_t ssize_t +# if defined(SSIZE_MAX) +# define OSSL_SSIZE_MAX SSIZE_MAX +# elif defined(_POSIX_SSIZE_MAX) +# define OSSL_SSIZE_MAX _POSIX_SSIZE_MAX +# else +# define OSSL_SSIZE_MAX ((ssize_t)(SIZE_MAX>>1)) +# endif +# endif + +# ifdef DEBUG_UNUSED +# define __owur __attribute__((__warn_unused_result__)) +# else +# define __owur +# endif + +/* Standard integer types */ +# if defined(OPENSSL_SYS_UEFI) +typedef INT8 int8_t; +typedef UINT8 uint8_t; +typedef INT16 int16_t; +typedef UINT16 uint16_t; +typedef INT32 int32_t; +typedef UINT32 uint32_t; +typedef INT64 int64_t; +typedef UINT64 uint64_t; +# elif (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \ + defined(__osf__) || defined(__sgi) || defined(__hpux) || \ + defined(OPENSSL_SYS_VMS) || defined (__OpenBSD__) +# include +# elif defined(_MSC_VER) && _MSC_VER<=1500 +/* + * minimally required typdefs for systems not supporting inttypes.h or + * stdint.h: currently just older VC++ + */ +typedef signed char int8_t; +typedef unsigned char uint8_t; +typedef short int16_t; +typedef unsigned short uint16_t; +typedef int int32_t; +typedef unsigned int uint32_t; +typedef __int64 int64_t; +typedef unsigned __int64 uint64_t; +# else +# include +# endif + +/* ossl_inline: portable inline definition usable in public headers */ +# if !defined(inline) && !defined(__cplusplus) +# if defined(__STDC_VERSION__) && __STDC_VERSION__>=199901L + /* just use inline */ +# define ossl_inline inline +# elif defined(__GNUC__) && __GNUC__>=2 +# define ossl_inline __inline__ +# elif defined(_MSC_VER) + /* + * Visual Studio: inline is available in C++ only, however + * __inline is available for C, see + * http://msdn.microsoft.com/en-us/library/z8y1yy88.aspx + */ +# define ossl_inline __inline +# else +# define ossl_inline +# endif +# else +# define ossl_inline inline +# endif + +# if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L +# define ossl_noreturn _Noreturn +# elif defined(__GNUC__) && __GNUC__ >= 2 +# define ossl_noreturn __attribute__((noreturn)) +# else +# define ossl_noreturn +# endif + +/* ossl_unused: portable unused attribute for use in public headers */ +# if defined(__GNUC__) +# define ossl_unused __attribute__((unused)) +# else +# define ossl_unused +# endif + +#ifdef __cplusplus +} +#endif +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/ebcdic.h b/MediaClient/MediaClient/openssl/include/openssl/ebcdic.h new file mode 100644 index 0000000..aa01285 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/ebcdic.h @@ -0,0 +1,33 @@ +/* + * Copyright 1999-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_EBCDIC_H +# define HEADER_EBCDIC_H + +# include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Avoid name clashes with other applications */ +# define os_toascii _openssl_os_toascii +# define os_toebcdic _openssl_os_toebcdic +# define ebcdic2ascii _openssl_ebcdic2ascii +# define ascii2ebcdic _openssl_ascii2ebcdic + +extern const unsigned char os_toascii[256]; +extern const unsigned char os_toebcdic[256]; +void *ebcdic2ascii(void *dest, const void *srce, size_t count); +void *ascii2ebcdic(void *dest, const void *srce, size_t count); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/ec.h b/MediaClient/MediaClient/openssl/include/openssl/ec.h new file mode 100644 index 0000000..5af9ebd --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/ec.h @@ -0,0 +1,1479 @@ +/* + * Copyright 2002-2019 The OpenSSL Project Authors. All Rights Reserved. + * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_EC_H +# define HEADER_EC_H + +# include + +# ifndef OPENSSL_NO_EC +# include +# include +# if OPENSSL_API_COMPAT < 0x10100000L +# include +# endif +# include +# ifdef __cplusplus +extern "C" { +# endif + +# ifndef OPENSSL_ECC_MAX_FIELD_BITS +# define OPENSSL_ECC_MAX_FIELD_BITS 661 +# endif + +/** Enum for the point conversion form as defined in X9.62 (ECDSA) + * for the encoding of a elliptic curve point (x,y) */ +typedef enum { + /** the point is encoded as z||x, where the octet z specifies + * which solution of the quadratic equation y is */ + POINT_CONVERSION_COMPRESSED = 2, + /** the point is encoded as z||x||y, where z is the octet 0x04 */ + POINT_CONVERSION_UNCOMPRESSED = 4, + /** the point is encoded as z||x||y, where the octet z specifies + * which solution of the quadratic equation y is */ + POINT_CONVERSION_HYBRID = 6 +} point_conversion_form_t; + +typedef struct ec_method_st EC_METHOD; +typedef struct ec_group_st EC_GROUP; +typedef struct ec_point_st EC_POINT; +typedef struct ecpk_parameters_st ECPKPARAMETERS; +typedef struct ec_parameters_st ECPARAMETERS; + +/********************************************************************/ +/* EC_METHODs for curves over GF(p) */ +/********************************************************************/ + +/** Returns the basic GFp ec methods which provides the basis for the + * optimized methods. + * \return EC_METHOD object + */ +const EC_METHOD *EC_GFp_simple_method(void); + +/** Returns GFp methods using montgomery multiplication. + * \return EC_METHOD object + */ +const EC_METHOD *EC_GFp_mont_method(void); + +/** Returns GFp methods using optimized methods for NIST recommended curves + * \return EC_METHOD object + */ +const EC_METHOD *EC_GFp_nist_method(void); + +# ifndef OPENSSL_NO_EC_NISTP_64_GCC_128 +/** Returns 64-bit optimized methods for nistp224 + * \return EC_METHOD object + */ +const EC_METHOD *EC_GFp_nistp224_method(void); + +/** Returns 64-bit optimized methods for nistp256 + * \return EC_METHOD object + */ +const EC_METHOD *EC_GFp_nistp256_method(void); + +/** Returns 64-bit optimized methods for nistp521 + * \return EC_METHOD object + */ +const EC_METHOD *EC_GFp_nistp521_method(void); +# endif + +# ifndef OPENSSL_NO_EC2M +/********************************************************************/ +/* EC_METHOD for curves over GF(2^m) */ +/********************************************************************/ + +/** Returns the basic GF2m ec method + * \return EC_METHOD object + */ +const EC_METHOD *EC_GF2m_simple_method(void); + +# endif + +/********************************************************************/ +/* EC_GROUP functions */ +/********************************************************************/ + +/** Creates a new EC_GROUP object + * \param meth EC_METHOD to use + * \return newly created EC_GROUP object or NULL in case of an error. + */ +EC_GROUP *EC_GROUP_new(const EC_METHOD *meth); + +/** Frees a EC_GROUP object + * \param group EC_GROUP object to be freed. + */ +void EC_GROUP_free(EC_GROUP *group); + +/** Clears and frees a EC_GROUP object + * \param group EC_GROUP object to be cleared and freed. + */ +void EC_GROUP_clear_free(EC_GROUP *group); + +/** Copies EC_GROUP objects. Note: both EC_GROUPs must use the same EC_METHOD. + * \param dst destination EC_GROUP object + * \param src source EC_GROUP object + * \return 1 on success and 0 if an error occurred. + */ +int EC_GROUP_copy(EC_GROUP *dst, const EC_GROUP *src); + +/** Creates a new EC_GROUP object and copies the copies the content + * form src to the newly created EC_KEY object + * \param src source EC_GROUP object + * \return newly created EC_GROUP object or NULL in case of an error. + */ +EC_GROUP *EC_GROUP_dup(const EC_GROUP *src); + +/** Returns the EC_METHOD of the EC_GROUP object. + * \param group EC_GROUP object + * \return EC_METHOD used in this EC_GROUP object. + */ +const EC_METHOD *EC_GROUP_method_of(const EC_GROUP *group); + +/** Returns the field type of the EC_METHOD. + * \param meth EC_METHOD object + * \return NID of the underlying field type OID. + */ +int EC_METHOD_get_field_type(const EC_METHOD *meth); + +/** Sets the generator and its order/cofactor of a EC_GROUP object. + * \param group EC_GROUP object + * \param generator EC_POINT object with the generator. + * \param order the order of the group generated by the generator. + * \param cofactor the index of the sub-group generated by the generator + * in the group of all points on the elliptic curve. + * \return 1 on success and 0 if an error occurred + */ +int EC_GROUP_set_generator(EC_GROUP *group, const EC_POINT *generator, + const BIGNUM *order, const BIGNUM *cofactor); + +/** Returns the generator of a EC_GROUP object. + * \param group EC_GROUP object + * \return the currently used generator (possibly NULL). + */ +const EC_POINT *EC_GROUP_get0_generator(const EC_GROUP *group); + +/** Returns the montgomery data for order(Generator) + * \param group EC_GROUP object + * \return the currently used montgomery data (possibly NULL). +*/ +BN_MONT_CTX *EC_GROUP_get_mont_data(const EC_GROUP *group); + +/** Gets the order of a EC_GROUP + * \param group EC_GROUP object + * \param order BIGNUM to which the order is copied + * \param ctx unused + * \return 1 on success and 0 if an error occurred + */ +int EC_GROUP_get_order(const EC_GROUP *group, BIGNUM *order, BN_CTX *ctx); + +/** Gets the order of an EC_GROUP + * \param group EC_GROUP object + * \return the group order + */ +const BIGNUM *EC_GROUP_get0_order(const EC_GROUP *group); + +/** Gets the number of bits of the order of an EC_GROUP + * \param group EC_GROUP object + * \return number of bits of group order. + */ +int EC_GROUP_order_bits(const EC_GROUP *group); + +/** Gets the cofactor of a EC_GROUP + * \param group EC_GROUP object + * \param cofactor BIGNUM to which the cofactor is copied + * \param ctx unused + * \return 1 on success and 0 if an error occurred + */ +int EC_GROUP_get_cofactor(const EC_GROUP *group, BIGNUM *cofactor, + BN_CTX *ctx); + +/** Gets the cofactor of an EC_GROUP + * \param group EC_GROUP object + * \return the group cofactor + */ +const BIGNUM *EC_GROUP_get0_cofactor(const EC_GROUP *group); + +/** Sets the name of a EC_GROUP object + * \param group EC_GROUP object + * \param nid NID of the curve name OID + */ +void EC_GROUP_set_curve_name(EC_GROUP *group, int nid); + +/** Returns the curve name of a EC_GROUP object + * \param group EC_GROUP object + * \return NID of the curve name OID or 0 if not set. + */ +int EC_GROUP_get_curve_name(const EC_GROUP *group); + +void EC_GROUP_set_asn1_flag(EC_GROUP *group, int flag); +int EC_GROUP_get_asn1_flag(const EC_GROUP *group); + +void EC_GROUP_set_point_conversion_form(EC_GROUP *group, + point_conversion_form_t form); +point_conversion_form_t EC_GROUP_get_point_conversion_form(const EC_GROUP *); + +unsigned char *EC_GROUP_get0_seed(const EC_GROUP *x); +size_t EC_GROUP_get_seed_len(const EC_GROUP *); +size_t EC_GROUP_set_seed(EC_GROUP *, const unsigned char *, size_t len); + +/** Sets the parameters of a ec curve defined by y^2 = x^3 + a*x + b (for GFp) + * or y^2 + x*y = x^3 + a*x^2 + b (for GF2m) + * \param group EC_GROUP object + * \param p BIGNUM with the prime number (GFp) or the polynomial + * defining the underlying field (GF2m) + * \param a BIGNUM with parameter a of the equation + * \param b BIGNUM with parameter b of the equation + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +int EC_GROUP_set_curve(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, + const BIGNUM *b, BN_CTX *ctx); + +/** Gets the parameters of the ec curve defined by y^2 = x^3 + a*x + b (for GFp) + * or y^2 + x*y = x^3 + a*x^2 + b (for GF2m) + * \param group EC_GROUP object + * \param p BIGNUM with the prime number (GFp) or the polynomial + * defining the underlying field (GF2m) + * \param a BIGNUM for parameter a of the equation + * \param b BIGNUM for parameter b of the equation + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +int EC_GROUP_get_curve(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b, + BN_CTX *ctx); + +/** Sets the parameters of an ec curve. Synonym for EC_GROUP_set_curve + * \param group EC_GROUP object + * \param p BIGNUM with the prime number (GFp) or the polynomial + * defining the underlying field (GF2m) + * \param a BIGNUM with parameter a of the equation + * \param b BIGNUM with parameter b of the equation + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +DEPRECATEDIN_1_2_0(int EC_GROUP_set_curve_GFp(EC_GROUP *group, const BIGNUM *p, + const BIGNUM *a, const BIGNUM *b, + BN_CTX *ctx)) + +/** Gets the parameters of an ec curve. Synonym for EC_GROUP_get_curve + * \param group EC_GROUP object + * \param p BIGNUM with the prime number (GFp) or the polynomial + * defining the underlying field (GF2m) + * \param a BIGNUM for parameter a of the equation + * \param b BIGNUM for parameter b of the equation + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +DEPRECATEDIN_1_2_0(int EC_GROUP_get_curve_GFp(const EC_GROUP *group, BIGNUM *p, + BIGNUM *a, BIGNUM *b, + BN_CTX *ctx)) + +# ifndef OPENSSL_NO_EC2M +/** Sets the parameter of an ec curve. Synonym for EC_GROUP_set_curve + * \param group EC_GROUP object + * \param p BIGNUM with the prime number (GFp) or the polynomial + * defining the underlying field (GF2m) + * \param a BIGNUM with parameter a of the equation + * \param b BIGNUM with parameter b of the equation + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +DEPRECATEDIN_1_2_0(int EC_GROUP_set_curve_GF2m(EC_GROUP *group, const BIGNUM *p, + const BIGNUM *a, const BIGNUM *b, + BN_CTX *ctx)) + +/** Gets the parameters of an ec curve. Synonym for EC_GROUP_get_curve + * \param group EC_GROUP object + * \param p BIGNUM with the prime number (GFp) or the polynomial + * defining the underlying field (GF2m) + * \param a BIGNUM for parameter a of the equation + * \param b BIGNUM for parameter b of the equation + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +DEPRECATEDIN_1_2_0(int EC_GROUP_get_curve_GF2m(const EC_GROUP *group, BIGNUM *p, + BIGNUM *a, BIGNUM *b, + BN_CTX *ctx)) +# endif +/** Returns the number of bits needed to represent a field element + * \param group EC_GROUP object + * \return number of bits needed to represent a field element + */ +int EC_GROUP_get_degree(const EC_GROUP *group); + +/** Checks whether the parameter in the EC_GROUP define a valid ec group + * \param group EC_GROUP object + * \param ctx BN_CTX object (optional) + * \return 1 if group is a valid ec group and 0 otherwise + */ +int EC_GROUP_check(const EC_GROUP *group, BN_CTX *ctx); + +/** Checks whether the discriminant of the elliptic curve is zero or not + * \param group EC_GROUP object + * \param ctx BN_CTX object (optional) + * \return 1 if the discriminant is not zero and 0 otherwise + */ +int EC_GROUP_check_discriminant(const EC_GROUP *group, BN_CTX *ctx); + +/** Compares two EC_GROUP objects + * \param a first EC_GROUP object + * \param b second EC_GROUP object + * \param ctx BN_CTX object (optional) + * \return 0 if the groups are equal, 1 if not, or -1 on error + */ +int EC_GROUP_cmp(const EC_GROUP *a, const EC_GROUP *b, BN_CTX *ctx); + +/* + * EC_GROUP_new_GF*() calls EC_GROUP_new() and EC_GROUP_set_GF*() after + * choosing an appropriate EC_METHOD + */ + +/** Creates a new EC_GROUP object with the specified parameters defined + * over GFp (defined by the equation y^2 = x^3 + a*x + b) + * \param p BIGNUM with the prime number + * \param a BIGNUM with the parameter a of the equation + * \param b BIGNUM with the parameter b of the equation + * \param ctx BN_CTX object (optional) + * \return newly created EC_GROUP object with the specified parameters + */ +EC_GROUP *EC_GROUP_new_curve_GFp(const BIGNUM *p, const BIGNUM *a, + const BIGNUM *b, BN_CTX *ctx); +# ifndef OPENSSL_NO_EC2M +/** Creates a new EC_GROUP object with the specified parameters defined + * over GF2m (defined by the equation y^2 + x*y = x^3 + a*x^2 + b) + * \param p BIGNUM with the polynomial defining the underlying field + * \param a BIGNUM with the parameter a of the equation + * \param b BIGNUM with the parameter b of the equation + * \param ctx BN_CTX object (optional) + * \return newly created EC_GROUP object with the specified parameters + */ +EC_GROUP *EC_GROUP_new_curve_GF2m(const BIGNUM *p, const BIGNUM *a, + const BIGNUM *b, BN_CTX *ctx); +# endif + +/** Creates a EC_GROUP object with a curve specified by a NID + * \param nid NID of the OID of the curve name + * \return newly created EC_GROUP object with specified curve or NULL + * if an error occurred + */ +EC_GROUP *EC_GROUP_new_by_curve_name(int nid); + +/** Creates a new EC_GROUP object from an ECPARAMETERS object + * \param params pointer to the ECPARAMETERS object + * \return newly created EC_GROUP object with specified curve or NULL + * if an error occurred + */ +EC_GROUP *EC_GROUP_new_from_ecparameters(const ECPARAMETERS *params); + +/** Creates an ECPARAMETERS object for the given EC_GROUP object. + * \param group pointer to the EC_GROUP object + * \param params pointer to an existing ECPARAMETERS object or NULL + * \return pointer to the new ECPARAMETERS object or NULL + * if an error occurred. + */ +ECPARAMETERS *EC_GROUP_get_ecparameters(const EC_GROUP *group, + ECPARAMETERS *params); + +/** Creates a new EC_GROUP object from an ECPKPARAMETERS object + * \param params pointer to an existing ECPKPARAMETERS object, or NULL + * \return newly created EC_GROUP object with specified curve, or NULL + * if an error occurred + */ +EC_GROUP *EC_GROUP_new_from_ecpkparameters(const ECPKPARAMETERS *params); + +/** Creates an ECPKPARAMETERS object for the given EC_GROUP object. + * \param group pointer to the EC_GROUP object + * \param params pointer to an existing ECPKPARAMETERS object or NULL + * \return pointer to the new ECPKPARAMETERS object or NULL + * if an error occurred. + */ +ECPKPARAMETERS *EC_GROUP_get_ecpkparameters(const EC_GROUP *group, + ECPKPARAMETERS *params); + +/********************************************************************/ +/* handling of internal curves */ +/********************************************************************/ + +typedef struct { + int nid; + const char *comment; +} EC_builtin_curve; + +/* + * EC_builtin_curves(EC_builtin_curve *r, size_t size) returns number of all + * available curves or zero if a error occurred. In case r is not zero, + * nitems EC_builtin_curve structures are filled with the data of the first + * nitems internal groups + */ +size_t EC_get_builtin_curves(EC_builtin_curve *r, size_t nitems); + +const char *EC_curve_nid2nist(int nid); +int EC_curve_nist2nid(const char *name); + +/********************************************************************/ +/* EC_POINT functions */ +/********************************************************************/ + +/** Creates a new EC_POINT object for the specified EC_GROUP + * \param group EC_GROUP the underlying EC_GROUP object + * \return newly created EC_POINT object or NULL if an error occurred + */ +EC_POINT *EC_POINT_new(const EC_GROUP *group); + +/** Frees a EC_POINT object + * \param point EC_POINT object to be freed + */ +void EC_POINT_free(EC_POINT *point); + +/** Clears and frees a EC_POINT object + * \param point EC_POINT object to be cleared and freed + */ +void EC_POINT_clear_free(EC_POINT *point); + +/** Copies EC_POINT object + * \param dst destination EC_POINT object + * \param src source EC_POINT object + * \return 1 on success and 0 if an error occurred + */ +int EC_POINT_copy(EC_POINT *dst, const EC_POINT *src); + +/** Creates a new EC_POINT object and copies the content of the supplied + * EC_POINT + * \param src source EC_POINT object + * \param group underlying the EC_GROUP object + * \return newly created EC_POINT object or NULL if an error occurred + */ +EC_POINT *EC_POINT_dup(const EC_POINT *src, const EC_GROUP *group); + +/** Returns the EC_METHOD used in EC_POINT object + * \param point EC_POINT object + * \return the EC_METHOD used + */ +const EC_METHOD *EC_POINT_method_of(const EC_POINT *point); + +/** Sets a point to infinity (neutral element) + * \param group underlying EC_GROUP object + * \param point EC_POINT to set to infinity + * \return 1 on success and 0 if an error occurred + */ +int EC_POINT_set_to_infinity(const EC_GROUP *group, EC_POINT *point); + +/** Sets the jacobian projective coordinates of a EC_POINT over GFp + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param x BIGNUM with the x-coordinate + * \param y BIGNUM with the y-coordinate + * \param z BIGNUM with the z-coordinate + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +int EC_POINT_set_Jprojective_coordinates_GFp(const EC_GROUP *group, + EC_POINT *p, const BIGNUM *x, + const BIGNUM *y, const BIGNUM *z, + BN_CTX *ctx); + +/** Gets the jacobian projective coordinates of a EC_POINT over GFp + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param x BIGNUM for the x-coordinate + * \param y BIGNUM for the y-coordinate + * \param z BIGNUM for the z-coordinate + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +int EC_POINT_get_Jprojective_coordinates_GFp(const EC_GROUP *group, + const EC_POINT *p, BIGNUM *x, + BIGNUM *y, BIGNUM *z, + BN_CTX *ctx); + +/** Sets the affine coordinates of an EC_POINT + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param x BIGNUM with the x-coordinate + * \param y BIGNUM with the y-coordinate + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +int EC_POINT_set_affine_coordinates(const EC_GROUP *group, EC_POINT *p, + const BIGNUM *x, const BIGNUM *y, + BN_CTX *ctx); + +/** Gets the affine coordinates of an EC_POINT. + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param x BIGNUM for the x-coordinate + * \param y BIGNUM for the y-coordinate + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +int EC_POINT_get_affine_coordinates(const EC_GROUP *group, const EC_POINT *p, + BIGNUM *x, BIGNUM *y, BN_CTX *ctx); + +/** Sets the affine coordinates of an EC_POINT. A synonym of + * EC_POINT_set_affine_coordinates + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param x BIGNUM with the x-coordinate + * \param y BIGNUM with the y-coordinate + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +DEPRECATEDIN_1_2_0(int EC_POINT_set_affine_coordinates_GFp(const EC_GROUP *group, + EC_POINT *p, + const BIGNUM *x, + const BIGNUM *y, + BN_CTX *ctx)) + +/** Gets the affine coordinates of an EC_POINT. A synonym of + * EC_POINT_get_affine_coordinates + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param x BIGNUM for the x-coordinate + * \param y BIGNUM for the y-coordinate + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +DEPRECATEDIN_1_2_0(int EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *group, + const EC_POINT *p, + BIGNUM *x, + BIGNUM *y, + BN_CTX *ctx)) + +/** Sets the x9.62 compressed coordinates of a EC_POINT + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param x BIGNUM with x-coordinate + * \param y_bit integer with the y-Bit (either 0 or 1) + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +int EC_POINT_set_compressed_coordinates(const EC_GROUP *group, EC_POINT *p, + const BIGNUM *x, int y_bit, + BN_CTX *ctx); + +/** Sets the x9.62 compressed coordinates of a EC_POINT. A synonym of + * EC_POINT_set_compressed_coordinates + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param x BIGNUM with x-coordinate + * \param y_bit integer with the y-Bit (either 0 or 1) + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +DEPRECATEDIN_1_2_0(int EC_POINT_set_compressed_coordinates_GFp(const EC_GROUP *group, + EC_POINT *p, + const BIGNUM *x, + int y_bit, + BN_CTX *ctx)) +# ifndef OPENSSL_NO_EC2M +/** Sets the affine coordinates of an EC_POINT. A synonym of + * EC_POINT_set_affine_coordinates + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param x BIGNUM with the x-coordinate + * \param y BIGNUM with the y-coordinate + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +DEPRECATEDIN_1_2_0(int EC_POINT_set_affine_coordinates_GF2m(const EC_GROUP *group, + EC_POINT *p, + const BIGNUM *x, + const BIGNUM *y, + BN_CTX *ctx)) + +/** Gets the affine coordinates of an EC_POINT. A synonym of + * EC_POINT_get_affine_coordinates + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param x BIGNUM for the x-coordinate + * \param y BIGNUM for the y-coordinate + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +DEPRECATEDIN_1_2_0(int EC_POINT_get_affine_coordinates_GF2m(const EC_GROUP *group, + const EC_POINT *p, + BIGNUM *x, + BIGNUM *y, + BN_CTX *ctx)) + +/** Sets the x9.62 compressed coordinates of a EC_POINT. A synonym of + * EC_POINT_set_compressed_coordinates + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param x BIGNUM with x-coordinate + * \param y_bit integer with the y-Bit (either 0 or 1) + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +DEPRECATEDIN_1_2_0(int EC_POINT_set_compressed_coordinates_GF2m(const EC_GROUP *group, + EC_POINT *p, + const BIGNUM *x, + int y_bit, + BN_CTX *ctx)) +# endif +/** Encodes a EC_POINT object to a octet string + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param form point conversion form + * \param buf memory buffer for the result. If NULL the function returns + * required buffer size. + * \param len length of the memory buffer + * \param ctx BN_CTX object (optional) + * \return the length of the encoded octet string or 0 if an error occurred + */ +size_t EC_POINT_point2oct(const EC_GROUP *group, const EC_POINT *p, + point_conversion_form_t form, + unsigned char *buf, size_t len, BN_CTX *ctx); + +/** Decodes a EC_POINT from a octet string + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param buf memory buffer with the encoded ec point + * \param len length of the encoded ec point + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +int EC_POINT_oct2point(const EC_GROUP *group, EC_POINT *p, + const unsigned char *buf, size_t len, BN_CTX *ctx); + +/** Encodes an EC_POINT object to an allocated octet string + * \param group underlying EC_GROUP object + * \param point EC_POINT object + * \param form point conversion form + * \param pbuf returns pointer to allocated buffer + * \param ctx BN_CTX object (optional) + * \return the length of the encoded octet string or 0 if an error occurred + */ +size_t EC_POINT_point2buf(const EC_GROUP *group, const EC_POINT *point, + point_conversion_form_t form, + unsigned char **pbuf, BN_CTX *ctx); + +/* other interfaces to point2oct/oct2point: */ +BIGNUM *EC_POINT_point2bn(const EC_GROUP *, const EC_POINT *, + point_conversion_form_t form, BIGNUM *, BN_CTX *); +EC_POINT *EC_POINT_bn2point(const EC_GROUP *, const BIGNUM *, + EC_POINT *, BN_CTX *); +char *EC_POINT_point2hex(const EC_GROUP *, const EC_POINT *, + point_conversion_form_t form, BN_CTX *); +EC_POINT *EC_POINT_hex2point(const EC_GROUP *, const char *, + EC_POINT *, BN_CTX *); + +/********************************************************************/ +/* functions for doing EC_POINT arithmetic */ +/********************************************************************/ + +/** Computes the sum of two EC_POINT + * \param group underlying EC_GROUP object + * \param r EC_POINT object for the result (r = a + b) + * \param a EC_POINT object with the first summand + * \param b EC_POINT object with the second summand + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +int EC_POINT_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, + const EC_POINT *b, BN_CTX *ctx); + +/** Computes the double of a EC_POINT + * \param group underlying EC_GROUP object + * \param r EC_POINT object for the result (r = 2 * a) + * \param a EC_POINT object + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +int EC_POINT_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, + BN_CTX *ctx); + +/** Computes the inverse of a EC_POINT + * \param group underlying EC_GROUP object + * \param a EC_POINT object to be inverted (it's used for the result as well) + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +int EC_POINT_invert(const EC_GROUP *group, EC_POINT *a, BN_CTX *ctx); + +/** Checks whether the point is the neutral element of the group + * \param group the underlying EC_GROUP object + * \param p EC_POINT object + * \return 1 if the point is the neutral element and 0 otherwise + */ +int EC_POINT_is_at_infinity(const EC_GROUP *group, const EC_POINT *p); + +/** Checks whether the point is on the curve + * \param group underlying EC_GROUP object + * \param point EC_POINT object to check + * \param ctx BN_CTX object (optional) + * \return 1 if the point is on the curve, 0 if not, or -1 on error + */ +int EC_POINT_is_on_curve(const EC_GROUP *group, const EC_POINT *point, + BN_CTX *ctx); + +/** Compares two EC_POINTs + * \param group underlying EC_GROUP object + * \param a first EC_POINT object + * \param b second EC_POINT object + * \param ctx BN_CTX object (optional) + * \return 1 if the points are not equal, 0 if they are, or -1 on error + */ +int EC_POINT_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b, + BN_CTX *ctx); + +int EC_POINT_make_affine(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx); +int EC_POINTs_make_affine(const EC_GROUP *group, size_t num, + EC_POINT *points[], BN_CTX *ctx); + +/** Computes r = generator * n + sum_{i=0}^{num-1} p[i] * m[i] + * \param group underlying EC_GROUP object + * \param r EC_POINT object for the result + * \param n BIGNUM with the multiplier for the group generator (optional) + * \param num number further summands + * \param p array of size num of EC_POINT objects + * \param m array of size num of BIGNUM objects + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *n, + size_t num, const EC_POINT *p[], const BIGNUM *m[], + BN_CTX *ctx); + +/** Computes r = generator * n + q * m + * \param group underlying EC_GROUP object + * \param r EC_POINT object for the result + * \param n BIGNUM with the multiplier for the group generator (optional) + * \param q EC_POINT object with the first factor of the second summand + * \param m BIGNUM with the second factor of the second summand + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +int EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *n, + const EC_POINT *q, const BIGNUM *m, BN_CTX *ctx); + +/** Stores multiples of generator for faster point multiplication + * \param group EC_GROUP object + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +int EC_GROUP_precompute_mult(EC_GROUP *group, BN_CTX *ctx); + +/** Reports whether a precomputation has been done + * \param group EC_GROUP object + * \return 1 if a pre-computation has been done and 0 otherwise + */ +int EC_GROUP_have_precompute_mult(const EC_GROUP *group); + +/********************************************************************/ +/* ASN1 stuff */ +/********************************************************************/ + +DECLARE_ASN1_ITEM(ECPKPARAMETERS) +DECLARE_ASN1_ALLOC_FUNCTIONS(ECPKPARAMETERS) +DECLARE_ASN1_ITEM(ECPARAMETERS) +DECLARE_ASN1_ALLOC_FUNCTIONS(ECPARAMETERS) + +/* + * EC_GROUP_get_basis_type() returns the NID of the basis type used to + * represent the field elements + */ +int EC_GROUP_get_basis_type(const EC_GROUP *); +# ifndef OPENSSL_NO_EC2M +int EC_GROUP_get_trinomial_basis(const EC_GROUP *, unsigned int *k); +int EC_GROUP_get_pentanomial_basis(const EC_GROUP *, unsigned int *k1, + unsigned int *k2, unsigned int *k3); +# endif + +# define OPENSSL_EC_EXPLICIT_CURVE 0x000 +# define OPENSSL_EC_NAMED_CURVE 0x001 + +EC_GROUP *d2i_ECPKParameters(EC_GROUP **, const unsigned char **in, long len); +int i2d_ECPKParameters(const EC_GROUP *, unsigned char **out); + +# define d2i_ECPKParameters_bio(bp,x) ASN1_d2i_bio_of(EC_GROUP,NULL,d2i_ECPKParameters,bp,x) +# define i2d_ECPKParameters_bio(bp,x) ASN1_i2d_bio_of_const(EC_GROUP,i2d_ECPKParameters,bp,x) +# define d2i_ECPKParameters_fp(fp,x) (EC_GROUP *)ASN1_d2i_fp(NULL, \ + (char *(*)())d2i_ECPKParameters,(fp),(unsigned char **)(x)) +# define i2d_ECPKParameters_fp(fp,x) ASN1_i2d_fp(i2d_ECPKParameters,(fp), \ + (unsigned char *)(x)) + +int ECPKParameters_print(BIO *bp, const EC_GROUP *x, int off); +# ifndef OPENSSL_NO_STDIO +int ECPKParameters_print_fp(FILE *fp, const EC_GROUP *x, int off); +# endif + +/********************************************************************/ +/* EC_KEY functions */ +/********************************************************************/ + +/* some values for the encoding_flag */ +# define EC_PKEY_NO_PARAMETERS 0x001 +# define EC_PKEY_NO_PUBKEY 0x002 + +/* some values for the flags field */ +# define EC_FLAG_NON_FIPS_ALLOW 0x1 +# define EC_FLAG_FIPS_CHECKED 0x2 +# define EC_FLAG_COFACTOR_ECDH 0x1000 + +/** Creates a new EC_KEY object. + * \return EC_KEY object or NULL if an error occurred. + */ +EC_KEY *EC_KEY_new(void); + +int EC_KEY_get_flags(const EC_KEY *key); + +void EC_KEY_set_flags(EC_KEY *key, int flags); + +void EC_KEY_clear_flags(EC_KEY *key, int flags); + +/** Creates a new EC_KEY object using a named curve as underlying + * EC_GROUP object. + * \param nid NID of the named curve. + * \return EC_KEY object or NULL if an error occurred. + */ +EC_KEY *EC_KEY_new_by_curve_name(int nid); + +/** Frees a EC_KEY object. + * \param key EC_KEY object to be freed. + */ +void EC_KEY_free(EC_KEY *key); + +/** Copies a EC_KEY object. + * \param dst destination EC_KEY object + * \param src src EC_KEY object + * \return dst or NULL if an error occurred. + */ +EC_KEY *EC_KEY_copy(EC_KEY *dst, const EC_KEY *src); + +/** Creates a new EC_KEY object and copies the content from src to it. + * \param src the source EC_KEY object + * \return newly created EC_KEY object or NULL if an error occurred. + */ +EC_KEY *EC_KEY_dup(const EC_KEY *src); + +/** Increases the internal reference count of a EC_KEY object. + * \param key EC_KEY object + * \return 1 on success and 0 if an error occurred. + */ +int EC_KEY_up_ref(EC_KEY *key); + +/** Returns the ENGINE object of a EC_KEY object + * \param eckey EC_KEY object + * \return the ENGINE object (possibly NULL). + */ +ENGINE *EC_KEY_get0_engine(const EC_KEY *eckey); + +/** Returns the EC_GROUP object of a EC_KEY object + * \param key EC_KEY object + * \return the EC_GROUP object (possibly NULL). + */ +const EC_GROUP *EC_KEY_get0_group(const EC_KEY *key); + +/** Sets the EC_GROUP of a EC_KEY object. + * \param key EC_KEY object + * \param group EC_GROUP to use in the EC_KEY object (note: the EC_KEY + * object will use an own copy of the EC_GROUP). + * \return 1 on success and 0 if an error occurred. + */ +int EC_KEY_set_group(EC_KEY *key, const EC_GROUP *group); + +/** Returns the private key of a EC_KEY object. + * \param key EC_KEY object + * \return a BIGNUM with the private key (possibly NULL). + */ +const BIGNUM *EC_KEY_get0_private_key(const EC_KEY *key); + +/** Sets the private key of a EC_KEY object. + * \param key EC_KEY object + * \param prv BIGNUM with the private key (note: the EC_KEY object + * will use an own copy of the BIGNUM). + * \return 1 on success and 0 if an error occurred. + */ +int EC_KEY_set_private_key(EC_KEY *key, const BIGNUM *prv); + +/** Returns the public key of a EC_KEY object. + * \param key the EC_KEY object + * \return a EC_POINT object with the public key (possibly NULL) + */ +const EC_POINT *EC_KEY_get0_public_key(const EC_KEY *key); + +/** Sets the public key of a EC_KEY object. + * \param key EC_KEY object + * \param pub EC_POINT object with the public key (note: the EC_KEY object + * will use an own copy of the EC_POINT object). + * \return 1 on success and 0 if an error occurred. + */ +int EC_KEY_set_public_key(EC_KEY *key, const EC_POINT *pub); + +unsigned EC_KEY_get_enc_flags(const EC_KEY *key); +void EC_KEY_set_enc_flags(EC_KEY *eckey, unsigned int flags); +point_conversion_form_t EC_KEY_get_conv_form(const EC_KEY *key); +void EC_KEY_set_conv_form(EC_KEY *eckey, point_conversion_form_t cform); + +#define EC_KEY_get_ex_new_index(l, p, newf, dupf, freef) \ + CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_EC_KEY, l, p, newf, dupf, freef) +int EC_KEY_set_ex_data(EC_KEY *key, int idx, void *arg); +void *EC_KEY_get_ex_data(const EC_KEY *key, int idx); + +/* wrapper functions for the underlying EC_GROUP object */ +void EC_KEY_set_asn1_flag(EC_KEY *eckey, int asn1_flag); + +/** Creates a table of pre-computed multiples of the generator to + * accelerate further EC_KEY operations. + * \param key EC_KEY object + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred. + */ +int EC_KEY_precompute_mult(EC_KEY *key, BN_CTX *ctx); + +/** Creates a new ec private (and optional a new public) key. + * \param key EC_KEY object + * \return 1 on success and 0 if an error occurred. + */ +int EC_KEY_generate_key(EC_KEY *key); + +/** Verifies that a private and/or public key is valid. + * \param key the EC_KEY object + * \return 1 on success and 0 otherwise. + */ +int EC_KEY_check_key(const EC_KEY *key); + +/** Indicates if an EC_KEY can be used for signing. + * \param eckey the EC_KEY object + * \return 1 if can can sign and 0 otherwise. + */ +int EC_KEY_can_sign(const EC_KEY *eckey); + +/** Sets a public key from affine coordinates performing + * necessary NIST PKV tests. + * \param key the EC_KEY object + * \param x public key x coordinate + * \param y public key y coordinate + * \return 1 on success and 0 otherwise. + */ +int EC_KEY_set_public_key_affine_coordinates(EC_KEY *key, BIGNUM *x, + BIGNUM *y); + +/** Encodes an EC_KEY public key to an allocated octet string + * \param key key to encode + * \param form point conversion form + * \param pbuf returns pointer to allocated buffer + * \param ctx BN_CTX object (optional) + * \return the length of the encoded octet string or 0 if an error occurred + */ +size_t EC_KEY_key2buf(const EC_KEY *key, point_conversion_form_t form, + unsigned char **pbuf, BN_CTX *ctx); + +/** Decodes a EC_KEY public key from a octet string + * \param key key to decode + * \param buf memory buffer with the encoded ec point + * \param len length of the encoded ec point + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ + +int EC_KEY_oct2key(EC_KEY *key, const unsigned char *buf, size_t len, + BN_CTX *ctx); + +/** Decodes an EC_KEY private key from an octet string + * \param key key to decode + * \param buf memory buffer with the encoded private key + * \param len length of the encoded key + * \return 1 on success and 0 if an error occurred + */ + +int EC_KEY_oct2priv(EC_KEY *key, const unsigned char *buf, size_t len); + +/** Encodes a EC_KEY private key to an octet string + * \param key key to encode + * \param buf memory buffer for the result. If NULL the function returns + * required buffer size. + * \param len length of the memory buffer + * \return the length of the encoded octet string or 0 if an error occurred + */ + +size_t EC_KEY_priv2oct(const EC_KEY *key, unsigned char *buf, size_t len); + +/** Encodes an EC_KEY private key to an allocated octet string + * \param eckey key to encode + * \param pbuf returns pointer to allocated buffer + * \return the length of the encoded octet string or 0 if an error occurred + */ +size_t EC_KEY_priv2buf(const EC_KEY *eckey, unsigned char **pbuf); + +/********************************************************************/ +/* de- and encoding functions for SEC1 ECPrivateKey */ +/********************************************************************/ + +/** Decodes a private key from a memory buffer. + * \param key a pointer to a EC_KEY object which should be used (or NULL) + * \param in pointer to memory with the DER encoded private key + * \param len length of the DER encoded private key + * \return the decoded private key or NULL if an error occurred. + */ +EC_KEY *d2i_ECPrivateKey(EC_KEY **key, const unsigned char **in, long len); + +/** Encodes a private key object and stores the result in a buffer. + * \param key the EC_KEY object to encode + * \param out the buffer for the result (if NULL the function returns number + * of bytes needed). + * \return 1 on success and 0 if an error occurred. + */ +int i2d_ECPrivateKey(EC_KEY *key, unsigned char **out); + +/********************************************************************/ +/* de- and encoding functions for EC parameters */ +/********************************************************************/ + +/** Decodes ec parameter from a memory buffer. + * \param key a pointer to a EC_KEY object which should be used (or NULL) + * \param in pointer to memory with the DER encoded ec parameters + * \param len length of the DER encoded ec parameters + * \return a EC_KEY object with the decoded parameters or NULL if an error + * occurred. + */ +EC_KEY *d2i_ECParameters(EC_KEY **key, const unsigned char **in, long len); + +/** Encodes ec parameter and stores the result in a buffer. + * \param key the EC_KEY object with ec parameters to encode + * \param out the buffer for the result (if NULL the function returns number + * of bytes needed). + * \return 1 on success and 0 if an error occurred. + */ +int i2d_ECParameters(EC_KEY *key, unsigned char **out); + +/********************************************************************/ +/* de- and encoding functions for EC public key */ +/* (octet string, not DER -- hence 'o2i' and 'i2o') */ +/********************************************************************/ + +/** Decodes a ec public key from a octet string. + * \param key a pointer to a EC_KEY object which should be used + * \param in memory buffer with the encoded public key + * \param len length of the encoded public key + * \return EC_KEY object with decoded public key or NULL if an error + * occurred. + */ +EC_KEY *o2i_ECPublicKey(EC_KEY **key, const unsigned char **in, long len); + +/** Encodes a ec public key in an octet string. + * \param key the EC_KEY object with the public key + * \param out the buffer for the result (if NULL the function returns number + * of bytes needed). + * \return 1 on success and 0 if an error occurred + */ +int i2o_ECPublicKey(const EC_KEY *key, unsigned char **out); + +/** Prints out the ec parameters on human readable form. + * \param bp BIO object to which the information is printed + * \param key EC_KEY object + * \return 1 on success and 0 if an error occurred + */ +int ECParameters_print(BIO *bp, const EC_KEY *key); + +/** Prints out the contents of a EC_KEY object + * \param bp BIO object to which the information is printed + * \param key EC_KEY object + * \param off line offset + * \return 1 on success and 0 if an error occurred + */ +int EC_KEY_print(BIO *bp, const EC_KEY *key, int off); + +# ifndef OPENSSL_NO_STDIO +/** Prints out the ec parameters on human readable form. + * \param fp file descriptor to which the information is printed + * \param key EC_KEY object + * \return 1 on success and 0 if an error occurred + */ +int ECParameters_print_fp(FILE *fp, const EC_KEY *key); + +/** Prints out the contents of a EC_KEY object + * \param fp file descriptor to which the information is printed + * \param key EC_KEY object + * \param off line offset + * \return 1 on success and 0 if an error occurred + */ +int EC_KEY_print_fp(FILE *fp, const EC_KEY *key, int off); + +# endif + +const EC_KEY_METHOD *EC_KEY_OpenSSL(void); +const EC_KEY_METHOD *EC_KEY_get_default_method(void); +void EC_KEY_set_default_method(const EC_KEY_METHOD *meth); +const EC_KEY_METHOD *EC_KEY_get_method(const EC_KEY *key); +int EC_KEY_set_method(EC_KEY *key, const EC_KEY_METHOD *meth); +EC_KEY *EC_KEY_new_method(ENGINE *engine); + +/** The old name for ecdh_KDF_X9_63 + * The ECDH KDF specification has been mistakingly attributed to ANSI X9.62, + * it is actually specified in ANSI X9.63. + * This identifier is retained for backwards compatibility + */ +int ECDH_KDF_X9_62(unsigned char *out, size_t outlen, + const unsigned char *Z, size_t Zlen, + const unsigned char *sinfo, size_t sinfolen, + const EVP_MD *md); + +int ECDH_compute_key(void *out, size_t outlen, const EC_POINT *pub_key, + const EC_KEY *ecdh, + void *(*KDF) (const void *in, size_t inlen, + void *out, size_t *outlen)); + +typedef struct ECDSA_SIG_st ECDSA_SIG; + +/** Allocates and initialize a ECDSA_SIG structure + * \return pointer to a ECDSA_SIG structure or NULL if an error occurred + */ +ECDSA_SIG *ECDSA_SIG_new(void); + +/** frees a ECDSA_SIG structure + * \param sig pointer to the ECDSA_SIG structure + */ +void ECDSA_SIG_free(ECDSA_SIG *sig); + +/** DER encode content of ECDSA_SIG object (note: this function modifies *pp + * (*pp += length of the DER encoded signature)). + * \param sig pointer to the ECDSA_SIG object + * \param pp pointer to a unsigned char pointer for the output or NULL + * \return the length of the DER encoded ECDSA_SIG object or a negative value + * on error + */ +int i2d_ECDSA_SIG(const ECDSA_SIG *sig, unsigned char **pp); + +/** Decodes a DER encoded ECDSA signature (note: this function changes *pp + * (*pp += len)). + * \param sig pointer to ECDSA_SIG pointer (may be NULL) + * \param pp memory buffer with the DER encoded signature + * \param len length of the buffer + * \return pointer to the decoded ECDSA_SIG structure (or NULL) + */ +ECDSA_SIG *d2i_ECDSA_SIG(ECDSA_SIG **sig, const unsigned char **pp, long len); + +/** Accessor for r and s fields of ECDSA_SIG + * \param sig pointer to ECDSA_SIG structure + * \param pr pointer to BIGNUM pointer for r (may be NULL) + * \param ps pointer to BIGNUM pointer for s (may be NULL) + */ +void ECDSA_SIG_get0(const ECDSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps); + +/** Accessor for r field of ECDSA_SIG + * \param sig pointer to ECDSA_SIG structure + */ +const BIGNUM *ECDSA_SIG_get0_r(const ECDSA_SIG *sig); + +/** Accessor for s field of ECDSA_SIG + * \param sig pointer to ECDSA_SIG structure + */ +const BIGNUM *ECDSA_SIG_get0_s(const ECDSA_SIG *sig); + +/** Setter for r and s fields of ECDSA_SIG + * \param sig pointer to ECDSA_SIG structure + * \param r pointer to BIGNUM for r (may be NULL) + * \param s pointer to BIGNUM for s (may be NULL) + */ +int ECDSA_SIG_set0(ECDSA_SIG *sig, BIGNUM *r, BIGNUM *s); + +/** Computes the ECDSA signature of the given hash value using + * the supplied private key and returns the created signature. + * \param dgst pointer to the hash value + * \param dgst_len length of the hash value + * \param eckey EC_KEY object containing a private EC key + * \return pointer to a ECDSA_SIG structure or NULL if an error occurred + */ +ECDSA_SIG *ECDSA_do_sign(const unsigned char *dgst, int dgst_len, + EC_KEY *eckey); + +/** Computes ECDSA signature of a given hash value using the supplied + * private key (note: sig must point to ECDSA_size(eckey) bytes of memory). + * \param dgst pointer to the hash value to sign + * \param dgstlen length of the hash value + * \param kinv BIGNUM with a pre-computed inverse k (optional) + * \param rp BIGNUM with a pre-computed rp value (optional), + * see ECDSA_sign_setup + * \param eckey EC_KEY object containing a private EC key + * \return pointer to a ECDSA_SIG structure or NULL if an error occurred + */ +ECDSA_SIG *ECDSA_do_sign_ex(const unsigned char *dgst, int dgstlen, + const BIGNUM *kinv, const BIGNUM *rp, + EC_KEY *eckey); + +/** Verifies that the supplied signature is a valid ECDSA + * signature of the supplied hash value using the supplied public key. + * \param dgst pointer to the hash value + * \param dgst_len length of the hash value + * \param sig ECDSA_SIG structure + * \param eckey EC_KEY object containing a public EC key + * \return 1 if the signature is valid, 0 if the signature is invalid + * and -1 on error + */ +int ECDSA_do_verify(const unsigned char *dgst, int dgst_len, + const ECDSA_SIG *sig, EC_KEY *eckey); + +/** Precompute parts of the signing operation + * \param eckey EC_KEY object containing a private EC key + * \param ctx BN_CTX object (optional) + * \param kinv BIGNUM pointer for the inverse of k + * \param rp BIGNUM pointer for x coordinate of k * generator + * \return 1 on success and 0 otherwise + */ +int ECDSA_sign_setup(EC_KEY *eckey, BN_CTX *ctx, BIGNUM **kinv, BIGNUM **rp); + +/** Computes ECDSA signature of a given hash value using the supplied + * private key (note: sig must point to ECDSA_size(eckey) bytes of memory). + * \param type this parameter is ignored + * \param dgst pointer to the hash value to sign + * \param dgstlen length of the hash value + * \param sig memory for the DER encoded created signature + * \param siglen pointer to the length of the returned signature + * \param eckey EC_KEY object containing a private EC key + * \return 1 on success and 0 otherwise + */ +int ECDSA_sign(int type, const unsigned char *dgst, int dgstlen, + unsigned char *sig, unsigned int *siglen, EC_KEY *eckey); + +/** Computes ECDSA signature of a given hash value using the supplied + * private key (note: sig must point to ECDSA_size(eckey) bytes of memory). + * \param type this parameter is ignored + * \param dgst pointer to the hash value to sign + * \param dgstlen length of the hash value + * \param sig buffer to hold the DER encoded signature + * \param siglen pointer to the length of the returned signature + * \param kinv BIGNUM with a pre-computed inverse k (optional) + * \param rp BIGNUM with a pre-computed rp value (optional), + * see ECDSA_sign_setup + * \param eckey EC_KEY object containing a private EC key + * \return 1 on success and 0 otherwise + */ +int ECDSA_sign_ex(int type, const unsigned char *dgst, int dgstlen, + unsigned char *sig, unsigned int *siglen, + const BIGNUM *kinv, const BIGNUM *rp, EC_KEY *eckey); + +/** Verifies that the given signature is valid ECDSA signature + * of the supplied hash value using the specified public key. + * \param type this parameter is ignored + * \param dgst pointer to the hash value + * \param dgstlen length of the hash value + * \param sig pointer to the DER encoded signature + * \param siglen length of the DER encoded signature + * \param eckey EC_KEY object containing a public EC key + * \return 1 if the signature is valid, 0 if the signature is invalid + * and -1 on error + */ +int ECDSA_verify(int type, const unsigned char *dgst, int dgstlen, + const unsigned char *sig, int siglen, EC_KEY *eckey); + +/** Returns the maximum length of the DER encoded signature + * \param eckey EC_KEY object + * \return numbers of bytes required for the DER encoded signature + */ +int ECDSA_size(const EC_KEY *eckey); + +/********************************************************************/ +/* EC_KEY_METHOD constructors, destructors, writers and accessors */ +/********************************************************************/ + +EC_KEY_METHOD *EC_KEY_METHOD_new(const EC_KEY_METHOD *meth); +void EC_KEY_METHOD_free(EC_KEY_METHOD *meth); +void EC_KEY_METHOD_set_init(EC_KEY_METHOD *meth, + int (*init)(EC_KEY *key), + void (*finish)(EC_KEY *key), + int (*copy)(EC_KEY *dest, const EC_KEY *src), + int (*set_group)(EC_KEY *key, const EC_GROUP *grp), + int (*set_private)(EC_KEY *key, + const BIGNUM *priv_key), + int (*set_public)(EC_KEY *key, + const EC_POINT *pub_key)); + +void EC_KEY_METHOD_set_keygen(EC_KEY_METHOD *meth, + int (*keygen)(EC_KEY *key)); + +void EC_KEY_METHOD_set_compute_key(EC_KEY_METHOD *meth, + int (*ckey)(unsigned char **psec, + size_t *pseclen, + const EC_POINT *pub_key, + const EC_KEY *ecdh)); + +void EC_KEY_METHOD_set_sign(EC_KEY_METHOD *meth, + int (*sign)(int type, const unsigned char *dgst, + int dlen, unsigned char *sig, + unsigned int *siglen, + const BIGNUM *kinv, const BIGNUM *r, + EC_KEY *eckey), + int (*sign_setup)(EC_KEY *eckey, BN_CTX *ctx_in, + BIGNUM **kinvp, BIGNUM **rp), + ECDSA_SIG *(*sign_sig)(const unsigned char *dgst, + int dgst_len, + const BIGNUM *in_kinv, + const BIGNUM *in_r, + EC_KEY *eckey)); + +void EC_KEY_METHOD_set_verify(EC_KEY_METHOD *meth, + int (*verify)(int type, const unsigned + char *dgst, int dgst_len, + const unsigned char *sigbuf, + int sig_len, EC_KEY *eckey), + int (*verify_sig)(const unsigned char *dgst, + int dgst_len, + const ECDSA_SIG *sig, + EC_KEY *eckey)); + +void EC_KEY_METHOD_get_init(const EC_KEY_METHOD *meth, + int (**pinit)(EC_KEY *key), + void (**pfinish)(EC_KEY *key), + int (**pcopy)(EC_KEY *dest, const EC_KEY *src), + int (**pset_group)(EC_KEY *key, + const EC_GROUP *grp), + int (**pset_private)(EC_KEY *key, + const BIGNUM *priv_key), + int (**pset_public)(EC_KEY *key, + const EC_POINT *pub_key)); + +void EC_KEY_METHOD_get_keygen(const EC_KEY_METHOD *meth, + int (**pkeygen)(EC_KEY *key)); + +void EC_KEY_METHOD_get_compute_key(const EC_KEY_METHOD *meth, + int (**pck)(unsigned char **psec, + size_t *pseclen, + const EC_POINT *pub_key, + const EC_KEY *ecdh)); + +void EC_KEY_METHOD_get_sign(const EC_KEY_METHOD *meth, + int (**psign)(int type, const unsigned char *dgst, + int dlen, unsigned char *sig, + unsigned int *siglen, + const BIGNUM *kinv, const BIGNUM *r, + EC_KEY *eckey), + int (**psign_setup)(EC_KEY *eckey, BN_CTX *ctx_in, + BIGNUM **kinvp, BIGNUM **rp), + ECDSA_SIG *(**psign_sig)(const unsigned char *dgst, + int dgst_len, + const BIGNUM *in_kinv, + const BIGNUM *in_r, + EC_KEY *eckey)); + +void EC_KEY_METHOD_get_verify(const EC_KEY_METHOD *meth, + int (**pverify)(int type, const unsigned + char *dgst, int dgst_len, + const unsigned char *sigbuf, + int sig_len, EC_KEY *eckey), + int (**pverify_sig)(const unsigned char *dgst, + int dgst_len, + const ECDSA_SIG *sig, + EC_KEY *eckey)); + +# define ECParameters_dup(x) ASN1_dup_of(EC_KEY,i2d_ECParameters,d2i_ECParameters,x) + +# ifndef __cplusplus +# if defined(__SUNPRO_C) +# if __SUNPRO_C >= 0x520 +# pragma error_messages (default,E_ARRAY_OF_INCOMPLETE_NONAME,E_ARRAY_OF_INCOMPLETE) +# endif +# endif +# endif + +# define EVP_PKEY_CTX_set_ec_paramgen_curve_nid(ctx, nid) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ + EVP_PKEY_OP_PARAMGEN|EVP_PKEY_OP_KEYGEN, \ + EVP_PKEY_CTRL_EC_PARAMGEN_CURVE_NID, nid, NULL) + +# define EVP_PKEY_CTX_set_ec_param_enc(ctx, flag) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ + EVP_PKEY_OP_PARAMGEN|EVP_PKEY_OP_KEYGEN, \ + EVP_PKEY_CTRL_EC_PARAM_ENC, flag, NULL) + +# define EVP_PKEY_CTX_set_ecdh_cofactor_mode(ctx, flag) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_EC_ECDH_COFACTOR, flag, NULL) + +# define EVP_PKEY_CTX_get_ecdh_cofactor_mode(ctx) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_EC_ECDH_COFACTOR, -2, NULL) + +# define EVP_PKEY_CTX_set_ecdh_kdf_type(ctx, kdf) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_EC_KDF_TYPE, kdf, NULL) + +# define EVP_PKEY_CTX_get_ecdh_kdf_type(ctx) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_EC_KDF_TYPE, -2, NULL) + +# define EVP_PKEY_CTX_set_ecdh_kdf_md(ctx, md) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_EC_KDF_MD, 0, (void *)(md)) + +# define EVP_PKEY_CTX_get_ecdh_kdf_md(ctx, pmd) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_GET_EC_KDF_MD, 0, (void *)(pmd)) + +# define EVP_PKEY_CTX_set_ecdh_kdf_outlen(ctx, len) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_EC_KDF_OUTLEN, len, NULL) + +# define EVP_PKEY_CTX_get_ecdh_kdf_outlen(ctx, plen) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_GET_EC_KDF_OUTLEN, 0, \ + (void *)(plen)) + +# define EVP_PKEY_CTX_set0_ecdh_kdf_ukm(ctx, p, plen) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_EC_KDF_UKM, plen, (void *)(p)) + +# define EVP_PKEY_CTX_get0_ecdh_kdf_ukm(ctx, p) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_GET_EC_KDF_UKM, 0, (void *)(p)) + +/* SM2 will skip the operation check so no need to pass operation here */ +# define EVP_PKEY_CTX_set1_id(ctx, id, id_len) \ + EVP_PKEY_CTX_ctrl(ctx, -1, -1, \ + EVP_PKEY_CTRL_SET1_ID, (int)id_len, (void*)(id)) + +# define EVP_PKEY_CTX_get1_id(ctx, id) \ + EVP_PKEY_CTX_ctrl(ctx, -1, -1, \ + EVP_PKEY_CTRL_GET1_ID, 0, (void*)(id)) + +# define EVP_PKEY_CTX_get1_id_len(ctx, id_len) \ + EVP_PKEY_CTX_ctrl(ctx, -1, -1, \ + EVP_PKEY_CTRL_GET1_ID_LEN, 0, (void*)(id_len)) + +# define EVP_PKEY_CTRL_EC_PARAMGEN_CURVE_NID (EVP_PKEY_ALG_CTRL + 1) +# define EVP_PKEY_CTRL_EC_PARAM_ENC (EVP_PKEY_ALG_CTRL + 2) +# define EVP_PKEY_CTRL_EC_ECDH_COFACTOR (EVP_PKEY_ALG_CTRL + 3) +# define EVP_PKEY_CTRL_EC_KDF_TYPE (EVP_PKEY_ALG_CTRL + 4) +# define EVP_PKEY_CTRL_EC_KDF_MD (EVP_PKEY_ALG_CTRL + 5) +# define EVP_PKEY_CTRL_GET_EC_KDF_MD (EVP_PKEY_ALG_CTRL + 6) +# define EVP_PKEY_CTRL_EC_KDF_OUTLEN (EVP_PKEY_ALG_CTRL + 7) +# define EVP_PKEY_CTRL_GET_EC_KDF_OUTLEN (EVP_PKEY_ALG_CTRL + 8) +# define EVP_PKEY_CTRL_EC_KDF_UKM (EVP_PKEY_ALG_CTRL + 9) +# define EVP_PKEY_CTRL_GET_EC_KDF_UKM (EVP_PKEY_ALG_CTRL + 10) +# define EVP_PKEY_CTRL_SET1_ID (EVP_PKEY_ALG_CTRL + 11) +# define EVP_PKEY_CTRL_GET1_ID (EVP_PKEY_ALG_CTRL + 12) +# define EVP_PKEY_CTRL_GET1_ID_LEN (EVP_PKEY_ALG_CTRL + 13) +/* KDF types */ +# define EVP_PKEY_ECDH_KDF_NONE 1 +# define EVP_PKEY_ECDH_KDF_X9_63 2 +/** The old name for EVP_PKEY_ECDH_KDF_X9_63 + * The ECDH KDF specification has been mistakingly attributed to ANSI X9.62, + * it is actually specified in ANSI X9.63. + * This identifier is retained for backwards compatibility + */ +# define EVP_PKEY_ECDH_KDF_X9_62 EVP_PKEY_ECDH_KDF_X9_63 + + +# ifdef __cplusplus +} +# endif +# endif +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/ecdh.h b/MediaClient/MediaClient/openssl/include/openssl/ecdh.h new file mode 100644 index 0000000..681f3d5 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/ecdh.h @@ -0,0 +1,10 @@ +/* + * Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#include diff --git a/MediaClient/MediaClient/openssl/include/openssl/ecdsa.h b/MediaClient/MediaClient/openssl/include/openssl/ecdsa.h new file mode 100644 index 0000000..681f3d5 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/ecdsa.h @@ -0,0 +1,10 @@ +/* + * Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#include diff --git a/MediaClient/MediaClient/openssl/include/openssl/ecerr.h b/MediaClient/MediaClient/openssl/include/openssl/ecerr.h new file mode 100644 index 0000000..f7b9183 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/ecerr.h @@ -0,0 +1,275 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_ECERR_H +# define HEADER_ECERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# include + +# ifndef OPENSSL_NO_EC + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_EC_strings(void); + +/* + * EC function codes. + */ +# define EC_F_BN_TO_FELEM 224 +# define EC_F_D2I_ECPARAMETERS 144 +# define EC_F_D2I_ECPKPARAMETERS 145 +# define EC_F_D2I_ECPRIVATEKEY 146 +# define EC_F_DO_EC_KEY_PRINT 221 +# define EC_F_ECDH_CMS_DECRYPT 238 +# define EC_F_ECDH_CMS_SET_SHARED_INFO 239 +# define EC_F_ECDH_COMPUTE_KEY 246 +# define EC_F_ECDH_SIMPLE_COMPUTE_KEY 257 +# define EC_F_ECDSA_DO_SIGN_EX 251 +# define EC_F_ECDSA_DO_VERIFY 252 +# define EC_F_ECDSA_SIGN_EX 254 +# define EC_F_ECDSA_SIGN_SETUP 248 +# define EC_F_ECDSA_SIG_NEW 265 +# define EC_F_ECDSA_VERIFY 253 +# define EC_F_ECD_ITEM_VERIFY 270 +# define EC_F_ECKEY_PARAM2TYPE 223 +# define EC_F_ECKEY_PARAM_DECODE 212 +# define EC_F_ECKEY_PRIV_DECODE 213 +# define EC_F_ECKEY_PRIV_ENCODE 214 +# define EC_F_ECKEY_PUB_DECODE 215 +# define EC_F_ECKEY_PUB_ENCODE 216 +# define EC_F_ECKEY_TYPE2PARAM 220 +# define EC_F_ECPARAMETERS_PRINT 147 +# define EC_F_ECPARAMETERS_PRINT_FP 148 +# define EC_F_ECPKPARAMETERS_PRINT 149 +# define EC_F_ECPKPARAMETERS_PRINT_FP 150 +# define EC_F_ECP_NISTZ256_GET_AFFINE 240 +# define EC_F_ECP_NISTZ256_INV_MOD_ORD 275 +# define EC_F_ECP_NISTZ256_MULT_PRECOMPUTE 243 +# define EC_F_ECP_NISTZ256_POINTS_MUL 241 +# define EC_F_ECP_NISTZ256_PRE_COMP_NEW 244 +# define EC_F_ECP_NISTZ256_WINDOWED_MUL 242 +# define EC_F_ECX_KEY_OP 266 +# define EC_F_ECX_PRIV_ENCODE 267 +# define EC_F_ECX_PUB_ENCODE 268 +# define EC_F_EC_ASN1_GROUP2CURVE 153 +# define EC_F_EC_ASN1_GROUP2FIELDID 154 +# define EC_F_EC_GF2M_MONTGOMERY_POINT_MULTIPLY 208 +# define EC_F_EC_GF2M_SIMPLE_FIELD_INV 296 +# define EC_F_EC_GF2M_SIMPLE_GROUP_CHECK_DISCRIMINANT 159 +# define EC_F_EC_GF2M_SIMPLE_GROUP_SET_CURVE 195 +# define EC_F_EC_GF2M_SIMPLE_LADDER_POST 285 +# define EC_F_EC_GF2M_SIMPLE_LADDER_PRE 288 +# define EC_F_EC_GF2M_SIMPLE_OCT2POINT 160 +# define EC_F_EC_GF2M_SIMPLE_POINT2OCT 161 +# define EC_F_EC_GF2M_SIMPLE_POINTS_MUL 289 +# define EC_F_EC_GF2M_SIMPLE_POINT_GET_AFFINE_COORDINATES 162 +# define EC_F_EC_GF2M_SIMPLE_POINT_SET_AFFINE_COORDINATES 163 +# define EC_F_EC_GF2M_SIMPLE_SET_COMPRESSED_COORDINATES 164 +# define EC_F_EC_GFP_MONT_FIELD_DECODE 133 +# define EC_F_EC_GFP_MONT_FIELD_ENCODE 134 +# define EC_F_EC_GFP_MONT_FIELD_INV 297 +# define EC_F_EC_GFP_MONT_FIELD_MUL 131 +# define EC_F_EC_GFP_MONT_FIELD_SET_TO_ONE 209 +# define EC_F_EC_GFP_MONT_FIELD_SQR 132 +# define EC_F_EC_GFP_MONT_GROUP_SET_CURVE 189 +# define EC_F_EC_GFP_NISTP224_GROUP_SET_CURVE 225 +# define EC_F_EC_GFP_NISTP224_POINTS_MUL 228 +# define EC_F_EC_GFP_NISTP224_POINT_GET_AFFINE_COORDINATES 226 +# define EC_F_EC_GFP_NISTP256_GROUP_SET_CURVE 230 +# define EC_F_EC_GFP_NISTP256_POINTS_MUL 231 +# define EC_F_EC_GFP_NISTP256_POINT_GET_AFFINE_COORDINATES 232 +# define EC_F_EC_GFP_NISTP521_GROUP_SET_CURVE 233 +# define EC_F_EC_GFP_NISTP521_POINTS_MUL 234 +# define EC_F_EC_GFP_NISTP521_POINT_GET_AFFINE_COORDINATES 235 +# define EC_F_EC_GFP_NIST_FIELD_MUL 200 +# define EC_F_EC_GFP_NIST_FIELD_SQR 201 +# define EC_F_EC_GFP_NIST_GROUP_SET_CURVE 202 +# define EC_F_EC_GFP_SIMPLE_BLIND_COORDINATES 287 +# define EC_F_EC_GFP_SIMPLE_FIELD_INV 298 +# define EC_F_EC_GFP_SIMPLE_GROUP_CHECK_DISCRIMINANT 165 +# define EC_F_EC_GFP_SIMPLE_GROUP_SET_CURVE 166 +# define EC_F_EC_GFP_SIMPLE_MAKE_AFFINE 102 +# define EC_F_EC_GFP_SIMPLE_OCT2POINT 103 +# define EC_F_EC_GFP_SIMPLE_POINT2OCT 104 +# define EC_F_EC_GFP_SIMPLE_POINTS_MAKE_AFFINE 137 +# define EC_F_EC_GFP_SIMPLE_POINT_GET_AFFINE_COORDINATES 167 +# define EC_F_EC_GFP_SIMPLE_POINT_SET_AFFINE_COORDINATES 168 +# define EC_F_EC_GFP_SIMPLE_SET_COMPRESSED_COORDINATES 169 +# define EC_F_EC_GROUP_CHECK 170 +# define EC_F_EC_GROUP_CHECK_DISCRIMINANT 171 +# define EC_F_EC_GROUP_COPY 106 +# define EC_F_EC_GROUP_GET_CURVE 291 +# define EC_F_EC_GROUP_GET_CURVE_GF2M 172 +# define EC_F_EC_GROUP_GET_CURVE_GFP 130 +# define EC_F_EC_GROUP_GET_DEGREE 173 +# define EC_F_EC_GROUP_GET_ECPARAMETERS 261 +# define EC_F_EC_GROUP_GET_ECPKPARAMETERS 262 +# define EC_F_EC_GROUP_GET_PENTANOMIAL_BASIS 193 +# define EC_F_EC_GROUP_GET_TRINOMIAL_BASIS 194 +# define EC_F_EC_GROUP_NEW 108 +# define EC_F_EC_GROUP_NEW_BY_CURVE_NAME 174 +# define EC_F_EC_GROUP_NEW_FROM_DATA 175 +# define EC_F_EC_GROUP_NEW_FROM_ECPARAMETERS 263 +# define EC_F_EC_GROUP_NEW_FROM_ECPKPARAMETERS 264 +# define EC_F_EC_GROUP_SET_CURVE 292 +# define EC_F_EC_GROUP_SET_CURVE_GF2M 176 +# define EC_F_EC_GROUP_SET_CURVE_GFP 109 +# define EC_F_EC_GROUP_SET_GENERATOR 111 +# define EC_F_EC_GROUP_SET_SEED 286 +# define EC_F_EC_KEY_CHECK_KEY 177 +# define EC_F_EC_KEY_COPY 178 +# define EC_F_EC_KEY_GENERATE_KEY 179 +# define EC_F_EC_KEY_NEW 182 +# define EC_F_EC_KEY_NEW_METHOD 245 +# define EC_F_EC_KEY_OCT2PRIV 255 +# define EC_F_EC_KEY_PRINT 180 +# define EC_F_EC_KEY_PRINT_FP 181 +# define EC_F_EC_KEY_PRIV2BUF 279 +# define EC_F_EC_KEY_PRIV2OCT 256 +# define EC_F_EC_KEY_SET_PUBLIC_KEY_AFFINE_COORDINATES 229 +# define EC_F_EC_KEY_SIMPLE_CHECK_KEY 258 +# define EC_F_EC_KEY_SIMPLE_OCT2PRIV 259 +# define EC_F_EC_KEY_SIMPLE_PRIV2OCT 260 +# define EC_F_EC_PKEY_CHECK 273 +# define EC_F_EC_PKEY_PARAM_CHECK 274 +# define EC_F_EC_POINTS_MAKE_AFFINE 136 +# define EC_F_EC_POINTS_MUL 290 +# define EC_F_EC_POINT_ADD 112 +# define EC_F_EC_POINT_BN2POINT 280 +# define EC_F_EC_POINT_CMP 113 +# define EC_F_EC_POINT_COPY 114 +# define EC_F_EC_POINT_DBL 115 +# define EC_F_EC_POINT_GET_AFFINE_COORDINATES 293 +# define EC_F_EC_POINT_GET_AFFINE_COORDINATES_GF2M 183 +# define EC_F_EC_POINT_GET_AFFINE_COORDINATES_GFP 116 +# define EC_F_EC_POINT_GET_JPROJECTIVE_COORDINATES_GFP 117 +# define EC_F_EC_POINT_INVERT 210 +# define EC_F_EC_POINT_IS_AT_INFINITY 118 +# define EC_F_EC_POINT_IS_ON_CURVE 119 +# define EC_F_EC_POINT_MAKE_AFFINE 120 +# define EC_F_EC_POINT_NEW 121 +# define EC_F_EC_POINT_OCT2POINT 122 +# define EC_F_EC_POINT_POINT2BUF 281 +# define EC_F_EC_POINT_POINT2OCT 123 +# define EC_F_EC_POINT_SET_AFFINE_COORDINATES 294 +# define EC_F_EC_POINT_SET_AFFINE_COORDINATES_GF2M 185 +# define EC_F_EC_POINT_SET_AFFINE_COORDINATES_GFP 124 +# define EC_F_EC_POINT_SET_COMPRESSED_COORDINATES 295 +# define EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GF2M 186 +# define EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GFP 125 +# define EC_F_EC_POINT_SET_JPROJECTIVE_COORDINATES_GFP 126 +# define EC_F_EC_POINT_SET_TO_INFINITY 127 +# define EC_F_EC_PRE_COMP_NEW 196 +# define EC_F_EC_SCALAR_MUL_LADDER 284 +# define EC_F_EC_WNAF_MUL 187 +# define EC_F_EC_WNAF_PRECOMPUTE_MULT 188 +# define EC_F_I2D_ECPARAMETERS 190 +# define EC_F_I2D_ECPKPARAMETERS 191 +# define EC_F_I2D_ECPRIVATEKEY 192 +# define EC_F_I2O_ECPUBLICKEY 151 +# define EC_F_NISTP224_PRE_COMP_NEW 227 +# define EC_F_NISTP256_PRE_COMP_NEW 236 +# define EC_F_NISTP521_PRE_COMP_NEW 237 +# define EC_F_O2I_ECPUBLICKEY 152 +# define EC_F_OLD_EC_PRIV_DECODE 222 +# define EC_F_OSSL_ECDH_COMPUTE_KEY 247 +# define EC_F_OSSL_ECDSA_SIGN_SIG 249 +# define EC_F_OSSL_ECDSA_VERIFY_SIG 250 +# define EC_F_PKEY_ECD_CTRL 271 +# define EC_F_PKEY_ECD_DIGESTSIGN 272 +# define EC_F_PKEY_ECD_DIGESTSIGN25519 276 +# define EC_F_PKEY_ECD_DIGESTSIGN448 277 +# define EC_F_PKEY_ECX_DERIVE 269 +# define EC_F_PKEY_EC_CTRL 197 +# define EC_F_PKEY_EC_CTRL_STR 198 +# define EC_F_PKEY_EC_DERIVE 217 +# define EC_F_PKEY_EC_INIT 282 +# define EC_F_PKEY_EC_KDF_DERIVE 283 +# define EC_F_PKEY_EC_KEYGEN 199 +# define EC_F_PKEY_EC_PARAMGEN 219 +# define EC_F_PKEY_EC_SIGN 218 +# define EC_F_VALIDATE_ECX_DERIVE 278 + +/* + * EC reason codes. + */ +# define EC_R_ASN1_ERROR 115 +# define EC_R_BAD_SIGNATURE 156 +# define EC_R_BIGNUM_OUT_OF_RANGE 144 +# define EC_R_BUFFER_TOO_SMALL 100 +# define EC_R_CANNOT_INVERT 165 +# define EC_R_COORDINATES_OUT_OF_RANGE 146 +# define EC_R_CURVE_DOES_NOT_SUPPORT_ECDH 160 +# define EC_R_CURVE_DOES_NOT_SUPPORT_SIGNING 159 +# define EC_R_D2I_ECPKPARAMETERS_FAILURE 117 +# define EC_R_DECODE_ERROR 142 +# define EC_R_DISCRIMINANT_IS_ZERO 118 +# define EC_R_EC_GROUP_NEW_BY_NAME_FAILURE 119 +# define EC_R_FIELD_TOO_LARGE 143 +# define EC_R_GF2M_NOT_SUPPORTED 147 +# define EC_R_GROUP2PKPARAMETERS_FAILURE 120 +# define EC_R_I2D_ECPKPARAMETERS_FAILURE 121 +# define EC_R_INCOMPATIBLE_OBJECTS 101 +# define EC_R_INVALID_ARGUMENT 112 +# define EC_R_INVALID_COMPRESSED_POINT 110 +# define EC_R_INVALID_COMPRESSION_BIT 109 +# define EC_R_INVALID_CURVE 141 +# define EC_R_INVALID_DIGEST 151 +# define EC_R_INVALID_DIGEST_TYPE 138 +# define EC_R_INVALID_ENCODING 102 +# define EC_R_INVALID_FIELD 103 +# define EC_R_INVALID_FORM 104 +# define EC_R_INVALID_GROUP_ORDER 122 +# define EC_R_INVALID_KEY 116 +# define EC_R_INVALID_OUTPUT_LENGTH 161 +# define EC_R_INVALID_PEER_KEY 133 +# define EC_R_INVALID_PENTANOMIAL_BASIS 132 +# define EC_R_INVALID_PRIVATE_KEY 123 +# define EC_R_INVALID_TRINOMIAL_BASIS 137 +# define EC_R_KDF_PARAMETER_ERROR 148 +# define EC_R_KEYS_NOT_SET 140 +# define EC_R_LADDER_POST_FAILURE 136 +# define EC_R_LADDER_PRE_FAILURE 153 +# define EC_R_LADDER_STEP_FAILURE 162 +# define EC_R_MISSING_PARAMETERS 124 +# define EC_R_MISSING_PRIVATE_KEY 125 +# define EC_R_NEED_NEW_SETUP_VALUES 157 +# define EC_R_NOT_A_NIST_PRIME 135 +# define EC_R_NOT_IMPLEMENTED 126 +# define EC_R_NOT_INITIALIZED 111 +# define EC_R_NO_PARAMETERS_SET 139 +# define EC_R_NO_PRIVATE_VALUE 154 +# define EC_R_OPERATION_NOT_SUPPORTED 152 +# define EC_R_PASSED_NULL_PARAMETER 134 +# define EC_R_PEER_KEY_ERROR 149 +# define EC_R_PKPARAMETERS2GROUP_FAILURE 127 +# define EC_R_POINT_ARITHMETIC_FAILURE 155 +# define EC_R_POINT_AT_INFINITY 106 +# define EC_R_POINT_COORDINATES_BLIND_FAILURE 163 +# define EC_R_POINT_IS_NOT_ON_CURVE 107 +# define EC_R_RANDOM_NUMBER_GENERATION_FAILED 158 +# define EC_R_SHARED_INFO_ERROR 150 +# define EC_R_SLOT_FULL 108 +# define EC_R_UNDEFINED_GENERATOR 113 +# define EC_R_UNDEFINED_ORDER 128 +# define EC_R_UNKNOWN_COFACTOR 164 +# define EC_R_UNKNOWN_GROUP 129 +# define EC_R_UNKNOWN_ORDER 114 +# define EC_R_UNSUPPORTED_FIELD 131 +# define EC_R_WRONG_CURVE_PARAMETERS 145 +# define EC_R_WRONG_ORDER 130 + +# endif +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/engine.h b/MediaClient/MediaClient/openssl/include/openssl/engine.h new file mode 100644 index 0000000..0780f0f --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/engine.h @@ -0,0 +1,751 @@ +/* + * Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved. + * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_ENGINE_H +# define HEADER_ENGINE_H + +# include + +# ifndef OPENSSL_NO_ENGINE +# if OPENSSL_API_COMPAT < 0x10100000L +# include +# include +# include +# include +# include +# include +# include +# include +# endif +# include +# include +# include +# include +# ifdef __cplusplus +extern "C" { +# endif + +/* + * These flags are used to control combinations of algorithm (methods) by + * bitwise "OR"ing. + */ +# define ENGINE_METHOD_RSA (unsigned int)0x0001 +# define ENGINE_METHOD_DSA (unsigned int)0x0002 +# define ENGINE_METHOD_DH (unsigned int)0x0004 +# define ENGINE_METHOD_RAND (unsigned int)0x0008 +# define ENGINE_METHOD_CIPHERS (unsigned int)0x0040 +# define ENGINE_METHOD_DIGESTS (unsigned int)0x0080 +# define ENGINE_METHOD_PKEY_METHS (unsigned int)0x0200 +# define ENGINE_METHOD_PKEY_ASN1_METHS (unsigned int)0x0400 +# define ENGINE_METHOD_EC (unsigned int)0x0800 +/* Obvious all-or-nothing cases. */ +# define ENGINE_METHOD_ALL (unsigned int)0xFFFF +# define ENGINE_METHOD_NONE (unsigned int)0x0000 + +/* + * This(ese) flag(s) controls behaviour of the ENGINE_TABLE mechanism used + * internally to control registration of ENGINE implementations, and can be + * set by ENGINE_set_table_flags(). The "NOINIT" flag prevents attempts to + * initialise registered ENGINEs if they are not already initialised. + */ +# define ENGINE_TABLE_FLAG_NOINIT (unsigned int)0x0001 + +/* ENGINE flags that can be set by ENGINE_set_flags(). */ +/* Not used */ +/* #define ENGINE_FLAGS_MALLOCED 0x0001 */ + +/* + * This flag is for ENGINEs that wish to handle the various 'CMD'-related + * control commands on their own. Without this flag, ENGINE_ctrl() handles + * these control commands on behalf of the ENGINE using their "cmd_defns" + * data. + */ +# define ENGINE_FLAGS_MANUAL_CMD_CTRL (int)0x0002 + +/* + * This flag is for ENGINEs who return new duplicate structures when found + * via "ENGINE_by_id()". When an ENGINE must store state (eg. if + * ENGINE_ctrl() commands are called in sequence as part of some stateful + * process like key-generation setup and execution), it can set this flag - + * then each attempt to obtain the ENGINE will result in it being copied into + * a new structure. Normally, ENGINEs don't declare this flag so + * ENGINE_by_id() just increments the existing ENGINE's structural reference + * count. + */ +# define ENGINE_FLAGS_BY_ID_COPY (int)0x0004 + +/* + * This flag if for an ENGINE that does not want its methods registered as + * part of ENGINE_register_all_complete() for example if the methods are not + * usable as default methods. + */ + +# define ENGINE_FLAGS_NO_REGISTER_ALL (int)0x0008 + +/* + * ENGINEs can support their own command types, and these flags are used in + * ENGINE_CTRL_GET_CMD_FLAGS to indicate to the caller what kind of input + * each command expects. Currently only numeric and string input is + * supported. If a control command supports none of the _NUMERIC, _STRING, or + * _NO_INPUT options, then it is regarded as an "internal" control command - + * and not for use in config setting situations. As such, they're not + * available to the ENGINE_ctrl_cmd_string() function, only raw ENGINE_ctrl() + * access. Changes to this list of 'command types' should be reflected + * carefully in ENGINE_cmd_is_executable() and ENGINE_ctrl_cmd_string(). + */ + +/* accepts a 'long' input value (3rd parameter to ENGINE_ctrl) */ +# define ENGINE_CMD_FLAG_NUMERIC (unsigned int)0x0001 +/* + * accepts string input (cast from 'void*' to 'const char *', 4th parameter + * to ENGINE_ctrl) + */ +# define ENGINE_CMD_FLAG_STRING (unsigned int)0x0002 +/* + * Indicates that the control command takes *no* input. Ie. the control + * command is unparameterised. + */ +# define ENGINE_CMD_FLAG_NO_INPUT (unsigned int)0x0004 +/* + * Indicates that the control command is internal. This control command won't + * be shown in any output, and is only usable through the ENGINE_ctrl_cmd() + * function. + */ +# define ENGINE_CMD_FLAG_INTERNAL (unsigned int)0x0008 + +/* + * NB: These 3 control commands are deprecated and should not be used. + * ENGINEs relying on these commands should compile conditional support for + * compatibility (eg. if these symbols are defined) but should also migrate + * the same functionality to their own ENGINE-specific control functions that + * can be "discovered" by calling applications. The fact these control + * commands wouldn't be "executable" (ie. usable by text-based config) + * doesn't change the fact that application code can find and use them + * without requiring per-ENGINE hacking. + */ + +/* + * These flags are used to tell the ctrl function what should be done. All + * command numbers are shared between all engines, even if some don't make + * sense to some engines. In such a case, they do nothing but return the + * error ENGINE_R_CTRL_COMMAND_NOT_IMPLEMENTED. + */ +# define ENGINE_CTRL_SET_LOGSTREAM 1 +# define ENGINE_CTRL_SET_PASSWORD_CALLBACK 2 +# define ENGINE_CTRL_HUP 3/* Close and reinitialise + * any handles/connections + * etc. */ +# define ENGINE_CTRL_SET_USER_INTERFACE 4/* Alternative to callback */ +# define ENGINE_CTRL_SET_CALLBACK_DATA 5/* User-specific data, used + * when calling the password + * callback and the user + * interface */ +# define ENGINE_CTRL_LOAD_CONFIGURATION 6/* Load a configuration, + * given a string that + * represents a file name + * or so */ +# define ENGINE_CTRL_LOAD_SECTION 7/* Load data from a given + * section in the already + * loaded configuration */ + +/* + * These control commands allow an application to deal with an arbitrary + * engine in a dynamic way. Warn: Negative return values indicate errors FOR + * THESE COMMANDS because zero is used to indicate 'end-of-list'. Other + * commands, including ENGINE-specific command types, return zero for an + * error. An ENGINE can choose to implement these ctrl functions, and can + * internally manage things however it chooses - it does so by setting the + * ENGINE_FLAGS_MANUAL_CMD_CTRL flag (using ENGINE_set_flags()). Otherwise + * the ENGINE_ctrl() code handles this on the ENGINE's behalf using the + * cmd_defns data (set using ENGINE_set_cmd_defns()). This means an ENGINE's + * ctrl() handler need only implement its own commands - the above "meta" + * commands will be taken care of. + */ + +/* + * Returns non-zero if the supplied ENGINE has a ctrl() handler. If "not", + * then all the remaining control commands will return failure, so it is + * worth checking this first if the caller is trying to "discover" the + * engine's capabilities and doesn't want errors generated unnecessarily. + */ +# define ENGINE_CTRL_HAS_CTRL_FUNCTION 10 +/* + * Returns a positive command number for the first command supported by the + * engine. Returns zero if no ctrl commands are supported. + */ +# define ENGINE_CTRL_GET_FIRST_CMD_TYPE 11 +/* + * The 'long' argument specifies a command implemented by the engine, and the + * return value is the next command supported, or zero if there are no more. + */ +# define ENGINE_CTRL_GET_NEXT_CMD_TYPE 12 +/* + * The 'void*' argument is a command name (cast from 'const char *'), and the + * return value is the command that corresponds to it. + */ +# define ENGINE_CTRL_GET_CMD_FROM_NAME 13 +/* + * The next two allow a command to be converted into its corresponding string + * form. In each case, the 'long' argument supplies the command. In the + * NAME_LEN case, the return value is the length of the command name (not + * counting a trailing EOL). In the NAME case, the 'void*' argument must be a + * string buffer large enough, and it will be populated with the name of the + * command (WITH a trailing EOL). + */ +# define ENGINE_CTRL_GET_NAME_LEN_FROM_CMD 14 +# define ENGINE_CTRL_GET_NAME_FROM_CMD 15 +/* The next two are similar but give a "short description" of a command. */ +# define ENGINE_CTRL_GET_DESC_LEN_FROM_CMD 16 +# define ENGINE_CTRL_GET_DESC_FROM_CMD 17 +/* + * With this command, the return value is the OR'd combination of + * ENGINE_CMD_FLAG_*** values that indicate what kind of input a given + * engine-specific ctrl command expects. + */ +# define ENGINE_CTRL_GET_CMD_FLAGS 18 + +/* + * ENGINE implementations should start the numbering of their own control + * commands from this value. (ie. ENGINE_CMD_BASE, ENGINE_CMD_BASE + 1, etc). + */ +# define ENGINE_CMD_BASE 200 + +/* + * NB: These 2 nCipher "chil" control commands are deprecated, and their + * functionality is now available through ENGINE-specific control commands + * (exposed through the above-mentioned 'CMD'-handling). Code using these 2 + * commands should be migrated to the more general command handling before + * these are removed. + */ + +/* Flags specific to the nCipher "chil" engine */ +# define ENGINE_CTRL_CHIL_SET_FORKCHECK 100 + /* + * Depending on the value of the (long)i argument, this sets or + * unsets the SimpleForkCheck flag in the CHIL API to enable or + * disable checking and workarounds for applications that fork(). + */ +# define ENGINE_CTRL_CHIL_NO_LOCKING 101 + /* + * This prevents the initialisation function from providing mutex + * callbacks to the nCipher library. + */ + +/* + * If an ENGINE supports its own specific control commands and wishes the + * framework to handle the above 'ENGINE_CMD_***'-manipulation commands on + * its behalf, it should supply a null-terminated array of ENGINE_CMD_DEFN + * entries to ENGINE_set_cmd_defns(). It should also implement a ctrl() + * handler that supports the stated commands (ie. the "cmd_num" entries as + * described by the array). NB: The array must be ordered in increasing order + * of cmd_num. "null-terminated" means that the last ENGINE_CMD_DEFN element + * has cmd_num set to zero and/or cmd_name set to NULL. + */ +typedef struct ENGINE_CMD_DEFN_st { + unsigned int cmd_num; /* The command number */ + const char *cmd_name; /* The command name itself */ + const char *cmd_desc; /* A short description of the command */ + unsigned int cmd_flags; /* The input the command expects */ +} ENGINE_CMD_DEFN; + +/* Generic function pointer */ +typedef int (*ENGINE_GEN_FUNC_PTR) (void); +/* Generic function pointer taking no arguments */ +typedef int (*ENGINE_GEN_INT_FUNC_PTR) (ENGINE *); +/* Specific control function pointer */ +typedef int (*ENGINE_CTRL_FUNC_PTR) (ENGINE *, int, long, void *, + void (*f) (void)); +/* Generic load_key function pointer */ +typedef EVP_PKEY *(*ENGINE_LOAD_KEY_PTR)(ENGINE *, const char *, + UI_METHOD *ui_method, + void *callback_data); +typedef int (*ENGINE_SSL_CLIENT_CERT_PTR) (ENGINE *, SSL *ssl, + STACK_OF(X509_NAME) *ca_dn, + X509 **pcert, EVP_PKEY **pkey, + STACK_OF(X509) **pother, + UI_METHOD *ui_method, + void *callback_data); +/*- + * These callback types are for an ENGINE's handler for cipher and digest logic. + * These handlers have these prototypes; + * int foo(ENGINE *e, const EVP_CIPHER **cipher, const int **nids, int nid); + * int foo(ENGINE *e, const EVP_MD **digest, const int **nids, int nid); + * Looking at how to implement these handlers in the case of cipher support, if + * the framework wants the EVP_CIPHER for 'nid', it will call; + * foo(e, &p_evp_cipher, NULL, nid); (return zero for failure) + * If the framework wants a list of supported 'nid's, it will call; + * foo(e, NULL, &p_nids, 0); (returns number of 'nids' or -1 for error) + */ +/* + * Returns to a pointer to the array of supported cipher 'nid's. If the + * second parameter is non-NULL it is set to the size of the returned array. + */ +typedef int (*ENGINE_CIPHERS_PTR) (ENGINE *, const EVP_CIPHER **, + const int **, int); +typedef int (*ENGINE_DIGESTS_PTR) (ENGINE *, const EVP_MD **, const int **, + int); +typedef int (*ENGINE_PKEY_METHS_PTR) (ENGINE *, EVP_PKEY_METHOD **, + const int **, int); +typedef int (*ENGINE_PKEY_ASN1_METHS_PTR) (ENGINE *, EVP_PKEY_ASN1_METHOD **, + const int **, int); +/* + * STRUCTURE functions ... all of these functions deal with pointers to + * ENGINE structures where the pointers have a "structural reference". This + * means that their reference is to allowed access to the structure but it + * does not imply that the structure is functional. To simply increment or + * decrement the structural reference count, use ENGINE_by_id and + * ENGINE_free. NB: This is not required when iterating using ENGINE_get_next + * as it will automatically decrement the structural reference count of the + * "current" ENGINE and increment the structural reference count of the + * ENGINE it returns (unless it is NULL). + */ + +/* Get the first/last "ENGINE" type available. */ +ENGINE *ENGINE_get_first(void); +ENGINE *ENGINE_get_last(void); +/* Iterate to the next/previous "ENGINE" type (NULL = end of the list). */ +ENGINE *ENGINE_get_next(ENGINE *e); +ENGINE *ENGINE_get_prev(ENGINE *e); +/* Add another "ENGINE" type into the array. */ +int ENGINE_add(ENGINE *e); +/* Remove an existing "ENGINE" type from the array. */ +int ENGINE_remove(ENGINE *e); +/* Retrieve an engine from the list by its unique "id" value. */ +ENGINE *ENGINE_by_id(const char *id); + +#if OPENSSL_API_COMPAT < 0x10100000L +# define ENGINE_load_openssl() \ + OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_OPENSSL, NULL) +# define ENGINE_load_dynamic() \ + OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_DYNAMIC, NULL) +# ifndef OPENSSL_NO_STATIC_ENGINE +# define ENGINE_load_padlock() \ + OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_PADLOCK, NULL) +# define ENGINE_load_capi() \ + OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_CAPI, NULL) +# define ENGINE_load_afalg() \ + OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_AFALG, NULL) +# endif +# define ENGINE_load_cryptodev() \ + OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_CRYPTODEV, NULL) +# define ENGINE_load_rdrand() \ + OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_RDRAND, NULL) +#endif +void ENGINE_load_builtin_engines(void); + +/* + * Get and set global flags (ENGINE_TABLE_FLAG_***) for the implementation + * "registry" handling. + */ +unsigned int ENGINE_get_table_flags(void); +void ENGINE_set_table_flags(unsigned int flags); + +/*- Manage registration of ENGINEs per "table". For each type, there are 3 + * functions; + * ENGINE_register_***(e) - registers the implementation from 'e' (if it has one) + * ENGINE_unregister_***(e) - unregister the implementation from 'e' + * ENGINE_register_all_***() - call ENGINE_register_***() for each 'e' in the list + * Cleanup is automatically registered from each table when required. + */ + +int ENGINE_register_RSA(ENGINE *e); +void ENGINE_unregister_RSA(ENGINE *e); +void ENGINE_register_all_RSA(void); + +int ENGINE_register_DSA(ENGINE *e); +void ENGINE_unregister_DSA(ENGINE *e); +void ENGINE_register_all_DSA(void); + +int ENGINE_register_EC(ENGINE *e); +void ENGINE_unregister_EC(ENGINE *e); +void ENGINE_register_all_EC(void); + +int ENGINE_register_DH(ENGINE *e); +void ENGINE_unregister_DH(ENGINE *e); +void ENGINE_register_all_DH(void); + +int ENGINE_register_RAND(ENGINE *e); +void ENGINE_unregister_RAND(ENGINE *e); +void ENGINE_register_all_RAND(void); + +int ENGINE_register_ciphers(ENGINE *e); +void ENGINE_unregister_ciphers(ENGINE *e); +void ENGINE_register_all_ciphers(void); + +int ENGINE_register_digests(ENGINE *e); +void ENGINE_unregister_digests(ENGINE *e); +void ENGINE_register_all_digests(void); + +int ENGINE_register_pkey_meths(ENGINE *e); +void ENGINE_unregister_pkey_meths(ENGINE *e); +void ENGINE_register_all_pkey_meths(void); + +int ENGINE_register_pkey_asn1_meths(ENGINE *e); +void ENGINE_unregister_pkey_asn1_meths(ENGINE *e); +void ENGINE_register_all_pkey_asn1_meths(void); + +/* + * These functions register all support from the above categories. Note, use + * of these functions can result in static linkage of code your application + * may not need. If you only need a subset of functionality, consider using + * more selective initialisation. + */ +int ENGINE_register_complete(ENGINE *e); +int ENGINE_register_all_complete(void); + +/* + * Send parameterised control commands to the engine. The possibilities to + * send down an integer, a pointer to data or a function pointer are + * provided. Any of the parameters may or may not be NULL, depending on the + * command number. In actuality, this function only requires a structural + * (rather than functional) reference to an engine, but many control commands + * may require the engine be functional. The caller should be aware of trying + * commands that require an operational ENGINE, and only use functional + * references in such situations. + */ +int ENGINE_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f) (void)); + +/* + * This function tests if an ENGINE-specific command is usable as a + * "setting". Eg. in an application's config file that gets processed through + * ENGINE_ctrl_cmd_string(). If this returns zero, it is not available to + * ENGINE_ctrl_cmd_string(), only ENGINE_ctrl(). + */ +int ENGINE_cmd_is_executable(ENGINE *e, int cmd); + +/* + * This function works like ENGINE_ctrl() with the exception of taking a + * command name instead of a command number, and can handle optional + * commands. See the comment on ENGINE_ctrl_cmd_string() for an explanation + * on how to use the cmd_name and cmd_optional. + */ +int ENGINE_ctrl_cmd(ENGINE *e, const char *cmd_name, + long i, void *p, void (*f) (void), int cmd_optional); + +/* + * This function passes a command-name and argument to an ENGINE. The + * cmd_name is converted to a command number and the control command is + * called using 'arg' as an argument (unless the ENGINE doesn't support such + * a command, in which case no control command is called). The command is + * checked for input flags, and if necessary the argument will be converted + * to a numeric value. If cmd_optional is non-zero, then if the ENGINE + * doesn't support the given cmd_name the return value will be success + * anyway. This function is intended for applications to use so that users + * (or config files) can supply engine-specific config data to the ENGINE at + * run-time to control behaviour of specific engines. As such, it shouldn't + * be used for calling ENGINE_ctrl() functions that return data, deal with + * binary data, or that are otherwise supposed to be used directly through + * ENGINE_ctrl() in application code. Any "return" data from an ENGINE_ctrl() + * operation in this function will be lost - the return value is interpreted + * as failure if the return value is zero, success otherwise, and this + * function returns a boolean value as a result. In other words, vendors of + * 'ENGINE'-enabled devices should write ENGINE implementations with + * parameterisations that work in this scheme, so that compliant ENGINE-based + * applications can work consistently with the same configuration for the + * same ENGINE-enabled devices, across applications. + */ +int ENGINE_ctrl_cmd_string(ENGINE *e, const char *cmd_name, const char *arg, + int cmd_optional); + +/* + * These functions are useful for manufacturing new ENGINE structures. They + * don't address reference counting at all - one uses them to populate an + * ENGINE structure with personalised implementations of things prior to + * using it directly or adding it to the builtin ENGINE list in OpenSSL. + * These are also here so that the ENGINE structure doesn't have to be + * exposed and break binary compatibility! + */ +ENGINE *ENGINE_new(void); +int ENGINE_free(ENGINE *e); +int ENGINE_up_ref(ENGINE *e); +int ENGINE_set_id(ENGINE *e, const char *id); +int ENGINE_set_name(ENGINE *e, const char *name); +int ENGINE_set_RSA(ENGINE *e, const RSA_METHOD *rsa_meth); +int ENGINE_set_DSA(ENGINE *e, const DSA_METHOD *dsa_meth); +int ENGINE_set_EC(ENGINE *e, const EC_KEY_METHOD *ecdsa_meth); +int ENGINE_set_DH(ENGINE *e, const DH_METHOD *dh_meth); +int ENGINE_set_RAND(ENGINE *e, const RAND_METHOD *rand_meth); +int ENGINE_set_destroy_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR destroy_f); +int ENGINE_set_init_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR init_f); +int ENGINE_set_finish_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR finish_f); +int ENGINE_set_ctrl_function(ENGINE *e, ENGINE_CTRL_FUNC_PTR ctrl_f); +int ENGINE_set_load_privkey_function(ENGINE *e, + ENGINE_LOAD_KEY_PTR loadpriv_f); +int ENGINE_set_load_pubkey_function(ENGINE *e, ENGINE_LOAD_KEY_PTR loadpub_f); +int ENGINE_set_load_ssl_client_cert_function(ENGINE *e, + ENGINE_SSL_CLIENT_CERT_PTR + loadssl_f); +int ENGINE_set_ciphers(ENGINE *e, ENGINE_CIPHERS_PTR f); +int ENGINE_set_digests(ENGINE *e, ENGINE_DIGESTS_PTR f); +int ENGINE_set_pkey_meths(ENGINE *e, ENGINE_PKEY_METHS_PTR f); +int ENGINE_set_pkey_asn1_meths(ENGINE *e, ENGINE_PKEY_ASN1_METHS_PTR f); +int ENGINE_set_flags(ENGINE *e, int flags); +int ENGINE_set_cmd_defns(ENGINE *e, const ENGINE_CMD_DEFN *defns); +/* These functions allow control over any per-structure ENGINE data. */ +#define ENGINE_get_ex_new_index(l, p, newf, dupf, freef) \ + CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_ENGINE, l, p, newf, dupf, freef) +int ENGINE_set_ex_data(ENGINE *e, int idx, void *arg); +void *ENGINE_get_ex_data(const ENGINE *e, int idx); + +#if OPENSSL_API_COMPAT < 0x10100000L +/* + * This function previously cleaned up anything that needs it. Auto-deinit will + * now take care of it so it is no longer required to call this function. + */ +# define ENGINE_cleanup() while(0) continue +#endif + +/* + * These return values from within the ENGINE structure. These can be useful + * with functional references as well as structural references - it depends + * which you obtained. Using the result for functional purposes if you only + * obtained a structural reference may be problematic! + */ +const char *ENGINE_get_id(const ENGINE *e); +const char *ENGINE_get_name(const ENGINE *e); +const RSA_METHOD *ENGINE_get_RSA(const ENGINE *e); +const DSA_METHOD *ENGINE_get_DSA(const ENGINE *e); +const EC_KEY_METHOD *ENGINE_get_EC(const ENGINE *e); +const DH_METHOD *ENGINE_get_DH(const ENGINE *e); +const RAND_METHOD *ENGINE_get_RAND(const ENGINE *e); +ENGINE_GEN_INT_FUNC_PTR ENGINE_get_destroy_function(const ENGINE *e); +ENGINE_GEN_INT_FUNC_PTR ENGINE_get_init_function(const ENGINE *e); +ENGINE_GEN_INT_FUNC_PTR ENGINE_get_finish_function(const ENGINE *e); +ENGINE_CTRL_FUNC_PTR ENGINE_get_ctrl_function(const ENGINE *e); +ENGINE_LOAD_KEY_PTR ENGINE_get_load_privkey_function(const ENGINE *e); +ENGINE_LOAD_KEY_PTR ENGINE_get_load_pubkey_function(const ENGINE *e); +ENGINE_SSL_CLIENT_CERT_PTR ENGINE_get_ssl_client_cert_function(const ENGINE + *e); +ENGINE_CIPHERS_PTR ENGINE_get_ciphers(const ENGINE *e); +ENGINE_DIGESTS_PTR ENGINE_get_digests(const ENGINE *e); +ENGINE_PKEY_METHS_PTR ENGINE_get_pkey_meths(const ENGINE *e); +ENGINE_PKEY_ASN1_METHS_PTR ENGINE_get_pkey_asn1_meths(const ENGINE *e); +const EVP_CIPHER *ENGINE_get_cipher(ENGINE *e, int nid); +const EVP_MD *ENGINE_get_digest(ENGINE *e, int nid); +const EVP_PKEY_METHOD *ENGINE_get_pkey_meth(ENGINE *e, int nid); +const EVP_PKEY_ASN1_METHOD *ENGINE_get_pkey_asn1_meth(ENGINE *e, int nid); +const EVP_PKEY_ASN1_METHOD *ENGINE_get_pkey_asn1_meth_str(ENGINE *e, + const char *str, + int len); +const EVP_PKEY_ASN1_METHOD *ENGINE_pkey_asn1_find_str(ENGINE **pe, + const char *str, + int len); +const ENGINE_CMD_DEFN *ENGINE_get_cmd_defns(const ENGINE *e); +int ENGINE_get_flags(const ENGINE *e); + +/* + * FUNCTIONAL functions. These functions deal with ENGINE structures that + * have (or will) be initialised for use. Broadly speaking, the structural + * functions are useful for iterating the list of available engine types, + * creating new engine types, and other "list" operations. These functions + * actually deal with ENGINEs that are to be used. As such these functions + * can fail (if applicable) when particular engines are unavailable - eg. if + * a hardware accelerator is not attached or not functioning correctly. Each + * ENGINE has 2 reference counts; structural and functional. Every time a + * functional reference is obtained or released, a corresponding structural + * reference is automatically obtained or released too. + */ + +/* + * Initialise a engine type for use (or up its reference count if it's + * already in use). This will fail if the engine is not currently operational + * and cannot initialise. + */ +int ENGINE_init(ENGINE *e); +/* + * Free a functional reference to a engine type. This does not require a + * corresponding call to ENGINE_free as it also releases a structural + * reference. + */ +int ENGINE_finish(ENGINE *e); + +/* + * The following functions handle keys that are stored in some secondary + * location, handled by the engine. The storage may be on a card or + * whatever. + */ +EVP_PKEY *ENGINE_load_private_key(ENGINE *e, const char *key_id, + UI_METHOD *ui_method, void *callback_data); +EVP_PKEY *ENGINE_load_public_key(ENGINE *e, const char *key_id, + UI_METHOD *ui_method, void *callback_data); +int ENGINE_load_ssl_client_cert(ENGINE *e, SSL *s, + STACK_OF(X509_NAME) *ca_dn, X509 **pcert, + EVP_PKEY **ppkey, STACK_OF(X509) **pother, + UI_METHOD *ui_method, void *callback_data); + +/* + * This returns a pointer for the current ENGINE structure that is (by + * default) performing any RSA operations. The value returned is an + * incremented reference, so it should be free'd (ENGINE_finish) before it is + * discarded. + */ +ENGINE *ENGINE_get_default_RSA(void); +/* Same for the other "methods" */ +ENGINE *ENGINE_get_default_DSA(void); +ENGINE *ENGINE_get_default_EC(void); +ENGINE *ENGINE_get_default_DH(void); +ENGINE *ENGINE_get_default_RAND(void); +/* + * These functions can be used to get a functional reference to perform + * ciphering or digesting corresponding to "nid". + */ +ENGINE *ENGINE_get_cipher_engine(int nid); +ENGINE *ENGINE_get_digest_engine(int nid); +ENGINE *ENGINE_get_pkey_meth_engine(int nid); +ENGINE *ENGINE_get_pkey_asn1_meth_engine(int nid); + +/* + * This sets a new default ENGINE structure for performing RSA operations. If + * the result is non-zero (success) then the ENGINE structure will have had + * its reference count up'd so the caller should still free their own + * reference 'e'. + */ +int ENGINE_set_default_RSA(ENGINE *e); +int ENGINE_set_default_string(ENGINE *e, const char *def_list); +/* Same for the other "methods" */ +int ENGINE_set_default_DSA(ENGINE *e); +int ENGINE_set_default_EC(ENGINE *e); +int ENGINE_set_default_DH(ENGINE *e); +int ENGINE_set_default_RAND(ENGINE *e); +int ENGINE_set_default_ciphers(ENGINE *e); +int ENGINE_set_default_digests(ENGINE *e); +int ENGINE_set_default_pkey_meths(ENGINE *e); +int ENGINE_set_default_pkey_asn1_meths(ENGINE *e); + +/* + * The combination "set" - the flags are bitwise "OR"d from the + * ENGINE_METHOD_*** defines above. As with the "ENGINE_register_complete()" + * function, this function can result in unnecessary static linkage. If your + * application requires only specific functionality, consider using more + * selective functions. + */ +int ENGINE_set_default(ENGINE *e, unsigned int flags); + +void ENGINE_add_conf_module(void); + +/* Deprecated functions ... */ +/* int ENGINE_clear_defaults(void); */ + +/**************************/ +/* DYNAMIC ENGINE SUPPORT */ +/**************************/ + +/* Binary/behaviour compatibility levels */ +# define OSSL_DYNAMIC_VERSION (unsigned long)0x00030000 +/* + * Binary versions older than this are too old for us (whether we're a loader + * or a loadee) + */ +# define OSSL_DYNAMIC_OLDEST (unsigned long)0x00030000 + +/* + * When compiling an ENGINE entirely as an external shared library, loadable + * by the "dynamic" ENGINE, these types are needed. The 'dynamic_fns' + * structure type provides the calling application's (or library's) error + * functionality and memory management function pointers to the loaded + * library. These should be used/set in the loaded library code so that the + * loading application's 'state' will be used/changed in all operations. The + * 'static_state' pointer allows the loaded library to know if it shares the + * same static data as the calling application (or library), and thus whether + * these callbacks need to be set or not. + */ +typedef void *(*dyn_MEM_malloc_fn) (size_t, const char *, int); +typedef void *(*dyn_MEM_realloc_fn) (void *, size_t, const char *, int); +typedef void (*dyn_MEM_free_fn) (void *, const char *, int); +typedef struct st_dynamic_MEM_fns { + dyn_MEM_malloc_fn malloc_fn; + dyn_MEM_realloc_fn realloc_fn; + dyn_MEM_free_fn free_fn; +} dynamic_MEM_fns; +/* + * FIXME: Perhaps the memory and locking code (crypto.h) should declare and + * use these types so we (and any other dependent code) can simplify a bit?? + */ +/* The top-level structure */ +typedef struct st_dynamic_fns { + void *static_state; + dynamic_MEM_fns mem_fns; +} dynamic_fns; + +/* + * The version checking function should be of this prototype. NB: The + * ossl_version value passed in is the OSSL_DYNAMIC_VERSION of the loading + * code. If this function returns zero, it indicates a (potential) version + * incompatibility and the loaded library doesn't believe it can proceed. + * Otherwise, the returned value is the (latest) version supported by the + * loading library. The loader may still decide that the loaded code's + * version is unsatisfactory and could veto the load. The function is + * expected to be implemented with the symbol name "v_check", and a default + * implementation can be fully instantiated with + * IMPLEMENT_DYNAMIC_CHECK_FN(). + */ +typedef unsigned long (*dynamic_v_check_fn) (unsigned long ossl_version); +# define IMPLEMENT_DYNAMIC_CHECK_FN() \ + OPENSSL_EXPORT unsigned long v_check(unsigned long v); \ + OPENSSL_EXPORT unsigned long v_check(unsigned long v) { \ + if (v >= OSSL_DYNAMIC_OLDEST) return OSSL_DYNAMIC_VERSION; \ + return 0; } + +/* + * This function is passed the ENGINE structure to initialise with its own + * function and command settings. It should not adjust the structural or + * functional reference counts. If this function returns zero, (a) the load + * will be aborted, (b) the previous ENGINE state will be memcpy'd back onto + * the structure, and (c) the shared library will be unloaded. So + * implementations should do their own internal cleanup in failure + * circumstances otherwise they could leak. The 'id' parameter, if non-NULL, + * represents the ENGINE id that the loader is looking for. If this is NULL, + * the shared library can choose to return failure or to initialise a + * 'default' ENGINE. If non-NULL, the shared library must initialise only an + * ENGINE matching the passed 'id'. The function is expected to be + * implemented with the symbol name "bind_engine". A standard implementation + * can be instantiated with IMPLEMENT_DYNAMIC_BIND_FN(fn) where the parameter + * 'fn' is a callback function that populates the ENGINE structure and + * returns an int value (zero for failure). 'fn' should have prototype; + * [static] int fn(ENGINE *e, const char *id); + */ +typedef int (*dynamic_bind_engine) (ENGINE *e, const char *id, + const dynamic_fns *fns); +# define IMPLEMENT_DYNAMIC_BIND_FN(fn) \ + OPENSSL_EXPORT \ + int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns); \ + OPENSSL_EXPORT \ + int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns) { \ + if (ENGINE_get_static_state() == fns->static_state) goto skip_cbs; \ + CRYPTO_set_mem_functions(fns->mem_fns.malloc_fn, \ + fns->mem_fns.realloc_fn, \ + fns->mem_fns.free_fn); \ + skip_cbs: \ + if (!fn(e, id)) return 0; \ + return 1; } + +/* + * If the loading application (or library) and the loaded ENGINE library + * share the same static data (eg. they're both dynamically linked to the + * same libcrypto.so) we need a way to avoid trying to set system callbacks - + * this would fail, and for the same reason that it's unnecessary to try. If + * the loaded ENGINE has (or gets from through the loader) its own copy of + * the libcrypto static data, we will need to set the callbacks. The easiest + * way to detect this is to have a function that returns a pointer to some + * static data and let the loading application and loaded ENGINE compare + * their respective values. + */ +void *ENGINE_get_static_state(void); + +# if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) +DEPRECATEDIN_1_1_0(void ENGINE_setup_bsd_cryptodev(void)) +# endif + + +# ifdef __cplusplus +} +# endif +# endif +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/engineerr.h b/MediaClient/MediaClient/openssl/include/openssl/engineerr.h new file mode 100644 index 0000000..05e84bd --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/engineerr.h @@ -0,0 +1,111 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_ENGINEERR_H +# define HEADER_ENGINEERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# include + +# ifndef OPENSSL_NO_ENGINE + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_ENGINE_strings(void); + +/* + * ENGINE function codes. + */ +# define ENGINE_F_DIGEST_UPDATE 198 +# define ENGINE_F_DYNAMIC_CTRL 180 +# define ENGINE_F_DYNAMIC_GET_DATA_CTX 181 +# define ENGINE_F_DYNAMIC_LOAD 182 +# define ENGINE_F_DYNAMIC_SET_DATA_CTX 183 +# define ENGINE_F_ENGINE_ADD 105 +# define ENGINE_F_ENGINE_BY_ID 106 +# define ENGINE_F_ENGINE_CMD_IS_EXECUTABLE 170 +# define ENGINE_F_ENGINE_CTRL 142 +# define ENGINE_F_ENGINE_CTRL_CMD 178 +# define ENGINE_F_ENGINE_CTRL_CMD_STRING 171 +# define ENGINE_F_ENGINE_FINISH 107 +# define ENGINE_F_ENGINE_GET_CIPHER 185 +# define ENGINE_F_ENGINE_GET_DIGEST 186 +# define ENGINE_F_ENGINE_GET_FIRST 195 +# define ENGINE_F_ENGINE_GET_LAST 196 +# define ENGINE_F_ENGINE_GET_NEXT 115 +# define ENGINE_F_ENGINE_GET_PKEY_ASN1_METH 193 +# define ENGINE_F_ENGINE_GET_PKEY_METH 192 +# define ENGINE_F_ENGINE_GET_PREV 116 +# define ENGINE_F_ENGINE_INIT 119 +# define ENGINE_F_ENGINE_LIST_ADD 120 +# define ENGINE_F_ENGINE_LIST_REMOVE 121 +# define ENGINE_F_ENGINE_LOAD_PRIVATE_KEY 150 +# define ENGINE_F_ENGINE_LOAD_PUBLIC_KEY 151 +# define ENGINE_F_ENGINE_LOAD_SSL_CLIENT_CERT 194 +# define ENGINE_F_ENGINE_NEW 122 +# define ENGINE_F_ENGINE_PKEY_ASN1_FIND_STR 197 +# define ENGINE_F_ENGINE_REMOVE 123 +# define ENGINE_F_ENGINE_SET_DEFAULT_STRING 189 +# define ENGINE_F_ENGINE_SET_ID 129 +# define ENGINE_F_ENGINE_SET_NAME 130 +# define ENGINE_F_ENGINE_TABLE_REGISTER 184 +# define ENGINE_F_ENGINE_UNLOCKED_FINISH 191 +# define ENGINE_F_ENGINE_UP_REF 190 +# define ENGINE_F_INT_CLEANUP_ITEM 199 +# define ENGINE_F_INT_CTRL_HELPER 172 +# define ENGINE_F_INT_ENGINE_CONFIGURE 188 +# define ENGINE_F_INT_ENGINE_MODULE_INIT 187 +# define ENGINE_F_OSSL_HMAC_INIT 200 + +/* + * ENGINE reason codes. + */ +# define ENGINE_R_ALREADY_LOADED 100 +# define ENGINE_R_ARGUMENT_IS_NOT_A_NUMBER 133 +# define ENGINE_R_CMD_NOT_EXECUTABLE 134 +# define ENGINE_R_COMMAND_TAKES_INPUT 135 +# define ENGINE_R_COMMAND_TAKES_NO_INPUT 136 +# define ENGINE_R_CONFLICTING_ENGINE_ID 103 +# define ENGINE_R_CTRL_COMMAND_NOT_IMPLEMENTED 119 +# define ENGINE_R_DSO_FAILURE 104 +# define ENGINE_R_DSO_NOT_FOUND 132 +# define ENGINE_R_ENGINES_SECTION_ERROR 148 +# define ENGINE_R_ENGINE_CONFIGURATION_ERROR 102 +# define ENGINE_R_ENGINE_IS_NOT_IN_LIST 105 +# define ENGINE_R_ENGINE_SECTION_ERROR 149 +# define ENGINE_R_FAILED_LOADING_PRIVATE_KEY 128 +# define ENGINE_R_FAILED_LOADING_PUBLIC_KEY 129 +# define ENGINE_R_FINISH_FAILED 106 +# define ENGINE_R_ID_OR_NAME_MISSING 108 +# define ENGINE_R_INIT_FAILED 109 +# define ENGINE_R_INTERNAL_LIST_ERROR 110 +# define ENGINE_R_INVALID_ARGUMENT 143 +# define ENGINE_R_INVALID_CMD_NAME 137 +# define ENGINE_R_INVALID_CMD_NUMBER 138 +# define ENGINE_R_INVALID_INIT_VALUE 151 +# define ENGINE_R_INVALID_STRING 150 +# define ENGINE_R_NOT_INITIALISED 117 +# define ENGINE_R_NOT_LOADED 112 +# define ENGINE_R_NO_CONTROL_FUNCTION 120 +# define ENGINE_R_NO_INDEX 144 +# define ENGINE_R_NO_LOAD_FUNCTION 125 +# define ENGINE_R_NO_REFERENCE 130 +# define ENGINE_R_NO_SUCH_ENGINE 116 +# define ENGINE_R_UNIMPLEMENTED_CIPHER 146 +# define ENGINE_R_UNIMPLEMENTED_DIGEST 147 +# define ENGINE_R_UNIMPLEMENTED_PUBLIC_KEY_METHOD 101 +# define ENGINE_R_VERSION_INCOMPATIBILITY 145 + +# endif +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/err.h b/MediaClient/MediaClient/openssl/include/openssl/err.h new file mode 100644 index 0000000..b49f881 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/err.h @@ -0,0 +1,274 @@ +/* + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_ERR_H +# define HEADER_ERR_H + +# include + +# ifndef OPENSSL_NO_STDIO +# include +# include +# endif + +# include +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + +# ifndef OPENSSL_NO_ERR +# define ERR_PUT_error(a,b,c,d,e) ERR_put_error(a,b,c,d,e) +# else +# define ERR_PUT_error(a,b,c,d,e) ERR_put_error(a,b,c,NULL,0) +# endif + +# include + +# define ERR_TXT_MALLOCED 0x01 +# define ERR_TXT_STRING 0x02 + +# define ERR_FLAG_MARK 0x01 +# define ERR_FLAG_CLEAR 0x02 + +# define ERR_NUM_ERRORS 16 +typedef struct err_state_st { + int err_flags[ERR_NUM_ERRORS]; + unsigned long err_buffer[ERR_NUM_ERRORS]; + char *err_data[ERR_NUM_ERRORS]; + int err_data_flags[ERR_NUM_ERRORS]; + const char *err_file[ERR_NUM_ERRORS]; + int err_line[ERR_NUM_ERRORS]; + int top, bottom; +} ERR_STATE; + +/* library */ +# define ERR_LIB_NONE 1 +# define ERR_LIB_SYS 2 +# define ERR_LIB_BN 3 +# define ERR_LIB_RSA 4 +# define ERR_LIB_DH 5 +# define ERR_LIB_EVP 6 +# define ERR_LIB_BUF 7 +# define ERR_LIB_OBJ 8 +# define ERR_LIB_PEM 9 +# define ERR_LIB_DSA 10 +# define ERR_LIB_X509 11 +/* #define ERR_LIB_METH 12 */ +# define ERR_LIB_ASN1 13 +# define ERR_LIB_CONF 14 +# define ERR_LIB_CRYPTO 15 +# define ERR_LIB_EC 16 +# define ERR_LIB_SSL 20 +/* #define ERR_LIB_SSL23 21 */ +/* #define ERR_LIB_SSL2 22 */ +/* #define ERR_LIB_SSL3 23 */ +/* #define ERR_LIB_RSAREF 30 */ +/* #define ERR_LIB_PROXY 31 */ +# define ERR_LIB_BIO 32 +# define ERR_LIB_PKCS7 33 +# define ERR_LIB_X509V3 34 +# define ERR_LIB_PKCS12 35 +# define ERR_LIB_RAND 36 +# define ERR_LIB_DSO 37 +# define ERR_LIB_ENGINE 38 +# define ERR_LIB_OCSP 39 +# define ERR_LIB_UI 40 +# define ERR_LIB_COMP 41 +# define ERR_LIB_ECDSA 42 +# define ERR_LIB_ECDH 43 +# define ERR_LIB_OSSL_STORE 44 +# define ERR_LIB_FIPS 45 +# define ERR_LIB_CMS 46 +# define ERR_LIB_TS 47 +# define ERR_LIB_HMAC 48 +/* # define ERR_LIB_JPAKE 49 */ +# define ERR_LIB_CT 50 +# define ERR_LIB_ASYNC 51 +# define ERR_LIB_KDF 52 +# define ERR_LIB_SM2 53 + +# define ERR_LIB_USER 128 + +# define SYSerr(f,r) ERR_PUT_error(ERR_LIB_SYS,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define BNerr(f,r) ERR_PUT_error(ERR_LIB_BN,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define RSAerr(f,r) ERR_PUT_error(ERR_LIB_RSA,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define DHerr(f,r) ERR_PUT_error(ERR_LIB_DH,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define EVPerr(f,r) ERR_PUT_error(ERR_LIB_EVP,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define BUFerr(f,r) ERR_PUT_error(ERR_LIB_BUF,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define OBJerr(f,r) ERR_PUT_error(ERR_LIB_OBJ,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define PEMerr(f,r) ERR_PUT_error(ERR_LIB_PEM,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define DSAerr(f,r) ERR_PUT_error(ERR_LIB_DSA,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define X509err(f,r) ERR_PUT_error(ERR_LIB_X509,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define CONFerr(f,r) ERR_PUT_error(ERR_LIB_CONF,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define CRYPTOerr(f,r) ERR_PUT_error(ERR_LIB_CRYPTO,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define ECerr(f,r) ERR_PUT_error(ERR_LIB_EC,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define SSLerr(f,r) ERR_PUT_error(ERR_LIB_SSL,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define BIOerr(f,r) ERR_PUT_error(ERR_LIB_BIO,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define PKCS7err(f,r) ERR_PUT_error(ERR_LIB_PKCS7,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define X509V3err(f,r) ERR_PUT_error(ERR_LIB_X509V3,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define PKCS12err(f,r) ERR_PUT_error(ERR_LIB_PKCS12,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define RANDerr(f,r) ERR_PUT_error(ERR_LIB_RAND,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define DSOerr(f,r) ERR_PUT_error(ERR_LIB_DSO,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define ENGINEerr(f,r) ERR_PUT_error(ERR_LIB_ENGINE,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define OCSPerr(f,r) ERR_PUT_error(ERR_LIB_OCSP,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define UIerr(f,r) ERR_PUT_error(ERR_LIB_UI,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define COMPerr(f,r) ERR_PUT_error(ERR_LIB_COMP,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define ECDSAerr(f,r) ERR_PUT_error(ERR_LIB_ECDSA,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define ECDHerr(f,r) ERR_PUT_error(ERR_LIB_ECDH,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define OSSL_STOREerr(f,r) ERR_PUT_error(ERR_LIB_OSSL_STORE,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define FIPSerr(f,r) ERR_PUT_error(ERR_LIB_FIPS,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define CMSerr(f,r) ERR_PUT_error(ERR_LIB_CMS,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define TSerr(f,r) ERR_PUT_error(ERR_LIB_TS,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define HMACerr(f,r) ERR_PUT_error(ERR_LIB_HMAC,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define CTerr(f,r) ERR_PUT_error(ERR_LIB_CT,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define ASYNCerr(f,r) ERR_PUT_error(ERR_LIB_ASYNC,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define KDFerr(f,r) ERR_PUT_error(ERR_LIB_KDF,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define SM2err(f,r) ERR_PUT_error(ERR_LIB_SM2,(f),(r),OPENSSL_FILE,OPENSSL_LINE) + +# define ERR_PACK(l,f,r) ( \ + (((unsigned int)(l) & 0x0FF) << 24L) | \ + (((unsigned int)(f) & 0xFFF) << 12L) | \ + (((unsigned int)(r) & 0xFFF) ) ) +# define ERR_GET_LIB(l) (int)(((l) >> 24L) & 0x0FFL) +# define ERR_GET_FUNC(l) (int)(((l) >> 12L) & 0xFFFL) +# define ERR_GET_REASON(l) (int)( (l) & 0xFFFL) +# define ERR_FATAL_ERROR(l) (int)( (l) & ERR_R_FATAL) + +/* OS functions */ +# define SYS_F_FOPEN 1 +# define SYS_F_CONNECT 2 +# define SYS_F_GETSERVBYNAME 3 +# define SYS_F_SOCKET 4 +# define SYS_F_IOCTLSOCKET 5 +# define SYS_F_BIND 6 +# define SYS_F_LISTEN 7 +# define SYS_F_ACCEPT 8 +# define SYS_F_WSASTARTUP 9/* Winsock stuff */ +# define SYS_F_OPENDIR 10 +# define SYS_F_FREAD 11 +# define SYS_F_GETADDRINFO 12 +# define SYS_F_GETNAMEINFO 13 +# define SYS_F_SETSOCKOPT 14 +# define SYS_F_GETSOCKOPT 15 +# define SYS_F_GETSOCKNAME 16 +# define SYS_F_GETHOSTBYNAME 17 +# define SYS_F_FFLUSH 18 +# define SYS_F_OPEN 19 +# define SYS_F_CLOSE 20 +# define SYS_F_IOCTL 21 +# define SYS_F_STAT 22 +# define SYS_F_FCNTL 23 +# define SYS_F_FSTAT 24 + +/* reasons */ +# define ERR_R_SYS_LIB ERR_LIB_SYS/* 2 */ +# define ERR_R_BN_LIB ERR_LIB_BN/* 3 */ +# define ERR_R_RSA_LIB ERR_LIB_RSA/* 4 */ +# define ERR_R_DH_LIB ERR_LIB_DH/* 5 */ +# define ERR_R_EVP_LIB ERR_LIB_EVP/* 6 */ +# define ERR_R_BUF_LIB ERR_LIB_BUF/* 7 */ +# define ERR_R_OBJ_LIB ERR_LIB_OBJ/* 8 */ +# define ERR_R_PEM_LIB ERR_LIB_PEM/* 9 */ +# define ERR_R_DSA_LIB ERR_LIB_DSA/* 10 */ +# define ERR_R_X509_LIB ERR_LIB_X509/* 11 */ +# define ERR_R_ASN1_LIB ERR_LIB_ASN1/* 13 */ +# define ERR_R_EC_LIB ERR_LIB_EC/* 16 */ +# define ERR_R_BIO_LIB ERR_LIB_BIO/* 32 */ +# define ERR_R_PKCS7_LIB ERR_LIB_PKCS7/* 33 */ +# define ERR_R_X509V3_LIB ERR_LIB_X509V3/* 34 */ +# define ERR_R_ENGINE_LIB ERR_LIB_ENGINE/* 38 */ +# define ERR_R_UI_LIB ERR_LIB_UI/* 40 */ +# define ERR_R_ECDSA_LIB ERR_LIB_ECDSA/* 42 */ +# define ERR_R_OSSL_STORE_LIB ERR_LIB_OSSL_STORE/* 44 */ + +# define ERR_R_NESTED_ASN1_ERROR 58 +# define ERR_R_MISSING_ASN1_EOS 63 + +/* fatal error */ +# define ERR_R_FATAL 64 +# define ERR_R_MALLOC_FAILURE (1|ERR_R_FATAL) +# define ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED (2|ERR_R_FATAL) +# define ERR_R_PASSED_NULL_PARAMETER (3|ERR_R_FATAL) +# define ERR_R_INTERNAL_ERROR (4|ERR_R_FATAL) +# define ERR_R_DISABLED (5|ERR_R_FATAL) +# define ERR_R_INIT_FAIL (6|ERR_R_FATAL) +# define ERR_R_PASSED_INVALID_ARGUMENT (7) +# define ERR_R_OPERATION_FAIL (8|ERR_R_FATAL) + +/* + * 99 is the maximum possible ERR_R_... code, higher values are reserved for + * the individual libraries + */ + +typedef struct ERR_string_data_st { + unsigned long error; + const char *string; +} ERR_STRING_DATA; + +DEFINE_LHASH_OF(ERR_STRING_DATA); + +void ERR_put_error(int lib, int func, int reason, const char *file, int line); +void ERR_set_error_data(char *data, int flags); + +unsigned long ERR_get_error(void); +unsigned long ERR_get_error_line(const char **file, int *line); +unsigned long ERR_get_error_line_data(const char **file, int *line, + const char **data, int *flags); +unsigned long ERR_peek_error(void); +unsigned long ERR_peek_error_line(const char **file, int *line); +unsigned long ERR_peek_error_line_data(const char **file, int *line, + const char **data, int *flags); +unsigned long ERR_peek_last_error(void); +unsigned long ERR_peek_last_error_line(const char **file, int *line); +unsigned long ERR_peek_last_error_line_data(const char **file, int *line, + const char **data, int *flags); +void ERR_clear_error(void); +char *ERR_error_string(unsigned long e, char *buf); +void ERR_error_string_n(unsigned long e, char *buf, size_t len); +const char *ERR_lib_error_string(unsigned long e); +const char *ERR_func_error_string(unsigned long e); +const char *ERR_reason_error_string(unsigned long e); +void ERR_print_errors_cb(int (*cb) (const char *str, size_t len, void *u), + void *u); +# ifndef OPENSSL_NO_STDIO +void ERR_print_errors_fp(FILE *fp); +# endif +void ERR_print_errors(BIO *bp); +void ERR_add_error_data(int num, ...); +void ERR_add_error_vdata(int num, va_list args); +int ERR_load_strings(int lib, ERR_STRING_DATA *str); +int ERR_load_strings_const(const ERR_STRING_DATA *str); +int ERR_unload_strings(int lib, ERR_STRING_DATA *str); +int ERR_load_ERR_strings(void); + +#if OPENSSL_API_COMPAT < 0x10100000L +# define ERR_load_crypto_strings() \ + OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL) +# define ERR_free_strings() while(0) continue +#endif + +DEPRECATEDIN_1_1_0(void ERR_remove_thread_state(void *)) +DEPRECATEDIN_1_0_0(void ERR_remove_state(unsigned long pid)) +ERR_STATE *ERR_get_state(void); + +int ERR_get_next_error_library(void); + +int ERR_set_mark(void); +int ERR_pop_to_mark(void); +int ERR_clear_last_mark(void); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/evp.h b/MediaClient/MediaClient/openssl/include/openssl/evp.h new file mode 100644 index 0000000..a411f3f --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/evp.h @@ -0,0 +1,1666 @@ +/* + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_ENVELOPE_H +# define HEADER_ENVELOPE_H + +# include +# include +# include +# include +# include + +# define EVP_MAX_MD_SIZE 64/* longest known is SHA512 */ +# define EVP_MAX_KEY_LENGTH 64 +# define EVP_MAX_IV_LENGTH 16 +# define EVP_MAX_BLOCK_LENGTH 32 + +# define PKCS5_SALT_LEN 8 +/* Default PKCS#5 iteration count */ +# define PKCS5_DEFAULT_ITER 2048 + +# include + +# define EVP_PK_RSA 0x0001 +# define EVP_PK_DSA 0x0002 +# define EVP_PK_DH 0x0004 +# define EVP_PK_EC 0x0008 +# define EVP_PKT_SIGN 0x0010 +# define EVP_PKT_ENC 0x0020 +# define EVP_PKT_EXCH 0x0040 +# define EVP_PKS_RSA 0x0100 +# define EVP_PKS_DSA 0x0200 +# define EVP_PKS_EC 0x0400 + +# define EVP_PKEY_NONE NID_undef +# define EVP_PKEY_RSA NID_rsaEncryption +# define EVP_PKEY_RSA2 NID_rsa +# define EVP_PKEY_RSA_PSS NID_rsassaPss +# define EVP_PKEY_DSA NID_dsa +# define EVP_PKEY_DSA1 NID_dsa_2 +# define EVP_PKEY_DSA2 NID_dsaWithSHA +# define EVP_PKEY_DSA3 NID_dsaWithSHA1 +# define EVP_PKEY_DSA4 NID_dsaWithSHA1_2 +# define EVP_PKEY_DH NID_dhKeyAgreement +# define EVP_PKEY_DHX NID_dhpublicnumber +# define EVP_PKEY_EC NID_X9_62_id_ecPublicKey +# define EVP_PKEY_SM2 NID_sm2 +# define EVP_PKEY_HMAC NID_hmac +# define EVP_PKEY_CMAC NID_cmac +# define EVP_PKEY_SCRYPT NID_id_scrypt +# define EVP_PKEY_TLS1_PRF NID_tls1_prf +# define EVP_PKEY_HKDF NID_hkdf +# define EVP_PKEY_POLY1305 NID_poly1305 +# define EVP_PKEY_SIPHASH NID_siphash +# define EVP_PKEY_X25519 NID_X25519 +# define EVP_PKEY_ED25519 NID_ED25519 +# define EVP_PKEY_X448 NID_X448 +# define EVP_PKEY_ED448 NID_ED448 + +#ifdef __cplusplus +extern "C" { +#endif + +# define EVP_PKEY_MO_SIGN 0x0001 +# define EVP_PKEY_MO_VERIFY 0x0002 +# define EVP_PKEY_MO_ENCRYPT 0x0004 +# define EVP_PKEY_MO_DECRYPT 0x0008 + +# ifndef EVP_MD +EVP_MD *EVP_MD_meth_new(int md_type, int pkey_type); +EVP_MD *EVP_MD_meth_dup(const EVP_MD *md); +void EVP_MD_meth_free(EVP_MD *md); + +int EVP_MD_meth_set_input_blocksize(EVP_MD *md, int blocksize); +int EVP_MD_meth_set_result_size(EVP_MD *md, int resultsize); +int EVP_MD_meth_set_app_datasize(EVP_MD *md, int datasize); +int EVP_MD_meth_set_flags(EVP_MD *md, unsigned long flags); +int EVP_MD_meth_set_init(EVP_MD *md, int (*init)(EVP_MD_CTX *ctx)); +int EVP_MD_meth_set_update(EVP_MD *md, int (*update)(EVP_MD_CTX *ctx, + const void *data, + size_t count)); +int EVP_MD_meth_set_final(EVP_MD *md, int (*final)(EVP_MD_CTX *ctx, + unsigned char *md)); +int EVP_MD_meth_set_copy(EVP_MD *md, int (*copy)(EVP_MD_CTX *to, + const EVP_MD_CTX *from)); +int EVP_MD_meth_set_cleanup(EVP_MD *md, int (*cleanup)(EVP_MD_CTX *ctx)); +int EVP_MD_meth_set_ctrl(EVP_MD *md, int (*ctrl)(EVP_MD_CTX *ctx, int cmd, + int p1, void *p2)); + +int EVP_MD_meth_get_input_blocksize(const EVP_MD *md); +int EVP_MD_meth_get_result_size(const EVP_MD *md); +int EVP_MD_meth_get_app_datasize(const EVP_MD *md); +unsigned long EVP_MD_meth_get_flags(const EVP_MD *md); +int (*EVP_MD_meth_get_init(const EVP_MD *md))(EVP_MD_CTX *ctx); +int (*EVP_MD_meth_get_update(const EVP_MD *md))(EVP_MD_CTX *ctx, + const void *data, + size_t count); +int (*EVP_MD_meth_get_final(const EVP_MD *md))(EVP_MD_CTX *ctx, + unsigned char *md); +int (*EVP_MD_meth_get_copy(const EVP_MD *md))(EVP_MD_CTX *to, + const EVP_MD_CTX *from); +int (*EVP_MD_meth_get_cleanup(const EVP_MD *md))(EVP_MD_CTX *ctx); +int (*EVP_MD_meth_get_ctrl(const EVP_MD *md))(EVP_MD_CTX *ctx, int cmd, + int p1, void *p2); + +/* digest can only handle a single block */ +# define EVP_MD_FLAG_ONESHOT 0x0001 + +/* digest is extensible-output function, XOF */ +# define EVP_MD_FLAG_XOF 0x0002 + +/* DigestAlgorithmIdentifier flags... */ + +# define EVP_MD_FLAG_DIGALGID_MASK 0x0018 + +/* NULL or absent parameter accepted. Use NULL */ + +# define EVP_MD_FLAG_DIGALGID_NULL 0x0000 + +/* NULL or absent parameter accepted. Use NULL for PKCS#1 otherwise absent */ + +# define EVP_MD_FLAG_DIGALGID_ABSENT 0x0008 + +/* Custom handling via ctrl */ + +# define EVP_MD_FLAG_DIGALGID_CUSTOM 0x0018 + +/* Note if suitable for use in FIPS mode */ +# define EVP_MD_FLAG_FIPS 0x0400 + +/* Digest ctrls */ + +# define EVP_MD_CTRL_DIGALGID 0x1 +# define EVP_MD_CTRL_MICALG 0x2 +# define EVP_MD_CTRL_XOF_LEN 0x3 + +/* Minimum Algorithm specific ctrl value */ + +# define EVP_MD_CTRL_ALG_CTRL 0x1000 + +# endif /* !EVP_MD */ + +/* values for EVP_MD_CTX flags */ + +# define EVP_MD_CTX_FLAG_ONESHOT 0x0001/* digest update will be + * called once only */ +# define EVP_MD_CTX_FLAG_CLEANED 0x0002/* context has already been + * cleaned */ +# define EVP_MD_CTX_FLAG_REUSE 0x0004/* Don't free up ctx->md_data + * in EVP_MD_CTX_reset */ +/* + * FIPS and pad options are ignored in 1.0.0, definitions are here so we + * don't accidentally reuse the values for other purposes. + */ + +# define EVP_MD_CTX_FLAG_NON_FIPS_ALLOW 0x0008/* Allow use of non FIPS + * digest in FIPS mode */ + +/* + * The following PAD options are also currently ignored in 1.0.0, digest + * parameters are handled through EVP_DigestSign*() and EVP_DigestVerify*() + * instead. + */ +# define EVP_MD_CTX_FLAG_PAD_MASK 0xF0/* RSA mode to use */ +# define EVP_MD_CTX_FLAG_PAD_PKCS1 0x00/* PKCS#1 v1.5 mode */ +# define EVP_MD_CTX_FLAG_PAD_X931 0x10/* X9.31 mode */ +# define EVP_MD_CTX_FLAG_PAD_PSS 0x20/* PSS mode */ + +# define EVP_MD_CTX_FLAG_NO_INIT 0x0100/* Don't initialize md_data */ +/* + * Some functions such as EVP_DigestSign only finalise copies of internal + * contexts so additional data can be included after the finalisation call. + * This is inefficient if this functionality is not required: it is disabled + * if the following flag is set. + */ +# define EVP_MD_CTX_FLAG_FINALISE 0x0200 +/* NOTE: 0x0400 is reserved for internal usage */ + +EVP_CIPHER *EVP_CIPHER_meth_new(int cipher_type, int block_size, int key_len); +EVP_CIPHER *EVP_CIPHER_meth_dup(const EVP_CIPHER *cipher); +void EVP_CIPHER_meth_free(EVP_CIPHER *cipher); + +int EVP_CIPHER_meth_set_iv_length(EVP_CIPHER *cipher, int iv_len); +int EVP_CIPHER_meth_set_flags(EVP_CIPHER *cipher, unsigned long flags); +int EVP_CIPHER_meth_set_impl_ctx_size(EVP_CIPHER *cipher, int ctx_size); +int EVP_CIPHER_meth_set_init(EVP_CIPHER *cipher, + int (*init) (EVP_CIPHER_CTX *ctx, + const unsigned char *key, + const unsigned char *iv, + int enc)); +int EVP_CIPHER_meth_set_do_cipher(EVP_CIPHER *cipher, + int (*do_cipher) (EVP_CIPHER_CTX *ctx, + unsigned char *out, + const unsigned char *in, + size_t inl)); +int EVP_CIPHER_meth_set_cleanup(EVP_CIPHER *cipher, + int (*cleanup) (EVP_CIPHER_CTX *)); +int EVP_CIPHER_meth_set_set_asn1_params(EVP_CIPHER *cipher, + int (*set_asn1_parameters) (EVP_CIPHER_CTX *, + ASN1_TYPE *)); +int EVP_CIPHER_meth_set_get_asn1_params(EVP_CIPHER *cipher, + int (*get_asn1_parameters) (EVP_CIPHER_CTX *, + ASN1_TYPE *)); +int EVP_CIPHER_meth_set_ctrl(EVP_CIPHER *cipher, + int (*ctrl) (EVP_CIPHER_CTX *, int type, + int arg, void *ptr)); + +int (*EVP_CIPHER_meth_get_init(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *ctx, + const unsigned char *key, + const unsigned char *iv, + int enc); +int (*EVP_CIPHER_meth_get_do_cipher(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *ctx, + unsigned char *out, + const unsigned char *in, + size_t inl); +int (*EVP_CIPHER_meth_get_cleanup(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *); +int (*EVP_CIPHER_meth_get_set_asn1_params(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *, + ASN1_TYPE *); +int (*EVP_CIPHER_meth_get_get_asn1_params(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *, + ASN1_TYPE *); +int (*EVP_CIPHER_meth_get_ctrl(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *, + int type, int arg, + void *ptr); + +/* Values for cipher flags */ + +/* Modes for ciphers */ + +# define EVP_CIPH_STREAM_CIPHER 0x0 +# define EVP_CIPH_ECB_MODE 0x1 +# define EVP_CIPH_CBC_MODE 0x2 +# define EVP_CIPH_CFB_MODE 0x3 +# define EVP_CIPH_OFB_MODE 0x4 +# define EVP_CIPH_CTR_MODE 0x5 +# define EVP_CIPH_GCM_MODE 0x6 +# define EVP_CIPH_CCM_MODE 0x7 +# define EVP_CIPH_XTS_MODE 0x10001 +# define EVP_CIPH_WRAP_MODE 0x10002 +# define EVP_CIPH_OCB_MODE 0x10003 +# define EVP_CIPH_MODE 0xF0007 +/* Set if variable length cipher */ +# define EVP_CIPH_VARIABLE_LENGTH 0x8 +/* Set if the iv handling should be done by the cipher itself */ +# define EVP_CIPH_CUSTOM_IV 0x10 +/* Set if the cipher's init() function should be called if key is NULL */ +# define EVP_CIPH_ALWAYS_CALL_INIT 0x20 +/* Call ctrl() to init cipher parameters */ +# define EVP_CIPH_CTRL_INIT 0x40 +/* Don't use standard key length function */ +# define EVP_CIPH_CUSTOM_KEY_LENGTH 0x80 +/* Don't use standard block padding */ +# define EVP_CIPH_NO_PADDING 0x100 +/* cipher handles random key generation */ +# define EVP_CIPH_RAND_KEY 0x200 +/* cipher has its own additional copying logic */ +# define EVP_CIPH_CUSTOM_COPY 0x400 +/* Don't use standard iv length function */ +# define EVP_CIPH_CUSTOM_IV_LENGTH 0x800 +/* Allow use default ASN1 get/set iv */ +# define EVP_CIPH_FLAG_DEFAULT_ASN1 0x1000 +/* Buffer length in bits not bytes: CFB1 mode only */ +# define EVP_CIPH_FLAG_LENGTH_BITS 0x2000 +/* Note if suitable for use in FIPS mode */ +# define EVP_CIPH_FLAG_FIPS 0x4000 +/* Allow non FIPS cipher in FIPS mode */ +# define EVP_CIPH_FLAG_NON_FIPS_ALLOW 0x8000 +/* + * Cipher handles any and all padding logic as well as finalisation. + */ +# define EVP_CIPH_FLAG_CUSTOM_CIPHER 0x100000 +# define EVP_CIPH_FLAG_AEAD_CIPHER 0x200000 +# define EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK 0x400000 +/* Cipher can handle pipeline operations */ +# define EVP_CIPH_FLAG_PIPELINE 0X800000 + +/* + * Cipher context flag to indicate we can handle wrap mode: if allowed in + * older applications it could overflow buffers. + */ + +# define EVP_CIPHER_CTX_FLAG_WRAP_ALLOW 0x1 + +/* ctrl() values */ + +# define EVP_CTRL_INIT 0x0 +# define EVP_CTRL_SET_KEY_LENGTH 0x1 +# define EVP_CTRL_GET_RC2_KEY_BITS 0x2 +# define EVP_CTRL_SET_RC2_KEY_BITS 0x3 +# define EVP_CTRL_GET_RC5_ROUNDS 0x4 +# define EVP_CTRL_SET_RC5_ROUNDS 0x5 +# define EVP_CTRL_RAND_KEY 0x6 +# define EVP_CTRL_PBE_PRF_NID 0x7 +# define EVP_CTRL_COPY 0x8 +# define EVP_CTRL_AEAD_SET_IVLEN 0x9 +# define EVP_CTRL_AEAD_GET_TAG 0x10 +# define EVP_CTRL_AEAD_SET_TAG 0x11 +# define EVP_CTRL_AEAD_SET_IV_FIXED 0x12 +# define EVP_CTRL_GCM_SET_IVLEN EVP_CTRL_AEAD_SET_IVLEN +# define EVP_CTRL_GCM_GET_TAG EVP_CTRL_AEAD_GET_TAG +# define EVP_CTRL_GCM_SET_TAG EVP_CTRL_AEAD_SET_TAG +# define EVP_CTRL_GCM_SET_IV_FIXED EVP_CTRL_AEAD_SET_IV_FIXED +# define EVP_CTRL_GCM_IV_GEN 0x13 +# define EVP_CTRL_CCM_SET_IVLEN EVP_CTRL_AEAD_SET_IVLEN +# define EVP_CTRL_CCM_GET_TAG EVP_CTRL_AEAD_GET_TAG +# define EVP_CTRL_CCM_SET_TAG EVP_CTRL_AEAD_SET_TAG +# define EVP_CTRL_CCM_SET_IV_FIXED EVP_CTRL_AEAD_SET_IV_FIXED +# define EVP_CTRL_CCM_SET_L 0x14 +# define EVP_CTRL_CCM_SET_MSGLEN 0x15 +/* + * AEAD cipher deduces payload length and returns number of bytes required to + * store MAC and eventual padding. Subsequent call to EVP_Cipher even + * appends/verifies MAC. + */ +# define EVP_CTRL_AEAD_TLS1_AAD 0x16 +/* Used by composite AEAD ciphers, no-op in GCM, CCM... */ +# define EVP_CTRL_AEAD_SET_MAC_KEY 0x17 +/* Set the GCM invocation field, decrypt only */ +# define EVP_CTRL_GCM_SET_IV_INV 0x18 + +# define EVP_CTRL_TLS1_1_MULTIBLOCK_AAD 0x19 +# define EVP_CTRL_TLS1_1_MULTIBLOCK_ENCRYPT 0x1a +# define EVP_CTRL_TLS1_1_MULTIBLOCK_DECRYPT 0x1b +# define EVP_CTRL_TLS1_1_MULTIBLOCK_MAX_BUFSIZE 0x1c + +# define EVP_CTRL_SSL3_MASTER_SECRET 0x1d + +/* EVP_CTRL_SET_SBOX takes the char * specifying S-boxes */ +# define EVP_CTRL_SET_SBOX 0x1e +/* + * EVP_CTRL_SBOX_USED takes a 'size_t' and 'char *', pointing at a + * pre-allocated buffer with specified size + */ +# define EVP_CTRL_SBOX_USED 0x1f +/* EVP_CTRL_KEY_MESH takes 'size_t' number of bytes to mesh the key after, + * 0 switches meshing off + */ +# define EVP_CTRL_KEY_MESH 0x20 +/* EVP_CTRL_BLOCK_PADDING_MODE takes the padding mode */ +# define EVP_CTRL_BLOCK_PADDING_MODE 0x21 + +/* Set the output buffers to use for a pipelined operation */ +# define EVP_CTRL_SET_PIPELINE_OUTPUT_BUFS 0x22 +/* Set the input buffers to use for a pipelined operation */ +# define EVP_CTRL_SET_PIPELINE_INPUT_BUFS 0x23 +/* Set the input buffer lengths to use for a pipelined operation */ +# define EVP_CTRL_SET_PIPELINE_INPUT_LENS 0x24 + +# define EVP_CTRL_GET_IVLEN 0x25 + +/* Padding modes */ +#define EVP_PADDING_PKCS7 1 +#define EVP_PADDING_ISO7816_4 2 +#define EVP_PADDING_ANSI923 3 +#define EVP_PADDING_ISO10126 4 +#define EVP_PADDING_ZERO 5 + +/* RFC 5246 defines additional data to be 13 bytes in length */ +# define EVP_AEAD_TLS1_AAD_LEN 13 + +typedef struct { + unsigned char *out; + const unsigned char *inp; + size_t len; + unsigned int interleave; +} EVP_CTRL_TLS1_1_MULTIBLOCK_PARAM; + +/* GCM TLS constants */ +/* Length of fixed part of IV derived from PRF */ +# define EVP_GCM_TLS_FIXED_IV_LEN 4 +/* Length of explicit part of IV part of TLS records */ +# define EVP_GCM_TLS_EXPLICIT_IV_LEN 8 +/* Length of tag for TLS */ +# define EVP_GCM_TLS_TAG_LEN 16 + +/* CCM TLS constants */ +/* Length of fixed part of IV derived from PRF */ +# define EVP_CCM_TLS_FIXED_IV_LEN 4 +/* Length of explicit part of IV part of TLS records */ +# define EVP_CCM_TLS_EXPLICIT_IV_LEN 8 +/* Total length of CCM IV length for TLS */ +# define EVP_CCM_TLS_IV_LEN 12 +/* Length of tag for TLS */ +# define EVP_CCM_TLS_TAG_LEN 16 +/* Length of CCM8 tag for TLS */ +# define EVP_CCM8_TLS_TAG_LEN 8 + +/* Length of tag for TLS */ +# define EVP_CHACHAPOLY_TLS_TAG_LEN 16 + +typedef struct evp_cipher_info_st { + const EVP_CIPHER *cipher; + unsigned char iv[EVP_MAX_IV_LENGTH]; +} EVP_CIPHER_INFO; + + +/* Password based encryption function */ +typedef int (EVP_PBE_KEYGEN) (EVP_CIPHER_CTX *ctx, const char *pass, + int passlen, ASN1_TYPE *param, + const EVP_CIPHER *cipher, const EVP_MD *md, + int en_de); + +# ifndef OPENSSL_NO_RSA +# define EVP_PKEY_assign_RSA(pkey,rsa) EVP_PKEY_assign((pkey),EVP_PKEY_RSA,\ + (char *)(rsa)) +# endif + +# ifndef OPENSSL_NO_DSA +# define EVP_PKEY_assign_DSA(pkey,dsa) EVP_PKEY_assign((pkey),EVP_PKEY_DSA,\ + (char *)(dsa)) +# endif + +# ifndef OPENSSL_NO_DH +# define EVP_PKEY_assign_DH(pkey,dh) EVP_PKEY_assign((pkey),EVP_PKEY_DH,\ + (char *)(dh)) +# endif + +# ifndef OPENSSL_NO_EC +# define EVP_PKEY_assign_EC_KEY(pkey,eckey) EVP_PKEY_assign((pkey),EVP_PKEY_EC,\ + (char *)(eckey)) +# endif +# ifndef OPENSSL_NO_SIPHASH +# define EVP_PKEY_assign_SIPHASH(pkey,shkey) EVP_PKEY_assign((pkey),EVP_PKEY_SIPHASH,\ + (char *)(shkey)) +# endif + +# ifndef OPENSSL_NO_POLY1305 +# define EVP_PKEY_assign_POLY1305(pkey,polykey) EVP_PKEY_assign((pkey),EVP_PKEY_POLY1305,\ + (char *)(polykey)) +# endif + +/* Add some extra combinations */ +# define EVP_get_digestbynid(a) EVP_get_digestbyname(OBJ_nid2sn(a)) +# define EVP_get_digestbyobj(a) EVP_get_digestbynid(OBJ_obj2nid(a)) +# define EVP_get_cipherbynid(a) EVP_get_cipherbyname(OBJ_nid2sn(a)) +# define EVP_get_cipherbyobj(a) EVP_get_cipherbynid(OBJ_obj2nid(a)) + +int EVP_MD_type(const EVP_MD *md); +# define EVP_MD_nid(e) EVP_MD_type(e) +# define EVP_MD_name(e) OBJ_nid2sn(EVP_MD_nid(e)) +int EVP_MD_pkey_type(const EVP_MD *md); +int EVP_MD_size(const EVP_MD *md); +int EVP_MD_block_size(const EVP_MD *md); +unsigned long EVP_MD_flags(const EVP_MD *md); + +const EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx); +int (*EVP_MD_CTX_update_fn(EVP_MD_CTX *ctx))(EVP_MD_CTX *ctx, + const void *data, size_t count); +void EVP_MD_CTX_set_update_fn(EVP_MD_CTX *ctx, + int (*update) (EVP_MD_CTX *ctx, + const void *data, size_t count)); +# define EVP_MD_CTX_size(e) EVP_MD_size(EVP_MD_CTX_md(e)) +# define EVP_MD_CTX_block_size(e) EVP_MD_block_size(EVP_MD_CTX_md(e)) +# define EVP_MD_CTX_type(e) EVP_MD_type(EVP_MD_CTX_md(e)) +EVP_PKEY_CTX *EVP_MD_CTX_pkey_ctx(const EVP_MD_CTX *ctx); +void EVP_MD_CTX_set_pkey_ctx(EVP_MD_CTX *ctx, EVP_PKEY_CTX *pctx); +void *EVP_MD_CTX_md_data(const EVP_MD_CTX *ctx); + +int EVP_CIPHER_nid(const EVP_CIPHER *cipher); +# define EVP_CIPHER_name(e) OBJ_nid2sn(EVP_CIPHER_nid(e)) +int EVP_CIPHER_block_size(const EVP_CIPHER *cipher); +int EVP_CIPHER_impl_ctx_size(const EVP_CIPHER *cipher); +int EVP_CIPHER_key_length(const EVP_CIPHER *cipher); +int EVP_CIPHER_iv_length(const EVP_CIPHER *cipher); +unsigned long EVP_CIPHER_flags(const EVP_CIPHER *cipher); +# define EVP_CIPHER_mode(e) (EVP_CIPHER_flags(e) & EVP_CIPH_MODE) + +const EVP_CIPHER *EVP_CIPHER_CTX_cipher(const EVP_CIPHER_CTX *ctx); +int EVP_CIPHER_CTX_encrypting(const EVP_CIPHER_CTX *ctx); +int EVP_CIPHER_CTX_nid(const EVP_CIPHER_CTX *ctx); +int EVP_CIPHER_CTX_block_size(const EVP_CIPHER_CTX *ctx); +int EVP_CIPHER_CTX_key_length(const EVP_CIPHER_CTX *ctx); +int EVP_CIPHER_CTX_iv_length(const EVP_CIPHER_CTX *ctx); +const unsigned char *EVP_CIPHER_CTX_iv(const EVP_CIPHER_CTX *ctx); +const unsigned char *EVP_CIPHER_CTX_original_iv(const EVP_CIPHER_CTX *ctx); +unsigned char *EVP_CIPHER_CTX_iv_noconst(EVP_CIPHER_CTX *ctx); +unsigned char *EVP_CIPHER_CTX_buf_noconst(EVP_CIPHER_CTX *ctx); +int EVP_CIPHER_CTX_num(const EVP_CIPHER_CTX *ctx); +void EVP_CIPHER_CTX_set_num(EVP_CIPHER_CTX *ctx, int num); +int EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, const EVP_CIPHER_CTX *in); +void *EVP_CIPHER_CTX_get_app_data(const EVP_CIPHER_CTX *ctx); +void EVP_CIPHER_CTX_set_app_data(EVP_CIPHER_CTX *ctx, void *data); +void *EVP_CIPHER_CTX_get_cipher_data(const EVP_CIPHER_CTX *ctx); +void *EVP_CIPHER_CTX_set_cipher_data(EVP_CIPHER_CTX *ctx, void *cipher_data); +# define EVP_CIPHER_CTX_type(c) EVP_CIPHER_type(EVP_CIPHER_CTX_cipher(c)) +# if OPENSSL_API_COMPAT < 0x10100000L +# define EVP_CIPHER_CTX_flags(c) EVP_CIPHER_flags(EVP_CIPHER_CTX_cipher(c)) +# endif +# define EVP_CIPHER_CTX_mode(c) EVP_CIPHER_mode(EVP_CIPHER_CTX_cipher(c)) + +# define EVP_ENCODE_LENGTH(l) ((((l)+2)/3*4)+((l)/48+1)*2+80) +# define EVP_DECODE_LENGTH(l) (((l)+3)/4*3+80) + +# define EVP_SignInit_ex(a,b,c) EVP_DigestInit_ex(a,b,c) +# define EVP_SignInit(a,b) EVP_DigestInit(a,b) +# define EVP_SignUpdate(a,b,c) EVP_DigestUpdate(a,b,c) +# define EVP_VerifyInit_ex(a,b,c) EVP_DigestInit_ex(a,b,c) +# define EVP_VerifyInit(a,b) EVP_DigestInit(a,b) +# define EVP_VerifyUpdate(a,b,c) EVP_DigestUpdate(a,b,c) +# define EVP_OpenUpdate(a,b,c,d,e) EVP_DecryptUpdate(a,b,c,d,e) +# define EVP_SealUpdate(a,b,c,d,e) EVP_EncryptUpdate(a,b,c,d,e) +# define EVP_DigestSignUpdate(a,b,c) EVP_DigestUpdate(a,b,c) +# define EVP_DigestVerifyUpdate(a,b,c) EVP_DigestUpdate(a,b,c) + +# ifdef CONST_STRICT +void BIO_set_md(BIO *, const EVP_MD *md); +# else +# define BIO_set_md(b,md) BIO_ctrl(b,BIO_C_SET_MD,0,(char *)(md)) +# endif +# define BIO_get_md(b,mdp) BIO_ctrl(b,BIO_C_GET_MD,0,(char *)(mdp)) +# define BIO_get_md_ctx(b,mdcp) BIO_ctrl(b,BIO_C_GET_MD_CTX,0, \ + (char *)(mdcp)) +# define BIO_set_md_ctx(b,mdcp) BIO_ctrl(b,BIO_C_SET_MD_CTX,0, \ + (char *)(mdcp)) +# define BIO_get_cipher_status(b) BIO_ctrl(b,BIO_C_GET_CIPHER_STATUS,0,NULL) +# define BIO_get_cipher_ctx(b,c_pp) BIO_ctrl(b,BIO_C_GET_CIPHER_CTX,0, \ + (char *)(c_pp)) + +/*__owur*/ int EVP_Cipher(EVP_CIPHER_CTX *c, + unsigned char *out, + const unsigned char *in, unsigned int inl); + +# define EVP_add_cipher_alias(n,alias) \ + OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n)) +# define EVP_add_digest_alias(n,alias) \ + OBJ_NAME_add((alias),OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS,(n)) +# define EVP_delete_cipher_alias(alias) \ + OBJ_NAME_remove(alias,OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS); +# define EVP_delete_digest_alias(alias) \ + OBJ_NAME_remove(alias,OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS); + +int EVP_MD_CTX_ctrl(EVP_MD_CTX *ctx, int cmd, int p1, void *p2); +EVP_MD_CTX *EVP_MD_CTX_new(void); +int EVP_MD_CTX_reset(EVP_MD_CTX *ctx); +void EVP_MD_CTX_free(EVP_MD_CTX *ctx); +# define EVP_MD_CTX_create() EVP_MD_CTX_new() +# define EVP_MD_CTX_init(ctx) EVP_MD_CTX_reset((ctx)) +# define EVP_MD_CTX_destroy(ctx) EVP_MD_CTX_free((ctx)) +__owur int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out, const EVP_MD_CTX *in); +void EVP_MD_CTX_set_flags(EVP_MD_CTX *ctx, int flags); +void EVP_MD_CTX_clear_flags(EVP_MD_CTX *ctx, int flags); +int EVP_MD_CTX_test_flags(const EVP_MD_CTX *ctx, int flags); +__owur int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, + ENGINE *impl); +__owur int EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *d, + size_t cnt); +__owur int EVP_DigestFinal_ex(EVP_MD_CTX *ctx, unsigned char *md, + unsigned int *s); +__owur int EVP_Digest(const void *data, size_t count, + unsigned char *md, unsigned int *size, + const EVP_MD *type, ENGINE *impl); + +__owur int EVP_MD_CTX_copy(EVP_MD_CTX *out, const EVP_MD_CTX *in); +__owur int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type); +__owur int EVP_DigestFinal(EVP_MD_CTX *ctx, unsigned char *md, + unsigned int *s); +__owur int EVP_DigestFinalXOF(EVP_MD_CTX *ctx, unsigned char *md, + size_t len); + +int EVP_read_pw_string(char *buf, int length, const char *prompt, int verify); +int EVP_read_pw_string_min(char *buf, int minlen, int maxlen, + const char *prompt, int verify); +void EVP_set_pw_prompt(const char *prompt); +char *EVP_get_pw_prompt(void); + +__owur int EVP_BytesToKey(const EVP_CIPHER *type, const EVP_MD *md, + const unsigned char *salt, + const unsigned char *data, int datal, int count, + unsigned char *key, unsigned char *iv); + +void EVP_CIPHER_CTX_set_flags(EVP_CIPHER_CTX *ctx, int flags); +void EVP_CIPHER_CTX_clear_flags(EVP_CIPHER_CTX *ctx, int flags); +int EVP_CIPHER_CTX_test_flags(const EVP_CIPHER_CTX *ctx, int flags); + +__owur int EVP_EncryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, + const unsigned char *key, const unsigned char *iv); +/*__owur*/ int EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx, + const EVP_CIPHER *cipher, ENGINE *impl, + const unsigned char *key, + const unsigned char *iv); +/*__owur*/ int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, + int *outl, const unsigned char *in, int inl); +/*__owur*/ int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, + int *outl); +/*__owur*/ int EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, + int *outl); + +__owur int EVP_DecryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, + const unsigned char *key, const unsigned char *iv); +/*__owur*/ int EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx, + const EVP_CIPHER *cipher, ENGINE *impl, + const unsigned char *key, + const unsigned char *iv); +/*__owur*/ int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, + int *outl, const unsigned char *in, int inl); +__owur int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, + int *outl); +/*__owur*/ int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, + int *outl); + +__owur int EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, + const unsigned char *key, const unsigned char *iv, + int enc); +/*__owur*/ int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, + const EVP_CIPHER *cipher, ENGINE *impl, + const unsigned char *key, + const unsigned char *iv, int enc); +__owur int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, + int *outl, const unsigned char *in, int inl); +__owur int EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, + int *outl); +__owur int EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, + int *outl); + +__owur int EVP_SignFinal(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *s, + EVP_PKEY *pkey); + +__owur int EVP_DigestSign(EVP_MD_CTX *ctx, unsigned char *sigret, + size_t *siglen, const unsigned char *tbs, + size_t tbslen); + +__owur int EVP_VerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sigbuf, + unsigned int siglen, EVP_PKEY *pkey); + +__owur int EVP_DigestVerify(EVP_MD_CTX *ctx, const unsigned char *sigret, + size_t siglen, const unsigned char *tbs, + size_t tbslen); + +/*__owur*/ int EVP_DigestSignInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, + const EVP_MD *type, ENGINE *e, + EVP_PKEY *pkey); +__owur int EVP_DigestSignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, + size_t *siglen); + +__owur int EVP_DigestVerifyInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, + const EVP_MD *type, ENGINE *e, + EVP_PKEY *pkey); +__owur int EVP_DigestVerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sig, + size_t siglen); + +# ifndef OPENSSL_NO_RSA +__owur int EVP_OpenInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, + const unsigned char *ek, int ekl, + const unsigned char *iv, EVP_PKEY *priv); +__owur int EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); + +__owur int EVP_SealInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, + unsigned char **ek, int *ekl, unsigned char *iv, + EVP_PKEY **pubk, int npubk); +__owur int EVP_SealFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); +# endif + +EVP_ENCODE_CTX *EVP_ENCODE_CTX_new(void); +void EVP_ENCODE_CTX_free(EVP_ENCODE_CTX *ctx); +int EVP_ENCODE_CTX_copy(EVP_ENCODE_CTX *dctx, EVP_ENCODE_CTX *sctx); +int EVP_ENCODE_CTX_num(EVP_ENCODE_CTX *ctx); +void EVP_EncodeInit(EVP_ENCODE_CTX *ctx); +int EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, + const unsigned char *in, int inl); +void EVP_EncodeFinal(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl); +int EVP_EncodeBlock(unsigned char *t, const unsigned char *f, int n); + +void EVP_DecodeInit(EVP_ENCODE_CTX *ctx); +int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, + const unsigned char *in, int inl); +int EVP_DecodeFinal(EVP_ENCODE_CTX *ctx, unsigned + char *out, int *outl); +int EVP_DecodeBlock(unsigned char *t, const unsigned char *f, int n); + +# if OPENSSL_API_COMPAT < 0x10100000L +# define EVP_CIPHER_CTX_init(c) EVP_CIPHER_CTX_reset(c) +# define EVP_CIPHER_CTX_cleanup(c) EVP_CIPHER_CTX_reset(c) +# endif +EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void); +int EVP_CIPHER_CTX_reset(EVP_CIPHER_CTX *c); +void EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *c); +int EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *x, int keylen); +int EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *c, int pad); +int EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr); +int EVP_CIPHER_CTX_rand_key(EVP_CIPHER_CTX *ctx, unsigned char *key); + +const BIO_METHOD *BIO_f_md(void); +const BIO_METHOD *BIO_f_base64(void); +const BIO_METHOD *BIO_f_cipher(void); +const BIO_METHOD *BIO_f_reliable(void); +__owur int BIO_set_cipher(BIO *b, const EVP_CIPHER *c, const unsigned char *k, + const unsigned char *i, int enc); + +const EVP_MD *EVP_md_null(void); +# ifndef OPENSSL_NO_MD2 +const EVP_MD *EVP_md2(void); +# endif +# ifndef OPENSSL_NO_MD4 +const EVP_MD *EVP_md4(void); +# endif +# ifndef OPENSSL_NO_MD5 +const EVP_MD *EVP_md5(void); +const EVP_MD *EVP_md5_sha1(void); +# endif +# ifndef OPENSSL_NO_BLAKE2 +const EVP_MD *EVP_blake2b512(void); +const EVP_MD *EVP_blake2s256(void); +# endif +const EVP_MD *EVP_sha1(void); +const EVP_MD *EVP_sha224(void); +const EVP_MD *EVP_sha256(void); +const EVP_MD *EVP_sha384(void); +const EVP_MD *EVP_sha512(void); +const EVP_MD *EVP_sha512_224(void); +const EVP_MD *EVP_sha512_256(void); +const EVP_MD *EVP_sha3_224(void); +const EVP_MD *EVP_sha3_256(void); +const EVP_MD *EVP_sha3_384(void); +const EVP_MD *EVP_sha3_512(void); +const EVP_MD *EVP_shake128(void); +const EVP_MD *EVP_shake256(void); +# ifndef OPENSSL_NO_MDC2 +const EVP_MD *EVP_mdc2(void); +# endif +# ifndef OPENSSL_NO_RMD160 +const EVP_MD *EVP_ripemd160(void); +# endif +# ifndef OPENSSL_NO_WHIRLPOOL +const EVP_MD *EVP_whirlpool(void); +# endif +# ifndef OPENSSL_NO_SM3 +const EVP_MD *EVP_sm3(void); +# endif +const EVP_CIPHER *EVP_enc_null(void); /* does nothing :-) */ +# ifndef OPENSSL_NO_DES +const EVP_CIPHER *EVP_des_ecb(void); +const EVP_CIPHER *EVP_des_ede(void); +const EVP_CIPHER *EVP_des_ede3(void); +const EVP_CIPHER *EVP_des_ede_ecb(void); +const EVP_CIPHER *EVP_des_ede3_ecb(void); +const EVP_CIPHER *EVP_des_cfb64(void); +# define EVP_des_cfb EVP_des_cfb64 +const EVP_CIPHER *EVP_des_cfb1(void); +const EVP_CIPHER *EVP_des_cfb8(void); +const EVP_CIPHER *EVP_des_ede_cfb64(void); +# define EVP_des_ede_cfb EVP_des_ede_cfb64 +const EVP_CIPHER *EVP_des_ede3_cfb64(void); +# define EVP_des_ede3_cfb EVP_des_ede3_cfb64 +const EVP_CIPHER *EVP_des_ede3_cfb1(void); +const EVP_CIPHER *EVP_des_ede3_cfb8(void); +const EVP_CIPHER *EVP_des_ofb(void); +const EVP_CIPHER *EVP_des_ede_ofb(void); +const EVP_CIPHER *EVP_des_ede3_ofb(void); +const EVP_CIPHER *EVP_des_cbc(void); +const EVP_CIPHER *EVP_des_ede_cbc(void); +const EVP_CIPHER *EVP_des_ede3_cbc(void); +const EVP_CIPHER *EVP_desx_cbc(void); +const EVP_CIPHER *EVP_des_ede3_wrap(void); +/* + * This should now be supported through the dev_crypto ENGINE. But also, why + * are rc4 and md5 declarations made here inside a "NO_DES" precompiler + * branch? + */ +# endif +# ifndef OPENSSL_NO_RC4 +const EVP_CIPHER *EVP_rc4(void); +const EVP_CIPHER *EVP_rc4_40(void); +# ifndef OPENSSL_NO_MD5 +const EVP_CIPHER *EVP_rc4_hmac_md5(void); +# endif +# endif +# ifndef OPENSSL_NO_IDEA +const EVP_CIPHER *EVP_idea_ecb(void); +const EVP_CIPHER *EVP_idea_cfb64(void); +# define EVP_idea_cfb EVP_idea_cfb64 +const EVP_CIPHER *EVP_idea_ofb(void); +const EVP_CIPHER *EVP_idea_cbc(void); +# endif +# ifndef OPENSSL_NO_RC2 +const EVP_CIPHER *EVP_rc2_ecb(void); +const EVP_CIPHER *EVP_rc2_cbc(void); +const EVP_CIPHER *EVP_rc2_40_cbc(void); +const EVP_CIPHER *EVP_rc2_64_cbc(void); +const EVP_CIPHER *EVP_rc2_cfb64(void); +# define EVP_rc2_cfb EVP_rc2_cfb64 +const EVP_CIPHER *EVP_rc2_ofb(void); +# endif +# ifndef OPENSSL_NO_BF +const EVP_CIPHER *EVP_bf_ecb(void); +const EVP_CIPHER *EVP_bf_cbc(void); +const EVP_CIPHER *EVP_bf_cfb64(void); +# define EVP_bf_cfb EVP_bf_cfb64 +const EVP_CIPHER *EVP_bf_ofb(void); +# endif +# ifndef OPENSSL_NO_CAST +const EVP_CIPHER *EVP_cast5_ecb(void); +const EVP_CIPHER *EVP_cast5_cbc(void); +const EVP_CIPHER *EVP_cast5_cfb64(void); +# define EVP_cast5_cfb EVP_cast5_cfb64 +const EVP_CIPHER *EVP_cast5_ofb(void); +# endif +# ifndef OPENSSL_NO_RC5 +const EVP_CIPHER *EVP_rc5_32_12_16_cbc(void); +const EVP_CIPHER *EVP_rc5_32_12_16_ecb(void); +const EVP_CIPHER *EVP_rc5_32_12_16_cfb64(void); +# define EVP_rc5_32_12_16_cfb EVP_rc5_32_12_16_cfb64 +const EVP_CIPHER *EVP_rc5_32_12_16_ofb(void); +# endif +const EVP_CIPHER *EVP_aes_128_ecb(void); +const EVP_CIPHER *EVP_aes_128_cbc(void); +const EVP_CIPHER *EVP_aes_128_cfb1(void); +const EVP_CIPHER *EVP_aes_128_cfb8(void); +const EVP_CIPHER *EVP_aes_128_cfb128(void); +# define EVP_aes_128_cfb EVP_aes_128_cfb128 +const EVP_CIPHER *EVP_aes_128_ofb(void); +const EVP_CIPHER *EVP_aes_128_ctr(void); +const EVP_CIPHER *EVP_aes_128_ccm(void); +const EVP_CIPHER *EVP_aes_128_gcm(void); +const EVP_CIPHER *EVP_aes_128_xts(void); +const EVP_CIPHER *EVP_aes_128_wrap(void); +const EVP_CIPHER *EVP_aes_128_wrap_pad(void); +# ifndef OPENSSL_NO_OCB +const EVP_CIPHER *EVP_aes_128_ocb(void); +# endif +const EVP_CIPHER *EVP_aes_192_ecb(void); +const EVP_CIPHER *EVP_aes_192_cbc(void); +const EVP_CIPHER *EVP_aes_192_cfb1(void); +const EVP_CIPHER *EVP_aes_192_cfb8(void); +const EVP_CIPHER *EVP_aes_192_cfb128(void); +# define EVP_aes_192_cfb EVP_aes_192_cfb128 +const EVP_CIPHER *EVP_aes_192_ofb(void); +const EVP_CIPHER *EVP_aes_192_ctr(void); +const EVP_CIPHER *EVP_aes_192_ccm(void); +const EVP_CIPHER *EVP_aes_192_gcm(void); +const EVP_CIPHER *EVP_aes_192_wrap(void); +const EVP_CIPHER *EVP_aes_192_wrap_pad(void); +# ifndef OPENSSL_NO_OCB +const EVP_CIPHER *EVP_aes_192_ocb(void); +# endif +const EVP_CIPHER *EVP_aes_256_ecb(void); +const EVP_CIPHER *EVP_aes_256_cbc(void); +const EVP_CIPHER *EVP_aes_256_cfb1(void); +const EVP_CIPHER *EVP_aes_256_cfb8(void); +const EVP_CIPHER *EVP_aes_256_cfb128(void); +# define EVP_aes_256_cfb EVP_aes_256_cfb128 +const EVP_CIPHER *EVP_aes_256_ofb(void); +const EVP_CIPHER *EVP_aes_256_ctr(void); +const EVP_CIPHER *EVP_aes_256_ccm(void); +const EVP_CIPHER *EVP_aes_256_gcm(void); +const EVP_CIPHER *EVP_aes_256_xts(void); +const EVP_CIPHER *EVP_aes_256_wrap(void); +const EVP_CIPHER *EVP_aes_256_wrap_pad(void); +# ifndef OPENSSL_NO_OCB +const EVP_CIPHER *EVP_aes_256_ocb(void); +# endif +const EVP_CIPHER *EVP_aes_128_cbc_hmac_sha1(void); +const EVP_CIPHER *EVP_aes_256_cbc_hmac_sha1(void); +const EVP_CIPHER *EVP_aes_128_cbc_hmac_sha256(void); +const EVP_CIPHER *EVP_aes_256_cbc_hmac_sha256(void); +# ifndef OPENSSL_NO_ARIA +const EVP_CIPHER *EVP_aria_128_ecb(void); +const EVP_CIPHER *EVP_aria_128_cbc(void); +const EVP_CIPHER *EVP_aria_128_cfb1(void); +const EVP_CIPHER *EVP_aria_128_cfb8(void); +const EVP_CIPHER *EVP_aria_128_cfb128(void); +# define EVP_aria_128_cfb EVP_aria_128_cfb128 +const EVP_CIPHER *EVP_aria_128_ctr(void); +const EVP_CIPHER *EVP_aria_128_ofb(void); +const EVP_CIPHER *EVP_aria_128_gcm(void); +const EVP_CIPHER *EVP_aria_128_ccm(void); +const EVP_CIPHER *EVP_aria_192_ecb(void); +const EVP_CIPHER *EVP_aria_192_cbc(void); +const EVP_CIPHER *EVP_aria_192_cfb1(void); +const EVP_CIPHER *EVP_aria_192_cfb8(void); +const EVP_CIPHER *EVP_aria_192_cfb128(void); +# define EVP_aria_192_cfb EVP_aria_192_cfb128 +const EVP_CIPHER *EVP_aria_192_ctr(void); +const EVP_CIPHER *EVP_aria_192_ofb(void); +const EVP_CIPHER *EVP_aria_192_gcm(void); +const EVP_CIPHER *EVP_aria_192_ccm(void); +const EVP_CIPHER *EVP_aria_256_ecb(void); +const EVP_CIPHER *EVP_aria_256_cbc(void); +const EVP_CIPHER *EVP_aria_256_cfb1(void); +const EVP_CIPHER *EVP_aria_256_cfb8(void); +const EVP_CIPHER *EVP_aria_256_cfb128(void); +# define EVP_aria_256_cfb EVP_aria_256_cfb128 +const EVP_CIPHER *EVP_aria_256_ctr(void); +const EVP_CIPHER *EVP_aria_256_ofb(void); +const EVP_CIPHER *EVP_aria_256_gcm(void); +const EVP_CIPHER *EVP_aria_256_ccm(void); +# endif +# ifndef OPENSSL_NO_CAMELLIA +const EVP_CIPHER *EVP_camellia_128_ecb(void); +const EVP_CIPHER *EVP_camellia_128_cbc(void); +const EVP_CIPHER *EVP_camellia_128_cfb1(void); +const EVP_CIPHER *EVP_camellia_128_cfb8(void); +const EVP_CIPHER *EVP_camellia_128_cfb128(void); +# define EVP_camellia_128_cfb EVP_camellia_128_cfb128 +const EVP_CIPHER *EVP_camellia_128_ofb(void); +const EVP_CIPHER *EVP_camellia_128_ctr(void); +const EVP_CIPHER *EVP_camellia_192_ecb(void); +const EVP_CIPHER *EVP_camellia_192_cbc(void); +const EVP_CIPHER *EVP_camellia_192_cfb1(void); +const EVP_CIPHER *EVP_camellia_192_cfb8(void); +const EVP_CIPHER *EVP_camellia_192_cfb128(void); +# define EVP_camellia_192_cfb EVP_camellia_192_cfb128 +const EVP_CIPHER *EVP_camellia_192_ofb(void); +const EVP_CIPHER *EVP_camellia_192_ctr(void); +const EVP_CIPHER *EVP_camellia_256_ecb(void); +const EVP_CIPHER *EVP_camellia_256_cbc(void); +const EVP_CIPHER *EVP_camellia_256_cfb1(void); +const EVP_CIPHER *EVP_camellia_256_cfb8(void); +const EVP_CIPHER *EVP_camellia_256_cfb128(void); +# define EVP_camellia_256_cfb EVP_camellia_256_cfb128 +const EVP_CIPHER *EVP_camellia_256_ofb(void); +const EVP_CIPHER *EVP_camellia_256_ctr(void); +# endif +# ifndef OPENSSL_NO_CHACHA +const EVP_CIPHER *EVP_chacha20(void); +# ifndef OPENSSL_NO_POLY1305 +const EVP_CIPHER *EVP_chacha20_poly1305(void); +# endif +# endif + +# ifndef OPENSSL_NO_SEED +const EVP_CIPHER *EVP_seed_ecb(void); +const EVP_CIPHER *EVP_seed_cbc(void); +const EVP_CIPHER *EVP_seed_cfb128(void); +# define EVP_seed_cfb EVP_seed_cfb128 +const EVP_CIPHER *EVP_seed_ofb(void); +# endif + +# ifndef OPENSSL_NO_SM4 +const EVP_CIPHER *EVP_sm4_ecb(void); +const EVP_CIPHER *EVP_sm4_cbc(void); +const EVP_CIPHER *EVP_sm4_cfb128(void); +# define EVP_sm4_cfb EVP_sm4_cfb128 +const EVP_CIPHER *EVP_sm4_ofb(void); +const EVP_CIPHER *EVP_sm4_ctr(void); +# endif + +# if OPENSSL_API_COMPAT < 0x10100000L +# define OPENSSL_add_all_algorithms_conf() \ + OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS \ + | OPENSSL_INIT_ADD_ALL_DIGESTS \ + | OPENSSL_INIT_LOAD_CONFIG, NULL) +# define OPENSSL_add_all_algorithms_noconf() \ + OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS \ + | OPENSSL_INIT_ADD_ALL_DIGESTS, NULL) + +# ifdef OPENSSL_LOAD_CONF +# define OpenSSL_add_all_algorithms() OPENSSL_add_all_algorithms_conf() +# else +# define OpenSSL_add_all_algorithms() OPENSSL_add_all_algorithms_noconf() +# endif + +# define OpenSSL_add_all_ciphers() \ + OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS, NULL) +# define OpenSSL_add_all_digests() \ + OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_DIGESTS, NULL) + +# define EVP_cleanup() while(0) continue +# endif + +int EVP_add_cipher(const EVP_CIPHER *cipher); +int EVP_add_digest(const EVP_MD *digest); + +const EVP_CIPHER *EVP_get_cipherbyname(const char *name); +const EVP_MD *EVP_get_digestbyname(const char *name); + +void EVP_CIPHER_do_all(void (*fn) (const EVP_CIPHER *ciph, + const char *from, const char *to, void *x), + void *arg); +void EVP_CIPHER_do_all_sorted(void (*fn) + (const EVP_CIPHER *ciph, const char *from, + const char *to, void *x), void *arg); + +void EVP_MD_do_all(void (*fn) (const EVP_MD *ciph, + const char *from, const char *to, void *x), + void *arg); +void EVP_MD_do_all_sorted(void (*fn) + (const EVP_MD *ciph, const char *from, + const char *to, void *x), void *arg); + +int EVP_PKEY_decrypt_old(unsigned char *dec_key, + const unsigned char *enc_key, int enc_key_len, + EVP_PKEY *private_key); +int EVP_PKEY_encrypt_old(unsigned char *enc_key, + const unsigned char *key, int key_len, + EVP_PKEY *pub_key); +int EVP_PKEY_type(int type); +int EVP_PKEY_id(const EVP_PKEY *pkey); +int EVP_PKEY_base_id(const EVP_PKEY *pkey); +int EVP_PKEY_bits(const EVP_PKEY *pkey); +int EVP_PKEY_security_bits(const EVP_PKEY *pkey); +int EVP_PKEY_size(const EVP_PKEY *pkey); +int EVP_PKEY_set_type(EVP_PKEY *pkey, int type); +int EVP_PKEY_set_type_str(EVP_PKEY *pkey, const char *str, int len); +int EVP_PKEY_set_alias_type(EVP_PKEY *pkey, int type); +# ifndef OPENSSL_NO_ENGINE +int EVP_PKEY_set1_engine(EVP_PKEY *pkey, ENGINE *e); +ENGINE *EVP_PKEY_get0_engine(const EVP_PKEY *pkey); +# endif +int EVP_PKEY_assign(EVP_PKEY *pkey, int type, void *key); +void *EVP_PKEY_get0(const EVP_PKEY *pkey); +const unsigned char *EVP_PKEY_get0_hmac(const EVP_PKEY *pkey, size_t *len); +# ifndef OPENSSL_NO_POLY1305 +const unsigned char *EVP_PKEY_get0_poly1305(const EVP_PKEY *pkey, size_t *len); +# endif +# ifndef OPENSSL_NO_SIPHASH +const unsigned char *EVP_PKEY_get0_siphash(const EVP_PKEY *pkey, size_t *len); +# endif + +# ifndef OPENSSL_NO_RSA +struct rsa_st; +int EVP_PKEY_set1_RSA(EVP_PKEY *pkey, struct rsa_st *key); +struct rsa_st *EVP_PKEY_get0_RSA(EVP_PKEY *pkey); +struct rsa_st *EVP_PKEY_get1_RSA(EVP_PKEY *pkey); +# endif +# ifndef OPENSSL_NO_DSA +struct dsa_st; +int EVP_PKEY_set1_DSA(EVP_PKEY *pkey, struct dsa_st *key); +struct dsa_st *EVP_PKEY_get0_DSA(EVP_PKEY *pkey); +struct dsa_st *EVP_PKEY_get1_DSA(EVP_PKEY *pkey); +# endif +# ifndef OPENSSL_NO_DH +struct dh_st; +int EVP_PKEY_set1_DH(EVP_PKEY *pkey, struct dh_st *key); +struct dh_st *EVP_PKEY_get0_DH(EVP_PKEY *pkey); +struct dh_st *EVP_PKEY_get1_DH(EVP_PKEY *pkey); +# endif +# ifndef OPENSSL_NO_EC +struct ec_key_st; +int EVP_PKEY_set1_EC_KEY(EVP_PKEY *pkey, struct ec_key_st *key); +struct ec_key_st *EVP_PKEY_get0_EC_KEY(EVP_PKEY *pkey); +struct ec_key_st *EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey); +# endif + +EVP_PKEY *EVP_PKEY_new(void); +int EVP_PKEY_up_ref(EVP_PKEY *pkey); +void EVP_PKEY_free(EVP_PKEY *pkey); + +EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, const unsigned char **pp, + long length); +int i2d_PublicKey(EVP_PKEY *a, unsigned char **pp); + +EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, const unsigned char **pp, + long length); +EVP_PKEY *d2i_AutoPrivateKey(EVP_PKEY **a, const unsigned char **pp, + long length); +int i2d_PrivateKey(EVP_PKEY *a, unsigned char **pp); + +int EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from); +int EVP_PKEY_missing_parameters(const EVP_PKEY *pkey); +int EVP_PKEY_save_parameters(EVP_PKEY *pkey, int mode); +int EVP_PKEY_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b); + +int EVP_PKEY_cmp(const EVP_PKEY *a, const EVP_PKEY *b); + +int EVP_PKEY_print_public(BIO *out, const EVP_PKEY *pkey, + int indent, ASN1_PCTX *pctx); +int EVP_PKEY_print_private(BIO *out, const EVP_PKEY *pkey, + int indent, ASN1_PCTX *pctx); +int EVP_PKEY_print_params(BIO *out, const EVP_PKEY *pkey, + int indent, ASN1_PCTX *pctx); + +int EVP_PKEY_get_default_digest_nid(EVP_PKEY *pkey, int *pnid); + +int EVP_PKEY_set1_tls_encodedpoint(EVP_PKEY *pkey, + const unsigned char *pt, size_t ptlen); +size_t EVP_PKEY_get1_tls_encodedpoint(EVP_PKEY *pkey, unsigned char **ppt); + +int EVP_CIPHER_type(const EVP_CIPHER *ctx); + +/* calls methods */ +int EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *c, ASN1_TYPE *type); +int EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *c, ASN1_TYPE *type); + +/* These are used by EVP_CIPHER methods */ +int EVP_CIPHER_set_asn1_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type); +int EVP_CIPHER_get_asn1_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type); + +/* PKCS5 password based encryption */ +int PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, + ASN1_TYPE *param, const EVP_CIPHER *cipher, + const EVP_MD *md, int en_de); +int PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen, + const unsigned char *salt, int saltlen, int iter, + int keylen, unsigned char *out); +int PKCS5_PBKDF2_HMAC(const char *pass, int passlen, + const unsigned char *salt, int saltlen, int iter, + const EVP_MD *digest, int keylen, unsigned char *out); +int PKCS5_v2_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, + ASN1_TYPE *param, const EVP_CIPHER *cipher, + const EVP_MD *md, int en_de); + +#ifndef OPENSSL_NO_SCRYPT +int EVP_PBE_scrypt(const char *pass, size_t passlen, + const unsigned char *salt, size_t saltlen, + uint64_t N, uint64_t r, uint64_t p, uint64_t maxmem, + unsigned char *key, size_t keylen); + +int PKCS5_v2_scrypt_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, + int passlen, ASN1_TYPE *param, + const EVP_CIPHER *c, const EVP_MD *md, int en_de); +#endif + +void PKCS5_PBE_add(void); + +int EVP_PBE_CipherInit(ASN1_OBJECT *pbe_obj, const char *pass, int passlen, + ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de); + +/* PBE type */ + +/* Can appear as the outermost AlgorithmIdentifier */ +# define EVP_PBE_TYPE_OUTER 0x0 +/* Is an PRF type OID */ +# define EVP_PBE_TYPE_PRF 0x1 +/* Is a PKCS#5 v2.0 KDF */ +# define EVP_PBE_TYPE_KDF 0x2 + +int EVP_PBE_alg_add_type(int pbe_type, int pbe_nid, int cipher_nid, + int md_nid, EVP_PBE_KEYGEN *keygen); +int EVP_PBE_alg_add(int nid, const EVP_CIPHER *cipher, const EVP_MD *md, + EVP_PBE_KEYGEN *keygen); +int EVP_PBE_find(int type, int pbe_nid, int *pcnid, int *pmnid, + EVP_PBE_KEYGEN **pkeygen); +void EVP_PBE_cleanup(void); +int EVP_PBE_get(int *ptype, int *ppbe_nid, size_t num); + +# define ASN1_PKEY_ALIAS 0x1 +# define ASN1_PKEY_DYNAMIC 0x2 +# define ASN1_PKEY_SIGPARAM_NULL 0x4 + +# define ASN1_PKEY_CTRL_PKCS7_SIGN 0x1 +# define ASN1_PKEY_CTRL_PKCS7_ENCRYPT 0x2 +# define ASN1_PKEY_CTRL_DEFAULT_MD_NID 0x3 +# define ASN1_PKEY_CTRL_CMS_SIGN 0x5 +# define ASN1_PKEY_CTRL_CMS_ENVELOPE 0x7 +# define ASN1_PKEY_CTRL_CMS_RI_TYPE 0x8 + +# define ASN1_PKEY_CTRL_SET1_TLS_ENCPT 0x9 +# define ASN1_PKEY_CTRL_GET1_TLS_ENCPT 0xa + +int EVP_PKEY_asn1_get_count(void); +const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_get0(int idx); +const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find(ENGINE **pe, int type); +const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find_str(ENGINE **pe, + const char *str, int len); +int EVP_PKEY_asn1_add0(const EVP_PKEY_ASN1_METHOD *ameth); +int EVP_PKEY_asn1_add_alias(int to, int from); +int EVP_PKEY_asn1_get0_info(int *ppkey_id, int *pkey_base_id, + int *ppkey_flags, const char **pinfo, + const char **ppem_str, + const EVP_PKEY_ASN1_METHOD *ameth); + +const EVP_PKEY_ASN1_METHOD *EVP_PKEY_get0_asn1(const EVP_PKEY *pkey); +EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_new(int id, int flags, + const char *pem_str, + const char *info); +void EVP_PKEY_asn1_copy(EVP_PKEY_ASN1_METHOD *dst, + const EVP_PKEY_ASN1_METHOD *src); +void EVP_PKEY_asn1_free(EVP_PKEY_ASN1_METHOD *ameth); +void EVP_PKEY_asn1_set_public(EVP_PKEY_ASN1_METHOD *ameth, + int (*pub_decode) (EVP_PKEY *pk, + X509_PUBKEY *pub), + int (*pub_encode) (X509_PUBKEY *pub, + const EVP_PKEY *pk), + int (*pub_cmp) (const EVP_PKEY *a, + const EVP_PKEY *b), + int (*pub_print) (BIO *out, + const EVP_PKEY *pkey, + int indent, ASN1_PCTX *pctx), + int (*pkey_size) (const EVP_PKEY *pk), + int (*pkey_bits) (const EVP_PKEY *pk)); +void EVP_PKEY_asn1_set_private(EVP_PKEY_ASN1_METHOD *ameth, + int (*priv_decode) (EVP_PKEY *pk, + const PKCS8_PRIV_KEY_INFO + *p8inf), + int (*priv_encode) (PKCS8_PRIV_KEY_INFO *p8, + const EVP_PKEY *pk), + int (*priv_print) (BIO *out, + const EVP_PKEY *pkey, + int indent, + ASN1_PCTX *pctx)); +void EVP_PKEY_asn1_set_param(EVP_PKEY_ASN1_METHOD *ameth, + int (*param_decode) (EVP_PKEY *pkey, + const unsigned char **pder, + int derlen), + int (*param_encode) (const EVP_PKEY *pkey, + unsigned char **pder), + int (*param_missing) (const EVP_PKEY *pk), + int (*param_copy) (EVP_PKEY *to, + const EVP_PKEY *from), + int (*param_cmp) (const EVP_PKEY *a, + const EVP_PKEY *b), + int (*param_print) (BIO *out, + const EVP_PKEY *pkey, + int indent, + ASN1_PCTX *pctx)); + +void EVP_PKEY_asn1_set_free(EVP_PKEY_ASN1_METHOD *ameth, + void (*pkey_free) (EVP_PKEY *pkey)); +void EVP_PKEY_asn1_set_ctrl(EVP_PKEY_ASN1_METHOD *ameth, + int (*pkey_ctrl) (EVP_PKEY *pkey, int op, + long arg1, void *arg2)); +void EVP_PKEY_asn1_set_item(EVP_PKEY_ASN1_METHOD *ameth, + int (*item_verify) (EVP_MD_CTX *ctx, + const ASN1_ITEM *it, + void *asn, + X509_ALGOR *a, + ASN1_BIT_STRING *sig, + EVP_PKEY *pkey), + int (*item_sign) (EVP_MD_CTX *ctx, + const ASN1_ITEM *it, + void *asn, + X509_ALGOR *alg1, + X509_ALGOR *alg2, + ASN1_BIT_STRING *sig)); + +void EVP_PKEY_asn1_set_siginf(EVP_PKEY_ASN1_METHOD *ameth, + int (*siginf_set) (X509_SIG_INFO *siginf, + const X509_ALGOR *alg, + const ASN1_STRING *sig)); + +void EVP_PKEY_asn1_set_check(EVP_PKEY_ASN1_METHOD *ameth, + int (*pkey_check) (const EVP_PKEY *pk)); + +void EVP_PKEY_asn1_set_public_check(EVP_PKEY_ASN1_METHOD *ameth, + int (*pkey_pub_check) (const EVP_PKEY *pk)); + +void EVP_PKEY_asn1_set_param_check(EVP_PKEY_ASN1_METHOD *ameth, + int (*pkey_param_check) (const EVP_PKEY *pk)); + +void EVP_PKEY_asn1_set_set_priv_key(EVP_PKEY_ASN1_METHOD *ameth, + int (*set_priv_key) (EVP_PKEY *pk, + const unsigned char + *priv, + size_t len)); +void EVP_PKEY_asn1_set_set_pub_key(EVP_PKEY_ASN1_METHOD *ameth, + int (*set_pub_key) (EVP_PKEY *pk, + const unsigned char *pub, + size_t len)); +void EVP_PKEY_asn1_set_get_priv_key(EVP_PKEY_ASN1_METHOD *ameth, + int (*get_priv_key) (const EVP_PKEY *pk, + unsigned char *priv, + size_t *len)); +void EVP_PKEY_asn1_set_get_pub_key(EVP_PKEY_ASN1_METHOD *ameth, + int (*get_pub_key) (const EVP_PKEY *pk, + unsigned char *pub, + size_t *len)); + +void EVP_PKEY_asn1_set_security_bits(EVP_PKEY_ASN1_METHOD *ameth, + int (*pkey_security_bits) (const EVP_PKEY + *pk)); + +# define EVP_PKEY_OP_UNDEFINED 0 +# define EVP_PKEY_OP_PARAMGEN (1<<1) +# define EVP_PKEY_OP_KEYGEN (1<<2) +# define EVP_PKEY_OP_SIGN (1<<3) +# define EVP_PKEY_OP_VERIFY (1<<4) +# define EVP_PKEY_OP_VERIFYRECOVER (1<<5) +# define EVP_PKEY_OP_SIGNCTX (1<<6) +# define EVP_PKEY_OP_VERIFYCTX (1<<7) +# define EVP_PKEY_OP_ENCRYPT (1<<8) +# define EVP_PKEY_OP_DECRYPT (1<<9) +# define EVP_PKEY_OP_DERIVE (1<<10) + +# define EVP_PKEY_OP_TYPE_SIG \ + (EVP_PKEY_OP_SIGN | EVP_PKEY_OP_VERIFY | EVP_PKEY_OP_VERIFYRECOVER \ + | EVP_PKEY_OP_SIGNCTX | EVP_PKEY_OP_VERIFYCTX) + +# define EVP_PKEY_OP_TYPE_CRYPT \ + (EVP_PKEY_OP_ENCRYPT | EVP_PKEY_OP_DECRYPT) + +# define EVP_PKEY_OP_TYPE_NOGEN \ + (EVP_PKEY_OP_TYPE_SIG | EVP_PKEY_OP_TYPE_CRYPT | EVP_PKEY_OP_DERIVE) + +# define EVP_PKEY_OP_TYPE_GEN \ + (EVP_PKEY_OP_PARAMGEN | EVP_PKEY_OP_KEYGEN) + +# define EVP_PKEY_CTX_set_signature_md(ctx, md) \ + EVP_PKEY_CTX_ctrl(ctx, -1, EVP_PKEY_OP_TYPE_SIG, \ + EVP_PKEY_CTRL_MD, 0, (void *)(md)) + +# define EVP_PKEY_CTX_get_signature_md(ctx, pmd) \ + EVP_PKEY_CTX_ctrl(ctx, -1, EVP_PKEY_OP_TYPE_SIG, \ + EVP_PKEY_CTRL_GET_MD, 0, (void *)(pmd)) + +# define EVP_PKEY_CTX_set_mac_key(ctx, key, len) \ + EVP_PKEY_CTX_ctrl(ctx, -1, EVP_PKEY_OP_KEYGEN, \ + EVP_PKEY_CTRL_SET_MAC_KEY, len, (void *)(key)) + +# define EVP_PKEY_CTRL_MD 1 +# define EVP_PKEY_CTRL_PEER_KEY 2 + +# define EVP_PKEY_CTRL_PKCS7_ENCRYPT 3 +# define EVP_PKEY_CTRL_PKCS7_DECRYPT 4 + +# define EVP_PKEY_CTRL_PKCS7_SIGN 5 + +# define EVP_PKEY_CTRL_SET_MAC_KEY 6 + +# define EVP_PKEY_CTRL_DIGESTINIT 7 + +/* Used by GOST key encryption in TLS */ +# define EVP_PKEY_CTRL_SET_IV 8 + +# define EVP_PKEY_CTRL_CMS_ENCRYPT 9 +# define EVP_PKEY_CTRL_CMS_DECRYPT 10 +# define EVP_PKEY_CTRL_CMS_SIGN 11 + +# define EVP_PKEY_CTRL_CIPHER 12 + +# define EVP_PKEY_CTRL_GET_MD 13 + +# define EVP_PKEY_CTRL_SET_DIGEST_SIZE 14 + +# define EVP_PKEY_ALG_CTRL 0x1000 + +# define EVP_PKEY_FLAG_AUTOARGLEN 2 +/* + * Method handles all operations: don't assume any digest related defaults. + */ +# define EVP_PKEY_FLAG_SIGCTX_CUSTOM 4 + +const EVP_PKEY_METHOD *EVP_PKEY_meth_find(int type); +EVP_PKEY_METHOD *EVP_PKEY_meth_new(int id, int flags); +void EVP_PKEY_meth_get0_info(int *ppkey_id, int *pflags, + const EVP_PKEY_METHOD *meth); +void EVP_PKEY_meth_copy(EVP_PKEY_METHOD *dst, const EVP_PKEY_METHOD *src); +void EVP_PKEY_meth_free(EVP_PKEY_METHOD *pmeth); +int EVP_PKEY_meth_add0(const EVP_PKEY_METHOD *pmeth); +int EVP_PKEY_meth_remove(const EVP_PKEY_METHOD *pmeth); +size_t EVP_PKEY_meth_get_count(void); +const EVP_PKEY_METHOD *EVP_PKEY_meth_get0(size_t idx); + +EVP_PKEY_CTX *EVP_PKEY_CTX_new(EVP_PKEY *pkey, ENGINE *e); +EVP_PKEY_CTX *EVP_PKEY_CTX_new_id(int id, ENGINE *e); +EVP_PKEY_CTX *EVP_PKEY_CTX_dup(EVP_PKEY_CTX *ctx); +void EVP_PKEY_CTX_free(EVP_PKEY_CTX *ctx); + +int EVP_PKEY_CTX_ctrl(EVP_PKEY_CTX *ctx, int keytype, int optype, + int cmd, int p1, void *p2); +int EVP_PKEY_CTX_ctrl_str(EVP_PKEY_CTX *ctx, const char *type, + const char *value); +int EVP_PKEY_CTX_ctrl_uint64(EVP_PKEY_CTX *ctx, int keytype, int optype, + int cmd, uint64_t value); + +int EVP_PKEY_CTX_str2ctrl(EVP_PKEY_CTX *ctx, int cmd, const char *str); +int EVP_PKEY_CTX_hex2ctrl(EVP_PKEY_CTX *ctx, int cmd, const char *hex); + +int EVP_PKEY_CTX_md(EVP_PKEY_CTX *ctx, int optype, int cmd, const char *md); + +int EVP_PKEY_CTX_get_operation(EVP_PKEY_CTX *ctx); +void EVP_PKEY_CTX_set0_keygen_info(EVP_PKEY_CTX *ctx, int *dat, int datlen); + +EVP_PKEY *EVP_PKEY_new_mac_key(int type, ENGINE *e, + const unsigned char *key, int keylen); +EVP_PKEY *EVP_PKEY_new_raw_private_key(int type, ENGINE *e, + const unsigned char *priv, + size_t len); +EVP_PKEY *EVP_PKEY_new_raw_public_key(int type, ENGINE *e, + const unsigned char *pub, + size_t len); +int EVP_PKEY_get_raw_private_key(const EVP_PKEY *pkey, unsigned char *priv, + size_t *len); +int EVP_PKEY_get_raw_public_key(const EVP_PKEY *pkey, unsigned char *pub, + size_t *len); + +EVP_PKEY *EVP_PKEY_new_CMAC_key(ENGINE *e, const unsigned char *priv, + size_t len, const EVP_CIPHER *cipher); + +void EVP_PKEY_CTX_set_data(EVP_PKEY_CTX *ctx, void *data); +void *EVP_PKEY_CTX_get_data(EVP_PKEY_CTX *ctx); +EVP_PKEY *EVP_PKEY_CTX_get0_pkey(EVP_PKEY_CTX *ctx); + +EVP_PKEY *EVP_PKEY_CTX_get0_peerkey(EVP_PKEY_CTX *ctx); + +void EVP_PKEY_CTX_set_app_data(EVP_PKEY_CTX *ctx, void *data); +void *EVP_PKEY_CTX_get_app_data(EVP_PKEY_CTX *ctx); + +int EVP_PKEY_sign_init(EVP_PKEY_CTX *ctx); +int EVP_PKEY_sign(EVP_PKEY_CTX *ctx, + unsigned char *sig, size_t *siglen, + const unsigned char *tbs, size_t tbslen); +int EVP_PKEY_verify_init(EVP_PKEY_CTX *ctx); +int EVP_PKEY_verify(EVP_PKEY_CTX *ctx, + const unsigned char *sig, size_t siglen, + const unsigned char *tbs, size_t tbslen); +int EVP_PKEY_verify_recover_init(EVP_PKEY_CTX *ctx); +int EVP_PKEY_verify_recover(EVP_PKEY_CTX *ctx, + unsigned char *rout, size_t *routlen, + const unsigned char *sig, size_t siglen); +int EVP_PKEY_encrypt_init(EVP_PKEY_CTX *ctx); +int EVP_PKEY_encrypt(EVP_PKEY_CTX *ctx, + unsigned char *out, size_t *outlen, + const unsigned char *in, size_t inlen); +int EVP_PKEY_decrypt_init(EVP_PKEY_CTX *ctx); +int EVP_PKEY_decrypt(EVP_PKEY_CTX *ctx, + unsigned char *out, size_t *outlen, + const unsigned char *in, size_t inlen); + +int EVP_PKEY_derive_init(EVP_PKEY_CTX *ctx); +int EVP_PKEY_derive_set_peer(EVP_PKEY_CTX *ctx, EVP_PKEY *peer); +int EVP_PKEY_derive(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen); + +typedef int EVP_PKEY_gen_cb(EVP_PKEY_CTX *ctx); + +int EVP_PKEY_paramgen_init(EVP_PKEY_CTX *ctx); +int EVP_PKEY_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey); +int EVP_PKEY_keygen_init(EVP_PKEY_CTX *ctx); +int EVP_PKEY_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey); +int EVP_PKEY_check(EVP_PKEY_CTX *ctx); +int EVP_PKEY_public_check(EVP_PKEY_CTX *ctx); +int EVP_PKEY_param_check(EVP_PKEY_CTX *ctx); + +void EVP_PKEY_CTX_set_cb(EVP_PKEY_CTX *ctx, EVP_PKEY_gen_cb *cb); +EVP_PKEY_gen_cb *EVP_PKEY_CTX_get_cb(EVP_PKEY_CTX *ctx); + +int EVP_PKEY_CTX_get_keygen_info(EVP_PKEY_CTX *ctx, int idx); + +void EVP_PKEY_meth_set_init(EVP_PKEY_METHOD *pmeth, + int (*init) (EVP_PKEY_CTX *ctx)); + +void EVP_PKEY_meth_set_copy(EVP_PKEY_METHOD *pmeth, + int (*copy) (EVP_PKEY_CTX *dst, + EVP_PKEY_CTX *src)); + +void EVP_PKEY_meth_set_cleanup(EVP_PKEY_METHOD *pmeth, + void (*cleanup) (EVP_PKEY_CTX *ctx)); + +void EVP_PKEY_meth_set_paramgen(EVP_PKEY_METHOD *pmeth, + int (*paramgen_init) (EVP_PKEY_CTX *ctx), + int (*paramgen) (EVP_PKEY_CTX *ctx, + EVP_PKEY *pkey)); + +void EVP_PKEY_meth_set_keygen(EVP_PKEY_METHOD *pmeth, + int (*keygen_init) (EVP_PKEY_CTX *ctx), + int (*keygen) (EVP_PKEY_CTX *ctx, + EVP_PKEY *pkey)); + +void EVP_PKEY_meth_set_sign(EVP_PKEY_METHOD *pmeth, + int (*sign_init) (EVP_PKEY_CTX *ctx), + int (*sign) (EVP_PKEY_CTX *ctx, + unsigned char *sig, size_t *siglen, + const unsigned char *tbs, + size_t tbslen)); + +void EVP_PKEY_meth_set_verify(EVP_PKEY_METHOD *pmeth, + int (*verify_init) (EVP_PKEY_CTX *ctx), + int (*verify) (EVP_PKEY_CTX *ctx, + const unsigned char *sig, + size_t siglen, + const unsigned char *tbs, + size_t tbslen)); + +void EVP_PKEY_meth_set_verify_recover(EVP_PKEY_METHOD *pmeth, + int (*verify_recover_init) (EVP_PKEY_CTX + *ctx), + int (*verify_recover) (EVP_PKEY_CTX + *ctx, + unsigned char + *sig, + size_t *siglen, + const unsigned + char *tbs, + size_t tbslen)); + +void EVP_PKEY_meth_set_signctx(EVP_PKEY_METHOD *pmeth, + int (*signctx_init) (EVP_PKEY_CTX *ctx, + EVP_MD_CTX *mctx), + int (*signctx) (EVP_PKEY_CTX *ctx, + unsigned char *sig, + size_t *siglen, + EVP_MD_CTX *mctx)); + +void EVP_PKEY_meth_set_verifyctx(EVP_PKEY_METHOD *pmeth, + int (*verifyctx_init) (EVP_PKEY_CTX *ctx, + EVP_MD_CTX *mctx), + int (*verifyctx) (EVP_PKEY_CTX *ctx, + const unsigned char *sig, + int siglen, + EVP_MD_CTX *mctx)); + +void EVP_PKEY_meth_set_encrypt(EVP_PKEY_METHOD *pmeth, + int (*encrypt_init) (EVP_PKEY_CTX *ctx), + int (*encryptfn) (EVP_PKEY_CTX *ctx, + unsigned char *out, + size_t *outlen, + const unsigned char *in, + size_t inlen)); + +void EVP_PKEY_meth_set_decrypt(EVP_PKEY_METHOD *pmeth, + int (*decrypt_init) (EVP_PKEY_CTX *ctx), + int (*decrypt) (EVP_PKEY_CTX *ctx, + unsigned char *out, + size_t *outlen, + const unsigned char *in, + size_t inlen)); + +void EVP_PKEY_meth_set_derive(EVP_PKEY_METHOD *pmeth, + int (*derive_init) (EVP_PKEY_CTX *ctx), + int (*derive) (EVP_PKEY_CTX *ctx, + unsigned char *key, + size_t *keylen)); + +void EVP_PKEY_meth_set_ctrl(EVP_PKEY_METHOD *pmeth, + int (*ctrl) (EVP_PKEY_CTX *ctx, int type, int p1, + void *p2), + int (*ctrl_str) (EVP_PKEY_CTX *ctx, + const char *type, + const char *value)); + +void EVP_PKEY_meth_set_digestsign(EVP_PKEY_METHOD *pmeth, + int (*digestsign) (EVP_MD_CTX *ctx, + unsigned char *sig, + size_t *siglen, + const unsigned char *tbs, + size_t tbslen)); + +void EVP_PKEY_meth_set_digestverify(EVP_PKEY_METHOD *pmeth, + int (*digestverify) (EVP_MD_CTX *ctx, + const unsigned char *sig, + size_t siglen, + const unsigned char *tbs, + size_t tbslen)); + +void EVP_PKEY_meth_set_check(EVP_PKEY_METHOD *pmeth, + int (*check) (EVP_PKEY *pkey)); + +void EVP_PKEY_meth_set_public_check(EVP_PKEY_METHOD *pmeth, + int (*check) (EVP_PKEY *pkey)); + +void EVP_PKEY_meth_set_param_check(EVP_PKEY_METHOD *pmeth, + int (*check) (EVP_PKEY *pkey)); + +void EVP_PKEY_meth_set_digest_custom(EVP_PKEY_METHOD *pmeth, + int (*digest_custom) (EVP_PKEY_CTX *ctx, + EVP_MD_CTX *mctx)); + +void EVP_PKEY_meth_get_init(const EVP_PKEY_METHOD *pmeth, + int (**pinit) (EVP_PKEY_CTX *ctx)); + +void EVP_PKEY_meth_get_copy(const EVP_PKEY_METHOD *pmeth, + int (**pcopy) (EVP_PKEY_CTX *dst, + EVP_PKEY_CTX *src)); + +void EVP_PKEY_meth_get_cleanup(const EVP_PKEY_METHOD *pmeth, + void (**pcleanup) (EVP_PKEY_CTX *ctx)); + +void EVP_PKEY_meth_get_paramgen(const EVP_PKEY_METHOD *pmeth, + int (**pparamgen_init) (EVP_PKEY_CTX *ctx), + int (**pparamgen) (EVP_PKEY_CTX *ctx, + EVP_PKEY *pkey)); + +void EVP_PKEY_meth_get_keygen(const EVP_PKEY_METHOD *pmeth, + int (**pkeygen_init) (EVP_PKEY_CTX *ctx), + int (**pkeygen) (EVP_PKEY_CTX *ctx, + EVP_PKEY *pkey)); + +void EVP_PKEY_meth_get_sign(const EVP_PKEY_METHOD *pmeth, + int (**psign_init) (EVP_PKEY_CTX *ctx), + int (**psign) (EVP_PKEY_CTX *ctx, + unsigned char *sig, size_t *siglen, + const unsigned char *tbs, + size_t tbslen)); + +void EVP_PKEY_meth_get_verify(const EVP_PKEY_METHOD *pmeth, + int (**pverify_init) (EVP_PKEY_CTX *ctx), + int (**pverify) (EVP_PKEY_CTX *ctx, + const unsigned char *sig, + size_t siglen, + const unsigned char *tbs, + size_t tbslen)); + +void EVP_PKEY_meth_get_verify_recover(const EVP_PKEY_METHOD *pmeth, + int (**pverify_recover_init) (EVP_PKEY_CTX + *ctx), + int (**pverify_recover) (EVP_PKEY_CTX + *ctx, + unsigned char + *sig, + size_t *siglen, + const unsigned + char *tbs, + size_t tbslen)); + +void EVP_PKEY_meth_get_signctx(const EVP_PKEY_METHOD *pmeth, + int (**psignctx_init) (EVP_PKEY_CTX *ctx, + EVP_MD_CTX *mctx), + int (**psignctx) (EVP_PKEY_CTX *ctx, + unsigned char *sig, + size_t *siglen, + EVP_MD_CTX *mctx)); + +void EVP_PKEY_meth_get_verifyctx(const EVP_PKEY_METHOD *pmeth, + int (**pverifyctx_init) (EVP_PKEY_CTX *ctx, + EVP_MD_CTX *mctx), + int (**pverifyctx) (EVP_PKEY_CTX *ctx, + const unsigned char *sig, + int siglen, + EVP_MD_CTX *mctx)); + +void EVP_PKEY_meth_get_encrypt(const EVP_PKEY_METHOD *pmeth, + int (**pencrypt_init) (EVP_PKEY_CTX *ctx), + int (**pencryptfn) (EVP_PKEY_CTX *ctx, + unsigned char *out, + size_t *outlen, + const unsigned char *in, + size_t inlen)); + +void EVP_PKEY_meth_get_decrypt(const EVP_PKEY_METHOD *pmeth, + int (**pdecrypt_init) (EVP_PKEY_CTX *ctx), + int (**pdecrypt) (EVP_PKEY_CTX *ctx, + unsigned char *out, + size_t *outlen, + const unsigned char *in, + size_t inlen)); + +void EVP_PKEY_meth_get_derive(const EVP_PKEY_METHOD *pmeth, + int (**pderive_init) (EVP_PKEY_CTX *ctx), + int (**pderive) (EVP_PKEY_CTX *ctx, + unsigned char *key, + size_t *keylen)); + +void EVP_PKEY_meth_get_ctrl(const EVP_PKEY_METHOD *pmeth, + int (**pctrl) (EVP_PKEY_CTX *ctx, int type, int p1, + void *p2), + int (**pctrl_str) (EVP_PKEY_CTX *ctx, + const char *type, + const char *value)); + +void EVP_PKEY_meth_get_digestsign(EVP_PKEY_METHOD *pmeth, + int (**digestsign) (EVP_MD_CTX *ctx, + unsigned char *sig, + size_t *siglen, + const unsigned char *tbs, + size_t tbslen)); + +void EVP_PKEY_meth_get_digestverify(EVP_PKEY_METHOD *pmeth, + int (**digestverify) (EVP_MD_CTX *ctx, + const unsigned char *sig, + size_t siglen, + const unsigned char *tbs, + size_t tbslen)); + +void EVP_PKEY_meth_get_check(const EVP_PKEY_METHOD *pmeth, + int (**pcheck) (EVP_PKEY *pkey)); + +void EVP_PKEY_meth_get_public_check(const EVP_PKEY_METHOD *pmeth, + int (**pcheck) (EVP_PKEY *pkey)); + +void EVP_PKEY_meth_get_param_check(const EVP_PKEY_METHOD *pmeth, + int (**pcheck) (EVP_PKEY *pkey)); + +void EVP_PKEY_meth_get_digest_custom(EVP_PKEY_METHOD *pmeth, + int (**pdigest_custom) (EVP_PKEY_CTX *ctx, + EVP_MD_CTX *mctx)); +void EVP_add_alg_module(void); + + +# ifdef __cplusplus +} +# endif +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/evperr.h b/MediaClient/MediaClient/openssl/include/openssl/evperr.h new file mode 100644 index 0000000..d2b26ea --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/evperr.h @@ -0,0 +1,205 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_EVPERR_H +# define HEADER_EVPERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_EVP_strings(void); + +/* + * EVP function codes. + */ +# define EVP_F_AESNI_INIT_KEY 165 +# define EVP_F_AESNI_XTS_INIT_KEY 207 +# define EVP_F_AES_GCM_CTRL 196 +# define EVP_F_AES_INIT_KEY 133 +# define EVP_F_AES_OCB_CIPHER 169 +# define EVP_F_AES_T4_INIT_KEY 178 +# define EVP_F_AES_T4_XTS_INIT_KEY 208 +# define EVP_F_AES_WRAP_CIPHER 170 +# define EVP_F_AES_XTS_INIT_KEY 209 +# define EVP_F_ALG_MODULE_INIT 177 +# define EVP_F_ARIA_CCM_INIT_KEY 175 +# define EVP_F_ARIA_GCM_CTRL 197 +# define EVP_F_ARIA_GCM_INIT_KEY 176 +# define EVP_F_ARIA_INIT_KEY 185 +# define EVP_F_B64_NEW 198 +# define EVP_F_CAMELLIA_INIT_KEY 159 +# define EVP_F_CHACHA20_POLY1305_CTRL 182 +# define EVP_F_CMLL_T4_INIT_KEY 179 +# define EVP_F_DES_EDE3_WRAP_CIPHER 171 +# define EVP_F_DO_SIGVER_INIT 161 +# define EVP_F_ENC_NEW 199 +# define EVP_F_EVP_CIPHERINIT_EX 123 +# define EVP_F_EVP_CIPHER_ASN1_TO_PARAM 204 +# define EVP_F_EVP_CIPHER_CTX_COPY 163 +# define EVP_F_EVP_CIPHER_CTX_CTRL 124 +# define EVP_F_EVP_CIPHER_CTX_SET_KEY_LENGTH 122 +# define EVP_F_EVP_CIPHER_PARAM_TO_ASN1 205 +# define EVP_F_EVP_DECRYPTFINAL_EX 101 +# define EVP_F_EVP_DECRYPTUPDATE 166 +# define EVP_F_EVP_DIGESTFINALXOF 174 +# define EVP_F_EVP_DIGESTINIT_EX 128 +# define EVP_F_EVP_ENCRYPTDECRYPTUPDATE 219 +# define EVP_F_EVP_ENCRYPTFINAL_EX 127 +# define EVP_F_EVP_ENCRYPTUPDATE 167 +# define EVP_F_EVP_MD_CTX_COPY_EX 110 +# define EVP_F_EVP_MD_SIZE 162 +# define EVP_F_EVP_OPENINIT 102 +# define EVP_F_EVP_PBE_ALG_ADD 115 +# define EVP_F_EVP_PBE_ALG_ADD_TYPE 160 +# define EVP_F_EVP_PBE_CIPHERINIT 116 +# define EVP_F_EVP_PBE_SCRYPT 181 +# define EVP_F_EVP_PKCS82PKEY 111 +# define EVP_F_EVP_PKEY2PKCS8 113 +# define EVP_F_EVP_PKEY_ASN1_ADD0 188 +# define EVP_F_EVP_PKEY_CHECK 186 +# define EVP_F_EVP_PKEY_COPY_PARAMETERS 103 +# define EVP_F_EVP_PKEY_CTX_CTRL 137 +# define EVP_F_EVP_PKEY_CTX_CTRL_STR 150 +# define EVP_F_EVP_PKEY_CTX_DUP 156 +# define EVP_F_EVP_PKEY_CTX_MD 168 +# define EVP_F_EVP_PKEY_DECRYPT 104 +# define EVP_F_EVP_PKEY_DECRYPT_INIT 138 +# define EVP_F_EVP_PKEY_DECRYPT_OLD 151 +# define EVP_F_EVP_PKEY_DERIVE 153 +# define EVP_F_EVP_PKEY_DERIVE_INIT 154 +# define EVP_F_EVP_PKEY_DERIVE_SET_PEER 155 +# define EVP_F_EVP_PKEY_ENCRYPT 105 +# define EVP_F_EVP_PKEY_ENCRYPT_INIT 139 +# define EVP_F_EVP_PKEY_ENCRYPT_OLD 152 +# define EVP_F_EVP_PKEY_GET0_DH 119 +# define EVP_F_EVP_PKEY_GET0_DSA 120 +# define EVP_F_EVP_PKEY_GET0_EC_KEY 131 +# define EVP_F_EVP_PKEY_GET0_HMAC 183 +# define EVP_F_EVP_PKEY_GET0_POLY1305 184 +# define EVP_F_EVP_PKEY_GET0_RSA 121 +# define EVP_F_EVP_PKEY_GET0_SIPHASH 172 +# define EVP_F_EVP_PKEY_GET_RAW_PRIVATE_KEY 202 +# define EVP_F_EVP_PKEY_GET_RAW_PUBLIC_KEY 203 +# define EVP_F_EVP_PKEY_KEYGEN 146 +# define EVP_F_EVP_PKEY_KEYGEN_INIT 147 +# define EVP_F_EVP_PKEY_METH_ADD0 194 +# define EVP_F_EVP_PKEY_METH_NEW 195 +# define EVP_F_EVP_PKEY_NEW 106 +# define EVP_F_EVP_PKEY_NEW_CMAC_KEY 193 +# define EVP_F_EVP_PKEY_NEW_RAW_PRIVATE_KEY 191 +# define EVP_F_EVP_PKEY_NEW_RAW_PUBLIC_KEY 192 +# define EVP_F_EVP_PKEY_PARAMGEN 148 +# define EVP_F_EVP_PKEY_PARAMGEN_INIT 149 +# define EVP_F_EVP_PKEY_PARAM_CHECK 189 +# define EVP_F_EVP_PKEY_PUBLIC_CHECK 190 +# define EVP_F_EVP_PKEY_SET1_ENGINE 187 +# define EVP_F_EVP_PKEY_SET_ALIAS_TYPE 206 +# define EVP_F_EVP_PKEY_SIGN 140 +# define EVP_F_EVP_PKEY_SIGN_INIT 141 +# define EVP_F_EVP_PKEY_VERIFY 142 +# define EVP_F_EVP_PKEY_VERIFY_INIT 143 +# define EVP_F_EVP_PKEY_VERIFY_RECOVER 144 +# define EVP_F_EVP_PKEY_VERIFY_RECOVER_INIT 145 +# define EVP_F_EVP_SIGNFINAL 107 +# define EVP_F_EVP_VERIFYFINAL 108 +# define EVP_F_INT_CTX_NEW 157 +# define EVP_F_OK_NEW 200 +# define EVP_F_PKCS5_PBE_KEYIVGEN 117 +# define EVP_F_PKCS5_V2_PBE_KEYIVGEN 118 +# define EVP_F_PKCS5_V2_PBKDF2_KEYIVGEN 164 +# define EVP_F_PKCS5_V2_SCRYPT_KEYIVGEN 180 +# define EVP_F_PKEY_SET_TYPE 158 +# define EVP_F_RC2_MAGIC_TO_METH 109 +# define EVP_F_RC5_CTRL 125 +# define EVP_F_R_32_12_16_INIT_KEY 242 +# define EVP_F_S390X_AES_GCM_CTRL 201 +# define EVP_F_UPDATE 173 + +/* + * EVP reason codes. + */ +# define EVP_R_AES_KEY_SETUP_FAILED 143 +# define EVP_R_ARIA_KEY_SETUP_FAILED 176 +# define EVP_R_BAD_DECRYPT 100 +# define EVP_R_BAD_KEY_LENGTH 195 +# define EVP_R_BUFFER_TOO_SMALL 155 +# define EVP_R_CAMELLIA_KEY_SETUP_FAILED 157 +# define EVP_R_CIPHER_PARAMETER_ERROR 122 +# define EVP_R_COMMAND_NOT_SUPPORTED 147 +# define EVP_R_COPY_ERROR 173 +# define EVP_R_CTRL_NOT_IMPLEMENTED 132 +# define EVP_R_CTRL_OPERATION_NOT_IMPLEMENTED 133 +# define EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH 138 +# define EVP_R_DECODE_ERROR 114 +# define EVP_R_DIFFERENT_KEY_TYPES 101 +# define EVP_R_DIFFERENT_PARAMETERS 153 +# define EVP_R_ERROR_LOADING_SECTION 165 +# define EVP_R_ERROR_SETTING_FIPS_MODE 166 +# define EVP_R_EXPECTING_AN_HMAC_KEY 174 +# define EVP_R_EXPECTING_AN_RSA_KEY 127 +# define EVP_R_EXPECTING_A_DH_KEY 128 +# define EVP_R_EXPECTING_A_DSA_KEY 129 +# define EVP_R_EXPECTING_A_EC_KEY 142 +# define EVP_R_EXPECTING_A_POLY1305_KEY 164 +# define EVP_R_EXPECTING_A_SIPHASH_KEY 175 +# define EVP_R_FIPS_MODE_NOT_SUPPORTED 167 +# define EVP_R_GET_RAW_KEY_FAILED 182 +# define EVP_R_ILLEGAL_SCRYPT_PARAMETERS 171 +# define EVP_R_INITIALIZATION_ERROR 134 +# define EVP_R_INPUT_NOT_INITIALIZED 111 +# define EVP_R_INVALID_DIGEST 152 +# define EVP_R_INVALID_FIPS_MODE 168 +# define EVP_R_INVALID_IV_LENGTH 194 +# define EVP_R_INVALID_KEY 163 +# define EVP_R_INVALID_KEY_LENGTH 130 +# define EVP_R_INVALID_OPERATION 148 +# define EVP_R_KEYGEN_FAILURE 120 +# define EVP_R_KEY_SETUP_FAILED 180 +# define EVP_R_MEMORY_LIMIT_EXCEEDED 172 +# define EVP_R_MESSAGE_DIGEST_IS_NULL 159 +# define EVP_R_METHOD_NOT_SUPPORTED 144 +# define EVP_R_MISSING_PARAMETERS 103 +# define EVP_R_NOT_XOF_OR_INVALID_LENGTH 178 +# define EVP_R_NO_CIPHER_SET 131 +# define EVP_R_NO_DEFAULT_DIGEST 158 +# define EVP_R_NO_DIGEST_SET 139 +# define EVP_R_NO_KEY_SET 154 +# define EVP_R_NO_OPERATION_SET 149 +# define EVP_R_ONLY_ONESHOT_SUPPORTED 177 +# define EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE 150 +# define EVP_R_OPERATON_NOT_INITIALIZED 151 +# define EVP_R_PARTIALLY_OVERLAPPING 162 +# define EVP_R_PBKDF2_ERROR 181 +# define EVP_R_PKEY_APPLICATION_ASN1_METHOD_ALREADY_REGISTERED 179 +# define EVP_R_PRIVATE_KEY_DECODE_ERROR 145 +# define EVP_R_PRIVATE_KEY_ENCODE_ERROR 146 +# define EVP_R_PUBLIC_KEY_NOT_RSA 106 +# define EVP_R_UNKNOWN_CIPHER 160 +# define EVP_R_UNKNOWN_DIGEST 161 +# define EVP_R_UNKNOWN_OPTION 169 +# define EVP_R_UNKNOWN_PBE_ALGORITHM 121 +# define EVP_R_UNSUPPORTED_ALGORITHM 156 +# define EVP_R_UNSUPPORTED_CIPHER 107 +# define EVP_R_UNSUPPORTED_KEYLENGTH 123 +# define EVP_R_UNSUPPORTED_KEY_DERIVATION_FUNCTION 124 +# define EVP_R_UNSUPPORTED_KEY_SIZE 108 +# define EVP_R_UNSUPPORTED_NUMBER_OF_ROUNDS 135 +# define EVP_R_UNSUPPORTED_PRF 125 +# define EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM 118 +# define EVP_R_UNSUPPORTED_SALT_TYPE 126 +# define EVP_R_WRAP_MODE_NOT_ALLOWED 170 +# define EVP_R_WRONG_FINAL_BLOCK_LENGTH 109 +# define EVP_R_XTS_DUPLICATED_KEYS 183 + +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/hmac.h b/MediaClient/MediaClient/openssl/include/openssl/hmac.h new file mode 100644 index 0000000..458efc1 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/hmac.h @@ -0,0 +1,51 @@ +/* + * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_HMAC_H +# define HEADER_HMAC_H + +# include + +# include + +# if OPENSSL_API_COMPAT < 0x10200000L +# define HMAC_MAX_MD_CBLOCK 128 /* Deprecated */ +# endif + +#ifdef __cplusplus +extern "C" { +#endif + +size_t HMAC_size(const HMAC_CTX *e); +HMAC_CTX *HMAC_CTX_new(void); +int HMAC_CTX_reset(HMAC_CTX *ctx); +void HMAC_CTX_free(HMAC_CTX *ctx); + +DEPRECATEDIN_1_1_0(__owur int HMAC_Init(HMAC_CTX *ctx, const void *key, int len, + const EVP_MD *md)) + +/*__owur*/ int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, + const EVP_MD *md, ENGINE *impl); +/*__owur*/ int HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, + size_t len); +/*__owur*/ int HMAC_Final(HMAC_CTX *ctx, unsigned char *md, + unsigned int *len); +unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len, + const unsigned char *d, size_t n, unsigned char *md, + unsigned int *md_len); +__owur int HMAC_CTX_copy(HMAC_CTX *dctx, HMAC_CTX *sctx); + +void HMAC_CTX_set_flags(HMAC_CTX *ctx, unsigned long flags); +const EVP_MD *HMAC_CTX_get_md(const HMAC_CTX *ctx); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/idea.h b/MediaClient/MediaClient/openssl/include/openssl/idea.h new file mode 100644 index 0000000..4334f3e --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/idea.h @@ -0,0 +1,64 @@ +/* + * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_IDEA_H +# define HEADER_IDEA_H + +# include + +# ifndef OPENSSL_NO_IDEA +# ifdef __cplusplus +extern "C" { +# endif + +typedef unsigned int IDEA_INT; + +# define IDEA_ENCRYPT 1 +# define IDEA_DECRYPT 0 + +# define IDEA_BLOCK 8 +# define IDEA_KEY_LENGTH 16 + +typedef struct idea_key_st { + IDEA_INT data[9][6]; +} IDEA_KEY_SCHEDULE; + +const char *IDEA_options(void); +void IDEA_ecb_encrypt(const unsigned char *in, unsigned char *out, + IDEA_KEY_SCHEDULE *ks); +void IDEA_set_encrypt_key(const unsigned char *key, IDEA_KEY_SCHEDULE *ks); +void IDEA_set_decrypt_key(IDEA_KEY_SCHEDULE *ek, IDEA_KEY_SCHEDULE *dk); +void IDEA_cbc_encrypt(const unsigned char *in, unsigned char *out, + long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv, + int enc); +void IDEA_cfb64_encrypt(const unsigned char *in, unsigned char *out, + long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv, + int *num, int enc); +void IDEA_ofb64_encrypt(const unsigned char *in, unsigned char *out, + long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv, + int *num); +void IDEA_encrypt(unsigned long *in, IDEA_KEY_SCHEDULE *ks); + +# if OPENSSL_API_COMPAT < 0x10100000L +# define idea_options IDEA_options +# define idea_ecb_encrypt IDEA_ecb_encrypt +# define idea_set_encrypt_key IDEA_set_encrypt_key +# define idea_set_decrypt_key IDEA_set_decrypt_key +# define idea_cbc_encrypt IDEA_cbc_encrypt +# define idea_cfb64_encrypt IDEA_cfb64_encrypt +# define idea_ofb64_encrypt IDEA_ofb64_encrypt +# define idea_encrypt IDEA_encrypt +# endif + +# ifdef __cplusplus +} +# endif +# endif + +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/kdf.h b/MediaClient/MediaClient/openssl/include/openssl/kdf.h new file mode 100644 index 0000000..5abd4c3 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/kdf.h @@ -0,0 +1,97 @@ +/* + * Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_KDF_H +# define HEADER_KDF_H + +# include +#ifdef __cplusplus +extern "C" { +#endif + +# define EVP_PKEY_CTRL_TLS_MD (EVP_PKEY_ALG_CTRL) +# define EVP_PKEY_CTRL_TLS_SECRET (EVP_PKEY_ALG_CTRL + 1) +# define EVP_PKEY_CTRL_TLS_SEED (EVP_PKEY_ALG_CTRL + 2) +# define EVP_PKEY_CTRL_HKDF_MD (EVP_PKEY_ALG_CTRL + 3) +# define EVP_PKEY_CTRL_HKDF_SALT (EVP_PKEY_ALG_CTRL + 4) +# define EVP_PKEY_CTRL_HKDF_KEY (EVP_PKEY_ALG_CTRL + 5) +# define EVP_PKEY_CTRL_HKDF_INFO (EVP_PKEY_ALG_CTRL + 6) +# define EVP_PKEY_CTRL_HKDF_MODE (EVP_PKEY_ALG_CTRL + 7) +# define EVP_PKEY_CTRL_PASS (EVP_PKEY_ALG_CTRL + 8) +# define EVP_PKEY_CTRL_SCRYPT_SALT (EVP_PKEY_ALG_CTRL + 9) +# define EVP_PKEY_CTRL_SCRYPT_N (EVP_PKEY_ALG_CTRL + 10) +# define EVP_PKEY_CTRL_SCRYPT_R (EVP_PKEY_ALG_CTRL + 11) +# define EVP_PKEY_CTRL_SCRYPT_P (EVP_PKEY_ALG_CTRL + 12) +# define EVP_PKEY_CTRL_SCRYPT_MAXMEM_BYTES (EVP_PKEY_ALG_CTRL + 13) + +# define EVP_PKEY_HKDEF_MODE_EXTRACT_AND_EXPAND 0 +# define EVP_PKEY_HKDEF_MODE_EXTRACT_ONLY 1 +# define EVP_PKEY_HKDEF_MODE_EXPAND_ONLY 2 + +# define EVP_PKEY_CTX_set_tls1_prf_md(pctx, md) \ + EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_TLS_MD, 0, (void *)(md)) + +# define EVP_PKEY_CTX_set1_tls1_prf_secret(pctx, sec, seclen) \ + EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_TLS_SECRET, seclen, (void *)(sec)) + +# define EVP_PKEY_CTX_add1_tls1_prf_seed(pctx, seed, seedlen) \ + EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_TLS_SEED, seedlen, (void *)(seed)) + +# define EVP_PKEY_CTX_set_hkdf_md(pctx, md) \ + EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_HKDF_MD, 0, (void *)(md)) + +# define EVP_PKEY_CTX_set1_hkdf_salt(pctx, salt, saltlen) \ + EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_HKDF_SALT, saltlen, (void *)(salt)) + +# define EVP_PKEY_CTX_set1_hkdf_key(pctx, key, keylen) \ + EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_HKDF_KEY, keylen, (void *)(key)) + +# define EVP_PKEY_CTX_add1_hkdf_info(pctx, info, infolen) \ + EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_HKDF_INFO, infolen, (void *)(info)) + +# define EVP_PKEY_CTX_hkdf_mode(pctx, mode) \ + EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_HKDF_MODE, mode, NULL) + +# define EVP_PKEY_CTX_set1_pbe_pass(pctx, pass, passlen) \ + EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_PASS, passlen, (void *)(pass)) + +# define EVP_PKEY_CTX_set1_scrypt_salt(pctx, salt, saltlen) \ + EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_SCRYPT_SALT, saltlen, (void *)(salt)) + +# define EVP_PKEY_CTX_set_scrypt_N(pctx, n) \ + EVP_PKEY_CTX_ctrl_uint64(pctx, -1, EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_SCRYPT_N, n) + +# define EVP_PKEY_CTX_set_scrypt_r(pctx, r) \ + EVP_PKEY_CTX_ctrl_uint64(pctx, -1, EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_SCRYPT_R, r) + +# define EVP_PKEY_CTX_set_scrypt_p(pctx, p) \ + EVP_PKEY_CTX_ctrl_uint64(pctx, -1, EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_SCRYPT_P, p) + +# define EVP_PKEY_CTX_set_scrypt_maxmem_bytes(pctx, maxmem_bytes) \ + EVP_PKEY_CTX_ctrl_uint64(pctx, -1, EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_SCRYPT_MAXMEM_BYTES, maxmem_bytes) + + +# ifdef __cplusplus +} +# endif +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/kdferr.h b/MediaClient/MediaClient/openssl/include/openssl/kdferr.h new file mode 100644 index 0000000..3f51bd0 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/kdferr.h @@ -0,0 +1,55 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_KDFERR_H +# define HEADER_KDFERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_KDF_strings(void); + +/* + * KDF function codes. + */ +# define KDF_F_PKEY_HKDF_CTRL_STR 103 +# define KDF_F_PKEY_HKDF_DERIVE 102 +# define KDF_F_PKEY_HKDF_INIT 108 +# define KDF_F_PKEY_SCRYPT_CTRL_STR 104 +# define KDF_F_PKEY_SCRYPT_CTRL_UINT64 105 +# define KDF_F_PKEY_SCRYPT_DERIVE 109 +# define KDF_F_PKEY_SCRYPT_INIT 106 +# define KDF_F_PKEY_SCRYPT_SET_MEMBUF 107 +# define KDF_F_PKEY_TLS1_PRF_CTRL_STR 100 +# define KDF_F_PKEY_TLS1_PRF_DERIVE 101 +# define KDF_F_PKEY_TLS1_PRF_INIT 110 +# define KDF_F_TLS1_PRF_ALG 111 + +/* + * KDF reason codes. + */ +# define KDF_R_INVALID_DIGEST 100 +# define KDF_R_MISSING_ITERATION_COUNT 109 +# define KDF_R_MISSING_KEY 104 +# define KDF_R_MISSING_MESSAGE_DIGEST 105 +# define KDF_R_MISSING_PARAMETER 101 +# define KDF_R_MISSING_PASS 110 +# define KDF_R_MISSING_SALT 111 +# define KDF_R_MISSING_SECRET 107 +# define KDF_R_MISSING_SEED 106 +# define KDF_R_UNKNOWN_PARAMETER_TYPE 103 +# define KDF_R_VALUE_ERROR 108 +# define KDF_R_VALUE_MISSING 102 + +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/lhash.h b/MediaClient/MediaClient/openssl/include/openssl/lhash.h new file mode 100644 index 0000000..2e42d72 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/lhash.h @@ -0,0 +1,241 @@ +/* + * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +/* + * Header for dynamic hash table routines Author - Eric Young + */ + +#ifndef HEADER_LHASH_H +# define HEADER_LHASH_H + +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct lhash_node_st OPENSSL_LH_NODE; +typedef int (*OPENSSL_LH_COMPFUNC) (const void *, const void *); +typedef unsigned long (*OPENSSL_LH_HASHFUNC) (const void *); +typedef void (*OPENSSL_LH_DOALL_FUNC) (void *); +typedef void (*OPENSSL_LH_DOALL_FUNCARG) (void *, void *); +typedef struct lhash_st OPENSSL_LHASH; + +/* + * Macros for declaring and implementing type-safe wrappers for LHASH + * callbacks. This way, callbacks can be provided to LHASH structures without + * function pointer casting and the macro-defined callbacks provide + * per-variable casting before deferring to the underlying type-specific + * callbacks. NB: It is possible to place a "static" in front of both the + * DECLARE and IMPLEMENT macros if the functions are strictly internal. + */ + +/* First: "hash" functions */ +# define DECLARE_LHASH_HASH_FN(name, o_type) \ + unsigned long name##_LHASH_HASH(const void *); +# define IMPLEMENT_LHASH_HASH_FN(name, o_type) \ + unsigned long name##_LHASH_HASH(const void *arg) { \ + const o_type *a = arg; \ + return name##_hash(a); } +# define LHASH_HASH_FN(name) name##_LHASH_HASH + +/* Second: "compare" functions */ +# define DECLARE_LHASH_COMP_FN(name, o_type) \ + int name##_LHASH_COMP(const void *, const void *); +# define IMPLEMENT_LHASH_COMP_FN(name, o_type) \ + int name##_LHASH_COMP(const void *arg1, const void *arg2) { \ + const o_type *a = arg1; \ + const o_type *b = arg2; \ + return name##_cmp(a,b); } +# define LHASH_COMP_FN(name) name##_LHASH_COMP + +/* Fourth: "doall_arg" functions */ +# define DECLARE_LHASH_DOALL_ARG_FN(name, o_type, a_type) \ + void name##_LHASH_DOALL_ARG(void *, void *); +# define IMPLEMENT_LHASH_DOALL_ARG_FN(name, o_type, a_type) \ + void name##_LHASH_DOALL_ARG(void *arg1, void *arg2) { \ + o_type *a = arg1; \ + a_type *b = arg2; \ + name##_doall_arg(a, b); } +# define LHASH_DOALL_ARG_FN(name) name##_LHASH_DOALL_ARG + + +# define LH_LOAD_MULT 256 + +int OPENSSL_LH_error(OPENSSL_LHASH *lh); +OPENSSL_LHASH *OPENSSL_LH_new(OPENSSL_LH_HASHFUNC h, OPENSSL_LH_COMPFUNC c); +void OPENSSL_LH_free(OPENSSL_LHASH *lh); +void *OPENSSL_LH_insert(OPENSSL_LHASH *lh, void *data); +void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data); +void *OPENSSL_LH_retrieve(OPENSSL_LHASH *lh, const void *data); +void OPENSSL_LH_doall(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNC func); +void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg); +unsigned long OPENSSL_LH_strhash(const char *c); +unsigned long OPENSSL_LH_num_items(const OPENSSL_LHASH *lh); +unsigned long OPENSSL_LH_get_down_load(const OPENSSL_LHASH *lh); +void OPENSSL_LH_set_down_load(OPENSSL_LHASH *lh, unsigned long down_load); + +# ifndef OPENSSL_NO_STDIO +void OPENSSL_LH_stats(const OPENSSL_LHASH *lh, FILE *fp); +void OPENSSL_LH_node_stats(const OPENSSL_LHASH *lh, FILE *fp); +void OPENSSL_LH_node_usage_stats(const OPENSSL_LHASH *lh, FILE *fp); +# endif +void OPENSSL_LH_stats_bio(const OPENSSL_LHASH *lh, BIO *out); +void OPENSSL_LH_node_stats_bio(const OPENSSL_LHASH *lh, BIO *out); +void OPENSSL_LH_node_usage_stats_bio(const OPENSSL_LHASH *lh, BIO *out); + +# if OPENSSL_API_COMPAT < 0x10100000L +# define _LHASH OPENSSL_LHASH +# define LHASH_NODE OPENSSL_LH_NODE +# define lh_error OPENSSL_LH_error +# define lh_new OPENSSL_LH_new +# define lh_free OPENSSL_LH_free +# define lh_insert OPENSSL_LH_insert +# define lh_delete OPENSSL_LH_delete +# define lh_retrieve OPENSSL_LH_retrieve +# define lh_doall OPENSSL_LH_doall +# define lh_doall_arg OPENSSL_LH_doall_arg +# define lh_strhash OPENSSL_LH_strhash +# define lh_num_items OPENSSL_LH_num_items +# ifndef OPENSSL_NO_STDIO +# define lh_stats OPENSSL_LH_stats +# define lh_node_stats OPENSSL_LH_node_stats +# define lh_node_usage_stats OPENSSL_LH_node_usage_stats +# endif +# define lh_stats_bio OPENSSL_LH_stats_bio +# define lh_node_stats_bio OPENSSL_LH_node_stats_bio +# define lh_node_usage_stats_bio OPENSSL_LH_node_usage_stats_bio +# endif + +/* Type checking... */ + +# define LHASH_OF(type) struct lhash_st_##type + +# define DEFINE_LHASH_OF(type) \ + LHASH_OF(type) { union lh_##type##_dummy { void* d1; unsigned long d2; int d3; } dummy; }; \ + static ossl_unused ossl_inline LHASH_OF(type) *lh_##type##_new(unsigned long (*hfn)(const type *), \ + int (*cfn)(const type *, const type *)) \ + { \ + return (LHASH_OF(type) *) \ + OPENSSL_LH_new((OPENSSL_LH_HASHFUNC)hfn, (OPENSSL_LH_COMPFUNC)cfn); \ + } \ + static ossl_unused ossl_inline void lh_##type##_free(LHASH_OF(type) *lh) \ + { \ + OPENSSL_LH_free((OPENSSL_LHASH *)lh); \ + } \ + static ossl_unused ossl_inline type *lh_##type##_insert(LHASH_OF(type) *lh, type *d) \ + { \ + return (type *)OPENSSL_LH_insert((OPENSSL_LHASH *)lh, d); \ + } \ + static ossl_unused ossl_inline type *lh_##type##_delete(LHASH_OF(type) *lh, const type *d) \ + { \ + return (type *)OPENSSL_LH_delete((OPENSSL_LHASH *)lh, d); \ + } \ + static ossl_unused ossl_inline type *lh_##type##_retrieve(LHASH_OF(type) *lh, const type *d) \ + { \ + return (type *)OPENSSL_LH_retrieve((OPENSSL_LHASH *)lh, d); \ + } \ + static ossl_unused ossl_inline int lh_##type##_error(LHASH_OF(type) *lh) \ + { \ + return OPENSSL_LH_error((OPENSSL_LHASH *)lh); \ + } \ + static ossl_unused ossl_inline unsigned long lh_##type##_num_items(LHASH_OF(type) *lh) \ + { \ + return OPENSSL_LH_num_items((OPENSSL_LHASH *)lh); \ + } \ + static ossl_unused ossl_inline void lh_##type##_node_stats_bio(const LHASH_OF(type) *lh, BIO *out) \ + { \ + OPENSSL_LH_node_stats_bio((const OPENSSL_LHASH *)lh, out); \ + } \ + static ossl_unused ossl_inline void lh_##type##_node_usage_stats_bio(const LHASH_OF(type) *lh, BIO *out) \ + { \ + OPENSSL_LH_node_usage_stats_bio((const OPENSSL_LHASH *)lh, out); \ + } \ + static ossl_unused ossl_inline void lh_##type##_stats_bio(const LHASH_OF(type) *lh, BIO *out) \ + { \ + OPENSSL_LH_stats_bio((const OPENSSL_LHASH *)lh, out); \ + } \ + static ossl_unused ossl_inline unsigned long lh_##type##_get_down_load(LHASH_OF(type) *lh) \ + { \ + return OPENSSL_LH_get_down_load((OPENSSL_LHASH *)lh); \ + } \ + static ossl_unused ossl_inline void lh_##type##_set_down_load(LHASH_OF(type) *lh, unsigned long dl) \ + { \ + OPENSSL_LH_set_down_load((OPENSSL_LHASH *)lh, dl); \ + } \ + static ossl_unused ossl_inline void lh_##type##_doall(LHASH_OF(type) *lh, \ + void (*doall)(type *)) \ + { \ + OPENSSL_LH_doall((OPENSSL_LHASH *)lh, (OPENSSL_LH_DOALL_FUNC)doall); \ + } \ + LHASH_OF(type) + +#define IMPLEMENT_LHASH_DOALL_ARG_CONST(type, argtype) \ + int_implement_lhash_doall(type, argtype, const type) + +#define IMPLEMENT_LHASH_DOALL_ARG(type, argtype) \ + int_implement_lhash_doall(type, argtype, type) + +#define int_implement_lhash_doall(type, argtype, cbargtype) \ + static ossl_unused ossl_inline void \ + lh_##type##_doall_##argtype(LHASH_OF(type) *lh, \ + void (*fn)(cbargtype *, argtype *), \ + argtype *arg) \ + { \ + OPENSSL_LH_doall_arg((OPENSSL_LHASH *)lh, (OPENSSL_LH_DOALL_FUNCARG)fn, (void *)arg); \ + } \ + LHASH_OF(type) + +DEFINE_LHASH_OF(OPENSSL_STRING); +# ifdef _MSC_VER +/* + * push and pop this warning: + * warning C4090: 'function': different 'const' qualifiers + */ +# pragma warning (push) +# pragma warning (disable: 4090) +# endif + +DEFINE_LHASH_OF(OPENSSL_CSTRING); + +# ifdef _MSC_VER +# pragma warning (pop) +# endif + +/* + * If called without higher optimization (min. -xO3) the Oracle Developer + * Studio compiler generates code for the defined (static inline) functions + * above. + * This would later lead to the linker complaining about missing symbols when + * this header file is included but the resulting object is not linked against + * the Crypto library (openssl#6912). + */ +# ifdef __SUNPRO_C +# pragma weak OPENSSL_LH_new +# pragma weak OPENSSL_LH_free +# pragma weak OPENSSL_LH_insert +# pragma weak OPENSSL_LH_delete +# pragma weak OPENSSL_LH_retrieve +# pragma weak OPENSSL_LH_error +# pragma weak OPENSSL_LH_num_items +# pragma weak OPENSSL_LH_node_stats_bio +# pragma weak OPENSSL_LH_node_usage_stats_bio +# pragma weak OPENSSL_LH_stats_bio +# pragma weak OPENSSL_LH_get_down_load +# pragma weak OPENSSL_LH_set_down_load +# pragma weak OPENSSL_LH_doall +# pragma weak OPENSSL_LH_doall_arg +# endif /* __SUNPRO_C */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/md2.h b/MediaClient/MediaClient/openssl/include/openssl/md2.h new file mode 100644 index 0000000..7faf8e3 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/md2.h @@ -0,0 +1,44 @@ +/* + * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_MD2_H +# define HEADER_MD2_H + +# include + +# ifndef OPENSSL_NO_MD2 +# include +# ifdef __cplusplus +extern "C" { +# endif + +typedef unsigned char MD2_INT; + +# define MD2_DIGEST_LENGTH 16 +# define MD2_BLOCK 16 + +typedef struct MD2state_st { + unsigned int num; + unsigned char data[MD2_BLOCK]; + MD2_INT cksm[MD2_BLOCK]; + MD2_INT state[MD2_BLOCK]; +} MD2_CTX; + +const char *MD2_options(void); +int MD2_Init(MD2_CTX *c); +int MD2_Update(MD2_CTX *c, const unsigned char *data, size_t len); +int MD2_Final(unsigned char *md, MD2_CTX *c); +unsigned char *MD2(const unsigned char *d, size_t n, unsigned char *md); + +# ifdef __cplusplus +} +# endif +# endif + +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/md4.h b/MediaClient/MediaClient/openssl/include/openssl/md4.h new file mode 100644 index 0000000..940e29d --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/md4.h @@ -0,0 +1,51 @@ +/* + * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_MD4_H +# define HEADER_MD4_H + +# include + +# ifndef OPENSSL_NO_MD4 +# include +# include +# ifdef __cplusplus +extern "C" { +# endif + +/*- + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * ! MD4_LONG has to be at least 32 bits wide. ! + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + */ +# define MD4_LONG unsigned int + +# define MD4_CBLOCK 64 +# define MD4_LBLOCK (MD4_CBLOCK/4) +# define MD4_DIGEST_LENGTH 16 + +typedef struct MD4state_st { + MD4_LONG A, B, C, D; + MD4_LONG Nl, Nh; + MD4_LONG data[MD4_LBLOCK]; + unsigned int num; +} MD4_CTX; + +int MD4_Init(MD4_CTX *c); +int MD4_Update(MD4_CTX *c, const void *data, size_t len); +int MD4_Final(unsigned char *md, MD4_CTX *c); +unsigned char *MD4(const unsigned char *d, size_t n, unsigned char *md); +void MD4_Transform(MD4_CTX *c, const unsigned char *b); + +# ifdef __cplusplus +} +# endif +# endif + +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/md5.h b/MediaClient/MediaClient/openssl/include/openssl/md5.h new file mode 100644 index 0000000..2deb772 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/md5.h @@ -0,0 +1,50 @@ +/* + * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_MD5_H +# define HEADER_MD5_H + +# include + +# ifndef OPENSSL_NO_MD5 +# include +# include +# ifdef __cplusplus +extern "C" { +# endif + +/* + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * ! MD5_LONG has to be at least 32 bits wide. ! + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + */ +# define MD5_LONG unsigned int + +# define MD5_CBLOCK 64 +# define MD5_LBLOCK (MD5_CBLOCK/4) +# define MD5_DIGEST_LENGTH 16 + +typedef struct MD5state_st { + MD5_LONG A, B, C, D; + MD5_LONG Nl, Nh; + MD5_LONG data[MD5_LBLOCK]; + unsigned int num; +} MD5_CTX; + +int MD5_Init(MD5_CTX *c); +int MD5_Update(MD5_CTX *c, const void *data, size_t len); +int MD5_Final(unsigned char *md, MD5_CTX *c); +unsigned char *MD5(const unsigned char *d, size_t n, unsigned char *md); +void MD5_Transform(MD5_CTX *c, const unsigned char *b); +# ifdef __cplusplus +} +# endif +# endif + +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/mdc2.h b/MediaClient/MediaClient/openssl/include/openssl/mdc2.h new file mode 100644 index 0000000..aabd2bf --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/mdc2.h @@ -0,0 +1,42 @@ +/* + * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_MDC2_H +# define HEADER_MDC2_H + +# include + +#ifndef OPENSSL_NO_MDC2 +# include +# include +# ifdef __cplusplus +extern "C" { +# endif + +# define MDC2_BLOCK 8 +# define MDC2_DIGEST_LENGTH 16 + +typedef struct mdc2_ctx_st { + unsigned int num; + unsigned char data[MDC2_BLOCK]; + DES_cblock h, hh; + int pad_type; /* either 1 or 2, default 1 */ +} MDC2_CTX; + +int MDC2_Init(MDC2_CTX *c); +int MDC2_Update(MDC2_CTX *c, const unsigned char *data, size_t len); +int MDC2_Final(unsigned char *md, MDC2_CTX *c); +unsigned char *MDC2(const unsigned char *d, size_t n, unsigned char *md); + +# ifdef __cplusplus +} +# endif +# endif + +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/modes.h b/MediaClient/MediaClient/openssl/include/openssl/modes.h new file mode 100644 index 0000000..d544f98 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/modes.h @@ -0,0 +1,208 @@ +/* + * Copyright 2008-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_MODES_H +# define HEADER_MODES_H + +# include + +# ifdef __cplusplus +extern "C" { +# endif +typedef void (*block128_f) (const unsigned char in[16], + unsigned char out[16], const void *key); + +typedef void (*cbc128_f) (const unsigned char *in, unsigned char *out, + size_t len, const void *key, + unsigned char ivec[16], int enc); + +typedef void (*ctr128_f) (const unsigned char *in, unsigned char *out, + size_t blocks, const void *key, + const unsigned char ivec[16]); + +typedef void (*ccm128_f) (const unsigned char *in, unsigned char *out, + size_t blocks, const void *key, + const unsigned char ivec[16], + unsigned char cmac[16]); + +void CRYPTO_cbc128_encrypt(const unsigned char *in, unsigned char *out, + size_t len, const void *key, + unsigned char ivec[16], block128_f block); +void CRYPTO_cbc128_decrypt(const unsigned char *in, unsigned char *out, + size_t len, const void *key, + unsigned char ivec[16], block128_f block); + +void CRYPTO_ctr128_encrypt(const unsigned char *in, unsigned char *out, + size_t len, const void *key, + unsigned char ivec[16], + unsigned char ecount_buf[16], unsigned int *num, + block128_f block); + +void CRYPTO_ctr128_encrypt_ctr32(const unsigned char *in, unsigned char *out, + size_t len, const void *key, + unsigned char ivec[16], + unsigned char ecount_buf[16], + unsigned int *num, ctr128_f ctr); + +void CRYPTO_ofb128_encrypt(const unsigned char *in, unsigned char *out, + size_t len, const void *key, + unsigned char ivec[16], int *num, + block128_f block); + +void CRYPTO_cfb128_encrypt(const unsigned char *in, unsigned char *out, + size_t len, const void *key, + unsigned char ivec[16], int *num, + int enc, block128_f block); +void CRYPTO_cfb128_8_encrypt(const unsigned char *in, unsigned char *out, + size_t length, const void *key, + unsigned char ivec[16], int *num, + int enc, block128_f block); +void CRYPTO_cfb128_1_encrypt(const unsigned char *in, unsigned char *out, + size_t bits, const void *key, + unsigned char ivec[16], int *num, + int enc, block128_f block); + +size_t CRYPTO_cts128_encrypt_block(const unsigned char *in, + unsigned char *out, size_t len, + const void *key, unsigned char ivec[16], + block128_f block); +size_t CRYPTO_cts128_encrypt(const unsigned char *in, unsigned char *out, + size_t len, const void *key, + unsigned char ivec[16], cbc128_f cbc); +size_t CRYPTO_cts128_decrypt_block(const unsigned char *in, + unsigned char *out, size_t len, + const void *key, unsigned char ivec[16], + block128_f block); +size_t CRYPTO_cts128_decrypt(const unsigned char *in, unsigned char *out, + size_t len, const void *key, + unsigned char ivec[16], cbc128_f cbc); + +size_t CRYPTO_nistcts128_encrypt_block(const unsigned char *in, + unsigned char *out, size_t len, + const void *key, + unsigned char ivec[16], + block128_f block); +size_t CRYPTO_nistcts128_encrypt(const unsigned char *in, unsigned char *out, + size_t len, const void *key, + unsigned char ivec[16], cbc128_f cbc); +size_t CRYPTO_nistcts128_decrypt_block(const unsigned char *in, + unsigned char *out, size_t len, + const void *key, + unsigned char ivec[16], + block128_f block); +size_t CRYPTO_nistcts128_decrypt(const unsigned char *in, unsigned char *out, + size_t len, const void *key, + unsigned char ivec[16], cbc128_f cbc); + +typedef struct gcm128_context GCM128_CONTEXT; + +GCM128_CONTEXT *CRYPTO_gcm128_new(void *key, block128_f block); +void CRYPTO_gcm128_init(GCM128_CONTEXT *ctx, void *key, block128_f block); +void CRYPTO_gcm128_setiv(GCM128_CONTEXT *ctx, const unsigned char *iv, + size_t len); +int CRYPTO_gcm128_aad(GCM128_CONTEXT *ctx, const unsigned char *aad, + size_t len); +int CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx, + const unsigned char *in, unsigned char *out, + size_t len); +int CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx, + const unsigned char *in, unsigned char *out, + size_t len); +int CRYPTO_gcm128_encrypt_ctr32(GCM128_CONTEXT *ctx, + const unsigned char *in, unsigned char *out, + size_t len, ctr128_f stream); +int CRYPTO_gcm128_decrypt_ctr32(GCM128_CONTEXT *ctx, + const unsigned char *in, unsigned char *out, + size_t len, ctr128_f stream); +int CRYPTO_gcm128_finish(GCM128_CONTEXT *ctx, const unsigned char *tag, + size_t len); +void CRYPTO_gcm128_tag(GCM128_CONTEXT *ctx, unsigned char *tag, size_t len); +void CRYPTO_gcm128_release(GCM128_CONTEXT *ctx); + +typedef struct ccm128_context CCM128_CONTEXT; + +void CRYPTO_ccm128_init(CCM128_CONTEXT *ctx, + unsigned int M, unsigned int L, void *key, + block128_f block); +int CRYPTO_ccm128_setiv(CCM128_CONTEXT *ctx, const unsigned char *nonce, + size_t nlen, size_t mlen); +void CRYPTO_ccm128_aad(CCM128_CONTEXT *ctx, const unsigned char *aad, + size_t alen); +int CRYPTO_ccm128_encrypt(CCM128_CONTEXT *ctx, const unsigned char *inp, + unsigned char *out, size_t len); +int CRYPTO_ccm128_decrypt(CCM128_CONTEXT *ctx, const unsigned char *inp, + unsigned char *out, size_t len); +int CRYPTO_ccm128_encrypt_ccm64(CCM128_CONTEXT *ctx, const unsigned char *inp, + unsigned char *out, size_t len, + ccm128_f stream); +int CRYPTO_ccm128_decrypt_ccm64(CCM128_CONTEXT *ctx, const unsigned char *inp, + unsigned char *out, size_t len, + ccm128_f stream); +size_t CRYPTO_ccm128_tag(CCM128_CONTEXT *ctx, unsigned char *tag, size_t len); + +typedef struct xts128_context XTS128_CONTEXT; + +int CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx, + const unsigned char iv[16], + const unsigned char *inp, unsigned char *out, + size_t len, int enc); + +size_t CRYPTO_128_wrap(void *key, const unsigned char *iv, + unsigned char *out, + const unsigned char *in, size_t inlen, + block128_f block); + +size_t CRYPTO_128_unwrap(void *key, const unsigned char *iv, + unsigned char *out, + const unsigned char *in, size_t inlen, + block128_f block); +size_t CRYPTO_128_wrap_pad(void *key, const unsigned char *icv, + unsigned char *out, const unsigned char *in, + size_t inlen, block128_f block); +size_t CRYPTO_128_unwrap_pad(void *key, const unsigned char *icv, + unsigned char *out, const unsigned char *in, + size_t inlen, block128_f block); + +# ifndef OPENSSL_NO_OCB +typedef struct ocb128_context OCB128_CONTEXT; + +typedef void (*ocb128_f) (const unsigned char *in, unsigned char *out, + size_t blocks, const void *key, + size_t start_block_num, + unsigned char offset_i[16], + const unsigned char L_[][16], + unsigned char checksum[16]); + +OCB128_CONTEXT *CRYPTO_ocb128_new(void *keyenc, void *keydec, + block128_f encrypt, block128_f decrypt, + ocb128_f stream); +int CRYPTO_ocb128_init(OCB128_CONTEXT *ctx, void *keyenc, void *keydec, + block128_f encrypt, block128_f decrypt, + ocb128_f stream); +int CRYPTO_ocb128_copy_ctx(OCB128_CONTEXT *dest, OCB128_CONTEXT *src, + void *keyenc, void *keydec); +int CRYPTO_ocb128_setiv(OCB128_CONTEXT *ctx, const unsigned char *iv, + size_t len, size_t taglen); +int CRYPTO_ocb128_aad(OCB128_CONTEXT *ctx, const unsigned char *aad, + size_t len); +int CRYPTO_ocb128_encrypt(OCB128_CONTEXT *ctx, const unsigned char *in, + unsigned char *out, size_t len); +int CRYPTO_ocb128_decrypt(OCB128_CONTEXT *ctx, const unsigned char *in, + unsigned char *out, size_t len); +int CRYPTO_ocb128_finish(OCB128_CONTEXT *ctx, const unsigned char *tag, + size_t len); +int CRYPTO_ocb128_tag(OCB128_CONTEXT *ctx, unsigned char *tag, size_t len); +void CRYPTO_ocb128_cleanup(OCB128_CONTEXT *ctx); +# endif /* OPENSSL_NO_OCB */ + +# ifdef __cplusplus +} +# endif + +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/obj_mac.h b/MediaClient/MediaClient/openssl/include/openssl/obj_mac.h new file mode 100644 index 0000000..483fc05 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/obj_mac.h @@ -0,0 +1,5198 @@ +/* + * WARNING: do not edit! + * Generated by crypto/objects/objects.pl + * + * Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved. + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#define SN_undef "UNDEF" +#define LN_undef "undefined" +#define NID_undef 0 +#define OBJ_undef 0L + +#define SN_itu_t "ITU-T" +#define LN_itu_t "itu-t" +#define NID_itu_t 645 +#define OBJ_itu_t 0L + +#define NID_ccitt 404 +#define OBJ_ccitt OBJ_itu_t + +#define SN_iso "ISO" +#define LN_iso "iso" +#define NID_iso 181 +#define OBJ_iso 1L + +#define SN_joint_iso_itu_t "JOINT-ISO-ITU-T" +#define LN_joint_iso_itu_t "joint-iso-itu-t" +#define NID_joint_iso_itu_t 646 +#define OBJ_joint_iso_itu_t 2L + +#define NID_joint_iso_ccitt 393 +#define OBJ_joint_iso_ccitt OBJ_joint_iso_itu_t + +#define SN_member_body "member-body" +#define LN_member_body "ISO Member Body" +#define NID_member_body 182 +#define OBJ_member_body OBJ_iso,2L + +#define SN_identified_organization "identified-organization" +#define NID_identified_organization 676 +#define OBJ_identified_organization OBJ_iso,3L + +#define SN_hmac_md5 "HMAC-MD5" +#define LN_hmac_md5 "hmac-md5" +#define NID_hmac_md5 780 +#define OBJ_hmac_md5 OBJ_identified_organization,6L,1L,5L,5L,8L,1L,1L + +#define SN_hmac_sha1 "HMAC-SHA1" +#define LN_hmac_sha1 "hmac-sha1" +#define NID_hmac_sha1 781 +#define OBJ_hmac_sha1 OBJ_identified_organization,6L,1L,5L,5L,8L,1L,2L + +#define SN_x509ExtAdmission "x509ExtAdmission" +#define LN_x509ExtAdmission "Professional Information or basis for Admission" +#define NID_x509ExtAdmission 1093 +#define OBJ_x509ExtAdmission OBJ_identified_organization,36L,8L,3L,3L + +#define SN_certicom_arc "certicom-arc" +#define NID_certicom_arc 677 +#define OBJ_certicom_arc OBJ_identified_organization,132L + +#define SN_ieee "ieee" +#define NID_ieee 1170 +#define OBJ_ieee OBJ_identified_organization,111L + +#define SN_ieee_siswg "ieee-siswg" +#define LN_ieee_siswg "IEEE Security in Storage Working Group" +#define NID_ieee_siswg 1171 +#define OBJ_ieee_siswg OBJ_ieee,2L,1619L + +#define SN_international_organizations "international-organizations" +#define LN_international_organizations "International Organizations" +#define NID_international_organizations 647 +#define OBJ_international_organizations OBJ_joint_iso_itu_t,23L + +#define SN_wap "wap" +#define NID_wap 678 +#define OBJ_wap OBJ_international_organizations,43L + +#define SN_wap_wsg "wap-wsg" +#define NID_wap_wsg 679 +#define OBJ_wap_wsg OBJ_wap,1L + +#define SN_selected_attribute_types "selected-attribute-types" +#define LN_selected_attribute_types "Selected Attribute Types" +#define NID_selected_attribute_types 394 +#define OBJ_selected_attribute_types OBJ_joint_iso_itu_t,5L,1L,5L + +#define SN_clearance "clearance" +#define NID_clearance 395 +#define OBJ_clearance OBJ_selected_attribute_types,55L + +#define SN_ISO_US "ISO-US" +#define LN_ISO_US "ISO US Member Body" +#define NID_ISO_US 183 +#define OBJ_ISO_US OBJ_member_body,840L + +#define SN_X9_57 "X9-57" +#define LN_X9_57 "X9.57" +#define NID_X9_57 184 +#define OBJ_X9_57 OBJ_ISO_US,10040L + +#define SN_X9cm "X9cm" +#define LN_X9cm "X9.57 CM ?" +#define NID_X9cm 185 +#define OBJ_X9cm OBJ_X9_57,4L + +#define SN_ISO_CN "ISO-CN" +#define LN_ISO_CN "ISO CN Member Body" +#define NID_ISO_CN 1140 +#define OBJ_ISO_CN OBJ_member_body,156L + +#define SN_oscca "oscca" +#define NID_oscca 1141 +#define OBJ_oscca OBJ_ISO_CN,10197L + +#define SN_sm_scheme "sm-scheme" +#define NID_sm_scheme 1142 +#define OBJ_sm_scheme OBJ_oscca,1L + +#define SN_dsa "DSA" +#define LN_dsa "dsaEncryption" +#define NID_dsa 116 +#define OBJ_dsa OBJ_X9cm,1L + +#define SN_dsaWithSHA1 "DSA-SHA1" +#define LN_dsaWithSHA1 "dsaWithSHA1" +#define NID_dsaWithSHA1 113 +#define OBJ_dsaWithSHA1 OBJ_X9cm,3L + +#define SN_ansi_X9_62 "ansi-X9-62" +#define LN_ansi_X9_62 "ANSI X9.62" +#define NID_ansi_X9_62 405 +#define OBJ_ansi_X9_62 OBJ_ISO_US,10045L + +#define OBJ_X9_62_id_fieldType OBJ_ansi_X9_62,1L + +#define SN_X9_62_prime_field "prime-field" +#define NID_X9_62_prime_field 406 +#define OBJ_X9_62_prime_field OBJ_X9_62_id_fieldType,1L + +#define SN_X9_62_characteristic_two_field "characteristic-two-field" +#define NID_X9_62_characteristic_two_field 407 +#define OBJ_X9_62_characteristic_two_field OBJ_X9_62_id_fieldType,2L + +#define SN_X9_62_id_characteristic_two_basis "id-characteristic-two-basis" +#define NID_X9_62_id_characteristic_two_basis 680 +#define OBJ_X9_62_id_characteristic_two_basis OBJ_X9_62_characteristic_two_field,3L + +#define SN_X9_62_onBasis "onBasis" +#define NID_X9_62_onBasis 681 +#define OBJ_X9_62_onBasis OBJ_X9_62_id_characteristic_two_basis,1L + +#define SN_X9_62_tpBasis "tpBasis" +#define NID_X9_62_tpBasis 682 +#define OBJ_X9_62_tpBasis OBJ_X9_62_id_characteristic_two_basis,2L + +#define SN_X9_62_ppBasis "ppBasis" +#define NID_X9_62_ppBasis 683 +#define OBJ_X9_62_ppBasis OBJ_X9_62_id_characteristic_two_basis,3L + +#define OBJ_X9_62_id_publicKeyType OBJ_ansi_X9_62,2L + +#define SN_X9_62_id_ecPublicKey "id-ecPublicKey" +#define NID_X9_62_id_ecPublicKey 408 +#define OBJ_X9_62_id_ecPublicKey OBJ_X9_62_id_publicKeyType,1L + +#define OBJ_X9_62_ellipticCurve OBJ_ansi_X9_62,3L + +#define OBJ_X9_62_c_TwoCurve OBJ_X9_62_ellipticCurve,0L + +#define SN_X9_62_c2pnb163v1 "c2pnb163v1" +#define NID_X9_62_c2pnb163v1 684 +#define OBJ_X9_62_c2pnb163v1 OBJ_X9_62_c_TwoCurve,1L + +#define SN_X9_62_c2pnb163v2 "c2pnb163v2" +#define NID_X9_62_c2pnb163v2 685 +#define OBJ_X9_62_c2pnb163v2 OBJ_X9_62_c_TwoCurve,2L + +#define SN_X9_62_c2pnb163v3 "c2pnb163v3" +#define NID_X9_62_c2pnb163v3 686 +#define OBJ_X9_62_c2pnb163v3 OBJ_X9_62_c_TwoCurve,3L + +#define SN_X9_62_c2pnb176v1 "c2pnb176v1" +#define NID_X9_62_c2pnb176v1 687 +#define OBJ_X9_62_c2pnb176v1 OBJ_X9_62_c_TwoCurve,4L + +#define SN_X9_62_c2tnb191v1 "c2tnb191v1" +#define NID_X9_62_c2tnb191v1 688 +#define OBJ_X9_62_c2tnb191v1 OBJ_X9_62_c_TwoCurve,5L + +#define SN_X9_62_c2tnb191v2 "c2tnb191v2" +#define NID_X9_62_c2tnb191v2 689 +#define OBJ_X9_62_c2tnb191v2 OBJ_X9_62_c_TwoCurve,6L + +#define SN_X9_62_c2tnb191v3 "c2tnb191v3" +#define NID_X9_62_c2tnb191v3 690 +#define OBJ_X9_62_c2tnb191v3 OBJ_X9_62_c_TwoCurve,7L + +#define SN_X9_62_c2onb191v4 "c2onb191v4" +#define NID_X9_62_c2onb191v4 691 +#define OBJ_X9_62_c2onb191v4 OBJ_X9_62_c_TwoCurve,8L + +#define SN_X9_62_c2onb191v5 "c2onb191v5" +#define NID_X9_62_c2onb191v5 692 +#define OBJ_X9_62_c2onb191v5 OBJ_X9_62_c_TwoCurve,9L + +#define SN_X9_62_c2pnb208w1 "c2pnb208w1" +#define NID_X9_62_c2pnb208w1 693 +#define OBJ_X9_62_c2pnb208w1 OBJ_X9_62_c_TwoCurve,10L + +#define SN_X9_62_c2tnb239v1 "c2tnb239v1" +#define NID_X9_62_c2tnb239v1 694 +#define OBJ_X9_62_c2tnb239v1 OBJ_X9_62_c_TwoCurve,11L + +#define SN_X9_62_c2tnb239v2 "c2tnb239v2" +#define NID_X9_62_c2tnb239v2 695 +#define OBJ_X9_62_c2tnb239v2 OBJ_X9_62_c_TwoCurve,12L + +#define SN_X9_62_c2tnb239v3 "c2tnb239v3" +#define NID_X9_62_c2tnb239v3 696 +#define OBJ_X9_62_c2tnb239v3 OBJ_X9_62_c_TwoCurve,13L + +#define SN_X9_62_c2onb239v4 "c2onb239v4" +#define NID_X9_62_c2onb239v4 697 +#define OBJ_X9_62_c2onb239v4 OBJ_X9_62_c_TwoCurve,14L + +#define SN_X9_62_c2onb239v5 "c2onb239v5" +#define NID_X9_62_c2onb239v5 698 +#define OBJ_X9_62_c2onb239v5 OBJ_X9_62_c_TwoCurve,15L + +#define SN_X9_62_c2pnb272w1 "c2pnb272w1" +#define NID_X9_62_c2pnb272w1 699 +#define OBJ_X9_62_c2pnb272w1 OBJ_X9_62_c_TwoCurve,16L + +#define SN_X9_62_c2pnb304w1 "c2pnb304w1" +#define NID_X9_62_c2pnb304w1 700 +#define OBJ_X9_62_c2pnb304w1 OBJ_X9_62_c_TwoCurve,17L + +#define SN_X9_62_c2tnb359v1 "c2tnb359v1" +#define NID_X9_62_c2tnb359v1 701 +#define OBJ_X9_62_c2tnb359v1 OBJ_X9_62_c_TwoCurve,18L + +#define SN_X9_62_c2pnb368w1 "c2pnb368w1" +#define NID_X9_62_c2pnb368w1 702 +#define OBJ_X9_62_c2pnb368w1 OBJ_X9_62_c_TwoCurve,19L + +#define SN_X9_62_c2tnb431r1 "c2tnb431r1" +#define NID_X9_62_c2tnb431r1 703 +#define OBJ_X9_62_c2tnb431r1 OBJ_X9_62_c_TwoCurve,20L + +#define OBJ_X9_62_primeCurve OBJ_X9_62_ellipticCurve,1L + +#define SN_X9_62_prime192v1 "prime192v1" +#define NID_X9_62_prime192v1 409 +#define OBJ_X9_62_prime192v1 OBJ_X9_62_primeCurve,1L + +#define SN_X9_62_prime192v2 "prime192v2" +#define NID_X9_62_prime192v2 410 +#define OBJ_X9_62_prime192v2 OBJ_X9_62_primeCurve,2L + +#define SN_X9_62_prime192v3 "prime192v3" +#define NID_X9_62_prime192v3 411 +#define OBJ_X9_62_prime192v3 OBJ_X9_62_primeCurve,3L + +#define SN_X9_62_prime239v1 "prime239v1" +#define NID_X9_62_prime239v1 412 +#define OBJ_X9_62_prime239v1 OBJ_X9_62_primeCurve,4L + +#define SN_X9_62_prime239v2 "prime239v2" +#define NID_X9_62_prime239v2 413 +#define OBJ_X9_62_prime239v2 OBJ_X9_62_primeCurve,5L + +#define SN_X9_62_prime239v3 "prime239v3" +#define NID_X9_62_prime239v3 414 +#define OBJ_X9_62_prime239v3 OBJ_X9_62_primeCurve,6L + +#define SN_X9_62_prime256v1 "prime256v1" +#define NID_X9_62_prime256v1 415 +#define OBJ_X9_62_prime256v1 OBJ_X9_62_primeCurve,7L + +#define OBJ_X9_62_id_ecSigType OBJ_ansi_X9_62,4L + +#define SN_ecdsa_with_SHA1 "ecdsa-with-SHA1" +#define NID_ecdsa_with_SHA1 416 +#define OBJ_ecdsa_with_SHA1 OBJ_X9_62_id_ecSigType,1L + +#define SN_ecdsa_with_Recommended "ecdsa-with-Recommended" +#define NID_ecdsa_with_Recommended 791 +#define OBJ_ecdsa_with_Recommended OBJ_X9_62_id_ecSigType,2L + +#define SN_ecdsa_with_Specified "ecdsa-with-Specified" +#define NID_ecdsa_with_Specified 792 +#define OBJ_ecdsa_with_Specified OBJ_X9_62_id_ecSigType,3L + +#define SN_ecdsa_with_SHA224 "ecdsa-with-SHA224" +#define NID_ecdsa_with_SHA224 793 +#define OBJ_ecdsa_with_SHA224 OBJ_ecdsa_with_Specified,1L + +#define SN_ecdsa_with_SHA256 "ecdsa-with-SHA256" +#define NID_ecdsa_with_SHA256 794 +#define OBJ_ecdsa_with_SHA256 OBJ_ecdsa_with_Specified,2L + +#define SN_ecdsa_with_SHA384 "ecdsa-with-SHA384" +#define NID_ecdsa_with_SHA384 795 +#define OBJ_ecdsa_with_SHA384 OBJ_ecdsa_with_Specified,3L + +#define SN_ecdsa_with_SHA512 "ecdsa-with-SHA512" +#define NID_ecdsa_with_SHA512 796 +#define OBJ_ecdsa_with_SHA512 OBJ_ecdsa_with_Specified,4L + +#define OBJ_secg_ellipticCurve OBJ_certicom_arc,0L + +#define SN_secp112r1 "secp112r1" +#define NID_secp112r1 704 +#define OBJ_secp112r1 OBJ_secg_ellipticCurve,6L + +#define SN_secp112r2 "secp112r2" +#define NID_secp112r2 705 +#define OBJ_secp112r2 OBJ_secg_ellipticCurve,7L + +#define SN_secp128r1 "secp128r1" +#define NID_secp128r1 706 +#define OBJ_secp128r1 OBJ_secg_ellipticCurve,28L + +#define SN_secp128r2 "secp128r2" +#define NID_secp128r2 707 +#define OBJ_secp128r2 OBJ_secg_ellipticCurve,29L + +#define SN_secp160k1 "secp160k1" +#define NID_secp160k1 708 +#define OBJ_secp160k1 OBJ_secg_ellipticCurve,9L + +#define SN_secp160r1 "secp160r1" +#define NID_secp160r1 709 +#define OBJ_secp160r1 OBJ_secg_ellipticCurve,8L + +#define SN_secp160r2 "secp160r2" +#define NID_secp160r2 710 +#define OBJ_secp160r2 OBJ_secg_ellipticCurve,30L + +#define SN_secp192k1 "secp192k1" +#define NID_secp192k1 711 +#define OBJ_secp192k1 OBJ_secg_ellipticCurve,31L + +#define SN_secp224k1 "secp224k1" +#define NID_secp224k1 712 +#define OBJ_secp224k1 OBJ_secg_ellipticCurve,32L + +#define SN_secp224r1 "secp224r1" +#define NID_secp224r1 713 +#define OBJ_secp224r1 OBJ_secg_ellipticCurve,33L + +#define SN_secp256k1 "secp256k1" +#define NID_secp256k1 714 +#define OBJ_secp256k1 OBJ_secg_ellipticCurve,10L + +#define SN_secp384r1 "secp384r1" +#define NID_secp384r1 715 +#define OBJ_secp384r1 OBJ_secg_ellipticCurve,34L + +#define SN_secp521r1 "secp521r1" +#define NID_secp521r1 716 +#define OBJ_secp521r1 OBJ_secg_ellipticCurve,35L + +#define SN_sect113r1 "sect113r1" +#define NID_sect113r1 717 +#define OBJ_sect113r1 OBJ_secg_ellipticCurve,4L + +#define SN_sect113r2 "sect113r2" +#define NID_sect113r2 718 +#define OBJ_sect113r2 OBJ_secg_ellipticCurve,5L + +#define SN_sect131r1 "sect131r1" +#define NID_sect131r1 719 +#define OBJ_sect131r1 OBJ_secg_ellipticCurve,22L + +#define SN_sect131r2 "sect131r2" +#define NID_sect131r2 720 +#define OBJ_sect131r2 OBJ_secg_ellipticCurve,23L + +#define SN_sect163k1 "sect163k1" +#define NID_sect163k1 721 +#define OBJ_sect163k1 OBJ_secg_ellipticCurve,1L + +#define SN_sect163r1 "sect163r1" +#define NID_sect163r1 722 +#define OBJ_sect163r1 OBJ_secg_ellipticCurve,2L + +#define SN_sect163r2 "sect163r2" +#define NID_sect163r2 723 +#define OBJ_sect163r2 OBJ_secg_ellipticCurve,15L + +#define SN_sect193r1 "sect193r1" +#define NID_sect193r1 724 +#define OBJ_sect193r1 OBJ_secg_ellipticCurve,24L + +#define SN_sect193r2 "sect193r2" +#define NID_sect193r2 725 +#define OBJ_sect193r2 OBJ_secg_ellipticCurve,25L + +#define SN_sect233k1 "sect233k1" +#define NID_sect233k1 726 +#define OBJ_sect233k1 OBJ_secg_ellipticCurve,26L + +#define SN_sect233r1 "sect233r1" +#define NID_sect233r1 727 +#define OBJ_sect233r1 OBJ_secg_ellipticCurve,27L + +#define SN_sect239k1 "sect239k1" +#define NID_sect239k1 728 +#define OBJ_sect239k1 OBJ_secg_ellipticCurve,3L + +#define SN_sect283k1 "sect283k1" +#define NID_sect283k1 729 +#define OBJ_sect283k1 OBJ_secg_ellipticCurve,16L + +#define SN_sect283r1 "sect283r1" +#define NID_sect283r1 730 +#define OBJ_sect283r1 OBJ_secg_ellipticCurve,17L + +#define SN_sect409k1 "sect409k1" +#define NID_sect409k1 731 +#define OBJ_sect409k1 OBJ_secg_ellipticCurve,36L + +#define SN_sect409r1 "sect409r1" +#define NID_sect409r1 732 +#define OBJ_sect409r1 OBJ_secg_ellipticCurve,37L + +#define SN_sect571k1 "sect571k1" +#define NID_sect571k1 733 +#define OBJ_sect571k1 OBJ_secg_ellipticCurve,38L + +#define SN_sect571r1 "sect571r1" +#define NID_sect571r1 734 +#define OBJ_sect571r1 OBJ_secg_ellipticCurve,39L + +#define OBJ_wap_wsg_idm_ecid OBJ_wap_wsg,4L + +#define SN_wap_wsg_idm_ecid_wtls1 "wap-wsg-idm-ecid-wtls1" +#define NID_wap_wsg_idm_ecid_wtls1 735 +#define OBJ_wap_wsg_idm_ecid_wtls1 OBJ_wap_wsg_idm_ecid,1L + +#define SN_wap_wsg_idm_ecid_wtls3 "wap-wsg-idm-ecid-wtls3" +#define NID_wap_wsg_idm_ecid_wtls3 736 +#define OBJ_wap_wsg_idm_ecid_wtls3 OBJ_wap_wsg_idm_ecid,3L + +#define SN_wap_wsg_idm_ecid_wtls4 "wap-wsg-idm-ecid-wtls4" +#define NID_wap_wsg_idm_ecid_wtls4 737 +#define OBJ_wap_wsg_idm_ecid_wtls4 OBJ_wap_wsg_idm_ecid,4L + +#define SN_wap_wsg_idm_ecid_wtls5 "wap-wsg-idm-ecid-wtls5" +#define NID_wap_wsg_idm_ecid_wtls5 738 +#define OBJ_wap_wsg_idm_ecid_wtls5 OBJ_wap_wsg_idm_ecid,5L + +#define SN_wap_wsg_idm_ecid_wtls6 "wap-wsg-idm-ecid-wtls6" +#define NID_wap_wsg_idm_ecid_wtls6 739 +#define OBJ_wap_wsg_idm_ecid_wtls6 OBJ_wap_wsg_idm_ecid,6L + +#define SN_wap_wsg_idm_ecid_wtls7 "wap-wsg-idm-ecid-wtls7" +#define NID_wap_wsg_idm_ecid_wtls7 740 +#define OBJ_wap_wsg_idm_ecid_wtls7 OBJ_wap_wsg_idm_ecid,7L + +#define SN_wap_wsg_idm_ecid_wtls8 "wap-wsg-idm-ecid-wtls8" +#define NID_wap_wsg_idm_ecid_wtls8 741 +#define OBJ_wap_wsg_idm_ecid_wtls8 OBJ_wap_wsg_idm_ecid,8L + +#define SN_wap_wsg_idm_ecid_wtls9 "wap-wsg-idm-ecid-wtls9" +#define NID_wap_wsg_idm_ecid_wtls9 742 +#define OBJ_wap_wsg_idm_ecid_wtls9 OBJ_wap_wsg_idm_ecid,9L + +#define SN_wap_wsg_idm_ecid_wtls10 "wap-wsg-idm-ecid-wtls10" +#define NID_wap_wsg_idm_ecid_wtls10 743 +#define OBJ_wap_wsg_idm_ecid_wtls10 OBJ_wap_wsg_idm_ecid,10L + +#define SN_wap_wsg_idm_ecid_wtls11 "wap-wsg-idm-ecid-wtls11" +#define NID_wap_wsg_idm_ecid_wtls11 744 +#define OBJ_wap_wsg_idm_ecid_wtls11 OBJ_wap_wsg_idm_ecid,11L + +#define SN_wap_wsg_idm_ecid_wtls12 "wap-wsg-idm-ecid-wtls12" +#define NID_wap_wsg_idm_ecid_wtls12 745 +#define OBJ_wap_wsg_idm_ecid_wtls12 OBJ_wap_wsg_idm_ecid,12L + +#define SN_cast5_cbc "CAST5-CBC" +#define LN_cast5_cbc "cast5-cbc" +#define NID_cast5_cbc 108 +#define OBJ_cast5_cbc OBJ_ISO_US,113533L,7L,66L,10L + +#define SN_cast5_ecb "CAST5-ECB" +#define LN_cast5_ecb "cast5-ecb" +#define NID_cast5_ecb 109 + +#define SN_cast5_cfb64 "CAST5-CFB" +#define LN_cast5_cfb64 "cast5-cfb" +#define NID_cast5_cfb64 110 + +#define SN_cast5_ofb64 "CAST5-OFB" +#define LN_cast5_ofb64 "cast5-ofb" +#define NID_cast5_ofb64 111 + +#define LN_pbeWithMD5AndCast5_CBC "pbeWithMD5AndCast5CBC" +#define NID_pbeWithMD5AndCast5_CBC 112 +#define OBJ_pbeWithMD5AndCast5_CBC OBJ_ISO_US,113533L,7L,66L,12L + +#define SN_id_PasswordBasedMAC "id-PasswordBasedMAC" +#define LN_id_PasswordBasedMAC "password based MAC" +#define NID_id_PasswordBasedMAC 782 +#define OBJ_id_PasswordBasedMAC OBJ_ISO_US,113533L,7L,66L,13L + +#define SN_id_DHBasedMac "id-DHBasedMac" +#define LN_id_DHBasedMac "Diffie-Hellman based MAC" +#define NID_id_DHBasedMac 783 +#define OBJ_id_DHBasedMac OBJ_ISO_US,113533L,7L,66L,30L + +#define SN_rsadsi "rsadsi" +#define LN_rsadsi "RSA Data Security, Inc." +#define NID_rsadsi 1 +#define OBJ_rsadsi OBJ_ISO_US,113549L + +#define SN_pkcs "pkcs" +#define LN_pkcs "RSA Data Security, Inc. PKCS" +#define NID_pkcs 2 +#define OBJ_pkcs OBJ_rsadsi,1L + +#define SN_pkcs1 "pkcs1" +#define NID_pkcs1 186 +#define OBJ_pkcs1 OBJ_pkcs,1L + +#define LN_rsaEncryption "rsaEncryption" +#define NID_rsaEncryption 6 +#define OBJ_rsaEncryption OBJ_pkcs1,1L + +#define SN_md2WithRSAEncryption "RSA-MD2" +#define LN_md2WithRSAEncryption "md2WithRSAEncryption" +#define NID_md2WithRSAEncryption 7 +#define OBJ_md2WithRSAEncryption OBJ_pkcs1,2L + +#define SN_md4WithRSAEncryption "RSA-MD4" +#define LN_md4WithRSAEncryption "md4WithRSAEncryption" +#define NID_md4WithRSAEncryption 396 +#define OBJ_md4WithRSAEncryption OBJ_pkcs1,3L + +#define SN_md5WithRSAEncryption "RSA-MD5" +#define LN_md5WithRSAEncryption "md5WithRSAEncryption" +#define NID_md5WithRSAEncryption 8 +#define OBJ_md5WithRSAEncryption OBJ_pkcs1,4L + +#define SN_sha1WithRSAEncryption "RSA-SHA1" +#define LN_sha1WithRSAEncryption "sha1WithRSAEncryption" +#define NID_sha1WithRSAEncryption 65 +#define OBJ_sha1WithRSAEncryption OBJ_pkcs1,5L + +#define SN_rsaesOaep "RSAES-OAEP" +#define LN_rsaesOaep "rsaesOaep" +#define NID_rsaesOaep 919 +#define OBJ_rsaesOaep OBJ_pkcs1,7L + +#define SN_mgf1 "MGF1" +#define LN_mgf1 "mgf1" +#define NID_mgf1 911 +#define OBJ_mgf1 OBJ_pkcs1,8L + +#define SN_pSpecified "PSPECIFIED" +#define LN_pSpecified "pSpecified" +#define NID_pSpecified 935 +#define OBJ_pSpecified OBJ_pkcs1,9L + +#define SN_rsassaPss "RSASSA-PSS" +#define LN_rsassaPss "rsassaPss" +#define NID_rsassaPss 912 +#define OBJ_rsassaPss OBJ_pkcs1,10L + +#define SN_sha256WithRSAEncryption "RSA-SHA256" +#define LN_sha256WithRSAEncryption "sha256WithRSAEncryption" +#define NID_sha256WithRSAEncryption 668 +#define OBJ_sha256WithRSAEncryption OBJ_pkcs1,11L + +#define SN_sha384WithRSAEncryption "RSA-SHA384" +#define LN_sha384WithRSAEncryption "sha384WithRSAEncryption" +#define NID_sha384WithRSAEncryption 669 +#define OBJ_sha384WithRSAEncryption OBJ_pkcs1,12L + +#define SN_sha512WithRSAEncryption "RSA-SHA512" +#define LN_sha512WithRSAEncryption "sha512WithRSAEncryption" +#define NID_sha512WithRSAEncryption 670 +#define OBJ_sha512WithRSAEncryption OBJ_pkcs1,13L + +#define SN_sha224WithRSAEncryption "RSA-SHA224" +#define LN_sha224WithRSAEncryption "sha224WithRSAEncryption" +#define NID_sha224WithRSAEncryption 671 +#define OBJ_sha224WithRSAEncryption OBJ_pkcs1,14L + +#define SN_sha512_224WithRSAEncryption "RSA-SHA512/224" +#define LN_sha512_224WithRSAEncryption "sha512-224WithRSAEncryption" +#define NID_sha512_224WithRSAEncryption 1145 +#define OBJ_sha512_224WithRSAEncryption OBJ_pkcs1,15L + +#define SN_sha512_256WithRSAEncryption "RSA-SHA512/256" +#define LN_sha512_256WithRSAEncryption "sha512-256WithRSAEncryption" +#define NID_sha512_256WithRSAEncryption 1146 +#define OBJ_sha512_256WithRSAEncryption OBJ_pkcs1,16L + +#define SN_pkcs3 "pkcs3" +#define NID_pkcs3 27 +#define OBJ_pkcs3 OBJ_pkcs,3L + +#define LN_dhKeyAgreement "dhKeyAgreement" +#define NID_dhKeyAgreement 28 +#define OBJ_dhKeyAgreement OBJ_pkcs3,1L + +#define SN_pkcs5 "pkcs5" +#define NID_pkcs5 187 +#define OBJ_pkcs5 OBJ_pkcs,5L + +#define SN_pbeWithMD2AndDES_CBC "PBE-MD2-DES" +#define LN_pbeWithMD2AndDES_CBC "pbeWithMD2AndDES-CBC" +#define NID_pbeWithMD2AndDES_CBC 9 +#define OBJ_pbeWithMD2AndDES_CBC OBJ_pkcs5,1L + +#define SN_pbeWithMD5AndDES_CBC "PBE-MD5-DES" +#define LN_pbeWithMD5AndDES_CBC "pbeWithMD5AndDES-CBC" +#define NID_pbeWithMD5AndDES_CBC 10 +#define OBJ_pbeWithMD5AndDES_CBC OBJ_pkcs5,3L + +#define SN_pbeWithMD2AndRC2_CBC "PBE-MD2-RC2-64" +#define LN_pbeWithMD2AndRC2_CBC "pbeWithMD2AndRC2-CBC" +#define NID_pbeWithMD2AndRC2_CBC 168 +#define OBJ_pbeWithMD2AndRC2_CBC OBJ_pkcs5,4L + +#define SN_pbeWithMD5AndRC2_CBC "PBE-MD5-RC2-64" +#define LN_pbeWithMD5AndRC2_CBC "pbeWithMD5AndRC2-CBC" +#define NID_pbeWithMD5AndRC2_CBC 169 +#define OBJ_pbeWithMD5AndRC2_CBC OBJ_pkcs5,6L + +#define SN_pbeWithSHA1AndDES_CBC "PBE-SHA1-DES" +#define LN_pbeWithSHA1AndDES_CBC "pbeWithSHA1AndDES-CBC" +#define NID_pbeWithSHA1AndDES_CBC 170 +#define OBJ_pbeWithSHA1AndDES_CBC OBJ_pkcs5,10L + +#define SN_pbeWithSHA1AndRC2_CBC "PBE-SHA1-RC2-64" +#define LN_pbeWithSHA1AndRC2_CBC "pbeWithSHA1AndRC2-CBC" +#define NID_pbeWithSHA1AndRC2_CBC 68 +#define OBJ_pbeWithSHA1AndRC2_CBC OBJ_pkcs5,11L + +#define LN_id_pbkdf2 "PBKDF2" +#define NID_id_pbkdf2 69 +#define OBJ_id_pbkdf2 OBJ_pkcs5,12L + +#define LN_pbes2 "PBES2" +#define NID_pbes2 161 +#define OBJ_pbes2 OBJ_pkcs5,13L + +#define LN_pbmac1 "PBMAC1" +#define NID_pbmac1 162 +#define OBJ_pbmac1 OBJ_pkcs5,14L + +#define SN_pkcs7 "pkcs7" +#define NID_pkcs7 20 +#define OBJ_pkcs7 OBJ_pkcs,7L + +#define LN_pkcs7_data "pkcs7-data" +#define NID_pkcs7_data 21 +#define OBJ_pkcs7_data OBJ_pkcs7,1L + +#define LN_pkcs7_signed "pkcs7-signedData" +#define NID_pkcs7_signed 22 +#define OBJ_pkcs7_signed OBJ_pkcs7,2L + +#define LN_pkcs7_enveloped "pkcs7-envelopedData" +#define NID_pkcs7_enveloped 23 +#define OBJ_pkcs7_enveloped OBJ_pkcs7,3L + +#define LN_pkcs7_signedAndEnveloped "pkcs7-signedAndEnvelopedData" +#define NID_pkcs7_signedAndEnveloped 24 +#define OBJ_pkcs7_signedAndEnveloped OBJ_pkcs7,4L + +#define LN_pkcs7_digest "pkcs7-digestData" +#define NID_pkcs7_digest 25 +#define OBJ_pkcs7_digest OBJ_pkcs7,5L + +#define LN_pkcs7_encrypted "pkcs7-encryptedData" +#define NID_pkcs7_encrypted 26 +#define OBJ_pkcs7_encrypted OBJ_pkcs7,6L + +#define SN_pkcs9 "pkcs9" +#define NID_pkcs9 47 +#define OBJ_pkcs9 OBJ_pkcs,9L + +#define LN_pkcs9_emailAddress "emailAddress" +#define NID_pkcs9_emailAddress 48 +#define OBJ_pkcs9_emailAddress OBJ_pkcs9,1L + +#define LN_pkcs9_unstructuredName "unstructuredName" +#define NID_pkcs9_unstructuredName 49 +#define OBJ_pkcs9_unstructuredName OBJ_pkcs9,2L + +#define LN_pkcs9_contentType "contentType" +#define NID_pkcs9_contentType 50 +#define OBJ_pkcs9_contentType OBJ_pkcs9,3L + +#define LN_pkcs9_messageDigest "messageDigest" +#define NID_pkcs9_messageDigest 51 +#define OBJ_pkcs9_messageDigest OBJ_pkcs9,4L + +#define LN_pkcs9_signingTime "signingTime" +#define NID_pkcs9_signingTime 52 +#define OBJ_pkcs9_signingTime OBJ_pkcs9,5L + +#define LN_pkcs9_countersignature "countersignature" +#define NID_pkcs9_countersignature 53 +#define OBJ_pkcs9_countersignature OBJ_pkcs9,6L + +#define LN_pkcs9_challengePassword "challengePassword" +#define NID_pkcs9_challengePassword 54 +#define OBJ_pkcs9_challengePassword OBJ_pkcs9,7L + +#define LN_pkcs9_unstructuredAddress "unstructuredAddress" +#define NID_pkcs9_unstructuredAddress 55 +#define OBJ_pkcs9_unstructuredAddress OBJ_pkcs9,8L + +#define LN_pkcs9_extCertAttributes "extendedCertificateAttributes" +#define NID_pkcs9_extCertAttributes 56 +#define OBJ_pkcs9_extCertAttributes OBJ_pkcs9,9L + +#define SN_ext_req "extReq" +#define LN_ext_req "Extension Request" +#define NID_ext_req 172 +#define OBJ_ext_req OBJ_pkcs9,14L + +#define SN_SMIMECapabilities "SMIME-CAPS" +#define LN_SMIMECapabilities "S/MIME Capabilities" +#define NID_SMIMECapabilities 167 +#define OBJ_SMIMECapabilities OBJ_pkcs9,15L + +#define SN_SMIME "SMIME" +#define LN_SMIME "S/MIME" +#define NID_SMIME 188 +#define OBJ_SMIME OBJ_pkcs9,16L + +#define SN_id_smime_mod "id-smime-mod" +#define NID_id_smime_mod 189 +#define OBJ_id_smime_mod OBJ_SMIME,0L + +#define SN_id_smime_ct "id-smime-ct" +#define NID_id_smime_ct 190 +#define OBJ_id_smime_ct OBJ_SMIME,1L + +#define SN_id_smime_aa "id-smime-aa" +#define NID_id_smime_aa 191 +#define OBJ_id_smime_aa OBJ_SMIME,2L + +#define SN_id_smime_alg "id-smime-alg" +#define NID_id_smime_alg 192 +#define OBJ_id_smime_alg OBJ_SMIME,3L + +#define SN_id_smime_cd "id-smime-cd" +#define NID_id_smime_cd 193 +#define OBJ_id_smime_cd OBJ_SMIME,4L + +#define SN_id_smime_spq "id-smime-spq" +#define NID_id_smime_spq 194 +#define OBJ_id_smime_spq OBJ_SMIME,5L + +#define SN_id_smime_cti "id-smime-cti" +#define NID_id_smime_cti 195 +#define OBJ_id_smime_cti OBJ_SMIME,6L + +#define SN_id_smime_mod_cms "id-smime-mod-cms" +#define NID_id_smime_mod_cms 196 +#define OBJ_id_smime_mod_cms OBJ_id_smime_mod,1L + +#define SN_id_smime_mod_ess "id-smime-mod-ess" +#define NID_id_smime_mod_ess 197 +#define OBJ_id_smime_mod_ess OBJ_id_smime_mod,2L + +#define SN_id_smime_mod_oid "id-smime-mod-oid" +#define NID_id_smime_mod_oid 198 +#define OBJ_id_smime_mod_oid OBJ_id_smime_mod,3L + +#define SN_id_smime_mod_msg_v3 "id-smime-mod-msg-v3" +#define NID_id_smime_mod_msg_v3 199 +#define OBJ_id_smime_mod_msg_v3 OBJ_id_smime_mod,4L + +#define SN_id_smime_mod_ets_eSignature_88 "id-smime-mod-ets-eSignature-88" +#define NID_id_smime_mod_ets_eSignature_88 200 +#define OBJ_id_smime_mod_ets_eSignature_88 OBJ_id_smime_mod,5L + +#define SN_id_smime_mod_ets_eSignature_97 "id-smime-mod-ets-eSignature-97" +#define NID_id_smime_mod_ets_eSignature_97 201 +#define OBJ_id_smime_mod_ets_eSignature_97 OBJ_id_smime_mod,6L + +#define SN_id_smime_mod_ets_eSigPolicy_88 "id-smime-mod-ets-eSigPolicy-88" +#define NID_id_smime_mod_ets_eSigPolicy_88 202 +#define OBJ_id_smime_mod_ets_eSigPolicy_88 OBJ_id_smime_mod,7L + +#define SN_id_smime_mod_ets_eSigPolicy_97 "id-smime-mod-ets-eSigPolicy-97" +#define NID_id_smime_mod_ets_eSigPolicy_97 203 +#define OBJ_id_smime_mod_ets_eSigPolicy_97 OBJ_id_smime_mod,8L + +#define SN_id_smime_ct_receipt "id-smime-ct-receipt" +#define NID_id_smime_ct_receipt 204 +#define OBJ_id_smime_ct_receipt OBJ_id_smime_ct,1L + +#define SN_id_smime_ct_authData "id-smime-ct-authData" +#define NID_id_smime_ct_authData 205 +#define OBJ_id_smime_ct_authData OBJ_id_smime_ct,2L + +#define SN_id_smime_ct_publishCert "id-smime-ct-publishCert" +#define NID_id_smime_ct_publishCert 206 +#define OBJ_id_smime_ct_publishCert OBJ_id_smime_ct,3L + +#define SN_id_smime_ct_TSTInfo "id-smime-ct-TSTInfo" +#define NID_id_smime_ct_TSTInfo 207 +#define OBJ_id_smime_ct_TSTInfo OBJ_id_smime_ct,4L + +#define SN_id_smime_ct_TDTInfo "id-smime-ct-TDTInfo" +#define NID_id_smime_ct_TDTInfo 208 +#define OBJ_id_smime_ct_TDTInfo OBJ_id_smime_ct,5L + +#define SN_id_smime_ct_contentInfo "id-smime-ct-contentInfo" +#define NID_id_smime_ct_contentInfo 209 +#define OBJ_id_smime_ct_contentInfo OBJ_id_smime_ct,6L + +#define SN_id_smime_ct_DVCSRequestData "id-smime-ct-DVCSRequestData" +#define NID_id_smime_ct_DVCSRequestData 210 +#define OBJ_id_smime_ct_DVCSRequestData OBJ_id_smime_ct,7L + +#define SN_id_smime_ct_DVCSResponseData "id-smime-ct-DVCSResponseData" +#define NID_id_smime_ct_DVCSResponseData 211 +#define OBJ_id_smime_ct_DVCSResponseData OBJ_id_smime_ct,8L + +#define SN_id_smime_ct_compressedData "id-smime-ct-compressedData" +#define NID_id_smime_ct_compressedData 786 +#define OBJ_id_smime_ct_compressedData OBJ_id_smime_ct,9L + +#define SN_id_smime_ct_contentCollection "id-smime-ct-contentCollection" +#define NID_id_smime_ct_contentCollection 1058 +#define OBJ_id_smime_ct_contentCollection OBJ_id_smime_ct,19L + +#define SN_id_smime_ct_authEnvelopedData "id-smime-ct-authEnvelopedData" +#define NID_id_smime_ct_authEnvelopedData 1059 +#define OBJ_id_smime_ct_authEnvelopedData OBJ_id_smime_ct,23L + +#define SN_id_ct_asciiTextWithCRLF "id-ct-asciiTextWithCRLF" +#define NID_id_ct_asciiTextWithCRLF 787 +#define OBJ_id_ct_asciiTextWithCRLF OBJ_id_smime_ct,27L + +#define SN_id_ct_xml "id-ct-xml" +#define NID_id_ct_xml 1060 +#define OBJ_id_ct_xml OBJ_id_smime_ct,28L + +#define SN_id_smime_aa_receiptRequest "id-smime-aa-receiptRequest" +#define NID_id_smime_aa_receiptRequest 212 +#define OBJ_id_smime_aa_receiptRequest OBJ_id_smime_aa,1L + +#define SN_id_smime_aa_securityLabel "id-smime-aa-securityLabel" +#define NID_id_smime_aa_securityLabel 213 +#define OBJ_id_smime_aa_securityLabel OBJ_id_smime_aa,2L + +#define SN_id_smime_aa_mlExpandHistory "id-smime-aa-mlExpandHistory" +#define NID_id_smime_aa_mlExpandHistory 214 +#define OBJ_id_smime_aa_mlExpandHistory OBJ_id_smime_aa,3L + +#define SN_id_smime_aa_contentHint "id-smime-aa-contentHint" +#define NID_id_smime_aa_contentHint 215 +#define OBJ_id_smime_aa_contentHint OBJ_id_smime_aa,4L + +#define SN_id_smime_aa_msgSigDigest "id-smime-aa-msgSigDigest" +#define NID_id_smime_aa_msgSigDigest 216 +#define OBJ_id_smime_aa_msgSigDigest OBJ_id_smime_aa,5L + +#define SN_id_smime_aa_encapContentType "id-smime-aa-encapContentType" +#define NID_id_smime_aa_encapContentType 217 +#define OBJ_id_smime_aa_encapContentType OBJ_id_smime_aa,6L + +#define SN_id_smime_aa_contentIdentifier "id-smime-aa-contentIdentifier" +#define NID_id_smime_aa_contentIdentifier 218 +#define OBJ_id_smime_aa_contentIdentifier OBJ_id_smime_aa,7L + +#define SN_id_smime_aa_macValue "id-smime-aa-macValue" +#define NID_id_smime_aa_macValue 219 +#define OBJ_id_smime_aa_macValue OBJ_id_smime_aa,8L + +#define SN_id_smime_aa_equivalentLabels "id-smime-aa-equivalentLabels" +#define NID_id_smime_aa_equivalentLabels 220 +#define OBJ_id_smime_aa_equivalentLabels OBJ_id_smime_aa,9L + +#define SN_id_smime_aa_contentReference "id-smime-aa-contentReference" +#define NID_id_smime_aa_contentReference 221 +#define OBJ_id_smime_aa_contentReference OBJ_id_smime_aa,10L + +#define SN_id_smime_aa_encrypKeyPref "id-smime-aa-encrypKeyPref" +#define NID_id_smime_aa_encrypKeyPref 222 +#define OBJ_id_smime_aa_encrypKeyPref OBJ_id_smime_aa,11L + +#define SN_id_smime_aa_signingCertificate "id-smime-aa-signingCertificate" +#define NID_id_smime_aa_signingCertificate 223 +#define OBJ_id_smime_aa_signingCertificate OBJ_id_smime_aa,12L + +#define SN_id_smime_aa_smimeEncryptCerts "id-smime-aa-smimeEncryptCerts" +#define NID_id_smime_aa_smimeEncryptCerts 224 +#define OBJ_id_smime_aa_smimeEncryptCerts OBJ_id_smime_aa,13L + +#define SN_id_smime_aa_timeStampToken "id-smime-aa-timeStampToken" +#define NID_id_smime_aa_timeStampToken 225 +#define OBJ_id_smime_aa_timeStampToken OBJ_id_smime_aa,14L + +#define SN_id_smime_aa_ets_sigPolicyId "id-smime-aa-ets-sigPolicyId" +#define NID_id_smime_aa_ets_sigPolicyId 226 +#define OBJ_id_smime_aa_ets_sigPolicyId OBJ_id_smime_aa,15L + +#define SN_id_smime_aa_ets_commitmentType "id-smime-aa-ets-commitmentType" +#define NID_id_smime_aa_ets_commitmentType 227 +#define OBJ_id_smime_aa_ets_commitmentType OBJ_id_smime_aa,16L + +#define SN_id_smime_aa_ets_signerLocation "id-smime-aa-ets-signerLocation" +#define NID_id_smime_aa_ets_signerLocation 228 +#define OBJ_id_smime_aa_ets_signerLocation OBJ_id_smime_aa,17L + +#define SN_id_smime_aa_ets_signerAttr "id-smime-aa-ets-signerAttr" +#define NID_id_smime_aa_ets_signerAttr 229 +#define OBJ_id_smime_aa_ets_signerAttr OBJ_id_smime_aa,18L + +#define SN_id_smime_aa_ets_otherSigCert "id-smime-aa-ets-otherSigCert" +#define NID_id_smime_aa_ets_otherSigCert 230 +#define OBJ_id_smime_aa_ets_otherSigCert OBJ_id_smime_aa,19L + +#define SN_id_smime_aa_ets_contentTimestamp "id-smime-aa-ets-contentTimestamp" +#define NID_id_smime_aa_ets_contentTimestamp 231 +#define OBJ_id_smime_aa_ets_contentTimestamp OBJ_id_smime_aa,20L + +#define SN_id_smime_aa_ets_CertificateRefs "id-smime-aa-ets-CertificateRefs" +#define NID_id_smime_aa_ets_CertificateRefs 232 +#define OBJ_id_smime_aa_ets_CertificateRefs OBJ_id_smime_aa,21L + +#define SN_id_smime_aa_ets_RevocationRefs "id-smime-aa-ets-RevocationRefs" +#define NID_id_smime_aa_ets_RevocationRefs 233 +#define OBJ_id_smime_aa_ets_RevocationRefs OBJ_id_smime_aa,22L + +#define SN_id_smime_aa_ets_certValues "id-smime-aa-ets-certValues" +#define NID_id_smime_aa_ets_certValues 234 +#define OBJ_id_smime_aa_ets_certValues OBJ_id_smime_aa,23L + +#define SN_id_smime_aa_ets_revocationValues "id-smime-aa-ets-revocationValues" +#define NID_id_smime_aa_ets_revocationValues 235 +#define OBJ_id_smime_aa_ets_revocationValues OBJ_id_smime_aa,24L + +#define SN_id_smime_aa_ets_escTimeStamp "id-smime-aa-ets-escTimeStamp" +#define NID_id_smime_aa_ets_escTimeStamp 236 +#define OBJ_id_smime_aa_ets_escTimeStamp OBJ_id_smime_aa,25L + +#define SN_id_smime_aa_ets_certCRLTimestamp "id-smime-aa-ets-certCRLTimestamp" +#define NID_id_smime_aa_ets_certCRLTimestamp 237 +#define OBJ_id_smime_aa_ets_certCRLTimestamp OBJ_id_smime_aa,26L + +#define SN_id_smime_aa_ets_archiveTimeStamp "id-smime-aa-ets-archiveTimeStamp" +#define NID_id_smime_aa_ets_archiveTimeStamp 238 +#define OBJ_id_smime_aa_ets_archiveTimeStamp OBJ_id_smime_aa,27L + +#define SN_id_smime_aa_signatureType "id-smime-aa-signatureType" +#define NID_id_smime_aa_signatureType 239 +#define OBJ_id_smime_aa_signatureType OBJ_id_smime_aa,28L + +#define SN_id_smime_aa_dvcs_dvc "id-smime-aa-dvcs-dvc" +#define NID_id_smime_aa_dvcs_dvc 240 +#define OBJ_id_smime_aa_dvcs_dvc OBJ_id_smime_aa,29L + +#define SN_id_smime_aa_signingCertificateV2 "id-smime-aa-signingCertificateV2" +#define NID_id_smime_aa_signingCertificateV2 1086 +#define OBJ_id_smime_aa_signingCertificateV2 OBJ_id_smime_aa,47L + +#define SN_id_smime_alg_ESDHwith3DES "id-smime-alg-ESDHwith3DES" +#define NID_id_smime_alg_ESDHwith3DES 241 +#define OBJ_id_smime_alg_ESDHwith3DES OBJ_id_smime_alg,1L + +#define SN_id_smime_alg_ESDHwithRC2 "id-smime-alg-ESDHwithRC2" +#define NID_id_smime_alg_ESDHwithRC2 242 +#define OBJ_id_smime_alg_ESDHwithRC2 OBJ_id_smime_alg,2L + +#define SN_id_smime_alg_3DESwrap "id-smime-alg-3DESwrap" +#define NID_id_smime_alg_3DESwrap 243 +#define OBJ_id_smime_alg_3DESwrap OBJ_id_smime_alg,3L + +#define SN_id_smime_alg_RC2wrap "id-smime-alg-RC2wrap" +#define NID_id_smime_alg_RC2wrap 244 +#define OBJ_id_smime_alg_RC2wrap OBJ_id_smime_alg,4L + +#define SN_id_smime_alg_ESDH "id-smime-alg-ESDH" +#define NID_id_smime_alg_ESDH 245 +#define OBJ_id_smime_alg_ESDH OBJ_id_smime_alg,5L + +#define SN_id_smime_alg_CMS3DESwrap "id-smime-alg-CMS3DESwrap" +#define NID_id_smime_alg_CMS3DESwrap 246 +#define OBJ_id_smime_alg_CMS3DESwrap OBJ_id_smime_alg,6L + +#define SN_id_smime_alg_CMSRC2wrap "id-smime-alg-CMSRC2wrap" +#define NID_id_smime_alg_CMSRC2wrap 247 +#define OBJ_id_smime_alg_CMSRC2wrap OBJ_id_smime_alg,7L + +#define SN_id_alg_PWRI_KEK "id-alg-PWRI-KEK" +#define NID_id_alg_PWRI_KEK 893 +#define OBJ_id_alg_PWRI_KEK OBJ_id_smime_alg,9L + +#define SN_id_smime_cd_ldap "id-smime-cd-ldap" +#define NID_id_smime_cd_ldap 248 +#define OBJ_id_smime_cd_ldap OBJ_id_smime_cd,1L + +#define SN_id_smime_spq_ets_sqt_uri "id-smime-spq-ets-sqt-uri" +#define NID_id_smime_spq_ets_sqt_uri 249 +#define OBJ_id_smime_spq_ets_sqt_uri OBJ_id_smime_spq,1L + +#define SN_id_smime_spq_ets_sqt_unotice "id-smime-spq-ets-sqt-unotice" +#define NID_id_smime_spq_ets_sqt_unotice 250 +#define OBJ_id_smime_spq_ets_sqt_unotice OBJ_id_smime_spq,2L + +#define SN_id_smime_cti_ets_proofOfOrigin "id-smime-cti-ets-proofOfOrigin" +#define NID_id_smime_cti_ets_proofOfOrigin 251 +#define OBJ_id_smime_cti_ets_proofOfOrigin OBJ_id_smime_cti,1L + +#define SN_id_smime_cti_ets_proofOfReceipt "id-smime-cti-ets-proofOfReceipt" +#define NID_id_smime_cti_ets_proofOfReceipt 252 +#define OBJ_id_smime_cti_ets_proofOfReceipt OBJ_id_smime_cti,2L + +#define SN_id_smime_cti_ets_proofOfDelivery "id-smime-cti-ets-proofOfDelivery" +#define NID_id_smime_cti_ets_proofOfDelivery 253 +#define OBJ_id_smime_cti_ets_proofOfDelivery OBJ_id_smime_cti,3L + +#define SN_id_smime_cti_ets_proofOfSender "id-smime-cti-ets-proofOfSender" +#define NID_id_smime_cti_ets_proofOfSender 254 +#define OBJ_id_smime_cti_ets_proofOfSender OBJ_id_smime_cti,4L + +#define SN_id_smime_cti_ets_proofOfApproval "id-smime-cti-ets-proofOfApproval" +#define NID_id_smime_cti_ets_proofOfApproval 255 +#define OBJ_id_smime_cti_ets_proofOfApproval OBJ_id_smime_cti,5L + +#define SN_id_smime_cti_ets_proofOfCreation "id-smime-cti-ets-proofOfCreation" +#define NID_id_smime_cti_ets_proofOfCreation 256 +#define OBJ_id_smime_cti_ets_proofOfCreation OBJ_id_smime_cti,6L + +#define LN_friendlyName "friendlyName" +#define NID_friendlyName 156 +#define OBJ_friendlyName OBJ_pkcs9,20L + +#define LN_localKeyID "localKeyID" +#define NID_localKeyID 157 +#define OBJ_localKeyID OBJ_pkcs9,21L + +#define SN_ms_csp_name "CSPName" +#define LN_ms_csp_name "Microsoft CSP Name" +#define NID_ms_csp_name 417 +#define OBJ_ms_csp_name 1L,3L,6L,1L,4L,1L,311L,17L,1L + +#define SN_LocalKeySet "LocalKeySet" +#define LN_LocalKeySet "Microsoft Local Key set" +#define NID_LocalKeySet 856 +#define OBJ_LocalKeySet 1L,3L,6L,1L,4L,1L,311L,17L,2L + +#define OBJ_certTypes OBJ_pkcs9,22L + +#define LN_x509Certificate "x509Certificate" +#define NID_x509Certificate 158 +#define OBJ_x509Certificate OBJ_certTypes,1L + +#define LN_sdsiCertificate "sdsiCertificate" +#define NID_sdsiCertificate 159 +#define OBJ_sdsiCertificate OBJ_certTypes,2L + +#define OBJ_crlTypes OBJ_pkcs9,23L + +#define LN_x509Crl "x509Crl" +#define NID_x509Crl 160 +#define OBJ_x509Crl OBJ_crlTypes,1L + +#define OBJ_pkcs12 OBJ_pkcs,12L + +#define OBJ_pkcs12_pbeids OBJ_pkcs12,1L + +#define SN_pbe_WithSHA1And128BitRC4 "PBE-SHA1-RC4-128" +#define LN_pbe_WithSHA1And128BitRC4 "pbeWithSHA1And128BitRC4" +#define NID_pbe_WithSHA1And128BitRC4 144 +#define OBJ_pbe_WithSHA1And128BitRC4 OBJ_pkcs12_pbeids,1L + +#define SN_pbe_WithSHA1And40BitRC4 "PBE-SHA1-RC4-40" +#define LN_pbe_WithSHA1And40BitRC4 "pbeWithSHA1And40BitRC4" +#define NID_pbe_WithSHA1And40BitRC4 145 +#define OBJ_pbe_WithSHA1And40BitRC4 OBJ_pkcs12_pbeids,2L + +#define SN_pbe_WithSHA1And3_Key_TripleDES_CBC "PBE-SHA1-3DES" +#define LN_pbe_WithSHA1And3_Key_TripleDES_CBC "pbeWithSHA1And3-KeyTripleDES-CBC" +#define NID_pbe_WithSHA1And3_Key_TripleDES_CBC 146 +#define OBJ_pbe_WithSHA1And3_Key_TripleDES_CBC OBJ_pkcs12_pbeids,3L + +#define SN_pbe_WithSHA1And2_Key_TripleDES_CBC "PBE-SHA1-2DES" +#define LN_pbe_WithSHA1And2_Key_TripleDES_CBC "pbeWithSHA1And2-KeyTripleDES-CBC" +#define NID_pbe_WithSHA1And2_Key_TripleDES_CBC 147 +#define OBJ_pbe_WithSHA1And2_Key_TripleDES_CBC OBJ_pkcs12_pbeids,4L + +#define SN_pbe_WithSHA1And128BitRC2_CBC "PBE-SHA1-RC2-128" +#define LN_pbe_WithSHA1And128BitRC2_CBC "pbeWithSHA1And128BitRC2-CBC" +#define NID_pbe_WithSHA1And128BitRC2_CBC 148 +#define OBJ_pbe_WithSHA1And128BitRC2_CBC OBJ_pkcs12_pbeids,5L + +#define SN_pbe_WithSHA1And40BitRC2_CBC "PBE-SHA1-RC2-40" +#define LN_pbe_WithSHA1And40BitRC2_CBC "pbeWithSHA1And40BitRC2-CBC" +#define NID_pbe_WithSHA1And40BitRC2_CBC 149 +#define OBJ_pbe_WithSHA1And40BitRC2_CBC OBJ_pkcs12_pbeids,6L + +#define OBJ_pkcs12_Version1 OBJ_pkcs12,10L + +#define OBJ_pkcs12_BagIds OBJ_pkcs12_Version1,1L + +#define LN_keyBag "keyBag" +#define NID_keyBag 150 +#define OBJ_keyBag OBJ_pkcs12_BagIds,1L + +#define LN_pkcs8ShroudedKeyBag "pkcs8ShroudedKeyBag" +#define NID_pkcs8ShroudedKeyBag 151 +#define OBJ_pkcs8ShroudedKeyBag OBJ_pkcs12_BagIds,2L + +#define LN_certBag "certBag" +#define NID_certBag 152 +#define OBJ_certBag OBJ_pkcs12_BagIds,3L + +#define LN_crlBag "crlBag" +#define NID_crlBag 153 +#define OBJ_crlBag OBJ_pkcs12_BagIds,4L + +#define LN_secretBag "secretBag" +#define NID_secretBag 154 +#define OBJ_secretBag OBJ_pkcs12_BagIds,5L + +#define LN_safeContentsBag "safeContentsBag" +#define NID_safeContentsBag 155 +#define OBJ_safeContentsBag OBJ_pkcs12_BagIds,6L + +#define SN_md2 "MD2" +#define LN_md2 "md2" +#define NID_md2 3 +#define OBJ_md2 OBJ_rsadsi,2L,2L + +#define SN_md4 "MD4" +#define LN_md4 "md4" +#define NID_md4 257 +#define OBJ_md4 OBJ_rsadsi,2L,4L + +#define SN_md5 "MD5" +#define LN_md5 "md5" +#define NID_md5 4 +#define OBJ_md5 OBJ_rsadsi,2L,5L + +#define SN_md5_sha1 "MD5-SHA1" +#define LN_md5_sha1 "md5-sha1" +#define NID_md5_sha1 114 + +#define LN_hmacWithMD5 "hmacWithMD5" +#define NID_hmacWithMD5 797 +#define OBJ_hmacWithMD5 OBJ_rsadsi,2L,6L + +#define LN_hmacWithSHA1 "hmacWithSHA1" +#define NID_hmacWithSHA1 163 +#define OBJ_hmacWithSHA1 OBJ_rsadsi,2L,7L + +#define SN_sm2 "SM2" +#define LN_sm2 "sm2" +#define NID_sm2 1172 +#define OBJ_sm2 OBJ_sm_scheme,301L + +#define SN_sm3 "SM3" +#define LN_sm3 "sm3" +#define NID_sm3 1143 +#define OBJ_sm3 OBJ_sm_scheme,401L + +#define SN_sm3WithRSAEncryption "RSA-SM3" +#define LN_sm3WithRSAEncryption "sm3WithRSAEncryption" +#define NID_sm3WithRSAEncryption 1144 +#define OBJ_sm3WithRSAEncryption OBJ_sm_scheme,504L + +#define LN_hmacWithSHA224 "hmacWithSHA224" +#define NID_hmacWithSHA224 798 +#define OBJ_hmacWithSHA224 OBJ_rsadsi,2L,8L + +#define LN_hmacWithSHA256 "hmacWithSHA256" +#define NID_hmacWithSHA256 799 +#define OBJ_hmacWithSHA256 OBJ_rsadsi,2L,9L + +#define LN_hmacWithSHA384 "hmacWithSHA384" +#define NID_hmacWithSHA384 800 +#define OBJ_hmacWithSHA384 OBJ_rsadsi,2L,10L + +#define LN_hmacWithSHA512 "hmacWithSHA512" +#define NID_hmacWithSHA512 801 +#define OBJ_hmacWithSHA512 OBJ_rsadsi,2L,11L + +#define LN_hmacWithSHA512_224 "hmacWithSHA512-224" +#define NID_hmacWithSHA512_224 1193 +#define OBJ_hmacWithSHA512_224 OBJ_rsadsi,2L,12L + +#define LN_hmacWithSHA512_256 "hmacWithSHA512-256" +#define NID_hmacWithSHA512_256 1194 +#define OBJ_hmacWithSHA512_256 OBJ_rsadsi,2L,13L + +#define SN_rc2_cbc "RC2-CBC" +#define LN_rc2_cbc "rc2-cbc" +#define NID_rc2_cbc 37 +#define OBJ_rc2_cbc OBJ_rsadsi,3L,2L + +#define SN_rc2_ecb "RC2-ECB" +#define LN_rc2_ecb "rc2-ecb" +#define NID_rc2_ecb 38 + +#define SN_rc2_cfb64 "RC2-CFB" +#define LN_rc2_cfb64 "rc2-cfb" +#define NID_rc2_cfb64 39 + +#define SN_rc2_ofb64 "RC2-OFB" +#define LN_rc2_ofb64 "rc2-ofb" +#define NID_rc2_ofb64 40 + +#define SN_rc2_40_cbc "RC2-40-CBC" +#define LN_rc2_40_cbc "rc2-40-cbc" +#define NID_rc2_40_cbc 98 + +#define SN_rc2_64_cbc "RC2-64-CBC" +#define LN_rc2_64_cbc "rc2-64-cbc" +#define NID_rc2_64_cbc 166 + +#define SN_rc4 "RC4" +#define LN_rc4 "rc4" +#define NID_rc4 5 +#define OBJ_rc4 OBJ_rsadsi,3L,4L + +#define SN_rc4_40 "RC4-40" +#define LN_rc4_40 "rc4-40" +#define NID_rc4_40 97 + +#define SN_des_ede3_cbc "DES-EDE3-CBC" +#define LN_des_ede3_cbc "des-ede3-cbc" +#define NID_des_ede3_cbc 44 +#define OBJ_des_ede3_cbc OBJ_rsadsi,3L,7L + +#define SN_rc5_cbc "RC5-CBC" +#define LN_rc5_cbc "rc5-cbc" +#define NID_rc5_cbc 120 +#define OBJ_rc5_cbc OBJ_rsadsi,3L,8L + +#define SN_rc5_ecb "RC5-ECB" +#define LN_rc5_ecb "rc5-ecb" +#define NID_rc5_ecb 121 + +#define SN_rc5_cfb64 "RC5-CFB" +#define LN_rc5_cfb64 "rc5-cfb" +#define NID_rc5_cfb64 122 + +#define SN_rc5_ofb64 "RC5-OFB" +#define LN_rc5_ofb64 "rc5-ofb" +#define NID_rc5_ofb64 123 + +#define SN_ms_ext_req "msExtReq" +#define LN_ms_ext_req "Microsoft Extension Request" +#define NID_ms_ext_req 171 +#define OBJ_ms_ext_req 1L,3L,6L,1L,4L,1L,311L,2L,1L,14L + +#define SN_ms_code_ind "msCodeInd" +#define LN_ms_code_ind "Microsoft Individual Code Signing" +#define NID_ms_code_ind 134 +#define OBJ_ms_code_ind 1L,3L,6L,1L,4L,1L,311L,2L,1L,21L + +#define SN_ms_code_com "msCodeCom" +#define LN_ms_code_com "Microsoft Commercial Code Signing" +#define NID_ms_code_com 135 +#define OBJ_ms_code_com 1L,3L,6L,1L,4L,1L,311L,2L,1L,22L + +#define SN_ms_ctl_sign "msCTLSign" +#define LN_ms_ctl_sign "Microsoft Trust List Signing" +#define NID_ms_ctl_sign 136 +#define OBJ_ms_ctl_sign 1L,3L,6L,1L,4L,1L,311L,10L,3L,1L + +#define SN_ms_sgc "msSGC" +#define LN_ms_sgc "Microsoft Server Gated Crypto" +#define NID_ms_sgc 137 +#define OBJ_ms_sgc 1L,3L,6L,1L,4L,1L,311L,10L,3L,3L + +#define SN_ms_efs "msEFS" +#define LN_ms_efs "Microsoft Encrypted File System" +#define NID_ms_efs 138 +#define OBJ_ms_efs 1L,3L,6L,1L,4L,1L,311L,10L,3L,4L + +#define SN_ms_smartcard_login "msSmartcardLogin" +#define LN_ms_smartcard_login "Microsoft Smartcard Login" +#define NID_ms_smartcard_login 648 +#define OBJ_ms_smartcard_login 1L,3L,6L,1L,4L,1L,311L,20L,2L,2L + +#define SN_ms_upn "msUPN" +#define LN_ms_upn "Microsoft User Principal Name" +#define NID_ms_upn 649 +#define OBJ_ms_upn 1L,3L,6L,1L,4L,1L,311L,20L,2L,3L + +#define SN_idea_cbc "IDEA-CBC" +#define LN_idea_cbc "idea-cbc" +#define NID_idea_cbc 34 +#define OBJ_idea_cbc 1L,3L,6L,1L,4L,1L,188L,7L,1L,1L,2L + +#define SN_idea_ecb "IDEA-ECB" +#define LN_idea_ecb "idea-ecb" +#define NID_idea_ecb 36 + +#define SN_idea_cfb64 "IDEA-CFB" +#define LN_idea_cfb64 "idea-cfb" +#define NID_idea_cfb64 35 + +#define SN_idea_ofb64 "IDEA-OFB" +#define LN_idea_ofb64 "idea-ofb" +#define NID_idea_ofb64 46 + +#define SN_bf_cbc "BF-CBC" +#define LN_bf_cbc "bf-cbc" +#define NID_bf_cbc 91 +#define OBJ_bf_cbc 1L,3L,6L,1L,4L,1L,3029L,1L,2L + +#define SN_bf_ecb "BF-ECB" +#define LN_bf_ecb "bf-ecb" +#define NID_bf_ecb 92 + +#define SN_bf_cfb64 "BF-CFB" +#define LN_bf_cfb64 "bf-cfb" +#define NID_bf_cfb64 93 + +#define SN_bf_ofb64 "BF-OFB" +#define LN_bf_ofb64 "bf-ofb" +#define NID_bf_ofb64 94 + +#define SN_id_pkix "PKIX" +#define NID_id_pkix 127 +#define OBJ_id_pkix 1L,3L,6L,1L,5L,5L,7L + +#define SN_id_pkix_mod "id-pkix-mod" +#define NID_id_pkix_mod 258 +#define OBJ_id_pkix_mod OBJ_id_pkix,0L + +#define SN_id_pe "id-pe" +#define NID_id_pe 175 +#define OBJ_id_pe OBJ_id_pkix,1L + +#define SN_id_qt "id-qt" +#define NID_id_qt 259 +#define OBJ_id_qt OBJ_id_pkix,2L + +#define SN_id_kp "id-kp" +#define NID_id_kp 128 +#define OBJ_id_kp OBJ_id_pkix,3L + +#define SN_id_it "id-it" +#define NID_id_it 260 +#define OBJ_id_it OBJ_id_pkix,4L + +#define SN_id_pkip "id-pkip" +#define NID_id_pkip 261 +#define OBJ_id_pkip OBJ_id_pkix,5L + +#define SN_id_alg "id-alg" +#define NID_id_alg 262 +#define OBJ_id_alg OBJ_id_pkix,6L + +#define SN_id_cmc "id-cmc" +#define NID_id_cmc 263 +#define OBJ_id_cmc OBJ_id_pkix,7L + +#define SN_id_on "id-on" +#define NID_id_on 264 +#define OBJ_id_on OBJ_id_pkix,8L + +#define SN_id_pda "id-pda" +#define NID_id_pda 265 +#define OBJ_id_pda OBJ_id_pkix,9L + +#define SN_id_aca "id-aca" +#define NID_id_aca 266 +#define OBJ_id_aca OBJ_id_pkix,10L + +#define SN_id_qcs "id-qcs" +#define NID_id_qcs 267 +#define OBJ_id_qcs OBJ_id_pkix,11L + +#define SN_id_cct "id-cct" +#define NID_id_cct 268 +#define OBJ_id_cct OBJ_id_pkix,12L + +#define SN_id_ppl "id-ppl" +#define NID_id_ppl 662 +#define OBJ_id_ppl OBJ_id_pkix,21L + +#define SN_id_ad "id-ad" +#define NID_id_ad 176 +#define OBJ_id_ad OBJ_id_pkix,48L + +#define SN_id_pkix1_explicit_88 "id-pkix1-explicit-88" +#define NID_id_pkix1_explicit_88 269 +#define OBJ_id_pkix1_explicit_88 OBJ_id_pkix_mod,1L + +#define SN_id_pkix1_implicit_88 "id-pkix1-implicit-88" +#define NID_id_pkix1_implicit_88 270 +#define OBJ_id_pkix1_implicit_88 OBJ_id_pkix_mod,2L + +#define SN_id_pkix1_explicit_93 "id-pkix1-explicit-93" +#define NID_id_pkix1_explicit_93 271 +#define OBJ_id_pkix1_explicit_93 OBJ_id_pkix_mod,3L + +#define SN_id_pkix1_implicit_93 "id-pkix1-implicit-93" +#define NID_id_pkix1_implicit_93 272 +#define OBJ_id_pkix1_implicit_93 OBJ_id_pkix_mod,4L + +#define SN_id_mod_crmf "id-mod-crmf" +#define NID_id_mod_crmf 273 +#define OBJ_id_mod_crmf OBJ_id_pkix_mod,5L + +#define SN_id_mod_cmc "id-mod-cmc" +#define NID_id_mod_cmc 274 +#define OBJ_id_mod_cmc OBJ_id_pkix_mod,6L + +#define SN_id_mod_kea_profile_88 "id-mod-kea-profile-88" +#define NID_id_mod_kea_profile_88 275 +#define OBJ_id_mod_kea_profile_88 OBJ_id_pkix_mod,7L + +#define SN_id_mod_kea_profile_93 "id-mod-kea-profile-93" +#define NID_id_mod_kea_profile_93 276 +#define OBJ_id_mod_kea_profile_93 OBJ_id_pkix_mod,8L + +#define SN_id_mod_cmp "id-mod-cmp" +#define NID_id_mod_cmp 277 +#define OBJ_id_mod_cmp OBJ_id_pkix_mod,9L + +#define SN_id_mod_qualified_cert_88 "id-mod-qualified-cert-88" +#define NID_id_mod_qualified_cert_88 278 +#define OBJ_id_mod_qualified_cert_88 OBJ_id_pkix_mod,10L + +#define SN_id_mod_qualified_cert_93 "id-mod-qualified-cert-93" +#define NID_id_mod_qualified_cert_93 279 +#define OBJ_id_mod_qualified_cert_93 OBJ_id_pkix_mod,11L + +#define SN_id_mod_attribute_cert "id-mod-attribute-cert" +#define NID_id_mod_attribute_cert 280 +#define OBJ_id_mod_attribute_cert OBJ_id_pkix_mod,12L + +#define SN_id_mod_timestamp_protocol "id-mod-timestamp-protocol" +#define NID_id_mod_timestamp_protocol 281 +#define OBJ_id_mod_timestamp_protocol OBJ_id_pkix_mod,13L + +#define SN_id_mod_ocsp "id-mod-ocsp" +#define NID_id_mod_ocsp 282 +#define OBJ_id_mod_ocsp OBJ_id_pkix_mod,14L + +#define SN_id_mod_dvcs "id-mod-dvcs" +#define NID_id_mod_dvcs 283 +#define OBJ_id_mod_dvcs OBJ_id_pkix_mod,15L + +#define SN_id_mod_cmp2000 "id-mod-cmp2000" +#define NID_id_mod_cmp2000 284 +#define OBJ_id_mod_cmp2000 OBJ_id_pkix_mod,16L + +#define SN_info_access "authorityInfoAccess" +#define LN_info_access "Authority Information Access" +#define NID_info_access 177 +#define OBJ_info_access OBJ_id_pe,1L + +#define SN_biometricInfo "biometricInfo" +#define LN_biometricInfo "Biometric Info" +#define NID_biometricInfo 285 +#define OBJ_biometricInfo OBJ_id_pe,2L + +#define SN_qcStatements "qcStatements" +#define NID_qcStatements 286 +#define OBJ_qcStatements OBJ_id_pe,3L + +#define SN_ac_auditEntity "ac-auditEntity" +#define NID_ac_auditEntity 287 +#define OBJ_ac_auditEntity OBJ_id_pe,4L + +#define SN_ac_targeting "ac-targeting" +#define NID_ac_targeting 288 +#define OBJ_ac_targeting OBJ_id_pe,5L + +#define SN_aaControls "aaControls" +#define NID_aaControls 289 +#define OBJ_aaControls OBJ_id_pe,6L + +#define SN_sbgp_ipAddrBlock "sbgp-ipAddrBlock" +#define NID_sbgp_ipAddrBlock 290 +#define OBJ_sbgp_ipAddrBlock OBJ_id_pe,7L + +#define SN_sbgp_autonomousSysNum "sbgp-autonomousSysNum" +#define NID_sbgp_autonomousSysNum 291 +#define OBJ_sbgp_autonomousSysNum OBJ_id_pe,8L + +#define SN_sbgp_routerIdentifier "sbgp-routerIdentifier" +#define NID_sbgp_routerIdentifier 292 +#define OBJ_sbgp_routerIdentifier OBJ_id_pe,9L + +#define SN_ac_proxying "ac-proxying" +#define NID_ac_proxying 397 +#define OBJ_ac_proxying OBJ_id_pe,10L + +#define SN_sinfo_access "subjectInfoAccess" +#define LN_sinfo_access "Subject Information Access" +#define NID_sinfo_access 398 +#define OBJ_sinfo_access OBJ_id_pe,11L + +#define SN_proxyCertInfo "proxyCertInfo" +#define LN_proxyCertInfo "Proxy Certificate Information" +#define NID_proxyCertInfo 663 +#define OBJ_proxyCertInfo OBJ_id_pe,14L + +#define SN_tlsfeature "tlsfeature" +#define LN_tlsfeature "TLS Feature" +#define NID_tlsfeature 1020 +#define OBJ_tlsfeature OBJ_id_pe,24L + +#define SN_id_qt_cps "id-qt-cps" +#define LN_id_qt_cps "Policy Qualifier CPS" +#define NID_id_qt_cps 164 +#define OBJ_id_qt_cps OBJ_id_qt,1L + +#define SN_id_qt_unotice "id-qt-unotice" +#define LN_id_qt_unotice "Policy Qualifier User Notice" +#define NID_id_qt_unotice 165 +#define OBJ_id_qt_unotice OBJ_id_qt,2L + +#define SN_textNotice "textNotice" +#define NID_textNotice 293 +#define OBJ_textNotice OBJ_id_qt,3L + +#define SN_server_auth "serverAuth" +#define LN_server_auth "TLS Web Server Authentication" +#define NID_server_auth 129 +#define OBJ_server_auth OBJ_id_kp,1L + +#define SN_client_auth "clientAuth" +#define LN_client_auth "TLS Web Client Authentication" +#define NID_client_auth 130 +#define OBJ_client_auth OBJ_id_kp,2L + +#define SN_code_sign "codeSigning" +#define LN_code_sign "Code Signing" +#define NID_code_sign 131 +#define OBJ_code_sign OBJ_id_kp,3L + +#define SN_email_protect "emailProtection" +#define LN_email_protect "E-mail Protection" +#define NID_email_protect 132 +#define OBJ_email_protect OBJ_id_kp,4L + +#define SN_ipsecEndSystem "ipsecEndSystem" +#define LN_ipsecEndSystem "IPSec End System" +#define NID_ipsecEndSystem 294 +#define OBJ_ipsecEndSystem OBJ_id_kp,5L + +#define SN_ipsecTunnel "ipsecTunnel" +#define LN_ipsecTunnel "IPSec Tunnel" +#define NID_ipsecTunnel 295 +#define OBJ_ipsecTunnel OBJ_id_kp,6L + +#define SN_ipsecUser "ipsecUser" +#define LN_ipsecUser "IPSec User" +#define NID_ipsecUser 296 +#define OBJ_ipsecUser OBJ_id_kp,7L + +#define SN_time_stamp "timeStamping" +#define LN_time_stamp "Time Stamping" +#define NID_time_stamp 133 +#define OBJ_time_stamp OBJ_id_kp,8L + +#define SN_OCSP_sign "OCSPSigning" +#define LN_OCSP_sign "OCSP Signing" +#define NID_OCSP_sign 180 +#define OBJ_OCSP_sign OBJ_id_kp,9L + +#define SN_dvcs "DVCS" +#define LN_dvcs "dvcs" +#define NID_dvcs 297 +#define OBJ_dvcs OBJ_id_kp,10L + +#define SN_ipsec_IKE "ipsecIKE" +#define LN_ipsec_IKE "ipsec Internet Key Exchange" +#define NID_ipsec_IKE 1022 +#define OBJ_ipsec_IKE OBJ_id_kp,17L + +#define SN_capwapAC "capwapAC" +#define LN_capwapAC "Ctrl/provision WAP Access" +#define NID_capwapAC 1023 +#define OBJ_capwapAC OBJ_id_kp,18L + +#define SN_capwapWTP "capwapWTP" +#define LN_capwapWTP "Ctrl/Provision WAP Termination" +#define NID_capwapWTP 1024 +#define OBJ_capwapWTP OBJ_id_kp,19L + +#define SN_sshClient "secureShellClient" +#define LN_sshClient "SSH Client" +#define NID_sshClient 1025 +#define OBJ_sshClient OBJ_id_kp,21L + +#define SN_sshServer "secureShellServer" +#define LN_sshServer "SSH Server" +#define NID_sshServer 1026 +#define OBJ_sshServer OBJ_id_kp,22L + +#define SN_sendRouter "sendRouter" +#define LN_sendRouter "Send Router" +#define NID_sendRouter 1027 +#define OBJ_sendRouter OBJ_id_kp,23L + +#define SN_sendProxiedRouter "sendProxiedRouter" +#define LN_sendProxiedRouter "Send Proxied Router" +#define NID_sendProxiedRouter 1028 +#define OBJ_sendProxiedRouter OBJ_id_kp,24L + +#define SN_sendOwner "sendOwner" +#define LN_sendOwner "Send Owner" +#define NID_sendOwner 1029 +#define OBJ_sendOwner OBJ_id_kp,25L + +#define SN_sendProxiedOwner "sendProxiedOwner" +#define LN_sendProxiedOwner "Send Proxied Owner" +#define NID_sendProxiedOwner 1030 +#define OBJ_sendProxiedOwner OBJ_id_kp,26L + +#define SN_cmcCA "cmcCA" +#define LN_cmcCA "CMC Certificate Authority" +#define NID_cmcCA 1131 +#define OBJ_cmcCA OBJ_id_kp,27L + +#define SN_cmcRA "cmcRA" +#define LN_cmcRA "CMC Registration Authority" +#define NID_cmcRA 1132 +#define OBJ_cmcRA OBJ_id_kp,28L + +#define SN_id_it_caProtEncCert "id-it-caProtEncCert" +#define NID_id_it_caProtEncCert 298 +#define OBJ_id_it_caProtEncCert OBJ_id_it,1L + +#define SN_id_it_signKeyPairTypes "id-it-signKeyPairTypes" +#define NID_id_it_signKeyPairTypes 299 +#define OBJ_id_it_signKeyPairTypes OBJ_id_it,2L + +#define SN_id_it_encKeyPairTypes "id-it-encKeyPairTypes" +#define NID_id_it_encKeyPairTypes 300 +#define OBJ_id_it_encKeyPairTypes OBJ_id_it,3L + +#define SN_id_it_preferredSymmAlg "id-it-preferredSymmAlg" +#define NID_id_it_preferredSymmAlg 301 +#define OBJ_id_it_preferredSymmAlg OBJ_id_it,4L + +#define SN_id_it_caKeyUpdateInfo "id-it-caKeyUpdateInfo" +#define NID_id_it_caKeyUpdateInfo 302 +#define OBJ_id_it_caKeyUpdateInfo OBJ_id_it,5L + +#define SN_id_it_currentCRL "id-it-currentCRL" +#define NID_id_it_currentCRL 303 +#define OBJ_id_it_currentCRL OBJ_id_it,6L + +#define SN_id_it_unsupportedOIDs "id-it-unsupportedOIDs" +#define NID_id_it_unsupportedOIDs 304 +#define OBJ_id_it_unsupportedOIDs OBJ_id_it,7L + +#define SN_id_it_subscriptionRequest "id-it-subscriptionRequest" +#define NID_id_it_subscriptionRequest 305 +#define OBJ_id_it_subscriptionRequest OBJ_id_it,8L + +#define SN_id_it_subscriptionResponse "id-it-subscriptionResponse" +#define NID_id_it_subscriptionResponse 306 +#define OBJ_id_it_subscriptionResponse OBJ_id_it,9L + +#define SN_id_it_keyPairParamReq "id-it-keyPairParamReq" +#define NID_id_it_keyPairParamReq 307 +#define OBJ_id_it_keyPairParamReq OBJ_id_it,10L + +#define SN_id_it_keyPairParamRep "id-it-keyPairParamRep" +#define NID_id_it_keyPairParamRep 308 +#define OBJ_id_it_keyPairParamRep OBJ_id_it,11L + +#define SN_id_it_revPassphrase "id-it-revPassphrase" +#define NID_id_it_revPassphrase 309 +#define OBJ_id_it_revPassphrase OBJ_id_it,12L + +#define SN_id_it_implicitConfirm "id-it-implicitConfirm" +#define NID_id_it_implicitConfirm 310 +#define OBJ_id_it_implicitConfirm OBJ_id_it,13L + +#define SN_id_it_confirmWaitTime "id-it-confirmWaitTime" +#define NID_id_it_confirmWaitTime 311 +#define OBJ_id_it_confirmWaitTime OBJ_id_it,14L + +#define SN_id_it_origPKIMessage "id-it-origPKIMessage" +#define NID_id_it_origPKIMessage 312 +#define OBJ_id_it_origPKIMessage OBJ_id_it,15L + +#define SN_id_it_suppLangTags "id-it-suppLangTags" +#define NID_id_it_suppLangTags 784 +#define OBJ_id_it_suppLangTags OBJ_id_it,16L + +#define SN_id_regCtrl "id-regCtrl" +#define NID_id_regCtrl 313 +#define OBJ_id_regCtrl OBJ_id_pkip,1L + +#define SN_id_regInfo "id-regInfo" +#define NID_id_regInfo 314 +#define OBJ_id_regInfo OBJ_id_pkip,2L + +#define SN_id_regCtrl_regToken "id-regCtrl-regToken" +#define NID_id_regCtrl_regToken 315 +#define OBJ_id_regCtrl_regToken OBJ_id_regCtrl,1L + +#define SN_id_regCtrl_authenticator "id-regCtrl-authenticator" +#define NID_id_regCtrl_authenticator 316 +#define OBJ_id_regCtrl_authenticator OBJ_id_regCtrl,2L + +#define SN_id_regCtrl_pkiPublicationInfo "id-regCtrl-pkiPublicationInfo" +#define NID_id_regCtrl_pkiPublicationInfo 317 +#define OBJ_id_regCtrl_pkiPublicationInfo OBJ_id_regCtrl,3L + +#define SN_id_regCtrl_pkiArchiveOptions "id-regCtrl-pkiArchiveOptions" +#define NID_id_regCtrl_pkiArchiveOptions 318 +#define OBJ_id_regCtrl_pkiArchiveOptions OBJ_id_regCtrl,4L + +#define SN_id_regCtrl_oldCertID "id-regCtrl-oldCertID" +#define NID_id_regCtrl_oldCertID 319 +#define OBJ_id_regCtrl_oldCertID OBJ_id_regCtrl,5L + +#define SN_id_regCtrl_protocolEncrKey "id-regCtrl-protocolEncrKey" +#define NID_id_regCtrl_protocolEncrKey 320 +#define OBJ_id_regCtrl_protocolEncrKey OBJ_id_regCtrl,6L + +#define SN_id_regInfo_utf8Pairs "id-regInfo-utf8Pairs" +#define NID_id_regInfo_utf8Pairs 321 +#define OBJ_id_regInfo_utf8Pairs OBJ_id_regInfo,1L + +#define SN_id_regInfo_certReq "id-regInfo-certReq" +#define NID_id_regInfo_certReq 322 +#define OBJ_id_regInfo_certReq OBJ_id_regInfo,2L + +#define SN_id_alg_des40 "id-alg-des40" +#define NID_id_alg_des40 323 +#define OBJ_id_alg_des40 OBJ_id_alg,1L + +#define SN_id_alg_noSignature "id-alg-noSignature" +#define NID_id_alg_noSignature 324 +#define OBJ_id_alg_noSignature OBJ_id_alg,2L + +#define SN_id_alg_dh_sig_hmac_sha1 "id-alg-dh-sig-hmac-sha1" +#define NID_id_alg_dh_sig_hmac_sha1 325 +#define OBJ_id_alg_dh_sig_hmac_sha1 OBJ_id_alg,3L + +#define SN_id_alg_dh_pop "id-alg-dh-pop" +#define NID_id_alg_dh_pop 326 +#define OBJ_id_alg_dh_pop OBJ_id_alg,4L + +#define SN_id_cmc_statusInfo "id-cmc-statusInfo" +#define NID_id_cmc_statusInfo 327 +#define OBJ_id_cmc_statusInfo OBJ_id_cmc,1L + +#define SN_id_cmc_identification "id-cmc-identification" +#define NID_id_cmc_identification 328 +#define OBJ_id_cmc_identification OBJ_id_cmc,2L + +#define SN_id_cmc_identityProof "id-cmc-identityProof" +#define NID_id_cmc_identityProof 329 +#define OBJ_id_cmc_identityProof OBJ_id_cmc,3L + +#define SN_id_cmc_dataReturn "id-cmc-dataReturn" +#define NID_id_cmc_dataReturn 330 +#define OBJ_id_cmc_dataReturn OBJ_id_cmc,4L + +#define SN_id_cmc_transactionId "id-cmc-transactionId" +#define NID_id_cmc_transactionId 331 +#define OBJ_id_cmc_transactionId OBJ_id_cmc,5L + +#define SN_id_cmc_senderNonce "id-cmc-senderNonce" +#define NID_id_cmc_senderNonce 332 +#define OBJ_id_cmc_senderNonce OBJ_id_cmc,6L + +#define SN_id_cmc_recipientNonce "id-cmc-recipientNonce" +#define NID_id_cmc_recipientNonce 333 +#define OBJ_id_cmc_recipientNonce OBJ_id_cmc,7L + +#define SN_id_cmc_addExtensions "id-cmc-addExtensions" +#define NID_id_cmc_addExtensions 334 +#define OBJ_id_cmc_addExtensions OBJ_id_cmc,8L + +#define SN_id_cmc_encryptedPOP "id-cmc-encryptedPOP" +#define NID_id_cmc_encryptedPOP 335 +#define OBJ_id_cmc_encryptedPOP OBJ_id_cmc,9L + +#define SN_id_cmc_decryptedPOP "id-cmc-decryptedPOP" +#define NID_id_cmc_decryptedPOP 336 +#define OBJ_id_cmc_decryptedPOP OBJ_id_cmc,10L + +#define SN_id_cmc_lraPOPWitness "id-cmc-lraPOPWitness" +#define NID_id_cmc_lraPOPWitness 337 +#define OBJ_id_cmc_lraPOPWitness OBJ_id_cmc,11L + +#define SN_id_cmc_getCert "id-cmc-getCert" +#define NID_id_cmc_getCert 338 +#define OBJ_id_cmc_getCert OBJ_id_cmc,15L + +#define SN_id_cmc_getCRL "id-cmc-getCRL" +#define NID_id_cmc_getCRL 339 +#define OBJ_id_cmc_getCRL OBJ_id_cmc,16L + +#define SN_id_cmc_revokeRequest "id-cmc-revokeRequest" +#define NID_id_cmc_revokeRequest 340 +#define OBJ_id_cmc_revokeRequest OBJ_id_cmc,17L + +#define SN_id_cmc_regInfo "id-cmc-regInfo" +#define NID_id_cmc_regInfo 341 +#define OBJ_id_cmc_regInfo OBJ_id_cmc,18L + +#define SN_id_cmc_responseInfo "id-cmc-responseInfo" +#define NID_id_cmc_responseInfo 342 +#define OBJ_id_cmc_responseInfo OBJ_id_cmc,19L + +#define SN_id_cmc_queryPending "id-cmc-queryPending" +#define NID_id_cmc_queryPending 343 +#define OBJ_id_cmc_queryPending OBJ_id_cmc,21L + +#define SN_id_cmc_popLinkRandom "id-cmc-popLinkRandom" +#define NID_id_cmc_popLinkRandom 344 +#define OBJ_id_cmc_popLinkRandom OBJ_id_cmc,22L + +#define SN_id_cmc_popLinkWitness "id-cmc-popLinkWitness" +#define NID_id_cmc_popLinkWitness 345 +#define OBJ_id_cmc_popLinkWitness OBJ_id_cmc,23L + +#define SN_id_cmc_confirmCertAcceptance "id-cmc-confirmCertAcceptance" +#define NID_id_cmc_confirmCertAcceptance 346 +#define OBJ_id_cmc_confirmCertAcceptance OBJ_id_cmc,24L + +#define SN_id_on_personalData "id-on-personalData" +#define NID_id_on_personalData 347 +#define OBJ_id_on_personalData OBJ_id_on,1L + +#define SN_id_on_permanentIdentifier "id-on-permanentIdentifier" +#define LN_id_on_permanentIdentifier "Permanent Identifier" +#define NID_id_on_permanentIdentifier 858 +#define OBJ_id_on_permanentIdentifier OBJ_id_on,3L + +#define SN_id_pda_dateOfBirth "id-pda-dateOfBirth" +#define NID_id_pda_dateOfBirth 348 +#define OBJ_id_pda_dateOfBirth OBJ_id_pda,1L + +#define SN_id_pda_placeOfBirth "id-pda-placeOfBirth" +#define NID_id_pda_placeOfBirth 349 +#define OBJ_id_pda_placeOfBirth OBJ_id_pda,2L + +#define SN_id_pda_gender "id-pda-gender" +#define NID_id_pda_gender 351 +#define OBJ_id_pda_gender OBJ_id_pda,3L + +#define SN_id_pda_countryOfCitizenship "id-pda-countryOfCitizenship" +#define NID_id_pda_countryOfCitizenship 352 +#define OBJ_id_pda_countryOfCitizenship OBJ_id_pda,4L + +#define SN_id_pda_countryOfResidence "id-pda-countryOfResidence" +#define NID_id_pda_countryOfResidence 353 +#define OBJ_id_pda_countryOfResidence OBJ_id_pda,5L + +#define SN_id_aca_authenticationInfo "id-aca-authenticationInfo" +#define NID_id_aca_authenticationInfo 354 +#define OBJ_id_aca_authenticationInfo OBJ_id_aca,1L + +#define SN_id_aca_accessIdentity "id-aca-accessIdentity" +#define NID_id_aca_accessIdentity 355 +#define OBJ_id_aca_accessIdentity OBJ_id_aca,2L + +#define SN_id_aca_chargingIdentity "id-aca-chargingIdentity" +#define NID_id_aca_chargingIdentity 356 +#define OBJ_id_aca_chargingIdentity OBJ_id_aca,3L + +#define SN_id_aca_group "id-aca-group" +#define NID_id_aca_group 357 +#define OBJ_id_aca_group OBJ_id_aca,4L + +#define SN_id_aca_role "id-aca-role" +#define NID_id_aca_role 358 +#define OBJ_id_aca_role OBJ_id_aca,5L + +#define SN_id_aca_encAttrs "id-aca-encAttrs" +#define NID_id_aca_encAttrs 399 +#define OBJ_id_aca_encAttrs OBJ_id_aca,6L + +#define SN_id_qcs_pkixQCSyntax_v1 "id-qcs-pkixQCSyntax-v1" +#define NID_id_qcs_pkixQCSyntax_v1 359 +#define OBJ_id_qcs_pkixQCSyntax_v1 OBJ_id_qcs,1L + +#define SN_id_cct_crs "id-cct-crs" +#define NID_id_cct_crs 360 +#define OBJ_id_cct_crs OBJ_id_cct,1L + +#define SN_id_cct_PKIData "id-cct-PKIData" +#define NID_id_cct_PKIData 361 +#define OBJ_id_cct_PKIData OBJ_id_cct,2L + +#define SN_id_cct_PKIResponse "id-cct-PKIResponse" +#define NID_id_cct_PKIResponse 362 +#define OBJ_id_cct_PKIResponse OBJ_id_cct,3L + +#define SN_id_ppl_anyLanguage "id-ppl-anyLanguage" +#define LN_id_ppl_anyLanguage "Any language" +#define NID_id_ppl_anyLanguage 664 +#define OBJ_id_ppl_anyLanguage OBJ_id_ppl,0L + +#define SN_id_ppl_inheritAll "id-ppl-inheritAll" +#define LN_id_ppl_inheritAll "Inherit all" +#define NID_id_ppl_inheritAll 665 +#define OBJ_id_ppl_inheritAll OBJ_id_ppl,1L + +#define SN_Independent "id-ppl-independent" +#define LN_Independent "Independent" +#define NID_Independent 667 +#define OBJ_Independent OBJ_id_ppl,2L + +#define SN_ad_OCSP "OCSP" +#define LN_ad_OCSP "OCSP" +#define NID_ad_OCSP 178 +#define OBJ_ad_OCSP OBJ_id_ad,1L + +#define SN_ad_ca_issuers "caIssuers" +#define LN_ad_ca_issuers "CA Issuers" +#define NID_ad_ca_issuers 179 +#define OBJ_ad_ca_issuers OBJ_id_ad,2L + +#define SN_ad_timeStamping "ad_timestamping" +#define LN_ad_timeStamping "AD Time Stamping" +#define NID_ad_timeStamping 363 +#define OBJ_ad_timeStamping OBJ_id_ad,3L + +#define SN_ad_dvcs "AD_DVCS" +#define LN_ad_dvcs "ad dvcs" +#define NID_ad_dvcs 364 +#define OBJ_ad_dvcs OBJ_id_ad,4L + +#define SN_caRepository "caRepository" +#define LN_caRepository "CA Repository" +#define NID_caRepository 785 +#define OBJ_caRepository OBJ_id_ad,5L + +#define OBJ_id_pkix_OCSP OBJ_ad_OCSP + +#define SN_id_pkix_OCSP_basic "basicOCSPResponse" +#define LN_id_pkix_OCSP_basic "Basic OCSP Response" +#define NID_id_pkix_OCSP_basic 365 +#define OBJ_id_pkix_OCSP_basic OBJ_id_pkix_OCSP,1L + +#define SN_id_pkix_OCSP_Nonce "Nonce" +#define LN_id_pkix_OCSP_Nonce "OCSP Nonce" +#define NID_id_pkix_OCSP_Nonce 366 +#define OBJ_id_pkix_OCSP_Nonce OBJ_id_pkix_OCSP,2L + +#define SN_id_pkix_OCSP_CrlID "CrlID" +#define LN_id_pkix_OCSP_CrlID "OCSP CRL ID" +#define NID_id_pkix_OCSP_CrlID 367 +#define OBJ_id_pkix_OCSP_CrlID OBJ_id_pkix_OCSP,3L + +#define SN_id_pkix_OCSP_acceptableResponses "acceptableResponses" +#define LN_id_pkix_OCSP_acceptableResponses "Acceptable OCSP Responses" +#define NID_id_pkix_OCSP_acceptableResponses 368 +#define OBJ_id_pkix_OCSP_acceptableResponses OBJ_id_pkix_OCSP,4L + +#define SN_id_pkix_OCSP_noCheck "noCheck" +#define LN_id_pkix_OCSP_noCheck "OCSP No Check" +#define NID_id_pkix_OCSP_noCheck 369 +#define OBJ_id_pkix_OCSP_noCheck OBJ_id_pkix_OCSP,5L + +#define SN_id_pkix_OCSP_archiveCutoff "archiveCutoff" +#define LN_id_pkix_OCSP_archiveCutoff "OCSP Archive Cutoff" +#define NID_id_pkix_OCSP_archiveCutoff 370 +#define OBJ_id_pkix_OCSP_archiveCutoff OBJ_id_pkix_OCSP,6L + +#define SN_id_pkix_OCSP_serviceLocator "serviceLocator" +#define LN_id_pkix_OCSP_serviceLocator "OCSP Service Locator" +#define NID_id_pkix_OCSP_serviceLocator 371 +#define OBJ_id_pkix_OCSP_serviceLocator OBJ_id_pkix_OCSP,7L + +#define SN_id_pkix_OCSP_extendedStatus "extendedStatus" +#define LN_id_pkix_OCSP_extendedStatus "Extended OCSP Status" +#define NID_id_pkix_OCSP_extendedStatus 372 +#define OBJ_id_pkix_OCSP_extendedStatus OBJ_id_pkix_OCSP,8L + +#define SN_id_pkix_OCSP_valid "valid" +#define NID_id_pkix_OCSP_valid 373 +#define OBJ_id_pkix_OCSP_valid OBJ_id_pkix_OCSP,9L + +#define SN_id_pkix_OCSP_path "path" +#define NID_id_pkix_OCSP_path 374 +#define OBJ_id_pkix_OCSP_path OBJ_id_pkix_OCSP,10L + +#define SN_id_pkix_OCSP_trustRoot "trustRoot" +#define LN_id_pkix_OCSP_trustRoot "Trust Root" +#define NID_id_pkix_OCSP_trustRoot 375 +#define OBJ_id_pkix_OCSP_trustRoot OBJ_id_pkix_OCSP,11L + +#define SN_algorithm "algorithm" +#define LN_algorithm "algorithm" +#define NID_algorithm 376 +#define OBJ_algorithm 1L,3L,14L,3L,2L + +#define SN_md5WithRSA "RSA-NP-MD5" +#define LN_md5WithRSA "md5WithRSA" +#define NID_md5WithRSA 104 +#define OBJ_md5WithRSA OBJ_algorithm,3L + +#define SN_des_ecb "DES-ECB" +#define LN_des_ecb "des-ecb" +#define NID_des_ecb 29 +#define OBJ_des_ecb OBJ_algorithm,6L + +#define SN_des_cbc "DES-CBC" +#define LN_des_cbc "des-cbc" +#define NID_des_cbc 31 +#define OBJ_des_cbc OBJ_algorithm,7L + +#define SN_des_ofb64 "DES-OFB" +#define LN_des_ofb64 "des-ofb" +#define NID_des_ofb64 45 +#define OBJ_des_ofb64 OBJ_algorithm,8L + +#define SN_des_cfb64 "DES-CFB" +#define LN_des_cfb64 "des-cfb" +#define NID_des_cfb64 30 +#define OBJ_des_cfb64 OBJ_algorithm,9L + +#define SN_rsaSignature "rsaSignature" +#define NID_rsaSignature 377 +#define OBJ_rsaSignature OBJ_algorithm,11L + +#define SN_dsa_2 "DSA-old" +#define LN_dsa_2 "dsaEncryption-old" +#define NID_dsa_2 67 +#define OBJ_dsa_2 OBJ_algorithm,12L + +#define SN_dsaWithSHA "DSA-SHA" +#define LN_dsaWithSHA "dsaWithSHA" +#define NID_dsaWithSHA 66 +#define OBJ_dsaWithSHA OBJ_algorithm,13L + +#define SN_shaWithRSAEncryption "RSA-SHA" +#define LN_shaWithRSAEncryption "shaWithRSAEncryption" +#define NID_shaWithRSAEncryption 42 +#define OBJ_shaWithRSAEncryption OBJ_algorithm,15L + +#define SN_des_ede_ecb "DES-EDE" +#define LN_des_ede_ecb "des-ede" +#define NID_des_ede_ecb 32 +#define OBJ_des_ede_ecb OBJ_algorithm,17L + +#define SN_des_ede3_ecb "DES-EDE3" +#define LN_des_ede3_ecb "des-ede3" +#define NID_des_ede3_ecb 33 + +#define SN_des_ede_cbc "DES-EDE-CBC" +#define LN_des_ede_cbc "des-ede-cbc" +#define NID_des_ede_cbc 43 + +#define SN_des_ede_cfb64 "DES-EDE-CFB" +#define LN_des_ede_cfb64 "des-ede-cfb" +#define NID_des_ede_cfb64 60 + +#define SN_des_ede3_cfb64 "DES-EDE3-CFB" +#define LN_des_ede3_cfb64 "des-ede3-cfb" +#define NID_des_ede3_cfb64 61 + +#define SN_des_ede_ofb64 "DES-EDE-OFB" +#define LN_des_ede_ofb64 "des-ede-ofb" +#define NID_des_ede_ofb64 62 + +#define SN_des_ede3_ofb64 "DES-EDE3-OFB" +#define LN_des_ede3_ofb64 "des-ede3-ofb" +#define NID_des_ede3_ofb64 63 + +#define SN_desx_cbc "DESX-CBC" +#define LN_desx_cbc "desx-cbc" +#define NID_desx_cbc 80 + +#define SN_sha "SHA" +#define LN_sha "sha" +#define NID_sha 41 +#define OBJ_sha OBJ_algorithm,18L + +#define SN_sha1 "SHA1" +#define LN_sha1 "sha1" +#define NID_sha1 64 +#define OBJ_sha1 OBJ_algorithm,26L + +#define SN_dsaWithSHA1_2 "DSA-SHA1-old" +#define LN_dsaWithSHA1_2 "dsaWithSHA1-old" +#define NID_dsaWithSHA1_2 70 +#define OBJ_dsaWithSHA1_2 OBJ_algorithm,27L + +#define SN_sha1WithRSA "RSA-SHA1-2" +#define LN_sha1WithRSA "sha1WithRSA" +#define NID_sha1WithRSA 115 +#define OBJ_sha1WithRSA OBJ_algorithm,29L + +#define SN_ripemd160 "RIPEMD160" +#define LN_ripemd160 "ripemd160" +#define NID_ripemd160 117 +#define OBJ_ripemd160 1L,3L,36L,3L,2L,1L + +#define SN_ripemd160WithRSA "RSA-RIPEMD160" +#define LN_ripemd160WithRSA "ripemd160WithRSA" +#define NID_ripemd160WithRSA 119 +#define OBJ_ripemd160WithRSA 1L,3L,36L,3L,3L,1L,2L + +#define SN_blake2b512 "BLAKE2b512" +#define LN_blake2b512 "blake2b512" +#define NID_blake2b512 1056 +#define OBJ_blake2b512 1L,3L,6L,1L,4L,1L,1722L,12L,2L,1L,16L + +#define SN_blake2s256 "BLAKE2s256" +#define LN_blake2s256 "blake2s256" +#define NID_blake2s256 1057 +#define OBJ_blake2s256 1L,3L,6L,1L,4L,1L,1722L,12L,2L,2L,8L + +#define SN_sxnet "SXNetID" +#define LN_sxnet "Strong Extranet ID" +#define NID_sxnet 143 +#define OBJ_sxnet 1L,3L,101L,1L,4L,1L + +#define SN_X500 "X500" +#define LN_X500 "directory services (X.500)" +#define NID_X500 11 +#define OBJ_X500 2L,5L + +#define SN_X509 "X509" +#define NID_X509 12 +#define OBJ_X509 OBJ_X500,4L + +#define SN_commonName "CN" +#define LN_commonName "commonName" +#define NID_commonName 13 +#define OBJ_commonName OBJ_X509,3L + +#define SN_surname "SN" +#define LN_surname "surname" +#define NID_surname 100 +#define OBJ_surname OBJ_X509,4L + +#define LN_serialNumber "serialNumber" +#define NID_serialNumber 105 +#define OBJ_serialNumber OBJ_X509,5L + +#define SN_countryName "C" +#define LN_countryName "countryName" +#define NID_countryName 14 +#define OBJ_countryName OBJ_X509,6L + +#define SN_localityName "L" +#define LN_localityName "localityName" +#define NID_localityName 15 +#define OBJ_localityName OBJ_X509,7L + +#define SN_stateOrProvinceName "ST" +#define LN_stateOrProvinceName "stateOrProvinceName" +#define NID_stateOrProvinceName 16 +#define OBJ_stateOrProvinceName OBJ_X509,8L + +#define SN_streetAddress "street" +#define LN_streetAddress "streetAddress" +#define NID_streetAddress 660 +#define OBJ_streetAddress OBJ_X509,9L + +#define SN_organizationName "O" +#define LN_organizationName "organizationName" +#define NID_organizationName 17 +#define OBJ_organizationName OBJ_X509,10L + +#define SN_organizationalUnitName "OU" +#define LN_organizationalUnitName "organizationalUnitName" +#define NID_organizationalUnitName 18 +#define OBJ_organizationalUnitName OBJ_X509,11L + +#define SN_title "title" +#define LN_title "title" +#define NID_title 106 +#define OBJ_title OBJ_X509,12L + +#define LN_description "description" +#define NID_description 107 +#define OBJ_description OBJ_X509,13L + +#define LN_searchGuide "searchGuide" +#define NID_searchGuide 859 +#define OBJ_searchGuide OBJ_X509,14L + +#define LN_businessCategory "businessCategory" +#define NID_businessCategory 860 +#define OBJ_businessCategory OBJ_X509,15L + +#define LN_postalAddress "postalAddress" +#define NID_postalAddress 861 +#define OBJ_postalAddress OBJ_X509,16L + +#define LN_postalCode "postalCode" +#define NID_postalCode 661 +#define OBJ_postalCode OBJ_X509,17L + +#define LN_postOfficeBox "postOfficeBox" +#define NID_postOfficeBox 862 +#define OBJ_postOfficeBox OBJ_X509,18L + +#define LN_physicalDeliveryOfficeName "physicalDeliveryOfficeName" +#define NID_physicalDeliveryOfficeName 863 +#define OBJ_physicalDeliveryOfficeName OBJ_X509,19L + +#define LN_telephoneNumber "telephoneNumber" +#define NID_telephoneNumber 864 +#define OBJ_telephoneNumber OBJ_X509,20L + +#define LN_telexNumber "telexNumber" +#define NID_telexNumber 865 +#define OBJ_telexNumber OBJ_X509,21L + +#define LN_teletexTerminalIdentifier "teletexTerminalIdentifier" +#define NID_teletexTerminalIdentifier 866 +#define OBJ_teletexTerminalIdentifier OBJ_X509,22L + +#define LN_facsimileTelephoneNumber "facsimileTelephoneNumber" +#define NID_facsimileTelephoneNumber 867 +#define OBJ_facsimileTelephoneNumber OBJ_X509,23L + +#define LN_x121Address "x121Address" +#define NID_x121Address 868 +#define OBJ_x121Address OBJ_X509,24L + +#define LN_internationaliSDNNumber "internationaliSDNNumber" +#define NID_internationaliSDNNumber 869 +#define OBJ_internationaliSDNNumber OBJ_X509,25L + +#define LN_registeredAddress "registeredAddress" +#define NID_registeredAddress 870 +#define OBJ_registeredAddress OBJ_X509,26L + +#define LN_destinationIndicator "destinationIndicator" +#define NID_destinationIndicator 871 +#define OBJ_destinationIndicator OBJ_X509,27L + +#define LN_preferredDeliveryMethod "preferredDeliveryMethod" +#define NID_preferredDeliveryMethod 872 +#define OBJ_preferredDeliveryMethod OBJ_X509,28L + +#define LN_presentationAddress "presentationAddress" +#define NID_presentationAddress 873 +#define OBJ_presentationAddress OBJ_X509,29L + +#define LN_supportedApplicationContext "supportedApplicationContext" +#define NID_supportedApplicationContext 874 +#define OBJ_supportedApplicationContext OBJ_X509,30L + +#define SN_member "member" +#define NID_member 875 +#define OBJ_member OBJ_X509,31L + +#define SN_owner "owner" +#define NID_owner 876 +#define OBJ_owner OBJ_X509,32L + +#define LN_roleOccupant "roleOccupant" +#define NID_roleOccupant 877 +#define OBJ_roleOccupant OBJ_X509,33L + +#define SN_seeAlso "seeAlso" +#define NID_seeAlso 878 +#define OBJ_seeAlso OBJ_X509,34L + +#define LN_userPassword "userPassword" +#define NID_userPassword 879 +#define OBJ_userPassword OBJ_X509,35L + +#define LN_userCertificate "userCertificate" +#define NID_userCertificate 880 +#define OBJ_userCertificate OBJ_X509,36L + +#define LN_cACertificate "cACertificate" +#define NID_cACertificate 881 +#define OBJ_cACertificate OBJ_X509,37L + +#define LN_authorityRevocationList "authorityRevocationList" +#define NID_authorityRevocationList 882 +#define OBJ_authorityRevocationList OBJ_X509,38L + +#define LN_certificateRevocationList "certificateRevocationList" +#define NID_certificateRevocationList 883 +#define OBJ_certificateRevocationList OBJ_X509,39L + +#define LN_crossCertificatePair "crossCertificatePair" +#define NID_crossCertificatePair 884 +#define OBJ_crossCertificatePair OBJ_X509,40L + +#define SN_name "name" +#define LN_name "name" +#define NID_name 173 +#define OBJ_name OBJ_X509,41L + +#define SN_givenName "GN" +#define LN_givenName "givenName" +#define NID_givenName 99 +#define OBJ_givenName OBJ_X509,42L + +#define SN_initials "initials" +#define LN_initials "initials" +#define NID_initials 101 +#define OBJ_initials OBJ_X509,43L + +#define LN_generationQualifier "generationQualifier" +#define NID_generationQualifier 509 +#define OBJ_generationQualifier OBJ_X509,44L + +#define LN_x500UniqueIdentifier "x500UniqueIdentifier" +#define NID_x500UniqueIdentifier 503 +#define OBJ_x500UniqueIdentifier OBJ_X509,45L + +#define SN_dnQualifier "dnQualifier" +#define LN_dnQualifier "dnQualifier" +#define NID_dnQualifier 174 +#define OBJ_dnQualifier OBJ_X509,46L + +#define LN_enhancedSearchGuide "enhancedSearchGuide" +#define NID_enhancedSearchGuide 885 +#define OBJ_enhancedSearchGuide OBJ_X509,47L + +#define LN_protocolInformation "protocolInformation" +#define NID_protocolInformation 886 +#define OBJ_protocolInformation OBJ_X509,48L + +#define LN_distinguishedName "distinguishedName" +#define NID_distinguishedName 887 +#define OBJ_distinguishedName OBJ_X509,49L + +#define LN_uniqueMember "uniqueMember" +#define NID_uniqueMember 888 +#define OBJ_uniqueMember OBJ_X509,50L + +#define LN_houseIdentifier "houseIdentifier" +#define NID_houseIdentifier 889 +#define OBJ_houseIdentifier OBJ_X509,51L + +#define LN_supportedAlgorithms "supportedAlgorithms" +#define NID_supportedAlgorithms 890 +#define OBJ_supportedAlgorithms OBJ_X509,52L + +#define LN_deltaRevocationList "deltaRevocationList" +#define NID_deltaRevocationList 891 +#define OBJ_deltaRevocationList OBJ_X509,53L + +#define SN_dmdName "dmdName" +#define NID_dmdName 892 +#define OBJ_dmdName OBJ_X509,54L + +#define LN_pseudonym "pseudonym" +#define NID_pseudonym 510 +#define OBJ_pseudonym OBJ_X509,65L + +#define SN_role "role" +#define LN_role "role" +#define NID_role 400 +#define OBJ_role OBJ_X509,72L + +#define LN_organizationIdentifier "organizationIdentifier" +#define NID_organizationIdentifier 1089 +#define OBJ_organizationIdentifier OBJ_X509,97L + +#define SN_countryCode3c "c3" +#define LN_countryCode3c "countryCode3c" +#define NID_countryCode3c 1090 +#define OBJ_countryCode3c OBJ_X509,98L + +#define SN_countryCode3n "n3" +#define LN_countryCode3n "countryCode3n" +#define NID_countryCode3n 1091 +#define OBJ_countryCode3n OBJ_X509,99L + +#define LN_dnsName "dnsName" +#define NID_dnsName 1092 +#define OBJ_dnsName OBJ_X509,100L + +#define SN_X500algorithms "X500algorithms" +#define LN_X500algorithms "directory services - algorithms" +#define NID_X500algorithms 378 +#define OBJ_X500algorithms OBJ_X500,8L + +#define SN_rsa "RSA" +#define LN_rsa "rsa" +#define NID_rsa 19 +#define OBJ_rsa OBJ_X500algorithms,1L,1L + +#define SN_mdc2WithRSA "RSA-MDC2" +#define LN_mdc2WithRSA "mdc2WithRSA" +#define NID_mdc2WithRSA 96 +#define OBJ_mdc2WithRSA OBJ_X500algorithms,3L,100L + +#define SN_mdc2 "MDC2" +#define LN_mdc2 "mdc2" +#define NID_mdc2 95 +#define OBJ_mdc2 OBJ_X500algorithms,3L,101L + +#define SN_id_ce "id-ce" +#define NID_id_ce 81 +#define OBJ_id_ce OBJ_X500,29L + +#define SN_subject_directory_attributes "subjectDirectoryAttributes" +#define LN_subject_directory_attributes "X509v3 Subject Directory Attributes" +#define NID_subject_directory_attributes 769 +#define OBJ_subject_directory_attributes OBJ_id_ce,9L + +#define SN_subject_key_identifier "subjectKeyIdentifier" +#define LN_subject_key_identifier "X509v3 Subject Key Identifier" +#define NID_subject_key_identifier 82 +#define OBJ_subject_key_identifier OBJ_id_ce,14L + +#define SN_key_usage "keyUsage" +#define LN_key_usage "X509v3 Key Usage" +#define NID_key_usage 83 +#define OBJ_key_usage OBJ_id_ce,15L + +#define SN_private_key_usage_period "privateKeyUsagePeriod" +#define LN_private_key_usage_period "X509v3 Private Key Usage Period" +#define NID_private_key_usage_period 84 +#define OBJ_private_key_usage_period OBJ_id_ce,16L + +#define SN_subject_alt_name "subjectAltName" +#define LN_subject_alt_name "X509v3 Subject Alternative Name" +#define NID_subject_alt_name 85 +#define OBJ_subject_alt_name OBJ_id_ce,17L + +#define SN_issuer_alt_name "issuerAltName" +#define LN_issuer_alt_name "X509v3 Issuer Alternative Name" +#define NID_issuer_alt_name 86 +#define OBJ_issuer_alt_name OBJ_id_ce,18L + +#define SN_basic_constraints "basicConstraints" +#define LN_basic_constraints "X509v3 Basic Constraints" +#define NID_basic_constraints 87 +#define OBJ_basic_constraints OBJ_id_ce,19L + +#define SN_crl_number "crlNumber" +#define LN_crl_number "X509v3 CRL Number" +#define NID_crl_number 88 +#define OBJ_crl_number OBJ_id_ce,20L + +#define SN_crl_reason "CRLReason" +#define LN_crl_reason "X509v3 CRL Reason Code" +#define NID_crl_reason 141 +#define OBJ_crl_reason OBJ_id_ce,21L + +#define SN_invalidity_date "invalidityDate" +#define LN_invalidity_date "Invalidity Date" +#define NID_invalidity_date 142 +#define OBJ_invalidity_date OBJ_id_ce,24L + +#define SN_delta_crl "deltaCRL" +#define LN_delta_crl "X509v3 Delta CRL Indicator" +#define NID_delta_crl 140 +#define OBJ_delta_crl OBJ_id_ce,27L + +#define SN_issuing_distribution_point "issuingDistributionPoint" +#define LN_issuing_distribution_point "X509v3 Issuing Distribution Point" +#define NID_issuing_distribution_point 770 +#define OBJ_issuing_distribution_point OBJ_id_ce,28L + +#define SN_certificate_issuer "certificateIssuer" +#define LN_certificate_issuer "X509v3 Certificate Issuer" +#define NID_certificate_issuer 771 +#define OBJ_certificate_issuer OBJ_id_ce,29L + +#define SN_name_constraints "nameConstraints" +#define LN_name_constraints "X509v3 Name Constraints" +#define NID_name_constraints 666 +#define OBJ_name_constraints OBJ_id_ce,30L + +#define SN_crl_distribution_points "crlDistributionPoints" +#define LN_crl_distribution_points "X509v3 CRL Distribution Points" +#define NID_crl_distribution_points 103 +#define OBJ_crl_distribution_points OBJ_id_ce,31L + +#define SN_certificate_policies "certificatePolicies" +#define LN_certificate_policies "X509v3 Certificate Policies" +#define NID_certificate_policies 89 +#define OBJ_certificate_policies OBJ_id_ce,32L + +#define SN_any_policy "anyPolicy" +#define LN_any_policy "X509v3 Any Policy" +#define NID_any_policy 746 +#define OBJ_any_policy OBJ_certificate_policies,0L + +#define SN_policy_mappings "policyMappings" +#define LN_policy_mappings "X509v3 Policy Mappings" +#define NID_policy_mappings 747 +#define OBJ_policy_mappings OBJ_id_ce,33L + +#define SN_authority_key_identifier "authorityKeyIdentifier" +#define LN_authority_key_identifier "X509v3 Authority Key Identifier" +#define NID_authority_key_identifier 90 +#define OBJ_authority_key_identifier OBJ_id_ce,35L + +#define SN_policy_constraints "policyConstraints" +#define LN_policy_constraints "X509v3 Policy Constraints" +#define NID_policy_constraints 401 +#define OBJ_policy_constraints OBJ_id_ce,36L + +#define SN_ext_key_usage "extendedKeyUsage" +#define LN_ext_key_usage "X509v3 Extended Key Usage" +#define NID_ext_key_usage 126 +#define OBJ_ext_key_usage OBJ_id_ce,37L + +#define SN_freshest_crl "freshestCRL" +#define LN_freshest_crl "X509v3 Freshest CRL" +#define NID_freshest_crl 857 +#define OBJ_freshest_crl OBJ_id_ce,46L + +#define SN_inhibit_any_policy "inhibitAnyPolicy" +#define LN_inhibit_any_policy "X509v3 Inhibit Any Policy" +#define NID_inhibit_any_policy 748 +#define OBJ_inhibit_any_policy OBJ_id_ce,54L + +#define SN_target_information "targetInformation" +#define LN_target_information "X509v3 AC Targeting" +#define NID_target_information 402 +#define OBJ_target_information OBJ_id_ce,55L + +#define SN_no_rev_avail "noRevAvail" +#define LN_no_rev_avail "X509v3 No Revocation Available" +#define NID_no_rev_avail 403 +#define OBJ_no_rev_avail OBJ_id_ce,56L + +#define SN_anyExtendedKeyUsage "anyExtendedKeyUsage" +#define LN_anyExtendedKeyUsage "Any Extended Key Usage" +#define NID_anyExtendedKeyUsage 910 +#define OBJ_anyExtendedKeyUsage OBJ_ext_key_usage,0L + +#define SN_netscape "Netscape" +#define LN_netscape "Netscape Communications Corp." +#define NID_netscape 57 +#define OBJ_netscape 2L,16L,840L,1L,113730L + +#define SN_netscape_cert_extension "nsCertExt" +#define LN_netscape_cert_extension "Netscape Certificate Extension" +#define NID_netscape_cert_extension 58 +#define OBJ_netscape_cert_extension OBJ_netscape,1L + +#define SN_netscape_data_type "nsDataType" +#define LN_netscape_data_type "Netscape Data Type" +#define NID_netscape_data_type 59 +#define OBJ_netscape_data_type OBJ_netscape,2L + +#define SN_netscape_cert_type "nsCertType" +#define LN_netscape_cert_type "Netscape Cert Type" +#define NID_netscape_cert_type 71 +#define OBJ_netscape_cert_type OBJ_netscape_cert_extension,1L + +#define SN_netscape_base_url "nsBaseUrl" +#define LN_netscape_base_url "Netscape Base Url" +#define NID_netscape_base_url 72 +#define OBJ_netscape_base_url OBJ_netscape_cert_extension,2L + +#define SN_netscape_revocation_url "nsRevocationUrl" +#define LN_netscape_revocation_url "Netscape Revocation Url" +#define NID_netscape_revocation_url 73 +#define OBJ_netscape_revocation_url OBJ_netscape_cert_extension,3L + +#define SN_netscape_ca_revocation_url "nsCaRevocationUrl" +#define LN_netscape_ca_revocation_url "Netscape CA Revocation Url" +#define NID_netscape_ca_revocation_url 74 +#define OBJ_netscape_ca_revocation_url OBJ_netscape_cert_extension,4L + +#define SN_netscape_renewal_url "nsRenewalUrl" +#define LN_netscape_renewal_url "Netscape Renewal Url" +#define NID_netscape_renewal_url 75 +#define OBJ_netscape_renewal_url OBJ_netscape_cert_extension,7L + +#define SN_netscape_ca_policy_url "nsCaPolicyUrl" +#define LN_netscape_ca_policy_url "Netscape CA Policy Url" +#define NID_netscape_ca_policy_url 76 +#define OBJ_netscape_ca_policy_url OBJ_netscape_cert_extension,8L + +#define SN_netscape_ssl_server_name "nsSslServerName" +#define LN_netscape_ssl_server_name "Netscape SSL Server Name" +#define NID_netscape_ssl_server_name 77 +#define OBJ_netscape_ssl_server_name OBJ_netscape_cert_extension,12L + +#define SN_netscape_comment "nsComment" +#define LN_netscape_comment "Netscape Comment" +#define NID_netscape_comment 78 +#define OBJ_netscape_comment OBJ_netscape_cert_extension,13L + +#define SN_netscape_cert_sequence "nsCertSequence" +#define LN_netscape_cert_sequence "Netscape Certificate Sequence" +#define NID_netscape_cert_sequence 79 +#define OBJ_netscape_cert_sequence OBJ_netscape_data_type,5L + +#define SN_ns_sgc "nsSGC" +#define LN_ns_sgc "Netscape Server Gated Crypto" +#define NID_ns_sgc 139 +#define OBJ_ns_sgc OBJ_netscape,4L,1L + +#define SN_org "ORG" +#define LN_org "org" +#define NID_org 379 +#define OBJ_org OBJ_iso,3L + +#define SN_dod "DOD" +#define LN_dod "dod" +#define NID_dod 380 +#define OBJ_dod OBJ_org,6L + +#define SN_iana "IANA" +#define LN_iana "iana" +#define NID_iana 381 +#define OBJ_iana OBJ_dod,1L + +#define OBJ_internet OBJ_iana + +#define SN_Directory "directory" +#define LN_Directory "Directory" +#define NID_Directory 382 +#define OBJ_Directory OBJ_internet,1L + +#define SN_Management "mgmt" +#define LN_Management "Management" +#define NID_Management 383 +#define OBJ_Management OBJ_internet,2L + +#define SN_Experimental "experimental" +#define LN_Experimental "Experimental" +#define NID_Experimental 384 +#define OBJ_Experimental OBJ_internet,3L + +#define SN_Private "private" +#define LN_Private "Private" +#define NID_Private 385 +#define OBJ_Private OBJ_internet,4L + +#define SN_Security "security" +#define LN_Security "Security" +#define NID_Security 386 +#define OBJ_Security OBJ_internet,5L + +#define SN_SNMPv2 "snmpv2" +#define LN_SNMPv2 "SNMPv2" +#define NID_SNMPv2 387 +#define OBJ_SNMPv2 OBJ_internet,6L + +#define LN_Mail "Mail" +#define NID_Mail 388 +#define OBJ_Mail OBJ_internet,7L + +#define SN_Enterprises "enterprises" +#define LN_Enterprises "Enterprises" +#define NID_Enterprises 389 +#define OBJ_Enterprises OBJ_Private,1L + +#define SN_dcObject "dcobject" +#define LN_dcObject "dcObject" +#define NID_dcObject 390 +#define OBJ_dcObject OBJ_Enterprises,1466L,344L + +#define SN_mime_mhs "mime-mhs" +#define LN_mime_mhs "MIME MHS" +#define NID_mime_mhs 504 +#define OBJ_mime_mhs OBJ_Mail,1L + +#define SN_mime_mhs_headings "mime-mhs-headings" +#define LN_mime_mhs_headings "mime-mhs-headings" +#define NID_mime_mhs_headings 505 +#define OBJ_mime_mhs_headings OBJ_mime_mhs,1L + +#define SN_mime_mhs_bodies "mime-mhs-bodies" +#define LN_mime_mhs_bodies "mime-mhs-bodies" +#define NID_mime_mhs_bodies 506 +#define OBJ_mime_mhs_bodies OBJ_mime_mhs,2L + +#define SN_id_hex_partial_message "id-hex-partial-message" +#define LN_id_hex_partial_message "id-hex-partial-message" +#define NID_id_hex_partial_message 507 +#define OBJ_id_hex_partial_message OBJ_mime_mhs_headings,1L + +#define SN_id_hex_multipart_message "id-hex-multipart-message" +#define LN_id_hex_multipart_message "id-hex-multipart-message" +#define NID_id_hex_multipart_message 508 +#define OBJ_id_hex_multipart_message OBJ_mime_mhs_headings,2L + +#define SN_zlib_compression "ZLIB" +#define LN_zlib_compression "zlib compression" +#define NID_zlib_compression 125 +#define OBJ_zlib_compression OBJ_id_smime_alg,8L + +#define OBJ_csor 2L,16L,840L,1L,101L,3L + +#define OBJ_nistAlgorithms OBJ_csor,4L + +#define OBJ_aes OBJ_nistAlgorithms,1L + +#define SN_aes_128_ecb "AES-128-ECB" +#define LN_aes_128_ecb "aes-128-ecb" +#define NID_aes_128_ecb 418 +#define OBJ_aes_128_ecb OBJ_aes,1L + +#define SN_aes_128_cbc "AES-128-CBC" +#define LN_aes_128_cbc "aes-128-cbc" +#define NID_aes_128_cbc 419 +#define OBJ_aes_128_cbc OBJ_aes,2L + +#define SN_aes_128_ofb128 "AES-128-OFB" +#define LN_aes_128_ofb128 "aes-128-ofb" +#define NID_aes_128_ofb128 420 +#define OBJ_aes_128_ofb128 OBJ_aes,3L + +#define SN_aes_128_cfb128 "AES-128-CFB" +#define LN_aes_128_cfb128 "aes-128-cfb" +#define NID_aes_128_cfb128 421 +#define OBJ_aes_128_cfb128 OBJ_aes,4L + +#define SN_id_aes128_wrap "id-aes128-wrap" +#define NID_id_aes128_wrap 788 +#define OBJ_id_aes128_wrap OBJ_aes,5L + +#define SN_aes_128_gcm "id-aes128-GCM" +#define LN_aes_128_gcm "aes-128-gcm" +#define NID_aes_128_gcm 895 +#define OBJ_aes_128_gcm OBJ_aes,6L + +#define SN_aes_128_ccm "id-aes128-CCM" +#define LN_aes_128_ccm "aes-128-ccm" +#define NID_aes_128_ccm 896 +#define OBJ_aes_128_ccm OBJ_aes,7L + +#define SN_id_aes128_wrap_pad "id-aes128-wrap-pad" +#define NID_id_aes128_wrap_pad 897 +#define OBJ_id_aes128_wrap_pad OBJ_aes,8L + +#define SN_aes_192_ecb "AES-192-ECB" +#define LN_aes_192_ecb "aes-192-ecb" +#define NID_aes_192_ecb 422 +#define OBJ_aes_192_ecb OBJ_aes,21L + +#define SN_aes_192_cbc "AES-192-CBC" +#define LN_aes_192_cbc "aes-192-cbc" +#define NID_aes_192_cbc 423 +#define OBJ_aes_192_cbc OBJ_aes,22L + +#define SN_aes_192_ofb128 "AES-192-OFB" +#define LN_aes_192_ofb128 "aes-192-ofb" +#define NID_aes_192_ofb128 424 +#define OBJ_aes_192_ofb128 OBJ_aes,23L + +#define SN_aes_192_cfb128 "AES-192-CFB" +#define LN_aes_192_cfb128 "aes-192-cfb" +#define NID_aes_192_cfb128 425 +#define OBJ_aes_192_cfb128 OBJ_aes,24L + +#define SN_id_aes192_wrap "id-aes192-wrap" +#define NID_id_aes192_wrap 789 +#define OBJ_id_aes192_wrap OBJ_aes,25L + +#define SN_aes_192_gcm "id-aes192-GCM" +#define LN_aes_192_gcm "aes-192-gcm" +#define NID_aes_192_gcm 898 +#define OBJ_aes_192_gcm OBJ_aes,26L + +#define SN_aes_192_ccm "id-aes192-CCM" +#define LN_aes_192_ccm "aes-192-ccm" +#define NID_aes_192_ccm 899 +#define OBJ_aes_192_ccm OBJ_aes,27L + +#define SN_id_aes192_wrap_pad "id-aes192-wrap-pad" +#define NID_id_aes192_wrap_pad 900 +#define OBJ_id_aes192_wrap_pad OBJ_aes,28L + +#define SN_aes_256_ecb "AES-256-ECB" +#define LN_aes_256_ecb "aes-256-ecb" +#define NID_aes_256_ecb 426 +#define OBJ_aes_256_ecb OBJ_aes,41L + +#define SN_aes_256_cbc "AES-256-CBC" +#define LN_aes_256_cbc "aes-256-cbc" +#define NID_aes_256_cbc 427 +#define OBJ_aes_256_cbc OBJ_aes,42L + +#define SN_aes_256_ofb128 "AES-256-OFB" +#define LN_aes_256_ofb128 "aes-256-ofb" +#define NID_aes_256_ofb128 428 +#define OBJ_aes_256_ofb128 OBJ_aes,43L + +#define SN_aes_256_cfb128 "AES-256-CFB" +#define LN_aes_256_cfb128 "aes-256-cfb" +#define NID_aes_256_cfb128 429 +#define OBJ_aes_256_cfb128 OBJ_aes,44L + +#define SN_id_aes256_wrap "id-aes256-wrap" +#define NID_id_aes256_wrap 790 +#define OBJ_id_aes256_wrap OBJ_aes,45L + +#define SN_aes_256_gcm "id-aes256-GCM" +#define LN_aes_256_gcm "aes-256-gcm" +#define NID_aes_256_gcm 901 +#define OBJ_aes_256_gcm OBJ_aes,46L + +#define SN_aes_256_ccm "id-aes256-CCM" +#define LN_aes_256_ccm "aes-256-ccm" +#define NID_aes_256_ccm 902 +#define OBJ_aes_256_ccm OBJ_aes,47L + +#define SN_id_aes256_wrap_pad "id-aes256-wrap-pad" +#define NID_id_aes256_wrap_pad 903 +#define OBJ_id_aes256_wrap_pad OBJ_aes,48L + +#define SN_aes_128_xts "AES-128-XTS" +#define LN_aes_128_xts "aes-128-xts" +#define NID_aes_128_xts 913 +#define OBJ_aes_128_xts OBJ_ieee_siswg,0L,1L,1L + +#define SN_aes_256_xts "AES-256-XTS" +#define LN_aes_256_xts "aes-256-xts" +#define NID_aes_256_xts 914 +#define OBJ_aes_256_xts OBJ_ieee_siswg,0L,1L,2L + +#define SN_aes_128_cfb1 "AES-128-CFB1" +#define LN_aes_128_cfb1 "aes-128-cfb1" +#define NID_aes_128_cfb1 650 + +#define SN_aes_192_cfb1 "AES-192-CFB1" +#define LN_aes_192_cfb1 "aes-192-cfb1" +#define NID_aes_192_cfb1 651 + +#define SN_aes_256_cfb1 "AES-256-CFB1" +#define LN_aes_256_cfb1 "aes-256-cfb1" +#define NID_aes_256_cfb1 652 + +#define SN_aes_128_cfb8 "AES-128-CFB8" +#define LN_aes_128_cfb8 "aes-128-cfb8" +#define NID_aes_128_cfb8 653 + +#define SN_aes_192_cfb8 "AES-192-CFB8" +#define LN_aes_192_cfb8 "aes-192-cfb8" +#define NID_aes_192_cfb8 654 + +#define SN_aes_256_cfb8 "AES-256-CFB8" +#define LN_aes_256_cfb8 "aes-256-cfb8" +#define NID_aes_256_cfb8 655 + +#define SN_aes_128_ctr "AES-128-CTR" +#define LN_aes_128_ctr "aes-128-ctr" +#define NID_aes_128_ctr 904 + +#define SN_aes_192_ctr "AES-192-CTR" +#define LN_aes_192_ctr "aes-192-ctr" +#define NID_aes_192_ctr 905 + +#define SN_aes_256_ctr "AES-256-CTR" +#define LN_aes_256_ctr "aes-256-ctr" +#define NID_aes_256_ctr 906 + +#define SN_aes_128_ocb "AES-128-OCB" +#define LN_aes_128_ocb "aes-128-ocb" +#define NID_aes_128_ocb 958 + +#define SN_aes_192_ocb "AES-192-OCB" +#define LN_aes_192_ocb "aes-192-ocb" +#define NID_aes_192_ocb 959 + +#define SN_aes_256_ocb "AES-256-OCB" +#define LN_aes_256_ocb "aes-256-ocb" +#define NID_aes_256_ocb 960 + +#define SN_des_cfb1 "DES-CFB1" +#define LN_des_cfb1 "des-cfb1" +#define NID_des_cfb1 656 + +#define SN_des_cfb8 "DES-CFB8" +#define LN_des_cfb8 "des-cfb8" +#define NID_des_cfb8 657 + +#define SN_des_ede3_cfb1 "DES-EDE3-CFB1" +#define LN_des_ede3_cfb1 "des-ede3-cfb1" +#define NID_des_ede3_cfb1 658 + +#define SN_des_ede3_cfb8 "DES-EDE3-CFB8" +#define LN_des_ede3_cfb8 "des-ede3-cfb8" +#define NID_des_ede3_cfb8 659 + +#define OBJ_nist_hashalgs OBJ_nistAlgorithms,2L + +#define SN_sha256 "SHA256" +#define LN_sha256 "sha256" +#define NID_sha256 672 +#define OBJ_sha256 OBJ_nist_hashalgs,1L + +#define SN_sha384 "SHA384" +#define LN_sha384 "sha384" +#define NID_sha384 673 +#define OBJ_sha384 OBJ_nist_hashalgs,2L + +#define SN_sha512 "SHA512" +#define LN_sha512 "sha512" +#define NID_sha512 674 +#define OBJ_sha512 OBJ_nist_hashalgs,3L + +#define SN_sha224 "SHA224" +#define LN_sha224 "sha224" +#define NID_sha224 675 +#define OBJ_sha224 OBJ_nist_hashalgs,4L + +#define SN_sha512_224 "SHA512-224" +#define LN_sha512_224 "sha512-224" +#define NID_sha512_224 1094 +#define OBJ_sha512_224 OBJ_nist_hashalgs,5L + +#define SN_sha512_256 "SHA512-256" +#define LN_sha512_256 "sha512-256" +#define NID_sha512_256 1095 +#define OBJ_sha512_256 OBJ_nist_hashalgs,6L + +#define SN_sha3_224 "SHA3-224" +#define LN_sha3_224 "sha3-224" +#define NID_sha3_224 1096 +#define OBJ_sha3_224 OBJ_nist_hashalgs,7L + +#define SN_sha3_256 "SHA3-256" +#define LN_sha3_256 "sha3-256" +#define NID_sha3_256 1097 +#define OBJ_sha3_256 OBJ_nist_hashalgs,8L + +#define SN_sha3_384 "SHA3-384" +#define LN_sha3_384 "sha3-384" +#define NID_sha3_384 1098 +#define OBJ_sha3_384 OBJ_nist_hashalgs,9L + +#define SN_sha3_512 "SHA3-512" +#define LN_sha3_512 "sha3-512" +#define NID_sha3_512 1099 +#define OBJ_sha3_512 OBJ_nist_hashalgs,10L + +#define SN_shake128 "SHAKE128" +#define LN_shake128 "shake128" +#define NID_shake128 1100 +#define OBJ_shake128 OBJ_nist_hashalgs,11L + +#define SN_shake256 "SHAKE256" +#define LN_shake256 "shake256" +#define NID_shake256 1101 +#define OBJ_shake256 OBJ_nist_hashalgs,12L + +#define SN_hmac_sha3_224 "id-hmacWithSHA3-224" +#define LN_hmac_sha3_224 "hmac-sha3-224" +#define NID_hmac_sha3_224 1102 +#define OBJ_hmac_sha3_224 OBJ_nist_hashalgs,13L + +#define SN_hmac_sha3_256 "id-hmacWithSHA3-256" +#define LN_hmac_sha3_256 "hmac-sha3-256" +#define NID_hmac_sha3_256 1103 +#define OBJ_hmac_sha3_256 OBJ_nist_hashalgs,14L + +#define SN_hmac_sha3_384 "id-hmacWithSHA3-384" +#define LN_hmac_sha3_384 "hmac-sha3-384" +#define NID_hmac_sha3_384 1104 +#define OBJ_hmac_sha3_384 OBJ_nist_hashalgs,15L + +#define SN_hmac_sha3_512 "id-hmacWithSHA3-512" +#define LN_hmac_sha3_512 "hmac-sha3-512" +#define NID_hmac_sha3_512 1105 +#define OBJ_hmac_sha3_512 OBJ_nist_hashalgs,16L + +#define OBJ_dsa_with_sha2 OBJ_nistAlgorithms,3L + +#define SN_dsa_with_SHA224 "dsa_with_SHA224" +#define NID_dsa_with_SHA224 802 +#define OBJ_dsa_with_SHA224 OBJ_dsa_with_sha2,1L + +#define SN_dsa_with_SHA256 "dsa_with_SHA256" +#define NID_dsa_with_SHA256 803 +#define OBJ_dsa_with_SHA256 OBJ_dsa_with_sha2,2L + +#define OBJ_sigAlgs OBJ_nistAlgorithms,3L + +#define SN_dsa_with_SHA384 "id-dsa-with-sha384" +#define LN_dsa_with_SHA384 "dsa_with_SHA384" +#define NID_dsa_with_SHA384 1106 +#define OBJ_dsa_with_SHA384 OBJ_sigAlgs,3L + +#define SN_dsa_with_SHA512 "id-dsa-with-sha512" +#define LN_dsa_with_SHA512 "dsa_with_SHA512" +#define NID_dsa_with_SHA512 1107 +#define OBJ_dsa_with_SHA512 OBJ_sigAlgs,4L + +#define SN_dsa_with_SHA3_224 "id-dsa-with-sha3-224" +#define LN_dsa_with_SHA3_224 "dsa_with_SHA3-224" +#define NID_dsa_with_SHA3_224 1108 +#define OBJ_dsa_with_SHA3_224 OBJ_sigAlgs,5L + +#define SN_dsa_with_SHA3_256 "id-dsa-with-sha3-256" +#define LN_dsa_with_SHA3_256 "dsa_with_SHA3-256" +#define NID_dsa_with_SHA3_256 1109 +#define OBJ_dsa_with_SHA3_256 OBJ_sigAlgs,6L + +#define SN_dsa_with_SHA3_384 "id-dsa-with-sha3-384" +#define LN_dsa_with_SHA3_384 "dsa_with_SHA3-384" +#define NID_dsa_with_SHA3_384 1110 +#define OBJ_dsa_with_SHA3_384 OBJ_sigAlgs,7L + +#define SN_dsa_with_SHA3_512 "id-dsa-with-sha3-512" +#define LN_dsa_with_SHA3_512 "dsa_with_SHA3-512" +#define NID_dsa_with_SHA3_512 1111 +#define OBJ_dsa_with_SHA3_512 OBJ_sigAlgs,8L + +#define SN_ecdsa_with_SHA3_224 "id-ecdsa-with-sha3-224" +#define LN_ecdsa_with_SHA3_224 "ecdsa_with_SHA3-224" +#define NID_ecdsa_with_SHA3_224 1112 +#define OBJ_ecdsa_with_SHA3_224 OBJ_sigAlgs,9L + +#define SN_ecdsa_with_SHA3_256 "id-ecdsa-with-sha3-256" +#define LN_ecdsa_with_SHA3_256 "ecdsa_with_SHA3-256" +#define NID_ecdsa_with_SHA3_256 1113 +#define OBJ_ecdsa_with_SHA3_256 OBJ_sigAlgs,10L + +#define SN_ecdsa_with_SHA3_384 "id-ecdsa-with-sha3-384" +#define LN_ecdsa_with_SHA3_384 "ecdsa_with_SHA3-384" +#define NID_ecdsa_with_SHA3_384 1114 +#define OBJ_ecdsa_with_SHA3_384 OBJ_sigAlgs,11L + +#define SN_ecdsa_with_SHA3_512 "id-ecdsa-with-sha3-512" +#define LN_ecdsa_with_SHA3_512 "ecdsa_with_SHA3-512" +#define NID_ecdsa_with_SHA3_512 1115 +#define OBJ_ecdsa_with_SHA3_512 OBJ_sigAlgs,12L + +#define SN_RSA_SHA3_224 "id-rsassa-pkcs1-v1_5-with-sha3-224" +#define LN_RSA_SHA3_224 "RSA-SHA3-224" +#define NID_RSA_SHA3_224 1116 +#define OBJ_RSA_SHA3_224 OBJ_sigAlgs,13L + +#define SN_RSA_SHA3_256 "id-rsassa-pkcs1-v1_5-with-sha3-256" +#define LN_RSA_SHA3_256 "RSA-SHA3-256" +#define NID_RSA_SHA3_256 1117 +#define OBJ_RSA_SHA3_256 OBJ_sigAlgs,14L + +#define SN_RSA_SHA3_384 "id-rsassa-pkcs1-v1_5-with-sha3-384" +#define LN_RSA_SHA3_384 "RSA-SHA3-384" +#define NID_RSA_SHA3_384 1118 +#define OBJ_RSA_SHA3_384 OBJ_sigAlgs,15L + +#define SN_RSA_SHA3_512 "id-rsassa-pkcs1-v1_5-with-sha3-512" +#define LN_RSA_SHA3_512 "RSA-SHA3-512" +#define NID_RSA_SHA3_512 1119 +#define OBJ_RSA_SHA3_512 OBJ_sigAlgs,16L + +#define SN_hold_instruction_code "holdInstructionCode" +#define LN_hold_instruction_code "Hold Instruction Code" +#define NID_hold_instruction_code 430 +#define OBJ_hold_instruction_code OBJ_id_ce,23L + +#define OBJ_holdInstruction OBJ_X9_57,2L + +#define SN_hold_instruction_none "holdInstructionNone" +#define LN_hold_instruction_none "Hold Instruction None" +#define NID_hold_instruction_none 431 +#define OBJ_hold_instruction_none OBJ_holdInstruction,1L + +#define SN_hold_instruction_call_issuer "holdInstructionCallIssuer" +#define LN_hold_instruction_call_issuer "Hold Instruction Call Issuer" +#define NID_hold_instruction_call_issuer 432 +#define OBJ_hold_instruction_call_issuer OBJ_holdInstruction,2L + +#define SN_hold_instruction_reject "holdInstructionReject" +#define LN_hold_instruction_reject "Hold Instruction Reject" +#define NID_hold_instruction_reject 433 +#define OBJ_hold_instruction_reject OBJ_holdInstruction,3L + +#define SN_data "data" +#define NID_data 434 +#define OBJ_data OBJ_itu_t,9L + +#define SN_pss "pss" +#define NID_pss 435 +#define OBJ_pss OBJ_data,2342L + +#define SN_ucl "ucl" +#define NID_ucl 436 +#define OBJ_ucl OBJ_pss,19200300L + +#define SN_pilot "pilot" +#define NID_pilot 437 +#define OBJ_pilot OBJ_ucl,100L + +#define LN_pilotAttributeType "pilotAttributeType" +#define NID_pilotAttributeType 438 +#define OBJ_pilotAttributeType OBJ_pilot,1L + +#define LN_pilotAttributeSyntax "pilotAttributeSyntax" +#define NID_pilotAttributeSyntax 439 +#define OBJ_pilotAttributeSyntax OBJ_pilot,3L + +#define LN_pilotObjectClass "pilotObjectClass" +#define NID_pilotObjectClass 440 +#define OBJ_pilotObjectClass OBJ_pilot,4L + +#define LN_pilotGroups "pilotGroups" +#define NID_pilotGroups 441 +#define OBJ_pilotGroups OBJ_pilot,10L + +#define LN_iA5StringSyntax "iA5StringSyntax" +#define NID_iA5StringSyntax 442 +#define OBJ_iA5StringSyntax OBJ_pilotAttributeSyntax,4L + +#define LN_caseIgnoreIA5StringSyntax "caseIgnoreIA5StringSyntax" +#define NID_caseIgnoreIA5StringSyntax 443 +#define OBJ_caseIgnoreIA5StringSyntax OBJ_pilotAttributeSyntax,5L + +#define LN_pilotObject "pilotObject" +#define NID_pilotObject 444 +#define OBJ_pilotObject OBJ_pilotObjectClass,3L + +#define LN_pilotPerson "pilotPerson" +#define NID_pilotPerson 445 +#define OBJ_pilotPerson OBJ_pilotObjectClass,4L + +#define SN_account "account" +#define NID_account 446 +#define OBJ_account OBJ_pilotObjectClass,5L + +#define SN_document "document" +#define NID_document 447 +#define OBJ_document OBJ_pilotObjectClass,6L + +#define SN_room "room" +#define NID_room 448 +#define OBJ_room OBJ_pilotObjectClass,7L + +#define LN_documentSeries "documentSeries" +#define NID_documentSeries 449 +#define OBJ_documentSeries OBJ_pilotObjectClass,9L + +#define SN_Domain "domain" +#define LN_Domain "Domain" +#define NID_Domain 392 +#define OBJ_Domain OBJ_pilotObjectClass,13L + +#define LN_rFC822localPart "rFC822localPart" +#define NID_rFC822localPart 450 +#define OBJ_rFC822localPart OBJ_pilotObjectClass,14L + +#define LN_dNSDomain "dNSDomain" +#define NID_dNSDomain 451 +#define OBJ_dNSDomain OBJ_pilotObjectClass,15L + +#define LN_domainRelatedObject "domainRelatedObject" +#define NID_domainRelatedObject 452 +#define OBJ_domainRelatedObject OBJ_pilotObjectClass,17L + +#define LN_friendlyCountry "friendlyCountry" +#define NID_friendlyCountry 453 +#define OBJ_friendlyCountry OBJ_pilotObjectClass,18L + +#define LN_simpleSecurityObject "simpleSecurityObject" +#define NID_simpleSecurityObject 454 +#define OBJ_simpleSecurityObject OBJ_pilotObjectClass,19L + +#define LN_pilotOrganization "pilotOrganization" +#define NID_pilotOrganization 455 +#define OBJ_pilotOrganization OBJ_pilotObjectClass,20L + +#define LN_pilotDSA "pilotDSA" +#define NID_pilotDSA 456 +#define OBJ_pilotDSA OBJ_pilotObjectClass,21L + +#define LN_qualityLabelledData "qualityLabelledData" +#define NID_qualityLabelledData 457 +#define OBJ_qualityLabelledData OBJ_pilotObjectClass,22L + +#define SN_userId "UID" +#define LN_userId "userId" +#define NID_userId 458 +#define OBJ_userId OBJ_pilotAttributeType,1L + +#define LN_textEncodedORAddress "textEncodedORAddress" +#define NID_textEncodedORAddress 459 +#define OBJ_textEncodedORAddress OBJ_pilotAttributeType,2L + +#define SN_rfc822Mailbox "mail" +#define LN_rfc822Mailbox "rfc822Mailbox" +#define NID_rfc822Mailbox 460 +#define OBJ_rfc822Mailbox OBJ_pilotAttributeType,3L + +#define SN_info "info" +#define NID_info 461 +#define OBJ_info OBJ_pilotAttributeType,4L + +#define LN_favouriteDrink "favouriteDrink" +#define NID_favouriteDrink 462 +#define OBJ_favouriteDrink OBJ_pilotAttributeType,5L + +#define LN_roomNumber "roomNumber" +#define NID_roomNumber 463 +#define OBJ_roomNumber OBJ_pilotAttributeType,6L + +#define SN_photo "photo" +#define NID_photo 464 +#define OBJ_photo OBJ_pilotAttributeType,7L + +#define LN_userClass "userClass" +#define NID_userClass 465 +#define OBJ_userClass OBJ_pilotAttributeType,8L + +#define SN_host "host" +#define NID_host 466 +#define OBJ_host OBJ_pilotAttributeType,9L + +#define SN_manager "manager" +#define NID_manager 467 +#define OBJ_manager OBJ_pilotAttributeType,10L + +#define LN_documentIdentifier "documentIdentifier" +#define NID_documentIdentifier 468 +#define OBJ_documentIdentifier OBJ_pilotAttributeType,11L + +#define LN_documentTitle "documentTitle" +#define NID_documentTitle 469 +#define OBJ_documentTitle OBJ_pilotAttributeType,12L + +#define LN_documentVersion "documentVersion" +#define NID_documentVersion 470 +#define OBJ_documentVersion OBJ_pilotAttributeType,13L + +#define LN_documentAuthor "documentAuthor" +#define NID_documentAuthor 471 +#define OBJ_documentAuthor OBJ_pilotAttributeType,14L + +#define LN_documentLocation "documentLocation" +#define NID_documentLocation 472 +#define OBJ_documentLocation OBJ_pilotAttributeType,15L + +#define LN_homeTelephoneNumber "homeTelephoneNumber" +#define NID_homeTelephoneNumber 473 +#define OBJ_homeTelephoneNumber OBJ_pilotAttributeType,20L + +#define SN_secretary "secretary" +#define NID_secretary 474 +#define OBJ_secretary OBJ_pilotAttributeType,21L + +#define LN_otherMailbox "otherMailbox" +#define NID_otherMailbox 475 +#define OBJ_otherMailbox OBJ_pilotAttributeType,22L + +#define LN_lastModifiedTime "lastModifiedTime" +#define NID_lastModifiedTime 476 +#define OBJ_lastModifiedTime OBJ_pilotAttributeType,23L + +#define LN_lastModifiedBy "lastModifiedBy" +#define NID_lastModifiedBy 477 +#define OBJ_lastModifiedBy OBJ_pilotAttributeType,24L + +#define SN_domainComponent "DC" +#define LN_domainComponent "domainComponent" +#define NID_domainComponent 391 +#define OBJ_domainComponent OBJ_pilotAttributeType,25L + +#define LN_aRecord "aRecord" +#define NID_aRecord 478 +#define OBJ_aRecord OBJ_pilotAttributeType,26L + +#define LN_pilotAttributeType27 "pilotAttributeType27" +#define NID_pilotAttributeType27 479 +#define OBJ_pilotAttributeType27 OBJ_pilotAttributeType,27L + +#define LN_mXRecord "mXRecord" +#define NID_mXRecord 480 +#define OBJ_mXRecord OBJ_pilotAttributeType,28L + +#define LN_nSRecord "nSRecord" +#define NID_nSRecord 481 +#define OBJ_nSRecord OBJ_pilotAttributeType,29L + +#define LN_sOARecord "sOARecord" +#define NID_sOARecord 482 +#define OBJ_sOARecord OBJ_pilotAttributeType,30L + +#define LN_cNAMERecord "cNAMERecord" +#define NID_cNAMERecord 483 +#define OBJ_cNAMERecord OBJ_pilotAttributeType,31L + +#define LN_associatedDomain "associatedDomain" +#define NID_associatedDomain 484 +#define OBJ_associatedDomain OBJ_pilotAttributeType,37L + +#define LN_associatedName "associatedName" +#define NID_associatedName 485 +#define OBJ_associatedName OBJ_pilotAttributeType,38L + +#define LN_homePostalAddress "homePostalAddress" +#define NID_homePostalAddress 486 +#define OBJ_homePostalAddress OBJ_pilotAttributeType,39L + +#define LN_personalTitle "personalTitle" +#define NID_personalTitle 487 +#define OBJ_personalTitle OBJ_pilotAttributeType,40L + +#define LN_mobileTelephoneNumber "mobileTelephoneNumber" +#define NID_mobileTelephoneNumber 488 +#define OBJ_mobileTelephoneNumber OBJ_pilotAttributeType,41L + +#define LN_pagerTelephoneNumber "pagerTelephoneNumber" +#define NID_pagerTelephoneNumber 489 +#define OBJ_pagerTelephoneNumber OBJ_pilotAttributeType,42L + +#define LN_friendlyCountryName "friendlyCountryName" +#define NID_friendlyCountryName 490 +#define OBJ_friendlyCountryName OBJ_pilotAttributeType,43L + +#define SN_uniqueIdentifier "uid" +#define LN_uniqueIdentifier "uniqueIdentifier" +#define NID_uniqueIdentifier 102 +#define OBJ_uniqueIdentifier OBJ_pilotAttributeType,44L + +#define LN_organizationalStatus "organizationalStatus" +#define NID_organizationalStatus 491 +#define OBJ_organizationalStatus OBJ_pilotAttributeType,45L + +#define LN_janetMailbox "janetMailbox" +#define NID_janetMailbox 492 +#define OBJ_janetMailbox OBJ_pilotAttributeType,46L + +#define LN_mailPreferenceOption "mailPreferenceOption" +#define NID_mailPreferenceOption 493 +#define OBJ_mailPreferenceOption OBJ_pilotAttributeType,47L + +#define LN_buildingName "buildingName" +#define NID_buildingName 494 +#define OBJ_buildingName OBJ_pilotAttributeType,48L + +#define LN_dSAQuality "dSAQuality" +#define NID_dSAQuality 495 +#define OBJ_dSAQuality OBJ_pilotAttributeType,49L + +#define LN_singleLevelQuality "singleLevelQuality" +#define NID_singleLevelQuality 496 +#define OBJ_singleLevelQuality OBJ_pilotAttributeType,50L + +#define LN_subtreeMinimumQuality "subtreeMinimumQuality" +#define NID_subtreeMinimumQuality 497 +#define OBJ_subtreeMinimumQuality OBJ_pilotAttributeType,51L + +#define LN_subtreeMaximumQuality "subtreeMaximumQuality" +#define NID_subtreeMaximumQuality 498 +#define OBJ_subtreeMaximumQuality OBJ_pilotAttributeType,52L + +#define LN_personalSignature "personalSignature" +#define NID_personalSignature 499 +#define OBJ_personalSignature OBJ_pilotAttributeType,53L + +#define LN_dITRedirect "dITRedirect" +#define NID_dITRedirect 500 +#define OBJ_dITRedirect OBJ_pilotAttributeType,54L + +#define SN_audio "audio" +#define NID_audio 501 +#define OBJ_audio OBJ_pilotAttributeType,55L + +#define LN_documentPublisher "documentPublisher" +#define NID_documentPublisher 502 +#define OBJ_documentPublisher OBJ_pilotAttributeType,56L + +#define SN_id_set "id-set" +#define LN_id_set "Secure Electronic Transactions" +#define NID_id_set 512 +#define OBJ_id_set OBJ_international_organizations,42L + +#define SN_set_ctype "set-ctype" +#define LN_set_ctype "content types" +#define NID_set_ctype 513 +#define OBJ_set_ctype OBJ_id_set,0L + +#define SN_set_msgExt "set-msgExt" +#define LN_set_msgExt "message extensions" +#define NID_set_msgExt 514 +#define OBJ_set_msgExt OBJ_id_set,1L + +#define SN_set_attr "set-attr" +#define NID_set_attr 515 +#define OBJ_set_attr OBJ_id_set,3L + +#define SN_set_policy "set-policy" +#define NID_set_policy 516 +#define OBJ_set_policy OBJ_id_set,5L + +#define SN_set_certExt "set-certExt" +#define LN_set_certExt "certificate extensions" +#define NID_set_certExt 517 +#define OBJ_set_certExt OBJ_id_set,7L + +#define SN_set_brand "set-brand" +#define NID_set_brand 518 +#define OBJ_set_brand OBJ_id_set,8L + +#define SN_setct_PANData "setct-PANData" +#define NID_setct_PANData 519 +#define OBJ_setct_PANData OBJ_set_ctype,0L + +#define SN_setct_PANToken "setct-PANToken" +#define NID_setct_PANToken 520 +#define OBJ_setct_PANToken OBJ_set_ctype,1L + +#define SN_setct_PANOnly "setct-PANOnly" +#define NID_setct_PANOnly 521 +#define OBJ_setct_PANOnly OBJ_set_ctype,2L + +#define SN_setct_OIData "setct-OIData" +#define NID_setct_OIData 522 +#define OBJ_setct_OIData OBJ_set_ctype,3L + +#define SN_setct_PI "setct-PI" +#define NID_setct_PI 523 +#define OBJ_setct_PI OBJ_set_ctype,4L + +#define SN_setct_PIData "setct-PIData" +#define NID_setct_PIData 524 +#define OBJ_setct_PIData OBJ_set_ctype,5L + +#define SN_setct_PIDataUnsigned "setct-PIDataUnsigned" +#define NID_setct_PIDataUnsigned 525 +#define OBJ_setct_PIDataUnsigned OBJ_set_ctype,6L + +#define SN_setct_HODInput "setct-HODInput" +#define NID_setct_HODInput 526 +#define OBJ_setct_HODInput OBJ_set_ctype,7L + +#define SN_setct_AuthResBaggage "setct-AuthResBaggage" +#define NID_setct_AuthResBaggage 527 +#define OBJ_setct_AuthResBaggage OBJ_set_ctype,8L + +#define SN_setct_AuthRevReqBaggage "setct-AuthRevReqBaggage" +#define NID_setct_AuthRevReqBaggage 528 +#define OBJ_setct_AuthRevReqBaggage OBJ_set_ctype,9L + +#define SN_setct_AuthRevResBaggage "setct-AuthRevResBaggage" +#define NID_setct_AuthRevResBaggage 529 +#define OBJ_setct_AuthRevResBaggage OBJ_set_ctype,10L + +#define SN_setct_CapTokenSeq "setct-CapTokenSeq" +#define NID_setct_CapTokenSeq 530 +#define OBJ_setct_CapTokenSeq OBJ_set_ctype,11L + +#define SN_setct_PInitResData "setct-PInitResData" +#define NID_setct_PInitResData 531 +#define OBJ_setct_PInitResData OBJ_set_ctype,12L + +#define SN_setct_PI_TBS "setct-PI-TBS" +#define NID_setct_PI_TBS 532 +#define OBJ_setct_PI_TBS OBJ_set_ctype,13L + +#define SN_setct_PResData "setct-PResData" +#define NID_setct_PResData 533 +#define OBJ_setct_PResData OBJ_set_ctype,14L + +#define SN_setct_AuthReqTBS "setct-AuthReqTBS" +#define NID_setct_AuthReqTBS 534 +#define OBJ_setct_AuthReqTBS OBJ_set_ctype,16L + +#define SN_setct_AuthResTBS "setct-AuthResTBS" +#define NID_setct_AuthResTBS 535 +#define OBJ_setct_AuthResTBS OBJ_set_ctype,17L + +#define SN_setct_AuthResTBSX "setct-AuthResTBSX" +#define NID_setct_AuthResTBSX 536 +#define OBJ_setct_AuthResTBSX OBJ_set_ctype,18L + +#define SN_setct_AuthTokenTBS "setct-AuthTokenTBS" +#define NID_setct_AuthTokenTBS 537 +#define OBJ_setct_AuthTokenTBS OBJ_set_ctype,19L + +#define SN_setct_CapTokenData "setct-CapTokenData" +#define NID_setct_CapTokenData 538 +#define OBJ_setct_CapTokenData OBJ_set_ctype,20L + +#define SN_setct_CapTokenTBS "setct-CapTokenTBS" +#define NID_setct_CapTokenTBS 539 +#define OBJ_setct_CapTokenTBS OBJ_set_ctype,21L + +#define SN_setct_AcqCardCodeMsg "setct-AcqCardCodeMsg" +#define NID_setct_AcqCardCodeMsg 540 +#define OBJ_setct_AcqCardCodeMsg OBJ_set_ctype,22L + +#define SN_setct_AuthRevReqTBS "setct-AuthRevReqTBS" +#define NID_setct_AuthRevReqTBS 541 +#define OBJ_setct_AuthRevReqTBS OBJ_set_ctype,23L + +#define SN_setct_AuthRevResData "setct-AuthRevResData" +#define NID_setct_AuthRevResData 542 +#define OBJ_setct_AuthRevResData OBJ_set_ctype,24L + +#define SN_setct_AuthRevResTBS "setct-AuthRevResTBS" +#define NID_setct_AuthRevResTBS 543 +#define OBJ_setct_AuthRevResTBS OBJ_set_ctype,25L + +#define SN_setct_CapReqTBS "setct-CapReqTBS" +#define NID_setct_CapReqTBS 544 +#define OBJ_setct_CapReqTBS OBJ_set_ctype,26L + +#define SN_setct_CapReqTBSX "setct-CapReqTBSX" +#define NID_setct_CapReqTBSX 545 +#define OBJ_setct_CapReqTBSX OBJ_set_ctype,27L + +#define SN_setct_CapResData "setct-CapResData" +#define NID_setct_CapResData 546 +#define OBJ_setct_CapResData OBJ_set_ctype,28L + +#define SN_setct_CapRevReqTBS "setct-CapRevReqTBS" +#define NID_setct_CapRevReqTBS 547 +#define OBJ_setct_CapRevReqTBS OBJ_set_ctype,29L + +#define SN_setct_CapRevReqTBSX "setct-CapRevReqTBSX" +#define NID_setct_CapRevReqTBSX 548 +#define OBJ_setct_CapRevReqTBSX OBJ_set_ctype,30L + +#define SN_setct_CapRevResData "setct-CapRevResData" +#define NID_setct_CapRevResData 549 +#define OBJ_setct_CapRevResData OBJ_set_ctype,31L + +#define SN_setct_CredReqTBS "setct-CredReqTBS" +#define NID_setct_CredReqTBS 550 +#define OBJ_setct_CredReqTBS OBJ_set_ctype,32L + +#define SN_setct_CredReqTBSX "setct-CredReqTBSX" +#define NID_setct_CredReqTBSX 551 +#define OBJ_setct_CredReqTBSX OBJ_set_ctype,33L + +#define SN_setct_CredResData "setct-CredResData" +#define NID_setct_CredResData 552 +#define OBJ_setct_CredResData OBJ_set_ctype,34L + +#define SN_setct_CredRevReqTBS "setct-CredRevReqTBS" +#define NID_setct_CredRevReqTBS 553 +#define OBJ_setct_CredRevReqTBS OBJ_set_ctype,35L + +#define SN_setct_CredRevReqTBSX "setct-CredRevReqTBSX" +#define NID_setct_CredRevReqTBSX 554 +#define OBJ_setct_CredRevReqTBSX OBJ_set_ctype,36L + +#define SN_setct_CredRevResData "setct-CredRevResData" +#define NID_setct_CredRevResData 555 +#define OBJ_setct_CredRevResData OBJ_set_ctype,37L + +#define SN_setct_PCertReqData "setct-PCertReqData" +#define NID_setct_PCertReqData 556 +#define OBJ_setct_PCertReqData OBJ_set_ctype,38L + +#define SN_setct_PCertResTBS "setct-PCertResTBS" +#define NID_setct_PCertResTBS 557 +#define OBJ_setct_PCertResTBS OBJ_set_ctype,39L + +#define SN_setct_BatchAdminReqData "setct-BatchAdminReqData" +#define NID_setct_BatchAdminReqData 558 +#define OBJ_setct_BatchAdminReqData OBJ_set_ctype,40L + +#define SN_setct_BatchAdminResData "setct-BatchAdminResData" +#define NID_setct_BatchAdminResData 559 +#define OBJ_setct_BatchAdminResData OBJ_set_ctype,41L + +#define SN_setct_CardCInitResTBS "setct-CardCInitResTBS" +#define NID_setct_CardCInitResTBS 560 +#define OBJ_setct_CardCInitResTBS OBJ_set_ctype,42L + +#define SN_setct_MeAqCInitResTBS "setct-MeAqCInitResTBS" +#define NID_setct_MeAqCInitResTBS 561 +#define OBJ_setct_MeAqCInitResTBS OBJ_set_ctype,43L + +#define SN_setct_RegFormResTBS "setct-RegFormResTBS" +#define NID_setct_RegFormResTBS 562 +#define OBJ_setct_RegFormResTBS OBJ_set_ctype,44L + +#define SN_setct_CertReqData "setct-CertReqData" +#define NID_setct_CertReqData 563 +#define OBJ_setct_CertReqData OBJ_set_ctype,45L + +#define SN_setct_CertReqTBS "setct-CertReqTBS" +#define NID_setct_CertReqTBS 564 +#define OBJ_setct_CertReqTBS OBJ_set_ctype,46L + +#define SN_setct_CertResData "setct-CertResData" +#define NID_setct_CertResData 565 +#define OBJ_setct_CertResData OBJ_set_ctype,47L + +#define SN_setct_CertInqReqTBS "setct-CertInqReqTBS" +#define NID_setct_CertInqReqTBS 566 +#define OBJ_setct_CertInqReqTBS OBJ_set_ctype,48L + +#define SN_setct_ErrorTBS "setct-ErrorTBS" +#define NID_setct_ErrorTBS 567 +#define OBJ_setct_ErrorTBS OBJ_set_ctype,49L + +#define SN_setct_PIDualSignedTBE "setct-PIDualSignedTBE" +#define NID_setct_PIDualSignedTBE 568 +#define OBJ_setct_PIDualSignedTBE OBJ_set_ctype,50L + +#define SN_setct_PIUnsignedTBE "setct-PIUnsignedTBE" +#define NID_setct_PIUnsignedTBE 569 +#define OBJ_setct_PIUnsignedTBE OBJ_set_ctype,51L + +#define SN_setct_AuthReqTBE "setct-AuthReqTBE" +#define NID_setct_AuthReqTBE 570 +#define OBJ_setct_AuthReqTBE OBJ_set_ctype,52L + +#define SN_setct_AuthResTBE "setct-AuthResTBE" +#define NID_setct_AuthResTBE 571 +#define OBJ_setct_AuthResTBE OBJ_set_ctype,53L + +#define SN_setct_AuthResTBEX "setct-AuthResTBEX" +#define NID_setct_AuthResTBEX 572 +#define OBJ_setct_AuthResTBEX OBJ_set_ctype,54L + +#define SN_setct_AuthTokenTBE "setct-AuthTokenTBE" +#define NID_setct_AuthTokenTBE 573 +#define OBJ_setct_AuthTokenTBE OBJ_set_ctype,55L + +#define SN_setct_CapTokenTBE "setct-CapTokenTBE" +#define NID_setct_CapTokenTBE 574 +#define OBJ_setct_CapTokenTBE OBJ_set_ctype,56L + +#define SN_setct_CapTokenTBEX "setct-CapTokenTBEX" +#define NID_setct_CapTokenTBEX 575 +#define OBJ_setct_CapTokenTBEX OBJ_set_ctype,57L + +#define SN_setct_AcqCardCodeMsgTBE "setct-AcqCardCodeMsgTBE" +#define NID_setct_AcqCardCodeMsgTBE 576 +#define OBJ_setct_AcqCardCodeMsgTBE OBJ_set_ctype,58L + +#define SN_setct_AuthRevReqTBE "setct-AuthRevReqTBE" +#define NID_setct_AuthRevReqTBE 577 +#define OBJ_setct_AuthRevReqTBE OBJ_set_ctype,59L + +#define SN_setct_AuthRevResTBE "setct-AuthRevResTBE" +#define NID_setct_AuthRevResTBE 578 +#define OBJ_setct_AuthRevResTBE OBJ_set_ctype,60L + +#define SN_setct_AuthRevResTBEB "setct-AuthRevResTBEB" +#define NID_setct_AuthRevResTBEB 579 +#define OBJ_setct_AuthRevResTBEB OBJ_set_ctype,61L + +#define SN_setct_CapReqTBE "setct-CapReqTBE" +#define NID_setct_CapReqTBE 580 +#define OBJ_setct_CapReqTBE OBJ_set_ctype,62L + +#define SN_setct_CapReqTBEX "setct-CapReqTBEX" +#define NID_setct_CapReqTBEX 581 +#define OBJ_setct_CapReqTBEX OBJ_set_ctype,63L + +#define SN_setct_CapResTBE "setct-CapResTBE" +#define NID_setct_CapResTBE 582 +#define OBJ_setct_CapResTBE OBJ_set_ctype,64L + +#define SN_setct_CapRevReqTBE "setct-CapRevReqTBE" +#define NID_setct_CapRevReqTBE 583 +#define OBJ_setct_CapRevReqTBE OBJ_set_ctype,65L + +#define SN_setct_CapRevReqTBEX "setct-CapRevReqTBEX" +#define NID_setct_CapRevReqTBEX 584 +#define OBJ_setct_CapRevReqTBEX OBJ_set_ctype,66L + +#define SN_setct_CapRevResTBE "setct-CapRevResTBE" +#define NID_setct_CapRevResTBE 585 +#define OBJ_setct_CapRevResTBE OBJ_set_ctype,67L + +#define SN_setct_CredReqTBE "setct-CredReqTBE" +#define NID_setct_CredReqTBE 586 +#define OBJ_setct_CredReqTBE OBJ_set_ctype,68L + +#define SN_setct_CredReqTBEX "setct-CredReqTBEX" +#define NID_setct_CredReqTBEX 587 +#define OBJ_setct_CredReqTBEX OBJ_set_ctype,69L + +#define SN_setct_CredResTBE "setct-CredResTBE" +#define NID_setct_CredResTBE 588 +#define OBJ_setct_CredResTBE OBJ_set_ctype,70L + +#define SN_setct_CredRevReqTBE "setct-CredRevReqTBE" +#define NID_setct_CredRevReqTBE 589 +#define OBJ_setct_CredRevReqTBE OBJ_set_ctype,71L + +#define SN_setct_CredRevReqTBEX "setct-CredRevReqTBEX" +#define NID_setct_CredRevReqTBEX 590 +#define OBJ_setct_CredRevReqTBEX OBJ_set_ctype,72L + +#define SN_setct_CredRevResTBE "setct-CredRevResTBE" +#define NID_setct_CredRevResTBE 591 +#define OBJ_setct_CredRevResTBE OBJ_set_ctype,73L + +#define SN_setct_BatchAdminReqTBE "setct-BatchAdminReqTBE" +#define NID_setct_BatchAdminReqTBE 592 +#define OBJ_setct_BatchAdminReqTBE OBJ_set_ctype,74L + +#define SN_setct_BatchAdminResTBE "setct-BatchAdminResTBE" +#define NID_setct_BatchAdminResTBE 593 +#define OBJ_setct_BatchAdminResTBE OBJ_set_ctype,75L + +#define SN_setct_RegFormReqTBE "setct-RegFormReqTBE" +#define NID_setct_RegFormReqTBE 594 +#define OBJ_setct_RegFormReqTBE OBJ_set_ctype,76L + +#define SN_setct_CertReqTBE "setct-CertReqTBE" +#define NID_setct_CertReqTBE 595 +#define OBJ_setct_CertReqTBE OBJ_set_ctype,77L + +#define SN_setct_CertReqTBEX "setct-CertReqTBEX" +#define NID_setct_CertReqTBEX 596 +#define OBJ_setct_CertReqTBEX OBJ_set_ctype,78L + +#define SN_setct_CertResTBE "setct-CertResTBE" +#define NID_setct_CertResTBE 597 +#define OBJ_setct_CertResTBE OBJ_set_ctype,79L + +#define SN_setct_CRLNotificationTBS "setct-CRLNotificationTBS" +#define NID_setct_CRLNotificationTBS 598 +#define OBJ_setct_CRLNotificationTBS OBJ_set_ctype,80L + +#define SN_setct_CRLNotificationResTBS "setct-CRLNotificationResTBS" +#define NID_setct_CRLNotificationResTBS 599 +#define OBJ_setct_CRLNotificationResTBS OBJ_set_ctype,81L + +#define SN_setct_BCIDistributionTBS "setct-BCIDistributionTBS" +#define NID_setct_BCIDistributionTBS 600 +#define OBJ_setct_BCIDistributionTBS OBJ_set_ctype,82L + +#define SN_setext_genCrypt "setext-genCrypt" +#define LN_setext_genCrypt "generic cryptogram" +#define NID_setext_genCrypt 601 +#define OBJ_setext_genCrypt OBJ_set_msgExt,1L + +#define SN_setext_miAuth "setext-miAuth" +#define LN_setext_miAuth "merchant initiated auth" +#define NID_setext_miAuth 602 +#define OBJ_setext_miAuth OBJ_set_msgExt,3L + +#define SN_setext_pinSecure "setext-pinSecure" +#define NID_setext_pinSecure 603 +#define OBJ_setext_pinSecure OBJ_set_msgExt,4L + +#define SN_setext_pinAny "setext-pinAny" +#define NID_setext_pinAny 604 +#define OBJ_setext_pinAny OBJ_set_msgExt,5L + +#define SN_setext_track2 "setext-track2" +#define NID_setext_track2 605 +#define OBJ_setext_track2 OBJ_set_msgExt,7L + +#define SN_setext_cv "setext-cv" +#define LN_setext_cv "additional verification" +#define NID_setext_cv 606 +#define OBJ_setext_cv OBJ_set_msgExt,8L + +#define SN_set_policy_root "set-policy-root" +#define NID_set_policy_root 607 +#define OBJ_set_policy_root OBJ_set_policy,0L + +#define SN_setCext_hashedRoot "setCext-hashedRoot" +#define NID_setCext_hashedRoot 608 +#define OBJ_setCext_hashedRoot OBJ_set_certExt,0L + +#define SN_setCext_certType "setCext-certType" +#define NID_setCext_certType 609 +#define OBJ_setCext_certType OBJ_set_certExt,1L + +#define SN_setCext_merchData "setCext-merchData" +#define NID_setCext_merchData 610 +#define OBJ_setCext_merchData OBJ_set_certExt,2L + +#define SN_setCext_cCertRequired "setCext-cCertRequired" +#define NID_setCext_cCertRequired 611 +#define OBJ_setCext_cCertRequired OBJ_set_certExt,3L + +#define SN_setCext_tunneling "setCext-tunneling" +#define NID_setCext_tunneling 612 +#define OBJ_setCext_tunneling OBJ_set_certExt,4L + +#define SN_setCext_setExt "setCext-setExt" +#define NID_setCext_setExt 613 +#define OBJ_setCext_setExt OBJ_set_certExt,5L + +#define SN_setCext_setQualf "setCext-setQualf" +#define NID_setCext_setQualf 614 +#define OBJ_setCext_setQualf OBJ_set_certExt,6L + +#define SN_setCext_PGWYcapabilities "setCext-PGWYcapabilities" +#define NID_setCext_PGWYcapabilities 615 +#define OBJ_setCext_PGWYcapabilities OBJ_set_certExt,7L + +#define SN_setCext_TokenIdentifier "setCext-TokenIdentifier" +#define NID_setCext_TokenIdentifier 616 +#define OBJ_setCext_TokenIdentifier OBJ_set_certExt,8L + +#define SN_setCext_Track2Data "setCext-Track2Data" +#define NID_setCext_Track2Data 617 +#define OBJ_setCext_Track2Data OBJ_set_certExt,9L + +#define SN_setCext_TokenType "setCext-TokenType" +#define NID_setCext_TokenType 618 +#define OBJ_setCext_TokenType OBJ_set_certExt,10L + +#define SN_setCext_IssuerCapabilities "setCext-IssuerCapabilities" +#define NID_setCext_IssuerCapabilities 619 +#define OBJ_setCext_IssuerCapabilities OBJ_set_certExt,11L + +#define SN_setAttr_Cert "setAttr-Cert" +#define NID_setAttr_Cert 620 +#define OBJ_setAttr_Cert OBJ_set_attr,0L + +#define SN_setAttr_PGWYcap "setAttr-PGWYcap" +#define LN_setAttr_PGWYcap "payment gateway capabilities" +#define NID_setAttr_PGWYcap 621 +#define OBJ_setAttr_PGWYcap OBJ_set_attr,1L + +#define SN_setAttr_TokenType "setAttr-TokenType" +#define NID_setAttr_TokenType 622 +#define OBJ_setAttr_TokenType OBJ_set_attr,2L + +#define SN_setAttr_IssCap "setAttr-IssCap" +#define LN_setAttr_IssCap "issuer capabilities" +#define NID_setAttr_IssCap 623 +#define OBJ_setAttr_IssCap OBJ_set_attr,3L + +#define SN_set_rootKeyThumb "set-rootKeyThumb" +#define NID_set_rootKeyThumb 624 +#define OBJ_set_rootKeyThumb OBJ_setAttr_Cert,0L + +#define SN_set_addPolicy "set-addPolicy" +#define NID_set_addPolicy 625 +#define OBJ_set_addPolicy OBJ_setAttr_Cert,1L + +#define SN_setAttr_Token_EMV "setAttr-Token-EMV" +#define NID_setAttr_Token_EMV 626 +#define OBJ_setAttr_Token_EMV OBJ_setAttr_TokenType,1L + +#define SN_setAttr_Token_B0Prime "setAttr-Token-B0Prime" +#define NID_setAttr_Token_B0Prime 627 +#define OBJ_setAttr_Token_B0Prime OBJ_setAttr_TokenType,2L + +#define SN_setAttr_IssCap_CVM "setAttr-IssCap-CVM" +#define NID_setAttr_IssCap_CVM 628 +#define OBJ_setAttr_IssCap_CVM OBJ_setAttr_IssCap,3L + +#define SN_setAttr_IssCap_T2 "setAttr-IssCap-T2" +#define NID_setAttr_IssCap_T2 629 +#define OBJ_setAttr_IssCap_T2 OBJ_setAttr_IssCap,4L + +#define SN_setAttr_IssCap_Sig "setAttr-IssCap-Sig" +#define NID_setAttr_IssCap_Sig 630 +#define OBJ_setAttr_IssCap_Sig OBJ_setAttr_IssCap,5L + +#define SN_setAttr_GenCryptgrm "setAttr-GenCryptgrm" +#define LN_setAttr_GenCryptgrm "generate cryptogram" +#define NID_setAttr_GenCryptgrm 631 +#define OBJ_setAttr_GenCryptgrm OBJ_setAttr_IssCap_CVM,1L + +#define SN_setAttr_T2Enc "setAttr-T2Enc" +#define LN_setAttr_T2Enc "encrypted track 2" +#define NID_setAttr_T2Enc 632 +#define OBJ_setAttr_T2Enc OBJ_setAttr_IssCap_T2,1L + +#define SN_setAttr_T2cleartxt "setAttr-T2cleartxt" +#define LN_setAttr_T2cleartxt "cleartext track 2" +#define NID_setAttr_T2cleartxt 633 +#define OBJ_setAttr_T2cleartxt OBJ_setAttr_IssCap_T2,2L + +#define SN_setAttr_TokICCsig "setAttr-TokICCsig" +#define LN_setAttr_TokICCsig "ICC or token signature" +#define NID_setAttr_TokICCsig 634 +#define OBJ_setAttr_TokICCsig OBJ_setAttr_IssCap_Sig,1L + +#define SN_setAttr_SecDevSig "setAttr-SecDevSig" +#define LN_setAttr_SecDevSig "secure device signature" +#define NID_setAttr_SecDevSig 635 +#define OBJ_setAttr_SecDevSig OBJ_setAttr_IssCap_Sig,2L + +#define SN_set_brand_IATA_ATA "set-brand-IATA-ATA" +#define NID_set_brand_IATA_ATA 636 +#define OBJ_set_brand_IATA_ATA OBJ_set_brand,1L + +#define SN_set_brand_Diners "set-brand-Diners" +#define NID_set_brand_Diners 637 +#define OBJ_set_brand_Diners OBJ_set_brand,30L + +#define SN_set_brand_AmericanExpress "set-brand-AmericanExpress" +#define NID_set_brand_AmericanExpress 638 +#define OBJ_set_brand_AmericanExpress OBJ_set_brand,34L + +#define SN_set_brand_JCB "set-brand-JCB" +#define NID_set_brand_JCB 639 +#define OBJ_set_brand_JCB OBJ_set_brand,35L + +#define SN_set_brand_Visa "set-brand-Visa" +#define NID_set_brand_Visa 640 +#define OBJ_set_brand_Visa OBJ_set_brand,4L + +#define SN_set_brand_MasterCard "set-brand-MasterCard" +#define NID_set_brand_MasterCard 641 +#define OBJ_set_brand_MasterCard OBJ_set_brand,5L + +#define SN_set_brand_Novus "set-brand-Novus" +#define NID_set_brand_Novus 642 +#define OBJ_set_brand_Novus OBJ_set_brand,6011L + +#define SN_des_cdmf "DES-CDMF" +#define LN_des_cdmf "des-cdmf" +#define NID_des_cdmf 643 +#define OBJ_des_cdmf OBJ_rsadsi,3L,10L + +#define SN_rsaOAEPEncryptionSET "rsaOAEPEncryptionSET" +#define NID_rsaOAEPEncryptionSET 644 +#define OBJ_rsaOAEPEncryptionSET OBJ_rsadsi,1L,1L,6L + +#define SN_ipsec3 "Oakley-EC2N-3" +#define LN_ipsec3 "ipsec3" +#define NID_ipsec3 749 + +#define SN_ipsec4 "Oakley-EC2N-4" +#define LN_ipsec4 "ipsec4" +#define NID_ipsec4 750 + +#define SN_whirlpool "whirlpool" +#define NID_whirlpool 804 +#define OBJ_whirlpool OBJ_iso,0L,10118L,3L,0L,55L + +#define SN_cryptopro "cryptopro" +#define NID_cryptopro 805 +#define OBJ_cryptopro OBJ_member_body,643L,2L,2L + +#define SN_cryptocom "cryptocom" +#define NID_cryptocom 806 +#define OBJ_cryptocom OBJ_member_body,643L,2L,9L + +#define SN_id_tc26 "id-tc26" +#define NID_id_tc26 974 +#define OBJ_id_tc26 OBJ_member_body,643L,7L,1L + +#define SN_id_GostR3411_94_with_GostR3410_2001 "id-GostR3411-94-with-GostR3410-2001" +#define LN_id_GostR3411_94_with_GostR3410_2001 "GOST R 34.11-94 with GOST R 34.10-2001" +#define NID_id_GostR3411_94_with_GostR3410_2001 807 +#define OBJ_id_GostR3411_94_with_GostR3410_2001 OBJ_cryptopro,3L + +#define SN_id_GostR3411_94_with_GostR3410_94 "id-GostR3411-94-with-GostR3410-94" +#define LN_id_GostR3411_94_with_GostR3410_94 "GOST R 34.11-94 with GOST R 34.10-94" +#define NID_id_GostR3411_94_with_GostR3410_94 808 +#define OBJ_id_GostR3411_94_with_GostR3410_94 OBJ_cryptopro,4L + +#define SN_id_GostR3411_94 "md_gost94" +#define LN_id_GostR3411_94 "GOST R 34.11-94" +#define NID_id_GostR3411_94 809 +#define OBJ_id_GostR3411_94 OBJ_cryptopro,9L + +#define SN_id_HMACGostR3411_94 "id-HMACGostR3411-94" +#define LN_id_HMACGostR3411_94 "HMAC GOST 34.11-94" +#define NID_id_HMACGostR3411_94 810 +#define OBJ_id_HMACGostR3411_94 OBJ_cryptopro,10L + +#define SN_id_GostR3410_2001 "gost2001" +#define LN_id_GostR3410_2001 "GOST R 34.10-2001" +#define NID_id_GostR3410_2001 811 +#define OBJ_id_GostR3410_2001 OBJ_cryptopro,19L + +#define SN_id_GostR3410_94 "gost94" +#define LN_id_GostR3410_94 "GOST R 34.10-94" +#define NID_id_GostR3410_94 812 +#define OBJ_id_GostR3410_94 OBJ_cryptopro,20L + +#define SN_id_Gost28147_89 "gost89" +#define LN_id_Gost28147_89 "GOST 28147-89" +#define NID_id_Gost28147_89 813 +#define OBJ_id_Gost28147_89 OBJ_cryptopro,21L + +#define SN_gost89_cnt "gost89-cnt" +#define NID_gost89_cnt 814 + +#define SN_gost89_cnt_12 "gost89-cnt-12" +#define NID_gost89_cnt_12 975 + +#define SN_gost89_cbc "gost89-cbc" +#define NID_gost89_cbc 1009 + +#define SN_gost89_ecb "gost89-ecb" +#define NID_gost89_ecb 1010 + +#define SN_gost89_ctr "gost89-ctr" +#define NID_gost89_ctr 1011 + +#define SN_id_Gost28147_89_MAC "gost-mac" +#define LN_id_Gost28147_89_MAC "GOST 28147-89 MAC" +#define NID_id_Gost28147_89_MAC 815 +#define OBJ_id_Gost28147_89_MAC OBJ_cryptopro,22L + +#define SN_gost_mac_12 "gost-mac-12" +#define NID_gost_mac_12 976 + +#define SN_id_GostR3411_94_prf "prf-gostr3411-94" +#define LN_id_GostR3411_94_prf "GOST R 34.11-94 PRF" +#define NID_id_GostR3411_94_prf 816 +#define OBJ_id_GostR3411_94_prf OBJ_cryptopro,23L + +#define SN_id_GostR3410_2001DH "id-GostR3410-2001DH" +#define LN_id_GostR3410_2001DH "GOST R 34.10-2001 DH" +#define NID_id_GostR3410_2001DH 817 +#define OBJ_id_GostR3410_2001DH OBJ_cryptopro,98L + +#define SN_id_GostR3410_94DH "id-GostR3410-94DH" +#define LN_id_GostR3410_94DH "GOST R 34.10-94 DH" +#define NID_id_GostR3410_94DH 818 +#define OBJ_id_GostR3410_94DH OBJ_cryptopro,99L + +#define SN_id_Gost28147_89_CryptoPro_KeyMeshing "id-Gost28147-89-CryptoPro-KeyMeshing" +#define NID_id_Gost28147_89_CryptoPro_KeyMeshing 819 +#define OBJ_id_Gost28147_89_CryptoPro_KeyMeshing OBJ_cryptopro,14L,1L + +#define SN_id_Gost28147_89_None_KeyMeshing "id-Gost28147-89-None-KeyMeshing" +#define NID_id_Gost28147_89_None_KeyMeshing 820 +#define OBJ_id_Gost28147_89_None_KeyMeshing OBJ_cryptopro,14L,0L + +#define SN_id_GostR3411_94_TestParamSet "id-GostR3411-94-TestParamSet" +#define NID_id_GostR3411_94_TestParamSet 821 +#define OBJ_id_GostR3411_94_TestParamSet OBJ_cryptopro,30L,0L + +#define SN_id_GostR3411_94_CryptoProParamSet "id-GostR3411-94-CryptoProParamSet" +#define NID_id_GostR3411_94_CryptoProParamSet 822 +#define OBJ_id_GostR3411_94_CryptoProParamSet OBJ_cryptopro,30L,1L + +#define SN_id_Gost28147_89_TestParamSet "id-Gost28147-89-TestParamSet" +#define NID_id_Gost28147_89_TestParamSet 823 +#define OBJ_id_Gost28147_89_TestParamSet OBJ_cryptopro,31L,0L + +#define SN_id_Gost28147_89_CryptoPro_A_ParamSet "id-Gost28147-89-CryptoPro-A-ParamSet" +#define NID_id_Gost28147_89_CryptoPro_A_ParamSet 824 +#define OBJ_id_Gost28147_89_CryptoPro_A_ParamSet OBJ_cryptopro,31L,1L + +#define SN_id_Gost28147_89_CryptoPro_B_ParamSet "id-Gost28147-89-CryptoPro-B-ParamSet" +#define NID_id_Gost28147_89_CryptoPro_B_ParamSet 825 +#define OBJ_id_Gost28147_89_CryptoPro_B_ParamSet OBJ_cryptopro,31L,2L + +#define SN_id_Gost28147_89_CryptoPro_C_ParamSet "id-Gost28147-89-CryptoPro-C-ParamSet" +#define NID_id_Gost28147_89_CryptoPro_C_ParamSet 826 +#define OBJ_id_Gost28147_89_CryptoPro_C_ParamSet OBJ_cryptopro,31L,3L + +#define SN_id_Gost28147_89_CryptoPro_D_ParamSet "id-Gost28147-89-CryptoPro-D-ParamSet" +#define NID_id_Gost28147_89_CryptoPro_D_ParamSet 827 +#define OBJ_id_Gost28147_89_CryptoPro_D_ParamSet OBJ_cryptopro,31L,4L + +#define SN_id_Gost28147_89_CryptoPro_Oscar_1_1_ParamSet "id-Gost28147-89-CryptoPro-Oscar-1-1-ParamSet" +#define NID_id_Gost28147_89_CryptoPro_Oscar_1_1_ParamSet 828 +#define OBJ_id_Gost28147_89_CryptoPro_Oscar_1_1_ParamSet OBJ_cryptopro,31L,5L + +#define SN_id_Gost28147_89_CryptoPro_Oscar_1_0_ParamSet "id-Gost28147-89-CryptoPro-Oscar-1-0-ParamSet" +#define NID_id_Gost28147_89_CryptoPro_Oscar_1_0_ParamSet 829 +#define OBJ_id_Gost28147_89_CryptoPro_Oscar_1_0_ParamSet OBJ_cryptopro,31L,6L + +#define SN_id_Gost28147_89_CryptoPro_RIC_1_ParamSet "id-Gost28147-89-CryptoPro-RIC-1-ParamSet" +#define NID_id_Gost28147_89_CryptoPro_RIC_1_ParamSet 830 +#define OBJ_id_Gost28147_89_CryptoPro_RIC_1_ParamSet OBJ_cryptopro,31L,7L + +#define SN_id_GostR3410_94_TestParamSet "id-GostR3410-94-TestParamSet" +#define NID_id_GostR3410_94_TestParamSet 831 +#define OBJ_id_GostR3410_94_TestParamSet OBJ_cryptopro,32L,0L + +#define SN_id_GostR3410_94_CryptoPro_A_ParamSet "id-GostR3410-94-CryptoPro-A-ParamSet" +#define NID_id_GostR3410_94_CryptoPro_A_ParamSet 832 +#define OBJ_id_GostR3410_94_CryptoPro_A_ParamSet OBJ_cryptopro,32L,2L + +#define SN_id_GostR3410_94_CryptoPro_B_ParamSet "id-GostR3410-94-CryptoPro-B-ParamSet" +#define NID_id_GostR3410_94_CryptoPro_B_ParamSet 833 +#define OBJ_id_GostR3410_94_CryptoPro_B_ParamSet OBJ_cryptopro,32L,3L + +#define SN_id_GostR3410_94_CryptoPro_C_ParamSet "id-GostR3410-94-CryptoPro-C-ParamSet" +#define NID_id_GostR3410_94_CryptoPro_C_ParamSet 834 +#define OBJ_id_GostR3410_94_CryptoPro_C_ParamSet OBJ_cryptopro,32L,4L + +#define SN_id_GostR3410_94_CryptoPro_D_ParamSet "id-GostR3410-94-CryptoPro-D-ParamSet" +#define NID_id_GostR3410_94_CryptoPro_D_ParamSet 835 +#define OBJ_id_GostR3410_94_CryptoPro_D_ParamSet OBJ_cryptopro,32L,5L + +#define SN_id_GostR3410_94_CryptoPro_XchA_ParamSet "id-GostR3410-94-CryptoPro-XchA-ParamSet" +#define NID_id_GostR3410_94_CryptoPro_XchA_ParamSet 836 +#define OBJ_id_GostR3410_94_CryptoPro_XchA_ParamSet OBJ_cryptopro,33L,1L + +#define SN_id_GostR3410_94_CryptoPro_XchB_ParamSet "id-GostR3410-94-CryptoPro-XchB-ParamSet" +#define NID_id_GostR3410_94_CryptoPro_XchB_ParamSet 837 +#define OBJ_id_GostR3410_94_CryptoPro_XchB_ParamSet OBJ_cryptopro,33L,2L + +#define SN_id_GostR3410_94_CryptoPro_XchC_ParamSet "id-GostR3410-94-CryptoPro-XchC-ParamSet" +#define NID_id_GostR3410_94_CryptoPro_XchC_ParamSet 838 +#define OBJ_id_GostR3410_94_CryptoPro_XchC_ParamSet OBJ_cryptopro,33L,3L + +#define SN_id_GostR3410_2001_TestParamSet "id-GostR3410-2001-TestParamSet" +#define NID_id_GostR3410_2001_TestParamSet 839 +#define OBJ_id_GostR3410_2001_TestParamSet OBJ_cryptopro,35L,0L + +#define SN_id_GostR3410_2001_CryptoPro_A_ParamSet "id-GostR3410-2001-CryptoPro-A-ParamSet" +#define NID_id_GostR3410_2001_CryptoPro_A_ParamSet 840 +#define OBJ_id_GostR3410_2001_CryptoPro_A_ParamSet OBJ_cryptopro,35L,1L + +#define SN_id_GostR3410_2001_CryptoPro_B_ParamSet "id-GostR3410-2001-CryptoPro-B-ParamSet" +#define NID_id_GostR3410_2001_CryptoPro_B_ParamSet 841 +#define OBJ_id_GostR3410_2001_CryptoPro_B_ParamSet OBJ_cryptopro,35L,2L + +#define SN_id_GostR3410_2001_CryptoPro_C_ParamSet "id-GostR3410-2001-CryptoPro-C-ParamSet" +#define NID_id_GostR3410_2001_CryptoPro_C_ParamSet 842 +#define OBJ_id_GostR3410_2001_CryptoPro_C_ParamSet OBJ_cryptopro,35L,3L + +#define SN_id_GostR3410_2001_CryptoPro_XchA_ParamSet "id-GostR3410-2001-CryptoPro-XchA-ParamSet" +#define NID_id_GostR3410_2001_CryptoPro_XchA_ParamSet 843 +#define OBJ_id_GostR3410_2001_CryptoPro_XchA_ParamSet OBJ_cryptopro,36L,0L + +#define SN_id_GostR3410_2001_CryptoPro_XchB_ParamSet "id-GostR3410-2001-CryptoPro-XchB-ParamSet" +#define NID_id_GostR3410_2001_CryptoPro_XchB_ParamSet 844 +#define OBJ_id_GostR3410_2001_CryptoPro_XchB_ParamSet OBJ_cryptopro,36L,1L + +#define SN_id_GostR3410_94_a "id-GostR3410-94-a" +#define NID_id_GostR3410_94_a 845 +#define OBJ_id_GostR3410_94_a OBJ_id_GostR3410_94,1L + +#define SN_id_GostR3410_94_aBis "id-GostR3410-94-aBis" +#define NID_id_GostR3410_94_aBis 846 +#define OBJ_id_GostR3410_94_aBis OBJ_id_GostR3410_94,2L + +#define SN_id_GostR3410_94_b "id-GostR3410-94-b" +#define NID_id_GostR3410_94_b 847 +#define OBJ_id_GostR3410_94_b OBJ_id_GostR3410_94,3L + +#define SN_id_GostR3410_94_bBis "id-GostR3410-94-bBis" +#define NID_id_GostR3410_94_bBis 848 +#define OBJ_id_GostR3410_94_bBis OBJ_id_GostR3410_94,4L + +#define SN_id_Gost28147_89_cc "id-Gost28147-89-cc" +#define LN_id_Gost28147_89_cc "GOST 28147-89 Cryptocom ParamSet" +#define NID_id_Gost28147_89_cc 849 +#define OBJ_id_Gost28147_89_cc OBJ_cryptocom,1L,6L,1L + +#define SN_id_GostR3410_94_cc "gost94cc" +#define LN_id_GostR3410_94_cc "GOST 34.10-94 Cryptocom" +#define NID_id_GostR3410_94_cc 850 +#define OBJ_id_GostR3410_94_cc OBJ_cryptocom,1L,5L,3L + +#define SN_id_GostR3410_2001_cc "gost2001cc" +#define LN_id_GostR3410_2001_cc "GOST 34.10-2001 Cryptocom" +#define NID_id_GostR3410_2001_cc 851 +#define OBJ_id_GostR3410_2001_cc OBJ_cryptocom,1L,5L,4L + +#define SN_id_GostR3411_94_with_GostR3410_94_cc "id-GostR3411-94-with-GostR3410-94-cc" +#define LN_id_GostR3411_94_with_GostR3410_94_cc "GOST R 34.11-94 with GOST R 34.10-94 Cryptocom" +#define NID_id_GostR3411_94_with_GostR3410_94_cc 852 +#define OBJ_id_GostR3411_94_with_GostR3410_94_cc OBJ_cryptocom,1L,3L,3L + +#define SN_id_GostR3411_94_with_GostR3410_2001_cc "id-GostR3411-94-with-GostR3410-2001-cc" +#define LN_id_GostR3411_94_with_GostR3410_2001_cc "GOST R 34.11-94 with GOST R 34.10-2001 Cryptocom" +#define NID_id_GostR3411_94_with_GostR3410_2001_cc 853 +#define OBJ_id_GostR3411_94_with_GostR3410_2001_cc OBJ_cryptocom,1L,3L,4L + +#define SN_id_GostR3410_2001_ParamSet_cc "id-GostR3410-2001-ParamSet-cc" +#define LN_id_GostR3410_2001_ParamSet_cc "GOST R 3410-2001 Parameter Set Cryptocom" +#define NID_id_GostR3410_2001_ParamSet_cc 854 +#define OBJ_id_GostR3410_2001_ParamSet_cc OBJ_cryptocom,1L,8L,1L + +#define SN_id_tc26_algorithms "id-tc26-algorithms" +#define NID_id_tc26_algorithms 977 +#define OBJ_id_tc26_algorithms OBJ_id_tc26,1L + +#define SN_id_tc26_sign "id-tc26-sign" +#define NID_id_tc26_sign 978 +#define OBJ_id_tc26_sign OBJ_id_tc26_algorithms,1L + +#define SN_id_GostR3410_2012_256 "gost2012_256" +#define LN_id_GostR3410_2012_256 "GOST R 34.10-2012 with 256 bit modulus" +#define NID_id_GostR3410_2012_256 979 +#define OBJ_id_GostR3410_2012_256 OBJ_id_tc26_sign,1L + +#define SN_id_GostR3410_2012_512 "gost2012_512" +#define LN_id_GostR3410_2012_512 "GOST R 34.10-2012 with 512 bit modulus" +#define NID_id_GostR3410_2012_512 980 +#define OBJ_id_GostR3410_2012_512 OBJ_id_tc26_sign,2L + +#define SN_id_tc26_digest "id-tc26-digest" +#define NID_id_tc26_digest 981 +#define OBJ_id_tc26_digest OBJ_id_tc26_algorithms,2L + +#define SN_id_GostR3411_2012_256 "md_gost12_256" +#define LN_id_GostR3411_2012_256 "GOST R 34.11-2012 with 256 bit hash" +#define NID_id_GostR3411_2012_256 982 +#define OBJ_id_GostR3411_2012_256 OBJ_id_tc26_digest,2L + +#define SN_id_GostR3411_2012_512 "md_gost12_512" +#define LN_id_GostR3411_2012_512 "GOST R 34.11-2012 with 512 bit hash" +#define NID_id_GostR3411_2012_512 983 +#define OBJ_id_GostR3411_2012_512 OBJ_id_tc26_digest,3L + +#define SN_id_tc26_signwithdigest "id-tc26-signwithdigest" +#define NID_id_tc26_signwithdigest 984 +#define OBJ_id_tc26_signwithdigest OBJ_id_tc26_algorithms,3L + +#define SN_id_tc26_signwithdigest_gost3410_2012_256 "id-tc26-signwithdigest-gost3410-2012-256" +#define LN_id_tc26_signwithdigest_gost3410_2012_256 "GOST R 34.10-2012 with GOST R 34.11-2012 (256 bit)" +#define NID_id_tc26_signwithdigest_gost3410_2012_256 985 +#define OBJ_id_tc26_signwithdigest_gost3410_2012_256 OBJ_id_tc26_signwithdigest,2L + +#define SN_id_tc26_signwithdigest_gost3410_2012_512 "id-tc26-signwithdigest-gost3410-2012-512" +#define LN_id_tc26_signwithdigest_gost3410_2012_512 "GOST R 34.10-2012 with GOST R 34.11-2012 (512 bit)" +#define NID_id_tc26_signwithdigest_gost3410_2012_512 986 +#define OBJ_id_tc26_signwithdigest_gost3410_2012_512 OBJ_id_tc26_signwithdigest,3L + +#define SN_id_tc26_mac "id-tc26-mac" +#define NID_id_tc26_mac 987 +#define OBJ_id_tc26_mac OBJ_id_tc26_algorithms,4L + +#define SN_id_tc26_hmac_gost_3411_2012_256 "id-tc26-hmac-gost-3411-2012-256" +#define LN_id_tc26_hmac_gost_3411_2012_256 "HMAC GOST 34.11-2012 256 bit" +#define NID_id_tc26_hmac_gost_3411_2012_256 988 +#define OBJ_id_tc26_hmac_gost_3411_2012_256 OBJ_id_tc26_mac,1L + +#define SN_id_tc26_hmac_gost_3411_2012_512 "id-tc26-hmac-gost-3411-2012-512" +#define LN_id_tc26_hmac_gost_3411_2012_512 "HMAC GOST 34.11-2012 512 bit" +#define NID_id_tc26_hmac_gost_3411_2012_512 989 +#define OBJ_id_tc26_hmac_gost_3411_2012_512 OBJ_id_tc26_mac,2L + +#define SN_id_tc26_cipher "id-tc26-cipher" +#define NID_id_tc26_cipher 990 +#define OBJ_id_tc26_cipher OBJ_id_tc26_algorithms,5L + +#define SN_id_tc26_cipher_gostr3412_2015_magma "id-tc26-cipher-gostr3412-2015-magma" +#define NID_id_tc26_cipher_gostr3412_2015_magma 1173 +#define OBJ_id_tc26_cipher_gostr3412_2015_magma OBJ_id_tc26_cipher,1L + +#define SN_id_tc26_cipher_gostr3412_2015_magma_ctracpkm "id-tc26-cipher-gostr3412-2015-magma-ctracpkm" +#define NID_id_tc26_cipher_gostr3412_2015_magma_ctracpkm 1174 +#define OBJ_id_tc26_cipher_gostr3412_2015_magma_ctracpkm OBJ_id_tc26_cipher_gostr3412_2015_magma,1L + +#define SN_id_tc26_cipher_gostr3412_2015_magma_ctracpkm_omac "id-tc26-cipher-gostr3412-2015-magma-ctracpkm-omac" +#define NID_id_tc26_cipher_gostr3412_2015_magma_ctracpkm_omac 1175 +#define OBJ_id_tc26_cipher_gostr3412_2015_magma_ctracpkm_omac OBJ_id_tc26_cipher_gostr3412_2015_magma,2L + +#define SN_id_tc26_cipher_gostr3412_2015_kuznyechik "id-tc26-cipher-gostr3412-2015-kuznyechik" +#define NID_id_tc26_cipher_gostr3412_2015_kuznyechik 1176 +#define OBJ_id_tc26_cipher_gostr3412_2015_kuznyechik OBJ_id_tc26_cipher,2L + +#define SN_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm "id-tc26-cipher-gostr3412-2015-kuznyechik-ctracpkm" +#define NID_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm 1177 +#define OBJ_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm OBJ_id_tc26_cipher_gostr3412_2015_kuznyechik,1L + +#define SN_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm_omac "id-tc26-cipher-gostr3412-2015-kuznyechik-ctracpkm-omac" +#define NID_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm_omac 1178 +#define OBJ_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm_omac OBJ_id_tc26_cipher_gostr3412_2015_kuznyechik,2L + +#define SN_id_tc26_agreement "id-tc26-agreement" +#define NID_id_tc26_agreement 991 +#define OBJ_id_tc26_agreement OBJ_id_tc26_algorithms,6L + +#define SN_id_tc26_agreement_gost_3410_2012_256 "id-tc26-agreement-gost-3410-2012-256" +#define NID_id_tc26_agreement_gost_3410_2012_256 992 +#define OBJ_id_tc26_agreement_gost_3410_2012_256 OBJ_id_tc26_agreement,1L + +#define SN_id_tc26_agreement_gost_3410_2012_512 "id-tc26-agreement-gost-3410-2012-512" +#define NID_id_tc26_agreement_gost_3410_2012_512 993 +#define OBJ_id_tc26_agreement_gost_3410_2012_512 OBJ_id_tc26_agreement,2L + +#define SN_id_tc26_wrap "id-tc26-wrap" +#define NID_id_tc26_wrap 1179 +#define OBJ_id_tc26_wrap OBJ_id_tc26_algorithms,7L + +#define SN_id_tc26_wrap_gostr3412_2015_magma "id-tc26-wrap-gostr3412-2015-magma" +#define NID_id_tc26_wrap_gostr3412_2015_magma 1180 +#define OBJ_id_tc26_wrap_gostr3412_2015_magma OBJ_id_tc26_wrap,1L + +#define SN_id_tc26_wrap_gostr3412_2015_magma_kexp15 "id-tc26-wrap-gostr3412-2015-magma-kexp15" +#define NID_id_tc26_wrap_gostr3412_2015_magma_kexp15 1181 +#define OBJ_id_tc26_wrap_gostr3412_2015_magma_kexp15 OBJ_id_tc26_wrap_gostr3412_2015_magma,1L + +#define SN_id_tc26_wrap_gostr3412_2015_kuznyechik "id-tc26-wrap-gostr3412-2015-kuznyechik" +#define NID_id_tc26_wrap_gostr3412_2015_kuznyechik 1182 +#define OBJ_id_tc26_wrap_gostr3412_2015_kuznyechik OBJ_id_tc26_wrap,2L + +#define SN_id_tc26_wrap_gostr3412_2015_kuznyechik_kexp15 "id-tc26-wrap-gostr3412-2015-kuznyechik-kexp15" +#define NID_id_tc26_wrap_gostr3412_2015_kuznyechik_kexp15 1183 +#define OBJ_id_tc26_wrap_gostr3412_2015_kuznyechik_kexp15 OBJ_id_tc26_wrap_gostr3412_2015_kuznyechik,1L + +#define SN_id_tc26_constants "id-tc26-constants" +#define NID_id_tc26_constants 994 +#define OBJ_id_tc26_constants OBJ_id_tc26,2L + +#define SN_id_tc26_sign_constants "id-tc26-sign-constants" +#define NID_id_tc26_sign_constants 995 +#define OBJ_id_tc26_sign_constants OBJ_id_tc26_constants,1L + +#define SN_id_tc26_gost_3410_2012_256_constants "id-tc26-gost-3410-2012-256-constants" +#define NID_id_tc26_gost_3410_2012_256_constants 1147 +#define OBJ_id_tc26_gost_3410_2012_256_constants OBJ_id_tc26_sign_constants,1L + +#define SN_id_tc26_gost_3410_2012_256_paramSetA "id-tc26-gost-3410-2012-256-paramSetA" +#define LN_id_tc26_gost_3410_2012_256_paramSetA "GOST R 34.10-2012 (256 bit) ParamSet A" +#define NID_id_tc26_gost_3410_2012_256_paramSetA 1148 +#define OBJ_id_tc26_gost_3410_2012_256_paramSetA OBJ_id_tc26_gost_3410_2012_256_constants,1L + +#define SN_id_tc26_gost_3410_2012_256_paramSetB "id-tc26-gost-3410-2012-256-paramSetB" +#define LN_id_tc26_gost_3410_2012_256_paramSetB "GOST R 34.10-2012 (256 bit) ParamSet B" +#define NID_id_tc26_gost_3410_2012_256_paramSetB 1184 +#define OBJ_id_tc26_gost_3410_2012_256_paramSetB OBJ_id_tc26_gost_3410_2012_256_constants,2L + +#define SN_id_tc26_gost_3410_2012_256_paramSetC "id-tc26-gost-3410-2012-256-paramSetC" +#define LN_id_tc26_gost_3410_2012_256_paramSetC "GOST R 34.10-2012 (256 bit) ParamSet C" +#define NID_id_tc26_gost_3410_2012_256_paramSetC 1185 +#define OBJ_id_tc26_gost_3410_2012_256_paramSetC OBJ_id_tc26_gost_3410_2012_256_constants,3L + +#define SN_id_tc26_gost_3410_2012_256_paramSetD "id-tc26-gost-3410-2012-256-paramSetD" +#define LN_id_tc26_gost_3410_2012_256_paramSetD "GOST R 34.10-2012 (256 bit) ParamSet D" +#define NID_id_tc26_gost_3410_2012_256_paramSetD 1186 +#define OBJ_id_tc26_gost_3410_2012_256_paramSetD OBJ_id_tc26_gost_3410_2012_256_constants,4L + +#define SN_id_tc26_gost_3410_2012_512_constants "id-tc26-gost-3410-2012-512-constants" +#define NID_id_tc26_gost_3410_2012_512_constants 996 +#define OBJ_id_tc26_gost_3410_2012_512_constants OBJ_id_tc26_sign_constants,2L + +#define SN_id_tc26_gost_3410_2012_512_paramSetTest "id-tc26-gost-3410-2012-512-paramSetTest" +#define LN_id_tc26_gost_3410_2012_512_paramSetTest "GOST R 34.10-2012 (512 bit) testing parameter set" +#define NID_id_tc26_gost_3410_2012_512_paramSetTest 997 +#define OBJ_id_tc26_gost_3410_2012_512_paramSetTest OBJ_id_tc26_gost_3410_2012_512_constants,0L + +#define SN_id_tc26_gost_3410_2012_512_paramSetA "id-tc26-gost-3410-2012-512-paramSetA" +#define LN_id_tc26_gost_3410_2012_512_paramSetA "GOST R 34.10-2012 (512 bit) ParamSet A" +#define NID_id_tc26_gost_3410_2012_512_paramSetA 998 +#define OBJ_id_tc26_gost_3410_2012_512_paramSetA OBJ_id_tc26_gost_3410_2012_512_constants,1L + +#define SN_id_tc26_gost_3410_2012_512_paramSetB "id-tc26-gost-3410-2012-512-paramSetB" +#define LN_id_tc26_gost_3410_2012_512_paramSetB "GOST R 34.10-2012 (512 bit) ParamSet B" +#define NID_id_tc26_gost_3410_2012_512_paramSetB 999 +#define OBJ_id_tc26_gost_3410_2012_512_paramSetB OBJ_id_tc26_gost_3410_2012_512_constants,2L + +#define SN_id_tc26_gost_3410_2012_512_paramSetC "id-tc26-gost-3410-2012-512-paramSetC" +#define LN_id_tc26_gost_3410_2012_512_paramSetC "GOST R 34.10-2012 (512 bit) ParamSet C" +#define NID_id_tc26_gost_3410_2012_512_paramSetC 1149 +#define OBJ_id_tc26_gost_3410_2012_512_paramSetC OBJ_id_tc26_gost_3410_2012_512_constants,3L + +#define SN_id_tc26_digest_constants "id-tc26-digest-constants" +#define NID_id_tc26_digest_constants 1000 +#define OBJ_id_tc26_digest_constants OBJ_id_tc26_constants,2L + +#define SN_id_tc26_cipher_constants "id-tc26-cipher-constants" +#define NID_id_tc26_cipher_constants 1001 +#define OBJ_id_tc26_cipher_constants OBJ_id_tc26_constants,5L + +#define SN_id_tc26_gost_28147_constants "id-tc26-gost-28147-constants" +#define NID_id_tc26_gost_28147_constants 1002 +#define OBJ_id_tc26_gost_28147_constants OBJ_id_tc26_cipher_constants,1L + +#define SN_id_tc26_gost_28147_param_Z "id-tc26-gost-28147-param-Z" +#define LN_id_tc26_gost_28147_param_Z "GOST 28147-89 TC26 parameter set" +#define NID_id_tc26_gost_28147_param_Z 1003 +#define OBJ_id_tc26_gost_28147_param_Z OBJ_id_tc26_gost_28147_constants,1L + +#define SN_INN "INN" +#define LN_INN "INN" +#define NID_INN 1004 +#define OBJ_INN OBJ_member_body,643L,3L,131L,1L,1L + +#define SN_OGRN "OGRN" +#define LN_OGRN "OGRN" +#define NID_OGRN 1005 +#define OBJ_OGRN OBJ_member_body,643L,100L,1L + +#define SN_SNILS "SNILS" +#define LN_SNILS "SNILS" +#define NID_SNILS 1006 +#define OBJ_SNILS OBJ_member_body,643L,100L,3L + +#define SN_subjectSignTool "subjectSignTool" +#define LN_subjectSignTool "Signing Tool of Subject" +#define NID_subjectSignTool 1007 +#define OBJ_subjectSignTool OBJ_member_body,643L,100L,111L + +#define SN_issuerSignTool "issuerSignTool" +#define LN_issuerSignTool "Signing Tool of Issuer" +#define NID_issuerSignTool 1008 +#define OBJ_issuerSignTool OBJ_member_body,643L,100L,112L + +#define SN_grasshopper_ecb "grasshopper-ecb" +#define NID_grasshopper_ecb 1012 + +#define SN_grasshopper_ctr "grasshopper-ctr" +#define NID_grasshopper_ctr 1013 + +#define SN_grasshopper_ofb "grasshopper-ofb" +#define NID_grasshopper_ofb 1014 + +#define SN_grasshopper_cbc "grasshopper-cbc" +#define NID_grasshopper_cbc 1015 + +#define SN_grasshopper_cfb "grasshopper-cfb" +#define NID_grasshopper_cfb 1016 + +#define SN_grasshopper_mac "grasshopper-mac" +#define NID_grasshopper_mac 1017 + +#define SN_magma_ecb "magma-ecb" +#define NID_magma_ecb 1187 + +#define SN_magma_ctr "magma-ctr" +#define NID_magma_ctr 1188 + +#define SN_magma_ofb "magma-ofb" +#define NID_magma_ofb 1189 + +#define SN_magma_cbc "magma-cbc" +#define NID_magma_cbc 1190 + +#define SN_magma_cfb "magma-cfb" +#define NID_magma_cfb 1191 + +#define SN_magma_mac "magma-mac" +#define NID_magma_mac 1192 + +#define SN_camellia_128_cbc "CAMELLIA-128-CBC" +#define LN_camellia_128_cbc "camellia-128-cbc" +#define NID_camellia_128_cbc 751 +#define OBJ_camellia_128_cbc 1L,2L,392L,200011L,61L,1L,1L,1L,2L + +#define SN_camellia_192_cbc "CAMELLIA-192-CBC" +#define LN_camellia_192_cbc "camellia-192-cbc" +#define NID_camellia_192_cbc 752 +#define OBJ_camellia_192_cbc 1L,2L,392L,200011L,61L,1L,1L,1L,3L + +#define SN_camellia_256_cbc "CAMELLIA-256-CBC" +#define LN_camellia_256_cbc "camellia-256-cbc" +#define NID_camellia_256_cbc 753 +#define OBJ_camellia_256_cbc 1L,2L,392L,200011L,61L,1L,1L,1L,4L + +#define SN_id_camellia128_wrap "id-camellia128-wrap" +#define NID_id_camellia128_wrap 907 +#define OBJ_id_camellia128_wrap 1L,2L,392L,200011L,61L,1L,1L,3L,2L + +#define SN_id_camellia192_wrap "id-camellia192-wrap" +#define NID_id_camellia192_wrap 908 +#define OBJ_id_camellia192_wrap 1L,2L,392L,200011L,61L,1L,1L,3L,3L + +#define SN_id_camellia256_wrap "id-camellia256-wrap" +#define NID_id_camellia256_wrap 909 +#define OBJ_id_camellia256_wrap 1L,2L,392L,200011L,61L,1L,1L,3L,4L + +#define OBJ_ntt_ds 0L,3L,4401L,5L + +#define OBJ_camellia OBJ_ntt_ds,3L,1L,9L + +#define SN_camellia_128_ecb "CAMELLIA-128-ECB" +#define LN_camellia_128_ecb "camellia-128-ecb" +#define NID_camellia_128_ecb 754 +#define OBJ_camellia_128_ecb OBJ_camellia,1L + +#define SN_camellia_128_ofb128 "CAMELLIA-128-OFB" +#define LN_camellia_128_ofb128 "camellia-128-ofb" +#define NID_camellia_128_ofb128 766 +#define OBJ_camellia_128_ofb128 OBJ_camellia,3L + +#define SN_camellia_128_cfb128 "CAMELLIA-128-CFB" +#define LN_camellia_128_cfb128 "camellia-128-cfb" +#define NID_camellia_128_cfb128 757 +#define OBJ_camellia_128_cfb128 OBJ_camellia,4L + +#define SN_camellia_128_gcm "CAMELLIA-128-GCM" +#define LN_camellia_128_gcm "camellia-128-gcm" +#define NID_camellia_128_gcm 961 +#define OBJ_camellia_128_gcm OBJ_camellia,6L + +#define SN_camellia_128_ccm "CAMELLIA-128-CCM" +#define LN_camellia_128_ccm "camellia-128-ccm" +#define NID_camellia_128_ccm 962 +#define OBJ_camellia_128_ccm OBJ_camellia,7L + +#define SN_camellia_128_ctr "CAMELLIA-128-CTR" +#define LN_camellia_128_ctr "camellia-128-ctr" +#define NID_camellia_128_ctr 963 +#define OBJ_camellia_128_ctr OBJ_camellia,9L + +#define SN_camellia_128_cmac "CAMELLIA-128-CMAC" +#define LN_camellia_128_cmac "camellia-128-cmac" +#define NID_camellia_128_cmac 964 +#define OBJ_camellia_128_cmac OBJ_camellia,10L + +#define SN_camellia_192_ecb "CAMELLIA-192-ECB" +#define LN_camellia_192_ecb "camellia-192-ecb" +#define NID_camellia_192_ecb 755 +#define OBJ_camellia_192_ecb OBJ_camellia,21L + +#define SN_camellia_192_ofb128 "CAMELLIA-192-OFB" +#define LN_camellia_192_ofb128 "camellia-192-ofb" +#define NID_camellia_192_ofb128 767 +#define OBJ_camellia_192_ofb128 OBJ_camellia,23L + +#define SN_camellia_192_cfb128 "CAMELLIA-192-CFB" +#define LN_camellia_192_cfb128 "camellia-192-cfb" +#define NID_camellia_192_cfb128 758 +#define OBJ_camellia_192_cfb128 OBJ_camellia,24L + +#define SN_camellia_192_gcm "CAMELLIA-192-GCM" +#define LN_camellia_192_gcm "camellia-192-gcm" +#define NID_camellia_192_gcm 965 +#define OBJ_camellia_192_gcm OBJ_camellia,26L + +#define SN_camellia_192_ccm "CAMELLIA-192-CCM" +#define LN_camellia_192_ccm "camellia-192-ccm" +#define NID_camellia_192_ccm 966 +#define OBJ_camellia_192_ccm OBJ_camellia,27L + +#define SN_camellia_192_ctr "CAMELLIA-192-CTR" +#define LN_camellia_192_ctr "camellia-192-ctr" +#define NID_camellia_192_ctr 967 +#define OBJ_camellia_192_ctr OBJ_camellia,29L + +#define SN_camellia_192_cmac "CAMELLIA-192-CMAC" +#define LN_camellia_192_cmac "camellia-192-cmac" +#define NID_camellia_192_cmac 968 +#define OBJ_camellia_192_cmac OBJ_camellia,30L + +#define SN_camellia_256_ecb "CAMELLIA-256-ECB" +#define LN_camellia_256_ecb "camellia-256-ecb" +#define NID_camellia_256_ecb 756 +#define OBJ_camellia_256_ecb OBJ_camellia,41L + +#define SN_camellia_256_ofb128 "CAMELLIA-256-OFB" +#define LN_camellia_256_ofb128 "camellia-256-ofb" +#define NID_camellia_256_ofb128 768 +#define OBJ_camellia_256_ofb128 OBJ_camellia,43L + +#define SN_camellia_256_cfb128 "CAMELLIA-256-CFB" +#define LN_camellia_256_cfb128 "camellia-256-cfb" +#define NID_camellia_256_cfb128 759 +#define OBJ_camellia_256_cfb128 OBJ_camellia,44L + +#define SN_camellia_256_gcm "CAMELLIA-256-GCM" +#define LN_camellia_256_gcm "camellia-256-gcm" +#define NID_camellia_256_gcm 969 +#define OBJ_camellia_256_gcm OBJ_camellia,46L + +#define SN_camellia_256_ccm "CAMELLIA-256-CCM" +#define LN_camellia_256_ccm "camellia-256-ccm" +#define NID_camellia_256_ccm 970 +#define OBJ_camellia_256_ccm OBJ_camellia,47L + +#define SN_camellia_256_ctr "CAMELLIA-256-CTR" +#define LN_camellia_256_ctr "camellia-256-ctr" +#define NID_camellia_256_ctr 971 +#define OBJ_camellia_256_ctr OBJ_camellia,49L + +#define SN_camellia_256_cmac "CAMELLIA-256-CMAC" +#define LN_camellia_256_cmac "camellia-256-cmac" +#define NID_camellia_256_cmac 972 +#define OBJ_camellia_256_cmac OBJ_camellia,50L + +#define SN_camellia_128_cfb1 "CAMELLIA-128-CFB1" +#define LN_camellia_128_cfb1 "camellia-128-cfb1" +#define NID_camellia_128_cfb1 760 + +#define SN_camellia_192_cfb1 "CAMELLIA-192-CFB1" +#define LN_camellia_192_cfb1 "camellia-192-cfb1" +#define NID_camellia_192_cfb1 761 + +#define SN_camellia_256_cfb1 "CAMELLIA-256-CFB1" +#define LN_camellia_256_cfb1 "camellia-256-cfb1" +#define NID_camellia_256_cfb1 762 + +#define SN_camellia_128_cfb8 "CAMELLIA-128-CFB8" +#define LN_camellia_128_cfb8 "camellia-128-cfb8" +#define NID_camellia_128_cfb8 763 + +#define SN_camellia_192_cfb8 "CAMELLIA-192-CFB8" +#define LN_camellia_192_cfb8 "camellia-192-cfb8" +#define NID_camellia_192_cfb8 764 + +#define SN_camellia_256_cfb8 "CAMELLIA-256-CFB8" +#define LN_camellia_256_cfb8 "camellia-256-cfb8" +#define NID_camellia_256_cfb8 765 + +#define OBJ_aria 1L,2L,410L,200046L,1L,1L + +#define SN_aria_128_ecb "ARIA-128-ECB" +#define LN_aria_128_ecb "aria-128-ecb" +#define NID_aria_128_ecb 1065 +#define OBJ_aria_128_ecb OBJ_aria,1L + +#define SN_aria_128_cbc "ARIA-128-CBC" +#define LN_aria_128_cbc "aria-128-cbc" +#define NID_aria_128_cbc 1066 +#define OBJ_aria_128_cbc OBJ_aria,2L + +#define SN_aria_128_cfb128 "ARIA-128-CFB" +#define LN_aria_128_cfb128 "aria-128-cfb" +#define NID_aria_128_cfb128 1067 +#define OBJ_aria_128_cfb128 OBJ_aria,3L + +#define SN_aria_128_ofb128 "ARIA-128-OFB" +#define LN_aria_128_ofb128 "aria-128-ofb" +#define NID_aria_128_ofb128 1068 +#define OBJ_aria_128_ofb128 OBJ_aria,4L + +#define SN_aria_128_ctr "ARIA-128-CTR" +#define LN_aria_128_ctr "aria-128-ctr" +#define NID_aria_128_ctr 1069 +#define OBJ_aria_128_ctr OBJ_aria,5L + +#define SN_aria_192_ecb "ARIA-192-ECB" +#define LN_aria_192_ecb "aria-192-ecb" +#define NID_aria_192_ecb 1070 +#define OBJ_aria_192_ecb OBJ_aria,6L + +#define SN_aria_192_cbc "ARIA-192-CBC" +#define LN_aria_192_cbc "aria-192-cbc" +#define NID_aria_192_cbc 1071 +#define OBJ_aria_192_cbc OBJ_aria,7L + +#define SN_aria_192_cfb128 "ARIA-192-CFB" +#define LN_aria_192_cfb128 "aria-192-cfb" +#define NID_aria_192_cfb128 1072 +#define OBJ_aria_192_cfb128 OBJ_aria,8L + +#define SN_aria_192_ofb128 "ARIA-192-OFB" +#define LN_aria_192_ofb128 "aria-192-ofb" +#define NID_aria_192_ofb128 1073 +#define OBJ_aria_192_ofb128 OBJ_aria,9L + +#define SN_aria_192_ctr "ARIA-192-CTR" +#define LN_aria_192_ctr "aria-192-ctr" +#define NID_aria_192_ctr 1074 +#define OBJ_aria_192_ctr OBJ_aria,10L + +#define SN_aria_256_ecb "ARIA-256-ECB" +#define LN_aria_256_ecb "aria-256-ecb" +#define NID_aria_256_ecb 1075 +#define OBJ_aria_256_ecb OBJ_aria,11L + +#define SN_aria_256_cbc "ARIA-256-CBC" +#define LN_aria_256_cbc "aria-256-cbc" +#define NID_aria_256_cbc 1076 +#define OBJ_aria_256_cbc OBJ_aria,12L + +#define SN_aria_256_cfb128 "ARIA-256-CFB" +#define LN_aria_256_cfb128 "aria-256-cfb" +#define NID_aria_256_cfb128 1077 +#define OBJ_aria_256_cfb128 OBJ_aria,13L + +#define SN_aria_256_ofb128 "ARIA-256-OFB" +#define LN_aria_256_ofb128 "aria-256-ofb" +#define NID_aria_256_ofb128 1078 +#define OBJ_aria_256_ofb128 OBJ_aria,14L + +#define SN_aria_256_ctr "ARIA-256-CTR" +#define LN_aria_256_ctr "aria-256-ctr" +#define NID_aria_256_ctr 1079 +#define OBJ_aria_256_ctr OBJ_aria,15L + +#define SN_aria_128_cfb1 "ARIA-128-CFB1" +#define LN_aria_128_cfb1 "aria-128-cfb1" +#define NID_aria_128_cfb1 1080 + +#define SN_aria_192_cfb1 "ARIA-192-CFB1" +#define LN_aria_192_cfb1 "aria-192-cfb1" +#define NID_aria_192_cfb1 1081 + +#define SN_aria_256_cfb1 "ARIA-256-CFB1" +#define LN_aria_256_cfb1 "aria-256-cfb1" +#define NID_aria_256_cfb1 1082 + +#define SN_aria_128_cfb8 "ARIA-128-CFB8" +#define LN_aria_128_cfb8 "aria-128-cfb8" +#define NID_aria_128_cfb8 1083 + +#define SN_aria_192_cfb8 "ARIA-192-CFB8" +#define LN_aria_192_cfb8 "aria-192-cfb8" +#define NID_aria_192_cfb8 1084 + +#define SN_aria_256_cfb8 "ARIA-256-CFB8" +#define LN_aria_256_cfb8 "aria-256-cfb8" +#define NID_aria_256_cfb8 1085 + +#define SN_aria_128_ccm "ARIA-128-CCM" +#define LN_aria_128_ccm "aria-128-ccm" +#define NID_aria_128_ccm 1120 +#define OBJ_aria_128_ccm OBJ_aria,37L + +#define SN_aria_192_ccm "ARIA-192-CCM" +#define LN_aria_192_ccm "aria-192-ccm" +#define NID_aria_192_ccm 1121 +#define OBJ_aria_192_ccm OBJ_aria,38L + +#define SN_aria_256_ccm "ARIA-256-CCM" +#define LN_aria_256_ccm "aria-256-ccm" +#define NID_aria_256_ccm 1122 +#define OBJ_aria_256_ccm OBJ_aria,39L + +#define SN_aria_128_gcm "ARIA-128-GCM" +#define LN_aria_128_gcm "aria-128-gcm" +#define NID_aria_128_gcm 1123 +#define OBJ_aria_128_gcm OBJ_aria,34L + +#define SN_aria_192_gcm "ARIA-192-GCM" +#define LN_aria_192_gcm "aria-192-gcm" +#define NID_aria_192_gcm 1124 +#define OBJ_aria_192_gcm OBJ_aria,35L + +#define SN_aria_256_gcm "ARIA-256-GCM" +#define LN_aria_256_gcm "aria-256-gcm" +#define NID_aria_256_gcm 1125 +#define OBJ_aria_256_gcm OBJ_aria,36L + +#define SN_kisa "KISA" +#define LN_kisa "kisa" +#define NID_kisa 773 +#define OBJ_kisa OBJ_member_body,410L,200004L + +#define SN_seed_ecb "SEED-ECB" +#define LN_seed_ecb "seed-ecb" +#define NID_seed_ecb 776 +#define OBJ_seed_ecb OBJ_kisa,1L,3L + +#define SN_seed_cbc "SEED-CBC" +#define LN_seed_cbc "seed-cbc" +#define NID_seed_cbc 777 +#define OBJ_seed_cbc OBJ_kisa,1L,4L + +#define SN_seed_cfb128 "SEED-CFB" +#define LN_seed_cfb128 "seed-cfb" +#define NID_seed_cfb128 779 +#define OBJ_seed_cfb128 OBJ_kisa,1L,5L + +#define SN_seed_ofb128 "SEED-OFB" +#define LN_seed_ofb128 "seed-ofb" +#define NID_seed_ofb128 778 +#define OBJ_seed_ofb128 OBJ_kisa,1L,6L + +#define SN_sm4_ecb "SM4-ECB" +#define LN_sm4_ecb "sm4-ecb" +#define NID_sm4_ecb 1133 +#define OBJ_sm4_ecb OBJ_sm_scheme,104L,1L + +#define SN_sm4_cbc "SM4-CBC" +#define LN_sm4_cbc "sm4-cbc" +#define NID_sm4_cbc 1134 +#define OBJ_sm4_cbc OBJ_sm_scheme,104L,2L + +#define SN_sm4_ofb128 "SM4-OFB" +#define LN_sm4_ofb128 "sm4-ofb" +#define NID_sm4_ofb128 1135 +#define OBJ_sm4_ofb128 OBJ_sm_scheme,104L,3L + +#define SN_sm4_cfb128 "SM4-CFB" +#define LN_sm4_cfb128 "sm4-cfb" +#define NID_sm4_cfb128 1137 +#define OBJ_sm4_cfb128 OBJ_sm_scheme,104L,4L + +#define SN_sm4_cfb1 "SM4-CFB1" +#define LN_sm4_cfb1 "sm4-cfb1" +#define NID_sm4_cfb1 1136 +#define OBJ_sm4_cfb1 OBJ_sm_scheme,104L,5L + +#define SN_sm4_cfb8 "SM4-CFB8" +#define LN_sm4_cfb8 "sm4-cfb8" +#define NID_sm4_cfb8 1138 +#define OBJ_sm4_cfb8 OBJ_sm_scheme,104L,6L + +#define SN_sm4_ctr "SM4-CTR" +#define LN_sm4_ctr "sm4-ctr" +#define NID_sm4_ctr 1139 +#define OBJ_sm4_ctr OBJ_sm_scheme,104L,7L + +#define SN_hmac "HMAC" +#define LN_hmac "hmac" +#define NID_hmac 855 + +#define SN_cmac "CMAC" +#define LN_cmac "cmac" +#define NID_cmac 894 + +#define SN_rc4_hmac_md5 "RC4-HMAC-MD5" +#define LN_rc4_hmac_md5 "rc4-hmac-md5" +#define NID_rc4_hmac_md5 915 + +#define SN_aes_128_cbc_hmac_sha1 "AES-128-CBC-HMAC-SHA1" +#define LN_aes_128_cbc_hmac_sha1 "aes-128-cbc-hmac-sha1" +#define NID_aes_128_cbc_hmac_sha1 916 + +#define SN_aes_192_cbc_hmac_sha1 "AES-192-CBC-HMAC-SHA1" +#define LN_aes_192_cbc_hmac_sha1 "aes-192-cbc-hmac-sha1" +#define NID_aes_192_cbc_hmac_sha1 917 + +#define SN_aes_256_cbc_hmac_sha1 "AES-256-CBC-HMAC-SHA1" +#define LN_aes_256_cbc_hmac_sha1 "aes-256-cbc-hmac-sha1" +#define NID_aes_256_cbc_hmac_sha1 918 + +#define SN_aes_128_cbc_hmac_sha256 "AES-128-CBC-HMAC-SHA256" +#define LN_aes_128_cbc_hmac_sha256 "aes-128-cbc-hmac-sha256" +#define NID_aes_128_cbc_hmac_sha256 948 + +#define SN_aes_192_cbc_hmac_sha256 "AES-192-CBC-HMAC-SHA256" +#define LN_aes_192_cbc_hmac_sha256 "aes-192-cbc-hmac-sha256" +#define NID_aes_192_cbc_hmac_sha256 949 + +#define SN_aes_256_cbc_hmac_sha256 "AES-256-CBC-HMAC-SHA256" +#define LN_aes_256_cbc_hmac_sha256 "aes-256-cbc-hmac-sha256" +#define NID_aes_256_cbc_hmac_sha256 950 + +#define SN_chacha20_poly1305 "ChaCha20-Poly1305" +#define LN_chacha20_poly1305 "chacha20-poly1305" +#define NID_chacha20_poly1305 1018 + +#define SN_chacha20 "ChaCha20" +#define LN_chacha20 "chacha20" +#define NID_chacha20 1019 + +#define SN_dhpublicnumber "dhpublicnumber" +#define LN_dhpublicnumber "X9.42 DH" +#define NID_dhpublicnumber 920 +#define OBJ_dhpublicnumber OBJ_ISO_US,10046L,2L,1L + +#define SN_brainpoolP160r1 "brainpoolP160r1" +#define NID_brainpoolP160r1 921 +#define OBJ_brainpoolP160r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,1L + +#define SN_brainpoolP160t1 "brainpoolP160t1" +#define NID_brainpoolP160t1 922 +#define OBJ_brainpoolP160t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,2L + +#define SN_brainpoolP192r1 "brainpoolP192r1" +#define NID_brainpoolP192r1 923 +#define OBJ_brainpoolP192r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,3L + +#define SN_brainpoolP192t1 "brainpoolP192t1" +#define NID_brainpoolP192t1 924 +#define OBJ_brainpoolP192t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,4L + +#define SN_brainpoolP224r1 "brainpoolP224r1" +#define NID_brainpoolP224r1 925 +#define OBJ_brainpoolP224r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,5L + +#define SN_brainpoolP224t1 "brainpoolP224t1" +#define NID_brainpoolP224t1 926 +#define OBJ_brainpoolP224t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,6L + +#define SN_brainpoolP256r1 "brainpoolP256r1" +#define NID_brainpoolP256r1 927 +#define OBJ_brainpoolP256r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,7L + +#define SN_brainpoolP256t1 "brainpoolP256t1" +#define NID_brainpoolP256t1 928 +#define OBJ_brainpoolP256t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,8L + +#define SN_brainpoolP320r1 "brainpoolP320r1" +#define NID_brainpoolP320r1 929 +#define OBJ_brainpoolP320r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,9L + +#define SN_brainpoolP320t1 "brainpoolP320t1" +#define NID_brainpoolP320t1 930 +#define OBJ_brainpoolP320t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,10L + +#define SN_brainpoolP384r1 "brainpoolP384r1" +#define NID_brainpoolP384r1 931 +#define OBJ_brainpoolP384r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,11L + +#define SN_brainpoolP384t1 "brainpoolP384t1" +#define NID_brainpoolP384t1 932 +#define OBJ_brainpoolP384t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,12L + +#define SN_brainpoolP512r1 "brainpoolP512r1" +#define NID_brainpoolP512r1 933 +#define OBJ_brainpoolP512r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,13L + +#define SN_brainpoolP512t1 "brainpoolP512t1" +#define NID_brainpoolP512t1 934 +#define OBJ_brainpoolP512t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,14L + +#define OBJ_x9_63_scheme 1L,3L,133L,16L,840L,63L,0L + +#define OBJ_secg_scheme OBJ_certicom_arc,1L + +#define SN_dhSinglePass_stdDH_sha1kdf_scheme "dhSinglePass-stdDH-sha1kdf-scheme" +#define NID_dhSinglePass_stdDH_sha1kdf_scheme 936 +#define OBJ_dhSinglePass_stdDH_sha1kdf_scheme OBJ_x9_63_scheme,2L + +#define SN_dhSinglePass_stdDH_sha224kdf_scheme "dhSinglePass-stdDH-sha224kdf-scheme" +#define NID_dhSinglePass_stdDH_sha224kdf_scheme 937 +#define OBJ_dhSinglePass_stdDH_sha224kdf_scheme OBJ_secg_scheme,11L,0L + +#define SN_dhSinglePass_stdDH_sha256kdf_scheme "dhSinglePass-stdDH-sha256kdf-scheme" +#define NID_dhSinglePass_stdDH_sha256kdf_scheme 938 +#define OBJ_dhSinglePass_stdDH_sha256kdf_scheme OBJ_secg_scheme,11L,1L + +#define SN_dhSinglePass_stdDH_sha384kdf_scheme "dhSinglePass-stdDH-sha384kdf-scheme" +#define NID_dhSinglePass_stdDH_sha384kdf_scheme 939 +#define OBJ_dhSinglePass_stdDH_sha384kdf_scheme OBJ_secg_scheme,11L,2L + +#define SN_dhSinglePass_stdDH_sha512kdf_scheme "dhSinglePass-stdDH-sha512kdf-scheme" +#define NID_dhSinglePass_stdDH_sha512kdf_scheme 940 +#define OBJ_dhSinglePass_stdDH_sha512kdf_scheme OBJ_secg_scheme,11L,3L + +#define SN_dhSinglePass_cofactorDH_sha1kdf_scheme "dhSinglePass-cofactorDH-sha1kdf-scheme" +#define NID_dhSinglePass_cofactorDH_sha1kdf_scheme 941 +#define OBJ_dhSinglePass_cofactorDH_sha1kdf_scheme OBJ_x9_63_scheme,3L + +#define SN_dhSinglePass_cofactorDH_sha224kdf_scheme "dhSinglePass-cofactorDH-sha224kdf-scheme" +#define NID_dhSinglePass_cofactorDH_sha224kdf_scheme 942 +#define OBJ_dhSinglePass_cofactorDH_sha224kdf_scheme OBJ_secg_scheme,14L,0L + +#define SN_dhSinglePass_cofactorDH_sha256kdf_scheme "dhSinglePass-cofactorDH-sha256kdf-scheme" +#define NID_dhSinglePass_cofactorDH_sha256kdf_scheme 943 +#define OBJ_dhSinglePass_cofactorDH_sha256kdf_scheme OBJ_secg_scheme,14L,1L + +#define SN_dhSinglePass_cofactorDH_sha384kdf_scheme "dhSinglePass-cofactorDH-sha384kdf-scheme" +#define NID_dhSinglePass_cofactorDH_sha384kdf_scheme 944 +#define OBJ_dhSinglePass_cofactorDH_sha384kdf_scheme OBJ_secg_scheme,14L,2L + +#define SN_dhSinglePass_cofactorDH_sha512kdf_scheme "dhSinglePass-cofactorDH-sha512kdf-scheme" +#define NID_dhSinglePass_cofactorDH_sha512kdf_scheme 945 +#define OBJ_dhSinglePass_cofactorDH_sha512kdf_scheme OBJ_secg_scheme,14L,3L + +#define SN_dh_std_kdf "dh-std-kdf" +#define NID_dh_std_kdf 946 + +#define SN_dh_cofactor_kdf "dh-cofactor-kdf" +#define NID_dh_cofactor_kdf 947 + +#define SN_ct_precert_scts "ct_precert_scts" +#define LN_ct_precert_scts "CT Precertificate SCTs" +#define NID_ct_precert_scts 951 +#define OBJ_ct_precert_scts 1L,3L,6L,1L,4L,1L,11129L,2L,4L,2L + +#define SN_ct_precert_poison "ct_precert_poison" +#define LN_ct_precert_poison "CT Precertificate Poison" +#define NID_ct_precert_poison 952 +#define OBJ_ct_precert_poison 1L,3L,6L,1L,4L,1L,11129L,2L,4L,3L + +#define SN_ct_precert_signer "ct_precert_signer" +#define LN_ct_precert_signer "CT Precertificate Signer" +#define NID_ct_precert_signer 953 +#define OBJ_ct_precert_signer 1L,3L,6L,1L,4L,1L,11129L,2L,4L,4L + +#define SN_ct_cert_scts "ct_cert_scts" +#define LN_ct_cert_scts "CT Certificate SCTs" +#define NID_ct_cert_scts 954 +#define OBJ_ct_cert_scts 1L,3L,6L,1L,4L,1L,11129L,2L,4L,5L + +#define SN_jurisdictionLocalityName "jurisdictionL" +#define LN_jurisdictionLocalityName "jurisdictionLocalityName" +#define NID_jurisdictionLocalityName 955 +#define OBJ_jurisdictionLocalityName 1L,3L,6L,1L,4L,1L,311L,60L,2L,1L,1L + +#define SN_jurisdictionStateOrProvinceName "jurisdictionST" +#define LN_jurisdictionStateOrProvinceName "jurisdictionStateOrProvinceName" +#define NID_jurisdictionStateOrProvinceName 956 +#define OBJ_jurisdictionStateOrProvinceName 1L,3L,6L,1L,4L,1L,311L,60L,2L,1L,2L + +#define SN_jurisdictionCountryName "jurisdictionC" +#define LN_jurisdictionCountryName "jurisdictionCountryName" +#define NID_jurisdictionCountryName 957 +#define OBJ_jurisdictionCountryName 1L,3L,6L,1L,4L,1L,311L,60L,2L,1L,3L + +#define SN_id_scrypt "id-scrypt" +#define LN_id_scrypt "scrypt" +#define NID_id_scrypt 973 +#define OBJ_id_scrypt 1L,3L,6L,1L,4L,1L,11591L,4L,11L + +#define SN_tls1_prf "TLS1-PRF" +#define LN_tls1_prf "tls1-prf" +#define NID_tls1_prf 1021 + +#define SN_hkdf "HKDF" +#define LN_hkdf "hkdf" +#define NID_hkdf 1036 + +#define SN_id_pkinit "id-pkinit" +#define NID_id_pkinit 1031 +#define OBJ_id_pkinit 1L,3L,6L,1L,5L,2L,3L + +#define SN_pkInitClientAuth "pkInitClientAuth" +#define LN_pkInitClientAuth "PKINIT Client Auth" +#define NID_pkInitClientAuth 1032 +#define OBJ_pkInitClientAuth OBJ_id_pkinit,4L + +#define SN_pkInitKDC "pkInitKDC" +#define LN_pkInitKDC "Signing KDC Response" +#define NID_pkInitKDC 1033 +#define OBJ_pkInitKDC OBJ_id_pkinit,5L + +#define SN_X25519 "X25519" +#define NID_X25519 1034 +#define OBJ_X25519 1L,3L,101L,110L + +#define SN_X448 "X448" +#define NID_X448 1035 +#define OBJ_X448 1L,3L,101L,111L + +#define SN_ED25519 "ED25519" +#define NID_ED25519 1087 +#define OBJ_ED25519 1L,3L,101L,112L + +#define SN_ED448 "ED448" +#define NID_ED448 1088 +#define OBJ_ED448 1L,3L,101L,113L + +#define SN_kx_rsa "KxRSA" +#define LN_kx_rsa "kx-rsa" +#define NID_kx_rsa 1037 + +#define SN_kx_ecdhe "KxECDHE" +#define LN_kx_ecdhe "kx-ecdhe" +#define NID_kx_ecdhe 1038 + +#define SN_kx_dhe "KxDHE" +#define LN_kx_dhe "kx-dhe" +#define NID_kx_dhe 1039 + +#define SN_kx_ecdhe_psk "KxECDHE-PSK" +#define LN_kx_ecdhe_psk "kx-ecdhe-psk" +#define NID_kx_ecdhe_psk 1040 + +#define SN_kx_dhe_psk "KxDHE-PSK" +#define LN_kx_dhe_psk "kx-dhe-psk" +#define NID_kx_dhe_psk 1041 + +#define SN_kx_rsa_psk "KxRSA_PSK" +#define LN_kx_rsa_psk "kx-rsa-psk" +#define NID_kx_rsa_psk 1042 + +#define SN_kx_psk "KxPSK" +#define LN_kx_psk "kx-psk" +#define NID_kx_psk 1043 + +#define SN_kx_srp "KxSRP" +#define LN_kx_srp "kx-srp" +#define NID_kx_srp 1044 + +#define SN_kx_gost "KxGOST" +#define LN_kx_gost "kx-gost" +#define NID_kx_gost 1045 + +#define SN_kx_any "KxANY" +#define LN_kx_any "kx-any" +#define NID_kx_any 1063 + +#define SN_auth_rsa "AuthRSA" +#define LN_auth_rsa "auth-rsa" +#define NID_auth_rsa 1046 + +#define SN_auth_ecdsa "AuthECDSA" +#define LN_auth_ecdsa "auth-ecdsa" +#define NID_auth_ecdsa 1047 + +#define SN_auth_psk "AuthPSK" +#define LN_auth_psk "auth-psk" +#define NID_auth_psk 1048 + +#define SN_auth_dss "AuthDSS" +#define LN_auth_dss "auth-dss" +#define NID_auth_dss 1049 + +#define SN_auth_gost01 "AuthGOST01" +#define LN_auth_gost01 "auth-gost01" +#define NID_auth_gost01 1050 + +#define SN_auth_gost12 "AuthGOST12" +#define LN_auth_gost12 "auth-gost12" +#define NID_auth_gost12 1051 + +#define SN_auth_srp "AuthSRP" +#define LN_auth_srp "auth-srp" +#define NID_auth_srp 1052 + +#define SN_auth_null "AuthNULL" +#define LN_auth_null "auth-null" +#define NID_auth_null 1053 + +#define SN_auth_any "AuthANY" +#define LN_auth_any "auth-any" +#define NID_auth_any 1064 + +#define SN_poly1305 "Poly1305" +#define LN_poly1305 "poly1305" +#define NID_poly1305 1061 + +#define SN_siphash "SipHash" +#define LN_siphash "siphash" +#define NID_siphash 1062 + +#define SN_ffdhe2048 "ffdhe2048" +#define NID_ffdhe2048 1126 + +#define SN_ffdhe3072 "ffdhe3072" +#define NID_ffdhe3072 1127 + +#define SN_ffdhe4096 "ffdhe4096" +#define NID_ffdhe4096 1128 + +#define SN_ffdhe6144 "ffdhe6144" +#define NID_ffdhe6144 1129 + +#define SN_ffdhe8192 "ffdhe8192" +#define NID_ffdhe8192 1130 + +#define SN_ISO_UA "ISO-UA" +#define NID_ISO_UA 1150 +#define OBJ_ISO_UA OBJ_member_body,804L + +#define SN_ua_pki "ua-pki" +#define NID_ua_pki 1151 +#define OBJ_ua_pki OBJ_ISO_UA,2L,1L,1L,1L + +#define SN_dstu28147 "dstu28147" +#define LN_dstu28147 "DSTU Gost 28147-2009" +#define NID_dstu28147 1152 +#define OBJ_dstu28147 OBJ_ua_pki,1L,1L,1L + +#define SN_dstu28147_ofb "dstu28147-ofb" +#define LN_dstu28147_ofb "DSTU Gost 28147-2009 OFB mode" +#define NID_dstu28147_ofb 1153 +#define OBJ_dstu28147_ofb OBJ_dstu28147,2L + +#define SN_dstu28147_cfb "dstu28147-cfb" +#define LN_dstu28147_cfb "DSTU Gost 28147-2009 CFB mode" +#define NID_dstu28147_cfb 1154 +#define OBJ_dstu28147_cfb OBJ_dstu28147,3L + +#define SN_dstu28147_wrap "dstu28147-wrap" +#define LN_dstu28147_wrap "DSTU Gost 28147-2009 key wrap" +#define NID_dstu28147_wrap 1155 +#define OBJ_dstu28147_wrap OBJ_dstu28147,5L + +#define SN_hmacWithDstu34311 "hmacWithDstu34311" +#define LN_hmacWithDstu34311 "HMAC DSTU Gost 34311-95" +#define NID_hmacWithDstu34311 1156 +#define OBJ_hmacWithDstu34311 OBJ_ua_pki,1L,1L,2L + +#define SN_dstu34311 "dstu34311" +#define LN_dstu34311 "DSTU Gost 34311-95" +#define NID_dstu34311 1157 +#define OBJ_dstu34311 OBJ_ua_pki,1L,2L,1L + +#define SN_dstu4145le "dstu4145le" +#define LN_dstu4145le "DSTU 4145-2002 little endian" +#define NID_dstu4145le 1158 +#define OBJ_dstu4145le OBJ_ua_pki,1L,3L,1L,1L + +#define SN_dstu4145be "dstu4145be" +#define LN_dstu4145be "DSTU 4145-2002 big endian" +#define NID_dstu4145be 1159 +#define OBJ_dstu4145be OBJ_dstu4145le,1L,1L + +#define SN_uacurve0 "uacurve0" +#define LN_uacurve0 "DSTU curve 0" +#define NID_uacurve0 1160 +#define OBJ_uacurve0 OBJ_dstu4145le,2L,0L + +#define SN_uacurve1 "uacurve1" +#define LN_uacurve1 "DSTU curve 1" +#define NID_uacurve1 1161 +#define OBJ_uacurve1 OBJ_dstu4145le,2L,1L + +#define SN_uacurve2 "uacurve2" +#define LN_uacurve2 "DSTU curve 2" +#define NID_uacurve2 1162 +#define OBJ_uacurve2 OBJ_dstu4145le,2L,2L + +#define SN_uacurve3 "uacurve3" +#define LN_uacurve3 "DSTU curve 3" +#define NID_uacurve3 1163 +#define OBJ_uacurve3 OBJ_dstu4145le,2L,3L + +#define SN_uacurve4 "uacurve4" +#define LN_uacurve4 "DSTU curve 4" +#define NID_uacurve4 1164 +#define OBJ_uacurve4 OBJ_dstu4145le,2L,4L + +#define SN_uacurve5 "uacurve5" +#define LN_uacurve5 "DSTU curve 5" +#define NID_uacurve5 1165 +#define OBJ_uacurve5 OBJ_dstu4145le,2L,5L + +#define SN_uacurve6 "uacurve6" +#define LN_uacurve6 "DSTU curve 6" +#define NID_uacurve6 1166 +#define OBJ_uacurve6 OBJ_dstu4145le,2L,6L + +#define SN_uacurve7 "uacurve7" +#define LN_uacurve7 "DSTU curve 7" +#define NID_uacurve7 1167 +#define OBJ_uacurve7 OBJ_dstu4145le,2L,7L + +#define SN_uacurve8 "uacurve8" +#define LN_uacurve8 "DSTU curve 8" +#define NID_uacurve8 1168 +#define OBJ_uacurve8 OBJ_dstu4145le,2L,8L + +#define SN_uacurve9 "uacurve9" +#define LN_uacurve9 "DSTU curve 9" +#define NID_uacurve9 1169 +#define OBJ_uacurve9 OBJ_dstu4145le,2L,9L diff --git a/MediaClient/MediaClient/openssl/include/openssl/objects.h b/MediaClient/MediaClient/openssl/include/openssl/objects.h new file mode 100644 index 0000000..5e8b576 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/objects.h @@ -0,0 +1,175 @@ +/* + * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_OBJECTS_H +# define HEADER_OBJECTS_H + +# include +# include +# include +# include + +# define OBJ_NAME_TYPE_UNDEF 0x00 +# define OBJ_NAME_TYPE_MD_METH 0x01 +# define OBJ_NAME_TYPE_CIPHER_METH 0x02 +# define OBJ_NAME_TYPE_PKEY_METH 0x03 +# define OBJ_NAME_TYPE_COMP_METH 0x04 +# define OBJ_NAME_TYPE_NUM 0x05 + +# define OBJ_NAME_ALIAS 0x8000 + +# define OBJ_BSEARCH_VALUE_ON_NOMATCH 0x01 +# define OBJ_BSEARCH_FIRST_VALUE_ON_MATCH 0x02 + + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct obj_name_st { + int type; + int alias; + const char *name; + const char *data; +} OBJ_NAME; + +# define OBJ_create_and_add_object(a,b,c) OBJ_create(a,b,c) + +int OBJ_NAME_init(void); +int OBJ_NAME_new_index(unsigned long (*hash_func) (const char *), + int (*cmp_func) (const char *, const char *), + void (*free_func) (const char *, int, const char *)); +const char *OBJ_NAME_get(const char *name, int type); +int OBJ_NAME_add(const char *name, int type, const char *data); +int OBJ_NAME_remove(const char *name, int type); +void OBJ_NAME_cleanup(int type); /* -1 for everything */ +void OBJ_NAME_do_all(int type, void (*fn) (const OBJ_NAME *, void *arg), + void *arg); +void OBJ_NAME_do_all_sorted(int type, + void (*fn) (const OBJ_NAME *, void *arg), + void *arg); + +ASN1_OBJECT *OBJ_dup(const ASN1_OBJECT *o); +ASN1_OBJECT *OBJ_nid2obj(int n); +const char *OBJ_nid2ln(int n); +const char *OBJ_nid2sn(int n); +int OBJ_obj2nid(const ASN1_OBJECT *o); +ASN1_OBJECT *OBJ_txt2obj(const char *s, int no_name); +int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name); +int OBJ_txt2nid(const char *s); +int OBJ_ln2nid(const char *s); +int OBJ_sn2nid(const char *s); +int OBJ_cmp(const ASN1_OBJECT *a, const ASN1_OBJECT *b); +const void *OBJ_bsearch_(const void *key, const void *base, int num, int size, + int (*cmp) (const void *, const void *)); +const void *OBJ_bsearch_ex_(const void *key, const void *base, int num, + int size, + int (*cmp) (const void *, const void *), + int flags); + +# define _DECLARE_OBJ_BSEARCH_CMP_FN(scope, type1, type2, nm) \ + static int nm##_cmp_BSEARCH_CMP_FN(const void *, const void *); \ + static int nm##_cmp(type1 const *, type2 const *); \ + scope type2 * OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) + +# define DECLARE_OBJ_BSEARCH_CMP_FN(type1, type2, cmp) \ + _DECLARE_OBJ_BSEARCH_CMP_FN(static, type1, type2, cmp) +# define DECLARE_OBJ_BSEARCH_GLOBAL_CMP_FN(type1, type2, nm) \ + type2 * OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) + +/*- + * Unsolved problem: if a type is actually a pointer type, like + * nid_triple is, then its impossible to get a const where you need + * it. Consider: + * + * typedef int nid_triple[3]; + * const void *a_; + * const nid_triple const *a = a_; + * + * The assignment discards a const because what you really want is: + * + * const int const * const *a = a_; + * + * But if you do that, you lose the fact that a is an array of 3 ints, + * which breaks comparison functions. + * + * Thus we end up having to cast, sadly, or unpack the + * declarations. Or, as I finally did in this case, declare nid_triple + * to be a struct, which it should have been in the first place. + * + * Ben, August 2008. + * + * Also, strictly speaking not all types need be const, but handling + * the non-constness means a lot of complication, and in practice + * comparison routines do always not touch their arguments. + */ + +# define IMPLEMENT_OBJ_BSEARCH_CMP_FN(type1, type2, nm) \ + static int nm##_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_) \ + { \ + type1 const *a = a_; \ + type2 const *b = b_; \ + return nm##_cmp(a,b); \ + } \ + static type2 *OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) \ + { \ + return (type2 *)OBJ_bsearch_(key, base, num, sizeof(type2), \ + nm##_cmp_BSEARCH_CMP_FN); \ + } \ + extern void dummy_prototype(void) + +# define IMPLEMENT_OBJ_BSEARCH_GLOBAL_CMP_FN(type1, type2, nm) \ + static int nm##_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_) \ + { \ + type1 const *a = a_; \ + type2 const *b = b_; \ + return nm##_cmp(a,b); \ + } \ + type2 *OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) \ + { \ + return (type2 *)OBJ_bsearch_(key, base, num, sizeof(type2), \ + nm##_cmp_BSEARCH_CMP_FN); \ + } \ + extern void dummy_prototype(void) + +# define OBJ_bsearch(type1,key,type2,base,num,cmp) \ + ((type2 *)OBJ_bsearch_(CHECKED_PTR_OF(type1,key),CHECKED_PTR_OF(type2,base), \ + num,sizeof(type2), \ + ((void)CHECKED_PTR_OF(type1,cmp##_type_1), \ + (void)CHECKED_PTR_OF(type2,cmp##_type_2), \ + cmp##_BSEARCH_CMP_FN))) + +# define OBJ_bsearch_ex(type1,key,type2,base,num,cmp,flags) \ + ((type2 *)OBJ_bsearch_ex_(CHECKED_PTR_OF(type1,key),CHECKED_PTR_OF(type2,base), \ + num,sizeof(type2), \ + ((void)CHECKED_PTR_OF(type1,cmp##_type_1), \ + (void)type_2=CHECKED_PTR_OF(type2,cmp##_type_2), \ + cmp##_BSEARCH_CMP_FN)),flags) + +int OBJ_new_nid(int num); +int OBJ_add_object(const ASN1_OBJECT *obj); +int OBJ_create(const char *oid, const char *sn, const char *ln); +#if OPENSSL_API_COMPAT < 0x10100000L +# define OBJ_cleanup() while(0) continue +#endif +int OBJ_create_objects(BIO *in); + +size_t OBJ_length(const ASN1_OBJECT *obj); +const unsigned char *OBJ_get0_data(const ASN1_OBJECT *obj); + +int OBJ_find_sigid_algs(int signid, int *pdig_nid, int *ppkey_nid); +int OBJ_find_sigid_by_algs(int *psignid, int dig_nid, int pkey_nid); +int OBJ_add_sigid(int signid, int dig_id, int pkey_id); +void OBJ_sigid_free(void); + + +# ifdef __cplusplus +} +# endif +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/objectserr.h b/MediaClient/MediaClient/openssl/include/openssl/objectserr.h new file mode 100644 index 0000000..02e166f --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/objectserr.h @@ -0,0 +1,42 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_OBJERR_H +# define HEADER_OBJERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_OBJ_strings(void); + +/* + * OBJ function codes. + */ +# define OBJ_F_OBJ_ADD_OBJECT 105 +# define OBJ_F_OBJ_ADD_SIGID 107 +# define OBJ_F_OBJ_CREATE 100 +# define OBJ_F_OBJ_DUP 101 +# define OBJ_F_OBJ_NAME_NEW_INDEX 106 +# define OBJ_F_OBJ_NID2LN 102 +# define OBJ_F_OBJ_NID2OBJ 103 +# define OBJ_F_OBJ_NID2SN 104 +# define OBJ_F_OBJ_TXT2OBJ 108 + +/* + * OBJ reason codes. + */ +# define OBJ_R_OID_EXISTS 102 +# define OBJ_R_UNKNOWN_NID 101 + +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/ocsp.h b/MediaClient/MediaClient/openssl/include/openssl/ocsp.h new file mode 100644 index 0000000..4d759a4 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/ocsp.h @@ -0,0 +1,352 @@ +/* + * Copyright 2000-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_OCSP_H +# define HEADER_OCSP_H + +#include + +/* + * These definitions are outside the OPENSSL_NO_OCSP guard because although for + * historical reasons they have OCSP_* names, they can actually be used + * independently of OCSP. E.g. see RFC5280 + */ +/*- + * CRLReason ::= ENUMERATED { + * unspecified (0), + * keyCompromise (1), + * cACompromise (2), + * affiliationChanged (3), + * superseded (4), + * cessationOfOperation (5), + * certificateHold (6), + * removeFromCRL (8) } + */ +# define OCSP_REVOKED_STATUS_NOSTATUS -1 +# define OCSP_REVOKED_STATUS_UNSPECIFIED 0 +# define OCSP_REVOKED_STATUS_KEYCOMPROMISE 1 +# define OCSP_REVOKED_STATUS_CACOMPROMISE 2 +# define OCSP_REVOKED_STATUS_AFFILIATIONCHANGED 3 +# define OCSP_REVOKED_STATUS_SUPERSEDED 4 +# define OCSP_REVOKED_STATUS_CESSATIONOFOPERATION 5 +# define OCSP_REVOKED_STATUS_CERTIFICATEHOLD 6 +# define OCSP_REVOKED_STATUS_REMOVEFROMCRL 8 + + +# ifndef OPENSSL_NO_OCSP + +# include +# include +# include +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Various flags and values */ + +# define OCSP_DEFAULT_NONCE_LENGTH 16 + +# define OCSP_NOCERTS 0x1 +# define OCSP_NOINTERN 0x2 +# define OCSP_NOSIGS 0x4 +# define OCSP_NOCHAIN 0x8 +# define OCSP_NOVERIFY 0x10 +# define OCSP_NOEXPLICIT 0x20 +# define OCSP_NOCASIGN 0x40 +# define OCSP_NODELEGATED 0x80 +# define OCSP_NOCHECKS 0x100 +# define OCSP_TRUSTOTHER 0x200 +# define OCSP_RESPID_KEY 0x400 +# define OCSP_NOTIME 0x800 + +typedef struct ocsp_cert_id_st OCSP_CERTID; + +DEFINE_STACK_OF(OCSP_CERTID) + +typedef struct ocsp_one_request_st OCSP_ONEREQ; + +DEFINE_STACK_OF(OCSP_ONEREQ) + +typedef struct ocsp_req_info_st OCSP_REQINFO; +typedef struct ocsp_signature_st OCSP_SIGNATURE; +typedef struct ocsp_request_st OCSP_REQUEST; + +# define OCSP_RESPONSE_STATUS_SUCCESSFUL 0 +# define OCSP_RESPONSE_STATUS_MALFORMEDREQUEST 1 +# define OCSP_RESPONSE_STATUS_INTERNALERROR 2 +# define OCSP_RESPONSE_STATUS_TRYLATER 3 +# define OCSP_RESPONSE_STATUS_SIGREQUIRED 5 +# define OCSP_RESPONSE_STATUS_UNAUTHORIZED 6 + +typedef struct ocsp_resp_bytes_st OCSP_RESPBYTES; + +# define V_OCSP_RESPID_NAME 0 +# define V_OCSP_RESPID_KEY 1 + +DEFINE_STACK_OF(OCSP_RESPID) + +typedef struct ocsp_revoked_info_st OCSP_REVOKEDINFO; + +# define V_OCSP_CERTSTATUS_GOOD 0 +# define V_OCSP_CERTSTATUS_REVOKED 1 +# define V_OCSP_CERTSTATUS_UNKNOWN 2 + +typedef struct ocsp_cert_status_st OCSP_CERTSTATUS; +typedef struct ocsp_single_response_st OCSP_SINGLERESP; + +DEFINE_STACK_OF(OCSP_SINGLERESP) + +typedef struct ocsp_response_data_st OCSP_RESPDATA; + +typedef struct ocsp_basic_response_st OCSP_BASICRESP; + +typedef struct ocsp_crl_id_st OCSP_CRLID; +typedef struct ocsp_service_locator_st OCSP_SERVICELOC; + +# define PEM_STRING_OCSP_REQUEST "OCSP REQUEST" +# define PEM_STRING_OCSP_RESPONSE "OCSP RESPONSE" + +# define d2i_OCSP_REQUEST_bio(bp,p) ASN1_d2i_bio_of(OCSP_REQUEST,OCSP_REQUEST_new,d2i_OCSP_REQUEST,bp,p) + +# define d2i_OCSP_RESPONSE_bio(bp,p) ASN1_d2i_bio_of(OCSP_RESPONSE,OCSP_RESPONSE_new,d2i_OCSP_RESPONSE,bp,p) + +# define PEM_read_bio_OCSP_REQUEST(bp,x,cb) (OCSP_REQUEST *)PEM_ASN1_read_bio( \ + (char *(*)())d2i_OCSP_REQUEST,PEM_STRING_OCSP_REQUEST, \ + bp,(char **)(x),cb,NULL) + +# define PEM_read_bio_OCSP_RESPONSE(bp,x,cb) (OCSP_RESPONSE *)PEM_ASN1_read_bio(\ + (char *(*)())d2i_OCSP_RESPONSE,PEM_STRING_OCSP_RESPONSE, \ + bp,(char **)(x),cb,NULL) + +# define PEM_write_bio_OCSP_REQUEST(bp,o) \ + PEM_ASN1_write_bio((int (*)())i2d_OCSP_REQUEST,PEM_STRING_OCSP_REQUEST,\ + bp,(char *)(o), NULL,NULL,0,NULL,NULL) + +# define PEM_write_bio_OCSP_RESPONSE(bp,o) \ + PEM_ASN1_write_bio((int (*)())i2d_OCSP_RESPONSE,PEM_STRING_OCSP_RESPONSE,\ + bp,(char *)(o), NULL,NULL,0,NULL,NULL) + +# define i2d_OCSP_RESPONSE_bio(bp,o) ASN1_i2d_bio_of(OCSP_RESPONSE,i2d_OCSP_RESPONSE,bp,o) + +# define i2d_OCSP_REQUEST_bio(bp,o) ASN1_i2d_bio_of(OCSP_REQUEST,i2d_OCSP_REQUEST,bp,o) + +# define ASN1_BIT_STRING_digest(data,type,md,len) \ + ASN1_item_digest(ASN1_ITEM_rptr(ASN1_BIT_STRING),type,data,md,len) + +# define OCSP_CERTSTATUS_dup(cs)\ + (OCSP_CERTSTATUS*)ASN1_dup((int(*)())i2d_OCSP_CERTSTATUS,\ + (char *(*)())d2i_OCSP_CERTSTATUS,(char *)(cs)) + +OCSP_CERTID *OCSP_CERTID_dup(OCSP_CERTID *id); + +OCSP_RESPONSE *OCSP_sendreq_bio(BIO *b, const char *path, OCSP_REQUEST *req); +OCSP_REQ_CTX *OCSP_sendreq_new(BIO *io, const char *path, OCSP_REQUEST *req, + int maxline); +int OCSP_REQ_CTX_nbio(OCSP_REQ_CTX *rctx); +int OCSP_sendreq_nbio(OCSP_RESPONSE **presp, OCSP_REQ_CTX *rctx); +OCSP_REQ_CTX *OCSP_REQ_CTX_new(BIO *io, int maxline); +void OCSP_REQ_CTX_free(OCSP_REQ_CTX *rctx); +void OCSP_set_max_response_length(OCSP_REQ_CTX *rctx, unsigned long len); +int OCSP_REQ_CTX_i2d(OCSP_REQ_CTX *rctx, const ASN1_ITEM *it, + ASN1_VALUE *val); +int OCSP_REQ_CTX_nbio_d2i(OCSP_REQ_CTX *rctx, ASN1_VALUE **pval, + const ASN1_ITEM *it); +BIO *OCSP_REQ_CTX_get0_mem_bio(OCSP_REQ_CTX *rctx); +int OCSP_REQ_CTX_http(OCSP_REQ_CTX *rctx, const char *op, const char *path); +int OCSP_REQ_CTX_set1_req(OCSP_REQ_CTX *rctx, OCSP_REQUEST *req); +int OCSP_REQ_CTX_add1_header(OCSP_REQ_CTX *rctx, + const char *name, const char *value); + +OCSP_CERTID *OCSP_cert_to_id(const EVP_MD *dgst, const X509 *subject, + const X509 *issuer); + +OCSP_CERTID *OCSP_cert_id_new(const EVP_MD *dgst, + const X509_NAME *issuerName, + const ASN1_BIT_STRING *issuerKey, + const ASN1_INTEGER *serialNumber); + +OCSP_ONEREQ *OCSP_request_add0_id(OCSP_REQUEST *req, OCSP_CERTID *cid); + +int OCSP_request_add1_nonce(OCSP_REQUEST *req, unsigned char *val, int len); +int OCSP_basic_add1_nonce(OCSP_BASICRESP *resp, unsigned char *val, int len); +int OCSP_check_nonce(OCSP_REQUEST *req, OCSP_BASICRESP *bs); +int OCSP_copy_nonce(OCSP_BASICRESP *resp, OCSP_REQUEST *req); + +int OCSP_request_set1_name(OCSP_REQUEST *req, X509_NAME *nm); +int OCSP_request_add1_cert(OCSP_REQUEST *req, X509 *cert); + +int OCSP_request_sign(OCSP_REQUEST *req, + X509 *signer, + EVP_PKEY *key, + const EVP_MD *dgst, + STACK_OF(X509) *certs, unsigned long flags); + +int OCSP_response_status(OCSP_RESPONSE *resp); +OCSP_BASICRESP *OCSP_response_get1_basic(OCSP_RESPONSE *resp); + +const ASN1_OCTET_STRING *OCSP_resp_get0_signature(const OCSP_BASICRESP *bs); +const X509_ALGOR *OCSP_resp_get0_tbs_sigalg(const OCSP_BASICRESP *bs); +const OCSP_RESPDATA *OCSP_resp_get0_respdata(const OCSP_BASICRESP *bs); +int OCSP_resp_get0_signer(OCSP_BASICRESP *bs, X509 **signer, + STACK_OF(X509) *extra_certs); + +int OCSP_resp_count(OCSP_BASICRESP *bs); +OCSP_SINGLERESP *OCSP_resp_get0(OCSP_BASICRESP *bs, int idx); +const ASN1_GENERALIZEDTIME *OCSP_resp_get0_produced_at(const OCSP_BASICRESP* bs); +const STACK_OF(X509) *OCSP_resp_get0_certs(const OCSP_BASICRESP *bs); +int OCSP_resp_get0_id(const OCSP_BASICRESP *bs, + const ASN1_OCTET_STRING **pid, + const X509_NAME **pname); +int OCSP_resp_get1_id(const OCSP_BASICRESP *bs, + ASN1_OCTET_STRING **pid, + X509_NAME **pname); + +int OCSP_resp_find(OCSP_BASICRESP *bs, OCSP_CERTID *id, int last); +int OCSP_single_get0_status(OCSP_SINGLERESP *single, int *reason, + ASN1_GENERALIZEDTIME **revtime, + ASN1_GENERALIZEDTIME **thisupd, + ASN1_GENERALIZEDTIME **nextupd); +int OCSP_resp_find_status(OCSP_BASICRESP *bs, OCSP_CERTID *id, int *status, + int *reason, + ASN1_GENERALIZEDTIME **revtime, + ASN1_GENERALIZEDTIME **thisupd, + ASN1_GENERALIZEDTIME **nextupd); +int OCSP_check_validity(ASN1_GENERALIZEDTIME *thisupd, + ASN1_GENERALIZEDTIME *nextupd, long sec, long maxsec); + +int OCSP_request_verify(OCSP_REQUEST *req, STACK_OF(X509) *certs, + X509_STORE *store, unsigned long flags); + +int OCSP_parse_url(const char *url, char **phost, char **pport, char **ppath, + int *pssl); + +int OCSP_id_issuer_cmp(const OCSP_CERTID *a, const OCSP_CERTID *b); +int OCSP_id_cmp(const OCSP_CERTID *a, const OCSP_CERTID *b); + +int OCSP_request_onereq_count(OCSP_REQUEST *req); +OCSP_ONEREQ *OCSP_request_onereq_get0(OCSP_REQUEST *req, int i); +OCSP_CERTID *OCSP_onereq_get0_id(OCSP_ONEREQ *one); +int OCSP_id_get0_info(ASN1_OCTET_STRING **piNameHash, ASN1_OBJECT **pmd, + ASN1_OCTET_STRING **pikeyHash, + ASN1_INTEGER **pserial, OCSP_CERTID *cid); +int OCSP_request_is_signed(OCSP_REQUEST *req); +OCSP_RESPONSE *OCSP_response_create(int status, OCSP_BASICRESP *bs); +OCSP_SINGLERESP *OCSP_basic_add1_status(OCSP_BASICRESP *rsp, + OCSP_CERTID *cid, + int status, int reason, + ASN1_TIME *revtime, + ASN1_TIME *thisupd, + ASN1_TIME *nextupd); +int OCSP_basic_add1_cert(OCSP_BASICRESP *resp, X509 *cert); +int OCSP_basic_sign(OCSP_BASICRESP *brsp, + X509 *signer, EVP_PKEY *key, const EVP_MD *dgst, + STACK_OF(X509) *certs, unsigned long flags); +int OCSP_basic_sign_ctx(OCSP_BASICRESP *brsp, + X509 *signer, EVP_MD_CTX *ctx, + STACK_OF(X509) *certs, unsigned long flags); +int OCSP_RESPID_set_by_name(OCSP_RESPID *respid, X509 *cert); +int OCSP_RESPID_set_by_key(OCSP_RESPID *respid, X509 *cert); +int OCSP_RESPID_match(OCSP_RESPID *respid, X509 *cert); + +X509_EXTENSION *OCSP_crlID_new(const char *url, long *n, char *tim); + +X509_EXTENSION *OCSP_accept_responses_new(char **oids); + +X509_EXTENSION *OCSP_archive_cutoff_new(char *tim); + +X509_EXTENSION *OCSP_url_svcloc_new(X509_NAME *issuer, const char **urls); + +int OCSP_REQUEST_get_ext_count(OCSP_REQUEST *x); +int OCSP_REQUEST_get_ext_by_NID(OCSP_REQUEST *x, int nid, int lastpos); +int OCSP_REQUEST_get_ext_by_OBJ(OCSP_REQUEST *x, const ASN1_OBJECT *obj, + int lastpos); +int OCSP_REQUEST_get_ext_by_critical(OCSP_REQUEST *x, int crit, int lastpos); +X509_EXTENSION *OCSP_REQUEST_get_ext(OCSP_REQUEST *x, int loc); +X509_EXTENSION *OCSP_REQUEST_delete_ext(OCSP_REQUEST *x, int loc); +void *OCSP_REQUEST_get1_ext_d2i(OCSP_REQUEST *x, int nid, int *crit, + int *idx); +int OCSP_REQUEST_add1_ext_i2d(OCSP_REQUEST *x, int nid, void *value, int crit, + unsigned long flags); +int OCSP_REQUEST_add_ext(OCSP_REQUEST *x, X509_EXTENSION *ex, int loc); + +int OCSP_ONEREQ_get_ext_count(OCSP_ONEREQ *x); +int OCSP_ONEREQ_get_ext_by_NID(OCSP_ONEREQ *x, int nid, int lastpos); +int OCSP_ONEREQ_get_ext_by_OBJ(OCSP_ONEREQ *x, const ASN1_OBJECT *obj, int lastpos); +int OCSP_ONEREQ_get_ext_by_critical(OCSP_ONEREQ *x, int crit, int lastpos); +X509_EXTENSION *OCSP_ONEREQ_get_ext(OCSP_ONEREQ *x, int loc); +X509_EXTENSION *OCSP_ONEREQ_delete_ext(OCSP_ONEREQ *x, int loc); +void *OCSP_ONEREQ_get1_ext_d2i(OCSP_ONEREQ *x, int nid, int *crit, int *idx); +int OCSP_ONEREQ_add1_ext_i2d(OCSP_ONEREQ *x, int nid, void *value, int crit, + unsigned long flags); +int OCSP_ONEREQ_add_ext(OCSP_ONEREQ *x, X509_EXTENSION *ex, int loc); + +int OCSP_BASICRESP_get_ext_count(OCSP_BASICRESP *x); +int OCSP_BASICRESP_get_ext_by_NID(OCSP_BASICRESP *x, int nid, int lastpos); +int OCSP_BASICRESP_get_ext_by_OBJ(OCSP_BASICRESP *x, const ASN1_OBJECT *obj, + int lastpos); +int OCSP_BASICRESP_get_ext_by_critical(OCSP_BASICRESP *x, int crit, + int lastpos); +X509_EXTENSION *OCSP_BASICRESP_get_ext(OCSP_BASICRESP *x, int loc); +X509_EXTENSION *OCSP_BASICRESP_delete_ext(OCSP_BASICRESP *x, int loc); +void *OCSP_BASICRESP_get1_ext_d2i(OCSP_BASICRESP *x, int nid, int *crit, + int *idx); +int OCSP_BASICRESP_add1_ext_i2d(OCSP_BASICRESP *x, int nid, void *value, + int crit, unsigned long flags); +int OCSP_BASICRESP_add_ext(OCSP_BASICRESP *x, X509_EXTENSION *ex, int loc); + +int OCSP_SINGLERESP_get_ext_count(OCSP_SINGLERESP *x); +int OCSP_SINGLERESP_get_ext_by_NID(OCSP_SINGLERESP *x, int nid, int lastpos); +int OCSP_SINGLERESP_get_ext_by_OBJ(OCSP_SINGLERESP *x, const ASN1_OBJECT *obj, + int lastpos); +int OCSP_SINGLERESP_get_ext_by_critical(OCSP_SINGLERESP *x, int crit, + int lastpos); +X509_EXTENSION *OCSP_SINGLERESP_get_ext(OCSP_SINGLERESP *x, int loc); +X509_EXTENSION *OCSP_SINGLERESP_delete_ext(OCSP_SINGLERESP *x, int loc); +void *OCSP_SINGLERESP_get1_ext_d2i(OCSP_SINGLERESP *x, int nid, int *crit, + int *idx); +int OCSP_SINGLERESP_add1_ext_i2d(OCSP_SINGLERESP *x, int nid, void *value, + int crit, unsigned long flags); +int OCSP_SINGLERESP_add_ext(OCSP_SINGLERESP *x, X509_EXTENSION *ex, int loc); +const OCSP_CERTID *OCSP_SINGLERESP_get0_id(const OCSP_SINGLERESP *x); + +DECLARE_ASN1_FUNCTIONS(OCSP_SINGLERESP) +DECLARE_ASN1_FUNCTIONS(OCSP_CERTSTATUS) +DECLARE_ASN1_FUNCTIONS(OCSP_REVOKEDINFO) +DECLARE_ASN1_FUNCTIONS(OCSP_BASICRESP) +DECLARE_ASN1_FUNCTIONS(OCSP_RESPDATA) +DECLARE_ASN1_FUNCTIONS(OCSP_RESPID) +DECLARE_ASN1_FUNCTIONS(OCSP_RESPONSE) +DECLARE_ASN1_FUNCTIONS(OCSP_RESPBYTES) +DECLARE_ASN1_FUNCTIONS(OCSP_ONEREQ) +DECLARE_ASN1_FUNCTIONS(OCSP_CERTID) +DECLARE_ASN1_FUNCTIONS(OCSP_REQUEST) +DECLARE_ASN1_FUNCTIONS(OCSP_SIGNATURE) +DECLARE_ASN1_FUNCTIONS(OCSP_REQINFO) +DECLARE_ASN1_FUNCTIONS(OCSP_CRLID) +DECLARE_ASN1_FUNCTIONS(OCSP_SERVICELOC) + +const char *OCSP_response_status_str(long s); +const char *OCSP_cert_status_str(long s); +const char *OCSP_crl_reason_str(long s); + +int OCSP_REQUEST_print(BIO *bp, OCSP_REQUEST *a, unsigned long flags); +int OCSP_RESPONSE_print(BIO *bp, OCSP_RESPONSE *o, unsigned long flags); + +int OCSP_basic_verify(OCSP_BASICRESP *bs, STACK_OF(X509) *certs, + X509_STORE *st, unsigned long flags); + + +# ifdef __cplusplus +} +# endif +# endif +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/ocsperr.h b/MediaClient/MediaClient/openssl/include/openssl/ocsperr.h new file mode 100644 index 0000000..8dd9e01 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/ocsperr.h @@ -0,0 +1,78 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_OCSPERR_H +# define HEADER_OCSPERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# include + +# ifndef OPENSSL_NO_OCSP + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_OCSP_strings(void); + +/* + * OCSP function codes. + */ +# define OCSP_F_D2I_OCSP_NONCE 102 +# define OCSP_F_OCSP_BASIC_ADD1_STATUS 103 +# define OCSP_F_OCSP_BASIC_SIGN 104 +# define OCSP_F_OCSP_BASIC_SIGN_CTX 119 +# define OCSP_F_OCSP_BASIC_VERIFY 105 +# define OCSP_F_OCSP_CERT_ID_NEW 101 +# define OCSP_F_OCSP_CHECK_DELEGATED 106 +# define OCSP_F_OCSP_CHECK_IDS 107 +# define OCSP_F_OCSP_CHECK_ISSUER 108 +# define OCSP_F_OCSP_CHECK_VALIDITY 115 +# define OCSP_F_OCSP_MATCH_ISSUERID 109 +# define OCSP_F_OCSP_PARSE_URL 114 +# define OCSP_F_OCSP_REQUEST_SIGN 110 +# define OCSP_F_OCSP_REQUEST_VERIFY 116 +# define OCSP_F_OCSP_RESPONSE_GET1_BASIC 111 +# define OCSP_F_PARSE_HTTP_LINE1 118 + +/* + * OCSP reason codes. + */ +# define OCSP_R_CERTIFICATE_VERIFY_ERROR 101 +# define OCSP_R_DIGEST_ERR 102 +# define OCSP_R_ERROR_IN_NEXTUPDATE_FIELD 122 +# define OCSP_R_ERROR_IN_THISUPDATE_FIELD 123 +# define OCSP_R_ERROR_PARSING_URL 121 +# define OCSP_R_MISSING_OCSPSIGNING_USAGE 103 +# define OCSP_R_NEXTUPDATE_BEFORE_THISUPDATE 124 +# define OCSP_R_NOT_BASIC_RESPONSE 104 +# define OCSP_R_NO_CERTIFICATES_IN_CHAIN 105 +# define OCSP_R_NO_RESPONSE_DATA 108 +# define OCSP_R_NO_REVOKED_TIME 109 +# define OCSP_R_NO_SIGNER_KEY 130 +# define OCSP_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 110 +# define OCSP_R_REQUEST_NOT_SIGNED 128 +# define OCSP_R_RESPONSE_CONTAINS_NO_REVOCATION_DATA 111 +# define OCSP_R_ROOT_CA_NOT_TRUSTED 112 +# define OCSP_R_SERVER_RESPONSE_ERROR 114 +# define OCSP_R_SERVER_RESPONSE_PARSE_ERROR 115 +# define OCSP_R_SIGNATURE_FAILURE 117 +# define OCSP_R_SIGNER_CERTIFICATE_NOT_FOUND 118 +# define OCSP_R_STATUS_EXPIRED 125 +# define OCSP_R_STATUS_NOT_YET_VALID 126 +# define OCSP_R_STATUS_TOO_OLD 127 +# define OCSP_R_UNKNOWN_MESSAGE_DIGEST 119 +# define OCSP_R_UNKNOWN_NID 120 +# define OCSP_R_UNSUPPORTED_REQUESTORNAME_TYPE 129 + +# endif +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/opensslconf.h b/MediaClient/MediaClient/openssl/include/openssl/opensslconf.h new file mode 100644 index 0000000..942b46d --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/opensslconf.h @@ -0,0 +1,195 @@ +/* + * WARNING: do not edit! + * Generated by Makefile from include/openssl/opensslconf.h.in + * + * Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef OPENSSL_ALGORITHM_DEFINES +# error OPENSSL_ALGORITHM_DEFINES no longer supported +#endif + +/* + * OpenSSL was configured with the following options: + */ + +#ifndef OPENSSL_NO_MD2 +# define OPENSSL_NO_MD2 +#endif +#ifndef OPENSSL_NO_RC5 +# define OPENSSL_NO_RC5 +#endif +#ifndef OPENSSL_THREADS +# define OPENSSL_THREADS +#endif +#ifndef OPENSSL_RAND_SEED_OS +# define OPENSSL_RAND_SEED_OS +#endif +#ifndef OPENSSL_NO_AFALGENG +# define OPENSSL_NO_AFALGENG +#endif +#ifndef OPENSSL_NO_ASAN +# define OPENSSL_NO_ASAN +#endif +#ifndef OPENSSL_NO_CRYPTO_MDEBUG +# define OPENSSL_NO_CRYPTO_MDEBUG +#endif +#ifndef OPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE +# define OPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE +#endif +#ifndef OPENSSL_NO_DEVCRYPTOENG +# define OPENSSL_NO_DEVCRYPTOENG +#endif +#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128 +# define OPENSSL_NO_EC_NISTP_64_GCC_128 +#endif +#ifndef OPENSSL_NO_EGD +# define OPENSSL_NO_EGD +#endif +#ifndef OPENSSL_NO_EXTERNAL_TESTS +# define OPENSSL_NO_EXTERNAL_TESTS +#endif +#ifndef OPENSSL_NO_FUZZ_AFL +# define OPENSSL_NO_FUZZ_AFL +#endif +#ifndef OPENSSL_NO_FUZZ_LIBFUZZER +# define OPENSSL_NO_FUZZ_LIBFUZZER +#endif +#ifndef OPENSSL_NO_HEARTBEATS +# define OPENSSL_NO_HEARTBEATS +#endif +#ifndef OPENSSL_NO_MSAN +# define OPENSSL_NO_MSAN +#endif +#ifndef OPENSSL_NO_SCTP +# define OPENSSL_NO_SCTP +#endif +#ifndef OPENSSL_NO_SSL_TRACE +# define OPENSSL_NO_SSL_TRACE +#endif +#ifndef OPENSSL_NO_SSL3 +# define OPENSSL_NO_SSL3 +#endif +#ifndef OPENSSL_NO_SSL3_METHOD +# define OPENSSL_NO_SSL3_METHOD +#endif +#ifndef OPENSSL_NO_UBSAN +# define OPENSSL_NO_UBSAN +#endif +#ifndef OPENSSL_NO_UNIT_TEST +# define OPENSSL_NO_UNIT_TEST +#endif +#ifndef OPENSSL_NO_WEAK_SSL_CIPHERS +# define OPENSSL_NO_WEAK_SSL_CIPHERS +#endif +#ifndef OPENSSL_NO_STATIC_ENGINE +# define OPENSSL_NO_STATIC_ENGINE +#endif + + +/* + * Sometimes OPENSSSL_NO_xxx ends up with an empty file and some compilers + * don't like that. This will hopefully silence them. + */ +#define NON_EMPTY_TRANSLATION_UNIT static void *dummy = &dummy; + +/* + * Applications should use -DOPENSSL_API_COMPAT= to suppress the + * declarations of functions deprecated in or before . Otherwise, they + * still won't see them if the library has been built to disable deprecated + * functions. + */ +#ifndef DECLARE_DEPRECATED +# define DECLARE_DEPRECATED(f) f; +# ifdef __GNUC__ +# if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 0) +# undef DECLARE_DEPRECATED +# define DECLARE_DEPRECATED(f) f __attribute__ ((deprecated)); +# endif +# endif +#endif + +#ifndef OPENSSL_FILE +# ifdef OPENSSL_NO_FILENAMES +# define OPENSSL_FILE "" +# define OPENSSL_LINE 0 +# else +# define OPENSSL_FILE __FILE__ +# define OPENSSL_LINE __LINE__ +# endif +#endif + +#ifndef OPENSSL_MIN_API +# define OPENSSL_MIN_API 0 +#endif + +#if !defined(OPENSSL_API_COMPAT) || OPENSSL_API_COMPAT < OPENSSL_MIN_API +# undef OPENSSL_API_COMPAT +# define OPENSSL_API_COMPAT OPENSSL_MIN_API +#endif + +/* + * Do not deprecate things to be deprecated in version 1.2.0 before the + * OpenSSL version number matches. + */ +#if OPENSSL_VERSION_NUMBER < 0x10200000L +# define DEPRECATEDIN_1_2_0(f) f; +#elif OPENSSL_API_COMPAT < 0x10200000L +# define DEPRECATEDIN_1_2_0(f) DECLARE_DEPRECATED(f) +#else +# define DEPRECATEDIN_1_2_0(f) +#endif + +#if OPENSSL_API_COMPAT < 0x10100000L +# define DEPRECATEDIN_1_1_0(f) DECLARE_DEPRECATED(f) +#else +# define DEPRECATEDIN_1_1_0(f) +#endif + +#if OPENSSL_API_COMPAT < 0x10000000L +# define DEPRECATEDIN_1_0_0(f) DECLARE_DEPRECATED(f) +#else +# define DEPRECATEDIN_1_0_0(f) +#endif + +#if OPENSSL_API_COMPAT < 0x00908000L +# define DEPRECATEDIN_0_9_8(f) DECLARE_DEPRECATED(f) +#else +# define DEPRECATEDIN_0_9_8(f) +#endif + +/* Generate 80386 code? */ +#undef I386_ONLY + +#undef OPENSSL_UNISTD +#define OPENSSL_UNISTD + +#undef OPENSSL_EXPORT_VAR_AS_FUNCTION + +/* + * The following are cipher-specific, but are part of the public API. + */ +#if !defined(OPENSSL_SYS_UEFI) +# undef BN_LLONG +/* Only one for the following should be defined */ +# define SIXTY_FOUR_BIT_LONG +# undef SIXTY_FOUR_BIT +# undef THIRTY_TWO_BIT +#endif + +#define RC4_INT unsigned int + +#ifdef __cplusplus +} +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/opensslv.h b/MediaClient/MediaClient/openssl/include/openssl/opensslv.h new file mode 100644 index 0000000..17d271f --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/opensslv.h @@ -0,0 +1,101 @@ +/* + * Copyright 1999-2020 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_OPENSSLV_H +# define HEADER_OPENSSLV_H + +#ifdef __cplusplus +extern "C" { +#endif + +/*- + * Numeric release version identifier: + * MNNFFPPS: major minor fix patch status + * The status nibble has one of the values 0 for development, 1 to e for betas + * 1 to 14, and f for release. The patch level is exactly that. + * For example: + * 0.9.3-dev 0x00903000 + * 0.9.3-beta1 0x00903001 + * 0.9.3-beta2-dev 0x00903002 + * 0.9.3-beta2 0x00903002 (same as ...beta2-dev) + * 0.9.3 0x0090300f + * 0.9.3a 0x0090301f + * 0.9.4 0x0090400f + * 1.2.3z 0x102031af + * + * For continuity reasons (because 0.9.5 is already out, and is coded + * 0x00905100), between 0.9.5 and 0.9.6 the coding of the patch level + * part is slightly different, by setting the highest bit. This means + * that 0.9.5a looks like this: 0x0090581f. At 0.9.6, we can start + * with 0x0090600S... + * + * (Prior to 0.9.3-dev a different scheme was used: 0.9.2b is 0x0922.) + * (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for + * major minor fix final patch/beta) + */ +# define OPENSSL_VERSION_NUMBER 0x1010107fL +# define OPENSSL_VERSION_TEXT "OpenSSL 1.1.1g 21 Apr 2020" + +/*- + * The macros below are to be used for shared library (.so, .dll, ...) + * versioning. That kind of versioning works a bit differently between + * operating systems. The most usual scheme is to set a major and a minor + * number, and have the runtime loader check that the major number is equal + * to what it was at application link time, while the minor number has to + * be greater or equal to what it was at application link time. With this + * scheme, the version number is usually part of the file name, like this: + * + * libcrypto.so.0.9 + * + * Some unixen also make a softlink with the major version number only: + * + * libcrypto.so.0 + * + * On Tru64 and IRIX 6.x it works a little bit differently. There, the + * shared library version is stored in the file, and is actually a series + * of versions, separated by colons. The rightmost version present in the + * library when linking an application is stored in the application to be + * matched at run time. When the application is run, a check is done to + * see if the library version stored in the application matches any of the + * versions in the version string of the library itself. + * This version string can be constructed in any way, depending on what + * kind of matching is desired. However, to implement the same scheme as + * the one used in the other unixen, all compatible versions, from lowest + * to highest, should be part of the string. Consecutive builds would + * give the following versions strings: + * + * 3.0 + * 3.0:3.1 + * 3.0:3.1:3.2 + * 4.0 + * 4.0:4.1 + * + * Notice how version 4 is completely incompatible with version, and + * therefore give the breach you can see. + * + * There may be other schemes as well that I haven't yet discovered. + * + * So, here's the way it works here: first of all, the library version + * number doesn't need at all to match the overall OpenSSL version. + * However, it's nice and more understandable if it actually does. + * The current library version is stored in the macro SHLIB_VERSION_NUMBER, + * which is just a piece of text in the format "M.m.e" (Major, minor, edit). + * For the sake of Tru64, IRIX, and any other OS that behaves in similar ways, + * we need to keep a history of version numbers, which is done in the + * macro SHLIB_VERSION_HISTORY. The numbers are separated by colons and + * should only keep the versions that are binary compatible with the current. + */ +# define SHLIB_VERSION_HISTORY "" +# define SHLIB_VERSION_NUMBER "1.1" + + +#ifdef __cplusplus +} +#endif +#endif /* HEADER_OPENSSLV_H */ diff --git a/MediaClient/MediaClient/openssl/include/openssl/ossl_typ.h b/MediaClient/MediaClient/openssl/include/openssl/ossl_typ.h new file mode 100644 index 0000000..e0edfaa --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/ossl_typ.h @@ -0,0 +1,197 @@ +/* + * Copyright 2001-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_OPENSSL_TYPES_H +# define HEADER_OPENSSL_TYPES_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +# include + +# ifdef NO_ASN1_TYPEDEFS +# define ASN1_INTEGER ASN1_STRING +# define ASN1_ENUMERATED ASN1_STRING +# define ASN1_BIT_STRING ASN1_STRING +# define ASN1_OCTET_STRING ASN1_STRING +# define ASN1_PRINTABLESTRING ASN1_STRING +# define ASN1_T61STRING ASN1_STRING +# define ASN1_IA5STRING ASN1_STRING +# define ASN1_UTCTIME ASN1_STRING +# define ASN1_GENERALIZEDTIME ASN1_STRING +# define ASN1_TIME ASN1_STRING +# define ASN1_GENERALSTRING ASN1_STRING +# define ASN1_UNIVERSALSTRING ASN1_STRING +# define ASN1_BMPSTRING ASN1_STRING +# define ASN1_VISIBLESTRING ASN1_STRING +# define ASN1_UTF8STRING ASN1_STRING +# define ASN1_BOOLEAN int +# define ASN1_NULL int +# else +typedef struct asn1_string_st ASN1_INTEGER; +typedef struct asn1_string_st ASN1_ENUMERATED; +typedef struct asn1_string_st ASN1_BIT_STRING; +typedef struct asn1_string_st ASN1_OCTET_STRING; +typedef struct asn1_string_st ASN1_PRINTABLESTRING; +typedef struct asn1_string_st ASN1_T61STRING; +typedef struct asn1_string_st ASN1_IA5STRING; +typedef struct asn1_string_st ASN1_GENERALSTRING; +typedef struct asn1_string_st ASN1_UNIVERSALSTRING; +typedef struct asn1_string_st ASN1_BMPSTRING; +typedef struct asn1_string_st ASN1_UTCTIME; +typedef struct asn1_string_st ASN1_TIME; +typedef struct asn1_string_st ASN1_GENERALIZEDTIME; +typedef struct asn1_string_st ASN1_VISIBLESTRING; +typedef struct asn1_string_st ASN1_UTF8STRING; +typedef struct asn1_string_st ASN1_STRING; +typedef int ASN1_BOOLEAN; +typedef int ASN1_NULL; +# endif + +typedef struct asn1_object_st ASN1_OBJECT; + +typedef struct ASN1_ITEM_st ASN1_ITEM; +typedef struct asn1_pctx_st ASN1_PCTX; +typedef struct asn1_sctx_st ASN1_SCTX; + +# ifdef _WIN32 +# undef X509_NAME +# undef X509_EXTENSIONS +# undef PKCS7_ISSUER_AND_SERIAL +# undef PKCS7_SIGNER_INFO +# undef OCSP_REQUEST +# undef OCSP_RESPONSE +# endif + +# ifdef BIGNUM +# undef BIGNUM +# endif +struct dane_st; +typedef struct bio_st BIO; +typedef struct bignum_st BIGNUM; +typedef struct bignum_ctx BN_CTX; +typedef struct bn_blinding_st BN_BLINDING; +typedef struct bn_mont_ctx_st BN_MONT_CTX; +typedef struct bn_recp_ctx_st BN_RECP_CTX; +typedef struct bn_gencb_st BN_GENCB; + +typedef struct buf_mem_st BUF_MEM; + +typedef struct evp_cipher_st EVP_CIPHER; +typedef struct evp_cipher_ctx_st EVP_CIPHER_CTX; +typedef struct evp_md_st EVP_MD; +typedef struct evp_md_ctx_st EVP_MD_CTX; +typedef struct evp_pkey_st EVP_PKEY; + +typedef struct evp_pkey_asn1_method_st EVP_PKEY_ASN1_METHOD; + +typedef struct evp_pkey_method_st EVP_PKEY_METHOD; +typedef struct evp_pkey_ctx_st EVP_PKEY_CTX; + +typedef struct evp_Encode_Ctx_st EVP_ENCODE_CTX; + +typedef struct hmac_ctx_st HMAC_CTX; + +typedef struct dh_st DH; +typedef struct dh_method DH_METHOD; + +typedef struct dsa_st DSA; +typedef struct dsa_method DSA_METHOD; + +typedef struct rsa_st RSA; +typedef struct rsa_meth_st RSA_METHOD; +typedef struct rsa_pss_params_st RSA_PSS_PARAMS; + +typedef struct ec_key_st EC_KEY; +typedef struct ec_key_method_st EC_KEY_METHOD; + +typedef struct rand_meth_st RAND_METHOD; +typedef struct rand_drbg_st RAND_DRBG; + +typedef struct ssl_dane_st SSL_DANE; +typedef struct x509_st X509; +typedef struct X509_algor_st X509_ALGOR; +typedef struct X509_crl_st X509_CRL; +typedef struct x509_crl_method_st X509_CRL_METHOD; +typedef struct x509_revoked_st X509_REVOKED; +typedef struct X509_name_st X509_NAME; +typedef struct X509_pubkey_st X509_PUBKEY; +typedef struct x509_store_st X509_STORE; +typedef struct x509_store_ctx_st X509_STORE_CTX; + +typedef struct x509_object_st X509_OBJECT; +typedef struct x509_lookup_st X509_LOOKUP; +typedef struct x509_lookup_method_st X509_LOOKUP_METHOD; +typedef struct X509_VERIFY_PARAM_st X509_VERIFY_PARAM; + +typedef struct x509_sig_info_st X509_SIG_INFO; + +typedef struct pkcs8_priv_key_info_st PKCS8_PRIV_KEY_INFO; + +typedef struct v3_ext_ctx X509V3_CTX; +typedef struct conf_st CONF; +typedef struct ossl_init_settings_st OPENSSL_INIT_SETTINGS; + +typedef struct ui_st UI; +typedef struct ui_method_st UI_METHOD; + +typedef struct engine_st ENGINE; +typedef struct ssl_st SSL; +typedef struct ssl_ctx_st SSL_CTX; + +typedef struct comp_ctx_st COMP_CTX; +typedef struct comp_method_st COMP_METHOD; + +typedef struct X509_POLICY_NODE_st X509_POLICY_NODE; +typedef struct X509_POLICY_LEVEL_st X509_POLICY_LEVEL; +typedef struct X509_POLICY_TREE_st X509_POLICY_TREE; +typedef struct X509_POLICY_CACHE_st X509_POLICY_CACHE; + +typedef struct AUTHORITY_KEYID_st AUTHORITY_KEYID; +typedef struct DIST_POINT_st DIST_POINT; +typedef struct ISSUING_DIST_POINT_st ISSUING_DIST_POINT; +typedef struct NAME_CONSTRAINTS_st NAME_CONSTRAINTS; + +typedef struct crypto_ex_data_st CRYPTO_EX_DATA; + +typedef struct ocsp_req_ctx_st OCSP_REQ_CTX; +typedef struct ocsp_response_st OCSP_RESPONSE; +typedef struct ocsp_responder_id_st OCSP_RESPID; + +typedef struct sct_st SCT; +typedef struct sct_ctx_st SCT_CTX; +typedef struct ctlog_st CTLOG; +typedef struct ctlog_store_st CTLOG_STORE; +typedef struct ct_policy_eval_ctx_st CT_POLICY_EVAL_CTX; + +typedef struct ossl_store_info_st OSSL_STORE_INFO; +typedef struct ossl_store_search_st OSSL_STORE_SEARCH; + +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L && \ + defined(INTMAX_MAX) && defined(UINTMAX_MAX) +typedef intmax_t ossl_intmax_t; +typedef uintmax_t ossl_uintmax_t; +#else +/* + * Not long long, because the C-library can only be expected to provide + * strtoll(), strtoull() at the same time as intmax_t and strtoimax(), + * strtoumax(). Since we use these for parsing arguments, we need the + * conversion functions, not just the sizes. + */ +typedef long ossl_intmax_t; +typedef unsigned long ossl_uintmax_t; +#endif + +#ifdef __cplusplus +} +#endif +#endif /* def HEADER_OPENSSL_TYPES_H */ diff --git a/MediaClient/MediaClient/openssl/include/openssl/pem.h b/MediaClient/MediaClient/openssl/include/openssl/pem.h new file mode 100644 index 0000000..2ef5b5d --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/pem.h @@ -0,0 +1,378 @@ +/* + * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_PEM_H +# define HEADER_PEM_H + +# include +# include +# include +# include +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + +# define PEM_BUFSIZE 1024 + +# define PEM_STRING_X509_OLD "X509 CERTIFICATE" +# define PEM_STRING_X509 "CERTIFICATE" +# define PEM_STRING_X509_TRUSTED "TRUSTED CERTIFICATE" +# define PEM_STRING_X509_REQ_OLD "NEW CERTIFICATE REQUEST" +# define PEM_STRING_X509_REQ "CERTIFICATE REQUEST" +# define PEM_STRING_X509_CRL "X509 CRL" +# define PEM_STRING_EVP_PKEY "ANY PRIVATE KEY" +# define PEM_STRING_PUBLIC "PUBLIC KEY" +# define PEM_STRING_RSA "RSA PRIVATE KEY" +# define PEM_STRING_RSA_PUBLIC "RSA PUBLIC KEY" +# define PEM_STRING_DSA "DSA PRIVATE KEY" +# define PEM_STRING_DSA_PUBLIC "DSA PUBLIC KEY" +# define PEM_STRING_PKCS7 "PKCS7" +# define PEM_STRING_PKCS7_SIGNED "PKCS #7 SIGNED DATA" +# define PEM_STRING_PKCS8 "ENCRYPTED PRIVATE KEY" +# define PEM_STRING_PKCS8INF "PRIVATE KEY" +# define PEM_STRING_DHPARAMS "DH PARAMETERS" +# define PEM_STRING_DHXPARAMS "X9.42 DH PARAMETERS" +# define PEM_STRING_SSL_SESSION "SSL SESSION PARAMETERS" +# define PEM_STRING_DSAPARAMS "DSA PARAMETERS" +# define PEM_STRING_ECDSA_PUBLIC "ECDSA PUBLIC KEY" +# define PEM_STRING_ECPARAMETERS "EC PARAMETERS" +# define PEM_STRING_ECPRIVATEKEY "EC PRIVATE KEY" +# define PEM_STRING_PARAMETERS "PARAMETERS" +# define PEM_STRING_CMS "CMS" + +# define PEM_TYPE_ENCRYPTED 10 +# define PEM_TYPE_MIC_ONLY 20 +# define PEM_TYPE_MIC_CLEAR 30 +# define PEM_TYPE_CLEAR 40 + +/* + * These macros make the PEM_read/PEM_write functions easier to maintain and + * write. Now they are all implemented with either: IMPLEMENT_PEM_rw(...) or + * IMPLEMENT_PEM_rw_cb(...) + */ + +# ifdef OPENSSL_NO_STDIO + +# define IMPLEMENT_PEM_read_fp(name, type, str, asn1) /**/ +# define IMPLEMENT_PEM_write_fp(name, type, str, asn1) /**/ +# define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) /**/ +# define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) /**/ +# define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) /**/ +# else + +# define IMPLEMENT_PEM_read_fp(name, type, str, asn1) \ +type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u)\ +{ \ +return PEM_ASN1_read((d2i_of_void *)d2i_##asn1, str,fp,(void **)x,cb,u); \ +} + +# define IMPLEMENT_PEM_write_fp(name, type, str, asn1) \ +int PEM_write_##name(FILE *fp, type *x) \ +{ \ +return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,x,NULL,NULL,0,NULL,NULL); \ +} + +# define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) \ +int PEM_write_##name(FILE *fp, const type *x) \ +{ \ +return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,(void *)x,NULL,NULL,0,NULL,NULL); \ +} + +# define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) \ +int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \ + unsigned char *kstr, int klen, pem_password_cb *cb, \ + void *u) \ + { \ + return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,x,enc,kstr,klen,cb,u); \ + } + +# define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) \ +int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \ + unsigned char *kstr, int klen, pem_password_cb *cb, \ + void *u) \ + { \ + return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,x,enc,kstr,klen,cb,u); \ + } + +# endif + +# define IMPLEMENT_PEM_read_bio(name, type, str, asn1) \ +type *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u)\ +{ \ +return PEM_ASN1_read_bio((d2i_of_void *)d2i_##asn1, str,bp,(void **)x,cb,u); \ +} + +# define IMPLEMENT_PEM_write_bio(name, type, str, asn1) \ +int PEM_write_bio_##name(BIO *bp, type *x) \ +{ \ +return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,x,NULL,NULL,0,NULL,NULL); \ +} + +# define IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \ +int PEM_write_bio_##name(BIO *bp, const type *x) \ +{ \ +return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,(void *)x,NULL,NULL,0,NULL,NULL); \ +} + +# define IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \ +int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ + unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \ + { \ + return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,x,enc,kstr,klen,cb,u); \ + } + +# define IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \ +int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ + unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \ + { \ + return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,(void *)x,enc,kstr,klen,cb,u); \ + } + +# define IMPLEMENT_PEM_write(name, type, str, asn1) \ + IMPLEMENT_PEM_write_bio(name, type, str, asn1) \ + IMPLEMENT_PEM_write_fp(name, type, str, asn1) + +# define IMPLEMENT_PEM_write_const(name, type, str, asn1) \ + IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \ + IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) + +# define IMPLEMENT_PEM_write_cb(name, type, str, asn1) \ + IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \ + IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) + +# define IMPLEMENT_PEM_write_cb_const(name, type, str, asn1) \ + IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \ + IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) + +# define IMPLEMENT_PEM_read(name, type, str, asn1) \ + IMPLEMENT_PEM_read_bio(name, type, str, asn1) \ + IMPLEMENT_PEM_read_fp(name, type, str, asn1) + +# define IMPLEMENT_PEM_rw(name, type, str, asn1) \ + IMPLEMENT_PEM_read(name, type, str, asn1) \ + IMPLEMENT_PEM_write(name, type, str, asn1) + +# define IMPLEMENT_PEM_rw_const(name, type, str, asn1) \ + IMPLEMENT_PEM_read(name, type, str, asn1) \ + IMPLEMENT_PEM_write_const(name, type, str, asn1) + +# define IMPLEMENT_PEM_rw_cb(name, type, str, asn1) \ + IMPLEMENT_PEM_read(name, type, str, asn1) \ + IMPLEMENT_PEM_write_cb(name, type, str, asn1) + +/* These are the same except they are for the declarations */ + +# if defined(OPENSSL_NO_STDIO) + +# define DECLARE_PEM_read_fp(name, type) /**/ +# define DECLARE_PEM_write_fp(name, type) /**/ +# define DECLARE_PEM_write_fp_const(name, type) /**/ +# define DECLARE_PEM_write_cb_fp(name, type) /**/ +# else + +# define DECLARE_PEM_read_fp(name, type) \ + type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u); + +# define DECLARE_PEM_write_fp(name, type) \ + int PEM_write_##name(FILE *fp, type *x); + +# define DECLARE_PEM_write_fp_const(name, type) \ + int PEM_write_##name(FILE *fp, const type *x); + +# define DECLARE_PEM_write_cb_fp(name, type) \ + int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \ + unsigned char *kstr, int klen, pem_password_cb *cb, void *u); + +# endif + +# define DECLARE_PEM_read_bio(name, type) \ + type *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u); + +# define DECLARE_PEM_write_bio(name, type) \ + int PEM_write_bio_##name(BIO *bp, type *x); + +# define DECLARE_PEM_write_bio_const(name, type) \ + int PEM_write_bio_##name(BIO *bp, const type *x); + +# define DECLARE_PEM_write_cb_bio(name, type) \ + int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ + unsigned char *kstr, int klen, pem_password_cb *cb, void *u); + +# define DECLARE_PEM_write(name, type) \ + DECLARE_PEM_write_bio(name, type) \ + DECLARE_PEM_write_fp(name, type) +# define DECLARE_PEM_write_const(name, type) \ + DECLARE_PEM_write_bio_const(name, type) \ + DECLARE_PEM_write_fp_const(name, type) +# define DECLARE_PEM_write_cb(name, type) \ + DECLARE_PEM_write_cb_bio(name, type) \ + DECLARE_PEM_write_cb_fp(name, type) +# define DECLARE_PEM_read(name, type) \ + DECLARE_PEM_read_bio(name, type) \ + DECLARE_PEM_read_fp(name, type) +# define DECLARE_PEM_rw(name, type) \ + DECLARE_PEM_read(name, type) \ + DECLARE_PEM_write(name, type) +# define DECLARE_PEM_rw_const(name, type) \ + DECLARE_PEM_read(name, type) \ + DECLARE_PEM_write_const(name, type) +# define DECLARE_PEM_rw_cb(name, type) \ + DECLARE_PEM_read(name, type) \ + DECLARE_PEM_write_cb(name, type) +typedef int pem_password_cb (char *buf, int size, int rwflag, void *userdata); + +int PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher); +int PEM_do_header(EVP_CIPHER_INFO *cipher, unsigned char *data, long *len, + pem_password_cb *callback, void *u); + +int PEM_read_bio(BIO *bp, char **name, char **header, + unsigned char **data, long *len); +# define PEM_FLAG_SECURE 0x1 +# define PEM_FLAG_EAY_COMPATIBLE 0x2 +# define PEM_FLAG_ONLY_B64 0x4 +int PEM_read_bio_ex(BIO *bp, char **name, char **header, + unsigned char **data, long *len, unsigned int flags); +int PEM_bytes_read_bio_secmem(unsigned char **pdata, long *plen, char **pnm, + const char *name, BIO *bp, pem_password_cb *cb, + void *u); +int PEM_write_bio(BIO *bp, const char *name, const char *hdr, + const unsigned char *data, long len); +int PEM_bytes_read_bio(unsigned char **pdata, long *plen, char **pnm, + const char *name, BIO *bp, pem_password_cb *cb, + void *u); +void *PEM_ASN1_read_bio(d2i_of_void *d2i, const char *name, BIO *bp, void **x, + pem_password_cb *cb, void *u); +int PEM_ASN1_write_bio(i2d_of_void *i2d, const char *name, BIO *bp, void *x, + const EVP_CIPHER *enc, unsigned char *kstr, int klen, + pem_password_cb *cb, void *u); + +STACK_OF(X509_INFO) *PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk, + pem_password_cb *cb, void *u); +int PEM_X509_INFO_write_bio(BIO *bp, X509_INFO *xi, EVP_CIPHER *enc, + unsigned char *kstr, int klen, + pem_password_cb *cd, void *u); + +#ifndef OPENSSL_NO_STDIO +int PEM_read(FILE *fp, char **name, char **header, + unsigned char **data, long *len); +int PEM_write(FILE *fp, const char *name, const char *hdr, + const unsigned char *data, long len); +void *PEM_ASN1_read(d2i_of_void *d2i, const char *name, FILE *fp, void **x, + pem_password_cb *cb, void *u); +int PEM_ASN1_write(i2d_of_void *i2d, const char *name, FILE *fp, + void *x, const EVP_CIPHER *enc, unsigned char *kstr, + int klen, pem_password_cb *callback, void *u); +STACK_OF(X509_INFO) *PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk, + pem_password_cb *cb, void *u); +#endif + +int PEM_SignInit(EVP_MD_CTX *ctx, EVP_MD *type); +int PEM_SignUpdate(EVP_MD_CTX *ctx, unsigned char *d, unsigned int cnt); +int PEM_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, + unsigned int *siglen, EVP_PKEY *pkey); + +/* The default pem_password_cb that's used internally */ +int PEM_def_callback(char *buf, int num, int rwflag, void *userdata); +void PEM_proc_type(char *buf, int type); +void PEM_dek_info(char *buf, const char *type, int len, char *str); + +# include + +DECLARE_PEM_rw(X509, X509) +DECLARE_PEM_rw(X509_AUX, X509) +DECLARE_PEM_rw(X509_REQ, X509_REQ) +DECLARE_PEM_write(X509_REQ_NEW, X509_REQ) +DECLARE_PEM_rw(X509_CRL, X509_CRL) +DECLARE_PEM_rw(PKCS7, PKCS7) +DECLARE_PEM_rw(NETSCAPE_CERT_SEQUENCE, NETSCAPE_CERT_SEQUENCE) +DECLARE_PEM_rw(PKCS8, X509_SIG) +DECLARE_PEM_rw(PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO) +# ifndef OPENSSL_NO_RSA +DECLARE_PEM_rw_cb(RSAPrivateKey, RSA) +DECLARE_PEM_rw_const(RSAPublicKey, RSA) +DECLARE_PEM_rw(RSA_PUBKEY, RSA) +# endif +# ifndef OPENSSL_NO_DSA +DECLARE_PEM_rw_cb(DSAPrivateKey, DSA) +DECLARE_PEM_rw(DSA_PUBKEY, DSA) +DECLARE_PEM_rw_const(DSAparams, DSA) +# endif +# ifndef OPENSSL_NO_EC +DECLARE_PEM_rw_const(ECPKParameters, EC_GROUP) +DECLARE_PEM_rw_cb(ECPrivateKey, EC_KEY) +DECLARE_PEM_rw(EC_PUBKEY, EC_KEY) +# endif +# ifndef OPENSSL_NO_DH +DECLARE_PEM_rw_const(DHparams, DH) +DECLARE_PEM_write_const(DHxparams, DH) +# endif +DECLARE_PEM_rw_cb(PrivateKey, EVP_PKEY) +DECLARE_PEM_rw(PUBKEY, EVP_PKEY) + +int PEM_write_bio_PrivateKey_traditional(BIO *bp, EVP_PKEY *x, + const EVP_CIPHER *enc, + unsigned char *kstr, int klen, + pem_password_cb *cb, void *u); + +int PEM_write_bio_PKCS8PrivateKey_nid(BIO *bp, EVP_PKEY *x, int nid, + char *kstr, int klen, + pem_password_cb *cb, void *u); +int PEM_write_bio_PKCS8PrivateKey(BIO *, EVP_PKEY *, const EVP_CIPHER *, + char *, int, pem_password_cb *, void *); +int i2d_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc, + char *kstr, int klen, + pem_password_cb *cb, void *u); +int i2d_PKCS8PrivateKey_nid_bio(BIO *bp, EVP_PKEY *x, int nid, + char *kstr, int klen, + pem_password_cb *cb, void *u); +EVP_PKEY *d2i_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, + void *u); + +# ifndef OPENSSL_NO_STDIO +int i2d_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc, + char *kstr, int klen, + pem_password_cb *cb, void *u); +int i2d_PKCS8PrivateKey_nid_fp(FILE *fp, EVP_PKEY *x, int nid, + char *kstr, int klen, + pem_password_cb *cb, void *u); +int PEM_write_PKCS8PrivateKey_nid(FILE *fp, EVP_PKEY *x, int nid, + char *kstr, int klen, + pem_password_cb *cb, void *u); + +EVP_PKEY *d2i_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY **x, pem_password_cb *cb, + void *u); + +int PEM_write_PKCS8PrivateKey(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc, + char *kstr, int klen, pem_password_cb *cd, + void *u); +# endif +EVP_PKEY *PEM_read_bio_Parameters(BIO *bp, EVP_PKEY **x); +int PEM_write_bio_Parameters(BIO *bp, EVP_PKEY *x); + +# ifndef OPENSSL_NO_DSA +EVP_PKEY *b2i_PrivateKey(const unsigned char **in, long length); +EVP_PKEY *b2i_PublicKey(const unsigned char **in, long length); +EVP_PKEY *b2i_PrivateKey_bio(BIO *in); +EVP_PKEY *b2i_PublicKey_bio(BIO *in); +int i2b_PrivateKey_bio(BIO *out, EVP_PKEY *pk); +int i2b_PublicKey_bio(BIO *out, EVP_PKEY *pk); +# ifndef OPENSSL_NO_RC4 +EVP_PKEY *b2i_PVK_bio(BIO *in, pem_password_cb *cb, void *u); +int i2b_PVK_bio(BIO *out, EVP_PKEY *pk, int enclevel, + pem_password_cb *cb, void *u); +# endif +# endif + +# ifdef __cplusplus +} +# endif +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/pem2.h b/MediaClient/MediaClient/openssl/include/openssl/pem2.h new file mode 100644 index 0000000..038fe79 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/pem2.h @@ -0,0 +1,13 @@ +/* + * Copyright 1999-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_PEM2_H +# define HEADER_PEM2_H +# include +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/pemerr.h b/MediaClient/MediaClient/openssl/include/openssl/pemerr.h new file mode 100644 index 0000000..0c45918 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/pemerr.h @@ -0,0 +1,103 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_PEMERR_H +# define HEADER_PEMERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_PEM_strings(void); + +/* + * PEM function codes. + */ +# define PEM_F_B2I_DSS 127 +# define PEM_F_B2I_PVK_BIO 128 +# define PEM_F_B2I_RSA 129 +# define PEM_F_CHECK_BITLEN_DSA 130 +# define PEM_F_CHECK_BITLEN_RSA 131 +# define PEM_F_D2I_PKCS8PRIVATEKEY_BIO 120 +# define PEM_F_D2I_PKCS8PRIVATEKEY_FP 121 +# define PEM_F_DO_B2I 132 +# define PEM_F_DO_B2I_BIO 133 +# define PEM_F_DO_BLOB_HEADER 134 +# define PEM_F_DO_I2B 146 +# define PEM_F_DO_PK8PKEY 126 +# define PEM_F_DO_PK8PKEY_FP 125 +# define PEM_F_DO_PVK_BODY 135 +# define PEM_F_DO_PVK_HEADER 136 +# define PEM_F_GET_HEADER_AND_DATA 143 +# define PEM_F_GET_NAME 144 +# define PEM_F_I2B_PVK 137 +# define PEM_F_I2B_PVK_BIO 138 +# define PEM_F_LOAD_IV 101 +# define PEM_F_PEM_ASN1_READ 102 +# define PEM_F_PEM_ASN1_READ_BIO 103 +# define PEM_F_PEM_ASN1_WRITE 104 +# define PEM_F_PEM_ASN1_WRITE_BIO 105 +# define PEM_F_PEM_DEF_CALLBACK 100 +# define PEM_F_PEM_DO_HEADER 106 +# define PEM_F_PEM_GET_EVP_CIPHER_INFO 107 +# define PEM_F_PEM_READ 108 +# define PEM_F_PEM_READ_BIO 109 +# define PEM_F_PEM_READ_BIO_DHPARAMS 141 +# define PEM_F_PEM_READ_BIO_EX 145 +# define PEM_F_PEM_READ_BIO_PARAMETERS 140 +# define PEM_F_PEM_READ_BIO_PRIVATEKEY 123 +# define PEM_F_PEM_READ_DHPARAMS 142 +# define PEM_F_PEM_READ_PRIVATEKEY 124 +# define PEM_F_PEM_SIGNFINAL 112 +# define PEM_F_PEM_WRITE 113 +# define PEM_F_PEM_WRITE_BIO 114 +# define PEM_F_PEM_WRITE_PRIVATEKEY 139 +# define PEM_F_PEM_X509_INFO_READ 115 +# define PEM_F_PEM_X509_INFO_READ_BIO 116 +# define PEM_F_PEM_X509_INFO_WRITE_BIO 117 + +/* + * PEM reason codes. + */ +# define PEM_R_BAD_BASE64_DECODE 100 +# define PEM_R_BAD_DECRYPT 101 +# define PEM_R_BAD_END_LINE 102 +# define PEM_R_BAD_IV_CHARS 103 +# define PEM_R_BAD_MAGIC_NUMBER 116 +# define PEM_R_BAD_PASSWORD_READ 104 +# define PEM_R_BAD_VERSION_NUMBER 117 +# define PEM_R_BIO_WRITE_FAILURE 118 +# define PEM_R_CIPHER_IS_NULL 127 +# define PEM_R_ERROR_CONVERTING_PRIVATE_KEY 115 +# define PEM_R_EXPECTING_PRIVATE_KEY_BLOB 119 +# define PEM_R_EXPECTING_PUBLIC_KEY_BLOB 120 +# define PEM_R_HEADER_TOO_LONG 128 +# define PEM_R_INCONSISTENT_HEADER 121 +# define PEM_R_KEYBLOB_HEADER_PARSE_ERROR 122 +# define PEM_R_KEYBLOB_TOO_SHORT 123 +# define PEM_R_MISSING_DEK_IV 129 +# define PEM_R_NOT_DEK_INFO 105 +# define PEM_R_NOT_ENCRYPTED 106 +# define PEM_R_NOT_PROC_TYPE 107 +# define PEM_R_NO_START_LINE 108 +# define PEM_R_PROBLEMS_GETTING_PASSWORD 109 +# define PEM_R_PVK_DATA_TOO_SHORT 124 +# define PEM_R_PVK_TOO_SHORT 125 +# define PEM_R_READ_KEY 111 +# define PEM_R_SHORT_HEADER 112 +# define PEM_R_UNEXPECTED_DEK_IV 130 +# define PEM_R_UNSUPPORTED_CIPHER 113 +# define PEM_R_UNSUPPORTED_ENCRYPTION 114 +# define PEM_R_UNSUPPORTED_KEY_COMPONENTS 126 + +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/pkcs12.h b/MediaClient/MediaClient/openssl/include/openssl/pkcs12.h new file mode 100644 index 0000000..3f43dad --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/pkcs12.h @@ -0,0 +1,223 @@ +/* + * Copyright 1999-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_PKCS12_H +# define HEADER_PKCS12_H + +# include +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + +# define PKCS12_KEY_ID 1 +# define PKCS12_IV_ID 2 +# define PKCS12_MAC_ID 3 + +/* Default iteration count */ +# ifndef PKCS12_DEFAULT_ITER +# define PKCS12_DEFAULT_ITER PKCS5_DEFAULT_ITER +# endif + +# define PKCS12_MAC_KEY_LENGTH 20 + +# define PKCS12_SALT_LEN 8 + +/* It's not clear if these are actually needed... */ +# define PKCS12_key_gen PKCS12_key_gen_utf8 +# define PKCS12_add_friendlyname PKCS12_add_friendlyname_utf8 + +/* MS key usage constants */ + +# define KEY_EX 0x10 +# define KEY_SIG 0x80 + +typedef struct PKCS12_MAC_DATA_st PKCS12_MAC_DATA; + +typedef struct PKCS12_st PKCS12; + +typedef struct PKCS12_SAFEBAG_st PKCS12_SAFEBAG; + +DEFINE_STACK_OF(PKCS12_SAFEBAG) + +typedef struct pkcs12_bag_st PKCS12_BAGS; + +# define PKCS12_ERROR 0 +# define PKCS12_OK 1 + +/* Compatibility macros */ + +#if OPENSSL_API_COMPAT < 0x10100000L + +# define M_PKCS12_bag_type PKCS12_bag_type +# define M_PKCS12_cert_bag_type PKCS12_cert_bag_type +# define M_PKCS12_crl_bag_type PKCS12_cert_bag_type + +# define PKCS12_certbag2x509 PKCS12_SAFEBAG_get1_cert +# define PKCS12_certbag2scrl PKCS12_SAFEBAG_get1_crl +# define PKCS12_bag_type PKCS12_SAFEBAG_get_nid +# define PKCS12_cert_bag_type PKCS12_SAFEBAG_get_bag_nid +# define PKCS12_x5092certbag PKCS12_SAFEBAG_create_cert +# define PKCS12_x509crl2certbag PKCS12_SAFEBAG_create_crl +# define PKCS12_MAKE_KEYBAG PKCS12_SAFEBAG_create0_p8inf +# define PKCS12_MAKE_SHKEYBAG PKCS12_SAFEBAG_create_pkcs8_encrypt + +#endif + +DEPRECATEDIN_1_1_0(ASN1_TYPE *PKCS12_get_attr(const PKCS12_SAFEBAG *bag, int attr_nid)) + +ASN1_TYPE *PKCS8_get_attr(PKCS8_PRIV_KEY_INFO *p8, int attr_nid); +int PKCS12_mac_present(const PKCS12 *p12); +void PKCS12_get0_mac(const ASN1_OCTET_STRING **pmac, + const X509_ALGOR **pmacalg, + const ASN1_OCTET_STRING **psalt, + const ASN1_INTEGER **piter, + const PKCS12 *p12); + +const ASN1_TYPE *PKCS12_SAFEBAG_get0_attr(const PKCS12_SAFEBAG *bag, + int attr_nid); +const ASN1_OBJECT *PKCS12_SAFEBAG_get0_type(const PKCS12_SAFEBAG *bag); +int PKCS12_SAFEBAG_get_nid(const PKCS12_SAFEBAG *bag); +int PKCS12_SAFEBAG_get_bag_nid(const PKCS12_SAFEBAG *bag); + +X509 *PKCS12_SAFEBAG_get1_cert(const PKCS12_SAFEBAG *bag); +X509_CRL *PKCS12_SAFEBAG_get1_crl(const PKCS12_SAFEBAG *bag); +const STACK_OF(PKCS12_SAFEBAG) * +PKCS12_SAFEBAG_get0_safes(const PKCS12_SAFEBAG *bag); +const PKCS8_PRIV_KEY_INFO *PKCS12_SAFEBAG_get0_p8inf(const PKCS12_SAFEBAG *bag); +const X509_SIG *PKCS12_SAFEBAG_get0_pkcs8(const PKCS12_SAFEBAG *bag); + +PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_cert(X509 *x509); +PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_crl(X509_CRL *crl); +PKCS12_SAFEBAG *PKCS12_SAFEBAG_create0_p8inf(PKCS8_PRIV_KEY_INFO *p8); +PKCS12_SAFEBAG *PKCS12_SAFEBAG_create0_pkcs8(X509_SIG *p8); +PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_pkcs8_encrypt(int pbe_nid, + const char *pass, + int passlen, + unsigned char *salt, + int saltlen, int iter, + PKCS8_PRIV_KEY_INFO *p8inf); + +PKCS12_SAFEBAG *PKCS12_item_pack_safebag(void *obj, const ASN1_ITEM *it, + int nid1, int nid2); +PKCS8_PRIV_KEY_INFO *PKCS8_decrypt(const X509_SIG *p8, const char *pass, + int passlen); +PKCS8_PRIV_KEY_INFO *PKCS12_decrypt_skey(const PKCS12_SAFEBAG *bag, + const char *pass, int passlen); +X509_SIG *PKCS8_encrypt(int pbe_nid, const EVP_CIPHER *cipher, + const char *pass, int passlen, unsigned char *salt, + int saltlen, int iter, PKCS8_PRIV_KEY_INFO *p8); +X509_SIG *PKCS8_set0_pbe(const char *pass, int passlen, + PKCS8_PRIV_KEY_INFO *p8inf, X509_ALGOR *pbe); +PKCS7 *PKCS12_pack_p7data(STACK_OF(PKCS12_SAFEBAG) *sk); +STACK_OF(PKCS12_SAFEBAG) *PKCS12_unpack_p7data(PKCS7 *p7); +PKCS7 *PKCS12_pack_p7encdata(int pbe_nid, const char *pass, int passlen, + unsigned char *salt, int saltlen, int iter, + STACK_OF(PKCS12_SAFEBAG) *bags); +STACK_OF(PKCS12_SAFEBAG) *PKCS12_unpack_p7encdata(PKCS7 *p7, const char *pass, + int passlen); + +int PKCS12_pack_authsafes(PKCS12 *p12, STACK_OF(PKCS7) *safes); +STACK_OF(PKCS7) *PKCS12_unpack_authsafes(const PKCS12 *p12); + +int PKCS12_add_localkeyid(PKCS12_SAFEBAG *bag, unsigned char *name, + int namelen); +int PKCS12_add_friendlyname_asc(PKCS12_SAFEBAG *bag, const char *name, + int namelen); +int PKCS12_add_friendlyname_utf8(PKCS12_SAFEBAG *bag, const char *name, + int namelen); +int PKCS12_add_CSPName_asc(PKCS12_SAFEBAG *bag, const char *name, + int namelen); +int PKCS12_add_friendlyname_uni(PKCS12_SAFEBAG *bag, + const unsigned char *name, int namelen); +int PKCS8_add_keyusage(PKCS8_PRIV_KEY_INFO *p8, int usage); +ASN1_TYPE *PKCS12_get_attr_gen(const STACK_OF(X509_ATTRIBUTE) *attrs, + int attr_nid); +char *PKCS12_get_friendlyname(PKCS12_SAFEBAG *bag); +const STACK_OF(X509_ATTRIBUTE) * +PKCS12_SAFEBAG_get0_attrs(const PKCS12_SAFEBAG *bag); +unsigned char *PKCS12_pbe_crypt(const X509_ALGOR *algor, + const char *pass, int passlen, + const unsigned char *in, int inlen, + unsigned char **data, int *datalen, + int en_de); +void *PKCS12_item_decrypt_d2i(const X509_ALGOR *algor, const ASN1_ITEM *it, + const char *pass, int passlen, + const ASN1_OCTET_STRING *oct, int zbuf); +ASN1_OCTET_STRING *PKCS12_item_i2d_encrypt(X509_ALGOR *algor, + const ASN1_ITEM *it, + const char *pass, int passlen, + void *obj, int zbuf); +PKCS12 *PKCS12_init(int mode); +int PKCS12_key_gen_asc(const char *pass, int passlen, unsigned char *salt, + int saltlen, int id, int iter, int n, + unsigned char *out, const EVP_MD *md_type); +int PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt, + int saltlen, int id, int iter, int n, + unsigned char *out, const EVP_MD *md_type); +int PKCS12_key_gen_utf8(const char *pass, int passlen, unsigned char *salt, + int saltlen, int id, int iter, int n, + unsigned char *out, const EVP_MD *md_type); +int PKCS12_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, + ASN1_TYPE *param, const EVP_CIPHER *cipher, + const EVP_MD *md_type, int en_de); +int PKCS12_gen_mac(PKCS12 *p12, const char *pass, int passlen, + unsigned char *mac, unsigned int *maclen); +int PKCS12_verify_mac(PKCS12 *p12, const char *pass, int passlen); +int PKCS12_set_mac(PKCS12 *p12, const char *pass, int passlen, + unsigned char *salt, int saltlen, int iter, + const EVP_MD *md_type); +int PKCS12_setup_mac(PKCS12 *p12, int iter, unsigned char *salt, + int saltlen, const EVP_MD *md_type); +unsigned char *OPENSSL_asc2uni(const char *asc, int asclen, + unsigned char **uni, int *unilen); +char *OPENSSL_uni2asc(const unsigned char *uni, int unilen); +unsigned char *OPENSSL_utf82uni(const char *asc, int asclen, + unsigned char **uni, int *unilen); +char *OPENSSL_uni2utf8(const unsigned char *uni, int unilen); + +DECLARE_ASN1_FUNCTIONS(PKCS12) +DECLARE_ASN1_FUNCTIONS(PKCS12_MAC_DATA) +DECLARE_ASN1_FUNCTIONS(PKCS12_SAFEBAG) +DECLARE_ASN1_FUNCTIONS(PKCS12_BAGS) + +DECLARE_ASN1_ITEM(PKCS12_SAFEBAGS) +DECLARE_ASN1_ITEM(PKCS12_AUTHSAFES) + +void PKCS12_PBE_add(void); +int PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert, + STACK_OF(X509) **ca); +PKCS12 *PKCS12_create(const char *pass, const char *name, EVP_PKEY *pkey, + X509 *cert, STACK_OF(X509) *ca, int nid_key, int nid_cert, + int iter, int mac_iter, int keytype); + +PKCS12_SAFEBAG *PKCS12_add_cert(STACK_OF(PKCS12_SAFEBAG) **pbags, X509 *cert); +PKCS12_SAFEBAG *PKCS12_add_key(STACK_OF(PKCS12_SAFEBAG) **pbags, + EVP_PKEY *key, int key_usage, int iter, + int key_nid, const char *pass); +int PKCS12_add_safe(STACK_OF(PKCS7) **psafes, STACK_OF(PKCS12_SAFEBAG) *bags, + int safe_nid, int iter, const char *pass); +PKCS12 *PKCS12_add_safes(STACK_OF(PKCS7) *safes, int p7_nid); + +int i2d_PKCS12_bio(BIO *bp, PKCS12 *p12); +# ifndef OPENSSL_NO_STDIO +int i2d_PKCS12_fp(FILE *fp, PKCS12 *p12); +# endif +PKCS12 *d2i_PKCS12_bio(BIO *bp, PKCS12 **p12); +# ifndef OPENSSL_NO_STDIO +PKCS12 *d2i_PKCS12_fp(FILE *fp, PKCS12 **p12); +# endif +int PKCS12_newpass(PKCS12 *p12, const char *oldpass, const char *newpass); + +# ifdef __cplusplus +} +# endif +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/pkcs12err.h b/MediaClient/MediaClient/openssl/include/openssl/pkcs12err.h new file mode 100644 index 0000000..eff5eb2 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/pkcs12err.h @@ -0,0 +1,81 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_PKCS12ERR_H +# define HEADER_PKCS12ERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_PKCS12_strings(void); + +/* + * PKCS12 function codes. + */ +# define PKCS12_F_OPENSSL_ASC2UNI 121 +# define PKCS12_F_OPENSSL_UNI2ASC 124 +# define PKCS12_F_OPENSSL_UNI2UTF8 127 +# define PKCS12_F_OPENSSL_UTF82UNI 129 +# define PKCS12_F_PKCS12_CREATE 105 +# define PKCS12_F_PKCS12_GEN_MAC 107 +# define PKCS12_F_PKCS12_INIT 109 +# define PKCS12_F_PKCS12_ITEM_DECRYPT_D2I 106 +# define PKCS12_F_PKCS12_ITEM_I2D_ENCRYPT 108 +# define PKCS12_F_PKCS12_ITEM_PACK_SAFEBAG 117 +# define PKCS12_F_PKCS12_KEY_GEN_ASC 110 +# define PKCS12_F_PKCS12_KEY_GEN_UNI 111 +# define PKCS12_F_PKCS12_KEY_GEN_UTF8 116 +# define PKCS12_F_PKCS12_NEWPASS 128 +# define PKCS12_F_PKCS12_PACK_P7DATA 114 +# define PKCS12_F_PKCS12_PACK_P7ENCDATA 115 +# define PKCS12_F_PKCS12_PARSE 118 +# define PKCS12_F_PKCS12_PBE_CRYPT 119 +# define PKCS12_F_PKCS12_PBE_KEYIVGEN 120 +# define PKCS12_F_PKCS12_SAFEBAG_CREATE0_P8INF 112 +# define PKCS12_F_PKCS12_SAFEBAG_CREATE0_PKCS8 113 +# define PKCS12_F_PKCS12_SAFEBAG_CREATE_PKCS8_ENCRYPT 133 +# define PKCS12_F_PKCS12_SETUP_MAC 122 +# define PKCS12_F_PKCS12_SET_MAC 123 +# define PKCS12_F_PKCS12_UNPACK_AUTHSAFES 130 +# define PKCS12_F_PKCS12_UNPACK_P7DATA 131 +# define PKCS12_F_PKCS12_VERIFY_MAC 126 +# define PKCS12_F_PKCS8_ENCRYPT 125 +# define PKCS12_F_PKCS8_SET0_PBE 132 + +/* + * PKCS12 reason codes. + */ +# define PKCS12_R_CANT_PACK_STRUCTURE 100 +# define PKCS12_R_CONTENT_TYPE_NOT_DATA 121 +# define PKCS12_R_DECODE_ERROR 101 +# define PKCS12_R_ENCODE_ERROR 102 +# define PKCS12_R_ENCRYPT_ERROR 103 +# define PKCS12_R_ERROR_SETTING_ENCRYPTED_DATA_TYPE 120 +# define PKCS12_R_INVALID_NULL_ARGUMENT 104 +# define PKCS12_R_INVALID_NULL_PKCS12_POINTER 105 +# define PKCS12_R_IV_GEN_ERROR 106 +# define PKCS12_R_KEY_GEN_ERROR 107 +# define PKCS12_R_MAC_ABSENT 108 +# define PKCS12_R_MAC_GENERATION_ERROR 109 +# define PKCS12_R_MAC_SETUP_ERROR 110 +# define PKCS12_R_MAC_STRING_SET_ERROR 111 +# define PKCS12_R_MAC_VERIFY_FAILURE 113 +# define PKCS12_R_PARSE_ERROR 114 +# define PKCS12_R_PKCS12_ALGOR_CIPHERINIT_ERROR 115 +# define PKCS12_R_PKCS12_CIPHERFINAL_ERROR 116 +# define PKCS12_R_PKCS12_PBE_CRYPT_ERROR 117 +# define PKCS12_R_UNKNOWN_DIGEST_ALGORITHM 118 +# define PKCS12_R_UNSUPPORTED_PKCS12_MODE 119 + +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/pkcs7.h b/MediaClient/MediaClient/openssl/include/openssl/pkcs7.h new file mode 100644 index 0000000..9b66e00 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/pkcs7.h @@ -0,0 +1,319 @@ +/* + * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_PKCS7_H +# define HEADER_PKCS7_H + +# include +# include +# include + +# include +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + +/*- +Encryption_ID DES-CBC +Digest_ID MD5 +Digest_Encryption_ID rsaEncryption +Key_Encryption_ID rsaEncryption +*/ + +typedef struct pkcs7_issuer_and_serial_st { + X509_NAME *issuer; + ASN1_INTEGER *serial; +} PKCS7_ISSUER_AND_SERIAL; + +typedef struct pkcs7_signer_info_st { + ASN1_INTEGER *version; /* version 1 */ + PKCS7_ISSUER_AND_SERIAL *issuer_and_serial; + X509_ALGOR *digest_alg; + STACK_OF(X509_ATTRIBUTE) *auth_attr; /* [ 0 ] */ + X509_ALGOR *digest_enc_alg; + ASN1_OCTET_STRING *enc_digest; + STACK_OF(X509_ATTRIBUTE) *unauth_attr; /* [ 1 ] */ + /* The private key to sign with */ + EVP_PKEY *pkey; +} PKCS7_SIGNER_INFO; + +DEFINE_STACK_OF(PKCS7_SIGNER_INFO) + +typedef struct pkcs7_recip_info_st { + ASN1_INTEGER *version; /* version 0 */ + PKCS7_ISSUER_AND_SERIAL *issuer_and_serial; + X509_ALGOR *key_enc_algor; + ASN1_OCTET_STRING *enc_key; + X509 *cert; /* get the pub-key from this */ +} PKCS7_RECIP_INFO; + +DEFINE_STACK_OF(PKCS7_RECIP_INFO) + +typedef struct pkcs7_signed_st { + ASN1_INTEGER *version; /* version 1 */ + STACK_OF(X509_ALGOR) *md_algs; /* md used */ + STACK_OF(X509) *cert; /* [ 0 ] */ + STACK_OF(X509_CRL) *crl; /* [ 1 ] */ + STACK_OF(PKCS7_SIGNER_INFO) *signer_info; + struct pkcs7_st *contents; +} PKCS7_SIGNED; +/* + * The above structure is very very similar to PKCS7_SIGN_ENVELOPE. How about + * merging the two + */ + +typedef struct pkcs7_enc_content_st { + ASN1_OBJECT *content_type; + X509_ALGOR *algorithm; + ASN1_OCTET_STRING *enc_data; /* [ 0 ] */ + const EVP_CIPHER *cipher; +} PKCS7_ENC_CONTENT; + +typedef struct pkcs7_enveloped_st { + ASN1_INTEGER *version; /* version 0 */ + STACK_OF(PKCS7_RECIP_INFO) *recipientinfo; + PKCS7_ENC_CONTENT *enc_data; +} PKCS7_ENVELOPE; + +typedef struct pkcs7_signedandenveloped_st { + ASN1_INTEGER *version; /* version 1 */ + STACK_OF(X509_ALGOR) *md_algs; /* md used */ + STACK_OF(X509) *cert; /* [ 0 ] */ + STACK_OF(X509_CRL) *crl; /* [ 1 ] */ + STACK_OF(PKCS7_SIGNER_INFO) *signer_info; + PKCS7_ENC_CONTENT *enc_data; + STACK_OF(PKCS7_RECIP_INFO) *recipientinfo; +} PKCS7_SIGN_ENVELOPE; + +typedef struct pkcs7_digest_st { + ASN1_INTEGER *version; /* version 0 */ + X509_ALGOR *md; /* md used */ + struct pkcs7_st *contents; + ASN1_OCTET_STRING *digest; +} PKCS7_DIGEST; + +typedef struct pkcs7_encrypted_st { + ASN1_INTEGER *version; /* version 0 */ + PKCS7_ENC_CONTENT *enc_data; +} PKCS7_ENCRYPT; + +typedef struct pkcs7_st { + /* + * The following is non NULL if it contains ASN1 encoding of this + * structure + */ + unsigned char *asn1; + long length; +# define PKCS7_S_HEADER 0 +# define PKCS7_S_BODY 1 +# define PKCS7_S_TAIL 2 + int state; /* used during processing */ + int detached; + ASN1_OBJECT *type; + /* content as defined by the type */ + /* + * all encryption/message digests are applied to the 'contents', leaving + * out the 'type' field. + */ + union { + char *ptr; + /* NID_pkcs7_data */ + ASN1_OCTET_STRING *data; + /* NID_pkcs7_signed */ + PKCS7_SIGNED *sign; + /* NID_pkcs7_enveloped */ + PKCS7_ENVELOPE *enveloped; + /* NID_pkcs7_signedAndEnveloped */ + PKCS7_SIGN_ENVELOPE *signed_and_enveloped; + /* NID_pkcs7_digest */ + PKCS7_DIGEST *digest; + /* NID_pkcs7_encrypted */ + PKCS7_ENCRYPT *encrypted; + /* Anything else */ + ASN1_TYPE *other; + } d; +} PKCS7; + +DEFINE_STACK_OF(PKCS7) + +# define PKCS7_OP_SET_DETACHED_SIGNATURE 1 +# define PKCS7_OP_GET_DETACHED_SIGNATURE 2 + +# define PKCS7_get_signed_attributes(si) ((si)->auth_attr) +# define PKCS7_get_attributes(si) ((si)->unauth_attr) + +# define PKCS7_type_is_signed(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_signed) +# define PKCS7_type_is_encrypted(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_encrypted) +# define PKCS7_type_is_enveloped(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_enveloped) +# define PKCS7_type_is_signedAndEnveloped(a) \ + (OBJ_obj2nid((a)->type) == NID_pkcs7_signedAndEnveloped) +# define PKCS7_type_is_data(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_data) +# define PKCS7_type_is_digest(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_digest) + +# define PKCS7_set_detached(p,v) \ + PKCS7_ctrl(p,PKCS7_OP_SET_DETACHED_SIGNATURE,v,NULL) +# define PKCS7_get_detached(p) \ + PKCS7_ctrl(p,PKCS7_OP_GET_DETACHED_SIGNATURE,0,NULL) + +# define PKCS7_is_detached(p7) (PKCS7_type_is_signed(p7) && PKCS7_get_detached(p7)) + +/* S/MIME related flags */ + +# define PKCS7_TEXT 0x1 +# define PKCS7_NOCERTS 0x2 +# define PKCS7_NOSIGS 0x4 +# define PKCS7_NOCHAIN 0x8 +# define PKCS7_NOINTERN 0x10 +# define PKCS7_NOVERIFY 0x20 +# define PKCS7_DETACHED 0x40 +# define PKCS7_BINARY 0x80 +# define PKCS7_NOATTR 0x100 +# define PKCS7_NOSMIMECAP 0x200 +# define PKCS7_NOOLDMIMETYPE 0x400 +# define PKCS7_CRLFEOL 0x800 +# define PKCS7_STREAM 0x1000 +# define PKCS7_NOCRL 0x2000 +# define PKCS7_PARTIAL 0x4000 +# define PKCS7_REUSE_DIGEST 0x8000 +# define PKCS7_NO_DUAL_CONTENT 0x10000 + +/* Flags: for compatibility with older code */ + +# define SMIME_TEXT PKCS7_TEXT +# define SMIME_NOCERTS PKCS7_NOCERTS +# define SMIME_NOSIGS PKCS7_NOSIGS +# define SMIME_NOCHAIN PKCS7_NOCHAIN +# define SMIME_NOINTERN PKCS7_NOINTERN +# define SMIME_NOVERIFY PKCS7_NOVERIFY +# define SMIME_DETACHED PKCS7_DETACHED +# define SMIME_BINARY PKCS7_BINARY +# define SMIME_NOATTR PKCS7_NOATTR + +/* CRLF ASCII canonicalisation */ +# define SMIME_ASCIICRLF 0x80000 + +DECLARE_ASN1_FUNCTIONS(PKCS7_ISSUER_AND_SERIAL) + +int PKCS7_ISSUER_AND_SERIAL_digest(PKCS7_ISSUER_AND_SERIAL *data, + const EVP_MD *type, unsigned char *md, + unsigned int *len); +# ifndef OPENSSL_NO_STDIO +PKCS7 *d2i_PKCS7_fp(FILE *fp, PKCS7 **p7); +int i2d_PKCS7_fp(FILE *fp, PKCS7 *p7); +# endif +PKCS7 *PKCS7_dup(PKCS7 *p7); +PKCS7 *d2i_PKCS7_bio(BIO *bp, PKCS7 **p7); +int i2d_PKCS7_bio(BIO *bp, PKCS7 *p7); +int i2d_PKCS7_bio_stream(BIO *out, PKCS7 *p7, BIO *in, int flags); +int PEM_write_bio_PKCS7_stream(BIO *out, PKCS7 *p7, BIO *in, int flags); + +DECLARE_ASN1_FUNCTIONS(PKCS7_SIGNER_INFO) +DECLARE_ASN1_FUNCTIONS(PKCS7_RECIP_INFO) +DECLARE_ASN1_FUNCTIONS(PKCS7_SIGNED) +DECLARE_ASN1_FUNCTIONS(PKCS7_ENC_CONTENT) +DECLARE_ASN1_FUNCTIONS(PKCS7_ENVELOPE) +DECLARE_ASN1_FUNCTIONS(PKCS7_SIGN_ENVELOPE) +DECLARE_ASN1_FUNCTIONS(PKCS7_DIGEST) +DECLARE_ASN1_FUNCTIONS(PKCS7_ENCRYPT) +DECLARE_ASN1_FUNCTIONS(PKCS7) + +DECLARE_ASN1_ITEM(PKCS7_ATTR_SIGN) +DECLARE_ASN1_ITEM(PKCS7_ATTR_VERIFY) + +DECLARE_ASN1_NDEF_FUNCTION(PKCS7) +DECLARE_ASN1_PRINT_FUNCTION(PKCS7) + +long PKCS7_ctrl(PKCS7 *p7, int cmd, long larg, char *parg); + +int PKCS7_set_type(PKCS7 *p7, int type); +int PKCS7_set0_type_other(PKCS7 *p7, int type, ASN1_TYPE *other); +int PKCS7_set_content(PKCS7 *p7, PKCS7 *p7_data); +int PKCS7_SIGNER_INFO_set(PKCS7_SIGNER_INFO *p7i, X509 *x509, EVP_PKEY *pkey, + const EVP_MD *dgst); +int PKCS7_SIGNER_INFO_sign(PKCS7_SIGNER_INFO *si); +int PKCS7_add_signer(PKCS7 *p7, PKCS7_SIGNER_INFO *p7i); +int PKCS7_add_certificate(PKCS7 *p7, X509 *x509); +int PKCS7_add_crl(PKCS7 *p7, X509_CRL *x509); +int PKCS7_content_new(PKCS7 *p7, int nid); +int PKCS7_dataVerify(X509_STORE *cert_store, X509_STORE_CTX *ctx, + BIO *bio, PKCS7 *p7, PKCS7_SIGNER_INFO *si); +int PKCS7_signatureVerify(BIO *bio, PKCS7 *p7, PKCS7_SIGNER_INFO *si, + X509 *x509); + +BIO *PKCS7_dataInit(PKCS7 *p7, BIO *bio); +int PKCS7_dataFinal(PKCS7 *p7, BIO *bio); +BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert); + +PKCS7_SIGNER_INFO *PKCS7_add_signature(PKCS7 *p7, X509 *x509, + EVP_PKEY *pkey, const EVP_MD *dgst); +X509 *PKCS7_cert_from_signer_info(PKCS7 *p7, PKCS7_SIGNER_INFO *si); +int PKCS7_set_digest(PKCS7 *p7, const EVP_MD *md); +STACK_OF(PKCS7_SIGNER_INFO) *PKCS7_get_signer_info(PKCS7 *p7); + +PKCS7_RECIP_INFO *PKCS7_add_recipient(PKCS7 *p7, X509 *x509); +void PKCS7_SIGNER_INFO_get0_algs(PKCS7_SIGNER_INFO *si, EVP_PKEY **pk, + X509_ALGOR **pdig, X509_ALGOR **psig); +void PKCS7_RECIP_INFO_get0_alg(PKCS7_RECIP_INFO *ri, X509_ALGOR **penc); +int PKCS7_add_recipient_info(PKCS7 *p7, PKCS7_RECIP_INFO *ri); +int PKCS7_RECIP_INFO_set(PKCS7_RECIP_INFO *p7i, X509 *x509); +int PKCS7_set_cipher(PKCS7 *p7, const EVP_CIPHER *cipher); +int PKCS7_stream(unsigned char ***boundary, PKCS7 *p7); + +PKCS7_ISSUER_AND_SERIAL *PKCS7_get_issuer_and_serial(PKCS7 *p7, int idx); +ASN1_OCTET_STRING *PKCS7_digest_from_attributes(STACK_OF(X509_ATTRIBUTE) *sk); +int PKCS7_add_signed_attribute(PKCS7_SIGNER_INFO *p7si, int nid, int type, + void *data); +int PKCS7_add_attribute(PKCS7_SIGNER_INFO *p7si, int nid, int atrtype, + void *value); +ASN1_TYPE *PKCS7_get_attribute(PKCS7_SIGNER_INFO *si, int nid); +ASN1_TYPE *PKCS7_get_signed_attribute(PKCS7_SIGNER_INFO *si, int nid); +int PKCS7_set_signed_attributes(PKCS7_SIGNER_INFO *p7si, + STACK_OF(X509_ATTRIBUTE) *sk); +int PKCS7_set_attributes(PKCS7_SIGNER_INFO *p7si, + STACK_OF(X509_ATTRIBUTE) *sk); + +PKCS7 *PKCS7_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs, + BIO *data, int flags); + +PKCS7_SIGNER_INFO *PKCS7_sign_add_signer(PKCS7 *p7, + X509 *signcert, EVP_PKEY *pkey, + const EVP_MD *md, int flags); + +int PKCS7_final(PKCS7 *p7, BIO *data, int flags); +int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store, + BIO *indata, BIO *out, int flags); +STACK_OF(X509) *PKCS7_get0_signers(PKCS7 *p7, STACK_OF(X509) *certs, + int flags); +PKCS7 *PKCS7_encrypt(STACK_OF(X509) *certs, BIO *in, const EVP_CIPHER *cipher, + int flags); +int PKCS7_decrypt(PKCS7 *p7, EVP_PKEY *pkey, X509 *cert, BIO *data, + int flags); + +int PKCS7_add_attrib_smimecap(PKCS7_SIGNER_INFO *si, + STACK_OF(X509_ALGOR) *cap); +STACK_OF(X509_ALGOR) *PKCS7_get_smimecap(PKCS7_SIGNER_INFO *si); +int PKCS7_simple_smimecap(STACK_OF(X509_ALGOR) *sk, int nid, int arg); + +int PKCS7_add_attrib_content_type(PKCS7_SIGNER_INFO *si, ASN1_OBJECT *coid); +int PKCS7_add0_attrib_signing_time(PKCS7_SIGNER_INFO *si, ASN1_TIME *t); +int PKCS7_add1_attrib_digest(PKCS7_SIGNER_INFO *si, + const unsigned char *md, int mdlen); + +int SMIME_write_PKCS7(BIO *bio, PKCS7 *p7, BIO *data, int flags); +PKCS7 *SMIME_read_PKCS7(BIO *bio, BIO **bcont); + +BIO *BIO_new_PKCS7(BIO *out, PKCS7 *p7); + +# ifdef __cplusplus +} +# endif +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/pkcs7err.h b/MediaClient/MediaClient/openssl/include/openssl/pkcs7err.h new file mode 100644 index 0000000..02e0299 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/pkcs7err.h @@ -0,0 +1,103 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_PKCS7ERR_H +# define HEADER_PKCS7ERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_PKCS7_strings(void); + +/* + * PKCS7 function codes. + */ +# define PKCS7_F_DO_PKCS7_SIGNED_ATTRIB 136 +# define PKCS7_F_PKCS7_ADD0_ATTRIB_SIGNING_TIME 135 +# define PKCS7_F_PKCS7_ADD_ATTRIB_SMIMECAP 118 +# define PKCS7_F_PKCS7_ADD_CERTIFICATE 100 +# define PKCS7_F_PKCS7_ADD_CRL 101 +# define PKCS7_F_PKCS7_ADD_RECIPIENT_INFO 102 +# define PKCS7_F_PKCS7_ADD_SIGNATURE 131 +# define PKCS7_F_PKCS7_ADD_SIGNER 103 +# define PKCS7_F_PKCS7_BIO_ADD_DIGEST 125 +# define PKCS7_F_PKCS7_COPY_EXISTING_DIGEST 138 +# define PKCS7_F_PKCS7_CTRL 104 +# define PKCS7_F_PKCS7_DATADECODE 112 +# define PKCS7_F_PKCS7_DATAFINAL 128 +# define PKCS7_F_PKCS7_DATAINIT 105 +# define PKCS7_F_PKCS7_DATAVERIFY 107 +# define PKCS7_F_PKCS7_DECRYPT 114 +# define PKCS7_F_PKCS7_DECRYPT_RINFO 133 +# define PKCS7_F_PKCS7_ENCODE_RINFO 132 +# define PKCS7_F_PKCS7_ENCRYPT 115 +# define PKCS7_F_PKCS7_FINAL 134 +# define PKCS7_F_PKCS7_FIND_DIGEST 127 +# define PKCS7_F_PKCS7_GET0_SIGNERS 124 +# define PKCS7_F_PKCS7_RECIP_INFO_SET 130 +# define PKCS7_F_PKCS7_SET_CIPHER 108 +# define PKCS7_F_PKCS7_SET_CONTENT 109 +# define PKCS7_F_PKCS7_SET_DIGEST 126 +# define PKCS7_F_PKCS7_SET_TYPE 110 +# define PKCS7_F_PKCS7_SIGN 116 +# define PKCS7_F_PKCS7_SIGNATUREVERIFY 113 +# define PKCS7_F_PKCS7_SIGNER_INFO_SET 129 +# define PKCS7_F_PKCS7_SIGNER_INFO_SIGN 139 +# define PKCS7_F_PKCS7_SIGN_ADD_SIGNER 137 +# define PKCS7_F_PKCS7_SIMPLE_SMIMECAP 119 +# define PKCS7_F_PKCS7_VERIFY 117 + +/* + * PKCS7 reason codes. + */ +# define PKCS7_R_CERTIFICATE_VERIFY_ERROR 117 +# define PKCS7_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER 144 +# define PKCS7_R_CIPHER_NOT_INITIALIZED 116 +# define PKCS7_R_CONTENT_AND_DATA_PRESENT 118 +# define PKCS7_R_CTRL_ERROR 152 +# define PKCS7_R_DECRYPT_ERROR 119 +# define PKCS7_R_DIGEST_FAILURE 101 +# define PKCS7_R_ENCRYPTION_CTRL_FAILURE 149 +# define PKCS7_R_ENCRYPTION_NOT_SUPPORTED_FOR_THIS_KEY_TYPE 150 +# define PKCS7_R_ERROR_ADDING_RECIPIENT 120 +# define PKCS7_R_ERROR_SETTING_CIPHER 121 +# define PKCS7_R_INVALID_NULL_POINTER 143 +# define PKCS7_R_INVALID_SIGNED_DATA_TYPE 155 +# define PKCS7_R_NO_CONTENT 122 +# define PKCS7_R_NO_DEFAULT_DIGEST 151 +# define PKCS7_R_NO_MATCHING_DIGEST_TYPE_FOUND 154 +# define PKCS7_R_NO_RECIPIENT_MATCHES_CERTIFICATE 115 +# define PKCS7_R_NO_SIGNATURES_ON_DATA 123 +# define PKCS7_R_NO_SIGNERS 142 +# define PKCS7_R_OPERATION_NOT_SUPPORTED_ON_THIS_TYPE 104 +# define PKCS7_R_PKCS7_ADD_SIGNATURE_ERROR 124 +# define PKCS7_R_PKCS7_ADD_SIGNER_ERROR 153 +# define PKCS7_R_PKCS7_DATASIGN 145 +# define PKCS7_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 127 +# define PKCS7_R_SIGNATURE_FAILURE 105 +# define PKCS7_R_SIGNER_CERTIFICATE_NOT_FOUND 128 +# define PKCS7_R_SIGNING_CTRL_FAILURE 147 +# define PKCS7_R_SIGNING_NOT_SUPPORTED_FOR_THIS_KEY_TYPE 148 +# define PKCS7_R_SMIME_TEXT_ERROR 129 +# define PKCS7_R_UNABLE_TO_FIND_CERTIFICATE 106 +# define PKCS7_R_UNABLE_TO_FIND_MEM_BIO 107 +# define PKCS7_R_UNABLE_TO_FIND_MESSAGE_DIGEST 108 +# define PKCS7_R_UNKNOWN_DIGEST_TYPE 109 +# define PKCS7_R_UNKNOWN_OPERATION 110 +# define PKCS7_R_UNSUPPORTED_CIPHER_TYPE 111 +# define PKCS7_R_UNSUPPORTED_CONTENT_TYPE 112 +# define PKCS7_R_WRONG_CONTENT_TYPE 113 +# define PKCS7_R_WRONG_PKCS7_TYPE 114 + +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/rand.h b/MediaClient/MediaClient/openssl/include/openssl/rand.h new file mode 100644 index 0000000..38a2a27 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/rand.h @@ -0,0 +1,77 @@ +/* + * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_RAND_H +# define HEADER_RAND_H + +# include +# include +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + +struct rand_meth_st { + int (*seed) (const void *buf, int num); + int (*bytes) (unsigned char *buf, int num); + void (*cleanup) (void); + int (*add) (const void *buf, int num, double randomness); + int (*pseudorand) (unsigned char *buf, int num); + int (*status) (void); +}; + +int RAND_set_rand_method(const RAND_METHOD *meth); +const RAND_METHOD *RAND_get_rand_method(void); +# ifndef OPENSSL_NO_ENGINE +int RAND_set_rand_engine(ENGINE *engine); +# endif + +RAND_METHOD *RAND_OpenSSL(void); + +# if OPENSSL_API_COMPAT < 0x10100000L +# define RAND_cleanup() while(0) continue +# endif +int RAND_bytes(unsigned char *buf, int num); +int RAND_priv_bytes(unsigned char *buf, int num); +DEPRECATEDIN_1_1_0(int RAND_pseudo_bytes(unsigned char *buf, int num)) + +void RAND_seed(const void *buf, int num); +void RAND_keep_random_devices_open(int keep); + +# if defined(__ANDROID__) && defined(__NDK_FPABI__) +__NDK_FPABI__ /* __attribute__((pcs("aapcs"))) on ARM */ +# endif +void RAND_add(const void *buf, int num, double randomness); +int RAND_load_file(const char *file, long max_bytes); +int RAND_write_file(const char *file); +const char *RAND_file_name(char *file, size_t num); +int RAND_status(void); + +# ifndef OPENSSL_NO_EGD +int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes); +int RAND_egd(const char *path); +int RAND_egd_bytes(const char *path, int bytes); +# endif + +int RAND_poll(void); + +# if defined(_WIN32) && (defined(BASETYPES) || defined(_WINDEF_H)) +/* application has to include in order to use these */ +DEPRECATEDIN_1_1_0(void RAND_screen(void)) +DEPRECATEDIN_1_1_0(int RAND_event(UINT, WPARAM, LPARAM)) +# endif + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/rand_drbg.h b/MediaClient/MediaClient/openssl/include/openssl/rand_drbg.h new file mode 100644 index 0000000..45b731b --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/rand_drbg.h @@ -0,0 +1,130 @@ +/* + * Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_DRBG_RAND_H +# define HEADER_DRBG_RAND_H + +# include +# include +# include + +/* + * RAND_DRBG flags + * + * Note: if new flags are added, the constant `rand_drbg_used_flags` + * in drbg_lib.c needs to be updated accordingly. + */ + +/* In CTR mode, disable derivation function ctr_df */ +# define RAND_DRBG_FLAG_CTR_NO_DF 0x1 + + +# if OPENSSL_API_COMPAT < 0x10200000L +/* This #define was replaced by an internal constant and should not be used. */ +# define RAND_DRBG_USED_FLAGS (RAND_DRBG_FLAG_CTR_NO_DF) +# endif + +/* + * Default security strength (in the sense of [NIST SP 800-90Ar1]) + * + * NIST SP 800-90Ar1 supports the strength of the DRBG being smaller than that + * of the cipher by collecting less entropy. The current DRBG implementation + * does not take RAND_DRBG_STRENGTH into account and sets the strength of the + * DRBG to that of the cipher. + * + * RAND_DRBG_STRENGTH is currently only used for the legacy RAND + * implementation. + * + * Currently supported ciphers are: NID_aes_128_ctr, NID_aes_192_ctr and + * NID_aes_256_ctr + */ +# define RAND_DRBG_STRENGTH 256 +/* Default drbg type */ +# define RAND_DRBG_TYPE NID_aes_256_ctr +/* Default drbg flags */ +# define RAND_DRBG_FLAGS 0 + + +# ifdef __cplusplus +extern "C" { +# endif + +/* + * Object lifetime functions. + */ +RAND_DRBG *RAND_DRBG_new(int type, unsigned int flags, RAND_DRBG *parent); +RAND_DRBG *RAND_DRBG_secure_new(int type, unsigned int flags, RAND_DRBG *parent); +int RAND_DRBG_set(RAND_DRBG *drbg, int type, unsigned int flags); +int RAND_DRBG_set_defaults(int type, unsigned int flags); +int RAND_DRBG_instantiate(RAND_DRBG *drbg, + const unsigned char *pers, size_t perslen); +int RAND_DRBG_uninstantiate(RAND_DRBG *drbg); +void RAND_DRBG_free(RAND_DRBG *drbg); + +/* + * Object "use" functions. + */ +int RAND_DRBG_reseed(RAND_DRBG *drbg, + const unsigned char *adin, size_t adinlen, + int prediction_resistance); +int RAND_DRBG_generate(RAND_DRBG *drbg, unsigned char *out, size_t outlen, + int prediction_resistance, + const unsigned char *adin, size_t adinlen); +int RAND_DRBG_bytes(RAND_DRBG *drbg, unsigned char *out, size_t outlen); + +int RAND_DRBG_set_reseed_interval(RAND_DRBG *drbg, unsigned int interval); +int RAND_DRBG_set_reseed_time_interval(RAND_DRBG *drbg, time_t interval); + +int RAND_DRBG_set_reseed_defaults( + unsigned int master_reseed_interval, + unsigned int slave_reseed_interval, + time_t master_reseed_time_interval, + time_t slave_reseed_time_interval + ); + +RAND_DRBG *RAND_DRBG_get0_master(void); +RAND_DRBG *RAND_DRBG_get0_public(void); +RAND_DRBG *RAND_DRBG_get0_private(void); + +/* + * EXDATA + */ +# define RAND_DRBG_get_ex_new_index(l, p, newf, dupf, freef) \ + CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_DRBG, l, p, newf, dupf, freef) +int RAND_DRBG_set_ex_data(RAND_DRBG *drbg, int idx, void *arg); +void *RAND_DRBG_get_ex_data(const RAND_DRBG *drbg, int idx); + +/* + * Callback function typedefs + */ +typedef size_t (*RAND_DRBG_get_entropy_fn)(RAND_DRBG *drbg, + unsigned char **pout, + int entropy, size_t min_len, + size_t max_len, + int prediction_resistance); +typedef void (*RAND_DRBG_cleanup_entropy_fn)(RAND_DRBG *ctx, + unsigned char *out, size_t outlen); +typedef size_t (*RAND_DRBG_get_nonce_fn)(RAND_DRBG *drbg, unsigned char **pout, + int entropy, size_t min_len, + size_t max_len); +typedef void (*RAND_DRBG_cleanup_nonce_fn)(RAND_DRBG *drbg, + unsigned char *out, size_t outlen); + +int RAND_DRBG_set_callbacks(RAND_DRBG *drbg, + RAND_DRBG_get_entropy_fn get_entropy, + RAND_DRBG_cleanup_entropy_fn cleanup_entropy, + RAND_DRBG_get_nonce_fn get_nonce, + RAND_DRBG_cleanup_nonce_fn cleanup_nonce); + + +# ifdef __cplusplus +} +# endif + +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/randerr.h b/MediaClient/MediaClient/openssl/include/openssl/randerr.h new file mode 100644 index 0000000..79d5790 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/randerr.h @@ -0,0 +1,94 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_RANDERR_H +# define HEADER_RANDERR_H + +# include + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_RAND_strings(void); + +/* + * RAND function codes. + */ +# define RAND_F_DATA_COLLECT_METHOD 127 +# define RAND_F_DRBG_BYTES 101 +# define RAND_F_DRBG_GET_ENTROPY 105 +# define RAND_F_DRBG_SETUP 117 +# define RAND_F_GET_ENTROPY 106 +# define RAND_F_RAND_BYTES 100 +# define RAND_F_RAND_DRBG_ENABLE_LOCKING 119 +# define RAND_F_RAND_DRBG_GENERATE 107 +# define RAND_F_RAND_DRBG_GET_ENTROPY 120 +# define RAND_F_RAND_DRBG_GET_NONCE 123 +# define RAND_F_RAND_DRBG_INSTANTIATE 108 +# define RAND_F_RAND_DRBG_NEW 109 +# define RAND_F_RAND_DRBG_RESEED 110 +# define RAND_F_RAND_DRBG_RESTART 102 +# define RAND_F_RAND_DRBG_SET 104 +# define RAND_F_RAND_DRBG_SET_DEFAULTS 121 +# define RAND_F_RAND_DRBG_UNINSTANTIATE 118 +# define RAND_F_RAND_LOAD_FILE 111 +# define RAND_F_RAND_POOL_ACQUIRE_ENTROPY 122 +# define RAND_F_RAND_POOL_ADD 103 +# define RAND_F_RAND_POOL_ADD_BEGIN 113 +# define RAND_F_RAND_POOL_ADD_END 114 +# define RAND_F_RAND_POOL_ATTACH 124 +# define RAND_F_RAND_POOL_BYTES_NEEDED 115 +# define RAND_F_RAND_POOL_GROW 125 +# define RAND_F_RAND_POOL_NEW 116 +# define RAND_F_RAND_PSEUDO_BYTES 126 +# define RAND_F_RAND_WRITE_FILE 112 + +/* + * RAND reason codes. + */ +# define RAND_R_ADDITIONAL_INPUT_TOO_LONG 102 +# define RAND_R_ALREADY_INSTANTIATED 103 +# define RAND_R_ARGUMENT_OUT_OF_RANGE 105 +# define RAND_R_CANNOT_OPEN_FILE 121 +# define RAND_R_DRBG_ALREADY_INITIALIZED 129 +# define RAND_R_DRBG_NOT_INITIALISED 104 +# define RAND_R_ENTROPY_INPUT_TOO_LONG 106 +# define RAND_R_ENTROPY_OUT_OF_RANGE 124 +# define RAND_R_ERROR_ENTROPY_POOL_WAS_IGNORED 127 +# define RAND_R_ERROR_INITIALISING_DRBG 107 +# define RAND_R_ERROR_INSTANTIATING_DRBG 108 +# define RAND_R_ERROR_RETRIEVING_ADDITIONAL_INPUT 109 +# define RAND_R_ERROR_RETRIEVING_ENTROPY 110 +# define RAND_R_ERROR_RETRIEVING_NONCE 111 +# define RAND_R_FAILED_TO_CREATE_LOCK 126 +# define RAND_R_FUNC_NOT_IMPLEMENTED 101 +# define RAND_R_FWRITE_ERROR 123 +# define RAND_R_GENERATE_ERROR 112 +# define RAND_R_INTERNAL_ERROR 113 +# define RAND_R_IN_ERROR_STATE 114 +# define RAND_R_NOT_A_REGULAR_FILE 122 +# define RAND_R_NOT_INSTANTIATED 115 +# define RAND_R_NO_DRBG_IMPLEMENTATION_SELECTED 128 +# define RAND_R_PARENT_LOCKING_NOT_ENABLED 130 +# define RAND_R_PARENT_STRENGTH_TOO_WEAK 131 +# define RAND_R_PERSONALISATION_STRING_TOO_LONG 116 +# define RAND_R_PREDICTION_RESISTANCE_NOT_SUPPORTED 133 +# define RAND_R_PRNG_NOT_SEEDED 100 +# define RAND_R_RANDOM_POOL_OVERFLOW 125 +# define RAND_R_RANDOM_POOL_UNDERFLOW 134 +# define RAND_R_REQUEST_TOO_LARGE_FOR_DRBG 117 +# define RAND_R_RESEED_ERROR 118 +# define RAND_R_SELFTEST_FAILURE 119 +# define RAND_R_TOO_LITTLE_NONCE_REQUESTED 135 +# define RAND_R_TOO_MUCH_NONCE_REQUESTED 136 +# define RAND_R_UNSUPPORTED_DRBG_FLAGS 132 +# define RAND_R_UNSUPPORTED_DRBG_TYPE 120 + +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/rc2.h b/MediaClient/MediaClient/openssl/include/openssl/rc2.h new file mode 100644 index 0000000..585f9e4 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/rc2.h @@ -0,0 +1,51 @@ +/* + * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_RC2_H +# define HEADER_RC2_H + +# include + +# ifndef OPENSSL_NO_RC2 +# ifdef __cplusplus +extern "C" { +# endif + +typedef unsigned int RC2_INT; + +# define RC2_ENCRYPT 1 +# define RC2_DECRYPT 0 + +# define RC2_BLOCK 8 +# define RC2_KEY_LENGTH 16 + +typedef struct rc2_key_st { + RC2_INT data[64]; +} RC2_KEY; + +void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data, int bits); +void RC2_ecb_encrypt(const unsigned char *in, unsigned char *out, + RC2_KEY *key, int enc); +void RC2_encrypt(unsigned long *data, RC2_KEY *key); +void RC2_decrypt(unsigned long *data, RC2_KEY *key); +void RC2_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, + RC2_KEY *ks, unsigned char *iv, int enc); +void RC2_cfb64_encrypt(const unsigned char *in, unsigned char *out, + long length, RC2_KEY *schedule, unsigned char *ivec, + int *num, int enc); +void RC2_ofb64_encrypt(const unsigned char *in, unsigned char *out, + long length, RC2_KEY *schedule, unsigned char *ivec, + int *num); + +# ifdef __cplusplus +} +# endif +# endif + +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/rc4.h b/MediaClient/MediaClient/openssl/include/openssl/rc4.h new file mode 100644 index 0000000..86803b3 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/rc4.h @@ -0,0 +1,36 @@ +/* + * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_RC4_H +# define HEADER_RC4_H + +# include + +# ifndef OPENSSL_NO_RC4 +# include +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct rc4_key_st { + RC4_INT x, y; + RC4_INT data[256]; +} RC4_KEY; + +const char *RC4_options(void); +void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data); +void RC4(RC4_KEY *key, size_t len, const unsigned char *indata, + unsigned char *outdata); + +# ifdef __cplusplus +} +# endif +# endif + +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/rc5.h b/MediaClient/MediaClient/openssl/include/openssl/rc5.h new file mode 100644 index 0000000..793f88e --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/rc5.h @@ -0,0 +1,63 @@ +/* + * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_RC5_H +# define HEADER_RC5_H + +# include + +# ifndef OPENSSL_NO_RC5 +# ifdef __cplusplus +extern "C" { +# endif + +# define RC5_ENCRYPT 1 +# define RC5_DECRYPT 0 + +# define RC5_32_INT unsigned int + +# define RC5_32_BLOCK 8 +# define RC5_32_KEY_LENGTH 16/* This is a default, max is 255 */ + +/* + * This are the only values supported. Tweak the code if you want more The + * most supported modes will be RC5-32/12/16 RC5-32/16/8 + */ +# define RC5_8_ROUNDS 8 +# define RC5_12_ROUNDS 12 +# define RC5_16_ROUNDS 16 + +typedef struct rc5_key_st { + /* Number of rounds */ + int rounds; + RC5_32_INT data[2 * (RC5_16_ROUNDS + 1)]; +} RC5_32_KEY; + +void RC5_32_set_key(RC5_32_KEY *key, int len, const unsigned char *data, + int rounds); +void RC5_32_ecb_encrypt(const unsigned char *in, unsigned char *out, + RC5_32_KEY *key, int enc); +void RC5_32_encrypt(unsigned long *data, RC5_32_KEY *key); +void RC5_32_decrypt(unsigned long *data, RC5_32_KEY *key); +void RC5_32_cbc_encrypt(const unsigned char *in, unsigned char *out, + long length, RC5_32_KEY *ks, unsigned char *iv, + int enc); +void RC5_32_cfb64_encrypt(const unsigned char *in, unsigned char *out, + long length, RC5_32_KEY *schedule, + unsigned char *ivec, int *num, int enc); +void RC5_32_ofb64_encrypt(const unsigned char *in, unsigned char *out, + long length, RC5_32_KEY *schedule, + unsigned char *ivec, int *num); + +# ifdef __cplusplus +} +# endif +# endif + +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/ripemd.h b/MediaClient/MediaClient/openssl/include/openssl/ripemd.h new file mode 100644 index 0000000..c42026a --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/ripemd.h @@ -0,0 +1,47 @@ +/* + * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_RIPEMD_H +# define HEADER_RIPEMD_H + +# include + +#ifndef OPENSSL_NO_RMD160 +# include +# include +# ifdef __cplusplus +extern "C" { +# endif + +# define RIPEMD160_LONG unsigned int + +# define RIPEMD160_CBLOCK 64 +# define RIPEMD160_LBLOCK (RIPEMD160_CBLOCK/4) +# define RIPEMD160_DIGEST_LENGTH 20 + +typedef struct RIPEMD160state_st { + RIPEMD160_LONG A, B, C, D, E; + RIPEMD160_LONG Nl, Nh; + RIPEMD160_LONG data[RIPEMD160_LBLOCK]; + unsigned int num; +} RIPEMD160_CTX; + +int RIPEMD160_Init(RIPEMD160_CTX *c); +int RIPEMD160_Update(RIPEMD160_CTX *c, const void *data, size_t len); +int RIPEMD160_Final(unsigned char *md, RIPEMD160_CTX *c); +unsigned char *RIPEMD160(const unsigned char *d, size_t n, unsigned char *md); +void RIPEMD160_Transform(RIPEMD160_CTX *c, const unsigned char *b); + +# ifdef __cplusplus +} +# endif +# endif + + +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/rsa.h b/MediaClient/MediaClient/openssl/include/openssl/rsa.h new file mode 100644 index 0000000..5e76365 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/rsa.h @@ -0,0 +1,513 @@ +/* + * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_RSA_H +# define HEADER_RSA_H + +# include + +# ifndef OPENSSL_NO_RSA +# include +# include +# include +# include +# if OPENSSL_API_COMPAT < 0x10100000L +# include +# endif +# include +# ifdef __cplusplus +extern "C" { +# endif + +/* The types RSA and RSA_METHOD are defined in ossl_typ.h */ + +# ifndef OPENSSL_RSA_MAX_MODULUS_BITS +# define OPENSSL_RSA_MAX_MODULUS_BITS 16384 +# endif + +# define OPENSSL_RSA_FIPS_MIN_MODULUS_BITS 1024 + +# ifndef OPENSSL_RSA_SMALL_MODULUS_BITS +# define OPENSSL_RSA_SMALL_MODULUS_BITS 3072 +# endif +# ifndef OPENSSL_RSA_MAX_PUBEXP_BITS + +/* exponent limit enforced for "large" modulus only */ +# define OPENSSL_RSA_MAX_PUBEXP_BITS 64 +# endif + +# define RSA_3 0x3L +# define RSA_F4 0x10001L + +/* based on RFC 8017 appendix A.1.2 */ +# define RSA_ASN1_VERSION_DEFAULT 0 +# define RSA_ASN1_VERSION_MULTI 1 + +# define RSA_DEFAULT_PRIME_NUM 2 + +# define RSA_METHOD_FLAG_NO_CHECK 0x0001/* don't check pub/private + * match */ + +# define RSA_FLAG_CACHE_PUBLIC 0x0002 +# define RSA_FLAG_CACHE_PRIVATE 0x0004 +# define RSA_FLAG_BLINDING 0x0008 +# define RSA_FLAG_THREAD_SAFE 0x0010 +/* + * This flag means the private key operations will be handled by rsa_mod_exp + * and that they do not depend on the private key components being present: + * for example a key stored in external hardware. Without this flag + * bn_mod_exp gets called when private key components are absent. + */ +# define RSA_FLAG_EXT_PKEY 0x0020 + +/* + * new with 0.9.6j and 0.9.7b; the built-in + * RSA implementation now uses blinding by + * default (ignoring RSA_FLAG_BLINDING), + * but other engines might not need it + */ +# define RSA_FLAG_NO_BLINDING 0x0080 +# if OPENSSL_API_COMPAT < 0x10100000L +/* + * Does nothing. Previously this switched off constant time behaviour. + */ +# define RSA_FLAG_NO_CONSTTIME 0x0000 +# endif +# if OPENSSL_API_COMPAT < 0x00908000L +/* deprecated name for the flag*/ +/* + * new with 0.9.7h; the built-in RSA + * implementation now uses constant time + * modular exponentiation for secret exponents + * by default. This flag causes the + * faster variable sliding window method to + * be used for all exponents. + */ +# define RSA_FLAG_NO_EXP_CONSTTIME RSA_FLAG_NO_CONSTTIME +# endif + +# define EVP_PKEY_CTX_set_rsa_padding(ctx, pad) \ + RSA_pkey_ctx_ctrl(ctx, -1, EVP_PKEY_CTRL_RSA_PADDING, pad, NULL) + +# define EVP_PKEY_CTX_get_rsa_padding(ctx, ppad) \ + RSA_pkey_ctx_ctrl(ctx, -1, EVP_PKEY_CTRL_GET_RSA_PADDING, 0, ppad) + +# define EVP_PKEY_CTX_set_rsa_pss_saltlen(ctx, len) \ + RSA_pkey_ctx_ctrl(ctx, (EVP_PKEY_OP_SIGN|EVP_PKEY_OP_VERIFY), \ + EVP_PKEY_CTRL_RSA_PSS_SALTLEN, len, NULL) +/* Salt length matches digest */ +# define RSA_PSS_SALTLEN_DIGEST -1 +/* Verify only: auto detect salt length */ +# define RSA_PSS_SALTLEN_AUTO -2 +/* Set salt length to maximum possible */ +# define RSA_PSS_SALTLEN_MAX -3 +/* Old compatible max salt length for sign only */ +# define RSA_PSS_SALTLEN_MAX_SIGN -2 + +# define EVP_PKEY_CTX_set_rsa_pss_keygen_saltlen(ctx, len) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA_PSS, EVP_PKEY_OP_KEYGEN, \ + EVP_PKEY_CTRL_RSA_PSS_SALTLEN, len, NULL) + +# define EVP_PKEY_CTX_get_rsa_pss_saltlen(ctx, plen) \ + RSA_pkey_ctx_ctrl(ctx, (EVP_PKEY_OP_SIGN|EVP_PKEY_OP_VERIFY), \ + EVP_PKEY_CTRL_GET_RSA_PSS_SALTLEN, 0, plen) + +# define EVP_PKEY_CTX_set_rsa_keygen_bits(ctx, bits) \ + RSA_pkey_ctx_ctrl(ctx, EVP_PKEY_OP_KEYGEN, \ + EVP_PKEY_CTRL_RSA_KEYGEN_BITS, bits, NULL) + +# define EVP_PKEY_CTX_set_rsa_keygen_pubexp(ctx, pubexp) \ + RSA_pkey_ctx_ctrl(ctx, EVP_PKEY_OP_KEYGEN, \ + EVP_PKEY_CTRL_RSA_KEYGEN_PUBEXP, 0, pubexp) + +# define EVP_PKEY_CTX_set_rsa_keygen_primes(ctx, primes) \ + RSA_pkey_ctx_ctrl(ctx, EVP_PKEY_OP_KEYGEN, \ + EVP_PKEY_CTRL_RSA_KEYGEN_PRIMES, primes, NULL) + +# define EVP_PKEY_CTX_set_rsa_mgf1_md(ctx, md) \ + RSA_pkey_ctx_ctrl(ctx, EVP_PKEY_OP_TYPE_SIG | EVP_PKEY_OP_TYPE_CRYPT, \ + EVP_PKEY_CTRL_RSA_MGF1_MD, 0, (void *)(md)) + +# define EVP_PKEY_CTX_set_rsa_pss_keygen_mgf1_md(ctx, md) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA_PSS, EVP_PKEY_OP_KEYGEN, \ + EVP_PKEY_CTRL_RSA_MGF1_MD, 0, (void *)(md)) + +# define EVP_PKEY_CTX_set_rsa_oaep_md(ctx, md) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_TYPE_CRYPT, \ + EVP_PKEY_CTRL_RSA_OAEP_MD, 0, (void *)(md)) + +# define EVP_PKEY_CTX_get_rsa_mgf1_md(ctx, pmd) \ + RSA_pkey_ctx_ctrl(ctx, EVP_PKEY_OP_TYPE_SIG | EVP_PKEY_OP_TYPE_CRYPT, \ + EVP_PKEY_CTRL_GET_RSA_MGF1_MD, 0, (void *)(pmd)) + +# define EVP_PKEY_CTX_get_rsa_oaep_md(ctx, pmd) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_TYPE_CRYPT, \ + EVP_PKEY_CTRL_GET_RSA_OAEP_MD, 0, (void *)(pmd)) + +# define EVP_PKEY_CTX_set0_rsa_oaep_label(ctx, l, llen) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_TYPE_CRYPT, \ + EVP_PKEY_CTRL_RSA_OAEP_LABEL, llen, (void *)(l)) + +# define EVP_PKEY_CTX_get0_rsa_oaep_label(ctx, l) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_TYPE_CRYPT, \ + EVP_PKEY_CTRL_GET_RSA_OAEP_LABEL, 0, (void *)(l)) + +# define EVP_PKEY_CTX_set_rsa_pss_keygen_md(ctx, md) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA_PSS, \ + EVP_PKEY_OP_KEYGEN, EVP_PKEY_CTRL_MD, \ + 0, (void *)(md)) + +# define EVP_PKEY_CTRL_RSA_PADDING (EVP_PKEY_ALG_CTRL + 1) +# define EVP_PKEY_CTRL_RSA_PSS_SALTLEN (EVP_PKEY_ALG_CTRL + 2) + +# define EVP_PKEY_CTRL_RSA_KEYGEN_BITS (EVP_PKEY_ALG_CTRL + 3) +# define EVP_PKEY_CTRL_RSA_KEYGEN_PUBEXP (EVP_PKEY_ALG_CTRL + 4) +# define EVP_PKEY_CTRL_RSA_MGF1_MD (EVP_PKEY_ALG_CTRL + 5) + +# define EVP_PKEY_CTRL_GET_RSA_PADDING (EVP_PKEY_ALG_CTRL + 6) +# define EVP_PKEY_CTRL_GET_RSA_PSS_SALTLEN (EVP_PKEY_ALG_CTRL + 7) +# define EVP_PKEY_CTRL_GET_RSA_MGF1_MD (EVP_PKEY_ALG_CTRL + 8) + +# define EVP_PKEY_CTRL_RSA_OAEP_MD (EVP_PKEY_ALG_CTRL + 9) +# define EVP_PKEY_CTRL_RSA_OAEP_LABEL (EVP_PKEY_ALG_CTRL + 10) + +# define EVP_PKEY_CTRL_GET_RSA_OAEP_MD (EVP_PKEY_ALG_CTRL + 11) +# define EVP_PKEY_CTRL_GET_RSA_OAEP_LABEL (EVP_PKEY_ALG_CTRL + 12) + +# define EVP_PKEY_CTRL_RSA_KEYGEN_PRIMES (EVP_PKEY_ALG_CTRL + 13) + +# define RSA_PKCS1_PADDING 1 +# define RSA_SSLV23_PADDING 2 +# define RSA_NO_PADDING 3 +# define RSA_PKCS1_OAEP_PADDING 4 +# define RSA_X931_PADDING 5 +/* EVP_PKEY_ only */ +# define RSA_PKCS1_PSS_PADDING 6 + +# define RSA_PKCS1_PADDING_SIZE 11 + +# define RSA_set_app_data(s,arg) RSA_set_ex_data(s,0,arg) +# define RSA_get_app_data(s) RSA_get_ex_data(s,0) + +RSA *RSA_new(void); +RSA *RSA_new_method(ENGINE *engine); +int RSA_bits(const RSA *rsa); +int RSA_size(const RSA *rsa); +int RSA_security_bits(const RSA *rsa); + +int RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d); +int RSA_set0_factors(RSA *r, BIGNUM *p, BIGNUM *q); +int RSA_set0_crt_params(RSA *r,BIGNUM *dmp1, BIGNUM *dmq1, BIGNUM *iqmp); +int RSA_set0_multi_prime_params(RSA *r, BIGNUM *primes[], BIGNUM *exps[], + BIGNUM *coeffs[], int pnum); +void RSA_get0_key(const RSA *r, + const BIGNUM **n, const BIGNUM **e, const BIGNUM **d); +void RSA_get0_factors(const RSA *r, const BIGNUM **p, const BIGNUM **q); +int RSA_get_multi_prime_extra_count(const RSA *r); +int RSA_get0_multi_prime_factors(const RSA *r, const BIGNUM *primes[]); +void RSA_get0_crt_params(const RSA *r, + const BIGNUM **dmp1, const BIGNUM **dmq1, + const BIGNUM **iqmp); +int RSA_get0_multi_prime_crt_params(const RSA *r, const BIGNUM *exps[], + const BIGNUM *coeffs[]); +const BIGNUM *RSA_get0_n(const RSA *d); +const BIGNUM *RSA_get0_e(const RSA *d); +const BIGNUM *RSA_get0_d(const RSA *d); +const BIGNUM *RSA_get0_p(const RSA *d); +const BIGNUM *RSA_get0_q(const RSA *d); +const BIGNUM *RSA_get0_dmp1(const RSA *r); +const BIGNUM *RSA_get0_dmq1(const RSA *r); +const BIGNUM *RSA_get0_iqmp(const RSA *r); +const RSA_PSS_PARAMS *RSA_get0_pss_params(const RSA *r); +void RSA_clear_flags(RSA *r, int flags); +int RSA_test_flags(const RSA *r, int flags); +void RSA_set_flags(RSA *r, int flags); +int RSA_get_version(RSA *r); +ENGINE *RSA_get0_engine(const RSA *r); + +/* Deprecated version */ +DEPRECATEDIN_0_9_8(RSA *RSA_generate_key(int bits, unsigned long e, void + (*callback) (int, int, void *), + void *cb_arg)) + +/* New version */ +int RSA_generate_key_ex(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb); +/* Multi-prime version */ +int RSA_generate_multi_prime_key(RSA *rsa, int bits, int primes, + BIGNUM *e, BN_GENCB *cb); + +int RSA_X931_derive_ex(RSA *rsa, BIGNUM *p1, BIGNUM *p2, BIGNUM *q1, + BIGNUM *q2, const BIGNUM *Xp1, const BIGNUM *Xp2, + const BIGNUM *Xp, const BIGNUM *Xq1, const BIGNUM *Xq2, + const BIGNUM *Xq, const BIGNUM *e, BN_GENCB *cb); +int RSA_X931_generate_key_ex(RSA *rsa, int bits, const BIGNUM *e, + BN_GENCB *cb); + +int RSA_check_key(const RSA *); +int RSA_check_key_ex(const RSA *, BN_GENCB *cb); + /* next 4 return -1 on error */ +int RSA_public_encrypt(int flen, const unsigned char *from, + unsigned char *to, RSA *rsa, int padding); +int RSA_private_encrypt(int flen, const unsigned char *from, + unsigned char *to, RSA *rsa, int padding); +int RSA_public_decrypt(int flen, const unsigned char *from, + unsigned char *to, RSA *rsa, int padding); +int RSA_private_decrypt(int flen, const unsigned char *from, + unsigned char *to, RSA *rsa, int padding); +void RSA_free(RSA *r); +/* "up" the RSA object's reference count */ +int RSA_up_ref(RSA *r); + +int RSA_flags(const RSA *r); + +void RSA_set_default_method(const RSA_METHOD *meth); +const RSA_METHOD *RSA_get_default_method(void); +const RSA_METHOD *RSA_null_method(void); +const RSA_METHOD *RSA_get_method(const RSA *rsa); +int RSA_set_method(RSA *rsa, const RSA_METHOD *meth); + +/* these are the actual RSA functions */ +const RSA_METHOD *RSA_PKCS1_OpenSSL(void); + +int RSA_pkey_ctx_ctrl(EVP_PKEY_CTX *ctx, int optype, int cmd, int p1, void *p2); + +DECLARE_ASN1_ENCODE_FUNCTIONS_const(RSA, RSAPublicKey) +DECLARE_ASN1_ENCODE_FUNCTIONS_const(RSA, RSAPrivateKey) + +struct rsa_pss_params_st { + X509_ALGOR *hashAlgorithm; + X509_ALGOR *maskGenAlgorithm; + ASN1_INTEGER *saltLength; + ASN1_INTEGER *trailerField; + /* Decoded hash algorithm from maskGenAlgorithm */ + X509_ALGOR *maskHash; +}; + +DECLARE_ASN1_FUNCTIONS(RSA_PSS_PARAMS) + +typedef struct rsa_oaep_params_st { + X509_ALGOR *hashFunc; + X509_ALGOR *maskGenFunc; + X509_ALGOR *pSourceFunc; + /* Decoded hash algorithm from maskGenFunc */ + X509_ALGOR *maskHash; +} RSA_OAEP_PARAMS; + +DECLARE_ASN1_FUNCTIONS(RSA_OAEP_PARAMS) + +# ifndef OPENSSL_NO_STDIO +int RSA_print_fp(FILE *fp, const RSA *r, int offset); +# endif + +int RSA_print(BIO *bp, const RSA *r, int offset); + +/* + * The following 2 functions sign and verify a X509_SIG ASN1 object inside + * PKCS#1 padded RSA encryption + */ +int RSA_sign(int type, const unsigned char *m, unsigned int m_length, + unsigned char *sigret, unsigned int *siglen, RSA *rsa); +int RSA_verify(int type, const unsigned char *m, unsigned int m_length, + const unsigned char *sigbuf, unsigned int siglen, RSA *rsa); + +/* + * The following 2 function sign and verify a ASN1_OCTET_STRING object inside + * PKCS#1 padded RSA encryption + */ +int RSA_sign_ASN1_OCTET_STRING(int type, + const unsigned char *m, unsigned int m_length, + unsigned char *sigret, unsigned int *siglen, + RSA *rsa); +int RSA_verify_ASN1_OCTET_STRING(int type, const unsigned char *m, + unsigned int m_length, unsigned char *sigbuf, + unsigned int siglen, RSA *rsa); + +int RSA_blinding_on(RSA *rsa, BN_CTX *ctx); +void RSA_blinding_off(RSA *rsa); +BN_BLINDING *RSA_setup_blinding(RSA *rsa, BN_CTX *ctx); + +int RSA_padding_add_PKCS1_type_1(unsigned char *to, int tlen, + const unsigned char *f, int fl); +int RSA_padding_check_PKCS1_type_1(unsigned char *to, int tlen, + const unsigned char *f, int fl, + int rsa_len); +int RSA_padding_add_PKCS1_type_2(unsigned char *to, int tlen, + const unsigned char *f, int fl); +int RSA_padding_check_PKCS1_type_2(unsigned char *to, int tlen, + const unsigned char *f, int fl, + int rsa_len); +int PKCS1_MGF1(unsigned char *mask, long len, const unsigned char *seed, + long seedlen, const EVP_MD *dgst); +int RSA_padding_add_PKCS1_OAEP(unsigned char *to, int tlen, + const unsigned char *f, int fl, + const unsigned char *p, int pl); +int RSA_padding_check_PKCS1_OAEP(unsigned char *to, int tlen, + const unsigned char *f, int fl, int rsa_len, + const unsigned char *p, int pl); +int RSA_padding_add_PKCS1_OAEP_mgf1(unsigned char *to, int tlen, + const unsigned char *from, int flen, + const unsigned char *param, int plen, + const EVP_MD *md, const EVP_MD *mgf1md); +int RSA_padding_check_PKCS1_OAEP_mgf1(unsigned char *to, int tlen, + const unsigned char *from, int flen, + int num, const unsigned char *param, + int plen, const EVP_MD *md, + const EVP_MD *mgf1md); +int RSA_padding_add_SSLv23(unsigned char *to, int tlen, + const unsigned char *f, int fl); +int RSA_padding_check_SSLv23(unsigned char *to, int tlen, + const unsigned char *f, int fl, int rsa_len); +int RSA_padding_add_none(unsigned char *to, int tlen, const unsigned char *f, + int fl); +int RSA_padding_check_none(unsigned char *to, int tlen, + const unsigned char *f, int fl, int rsa_len); +int RSA_padding_add_X931(unsigned char *to, int tlen, const unsigned char *f, + int fl); +int RSA_padding_check_X931(unsigned char *to, int tlen, + const unsigned char *f, int fl, int rsa_len); +int RSA_X931_hash_id(int nid); + +int RSA_verify_PKCS1_PSS(RSA *rsa, const unsigned char *mHash, + const EVP_MD *Hash, const unsigned char *EM, + int sLen); +int RSA_padding_add_PKCS1_PSS(RSA *rsa, unsigned char *EM, + const unsigned char *mHash, const EVP_MD *Hash, + int sLen); + +int RSA_verify_PKCS1_PSS_mgf1(RSA *rsa, const unsigned char *mHash, + const EVP_MD *Hash, const EVP_MD *mgf1Hash, + const unsigned char *EM, int sLen); + +int RSA_padding_add_PKCS1_PSS_mgf1(RSA *rsa, unsigned char *EM, + const unsigned char *mHash, + const EVP_MD *Hash, const EVP_MD *mgf1Hash, + int sLen); + +#define RSA_get_ex_new_index(l, p, newf, dupf, freef) \ + CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_RSA, l, p, newf, dupf, freef) +int RSA_set_ex_data(RSA *r, int idx, void *arg); +void *RSA_get_ex_data(const RSA *r, int idx); + +RSA *RSAPublicKey_dup(RSA *rsa); +RSA *RSAPrivateKey_dup(RSA *rsa); + +/* + * If this flag is set the RSA method is FIPS compliant and can be used in + * FIPS mode. This is set in the validated module method. If an application + * sets this flag in its own methods it is its responsibility to ensure the + * result is compliant. + */ + +# define RSA_FLAG_FIPS_METHOD 0x0400 + +/* + * If this flag is set the operations normally disabled in FIPS mode are + * permitted it is then the applications responsibility to ensure that the + * usage is compliant. + */ + +# define RSA_FLAG_NON_FIPS_ALLOW 0x0400 +/* + * Application has decided PRNG is good enough to generate a key: don't + * check. + */ +# define RSA_FLAG_CHECKED 0x0800 + +RSA_METHOD *RSA_meth_new(const char *name, int flags); +void RSA_meth_free(RSA_METHOD *meth); +RSA_METHOD *RSA_meth_dup(const RSA_METHOD *meth); +const char *RSA_meth_get0_name(const RSA_METHOD *meth); +int RSA_meth_set1_name(RSA_METHOD *meth, const char *name); +int RSA_meth_get_flags(const RSA_METHOD *meth); +int RSA_meth_set_flags(RSA_METHOD *meth, int flags); +void *RSA_meth_get0_app_data(const RSA_METHOD *meth); +int RSA_meth_set0_app_data(RSA_METHOD *meth, void *app_data); +int (*RSA_meth_get_pub_enc(const RSA_METHOD *meth)) + (int flen, const unsigned char *from, + unsigned char *to, RSA *rsa, int padding); +int RSA_meth_set_pub_enc(RSA_METHOD *rsa, + int (*pub_enc) (int flen, const unsigned char *from, + unsigned char *to, RSA *rsa, + int padding)); +int (*RSA_meth_get_pub_dec(const RSA_METHOD *meth)) + (int flen, const unsigned char *from, + unsigned char *to, RSA *rsa, int padding); +int RSA_meth_set_pub_dec(RSA_METHOD *rsa, + int (*pub_dec) (int flen, const unsigned char *from, + unsigned char *to, RSA *rsa, + int padding)); +int (*RSA_meth_get_priv_enc(const RSA_METHOD *meth)) + (int flen, const unsigned char *from, + unsigned char *to, RSA *rsa, int padding); +int RSA_meth_set_priv_enc(RSA_METHOD *rsa, + int (*priv_enc) (int flen, const unsigned char *from, + unsigned char *to, RSA *rsa, + int padding)); +int (*RSA_meth_get_priv_dec(const RSA_METHOD *meth)) + (int flen, const unsigned char *from, + unsigned char *to, RSA *rsa, int padding); +int RSA_meth_set_priv_dec(RSA_METHOD *rsa, + int (*priv_dec) (int flen, const unsigned char *from, + unsigned char *to, RSA *rsa, + int padding)); +int (*RSA_meth_get_mod_exp(const RSA_METHOD *meth)) + (BIGNUM *r0, const BIGNUM *i, RSA *rsa, BN_CTX *ctx); +int RSA_meth_set_mod_exp(RSA_METHOD *rsa, + int (*mod_exp) (BIGNUM *r0, const BIGNUM *i, RSA *rsa, + BN_CTX *ctx)); +int (*RSA_meth_get_bn_mod_exp(const RSA_METHOD *meth)) + (BIGNUM *r, const BIGNUM *a, const BIGNUM *p, + const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); +int RSA_meth_set_bn_mod_exp(RSA_METHOD *rsa, + int (*bn_mod_exp) (BIGNUM *r, + const BIGNUM *a, + const BIGNUM *p, + const BIGNUM *m, + BN_CTX *ctx, + BN_MONT_CTX *m_ctx)); +int (*RSA_meth_get_init(const RSA_METHOD *meth)) (RSA *rsa); +int RSA_meth_set_init(RSA_METHOD *rsa, int (*init) (RSA *rsa)); +int (*RSA_meth_get_finish(const RSA_METHOD *meth)) (RSA *rsa); +int RSA_meth_set_finish(RSA_METHOD *rsa, int (*finish) (RSA *rsa)); +int (*RSA_meth_get_sign(const RSA_METHOD *meth)) + (int type, + const unsigned char *m, unsigned int m_length, + unsigned char *sigret, unsigned int *siglen, + const RSA *rsa); +int RSA_meth_set_sign(RSA_METHOD *rsa, + int (*sign) (int type, const unsigned char *m, + unsigned int m_length, + unsigned char *sigret, unsigned int *siglen, + const RSA *rsa)); +int (*RSA_meth_get_verify(const RSA_METHOD *meth)) + (int dtype, const unsigned char *m, + unsigned int m_length, const unsigned char *sigbuf, + unsigned int siglen, const RSA *rsa); +int RSA_meth_set_verify(RSA_METHOD *rsa, + int (*verify) (int dtype, const unsigned char *m, + unsigned int m_length, + const unsigned char *sigbuf, + unsigned int siglen, const RSA *rsa)); +int (*RSA_meth_get_keygen(const RSA_METHOD *meth)) + (RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb); +int RSA_meth_set_keygen(RSA_METHOD *rsa, + int (*keygen) (RSA *rsa, int bits, BIGNUM *e, + BN_GENCB *cb)); +int (*RSA_meth_get_multi_prime_keygen(const RSA_METHOD *meth)) + (RSA *rsa, int bits, int primes, BIGNUM *e, BN_GENCB *cb); +int RSA_meth_set_multi_prime_keygen(RSA_METHOD *meth, + int (*keygen) (RSA *rsa, int bits, + int primes, BIGNUM *e, + BN_GENCB *cb)); + +# ifdef __cplusplus +} +# endif +# endif +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/rsaerr.h b/MediaClient/MediaClient/openssl/include/openssl/rsaerr.h new file mode 100644 index 0000000..59b15e1 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/rsaerr.h @@ -0,0 +1,167 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_RSAERR_H +# define HEADER_RSAERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_RSA_strings(void); + +/* + * RSA function codes. + */ +# define RSA_F_CHECK_PADDING_MD 140 +# define RSA_F_ENCODE_PKCS1 146 +# define RSA_F_INT_RSA_VERIFY 145 +# define RSA_F_OLD_RSA_PRIV_DECODE 147 +# define RSA_F_PKEY_PSS_INIT 165 +# define RSA_F_PKEY_RSA_CTRL 143 +# define RSA_F_PKEY_RSA_CTRL_STR 144 +# define RSA_F_PKEY_RSA_SIGN 142 +# define RSA_F_PKEY_RSA_VERIFY 149 +# define RSA_F_PKEY_RSA_VERIFYRECOVER 141 +# define RSA_F_RSA_ALGOR_TO_MD 156 +# define RSA_F_RSA_BUILTIN_KEYGEN 129 +# define RSA_F_RSA_CHECK_KEY 123 +# define RSA_F_RSA_CHECK_KEY_EX 160 +# define RSA_F_RSA_CMS_DECRYPT 159 +# define RSA_F_RSA_CMS_VERIFY 158 +# define RSA_F_RSA_ITEM_VERIFY 148 +# define RSA_F_RSA_METH_DUP 161 +# define RSA_F_RSA_METH_NEW 162 +# define RSA_F_RSA_METH_SET1_NAME 163 +# define RSA_F_RSA_MGF1_TO_MD 157 +# define RSA_F_RSA_MULTIP_INFO_NEW 166 +# define RSA_F_RSA_NEW_METHOD 106 +# define RSA_F_RSA_NULL 124 +# define RSA_F_RSA_NULL_PRIVATE_DECRYPT 132 +# define RSA_F_RSA_NULL_PRIVATE_ENCRYPT 133 +# define RSA_F_RSA_NULL_PUBLIC_DECRYPT 134 +# define RSA_F_RSA_NULL_PUBLIC_ENCRYPT 135 +# define RSA_F_RSA_OSSL_PRIVATE_DECRYPT 101 +# define RSA_F_RSA_OSSL_PRIVATE_ENCRYPT 102 +# define RSA_F_RSA_OSSL_PUBLIC_DECRYPT 103 +# define RSA_F_RSA_OSSL_PUBLIC_ENCRYPT 104 +# define RSA_F_RSA_PADDING_ADD_NONE 107 +# define RSA_F_RSA_PADDING_ADD_PKCS1_OAEP 121 +# define RSA_F_RSA_PADDING_ADD_PKCS1_OAEP_MGF1 154 +# define RSA_F_RSA_PADDING_ADD_PKCS1_PSS 125 +# define RSA_F_RSA_PADDING_ADD_PKCS1_PSS_MGF1 152 +# define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_1 108 +# define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_2 109 +# define RSA_F_RSA_PADDING_ADD_SSLV23 110 +# define RSA_F_RSA_PADDING_ADD_X931 127 +# define RSA_F_RSA_PADDING_CHECK_NONE 111 +# define RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP 122 +# define RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP_MGF1 153 +# define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_1 112 +# define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_2 113 +# define RSA_F_RSA_PADDING_CHECK_SSLV23 114 +# define RSA_F_RSA_PADDING_CHECK_X931 128 +# define RSA_F_RSA_PARAM_DECODE 164 +# define RSA_F_RSA_PRINT 115 +# define RSA_F_RSA_PRINT_FP 116 +# define RSA_F_RSA_PRIV_DECODE 150 +# define RSA_F_RSA_PRIV_ENCODE 138 +# define RSA_F_RSA_PSS_GET_PARAM 151 +# define RSA_F_RSA_PSS_TO_CTX 155 +# define RSA_F_RSA_PUB_DECODE 139 +# define RSA_F_RSA_SETUP_BLINDING 136 +# define RSA_F_RSA_SIGN 117 +# define RSA_F_RSA_SIGN_ASN1_OCTET_STRING 118 +# define RSA_F_RSA_VERIFY 119 +# define RSA_F_RSA_VERIFY_ASN1_OCTET_STRING 120 +# define RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1 126 +# define RSA_F_SETUP_TBUF 167 + +/* + * RSA reason codes. + */ +# define RSA_R_ALGORITHM_MISMATCH 100 +# define RSA_R_BAD_E_VALUE 101 +# define RSA_R_BAD_FIXED_HEADER_DECRYPT 102 +# define RSA_R_BAD_PAD_BYTE_COUNT 103 +# define RSA_R_BAD_SIGNATURE 104 +# define RSA_R_BLOCK_TYPE_IS_NOT_01 106 +# define RSA_R_BLOCK_TYPE_IS_NOT_02 107 +# define RSA_R_DATA_GREATER_THAN_MOD_LEN 108 +# define RSA_R_DATA_TOO_LARGE 109 +# define RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE 110 +# define RSA_R_DATA_TOO_LARGE_FOR_MODULUS 132 +# define RSA_R_DATA_TOO_SMALL 111 +# define RSA_R_DATA_TOO_SMALL_FOR_KEY_SIZE 122 +# define RSA_R_DIGEST_DOES_NOT_MATCH 158 +# define RSA_R_DIGEST_NOT_ALLOWED 145 +# define RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY 112 +# define RSA_R_DMP1_NOT_CONGRUENT_TO_D 124 +# define RSA_R_DMQ1_NOT_CONGRUENT_TO_D 125 +# define RSA_R_D_E_NOT_CONGRUENT_TO_1 123 +# define RSA_R_FIRST_OCTET_INVALID 133 +# define RSA_R_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE 144 +# define RSA_R_INVALID_DIGEST 157 +# define RSA_R_INVALID_DIGEST_LENGTH 143 +# define RSA_R_INVALID_HEADER 137 +# define RSA_R_INVALID_LABEL 160 +# define RSA_R_INVALID_MESSAGE_LENGTH 131 +# define RSA_R_INVALID_MGF1_MD 156 +# define RSA_R_INVALID_MULTI_PRIME_KEY 167 +# define RSA_R_INVALID_OAEP_PARAMETERS 161 +# define RSA_R_INVALID_PADDING 138 +# define RSA_R_INVALID_PADDING_MODE 141 +# define RSA_R_INVALID_PSS_PARAMETERS 149 +# define RSA_R_INVALID_PSS_SALTLEN 146 +# define RSA_R_INVALID_SALT_LENGTH 150 +# define RSA_R_INVALID_TRAILER 139 +# define RSA_R_INVALID_X931_DIGEST 142 +# define RSA_R_IQMP_NOT_INVERSE_OF_Q 126 +# define RSA_R_KEY_PRIME_NUM_INVALID 165 +# define RSA_R_KEY_SIZE_TOO_SMALL 120 +# define RSA_R_LAST_OCTET_INVALID 134 +# define RSA_R_MISSING_PRIVATE_KEY 179 +# define RSA_R_MGF1_DIGEST_NOT_ALLOWED 152 +# define RSA_R_MODULUS_TOO_LARGE 105 +# define RSA_R_MP_COEFFICIENT_NOT_INVERSE_OF_R 168 +# define RSA_R_MP_EXPONENT_NOT_CONGRUENT_TO_D 169 +# define RSA_R_MP_R_NOT_PRIME 170 +# define RSA_R_NO_PUBLIC_EXPONENT 140 +# define RSA_R_NULL_BEFORE_BLOCK_MISSING 113 +# define RSA_R_N_DOES_NOT_EQUAL_PRODUCT_OF_PRIMES 172 +# define RSA_R_N_DOES_NOT_EQUAL_P_Q 127 +# define RSA_R_OAEP_DECODING_ERROR 121 +# define RSA_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE 148 +# define RSA_R_PADDING_CHECK_FAILED 114 +# define RSA_R_PKCS_DECODING_ERROR 159 +# define RSA_R_PSS_SALTLEN_TOO_SMALL 164 +# define RSA_R_P_NOT_PRIME 128 +# define RSA_R_Q_NOT_PRIME 129 +# define RSA_R_RSA_OPERATIONS_NOT_SUPPORTED 130 +# define RSA_R_SLEN_CHECK_FAILED 136 +# define RSA_R_SLEN_RECOVERY_FAILED 135 +# define RSA_R_SSLV3_ROLLBACK_ATTACK 115 +# define RSA_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 116 +# define RSA_R_UNKNOWN_ALGORITHM_TYPE 117 +# define RSA_R_UNKNOWN_DIGEST 166 +# define RSA_R_UNKNOWN_MASK_DIGEST 151 +# define RSA_R_UNKNOWN_PADDING_TYPE 118 +# define RSA_R_UNSUPPORTED_ENCRYPTION_TYPE 162 +# define RSA_R_UNSUPPORTED_LABEL_SOURCE 163 +# define RSA_R_UNSUPPORTED_MASK_ALGORITHM 153 +# define RSA_R_UNSUPPORTED_MASK_PARAMETER 154 +# define RSA_R_UNSUPPORTED_SIGNATURE_TYPE 155 +# define RSA_R_VALUE_MISSING 147 +# define RSA_R_WRONG_SIGNATURE_LENGTH 119 + +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/safestack.h b/MediaClient/MediaClient/openssl/include/openssl/safestack.h new file mode 100644 index 0000000..38b5578 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/safestack.h @@ -0,0 +1,207 @@ +/* + * Copyright 1999-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_SAFESTACK_H +# define HEADER_SAFESTACK_H + +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + +# define STACK_OF(type) struct stack_st_##type + +# define SKM_DEFINE_STACK_OF(t1, t2, t3) \ + STACK_OF(t1); \ + typedef int (*sk_##t1##_compfunc)(const t3 * const *a, const t3 *const *b); \ + typedef void (*sk_##t1##_freefunc)(t3 *a); \ + typedef t3 * (*sk_##t1##_copyfunc)(const t3 *a); \ + static ossl_unused ossl_inline int sk_##t1##_num(const STACK_OF(t1) *sk) \ + { \ + return OPENSSL_sk_num((const OPENSSL_STACK *)sk); \ + } \ + static ossl_unused ossl_inline t2 *sk_##t1##_value(const STACK_OF(t1) *sk, int idx) \ + { \ + return (t2 *)OPENSSL_sk_value((const OPENSSL_STACK *)sk, idx); \ + } \ + static ossl_unused ossl_inline STACK_OF(t1) *sk_##t1##_new(sk_##t1##_compfunc compare) \ + { \ + return (STACK_OF(t1) *)OPENSSL_sk_new((OPENSSL_sk_compfunc)compare); \ + } \ + static ossl_unused ossl_inline STACK_OF(t1) *sk_##t1##_new_null(void) \ + { \ + return (STACK_OF(t1) *)OPENSSL_sk_new_null(); \ + } \ + static ossl_unused ossl_inline STACK_OF(t1) *sk_##t1##_new_reserve(sk_##t1##_compfunc compare, int n) \ + { \ + return (STACK_OF(t1) *)OPENSSL_sk_new_reserve((OPENSSL_sk_compfunc)compare, n); \ + } \ + static ossl_unused ossl_inline int sk_##t1##_reserve(STACK_OF(t1) *sk, int n) \ + { \ + return OPENSSL_sk_reserve((OPENSSL_STACK *)sk, n); \ + } \ + static ossl_unused ossl_inline void sk_##t1##_free(STACK_OF(t1) *sk) \ + { \ + OPENSSL_sk_free((OPENSSL_STACK *)sk); \ + } \ + static ossl_unused ossl_inline void sk_##t1##_zero(STACK_OF(t1) *sk) \ + { \ + OPENSSL_sk_zero((OPENSSL_STACK *)sk); \ + } \ + static ossl_unused ossl_inline t2 *sk_##t1##_delete(STACK_OF(t1) *sk, int i) \ + { \ + return (t2 *)OPENSSL_sk_delete((OPENSSL_STACK *)sk, i); \ + } \ + static ossl_unused ossl_inline t2 *sk_##t1##_delete_ptr(STACK_OF(t1) *sk, t2 *ptr) \ + { \ + return (t2 *)OPENSSL_sk_delete_ptr((OPENSSL_STACK *)sk, \ + (const void *)ptr); \ + } \ + static ossl_unused ossl_inline int sk_##t1##_push(STACK_OF(t1) *sk, t2 *ptr) \ + { \ + return OPENSSL_sk_push((OPENSSL_STACK *)sk, (const void *)ptr); \ + } \ + static ossl_unused ossl_inline int sk_##t1##_unshift(STACK_OF(t1) *sk, t2 *ptr) \ + { \ + return OPENSSL_sk_unshift((OPENSSL_STACK *)sk, (const void *)ptr); \ + } \ + static ossl_unused ossl_inline t2 *sk_##t1##_pop(STACK_OF(t1) *sk) \ + { \ + return (t2 *)OPENSSL_sk_pop((OPENSSL_STACK *)sk); \ + } \ + static ossl_unused ossl_inline t2 *sk_##t1##_shift(STACK_OF(t1) *sk) \ + { \ + return (t2 *)OPENSSL_sk_shift((OPENSSL_STACK *)sk); \ + } \ + static ossl_unused ossl_inline void sk_##t1##_pop_free(STACK_OF(t1) *sk, sk_##t1##_freefunc freefunc) \ + { \ + OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \ + } \ + static ossl_unused ossl_inline int sk_##t1##_insert(STACK_OF(t1) *sk, t2 *ptr, int idx) \ + { \ + return OPENSSL_sk_insert((OPENSSL_STACK *)sk, (const void *)ptr, idx); \ + } \ + static ossl_unused ossl_inline t2 *sk_##t1##_set(STACK_OF(t1) *sk, int idx, t2 *ptr) \ + { \ + return (t2 *)OPENSSL_sk_set((OPENSSL_STACK *)sk, idx, (const void *)ptr); \ + } \ + static ossl_unused ossl_inline int sk_##t1##_find(STACK_OF(t1) *sk, t2 *ptr) \ + { \ + return OPENSSL_sk_find((OPENSSL_STACK *)sk, (const void *)ptr); \ + } \ + static ossl_unused ossl_inline int sk_##t1##_find_ex(STACK_OF(t1) *sk, t2 *ptr) \ + { \ + return OPENSSL_sk_find_ex((OPENSSL_STACK *)sk, (const void *)ptr); \ + } \ + static ossl_unused ossl_inline void sk_##t1##_sort(STACK_OF(t1) *sk) \ + { \ + OPENSSL_sk_sort((OPENSSL_STACK *)sk); \ + } \ + static ossl_unused ossl_inline int sk_##t1##_is_sorted(const STACK_OF(t1) *sk) \ + { \ + return OPENSSL_sk_is_sorted((const OPENSSL_STACK *)sk); \ + } \ + static ossl_unused ossl_inline STACK_OF(t1) * sk_##t1##_dup(const STACK_OF(t1) *sk) \ + { \ + return (STACK_OF(t1) *)OPENSSL_sk_dup((const OPENSSL_STACK *)sk); \ + } \ + static ossl_unused ossl_inline STACK_OF(t1) *sk_##t1##_deep_copy(const STACK_OF(t1) *sk, \ + sk_##t1##_copyfunc copyfunc, \ + sk_##t1##_freefunc freefunc) \ + { \ + return (STACK_OF(t1) *)OPENSSL_sk_deep_copy((const OPENSSL_STACK *)sk, \ + (OPENSSL_sk_copyfunc)copyfunc, \ + (OPENSSL_sk_freefunc)freefunc); \ + } \ + static ossl_unused ossl_inline sk_##t1##_compfunc sk_##t1##_set_cmp_func(STACK_OF(t1) *sk, sk_##t1##_compfunc compare) \ + { \ + return (sk_##t1##_compfunc)OPENSSL_sk_set_cmp_func((OPENSSL_STACK *)sk, (OPENSSL_sk_compfunc)compare); \ + } + +# define DEFINE_SPECIAL_STACK_OF(t1, t2) SKM_DEFINE_STACK_OF(t1, t2, t2) +# define DEFINE_STACK_OF(t) SKM_DEFINE_STACK_OF(t, t, t) +# define DEFINE_SPECIAL_STACK_OF_CONST(t1, t2) \ + SKM_DEFINE_STACK_OF(t1, const t2, t2) +# define DEFINE_STACK_OF_CONST(t) SKM_DEFINE_STACK_OF(t, const t, t) + +/*- + * Strings are special: normally an lhash entry will point to a single + * (somewhat) mutable object. In the case of strings: + * + * a) Instead of a single char, there is an array of chars, NUL-terminated. + * b) The string may have be immutable. + * + * So, they need their own declarations. Especially important for + * type-checking tools, such as Deputy. + * + * In practice, however, it appears to be hard to have a const + * string. For now, I'm settling for dealing with the fact it is a + * string at all. + */ +typedef char *OPENSSL_STRING; +typedef const char *OPENSSL_CSTRING; + +/*- + * Confusingly, LHASH_OF(STRING) deals with char ** throughout, but + * STACK_OF(STRING) is really more like STACK_OF(char), only, as mentioned + * above, instead of a single char each entry is a NUL-terminated array of + * chars. So, we have to implement STRING specially for STACK_OF. This is + * dealt with in the autogenerated macros below. + */ +DEFINE_SPECIAL_STACK_OF(OPENSSL_STRING, char) +DEFINE_SPECIAL_STACK_OF_CONST(OPENSSL_CSTRING, char) + +/* + * Similarly, we sometimes use a block of characters, NOT nul-terminated. + * These should also be distinguished from "normal" stacks. + */ +typedef void *OPENSSL_BLOCK; +DEFINE_SPECIAL_STACK_OF(OPENSSL_BLOCK, void) + +/* + * If called without higher optimization (min. -xO3) the Oracle Developer + * Studio compiler generates code for the defined (static inline) functions + * above. + * This would later lead to the linker complaining about missing symbols when + * this header file is included but the resulting object is not linked against + * the Crypto library (openssl#6912). + */ +# ifdef __SUNPRO_C +# pragma weak OPENSSL_sk_num +# pragma weak OPENSSL_sk_value +# pragma weak OPENSSL_sk_new +# pragma weak OPENSSL_sk_new_null +# pragma weak OPENSSL_sk_new_reserve +# pragma weak OPENSSL_sk_reserve +# pragma weak OPENSSL_sk_free +# pragma weak OPENSSL_sk_zero +# pragma weak OPENSSL_sk_delete +# pragma weak OPENSSL_sk_delete_ptr +# pragma weak OPENSSL_sk_push +# pragma weak OPENSSL_sk_unshift +# pragma weak OPENSSL_sk_pop +# pragma weak OPENSSL_sk_shift +# pragma weak OPENSSL_sk_pop_free +# pragma weak OPENSSL_sk_insert +# pragma weak OPENSSL_sk_set +# pragma weak OPENSSL_sk_find +# pragma weak OPENSSL_sk_find_ex +# pragma weak OPENSSL_sk_sort +# pragma weak OPENSSL_sk_is_sorted +# pragma weak OPENSSL_sk_dup +# pragma weak OPENSSL_sk_deep_copy +# pragma weak OPENSSL_sk_set_cmp_func +# endif /* __SUNPRO_C */ + +# ifdef __cplusplus +} +# endif +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/seed.h b/MediaClient/MediaClient/openssl/include/openssl/seed.h new file mode 100644 index 0000000..de10b08 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/seed.h @@ -0,0 +1,96 @@ +/* + * Copyright 2007-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +/* + * Copyright (c) 2007 KISA(Korea Information Security Agency). All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Neither the name of author nor the names of its contributors may + * be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef HEADER_SEED_H +# define HEADER_SEED_H + +# include + +# ifndef OPENSSL_NO_SEED +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + +/* look whether we need 'long' to get 32 bits */ +# ifdef AES_LONG +# ifndef SEED_LONG +# define SEED_LONG 1 +# endif +# endif + +# include + +# define SEED_BLOCK_SIZE 16 +# define SEED_KEY_LENGTH 16 + +typedef struct seed_key_st { +# ifdef SEED_LONG + unsigned long data[32]; +# else + unsigned int data[32]; +# endif +} SEED_KEY_SCHEDULE; + +void SEED_set_key(const unsigned char rawkey[SEED_KEY_LENGTH], + SEED_KEY_SCHEDULE *ks); + +void SEED_encrypt(const unsigned char s[SEED_BLOCK_SIZE], + unsigned char d[SEED_BLOCK_SIZE], + const SEED_KEY_SCHEDULE *ks); +void SEED_decrypt(const unsigned char s[SEED_BLOCK_SIZE], + unsigned char d[SEED_BLOCK_SIZE], + const SEED_KEY_SCHEDULE *ks); + +void SEED_ecb_encrypt(const unsigned char *in, unsigned char *out, + const SEED_KEY_SCHEDULE *ks, int enc); +void SEED_cbc_encrypt(const unsigned char *in, unsigned char *out, size_t len, + const SEED_KEY_SCHEDULE *ks, + unsigned char ivec[SEED_BLOCK_SIZE], int enc); +void SEED_cfb128_encrypt(const unsigned char *in, unsigned char *out, + size_t len, const SEED_KEY_SCHEDULE *ks, + unsigned char ivec[SEED_BLOCK_SIZE], int *num, + int enc); +void SEED_ofb128_encrypt(const unsigned char *in, unsigned char *out, + size_t len, const SEED_KEY_SCHEDULE *ks, + unsigned char ivec[SEED_BLOCK_SIZE], int *num); + +# ifdef __cplusplus +} +# endif +# endif + +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/sha.h b/MediaClient/MediaClient/openssl/include/openssl/sha.h new file mode 100644 index 0000000..6a1eb0d --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/sha.h @@ -0,0 +1,119 @@ +/* + * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_SHA_H +# define HEADER_SHA_H + +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + +/*- + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * ! SHA_LONG has to be at least 32 bits wide. ! + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + */ +# define SHA_LONG unsigned int + +# define SHA_LBLOCK 16 +# define SHA_CBLOCK (SHA_LBLOCK*4)/* SHA treats input data as a + * contiguous array of 32 bit wide + * big-endian values. */ +# define SHA_LAST_BLOCK (SHA_CBLOCK-8) +# define SHA_DIGEST_LENGTH 20 + +typedef struct SHAstate_st { + SHA_LONG h0, h1, h2, h3, h4; + SHA_LONG Nl, Nh; + SHA_LONG data[SHA_LBLOCK]; + unsigned int num; +} SHA_CTX; + +int SHA1_Init(SHA_CTX *c); +int SHA1_Update(SHA_CTX *c, const void *data, size_t len); +int SHA1_Final(unsigned char *md, SHA_CTX *c); +unsigned char *SHA1(const unsigned char *d, size_t n, unsigned char *md); +void SHA1_Transform(SHA_CTX *c, const unsigned char *data); + +# define SHA256_CBLOCK (SHA_LBLOCK*4)/* SHA-256 treats input data as a + * contiguous array of 32 bit wide + * big-endian values. */ + +typedef struct SHA256state_st { + SHA_LONG h[8]; + SHA_LONG Nl, Nh; + SHA_LONG data[SHA_LBLOCK]; + unsigned int num, md_len; +} SHA256_CTX; + +int SHA224_Init(SHA256_CTX *c); +int SHA224_Update(SHA256_CTX *c, const void *data, size_t len); +int SHA224_Final(unsigned char *md, SHA256_CTX *c); +unsigned char *SHA224(const unsigned char *d, size_t n, unsigned char *md); +int SHA256_Init(SHA256_CTX *c); +int SHA256_Update(SHA256_CTX *c, const void *data, size_t len); +int SHA256_Final(unsigned char *md, SHA256_CTX *c); +unsigned char *SHA256(const unsigned char *d, size_t n, unsigned char *md); +void SHA256_Transform(SHA256_CTX *c, const unsigned char *data); + +# define SHA224_DIGEST_LENGTH 28 +# define SHA256_DIGEST_LENGTH 32 +# define SHA384_DIGEST_LENGTH 48 +# define SHA512_DIGEST_LENGTH 64 + +/* + * Unlike 32-bit digest algorithms, SHA-512 *relies* on SHA_LONG64 + * being exactly 64-bit wide. See Implementation Notes in sha512.c + * for further details. + */ +/* + * SHA-512 treats input data as a + * contiguous array of 64 bit + * wide big-endian values. + */ +# define SHA512_CBLOCK (SHA_LBLOCK*8) +# if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32__) +# define SHA_LONG64 unsigned __int64 +# define U64(C) C##UI64 +# elif defined(__arch64__) +# define SHA_LONG64 unsigned long +# define U64(C) C##UL +# else +# define SHA_LONG64 unsigned long long +# define U64(C) C##ULL +# endif + +typedef struct SHA512state_st { + SHA_LONG64 h[8]; + SHA_LONG64 Nl, Nh; + union { + SHA_LONG64 d[SHA_LBLOCK]; + unsigned char p[SHA512_CBLOCK]; + } u; + unsigned int num, md_len; +} SHA512_CTX; + +int SHA384_Init(SHA512_CTX *c); +int SHA384_Update(SHA512_CTX *c, const void *data, size_t len); +int SHA384_Final(unsigned char *md, SHA512_CTX *c); +unsigned char *SHA384(const unsigned char *d, size_t n, unsigned char *md); +int SHA512_Init(SHA512_CTX *c); +int SHA512_Update(SHA512_CTX *c, const void *data, size_t len); +int SHA512_Final(unsigned char *md, SHA512_CTX *c); +unsigned char *SHA512(const unsigned char *d, size_t n, unsigned char *md); +void SHA512_Transform(SHA512_CTX *c, const unsigned char *data); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/srp.h b/MediaClient/MediaClient/openssl/include/openssl/srp.h new file mode 100644 index 0000000..aaf1355 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/srp.h @@ -0,0 +1,135 @@ +/* + * Copyright 2004-2018 The OpenSSL Project Authors. All Rights Reserved. + * Copyright (c) 2004, EdelKey Project. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + * + * Originally written by Christophe Renou and Peter Sylvester, + * for the EdelKey project. + */ + +#ifndef HEADER_SRP_H +# define HEADER_SRP_H + +#include + +#ifndef OPENSSL_NO_SRP +# include +# include +# include +# include +# include + +# ifdef __cplusplus +extern "C" { +# endif + +typedef struct SRP_gN_cache_st { + char *b64_bn; + BIGNUM *bn; +} SRP_gN_cache; + + +DEFINE_STACK_OF(SRP_gN_cache) + +typedef struct SRP_user_pwd_st { + /* Owned by us. */ + char *id; + BIGNUM *s; + BIGNUM *v; + /* Not owned by us. */ + const BIGNUM *g; + const BIGNUM *N; + /* Owned by us. */ + char *info; +} SRP_user_pwd; + +void SRP_user_pwd_free(SRP_user_pwd *user_pwd); + +DEFINE_STACK_OF(SRP_user_pwd) + +typedef struct SRP_VBASE_st { + STACK_OF(SRP_user_pwd) *users_pwd; + STACK_OF(SRP_gN_cache) *gN_cache; +/* to simulate a user */ + char *seed_key; + const BIGNUM *default_g; + const BIGNUM *default_N; +} SRP_VBASE; + +/* + * Internal structure storing N and g pair + */ +typedef struct SRP_gN_st { + char *id; + const BIGNUM *g; + const BIGNUM *N; +} SRP_gN; + +DEFINE_STACK_OF(SRP_gN) + +SRP_VBASE *SRP_VBASE_new(char *seed_key); +void SRP_VBASE_free(SRP_VBASE *vb); +int SRP_VBASE_init(SRP_VBASE *vb, char *verifier_file); + +/* This method ignores the configured seed and fails for an unknown user. */ +DEPRECATEDIN_1_1_0(SRP_user_pwd *SRP_VBASE_get_by_user(SRP_VBASE *vb, char *username)) +/* NOTE: unlike in SRP_VBASE_get_by_user, caller owns the returned pointer.*/ +SRP_user_pwd *SRP_VBASE_get1_by_user(SRP_VBASE *vb, char *username); + +char *SRP_create_verifier(const char *user, const char *pass, char **salt, + char **verifier, const char *N, const char *g); +int SRP_create_verifier_BN(const char *user, const char *pass, BIGNUM **salt, + BIGNUM **verifier, const BIGNUM *N, + const BIGNUM *g); + +# define SRP_NO_ERROR 0 +# define SRP_ERR_VBASE_INCOMPLETE_FILE 1 +# define SRP_ERR_VBASE_BN_LIB 2 +# define SRP_ERR_OPEN_FILE 3 +# define SRP_ERR_MEMORY 4 + +# define DB_srptype 0 +# define DB_srpverifier 1 +# define DB_srpsalt 2 +# define DB_srpid 3 +# define DB_srpgN 4 +# define DB_srpinfo 5 +# undef DB_NUMBER +# define DB_NUMBER 6 + +# define DB_SRP_INDEX 'I' +# define DB_SRP_VALID 'V' +# define DB_SRP_REVOKED 'R' +# define DB_SRP_MODIF 'v' + +/* see srp.c */ +char *SRP_check_known_gN_param(const BIGNUM *g, const BIGNUM *N); +SRP_gN *SRP_get_default_gN(const char *id); + +/* server side .... */ +BIGNUM *SRP_Calc_server_key(const BIGNUM *A, const BIGNUM *v, const BIGNUM *u, + const BIGNUM *b, const BIGNUM *N); +BIGNUM *SRP_Calc_B(const BIGNUM *b, const BIGNUM *N, const BIGNUM *g, + const BIGNUM *v); +int SRP_Verify_A_mod_N(const BIGNUM *A, const BIGNUM *N); +BIGNUM *SRP_Calc_u(const BIGNUM *A, const BIGNUM *B, const BIGNUM *N); + +/* client side .... */ +BIGNUM *SRP_Calc_x(const BIGNUM *s, const char *user, const char *pass); +BIGNUM *SRP_Calc_A(const BIGNUM *a, const BIGNUM *N, const BIGNUM *g); +BIGNUM *SRP_Calc_client_key(const BIGNUM *N, const BIGNUM *B, const BIGNUM *g, + const BIGNUM *x, const BIGNUM *a, const BIGNUM *u); +int SRP_Verify_B_mod_N(const BIGNUM *B, const BIGNUM *N); + +# define SRP_MINIMAL_N 1024 + +# ifdef __cplusplus +} +# endif +# endif + +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/srtp.h b/MediaClient/MediaClient/openssl/include/openssl/srtp.h new file mode 100644 index 0000000..0b57c23 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/srtp.h @@ -0,0 +1,50 @@ +/* + * Copyright 2011-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +/* + * DTLS code by Eric Rescorla + * + * Copyright (C) 2006, Network Resonance, Inc. Copyright (C) 2011, RTFM, Inc. + */ + +#ifndef HEADER_D1_SRTP_H +# define HEADER_D1_SRTP_H + +# include + +#ifdef __cplusplus +extern "C" { +#endif + +# define SRTP_AES128_CM_SHA1_80 0x0001 +# define SRTP_AES128_CM_SHA1_32 0x0002 +# define SRTP_AES128_F8_SHA1_80 0x0003 +# define SRTP_AES128_F8_SHA1_32 0x0004 +# define SRTP_NULL_SHA1_80 0x0005 +# define SRTP_NULL_SHA1_32 0x0006 + +/* AEAD SRTP protection profiles from RFC 7714 */ +# define SRTP_AEAD_AES_128_GCM 0x0007 +# define SRTP_AEAD_AES_256_GCM 0x0008 + +# ifndef OPENSSL_NO_SRTP + +__owur int SSL_CTX_set_tlsext_use_srtp(SSL_CTX *ctx, const char *profiles); +__owur int SSL_set_tlsext_use_srtp(SSL *ssl, const char *profiles); + +__owur STACK_OF(SRTP_PROTECTION_PROFILE) *SSL_get_srtp_profiles(SSL *ssl); +__owur SRTP_PROTECTION_PROFILE *SSL_get_selected_srtp_profile(SSL *s); + +# endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/ssl.h b/MediaClient/MediaClient/openssl/include/openssl/ssl.h new file mode 100644 index 0000000..6724ccf --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/ssl.h @@ -0,0 +1,2438 @@ +/* + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved + * Copyright 2005 Nokia. All rights reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_SSL_H +# define HEADER_SSL_H + +# include +# include +# include +# include +# if OPENSSL_API_COMPAT < 0x10100000L +# include +# include +# include +# endif +# include +# include +# include +# include + +# include +# include +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + +/* OpenSSL version number for ASN.1 encoding of the session information */ +/*- + * Version 0 - initial version + * Version 1 - added the optional peer certificate + */ +# define SSL_SESSION_ASN1_VERSION 0x0001 + +# define SSL_MAX_SSL_SESSION_ID_LENGTH 32 +# define SSL_MAX_SID_CTX_LENGTH 32 + +# define SSL_MIN_RSA_MODULUS_LENGTH_IN_BYTES (512/8) +# define SSL_MAX_KEY_ARG_LENGTH 8 +# define SSL_MAX_MASTER_KEY_LENGTH 48 + +/* The maximum number of encrypt/decrypt pipelines we can support */ +# define SSL_MAX_PIPELINES 32 + +/* text strings for the ciphers */ + +/* These are used to specify which ciphers to use and not to use */ + +# define SSL_TXT_LOW "LOW" +# define SSL_TXT_MEDIUM "MEDIUM" +# define SSL_TXT_HIGH "HIGH" +# define SSL_TXT_FIPS "FIPS" + +# define SSL_TXT_aNULL "aNULL" +# define SSL_TXT_eNULL "eNULL" +# define SSL_TXT_NULL "NULL" + +# define SSL_TXT_kRSA "kRSA" +# define SSL_TXT_kDHr "kDHr"/* this cipher class has been removed */ +# define SSL_TXT_kDHd "kDHd"/* this cipher class has been removed */ +# define SSL_TXT_kDH "kDH"/* this cipher class has been removed */ +# define SSL_TXT_kEDH "kEDH"/* alias for kDHE */ +# define SSL_TXT_kDHE "kDHE" +# define SSL_TXT_kECDHr "kECDHr"/* this cipher class has been removed */ +# define SSL_TXT_kECDHe "kECDHe"/* this cipher class has been removed */ +# define SSL_TXT_kECDH "kECDH"/* this cipher class has been removed */ +# define SSL_TXT_kEECDH "kEECDH"/* alias for kECDHE */ +# define SSL_TXT_kECDHE "kECDHE" +# define SSL_TXT_kPSK "kPSK" +# define SSL_TXT_kRSAPSK "kRSAPSK" +# define SSL_TXT_kECDHEPSK "kECDHEPSK" +# define SSL_TXT_kDHEPSK "kDHEPSK" +# define SSL_TXT_kGOST "kGOST" +# define SSL_TXT_kSRP "kSRP" + +# define SSL_TXT_aRSA "aRSA" +# define SSL_TXT_aDSS "aDSS" +# define SSL_TXT_aDH "aDH"/* this cipher class has been removed */ +# define SSL_TXT_aECDH "aECDH"/* this cipher class has been removed */ +# define SSL_TXT_aECDSA "aECDSA" +# define SSL_TXT_aPSK "aPSK" +# define SSL_TXT_aGOST94 "aGOST94" +# define SSL_TXT_aGOST01 "aGOST01" +# define SSL_TXT_aGOST12 "aGOST12" +# define SSL_TXT_aGOST "aGOST" +# define SSL_TXT_aSRP "aSRP" + +# define SSL_TXT_DSS "DSS" +# define SSL_TXT_DH "DH" +# define SSL_TXT_DHE "DHE"/* same as "kDHE:-ADH" */ +# define SSL_TXT_EDH "EDH"/* alias for DHE */ +# define SSL_TXT_ADH "ADH" +# define SSL_TXT_RSA "RSA" +# define SSL_TXT_ECDH "ECDH" +# define SSL_TXT_EECDH "EECDH"/* alias for ECDHE" */ +# define SSL_TXT_ECDHE "ECDHE"/* same as "kECDHE:-AECDH" */ +# define SSL_TXT_AECDH "AECDH" +# define SSL_TXT_ECDSA "ECDSA" +# define SSL_TXT_PSK "PSK" +# define SSL_TXT_SRP "SRP" + +# define SSL_TXT_DES "DES" +# define SSL_TXT_3DES "3DES" +# define SSL_TXT_RC4 "RC4" +# define SSL_TXT_RC2 "RC2" +# define SSL_TXT_IDEA "IDEA" +# define SSL_TXT_SEED "SEED" +# define SSL_TXT_AES128 "AES128" +# define SSL_TXT_AES256 "AES256" +# define SSL_TXT_AES "AES" +# define SSL_TXT_AES_GCM "AESGCM" +# define SSL_TXT_AES_CCM "AESCCM" +# define SSL_TXT_AES_CCM_8 "AESCCM8" +# define SSL_TXT_CAMELLIA128 "CAMELLIA128" +# define SSL_TXT_CAMELLIA256 "CAMELLIA256" +# define SSL_TXT_CAMELLIA "CAMELLIA" +# define SSL_TXT_CHACHA20 "CHACHA20" +# define SSL_TXT_GOST "GOST89" +# define SSL_TXT_ARIA "ARIA" +# define SSL_TXT_ARIA_GCM "ARIAGCM" +# define SSL_TXT_ARIA128 "ARIA128" +# define SSL_TXT_ARIA256 "ARIA256" + +# define SSL_TXT_MD5 "MD5" +# define SSL_TXT_SHA1 "SHA1" +# define SSL_TXT_SHA "SHA"/* same as "SHA1" */ +# define SSL_TXT_GOST94 "GOST94" +# define SSL_TXT_GOST89MAC "GOST89MAC" +# define SSL_TXT_GOST12 "GOST12" +# define SSL_TXT_GOST89MAC12 "GOST89MAC12" +# define SSL_TXT_SHA256 "SHA256" +# define SSL_TXT_SHA384 "SHA384" + +# define SSL_TXT_SSLV3 "SSLv3" +# define SSL_TXT_TLSV1 "TLSv1" +# define SSL_TXT_TLSV1_1 "TLSv1.1" +# define SSL_TXT_TLSV1_2 "TLSv1.2" + +# define SSL_TXT_ALL "ALL" + +/*- + * COMPLEMENTOF* definitions. These identifiers are used to (de-select) + * ciphers normally not being used. + * Example: "RC4" will activate all ciphers using RC4 including ciphers + * without authentication, which would normally disabled by DEFAULT (due + * the "!ADH" being part of default). Therefore "RC4:!COMPLEMENTOFDEFAULT" + * will make sure that it is also disabled in the specific selection. + * COMPLEMENTOF* identifiers are portable between version, as adjustments + * to the default cipher setup will also be included here. + * + * COMPLEMENTOFDEFAULT does not experience the same special treatment that + * DEFAULT gets, as only selection is being done and no sorting as needed + * for DEFAULT. + */ +# define SSL_TXT_CMPALL "COMPLEMENTOFALL" +# define SSL_TXT_CMPDEF "COMPLEMENTOFDEFAULT" + +/* + * The following cipher list is used by default. It also is substituted when + * an application-defined cipher list string starts with 'DEFAULT'. + * This applies to ciphersuites for TLSv1.2 and below. + */ +# define SSL_DEFAULT_CIPHER_LIST "ALL:!COMPLEMENTOFDEFAULT:!eNULL" +/* This is the default set of TLSv1.3 ciphersuites */ +# if !defined(OPENSSL_NO_CHACHA) && !defined(OPENSSL_NO_POLY1305) +# define TLS_DEFAULT_CIPHERSUITES "TLS_AES_256_GCM_SHA384:" \ + "TLS_CHACHA20_POLY1305_SHA256:" \ + "TLS_AES_128_GCM_SHA256" +# else +# define TLS_DEFAULT_CIPHERSUITES "TLS_AES_256_GCM_SHA384:" \ + "TLS_AES_128_GCM_SHA256" +#endif +/* + * As of OpenSSL 1.0.0, ssl_create_cipher_list() in ssl/ssl_ciph.c always + * starts with a reasonable order, and all we have to do for DEFAULT is + * throwing out anonymous and unencrypted ciphersuites! (The latter are not + * actually enabled by ALL, but "ALL:RSA" would enable some of them.) + */ + +/* Used in SSL_set_shutdown()/SSL_get_shutdown(); */ +# define SSL_SENT_SHUTDOWN 1 +# define SSL_RECEIVED_SHUTDOWN 2 + +#ifdef __cplusplus +} +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +# define SSL_FILETYPE_ASN1 X509_FILETYPE_ASN1 +# define SSL_FILETYPE_PEM X509_FILETYPE_PEM + +/* + * This is needed to stop compilers complaining about the 'struct ssl_st *' + * function parameters used to prototype callbacks in SSL_CTX. + */ +typedef struct ssl_st *ssl_crock_st; +typedef struct tls_session_ticket_ext_st TLS_SESSION_TICKET_EXT; +typedef struct ssl_method_st SSL_METHOD; +typedef struct ssl_cipher_st SSL_CIPHER; +typedef struct ssl_session_st SSL_SESSION; +typedef struct tls_sigalgs_st TLS_SIGALGS; +typedef struct ssl_conf_ctx_st SSL_CONF_CTX; +typedef struct ssl_comp_st SSL_COMP; + +STACK_OF(SSL_CIPHER); +STACK_OF(SSL_COMP); + +/* SRTP protection profiles for use with the use_srtp extension (RFC 5764)*/ +typedef struct srtp_protection_profile_st { + const char *name; + unsigned long id; +} SRTP_PROTECTION_PROFILE; + +DEFINE_STACK_OF(SRTP_PROTECTION_PROFILE) + +typedef int (*tls_session_ticket_ext_cb_fn)(SSL *s, const unsigned char *data, + int len, void *arg); +typedef int (*tls_session_secret_cb_fn)(SSL *s, void *secret, int *secret_len, + STACK_OF(SSL_CIPHER) *peer_ciphers, + const SSL_CIPHER **cipher, void *arg); + +/* Extension context codes */ +/* This extension is only allowed in TLS */ +#define SSL_EXT_TLS_ONLY 0x0001 +/* This extension is only allowed in DTLS */ +#define SSL_EXT_DTLS_ONLY 0x0002 +/* Some extensions may be allowed in DTLS but we don't implement them for it */ +#define SSL_EXT_TLS_IMPLEMENTATION_ONLY 0x0004 +/* Most extensions are not defined for SSLv3 but EXT_TYPE_renegotiate is */ +#define SSL_EXT_SSL3_ALLOWED 0x0008 +/* Extension is only defined for TLS1.2 and below */ +#define SSL_EXT_TLS1_2_AND_BELOW_ONLY 0x0010 +/* Extension is only defined for TLS1.3 and above */ +#define SSL_EXT_TLS1_3_ONLY 0x0020 +/* Ignore this extension during parsing if we are resuming */ +#define SSL_EXT_IGNORE_ON_RESUMPTION 0x0040 +#define SSL_EXT_CLIENT_HELLO 0x0080 +/* Really means TLS1.2 or below */ +#define SSL_EXT_TLS1_2_SERVER_HELLO 0x0100 +#define SSL_EXT_TLS1_3_SERVER_HELLO 0x0200 +#define SSL_EXT_TLS1_3_ENCRYPTED_EXTENSIONS 0x0400 +#define SSL_EXT_TLS1_3_HELLO_RETRY_REQUEST 0x0800 +#define SSL_EXT_TLS1_3_CERTIFICATE 0x1000 +#define SSL_EXT_TLS1_3_NEW_SESSION_TICKET 0x2000 +#define SSL_EXT_TLS1_3_CERTIFICATE_REQUEST 0x4000 + +/* Typedefs for handling custom extensions */ + +typedef int (*custom_ext_add_cb)(SSL *s, unsigned int ext_type, + const unsigned char **out, size_t *outlen, + int *al, void *add_arg); + +typedef void (*custom_ext_free_cb)(SSL *s, unsigned int ext_type, + const unsigned char *out, void *add_arg); + +typedef int (*custom_ext_parse_cb)(SSL *s, unsigned int ext_type, + const unsigned char *in, size_t inlen, + int *al, void *parse_arg); + + +typedef int (*SSL_custom_ext_add_cb_ex)(SSL *s, unsigned int ext_type, + unsigned int context, + const unsigned char **out, + size_t *outlen, X509 *x, + size_t chainidx, + int *al, void *add_arg); + +typedef void (*SSL_custom_ext_free_cb_ex)(SSL *s, unsigned int ext_type, + unsigned int context, + const unsigned char *out, + void *add_arg); + +typedef int (*SSL_custom_ext_parse_cb_ex)(SSL *s, unsigned int ext_type, + unsigned int context, + const unsigned char *in, + size_t inlen, X509 *x, + size_t chainidx, + int *al, void *parse_arg); + +/* Typedef for verification callback */ +typedef int (*SSL_verify_cb)(int preverify_ok, X509_STORE_CTX *x509_ctx); + +/* + * Some values are reserved until OpenSSL 1.2.0 because they were previously + * included in SSL_OP_ALL in a 1.1.x release. + * + * Reserved value (until OpenSSL 1.2.0) 0x00000001U + * Reserved value (until OpenSSL 1.2.0) 0x00000002U + */ +/* Allow initial connection to servers that don't support RI */ +# define SSL_OP_LEGACY_SERVER_CONNECT 0x00000004U + +/* Reserved value (until OpenSSL 1.2.0) 0x00000008U */ +# define SSL_OP_TLSEXT_PADDING 0x00000010U +/* Reserved value (until OpenSSL 1.2.0) 0x00000020U */ +# define SSL_OP_SAFARI_ECDHE_ECDSA_BUG 0x00000040U +/* + * Reserved value (until OpenSSL 1.2.0) 0x00000080U + * Reserved value (until OpenSSL 1.2.0) 0x00000100U + * Reserved value (until OpenSSL 1.2.0) 0x00000200U + */ + +/* In TLSv1.3 allow a non-(ec)dhe based kex_mode */ +# define SSL_OP_ALLOW_NO_DHE_KEX 0x00000400U + +/* + * Disable SSL 3.0/TLS 1.0 CBC vulnerability workaround that was added in + * OpenSSL 0.9.6d. Usually (depending on the application protocol) the + * workaround is not needed. Unfortunately some broken SSL/TLS + * implementations cannot handle it at all, which is why we include it in + * SSL_OP_ALL. Added in 0.9.6e + */ +# define SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS 0x00000800U + +/* DTLS options */ +# define SSL_OP_NO_QUERY_MTU 0x00001000U +/* Turn on Cookie Exchange (on relevant for servers) */ +# define SSL_OP_COOKIE_EXCHANGE 0x00002000U +/* Don't use RFC4507 ticket extension */ +# define SSL_OP_NO_TICKET 0x00004000U +# ifndef OPENSSL_NO_DTLS1_METHOD +/* Use Cisco's "speshul" version of DTLS_BAD_VER + * (only with deprecated DTLSv1_client_method()) */ +# define SSL_OP_CISCO_ANYCONNECT 0x00008000U +# endif + +/* As server, disallow session resumption on renegotiation */ +# define SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION 0x00010000U +/* Don't use compression even if supported */ +# define SSL_OP_NO_COMPRESSION 0x00020000U +/* Permit unsafe legacy renegotiation */ +# define SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION 0x00040000U +/* Disable encrypt-then-mac */ +# define SSL_OP_NO_ENCRYPT_THEN_MAC 0x00080000U + +/* + * Enable TLSv1.3 Compatibility mode. This is on by default. A future version + * of OpenSSL may have this disabled by default. + */ +# define SSL_OP_ENABLE_MIDDLEBOX_COMPAT 0x00100000U + +/* Prioritize Chacha20Poly1305 when client does. + * Modifies SSL_OP_CIPHER_SERVER_PREFERENCE */ +# define SSL_OP_PRIORITIZE_CHACHA 0x00200000U + +/* + * Set on servers to choose the cipher according to the server's preferences + */ +# define SSL_OP_CIPHER_SERVER_PREFERENCE 0x00400000U +/* + * If set, a server will allow a client to issue a SSLv3.0 version number as + * latest version supported in the premaster secret, even when TLSv1.0 + * (version 3.1) was announced in the client hello. Normally this is + * forbidden to prevent version rollback attacks. + */ +# define SSL_OP_TLS_ROLLBACK_BUG 0x00800000U + +/* + * Switches off automatic TLSv1.3 anti-replay protection for early data. This + * is a server-side option only (no effect on the client). + */ +# define SSL_OP_NO_ANTI_REPLAY 0x01000000U + +# define SSL_OP_NO_SSLv3 0x02000000U +# define SSL_OP_NO_TLSv1 0x04000000U +# define SSL_OP_NO_TLSv1_2 0x08000000U +# define SSL_OP_NO_TLSv1_1 0x10000000U +# define SSL_OP_NO_TLSv1_3 0x20000000U + +# define SSL_OP_NO_DTLSv1 0x04000000U +# define SSL_OP_NO_DTLSv1_2 0x08000000U + +# define SSL_OP_NO_SSL_MASK (SSL_OP_NO_SSLv3|\ + SSL_OP_NO_TLSv1|SSL_OP_NO_TLSv1_1|SSL_OP_NO_TLSv1_2|SSL_OP_NO_TLSv1_3) +# define SSL_OP_NO_DTLS_MASK (SSL_OP_NO_DTLSv1|SSL_OP_NO_DTLSv1_2) + +/* Disallow all renegotiation */ +# define SSL_OP_NO_RENEGOTIATION 0x40000000U + +/* + * Make server add server-hello extension from early version of cryptopro + * draft, when GOST ciphersuite is negotiated. Required for interoperability + * with CryptoPro CSP 3.x + */ +# define SSL_OP_CRYPTOPRO_TLSEXT_BUG 0x80000000U + +/* + * SSL_OP_ALL: various bug workarounds that should be rather harmless. + * This used to be 0x000FFFFFL before 0.9.7. + * This used to be 0x80000BFFU before 1.1.1. + */ +# define SSL_OP_ALL (SSL_OP_CRYPTOPRO_TLSEXT_BUG|\ + SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS|\ + SSL_OP_LEGACY_SERVER_CONNECT|\ + SSL_OP_TLSEXT_PADDING|\ + SSL_OP_SAFARI_ECDHE_ECDSA_BUG) + +/* OBSOLETE OPTIONS: retained for compatibility */ + +/* Removed from OpenSSL 1.1.0. Was 0x00000001L */ +/* Related to removed SSLv2. */ +# define SSL_OP_MICROSOFT_SESS_ID_BUG 0x0 +/* Removed from OpenSSL 1.1.0. Was 0x00000002L */ +/* Related to removed SSLv2. */ +# define SSL_OP_NETSCAPE_CHALLENGE_BUG 0x0 +/* Removed from OpenSSL 0.9.8q and 1.0.0c. Was 0x00000008L */ +/* Dead forever, see CVE-2010-4180 */ +# define SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG 0x0 +/* Removed from OpenSSL 1.0.1h and 1.0.2. Was 0x00000010L */ +/* Refers to ancient SSLREF and SSLv2. */ +# define SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG 0x0 +/* Removed from OpenSSL 1.1.0. Was 0x00000020 */ +# define SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER 0x0 +/* Removed from OpenSSL 0.9.7h and 0.9.8b. Was 0x00000040L */ +# define SSL_OP_MSIE_SSLV2_RSA_PADDING 0x0 +/* Removed from OpenSSL 1.1.0. Was 0x00000080 */ +/* Ancient SSLeay version. */ +# define SSL_OP_SSLEAY_080_CLIENT_DH_BUG 0x0 +/* Removed from OpenSSL 1.1.0. Was 0x00000100L */ +# define SSL_OP_TLS_D5_BUG 0x0 +/* Removed from OpenSSL 1.1.0. Was 0x00000200L */ +# define SSL_OP_TLS_BLOCK_PADDING_BUG 0x0 +/* Removed from OpenSSL 1.1.0. Was 0x00080000L */ +# define SSL_OP_SINGLE_ECDH_USE 0x0 +/* Removed from OpenSSL 1.1.0. Was 0x00100000L */ +# define SSL_OP_SINGLE_DH_USE 0x0 +/* Removed from OpenSSL 1.0.1k and 1.0.2. Was 0x00200000L */ +# define SSL_OP_EPHEMERAL_RSA 0x0 +/* Removed from OpenSSL 1.1.0. Was 0x01000000L */ +# define SSL_OP_NO_SSLv2 0x0 +/* Removed from OpenSSL 1.0.1. Was 0x08000000L */ +# define SSL_OP_PKCS1_CHECK_1 0x0 +/* Removed from OpenSSL 1.0.1. Was 0x10000000L */ +# define SSL_OP_PKCS1_CHECK_2 0x0 +/* Removed from OpenSSL 1.1.0. Was 0x20000000L */ +# define SSL_OP_NETSCAPE_CA_DN_BUG 0x0 +/* Removed from OpenSSL 1.1.0. Was 0x40000000L */ +# define SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG 0x0 + +/* + * Allow SSL_write(..., n) to return r with 0 < r < n (i.e. report success + * when just a single record has been written): + */ +# define SSL_MODE_ENABLE_PARTIAL_WRITE 0x00000001U +/* + * Make it possible to retry SSL_write() with changed buffer location (buffer + * contents must stay the same!); this is not the default to avoid the + * misconception that non-blocking SSL_write() behaves like non-blocking + * write(): + */ +# define SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER 0x00000002U +/* + * Never bother the application with retries if the transport is blocking: + */ +# define SSL_MODE_AUTO_RETRY 0x00000004U +/* Don't attempt to automatically build certificate chain */ +# define SSL_MODE_NO_AUTO_CHAIN 0x00000008U +/* + * Save RAM by releasing read and write buffers when they're empty. (SSL3 and + * TLS only.) Released buffers are freed. + */ +# define SSL_MODE_RELEASE_BUFFERS 0x00000010U +/* + * Send the current time in the Random fields of the ClientHello and + * ServerHello records for compatibility with hypothetical implementations + * that require it. + */ +# define SSL_MODE_SEND_CLIENTHELLO_TIME 0x00000020U +# define SSL_MODE_SEND_SERVERHELLO_TIME 0x00000040U +/* + * Send TLS_FALLBACK_SCSV in the ClientHello. To be set only by applications + * that reconnect with a downgraded protocol version; see + * draft-ietf-tls-downgrade-scsv-00 for details. DO NOT ENABLE THIS if your + * application attempts a normal handshake. Only use this in explicit + * fallback retries, following the guidance in + * draft-ietf-tls-downgrade-scsv-00. + */ +# define SSL_MODE_SEND_FALLBACK_SCSV 0x00000080U +/* + * Support Asynchronous operation + */ +# define SSL_MODE_ASYNC 0x00000100U + +/* + * When using DTLS/SCTP, include the terminating zero in the label + * used for computing the endpoint-pair shared secret. Required for + * interoperability with implementations having this bug like these + * older version of OpenSSL: + * - OpenSSL 1.0.0 series + * - OpenSSL 1.0.1 series + * - OpenSSL 1.0.2 series + * - OpenSSL 1.1.0 series + * - OpenSSL 1.1.1 and 1.1.1a + */ +# define SSL_MODE_DTLS_SCTP_LABEL_LENGTH_BUG 0x00000400U + +/* Cert related flags */ +/* + * Many implementations ignore some aspects of the TLS standards such as + * enforcing certificate chain algorithms. When this is set we enforce them. + */ +# define SSL_CERT_FLAG_TLS_STRICT 0x00000001U + +/* Suite B modes, takes same values as certificate verify flags */ +# define SSL_CERT_FLAG_SUITEB_128_LOS_ONLY 0x10000 +/* Suite B 192 bit only mode */ +# define SSL_CERT_FLAG_SUITEB_192_LOS 0x20000 +/* Suite B 128 bit mode allowing 192 bit algorithms */ +# define SSL_CERT_FLAG_SUITEB_128_LOS 0x30000 + +/* Perform all sorts of protocol violations for testing purposes */ +# define SSL_CERT_FLAG_BROKEN_PROTOCOL 0x10000000 + +/* Flags for building certificate chains */ +/* Treat any existing certificates as untrusted CAs */ +# define SSL_BUILD_CHAIN_FLAG_UNTRUSTED 0x1 +/* Don't include root CA in chain */ +# define SSL_BUILD_CHAIN_FLAG_NO_ROOT 0x2 +/* Just check certificates already there */ +# define SSL_BUILD_CHAIN_FLAG_CHECK 0x4 +/* Ignore verification errors */ +# define SSL_BUILD_CHAIN_FLAG_IGNORE_ERROR 0x8 +/* Clear verification errors from queue */ +# define SSL_BUILD_CHAIN_FLAG_CLEAR_ERROR 0x10 + +/* Flags returned by SSL_check_chain */ +/* Certificate can be used with this session */ +# define CERT_PKEY_VALID 0x1 +/* Certificate can also be used for signing */ +# define CERT_PKEY_SIGN 0x2 +/* EE certificate signing algorithm OK */ +# define CERT_PKEY_EE_SIGNATURE 0x10 +/* CA signature algorithms OK */ +# define CERT_PKEY_CA_SIGNATURE 0x20 +/* EE certificate parameters OK */ +# define CERT_PKEY_EE_PARAM 0x40 +/* CA certificate parameters OK */ +# define CERT_PKEY_CA_PARAM 0x80 +/* Signing explicitly allowed as opposed to SHA1 fallback */ +# define CERT_PKEY_EXPLICIT_SIGN 0x100 +/* Client CA issuer names match (always set for server cert) */ +# define CERT_PKEY_ISSUER_NAME 0x200 +/* Cert type matches client types (always set for server cert) */ +# define CERT_PKEY_CERT_TYPE 0x400 +/* Cert chain suitable to Suite B */ +# define CERT_PKEY_SUITEB 0x800 + +# define SSL_CONF_FLAG_CMDLINE 0x1 +# define SSL_CONF_FLAG_FILE 0x2 +# define SSL_CONF_FLAG_CLIENT 0x4 +# define SSL_CONF_FLAG_SERVER 0x8 +# define SSL_CONF_FLAG_SHOW_ERRORS 0x10 +# define SSL_CONF_FLAG_CERTIFICATE 0x20 +# define SSL_CONF_FLAG_REQUIRE_PRIVATE 0x40 +/* Configuration value types */ +# define SSL_CONF_TYPE_UNKNOWN 0x0 +# define SSL_CONF_TYPE_STRING 0x1 +# define SSL_CONF_TYPE_FILE 0x2 +# define SSL_CONF_TYPE_DIR 0x3 +# define SSL_CONF_TYPE_NONE 0x4 + +/* Maximum length of the application-controlled segment of a a TLSv1.3 cookie */ +# define SSL_COOKIE_LENGTH 4096 + +/* + * Note: SSL[_CTX]_set_{options,mode} use |= op on the previous value, they + * cannot be used to clear bits. + */ + +unsigned long SSL_CTX_get_options(const SSL_CTX *ctx); +unsigned long SSL_get_options(const SSL *s); +unsigned long SSL_CTX_clear_options(SSL_CTX *ctx, unsigned long op); +unsigned long SSL_clear_options(SSL *s, unsigned long op); +unsigned long SSL_CTX_set_options(SSL_CTX *ctx, unsigned long op); +unsigned long SSL_set_options(SSL *s, unsigned long op); + +# define SSL_CTX_set_mode(ctx,op) \ + SSL_CTX_ctrl((ctx),SSL_CTRL_MODE,(op),NULL) +# define SSL_CTX_clear_mode(ctx,op) \ + SSL_CTX_ctrl((ctx),SSL_CTRL_CLEAR_MODE,(op),NULL) +# define SSL_CTX_get_mode(ctx) \ + SSL_CTX_ctrl((ctx),SSL_CTRL_MODE,0,NULL) +# define SSL_clear_mode(ssl,op) \ + SSL_ctrl((ssl),SSL_CTRL_CLEAR_MODE,(op),NULL) +# define SSL_set_mode(ssl,op) \ + SSL_ctrl((ssl),SSL_CTRL_MODE,(op),NULL) +# define SSL_get_mode(ssl) \ + SSL_ctrl((ssl),SSL_CTRL_MODE,0,NULL) +# define SSL_set_mtu(ssl, mtu) \ + SSL_ctrl((ssl),SSL_CTRL_SET_MTU,(mtu),NULL) +# define DTLS_set_link_mtu(ssl, mtu) \ + SSL_ctrl((ssl),DTLS_CTRL_SET_LINK_MTU,(mtu),NULL) +# define DTLS_get_link_min_mtu(ssl) \ + SSL_ctrl((ssl),DTLS_CTRL_GET_LINK_MIN_MTU,0,NULL) + +# define SSL_get_secure_renegotiation_support(ssl) \ + SSL_ctrl((ssl), SSL_CTRL_GET_RI_SUPPORT, 0, NULL) + +# ifndef OPENSSL_NO_HEARTBEATS +# define SSL_heartbeat(ssl) \ + SSL_ctrl((ssl),SSL_CTRL_DTLS_EXT_SEND_HEARTBEAT,0,NULL) +# endif + +# define SSL_CTX_set_cert_flags(ctx,op) \ + SSL_CTX_ctrl((ctx),SSL_CTRL_CERT_FLAGS,(op),NULL) +# define SSL_set_cert_flags(s,op) \ + SSL_ctrl((s),SSL_CTRL_CERT_FLAGS,(op),NULL) +# define SSL_CTX_clear_cert_flags(ctx,op) \ + SSL_CTX_ctrl((ctx),SSL_CTRL_CLEAR_CERT_FLAGS,(op),NULL) +# define SSL_clear_cert_flags(s,op) \ + SSL_ctrl((s),SSL_CTRL_CLEAR_CERT_FLAGS,(op),NULL) + +void SSL_CTX_set_msg_callback(SSL_CTX *ctx, + void (*cb) (int write_p, int version, + int content_type, const void *buf, + size_t len, SSL *ssl, void *arg)); +void SSL_set_msg_callback(SSL *ssl, + void (*cb) (int write_p, int version, + int content_type, const void *buf, + size_t len, SSL *ssl, void *arg)); +# define SSL_CTX_set_msg_callback_arg(ctx, arg) SSL_CTX_ctrl((ctx), SSL_CTRL_SET_MSG_CALLBACK_ARG, 0, (arg)) +# define SSL_set_msg_callback_arg(ssl, arg) SSL_ctrl((ssl), SSL_CTRL_SET_MSG_CALLBACK_ARG, 0, (arg)) + +# define SSL_get_extms_support(s) \ + SSL_ctrl((s),SSL_CTRL_GET_EXTMS_SUPPORT,0,NULL) + +# ifndef OPENSSL_NO_SRP + +/* see tls_srp.c */ +__owur int SSL_SRP_CTX_init(SSL *s); +__owur int SSL_CTX_SRP_CTX_init(SSL_CTX *ctx); +int SSL_SRP_CTX_free(SSL *ctx); +int SSL_CTX_SRP_CTX_free(SSL_CTX *ctx); +__owur int SSL_srp_server_param_with_username(SSL *s, int *ad); +__owur int SRP_Calc_A_param(SSL *s); + +# endif + +/* 100k max cert list */ +# define SSL_MAX_CERT_LIST_DEFAULT 1024*100 + +# define SSL_SESSION_CACHE_MAX_SIZE_DEFAULT (1024*20) + +/* + * This callback type is used inside SSL_CTX, SSL, and in the functions that + * set them. It is used to override the generation of SSL/TLS session IDs in + * a server. Return value should be zero on an error, non-zero to proceed. + * Also, callbacks should themselves check if the id they generate is unique + * otherwise the SSL handshake will fail with an error - callbacks can do + * this using the 'ssl' value they're passed by; + * SSL_has_matching_session_id(ssl, id, *id_len) The length value passed in + * is set at the maximum size the session ID can be. In SSLv3/TLSv1 it is 32 + * bytes. The callback can alter this length to be less if desired. It is + * also an error for the callback to set the size to zero. + */ +typedef int (*GEN_SESSION_CB) (SSL *ssl, unsigned char *id, + unsigned int *id_len); + +# define SSL_SESS_CACHE_OFF 0x0000 +# define SSL_SESS_CACHE_CLIENT 0x0001 +# define SSL_SESS_CACHE_SERVER 0x0002 +# define SSL_SESS_CACHE_BOTH (SSL_SESS_CACHE_CLIENT|SSL_SESS_CACHE_SERVER) +# define SSL_SESS_CACHE_NO_AUTO_CLEAR 0x0080 +/* enough comments already ... see SSL_CTX_set_session_cache_mode(3) */ +# define SSL_SESS_CACHE_NO_INTERNAL_LOOKUP 0x0100 +# define SSL_SESS_CACHE_NO_INTERNAL_STORE 0x0200 +# define SSL_SESS_CACHE_NO_INTERNAL \ + (SSL_SESS_CACHE_NO_INTERNAL_LOOKUP|SSL_SESS_CACHE_NO_INTERNAL_STORE) + +LHASH_OF(SSL_SESSION) *SSL_CTX_sessions(SSL_CTX *ctx); +# define SSL_CTX_sess_number(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_NUMBER,0,NULL) +# define SSL_CTX_sess_connect(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CONNECT,0,NULL) +# define SSL_CTX_sess_connect_good(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CONNECT_GOOD,0,NULL) +# define SSL_CTX_sess_connect_renegotiate(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CONNECT_RENEGOTIATE,0,NULL) +# define SSL_CTX_sess_accept(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_ACCEPT,0,NULL) +# define SSL_CTX_sess_accept_renegotiate(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_ACCEPT_RENEGOTIATE,0,NULL) +# define SSL_CTX_sess_accept_good(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_ACCEPT_GOOD,0,NULL) +# define SSL_CTX_sess_hits(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_HIT,0,NULL) +# define SSL_CTX_sess_cb_hits(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CB_HIT,0,NULL) +# define SSL_CTX_sess_misses(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_MISSES,0,NULL) +# define SSL_CTX_sess_timeouts(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_TIMEOUTS,0,NULL) +# define SSL_CTX_sess_cache_full(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CACHE_FULL,0,NULL) + +void SSL_CTX_sess_set_new_cb(SSL_CTX *ctx, + int (*new_session_cb) (struct ssl_st *ssl, + SSL_SESSION *sess)); +int (*SSL_CTX_sess_get_new_cb(SSL_CTX *ctx)) (struct ssl_st *ssl, + SSL_SESSION *sess); +void SSL_CTX_sess_set_remove_cb(SSL_CTX *ctx, + void (*remove_session_cb) (struct ssl_ctx_st + *ctx, + SSL_SESSION *sess)); +void (*SSL_CTX_sess_get_remove_cb(SSL_CTX *ctx)) (struct ssl_ctx_st *ctx, + SSL_SESSION *sess); +void SSL_CTX_sess_set_get_cb(SSL_CTX *ctx, + SSL_SESSION *(*get_session_cb) (struct ssl_st + *ssl, + const unsigned char + *data, int len, + int *copy)); +SSL_SESSION *(*SSL_CTX_sess_get_get_cb(SSL_CTX *ctx)) (struct ssl_st *ssl, + const unsigned char *data, + int len, int *copy); +void SSL_CTX_set_info_callback(SSL_CTX *ctx, + void (*cb) (const SSL *ssl, int type, int val)); +void (*SSL_CTX_get_info_callback(SSL_CTX *ctx)) (const SSL *ssl, int type, + int val); +void SSL_CTX_set_client_cert_cb(SSL_CTX *ctx, + int (*client_cert_cb) (SSL *ssl, X509 **x509, + EVP_PKEY **pkey)); +int (*SSL_CTX_get_client_cert_cb(SSL_CTX *ctx)) (SSL *ssl, X509 **x509, + EVP_PKEY **pkey); +# ifndef OPENSSL_NO_ENGINE +__owur int SSL_CTX_set_client_cert_engine(SSL_CTX *ctx, ENGINE *e); +# endif +void SSL_CTX_set_cookie_generate_cb(SSL_CTX *ctx, + int (*app_gen_cookie_cb) (SSL *ssl, + unsigned char + *cookie, + unsigned int + *cookie_len)); +void SSL_CTX_set_cookie_verify_cb(SSL_CTX *ctx, + int (*app_verify_cookie_cb) (SSL *ssl, + const unsigned + char *cookie, + unsigned int + cookie_len)); + +void SSL_CTX_set_stateless_cookie_generate_cb( + SSL_CTX *ctx, + int (*gen_stateless_cookie_cb) (SSL *ssl, + unsigned char *cookie, + size_t *cookie_len)); +void SSL_CTX_set_stateless_cookie_verify_cb( + SSL_CTX *ctx, + int (*verify_stateless_cookie_cb) (SSL *ssl, + const unsigned char *cookie, + size_t cookie_len)); +# ifndef OPENSSL_NO_NEXTPROTONEG + +typedef int (*SSL_CTX_npn_advertised_cb_func)(SSL *ssl, + const unsigned char **out, + unsigned int *outlen, + void *arg); +void SSL_CTX_set_next_protos_advertised_cb(SSL_CTX *s, + SSL_CTX_npn_advertised_cb_func cb, + void *arg); +# define SSL_CTX_set_npn_advertised_cb SSL_CTX_set_next_protos_advertised_cb + +typedef int (*SSL_CTX_npn_select_cb_func)(SSL *s, + unsigned char **out, + unsigned char *outlen, + const unsigned char *in, + unsigned int inlen, + void *arg); +void SSL_CTX_set_next_proto_select_cb(SSL_CTX *s, + SSL_CTX_npn_select_cb_func cb, + void *arg); +# define SSL_CTX_set_npn_select_cb SSL_CTX_set_next_proto_select_cb + +void SSL_get0_next_proto_negotiated(const SSL *s, const unsigned char **data, + unsigned *len); +# define SSL_get0_npn_negotiated SSL_get0_next_proto_negotiated +# endif + +__owur int SSL_select_next_proto(unsigned char **out, unsigned char *outlen, + const unsigned char *in, unsigned int inlen, + const unsigned char *client, + unsigned int client_len); + +# define OPENSSL_NPN_UNSUPPORTED 0 +# define OPENSSL_NPN_NEGOTIATED 1 +# define OPENSSL_NPN_NO_OVERLAP 2 + +__owur int SSL_CTX_set_alpn_protos(SSL_CTX *ctx, const unsigned char *protos, + unsigned int protos_len); +__owur int SSL_set_alpn_protos(SSL *ssl, const unsigned char *protos, + unsigned int protos_len); +typedef int (*SSL_CTX_alpn_select_cb_func)(SSL *ssl, + const unsigned char **out, + unsigned char *outlen, + const unsigned char *in, + unsigned int inlen, + void *arg); +void SSL_CTX_set_alpn_select_cb(SSL_CTX *ctx, + SSL_CTX_alpn_select_cb_func cb, + void *arg); +void SSL_get0_alpn_selected(const SSL *ssl, const unsigned char **data, + unsigned int *len); + +# ifndef OPENSSL_NO_PSK +/* + * the maximum length of the buffer given to callbacks containing the + * resulting identity/psk + */ +# define PSK_MAX_IDENTITY_LEN 128 +# define PSK_MAX_PSK_LEN 256 +typedef unsigned int (*SSL_psk_client_cb_func)(SSL *ssl, + const char *hint, + char *identity, + unsigned int max_identity_len, + unsigned char *psk, + unsigned int max_psk_len); +void SSL_CTX_set_psk_client_callback(SSL_CTX *ctx, SSL_psk_client_cb_func cb); +void SSL_set_psk_client_callback(SSL *ssl, SSL_psk_client_cb_func cb); + +typedef unsigned int (*SSL_psk_server_cb_func)(SSL *ssl, + const char *identity, + unsigned char *psk, + unsigned int max_psk_len); +void SSL_CTX_set_psk_server_callback(SSL_CTX *ctx, SSL_psk_server_cb_func cb); +void SSL_set_psk_server_callback(SSL *ssl, SSL_psk_server_cb_func cb); + +__owur int SSL_CTX_use_psk_identity_hint(SSL_CTX *ctx, const char *identity_hint); +__owur int SSL_use_psk_identity_hint(SSL *s, const char *identity_hint); +const char *SSL_get_psk_identity_hint(const SSL *s); +const char *SSL_get_psk_identity(const SSL *s); +# endif + +typedef int (*SSL_psk_find_session_cb_func)(SSL *ssl, + const unsigned char *identity, + size_t identity_len, + SSL_SESSION **sess); +typedef int (*SSL_psk_use_session_cb_func)(SSL *ssl, const EVP_MD *md, + const unsigned char **id, + size_t *idlen, + SSL_SESSION **sess); + +void SSL_set_psk_find_session_callback(SSL *s, SSL_psk_find_session_cb_func cb); +void SSL_CTX_set_psk_find_session_callback(SSL_CTX *ctx, + SSL_psk_find_session_cb_func cb); +void SSL_set_psk_use_session_callback(SSL *s, SSL_psk_use_session_cb_func cb); +void SSL_CTX_set_psk_use_session_callback(SSL_CTX *ctx, + SSL_psk_use_session_cb_func cb); + +/* Register callbacks to handle custom TLS Extensions for client or server. */ + +__owur int SSL_CTX_has_client_custom_ext(const SSL_CTX *ctx, + unsigned int ext_type); + +__owur int SSL_CTX_add_client_custom_ext(SSL_CTX *ctx, + unsigned int ext_type, + custom_ext_add_cb add_cb, + custom_ext_free_cb free_cb, + void *add_arg, + custom_ext_parse_cb parse_cb, + void *parse_arg); + +__owur int SSL_CTX_add_server_custom_ext(SSL_CTX *ctx, + unsigned int ext_type, + custom_ext_add_cb add_cb, + custom_ext_free_cb free_cb, + void *add_arg, + custom_ext_parse_cb parse_cb, + void *parse_arg); + +__owur int SSL_CTX_add_custom_ext(SSL_CTX *ctx, unsigned int ext_type, + unsigned int context, + SSL_custom_ext_add_cb_ex add_cb, + SSL_custom_ext_free_cb_ex free_cb, + void *add_arg, + SSL_custom_ext_parse_cb_ex parse_cb, + void *parse_arg); + +__owur int SSL_extension_supported(unsigned int ext_type); + +# define SSL_NOTHING 1 +# define SSL_WRITING 2 +# define SSL_READING 3 +# define SSL_X509_LOOKUP 4 +# define SSL_ASYNC_PAUSED 5 +# define SSL_ASYNC_NO_JOBS 6 +# define SSL_CLIENT_HELLO_CB 7 + +/* These will only be used when doing non-blocking IO */ +# define SSL_want_nothing(s) (SSL_want(s) == SSL_NOTHING) +# define SSL_want_read(s) (SSL_want(s) == SSL_READING) +# define SSL_want_write(s) (SSL_want(s) == SSL_WRITING) +# define SSL_want_x509_lookup(s) (SSL_want(s) == SSL_X509_LOOKUP) +# define SSL_want_async(s) (SSL_want(s) == SSL_ASYNC_PAUSED) +# define SSL_want_async_job(s) (SSL_want(s) == SSL_ASYNC_NO_JOBS) +# define SSL_want_client_hello_cb(s) (SSL_want(s) == SSL_CLIENT_HELLO_CB) + +# define SSL_MAC_FLAG_READ_MAC_STREAM 1 +# define SSL_MAC_FLAG_WRITE_MAC_STREAM 2 + +/* + * A callback for logging out TLS key material. This callback should log out + * |line| followed by a newline. + */ +typedef void (*SSL_CTX_keylog_cb_func)(const SSL *ssl, const char *line); + +/* + * SSL_CTX_set_keylog_callback configures a callback to log key material. This + * is intended for debugging use with tools like Wireshark. The cb function + * should log line followed by a newline. + */ +void SSL_CTX_set_keylog_callback(SSL_CTX *ctx, SSL_CTX_keylog_cb_func cb); + +/* + * SSL_CTX_get_keylog_callback returns the callback configured by + * SSL_CTX_set_keylog_callback. + */ +SSL_CTX_keylog_cb_func SSL_CTX_get_keylog_callback(const SSL_CTX *ctx); + +int SSL_CTX_set_max_early_data(SSL_CTX *ctx, uint32_t max_early_data); +uint32_t SSL_CTX_get_max_early_data(const SSL_CTX *ctx); +int SSL_set_max_early_data(SSL *s, uint32_t max_early_data); +uint32_t SSL_get_max_early_data(const SSL *s); +int SSL_CTX_set_recv_max_early_data(SSL_CTX *ctx, uint32_t recv_max_early_data); +uint32_t SSL_CTX_get_recv_max_early_data(const SSL_CTX *ctx); +int SSL_set_recv_max_early_data(SSL *s, uint32_t recv_max_early_data); +uint32_t SSL_get_recv_max_early_data(const SSL *s); + +#ifdef __cplusplus +} +#endif + +# include +# include +# include /* This is mostly sslv3 with a few tweaks */ +# include /* Datagram TLS */ +# include /* Support for the use_srtp extension */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * These need to be after the above set of includes due to a compiler bug + * in VisualStudio 2015 + */ +DEFINE_STACK_OF_CONST(SSL_CIPHER) +DEFINE_STACK_OF(SSL_COMP) + +/* compatibility */ +# define SSL_set_app_data(s,arg) (SSL_set_ex_data(s,0,(char *)(arg))) +# define SSL_get_app_data(s) (SSL_get_ex_data(s,0)) +# define SSL_SESSION_set_app_data(s,a) (SSL_SESSION_set_ex_data(s,0, \ + (char *)(a))) +# define SSL_SESSION_get_app_data(s) (SSL_SESSION_get_ex_data(s,0)) +# define SSL_CTX_get_app_data(ctx) (SSL_CTX_get_ex_data(ctx,0)) +# define SSL_CTX_set_app_data(ctx,arg) (SSL_CTX_set_ex_data(ctx,0, \ + (char *)(arg))) +DEPRECATEDIN_1_1_0(void SSL_set_debug(SSL *s, int debug)) + +/* TLSv1.3 KeyUpdate message types */ +/* -1 used so that this is an invalid value for the on-the-wire protocol */ +#define SSL_KEY_UPDATE_NONE -1 +/* Values as defined for the on-the-wire protocol */ +#define SSL_KEY_UPDATE_NOT_REQUESTED 0 +#define SSL_KEY_UPDATE_REQUESTED 1 + +/* + * The valid handshake states (one for each type message sent and one for each + * type of message received). There are also two "special" states: + * TLS = TLS or DTLS state + * DTLS = DTLS specific state + * CR/SR = Client Read/Server Read + * CW/SW = Client Write/Server Write + * + * The "special" states are: + * TLS_ST_BEFORE = No handshake has been initiated yet + * TLS_ST_OK = A handshake has been successfully completed + */ +typedef enum { + TLS_ST_BEFORE, + TLS_ST_OK, + DTLS_ST_CR_HELLO_VERIFY_REQUEST, + TLS_ST_CR_SRVR_HELLO, + TLS_ST_CR_CERT, + TLS_ST_CR_CERT_STATUS, + TLS_ST_CR_KEY_EXCH, + TLS_ST_CR_CERT_REQ, + TLS_ST_CR_SRVR_DONE, + TLS_ST_CR_SESSION_TICKET, + TLS_ST_CR_CHANGE, + TLS_ST_CR_FINISHED, + TLS_ST_CW_CLNT_HELLO, + TLS_ST_CW_CERT, + TLS_ST_CW_KEY_EXCH, + TLS_ST_CW_CERT_VRFY, + TLS_ST_CW_CHANGE, + TLS_ST_CW_NEXT_PROTO, + TLS_ST_CW_FINISHED, + TLS_ST_SW_HELLO_REQ, + TLS_ST_SR_CLNT_HELLO, + DTLS_ST_SW_HELLO_VERIFY_REQUEST, + TLS_ST_SW_SRVR_HELLO, + TLS_ST_SW_CERT, + TLS_ST_SW_KEY_EXCH, + TLS_ST_SW_CERT_REQ, + TLS_ST_SW_SRVR_DONE, + TLS_ST_SR_CERT, + TLS_ST_SR_KEY_EXCH, + TLS_ST_SR_CERT_VRFY, + TLS_ST_SR_NEXT_PROTO, + TLS_ST_SR_CHANGE, + TLS_ST_SR_FINISHED, + TLS_ST_SW_SESSION_TICKET, + TLS_ST_SW_CERT_STATUS, + TLS_ST_SW_CHANGE, + TLS_ST_SW_FINISHED, + TLS_ST_SW_ENCRYPTED_EXTENSIONS, + TLS_ST_CR_ENCRYPTED_EXTENSIONS, + TLS_ST_CR_CERT_VRFY, + TLS_ST_SW_CERT_VRFY, + TLS_ST_CR_HELLO_REQ, + TLS_ST_SW_KEY_UPDATE, + TLS_ST_CW_KEY_UPDATE, + TLS_ST_SR_KEY_UPDATE, + TLS_ST_CR_KEY_UPDATE, + TLS_ST_EARLY_DATA, + TLS_ST_PENDING_EARLY_DATA_END, + TLS_ST_CW_END_OF_EARLY_DATA, + TLS_ST_SR_END_OF_EARLY_DATA +} OSSL_HANDSHAKE_STATE; + +/* + * Most of the following state values are no longer used and are defined to be + * the closest equivalent value in the current state machine code. Not all + * defines have an equivalent and are set to a dummy value (-1). SSL_ST_CONNECT + * and SSL_ST_ACCEPT are still in use in the definition of SSL_CB_ACCEPT_LOOP, + * SSL_CB_ACCEPT_EXIT, SSL_CB_CONNECT_LOOP and SSL_CB_CONNECT_EXIT. + */ + +# define SSL_ST_CONNECT 0x1000 +# define SSL_ST_ACCEPT 0x2000 + +# define SSL_ST_MASK 0x0FFF + +# define SSL_CB_LOOP 0x01 +# define SSL_CB_EXIT 0x02 +# define SSL_CB_READ 0x04 +# define SSL_CB_WRITE 0x08 +# define SSL_CB_ALERT 0x4000/* used in callback */ +# define SSL_CB_READ_ALERT (SSL_CB_ALERT|SSL_CB_READ) +# define SSL_CB_WRITE_ALERT (SSL_CB_ALERT|SSL_CB_WRITE) +# define SSL_CB_ACCEPT_LOOP (SSL_ST_ACCEPT|SSL_CB_LOOP) +# define SSL_CB_ACCEPT_EXIT (SSL_ST_ACCEPT|SSL_CB_EXIT) +# define SSL_CB_CONNECT_LOOP (SSL_ST_CONNECT|SSL_CB_LOOP) +# define SSL_CB_CONNECT_EXIT (SSL_ST_CONNECT|SSL_CB_EXIT) +# define SSL_CB_HANDSHAKE_START 0x10 +# define SSL_CB_HANDSHAKE_DONE 0x20 + +/* Is the SSL_connection established? */ +# define SSL_in_connect_init(a) (SSL_in_init(a) && !SSL_is_server(a)) +# define SSL_in_accept_init(a) (SSL_in_init(a) && SSL_is_server(a)) +int SSL_in_init(const SSL *s); +int SSL_in_before(const SSL *s); +int SSL_is_init_finished(const SSL *s); + +/* + * The following 3 states are kept in ssl->rlayer.rstate when reads fail, you + * should not need these + */ +# define SSL_ST_READ_HEADER 0xF0 +# define SSL_ST_READ_BODY 0xF1 +# define SSL_ST_READ_DONE 0xF2 + +/*- + * Obtain latest Finished message + * -- that we sent (SSL_get_finished) + * -- that we expected from peer (SSL_get_peer_finished). + * Returns length (0 == no Finished so far), copies up to 'count' bytes. + */ +size_t SSL_get_finished(const SSL *s, void *buf, size_t count); +size_t SSL_get_peer_finished(const SSL *s, void *buf, size_t count); + +/* + * use either SSL_VERIFY_NONE or SSL_VERIFY_PEER, the last 3 options are + * 'ored' with SSL_VERIFY_PEER if they are desired + */ +# define SSL_VERIFY_NONE 0x00 +# define SSL_VERIFY_PEER 0x01 +# define SSL_VERIFY_FAIL_IF_NO_PEER_CERT 0x02 +# define SSL_VERIFY_CLIENT_ONCE 0x04 +# define SSL_VERIFY_POST_HANDSHAKE 0x08 + +# if OPENSSL_API_COMPAT < 0x10100000L +# define OpenSSL_add_ssl_algorithms() SSL_library_init() +# define SSLeay_add_ssl_algorithms() SSL_library_init() +# endif + +/* More backward compatibility */ +# define SSL_get_cipher(s) \ + SSL_CIPHER_get_name(SSL_get_current_cipher(s)) +# define SSL_get_cipher_bits(s,np) \ + SSL_CIPHER_get_bits(SSL_get_current_cipher(s),np) +# define SSL_get_cipher_version(s) \ + SSL_CIPHER_get_version(SSL_get_current_cipher(s)) +# define SSL_get_cipher_name(s) \ + SSL_CIPHER_get_name(SSL_get_current_cipher(s)) +# define SSL_get_time(a) SSL_SESSION_get_time(a) +# define SSL_set_time(a,b) SSL_SESSION_set_time((a),(b)) +# define SSL_get_timeout(a) SSL_SESSION_get_timeout(a) +# define SSL_set_timeout(a,b) SSL_SESSION_set_timeout((a),(b)) + +# define d2i_SSL_SESSION_bio(bp,s_id) ASN1_d2i_bio_of(SSL_SESSION,SSL_SESSION_new,d2i_SSL_SESSION,bp,s_id) +# define i2d_SSL_SESSION_bio(bp,s_id) ASN1_i2d_bio_of(SSL_SESSION,i2d_SSL_SESSION,bp,s_id) + +DECLARE_PEM_rw(SSL_SESSION, SSL_SESSION) +# define SSL_AD_REASON_OFFSET 1000/* offset to get SSL_R_... value + * from SSL_AD_... */ +/* These alert types are for SSLv3 and TLSv1 */ +# define SSL_AD_CLOSE_NOTIFY SSL3_AD_CLOSE_NOTIFY +/* fatal */ +# define SSL_AD_UNEXPECTED_MESSAGE SSL3_AD_UNEXPECTED_MESSAGE +/* fatal */ +# define SSL_AD_BAD_RECORD_MAC SSL3_AD_BAD_RECORD_MAC +# define SSL_AD_DECRYPTION_FAILED TLS1_AD_DECRYPTION_FAILED +# define SSL_AD_RECORD_OVERFLOW TLS1_AD_RECORD_OVERFLOW +/* fatal */ +# define SSL_AD_DECOMPRESSION_FAILURE SSL3_AD_DECOMPRESSION_FAILURE +/* fatal */ +# define SSL_AD_HANDSHAKE_FAILURE SSL3_AD_HANDSHAKE_FAILURE +/* Not for TLS */ +# define SSL_AD_NO_CERTIFICATE SSL3_AD_NO_CERTIFICATE +# define SSL_AD_BAD_CERTIFICATE SSL3_AD_BAD_CERTIFICATE +# define SSL_AD_UNSUPPORTED_CERTIFICATE SSL3_AD_UNSUPPORTED_CERTIFICATE +# define SSL_AD_CERTIFICATE_REVOKED SSL3_AD_CERTIFICATE_REVOKED +# define SSL_AD_CERTIFICATE_EXPIRED SSL3_AD_CERTIFICATE_EXPIRED +# define SSL_AD_CERTIFICATE_UNKNOWN SSL3_AD_CERTIFICATE_UNKNOWN +/* fatal */ +# define SSL_AD_ILLEGAL_PARAMETER SSL3_AD_ILLEGAL_PARAMETER +/* fatal */ +# define SSL_AD_UNKNOWN_CA TLS1_AD_UNKNOWN_CA +/* fatal */ +# define SSL_AD_ACCESS_DENIED TLS1_AD_ACCESS_DENIED +/* fatal */ +# define SSL_AD_DECODE_ERROR TLS1_AD_DECODE_ERROR +# define SSL_AD_DECRYPT_ERROR TLS1_AD_DECRYPT_ERROR +/* fatal */ +# define SSL_AD_EXPORT_RESTRICTION TLS1_AD_EXPORT_RESTRICTION +/* fatal */ +# define SSL_AD_PROTOCOL_VERSION TLS1_AD_PROTOCOL_VERSION +/* fatal */ +# define SSL_AD_INSUFFICIENT_SECURITY TLS1_AD_INSUFFICIENT_SECURITY +/* fatal */ +# define SSL_AD_INTERNAL_ERROR TLS1_AD_INTERNAL_ERROR +# define SSL_AD_USER_CANCELLED TLS1_AD_USER_CANCELLED +# define SSL_AD_NO_RENEGOTIATION TLS1_AD_NO_RENEGOTIATION +# define SSL_AD_MISSING_EXTENSION TLS13_AD_MISSING_EXTENSION +# define SSL_AD_CERTIFICATE_REQUIRED TLS13_AD_CERTIFICATE_REQUIRED +# define SSL_AD_UNSUPPORTED_EXTENSION TLS1_AD_UNSUPPORTED_EXTENSION +# define SSL_AD_CERTIFICATE_UNOBTAINABLE TLS1_AD_CERTIFICATE_UNOBTAINABLE +# define SSL_AD_UNRECOGNIZED_NAME TLS1_AD_UNRECOGNIZED_NAME +# define SSL_AD_BAD_CERTIFICATE_STATUS_RESPONSE TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE +# define SSL_AD_BAD_CERTIFICATE_HASH_VALUE TLS1_AD_BAD_CERTIFICATE_HASH_VALUE +/* fatal */ +# define SSL_AD_UNKNOWN_PSK_IDENTITY TLS1_AD_UNKNOWN_PSK_IDENTITY +/* fatal */ +# define SSL_AD_INAPPROPRIATE_FALLBACK TLS1_AD_INAPPROPRIATE_FALLBACK +# define SSL_AD_NO_APPLICATION_PROTOCOL TLS1_AD_NO_APPLICATION_PROTOCOL +# define SSL_ERROR_NONE 0 +# define SSL_ERROR_SSL 1 +# define SSL_ERROR_WANT_READ 2 +# define SSL_ERROR_WANT_WRITE 3 +# define SSL_ERROR_WANT_X509_LOOKUP 4 +# define SSL_ERROR_SYSCALL 5/* look at error stack/return + * value/errno */ +# define SSL_ERROR_ZERO_RETURN 6 +# define SSL_ERROR_WANT_CONNECT 7 +# define SSL_ERROR_WANT_ACCEPT 8 +# define SSL_ERROR_WANT_ASYNC 9 +# define SSL_ERROR_WANT_ASYNC_JOB 10 +# define SSL_ERROR_WANT_CLIENT_HELLO_CB 11 +# define SSL_CTRL_SET_TMP_DH 3 +# define SSL_CTRL_SET_TMP_ECDH 4 +# define SSL_CTRL_SET_TMP_DH_CB 6 +# define SSL_CTRL_GET_CLIENT_CERT_REQUEST 9 +# define SSL_CTRL_GET_NUM_RENEGOTIATIONS 10 +# define SSL_CTRL_CLEAR_NUM_RENEGOTIATIONS 11 +# define SSL_CTRL_GET_TOTAL_RENEGOTIATIONS 12 +# define SSL_CTRL_GET_FLAGS 13 +# define SSL_CTRL_EXTRA_CHAIN_CERT 14 +# define SSL_CTRL_SET_MSG_CALLBACK 15 +# define SSL_CTRL_SET_MSG_CALLBACK_ARG 16 +/* only applies to datagram connections */ +# define SSL_CTRL_SET_MTU 17 +/* Stats */ +# define SSL_CTRL_SESS_NUMBER 20 +# define SSL_CTRL_SESS_CONNECT 21 +# define SSL_CTRL_SESS_CONNECT_GOOD 22 +# define SSL_CTRL_SESS_CONNECT_RENEGOTIATE 23 +# define SSL_CTRL_SESS_ACCEPT 24 +# define SSL_CTRL_SESS_ACCEPT_GOOD 25 +# define SSL_CTRL_SESS_ACCEPT_RENEGOTIATE 26 +# define SSL_CTRL_SESS_HIT 27 +# define SSL_CTRL_SESS_CB_HIT 28 +# define SSL_CTRL_SESS_MISSES 29 +# define SSL_CTRL_SESS_TIMEOUTS 30 +# define SSL_CTRL_SESS_CACHE_FULL 31 +# define SSL_CTRL_MODE 33 +# define SSL_CTRL_GET_READ_AHEAD 40 +# define SSL_CTRL_SET_READ_AHEAD 41 +# define SSL_CTRL_SET_SESS_CACHE_SIZE 42 +# define SSL_CTRL_GET_SESS_CACHE_SIZE 43 +# define SSL_CTRL_SET_SESS_CACHE_MODE 44 +# define SSL_CTRL_GET_SESS_CACHE_MODE 45 +# define SSL_CTRL_GET_MAX_CERT_LIST 50 +# define SSL_CTRL_SET_MAX_CERT_LIST 51 +# define SSL_CTRL_SET_MAX_SEND_FRAGMENT 52 +/* see tls1.h for macros based on these */ +# define SSL_CTRL_SET_TLSEXT_SERVERNAME_CB 53 +# define SSL_CTRL_SET_TLSEXT_SERVERNAME_ARG 54 +# define SSL_CTRL_SET_TLSEXT_HOSTNAME 55 +# define SSL_CTRL_SET_TLSEXT_DEBUG_CB 56 +# define SSL_CTRL_SET_TLSEXT_DEBUG_ARG 57 +# define SSL_CTRL_GET_TLSEXT_TICKET_KEYS 58 +# define SSL_CTRL_SET_TLSEXT_TICKET_KEYS 59 +/*# define SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT 60 */ +/*# define SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT_CB 61 */ +/*# define SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT_CB_ARG 62 */ +# define SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB 63 +# define SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB_ARG 64 +# define SSL_CTRL_SET_TLSEXT_STATUS_REQ_TYPE 65 +# define SSL_CTRL_GET_TLSEXT_STATUS_REQ_EXTS 66 +# define SSL_CTRL_SET_TLSEXT_STATUS_REQ_EXTS 67 +# define SSL_CTRL_GET_TLSEXT_STATUS_REQ_IDS 68 +# define SSL_CTRL_SET_TLSEXT_STATUS_REQ_IDS 69 +# define SSL_CTRL_GET_TLSEXT_STATUS_REQ_OCSP_RESP 70 +# define SSL_CTRL_SET_TLSEXT_STATUS_REQ_OCSP_RESP 71 +# define SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB 72 +# define SSL_CTRL_SET_TLS_EXT_SRP_USERNAME_CB 75 +# define SSL_CTRL_SET_SRP_VERIFY_PARAM_CB 76 +# define SSL_CTRL_SET_SRP_GIVE_CLIENT_PWD_CB 77 +# define SSL_CTRL_SET_SRP_ARG 78 +# define SSL_CTRL_SET_TLS_EXT_SRP_USERNAME 79 +# define SSL_CTRL_SET_TLS_EXT_SRP_STRENGTH 80 +# define SSL_CTRL_SET_TLS_EXT_SRP_PASSWORD 81 +# ifndef OPENSSL_NO_HEARTBEATS +# define SSL_CTRL_DTLS_EXT_SEND_HEARTBEAT 85 +# define SSL_CTRL_GET_DTLS_EXT_HEARTBEAT_PENDING 86 +# define SSL_CTRL_SET_DTLS_EXT_HEARTBEAT_NO_REQUESTS 87 +# endif +# define DTLS_CTRL_GET_TIMEOUT 73 +# define DTLS_CTRL_HANDLE_TIMEOUT 74 +# define SSL_CTRL_GET_RI_SUPPORT 76 +# define SSL_CTRL_CLEAR_MODE 78 +# define SSL_CTRL_SET_NOT_RESUMABLE_SESS_CB 79 +# define SSL_CTRL_GET_EXTRA_CHAIN_CERTS 82 +# define SSL_CTRL_CLEAR_EXTRA_CHAIN_CERTS 83 +# define SSL_CTRL_CHAIN 88 +# define SSL_CTRL_CHAIN_CERT 89 +# define SSL_CTRL_GET_GROUPS 90 +# define SSL_CTRL_SET_GROUPS 91 +# define SSL_CTRL_SET_GROUPS_LIST 92 +# define SSL_CTRL_GET_SHARED_GROUP 93 +# define SSL_CTRL_SET_SIGALGS 97 +# define SSL_CTRL_SET_SIGALGS_LIST 98 +# define SSL_CTRL_CERT_FLAGS 99 +# define SSL_CTRL_CLEAR_CERT_FLAGS 100 +# define SSL_CTRL_SET_CLIENT_SIGALGS 101 +# define SSL_CTRL_SET_CLIENT_SIGALGS_LIST 102 +# define SSL_CTRL_GET_CLIENT_CERT_TYPES 103 +# define SSL_CTRL_SET_CLIENT_CERT_TYPES 104 +# define SSL_CTRL_BUILD_CERT_CHAIN 105 +# define SSL_CTRL_SET_VERIFY_CERT_STORE 106 +# define SSL_CTRL_SET_CHAIN_CERT_STORE 107 +# define SSL_CTRL_GET_PEER_SIGNATURE_NID 108 +# define SSL_CTRL_GET_PEER_TMP_KEY 109 +# define SSL_CTRL_GET_RAW_CIPHERLIST 110 +# define SSL_CTRL_GET_EC_POINT_FORMATS 111 +# define SSL_CTRL_GET_CHAIN_CERTS 115 +# define SSL_CTRL_SELECT_CURRENT_CERT 116 +# define SSL_CTRL_SET_CURRENT_CERT 117 +# define SSL_CTRL_SET_DH_AUTO 118 +# define DTLS_CTRL_SET_LINK_MTU 120 +# define DTLS_CTRL_GET_LINK_MIN_MTU 121 +# define SSL_CTRL_GET_EXTMS_SUPPORT 122 +# define SSL_CTRL_SET_MIN_PROTO_VERSION 123 +# define SSL_CTRL_SET_MAX_PROTO_VERSION 124 +# define SSL_CTRL_SET_SPLIT_SEND_FRAGMENT 125 +# define SSL_CTRL_SET_MAX_PIPELINES 126 +# define SSL_CTRL_GET_TLSEXT_STATUS_REQ_TYPE 127 +# define SSL_CTRL_GET_TLSEXT_STATUS_REQ_CB 128 +# define SSL_CTRL_GET_TLSEXT_STATUS_REQ_CB_ARG 129 +# define SSL_CTRL_GET_MIN_PROTO_VERSION 130 +# define SSL_CTRL_GET_MAX_PROTO_VERSION 131 +# define SSL_CTRL_GET_SIGNATURE_NID 132 +# define SSL_CTRL_GET_TMP_KEY 133 +# define SSL_CERT_SET_FIRST 1 +# define SSL_CERT_SET_NEXT 2 +# define SSL_CERT_SET_SERVER 3 +# define DTLSv1_get_timeout(ssl, arg) \ + SSL_ctrl(ssl,DTLS_CTRL_GET_TIMEOUT,0, (void *)(arg)) +# define DTLSv1_handle_timeout(ssl) \ + SSL_ctrl(ssl,DTLS_CTRL_HANDLE_TIMEOUT,0, NULL) +# define SSL_num_renegotiations(ssl) \ + SSL_ctrl((ssl),SSL_CTRL_GET_NUM_RENEGOTIATIONS,0,NULL) +# define SSL_clear_num_renegotiations(ssl) \ + SSL_ctrl((ssl),SSL_CTRL_CLEAR_NUM_RENEGOTIATIONS,0,NULL) +# define SSL_total_renegotiations(ssl) \ + SSL_ctrl((ssl),SSL_CTRL_GET_TOTAL_RENEGOTIATIONS,0,NULL) +# define SSL_CTX_set_tmp_dh(ctx,dh) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_DH,0,(char *)(dh)) +# define SSL_CTX_set_tmp_ecdh(ctx,ecdh) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_ECDH,0,(char *)(ecdh)) +# define SSL_CTX_set_dh_auto(ctx, onoff) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_DH_AUTO,onoff,NULL) +# define SSL_set_dh_auto(s, onoff) \ + SSL_ctrl(s,SSL_CTRL_SET_DH_AUTO,onoff,NULL) +# define SSL_set_tmp_dh(ssl,dh) \ + SSL_ctrl(ssl,SSL_CTRL_SET_TMP_DH,0,(char *)(dh)) +# define SSL_set_tmp_ecdh(ssl,ecdh) \ + SSL_ctrl(ssl,SSL_CTRL_SET_TMP_ECDH,0,(char *)(ecdh)) +# define SSL_CTX_add_extra_chain_cert(ctx,x509) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_EXTRA_CHAIN_CERT,0,(char *)(x509)) +# define SSL_CTX_get_extra_chain_certs(ctx,px509) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_GET_EXTRA_CHAIN_CERTS,0,px509) +# define SSL_CTX_get_extra_chain_certs_only(ctx,px509) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_GET_EXTRA_CHAIN_CERTS,1,px509) +# define SSL_CTX_clear_extra_chain_certs(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_CLEAR_EXTRA_CHAIN_CERTS,0,NULL) +# define SSL_CTX_set0_chain(ctx,sk) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_CHAIN,0,(char *)(sk)) +# define SSL_CTX_set1_chain(ctx,sk) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_CHAIN,1,(char *)(sk)) +# define SSL_CTX_add0_chain_cert(ctx,x509) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_CHAIN_CERT,0,(char *)(x509)) +# define SSL_CTX_add1_chain_cert(ctx,x509) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_CHAIN_CERT,1,(char *)(x509)) +# define SSL_CTX_get0_chain_certs(ctx,px509) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_GET_CHAIN_CERTS,0,px509) +# define SSL_CTX_clear_chain_certs(ctx) \ + SSL_CTX_set0_chain(ctx,NULL) +# define SSL_CTX_build_cert_chain(ctx, flags) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_BUILD_CERT_CHAIN, flags, NULL) +# define SSL_CTX_select_current_cert(ctx,x509) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SELECT_CURRENT_CERT,0,(char *)(x509)) +# define SSL_CTX_set_current_cert(ctx, op) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CURRENT_CERT, op, NULL) +# define SSL_CTX_set0_verify_cert_store(ctx,st) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_VERIFY_CERT_STORE,0,(char *)(st)) +# define SSL_CTX_set1_verify_cert_store(ctx,st) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_VERIFY_CERT_STORE,1,(char *)(st)) +# define SSL_CTX_set0_chain_cert_store(ctx,st) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CHAIN_CERT_STORE,0,(char *)(st)) +# define SSL_CTX_set1_chain_cert_store(ctx,st) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CHAIN_CERT_STORE,1,(char *)(st)) +# define SSL_set0_chain(s,sk) \ + SSL_ctrl(s,SSL_CTRL_CHAIN,0,(char *)(sk)) +# define SSL_set1_chain(s,sk) \ + SSL_ctrl(s,SSL_CTRL_CHAIN,1,(char *)(sk)) +# define SSL_add0_chain_cert(s,x509) \ + SSL_ctrl(s,SSL_CTRL_CHAIN_CERT,0,(char *)(x509)) +# define SSL_add1_chain_cert(s,x509) \ + SSL_ctrl(s,SSL_CTRL_CHAIN_CERT,1,(char *)(x509)) +# define SSL_get0_chain_certs(s,px509) \ + SSL_ctrl(s,SSL_CTRL_GET_CHAIN_CERTS,0,px509) +# define SSL_clear_chain_certs(s) \ + SSL_set0_chain(s,NULL) +# define SSL_build_cert_chain(s, flags) \ + SSL_ctrl(s,SSL_CTRL_BUILD_CERT_CHAIN, flags, NULL) +# define SSL_select_current_cert(s,x509) \ + SSL_ctrl(s,SSL_CTRL_SELECT_CURRENT_CERT,0,(char *)(x509)) +# define SSL_set_current_cert(s,op) \ + SSL_ctrl(s,SSL_CTRL_SET_CURRENT_CERT, op, NULL) +# define SSL_set0_verify_cert_store(s,st) \ + SSL_ctrl(s,SSL_CTRL_SET_VERIFY_CERT_STORE,0,(char *)(st)) +# define SSL_set1_verify_cert_store(s,st) \ + SSL_ctrl(s,SSL_CTRL_SET_VERIFY_CERT_STORE,1,(char *)(st)) +# define SSL_set0_chain_cert_store(s,st) \ + SSL_ctrl(s,SSL_CTRL_SET_CHAIN_CERT_STORE,0,(char *)(st)) +# define SSL_set1_chain_cert_store(s,st) \ + SSL_ctrl(s,SSL_CTRL_SET_CHAIN_CERT_STORE,1,(char *)(st)) +# define SSL_get1_groups(s, glist) \ + SSL_ctrl(s,SSL_CTRL_GET_GROUPS,0,(int*)(glist)) +# define SSL_CTX_set1_groups(ctx, glist, glistlen) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_GROUPS,glistlen,(char *)(glist)) +# define SSL_CTX_set1_groups_list(ctx, s) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_GROUPS_LIST,0,(char *)(s)) +# define SSL_set1_groups(s, glist, glistlen) \ + SSL_ctrl(s,SSL_CTRL_SET_GROUPS,glistlen,(char *)(glist)) +# define SSL_set1_groups_list(s, str) \ + SSL_ctrl(s,SSL_CTRL_SET_GROUPS_LIST,0,(char *)(str)) +# define SSL_get_shared_group(s, n) \ + SSL_ctrl(s,SSL_CTRL_GET_SHARED_GROUP,n,NULL) +# define SSL_CTX_set1_sigalgs(ctx, slist, slistlen) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SIGALGS,slistlen,(int *)(slist)) +# define SSL_CTX_set1_sigalgs_list(ctx, s) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SIGALGS_LIST,0,(char *)(s)) +# define SSL_set1_sigalgs(s, slist, slistlen) \ + SSL_ctrl(s,SSL_CTRL_SET_SIGALGS,slistlen,(int *)(slist)) +# define SSL_set1_sigalgs_list(s, str) \ + SSL_ctrl(s,SSL_CTRL_SET_SIGALGS_LIST,0,(char *)(str)) +# define SSL_CTX_set1_client_sigalgs(ctx, slist, slistlen) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CLIENT_SIGALGS,slistlen,(int *)(slist)) +# define SSL_CTX_set1_client_sigalgs_list(ctx, s) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CLIENT_SIGALGS_LIST,0,(char *)(s)) +# define SSL_set1_client_sigalgs(s, slist, slistlen) \ + SSL_ctrl(s,SSL_CTRL_SET_CLIENT_SIGALGS,slistlen,(int *)(slist)) +# define SSL_set1_client_sigalgs_list(s, str) \ + SSL_ctrl(s,SSL_CTRL_SET_CLIENT_SIGALGS_LIST,0,(char *)(str)) +# define SSL_get0_certificate_types(s, clist) \ + SSL_ctrl(s, SSL_CTRL_GET_CLIENT_CERT_TYPES, 0, (char *)(clist)) +# define SSL_CTX_set1_client_certificate_types(ctx, clist, clistlen) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CLIENT_CERT_TYPES,clistlen, \ + (char *)(clist)) +# define SSL_set1_client_certificate_types(s, clist, clistlen) \ + SSL_ctrl(s,SSL_CTRL_SET_CLIENT_CERT_TYPES,clistlen,(char *)(clist)) +# define SSL_get_signature_nid(s, pn) \ + SSL_ctrl(s,SSL_CTRL_GET_SIGNATURE_NID,0,pn) +# define SSL_get_peer_signature_nid(s, pn) \ + SSL_ctrl(s,SSL_CTRL_GET_PEER_SIGNATURE_NID,0,pn) +# define SSL_get_peer_tmp_key(s, pk) \ + SSL_ctrl(s,SSL_CTRL_GET_PEER_TMP_KEY,0,pk) +# define SSL_get_tmp_key(s, pk) \ + SSL_ctrl(s,SSL_CTRL_GET_TMP_KEY,0,pk) +# define SSL_get0_raw_cipherlist(s, plst) \ + SSL_ctrl(s,SSL_CTRL_GET_RAW_CIPHERLIST,0,plst) +# define SSL_get0_ec_point_formats(s, plst) \ + SSL_ctrl(s,SSL_CTRL_GET_EC_POINT_FORMATS,0,plst) +# define SSL_CTX_set_min_proto_version(ctx, version) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_MIN_PROTO_VERSION, version, NULL) +# define SSL_CTX_set_max_proto_version(ctx, version) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_MAX_PROTO_VERSION, version, NULL) +# define SSL_CTX_get_min_proto_version(ctx) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_GET_MIN_PROTO_VERSION, 0, NULL) +# define SSL_CTX_get_max_proto_version(ctx) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_GET_MAX_PROTO_VERSION, 0, NULL) +# define SSL_set_min_proto_version(s, version) \ + SSL_ctrl(s, SSL_CTRL_SET_MIN_PROTO_VERSION, version, NULL) +# define SSL_set_max_proto_version(s, version) \ + SSL_ctrl(s, SSL_CTRL_SET_MAX_PROTO_VERSION, version, NULL) +# define SSL_get_min_proto_version(s) \ + SSL_ctrl(s, SSL_CTRL_GET_MIN_PROTO_VERSION, 0, NULL) +# define SSL_get_max_proto_version(s) \ + SSL_ctrl(s, SSL_CTRL_GET_MAX_PROTO_VERSION, 0, NULL) + +/* Backwards compatibility, original 1.1.0 names */ +# define SSL_CTRL_GET_SERVER_TMP_KEY \ + SSL_CTRL_GET_PEER_TMP_KEY +# define SSL_get_server_tmp_key(s, pk) \ + SSL_get_peer_tmp_key(s, pk) + +/* + * The following symbol names are old and obsolete. They are kept + * for compatibility reasons only and should not be used anymore. + */ +# define SSL_CTRL_GET_CURVES SSL_CTRL_GET_GROUPS +# define SSL_CTRL_SET_CURVES SSL_CTRL_SET_GROUPS +# define SSL_CTRL_SET_CURVES_LIST SSL_CTRL_SET_GROUPS_LIST +# define SSL_CTRL_GET_SHARED_CURVE SSL_CTRL_GET_SHARED_GROUP + +# define SSL_get1_curves SSL_get1_groups +# define SSL_CTX_set1_curves SSL_CTX_set1_groups +# define SSL_CTX_set1_curves_list SSL_CTX_set1_groups_list +# define SSL_set1_curves SSL_set1_groups +# define SSL_set1_curves_list SSL_set1_groups_list +# define SSL_get_shared_curve SSL_get_shared_group + + +# if OPENSSL_API_COMPAT < 0x10100000L +/* Provide some compatibility macros for removed functionality. */ +# define SSL_CTX_need_tmp_RSA(ctx) 0 +# define SSL_CTX_set_tmp_rsa(ctx,rsa) 1 +# define SSL_need_tmp_RSA(ssl) 0 +# define SSL_set_tmp_rsa(ssl,rsa) 1 +# define SSL_CTX_set_ecdh_auto(dummy, onoff) ((onoff) != 0) +# define SSL_set_ecdh_auto(dummy, onoff) ((onoff) != 0) +/* + * We "pretend" to call the callback to avoid warnings about unused static + * functions. + */ +# define SSL_CTX_set_tmp_rsa_callback(ctx, cb) while(0) (cb)(NULL, 0, 0) +# define SSL_set_tmp_rsa_callback(ssl, cb) while(0) (cb)(NULL, 0, 0) +# endif +__owur const BIO_METHOD *BIO_f_ssl(void); +__owur BIO *BIO_new_ssl(SSL_CTX *ctx, int client); +__owur BIO *BIO_new_ssl_connect(SSL_CTX *ctx); +__owur BIO *BIO_new_buffer_ssl_connect(SSL_CTX *ctx); +__owur int BIO_ssl_copy_session_id(BIO *to, BIO *from); +void BIO_ssl_shutdown(BIO *ssl_bio); + +__owur int SSL_CTX_set_cipher_list(SSL_CTX *, const char *str); +__owur SSL_CTX *SSL_CTX_new(const SSL_METHOD *meth); +int SSL_CTX_up_ref(SSL_CTX *ctx); +void SSL_CTX_free(SSL_CTX *); +__owur long SSL_CTX_set_timeout(SSL_CTX *ctx, long t); +__owur long SSL_CTX_get_timeout(const SSL_CTX *ctx); +__owur X509_STORE *SSL_CTX_get_cert_store(const SSL_CTX *); +void SSL_CTX_set_cert_store(SSL_CTX *, X509_STORE *); +void SSL_CTX_set1_cert_store(SSL_CTX *, X509_STORE *); +__owur int SSL_want(const SSL *s); +__owur int SSL_clear(SSL *s); + +void SSL_CTX_flush_sessions(SSL_CTX *ctx, long tm); + +__owur const SSL_CIPHER *SSL_get_current_cipher(const SSL *s); +__owur const SSL_CIPHER *SSL_get_pending_cipher(const SSL *s); +__owur int SSL_CIPHER_get_bits(const SSL_CIPHER *c, int *alg_bits); +__owur const char *SSL_CIPHER_get_version(const SSL_CIPHER *c); +__owur const char *SSL_CIPHER_get_name(const SSL_CIPHER *c); +__owur const char *SSL_CIPHER_standard_name(const SSL_CIPHER *c); +__owur const char *OPENSSL_cipher_name(const char *rfc_name); +__owur uint32_t SSL_CIPHER_get_id(const SSL_CIPHER *c); +__owur uint16_t SSL_CIPHER_get_protocol_id(const SSL_CIPHER *c); +__owur int SSL_CIPHER_get_kx_nid(const SSL_CIPHER *c); +__owur int SSL_CIPHER_get_auth_nid(const SSL_CIPHER *c); +__owur const EVP_MD *SSL_CIPHER_get_handshake_digest(const SSL_CIPHER *c); +__owur int SSL_CIPHER_is_aead(const SSL_CIPHER *c); + +__owur int SSL_get_fd(const SSL *s); +__owur int SSL_get_rfd(const SSL *s); +__owur int SSL_get_wfd(const SSL *s); +__owur const char *SSL_get_cipher_list(const SSL *s, int n); +__owur char *SSL_get_shared_ciphers(const SSL *s, char *buf, int size); +__owur int SSL_get_read_ahead(const SSL *s); +__owur int SSL_pending(const SSL *s); +__owur int SSL_has_pending(const SSL *s); +# ifndef OPENSSL_NO_SOCK +__owur int SSL_set_fd(SSL *s, int fd); +__owur int SSL_set_rfd(SSL *s, int fd); +__owur int SSL_set_wfd(SSL *s, int fd); +# endif +void SSL_set0_rbio(SSL *s, BIO *rbio); +void SSL_set0_wbio(SSL *s, BIO *wbio); +void SSL_set_bio(SSL *s, BIO *rbio, BIO *wbio); +__owur BIO *SSL_get_rbio(const SSL *s); +__owur BIO *SSL_get_wbio(const SSL *s); +__owur int SSL_set_cipher_list(SSL *s, const char *str); +__owur int SSL_CTX_set_ciphersuites(SSL_CTX *ctx, const char *str); +__owur int SSL_set_ciphersuites(SSL *s, const char *str); +void SSL_set_read_ahead(SSL *s, int yes); +__owur int SSL_get_verify_mode(const SSL *s); +__owur int SSL_get_verify_depth(const SSL *s); +__owur SSL_verify_cb SSL_get_verify_callback(const SSL *s); +void SSL_set_verify(SSL *s, int mode, SSL_verify_cb callback); +void SSL_set_verify_depth(SSL *s, int depth); +void SSL_set_cert_cb(SSL *s, int (*cb) (SSL *ssl, void *arg), void *arg); +# ifndef OPENSSL_NO_RSA +__owur int SSL_use_RSAPrivateKey(SSL *ssl, RSA *rsa); +__owur int SSL_use_RSAPrivateKey_ASN1(SSL *ssl, const unsigned char *d, + long len); +# endif +__owur int SSL_use_PrivateKey(SSL *ssl, EVP_PKEY *pkey); +__owur int SSL_use_PrivateKey_ASN1(int pk, SSL *ssl, const unsigned char *d, + long len); +__owur int SSL_use_certificate(SSL *ssl, X509 *x); +__owur int SSL_use_certificate_ASN1(SSL *ssl, const unsigned char *d, int len); +__owur int SSL_use_cert_and_key(SSL *ssl, X509 *x509, EVP_PKEY *privatekey, + STACK_OF(X509) *chain, int override); + + +/* serverinfo file format versions */ +# define SSL_SERVERINFOV1 1 +# define SSL_SERVERINFOV2 2 + +/* Set serverinfo data for the current active cert. */ +__owur int SSL_CTX_use_serverinfo(SSL_CTX *ctx, const unsigned char *serverinfo, + size_t serverinfo_length); +__owur int SSL_CTX_use_serverinfo_ex(SSL_CTX *ctx, unsigned int version, + const unsigned char *serverinfo, + size_t serverinfo_length); +__owur int SSL_CTX_use_serverinfo_file(SSL_CTX *ctx, const char *file); + +#ifndef OPENSSL_NO_RSA +__owur int SSL_use_RSAPrivateKey_file(SSL *ssl, const char *file, int type); +#endif + +__owur int SSL_use_PrivateKey_file(SSL *ssl, const char *file, int type); +__owur int SSL_use_certificate_file(SSL *ssl, const char *file, int type); + +#ifndef OPENSSL_NO_RSA +__owur int SSL_CTX_use_RSAPrivateKey_file(SSL_CTX *ctx, const char *file, + int type); +#endif +__owur int SSL_CTX_use_PrivateKey_file(SSL_CTX *ctx, const char *file, + int type); +__owur int SSL_CTX_use_certificate_file(SSL_CTX *ctx, const char *file, + int type); +/* PEM type */ +__owur int SSL_CTX_use_certificate_chain_file(SSL_CTX *ctx, const char *file); +__owur int SSL_use_certificate_chain_file(SSL *ssl, const char *file); +__owur STACK_OF(X509_NAME) *SSL_load_client_CA_file(const char *file); +__owur int SSL_add_file_cert_subjects_to_stack(STACK_OF(X509_NAME) *stackCAs, + const char *file); +int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stackCAs, + const char *dir); + +# if OPENSSL_API_COMPAT < 0x10100000L +# define SSL_load_error_strings() \ + OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS \ + | OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL) +# endif + +__owur const char *SSL_state_string(const SSL *s); +__owur const char *SSL_rstate_string(const SSL *s); +__owur const char *SSL_state_string_long(const SSL *s); +__owur const char *SSL_rstate_string_long(const SSL *s); +__owur long SSL_SESSION_get_time(const SSL_SESSION *s); +__owur long SSL_SESSION_set_time(SSL_SESSION *s, long t); +__owur long SSL_SESSION_get_timeout(const SSL_SESSION *s); +__owur long SSL_SESSION_set_timeout(SSL_SESSION *s, long t); +__owur int SSL_SESSION_get_protocol_version(const SSL_SESSION *s); +__owur int SSL_SESSION_set_protocol_version(SSL_SESSION *s, int version); + +__owur const char *SSL_SESSION_get0_hostname(const SSL_SESSION *s); +__owur int SSL_SESSION_set1_hostname(SSL_SESSION *s, const char *hostname); +void SSL_SESSION_get0_alpn_selected(const SSL_SESSION *s, + const unsigned char **alpn, + size_t *len); +__owur int SSL_SESSION_set1_alpn_selected(SSL_SESSION *s, + const unsigned char *alpn, + size_t len); +__owur const SSL_CIPHER *SSL_SESSION_get0_cipher(const SSL_SESSION *s); +__owur int SSL_SESSION_set_cipher(SSL_SESSION *s, const SSL_CIPHER *cipher); +__owur int SSL_SESSION_has_ticket(const SSL_SESSION *s); +__owur unsigned long SSL_SESSION_get_ticket_lifetime_hint(const SSL_SESSION *s); +void SSL_SESSION_get0_ticket(const SSL_SESSION *s, const unsigned char **tick, + size_t *len); +__owur uint32_t SSL_SESSION_get_max_early_data(const SSL_SESSION *s); +__owur int SSL_SESSION_set_max_early_data(SSL_SESSION *s, + uint32_t max_early_data); +__owur int SSL_copy_session_id(SSL *to, const SSL *from); +__owur X509 *SSL_SESSION_get0_peer(SSL_SESSION *s); +__owur int SSL_SESSION_set1_id_context(SSL_SESSION *s, + const unsigned char *sid_ctx, + unsigned int sid_ctx_len); +__owur int SSL_SESSION_set1_id(SSL_SESSION *s, const unsigned char *sid, + unsigned int sid_len); +__owur int SSL_SESSION_is_resumable(const SSL_SESSION *s); + +__owur SSL_SESSION *SSL_SESSION_new(void); +__owur SSL_SESSION *SSL_SESSION_dup(SSL_SESSION *src); +const unsigned char *SSL_SESSION_get_id(const SSL_SESSION *s, + unsigned int *len); +const unsigned char *SSL_SESSION_get0_id_context(const SSL_SESSION *s, + unsigned int *len); +__owur unsigned int SSL_SESSION_get_compress_id(const SSL_SESSION *s); +# ifndef OPENSSL_NO_STDIO +int SSL_SESSION_print_fp(FILE *fp, const SSL_SESSION *ses); +# endif +int SSL_SESSION_print(BIO *fp, const SSL_SESSION *ses); +int SSL_SESSION_print_keylog(BIO *bp, const SSL_SESSION *x); +int SSL_SESSION_up_ref(SSL_SESSION *ses); +void SSL_SESSION_free(SSL_SESSION *ses); +__owur int i2d_SSL_SESSION(SSL_SESSION *in, unsigned char **pp); +__owur int SSL_set_session(SSL *to, SSL_SESSION *session); +int SSL_CTX_add_session(SSL_CTX *ctx, SSL_SESSION *session); +int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *session); +__owur int SSL_CTX_set_generate_session_id(SSL_CTX *ctx, GEN_SESSION_CB cb); +__owur int SSL_set_generate_session_id(SSL *s, GEN_SESSION_CB cb); +__owur int SSL_has_matching_session_id(const SSL *s, + const unsigned char *id, + unsigned int id_len); +SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp, + long length); + +# ifdef HEADER_X509_H +__owur X509 *SSL_get_peer_certificate(const SSL *s); +# endif + +__owur STACK_OF(X509) *SSL_get_peer_cert_chain(const SSL *s); + +__owur int SSL_CTX_get_verify_mode(const SSL_CTX *ctx); +__owur int SSL_CTX_get_verify_depth(const SSL_CTX *ctx); +__owur SSL_verify_cb SSL_CTX_get_verify_callback(const SSL_CTX *ctx); +void SSL_CTX_set_verify(SSL_CTX *ctx, int mode, SSL_verify_cb callback); +void SSL_CTX_set_verify_depth(SSL_CTX *ctx, int depth); +void SSL_CTX_set_cert_verify_callback(SSL_CTX *ctx, + int (*cb) (X509_STORE_CTX *, void *), + void *arg); +void SSL_CTX_set_cert_cb(SSL_CTX *c, int (*cb) (SSL *ssl, void *arg), + void *arg); +# ifndef OPENSSL_NO_RSA +__owur int SSL_CTX_use_RSAPrivateKey(SSL_CTX *ctx, RSA *rsa); +__owur int SSL_CTX_use_RSAPrivateKey_ASN1(SSL_CTX *ctx, const unsigned char *d, + long len); +# endif +__owur int SSL_CTX_use_PrivateKey(SSL_CTX *ctx, EVP_PKEY *pkey); +__owur int SSL_CTX_use_PrivateKey_ASN1(int pk, SSL_CTX *ctx, + const unsigned char *d, long len); +__owur int SSL_CTX_use_certificate(SSL_CTX *ctx, X509 *x); +__owur int SSL_CTX_use_certificate_ASN1(SSL_CTX *ctx, int len, + const unsigned char *d); +__owur int SSL_CTX_use_cert_and_key(SSL_CTX *ctx, X509 *x509, EVP_PKEY *privatekey, + STACK_OF(X509) *chain, int override); + +void SSL_CTX_set_default_passwd_cb(SSL_CTX *ctx, pem_password_cb *cb); +void SSL_CTX_set_default_passwd_cb_userdata(SSL_CTX *ctx, void *u); +pem_password_cb *SSL_CTX_get_default_passwd_cb(SSL_CTX *ctx); +void *SSL_CTX_get_default_passwd_cb_userdata(SSL_CTX *ctx); +void SSL_set_default_passwd_cb(SSL *s, pem_password_cb *cb); +void SSL_set_default_passwd_cb_userdata(SSL *s, void *u); +pem_password_cb *SSL_get_default_passwd_cb(SSL *s); +void *SSL_get_default_passwd_cb_userdata(SSL *s); + +__owur int SSL_CTX_check_private_key(const SSL_CTX *ctx); +__owur int SSL_check_private_key(const SSL *ctx); + +__owur int SSL_CTX_set_session_id_context(SSL_CTX *ctx, + const unsigned char *sid_ctx, + unsigned int sid_ctx_len); + +SSL *SSL_new(SSL_CTX *ctx); +int SSL_up_ref(SSL *s); +int SSL_is_dtls(const SSL *s); +__owur int SSL_set_session_id_context(SSL *ssl, const unsigned char *sid_ctx, + unsigned int sid_ctx_len); + +__owur int SSL_CTX_set_purpose(SSL_CTX *ctx, int purpose); +__owur int SSL_set_purpose(SSL *ssl, int purpose); +__owur int SSL_CTX_set_trust(SSL_CTX *ctx, int trust); +__owur int SSL_set_trust(SSL *ssl, int trust); + +__owur int SSL_set1_host(SSL *s, const char *hostname); +__owur int SSL_add1_host(SSL *s, const char *hostname); +__owur const char *SSL_get0_peername(SSL *s); +void SSL_set_hostflags(SSL *s, unsigned int flags); + +__owur int SSL_CTX_dane_enable(SSL_CTX *ctx); +__owur int SSL_CTX_dane_mtype_set(SSL_CTX *ctx, const EVP_MD *md, + uint8_t mtype, uint8_t ord); +__owur int SSL_dane_enable(SSL *s, const char *basedomain); +__owur int SSL_dane_tlsa_add(SSL *s, uint8_t usage, uint8_t selector, + uint8_t mtype, unsigned const char *data, size_t dlen); +__owur int SSL_get0_dane_authority(SSL *s, X509 **mcert, EVP_PKEY **mspki); +__owur int SSL_get0_dane_tlsa(SSL *s, uint8_t *usage, uint8_t *selector, + uint8_t *mtype, unsigned const char **data, + size_t *dlen); +/* + * Bridge opacity barrier between libcrypt and libssl, also needed to support + * offline testing in test/danetest.c + */ +SSL_DANE *SSL_get0_dane(SSL *ssl); +/* + * DANE flags + */ +unsigned long SSL_CTX_dane_set_flags(SSL_CTX *ctx, unsigned long flags); +unsigned long SSL_CTX_dane_clear_flags(SSL_CTX *ctx, unsigned long flags); +unsigned long SSL_dane_set_flags(SSL *ssl, unsigned long flags); +unsigned long SSL_dane_clear_flags(SSL *ssl, unsigned long flags); + +__owur int SSL_CTX_set1_param(SSL_CTX *ctx, X509_VERIFY_PARAM *vpm); +__owur int SSL_set1_param(SSL *ssl, X509_VERIFY_PARAM *vpm); + +__owur X509_VERIFY_PARAM *SSL_CTX_get0_param(SSL_CTX *ctx); +__owur X509_VERIFY_PARAM *SSL_get0_param(SSL *ssl); + +# ifndef OPENSSL_NO_SRP +int SSL_CTX_set_srp_username(SSL_CTX *ctx, char *name); +int SSL_CTX_set_srp_password(SSL_CTX *ctx, char *password); +int SSL_CTX_set_srp_strength(SSL_CTX *ctx, int strength); +int SSL_CTX_set_srp_client_pwd_callback(SSL_CTX *ctx, + char *(*cb) (SSL *, void *)); +int SSL_CTX_set_srp_verify_param_callback(SSL_CTX *ctx, + int (*cb) (SSL *, void *)); +int SSL_CTX_set_srp_username_callback(SSL_CTX *ctx, + int (*cb) (SSL *, int *, void *)); +int SSL_CTX_set_srp_cb_arg(SSL_CTX *ctx, void *arg); + +int SSL_set_srp_server_param(SSL *s, const BIGNUM *N, const BIGNUM *g, + BIGNUM *sa, BIGNUM *v, char *info); +int SSL_set_srp_server_param_pw(SSL *s, const char *user, const char *pass, + const char *grp); + +__owur BIGNUM *SSL_get_srp_g(SSL *s); +__owur BIGNUM *SSL_get_srp_N(SSL *s); + +__owur char *SSL_get_srp_username(SSL *s); +__owur char *SSL_get_srp_userinfo(SSL *s); +# endif + +/* + * ClientHello callback and helpers. + */ + +# define SSL_CLIENT_HELLO_SUCCESS 1 +# define SSL_CLIENT_HELLO_ERROR 0 +# define SSL_CLIENT_HELLO_RETRY (-1) + +typedef int (*SSL_client_hello_cb_fn) (SSL *s, int *al, void *arg); +void SSL_CTX_set_client_hello_cb(SSL_CTX *c, SSL_client_hello_cb_fn cb, + void *arg); +int SSL_client_hello_isv2(SSL *s); +unsigned int SSL_client_hello_get0_legacy_version(SSL *s); +size_t SSL_client_hello_get0_random(SSL *s, const unsigned char **out); +size_t SSL_client_hello_get0_session_id(SSL *s, const unsigned char **out); +size_t SSL_client_hello_get0_ciphers(SSL *s, const unsigned char **out); +size_t SSL_client_hello_get0_compression_methods(SSL *s, + const unsigned char **out); +int SSL_client_hello_get1_extensions_present(SSL *s, int **out, size_t *outlen); +int SSL_client_hello_get0_ext(SSL *s, unsigned int type, + const unsigned char **out, size_t *outlen); + +void SSL_certs_clear(SSL *s); +void SSL_free(SSL *ssl); +# ifdef OSSL_ASYNC_FD +/* + * Windows application developer has to include windows.h to use these. + */ +__owur int SSL_waiting_for_async(SSL *s); +__owur int SSL_get_all_async_fds(SSL *s, OSSL_ASYNC_FD *fds, size_t *numfds); +__owur int SSL_get_changed_async_fds(SSL *s, OSSL_ASYNC_FD *addfd, + size_t *numaddfds, OSSL_ASYNC_FD *delfd, + size_t *numdelfds); +# endif +__owur int SSL_accept(SSL *ssl); +__owur int SSL_stateless(SSL *s); +__owur int SSL_connect(SSL *ssl); +__owur int SSL_read(SSL *ssl, void *buf, int num); +__owur int SSL_read_ex(SSL *ssl, void *buf, size_t num, size_t *readbytes); + +# define SSL_READ_EARLY_DATA_ERROR 0 +# define SSL_READ_EARLY_DATA_SUCCESS 1 +# define SSL_READ_EARLY_DATA_FINISH 2 + +__owur int SSL_read_early_data(SSL *s, void *buf, size_t num, + size_t *readbytes); +__owur int SSL_peek(SSL *ssl, void *buf, int num); +__owur int SSL_peek_ex(SSL *ssl, void *buf, size_t num, size_t *readbytes); +__owur int SSL_write(SSL *ssl, const void *buf, int num); +__owur int SSL_write_ex(SSL *s, const void *buf, size_t num, size_t *written); +__owur int SSL_write_early_data(SSL *s, const void *buf, size_t num, + size_t *written); +long SSL_ctrl(SSL *ssl, int cmd, long larg, void *parg); +long SSL_callback_ctrl(SSL *, int, void (*)(void)); +long SSL_CTX_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg); +long SSL_CTX_callback_ctrl(SSL_CTX *, int, void (*)(void)); + +# define SSL_EARLY_DATA_NOT_SENT 0 +# define SSL_EARLY_DATA_REJECTED 1 +# define SSL_EARLY_DATA_ACCEPTED 2 + +__owur int SSL_get_early_data_status(const SSL *s); + +__owur int SSL_get_error(const SSL *s, int ret_code); +__owur const char *SSL_get_version(const SSL *s); + +/* This sets the 'default' SSL version that SSL_new() will create */ +__owur int SSL_CTX_set_ssl_version(SSL_CTX *ctx, const SSL_METHOD *meth); + +# ifndef OPENSSL_NO_SSL3_METHOD +DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *SSLv3_method(void)) /* SSLv3 */ +DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *SSLv3_server_method(void)) +DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *SSLv3_client_method(void)) +# endif + +#define SSLv23_method TLS_method +#define SSLv23_server_method TLS_server_method +#define SSLv23_client_method TLS_client_method + +/* Negotiate highest available SSL/TLS version */ +__owur const SSL_METHOD *TLS_method(void); +__owur const SSL_METHOD *TLS_server_method(void); +__owur const SSL_METHOD *TLS_client_method(void); + +# ifndef OPENSSL_NO_TLS1_METHOD +DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_method(void)) /* TLSv1.0 */ +DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_server_method(void)) +DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_client_method(void)) +# endif + +# ifndef OPENSSL_NO_TLS1_1_METHOD +DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_1_method(void)) /* TLSv1.1 */ +DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_1_server_method(void)) +DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_1_client_method(void)) +# endif + +# ifndef OPENSSL_NO_TLS1_2_METHOD +DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_2_method(void)) /* TLSv1.2 */ +DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_2_server_method(void)) +DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_2_client_method(void)) +# endif + +# ifndef OPENSSL_NO_DTLS1_METHOD +DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_method(void)) /* DTLSv1.0 */ +DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_server_method(void)) +DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_client_method(void)) +# endif + +# ifndef OPENSSL_NO_DTLS1_2_METHOD +/* DTLSv1.2 */ +DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_2_method(void)) +DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_2_server_method(void)) +DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_2_client_method(void)) +# endif + +__owur const SSL_METHOD *DTLS_method(void); /* DTLS 1.0 and 1.2 */ +__owur const SSL_METHOD *DTLS_server_method(void); /* DTLS 1.0 and 1.2 */ +__owur const SSL_METHOD *DTLS_client_method(void); /* DTLS 1.0 and 1.2 */ + +__owur size_t DTLS_get_data_mtu(const SSL *s); + +__owur STACK_OF(SSL_CIPHER) *SSL_get_ciphers(const SSL *s); +__owur STACK_OF(SSL_CIPHER) *SSL_CTX_get_ciphers(const SSL_CTX *ctx); +__owur STACK_OF(SSL_CIPHER) *SSL_get_client_ciphers(const SSL *s); +__owur STACK_OF(SSL_CIPHER) *SSL_get1_supported_ciphers(SSL *s); + +__owur int SSL_do_handshake(SSL *s); +int SSL_key_update(SSL *s, int updatetype); +int SSL_get_key_update_type(const SSL *s); +int SSL_renegotiate(SSL *s); +int SSL_renegotiate_abbreviated(SSL *s); +__owur int SSL_renegotiate_pending(const SSL *s); +int SSL_shutdown(SSL *s); +__owur int SSL_verify_client_post_handshake(SSL *s); +void SSL_CTX_set_post_handshake_auth(SSL_CTX *ctx, int val); +void SSL_set_post_handshake_auth(SSL *s, int val); + +__owur const SSL_METHOD *SSL_CTX_get_ssl_method(const SSL_CTX *ctx); +__owur const SSL_METHOD *SSL_get_ssl_method(const SSL *s); +__owur int SSL_set_ssl_method(SSL *s, const SSL_METHOD *method); +__owur const char *SSL_alert_type_string_long(int value); +__owur const char *SSL_alert_type_string(int value); +__owur const char *SSL_alert_desc_string_long(int value); +__owur const char *SSL_alert_desc_string(int value); + +void SSL_set0_CA_list(SSL *s, STACK_OF(X509_NAME) *name_list); +void SSL_CTX_set0_CA_list(SSL_CTX *ctx, STACK_OF(X509_NAME) *name_list); +__owur const STACK_OF(X509_NAME) *SSL_get0_CA_list(const SSL *s); +__owur const STACK_OF(X509_NAME) *SSL_CTX_get0_CA_list(const SSL_CTX *ctx); +__owur int SSL_add1_to_CA_list(SSL *ssl, const X509 *x); +__owur int SSL_CTX_add1_to_CA_list(SSL_CTX *ctx, const X509 *x); +__owur const STACK_OF(X509_NAME) *SSL_get0_peer_CA_list(const SSL *s); + +void SSL_set_client_CA_list(SSL *s, STACK_OF(X509_NAME) *name_list); +void SSL_CTX_set_client_CA_list(SSL_CTX *ctx, STACK_OF(X509_NAME) *name_list); +__owur STACK_OF(X509_NAME) *SSL_get_client_CA_list(const SSL *s); +__owur STACK_OF(X509_NAME) *SSL_CTX_get_client_CA_list(const SSL_CTX *s); +__owur int SSL_add_client_CA(SSL *ssl, X509 *x); +__owur int SSL_CTX_add_client_CA(SSL_CTX *ctx, X509 *x); + +void SSL_set_connect_state(SSL *s); +void SSL_set_accept_state(SSL *s); + +__owur long SSL_get_default_timeout(const SSL *s); + +# if OPENSSL_API_COMPAT < 0x10100000L +# define SSL_library_init() OPENSSL_init_ssl(0, NULL) +# endif + +__owur char *SSL_CIPHER_description(const SSL_CIPHER *, char *buf, int size); +__owur STACK_OF(X509_NAME) *SSL_dup_CA_list(const STACK_OF(X509_NAME) *sk); + +__owur SSL *SSL_dup(SSL *ssl); + +__owur X509 *SSL_get_certificate(const SSL *ssl); +/* + * EVP_PKEY + */ +struct evp_pkey_st *SSL_get_privatekey(const SSL *ssl); + +__owur X509 *SSL_CTX_get0_certificate(const SSL_CTX *ctx); +__owur EVP_PKEY *SSL_CTX_get0_privatekey(const SSL_CTX *ctx); + +void SSL_CTX_set_quiet_shutdown(SSL_CTX *ctx, int mode); +__owur int SSL_CTX_get_quiet_shutdown(const SSL_CTX *ctx); +void SSL_set_quiet_shutdown(SSL *ssl, int mode); +__owur int SSL_get_quiet_shutdown(const SSL *ssl); +void SSL_set_shutdown(SSL *ssl, int mode); +__owur int SSL_get_shutdown(const SSL *ssl); +__owur int SSL_version(const SSL *ssl); +__owur int SSL_client_version(const SSL *s); +__owur int SSL_CTX_set_default_verify_paths(SSL_CTX *ctx); +__owur int SSL_CTX_set_default_verify_dir(SSL_CTX *ctx); +__owur int SSL_CTX_set_default_verify_file(SSL_CTX *ctx); +__owur int SSL_CTX_load_verify_locations(SSL_CTX *ctx, const char *CAfile, + const char *CApath); +# define SSL_get0_session SSL_get_session/* just peek at pointer */ +__owur SSL_SESSION *SSL_get_session(const SSL *ssl); +__owur SSL_SESSION *SSL_get1_session(SSL *ssl); /* obtain a reference count */ +__owur SSL_CTX *SSL_get_SSL_CTX(const SSL *ssl); +SSL_CTX *SSL_set_SSL_CTX(SSL *ssl, SSL_CTX *ctx); +void SSL_set_info_callback(SSL *ssl, + void (*cb) (const SSL *ssl, int type, int val)); +void (*SSL_get_info_callback(const SSL *ssl)) (const SSL *ssl, int type, + int val); +__owur OSSL_HANDSHAKE_STATE SSL_get_state(const SSL *ssl); + +void SSL_set_verify_result(SSL *ssl, long v); +__owur long SSL_get_verify_result(const SSL *ssl); +__owur STACK_OF(X509) *SSL_get0_verified_chain(const SSL *s); + +__owur size_t SSL_get_client_random(const SSL *ssl, unsigned char *out, + size_t outlen); +__owur size_t SSL_get_server_random(const SSL *ssl, unsigned char *out, + size_t outlen); +__owur size_t SSL_SESSION_get_master_key(const SSL_SESSION *sess, + unsigned char *out, size_t outlen); +__owur int SSL_SESSION_set1_master_key(SSL_SESSION *sess, + const unsigned char *in, size_t len); +uint8_t SSL_SESSION_get_max_fragment_length(const SSL_SESSION *sess); + +#define SSL_get_ex_new_index(l, p, newf, dupf, freef) \ + CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_SSL, l, p, newf, dupf, freef) +__owur int SSL_set_ex_data(SSL *ssl, int idx, void *data); +void *SSL_get_ex_data(const SSL *ssl, int idx); +#define SSL_SESSION_get_ex_new_index(l, p, newf, dupf, freef) \ + CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_SSL_SESSION, l, p, newf, dupf, freef) +__owur int SSL_SESSION_set_ex_data(SSL_SESSION *ss, int idx, void *data); +void *SSL_SESSION_get_ex_data(const SSL_SESSION *ss, int idx); +#define SSL_CTX_get_ex_new_index(l, p, newf, dupf, freef) \ + CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_SSL_CTX, l, p, newf, dupf, freef) +__owur int SSL_CTX_set_ex_data(SSL_CTX *ssl, int idx, void *data); +void *SSL_CTX_get_ex_data(const SSL_CTX *ssl, int idx); + +__owur int SSL_get_ex_data_X509_STORE_CTX_idx(void); + +# define SSL_CTX_sess_set_cache_size(ctx,t) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SESS_CACHE_SIZE,t,NULL) +# define SSL_CTX_sess_get_cache_size(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_GET_SESS_CACHE_SIZE,0,NULL) +# define SSL_CTX_set_session_cache_mode(ctx,m) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SESS_CACHE_MODE,m,NULL) +# define SSL_CTX_get_session_cache_mode(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_GET_SESS_CACHE_MODE,0,NULL) + +# define SSL_CTX_get_default_read_ahead(ctx) SSL_CTX_get_read_ahead(ctx) +# define SSL_CTX_set_default_read_ahead(ctx,m) SSL_CTX_set_read_ahead(ctx,m) +# define SSL_CTX_get_read_ahead(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_GET_READ_AHEAD,0,NULL) +# define SSL_CTX_set_read_ahead(ctx,m) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_READ_AHEAD,m,NULL) +# define SSL_CTX_get_max_cert_list(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_GET_MAX_CERT_LIST,0,NULL) +# define SSL_CTX_set_max_cert_list(ctx,m) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_MAX_CERT_LIST,m,NULL) +# define SSL_get_max_cert_list(ssl) \ + SSL_ctrl(ssl,SSL_CTRL_GET_MAX_CERT_LIST,0,NULL) +# define SSL_set_max_cert_list(ssl,m) \ + SSL_ctrl(ssl,SSL_CTRL_SET_MAX_CERT_LIST,m,NULL) + +# define SSL_CTX_set_max_send_fragment(ctx,m) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_MAX_SEND_FRAGMENT,m,NULL) +# define SSL_set_max_send_fragment(ssl,m) \ + SSL_ctrl(ssl,SSL_CTRL_SET_MAX_SEND_FRAGMENT,m,NULL) +# define SSL_CTX_set_split_send_fragment(ctx,m) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SPLIT_SEND_FRAGMENT,m,NULL) +# define SSL_set_split_send_fragment(ssl,m) \ + SSL_ctrl(ssl,SSL_CTRL_SET_SPLIT_SEND_FRAGMENT,m,NULL) +# define SSL_CTX_set_max_pipelines(ctx,m) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_MAX_PIPELINES,m,NULL) +# define SSL_set_max_pipelines(ssl,m) \ + SSL_ctrl(ssl,SSL_CTRL_SET_MAX_PIPELINES,m,NULL) + +void SSL_CTX_set_default_read_buffer_len(SSL_CTX *ctx, size_t len); +void SSL_set_default_read_buffer_len(SSL *s, size_t len); + +# ifndef OPENSSL_NO_DH +/* NB: the |keylength| is only applicable when is_export is true */ +void SSL_CTX_set_tmp_dh_callback(SSL_CTX *ctx, + DH *(*dh) (SSL *ssl, int is_export, + int keylength)); +void SSL_set_tmp_dh_callback(SSL *ssl, + DH *(*dh) (SSL *ssl, int is_export, + int keylength)); +# endif + +__owur const COMP_METHOD *SSL_get_current_compression(const SSL *s); +__owur const COMP_METHOD *SSL_get_current_expansion(const SSL *s); +__owur const char *SSL_COMP_get_name(const COMP_METHOD *comp); +__owur const char *SSL_COMP_get0_name(const SSL_COMP *comp); +__owur int SSL_COMP_get_id(const SSL_COMP *comp); +STACK_OF(SSL_COMP) *SSL_COMP_get_compression_methods(void); +__owur STACK_OF(SSL_COMP) *SSL_COMP_set0_compression_methods(STACK_OF(SSL_COMP) + *meths); +# if OPENSSL_API_COMPAT < 0x10100000L +# define SSL_COMP_free_compression_methods() while(0) continue +# endif +__owur int SSL_COMP_add_compression_method(int id, COMP_METHOD *cm); + +const SSL_CIPHER *SSL_CIPHER_find(SSL *ssl, const unsigned char *ptr); +int SSL_CIPHER_get_cipher_nid(const SSL_CIPHER *c); +int SSL_CIPHER_get_digest_nid(const SSL_CIPHER *c); +int SSL_bytes_to_cipher_list(SSL *s, const unsigned char *bytes, size_t len, + int isv2format, STACK_OF(SSL_CIPHER) **sk, + STACK_OF(SSL_CIPHER) **scsvs); + +/* TLS extensions functions */ +__owur int SSL_set_session_ticket_ext(SSL *s, void *ext_data, int ext_len); + +__owur int SSL_set_session_ticket_ext_cb(SSL *s, + tls_session_ticket_ext_cb_fn cb, + void *arg); + +/* Pre-shared secret session resumption functions */ +__owur int SSL_set_session_secret_cb(SSL *s, + tls_session_secret_cb_fn session_secret_cb, + void *arg); + +void SSL_CTX_set_not_resumable_session_callback(SSL_CTX *ctx, + int (*cb) (SSL *ssl, + int + is_forward_secure)); + +void SSL_set_not_resumable_session_callback(SSL *ssl, + int (*cb) (SSL *ssl, + int is_forward_secure)); + +void SSL_CTX_set_record_padding_callback(SSL_CTX *ctx, + size_t (*cb) (SSL *ssl, int type, + size_t len, void *arg)); +void SSL_CTX_set_record_padding_callback_arg(SSL_CTX *ctx, void *arg); +void *SSL_CTX_get_record_padding_callback_arg(const SSL_CTX *ctx); +int SSL_CTX_set_block_padding(SSL_CTX *ctx, size_t block_size); + +void SSL_set_record_padding_callback(SSL *ssl, + size_t (*cb) (SSL *ssl, int type, + size_t len, void *arg)); +void SSL_set_record_padding_callback_arg(SSL *ssl, void *arg); +void *SSL_get_record_padding_callback_arg(const SSL *ssl); +int SSL_set_block_padding(SSL *ssl, size_t block_size); + +int SSL_set_num_tickets(SSL *s, size_t num_tickets); +size_t SSL_get_num_tickets(const SSL *s); +int SSL_CTX_set_num_tickets(SSL_CTX *ctx, size_t num_tickets); +size_t SSL_CTX_get_num_tickets(const SSL_CTX *ctx); + +# if OPENSSL_API_COMPAT < 0x10100000L +# define SSL_cache_hit(s) SSL_session_reused(s) +# endif + +__owur int SSL_session_reused(const SSL *s); +__owur int SSL_is_server(const SSL *s); + +__owur __owur SSL_CONF_CTX *SSL_CONF_CTX_new(void); +int SSL_CONF_CTX_finish(SSL_CONF_CTX *cctx); +void SSL_CONF_CTX_free(SSL_CONF_CTX *cctx); +unsigned int SSL_CONF_CTX_set_flags(SSL_CONF_CTX *cctx, unsigned int flags); +__owur unsigned int SSL_CONF_CTX_clear_flags(SSL_CONF_CTX *cctx, + unsigned int flags); +__owur int SSL_CONF_CTX_set1_prefix(SSL_CONF_CTX *cctx, const char *pre); + +void SSL_CONF_CTX_set_ssl(SSL_CONF_CTX *cctx, SSL *ssl); +void SSL_CONF_CTX_set_ssl_ctx(SSL_CONF_CTX *cctx, SSL_CTX *ctx); + +__owur int SSL_CONF_cmd(SSL_CONF_CTX *cctx, const char *cmd, const char *value); +__owur int SSL_CONF_cmd_argv(SSL_CONF_CTX *cctx, int *pargc, char ***pargv); +__owur int SSL_CONF_cmd_value_type(SSL_CONF_CTX *cctx, const char *cmd); + +void SSL_add_ssl_module(void); +int SSL_config(SSL *s, const char *name); +int SSL_CTX_config(SSL_CTX *ctx, const char *name); + +# ifndef OPENSSL_NO_SSL_TRACE +void SSL_trace(int write_p, int version, int content_type, + const void *buf, size_t len, SSL *ssl, void *arg); +# endif + +# ifndef OPENSSL_NO_SOCK +int DTLSv1_listen(SSL *s, BIO_ADDR *client); +# endif + +# ifndef OPENSSL_NO_CT + +/* + * A callback for verifying that the received SCTs are sufficient. + * Expected to return 1 if they are sufficient, otherwise 0. + * May return a negative integer if an error occurs. + * A connection should be aborted if the SCTs are deemed insufficient. + */ +typedef int (*ssl_ct_validation_cb)(const CT_POLICY_EVAL_CTX *ctx, + const STACK_OF(SCT) *scts, void *arg); + +/* + * Sets a |callback| that is invoked upon receipt of ServerHelloDone to validate + * the received SCTs. + * If the callback returns a non-positive result, the connection is terminated. + * Call this function before beginning a handshake. + * If a NULL |callback| is provided, SCT validation is disabled. + * |arg| is arbitrary userdata that will be passed to the callback whenever it + * is invoked. Ownership of |arg| remains with the caller. + * + * NOTE: A side-effect of setting a CT callback is that an OCSP stapled response + * will be requested. + */ +int SSL_set_ct_validation_callback(SSL *s, ssl_ct_validation_cb callback, + void *arg); +int SSL_CTX_set_ct_validation_callback(SSL_CTX *ctx, + ssl_ct_validation_cb callback, + void *arg); +#define SSL_disable_ct(s) \ + ((void) SSL_set_validation_callback((s), NULL, NULL)) +#define SSL_CTX_disable_ct(ctx) \ + ((void) SSL_CTX_set_validation_callback((ctx), NULL, NULL)) + +/* + * The validation type enumerates the available behaviours of the built-in SSL + * CT validation callback selected via SSL_enable_ct() and SSL_CTX_enable_ct(). + * The underlying callback is a static function in libssl. + */ +enum { + SSL_CT_VALIDATION_PERMISSIVE = 0, + SSL_CT_VALIDATION_STRICT +}; + +/* + * Enable CT by setting up a callback that implements one of the built-in + * validation variants. The SSL_CT_VALIDATION_PERMISSIVE variant always + * continues the handshake, the application can make appropriate decisions at + * handshake completion. The SSL_CT_VALIDATION_STRICT variant requires at + * least one valid SCT, or else handshake termination will be requested. The + * handshake may continue anyway if SSL_VERIFY_NONE is in effect. + */ +int SSL_enable_ct(SSL *s, int validation_mode); +int SSL_CTX_enable_ct(SSL_CTX *ctx, int validation_mode); + +/* + * Report whether a non-NULL callback is enabled. + */ +int SSL_ct_is_enabled(const SSL *s); +int SSL_CTX_ct_is_enabled(const SSL_CTX *ctx); + +/* Gets the SCTs received from a connection */ +const STACK_OF(SCT) *SSL_get0_peer_scts(SSL *s); + +/* + * Loads the CT log list from the default location. + * If a CTLOG_STORE has previously been set using SSL_CTX_set_ctlog_store, + * the log information loaded from this file will be appended to the + * CTLOG_STORE. + * Returns 1 on success, 0 otherwise. + */ +int SSL_CTX_set_default_ctlog_list_file(SSL_CTX *ctx); + +/* + * Loads the CT log list from the specified file path. + * If a CTLOG_STORE has previously been set using SSL_CTX_set_ctlog_store, + * the log information loaded from this file will be appended to the + * CTLOG_STORE. + * Returns 1 on success, 0 otherwise. + */ +int SSL_CTX_set_ctlog_list_file(SSL_CTX *ctx, const char *path); + +/* + * Sets the CT log list used by all SSL connections created from this SSL_CTX. + * Ownership of the CTLOG_STORE is transferred to the SSL_CTX. + */ +void SSL_CTX_set0_ctlog_store(SSL_CTX *ctx, CTLOG_STORE *logs); + +/* + * Gets the CT log list used by all SSL connections created from this SSL_CTX. + * This will be NULL unless one of the following functions has been called: + * - SSL_CTX_set_default_ctlog_list_file + * - SSL_CTX_set_ctlog_list_file + * - SSL_CTX_set_ctlog_store + */ +const CTLOG_STORE *SSL_CTX_get0_ctlog_store(const SSL_CTX *ctx); + +# endif /* OPENSSL_NO_CT */ + +/* What the "other" parameter contains in security callback */ +/* Mask for type */ +# define SSL_SECOP_OTHER_TYPE 0xffff0000 +# define SSL_SECOP_OTHER_NONE 0 +# define SSL_SECOP_OTHER_CIPHER (1 << 16) +# define SSL_SECOP_OTHER_CURVE (2 << 16) +# define SSL_SECOP_OTHER_DH (3 << 16) +# define SSL_SECOP_OTHER_PKEY (4 << 16) +# define SSL_SECOP_OTHER_SIGALG (5 << 16) +# define SSL_SECOP_OTHER_CERT (6 << 16) + +/* Indicated operation refers to peer key or certificate */ +# define SSL_SECOP_PEER 0x1000 + +/* Values for "op" parameter in security callback */ + +/* Called to filter ciphers */ +/* Ciphers client supports */ +# define SSL_SECOP_CIPHER_SUPPORTED (1 | SSL_SECOP_OTHER_CIPHER) +/* Cipher shared by client/server */ +# define SSL_SECOP_CIPHER_SHARED (2 | SSL_SECOP_OTHER_CIPHER) +/* Sanity check of cipher server selects */ +# define SSL_SECOP_CIPHER_CHECK (3 | SSL_SECOP_OTHER_CIPHER) +/* Curves supported by client */ +# define SSL_SECOP_CURVE_SUPPORTED (4 | SSL_SECOP_OTHER_CURVE) +/* Curves shared by client/server */ +# define SSL_SECOP_CURVE_SHARED (5 | SSL_SECOP_OTHER_CURVE) +/* Sanity check of curve server selects */ +# define SSL_SECOP_CURVE_CHECK (6 | SSL_SECOP_OTHER_CURVE) +/* Temporary DH key */ +# define SSL_SECOP_TMP_DH (7 | SSL_SECOP_OTHER_PKEY) +/* SSL/TLS version */ +# define SSL_SECOP_VERSION (9 | SSL_SECOP_OTHER_NONE) +/* Session tickets */ +# define SSL_SECOP_TICKET (10 | SSL_SECOP_OTHER_NONE) +/* Supported signature algorithms sent to peer */ +# define SSL_SECOP_SIGALG_SUPPORTED (11 | SSL_SECOP_OTHER_SIGALG) +/* Shared signature algorithm */ +# define SSL_SECOP_SIGALG_SHARED (12 | SSL_SECOP_OTHER_SIGALG) +/* Sanity check signature algorithm allowed */ +# define SSL_SECOP_SIGALG_CHECK (13 | SSL_SECOP_OTHER_SIGALG) +/* Used to get mask of supported public key signature algorithms */ +# define SSL_SECOP_SIGALG_MASK (14 | SSL_SECOP_OTHER_SIGALG) +/* Use to see if compression is allowed */ +# define SSL_SECOP_COMPRESSION (15 | SSL_SECOP_OTHER_NONE) +/* EE key in certificate */ +# define SSL_SECOP_EE_KEY (16 | SSL_SECOP_OTHER_CERT) +/* CA key in certificate */ +# define SSL_SECOP_CA_KEY (17 | SSL_SECOP_OTHER_CERT) +/* CA digest algorithm in certificate */ +# define SSL_SECOP_CA_MD (18 | SSL_SECOP_OTHER_CERT) +/* Peer EE key in certificate */ +# define SSL_SECOP_PEER_EE_KEY (SSL_SECOP_EE_KEY | SSL_SECOP_PEER) +/* Peer CA key in certificate */ +# define SSL_SECOP_PEER_CA_KEY (SSL_SECOP_CA_KEY | SSL_SECOP_PEER) +/* Peer CA digest algorithm in certificate */ +# define SSL_SECOP_PEER_CA_MD (SSL_SECOP_CA_MD | SSL_SECOP_PEER) + +void SSL_set_security_level(SSL *s, int level); +__owur int SSL_get_security_level(const SSL *s); +void SSL_set_security_callback(SSL *s, + int (*cb) (const SSL *s, const SSL_CTX *ctx, + int op, int bits, int nid, + void *other, void *ex)); +int (*SSL_get_security_callback(const SSL *s)) (const SSL *s, + const SSL_CTX *ctx, int op, + int bits, int nid, void *other, + void *ex); +void SSL_set0_security_ex_data(SSL *s, void *ex); +__owur void *SSL_get0_security_ex_data(const SSL *s); + +void SSL_CTX_set_security_level(SSL_CTX *ctx, int level); +__owur int SSL_CTX_get_security_level(const SSL_CTX *ctx); +void SSL_CTX_set_security_callback(SSL_CTX *ctx, + int (*cb) (const SSL *s, const SSL_CTX *ctx, + int op, int bits, int nid, + void *other, void *ex)); +int (*SSL_CTX_get_security_callback(const SSL_CTX *ctx)) (const SSL *s, + const SSL_CTX *ctx, + int op, int bits, + int nid, + void *other, + void *ex); +void SSL_CTX_set0_security_ex_data(SSL_CTX *ctx, void *ex); +__owur void *SSL_CTX_get0_security_ex_data(const SSL_CTX *ctx); + +/* OPENSSL_INIT flag 0x010000 reserved for internal use */ +# define OPENSSL_INIT_NO_LOAD_SSL_STRINGS 0x00100000L +# define OPENSSL_INIT_LOAD_SSL_STRINGS 0x00200000L + +# define OPENSSL_INIT_SSL_DEFAULT \ + (OPENSSL_INIT_LOAD_SSL_STRINGS | OPENSSL_INIT_LOAD_CRYPTO_STRINGS) + +int OPENSSL_init_ssl(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings); + +# ifndef OPENSSL_NO_UNIT_TEST +__owur const struct openssl_ssl_test_functions *SSL_test_functions(void); +# endif + +__owur int SSL_free_buffers(SSL *ssl); +__owur int SSL_alloc_buffers(SSL *ssl); + +/* Status codes passed to the decrypt session ticket callback. Some of these + * are for internal use only and are never passed to the callback. */ +typedef int SSL_TICKET_STATUS; + +/* Support for ticket appdata */ +/* fatal error, malloc failure */ +# define SSL_TICKET_FATAL_ERR_MALLOC 0 +/* fatal error, either from parsing or decrypting the ticket */ +# define SSL_TICKET_FATAL_ERR_OTHER 1 +/* No ticket present */ +# define SSL_TICKET_NONE 2 +/* Empty ticket present */ +# define SSL_TICKET_EMPTY 3 +/* the ticket couldn't be decrypted */ +# define SSL_TICKET_NO_DECRYPT 4 +/* a ticket was successfully decrypted */ +# define SSL_TICKET_SUCCESS 5 +/* same as above but the ticket needs to be renewed */ +# define SSL_TICKET_SUCCESS_RENEW 6 + +/* Return codes for the decrypt session ticket callback */ +typedef int SSL_TICKET_RETURN; + +/* An error occurred */ +#define SSL_TICKET_RETURN_ABORT 0 +/* Do not use the ticket, do not send a renewed ticket to the client */ +#define SSL_TICKET_RETURN_IGNORE 1 +/* Do not use the ticket, send a renewed ticket to the client */ +#define SSL_TICKET_RETURN_IGNORE_RENEW 2 +/* Use the ticket, do not send a renewed ticket to the client */ +#define SSL_TICKET_RETURN_USE 3 +/* Use the ticket, send a renewed ticket to the client */ +#define SSL_TICKET_RETURN_USE_RENEW 4 + +typedef int (*SSL_CTX_generate_session_ticket_fn)(SSL *s, void *arg); +typedef SSL_TICKET_RETURN (*SSL_CTX_decrypt_session_ticket_fn)(SSL *s, SSL_SESSION *ss, + const unsigned char *keyname, + size_t keyname_length, + SSL_TICKET_STATUS status, + void *arg); +int SSL_CTX_set_session_ticket_cb(SSL_CTX *ctx, + SSL_CTX_generate_session_ticket_fn gen_cb, + SSL_CTX_decrypt_session_ticket_fn dec_cb, + void *arg); +int SSL_SESSION_set1_ticket_appdata(SSL_SESSION *ss, const void *data, size_t len); +int SSL_SESSION_get0_ticket_appdata(SSL_SESSION *ss, void **data, size_t *len); + +extern const char SSL_version_str[]; + +typedef unsigned int (*DTLS_timer_cb)(SSL *s, unsigned int timer_us); + +void DTLS_set_timer_cb(SSL *s, DTLS_timer_cb cb); + + +typedef int (*SSL_allow_early_data_cb_fn)(SSL *s, void *arg); +void SSL_CTX_set_allow_early_data_cb(SSL_CTX *ctx, + SSL_allow_early_data_cb_fn cb, + void *arg); +void SSL_set_allow_early_data_cb(SSL *s, + SSL_allow_early_data_cb_fn cb, + void *arg); + +# ifdef __cplusplus +} +# endif +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/ssl2.h b/MediaClient/MediaClient/openssl/include/openssl/ssl2.h new file mode 100644 index 0000000..5321bd2 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/ssl2.h @@ -0,0 +1,24 @@ +/* + * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_SSL2_H +# define HEADER_SSL2_H + +#ifdef __cplusplus +extern "C" { +#endif + +# define SSL2_VERSION 0x0002 + +# define SSL2_MT_CLIENT_HELLO 1 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/ssl3.h b/MediaClient/MediaClient/openssl/include/openssl/ssl3.h new file mode 100644 index 0000000..8d01fcc --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/ssl3.h @@ -0,0 +1,339 @@ +/* + * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. + * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_SSL3_H +# define HEADER_SSL3_H + +# include +# include +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Signalling cipher suite value from RFC 5746 + * (TLS_EMPTY_RENEGOTIATION_INFO_SCSV) + */ +# define SSL3_CK_SCSV 0x030000FF + +/* + * Signalling cipher suite value from draft-ietf-tls-downgrade-scsv-00 + * (TLS_FALLBACK_SCSV) + */ +# define SSL3_CK_FALLBACK_SCSV 0x03005600 + +# define SSL3_CK_RSA_NULL_MD5 0x03000001 +# define SSL3_CK_RSA_NULL_SHA 0x03000002 +# define SSL3_CK_RSA_RC4_40_MD5 0x03000003 +# define SSL3_CK_RSA_RC4_128_MD5 0x03000004 +# define SSL3_CK_RSA_RC4_128_SHA 0x03000005 +# define SSL3_CK_RSA_RC2_40_MD5 0x03000006 +# define SSL3_CK_RSA_IDEA_128_SHA 0x03000007 +# define SSL3_CK_RSA_DES_40_CBC_SHA 0x03000008 +# define SSL3_CK_RSA_DES_64_CBC_SHA 0x03000009 +# define SSL3_CK_RSA_DES_192_CBC3_SHA 0x0300000A + +# define SSL3_CK_DH_DSS_DES_40_CBC_SHA 0x0300000B +# define SSL3_CK_DH_DSS_DES_64_CBC_SHA 0x0300000C +# define SSL3_CK_DH_DSS_DES_192_CBC3_SHA 0x0300000D +# define SSL3_CK_DH_RSA_DES_40_CBC_SHA 0x0300000E +# define SSL3_CK_DH_RSA_DES_64_CBC_SHA 0x0300000F +# define SSL3_CK_DH_RSA_DES_192_CBC3_SHA 0x03000010 + +# define SSL3_CK_DHE_DSS_DES_40_CBC_SHA 0x03000011 +# define SSL3_CK_EDH_DSS_DES_40_CBC_SHA SSL3_CK_DHE_DSS_DES_40_CBC_SHA +# define SSL3_CK_DHE_DSS_DES_64_CBC_SHA 0x03000012 +# define SSL3_CK_EDH_DSS_DES_64_CBC_SHA SSL3_CK_DHE_DSS_DES_64_CBC_SHA +# define SSL3_CK_DHE_DSS_DES_192_CBC3_SHA 0x03000013 +# define SSL3_CK_EDH_DSS_DES_192_CBC3_SHA SSL3_CK_DHE_DSS_DES_192_CBC3_SHA +# define SSL3_CK_DHE_RSA_DES_40_CBC_SHA 0x03000014 +# define SSL3_CK_EDH_RSA_DES_40_CBC_SHA SSL3_CK_DHE_RSA_DES_40_CBC_SHA +# define SSL3_CK_DHE_RSA_DES_64_CBC_SHA 0x03000015 +# define SSL3_CK_EDH_RSA_DES_64_CBC_SHA SSL3_CK_DHE_RSA_DES_64_CBC_SHA +# define SSL3_CK_DHE_RSA_DES_192_CBC3_SHA 0x03000016 +# define SSL3_CK_EDH_RSA_DES_192_CBC3_SHA SSL3_CK_DHE_RSA_DES_192_CBC3_SHA + +# define SSL3_CK_ADH_RC4_40_MD5 0x03000017 +# define SSL3_CK_ADH_RC4_128_MD5 0x03000018 +# define SSL3_CK_ADH_DES_40_CBC_SHA 0x03000019 +# define SSL3_CK_ADH_DES_64_CBC_SHA 0x0300001A +# define SSL3_CK_ADH_DES_192_CBC_SHA 0x0300001B + +/* a bundle of RFC standard cipher names, generated from ssl3_ciphers[] */ +# define SSL3_RFC_RSA_NULL_MD5 "TLS_RSA_WITH_NULL_MD5" +# define SSL3_RFC_RSA_NULL_SHA "TLS_RSA_WITH_NULL_SHA" +# define SSL3_RFC_RSA_DES_192_CBC3_SHA "TLS_RSA_WITH_3DES_EDE_CBC_SHA" +# define SSL3_RFC_DHE_DSS_DES_192_CBC3_SHA "TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA" +# define SSL3_RFC_DHE_RSA_DES_192_CBC3_SHA "TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA" +# define SSL3_RFC_ADH_DES_192_CBC_SHA "TLS_DH_anon_WITH_3DES_EDE_CBC_SHA" +# define SSL3_RFC_RSA_IDEA_128_SHA "TLS_RSA_WITH_IDEA_CBC_SHA" +# define SSL3_RFC_RSA_RC4_128_MD5 "TLS_RSA_WITH_RC4_128_MD5" +# define SSL3_RFC_RSA_RC4_128_SHA "TLS_RSA_WITH_RC4_128_SHA" +# define SSL3_RFC_ADH_RC4_128_MD5 "TLS_DH_anon_WITH_RC4_128_MD5" + +# define SSL3_TXT_RSA_NULL_MD5 "NULL-MD5" +# define SSL3_TXT_RSA_NULL_SHA "NULL-SHA" +# define SSL3_TXT_RSA_RC4_40_MD5 "EXP-RC4-MD5" +# define SSL3_TXT_RSA_RC4_128_MD5 "RC4-MD5" +# define SSL3_TXT_RSA_RC4_128_SHA "RC4-SHA" +# define SSL3_TXT_RSA_RC2_40_MD5 "EXP-RC2-CBC-MD5" +# define SSL3_TXT_RSA_IDEA_128_SHA "IDEA-CBC-SHA" +# define SSL3_TXT_RSA_DES_40_CBC_SHA "EXP-DES-CBC-SHA" +# define SSL3_TXT_RSA_DES_64_CBC_SHA "DES-CBC-SHA" +# define SSL3_TXT_RSA_DES_192_CBC3_SHA "DES-CBC3-SHA" + +# define SSL3_TXT_DH_DSS_DES_40_CBC_SHA "EXP-DH-DSS-DES-CBC-SHA" +# define SSL3_TXT_DH_DSS_DES_64_CBC_SHA "DH-DSS-DES-CBC-SHA" +# define SSL3_TXT_DH_DSS_DES_192_CBC3_SHA "DH-DSS-DES-CBC3-SHA" +# define SSL3_TXT_DH_RSA_DES_40_CBC_SHA "EXP-DH-RSA-DES-CBC-SHA" +# define SSL3_TXT_DH_RSA_DES_64_CBC_SHA "DH-RSA-DES-CBC-SHA" +# define SSL3_TXT_DH_RSA_DES_192_CBC3_SHA "DH-RSA-DES-CBC3-SHA" + +# define SSL3_TXT_DHE_DSS_DES_40_CBC_SHA "EXP-DHE-DSS-DES-CBC-SHA" +# define SSL3_TXT_DHE_DSS_DES_64_CBC_SHA "DHE-DSS-DES-CBC-SHA" +# define SSL3_TXT_DHE_DSS_DES_192_CBC3_SHA "DHE-DSS-DES-CBC3-SHA" +# define SSL3_TXT_DHE_RSA_DES_40_CBC_SHA "EXP-DHE-RSA-DES-CBC-SHA" +# define SSL3_TXT_DHE_RSA_DES_64_CBC_SHA "DHE-RSA-DES-CBC-SHA" +# define SSL3_TXT_DHE_RSA_DES_192_CBC3_SHA "DHE-RSA-DES-CBC3-SHA" + +/* + * This next block of six "EDH" labels is for backward compatibility with + * older versions of OpenSSL. New code should use the six "DHE" labels above + * instead: + */ +# define SSL3_TXT_EDH_DSS_DES_40_CBC_SHA "EXP-EDH-DSS-DES-CBC-SHA" +# define SSL3_TXT_EDH_DSS_DES_64_CBC_SHA "EDH-DSS-DES-CBC-SHA" +# define SSL3_TXT_EDH_DSS_DES_192_CBC3_SHA "EDH-DSS-DES-CBC3-SHA" +# define SSL3_TXT_EDH_RSA_DES_40_CBC_SHA "EXP-EDH-RSA-DES-CBC-SHA" +# define SSL3_TXT_EDH_RSA_DES_64_CBC_SHA "EDH-RSA-DES-CBC-SHA" +# define SSL3_TXT_EDH_RSA_DES_192_CBC3_SHA "EDH-RSA-DES-CBC3-SHA" + +# define SSL3_TXT_ADH_RC4_40_MD5 "EXP-ADH-RC4-MD5" +# define SSL3_TXT_ADH_RC4_128_MD5 "ADH-RC4-MD5" +# define SSL3_TXT_ADH_DES_40_CBC_SHA "EXP-ADH-DES-CBC-SHA" +# define SSL3_TXT_ADH_DES_64_CBC_SHA "ADH-DES-CBC-SHA" +# define SSL3_TXT_ADH_DES_192_CBC_SHA "ADH-DES-CBC3-SHA" + +# define SSL3_SSL_SESSION_ID_LENGTH 32 +# define SSL3_MAX_SSL_SESSION_ID_LENGTH 32 + +# define SSL3_MASTER_SECRET_SIZE 48 +# define SSL3_RANDOM_SIZE 32 +# define SSL3_SESSION_ID_SIZE 32 +# define SSL3_RT_HEADER_LENGTH 5 + +# define SSL3_HM_HEADER_LENGTH 4 + +# ifndef SSL3_ALIGN_PAYLOAD + /* + * Some will argue that this increases memory footprint, but it's not + * actually true. Point is that malloc has to return at least 64-bit aligned + * pointers, meaning that allocating 5 bytes wastes 3 bytes in either case. + * Suggested pre-gaping simply moves these wasted bytes from the end of + * allocated region to its front, but makes data payload aligned, which + * improves performance:-) + */ +# define SSL3_ALIGN_PAYLOAD 8 +# else +# if (SSL3_ALIGN_PAYLOAD&(SSL3_ALIGN_PAYLOAD-1))!=0 +# error "insane SSL3_ALIGN_PAYLOAD" +# undef SSL3_ALIGN_PAYLOAD +# endif +# endif + +/* + * This is the maximum MAC (digest) size used by the SSL library. Currently + * maximum of 20 is used by SHA1, but we reserve for future extension for + * 512-bit hashes. + */ + +# define SSL3_RT_MAX_MD_SIZE 64 + +/* + * Maximum block size used in all ciphersuites. Currently 16 for AES. + */ + +# define SSL_RT_MAX_CIPHER_BLOCK_SIZE 16 + +# define SSL3_RT_MAX_EXTRA (16384) + +/* Maximum plaintext length: defined by SSL/TLS standards */ +# define SSL3_RT_MAX_PLAIN_LENGTH 16384 +/* Maximum compression overhead: defined by SSL/TLS standards */ +# define SSL3_RT_MAX_COMPRESSED_OVERHEAD 1024 + +/* + * The standards give a maximum encryption overhead of 1024 bytes. In + * practice the value is lower than this. The overhead is the maximum number + * of padding bytes (256) plus the mac size. + */ +# define SSL3_RT_MAX_ENCRYPTED_OVERHEAD (256 + SSL3_RT_MAX_MD_SIZE) +# define SSL3_RT_MAX_TLS13_ENCRYPTED_OVERHEAD 256 + +/* + * OpenSSL currently only uses a padding length of at most one block so the + * send overhead is smaller. + */ + +# define SSL3_RT_SEND_MAX_ENCRYPTED_OVERHEAD \ + (SSL_RT_MAX_CIPHER_BLOCK_SIZE + SSL3_RT_MAX_MD_SIZE) + +/* If compression isn't used don't include the compression overhead */ + +# ifdef OPENSSL_NO_COMP +# define SSL3_RT_MAX_COMPRESSED_LENGTH SSL3_RT_MAX_PLAIN_LENGTH +# else +# define SSL3_RT_MAX_COMPRESSED_LENGTH \ + (SSL3_RT_MAX_PLAIN_LENGTH+SSL3_RT_MAX_COMPRESSED_OVERHEAD) +# endif +# define SSL3_RT_MAX_ENCRYPTED_LENGTH \ + (SSL3_RT_MAX_ENCRYPTED_OVERHEAD+SSL3_RT_MAX_COMPRESSED_LENGTH) +# define SSL3_RT_MAX_TLS13_ENCRYPTED_LENGTH \ + (SSL3_RT_MAX_PLAIN_LENGTH + SSL3_RT_MAX_TLS13_ENCRYPTED_OVERHEAD) +# define SSL3_RT_MAX_PACKET_SIZE \ + (SSL3_RT_MAX_ENCRYPTED_LENGTH+SSL3_RT_HEADER_LENGTH) + +# define SSL3_MD_CLIENT_FINISHED_CONST "\x43\x4C\x4E\x54" +# define SSL3_MD_SERVER_FINISHED_CONST "\x53\x52\x56\x52" + +# define SSL3_VERSION 0x0300 +# define SSL3_VERSION_MAJOR 0x03 +# define SSL3_VERSION_MINOR 0x00 + +# define SSL3_RT_CHANGE_CIPHER_SPEC 20 +# define SSL3_RT_ALERT 21 +# define SSL3_RT_HANDSHAKE 22 +# define SSL3_RT_APPLICATION_DATA 23 +# define DTLS1_RT_HEARTBEAT 24 + +/* Pseudo content types to indicate additional parameters */ +# define TLS1_RT_CRYPTO 0x1000 +# define TLS1_RT_CRYPTO_PREMASTER (TLS1_RT_CRYPTO | 0x1) +# define TLS1_RT_CRYPTO_CLIENT_RANDOM (TLS1_RT_CRYPTO | 0x2) +# define TLS1_RT_CRYPTO_SERVER_RANDOM (TLS1_RT_CRYPTO | 0x3) +# define TLS1_RT_CRYPTO_MASTER (TLS1_RT_CRYPTO | 0x4) + +# define TLS1_RT_CRYPTO_READ 0x0000 +# define TLS1_RT_CRYPTO_WRITE 0x0100 +# define TLS1_RT_CRYPTO_MAC (TLS1_RT_CRYPTO | 0x5) +# define TLS1_RT_CRYPTO_KEY (TLS1_RT_CRYPTO | 0x6) +# define TLS1_RT_CRYPTO_IV (TLS1_RT_CRYPTO | 0x7) +# define TLS1_RT_CRYPTO_FIXED_IV (TLS1_RT_CRYPTO | 0x8) + +/* Pseudo content types for SSL/TLS header info */ +# define SSL3_RT_HEADER 0x100 +# define SSL3_RT_INNER_CONTENT_TYPE 0x101 + +# define SSL3_AL_WARNING 1 +# define SSL3_AL_FATAL 2 + +# define SSL3_AD_CLOSE_NOTIFY 0 +# define SSL3_AD_UNEXPECTED_MESSAGE 10/* fatal */ +# define SSL3_AD_BAD_RECORD_MAC 20/* fatal */ +# define SSL3_AD_DECOMPRESSION_FAILURE 30/* fatal */ +# define SSL3_AD_HANDSHAKE_FAILURE 40/* fatal */ +# define SSL3_AD_NO_CERTIFICATE 41 +# define SSL3_AD_BAD_CERTIFICATE 42 +# define SSL3_AD_UNSUPPORTED_CERTIFICATE 43 +# define SSL3_AD_CERTIFICATE_REVOKED 44 +# define SSL3_AD_CERTIFICATE_EXPIRED 45 +# define SSL3_AD_CERTIFICATE_UNKNOWN 46 +# define SSL3_AD_ILLEGAL_PARAMETER 47/* fatal */ + +# define TLS1_HB_REQUEST 1 +# define TLS1_HB_RESPONSE 2 + + +# define SSL3_CT_RSA_SIGN 1 +# define SSL3_CT_DSS_SIGN 2 +# define SSL3_CT_RSA_FIXED_DH 3 +# define SSL3_CT_DSS_FIXED_DH 4 +# define SSL3_CT_RSA_EPHEMERAL_DH 5 +# define SSL3_CT_DSS_EPHEMERAL_DH 6 +# define SSL3_CT_FORTEZZA_DMS 20 +/* + * SSL3_CT_NUMBER is used to size arrays and it must be large enough to + * contain all of the cert types defined for *either* SSLv3 and TLSv1. + */ +# define SSL3_CT_NUMBER 10 + +# if defined(TLS_CT_NUMBER) +# if TLS_CT_NUMBER != SSL3_CT_NUMBER +# error "SSL/TLS CT_NUMBER values do not match" +# endif +# endif + +/* No longer used as of OpenSSL 1.1.1 */ +# define SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS 0x0001 + +/* Removed from OpenSSL 1.1.0 */ +# define TLS1_FLAGS_TLS_PADDING_BUG 0x0 + +# define TLS1_FLAGS_SKIP_CERT_VERIFY 0x0010 + +/* Set if we encrypt then mac instead of usual mac then encrypt */ +# define TLS1_FLAGS_ENCRYPT_THEN_MAC_READ 0x0100 +# define TLS1_FLAGS_ENCRYPT_THEN_MAC TLS1_FLAGS_ENCRYPT_THEN_MAC_READ + +/* Set if extended master secret extension received from peer */ +# define TLS1_FLAGS_RECEIVED_EXTMS 0x0200 + +# define TLS1_FLAGS_ENCRYPT_THEN_MAC_WRITE 0x0400 + +# define TLS1_FLAGS_STATELESS 0x0800 + +# define SSL3_MT_HELLO_REQUEST 0 +# define SSL3_MT_CLIENT_HELLO 1 +# define SSL3_MT_SERVER_HELLO 2 +# define SSL3_MT_NEWSESSION_TICKET 4 +# define SSL3_MT_END_OF_EARLY_DATA 5 +# define SSL3_MT_ENCRYPTED_EXTENSIONS 8 +# define SSL3_MT_CERTIFICATE 11 +# define SSL3_MT_SERVER_KEY_EXCHANGE 12 +# define SSL3_MT_CERTIFICATE_REQUEST 13 +# define SSL3_MT_SERVER_DONE 14 +# define SSL3_MT_CERTIFICATE_VERIFY 15 +# define SSL3_MT_CLIENT_KEY_EXCHANGE 16 +# define SSL3_MT_FINISHED 20 +# define SSL3_MT_CERTIFICATE_URL 21 +# define SSL3_MT_CERTIFICATE_STATUS 22 +# define SSL3_MT_SUPPLEMENTAL_DATA 23 +# define SSL3_MT_KEY_UPDATE 24 +# ifndef OPENSSL_NO_NEXTPROTONEG +# define SSL3_MT_NEXT_PROTO 67 +# endif +# define SSL3_MT_MESSAGE_HASH 254 +# define DTLS1_MT_HELLO_VERIFY_REQUEST 3 + +/* Dummy message type for handling CCS like a normal handshake message */ +# define SSL3_MT_CHANGE_CIPHER_SPEC 0x0101 + +# define SSL3_MT_CCS 1 + +/* These are used when changing over to a new cipher */ +# define SSL3_CC_READ 0x001 +# define SSL3_CC_WRITE 0x002 +# define SSL3_CC_CLIENT 0x010 +# define SSL3_CC_SERVER 0x020 +# define SSL3_CC_EARLY 0x040 +# define SSL3_CC_HANDSHAKE 0x080 +# define SSL3_CC_APPLICATION 0x100 +# define SSL3_CHANGE_CIPHER_CLIENT_WRITE (SSL3_CC_CLIENT|SSL3_CC_WRITE) +# define SSL3_CHANGE_CIPHER_SERVER_READ (SSL3_CC_SERVER|SSL3_CC_READ) +# define SSL3_CHANGE_CIPHER_CLIENT_READ (SSL3_CC_CLIENT|SSL3_CC_READ) +# define SSL3_CHANGE_CIPHER_SERVER_WRITE (SSL3_CC_SERVER|SSL3_CC_WRITE) + +#ifdef __cplusplus +} +#endif +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/sslerr.h b/MediaClient/MediaClient/openssl/include/openssl/sslerr.h new file mode 100644 index 0000000..82983d3 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/sslerr.h @@ -0,0 +1,773 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_SSLERR_H +# define HEADER_SSLERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_SSL_strings(void); + +/* + * SSL function codes. + */ +# define SSL_F_ADD_CLIENT_KEY_SHARE_EXT 438 +# define SSL_F_ADD_KEY_SHARE 512 +# define SSL_F_BYTES_TO_CIPHER_LIST 519 +# define SSL_F_CHECK_SUITEB_CIPHER_LIST 331 +# define SSL_F_CIPHERSUITE_CB 622 +# define SSL_F_CONSTRUCT_CA_NAMES 552 +# define SSL_F_CONSTRUCT_KEY_EXCHANGE_TBS 553 +# define SSL_F_CONSTRUCT_STATEFUL_TICKET 636 +# define SSL_F_CONSTRUCT_STATELESS_TICKET 637 +# define SSL_F_CREATE_SYNTHETIC_MESSAGE_HASH 539 +# define SSL_F_CREATE_TICKET_PREQUEL 638 +# define SSL_F_CT_MOVE_SCTS 345 +# define SSL_F_CT_STRICT 349 +# define SSL_F_CUSTOM_EXT_ADD 554 +# define SSL_F_CUSTOM_EXT_PARSE 555 +# define SSL_F_D2I_SSL_SESSION 103 +# define SSL_F_DANE_CTX_ENABLE 347 +# define SSL_F_DANE_MTYPE_SET 393 +# define SSL_F_DANE_TLSA_ADD 394 +# define SSL_F_DERIVE_SECRET_KEY_AND_IV 514 +# define SSL_F_DO_DTLS1_WRITE 245 +# define SSL_F_DO_SSL3_WRITE 104 +# define SSL_F_DTLS1_BUFFER_RECORD 247 +# define SSL_F_DTLS1_CHECK_TIMEOUT_NUM 318 +# define SSL_F_DTLS1_HEARTBEAT 305 +# define SSL_F_DTLS1_HM_FRAGMENT_NEW 623 +# define SSL_F_DTLS1_PREPROCESS_FRAGMENT 288 +# define SSL_F_DTLS1_PROCESS_BUFFERED_RECORDS 424 +# define SSL_F_DTLS1_PROCESS_RECORD 257 +# define SSL_F_DTLS1_READ_BYTES 258 +# define SSL_F_DTLS1_READ_FAILED 339 +# define SSL_F_DTLS1_RETRANSMIT_MESSAGE 390 +# define SSL_F_DTLS1_WRITE_APP_DATA_BYTES 268 +# define SSL_F_DTLS1_WRITE_BYTES 545 +# define SSL_F_DTLSV1_LISTEN 350 +# define SSL_F_DTLS_CONSTRUCT_CHANGE_CIPHER_SPEC 371 +# define SSL_F_DTLS_CONSTRUCT_HELLO_VERIFY_REQUEST 385 +# define SSL_F_DTLS_GET_REASSEMBLED_MESSAGE 370 +# define SSL_F_DTLS_PROCESS_HELLO_VERIFY 386 +# define SSL_F_DTLS_RECORD_LAYER_NEW 635 +# define SSL_F_DTLS_WAIT_FOR_DRY 592 +# define SSL_F_EARLY_DATA_COUNT_OK 532 +# define SSL_F_FINAL_EARLY_DATA 556 +# define SSL_F_FINAL_EC_PT_FORMATS 485 +# define SSL_F_FINAL_EMS 486 +# define SSL_F_FINAL_KEY_SHARE 503 +# define SSL_F_FINAL_MAXFRAGMENTLEN 557 +# define SSL_F_FINAL_RENEGOTIATE 483 +# define SSL_F_FINAL_SERVER_NAME 558 +# define SSL_F_FINAL_SIG_ALGS 497 +# define SSL_F_GET_CERT_VERIFY_TBS_DATA 588 +# define SSL_F_NSS_KEYLOG_INT 500 +# define SSL_F_OPENSSL_INIT_SSL 342 +# define SSL_F_OSSL_STATEM_CLIENT13_READ_TRANSITION 436 +# define SSL_F_OSSL_STATEM_CLIENT13_WRITE_TRANSITION 598 +# define SSL_F_OSSL_STATEM_CLIENT_CONSTRUCT_MESSAGE 430 +# define SSL_F_OSSL_STATEM_CLIENT_POST_PROCESS_MESSAGE 593 +# define SSL_F_OSSL_STATEM_CLIENT_PROCESS_MESSAGE 594 +# define SSL_F_OSSL_STATEM_CLIENT_READ_TRANSITION 417 +# define SSL_F_OSSL_STATEM_CLIENT_WRITE_TRANSITION 599 +# define SSL_F_OSSL_STATEM_SERVER13_READ_TRANSITION 437 +# define SSL_F_OSSL_STATEM_SERVER13_WRITE_TRANSITION 600 +# define SSL_F_OSSL_STATEM_SERVER_CONSTRUCT_MESSAGE 431 +# define SSL_F_OSSL_STATEM_SERVER_POST_PROCESS_MESSAGE 601 +# define SSL_F_OSSL_STATEM_SERVER_POST_WORK 602 +# define SSL_F_OSSL_STATEM_SERVER_PRE_WORK 640 +# define SSL_F_OSSL_STATEM_SERVER_PROCESS_MESSAGE 603 +# define SSL_F_OSSL_STATEM_SERVER_READ_TRANSITION 418 +# define SSL_F_OSSL_STATEM_SERVER_WRITE_TRANSITION 604 +# define SSL_F_PARSE_CA_NAMES 541 +# define SSL_F_PITEM_NEW 624 +# define SSL_F_PQUEUE_NEW 625 +# define SSL_F_PROCESS_KEY_SHARE_EXT 439 +# define SSL_F_READ_STATE_MACHINE 352 +# define SSL_F_SET_CLIENT_CIPHERSUITE 540 +# define SSL_F_SRP_GENERATE_CLIENT_MASTER_SECRET 595 +# define SSL_F_SRP_GENERATE_SERVER_MASTER_SECRET 589 +# define SSL_F_SRP_VERIFY_SERVER_PARAM 596 +# define SSL_F_SSL3_CHANGE_CIPHER_STATE 129 +# define SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM 130 +# define SSL_F_SSL3_CTRL 213 +# define SSL_F_SSL3_CTX_CTRL 133 +# define SSL_F_SSL3_DIGEST_CACHED_RECORDS 293 +# define SSL_F_SSL3_DO_CHANGE_CIPHER_SPEC 292 +# define SSL_F_SSL3_ENC 608 +# define SSL_F_SSL3_FINAL_FINISH_MAC 285 +# define SSL_F_SSL3_FINISH_MAC 587 +# define SSL_F_SSL3_GENERATE_KEY_BLOCK 238 +# define SSL_F_SSL3_GENERATE_MASTER_SECRET 388 +# define SSL_F_SSL3_GET_RECORD 143 +# define SSL_F_SSL3_INIT_FINISHED_MAC 397 +# define SSL_F_SSL3_OUTPUT_CERT_CHAIN 147 +# define SSL_F_SSL3_READ_BYTES 148 +# define SSL_F_SSL3_READ_N 149 +# define SSL_F_SSL3_SETUP_KEY_BLOCK 157 +# define SSL_F_SSL3_SETUP_READ_BUFFER 156 +# define SSL_F_SSL3_SETUP_WRITE_BUFFER 291 +# define SSL_F_SSL3_WRITE_BYTES 158 +# define SSL_F_SSL3_WRITE_PENDING 159 +# define SSL_F_SSL_ADD_CERT_CHAIN 316 +# define SSL_F_SSL_ADD_CERT_TO_BUF 319 +# define SSL_F_SSL_ADD_CERT_TO_WPACKET 493 +# define SSL_F_SSL_ADD_CLIENTHELLO_RENEGOTIATE_EXT 298 +# define SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT 277 +# define SSL_F_SSL_ADD_CLIENTHELLO_USE_SRTP_EXT 307 +# define SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK 215 +# define SSL_F_SSL_ADD_FILE_CERT_SUBJECTS_TO_STACK 216 +# define SSL_F_SSL_ADD_SERVERHELLO_RENEGOTIATE_EXT 299 +# define SSL_F_SSL_ADD_SERVERHELLO_TLSEXT 278 +# define SSL_F_SSL_ADD_SERVERHELLO_USE_SRTP_EXT 308 +# define SSL_F_SSL_BAD_METHOD 160 +# define SSL_F_SSL_BUILD_CERT_CHAIN 332 +# define SSL_F_SSL_BYTES_TO_CIPHER_LIST 161 +# define SSL_F_SSL_CACHE_CIPHERLIST 520 +# define SSL_F_SSL_CERT_ADD0_CHAIN_CERT 346 +# define SSL_F_SSL_CERT_DUP 221 +# define SSL_F_SSL_CERT_NEW 162 +# define SSL_F_SSL_CERT_SET0_CHAIN 340 +# define SSL_F_SSL_CHECK_PRIVATE_KEY 163 +# define SSL_F_SSL_CHECK_SERVERHELLO_TLSEXT 280 +# define SSL_F_SSL_CHECK_SRP_EXT_CLIENTHELLO 606 +# define SSL_F_SSL_CHECK_SRVR_ECC_CERT_AND_ALG 279 +# define SSL_F_SSL_CHOOSE_CLIENT_VERSION 607 +# define SSL_F_SSL_CIPHER_DESCRIPTION 626 +# define SSL_F_SSL_CIPHER_LIST_TO_BYTES 425 +# define SSL_F_SSL_CIPHER_PROCESS_RULESTR 230 +# define SSL_F_SSL_CIPHER_STRENGTH_SORT 231 +# define SSL_F_SSL_CLEAR 164 +# define SSL_F_SSL_CLIENT_HELLO_GET1_EXTENSIONS_PRESENT 627 +# define SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD 165 +# define SSL_F_SSL_CONF_CMD 334 +# define SSL_F_SSL_CREATE_CIPHER_LIST 166 +# define SSL_F_SSL_CTRL 232 +# define SSL_F_SSL_CTX_CHECK_PRIVATE_KEY 168 +# define SSL_F_SSL_CTX_ENABLE_CT 398 +# define SSL_F_SSL_CTX_MAKE_PROFILES 309 +# define SSL_F_SSL_CTX_NEW 169 +# define SSL_F_SSL_CTX_SET_ALPN_PROTOS 343 +# define SSL_F_SSL_CTX_SET_CIPHER_LIST 269 +# define SSL_F_SSL_CTX_SET_CLIENT_CERT_ENGINE 290 +# define SSL_F_SSL_CTX_SET_CT_VALIDATION_CALLBACK 396 +# define SSL_F_SSL_CTX_SET_SESSION_ID_CONTEXT 219 +# define SSL_F_SSL_CTX_SET_SSL_VERSION 170 +# define SSL_F_SSL_CTX_SET_TLSEXT_MAX_FRAGMENT_LENGTH 551 +# define SSL_F_SSL_CTX_USE_CERTIFICATE 171 +# define SSL_F_SSL_CTX_USE_CERTIFICATE_ASN1 172 +# define SSL_F_SSL_CTX_USE_CERTIFICATE_FILE 173 +# define SSL_F_SSL_CTX_USE_PRIVATEKEY 174 +# define SSL_F_SSL_CTX_USE_PRIVATEKEY_ASN1 175 +# define SSL_F_SSL_CTX_USE_PRIVATEKEY_FILE 176 +# define SSL_F_SSL_CTX_USE_PSK_IDENTITY_HINT 272 +# define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY 177 +# define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY_ASN1 178 +# define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY_FILE 179 +# define SSL_F_SSL_CTX_USE_SERVERINFO 336 +# define SSL_F_SSL_CTX_USE_SERVERINFO_EX 543 +# define SSL_F_SSL_CTX_USE_SERVERINFO_FILE 337 +# define SSL_F_SSL_DANE_DUP 403 +# define SSL_F_SSL_DANE_ENABLE 395 +# define SSL_F_SSL_DERIVE 590 +# define SSL_F_SSL_DO_CONFIG 391 +# define SSL_F_SSL_DO_HANDSHAKE 180 +# define SSL_F_SSL_DUP_CA_LIST 408 +# define SSL_F_SSL_ENABLE_CT 402 +# define SSL_F_SSL_GENERATE_PKEY_GROUP 559 +# define SSL_F_SSL_GENERATE_SESSION_ID 547 +# define SSL_F_SSL_GET_NEW_SESSION 181 +# define SSL_F_SSL_GET_PREV_SESSION 217 +# define SSL_F_SSL_GET_SERVER_CERT_INDEX 322 +# define SSL_F_SSL_GET_SIGN_PKEY 183 +# define SSL_F_SSL_HANDSHAKE_HASH 560 +# define SSL_F_SSL_INIT_WBIO_BUFFER 184 +# define SSL_F_SSL_KEY_UPDATE 515 +# define SSL_F_SSL_LOAD_CLIENT_CA_FILE 185 +# define SSL_F_SSL_LOG_MASTER_SECRET 498 +# define SSL_F_SSL_LOG_RSA_CLIENT_KEY_EXCHANGE 499 +# define SSL_F_SSL_MODULE_INIT 392 +# define SSL_F_SSL_NEW 186 +# define SSL_F_SSL_NEXT_PROTO_VALIDATE 565 +# define SSL_F_SSL_PARSE_CLIENTHELLO_RENEGOTIATE_EXT 300 +# define SSL_F_SSL_PARSE_CLIENTHELLO_TLSEXT 302 +# define SSL_F_SSL_PARSE_CLIENTHELLO_USE_SRTP_EXT 310 +# define SSL_F_SSL_PARSE_SERVERHELLO_RENEGOTIATE_EXT 301 +# define SSL_F_SSL_PARSE_SERVERHELLO_TLSEXT 303 +# define SSL_F_SSL_PARSE_SERVERHELLO_USE_SRTP_EXT 311 +# define SSL_F_SSL_PEEK 270 +# define SSL_F_SSL_PEEK_EX 432 +# define SSL_F_SSL_PEEK_INTERNAL 522 +# define SSL_F_SSL_READ 223 +# define SSL_F_SSL_READ_EARLY_DATA 529 +# define SSL_F_SSL_READ_EX 434 +# define SSL_F_SSL_READ_INTERNAL 523 +# define SSL_F_SSL_RENEGOTIATE 516 +# define SSL_F_SSL_RENEGOTIATE_ABBREVIATED 546 +# define SSL_F_SSL_SCAN_CLIENTHELLO_TLSEXT 320 +# define SSL_F_SSL_SCAN_SERVERHELLO_TLSEXT 321 +# define SSL_F_SSL_SESSION_DUP 348 +# define SSL_F_SSL_SESSION_NEW 189 +# define SSL_F_SSL_SESSION_PRINT_FP 190 +# define SSL_F_SSL_SESSION_SET1_ID 423 +# define SSL_F_SSL_SESSION_SET1_ID_CONTEXT 312 +# define SSL_F_SSL_SET_ALPN_PROTOS 344 +# define SSL_F_SSL_SET_CERT 191 +# define SSL_F_SSL_SET_CERT_AND_KEY 621 +# define SSL_F_SSL_SET_CIPHER_LIST 271 +# define SSL_F_SSL_SET_CT_VALIDATION_CALLBACK 399 +# define SSL_F_SSL_SET_FD 192 +# define SSL_F_SSL_SET_PKEY 193 +# define SSL_F_SSL_SET_RFD 194 +# define SSL_F_SSL_SET_SESSION 195 +# define SSL_F_SSL_SET_SESSION_ID_CONTEXT 218 +# define SSL_F_SSL_SET_SESSION_TICKET_EXT 294 +# define SSL_F_SSL_SET_TLSEXT_MAX_FRAGMENT_LENGTH 550 +# define SSL_F_SSL_SET_WFD 196 +# define SSL_F_SSL_SHUTDOWN 224 +# define SSL_F_SSL_SRP_CTX_INIT 313 +# define SSL_F_SSL_START_ASYNC_JOB 389 +# define SSL_F_SSL_UNDEFINED_FUNCTION 197 +# define SSL_F_SSL_UNDEFINED_VOID_FUNCTION 244 +# define SSL_F_SSL_USE_CERTIFICATE 198 +# define SSL_F_SSL_USE_CERTIFICATE_ASN1 199 +# define SSL_F_SSL_USE_CERTIFICATE_FILE 200 +# define SSL_F_SSL_USE_PRIVATEKEY 201 +# define SSL_F_SSL_USE_PRIVATEKEY_ASN1 202 +# define SSL_F_SSL_USE_PRIVATEKEY_FILE 203 +# define SSL_F_SSL_USE_PSK_IDENTITY_HINT 273 +# define SSL_F_SSL_USE_RSAPRIVATEKEY 204 +# define SSL_F_SSL_USE_RSAPRIVATEKEY_ASN1 205 +# define SSL_F_SSL_USE_RSAPRIVATEKEY_FILE 206 +# define SSL_F_SSL_VALIDATE_CT 400 +# define SSL_F_SSL_VERIFY_CERT_CHAIN 207 +# define SSL_F_SSL_VERIFY_CLIENT_POST_HANDSHAKE 616 +# define SSL_F_SSL_WRITE 208 +# define SSL_F_SSL_WRITE_EARLY_DATA 526 +# define SSL_F_SSL_WRITE_EARLY_FINISH 527 +# define SSL_F_SSL_WRITE_EX 433 +# define SSL_F_SSL_WRITE_INTERNAL 524 +# define SSL_F_STATE_MACHINE 353 +# define SSL_F_TLS12_CHECK_PEER_SIGALG 333 +# define SSL_F_TLS12_COPY_SIGALGS 533 +# define SSL_F_TLS13_CHANGE_CIPHER_STATE 440 +# define SSL_F_TLS13_ENC 609 +# define SSL_F_TLS13_FINAL_FINISH_MAC 605 +# define SSL_F_TLS13_GENERATE_SECRET 591 +# define SSL_F_TLS13_HKDF_EXPAND 561 +# define SSL_F_TLS13_RESTORE_HANDSHAKE_DIGEST_FOR_PHA 617 +# define SSL_F_TLS13_SAVE_HANDSHAKE_DIGEST_FOR_PHA 618 +# define SSL_F_TLS13_SETUP_KEY_BLOCK 441 +# define SSL_F_TLS1_CHANGE_CIPHER_STATE 209 +# define SSL_F_TLS1_CHECK_DUPLICATE_EXTENSIONS 341 +# define SSL_F_TLS1_ENC 401 +# define SSL_F_TLS1_EXPORT_KEYING_MATERIAL 314 +# define SSL_F_TLS1_GET_CURVELIST 338 +# define SSL_F_TLS1_PRF 284 +# define SSL_F_TLS1_SAVE_U16 628 +# define SSL_F_TLS1_SETUP_KEY_BLOCK 211 +# define SSL_F_TLS1_SET_GROUPS 629 +# define SSL_F_TLS1_SET_RAW_SIGALGS 630 +# define SSL_F_TLS1_SET_SERVER_SIGALGS 335 +# define SSL_F_TLS1_SET_SHARED_SIGALGS 631 +# define SSL_F_TLS1_SET_SIGALGS 632 +# define SSL_F_TLS_CHOOSE_SIGALG 513 +# define SSL_F_TLS_CLIENT_KEY_EXCHANGE_POST_WORK 354 +# define SSL_F_TLS_COLLECT_EXTENSIONS 435 +# define SSL_F_TLS_CONSTRUCT_CERTIFICATE_AUTHORITIES 542 +# define SSL_F_TLS_CONSTRUCT_CERTIFICATE_REQUEST 372 +# define SSL_F_TLS_CONSTRUCT_CERT_STATUS 429 +# define SSL_F_TLS_CONSTRUCT_CERT_STATUS_BODY 494 +# define SSL_F_TLS_CONSTRUCT_CERT_VERIFY 496 +# define SSL_F_TLS_CONSTRUCT_CHANGE_CIPHER_SPEC 427 +# define SSL_F_TLS_CONSTRUCT_CKE_DHE 404 +# define SSL_F_TLS_CONSTRUCT_CKE_ECDHE 405 +# define SSL_F_TLS_CONSTRUCT_CKE_GOST 406 +# define SSL_F_TLS_CONSTRUCT_CKE_PSK_PREAMBLE 407 +# define SSL_F_TLS_CONSTRUCT_CKE_RSA 409 +# define SSL_F_TLS_CONSTRUCT_CKE_SRP 410 +# define SSL_F_TLS_CONSTRUCT_CLIENT_CERTIFICATE 484 +# define SSL_F_TLS_CONSTRUCT_CLIENT_HELLO 487 +# define SSL_F_TLS_CONSTRUCT_CLIENT_KEY_EXCHANGE 488 +# define SSL_F_TLS_CONSTRUCT_CLIENT_VERIFY 489 +# define SSL_F_TLS_CONSTRUCT_CTOS_ALPN 466 +# define SSL_F_TLS_CONSTRUCT_CTOS_CERTIFICATE 355 +# define SSL_F_TLS_CONSTRUCT_CTOS_COOKIE 535 +# define SSL_F_TLS_CONSTRUCT_CTOS_EARLY_DATA 530 +# define SSL_F_TLS_CONSTRUCT_CTOS_EC_PT_FORMATS 467 +# define SSL_F_TLS_CONSTRUCT_CTOS_EMS 468 +# define SSL_F_TLS_CONSTRUCT_CTOS_ETM 469 +# define SSL_F_TLS_CONSTRUCT_CTOS_HELLO 356 +# define SSL_F_TLS_CONSTRUCT_CTOS_KEY_EXCHANGE 357 +# define SSL_F_TLS_CONSTRUCT_CTOS_KEY_SHARE 470 +# define SSL_F_TLS_CONSTRUCT_CTOS_MAXFRAGMENTLEN 549 +# define SSL_F_TLS_CONSTRUCT_CTOS_NPN 471 +# define SSL_F_TLS_CONSTRUCT_CTOS_PADDING 472 +# define SSL_F_TLS_CONSTRUCT_CTOS_POST_HANDSHAKE_AUTH 619 +# define SSL_F_TLS_CONSTRUCT_CTOS_PSK 501 +# define SSL_F_TLS_CONSTRUCT_CTOS_PSK_KEX_MODES 509 +# define SSL_F_TLS_CONSTRUCT_CTOS_RENEGOTIATE 473 +# define SSL_F_TLS_CONSTRUCT_CTOS_SCT 474 +# define SSL_F_TLS_CONSTRUCT_CTOS_SERVER_NAME 475 +# define SSL_F_TLS_CONSTRUCT_CTOS_SESSION_TICKET 476 +# define SSL_F_TLS_CONSTRUCT_CTOS_SIG_ALGS 477 +# define SSL_F_TLS_CONSTRUCT_CTOS_SRP 478 +# define SSL_F_TLS_CONSTRUCT_CTOS_STATUS_REQUEST 479 +# define SSL_F_TLS_CONSTRUCT_CTOS_SUPPORTED_GROUPS 480 +# define SSL_F_TLS_CONSTRUCT_CTOS_SUPPORTED_VERSIONS 481 +# define SSL_F_TLS_CONSTRUCT_CTOS_USE_SRTP 482 +# define SSL_F_TLS_CONSTRUCT_CTOS_VERIFY 358 +# define SSL_F_TLS_CONSTRUCT_ENCRYPTED_EXTENSIONS 443 +# define SSL_F_TLS_CONSTRUCT_END_OF_EARLY_DATA 536 +# define SSL_F_TLS_CONSTRUCT_EXTENSIONS 447 +# define SSL_F_TLS_CONSTRUCT_FINISHED 359 +# define SSL_F_TLS_CONSTRUCT_HELLO_REQUEST 373 +# define SSL_F_TLS_CONSTRUCT_HELLO_RETRY_REQUEST 510 +# define SSL_F_TLS_CONSTRUCT_KEY_UPDATE 517 +# define SSL_F_TLS_CONSTRUCT_NEW_SESSION_TICKET 428 +# define SSL_F_TLS_CONSTRUCT_NEXT_PROTO 426 +# define SSL_F_TLS_CONSTRUCT_SERVER_CERTIFICATE 490 +# define SSL_F_TLS_CONSTRUCT_SERVER_HELLO 491 +# define SSL_F_TLS_CONSTRUCT_SERVER_KEY_EXCHANGE 492 +# define SSL_F_TLS_CONSTRUCT_STOC_ALPN 451 +# define SSL_F_TLS_CONSTRUCT_STOC_CERTIFICATE 374 +# define SSL_F_TLS_CONSTRUCT_STOC_COOKIE 613 +# define SSL_F_TLS_CONSTRUCT_STOC_CRYPTOPRO_BUG 452 +# define SSL_F_TLS_CONSTRUCT_STOC_DONE 375 +# define SSL_F_TLS_CONSTRUCT_STOC_EARLY_DATA 531 +# define SSL_F_TLS_CONSTRUCT_STOC_EARLY_DATA_INFO 525 +# define SSL_F_TLS_CONSTRUCT_STOC_EC_PT_FORMATS 453 +# define SSL_F_TLS_CONSTRUCT_STOC_EMS 454 +# define SSL_F_TLS_CONSTRUCT_STOC_ETM 455 +# define SSL_F_TLS_CONSTRUCT_STOC_HELLO 376 +# define SSL_F_TLS_CONSTRUCT_STOC_KEY_EXCHANGE 377 +# define SSL_F_TLS_CONSTRUCT_STOC_KEY_SHARE 456 +# define SSL_F_TLS_CONSTRUCT_STOC_MAXFRAGMENTLEN 548 +# define SSL_F_TLS_CONSTRUCT_STOC_NEXT_PROTO_NEG 457 +# define SSL_F_TLS_CONSTRUCT_STOC_PSK 504 +# define SSL_F_TLS_CONSTRUCT_STOC_RENEGOTIATE 458 +# define SSL_F_TLS_CONSTRUCT_STOC_SERVER_NAME 459 +# define SSL_F_TLS_CONSTRUCT_STOC_SESSION_TICKET 460 +# define SSL_F_TLS_CONSTRUCT_STOC_STATUS_REQUEST 461 +# define SSL_F_TLS_CONSTRUCT_STOC_SUPPORTED_GROUPS 544 +# define SSL_F_TLS_CONSTRUCT_STOC_SUPPORTED_VERSIONS 611 +# define SSL_F_TLS_CONSTRUCT_STOC_USE_SRTP 462 +# define SSL_F_TLS_EARLY_POST_PROCESS_CLIENT_HELLO 521 +# define SSL_F_TLS_FINISH_HANDSHAKE 597 +# define SSL_F_TLS_GET_MESSAGE_BODY 351 +# define SSL_F_TLS_GET_MESSAGE_HEADER 387 +# define SSL_F_TLS_HANDLE_ALPN 562 +# define SSL_F_TLS_HANDLE_STATUS_REQUEST 563 +# define SSL_F_TLS_PARSE_CERTIFICATE_AUTHORITIES 566 +# define SSL_F_TLS_PARSE_CLIENTHELLO_TLSEXT 449 +# define SSL_F_TLS_PARSE_CTOS_ALPN 567 +# define SSL_F_TLS_PARSE_CTOS_COOKIE 614 +# define SSL_F_TLS_PARSE_CTOS_EARLY_DATA 568 +# define SSL_F_TLS_PARSE_CTOS_EC_PT_FORMATS 569 +# define SSL_F_TLS_PARSE_CTOS_EMS 570 +# define SSL_F_TLS_PARSE_CTOS_KEY_SHARE 463 +# define SSL_F_TLS_PARSE_CTOS_MAXFRAGMENTLEN 571 +# define SSL_F_TLS_PARSE_CTOS_POST_HANDSHAKE_AUTH 620 +# define SSL_F_TLS_PARSE_CTOS_PSK 505 +# define SSL_F_TLS_PARSE_CTOS_PSK_KEX_MODES 572 +# define SSL_F_TLS_PARSE_CTOS_RENEGOTIATE 464 +# define SSL_F_TLS_PARSE_CTOS_SERVER_NAME 573 +# define SSL_F_TLS_PARSE_CTOS_SESSION_TICKET 574 +# define SSL_F_TLS_PARSE_CTOS_SIG_ALGS 575 +# define SSL_F_TLS_PARSE_CTOS_SIG_ALGS_CERT 615 +# define SSL_F_TLS_PARSE_CTOS_SRP 576 +# define SSL_F_TLS_PARSE_CTOS_STATUS_REQUEST 577 +# define SSL_F_TLS_PARSE_CTOS_SUPPORTED_GROUPS 578 +# define SSL_F_TLS_PARSE_CTOS_USE_SRTP 465 +# define SSL_F_TLS_PARSE_STOC_ALPN 579 +# define SSL_F_TLS_PARSE_STOC_COOKIE 534 +# define SSL_F_TLS_PARSE_STOC_EARLY_DATA 538 +# define SSL_F_TLS_PARSE_STOC_EARLY_DATA_INFO 528 +# define SSL_F_TLS_PARSE_STOC_EC_PT_FORMATS 580 +# define SSL_F_TLS_PARSE_STOC_KEY_SHARE 445 +# define SSL_F_TLS_PARSE_STOC_MAXFRAGMENTLEN 581 +# define SSL_F_TLS_PARSE_STOC_NPN 582 +# define SSL_F_TLS_PARSE_STOC_PSK 502 +# define SSL_F_TLS_PARSE_STOC_RENEGOTIATE 448 +# define SSL_F_TLS_PARSE_STOC_SCT 564 +# define SSL_F_TLS_PARSE_STOC_SERVER_NAME 583 +# define SSL_F_TLS_PARSE_STOC_SESSION_TICKET 584 +# define SSL_F_TLS_PARSE_STOC_STATUS_REQUEST 585 +# define SSL_F_TLS_PARSE_STOC_SUPPORTED_VERSIONS 612 +# define SSL_F_TLS_PARSE_STOC_USE_SRTP 446 +# define SSL_F_TLS_POST_PROCESS_CLIENT_HELLO 378 +# define SSL_F_TLS_POST_PROCESS_CLIENT_KEY_EXCHANGE 384 +# define SSL_F_TLS_PREPARE_CLIENT_CERTIFICATE 360 +# define SSL_F_TLS_PROCESS_AS_HELLO_RETRY_REQUEST 610 +# define SSL_F_TLS_PROCESS_CERTIFICATE_REQUEST 361 +# define SSL_F_TLS_PROCESS_CERT_STATUS 362 +# define SSL_F_TLS_PROCESS_CERT_STATUS_BODY 495 +# define SSL_F_TLS_PROCESS_CERT_VERIFY 379 +# define SSL_F_TLS_PROCESS_CHANGE_CIPHER_SPEC 363 +# define SSL_F_TLS_PROCESS_CKE_DHE 411 +# define SSL_F_TLS_PROCESS_CKE_ECDHE 412 +# define SSL_F_TLS_PROCESS_CKE_GOST 413 +# define SSL_F_TLS_PROCESS_CKE_PSK_PREAMBLE 414 +# define SSL_F_TLS_PROCESS_CKE_RSA 415 +# define SSL_F_TLS_PROCESS_CKE_SRP 416 +# define SSL_F_TLS_PROCESS_CLIENT_CERTIFICATE 380 +# define SSL_F_TLS_PROCESS_CLIENT_HELLO 381 +# define SSL_F_TLS_PROCESS_CLIENT_KEY_EXCHANGE 382 +# define SSL_F_TLS_PROCESS_ENCRYPTED_EXTENSIONS 444 +# define SSL_F_TLS_PROCESS_END_OF_EARLY_DATA 537 +# define SSL_F_TLS_PROCESS_FINISHED 364 +# define SSL_F_TLS_PROCESS_HELLO_REQ 507 +# define SSL_F_TLS_PROCESS_HELLO_RETRY_REQUEST 511 +# define SSL_F_TLS_PROCESS_INITIAL_SERVER_FLIGHT 442 +# define SSL_F_TLS_PROCESS_KEY_EXCHANGE 365 +# define SSL_F_TLS_PROCESS_KEY_UPDATE 518 +# define SSL_F_TLS_PROCESS_NEW_SESSION_TICKET 366 +# define SSL_F_TLS_PROCESS_NEXT_PROTO 383 +# define SSL_F_TLS_PROCESS_SERVER_CERTIFICATE 367 +# define SSL_F_TLS_PROCESS_SERVER_DONE 368 +# define SSL_F_TLS_PROCESS_SERVER_HELLO 369 +# define SSL_F_TLS_PROCESS_SKE_DHE 419 +# define SSL_F_TLS_PROCESS_SKE_ECDHE 420 +# define SSL_F_TLS_PROCESS_SKE_PSK_PREAMBLE 421 +# define SSL_F_TLS_PROCESS_SKE_SRP 422 +# define SSL_F_TLS_PSK_DO_BINDER 506 +# define SSL_F_TLS_SCAN_CLIENTHELLO_TLSEXT 450 +# define SSL_F_TLS_SETUP_HANDSHAKE 508 +# define SSL_F_USE_CERTIFICATE_CHAIN_FILE 220 +# define SSL_F_WPACKET_INTERN_INIT_LEN 633 +# define SSL_F_WPACKET_START_SUB_PACKET_LEN__ 634 +# define SSL_F_WRITE_STATE_MACHINE 586 + +/* + * SSL reason codes. + */ +# define SSL_R_APPLICATION_DATA_AFTER_CLOSE_NOTIFY 291 +# define SSL_R_APP_DATA_IN_HANDSHAKE 100 +# define SSL_R_ATTEMPT_TO_REUSE_SESSION_IN_DIFFERENT_CONTEXT 272 +# define SSL_R_AT_LEAST_TLS_1_0_NEEDED_IN_FIPS_MODE 143 +# define SSL_R_AT_LEAST_TLS_1_2_NEEDED_IN_SUITEB_MODE 158 +# define SSL_R_BAD_CHANGE_CIPHER_SPEC 103 +# define SSL_R_BAD_CIPHER 186 +# define SSL_R_BAD_DATA 390 +# define SSL_R_BAD_DATA_RETURNED_BY_CALLBACK 106 +# define SSL_R_BAD_DECOMPRESSION 107 +# define SSL_R_BAD_DH_VALUE 102 +# define SSL_R_BAD_DIGEST_LENGTH 111 +# define SSL_R_BAD_EARLY_DATA 233 +# define SSL_R_BAD_ECC_CERT 304 +# define SSL_R_BAD_ECPOINT 306 +# define SSL_R_BAD_EXTENSION 110 +# define SSL_R_BAD_HANDSHAKE_LENGTH 332 +# define SSL_R_BAD_HANDSHAKE_STATE 236 +# define SSL_R_BAD_HELLO_REQUEST 105 +# define SSL_R_BAD_HRR_VERSION 263 +# define SSL_R_BAD_KEY_SHARE 108 +# define SSL_R_BAD_KEY_UPDATE 122 +# define SSL_R_BAD_LEGACY_VERSION 292 +# define SSL_R_BAD_LENGTH 271 +# define SSL_R_BAD_PACKET 240 +# define SSL_R_BAD_PACKET_LENGTH 115 +# define SSL_R_BAD_PROTOCOL_VERSION_NUMBER 116 +# define SSL_R_BAD_PSK 219 +# define SSL_R_BAD_PSK_IDENTITY 114 +# define SSL_R_BAD_RECORD_TYPE 443 +# define SSL_R_BAD_RSA_ENCRYPT 119 +# define SSL_R_BAD_SIGNATURE 123 +# define SSL_R_BAD_SRP_A_LENGTH 347 +# define SSL_R_BAD_SRP_PARAMETERS 371 +# define SSL_R_BAD_SRTP_MKI_VALUE 352 +# define SSL_R_BAD_SRTP_PROTECTION_PROFILE_LIST 353 +# define SSL_R_BAD_SSL_FILETYPE 124 +# define SSL_R_BAD_VALUE 384 +# define SSL_R_BAD_WRITE_RETRY 127 +# define SSL_R_BINDER_DOES_NOT_VERIFY 253 +# define SSL_R_BIO_NOT_SET 128 +# define SSL_R_BLOCK_CIPHER_PAD_IS_WRONG 129 +# define SSL_R_BN_LIB 130 +# define SSL_R_CALLBACK_FAILED 234 +# define SSL_R_CANNOT_CHANGE_CIPHER 109 +# define SSL_R_CA_DN_LENGTH_MISMATCH 131 +# define SSL_R_CA_KEY_TOO_SMALL 397 +# define SSL_R_CA_MD_TOO_WEAK 398 +# define SSL_R_CCS_RECEIVED_EARLY 133 +# define SSL_R_CERTIFICATE_VERIFY_FAILED 134 +# define SSL_R_CERT_CB_ERROR 377 +# define SSL_R_CERT_LENGTH_MISMATCH 135 +# define SSL_R_CIPHERSUITE_DIGEST_HAS_CHANGED 218 +# define SSL_R_CIPHER_CODE_WRONG_LENGTH 137 +# define SSL_R_CIPHER_OR_HASH_UNAVAILABLE 138 +# define SSL_R_CLIENTHELLO_TLSEXT 226 +# define SSL_R_COMPRESSED_LENGTH_TOO_LONG 140 +# define SSL_R_COMPRESSION_DISABLED 343 +# define SSL_R_COMPRESSION_FAILURE 141 +# define SSL_R_COMPRESSION_ID_NOT_WITHIN_PRIVATE_RANGE 307 +# define SSL_R_COMPRESSION_LIBRARY_ERROR 142 +# define SSL_R_CONNECTION_TYPE_NOT_SET 144 +# define SSL_R_CONTEXT_NOT_DANE_ENABLED 167 +# define SSL_R_COOKIE_GEN_CALLBACK_FAILURE 400 +# define SSL_R_COOKIE_MISMATCH 308 +# define SSL_R_CUSTOM_EXT_HANDLER_ALREADY_INSTALLED 206 +# define SSL_R_DANE_ALREADY_ENABLED 172 +# define SSL_R_DANE_CANNOT_OVERRIDE_MTYPE_FULL 173 +# define SSL_R_DANE_NOT_ENABLED 175 +# define SSL_R_DANE_TLSA_BAD_CERTIFICATE 180 +# define SSL_R_DANE_TLSA_BAD_CERTIFICATE_USAGE 184 +# define SSL_R_DANE_TLSA_BAD_DATA_LENGTH 189 +# define SSL_R_DANE_TLSA_BAD_DIGEST_LENGTH 192 +# define SSL_R_DANE_TLSA_BAD_MATCHING_TYPE 200 +# define SSL_R_DANE_TLSA_BAD_PUBLIC_KEY 201 +# define SSL_R_DANE_TLSA_BAD_SELECTOR 202 +# define SSL_R_DANE_TLSA_NULL_DATA 203 +# define SSL_R_DATA_BETWEEN_CCS_AND_FINISHED 145 +# define SSL_R_DATA_LENGTH_TOO_LONG 146 +# define SSL_R_DECRYPTION_FAILED 147 +# define SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC 281 +# define SSL_R_DH_KEY_TOO_SMALL 394 +# define SSL_R_DH_PUBLIC_VALUE_LENGTH_IS_WRONG 148 +# define SSL_R_DIGEST_CHECK_FAILED 149 +# define SSL_R_DTLS_MESSAGE_TOO_BIG 334 +# define SSL_R_DUPLICATE_COMPRESSION_ID 309 +# define SSL_R_ECC_CERT_NOT_FOR_SIGNING 318 +# define SSL_R_ECDH_REQUIRED_FOR_SUITEB_MODE 374 +# define SSL_R_EE_KEY_TOO_SMALL 399 +# define SSL_R_EMPTY_SRTP_PROTECTION_PROFILE_LIST 354 +# define SSL_R_ENCRYPTED_LENGTH_TOO_LONG 150 +# define SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST 151 +# define SSL_R_ERROR_SETTING_TLSA_BASE_DOMAIN 204 +# define SSL_R_EXCEEDS_MAX_FRAGMENT_SIZE 194 +# define SSL_R_EXCESSIVE_MESSAGE_SIZE 152 +# define SSL_R_EXTENSION_NOT_RECEIVED 279 +# define SSL_R_EXTRA_DATA_IN_MESSAGE 153 +# define SSL_R_EXT_LENGTH_MISMATCH 163 +# define SSL_R_FAILED_TO_INIT_ASYNC 405 +# define SSL_R_FRAGMENTED_CLIENT_HELLO 401 +# define SSL_R_GOT_A_FIN_BEFORE_A_CCS 154 +# define SSL_R_HTTPS_PROXY_REQUEST 155 +# define SSL_R_HTTP_REQUEST 156 +# define SSL_R_ILLEGAL_POINT_COMPRESSION 162 +# define SSL_R_ILLEGAL_SUITEB_DIGEST 380 +# define SSL_R_INAPPROPRIATE_FALLBACK 373 +# define SSL_R_INCONSISTENT_COMPRESSION 340 +# define SSL_R_INCONSISTENT_EARLY_DATA_ALPN 222 +# define SSL_R_INCONSISTENT_EARLY_DATA_SNI 231 +# define SSL_R_INCONSISTENT_EXTMS 104 +# define SSL_R_INSUFFICIENT_SECURITY 241 +# define SSL_R_INVALID_ALERT 205 +# define SSL_R_INVALID_CCS_MESSAGE 260 +# define SSL_R_INVALID_CERTIFICATE_OR_ALG 238 +# define SSL_R_INVALID_COMMAND 280 +# define SSL_R_INVALID_COMPRESSION_ALGORITHM 341 +# define SSL_R_INVALID_CONFIG 283 +# define SSL_R_INVALID_CONFIGURATION_NAME 113 +# define SSL_R_INVALID_CONTEXT 282 +# define SSL_R_INVALID_CT_VALIDATION_TYPE 212 +# define SSL_R_INVALID_KEY_UPDATE_TYPE 120 +# define SSL_R_INVALID_MAX_EARLY_DATA 174 +# define SSL_R_INVALID_NULL_CMD_NAME 385 +# define SSL_R_INVALID_SEQUENCE_NUMBER 402 +# define SSL_R_INVALID_SERVERINFO_DATA 388 +# define SSL_R_INVALID_SESSION_ID 999 +# define SSL_R_INVALID_SRP_USERNAME 357 +# define SSL_R_INVALID_STATUS_RESPONSE 328 +# define SSL_R_INVALID_TICKET_KEYS_LENGTH 325 +# define SSL_R_LENGTH_MISMATCH 159 +# define SSL_R_LENGTH_TOO_LONG 404 +# define SSL_R_LENGTH_TOO_SHORT 160 +# define SSL_R_LIBRARY_BUG 274 +# define SSL_R_LIBRARY_HAS_NO_CIPHERS 161 +# define SSL_R_MISSING_DSA_SIGNING_CERT 165 +# define SSL_R_MISSING_ECDSA_SIGNING_CERT 381 +# define SSL_R_MISSING_FATAL 256 +# define SSL_R_MISSING_PARAMETERS 290 +# define SSL_R_MISSING_RSA_CERTIFICATE 168 +# define SSL_R_MISSING_RSA_ENCRYPTING_CERT 169 +# define SSL_R_MISSING_RSA_SIGNING_CERT 170 +# define SSL_R_MISSING_SIGALGS_EXTENSION 112 +# define SSL_R_MISSING_SIGNING_CERT 221 +# define SSL_R_MISSING_SRP_PARAM 358 +# define SSL_R_MISSING_SUPPORTED_GROUPS_EXTENSION 209 +# define SSL_R_MISSING_TMP_DH_KEY 171 +# define SSL_R_MISSING_TMP_ECDH_KEY 311 +# define SSL_R_MIXED_HANDSHAKE_AND_NON_HANDSHAKE_DATA 293 +# define SSL_R_NOT_ON_RECORD_BOUNDARY 182 +# define SSL_R_NOT_REPLACING_CERTIFICATE 289 +# define SSL_R_NOT_SERVER 284 +# define SSL_R_NO_APPLICATION_PROTOCOL 235 +# define SSL_R_NO_CERTIFICATES_RETURNED 176 +# define SSL_R_NO_CERTIFICATE_ASSIGNED 177 +# define SSL_R_NO_CERTIFICATE_SET 179 +# define SSL_R_NO_CHANGE_FOLLOWING_HRR 214 +# define SSL_R_NO_CIPHERS_AVAILABLE 181 +# define SSL_R_NO_CIPHERS_SPECIFIED 183 +# define SSL_R_NO_CIPHER_MATCH 185 +# define SSL_R_NO_CLIENT_CERT_METHOD 331 +# define SSL_R_NO_COMPRESSION_SPECIFIED 187 +# define SSL_R_NO_COOKIE_CALLBACK_SET 287 +# define SSL_R_NO_GOST_CERTIFICATE_SENT_BY_PEER 330 +# define SSL_R_NO_METHOD_SPECIFIED 188 +# define SSL_R_NO_PEM_EXTENSIONS 389 +# define SSL_R_NO_PRIVATE_KEY_ASSIGNED 190 +# define SSL_R_NO_PROTOCOLS_AVAILABLE 191 +# define SSL_R_NO_RENEGOTIATION 339 +# define SSL_R_NO_REQUIRED_DIGEST 324 +# define SSL_R_NO_SHARED_CIPHER 193 +# define SSL_R_NO_SHARED_GROUPS 410 +# define SSL_R_NO_SHARED_SIGNATURE_ALGORITHMS 376 +# define SSL_R_NO_SRTP_PROFILES 359 +# define SSL_R_NO_SUITABLE_KEY_SHARE 101 +# define SSL_R_NO_SUITABLE_SIGNATURE_ALGORITHM 118 +# define SSL_R_NO_VALID_SCTS 216 +# define SSL_R_NO_VERIFY_COOKIE_CALLBACK 403 +# define SSL_R_NULL_SSL_CTX 195 +# define SSL_R_NULL_SSL_METHOD_PASSED 196 +# define SSL_R_OLD_SESSION_CIPHER_NOT_RETURNED 197 +# define SSL_R_OLD_SESSION_COMPRESSION_ALGORITHM_NOT_RETURNED 344 +# define SSL_R_OVERFLOW_ERROR 237 +# define SSL_R_PACKET_LENGTH_TOO_LONG 198 +# define SSL_R_PARSE_TLSEXT 227 +# define SSL_R_PATH_TOO_LONG 270 +# define SSL_R_PEER_DID_NOT_RETURN_A_CERTIFICATE 199 +# define SSL_R_PEM_NAME_BAD_PREFIX 391 +# define SSL_R_PEM_NAME_TOO_SHORT 392 +# define SSL_R_PIPELINE_FAILURE 406 +# define SSL_R_POST_HANDSHAKE_AUTH_ENCODING_ERR 278 +# define SSL_R_PRIVATE_KEY_MISMATCH 288 +# define SSL_R_PROTOCOL_IS_SHUTDOWN 207 +# define SSL_R_PSK_IDENTITY_NOT_FOUND 223 +# define SSL_R_PSK_NO_CLIENT_CB 224 +# define SSL_R_PSK_NO_SERVER_CB 225 +# define SSL_R_READ_BIO_NOT_SET 211 +# define SSL_R_READ_TIMEOUT_EXPIRED 312 +# define SSL_R_RECORD_LENGTH_MISMATCH 213 +# define SSL_R_RECORD_TOO_SMALL 298 +# define SSL_R_RENEGOTIATE_EXT_TOO_LONG 335 +# define SSL_R_RENEGOTIATION_ENCODING_ERR 336 +# define SSL_R_RENEGOTIATION_MISMATCH 337 +# define SSL_R_REQUEST_PENDING 285 +# define SSL_R_REQUEST_SENT 286 +# define SSL_R_REQUIRED_CIPHER_MISSING 215 +# define SSL_R_REQUIRED_COMPRESSION_ALGORITHM_MISSING 342 +# define SSL_R_SCSV_RECEIVED_WHEN_RENEGOTIATING 345 +# define SSL_R_SCT_VERIFICATION_FAILED 208 +# define SSL_R_SERVERHELLO_TLSEXT 275 +# define SSL_R_SESSION_ID_CONTEXT_UNINITIALIZED 277 +# define SSL_R_SHUTDOWN_WHILE_IN_INIT 407 +# define SSL_R_SIGNATURE_ALGORITHMS_ERROR 360 +# define SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE 220 +# define SSL_R_SRP_A_CALC 361 +# define SSL_R_SRTP_COULD_NOT_ALLOCATE_PROFILES 362 +# define SSL_R_SRTP_PROTECTION_PROFILE_LIST_TOO_LONG 363 +# define SSL_R_SRTP_UNKNOWN_PROTECTION_PROFILE 364 +# define SSL_R_SSL3_EXT_INVALID_MAX_FRAGMENT_LENGTH 232 +# define SSL_R_SSL3_EXT_INVALID_SERVERNAME 319 +# define SSL_R_SSL3_EXT_INVALID_SERVERNAME_TYPE 320 +# define SSL_R_SSL3_SESSION_ID_TOO_LONG 300 +# define SSL_R_SSLV3_ALERT_BAD_CERTIFICATE 1042 +# define SSL_R_SSLV3_ALERT_BAD_RECORD_MAC 1020 +# define SSL_R_SSLV3_ALERT_CERTIFICATE_EXPIRED 1045 +# define SSL_R_SSLV3_ALERT_CERTIFICATE_REVOKED 1044 +# define SSL_R_SSLV3_ALERT_CERTIFICATE_UNKNOWN 1046 +# define SSL_R_SSLV3_ALERT_DECOMPRESSION_FAILURE 1030 +# define SSL_R_SSLV3_ALERT_HANDSHAKE_FAILURE 1040 +# define SSL_R_SSLV3_ALERT_ILLEGAL_PARAMETER 1047 +# define SSL_R_SSLV3_ALERT_NO_CERTIFICATE 1041 +# define SSL_R_SSLV3_ALERT_UNEXPECTED_MESSAGE 1010 +# define SSL_R_SSLV3_ALERT_UNSUPPORTED_CERTIFICATE 1043 +# define SSL_R_SSL_COMMAND_SECTION_EMPTY 117 +# define SSL_R_SSL_COMMAND_SECTION_NOT_FOUND 125 +# define SSL_R_SSL_CTX_HAS_NO_DEFAULT_SSL_VERSION 228 +# define SSL_R_SSL_HANDSHAKE_FAILURE 229 +# define SSL_R_SSL_LIBRARY_HAS_NO_CIPHERS 230 +# define SSL_R_SSL_NEGATIVE_LENGTH 372 +# define SSL_R_SSL_SECTION_EMPTY 126 +# define SSL_R_SSL_SECTION_NOT_FOUND 136 +# define SSL_R_SSL_SESSION_ID_CALLBACK_FAILED 301 +# define SSL_R_SSL_SESSION_ID_CONFLICT 302 +# define SSL_R_SSL_SESSION_ID_CONTEXT_TOO_LONG 273 +# define SSL_R_SSL_SESSION_ID_HAS_BAD_LENGTH 303 +# define SSL_R_SSL_SESSION_ID_TOO_LONG 408 +# define SSL_R_SSL_SESSION_VERSION_MISMATCH 210 +# define SSL_R_STILL_IN_INIT 121 +# define SSL_R_TLSV13_ALERT_CERTIFICATE_REQUIRED 1116 +# define SSL_R_TLSV13_ALERT_MISSING_EXTENSION 1109 +# define SSL_R_TLSV1_ALERT_ACCESS_DENIED 1049 +# define SSL_R_TLSV1_ALERT_DECODE_ERROR 1050 +# define SSL_R_TLSV1_ALERT_DECRYPTION_FAILED 1021 +# define SSL_R_TLSV1_ALERT_DECRYPT_ERROR 1051 +# define SSL_R_TLSV1_ALERT_EXPORT_RESTRICTION 1060 +# define SSL_R_TLSV1_ALERT_INAPPROPRIATE_FALLBACK 1086 +# define SSL_R_TLSV1_ALERT_INSUFFICIENT_SECURITY 1071 +# define SSL_R_TLSV1_ALERT_INTERNAL_ERROR 1080 +# define SSL_R_TLSV1_ALERT_NO_RENEGOTIATION 1100 +# define SSL_R_TLSV1_ALERT_PROTOCOL_VERSION 1070 +# define SSL_R_TLSV1_ALERT_RECORD_OVERFLOW 1022 +# define SSL_R_TLSV1_ALERT_UNKNOWN_CA 1048 +# define SSL_R_TLSV1_ALERT_USER_CANCELLED 1090 +# define SSL_R_TLSV1_BAD_CERTIFICATE_HASH_VALUE 1114 +# define SSL_R_TLSV1_BAD_CERTIFICATE_STATUS_RESPONSE 1113 +# define SSL_R_TLSV1_CERTIFICATE_UNOBTAINABLE 1111 +# define SSL_R_TLSV1_UNRECOGNIZED_NAME 1112 +# define SSL_R_TLSV1_UNSUPPORTED_EXTENSION 1110 +# define SSL_R_TLS_HEARTBEAT_PEER_DOESNT_ACCEPT 365 +# define SSL_R_TLS_HEARTBEAT_PENDING 366 +# define SSL_R_TLS_ILLEGAL_EXPORTER_LABEL 367 +# define SSL_R_TLS_INVALID_ECPOINTFORMAT_LIST 157 +# define SSL_R_TOO_MANY_KEY_UPDATES 132 +# define SSL_R_TOO_MANY_WARN_ALERTS 409 +# define SSL_R_TOO_MUCH_EARLY_DATA 164 +# define SSL_R_UNABLE_TO_FIND_ECDH_PARAMETERS 314 +# define SSL_R_UNABLE_TO_FIND_PUBLIC_KEY_PARAMETERS 239 +# define SSL_R_UNABLE_TO_LOAD_SSL3_MD5_ROUTINES 242 +# define SSL_R_UNABLE_TO_LOAD_SSL3_SHA1_ROUTINES 243 +# define SSL_R_UNEXPECTED_CCS_MESSAGE 262 +# define SSL_R_UNEXPECTED_END_OF_EARLY_DATA 178 +# define SSL_R_UNEXPECTED_MESSAGE 244 +# define SSL_R_UNEXPECTED_RECORD 245 +# define SSL_R_UNINITIALIZED 276 +# define SSL_R_UNKNOWN_ALERT_TYPE 246 +# define SSL_R_UNKNOWN_CERTIFICATE_TYPE 247 +# define SSL_R_UNKNOWN_CIPHER_RETURNED 248 +# define SSL_R_UNKNOWN_CIPHER_TYPE 249 +# define SSL_R_UNKNOWN_CMD_NAME 386 +# define SSL_R_UNKNOWN_COMMAND 139 +# define SSL_R_UNKNOWN_DIGEST 368 +# define SSL_R_UNKNOWN_KEY_EXCHANGE_TYPE 250 +# define SSL_R_UNKNOWN_PKEY_TYPE 251 +# define SSL_R_UNKNOWN_PROTOCOL 252 +# define SSL_R_UNKNOWN_SSL_VERSION 254 +# define SSL_R_UNKNOWN_STATE 255 +# define SSL_R_UNSAFE_LEGACY_RENEGOTIATION_DISABLED 338 +# define SSL_R_UNSOLICITED_EXTENSION 217 +# define SSL_R_UNSUPPORTED_COMPRESSION_ALGORITHM 257 +# define SSL_R_UNSUPPORTED_ELLIPTIC_CURVE 315 +# define SSL_R_UNSUPPORTED_PROTOCOL 258 +# define SSL_R_UNSUPPORTED_SSL_VERSION 259 +# define SSL_R_UNSUPPORTED_STATUS_TYPE 329 +# define SSL_R_USE_SRTP_NOT_NEGOTIATED 369 +# define SSL_R_VERSION_TOO_HIGH 166 +# define SSL_R_VERSION_TOO_LOW 396 +# define SSL_R_WRONG_CERTIFICATE_TYPE 383 +# define SSL_R_WRONG_CIPHER_RETURNED 261 +# define SSL_R_WRONG_CURVE 378 +# define SSL_R_WRONG_SIGNATURE_LENGTH 264 +# define SSL_R_WRONG_SIGNATURE_SIZE 265 +# define SSL_R_WRONG_SIGNATURE_TYPE 370 +# define SSL_R_WRONG_SSL_VERSION 266 +# define SSL_R_WRONG_VERSION_NUMBER 267 +# define SSL_R_X509_LIB 268 +# define SSL_R_X509_VERIFICATION_SETUP_PROBLEMS 269 + +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/stack.h b/MediaClient/MediaClient/openssl/include/openssl/stack.h new file mode 100644 index 0000000..cfc0750 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/stack.h @@ -0,0 +1,83 @@ +/* + * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_STACK_H +# define HEADER_STACK_H + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct stack_st OPENSSL_STACK; /* Use STACK_OF(...) instead */ + +typedef int (*OPENSSL_sk_compfunc)(const void *, const void *); +typedef void (*OPENSSL_sk_freefunc)(void *); +typedef void *(*OPENSSL_sk_copyfunc)(const void *); + +int OPENSSL_sk_num(const OPENSSL_STACK *); +void *OPENSSL_sk_value(const OPENSSL_STACK *, int); + +void *OPENSSL_sk_set(OPENSSL_STACK *st, int i, const void *data); + +OPENSSL_STACK *OPENSSL_sk_new(OPENSSL_sk_compfunc cmp); +OPENSSL_STACK *OPENSSL_sk_new_null(void); +OPENSSL_STACK *OPENSSL_sk_new_reserve(OPENSSL_sk_compfunc c, int n); +int OPENSSL_sk_reserve(OPENSSL_STACK *st, int n); +void OPENSSL_sk_free(OPENSSL_STACK *); +void OPENSSL_sk_pop_free(OPENSSL_STACK *st, void (*func) (void *)); +OPENSSL_STACK *OPENSSL_sk_deep_copy(const OPENSSL_STACK *, + OPENSSL_sk_copyfunc c, + OPENSSL_sk_freefunc f); +int OPENSSL_sk_insert(OPENSSL_STACK *sk, const void *data, int where); +void *OPENSSL_sk_delete(OPENSSL_STACK *st, int loc); +void *OPENSSL_sk_delete_ptr(OPENSSL_STACK *st, const void *p); +int OPENSSL_sk_find(OPENSSL_STACK *st, const void *data); +int OPENSSL_sk_find_ex(OPENSSL_STACK *st, const void *data); +int OPENSSL_sk_push(OPENSSL_STACK *st, const void *data); +int OPENSSL_sk_unshift(OPENSSL_STACK *st, const void *data); +void *OPENSSL_sk_shift(OPENSSL_STACK *st); +void *OPENSSL_sk_pop(OPENSSL_STACK *st); +void OPENSSL_sk_zero(OPENSSL_STACK *st); +OPENSSL_sk_compfunc OPENSSL_sk_set_cmp_func(OPENSSL_STACK *sk, + OPENSSL_sk_compfunc cmp); +OPENSSL_STACK *OPENSSL_sk_dup(const OPENSSL_STACK *st); +void OPENSSL_sk_sort(OPENSSL_STACK *st); +int OPENSSL_sk_is_sorted(const OPENSSL_STACK *st); + +# if OPENSSL_API_COMPAT < 0x10100000L +# define _STACK OPENSSL_STACK +# define sk_num OPENSSL_sk_num +# define sk_value OPENSSL_sk_value +# define sk_set OPENSSL_sk_set +# define sk_new OPENSSL_sk_new +# define sk_new_null OPENSSL_sk_new_null +# define sk_free OPENSSL_sk_free +# define sk_pop_free OPENSSL_sk_pop_free +# define sk_deep_copy OPENSSL_sk_deep_copy +# define sk_insert OPENSSL_sk_insert +# define sk_delete OPENSSL_sk_delete +# define sk_delete_ptr OPENSSL_sk_delete_ptr +# define sk_find OPENSSL_sk_find +# define sk_find_ex OPENSSL_sk_find_ex +# define sk_push OPENSSL_sk_push +# define sk_unshift OPENSSL_sk_unshift +# define sk_shift OPENSSL_sk_shift +# define sk_pop OPENSSL_sk_pop +# define sk_zero OPENSSL_sk_zero +# define sk_set_cmp_func OPENSSL_sk_set_cmp_func +# define sk_dup OPENSSL_sk_dup +# define sk_sort OPENSSL_sk_sort +# define sk_is_sorted OPENSSL_sk_is_sorted +# endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/store.h b/MediaClient/MediaClient/openssl/include/openssl/store.h new file mode 100644 index 0000000..a40a733 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/store.h @@ -0,0 +1,266 @@ +/* + * Copyright 2016-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_OSSL_STORE_H +# define HEADER_OSSL_STORE_H + +# include +# include +# include +# include + +# ifdef __cplusplus +extern "C" { +# endif + +/*- + * The main OSSL_STORE functions. + * ------------------------------ + * + * These allow applications to open a channel to a resource with supported + * data (keys, certs, crls, ...), read the data a piece at a time and decide + * what to do with it, and finally close. + */ + +typedef struct ossl_store_ctx_st OSSL_STORE_CTX; + +/* + * Typedef for the OSSL_STORE_INFO post processing callback. This can be used + * to massage the given OSSL_STORE_INFO, or to drop it entirely (by returning + * NULL). + */ +typedef OSSL_STORE_INFO *(*OSSL_STORE_post_process_info_fn)(OSSL_STORE_INFO *, + void *); + +/* + * Open a channel given a URI. The given UI method will be used any time the + * loader needs extra input, for example when a password or pin is needed, and + * will be passed the same user data every time it's needed in this context. + * + * Returns a context reference which represents the channel to communicate + * through. + */ +OSSL_STORE_CTX *OSSL_STORE_open(const char *uri, const UI_METHOD *ui_method, + void *ui_data, + OSSL_STORE_post_process_info_fn post_process, + void *post_process_data); + +/* + * Control / fine tune the OSSL_STORE channel. |cmd| determines what is to be + * done, and depends on the underlying loader (use OSSL_STORE_get0_scheme to + * determine which loader is used), except for common commands (see below). + * Each command takes different arguments. + */ +int OSSL_STORE_ctrl(OSSL_STORE_CTX *ctx, int cmd, ... /* args */); +int OSSL_STORE_vctrl(OSSL_STORE_CTX *ctx, int cmd, va_list args); + +/* + * Common ctrl commands that different loaders may choose to support. + */ +/* int on = 0 or 1; STORE_ctrl(ctx, STORE_C_USE_SECMEM, &on); */ +# define OSSL_STORE_C_USE_SECMEM 1 +/* Where custom commands start */ +# define OSSL_STORE_C_CUSTOM_START 100 + +/* + * Read one data item (a key, a cert, a CRL) that is supported by the OSSL_STORE + * functionality, given a context. + * Returns a OSSL_STORE_INFO pointer, from which OpenSSL typed data can be + * extracted with OSSL_STORE_INFO_get0_PKEY(), OSSL_STORE_INFO_get0_CERT(), ... + * NULL is returned on error, which may include that the data found at the URI + * can't be figured out for certain or is ambiguous. + */ +OSSL_STORE_INFO *OSSL_STORE_load(OSSL_STORE_CTX *ctx); + +/* + * Check if end of data (end of file) is reached + * Returns 1 on end, 0 otherwise. + */ +int OSSL_STORE_eof(OSSL_STORE_CTX *ctx); + +/* + * Check if an error occurred + * Returns 1 if it did, 0 otherwise. + */ +int OSSL_STORE_error(OSSL_STORE_CTX *ctx); + +/* + * Close the channel + * Returns 1 on success, 0 on error. + */ +int OSSL_STORE_close(OSSL_STORE_CTX *ctx); + + +/*- + * Extracting OpenSSL types from and creating new OSSL_STORE_INFOs + * --------------------------------------------------------------- + */ + +/* + * Types of data that can be ossl_stored in a OSSL_STORE_INFO. + * OSSL_STORE_INFO_NAME is typically found when getting a listing of + * available "files" / "tokens" / what have you. + */ +# define OSSL_STORE_INFO_NAME 1 /* char * */ +# define OSSL_STORE_INFO_PARAMS 2 /* EVP_PKEY * */ +# define OSSL_STORE_INFO_PKEY 3 /* EVP_PKEY * */ +# define OSSL_STORE_INFO_CERT 4 /* X509 * */ +# define OSSL_STORE_INFO_CRL 5 /* X509_CRL * */ + +/* + * Functions to generate OSSL_STORE_INFOs, one function for each type we + * support having in them, as well as a generic constructor. + * + * In all cases, ownership of the object is transferred to the OSSL_STORE_INFO + * and will therefore be freed when the OSSL_STORE_INFO is freed. + */ +OSSL_STORE_INFO *OSSL_STORE_INFO_new_NAME(char *name); +int OSSL_STORE_INFO_set0_NAME_description(OSSL_STORE_INFO *info, char *desc); +OSSL_STORE_INFO *OSSL_STORE_INFO_new_PARAMS(EVP_PKEY *params); +OSSL_STORE_INFO *OSSL_STORE_INFO_new_PKEY(EVP_PKEY *pkey); +OSSL_STORE_INFO *OSSL_STORE_INFO_new_CERT(X509 *x509); +OSSL_STORE_INFO *OSSL_STORE_INFO_new_CRL(X509_CRL *crl); + +/* + * Functions to try to extract data from a OSSL_STORE_INFO. + */ +int OSSL_STORE_INFO_get_type(const OSSL_STORE_INFO *info); +const char *OSSL_STORE_INFO_get0_NAME(const OSSL_STORE_INFO *info); +char *OSSL_STORE_INFO_get1_NAME(const OSSL_STORE_INFO *info); +const char *OSSL_STORE_INFO_get0_NAME_description(const OSSL_STORE_INFO *info); +char *OSSL_STORE_INFO_get1_NAME_description(const OSSL_STORE_INFO *info); +EVP_PKEY *OSSL_STORE_INFO_get0_PARAMS(const OSSL_STORE_INFO *info); +EVP_PKEY *OSSL_STORE_INFO_get1_PARAMS(const OSSL_STORE_INFO *info); +EVP_PKEY *OSSL_STORE_INFO_get0_PKEY(const OSSL_STORE_INFO *info); +EVP_PKEY *OSSL_STORE_INFO_get1_PKEY(const OSSL_STORE_INFO *info); +X509 *OSSL_STORE_INFO_get0_CERT(const OSSL_STORE_INFO *info); +X509 *OSSL_STORE_INFO_get1_CERT(const OSSL_STORE_INFO *info); +X509_CRL *OSSL_STORE_INFO_get0_CRL(const OSSL_STORE_INFO *info); +X509_CRL *OSSL_STORE_INFO_get1_CRL(const OSSL_STORE_INFO *info); + +const char *OSSL_STORE_INFO_type_string(int type); + +/* + * Free the OSSL_STORE_INFO + */ +void OSSL_STORE_INFO_free(OSSL_STORE_INFO *info); + + +/*- + * Functions to construct a search URI from a base URI and search criteria + * ----------------------------------------------------------------------- + */ + +/* OSSL_STORE search types */ +# define OSSL_STORE_SEARCH_BY_NAME 1 /* subject in certs, issuer in CRLs */ +# define OSSL_STORE_SEARCH_BY_ISSUER_SERIAL 2 +# define OSSL_STORE_SEARCH_BY_KEY_FINGERPRINT 3 +# define OSSL_STORE_SEARCH_BY_ALIAS 4 + +/* To check what search types the scheme handler supports */ +int OSSL_STORE_supports_search(OSSL_STORE_CTX *ctx, int search_type); + +/* Search term constructors */ +/* + * The input is considered to be owned by the caller, and must therefore + * remain present throughout the lifetime of the returned OSSL_STORE_SEARCH + */ +OSSL_STORE_SEARCH *OSSL_STORE_SEARCH_by_name(X509_NAME *name); +OSSL_STORE_SEARCH *OSSL_STORE_SEARCH_by_issuer_serial(X509_NAME *name, + const ASN1_INTEGER + *serial); +OSSL_STORE_SEARCH *OSSL_STORE_SEARCH_by_key_fingerprint(const EVP_MD *digest, + const unsigned char + *bytes, size_t len); +OSSL_STORE_SEARCH *OSSL_STORE_SEARCH_by_alias(const char *alias); + +/* Search term destructor */ +void OSSL_STORE_SEARCH_free(OSSL_STORE_SEARCH *search); + +/* Search term accessors */ +int OSSL_STORE_SEARCH_get_type(const OSSL_STORE_SEARCH *criterion); +X509_NAME *OSSL_STORE_SEARCH_get0_name(OSSL_STORE_SEARCH *criterion); +const ASN1_INTEGER *OSSL_STORE_SEARCH_get0_serial(const OSSL_STORE_SEARCH + *criterion); +const unsigned char *OSSL_STORE_SEARCH_get0_bytes(const OSSL_STORE_SEARCH + *criterion, size_t *length); +const char *OSSL_STORE_SEARCH_get0_string(const OSSL_STORE_SEARCH *criterion); +const EVP_MD *OSSL_STORE_SEARCH_get0_digest(const OSSL_STORE_SEARCH *criterion); + +/* + * Add search criterion and expected return type (which can be unspecified) + * to the loading channel. This MUST happen before the first OSSL_STORE_load(). + */ +int OSSL_STORE_expect(OSSL_STORE_CTX *ctx, int expected_type); +int OSSL_STORE_find(OSSL_STORE_CTX *ctx, OSSL_STORE_SEARCH *search); + + +/*- + * Function to register a loader for the given URI scheme. + * ------------------------------------------------------- + * + * The loader receives all the main components of an URI except for the + * scheme. + */ + +typedef struct ossl_store_loader_st OSSL_STORE_LOADER; +OSSL_STORE_LOADER *OSSL_STORE_LOADER_new(ENGINE *e, const char *scheme); +const ENGINE *OSSL_STORE_LOADER_get0_engine(const OSSL_STORE_LOADER *loader); +const char *OSSL_STORE_LOADER_get0_scheme(const OSSL_STORE_LOADER *loader); +/* struct ossl_store_loader_ctx_st is defined differently by each loader */ +typedef struct ossl_store_loader_ctx_st OSSL_STORE_LOADER_CTX; +typedef OSSL_STORE_LOADER_CTX *(*OSSL_STORE_open_fn)(const OSSL_STORE_LOADER + *loader, + const char *uri, + const UI_METHOD *ui_method, + void *ui_data); +int OSSL_STORE_LOADER_set_open(OSSL_STORE_LOADER *loader, + OSSL_STORE_open_fn open_function); +typedef int (*OSSL_STORE_ctrl_fn)(OSSL_STORE_LOADER_CTX *ctx, int cmd, + va_list args); +int OSSL_STORE_LOADER_set_ctrl(OSSL_STORE_LOADER *loader, + OSSL_STORE_ctrl_fn ctrl_function); +typedef int (*OSSL_STORE_expect_fn)(OSSL_STORE_LOADER_CTX *ctx, int expected); +int OSSL_STORE_LOADER_set_expect(OSSL_STORE_LOADER *loader, + OSSL_STORE_expect_fn expect_function); +typedef int (*OSSL_STORE_find_fn)(OSSL_STORE_LOADER_CTX *ctx, + OSSL_STORE_SEARCH *criteria); +int OSSL_STORE_LOADER_set_find(OSSL_STORE_LOADER *loader, + OSSL_STORE_find_fn find_function); +typedef OSSL_STORE_INFO *(*OSSL_STORE_load_fn)(OSSL_STORE_LOADER_CTX *ctx, + const UI_METHOD *ui_method, + void *ui_data); +int OSSL_STORE_LOADER_set_load(OSSL_STORE_LOADER *loader, + OSSL_STORE_load_fn load_function); +typedef int (*OSSL_STORE_eof_fn)(OSSL_STORE_LOADER_CTX *ctx); +int OSSL_STORE_LOADER_set_eof(OSSL_STORE_LOADER *loader, + OSSL_STORE_eof_fn eof_function); +typedef int (*OSSL_STORE_error_fn)(OSSL_STORE_LOADER_CTX *ctx); +int OSSL_STORE_LOADER_set_error(OSSL_STORE_LOADER *loader, + OSSL_STORE_error_fn error_function); +typedef int (*OSSL_STORE_close_fn)(OSSL_STORE_LOADER_CTX *ctx); +int OSSL_STORE_LOADER_set_close(OSSL_STORE_LOADER *loader, + OSSL_STORE_close_fn close_function); +void OSSL_STORE_LOADER_free(OSSL_STORE_LOADER *loader); + +int OSSL_STORE_register_loader(OSSL_STORE_LOADER *loader); +OSSL_STORE_LOADER *OSSL_STORE_unregister_loader(const char *scheme); + +/*- + * Functions to list STORE loaders + * ------------------------------- + */ +int OSSL_STORE_do_all_loaders(void (*do_function) (const OSSL_STORE_LOADER + *loader, void *do_arg), + void *do_arg); + +# ifdef __cplusplus +} +# endif +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/storeerr.h b/MediaClient/MediaClient/openssl/include/openssl/storeerr.h new file mode 100644 index 0000000..190eab0 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/storeerr.h @@ -0,0 +1,91 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_OSSL_STOREERR_H +# define HEADER_OSSL_STOREERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_OSSL_STORE_strings(void); + +/* + * OSSL_STORE function codes. + */ +# define OSSL_STORE_F_FILE_CTRL 129 +# define OSSL_STORE_F_FILE_FIND 138 +# define OSSL_STORE_F_FILE_GET_PASS 118 +# define OSSL_STORE_F_FILE_LOAD 119 +# define OSSL_STORE_F_FILE_LOAD_TRY_DECODE 124 +# define OSSL_STORE_F_FILE_NAME_TO_URI 126 +# define OSSL_STORE_F_FILE_OPEN 120 +# define OSSL_STORE_F_OSSL_STORE_ATTACH_PEM_BIO 127 +# define OSSL_STORE_F_OSSL_STORE_EXPECT 130 +# define OSSL_STORE_F_OSSL_STORE_FILE_ATTACH_PEM_BIO_INT 128 +# define OSSL_STORE_F_OSSL_STORE_FIND 131 +# define OSSL_STORE_F_OSSL_STORE_GET0_LOADER_INT 100 +# define OSSL_STORE_F_OSSL_STORE_INFO_GET1_CERT 101 +# define OSSL_STORE_F_OSSL_STORE_INFO_GET1_CRL 102 +# define OSSL_STORE_F_OSSL_STORE_INFO_GET1_NAME 103 +# define OSSL_STORE_F_OSSL_STORE_INFO_GET1_NAME_DESCRIPTION 135 +# define OSSL_STORE_F_OSSL_STORE_INFO_GET1_PARAMS 104 +# define OSSL_STORE_F_OSSL_STORE_INFO_GET1_PKEY 105 +# define OSSL_STORE_F_OSSL_STORE_INFO_NEW_CERT 106 +# define OSSL_STORE_F_OSSL_STORE_INFO_NEW_CRL 107 +# define OSSL_STORE_F_OSSL_STORE_INFO_NEW_EMBEDDED 123 +# define OSSL_STORE_F_OSSL_STORE_INFO_NEW_NAME 109 +# define OSSL_STORE_F_OSSL_STORE_INFO_NEW_PARAMS 110 +# define OSSL_STORE_F_OSSL_STORE_INFO_NEW_PKEY 111 +# define OSSL_STORE_F_OSSL_STORE_INFO_SET0_NAME_DESCRIPTION 134 +# define OSSL_STORE_F_OSSL_STORE_INIT_ONCE 112 +# define OSSL_STORE_F_OSSL_STORE_LOADER_NEW 113 +# define OSSL_STORE_F_OSSL_STORE_OPEN 114 +# define OSSL_STORE_F_OSSL_STORE_OPEN_INT 115 +# define OSSL_STORE_F_OSSL_STORE_REGISTER_LOADER_INT 117 +# define OSSL_STORE_F_OSSL_STORE_SEARCH_BY_ALIAS 132 +# define OSSL_STORE_F_OSSL_STORE_SEARCH_BY_ISSUER_SERIAL 133 +# define OSSL_STORE_F_OSSL_STORE_SEARCH_BY_KEY_FINGERPRINT 136 +# define OSSL_STORE_F_OSSL_STORE_SEARCH_BY_NAME 137 +# define OSSL_STORE_F_OSSL_STORE_UNREGISTER_LOADER_INT 116 +# define OSSL_STORE_F_TRY_DECODE_PARAMS 121 +# define OSSL_STORE_F_TRY_DECODE_PKCS12 122 +# define OSSL_STORE_F_TRY_DECODE_PKCS8ENCRYPTED 125 + +/* + * OSSL_STORE reason codes. + */ +# define OSSL_STORE_R_AMBIGUOUS_CONTENT_TYPE 107 +# define OSSL_STORE_R_BAD_PASSWORD_READ 115 +# define OSSL_STORE_R_ERROR_VERIFYING_PKCS12_MAC 113 +# define OSSL_STORE_R_FINGERPRINT_SIZE_DOES_NOT_MATCH_DIGEST 121 +# define OSSL_STORE_R_INVALID_SCHEME 106 +# define OSSL_STORE_R_IS_NOT_A 112 +# define OSSL_STORE_R_LOADER_INCOMPLETE 116 +# define OSSL_STORE_R_LOADING_STARTED 117 +# define OSSL_STORE_R_NOT_A_CERTIFICATE 100 +# define OSSL_STORE_R_NOT_A_CRL 101 +# define OSSL_STORE_R_NOT_A_KEY 102 +# define OSSL_STORE_R_NOT_A_NAME 103 +# define OSSL_STORE_R_NOT_PARAMETERS 104 +# define OSSL_STORE_R_PASSPHRASE_CALLBACK_ERROR 114 +# define OSSL_STORE_R_PATH_MUST_BE_ABSOLUTE 108 +# define OSSL_STORE_R_SEARCH_ONLY_SUPPORTED_FOR_DIRECTORIES 119 +# define OSSL_STORE_R_UI_PROCESS_INTERRUPTED_OR_CANCELLED 109 +# define OSSL_STORE_R_UNREGISTERED_SCHEME 105 +# define OSSL_STORE_R_UNSUPPORTED_CONTENT_TYPE 110 +# define OSSL_STORE_R_UNSUPPORTED_OPERATION 118 +# define OSSL_STORE_R_UNSUPPORTED_SEARCH_TYPE 120 +# define OSSL_STORE_R_URI_AUTHORITY_UNSUPPORTED 111 + +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/symhacks.h b/MediaClient/MediaClient/openssl/include/openssl/symhacks.h new file mode 100644 index 0000000..156ea6e --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/symhacks.h @@ -0,0 +1,37 @@ +/* + * Copyright 1999-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_SYMHACKS_H +# define HEADER_SYMHACKS_H + +# include + +/* Case insensitive linking causes problems.... */ +# if defined(OPENSSL_SYS_VMS) +# undef ERR_load_CRYPTO_strings +# define ERR_load_CRYPTO_strings ERR_load_CRYPTOlib_strings +# undef OCSP_crlID_new +# define OCSP_crlID_new OCSP_crlID2_new + +# undef d2i_ECPARAMETERS +# define d2i_ECPARAMETERS d2i_UC_ECPARAMETERS +# undef i2d_ECPARAMETERS +# define i2d_ECPARAMETERS i2d_UC_ECPARAMETERS +# undef d2i_ECPKPARAMETERS +# define d2i_ECPKPARAMETERS d2i_UC_ECPKPARAMETERS +# undef i2d_ECPKPARAMETERS +# define i2d_ECPKPARAMETERS i2d_UC_ECPKPARAMETERS + +/* This one clashes with CMS_data_create */ +# undef cms_Data_create +# define cms_Data_create priv_cms_Data_create + +# endif + +#endif /* ! defined HEADER_VMS_IDHACKS_H */ diff --git a/MediaClient/MediaClient/openssl/include/openssl/tls1.h b/MediaClient/MediaClient/openssl/include/openssl/tls1.h new file mode 100644 index 0000000..76d9fda --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/tls1.h @@ -0,0 +1,1237 @@ +/* + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved + * Copyright 2005 Nokia. All rights reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_TLS1_H +# define HEADER_TLS1_H + +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Default security level if not overridden at config time */ +# ifndef OPENSSL_TLS_SECURITY_LEVEL +# define OPENSSL_TLS_SECURITY_LEVEL 1 +# endif + +# define TLS1_VERSION 0x0301 +# define TLS1_1_VERSION 0x0302 +# define TLS1_2_VERSION 0x0303 +# define TLS1_3_VERSION 0x0304 +# define TLS_MAX_VERSION TLS1_3_VERSION + +/* Special value for method supporting multiple versions */ +# define TLS_ANY_VERSION 0x10000 + +# define TLS1_VERSION_MAJOR 0x03 +# define TLS1_VERSION_MINOR 0x01 + +# define TLS1_1_VERSION_MAJOR 0x03 +# define TLS1_1_VERSION_MINOR 0x02 + +# define TLS1_2_VERSION_MAJOR 0x03 +# define TLS1_2_VERSION_MINOR 0x03 + +# define TLS1_get_version(s) \ + ((SSL_version(s) >> 8) == TLS1_VERSION_MAJOR ? SSL_version(s) : 0) + +# define TLS1_get_client_version(s) \ + ((SSL_client_version(s) >> 8) == TLS1_VERSION_MAJOR ? SSL_client_version(s) : 0) + +# define TLS1_AD_DECRYPTION_FAILED 21 +# define TLS1_AD_RECORD_OVERFLOW 22 +# define TLS1_AD_UNKNOWN_CA 48/* fatal */ +# define TLS1_AD_ACCESS_DENIED 49/* fatal */ +# define TLS1_AD_DECODE_ERROR 50/* fatal */ +# define TLS1_AD_DECRYPT_ERROR 51 +# define TLS1_AD_EXPORT_RESTRICTION 60/* fatal */ +# define TLS1_AD_PROTOCOL_VERSION 70/* fatal */ +# define TLS1_AD_INSUFFICIENT_SECURITY 71/* fatal */ +# define TLS1_AD_INTERNAL_ERROR 80/* fatal */ +# define TLS1_AD_INAPPROPRIATE_FALLBACK 86/* fatal */ +# define TLS1_AD_USER_CANCELLED 90 +# define TLS1_AD_NO_RENEGOTIATION 100 +/* TLSv1.3 alerts */ +# define TLS13_AD_MISSING_EXTENSION 109 /* fatal */ +# define TLS13_AD_CERTIFICATE_REQUIRED 116 /* fatal */ +/* codes 110-114 are from RFC3546 */ +# define TLS1_AD_UNSUPPORTED_EXTENSION 110 +# define TLS1_AD_CERTIFICATE_UNOBTAINABLE 111 +# define TLS1_AD_UNRECOGNIZED_NAME 112 +# define TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE 113 +# define TLS1_AD_BAD_CERTIFICATE_HASH_VALUE 114 +# define TLS1_AD_UNKNOWN_PSK_IDENTITY 115/* fatal */ +# define TLS1_AD_NO_APPLICATION_PROTOCOL 120 /* fatal */ + +/* ExtensionType values from RFC3546 / RFC4366 / RFC6066 */ +# define TLSEXT_TYPE_server_name 0 +# define TLSEXT_TYPE_max_fragment_length 1 +# define TLSEXT_TYPE_client_certificate_url 2 +# define TLSEXT_TYPE_trusted_ca_keys 3 +# define TLSEXT_TYPE_truncated_hmac 4 +# define TLSEXT_TYPE_status_request 5 +/* ExtensionType values from RFC4681 */ +# define TLSEXT_TYPE_user_mapping 6 +/* ExtensionType values from RFC5878 */ +# define TLSEXT_TYPE_client_authz 7 +# define TLSEXT_TYPE_server_authz 8 +/* ExtensionType values from RFC6091 */ +# define TLSEXT_TYPE_cert_type 9 + +/* ExtensionType values from RFC4492 */ +/* + * Prior to TLSv1.3 the supported_groups extension was known as + * elliptic_curves + */ +# define TLSEXT_TYPE_supported_groups 10 +# define TLSEXT_TYPE_elliptic_curves TLSEXT_TYPE_supported_groups +# define TLSEXT_TYPE_ec_point_formats 11 + + +/* ExtensionType value from RFC5054 */ +# define TLSEXT_TYPE_srp 12 + +/* ExtensionType values from RFC5246 */ +# define TLSEXT_TYPE_signature_algorithms 13 + +/* ExtensionType value from RFC5764 */ +# define TLSEXT_TYPE_use_srtp 14 + +/* ExtensionType value from RFC5620 */ +# define TLSEXT_TYPE_heartbeat 15 + +/* ExtensionType value from RFC7301 */ +# define TLSEXT_TYPE_application_layer_protocol_negotiation 16 + +/* + * Extension type for Certificate Transparency + * https://tools.ietf.org/html/rfc6962#section-3.3.1 + */ +# define TLSEXT_TYPE_signed_certificate_timestamp 18 + +/* + * ExtensionType value for TLS padding extension. + * http://tools.ietf.org/html/draft-agl-tls-padding + */ +# define TLSEXT_TYPE_padding 21 + +/* ExtensionType value from RFC7366 */ +# define TLSEXT_TYPE_encrypt_then_mac 22 + +/* ExtensionType value from RFC7627 */ +# define TLSEXT_TYPE_extended_master_secret 23 + +/* ExtensionType value from RFC4507 */ +# define TLSEXT_TYPE_session_ticket 35 + +/* As defined for TLS1.3 */ +# define TLSEXT_TYPE_psk 41 +# define TLSEXT_TYPE_early_data 42 +# define TLSEXT_TYPE_supported_versions 43 +# define TLSEXT_TYPE_cookie 44 +# define TLSEXT_TYPE_psk_kex_modes 45 +# define TLSEXT_TYPE_certificate_authorities 47 +# define TLSEXT_TYPE_post_handshake_auth 49 +# define TLSEXT_TYPE_signature_algorithms_cert 50 +# define TLSEXT_TYPE_key_share 51 + +/* Temporary extension type */ +# define TLSEXT_TYPE_renegotiate 0xff01 + +# ifndef OPENSSL_NO_NEXTPROTONEG +/* This is not an IANA defined extension number */ +# define TLSEXT_TYPE_next_proto_neg 13172 +# endif + +/* NameType value from RFC3546 */ +# define TLSEXT_NAMETYPE_host_name 0 +/* status request value from RFC3546 */ +# define TLSEXT_STATUSTYPE_ocsp 1 + +/* ECPointFormat values from RFC4492 */ +# define TLSEXT_ECPOINTFORMAT_first 0 +# define TLSEXT_ECPOINTFORMAT_uncompressed 0 +# define TLSEXT_ECPOINTFORMAT_ansiX962_compressed_prime 1 +# define TLSEXT_ECPOINTFORMAT_ansiX962_compressed_char2 2 +# define TLSEXT_ECPOINTFORMAT_last 2 + +/* Signature and hash algorithms from RFC5246 */ +# define TLSEXT_signature_anonymous 0 +# define TLSEXT_signature_rsa 1 +# define TLSEXT_signature_dsa 2 +# define TLSEXT_signature_ecdsa 3 +# define TLSEXT_signature_gostr34102001 237 +# define TLSEXT_signature_gostr34102012_256 238 +# define TLSEXT_signature_gostr34102012_512 239 + +/* Total number of different signature algorithms */ +# define TLSEXT_signature_num 7 + +# define TLSEXT_hash_none 0 +# define TLSEXT_hash_md5 1 +# define TLSEXT_hash_sha1 2 +# define TLSEXT_hash_sha224 3 +# define TLSEXT_hash_sha256 4 +# define TLSEXT_hash_sha384 5 +# define TLSEXT_hash_sha512 6 +# define TLSEXT_hash_gostr3411 237 +# define TLSEXT_hash_gostr34112012_256 238 +# define TLSEXT_hash_gostr34112012_512 239 + +/* Total number of different digest algorithms */ + +# define TLSEXT_hash_num 10 + +/* Flag set for unrecognised algorithms */ +# define TLSEXT_nid_unknown 0x1000000 + +/* ECC curves */ + +# define TLSEXT_curve_P_256 23 +# define TLSEXT_curve_P_384 24 + +/* OpenSSL value to disable maximum fragment length extension */ +# define TLSEXT_max_fragment_length_DISABLED 0 +/* Allowed values for max fragment length extension */ +# define TLSEXT_max_fragment_length_512 1 +# define TLSEXT_max_fragment_length_1024 2 +# define TLSEXT_max_fragment_length_2048 3 +# define TLSEXT_max_fragment_length_4096 4 + +int SSL_CTX_set_tlsext_max_fragment_length(SSL_CTX *ctx, uint8_t mode); +int SSL_set_tlsext_max_fragment_length(SSL *ssl, uint8_t mode); + +# define TLSEXT_MAXLEN_host_name 255 + +__owur const char *SSL_get_servername(const SSL *s, const int type); +__owur int SSL_get_servername_type(const SSL *s); +/* + * SSL_export_keying_material exports a value derived from the master secret, + * as specified in RFC 5705. It writes |olen| bytes to |out| given a label and + * optional context. (Since a zero length context is allowed, the |use_context| + * flag controls whether a context is included.) It returns 1 on success and + * 0 or -1 otherwise. + */ +__owur int SSL_export_keying_material(SSL *s, unsigned char *out, size_t olen, + const char *label, size_t llen, + const unsigned char *context, + size_t contextlen, int use_context); + +/* + * SSL_export_keying_material_early exports a value derived from the + * early exporter master secret, as specified in + * https://tools.ietf.org/html/draft-ietf-tls-tls13-23. It writes + * |olen| bytes to |out| given a label and optional context. It + * returns 1 on success and 0 otherwise. + */ +__owur int SSL_export_keying_material_early(SSL *s, unsigned char *out, + size_t olen, const char *label, + size_t llen, + const unsigned char *context, + size_t contextlen); + +int SSL_get_peer_signature_type_nid(const SSL *s, int *pnid); +int SSL_get_signature_type_nid(const SSL *s, int *pnid); + +int SSL_get_sigalgs(SSL *s, int idx, + int *psign, int *phash, int *psignandhash, + unsigned char *rsig, unsigned char *rhash); + +int SSL_get_shared_sigalgs(SSL *s, int idx, + int *psign, int *phash, int *psignandhash, + unsigned char *rsig, unsigned char *rhash); + +__owur int SSL_check_chain(SSL *s, X509 *x, EVP_PKEY *pk, STACK_OF(X509) *chain); + +# define SSL_set_tlsext_host_name(s,name) \ + SSL_ctrl(s,SSL_CTRL_SET_TLSEXT_HOSTNAME,TLSEXT_NAMETYPE_host_name,\ + (void *)name) + +# define SSL_set_tlsext_debug_callback(ssl, cb) \ + SSL_callback_ctrl(ssl,SSL_CTRL_SET_TLSEXT_DEBUG_CB,\ + (void (*)(void))cb) + +# define SSL_set_tlsext_debug_arg(ssl, arg) \ + SSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_DEBUG_ARG,0,arg) + +# define SSL_get_tlsext_status_type(ssl) \ + SSL_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_TYPE,0,NULL) + +# define SSL_set_tlsext_status_type(ssl, type) \ + SSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_TYPE,type,NULL) + +# define SSL_get_tlsext_status_exts(ssl, arg) \ + SSL_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_EXTS,0,arg) + +# define SSL_set_tlsext_status_exts(ssl, arg) \ + SSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_EXTS,0,arg) + +# define SSL_get_tlsext_status_ids(ssl, arg) \ + SSL_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_IDS,0,arg) + +# define SSL_set_tlsext_status_ids(ssl, arg) \ + SSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_IDS,0,arg) + +# define SSL_get_tlsext_status_ocsp_resp(ssl, arg) \ + SSL_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_OCSP_RESP,0,arg) + +# define SSL_set_tlsext_status_ocsp_resp(ssl, arg, arglen) \ + SSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_OCSP_RESP,arglen,arg) + +# define SSL_CTX_set_tlsext_servername_callback(ctx, cb) \ + SSL_CTX_callback_ctrl(ctx,SSL_CTRL_SET_TLSEXT_SERVERNAME_CB,\ + (void (*)(void))cb) + +# define SSL_TLSEXT_ERR_OK 0 +# define SSL_TLSEXT_ERR_ALERT_WARNING 1 +# define SSL_TLSEXT_ERR_ALERT_FATAL 2 +# define SSL_TLSEXT_ERR_NOACK 3 + +# define SSL_CTX_set_tlsext_servername_arg(ctx, arg) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TLSEXT_SERVERNAME_ARG,0,arg) + +# define SSL_CTX_get_tlsext_ticket_keys(ctx, keys, keylen) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_GET_TLSEXT_TICKET_KEYS,keylen,keys) +# define SSL_CTX_set_tlsext_ticket_keys(ctx, keys, keylen) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TLSEXT_TICKET_KEYS,keylen,keys) + +# define SSL_CTX_get_tlsext_status_cb(ssl, cb) \ + SSL_CTX_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_CB,0,(void *)cb) +# define SSL_CTX_set_tlsext_status_cb(ssl, cb) \ + SSL_CTX_callback_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB,\ + (void (*)(void))cb) + +# define SSL_CTX_get_tlsext_status_arg(ssl, arg) \ + SSL_CTX_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_CB_ARG,0,arg) +# define SSL_CTX_set_tlsext_status_arg(ssl, arg) \ + SSL_CTX_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB_ARG,0,arg) + +# define SSL_CTX_set_tlsext_status_type(ssl, type) \ + SSL_CTX_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_TYPE,type,NULL) + +# define SSL_CTX_get_tlsext_status_type(ssl) \ + SSL_CTX_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_TYPE,0,NULL) + +# define SSL_CTX_set_tlsext_ticket_key_cb(ssl, cb) \ + SSL_CTX_callback_ctrl(ssl,SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB,\ + (void (*)(void))cb) + +# ifndef OPENSSL_NO_HEARTBEATS +# define SSL_DTLSEXT_HB_ENABLED 0x01 +# define SSL_DTLSEXT_HB_DONT_SEND_REQUESTS 0x02 +# define SSL_DTLSEXT_HB_DONT_RECV_REQUESTS 0x04 +# define SSL_get_dtlsext_heartbeat_pending(ssl) \ + SSL_ctrl(ssl,SSL_CTRL_GET_DTLS_EXT_HEARTBEAT_PENDING,0,NULL) +# define SSL_set_dtlsext_heartbeat_no_requests(ssl, arg) \ + SSL_ctrl(ssl,SSL_CTRL_SET_DTLS_EXT_HEARTBEAT_NO_REQUESTS,arg,NULL) + +# if OPENSSL_API_COMPAT < 0x10100000L +# define SSL_CTRL_TLS_EXT_SEND_HEARTBEAT \ + SSL_CTRL_DTLS_EXT_SEND_HEARTBEAT +# define SSL_CTRL_GET_TLS_EXT_HEARTBEAT_PENDING \ + SSL_CTRL_GET_DTLS_EXT_HEARTBEAT_PENDING +# define SSL_CTRL_SET_TLS_EXT_HEARTBEAT_NO_REQUESTS \ + SSL_CTRL_SET_DTLS_EXT_HEARTBEAT_NO_REQUESTS +# define SSL_TLSEXT_HB_ENABLED \ + SSL_DTLSEXT_HB_ENABLED +# define SSL_TLSEXT_HB_DONT_SEND_REQUESTS \ + SSL_DTLSEXT_HB_DONT_SEND_REQUESTS +# define SSL_TLSEXT_HB_DONT_RECV_REQUESTS \ + SSL_DTLSEXT_HB_DONT_RECV_REQUESTS +# define SSL_get_tlsext_heartbeat_pending(ssl) \ + SSL_get_dtlsext_heartbeat_pending(ssl) +# define SSL_set_tlsext_heartbeat_no_requests(ssl, arg) \ + SSL_set_dtlsext_heartbeat_no_requests(ssl,arg) +# endif +# endif + +/* PSK ciphersuites from 4279 */ +# define TLS1_CK_PSK_WITH_RC4_128_SHA 0x0300008A +# define TLS1_CK_PSK_WITH_3DES_EDE_CBC_SHA 0x0300008B +# define TLS1_CK_PSK_WITH_AES_128_CBC_SHA 0x0300008C +# define TLS1_CK_PSK_WITH_AES_256_CBC_SHA 0x0300008D +# define TLS1_CK_DHE_PSK_WITH_RC4_128_SHA 0x0300008E +# define TLS1_CK_DHE_PSK_WITH_3DES_EDE_CBC_SHA 0x0300008F +# define TLS1_CK_DHE_PSK_WITH_AES_128_CBC_SHA 0x03000090 +# define TLS1_CK_DHE_PSK_WITH_AES_256_CBC_SHA 0x03000091 +# define TLS1_CK_RSA_PSK_WITH_RC4_128_SHA 0x03000092 +# define TLS1_CK_RSA_PSK_WITH_3DES_EDE_CBC_SHA 0x03000093 +# define TLS1_CK_RSA_PSK_WITH_AES_128_CBC_SHA 0x03000094 +# define TLS1_CK_RSA_PSK_WITH_AES_256_CBC_SHA 0x03000095 + +/* PSK ciphersuites from 5487 */ +# define TLS1_CK_PSK_WITH_AES_128_GCM_SHA256 0x030000A8 +# define TLS1_CK_PSK_WITH_AES_256_GCM_SHA384 0x030000A9 +# define TLS1_CK_DHE_PSK_WITH_AES_128_GCM_SHA256 0x030000AA +# define TLS1_CK_DHE_PSK_WITH_AES_256_GCM_SHA384 0x030000AB +# define TLS1_CK_RSA_PSK_WITH_AES_128_GCM_SHA256 0x030000AC +# define TLS1_CK_RSA_PSK_WITH_AES_256_GCM_SHA384 0x030000AD +# define TLS1_CK_PSK_WITH_AES_128_CBC_SHA256 0x030000AE +# define TLS1_CK_PSK_WITH_AES_256_CBC_SHA384 0x030000AF +# define TLS1_CK_PSK_WITH_NULL_SHA256 0x030000B0 +# define TLS1_CK_PSK_WITH_NULL_SHA384 0x030000B1 +# define TLS1_CK_DHE_PSK_WITH_AES_128_CBC_SHA256 0x030000B2 +# define TLS1_CK_DHE_PSK_WITH_AES_256_CBC_SHA384 0x030000B3 +# define TLS1_CK_DHE_PSK_WITH_NULL_SHA256 0x030000B4 +# define TLS1_CK_DHE_PSK_WITH_NULL_SHA384 0x030000B5 +# define TLS1_CK_RSA_PSK_WITH_AES_128_CBC_SHA256 0x030000B6 +# define TLS1_CK_RSA_PSK_WITH_AES_256_CBC_SHA384 0x030000B7 +# define TLS1_CK_RSA_PSK_WITH_NULL_SHA256 0x030000B8 +# define TLS1_CK_RSA_PSK_WITH_NULL_SHA384 0x030000B9 + +/* NULL PSK ciphersuites from RFC4785 */ +# define TLS1_CK_PSK_WITH_NULL_SHA 0x0300002C +# define TLS1_CK_DHE_PSK_WITH_NULL_SHA 0x0300002D +# define TLS1_CK_RSA_PSK_WITH_NULL_SHA 0x0300002E + +/* AES ciphersuites from RFC3268 */ +# define TLS1_CK_RSA_WITH_AES_128_SHA 0x0300002F +# define TLS1_CK_DH_DSS_WITH_AES_128_SHA 0x03000030 +# define TLS1_CK_DH_RSA_WITH_AES_128_SHA 0x03000031 +# define TLS1_CK_DHE_DSS_WITH_AES_128_SHA 0x03000032 +# define TLS1_CK_DHE_RSA_WITH_AES_128_SHA 0x03000033 +# define TLS1_CK_ADH_WITH_AES_128_SHA 0x03000034 +# define TLS1_CK_RSA_WITH_AES_256_SHA 0x03000035 +# define TLS1_CK_DH_DSS_WITH_AES_256_SHA 0x03000036 +# define TLS1_CK_DH_RSA_WITH_AES_256_SHA 0x03000037 +# define TLS1_CK_DHE_DSS_WITH_AES_256_SHA 0x03000038 +# define TLS1_CK_DHE_RSA_WITH_AES_256_SHA 0x03000039 +# define TLS1_CK_ADH_WITH_AES_256_SHA 0x0300003A + +/* TLS v1.2 ciphersuites */ +# define TLS1_CK_RSA_WITH_NULL_SHA256 0x0300003B +# define TLS1_CK_RSA_WITH_AES_128_SHA256 0x0300003C +# define TLS1_CK_RSA_WITH_AES_256_SHA256 0x0300003D +# define TLS1_CK_DH_DSS_WITH_AES_128_SHA256 0x0300003E +# define TLS1_CK_DH_RSA_WITH_AES_128_SHA256 0x0300003F +# define TLS1_CK_DHE_DSS_WITH_AES_128_SHA256 0x03000040 + +/* Camellia ciphersuites from RFC4132 */ +# define TLS1_CK_RSA_WITH_CAMELLIA_128_CBC_SHA 0x03000041 +# define TLS1_CK_DH_DSS_WITH_CAMELLIA_128_CBC_SHA 0x03000042 +# define TLS1_CK_DH_RSA_WITH_CAMELLIA_128_CBC_SHA 0x03000043 +# define TLS1_CK_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA 0x03000044 +# define TLS1_CK_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA 0x03000045 +# define TLS1_CK_ADH_WITH_CAMELLIA_128_CBC_SHA 0x03000046 + +/* TLS v1.2 ciphersuites */ +# define TLS1_CK_DHE_RSA_WITH_AES_128_SHA256 0x03000067 +# define TLS1_CK_DH_DSS_WITH_AES_256_SHA256 0x03000068 +# define TLS1_CK_DH_RSA_WITH_AES_256_SHA256 0x03000069 +# define TLS1_CK_DHE_DSS_WITH_AES_256_SHA256 0x0300006A +# define TLS1_CK_DHE_RSA_WITH_AES_256_SHA256 0x0300006B +# define TLS1_CK_ADH_WITH_AES_128_SHA256 0x0300006C +# define TLS1_CK_ADH_WITH_AES_256_SHA256 0x0300006D + +/* Camellia ciphersuites from RFC4132 */ +# define TLS1_CK_RSA_WITH_CAMELLIA_256_CBC_SHA 0x03000084 +# define TLS1_CK_DH_DSS_WITH_CAMELLIA_256_CBC_SHA 0x03000085 +# define TLS1_CK_DH_RSA_WITH_CAMELLIA_256_CBC_SHA 0x03000086 +# define TLS1_CK_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA 0x03000087 +# define TLS1_CK_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA 0x03000088 +# define TLS1_CK_ADH_WITH_CAMELLIA_256_CBC_SHA 0x03000089 + +/* SEED ciphersuites from RFC4162 */ +# define TLS1_CK_RSA_WITH_SEED_SHA 0x03000096 +# define TLS1_CK_DH_DSS_WITH_SEED_SHA 0x03000097 +# define TLS1_CK_DH_RSA_WITH_SEED_SHA 0x03000098 +# define TLS1_CK_DHE_DSS_WITH_SEED_SHA 0x03000099 +# define TLS1_CK_DHE_RSA_WITH_SEED_SHA 0x0300009A +# define TLS1_CK_ADH_WITH_SEED_SHA 0x0300009B + +/* TLS v1.2 GCM ciphersuites from RFC5288 */ +# define TLS1_CK_RSA_WITH_AES_128_GCM_SHA256 0x0300009C +# define TLS1_CK_RSA_WITH_AES_256_GCM_SHA384 0x0300009D +# define TLS1_CK_DHE_RSA_WITH_AES_128_GCM_SHA256 0x0300009E +# define TLS1_CK_DHE_RSA_WITH_AES_256_GCM_SHA384 0x0300009F +# define TLS1_CK_DH_RSA_WITH_AES_128_GCM_SHA256 0x030000A0 +# define TLS1_CK_DH_RSA_WITH_AES_256_GCM_SHA384 0x030000A1 +# define TLS1_CK_DHE_DSS_WITH_AES_128_GCM_SHA256 0x030000A2 +# define TLS1_CK_DHE_DSS_WITH_AES_256_GCM_SHA384 0x030000A3 +# define TLS1_CK_DH_DSS_WITH_AES_128_GCM_SHA256 0x030000A4 +# define TLS1_CK_DH_DSS_WITH_AES_256_GCM_SHA384 0x030000A5 +# define TLS1_CK_ADH_WITH_AES_128_GCM_SHA256 0x030000A6 +# define TLS1_CK_ADH_WITH_AES_256_GCM_SHA384 0x030000A7 + +/* CCM ciphersuites from RFC6655 */ +# define TLS1_CK_RSA_WITH_AES_128_CCM 0x0300C09C +# define TLS1_CK_RSA_WITH_AES_256_CCM 0x0300C09D +# define TLS1_CK_DHE_RSA_WITH_AES_128_CCM 0x0300C09E +# define TLS1_CK_DHE_RSA_WITH_AES_256_CCM 0x0300C09F +# define TLS1_CK_RSA_WITH_AES_128_CCM_8 0x0300C0A0 +# define TLS1_CK_RSA_WITH_AES_256_CCM_8 0x0300C0A1 +# define TLS1_CK_DHE_RSA_WITH_AES_128_CCM_8 0x0300C0A2 +# define TLS1_CK_DHE_RSA_WITH_AES_256_CCM_8 0x0300C0A3 +# define TLS1_CK_PSK_WITH_AES_128_CCM 0x0300C0A4 +# define TLS1_CK_PSK_WITH_AES_256_CCM 0x0300C0A5 +# define TLS1_CK_DHE_PSK_WITH_AES_128_CCM 0x0300C0A6 +# define TLS1_CK_DHE_PSK_WITH_AES_256_CCM 0x0300C0A7 +# define TLS1_CK_PSK_WITH_AES_128_CCM_8 0x0300C0A8 +# define TLS1_CK_PSK_WITH_AES_256_CCM_8 0x0300C0A9 +# define TLS1_CK_DHE_PSK_WITH_AES_128_CCM_8 0x0300C0AA +# define TLS1_CK_DHE_PSK_WITH_AES_256_CCM_8 0x0300C0AB + +/* CCM ciphersuites from RFC7251 */ +# define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_CCM 0x0300C0AC +# define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_CCM 0x0300C0AD +# define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_CCM_8 0x0300C0AE +# define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_CCM_8 0x0300C0AF + +/* TLS 1.2 Camellia SHA-256 ciphersuites from RFC5932 */ +# define TLS1_CK_RSA_WITH_CAMELLIA_128_CBC_SHA256 0x030000BA +# define TLS1_CK_DH_DSS_WITH_CAMELLIA_128_CBC_SHA256 0x030000BB +# define TLS1_CK_DH_RSA_WITH_CAMELLIA_128_CBC_SHA256 0x030000BC +# define TLS1_CK_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA256 0x030000BD +# define TLS1_CK_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 0x030000BE +# define TLS1_CK_ADH_WITH_CAMELLIA_128_CBC_SHA256 0x030000BF + +# define TLS1_CK_RSA_WITH_CAMELLIA_256_CBC_SHA256 0x030000C0 +# define TLS1_CK_DH_DSS_WITH_CAMELLIA_256_CBC_SHA256 0x030000C1 +# define TLS1_CK_DH_RSA_WITH_CAMELLIA_256_CBC_SHA256 0x030000C2 +# define TLS1_CK_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA256 0x030000C3 +# define TLS1_CK_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256 0x030000C4 +# define TLS1_CK_ADH_WITH_CAMELLIA_256_CBC_SHA256 0x030000C5 + +/* ECC ciphersuites from RFC4492 */ +# define TLS1_CK_ECDH_ECDSA_WITH_NULL_SHA 0x0300C001 +# define TLS1_CK_ECDH_ECDSA_WITH_RC4_128_SHA 0x0300C002 +# define TLS1_CK_ECDH_ECDSA_WITH_DES_192_CBC3_SHA 0x0300C003 +# define TLS1_CK_ECDH_ECDSA_WITH_AES_128_CBC_SHA 0x0300C004 +# define TLS1_CK_ECDH_ECDSA_WITH_AES_256_CBC_SHA 0x0300C005 + +# define TLS1_CK_ECDHE_ECDSA_WITH_NULL_SHA 0x0300C006 +# define TLS1_CK_ECDHE_ECDSA_WITH_RC4_128_SHA 0x0300C007 +# define TLS1_CK_ECDHE_ECDSA_WITH_DES_192_CBC3_SHA 0x0300C008 +# define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_CBC_SHA 0x0300C009 +# define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_CBC_SHA 0x0300C00A + +# define TLS1_CK_ECDH_RSA_WITH_NULL_SHA 0x0300C00B +# define TLS1_CK_ECDH_RSA_WITH_RC4_128_SHA 0x0300C00C +# define TLS1_CK_ECDH_RSA_WITH_DES_192_CBC3_SHA 0x0300C00D +# define TLS1_CK_ECDH_RSA_WITH_AES_128_CBC_SHA 0x0300C00E +# define TLS1_CK_ECDH_RSA_WITH_AES_256_CBC_SHA 0x0300C00F + +# define TLS1_CK_ECDHE_RSA_WITH_NULL_SHA 0x0300C010 +# define TLS1_CK_ECDHE_RSA_WITH_RC4_128_SHA 0x0300C011 +# define TLS1_CK_ECDHE_RSA_WITH_DES_192_CBC3_SHA 0x0300C012 +# define TLS1_CK_ECDHE_RSA_WITH_AES_128_CBC_SHA 0x0300C013 +# define TLS1_CK_ECDHE_RSA_WITH_AES_256_CBC_SHA 0x0300C014 + +# define TLS1_CK_ECDH_anon_WITH_NULL_SHA 0x0300C015 +# define TLS1_CK_ECDH_anon_WITH_RC4_128_SHA 0x0300C016 +# define TLS1_CK_ECDH_anon_WITH_DES_192_CBC3_SHA 0x0300C017 +# define TLS1_CK_ECDH_anon_WITH_AES_128_CBC_SHA 0x0300C018 +# define TLS1_CK_ECDH_anon_WITH_AES_256_CBC_SHA 0x0300C019 + +/* SRP ciphersuites from RFC 5054 */ +# define TLS1_CK_SRP_SHA_WITH_3DES_EDE_CBC_SHA 0x0300C01A +# define TLS1_CK_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA 0x0300C01B +# define TLS1_CK_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA 0x0300C01C +# define TLS1_CK_SRP_SHA_WITH_AES_128_CBC_SHA 0x0300C01D +# define TLS1_CK_SRP_SHA_RSA_WITH_AES_128_CBC_SHA 0x0300C01E +# define TLS1_CK_SRP_SHA_DSS_WITH_AES_128_CBC_SHA 0x0300C01F +# define TLS1_CK_SRP_SHA_WITH_AES_256_CBC_SHA 0x0300C020 +# define TLS1_CK_SRP_SHA_RSA_WITH_AES_256_CBC_SHA 0x0300C021 +# define TLS1_CK_SRP_SHA_DSS_WITH_AES_256_CBC_SHA 0x0300C022 + +/* ECDH HMAC based ciphersuites from RFC5289 */ +# define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_SHA256 0x0300C023 +# define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_SHA384 0x0300C024 +# define TLS1_CK_ECDH_ECDSA_WITH_AES_128_SHA256 0x0300C025 +# define TLS1_CK_ECDH_ECDSA_WITH_AES_256_SHA384 0x0300C026 +# define TLS1_CK_ECDHE_RSA_WITH_AES_128_SHA256 0x0300C027 +# define TLS1_CK_ECDHE_RSA_WITH_AES_256_SHA384 0x0300C028 +# define TLS1_CK_ECDH_RSA_WITH_AES_128_SHA256 0x0300C029 +# define TLS1_CK_ECDH_RSA_WITH_AES_256_SHA384 0x0300C02A + +/* ECDH GCM based ciphersuites from RFC5289 */ +# define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 0x0300C02B +# define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 0x0300C02C +# define TLS1_CK_ECDH_ECDSA_WITH_AES_128_GCM_SHA256 0x0300C02D +# define TLS1_CK_ECDH_ECDSA_WITH_AES_256_GCM_SHA384 0x0300C02E +# define TLS1_CK_ECDHE_RSA_WITH_AES_128_GCM_SHA256 0x0300C02F +# define TLS1_CK_ECDHE_RSA_WITH_AES_256_GCM_SHA384 0x0300C030 +# define TLS1_CK_ECDH_RSA_WITH_AES_128_GCM_SHA256 0x0300C031 +# define TLS1_CK_ECDH_RSA_WITH_AES_256_GCM_SHA384 0x0300C032 + +/* ECDHE PSK ciphersuites from RFC5489 */ +# define TLS1_CK_ECDHE_PSK_WITH_RC4_128_SHA 0x0300C033 +# define TLS1_CK_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA 0x0300C034 +# define TLS1_CK_ECDHE_PSK_WITH_AES_128_CBC_SHA 0x0300C035 +# define TLS1_CK_ECDHE_PSK_WITH_AES_256_CBC_SHA 0x0300C036 + +# define TLS1_CK_ECDHE_PSK_WITH_AES_128_CBC_SHA256 0x0300C037 +# define TLS1_CK_ECDHE_PSK_WITH_AES_256_CBC_SHA384 0x0300C038 + +/* NULL PSK ciphersuites from RFC4785 */ +# define TLS1_CK_ECDHE_PSK_WITH_NULL_SHA 0x0300C039 +# define TLS1_CK_ECDHE_PSK_WITH_NULL_SHA256 0x0300C03A +# define TLS1_CK_ECDHE_PSK_WITH_NULL_SHA384 0x0300C03B + +/* Camellia-CBC ciphersuites from RFC6367 */ +# define TLS1_CK_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 0x0300C072 +# define TLS1_CK_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 0x0300C073 +# define TLS1_CK_ECDH_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 0x0300C074 +# define TLS1_CK_ECDH_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 0x0300C075 +# define TLS1_CK_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 0x0300C076 +# define TLS1_CK_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384 0x0300C077 +# define TLS1_CK_ECDH_RSA_WITH_CAMELLIA_128_CBC_SHA256 0x0300C078 +# define TLS1_CK_ECDH_RSA_WITH_CAMELLIA_256_CBC_SHA384 0x0300C079 + +# define TLS1_CK_PSK_WITH_CAMELLIA_128_CBC_SHA256 0x0300C094 +# define TLS1_CK_PSK_WITH_CAMELLIA_256_CBC_SHA384 0x0300C095 +# define TLS1_CK_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 0x0300C096 +# define TLS1_CK_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 0x0300C097 +# define TLS1_CK_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256 0x0300C098 +# define TLS1_CK_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384 0x0300C099 +# define TLS1_CK_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 0x0300C09A +# define TLS1_CK_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 0x0300C09B + +/* draft-ietf-tls-chacha20-poly1305-03 */ +# define TLS1_CK_ECDHE_RSA_WITH_CHACHA20_POLY1305 0x0300CCA8 +# define TLS1_CK_ECDHE_ECDSA_WITH_CHACHA20_POLY1305 0x0300CCA9 +# define TLS1_CK_DHE_RSA_WITH_CHACHA20_POLY1305 0x0300CCAA +# define TLS1_CK_PSK_WITH_CHACHA20_POLY1305 0x0300CCAB +# define TLS1_CK_ECDHE_PSK_WITH_CHACHA20_POLY1305 0x0300CCAC +# define TLS1_CK_DHE_PSK_WITH_CHACHA20_POLY1305 0x0300CCAD +# define TLS1_CK_RSA_PSK_WITH_CHACHA20_POLY1305 0x0300CCAE + +/* TLS v1.3 ciphersuites */ +# define TLS1_3_CK_AES_128_GCM_SHA256 0x03001301 +# define TLS1_3_CK_AES_256_GCM_SHA384 0x03001302 +# define TLS1_3_CK_CHACHA20_POLY1305_SHA256 0x03001303 +# define TLS1_3_CK_AES_128_CCM_SHA256 0x03001304 +# define TLS1_3_CK_AES_128_CCM_8_SHA256 0x03001305 + +/* Aria ciphersuites from RFC6209 */ +# define TLS1_CK_RSA_WITH_ARIA_128_GCM_SHA256 0x0300C050 +# define TLS1_CK_RSA_WITH_ARIA_256_GCM_SHA384 0x0300C051 +# define TLS1_CK_DHE_RSA_WITH_ARIA_128_GCM_SHA256 0x0300C052 +# define TLS1_CK_DHE_RSA_WITH_ARIA_256_GCM_SHA384 0x0300C053 +# define TLS1_CK_DH_RSA_WITH_ARIA_128_GCM_SHA256 0x0300C054 +# define TLS1_CK_DH_RSA_WITH_ARIA_256_GCM_SHA384 0x0300C055 +# define TLS1_CK_DHE_DSS_WITH_ARIA_128_GCM_SHA256 0x0300C056 +# define TLS1_CK_DHE_DSS_WITH_ARIA_256_GCM_SHA384 0x0300C057 +# define TLS1_CK_DH_DSS_WITH_ARIA_128_GCM_SHA256 0x0300C058 +# define TLS1_CK_DH_DSS_WITH_ARIA_256_GCM_SHA384 0x0300C059 +# define TLS1_CK_DH_anon_WITH_ARIA_128_GCM_SHA256 0x0300C05A +# define TLS1_CK_DH_anon_WITH_ARIA_256_GCM_SHA384 0x0300C05B +# define TLS1_CK_ECDHE_ECDSA_WITH_ARIA_128_GCM_SHA256 0x0300C05C +# define TLS1_CK_ECDHE_ECDSA_WITH_ARIA_256_GCM_SHA384 0x0300C05D +# define TLS1_CK_ECDH_ECDSA_WITH_ARIA_128_GCM_SHA256 0x0300C05E +# define TLS1_CK_ECDH_ECDSA_WITH_ARIA_256_GCM_SHA384 0x0300C05F +# define TLS1_CK_ECDHE_RSA_WITH_ARIA_128_GCM_SHA256 0x0300C060 +# define TLS1_CK_ECDHE_RSA_WITH_ARIA_256_GCM_SHA384 0x0300C061 +# define TLS1_CK_ECDH_RSA_WITH_ARIA_128_GCM_SHA256 0x0300C062 +# define TLS1_CK_ECDH_RSA_WITH_ARIA_256_GCM_SHA384 0x0300C063 +# define TLS1_CK_PSK_WITH_ARIA_128_GCM_SHA256 0x0300C06A +# define TLS1_CK_PSK_WITH_ARIA_256_GCM_SHA384 0x0300C06B +# define TLS1_CK_DHE_PSK_WITH_ARIA_128_GCM_SHA256 0x0300C06C +# define TLS1_CK_DHE_PSK_WITH_ARIA_256_GCM_SHA384 0x0300C06D +# define TLS1_CK_RSA_PSK_WITH_ARIA_128_GCM_SHA256 0x0300C06E +# define TLS1_CK_RSA_PSK_WITH_ARIA_256_GCM_SHA384 0x0300C06F + +/* a bundle of RFC standard cipher names, generated from ssl3_ciphers[] */ +# define TLS1_RFC_RSA_WITH_AES_128_SHA "TLS_RSA_WITH_AES_128_CBC_SHA" +# define TLS1_RFC_DHE_DSS_WITH_AES_128_SHA "TLS_DHE_DSS_WITH_AES_128_CBC_SHA" +# define TLS1_RFC_DHE_RSA_WITH_AES_128_SHA "TLS_DHE_RSA_WITH_AES_128_CBC_SHA" +# define TLS1_RFC_ADH_WITH_AES_128_SHA "TLS_DH_anon_WITH_AES_128_CBC_SHA" +# define TLS1_RFC_RSA_WITH_AES_256_SHA "TLS_RSA_WITH_AES_256_CBC_SHA" +# define TLS1_RFC_DHE_DSS_WITH_AES_256_SHA "TLS_DHE_DSS_WITH_AES_256_CBC_SHA" +# define TLS1_RFC_DHE_RSA_WITH_AES_256_SHA "TLS_DHE_RSA_WITH_AES_256_CBC_SHA" +# define TLS1_RFC_ADH_WITH_AES_256_SHA "TLS_DH_anon_WITH_AES_256_CBC_SHA" +# define TLS1_RFC_RSA_WITH_NULL_SHA256 "TLS_RSA_WITH_NULL_SHA256" +# define TLS1_RFC_RSA_WITH_AES_128_SHA256 "TLS_RSA_WITH_AES_128_CBC_SHA256" +# define TLS1_RFC_RSA_WITH_AES_256_SHA256 "TLS_RSA_WITH_AES_256_CBC_SHA256" +# define TLS1_RFC_DHE_DSS_WITH_AES_128_SHA256 "TLS_DHE_DSS_WITH_AES_128_CBC_SHA256" +# define TLS1_RFC_DHE_RSA_WITH_AES_128_SHA256 "TLS_DHE_RSA_WITH_AES_128_CBC_SHA256" +# define TLS1_RFC_DHE_DSS_WITH_AES_256_SHA256 "TLS_DHE_DSS_WITH_AES_256_CBC_SHA256" +# define TLS1_RFC_DHE_RSA_WITH_AES_256_SHA256 "TLS_DHE_RSA_WITH_AES_256_CBC_SHA256" +# define TLS1_RFC_ADH_WITH_AES_128_SHA256 "TLS_DH_anon_WITH_AES_128_CBC_SHA256" +# define TLS1_RFC_ADH_WITH_AES_256_SHA256 "TLS_DH_anon_WITH_AES_256_CBC_SHA256" +# define TLS1_RFC_RSA_WITH_AES_128_GCM_SHA256 "TLS_RSA_WITH_AES_128_GCM_SHA256" +# define TLS1_RFC_RSA_WITH_AES_256_GCM_SHA384 "TLS_RSA_WITH_AES_256_GCM_SHA384" +# define TLS1_RFC_DHE_RSA_WITH_AES_128_GCM_SHA256 "TLS_DHE_RSA_WITH_AES_128_GCM_SHA256" +# define TLS1_RFC_DHE_RSA_WITH_AES_256_GCM_SHA384 "TLS_DHE_RSA_WITH_AES_256_GCM_SHA384" +# define TLS1_RFC_DHE_DSS_WITH_AES_128_GCM_SHA256 "TLS_DHE_DSS_WITH_AES_128_GCM_SHA256" +# define TLS1_RFC_DHE_DSS_WITH_AES_256_GCM_SHA384 "TLS_DHE_DSS_WITH_AES_256_GCM_SHA384" +# define TLS1_RFC_ADH_WITH_AES_128_GCM_SHA256 "TLS_DH_anon_WITH_AES_128_GCM_SHA256" +# define TLS1_RFC_ADH_WITH_AES_256_GCM_SHA384 "TLS_DH_anon_WITH_AES_256_GCM_SHA384" +# define TLS1_RFC_RSA_WITH_AES_128_CCM "TLS_RSA_WITH_AES_128_CCM" +# define TLS1_RFC_RSA_WITH_AES_256_CCM "TLS_RSA_WITH_AES_256_CCM" +# define TLS1_RFC_DHE_RSA_WITH_AES_128_CCM "TLS_DHE_RSA_WITH_AES_128_CCM" +# define TLS1_RFC_DHE_RSA_WITH_AES_256_CCM "TLS_DHE_RSA_WITH_AES_256_CCM" +# define TLS1_RFC_RSA_WITH_AES_128_CCM_8 "TLS_RSA_WITH_AES_128_CCM_8" +# define TLS1_RFC_RSA_WITH_AES_256_CCM_8 "TLS_RSA_WITH_AES_256_CCM_8" +# define TLS1_RFC_DHE_RSA_WITH_AES_128_CCM_8 "TLS_DHE_RSA_WITH_AES_128_CCM_8" +# define TLS1_RFC_DHE_RSA_WITH_AES_256_CCM_8 "TLS_DHE_RSA_WITH_AES_256_CCM_8" +# define TLS1_RFC_PSK_WITH_AES_128_CCM "TLS_PSK_WITH_AES_128_CCM" +# define TLS1_RFC_PSK_WITH_AES_256_CCM "TLS_PSK_WITH_AES_256_CCM" +# define TLS1_RFC_DHE_PSK_WITH_AES_128_CCM "TLS_DHE_PSK_WITH_AES_128_CCM" +# define TLS1_RFC_DHE_PSK_WITH_AES_256_CCM "TLS_DHE_PSK_WITH_AES_256_CCM" +# define TLS1_RFC_PSK_WITH_AES_128_CCM_8 "TLS_PSK_WITH_AES_128_CCM_8" +# define TLS1_RFC_PSK_WITH_AES_256_CCM_8 "TLS_PSK_WITH_AES_256_CCM_8" +# define TLS1_RFC_DHE_PSK_WITH_AES_128_CCM_8 "TLS_PSK_DHE_WITH_AES_128_CCM_8" +# define TLS1_RFC_DHE_PSK_WITH_AES_256_CCM_8 "TLS_PSK_DHE_WITH_AES_256_CCM_8" +# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_128_CCM "TLS_ECDHE_ECDSA_WITH_AES_128_CCM" +# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_256_CCM "TLS_ECDHE_ECDSA_WITH_AES_256_CCM" +# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_128_CCM_8 "TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8" +# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_256_CCM_8 "TLS_ECDHE_ECDSA_WITH_AES_256_CCM_8" +# define TLS1_3_RFC_AES_128_GCM_SHA256 "TLS_AES_128_GCM_SHA256" +# define TLS1_3_RFC_AES_256_GCM_SHA384 "TLS_AES_256_GCM_SHA384" +# define TLS1_3_RFC_CHACHA20_POLY1305_SHA256 "TLS_CHACHA20_POLY1305_SHA256" +# define TLS1_3_RFC_AES_128_CCM_SHA256 "TLS_AES_128_CCM_SHA256" +# define TLS1_3_RFC_AES_128_CCM_8_SHA256 "TLS_AES_128_CCM_8_SHA256" +# define TLS1_RFC_ECDHE_ECDSA_WITH_NULL_SHA "TLS_ECDHE_ECDSA_WITH_NULL_SHA" +# define TLS1_RFC_ECDHE_ECDSA_WITH_DES_192_CBC3_SHA "TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA" +# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_128_CBC_SHA "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA" +# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_256_CBC_SHA "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA" +# define TLS1_RFC_ECDHE_RSA_WITH_NULL_SHA "TLS_ECDHE_RSA_WITH_NULL_SHA" +# define TLS1_RFC_ECDHE_RSA_WITH_DES_192_CBC3_SHA "TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA" +# define TLS1_RFC_ECDHE_RSA_WITH_AES_128_CBC_SHA "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA" +# define TLS1_RFC_ECDHE_RSA_WITH_AES_256_CBC_SHA "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA" +# define TLS1_RFC_ECDH_anon_WITH_NULL_SHA "TLS_ECDH_anon_WITH_NULL_SHA" +# define TLS1_RFC_ECDH_anon_WITH_DES_192_CBC3_SHA "TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA" +# define TLS1_RFC_ECDH_anon_WITH_AES_128_CBC_SHA "TLS_ECDH_anon_WITH_AES_128_CBC_SHA" +# define TLS1_RFC_ECDH_anon_WITH_AES_256_CBC_SHA "TLS_ECDH_anon_WITH_AES_256_CBC_SHA" +# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_128_SHA256 "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256" +# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_256_SHA384 "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384" +# define TLS1_RFC_ECDHE_RSA_WITH_AES_128_SHA256 "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256" +# define TLS1_RFC_ECDHE_RSA_WITH_AES_256_SHA384 "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384" +# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256" +# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384" +# define TLS1_RFC_ECDHE_RSA_WITH_AES_128_GCM_SHA256 "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256" +# define TLS1_RFC_ECDHE_RSA_WITH_AES_256_GCM_SHA384 "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384" +# define TLS1_RFC_PSK_WITH_NULL_SHA "TLS_PSK_WITH_NULL_SHA" +# define TLS1_RFC_DHE_PSK_WITH_NULL_SHA "TLS_DHE_PSK_WITH_NULL_SHA" +# define TLS1_RFC_RSA_PSK_WITH_NULL_SHA "TLS_RSA_PSK_WITH_NULL_SHA" +# define TLS1_RFC_PSK_WITH_3DES_EDE_CBC_SHA "TLS_PSK_WITH_3DES_EDE_CBC_SHA" +# define TLS1_RFC_PSK_WITH_AES_128_CBC_SHA "TLS_PSK_WITH_AES_128_CBC_SHA" +# define TLS1_RFC_PSK_WITH_AES_256_CBC_SHA "TLS_PSK_WITH_AES_256_CBC_SHA" +# define TLS1_RFC_DHE_PSK_WITH_3DES_EDE_CBC_SHA "TLS_DHE_PSK_WITH_3DES_EDE_CBC_SHA" +# define TLS1_RFC_DHE_PSK_WITH_AES_128_CBC_SHA "TLS_DHE_PSK_WITH_AES_128_CBC_SHA" +# define TLS1_RFC_DHE_PSK_WITH_AES_256_CBC_SHA "TLS_DHE_PSK_WITH_AES_256_CBC_SHA" +# define TLS1_RFC_RSA_PSK_WITH_3DES_EDE_CBC_SHA "TLS_RSA_PSK_WITH_3DES_EDE_CBC_SHA" +# define TLS1_RFC_RSA_PSK_WITH_AES_128_CBC_SHA "TLS_RSA_PSK_WITH_AES_128_CBC_SHA" +# define TLS1_RFC_RSA_PSK_WITH_AES_256_CBC_SHA "TLS_RSA_PSK_WITH_AES_256_CBC_SHA" +# define TLS1_RFC_PSK_WITH_AES_128_GCM_SHA256 "TLS_PSK_WITH_AES_128_GCM_SHA256" +# define TLS1_RFC_PSK_WITH_AES_256_GCM_SHA384 "TLS_PSK_WITH_AES_256_GCM_SHA384" +# define TLS1_RFC_DHE_PSK_WITH_AES_128_GCM_SHA256 "TLS_DHE_PSK_WITH_AES_128_GCM_SHA256" +# define TLS1_RFC_DHE_PSK_WITH_AES_256_GCM_SHA384 "TLS_DHE_PSK_WITH_AES_256_GCM_SHA384" +# define TLS1_RFC_RSA_PSK_WITH_AES_128_GCM_SHA256 "TLS_RSA_PSK_WITH_AES_128_GCM_SHA256" +# define TLS1_RFC_RSA_PSK_WITH_AES_256_GCM_SHA384 "TLS_RSA_PSK_WITH_AES_256_GCM_SHA384" +# define TLS1_RFC_PSK_WITH_AES_128_CBC_SHA256 "TLS_PSK_WITH_AES_128_CBC_SHA256" +# define TLS1_RFC_PSK_WITH_AES_256_CBC_SHA384 "TLS_PSK_WITH_AES_256_CBC_SHA384" +# define TLS1_RFC_PSK_WITH_NULL_SHA256 "TLS_PSK_WITH_NULL_SHA256" +# define TLS1_RFC_PSK_WITH_NULL_SHA384 "TLS_PSK_WITH_NULL_SHA384" +# define TLS1_RFC_DHE_PSK_WITH_AES_128_CBC_SHA256 "TLS_DHE_PSK_WITH_AES_128_CBC_SHA256" +# define TLS1_RFC_DHE_PSK_WITH_AES_256_CBC_SHA384 "TLS_DHE_PSK_WITH_AES_256_CBC_SHA384" +# define TLS1_RFC_DHE_PSK_WITH_NULL_SHA256 "TLS_DHE_PSK_WITH_NULL_SHA256" +# define TLS1_RFC_DHE_PSK_WITH_NULL_SHA384 "TLS_DHE_PSK_WITH_NULL_SHA384" +# define TLS1_RFC_RSA_PSK_WITH_AES_128_CBC_SHA256 "TLS_RSA_PSK_WITH_AES_128_CBC_SHA256" +# define TLS1_RFC_RSA_PSK_WITH_AES_256_CBC_SHA384 "TLS_RSA_PSK_WITH_AES_256_CBC_SHA384" +# define TLS1_RFC_RSA_PSK_WITH_NULL_SHA256 "TLS_RSA_PSK_WITH_NULL_SHA256" +# define TLS1_RFC_RSA_PSK_WITH_NULL_SHA384 "TLS_RSA_PSK_WITH_NULL_SHA384" +# define TLS1_RFC_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA "TLS_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA" +# define TLS1_RFC_ECDHE_PSK_WITH_AES_128_CBC_SHA "TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA" +# define TLS1_RFC_ECDHE_PSK_WITH_AES_256_CBC_SHA "TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA" +# define TLS1_RFC_ECDHE_PSK_WITH_AES_128_CBC_SHA256 "TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256" +# define TLS1_RFC_ECDHE_PSK_WITH_AES_256_CBC_SHA384 "TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA384" +# define TLS1_RFC_ECDHE_PSK_WITH_NULL_SHA "TLS_ECDHE_PSK_WITH_NULL_SHA" +# define TLS1_RFC_ECDHE_PSK_WITH_NULL_SHA256 "TLS_ECDHE_PSK_WITH_NULL_SHA256" +# define TLS1_RFC_ECDHE_PSK_WITH_NULL_SHA384 "TLS_ECDHE_PSK_WITH_NULL_SHA384" +# define TLS1_RFC_SRP_SHA_WITH_3DES_EDE_CBC_SHA "TLS_SRP_SHA_WITH_3DES_EDE_CBC_SHA" +# define TLS1_RFC_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA "TLS_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA" +# define TLS1_RFC_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA "TLS_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA" +# define TLS1_RFC_SRP_SHA_WITH_AES_128_CBC_SHA "TLS_SRP_SHA_WITH_AES_128_CBC_SHA" +# define TLS1_RFC_SRP_SHA_RSA_WITH_AES_128_CBC_SHA "TLS_SRP_SHA_RSA_WITH_AES_128_CBC_SHA" +# define TLS1_RFC_SRP_SHA_DSS_WITH_AES_128_CBC_SHA "TLS_SRP_SHA_DSS_WITH_AES_128_CBC_SHA" +# define TLS1_RFC_SRP_SHA_WITH_AES_256_CBC_SHA "TLS_SRP_SHA_WITH_AES_256_CBC_SHA" +# define TLS1_RFC_SRP_SHA_RSA_WITH_AES_256_CBC_SHA "TLS_SRP_SHA_RSA_WITH_AES_256_CBC_SHA" +# define TLS1_RFC_SRP_SHA_DSS_WITH_AES_256_CBC_SHA "TLS_SRP_SHA_DSS_WITH_AES_256_CBC_SHA" +# define TLS1_RFC_DHE_RSA_WITH_CHACHA20_POLY1305 "TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256" +# define TLS1_RFC_ECDHE_RSA_WITH_CHACHA20_POLY1305 "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256" +# define TLS1_RFC_ECDHE_ECDSA_WITH_CHACHA20_POLY1305 "TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256" +# define TLS1_RFC_PSK_WITH_CHACHA20_POLY1305 "TLS_PSK_WITH_CHACHA20_POLY1305_SHA256" +# define TLS1_RFC_ECDHE_PSK_WITH_CHACHA20_POLY1305 "TLS_ECDHE_PSK_WITH_CHACHA20_POLY1305_SHA256" +# define TLS1_RFC_DHE_PSK_WITH_CHACHA20_POLY1305 "TLS_DHE_PSK_WITH_CHACHA20_POLY1305_SHA256" +# define TLS1_RFC_RSA_PSK_WITH_CHACHA20_POLY1305 "TLS_RSA_PSK_WITH_CHACHA20_POLY1305_SHA256" +# define TLS1_RFC_RSA_WITH_CAMELLIA_128_CBC_SHA256 "TLS_RSA_WITH_CAMELLIA_128_CBC_SHA256" +# define TLS1_RFC_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA256 "TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA256" +# define TLS1_RFC_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 "TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256" +# define TLS1_RFC_ADH_WITH_CAMELLIA_128_CBC_SHA256 "TLS_DH_anon_WITH_CAMELLIA_128_CBC_SHA256" +# define TLS1_RFC_RSA_WITH_CAMELLIA_256_CBC_SHA256 "TLS_RSA_WITH_CAMELLIA_256_CBC_SHA256" +# define TLS1_RFC_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA256 "TLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA256" +# define TLS1_RFC_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256 "TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256" +# define TLS1_RFC_ADH_WITH_CAMELLIA_256_CBC_SHA256 "TLS_DH_anon_WITH_CAMELLIA_256_CBC_SHA256" +# define TLS1_RFC_RSA_WITH_CAMELLIA_256_CBC_SHA "TLS_RSA_WITH_CAMELLIA_256_CBC_SHA" +# define TLS1_RFC_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA "TLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA" +# define TLS1_RFC_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA "TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA" +# define TLS1_RFC_ADH_WITH_CAMELLIA_256_CBC_SHA "TLS_DH_anon_WITH_CAMELLIA_256_CBC_SHA" +# define TLS1_RFC_RSA_WITH_CAMELLIA_128_CBC_SHA "TLS_RSA_WITH_CAMELLIA_128_CBC_SHA" +# define TLS1_RFC_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA "TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA" +# define TLS1_RFC_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA "TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA" +# define TLS1_RFC_ADH_WITH_CAMELLIA_128_CBC_SHA "TLS_DH_anon_WITH_CAMELLIA_128_CBC_SHA" +# define TLS1_RFC_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 "TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256" +# define TLS1_RFC_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 "TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384" +# define TLS1_RFC_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 "TLS_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256" +# define TLS1_RFC_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384 "TLS_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384" +# define TLS1_RFC_PSK_WITH_CAMELLIA_128_CBC_SHA256 "TLS_PSK_WITH_CAMELLIA_128_CBC_SHA256" +# define TLS1_RFC_PSK_WITH_CAMELLIA_256_CBC_SHA384 "TLS_PSK_WITH_CAMELLIA_256_CBC_SHA384" +# define TLS1_RFC_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 "TLS_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256" +# define TLS1_RFC_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 "TLS_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384" +# define TLS1_RFC_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256 "TLS_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256" +# define TLS1_RFC_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384 "TLS_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384" +# define TLS1_RFC_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 "TLS_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256" +# define TLS1_RFC_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 "TLS_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384" +# define TLS1_RFC_RSA_WITH_SEED_SHA "TLS_RSA_WITH_SEED_CBC_SHA" +# define TLS1_RFC_DHE_DSS_WITH_SEED_SHA "TLS_DHE_DSS_WITH_SEED_CBC_SHA" +# define TLS1_RFC_DHE_RSA_WITH_SEED_SHA "TLS_DHE_RSA_WITH_SEED_CBC_SHA" +# define TLS1_RFC_ADH_WITH_SEED_SHA "TLS_DH_anon_WITH_SEED_CBC_SHA" +# define TLS1_RFC_ECDHE_PSK_WITH_RC4_128_SHA "TLS_ECDHE_PSK_WITH_RC4_128_SHA" +# define TLS1_RFC_ECDH_anon_WITH_RC4_128_SHA "TLS_ECDH_anon_WITH_RC4_128_SHA" +# define TLS1_RFC_ECDHE_ECDSA_WITH_RC4_128_SHA "TLS_ECDHE_ECDSA_WITH_RC4_128_SHA" +# define TLS1_RFC_ECDHE_RSA_WITH_RC4_128_SHA "TLS_ECDHE_RSA_WITH_RC4_128_SHA" +# define TLS1_RFC_PSK_WITH_RC4_128_SHA "TLS_PSK_WITH_RC4_128_SHA" +# define TLS1_RFC_RSA_PSK_WITH_RC4_128_SHA "TLS_RSA_PSK_WITH_RC4_128_SHA" +# define TLS1_RFC_DHE_PSK_WITH_RC4_128_SHA "TLS_DHE_PSK_WITH_RC4_128_SHA" +# define TLS1_RFC_RSA_WITH_ARIA_128_GCM_SHA256 "TLS_RSA_WITH_ARIA_128_GCM_SHA256" +# define TLS1_RFC_RSA_WITH_ARIA_256_GCM_SHA384 "TLS_RSA_WITH_ARIA_256_GCM_SHA384" +# define TLS1_RFC_DHE_RSA_WITH_ARIA_128_GCM_SHA256 "TLS_DHE_RSA_WITH_ARIA_128_GCM_SHA256" +# define TLS1_RFC_DHE_RSA_WITH_ARIA_256_GCM_SHA384 "TLS_DHE_RSA_WITH_ARIA_256_GCM_SHA384" +# define TLS1_RFC_DH_RSA_WITH_ARIA_128_GCM_SHA256 "TLS_DH_RSA_WITH_ARIA_128_GCM_SHA256" +# define TLS1_RFC_DH_RSA_WITH_ARIA_256_GCM_SHA384 "TLS_DH_RSA_WITH_ARIA_256_GCM_SHA384" +# define TLS1_RFC_DHE_DSS_WITH_ARIA_128_GCM_SHA256 "TLS_DHE_DSS_WITH_ARIA_128_GCM_SHA256" +# define TLS1_RFC_DHE_DSS_WITH_ARIA_256_GCM_SHA384 "TLS_DHE_DSS_WITH_ARIA_256_GCM_SHA384" +# define TLS1_RFC_DH_DSS_WITH_ARIA_128_GCM_SHA256 "TLS_DH_DSS_WITH_ARIA_128_GCM_SHA256" +# define TLS1_RFC_DH_DSS_WITH_ARIA_256_GCM_SHA384 "TLS_DH_DSS_WITH_ARIA_256_GCM_SHA384" +# define TLS1_RFC_DH_anon_WITH_ARIA_128_GCM_SHA256 "TLS_DH_anon_WITH_ARIA_128_GCM_SHA256" +# define TLS1_RFC_DH_anon_WITH_ARIA_256_GCM_SHA384 "TLS_DH_anon_WITH_ARIA_256_GCM_SHA384" +# define TLS1_RFC_ECDHE_ECDSA_WITH_ARIA_128_GCM_SHA256 "TLS_ECDHE_ECDSA_WITH_ARIA_128_GCM_SHA256" +# define TLS1_RFC_ECDHE_ECDSA_WITH_ARIA_256_GCM_SHA384 "TLS_ECDHE_ECDSA_WITH_ARIA_256_GCM_SHA384" +# define TLS1_RFC_ECDH_ECDSA_WITH_ARIA_128_GCM_SHA256 "TLS_ECDH_ECDSA_WITH_ARIA_128_GCM_SHA256" +# define TLS1_RFC_ECDH_ECDSA_WITH_ARIA_256_GCM_SHA384 "TLS_ECDH_ECDSA_WITH_ARIA_256_GCM_SHA384" +# define TLS1_RFC_ECDHE_RSA_WITH_ARIA_128_GCM_SHA256 "TLS_ECDHE_RSA_WITH_ARIA_128_GCM_SHA256" +# define TLS1_RFC_ECDHE_RSA_WITH_ARIA_256_GCM_SHA384 "TLS_ECDHE_RSA_WITH_ARIA_256_GCM_SHA384" +# define TLS1_RFC_ECDH_RSA_WITH_ARIA_128_GCM_SHA256 "TLS_ECDH_RSA_WITH_ARIA_128_GCM_SHA256" +# define TLS1_RFC_ECDH_RSA_WITH_ARIA_256_GCM_SHA384 "TLS_ECDH_RSA_WITH_ARIA_256_GCM_SHA384" +# define TLS1_RFC_PSK_WITH_ARIA_128_GCM_SHA256 "TLS_PSK_WITH_ARIA_128_GCM_SHA256" +# define TLS1_RFC_PSK_WITH_ARIA_256_GCM_SHA384 "TLS_PSK_WITH_ARIA_256_GCM_SHA384" +# define TLS1_RFC_DHE_PSK_WITH_ARIA_128_GCM_SHA256 "TLS_DHE_PSK_WITH_ARIA_128_GCM_SHA256" +# define TLS1_RFC_DHE_PSK_WITH_ARIA_256_GCM_SHA384 "TLS_DHE_PSK_WITH_ARIA_256_GCM_SHA384" +# define TLS1_RFC_RSA_PSK_WITH_ARIA_128_GCM_SHA256 "TLS_RSA_PSK_WITH_ARIA_128_GCM_SHA256" +# define TLS1_RFC_RSA_PSK_WITH_ARIA_256_GCM_SHA384 "TLS_RSA_PSK_WITH_ARIA_256_GCM_SHA384" + + +/* + * XXX Backward compatibility alert: Older versions of OpenSSL gave some DHE + * ciphers names with "EDH" instead of "DHE". Going forward, we should be + * using DHE everywhere, though we may indefinitely maintain aliases for + * users or configurations that used "EDH" + */ +# define TLS1_TXT_DHE_DSS_WITH_RC4_128_SHA "DHE-DSS-RC4-SHA" + +# define TLS1_TXT_PSK_WITH_NULL_SHA "PSK-NULL-SHA" +# define TLS1_TXT_DHE_PSK_WITH_NULL_SHA "DHE-PSK-NULL-SHA" +# define TLS1_TXT_RSA_PSK_WITH_NULL_SHA "RSA-PSK-NULL-SHA" + +/* AES ciphersuites from RFC3268 */ +# define TLS1_TXT_RSA_WITH_AES_128_SHA "AES128-SHA" +# define TLS1_TXT_DH_DSS_WITH_AES_128_SHA "DH-DSS-AES128-SHA" +# define TLS1_TXT_DH_RSA_WITH_AES_128_SHA "DH-RSA-AES128-SHA" +# define TLS1_TXT_DHE_DSS_WITH_AES_128_SHA "DHE-DSS-AES128-SHA" +# define TLS1_TXT_DHE_RSA_WITH_AES_128_SHA "DHE-RSA-AES128-SHA" +# define TLS1_TXT_ADH_WITH_AES_128_SHA "ADH-AES128-SHA" + +# define TLS1_TXT_RSA_WITH_AES_256_SHA "AES256-SHA" +# define TLS1_TXT_DH_DSS_WITH_AES_256_SHA "DH-DSS-AES256-SHA" +# define TLS1_TXT_DH_RSA_WITH_AES_256_SHA "DH-RSA-AES256-SHA" +# define TLS1_TXT_DHE_DSS_WITH_AES_256_SHA "DHE-DSS-AES256-SHA" +# define TLS1_TXT_DHE_RSA_WITH_AES_256_SHA "DHE-RSA-AES256-SHA" +# define TLS1_TXT_ADH_WITH_AES_256_SHA "ADH-AES256-SHA" + +/* ECC ciphersuites from RFC4492 */ +# define TLS1_TXT_ECDH_ECDSA_WITH_NULL_SHA "ECDH-ECDSA-NULL-SHA" +# define TLS1_TXT_ECDH_ECDSA_WITH_RC4_128_SHA "ECDH-ECDSA-RC4-SHA" +# define TLS1_TXT_ECDH_ECDSA_WITH_DES_192_CBC3_SHA "ECDH-ECDSA-DES-CBC3-SHA" +# define TLS1_TXT_ECDH_ECDSA_WITH_AES_128_CBC_SHA "ECDH-ECDSA-AES128-SHA" +# define TLS1_TXT_ECDH_ECDSA_WITH_AES_256_CBC_SHA "ECDH-ECDSA-AES256-SHA" + +# define TLS1_TXT_ECDHE_ECDSA_WITH_NULL_SHA "ECDHE-ECDSA-NULL-SHA" +# define TLS1_TXT_ECDHE_ECDSA_WITH_RC4_128_SHA "ECDHE-ECDSA-RC4-SHA" +# define TLS1_TXT_ECDHE_ECDSA_WITH_DES_192_CBC3_SHA "ECDHE-ECDSA-DES-CBC3-SHA" +# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_CBC_SHA "ECDHE-ECDSA-AES128-SHA" +# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_CBC_SHA "ECDHE-ECDSA-AES256-SHA" + +# define TLS1_TXT_ECDH_RSA_WITH_NULL_SHA "ECDH-RSA-NULL-SHA" +# define TLS1_TXT_ECDH_RSA_WITH_RC4_128_SHA "ECDH-RSA-RC4-SHA" +# define TLS1_TXT_ECDH_RSA_WITH_DES_192_CBC3_SHA "ECDH-RSA-DES-CBC3-SHA" +# define TLS1_TXT_ECDH_RSA_WITH_AES_128_CBC_SHA "ECDH-RSA-AES128-SHA" +# define TLS1_TXT_ECDH_RSA_WITH_AES_256_CBC_SHA "ECDH-RSA-AES256-SHA" + +# define TLS1_TXT_ECDHE_RSA_WITH_NULL_SHA "ECDHE-RSA-NULL-SHA" +# define TLS1_TXT_ECDHE_RSA_WITH_RC4_128_SHA "ECDHE-RSA-RC4-SHA" +# define TLS1_TXT_ECDHE_RSA_WITH_DES_192_CBC3_SHA "ECDHE-RSA-DES-CBC3-SHA" +# define TLS1_TXT_ECDHE_RSA_WITH_AES_128_CBC_SHA "ECDHE-RSA-AES128-SHA" +# define TLS1_TXT_ECDHE_RSA_WITH_AES_256_CBC_SHA "ECDHE-RSA-AES256-SHA" + +# define TLS1_TXT_ECDH_anon_WITH_NULL_SHA "AECDH-NULL-SHA" +# define TLS1_TXT_ECDH_anon_WITH_RC4_128_SHA "AECDH-RC4-SHA" +# define TLS1_TXT_ECDH_anon_WITH_DES_192_CBC3_SHA "AECDH-DES-CBC3-SHA" +# define TLS1_TXT_ECDH_anon_WITH_AES_128_CBC_SHA "AECDH-AES128-SHA" +# define TLS1_TXT_ECDH_anon_WITH_AES_256_CBC_SHA "AECDH-AES256-SHA" + +/* PSK ciphersuites from RFC 4279 */ +# define TLS1_TXT_PSK_WITH_RC4_128_SHA "PSK-RC4-SHA" +# define TLS1_TXT_PSK_WITH_3DES_EDE_CBC_SHA "PSK-3DES-EDE-CBC-SHA" +# define TLS1_TXT_PSK_WITH_AES_128_CBC_SHA "PSK-AES128-CBC-SHA" +# define TLS1_TXT_PSK_WITH_AES_256_CBC_SHA "PSK-AES256-CBC-SHA" + +# define TLS1_TXT_DHE_PSK_WITH_RC4_128_SHA "DHE-PSK-RC4-SHA" +# define TLS1_TXT_DHE_PSK_WITH_3DES_EDE_CBC_SHA "DHE-PSK-3DES-EDE-CBC-SHA" +# define TLS1_TXT_DHE_PSK_WITH_AES_128_CBC_SHA "DHE-PSK-AES128-CBC-SHA" +# define TLS1_TXT_DHE_PSK_WITH_AES_256_CBC_SHA "DHE-PSK-AES256-CBC-SHA" +# define TLS1_TXT_RSA_PSK_WITH_RC4_128_SHA "RSA-PSK-RC4-SHA" +# define TLS1_TXT_RSA_PSK_WITH_3DES_EDE_CBC_SHA "RSA-PSK-3DES-EDE-CBC-SHA" +# define TLS1_TXT_RSA_PSK_WITH_AES_128_CBC_SHA "RSA-PSK-AES128-CBC-SHA" +# define TLS1_TXT_RSA_PSK_WITH_AES_256_CBC_SHA "RSA-PSK-AES256-CBC-SHA" + +/* PSK ciphersuites from RFC 5487 */ +# define TLS1_TXT_PSK_WITH_AES_128_GCM_SHA256 "PSK-AES128-GCM-SHA256" +# define TLS1_TXT_PSK_WITH_AES_256_GCM_SHA384 "PSK-AES256-GCM-SHA384" +# define TLS1_TXT_DHE_PSK_WITH_AES_128_GCM_SHA256 "DHE-PSK-AES128-GCM-SHA256" +# define TLS1_TXT_DHE_PSK_WITH_AES_256_GCM_SHA384 "DHE-PSK-AES256-GCM-SHA384" +# define TLS1_TXT_RSA_PSK_WITH_AES_128_GCM_SHA256 "RSA-PSK-AES128-GCM-SHA256" +# define TLS1_TXT_RSA_PSK_WITH_AES_256_GCM_SHA384 "RSA-PSK-AES256-GCM-SHA384" + +# define TLS1_TXT_PSK_WITH_AES_128_CBC_SHA256 "PSK-AES128-CBC-SHA256" +# define TLS1_TXT_PSK_WITH_AES_256_CBC_SHA384 "PSK-AES256-CBC-SHA384" +# define TLS1_TXT_PSK_WITH_NULL_SHA256 "PSK-NULL-SHA256" +# define TLS1_TXT_PSK_WITH_NULL_SHA384 "PSK-NULL-SHA384" + +# define TLS1_TXT_DHE_PSK_WITH_AES_128_CBC_SHA256 "DHE-PSK-AES128-CBC-SHA256" +# define TLS1_TXT_DHE_PSK_WITH_AES_256_CBC_SHA384 "DHE-PSK-AES256-CBC-SHA384" +# define TLS1_TXT_DHE_PSK_WITH_NULL_SHA256 "DHE-PSK-NULL-SHA256" +# define TLS1_TXT_DHE_PSK_WITH_NULL_SHA384 "DHE-PSK-NULL-SHA384" + +# define TLS1_TXT_RSA_PSK_WITH_AES_128_CBC_SHA256 "RSA-PSK-AES128-CBC-SHA256" +# define TLS1_TXT_RSA_PSK_WITH_AES_256_CBC_SHA384 "RSA-PSK-AES256-CBC-SHA384" +# define TLS1_TXT_RSA_PSK_WITH_NULL_SHA256 "RSA-PSK-NULL-SHA256" +# define TLS1_TXT_RSA_PSK_WITH_NULL_SHA384 "RSA-PSK-NULL-SHA384" + +/* SRP ciphersuite from RFC 5054 */ +# define TLS1_TXT_SRP_SHA_WITH_3DES_EDE_CBC_SHA "SRP-3DES-EDE-CBC-SHA" +# define TLS1_TXT_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA "SRP-RSA-3DES-EDE-CBC-SHA" +# define TLS1_TXT_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA "SRP-DSS-3DES-EDE-CBC-SHA" +# define TLS1_TXT_SRP_SHA_WITH_AES_128_CBC_SHA "SRP-AES-128-CBC-SHA" +# define TLS1_TXT_SRP_SHA_RSA_WITH_AES_128_CBC_SHA "SRP-RSA-AES-128-CBC-SHA" +# define TLS1_TXT_SRP_SHA_DSS_WITH_AES_128_CBC_SHA "SRP-DSS-AES-128-CBC-SHA" +# define TLS1_TXT_SRP_SHA_WITH_AES_256_CBC_SHA "SRP-AES-256-CBC-SHA" +# define TLS1_TXT_SRP_SHA_RSA_WITH_AES_256_CBC_SHA "SRP-RSA-AES-256-CBC-SHA" +# define TLS1_TXT_SRP_SHA_DSS_WITH_AES_256_CBC_SHA "SRP-DSS-AES-256-CBC-SHA" + +/* Camellia ciphersuites from RFC4132 */ +# define TLS1_TXT_RSA_WITH_CAMELLIA_128_CBC_SHA "CAMELLIA128-SHA" +# define TLS1_TXT_DH_DSS_WITH_CAMELLIA_128_CBC_SHA "DH-DSS-CAMELLIA128-SHA" +# define TLS1_TXT_DH_RSA_WITH_CAMELLIA_128_CBC_SHA "DH-RSA-CAMELLIA128-SHA" +# define TLS1_TXT_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA "DHE-DSS-CAMELLIA128-SHA" +# define TLS1_TXT_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA "DHE-RSA-CAMELLIA128-SHA" +# define TLS1_TXT_ADH_WITH_CAMELLIA_128_CBC_SHA "ADH-CAMELLIA128-SHA" + +# define TLS1_TXT_RSA_WITH_CAMELLIA_256_CBC_SHA "CAMELLIA256-SHA" +# define TLS1_TXT_DH_DSS_WITH_CAMELLIA_256_CBC_SHA "DH-DSS-CAMELLIA256-SHA" +# define TLS1_TXT_DH_RSA_WITH_CAMELLIA_256_CBC_SHA "DH-RSA-CAMELLIA256-SHA" +# define TLS1_TXT_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA "DHE-DSS-CAMELLIA256-SHA" +# define TLS1_TXT_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA "DHE-RSA-CAMELLIA256-SHA" +# define TLS1_TXT_ADH_WITH_CAMELLIA_256_CBC_SHA "ADH-CAMELLIA256-SHA" + +/* TLS 1.2 Camellia SHA-256 ciphersuites from RFC5932 */ +# define TLS1_TXT_RSA_WITH_CAMELLIA_128_CBC_SHA256 "CAMELLIA128-SHA256" +# define TLS1_TXT_DH_DSS_WITH_CAMELLIA_128_CBC_SHA256 "DH-DSS-CAMELLIA128-SHA256" +# define TLS1_TXT_DH_RSA_WITH_CAMELLIA_128_CBC_SHA256 "DH-RSA-CAMELLIA128-SHA256" +# define TLS1_TXT_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA256 "DHE-DSS-CAMELLIA128-SHA256" +# define TLS1_TXT_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 "DHE-RSA-CAMELLIA128-SHA256" +# define TLS1_TXT_ADH_WITH_CAMELLIA_128_CBC_SHA256 "ADH-CAMELLIA128-SHA256" + +# define TLS1_TXT_RSA_WITH_CAMELLIA_256_CBC_SHA256 "CAMELLIA256-SHA256" +# define TLS1_TXT_DH_DSS_WITH_CAMELLIA_256_CBC_SHA256 "DH-DSS-CAMELLIA256-SHA256" +# define TLS1_TXT_DH_RSA_WITH_CAMELLIA_256_CBC_SHA256 "DH-RSA-CAMELLIA256-SHA256" +# define TLS1_TXT_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA256 "DHE-DSS-CAMELLIA256-SHA256" +# define TLS1_TXT_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256 "DHE-RSA-CAMELLIA256-SHA256" +# define TLS1_TXT_ADH_WITH_CAMELLIA_256_CBC_SHA256 "ADH-CAMELLIA256-SHA256" + +# define TLS1_TXT_PSK_WITH_CAMELLIA_128_CBC_SHA256 "PSK-CAMELLIA128-SHA256" +# define TLS1_TXT_PSK_WITH_CAMELLIA_256_CBC_SHA384 "PSK-CAMELLIA256-SHA384" +# define TLS1_TXT_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 "DHE-PSK-CAMELLIA128-SHA256" +# define TLS1_TXT_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 "DHE-PSK-CAMELLIA256-SHA384" +# define TLS1_TXT_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256 "RSA-PSK-CAMELLIA128-SHA256" +# define TLS1_TXT_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384 "RSA-PSK-CAMELLIA256-SHA384" +# define TLS1_TXT_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 "ECDHE-PSK-CAMELLIA128-SHA256" +# define TLS1_TXT_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 "ECDHE-PSK-CAMELLIA256-SHA384" + +/* SEED ciphersuites from RFC4162 */ +# define TLS1_TXT_RSA_WITH_SEED_SHA "SEED-SHA" +# define TLS1_TXT_DH_DSS_WITH_SEED_SHA "DH-DSS-SEED-SHA" +# define TLS1_TXT_DH_RSA_WITH_SEED_SHA "DH-RSA-SEED-SHA" +# define TLS1_TXT_DHE_DSS_WITH_SEED_SHA "DHE-DSS-SEED-SHA" +# define TLS1_TXT_DHE_RSA_WITH_SEED_SHA "DHE-RSA-SEED-SHA" +# define TLS1_TXT_ADH_WITH_SEED_SHA "ADH-SEED-SHA" + +/* TLS v1.2 ciphersuites */ +# define TLS1_TXT_RSA_WITH_NULL_SHA256 "NULL-SHA256" +# define TLS1_TXT_RSA_WITH_AES_128_SHA256 "AES128-SHA256" +# define TLS1_TXT_RSA_WITH_AES_256_SHA256 "AES256-SHA256" +# define TLS1_TXT_DH_DSS_WITH_AES_128_SHA256 "DH-DSS-AES128-SHA256" +# define TLS1_TXT_DH_RSA_WITH_AES_128_SHA256 "DH-RSA-AES128-SHA256" +# define TLS1_TXT_DHE_DSS_WITH_AES_128_SHA256 "DHE-DSS-AES128-SHA256" +# define TLS1_TXT_DHE_RSA_WITH_AES_128_SHA256 "DHE-RSA-AES128-SHA256" +# define TLS1_TXT_DH_DSS_WITH_AES_256_SHA256 "DH-DSS-AES256-SHA256" +# define TLS1_TXT_DH_RSA_WITH_AES_256_SHA256 "DH-RSA-AES256-SHA256" +# define TLS1_TXT_DHE_DSS_WITH_AES_256_SHA256 "DHE-DSS-AES256-SHA256" +# define TLS1_TXT_DHE_RSA_WITH_AES_256_SHA256 "DHE-RSA-AES256-SHA256" +# define TLS1_TXT_ADH_WITH_AES_128_SHA256 "ADH-AES128-SHA256" +# define TLS1_TXT_ADH_WITH_AES_256_SHA256 "ADH-AES256-SHA256" + +/* TLS v1.2 GCM ciphersuites from RFC5288 */ +# define TLS1_TXT_RSA_WITH_AES_128_GCM_SHA256 "AES128-GCM-SHA256" +# define TLS1_TXT_RSA_WITH_AES_256_GCM_SHA384 "AES256-GCM-SHA384" +# define TLS1_TXT_DHE_RSA_WITH_AES_128_GCM_SHA256 "DHE-RSA-AES128-GCM-SHA256" +# define TLS1_TXT_DHE_RSA_WITH_AES_256_GCM_SHA384 "DHE-RSA-AES256-GCM-SHA384" +# define TLS1_TXT_DH_RSA_WITH_AES_128_GCM_SHA256 "DH-RSA-AES128-GCM-SHA256" +# define TLS1_TXT_DH_RSA_WITH_AES_256_GCM_SHA384 "DH-RSA-AES256-GCM-SHA384" +# define TLS1_TXT_DHE_DSS_WITH_AES_128_GCM_SHA256 "DHE-DSS-AES128-GCM-SHA256" +# define TLS1_TXT_DHE_DSS_WITH_AES_256_GCM_SHA384 "DHE-DSS-AES256-GCM-SHA384" +# define TLS1_TXT_DH_DSS_WITH_AES_128_GCM_SHA256 "DH-DSS-AES128-GCM-SHA256" +# define TLS1_TXT_DH_DSS_WITH_AES_256_GCM_SHA384 "DH-DSS-AES256-GCM-SHA384" +# define TLS1_TXT_ADH_WITH_AES_128_GCM_SHA256 "ADH-AES128-GCM-SHA256" +# define TLS1_TXT_ADH_WITH_AES_256_GCM_SHA384 "ADH-AES256-GCM-SHA384" + +/* CCM ciphersuites from RFC6655 */ +# define TLS1_TXT_RSA_WITH_AES_128_CCM "AES128-CCM" +# define TLS1_TXT_RSA_WITH_AES_256_CCM "AES256-CCM" +# define TLS1_TXT_DHE_RSA_WITH_AES_128_CCM "DHE-RSA-AES128-CCM" +# define TLS1_TXT_DHE_RSA_WITH_AES_256_CCM "DHE-RSA-AES256-CCM" + +# define TLS1_TXT_RSA_WITH_AES_128_CCM_8 "AES128-CCM8" +# define TLS1_TXT_RSA_WITH_AES_256_CCM_8 "AES256-CCM8" +# define TLS1_TXT_DHE_RSA_WITH_AES_128_CCM_8 "DHE-RSA-AES128-CCM8" +# define TLS1_TXT_DHE_RSA_WITH_AES_256_CCM_8 "DHE-RSA-AES256-CCM8" + +# define TLS1_TXT_PSK_WITH_AES_128_CCM "PSK-AES128-CCM" +# define TLS1_TXT_PSK_WITH_AES_256_CCM "PSK-AES256-CCM" +# define TLS1_TXT_DHE_PSK_WITH_AES_128_CCM "DHE-PSK-AES128-CCM" +# define TLS1_TXT_DHE_PSK_WITH_AES_256_CCM "DHE-PSK-AES256-CCM" + +# define TLS1_TXT_PSK_WITH_AES_128_CCM_8 "PSK-AES128-CCM8" +# define TLS1_TXT_PSK_WITH_AES_256_CCM_8 "PSK-AES256-CCM8" +# define TLS1_TXT_DHE_PSK_WITH_AES_128_CCM_8 "DHE-PSK-AES128-CCM8" +# define TLS1_TXT_DHE_PSK_WITH_AES_256_CCM_8 "DHE-PSK-AES256-CCM8" + +/* CCM ciphersuites from RFC7251 */ +# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_CCM "ECDHE-ECDSA-AES128-CCM" +# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_CCM "ECDHE-ECDSA-AES256-CCM" +# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_CCM_8 "ECDHE-ECDSA-AES128-CCM8" +# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_CCM_8 "ECDHE-ECDSA-AES256-CCM8" + +/* ECDH HMAC based ciphersuites from RFC5289 */ +# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_SHA256 "ECDHE-ECDSA-AES128-SHA256" +# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_SHA384 "ECDHE-ECDSA-AES256-SHA384" +# define TLS1_TXT_ECDH_ECDSA_WITH_AES_128_SHA256 "ECDH-ECDSA-AES128-SHA256" +# define TLS1_TXT_ECDH_ECDSA_WITH_AES_256_SHA384 "ECDH-ECDSA-AES256-SHA384" +# define TLS1_TXT_ECDHE_RSA_WITH_AES_128_SHA256 "ECDHE-RSA-AES128-SHA256" +# define TLS1_TXT_ECDHE_RSA_WITH_AES_256_SHA384 "ECDHE-RSA-AES256-SHA384" +# define TLS1_TXT_ECDH_RSA_WITH_AES_128_SHA256 "ECDH-RSA-AES128-SHA256" +# define TLS1_TXT_ECDH_RSA_WITH_AES_256_SHA384 "ECDH-RSA-AES256-SHA384" + +/* ECDH GCM based ciphersuites from RFC5289 */ +# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 "ECDHE-ECDSA-AES128-GCM-SHA256" +# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 "ECDHE-ECDSA-AES256-GCM-SHA384" +# define TLS1_TXT_ECDH_ECDSA_WITH_AES_128_GCM_SHA256 "ECDH-ECDSA-AES128-GCM-SHA256" +# define TLS1_TXT_ECDH_ECDSA_WITH_AES_256_GCM_SHA384 "ECDH-ECDSA-AES256-GCM-SHA384" +# define TLS1_TXT_ECDHE_RSA_WITH_AES_128_GCM_SHA256 "ECDHE-RSA-AES128-GCM-SHA256" +# define TLS1_TXT_ECDHE_RSA_WITH_AES_256_GCM_SHA384 "ECDHE-RSA-AES256-GCM-SHA384" +# define TLS1_TXT_ECDH_RSA_WITH_AES_128_GCM_SHA256 "ECDH-RSA-AES128-GCM-SHA256" +# define TLS1_TXT_ECDH_RSA_WITH_AES_256_GCM_SHA384 "ECDH-RSA-AES256-GCM-SHA384" + +/* TLS v1.2 PSK GCM ciphersuites from RFC5487 */ +# define TLS1_TXT_PSK_WITH_AES_128_GCM_SHA256 "PSK-AES128-GCM-SHA256" +# define TLS1_TXT_PSK_WITH_AES_256_GCM_SHA384 "PSK-AES256-GCM-SHA384" + +/* ECDHE PSK ciphersuites from RFC 5489 */ +# define TLS1_TXT_ECDHE_PSK_WITH_RC4_128_SHA "ECDHE-PSK-RC4-SHA" +# define TLS1_TXT_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA "ECDHE-PSK-3DES-EDE-CBC-SHA" +# define TLS1_TXT_ECDHE_PSK_WITH_AES_128_CBC_SHA "ECDHE-PSK-AES128-CBC-SHA" +# define TLS1_TXT_ECDHE_PSK_WITH_AES_256_CBC_SHA "ECDHE-PSK-AES256-CBC-SHA" + +# define TLS1_TXT_ECDHE_PSK_WITH_AES_128_CBC_SHA256 "ECDHE-PSK-AES128-CBC-SHA256" +# define TLS1_TXT_ECDHE_PSK_WITH_AES_256_CBC_SHA384 "ECDHE-PSK-AES256-CBC-SHA384" + +# define TLS1_TXT_ECDHE_PSK_WITH_NULL_SHA "ECDHE-PSK-NULL-SHA" +# define TLS1_TXT_ECDHE_PSK_WITH_NULL_SHA256 "ECDHE-PSK-NULL-SHA256" +# define TLS1_TXT_ECDHE_PSK_WITH_NULL_SHA384 "ECDHE-PSK-NULL-SHA384" + +/* Camellia-CBC ciphersuites from RFC6367 */ +# define TLS1_TXT_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 "ECDHE-ECDSA-CAMELLIA128-SHA256" +# define TLS1_TXT_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 "ECDHE-ECDSA-CAMELLIA256-SHA384" +# define TLS1_TXT_ECDH_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 "ECDH-ECDSA-CAMELLIA128-SHA256" +# define TLS1_TXT_ECDH_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 "ECDH-ECDSA-CAMELLIA256-SHA384" +# define TLS1_TXT_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 "ECDHE-RSA-CAMELLIA128-SHA256" +# define TLS1_TXT_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384 "ECDHE-RSA-CAMELLIA256-SHA384" +# define TLS1_TXT_ECDH_RSA_WITH_CAMELLIA_128_CBC_SHA256 "ECDH-RSA-CAMELLIA128-SHA256" +# define TLS1_TXT_ECDH_RSA_WITH_CAMELLIA_256_CBC_SHA384 "ECDH-RSA-CAMELLIA256-SHA384" + +/* draft-ietf-tls-chacha20-poly1305-03 */ +# define TLS1_TXT_ECDHE_RSA_WITH_CHACHA20_POLY1305 "ECDHE-RSA-CHACHA20-POLY1305" +# define TLS1_TXT_ECDHE_ECDSA_WITH_CHACHA20_POLY1305 "ECDHE-ECDSA-CHACHA20-POLY1305" +# define TLS1_TXT_DHE_RSA_WITH_CHACHA20_POLY1305 "DHE-RSA-CHACHA20-POLY1305" +# define TLS1_TXT_PSK_WITH_CHACHA20_POLY1305 "PSK-CHACHA20-POLY1305" +# define TLS1_TXT_ECDHE_PSK_WITH_CHACHA20_POLY1305 "ECDHE-PSK-CHACHA20-POLY1305" +# define TLS1_TXT_DHE_PSK_WITH_CHACHA20_POLY1305 "DHE-PSK-CHACHA20-POLY1305" +# define TLS1_TXT_RSA_PSK_WITH_CHACHA20_POLY1305 "RSA-PSK-CHACHA20-POLY1305" + +/* Aria ciphersuites from RFC6209 */ +# define TLS1_TXT_RSA_WITH_ARIA_128_GCM_SHA256 "ARIA128-GCM-SHA256" +# define TLS1_TXT_RSA_WITH_ARIA_256_GCM_SHA384 "ARIA256-GCM-SHA384" +# define TLS1_TXT_DHE_RSA_WITH_ARIA_128_GCM_SHA256 "DHE-RSA-ARIA128-GCM-SHA256" +# define TLS1_TXT_DHE_RSA_WITH_ARIA_256_GCM_SHA384 "DHE-RSA-ARIA256-GCM-SHA384" +# define TLS1_TXT_DH_RSA_WITH_ARIA_128_GCM_SHA256 "DH-RSA-ARIA128-GCM-SHA256" +# define TLS1_TXT_DH_RSA_WITH_ARIA_256_GCM_SHA384 "DH-RSA-ARIA256-GCM-SHA384" +# define TLS1_TXT_DHE_DSS_WITH_ARIA_128_GCM_SHA256 "DHE-DSS-ARIA128-GCM-SHA256" +# define TLS1_TXT_DHE_DSS_WITH_ARIA_256_GCM_SHA384 "DHE-DSS-ARIA256-GCM-SHA384" +# define TLS1_TXT_DH_DSS_WITH_ARIA_128_GCM_SHA256 "DH-DSS-ARIA128-GCM-SHA256" +# define TLS1_TXT_DH_DSS_WITH_ARIA_256_GCM_SHA384 "DH-DSS-ARIA256-GCM-SHA384" +# define TLS1_TXT_DH_anon_WITH_ARIA_128_GCM_SHA256 "ADH-ARIA128-GCM-SHA256" +# define TLS1_TXT_DH_anon_WITH_ARIA_256_GCM_SHA384 "ADH-ARIA256-GCM-SHA384" +# define TLS1_TXT_ECDHE_ECDSA_WITH_ARIA_128_GCM_SHA256 "ECDHE-ECDSA-ARIA128-GCM-SHA256" +# define TLS1_TXT_ECDHE_ECDSA_WITH_ARIA_256_GCM_SHA384 "ECDHE-ECDSA-ARIA256-GCM-SHA384" +# define TLS1_TXT_ECDH_ECDSA_WITH_ARIA_128_GCM_SHA256 "ECDH-ECDSA-ARIA128-GCM-SHA256" +# define TLS1_TXT_ECDH_ECDSA_WITH_ARIA_256_GCM_SHA384 "ECDH-ECDSA-ARIA256-GCM-SHA384" +# define TLS1_TXT_ECDHE_RSA_WITH_ARIA_128_GCM_SHA256 "ECDHE-ARIA128-GCM-SHA256" +# define TLS1_TXT_ECDHE_RSA_WITH_ARIA_256_GCM_SHA384 "ECDHE-ARIA256-GCM-SHA384" +# define TLS1_TXT_ECDH_RSA_WITH_ARIA_128_GCM_SHA256 "ECDH-ARIA128-GCM-SHA256" +# define TLS1_TXT_ECDH_RSA_WITH_ARIA_256_GCM_SHA384 "ECDH-ARIA256-GCM-SHA384" +# define TLS1_TXT_PSK_WITH_ARIA_128_GCM_SHA256 "PSK-ARIA128-GCM-SHA256" +# define TLS1_TXT_PSK_WITH_ARIA_256_GCM_SHA384 "PSK-ARIA256-GCM-SHA384" +# define TLS1_TXT_DHE_PSK_WITH_ARIA_128_GCM_SHA256 "DHE-PSK-ARIA128-GCM-SHA256" +# define TLS1_TXT_DHE_PSK_WITH_ARIA_256_GCM_SHA384 "DHE-PSK-ARIA256-GCM-SHA384" +# define TLS1_TXT_RSA_PSK_WITH_ARIA_128_GCM_SHA256 "RSA-PSK-ARIA128-GCM-SHA256" +# define TLS1_TXT_RSA_PSK_WITH_ARIA_256_GCM_SHA384 "RSA-PSK-ARIA256-GCM-SHA384" + +# define TLS_CT_RSA_SIGN 1 +# define TLS_CT_DSS_SIGN 2 +# define TLS_CT_RSA_FIXED_DH 3 +# define TLS_CT_DSS_FIXED_DH 4 +# define TLS_CT_ECDSA_SIGN 64 +# define TLS_CT_RSA_FIXED_ECDH 65 +# define TLS_CT_ECDSA_FIXED_ECDH 66 +# define TLS_CT_GOST01_SIGN 22 +# define TLS_CT_GOST12_SIGN 238 +# define TLS_CT_GOST12_512_SIGN 239 + +/* + * when correcting this number, correct also SSL3_CT_NUMBER in ssl3.h (see + * comment there) + */ +# define TLS_CT_NUMBER 10 + +# if defined(SSL3_CT_NUMBER) +# if TLS_CT_NUMBER != SSL3_CT_NUMBER +# error "SSL/TLS CT_NUMBER values do not match" +# endif +# endif + +# define TLS1_FINISH_MAC_LENGTH 12 + +# define TLS_MD_MAX_CONST_SIZE 22 +# define TLS_MD_CLIENT_FINISH_CONST "client finished" +# define TLS_MD_CLIENT_FINISH_CONST_SIZE 15 +# define TLS_MD_SERVER_FINISH_CONST "server finished" +# define TLS_MD_SERVER_FINISH_CONST_SIZE 15 +# define TLS_MD_KEY_EXPANSION_CONST "key expansion" +# define TLS_MD_KEY_EXPANSION_CONST_SIZE 13 +# define TLS_MD_CLIENT_WRITE_KEY_CONST "client write key" +# define TLS_MD_CLIENT_WRITE_KEY_CONST_SIZE 16 +# define TLS_MD_SERVER_WRITE_KEY_CONST "server write key" +# define TLS_MD_SERVER_WRITE_KEY_CONST_SIZE 16 +# define TLS_MD_IV_BLOCK_CONST "IV block" +# define TLS_MD_IV_BLOCK_CONST_SIZE 8 +# define TLS_MD_MASTER_SECRET_CONST "master secret" +# define TLS_MD_MASTER_SECRET_CONST_SIZE 13 +# define TLS_MD_EXTENDED_MASTER_SECRET_CONST "extended master secret" +# define TLS_MD_EXTENDED_MASTER_SECRET_CONST_SIZE 22 + +# ifdef CHARSET_EBCDIC +# undef TLS_MD_CLIENT_FINISH_CONST +/* + * client finished + */ +# define TLS_MD_CLIENT_FINISH_CONST "\x63\x6c\x69\x65\x6e\x74\x20\x66\x69\x6e\x69\x73\x68\x65\x64" + +# undef TLS_MD_SERVER_FINISH_CONST +/* + * server finished + */ +# define TLS_MD_SERVER_FINISH_CONST "\x73\x65\x72\x76\x65\x72\x20\x66\x69\x6e\x69\x73\x68\x65\x64" + +# undef TLS_MD_SERVER_WRITE_KEY_CONST +/* + * server write key + */ +# define TLS_MD_SERVER_WRITE_KEY_CONST "\x73\x65\x72\x76\x65\x72\x20\x77\x72\x69\x74\x65\x20\x6b\x65\x79" + +# undef TLS_MD_KEY_EXPANSION_CONST +/* + * key expansion + */ +# define TLS_MD_KEY_EXPANSION_CONST "\x6b\x65\x79\x20\x65\x78\x70\x61\x6e\x73\x69\x6f\x6e" + +# undef TLS_MD_CLIENT_WRITE_KEY_CONST +/* + * client write key + */ +# define TLS_MD_CLIENT_WRITE_KEY_CONST "\x63\x6c\x69\x65\x6e\x74\x20\x77\x72\x69\x74\x65\x20\x6b\x65\x79" + +# undef TLS_MD_SERVER_WRITE_KEY_CONST +/* + * server write key + */ +# define TLS_MD_SERVER_WRITE_KEY_CONST "\x73\x65\x72\x76\x65\x72\x20\x77\x72\x69\x74\x65\x20\x6b\x65\x79" + +# undef TLS_MD_IV_BLOCK_CONST +/* + * IV block + */ +# define TLS_MD_IV_BLOCK_CONST "\x49\x56\x20\x62\x6c\x6f\x63\x6b" + +# undef TLS_MD_MASTER_SECRET_CONST +/* + * master secret + */ +# define TLS_MD_MASTER_SECRET_CONST "\x6d\x61\x73\x74\x65\x72\x20\x73\x65\x63\x72\x65\x74" +# undef TLS_MD_EXTENDED_MASTER_SECRET_CONST +/* + * extended master secret + */ +# define TLS_MD_EXTENDED_MASTER_SECRET_CONST "\x65\x78\x74\x65\x6e\x64\x65\x64\x20\x6d\x61\x73\x74\x65\x72\x20\x73\x65\x63\x72\x65\x74" +# endif + +/* TLS Session Ticket extension struct */ +struct tls_session_ticket_ext_st { + unsigned short length; + void *data; +}; + +#ifdef __cplusplus +} +#endif +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/ts.h b/MediaClient/MediaClient/openssl/include/openssl/ts.h new file mode 100644 index 0000000..3b58aa5 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/ts.h @@ -0,0 +1,559 @@ +/* + * Copyright 2006-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_TS_H +# define HEADER_TS_H + +# include + +# ifndef OPENSSL_NO_TS +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# ifdef __cplusplus +extern "C" { +# endif + +# include +# include + +typedef struct TS_msg_imprint_st TS_MSG_IMPRINT; +typedef struct TS_req_st TS_REQ; +typedef struct TS_accuracy_st TS_ACCURACY; +typedef struct TS_tst_info_st TS_TST_INFO; + +/* Possible values for status. */ +# define TS_STATUS_GRANTED 0 +# define TS_STATUS_GRANTED_WITH_MODS 1 +# define TS_STATUS_REJECTION 2 +# define TS_STATUS_WAITING 3 +# define TS_STATUS_REVOCATION_WARNING 4 +# define TS_STATUS_REVOCATION_NOTIFICATION 5 + +/* Possible values for failure_info. */ +# define TS_INFO_BAD_ALG 0 +# define TS_INFO_BAD_REQUEST 2 +# define TS_INFO_BAD_DATA_FORMAT 5 +# define TS_INFO_TIME_NOT_AVAILABLE 14 +# define TS_INFO_UNACCEPTED_POLICY 15 +# define TS_INFO_UNACCEPTED_EXTENSION 16 +# define TS_INFO_ADD_INFO_NOT_AVAILABLE 17 +# define TS_INFO_SYSTEM_FAILURE 25 + + +typedef struct TS_status_info_st TS_STATUS_INFO; +typedef struct ESS_issuer_serial ESS_ISSUER_SERIAL; +typedef struct ESS_cert_id ESS_CERT_ID; +typedef struct ESS_signing_cert ESS_SIGNING_CERT; + +DEFINE_STACK_OF(ESS_CERT_ID) + +typedef struct ESS_cert_id_v2_st ESS_CERT_ID_V2; +typedef struct ESS_signing_cert_v2_st ESS_SIGNING_CERT_V2; + +DEFINE_STACK_OF(ESS_CERT_ID_V2) + +typedef struct TS_resp_st TS_RESP; + +TS_REQ *TS_REQ_new(void); +void TS_REQ_free(TS_REQ *a); +int i2d_TS_REQ(const TS_REQ *a, unsigned char **pp); +TS_REQ *d2i_TS_REQ(TS_REQ **a, const unsigned char **pp, long length); + +TS_REQ *TS_REQ_dup(TS_REQ *a); + +#ifndef OPENSSL_NO_STDIO +TS_REQ *d2i_TS_REQ_fp(FILE *fp, TS_REQ **a); +int i2d_TS_REQ_fp(FILE *fp, TS_REQ *a); +#endif +TS_REQ *d2i_TS_REQ_bio(BIO *fp, TS_REQ **a); +int i2d_TS_REQ_bio(BIO *fp, TS_REQ *a); + +TS_MSG_IMPRINT *TS_MSG_IMPRINT_new(void); +void TS_MSG_IMPRINT_free(TS_MSG_IMPRINT *a); +int i2d_TS_MSG_IMPRINT(const TS_MSG_IMPRINT *a, unsigned char **pp); +TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT(TS_MSG_IMPRINT **a, + const unsigned char **pp, long length); + +TS_MSG_IMPRINT *TS_MSG_IMPRINT_dup(TS_MSG_IMPRINT *a); + +#ifndef OPENSSL_NO_STDIO +TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT_fp(FILE *fp, TS_MSG_IMPRINT **a); +int i2d_TS_MSG_IMPRINT_fp(FILE *fp, TS_MSG_IMPRINT *a); +#endif +TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT_bio(BIO *bio, TS_MSG_IMPRINT **a); +int i2d_TS_MSG_IMPRINT_bio(BIO *bio, TS_MSG_IMPRINT *a); + +TS_RESP *TS_RESP_new(void); +void TS_RESP_free(TS_RESP *a); +int i2d_TS_RESP(const TS_RESP *a, unsigned char **pp); +TS_RESP *d2i_TS_RESP(TS_RESP **a, const unsigned char **pp, long length); +TS_TST_INFO *PKCS7_to_TS_TST_INFO(PKCS7 *token); +TS_RESP *TS_RESP_dup(TS_RESP *a); + +#ifndef OPENSSL_NO_STDIO +TS_RESP *d2i_TS_RESP_fp(FILE *fp, TS_RESP **a); +int i2d_TS_RESP_fp(FILE *fp, TS_RESP *a); +#endif +TS_RESP *d2i_TS_RESP_bio(BIO *bio, TS_RESP **a); +int i2d_TS_RESP_bio(BIO *bio, TS_RESP *a); + +TS_STATUS_INFO *TS_STATUS_INFO_new(void); +void TS_STATUS_INFO_free(TS_STATUS_INFO *a); +int i2d_TS_STATUS_INFO(const TS_STATUS_INFO *a, unsigned char **pp); +TS_STATUS_INFO *d2i_TS_STATUS_INFO(TS_STATUS_INFO **a, + const unsigned char **pp, long length); +TS_STATUS_INFO *TS_STATUS_INFO_dup(TS_STATUS_INFO *a); + +TS_TST_INFO *TS_TST_INFO_new(void); +void TS_TST_INFO_free(TS_TST_INFO *a); +int i2d_TS_TST_INFO(const TS_TST_INFO *a, unsigned char **pp); +TS_TST_INFO *d2i_TS_TST_INFO(TS_TST_INFO **a, const unsigned char **pp, + long length); +TS_TST_INFO *TS_TST_INFO_dup(TS_TST_INFO *a); + +#ifndef OPENSSL_NO_STDIO +TS_TST_INFO *d2i_TS_TST_INFO_fp(FILE *fp, TS_TST_INFO **a); +int i2d_TS_TST_INFO_fp(FILE *fp, TS_TST_INFO *a); +#endif +TS_TST_INFO *d2i_TS_TST_INFO_bio(BIO *bio, TS_TST_INFO **a); +int i2d_TS_TST_INFO_bio(BIO *bio, TS_TST_INFO *a); + +TS_ACCURACY *TS_ACCURACY_new(void); +void TS_ACCURACY_free(TS_ACCURACY *a); +int i2d_TS_ACCURACY(const TS_ACCURACY *a, unsigned char **pp); +TS_ACCURACY *d2i_TS_ACCURACY(TS_ACCURACY **a, const unsigned char **pp, + long length); +TS_ACCURACY *TS_ACCURACY_dup(TS_ACCURACY *a); + +ESS_ISSUER_SERIAL *ESS_ISSUER_SERIAL_new(void); +void ESS_ISSUER_SERIAL_free(ESS_ISSUER_SERIAL *a); +int i2d_ESS_ISSUER_SERIAL(const ESS_ISSUER_SERIAL *a, unsigned char **pp); +ESS_ISSUER_SERIAL *d2i_ESS_ISSUER_SERIAL(ESS_ISSUER_SERIAL **a, + const unsigned char **pp, + long length); +ESS_ISSUER_SERIAL *ESS_ISSUER_SERIAL_dup(ESS_ISSUER_SERIAL *a); + +ESS_CERT_ID *ESS_CERT_ID_new(void); +void ESS_CERT_ID_free(ESS_CERT_ID *a); +int i2d_ESS_CERT_ID(const ESS_CERT_ID *a, unsigned char **pp); +ESS_CERT_ID *d2i_ESS_CERT_ID(ESS_CERT_ID **a, const unsigned char **pp, + long length); +ESS_CERT_ID *ESS_CERT_ID_dup(ESS_CERT_ID *a); + +ESS_SIGNING_CERT *ESS_SIGNING_CERT_new(void); +void ESS_SIGNING_CERT_free(ESS_SIGNING_CERT *a); +int i2d_ESS_SIGNING_CERT(const ESS_SIGNING_CERT *a, unsigned char **pp); +ESS_SIGNING_CERT *d2i_ESS_SIGNING_CERT(ESS_SIGNING_CERT **a, + const unsigned char **pp, long length); +ESS_SIGNING_CERT *ESS_SIGNING_CERT_dup(ESS_SIGNING_CERT *a); + +ESS_CERT_ID_V2 *ESS_CERT_ID_V2_new(void); +void ESS_CERT_ID_V2_free(ESS_CERT_ID_V2 *a); +int i2d_ESS_CERT_ID_V2(const ESS_CERT_ID_V2 *a, unsigned char **pp); +ESS_CERT_ID_V2 *d2i_ESS_CERT_ID_V2(ESS_CERT_ID_V2 **a, + const unsigned char **pp, long length); +ESS_CERT_ID_V2 *ESS_CERT_ID_V2_dup(ESS_CERT_ID_V2 *a); + +ESS_SIGNING_CERT_V2 *ESS_SIGNING_CERT_V2_new(void); +void ESS_SIGNING_CERT_V2_free(ESS_SIGNING_CERT_V2 *a); +int i2d_ESS_SIGNING_CERT_V2(const ESS_SIGNING_CERT_V2 *a, unsigned char **pp); +ESS_SIGNING_CERT_V2 *d2i_ESS_SIGNING_CERT_V2(ESS_SIGNING_CERT_V2 **a, + const unsigned char **pp, + long length); +ESS_SIGNING_CERT_V2 *ESS_SIGNING_CERT_V2_dup(ESS_SIGNING_CERT_V2 *a); + +int TS_REQ_set_version(TS_REQ *a, long version); +long TS_REQ_get_version(const TS_REQ *a); + +int TS_STATUS_INFO_set_status(TS_STATUS_INFO *a, int i); +const ASN1_INTEGER *TS_STATUS_INFO_get0_status(const TS_STATUS_INFO *a); + +const STACK_OF(ASN1_UTF8STRING) * +TS_STATUS_INFO_get0_text(const TS_STATUS_INFO *a); + +const ASN1_BIT_STRING * +TS_STATUS_INFO_get0_failure_info(const TS_STATUS_INFO *a); + +int TS_REQ_set_msg_imprint(TS_REQ *a, TS_MSG_IMPRINT *msg_imprint); +TS_MSG_IMPRINT *TS_REQ_get_msg_imprint(TS_REQ *a); + +int TS_MSG_IMPRINT_set_algo(TS_MSG_IMPRINT *a, X509_ALGOR *alg); +X509_ALGOR *TS_MSG_IMPRINT_get_algo(TS_MSG_IMPRINT *a); + +int TS_MSG_IMPRINT_set_msg(TS_MSG_IMPRINT *a, unsigned char *d, int len); +ASN1_OCTET_STRING *TS_MSG_IMPRINT_get_msg(TS_MSG_IMPRINT *a); + +int TS_REQ_set_policy_id(TS_REQ *a, const ASN1_OBJECT *policy); +ASN1_OBJECT *TS_REQ_get_policy_id(TS_REQ *a); + +int TS_REQ_set_nonce(TS_REQ *a, const ASN1_INTEGER *nonce); +const ASN1_INTEGER *TS_REQ_get_nonce(const TS_REQ *a); + +int TS_REQ_set_cert_req(TS_REQ *a, int cert_req); +int TS_REQ_get_cert_req(const TS_REQ *a); + +STACK_OF(X509_EXTENSION) *TS_REQ_get_exts(TS_REQ *a); +void TS_REQ_ext_free(TS_REQ *a); +int TS_REQ_get_ext_count(TS_REQ *a); +int TS_REQ_get_ext_by_NID(TS_REQ *a, int nid, int lastpos); +int TS_REQ_get_ext_by_OBJ(TS_REQ *a, const ASN1_OBJECT *obj, int lastpos); +int TS_REQ_get_ext_by_critical(TS_REQ *a, int crit, int lastpos); +X509_EXTENSION *TS_REQ_get_ext(TS_REQ *a, int loc); +X509_EXTENSION *TS_REQ_delete_ext(TS_REQ *a, int loc); +int TS_REQ_add_ext(TS_REQ *a, X509_EXTENSION *ex, int loc); +void *TS_REQ_get_ext_d2i(TS_REQ *a, int nid, int *crit, int *idx); + +/* Function declarations for TS_REQ defined in ts/ts_req_print.c */ + +int TS_REQ_print_bio(BIO *bio, TS_REQ *a); + +/* Function declarations for TS_RESP defined in ts/ts_resp_utils.c */ + +int TS_RESP_set_status_info(TS_RESP *a, TS_STATUS_INFO *info); +TS_STATUS_INFO *TS_RESP_get_status_info(TS_RESP *a); + +/* Caller loses ownership of PKCS7 and TS_TST_INFO objects. */ +void TS_RESP_set_tst_info(TS_RESP *a, PKCS7 *p7, TS_TST_INFO *tst_info); +PKCS7 *TS_RESP_get_token(TS_RESP *a); +TS_TST_INFO *TS_RESP_get_tst_info(TS_RESP *a); + +int TS_TST_INFO_set_version(TS_TST_INFO *a, long version); +long TS_TST_INFO_get_version(const TS_TST_INFO *a); + +int TS_TST_INFO_set_policy_id(TS_TST_INFO *a, ASN1_OBJECT *policy_id); +ASN1_OBJECT *TS_TST_INFO_get_policy_id(TS_TST_INFO *a); + +int TS_TST_INFO_set_msg_imprint(TS_TST_INFO *a, TS_MSG_IMPRINT *msg_imprint); +TS_MSG_IMPRINT *TS_TST_INFO_get_msg_imprint(TS_TST_INFO *a); + +int TS_TST_INFO_set_serial(TS_TST_INFO *a, const ASN1_INTEGER *serial); +const ASN1_INTEGER *TS_TST_INFO_get_serial(const TS_TST_INFO *a); + +int TS_TST_INFO_set_time(TS_TST_INFO *a, const ASN1_GENERALIZEDTIME *gtime); +const ASN1_GENERALIZEDTIME *TS_TST_INFO_get_time(const TS_TST_INFO *a); + +int TS_TST_INFO_set_accuracy(TS_TST_INFO *a, TS_ACCURACY *accuracy); +TS_ACCURACY *TS_TST_INFO_get_accuracy(TS_TST_INFO *a); + +int TS_ACCURACY_set_seconds(TS_ACCURACY *a, const ASN1_INTEGER *seconds); +const ASN1_INTEGER *TS_ACCURACY_get_seconds(const TS_ACCURACY *a); + +int TS_ACCURACY_set_millis(TS_ACCURACY *a, const ASN1_INTEGER *millis); +const ASN1_INTEGER *TS_ACCURACY_get_millis(const TS_ACCURACY *a); + +int TS_ACCURACY_set_micros(TS_ACCURACY *a, const ASN1_INTEGER *micros); +const ASN1_INTEGER *TS_ACCURACY_get_micros(const TS_ACCURACY *a); + +int TS_TST_INFO_set_ordering(TS_TST_INFO *a, int ordering); +int TS_TST_INFO_get_ordering(const TS_TST_INFO *a); + +int TS_TST_INFO_set_nonce(TS_TST_INFO *a, const ASN1_INTEGER *nonce); +const ASN1_INTEGER *TS_TST_INFO_get_nonce(const TS_TST_INFO *a); + +int TS_TST_INFO_set_tsa(TS_TST_INFO *a, GENERAL_NAME *tsa); +GENERAL_NAME *TS_TST_INFO_get_tsa(TS_TST_INFO *a); + +STACK_OF(X509_EXTENSION) *TS_TST_INFO_get_exts(TS_TST_INFO *a); +void TS_TST_INFO_ext_free(TS_TST_INFO *a); +int TS_TST_INFO_get_ext_count(TS_TST_INFO *a); +int TS_TST_INFO_get_ext_by_NID(TS_TST_INFO *a, int nid, int lastpos); +int TS_TST_INFO_get_ext_by_OBJ(TS_TST_INFO *a, const ASN1_OBJECT *obj, + int lastpos); +int TS_TST_INFO_get_ext_by_critical(TS_TST_INFO *a, int crit, int lastpos); +X509_EXTENSION *TS_TST_INFO_get_ext(TS_TST_INFO *a, int loc); +X509_EXTENSION *TS_TST_INFO_delete_ext(TS_TST_INFO *a, int loc); +int TS_TST_INFO_add_ext(TS_TST_INFO *a, X509_EXTENSION *ex, int loc); +void *TS_TST_INFO_get_ext_d2i(TS_TST_INFO *a, int nid, int *crit, int *idx); + +/* + * Declarations related to response generation, defined in ts/ts_resp_sign.c. + */ + +/* Optional flags for response generation. */ + +/* Don't include the TSA name in response. */ +# define TS_TSA_NAME 0x01 + +/* Set ordering to true in response. */ +# define TS_ORDERING 0x02 + +/* + * Include the signer certificate and the other specified certificates in + * the ESS signing certificate attribute beside the PKCS7 signed data. + * Only the signer certificates is included by default. + */ +# define TS_ESS_CERT_ID_CHAIN 0x04 + +/* Forward declaration. */ +struct TS_resp_ctx; + +/* This must return a unique number less than 160 bits long. */ +typedef ASN1_INTEGER *(*TS_serial_cb) (struct TS_resp_ctx *, void *); + +/* + * This must return the seconds and microseconds since Jan 1, 1970 in the sec + * and usec variables allocated by the caller. Return non-zero for success + * and zero for failure. + */ +typedef int (*TS_time_cb) (struct TS_resp_ctx *, void *, long *sec, + long *usec); + +/* + * This must process the given extension. It can modify the TS_TST_INFO + * object of the context. Return values: !0 (processed), 0 (error, it must + * set the status info/failure info of the response). + */ +typedef int (*TS_extension_cb) (struct TS_resp_ctx *, X509_EXTENSION *, + void *); + +typedef struct TS_resp_ctx TS_RESP_CTX; + +DEFINE_STACK_OF_CONST(EVP_MD) + +/* Creates a response context that can be used for generating responses. */ +TS_RESP_CTX *TS_RESP_CTX_new(void); +void TS_RESP_CTX_free(TS_RESP_CTX *ctx); + +/* This parameter must be set. */ +int TS_RESP_CTX_set_signer_cert(TS_RESP_CTX *ctx, X509 *signer); + +/* This parameter must be set. */ +int TS_RESP_CTX_set_signer_key(TS_RESP_CTX *ctx, EVP_PKEY *key); + +int TS_RESP_CTX_set_signer_digest(TS_RESP_CTX *ctx, + const EVP_MD *signer_digest); +int TS_RESP_CTX_set_ess_cert_id_digest(TS_RESP_CTX *ctx, const EVP_MD *md); + +/* This parameter must be set. */ +int TS_RESP_CTX_set_def_policy(TS_RESP_CTX *ctx, const ASN1_OBJECT *def_policy); + +/* No additional certs are included in the response by default. */ +int TS_RESP_CTX_set_certs(TS_RESP_CTX *ctx, STACK_OF(X509) *certs); + +/* + * Adds a new acceptable policy, only the default policy is accepted by + * default. + */ +int TS_RESP_CTX_add_policy(TS_RESP_CTX *ctx, const ASN1_OBJECT *policy); + +/* + * Adds a new acceptable message digest. Note that no message digests are + * accepted by default. The md argument is shared with the caller. + */ +int TS_RESP_CTX_add_md(TS_RESP_CTX *ctx, const EVP_MD *md); + +/* Accuracy is not included by default. */ +int TS_RESP_CTX_set_accuracy(TS_RESP_CTX *ctx, + int secs, int millis, int micros); + +/* + * Clock precision digits, i.e. the number of decimal digits: '0' means sec, + * '3' msec, '6' usec, and so on. Default is 0. + */ +int TS_RESP_CTX_set_clock_precision_digits(TS_RESP_CTX *ctx, + unsigned clock_precision_digits); +/* At most we accept usec precision. */ +# define TS_MAX_CLOCK_PRECISION_DIGITS 6 + +/* Maximum status message length */ +# define TS_MAX_STATUS_LENGTH (1024 * 1024) + +/* No flags are set by default. */ +void TS_RESP_CTX_add_flags(TS_RESP_CTX *ctx, int flags); + +/* Default callback always returns a constant. */ +void TS_RESP_CTX_set_serial_cb(TS_RESP_CTX *ctx, TS_serial_cb cb, void *data); + +/* Default callback uses the gettimeofday() and gmtime() system calls. */ +void TS_RESP_CTX_set_time_cb(TS_RESP_CTX *ctx, TS_time_cb cb, void *data); + +/* + * Default callback rejects all extensions. The extension callback is called + * when the TS_TST_INFO object is already set up and not signed yet. + */ +/* FIXME: extension handling is not tested yet. */ +void TS_RESP_CTX_set_extension_cb(TS_RESP_CTX *ctx, + TS_extension_cb cb, void *data); + +/* The following methods can be used in the callbacks. */ +int TS_RESP_CTX_set_status_info(TS_RESP_CTX *ctx, + int status, const char *text); + +/* Sets the status info only if it is still TS_STATUS_GRANTED. */ +int TS_RESP_CTX_set_status_info_cond(TS_RESP_CTX *ctx, + int status, const char *text); + +int TS_RESP_CTX_add_failure_info(TS_RESP_CTX *ctx, int failure); + +/* The get methods below can be used in the extension callback. */ +TS_REQ *TS_RESP_CTX_get_request(TS_RESP_CTX *ctx); + +TS_TST_INFO *TS_RESP_CTX_get_tst_info(TS_RESP_CTX *ctx); + +/* + * Creates the signed TS_TST_INFO and puts it in TS_RESP. + * In case of errors it sets the status info properly. + * Returns NULL only in case of memory allocation/fatal error. + */ +TS_RESP *TS_RESP_create_response(TS_RESP_CTX *ctx, BIO *req_bio); + +/* + * Declarations related to response verification, + * they are defined in ts/ts_resp_verify.c. + */ + +int TS_RESP_verify_signature(PKCS7 *token, STACK_OF(X509) *certs, + X509_STORE *store, X509 **signer_out); + +/* Context structure for the generic verify method. */ + +/* Verify the signer's certificate and the signature of the response. */ +# define TS_VFY_SIGNATURE (1u << 0) +/* Verify the version number of the response. */ +# define TS_VFY_VERSION (1u << 1) +/* Verify if the policy supplied by the user matches the policy of the TSA. */ +# define TS_VFY_POLICY (1u << 2) +/* + * Verify the message imprint provided by the user. This flag should not be + * specified with TS_VFY_DATA. + */ +# define TS_VFY_IMPRINT (1u << 3) +/* + * Verify the message imprint computed by the verify method from the user + * provided data and the MD algorithm of the response. This flag should not + * be specified with TS_VFY_IMPRINT. + */ +# define TS_VFY_DATA (1u << 4) +/* Verify the nonce value. */ +# define TS_VFY_NONCE (1u << 5) +/* Verify if the TSA name field matches the signer certificate. */ +# define TS_VFY_SIGNER (1u << 6) +/* Verify if the TSA name field equals to the user provided name. */ +# define TS_VFY_TSA_NAME (1u << 7) + +/* You can use the following convenience constants. */ +# define TS_VFY_ALL_IMPRINT (TS_VFY_SIGNATURE \ + | TS_VFY_VERSION \ + | TS_VFY_POLICY \ + | TS_VFY_IMPRINT \ + | TS_VFY_NONCE \ + | TS_VFY_SIGNER \ + | TS_VFY_TSA_NAME) +# define TS_VFY_ALL_DATA (TS_VFY_SIGNATURE \ + | TS_VFY_VERSION \ + | TS_VFY_POLICY \ + | TS_VFY_DATA \ + | TS_VFY_NONCE \ + | TS_VFY_SIGNER \ + | TS_VFY_TSA_NAME) + +typedef struct TS_verify_ctx TS_VERIFY_CTX; + +int TS_RESP_verify_response(TS_VERIFY_CTX *ctx, TS_RESP *response); +int TS_RESP_verify_token(TS_VERIFY_CTX *ctx, PKCS7 *token); + +/* + * Declarations related to response verification context, + */ +TS_VERIFY_CTX *TS_VERIFY_CTX_new(void); +void TS_VERIFY_CTX_init(TS_VERIFY_CTX *ctx); +void TS_VERIFY_CTX_free(TS_VERIFY_CTX *ctx); +void TS_VERIFY_CTX_cleanup(TS_VERIFY_CTX *ctx); +int TS_VERIFY_CTX_set_flags(TS_VERIFY_CTX *ctx, int f); +int TS_VERIFY_CTX_add_flags(TS_VERIFY_CTX *ctx, int f); +BIO *TS_VERIFY_CTX_set_data(TS_VERIFY_CTX *ctx, BIO *b); +unsigned char *TS_VERIFY_CTX_set_imprint(TS_VERIFY_CTX *ctx, + unsigned char *hexstr, long len); +X509_STORE *TS_VERIFY_CTX_set_store(TS_VERIFY_CTX *ctx, X509_STORE *s); +STACK_OF(X509) *TS_VERIFY_CTS_set_certs(TS_VERIFY_CTX *ctx, STACK_OF(X509) *certs); + +/*- + * If ctx is NULL, it allocates and returns a new object, otherwise + * it returns ctx. It initialises all the members as follows: + * flags = TS_VFY_ALL_IMPRINT & ~(TS_VFY_TSA_NAME | TS_VFY_SIGNATURE) + * certs = NULL + * store = NULL + * policy = policy from the request or NULL if absent (in this case + * TS_VFY_POLICY is cleared from flags as well) + * md_alg = MD algorithm from request + * imprint, imprint_len = imprint from request + * data = NULL + * nonce, nonce_len = nonce from the request or NULL if absent (in this case + * TS_VFY_NONCE is cleared from flags as well) + * tsa_name = NULL + * Important: after calling this method TS_VFY_SIGNATURE should be added! + */ +TS_VERIFY_CTX *TS_REQ_to_TS_VERIFY_CTX(TS_REQ *req, TS_VERIFY_CTX *ctx); + +/* Function declarations for TS_RESP defined in ts/ts_resp_print.c */ + +int TS_RESP_print_bio(BIO *bio, TS_RESP *a); +int TS_STATUS_INFO_print_bio(BIO *bio, TS_STATUS_INFO *a); +int TS_TST_INFO_print_bio(BIO *bio, TS_TST_INFO *a); + +/* Common utility functions defined in ts/ts_lib.c */ + +int TS_ASN1_INTEGER_print_bio(BIO *bio, const ASN1_INTEGER *num); +int TS_OBJ_print_bio(BIO *bio, const ASN1_OBJECT *obj); +int TS_ext_print_bio(BIO *bio, const STACK_OF(X509_EXTENSION) *extensions); +int TS_X509_ALGOR_print_bio(BIO *bio, const X509_ALGOR *alg); +int TS_MSG_IMPRINT_print_bio(BIO *bio, TS_MSG_IMPRINT *msg); + +/* + * Function declarations for handling configuration options, defined in + * ts/ts_conf.c + */ + +X509 *TS_CONF_load_cert(const char *file); +STACK_OF(X509) *TS_CONF_load_certs(const char *file); +EVP_PKEY *TS_CONF_load_key(const char *file, const char *pass); +const char *TS_CONF_get_tsa_section(CONF *conf, const char *section); +int TS_CONF_set_serial(CONF *conf, const char *section, TS_serial_cb cb, + TS_RESP_CTX *ctx); +#ifndef OPENSSL_NO_ENGINE +int TS_CONF_set_crypto_device(CONF *conf, const char *section, + const char *device); +int TS_CONF_set_default_engine(const char *name); +#endif +int TS_CONF_set_signer_cert(CONF *conf, const char *section, + const char *cert, TS_RESP_CTX *ctx); +int TS_CONF_set_certs(CONF *conf, const char *section, const char *certs, + TS_RESP_CTX *ctx); +int TS_CONF_set_signer_key(CONF *conf, const char *section, + const char *key, const char *pass, + TS_RESP_CTX *ctx); +int TS_CONF_set_signer_digest(CONF *conf, const char *section, + const char *md, TS_RESP_CTX *ctx); +int TS_CONF_set_def_policy(CONF *conf, const char *section, + const char *policy, TS_RESP_CTX *ctx); +int TS_CONF_set_policies(CONF *conf, const char *section, TS_RESP_CTX *ctx); +int TS_CONF_set_digests(CONF *conf, const char *section, TS_RESP_CTX *ctx); +int TS_CONF_set_accuracy(CONF *conf, const char *section, TS_RESP_CTX *ctx); +int TS_CONF_set_clock_precision_digits(CONF *conf, const char *section, + TS_RESP_CTX *ctx); +int TS_CONF_set_ordering(CONF *conf, const char *section, TS_RESP_CTX *ctx); +int TS_CONF_set_tsa_name(CONF *conf, const char *section, TS_RESP_CTX *ctx); +int TS_CONF_set_ess_cert_id_chain(CONF *conf, const char *section, + TS_RESP_CTX *ctx); +int TS_CONF_set_ess_cert_id_digest(CONF *conf, const char *section, + TS_RESP_CTX *ctx); + +# ifdef __cplusplus +} +# endif +# endif +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/tserr.h b/MediaClient/MediaClient/openssl/include/openssl/tserr.h new file mode 100644 index 0000000..07f2333 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/tserr.h @@ -0,0 +1,132 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_TSERR_H +# define HEADER_TSERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# include + +# ifndef OPENSSL_NO_TS + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_TS_strings(void); + +/* + * TS function codes. + */ +# define TS_F_DEF_SERIAL_CB 110 +# define TS_F_DEF_TIME_CB 111 +# define TS_F_ESS_ADD_SIGNING_CERT 112 +# define TS_F_ESS_ADD_SIGNING_CERT_V2 147 +# define TS_F_ESS_CERT_ID_NEW_INIT 113 +# define TS_F_ESS_CERT_ID_V2_NEW_INIT 156 +# define TS_F_ESS_SIGNING_CERT_NEW_INIT 114 +# define TS_F_ESS_SIGNING_CERT_V2_NEW_INIT 157 +# define TS_F_INT_TS_RESP_VERIFY_TOKEN 149 +# define TS_F_PKCS7_TO_TS_TST_INFO 148 +# define TS_F_TS_ACCURACY_SET_MICROS 115 +# define TS_F_TS_ACCURACY_SET_MILLIS 116 +# define TS_F_TS_ACCURACY_SET_SECONDS 117 +# define TS_F_TS_CHECK_IMPRINTS 100 +# define TS_F_TS_CHECK_NONCES 101 +# define TS_F_TS_CHECK_POLICY 102 +# define TS_F_TS_CHECK_SIGNING_CERTS 103 +# define TS_F_TS_CHECK_STATUS_INFO 104 +# define TS_F_TS_COMPUTE_IMPRINT 145 +# define TS_F_TS_CONF_INVALID 151 +# define TS_F_TS_CONF_LOAD_CERT 153 +# define TS_F_TS_CONF_LOAD_CERTS 154 +# define TS_F_TS_CONF_LOAD_KEY 155 +# define TS_F_TS_CONF_LOOKUP_FAIL 152 +# define TS_F_TS_CONF_SET_DEFAULT_ENGINE 146 +# define TS_F_TS_GET_STATUS_TEXT 105 +# define TS_F_TS_MSG_IMPRINT_SET_ALGO 118 +# define TS_F_TS_REQ_SET_MSG_IMPRINT 119 +# define TS_F_TS_REQ_SET_NONCE 120 +# define TS_F_TS_REQ_SET_POLICY_ID 121 +# define TS_F_TS_RESP_CREATE_RESPONSE 122 +# define TS_F_TS_RESP_CREATE_TST_INFO 123 +# define TS_F_TS_RESP_CTX_ADD_FAILURE_INFO 124 +# define TS_F_TS_RESP_CTX_ADD_MD 125 +# define TS_F_TS_RESP_CTX_ADD_POLICY 126 +# define TS_F_TS_RESP_CTX_NEW 127 +# define TS_F_TS_RESP_CTX_SET_ACCURACY 128 +# define TS_F_TS_RESP_CTX_SET_CERTS 129 +# define TS_F_TS_RESP_CTX_SET_DEF_POLICY 130 +# define TS_F_TS_RESP_CTX_SET_SIGNER_CERT 131 +# define TS_F_TS_RESP_CTX_SET_STATUS_INFO 132 +# define TS_F_TS_RESP_GET_POLICY 133 +# define TS_F_TS_RESP_SET_GENTIME_WITH_PRECISION 134 +# define TS_F_TS_RESP_SET_STATUS_INFO 135 +# define TS_F_TS_RESP_SET_TST_INFO 150 +# define TS_F_TS_RESP_SIGN 136 +# define TS_F_TS_RESP_VERIFY_SIGNATURE 106 +# define TS_F_TS_TST_INFO_SET_ACCURACY 137 +# define TS_F_TS_TST_INFO_SET_MSG_IMPRINT 138 +# define TS_F_TS_TST_INFO_SET_NONCE 139 +# define TS_F_TS_TST_INFO_SET_POLICY_ID 140 +# define TS_F_TS_TST_INFO_SET_SERIAL 141 +# define TS_F_TS_TST_INFO_SET_TIME 142 +# define TS_F_TS_TST_INFO_SET_TSA 143 +# define TS_F_TS_VERIFY 108 +# define TS_F_TS_VERIFY_CERT 109 +# define TS_F_TS_VERIFY_CTX_NEW 144 + +/* + * TS reason codes. + */ +# define TS_R_BAD_PKCS7_TYPE 132 +# define TS_R_BAD_TYPE 133 +# define TS_R_CANNOT_LOAD_CERT 137 +# define TS_R_CANNOT_LOAD_KEY 138 +# define TS_R_CERTIFICATE_VERIFY_ERROR 100 +# define TS_R_COULD_NOT_SET_ENGINE 127 +# define TS_R_COULD_NOT_SET_TIME 115 +# define TS_R_DETACHED_CONTENT 134 +# define TS_R_ESS_ADD_SIGNING_CERT_ERROR 116 +# define TS_R_ESS_ADD_SIGNING_CERT_V2_ERROR 139 +# define TS_R_ESS_SIGNING_CERTIFICATE_ERROR 101 +# define TS_R_INVALID_NULL_POINTER 102 +# define TS_R_INVALID_SIGNER_CERTIFICATE_PURPOSE 117 +# define TS_R_MESSAGE_IMPRINT_MISMATCH 103 +# define TS_R_NONCE_MISMATCH 104 +# define TS_R_NONCE_NOT_RETURNED 105 +# define TS_R_NO_CONTENT 106 +# define TS_R_NO_TIME_STAMP_TOKEN 107 +# define TS_R_PKCS7_ADD_SIGNATURE_ERROR 118 +# define TS_R_PKCS7_ADD_SIGNED_ATTR_ERROR 119 +# define TS_R_PKCS7_TO_TS_TST_INFO_FAILED 129 +# define TS_R_POLICY_MISMATCH 108 +# define TS_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 120 +# define TS_R_RESPONSE_SETUP_ERROR 121 +# define TS_R_SIGNATURE_FAILURE 109 +# define TS_R_THERE_MUST_BE_ONE_SIGNER 110 +# define TS_R_TIME_SYSCALL_ERROR 122 +# define TS_R_TOKEN_NOT_PRESENT 130 +# define TS_R_TOKEN_PRESENT 131 +# define TS_R_TSA_NAME_MISMATCH 111 +# define TS_R_TSA_UNTRUSTED 112 +# define TS_R_TST_INFO_SETUP_ERROR 123 +# define TS_R_TS_DATASIGN 124 +# define TS_R_UNACCEPTABLE_POLICY 125 +# define TS_R_UNSUPPORTED_MD_ALGORITHM 126 +# define TS_R_UNSUPPORTED_VERSION 113 +# define TS_R_VAR_BAD_VALUE 135 +# define TS_R_VAR_LOOKUP_FAILURE 136 +# define TS_R_WRONG_CONTENT_TYPE 114 + +# endif +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/txt_db.h b/MediaClient/MediaClient/openssl/include/openssl/txt_db.h new file mode 100644 index 0000000..ec981a4 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/txt_db.h @@ -0,0 +1,57 @@ +/* + * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_TXT_DB_H +# define HEADER_TXT_DB_H + +# include +# include +# include +# include + +# define DB_ERROR_OK 0 +# define DB_ERROR_MALLOC 1 +# define DB_ERROR_INDEX_CLASH 2 +# define DB_ERROR_INDEX_OUT_OF_RANGE 3 +# define DB_ERROR_NO_INDEX 4 +# define DB_ERROR_INSERT_INDEX_CLASH 5 +# define DB_ERROR_WRONG_NUM_FIELDS 6 + +#ifdef __cplusplus +extern "C" { +#endif + +typedef OPENSSL_STRING *OPENSSL_PSTRING; +DEFINE_SPECIAL_STACK_OF(OPENSSL_PSTRING, OPENSSL_STRING) + +typedef struct txt_db_st { + int num_fields; + STACK_OF(OPENSSL_PSTRING) *data; + LHASH_OF(OPENSSL_STRING) **index; + int (**qual) (OPENSSL_STRING *); + long error; + long arg1; + long arg2; + OPENSSL_STRING *arg_row; +} TXT_DB; + +TXT_DB *TXT_DB_read(BIO *in, int num); +long TXT_DB_write(BIO *out, TXT_DB *db); +int TXT_DB_create_index(TXT_DB *db, int field, int (*qual) (OPENSSL_STRING *), + OPENSSL_LH_HASHFUNC hash, OPENSSL_LH_COMPFUNC cmp); +void TXT_DB_free(TXT_DB *db); +OPENSSL_STRING *TXT_DB_get_by_index(TXT_DB *db, int idx, + OPENSSL_STRING *value); +int TXT_DB_insert(TXT_DB *db, OPENSSL_STRING *value); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/ui.h b/MediaClient/MediaClient/openssl/include/openssl/ui.h new file mode 100644 index 0000000..7c721ec --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/ui.h @@ -0,0 +1,368 @@ +/* + * Copyright 2001-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_UI_H +# define HEADER_UI_H + +# include + +# if OPENSSL_API_COMPAT < 0x10100000L +# include +# endif +# include +# include +# include +# include + +/* For compatibility reasons, the macro OPENSSL_NO_UI is currently retained */ +# if OPENSSL_API_COMPAT < 0x10200000L +# ifdef OPENSSL_NO_UI_CONSOLE +# define OPENSSL_NO_UI +# endif +# endif + +# ifdef __cplusplus +extern "C" { +# endif + +/* + * All the following functions return -1 or NULL on error and in some cases + * (UI_process()) -2 if interrupted or in some other way cancelled. When + * everything is fine, they return 0, a positive value or a non-NULL pointer, + * all depending on their purpose. + */ + +/* Creators and destructor. */ +UI *UI_new(void); +UI *UI_new_method(const UI_METHOD *method); +void UI_free(UI *ui); + +/*- + The following functions are used to add strings to be printed and prompt + strings to prompt for data. The names are UI_{add,dup}__string + and UI_{add,dup}_input_boolean. + + UI_{add,dup}__string have the following meanings: + add add a text or prompt string. The pointers given to these + functions are used verbatim, no copying is done. + dup make a copy of the text or prompt string, then add the copy + to the collection of strings in the user interface. + + The function is a name for the functionality that the given + string shall be used for. It can be one of: + input use the string as data prompt. + verify use the string as verification prompt. This + is used to verify a previous input. + info use the string for informational output. + error use the string for error output. + Honestly, there's currently no difference between info and error for the + moment. + + UI_{add,dup}_input_boolean have the same semantics for "add" and "dup", + and are typically used when one wants to prompt for a yes/no response. + + All of the functions in this group take a UI and a prompt string. + The string input and verify addition functions also take a flag argument, + a buffer for the result to end up with, a minimum input size and a maximum + input size (the result buffer MUST be large enough to be able to contain + the maximum number of characters). Additionally, the verify addition + functions takes another buffer to compare the result against. + The boolean input functions take an action description string (which should + be safe to ignore if the expected user action is obvious, for example with + a dialog box with an OK button and a Cancel button), a string of acceptable + characters to mean OK and to mean Cancel. The two last strings are checked + to make sure they don't have common characters. Additionally, the same + flag argument as for the string input is taken, as well as a result buffer. + The result buffer is required to be at least one byte long. Depending on + the answer, the first character from the OK or the Cancel character strings + will be stored in the first byte of the result buffer. No NUL will be + added, so the result is *not* a string. + + On success, the all return an index of the added information. That index + is useful when retrieving results with UI_get0_result(). */ +int UI_add_input_string(UI *ui, const char *prompt, int flags, + char *result_buf, int minsize, int maxsize); +int UI_dup_input_string(UI *ui, const char *prompt, int flags, + char *result_buf, int minsize, int maxsize); +int UI_add_verify_string(UI *ui, const char *prompt, int flags, + char *result_buf, int minsize, int maxsize, + const char *test_buf); +int UI_dup_verify_string(UI *ui, const char *prompt, int flags, + char *result_buf, int minsize, int maxsize, + const char *test_buf); +int UI_add_input_boolean(UI *ui, const char *prompt, const char *action_desc, + const char *ok_chars, const char *cancel_chars, + int flags, char *result_buf); +int UI_dup_input_boolean(UI *ui, const char *prompt, const char *action_desc, + const char *ok_chars, const char *cancel_chars, + int flags, char *result_buf); +int UI_add_info_string(UI *ui, const char *text); +int UI_dup_info_string(UI *ui, const char *text); +int UI_add_error_string(UI *ui, const char *text); +int UI_dup_error_string(UI *ui, const char *text); + +/* These are the possible flags. They can be or'ed together. */ +/* Use to have echoing of input */ +# define UI_INPUT_FLAG_ECHO 0x01 +/* + * Use a default password. Where that password is found is completely up to + * the application, it might for example be in the user data set with + * UI_add_user_data(). It is not recommended to have more than one input in + * each UI being marked with this flag, or the application might get + * confused. + */ +# define UI_INPUT_FLAG_DEFAULT_PWD 0x02 + +/*- + * The user of these routines may want to define flags of their own. The core + * UI won't look at those, but will pass them on to the method routines. They + * must use higher bits so they don't get confused with the UI bits above. + * UI_INPUT_FLAG_USER_BASE tells which is the lowest bit to use. A good + * example of use is this: + * + * #define MY_UI_FLAG1 (0x01 << UI_INPUT_FLAG_USER_BASE) + * +*/ +# define UI_INPUT_FLAG_USER_BASE 16 + +/*- + * The following function helps construct a prompt. object_desc is a + * textual short description of the object, for example "pass phrase", + * and object_name is the name of the object (might be a card name or + * a file name. + * The returned string shall always be allocated on the heap with + * OPENSSL_malloc(), and need to be free'd with OPENSSL_free(). + * + * If the ui_method doesn't contain a pointer to a user-defined prompt + * constructor, a default string is built, looking like this: + * + * "Enter {object_desc} for {object_name}:" + * + * So, if object_desc has the value "pass phrase" and object_name has + * the value "foo.key", the resulting string is: + * + * "Enter pass phrase for foo.key:" +*/ +char *UI_construct_prompt(UI *ui_method, + const char *object_desc, const char *object_name); + +/* + * The following function is used to store a pointer to user-specific data. + * Any previous such pointer will be returned and replaced. + * + * For callback purposes, this function makes a lot more sense than using + * ex_data, since the latter requires that different parts of OpenSSL or + * applications share the same ex_data index. + * + * Note that the UI_OpenSSL() method completely ignores the user data. Other + * methods may not, however. + */ +void *UI_add_user_data(UI *ui, void *user_data); +/* + * Alternatively, this function is used to duplicate the user data. + * This uses the duplicator method function. The destroy function will + * be used to free the user data in this case. + */ +int UI_dup_user_data(UI *ui, void *user_data); +/* We need a user data retrieving function as well. */ +void *UI_get0_user_data(UI *ui); + +/* Return the result associated with a prompt given with the index i. */ +const char *UI_get0_result(UI *ui, int i); +int UI_get_result_length(UI *ui, int i); + +/* When all strings have been added, process the whole thing. */ +int UI_process(UI *ui); + +/* + * Give a user interface parameterised control commands. This can be used to + * send down an integer, a data pointer or a function pointer, as well as be + * used to get information from a UI. + */ +int UI_ctrl(UI *ui, int cmd, long i, void *p, void (*f) (void)); + +/* The commands */ +/* + * Use UI_CONTROL_PRINT_ERRORS with the value 1 to have UI_process print the + * OpenSSL error stack before printing any info or added error messages and + * before any prompting. + */ +# define UI_CTRL_PRINT_ERRORS 1 +/* + * Check if a UI_process() is possible to do again with the same instance of + * a user interface. This makes UI_ctrl() return 1 if it is redoable, and 0 + * if not. + */ +# define UI_CTRL_IS_REDOABLE 2 + +/* Some methods may use extra data */ +# define UI_set_app_data(s,arg) UI_set_ex_data(s,0,arg) +# define UI_get_app_data(s) UI_get_ex_data(s,0) + +# define UI_get_ex_new_index(l, p, newf, dupf, freef) \ + CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_UI, l, p, newf, dupf, freef) +int UI_set_ex_data(UI *r, int idx, void *arg); +void *UI_get_ex_data(UI *r, int idx); + +/* Use specific methods instead of the built-in one */ +void UI_set_default_method(const UI_METHOD *meth); +const UI_METHOD *UI_get_default_method(void); +const UI_METHOD *UI_get_method(UI *ui); +const UI_METHOD *UI_set_method(UI *ui, const UI_METHOD *meth); + +# ifndef OPENSSL_NO_UI_CONSOLE + +/* The method with all the built-in thingies */ +UI_METHOD *UI_OpenSSL(void); + +# endif + +/* + * NULL method. Literally does nothing, but may serve as a placeholder + * to avoid internal default. + */ +const UI_METHOD *UI_null(void); + +/* ---------- For method writers ---------- */ +/*- + A method contains a number of functions that implement the low level + of the User Interface. The functions are: + + an opener This function starts a session, maybe by opening + a channel to a tty, or by opening a window. + a writer This function is called to write a given string, + maybe to the tty, maybe as a field label in a + window. + a flusher This function is called to flush everything that + has been output so far. It can be used to actually + display a dialog box after it has been built. + a reader This function is called to read a given prompt, + maybe from the tty, maybe from a field in a + window. Note that it's called with all string + structures, not only the prompt ones, so it must + check such things itself. + a closer This function closes the session, maybe by closing + the channel to the tty, or closing the window. + + All these functions are expected to return: + + 0 on error. + 1 on success. + -1 on out-of-band events, for example if some prompting has + been canceled (by pressing Ctrl-C, for example). This is + only checked when returned by the flusher or the reader. + + The way this is used, the opener is first called, then the writer for all + strings, then the flusher, then the reader for all strings and finally the + closer. Note that if you want to prompt from a terminal or other command + line interface, the best is to have the reader also write the prompts + instead of having the writer do it. If you want to prompt from a dialog + box, the writer can be used to build up the contents of the box, and the + flusher to actually display the box and run the event loop until all data + has been given, after which the reader only grabs the given data and puts + them back into the UI strings. + + All method functions take a UI as argument. Additionally, the writer and + the reader take a UI_STRING. +*/ + +/* + * The UI_STRING type is the data structure that contains all the needed info + * about a string or a prompt, including test data for a verification prompt. + */ +typedef struct ui_string_st UI_STRING; +DEFINE_STACK_OF(UI_STRING) + +/* + * The different types of strings that are currently supported. This is only + * needed by method authors. + */ +enum UI_string_types { + UIT_NONE = 0, + UIT_PROMPT, /* Prompt for a string */ + UIT_VERIFY, /* Prompt for a string and verify */ + UIT_BOOLEAN, /* Prompt for a yes/no response */ + UIT_INFO, /* Send info to the user */ + UIT_ERROR /* Send an error message to the user */ +}; + +/* Create and manipulate methods */ +UI_METHOD *UI_create_method(const char *name); +void UI_destroy_method(UI_METHOD *ui_method); +int UI_method_set_opener(UI_METHOD *method, int (*opener) (UI *ui)); +int UI_method_set_writer(UI_METHOD *method, + int (*writer) (UI *ui, UI_STRING *uis)); +int UI_method_set_flusher(UI_METHOD *method, int (*flusher) (UI *ui)); +int UI_method_set_reader(UI_METHOD *method, + int (*reader) (UI *ui, UI_STRING *uis)); +int UI_method_set_closer(UI_METHOD *method, int (*closer) (UI *ui)); +int UI_method_set_data_duplicator(UI_METHOD *method, + void *(*duplicator) (UI *ui, void *ui_data), + void (*destructor)(UI *ui, void *ui_data)); +int UI_method_set_prompt_constructor(UI_METHOD *method, + char *(*prompt_constructor) (UI *ui, + const char + *object_desc, + const char + *object_name)); +int UI_method_set_ex_data(UI_METHOD *method, int idx, void *data); +int (*UI_method_get_opener(const UI_METHOD *method)) (UI *); +int (*UI_method_get_writer(const UI_METHOD *method)) (UI *, UI_STRING *); +int (*UI_method_get_flusher(const UI_METHOD *method)) (UI *); +int (*UI_method_get_reader(const UI_METHOD *method)) (UI *, UI_STRING *); +int (*UI_method_get_closer(const UI_METHOD *method)) (UI *); +char *(*UI_method_get_prompt_constructor(const UI_METHOD *method)) + (UI *, const char *, const char *); +void *(*UI_method_get_data_duplicator(const UI_METHOD *method)) (UI *, void *); +void (*UI_method_get_data_destructor(const UI_METHOD *method)) (UI *, void *); +const void *UI_method_get_ex_data(const UI_METHOD *method, int idx); + +/* + * The following functions are helpers for method writers to access relevant + * data from a UI_STRING. + */ + +/* Return type of the UI_STRING */ +enum UI_string_types UI_get_string_type(UI_STRING *uis); +/* Return input flags of the UI_STRING */ +int UI_get_input_flags(UI_STRING *uis); +/* Return the actual string to output (the prompt, info or error) */ +const char *UI_get0_output_string(UI_STRING *uis); +/* + * Return the optional action string to output (the boolean prompt + * instruction) + */ +const char *UI_get0_action_string(UI_STRING *uis); +/* Return the result of a prompt */ +const char *UI_get0_result_string(UI_STRING *uis); +int UI_get_result_string_length(UI_STRING *uis); +/* + * Return the string to test the result against. Only useful with verifies. + */ +const char *UI_get0_test_string(UI_STRING *uis); +/* Return the required minimum size of the result */ +int UI_get_result_minsize(UI_STRING *uis); +/* Return the required maximum size of the result */ +int UI_get_result_maxsize(UI_STRING *uis); +/* Set the result of a UI_STRING. */ +int UI_set_result(UI *ui, UI_STRING *uis, const char *result); +int UI_set_result_ex(UI *ui, UI_STRING *uis, const char *result, int len); + +/* A couple of popular utility functions */ +int UI_UTIL_read_pw_string(char *buf, int length, const char *prompt, + int verify); +int UI_UTIL_read_pw(char *buf, char *buff, int size, const char *prompt, + int verify); +UI_METHOD *UI_UTIL_wrap_read_pem_callback(pem_password_cb *cb, int rwflag); + + +# ifdef __cplusplus +} +# endif +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/uierr.h b/MediaClient/MediaClient/openssl/include/openssl/uierr.h new file mode 100644 index 0000000..bd68864 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/uierr.h @@ -0,0 +1,65 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_UIERR_H +# define HEADER_UIERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_UI_strings(void); + +/* + * UI function codes. + */ +# define UI_F_CLOSE_CONSOLE 115 +# define UI_F_ECHO_CONSOLE 116 +# define UI_F_GENERAL_ALLOCATE_BOOLEAN 108 +# define UI_F_GENERAL_ALLOCATE_PROMPT 109 +# define UI_F_NOECHO_CONSOLE 117 +# define UI_F_OPEN_CONSOLE 114 +# define UI_F_UI_CONSTRUCT_PROMPT 121 +# define UI_F_UI_CREATE_METHOD 112 +# define UI_F_UI_CTRL 111 +# define UI_F_UI_DUP_ERROR_STRING 101 +# define UI_F_UI_DUP_INFO_STRING 102 +# define UI_F_UI_DUP_INPUT_BOOLEAN 110 +# define UI_F_UI_DUP_INPUT_STRING 103 +# define UI_F_UI_DUP_USER_DATA 118 +# define UI_F_UI_DUP_VERIFY_STRING 106 +# define UI_F_UI_GET0_RESULT 107 +# define UI_F_UI_GET_RESULT_LENGTH 119 +# define UI_F_UI_NEW_METHOD 104 +# define UI_F_UI_PROCESS 113 +# define UI_F_UI_SET_RESULT 105 +# define UI_F_UI_SET_RESULT_EX 120 + +/* + * UI reason codes. + */ +# define UI_R_COMMON_OK_AND_CANCEL_CHARACTERS 104 +# define UI_R_INDEX_TOO_LARGE 102 +# define UI_R_INDEX_TOO_SMALL 103 +# define UI_R_NO_RESULT_BUFFER 105 +# define UI_R_PROCESSING_ERROR 107 +# define UI_R_RESULT_TOO_LARGE 100 +# define UI_R_RESULT_TOO_SMALL 101 +# define UI_R_SYSASSIGN_ERROR 109 +# define UI_R_SYSDASSGN_ERROR 110 +# define UI_R_SYSQIOW_ERROR 111 +# define UI_R_UNKNOWN_CONTROL_COMMAND 106 +# define UI_R_UNKNOWN_TTYGET_ERRNO_VALUE 108 +# define UI_R_USER_DATA_DUPLICATION_UNSUPPORTED 112 + +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/whrlpool.h b/MediaClient/MediaClient/openssl/include/openssl/whrlpool.h new file mode 100644 index 0000000..20ea350 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/whrlpool.h @@ -0,0 +1,48 @@ +/* + * Copyright 2005-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_WHRLPOOL_H +# define HEADER_WHRLPOOL_H + +#include + +# ifndef OPENSSL_NO_WHIRLPOOL +# include +# include +# ifdef __cplusplus +extern "C" { +# endif + +# define WHIRLPOOL_DIGEST_LENGTH (512/8) +# define WHIRLPOOL_BBLOCK 512 +# define WHIRLPOOL_COUNTER (256/8) + +typedef struct { + union { + unsigned char c[WHIRLPOOL_DIGEST_LENGTH]; + /* double q is here to ensure 64-bit alignment */ + double q[WHIRLPOOL_DIGEST_LENGTH / sizeof(double)]; + } H; + unsigned char data[WHIRLPOOL_BBLOCK / 8]; + unsigned int bitoff; + size_t bitlen[WHIRLPOOL_COUNTER / sizeof(size_t)]; +} WHIRLPOOL_CTX; + +int WHIRLPOOL_Init(WHIRLPOOL_CTX *c); +int WHIRLPOOL_Update(WHIRLPOOL_CTX *c, const void *inp, size_t bytes); +void WHIRLPOOL_BitUpdate(WHIRLPOOL_CTX *c, const void *inp, size_t bits); +int WHIRLPOOL_Final(unsigned char *md, WHIRLPOOL_CTX *c); +unsigned char *WHIRLPOOL(const void *inp, size_t bytes, unsigned char *md); + +# ifdef __cplusplus +} +# endif +# endif + +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/x509.h b/MediaClient/MediaClient/openssl/include/openssl/x509.h new file mode 100644 index 0000000..39ca0ba --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/x509.h @@ -0,0 +1,1047 @@ +/* + * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. + * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_X509_H +# define HEADER_X509_H + +# include +# include +# include +# include +# include +# include +# include +# include +# include + +# if OPENSSL_API_COMPAT < 0x10100000L +# include +# include +# include +# endif + +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + + +/* Flags for X509_get_signature_info() */ +/* Signature info is valid */ +# define X509_SIG_INFO_VALID 0x1 +/* Signature is suitable for TLS use */ +# define X509_SIG_INFO_TLS 0x2 + +# define X509_FILETYPE_PEM 1 +# define X509_FILETYPE_ASN1 2 +# define X509_FILETYPE_DEFAULT 3 + +# define X509v3_KU_DIGITAL_SIGNATURE 0x0080 +# define X509v3_KU_NON_REPUDIATION 0x0040 +# define X509v3_KU_KEY_ENCIPHERMENT 0x0020 +# define X509v3_KU_DATA_ENCIPHERMENT 0x0010 +# define X509v3_KU_KEY_AGREEMENT 0x0008 +# define X509v3_KU_KEY_CERT_SIGN 0x0004 +# define X509v3_KU_CRL_SIGN 0x0002 +# define X509v3_KU_ENCIPHER_ONLY 0x0001 +# define X509v3_KU_DECIPHER_ONLY 0x8000 +# define X509v3_KU_UNDEF 0xffff + +struct X509_algor_st { + ASN1_OBJECT *algorithm; + ASN1_TYPE *parameter; +} /* X509_ALGOR */ ; + +typedef STACK_OF(X509_ALGOR) X509_ALGORS; + +typedef struct X509_val_st { + ASN1_TIME *notBefore; + ASN1_TIME *notAfter; +} X509_VAL; + +typedef struct X509_sig_st X509_SIG; + +typedef struct X509_name_entry_st X509_NAME_ENTRY; + +DEFINE_STACK_OF(X509_NAME_ENTRY) + +DEFINE_STACK_OF(X509_NAME) + +# define X509_EX_V_NETSCAPE_HACK 0x8000 +# define X509_EX_V_INIT 0x0001 +typedef struct X509_extension_st X509_EXTENSION; + +typedef STACK_OF(X509_EXTENSION) X509_EXTENSIONS; + +DEFINE_STACK_OF(X509_EXTENSION) + +typedef struct x509_attributes_st X509_ATTRIBUTE; + +DEFINE_STACK_OF(X509_ATTRIBUTE) + +typedef struct X509_req_info_st X509_REQ_INFO; + +typedef struct X509_req_st X509_REQ; + +typedef struct x509_cert_aux_st X509_CERT_AUX; + +typedef struct x509_cinf_st X509_CINF; + +DEFINE_STACK_OF(X509) + +/* This is used for a table of trust checking functions */ + +typedef struct x509_trust_st { + int trust; + int flags; + int (*check_trust) (struct x509_trust_st *, X509 *, int); + char *name; + int arg1; + void *arg2; +} X509_TRUST; + +DEFINE_STACK_OF(X509_TRUST) + +/* standard trust ids */ + +# define X509_TRUST_DEFAULT 0 /* Only valid in purpose settings */ + +# define X509_TRUST_COMPAT 1 +# define X509_TRUST_SSL_CLIENT 2 +# define X509_TRUST_SSL_SERVER 3 +# define X509_TRUST_EMAIL 4 +# define X509_TRUST_OBJECT_SIGN 5 +# define X509_TRUST_OCSP_SIGN 6 +# define X509_TRUST_OCSP_REQUEST 7 +# define X509_TRUST_TSA 8 + +/* Keep these up to date! */ +# define X509_TRUST_MIN 1 +# define X509_TRUST_MAX 8 + +/* trust_flags values */ +# define X509_TRUST_DYNAMIC (1U << 0) +# define X509_TRUST_DYNAMIC_NAME (1U << 1) +/* No compat trust if self-signed, preempts "DO_SS" */ +# define X509_TRUST_NO_SS_COMPAT (1U << 2) +/* Compat trust if no explicit accepted trust EKUs */ +# define X509_TRUST_DO_SS_COMPAT (1U << 3) +/* Accept "anyEKU" as a wildcard trust OID */ +# define X509_TRUST_OK_ANY_EKU (1U << 4) + +/* check_trust return codes */ + +# define X509_TRUST_TRUSTED 1 +# define X509_TRUST_REJECTED 2 +# define X509_TRUST_UNTRUSTED 3 + +/* Flags for X509_print_ex() */ + +# define X509_FLAG_COMPAT 0 +# define X509_FLAG_NO_HEADER 1L +# define X509_FLAG_NO_VERSION (1L << 1) +# define X509_FLAG_NO_SERIAL (1L << 2) +# define X509_FLAG_NO_SIGNAME (1L << 3) +# define X509_FLAG_NO_ISSUER (1L << 4) +# define X509_FLAG_NO_VALIDITY (1L << 5) +# define X509_FLAG_NO_SUBJECT (1L << 6) +# define X509_FLAG_NO_PUBKEY (1L << 7) +# define X509_FLAG_NO_EXTENSIONS (1L << 8) +# define X509_FLAG_NO_SIGDUMP (1L << 9) +# define X509_FLAG_NO_AUX (1L << 10) +# define X509_FLAG_NO_ATTRIBUTES (1L << 11) +# define X509_FLAG_NO_IDS (1L << 12) + +/* Flags specific to X509_NAME_print_ex() */ + +/* The field separator information */ + +# define XN_FLAG_SEP_MASK (0xf << 16) + +# define XN_FLAG_COMPAT 0/* Traditional; use old X509_NAME_print */ +# define XN_FLAG_SEP_COMMA_PLUS (1 << 16)/* RFC2253 ,+ */ +# define XN_FLAG_SEP_CPLUS_SPC (2 << 16)/* ,+ spaced: more readable */ +# define XN_FLAG_SEP_SPLUS_SPC (3 << 16)/* ;+ spaced */ +# define XN_FLAG_SEP_MULTILINE (4 << 16)/* One line per field */ + +# define XN_FLAG_DN_REV (1 << 20)/* Reverse DN order */ + +/* How the field name is shown */ + +# define XN_FLAG_FN_MASK (0x3 << 21) + +# define XN_FLAG_FN_SN 0/* Object short name */ +# define XN_FLAG_FN_LN (1 << 21)/* Object long name */ +# define XN_FLAG_FN_OID (2 << 21)/* Always use OIDs */ +# define XN_FLAG_FN_NONE (3 << 21)/* No field names */ + +# define XN_FLAG_SPC_EQ (1 << 23)/* Put spaces round '=' */ + +/* + * This determines if we dump fields we don't recognise: RFC2253 requires + * this. + */ + +# define XN_FLAG_DUMP_UNKNOWN_FIELDS (1 << 24) + +# define XN_FLAG_FN_ALIGN (1 << 25)/* Align field names to 20 + * characters */ + +/* Complete set of RFC2253 flags */ + +# define XN_FLAG_RFC2253 (ASN1_STRFLGS_RFC2253 | \ + XN_FLAG_SEP_COMMA_PLUS | \ + XN_FLAG_DN_REV | \ + XN_FLAG_FN_SN | \ + XN_FLAG_DUMP_UNKNOWN_FIELDS) + +/* readable oneline form */ + +# define XN_FLAG_ONELINE (ASN1_STRFLGS_RFC2253 | \ + ASN1_STRFLGS_ESC_QUOTE | \ + XN_FLAG_SEP_CPLUS_SPC | \ + XN_FLAG_SPC_EQ | \ + XN_FLAG_FN_SN) + +/* readable multiline form */ + +# define XN_FLAG_MULTILINE (ASN1_STRFLGS_ESC_CTRL | \ + ASN1_STRFLGS_ESC_MSB | \ + XN_FLAG_SEP_MULTILINE | \ + XN_FLAG_SPC_EQ | \ + XN_FLAG_FN_LN | \ + XN_FLAG_FN_ALIGN) + +DEFINE_STACK_OF(X509_REVOKED) + +typedef struct X509_crl_info_st X509_CRL_INFO; + +DEFINE_STACK_OF(X509_CRL) + +typedef struct private_key_st { + int version; + /* The PKCS#8 data types */ + X509_ALGOR *enc_algor; + ASN1_OCTET_STRING *enc_pkey; /* encrypted pub key */ + /* When decrypted, the following will not be NULL */ + EVP_PKEY *dec_pkey; + /* used to encrypt and decrypt */ + int key_length; + char *key_data; + int key_free; /* true if we should auto free key_data */ + /* expanded version of 'enc_algor' */ + EVP_CIPHER_INFO cipher; +} X509_PKEY; + +typedef struct X509_info_st { + X509 *x509; + X509_CRL *crl; + X509_PKEY *x_pkey; + EVP_CIPHER_INFO enc_cipher; + int enc_len; + char *enc_data; +} X509_INFO; + +DEFINE_STACK_OF(X509_INFO) + +/* + * The next 2 structures and their 8 routines are used to manipulate Netscape's + * spki structures - useful if you are writing a CA web page + */ +typedef struct Netscape_spkac_st { + X509_PUBKEY *pubkey; + ASN1_IA5STRING *challenge; /* challenge sent in atlas >= PR2 */ +} NETSCAPE_SPKAC; + +typedef struct Netscape_spki_st { + NETSCAPE_SPKAC *spkac; /* signed public key and challenge */ + X509_ALGOR sig_algor; + ASN1_BIT_STRING *signature; +} NETSCAPE_SPKI; + +/* Netscape certificate sequence structure */ +typedef struct Netscape_certificate_sequence { + ASN1_OBJECT *type; + STACK_OF(X509) *certs; +} NETSCAPE_CERT_SEQUENCE; + +/*- Unused (and iv length is wrong) +typedef struct CBCParameter_st + { + unsigned char iv[8]; + } CBC_PARAM; +*/ + +/* Password based encryption structure */ + +typedef struct PBEPARAM_st { + ASN1_OCTET_STRING *salt; + ASN1_INTEGER *iter; +} PBEPARAM; + +/* Password based encryption V2 structures */ + +typedef struct PBE2PARAM_st { + X509_ALGOR *keyfunc; + X509_ALGOR *encryption; +} PBE2PARAM; + +typedef struct PBKDF2PARAM_st { +/* Usually OCTET STRING but could be anything */ + ASN1_TYPE *salt; + ASN1_INTEGER *iter; + ASN1_INTEGER *keylength; + X509_ALGOR *prf; +} PBKDF2PARAM; + +#ifndef OPENSSL_NO_SCRYPT +typedef struct SCRYPT_PARAMS_st { + ASN1_OCTET_STRING *salt; + ASN1_INTEGER *costParameter; + ASN1_INTEGER *blockSize; + ASN1_INTEGER *parallelizationParameter; + ASN1_INTEGER *keyLength; +} SCRYPT_PARAMS; +#endif + +#ifdef __cplusplus +} +#endif + +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + +# define X509_EXT_PACK_UNKNOWN 1 +# define X509_EXT_PACK_STRING 2 + +# define X509_extract_key(x) X509_get_pubkey(x)/*****/ +# define X509_REQ_extract_key(a) X509_REQ_get_pubkey(a) +# define X509_name_cmp(a,b) X509_NAME_cmp((a),(b)) + +void X509_CRL_set_default_method(const X509_CRL_METHOD *meth); +X509_CRL_METHOD *X509_CRL_METHOD_new(int (*crl_init) (X509_CRL *crl), + int (*crl_free) (X509_CRL *crl), + int (*crl_lookup) (X509_CRL *crl, + X509_REVOKED **ret, + ASN1_INTEGER *ser, + X509_NAME *issuer), + int (*crl_verify) (X509_CRL *crl, + EVP_PKEY *pk)); +void X509_CRL_METHOD_free(X509_CRL_METHOD *m); + +void X509_CRL_set_meth_data(X509_CRL *crl, void *dat); +void *X509_CRL_get_meth_data(X509_CRL *crl); + +const char *X509_verify_cert_error_string(long n); + +int X509_verify(X509 *a, EVP_PKEY *r); + +int X509_REQ_verify(X509_REQ *a, EVP_PKEY *r); +int X509_CRL_verify(X509_CRL *a, EVP_PKEY *r); +int NETSCAPE_SPKI_verify(NETSCAPE_SPKI *a, EVP_PKEY *r); + +NETSCAPE_SPKI *NETSCAPE_SPKI_b64_decode(const char *str, int len); +char *NETSCAPE_SPKI_b64_encode(NETSCAPE_SPKI *x); +EVP_PKEY *NETSCAPE_SPKI_get_pubkey(NETSCAPE_SPKI *x); +int NETSCAPE_SPKI_set_pubkey(NETSCAPE_SPKI *x, EVP_PKEY *pkey); + +int NETSCAPE_SPKI_print(BIO *out, NETSCAPE_SPKI *spki); + +int X509_signature_dump(BIO *bp, const ASN1_STRING *sig, int indent); +int X509_signature_print(BIO *bp, const X509_ALGOR *alg, + const ASN1_STRING *sig); + +int X509_sign(X509 *x, EVP_PKEY *pkey, const EVP_MD *md); +int X509_sign_ctx(X509 *x, EVP_MD_CTX *ctx); +# ifndef OPENSSL_NO_OCSP +int X509_http_nbio(OCSP_REQ_CTX *rctx, X509 **pcert); +# endif +int X509_REQ_sign(X509_REQ *x, EVP_PKEY *pkey, const EVP_MD *md); +int X509_REQ_sign_ctx(X509_REQ *x, EVP_MD_CTX *ctx); +int X509_CRL_sign(X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *md); +int X509_CRL_sign_ctx(X509_CRL *x, EVP_MD_CTX *ctx); +# ifndef OPENSSL_NO_OCSP +int X509_CRL_http_nbio(OCSP_REQ_CTX *rctx, X509_CRL **pcrl); +# endif +int NETSCAPE_SPKI_sign(NETSCAPE_SPKI *x, EVP_PKEY *pkey, const EVP_MD *md); + +int X509_pubkey_digest(const X509 *data, const EVP_MD *type, + unsigned char *md, unsigned int *len); +int X509_digest(const X509 *data, const EVP_MD *type, + unsigned char *md, unsigned int *len); +int X509_CRL_digest(const X509_CRL *data, const EVP_MD *type, + unsigned char *md, unsigned int *len); +int X509_REQ_digest(const X509_REQ *data, const EVP_MD *type, + unsigned char *md, unsigned int *len); +int X509_NAME_digest(const X509_NAME *data, const EVP_MD *type, + unsigned char *md, unsigned int *len); + +# ifndef OPENSSL_NO_STDIO +X509 *d2i_X509_fp(FILE *fp, X509 **x509); +int i2d_X509_fp(FILE *fp, X509 *x509); +X509_CRL *d2i_X509_CRL_fp(FILE *fp, X509_CRL **crl); +int i2d_X509_CRL_fp(FILE *fp, X509_CRL *crl); +X509_REQ *d2i_X509_REQ_fp(FILE *fp, X509_REQ **req); +int i2d_X509_REQ_fp(FILE *fp, X509_REQ *req); +# ifndef OPENSSL_NO_RSA +RSA *d2i_RSAPrivateKey_fp(FILE *fp, RSA **rsa); +int i2d_RSAPrivateKey_fp(FILE *fp, RSA *rsa); +RSA *d2i_RSAPublicKey_fp(FILE *fp, RSA **rsa); +int i2d_RSAPublicKey_fp(FILE *fp, RSA *rsa); +RSA *d2i_RSA_PUBKEY_fp(FILE *fp, RSA **rsa); +int i2d_RSA_PUBKEY_fp(FILE *fp, RSA *rsa); +# endif +# ifndef OPENSSL_NO_DSA +DSA *d2i_DSA_PUBKEY_fp(FILE *fp, DSA **dsa); +int i2d_DSA_PUBKEY_fp(FILE *fp, DSA *dsa); +DSA *d2i_DSAPrivateKey_fp(FILE *fp, DSA **dsa); +int i2d_DSAPrivateKey_fp(FILE *fp, DSA *dsa); +# endif +# ifndef OPENSSL_NO_EC +EC_KEY *d2i_EC_PUBKEY_fp(FILE *fp, EC_KEY **eckey); +int i2d_EC_PUBKEY_fp(FILE *fp, EC_KEY *eckey); +EC_KEY *d2i_ECPrivateKey_fp(FILE *fp, EC_KEY **eckey); +int i2d_ECPrivateKey_fp(FILE *fp, EC_KEY *eckey); +# endif +X509_SIG *d2i_PKCS8_fp(FILE *fp, X509_SIG **p8); +int i2d_PKCS8_fp(FILE *fp, X509_SIG *p8); +PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_fp(FILE *fp, + PKCS8_PRIV_KEY_INFO **p8inf); +int i2d_PKCS8_PRIV_KEY_INFO_fp(FILE *fp, PKCS8_PRIV_KEY_INFO *p8inf); +int i2d_PKCS8PrivateKeyInfo_fp(FILE *fp, EVP_PKEY *key); +int i2d_PrivateKey_fp(FILE *fp, EVP_PKEY *pkey); +EVP_PKEY *d2i_PrivateKey_fp(FILE *fp, EVP_PKEY **a); +int i2d_PUBKEY_fp(FILE *fp, EVP_PKEY *pkey); +EVP_PKEY *d2i_PUBKEY_fp(FILE *fp, EVP_PKEY **a); +# endif + +X509 *d2i_X509_bio(BIO *bp, X509 **x509); +int i2d_X509_bio(BIO *bp, X509 *x509); +X509_CRL *d2i_X509_CRL_bio(BIO *bp, X509_CRL **crl); +int i2d_X509_CRL_bio(BIO *bp, X509_CRL *crl); +X509_REQ *d2i_X509_REQ_bio(BIO *bp, X509_REQ **req); +int i2d_X509_REQ_bio(BIO *bp, X509_REQ *req); +# ifndef OPENSSL_NO_RSA +RSA *d2i_RSAPrivateKey_bio(BIO *bp, RSA **rsa); +int i2d_RSAPrivateKey_bio(BIO *bp, RSA *rsa); +RSA *d2i_RSAPublicKey_bio(BIO *bp, RSA **rsa); +int i2d_RSAPublicKey_bio(BIO *bp, RSA *rsa); +RSA *d2i_RSA_PUBKEY_bio(BIO *bp, RSA **rsa); +int i2d_RSA_PUBKEY_bio(BIO *bp, RSA *rsa); +# endif +# ifndef OPENSSL_NO_DSA +DSA *d2i_DSA_PUBKEY_bio(BIO *bp, DSA **dsa); +int i2d_DSA_PUBKEY_bio(BIO *bp, DSA *dsa); +DSA *d2i_DSAPrivateKey_bio(BIO *bp, DSA **dsa); +int i2d_DSAPrivateKey_bio(BIO *bp, DSA *dsa); +# endif +# ifndef OPENSSL_NO_EC +EC_KEY *d2i_EC_PUBKEY_bio(BIO *bp, EC_KEY **eckey); +int i2d_EC_PUBKEY_bio(BIO *bp, EC_KEY *eckey); +EC_KEY *d2i_ECPrivateKey_bio(BIO *bp, EC_KEY **eckey); +int i2d_ECPrivateKey_bio(BIO *bp, EC_KEY *eckey); +# endif +X509_SIG *d2i_PKCS8_bio(BIO *bp, X509_SIG **p8); +int i2d_PKCS8_bio(BIO *bp, X509_SIG *p8); +PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_bio(BIO *bp, + PKCS8_PRIV_KEY_INFO **p8inf); +int i2d_PKCS8_PRIV_KEY_INFO_bio(BIO *bp, PKCS8_PRIV_KEY_INFO *p8inf); +int i2d_PKCS8PrivateKeyInfo_bio(BIO *bp, EVP_PKEY *key); +int i2d_PrivateKey_bio(BIO *bp, EVP_PKEY *pkey); +EVP_PKEY *d2i_PrivateKey_bio(BIO *bp, EVP_PKEY **a); +int i2d_PUBKEY_bio(BIO *bp, EVP_PKEY *pkey); +EVP_PKEY *d2i_PUBKEY_bio(BIO *bp, EVP_PKEY **a); + +X509 *X509_dup(X509 *x509); +X509_ATTRIBUTE *X509_ATTRIBUTE_dup(X509_ATTRIBUTE *xa); +X509_EXTENSION *X509_EXTENSION_dup(X509_EXTENSION *ex); +X509_CRL *X509_CRL_dup(X509_CRL *crl); +X509_REVOKED *X509_REVOKED_dup(X509_REVOKED *rev); +X509_REQ *X509_REQ_dup(X509_REQ *req); +X509_ALGOR *X509_ALGOR_dup(X509_ALGOR *xn); +int X509_ALGOR_set0(X509_ALGOR *alg, ASN1_OBJECT *aobj, int ptype, + void *pval); +void X509_ALGOR_get0(const ASN1_OBJECT **paobj, int *pptype, + const void **ppval, const X509_ALGOR *algor); +void X509_ALGOR_set_md(X509_ALGOR *alg, const EVP_MD *md); +int X509_ALGOR_cmp(const X509_ALGOR *a, const X509_ALGOR *b); + +X509_NAME *X509_NAME_dup(X509_NAME *xn); +X509_NAME_ENTRY *X509_NAME_ENTRY_dup(X509_NAME_ENTRY *ne); + +int X509_cmp_time(const ASN1_TIME *s, time_t *t); +int X509_cmp_current_time(const ASN1_TIME *s); +ASN1_TIME *X509_time_adj(ASN1_TIME *s, long adj, time_t *t); +ASN1_TIME *X509_time_adj_ex(ASN1_TIME *s, + int offset_day, long offset_sec, time_t *t); +ASN1_TIME *X509_gmtime_adj(ASN1_TIME *s, long adj); + +const char *X509_get_default_cert_area(void); +const char *X509_get_default_cert_dir(void); +const char *X509_get_default_cert_file(void); +const char *X509_get_default_cert_dir_env(void); +const char *X509_get_default_cert_file_env(void); +const char *X509_get_default_private_dir(void); + +X509_REQ *X509_to_X509_REQ(X509 *x, EVP_PKEY *pkey, const EVP_MD *md); +X509 *X509_REQ_to_X509(X509_REQ *r, int days, EVP_PKEY *pkey); + +DECLARE_ASN1_FUNCTIONS(X509_ALGOR) +DECLARE_ASN1_ENCODE_FUNCTIONS(X509_ALGORS, X509_ALGORS, X509_ALGORS) +DECLARE_ASN1_FUNCTIONS(X509_VAL) + +DECLARE_ASN1_FUNCTIONS(X509_PUBKEY) + +int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey); +EVP_PKEY *X509_PUBKEY_get0(X509_PUBKEY *key); +EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key); +int X509_get_pubkey_parameters(EVP_PKEY *pkey, STACK_OF(X509) *chain); +long X509_get_pathlen(X509 *x); +int i2d_PUBKEY(EVP_PKEY *a, unsigned char **pp); +EVP_PKEY *d2i_PUBKEY(EVP_PKEY **a, const unsigned char **pp, long length); +# ifndef OPENSSL_NO_RSA +int i2d_RSA_PUBKEY(RSA *a, unsigned char **pp); +RSA *d2i_RSA_PUBKEY(RSA **a, const unsigned char **pp, long length); +# endif +# ifndef OPENSSL_NO_DSA +int i2d_DSA_PUBKEY(DSA *a, unsigned char **pp); +DSA *d2i_DSA_PUBKEY(DSA **a, const unsigned char **pp, long length); +# endif +# ifndef OPENSSL_NO_EC +int i2d_EC_PUBKEY(EC_KEY *a, unsigned char **pp); +EC_KEY *d2i_EC_PUBKEY(EC_KEY **a, const unsigned char **pp, long length); +# endif + +DECLARE_ASN1_FUNCTIONS(X509_SIG) +void X509_SIG_get0(const X509_SIG *sig, const X509_ALGOR **palg, + const ASN1_OCTET_STRING **pdigest); +void X509_SIG_getm(X509_SIG *sig, X509_ALGOR **palg, + ASN1_OCTET_STRING **pdigest); + +DECLARE_ASN1_FUNCTIONS(X509_REQ_INFO) +DECLARE_ASN1_FUNCTIONS(X509_REQ) + +DECLARE_ASN1_FUNCTIONS(X509_ATTRIBUTE) +X509_ATTRIBUTE *X509_ATTRIBUTE_create(int nid, int atrtype, void *value); + +DECLARE_ASN1_FUNCTIONS(X509_EXTENSION) +DECLARE_ASN1_ENCODE_FUNCTIONS(X509_EXTENSIONS, X509_EXTENSIONS, X509_EXTENSIONS) + +DECLARE_ASN1_FUNCTIONS(X509_NAME_ENTRY) + +DECLARE_ASN1_FUNCTIONS(X509_NAME) + +int X509_NAME_set(X509_NAME **xn, X509_NAME *name); + +DECLARE_ASN1_FUNCTIONS(X509_CINF) + +DECLARE_ASN1_FUNCTIONS(X509) +DECLARE_ASN1_FUNCTIONS(X509_CERT_AUX) + +#define X509_get_ex_new_index(l, p, newf, dupf, freef) \ + CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_X509, l, p, newf, dupf, freef) +int X509_set_ex_data(X509 *r, int idx, void *arg); +void *X509_get_ex_data(X509 *r, int idx); +int i2d_X509_AUX(X509 *a, unsigned char **pp); +X509 *d2i_X509_AUX(X509 **a, const unsigned char **pp, long length); + +int i2d_re_X509_tbs(X509 *x, unsigned char **pp); + +int X509_SIG_INFO_get(const X509_SIG_INFO *siginf, int *mdnid, int *pknid, + int *secbits, uint32_t *flags); +void X509_SIG_INFO_set(X509_SIG_INFO *siginf, int mdnid, int pknid, + int secbits, uint32_t flags); + +int X509_get_signature_info(X509 *x, int *mdnid, int *pknid, int *secbits, + uint32_t *flags); + +void X509_get0_signature(const ASN1_BIT_STRING **psig, + const X509_ALGOR **palg, const X509 *x); +int X509_get_signature_nid(const X509 *x); + +int X509_trusted(const X509 *x); +int X509_alias_set1(X509 *x, const unsigned char *name, int len); +int X509_keyid_set1(X509 *x, const unsigned char *id, int len); +unsigned char *X509_alias_get0(X509 *x, int *len); +unsigned char *X509_keyid_get0(X509 *x, int *len); +int (*X509_TRUST_set_default(int (*trust) (int, X509 *, int))) (int, X509 *, + int); +int X509_TRUST_set(int *t, int trust); +int X509_add1_trust_object(X509 *x, const ASN1_OBJECT *obj); +int X509_add1_reject_object(X509 *x, const ASN1_OBJECT *obj); +void X509_trust_clear(X509 *x); +void X509_reject_clear(X509 *x); + +STACK_OF(ASN1_OBJECT) *X509_get0_trust_objects(X509 *x); +STACK_OF(ASN1_OBJECT) *X509_get0_reject_objects(X509 *x); + +DECLARE_ASN1_FUNCTIONS(X509_REVOKED) +DECLARE_ASN1_FUNCTIONS(X509_CRL_INFO) +DECLARE_ASN1_FUNCTIONS(X509_CRL) + +int X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev); +int X509_CRL_get0_by_serial(X509_CRL *crl, + X509_REVOKED **ret, ASN1_INTEGER *serial); +int X509_CRL_get0_by_cert(X509_CRL *crl, X509_REVOKED **ret, X509 *x); + +X509_PKEY *X509_PKEY_new(void); +void X509_PKEY_free(X509_PKEY *a); + +DECLARE_ASN1_FUNCTIONS(NETSCAPE_SPKI) +DECLARE_ASN1_FUNCTIONS(NETSCAPE_SPKAC) +DECLARE_ASN1_FUNCTIONS(NETSCAPE_CERT_SEQUENCE) + +X509_INFO *X509_INFO_new(void); +void X509_INFO_free(X509_INFO *a); +char *X509_NAME_oneline(const X509_NAME *a, char *buf, int size); + +int ASN1_verify(i2d_of_void *i2d, X509_ALGOR *algor1, + ASN1_BIT_STRING *signature, char *data, EVP_PKEY *pkey); + +int ASN1_digest(i2d_of_void *i2d, const EVP_MD *type, char *data, + unsigned char *md, unsigned int *len); + +int ASN1_sign(i2d_of_void *i2d, X509_ALGOR *algor1, + X509_ALGOR *algor2, ASN1_BIT_STRING *signature, + char *data, EVP_PKEY *pkey, const EVP_MD *type); + +int ASN1_item_digest(const ASN1_ITEM *it, const EVP_MD *type, void *data, + unsigned char *md, unsigned int *len); + +int ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *algor1, + ASN1_BIT_STRING *signature, void *data, EVP_PKEY *pkey); + +int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, + X509_ALGOR *algor2, ASN1_BIT_STRING *signature, void *data, + EVP_PKEY *pkey, const EVP_MD *type); +int ASN1_item_sign_ctx(const ASN1_ITEM *it, X509_ALGOR *algor1, + X509_ALGOR *algor2, ASN1_BIT_STRING *signature, + void *asn, EVP_MD_CTX *ctx); + +long X509_get_version(const X509 *x); +int X509_set_version(X509 *x, long version); +int X509_set_serialNumber(X509 *x, ASN1_INTEGER *serial); +ASN1_INTEGER *X509_get_serialNumber(X509 *x); +const ASN1_INTEGER *X509_get0_serialNumber(const X509 *x); +int X509_set_issuer_name(X509 *x, X509_NAME *name); +X509_NAME *X509_get_issuer_name(const X509 *a); +int X509_set_subject_name(X509 *x, X509_NAME *name); +X509_NAME *X509_get_subject_name(const X509 *a); +const ASN1_TIME * X509_get0_notBefore(const X509 *x); +ASN1_TIME *X509_getm_notBefore(const X509 *x); +int X509_set1_notBefore(X509 *x, const ASN1_TIME *tm); +const ASN1_TIME *X509_get0_notAfter(const X509 *x); +ASN1_TIME *X509_getm_notAfter(const X509 *x); +int X509_set1_notAfter(X509 *x, const ASN1_TIME *tm); +int X509_set_pubkey(X509 *x, EVP_PKEY *pkey); +int X509_up_ref(X509 *x); +int X509_get_signature_type(const X509 *x); + +# if OPENSSL_API_COMPAT < 0x10100000L +# define X509_get_notBefore X509_getm_notBefore +# define X509_get_notAfter X509_getm_notAfter +# define X509_set_notBefore X509_set1_notBefore +# define X509_set_notAfter X509_set1_notAfter +#endif + + +/* + * This one is only used so that a binary form can output, as in + * i2d_X509_PUBKEY(X509_get_X509_PUBKEY(x), &buf) + */ +X509_PUBKEY *X509_get_X509_PUBKEY(const X509 *x); +const STACK_OF(X509_EXTENSION) *X509_get0_extensions(const X509 *x); +void X509_get0_uids(const X509 *x, const ASN1_BIT_STRING **piuid, + const ASN1_BIT_STRING **psuid); +const X509_ALGOR *X509_get0_tbs_sigalg(const X509 *x); + +EVP_PKEY *X509_get0_pubkey(const X509 *x); +EVP_PKEY *X509_get_pubkey(X509 *x); +ASN1_BIT_STRING *X509_get0_pubkey_bitstr(const X509 *x); +int X509_certificate_type(const X509 *x, const EVP_PKEY *pubkey); + +long X509_REQ_get_version(const X509_REQ *req); +int X509_REQ_set_version(X509_REQ *x, long version); +X509_NAME *X509_REQ_get_subject_name(const X509_REQ *req); +int X509_REQ_set_subject_name(X509_REQ *req, X509_NAME *name); +void X509_REQ_get0_signature(const X509_REQ *req, const ASN1_BIT_STRING **psig, + const X509_ALGOR **palg); +int X509_REQ_get_signature_nid(const X509_REQ *req); +int i2d_re_X509_REQ_tbs(X509_REQ *req, unsigned char **pp); +int X509_REQ_set_pubkey(X509_REQ *x, EVP_PKEY *pkey); +EVP_PKEY *X509_REQ_get_pubkey(X509_REQ *req); +EVP_PKEY *X509_REQ_get0_pubkey(X509_REQ *req); +X509_PUBKEY *X509_REQ_get_X509_PUBKEY(X509_REQ *req); +int X509_REQ_extension_nid(int nid); +int *X509_REQ_get_extension_nids(void); +void X509_REQ_set_extension_nids(int *nids); +STACK_OF(X509_EXTENSION) *X509_REQ_get_extensions(X509_REQ *req); +int X509_REQ_add_extensions_nid(X509_REQ *req, STACK_OF(X509_EXTENSION) *exts, + int nid); +int X509_REQ_add_extensions(X509_REQ *req, STACK_OF(X509_EXTENSION) *exts); +int X509_REQ_get_attr_count(const X509_REQ *req); +int X509_REQ_get_attr_by_NID(const X509_REQ *req, int nid, int lastpos); +int X509_REQ_get_attr_by_OBJ(const X509_REQ *req, const ASN1_OBJECT *obj, + int lastpos); +X509_ATTRIBUTE *X509_REQ_get_attr(const X509_REQ *req, int loc); +X509_ATTRIBUTE *X509_REQ_delete_attr(X509_REQ *req, int loc); +int X509_REQ_add1_attr(X509_REQ *req, X509_ATTRIBUTE *attr); +int X509_REQ_add1_attr_by_OBJ(X509_REQ *req, + const ASN1_OBJECT *obj, int type, + const unsigned char *bytes, int len); +int X509_REQ_add1_attr_by_NID(X509_REQ *req, + int nid, int type, + const unsigned char *bytes, int len); +int X509_REQ_add1_attr_by_txt(X509_REQ *req, + const char *attrname, int type, + const unsigned char *bytes, int len); + +int X509_CRL_set_version(X509_CRL *x, long version); +int X509_CRL_set_issuer_name(X509_CRL *x, X509_NAME *name); +int X509_CRL_set1_lastUpdate(X509_CRL *x, const ASN1_TIME *tm); +int X509_CRL_set1_nextUpdate(X509_CRL *x, const ASN1_TIME *tm); +int X509_CRL_sort(X509_CRL *crl); +int X509_CRL_up_ref(X509_CRL *crl); + +# if OPENSSL_API_COMPAT < 0x10100000L +# define X509_CRL_set_lastUpdate X509_CRL_set1_lastUpdate +# define X509_CRL_set_nextUpdate X509_CRL_set1_nextUpdate +#endif + +long X509_CRL_get_version(const X509_CRL *crl); +const ASN1_TIME *X509_CRL_get0_lastUpdate(const X509_CRL *crl); +const ASN1_TIME *X509_CRL_get0_nextUpdate(const X509_CRL *crl); +DEPRECATEDIN_1_1_0(ASN1_TIME *X509_CRL_get_lastUpdate(X509_CRL *crl)) +DEPRECATEDIN_1_1_0(ASN1_TIME *X509_CRL_get_nextUpdate(X509_CRL *crl)) +X509_NAME *X509_CRL_get_issuer(const X509_CRL *crl); +const STACK_OF(X509_EXTENSION) *X509_CRL_get0_extensions(const X509_CRL *crl); +STACK_OF(X509_REVOKED) *X509_CRL_get_REVOKED(X509_CRL *crl); +void X509_CRL_get0_signature(const X509_CRL *crl, const ASN1_BIT_STRING **psig, + const X509_ALGOR **palg); +int X509_CRL_get_signature_nid(const X509_CRL *crl); +int i2d_re_X509_CRL_tbs(X509_CRL *req, unsigned char **pp); + +const ASN1_INTEGER *X509_REVOKED_get0_serialNumber(const X509_REVOKED *x); +int X509_REVOKED_set_serialNumber(X509_REVOKED *x, ASN1_INTEGER *serial); +const ASN1_TIME *X509_REVOKED_get0_revocationDate(const X509_REVOKED *x); +int X509_REVOKED_set_revocationDate(X509_REVOKED *r, ASN1_TIME *tm); +const STACK_OF(X509_EXTENSION) * +X509_REVOKED_get0_extensions(const X509_REVOKED *r); + +X509_CRL *X509_CRL_diff(X509_CRL *base, X509_CRL *newer, + EVP_PKEY *skey, const EVP_MD *md, unsigned int flags); + +int X509_REQ_check_private_key(X509_REQ *x509, EVP_PKEY *pkey); + +int X509_check_private_key(const X509 *x509, const EVP_PKEY *pkey); +int X509_chain_check_suiteb(int *perror_depth, + X509 *x, STACK_OF(X509) *chain, + unsigned long flags); +int X509_CRL_check_suiteb(X509_CRL *crl, EVP_PKEY *pk, unsigned long flags); +STACK_OF(X509) *X509_chain_up_ref(STACK_OF(X509) *chain); + +int X509_issuer_and_serial_cmp(const X509 *a, const X509 *b); +unsigned long X509_issuer_and_serial_hash(X509 *a); + +int X509_issuer_name_cmp(const X509 *a, const X509 *b); +unsigned long X509_issuer_name_hash(X509 *a); + +int X509_subject_name_cmp(const X509 *a, const X509 *b); +unsigned long X509_subject_name_hash(X509 *x); + +# ifndef OPENSSL_NO_MD5 +unsigned long X509_issuer_name_hash_old(X509 *a); +unsigned long X509_subject_name_hash_old(X509 *x); +# endif + +int X509_cmp(const X509 *a, const X509 *b); +int X509_NAME_cmp(const X509_NAME *a, const X509_NAME *b); +unsigned long X509_NAME_hash(X509_NAME *x); +unsigned long X509_NAME_hash_old(X509_NAME *x); + +int X509_CRL_cmp(const X509_CRL *a, const X509_CRL *b); +int X509_CRL_match(const X509_CRL *a, const X509_CRL *b); +int X509_aux_print(BIO *out, X509 *x, int indent); +# ifndef OPENSSL_NO_STDIO +int X509_print_ex_fp(FILE *bp, X509 *x, unsigned long nmflag, + unsigned long cflag); +int X509_print_fp(FILE *bp, X509 *x); +int X509_CRL_print_fp(FILE *bp, X509_CRL *x); +int X509_REQ_print_fp(FILE *bp, X509_REQ *req); +int X509_NAME_print_ex_fp(FILE *fp, const X509_NAME *nm, int indent, + unsigned long flags); +# endif + +int X509_NAME_print(BIO *bp, const X509_NAME *name, int obase); +int X509_NAME_print_ex(BIO *out, const X509_NAME *nm, int indent, + unsigned long flags); +int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflag, + unsigned long cflag); +int X509_print(BIO *bp, X509 *x); +int X509_ocspid_print(BIO *bp, X509 *x); +int X509_CRL_print_ex(BIO *out, X509_CRL *x, unsigned long nmflag); +int X509_CRL_print(BIO *bp, X509_CRL *x); +int X509_REQ_print_ex(BIO *bp, X509_REQ *x, unsigned long nmflag, + unsigned long cflag); +int X509_REQ_print(BIO *bp, X509_REQ *req); + +int X509_NAME_entry_count(const X509_NAME *name); +int X509_NAME_get_text_by_NID(X509_NAME *name, int nid, char *buf, int len); +int X509_NAME_get_text_by_OBJ(X509_NAME *name, const ASN1_OBJECT *obj, + char *buf, int len); + +/* + * NOTE: you should be passing -1, not 0 as lastpos. The functions that use + * lastpos, search after that position on. + */ +int X509_NAME_get_index_by_NID(X509_NAME *name, int nid, int lastpos); +int X509_NAME_get_index_by_OBJ(X509_NAME *name, const ASN1_OBJECT *obj, + int lastpos); +X509_NAME_ENTRY *X509_NAME_get_entry(const X509_NAME *name, int loc); +X509_NAME_ENTRY *X509_NAME_delete_entry(X509_NAME *name, int loc); +int X509_NAME_add_entry(X509_NAME *name, const X509_NAME_ENTRY *ne, + int loc, int set); +int X509_NAME_add_entry_by_OBJ(X509_NAME *name, const ASN1_OBJECT *obj, int type, + const unsigned char *bytes, int len, int loc, + int set); +int X509_NAME_add_entry_by_NID(X509_NAME *name, int nid, int type, + const unsigned char *bytes, int len, int loc, + int set); +X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_txt(X509_NAME_ENTRY **ne, + const char *field, int type, + const unsigned char *bytes, + int len); +X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_NID(X509_NAME_ENTRY **ne, int nid, + int type, + const unsigned char *bytes, + int len); +int X509_NAME_add_entry_by_txt(X509_NAME *name, const char *field, int type, + const unsigned char *bytes, int len, int loc, + int set); +X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_OBJ(X509_NAME_ENTRY **ne, + const ASN1_OBJECT *obj, int type, + const unsigned char *bytes, + int len); +int X509_NAME_ENTRY_set_object(X509_NAME_ENTRY *ne, const ASN1_OBJECT *obj); +int X509_NAME_ENTRY_set_data(X509_NAME_ENTRY *ne, int type, + const unsigned char *bytes, int len); +ASN1_OBJECT *X509_NAME_ENTRY_get_object(const X509_NAME_ENTRY *ne); +ASN1_STRING * X509_NAME_ENTRY_get_data(const X509_NAME_ENTRY *ne); +int X509_NAME_ENTRY_set(const X509_NAME_ENTRY *ne); + +int X509_NAME_get0_der(X509_NAME *nm, const unsigned char **pder, + size_t *pderlen); + +int X509v3_get_ext_count(const STACK_OF(X509_EXTENSION) *x); +int X509v3_get_ext_by_NID(const STACK_OF(X509_EXTENSION) *x, + int nid, int lastpos); +int X509v3_get_ext_by_OBJ(const STACK_OF(X509_EXTENSION) *x, + const ASN1_OBJECT *obj, int lastpos); +int X509v3_get_ext_by_critical(const STACK_OF(X509_EXTENSION) *x, + int crit, int lastpos); +X509_EXTENSION *X509v3_get_ext(const STACK_OF(X509_EXTENSION) *x, int loc); +X509_EXTENSION *X509v3_delete_ext(STACK_OF(X509_EXTENSION) *x, int loc); +STACK_OF(X509_EXTENSION) *X509v3_add_ext(STACK_OF(X509_EXTENSION) **x, + X509_EXTENSION *ex, int loc); + +int X509_get_ext_count(const X509 *x); +int X509_get_ext_by_NID(const X509 *x, int nid, int lastpos); +int X509_get_ext_by_OBJ(const X509 *x, const ASN1_OBJECT *obj, int lastpos); +int X509_get_ext_by_critical(const X509 *x, int crit, int lastpos); +X509_EXTENSION *X509_get_ext(const X509 *x, int loc); +X509_EXTENSION *X509_delete_ext(X509 *x, int loc); +int X509_add_ext(X509 *x, X509_EXTENSION *ex, int loc); +void *X509_get_ext_d2i(const X509 *x, int nid, int *crit, int *idx); +int X509_add1_ext_i2d(X509 *x, int nid, void *value, int crit, + unsigned long flags); + +int X509_CRL_get_ext_count(const X509_CRL *x); +int X509_CRL_get_ext_by_NID(const X509_CRL *x, int nid, int lastpos); +int X509_CRL_get_ext_by_OBJ(const X509_CRL *x, const ASN1_OBJECT *obj, + int lastpos); +int X509_CRL_get_ext_by_critical(const X509_CRL *x, int crit, int lastpos); +X509_EXTENSION *X509_CRL_get_ext(const X509_CRL *x, int loc); +X509_EXTENSION *X509_CRL_delete_ext(X509_CRL *x, int loc); +int X509_CRL_add_ext(X509_CRL *x, X509_EXTENSION *ex, int loc); +void *X509_CRL_get_ext_d2i(const X509_CRL *x, int nid, int *crit, int *idx); +int X509_CRL_add1_ext_i2d(X509_CRL *x, int nid, void *value, int crit, + unsigned long flags); + +int X509_REVOKED_get_ext_count(const X509_REVOKED *x); +int X509_REVOKED_get_ext_by_NID(const X509_REVOKED *x, int nid, int lastpos); +int X509_REVOKED_get_ext_by_OBJ(const X509_REVOKED *x, const ASN1_OBJECT *obj, + int lastpos); +int X509_REVOKED_get_ext_by_critical(const X509_REVOKED *x, int crit, + int lastpos); +X509_EXTENSION *X509_REVOKED_get_ext(const X509_REVOKED *x, int loc); +X509_EXTENSION *X509_REVOKED_delete_ext(X509_REVOKED *x, int loc); +int X509_REVOKED_add_ext(X509_REVOKED *x, X509_EXTENSION *ex, int loc); +void *X509_REVOKED_get_ext_d2i(const X509_REVOKED *x, int nid, int *crit, + int *idx); +int X509_REVOKED_add1_ext_i2d(X509_REVOKED *x, int nid, void *value, int crit, + unsigned long flags); + +X509_EXTENSION *X509_EXTENSION_create_by_NID(X509_EXTENSION **ex, + int nid, int crit, + ASN1_OCTET_STRING *data); +X509_EXTENSION *X509_EXTENSION_create_by_OBJ(X509_EXTENSION **ex, + const ASN1_OBJECT *obj, int crit, + ASN1_OCTET_STRING *data); +int X509_EXTENSION_set_object(X509_EXTENSION *ex, const ASN1_OBJECT *obj); +int X509_EXTENSION_set_critical(X509_EXTENSION *ex, int crit); +int X509_EXTENSION_set_data(X509_EXTENSION *ex, ASN1_OCTET_STRING *data); +ASN1_OBJECT *X509_EXTENSION_get_object(X509_EXTENSION *ex); +ASN1_OCTET_STRING *X509_EXTENSION_get_data(X509_EXTENSION *ne); +int X509_EXTENSION_get_critical(const X509_EXTENSION *ex); + +int X509at_get_attr_count(const STACK_OF(X509_ATTRIBUTE) *x); +int X509at_get_attr_by_NID(const STACK_OF(X509_ATTRIBUTE) *x, int nid, + int lastpos); +int X509at_get_attr_by_OBJ(const STACK_OF(X509_ATTRIBUTE) *sk, + const ASN1_OBJECT *obj, int lastpos); +X509_ATTRIBUTE *X509at_get_attr(const STACK_OF(X509_ATTRIBUTE) *x, int loc); +X509_ATTRIBUTE *X509at_delete_attr(STACK_OF(X509_ATTRIBUTE) *x, int loc); +STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr(STACK_OF(X509_ATTRIBUTE) **x, + X509_ATTRIBUTE *attr); +STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_OBJ(STACK_OF(X509_ATTRIBUTE) + **x, const ASN1_OBJECT *obj, + int type, + const unsigned char *bytes, + int len); +STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_NID(STACK_OF(X509_ATTRIBUTE) + **x, int nid, int type, + const unsigned char *bytes, + int len); +STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_txt(STACK_OF(X509_ATTRIBUTE) + **x, const char *attrname, + int type, + const unsigned char *bytes, + int len); +void *X509at_get0_data_by_OBJ(STACK_OF(X509_ATTRIBUTE) *x, + const ASN1_OBJECT *obj, int lastpos, int type); +X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_NID(X509_ATTRIBUTE **attr, int nid, + int atrtype, const void *data, + int len); +X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_OBJ(X509_ATTRIBUTE **attr, + const ASN1_OBJECT *obj, + int atrtype, const void *data, + int len); +X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_txt(X509_ATTRIBUTE **attr, + const char *atrname, int type, + const unsigned char *bytes, + int len); +int X509_ATTRIBUTE_set1_object(X509_ATTRIBUTE *attr, const ASN1_OBJECT *obj); +int X509_ATTRIBUTE_set1_data(X509_ATTRIBUTE *attr, int attrtype, + const void *data, int len); +void *X509_ATTRIBUTE_get0_data(X509_ATTRIBUTE *attr, int idx, int atrtype, + void *data); +int X509_ATTRIBUTE_count(const X509_ATTRIBUTE *attr); +ASN1_OBJECT *X509_ATTRIBUTE_get0_object(X509_ATTRIBUTE *attr); +ASN1_TYPE *X509_ATTRIBUTE_get0_type(X509_ATTRIBUTE *attr, int idx); + +int EVP_PKEY_get_attr_count(const EVP_PKEY *key); +int EVP_PKEY_get_attr_by_NID(const EVP_PKEY *key, int nid, int lastpos); +int EVP_PKEY_get_attr_by_OBJ(const EVP_PKEY *key, const ASN1_OBJECT *obj, + int lastpos); +X509_ATTRIBUTE *EVP_PKEY_get_attr(const EVP_PKEY *key, int loc); +X509_ATTRIBUTE *EVP_PKEY_delete_attr(EVP_PKEY *key, int loc); +int EVP_PKEY_add1_attr(EVP_PKEY *key, X509_ATTRIBUTE *attr); +int EVP_PKEY_add1_attr_by_OBJ(EVP_PKEY *key, + const ASN1_OBJECT *obj, int type, + const unsigned char *bytes, int len); +int EVP_PKEY_add1_attr_by_NID(EVP_PKEY *key, + int nid, int type, + const unsigned char *bytes, int len); +int EVP_PKEY_add1_attr_by_txt(EVP_PKEY *key, + const char *attrname, int type, + const unsigned char *bytes, int len); + +int X509_verify_cert(X509_STORE_CTX *ctx); + +/* lookup a cert from a X509 STACK */ +X509 *X509_find_by_issuer_and_serial(STACK_OF(X509) *sk, X509_NAME *name, + ASN1_INTEGER *serial); +X509 *X509_find_by_subject(STACK_OF(X509) *sk, X509_NAME *name); + +DECLARE_ASN1_FUNCTIONS(PBEPARAM) +DECLARE_ASN1_FUNCTIONS(PBE2PARAM) +DECLARE_ASN1_FUNCTIONS(PBKDF2PARAM) +#ifndef OPENSSL_NO_SCRYPT +DECLARE_ASN1_FUNCTIONS(SCRYPT_PARAMS) +#endif + +int PKCS5_pbe_set0_algor(X509_ALGOR *algor, int alg, int iter, + const unsigned char *salt, int saltlen); + +X509_ALGOR *PKCS5_pbe_set(int alg, int iter, + const unsigned char *salt, int saltlen); +X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter, + unsigned char *salt, int saltlen); +X509_ALGOR *PKCS5_pbe2_set_iv(const EVP_CIPHER *cipher, int iter, + unsigned char *salt, int saltlen, + unsigned char *aiv, int prf_nid); + +#ifndef OPENSSL_NO_SCRYPT +X509_ALGOR *PKCS5_pbe2_set_scrypt(const EVP_CIPHER *cipher, + const unsigned char *salt, int saltlen, + unsigned char *aiv, uint64_t N, uint64_t r, + uint64_t p); +#endif + +X509_ALGOR *PKCS5_pbkdf2_set(int iter, unsigned char *salt, int saltlen, + int prf_nid, int keylen); + +/* PKCS#8 utilities */ + +DECLARE_ASN1_FUNCTIONS(PKCS8_PRIV_KEY_INFO) + +EVP_PKEY *EVP_PKCS82PKEY(const PKCS8_PRIV_KEY_INFO *p8); +PKCS8_PRIV_KEY_INFO *EVP_PKEY2PKCS8(EVP_PKEY *pkey); + +int PKCS8_pkey_set0(PKCS8_PRIV_KEY_INFO *priv, ASN1_OBJECT *aobj, + int version, int ptype, void *pval, + unsigned char *penc, int penclen); +int PKCS8_pkey_get0(const ASN1_OBJECT **ppkalg, + const unsigned char **pk, int *ppklen, + const X509_ALGOR **pa, const PKCS8_PRIV_KEY_INFO *p8); + +const STACK_OF(X509_ATTRIBUTE) * +PKCS8_pkey_get0_attrs(const PKCS8_PRIV_KEY_INFO *p8); +int PKCS8_pkey_add1_attr_by_NID(PKCS8_PRIV_KEY_INFO *p8, int nid, int type, + const unsigned char *bytes, int len); + +int X509_PUBKEY_set0_param(X509_PUBKEY *pub, ASN1_OBJECT *aobj, + int ptype, void *pval, + unsigned char *penc, int penclen); +int X509_PUBKEY_get0_param(ASN1_OBJECT **ppkalg, + const unsigned char **pk, int *ppklen, + X509_ALGOR **pa, X509_PUBKEY *pub); + +int X509_check_trust(X509 *x, int id, int flags); +int X509_TRUST_get_count(void); +X509_TRUST *X509_TRUST_get0(int idx); +int X509_TRUST_get_by_id(int id); +int X509_TRUST_add(int id, int flags, int (*ck) (X509_TRUST *, X509 *, int), + const char *name, int arg1, void *arg2); +void X509_TRUST_cleanup(void); +int X509_TRUST_get_flags(const X509_TRUST *xp); +char *X509_TRUST_get0_name(const X509_TRUST *xp); +int X509_TRUST_get_trust(const X509_TRUST *xp); + +# ifdef __cplusplus +} +# endif +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/x509_vfy.h b/MediaClient/MediaClient/openssl/include/openssl/x509_vfy.h new file mode 100644 index 0000000..adb8bce --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/x509_vfy.h @@ -0,0 +1,628 @@ +/* + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_X509_VFY_H +# define HEADER_X509_VFY_H + +/* + * Protect against recursion, x509.h and x509_vfy.h each include the other. + */ +# ifndef HEADER_X509_H +# include +# endif + +# include +# include +# include +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + +/*- +SSL_CTX -> X509_STORE + -> X509_LOOKUP + ->X509_LOOKUP_METHOD + -> X509_LOOKUP + ->X509_LOOKUP_METHOD + +SSL -> X509_STORE_CTX + ->X509_STORE + +The X509_STORE holds the tables etc for verification stuff. +A X509_STORE_CTX is used while validating a single certificate. +The X509_STORE has X509_LOOKUPs for looking up certs. +The X509_STORE then calls a function to actually verify the +certificate chain. +*/ + +typedef enum { + X509_LU_NONE = 0, + X509_LU_X509, X509_LU_CRL +} X509_LOOKUP_TYPE; + +#if OPENSSL_API_COMPAT < 0x10100000L +#define X509_LU_RETRY -1 +#define X509_LU_FAIL 0 +#endif + +DEFINE_STACK_OF(X509_LOOKUP) +DEFINE_STACK_OF(X509_OBJECT) +DEFINE_STACK_OF(X509_VERIFY_PARAM) + +int X509_STORE_set_depth(X509_STORE *store, int depth); + +typedef int (*X509_STORE_CTX_verify_cb)(int, X509_STORE_CTX *); +typedef int (*X509_STORE_CTX_verify_fn)(X509_STORE_CTX *); +typedef int (*X509_STORE_CTX_get_issuer_fn)(X509 **issuer, + X509_STORE_CTX *ctx, X509 *x); +typedef int (*X509_STORE_CTX_check_issued_fn)(X509_STORE_CTX *ctx, + X509 *x, X509 *issuer); +typedef int (*X509_STORE_CTX_check_revocation_fn)(X509_STORE_CTX *ctx); +typedef int (*X509_STORE_CTX_get_crl_fn)(X509_STORE_CTX *ctx, + X509_CRL **crl, X509 *x); +typedef int (*X509_STORE_CTX_check_crl_fn)(X509_STORE_CTX *ctx, X509_CRL *crl); +typedef int (*X509_STORE_CTX_cert_crl_fn)(X509_STORE_CTX *ctx, + X509_CRL *crl, X509 *x); +typedef int (*X509_STORE_CTX_check_policy_fn)(X509_STORE_CTX *ctx); +typedef STACK_OF(X509) *(*X509_STORE_CTX_lookup_certs_fn)(X509_STORE_CTX *ctx, + X509_NAME *nm); +typedef STACK_OF(X509_CRL) *(*X509_STORE_CTX_lookup_crls_fn)(X509_STORE_CTX *ctx, + X509_NAME *nm); +typedef int (*X509_STORE_CTX_cleanup_fn)(X509_STORE_CTX *ctx); + + +void X509_STORE_CTX_set_depth(X509_STORE_CTX *ctx, int depth); + +# define X509_STORE_CTX_set_app_data(ctx,data) \ + X509_STORE_CTX_set_ex_data(ctx,0,data) +# define X509_STORE_CTX_get_app_data(ctx) \ + X509_STORE_CTX_get_ex_data(ctx,0) + +# define X509_L_FILE_LOAD 1 +# define X509_L_ADD_DIR 2 + +# define X509_LOOKUP_load_file(x,name,type) \ + X509_LOOKUP_ctrl((x),X509_L_FILE_LOAD,(name),(long)(type),NULL) + +# define X509_LOOKUP_add_dir(x,name,type) \ + X509_LOOKUP_ctrl((x),X509_L_ADD_DIR,(name),(long)(type),NULL) + +# define X509_V_OK 0 +# define X509_V_ERR_UNSPECIFIED 1 +# define X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT 2 +# define X509_V_ERR_UNABLE_TO_GET_CRL 3 +# define X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE 4 +# define X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE 5 +# define X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY 6 +# define X509_V_ERR_CERT_SIGNATURE_FAILURE 7 +# define X509_V_ERR_CRL_SIGNATURE_FAILURE 8 +# define X509_V_ERR_CERT_NOT_YET_VALID 9 +# define X509_V_ERR_CERT_HAS_EXPIRED 10 +# define X509_V_ERR_CRL_NOT_YET_VALID 11 +# define X509_V_ERR_CRL_HAS_EXPIRED 12 +# define X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD 13 +# define X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD 14 +# define X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD 15 +# define X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD 16 +# define X509_V_ERR_OUT_OF_MEM 17 +# define X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT 18 +# define X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN 19 +# define X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY 20 +# define X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE 21 +# define X509_V_ERR_CERT_CHAIN_TOO_LONG 22 +# define X509_V_ERR_CERT_REVOKED 23 +# define X509_V_ERR_INVALID_CA 24 +# define X509_V_ERR_PATH_LENGTH_EXCEEDED 25 +# define X509_V_ERR_INVALID_PURPOSE 26 +# define X509_V_ERR_CERT_UNTRUSTED 27 +# define X509_V_ERR_CERT_REJECTED 28 +/* These are 'informational' when looking for issuer cert */ +# define X509_V_ERR_SUBJECT_ISSUER_MISMATCH 29 +# define X509_V_ERR_AKID_SKID_MISMATCH 30 +# define X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH 31 +# define X509_V_ERR_KEYUSAGE_NO_CERTSIGN 32 +# define X509_V_ERR_UNABLE_TO_GET_CRL_ISSUER 33 +# define X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION 34 +# define X509_V_ERR_KEYUSAGE_NO_CRL_SIGN 35 +# define X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION 36 +# define X509_V_ERR_INVALID_NON_CA 37 +# define X509_V_ERR_PROXY_PATH_LENGTH_EXCEEDED 38 +# define X509_V_ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE 39 +# define X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED 40 +# define X509_V_ERR_INVALID_EXTENSION 41 +# define X509_V_ERR_INVALID_POLICY_EXTENSION 42 +# define X509_V_ERR_NO_EXPLICIT_POLICY 43 +# define X509_V_ERR_DIFFERENT_CRL_SCOPE 44 +# define X509_V_ERR_UNSUPPORTED_EXTENSION_FEATURE 45 +# define X509_V_ERR_UNNESTED_RESOURCE 46 +# define X509_V_ERR_PERMITTED_VIOLATION 47 +# define X509_V_ERR_EXCLUDED_VIOLATION 48 +# define X509_V_ERR_SUBTREE_MINMAX 49 +/* The application is not happy */ +# define X509_V_ERR_APPLICATION_VERIFICATION 50 +# define X509_V_ERR_UNSUPPORTED_CONSTRAINT_TYPE 51 +# define X509_V_ERR_UNSUPPORTED_CONSTRAINT_SYNTAX 52 +# define X509_V_ERR_UNSUPPORTED_NAME_SYNTAX 53 +# define X509_V_ERR_CRL_PATH_VALIDATION_ERROR 54 +/* Another issuer check debug option */ +# define X509_V_ERR_PATH_LOOP 55 +/* Suite B mode algorithm violation */ +# define X509_V_ERR_SUITE_B_INVALID_VERSION 56 +# define X509_V_ERR_SUITE_B_INVALID_ALGORITHM 57 +# define X509_V_ERR_SUITE_B_INVALID_CURVE 58 +# define X509_V_ERR_SUITE_B_INVALID_SIGNATURE_ALGORITHM 59 +# define X509_V_ERR_SUITE_B_LOS_NOT_ALLOWED 60 +# define X509_V_ERR_SUITE_B_CANNOT_SIGN_P_384_WITH_P_256 61 +/* Host, email and IP check errors */ +# define X509_V_ERR_HOSTNAME_MISMATCH 62 +# define X509_V_ERR_EMAIL_MISMATCH 63 +# define X509_V_ERR_IP_ADDRESS_MISMATCH 64 +/* DANE TLSA errors */ +# define X509_V_ERR_DANE_NO_MATCH 65 +/* security level errors */ +# define X509_V_ERR_EE_KEY_TOO_SMALL 66 +# define X509_V_ERR_CA_KEY_TOO_SMALL 67 +# define X509_V_ERR_CA_MD_TOO_WEAK 68 +/* Caller error */ +# define X509_V_ERR_INVALID_CALL 69 +/* Issuer lookup error */ +# define X509_V_ERR_STORE_LOOKUP 70 +/* Certificate transparency */ +# define X509_V_ERR_NO_VALID_SCTS 71 + +# define X509_V_ERR_PROXY_SUBJECT_NAME_VIOLATION 72 +/* OCSP status errors */ +# define X509_V_ERR_OCSP_VERIFY_NEEDED 73 /* Need OCSP verification */ +# define X509_V_ERR_OCSP_VERIFY_FAILED 74 /* Couldn't verify cert through OCSP */ +# define X509_V_ERR_OCSP_CERT_UNKNOWN 75 /* Certificate wasn't recognized by the OCSP responder */ + +/* Certificate verify flags */ + +# if OPENSSL_API_COMPAT < 0x10100000L +# define X509_V_FLAG_CB_ISSUER_CHECK 0x0 /* Deprecated */ +# endif +/* Use check time instead of current time */ +# define X509_V_FLAG_USE_CHECK_TIME 0x2 +/* Lookup CRLs */ +# define X509_V_FLAG_CRL_CHECK 0x4 +/* Lookup CRLs for whole chain */ +# define X509_V_FLAG_CRL_CHECK_ALL 0x8 +/* Ignore unhandled critical extensions */ +# define X509_V_FLAG_IGNORE_CRITICAL 0x10 +/* Disable workarounds for broken certificates */ +# define X509_V_FLAG_X509_STRICT 0x20 +/* Enable proxy certificate validation */ +# define X509_V_FLAG_ALLOW_PROXY_CERTS 0x40 +/* Enable policy checking */ +# define X509_V_FLAG_POLICY_CHECK 0x80 +/* Policy variable require-explicit-policy */ +# define X509_V_FLAG_EXPLICIT_POLICY 0x100 +/* Policy variable inhibit-any-policy */ +# define X509_V_FLAG_INHIBIT_ANY 0x200 +/* Policy variable inhibit-policy-mapping */ +# define X509_V_FLAG_INHIBIT_MAP 0x400 +/* Notify callback that policy is OK */ +# define X509_V_FLAG_NOTIFY_POLICY 0x800 +/* Extended CRL features such as indirect CRLs, alternate CRL signing keys */ +# define X509_V_FLAG_EXTENDED_CRL_SUPPORT 0x1000 +/* Delta CRL support */ +# define X509_V_FLAG_USE_DELTAS 0x2000 +/* Check self-signed CA signature */ +# define X509_V_FLAG_CHECK_SS_SIGNATURE 0x4000 +/* Use trusted store first */ +# define X509_V_FLAG_TRUSTED_FIRST 0x8000 +/* Suite B 128 bit only mode: not normally used */ +# define X509_V_FLAG_SUITEB_128_LOS_ONLY 0x10000 +/* Suite B 192 bit only mode */ +# define X509_V_FLAG_SUITEB_192_LOS 0x20000 +/* Suite B 128 bit mode allowing 192 bit algorithms */ +# define X509_V_FLAG_SUITEB_128_LOS 0x30000 +/* Allow partial chains if at least one certificate is in trusted store */ +# define X509_V_FLAG_PARTIAL_CHAIN 0x80000 +/* + * If the initial chain is not trusted, do not attempt to build an alternative + * chain. Alternate chain checking was introduced in 1.1.0. Setting this flag + * will force the behaviour to match that of previous versions. + */ +# define X509_V_FLAG_NO_ALT_CHAINS 0x100000 +/* Do not check certificate/CRL validity against current time */ +# define X509_V_FLAG_NO_CHECK_TIME 0x200000 + +# define X509_VP_FLAG_DEFAULT 0x1 +# define X509_VP_FLAG_OVERWRITE 0x2 +# define X509_VP_FLAG_RESET_FLAGS 0x4 +# define X509_VP_FLAG_LOCKED 0x8 +# define X509_VP_FLAG_ONCE 0x10 + +/* Internal use: mask of policy related options */ +# define X509_V_FLAG_POLICY_MASK (X509_V_FLAG_POLICY_CHECK \ + | X509_V_FLAG_EXPLICIT_POLICY \ + | X509_V_FLAG_INHIBIT_ANY \ + | X509_V_FLAG_INHIBIT_MAP) + +int X509_OBJECT_idx_by_subject(STACK_OF(X509_OBJECT) *h, X509_LOOKUP_TYPE type, + X509_NAME *name); +X509_OBJECT *X509_OBJECT_retrieve_by_subject(STACK_OF(X509_OBJECT) *h, + X509_LOOKUP_TYPE type, + X509_NAME *name); +X509_OBJECT *X509_OBJECT_retrieve_match(STACK_OF(X509_OBJECT) *h, + X509_OBJECT *x); +int X509_OBJECT_up_ref_count(X509_OBJECT *a); +X509_OBJECT *X509_OBJECT_new(void); +void X509_OBJECT_free(X509_OBJECT *a); +X509_LOOKUP_TYPE X509_OBJECT_get_type(const X509_OBJECT *a); +X509 *X509_OBJECT_get0_X509(const X509_OBJECT *a); +int X509_OBJECT_set1_X509(X509_OBJECT *a, X509 *obj); +X509_CRL *X509_OBJECT_get0_X509_CRL(X509_OBJECT *a); +int X509_OBJECT_set1_X509_CRL(X509_OBJECT *a, X509_CRL *obj); +X509_STORE *X509_STORE_new(void); +void X509_STORE_free(X509_STORE *v); +int X509_STORE_lock(X509_STORE *ctx); +int X509_STORE_unlock(X509_STORE *ctx); +int X509_STORE_up_ref(X509_STORE *v); +STACK_OF(X509_OBJECT) *X509_STORE_get0_objects(X509_STORE *v); + +STACK_OF(X509) *X509_STORE_CTX_get1_certs(X509_STORE_CTX *st, X509_NAME *nm); +STACK_OF(X509_CRL) *X509_STORE_CTX_get1_crls(X509_STORE_CTX *st, X509_NAME *nm); +int X509_STORE_set_flags(X509_STORE *ctx, unsigned long flags); +int X509_STORE_set_purpose(X509_STORE *ctx, int purpose); +int X509_STORE_set_trust(X509_STORE *ctx, int trust); +int X509_STORE_set1_param(X509_STORE *ctx, X509_VERIFY_PARAM *pm); +X509_VERIFY_PARAM *X509_STORE_get0_param(X509_STORE *ctx); + +void X509_STORE_set_verify(X509_STORE *ctx, X509_STORE_CTX_verify_fn verify); +#define X509_STORE_set_verify_func(ctx, func) \ + X509_STORE_set_verify((ctx),(func)) +void X509_STORE_CTX_set_verify(X509_STORE_CTX *ctx, + X509_STORE_CTX_verify_fn verify); +X509_STORE_CTX_verify_fn X509_STORE_get_verify(X509_STORE *ctx); +void X509_STORE_set_verify_cb(X509_STORE *ctx, + X509_STORE_CTX_verify_cb verify_cb); +# define X509_STORE_set_verify_cb_func(ctx,func) \ + X509_STORE_set_verify_cb((ctx),(func)) +X509_STORE_CTX_verify_cb X509_STORE_get_verify_cb(X509_STORE *ctx); +void X509_STORE_set_get_issuer(X509_STORE *ctx, + X509_STORE_CTX_get_issuer_fn get_issuer); +X509_STORE_CTX_get_issuer_fn X509_STORE_get_get_issuer(X509_STORE *ctx); +void X509_STORE_set_check_issued(X509_STORE *ctx, + X509_STORE_CTX_check_issued_fn check_issued); +X509_STORE_CTX_check_issued_fn X509_STORE_get_check_issued(X509_STORE *ctx); +void X509_STORE_set_check_revocation(X509_STORE *ctx, + X509_STORE_CTX_check_revocation_fn check_revocation); +X509_STORE_CTX_check_revocation_fn X509_STORE_get_check_revocation(X509_STORE *ctx); +void X509_STORE_set_get_crl(X509_STORE *ctx, + X509_STORE_CTX_get_crl_fn get_crl); +X509_STORE_CTX_get_crl_fn X509_STORE_get_get_crl(X509_STORE *ctx); +void X509_STORE_set_check_crl(X509_STORE *ctx, + X509_STORE_CTX_check_crl_fn check_crl); +X509_STORE_CTX_check_crl_fn X509_STORE_get_check_crl(X509_STORE *ctx); +void X509_STORE_set_cert_crl(X509_STORE *ctx, + X509_STORE_CTX_cert_crl_fn cert_crl); +X509_STORE_CTX_cert_crl_fn X509_STORE_get_cert_crl(X509_STORE *ctx); +void X509_STORE_set_check_policy(X509_STORE *ctx, + X509_STORE_CTX_check_policy_fn check_policy); +X509_STORE_CTX_check_policy_fn X509_STORE_get_check_policy(X509_STORE *ctx); +void X509_STORE_set_lookup_certs(X509_STORE *ctx, + X509_STORE_CTX_lookup_certs_fn lookup_certs); +X509_STORE_CTX_lookup_certs_fn X509_STORE_get_lookup_certs(X509_STORE *ctx); +void X509_STORE_set_lookup_crls(X509_STORE *ctx, + X509_STORE_CTX_lookup_crls_fn lookup_crls); +#define X509_STORE_set_lookup_crls_cb(ctx, func) \ + X509_STORE_set_lookup_crls((ctx), (func)) +X509_STORE_CTX_lookup_crls_fn X509_STORE_get_lookup_crls(X509_STORE *ctx); +void X509_STORE_set_cleanup(X509_STORE *ctx, + X509_STORE_CTX_cleanup_fn cleanup); +X509_STORE_CTX_cleanup_fn X509_STORE_get_cleanup(X509_STORE *ctx); + +#define X509_STORE_get_ex_new_index(l, p, newf, dupf, freef) \ + CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_X509_STORE, l, p, newf, dupf, freef) +int X509_STORE_set_ex_data(X509_STORE *ctx, int idx, void *data); +void *X509_STORE_get_ex_data(X509_STORE *ctx, int idx); + +X509_STORE_CTX *X509_STORE_CTX_new(void); + +int X509_STORE_CTX_get1_issuer(X509 **issuer, X509_STORE_CTX *ctx, X509 *x); + +void X509_STORE_CTX_free(X509_STORE_CTX *ctx); +int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, + X509 *x509, STACK_OF(X509) *chain); +void X509_STORE_CTX_set0_trusted_stack(X509_STORE_CTX *ctx, STACK_OF(X509) *sk); +void X509_STORE_CTX_cleanup(X509_STORE_CTX *ctx); + +X509_STORE *X509_STORE_CTX_get0_store(X509_STORE_CTX *ctx); +X509 *X509_STORE_CTX_get0_cert(X509_STORE_CTX *ctx); +STACK_OF(X509)* X509_STORE_CTX_get0_untrusted(X509_STORE_CTX *ctx); +void X509_STORE_CTX_set0_untrusted(X509_STORE_CTX *ctx, STACK_OF(X509) *sk); +void X509_STORE_CTX_set_verify_cb(X509_STORE_CTX *ctx, + X509_STORE_CTX_verify_cb verify); +X509_STORE_CTX_verify_cb X509_STORE_CTX_get_verify_cb(X509_STORE_CTX *ctx); +X509_STORE_CTX_verify_fn X509_STORE_CTX_get_verify(X509_STORE_CTX *ctx); +X509_STORE_CTX_get_issuer_fn X509_STORE_CTX_get_get_issuer(X509_STORE_CTX *ctx); +X509_STORE_CTX_check_issued_fn X509_STORE_CTX_get_check_issued(X509_STORE_CTX *ctx); +X509_STORE_CTX_check_revocation_fn X509_STORE_CTX_get_check_revocation(X509_STORE_CTX *ctx); +X509_STORE_CTX_get_crl_fn X509_STORE_CTX_get_get_crl(X509_STORE_CTX *ctx); +X509_STORE_CTX_check_crl_fn X509_STORE_CTX_get_check_crl(X509_STORE_CTX *ctx); +X509_STORE_CTX_cert_crl_fn X509_STORE_CTX_get_cert_crl(X509_STORE_CTX *ctx); +X509_STORE_CTX_check_policy_fn X509_STORE_CTX_get_check_policy(X509_STORE_CTX *ctx); +X509_STORE_CTX_lookup_certs_fn X509_STORE_CTX_get_lookup_certs(X509_STORE_CTX *ctx); +X509_STORE_CTX_lookup_crls_fn X509_STORE_CTX_get_lookup_crls(X509_STORE_CTX *ctx); +X509_STORE_CTX_cleanup_fn X509_STORE_CTX_get_cleanup(X509_STORE_CTX *ctx); + +#if OPENSSL_API_COMPAT < 0x10100000L +# define X509_STORE_CTX_get_chain X509_STORE_CTX_get0_chain +# define X509_STORE_CTX_set_chain X509_STORE_CTX_set0_untrusted +# define X509_STORE_CTX_trusted_stack X509_STORE_CTX_set0_trusted_stack +# define X509_STORE_get_by_subject X509_STORE_CTX_get_by_subject +# define X509_STORE_get1_certs X509_STORE_CTX_get1_certs +# define X509_STORE_get1_crls X509_STORE_CTX_get1_crls +/* the following macro is misspelled; use X509_STORE_get1_certs instead */ +# define X509_STORE_get1_cert X509_STORE_CTX_get1_certs +/* the following macro is misspelled; use X509_STORE_get1_crls instead */ +# define X509_STORE_get1_crl X509_STORE_CTX_get1_crls +#endif + +X509_LOOKUP *X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m); +X509_LOOKUP_METHOD *X509_LOOKUP_hash_dir(void); +X509_LOOKUP_METHOD *X509_LOOKUP_file(void); + +typedef int (*X509_LOOKUP_ctrl_fn)(X509_LOOKUP *ctx, int cmd, const char *argc, + long argl, char **ret); +typedef int (*X509_LOOKUP_get_by_subject_fn)(X509_LOOKUP *ctx, + X509_LOOKUP_TYPE type, + X509_NAME *name, + X509_OBJECT *ret); +typedef int (*X509_LOOKUP_get_by_issuer_serial_fn)(X509_LOOKUP *ctx, + X509_LOOKUP_TYPE type, + X509_NAME *name, + ASN1_INTEGER *serial, + X509_OBJECT *ret); +typedef int (*X509_LOOKUP_get_by_fingerprint_fn)(X509_LOOKUP *ctx, + X509_LOOKUP_TYPE type, + const unsigned char* bytes, + int len, + X509_OBJECT *ret); +typedef int (*X509_LOOKUP_get_by_alias_fn)(X509_LOOKUP *ctx, + X509_LOOKUP_TYPE type, + const char *str, + int len, + X509_OBJECT *ret); + +X509_LOOKUP_METHOD *X509_LOOKUP_meth_new(const char *name); +void X509_LOOKUP_meth_free(X509_LOOKUP_METHOD *method); + +int X509_LOOKUP_meth_set_new_item(X509_LOOKUP_METHOD *method, + int (*new_item) (X509_LOOKUP *ctx)); +int (*X509_LOOKUP_meth_get_new_item(const X509_LOOKUP_METHOD* method)) + (X509_LOOKUP *ctx); + +int X509_LOOKUP_meth_set_free(X509_LOOKUP_METHOD *method, + void (*free_fn) (X509_LOOKUP *ctx)); +void (*X509_LOOKUP_meth_get_free(const X509_LOOKUP_METHOD* method)) + (X509_LOOKUP *ctx); + +int X509_LOOKUP_meth_set_init(X509_LOOKUP_METHOD *method, + int (*init) (X509_LOOKUP *ctx)); +int (*X509_LOOKUP_meth_get_init(const X509_LOOKUP_METHOD* method)) + (X509_LOOKUP *ctx); + +int X509_LOOKUP_meth_set_shutdown(X509_LOOKUP_METHOD *method, + int (*shutdown) (X509_LOOKUP *ctx)); +int (*X509_LOOKUP_meth_get_shutdown(const X509_LOOKUP_METHOD* method)) + (X509_LOOKUP *ctx); + +int X509_LOOKUP_meth_set_ctrl(X509_LOOKUP_METHOD *method, + X509_LOOKUP_ctrl_fn ctrl_fn); +X509_LOOKUP_ctrl_fn X509_LOOKUP_meth_get_ctrl(const X509_LOOKUP_METHOD *method); + +int X509_LOOKUP_meth_set_get_by_subject(X509_LOOKUP_METHOD *method, + X509_LOOKUP_get_by_subject_fn fn); +X509_LOOKUP_get_by_subject_fn X509_LOOKUP_meth_get_get_by_subject( + const X509_LOOKUP_METHOD *method); + +int X509_LOOKUP_meth_set_get_by_issuer_serial(X509_LOOKUP_METHOD *method, + X509_LOOKUP_get_by_issuer_serial_fn fn); +X509_LOOKUP_get_by_issuer_serial_fn X509_LOOKUP_meth_get_get_by_issuer_serial( + const X509_LOOKUP_METHOD *method); + +int X509_LOOKUP_meth_set_get_by_fingerprint(X509_LOOKUP_METHOD *method, + X509_LOOKUP_get_by_fingerprint_fn fn); +X509_LOOKUP_get_by_fingerprint_fn X509_LOOKUP_meth_get_get_by_fingerprint( + const X509_LOOKUP_METHOD *method); + +int X509_LOOKUP_meth_set_get_by_alias(X509_LOOKUP_METHOD *method, + X509_LOOKUP_get_by_alias_fn fn); +X509_LOOKUP_get_by_alias_fn X509_LOOKUP_meth_get_get_by_alias( + const X509_LOOKUP_METHOD *method); + + +int X509_STORE_add_cert(X509_STORE *ctx, X509 *x); +int X509_STORE_add_crl(X509_STORE *ctx, X509_CRL *x); + +int X509_STORE_CTX_get_by_subject(X509_STORE_CTX *vs, X509_LOOKUP_TYPE type, + X509_NAME *name, X509_OBJECT *ret); +X509_OBJECT *X509_STORE_CTX_get_obj_by_subject(X509_STORE_CTX *vs, + X509_LOOKUP_TYPE type, + X509_NAME *name); + +int X509_LOOKUP_ctrl(X509_LOOKUP *ctx, int cmd, const char *argc, + long argl, char **ret); + +int X509_load_cert_file(X509_LOOKUP *ctx, const char *file, int type); +int X509_load_crl_file(X509_LOOKUP *ctx, const char *file, int type); +int X509_load_cert_crl_file(X509_LOOKUP *ctx, const char *file, int type); + +X509_LOOKUP *X509_LOOKUP_new(X509_LOOKUP_METHOD *method); +void X509_LOOKUP_free(X509_LOOKUP *ctx); +int X509_LOOKUP_init(X509_LOOKUP *ctx); +int X509_LOOKUP_by_subject(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, + X509_NAME *name, X509_OBJECT *ret); +int X509_LOOKUP_by_issuer_serial(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, + X509_NAME *name, ASN1_INTEGER *serial, + X509_OBJECT *ret); +int X509_LOOKUP_by_fingerprint(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, + const unsigned char *bytes, int len, + X509_OBJECT *ret); +int X509_LOOKUP_by_alias(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, + const char *str, int len, X509_OBJECT *ret); +int X509_LOOKUP_set_method_data(X509_LOOKUP *ctx, void *data); +void *X509_LOOKUP_get_method_data(const X509_LOOKUP *ctx); +X509_STORE *X509_LOOKUP_get_store(const X509_LOOKUP *ctx); +int X509_LOOKUP_shutdown(X509_LOOKUP *ctx); + +int X509_STORE_load_locations(X509_STORE *ctx, + const char *file, const char *dir); +int X509_STORE_set_default_paths(X509_STORE *ctx); + +#define X509_STORE_CTX_get_ex_new_index(l, p, newf, dupf, freef) \ + CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_X509_STORE_CTX, l, p, newf, dupf, freef) +int X509_STORE_CTX_set_ex_data(X509_STORE_CTX *ctx, int idx, void *data); +void *X509_STORE_CTX_get_ex_data(X509_STORE_CTX *ctx, int idx); +int X509_STORE_CTX_get_error(X509_STORE_CTX *ctx); +void X509_STORE_CTX_set_error(X509_STORE_CTX *ctx, int s); +int X509_STORE_CTX_get_error_depth(X509_STORE_CTX *ctx); +void X509_STORE_CTX_set_error_depth(X509_STORE_CTX *ctx, int depth); +X509 *X509_STORE_CTX_get_current_cert(X509_STORE_CTX *ctx); +void X509_STORE_CTX_set_current_cert(X509_STORE_CTX *ctx, X509 *x); +X509 *X509_STORE_CTX_get0_current_issuer(X509_STORE_CTX *ctx); +X509_CRL *X509_STORE_CTX_get0_current_crl(X509_STORE_CTX *ctx); +X509_STORE_CTX *X509_STORE_CTX_get0_parent_ctx(X509_STORE_CTX *ctx); +STACK_OF(X509) *X509_STORE_CTX_get0_chain(X509_STORE_CTX *ctx); +STACK_OF(X509) *X509_STORE_CTX_get1_chain(X509_STORE_CTX *ctx); +void X509_STORE_CTX_set_cert(X509_STORE_CTX *c, X509 *x); +void X509_STORE_CTX_set0_verified_chain(X509_STORE_CTX *c, STACK_OF(X509) *sk); +void X509_STORE_CTX_set0_crls(X509_STORE_CTX *c, STACK_OF(X509_CRL) *sk); +int X509_STORE_CTX_set_purpose(X509_STORE_CTX *ctx, int purpose); +int X509_STORE_CTX_set_trust(X509_STORE_CTX *ctx, int trust); +int X509_STORE_CTX_purpose_inherit(X509_STORE_CTX *ctx, int def_purpose, + int purpose, int trust); +void X509_STORE_CTX_set_flags(X509_STORE_CTX *ctx, unsigned long flags); +void X509_STORE_CTX_set_time(X509_STORE_CTX *ctx, unsigned long flags, + time_t t); + +X509_POLICY_TREE *X509_STORE_CTX_get0_policy_tree(X509_STORE_CTX *ctx); +int X509_STORE_CTX_get_explicit_policy(X509_STORE_CTX *ctx); +int X509_STORE_CTX_get_num_untrusted(X509_STORE_CTX *ctx); + +X509_VERIFY_PARAM *X509_STORE_CTX_get0_param(X509_STORE_CTX *ctx); +void X509_STORE_CTX_set0_param(X509_STORE_CTX *ctx, X509_VERIFY_PARAM *param); +int X509_STORE_CTX_set_default(X509_STORE_CTX *ctx, const char *name); + +/* + * Bridge opacity barrier between libcrypt and libssl, also needed to support + * offline testing in test/danetest.c + */ +void X509_STORE_CTX_set0_dane(X509_STORE_CTX *ctx, SSL_DANE *dane); +#define DANE_FLAG_NO_DANE_EE_NAMECHECKS (1L << 0) + +/* X509_VERIFY_PARAM functions */ + +X509_VERIFY_PARAM *X509_VERIFY_PARAM_new(void); +void X509_VERIFY_PARAM_free(X509_VERIFY_PARAM *param); +int X509_VERIFY_PARAM_inherit(X509_VERIFY_PARAM *to, + const X509_VERIFY_PARAM *from); +int X509_VERIFY_PARAM_set1(X509_VERIFY_PARAM *to, + const X509_VERIFY_PARAM *from); +int X509_VERIFY_PARAM_set1_name(X509_VERIFY_PARAM *param, const char *name); +int X509_VERIFY_PARAM_set_flags(X509_VERIFY_PARAM *param, + unsigned long flags); +int X509_VERIFY_PARAM_clear_flags(X509_VERIFY_PARAM *param, + unsigned long flags); +unsigned long X509_VERIFY_PARAM_get_flags(X509_VERIFY_PARAM *param); +int X509_VERIFY_PARAM_set_purpose(X509_VERIFY_PARAM *param, int purpose); +int X509_VERIFY_PARAM_set_trust(X509_VERIFY_PARAM *param, int trust); +void X509_VERIFY_PARAM_set_depth(X509_VERIFY_PARAM *param, int depth); +void X509_VERIFY_PARAM_set_auth_level(X509_VERIFY_PARAM *param, int auth_level); +time_t X509_VERIFY_PARAM_get_time(const X509_VERIFY_PARAM *param); +void X509_VERIFY_PARAM_set_time(X509_VERIFY_PARAM *param, time_t t); +int X509_VERIFY_PARAM_add0_policy(X509_VERIFY_PARAM *param, + ASN1_OBJECT *policy); +int X509_VERIFY_PARAM_set1_policies(X509_VERIFY_PARAM *param, + STACK_OF(ASN1_OBJECT) *policies); + +int X509_VERIFY_PARAM_set_inh_flags(X509_VERIFY_PARAM *param, + uint32_t flags); +uint32_t X509_VERIFY_PARAM_get_inh_flags(const X509_VERIFY_PARAM *param); + +int X509_VERIFY_PARAM_set1_host(X509_VERIFY_PARAM *param, + const char *name, size_t namelen); +int X509_VERIFY_PARAM_add1_host(X509_VERIFY_PARAM *param, + const char *name, size_t namelen); +void X509_VERIFY_PARAM_set_hostflags(X509_VERIFY_PARAM *param, + unsigned int flags); +unsigned int X509_VERIFY_PARAM_get_hostflags(const X509_VERIFY_PARAM *param); +char *X509_VERIFY_PARAM_get0_peername(X509_VERIFY_PARAM *); +void X509_VERIFY_PARAM_move_peername(X509_VERIFY_PARAM *, X509_VERIFY_PARAM *); +int X509_VERIFY_PARAM_set1_email(X509_VERIFY_PARAM *param, + const char *email, size_t emaillen); +int X509_VERIFY_PARAM_set1_ip(X509_VERIFY_PARAM *param, + const unsigned char *ip, size_t iplen); +int X509_VERIFY_PARAM_set1_ip_asc(X509_VERIFY_PARAM *param, + const char *ipasc); + +int X509_VERIFY_PARAM_get_depth(const X509_VERIFY_PARAM *param); +int X509_VERIFY_PARAM_get_auth_level(const X509_VERIFY_PARAM *param); +const char *X509_VERIFY_PARAM_get0_name(const X509_VERIFY_PARAM *param); + +int X509_VERIFY_PARAM_add0_table(X509_VERIFY_PARAM *param); +int X509_VERIFY_PARAM_get_count(void); +const X509_VERIFY_PARAM *X509_VERIFY_PARAM_get0(int id); +const X509_VERIFY_PARAM *X509_VERIFY_PARAM_lookup(const char *name); +void X509_VERIFY_PARAM_table_cleanup(void); + +/* Non positive return values are errors */ +#define X509_PCY_TREE_FAILURE -2 /* Failure to satisfy explicit policy */ +#define X509_PCY_TREE_INVALID -1 /* Inconsistent or invalid extensions */ +#define X509_PCY_TREE_INTERNAL 0 /* Internal error, most likely malloc */ + +/* + * Positive return values form a bit mask, all but the first are internal to + * the library and don't appear in results from X509_policy_check(). + */ +#define X509_PCY_TREE_VALID 1 /* The policy tree is valid */ +#define X509_PCY_TREE_EMPTY 2 /* The policy tree is empty */ +#define X509_PCY_TREE_EXPLICIT 4 /* Explicit policy required */ + +int X509_policy_check(X509_POLICY_TREE **ptree, int *pexplicit_policy, + STACK_OF(X509) *certs, + STACK_OF(ASN1_OBJECT) *policy_oids, unsigned int flags); + +void X509_policy_tree_free(X509_POLICY_TREE *tree); + +int X509_policy_tree_level_count(const X509_POLICY_TREE *tree); +X509_POLICY_LEVEL *X509_policy_tree_get0_level(const X509_POLICY_TREE *tree, + int i); + +STACK_OF(X509_POLICY_NODE) *X509_policy_tree_get0_policies(const + X509_POLICY_TREE + *tree); + +STACK_OF(X509_POLICY_NODE) *X509_policy_tree_get0_user_policies(const + X509_POLICY_TREE + *tree); + +int X509_policy_level_node_count(X509_POLICY_LEVEL *level); + +X509_POLICY_NODE *X509_policy_level_get0_node(X509_POLICY_LEVEL *level, + int i); + +const ASN1_OBJECT *X509_policy_node_get0_policy(const X509_POLICY_NODE *node); + +STACK_OF(POLICYQUALINFO) *X509_policy_node_get0_qualifiers(const + X509_POLICY_NODE + *node); +const X509_POLICY_NODE *X509_policy_node_get0_parent(const X509_POLICY_NODE + *node); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/x509err.h b/MediaClient/MediaClient/openssl/include/openssl/x509err.h new file mode 100644 index 0000000..0273853 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/x509err.h @@ -0,0 +1,130 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_X509ERR_H +# define HEADER_X509ERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_X509_strings(void); + +/* + * X509 function codes. + */ +# define X509_F_ADD_CERT_DIR 100 +# define X509_F_BUILD_CHAIN 106 +# define X509_F_BY_FILE_CTRL 101 +# define X509_F_CHECK_NAME_CONSTRAINTS 149 +# define X509_F_CHECK_POLICY 145 +# define X509_F_DANE_I2D 107 +# define X509_F_DIR_CTRL 102 +# define X509_F_GET_CERT_BY_SUBJECT 103 +# define X509_F_I2D_X509_AUX 151 +# define X509_F_LOOKUP_CERTS_SK 152 +# define X509_F_NETSCAPE_SPKI_B64_DECODE 129 +# define X509_F_NETSCAPE_SPKI_B64_ENCODE 130 +# define X509_F_NEW_DIR 153 +# define X509_F_X509AT_ADD1_ATTR 135 +# define X509_F_X509V3_ADD_EXT 104 +# define X509_F_X509_ATTRIBUTE_CREATE_BY_NID 136 +# define X509_F_X509_ATTRIBUTE_CREATE_BY_OBJ 137 +# define X509_F_X509_ATTRIBUTE_CREATE_BY_TXT 140 +# define X509_F_X509_ATTRIBUTE_GET0_DATA 139 +# define X509_F_X509_ATTRIBUTE_SET1_DATA 138 +# define X509_F_X509_CHECK_PRIVATE_KEY 128 +# define X509_F_X509_CRL_DIFF 105 +# define X509_F_X509_CRL_METHOD_NEW 154 +# define X509_F_X509_CRL_PRINT_FP 147 +# define X509_F_X509_EXTENSION_CREATE_BY_NID 108 +# define X509_F_X509_EXTENSION_CREATE_BY_OBJ 109 +# define X509_F_X509_GET_PUBKEY_PARAMETERS 110 +# define X509_F_X509_LOAD_CERT_CRL_FILE 132 +# define X509_F_X509_LOAD_CERT_FILE 111 +# define X509_F_X509_LOAD_CRL_FILE 112 +# define X509_F_X509_LOOKUP_METH_NEW 160 +# define X509_F_X509_LOOKUP_NEW 155 +# define X509_F_X509_NAME_ADD_ENTRY 113 +# define X509_F_X509_NAME_CANON 156 +# define X509_F_X509_NAME_ENTRY_CREATE_BY_NID 114 +# define X509_F_X509_NAME_ENTRY_CREATE_BY_TXT 131 +# define X509_F_X509_NAME_ENTRY_SET_OBJECT 115 +# define X509_F_X509_NAME_ONELINE 116 +# define X509_F_X509_NAME_PRINT 117 +# define X509_F_X509_OBJECT_NEW 150 +# define X509_F_X509_PRINT_EX_FP 118 +# define X509_F_X509_PUBKEY_DECODE 148 +# define X509_F_X509_PUBKEY_GET0 119 +# define X509_F_X509_PUBKEY_SET 120 +# define X509_F_X509_REQ_CHECK_PRIVATE_KEY 144 +# define X509_F_X509_REQ_PRINT_EX 121 +# define X509_F_X509_REQ_PRINT_FP 122 +# define X509_F_X509_REQ_TO_X509 123 +# define X509_F_X509_STORE_ADD_CERT 124 +# define X509_F_X509_STORE_ADD_CRL 125 +# define X509_F_X509_STORE_ADD_LOOKUP 157 +# define X509_F_X509_STORE_CTX_GET1_ISSUER 146 +# define X509_F_X509_STORE_CTX_INIT 143 +# define X509_F_X509_STORE_CTX_NEW 142 +# define X509_F_X509_STORE_CTX_PURPOSE_INHERIT 134 +# define X509_F_X509_STORE_NEW 158 +# define X509_F_X509_TO_X509_REQ 126 +# define X509_F_X509_TRUST_ADD 133 +# define X509_F_X509_TRUST_SET 141 +# define X509_F_X509_VERIFY_CERT 127 +# define X509_F_X509_VERIFY_PARAM_NEW 159 + +/* + * X509 reason codes. + */ +# define X509_R_AKID_MISMATCH 110 +# define X509_R_BAD_SELECTOR 133 +# define X509_R_BAD_X509_FILETYPE 100 +# define X509_R_BASE64_DECODE_ERROR 118 +# define X509_R_CANT_CHECK_DH_KEY 114 +# define X509_R_CERT_ALREADY_IN_HASH_TABLE 101 +# define X509_R_CRL_ALREADY_DELTA 127 +# define X509_R_CRL_VERIFY_FAILURE 131 +# define X509_R_IDP_MISMATCH 128 +# define X509_R_INVALID_ATTRIBUTES 138 +# define X509_R_INVALID_DIRECTORY 113 +# define X509_R_INVALID_FIELD_NAME 119 +# define X509_R_INVALID_TRUST 123 +# define X509_R_ISSUER_MISMATCH 129 +# define X509_R_KEY_TYPE_MISMATCH 115 +# define X509_R_KEY_VALUES_MISMATCH 116 +# define X509_R_LOADING_CERT_DIR 103 +# define X509_R_LOADING_DEFAULTS 104 +# define X509_R_METHOD_NOT_SUPPORTED 124 +# define X509_R_NAME_TOO_LONG 134 +# define X509_R_NEWER_CRL_NOT_NEWER 132 +# define X509_R_NO_CERTIFICATE_FOUND 135 +# define X509_R_NO_CERTIFICATE_OR_CRL_FOUND 136 +# define X509_R_NO_CERT_SET_FOR_US_TO_VERIFY 105 +# define X509_R_NO_CRL_FOUND 137 +# define X509_R_NO_CRL_NUMBER 130 +# define X509_R_PUBLIC_KEY_DECODE_ERROR 125 +# define X509_R_PUBLIC_KEY_ENCODE_ERROR 126 +# define X509_R_SHOULD_RETRY 106 +# define X509_R_UNABLE_TO_FIND_PARAMETERS_IN_CHAIN 107 +# define X509_R_UNABLE_TO_GET_CERTS_PUBLIC_KEY 108 +# define X509_R_UNKNOWN_KEY_TYPE 117 +# define X509_R_UNKNOWN_NID 109 +# define X509_R_UNKNOWN_PURPOSE_ID 121 +# define X509_R_UNKNOWN_TRUST_ID 120 +# define X509_R_UNSUPPORTED_ALGORITHM 111 +# define X509_R_WRONG_LOOKUP_TYPE 112 +# define X509_R_WRONG_TYPE 122 + +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/x509v3.h b/MediaClient/MediaClient/openssl/include/openssl/x509v3.h new file mode 100644 index 0000000..6c6eca3 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/x509v3.h @@ -0,0 +1,937 @@ +/* + * Copyright 1999-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_X509V3_H +# define HEADER_X509V3_H + +# include +# include +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward reference */ +struct v3_ext_method; +struct v3_ext_ctx; + +/* Useful typedefs */ + +typedef void *(*X509V3_EXT_NEW)(void); +typedef void (*X509V3_EXT_FREE) (void *); +typedef void *(*X509V3_EXT_D2I)(void *, const unsigned char **, long); +typedef int (*X509V3_EXT_I2D) (void *, unsigned char **); +typedef STACK_OF(CONF_VALUE) * + (*X509V3_EXT_I2V) (const struct v3_ext_method *method, void *ext, + STACK_OF(CONF_VALUE) *extlist); +typedef void *(*X509V3_EXT_V2I)(const struct v3_ext_method *method, + struct v3_ext_ctx *ctx, + STACK_OF(CONF_VALUE) *values); +typedef char *(*X509V3_EXT_I2S)(const struct v3_ext_method *method, + void *ext); +typedef void *(*X509V3_EXT_S2I)(const struct v3_ext_method *method, + struct v3_ext_ctx *ctx, const char *str); +typedef int (*X509V3_EXT_I2R) (const struct v3_ext_method *method, void *ext, + BIO *out, int indent); +typedef void *(*X509V3_EXT_R2I)(const struct v3_ext_method *method, + struct v3_ext_ctx *ctx, const char *str); + +/* V3 extension structure */ + +struct v3_ext_method { + int ext_nid; + int ext_flags; +/* If this is set the following four fields are ignored */ + ASN1_ITEM_EXP *it; +/* Old style ASN1 calls */ + X509V3_EXT_NEW ext_new; + X509V3_EXT_FREE ext_free; + X509V3_EXT_D2I d2i; + X509V3_EXT_I2D i2d; +/* The following pair is used for string extensions */ + X509V3_EXT_I2S i2s; + X509V3_EXT_S2I s2i; +/* The following pair is used for multi-valued extensions */ + X509V3_EXT_I2V i2v; + X509V3_EXT_V2I v2i; +/* The following are used for raw extensions */ + X509V3_EXT_I2R i2r; + X509V3_EXT_R2I r2i; + void *usr_data; /* Any extension specific data */ +}; + +typedef struct X509V3_CONF_METHOD_st { + char *(*get_string) (void *db, const char *section, const char *value); + STACK_OF(CONF_VALUE) *(*get_section) (void *db, const char *section); + void (*free_string) (void *db, char *string); + void (*free_section) (void *db, STACK_OF(CONF_VALUE) *section); +} X509V3_CONF_METHOD; + +/* Context specific info */ +struct v3_ext_ctx { +# define CTX_TEST 0x1 +# define X509V3_CTX_REPLACE 0x2 + int flags; + X509 *issuer_cert; + X509 *subject_cert; + X509_REQ *subject_req; + X509_CRL *crl; + X509V3_CONF_METHOD *db_meth; + void *db; +/* Maybe more here */ +}; + +typedef struct v3_ext_method X509V3_EXT_METHOD; + +DEFINE_STACK_OF(X509V3_EXT_METHOD) + +/* ext_flags values */ +# define X509V3_EXT_DYNAMIC 0x1 +# define X509V3_EXT_CTX_DEP 0x2 +# define X509V3_EXT_MULTILINE 0x4 + +typedef BIT_STRING_BITNAME ENUMERATED_NAMES; + +typedef struct BASIC_CONSTRAINTS_st { + int ca; + ASN1_INTEGER *pathlen; +} BASIC_CONSTRAINTS; + +typedef struct PKEY_USAGE_PERIOD_st { + ASN1_GENERALIZEDTIME *notBefore; + ASN1_GENERALIZEDTIME *notAfter; +} PKEY_USAGE_PERIOD; + +typedef struct otherName_st { + ASN1_OBJECT *type_id; + ASN1_TYPE *value; +} OTHERNAME; + +typedef struct EDIPartyName_st { + ASN1_STRING *nameAssigner; + ASN1_STRING *partyName; +} EDIPARTYNAME; + +typedef struct GENERAL_NAME_st { +# define GEN_OTHERNAME 0 +# define GEN_EMAIL 1 +# define GEN_DNS 2 +# define GEN_X400 3 +# define GEN_DIRNAME 4 +# define GEN_EDIPARTY 5 +# define GEN_URI 6 +# define GEN_IPADD 7 +# define GEN_RID 8 + int type; + union { + char *ptr; + OTHERNAME *otherName; /* otherName */ + ASN1_IA5STRING *rfc822Name; + ASN1_IA5STRING *dNSName; + ASN1_TYPE *x400Address; + X509_NAME *directoryName; + EDIPARTYNAME *ediPartyName; + ASN1_IA5STRING *uniformResourceIdentifier; + ASN1_OCTET_STRING *iPAddress; + ASN1_OBJECT *registeredID; + /* Old names */ + ASN1_OCTET_STRING *ip; /* iPAddress */ + X509_NAME *dirn; /* dirn */ + ASN1_IA5STRING *ia5; /* rfc822Name, dNSName, + * uniformResourceIdentifier */ + ASN1_OBJECT *rid; /* registeredID */ + ASN1_TYPE *other; /* x400Address */ + } d; +} GENERAL_NAME; + +typedef struct ACCESS_DESCRIPTION_st { + ASN1_OBJECT *method; + GENERAL_NAME *location; +} ACCESS_DESCRIPTION; + +typedef STACK_OF(ACCESS_DESCRIPTION) AUTHORITY_INFO_ACCESS; + +typedef STACK_OF(ASN1_OBJECT) EXTENDED_KEY_USAGE; + +typedef STACK_OF(ASN1_INTEGER) TLS_FEATURE; + +DEFINE_STACK_OF(GENERAL_NAME) +typedef STACK_OF(GENERAL_NAME) GENERAL_NAMES; +DEFINE_STACK_OF(GENERAL_NAMES) + +DEFINE_STACK_OF(ACCESS_DESCRIPTION) + +typedef struct DIST_POINT_NAME_st { + int type; + union { + GENERAL_NAMES *fullname; + STACK_OF(X509_NAME_ENTRY) *relativename; + } name; +/* If relativename then this contains the full distribution point name */ + X509_NAME *dpname; +} DIST_POINT_NAME; +/* All existing reasons */ +# define CRLDP_ALL_REASONS 0x807f + +# define CRL_REASON_NONE -1 +# define CRL_REASON_UNSPECIFIED 0 +# define CRL_REASON_KEY_COMPROMISE 1 +# define CRL_REASON_CA_COMPROMISE 2 +# define CRL_REASON_AFFILIATION_CHANGED 3 +# define CRL_REASON_SUPERSEDED 4 +# define CRL_REASON_CESSATION_OF_OPERATION 5 +# define CRL_REASON_CERTIFICATE_HOLD 6 +# define CRL_REASON_REMOVE_FROM_CRL 8 +# define CRL_REASON_PRIVILEGE_WITHDRAWN 9 +# define CRL_REASON_AA_COMPROMISE 10 + +struct DIST_POINT_st { + DIST_POINT_NAME *distpoint; + ASN1_BIT_STRING *reasons; + GENERAL_NAMES *CRLissuer; + int dp_reasons; +}; + +typedef STACK_OF(DIST_POINT) CRL_DIST_POINTS; + +DEFINE_STACK_OF(DIST_POINT) + +struct AUTHORITY_KEYID_st { + ASN1_OCTET_STRING *keyid; + GENERAL_NAMES *issuer; + ASN1_INTEGER *serial; +}; + +/* Strong extranet structures */ + +typedef struct SXNET_ID_st { + ASN1_INTEGER *zone; + ASN1_OCTET_STRING *user; +} SXNETID; + +DEFINE_STACK_OF(SXNETID) + +typedef struct SXNET_st { + ASN1_INTEGER *version; + STACK_OF(SXNETID) *ids; +} SXNET; + +typedef struct NOTICEREF_st { + ASN1_STRING *organization; + STACK_OF(ASN1_INTEGER) *noticenos; +} NOTICEREF; + +typedef struct USERNOTICE_st { + NOTICEREF *noticeref; + ASN1_STRING *exptext; +} USERNOTICE; + +typedef struct POLICYQUALINFO_st { + ASN1_OBJECT *pqualid; + union { + ASN1_IA5STRING *cpsuri; + USERNOTICE *usernotice; + ASN1_TYPE *other; + } d; +} POLICYQUALINFO; + +DEFINE_STACK_OF(POLICYQUALINFO) + +typedef struct POLICYINFO_st { + ASN1_OBJECT *policyid; + STACK_OF(POLICYQUALINFO) *qualifiers; +} POLICYINFO; + +typedef STACK_OF(POLICYINFO) CERTIFICATEPOLICIES; + +DEFINE_STACK_OF(POLICYINFO) + +typedef struct POLICY_MAPPING_st { + ASN1_OBJECT *issuerDomainPolicy; + ASN1_OBJECT *subjectDomainPolicy; +} POLICY_MAPPING; + +DEFINE_STACK_OF(POLICY_MAPPING) + +typedef STACK_OF(POLICY_MAPPING) POLICY_MAPPINGS; + +typedef struct GENERAL_SUBTREE_st { + GENERAL_NAME *base; + ASN1_INTEGER *minimum; + ASN1_INTEGER *maximum; +} GENERAL_SUBTREE; + +DEFINE_STACK_OF(GENERAL_SUBTREE) + +struct NAME_CONSTRAINTS_st { + STACK_OF(GENERAL_SUBTREE) *permittedSubtrees; + STACK_OF(GENERAL_SUBTREE) *excludedSubtrees; +}; + +typedef struct POLICY_CONSTRAINTS_st { + ASN1_INTEGER *requireExplicitPolicy; + ASN1_INTEGER *inhibitPolicyMapping; +} POLICY_CONSTRAINTS; + +/* Proxy certificate structures, see RFC 3820 */ +typedef struct PROXY_POLICY_st { + ASN1_OBJECT *policyLanguage; + ASN1_OCTET_STRING *policy; +} PROXY_POLICY; + +typedef struct PROXY_CERT_INFO_EXTENSION_st { + ASN1_INTEGER *pcPathLengthConstraint; + PROXY_POLICY *proxyPolicy; +} PROXY_CERT_INFO_EXTENSION; + +DECLARE_ASN1_FUNCTIONS(PROXY_POLICY) +DECLARE_ASN1_FUNCTIONS(PROXY_CERT_INFO_EXTENSION) + +struct ISSUING_DIST_POINT_st { + DIST_POINT_NAME *distpoint; + int onlyuser; + int onlyCA; + ASN1_BIT_STRING *onlysomereasons; + int indirectCRL; + int onlyattr; +}; + +/* Values in idp_flags field */ +/* IDP present */ +# define IDP_PRESENT 0x1 +/* IDP values inconsistent */ +# define IDP_INVALID 0x2 +/* onlyuser true */ +# define IDP_ONLYUSER 0x4 +/* onlyCA true */ +# define IDP_ONLYCA 0x8 +/* onlyattr true */ +# define IDP_ONLYATTR 0x10 +/* indirectCRL true */ +# define IDP_INDIRECT 0x20 +/* onlysomereasons present */ +# define IDP_REASONS 0x40 + +# define X509V3_conf_err(val) ERR_add_error_data(6, \ + "section:", (val)->section, \ + ",name:", (val)->name, ",value:", (val)->value) + +# define X509V3_set_ctx_test(ctx) \ + X509V3_set_ctx(ctx, NULL, NULL, NULL, NULL, CTX_TEST) +# define X509V3_set_ctx_nodb(ctx) (ctx)->db = NULL; + +# define EXT_BITSTRING(nid, table) { nid, 0, ASN1_ITEM_ref(ASN1_BIT_STRING), \ + 0,0,0,0, \ + 0,0, \ + (X509V3_EXT_I2V)i2v_ASN1_BIT_STRING, \ + (X509V3_EXT_V2I)v2i_ASN1_BIT_STRING, \ + NULL, NULL, \ + table} + +# define EXT_IA5STRING(nid) { nid, 0, ASN1_ITEM_ref(ASN1_IA5STRING), \ + 0,0,0,0, \ + (X509V3_EXT_I2S)i2s_ASN1_IA5STRING, \ + (X509V3_EXT_S2I)s2i_ASN1_IA5STRING, \ + 0,0,0,0, \ + NULL} + +# define EXT_END { -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} + +/* X509_PURPOSE stuff */ + +# define EXFLAG_BCONS 0x1 +# define EXFLAG_KUSAGE 0x2 +# define EXFLAG_XKUSAGE 0x4 +# define EXFLAG_NSCERT 0x8 + +# define EXFLAG_CA 0x10 +/* Really self issued not necessarily self signed */ +# define EXFLAG_SI 0x20 +# define EXFLAG_V1 0x40 +# define EXFLAG_INVALID 0x80 +/* EXFLAG_SET is set to indicate that some values have been precomputed */ +# define EXFLAG_SET 0x100 +# define EXFLAG_CRITICAL 0x200 +# define EXFLAG_PROXY 0x400 + +# define EXFLAG_INVALID_POLICY 0x800 +# define EXFLAG_FRESHEST 0x1000 +/* Self signed */ +# define EXFLAG_SS 0x2000 + +# define KU_DIGITAL_SIGNATURE 0x0080 +# define KU_NON_REPUDIATION 0x0040 +# define KU_KEY_ENCIPHERMENT 0x0020 +# define KU_DATA_ENCIPHERMENT 0x0010 +# define KU_KEY_AGREEMENT 0x0008 +# define KU_KEY_CERT_SIGN 0x0004 +# define KU_CRL_SIGN 0x0002 +# define KU_ENCIPHER_ONLY 0x0001 +# define KU_DECIPHER_ONLY 0x8000 + +# define NS_SSL_CLIENT 0x80 +# define NS_SSL_SERVER 0x40 +# define NS_SMIME 0x20 +# define NS_OBJSIGN 0x10 +# define NS_SSL_CA 0x04 +# define NS_SMIME_CA 0x02 +# define NS_OBJSIGN_CA 0x01 +# define NS_ANY_CA (NS_SSL_CA|NS_SMIME_CA|NS_OBJSIGN_CA) + +# define XKU_SSL_SERVER 0x1 +# define XKU_SSL_CLIENT 0x2 +# define XKU_SMIME 0x4 +# define XKU_CODE_SIGN 0x8 +# define XKU_SGC 0x10 +# define XKU_OCSP_SIGN 0x20 +# define XKU_TIMESTAMP 0x40 +# define XKU_DVCS 0x80 +# define XKU_ANYEKU 0x100 + +# define X509_PURPOSE_DYNAMIC 0x1 +# define X509_PURPOSE_DYNAMIC_NAME 0x2 + +typedef struct x509_purpose_st { + int purpose; + int trust; /* Default trust ID */ + int flags; + int (*check_purpose) (const struct x509_purpose_st *, const X509 *, int); + char *name; + char *sname; + void *usr_data; +} X509_PURPOSE; + +# define X509_PURPOSE_SSL_CLIENT 1 +# define X509_PURPOSE_SSL_SERVER 2 +# define X509_PURPOSE_NS_SSL_SERVER 3 +# define X509_PURPOSE_SMIME_SIGN 4 +# define X509_PURPOSE_SMIME_ENCRYPT 5 +# define X509_PURPOSE_CRL_SIGN 6 +# define X509_PURPOSE_ANY 7 +# define X509_PURPOSE_OCSP_HELPER 8 +# define X509_PURPOSE_TIMESTAMP_SIGN 9 + +# define X509_PURPOSE_MIN 1 +# define X509_PURPOSE_MAX 9 + +/* Flags for X509V3_EXT_print() */ + +# define X509V3_EXT_UNKNOWN_MASK (0xfL << 16) +/* Return error for unknown extensions */ +# define X509V3_EXT_DEFAULT 0 +/* Print error for unknown extensions */ +# define X509V3_EXT_ERROR_UNKNOWN (1L << 16) +/* ASN1 parse unknown extensions */ +# define X509V3_EXT_PARSE_UNKNOWN (2L << 16) +/* BIO_dump unknown extensions */ +# define X509V3_EXT_DUMP_UNKNOWN (3L << 16) + +/* Flags for X509V3_add1_i2d */ + +# define X509V3_ADD_OP_MASK 0xfL +# define X509V3_ADD_DEFAULT 0L +# define X509V3_ADD_APPEND 1L +# define X509V3_ADD_REPLACE 2L +# define X509V3_ADD_REPLACE_EXISTING 3L +# define X509V3_ADD_KEEP_EXISTING 4L +# define X509V3_ADD_DELETE 5L +# define X509V3_ADD_SILENT 0x10 + +DEFINE_STACK_OF(X509_PURPOSE) + +DECLARE_ASN1_FUNCTIONS(BASIC_CONSTRAINTS) + +DECLARE_ASN1_FUNCTIONS(SXNET) +DECLARE_ASN1_FUNCTIONS(SXNETID) + +int SXNET_add_id_asc(SXNET **psx, const char *zone, const char *user, int userlen); +int SXNET_add_id_ulong(SXNET **psx, unsigned long lzone, const char *user, + int userlen); +int SXNET_add_id_INTEGER(SXNET **psx, ASN1_INTEGER *izone, const char *user, + int userlen); + +ASN1_OCTET_STRING *SXNET_get_id_asc(SXNET *sx, const char *zone); +ASN1_OCTET_STRING *SXNET_get_id_ulong(SXNET *sx, unsigned long lzone); +ASN1_OCTET_STRING *SXNET_get_id_INTEGER(SXNET *sx, ASN1_INTEGER *zone); + +DECLARE_ASN1_FUNCTIONS(AUTHORITY_KEYID) + +DECLARE_ASN1_FUNCTIONS(PKEY_USAGE_PERIOD) + +DECLARE_ASN1_FUNCTIONS(GENERAL_NAME) +GENERAL_NAME *GENERAL_NAME_dup(GENERAL_NAME *a); +int GENERAL_NAME_cmp(GENERAL_NAME *a, GENERAL_NAME *b); + +ASN1_BIT_STRING *v2i_ASN1_BIT_STRING(X509V3_EXT_METHOD *method, + X509V3_CTX *ctx, + STACK_OF(CONF_VALUE) *nval); +STACK_OF(CONF_VALUE) *i2v_ASN1_BIT_STRING(X509V3_EXT_METHOD *method, + ASN1_BIT_STRING *bits, + STACK_OF(CONF_VALUE) *extlist); +char *i2s_ASN1_IA5STRING(X509V3_EXT_METHOD *method, ASN1_IA5STRING *ia5); +ASN1_IA5STRING *s2i_ASN1_IA5STRING(X509V3_EXT_METHOD *method, + X509V3_CTX *ctx, const char *str); + +STACK_OF(CONF_VALUE) *i2v_GENERAL_NAME(X509V3_EXT_METHOD *method, + GENERAL_NAME *gen, + STACK_OF(CONF_VALUE) *ret); +int GENERAL_NAME_print(BIO *out, GENERAL_NAME *gen); + +DECLARE_ASN1_FUNCTIONS(GENERAL_NAMES) + +STACK_OF(CONF_VALUE) *i2v_GENERAL_NAMES(X509V3_EXT_METHOD *method, + GENERAL_NAMES *gen, + STACK_OF(CONF_VALUE) *extlist); +GENERAL_NAMES *v2i_GENERAL_NAMES(const X509V3_EXT_METHOD *method, + X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval); + +DECLARE_ASN1_FUNCTIONS(OTHERNAME) +DECLARE_ASN1_FUNCTIONS(EDIPARTYNAME) +int OTHERNAME_cmp(OTHERNAME *a, OTHERNAME *b); +void GENERAL_NAME_set0_value(GENERAL_NAME *a, int type, void *value); +void *GENERAL_NAME_get0_value(const GENERAL_NAME *a, int *ptype); +int GENERAL_NAME_set0_othername(GENERAL_NAME *gen, + ASN1_OBJECT *oid, ASN1_TYPE *value); +int GENERAL_NAME_get0_otherName(const GENERAL_NAME *gen, + ASN1_OBJECT **poid, ASN1_TYPE **pvalue); + +char *i2s_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, + const ASN1_OCTET_STRING *ia5); +ASN1_OCTET_STRING *s2i_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, + X509V3_CTX *ctx, const char *str); + +DECLARE_ASN1_FUNCTIONS(EXTENDED_KEY_USAGE) +int i2a_ACCESS_DESCRIPTION(BIO *bp, const ACCESS_DESCRIPTION *a); + +DECLARE_ASN1_ALLOC_FUNCTIONS(TLS_FEATURE) + +DECLARE_ASN1_FUNCTIONS(CERTIFICATEPOLICIES) +DECLARE_ASN1_FUNCTIONS(POLICYINFO) +DECLARE_ASN1_FUNCTIONS(POLICYQUALINFO) +DECLARE_ASN1_FUNCTIONS(USERNOTICE) +DECLARE_ASN1_FUNCTIONS(NOTICEREF) + +DECLARE_ASN1_FUNCTIONS(CRL_DIST_POINTS) +DECLARE_ASN1_FUNCTIONS(DIST_POINT) +DECLARE_ASN1_FUNCTIONS(DIST_POINT_NAME) +DECLARE_ASN1_FUNCTIONS(ISSUING_DIST_POINT) + +int DIST_POINT_set_dpname(DIST_POINT_NAME *dpn, X509_NAME *iname); + +int NAME_CONSTRAINTS_check(X509 *x, NAME_CONSTRAINTS *nc); +int NAME_CONSTRAINTS_check_CN(X509 *x, NAME_CONSTRAINTS *nc); + +DECLARE_ASN1_FUNCTIONS(ACCESS_DESCRIPTION) +DECLARE_ASN1_FUNCTIONS(AUTHORITY_INFO_ACCESS) + +DECLARE_ASN1_ITEM(POLICY_MAPPING) +DECLARE_ASN1_ALLOC_FUNCTIONS(POLICY_MAPPING) +DECLARE_ASN1_ITEM(POLICY_MAPPINGS) + +DECLARE_ASN1_ITEM(GENERAL_SUBTREE) +DECLARE_ASN1_ALLOC_FUNCTIONS(GENERAL_SUBTREE) + +DECLARE_ASN1_ITEM(NAME_CONSTRAINTS) +DECLARE_ASN1_ALLOC_FUNCTIONS(NAME_CONSTRAINTS) + +DECLARE_ASN1_ALLOC_FUNCTIONS(POLICY_CONSTRAINTS) +DECLARE_ASN1_ITEM(POLICY_CONSTRAINTS) + +GENERAL_NAME *a2i_GENERAL_NAME(GENERAL_NAME *out, + const X509V3_EXT_METHOD *method, + X509V3_CTX *ctx, int gen_type, + const char *value, int is_nc); + +# ifdef HEADER_CONF_H +GENERAL_NAME *v2i_GENERAL_NAME(const X509V3_EXT_METHOD *method, + X509V3_CTX *ctx, CONF_VALUE *cnf); +GENERAL_NAME *v2i_GENERAL_NAME_ex(GENERAL_NAME *out, + const X509V3_EXT_METHOD *method, + X509V3_CTX *ctx, CONF_VALUE *cnf, + int is_nc); +void X509V3_conf_free(CONF_VALUE *val); + +X509_EXTENSION *X509V3_EXT_nconf_nid(CONF *conf, X509V3_CTX *ctx, int ext_nid, + const char *value); +X509_EXTENSION *X509V3_EXT_nconf(CONF *conf, X509V3_CTX *ctx, const char *name, + const char *value); +int X509V3_EXT_add_nconf_sk(CONF *conf, X509V3_CTX *ctx, const char *section, + STACK_OF(X509_EXTENSION) **sk); +int X509V3_EXT_add_nconf(CONF *conf, X509V3_CTX *ctx, const char *section, + X509 *cert); +int X509V3_EXT_REQ_add_nconf(CONF *conf, X509V3_CTX *ctx, const char *section, + X509_REQ *req); +int X509V3_EXT_CRL_add_nconf(CONF *conf, X509V3_CTX *ctx, const char *section, + X509_CRL *crl); + +X509_EXTENSION *X509V3_EXT_conf_nid(LHASH_OF(CONF_VALUE) *conf, + X509V3_CTX *ctx, int ext_nid, + const char *value); +X509_EXTENSION *X509V3_EXT_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, + const char *name, const char *value); +int X509V3_EXT_add_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, + const char *section, X509 *cert); +int X509V3_EXT_REQ_add_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, + const char *section, X509_REQ *req); +int X509V3_EXT_CRL_add_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, + const char *section, X509_CRL *crl); + +int X509V3_add_value_bool_nf(const char *name, int asn1_bool, + STACK_OF(CONF_VALUE) **extlist); +int X509V3_get_value_bool(const CONF_VALUE *value, int *asn1_bool); +int X509V3_get_value_int(const CONF_VALUE *value, ASN1_INTEGER **aint); +void X509V3_set_nconf(X509V3_CTX *ctx, CONF *conf); +void X509V3_set_conf_lhash(X509V3_CTX *ctx, LHASH_OF(CONF_VALUE) *lhash); +# endif + +char *X509V3_get_string(X509V3_CTX *ctx, const char *name, const char *section); +STACK_OF(CONF_VALUE) *X509V3_get_section(X509V3_CTX *ctx, const char *section); +void X509V3_string_free(X509V3_CTX *ctx, char *str); +void X509V3_section_free(X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *section); +void X509V3_set_ctx(X509V3_CTX *ctx, X509 *issuer, X509 *subject, + X509_REQ *req, X509_CRL *crl, int flags); + +int X509V3_add_value(const char *name, const char *value, + STACK_OF(CONF_VALUE) **extlist); +int X509V3_add_value_uchar(const char *name, const unsigned char *value, + STACK_OF(CONF_VALUE) **extlist); +int X509V3_add_value_bool(const char *name, int asn1_bool, + STACK_OF(CONF_VALUE) **extlist); +int X509V3_add_value_int(const char *name, const ASN1_INTEGER *aint, + STACK_OF(CONF_VALUE) **extlist); +char *i2s_ASN1_INTEGER(X509V3_EXT_METHOD *meth, const ASN1_INTEGER *aint); +ASN1_INTEGER *s2i_ASN1_INTEGER(X509V3_EXT_METHOD *meth, const char *value); +char *i2s_ASN1_ENUMERATED(X509V3_EXT_METHOD *meth, const ASN1_ENUMERATED *aint); +char *i2s_ASN1_ENUMERATED_TABLE(X509V3_EXT_METHOD *meth, + const ASN1_ENUMERATED *aint); +int X509V3_EXT_add(X509V3_EXT_METHOD *ext); +int X509V3_EXT_add_list(X509V3_EXT_METHOD *extlist); +int X509V3_EXT_add_alias(int nid_to, int nid_from); +void X509V3_EXT_cleanup(void); + +const X509V3_EXT_METHOD *X509V3_EXT_get(X509_EXTENSION *ext); +const X509V3_EXT_METHOD *X509V3_EXT_get_nid(int nid); +int X509V3_add_standard_extensions(void); +STACK_OF(CONF_VALUE) *X509V3_parse_list(const char *line); +void *X509V3_EXT_d2i(X509_EXTENSION *ext); +void *X509V3_get_d2i(const STACK_OF(X509_EXTENSION) *x, int nid, int *crit, + int *idx); + +X509_EXTENSION *X509V3_EXT_i2d(int ext_nid, int crit, void *ext_struc); +int X509V3_add1_i2d(STACK_OF(X509_EXTENSION) **x, int nid, void *value, + int crit, unsigned long flags); + +#if OPENSSL_API_COMPAT < 0x10100000L +/* The new declarations are in crypto.h, but the old ones were here. */ +# define hex_to_string OPENSSL_buf2hexstr +# define string_to_hex OPENSSL_hexstr2buf +#endif + +void X509V3_EXT_val_prn(BIO *out, STACK_OF(CONF_VALUE) *val, int indent, + int ml); +int X509V3_EXT_print(BIO *out, X509_EXTENSION *ext, unsigned long flag, + int indent); +#ifndef OPENSSL_NO_STDIO +int X509V3_EXT_print_fp(FILE *out, X509_EXTENSION *ext, int flag, int indent); +#endif +int X509V3_extensions_print(BIO *out, const char *title, + const STACK_OF(X509_EXTENSION) *exts, + unsigned long flag, int indent); + +int X509_check_ca(X509 *x); +int X509_check_purpose(X509 *x, int id, int ca); +int X509_supported_extension(X509_EXTENSION *ex); +int X509_PURPOSE_set(int *p, int purpose); +int X509_check_issued(X509 *issuer, X509 *subject); +int X509_check_akid(X509 *issuer, AUTHORITY_KEYID *akid); +void X509_set_proxy_flag(X509 *x); +void X509_set_proxy_pathlen(X509 *x, long l); +long X509_get_proxy_pathlen(X509 *x); + +uint32_t X509_get_extension_flags(X509 *x); +uint32_t X509_get_key_usage(X509 *x); +uint32_t X509_get_extended_key_usage(X509 *x); +const ASN1_OCTET_STRING *X509_get0_subject_key_id(X509 *x); +const ASN1_OCTET_STRING *X509_get0_authority_key_id(X509 *x); +const GENERAL_NAMES *X509_get0_authority_issuer(X509 *x); +const ASN1_INTEGER *X509_get0_authority_serial(X509 *x); + +int X509_PURPOSE_get_count(void); +X509_PURPOSE *X509_PURPOSE_get0(int idx); +int X509_PURPOSE_get_by_sname(const char *sname); +int X509_PURPOSE_get_by_id(int id); +int X509_PURPOSE_add(int id, int trust, int flags, + int (*ck) (const X509_PURPOSE *, const X509 *, int), + const char *name, const char *sname, void *arg); +char *X509_PURPOSE_get0_name(const X509_PURPOSE *xp); +char *X509_PURPOSE_get0_sname(const X509_PURPOSE *xp); +int X509_PURPOSE_get_trust(const X509_PURPOSE *xp); +void X509_PURPOSE_cleanup(void); +int X509_PURPOSE_get_id(const X509_PURPOSE *); + +STACK_OF(OPENSSL_STRING) *X509_get1_email(X509 *x); +STACK_OF(OPENSSL_STRING) *X509_REQ_get1_email(X509_REQ *x); +void X509_email_free(STACK_OF(OPENSSL_STRING) *sk); +STACK_OF(OPENSSL_STRING) *X509_get1_ocsp(X509 *x); +/* Flags for X509_check_* functions */ + +/* + * Always check subject name for host match even if subject alt names present + */ +# define X509_CHECK_FLAG_ALWAYS_CHECK_SUBJECT 0x1 +/* Disable wildcard matching for dnsName fields and common name. */ +# define X509_CHECK_FLAG_NO_WILDCARDS 0x2 +/* Wildcards must not match a partial label. */ +# define X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS 0x4 +/* Allow (non-partial) wildcards to match multiple labels. */ +# define X509_CHECK_FLAG_MULTI_LABEL_WILDCARDS 0x8 +/* Constraint verifier subdomain patterns to match a single labels. */ +# define X509_CHECK_FLAG_SINGLE_LABEL_SUBDOMAINS 0x10 +/* Never check the subject CN */ +# define X509_CHECK_FLAG_NEVER_CHECK_SUBJECT 0x20 +/* + * Match reference identifiers starting with "." to any sub-domain. + * This is a non-public flag, turned on implicitly when the subject + * reference identity is a DNS name. + */ +# define _X509_CHECK_FLAG_DOT_SUBDOMAINS 0x8000 + +int X509_check_host(X509 *x, const char *chk, size_t chklen, + unsigned int flags, char **peername); +int X509_check_email(X509 *x, const char *chk, size_t chklen, + unsigned int flags); +int X509_check_ip(X509 *x, const unsigned char *chk, size_t chklen, + unsigned int flags); +int X509_check_ip_asc(X509 *x, const char *ipasc, unsigned int flags); + +ASN1_OCTET_STRING *a2i_IPADDRESS(const char *ipasc); +ASN1_OCTET_STRING *a2i_IPADDRESS_NC(const char *ipasc); +int X509V3_NAME_from_section(X509_NAME *nm, STACK_OF(CONF_VALUE) *dn_sk, + unsigned long chtype); + +void X509_POLICY_NODE_print(BIO *out, X509_POLICY_NODE *node, int indent); +DEFINE_STACK_OF(X509_POLICY_NODE) + +#ifndef OPENSSL_NO_RFC3779 +typedef struct ASRange_st { + ASN1_INTEGER *min, *max; +} ASRange; + +# define ASIdOrRange_id 0 +# define ASIdOrRange_range 1 + +typedef struct ASIdOrRange_st { + int type; + union { + ASN1_INTEGER *id; + ASRange *range; + } u; +} ASIdOrRange; + +typedef STACK_OF(ASIdOrRange) ASIdOrRanges; +DEFINE_STACK_OF(ASIdOrRange) + +# define ASIdentifierChoice_inherit 0 +# define ASIdentifierChoice_asIdsOrRanges 1 + +typedef struct ASIdentifierChoice_st { + int type; + union { + ASN1_NULL *inherit; + ASIdOrRanges *asIdsOrRanges; + } u; +} ASIdentifierChoice; + +typedef struct ASIdentifiers_st { + ASIdentifierChoice *asnum, *rdi; +} ASIdentifiers; + +DECLARE_ASN1_FUNCTIONS(ASRange) +DECLARE_ASN1_FUNCTIONS(ASIdOrRange) +DECLARE_ASN1_FUNCTIONS(ASIdentifierChoice) +DECLARE_ASN1_FUNCTIONS(ASIdentifiers) + +typedef struct IPAddressRange_st { + ASN1_BIT_STRING *min, *max; +} IPAddressRange; + +# define IPAddressOrRange_addressPrefix 0 +# define IPAddressOrRange_addressRange 1 + +typedef struct IPAddressOrRange_st { + int type; + union { + ASN1_BIT_STRING *addressPrefix; + IPAddressRange *addressRange; + } u; +} IPAddressOrRange; + +typedef STACK_OF(IPAddressOrRange) IPAddressOrRanges; +DEFINE_STACK_OF(IPAddressOrRange) + +# define IPAddressChoice_inherit 0 +# define IPAddressChoice_addressesOrRanges 1 + +typedef struct IPAddressChoice_st { + int type; + union { + ASN1_NULL *inherit; + IPAddressOrRanges *addressesOrRanges; + } u; +} IPAddressChoice; + +typedef struct IPAddressFamily_st { + ASN1_OCTET_STRING *addressFamily; + IPAddressChoice *ipAddressChoice; +} IPAddressFamily; + +typedef STACK_OF(IPAddressFamily) IPAddrBlocks; +DEFINE_STACK_OF(IPAddressFamily) + +DECLARE_ASN1_FUNCTIONS(IPAddressRange) +DECLARE_ASN1_FUNCTIONS(IPAddressOrRange) +DECLARE_ASN1_FUNCTIONS(IPAddressChoice) +DECLARE_ASN1_FUNCTIONS(IPAddressFamily) + +/* + * API tag for elements of the ASIdentifer SEQUENCE. + */ +# define V3_ASID_ASNUM 0 +# define V3_ASID_RDI 1 + +/* + * AFI values, assigned by IANA. It'd be nice to make the AFI + * handling code totally generic, but there are too many little things + * that would need to be defined for other address families for it to + * be worth the trouble. + */ +# define IANA_AFI_IPV4 1 +# define IANA_AFI_IPV6 2 + +/* + * Utilities to construct and extract values from RFC3779 extensions, + * since some of the encodings (particularly for IP address prefixes + * and ranges) are a bit tedious to work with directly. + */ +int X509v3_asid_add_inherit(ASIdentifiers *asid, int which); +int X509v3_asid_add_id_or_range(ASIdentifiers *asid, int which, + ASN1_INTEGER *min, ASN1_INTEGER *max); +int X509v3_addr_add_inherit(IPAddrBlocks *addr, + const unsigned afi, const unsigned *safi); +int X509v3_addr_add_prefix(IPAddrBlocks *addr, + const unsigned afi, const unsigned *safi, + unsigned char *a, const int prefixlen); +int X509v3_addr_add_range(IPAddrBlocks *addr, + const unsigned afi, const unsigned *safi, + unsigned char *min, unsigned char *max); +unsigned X509v3_addr_get_afi(const IPAddressFamily *f); +int X509v3_addr_get_range(IPAddressOrRange *aor, const unsigned afi, + unsigned char *min, unsigned char *max, + const int length); + +/* + * Canonical forms. + */ +int X509v3_asid_is_canonical(ASIdentifiers *asid); +int X509v3_addr_is_canonical(IPAddrBlocks *addr); +int X509v3_asid_canonize(ASIdentifiers *asid); +int X509v3_addr_canonize(IPAddrBlocks *addr); + +/* + * Tests for inheritance and containment. + */ +int X509v3_asid_inherits(ASIdentifiers *asid); +int X509v3_addr_inherits(IPAddrBlocks *addr); +int X509v3_asid_subset(ASIdentifiers *a, ASIdentifiers *b); +int X509v3_addr_subset(IPAddrBlocks *a, IPAddrBlocks *b); + +/* + * Check whether RFC 3779 extensions nest properly in chains. + */ +int X509v3_asid_validate_path(X509_STORE_CTX *); +int X509v3_addr_validate_path(X509_STORE_CTX *); +int X509v3_asid_validate_resource_set(STACK_OF(X509) *chain, + ASIdentifiers *ext, + int allow_inheritance); +int X509v3_addr_validate_resource_set(STACK_OF(X509) *chain, + IPAddrBlocks *ext, int allow_inheritance); + +#endif /* OPENSSL_NO_RFC3779 */ + +DEFINE_STACK_OF(ASN1_STRING) + +/* + * Admission Syntax + */ +typedef struct NamingAuthority_st NAMING_AUTHORITY; +typedef struct ProfessionInfo_st PROFESSION_INFO; +typedef struct Admissions_st ADMISSIONS; +typedef struct AdmissionSyntax_st ADMISSION_SYNTAX; +DECLARE_ASN1_FUNCTIONS(NAMING_AUTHORITY) +DECLARE_ASN1_FUNCTIONS(PROFESSION_INFO) +DECLARE_ASN1_FUNCTIONS(ADMISSIONS) +DECLARE_ASN1_FUNCTIONS(ADMISSION_SYNTAX) +DEFINE_STACK_OF(ADMISSIONS) +DEFINE_STACK_OF(PROFESSION_INFO) +typedef STACK_OF(PROFESSION_INFO) PROFESSION_INFOS; + +const ASN1_OBJECT *NAMING_AUTHORITY_get0_authorityId( + const NAMING_AUTHORITY *n); +const ASN1_IA5STRING *NAMING_AUTHORITY_get0_authorityURL( + const NAMING_AUTHORITY *n); +const ASN1_STRING *NAMING_AUTHORITY_get0_authorityText( + const NAMING_AUTHORITY *n); +void NAMING_AUTHORITY_set0_authorityId(NAMING_AUTHORITY *n, + ASN1_OBJECT* namingAuthorityId); +void NAMING_AUTHORITY_set0_authorityURL(NAMING_AUTHORITY *n, + ASN1_IA5STRING* namingAuthorityUrl); +void NAMING_AUTHORITY_set0_authorityText(NAMING_AUTHORITY *n, + ASN1_STRING* namingAuthorityText); + +const GENERAL_NAME *ADMISSION_SYNTAX_get0_admissionAuthority( + const ADMISSION_SYNTAX *as); +void ADMISSION_SYNTAX_set0_admissionAuthority( + ADMISSION_SYNTAX *as, GENERAL_NAME *aa); +const STACK_OF(ADMISSIONS) *ADMISSION_SYNTAX_get0_contentsOfAdmissions( + const ADMISSION_SYNTAX *as); +void ADMISSION_SYNTAX_set0_contentsOfAdmissions( + ADMISSION_SYNTAX *as, STACK_OF(ADMISSIONS) *a); +const GENERAL_NAME *ADMISSIONS_get0_admissionAuthority(const ADMISSIONS *a); +void ADMISSIONS_set0_admissionAuthority(ADMISSIONS *a, GENERAL_NAME *aa); +const NAMING_AUTHORITY *ADMISSIONS_get0_namingAuthority(const ADMISSIONS *a); +void ADMISSIONS_set0_namingAuthority(ADMISSIONS *a, NAMING_AUTHORITY *na); +const PROFESSION_INFOS *ADMISSIONS_get0_professionInfos(const ADMISSIONS *a); +void ADMISSIONS_set0_professionInfos(ADMISSIONS *a, PROFESSION_INFOS *pi); +const ASN1_OCTET_STRING *PROFESSION_INFO_get0_addProfessionInfo( + const PROFESSION_INFO *pi); +void PROFESSION_INFO_set0_addProfessionInfo( + PROFESSION_INFO *pi, ASN1_OCTET_STRING *aos); +const NAMING_AUTHORITY *PROFESSION_INFO_get0_namingAuthority( + const PROFESSION_INFO *pi); +void PROFESSION_INFO_set0_namingAuthority( + PROFESSION_INFO *pi, NAMING_AUTHORITY *na); +const STACK_OF(ASN1_STRING) *PROFESSION_INFO_get0_professionItems( + const PROFESSION_INFO *pi); +void PROFESSION_INFO_set0_professionItems( + PROFESSION_INFO *pi, STACK_OF(ASN1_STRING) *as); +const STACK_OF(ASN1_OBJECT) *PROFESSION_INFO_get0_professionOIDs( + const PROFESSION_INFO *pi); +void PROFESSION_INFO_set0_professionOIDs( + PROFESSION_INFO *pi, STACK_OF(ASN1_OBJECT) *po); +const ASN1_PRINTABLESTRING *PROFESSION_INFO_get0_registrationNumber( + const PROFESSION_INFO *pi); +void PROFESSION_INFO_set0_registrationNumber( + PROFESSION_INFO *pi, ASN1_PRINTABLESTRING *rn); + +# ifdef __cplusplus +} +# endif +#endif diff --git a/MediaClient/MediaClient/openssl/include/openssl/x509v3err.h b/MediaClient/MediaClient/openssl/include/openssl/x509v3err.h new file mode 100644 index 0000000..5f25442 --- /dev/null +++ b/MediaClient/MediaClient/openssl/include/openssl/x509v3err.h @@ -0,0 +1,162 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_X509V3ERR_H +# define HEADER_X509V3ERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_X509V3_strings(void); + +/* + * X509V3 function codes. + */ +# define X509V3_F_A2I_GENERAL_NAME 164 +# define X509V3_F_ADDR_VALIDATE_PATH_INTERNAL 166 +# define X509V3_F_ASIDENTIFIERCHOICE_CANONIZE 161 +# define X509V3_F_ASIDENTIFIERCHOICE_IS_CANONICAL 162 +# define X509V3_F_BIGNUM_TO_STRING 167 +# define X509V3_F_COPY_EMAIL 122 +# define X509V3_F_COPY_ISSUER 123 +# define X509V3_F_DO_DIRNAME 144 +# define X509V3_F_DO_EXT_I2D 135 +# define X509V3_F_DO_EXT_NCONF 151 +# define X509V3_F_GNAMES_FROM_SECTNAME 156 +# define X509V3_F_I2S_ASN1_ENUMERATED 121 +# define X509V3_F_I2S_ASN1_IA5STRING 149 +# define X509V3_F_I2S_ASN1_INTEGER 120 +# define X509V3_F_I2V_AUTHORITY_INFO_ACCESS 138 +# define X509V3_F_LEVEL_ADD_NODE 168 +# define X509V3_F_NOTICE_SECTION 132 +# define X509V3_F_NREF_NOS 133 +# define X509V3_F_POLICY_CACHE_CREATE 169 +# define X509V3_F_POLICY_CACHE_NEW 170 +# define X509V3_F_POLICY_DATA_NEW 171 +# define X509V3_F_POLICY_SECTION 131 +# define X509V3_F_PROCESS_PCI_VALUE 150 +# define X509V3_F_R2I_CERTPOL 130 +# define X509V3_F_R2I_PCI 155 +# define X509V3_F_S2I_ASN1_IA5STRING 100 +# define X509V3_F_S2I_ASN1_INTEGER 108 +# define X509V3_F_S2I_ASN1_OCTET_STRING 112 +# define X509V3_F_S2I_SKEY_ID 115 +# define X509V3_F_SET_DIST_POINT_NAME 158 +# define X509V3_F_SXNET_ADD_ID_ASC 125 +# define X509V3_F_SXNET_ADD_ID_INTEGER 126 +# define X509V3_F_SXNET_ADD_ID_ULONG 127 +# define X509V3_F_SXNET_GET_ID_ASC 128 +# define X509V3_F_SXNET_GET_ID_ULONG 129 +# define X509V3_F_TREE_INIT 172 +# define X509V3_F_V2I_ASIDENTIFIERS 163 +# define X509V3_F_V2I_ASN1_BIT_STRING 101 +# define X509V3_F_V2I_AUTHORITY_INFO_ACCESS 139 +# define X509V3_F_V2I_AUTHORITY_KEYID 119 +# define X509V3_F_V2I_BASIC_CONSTRAINTS 102 +# define X509V3_F_V2I_CRLD 134 +# define X509V3_F_V2I_EXTENDED_KEY_USAGE 103 +# define X509V3_F_V2I_GENERAL_NAMES 118 +# define X509V3_F_V2I_GENERAL_NAME_EX 117 +# define X509V3_F_V2I_IDP 157 +# define X509V3_F_V2I_IPADDRBLOCKS 159 +# define X509V3_F_V2I_ISSUER_ALT 153 +# define X509V3_F_V2I_NAME_CONSTRAINTS 147 +# define X509V3_F_V2I_POLICY_CONSTRAINTS 146 +# define X509V3_F_V2I_POLICY_MAPPINGS 145 +# define X509V3_F_V2I_SUBJECT_ALT 154 +# define X509V3_F_V2I_TLS_FEATURE 165 +# define X509V3_F_V3_GENERIC_EXTENSION 116 +# define X509V3_F_X509V3_ADD1_I2D 140 +# define X509V3_F_X509V3_ADD_VALUE 105 +# define X509V3_F_X509V3_EXT_ADD 104 +# define X509V3_F_X509V3_EXT_ADD_ALIAS 106 +# define X509V3_F_X509V3_EXT_I2D 136 +# define X509V3_F_X509V3_EXT_NCONF 152 +# define X509V3_F_X509V3_GET_SECTION 142 +# define X509V3_F_X509V3_GET_STRING 143 +# define X509V3_F_X509V3_GET_VALUE_BOOL 110 +# define X509V3_F_X509V3_PARSE_LIST 109 +# define X509V3_F_X509_PURPOSE_ADD 137 +# define X509V3_F_X509_PURPOSE_SET 141 + +/* + * X509V3 reason codes. + */ +# define X509V3_R_BAD_IP_ADDRESS 118 +# define X509V3_R_BAD_OBJECT 119 +# define X509V3_R_BN_DEC2BN_ERROR 100 +# define X509V3_R_BN_TO_ASN1_INTEGER_ERROR 101 +# define X509V3_R_DIRNAME_ERROR 149 +# define X509V3_R_DISTPOINT_ALREADY_SET 160 +# define X509V3_R_DUPLICATE_ZONE_ID 133 +# define X509V3_R_ERROR_CONVERTING_ZONE 131 +# define X509V3_R_ERROR_CREATING_EXTENSION 144 +# define X509V3_R_ERROR_IN_EXTENSION 128 +# define X509V3_R_EXPECTED_A_SECTION_NAME 137 +# define X509V3_R_EXTENSION_EXISTS 145 +# define X509V3_R_EXTENSION_NAME_ERROR 115 +# define X509V3_R_EXTENSION_NOT_FOUND 102 +# define X509V3_R_EXTENSION_SETTING_NOT_SUPPORTED 103 +# define X509V3_R_EXTENSION_VALUE_ERROR 116 +# define X509V3_R_ILLEGAL_EMPTY_EXTENSION 151 +# define X509V3_R_INCORRECT_POLICY_SYNTAX_TAG 152 +# define X509V3_R_INVALID_ASNUMBER 162 +# define X509V3_R_INVALID_ASRANGE 163 +# define X509V3_R_INVALID_BOOLEAN_STRING 104 +# define X509V3_R_INVALID_EXTENSION_STRING 105 +# define X509V3_R_INVALID_INHERITANCE 165 +# define X509V3_R_INVALID_IPADDRESS 166 +# define X509V3_R_INVALID_MULTIPLE_RDNS 161 +# define X509V3_R_INVALID_NAME 106 +# define X509V3_R_INVALID_NULL_ARGUMENT 107 +# define X509V3_R_INVALID_NULL_NAME 108 +# define X509V3_R_INVALID_NULL_VALUE 109 +# define X509V3_R_INVALID_NUMBER 140 +# define X509V3_R_INVALID_NUMBERS 141 +# define X509V3_R_INVALID_OBJECT_IDENTIFIER 110 +# define X509V3_R_INVALID_OPTION 138 +# define X509V3_R_INVALID_POLICY_IDENTIFIER 134 +# define X509V3_R_INVALID_PROXY_POLICY_SETTING 153 +# define X509V3_R_INVALID_PURPOSE 146 +# define X509V3_R_INVALID_SAFI 164 +# define X509V3_R_INVALID_SECTION 135 +# define X509V3_R_INVALID_SYNTAX 143 +# define X509V3_R_ISSUER_DECODE_ERROR 126 +# define X509V3_R_MISSING_VALUE 124 +# define X509V3_R_NEED_ORGANIZATION_AND_NUMBERS 142 +# define X509V3_R_NO_CONFIG_DATABASE 136 +# define X509V3_R_NO_ISSUER_CERTIFICATE 121 +# define X509V3_R_NO_ISSUER_DETAILS 127 +# define X509V3_R_NO_POLICY_IDENTIFIER 139 +# define X509V3_R_NO_PROXY_CERT_POLICY_LANGUAGE_DEFINED 154 +# define X509V3_R_NO_PUBLIC_KEY 114 +# define X509V3_R_NO_SUBJECT_DETAILS 125 +# define X509V3_R_OPERATION_NOT_DEFINED 148 +# define X509V3_R_OTHERNAME_ERROR 147 +# define X509V3_R_POLICY_LANGUAGE_ALREADY_DEFINED 155 +# define X509V3_R_POLICY_PATH_LENGTH 156 +# define X509V3_R_POLICY_PATH_LENGTH_ALREADY_DEFINED 157 +# define X509V3_R_POLICY_WHEN_PROXY_LANGUAGE_REQUIRES_NO_POLICY 159 +# define X509V3_R_SECTION_NOT_FOUND 150 +# define X509V3_R_UNABLE_TO_GET_ISSUER_DETAILS 122 +# define X509V3_R_UNABLE_TO_GET_ISSUER_KEYID 123 +# define X509V3_R_UNKNOWN_BIT_STRING_ARGUMENT 111 +# define X509V3_R_UNKNOWN_EXTENSION 129 +# define X509V3_R_UNKNOWN_EXTENSION_NAME 130 +# define X509V3_R_UNKNOWN_OPTION 120 +# define X509V3_R_UNSUPPORTED_OPTION 117 +# define X509V3_R_UNSUPPORTED_TYPE 167 +# define X509V3_R_USER_TOO_LONG 132 + +#endif diff --git a/MediaClient/MediaClient/openssl/lib/linux/libcrypto.so.1.1 b/MediaClient/MediaClient/openssl/lib/linux/libcrypto.so.1.1 new file mode 100644 index 0000000..0741b46 Binary files /dev/null and b/MediaClient/MediaClient/openssl/lib/linux/libcrypto.so.1.1 differ diff --git a/MediaClient/MediaClient/openssl/lib/linux/libssl.so.1.1 b/MediaClient/MediaClient/openssl/lib/linux/libssl.so.1.1 new file mode 100644 index 0000000..f0d49a7 Binary files /dev/null and b/MediaClient/MediaClient/openssl/lib/linux/libssl.so.1.1 differ diff --git a/MediaClient/MediaClient/rtmp/amf.c b/MediaClient/MediaClient/rtmp/amf.c new file mode 100644 index 0000000..b402410 --- /dev/null +++ b/MediaClient/MediaClient/rtmp/amf.c @@ -0,0 +1,1311 @@ +/* + * Copyright (C) 2005-2008 Team XBMC + * http://www.xbmc.org + * Copyright (C) 2008-2009 Andrej Stepanchuk + * Copyright (C) 2009-2010 Howard Chu + * + * This file is part of librtmp. + * + * librtmp is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1, + * or (at your option) any later version. + * + * librtmp is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with librtmp see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * http://www.gnu.org/copyleft/lgpl.html + */ + +#include +#include +#include + +#include "rtmp_sys.h" +#include "amf.h" +#include "log.h" +#include "bytes.h" + +static const AMFObjectProperty AMFProp_Invalid = { {0, 0}, AMF_INVALID }; +static const AMFObject AMFObj_Invalid = { 0, 0 }; +static const AVal AV_empty = { 0, 0 }; + +/* Data is Big-Endian */ +unsigned short +AMF_DecodeInt16(const char *data) +{ + unsigned char *c = (unsigned char *) data; + unsigned short val; + val = (c[0] << 8) | c[1]; + return val; +} + +unsigned int +AMF_DecodeInt24(const char *data) +{ + unsigned char *c = (unsigned char *) data; + unsigned int val; + val = (c[0] << 16) | (c[1] << 8) | c[2]; + return val; +} + +unsigned int +AMF_DecodeInt32(const char *data) +{ + unsigned char *c = (unsigned char *)data; + unsigned int val; + val = (c[0] << 24) | (c[1] << 16) | (c[2] << 8) | c[3]; + return val; +} + +void +AMF_DecodeString(const char *data, AVal *bv) +{ + bv->av_len = AMF_DecodeInt16(data); + bv->av_val = (bv->av_len > 0) ? (char *)data + 2 : NULL; +} + +void +AMF_DecodeLongString(const char *data, AVal *bv) +{ + bv->av_len = AMF_DecodeInt32(data); + bv->av_val = (bv->av_len > 0) ? (char *)data + 4 : NULL; +} + +double +AMF_DecodeNumber(const char *data) +{ + double dVal; +#if __FLOAT_WORD_ORDER == __BYTE_ORDER +#if __BYTE_ORDER == __BIG_ENDIAN + memcpy(&dVal, data, 8); +#elif __BYTE_ORDER == __LITTLE_ENDIAN + unsigned char *ci, *co; + ci = (unsigned char *)data; + co = (unsigned char *)&dVal; + co[0] = ci[7]; + co[1] = ci[6]; + co[2] = ci[5]; + co[3] = ci[4]; + co[4] = ci[3]; + co[5] = ci[2]; + co[6] = ci[1]; + co[7] = ci[0]; +#endif +#else +#if __BYTE_ORDER == __LITTLE_ENDIAN /* __FLOAT_WORD_ORER == __BIG_ENDIAN */ + unsigned char *ci, *co; + ci = (unsigned char *)data; + co = (unsigned char *)&dVal; + co[0] = ci[3]; + co[1] = ci[2]; + co[2] = ci[1]; + co[3] = ci[0]; + co[4] = ci[7]; + co[5] = ci[6]; + co[6] = ci[5]; + co[7] = ci[4]; +#else /* __BYTE_ORDER == __BIG_ENDIAN && __FLOAT_WORD_ORER == __LITTLE_ENDIAN */ + unsigned char *ci, *co; + ci = (unsigned char *)data; + co = (unsigned char *)&dVal; + co[0] = ci[4]; + co[1] = ci[5]; + co[2] = ci[6]; + co[3] = ci[7]; + co[4] = ci[0]; + co[5] = ci[1]; + co[6] = ci[2]; + co[7] = ci[3]; +#endif +#endif + return dVal; +} + +int +AMF_DecodeBoolean(const char *data) +{ + return *data != 0; +} + +char * +AMF_EncodeInt16(char *output, char *outend, short nVal) +{ + if (output+2 > outend) + return NULL; + + output[1] = nVal & 0xff; + output[0] = nVal >> 8; + return output+2; +} + +char * +AMF_EncodeInt24(char *output, char *outend, int nVal) +{ + if (output+3 > outend) + return NULL; + + output[2] = nVal & 0xff; + output[1] = nVal >> 8; + output[0] = nVal >> 16; + return output+3; +} + +char * +AMF_EncodeInt32(char *output, char *outend, int nVal) +{ + if (output+4 > outend) + return NULL; + + output[3] = nVal & 0xff; + output[2] = nVal >> 8; + output[1] = nVal >> 16; + output[0] = nVal >> 24; + return output+4; +} + +char * +AMF_EncodeString(char *output, char *outend, const AVal *bv) +{ + if ((bv->av_len < 65536 && output + 1 + 2 + bv->av_len > outend) || + output + 1 + 4 + bv->av_len > outend) + return NULL; + + if (bv->av_len < 65536) + { + *output++ = AMF_STRING; + + output = AMF_EncodeInt16(output, outend, bv->av_len); + } + else + { + *output++ = AMF_LONG_STRING; + + output = AMF_EncodeInt32(output, outend, bv->av_len); + } + memcpy(output, bv->av_val, bv->av_len); + output += bv->av_len; + + return output; +} + +char * +AMF_EncodeNumber(char *output, char *outend, double dVal) +{ + if (output+1+8 > outend) + return NULL; + + *output++ = AMF_NUMBER; /* type: Number */ + +#if __FLOAT_WORD_ORDER == __BYTE_ORDER +#if __BYTE_ORDER == __BIG_ENDIAN + memcpy(output, &dVal, 8); +#elif __BYTE_ORDER == __LITTLE_ENDIAN + { + unsigned char *ci, *co; + ci = (unsigned char *)&dVal; + co = (unsigned char *)output; + co[0] = ci[7]; + co[1] = ci[6]; + co[2] = ci[5]; + co[3] = ci[4]; + co[4] = ci[3]; + co[5] = ci[2]; + co[6] = ci[1]; + co[7] = ci[0]; + } +#endif +#else +#if __BYTE_ORDER == __LITTLE_ENDIAN /* __FLOAT_WORD_ORER == __BIG_ENDIAN */ + { + unsigned char *ci, *co; + ci = (unsigned char *)&dVal; + co = (unsigned char *)output; + co[0] = ci[3]; + co[1] = ci[2]; + co[2] = ci[1]; + co[3] = ci[0]; + co[4] = ci[7]; + co[5] = ci[6]; + co[6] = ci[5]; + co[7] = ci[4]; + } +#else /* __BYTE_ORDER == __BIG_ENDIAN && __FLOAT_WORD_ORER == __LITTLE_ENDIAN */ + { + unsigned char *ci, *co; + ci = (unsigned char *)&dVal; + co = (unsigned char *)output; + co[0] = ci[4]; + co[1] = ci[5]; + co[2] = ci[6]; + co[3] = ci[7]; + co[4] = ci[0]; + co[5] = ci[1]; + co[6] = ci[2]; + co[7] = ci[3]; + } +#endif +#endif + + return output+8; +} + +char * +AMF_EncodeBoolean(char *output, char *outend, int bVal) +{ + if (output+2 > outend) + return NULL; + + *output++ = AMF_BOOLEAN; + + *output++ = bVal ? 0x01 : 0x00; + + return output; +} + +char * +AMF_EncodeNamedString(char *output, char *outend, const AVal *strName, const AVal *strValue) +{ + if (output+2+strName->av_len > outend) + return NULL; + output = AMF_EncodeInt16(output, outend, strName->av_len); + + memcpy(output, strName->av_val, strName->av_len); + output += strName->av_len; + + return AMF_EncodeString(output, outend, strValue); +} + +char * +AMF_EncodeNamedNumber(char *output, char *outend, const AVal *strName, double dVal) +{ + if (output+2+strName->av_len > outend) + return NULL; + output = AMF_EncodeInt16(output, outend, strName->av_len); + + memcpy(output, strName->av_val, strName->av_len); + output += strName->av_len; + + return AMF_EncodeNumber(output, outend, dVal); +} + +char * +AMF_EncodeNamedBoolean(char *output, char *outend, const AVal *strName, int bVal) +{ + if (output+2+strName->av_len > outend) + return NULL; + output = AMF_EncodeInt16(output, outend, strName->av_len); + + memcpy(output, strName->av_val, strName->av_len); + output += strName->av_len; + + return AMF_EncodeBoolean(output, outend, bVal); +} + +void +AMFProp_GetName(AMFObjectProperty *prop, AVal *name) +{ + *name = prop->p_name; +} + +void +AMFProp_SetName(AMFObjectProperty *prop, AVal *name) +{ + prop->p_name = *name; +} + +AMFDataType +AMFProp_GetType(AMFObjectProperty *prop) +{ + return prop->p_type; +} + +double +AMFProp_GetNumber(AMFObjectProperty *prop) +{ + return prop->p_vu.p_number; +} + +int +AMFProp_GetBoolean(AMFObjectProperty *prop) +{ + return prop->p_vu.p_number != 0; +} + +void +AMFProp_GetString(AMFObjectProperty *prop, AVal *str) +{ + if (prop->p_type == AMF_STRING) + *str = prop->p_vu.p_aval; + else + *str = AV_empty; +} + +void +AMFProp_GetObject(AMFObjectProperty *prop, AMFObject *obj) +{ + if (prop->p_type == AMF_OBJECT || prop->p_type == AMF_ECMA_ARRAY) + *obj = prop->p_vu.p_object; + else + *obj = AMFObj_Invalid; +} + +int +AMFProp_IsValid(AMFObjectProperty *prop) +{ + return prop->p_type != AMF_INVALID; +} + +char * +AMFProp_Encode(AMFObjectProperty *prop, char *pBuffer, char *pBufEnd) +{ + if (prop->p_type == AMF_INVALID) + return NULL; + + if (prop->p_type != AMF_NULL && pBuffer + prop->p_name.av_len + 2 + 1 >= pBufEnd) + return NULL; + + if (prop->p_type != AMF_NULL && prop->p_name.av_len) + { + *pBuffer++ = prop->p_name.av_len >> 8; + *pBuffer++ = prop->p_name.av_len & 0xff; + memcpy(pBuffer, prop->p_name.av_val, prop->p_name.av_len); + pBuffer += prop->p_name.av_len; + } + + switch (prop->p_type) + { + case AMF_NUMBER: + pBuffer = AMF_EncodeNumber(pBuffer, pBufEnd, prop->p_vu.p_number); + break; + + case AMF_BOOLEAN: + pBuffer = AMF_EncodeBoolean(pBuffer, pBufEnd, prop->p_vu.p_number != 0); + break; + + case AMF_STRING: + pBuffer = AMF_EncodeString(pBuffer, pBufEnd, &prop->p_vu.p_aval); + break; + + case AMF_NULL: + if (pBuffer+1 >= pBufEnd) + return NULL; + *pBuffer++ = AMF_NULL; + break; + + case AMF_OBJECT: + pBuffer = AMF_Encode(&prop->p_vu.p_object, pBuffer, pBufEnd); + break; + + case AMF_ECMA_ARRAY: + pBuffer = AMF_EncodeEcmaArray(&prop->p_vu.p_object, pBuffer, pBufEnd); + break; + + case AMF_STRICT_ARRAY: + pBuffer = AMF_EncodeArray(&prop->p_vu.p_object, pBuffer, pBufEnd); + break; + + default: + RTMP_Log(RTMP_LOGERROR, "%s, invalid type. %d", __FUNCTION__, prop->p_type); + pBuffer = NULL; + }; + + return pBuffer; +} + +#define AMF3_INTEGER_MAX 268435455 +#define AMF3_INTEGER_MIN -268435456 + +int +AMF3ReadInteger(const char *data, int32_t *valp) +{ + int i = 0; + int32_t val = 0; + + while (i <= 2) + { /* handle first 3 bytes */ + if (data[i] & 0x80) + { /* byte used */ + val <<= 7; /* shift up */ + val |= (data[i] & 0x7f); /* add bits */ + i++; + } + else + { + break; + } + } + + if (i > 2) + { /* use 4th byte, all 8bits */ + val <<= 8; + val |= data[3]; + + /* range check */ + if (val > AMF3_INTEGER_MAX) + val -= (1 << 29); + } + else + { /* use 7bits of last unparsed byte (0xxxxxxx) */ + val <<= 7; + val |= data[i]; + } + + *valp = val; + + return i > 2 ? 4 : i + 1; +} + +int +AMF3ReadString(const char *data, AVal *str) +{ + int32_t ref = 0; + int len; + assert(str != 0); + + len = AMF3ReadInteger(data, &ref); + data += len; + + if ((ref & 0x1) == 0) + { /* reference: 0xxx */ + uint32_t refIndex = (ref >> 1); + RTMP_Log(RTMP_LOGDEBUG, + "%s, string reference, index: %d, not supported, ignoring!", + __FUNCTION__, refIndex); + str->av_val = NULL; + str->av_len = 0; + return len; + } + else + { + uint32_t nSize = (ref >> 1); + + str->av_val = (char *)data; + str->av_len = nSize; + + return len + nSize; + } + return len; +} + +int +AMF3Prop_Decode(AMFObjectProperty *prop, const char *pBuffer, int nSize, + int bDecodeName) +{ + int nOriginalSize = nSize; + AMF3DataType type; + + prop->p_name.av_len = 0; + prop->p_name.av_val = NULL; + + if (nSize == 0 || !pBuffer) + { + RTMP_Log(RTMP_LOGDEBUG, "empty buffer/no buffer pointer!"); + return -1; + } + + /* decode name */ + if (bDecodeName) + { + AVal name; + int nRes = AMF3ReadString(pBuffer, &name); + + if (name.av_len <= 0) + return nRes; + + nSize -= nRes; + if (nSize <= 0) + return -1; + prop->p_name = name; + pBuffer += nRes; + } + + /* decode */ + type = *pBuffer++; + nSize--; + + switch (type) + { + case AMF3_UNDEFINED: + case AMF3_NULL: + prop->p_type = AMF_NULL; + break; + case AMF3_FALSE: + prop->p_type = AMF_BOOLEAN; + prop->p_vu.p_number = 0.0; + break; + case AMF3_TRUE: + prop->p_type = AMF_BOOLEAN; + prop->p_vu.p_number = 1.0; + break; + case AMF3_INTEGER: + { + int32_t res = 0; + int len = AMF3ReadInteger(pBuffer, &res); + prop->p_vu.p_number = (double)res; + prop->p_type = AMF_NUMBER; + nSize -= len; + break; + } + case AMF3_DOUBLE: + if (nSize < 8) + return -1; + prop->p_vu.p_number = AMF_DecodeNumber(pBuffer); + prop->p_type = AMF_NUMBER; + nSize -= 8; + break; + case AMF3_STRING: + case AMF3_XML_DOC: + case AMF3_XML: + { + int len = AMF3ReadString(pBuffer, &prop->p_vu.p_aval); + prop->p_type = AMF_STRING; + nSize -= len; + break; + } + case AMF3_DATE: + { + int32_t res = 0; + int len = AMF3ReadInteger(pBuffer, &res); + + nSize -= len; + pBuffer += len; + + if ((res & 0x1) == 0) + { /* reference */ + uint32_t nIndex = (res >> 1); + RTMP_Log(RTMP_LOGDEBUG, "AMF3_DATE reference: %d, not supported!", nIndex); + } + else + { + if (nSize < 8) + return -1; + + prop->p_vu.p_number = AMF_DecodeNumber(pBuffer); + nSize -= 8; + prop->p_type = AMF_NUMBER; + } + break; + } + case AMF3_OBJECT: + { + int nRes = AMF3_Decode(&prop->p_vu.p_object, pBuffer, nSize, TRUE); + if (nRes == -1) + return -1; + nSize -= nRes; + prop->p_type = AMF_OBJECT; + break; + } + case AMF3_ARRAY: + case AMF3_BYTE_ARRAY: + default: + RTMP_Log(RTMP_LOGDEBUG, "%s - AMF3 unknown/unsupported datatype 0x%02x, @%p", + __FUNCTION__, (unsigned char)(*pBuffer), pBuffer); + return -1; + } + if (nSize < 0) + return -1; + + return nOriginalSize - nSize; +} + +int +AMFProp_Decode(AMFObjectProperty *prop, const char *pBuffer, int nSize, + int bDecodeName) +{ + int nOriginalSize = nSize; + int nRes; + + prop->p_name.av_len = 0; + prop->p_name.av_val = NULL; + + if (nSize == 0 || !pBuffer) + { + RTMP_Log(RTMP_LOGDEBUG, "%s: Empty buffer/no buffer pointer!", __FUNCTION__); + return -1; + } + + if (bDecodeName && nSize < 4) + { /* at least name (length + at least 1 byte) and 1 byte of data */ + RTMP_Log(RTMP_LOGDEBUG, + "%s: Not enough data for decoding with name, less than 4 bytes!", + __FUNCTION__); + return -1; + } + + if (bDecodeName) + { + unsigned short nNameSize = AMF_DecodeInt16(pBuffer); + if (nNameSize > nSize - 2) + { + RTMP_Log(RTMP_LOGDEBUG, + "%s: Name size out of range: namesize (%d) > len (%d) - 2", + __FUNCTION__, nNameSize, nSize); + return -1; + } + + AMF_DecodeString(pBuffer, &prop->p_name); + nSize -= 2 + nNameSize; + pBuffer += 2 + nNameSize; + } + + if (nSize == 0) + { + return -1; + } + + nSize--; + + prop->p_type = *pBuffer++; + switch (prop->p_type) + { + case AMF_NUMBER: + if (nSize < 8) + return -1; + prop->p_vu.p_number = AMF_DecodeNumber(pBuffer); + nSize -= 8; + break; + case AMF_BOOLEAN: + if (nSize < 1) + return -1; + prop->p_vu.p_number = (double)AMF_DecodeBoolean(pBuffer); + nSize--; + break; + case AMF_STRING: + { + unsigned short nStringSize = AMF_DecodeInt16(pBuffer); + + if (nSize < (long)nStringSize + 2) + return -1; + AMF_DecodeString(pBuffer, &prop->p_vu.p_aval); + nSize -= (2 + nStringSize); + break; + } + case AMF_OBJECT: + { + int nRes = AMF_Decode(&prop->p_vu.p_object, pBuffer, nSize, TRUE); + if (nRes == -1) + return -1; + nSize -= nRes; + break; + } + case AMF_MOVIECLIP: + { + RTMP_Log(RTMP_LOGERROR, "AMF_MOVIECLIP reserved!"); + return -1; + break; + } + case AMF_NULL: + case AMF_UNDEFINED: + case AMF_UNSUPPORTED: + prop->p_type = AMF_NULL; + break; + case AMF_REFERENCE: + { + RTMP_Log(RTMP_LOGERROR, "AMF_REFERENCE not supported!"); + return -1; + break; + } + case AMF_ECMA_ARRAY: + { + nSize -= 4; + + /* next comes the rest, mixed array has a final 0x000009 mark and names, so its an object */ + nRes = AMF_Decode(&prop->p_vu.p_object, pBuffer + 4, nSize, TRUE); + if (nRes == -1) + return -1; + nSize -= nRes; + break; + } + case AMF_OBJECT_END: + { + return -1; + break; + } + case AMF_STRICT_ARRAY: + { + unsigned int nArrayLen = AMF_DecodeInt32(pBuffer); + nSize -= 4; + + nRes = AMF_DecodeArray(&prop->p_vu.p_object, pBuffer + 4, nSize, + nArrayLen, FALSE); + if (nRes == -1) + return -1; + nSize -= nRes; + break; + } + case AMF_DATE: + { + RTMP_Log(RTMP_LOGDEBUG, "AMF_DATE"); + + if (nSize < 10) + return -1; + + prop->p_vu.p_number = AMF_DecodeNumber(pBuffer); + prop->p_UTCoffset = AMF_DecodeInt16(pBuffer + 8); + + nSize -= 10; + break; + } + case AMF_LONG_STRING: + case AMF_XML_DOC: + { + unsigned int nStringSize = AMF_DecodeInt32(pBuffer); + if (nSize < (long)nStringSize + 4) + return -1; + AMF_DecodeLongString(pBuffer, &prop->p_vu.p_aval); + nSize -= (4 + nStringSize); + if (prop->p_type == AMF_LONG_STRING) + prop->p_type = AMF_STRING; + break; + } + case AMF_RECORDSET: + { + RTMP_Log(RTMP_LOGERROR, "AMF_RECORDSET reserved!"); + return -1; + break; + } + case AMF_TYPED_OBJECT: + { + RTMP_Log(RTMP_LOGERROR, "AMF_TYPED_OBJECT not supported!"); + return -1; + break; + } + case AMF_AVMPLUS: + { + int nRes = AMF3_Decode(&prop->p_vu.p_object, pBuffer, nSize, TRUE); + if (nRes == -1) + return -1; + nSize -= nRes; + prop->p_type = AMF_OBJECT; + break; + } + default: + RTMP_Log(RTMP_LOGDEBUG, "%s - unknown datatype 0x%02x, @%p", __FUNCTION__, + prop->p_type, pBuffer - 1); + return -1; + } + + return nOriginalSize - nSize; +} + +void +AMFProp_Dump(AMFObjectProperty *prop) +{ + char strRes[256]; + char str[256]; + AVal name; + + if (prop->p_type == AMF_INVALID) + { + RTMP_Log(RTMP_LOGDEBUG, "Property: INVALID"); + return; + } + + if (prop->p_type == AMF_NULL) + { + RTMP_Log(RTMP_LOGDEBUG, "Property: NULL"); + return; + } + + if (prop->p_name.av_len) + { + name = prop->p_name; + } + else + { + name.av_val = "no-name."; + name.av_len = sizeof("no-name.") - 1; + } + if (name.av_len > 18) + name.av_len = 18; + + snprintf(strRes, 255, "Name: %18.*s, ", name.av_len, name.av_val); + + if (prop->p_type == AMF_OBJECT) + { + RTMP_Log(RTMP_LOGDEBUG, "Property: <%sOBJECT>", strRes); + AMF_Dump(&prop->p_vu.p_object); + return; + } + else if (prop->p_type == AMF_ECMA_ARRAY) + { + RTMP_Log(RTMP_LOGDEBUG, "Property: <%sECMA_ARRAY>", strRes); + AMF_Dump(&prop->p_vu.p_object); + return; + } + else if (prop->p_type == AMF_STRICT_ARRAY) + { + RTMP_Log(RTMP_LOGDEBUG, "Property: <%sSTRICT_ARRAY>", strRes); + AMF_Dump(&prop->p_vu.p_object); + return; + } + + switch (prop->p_type) + { + case AMF_NUMBER: + snprintf(str, 255, "NUMBER:\t%.2f", prop->p_vu.p_number); + break; + case AMF_BOOLEAN: + snprintf(str, 255, "BOOLEAN:\t%s", + prop->p_vu.p_number != 0.0 ? "TRUE" : "FALSE"); + break; + case AMF_STRING: + snprintf(str, 255, "STRING:\t%.*s", prop->p_vu.p_aval.av_len, + prop->p_vu.p_aval.av_val); + break; + case AMF_DATE: + snprintf(str, 255, "DATE:\ttimestamp: %.2f, UTC offset: %d", + prop->p_vu.p_number, prop->p_UTCoffset); + break; + default: + snprintf(str, 255, "INVALID TYPE 0x%02x", (unsigned char)prop->p_type); + } + + RTMP_Log(RTMP_LOGDEBUG, "Property: <%s%s>", strRes, str); +} + +void +AMFProp_Reset(AMFObjectProperty *prop) +{ + if (prop->p_type == AMF_OBJECT || prop->p_type == AMF_ECMA_ARRAY || + prop->p_type == AMF_STRICT_ARRAY) + AMF_Reset(&prop->p_vu.p_object); + else + { + prop->p_vu.p_aval.av_len = 0; + prop->p_vu.p_aval.av_val = NULL; + } + prop->p_type = AMF_INVALID; +} + +/* AMFObject */ + +char * +AMF_Encode(AMFObject *obj, char *pBuffer, char *pBufEnd) +{ + int i; + + if (pBuffer+4 >= pBufEnd) + return NULL; + + *pBuffer++ = AMF_OBJECT; + + for (i = 0; i < obj->o_num; i++) + { + char *res = AMFProp_Encode(&obj->o_props[i], pBuffer, pBufEnd); + if (res == NULL) + { + RTMP_Log(RTMP_LOGERROR, "AMF_Encode - failed to encode property in index %d", + i); + break; + } + else + { + pBuffer = res; + } + } + + if (pBuffer + 3 >= pBufEnd) + return NULL; /* no room for the end marker */ + + pBuffer = AMF_EncodeInt24(pBuffer, pBufEnd, AMF_OBJECT_END); + + return pBuffer; +} + +char * +AMF_EncodeEcmaArray(AMFObject *obj, char *pBuffer, char *pBufEnd) +{ + int i; + + if (pBuffer+4 >= pBufEnd) + return NULL; + + *pBuffer++ = AMF_ECMA_ARRAY; + + pBuffer = AMF_EncodeInt32(pBuffer, pBufEnd, obj->o_num); + + for (i = 0; i < obj->o_num; i++) + { + char *res = AMFProp_Encode(&obj->o_props[i], pBuffer, pBufEnd); + if (res == NULL) + { + RTMP_Log(RTMP_LOGERROR, "AMF_Encode - failed to encode property in index %d", + i); + break; + } + else + { + pBuffer = res; + } + } + + if (pBuffer + 3 >= pBufEnd) + return NULL; /* no room for the end marker */ + + pBuffer = AMF_EncodeInt24(pBuffer, pBufEnd, AMF_OBJECT_END); + + return pBuffer; +} + +char * +AMF_EncodeArray(AMFObject *obj, char *pBuffer, char *pBufEnd) +{ + int i; + + if (pBuffer+4 >= pBufEnd) + return NULL; + + *pBuffer++ = AMF_STRICT_ARRAY; + + pBuffer = AMF_EncodeInt32(pBuffer, pBufEnd, obj->o_num); + + for (i = 0; i < obj->o_num; i++) + { + char *res = AMFProp_Encode(&obj->o_props[i], pBuffer, pBufEnd); + if (res == NULL) + { + RTMP_Log(RTMP_LOGERROR, "AMF_Encode - failed to encode property in index %d", + i); + break; + } + else + { + pBuffer = res; + } + } + + //if (pBuffer + 3 >= pBufEnd) + // return NULL; /* no room for the end marker */ + + //pBuffer = AMF_EncodeInt24(pBuffer, pBufEnd, AMF_OBJECT_END); + + return pBuffer; +} + +int +AMF_DecodeArray(AMFObject *obj, const char *pBuffer, int nSize, + int nArrayLen, int bDecodeName) +{ + int nOriginalSize = nSize; + int bError = FALSE; + + obj->o_num = 0; + obj->o_props = NULL; + while (nArrayLen > 0) + { + AMFObjectProperty prop; + int nRes; + nArrayLen--; + + if (nSize <= 0) + { + bError = TRUE; + break; + } + nRes = AMFProp_Decode(&prop, pBuffer, nSize, bDecodeName); + if (nRes == -1) + { + bError = TRUE; + break; + } + else + { + nSize -= nRes; + pBuffer += nRes; + AMF_AddProp(obj, &prop); + } + } + if (bError) + return -1; + + return nOriginalSize - nSize; +} + +int +AMF3_Decode(AMFObject *obj, const char *pBuffer, int nSize, int bAMFData) +{ + int nOriginalSize = nSize; + int32_t ref; + int len; + + obj->o_num = 0; + obj->o_props = NULL; + if (bAMFData) + { + if (*pBuffer != AMF3_OBJECT) + RTMP_Log(RTMP_LOGERROR, + "AMF3 Object encapsulated in AMF stream does not start with AMF3_OBJECT!"); + pBuffer++; + nSize--; + } + + ref = 0; + len = AMF3ReadInteger(pBuffer, &ref); + pBuffer += len; + nSize -= len; + + if ((ref & 1) == 0) + { /* object reference, 0xxx */ + uint32_t objectIndex = (ref >> 1); + + RTMP_Log(RTMP_LOGDEBUG, "Object reference, index: %d", objectIndex); + } + else /* object instance */ + { + int32_t classRef = (ref >> 1); + + AMF3ClassDef cd = { {0, 0} + }; + AMFObjectProperty prop; + + if ((classRef & 0x1) == 0) + { /* class reference */ + uint32_t classIndex = (classRef >> 1); + RTMP_Log(RTMP_LOGDEBUG, "Class reference: %d", classIndex); + } + else + { + int32_t classExtRef = (classRef >> 1); + int i, cdnum; + + cd.cd_externalizable = (classExtRef & 0x1) == 1; + cd.cd_dynamic = ((classExtRef >> 1) & 0x1) == 1; + + cdnum = classExtRef >> 2; + + /* class name */ + + len = AMF3ReadString(pBuffer, &cd.cd_name); + nSize -= len; + pBuffer += len; + + /*std::string str = className; */ + + RTMP_Log(RTMP_LOGDEBUG, + "Class name: %s, externalizable: %d, dynamic: %d, classMembers: %d", + cd.cd_name.av_val, cd.cd_externalizable, cd.cd_dynamic, + cd.cd_num); + + for (i = 0; i < cdnum; i++) + { + AVal memberName; + if (nSize <=0) + { +invalid: + RTMP_Log(RTMP_LOGDEBUG, "%s, invalid class encoding!", + __FUNCTION__); + return nOriginalSize; + } + len = AMF3ReadString(pBuffer, &memberName); + RTMP_Log(RTMP_LOGDEBUG, "Member: %s", memberName.av_val); + AMF3CD_AddProp(&cd, &memberName); + nSize -= len; + pBuffer += len; + } + } + + /* add as referencable object */ + + if (cd.cd_externalizable) + { + int nRes; + AVal name = AVC("DEFAULT_ATTRIBUTE"); + + RTMP_Log(RTMP_LOGDEBUG, "Externalizable, TODO check"); + + nRes = AMF3Prop_Decode(&prop, pBuffer, nSize, FALSE); + if (nRes == -1) + RTMP_Log(RTMP_LOGDEBUG, "%s, failed to decode AMF3 property!", + __FUNCTION__); + else + { + nSize -= nRes; + pBuffer += nRes; + } + + AMFProp_SetName(&prop, &name); + AMF_AddProp(obj, &prop); + } + else + { + int nRes, i; + for (i = 0; i < cd.cd_num; i++) /* non-dynamic */ + { + if (nSize <=0) + goto invalid; + nRes = AMF3Prop_Decode(&prop, pBuffer, nSize, FALSE); + if (nRes == -1) + RTMP_Log(RTMP_LOGDEBUG, "%s, failed to decode AMF3 property!", + __FUNCTION__); + + AMFProp_SetName(&prop, AMF3CD_GetProp(&cd, i)); + AMF_AddProp(obj, &prop); + + pBuffer += nRes; + nSize -= nRes; + } + if (cd.cd_dynamic) + { + int len = 0; + + do + { + if (nSize <=0) + goto invalid; + nRes = AMF3Prop_Decode(&prop, pBuffer, nSize, TRUE); + AMF_AddProp(obj, &prop); + + pBuffer += nRes; + nSize -= nRes; + + len = prop.p_name.av_len; + } + while (len > 0); + } + } + RTMP_Log(RTMP_LOGDEBUG, "class object!"); + } + return nOriginalSize - nSize; +} + +int +AMF_Decode(AMFObject *obj, const char *pBuffer, int nSize, int bDecodeName) +{ + int nOriginalSize = nSize; + int bError = FALSE; /* if there is an error while decoding - try to at least find the end mark AMF_OBJECT_END */ + + obj->o_num = 0; + obj->o_props = NULL; + while (nSize > 0) + { + AMFObjectProperty prop; + int nRes; + + if (nSize >=3 && AMF_DecodeInt24(pBuffer) == AMF_OBJECT_END) + { + nSize -= 3; + bError = FALSE; + break; + } + + if (bError) + { + RTMP_Log(RTMP_LOGERROR, + "DECODING ERROR, IGNORING BYTES UNTIL NEXT KNOWN PATTERN!"); + nSize--; + pBuffer++; + continue; + } + + nRes = AMFProp_Decode(&prop, pBuffer, nSize, bDecodeName); + if (nRes == -1) + { + bError = TRUE; + break; + } + else + { + nSize -= nRes; + if (nSize < 0) + { + bError = TRUE; + break; + } + pBuffer += nRes; + AMF_AddProp(obj, &prop); + } + } + + if (bError) + return -1; + + return nOriginalSize - nSize; +} + +void +AMF_AddProp(AMFObject *obj, const AMFObjectProperty *prop) +{ + if (!(obj->o_num & 0x0f)) + obj->o_props = + realloc(obj->o_props, (obj->o_num + 16) * sizeof(AMFObjectProperty)); + memcpy(&obj->o_props[obj->o_num++], prop, sizeof(AMFObjectProperty)); +} + +int +AMF_CountProp(AMFObject *obj) +{ + return obj->o_num; +} + +AMFObjectProperty * +AMF_GetProp(AMFObject *obj, const AVal *name, int nIndex) +{ + if (nIndex >= 0) + { + if (nIndex < obj->o_num) + return &obj->o_props[nIndex]; + } + else + { + int n; + for (n = 0; n < obj->o_num; n++) + { + if (AVMATCH(&obj->o_props[n].p_name, name)) + return &obj->o_props[n]; + } + } + + return (AMFObjectProperty *)&AMFProp_Invalid; +} + +void +AMF_Dump(AMFObject *obj) +{ + int n; + RTMP_Log(RTMP_LOGDEBUG, "(object begin)"); + for (n = 0; n < obj->o_num; n++) + { + AMFProp_Dump(&obj->o_props[n]); + } + RTMP_Log(RTMP_LOGDEBUG, "(object end)"); +} + +void +AMF_Reset(AMFObject *obj) +{ + int n; + for (n = 0; n < obj->o_num; n++) + { + AMFProp_Reset(&obj->o_props[n]); + } + free(obj->o_props); + obj->o_props = NULL; + obj->o_num = 0; +} + + +/* AMF3ClassDefinition */ + +void +AMF3CD_AddProp(AMF3ClassDef *cd, AVal *prop) +{ + if (!(cd->cd_num & 0x0f)) + cd->cd_props = realloc(cd->cd_props, (cd->cd_num + 16) * sizeof(AVal)); + cd->cd_props[cd->cd_num++] = *prop; +} + +AVal * +AMF3CD_GetProp(AMF3ClassDef *cd, int nIndex) +{ + if (nIndex >= cd->cd_num) + return (AVal *)&AV_empty; + return &cd->cd_props[nIndex]; +} diff --git a/MediaClient/MediaClient/rtmp/amf.h b/MediaClient/MediaClient/rtmp/amf.h new file mode 100644 index 0000000..cca11fa --- /dev/null +++ b/MediaClient/MediaClient/rtmp/amf.h @@ -0,0 +1,164 @@ +#ifndef __AMF_H__ +#define __AMF_H__ +/* + * Copyright (C) 2005-2008 Team XBMC + * http://www.xbmc.org + * Copyright (C) 2008-2009 Andrej Stepanchuk + * Copyright (C) 2009-2010 Howard Chu + * + * This file is part of librtmp. + * + * librtmp is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1, + * or (at your option) any later version. + * + * librtmp is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with librtmp see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * http://www.gnu.org/copyleft/lgpl.html + */ + +#include + +#ifndef TRUE +#define TRUE 1 +#define FALSE 0 +#endif + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef enum + { AMF_NUMBER = 0, AMF_BOOLEAN, AMF_STRING, AMF_OBJECT, + AMF_MOVIECLIP, /* reserved, not used */ + AMF_NULL, AMF_UNDEFINED, AMF_REFERENCE, AMF_ECMA_ARRAY, AMF_OBJECT_END, + AMF_STRICT_ARRAY, AMF_DATE, AMF_LONG_STRING, AMF_UNSUPPORTED, + AMF_RECORDSET, /* reserved, not used */ + AMF_XML_DOC, AMF_TYPED_OBJECT, + AMF_AVMPLUS, /* switch to AMF3 */ + AMF_INVALID = 0xff + } AMFDataType; + + typedef enum + { AMF3_UNDEFINED = 0, AMF3_NULL, AMF3_FALSE, AMF3_TRUE, + AMF3_INTEGER, AMF3_DOUBLE, AMF3_STRING, AMF3_XML_DOC, AMF3_DATE, + AMF3_ARRAY, AMF3_OBJECT, AMF3_XML, AMF3_BYTE_ARRAY + } AMF3DataType; + + typedef struct AVal + { + char *av_val; + int av_len; + } AVal; +#define AVC(str) {(char*)str,sizeof(str)-1} +#define AVMATCH(a1,a2) ((a1)->av_len == (a2)->av_len && !memcmp((a1)->av_val,(a2)->av_val,(a1)->av_len)) + + struct AMFObjectProperty; + + typedef struct AMFObject + { + int o_num; + struct AMFObjectProperty *o_props; + } AMFObject; + + typedef struct AMFObjectProperty + { + AVal p_name; + AMFDataType p_type; + union + { + double p_number; + AVal p_aval; + AMFObject p_object; + } p_vu; + int16_t p_UTCoffset; + } AMFObjectProperty; + + char *AMF_EncodeString(char *output, char *outend, const AVal * str); + char *AMF_EncodeNumber(char *output, char *outend, double dVal); + char *AMF_EncodeInt16(char *output, char *outend, short nVal); + char *AMF_EncodeInt24(char *output, char *outend, int nVal); + char *AMF_EncodeInt32(char *output, char *outend, int nVal); + char *AMF_EncodeBoolean(char *output, char *outend, int bVal); + + /* Shortcuts for AMFProp_Encode */ + char *AMF_EncodeNamedString(char *output, char *outend, const AVal * name, const AVal * value); + char *AMF_EncodeNamedNumber(char *output, char *outend, const AVal * name, double dVal); + char *AMF_EncodeNamedBoolean(char *output, char *outend, const AVal * name, int bVal); + + unsigned short AMF_DecodeInt16(const char *data); + unsigned int AMF_DecodeInt24(const char *data); + unsigned int AMF_DecodeInt32(const char *data); + void AMF_DecodeString(const char *data, AVal * str); + void AMF_DecodeLongString(const char *data, AVal * str); + int AMF_DecodeBoolean(const char *data); + double AMF_DecodeNumber(const char *data); + + char *AMF_Encode(AMFObject * obj, char *pBuffer, char *pBufEnd); + char *AMF_EncodeEcmaArray(AMFObject *obj, char *pBuffer, char *pBufEnd); + char *AMF_EncodeArray(AMFObject *obj, char *pBuffer, char *pBufEnd); + + int AMF_Decode(AMFObject * obj, const char *pBuffer, int nSize, + int bDecodeName); + int AMF_DecodeArray(AMFObject * obj, const char *pBuffer, int nSize, + int nArrayLen, int bDecodeName); + int AMF3_Decode(AMFObject * obj, const char *pBuffer, int nSize, + int bDecodeName); + void AMF_Dump(AMFObject * obj); + void AMF_Reset(AMFObject * obj); + + void AMF_AddProp(AMFObject * obj, const AMFObjectProperty * prop); + int AMF_CountProp(AMFObject * obj); + AMFObjectProperty *AMF_GetProp(AMFObject * obj, const AVal * name, + int nIndex); + + AMFDataType AMFProp_GetType(AMFObjectProperty * prop); + void AMFProp_SetNumber(AMFObjectProperty * prop, double dval); + void AMFProp_SetBoolean(AMFObjectProperty * prop, int bflag); + void AMFProp_SetString(AMFObjectProperty * prop, AVal * str); + void AMFProp_SetObject(AMFObjectProperty * prop, AMFObject * obj); + + void AMFProp_GetName(AMFObjectProperty * prop, AVal * name); + void AMFProp_SetName(AMFObjectProperty * prop, AVal * name); + double AMFProp_GetNumber(AMFObjectProperty * prop); + int AMFProp_GetBoolean(AMFObjectProperty * prop); + void AMFProp_GetString(AMFObjectProperty * prop, AVal * str); + void AMFProp_GetObject(AMFObjectProperty * prop, AMFObject * obj); + + int AMFProp_IsValid(AMFObjectProperty * prop); + + char *AMFProp_Encode(AMFObjectProperty * prop, char *pBuffer, char *pBufEnd); + int AMF3Prop_Decode(AMFObjectProperty * prop, const char *pBuffer, + int nSize, int bDecodeName); + int AMFProp_Decode(AMFObjectProperty * prop, const char *pBuffer, + int nSize, int bDecodeName); + + void AMFProp_Dump(AMFObjectProperty * prop); + void AMFProp_Reset(AMFObjectProperty * prop); + + typedef struct AMF3ClassDef + { + AVal cd_name; + char cd_externalizable; + char cd_dynamic; + int cd_num; + AVal *cd_props; + } AMF3ClassDef; + + void AMF3CD_AddProp(AMF3ClassDef * cd, AVal * prop); + AVal *AMF3CD_GetProp(AMF3ClassDef * cd, int idx); + +#ifdef __cplusplus +} +#endif + +#endif /* __AMF_H__ */ diff --git a/MediaClient/MediaClient/rtmp/rtmp.h b/MediaClient/MediaClient/rtmp/rtmp.h new file mode 100644 index 0000000..caa0f98 --- /dev/null +++ b/MediaClient/MediaClient/rtmp/rtmp.h @@ -0,0 +1,382 @@ +#ifndef __RTMP_H__ +#define __RTMP_H__ +/* + * Copyright (C) 2005-2008 Team XBMC + * http://www.xbmc.org + * Copyright (C) 2008-2009 Andrej Stepanchuk + * Copyright (C) 2009-2010 Howard Chu + * + * This file is part of librtmp. + * + * librtmp is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1, + * or (at your option) any later version. + * + * librtmp is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with librtmp see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * http://www.gnu.org/copyleft/lgpl.html + */ + +#if !defined(NO_CRYPTO) && !defined(CRYPTO) +#define CRYPTO +#endif + +#include +#include +#include + +#include "amf.h" + +#ifdef __cplusplus +extern "C" +{ +#endif + +#define RTMP_LIB_VERSION 0x020300 /* 2.3 */ + +#define RTMP_FEATURE_HTTP 0x01 +#define RTMP_FEATURE_ENC 0x02 +#define RTMP_FEATURE_SSL 0x04 +#define RTMP_FEATURE_MFP 0x08 /* not yet supported */ +#define RTMP_FEATURE_WRITE 0x10 /* publish, not play */ +#define RTMP_FEATURE_HTTP2 0x20 /* server-side rtmpt */ + +#define RTMP_PROTOCOL_UNDEFINED -1 +#define RTMP_PROTOCOL_RTMP 0 +#define RTMP_PROTOCOL_RTMPE RTMP_FEATURE_ENC +#define RTMP_PROTOCOL_RTMPT RTMP_FEATURE_HTTP +#define RTMP_PROTOCOL_RTMPS RTMP_FEATURE_SSL +#define RTMP_PROTOCOL_RTMPTE (RTMP_FEATURE_HTTP|RTMP_FEATURE_ENC) +#define RTMP_PROTOCOL_RTMPTS (RTMP_FEATURE_HTTP|RTMP_FEATURE_SSL) +#define RTMP_PROTOCOL_RTMFP RTMP_FEATURE_MFP + +#define RTMP_DEFAULT_CHUNKSIZE 128 + +/* needs to fit largest number of bytes recv() may return */ +#define RTMP_BUFFER_CACHE_SIZE (16*1024) + +#define RTMP_CHANNELS 65600 + + extern const char RTMPProtocolStringsLower[][7]; + extern const AVal RTMP_DefaultFlashVer; + extern const AVal RTMP_FlashVer; + extern int RTMP_ctrlC; + + uint32_t RTMP_GetTime(void); + +/* RTMP_PACKET_TYPE_... 0x00 */ +#define RTMP_PACKET_TYPE_CHUNK_SIZE 0x01 +/* RTMP_PACKET_TYPE_... 0x02 */ +#define RTMP_PACKET_TYPE_BYTES_READ_REPORT 0x03 +#define RTMP_PACKET_TYPE_CONTROL 0x04 +#define RTMP_PACKET_TYPE_SERVER_BW 0x05 +#define RTMP_PACKET_TYPE_CLIENT_BW 0x06 +/* RTMP_PACKET_TYPE_... 0x07 */ +#define RTMP_PACKET_TYPE_AUDIO 0x08 +#define RTMP_PACKET_TYPE_VIDEO 0x09 +/* RTMP_PACKET_TYPE_... 0x0A */ +/* RTMP_PACKET_TYPE_... 0x0B */ +/* RTMP_PACKET_TYPE_... 0x0C */ +/* RTMP_PACKET_TYPE_... 0x0D */ +/* RTMP_PACKET_TYPE_... 0x0E */ +#define RTMP_PACKET_TYPE_FLEX_STREAM_SEND 0x0F +#define RTMP_PACKET_TYPE_FLEX_SHARED_OBJECT 0x10 +#define RTMP_PACKET_TYPE_FLEX_MESSAGE 0x11 +#define RTMP_PACKET_TYPE_INFO 0x12 +#define RTMP_PACKET_TYPE_SHARED_OBJECT 0x13 +#define RTMP_PACKET_TYPE_INVOKE 0x14 +/* RTMP_PACKET_TYPE_... 0x15 */ +#define RTMP_PACKET_TYPE_FLASH_VIDEO 0x16 + +#define RTMP_MAX_HEADER_SIZE 18 + +#define RTMP_PACKET_SIZE_LARGE 0 +#define RTMP_PACKET_SIZE_MEDIUM 1 +#define RTMP_PACKET_SIZE_SMALL 2 +#define RTMP_PACKET_SIZE_MINIMUM 3 + + typedef struct RTMPChunk + { + int c_headerSize; + int c_chunkSize; + char *c_chunk; + char c_header[RTMP_MAX_HEADER_SIZE]; + } RTMPChunk; + + typedef struct RTMPPacket + { + uint8_t m_headerType; + uint8_t m_packetType; + uint8_t m_hasAbsTimestamp; /* timestamp absolute or relative? */ + int m_nChannel; + uint32_t m_nTimeStamp; /* timestamp */ + int32_t m_nInfoField2; /* last 4 bytes in a long header */ + uint32_t m_nBodySize; + uint32_t m_nBytesRead; + RTMPChunk *m_chunk; + char *m_body; + } RTMPPacket; + + typedef struct RTMPSockBuf + { + int sb_socket; + int sb_size; /* number of unprocessed bytes in buffer */ + char *sb_start; /* pointer into sb_pBuffer of next byte to process */ + char sb_buf[RTMP_BUFFER_CACHE_SIZE]; /* data read from socket */ + int sb_timedout; + void *sb_ssl; + } RTMPSockBuf; + + void RTMPPacket_Reset(RTMPPacket *p); + void RTMPPacket_Dump(RTMPPacket *p); + int RTMPPacket_Alloc(RTMPPacket *p, uint32_t nSize); + void RTMPPacket_Free(RTMPPacket *p); + +#define RTMPPacket_IsReady(a) ((a)->m_nBytesRead == (a)->m_nBodySize) + + typedef struct RTMP_LNK + { + AVal hostname; + AVal sockshost; + + AVal playpath0; /* parsed from URL */ + AVal playpath; /* passed in explicitly */ + AVal tcUrl; + AVal swfUrl; + AVal pageUrl; + AVal app; + AVal auth; + AVal flashVer; + AVal subscribepath; + AVal usherToken; + AVal token; + AVal pubUser; + AVal pubPasswd; + AMFObject extras; + int edepth; + + int seekTime; + int stopTime; + +#define RTMP_LF_AUTH 0x0001 /* using auth param */ +#define RTMP_LF_LIVE 0x0002 /* stream is live */ +#define RTMP_LF_SWFV 0x0004 /* do SWF verification */ +#define RTMP_LF_PLST 0x0008 /* send playlist before play */ +#define RTMP_LF_BUFX 0x0010 /* toggle stream on BufferEmpty msg */ +#define RTMP_LF_FTCU 0x0020 /* free tcUrl on close */ +#define RTMP_LF_FAPU 0x0040 /* free app on close */ + int lFlags; + + int swfAge; + + int protocol; + int timeout; /* connection timeout in seconds */ + + int pFlags; /* unused, but kept to avoid breaking ABI */ + + unsigned short socksport; + unsigned short port; + +#ifdef CRYPTO +#define RTMP_SWF_HASHLEN 32 + void *dh; /* for encryption */ + void *rc4keyIn; + void *rc4keyOut; + + uint32_t SWFSize; + uint8_t SWFHash[RTMP_SWF_HASHLEN]; + char SWFVerificationResponse[RTMP_SWF_HASHLEN+10]; +#endif + } RTMP_LNK; + + /* state for read() wrapper */ + typedef struct RTMP_READ + { + char *buf; + char *bufpos; + unsigned int buflen; + uint32_t timestamp; + uint8_t dataType; + uint8_t flags; +#define RTMP_READ_HEADER 0x01 +#define RTMP_READ_RESUME 0x02 +#define RTMP_READ_NO_IGNORE 0x04 +#define RTMP_READ_GOTKF 0x08 +#define RTMP_READ_GOTFLVK 0x10 +#define RTMP_READ_SEEKING 0x20 + int8_t status; +#define RTMP_READ_COMPLETE -3 +#define RTMP_READ_ERROR -2 +#define RTMP_READ_EOF -1 +#define RTMP_READ_IGNORE 0 + + /* if bResume == TRUE */ + uint8_t initialFrameType; + uint32_t nResumeTS; + char *metaHeader; + char *initialFrame; + uint32_t nMetaHeaderSize; + uint32_t nInitialFrameSize; + uint32_t nIgnoredFrameCounter; + uint32_t nIgnoredFlvFrameCounter; + } RTMP_READ; + + typedef struct RTMP_METHOD + { + AVal name; + int num; + } RTMP_METHOD; + + typedef struct RTMP + { + int m_inChunkSize; + int m_outChunkSize; + int m_nBWCheckCounter; + int m_nBytesIn; + int m_nBytesInSent; + int m_nBufferMS; + int m_stream_id; /* returned in _result from createStream */ + int m_mediaChannel; + uint32_t m_mediaStamp; + uint32_t m_pauseStamp; + int m_pausing; + int m_nServerBW; + int m_nClientBW; + uint8_t m_nClientBW2; + uint8_t m_bPlaying; + uint8_t m_bSendEncoding; + uint8_t m_bSendCounter; + + int m_numInvokes; + int m_numCalls; + RTMP_METHOD *m_methodCalls; /* remote method calls queue */ + + int m_channelsAllocatedIn; + int m_channelsAllocatedOut; + RTMPPacket **m_vecChannelsIn; + RTMPPacket **m_vecChannelsOut; + int *m_channelTimestamp; /* abs timestamp of last packet */ + + double m_fAudioCodecs; /* audioCodecs for the connect packet */ + double m_fVideoCodecs; /* videoCodecs for the connect packet */ + double m_fEncoding; /* AMF0 or AMF3 */ + + double m_fDuration; /* duration of stream in seconds */ + + int m_msgCounter; /* RTMPT stuff */ + int m_polling; + int m_resplen; + int m_unackd; + AVal m_clientID; + + RTMP_READ m_read; + RTMPPacket m_write; + RTMPSockBuf m_sb; + RTMP_LNK Link; + } RTMP; + + int RTMP_ParseURL(const char *url, int *protocol, AVal *host, + unsigned int *port, AVal *playpath, AVal *app, AVal *user, AVal *pass); + + void RTMP_ParsePlaypath(AVal *in, AVal *out); + void RTMP_SetBufferMS(RTMP *r, int size); + void RTMP_UpdateBufferMS(RTMP *r); + + int RTMP_SetOpt(RTMP *r, const AVal *opt, AVal *arg); + int RTMP_SetupURL(RTMP *r, char *url); + void RTMP_SetupStream(RTMP *r, int protocol, + AVal *hostname, + unsigned int port, + AVal *sockshost, + AVal *playpath, + AVal *tcUrl, + AVal *swfUrl, + AVal *pageUrl, + AVal *app, + AVal *auth, + AVal *swfSHA256Hash, + uint32_t swfSize, + AVal *flashVer, + AVal *subscribepath, + AVal *usherToken, + int dStart, + int dStop, int bLiveStream, long int timeout); + + int RTMP_Connect(RTMP *r, RTMPPacket *cp); + struct sockaddr; + int RTMP_Connect0(RTMP *r, struct sockaddr *svc); + int RTMP_Connect1(RTMP *r, RTMPPacket *cp); + int RTMP_Serve(RTMP *r); + int RTMP_TLS_Accept(RTMP *r, void *ctx); + + int RTMP_ReadPacket(RTMP *r, RTMPPacket *packet); + int RTMP_SendPacket(RTMP *r, RTMPPacket *packet, int queue); + int RTMP_SendChunk(RTMP *r, RTMPChunk *chunk); + int RTMP_IsConnected(RTMP *r); + int RTMP_Socket(RTMP *r); + int RTMP_IsTimedout(RTMP *r); + double RTMP_GetDuration(RTMP *r); + int RTMP_ToggleStream(RTMP *r); + + int RTMP_ConnectStream(RTMP *r, int seekTime); + int RTMP_ReconnectStream(RTMP *r, int seekTime); + void RTMP_DeleteStream(RTMP *r); + int RTMP_GetNextMediaPacket(RTMP *r, RTMPPacket *packet); + int RTMP_ClientPacket(RTMP *r, RTMPPacket *packet); + + void RTMP_Init(RTMP *r); + void RTMP_Close(RTMP *r); + RTMP *RTMP_Alloc(void); + void RTMP_Free(RTMP *r); + void RTMP_EnableWrite(RTMP *r); + + void *RTMP_TLS_AllocServerContext(const char* cert, const char* key); + void RTMP_TLS_FreeServerContext(void *ctx); + + int RTMP_LibVersion(void); + void RTMP_UserInterrupt(void); /* user typed Ctrl-C */ + + int RTMP_SendCtrl(RTMP *r, short nType, unsigned int nObject, + unsigned int nTime); + + /* caller probably doesn't know current timestamp, should + * just use RTMP_Pause instead + */ + int RTMP_SendPause(RTMP *r, int DoPause, int dTime); + int RTMP_Pause(RTMP *r, int DoPause); + + int RTMP_FindFirstMatchingProperty(AMFObject *obj, const AVal *name, + AMFObjectProperty * p); + + int RTMPSockBuf_Fill(RTMPSockBuf *sb); + int RTMPSockBuf_Send(RTMPSockBuf *sb, const char *buf, int len); + int RTMPSockBuf_Close(RTMPSockBuf *sb); + + int RTMP_SendCreateStream(RTMP *r); + int RTMP_SendSeek(RTMP *r, int dTime); + int RTMP_SendServerBW(RTMP *r); + int RTMP_SendClientBW(RTMP *r); + int RTMP_SendChunkSize(RTMP *r, int size); + void RTMP_DropRequest(RTMP *r, int i, int freeit); + int RTMP_Read(RTMP *r, char *buf, int size); + int RTMP_Write(RTMP *r, const char *buf, int size); + +/* hashswf.c */ + int RTMP_HashSWF(const char *url, unsigned int *size, unsigned char *hash, + int age); + + void HandleChangeChunkSize(RTMP *r, const RTMPPacket *packet); + +#ifdef __cplusplus +}; +#endif + +#endif diff --git a/MediaClient/MediaClient/rtmp/rtmp_cln.cpp b/MediaClient/MediaClient/rtmp/rtmp_cln.cpp new file mode 100644 index 0000000..48ed931 --- /dev/null +++ b/MediaClient/MediaClient/rtmp/rtmp_cln.cpp @@ -0,0 +1,1017 @@ +/*************************************************************************************** + * + * 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 "rtmp_cln.h" +#include "h264.h" +#include "h265.h" +#include "media_format.h" + + +void * rtmp_rx_thread(void * argv) +{ + CRtmpClient * pRtmpClient = (CRtmpClient *) argv; + + pRtmpClient->rx_thread(); + + return NULL; +} + +CRtmpClient::CRtmpClient() +: m_pRtmp(NULL) +, m_bRunning(FALSE) +, m_bPause(FALSE) +, m_bVideoReady(FALSE) +, m_bAudioReady(FALSE) +, m_tidRx(0) +, m_nVpsLen(0) +, m_nSpsLen(0) +, m_nPpsLen(0) +, m_nAudioConfigLen(0) +, m_nVideoCodec(VIDEO_CODEC_NONE) +, m_nWidth(0) +, m_nHeight(0) +, m_nFrameRate(0) +, m_nAudioCodec(AUDIO_CODEC_NONE) +, m_nSamplerate(44100) +, m_nChannels(2) +, m_nVideoInitTS(0) +, m_nAudioInitTS(0) +, m_pNotify(NULL) +, m_pUserdata(NULL) +, m_pVideoCB(NULL) +, m_pAudioCB(NULL) +{ + memset(m_url, 0, sizeof(m_url)); + memset(m_user, 0, sizeof(m_user)); + memset(m_pass, 0, sizeof(m_pass)); + + memset(&m_pVps, 0, sizeof(m_pVps)); + memset(&m_pSps, 0, sizeof(m_pVps)); + memset(&m_pPps, 0, sizeof(m_pVps)); + memset(&m_pAudioConfig, 0, sizeof(m_pAudioConfig)); + + m_pMutex = sys_os_create_mutex(); +} + +CRtmpClient::~CRtmpClient() +{ + rtmp_close(); + + if (m_pMutex) + { + sys_os_destroy_sig_mutex(m_pMutex); + m_pMutex = NULL; + } +} + +BOOL CRtmpClient::rtmp_start(const char * url, const char * user, const char * pass) +{ + if (url && url[0] != '\0') + { + strncpy(m_url, url, sizeof(m_url)-1); + } + + if (user && user[0] != '\0') + { + strncpy(m_user, user, sizeof(m_user)-1); + } + + if (pass && pass[0] != '\0') + { + strncpy(m_pass, pass, sizeof(m_pass)-1); + } + + m_bRunning = TRUE; + m_tidRx = sys_os_create_thread((void *)rtmp_rx_thread, this); + + return TRUE; +} + +BOOL CRtmpClient::rtmp_play() +{ + if (m_pRtmp && m_bPause) + { + RTMP_Pause(m_pRtmp, 0); + m_bPause = 0; + } + + return TRUE; +} + +BOOL CRtmpClient::rtmp_stop() +{ + return rtmp_close(); +} + +BOOL CRtmpClient::rtmp_pause() +{ + if (m_pRtmp && !m_bPause) + { + RTMP_Pause(m_pRtmp, 1); + m_bPause = 1; + } + + return TRUE; +} + +BOOL CRtmpClient::rtmp_close() +{ + sys_os_mutex_enter(m_pMutex); + m_pAudioCB = NULL; + m_pVideoCB = NULL; + m_pNotify = NULL; + m_pUserdata = NULL; + sys_os_mutex_leave(m_pMutex); + + if (m_pRtmp && m_pRtmp->m_sb.sb_socket != -1) + { + closesocket(m_pRtmp->m_sb.sb_socket); + m_pRtmp->m_sb.sb_socket = -1; + } + + m_bRunning = FALSE; + + while (m_tidRx) + { + usleep(10*1000); + } + + if (m_pRtmp) + { + RTMP_Close(m_pRtmp); + RTMP_Free(m_pRtmp); + + m_pRtmp = NULL; + } + + m_bVideoReady = FALSE; + m_bAudioReady = FALSE; + + return TRUE; +} + +BOOL CRtmpClient::rtmp_connect() +{ + rtmp_send_notify(RTMP_EVE_CONNECTING); + + m_pRtmp = RTMP_Alloc(); + if (NULL == m_pRtmp) + { + log_print(HT_LOG_ERR, "%s, RTMP_Alloc failed\r\n", __FUNCTION__); + goto FAILED; + } + + RTMP_Init(m_pRtmp); + + // set connection timeout,default 30s + m_pRtmp->Link.timeout = 30; + + if (RTMP_SetupURL(m_pRtmp, m_url) == FALSE) + { + log_print(HT_LOG_ERR, "%s, RTMP_SetupURL failed. url=%s\r\n", __FUNCTION__, m_url); + goto FAILED; + } + + m_pRtmp->Link.lFlags |= RTMP_LF_LIVE; + + RTMP_SetBufferMS(m_pRtmp, DEF_BUFTIME); + + if (!RTMP_Connect(m_pRtmp, NULL)) + { + log_print(HT_LOG_ERR, "%s, RTMP_Connect failed. url=%s\r\n", __FUNCTION__, m_url); + goto FAILED; + } + + if (!RTMP_ConnectStream(m_pRtmp, 0)) + { + log_print(HT_LOG_ERR, "%s, RTMP_ConnectStream failed. url=%s\r\n", __FUNCTION__, m_url); + goto FAILED; + } + + return TRUE; + +FAILED: + + if (m_pRtmp) + { + RTMP_Close(m_pRtmp); + RTMP_Free(m_pRtmp); + + m_pRtmp = NULL; + } + + return FALSE; +} + +int CRtmpClient::rtmp_h264_rx(RTMPPacket * packet) +{ + uint8 * data = (uint8 *) packet->m_body; + uint32 dataLen = packet->m_nBodySize; + + if (data[1] == 0x00) // AVC sequence header + { + if (dataLen < 15) + { + log_print(HT_LOG_WARN, "%s, dataLen=%d\r\n", __FUNCTION__, dataLen); + return 0; + } + + uint32 offset = 10; + int spsnum = (data[offset++] & 0x1f); + int i = 0; + + while (i < spsnum) + { + uint32 spslen = (data[offset] & 0x000000FF) << 8 | (data[offset + 1] & 0x000000FF); + + offset += 2; + + if (offset + spslen > dataLen) + { + return -1; + } + + if (0 == m_nSpsLen && spslen <= sizeof(m_pSps) + 4) + { + m_pSps[0] = 0; + m_pSps[1] = 0; + m_pSps[2] = 0; + m_pSps[3] = 1; + m_nSpsLen = spslen + 4; + memcpy(m_pSps + 4, data + offset, spslen); + } + + offset += spslen; + i++; + } + + int ppsnum = (data[offset++] & 0x1f); + i = 0; + + while (i < ppsnum) + { + uint32 ppslen = (data[offset] & 0x000000FF) << 8 | (data[offset + 1] & 0x000000FF); + + offset += 2; + + if (offset + ppslen > dataLen) + { + return -1; + } + + if (0 == m_nPpsLen && ppslen <= sizeof(m_pPps) + 4) + { + m_pPps[0] = 0; + m_pPps[1] = 0; + m_pPps[2] = 0; + m_pPps[3] = 1; + m_nPpsLen = ppslen + 4; + memcpy(m_pPps + 4, data + offset, ppslen); + } + + offset += ppslen; + i++; + } + + if (!m_bVideoReady) + { + m_bVideoReady = TRUE; + rtmp_send_notify(RTMP_EVE_VIDEOREADY); + } + + if (m_nSpsLen > 0 && m_nPpsLen > 0) + { + rtmp_video_data_cb(m_pSps, m_nSpsLen, 0); + rtmp_video_data_cb(m_pPps, m_nPpsLen, 0); + } + } + else if (data[1] == 0x01) // AVC NALU + { + if (dataLen < 10) + { + log_print(HT_LOG_WARN, "%s, dataLen=%d\r\n", __FUNCTION__, dataLen); + return 0; + } + + int len = 0; + int num = 5; + + while (num < (int)packet->m_nBodySize) + { + len = (data[num] & 0x000000FF) << 24 | (data[num + 1] & 0x000000FF) << 16 | + (data[num + 2] & 0x000000FF) << 8 | (data[num + 3] & 0x000000FF); + + num = num + 4; + + if (data[num] != 0 || data[num+1] != 0 || data[num+2] != 0 || data[num+3] != 1) + { + data[num-4]= 0; + data[num-3]= 0; + data[num-2]= 0; + data[num-1]= 1; + + rtmp_video_data_cb(data + num - 4, len + 4, packet->m_nTimeStamp); + } + else + { + rtmp_video_data_cb(data + num, len, packet->m_nTimeStamp); + } + + num = num + len; + } + } + else + { + log_print(HT_LOG_WARN, "%s, tag type [%02x]!!!\r\n", __FUNCTION__, data[1]); + } + + return 0; +} + +int CRtmpClient::rtmp_h265_rx(RTMPPacket * packet) +{ + uint8 * data = (uint8 *) packet->m_body; + uint32 dataLen = packet->m_nBodySize; + + if (data[1] == 0x00) // AVC sequence header + { + if (dataLen < 32) + { + log_print(HT_LOG_WARN, "%s, dataLen=%d\r\n", __FUNCTION__, dataLen); + return 0; + } + + uint32 offset = 5 + 22; + int numOfArrays = data[offset++]; + + for (int i=0; i dataLen) + { + return -1; + } + + if (naluType == HEVC_NAL_VPS && 0 == m_nVpsLen && naluLen <= sizeof(m_pVps) + 4) + { + m_pVps[0] = 0; + m_pVps[1] = 0; + m_pVps[2] = 0; + m_pVps[3] = 1; + memcpy(m_pVps+4, data+offset, naluLen); + m_nVpsLen = naluLen + 4; + } + else if (naluType == HEVC_NAL_SPS && 0 == m_nSpsLen && naluLen <= sizeof(m_pSps) + 4) + { + m_pSps[0] = 0; + m_pSps[1] = 0; + m_pSps[2] = 0; + m_pSps[3] = 1; + memcpy(m_pSps+4, data+offset, naluLen); + m_nSpsLen = naluLen + 4; + } + else if (naluType == HEVC_NAL_PPS && 0 == m_nPpsLen && naluLen <= sizeof(m_pPps) + 4) + { + m_pPps[0] = 0; + m_pPps[1] = 0; + m_pPps[2] = 0; + m_pPps[3] = 1; + memcpy(m_pPps+4, data+offset, naluLen); + m_nPpsLen = naluLen + 4; + } + + offset += naluLen; + } + } + + if (!m_bVideoReady) + { + m_bVideoReady = TRUE; + rtmp_send_notify(RTMP_EVE_VIDEOREADY); + } + + if (m_nVpsLen > 0 && m_nSpsLen > 0 && m_nPpsLen > 0) + { + rtmp_video_data_cb(m_pVps, m_nVpsLen, 0); + rtmp_video_data_cb(m_pSps, m_nSpsLen, 0); + rtmp_video_data_cb(m_pPps, m_nPpsLen, 0); + } + } + else if (data[1] == 0x01) // AVC NALU + { + if (dataLen < 10) + { + log_print(HT_LOG_WARN, "%s, dataLen=%d\r\n", __FUNCTION__, dataLen); + return 0; + } + + int len = 0; + int num = 5; + + while (num < (int)packet->m_nBodySize) + { + len = (data[num] & 0x000000FF) << 24 | (data[num + 1] & 0x000000FF) << 16 | + (data[num + 2] & 0x000000FF) << 8 | (data[num + 3] & 0x000000FF); + + num = num + 4; + + if (data[num] != 0 || data[num+1] != 0 || data[num+2] != 0 || data[num+3] != 1) + { + data[num-4]= 0; + data[num-3]= 0; + data[num-2]= 0; + data[num-1]= 1; + + rtmp_video_data_cb(data + num - 4, len + 4, packet->m_nTimeStamp); + } + else + { + rtmp_video_data_cb(data + num, len, packet->m_nTimeStamp); + } + + num = num + len; + } + } + else + { + log_print(HT_LOG_WARN, "%s, tag type [%02x]!!!\r\n", __FUNCTION__, data[1]); + } + + return 0; +} + +int CRtmpClient::rtmp_video_rx(RTMPPacket * packet) +{ + int ret = 0; + uint8 v_type = (uint8) packet->m_body[0]; + v_type = (v_type & 0x0f); + + if (v_type == 2) // Sorenson H.263 + { + } + else if (v_type == 3) // Screen video + { + } + else if (v_type == 4) // On2 VP6 + { + } + else if (v_type == 5) // On2 VP6 with alpha channel + { + } + else if (v_type == 6) // Screen video version 2 + { + } + else if (v_type == 7) // AVC + { + m_nVideoCodec = VIDEO_CODEC_H264; + + ret = rtmp_h264_rx(packet); + } + else if (v_type == 12) // H265 + { + m_nVideoCodec = VIDEO_CODEC_H265; + + ret = rtmp_h265_rx(packet); + } + + return ret; +} + +int CRtmpClient::rtmp_g711_rx(RTMPPacket * packet) +{ + uint8 * data = (uint8 *)packet->m_body; + + if (!m_bAudioReady) + { + m_nChannels = ((data[0] & 0x01) ? 2 : 1); + m_nSamplerate = 8000; + m_bAudioReady = TRUE; + + rtmp_send_notify(RTMP_EVE_AUDIOREADY); + } + + rtmp_audio_data_cb(data + 1, packet->m_nBodySize - 1, packet->m_nTimeStamp); + + return 0; +} + +int CRtmpClient::rtmp_aac_rx(RTMPPacket * packet) +{ + uint8 * data = (uint8 *)packet->m_body; + + if (packet->m_nBodySize < 4) + { + return -1; + } + + // AAC Packet Type: 0x00 - AAC Sequence Header; 0x01 - AAC Raw + if (data[1] == 0x00) + { + int nAudioSampleType; + + log_print(HT_LOG_DBG, "%s, len[%u] data[%02X %02X %02X %02X]\r\n", + __FUNCTION__, packet->m_nBodySize, data[0], data[1], data[2], data[3]); + + memcpy(m_pAudioConfig, data+2, 2); + m_nAudioConfigLen = 2; + m_nChannels = ((data[0] & 0x01) ? 2 : 1); // Whether stereo (0: Mono, 1: Stereo) + nAudioSampleType = (data[0] & 0x0c) >> 2; // Audio sample rate (0: 5.5kHz, 1:11KHz, 2:22 kHz, 3:44 kHz) + + switch (nAudioSampleType) + { + case 0: + m_nSamplerate = 5500; + break; + + case 1: + m_nSamplerate = 11025; + break; + + case 2: + m_nSamplerate = 22050; + break; + + case 3: + m_nSamplerate = 44100; + break; + + default: + m_nSamplerate = 44100; + break; + } + + uint16 audioSpecificConfig = 0; + + audioSpecificConfig = (data[2] & 0xff) << 8; + audioSpecificConfig += 0x00ff & data[3]; + + uint8 nSampleFrequencyIndex = (audioSpecificConfig & 0x0780) >> 7; + uint8 nChannels = (audioSpecificConfig & 0x78) >> 3; + + m_nChannels = nChannels; + + switch (nSampleFrequencyIndex) + { + case 0: + m_nSamplerate = 96000; + break; + + case 1: + m_nSamplerate = 88200; + break; + + case 2: + m_nSamplerate = 64000; + break; + + case 3: + m_nSamplerate = 48000; + break; + + case 4: + m_nSamplerate = 44100; + break; + + case 5: + m_nSamplerate = 32000; + break; + + case 6: + m_nSamplerate = 24000; + break; + + case 7: + m_nSamplerate = 22050; + break; + + case 8: + m_nSamplerate = 16000; + break; + + case 9: + m_nSamplerate = 12000; + break; + + case 10: + m_nSamplerate = 11025; + break; + + case 11: + m_nSamplerate = 8000; + break; + + case 12: + m_nSamplerate = 7350; + break; + + default: + m_nSamplerate = 44100; + break; + } + + if (!m_bAudioReady) + { + m_bAudioReady = TRUE; + rtmp_send_notify(RTMP_EVE_AUDIOREADY); + } + } + else if (data[1] == 0x01) + { + rtmp_audio_data_cb(data + 2, packet->m_nBodySize - 2, packet->m_nTimeStamp); + } + + return 0; +} + +int CRtmpClient::rtmp_audio_rx(RTMPPacket * packet) +{ + int ret = 0; + uint8 a_type = (uint8) packet->m_body[0]; + a_type = a_type >> 4; + + if (a_type == 0) // Linear PCM, platform endian + { + } + else if (a_type == 1) // ADPCM + { + } + else if (a_type == 2) // MP3 + { + } + else if (a_type == 3) // Linear PCM, little endian + { + } + else if (a_type == 7) // G711A + { + m_nAudioCodec = AUDIO_CODEC_G711A; + + ret = rtmp_g711_rx(packet); + } + else if (a_type == 8) // G711U + { + m_nAudioCodec = AUDIO_CODEC_G711U; + + ret = rtmp_g711_rx(packet); + } + else if (a_type == 10) // AAC + { + m_nAudioCodec = AUDIO_CODEC_AAC; + + ret = rtmp_aac_rx(packet); + } + else if (a_type == 11) // Speex + { + } + else if (a_type == 14) // MP3 8-Khz + { + } + + return ret; +} + +int CRtmpClient::rtmp_metadata_rx(RTMPPacket * packet) +{ + AMFObject obj; + AVal val; + AMFObjectProperty * property; + AMFObject subObject; + + int nRes = AMF_Decode(&obj, packet->m_body, packet->m_nBodySize, FALSE); + if (nRes < 0) + { + log_print(HT_LOG_ERR, "%s, error decoding invoke packet\r\n", __FUNCTION__); + return -1; + } + + AMF_Dump(&obj); + + for (int n = 0; n < obj.o_num; n++) + { + property = AMF_GetProp(&obj, NULL, n); + if (NULL == property) + { + continue; + } + + if (property->p_type == AMF_OBJECT || property->p_type == AMF_ECMA_ARRAY) + { + AMFProp_GetObject(property, &subObject); + + for (int m = 0; m < subObject.o_num; m++) + { + property = AMF_GetProp(&subObject, NULL, m); + if (NULL == property) + { + continue; + } + + if (property->p_type == AMF_OBJECT) + { + } + else if (property->p_type == AMF_BOOLEAN) + { + int bVal = AMFProp_GetBoolean(property); + if (strncmp("stereo", property->p_name.av_val, property->p_name.av_len) == 0) + { + m_nChannels = bVal > 0 ? 2 : 1; + } + } + else if (property->p_type == AMF_NUMBER) + { + double dVal = AMFProp_GetNumber(property); + if (strncmp("width", property->p_name.av_val, property->p_name.av_len) == 0) + { + m_nWidth = (int)dVal; + } + else if (strcasecmp("height", property->p_name.av_val) == 0) + { + m_nHeight = (int)dVal; + } + else if (strcasecmp("framerate", property->p_name.av_val) == 0) + { + m_nFrameRate = dVal; + } + else if (strcasecmp("videocodecid", property->p_name.av_val) == 0) + { + switch ((int)dVal) + { + case 7: + m_nVideoCodec = VIDEO_CODEC_H264; + break; + case 12: + m_nVideoCodec = VIDEO_CODEC_H265; + break; + } + } + else if (strcasecmp("audiosamplerate", property->p_name.av_val) == 0) + { + m_nSamplerate = (int)dVal; + } + else if (strcasecmp("audiosamplesize", property->p_name.av_val) == 0) + { + } + else if (strcasecmp("audiocodecid", property->p_name.av_val) == 0) + { + switch ((int)dVal) + { + case 7: + m_nAudioCodec = AUDIO_CODEC_G711A; + break; + case 8: + m_nAudioCodec = AUDIO_CODEC_G711U; + break; + case 10: + m_nAudioCodec = AUDIO_CODEC_AAC; + break; + } + } + else if (strcasecmp("filesize", property->p_name.av_val) == 0) + { + } + } + else if (property->p_type == AMF_STRING) + { + AMFProp_GetString(property, &val); + } + } + } + else + { + AMFProp_GetString(property, &val); + } + } + + AMF_Reset(&obj); + + if (m_nVideoCodec != VIDEO_CODEC_NONE && !m_bVideoReady) + { + m_bVideoReady = TRUE; + rtmp_send_notify(RTMP_EVE_VIDEOREADY); + } + + if (m_nAudioCodec != AUDIO_CODEC_NONE && !m_bAudioReady) + { + m_bAudioReady = TRUE; + rtmp_send_notify(RTMP_EVE_AUDIOREADY); + } + + return 0; +} + +void CRtmpClient::rx_thread() +{ + int ret = 0; + + if (!rtmp_connect()) + { + m_tidRx = 0; + rtmp_send_notify(RTMP_EVE_CONNFAIL); + return; + } + + RTMPPacket pc = { 0 }; + + while (m_bRunning) + { + if (RTMP_ReadPacket(m_pRtmp, &pc) && RTMPPacket_IsReady(&pc)) + { + if (!pc.m_nBodySize) + { + continue; + } + + if (pc.m_packetType == RTMP_PACKET_TYPE_VIDEO && RTMP_ClientPacket(m_pRtmp, &pc)) + { + ret = rtmp_video_rx(&pc); + } + else if (pc.m_packetType == RTMP_PACKET_TYPE_AUDIO && RTMP_ClientPacket(m_pRtmp, &pc)) + { + ret = rtmp_audio_rx(&pc); + } + else if (pc.m_packetType == RTMP_PACKET_TYPE_INFO && RTMP_ClientPacket(m_pRtmp, &pc)) + { + rtmp_metadata_rx(&pc); + } + + RTMPPacket_Free(&pc); + + if (ret < 0) + { + log_print(HT_LOG_ERR, "%s, ret = %d\r\n", __FUNCTION__, ret); + break; + } + } + else if (!RTMP_IsConnected(m_pRtmp)) + { + break; + } + } + + m_tidRx = 0; + + rtmp_send_notify(RTMP_EVE_STOPPED); +} + +void CRtmpClient::rtmp_send_notify(int event) +{ + sys_os_mutex_enter(m_pMutex); + + if (m_pNotify) + { + m_pNotify(event, m_pUserdata); + } + + sys_os_mutex_leave(m_pMutex); +} + +void CRtmpClient::rtmp_video_data_cb(uint8 * p_data, int len, uint32 ts) +{ + if (m_nVideoInitTS == 0 && ts != 0) + { + m_nVideoInitTS = ts; + } + + sys_os_mutex_enter(m_pMutex); + if (m_pVideoCB) + { + m_pVideoCB(p_data, len, ts, m_pUserdata); + } + sys_os_mutex_leave(m_pMutex); +} + +void CRtmpClient::rtmp_audio_data_cb(uint8 * p_data, int len, uint32 ts) +{ + if (m_nAudioInitTS == 0 && ts != 0) + { + m_nAudioInitTS = ts; + } + + sys_os_mutex_enter(m_pMutex); + if (m_pAudioCB) + { + m_pAudioCB(p_data, len, ts, m_pUserdata); + } + sys_os_mutex_leave(m_pMutex); +} + +void CRtmpClient::get_h264_params() +{ + if (m_nSpsLen > 0) + { + rtmp_video_data_cb(m_pSps, m_nSpsLen, 0); + } + + if (m_nPpsLen > 0) + { + rtmp_video_data_cb(m_pPps, m_nPpsLen, 0); + } +} + +BOOL CRtmpClient::get_h264_params(uint8 * p_sps, int * sps_len, uint8 * p_pps, int * pps_len) +{ + if (m_nSpsLen > 0) + { + *sps_len = m_nSpsLen; + memcpy(p_sps, m_pSps, m_nSpsLen); + } + + if (m_nPpsLen > 0) + { + *pps_len = m_nPpsLen; + memcpy(p_pps, m_pPps, m_nPpsLen); + } + + return TRUE; +} + +void CRtmpClient::get_h265_params() +{ + if (m_nVpsLen > 0) + { + rtmp_video_data_cb(m_pVps, m_nVpsLen, 0); + } + + if (m_nSpsLen > 0) + { + rtmp_video_data_cb(m_pSps, m_nSpsLen, 0); + } + + if (m_nPpsLen > 0) + { + rtmp_video_data_cb(m_pPps, m_nPpsLen, 0); + } +} + +BOOL CRtmpClient::get_h265_params(uint8 * p_sps, int * sps_len, uint8 * p_pps, int * pps_len, uint8 * p_vps, int * vps_len) +{ + if (m_nVpsLen > 0) + { + *vps_len = m_nVpsLen; + memcpy(p_vps, m_pVps, m_nVpsLen); + } + + if (m_nSpsLen > 0) + { + *sps_len = m_nSpsLen; + memcpy(p_sps, m_pSps, m_nSpsLen); + } + + if (m_nPpsLen > 0) + { + *pps_len = m_nPpsLen; + memcpy(p_pps, m_pPps, m_nPpsLen); + } + + return TRUE; +} + +void CRtmpClient::set_notify_cb(rtmp_notify_cb notify, void * userdata) +{ + sys_os_mutex_enter(m_pMutex); + m_pNotify = notify; + m_pUserdata = userdata; + sys_os_mutex_leave(m_pMutex); +} + +void CRtmpClient::set_video_cb(rtmp_video_cb cb) +{ + sys_os_mutex_enter(m_pMutex); + m_pVideoCB = cb; + sys_os_mutex_leave(m_pMutex); +} + +void CRtmpClient::set_audio_cb(rtmp_audio_cb cb) +{ + sys_os_mutex_enter(m_pMutex); + m_pAudioCB = cb; + sys_os_mutex_leave(m_pMutex); +} + + diff --git a/MediaClient/MediaClient/rtmp/rtmp_cln.h b/MediaClient/MediaClient/rtmp/rtmp_cln.h new file mode 100644 index 0000000..47a8ced --- /dev/null +++ b/MediaClient/MediaClient/rtmp/rtmp_cln.h @@ -0,0 +1,140 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef RTMP_CLN_H +#define RTMP_CLN_H + +#include "rtmp.h" +#include "h264.h" + + +#define RTMP_EVE_STOPPED 40 +#define RTMP_EVE_CONNECTING 41 +#define RTMP_EVE_CONNFAIL 42 +#define RTMP_EVE_NOSIGNAL 43 +#define RTMP_EVE_RESUME 44 +#define RTMP_EVE_AUTHFAILED 45 +#define RTMP_EVE_NODATA 46 +#define RTMP_EVE_VIDEOREADY 47 +#define RTMP_EVE_AUDIOREADY 48 + + +#define DEF_BUFTIME (10 * 60 * 60 * 1000) /* 10 hours default */ + +typedef int (*rtmp_notify_cb)(int, void *); +typedef int (*rtmp_video_cb)(uint8 *, int, uint32, void *); +typedef int (*rtmp_audio_cb)(uint8 *, int, uint32, void *); + + +class CRtmpClient +{ +public: + CRtmpClient(void); + ~CRtmpClient(void); + +public: + BOOL rtmp_start(const char * url, const char * user, const char * pass); + BOOL rtmp_play(); + BOOL rtmp_stop(); + BOOL rtmp_pause(); + BOOL rtmp_close(); + + char * get_url() {return m_url;} + char * get_user() {return m_user;} + char * get_pass() {return m_pass;} + int audio_codec() {return m_nAudioCodec;} + int video_codec() {return m_nVideoCodec;} + void get_h264_params(); + BOOL get_h264_params(uint8 * p_sps, int * sps_len, uint8 * p_pps, int * pps_len); + void get_h265_params(); + BOOL get_h265_params(uint8 * p_sps, int * sps_len, uint8 * p_pps, int * pps_len, uint8 * p_vps, int * vps_len); + int get_video_width() {return m_nWidth;} + int get_video_height() {return m_nHeight;} + double get_video_framerate() {return m_nFrameRate;} + int get_audio_samplerate() {return m_nSamplerate;} + int get_audio_channels() {return m_nChannels;} + uint8 * get_audio_config() {return m_pAudioConfig;} + int get_audio_config_len() {return m_nAudioConfigLen;} + uint32 get_video_init_ts() {return m_nVideoInitTS;} + uint32 get_audio_init_ts() {return m_nAudioInitTS;} + + void set_notify_cb(rtmp_notify_cb notify, void * userdata); + void set_video_cb(rtmp_video_cb cb); + void set_audio_cb(rtmp_audio_cb cb); + + void rx_thread(); + void rtmp_video_data_cb(uint8 * p_data, int len, uint32 ts); + void rtmp_audio_data_cb(uint8 * p_data, int len, uint32 ts); + +private: + BOOL rtmp_connect(); + int rtmp_h264_rx(RTMPPacket * packet); + int rtmp_h265_rx(RTMPPacket * packet); + int rtmp_video_rx(RTMPPacket * packet); + int rtmp_g711_rx(RTMPPacket * packet); + int rtmp_aac_rx(RTMPPacket * packet); + int rtmp_audio_rx(RTMPPacket * packet); + int rtmp_metadata_rx(RTMPPacket * packet); + void rtmp_send_notify(int event); + +private: + char m_url[512]; + char m_user[64]; + char m_pass[64]; + + RTMP * m_pRtmp; + BOOL m_bRunning; + BOOL m_bPause; + BOOL m_bVideoReady; + BOOL m_bAudioReady; + pthread_t m_tidRx; + + uint8 m_pVps[256]; + int m_nVpsLen; + uint8 m_pSps[256]; + int m_nSpsLen; + uint8 m_pPps[256]; + int m_nPpsLen; + + uint8 m_pAudioConfig[32]; + uint32 m_nAudioConfigLen; + + int m_nVideoCodec; + int m_nWidth; + int m_nHeight; + double m_nFrameRate; + int m_nAudioCodec; + int m_nSamplerate; + int m_nChannels; + + uint32 m_nVideoInitTS; + uint32 m_nAudioInitTS; + + rtmp_notify_cb m_pNotify; + void * m_pUserdata; + rtmp_video_cb m_pVideoCB; + rtmp_audio_cb m_pAudioCB; + void * m_pMutex; +}; + +#endif + + + + diff --git a/MediaClient/MediaClient/rtmp/rtmp_sys.h b/MediaClient/MediaClient/rtmp/rtmp_sys.h new file mode 100644 index 0000000..463070b --- /dev/null +++ b/MediaClient/MediaClient/rtmp/rtmp_sys.h @@ -0,0 +1,139 @@ +#ifndef __RTMP_SYS_H__ +#define __RTMP_SYS_H__ +/* + * Copyright (C) 2010 Howard Chu + * + * This file is part of librtmp. + * + * librtmp is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1, + * or (at your option) any later version. + * + * librtmp is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with librtmp see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * http://www.gnu.org/copyleft/lgpl.html + */ + +#ifdef _WIN32 + +#include +#include + +#ifdef _MSC_VER /* MSVC */ +//#define snprintf _snprintf +#define strcasecmp stricmp +#define strncasecmp strnicmp +//#define vsnprintf _vsnprintf +#endif + +#define GetSockError() WSAGetLastError() +#define SetSockError(e) WSASetLastError(e) +#define setsockopt(a,b,c,d,e) (setsockopt)(a,b,c,(const char *)d,(int)e) +//#define EWOULDBLOCK WSAETIMEDOUT /* we don't use nonblocking, but we do use timeouts */ +#define sleep(n) Sleep(n*1000) +#define msleep(n) Sleep(n) +#define SET_RCVTIMEO(tv,s) int tv = s*1000 +#else /* !_WIN32 */ +#include +#include +#include +#include +#include +#include +#include +#include +#define GetSockError() errno +#define SetSockError(e) errno = e +#undef closesocket +#define closesocket(s) close(s) +#define msleep(n) usleep(n*1000) +#define SET_RCVTIMEO(tv,s) struct timeval tv = {s,0} +#endif + +#include "rtmp.h" + +#ifdef USE_POLARSSL +#include +#include +#include +#include +#if POLARSSL_VERSION_NUMBER < 0x01010000 +#define havege_random havege_rand +#endif +#if POLARSSL_VERSION_NUMBER >= 0x01020000 +#define SSL_SET_SESSION(S,resume,timeout,ctx) ssl_set_session(S,ctx) +#else +#define SSL_SET_SESSION(S,resume,timeout,ctx) ssl_set_session(S,resume,timeout,ctx) +#endif +typedef struct tls_ctx { + havege_state hs; + ssl_session ssn; +} tls_ctx; +typedef struct tls_server_ctx { + havege_state *hs; + x509_cert cert; + rsa_context key; + ssl_session ssn; + const char *dhm_P, *dhm_G; +} tls_server_ctx; + +#define TLS_CTX tls_ctx * +#define TLS_client(ctx,s) s = malloc(sizeof(ssl_context)); ssl_init(s);\ + ssl_set_endpoint(s, SSL_IS_CLIENT); ssl_set_authmode(s, SSL_VERIFY_NONE);\ + ssl_set_rng(s, havege_random, &ctx->hs);\ + ssl_set_ciphersuites(s, ssl_default_ciphersuites);\ + SSL_SET_SESSION(s, 1, 600, &ctx->ssn) +#define TLS_server(ctx,s) s = malloc(sizeof(ssl_context)); ssl_init(s);\ + ssl_set_endpoint(s, SSL_IS_SERVER); ssl_set_authmode(s, SSL_VERIFY_NONE);\ + ssl_set_rng(s, havege_random, ((tls_server_ctx*)ctx)->hs);\ + ssl_set_ciphersuites(s, ssl_default_ciphersuites);\ + SSL_SET_SESSION(s, 1, 600, &((tls_server_ctx*)ctx)->ssn);\ + ssl_set_own_cert(s, &((tls_server_ctx*)ctx)->cert, &((tls_server_ctx*)ctx)->key);\ + ssl_set_dh_param(s, ((tls_server_ctx*)ctx)->dhm_P, ((tls_server_ctx*)ctx)->dhm_G) +#define TLS_setfd(s,fd) ssl_set_bio(s, net_recv, &fd, net_send, &fd) +#define TLS_connect(s) ssl_handshake(s) +#define TLS_accept(s) ssl_handshake(s) +#define TLS_read(s,b,l) ssl_read(s,(unsigned char *)b,l) +#define TLS_write(s,b,l) ssl_write(s,(unsigned char *)b,l) +#define TLS_shutdown(s) ssl_close_notify(s) +#define TLS_close(s) ssl_free(s); free(s) + +#elif defined(USE_GNUTLS) +#include +typedef struct tls_ctx { + gnutls_certificate_credentials_t cred; + gnutls_priority_t prios; +} tls_ctx; +#define TLS_CTX tls_ctx * +#define TLS_client(ctx,s) gnutls_init((gnutls_session_t *)(&s), GNUTLS_CLIENT); gnutls_priority_set(s, ctx->prios); gnutls_credentials_set(s, GNUTLS_CRD_CERTIFICATE, ctx->cred) +#define TLS_server(ctx,s) gnutls_init((gnutls_session_t *)(&s), GNUTLS_SERVER); gnutls_priority_set_direct(s, "NORMAL", NULL); gnutls_credentials_set(s, GNUTLS_CRD_CERTIFICATE, ctx) +#define TLS_setfd(s,fd) gnutls_transport_set_ptr(s, (gnutls_transport_ptr_t)(long)fd) +#define TLS_connect(s) gnutls_handshake(s) +#define TLS_accept(s) gnutls_handshake(s) +#define TLS_read(s,b,l) gnutls_record_recv(s,b,l) +#define TLS_write(s,b,l) gnutls_record_send(s,b,l) +#define TLS_shutdown(s) gnutls_bye(s, GNUTLS_SHUT_RDWR) +#define TLS_close(s) gnutls_deinit(s) + +#else /* USE_OPENSSL */ +#define TLS_CTX SSL_CTX * +#define TLS_client(ctx,s) s = SSL_new(ctx) +#define TLS_server(ctx,s) s = SSL_new(ctx) +#define TLS_setfd(s,fd) SSL_set_fd(s,fd) +#define TLS_connect(s) SSL_connect(s) +#define TLS_accept(s) SSL_accept(s) +#define TLS_read(s,b,l) SSL_read(s,b,l) +#define TLS_write(s,b,l) SSL_write(s,b,l) +#define TLS_shutdown(s) SSL_shutdown(s) +#define TLS_close(s) SSL_free(s) + +#endif +#endif diff --git a/MediaClient/MediaClient/rtp/aac_rtp_rx.cpp b/MediaClient/MediaClient/rtp/aac_rtp_rx.cpp new file mode 100644 index 0000000..6bc4d73 --- /dev/null +++ b/MediaClient/MediaClient/rtp/aac_rtp_rx.cpp @@ -0,0 +1,206 @@ +/*************************************************************************************** + * + * 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 "aac_rtp_rx.h" +#include "bs.h" + + +BOOL aac_data_rx(AACRXI * p_rxi, uint8 * p_data, int len) +{ + struct AUHeader + { + uint32 size; + uint32 index; // indexDelta for the 2nd & subsequent headers + }; + + uint8* headerStart = p_data; + uint32 packetSize = len; + uint32 resultSpecialHeaderSize; + + uint32 fNumAUHeaders; // in the most recently read packet + struct AUHeader* fAUHeaders; + + // default values: + resultSpecialHeaderSize = 0; + fNumAUHeaders = 0; + fAUHeaders = NULL; + + if (p_rxi->size_length == 0) + { + return FALSE; + } + + // The packet begins with a "AU Header Section". Parse it, to + // determine the "AU-header"s for each frame present in this packet + resultSpecialHeaderSize += 2; + if (packetSize < resultSpecialHeaderSize) + { + return FALSE; + } + + uint32 AU_headers_length = (headerStart[0] << 8) | headerStart[1]; + uint32 AU_headers_length_bytes = (AU_headers_length + 7) / 8; + if (packetSize < resultSpecialHeaderSize + AU_headers_length_bytes) + { + return FALSE; + } + resultSpecialHeaderSize += AU_headers_length_bytes; + + // Figure out how many AU-headers are present in the packet + int bitsAvail = AU_headers_length - (p_rxi->size_length + p_rxi->index_length); + if (bitsAvail >= 0 && (p_rxi->size_length + p_rxi->index_delta_length) > 0) + { + fNumAUHeaders = 1 + bitsAvail / (p_rxi->size_length + p_rxi->index_delta_length); + } + + if (fNumAUHeaders > 0) + { + fAUHeaders = new AUHeader[fNumAUHeaders]; + // Fill in each header: + bs_t bs; + bs_init(&bs, &headerStart[2], AU_headers_length); + + fAUHeaders[0].size = bs_read(&bs, p_rxi->size_length); + fAUHeaders[0].index = bs_read(&bs, p_rxi->index_length); + + for (uint32 i = 1; i < fNumAUHeaders; ++i) + { + fAUHeaders[i].size = bs_read(&bs, p_rxi->size_length); + fAUHeaders[i].index = bs_read(&bs, p_rxi->index_delta_length); + } + } + + p_data += resultSpecialHeaderSize; + len -= resultSpecialHeaderSize; + + if (fNumAUHeaders == 1 && (uint32) len < fAUHeaders[0].size) + { + if (fAUHeaders[0].size > p_rxi->buf_len) + { + if (fAUHeaders) + { + delete[] fAUHeaders; + } + + return FALSE; + } + + memcpy(p_rxi->p_buf + p_rxi->d_offset, p_data, len); + p_rxi->d_offset += len; + + if (p_rxi->rtprxi.rxf_marker) + { + if (p_rxi->d_offset != fAUHeaders[0].size) + { + if (fAUHeaders) + { + delete[] fAUHeaders; + } + + p_rxi->d_offset = 0; + return FALSE; + } + + if (p_rxi->pkt_func) + { + p_rxi->pkt_func(p_rxi->p_buf, p_rxi->d_offset, p_rxi->rtprxi.ts, p_rxi->rtprxi.seq, p_rxi->user_data); + } + } + } + else + { + for (uint32 i = 0; i < fNumAUHeaders; i++) + { + if ((uint32) len < fAUHeaders[i].size) + { + if (fAUHeaders) + { + delete[] fAUHeaders; + } + + return FALSE; + } + + memcpy(p_rxi->p_buf, p_data, fAUHeaders[i].size); + p_data += fAUHeaders[i].size; + len -= fAUHeaders[i].size; + + if (p_rxi->pkt_func) + { + p_rxi->pkt_func(p_rxi->p_buf, fAUHeaders[i].size, p_rxi->rtprxi.ts, p_rxi->rtprxi.seq, p_rxi->user_data); + } + } + } + + if (fAUHeaders) + { + delete[] fAUHeaders; + } + + return TRUE; +} + +BOOL aac_rtp_rx(AACRXI * p_rxi, uint8 * p_data, int len) +{ + if (p_rxi == NULL) + { + return FALSE; + } + + if (!rtp_data_rx(&p_rxi->rtprxi, p_data, len)) + { + return FALSE; + } + + return aac_data_rx(p_rxi, p_rxi->rtprxi.p_data, p_rxi->rtprxi.len); +} + +BOOL aac_rxi_init(AACRXI * p_rxi, VRTPRXCBF cbf, void * p_userdata) +{ + memset(p_rxi, 0, sizeof(AACRXI)); + + p_rxi->buf_len = RTP_MAX_AUDIO_BUFF; + + p_rxi->p_buf_org = (uint8 *)malloc(p_rxi->buf_len); + if (p_rxi->p_buf_org == NULL) + { + return FALSE; + } + + p_rxi->p_buf = p_rxi->p_buf_org + 32; + p_rxi->buf_len -= 32; + p_rxi->pkt_func = cbf; + p_rxi->user_data = p_userdata; + + return TRUE; +} + +void aac_rxi_deinit(AACRXI * p_rxi) +{ + if (p_rxi->p_buf_org) + { + free(p_rxi->p_buf_org); + } + + memset(p_rxi, 0, sizeof(AACRXI)); +} + + + diff --git a/MediaClient/MediaClient/rtp/aac_rtp_rx.h b/MediaClient/MediaClient/rtp/aac_rtp_rx.h new file mode 100644 index 0000000..f31dec6 --- /dev/null +++ b/MediaClient/MediaClient/rtp/aac_rtp_rx.h @@ -0,0 +1,59 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef AAC_RTP_RX_H +#define AAC_RTP_RX_H + +#include "rtp_rx.h" + + +typedef struct aac_rtp_rx_info +{ + RTPRXI rtprxi; + + uint8 * p_buf_org; // Allocated buffer + uint8 * p_buf; // = p_buf_org + 32 + uint32 buf_len; // Buffer length -32 + uint32 d_offset; // Data offset + + VRTPRXCBF pkt_func; // callback function + void * user_data; // user data + + int size_length; + int index_length; + int index_delta_length; +} AACRXI; + + +#ifdef __cplusplus +extern "C" { +#endif + +BOOL aac_data_rx(AACRXI * p_rxi, uint8 * p_data, int len); +BOOL aac_rtp_rx(AACRXI * p_rxi, uint8 * p_data, int len); +BOOL aac_rxi_init(AACRXI * p_rxi, VRTPRXCBF cbf, void * p_userdata); +void aac_rxi_deinit(AACRXI * p_rxi); + +#ifdef __cplusplus +} +#endif + + +#endif + diff --git a/MediaClient/MediaClient/rtp/bs.h b/MediaClient/MediaClient/rtp/bs.h new file mode 100644 index 0000000..785f593 --- /dev/null +++ b/MediaClient/MediaClient/rtp/bs.h @@ -0,0 +1,382 @@ + +#ifdef BS_H +#warning FIXME Multiple inclusion of bs.h +#else +#define BS_H + +typedef struct bs_s +{ + uint8 * p_start; + uint8 * p; + uint8 * p_end; + + int i_left; /* i_count number of available bits */ +} bs_t; + +static inline void bs_init(bs_t *s, void *p_data, int i_data) +{ + s->p_start = (uint8 *)p_data; + s->p = (uint8 *)p_data; + s->p_end = s->p + i_data; + s->i_left = 8; +} + +static inline int bs_pos(bs_t *s) +{ + return (int)(8 * (s->p - s->p_start) + 8 - s->i_left); +} + +static inline int bs_left(bs_t *s) +{ + return (int)(8 * (s->p_end - s->p) + 8 - s->i_left); +} + +static inline int bs_eof(bs_t *s) +{ + return (s->p >= s->p_end ? 1: 0); +} + +static inline uint32 bs_read(bs_t *s, int i_count) +{ + static uint32 i_mask[33] = { 0x00, + 0x01, 0x03, 0x07, 0x0f, + 0x1f, 0x3f, 0x7f, 0xff, + 0x1ff, 0x3ff, 0x7ff, 0xfff, + 0x1fff, 0x3fff, 0x7fff, 0xffff, + 0x1ffff, 0x3ffff, 0x7ffff, 0xfffff, + 0x1fffff, 0x3fffff, 0x7fffff, 0xffffff, + 0x1ffffff, 0x3ffffff, 0x7ffffff, 0xfffffff, + 0x1fffffff,0x3fffffff,0x7fffffff,0xffffffff}; + int i_shr; + uint32 i_result = 0; + + while (i_count > 0) + { + if (s->p >= s->p_end) + { + break; + } + + if ((i_shr = s->i_left - i_count) >= 0) + { + /* more in the buffer than requested */ + i_result |= (*s->p >> i_shr)&i_mask[i_count]; + s->i_left -= i_count; + if (s->i_left == 0) + { + s->p++; + s->i_left = 8; + } + + return i_result; + } + else + { + /* less in the buffer than requested */ + i_result |= (*s->p&i_mask[s->i_left]) << -i_shr; + i_count -= s->i_left; + s->p++; + s->i_left = 8; + } + } + + return i_result; +} + +static inline uint32 bs_read1(bs_t *s) +{ + if (s->p < s->p_end) + { + uint32 i_result; + + s->i_left--; + + i_result = (*s->p >> s->i_left)&0x01; + if (s->i_left == 0) + { + s->p++; + s->i_left = 8; + } + + return i_result; + } + + return 0; +} +static inline uint32 bs_show(bs_t *s, int i_count) +{ + if (s->p < s->p_end && i_count > 0) + { + uint32 i_cache = ((s->p[0] << 24)+(s->p[1] << 16)+(s->p[2] << 8)+s->p[3]) << (8-s->i_left); + return (i_cache >> (32 - i_count)); + } + + return 0; +} + +/* TODO optimize */ +static inline void bs_skip(bs_t *s, int i_count) +{ + s->i_left -= i_count; + + while (s->i_left <= 0) + { + s->p++; + s->i_left += 8; + } +} + +static inline int bs_read_ue(bs_t *s) +{ + int i = 0; + + while (bs_read1(s) == 0 && s->p < s->p_end && i < 32) + { + i++; + } + + return ((1 << i) - 1 + bs_read(s, i)); +} + +static inline int bs_read_se(bs_t *s) +{ + int val = bs_read_ue(s); + + return val&0x01 ? (val+1)/2 : -(val/2); +} + +static inline int bs_read_te(bs_t *s, int x) +{ + if (x == 1) + { + return 1 - bs_read1(s); + } + else if (x > 1) + { + return bs_read_ue(s); + } + + return 0; +} + +/* TODO optimize (write x bits at once) */ +static inline void bs_write(bs_t *s, int i_count, uint32 i_bits) +{ + while (i_count > 0) + { + if (s->p >= s->p_end) + { + break; + } + + i_count--; + + if ((i_bits >> i_count) & 0x01) + { + *s->p |= 1 << (s->i_left - 1); + } + else + { + *s->p &= ~(1 << (s->i_left - 1)); + } + + s->i_left--; + + if (s->i_left == 0) + { + s->p++; + s->i_left = 8; + } + } +} + +static inline void bs_write1(bs_t *s, uint32 i_bits) +{ + if (s->p < s->p_end) + { + s->i_left--; + + if (i_bits & 0x01) + { + *s->p |= 1 << s->i_left; + } + else + { + *s->p &= ~(1 << s->i_left); + } + + if (s->i_left == 0) + { + s->p++; + s->i_left = 8; + } + } +} + +static inline void bs_align(bs_t *s) +{ + if (s->i_left != 8) + { + s->i_left = 8; + s->p++; + } +} + +static inline void bs_align_0(bs_t *s) +{ + if (s->i_left != 8) + { + bs_write(s, s->i_left, 0); + } +} + +static inline void bs_align_1(bs_t *s) +{ + if (s->i_left != 8) + { + bs_write(s, s->i_left, ~0); + } +} + +/* golomb functions */ + +static inline void bs_write_ue(bs_t *s, uint32 val) +{ + int i_size = 0; + static const int i_size0_255[256] = + { + 1,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, + 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8 + }; + + if (val == 0) + { + bs_write(s, 1, 1); + } + else + { + uint32 tmp = ++val; + + if (tmp >= 0x00010000) + { + i_size += 16; + tmp >>= 16; + } + + if (tmp >= 0x100) + { + i_size += 8; + tmp >>= 8; + } + + i_size += i_size0_255[tmp]; + + bs_write(s, 2 * i_size - 1, val); + } +} + +static inline void bs_write_se(bs_t *s, int val) +{ + bs_write_ue(s, val <= 0 ? -val * 2 : val * 2 - 1); +} + +static inline void bs_write_te(bs_t *s, int x, int val) +{ + if (x == 1) + { + bs_write(s, 1, ~val); + } + else if (x > 1) + { + bs_write_ue(s, val); + } +} + +static inline void bs_rbsp_trailing(bs_t *s) +{ + bs_write(s, 1, 1); + + if (s->i_left != 8) + { + bs_write(s, s->i_left, 0x00); + } +} + +static inline int bs_size_ue(uint32 val) +{ + static const int i_size0_254[255] = + { + 1, 3, 3, 5, 5, 5, 5, 7, 7, 7, 7, 7, 7, 7, 7, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15 + }; + + if (val < 255) + { + return i_size0_254[val]; + } + else + { + int i_size = 0; + + val++; + + if (val >= 0x10000) + { + i_size += 32; + val = (val >> 16) - 1; + } + + if (val >= 0x100) + { + i_size += 16; + val = (val >> 8) - 1; + } + + return i_size0_254[val] + i_size; + } +} + +static inline int bs_size_se(int val) +{ + return bs_size_ue(val <= 0 ? -val * 2 : val * 2 - 1); +} + +static inline int bs_size_te(int x, int val) +{ + if (x == 1) + { + return 1; + } + else if (x > 1) + { + return bs_size_ue(val); + } + + return 0; +} + +static inline uint8 * bs_data(bs_t *s) +{ + return s->p - (8 - s->i_left) / 8; +} + +#endif + + + diff --git a/MediaClient/MediaClient/rtp/h264.h b/MediaClient/MediaClient/rtp/h264.h new file mode 100644 index 0000000..4284f59 --- /dev/null +++ b/MediaClient/MediaClient/rtp/h264.h @@ -0,0 +1,56 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef H264_H +#define H264_H + + +/* NAL unit types */ +enum +{ + H264_NAL_SLICE = 1, + H264_NAL_DPA = 2, + H264_NAL_DPB = 3, + H264_NAL_DPC = 4, + H264_NAL_IDR = 5, + H264_NAL_SEI = 6, + H264_NAL_SPS = 7, + H264_NAL_PPS = 8, + H264_NAL_AUD = 9, + H264_NAL_END_SEQUENCE = 10, + H264_NAL_END_STREAM = 11, + H264_NAL_FILLER_DATA = 12, + H264_NAL_SPS_EXT = 13, + H264_NAL_AUXILIARY_SLICE = 19, +}; + + +typedef struct +{ + uint8 sps[256]; + int sps_len; + + uint8 pps[256]; + int pps_len; +} H264ParamSets; + +#endif + + + diff --git a/MediaClient/MediaClient/rtp/h264_rtp_rx.cpp b/MediaClient/MediaClient/rtp/h264_rtp_rx.cpp new file mode 100644 index 0000000..c3432bb --- /dev/null +++ b/MediaClient/MediaClient/rtp/h264_rtp_rx.cpp @@ -0,0 +1,299 @@ +/*************************************************************************************** + * + * 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 "rtp.h" +#include "h264_rtp_rx.h" + + +/****************************************************************************/ + +void h264_save_parameters(H264RXI * p_rxi, uint8 * p_data, uint32 len) +{ + uint8 nal_type = (p_data[0] & 0x1F); + + if (nal_type == H264_NAL_SPS && p_rxi->param_sets.sps_len == 0) + { + if (len <= sizeof(p_rxi->param_sets.sps) - 4) + { + int offset = 0; + + p_rxi->param_sets.sps[0] = 0; + p_rxi->param_sets.sps[1] = 0; + p_rxi->param_sets.sps[2] = 0; + p_rxi->param_sets.sps[3] = 1; + + offset = 4; + + memcpy(p_rxi->param_sets.sps+offset, p_data, len); + p_rxi->param_sets.sps_len = len+offset; + } + } + else if (nal_type == H264_NAL_PPS && p_rxi->param_sets.pps_len == 0) + { + if (len <= sizeof(p_rxi->param_sets.pps) - 4) + { + int offset = 0; + + p_rxi->param_sets.pps[0] = 0; + p_rxi->param_sets.pps[1] = 0; + p_rxi->param_sets.pps[2] = 0; + p_rxi->param_sets.pps[3] = 1; + + offset = 4; + + memcpy(p_rxi->param_sets.pps+offset, p_data, len); + p_rxi->param_sets.pps_len = len+offset; + } + } +} + +BOOL h264_handle_aggregated_packet(H264RXI * p_rxi, uint8 * p_data, int len) +{ + uint8 *src = p_data; + int src_len = len; + + while (src_len > 2) + { + uint16 nal_size = ((src[0] << 8) | src[1]); + + // consume the length of the aggregate + src += 2; + src_len -= 2; + + if (nal_size <= src_len) + { + h264_save_parameters(p_rxi, src, nal_size); + + if (p_rxi->d_offset + nal_size + 4 >= p_rxi->buf_len) + { + if (p_rxi->rtprxi.rxf_marker) + { + p_rxi->d_offset = 0; + } + + log_print(HT_LOG_ERR, "%s, packet too big %d!!!", __FUNCTION__, p_rxi->d_offset + nal_size + 4); + return FALSE; + } + else + { + p_rxi->p_buf[p_rxi->d_offset+0] = 0; + p_rxi->p_buf[p_rxi->d_offset+1] = 0; + p_rxi->p_buf[p_rxi->d_offset+2] = 0; + p_rxi->p_buf[p_rxi->d_offset+3] = 1; + p_rxi->d_offset += 4; + + // copying + memcpy(p_rxi->p_buf + p_rxi->d_offset, src, nal_size); + + p_rxi->d_offset += nal_size; + } + } + else + { + log_print(HT_LOG_ERR, "%s, nal size exceeds length: %d %d\n", __FUNCTION__, nal_size, src_len); + return FALSE; + } + + // eat what we handled + src += nal_size; + src_len -= nal_size; + } + + if (p_rxi->pkt_func) + { + p_rxi->pkt_func(p_rxi->p_buf, p_rxi->d_offset, p_rxi->rtprxi.ts, p_rxi->rtprxi.seq, p_rxi->user_data); + } + + p_rxi->d_offset = 0; + + return TRUE; +} + +BOOL h264_data_rx(H264RXI * p_rxi, uint8 * p_data, int len) +{ + uint8 * headerStart = p_data; + uint32 packetSize = len; + uint32 numBytesToSkip; + uint8 naluType; + BOOL beginPacket = FALSE; + BOOL endPacket = FALSE; + + if (packetSize < 1) + { + return FALSE; + } + + if (p_rxi->rtprxi.rxf_loss) + { + // Packet loss, discard the previously cached packets + p_rxi->d_offset = 0; + } + + naluType = (headerStart[0] & 0x1F); + + switch (naluType) + { + case 24: // STAP-A + numBytesToSkip = 1; // discard the type byte + return h264_handle_aggregated_packet(p_rxi, p_data+numBytesToSkip, len-numBytesToSkip); + + case 25: case 26: case 27: // STAP-B, MTAP16, or MTAP24 + numBytesToSkip = 3; // discard the type byte, and the initial DON + break; + + case 28: case 29: // FU-A or FU-B + { + // For these NALUs, the first two bytes are the FU indicator and the FU header. + // If the start bit is set, we reconstruct the original NAL header into byte 1 + + if (packetSize < 2) + { + return FALSE; + } + + uint8 startBit = headerStart[1] & 0x80; + uint8 endBit = headerStart[1] & 0x40; + if (startBit) + { + beginPacket = TRUE; + + headerStart[1] = (headerStart[0] & 0xE0) | (headerStart[1] & 0x1F); + numBytesToSkip = 1; + } + else + { + // The start bit is not set, so we skip both the FU indicator and header: + beginPacket = FALSE; + numBytesToSkip = 2; + } + + endPacket = (endBit != 0); + break; + } + + default: + // This packet contains one complete NAL unit: + beginPacket = endPacket = TRUE; + numBytesToSkip = 0; + break; + } + + if (p_rxi->rtprxi.rxf_loss) + { + // Packet loss, until the next start packet + + if (!beginPacket) + { + return FALSE; + } + else + { + p_rxi->rtprxi.rxf_loss = 0; + } + } + + // save the H264 parameter sets + + h264_save_parameters(p_rxi, headerStart + numBytesToSkip, packetSize - numBytesToSkip); + + if ((p_rxi->d_offset + 4 + packetSize - numBytesToSkip) >= p_rxi->buf_len) + { + if (p_rxi->rtprxi.rxf_marker) + { + p_rxi->d_offset = 0; + } + + log_print(HT_LOG_ERR, "%s, fragment packet too big %d!!!", + __FUNCTION__, p_rxi->d_offset + 4 + packetSize - numBytesToSkip); + return FALSE; + } + + if (beginPacket) + { + p_rxi->p_buf[p_rxi->d_offset+0] = 0; + p_rxi->p_buf[p_rxi->d_offset+1] = 0; + p_rxi->p_buf[p_rxi->d_offset+2] = 0; + p_rxi->p_buf[p_rxi->d_offset+3] = 1; + p_rxi->d_offset += 4; + } + + memcpy(p_rxi->p_buf + p_rxi->d_offset, headerStart + numBytesToSkip, packetSize - numBytesToSkip); + p_rxi->d_offset += packetSize - numBytesToSkip; + + if (endPacket && p_rxi->rtprxi.rxf_marker) + { + if (p_rxi->pkt_func) + { + p_rxi->pkt_func(p_rxi->p_buf, p_rxi->d_offset, p_rxi->rtprxi.ts, p_rxi->rtprxi.seq, p_rxi->user_data); + } + + p_rxi->d_offset = 0; + } + + return TRUE; +} + +BOOL h264_rtp_rx(H264RXI * p_rxi, uint8 * p_data, int len) +{ + if (p_rxi == NULL) + { + return FALSE; + } + + if (!rtp_data_rx(&p_rxi->rtprxi, p_data, len)) + { + return FALSE; + } + + return h264_data_rx(p_rxi, p_rxi->rtprxi.p_data, p_rxi->rtprxi.len); +} + +BOOL h264_rxi_init(H264RXI * p_rxi, VRTPRXCBF cbf, void * p_userdata) +{ + memset(p_rxi, 0, sizeof(H264RXI)); + + p_rxi->buf_len = RTP_MAX_VIDEO_BUFF; + + p_rxi->p_buf_org = (uint8 *)malloc(p_rxi->buf_len); + if (p_rxi->p_buf_org == NULL) + { + return -1; + } + + p_rxi->p_buf = p_rxi->p_buf_org + 32; + p_rxi->buf_len -= 32; + p_rxi->pkt_func = cbf; + p_rxi->user_data = p_userdata; + + return 0; +} + +void h264_rxi_deinit(H264RXI * p_rxi) +{ + if (p_rxi->p_buf_org) + { + free(p_rxi->p_buf_org); + } + + memset(p_rxi, 0, sizeof(H264RXI)); +} + + + diff --git a/MediaClient/MediaClient/rtp/h264_rtp_rx.h b/MediaClient/MediaClient/rtp/h264_rtp_rx.h new file mode 100644 index 0000000..92b9444 --- /dev/null +++ b/MediaClient/MediaClient/rtp/h264_rtp_rx.h @@ -0,0 +1,59 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef H264_RTP_RX_H +#define H264_RTP_RX_H + +#include "h264.h" +#include "rtp_rx.h" + + +typedef struct h264_rtp_rx_info +{ + RTPRXI rtprxi; + + uint8 * p_buf_org; // Allocated buffer + uint8 * p_buf; // = p_buf_org + 32 + uint32 buf_len; // Buffer length -32 + uint32 d_offset; // Data offset + + VRTPRXCBF pkt_func; // callback function + void * user_data; // user data + + H264ParamSets param_sets; // h264 sps pps parameter sets +} H264RXI; + +#ifdef __cplusplus +extern "C" { +#endif + +BOOL h264_data_rx(H264RXI * p_rxi, uint8 * p_data, int len); +BOOL h264_rtp_rx(H264RXI * p_rxi, uint8 * p_data, int len); +BOOL h264_rxi_init(H264RXI * p_rxi, VRTPRXCBF cbf, void * p_userdata); +void h264_rxi_deinit(H264RXI * p_rxi); + +#ifdef __cplusplus +} +#endif + +#endif // H264_RTP_RX_H + + + + diff --git a/MediaClient/MediaClient/rtp/h264_util.cpp b/MediaClient/MediaClient/rtp/h264_util.cpp new file mode 100644 index 0000000..4287119 --- /dev/null +++ b/MediaClient/MediaClient/rtp/h264_util.cpp @@ -0,0 +1,235 @@ +/*************************************************************************************** + * + * 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 "bs.h" +#include "h264.h" +#include "h264_util.h" + + +void h264_parser_init(h264_t * h) +{ + h->i_width = 0; + h->i_height = 0; + h->b_key = 0; + + h->i_nal_type = -1; + h->i_ref_idc = -1; + h->i_idr_pic_id = -1; + h->i_frame_num = -1; + h->i_log2_max_frame_num = 0; + h->i_poc = -1; + h->i_poc_type = -1; +} + +void h264_parser_parse(h264_t * h, nal_t * nal, int * pb_nal_start) +{ + bs_t s; + + *pb_nal_start = 0; + + if (nal->i_type == H264_NAL_SPS || nal->i_type == H264_NAL_PPS) + { + *pb_nal_start = 1; + } + + bs_init(&s, nal->p_payload, nal->i_payload); + + if (nal->i_type == H264_NAL_SPS) + { + int i_tmp; + + i_tmp = bs_read(&s, 8); + bs_skip(&s, 1+1+1 + 5 + 8); + + /* sps id */ + bs_read_ue(&s); + + if (i_tmp >= 100) + { + bs_read_ue(&s); // chroma_format_idc + bs_read_ue(&s); // bit_depth_luma_minus8 + bs_read_ue(&s); // bit_depth_chroma_minus8 + bs_skip(&s, 1); // qpprime_y_zero_transform_bypass_flag + + if (bs_read(&s, 1)) // seq_scaling_matrix_present_flag + { + int i, j; + + for (i = 0; i < 8; i++) + { + if (bs_read(&s, 1)) // seq_scaling_list_present_flag[i] + { + uint8 i_tmp = 8; + + for (j = 0; j < (i<6?16:64); j++) + { + i_tmp += bs_read_se(&s); + + if (i_tmp == 0) + { + break; + } + } + } + } + } + } + + /* Skip i_log2_max_frame_num */ + h->i_log2_max_frame_num = bs_read_ue(&s) + 4; + + /* Read poc_type */ + h->i_poc_type = bs_read_ue(&s); + + if (h->i_poc_type == 0) + { + h->i_log2_max_poc_lsb = bs_read_ue(&s) + 4; + } + else if (h->i_poc_type == 1) + { + int i_cycle; + + /* skip b_delta_pic_order_always_zero */ + bs_skip(&s, 1); + + /* skip i_offset_for_non_ref_pic */ + bs_read_se(&s); + + /* skip i_offset_for_top_to_bottom_field */ + bs_read_se(&s); + + /* read i_num_ref_frames_in_poc_cycle */ + i_cycle = bs_read_ue(&s); + if (i_cycle > 256) + { + i_cycle = 256; + } + + while (i_cycle > 0) + { + /* skip i_offset_for_ref_frame */ + bs_read_se(&s); + i_cycle--; + } + } + + /* i_num_ref_frames */ + bs_read_ue(&s); + + /* b_gaps_in_frame_num_value_allowed */ + bs_skip(&s, 1); + + /* Read size */ + h->i_width = 16 * (bs_read_ue( &s ) + 1); + h->i_height = 16 * (bs_read_ue( &s ) + 1); + + /* b_frame_mbs_only */ + i_tmp = bs_read(&s, 1); + if (i_tmp == 0) + { + bs_skip(&s, 1); + } + + /* b_direct8x8_inference */ + bs_skip(&s, 1); + + /* crop ? */ + i_tmp = bs_read(&s, 1); + if (i_tmp) + { + /* left */ + h->i_width -= 2 * bs_read_ue(&s); + + /* right */ + h->i_width -= 2 * bs_read_ue(&s); + + /* top */ + h->i_height -= 2 * bs_read_ue(&s); + + /* bottom */ + h->i_height -= 2 * bs_read_ue(&s); + } + /* vui: ignored */ + } + else if (nal->i_type >= H264_NAL_SLICE && nal->i_type <= H264_NAL_IDR) + { + int i_tmp; + + /* i_first_mb */ + bs_read_ue(&s); + + /* picture type */ + switch (bs_read_ue(&s)) + { + case 0: case 5: /* P */ + case 1: case 6: /* B */ + case 3: case 8: /* SP */ + h->b_key = 0; + break; + + case 2: case 7: /* I */ + case 4: case 9: /* SI */ + h->b_key = (nal->i_type == H264_NAL_IDR); + break; + } + + /* pps id */ + bs_read_ue(&s); + + /* frame num */ + i_tmp = bs_read(&s, h->i_log2_max_frame_num); + if (i_tmp != h->i_frame_num) + { + *pb_nal_start = 1; + } + + h->i_frame_num = i_tmp; + + if (nal->i_type == H264_NAL_IDR) + { + i_tmp = bs_read_ue(&s); + + if (h->i_nal_type == H264_NAL_IDR && h->i_idr_pic_id != i_tmp) + { + *pb_nal_start = 1; + } + + h->i_idr_pic_id = i_tmp; + } + + if (h->i_poc_type == 0) + { + i_tmp = bs_read(&s, h->i_log2_max_poc_lsb); + if (i_tmp != h->i_poc) + { + *pb_nal_start = 1; + } + + h->i_poc = i_tmp; + } + } + + h->i_nal_type = nal->i_type; + h->i_ref_idc = nal->i_ref_idc; +} + + + + diff --git a/MediaClient/MediaClient/rtp/h264_util.h b/MediaClient/MediaClient/rtp/h264_util.h new file mode 100644 index 0000000..bfb2177 --- /dev/null +++ b/MediaClient/MediaClient/rtp/h264_util.h @@ -0,0 +1,64 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef H264_UTIL_H +#define H264_UTIL_H + + +typedef struct +{ + int i_ref_idc; // nal_priority_e + int i_type; // nal_unit_type_e + + /* This data are raw payload */ + int i_payload; + uint8 * p_payload; +} nal_t; + +typedef struct +{ + int i_width; + int i_height; + int i_nal_type; + int i_ref_idc; + int i_idr_pic_id; + int i_frame_num; + int i_poc; + int b_key; + int i_log2_max_frame_num; + int i_poc_type; + int i_log2_max_poc_lsb; +} h264_t; + + +#ifdef __cplusplus +extern "C" { +#endif + +void h264_parser_init(h264_t * h); +void h264_parser_parse(h264_t * h, nal_t * nal, int * pb_nal_start); + +#ifdef __cplusplus +} +#endif + +#endif // H264_UTIL_H + + + diff --git a/MediaClient/MediaClient/rtp/h265.h b/MediaClient/MediaClient/rtp/h265.h new file mode 100644 index 0000000..012869b --- /dev/null +++ b/MediaClient/MediaClient/rtp/h265.h @@ -0,0 +1,72 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef H265_H +#define H265_H + +/** + * NAL unit type codes + */ +enum HEVCNALUnitType +{ + HEVC_NAL_TRAIL_N = 0, + HEVC_NAL_TRAIL_R = 1, + HEVC_NAL_TSA_N = 2, + HEVC_NAL_TSA_R = 3, + HEVC_NAL_STSA_N = 4, + HEVC_NAL_STSA_R = 5, + HEVC_NAL_RADL_N = 6, + HEVC_NAL_RADL_R = 7, + HEVC_NAL_RASL_N = 8, + HEVC_NAL_RASL_R = 9, + HEVC_NAL_BLA_W_LP = 16, + HEVC_NAL_BLA_W_RADL = 17, + HEVC_NAL_BLA_N_LP = 18, + HEVC_NAL_IDR_W_RADL = 19, + HEVC_NAL_IDR_N_LP = 20, + HEVC_NAL_CRA_NUT = 21, + HEVC_NAL_VPS = 32, + HEVC_NAL_SPS = 33, + HEVC_NAL_PPS = 34, + HEVC_NAL_AUD = 35, + HEVC_NAL_EOS_NUT = 36, + HEVC_NAL_EOB_NUT = 37, + HEVC_NAL_FD_NUT = 38, + HEVC_NAL_SEI_PREFIX = 39, + HEVC_NAL_SEI_SUFFIX = 40, +}; + +#define IS_IRAP_NAL(nal) (nal >= 16 && nal <= 23) + + +typedef struct +{ + uint8 vps[256]; + int vps_len; + + uint8 sps[256]; + int sps_len; + + uint8 pps[256]; + int pps_len; +} H265ParamSets; + +#endif + + diff --git a/MediaClient/MediaClient/rtp/h265_rtp_rx.cpp b/MediaClient/MediaClient/rtp/h265_rtp_rx.cpp new file mode 100644 index 0000000..81f43e8 --- /dev/null +++ b/MediaClient/MediaClient/rtp/h265_rtp_rx.cpp @@ -0,0 +1,367 @@ +/*************************************************************************************** + * + * 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 "rtp.h" +#include "h265_rtp_rx.h" + + +/****************************************************************************/ + +void h265_save_parameters(H265RXI * p_rxi, uint8 * p_data, uint32 len) +{ + uint8 nal_type = ((p_data[0] >> 1) & 0x3f); + + if (nal_type == HEVC_NAL_VPS && p_rxi->param_sets.vps_len == 0) + { + if (len <= sizeof(p_rxi->param_sets.vps) - 4) + { + int offset = 0; + + p_rxi->param_sets.vps[0] = 0; + p_rxi->param_sets.vps[1] = 0; + p_rxi->param_sets.vps[2] = 0; + p_rxi->param_sets.vps[3] = 1; + + offset = 4; + + memcpy(p_rxi->param_sets.vps+offset, p_data, len); + p_rxi->param_sets.vps_len = len+offset; + } + } + else if (nal_type == HEVC_NAL_SPS && p_rxi->param_sets.sps_len == 0) + { + if (len <= sizeof(p_rxi->param_sets.sps) - 4) + { + int offset = 0; + + p_rxi->param_sets.sps[0] = 0; + p_rxi->param_sets.sps[1] = 0; + p_rxi->param_sets.sps[2] = 0; + p_rxi->param_sets.sps[3] = 1; + + offset = 4; + + memcpy(p_rxi->param_sets.sps+offset, p_data, len); + p_rxi->param_sets.sps_len = len+offset; + } + } + else if (nal_type == HEVC_NAL_PPS && p_rxi->param_sets.pps_len == 0) + { + if (len <= sizeof(p_rxi->param_sets.pps) - 4) + { + int offset = 0; + + p_rxi->param_sets.pps[0] = 0; + p_rxi->param_sets.pps[1] = 0; + p_rxi->param_sets.pps[2] = 0; + p_rxi->param_sets.pps[3] = 1; + + offset = 4; + + memcpy(p_rxi->param_sets.pps+offset, p_data, len); + p_rxi->param_sets.pps_len = len+offset; + } + } +} + +BOOL h265_handle_aggregated_packet(H265RXI * p_rxi, uint8 * p_data, int len) +{ + uint8 *src = p_data; + int src_len = len; + int skip_between = p_rxi->rxf_don ? 1 : 0; + + while (src_len > 2) + { + uint16 nal_size = ((src[0] << 8) | src[1]); + + // consume the length of the aggregate + src += 2; + src_len -= 2; + + if (nal_size <= src_len) + { + h265_save_parameters(p_rxi, src, nal_size); + + if (p_rxi->d_offset + nal_size + 4 >= p_rxi->buf_len) + { + if (p_rxi->rtprxi.rxf_marker) + { + p_rxi->d_offset = 0; + } + + log_print(HT_LOG_ERR, "%s, packet too big %d!!!", __FUNCTION__, p_rxi->d_offset + nal_size + 4); + return FALSE; + } + else + { + p_rxi->p_buf[p_rxi->d_offset+0] = 0; + p_rxi->p_buf[p_rxi->d_offset+1] = 0; + p_rxi->p_buf[p_rxi->d_offset+2] = 0; + p_rxi->p_buf[p_rxi->d_offset+3] = 1; + p_rxi->d_offset += 4; + + // copying + memcpy(p_rxi->p_buf + p_rxi->d_offset, src, nal_size); + + p_rxi->d_offset += nal_size; + } + } + else + { + log_print(HT_LOG_ERR, "%s, nal size exceeds length: %d %d\n", __FUNCTION__, nal_size, src_len); + return FALSE; + } + + // eat what we handled + src += nal_size + skip_between; + src_len -= nal_size + skip_between; + } + + if (p_rxi->pkt_func) + { + p_rxi->pkt_func(p_rxi->p_buf, p_rxi->d_offset, p_rxi->rtprxi.ts, p_rxi->rtprxi.seq, p_rxi->user_data); + } + + p_rxi->d_offset = 0; + + return TRUE; +} + +BOOL h265_data_rx(H265RXI * p_rxi, uint8 * p_data, int len) +{ + uint8 * headerStart = p_data; + uint32 packetSize = len; + uint32 numBytesToSkip; + uint8 naluType; + BOOL beginPacket = FALSE; + BOOL endPacket = FALSE; + + if (packetSize < 2) + { + return FALSE; + } + + if (p_rxi->rtprxi.rxf_loss) + { + // Packet loss, discard the previously cached packets + p_rxi->d_offset = 0; + } + + naluType = (headerStart[0] & 0x7E) >> 1; + + switch (naluType) + { + case 48: + { + // Aggregation Packet (AP) + // We skip over the 2-byte Payload Header, and the DONL header (if any). + if (p_rxi->rxf_don) + { + if (packetSize < 4) + { + return FALSE; + } + + numBytesToSkip = 4; + } + else + { + numBytesToSkip = 2; + } + + return h265_handle_aggregated_packet(p_rxi, p_data+numBytesToSkip, len-numBytesToSkip); + } + + case 49: + { + // Fragmentation Unit (FU) + // This NALU begins with the 2-byte Payload Header, the 1-byte FU header, and (optionally) + // the 2-byte DONL header. + // If the start bit is set, we reconstruct the original NAL header at the end of these + // 3 (or 5) bytes, and skip over the first 1 (or 3) bytes. + + if (packetSize < 3) + { + return FALSE; + } + + uint8 startBit = headerStart[2] & 0x80; // from the FU header + uint8 endBit = headerStart[2] & 0x40; // from the FU header + if (startBit) + { + beginPacket = TRUE; + + uint8 nal_unit_type = headerStart[2] & 0x3F; // the last 6 bits of the FU header + uint8 newNALHeader[2]; + + newNALHeader[0] = (headerStart[0] & 0x81) | (nal_unit_type << 1); + newNALHeader[1] = headerStart[1]; + + if (p_rxi->rxf_don) + { + if (packetSize < 5) + { + return FALSE; + } + + headerStart[3] = newNALHeader[0]; + headerStart[4] = newNALHeader[1]; + numBytesToSkip = 3; + } + else + { + headerStart[1] = newNALHeader[0]; + headerStart[2] = newNALHeader[1]; + numBytesToSkip = 1; + } + } + else + { + // The start bit is not set, so we skip over all headers: + beginPacket = FALSE; + + if (p_rxi->rxf_don) + { + if (packetSize < 5) + { + return FALSE; + } + + numBytesToSkip = 5; + } + else + { + numBytesToSkip = 3; + } + } + + endPacket = (endBit != 0); + break; + } + + default: + // This packet contains one complete NAL unit: + beginPacket = endPacket = TRUE; + numBytesToSkip = 0; + break; + } + + if (p_rxi->rtprxi.rxf_loss) + { + // Packet loss, until the next start packet + + if (!beginPacket) + { + return FALSE; + } + else + { + p_rxi->rtprxi.rxf_loss = 0; + } + } + + // save the H265 parameter sets + + h265_save_parameters(p_rxi, headerStart + numBytesToSkip, packetSize - numBytesToSkip); + + if ((p_rxi->d_offset + 4 + packetSize - numBytesToSkip) >= p_rxi->buf_len) + { + if (p_rxi->rtprxi.rxf_marker) + { + p_rxi->d_offset = 0; + } + + log_print(HT_LOG_ERR, "%s, fragment packet too big %d!!!", + __FUNCTION__, p_rxi->d_offset + 4 + packetSize - numBytesToSkip); + return FALSE; + } + + if (beginPacket) + { + p_rxi->p_buf[p_rxi->d_offset+0] = 0; + p_rxi->p_buf[p_rxi->d_offset+1] = 0; + p_rxi->p_buf[p_rxi->d_offset+2] = 0; + p_rxi->p_buf[p_rxi->d_offset+3] = 1; + p_rxi->d_offset += 4; + } + + memcpy(p_rxi->p_buf + p_rxi->d_offset, headerStart + numBytesToSkip, packetSize - numBytesToSkip); + p_rxi->d_offset += packetSize - numBytesToSkip; + + if (endPacket && p_rxi->rtprxi.rxf_marker) + { + if (p_rxi->pkt_func) + { + p_rxi->pkt_func(p_rxi->p_buf, p_rxi->d_offset, p_rxi->rtprxi.ts, p_rxi->rtprxi.seq, p_rxi->user_data); + } + + p_rxi->d_offset = 0; + } + + return TRUE; +} + +BOOL h265_rtp_rx(H265RXI * p_rxi, uint8 * p_data, int len) +{ + if (p_rxi == NULL) + { + return FALSE; + } + + if (!rtp_data_rx(&p_rxi->rtprxi, p_data, len)) + { + return FALSE; + } + + return h265_data_rx(p_rxi, p_rxi->rtprxi.p_data, p_rxi->rtprxi.len); +} + +BOOL h265_rxi_init(H265RXI * p_rxi, VRTPRXCBF cbf, void * p_userdata) +{ + memset(p_rxi, 0, sizeof(H265RXI)); + + p_rxi->buf_len = RTP_MAX_VIDEO_BUFF; + + p_rxi->p_buf_org = (uint8 *)malloc(p_rxi->buf_len); + if (p_rxi->p_buf_org == NULL) + { + return -1; + } + + p_rxi->p_buf = p_rxi->p_buf_org + 32; + p_rxi->buf_len -= 32; + p_rxi->pkt_func = cbf; + p_rxi->user_data = p_userdata; + + return 0; +} + +void h265_rxi_deinit(H265RXI * p_rxi) +{ + if (p_rxi->p_buf_org) + { + free(p_rxi->p_buf_org); + } + + memset(p_rxi, 0, sizeof(H265RXI)); +} + + + diff --git a/MediaClient/MediaClient/rtp/h265_rtp_rx.h b/MediaClient/MediaClient/rtp/h265_rtp_rx.h new file mode 100644 index 0000000..bc84aa4 --- /dev/null +++ b/MediaClient/MediaClient/rtp/h265_rtp_rx.h @@ -0,0 +1,62 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef H265_RTP_RX_H +#define H265_RTP_RX_H + +#include "rtp_rx.h" +#include "h265.h" + + +typedef struct h265_rtp_rx_info +{ + RTPRXI rtprxi; // rtp receive info + + uint8 * p_buf_org; // Allocated buffer + uint8 * p_buf; // = p_buf_org + 32 + uint32 buf_len; // Buffer length - 32 + uint32 d_offset; // Data offset + + VRTPRXCBF pkt_func; // callback function + void * user_data; // user data + + BOOL rxf_don; // DON + + H265ParamSets param_sets; // h265 parameter sets +} H265RXI; + +#ifdef __cplusplus +extern "C" { +#endif + +/**************************************************************************/ +BOOL h265_data_rx(H265RXI * p_rxi, uint8 * p_data, int len); +BOOL h265_rtp_rx(H265RXI * p_rxi, uint8 * p_data, int len); +BOOL h265_rxi_init(H265RXI * p_rxi, VRTPRXCBF cbf, void * p_userdata); +void h265_rxi_deinit(H265RXI * p_rxi); + +#ifdef __cplusplus +} +#endif + +#endif + + + + diff --git a/MediaClient/MediaClient/rtp/h265_util.cpp b/MediaClient/MediaClient/rtp/h265_util.cpp new file mode 100644 index 0000000..9dc5a2c --- /dev/null +++ b/MediaClient/MediaClient/rtp/h265_util.cpp @@ -0,0 +1,411 @@ +/*************************************************************************************** + * + * 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 "bs.h" +#include "util.h" +#include "h265.h" +#include "h265_util.h" + + +/**************************************************************************************/ + +int h265_extract_rbsp(const uint8 *src, int length, uint8 *dst) +{ + int i, si, di; + + for (i = 0; i + 1 < length; i += 2) + { + if (src[i]) + { + continue; + } + + if (i > 0 && src[i - 1] == 0) + { + i--; + } + + if (i + 2 < length && src[i + 1] == 0 && src[i + 2] <= 3) + { + if (src[i + 2] != 3 && src[i + 2] != 0) + { + /* startcode, so we must be past the end */ + length = i; + } + + break; + } + } + + if (i >= length - 1) + { + // no escaped 0 + memcpy(dst, src, length); + return length; + } + + memcpy(dst, src, i); + si = di = i; + + while (si + 2 < length) + { + // remove escapes (very rare 1:2^22) + if (src[si + 2] > 3) + { + dst[di++] = src[si++]; + dst[di++] = src[si++]; + } + else if (src[si] == 0 && src[si + 1] == 0 && src[si + 2] != 0) + { + if (src[si + 2] == 3) + { + // escape + dst[di++] = 0; + dst[di++] = 0; + si += 3; + + continue; + } + else // next start code + { + return si; + } + } + + dst[di++] = src[si++]; + } + + while (si < length) + { + dst[di++] = src[si++]; + } + + return si; +} + +void h265_parser_init(h265_t * h) +{ + memset(h, 0, sizeof(h265_t)); +} + +int h265_parser_parse(h265_t * h, uint8 * p_data, int len) +{ + uint32 i; + bs_t s; + uint8 bufs[512]; + + if (len > (int)sizeof(bufs)) + { + return -1; + } + + len = h265_extract_rbsp(p_data, len, bufs); + + bs_init(&s, bufs, len); + + bs_read(&s, 4); // sps_video_parameter_set_id u(4) + h->sps_max_sub_layers_minus1 = bs_read(&s, 3); // sps_max_sub_layers_minus1 u(3) + if (h->sps_max_sub_layers_minus1 > 6) + { + log_print(HT_LOG_ERR, "%s, sps_max_sub_layers_minus1[%d]>6!!!\r\n", + __FUNCTION__, h->sps_max_sub_layers_minus1); + return -1; + } + + bs_read(&s, 1); // sps_temporal_id_nesting_flag u(1) + + // profile_tier_level( maxNumSubLayersMinus1 ) + { + bs_read(&s, 2); // general_profile_space u(2) + bs_read(&s, 1); // general_tier_flag u(1) + h->general_profile_idc = bs_read(&s, 5); // general_profile_idc u(5) + bs_read(&s, 32); // general_profile_compatibility_flag[ j ] u(5) + bs_read(&s, 1); // general_progressive_source_flag u(1) + bs_read(&s, 1); // general_interlaced_source_flag u(1) + bs_read(&s, 1); // general_non_packed_constraint_flag u(1) + bs_read(&s, 1); // general_frame_only_constraint_flag u(1) + bs_skip(&s, 44); // general_reserved_zero_44bits u(44) + h->general_level_idc = bs_read(&s, 8); // general_level_idc u(8) + + uint8 sub_layer_profile_present_flag[6] = {0}; + uint8 sub_layer_level_present_flag[6] = {0}; + + for (i = 0; i < h->sps_max_sub_layers_minus1; i++) + { + sub_layer_profile_present_flag[i]= bs_read(&s, 1); + sub_layer_level_present_flag[i]= bs_read(&s, 1); + } + + if (h->sps_max_sub_layers_minus1 > 0) + { + for (i = h->sps_max_sub_layers_minus1; i < 8; i++) + { + bs_read(&s, 2); + } + } + + for (i = 0; i < h->sps_max_sub_layers_minus1; i++) + { + if (sub_layer_profile_present_flag[i]) + { + bs_read(&s, 2); // sub_layer_profile_space[i] + bs_read(&s, 1); // sub_layer_tier_flag[i] + bs_read(&s, 5); // sub_layer_profile_idc[i] + bs_read(&s, 32); // sub_layer_profile_compatibility_flag[i][32] + bs_read(&s, 1); // sub_layer_progressive_source_flag[i] + bs_read(&s, 1); // sub_layer_interlaced_source_flag[i] + bs_read(&s, 1); // sub_layer_non_packed_constraint_flag[i] + bs_read(&s, 1); // sub_layer_frame_only_constraint_flag[i] + bs_read(&s, 44); // sub_layer_reserved_zero_44bits[i] + } + + if (sub_layer_level_present_flag[i]) + { + bs_read(&s, 8); // sub_layer_level_idc[i] + } + } + } + + h->sps_seq_parameter_set_id = bs_read_ue(&s); // sps_seq_parameter_set_id ue(v) + h->chroma_format_idc = bs_read_ue(&s); // chroma_format_idc ue(v) + if (h->chroma_format_idc > 3) + { + log_print(HT_LOG_ERR, "%s, chroma_format_idc[%d]!!!\r\n", + __FUNCTION__, h->chroma_format_idc); + return -1; + } + + if (h->chroma_format_idc == 3) + { + h->separate_colour_plane_flag = bs_read(&s, 1); // separate_colour_plane_flag + } + + h->pic_width_in_luma_samples = bs_read_ue(&s); // pic_width_in_luma_samples ue(v) + h->pic_height_in_luma_samples = bs_read_ue(&s); // pic_height_in_luma_samples ue(v) + + h->conformance_window_flag = bs_read(&s, 1 ); // conformance_window_flag u(1) + if (h->conformance_window_flag) + { + h->conf_win_left_offset = bs_read_ue(&s); // conf_win_left_offset ue(v) + h->conf_win_right_offset = bs_read_ue(&s); // conf_win_right_offset ue(v) + h->conf_win_top_offset = bs_read_ue(&s); // conf_win_top_offset ue(v) + h->conf_win_bottom_offset = bs_read_ue(&s); // conf_win_bottom_offset ue(v) + } + + h->bit_depth_luma_minus8 = bs_read_ue(&s); // bit_depth_luma_minus8 ue(v) + h->bit_depth_chroma_minus8 = bs_read_ue(&s); // bit_depth_chroma_minus8 ue(v) + + return 0; +} + +void hvcc_init(HEVCDecoderConfigurationRecord * hvcc) +{ + memset(hvcc, 0, sizeof(HEVCDecoderConfigurationRecord)); + + hvcc->lengthSizeMinusOne = 3; // 4 bytes + + /* + * The following fields have all their valid bits set by default, + * the ProfileTierLevel parsing code will unset them when needed. + */ + hvcc->general_profile_compatibility_flags = 0xffffffff; + hvcc->general_constraint_indicator_flags = 0xffffffffffff; + + /* + * Initialize this field with an invalid value which can be used to detect + * whether we didn't see any VUI (in which case it should be reset to zero). + */ + hvcc->min_spatial_segmentation_idc = MAX_SPATIAL_SEGMENTATION + 1; +} + +int hvcc_parse_vps(HEVCDecoderConfigurationRecord * hvcc, uint8 * p_data, int len) +{ + uint32 vps_max_sub_layers_minus1; + uint8 bufs[512]; + bs_t s; + + if (len > (int)sizeof(bufs)) + { + return -1; + } + + len = h265_extract_rbsp(p_data, len, bufs); + + bs_init(&s, bufs, len); + + /* + * vps_video_parameter_set_id u(4) + * vps_reserved_three_2bits u(2) + * vps_max_layers_minus1 u(6) + */ + bs_skip(&s, 12); + + vps_max_sub_layers_minus1 = bs_read(&s, 3); + + /* + * numTemporalLayers greater than 1 indicates that the stream to which this + * configuration record applies is temporally scalable and the contained + * number of temporal layers (also referred to as temporal sub-layer or + * sub-layer in ISO/IEC 23008-2) is equal to numTemporalLayers. Value 1 + * indicates that the stream is not temporally scalable. Value 0 indicates + * that it is unknown whether the stream is temporally scalable. + */ + hvcc->numTemporalLayers = MAX(hvcc->numTemporalLayers, vps_max_sub_layers_minus1 + 1); + + /* + * vps_temporal_id_nesting_flag u(1) + * vps_reserved_0xffff_16bits u(16) + */ + bs_skip(&s, 17); + + uint8 profile_space; + uint8 tier_flag; + uint8 profile_idc; + uint32 profile_compatibility_flags; + uint64 constraint_indicator_flags; + uint8 level_idc; + + profile_space = bs_read(&s, 2); + tier_flag = bs_read(&s, 1); + profile_idc = bs_read(&s, 5); + profile_compatibility_flags = bs_read(&s, 32); + constraint_indicator_flags = (uint64)bs_read(&s, 16) << 32; + constraint_indicator_flags |= bs_read(&s, 32); + level_idc = bs_read(&s, 8); + + hvcc->general_profile_space = profile_space; + + /* + * The level indication general_level_idc must indicate a level of + * capability equal to or greater than the highest level indicated for the + * highest tier in all the parameter sets. + */ + if (hvcc->general_tier_flag < tier_flag) + hvcc->general_level_idc = level_idc; + else + hvcc->general_level_idc = MAX(hvcc->general_level_idc, level_idc); + + /* + * The tier indication general_tier_flag must indicate a tier equal to or + * greater than the highest tier indicated in all the parameter sets. + */ + hvcc->general_tier_flag = MAX(hvcc->general_tier_flag, tier_flag); + + /* + * The profile indication general_profile_idc must indicate a profile to + * which the stream associated with this configuration record conforms. + * + * If the sequence parameter sets are marked with different profiles, then + * the stream may need examination to determine which profile, if any, the + * entire stream conforms to. If the entire stream is not examined, or the + * examination reveals that there is no profile to which the entire stream + * conforms, then the entire stream must be split into two or more + * sub-streams with separate configuration records in which these rules can + * be met. + * + * Note: set the profile to the highest value for the sake of simplicity. + */ + hvcc->general_profile_idc = MAX(hvcc->general_profile_idc, profile_idc); + + /* + * Each bit in general_profile_compatibility_flags may only be set if all + * the parameter sets set that bit. + */ + hvcc->general_profile_compatibility_flags &= profile_compatibility_flags; + + /* + * Each bit in general_constraint_indicator_flags may only be set if all + * the parameter sets set that bit. + */ + hvcc->general_constraint_indicator_flags &= constraint_indicator_flags; + + /* nothing useful for hvcC past this point */ + return 0; +} + +int hvcc_parse_pps(HEVCDecoderConfigurationRecord * hvcc, uint8 * p_data, int len) +{ + uint8 tiles_enabled_flag, entropy_coding_sync_enabled_flag; + uint8 bufs[512]; + bs_t s; + + if (len > (int)sizeof(bufs)) + { + return -1; + } + + len = h265_extract_rbsp(p_data, len, bufs); + + bs_init(&s, bufs, len); + + bs_read_ue(&s); // pps_pic_parameter_set_id + bs_read_ue(&s); // pps_seq_parameter_set_id + + /* + * dependent_slice_segments_enabled_flag u(1) + * output_flag_present_flag u(1) + * num_extra_slice_header_bits u(3) + * sign_data_hiding_enabled_flag u(1) + * cabac_init_present_flag u(1) + */ + bs_skip(&s, 7); + + bs_read_ue(&s); // num_ref_idx_l0_default_active_minus1 + bs_read_ue(&s); // num_ref_idx_l1_default_active_minus1 + bs_read_se(&s); // init_qp_minus26 + + /* + * constrained_intra_pred_flag u(1) + * transform_skip_enabled_flag u(1) + */ + bs_skip(&s, 2); + + if (bs_read(&s, 1)) // cu_qp_delta_enabled_flag + bs_read_ue(&s); // diff_cu_qp_delta_depth + + bs_read_se(&s); // pps_cb_qp_offset + bs_read_se(&s); // pps_cr_qp_offset + + /* + * pps_slice_chroma_qp_offsets_present_flag u(1) + * weighted_pred_flag u(1) + * weighted_bipred_flag u(1) + * transquant_bypass_enabled_flag u(1) + */ + bs_skip(&s, 4); + + tiles_enabled_flag = bs_read(&s, 1); + entropy_coding_sync_enabled_flag = bs_read(&s, 1); + + if (entropy_coding_sync_enabled_flag && tiles_enabled_flag) + hvcc->parallelismType = 0; // mixed-type parallel decoding + else if (entropy_coding_sync_enabled_flag) + hvcc->parallelismType = 3; // wavefront-based parallel decoding + else if (tiles_enabled_flag) + hvcc->parallelismType = 2; // tile-based parallel decoding + else + hvcc->parallelismType = 1; // slice-based parallel decoding + + /* nothing useful for hvcC past this point */ + return 0; +} + + + diff --git a/MediaClient/MediaClient/rtp/h265_util.h b/MediaClient/MediaClient/rtp/h265_util.h new file mode 100644 index 0000000..d90fb11 --- /dev/null +++ b/MediaClient/MediaClient/rtp/h265_util.h @@ -0,0 +1,82 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef H265_UTIL_H +#define H265_UTIL_H + +#define MAX_SPATIAL_SEGMENTATION 4096 // max. value of u(12) field + +typedef struct +{ + int nal_len; + uint32 general_profile_idc; + uint32 general_level_idc; + uint32 separate_colour_plane_flag; + uint32 pic_width_in_luma_samples; + uint32 pic_height_in_luma_samples; + uint32 sps_max_sub_layers_minus1; + uint32 sps_seq_parameter_set_id; + uint32 chroma_format_idc; + uint32 conformance_window_flag; + uint32 conf_win_left_offset; + uint32 conf_win_right_offset; + uint32 conf_win_top_offset; + uint32 conf_win_bottom_offset; + uint32 bit_depth_luma_minus8; + uint32 bit_depth_chroma_minus8; +} h265_t; + +typedef struct +{ + uint8 general_profile_space; + uint8 general_tier_flag; + uint8 general_profile_idc; + uint32 general_profile_compatibility_flags; + uint64 general_constraint_indicator_flags; + uint8 general_level_idc; + uint16 min_spatial_segmentation_idc; + uint8 parallelismType; + uint8 chromaFormat; + uint8 bitDepthLumaMinus8; + uint8 bitDepthChromaMinus8; + uint16 avgFrameRate; + uint8 constantFrameRate; + uint8 numTemporalLayers; + uint8 temporalIdNested; + uint8 lengthSizeMinusOne; +} HEVCDecoderConfigurationRecord; + +#ifdef __cplusplus +extern "C" { +#endif + +void h265_parser_init(h265_t * h); +int h265_parser_parse(h265_t * h, uint8 * p_data, int len); +void hvcc_init(HEVCDecoderConfigurationRecord * hvcc); +int hvcc_parse_vps(HEVCDecoderConfigurationRecord * hvcc, uint8 * p_data, int len); +int hvcc_parse_pps(HEVCDecoderConfigurationRecord * hvcc, uint8 * p_data, int len); + +#ifdef __cplusplus +} +#endif + +#endif // H265_UTIL_H + + + diff --git a/MediaClient/MediaClient/rtp/mjpeg.h b/MediaClient/MediaClient/rtp/mjpeg.h new file mode 100644 index 0000000..3ffd414 --- /dev/null +++ b/MediaClient/MediaClient/rtp/mjpeg.h @@ -0,0 +1,108 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef MJPEG_H +#define MJPEG_H + +/* JPEG marker codes */ +enum JpegMarker +{ + /* start of frame */ + MARKER_SOF0 = 0xc0, /* start-of-frame, baseline scan */ + MARKER_SOF1 = 0xc1, /* extended sequential, huffman */ + MARKER_SOF2 = 0xc2, /* progressive, huffman */ + MARKER_SOF3 = 0xc3, /* lossless, huffman */ + + MARKER_SOF5 = 0xc5, /* differential sequential, huffman */ + MARKER_SOF6 = 0xc6, /* differential progressive, huffman */ + MARKER_SOF7 = 0xc7, /* differential lossless, huffman */ + MARKER_JPG = 0xc8, /* reserved for JPEG extension */ + MARKER_SOF9 = 0xc9, /* extended sequential, arithmetic */ + MARKER_SOF10 = 0xca, /* progressive, arithmetic */ + MARKER_SOF11 = 0xcb, /* lossless, arithmetic */ + + MARKER_SOF13 = 0xcd, /* differential sequential, arithmetic */ + MARKER_SOF14 = 0xce, /* differential progressive, arithmetic */ + MARKER_SOF15 = 0xcf, /* differential lossless, arithmetic */ + + MARKER_DHT = 0xc4, /* define huffman tables */ + + MARKER_DAC = 0xcc, /* define arithmetic-coding conditioning */ + + /* restart with modulo 8 count "m" */ + MARKER_RST0 = 0xd0, + MARKER_RST1 = 0xd1, + MARKER_RST2 = 0xd2, + MARKER_RST3 = 0xd3, + MARKER_RST4 = 0xd4, + MARKER_RST5 = 0xd5, + MARKER_RST6 = 0xd6, + MARKER_RST7 = 0xd7, + + MARKER_SOI = 0xd8, /* start of image */ + MARKER_EOI = 0xd9, /* end of image */ + MARKER_SOS = 0xda, /* start of scan */ + MARKER_DQT = 0xdb, /* define quantization tables */ + MARKER_DNL = 0xdc, /* define number of lines */ + MARKER_DRI = 0xdd, /* restart interval */ + MARKER_DHP = 0xde, /* define hierarchical progression */ + MARKER_EXP = 0xdf, /* expand reference components */ + + MARKER_APP_FIRST= 0xe0, + MARKER_APP1 = 0xe1, + MARKER_APP2 = 0xe2, + MARKER_APP3 = 0xe3, + MARKER_APP4 = 0xe4, + MARKER_APP5 = 0xe5, + MARKER_APP6 = 0xe6, + MARKER_APP7 = 0xe7, + MARKER_APP8 = 0xe8, + MARKER_APP9 = 0xe9, + MARKER_APP10 = 0xea, + MARKER_APP11 = 0xeb, + MARKER_APP12 = 0xec, + MARKER_APP13 = 0xed, + MARKER_APP14 = 0xee, + MARKER_APP_LAST = 0xef, + + MARKER_JPG0 = 0xf0, + MARKER_JPG1 = 0xf1, + MARKER_JPG2 = 0xf2, + MARKER_JPG3 = 0xf3, + MARKER_JPG4 = 0xf4, + MARKER_JPG5 = 0xf5, + MARKER_JPG6 = 0xf6, + MARKER_SOF48 = 0xf7, + MARKER_LSE = 0xf8, + MARKER_JPG9 = 0xf9, + MARKER_JPG10 = 0xfa, + MARKER_JPG11 = 0xfb, + MARKER_JPG12 = 0xfc, + MARKER_JPG13 = 0xfd, + + MARKER_COMMENT = 0xfe, + + MARKER_TEM = 0x01, /* temporary private use for arithmetic coding */ + + /* 0x02 -> 0xbf reserved */ +}; + +#endif /* MJPEG_H */ + + diff --git a/MediaClient/MediaClient/rtp/mjpeg_rtp_rx.cpp b/MediaClient/MediaClient/rtp/mjpeg_rtp_rx.cpp new file mode 100644 index 0000000..d09cc62 --- /dev/null +++ b/MediaClient/MediaClient/rtp/mjpeg_rtp_rx.cpp @@ -0,0 +1,397 @@ +/*************************************************************************************** + * + * 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 "mjpeg.h" +#include "mjpeg_rtp_rx.h" +#include "mjpeg_tables.h" + + +static void mjpeg_create_huffman_header +( +uint8*& p, +uint8 const* codelens, +int ncodes, +uint8 const* symbols, +int nsymbols, +int tableNo, int tableClass +) +{ + *p++ = 0xff; *p++ = MARKER_DHT; + *p++ = 0; /* length msb */ + *p++ = 3 + ncodes + nsymbols; /* length lsb */ + *p++ = (tableClass << 4) | tableNo; + memcpy(p, codelens, ncodes); + p += ncodes; + memcpy(p, symbols, nsymbols); + p += nsymbols; +} + +uint32 mjpeg_compute_header_size(uint32 qtlen, uint32 dri) +{ + uint32 qtlen_half = qtlen/2; // in case qtlen is odd; shouldn't happen + qtlen = qtlen_half*2; + + uint32 numQtables = qtlen > 64 ? 2 : 1; + return 485 + numQtables*5 + qtlen + (dri > 0 ? 6 : 0); +} + +int mjpeg_create_header +( +uint8* buf, uint32 type, +uint32 w, uint32 h, +uint8 const* qtables, uint32 qtlen, +uint32 dri +) +{ + uint8 *ptr = buf; + uint32 numQtables = qtlen > 64 ? 2 : 1; + + // MARKER_SOI: + *ptr++ = 0xFF; *ptr++ = MARKER_SOI; + + // MARKER_APP_FIRST: + *ptr++ = 0xFF; *ptr++ = MARKER_APP_FIRST; + *ptr++ = 0x00; *ptr++ = 0x10; // size of chunk + *ptr++ = 'J'; *ptr++ = 'F'; *ptr++ = 'I'; *ptr++ = 'F'; *ptr++ = 0x00; + *ptr++ = 0x01; *ptr++ = 0x01; // JFIF format version (1.1) + *ptr++ = 0x00; // no units + *ptr++ = 0x00; *ptr++ = 0x01; // Horizontal pixel aspect ratio + *ptr++ = 0x00; *ptr++ = 0x01; // Vertical pixel aspect ratio + *ptr++ = 0x00; *ptr++ = 0x00; // no thumbnail + + // MARKER_DRI: + if (dri > 0) + { + *ptr++ = 0xFF; *ptr++ = MARKER_DRI; + *ptr++ = 0x00; *ptr++ = 0x04; // size of chunk + *ptr++ = (uint8)(dri >> 8); *ptr++ = (uint8)(dri); // restart interval + } + + // MARKER_DQT (luma): + uint32 tableSize = numQtables == 1 ? qtlen : qtlen/2; + *ptr++ = 0xFF; *ptr++ = MARKER_DQT; + *ptr++ = 0x00; *ptr++ = tableSize + 3; // size of chunk + *ptr++ = 0x00; // precision(0), table id(0) + memcpy(ptr, qtables, tableSize); + qtables += tableSize; + ptr += tableSize; + + if (numQtables > 1) + { + tableSize = qtlen - qtlen/2; + // MARKER_DQT (chroma): + *ptr++ = 0xFF; *ptr++ = MARKER_DQT; + *ptr++ = 0x00; *ptr++ = tableSize + 3; // size of chunk + *ptr++ = 0x01; // precision(0), table id(1) + memcpy(ptr, qtables, tableSize); + qtables += tableSize; + ptr += tableSize; + } + + // MARKER_SOF0: + *ptr++ = 0xFF; *ptr++ = MARKER_SOF0; + *ptr++ = 0x00; *ptr++ = 0x11; // size of chunk + *ptr++ = 0x08; // sample precision + *ptr++ = (uint8)(h >> 8); + *ptr++ = (uint8)(h); // number of lines (must be a multiple of 8) + *ptr++ = (uint8)(w >> 8); + *ptr++ = (uint8)(w); // number of columns (must be a multiple of 8) + *ptr++ = 0x03; // number of components + *ptr++ = 0x01; // id of component + *ptr++ = type ? 0x22 : 0x21; // sampling ratio (h,v) + *ptr++ = 0x00; // quant table id + *ptr++ = 0x02; // id of component + *ptr++ = 0x11; // sampling ratio (h,v) + *ptr++ = numQtables == 1 ? 0x00 : 0x01; // quant table id + *ptr++ = 0x03; // id of component + *ptr++ = 0x11; // sampling ratio (h,v) + *ptr++ = numQtables == 1 ? 0x00 : 0x01; // quant table id + + mjpeg_create_huffman_header(ptr, lum_dc_codelens, sizeof lum_dc_codelens, + lum_dc_symbols, sizeof lum_dc_symbols, 0, 0); + mjpeg_create_huffman_header(ptr, lum_ac_codelens, sizeof lum_ac_codelens, + lum_ac_symbols, sizeof lum_ac_symbols, 0, 1); + mjpeg_create_huffman_header(ptr, chm_dc_codelens, sizeof chm_dc_codelens, + chm_dc_symbols, sizeof chm_dc_symbols, 1, 0); + mjpeg_create_huffman_header(ptr, chm_ac_codelens, sizeof chm_ac_codelens, + chm_ac_symbols, sizeof chm_ac_symbols, 1, 1); + + // MARKER_SOS: + *ptr++ = 0xFF; *ptr++ = MARKER_SOS; + *ptr++ = 0x00; *ptr++ = 0x0C; // size of chunk + *ptr++ = 0x03; // number of components + *ptr++ = 0x01; // id of component + *ptr++ = 0x00; // huffman table id (DC, AC) + *ptr++ = 0x02; // id of component + *ptr++ = 0x11; // huffman table id (DC, AC) + *ptr++ = 0x03; // id of component + *ptr++ = 0x11; // huffman table id (DC, AC) + *ptr++ = 0x00; // start of spectral + *ptr++ = 0x3F; // end of spectral + *ptr++ = 0x00; // successive approximation bit position (high, low) + + return (int)(ptr - buf); +} + + +// The default 'luma' and 'chroma' quantizer tables, in zigzag order: +static uint8 const defaultQuantizers[128] = +{ + // luma table: + 16, 11, 12, 14, 12, 10, 16, 14, + 13, 14, 18, 17, 16, 19, 24, 40, + 26, 24, 22, 22, 24, 49, 35, 37, + 29, 40, 58, 51, 61, 60, 57, 51, + 56, 55, 64, 72, 92, 78, 64, 68, + 87, 69, 55, 56, 80, 109, 81, 87, + 95, 98, 103, 104, 103, 62, 77, 113, + 121, 112, 100, 120, 92, 101, 103, 99, + // chroma table: + 17, 18, 18, 24, 21, 24, 47, 26, + 26, 47, 99, 66, 56, 66, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99 +}; + +void mjpeg_make_default_qtables(uint8* resultTables, uint32 Q) +{ + int factor = Q; + int q; + + if (Q < 1) factor = 1; + else if (Q > 99) factor = 99; + + if (Q < 50) + { + q = 5000 / factor; + } + else + { + q = 200 - factor*2; + } + + for (int i = 0; i < 128; ++i) + { + int newVal = (defaultQuantizers[i]*q + 50)/100; + if (newVal < 1) newVal = 1; + else if (newVal > 255) newVal = 255; + resultTables[i] = newVal; + } +} + +BOOL mjpeg_data_rx(MJPEGRXI * p_rxi, uint8 * p_data, int len) +{ + uint8* headerStart = p_data; + uint32 packetSize = len; + uint32 resultSpecialHeaderSize = 0; + + uint8* qtables = NULL; + uint32 qtlen = 0; + uint32 dri = 0; + + // There's at least 8-byte video-specific header + /* + 0 1 2 3 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Type-specific | Fragment Offset | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Type | Q | Width | Height | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + */ + + resultSpecialHeaderSize = 8; + + uint32 Offset = (uint32)((uint32)headerStart[1] << 16 | (uint32)headerStart[2] << 8 | (uint32)headerStart[3]); + uint32 Type = (uint32)headerStart[4]; + uint32 type = Type & 1; + uint32 Q = (uint32)headerStart[5]; + uint32 width = (uint32)headerStart[6] * 8; + uint32 height = (uint32)headerStart[7] * 8; + + if (width == 0) + { + width = p_rxi->width ? p_rxi->width : 256*8; + } + + if (height == 0) + { + height = p_rxi->height ? p_rxi->height : 256*8; + } + + if (Type > 63) + { + // Restart Marker header present + /* + 0 1 2 3 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Restart Interval |F|L| Restart Count | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + */ + if (packetSize < resultSpecialHeaderSize + 4) + { + return FALSE; + } + + uint32 RestartInterval = (uint32)((uint16)headerStart[resultSpecialHeaderSize] << 8 | (uint16)headerStart[resultSpecialHeaderSize + 1]); + dri = RestartInterval; + resultSpecialHeaderSize += 4; + } + + if (Offset == 0) + { + if (Q > 127) + { + // Quantization Table header present + /* + 0 1 2 3 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | MBZ | Precision | Length | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Quantization Table Data | + | ... | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + */ + if (packetSize < resultSpecialHeaderSize + 4) + { + return FALSE; + } + + uint32 MBZ = (uint32)headerStart[resultSpecialHeaderSize]; + if (MBZ == 0) + { + // uint32 Precision = (uint32)headerStart[resultSpecialHeaderSize + 1]; + uint32 Length = (uint32)((uint16)headerStart[resultSpecialHeaderSize + 2] << 8 | (uint16)headerStart[resultSpecialHeaderSize + 3]); + + //ASSERT(Length == 128); + + resultSpecialHeaderSize += 4; + + if (packetSize < resultSpecialHeaderSize + Length) + { + return FALSE; + } + + qtlen = Length; + qtables = &headerStart[resultSpecialHeaderSize]; + + resultSpecialHeaderSize += Length; + } + } + } + + // If this is the first (or only) fragment of a JPEG frame + if (Offset == 0) + { + uint8 newQtables[128]; + if (qtlen == 0) + { + // A quantization table was not present in the RTP JPEG header, + // so use the default tables, scaled according to the "Q" factor: + mjpeg_make_default_qtables(newQtables, Q); + qtables = newQtables; + qtlen = sizeof newQtables; + } + + p_rxi->d_offset = mjpeg_create_header(p_rxi->p_buf, type, width, height, qtables, qtlen, dri); + } + + if ((p_rxi->d_offset + packetSize - resultSpecialHeaderSize) >= p_rxi->buf_len) + { + log_print(HT_LOG_ERR, "%s, fragment packet too big %d!!!", __FUNCTION__, p_rxi->d_offset + packetSize - resultSpecialHeaderSize); + return FALSE; + } + + memcpy(p_rxi->p_buf + p_rxi->d_offset, headerStart + resultSpecialHeaderSize, packetSize - resultSpecialHeaderSize); + p_rxi->d_offset += packetSize - resultSpecialHeaderSize; + + // The RTP "M" (marker) bit indicates the last fragment of a frame: + if (p_rxi->rtprxi.rxf_marker) + { + if (p_rxi->d_offset >= 2 && !(p_rxi->p_buf[p_rxi->d_offset-2] == 0xFF && p_rxi->p_buf[p_rxi->d_offset-1] == MARKER_EOI)) + { + p_rxi->p_buf[p_rxi->d_offset++] = 0xFF; + p_rxi->p_buf[p_rxi->d_offset++] = MARKER_EOI; + } + + if (p_rxi->pkt_func) + { + p_rxi->pkt_func(p_rxi->p_buf, p_rxi->d_offset, p_rxi->rtprxi.ts, p_rxi->rtprxi.seq, p_rxi->user_data); + } + + p_rxi->d_offset = 0; + } + + return TRUE; +} + +BOOL mjpeg_rtp_rx(MJPEGRXI * p_rxi, uint8 * p_data, int len) +{ + if (p_rxi == NULL) + { + return FALSE; + } + + if (!rtp_data_rx(&p_rxi->rtprxi, p_data, len)) + { + return FALSE; + } + + return mjpeg_data_rx(p_rxi, p_rxi->rtprxi.p_data, p_rxi->rtprxi.len); +} + +BOOL mjpeg_rxi_init(MJPEGRXI * p_rxi, VRTPRXCBF cbf, void * p_userdata) +{ + memset(p_rxi, 0, sizeof(MJPEGRXI)); + + p_rxi->buf_len = RTP_MAX_VIDEO_BUFF; + + p_rxi->p_buf_org = (uint8 *)malloc(p_rxi->buf_len); + if (p_rxi->p_buf_org == NULL) + { + return FALSE; + } + + p_rxi->p_buf = p_rxi->p_buf_org + 32; + p_rxi->buf_len -= 32; + p_rxi->pkt_func = cbf; + p_rxi->user_data = p_userdata; + + return TRUE; +} + +void mjpeg_rxi_deinit(MJPEGRXI * p_rxi) +{ + if (p_rxi->p_buf_org) + { + free(p_rxi->p_buf_org); + } + + memset(p_rxi, 0, sizeof(MJPEGRXI)); +} + + + + diff --git a/MediaClient/MediaClient/rtp/mjpeg_rtp_rx.h b/MediaClient/MediaClient/rtp/mjpeg_rtp_rx.h new file mode 100644 index 0000000..b90eb01 --- /dev/null +++ b/MediaClient/MediaClient/rtp/mjpeg_rtp_rx.h @@ -0,0 +1,62 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ +#ifndef MJPEG_RTP_RX_H +#define MJPEG_RTP_RX_H + +#include "rtp_rx.h" + + +typedef struct mjpeg_rtp_rx_info +{ + RTPRXI rtprxi; + + uint8 * p_buf_org; // Allocated buffer + uint8 * p_buf; // = p_buf_org + 32 + uint32 buf_len; // Buffer length -32 + uint32 d_offset; // Data offset + + VRTPRXCBF pkt_func; // callback function + void * user_data; // user data + + int width; // video width + int height; // video height +} MJPEGRXI; + + +/***************************************************************************************/ + + +#ifdef __cplusplus +extern "C" { +#endif + +BOOL mjpeg_data_rx(MJPEGRXI * p_rxi, uint8 * p_data, int len); +BOOL mjpeg_rtp_rx(MJPEGRXI * p_rxi, uint8 * p_data, int len); +BOOL mjpeg_rxi_init(MJPEGRXI * p_rxi, VRTPRXCBF cbf, void * p_userdata); +void mjpeg_rxi_deinit(MJPEGRXI * p_rxi); + +#ifdef __cplusplus +} +#endif + + +#endif // MJPEG_RTP_RX_H + + + diff --git a/MediaClient/MediaClient/rtp/mjpeg_tables.cpp b/MediaClient/MediaClient/rtp/mjpeg_tables.cpp new file mode 100644 index 0000000..621e402 --- /dev/null +++ b/MediaClient/MediaClient/rtp/mjpeg_tables.cpp @@ -0,0 +1,97 @@ +/*************************************************************************************** + * + * 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 "mjpeg_tables.h" + + +uint8 const lum_dc_codelens[16] = { + 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, +}; + +uint8 const lum_dc_symbols[12] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, +}; + +uint8 const lum_ac_codelens[16] = { + 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 0x7d, +}; + +uint8 const lum_ac_symbols[] = { + 0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12, + 0x21, 0x31, 0x41, 0x06, 0x13, 0x51, 0x61, 0x07, + 0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xa1, 0x08, + 0x23, 0x42, 0xb1, 0xc1, 0x15, 0x52, 0xd1, 0xf0, + 0x24, 0x33, 0x62, 0x72, 0x82, 0x09, 0x0a, 0x16, + 0x17, 0x18, 0x19, 0x1a, 0x25, 0x26, 0x27, 0x28, + 0x29, 0x2a, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, + 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, + 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, + 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, + 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, + 0x7a, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, + 0x8a, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, + 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, + 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, + 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3, 0xc4, 0xc5, + 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2, 0xd3, 0xd4, + 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xe1, 0xe2, + 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, + 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, + 0xf9, 0xfa, +}; + +uint8 const chm_dc_codelens[16] = { + 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, +}; + +uint8 const chm_dc_symbols[12] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, +}; + +uint8 const chm_ac_codelens[16] = { + 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 0x77, +}; + +uint8 const chm_ac_symbols[] = { + 0x00, 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, 0x21, + 0x31, 0x06, 0x12, 0x41, 0x51, 0x07, 0x61, 0x71, + 0x13, 0x22, 0x32, 0x81, 0x08, 0x14, 0x42, 0x91, + 0xa1, 0xb1, 0xc1, 0x09, 0x23, 0x33, 0x52, 0xf0, + 0x15, 0x62, 0x72, 0xd1, 0x0a, 0x16, 0x24, 0x34, + 0xe1, 0x25, 0xf1, 0x17, 0x18, 0x19, 0x1a, 0x26, + 0x27, 0x28, 0x29, 0x2a, 0x35, 0x36, 0x37, 0x38, + 0x39, 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, + 0x49, 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, + 0x59, 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, + 0x69, 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, + 0x79, 0x7a, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, + 0x88, 0x89, 0x8a, 0x92, 0x93, 0x94, 0x95, 0x96, + 0x97, 0x98, 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5, + 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, + 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3, + 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2, + 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, + 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, + 0xea, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, + 0xf9, 0xfa, +}; + + + diff --git a/MediaClient/MediaClient/rtp/mjpeg_tables.h b/MediaClient/MediaClient/rtp/mjpeg_tables.h new file mode 100644 index 0000000..fc6d662 --- /dev/null +++ b/MediaClient/MediaClient/rtp/mjpeg_tables.h @@ -0,0 +1,42 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef MJPEG_TABLES_H +#define MJPEG_TABLES_H + +#ifdef __cplusplus +extern "C" { +#endif + +extern uint8 const lum_dc_codelens[16]; +extern uint8 const lum_dc_symbols[12]; +extern uint8 const lum_ac_codelens[16]; +extern uint8 const lum_ac_symbols[162]; +extern uint8 const chm_dc_codelens[16]; +extern uint8 const chm_dc_symbols[12]; +extern uint8 const chm_ac_codelens[16]; +extern uint8 const chm_ac_symbols[162]; + +#ifdef __cplusplus +} +#endif + +#endif // MJPEG_TABLES_H + + diff --git a/MediaClient/MediaClient/rtp/mpeg4.cpp b/MediaClient/MediaClient/rtp/mpeg4.cpp new file mode 100644 index 0000000..d2b24bb --- /dev/null +++ b/MediaClient/MediaClient/rtp/mpeg4.cpp @@ -0,0 +1,126 @@ +/*************************************************************************************** + * + * 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 "mpeg4.h" + + +static BOOL mpeg4_get_nibble(char const*& configStr, uint8& resultNibble) +{ + char c = configStr[0]; + if (c == '\0') + { + return FALSE; // we've reached the end + } + + if (c >= '0' && c <= '9') + { + resultNibble = c - '0'; + } + else if (c >= 'A' && c <= 'F') + { + resultNibble = 10 + c - 'A'; + } + else if (c >= 'a' && c <= 'f') + { + resultNibble = 10 + c - 'a'; + } + else + { + return FALSE; + } + + ++configStr; // move to the next nibble + + return TRUE; +} + +static BOOL mpeg4_get_byte(char const*& configStr, uint8& resultByte) +{ + resultByte = 0; // by default, in case parsing fails + + uint8 firstNibble; + if (!mpeg4_get_nibble(configStr, firstNibble)) + { + return FALSE; + } + + resultByte = firstNibble << 4; + + uint8 secondNibble = 0; + if (!mpeg4_get_nibble(configStr, secondNibble) && configStr[0] != '\0') + { + // There's a second nibble, but it's malformed + return FALSE; + } + + resultByte |= secondNibble; + + return TRUE; +} + +uint8 * mpeg4_parse_config(char const* configStr, uint32& configSize) +{ + uint8 * config = NULL; + + do + { + if (configStr == NULL) + { + break; + } + + configSize = ((int)strlen(configStr)+1)/2; + + config = (uint8 *) malloc(configSize); + if (config == NULL) + { + break; + } + + uint32 i; + + for (i = 0; i < configSize; ++i) + { + if (!mpeg4_get_byte(configStr, config[i])) + { + break; + } + } + + if (i != configSize) + { + break; // part of the string was bad + } + + return config; + } while (0); + + configSize = 0; + + if (config) + { + free(config); + } + + return NULL; +} + + + diff --git a/MediaClient/MediaClient/rtp/mpeg4.h b/MediaClient/MediaClient/rtp/mpeg4.h new file mode 100644 index 0000000..4283d3d --- /dev/null +++ b/MediaClient/MediaClient/rtp/mpeg4.h @@ -0,0 +1,37 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef MPEG4_H +#define MPEG4_H + + +#ifdef __cplusplus +extern "C" { +#endif + +uint8 * mpeg4_parse_config(char const* configStr, uint32& configSize); + +#ifdef __cplusplus +} +#endif + + +#endif + + diff --git a/MediaClient/MediaClient/rtp/mpeg4_rtp_rx.cpp b/MediaClient/MediaClient/rtp/mpeg4_rtp_rx.cpp new file mode 100644 index 0000000..65e55c9 --- /dev/null +++ b/MediaClient/MediaClient/rtp/mpeg4_rtp_rx.cpp @@ -0,0 +1,124 @@ +/*************************************************************************************** + * + * 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 "mpeg4_rtp_rx.h" + + +BOOL mpeg4_data_rx(MPEG4RXI * p_rxi, uint8 * p_data, int len) +{ + BOOL begin_packet = FALSE; + + // The packet begins a frame iff its data begins with a system code + // (i.e., 0x000001??) + begin_packet = (len >= 4 && p_data[0] == 0 && p_data[1] == 0 && p_data[2] == 1); + + if (begin_packet) + { + p_rxi->d_offset = 0; + } + + if (p_rxi->rtprxi.rxf_loss) + { + // Packet loss, discard the previously cached packets + p_rxi->d_offset = 0; + + // Packet loss, until the next start packet + + if (!begin_packet) + { + return FALSE; + } + else + { + p_rxi->rtprxi.rxf_loss = 0; + } + } + + if ((p_rxi->d_offset + len + p_rxi->hdr_len) >= p_rxi->buf_len) + { + log_print(HT_LOG_ERR, "%s, fragment packet too big %d!!!", + __FUNCTION__, p_rxi->d_offset + len + p_rxi->hdr_len); + return FALSE; + } + + memcpy(p_rxi->p_buf + p_rxi->d_offset + p_rxi->hdr_len, p_data, len); + p_rxi->d_offset += len; + + if (p_rxi->rtprxi.rxf_marker) + { + if (p_rxi->pkt_func) + { + p_rxi->pkt_func(p_rxi->p_buf, p_rxi->d_offset + p_rxi->hdr_len, p_rxi->rtprxi.ts, p_rxi->rtprxi.seq, p_rxi->user_data); + } + + p_rxi->d_offset = 0; + } + + return TRUE; +} + +BOOL mpeg4_rtp_rx(MPEG4RXI * p_rxi, uint8 * p_data, int len) +{ + if (p_rxi == NULL) + { + return FALSE; + } + + if (!rtp_data_rx(&p_rxi->rtprxi, p_data, len)) + { + return FALSE; + } + + return mpeg4_data_rx(p_rxi, p_rxi->rtprxi.p_data, p_rxi->rtprxi.len); +} + +BOOL mpeg4_rxi_init(MPEG4RXI * p_rxi, VRTPRXCBF cbf, void * p_userdata) +{ + memset(p_rxi, 0, sizeof(MPEG4RXI)); + + p_rxi->buf_len = RTP_MAX_VIDEO_BUFF; + + p_rxi->p_buf_org = (uint8 *)malloc(p_rxi->buf_len); + if (p_rxi->p_buf_org == NULL) + { + return FALSE; + } + + p_rxi->p_buf = p_rxi->p_buf_org + 32; + p_rxi->buf_len -= 32; + p_rxi->pkt_func = cbf; + p_rxi->user_data = p_userdata; + + return TRUE; +} + +void mpeg4_rxi_deinit(MPEG4RXI * p_rxi) +{ + if (p_rxi->p_buf_org) + { + free(p_rxi->p_buf_org); + } + + memset(p_rxi, 0, sizeof(MPEG4RXI)); +} + + + + + diff --git a/MediaClient/MediaClient/rtp/mpeg4_rtp_rx.h b/MediaClient/MediaClient/rtp/mpeg4_rtp_rx.h new file mode 100644 index 0000000..3e7dff2 --- /dev/null +++ b/MediaClient/MediaClient/rtp/mpeg4_rtp_rx.h @@ -0,0 +1,58 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ +#ifndef MPEG4_RTX_RX_H +#define MPEG4_RTX_RX_H + + +#include "rtp_rx.h" + + +typedef struct mpeg4_rtp_rx_info +{ + RTPRXI rtprxi; + + uint8 * p_buf_org; // Allocated buffer + uint8 * p_buf; // = p_buf_org + 32 + uint32 buf_len; // Buffer length -32 + uint32 d_offset; // Data offset + + VRTPRXCBF pkt_func; // callback function + void * user_data; // user data + + uint32 hdr_len; // header length +} MPEG4RXI; + + +#ifdef __cplusplus +extern "C" { +#endif + +BOOL mpeg4_data_rx(MPEG4RXI * p_rxi, uint8 * p_data, int len); +BOOL mpeg4_rtp_rx(MPEG4RXI * p_rxi, uint8 * p_data, int len); +BOOL mpeg4_rxi_init(MPEG4RXI * p_rxi, VRTPRXCBF cbf, void * p_userdata); +void mpeg4_rxi_deinit(MPEG4RXI * p_rxi); + +#ifdef __cplusplus +} +#endif + +#endif // MPEG4_RTX_RX_H + + + diff --git a/MediaClient/MediaClient/rtp/pcm_rtp_rx.cpp b/MediaClient/MediaClient/rtp/pcm_rtp_rx.cpp new file mode 100644 index 0000000..067019e --- /dev/null +++ b/MediaClient/MediaClient/rtp/pcm_rtp_rx.cpp @@ -0,0 +1,113 @@ +/*************************************************************************************** + * + * 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 "pcm_rtp_rx.h" + + +BOOL pcm_data_rx(PCMRXI * p_rxi, uint8 * p_data, int len) +{ + if (p_rxi->rtprxi.rxf_loss) + { + // Submit cached data + + if (p_rxi->pkt_func && p_rxi->d_offset > 0) + { + p_rxi->pkt_func(p_rxi->p_buf, p_rxi->d_offset, p_rxi->rtprxi.ts, p_rxi->rtprxi.seq, p_rxi->user_data); + } + + p_rxi->d_offset = 0; + p_rxi->rtprxi.rxf_loss = 0; + } + + if ((p_rxi->d_offset + len) >= p_rxi->buf_len) + { + // Submit cached data + + if (p_rxi->pkt_func) + { + p_rxi->pkt_func(p_rxi->p_buf, p_rxi->d_offset, p_rxi->rtprxi.ts, p_rxi->rtprxi.seq, p_rxi->user_data); + } + + p_rxi->d_offset = 0; + } + + memcpy(p_rxi->p_buf + p_rxi->d_offset, p_data, len); + p_rxi->d_offset += len; + + if (p_rxi->rtprxi.rxf_marker) + { + if (p_rxi->pkt_func) + { + p_rxi->pkt_func(p_rxi->p_buf, p_rxi->d_offset, p_rxi->rtprxi.ts, p_rxi->rtprxi.seq, p_rxi->user_data); + } + + p_rxi->d_offset = 0; + } + + return TRUE; +} + +BOOL pcm_rtp_rx(PCMRXI * p_rxi, uint8 * p_data, int len) +{ + if (p_rxi == NULL) + { + return FALSE; + } + + if (!rtp_data_rx(&p_rxi->rtprxi, p_data, len)) + { + return FALSE; + } + + return pcm_data_rx(p_rxi, p_rxi->rtprxi.p_data, p_rxi->rtprxi.len); +} + +BOOL pcm_rxi_init(PCMRXI * p_rxi, VRTPRXCBF cbf, void * p_userdata) +{ + memset(p_rxi, 0, sizeof(PCMRXI)); + + p_rxi->buf_len = RTP_MAX_AUDIO_BUFF; + + p_rxi->p_buf_org = (uint8 *)malloc(p_rxi->buf_len); + if (p_rxi->p_buf_org == NULL) + { + return FALSE; + } + + p_rxi->p_buf = p_rxi->p_buf_org + 32; + p_rxi->buf_len -= 32; + p_rxi->pkt_func = cbf; + p_rxi->user_data = p_userdata; + + return TRUE; +} + +void pcm_rxi_deinit(PCMRXI * p_rxi) +{ + if (p_rxi->p_buf_org) + { + free(p_rxi->p_buf_org); + } + + memset(p_rxi, 0, sizeof(PCMRXI)); +} + + + diff --git a/MediaClient/MediaClient/rtp/pcm_rtp_rx.h b/MediaClient/MediaClient/rtp/pcm_rtp_rx.h new file mode 100644 index 0000000..7ab0260 --- /dev/null +++ b/MediaClient/MediaClient/rtp/pcm_rtp_rx.h @@ -0,0 +1,59 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ +#ifndef PCM_RTP_RX_H +#define PCM_RTP_RX_H + +#include "rtp_rx.h" + + +typedef struct pcm_rtp_rx_info +{ + RTPRXI rtprxi; + + uint8 * p_buf_org; // Allocated buffer + uint8 * p_buf; // = p_buf_org + 32 + uint32 buf_len; // Buffer length -32 + uint32 d_offset; // Data offset + + VRTPRXCBF pkt_func; // callback function + void * user_data; // user data +} PCMRXI; + + +/***************************************************************************************/ + + +#ifdef __cplusplus +extern "C" { +#endif + +BOOL pcm_data_rx(PCMRXI * p_rxi, uint8 * p_data, int len); +BOOL pcm_rtp_rx(PCMRXI * p_rxi, uint8 * p_data, int len); +BOOL pcm_rxi_init(PCMRXI * p_rxi, VRTPRXCBF cbf, void * p_userdata); +void pcm_rxi_deinit(PCMRXI * p_rxi); + +#ifdef __cplusplus +} +#endif + + +#endif // PCM_RTP_RX_H + + + diff --git a/MediaClient/MediaClient/rtp/rtp.cpp b/MediaClient/MediaClient/rtp/rtp.cpp new file mode 100644 index 0000000..016d280 --- /dev/null +++ b/MediaClient/MediaClient/rtp/rtp.cpp @@ -0,0 +1,60 @@ +/*************************************************************************************** + * + * 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 "rtp.h" + + +uint16 rtp_read_uint16(uint8 *input) +{ + return (uint16)((input[0] << 8) | input[1]); +} + +uint32 rtp_read_uint32(uint8 *input) +{ + return (uint32)((input[0] << 24) | (input[1] << 16) | (input[2] << 8) | input[3]); +} + +uint64 rtp_read_uint64(uint8 *input) +{ + uint32 low = rtp_read_uint32(input); + uint32 high = rtp_read_uint32(input+4); + return (uint64)(((uint64)low) << 32 | high); +} + +int rtp_write_uint16(uint8 *output, uint16 nVal) +{ + output[1] = nVal & 0xff; + output[0] = nVal >> 8; + + return 2; +} + +int rtp_write_uint32(uint8 *output, uint32 nVal) +{ + output[3] = nVal & 0xff; + output[2] = nVal >> 8; + output[1] = nVal >> 16; + output[0] = nVal >> 24; + + return 4; +} + + + diff --git a/MediaClient/MediaClient/rtp/rtp.h b/MediaClient/MediaClient/rtp/rtp.h new file mode 100644 index 0000000..9583599 --- /dev/null +++ b/MediaClient/MediaClient/rtp/rtp.h @@ -0,0 +1,83 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef __H_RTP_H__ +#define __H_RTP_H__ + + +#define H26X_RTP_MAX_LEN (1450 - 4 - 12 - 2 - 16) // TCP RTP FU REPLAYHDR +#define JPEG_RTP_MAX_LEN (1450 - 4 - 12 - 16) +#define RTP_MAX_LEN (1450 - 4 - 12 - 16) + +/* + * Current protocol version. + */ +#define RTP_VERSION 2 + +#define RTP_SEQ_MOD (1<<16) +#define RTP_MAX_SDES 255 /* maximum text length for SDES */ + + +typedef enum { + RTCP_FIR = 192, + RTCP_NACK, // 193 + RTCP_SMPTETC, // 194 + RTCP_IJ, // 195 + RTCP_SR = 200, + RTCP_RR, // 201 + RTCP_SDES, // 202 + RTCP_BYE, // 203 + RTCP_APP, // 204 + RTCP_RTPFB, // 205 + RTCP_PSFB, // 206 + RTCP_XR, // 207 + RTCP_AVB, // 208 + RTCP_RSI, // 209 + RTCP_TOKEN, // 210 +} rtcp_type_t; + +#define RTP_PT_IS_RTCP(x) (((x) >= RTCP_FIR && (x) <= RTCP_IJ) || \ + ((x) >= RTCP_SR && (x) <= RTCP_TOKEN)) + +typedef struct +{ + uint32 magic : 8; + uint32 channel : 8; + uint32 rtp_len : 16; +} RILF; + +uint16 rtp_read_uint16(uint8 *input); +uint32 rtp_read_uint32(uint8 *input); +uint64 rtp_read_uint64(uint8 *input); +int rtp_write_uint16(uint8 *output, uint16 nVal); +int rtp_write_uint32(uint8 *output, uint32 nVal); + + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +} +#endif + +#endif // __H_RTP_H__ + + + diff --git a/MediaClient/MediaClient/rtp/rtp_rx.cpp b/MediaClient/MediaClient/rtp/rtp_rx.cpp new file mode 100644 index 0000000..5c16367 --- /dev/null +++ b/MediaClient/MediaClient/rtp/rtp_rx.cpp @@ -0,0 +1,123 @@ +/*************************************************************************************** + * + * 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 "rtp_rx.h" +#include "rtp.h" + + +BOOL rtp_data_rx(RTPRXI * p_rxi, uint8 * p_data, int len) +{ + uint8 * p_rtp = p_data; + uint32 rtp_len = len; + + // Check for the 12-byte RTP header: + if (rtp_len < 12) + { + return FALSE; + } + + uint32 rtpHdr = rtp_read_uint32(p_rtp); p_rtp += 4; rtp_len -= 4; + uint8 rtpPT = ((rtpHdr & 0x007f0000) >> 16); + BOOL rtpMarkerBit = (rtpHdr & 0x00800000) != 0; + uint16 rtpSeq = rtpHdr & 0xFFFF; + uint32 rtpTimestamp = rtp_read_uint32(p_rtp); p_rtp += 4; rtp_len -= 4; + uint32 rtpSSRC = rtp_read_uint32(p_rtp); p_rtp += 4; rtp_len -= 4; + + // Check the RTP version number (it should be 2) + if ((rtpHdr & 0xC0000000) != 0x80000000) + { + return FALSE; + } + + // Skip over any CSRC identifiers in the header + uint32 cc = (rtpHdr >> 24) & 0x0F; + if (rtp_len < cc * 4) + { + return FALSE; + } + p_rtp += cc * 4; rtp_len -= cc * 4; + + // Check for (& ignore) any RTP header extension + if (rtpHdr & 0x10000000) + { + if (rtp_len < 4) + { + return FALSE; + } + + uint32 extHdr = rtp_read_uint32(p_rtp); p_rtp += 4; rtp_len -= 4; + uint32 remExtSize = 4 * (extHdr & 0xFFFF); + if (rtp_len < remExtSize) + { + return FALSE; + } + p_rtp += remExtSize; rtp_len -= remExtSize; + } + + // Discard any padding bytes: + if (rtpHdr & 0x20000000) + { + if (rtp_len == 0) + { + return FALSE; + } + + uint32 numPaddingBytes = (uint32)p_rtp[rtp_len-1]; + if (rtp_len < numPaddingBytes) + { + return FALSE; + } + rtp_len -= numPaddingBytes; + } + + if (0 == p_rxi->rtp_pt) + { + p_rxi->rtp_pt = rtpPT; + } + else if (rtpPT != p_rxi->rtp_pt) + { + return FALSE; + } + + if (p_rxi->ssrc && p_rxi->ssrc != rtpSSRC) + { + log_print(HT_LOG_WARN, "%s, prev ssrc[%u], cur ssrc[%u]!!!\r\n", __FUNCTION__, p_rxi->ssrc, rtpSSRC); + } + p_rxi->ssrc = rtpSSRC; + + if (p_rxi->seq && p_rxi->seq != (uint16)(rtpSeq - 1)) + { + p_rxi->rxf_loss = 1; + log_print(HT_LOG_WARN, "%s, prev seq[%u], cur seq[%u]!!!\r\n", __FUNCTION__, p_rxi->seq, rtpSeq); + } + p_rxi->seq = rtpSeq; + + p_rxi->rxf_marker = rtpMarkerBit; + p_rxi->ts = rtpTimestamp; + + p_rxi->p_data = p_rtp; + p_rxi->len = rtp_len; + + return TRUE; +} + + + + diff --git a/MediaClient/MediaClient/rtp/rtp_rx.h b/MediaClient/MediaClient/rtp/rtp_rx.h new file mode 100644 index 0000000..384073e --- /dev/null +++ b/MediaClient/MediaClient/rtp/rtp_rx.h @@ -0,0 +1,60 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef RTP_RX_H +#define RTP_RX_H + + +#define RTP_MAX_VIDEO_BUFF (2*1024*1024) +#define RTP_MAX_AUDIO_BUFF (8*1024) + + +typedef int (*VRTPRXCBF)(uint8 * p_data, int len, uint32 ts, uint32 seq, void * p_userdata); + + +typedef struct +{ + uint32 rxf_marker : 1; // Marker bit + uint32 rxf_loss : 1; // The loss of sequence numbers has occurred in the middle + uint32 rtp_pt : 8; // rtp payload type + uint32 res1 : 6; + + uint32 seq : 16; // sequence number + + uint32 ssrc; // Synchronization source + uint32 ts; // Timestamp + + uint8 * p_data; + int len; +} RTPRXI; + +#ifdef __cplusplus +extern "C" { +#endif + +BOOL rtp_data_rx(RTPRXI * p_rxi, uint8 * p_data, int len); + +#ifdef __cplusplus +} +#endif + + +#endif + + diff --git a/MediaClient/MediaClient/rtp/ts_parser.cpp b/MediaClient/MediaClient/rtp/ts_parser.cpp new file mode 100644 index 0000000..f77a965 --- /dev/null +++ b/MediaClient/MediaClient/rtp/ts_parser.cpp @@ -0,0 +1,627 @@ +/*************************************************************************************** + * + * 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 "ts_parser.h" +#include "bs.h" + + +BOOL ts_parser_add_item_to_list(TSList * list, void * data) +{ + TSListItem * item = (TSListItem *)malloc(sizeof(TSListItem)); + if (NULL == item) + { + return FALSE; + } + + item->mData = data; + item->mNext = NULL; + + if (list->mTail != NULL) + { + list->mTail->mNext = item; + list->mTail = item; + } + else + { + list->mHead = list->mTail = item; + } + + return TRUE; +} + +BOOL ts_parser_add_program(TSParser * parser, uint32 program_map_pid) +{ + TSProgram * program = (TSProgram *)malloc(sizeof(TSProgram)); + if (NULL == program) + { + return FALSE; + } + + memset(program, 0, sizeof(TSProgram)); + + program->mProgramMapPID = program_map_pid; + + return ts_parser_add_item_to_list(&parser->mPrograms, program); +} + +BOOL ts_parser_add_stream(TSProgram * program, uint32 elementaryPID, uint32 streamType) +{ + TSStream * stream = (TSStream *)malloc(sizeof(TSStream)); + if (NULL == stream) + { + return FALSE; + } + + memset(stream, 0, sizeof(TSStream)); + + stream->mProgram = program; + stream->mElementaryPID = elementaryPID; + stream->mStreamType = streamType; + + // todo : The maximum receive buffer should be allocated based on streamType + + log_print(HT_LOG_INFO, "%s, add stream, pid: %d, stream type: %d (%X)\r\n", + __FUNCTION__, elementaryPID, streamType, streamType); + + return ts_parser_add_item_to_list(&program->mStreams, stream); +} + +TSStream * ts_parser_get_stream_by_pid(TSProgram * program, uint32 pid) +{ + TSListItem *item; + TSStream *stream; + + for (item = program->mStreams.mHead; item != NULL; item = item->mNext) + { + stream = (TSStream *)item->mData; + + if (stream != NULL && stream->mElementaryPID == pid) + { + return stream; + } + } + + return NULL; +} + +int64 ts_parser_parse_timestamp(bs_t * bs) +{ + int64 result = ((uint64)bs_read(bs, 3)) << 30; + bs_skip(bs, 1); + result |= ((uint64)bs_read(bs, 15)) << 15; + bs_skip(bs, 1); + result |= bs_read(bs, 15); + + return result; +} + +int64 ts_parser_pts_to_timestamp(TSStream * stream, uint64 PTS) +{ + if (!stream->mProgram->mFirstPTSValid) + { + stream->mProgram->mFirstPTSValid = 1; + stream->mProgram->mFirstPTS = PTS; + PTS = 0; + } + else if (PTS < stream->mProgram->mFirstPTS) + { + PTS = 0; + } + else + { + PTS -= stream->mProgram->mFirstPTS; + } + + return (PTS * 100) / 9; +} + +void ts_parser_on_payload_data(TSParser * parser, TSStream * stream, uint32 PTS_DTS_flag, uint64 PTS, uint64 DTS, uint8 *data, uint32 size) +{ + // int64 timeUs = ts_parser_pts_to_timestamp(stream, PTS); + + sys_os_mutex_enter(parser->mMutex); + if (parser->mCallback) + { + parser->mCallback(data, size, stream->mStreamType, PTS, parser->mUserdata); + } + sys_os_mutex_leave(parser->mMutex); +} + +void ts_parser_parse_pes(TSParser * parser, TSStream * stream, bs_t * bs) +{ + bs_read(bs, 24); // packet_startcode_prefix + + uint32 stream_id = bs_read(bs, 8); + uint32 PES_packet_length = bs_read(bs, 16); + + if (stream_id != 0xbc // program_stream_map + && stream_id != 0xbe // padding_stream + && stream_id != 0xbf // private_stream_2 + && stream_id != 0xf0 // ECM + && stream_id != 0xf1 // EMM + && stream_id != 0xff // program_stream_directory + && stream_id != 0xf2 // DSMCC + && stream_id != 0xf8) // H.222.1 type E + { + uint32 PTS_DTS_flags; + uint32 ESCR_flag; + uint32 ES_rate_flag; + uint32 PES_header_data_length; + uint32 optional_bytes_remaining; + uint64 PTS = 0, DTS = 0; + + bs_skip(bs, 8); + + PTS_DTS_flags = bs_read(bs, 2); + ESCR_flag = bs_read(bs, 1); + ES_rate_flag = bs_read(bs, 1); + bs_read(bs, 1); // DSM_trick_mode_flag + bs_read(bs, 1); // additional_copy_info_flag + + bs_skip(bs, 2); + + PES_header_data_length = bs_read(bs, 8); + optional_bytes_remaining = PES_header_data_length; + + if (PTS_DTS_flags == 2 || PTS_DTS_flags == 3) + { + bs_skip(bs, 4); + PTS = ts_parser_parse_timestamp(bs); + bs_skip(bs, 1); + + optional_bytes_remaining -= 5; + + if (PTS_DTS_flags == 3) + { + bs_skip(bs, 4); + + DTS = ts_parser_parse_timestamp(bs); + bs_skip(bs, 1); + + optional_bytes_remaining -= 5; + } + } + + if (ESCR_flag) + { + bs_skip(bs, 2); + + ts_parser_parse_timestamp(bs); + + bs_skip(bs, 11); + + optional_bytes_remaining -= 6; + } + + if (ES_rate_flag) + { + bs_skip(bs, 24); + optional_bytes_remaining -= 3; + } + + bs_skip(bs, optional_bytes_remaining * 8); + + // ES data follows. + if (PES_packet_length != 0) + { + uint32 dataLength = PES_packet_length - 3 - PES_header_data_length; + + // Signaling we have payload data + ts_parser_on_payload_data(parser, stream, PTS_DTS_flags, PTS, DTS, bs_data(bs), dataLength); + + bs_skip(bs, dataLength * 8); + } + else + { + // Signaling we have payload data + ts_parser_on_payload_data(parser, stream, PTS_DTS_flags, PTS, DTS, bs_data(bs), bs_left(bs) / 8); + } + } + else if (stream_id == 0xbe) + { + // padding_stream + bs_skip(bs, PES_packet_length * 8); + } + else + { + bs_skip(bs, PES_packet_length * 8); + } +} + +void ts_parser_flush_stream_data(TSParser * parser, TSStream * stream) +{ + bs_t bs; + bs_init(&bs, stream->mBuffer, stream->mBufferSize); + + ts_parser_parse_pes(parser, stream, &bs); + + stream->mBufferSize = 0; +} + +BOOL ts_parser_parse_stream(TSParser * parser, TSStream * stream, uint32 payload_unit_start_indicator, bs_t * bs) +{ + uint32 payload_size; + + if (payload_unit_start_indicator) + { + if (stream->mPayloadStarted) + { + ts_parser_flush_stream_data(parser, stream); + } + + stream->mPayloadStarted = 1; + } + + if (!stream->mPayloadStarted) + { + return FALSE; + } + + payload_size = bs_left(bs) / 8; + + if (stream->mBufferSize + payload_size > ARRAY_SIZE(stream->mBuffer)) + { + log_print(HT_LOG_WARN, "%s, packet size(%d) is too big!!!\r\n", + __FUNCTION__, stream->mBufferSize + payload_size); + return FALSE; + } + + memcpy(stream->mBuffer + stream->mBufferSize, bs_data(bs), payload_size); + stream->mBufferSize += payload_size; + + return TRUE; +} + +BOOL ts_parser_parse_program_map(TSParser * parser, TSProgram * program, bs_t * bs) +{ + uint32 table_id; + uint32 section_length; + uint32 program_info_length; + size_t infoBytesRemaining; + uint32 streamType; + uint32 elementaryPID; + uint32 ES_info_length; + uint32 info_bytes_remaining; + + table_id = bs_read(bs, 8); + if (TS_PMT_TID != table_id) + { + log_print(HT_LOG_ERR, "%s, table_id=%d\r\n", __FUNCTION__, table_id); + return FALSE; + } + + bs_read(bs, 1); // section_syntax_indicator + + bs_skip(bs, 3); // Reserved + + section_length = bs_read(bs, 12); + + bs_skip(bs, 16);// program_number + bs_skip(bs, 2); // reserved + bs_skip(bs, 5); // version_number + bs_skip(bs, 1); // current_next_indicator + bs_skip(bs, 8); // section_number + bs_skip(bs, 8); // last_section_number + bs_skip(bs, 3); // reserved + bs_skip(bs, 13);// PCR_PID + bs_skip(bs, 4); // reserved + + program_info_length = bs_read(bs, 12); + + bs_skip(bs, program_info_length * 8); // skip descriptors + + // infoBytesRemaining is the number of bytes that make up the + // variable length section of ES_infos. It does not include the + // final CRC. + infoBytesRemaining = section_length - 9 - program_info_length - 4; + + while (infoBytesRemaining > 0) + { + streamType = bs_read(bs, 8); + + bs_skip(bs, 3); // reserved + + elementaryPID = bs_read(bs, 13); + + bs_skip(bs, 4); // reserved + + ES_info_length = bs_read(bs, 12); + + info_bytes_remaining = ES_info_length; + while (info_bytes_remaining >= 2) + { + uint32 descLength; + + bs_skip(bs, 8); // tag + + descLength = bs_read(bs, 8); + + bs_skip(bs, descLength * 8); + + info_bytes_remaining -= descLength + 2; + } + + if (ts_parser_get_stream_by_pid(program, elementaryPID) == NULL) + { + ts_parser_add_stream(program, elementaryPID, streamType); + } + + infoBytesRemaining -= 5 + ES_info_length; + } + + bs_skip(bs, 32); // CRC + + return TRUE; +} + +BOOL ts_parser_parse_pmt(TSParser * parser, bs_t * bs) +{ + size_t i; + uint32 table_id = bs_read(bs, 8); + if (TS_PAT_TID != table_id) + { + log_print(HT_LOG_ERR, "%s, table_id=%d\r\n", __FUNCTION__, table_id); + return FALSE; + } + + bs_read(bs, 1); // section_syntax_indicator + bs_skip(bs, 1); + bs_skip(bs, 2); // reserved + + uint32 section_length = bs_read(bs, 12); + + bs_skip(bs, 16);// transport_stream_id + bs_skip(bs, 2); // reserved + bs_skip(bs, 5); // version_number + bs_skip(bs, 1); // current_next_indicator + bs_skip(bs, 8); // section_number + bs_skip(bs, 8); // last_section_number + + size_t numProgramBytes = (section_length - 5 /* header */ - 4 /* crc */); + + for (i = 0; i < numProgramBytes / 4; ++i) + { + uint32 program_number = bs_read(bs, 16); + + bs_skip(bs, 3); // reserved + + if (program_number == 0) + { + bs_skip(bs, 13); // network_PID + } + else + { + uint32 programMapPID = bs_read(bs, 13); + + ts_parser_add_program(parser, programMapPID); + } + } + + bs_skip(bs, 32); // CRC + + return TRUE; +} + +BOOL ts_parser_parse_program(TSParser * parser, bs_t * bs, uint32 pid, uint32 payload_unit_start_indicator) +{ + BOOL handled = 0; + TSListItem *item; + TSProgram *program; + + if (pid == 0) + { + if (payload_unit_start_indicator) + { + uint32 skip = bs_read(bs, 8); + bs_skip(bs, skip * 8); + } + + return ts_parser_parse_pmt(parser, bs); + } + + for (item = parser->mPrograms.mHead; item != NULL; item = item->mNext) + { + program = (TSProgram *)item->mData; + + if (pid == program->mProgramMapPID) + { + if (payload_unit_start_indicator) + { + uint32 skip = bs_read(bs, 8); + bs_skip(bs, skip * 8); + } + + handled = ts_parser_parse_program_map(parser, program, bs); + break; + } + else + { + TSStream * pStream = ts_parser_get_stream_by_pid(program, pid); + if (pStream != NULL) + { + handled = ts_parser_parse_stream(parser, pStream, payload_unit_start_indicator, bs); + break; + } + } + } + + if (!handled) + { + // log_print(HT_LOG_WARN, "%s, PID 0x%04x not handled.\n", __FUNCTION__, pid); + } + + return handled; +} + +void ts_parser_parse_adaptation_field(TSParser * parser, bs_t * bs) +{ + uint32 adaptation_field_length = bs_read(bs, 8); + if (adaptation_field_length > 0) + { + bs_skip(bs, adaptation_field_length * 8); + } +} + +BOOL ts_parser_parse_packet(TSParser * parser, uint8 * data, int size) +{ + uint32 transport_error_indicator; + uint32 payload_unit_start_indicator; + uint32 pid; + uint32 adaptation_field_control; + + bs_t bs; + bs_init(&bs, data, size); + + bs_read(&bs, 8); // sync_byte + + transport_error_indicator = bs_read(&bs, 1); + if (transport_error_indicator != 0) + { + log_print(HT_LOG_WARN, "%s, transport error indicator: %u\n", + __FUNCTION__, transport_error_indicator); + } + + payload_unit_start_indicator = bs_read(&bs, 1); + bs_read(&bs, 1); // transport_priority + pid = bs_read(&bs, 13); + bs_read(&bs, 2); // transport_scrambling_control + adaptation_field_control = bs_read(&bs, 2); + bs_read(&bs, 4); // continuity_counter + + if (adaptation_field_control == 2 || adaptation_field_control == 3) + { + ts_parser_parse_adaptation_field(parser, &bs); + } + + if (adaptation_field_control == 1 || adaptation_field_control == 3) + { + ts_parser_parse_program(parser, &bs, pid, payload_unit_start_indicator); + } + + return TRUE; +} + +BOOL ts_parser_parse(TSParser * parser, uint8 * data, int size) +{ + for (;;) + { + if (size == 0) + { + break; + } + else if (size < TS_PACKET_SIZE) + { + return FALSE; + } + + if (data[0] != TS_SYNC) + { + data++; + size--; + } + else + { + if (!ts_parser_parse_packet(parser, data, TS_PACKET_SIZE)) + { + return FALSE; + } + + data += TS_PACKET_SIZE; + size -= TS_PACKET_SIZE; + } + } + + return TRUE; +} + +BOOL ts_parser_init(TSParser * parser) +{ + if (NULL == parser) + { + return FALSE; + } + + memset(parser, 0, sizeof(TSParser)); + + parser->mMutex = sys_os_create_mutex(); + + return TRUE; +} + +void ts_parser_set_cb(TSParser * parser, payload_cb cb, void * userdata) +{ + if (NULL == parser) + { + return; + } + + sys_os_mutex_enter(parser->mMutex); + parser->mCallback = cb; + parser->mUserdata = userdata; + sys_os_mutex_leave(parser->mMutex); +} + +void ts_parser_free_program(TSProgram * program) +{ + // Free Streams + TSListItem *item; + TSStream *stream; + + while (program->mStreams.mHead != NULL) + { + item = program->mStreams.mHead; + program->mStreams.mHead = item->mNext; + + if(item->mData != NULL) + { + stream = (TSStream *)item->mData; + free(stream); + } + + free(item); + } +} + +void ts_parser_free(TSParser * parser) +{ + // Free Programs + TSListItem *item; + TSProgram *program; + + while (parser->mPrograms.mHead != NULL) + { + item = parser->mPrograms.mHead; + parser->mPrograms.mHead = item->mNext; + + if (item->mData != NULL) + { + program = (TSProgram *)item->mData; + ts_parser_free_program(program); + free(program); + } + + free(item); + } + + sys_os_destroy_sig_mutex(parser->mMutex); +} + + + + diff --git a/MediaClient/MediaClient/rtp/ts_parser.h b/MediaClient/MediaClient/rtp/ts_parser.h new file mode 100644 index 0000000..90bef41 --- /dev/null +++ b/MediaClient/MediaClient/rtp/ts_parser.h @@ -0,0 +1,100 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef TS_PARSER_H +#define TS_PARSER_H + +#include "sys_inc.h" + +#define TS_PACKET_SIZE 188 +#define TS_SYNC 0x47 +#define TS_DISCONTINUITY 0x0 + +#define TS_PAT_TID 0x00 +#define TS_PMT_TID 0x02 + +#define TS_STREAM_VIDEO 0x1b +#define TS_STREAM_AUDIO 0x0f + +#define TS_AUDIO_AAC 0x0f +#define TS_AUDIO_AAC_LATM 0x11 +#define TS_VIDEO_MPEG4 0x10 +#define TS_VIDEO_H264 0x1b +#define TS_VIDEO_HEVC 0x24 + +typedef void (*payload_cb)(uint8 *, uint32, uint32, uint64, void *); + +typedef struct _TSListItem +{ + void *mData; + struct _TSListItem *mNext; +} TSListItem; + +typedef struct _TSList +{ + TSListItem *mHead; + TSListItem *mTail; +} TSList; + +typedef struct +{ + uint32 mProgramMapPID; + uint64 mFirstPTS; + int mFirstPTSValid; + + TSList mStreams; +} TSProgram; + +typedef struct +{ + TSProgram *mProgram; + + uint32 mElementaryPID; + uint32 mStreamType; + uint32 mPayloadStarted; + + char mBuffer[2*1024*1024]; + int mBufferSize; +} TSStream; + +typedef struct +{ + TSList mPrograms; + payload_cb mCallback; + void *mUserdata; + void *mMutex; +} TSParser; + +#ifdef __cplusplus +extern "C" { +#endif + +BOOL ts_parser_init(TSParser * parser); +void ts_parser_set_cb(TSParser * parser, payload_cb cb, void * userdata); +BOOL ts_parser_parse(TSParser * parser, uint8 * data, int size); +BOOL ts_parser_parse_packet(TSParser * parser, uint8 * data, int size); +void ts_parser_free(TSParser * parser); + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/MediaClient/MediaClient/rtsp/rtsp_backchannel.cpp b/MediaClient/MediaClient/rtsp/rtsp_backchannel.cpp new file mode 100644 index 0000000..b49660a --- /dev/null +++ b/MediaClient/MediaClient/rtsp/rtsp_backchannel.cpp @@ -0,0 +1,337 @@ +/*************************************************************************************** + * + * 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 "rtsp_backchannel.h" +#include "rtsp_rcua.h" +#include "rtp.h" +#include "rtsp_util.h" +#include "base64.h" +#include "http_cln.h" +#include "media_format.h" +#ifdef OVER_WEBSOCKET +#include "rtsp_ws.h" +#endif + +#ifdef BACKCHANNEL + +/***************************************************************************************/ + +/** + * Send rtp data by TCP socket + * + * @param p_rua rtsp user agent + * @param p_data rtp data + * @param len rtp data len + * @return -1 on error, or the data length has been sent + */ +int rtp_tcp_tx(RCUA * p_rua, uint8 * p_data, int len) +{ + int offset = 0; + SOCKET fd; + int buflen; + char * p_buff; + +#ifdef OVER_HTTP + if (p_rua->over_http) + { + fd = p_rua->rtsp_send.cfd; + } + else +#endif +#ifdef OVER_WEBSOCKET + if (p_rua->over_ws) + { + fd = p_rua->ws_http.cfd; + } + else +#endif + fd = p_rua->fd; + + if (fd <= 0) + { + return -1; + } + +#ifdef OVER_HTTP + if (p_rua->over_http) + { + char * tx_buf_base64 = (char *)malloc(2 * len); + if (NULL == tx_buf_base64) + { + return -1; + } + + if (0 == base64_encode(p_data, len, tx_buf_base64, 2 * len)) + { + free(tx_buf_base64); + return -1; + } + + p_buff = tx_buf_base64; + buflen = strlen(tx_buf_base64); + } + else +#endif +#ifdef OVER_WEBSOCKET + if (p_rua->over_ws) + { + int extra = rtsp_ws_encode_data(p_data, len, 0x82, 1); + + p_buff = (char *)(p_data - extra); + buflen = len + extra; + } + else +#endif + { + p_buff = (char *)p_data; + buflen = len; + } + + while (offset < buflen) + { + int tlen; + +#ifdef OVER_HTTP + if (p_rua->over_http) + { + tlen = http_cln_tx(&p_rua->rtsp_send, p_buff+offset, buflen-offset); + } + else +#endif +#ifdef OVER_WEBSOCKET + if (p_rua->over_ws) + { + tlen = http_cln_tx(&p_rua->ws_http, p_buff+offset, buflen-offset); + } + else +#endif + tlen = send(fd, (const char *)p_buff+offset, buflen-offset, 0); + if (tlen > 0) + { + offset += tlen; + } + else + { + int sockerr = sys_os_get_socket_error_num(); + if (sockerr == EINTR || sockerr == EAGAIN) + { + usleep(1000); + continue; + } + + log_print(HT_LOG_ERR, "%s, send failed, fd[%d], tlen[%d,%d], err[%d][%s]!!!\r\n", + __FUNCTION__, fd, tlen, buflen-offset, sockerr, sys_os_get_socket_error()); + break; + } + } + +#ifdef OVER_HTTP + if (p_rua->over_http) + { + free(p_buff); + } +#endif + + return (offset == buflen) ? len : -1; +} + + +int rtp_udp_tx(RCUA * p_rua, int av_t, uint8 * p_data, int len) +{ + int slen; + SOCKET fd = 0; + struct sockaddr_in addr; + addr.sin_family = AF_INET; + addr.sin_addr.s_addr = inet_addr(p_rua->ripstr); + + if (AV_TYPE_BACKCHANNEL == av_t) + { + addr.sin_port = htons(p_rua->channels[av_t].r_port); + fd = p_rua->channels[av_t].udp_fd; + + if (p_rua->rtp_mcast) + { + addr.sin_addr.s_addr = inet_addr(p_rua->channels[av_t].destination); + } + } + + if (fd <= 0) + { + return -1; + } + + slen = sendto(fd, (char *)p_data, len, 0, (struct sockaddr *)&addr, sizeof(struct sockaddr_in)); + if (slen != len) + { + log_print(HT_LOG_ERR, "%s, slen = %d, len = %d, ip=0x%08x\r\n", __FUNCTION__, slen, len, p_rua->ripstr); + } + + return slen; +} + + +/** + * Build audio rtp packet and send + * + * @param p_rua rtsp user agent + * @param p_data payload data + * @param len payload data length + * @ts the packet timestamp + * @return the rtp packet length, -1 on error + */ +int rtp_audio_build(RCUA * p_rua, uint8 * p_data, int len, uint32 ts, int mbit) +{ + int offset = 0; + int slen = 0; + uint8 * p_rtp_ptr = p_data - 12; // shift forward RTP head + + if (p_rua->rtp_tcp) + { + p_rtp_ptr -= 4; + + *(p_rtp_ptr+offset) = 0x24; // magic + offset++; + + *(p_rtp_ptr+offset) = p_rua->channels[AV_BACK_CH].interleaved; // channel + offset++; + + offset += rtp_write_uint16(p_rtp_ptr+offset, 12 + len); // rtp payload length + } + + *(p_rtp_ptr+offset) = (RTP_VERSION << 6); + offset++; + + *(p_rtp_ptr+offset) = (p_rua->bc_rtp_info.rtp_pt) | ((mbit & 0x01) << 7); + offset++; + + offset += rtp_write_uint16(p_rtp_ptr+offset, p_rua->bc_rtp_info.rtp_cnt); + + offset += rtp_write_uint32(p_rtp_ptr+offset, p_rua->bc_rtp_info.rtp_ts); + + offset += rtp_write_uint32(p_rtp_ptr+offset, p_rua->bc_rtp_info.rtp_ssrc); + + if (p_rua->rtp_tcp) + { + slen = rtp_tcp_tx(p_rua, p_rtp_ptr, offset+len); + } + else + { + slen = rtp_udp_tx(p_rua, AV_TYPE_BACKCHANNEL, p_rtp_ptr, offset+len); + } + + p_rua->bc_rtp_info.rtp_cnt = (p_rua->bc_rtp_info.rtp_cnt + 1) & 0xFFFF; + + return (slen == offset+len) ? slen : -1; +} + +/** + * Build audio rtp packet and send (not fragment) + * + * @param p_rua rtsp user agent + * @param p_data payload data + * @param len payload data length + * @ts the packet timestamp + * @return the rtp packet length, -1 on error + */ +int rtp_audio_tx(RCUA * p_rua, uint8 * p_data, int size, uint32 ts) +{ + return rtp_audio_build(p_rua, p_data, size, ts, 1); +} + +int rtp_aac_audio_tx(RCUA * p_rua, uint8 * p_data, int size, uint32 ts) +{ + int ret = 0; + int len, max_packet_size, au_size; + uint8 *p; + + max_packet_size = RTP_MAX_LEN; + + if (p_data[0] == 0xFF && (p_data[1] & 0xF0) == 0xF0) + { + // skip ADTS header + p_data += 7; + size -= 7; + } + + p = p_data - 4; + au_size = size; + + while (size > 0) + { + len = MIN(size, max_packet_size); + + rtp_write_uint16(p, 2 * 8); + rtp_write_uint16(&p[2], au_size * 8); + + ret = rtp_audio_build(p_rua, p, len + 4, ts, len == size); + if (ret < 0) + { + break; + } + + size -= len; + p += len; + } + + return ret; +} + +void rtsp_bc_cb(uint8 *data, int size, int nbsamples, void *pUserdata) +{ + RCUA * p_rua = (RCUA *)pUserdata; + + if (p_rua->send_bc_data) + { + uint8 * p_buf = NULL; + + p_buf = (uint8 *)malloc(size + 40); + if (p_buf == NULL) + { + log_print(HT_LOG_ERR, "%s, malloc failed!!!\r\n", __FUNCTION__); + return; + } + + uint8 * p_tbuf = p_buf + 40; // shift forword header + + memcpy(p_tbuf, data, size); + + if (AUDIO_CODEC_AAC == p_rua->bc_audio_codec) + { + rtp_aac_audio_tx(p_rua, p_tbuf, size, rtsp_get_timestamp(nbsamples)); + } + else + { + rtp_audio_tx(p_rua, p_tbuf, size, rtsp_get_timestamp(nbsamples)); + } + + free(p_buf); + } +} + +#else + +void rtsp_bc_cb(uint8 *data, int size, int nbsamples, void *pUserdata) +{ +} + +#endif // BACKCHANNEL + + + diff --git a/MediaClient/MediaClient/rtsp/rtsp_backchannel.h b/MediaClient/MediaClient/rtsp/rtsp_backchannel.h new file mode 100644 index 0000000..3ff4b24 --- /dev/null +++ b/MediaClient/MediaClient/rtsp/rtsp_backchannel.h @@ -0,0 +1,37 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef RTSP_BACKCHANNEL_H +#define RTSP_BACKCHANNEL_H + + +#ifdef __cplusplus +extern "C" { +#endif + +void rtsp_bc_cb(uint8 * data, int size, int nbsamples, void * pUserdata); + +#ifdef __cplusplus +} +#endif + +#endif + + + diff --git a/MediaClient/MediaClient/rtsp/rtsp_cln.cpp b/MediaClient/MediaClient/rtsp/rtsp_cln.cpp new file mode 100644 index 0000000..553e266 --- /dev/null +++ b/MediaClient/MediaClient/rtsp/rtsp_cln.cpp @@ -0,0 +1,3598 @@ +/*************************************************************************************** + * + * 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 "rtp.h" +#include "rtsp_cln.h" +#include "mpeg4.h" +#include "mpeg4_rtp_rx.h" +#include "base64.h" +#include "rtsp_util.h" + +#ifdef BACKCHANNEL +#include "rtsp_backchannel.h" +#if __WINDOWS_OS__ +#include "audio_capture_win.h" +#elif defined(ANDROID) +#include "audio_capture_android.h" +#elif defined(IOS) +#include "audio_capture_mac.h" +#elif __LINUX_OS__ +#include "audio_capture_linux.h" +#endif +#endif + +#if defined(OVER_HTTP) || defined(OVER_WEBSOCKET) +#include "http_parse.h" +#include "http_cln.h" +#endif + +/***************************************************************************************/ +void * rtsp_tcp_rx_thread(void * argv) +{ + CRtspClient * pRtsp = (CRtspClient *)argv; + + pRtsp->tcp_rx_thread(); + + return NULL; +} + +void * rtsp_udp_rx_thread(void * argv) +{ + CRtspClient * pRtsp = (CRtspClient *)argv; + + pRtsp->udp_rx_thread(); + + return NULL; +} + +int video_data_cb(uint8 * p_data, int len, uint32 ts, uint32 seq, void * p_userdata) +{ + CRtspClient * pthis = (CRtspClient *)p_userdata; + + pthis->rtsp_video_data_cb(p_data, len, ts, seq); + + return 0; +} + +int audio_data_cb(uint8 * p_data, int len, uint32 ts, uint32 seq, void * p_userdata) +{ + CRtspClient * pthis = (CRtspClient *)p_userdata; + + pthis->rtsp_audio_data_cb(p_data, len, ts, seq); + + return 0; +} + +int metadata_data_cb(uint8 * p_data, int len, uint32 ts, uint32 seq, void * p_userdata) +{ + CRtspClient * pthis = (CRtspClient *)p_userdata; + + pthis->rtsp_meta_data_cb(p_data, len, ts, seq); + + return 0; +} + +/***************************************************************************************/ +CRtspClient::CRtspClient(void) +{ + m_pNotify = NULL; + m_pUserdata = NULL; + m_pVideoCB = NULL; + m_pAudioCB = NULL; + m_pRtcpCB = NULL; +#ifdef METADATA + m_pMetadataCB = NULL; +#endif + m_pMutex = sys_os_create_mutex(); + + m_bRunning = TRUE; + m_tcpRxTid = 0; + m_udpRxTid = 0; + + m_nRxTimeout = 10; // Data receiving timeout, default 10s timeout + m_nConnTimeout = 5; // Connect timeout, default 5s timeout + +#ifdef EPOLL + m_ep_event_num = AV_MAX_CHS * 2 + 2; + + m_ep_fd = epoll_create(m_ep_event_num); + if (m_ep_fd < 0) + { + log_print(HT_LOG_ERR, "%s, epoll_create failed\r\n", __FUNCTION__); + } + + m_ep_events = (struct epoll_event *)malloc(sizeof(struct epoll_event) * m_ep_event_num); + if (m_ep_events == NULL) + { + log_print(HT_LOG_ERR, "%s, malloc failed\r\n", __FUNCTION__); + } +#endif + + memset(&h265rxi, 0, sizeof(H265RXI)); + memset(&aacrxi, 0, sizeof(AACRXI)); + memset(&metadatarxi, 0, sizeof(PCMRXI)); + + set_default(); +} + +CRtspClient::~CRtspClient(void) +{ + rtsp_close(); + +#ifdef EPOLL + if (m_ep_fd) + { + close(m_ep_fd); + m_ep_fd = 0; + } + + if (m_ep_events) + { + free(m_ep_events); + m_ep_events = NULL; + } +#endif + + if (m_pMutex) + { + sys_os_destroy_sig_mutex(m_pMutex); + m_pMutex = NULL; + } +} + +void CRtspClient::set_default() +{ + memset(&m_rua, 0, sizeof(RCUA)); + memset(&m_url, 0, sizeof(m_url)); + memset(&m_ip, 0, sizeof(m_ip)); + memset(&m_suffix, 0, sizeof(m_suffix)); + + m_nWidth = m_nHeight = 0; + m_nport = 554; + m_rua.rtp_tcp = 1; // default RTP over RTSP + m_rua.session_timeout = 60; + strcpy(m_rua.user_agent, "happytimesoft rtsp client"); + m_rua.video_init_ts = -1; + m_rua.audio_init_ts = -1; + + m_rua.audio_spec = NULL; + m_rua.audio_spec_len = 0; + + m_rua.video_codec = VIDEO_CODEC_NONE; + m_rua.audio_codec = AUDIO_CODEC_NONE; + m_rua.sample_rate = 8000; + m_rua.audio_channels = 1; + m_rua.bit_per_sample = 0; + +#ifdef BACKCHANNEL + m_rua.bc_audio_codec = AUDIO_CODEC_NONE; + m_rua.bc_sample_rate = 0; + m_rua.bc_channels = 0; + m_rua.bc_bit_per_sample = 0; +#endif +} + +BOOL CRtspClient::rtsp_client_start() +{ + int len; + int timeout = m_nConnTimeout*1000; + RCUA * p_rua = &m_rua; + + p_rua->fd = tcp_connect_timeout(get_address_by_name(p_rua->ripstr), p_rua->rport, timeout); + if (p_rua->fd <= 0) + { + log_print(HT_LOG_ERR, "%s, %s:%d connect fail!!!\r\n", + __FUNCTION__, p_rua->ripstr, p_rua->rport); + return FALSE; + } + + len = 1024*1024; + + if (setsockopt(p_rua->fd, SOL_SOCKET, SO_RCVBUF, (char*)&len, sizeof(int))) + { + log_print(HT_LOG_WARN, "%s, setsockopt SO_RCVBUF error!\n", __FUNCTION__); + } + + m_rua.cseq = 1; + m_rua.state = RCS_OPTIONS; + + HRTSP_MSG * tx_msg = rcua_build_options(&m_rua); + if (tx_msg) + { + rcua_send_free_rtsp_msg(&m_rua, tx_msg); + } + + return TRUE; +} + +void CRtspClient::rtsp_send_h264_params(RCUA * p_rua) +{ + int pt; + char sps[1000], pps[1000] = {'\0'}; + + if (!rcua_get_sdp_h264_params(p_rua, &pt, sps, sizeof(sps))) + { + return; + } + + char * ptr = strchr(sps, ','); + if (ptr && ptr[1] != '\0') + { + *ptr = '\0'; + strcpy(pps, ptr+1); + } + + uint8 sps_pps[1000]; + sps_pps[0] = 0x0; + sps_pps[1] = 0x0; + sps_pps[2] = 0x0; + sps_pps[3] = 0x1; + + int len = base64_decode(sps, strlen(sps), sps_pps+4, sizeof(sps_pps)-4); + if (len <= 0) + { + return; + } + + sys_os_mutex_enter(m_pMutex); + + if (m_pVideoCB) + { + m_pVideoCB(sps_pps, len+4, 0, 0, m_pUserdata); + } + + if (pps[0] != '\0') + { + len = base64_decode(pps, strlen(pps), sps_pps+4, sizeof(sps_pps)-4); + if (len > 0) + { + if (m_pVideoCB) + { + m_pVideoCB(sps_pps, len+4, 0, 0, m_pUserdata); + } + } + } + + sys_os_mutex_leave(m_pMutex); +} + +void CRtspClient::rtsp_send_h265_params(RCUA * p_rua) +{ + int pt; + char vps[512] = {'\0'}, sps[512] = {'\0'}, pps[512] = {'\0'}; + + if (!rcua_get_sdp_h265_params(p_rua, &pt, &h265rxi.rxf_don, vps, sizeof(vps)-1, sps, sizeof(sps)-1, pps, sizeof(pps)-1)) + { + return; + } + + uint8 buff[1024]; + buff[0] = 0x0; + buff[1] = 0x0; + buff[2] = 0x0; + buff[3] = 0x1; + + sys_os_mutex_enter(m_pMutex); + + if (vps[0] != '\0') + { + int len = base64_decode(vps, strlen(vps), buff+4, sizeof(buff)-4); + if (len <= 0) + { + sys_os_mutex_leave(m_pMutex); + return; + } + + if (m_pVideoCB) + { + m_pVideoCB(buff, len+4, 0, 0, m_pUserdata); + } + } + + if (sps[0] != '\0') + { + int len = base64_decode(sps, strlen(sps), buff+4, sizeof(buff)-4); + if (len <= 0) + { + sys_os_mutex_leave(m_pMutex); + return; + } + + if (m_pVideoCB) + { + m_pVideoCB(buff, len+4, 0, 0, m_pUserdata); + } + } + + if (pps[0] != '\0') + { + int len = base64_decode(pps, strlen(pps), buff+4, sizeof(buff)-4); + if (len <= 0) + { + sys_os_mutex_leave(m_pMutex); + return; + } + + if (m_pVideoCB) + { + m_pVideoCB(buff, len+4, 0, 0, m_pUserdata); + } + } + + sys_os_mutex_leave(m_pMutex); +} + +void CRtspClient::rtsp_get_mpeg4_config(RCUA * p_rua) +{ + int pt; + char config[1000]; + + if (!rcua_get_sdp_mp4_params(p_rua, &pt, config, sizeof(config)-1)) + { + return; + } + + uint32 configLen; + uint8 * configData = mpeg4_parse_config(config, configLen); + if (configData) + { + mpeg4rxi.hdr_len = configLen; + memcpy(mpeg4rxi.p_buf, configData, configLen); + + free(configData); + } +} + +void CRtspClient::rtsp_get_aac_config(RCUA * p_rua) +{ + int pt = 0; + int sizelength = 13; + int indexlength = 3; + int indexdeltalength = 3; + char config[128]; + + if (rcua_get_sdp_aac_params(p_rua, &pt, &sizelength, &indexlength, &indexdeltalength, config, sizeof(config))) + { + m_rua.audio_spec = mpeg4_parse_config(config, m_rua.audio_spec_len); + } + + aacrxi.size_length = sizelength; + aacrxi.index_length = indexlength; + aacrxi.index_delta_length = indexdeltalength; +} + + +/*********************************************************************** +* +* Close RCUA +* +************************************************************************/ +void CRtspClient::rtsp_client_stop(RCUA * p_rua) +{ + if (p_rua->fd > 0) + { + HRTSP_MSG * tx_msg = rcua_build_teardown(p_rua); + if (tx_msg) + { + rcua_send_free_rtsp_msg(p_rua,tx_msg); + } + } +} + +BOOL CRtspClient::rtsp_setup_channel(RCUA * p_rua, int av_t) +{ + HRTSP_MSG * tx_msg = NULL; + + p_rua->state = RCS_INIT_V + av_t; + + if (p_rua->rtp_tcp) + { + p_rua->channels[av_t].interleaved = av_t * 2; + } + else if (p_rua->rtp_mcast) + { + if (p_rua->channels[av_t].r_port) + { + p_rua->channels[av_t].l_port = p_rua->channels[av_t].r_port; + } + else + { + p_rua->channels[av_t].l_port = p_rua->channels[av_t].r_port = rtsp_get_udp_port(); + } + } + else + { + p_rua->channels[av_t].l_port = rtsp_get_udp_port(); + + p_rua->channels[av_t].udp_fd = rcua_init_udp_connection(p_rua->channels[av_t].l_port); + if (p_rua->channels[av_t].udp_fd <= 0) + { + return FALSE; + } + + p_rua->channels[av_t].rtcp_fd = rcua_init_udp_connection(p_rua->channels[av_t].l_port+1); + if (p_rua->channels[av_t].rtcp_fd <= 0) + { + log_print(HT_LOG_WARN, "%s, init rtcp udp connection failed\r\n", __FUNCTION__); + } + +#ifdef EPOLL + struct epoll_event event; + event.events = EPOLLIN; + event.data.u64 = m_rua.channels[av_t].udp_fd; + epoll_ctl(m_ep_fd, EPOLL_CTL_ADD, m_rua.channels[av_t].udp_fd, &event); + + if (m_rua.channels[av_t].rtcp_fd > 0) + { + event.events = EPOLLIN; + event.data.u64 = m_rua.channels[av_t].rtcp_fd; + epoll_ctl(m_ep_fd, EPOLL_CTL_ADD, m_rua.channels[av_t].rtcp_fd, &event); + } +#endif + } + + tx_msg = rcua_build_setup(p_rua, av_t); + if (tx_msg) + { + rcua_send_free_rtsp_msg(p_rua, tx_msg); + } + + return TRUE; +} + +BOOL CRtspClient::rtsp_get_transport_info(RCUA * p_rua, HRTSP_MSG * rx_msg, int av_t) +{ + BOOL ret = FALSE; + + if (p_rua->rtp_tcp) + { + ret = rtsp_get_tcp_transport_info(rx_msg, &p_rua->channels[av_t].interleaved); + } + else if (p_rua->rtp_mcast) + { + ret = rtsp_get_mc_transport_info(rx_msg, p_rua->channels[av_t].destination, &p_rua->channels[av_t].r_port); + } + else + { + ret = rtsp_get_udp_transport_info(rx_msg, &p_rua->channels[av_t].l_port, &p_rua->channels[av_t].r_port); + } + + return ret; +} + +BOOL CRtspClient::rtsp_unauth_res(RCUA * p_rua, HRTSP_MSG * rx_msg) +{ + HRTSP_MSG * tx_msg = NULL; + + if (!p_rua->need_auth || p_rua->auth_retry < 3) + { + p_rua->need_auth = TRUE; + + if (rtsp_get_digest_info(rx_msg, &p_rua->auth_info)) + { + p_rua->auth_mode = 1; + snprintf(p_rua->auth_info.auth_uri, sizeof(p_rua->auth_info.auth_uri), "%s", p_rua->uri); + } + else + { + p_rua->auth_mode = 0; + } + + p_rua->cseq++; + p_rua->auth_retry++; + + switch (p_rua->state) + { + case RCS_OPTIONS: + tx_msg = rcua_build_options(p_rua); + break; + + case RCS_DESCRIBE: + tx_msg = rcua_build_describe(p_rua); + break; + + case RCS_INIT_V: + tx_msg = rcua_build_setup(p_rua, AV_TYPE_VIDEO); + break; + + case RCS_INIT_A: + tx_msg = rcua_build_setup(p_rua, AV_TYPE_AUDIO); + break; + +#ifdef METADATA + case RCS_INIT_M: + tx_msg = rcua_build_setup(p_rua, AV_TYPE_METADATA); + break; +#endif + +#ifdef BACKCHANNEL + case RCS_INIT_BC: + tx_msg = rcua_build_setup(p_rua, AV_TYPE_BACKCHANNEL); + break; +#endif + + case RCS_READY: + tx_msg = rcua_build_play(p_rua); + break; + } + + if (tx_msg) + { + rcua_send_free_rtsp_msg(p_rua, tx_msg); + } + else + { + return FALSE; + } + } + else + { + send_notify(RTSP_EVE_AUTHFAILED); + return FALSE; + } + + return TRUE; +} + +BOOL CRtspClient::rtsp_options_res(RCUA * p_rua, HRTSP_MSG * rx_msg) +{ + HRTSP_MSG * tx_msg = NULL; + + if (rx_msg->msg_sub_type == 200) + { + // get supported command list + p_rua->gp_cmd = rtsp_is_line_exist(rx_msg, "Public", "GET_PARAMETER"); + + p_rua->cseq++; + p_rua->state = RCS_DESCRIBE; + + tx_msg = rcua_build_describe(p_rua); + if (tx_msg) + { + rcua_send_free_rtsp_msg(p_rua, tx_msg); + } + } + else + { + return FALSE; + } + + return TRUE; +} + +BOOL CRtspClient::rtsp_describe_res(RCUA * p_rua, HRTSP_MSG * rx_msg) +{ + if (rx_msg->msg_sub_type == 200) + { + char cseq_buf[32]; + char cbase[256]; + + // Session + rtsp_get_session_info(rx_msg, p_rua->sid, sizeof(p_rua->sid)-1, &p_rua->session_timeout); + + rtsp_get_msg_cseq(rx_msg, cseq_buf, sizeof(cseq_buf)-1); + + // Content-Base + if (rtsp_get_cbase_info(rx_msg, cbase, sizeof(cbase)-1)) + { + strncpy(p_rua->uri, cbase, sizeof(p_rua->uri)-1); + } + + rtsp_get_sdp_range(rx_msg, &p_rua->play_start, &p_rua->play_end); + + rtsp_find_sdp_control(rx_msg, p_rua->channels[AV_VIDEO_CH].ctl, "video", sizeof(p_rua->channels[AV_VIDEO_CH].ctl)-1); + +#ifdef BACKCHANNEL + if (p_rua->backchannel) + { + p_rua->backchannel = rtsp_find_sdp_control(rx_msg, p_rua->channels[AV_BACK_CH].ctl, "audio", sizeof(p_rua->channels[AV_BACK_CH].ctl)-1, "sendonly"); + if (p_rua->backchannel) + { + rtsp_find_sdp_control(rx_msg, p_rua->channels[AV_AUDIO_CH].ctl, "audio", sizeof(p_rua->channels[AV_AUDIO_CH].ctl)-1, "recvonly"); + } + else + { + rtsp_find_sdp_control(rx_msg, p_rua->channels[AV_AUDIO_CH].ctl, "audio", sizeof(p_rua->channels[AV_AUDIO_CH].ctl)-1); + } + } + else + { + rtsp_find_sdp_control(rx_msg, p_rua->channels[AV_AUDIO_CH].ctl, "audio", sizeof(p_rua->channels[AV_AUDIO_CH].ctl)-1); + } +#else + rtsp_find_sdp_control(rx_msg, p_rua->channels[AV_AUDIO_CH].ctl, "audio", sizeof(p_rua->channels[AV_AUDIO_CH].ctl)-1); +#endif + +#ifdef METADATA + rtsp_find_sdp_control(rx_msg, p_rua->channels[AV_METADATA_CH].ctl, "application", sizeof(p_rua->channels[AV_METADATA_CH].ctl)-1); +#endif + + if (rcua_get_media_info(p_rua, rx_msg)) + { + rtsp_get_video_media_info(); + rtsp_get_audio_media_info(); + + if (VIDEO_CODEC_JPEG == m_rua.video_codec) + { + // Try to obtain the video size from the SDP based on a=x-dimensions + rtsp_get_video_size(&m_nWidth, &m_nHeight); + } + +#ifdef BACKCHANNEL + if (p_rua->backchannel) + { + rtsp_get_bc_media_info(); + } +#endif + } + + if (p_rua->mcast_flag) + { + p_rua->rtp_mcast = rtsp_is_support_mcast(rx_msg); + } + + p_rua->cseq++; + + for (int i = 0; i < AV_MAX_CHS; i++) + { + if (p_rua->channels[i].ctl[0] != '\0' && !p_rua->channels[i].disabled) + { + return rtsp_setup_channel(p_rua, i); + } + } + + return FALSE; + } +#ifdef BACKCHANNEL + else if (p_rua->backchannel) // the server don't support backchannel + { + p_rua->backchannel = 0; + + p_rua->cseq++; + p_rua->state = RCS_DESCRIBE; + + HRTSP_MSG * tx_msg = rcua_build_describe(p_rua); + if (tx_msg) + { + rcua_send_free_rtsp_msg(p_rua, tx_msg); + } + } +#endif + else + { + return FALSE; + } + + return TRUE; +} + +BOOL CRtspClient::rtsp_setup_res(RCUA * p_rua, HRTSP_MSG * rx_msg, int av_t) +{ + if (rx_msg->msg_sub_type == 200) + { + int i; + char cbase[256]; + HRTSP_MSG * tx_msg = NULL; + + // Content-Base + if (rtsp_get_cbase_info(rx_msg, cbase, sizeof(cbase)-1)) + { + strncpy(p_rua->uri, cbase, sizeof(p_rua->uri)-1); + snprintf(p_rua->auth_info.auth_uri, sizeof(p_rua->auth_info.auth_uri), "%s", p_rua->uri); + } + + // Session + if (p_rua->sid[0] == '\0') + { + rtsp_get_session_info(rx_msg, p_rua->sid, sizeof(p_rua->sid)-1, &p_rua->session_timeout); + } + + if (!rtsp_get_transport_info(p_rua, rx_msg, av_t)) + { + return FALSE; + } + + if (p_rua->rtp_mcast) + { + p_rua->channels[av_t].l_port = p_rua->channels[av_t].r_port; + + p_rua->channels[av_t].udp_fd = rcua_init_mc_connection(p_rua->channels[av_t].l_port, p_rua->channels[av_t].destination); + if (p_rua->channels[av_t].udp_fd <= 0) + { + return FALSE; + } + + p_rua->channels[av_t].rtcp_fd = rcua_init_mc_connection(p_rua->channels[av_t].l_port+1, p_rua->channels[av_t].destination); + if (p_rua->channels[av_t].rtcp_fd <= 0) + { + log_print(HT_LOG_WARN, "%s, init rtcp multicast connection failed\r\n", __FUNCTION__); + } + } + + if (p_rua->sid[0] == '\0') + { + snprintf(p_rua->sid, sizeof(p_rua->sid), "%x%x", rand(), rand()); + } + + p_rua->channels[av_t].setup = 1; + p_rua->cseq++; + + for (i = av_t+1; i < AV_MAX_CHS; i++) + { + if (p_rua->channels[i].ctl[0] != '\0' && !p_rua->channels[i].disabled) + { + return rtsp_setup_channel(p_rua, i); + } + } + +#ifdef BACKCHANNEL + if (AV_BACK_CH == av_t) + { + p_rua->bc_rtp_info.rtp_cnt = rand() & 0xFFFF; + p_rua->bc_rtp_info.rtp_pt = p_rua->channels[AV_BACK_CH].cap[0]; + p_rua->bc_rtp_info.rtp_ssrc = rand(); + } +#endif + + if (make_prepare_play() == FALSE) + { + return FALSE; + } + + p_rua->state = RCS_READY; + + tx_msg = rcua_build_play(p_rua); + if (tx_msg) + { + rcua_send_free_rtsp_msg(p_rua,tx_msg); + } + } + else if (p_rua->rtp_tcp) // maybe the server don't support rtp over tcp, try rtp over udp + { + p_rua->rtp_tcp = 0; + + p_rua->cseq++; + + if (!rtsp_setup_channel(p_rua, av_t)) + { + return FALSE; + } + } + else + { + return FALSE; + } + + return TRUE; +} + +BOOL CRtspClient::rtsp_play_res(RCUA * p_rua, HRTSP_MSG * rx_msg) +{ + if (rx_msg->msg_sub_type == 200) + { + // Session + rtsp_get_session_info(rx_msg, p_rua->sid, sizeof(p_rua->sid)-1, &p_rua->session_timeout); + + rtsp_get_rtp_info(rx_msg, p_rua->channels[AV_VIDEO_CH].ctl, &p_rua->video_init_ts, + p_rua->channels[AV_AUDIO_CH].ctl, &p_rua->audio_init_ts); + + if (p_rua->seek_pos > 0) + { + p_rua->media_start = p_rua->seek_pos; + p_rua->seek_pos = 0; + } + + if (p_rua->state == RCS_PLAYING) + { + return TRUE; + } + + p_rua->state = RCS_PLAYING; + p_rua->keepalive_time = sys_os_get_uptime(); + + if (m_rua.audio_codec == AUDIO_CODEC_AAC) + { + rtsp_get_aac_config(p_rua); + } + + send_notify(RTSP_EVE_CONNSUCC); + + if (m_rua.video_codec == VIDEO_CODEC_H264) + { + rtsp_send_h264_params(p_rua); + } + else if (m_rua.video_codec == VIDEO_CODEC_MP4) + { + rtsp_get_mpeg4_config(p_rua); + } + else if (m_rua.video_codec == VIDEO_CODEC_H265) + { + rtsp_send_h265_params(p_rua); + } + +#ifdef BACKCHANNEL + if (p_rua->backchannel) + { + rtsp_init_backchannel(p_rua); + } +#endif + } + else + { + //error handle + return FALSE; + } + + return TRUE; +} + +#ifdef METADATA + +void CRtspClient::set_metadata_cb(metadata_cb cb) +{ + sys_os_mutex_enter(m_pMutex); + m_pMetadataCB = cb; + sys_os_mutex_leave(m_pMutex); +} + +#endif // METADATA + +#ifdef BACKCHANNEL + +int CRtspClient::get_bc_flag() +{ + return m_rua.backchannel; +} + +void CRtspClient::set_bc_flag(int flag) +{ + m_rua.backchannel = flag; +} + +int CRtspClient::get_bc_data_flag() +{ + if (m_rua.backchannel) + { + return m_rua.send_bc_data; + } + + return -1; // unsupport backchannel +} + +void CRtspClient::set_bc_data_flag(int flag) +{ + m_rua.send_bc_data = flag; +} + +void CRtspClient::set_audio_device(int index) +{ + m_rua.bc_audio_device = index; +} + +BOOL CRtspClient::rtsp_get_bc_media_info() +{ + if (m_rua.channels[AV_BACK_CH].cap_count == 0) + { + return FALSE; + } + + if (m_rua.channels[AV_BACK_CH].cap[0] == 0) + { + m_rua.bc_audio_codec = AUDIO_CODEC_G711U; + } + else if (m_rua.channels[AV_BACK_CH].cap[0] == 8) + { + m_rua.bc_audio_codec = AUDIO_CODEC_G711A; + } + else if (m_rua.channels[AV_BACK_CH].cap[0] == 9) + { + m_rua.bc_audio_codec = AUDIO_CODEC_G722; + } + + int i; + int rtpmap_len = (int)strlen("a=rtpmap:"); + + for (i=0; i= count) + { + return FALSE; + } + + p_rua->audio_captrue = CWAudioCapture::getInstance(m_rua.bc_audio_device); +#elif defined(ANDROID) + count = CAAudioCapture::getDeviceNums(); + if (m_rua.bc_audio_device >= count) + { + return FALSE; + } + + p_rua->audio_captrue = CAAudioCapture::getInstance(m_rua.bc_audio_device); +#elif defined(IOS) + count = CMAudioCapture::getDeviceNums(); + if (m_rua.bc_audio_device >= count) + { + return FALSE; + } + + p_rua->audio_captrue = CMAudioCapture::getInstance(m_rua.bc_audio_device); +#elif __LINUX_OS__ + count = CLAudioCapture::getDeviceNums(); + if (m_rua.bc_audio_device >= count) + { + return FALSE; + } + + p_rua->audio_captrue = CLAudioCapture::getInstance(m_rua.bc_audio_device); +#endif + + if (NULL == p_rua->audio_captrue) + { + return FALSE; + } + + p_rua->audio_captrue->addCallback(rtsp_bc_cb, p_rua); + p_rua->audio_captrue->initCapture(m_rua.bc_audio_codec, m_rua.bc_sample_rate, m_rua.bc_channels, m_rua.bc_bit_per_sample * 8); + + return p_rua->audio_captrue->startCapture(); +} + +#endif // BACKCHANNEL + +#ifdef REPLAY + +int CRtspClient::get_replay_flag() +{ + return m_rua.replay; +} + +void CRtspClient::set_replay_flag(int flag) +{ + m_rua.replay = flag; +} + +void CRtspClient::set_scale(double scale) +{ + if (scale != 0) + { + m_rua.scale_flag = 1; + m_rua.scale = (int)(scale * 100); + } + else + { + m_rua.scale_flag = 0; + m_rua.scale = 0; + } +} + +void CRtspClient::set_rate_control_flag(int flag) +{ + m_rua.rate_control_flag = 1; + m_rua.rate_control = flag; +} + +void CRtspClient::set_immediate_flag(int flag) +{ + m_rua.immediate_flag = 1; + m_rua.immediate = flag; +} + +void CRtspClient::set_frames_flag(int flag, int interval) +{ + if (flag == 1 || flag == 2) + { + m_rua.frame_flag = 1; + m_rua.frame = flag; + } + else + { + m_rua.frame_flag = 0; + m_rua.frame = 0; + } + + if (interval > 0) + { + m_rua.frame_interval_flag = 1; + m_rua.frame_interval = interval; + } + else + { + m_rua.frame_interval_flag = 0; + m_rua.frame_interval = 0; + } +} + +void CRtspClient::set_replay_range(time_t start, time_t end) +{ + m_rua.range_flag = 1; + m_rua.replay_start = start; + m_rua.replay_end = end; +} + +#endif // REPLAY + +#ifdef OVER_HTTP + +void CRtspClient::set_rtsp_over_http(int flag, int port) +{ + if (flag) + { + m_rua.mcast_flag = 0; + m_rua.rtp_tcp = 1; + } + + m_rua.over_http = flag; + + if (port > 0 && port <= 65535) + { + m_rua.http_port = port; + } +} + +int CRtspClient::rtsp_build_http_get_req(void * p_user, char * bufs, int buflen, char * cookie) +{ + int offset = 0; + HTTPREQ * p_req = (HTTPREQ *) p_user; + + offset += snprintf(bufs+offset, buflen-offset, "GET %s HTTP/1.1\r\n", p_req->url); + offset += snprintf(bufs+offset, buflen-offset, "Host: %s:%u\r\n", p_req->host, p_req->port); + offset += snprintf(bufs+offset, buflen-offset, "User-Agent: Happytimesoft rtsp client\r\n"); + offset += snprintf(bufs+offset, buflen-offset, "x-sessioncookie: %s\r\n", cookie); + offset += snprintf(bufs+offset, buflen-offset, "Accept: application/x-rtsp-tunnelled\r\n"); + offset += snprintf(bufs+offset, buflen-offset, "Pragma: no-cache\r\n"); + offset += snprintf(bufs+offset, buflen-offset, "Cache-Control: no-cache\r\n"); + + if (p_req->need_auth) + { + offset += http_build_auth_msg(p_req, "GET", bufs+offset, buflen-offset); + } + + offset += snprintf(bufs+offset, buflen-offset, "\r\n"); + + log_print(HT_LOG_DBG, "TX >> %s\r\n\r\n", bufs); + + return offset; +} + +int CRtspClient::rtsp_build_http_post_req(void * p_user, char * bufs, int buflen, char * cookie) +{ + int offset = 0; + HTTPREQ * p_req = (HTTPREQ *) p_user; + + offset += snprintf(bufs+offset, buflen-offset, "POST %s HTTP/1.1\r\n", p_req->url); + offset += snprintf(bufs+offset, buflen-offset, "Host: %s:%u\r\n", p_req->host, p_req->port); + offset += snprintf(bufs+offset, buflen-offset, "User-Agent: ANS rtsp client\r\n"); + offset += snprintf(bufs+offset, buflen-offset, "x-sessioncookie: %s\r\n", cookie); + offset += snprintf(bufs+offset, buflen-offset, "Content-Type: application/x-rtsp-tunnelled\r\n"); + offset += snprintf(bufs+offset, buflen-offset, "Pragma: no-cache\r\n"); + offset += snprintf(bufs+offset, buflen-offset, "Cache-Control: no-cache\r\n"); + offset += snprintf(bufs+offset, buflen-offset, "Content-Length: 32767\r\n"); + + if (p_req->need_auth) + { + offset += http_build_auth_msg(p_req, "POST", bufs+offset, buflen-offset); + } + + offset += snprintf(bufs+offset, buflen-offset, "\r\n"); + + log_print(HT_LOG_DBG, "TX >> %s\r\n\r\n", bufs); + + return offset; +} + +BOOL CRtspClient::rtsp_over_http_start() +{ + int len; + int offset = 0; + int timeout = m_nConnTimeout*1000; + char buff[2048]; + char cookie[100]; + HTTPREQ * p_http; + static int cnt = 1; + HRTSP_MSG * tx_msg; + + srand((uint32)time(NULL)+cnt++); + snprintf(cookie, sizeof(cookie), "%x%x%x", rand(), rand(), sys_os_get_ms()); + +RETRY: + + p_http = &m_rua.rtsp_recv; + + if (m_nport != 554) + { + p_http->port = m_nport; // Port from the stream address + } + else + { + p_http->port = m_rua.http_port; // Configured RTSP OVER HTTP port + } + + strcpy(p_http->host, m_ip); + strcpy(p_http->url, m_suffix); + + if (memcmp(m_url, "https://", 8) == 0) + { + p_http->https = 1; + } + + // First try the stream address port, + // If the connection fails, try to connect to the configured port + + p_http->cfd = tcp_connect_timeout(get_address_by_name(p_http->host), p_http->port, timeout); + if (p_http->cfd <= 0) + { + if (p_http->port == m_rua.http_port) + { + log_print(HT_LOG_ERR, "%s, %s:%d connect failed\r\n", + __FUNCTION__, p_http->host, p_http->port); + goto FAILED; + } + + p_http->port = m_rua.http_port; + p_http->cfd = tcp_connect_timeout(get_address_by_name(p_http->host), p_http->port, timeout); + if (p_http->cfd <= 0) + { + log_print(HT_LOG_ERR, "%s, %s:%d connect failed\r\n", + __FUNCTION__, p_http->host, p_http->port); + goto FAILED; + } + } + + len = 1024*1024; + + if (setsockopt(p_http->cfd, SOL_SOCKET, SO_RCVBUF, (char*)&len, sizeof(int))) + { + log_print(HT_LOG_WARN, "%s, setsockopt SO_RCVBUF error!\n", __FUNCTION__); + } + + if (p_http->https) + { +#ifdef HTTPS + if (!http_cln_ssl_conn(p_http, timeout)) + { + goto FAILED; + } +#else + log_print(HT_LOG_ERR, "%s, the server require ssl connection, unsupport!\r\n", __FUNCTION__); + goto FAILED; +#endif + } + + offset = rtsp_build_http_get_req(p_http, buff, sizeof(buff), cookie); + + if (http_cln_tx(p_http, buff, offset) <= 0) + { + log_print(HT_LOG_ERR, "%s, http_cln_tx failed\r\n", __FUNCTION__); + goto FAILED; + } + + if (!http_cln_rx_timeout(p_http, timeout)) + { + log_print(HT_LOG_ERR, "%s, http_cln_rx_timeout failed\r\n", __FUNCTION__); + goto FAILED; + } + + if (p_http->rx_msg->msg_sub_type == 401) + { + if (p_http->need_auth == FALSE) + { + http_cln_auth_set(p_http, m_rua.auth_info.auth_name, m_rua.auth_info.auth_pwd); + + http_cln_free_req(p_http); + + goto RETRY; + } + + send_notify(RTSP_EVE_AUTHFAILED); + goto FAILED; + } + else if (p_http->rx_msg->msg_sub_type != 200 || p_http->rx_msg->ctt_type != CTT_RTSP_TUNNELLED) + { + log_print(HT_LOG_ERR, "%s, msg_sub_type=%d, ctt_type=%d\r\n", + __FUNCTION__, p_http->rx_msg->msg_sub_type, p_http->rx_msg->ctt_type); + goto FAILED; + } + + p_http = &m_rua.rtsp_send; + + p_http->https = m_rua.rtsp_recv.https; + p_http->port = m_rua.rtsp_recv.port; + strcpy(p_http->host, m_ip); + strcpy(p_http->url, m_suffix); + + p_http->cfd = tcp_connect_timeout(get_address_by_name(p_http->host), p_http->port, timeout); + if (p_http->cfd <= 0) + { + log_print(HT_LOG_ERR, "%s, %s:%d connect failed\r\n", + __FUNCTION__, p_http->host, p_http->port); + goto FAILED; + } + +#ifdef HTTPS + if (p_http->https) + { + if (!http_cln_ssl_conn(p_http, timeout)) + { + goto FAILED; + } + } +#endif + + offset = rtsp_build_http_post_req(p_http, buff, sizeof(buff), cookie); + + if (http_cln_tx(p_http, buff, offset) <= 0) + { + log_print(HT_LOG_ERR, "%s, http_cln_tx failed\r\n", __FUNCTION__); + goto FAILED; + } + + m_rua.cseq = 1; + m_rua.rtp_tcp = 1; + m_rua.state = RCS_OPTIONS; + + tx_msg = rcua_build_options(&m_rua); + if (tx_msg) + { + rcua_send_free_rtsp_msg(&m_rua, tx_msg); + } + + return TRUE; + +FAILED: + + http_cln_free_req(&m_rua.rtsp_recv); + http_cln_free_req(&m_rua.rtsp_send); + + return FALSE; +} + +int CRtspClient::rtsp_over_http_rx(RCUA * p_rua) +{ + int rlen; + SOCKET fd = -1; +#ifdef HTTPS + int https = 0; +#endif + + fd = p_rua->rtsp_recv.cfd; + if (fd <= 0) + { + return -1; + } + +#ifdef HTTPS + if (p_rua->rtsp_recv.https && p_rua->rtsp_recv.ssl) + { + https = 1; + } + + if (https && SSL_pending(p_rua->rtsp_recv.ssl) > 0) + { + // There is data to read + } + else +#endif + { +#ifndef EPOLL + fd_set fdread; + struct timeval tv = {1, 0}; + + FD_ZERO(&fdread); + FD_SET(fd, &fdread); + + int sret = select((int)(fd+1), &fdread, NULL, NULL, &tv); + if (sret == 0) // Time expired + { + return RTSP_RX_TIMEOUT; + } + else if (!FD_ISSET(fd, &fdread)) + { + return RTSP_RX_TIMEOUT; + } +#endif + } + + if (p_rua->rtp_rcv_buf == NULL || p_rua->rtp_t_len == 0) + { +#ifdef HTTPS + if (https) + { + rlen = SSL_read(p_rua->rtsp_recv.ssl, p_rua->rcv_buf+p_rua->rcv_dlen, 2048-p_rua->rcv_dlen); + } + else +#endif + rlen = recv(fd, p_rua->rcv_buf+p_rua->rcv_dlen, 2048-p_rua->rcv_dlen, 0); + if (rlen <= 0) + { + log_print(HT_LOG_WARN, "%s, ret = %d, err = %s\r\n", + __FUNCTION__, rlen, sys_os_get_socket_error()); //recv error, connection maybe disconn? + return RTSP_RX_FAIL; + } + + p_rua->rcv_dlen += rlen; + + if (p_rua->rcv_dlen < 4) + { + return RTSP_RX_SUCC; + } + } + else + { +#ifdef HTTPS + if (https) + { + rlen = SSL_read(p_rua->rtsp_recv.ssl, p_rua->rtp_rcv_buf+p_rua->rtp_rcv_len, p_rua->rtp_t_len-p_rua->rtp_rcv_len); + } + else +#endif + rlen = recv(fd, p_rua->rtp_rcv_buf+p_rua->rtp_rcv_len, p_rua->rtp_t_len-p_rua->rtp_rcv_len, 0); + if (rlen <= 0) + { + log_print(HT_LOG_WARN, "%s, ret = %d, err = %s\r\n", + __FUNCTION__, rlen, sys_os_get_socket_error()); // recv error, connection maybe disconn? + return RTSP_RX_FAIL; + } + + p_rua->rtp_rcv_len += rlen; + + if (p_rua->rtp_rcv_len == p_rua->rtp_t_len) + { + tcp_data_rx((uint8*)p_rua->rtp_rcv_buf, p_rua->rtp_rcv_len); + + free(p_rua->rtp_rcv_buf); + p_rua->rtp_rcv_buf = NULL; + p_rua->rtp_rcv_len = 0; + p_rua->rtp_t_len = 0; + } + + return RTSP_RX_SUCC; + } + + return rtsp_tcp_data_rx(p_rua); +} + +#endif // OVER_HTTP + +#ifdef OVER_WEBSOCKET + +void CRtspClient::set_rtsp_over_ws(int flag, int port) +{ + if (flag) + { + m_rua.mcast_flag = 0; + m_rua.rtp_tcp = 1; + } + + m_rua.over_ws = flag; + + if (port > 0 && port <= 65535) + { + m_rua.ws_port = port; + } +} + +int CRtspClient::rtsp_build_ws_req(void * p_user, char * bufs, int buflen) +{ + int offset = 0; + uint8 key[20]; + char key_base64[32] = {'\0'}; + HTTPREQ * p_req = (HTTPREQ *) p_user; + + snprintf((char *)key, sizeof(key), "%08d%08x", rand(), sys_os_get_ms()); + + base64_encode(key, 16, key_base64, sizeof(key_base64)-1); + + offset += snprintf(bufs+offset, buflen-offset, "GET %s HTTP/1.1\r\n", p_req->url); + offset += snprintf(bufs+offset, buflen-offset, "Host: %s:%u\r\n", p_req->host, p_req->port); + offset += snprintf(bufs+offset, buflen-offset, "Upgrade: websocket\r\n"); + offset += snprintf(bufs+offset, buflen-offset, "Connection: Upgrade\r\n"); + offset += snprintf(bufs+offset, buflen-offset, "Sec-WebSocket-Key: %s\r\n", key_base64); + offset += snprintf(bufs+offset, buflen-offset, "Sec-WebSocket-Protocol: %s\r\n", WS_PROTOCOL); + offset += snprintf(bufs+offset, buflen-offset, "Sec-WebSocket-Version: %d\r\n", WS_VERSION); + + if (p_req->need_auth) + { + offset += http_build_auth_msg(p_req, "GET", bufs+offset, buflen-offset); + } + + offset += snprintf(bufs+offset, buflen-offset, "\r\n"); + + log_print(HT_LOG_DBG, "TX >> %s\r\n\r\n", bufs); + + return offset; +} + +BOOL CRtspClient::rtsp_over_ws_start() +{ + int len; + int offset = 0; + int timeout = m_nConnTimeout*1000; + char buff[2048]; + HTTPREQ * p_http; + HRTSP_MSG * tx_msg; + +RETRY: + + p_http = &m_rua.ws_http; + + if (m_nport != 554) + { + p_http->port = m_nport; // Port from the stream address + } + else + { + p_http->port = m_rua.ws_port; // Configured RTSP OVER websocket port + } + + strcpy(p_http->host, m_ip); + strcpy(p_http->url, m_suffix); + + if (memcmp(m_url, "wss://", 6) == 0) + { + p_http->https = 1; + } + + p_http->cfd = tcp_connect_timeout(get_address_by_name(p_http->host), p_http->port, timeout); + if (p_http->cfd <= 0) + { + if (p_http->port == m_rua.ws_port) + { + log_print(HT_LOG_ERR, "%s, %s:%d connect failed\r\n", + __FUNCTION__, p_http->host, p_http->port); + goto FAILED; + } + + p_http->port = m_rua.ws_port; + p_http->cfd = tcp_connect_timeout(get_address_by_name(p_http->host), p_http->port, timeout); + if (p_http->cfd <= 0) + { + log_print(HT_LOG_ERR, "%s, %s:%d connect failed\r\n", + __FUNCTION__, p_http->host, p_http->port); + goto FAILED; + } + } + + len = 1024*1024; + + if (setsockopt(p_http->cfd, SOL_SOCKET, SO_RCVBUF, (char*)&len, sizeof(int))) + { + log_print(HT_LOG_WARN, "%s, setsockopt SO_RCVBUF error!\n", __FUNCTION__); + } + + if (p_http->https) + { +#ifdef HTTPS + if (!http_cln_ssl_conn(p_http, timeout)) + { + goto FAILED; + } +#else + log_print(HT_LOG_ERR, "%s, the server require ssl connection, unsupport!\r\n", __FUNCTION__); + goto FAILED; +#endif + } + + offset = rtsp_build_ws_req(p_http, buff, sizeof(buff)); + + if (http_cln_tx(p_http, buff, offset) <= 0) + { + log_print(HT_LOG_ERR, "%s, http_cln_tx failed\r\n", __FUNCTION__); + goto FAILED; + } + + if (!http_cln_rx_timeout(p_http, timeout)) + { + log_print(HT_LOG_ERR, "%s, http_cln_rx_timeout failed\r\n", __FUNCTION__); + goto FAILED; + } + + if (p_http->rx_msg->msg_sub_type == 401) + { + if (p_http->need_auth == FALSE) + { + http_cln_auth_set(p_http, m_rua.auth_info.auth_name, m_rua.auth_info.auth_pwd); + + http_cln_free_req(p_http); + + goto RETRY; + } + + send_notify(RTSP_EVE_AUTHFAILED); + goto FAILED; + } + else if (p_http->rx_msg->msg_sub_type != 101) + { + log_print(HT_LOG_ERR, "%s, msg_sub_type=%d, ctt_type=%d\r\n", + __FUNCTION__, p_http->rx_msg->msg_sub_type, p_http->rx_msg->ctt_type); + goto FAILED; + } + + m_rua.cseq = 1; + m_rua.rtp_tcp = 1; + m_rua.state = RCS_OPTIONS; + + m_rua.ws_msg.buff = (char *)malloc(WS_MAXMESSAGE); + if (NULL == m_rua.ws_msg.buff) + { + log_print(HT_LOG_ERR, "%s, malloc failed!\r\n", __FUNCTION__); + goto FAILED; + } + + m_rua.ws_msg.buff_len = WS_MAXMESSAGE; + + tx_msg = rcua_build_options(&m_rua); + if (tx_msg) + { + rcua_send_free_rtsp_msg(&m_rua, tx_msg); + } + + return TRUE; + +FAILED: + + http_cln_free_req(&m_rua.ws_http); + + return FALSE; +} + +BOOL CRtspClient::rtsp_ws_ping_process(RCUA * p_rua, char * p_buff, int len) +{ + int slen; + int extra = rtsp_ws_encode_data((uint8 *)p_buff, len, 0x8A, 1); + + len += extra; + p_buff -= extra; + + slen = http_cln_tx(&p_rua->ws_http, p_buff, len); + if (slen != len) + { + return FALSE; + } + + return TRUE; +} + +BOOL CRtspClient::rtsp_ws_rtsp_process(RCUA * p_rua, char * p_buff, int len) +{ + if (NULL == p_rua->rtp_rcv_buf || 0 == p_rua->rtp_t_len) + { + memcpy(p_rua->rcv_buf + p_rua->rcv_dlen, p_buff, len); + p_rua->rcv_dlen += len; + + if (p_rua->rcv_dlen < 4) + { + return TRUE; + } + } + else + { + if (len > p_rua->rtp_t_len - p_rua->rtp_rcv_len) + { + log_print(HT_LOG_ERR, "%s, bufflen=%d, rtp_t_len=%d, rtp_rcv_len=%d\r\n", + __FUNCTION__, len, p_rua->rtp_t_len, p_rua->rtp_rcv_len); + return FALSE; + } + + memcpy(p_rua->rtp_rcv_buf + p_rua->rtp_rcv_len, p_buff, len); + p_rua->rtp_rcv_len += len; + + if (p_rua->rtp_rcv_len == p_rua->rtp_t_len) + { + tcp_data_rx((uint8*)p_rua->rtp_rcv_buf, p_rua->rtp_rcv_len); + + free(p_rua->rtp_rcv_buf); + p_rua->rtp_rcv_buf = NULL; + p_rua->rtp_rcv_len = 0; + p_rua->rtp_t_len = 0; + } + + return TRUE; + } + + return rtsp_tcp_data_rx(p_rua); +} + +BOOL CRtspClient::rtsp_ws_data_process(RCUA * p_rua) +{ + WSMSG * p_msg = &p_rua->ws_msg; + +PARSE: + + int ret = rtsp_ws_decode_data(&p_rua->ws_msg); + if (ret > 0) + { + if (p_rua->ws_msg.opcode == 1 || p_rua->ws_msg.opcode == 2) + { + rtsp_ws_rtsp_process(p_rua, p_msg->buff+p_msg->skip, p_msg->msg_len); + } + else if (p_rua->ws_msg.opcode == 0x8) // close session + { + log_print(HT_LOG_INFO, "%s, recv close message\r\n", __FUNCTION__); + return FALSE; + } + else if (p_rua->ws_msg.opcode == 0x9) // ping + { + rtsp_ws_ping_process(p_rua, p_msg->buff+p_msg->skip, p_msg->msg_len); + } + else if (p_rua->ws_msg.opcode == 0xA) // pong + { + log_print(HT_LOG_INFO, "%s, recv pong message\r\n", __FUNCTION__); + } + else + { + log_print(HT_LOG_INFO, "%s, recv unkonw message %d\r\n", __FUNCTION__, p_rua->ws_msg.opcode); + return -1; + } + + p_msg->rcv_len -= p_msg->msg_len + p_msg->skip; + + if (p_msg->rcv_len > 0) + { + memmove(p_msg->buff, p_msg->buff + p_msg->msg_len + p_msg->skip, p_msg->rcv_len); + } + + if (p_msg->rcv_len >= 6) + { + goto PARSE; + } + + return TRUE; + } + else if (ret == 0) // need more data to parse + { + return TRUE; + } + else + { + return FALSE; + } +} + +int CRtspClient::rtsp_over_ws_rx(RCUA * p_rua) +{ + int rlen; + WSMSG * p_msg = &p_rua->ws_msg; + SOCKET fd = -1; +#ifdef HTTPS + int https = 0; +#endif + + fd = p_rua->ws_http.cfd; + if (fd <= 0) + { + return -1; + } + +#ifdef HTTPS + if (p_rua->ws_http.https && p_rua->ws_http.ssl) + { + https = 1; + } + + if (https && SSL_pending(p_rua->ws_http.ssl) > 0) + { + // There is data to read + } + else +#endif + { +#ifndef EPOLL + fd_set fdread; + struct timeval tv = {1, 0}; + + FD_ZERO(&fdread); + FD_SET(fd, &fdread); + + int sret = select((int)(fd+1), &fdread, NULL, NULL, &tv); + if (sret == 0) // Time expired + { + return RTSP_RX_TIMEOUT; + } + else if (!FD_ISSET(fd, &fdread)) + { + return RTSP_RX_TIMEOUT; + } +#endif + } + +#ifdef HTTPS + if (https) + { + rlen = SSL_read(p_rua->ws_http.ssl, p_msg->buff+p_msg->rcv_len, p_msg->buff_len-p_msg->rcv_len); + } + else +#endif + rlen = recv(fd, p_msg->buff+p_msg->rcv_len, p_msg->buff_len-p_msg->rcv_len, 0); + if (rlen <= 0) + { + log_print(HT_LOG_WARN, "%s, ret = %d, err = %s\r\n", + __FUNCTION__, rlen, sys_os_get_socket_error()); //recv error, connection maybe disconn? + return RTSP_RX_FAIL; + } + + p_msg->rcv_len += rlen; + + if (p_msg->rcv_len < 4) + { + return RTSP_RX_SUCC; + } + + return rtsp_ws_data_process(p_rua) ? RTSP_RX_SUCC : RTSP_RX_FAIL; +} + +#endif // OVER_WEBSOCKET + +BOOL CRtspClient::rtsp_client_state(RCUA * p_rua, HRTSP_MSG * rx_msg) +{ + BOOL ret = TRUE; + + if (rx_msg->msg_type == 0) // Request message? + { + return FALSE; + } + + if (rx_msg->msg_sub_type == 401) + { + return rtsp_unauth_res(p_rua, rx_msg); + } + else + { + p_rua->auth_retry = 0; + } + + switch (p_rua->state) + { + case RCS_NULL: + break; + + case RCS_OPTIONS: + ret = rtsp_options_res(p_rua, rx_msg); + break; + + case RCS_DESCRIBE: + ret = rtsp_describe_res(p_rua, rx_msg); + break; + + case RCS_INIT_V: + ret = rtsp_setup_res(p_rua, rx_msg, AV_VIDEO_CH); + break; + + case RCS_INIT_A: + ret = rtsp_setup_res(p_rua, rx_msg, AV_AUDIO_CH); + break; + +#ifdef METADATA + case RCS_INIT_M: + ret = rtsp_setup_res(p_rua, rx_msg, AV_METADATA_CH); + break; +#endif + +#ifdef BACKCHANNEL + case RCS_INIT_BC: + ret = rtsp_setup_res(p_rua, rx_msg, AV_BACK_CH); + break; +#endif + + case RCS_READY: + ret = rtsp_play_res(p_rua, rx_msg); + break; + + case RCS_PLAYING: + rtsp_play_res(p_rua, rx_msg); + break; + + case RCS_RECORDING: + break; + } + + return ret; +} + +BOOL CRtspClient::make_prepare_play() +{ + if (m_rua.channels[AV_VIDEO_CH].ctl[0] != '\0') + { + if (m_rua.video_codec == VIDEO_CODEC_H264) + { + h264_rxi_init(&h264rxi, video_data_cb, this); + } + else if (m_rua.video_codec == VIDEO_CODEC_H265) + { + h265_rxi_init(&h265rxi, video_data_cb, this); + } + else if (m_rua.video_codec == VIDEO_CODEC_JPEG) + { + mjpeg_rxi_init(&mjpegrxi, video_data_cb, this); + + mjpegrxi.width = m_nWidth; + mjpegrxi.height = m_nHeight; + } + else if (m_rua.video_codec == VIDEO_CODEC_MP4) + { + mpeg4_rxi_init(&mpeg4rxi, video_data_cb, this); + } + } + + if (m_rua.channels[AV_AUDIO_CH].ctl[0] != '\0') + { + if (m_rua.audio_codec == AUDIO_CODEC_AAC) + { + aac_rxi_init(&aacrxi, audio_data_cb, this); + } + else if (m_rua.audio_codec != AUDIO_CODEC_NONE ) + { + pcm_rxi_init(&pcmrxi, audio_data_cb, this); + } + } + +#ifdef METADATA + if (m_rua.channels[AV_METADATA_CH].ctl[0] != '\0') + { + pcm_rxi_init(&metadatarxi, metadata_data_cb, this); + } +#endif + +#ifndef EPOLL + if (!m_rua.rtp_tcp) + { + m_udpRxTid = sys_os_create_thread((void *)rtsp_udp_rx_thread, this); + } +#endif + + return TRUE; +} + +void CRtspClient::tcp_data_rx(uint8 * lpData, int rlen) +{ + RILF * p_rilf = (RILF *)lpData; + uint8 * p_rtp = (uint8 *)p_rilf + 4; + uint32 rtp_len = rlen - 4; + + if (p_rilf->channel == m_rua.channels[AV_VIDEO_CH].interleaved) + { + if (VIDEO_CODEC_H264 == m_rua.video_codec) + { + h264_rtp_rx(&h264rxi, p_rtp, rtp_len); + } + else if (VIDEO_CODEC_JPEG == m_rua.video_codec) + { + mjpeg_rtp_rx(&mjpegrxi, p_rtp, rtp_len); + } + else if (VIDEO_CODEC_MP4 == m_rua.video_codec) + { + mpeg4_rtp_rx(&mpeg4rxi, p_rtp, rtp_len); + } + else if (VIDEO_CODEC_H265 == m_rua.video_codec) + { + h265_rtp_rx(&h265rxi, p_rtp, rtp_len); + } + } + else if (p_rilf->channel == m_rua.channels[AV_AUDIO_CH].interleaved) + { + if (AUDIO_CODEC_AAC == m_rua.audio_codec) + { + aac_rtp_rx(&aacrxi, p_rtp, rtp_len); + } + else if (AUDIO_CODEC_NONE != m_rua.audio_codec) + { + pcm_rtp_rx(&pcmrxi, p_rtp, rtp_len); + } + } +#ifdef METADATA + else if (p_rilf->channel == m_rua.channels[AV_METADATA_CH].interleaved) + { + pcm_rtp_rx(&metadatarxi, p_rtp, rtp_len); + } +#endif + else if (p_rilf->channel == m_rua.channels[AV_VIDEO_CH].interleaved+1) + { + rtcp_data_rx(p_rtp, rtp_len, AV_VIDEO_CH); + } + else if (p_rilf->channel == m_rua.channels[AV_AUDIO_CH].interleaved+1) + { + rtcp_data_rx(p_rtp, rtp_len, AV_AUDIO_CH); + } +#ifdef METADATA + else if (p_rilf->channel == m_rua.channels[AV_METADATA_CH].interleaved+1) + { + rtcp_data_rx(p_rtp, rtp_len, AV_METADATA_CH); + } +#endif +} + +void CRtspClient::udp_data_rx(uint8 * lpData, int rlen, int type) +{ + uint8 * p_rtp = lpData; + uint32 rtp_len = rlen; + + if (rtp_len >= 2 && RTP_PT_IS_RTCP(p_rtp[1])) + { + rtcp_data_rx(p_rtp, rtp_len, type); + } + else if (AV_TYPE_VIDEO == type) + { + if (VIDEO_CODEC_H264 == m_rua.video_codec) + { + h264_rtp_rx(&h264rxi, p_rtp, rtp_len); + } + else if (VIDEO_CODEC_JPEG == m_rua.video_codec) + { + mjpeg_rtp_rx(&mjpegrxi, p_rtp, rtp_len); + } + else if (VIDEO_CODEC_MP4 == m_rua.video_codec) + { + mpeg4_rtp_rx(&mpeg4rxi, p_rtp, rtp_len); + } + else if (VIDEO_CODEC_H265 == m_rua.video_codec) + { + h265_rtp_rx(&h265rxi, p_rtp, rtp_len); + } + } + else if (AV_TYPE_AUDIO == type) + { + if (AUDIO_CODEC_AAC == m_rua.audio_codec) + { + aac_rtp_rx(&aacrxi, p_rtp, rtp_len); + } + else if (AUDIO_CODEC_NONE != m_rua.audio_codec) + { + pcm_rtp_rx(&pcmrxi, p_rtp, rtp_len); + } + } +#ifdef METADATA + else if (AV_TYPE_METADATA == type) + { + pcm_rtp_rx(&metadatarxi, p_rtp, rtp_len); + } +#endif +} + +void CRtspClient::rtcp_data_rx(uint8 * lpData, int rlen, int type) +{ + sys_os_mutex_enter(m_pMutex); + if (m_pRtcpCB) + { + m_pRtcpCB(lpData, rlen, type, m_pUserdata); + } + sys_os_mutex_leave(m_pMutex); +} + +int CRtspClient::rtsp_msg_parser(RCUA * p_rua) +{ + int rtsp_pkt_len = rtsp_pkt_find_end(p_rua->rcv_buf); + if (rtsp_pkt_len == 0) // wait for next recv + { + return RTSP_PARSE_MOREDATA; + } + + HRTSP_MSG * rx_msg = rtsp_get_msg_buf(); + if (rx_msg == NULL) + { + log_print(HT_LOG_ERR, "%s, rtsp_get_msg_buf return null!!!\r\n", __FUNCTION__); + return RTSP_PARSE_FAIL; + } + + memcpy(rx_msg->msg_buf, p_rua->rcv_buf, rtsp_pkt_len); + rx_msg->msg_buf[rtsp_pkt_len] = '\0'; + + log_print(HT_LOG_DBG, "RX << %s\r\n", rx_msg->msg_buf); + + int parse_len = rtsp_msg_parse_part1(rx_msg->msg_buf, rtsp_pkt_len, rx_msg); + if (parse_len != rtsp_pkt_len) //parse error + { + log_print(HT_LOG_ERR, "%s, rtsp_msg_parse_part1=%d, rtsp_pkt_len=%d!!!\r\n", + __FUNCTION__, parse_len, rtsp_pkt_len); + rtsp_free_msg(rx_msg); + + p_rua->rcv_dlen = 0; + return RTSP_PARSE_FAIL; + } + + if (rx_msg->ctx_len > 0) + { + if (p_rua->rcv_dlen < (parse_len + rx_msg->ctx_len)) + { + rtsp_free_msg(rx_msg); + return RTSP_PARSE_MOREDATA; + } + + memcpy(rx_msg->msg_buf+rtsp_pkt_len, p_rua->rcv_buf+rtsp_pkt_len, rx_msg->ctx_len); + rx_msg->msg_buf[rtsp_pkt_len+rx_msg->ctx_len] = '\0'; + + log_print(HT_LOG_DBG, "%s\r\n", rx_msg->msg_buf+rtsp_pkt_len); + + int sdp_parse_len = rtsp_msg_parse_part2(rx_msg->msg_buf+rtsp_pkt_len, rx_msg->ctx_len, rx_msg); + if (sdp_parse_len != rx_msg->ctx_len) + { + } + parse_len += rx_msg->ctx_len; + } + + if (parse_len < p_rua->rcv_dlen) + { + while (p_rua->rcv_buf[parse_len] == ' ' || + p_rua->rcv_buf[parse_len] == '\r' || + p_rua->rcv_buf[parse_len] == '\n') + { + parse_len++; + } + + memmove(p_rua->rcv_buf, p_rua->rcv_buf + parse_len, p_rua->rcv_dlen - parse_len); + p_rua->rcv_dlen -= parse_len; + } + else + { + p_rua->rcv_dlen = 0; + } + + int ret = rtsp_client_state(p_rua, rx_msg); + + rtsp_free_msg(rx_msg); + + return ret ? RTSP_PARSE_SUCC : RTSP_PARSE_FAIL; +} + +#ifdef EPOLL + +int CRtspClient::rtsp_epoll_rx() +{ + int i, nfds; + + nfds = epoll_wait(m_ep_fd, m_ep_events, m_ep_event_num, 1000); + if (0 == nfds) + { + return RTSP_RX_TIMEOUT; + } + + for (i = 0; i < nfds; i++) + { + if (m_ep_events[i].events & EPOLLIN) + { + int fd = (int)(m_ep_events[i].data.u64 & 0xFFFF); + + if ((m_ep_events[i].data.u64 & ((uint64)1 << 63)) != 0) + { + if (rtsp_tcp_rx() == RTSP_RX_FAIL) + { + return RTSP_RX_FAIL; + } + } + else + { + int ch; + int alen; + char buf[2048]; + struct sockaddr_in addr; + + memset(&addr, 0, sizeof(addr)); + alen = sizeof(struct sockaddr_in); + + int rlen = recvfrom(fd, buf, sizeof(buf), 0, (struct sockaddr *)&addr, (socklen_t*)&alen); + if (rlen <= 12) + { + log_print(HT_LOG_ERR, "%s, recvfrom return %d, err[%s]!!!\r\n", + __FUNCTION__, rlen, sys_os_get_socket_error()); + continue; + } + + for (ch = 0; ch < AV_MAX_CHS; ch++) + { + if (m_rua.channels[ch].udp_fd == fd) + { + udp_data_rx((uint8*)buf, rlen, ch); + } + else if (m_rua.channels[ch].rtcp_fd == fd) + { + rtcp_data_rx((uint8*)buf, rlen, ch); + } + } + } + } + } + + return RTSP_RX_SUCC; +} + +#endif + +int CRtspClient::rtsp_tcp_data_rx(RCUA * p_rua) +{ +rx_point: + + if (rtsp_is_rtsp_msg(p_rua->rcv_buf)) //Is RTSP Packet? + { + int ret = rtsp_msg_parser(p_rua); + if (ret == RTSP_PARSE_FAIL) + { + return RTSP_RX_FAIL; + } + else if (ret == RTSP_PARSE_MOREDATA) + { + return RTSP_RX_SUCC; + } + + if (p_rua->rcv_dlen >= 4) + { + goto rx_point; + } + } + else + { + RILF * p_rilf = (RILF *)(p_rua->rcv_buf); + if (p_rilf->magic != 0x24) + { + log_print(HT_LOG_WARN, "%s, p_rilf->magic[0x%02X]!!!\r\n", __FUNCTION__, p_rilf->magic); + + // Try to recover from wrong data + + for (int i = 1; i <= p_rua->rcv_dlen - 4; i++) + { + if (p_rua->rcv_buf[i] == 0x24 && + (p_rua->rcv_buf[i+1] == p_rua->channels[AV_VIDEO_CH].interleaved || + p_rua->rcv_buf[i+1] == p_rua->channels[AV_AUDIO_CH].interleaved)) + { + memmove(p_rua->rcv_buf, p_rua->rcv_buf+i, p_rua->rcv_dlen - i); + p_rua->rcv_dlen -= i; + goto rx_point; + } + } + + p_rua->rcv_dlen = 0; + + return RTSP_RX_SUCC; + } + + uint16 rtp_len = ntohs(p_rilf->rtp_len); + if (rtp_len > (p_rua->rcv_dlen - 4)) + { + if (p_rua->rtp_rcv_buf) + { + free(p_rua->rtp_rcv_buf); + } + + p_rua->rtp_rcv_buf = (char *)malloc(rtp_len+4); + if (p_rua->rtp_rcv_buf == NULL) + { + return RTSP_RX_FAIL; + } + + memcpy(p_rua->rtp_rcv_buf, p_rua->rcv_buf, p_rua->rcv_dlen); + p_rua->rtp_rcv_len = p_rua->rcv_dlen; + p_rua->rtp_t_len = rtp_len+4; + + p_rua->rcv_dlen = 0; + + return RTSP_RX_SUCC; + } + + tcp_data_rx((uint8*)p_rilf, rtp_len+4); + + p_rua->rcv_dlen -= rtp_len+4; + if (p_rua->rcv_dlen > 0) + { + memmove(p_rua->rcv_buf, p_rua->rcv_buf+rtp_len+4, p_rua->rcv_dlen); + } + + if (p_rua->rcv_dlen >= 4) + { + goto rx_point; + } + } + + return RTSP_RX_SUCC; +} + +int CRtspClient::rtsp_over_tcp_rx(RCUA * p_rua) +{ + int rlen; + SOCKET fd; + + fd = p_rua->fd; + if (fd <= 0) + { + return -1; + } + +#ifndef EPOLL + fd_set fdread; + struct timeval tv = {1, 0}; + + FD_ZERO(&fdread); + FD_SET(fd, &fdread); + + int sret = select((int)(fd+1), &fdread, NULL, NULL, &tv); + if (sret == 0) // Time expired + { + return RTSP_RX_TIMEOUT; + } + else if (!FD_ISSET(fd, &fdread)) + { + return RTSP_RX_TIMEOUT; + } +#endif + + if (p_rua->rtp_rcv_buf == NULL || p_rua->rtp_t_len == 0) + { + rlen = recv(fd, p_rua->rcv_buf+p_rua->rcv_dlen, 2048-p_rua->rcv_dlen, 0); + if (rlen <= 0) + { + log_print(HT_LOG_WARN, "%s, ret = %d, err = %s\r\n", + __FUNCTION__, rlen, sys_os_get_socket_error()); //recv error, connection maybe disconn? + return RTSP_RX_FAIL; + } + + p_rua->rcv_dlen += rlen; + + if (p_rua->rcv_dlen < 4) + { + return RTSP_RX_SUCC; + } + } + else + { + rlen = recv(fd, p_rua->rtp_rcv_buf+p_rua->rtp_rcv_len, p_rua->rtp_t_len-p_rua->rtp_rcv_len, 0); + if (rlen <= 0) + { + log_print(HT_LOG_WARN, "%s, ret = %d, err = %s\r\n", + __FUNCTION__, rlen, sys_os_get_socket_error()); // recv error, connection maybe disconn? + return RTSP_RX_FAIL; + } + + p_rua->rtp_rcv_len += rlen; + + if (p_rua->rtp_rcv_len == p_rua->rtp_t_len) + { + tcp_data_rx((uint8*)p_rua->rtp_rcv_buf, p_rua->rtp_rcv_len); + + free(p_rua->rtp_rcv_buf); + p_rua->rtp_rcv_buf = NULL; + p_rua->rtp_rcv_len = 0; + p_rua->rtp_t_len = 0; + } + + return RTSP_RX_SUCC; + } + + return rtsp_tcp_data_rx(p_rua); +} + +int CRtspClient::rtsp_tcp_rx() +{ + RCUA * p_rua = &m_rua; + +#ifdef OVER_HTTP + if (p_rua->over_http) + { + return rtsp_over_http_rx(p_rua); + } + else +#endif +#ifdef OVER_WEBSOCKET + if (p_rua->over_ws) + { + return rtsp_over_ws_rx(p_rua); + } + else +#endif + + return rtsp_over_tcp_rx(p_rua); +} + +int CRtspClient::rtsp_udp_rx() +{ + int i, max_fd = 0; + fd_set fdr; + + FD_ZERO(&fdr); + + for (i = 0; i < AV_MAX_CHS; i++) + { + if (m_rua.channels[i].udp_fd > 0) + { + FD_SET(m_rua.channels[i].udp_fd, &fdr); + max_fd = (max_fd >= (int)m_rua.channels[i].udp_fd)? max_fd : (int)m_rua.channels[i].udp_fd; + } + + if (m_rua.channels[i].rtcp_fd > 0) + { + FD_SET(m_rua.channels[i].rtcp_fd, &fdr); + max_fd = (max_fd >= (int)m_rua.channels[i].rtcp_fd)? max_fd : (int)m_rua.channels[i].rtcp_fd; + } + } + + struct timeval tv = {1, 0}; + + int sret = select(max_fd+1, &fdr, NULL, NULL, &tv); + if (sret <= 0) + { + return RTSP_RX_TIMEOUT; + } + + int alen; + char buf[2048]; + struct sockaddr_in addr; + + memset(&addr, 0, sizeof(addr)); + alen = sizeof(struct sockaddr_in); + + for (i = 0; i < AV_MAX_CHS; i++) + { + if (m_rua.channels[i].udp_fd > 0 && FD_ISSET(m_rua.channels[i].udp_fd, &fdr)) + { + int rlen = recvfrom(m_rua.channels[i].udp_fd, buf, sizeof(buf), 0, (struct sockaddr *)&addr, (socklen_t*)&alen); + if (rlen <= 12) + { + log_print(HT_LOG_ERR, "%s, recvfrom return %d, err[%s]!!!\r\n", + __FUNCTION__, rlen, sys_os_get_socket_error()); + } + else + { + udp_data_rx((uint8*)buf, rlen, i); + } + } + + if (m_rua.channels[i].rtcp_fd > 0 && FD_ISSET(m_rua.channels[i].rtcp_fd, &fdr)) + { + int rlen = recvfrom(m_rua.channels[i].rtcp_fd, buf, sizeof(buf), 0, (struct sockaddr *)&addr, (socklen_t*)&alen); + if (rlen <= 12) + { + log_print(HT_LOG_ERR, "%s, recvfrom return %d, err[%s]!!!\r\n", + __FUNCTION__, rlen, sys_os_get_socket_error()); + } + else + { + rtcp_data_rx((uint8*)buf, rlen, i); + } + } + } + + return RTSP_RX_SUCC; +} + +BOOL CRtspClient::rtsp_start(const char * url, const char * ip, int port, const char * user, const char * pass) +{ + if (m_rua.state != RCS_NULL) + { + rtsp_play(); + return TRUE; + } + + if (user && user != m_rua.auth_info.auth_name) + { + strcpy(m_rua.auth_info.auth_name, user); + } + + if (pass && pass != m_rua.auth_info.auth_pwd) + { + strcpy(m_rua.auth_info.auth_pwd, pass); + } + + if (url && url != m_url) + { + strcpy(m_url, url); + } + + if (ip && ip != m_ip) + { + strcpy(m_ip, ip); + } + + m_nport = port; + + m_rua.rport = m_nport; + strcpy(m_rua.ripstr, m_ip); + + if (m_suffix[0] == '/') + { + snprintf(m_rua.uri, sizeof(m_rua.uri)-1, "rtsp://%s:%d%s", m_ip, m_nport, m_suffix); + } + else + { + snprintf(m_rua.uri, sizeof(m_rua.uri)-1, "rtsp://%s:%d/%s", m_ip, m_nport, m_suffix); + } + + m_bRunning = TRUE; + m_tcpRxTid = sys_os_create_thread((void *)rtsp_tcp_rx_thread, this); + if (m_tcpRxTid == 0) + { + log_print(HT_LOG_ERR, "%s, sys_os_create_thread failed!!!\r\n", __FUNCTION__); + return FALSE; + } + + return TRUE; +} + +BOOL CRtspClient::rtsp_start(const char * url, const char * user, const char * pass) +{ + int port; + char proto[32], username[64], password[64], host[100], path[200]; + + url_split(url, proto, sizeof(proto), username, sizeof(username), + password, sizeof(password), host, sizeof(host), &port, path, sizeof(path)); + + if (strcasecmp(proto, "rtsp") == 0) + { + port = (port == -1) ? 554 : port; + } +#ifdef OVER_HTTP + else if (strcasecmp(proto, "http") == 0) + { + set_rtsp_over_http(1, 0); + + port = (port == -1) ? 80 : port; + } + else if (strcasecmp(proto, "https") == 0) + { + set_rtsp_over_http(1, 0); + + port = (port == -1) ? 443 : port; + } +#endif +#ifdef OVER_WEBSOCKET + else if (strcasecmp(proto, "ws") == 0) + { + set_rtsp_over_ws(1, 0); + + port = (port == -1) ? 80 : port; + } + else if (strcasecmp(proto, "wss") == 0) + { + set_rtsp_over_ws(1, 0); + + port = (port == -1) ? 443 : port; + } +#endif + else + { + return FALSE; + } + + if (host[0] == '\0') + { + return FALSE; + } + + strncpy(m_ip, host, sizeof(m_ip) - 1); + + if (username[0] != '\0') + { + strcpy(m_rua.auth_info.auth_name, username); + } + else if (user && user[0] != '\0') + { + strcpy(m_rua.auth_info.auth_name, user); + } + + if (password[0] != '\0') + { + strcpy(m_rua.auth_info.auth_pwd, password); + } + else if (pass && pass[0] != '\0') + { + strcpy(m_rua.auth_info.auth_pwd, pass); + } + + if (path[0] != '\0') + { + strncpy(m_suffix, path, sizeof(m_suffix) - 1); + } + + if (path[0] == '/') + { + snprintf(m_url, sizeof(m_url)-1, "%s://%s:%d%s", proto, host, port, path); + } + else + { + snprintf(m_url, sizeof(m_url)-1, "%s://%s:%d/%s", proto, host, port, path); + } + + m_nport = port; + + return rtsp_start(m_url, m_ip, m_nport, m_rua.auth_info.auth_name, m_rua.auth_info.auth_pwd); +} + +BOOL CRtspClient::rtsp_play(int npt_start) +{ + m_rua.cseq++; + m_rua.seek_pos = npt_start; + + HRTSP_MSG * tx_msg = rcua_build_play(&m_rua); + if (tx_msg) + { + rcua_send_free_rtsp_msg(&m_rua, tx_msg); + } + + return TRUE; +} + +BOOL CRtspClient::rtsp_stop() +{ + if (RCS_NULL == m_rua.state) + { + return TRUE; + } + + m_rua.cseq++; + m_rua.state = RCS_NULL; + + HRTSP_MSG * tx_msg = rcua_build_teardown(&m_rua); + if (tx_msg) + { + rcua_send_free_rtsp_msg(&m_rua, tx_msg); + } + + return TRUE; +} + +BOOL CRtspClient::rtsp_pause() +{ + m_rua.cseq++; + + HRTSP_MSG * tx_msg = rcua_build_pause(&m_rua); + if (tx_msg) + { + rcua_send_free_rtsp_msg(&m_rua, tx_msg); + } + + return TRUE; +} + +BOOL CRtspClient::rtsp_close() +{ + sys_os_mutex_enter(m_pMutex); + m_pAudioCB = NULL; + m_pVideoCB = NULL; + m_pRtcpCB = NULL; +#ifdef METADATA + m_pMetadataCB = NULL; +#endif + m_pNotify = NULL; + m_pUserdata = NULL; + sys_os_mutex_leave(m_pMutex); + +#ifdef OVER_HTTP + if (m_rua.over_http) + { +#ifdef HTTPS + if (m_rua.rtsp_recv.https && m_rua.rtsp_recv.ssl) + { + SSL_shutdown(m_rua.rtsp_recv.ssl); + } + + if (m_rua.rtsp_send.https && m_rua.rtsp_send.ssl) + { + SSL_shutdown(m_rua.rtsp_send.ssl); + } +#endif + + if (m_rua.rtsp_recv.cfd > 0) + { +#ifdef EPOLL + epoll_ctl(m_ep_fd, EPOLL_CTL_DEL, m_rua.rtsp_recv.cfd, NULL); +#endif + closesocket(m_rua.rtsp_recv.cfd); + m_rua.rtsp_recv.cfd = 0; + } + + if (m_rua.rtsp_send.cfd) + { + closesocket(m_rua.rtsp_send.cfd); + m_rua.rtsp_send.cfd = 0; + } + } +#endif + +#ifdef OVER_WEBSOCKET + if (m_rua.over_ws) + { +#ifdef HTTPS + if (m_rua.ws_http.https && m_rua.ws_http.ssl) + { + SSL_shutdown(m_rua.ws_http.ssl); + } +#endif + + if (m_rua.ws_http.cfd > 0) + { +#ifdef EPOLL + epoll_ctl(m_ep_fd, EPOLL_CTL_DEL, m_rua.ws_http.cfd, NULL); +#endif + closesocket(m_rua.ws_http.cfd); + m_rua.ws_http.cfd = 0; + } + } +#endif + + m_bRunning = FALSE; + + // Close sockets NOW so select() returns immediately in the rx threads, + // allowing them to see m_bRunning==FALSE and exit without waiting for + // the full select timeout (~1s). Without this, threads may still be + // blocked in select() when the DLL is unloaded → crash. + if (m_rua.fd > 0) + { +#ifdef EPOLL + epoll_ctl(m_ep_fd, EPOLL_CTL_DEL, m_rua.fd, NULL); +#endif + closesocket(m_rua.fd); + m_rua.fd = 0; + } + + for (int i = 0; i < AV_MAX_CHS; i++) + { + if (m_rua.channels[i].udp_fd > 0) + { +#ifdef EPOLL + epoll_ctl(m_ep_fd, EPOLL_CTL_DEL, m_rua.channels[i].udp_fd, NULL); +#endif + closesocket(m_rua.channels[i].udp_fd); + m_rua.channels[i].udp_fd = 0; + } + + if (m_rua.channels[i].rtcp_fd > 0) + { +#ifdef EPOLL + epoll_ctl(m_ep_fd, EPOLL_CTL_DEL, m_rua.channels[i].rtcp_fd, NULL); +#endif + closesocket(m_rua.channels[i].rtcp_fd); + m_rua.channels[i].rtcp_fd = 0; + } + } + + while (m_tcpRxTid != 0) + { + usleep(10*1000); + } + + while (m_udpRxTid != 0) + { + usleep(10*1000); + } + + // All sockets (fd, udp_fd, rtcp_fd) already closed above the busy-wait + +#ifdef BACKCHANNEL + if (m_rua.audio_captrue) + { + m_rua.audio_captrue->delCallback(rtsp_bc_cb, &m_rua); + m_rua.audio_captrue->freeInstance(0); + m_rua.audio_captrue = NULL; + } +#endif + + if (m_rua.video_codec == VIDEO_CODEC_H264) + { + h264_rxi_deinit(&h264rxi); + } + else if (m_rua.video_codec == VIDEO_CODEC_H265) + { + h265_rxi_deinit(&h265rxi); + } + else if (m_rua.video_codec == VIDEO_CODEC_JPEG) + { + mjpeg_rxi_deinit(&mjpegrxi); + } + else if (m_rua.video_codec == VIDEO_CODEC_MP4) + { + mpeg4_rxi_deinit(&mpeg4rxi); + } + + if (m_rua.audio_codec == AUDIO_CODEC_AAC) + { + aac_rxi_deinit(&aacrxi); + } + else if (m_rua.audio_codec != AUDIO_CODEC_NONE) + { + pcm_rxi_deinit(&pcmrxi); + } + +#ifdef METADATA + pcm_rxi_deinit(&metadatarxi); +#endif + + if (m_rua.audio_spec) + { + free(m_rua.audio_spec); + m_rua.audio_spec = NULL; + } + +#ifdef OVER_HTTP + if (m_rua.over_http) + { + http_cln_free_req(&m_rua.rtsp_recv); + http_cln_free_req(&m_rua.rtsp_send); + } +#endif + +#ifdef OVER_WEBSOCKET + if (m_rua.over_ws) + { + http_cln_free_req(&m_rua.ws_http); + } + + if (m_rua.ws_msg.buff) + { + free(m_rua.ws_msg.buff); + m_rua.ws_msg.buff = NULL; + } +#endif + + set_default(); + + return TRUE; +} + +void CRtspClient::rtsp_video_data_cb(uint8 * p_data, int len, uint32 ts, uint32 seq) +{ + sys_os_mutex_enter(m_pMutex); + if (m_pVideoCB) + { + m_pVideoCB(p_data, len, ts, seq, m_pUserdata); + } + sys_os_mutex_leave(m_pMutex); +} + +void CRtspClient::rtsp_audio_data_cb(uint8 * p_data, int len, uint32 ts, uint32 seq) +{ + sys_os_mutex_enter(m_pMutex); + if (m_pAudioCB) + { + m_pAudioCB(p_data, len, ts, seq, m_pUserdata); + } + sys_os_mutex_leave(m_pMutex); +} + +void CRtspClient::rtsp_meta_data_cb(uint8 * p_data, int len, uint32 ts, uint32 seq) +{ + sys_os_mutex_enter(m_pMutex); + if (m_pMetadataCB) + { + m_pMetadataCB(p_data, len, ts, seq, m_pUserdata); + } + sys_os_mutex_leave(m_pMutex); +} + +void CRtspClient::rtsp_keep_alive() +{ + uint32 cur_time = sys_os_get_uptime(); + uint32 keepalive_interval = (m_rua.session_timeout > 20) ? (m_rua.session_timeout / 2) : (m_rua.session_timeout - 5); + if (cur_time - m_rua.keepalive_time >= 15) + { + m_rua.keepalive_time = cur_time; + m_rua.cseq++; + + HRTSP_MSG* tx_msg; + + // Change to ue OPTIONS command to keep alive + tx_msg = rcua_build_options(&m_rua); + if (!tx_msg) { + tx_msg = rcua_build_get_parameter(&m_rua); + } + if (tx_msg) + { + rcua_send_free_rtsp_msg(&m_rua, tx_msg); + } + + } +} + +//void CRtspClient::rtsp_keep_alive() +//{ +// uint32 cur_time = sys_os_get_uptime(); +// +// if (cur_time - m_rua.keepalive_time >= (uint32)(m_rua.session_timeout - 5)) +// { +// m_rua.keepalive_time = cur_time; +// m_rua.cseq++; +// +// HRTSP_MSG * tx_msg; +// +// if (m_rua.gp_cmd) // the rtsp server supports GET_PARAMETER command +// { +// tx_msg = rcua_build_get_parameter(&m_rua); +// } +// else +// { +// tx_msg = rcua_build_options(&m_rua); +// } +// +// if (tx_msg) +// { +// rcua_send_free_rtsp_msg(&m_rua, tx_msg); +// } +// } +//} + + +//void CRtspClient::rtsp_keep_alive() +//{ +// uint32 cur_time = sys_os_get_uptime(); +// uint32 keepalive_interval = (m_rua.session_timeout > 20) ? (m_rua.session_timeout / 2) : (m_rua.session_timeout - 5); +// if (cur_time - m_rua.keepalive_time >= 15) +// //if (cur_time - m_rua.keepalive_time >= keepalive_interval) +// //if (cur_time - m_rua.keepalive_time >= (uint32)(m_rua.session_timeout - 5)) +// { +// m_rua.keepalive_time = cur_time; +// m_rua.cseq++; +// +// HRTSP_MSG* tx_msg; +// // Change to ue OPTIONS command to keep alive +// tx_msg = rcua_build_options(&m_rua); +// if (!tx_msg) { +// tx_msg = rcua_build_get_parameter(&m_rua); +// } +// if (tx_msg) +// { +// rcua_send_free_rtsp_msg(&m_rua, tx_msg); +// } +// +// } +//} + +void CRtspClient::tcp_rx_thread() +{ + int ret; + int tm_count = 0; + BOOL nodata_notify = FALSE; +#ifdef EPOLL + int fd; + uint64 e_dat; +#endif + + send_notify(RTSP_EVE_CONNECTING); + +#ifdef OVER_HTTP + if (m_rua.over_http) + { + ret = rtsp_over_http_start(); + } + else +#endif +#ifdef OVER_WEBSOCKET + if (m_rua.over_ws) + { + ret = rtsp_over_ws_start(); + } + else +#endif + ret = rtsp_client_start(); + + if (!ret) + { + send_notify(RTSP_EVE_CONNFAIL); + goto rtsp_rx_exit; + } + +#ifdef EPOLL + +#ifdef OVER_HTTP + if (m_rua.over_http) + { + fd = m_rua.rtsp_recv.cfd; + } + else +#endif +#ifdef OVER_WEBSOCKET + if (m_rua.over_ws) + { + fd = m_rua.ws_http.cfd; + } + else +#endif + fd = m_rua.fd; + + e_dat = fd; + e_dat |= ((uint64)1 << 63); + + struct epoll_event event; + event.events = EPOLLIN; + event.data.u64 = e_dat; + epoll_ctl(m_ep_fd, EPOLL_CTL_ADD, fd, &event); +#endif + + while (m_bRunning) + { +#ifdef EPOLL + ret = rtsp_epoll_rx(); + if (ret == RTSP_RX_FAIL) + { + break; + } + else if (ret == RTSP_RX_TIMEOUT) + { + tm_count++; + if (tm_count >= m_nRxTimeout && !nodata_notify) // in 10s without data + { + nodata_notify = TRUE; + send_notify(RTSP_EVE_NODATA); + } + } + else // should be RTSP_RX_SUCC + { + if (nodata_notify) + { + nodata_notify = FALSE; + send_notify(RTSP_EVE_RESUME); + } + + tm_count = 0; + } +#else + ret = rtsp_tcp_rx(); + if (ret == RTSP_RX_FAIL) + { + break; + } + else if (m_rua.rtp_tcp) + { + if (ret == RTSP_RX_TIMEOUT) + { + tm_count++; + if (tm_count >= m_nRxTimeout && !nodata_notify) // in 10s without data + { + nodata_notify = TRUE; + send_notify(RTSP_EVE_NODATA); + } + } + else // should be RTSP_RX_SUCC + { + if (nodata_notify) + { + nodata_notify = FALSE; + send_notify(RTSP_EVE_RESUME); + } + + tm_count = 0; + } + } + else + { + if (ret == RTSP_RX_TIMEOUT) + { + usleep(100*1000); + } + } +#endif + + if (m_rua.state == RCS_PLAYING) + { + rtsp_keep_alive(); + } + } + + if (m_rua.fd > 0) + { +#ifdef EPOLL + epoll_ctl(m_ep_fd, EPOLL_CTL_DEL, m_rua.fd, NULL); +#endif + + closesocket(m_rua.fd); + m_rua.fd = 0; + } + + if (m_rua.rtp_rcv_buf) + { + free(m_rua.rtp_rcv_buf); + m_rua.rtp_rcv_buf = NULL; + } + + send_notify(RTSP_EVE_STOPPED); + +rtsp_rx_exit: + + m_tcpRxTid = 0; + log_print(HT_LOG_DBG, "%s, exit\r\n", __FUNCTION__); +} + +void CRtspClient::udp_rx_thread() +{ + int ret; + int tm_count = 0; + BOOL nodata_notify = FALSE; + + while (m_bRunning) + { + ret = rtsp_udp_rx(); + if (ret == RTSP_RX_FAIL) + { + break; + } + else if (ret == RTSP_RX_TIMEOUT) + { + tm_count++; + if (tm_count >= m_nRxTimeout && !nodata_notify) // in 10s without data + { + nodata_notify = TRUE; + send_notify(RTSP_EVE_NODATA); + } + } + else // should be RTSP_RX_SUCC + { + if (nodata_notify) + { + nodata_notify = FALSE; + send_notify(RTSP_EVE_RESUME); + } + + tm_count = 0; + } + } + + m_udpRxTid = 0; + + log_print(HT_LOG_DBG, "%s, exit\r\n", __FUNCTION__); +} + +void CRtspClient::send_notify(int event) +{ + sys_os_mutex_enter(m_pMutex); + + if (m_pNotify) + { + m_pNotify(event, m_pUserdata); + } + + sys_os_mutex_leave(m_pMutex); +} + +void CRtspClient::get_h264_params() +{ + rtsp_send_h264_params(&m_rua); +} + +BOOL CRtspClient::get_h264_params(uint8 * p_sps, int * sps_len, uint8 * p_pps, int * pps_len) +{ + if (h264rxi.param_sets.sps_len > 0 && h264rxi.param_sets.pps_len > 0) + { + memcpy(p_sps, h264rxi.param_sets.sps, h264rxi.param_sets.sps_len); + *sps_len = h264rxi.param_sets.sps_len; + + memcpy(p_pps, h264rxi.param_sets.pps, h264rxi.param_sets.pps_len); + *pps_len = h264rxi.param_sets.pps_len; + + return TRUE; + } + + char sps[1000] = {'\0'}, pps[1000] = {'\0'}; + + if (!rcua_get_sdp_h264_params(&m_rua, NULL, sps, sizeof(sps))) + { + return FALSE; + } + + char * ptr = strchr(sps, ','); + if (ptr && ptr[1] != '\0') + { + *ptr = '\0'; + strcpy(pps, ptr+1); + } + + uint8 sps_pps[1000]; + sps_pps[0] = 0x0; + sps_pps[1] = 0x0; + sps_pps[2] = 0x0; + sps_pps[3] = 0x1; + + int len = base64_decode(sps, strlen(sps), sps_pps+4, sizeof(sps_pps)-4); + if (len <= 0) + { + return FALSE; + } + + if ((sps_pps[4] & 0x1f) == 7) + { + memcpy(p_sps, sps_pps, len+4); + *sps_len = len+4; + } + else if ((sps_pps[4] & 0x1f) == 8) + { + memcpy(p_pps, sps_pps, len+4); + *pps_len = len+4; + } + + if (pps[0] != '\0') + { + len = base64_decode(pps, strlen(pps), sps_pps+4, sizeof(sps_pps)-4); + if (len > 0) + { + if ((sps_pps[4] & 0x1f) == 7) + { + memcpy(p_sps, sps_pps, len+4); + *sps_len = len+4; + } + else if ((sps_pps[4] & 0x1f) == 8) + { + memcpy(p_pps, sps_pps, len+4); + *pps_len = len+4; + } + } + } + + return TRUE; +} + +BOOL CRtspClient::get_h264_sdp_desc(char * p_sdp, int max_len) +{ + return rcua_get_sdp_h264_desc(&m_rua, NULL, p_sdp, max_len); +} + +BOOL CRtspClient::get_h265_sdp_desc(char * p_sdp, int max_len) +{ + return rcua_get_sdp_h265_desc(&m_rua, NULL, p_sdp, max_len); +} + +BOOL CRtspClient::get_mp4_sdp_desc(char * p_sdp, int max_len) +{ + return rcua_get_sdp_mp4_desc(&m_rua, NULL, p_sdp, max_len); +} + +BOOL CRtspClient::get_aac_sdp_desc(char * p_sdp, int max_len) +{ + return rcua_get_sdp_aac_desc(&m_rua, NULL, p_sdp, max_len); +} + +void CRtspClient::get_h265_params() +{ + rtsp_send_h265_params(&m_rua); +} + +BOOL CRtspClient::get_h265_params(uint8 * p_sps, int * sps_len, uint8 * p_pps, int * pps_len, uint8 * p_vps, int * vps_len) +{ + if (h265rxi.param_sets.sps_len > 0 && h265rxi.param_sets.pps_len > 0 && h265rxi.param_sets.vps_len > 0) + { + memcpy(p_sps, h265rxi.param_sets.sps, h265rxi.param_sets.sps_len); + *sps_len = h265rxi.param_sets.sps_len; + + memcpy(p_pps, h265rxi.param_sets.pps, h265rxi.param_sets.pps_len); + *pps_len = h265rxi.param_sets.pps_len; + + memcpy(p_vps, h265rxi.param_sets.vps, h265rxi.param_sets.vps_len); + *vps_len = h265rxi.param_sets.vps_len; + + return TRUE; + } + + int pt; + BOOL don; + char vps[1000] = {'\0'}, sps[1000] = {'\0'}, pps[1000] = {'\0'}; + + if (!rcua_get_sdp_h265_params(&m_rua, &pt, &don, vps, sizeof(vps), sps, sizeof(sps), pps, sizeof(pps))) + { + return FALSE; + } + + uint8 buff[1000]; + buff[0] = 0x0; + buff[1] = 0x0; + buff[2] = 0x0; + buff[3] = 0x1; + + if (vps[0] != '\0') + { + int len = base64_decode(vps, strlen(vps), buff+4, sizeof(buff)-4); + if (len <= 0) + { + return FALSE; + } + + memcpy(p_vps, buff, len+4); + *vps_len = len+4; + } + + if (sps[0] != '\0') + { + int len = base64_decode(sps, strlen(sps), buff+4, sizeof(buff)-4); + if (len <= 0) + { + return FALSE; + } + + memcpy(p_sps, buff, len+4); + *sps_len = len+4; + } + + if (pps[0] != '\0') + { + int len = base64_decode(pps, strlen(pps), buff+4, sizeof(buff)-4); + if (len <= 0) + { + return FALSE; + } + + memcpy(p_pps, buff, len+4); + *pps_len = len+4; + } + + return TRUE; +} + +void CRtspClient::rtsp_get_video_size(int * w, int * h) +{ + int i; + + for (i = 0; i < MAX_AVN; i++) + { + char * sdpline = m_rua.channels[AV_VIDEO_CH].cap_desc[i]; + + if (sdpline[0] == '\0') + { + break; + } + + if (strncasecmp(sdpline, "a=x-dimensions:", 15) == 0) + { + int width, height; + + if (sscanf(sdpline, "a=x-dimensions:%d,%d", &width, &height) == 2) + { + if (w) *w = width; + if (h) *h = height; + + break; + } + } + } +} + +BOOL CRtspClient::rtsp_get_video_media_info() +{ + if (m_rua.channels[AV_VIDEO_CH].cap_count == 0) + { + return FALSE; + } + + if (m_rua.channels[AV_VIDEO_CH].cap[0] == 26) + { + m_rua.video_codec = VIDEO_CODEC_JPEG; + } + + int i; + int rtpmap_len = (int)strlen("a=rtpmap:"); + + for (i=0; i= 0 && channel < AV_MAX_CHS) + { + m_rua.channels[channel].disabled = !flag; + } +} + +void CRtspClient::set_rtp_multicast(int flag) +{ + if (flag) + { + m_rua.rtp_tcp = 0; + } + + m_rua.mcast_flag = flag; +} + +void CRtspClient::set_rtp_over_udp(int flag) +{ + if (flag) + { + m_rua.rtp_tcp = 0; + } + else + { + m_rua.rtp_tcp = 1; + } +} + +void CRtspClient::set_rx_timeout(int timeout) +{ + m_nRxTimeout = timeout; +} + +void CRtspClient::set_conn_timeout(int timeout) +{ + m_nConnTimeout = timeout; +} + + diff --git a/MediaClient/MediaClient/rtsp/rtsp_cln.h b/MediaClient/MediaClient/rtsp/rtsp_cln.h new file mode 100644 index 0000000..935fe5f --- /dev/null +++ b/MediaClient/MediaClient/rtsp/rtsp_cln.h @@ -0,0 +1,443 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef RTSP_CLN_H +#define RTSP_CLN_H + +#include "sys_buf.h" +#include "rtsp_rcua.h" +#include "media_format.h" +#include "h264_rtp_rx.h" +#include "mjpeg_rtp_rx.h" +#include "h265_rtp_rx.h" +#include "mpeg4_rtp_rx.h" +#include "aac_rtp_rx.h" +#include "pcm_rtp_rx.h" + + +typedef int (*notify_cb)(int, void *); +typedef int (*video_cb)(uint8 *, int, uint32, uint16, void *); +typedef int (*audio_cb)(uint8 *, int, uint32, uint16, void *); +typedef int (*rtcp_cb)(uint8 *, int, int, void *); +typedef int (*metadata_cb)(uint8 *, int, uint32, uint16, void *); + + +#define RTSP_EVE_STOPPED 0 // stopped +#define RTSP_EVE_CONNECTING 1 // connecting +#define RTSP_EVE_CONNFAIL 2 // connect failed +#define RTSP_EVE_CONNSUCC 3 // connect success +#define RTSP_EVE_NOSIGNAL 4 // no signal +#define RTSP_EVE_RESUME 5 // resume +#define RTSP_EVE_AUTHFAILED 6 // authentication failed +#define RTSP_EVE_NODATA 7 // No data received within the timeout period + +#define RTSP_RX_FAIL -1 // rtsp data receive failed +#define RTSP_RX_TIMEOUT 1 // rtsp data receive timeout +#define RTSP_RX_SUCC 2 // rtsp data receive success + +#define RTSP_PARSE_FAIL -1 // rtsp message parse failed +#define RTSP_PARSE_MOREDATA 0 // need more data to parse rtsp message +#define RTSP_PARSE_SUCC 1 // rtsp message parse success + + + +class CRtspClient +{ +public: + CRtspClient(void); + ~CRtspClient(void); + +public: + BOOL rtsp_start(const char * suffix, const char * ip, int port, const char * user, const char * pass); + BOOL rtsp_start(const char * url, const char * user, const char * pass); + BOOL rtsp_play(int npt_start = 0); + BOOL rtsp_stop(); + BOOL rtsp_pause(); + BOOL rtsp_close(); + + RCUA * get_rua() {return &m_rua;} + char * get_url() {return m_url;} + char * get_ip() {return m_ip;} + int get_port() {return m_nport;} + char * get_user() {return m_rua.auth_info.auth_name;} + char * get_pass() {return m_rua.auth_info.auth_pwd;} + void set_notify_cb(notify_cb notify, void * userdata); + void set_video_cb(video_cb cb); + void set_audio_cb(audio_cb cb); + void set_metadata_cb(metadata_cb cb); + void set_rtcp_cb(rtcp_cb cb); + + /** + * @desc : set channel flags + * @params : + * channel: + * AV_VIDEO_CH : video channel + * AV_AUDIO_CH : audio channel + * AV_METADATA_CH : metadata channel + * AV_BACK_CH : audio back channel + * + * flag : 1 - If the SDP description has the channel information, then SETUP this channel, + * 0 - DO NOT SETUP THIS CHANNEL + * + * note : All channels are setup by default + */ + void set_channel(int channel, int flag); + + /** + * @desc : Set rtp multicast + * @params : + * flag : 1 - enable rtp multcast, 0 - disable rtp multcast + */ + void set_rtp_multicast(int flag); + + /** + * @desc : Set rtp over udp + * @params : + * flag : 1 - enable rtp over udp, 0 - disable rtp over udp + */ + void set_rtp_over_udp(int flag); + + /** + * @desc : Set rtsp over http + * @params : + * flag : 1 - enable rtsp over http, 0 - disable rtsp over http + * port : if flag = 1, specify the http port + */ + void set_rtsp_over_http(int flag, int port); + + /** + * @desc : Set rtsp over websocket + * @params : + * flag : 1 - enable rtsp over websocket, 0 - disable rtsp over websocket + * ws_uri : if flag = 1, specify the websocket port + */ + void set_rtsp_over_ws(int flag, int port); + + /** + * @desc : Set the data rx timeout, if the data is not received within the specified time, + * send RTSP_EVE_NODATA notification + * @params : + * timeout : Timeout value, unit is second + */ + void set_rx_timeout(int timeout); + + /** + * @desc : Set the connect timeout + * @params : + * timeout : Timeout value, unit is second + */ + void set_conn_timeout(int timeout); + + /** + * @desc : Get H264, SPS, PPS parameters, and return through the video callback function + */ + void get_h264_params(); + + /** + * @desc : Get H264, SPS, PPS parameters + * @params + * p_sps : Receive H264 SPS data, the buffer size is not less than 256 + * sps_len : Receive H264 SPS buffer length + * p_pps : Receive H264 PPS data, the buffer size is not less than 256 + * pps_len : Receive H264 PPS buffer length + */ + BOOL get_h264_params(uint8 * p_sps, int * sps_len, uint8 * p_pps, int * pps_len); + + /** + * @desc : Get H265, VPS, SPS, PPS parameters, and return through the video callback function + */ + void get_h265_params(); + + /** + * @desc : Get H265, VPS, SPS, PPS parameters + * @params + * p_sps : Receive H264 SPS data, the buffer size is not less than 256 + * sps_len : Receive H264 SPS buffer length + * p_pps : Receive H264 PPS data, the buffer size is not less than 256 + * pps_len : Receive H264 PPS buffer length + * p_vps : Receive H264 VPS data, the buffer size is not less than 256 + * vps_len : Receive H264 VPS buffer length + */ + BOOL get_h265_params(uint8 * p_sps, int * sps_len, uint8 * p_pps, int * pps_len, uint8 * p_vps, int * vps_len); + + /** + * @desc : If the describe request response returned by the server has an H264 SDP description, get the H264 SDP description + * @params + * p_sdp : Receive H264 SDP description + * max_len : Maximum length of buffer p_sdp + */ + BOOL get_h264_sdp_desc(char * p_sdp, int max_len); + + /** + * @desc : If the describe request response returned by the server has an H265 SDP description, get the H265 SDP description + * @params + * p_sdp : Receive H265 SDP description + * max_len : Maximum length of buffer p_sdp + */ + BOOL get_h265_sdp_desc(char * p_sdp, int max_len); + + /** + * @desc : If the describe request response returned by the server has an H265 SDP description, get the MP4 SDP description + * @params + * p_sdp : Receive MP4 SDP description + * max_len : Maximum length of buffer p_sdp + */ + BOOL get_mp4_sdp_desc(char * p_sdp, int max_len); + + /** + * @desc : If the describe request response returned by the server has an H265 SDP description, get the AAC SDP description + * @params + * p_sdp : Receive AAC SDP description + * max_len : Maximum length of buffer p_sdp + */ + BOOL get_aac_sdp_desc(char * p_sdp, int max_len); + + /** + * @desc : Get video codec + * @retrun : reference the media_format.h, VIDEO_CODEC_H264, ... + */ + int audio_codec() {return m_rua.audio_codec;} + + /** + * @desc : Get audio codec + * @retrun : reference the media_format.h, AUDIO_CODEC_AAC, ... + */ + int video_codec() {return m_rua.video_codec;} + + /** + * @desc : Get audio sample rate + */ + int get_audio_samplerate() {return m_rua.sample_rate;} + + /** + * @desc : Get audio channel numbers + */ + int get_audio_channels() {return m_rua.audio_channels;} + + /** + * @desc : Get audio bits per sample, for G726 decoder + */ + int get_audio_bitpersample() {return m_rua.bit_per_sample;} + + /** + * @desc : Get audio config data, for AAC + */ + uint8 * get_audio_config() {return m_rua.audio_spec;} + + /** + * @desc : Get audio config data length, for AAC + */ + int get_audio_config_len() {return m_rua.audio_spec_len;} + + /** + * @desc : get the audio backchannel flag + */ + int get_bc_flag(); + + /** + * @desc : set the audio backchannel flag + * @params + * flag : 1 - enable audio backchannel; 0 - disable audio backchannel + */ + void set_bc_flag(int flag); + + /** + * @desc : get the audio backchannel data sending flag + */ + int get_bc_data_flag(); + + /** + * @desc : set the audio backchannel data sending flag + * @params + * flag : 1 - enable audio backchannel data sending; 0 - disable audio backchannel data sending + */ + void set_bc_data_flag(int flag); + + /** + * @desc : set the audio backchannel audio capture device index + * @params + * index : audio capture device index + */ + void set_audio_device(int index); + + /** + * @desc : get the replay flag + */ + int get_replay_flag(); + + /** + * @desc : set the replay flag + * @params + * flag : 1 - enable replay; 0 - disable replay + */ + void set_replay_flag(int flag); + + /** + * @desc : set the scale info + * @params + * scale : when not set the rata control flag, the scale is valid. + * It shall be either 1.0 or -1.0, to indicate forward or reverse playback respectively. + * If it is not present, forward playback is assumed + */ + void set_scale(double scale); + + /** + * @desc : set the rate control flag + * @params + * flag : + * 1-the stream is delivered in real time using standard RTP timing mechanisms + * 0-the stream is delivered as fast as possible, using only the flow control provided by the transport to limit the delivery rate + */ + void set_rate_control_flag(int flag); + + /** + * @desc : set the immediate flag + * @params + * flag : + * 1 - immediately start playing from the new location, cancelling any existing PLAY command. + * The first packet sent from the new location shall have the D (discontinuity) bit set in its RTP extension header. + */ + void set_immediate_flag(int flag); + + /** + * @desc : set the frame flag + * @params + * flag : + * 0 - all frames + * 1 - I-frame and P-frame + * 2 - I-frame + * interval : + * when flag = 2, set the I-frame interval + */ + void set_frames_flag(int flag, int interval); + + /** + * @desc : set replay range + * @params + * start : the replay start timestamp + * end : the replay end timestamp + */ + void set_replay_range(time_t start, time_t end); + + void tcp_rx_thread(); + void udp_rx_thread(); + void rtsp_video_data_cb(uint8 * p_data, int len, uint32 ts, uint32 seq); + void rtsp_audio_data_cb(uint8 * p_data, int len, uint32 ts, uint32 seq); + void rtsp_meta_data_cb(uint8 * p_data, int len, uint32 ts, uint32 seq); + +private: + void set_default(); + BOOL rtsp_client_start(); + void rtsp_client_stop(RCUA * p_rua); + BOOL rtsp_client_state(RCUA * p_rua, HRTSP_MSG * rx_msg); + int rtsp_epoll_rx(); + int rtsp_tcp_data_rx(RCUA * p_rua); + int rtsp_over_tcp_rx(RCUA * p_rua); + int rtsp_tcp_rx(); + int rtsp_udp_rx(); + int rtsp_msg_parser(RCUA * p_rua); + void rtsp_keep_alive(); + BOOL rtsp_setup_channel(RCUA * p_rua, int av_t); + + BOOL make_prepare_play(); + BOOL rtsp_unauth_res(RCUA * p_rua, HRTSP_MSG * rx_msg); + BOOL rtsp_options_res(RCUA * p_rua, HRTSP_MSG * rx_msg); + BOOL rtsp_describe_res(RCUA * p_rua, HRTSP_MSG * rx_msg); + BOOL rtsp_setup_res(RCUA * p_rua, HRTSP_MSG * rx_msg, int av_t); + BOOL rtsp_play_res(RCUA * p_rua, HRTSP_MSG * rx_msg); + + BOOL rtsp_init_backchannel(RCUA * p_rua); + BOOL rtsp_get_bc_media_info(); + + void send_notify(int event); + + BOOL rtsp_get_transport_info(RCUA * p_rua, HRTSP_MSG * rx_msg, int av_type); + void rtsp_get_video_size(int * w, int * h); + BOOL rtsp_get_video_media_info(); + BOOL rtsp_get_audio_media_info(); + + void tcp_data_rx(uint8 * lpData, int rlen); + void udp_data_rx(uint8 * lpData, int rlen, int type); + void rtcp_data_rx(uint8 * lpData, int rlen, int type); + + void rtsp_send_h264_params(RCUA * p_rua); + void rtsp_send_h265_params(RCUA * p_rua); + void rtsp_get_mpeg4_config(RCUA * p_rua); + void rtsp_get_aac_config(RCUA * p_rua); + + int rtsp_build_http_get_req(void * p_user, char * bufs, int buflen, char * cookie); + int rtsp_build_http_post_req(void * p_user, char * bufs, int buflen, char * cookie); + BOOL rtsp_over_http_start(); + int rtsp_over_http_rx(RCUA * p_rua); + + int rtsp_build_ws_req(void * p_user, char * bufs, int buflen); + BOOL rtsp_over_ws_start(); + BOOL rtsp_ws_ping_process(RCUA * p_rua, char * p_buff, int len); + BOOL rtsp_ws_rtsp_process(RCUA * p_rua, char * p_buff, int len); + BOOL rtsp_ws_data_process(RCUA * p_rua); + int rtsp_over_ws_rx(RCUA * p_rua); + +private: + RCUA m_rua; + char m_url[256]; + char m_ip[128]; + char m_suffix[128]; + int m_nport; + + int m_ep_fd; + struct epoll_event * m_ep_events; + int m_ep_event_num; + + notify_cb m_pNotify; + void * m_pUserdata; + video_cb m_pVideoCB; + audio_cb m_pAudioCB; + rtcp_cb m_pRtcpCB; + metadata_cb m_pMetadataCB; + void * m_pMutex; + int m_nRxTimeout; + int m_nConnTimeout; + int m_nWidth; + int m_nHeight; + + union { + H264RXI h264rxi; + H265RXI h265rxi; + MJPEGRXI mjpegrxi; + MPEG4RXI mpeg4rxi; + }; + + union { + AACRXI aacrxi; + PCMRXI pcmrxi; + }; + + PCMRXI metadatarxi; + + BOOL m_bRunning; + pthread_t m_tcpRxTid; + pthread_t m_udpRxTid; +}; + + + +#endif // RTSP_CLN_H + + + diff --git a/MediaClient/MediaClient/rtsp/rtsp_parse.cpp b/MediaClient/MediaClient/rtsp/rtsp_parse.cpp new file mode 100644 index 0000000..1ed051b --- /dev/null +++ b/MediaClient/MediaClient/rtsp/rtsp_parse.cpp @@ -0,0 +1,1839 @@ +/*************************************************************************************** + * + * 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 "word_analyse.h" +#include "rtsp_parse.h" +#include "http_cln.h" + +/**************************************************************************/ +const RREQMTV rtsp_req_mtvs[] = +{ + {RTSP_MT_DESCRIBE, "DESCRIBE", 8}, + {RTSP_MT_ANNOUNCE, "ANNOUNCE", 8}, + {RTSP_MT_OPTIONS, "OPTIONS", 7}, + {RTSP_MT_PAUSE, "PAUSE", 5}, + {RTSP_MT_PLAY, "PLAY", 4}, + {RTSP_MT_RECORD, "RECORD", 6}, + {RTSP_MT_REDIRECT, "REDIRECT", 8}, + {RTSP_MT_SETUP, "SETUP", 5}, + {RTSP_MT_SET_PARAMETER, "SET_PARAMETER",13}, + {RTSP_MT_GET_PARAMETER, "GET_PARAMETER",13}, + {RTSP_MT_TEARDOWN, "TEARDOWN", 8} +}; + +/**************************************************************************/ +BOOL rtsp_is_rtsp_msg(char * msg_buf) +{ + uint32 i; + for (i=0; i < sizeof(rtsp_req_mtvs)/sizeof(RREQMTV); i++) + { + if (memcmp(msg_buf, rtsp_req_mtvs[i].msg_str, rtsp_req_mtvs[i].msg_len) == 0) + { + return TRUE; + } + } + + if (memcmp(msg_buf, "RTSP/1.0", strlen("RTSP/1.0")) == 0) + { + return TRUE; + } + + return FALSE; +} + +void rtsp_headl_parse(char * pline, int llen, HRTSP_MSG * p_msg) +{ + char word_buf[256]; + int word_len; + int next_word_offset; + BOOL bHaveNextWord; + + bHaveNextWord = GetLineWord(pline, 0, llen, word_buf, sizeof(word_buf), &next_word_offset, WORD_TYPE_STRING); + word_len = (int)strlen(word_buf); + if (word_len > 0 && word_len < 31) + { + memcpy(p_msg->first_line.header, pline, word_len); + p_msg->first_line.header[word_len] = '\0'; + + while (pline[next_word_offset] == ' ') + { + next_word_offset++; + } + + p_msg->first_line.value_string = pline+next_word_offset; + p_msg->first_line.value_string[llen-next_word_offset] = '\0'; + + if (strcasecmp(word_buf, "RTSP/1.0") == 0) + { + if (bHaveNextWord) + { + word_len = sizeof(word_buf); + bHaveNextWord = GetLineWord(pline, next_word_offset, llen, word_buf, sizeof(word_buf), &next_word_offset, WORD_TYPE_NUM); + word_len = (int)strlen(word_buf); + if (word_len > 0) + { + p_msg->msg_type = 1; + p_msg->msg_sub_type = atoi(word_buf); + } + } + } + else + { + uint32 i; + + p_msg->msg_type = 0; + + for (i=0; i < sizeof(rtsp_req_mtvs)/sizeof(RREQMTV); i++) + { + if (strcasecmp(word_buf, (char *)(rtsp_req_mtvs[i].msg_str)) == 0) + { + p_msg->msg_sub_type = rtsp_req_mtvs[i].msg_type; + break; + } + } + } + } +} + +int rtsp_line_parse(char * p_buf, int max_len, char sep_char, PPSN_CTX * p_ctx) +{ + char word_buf[256]; + BOOL bHaveNextLine = TRUE; + int line_len = 0; + int parse_len = 0; + + char * ptr = p_buf; + + do { + if (GetSipLine(ptr, max_len, &line_len, &bHaveNextLine) == FALSE) + { + return -1; + } + + if (line_len <= 2) + { + return(parse_len + line_len); + } + + int next_word_offset = 0; + GetLineWord(ptr, 0, line_len-2, word_buf, sizeof(word_buf), &next_word_offset, WORD_TYPE_STRING); + + char nchar = *(ptr + next_word_offset); + if (nchar != sep_char) // SIP is ':',SDP is '=' + { + return -1; + } + + next_word_offset++; + while (ptr[next_word_offset] == ' ') + { + next_word_offset++; + } + + HDRV * pHdrV = hdrv_buf_get_idle(); + if (pHdrV == NULL) + { + log_print(HT_LOG_ERR, "%s, hdrv_buf_get_idle return NULL!!!\r\n", __FUNCTION__); + return -1; + } + + strncpy(pHdrV->header, word_buf, 31); + pHdrV->value_string = ptr+next_word_offset; + pps_ctx_ul_add(p_ctx, pHdrV); + + ptr += line_len; + max_len -= line_len; + parse_len += line_len; + + while (*ptr == '\r' || *ptr == '\n') + { + ptr++; + parse_len++; + } + } while (bHaveNextLine); + + return parse_len; +} + +int rtsp_ctx_parse(HRTSP_MSG * p_msg) +{ + int flag = 0; + RTSPCTXT w_ctx_type; + + HDRV * pHdrV = (HDRV *)pps_lookup_start(&(p_msg->rtsp_ctx)); + while (pHdrV != NULL) + { + if (strcasecmp(pHdrV->header, "Content-Length") == 0) + { + p_msg->ctx_len = atol(pHdrV->value_string); + flag++; + } + else if (strcasecmp(pHdrV->header, "Content-Type") == 0) + { + char type_word[64]; + int next_tmp; + GetLineWord(pHdrV->value_string, 0, (int)strlen(pHdrV->value_string), type_word, sizeof(type_word), &next_tmp, WORD_TYPE_STRING); + + if (strcasecmp(type_word, "application/sdp") == 0) + { + w_ctx_type = RTSP_CTX_SDP; + } + else + { + w_ctx_type = RTSP_CTX_NULL; + } + + p_msg->ctx_type = w_ctx_type; + flag++; + } + + pHdrV = (HDRV *)pps_lookup_next(&(p_msg->rtsp_ctx), pHdrV); + } + pps_lookup_end(&(p_msg->rtsp_ctx)); + + if (p_msg->ctx_type && p_msg->ctx_len) + { + return 1; + } + + return 0; +} + +int rtsp_msg_parse(char * msg_buf, int msg_buf_len, HRTSP_MSG * msg) +{ + int line_len = 0; + BOOL bHaveNextLine; + char * p_buf = msg_buf; + + msg->msg_type = (uint32) -1; + + if (GetSipLine(p_buf, msg_buf_len, &line_len, &bHaveNextLine) == FALSE) + { + return -1; + } + + if (line_len > 0) + { + rtsp_headl_parse(p_buf, line_len-2, msg); + } + + if (msg->msg_type == (uint32) -1) + { + return -1; + } + + p_buf += line_len; + msg->rtsp_len = rtsp_line_parse(p_buf, msg_buf_len-line_len, ':', &(msg->rtsp_ctx)); + if (msg->rtsp_len <= 0) + { + return -1; + } + + p_buf += msg->rtsp_len; + + if (rtsp_ctx_parse(msg) == 1 && msg->ctx_len > 0) + { + msg->sdp_len = rtsp_line_parse(p_buf, msg->ctx_len, '=', &(msg->sdp_ctx)); + if (msg->sdp_len < 0) + { + return -1; + } + } + + return (line_len + msg->rtsp_len + msg->sdp_len); +} + +int rtsp_msg_parse_part1(char * p_buf, int buf_len, HRTSP_MSG * msg) +{ + int line_len = 0; + BOOL bHaveNextLine; + + msg->msg_type = (uint32) -1; + + if (GetSipLine(p_buf, buf_len, &line_len, &bHaveNextLine) == FALSE) + { + return -1; + } + + if (line_len > 0) + { + rtsp_headl_parse(p_buf, line_len-2, msg); + } + + if (msg->msg_type == (uint32) -1) + { + return -1; + } + + p_buf += line_len; + msg->rtsp_len = rtsp_line_parse(p_buf, buf_len-line_len, ':', &(msg->rtsp_ctx)); + if (msg->rtsp_len <= 0) + { + return -1; + } + + rtsp_ctx_parse(msg); + + return (line_len + msg->rtsp_len); +} + +int rtsp_msg_parse_part2(char * p_buf, int buf_len, HRTSP_MSG * msg) +{ + msg->sdp_len = rtsp_line_parse(p_buf, buf_len, '=', &(msg->sdp_ctx)); + if (msg->sdp_len < 0) + { + msg->sdp_len = rtsp_line_parse(p_buf, buf_len, ':', &(msg->sdp_ctx)); + if (msg->sdp_len < 0) + { + return -1; + } + } + + return msg->sdp_len; +} + +HDRV * rtsp_find_headline(HRTSP_MSG * msg, const char * head) +{ + if (msg == NULL || head == NULL) + { + return NULL; + } + + HDRV * line = (HDRV *)pps_lookup_start(&(msg->rtsp_ctx)); + while (line != NULL) + { + if (strcasecmp(line->header, head) == 0) + { + return line; + } + + line = (HDRV *)pps_lookup_next(&(msg->rtsp_ctx), line); + } + pps_lookup_end(&(msg->rtsp_ctx)); + + return NULL; +} + +HDRV * rtsp_find_headline_next(HRTSP_MSG * msg, const char * head, HDRV * hrv) +{ + HDRV * line; + + if (msg == NULL || head == NULL) + { + return NULL; + } + + line = (HDRV *)pps_lookup_start(&(msg->rtsp_ctx)); + while (line != NULL) + { + if (line == hrv) + { + line = (HDRV *)pps_lookup_next(&(msg->rtsp_ctx), line); + break; + } + + line = (HDRV *)pps_lookup_next(&(msg->rtsp_ctx), line); + } + + while (line != NULL) + { + if (strcasecmp(line->header, head) == 0) + { + pps_lookup_end(&(msg->rtsp_ctx)); + return line; + } + + line = (HDRV *)pps_lookup_next(&(msg->rtsp_ctx), line); + } + pps_lookup_end(&(msg->rtsp_ctx)); + + return NULL; +} + +BOOL rtsp_get_headline_string(HRTSP_MSG * rx_msg, const char * head, char * p_value, int size) +{ + HDRV * rx_head = rtsp_find_headline(rx_msg, head); + if (rx_head == NULL || p_value == NULL) + { + return FALSE; + } + + if (rx_head->value_string == NULL) + { + return FALSE; + } + + p_value[0] = '\0'; + + int len = (int)strlen(rx_head->value_string); + if (len >= size) + { + log_print(HT_LOG_ERR, "%s, %s, value_string(%s) len(%d) > size(%d)\r\n", + __FUNCTION__, head, rx_head->value_string, len, size); + return FALSE; + } + + strcpy(p_value, rx_head->value_string); + + return TRUE; +} + +BOOL rtsp_get_headline_uri(HRTSP_MSG * rx_msg, char * p_uri, int size) +{ + char * p_ptr = rx_msg->first_line.value_string; + if (p_ptr == NULL) + { + return FALSE; + } + + char * p_end = p_ptr; + while (*p_end != ' ') + { + p_end++; + } + + int len = (int)(p_end - p_ptr); + if (len >= size) + { + return FALSE; + } + + memcpy(p_uri, p_ptr, len); + p_uri[len] = '\0'; + + return TRUE; +} + +HDRV * rtsp_find_sdp_headline(HRTSP_MSG * msg, const char * head) +{ + if (msg == NULL || head == NULL) + { + return NULL; + } + + HDRV * line = (HDRV *)pps_lookup_start(&(msg->sdp_ctx)); + while (line != NULL) + { + if (strcasecmp(line->header, head) == 0) + { + return line; + } + + line = (HDRV *)pps_lookup_next(&(msg->sdp_ctx), line); + } + pps_lookup_end(&(msg->sdp_ctx)); + + return NULL; +} + +BOOL rtsp_msg_with_sdp(HRTSP_MSG * msg) +{ + if (msg == NULL) + { + return FALSE; + } + + if (msg->sdp_ctx.node_num == 0) + { + return FALSE; + } + + return TRUE; +} + +BOOL rtsp_get_msg_session(HRTSP_MSG * rx_msg, char *session_buf, int len) +{ + session_buf[0] = '\0'; + + HDRV * rx_id = rtsp_find_headline(rx_msg, "Session"); + if (rx_id == NULL || len <= 0) + { + return FALSE; + } + + int next_word_offset; + + GetLineWord(rx_id->value_string, 0, (int)strlen(rx_id->value_string), session_buf, len, &next_word_offset, WORD_TYPE_STRING); + + return TRUE; +} + +BOOL rtsp_match_msg_session(HRTSP_MSG * rx_msg, HRTSP_MSG * tx_msg) +{ + HDRV * rx_id = rtsp_find_headline(rx_msg, "Session"); + HDRV * tx_id = rtsp_find_headline(tx_msg, "Session"); + + if (rx_id == NULL || tx_id == NULL) + { + return FALSE; + } + + char rx_word_buf[256]; + char tx_word_buf[256]; + int next_word_offset; + + GetLineWord(rx_id->value_string, 0, (int)strlen(rx_id->value_string), + rx_word_buf, sizeof(rx_word_buf), &next_word_offset, WORD_TYPE_STRING); + GetLineWord(tx_id->value_string, 0, (int)strlen(tx_id->value_string), + tx_word_buf, sizeof(tx_word_buf), &next_word_offset, WORD_TYPE_STRING); + + if (strcmp(rx_word_buf, tx_word_buf) != 0) + { + return FALSE; + } + + return TRUE; +} + +BOOL rtsp_match_msg_cseq(HRTSP_MSG * rx_msg, HRTSP_MSG * tx_msg) +{ + HDRV * rx_cseq = rtsp_find_headline(rx_msg, "CSeq"); + HDRV * tx_cseq = rtsp_find_headline(tx_msg, "CSeq"); + + if (rx_cseq == NULL || tx_cseq == NULL) + { + return FALSE; + } + + char rx_word_buf[256]; + char tx_word_buf[256]; + int next_offset; + + GetLineWord(rx_cseq->value_string, 0, (int)strlen(rx_cseq->value_string), + rx_word_buf, sizeof(rx_word_buf), &next_offset, WORD_TYPE_NUM); + GetLineWord(tx_cseq->value_string, 0, (int)strlen(tx_cseq->value_string), + tx_word_buf, sizeof(tx_word_buf), &next_offset, WORD_TYPE_NUM); + + if (strcmp(rx_word_buf, tx_word_buf) != 0) + { + return FALSE; + } + + GetLineWord(rx_cseq->value_string, next_offset, (int)strlen(rx_cseq->value_string), + rx_word_buf, sizeof(rx_word_buf), &next_offset, WORD_TYPE_STRING); + GetLineWord(tx_cseq->value_string, next_offset, (int)strlen(tx_cseq->value_string), + tx_word_buf, sizeof(tx_word_buf), &next_offset, WORD_TYPE_STRING); + + if (strcasecmp(rx_word_buf, tx_word_buf) != 0) + { + return FALSE; + } + + return TRUE; +} + +BOOL rtsp_get_msg_cseq(HRTSP_MSG * rx_msg, char *cseq_buf, int len) +{ + HDRV * rx_cseq = rtsp_find_headline(rx_msg, "CSeq"); + if ((rx_cseq == NULL) || len <= 0) + { + return FALSE; + } + + int next_offset; + + GetLineWord(rx_cseq->value_string, 0, (int)strlen(rx_cseq->value_string), cseq_buf, len, &next_offset, WORD_TYPE_NUM); + + return TRUE; +} + +BOOL rtsp_get_user_agent_info(HRTSP_MSG * rx_msg, char * agent_buf, int max_len) +{ + if (agent_buf == NULL || max_len <= 0) + { + return FALSE; + } + + agent_buf[0] = '\0'; + + HDRV * rx_line = rtsp_find_headline(rx_msg, "User-Agent"); + if (rx_line == NULL) + { + return FALSE; + } + + strncpy(agent_buf, rx_line->value_string, max_len); + + return TRUE; +} + +BOOL rtsp_get_session_info(HRTSP_MSG * rx_msg, char * session_buf, int max_len, int * timeout) +{ + if (session_buf == NULL || max_len <= 0) + { + return FALSE; + } + + HDRV * rx_line = rtsp_find_headline(rx_msg, "Session"); + if (rx_line == NULL) + { + return FALSE; + } + + session_buf[0] = '\0'; + + if (rx_line->value_string) + { + char * p = strchr(rx_line->value_string, ';'); + if (!p) + { + strncpy(session_buf, rx_line->value_string, max_len); + } + else + { + *p = '\0'; + strncpy(session_buf, rx_line->value_string, max_len); + *p = ';'; + } + + if (timeout) + { + char value_string[256] = {'\0'}; + strncpy(value_string, rx_line->value_string, sizeof(value_string)-1); + lowercase(value_string); + + p = strstr(value_string, "timeout="); + if (p) + { + p += strlen("timeout="); + *timeout = atoi(p); + + if (*timeout <= 0) + { + *timeout = 60; + } + else if (*timeout < 10) + { + *timeout = 10; + } + } + } + } + + return TRUE; +} + +BOOL rtsp_get_rtp_info(HRTSP_MSG * rx_msg, char * v_ctl, uint32 * p_v_ts, char * a_ctl, uint32 * p_a_ts) +{ + HDRV * rx_line = rtsp_find_headline(rx_msg, "RTP-Info"); + if (rx_line == NULL) + { + return FALSE; + } + + if (NULL == rx_line->value_string) + { + return FALSE; + } + + // set default value -1 + *p_v_ts = -1; + *p_a_ts = -1; + + if (v_ctl && v_ctl[0] != '\0') + { + int ctl_len; + char * p = strchr(v_ctl, '?'); + if (p) + { + char ctl[128] = {'\0'}; + strncpy(ctl, v_ctl, p-v_ctl); + + p = strstr(rx_line->value_string, ctl); + ctl_len = strlen(ctl); + } + else + { + p = strstr(rx_line->value_string, v_ctl); + ctl_len = strlen(v_ctl); + } + + if (p) + { + p += ctl_len; + + int i = 0, j = 0; + char * p_buff = NULL; + char * p_semicolon = strchr(p, ','); + char * p_rtptime = strstr(p, "rtptime="); + char rtptime[32] = {'\0'}; + + if (p_rtptime) + { + if (p_semicolon) + { + if (p_rtptime < p_semicolon) + { + p_buff = p_rtptime+strlen("rtptime="); + } + } + else + { + p_buff = p_rtptime+strlen("rtptime="); + } + + while (p_buff && p_buff[i] != '\0') + { + if (p_buff[i] == ',' || p_buff[i] == ';') + { + break; + } + else if (j < 31) + { + rtptime[j++] = p_buff[i]; + } + + i++; + } + + *p_v_ts = (uint32)strtoul(rtptime, NULL, 10); + } + } + } + + if (a_ctl && a_ctl[0] != '\0') + { + int ctl_len; + char * p = strchr(a_ctl, '?'); + if (p) + { + char ctl[128] = {'\0'}; + strncpy(ctl, a_ctl, p-a_ctl); + + p = strstr(rx_line->value_string, ctl); + ctl_len = strlen(ctl); + } + else + { + p = strstr(rx_line->value_string, a_ctl); + ctl_len = strlen(a_ctl); + } + + if (p) + { + p += ctl_len; + + int i = 0, j = 0; + char * p_buff = NULL; + char * p_semicolon = strchr(p, ','); + char * p_rtptime = strstr(p, "rtptime="); + char rtptime[32] = {'\0'}; + + if (p_rtptime) + { + if (p_semicolon) + { + if (p_rtptime < p_semicolon) + { + p_buff = p_rtptime+strlen("rtptime="); + } + } + else + { + p_buff = p_rtptime+strlen("rtptime="); + } + + while (p_buff && p_buff[i] != '\0') + { + if (p_buff[i] == ',' || p_buff[i] == ';') + { + break; + } + else if (j < 31) + { + rtptime[j++] = p_buff[i]; + } + + i++; + } + + *p_a_ts = (uint32)strtoul(rtptime, NULL, 10); + } + } + } + + return TRUE; +} + +BOOL rtsp_get_tcp_transport_info(HRTSP_MSG * rx_msg, uint16 * interleaved) +{ + BOOL ret = FALSE; + + HDRV * rx_line = rtsp_find_headline(rx_msg, "Transport"); + if (rx_line == NULL) + { + return FALSE; + } + + if (rx_line->value_string) + { + char buff[32] = {'\0'}; + if (GetNameValuePair(rx_line->value_string, (int)strlen(rx_line->value_string), "interleaved", buff, sizeof(buff)-1)) + { + if (interleaved) + { + *interleaved = atoi(buff); + } + + ret = TRUE; + } + } + + return ret; +} + +BOOL rtsp_get_udp_transport_info(HRTSP_MSG * rx_msg, uint16 * client_port, uint16 * server_port) +{ + BOOL ret = FALSE; + + HDRV * rx_line = rtsp_find_headline(rx_msg, "Transport"); + if (rx_line == NULL) + { + return FALSE; + } + + if (rx_line->value_string) + { + char buff[32] = {'\0'}; + if (GetNameValuePair(rx_line->value_string, (int)strlen(rx_line->value_string), "client_port", buff, sizeof(buff)-1)) + { + if (client_port) + { + *client_port = atoi(buff); + } + + ret = TRUE; + } + + if (GetNameValuePair(rx_line->value_string, (int)strlen(rx_line->value_string), "server_port", buff, sizeof(buff)-1)) + { + if (server_port) + { + *server_port = atoi(buff); + } + + ret = TRUE; + } + } + + return ret; +} + +BOOL rtsp_get_mc_transport_info(HRTSP_MSG * rx_msg, char * destination, uint16 * port) +{ + BOOL ret = FALSE; + + HDRV * rx_line = rtsp_find_headline(rx_msg, "Transport"); + if (rx_line == NULL) + { + return FALSE; + } + + if (rx_line->value_string) + { + char buff[32] = {'\0'}; + if (GetNameValuePair(rx_line->value_string, (int)strlen(rx_line->value_string), "destination", buff, sizeof(buff)-1)) + { + if (destination) + { + strcpy(destination, buff); + } + + ret = TRUE; + } + + if (GetNameValuePair(rx_line->value_string, (int)strlen(rx_line->value_string), "port", buff, sizeof(buff)-1)) + { + if (port) + { + *port = atoi(buff); + } + + ret = TRUE; + } + } + + return ret; +} + +BOOL rtsp_is_line_exist(HRTSP_MSG * rx_msg, const char * head, const char * value) +{ + char buf[256]; + char lovalue[256] = {'\0'}; + + if (!rtsp_get_headline_string(rx_msg, head, buf, sizeof(buf))) + { + return FALSE; + } + + strncpy(lovalue, value, sizeof(lovalue)-1); + + lowercase(buf); + lowercase(lovalue); + + if (!strstr(buf, lovalue)) + { + return FALSE; + } + + return TRUE; +} + +BOOL rtsp_get_cbase_info(HRTSP_MSG * rx_msg, char * cbase_buf, int max_len) +{ + if (cbase_buf == NULL || max_len <= 0) + { + return FALSE; + } + + cbase_buf[0] = '\0'; + + HDRV * rx_line = rtsp_find_headline(rx_msg, "Content-Base"); + if (rx_line == NULL) + { + return FALSE; + } + + strncpy(cbase_buf, rx_line->value_string, max_len); + + return TRUE; +} + +void rtsp_add_tx_msg_line(HRTSP_MSG * tx_msg, const char * msg_hdr, const char * msg_fmt, ...) +{ + int slen; + va_list argptr; + + if (tx_msg == NULL || tx_msg->msg_buf == NULL) + { + return; + } + + HDRV *pHdrV = hdrv_buf_get_idle(); + if (pHdrV == NULL) + { + log_print(HT_LOG_ERR, "%s, hdrv_buf_get_idle return NULL!!!\r\n", __FUNCTION__); + return; + } + + pHdrV->value_string = tx_msg->msg_buf + tx_msg->buf_offset; + + strncpy(pHdrV->header, msg_hdr, 31); + + va_start(argptr, msg_fmt); + +#if __LINUX_OS__ + slen = vsnprintf(pHdrV->value_string, 1600-tx_msg->buf_offset, msg_fmt, argptr); +#else + slen = vsprintf(pHdrV->value_string, msg_fmt, argptr); +#endif + + va_end(argptr); + + if (slen < 0) + { + log_print(HT_LOG_ERR, "%s, vsnprintf return %d !!!\r\n", __FUNCTION__, slen); + hdrv_buf_free(pHdrV); + return; + } + + pHdrV->value_string[slen] = '\0'; + tx_msg->buf_offset += slen + 1; + + pps_ctx_ul_add(&(tx_msg->rtsp_ctx), pHdrV); +} + +void rtsp_add_tx_msg_sdp_line(HRTSP_MSG * tx_msg, const char * msg_hdr, const char * msg_fmt, ...) +{ + int slen; + va_list argptr; + + if (tx_msg == NULL || tx_msg->msg_buf == NULL) + { + return; + } + + HDRV *pHdrV = hdrv_buf_get_idle(); + if (pHdrV == NULL) + { + log_print(HT_LOG_ERR, "%s, hdrv_buf_get_idle return NULL!!!\r\n", __FUNCTION__); + return; + } + + pHdrV->value_string = tx_msg->msg_buf + tx_msg->buf_offset; + + strncpy(pHdrV->header, msg_hdr, 31); + + va_start(argptr, msg_fmt); + +#if __LINUX_OS__ + slen = vsnprintf(pHdrV->value_string, 1600-tx_msg->buf_offset, msg_fmt, argptr); +#else + slen = vsprintf(pHdrV->value_string, msg_fmt, argptr); +#endif + + va_end(argptr); + + if (slen < 0) + { + log_print(HT_LOG_ERR, "%s, vsnprintf return %d !!!\r\n", __FUNCTION__, slen); + hdrv_buf_free(pHdrV); + return; + } + + pHdrV->value_string[slen] = '\0'; + tx_msg->buf_offset += slen + 1; + + pps_ctx_ul_add(&(tx_msg->sdp_ctx), pHdrV); +} + +void rtsp_add_tx_msg_fline(HRTSP_MSG * tx_msg, const char * msg_hdr, const char * msg_fmt, ...) +{ + int slen; + va_list argptr; + + if (tx_msg == NULL || tx_msg->msg_buf == NULL) + { + return; + } + + strncpy(tx_msg->first_line.header, msg_hdr, sizeof(tx_msg->first_line.header)-1); + tx_msg->first_line.value_string = tx_msg->msg_buf + tx_msg->buf_offset; + + va_start(argptr, msg_fmt); +#if __LINUX_OS__ + slen = vsnprintf(tx_msg->first_line.value_string, 1600-tx_msg->buf_offset, msg_fmt, argptr); +#else + slen = vsprintf(tx_msg->first_line.value_string, msg_fmt, argptr); +#endif + va_end(argptr); + + if (slen < 0) + { + log_print(HT_LOG_ERR, "%s, vsnprintf return %d !!!\r\n", __FUNCTION__, slen); + return; + } + + tx_msg->first_line.value_string[slen] = '\0'; + + tx_msg->buf_offset += slen + 1; +} + +void rtsp_copy_msg_line(HRTSP_MSG * src_msg, HRTSP_MSG * dst_msg, char * msg_hdr) +{ + HDRV * src_line = rtsp_find_headline(src_msg, msg_hdr); + if (src_line == NULL) + { + return; + } + + HDRV * dst_line = hdrv_buf_get_idle(); + if (dst_line == NULL) + { + return; + } + + strcpy(dst_line->header, src_line->header); + + dst_line->value_string = dst_msg->msg_buf + dst_msg->buf_offset; + if (dst_line->value_string == NULL) + { + hdrv_buf_free(dst_line); + return; + } + + strcpy(dst_line->value_string, src_line->value_string); + dst_msg->buf_offset += (int)strlen(src_line->value_string) + 1; + + pps_ctx_ul_add(&(dst_msg->rtsp_ctx), dst_line); +} + +void rtsp_free_msg(HRTSP_MSG * msg) +{ + if (msg == NULL) + { + return; + } + + rtsp_free_msg_content(msg); + rtsp_free_msg_buf(msg); +} + +void rtsp_free_msg_content(HRTSP_MSG * msg) +{ + if (msg == NULL) + { + return; + } + + hdrv_ctx_free(&(msg->rtsp_ctx)); + hdrv_ctx_free(&(msg->sdp_ctx)); + + net_buf_free(msg->msg_buf); +} + +BOOL rtsp_get_remote_media_ip(HRTSP_MSG * rx_msg, uint32 * media_ip) +{ + HDRV * pHdr = rtsp_find_sdp_headline(rx_msg, "c"); + if ((pHdr != NULL) && (pHdr->value_string != NULL) && (strlen(pHdr->value_string) > 0)) + { + char tmp_buf[128]; + int next_offset; + + GetLineWord(pHdr->value_string, 0, (int)strlen(pHdr->value_string), + tmp_buf, sizeof(tmp_buf), &next_offset, WORD_TYPE_STRING); + if (strcasecmp(tmp_buf, "IN") != 0) + { + return FALSE; + } + + GetLineWord(pHdr->value_string, next_offset, (int)strlen(pHdr->value_string), + tmp_buf, sizeof(tmp_buf), &next_offset, WORD_TYPE_STRING); + if (strcasecmp(tmp_buf, "IP4") != 0) + { + return FALSE; + } + + GetLineWord(pHdr->value_string, next_offset, (int)strlen(pHdr->value_string), + tmp_buf, sizeof(tmp_buf), &next_offset, WORD_TYPE_STRING); + + log_print(HT_LOG_DBG, "%s, media_ip=%s\r\n", __FUNCTION__, tmp_buf); + + if (is_ip_address(tmp_buf)) + { + *media_ip = inet_addr(tmp_buf); + return TRUE; + } + } + + return FALSE; +} + +HDRV * rtsp_find_mdesc_point(HRTSP_MSG * rx_msg, HDRV * pStartHdr, const char * cap_name, int * next_offset, const char * attr) +{ + char media_type[16]; + HDRV * pHdr = pStartHdr; + HDRV * pHdr1 = NULL; + + for (; pHdr != NULL; pHdr = (HDRV *)pps_lookup_next(&(rx_msg->sdp_ctx),pHdr)) + { + if (strcasecmp(pHdr->header, "m") != 0) + { + continue; + } + + GetLineWord(pHdr->value_string, 0, (int)strlen(pHdr->value_string), media_type, sizeof(media_type), next_offset, WORD_TYPE_STRING); + + if (strcasecmp(media_type, cap_name) != 0) + { + continue; + } + + if (NULL == attr) + { + return pHdr; + } + + pHdr1 = (HDRV *)pps_lookup_next(&(rx_msg->sdp_ctx), pHdr); + + for (; pHdr1 != NULL; pHdr1 = (HDRV *)pps_lookup_next(&(rx_msg->sdp_ctx), pHdr1)) + { + if (strcasecmp(pHdr1->header, "m") == 0) + { + break; + } + + if (pHdr1->value_string && (pHdr1->header[0] == 'a') && (memcmp(pHdr1->value_string, attr, strlen(attr)) == 0)) + { + return pHdr; + } + } + } + + return NULL; +} + +BOOL rtsp_get_remote_cap(HRTSP_MSG * rx_msg, const char * cap_name, int * cap_count, uint8 * cap_array, uint16 * rtp_port, const char * attr) +{ + int next_offset = 0; + char media_port[16],tmp_buf[64]; + + *cap_count = 0; + + HDRV * pHdr = (HDRV *)pps_lookup_start(&(rx_msg->sdp_ctx)); + + pHdr = rtsp_find_mdesc_point(rx_msg, pHdr, cap_name, &next_offset, attr); + if (pHdr == NULL) + { + pps_lookup_end(&(rx_msg->sdp_ctx)); + return FALSE; + } + + GetLineWord(pHdr->value_string, next_offset, (int)strlen(pHdr->value_string), + media_port, sizeof(media_port), &next_offset, WORD_TYPE_NUM); + + GetLineWord(pHdr->value_string, next_offset, (int)strlen(pHdr->value_string), + tmp_buf, sizeof(tmp_buf), &next_offset, WORD_TYPE_STRING); + + if (strcasecmp(tmp_buf, "RTP/AVP") != 0) + { + pps_lookup_end(&(rx_msg->sdp_ctx)); + return FALSE; + } + + int count = 0; + BOOL cap_next_flag = TRUE; + + do { + cap_next_flag = GetLineWord(pHdr->value_string, next_offset, (int)strlen(pHdr->value_string), + tmp_buf, sizeof(tmp_buf), &next_offset, WORD_TYPE_NUM); + if (tmp_buf[0] != '\0') + { + if (count >= MAX_AVN) + { + pps_lookup_end(&(rx_msg->sdp_ctx)); + return FALSE; + } + + cap_array[count++] = (uint8)atol(tmp_buf); + *cap_count = count; + } + } while (cap_next_flag); + + if (count > 0) + { + if (rtp_port) + { + *rtp_port = (uint16)atol(media_port); + } + + pps_lookup_end(&(rx_msg->sdp_ctx)); + return TRUE; + } + + pps_lookup_end(&(rx_msg->sdp_ctx)); + + return FALSE; +} + +BOOL rtsp_get_digest_info(HRTSP_MSG * rx_msg, HD_AUTH_INFO * p_auth) +{ + int len; + int next_offset; + char word_buf[128]; + HDRV * chap_id = NULL; + char * p; + + p_auth->auth_response[0] = '\0'; + +RETRY: + + if (chap_id) + { + chap_id = rtsp_find_headline_next(rx_msg, "WWW-Authenticate", chap_id); + } + else + { + chap_id = rtsp_find_headline(rx_msg, "WWW-Authenticate"); + } + + if (chap_id == NULL) + { + return FALSE; + } + + GetLineWord(chap_id->value_string, 0, (int)strlen(chap_id->value_string), + word_buf, sizeof(word_buf), &next_offset, WORD_TYPE_STRING); + if (strcasecmp(word_buf, "digest") != 0) + { + goto RETRY; + } + + p = chap_id->value_string + next_offset; + len = (int)strlen(chap_id->value_string) - next_offset; + + if (!http_get_digest_params(p, len, p_auth)) + { + goto RETRY; + } + + if (p_auth->auth_algorithm[0] != '\0' && + strncasecmp(p_auth->auth_algorithm, "MD5", 3) && + strncasecmp(p_auth->auth_algorithm, "SHA-256", 7)) + { + goto RETRY; + } + + return TRUE; +} + +BOOL rtsp_get_auth_digest_info(HRTSP_MSG * rx_msg, HD_AUTH_INFO * p_auth) +{ + int len; + int next_offset; + char word_buf[128]; + char * p; + + HDRV * res_line = rtsp_find_headline(rx_msg, "Authorization"); + if (res_line == NULL) + { + return FALSE; + } + + GetLineWord(res_line->value_string, 0, (int)strlen(res_line->value_string), + word_buf, sizeof(word_buf), &next_offset, WORD_TYPE_STRING); + + if (strcasecmp(word_buf, "digest") != 0) + { + return FALSE; + } + + p = res_line->value_string + next_offset; + len = (int)strlen(res_line->value_string) - next_offset; + + if (!GetNameValuePair(p, len, "username", p_auth->auth_name, sizeof(p_auth->auth_name))) + { + return FALSE; + } + + if (!GetNameValuePair(p, len, "realm", p_auth->auth_realm, sizeof(p_auth->auth_realm))) + { + return FALSE; + } + + if (!GetNameValuePair(p, len, "nonce", p_auth->auth_nonce, sizeof(p_auth->auth_nonce))) + { + return FALSE; + } + + if (!GetNameValuePair(p, len, "uri", p_auth->auth_uri, sizeof(p_auth->auth_uri))) + { + return FALSE; + } + + if (!GetNameValuePair(p, len, "response", p_auth->auth_response, sizeof(p_auth->auth_response))) + { + return FALSE; + } + + if (!GetNameValuePair(p, len, "algorithm", p_auth->auth_algorithm, sizeof(p_auth->auth_algorithm))) + { + p_auth->auth_algorithm[0] = '\0'; + } + + if (GetNameValuePair(p, len, "qop", p_auth->auth_qop, sizeof(p_auth->auth_qop))) + { + char * stop_string; + + if (!GetNameValuePair(p, len, "cnonce", p_auth->auth_cnonce, sizeof(p_auth->auth_cnonce))) + { + p_auth->auth_cnonce[0] = '\0'; + } + + if (!GetNameValuePair(p, len, "nc", p_auth->auth_ncstr, sizeof(p_auth->auth_ncstr))) + { + p_auth->auth_ncstr[0] = '\0'; + } + + p_auth->auth_nc = strtol(p_auth->auth_ncstr, &stop_string, 16); + + if (strlen(stop_string) > 0) + { + return FALSE; + } + } + else + { + p_auth->auth_qop[0] = '\0'; + p_auth->auth_cnonce[0] = '\0'; + p_auth->auth_ncstr[0] = '\0'; + p_auth->auth_nc = 0; + } + + return TRUE; +} + +BOOL rtsp_get_remote_cap_desc(HRTSP_MSG * rx_msg, const char * cap_name, char cap_desc[][MAX_AVDESCLEN], const char * attr) +{ + int next_offset = 0; + int index = 0; + + HDRV * pHdr = (HDRV *)pps_lookup_start(&(rx_msg->sdp_ctx)); + + pHdr = rtsp_find_mdesc_point(rx_msg, pHdr, cap_name, &next_offset, attr); + if (pHdr == NULL) + { + pps_lookup_end(&(rx_msg->sdp_ctx)); + return FALSE; + } + + for (index=0; indexsdp_ctx), pHdr); + while (pHdr != NULL) + { + if (strcasecmp(pHdr->header, "m") == 0) + { + break; + } + + if (index >= MAX_AVN) + { + break; + } + + snprintf(cap_desc[index], MAX_AVDESCLEN, "%s=%s", pHdr->header, pHdr->value_string); + + index++; + + pHdr = (HDRV *)pps_lookup_next(&(rx_msg->sdp_ctx), pHdr); + } + + pps_lookup_end(&(rx_msg->sdp_ctx)); + + return (index != 0); +} + +BOOL rtsp_find_sdp_control(HRTSP_MSG * rx_msg, char * ctl_buf, const char * tname, int max_len, const char *attr) +{ + if (rx_msg == NULL || ctl_buf == NULL) + { + return FALSE; + } + + int next_offset = 0; + int mlen = (int)strlen("control:"); + + ctl_buf[0] = '\0'; + + HDRV * pHdr = (HDRV *)pps_lookup_start(&(rx_msg->sdp_ctx)); + + pHdr = rtsp_find_mdesc_point(rx_msg, pHdr, tname, &next_offset, attr); + if (pHdr == NULL) + { + pps_lookup_end(&(rx_msg->sdp_ctx)); + return FALSE; + } + + pHdr = (HDRV *)pps_lookup_next(&(rx_msg->sdp_ctx), pHdr); + while (pHdr != NULL) + { + if (strcasecmp(pHdr->header, "m") == 0) + { + break; + } + + if (pHdr->value_string && pHdr->header[0] == 'a' && memcmp(pHdr->value_string, "control:", mlen) == 0) + { + int rlen = (int)strlen(pHdr->value_string) - mlen; + if (rlen > max_len) + { + rlen = max_len; + } + + int offset = 0; + + while (pHdr->value_string[offset+mlen] == ' ') + { + offset++; + } + + strcpy(ctl_buf, pHdr->value_string+offset+mlen); + + pps_lookup_end(&(rx_msg->sdp_ctx)); + + return TRUE; + } + + pHdr = (HDRV *)pps_lookup_next(&(rx_msg->sdp_ctx), pHdr); + } + + pps_lookup_end(&(rx_msg->sdp_ctx)); + + return FALSE; +} + +// a=range:npt=0-20.735 +BOOL rtsp_get_sdp_range(HRTSP_MSG * rx_msg, int * p_start, int * p_end) +{ + if (rx_msg == NULL) + { + return FALSE; + } + + *p_start = 0; + *p_end = 0; + + int mlen = (int)strlen("range:"); + + HDRV * pHdr = (HDRV *)pps_lookup_start(&(rx_msg->sdp_ctx)); + pHdr = (HDRV *)pps_lookup_next(&(rx_msg->sdp_ctx), pHdr); + while (pHdr != NULL) + { + if (strcasecmp(pHdr->header, "m") == 0) + { + break; + } + + if (pHdr->value_string && pHdr->header[0] == 'a' && memcmp(pHdr->value_string, "range:", mlen) == 0) + { + int i = 0; + int offset = 0; + int rlen = (int)strlen(pHdr->value_string) - mlen; + char start_buf[32] = {'\0'}, end_buf[32] = {'\0'}; + char * p_buff = start_buf; + + // skip space + while (pHdr->value_string[offset+mlen] == ' ') + { + offset++; + } + + if (rlen < offset + 4) + { + pps_lookup_end(&(rx_msg->sdp_ctx)); + return FALSE; + } + + if (pHdr->value_string[offset+mlen] != 'n' && + pHdr->value_string[offset+mlen+1] == 'p' && + pHdr->value_string[offset+mlen+2] == 't') + { + pps_lookup_end(&(rx_msg->sdp_ctx)); + return FALSE; + } + + offset += 3; // skip "npt" + + // skip space + while (pHdr->value_string[offset+mlen] == ' ') + { + offset++; + } + + if (pHdr->value_string[offset+mlen] != '=') + { + pps_lookup_end(&(rx_msg->sdp_ctx)); + return FALSE; + } + + offset++; // skip '=' + + while (pHdr->value_string[offset+mlen] != '\0') + { + if (pHdr->value_string[offset+mlen] == '-') + { + i = 0; + p_buff = end_buf; + } + else if (pHdr->value_string[offset+mlen] != ' ') + { + p_buff[i++] = pHdr->value_string[offset+mlen]; + + if (i >= 32) + { + pps_lookup_end(&(rx_msg->sdp_ctx)); + return FALSE; + } + } + + offset++; + } + + *p_start = (int)(atof(start_buf) * 1000); // convert to millisecond + *p_end = (int)(atof(end_buf) * 1000); + + break; + } + + pHdr = (HDRV *)pps_lookup_next(&(rx_msg->sdp_ctx), pHdr); + } + pps_lookup_end(&(rx_msg->sdp_ctx)); + + return TRUE; +} + +BOOL rtsp_is_support_mcast(HRTSP_MSG * rx_msg) +{ + BOOL ret = FALSE; + + HDRV * pHdr = (HDRV *)pps_lookup_start(&(rx_msg->sdp_ctx)); + while (pHdr != NULL) + { + if (strcasecmp(pHdr->header, "m") == 0) + { + break; + } + + if (strcasecmp(pHdr->header, "a") == 0) + { + if (strstr(pHdr->value_string, "type:broadcast")) + { + ret = TRUE; + break; + } + } + + pHdr = (HDRV *)pps_lookup_next(&(rx_msg->sdp_ctx), pHdr); + } + pps_lookup_end(&(rx_msg->sdp_ctx)); + + return ret; +} + +BOOL rtsp_get_scale_info(HRTSP_MSG * rx_msg, int * p_scale) +{ + if (rx_msg == NULL || p_scale == NULL) + { + return FALSE; + } + + HDRV * rx_line = rtsp_find_headline(rx_msg, "Scale"); + if (rx_line == NULL) + { + return FALSE; + } + + char * ptr = rx_line->value_string; + + while (*ptr == ' ' || *ptr == '\t') + { + ptr++; + } + + double scale = strtod(ptr, NULL); + if (scale == 0) + { + return FALSE; + } + + *p_scale = (int)(scale * 100); + + return TRUE; +} + +BOOL rtsp_get_rate_control(HRTSP_MSG * rx_msg, int * p_ratectrl) +{ + if (rx_msg == NULL || p_ratectrl == NULL) + { + return FALSE; + } + + HDRV * rx_line = rtsp_find_headline(rx_msg, "Rate-Control"); + if (rx_line == NULL) + { + return FALSE; + } + + char * ptr = rx_line->value_string; + + while (*ptr == ' ' || *ptr == '\t') + { + ptr++; + } + + int ratectrl = 1; + + if (strcasecmp(ptr, "no") == 0) + { + ratectrl = 0; + } + + *p_ratectrl = ratectrl; + + return TRUE; +} + +BOOL rtsp_get_immediate(HRTSP_MSG * rx_msg, int * p_imme) +{ + if (rx_msg == NULL || p_imme == NULL) + { + return FALSE; + } + + HDRV * rx_line = rtsp_find_headline(rx_msg, "Immediate"); + if (rx_line == NULL) + { + return FALSE; + } + + char * ptr = rx_line->value_string; + + while (*ptr == ' ' || *ptr == '\t') + { + ptr++; + } + + int imme = 0; + + if (strcasecmp(ptr, "yes") == 0) + { + imme = 1; + } + + *p_imme = imme; + + return TRUE; +} + +BOOL rtsp_get_frame_info(HRTSP_MSG * rx_msg, int * p_frame, int * p_interval) +{ + if (rx_msg == NULL || p_frame == NULL) + { + return FALSE; + } + + HDRV * rx_line = rtsp_find_headline(rx_msg, "Frames"); + if (rx_line == NULL) + { + return FALSE; + } + + char * ptr = rx_line->value_string; + + while (*ptr == ' ' || *ptr == '\t') + { + ptr++; + } + + int frame = 0; // all frames + + if (strncasecmp(ptr, "intra", 5) == 0) + { + frame = 2; // I-frame + + ptr += 5; + + while (*ptr == ' ' || *ptr == '\t') + { + ptr++; + } + + if (*ptr == '/') + { + ptr++; + + if (p_interval) + { + *p_interval = atoi(ptr); + } + } + } + else if (strcasecmp(ptr, "predicted") == 0) + { + frame = 1; // I-frame and P-frame + } + + *p_frame = frame; + + return TRUE; +} + + +/*****************************************************************/ +static PPSN_CTX * rtsp_msg_buf_fl = NULL; +static int rtsp_msg_buf_init_count = 0; +/*****************************************************************/ +BOOL rtsp_msg_buf_init(int num) +{ + rtsp_msg_buf_init_count++; + if (rtsp_msg_buf_fl) + { + return TRUE; + } + + rtsp_msg_buf_fl = pps_ctx_fl_init(num, sizeof(HRTSP_MSG), TRUE); + if (rtsp_msg_buf_fl == NULL) + { + return FALSE; + } + + return TRUE; +} + +void rtsp_msg_buf_deinit() +{ + rtsp_msg_buf_init_count--; + if (rtsp_msg_buf_init_count == 0) { + if (rtsp_msg_buf_fl) + { + pps_fl_free(rtsp_msg_buf_fl); + rtsp_msg_buf_fl = NULL; + } + } + if (rtsp_msg_buf_init_count < 0)rtsp_msg_buf_init_count = 0; + +} + +HRTSP_MSG * rtsp_get_msg_buf() +{ + HRTSP_MSG * tx_msg = (HRTSP_MSG *)pps_fl_pop(rtsp_msg_buf_fl); + if (tx_msg == NULL) + { + return NULL; + } + + memset(tx_msg, 0, sizeof(HRTSP_MSG)); + + tx_msg->msg_buf = net_buf_get_idle(); + if (tx_msg->msg_buf == NULL) + { + rtsp_free_msg_buf(tx_msg); + return NULL; + } + + rtsp_msg_ctx_init(tx_msg); + + return tx_msg; +} + +void rtsp_msg_ctx_init(HRTSP_MSG * msg) +{ + pps_ctx_ul_init_nm(hdrv_buf_fl, &(msg->rtsp_ctx)); + pps_ctx_ul_init_nm(hdrv_buf_fl, &(msg->sdp_ctx)); +} + +void rtsp_free_msg_buf(HRTSP_MSG * msg) +{ + pps_fl_push(rtsp_msg_buf_fl, msg); +} + +uint32 rtsp_idle_msg_buf_num() +{ + return rtsp_msg_buf_fl->node_num; +} + +BOOL rtsp_parse_buf_init(int nums) +{ + BOOL ret = rtsp_msg_buf_init(nums); + return ret; +} + +void rtsp_parse_buf_deinit() +{ + rtsp_msg_buf_deinit(); +} + + + diff --git a/MediaClient/MediaClient/rtsp/rtsp_parse.h b/MediaClient/MediaClient/rtsp/rtsp_parse.h new file mode 100644 index 0000000..77700ca --- /dev/null +++ b/MediaClient/MediaClient/rtsp/rtsp_parse.h @@ -0,0 +1,152 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef _RTSP_PARSE_H +#define _RTSP_PARSE_H + +#include "sys_inc.h" + +/*************************************************************************/ +typedef enum rtsp_req_mt +{ + RTSP_MT_NULL = 0, + RTSP_MT_DESCRIBE, + RTSP_MT_ANNOUNCE, + RTSP_MT_OPTIONS, + RTSP_MT_PAUSE, + RTSP_MT_PLAY, + RTSP_MT_RECORD, + RTSP_MT_REDIRECT, + RTSP_MT_SETUP, + RTSP_MT_SET_PARAMETER, + RTSP_MT_GET_PARAMETER, + RTSP_MT_TEARDOWN +} RTSP_RMT; + +typedef struct rtsp_req_message_type_value +{ + RTSP_RMT msg_type; + char msg_str[32]; + int msg_len; +} RREQMTV; + +typedef enum rtsp_context_type +{ + RTSP_CTX_NULL = 0, + RTSP_CTX_RTSP, + RTSP_CTX_SDP, + RTSP_CTX_TXT, + RTSP_CTX_HTM, +} RTSPCTXT; + +typedef struct hrtsp_msg_content +{ + uint32 msg_type; // message type : 0 represents a request, 1 represents a response + uint32 msg_sub_type; // message sub type + HDRV first_line; + + PPSN_CTX rtsp_ctx; + PPSN_CTX sdp_ctx; + + int rtsp_len; + int sdp_len; + + RTSPCTXT ctx_type; + int ctx_len; + + char * msg_buf; + int buf_offset; + + uint32 remote_ip; + uint16 remote_port; + uint16 local_port; +}HRTSP_MSG; + +#ifdef __cplusplus +extern "C" { +#endif + +/*************************************************************************/ +BOOL rtsp_is_rtsp_msg(char * msg_buf); +void rtsp_headl_parse(char * pline, int llen, HRTSP_MSG * p_msg); +int rtsp_line_parse(char * p_buf, int max_len, char sep_char, PPSN_CTX * p_ctx); +int rtsp_ctx_parse(HRTSP_MSG * p_msg); +int rtsp_msg_parse(char * msg_buf, int msg_buf_len, HRTSP_MSG * msg); +int rtsp_msg_parse_part1(char * p_buf, int buf_len, HRTSP_MSG * msg); +int rtsp_msg_parse_part2(char * p_buf, int buf_len, HRTSP_MSG * msg); + +/*************************************************************************/ +HDRV * rtsp_find_headline(HRTSP_MSG * msg, const char * head); +HDRV * rtsp_find_headline_next(HRTSP_MSG * msg, const char * head, HDRV * hrv); +HDRV * rtsp_find_sdp_headline(HRTSP_MSG * msg, const char * head); +BOOL rtsp_msg_with_sdp(HRTSP_MSG * msg); +BOOL rtsp_match_msg_session(HRTSP_MSG * rx_msg, HRTSP_MSG * tx_msg); +BOOL rtsp_match_msg_cseq(HRTSP_MSG * rx_msg, HRTSP_MSG * tx_msg); +BOOL rtsp_get_headline_uri(HRTSP_MSG * rx_msg, char * p_uri, int size); +BOOL rtsp_get_headline_string(HRTSP_MSG * rx_msg, const char * head, char * p_value, int size); +BOOL rtsp_get_msg_session(HRTSP_MSG * rx_msg, char *session_buf, int len); +BOOL rtsp_get_msg_cseq(HRTSP_MSG * rx_msg, char *cseq_buf, int len); +BOOL rtsp_get_user_agent_info(HRTSP_MSG * rx_msg, char * agent_buf, int max_len); +BOOL rtsp_get_session_info(HRTSP_MSG * rx_msg, char * session_buf, int max_len, int * timeout); +BOOL rtsp_get_rtp_info(HRTSP_MSG * rx_msg, char * v_ctl, uint32 * p_v_ts, char * a_ctl, uint32 * p_a_ts); +BOOL rtsp_get_tcp_transport_info(HRTSP_MSG * rx_msg, uint16 *interleaved); +BOOL rtsp_get_udp_transport_info(HRTSP_MSG * rx_msg, uint16 *client_port, uint16 *server_port); +BOOL rtsp_get_mc_transport_info(HRTSP_MSG * rx_msg, char *destination, uint16 *port); +BOOL rtsp_get_cbase_info(HRTSP_MSG * rx_msg, char * cbase_buf, int max_len); +BOOL rtsp_get_digest_info(HRTSP_MSG * rx_msg, HD_AUTH_INFO * auth_info); +BOOL rtsp_get_auth_digest_info(HRTSP_MSG * rx_msg, HD_AUTH_INFO * p_auth); +BOOL rtsp_is_line_exist(HRTSP_MSG * rx_msg, const char * head, const char * value); +void rtsp_add_tx_msg_line(HRTSP_MSG * tx_msg, const char * msg_hdr, const char * msg_fmt, ...); +void rtsp_add_tx_msg_sdp_line(HRTSP_MSG * tx_msg, const char * msg_hdr, const char * msg_fmt, ...); +void rtsp_add_tx_msg_fline(HRTSP_MSG * tx_msg, const char * msg_hdr, const char * msg_fmt, ...); +void rtsp_copy_msg_line(HRTSP_MSG * src_msg, HRTSP_MSG * dst_msg, const char * msg_hdr); +void rtsp_free_msg(HRTSP_MSG * msg); +void rtsp_free_msg_content(HRTSP_MSG * msg); + +/*************************************************************************/ +BOOL rtsp_get_remote_media_ip(HRTSP_MSG * rx_msg, uint32 * media_ip); +HDRV * rtsp_find_mdesc_point(HRTSP_MSG * rx_msg, HDRV * pStartHdr, const char * cap_name, int * next_offset, const char * attr=NULL); +BOOL rtsp_get_remote_cap(HRTSP_MSG * rx_msg, const char * cap_name, int * cap_count, uint8 * cap_array, uint16 * rtp_port, const char * attr=NULL); +BOOL rtsp_get_remote_cap_desc(HRTSP_MSG * rx_msg, const char * cap_name, char cap_desc[][MAX_AVDESCLEN], const char * attr=NULL); +BOOL rtsp_find_sdp_control(HRTSP_MSG * rx_msg, char * ctl_buf, const char * tname, int max_len, const char *attr = NULL); +BOOL rtsp_get_sdp_range(HRTSP_MSG * rx_msg, int * p_start, int * p_end); +BOOL rtsp_is_support_mcast(HRTSP_MSG * rx_msg); +BOOL rtsp_get_scale_info(HRTSP_MSG * rx_msg, int * p_scale); +BOOL rtsp_get_rate_control(HRTSP_MSG * rx_msg, int * p_ratectrl); +BOOL rtsp_get_immediate(HRTSP_MSG * rx_msg, int * p_imme); +BOOL rtsp_get_frame_info(HRTSP_MSG * rx_msg, int * p_frame, int * p_interval); + +/*************************************************************************/ +BOOL rtsp_msg_buf_init(int num); +void rtsp_msg_buf_deinit(); +HRTSP_MSG * rtsp_get_msg_buf(); +void rtsp_msg_ctx_init(HRTSP_MSG * msg); +void rtsp_free_msg_buf(HRTSP_MSG * msg); +uint32 rtsp_idle_msg_buf_num(); +BOOL rtsp_parse_buf_init(int nums); +void rtsp_parse_buf_deinit(); + + +#ifdef __cplusplus +} +#endif + +#endif // _RTSP_PARSE_H + + diff --git a/MediaClient/MediaClient/rtsp/rtsp_rcua.cpp b/MediaClient/MediaClient/rtsp/rtsp_rcua.cpp new file mode 100644 index 0000000..f21908e --- /dev/null +++ b/MediaClient/MediaClient/rtsp/rtsp_rcua.cpp @@ -0,0 +1,1074 @@ +/*************************************************************************************** + * + * 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 "rtp.h" +#include "word_analyse.h" +#include "rtsp_parse.h" +#include "rtsp_rcua.h" +#include "rfc_md5.h" +#include "base64.h" +#include "rtsp_util.h" +#include "http_cln.h" +#ifdef OVER_WEBSOCKET +#include "rtsp_ws.h" +#endif + +/***********************************************************************/ + +void rcua_build_auth_line(RCUA * p_rua, HRTSP_MSG * tx_msg, const char * p_method) +{ + if (0 == p_rua->need_auth) + { + return; + } + + HD_AUTH_INFO * p_auth = &p_rua->auth_info; + + if (p_rua->auth_mode == 1) // digest + { + int offset; + int buflen; + char buff[500] = {'\0'}; + + http_calc_auth_digest(p_auth, p_method); + + offset = 0; + buflen = sizeof(buff); + + offset += snprintf(buff+offset, buflen-offset, + "Digest username=\"%s\", realm=\"%s\", nonce=\"%s\", " + "uri=\"%s\", response=\"%s\"", + p_auth->auth_name, p_auth->auth_realm, p_auth->auth_nonce, + p_auth->auth_uri, p_auth->auth_response); + + if (p_auth->auth_opaque_flag) + { + offset += snprintf(buff+offset, buflen-offset, + ", opaque=\"%s\"", p_auth->auth_opaque); + } + + if (p_auth->auth_qop[0] != '\0') + { + offset += snprintf(buff+offset, buflen-offset, + ", qop=\"%s\", cnonce=\"%s\", nc=%s", + p_auth->auth_qop, p_auth->auth_cnonce, p_auth->auth_ncstr); + } + + if (p_auth->auth_algorithm[0] != '\0') + { + offset += snprintf(buff+offset, buflen-offset, + ", algorithm=%s", p_auth->auth_algorithm); + } + + rtsp_add_tx_msg_line(tx_msg, "Authorization", "%s", buff); + } + else if (p_rua->auth_mode == 0) // basic + { + char buff[512] = {'\0'}; + char basic[512] = {'\0'}; + snprintf(buff, sizeof(buff), "%s:%s", p_auth->auth_name, p_auth->auth_pwd); + base64_encode((uint8 *)buff, (int)strlen(buff), basic, sizeof(basic)); + rtsp_add_tx_msg_line(tx_msg, "Authorization", "Basic %s", basic); + } +} + +HRTSP_MSG * rcua_build_options(RCUA * p_rua) +{ + HRTSP_MSG * tx_msg = rtsp_get_msg_buf(); + if (tx_msg == NULL) + { + log_print(HT_LOG_ERR, "%s, rtsp_get_msg_buf return NULL!!!\r\n", __FUNCTION__); + return NULL; + } + + tx_msg->msg_type = 0; + tx_msg->msg_sub_type = RTSP_MT_OPTIONS; + + rtsp_add_tx_msg_fline(tx_msg, "OPTIONS", "%s RTSP/1.0", p_rua->uri); + + rtsp_add_tx_msg_line(tx_msg, "CSeq", "%u", p_rua->cseq); + + rcua_build_auth_line(p_rua, tx_msg, "OPTIONS"); + + if (p_rua->sid[0] != '\0') + { + rtsp_add_tx_msg_line(tx_msg, "Session", "%s", p_rua->sid); + } + + rtsp_add_tx_msg_line(tx_msg, "User-Agent", p_rua->user_agent); + + return tx_msg; +} + +HRTSP_MSG * rcua_build_describe(RCUA * p_rua) +{ + HRTSP_MSG * tx_msg = rtsp_get_msg_buf(); + if (tx_msg == NULL) + { + log_print(HT_LOG_ERR, "%s, rtsp_get_msg_buf return NULL!!!\r\n", __FUNCTION__); + return NULL; + } + + tx_msg->msg_type = 0; + tx_msg->msg_sub_type = RTSP_MT_DESCRIBE; + + rtsp_add_tx_msg_fline(tx_msg, "DESCRIBE", "%s RTSP/1.0", p_rua->uri); + + rtsp_add_tx_msg_line(tx_msg, "CSeq", "%u", p_rua->cseq); + + rcua_build_auth_line(p_rua, tx_msg, "DESCRIBE"); + + rtsp_add_tx_msg_line(tx_msg, "Accept", "application/sdp"); + rtsp_add_tx_msg_line(tx_msg, "User-Agent", p_rua->user_agent); + +#ifdef BACKCHANNEL + if (p_rua->backchannel) + { + rtsp_add_tx_msg_line(tx_msg, "Require", "www.onvif.org/ver20/backchannel"); + } +#endif + + return tx_msg; +} + +void rcua_build_setup_fline(HRTSP_MSG * tx_msg, const char * ctl, const char * uri) +{ + if (strncmp(ctl, "rtsp://", 7) == 0) + { + rtsp_add_tx_msg_fline(tx_msg, "SETUP", "%s RTSP/1.0", ctl); + } + else + { + int len = (int)strlen(uri); + + if (uri[len-1] == '/') + { + rtsp_add_tx_msg_fline(tx_msg, "SETUP", "%s%s RTSP/1.0", uri, ctl); + } + else + { + rtsp_add_tx_msg_fline(tx_msg, "SETUP", "%s/%s RTSP/1.0", uri, ctl); + } + } +} + +HRTSP_MSG * rcua_build_setup(RCUA * p_rua, int av_t) +{ + HRTSP_MSG * tx_msg = rtsp_get_msg_buf(); + if (tx_msg == NULL) + { + log_print(HT_LOG_ERR, "%s, rtsp_get_msg_buf return NULL!!!\r\n", __FUNCTION__); + return NULL; + } + + tx_msg->msg_type = 0; + tx_msg->msg_sub_type = RTSP_MT_SETUP; + + rcua_build_setup_fline(tx_msg, p_rua->channels[av_t].ctl, p_rua->uri); + + rtsp_add_tx_msg_line(tx_msg, "CSeq", "%u", p_rua->cseq); + + if (p_rua->sid[0] != '\0') + { + rtsp_add_tx_msg_line(tx_msg, "Session", "%s", p_rua->sid); + } + + rcua_build_auth_line(p_rua, tx_msg, "SETUP"); + + if (p_rua->rtp_tcp) // TCP + { + rtsp_add_tx_msg_line(tx_msg, "Transport", "RTP/AVP/TCP;unicast;interleaved=%u-%u", + p_rua->channels[av_t].interleaved, p_rua->channels[av_t].interleaved+1); + } + else if (p_rua->rtp_mcast) // rtp multicast + { + rtsp_add_tx_msg_line(tx_msg, "Transport", "RTP/AVP;multicast;port=%u-%u", + p_rua->channels[av_t].r_port, p_rua->channels[av_t].r_port+1); + } + else + { + rtsp_add_tx_msg_line(tx_msg, "Transport", "RTP/AVP;unicast;client_port=%u-%u", + p_rua->channels[av_t].l_port, p_rua->channels[av_t].l_port+1); + } + + rtsp_add_tx_msg_line(tx_msg, "User-Agent", p_rua->user_agent); + +#ifdef BACKCHANNEL + if (av_t == AV_TYPE_BACKCHANNEL) // backchannel + { + rtsp_add_tx_msg_line(tx_msg, "Require", "www.onvif.org/ver20/backchannel"); + } +#endif + +#ifdef REPLAY + if (p_rua->replay) + { + rtsp_add_tx_msg_line(tx_msg, "Require", "onvif-replay"); + } +#endif + + return tx_msg; +} + +HRTSP_MSG * rcua_build_play(RCUA * p_rua) +{ + HRTSP_MSG * tx_msg = rtsp_get_msg_buf(); + if (tx_msg == NULL) + { + log_print(HT_LOG_ERR, "%s, rtsp_get_msg_buf return NULL!!!\r\n", __FUNCTION__); + return NULL; + } + + tx_msg->msg_type = 0; + tx_msg->msg_sub_type = RTSP_MT_PLAY; + + rtsp_add_tx_msg_fline(tx_msg, "PLAY", "%s RTSP/1.0", p_rua->uri); + + rtsp_add_tx_msg_line(tx_msg, "CSeq", "%u", p_rua->cseq); + + rcua_build_auth_line(p_rua, tx_msg, "PLAY"); + + rtsp_add_tx_msg_line(tx_msg, "Session", "%s", p_rua->sid); + + rtsp_add_tx_msg_line(tx_msg, "Range", "npt=%0.3f-", p_rua->seek_pos/1000.0); + + rtsp_add_tx_msg_line(tx_msg, "User-Agent", p_rua->user_agent); + +#ifdef BACKCHANNEL + if (p_rua->backchannel) // backchannel + { + rtsp_add_tx_msg_line(tx_msg, "Require", "www.onvif.org/ver20/backchannel"); + } +#endif + +#ifdef REPLAY + if (p_rua->replay) + { + rtsp_add_tx_msg_line(tx_msg, "Require", "onvif-replay"); + + if (p_rua->scale_flag) + { + rtsp_add_tx_msg_line(tx_msg, "Scale", "%8.2f", p_rua->scale / 100.0); + } + + if (p_rua->rate_control_flag) + { + rtsp_add_tx_msg_line(tx_msg, "Rate-Control", "%s", p_rua->rate_control ? "yes" : "no"); + } + + if (p_rua->immediate_flag && p_rua->immediate) + { + rtsp_add_tx_msg_line(tx_msg, "Immediate", "yes"); + } + + if (p_rua->frame_flag) + { + if (1 == p_rua->frame) + { + rtsp_add_tx_msg_line(tx_msg, "Frames", "predicted"); + } + else if (2 == p_rua->frame) + { + if (p_rua->frame_interval_flag && p_rua->frame_interval) + { + rtsp_add_tx_msg_line(tx_msg, "Frames", "intra/%d", p_rua->frame_interval); + } + else + { + rtsp_add_tx_msg_line(tx_msg, "Frames", "intra"); + } + } + } + + if (p_rua->range_flag && p_rua->replay_start > 0) + { + char range[256] = {'\0'}; + char start[32] = {'\0'}, end[32] = {'\0'}; + struct tm *t1; + + t1 = gmtime(&p_rua->replay_start); + + snprintf(start, sizeof(start)-1, "%04d%02d%02dT%02d%02d%02dZ", + t1->tm_year+1900, t1->tm_mon+1, t1->tm_mday, + t1->tm_hour, t1->tm_min, t1->tm_sec); + + if (p_rua->replay_end > 0) + { + t1 = gmtime(&p_rua->replay_end); + + snprintf(end, sizeof(end)-1, "%04d%02d%02dT%02d%02d%02dZ", + t1->tm_year+1900, t1->tm_mon+1, t1->tm_mday, + t1->tm_hour, t1->tm_min, t1->tm_sec); + + snprintf(range, sizeof(range)-1, "clock=%s-%s", start, end); + } + else + { + snprintf(range, sizeof(range)-1, "clock=%s-", start); + } + + rtsp_add_tx_msg_line(tx_msg, "Range", range); + } + } +#endif + + return tx_msg; +} + +HRTSP_MSG * rcua_build_pause(RCUA * p_rua) +{ + HRTSP_MSG * tx_msg = rtsp_get_msg_buf(); + if (tx_msg == NULL) + { + log_print(HT_LOG_ERR, "%s::rtsp_get_msg_buf return NULL!!!\r\n", __FUNCTION__); + return NULL; + } + + tx_msg->msg_type = 0; + tx_msg->msg_sub_type = RTSP_MT_PAUSE; + + rtsp_add_tx_msg_fline(tx_msg, "PAUSE", "%s RTSP/1.0", p_rua->uri); + + rtsp_add_tx_msg_line(tx_msg, "CSeq", "%u", p_rua->cseq); + + rcua_build_auth_line(p_rua, tx_msg, "PAUSE"); + + rtsp_add_tx_msg_line(tx_msg, "Session", "%s", p_rua->sid); + rtsp_add_tx_msg_line(tx_msg, "User-Agent", p_rua->user_agent); + + return tx_msg; +} + +HRTSP_MSG * rcua_build_get_parameter(RCUA * p_rua) +{ + HRTSP_MSG * tx_msg = rtsp_get_msg_buf(); + if (tx_msg == NULL) + { + log_print(HT_LOG_ERR, "%s, rtsp_get_msg_buf return NULL!!!\r\n", __FUNCTION__); + return NULL; + } + + tx_msg->msg_type = 0; + tx_msg->msg_sub_type = RTSP_MT_GET_PARAMETER; + + rtsp_add_tx_msg_fline(tx_msg, "GET_PARAMETER", "%s RTSP/1.0", p_rua->uri); + + rtsp_add_tx_msg_line(tx_msg, "CSeq", "%u", p_rua->cseq); + + rcua_build_auth_line(p_rua, tx_msg, "GET_PARAMETER"); + + rtsp_add_tx_msg_line(tx_msg, "Session", "%s", p_rua->sid); + rtsp_add_tx_msg_line(tx_msg, "User-Agent", p_rua->user_agent); + + return tx_msg; +} + + +HRTSP_MSG * rcua_build_teardown(RCUA * p_rua) +{ + HRTSP_MSG * tx_msg = rtsp_get_msg_buf(); + if (tx_msg == NULL) + { + log_print(HT_LOG_ERR, "%s, rtsp_get_msg_buf return NULL!!!\r\n", __FUNCTION__); + return NULL; + } + + tx_msg->msg_type = 0; + tx_msg->msg_sub_type = RTSP_MT_TEARDOWN; + + rtsp_add_tx_msg_fline(tx_msg, "TEARDOWN", "%s RTSP/1.0", p_rua->uri); + + rtsp_add_tx_msg_line(tx_msg, "CSeq", "%u", p_rua->cseq); + + rcua_build_auth_line(p_rua, tx_msg, "TEARDOWN"); + + rtsp_add_tx_msg_line(tx_msg, "Session", "%s", p_rua->sid); + rtsp_add_tx_msg_line(tx_msg, "User-Agent", p_rua->user_agent); + +#ifdef BACKCHANNEL + if (p_rua->backchannel) // backchannel + { + rtsp_add_tx_msg_line(tx_msg, "Require", "www.onvif.org/ver20/backchannel"); + } +#endif + + return tx_msg; +} + +BOOL rcua_get_media_info(RCUA * p_rua, HRTSP_MSG * rx_msg) +{ + if (rx_msg == NULL || p_rua == NULL) + { + return FALSE; + } + + if (!rtsp_msg_with_sdp(rx_msg)) + { + return FALSE; + } + + rtsp_get_remote_cap(rx_msg, "video", &(p_rua->channels[AV_VIDEO_CH].cap_count), + p_rua->channels[AV_VIDEO_CH].cap, &p_rua->channels[AV_VIDEO_CH].r_port); + rtsp_get_remote_cap_desc(rx_msg, "video", p_rua->channels[AV_VIDEO_CH].cap_desc); + +#ifdef BACKCHANNEL + if (p_rua->backchannel) + { + rtsp_get_remote_cap(rx_msg, "audio", &(p_rua->channels[AV_AUDIO_CH].cap_count), + p_rua->channels[AV_AUDIO_CH].cap, &p_rua->channels[AV_AUDIO_CH].r_port, "recvonly"); + rtsp_get_remote_cap_desc(rx_msg, "audio", p_rua->channels[AV_AUDIO_CH].cap_desc, "recvonly"); + + rtsp_get_remote_cap(rx_msg, "audio", &(p_rua->channels[AV_BACK_CH].cap_count), + p_rua->channels[AV_BACK_CH].cap, &p_rua->channels[AV_BACK_CH].r_port, "sendonly"); + rtsp_get_remote_cap_desc(rx_msg, "audio", p_rua->channels[AV_BACK_CH].cap_desc, "sendonly"); + } + else +#endif + { + rtsp_get_remote_cap(rx_msg, "audio", &(p_rua->channels[AV_AUDIO_CH].cap_count), + p_rua->channels[AV_AUDIO_CH].cap, &p_rua->channels[AV_AUDIO_CH].r_port); + rtsp_get_remote_cap_desc(rx_msg, "audio", p_rua->channels[AV_AUDIO_CH].cap_desc); + } + +#ifdef METADATA + rtsp_get_remote_cap(rx_msg, "application", &(p_rua->channels[AV_METADATA_CH].cap_count), + p_rua->channels[AV_METADATA_CH].cap, &p_rua->channels[AV_METADATA_CH].r_port); + rtsp_get_remote_cap_desc(rx_msg, "application", p_rua->channels[AV_METADATA_CH].cap_desc); +#endif + + return TRUE; +} + +void rcua_send_rtsp_msg(RCUA * p_rua, HRTSP_MSG * tx_msg) +{ + int slen; + char * tx_buf; + int offset = 0; + int buf_len; + char rtsp_tx_buffer[2048+RTSP_SND_RESV_SIZE]; + SOCKET fd = -1; + + if (tx_msg == NULL) + { + return; + } + +#ifdef OVER_HTTP + if (p_rua->over_http) + { + fd = p_rua->rtsp_send.cfd; + } + else +#endif +#ifdef OVER_WEBSOCKET + if (p_rua->over_ws) + { + fd = p_rua->ws_http.cfd; + } + else +#endif + fd = p_rua->fd; + + if (fd <= 0) + { + return; + } + + tx_buf = rtsp_tx_buffer + RTSP_SND_RESV_SIZE; + buf_len = sizeof(rtsp_tx_buffer) - RTSP_SND_RESV_SIZE; + + offset += snprintf(tx_buf+offset, buf_len-offset, "%s %s\r\n", tx_msg->first_line.header, tx_msg->first_line.value_string); + + HDRV * pHdrV = (HDRV *)pps_lookup_start(&(tx_msg->rtsp_ctx)); + while (pHdrV != NULL) + { + offset += snprintf(tx_buf+offset, buf_len-offset, "%s: %s\r\n", pHdrV->header, pHdrV->value_string); + pHdrV = (HDRV *)pps_lookup_next(&(tx_msg->rtsp_ctx), pHdrV); + } + pps_lookup_end(&(tx_msg->rtsp_ctx)); + + offset += snprintf(tx_buf+offset, buf_len-offset, "\r\n"); + + if (tx_msg->sdp_ctx.node_num != 0) + { + pHdrV = (HDRV *)pps_lookup_start(&(tx_msg->sdp_ctx)); + while (pHdrV != NULL) + { + if (pHdrV->header[0] != '\0') + { + offset += snprintf(tx_buf+offset, buf_len-offset, "%s=%s\r\n", pHdrV->header, pHdrV->value_string); + } + else + { + offset += snprintf(tx_buf+offset, buf_len-offset, "%s\r\n", pHdrV->value_string); + } + + pHdrV = (HDRV *)pps_lookup_next(&(tx_msg->sdp_ctx), pHdrV); + } + pps_lookup_end(&(tx_msg->sdp_ctx)); + } + + log_print(HT_LOG_DBG, "TX >> %s\r\n", tx_buf); + +#ifdef OVER_HTTP + if (p_rua->over_http) + { + char tx_buf_base64[4096]; + + base64_encode((uint8 *)tx_buf, offset, tx_buf_base64, sizeof(tx_buf_base64)); + + tx_buf = tx_buf_base64; + offset = strlen(tx_buf_base64); + + slen = http_cln_tx(&p_rua->rtsp_send, tx_buf, offset); + } + else +#endif +#ifdef OVER_WEBSOCKET + if (p_rua->over_ws) + { + int extra = rtsp_ws_encode_data((uint8 *)tx_buf, offset, 0x82, 1); + + tx_buf -= extra; + offset += extra; + + slen = http_cln_tx(&p_rua->ws_http, tx_buf, offset); + } + else +#endif + { + slen = send(fd, tx_buf, offset, 0); + } + + if (slen != offset) + { + log_print(HT_LOG_ERR, "%s, slen=%d, offset=%d, send message failed!!!\r\n", + __FUNCTION__, slen, offset); + } +} + +BOOL rcua_get_sdp_video_desc(RCUA * p_rua, const char * key, int * pt, char * p_sdp, int max_len) +{ + int payload_type = 0, i; + int rtpmap_len = (int)strlen("a=rtpmap:"); + char key_str[64] = {'\0'}; + + strncpy(key_str, key, sizeof(key_str)-1); + + for (i=0; ichannels[AV_VIDEO_CH].cap_desc[i]; + if (memcmp(ptr, "a=rtpmap:", rtpmap_len) == 0) + { + char pt_buf[16]; + char code_buf[64] = {'\0'}; + int next_offset = 0; + + ptr += rtpmap_len; + + if (GetLineWord(ptr, 0, (int)strlen(ptr), pt_buf, sizeof(pt_buf), &next_offset, WORD_TYPE_NUM) == FALSE) + { + return FALSE; + } + + GetLineWord(ptr, next_offset, (int)strlen(ptr)-next_offset, code_buf, sizeof(code_buf), &next_offset, WORD_TYPE_STRING); + + if (memcmp(uppercase(code_buf), uppercase(key_str), strlen(key_str)) == 0) + { + payload_type = atoi(pt_buf); + break; + } + } + } + + if (payload_type <= 0) + { + return FALSE; + } + + if (pt) + { + *pt = payload_type; + } + + if (p_sdp == NULL) + { + return TRUE; + } + + p_sdp[0] = '\0'; + + char fmtp_buf[32]; + int fmtp_len = snprintf(fmtp_buf, sizeof(fmtp_buf), "a=fmtp:%d", payload_type); + + for (i=0; ichannels[AV_VIDEO_CH].cap_desc[i]; + if (memcmp(ptr, fmtp_buf, fmtp_len) == 0) + { + ptr += rtpmap_len+1; + strncpy(p_sdp, ptr, max_len); + break; + } + } + + return TRUE; +} + +BOOL rcua_get_sdp_audio_desc(RCUA * p_rua, const char * key, int * pt, char * p_sdp, int max_len) +{ + int payload_type = 0, i; + int rtpmap_len = (int)strlen("a=rtpmap:"); + char key_str[64] = {'\0'}; + + strncpy(key_str, key, sizeof(key_str)-1); + + for (i=0; ichannels[AV_AUDIO_CH].cap_desc[i]; + if (memcmp(ptr, "a=rtpmap:", rtpmap_len) == 0) + { + char pt_buf[16]; + char code_buf[64] = {'\0'}; + int next_offset = 0; + ptr += rtpmap_len; + + if (GetLineWord(ptr, 0, (int)strlen(ptr), pt_buf, sizeof(pt_buf), &next_offset, WORD_TYPE_NUM) == FALSE) + { + return FALSE; + } + + GetLineWord(ptr, next_offset, (int)strlen(ptr)-next_offset, code_buf, sizeof(code_buf), &next_offset, WORD_TYPE_STRING); + + if (memcmp(uppercase(code_buf), uppercase(key_str), strlen(key_str)) == 0) + { + payload_type = atoi(pt_buf); + break; + } + } + } + + if (payload_type <= 0) + { + return FALSE; + } + + if (pt) + { + *pt = payload_type; + } + + if (p_sdp == NULL) + { + return TRUE; + } + + p_sdp[0] = '\0'; + + char fmtp_buf[32]; + int fmtp_len = snprintf(fmtp_buf, sizeof(fmtp_buf), "a=fmtp:%d", payload_type); + + for (i=0; ichannels[AV_AUDIO_CH].cap_desc[i]; + if (memcmp(ptr, fmtp_buf, fmtp_len) == 0) + { + ptr += rtpmap_len+1; + strncpy(p_sdp, ptr, max_len); + break; + } + } + + return TRUE; +} + +BOOL rcua_get_sdp_h264_desc(RCUA * p_rua, int * pt, char * p_sdp, int max_len) +{ + return rcua_get_sdp_video_desc(p_rua, "H264/90000", pt, p_sdp, max_len); +} + +BOOL rcua_get_sdp_h264_params(RCUA * p_rua, int * pt, char * p_sps_pps, int max_len) +{ + BOOL ret = FALSE; + char sdp[1024] = {'\0'}; + + if (rcua_get_sdp_h264_desc(p_rua, pt, sdp, sizeof(sdp)) == FALSE) + { + return FALSE; + } + + char * p_substr = strstr(sdp, "sprop-parameter-sets="); + if (p_substr != NULL) + { + p_substr += strlen("sprop-parameter-sets="); + char * p_tmp = p_substr; + + while (*p_tmp != ' ' && *p_tmp != ';' && *p_tmp != '\0') + { + p_tmp++; + } + + int sps_base64_len = (int)(p_tmp - p_substr); + if (sps_base64_len < max_len) + { + memcpy(p_sps_pps, p_substr, sps_base64_len); + p_sps_pps[sps_base64_len] = '\0'; + ret = TRUE; + } + } + + return ret; +} + +BOOL rcua_get_sdp_h265_desc(RCUA * p_rua, int * pt, char * p_sdp, int max_len) +{ + return rcua_get_sdp_video_desc(p_rua, "H265/90000", pt, p_sdp, max_len); +} + +BOOL rcua_get_sdp_h265_params(RCUA * p_rua, int * pt, BOOL * donfield, char * p_vps, int vps_len, char * p_sps, int sps_len, char * p_pps, int pps_len) +{ + char sdp[1024] = {'\0'}; + + if (rcua_get_sdp_h265_desc(p_rua, pt, sdp, sizeof(sdp)) == FALSE) + { + return FALSE; + } + + char * p_substr = strstr(sdp, "sprop-depack-buf-nalus="); + if (p_substr != NULL) + { + p_substr += strlen("sprop-depack-buf-nalus="); + char * p_tmp = p_substr; + + while (*p_tmp != ' ' && *p_tmp != ';' && *p_tmp != '\0') + { + p_tmp++; + } + + int len = (int)(p_tmp - p_substr); + if (len > 0) + { + if (donfield) + { + *donfield = (atoi(p_substr) > 0 ? TRUE : FALSE); + } + } + else + { + return FALSE; + } + } + + p_substr = strstr(sdp, "sprop-vps="); + if (p_substr != NULL) + { + p_substr += strlen("sprop-vps="); + char * p_tmp = p_substr; + + while (*p_tmp != ' ' && *p_tmp != ';' && *p_tmp != '\0') + { + p_tmp++; + } + + int len = (int)(p_tmp - p_substr); + if (len < vps_len) + { + memcpy(p_vps, p_substr, len); + p_vps[len] = '\0'; + } + else + { + return FALSE; + } + } + + p_substr = strstr(sdp, "sprop-sps="); + if (p_substr != NULL) + { + p_substr += strlen("sprop-sps="); + char * p_tmp = p_substr; + + while (*p_tmp != ' ' && *p_tmp != ';' && *p_tmp != '\0') + { + p_tmp++; + } + + int len = (int)(p_tmp - p_substr); + if (len < sps_len) + { + memcpy(p_sps, p_substr, len); + p_sps[len] = '\0'; + } + else + { + return FALSE; + } + } + + p_substr = strstr(sdp, "sprop-pps="); + if (p_substr != NULL) + { + p_substr += strlen("sprop-pps="); + char * p_tmp = p_substr; + + while (*p_tmp != ' ' && *p_tmp != ';' && *p_tmp != '\0') + { + p_tmp++; + } + + int len = (int)(p_tmp - p_substr); + if (len < pps_len) + { + memcpy(p_pps, p_substr, len); + p_pps[len] = '\0'; + } + else + { + return FALSE; + } + } + + return TRUE; +} + +BOOL rcua_get_sdp_mp4_desc(RCUA * p_rua, int * pt, char * p_sdp, int max_len) +{ + return rcua_get_sdp_video_desc(p_rua, "MP4V-ES/90000", pt, p_sdp, max_len); +} + +BOOL rcua_get_sdp_mp4_params(RCUA * p_rua, int * pt, char * p_cfg, int max_len) +{ + BOOL ret = FALSE; + char sdp[1024] = {'\0'}; + + if (rcua_get_sdp_mp4_desc(p_rua, pt, sdp, sizeof(sdp)) == FALSE) + { + return FALSE; + } + + char * p_substr = strstr(sdp, "config="); + if (p_substr != NULL) + { + p_substr += strlen("config="); + char * p_tmp = p_substr; + + while (*p_tmp != ' ' && *p_tmp != ';' && *p_tmp != '\0') + { + p_tmp++; + } + + int cfg_len = (int)(p_tmp - p_substr); + if (cfg_len < max_len) + { + memcpy(p_cfg, p_substr, cfg_len); + p_cfg[cfg_len] = '\0'; + ret = TRUE; + } + else + { + ret = FALSE; + } + } + + return ret; +} + +BOOL rcua_get_sdp_aac_desc(RCUA * p_rua, int * pt, char * p_sdp, int max_len) +{ + return rcua_get_sdp_audio_desc(p_rua, "MPEG4-GENERIC", pt, p_sdp, max_len); +} + +BOOL rcua_get_sdp_aac_params(RCUA * p_rua, int *pt, int *sizelength, int *indexlength, int *indexdeltalength, char * p_cfg, int max_len) +{ + char sdp[1024] = {'\0'}; + + if (rcua_get_sdp_aac_desc(p_rua, pt, sdp, sizeof(sdp)) == FALSE) + { + return FALSE; + } + + char * p_substr = strstr(sdp, "config="); + if (p_substr != NULL) + { + p_substr += strlen("config="); + char * p_tmp = p_substr; + + while (*p_tmp != ' ' && *p_tmp != ';' && *p_tmp != '\0') + { + p_tmp++; + } + + int len = (int)(p_tmp - p_substr); + if (len < max_len) + { + memcpy(p_cfg, p_substr, len); + p_cfg[len] = '\0'; + } + else + { + return FALSE; + } + } + + p_substr = strstr(sdp, "sizelength="); + if (p_substr != NULL) + { + p_substr += strlen("sizelength="); + char * p_tmp = p_substr; + + while (*p_tmp != ' ' && *p_tmp != ';' && *p_tmp != '\0') + { + p_tmp++; + } + + int len = (int)(p_tmp - p_substr); + if (len > 0) + { + *sizelength = atoi(p_substr); + } + } + + p_substr = strstr(sdp, "indexlength="); + if (p_substr != NULL) + { + p_substr += strlen("indexlength="); + char * p_tmp = p_substr; + + while (*p_tmp != ' ' && *p_tmp != ';' && *p_tmp != '\0') + { + p_tmp++; + } + + int len = (int)(p_tmp - p_substr); + if (len > 0) + { + *indexlength = atoi(p_substr); + } + } + + p_substr = strstr(sdp, "indexdeltalength="); + if (p_substr != NULL) + { + p_substr += strlen("indexdeltalength="); + char * p_tmp = p_substr; + + while (*p_tmp != ' ' && *p_tmp != ';' && *p_tmp != '\0') + { + p_tmp++; + } + + int len = (int)(p_tmp - p_substr); + if (len > 0) + { + *indexdeltalength = atoi(p_substr); + } + } + + return TRUE; +} + +SOCKET rcua_init_udp_connection(uint16 port) +{ + struct sockaddr_in addr; + + SOCKET fd = socket(AF_INET, SOCK_DGRAM, 0); + if (fd <= 0) + { + log_print(HT_LOG_ERR, "%s, socket SOCK_DGRAM error!\n", __FUNCTION__); + return -1; + } + + addr.sin_family = AF_INET; + addr.sin_addr.s_addr = htonl(INADDR_ANY); + addr.sin_port = htons(port); + + int len = 1024*1024; + if (setsockopt(fd, SOL_SOCKET, SO_RCVBUF, (char*)&len, sizeof(int))) + { + log_print(HT_LOG_WARN, "%s, setsockopt SO_RCVBUF error!\r\n", __FUNCTION__); + } + + if (bind(fd, (struct sockaddr *)&addr, sizeof(addr)) == -1) + { + log_print(HT_LOG_ERR, "%s, Bind udp socket fail, port = %d, error = %s\r\n", + __FUNCTION__, port, sys_os_get_socket_error()); + closesocket(fd); + return -1; + } + + return fd; +} + +SOCKET rcua_init_mc_connection(uint16 port, char * destination) +{ + struct sockaddr_in addr; + struct ip_mreq mcast; + + SOCKET fd = socket(AF_INET, SOCK_DGRAM, 0); + if (fd <= 0) + { + log_print(HT_LOG_ERR, "%s, socket SOCK_DGRAM error!\n", __FUNCTION__); + return -1; + } + + addr.sin_family = AF_INET; + addr.sin_addr.s_addr = get_default_if_ip(); + addr.sin_port = htons(port); + + /* reuse socket addr */ + int opt = 1; + if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char*)&opt, sizeof(opt))) + { + log_print(HT_LOG_WARN, "%s, setsockopt SO_REUSEADDR error!\r\n", __FUNCTION__); + } + + int len = 1024*1024; + if (setsockopt(fd, SOL_SOCKET, SO_RCVBUF, (char*)&len, sizeof(int))) + { + log_print(HT_LOG_WARN, "%s, setsockopt SO_RCVBUF error!\r\n", __FUNCTION__); + } + + if (bind(fd, (struct sockaddr *)&addr, sizeof(addr)) == -1) + { + log_print(HT_LOG_ERR, "%s, Bind udp socket fail, port = %d, error = %s\r\n", + __FUNCTION__, port, sys_os_get_socket_error()); + closesocket(fd); + return -1; + } + + int ttl = 255; + setsockopt(fd, IPPROTO_IP, IP_MULTICAST_TTL, (char*)&ttl, sizeof(ttl)); + + mcast.imr_multiaddr.s_addr = inet_addr(destination); + mcast.imr_interface.s_addr = addr.sin_addr.s_addr; + + if (setsockopt(fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, (char*)&mcast, sizeof(mcast)) < 0) + { + log_print(HT_LOG_ERR, "%s, setsockopt IP_ADD_MEMBERSHIP error!%s\r\n", + __FUNCTION__, sys_os_get_socket_error()); + closesocket(fd); + return -1; + } + + return fd; +} + + + diff --git a/MediaClient/MediaClient/rtsp/rtsp_rcua.h b/MediaClient/MediaClient/rtsp/rtsp_rcua.h new file mode 100644 index 0000000..bc9a3c5 --- /dev/null +++ b/MediaClient/MediaClient/rtsp/rtsp_rcua.h @@ -0,0 +1,243 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef RTSP_RCUA_H +#define RTSP_RCUA_H + +#include "rtsp_parse.h" +#include "http.h" + +#ifdef BACKCHANNEL +#include "audio_capture.h" +#endif + +#ifdef OVER_WEBSOCKET +#include "rtsp_ws.h" +#endif + + +#define AV_TYPE_VIDEO 0 +#define AV_TYPE_AUDIO 1 +#define AV_TYPE_METADATA 2 +#define AV_TYPE_BACKCHANNEL 3 + +#define AV_MAX_CHS 4 + +#define AV_VIDEO_CH AV_TYPE_VIDEO +#define AV_AUDIO_CH AV_TYPE_AUDIO +#define AV_METADATA_CH AV_TYPE_METADATA +#define AV_BACK_CH AV_TYPE_BACKCHANNEL + +/** + * RTSP over websocket needs to reserve some space + * in the header of the send buffer + */ +#define RTSP_SND_RESV_SIZE 32 + +typedef enum rtsp_client_states +{ + RCS_NULL = 0, + RCS_OPTIONS, + RCS_DESCRIBE, + RCS_INIT_V, + RCS_INIT_A, + RCS_INIT_M, + RCS_INIT_BC, + RCS_READY, + RCS_PLAYING, + RCS_RECORDING, +} RCSTATE; + +typedef struct rtsp_client_media_channel +{ + int disabled; // not setup this channel + SOCKET udp_fd; // udp socket + SOCKET rtcp_fd; // rtcp udp socket + char ctl[128]; // control string + uint16 setup; // whether the media channel already be setuped + uint16 r_port; // remote udp port + uint16 l_port; // local udp port + uint16 interleaved; // rtp channel values + char destination[32]; // multicast address + int cap_count; // Local number of capabilities + uint8 cap[MAX_AVN]; // Local capability + char cap_desc[MAX_AVN][MAX_AVDESCLEN]; +} RCMCH; + +typedef struct rtsp_client_user_agent +{ + uint32 used_flag : 1; // used flag + uint32 rtp_tcp : 1; // rtp over tcp + uint32 mcast_flag : 1; // use rtp multicast, set by user + uint32 rtp_mcast : 1; // use rtp multicast, set by stack + uint32 rtp_tx : 1; // rtp sending flag + uint32 need_auth : 1; // need auth flag + uint32 auth_mode : 2; // 0 - baisc; 1 - digest + uint32 gp_cmd : 1; // is support get_parameter command + uint32 backchannel : 1; // audio backchannle flag + uint32 send_bc_data: 1; // audio backchannel data sending flag + uint32 replay : 1; // replay flag + uint32 over_http : 1; // rtsp over http flag + uint32 over_ws : 1; // rtsp over websocket flag + uint32 auth_retry : 3; // auth retry numbers + uint32 reserved : 15; + + int state; // state, RCSTATE + SOCKET fd; // socket handler + uint32 keepalive_time; // keepalive time + + char ripstr[128]; // remote ip + uint16 rport; // rtsp server port + + uint32 cseq; // seq no + char sid[64]; // Session ID + char uri[256]; // rtsp://221.10.50.195:554/cctv.sdp + char cbase[256]; // Content-Base: rtsp://221.10.50.195:554/broadcast.sdp/ + char user_agent[64]; // user agent string + int session_timeout; // session timeout value + int play_start; // a=range:npt=0-20.735, unit is millisecond + int play_end; // a=range:npt=0-20.735, unit is millisecond + uint32 video_init_ts; // video init timestampe + uint32 audio_init_ts; // audio init timestampe + int seek_pos; // seek pos + int media_start; // media start time, unit is millisecond + + char rcv_buf[2052]; // receive buffer + int rcv_dlen; // receive data length + int rtp_t_len; // rtp payload total length + int rtp_rcv_len; // rtp payload receive length + char * rtp_rcv_buf; // rtp payload receive buffer + + RCMCH channels[AV_MAX_CHS]; // media channels + + HD_AUTH_INFO auth_info; // auth information + + int video_codec; // video codec + + int audio_codec; // audio codec + int sample_rate; // audio sample rate + int audio_channels; // audio channels + int bit_per_sample; // audio bit per sample + + uint8 * audio_spec; // audio special data, for AAC etc. + uint32 audio_spec_len; // audio special data length + +#ifdef BACKCHANNEL + int bc_audio_device; // back channel audio device index, start from 0 + int bc_audio_codec; // back channel audio codec + int bc_sample_rate; // back channel sample rate + int bc_channels; // back channel channel numbers + int bc_bit_per_sample; // back channel bit per sample + UA_RTP_INFO bc_rtp_info; // back channel audio rtp info + CAudioCapture * audio_captrue; // audio capture +#endif + +#ifdef REPLAY + uint32 scale_flag : 1; + uint32 rate_control_flag : 1; + uint32 immediate_flag : 1; + uint32 frame_flag : 1; + uint32 frame_interval_flag : 1; + uint32 range_flag : 1; + uint32 replay_reserved : 26; + + int scale; // scale info, when not set the rata control flag, the scale is valid. + // It shall be either 100.0 or -100.0, to indicate forward or reverse playback respectively. + // If it is not present, forward playback is assumed + // 100 means 1.0, Divide by 100 when using + int rate_control; // rate control flag, + // 1-the stream is delivered in real time using standard RTP timing mechanisms + // 0-the stream is delivered as fast as possible, using only the flow control provided by the transport to limit the delivery rate + int immediate; // 1 - immediately start playing from the new location, cancelling any existing PLAY command. + // The first packet sent from the new location shall have the D (discontinuity) bit set in its RTP extension header. + int frame; // 0 - all frames + // 1 - I-frame and P-frame + // 2 - I-frame + int frame_interval; // I-frame interval, unit is milliseconds + time_t replay_start; // replay start time + time_t replay_end; // replay end time +#endif + +#ifdef OVER_HTTP + uint16 http_port; // rtsp over http port + HTTPREQ rtsp_send; // rtsp over http get connection + HTTPREQ rtsp_recv; // rtsp over http post connection +#endif + +#ifdef OVER_WEBSOCKET + uint16 ws_port; // rtsp over websocket port + HTTPREQ ws_http; // rtsp over websocket connection + WSMSG ws_msg; // rtsp over websocket message handler +#endif +} RCUA; + + +#ifdef __cplusplus +extern "C" { +#endif + +/*************************************************************************/ +HRTSP_MSG * rcua_build_describe(RCUA * p_rua); +HRTSP_MSG * rcua_build_setup(RCUA * p_rua,int type); +HRTSP_MSG * rcua_build_play(RCUA * p_rua); +HRTSP_MSG * rcua_build_pause(RCUA * p_rua); +HRTSP_MSG * rcua_build_teardown(RCUA * p_rua); +HRTSP_MSG * rcua_build_get_parameter(RCUA * p_rua); +HRTSP_MSG * rcua_build_options(RCUA * p_rua); + +/*************************************************************************/ +BOOL rcua_get_media_info(RCUA * p_rua, HRTSP_MSG * rx_msg); + +BOOL rcua_get_sdp_video_desc(RCUA * p_rua, const char * key, int * pt, char * p_sdp, int max_len); +BOOL rcua_get_sdp_audio_desc(RCUA * p_rua, const char * key, int * pt, char * p_sdp, int max_len); + +BOOL rcua_get_sdp_h264_desc(RCUA * p_rua, int * pt, char * p_sdp, int max_len); +BOOL rcua_get_sdp_h264_params(RCUA * p_rua, int * pt, char * p_sps_pps, int max_len); + +BOOL rcua_get_sdp_h265_desc(RCUA * p_rua, int * pt, char * p_sdp, int max_len); +BOOL rcua_get_sdp_h265_params(RCUA * p_rua, int * pt, BOOL * donfield, char * p_vps, int vps_len, char * p_sps, int sps_len, char * p_pps, int pps_len); + +BOOL rcua_get_sdp_mp4_desc(RCUA * p_rua, int * pt, char * p_sdp, int max_len); +BOOL rcua_get_sdp_mp4_params(RCUA * p_rua, int * pt, char * p_cfg, int max_len); + +BOOL rcua_get_sdp_aac_desc(RCUA * p_rua, int * pt, char * p_sdp, int max_len); +BOOL rcua_get_sdp_aac_params(RCUA * p_rua, int *pt, int *sizelength, int *indexlength, int *indexdeltalength, char * p_cfg, int max_len); + +SOCKET rcua_init_udp_connection(uint16 port); +SOCKET rcua_init_mc_connection(uint16 port, char * destination); + +/*************************************************************************/ +void rcua_send_rtsp_msg(RCUA * p_rua,HRTSP_MSG * tx_msg); + +#define rcua_send_free_rtsp_msg(p_rua,tx_msg) \ + do { \ + rcua_send_rtsp_msg(p_rua,tx_msg); \ + rtsp_free_msg(tx_msg); \ + } while(0) + + +#ifdef __cplusplus +} +#endif + +#endif // RTSP_RCUA_H + + + + diff --git a/MediaClient/MediaClient/rtsp/rtsp_util.cpp b/MediaClient/MediaClient/rtsp/rtsp_util.cpp new file mode 100644 index 0000000..0a09810 --- /dev/null +++ b/MediaClient/MediaClient/rtsp/rtsp_util.cpp @@ -0,0 +1,258 @@ +/*************************************************************************************** + * + * 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 "rtsp_util.h" + + +/***********************************************************************/ +#define UDP_BASE_PORT 40000 + +static uint16 g_udp_bport = UDP_BASE_PORT; +static void * g_udp_port_mutex = sys_os_create_mutex(); + + + +/***********************************************************************/ + +uint16 rtsp_get_udp_port() +{ + uint16 port; + + sys_os_mutex_enter(g_udp_port_mutex); + + port = g_udp_bport; + g_udp_bport += 2; + if (g_udp_bport > 65534) + { + g_udp_bport = UDP_BASE_PORT; + } + + sys_os_mutex_leave(g_udp_port_mutex); + + return port; +} + +uint32 rtsp_get_timestamp(int frequency) +{ + struct timeval tv; + + gettimeofday(&tv, 0); + + // Begin by converting from "struct timeval" units to RTP timestamp units: + uint32 increment = (frequency*tv.tv_sec); + increment += (uint32)(frequency*(tv.tv_usec/1000000.0) + 0.5); // note: rounding + + return increment; +} + +char * rtsp_get_utc_time() +{ + static char buff[100]; + + time_t t = time(NULL); + struct tm *ptr = gmtime(&t); + + strftime(buff, sizeof(buff)-1, "%a, %b %d %Y %H:%M:%S GMT", ptr); + + return buff; +} + +int rtsp_pkt_find_end(char * p_buf) +{ + int end_off = 0; + int rtsp_pkt_finish = 0; + + while (p_buf[end_off] != '\0') + { + if ((p_buf[end_off+0] == '\r' && p_buf[end_off+1] == '\n') && + (p_buf[end_off+2] == '\r' && p_buf[end_off+3] == '\n')) + { + rtsp_pkt_finish = 1; + break; + } + + end_off++; + } + + if (rtsp_pkt_finish) + { + return(end_off + 4); + } + + return 0; +} + +time_t rtsp_timegm(struct tm *T) +{ + time_t t, g, z; + struct tm tm; + + t = mktime(T); + if (t == (time_t)-1) + { + return (time_t)-1; + } + + tm = *gmtime(&t); + + tm.tm_isdst = 0; + g = mktime(&tm); + if (g == (time_t)-1) + { + return (time_t)-1; + } + + z = g - t; + return t - z; +} + +BOOL rtsp_parse_xsd_datetime(const char * s, time_t * p) +{ + if (s) + { + char zone[32]; + struct tm T; + const char *t; + + *zone = '\0'; + memset(&T, 0, sizeof(T)); + + if (strchr(s, '-')) + { + t = "%d-%d-%dT%d:%d:%d%31s"; + } + else if (strchr(s, ':')) + { + t = "%4d%2d%2dT%d:%d:%d%31s"; + } + else /* parse non-XSD-standard alternative ISO 8601 format */ + { + t = "%4d%2d%2dT%2d%2d%2d%31s"; + } + + if (sscanf(s, t, &T.tm_year, &T.tm_mon, &T.tm_mday, &T.tm_hour, &T.tm_min, &T.tm_sec, zone) < 6) + { + return FALSE; + } + + if (T.tm_year == 1) + { + T.tm_year = 70; + } + else + { + T.tm_year -= 1900; + } + + T.tm_mon--; + + if (*zone == '.') + { + for (s = zone + 1; *s; s++) + { + if (*s < '0' || *s > '9') + { + break; + } + } + } + else + { + s = zone; + } + + if (*s) + { + if (*s == '+' || *s == '-') + { + int h = 0, m = 0; + if (s[3] == ':') + { + /* +hh:mm */ + sscanf(s, "%d:%d", &h, &m); + if (h < 0) + m = -m; + } + else /* +hhmm */ + { + m = (int)strtol(s, NULL, 10); + h = m / 100; + m = m % 100; + } + + T.tm_min -= m; + T.tm_hour -= h; + /* put hour and min in range */ + T.tm_hour += T.tm_min / 60; + T.tm_min %= 60; + + if (T.tm_min < 0) + { + T.tm_min += 60; + T.tm_hour--; + } + + T.tm_mday += T.tm_hour / 24; + T.tm_hour %= 24; + + if (T.tm_hour < 0) + { + T.tm_hour += 24; + T.tm_mday--; + } + /* note: day of the month may be out of range, timegm() handles it */ + } + + *p = rtsp_timegm(&T); + } + else /* no UTC or timezone, so assume we got a localtime */ + { + T.tm_isdst = -1; + *p = mktime(&T); + } + } + + return TRUE; +} + +int64 rtsp_gettime() +{ +#if __LINUX_OS__ + struct timeval tv; + gettimeofday(&tv, NULL); + return (int64)tv.tv_sec * 1000000 + tv.tv_usec; +#elif __WINDOWS_OS__ + FILETIME ft; + int64 t; + GetSystemTimeAsFileTime(&ft); + t = (int64)ft.dwHighDateTime << 32 | ft.dwLowDateTime; + return t / 10 - 11644473600000000; /* Jan 1, 1601 */ +#endif + + return -1; +} + +uint64 rtsp_ntp_time() +{ + return (rtsp_gettime() / 1000) * 1000 + NTP_OFFSET_US; +} + + + diff --git a/MediaClient/MediaClient/rtsp/rtsp_util.h b/MediaClient/MediaClient/rtsp/rtsp_util.h new file mode 100644 index 0000000..0adf8fc --- /dev/null +++ b/MediaClient/MediaClient/rtsp/rtsp_util.h @@ -0,0 +1,47 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef RTSP_UTIL_H +#define RTSP_UTIL_H + +#define NTP_OFFSET 2208988800ULL +#define NTP_OFFSET_US (NTP_OFFSET * 1000000ULL) + + +#ifdef __cplusplus +extern "C" { +#endif + +uint16 rtsp_get_udp_port(); +uint32 rtsp_get_timestamp(int frequency); +char * rtsp_get_utc_time(); +int rtsp_pkt_find_end(char * p_buf); +BOOL rtsp_parse_xsd_datetime(const char * s, time_t * p); +int64 rtsp_gettime(); +uint64 rtsp_ntp_time(); + + +#ifdef __cplusplus +} +#endif + + +#endif + + diff --git a/MediaClient/MediaClient/rtsp/rtsp_ws.cpp b/MediaClient/MediaClient/rtsp/rtsp_ws.cpp new file mode 100644 index 0000000..64eaed3 --- /dev/null +++ b/MediaClient/MediaClient/rtsp/rtsp_ws.cpp @@ -0,0 +1,211 @@ +/*************************************************************************************** + * + * 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 "rtsp_ws.h" +#include "rtp.h" + + +int rtsp_ws_decode_data(WSMSG * p_msg) +{ + int length, has_mask; + char * p_buff = p_msg->buff; + + /** + * Extracting information from frame + */ + has_mask = p_buff[1] & 0x80 ? 1 : 0; + length = p_buff[1] & 0x7f; + + p_msg->opcode = (p_buff[0] & 0xF); + p_msg->finbit = ((p_buff[0] & 0x80) ? 1 : 0); + + /** + * We need to handle the received frame differently according to which + * length that the frame has set. + * + * length <= 125: We know that length is the actual length of the message, + * and that the maskin data must be placed 2 bytes further + * ahead. + * length == 126: We know that the length is an unsigned 16 bit integer, + * which is placed at the 2 next bytes, and that the masking + * data must be further 2 bytes away. + * length == 127: We know that the length is an unsigned 64 bit integer, + * which is placed at the 8 next bytes, and that the masking + * data must be further 2 bytes away. + */ + if (length <= 125) + { + if (p_msg->rcv_len < 6) + { + return 0; + } + + p_msg->msg_len = length; + p_msg->skip = 2; + + if (has_mask) + { + p_msg->skip += 4; + memcpy(&p_msg->mask, p_buff + 2, sizeof(p_msg->mask)); + } + } + else if (length == 126) + { + if (p_msg->rcv_len < 8) + { + return 0; + } + + p_msg->msg_len = rtp_read_uint16((uint8 *)p_buff + 2); + p_msg->skip = 4; + + if (has_mask) + { + p_msg->skip += 4; + memcpy(&p_msg->mask, p_buff + 4, sizeof(p_msg->mask)); + } + } + else if (length == 127) + { + if (p_msg->rcv_len < 14) + { + return 0; + } + + p_msg->msg_len = (uint32)rtp_read_uint64((uint8 *)p_buff + 2); + p_msg->skip = 10; + + if (has_mask) + { + p_msg->skip += 4; + memcpy(&p_msg->mask, p_buff + 10, sizeof(p_msg->mask)); + } + } + else + { + log_print(HT_LOG_ERR, "%s, Obscure length received from client: %d\r\n", __FUNCTION__, length); + return -1; + } + + /** + * If the message length is greater that our WS_MAXMESSAGE constant, we + * skip the message and close the connection. + */ + if (p_msg->msg_len > WS_MAXMESSAGE) + { + log_print(HT_LOG_ERR, "%s, Message received was bigger than WS_MAXMESSAGE\r\n", __FUNCTION__); + return -1; + } + + uint32 buf_len = (p_msg->rcv_len - p_msg->skip); + + /** + * The message read from recv is larger than the message we are supposed + * to receive. This means that we have received the first part of the next + * message as well. + */ + if (buf_len >= p_msg->msg_len) + { + if (has_mask) + { + char * buff = p_msg->buff + p_msg->skip; + + /** + * If everything went well, we have to remove the masking from the data. + */ + for (uint32 i = 0; i < p_msg->msg_len; i++) + { + buff[i] = buff[i] ^ p_msg->mask[i % 4]; + } + } + + return 1; + } + + return 0; +} + +/*** + * websocket encod data, add websocket header before p_data + * The p_data pointer must reserve a certain amount of space + */ +int rtsp_ws_encode_data(uint8 * p_data, int len, uint8 opcode, uint8 have_mask) +{ + int offset = 0; + uint8 mask[4]; + + if (have_mask) + { + mask[0] = rand(); + mask[1] = rand(); + mask[2] = rand(); + mask[3] = rand(); + + for (int32 i = 0; i < len; i++) + { + p_data[i] = p_data[i] ^ mask[i % 4]; + } + } + + /** + * RFC6455 message encoding + */ + if (len <= 125) + { + p_data -= have_mask ? 6 : 2; + p_data[0] = opcode; + p_data[1] = have_mask ? (len | 0x80) : len; + if (have_mask) + { + memcpy(p_data+2, mask, 4); + } + offset = have_mask ? 6 : 2; + } + else if (len <= 65535) + { + p_data -= have_mask ? 8 : 4; + p_data[0] = opcode; + p_data[1] = have_mask ? (126 | 0x80) : 126; + rtp_write_uint16(p_data + 2, len); + if (have_mask) + { + memcpy(p_data+4, mask, 4); + } + offset = have_mask ? 8 : 4; + } + else + { + uint64 len64 = len; + p_data -= have_mask ? 14 : 10; + p_data[0] = opcode; + p_data[1] = have_mask ? (127 | 0x80) : 127; + rtp_write_uint32(p_data + 2, len64 & 0xFFFF); + rtp_write_uint32(p_data + 6, (len64 >> 32) & 0xFFFF); + if (have_mask) + { + memcpy(p_data+10, mask, 4); + } + offset = have_mask ? 14 : 10; + } + + return offset; +} + + diff --git a/MediaClient/MediaClient/rtsp/rtsp_ws.h b/MediaClient/MediaClient/rtsp/rtsp_ws.h new file mode 100644 index 0000000..797daf8 --- /dev/null +++ b/MediaClient/MediaClient/rtsp/rtsp_ws.h @@ -0,0 +1,62 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef RTSP_WS_H +#define RTSP_WS_H + +#include "sys_inc.h" + +/**************************************************************************************/ + +#define WS_VERSION 13 // websocket version +#define WS_PROTOCOL "rtsp.onvif.org" // websocket protocol +#define WS_MAXMESSAGE 1048576 // Max size message = 1MB + +/**************************************************************************************/ + +typedef struct +{ + uint32 finbit : 1; + uint32 opcode : 4; + uint32 reserved : 27; + + char mask[4]; + int skip; + uint32 buff_len; + uint32 rcv_len; + uint32 msg_len; + char * buff; +} WSMSG; + +#ifdef __cplusplus +extern "C" { +#endif + +int rtsp_ws_decode_data(WSMSG * p_msg); +int rtsp_ws_encode_data(uint8 * p_data, int len, uint8 opcode, uint8 have_mask); + +#ifdef __cplusplus +} +#endif + + +#endif + + + diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL.h new file mode 100644 index 0000000..e2656ca --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL.h @@ -0,0 +1,138 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL.h + * + * Main include header for the SDL library + */ + + +#ifndef SDL_h_ +#define SDL_h_ + +#include "SDL_main.h" +#include "SDL_stdinc.h" +#include "SDL_assert.h" +#include "SDL_atomic.h" +#include "SDL_audio.h" +#include "SDL_clipboard.h" +#include "SDL_cpuinfo.h" +#include "SDL_endian.h" +#include "SDL_error.h" +#include "SDL_events.h" +#include "SDL_filesystem.h" +#include "SDL_gamecontroller.h" +#include "SDL_haptic.h" +#include "SDL_hints.h" +#include "SDL_joystick.h" +#include "SDL_loadso.h" +#include "SDL_log.h" +#include "SDL_messagebox.h" +#include "SDL_metal.h" +#include "SDL_mutex.h" +#include "SDL_power.h" +#include "SDL_render.h" +#include "SDL_rwops.h" +#include "SDL_sensor.h" +#include "SDL_shape.h" +#include "SDL_system.h" +#include "SDL_thread.h" +#include "SDL_timer.h" +#include "SDL_version.h" +#include "SDL_video.h" +#include "SDL_locale.h" +#include "SDL_misc.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* As of version 0.5, SDL is loaded dynamically into the application */ + +/** + * \name SDL_INIT_* + * + * These are the flags which may be passed to SDL_Init(). You should + * specify the subsystems which you will be using in your application. + */ +/* @{ */ +#define SDL_INIT_TIMER 0x00000001u +#define SDL_INIT_AUDIO 0x00000010u +#define SDL_INIT_VIDEO 0x00000020u /**< SDL_INIT_VIDEO implies SDL_INIT_EVENTS */ +#define SDL_INIT_JOYSTICK 0x00000200u /**< SDL_INIT_JOYSTICK implies SDL_INIT_EVENTS */ +#define SDL_INIT_HAPTIC 0x00001000u +#define SDL_INIT_GAMECONTROLLER 0x00002000u /**< SDL_INIT_GAMECONTROLLER implies SDL_INIT_JOYSTICK */ +#define SDL_INIT_EVENTS 0x00004000u +#define SDL_INIT_SENSOR 0x00008000u +#define SDL_INIT_NOPARACHUTE 0x00100000u /**< compatibility; this flag is ignored. */ +#define SDL_INIT_EVERYTHING ( \ + SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_EVENTS | \ + SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER | SDL_INIT_SENSOR \ + ) +/* @} */ + +/** + * This function initializes the subsystems specified by \c flags + */ +extern DECLSPEC int SDLCALL SDL_Init(Uint32 flags); + +/** + * This function initializes specific SDL subsystems + * + * Subsystem initialization is ref-counted, you must call + * SDL_QuitSubSystem() for each SDL_InitSubSystem() to correctly + * shutdown a subsystem manually (or call SDL_Quit() to force shutdown). + * If a subsystem is already loaded then this call will + * increase the ref-count and return. + */ +extern DECLSPEC int SDLCALL SDL_InitSubSystem(Uint32 flags); + +/** + * This function cleans up specific SDL subsystems + */ +extern DECLSPEC void SDLCALL SDL_QuitSubSystem(Uint32 flags); + +/** + * This function returns a mask of the specified subsystems which have + * previously been initialized. + * + * If \c flags is 0, it returns a mask of all initialized subsystems. + */ +extern DECLSPEC Uint32 SDLCALL SDL_WasInit(Uint32 flags); + +/** + * This function cleans up all initialized subsystems. You should + * call it upon all exit conditions. + */ +extern DECLSPEC void SDLCALL SDL_Quit(void); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_assert.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_assert.h new file mode 100644 index 0000000..f8a368e --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_assert.h @@ -0,0 +1,293 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef SDL_assert_h_ +#define SDL_assert_h_ + +#include "SDL_config.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef SDL_ASSERT_LEVEL +#ifdef SDL_DEFAULT_ASSERT_LEVEL +#define SDL_ASSERT_LEVEL SDL_DEFAULT_ASSERT_LEVEL +#elif defined(_DEBUG) || defined(DEBUG) || \ + (defined(__GNUC__) && !defined(__OPTIMIZE__)) +#define SDL_ASSERT_LEVEL 2 +#else +#define SDL_ASSERT_LEVEL 1 +#endif +#endif /* SDL_ASSERT_LEVEL */ + +/* +These are macros and not first class functions so that the debugger breaks +on the assertion line and not in some random guts of SDL, and so each +assert can have unique static variables associated with it. +*/ + +#if defined(_MSC_VER) +/* Don't include intrin.h here because it contains C++ code */ + extern void __cdecl __debugbreak(void); + #define SDL_TriggerBreakpoint() __debugbreak() +#elif ( (!defined(__NACL__)) && ((defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__))) ) + #define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "int $3\n\t" ) +#elif ( defined(__APPLE__) && defined(__arm64__) ) /* this might work on other ARM targets, but this is a known quantity... */ + #define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "brk #22\n\t" ) +#elif defined(__386__) && defined(__WATCOMC__) + #define SDL_TriggerBreakpoint() { _asm { int 0x03 } } +#elif defined(HAVE_SIGNAL_H) && !defined(__WATCOMC__) + #include + #define SDL_TriggerBreakpoint() raise(SIGTRAP) +#else + /* How do we trigger breakpoints on this platform? */ + #define SDL_TriggerBreakpoint() +#endif + +#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 supports __func__ as a standard. */ +# define SDL_FUNCTION __func__ +#elif ((__GNUC__ >= 2) || defined(_MSC_VER) || defined (__WATCOMC__)) +# define SDL_FUNCTION __FUNCTION__ +#else +# define SDL_FUNCTION "???" +#endif +#define SDL_FILE __FILE__ +#define SDL_LINE __LINE__ + +/* +sizeof (x) makes the compiler still parse the expression even without +assertions enabled, so the code is always checked at compile time, but +doesn't actually generate code for it, so there are no side effects or +expensive checks at run time, just the constant size of what x WOULD be, +which presumably gets optimized out as unused. +This also solves the problem of... + + int somevalue = blah(); + SDL_assert(somevalue == 1); + +...which would cause compiles to complain that somevalue is unused if we +disable assertions. +*/ + +/* "while (0,0)" fools Microsoft's compiler's /W4 warning level into thinking + this condition isn't constant. And looks like an owl's face! */ +#ifdef _MSC_VER /* stupid /W4 warnings. */ +#define SDL_NULL_WHILE_LOOP_CONDITION (0,0) +#else +#define SDL_NULL_WHILE_LOOP_CONDITION (0) +#endif + +#define SDL_disabled_assert(condition) \ + do { (void) sizeof ((condition)); } while (SDL_NULL_WHILE_LOOP_CONDITION) + +typedef enum +{ + SDL_ASSERTION_RETRY, /**< Retry the assert immediately. */ + SDL_ASSERTION_BREAK, /**< Make the debugger trigger a breakpoint. */ + SDL_ASSERTION_ABORT, /**< Terminate the program. */ + SDL_ASSERTION_IGNORE, /**< Ignore the assert. */ + SDL_ASSERTION_ALWAYS_IGNORE /**< Ignore the assert from now on. */ +} SDL_AssertState; + +typedef struct SDL_AssertData +{ + int always_ignore; + unsigned int trigger_count; + const char *condition; + const char *filename; + int linenum; + const char *function; + const struct SDL_AssertData *next; +} SDL_AssertData; + +#if (SDL_ASSERT_LEVEL > 0) + +/* Never call this directly. Use the SDL_assert* macros. */ +extern DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *, + const char *, + const char *, int) +#if defined(__clang__) +#if __has_feature(attribute_analyzer_noreturn) +/* this tells Clang's static analysis that we're a custom assert function, + and that the analyzer should assume the condition was always true past this + SDL_assert test. */ + __attribute__((analyzer_noreturn)) +#endif +#endif +; + +/* the do {} while(0) avoids dangling else problems: + if (x) SDL_assert(y); else blah(); + ... without the do/while, the "else" could attach to this macro's "if". + We try to handle just the minimum we need here in a macro...the loop, + the static vars, and break points. The heavy lifting is handled in + SDL_ReportAssertion(), in SDL_assert.c. +*/ +#define SDL_enabled_assert(condition) \ + do { \ + while ( !(condition) ) { \ + static struct SDL_AssertData sdl_assert_data = { \ + 0, 0, #condition, 0, 0, 0, 0 \ + }; \ + const SDL_AssertState sdl_assert_state = SDL_ReportAssertion(&sdl_assert_data, SDL_FUNCTION, SDL_FILE, SDL_LINE); \ + if (sdl_assert_state == SDL_ASSERTION_RETRY) { \ + continue; /* go again. */ \ + } else if (sdl_assert_state == SDL_ASSERTION_BREAK) { \ + SDL_TriggerBreakpoint(); \ + } \ + break; /* not retrying. */ \ + } \ + } while (SDL_NULL_WHILE_LOOP_CONDITION) + +#endif /* enabled assertions support code */ + +/* Enable various levels of assertions. */ +#if SDL_ASSERT_LEVEL == 0 /* assertions disabled */ +# define SDL_assert(condition) SDL_disabled_assert(condition) +# define SDL_assert_release(condition) SDL_disabled_assert(condition) +# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition) +#elif SDL_ASSERT_LEVEL == 1 /* release settings. */ +# define SDL_assert(condition) SDL_disabled_assert(condition) +# define SDL_assert_release(condition) SDL_enabled_assert(condition) +# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition) +#elif SDL_ASSERT_LEVEL == 2 /* normal settings. */ +# define SDL_assert(condition) SDL_enabled_assert(condition) +# define SDL_assert_release(condition) SDL_enabled_assert(condition) +# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition) +#elif SDL_ASSERT_LEVEL == 3 /* paranoid settings. */ +# define SDL_assert(condition) SDL_enabled_assert(condition) +# define SDL_assert_release(condition) SDL_enabled_assert(condition) +# define SDL_assert_paranoid(condition) SDL_enabled_assert(condition) +#else +# error Unknown assertion level. +#endif + +/* this assertion is never disabled at any level. */ +#define SDL_assert_always(condition) SDL_enabled_assert(condition) + + +typedef SDL_AssertState (SDLCALL *SDL_AssertionHandler)( + const SDL_AssertData* data, void* userdata); + +/** + * \brief Set an application-defined assertion handler. + * + * This allows an app to show its own assertion UI and/or force the + * response to an assertion failure. If the app doesn't provide this, SDL + * will try to do the right thing, popping up a system-specific GUI dialog, + * and probably minimizing any fullscreen windows. + * + * This callback may fire from any thread, but it runs wrapped in a mutex, so + * it will only fire from one thread at a time. + * + * Setting the callback to NULL restores SDL's original internal handler. + * + * This callback is NOT reset to SDL's internal handler upon SDL_Quit()! + * + * Return SDL_AssertState value of how to handle the assertion failure. + * + * \param handler Callback function, called when an assertion fails. + * \param userdata A pointer passed to the callback as-is. + */ +extern DECLSPEC void SDLCALL SDL_SetAssertionHandler( + SDL_AssertionHandler handler, + void *userdata); + +/** + * \brief Get the default assertion handler. + * + * This returns the function pointer that is called by default when an + * assertion is triggered. This is an internal function provided by SDL, + * that is used for assertions when SDL_SetAssertionHandler() hasn't been + * used to provide a different function. + * + * \return The default SDL_AssertionHandler that is called when an assert triggers. + */ +extern DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetDefaultAssertionHandler(void); + +/** + * \brief Get the current assertion handler. + * + * This returns the function pointer that is called when an assertion is + * triggered. This is either the value last passed to + * SDL_SetAssertionHandler(), or if no application-specified function is + * set, is equivalent to calling SDL_GetDefaultAssertionHandler(). + * + * \param puserdata Pointer to a void*, which will store the "userdata" + * pointer that was passed to SDL_SetAssertionHandler(). + * This value will always be NULL for the default handler. + * If you don't care about this data, it is safe to pass + * a NULL pointer to this function to ignore it. + * \return The SDL_AssertionHandler that is called when an assert triggers. + */ +extern DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetAssertionHandler(void **puserdata); + +/** + * \brief Get a list of all assertion failures. + * + * Get all assertions triggered since last call to SDL_ResetAssertionReport(), + * or the start of the program. + * + * The proper way to examine this data looks something like this: + * + * + * const SDL_AssertData *item = SDL_GetAssertionReport(); + * while (item) { + * printf("'%s', %s (%s:%d), triggered %u times, always ignore: %s.\\n", + * item->condition, item->function, item->filename, + * item->linenum, item->trigger_count, + * item->always_ignore ? "yes" : "no"); + * item = item->next; + * } + * + * + * \return List of all assertions. + * \sa SDL_ResetAssertionReport + */ +extern DECLSPEC const SDL_AssertData * SDLCALL SDL_GetAssertionReport(void); + +/** + * \brief Reset the list of all assertion failures. + * + * Reset list of all assertions triggered. + * + * \sa SDL_GetAssertionReport + */ +extern DECLSPEC void SDLCALL SDL_ResetAssertionReport(void); + + +/* these had wrong naming conventions until 2.0.4. Please update your app! */ +#define SDL_assert_state SDL_AssertState +#define SDL_assert_data SDL_AssertData + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_assert_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_atomic.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_atomic.h new file mode 100644 index 0000000..e99f1bc --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_atomic.h @@ -0,0 +1,295 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_atomic.h + * + * Atomic operations. + * + * IMPORTANT: + * If you are not an expert in concurrent lockless programming, you should + * only be using the atomic lock and reference counting functions in this + * file. In all other cases you should be protecting your data structures + * with full mutexes. + * + * The list of "safe" functions to use are: + * SDL_AtomicLock() + * SDL_AtomicUnlock() + * SDL_AtomicIncRef() + * SDL_AtomicDecRef() + * + * Seriously, here be dragons! + * ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + * + * You can find out a little more about lockless programming and the + * subtle issues that can arise here: + * http://msdn.microsoft.com/en-us/library/ee418650%28v=vs.85%29.aspx + * + * There's also lots of good information here: + * http://www.1024cores.net/home/lock-free-algorithms + * http://preshing.com/ + * + * These operations may or may not actually be implemented using + * processor specific atomic operations. When possible they are + * implemented as true processor specific atomic operations. When that + * is not possible the are implemented using locks that *do* use the + * available atomic operations. + * + * All of the atomic operations that modify memory are full memory barriers. + */ + +#ifndef SDL_atomic_h_ +#define SDL_atomic_h_ + +#include "SDL_stdinc.h" +#include "SDL_platform.h" + +#include "begin_code.h" + +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \name SDL AtomicLock + * + * The atomic locks are efficient spinlocks using CPU instructions, + * but are vulnerable to starvation and can spin forever if a thread + * holding a lock has been terminated. For this reason you should + * minimize the code executed inside an atomic lock and never do + * expensive things like API or system calls while holding them. + * + * The atomic locks are not safe to lock recursively. + * + * Porting Note: + * The spin lock functions and type are required and can not be + * emulated because they are used in the atomic emulation code. + */ +/* @{ */ + +typedef int SDL_SpinLock; + +/** + * \brief Try to lock a spin lock by setting it to a non-zero value. + * + * \param lock Points to the lock. + * + * \return SDL_TRUE if the lock succeeded, SDL_FALSE if the lock is already held. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_AtomicTryLock(SDL_SpinLock *lock); + +/** + * \brief Lock a spin lock by setting it to a non-zero value. + * + * \param lock Points to the lock. + */ +extern DECLSPEC void SDLCALL SDL_AtomicLock(SDL_SpinLock *lock); + +/** + * \brief Unlock a spin lock by setting it to 0. Always returns immediately + * + * \param lock Points to the lock. + */ +extern DECLSPEC void SDLCALL SDL_AtomicUnlock(SDL_SpinLock *lock); + +/* @} *//* SDL AtomicLock */ + + +/** + * The compiler barrier prevents the compiler from reordering + * reads and writes to globally visible variables across the call. + */ +#if defined(_MSC_VER) && (_MSC_VER > 1200) && !defined(__clang__) +void _ReadWriteBarrier(void); +#pragma intrinsic(_ReadWriteBarrier) +#define SDL_CompilerBarrier() _ReadWriteBarrier() +#elif (defined(__GNUC__) && !defined(__EMSCRIPTEN__)) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120)) +/* This is correct for all CPUs when using GCC or Solaris Studio 12.1+. */ +#define SDL_CompilerBarrier() __asm__ __volatile__ ("" : : : "memory") +#elif defined(__WATCOMC__) +extern _inline void SDL_CompilerBarrier (void); +#pragma aux SDL_CompilerBarrier = "" parm [] modify exact []; +#else +#define SDL_CompilerBarrier() \ +{ SDL_SpinLock _tmp = 0; SDL_AtomicLock(&_tmp); SDL_AtomicUnlock(&_tmp); } +#endif + +/** + * Memory barriers are designed to prevent reads and writes from being + * reordered by the compiler and being seen out of order on multi-core CPUs. + * + * A typical pattern would be for thread A to write some data and a flag, + * and for thread B to read the flag and get the data. In this case you + * would insert a release barrier between writing the data and the flag, + * guaranteeing that the data write completes no later than the flag is + * written, and you would insert an acquire barrier between reading the + * flag and reading the data, to ensure that all the reads associated + * with the flag have completed. + * + * In this pattern you should always see a release barrier paired with + * an acquire barrier and you should gate the data reads/writes with a + * single flag variable. + * + * For more information on these semantics, take a look at the blog post: + * http://preshing.com/20120913/acquire-and-release-semantics + */ +extern DECLSPEC void SDLCALL SDL_MemoryBarrierReleaseFunction(void); +extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquireFunction(void); + +#if defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__)) +#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("lwsync" : : : "memory") +#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("lwsync" : : : "memory") +#elif defined(__GNUC__) && defined(__aarch64__) +#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory") +#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("dmb ish" : : : "memory") +#elif defined(__GNUC__) && defined(__arm__) +#if 0 /* defined(__LINUX__) || defined(__ANDROID__) */ +/* Information from: + https://chromium.googlesource.com/chromium/chromium/+/trunk/base/atomicops_internals_arm_gcc.h#19 + + The Linux kernel provides a helper function which provides the right code for a memory barrier, + hard-coded at address 0xffff0fa0 +*/ +typedef void (*SDL_KernelMemoryBarrierFunc)(); +#define SDL_MemoryBarrierRelease() ((SDL_KernelMemoryBarrierFunc)0xffff0fa0)() +#define SDL_MemoryBarrierAcquire() ((SDL_KernelMemoryBarrierFunc)0xffff0fa0)() +#elif 0 /* defined(__QNXNTO__) */ +#include + +#define SDL_MemoryBarrierRelease() __cpu_membarrier() +#define SDL_MemoryBarrierAcquire() __cpu_membarrier() +#else +#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7EM__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__) || defined(__ARM_ARCH_8A__) +#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory") +#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("dmb ish" : : : "memory") +#elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_5TE__) +#ifdef __thumb__ +/* The mcr instruction isn't available in thumb mode, use real functions */ +#define SDL_MEMORY_BARRIER_USES_FUNCTION +#define SDL_MemoryBarrierRelease() SDL_MemoryBarrierReleaseFunction() +#define SDL_MemoryBarrierAcquire() SDL_MemoryBarrierAcquireFunction() +#else +#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory") +#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory") +#endif /* __thumb__ */ +#else +#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("" : : : "memory") +#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("" : : : "memory") +#endif /* __LINUX__ || __ANDROID__ */ +#endif /* __GNUC__ && __arm__ */ +#else +#if (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120)) +/* This is correct for all CPUs on Solaris when using Solaris Studio 12.1+. */ +#include +#define SDL_MemoryBarrierRelease() __machine_rel_barrier() +#define SDL_MemoryBarrierAcquire() __machine_acq_barrier() +#else +/* This is correct for the x86 and x64 CPUs, and we'll expand this over time. */ +#define SDL_MemoryBarrierRelease() SDL_CompilerBarrier() +#define SDL_MemoryBarrierAcquire() SDL_CompilerBarrier() +#endif +#endif + +/** + * \brief A type representing an atomic integer value. It is a struct + * so people don't accidentally use numeric operations on it. + */ +typedef struct { int value; } SDL_atomic_t; + +/** + * \brief Set an atomic variable to a new value if it is currently an old value. + * + * \return SDL_TRUE if the atomic variable was set, SDL_FALSE otherwise. + * + * \note If you don't know what this function is for, you shouldn't use it! +*/ +extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCAS(SDL_atomic_t *a, int oldval, int newval); + +/** + * \brief Set an atomic variable to a value. + * + * \return The previous value of the atomic variable. + */ +extern DECLSPEC int SDLCALL SDL_AtomicSet(SDL_atomic_t *a, int v); + +/** + * \brief Get the value of an atomic variable + */ +extern DECLSPEC int SDLCALL SDL_AtomicGet(SDL_atomic_t *a); + +/** + * \brief Add to an atomic variable. + * + * \return The previous value of the atomic variable. + * + * \note This same style can be used for any number operation + */ +extern DECLSPEC int SDLCALL SDL_AtomicAdd(SDL_atomic_t *a, int v); + +/** + * \brief Increment an atomic variable used as a reference count. + */ +#ifndef SDL_AtomicIncRef +#define SDL_AtomicIncRef(a) SDL_AtomicAdd(a, 1) +#endif + +/** + * \brief Decrement an atomic variable used as a reference count. + * + * \return SDL_TRUE if the variable reached zero after decrementing, + * SDL_FALSE otherwise + */ +#ifndef SDL_AtomicDecRef +#define SDL_AtomicDecRef(a) (SDL_AtomicAdd(a, -1) == 1) +#endif + +/** + * \brief Set a pointer to a new value if it is currently an old value. + * + * \return SDL_TRUE if the pointer was set, SDL_FALSE otherwise. + * + * \note If you don't know what this function is for, you shouldn't use it! +*/ +extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCASPtr(void **a, void *oldval, void *newval); + +/** + * \brief Set a pointer to a value atomically. + * + * \return The previous value of the pointer. + */ +extern DECLSPEC void* SDLCALL SDL_AtomicSetPtr(void **a, void* v); + +/** + * \brief Get the value of a pointer atomically. + */ +extern DECLSPEC void* SDLCALL SDL_AtomicGetPtr(void **a); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif + +#include "close_code.h" + +#endif /* SDL_atomic_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_audio.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_audio.h new file mode 100644 index 0000000..4ba3491 --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_audio.h @@ -0,0 +1,859 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_audio.h + * + * Access to the raw audio mixing buffer for the SDL library. + */ + +#ifndef SDL_audio_h_ +#define SDL_audio_h_ + +#include "SDL_stdinc.h" +#include "SDL_error.h" +#include "SDL_endian.h" +#include "SDL_mutex.h" +#include "SDL_thread.h" +#include "SDL_rwops.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \brief Audio format flags. + * + * These are what the 16 bits in SDL_AudioFormat currently mean... + * (Unspecified bits are always zero). + * + * \verbatim + ++-----------------------sample is signed if set + || + || ++-----------sample is bigendian if set + || || + || || ++---sample is float if set + || || || + || || || +---sample bit size---+ + || || || | | + 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00 + \endverbatim + * + * There are macros in SDL 2.0 and later to query these bits. + */ +typedef Uint16 SDL_AudioFormat; + +/** + * \name Audio flags + */ +/* @{ */ + +#define SDL_AUDIO_MASK_BITSIZE (0xFF) +#define SDL_AUDIO_MASK_DATATYPE (1<<8) +#define SDL_AUDIO_MASK_ENDIAN (1<<12) +#define SDL_AUDIO_MASK_SIGNED (1<<15) +#define SDL_AUDIO_BITSIZE(x) (x & SDL_AUDIO_MASK_BITSIZE) +#define SDL_AUDIO_ISFLOAT(x) (x & SDL_AUDIO_MASK_DATATYPE) +#define SDL_AUDIO_ISBIGENDIAN(x) (x & SDL_AUDIO_MASK_ENDIAN) +#define SDL_AUDIO_ISSIGNED(x) (x & SDL_AUDIO_MASK_SIGNED) +#define SDL_AUDIO_ISINT(x) (!SDL_AUDIO_ISFLOAT(x)) +#define SDL_AUDIO_ISLITTLEENDIAN(x) (!SDL_AUDIO_ISBIGENDIAN(x)) +#define SDL_AUDIO_ISUNSIGNED(x) (!SDL_AUDIO_ISSIGNED(x)) + +/** + * \name Audio format flags + * + * Defaults to LSB byte order. + */ +/* @{ */ +#define AUDIO_U8 0x0008 /**< Unsigned 8-bit samples */ +#define AUDIO_S8 0x8008 /**< Signed 8-bit samples */ +#define AUDIO_U16LSB 0x0010 /**< Unsigned 16-bit samples */ +#define AUDIO_S16LSB 0x8010 /**< Signed 16-bit samples */ +#define AUDIO_U16MSB 0x1010 /**< As above, but big-endian byte order */ +#define AUDIO_S16MSB 0x9010 /**< As above, but big-endian byte order */ +#define AUDIO_U16 AUDIO_U16LSB +#define AUDIO_S16 AUDIO_S16LSB +/* @} */ + +/** + * \name int32 support + */ +/* @{ */ +#define AUDIO_S32LSB 0x8020 /**< 32-bit integer samples */ +#define AUDIO_S32MSB 0x9020 /**< As above, but big-endian byte order */ +#define AUDIO_S32 AUDIO_S32LSB +/* @} */ + +/** + * \name float32 support + */ +/* @{ */ +#define AUDIO_F32LSB 0x8120 /**< 32-bit floating point samples */ +#define AUDIO_F32MSB 0x9120 /**< As above, but big-endian byte order */ +#define AUDIO_F32 AUDIO_F32LSB +/* @} */ + +/** + * \name Native audio byte ordering + */ +/* @{ */ +#if SDL_BYTEORDER == SDL_LIL_ENDIAN +#define AUDIO_U16SYS AUDIO_U16LSB +#define AUDIO_S16SYS AUDIO_S16LSB +#define AUDIO_S32SYS AUDIO_S32LSB +#define AUDIO_F32SYS AUDIO_F32LSB +#else +#define AUDIO_U16SYS AUDIO_U16MSB +#define AUDIO_S16SYS AUDIO_S16MSB +#define AUDIO_S32SYS AUDIO_S32MSB +#define AUDIO_F32SYS AUDIO_F32MSB +#endif +/* @} */ + +/** + * \name Allow change flags + * + * Which audio format changes are allowed when opening a device. + */ +/* @{ */ +#define SDL_AUDIO_ALLOW_FREQUENCY_CHANGE 0x00000001 +#define SDL_AUDIO_ALLOW_FORMAT_CHANGE 0x00000002 +#define SDL_AUDIO_ALLOW_CHANNELS_CHANGE 0x00000004 +#define SDL_AUDIO_ALLOW_SAMPLES_CHANGE 0x00000008 +#define SDL_AUDIO_ALLOW_ANY_CHANGE (SDL_AUDIO_ALLOW_FREQUENCY_CHANGE|SDL_AUDIO_ALLOW_FORMAT_CHANGE|SDL_AUDIO_ALLOW_CHANNELS_CHANGE|SDL_AUDIO_ALLOW_SAMPLES_CHANGE) +/* @} */ + +/* @} *//* Audio flags */ + +/** + * This function is called when the audio device needs more data. + * + * \param userdata An application-specific parameter saved in + * the SDL_AudioSpec structure + * \param stream A pointer to the audio data buffer. + * \param len The length of that buffer in bytes. + * + * Once the callback returns, the buffer will no longer be valid. + * Stereo samples are stored in a LRLRLR ordering. + * + * You can choose to avoid callbacks and use SDL_QueueAudio() instead, if + * you like. Just open your audio device with a NULL callback. + */ +typedef void (SDLCALL * SDL_AudioCallback) (void *userdata, Uint8 * stream, + int len); + +/** + * The calculated values in this structure are calculated by SDL_OpenAudio(). + * + * For multi-channel audio, the default SDL channel mapping is: + * 2: FL FR (stereo) + * 3: FL FR LFE (2.1 surround) + * 4: FL FR BL BR (quad) + * 5: FL FR FC BL BR (quad + center) + * 6: FL FR FC LFE SL SR (5.1 surround - last two can also be BL BR) + * 7: FL FR FC LFE BC SL SR (6.1 surround) + * 8: FL FR FC LFE BL BR SL SR (7.1 surround) + */ +typedef struct SDL_AudioSpec +{ + int freq; /**< DSP frequency -- samples per second */ + SDL_AudioFormat format; /**< Audio data format */ + Uint8 channels; /**< Number of channels: 1 mono, 2 stereo */ + Uint8 silence; /**< Audio buffer silence value (calculated) */ + Uint16 samples; /**< Audio buffer size in sample FRAMES (total samples divided by channel count) */ + Uint16 padding; /**< Necessary for some compile environments */ + Uint32 size; /**< Audio buffer size in bytes (calculated) */ + SDL_AudioCallback callback; /**< Callback that feeds the audio device (NULL to use SDL_QueueAudio()). */ + void *userdata; /**< Userdata passed to callback (ignored for NULL callbacks). */ +} SDL_AudioSpec; + + +struct SDL_AudioCVT; +typedef void (SDLCALL * SDL_AudioFilter) (struct SDL_AudioCVT * cvt, + SDL_AudioFormat format); + +/** + * \brief Upper limit of filters in SDL_AudioCVT + * + * The maximum number of SDL_AudioFilter functions in SDL_AudioCVT is + * currently limited to 9. The SDL_AudioCVT.filters array has 10 pointers, + * one of which is the terminating NULL pointer. + */ +#define SDL_AUDIOCVT_MAX_FILTERS 9 + +/** + * \struct SDL_AudioCVT + * \brief A structure to hold a set of audio conversion filters and buffers. + * + * Note that various parts of the conversion pipeline can take advantage + * of SIMD operations (like SSE2, for example). SDL_AudioCVT doesn't require + * you to pass it aligned data, but can possibly run much faster if you + * set both its (buf) field to a pointer that is aligned to 16 bytes, and its + * (len) field to something that's a multiple of 16, if possible. + */ +#ifdef __GNUC__ +/* This structure is 84 bytes on 32-bit architectures, make sure GCC doesn't + pad it out to 88 bytes to guarantee ABI compatibility between compilers. + vvv + The next time we rev the ABI, make sure to size the ints and add padding. +*/ +#define SDL_AUDIOCVT_PACKED __attribute__((packed)) +#else +#define SDL_AUDIOCVT_PACKED +#endif +/* */ +typedef struct SDL_AudioCVT +{ + int needed; /**< Set to 1 if conversion possible */ + SDL_AudioFormat src_format; /**< Source audio format */ + SDL_AudioFormat dst_format; /**< Target audio format */ + double rate_incr; /**< Rate conversion increment */ + Uint8 *buf; /**< Buffer to hold entire audio data */ + int len; /**< Length of original audio buffer */ + int len_cvt; /**< Length of converted audio buffer */ + int len_mult; /**< buffer must be len*len_mult big */ + double len_ratio; /**< Given len, final size is len*len_ratio */ + SDL_AudioFilter filters[SDL_AUDIOCVT_MAX_FILTERS + 1]; /**< NULL-terminated list of filter functions */ + int filter_index; /**< Current audio conversion function */ +} SDL_AUDIOCVT_PACKED SDL_AudioCVT; + + +/* Function prototypes */ + +/** + * \name Driver discovery functions + * + * These functions return the list of built in audio drivers, in the + * order that they are normally initialized by default. + */ +/* @{ */ +extern DECLSPEC int SDLCALL SDL_GetNumAudioDrivers(void); +extern DECLSPEC const char *SDLCALL SDL_GetAudioDriver(int index); +/* @} */ + +/** + * \name Initialization and cleanup + * + * \internal These functions are used internally, and should not be used unless + * you have a specific need to specify the audio driver you want to + * use. You should normally use SDL_Init() or SDL_InitSubSystem(). + */ +/* @{ */ +extern DECLSPEC int SDLCALL SDL_AudioInit(const char *driver_name); +extern DECLSPEC void SDLCALL SDL_AudioQuit(void); +/* @} */ + +/** + * This function returns the name of the current audio driver, or NULL + * if no driver has been initialized. + */ +extern DECLSPEC const char *SDLCALL SDL_GetCurrentAudioDriver(void); + +/** + * This function opens the audio device with the desired parameters, and + * returns 0 if successful, placing the actual hardware parameters in the + * structure pointed to by \c obtained. If \c obtained is NULL, the audio + * data passed to the callback function will be guaranteed to be in the + * requested format, and will be automatically converted to the hardware + * audio format if necessary. This function returns -1 if it failed + * to open the audio device, or couldn't set up the audio thread. + * + * When filling in the desired audio spec structure, + * - \c desired->freq should be the desired audio frequency in samples-per- + * second. + * - \c desired->format should be the desired audio format. + * - \c desired->samples is the desired size of the audio buffer, in + * samples. This number should be a power of two, and may be adjusted by + * the audio driver to a value more suitable for the hardware. Good values + * seem to range between 512 and 8096 inclusive, depending on the + * application and CPU speed. Smaller values yield faster response time, + * but can lead to underflow if the application is doing heavy processing + * and cannot fill the audio buffer in time. A stereo sample consists of + * both right and left channels in LR ordering. + * Note that the number of samples is directly related to time by the + * following formula: \code ms = (samples*1000)/freq \endcode + * - \c desired->size is the size in bytes of the audio buffer, and is + * calculated by SDL_OpenAudio(). + * - \c desired->silence is the value used to set the buffer to silence, + * and is calculated by SDL_OpenAudio(). + * - \c desired->callback should be set to a function that will be called + * when the audio device is ready for more data. It is passed a pointer + * to the audio buffer, and the length in bytes of the audio buffer. + * This function usually runs in a separate thread, and so you should + * protect data structures that it accesses by calling SDL_LockAudio() + * and SDL_UnlockAudio() in your code. Alternately, you may pass a NULL + * pointer here, and call SDL_QueueAudio() with some frequency, to queue + * more audio samples to be played (or for capture devices, call + * SDL_DequeueAudio() with some frequency, to obtain audio samples). + * - \c desired->userdata is passed as the first parameter to your callback + * function. If you passed a NULL callback, this value is ignored. + * + * The audio device starts out playing silence when it's opened, and should + * be enabled for playing by calling \c SDL_PauseAudio(0) when you are ready + * for your audio callback function to be called. Since the audio driver + * may modify the requested size of the audio buffer, you should allocate + * any local mixing buffers after you open the audio device. + */ +extern DECLSPEC int SDLCALL SDL_OpenAudio(SDL_AudioSpec * desired, + SDL_AudioSpec * obtained); + +/** + * SDL Audio Device IDs. + * + * A successful call to SDL_OpenAudio() is always device id 1, and legacy + * SDL audio APIs assume you want this device ID. SDL_OpenAudioDevice() calls + * always returns devices >= 2 on success. The legacy calls are good both + * for backwards compatibility and when you don't care about multiple, + * specific, or capture devices. + */ +typedef Uint32 SDL_AudioDeviceID; + +/** + * Get the number of available devices exposed by the current driver. + * Only valid after a successfully initializing the audio subsystem. + * Returns -1 if an explicit list of devices can't be determined; this is + * not an error. For example, if SDL is set up to talk to a remote audio + * server, it can't list every one available on the Internet, but it will + * still allow a specific host to be specified to SDL_OpenAudioDevice(). + * + * In many common cases, when this function returns a value <= 0, it can still + * successfully open the default device (NULL for first argument of + * SDL_OpenAudioDevice()). + */ +extern DECLSPEC int SDLCALL SDL_GetNumAudioDevices(int iscapture); + +/** + * Get the human-readable name of a specific audio device. + * Must be a value between 0 and (number of audio devices-1). + * Only valid after a successfully initializing the audio subsystem. + * The values returned by this function reflect the latest call to + * SDL_GetNumAudioDevices(); recall that function to redetect available + * hardware. + * + * The string returned by this function is UTF-8 encoded, read-only, and + * managed internally. You are not to free it. If you need to keep the + * string for any length of time, you should make your own copy of it, as it + * will be invalid next time any of several other SDL functions is called. + */ +extern DECLSPEC const char *SDLCALL SDL_GetAudioDeviceName(int index, + int iscapture); + + +/** + * Open a specific audio device. Passing in a device name of NULL requests + * the most reasonable default (and is equivalent to calling SDL_OpenAudio()). + * + * The device name is a UTF-8 string reported by SDL_GetAudioDeviceName(), but + * some drivers allow arbitrary and driver-specific strings, such as a + * hostname/IP address for a remote audio server, or a filename in the + * diskaudio driver. + * + * \return 0 on error, a valid device ID that is >= 2 on success. + * + * SDL_OpenAudio(), unlike this function, always acts on device ID 1. + */ +extern DECLSPEC SDL_AudioDeviceID SDLCALL SDL_OpenAudioDevice(const char + *device, + int iscapture, + const + SDL_AudioSpec * + desired, + SDL_AudioSpec * + obtained, + int + allowed_changes); + + + +/** + * \name Audio state + * + * Get the current audio state. + */ +/* @{ */ +typedef enum +{ + SDL_AUDIO_STOPPED = 0, + SDL_AUDIO_PLAYING, + SDL_AUDIO_PAUSED +} SDL_AudioStatus; +extern DECLSPEC SDL_AudioStatus SDLCALL SDL_GetAudioStatus(void); + +extern DECLSPEC SDL_AudioStatus SDLCALL +SDL_GetAudioDeviceStatus(SDL_AudioDeviceID dev); +/* @} *//* Audio State */ + +/** + * \name Pause audio functions + * + * These functions pause and unpause the audio callback processing. + * They should be called with a parameter of 0 after opening the audio + * device to start playing sound. This is so you can safely initialize + * data for your callback function after opening the audio device. + * Silence will be written to the audio device during the pause. + */ +/* @{ */ +extern DECLSPEC void SDLCALL SDL_PauseAudio(int pause_on); +extern DECLSPEC void SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev, + int pause_on); +/* @} *//* Pause audio functions */ + +/** + * \brief Load the audio data of a WAVE file into memory + * + * Loading a WAVE file requires \c src, \c spec, \c audio_buf and \c audio_len + * to be valid pointers. The entire data portion of the file is then loaded + * into memory and decoded if necessary. + * + * If \c freesrc is non-zero, the data source gets automatically closed and + * freed before the function returns. + * + * Supported are RIFF WAVE files with the formats PCM (8, 16, 24, and 32 bits), + * IEEE Float (32 bits), Microsoft ADPCM and IMA ADPCM (4 bits), and A-law and + * µ-law (8 bits). Other formats are currently unsupported and cause an error. + * + * If this function succeeds, the pointer returned by it is equal to \c spec + * and the pointer to the audio data allocated by the function is written to + * \c audio_buf and its length in bytes to \c audio_len. The \ref SDL_AudioSpec + * members \c freq, \c channels, and \c format are set to the values of the + * audio data in the buffer. The \c samples member is set to a sane default and + * all others are set to zero. + * + * It's necessary to use SDL_FreeWAV() to free the audio data returned in + * \c audio_buf when it is no longer used. + * + * Because of the underspecification of the Waveform format, there are many + * problematic files in the wild that cause issues with strict decoders. To + * provide compatibility with these files, this decoder is lenient in regards + * to the truncation of the file, the fact chunk, and the size of the RIFF + * chunk. The hints SDL_HINT_WAVE_RIFF_CHUNK_SIZE, SDL_HINT_WAVE_TRUNCATION, + * and SDL_HINT_WAVE_FACT_CHUNK can be used to tune the behavior of the + * loading process. + * + * Any file that is invalid (due to truncation, corruption, or wrong values in + * the headers), too big, or unsupported causes an error. Additionally, any + * critical I/O error from the data source will terminate the loading process + * with an error. The function returns NULL on error and in all cases (with the + * exception of \c src being NULL), an appropriate error message will be set. + * + * It is required that the data source supports seeking. + * + * Example: + * \code + * SDL_LoadWAV_RW(SDL_RWFromFile("sample.wav", "rb"), 1, ...); + * \endcode + * + * \param src The data source with the WAVE data + * \param freesrc A integer value that makes the function close the data source if non-zero + * \param spec A pointer filled with the audio format of the audio data + * \param audio_buf A pointer filled with the audio data allocated by the function + * \param audio_len A pointer filled with the length of the audio data buffer in bytes + * \return NULL on error, or non-NULL on success. + */ +extern DECLSPEC SDL_AudioSpec *SDLCALL SDL_LoadWAV_RW(SDL_RWops * src, + int freesrc, + SDL_AudioSpec * spec, + Uint8 ** audio_buf, + Uint32 * audio_len); + +/** + * Loads a WAV from a file. + * Compatibility convenience function. + */ +#define SDL_LoadWAV(file, spec, audio_buf, audio_len) \ + SDL_LoadWAV_RW(SDL_RWFromFile(file, "rb"),1, spec,audio_buf,audio_len) + +/** + * This function frees data previously allocated with SDL_LoadWAV_RW() + */ +extern DECLSPEC void SDLCALL SDL_FreeWAV(Uint8 * audio_buf); + +/** + * This function takes a source format and rate and a destination format + * and rate, and initializes the \c cvt structure with information needed + * by SDL_ConvertAudio() to convert a buffer of audio data from one format + * to the other. An unsupported format causes an error and -1 will be returned. + * + * \return 0 if no conversion is needed, 1 if the audio filter is set up, + * or -1 on error. + */ +extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT * cvt, + SDL_AudioFormat src_format, + Uint8 src_channels, + int src_rate, + SDL_AudioFormat dst_format, + Uint8 dst_channels, + int dst_rate); + +/** + * Once you have initialized the \c cvt structure using SDL_BuildAudioCVT(), + * created an audio buffer \c cvt->buf, and filled it with \c cvt->len bytes of + * audio data in the source format, this function will convert it in-place + * to the desired format. + * + * The data conversion may expand the size of the audio data, so the buffer + * \c cvt->buf should be allocated after the \c cvt structure is initialized by + * SDL_BuildAudioCVT(), and should be \c cvt->len*cvt->len_mult bytes long. + * + * \return 0 on success or -1 if \c cvt->buf is NULL. + */ +extern DECLSPEC int SDLCALL SDL_ConvertAudio(SDL_AudioCVT * cvt); + +/* SDL_AudioStream is a new audio conversion interface. + The benefits vs SDL_AudioCVT: + - it can handle resampling data in chunks without generating + artifacts, when it doesn't have the complete buffer available. + - it can handle incoming data in any variable size. + - You push data as you have it, and pull it when you need it + */ +/* this is opaque to the outside world. */ +struct _SDL_AudioStream; +typedef struct _SDL_AudioStream SDL_AudioStream; + +/** + * Create a new audio stream + * + * \param src_format The format of the source audio + * \param src_channels The number of channels of the source audio + * \param src_rate The sampling rate of the source audio + * \param dst_format The format of the desired audio output + * \param dst_channels The number of channels of the desired audio output + * \param dst_rate The sampling rate of the desired audio output + * \return 0 on success, or -1 on error. + * + * \sa SDL_AudioStreamPut + * \sa SDL_AudioStreamGet + * \sa SDL_AudioStreamAvailable + * \sa SDL_AudioStreamFlush + * \sa SDL_AudioStreamClear + * \sa SDL_FreeAudioStream + */ +extern DECLSPEC SDL_AudioStream * SDLCALL SDL_NewAudioStream(const SDL_AudioFormat src_format, + const Uint8 src_channels, + const int src_rate, + const SDL_AudioFormat dst_format, + const Uint8 dst_channels, + const int dst_rate); + +/** + * Add data to be converted/resampled to the stream + * + * \param stream The stream the audio data is being added to + * \param buf A pointer to the audio data to add + * \param len The number of bytes to write to the stream + * \return 0 on success, or -1 on error. + * + * \sa SDL_NewAudioStream + * \sa SDL_AudioStreamGet + * \sa SDL_AudioStreamAvailable + * \sa SDL_AudioStreamFlush + * \sa SDL_AudioStreamClear + * \sa SDL_FreeAudioStream + */ +extern DECLSPEC int SDLCALL SDL_AudioStreamPut(SDL_AudioStream *stream, const void *buf, int len); + +/** + * Get converted/resampled data from the stream + * + * \param stream The stream the audio is being requested from + * \param buf A buffer to fill with audio data + * \param len The maximum number of bytes to fill + * \return The number of bytes read from the stream, or -1 on error + * + * \sa SDL_NewAudioStream + * \sa SDL_AudioStreamPut + * \sa SDL_AudioStreamAvailable + * \sa SDL_AudioStreamFlush + * \sa SDL_AudioStreamClear + * \sa SDL_FreeAudioStream + */ +extern DECLSPEC int SDLCALL SDL_AudioStreamGet(SDL_AudioStream *stream, void *buf, int len); + +/** + * Get the number of converted/resampled bytes available. The stream may be + * buffering data behind the scenes until it has enough to resample + * correctly, so this number might be lower than what you expect, or even + * be zero. Add more data or flush the stream if you need the data now. + * + * \sa SDL_NewAudioStream + * \sa SDL_AudioStreamPut + * \sa SDL_AudioStreamGet + * \sa SDL_AudioStreamFlush + * \sa SDL_AudioStreamClear + * \sa SDL_FreeAudioStream + */ +extern DECLSPEC int SDLCALL SDL_AudioStreamAvailable(SDL_AudioStream *stream); + +/** + * Tell the stream that you're done sending data, and anything being buffered + * should be converted/resampled and made available immediately. + * + * It is legal to add more data to a stream after flushing, but there will + * be audio gaps in the output. Generally this is intended to signal the + * end of input, so the complete output becomes available. + * + * \sa SDL_NewAudioStream + * \sa SDL_AudioStreamPut + * \sa SDL_AudioStreamGet + * \sa SDL_AudioStreamAvailable + * \sa SDL_AudioStreamClear + * \sa SDL_FreeAudioStream + */ +extern DECLSPEC int SDLCALL SDL_AudioStreamFlush(SDL_AudioStream *stream); + +/** + * Clear any pending data in the stream without converting it + * + * \sa SDL_NewAudioStream + * \sa SDL_AudioStreamPut + * \sa SDL_AudioStreamGet + * \sa SDL_AudioStreamAvailable + * \sa SDL_AudioStreamFlush + * \sa SDL_FreeAudioStream + */ +extern DECLSPEC void SDLCALL SDL_AudioStreamClear(SDL_AudioStream *stream); + +/** + * Free an audio stream + * + * \sa SDL_NewAudioStream + * \sa SDL_AudioStreamPut + * \sa SDL_AudioStreamGet + * \sa SDL_AudioStreamAvailable + * \sa SDL_AudioStreamFlush + * \sa SDL_AudioStreamClear + */ +extern DECLSPEC void SDLCALL SDL_FreeAudioStream(SDL_AudioStream *stream); + +#define SDL_MIX_MAXVOLUME 128 +/** + * This takes two audio buffers of the playing audio format and mixes + * them, performing addition, volume adjustment, and overflow clipping. + * The volume ranges from 0 - 128, and should be set to ::SDL_MIX_MAXVOLUME + * for full audio volume. Note this does not change hardware volume. + * This is provided for convenience -- you can mix your own audio data. + */ +extern DECLSPEC void SDLCALL SDL_MixAudio(Uint8 * dst, const Uint8 * src, + Uint32 len, int volume); + +/** + * This works like SDL_MixAudio(), but you specify the audio format instead of + * using the format of audio device 1. Thus it can be used when no audio + * device is open at all. + */ +extern DECLSPEC void SDLCALL SDL_MixAudioFormat(Uint8 * dst, + const Uint8 * src, + SDL_AudioFormat format, + Uint32 len, int volume); + +/** + * Queue more audio on non-callback devices. + * + * (If you are looking to retrieve queued audio from a non-callback capture + * device, you want SDL_DequeueAudio() instead. This will return -1 to + * signify an error if you use it with capture devices.) + * + * SDL offers two ways to feed audio to the device: you can either supply a + * callback that SDL triggers with some frequency to obtain more audio + * (pull method), or you can supply no callback, and then SDL will expect + * you to supply data at regular intervals (push method) with this function. + * + * There are no limits on the amount of data you can queue, short of + * exhaustion of address space. Queued data will drain to the device as + * necessary without further intervention from you. If the device needs + * audio but there is not enough queued, it will play silence to make up + * the difference. This means you will have skips in your audio playback + * if you aren't routinely queueing sufficient data. + * + * This function copies the supplied data, so you are safe to free it when + * the function returns. This function is thread-safe, but queueing to the + * same device from two threads at once does not promise which buffer will + * be queued first. + * + * You may not queue audio on a device that is using an application-supplied + * callback; doing so returns an error. You have to use the audio callback + * or queue audio with this function, but not both. + * + * You should not call SDL_LockAudio() on the device before queueing; SDL + * handles locking internally for this function. + * + * \param dev The device ID to which we will queue audio. + * \param data The data to queue to the device for later playback. + * \param len The number of bytes (not samples!) to which (data) points. + * \return 0 on success, or -1 on error. + * + * \sa SDL_GetQueuedAudioSize + * \sa SDL_ClearQueuedAudio + */ +extern DECLSPEC int SDLCALL SDL_QueueAudio(SDL_AudioDeviceID dev, const void *data, Uint32 len); + +/** + * Dequeue more audio on non-callback devices. + * + * (If you are looking to queue audio for output on a non-callback playback + * device, you want SDL_QueueAudio() instead. This will always return 0 + * if you use it with playback devices.) + * + * SDL offers two ways to retrieve audio from a capture device: you can + * either supply a callback that SDL triggers with some frequency as the + * device records more audio data, (push method), or you can supply no + * callback, and then SDL will expect you to retrieve data at regular + * intervals (pull method) with this function. + * + * There are no limits on the amount of data you can queue, short of + * exhaustion of address space. Data from the device will keep queuing as + * necessary without further intervention from you. This means you will + * eventually run out of memory if you aren't routinely dequeueing data. + * + * Capture devices will not queue data when paused; if you are expecting + * to not need captured audio for some length of time, use + * SDL_PauseAudioDevice() to stop the capture device from queueing more + * data. This can be useful during, say, level loading times. When + * unpaused, capture devices will start queueing data from that point, + * having flushed any capturable data available while paused. + * + * This function is thread-safe, but dequeueing from the same device from + * two threads at once does not promise which thread will dequeued data + * first. + * + * You may not dequeue audio from a device that is using an + * application-supplied callback; doing so returns an error. You have to use + * the audio callback, or dequeue audio with this function, but not both. + * + * You should not call SDL_LockAudio() on the device before queueing; SDL + * handles locking internally for this function. + * + * \param dev The device ID from which we will dequeue audio. + * \param data A pointer into where audio data should be copied. + * \param len The number of bytes (not samples!) to which (data) points. + * \return number of bytes dequeued, which could be less than requested. + * + * \sa SDL_GetQueuedAudioSize + * \sa SDL_ClearQueuedAudio + */ +extern DECLSPEC Uint32 SDLCALL SDL_DequeueAudio(SDL_AudioDeviceID dev, void *data, Uint32 len); + +/** + * Get the number of bytes of still-queued audio. + * + * For playback device: + * + * This is the number of bytes that have been queued for playback with + * SDL_QueueAudio(), but have not yet been sent to the hardware. This + * number may shrink at any time, so this only informs of pending data. + * + * Once we've sent it to the hardware, this function can not decide the + * exact byte boundary of what has been played. It's possible that we just + * gave the hardware several kilobytes right before you called this + * function, but it hasn't played any of it yet, or maybe half of it, etc. + * + * For capture devices: + * + * This is the number of bytes that have been captured by the device and + * are waiting for you to dequeue. This number may grow at any time, so + * this only informs of the lower-bound of available data. + * + * You may not queue audio on a device that is using an application-supplied + * callback; calling this function on such a device always returns 0. + * You have to queue audio with SDL_QueueAudio()/SDL_DequeueAudio(), or use + * the audio callback, but not both. + * + * You should not call SDL_LockAudio() on the device before querying; SDL + * handles locking internally for this function. + * + * \param dev The device ID of which we will query queued audio size. + * \return Number of bytes (not samples!) of queued audio. + * + * \sa SDL_QueueAudio + * \sa SDL_ClearQueuedAudio + */ +extern DECLSPEC Uint32 SDLCALL SDL_GetQueuedAudioSize(SDL_AudioDeviceID dev); + +/** + * Drop any queued audio data. For playback devices, this is any queued data + * still waiting to be submitted to the hardware. For capture devices, this + * is any data that was queued by the device that hasn't yet been dequeued by + * the application. + * + * Immediately after this call, SDL_GetQueuedAudioSize() will return 0. For + * playback devices, the hardware will start playing silence if more audio + * isn't queued. Unpaused capture devices will start filling the queue again + * as soon as they have more data available (which, depending on the state + * of the hardware and the thread, could be before this function call + * returns!). + * + * This will not prevent playback of queued audio that's already been sent + * to the hardware, as we can not undo that, so expect there to be some + * fraction of a second of audio that might still be heard. This can be + * useful if you want to, say, drop any pending music during a level change + * in your game. + * + * You may not queue audio on a device that is using an application-supplied + * callback; calling this function on such a device is always a no-op. + * You have to queue audio with SDL_QueueAudio()/SDL_DequeueAudio(), or use + * the audio callback, but not both. + * + * You should not call SDL_LockAudio() on the device before clearing the + * queue; SDL handles locking internally for this function. + * + * This function always succeeds and thus returns void. + * + * \param dev The device ID of which to clear the audio queue. + * + * \sa SDL_QueueAudio + * \sa SDL_GetQueuedAudioSize + */ +extern DECLSPEC void SDLCALL SDL_ClearQueuedAudio(SDL_AudioDeviceID dev); + + +/** + * \name Audio lock functions + * + * The lock manipulated by these functions protects the callback function. + * During a SDL_LockAudio()/SDL_UnlockAudio() pair, you can be guaranteed that + * the callback function is not running. Do not call these from the callback + * function or you will cause deadlock. + */ +/* @{ */ +extern DECLSPEC void SDLCALL SDL_LockAudio(void); +extern DECLSPEC void SDLCALL SDL_LockAudioDevice(SDL_AudioDeviceID dev); +extern DECLSPEC void SDLCALL SDL_UnlockAudio(void); +extern DECLSPEC void SDLCALL SDL_UnlockAudioDevice(SDL_AudioDeviceID dev); +/* @} *//* Audio lock functions */ + +/** + * This function shuts down audio processing and closes the audio device. + */ +extern DECLSPEC void SDLCALL SDL_CloseAudio(void); +extern DECLSPEC void SDLCALL SDL_CloseAudioDevice(SDL_AudioDeviceID dev); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_audio_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_bits.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_bits.h new file mode 100644 index 0000000..db150ed --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_bits.h @@ -0,0 +1,121 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_bits.h + * + * Functions for fiddling with bits and bitmasks. + */ + +#ifndef SDL_bits_h_ +#define SDL_bits_h_ + +#include "SDL_stdinc.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \file SDL_bits.h + */ + +/** + * Get the index of the most significant bit. Result is undefined when called + * with 0. This operation can also be stated as "count leading zeroes" and + * "log base 2". + * + * \return Index of the most significant bit, or -1 if the value is 0. + */ +#if defined(__WATCOMC__) && defined(__386__) +extern _inline int _SDL_clz_watcom (Uint32); +#pragma aux _SDL_clz_watcom = \ + "bsr eax, eax" \ + "xor eax, 31" \ + parm [eax] nomemory \ + value [eax] \ + modify exact [eax] nomemory; +#endif + +SDL_FORCE_INLINE int +SDL_MostSignificantBitIndex32(Uint32 x) +{ +#if defined(__GNUC__) && (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) + /* Count Leading Zeroes builtin in GCC. + * http://gcc.gnu.org/onlinedocs/gcc-4.3.4/gcc/Other-Builtins.html + */ + if (x == 0) { + return -1; + } + return 31 - __builtin_clz(x); +#elif defined(__WATCOMC__) && defined(__386__) + if (x == 0) { + return -1; + } + return 31 - _SDL_clz_watcom(x); +#else + /* Based off of Bit Twiddling Hacks by Sean Eron Anderson + * , released in the public domain. + * http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog + */ + const Uint32 b[] = {0x2, 0xC, 0xF0, 0xFF00, 0xFFFF0000}; + const int S[] = {1, 2, 4, 8, 16}; + + int msbIndex = 0; + int i; + + if (x == 0) { + return -1; + } + + for (i = 4; i >= 0; i--) + { + if (x & b[i]) + { + x >>= S[i]; + msbIndex |= S[i]; + } + } + + return msbIndex; +#endif +} + +SDL_FORCE_INLINE SDL_bool +SDL_HasExactlyOneBitSet32(Uint32 x) +{ + if (x && !(x & (x - 1))) { + return SDL_TRUE; + } + return SDL_FALSE; +} + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_bits_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_blendmode.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_blendmode.h new file mode 100644 index 0000000..5e21a79 --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_blendmode.h @@ -0,0 +1,123 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_blendmode.h + * + * Header file declaring the SDL_BlendMode enumeration + */ + +#ifndef SDL_blendmode_h_ +#define SDL_blendmode_h_ + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \brief The blend mode used in SDL_RenderCopy() and drawing operations. + */ +typedef enum +{ + SDL_BLENDMODE_NONE = 0x00000000, /**< no blending + dstRGBA = srcRGBA */ + SDL_BLENDMODE_BLEND = 0x00000001, /**< alpha blending + dstRGB = (srcRGB * srcA) + (dstRGB * (1-srcA)) + dstA = srcA + (dstA * (1-srcA)) */ + SDL_BLENDMODE_ADD = 0x00000002, /**< additive blending + dstRGB = (srcRGB * srcA) + dstRGB + dstA = dstA */ + SDL_BLENDMODE_MOD = 0x00000004, /**< color modulate + dstRGB = srcRGB * dstRGB + dstA = dstA */ + SDL_BLENDMODE_MUL = 0x00000008, /**< color multiply + dstRGB = (srcRGB * dstRGB) + (dstRGB * (1-srcA)) + dstA = (srcA * dstA) + (dstA * (1-srcA)) */ + SDL_BLENDMODE_INVALID = 0x7FFFFFFF + + /* Additional custom blend modes can be returned by SDL_ComposeCustomBlendMode() */ + +} SDL_BlendMode; + +/** + * \brief The blend operation used when combining source and destination pixel components + */ +typedef enum +{ + SDL_BLENDOPERATION_ADD = 0x1, /**< dst + src: supported by all renderers */ + SDL_BLENDOPERATION_SUBTRACT = 0x2, /**< dst - src : supported by D3D9, D3D11, OpenGL, OpenGLES */ + SDL_BLENDOPERATION_REV_SUBTRACT = 0x3, /**< src - dst : supported by D3D9, D3D11, OpenGL, OpenGLES */ + SDL_BLENDOPERATION_MINIMUM = 0x4, /**< min(dst, src) : supported by D3D11 */ + SDL_BLENDOPERATION_MAXIMUM = 0x5 /**< max(dst, src) : supported by D3D11 */ + +} SDL_BlendOperation; + +/** + * \brief The normalized factor used to multiply pixel components + */ +typedef enum +{ + SDL_BLENDFACTOR_ZERO = 0x1, /**< 0, 0, 0, 0 */ + SDL_BLENDFACTOR_ONE = 0x2, /**< 1, 1, 1, 1 */ + SDL_BLENDFACTOR_SRC_COLOR = 0x3, /**< srcR, srcG, srcB, srcA */ + SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR = 0x4, /**< 1-srcR, 1-srcG, 1-srcB, 1-srcA */ + SDL_BLENDFACTOR_SRC_ALPHA = 0x5, /**< srcA, srcA, srcA, srcA */ + SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA = 0x6, /**< 1-srcA, 1-srcA, 1-srcA, 1-srcA */ + SDL_BLENDFACTOR_DST_COLOR = 0x7, /**< dstR, dstG, dstB, dstA */ + SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR = 0x8, /**< 1-dstR, 1-dstG, 1-dstB, 1-dstA */ + SDL_BLENDFACTOR_DST_ALPHA = 0x9, /**< dstA, dstA, dstA, dstA */ + SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA = 0xA /**< 1-dstA, 1-dstA, 1-dstA, 1-dstA */ + +} SDL_BlendFactor; + +/** + * \brief Create a custom blend mode, which may or may not be supported by a given renderer + * + * \param srcColorFactor source color factor + * \param dstColorFactor destination color factor + * \param colorOperation color operation + * \param srcAlphaFactor source alpha factor + * \param dstAlphaFactor destination alpha factor + * \param alphaOperation alpha operation + * + * The result of the blend mode operation will be: + * dstRGB = dstRGB * dstColorFactor colorOperation srcRGB * srcColorFactor + * and + * dstA = dstA * dstAlphaFactor alphaOperation srcA * srcAlphaFactor + */ +extern DECLSPEC SDL_BlendMode SDLCALL SDL_ComposeCustomBlendMode(SDL_BlendFactor srcColorFactor, + SDL_BlendFactor dstColorFactor, + SDL_BlendOperation colorOperation, + SDL_BlendFactor srcAlphaFactor, + SDL_BlendFactor dstAlphaFactor, + SDL_BlendOperation alphaOperation); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_blendmode_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_clipboard.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_clipboard.h new file mode 100644 index 0000000..dbf69fc --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_clipboard.h @@ -0,0 +1,71 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_clipboard.h + * + * Include file for SDL clipboard handling + */ + +#ifndef SDL_clipboard_h_ +#define SDL_clipboard_h_ + +#include "SDL_stdinc.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* Function prototypes */ + +/** + * \brief Put UTF-8 text into the clipboard + * + * \sa SDL_GetClipboardText() + */ +extern DECLSPEC int SDLCALL SDL_SetClipboardText(const char *text); + +/** + * \brief Get UTF-8 text from the clipboard, which must be freed with SDL_free() + * + * \sa SDL_SetClipboardText() + */ +extern DECLSPEC char * SDLCALL SDL_GetClipboardText(void); + +/** + * \brief Returns a flag indicating whether the clipboard exists and contains a text string that is non-empty + * + * \sa SDL_GetClipboardText() + */ +extern DECLSPEC SDL_bool SDLCALL SDL_HasClipboardText(void); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_clipboard_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_config.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_config.h new file mode 100644 index 0000000..18a3638 --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_config.h @@ -0,0 +1,288 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef SDL_config_windows_h_ +#define SDL_config_windows_h_ +#define SDL_config_h_ + +#include "SDL_platform.h" + +/* This is a set of defines to configure the SDL features */ + +#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H) +#if defined(__GNUC__) || defined(__DMC__) || defined(__WATCOMC__) +#define HAVE_STDINT_H 1 +#elif defined(_MSC_VER) +typedef signed __int8 int8_t; +typedef unsigned __int8 uint8_t; +typedef signed __int16 int16_t; +typedef unsigned __int16 uint16_t; +typedef signed __int32 int32_t; +typedef unsigned __int32 uint32_t; +typedef signed __int64 int64_t; +typedef unsigned __int64 uint64_t; +#ifndef _UINTPTR_T_DEFINED +#ifdef _WIN64 +typedef unsigned __int64 uintptr_t; +#else +typedef unsigned int uintptr_t; +#endif +#define _UINTPTR_T_DEFINED +#endif +/* Older Visual C++ headers don't have the Win64-compatible typedefs... */ +#if ((_MSC_VER <= 1200) && (!defined(DWORD_PTR))) +#define DWORD_PTR DWORD +#endif +#if ((_MSC_VER <= 1200) && (!defined(LONG_PTR))) +#define LONG_PTR LONG +#endif +#else /* !__GNUC__ && !_MSC_VER */ +typedef signed char int8_t; +typedef unsigned char uint8_t; +typedef signed short int16_t; +typedef unsigned short uint16_t; +typedef signed int int32_t; +typedef unsigned int uint32_t; +typedef signed long long int64_t; +typedef unsigned long long uint64_t; +#ifndef _SIZE_T_DEFINED_ +#define _SIZE_T_DEFINED_ +typedef unsigned int size_t; +#endif +typedef unsigned int uintptr_t; +#endif /* __GNUC__ || _MSC_VER */ +#endif /* !_STDINT_H_ && !HAVE_STDINT_H */ + +#ifdef _WIN64 +# define SIZEOF_VOIDP 8 +#else +# define SIZEOF_VOIDP 4 +#endif + +#define HAVE_DDRAW_H 1 +#define HAVE_DINPUT_H 1 +#define HAVE_DSOUND_H 1 +#define HAVE_DXGI_H 1 +#define HAVE_XINPUT_H 1 +#define HAVE_MMDEVICEAPI_H 1 +#define HAVE_AUDIOCLIENT_H 1 +#define HAVE_SENSORSAPI_H + +/* This is disabled by default to avoid C runtime dependencies and manifest requirements */ +#ifdef HAVE_LIBC +/* Useful headers */ +#define STDC_HEADERS 1 +#define HAVE_CTYPE_H 1 +#define HAVE_FLOAT_H 1 +#define HAVE_LIMITS_H 1 +#define HAVE_MATH_H 1 +#define HAVE_SIGNAL_H 1 +#define HAVE_STDIO_H 1 +#define HAVE_STRING_H 1 + +/* C library functions */ +#define HAVE_MALLOC 1 +#define HAVE_CALLOC 1 +#define HAVE_REALLOC 1 +#define HAVE_FREE 1 +#define HAVE_ALLOCA 1 +#define HAVE_QSORT 1 +#define HAVE_ABS 1 +#define HAVE_MEMSET 1 +#define HAVE_MEMCPY 1 +#define HAVE_MEMMOVE 1 +#define HAVE_MEMCMP 1 +#define HAVE_STRLEN 1 +#define HAVE__STRREV 1 +/* These functions have security warnings, so we won't use them */ +/* #undef HAVE__STRUPR */ +/* #undef HAVE__STRLWR */ +#define HAVE_STRCHR 1 +#define HAVE_STRRCHR 1 +#define HAVE_STRSTR 1 +/* #undef HAVE_STRTOK_R */ +#if defined(_MSC_VER) +#define HAVE_STRTOK_S 1 +#endif +/* These functions have security warnings, so we won't use them */ +/* #undef HAVE__LTOA */ +/* #undef HAVE__ULTOA */ +#define HAVE_STRTOL 1 +#define HAVE_STRTOUL 1 +#define HAVE_STRTOD 1 +#define HAVE_ATOI 1 +#define HAVE_ATOF 1 +#define HAVE_STRCMP 1 +#define HAVE_STRNCMP 1 +#define HAVE__STRICMP 1 +#define HAVE__STRNICMP 1 +#define HAVE__WCSICMP 1 +#define HAVE__WCSNICMP 1 +#define HAVE_ACOS 1 +#define HAVE_ACOSF 1 +#define HAVE_ASIN 1 +#define HAVE_ASINF 1 +#define HAVE_ATAN 1 +#define HAVE_ATANF 1 +#define HAVE_ATAN2 1 +#define HAVE_ATAN2F 1 +#define HAVE_CEILF 1 +#define HAVE__COPYSIGN 1 +#define HAVE_COS 1 +#define HAVE_COSF 1 +#define HAVE_EXP 1 +#define HAVE_EXPF 1 +#define HAVE_FABS 1 +#define HAVE_FABSF 1 +#define HAVE_FLOOR 1 +#define HAVE_FLOORF 1 +#define HAVE_FMOD 1 +#define HAVE_FMODF 1 +#define HAVE_LOG 1 +#define HAVE_LOGF 1 +#define HAVE_LOG10 1 +#define HAVE_LOG10F 1 +#define HAVE_POW 1 +#define HAVE_POWF 1 +#define HAVE_SIN 1 +#define HAVE_SINF 1 +#define HAVE_SQRT 1 +#define HAVE_SQRTF 1 +#define HAVE_TAN 1 +#define HAVE_TANF 1 +#if defined(_MSC_VER) +/* These functions were added with the VC++ 2013 C runtime library */ +#if _MSC_VER >= 1800 +#define HAVE_STRTOLL 1 +#define HAVE_VSSCANF 1 +#define HAVE_SCALBN 1 +#define HAVE_SCALBNF 1 +#define HAVE_TRUNC 1 +#define HAVE_TRUNCF 1 +#endif +/* This function is available with at least the VC++ 2008 C runtime library */ +#if _MSC_VER >= 1400 +#define HAVE__FSEEKI64 1 +#endif +#endif +#if !defined(_MSC_VER) || defined(_USE_MATH_DEFINES) +#define HAVE_M_PI 1 +#endif +#else +#define HAVE_STDARG_H 1 +#define HAVE_STDDEF_H 1 +#endif + +/* Check to see if we have Windows 10 build environment */ +#if _MSC_VER >= 1911 /* Visual Studio 15.3 */ +#include +#if _WIN32_WINNT >= 0x0601 /* Windows 7 */ +#define SDL_WINDOWS7_SDK +#endif +#if _WIN32_WINNT >= 0x0602 /* Windows 8 */ +#define SDL_WINDOWS8_SDK +#endif +#if _WIN32_WINNT >= 0x0A00 /* Windows 10 */ +#define SDL_WINDOWS10_SDK +#endif +#endif /* _MSC_VER >= 1911 */ + +/* Enable various audio drivers */ +#define SDL_AUDIO_DRIVER_WASAPI 1 +#define SDL_AUDIO_DRIVER_DSOUND 1 +#define SDL_AUDIO_DRIVER_WINMM 1 +#define SDL_AUDIO_DRIVER_DISK 1 +#define SDL_AUDIO_DRIVER_DUMMY 1 + +/* Enable various input drivers */ +#define SDL_JOYSTICK_DINPUT 1 +#define SDL_JOYSTICK_HIDAPI 1 +#ifndef __WINRT__ +#define SDL_JOYSTICK_RAWINPUT 1 +#endif +#define SDL_JOYSTICK_VIRTUAL 1 +#ifdef SDL_WINDOWS10_SDK +#define SDL_JOYSTICK_WGI 1 +#endif +#define SDL_JOYSTICK_XINPUT 1 +#define SDL_HAPTIC_DINPUT 1 +#define SDL_HAPTIC_XINPUT 1 + +/* Enable the sensor driver */ +#define SDL_SENSOR_WINDOWS 1 + +/* Enable various shared object loading systems */ +#define SDL_LOADSO_WINDOWS 1 + +/* Enable various threading systems */ +#define SDL_THREAD_WINDOWS 1 + +/* Enable various timer systems */ +#define SDL_TIMER_WINDOWS 1 + +/* Enable various video drivers */ +#define SDL_VIDEO_DRIVER_DUMMY 1 +#define SDL_VIDEO_DRIVER_WINDOWS 1 + +#ifndef SDL_VIDEO_RENDER_D3D +#define SDL_VIDEO_RENDER_D3D 1 +#endif +#ifdef SDL_WINDOWS7_SDK +#define SDL_VIDEO_RENDER_D3D11 1 +#endif + +/* Enable OpenGL support */ +#ifndef SDL_VIDEO_OPENGL +#define SDL_VIDEO_OPENGL 1 +#endif +#ifndef SDL_VIDEO_OPENGL_WGL +#define SDL_VIDEO_OPENGL_WGL 1 +#endif +#ifndef SDL_VIDEO_RENDER_OGL +#define SDL_VIDEO_RENDER_OGL 1 +#endif +#ifndef SDL_VIDEO_RENDER_OGL_ES2 +#define SDL_VIDEO_RENDER_OGL_ES2 1 +#endif +#ifndef SDL_VIDEO_OPENGL_ES2 +#define SDL_VIDEO_OPENGL_ES2 1 +#endif +#ifndef SDL_VIDEO_OPENGL_EGL +#define SDL_VIDEO_OPENGL_EGL 1 +#endif + +/* Enable Vulkan support */ +#define SDL_VIDEO_VULKAN 1 + +/* Enable system power support */ +#define SDL_POWER_WINDOWS 1 + +/* Enable filesystem support */ +#define SDL_FILESYSTEM_WINDOWS 1 + +/* Enable assembly routines (Win64 doesn't have inline asm) */ +#ifndef _WIN64 +#define SDL_ASSEMBLY_ROUTINES 1 +#endif + +#endif /* SDL_config_windows_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_config.h.cmake b/MediaClient/MediaClient/sdl/include/SDL2/SDL_config.h.cmake new file mode 100644 index 0000000..c57266c --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_config.h.cmake @@ -0,0 +1,445 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2017 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef SDL_config_h_ +#define SDL_config_h_ + +/** + * \file SDL_config.h.in + * + * This is a set of defines to configure the SDL features + */ + +/* General platform specific identifiers */ +#include "SDL_platform.h" + +/* C language features */ +#cmakedefine const @HAVE_CONST@ +#cmakedefine inline @HAVE_INLINE@ +#cmakedefine volatile @HAVE_VOLATILE@ + +/* C datatypes */ +/* Define SIZEOF_VOIDP for 64/32 architectures */ +#ifdef __LP64__ +#define SIZEOF_VOIDP 8 +#else +#define SIZEOF_VOIDP 4 +#endif + +#cmakedefine HAVE_GCC_ATOMICS @HAVE_GCC_ATOMICS@ +#cmakedefine HAVE_GCC_SYNC_LOCK_TEST_AND_SET @HAVE_GCC_SYNC_LOCK_TEST_AND_SET@ + +#cmakedefine HAVE_D3D_H @HAVE_D3D_H@ +#cmakedefine HAVE_D3D11_H @HAVE_D3D11_H@ +#cmakedefine HAVE_DDRAW_H @HAVE_DDRAW_H@ +#cmakedefine HAVE_DSOUND_H @HAVE_DSOUND_H@ +#cmakedefine HAVE_DINPUT_H @HAVE_DINPUT_H@ +#cmakedefine HAVE_XAUDIO2_H @HAVE_XAUDIO2_H@ +#cmakedefine HAVE_XINPUT_H @HAVE_XINPUT_H@ +#cmakedefine HAVE_DXGI_H @HAVE_DXGI_H@ +#cmakedefine HAVE_XINPUT_GAMEPAD_EX @HAVE_XINPUT_GAMEPAD_EX@ +#cmakedefine HAVE_XINPUT_STATE_EX @HAVE_XINPUT_STATE_EX@ + +/* Comment this if you want to build without any C library requirements */ +#cmakedefine HAVE_LIBC 1 +#if HAVE_LIBC + +/* Useful headers */ +#cmakedefine HAVE_ALLOCA_H 1 +#cmakedefine HAVE_SYS_TYPES_H 1 +#cmakedefine HAVE_STDIO_H 1 +#cmakedefine STDC_HEADERS 1 +#cmakedefine HAVE_STDLIB_H 1 +#cmakedefine HAVE_STDARG_H 1 +#cmakedefine HAVE_MALLOC_H 1 +#cmakedefine HAVE_MEMORY_H 1 +#cmakedefine HAVE_STRING_H 1 +#cmakedefine HAVE_STRINGS_H 1 +#cmakedefine HAVE_WCHAR_H 1 +#cmakedefine HAVE_INTTYPES_H 1 +#cmakedefine HAVE_STDINT_H 1 +#cmakedefine HAVE_CTYPE_H 1 +#cmakedefine HAVE_MATH_H 1 +#cmakedefine HAVE_ICONV_H 1 +#cmakedefine HAVE_SIGNAL_H 1 +#cmakedefine HAVE_ALTIVEC_H 1 +#cmakedefine HAVE_PTHREAD_NP_H 1 +#cmakedefine HAVE_LIBUDEV_H 1 +#cmakedefine HAVE_DBUS_DBUS_H 1 +#cmakedefine HAVE_IBUS_IBUS_H 1 +#cmakedefine HAVE_FCITX_FRONTEND_H 1 +#cmakedefine HAVE_LIBSAMPLERATE_H 1 + +/* C library functions */ +#cmakedefine HAVE_MALLOC 1 +#cmakedefine HAVE_CALLOC 1 +#cmakedefine HAVE_REALLOC 1 +#cmakedefine HAVE_FREE 1 +#cmakedefine HAVE_ALLOCA 1 +#ifndef __WIN32__ /* Don't use C runtime versions of these on Windows */ +#cmakedefine HAVE_GETENV 1 +#cmakedefine HAVE_SETENV 1 +#cmakedefine HAVE_PUTENV 1 +#cmakedefine HAVE_UNSETENV 1 +#endif +#cmakedefine HAVE_QSORT 1 +#cmakedefine HAVE_ABS 1 +#cmakedefine HAVE_BCOPY 1 +#cmakedefine HAVE_MEMSET 1 +#cmakedefine HAVE_MEMCPY 1 +#cmakedefine HAVE_MEMMOVE 1 +#cmakedefine HAVE_MEMCMP 1 +#cmakedefine HAVE_WCSLEN 1 +#cmakedefine HAVE_WCSLCPY 1 +#cmakedefine HAVE_WCSLCAT 1 +#cmakedefine HAVE_WCSCMP 1 +#cmakedefine HAVE_STRLEN 1 +#cmakedefine HAVE_STRLCPY 1 +#cmakedefine HAVE_STRLCAT 1 +#cmakedefine HAVE_STRDUP 1 +#cmakedefine HAVE__STRREV 1 +#cmakedefine HAVE__STRUPR 1 +#cmakedefine HAVE__STRLWR 1 +#cmakedefine HAVE_INDEX 1 +#cmakedefine HAVE_RINDEX 1 +#cmakedefine HAVE_STRCHR 1 +#cmakedefine HAVE_STRRCHR 1 +#cmakedefine HAVE_STRSTR 1 +#cmakedefine HAVE_ITOA 1 +#cmakedefine HAVE__LTOA 1 +#cmakedefine HAVE__UITOA 1 +#cmakedefine HAVE__ULTOA 1 +#cmakedefine HAVE_STRTOL 1 +#cmakedefine HAVE_STRTOUL 1 +#cmakedefine HAVE__I64TOA 1 +#cmakedefine HAVE__UI64TOA 1 +#cmakedefine HAVE_STRTOLL 1 +#cmakedefine HAVE_STRTOULL 1 +#cmakedefine HAVE_STRTOD 1 +#cmakedefine HAVE_ATOI 1 +#cmakedefine HAVE_ATOF 1 +#cmakedefine HAVE_STRCMP 1 +#cmakedefine HAVE_STRNCMP 1 +#cmakedefine HAVE__STRICMP 1 +#cmakedefine HAVE_STRCASECMP 1 +#cmakedefine HAVE__STRNICMP 1 +#cmakedefine HAVE_STRNCASECMP 1 +#cmakedefine HAVE_VSSCANF 1 +#cmakedefine HAVE_VSNPRINTF 1 +#cmakedefine HAVE_M_PI 1 +#cmakedefine HAVE_ATAN 1 +#cmakedefine HAVE_ATAN2 1 +#cmakedefine HAVE_ACOS 1 +#cmakedefine HAVE_ASIN 1 +#cmakedefine HAVE_CEIL 1 +#cmakedefine HAVE_COPYSIGN 1 +#cmakedefine HAVE_COS 1 +#cmakedefine HAVE_COSF 1 +#cmakedefine HAVE_FABS 1 +#cmakedefine HAVE_FLOOR 1 +#cmakedefine HAVE_LOG 1 +#cmakedefine HAVE_POW 1 +#cmakedefine HAVE_SCALBN 1 +#cmakedefine HAVE_SIN 1 +#cmakedefine HAVE_SINF 1 +#cmakedefine HAVE_SQRT 1 +#cmakedefine HAVE_SQRTF 1 +#cmakedefine HAVE_TAN 1 +#cmakedefine HAVE_TANF 1 +#cmakedefine HAVE_FOPEN64 1 +#cmakedefine HAVE_FSEEKO 1 +#cmakedefine HAVE_FSEEKO64 1 +#cmakedefine HAVE_SIGACTION 1 +#cmakedefine HAVE_SA_SIGACTION 1 +#cmakedefine HAVE_SETJMP 1 +#cmakedefine HAVE_NANOSLEEP 1 +#cmakedefine HAVE_SYSCONF 1 +#cmakedefine HAVE_SYSCTLBYNAME 1 +#cmakedefine HAVE_CLOCK_GETTIME 1 +#cmakedefine HAVE_GETPAGESIZE 1 +#cmakedefine HAVE_MPROTECT 1 +#cmakedefine HAVE_ICONV 1 +#cmakedefine HAVE_PTHREAD_SETNAME_NP 1 +#cmakedefine HAVE_PTHREAD_SET_NAME_NP 1 +#cmakedefine HAVE_SEM_TIMEDWAIT 1 +#cmakedefine HAVE_GETAUXVAL 1 +#cmakedefine HAVE_POLL 1 + +#elif __WIN32__ +#cmakedefine HAVE_STDARG_H 1 +#cmakedefine HAVE_STDDEF_H 1 +#else +/* We may need some replacement for stdarg.h here */ +#include +#endif /* HAVE_LIBC */ + +/* SDL internal assertion support */ +#cmakedefine SDL_DEFAULT_ASSERT_LEVEL @SDL_DEFAULT_ASSERT_LEVEL@ + +/* Allow disabling of core subsystems */ +#cmakedefine SDL_ATOMIC_DISABLED @SDL_ATOMIC_DISABLED@ +#cmakedefine SDL_AUDIO_DISABLED @SDL_AUDIO_DISABLED@ +#cmakedefine SDL_CPUINFO_DISABLED @SDL_CPUINFO_DISABLED@ +#cmakedefine SDL_EVENTS_DISABLED @SDL_EVENTS_DISABLED@ +#cmakedefine SDL_FILE_DISABLED @SDL_FILE_DISABLED@ +#cmakedefine SDL_JOYSTICK_DISABLED @SDL_JOYSTICK_DISABLED@ +#cmakedefine SDL_HAPTIC_DISABLED @SDL_HAPTIC_DISABLED@ +#cmakedefine SDL_LOADSO_DISABLED @SDL_LOADSO_DISABLED@ +#cmakedefine SDL_RENDER_DISABLED @SDL_RENDER_DISABLED@ +#cmakedefine SDL_THREADS_DISABLED @SDL_THREADS_DISABLED@ +#cmakedefine SDL_TIMERS_DISABLED @SDL_TIMERS_DISABLED@ +#cmakedefine SDL_VIDEO_DISABLED @SDL_VIDEO_DISABLED@ +#cmakedefine SDL_POWER_DISABLED @SDL_POWER_DISABLED@ +#cmakedefine SDL_FILESYSTEM_DISABLED @SDL_FILESYSTEM_DISABLED@ + +/* Enable various audio drivers */ +#cmakedefine SDL_AUDIO_DRIVER_ALSA @SDL_AUDIO_DRIVER_ALSA@ +#cmakedefine SDL_AUDIO_DRIVER_ALSA_DYNAMIC @SDL_AUDIO_DRIVER_ALSA_DYNAMIC@ +#cmakedefine SDL_AUDIO_DRIVER_ANDROID @SDL_AUDIO_DRIVER_ANDROID@ +#cmakedefine SDL_AUDIO_DRIVER_ARTS @SDL_AUDIO_DRIVER_ARTS@ +#cmakedefine SDL_AUDIO_DRIVER_ARTS_DYNAMIC @SDL_AUDIO_DRIVER_ARTS_DYNAMIC@ +#cmakedefine SDL_AUDIO_DRIVER_COREAUDIO @SDL_AUDIO_DRIVER_COREAUDIO@ +#cmakedefine SDL_AUDIO_DRIVER_DISK @SDL_AUDIO_DRIVER_DISK@ +#cmakedefine SDL_AUDIO_DRIVER_DSOUND @SDL_AUDIO_DRIVER_DSOUND@ +#cmakedefine SDL_AUDIO_DRIVER_DUMMY @SDL_AUDIO_DRIVER_DUMMY@ +#cmakedefine SDL_AUDIO_DRIVER_EMSCRIPTEN @SDL_AUDIO_DRIVER_EMSCRIPTEN@ +#cmakedefine SDL_AUDIO_DRIVER_ESD @SDL_AUDIO_DRIVER_ESD@ +#cmakedefine SDL_AUDIO_DRIVER_ESD_DYNAMIC @SDL_AUDIO_DRIVER_ESD_DYNAMIC@ +#cmakedefine SDL_AUDIO_DRIVER_FUSIONSOUND @SDL_AUDIO_DRIVER_FUSIONSOUND@ +#cmakedefine SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC @SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC@ +#cmakedefine SDL_AUDIO_DRIVER_HAIKU @SDL_AUDIO_DRIVER_HAIKU@ +#cmakedefine SDL_AUDIO_DRIVER_JACK @SDL_AUDIO_DRIVER_JACK@ +#cmakedefine SDL_AUDIO_DRIVER_JACK_DYNAMIC @SDL_AUDIO_DRIVER_JACK_DYNAMIC@ +#cmakedefine SDL_AUDIO_DRIVER_NAS @SDL_AUDIO_DRIVER_NAS@ +#cmakedefine SDL_AUDIO_DRIVER_NAS_DYNAMIC @SDL_AUDIO_DRIVER_NAS_DYNAMIC@ +#cmakedefine SDL_AUDIO_DRIVER_NETBSD @SDL_AUDIO_DRIVER_NETBSD@ +#cmakedefine SDL_AUDIO_DRIVER_OSS @SDL_AUDIO_DRIVER_OSS@ +#cmakedefine SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H @SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H@ +#cmakedefine SDL_AUDIO_DRIVER_PAUDIO @SDL_AUDIO_DRIVER_PAUDIO@ +#cmakedefine SDL_AUDIO_DRIVER_PULSEAUDIO @SDL_AUDIO_DRIVER_PULSEAUDIO@ +#cmakedefine SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC @SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC@ +#cmakedefine SDL_AUDIO_DRIVER_QSA @SDL_AUDIO_DRIVER_QSA@ +#cmakedefine SDL_AUDIO_DRIVER_SNDIO @SDL_AUDIO_DRIVER_SNDIO@ +#cmakedefine SDL_AUDIO_DRIVER_SNDIO_DYNAMIC @SDL_AUDIO_DRIVER_SNDIO_DYNAMIC@ +#cmakedefine SDL_AUDIO_DRIVER_SUNAUDIO @SDL_AUDIO_DRIVER_SUNAUDIO@ +#cmakedefine SDL_AUDIO_DRIVER_WASAPI @SDL_AUDIO_DRIVER_WASAPI@ +#cmakedefine SDL_AUDIO_DRIVER_WINMM @SDL_AUDIO_DRIVER_WINMM@ +#cmakedefine SDL_AUDIO_DRIVER_XAUDIO2 @SDL_AUDIO_DRIVER_XAUDIO2@ + +/* Enable various input drivers */ +#cmakedefine SDL_INPUT_LINUXEV @SDL_INPUT_LINUXEV@ +#cmakedefine SDL_INPUT_LINUXKD @SDL_INPUT_LINUXKD@ +#cmakedefine SDL_INPUT_TSLIB @SDL_INPUT_TSLIB@ +#cmakedefine SDL_JOYSTICK_ANDROID @SDL_JOYSTICK_ANDROID@ +#cmakedefine SDL_JOYSTICK_HAIKU @SDL_JOYSTICK_HAIKU@ +#cmakedefine SDL_JOYSTICK_DINPUT @SDL_JOYSTICK_DINPUT@ +#cmakedefine SDL_JOYSTICK_XINPUT @SDL_JOYSTICK_XINPUT@ +#cmakedefine SDL_JOYSTICK_DUMMY @SDL_JOYSTICK_DUMMY@ +#cmakedefine SDL_JOYSTICK_IOKIT @SDL_JOYSTICK_IOKIT@ +#cmakedefine SDL_JOYSTICK_MFI @SDL_JOYSTICK_MFI@ +#cmakedefine SDL_JOYSTICK_LINUX @SDL_JOYSTICK_LINUX@ +#cmakedefine SDL_JOYSTICK_WINMM @SDL_JOYSTICK_WINMM@ +#cmakedefine SDL_JOYSTICK_USBHID @SDL_JOYSTICK_USBHID@ +#cmakedefine SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H @SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H@ +#cmakedefine SDL_JOYSTICK_EMSCRIPTEN @SDL_JOYSTICK_EMSCRIPTEN@ +#cmakedefine SDL_HAPTIC_DUMMY @SDL_HAPTIC_DUMMY@ +#cmakedefine SDL_HAPTIC_LINUX @SDL_HAPTIC_LINUX@ +#cmakedefine SDL_HAPTIC_IOKIT @SDL_HAPTIC_IOKIT@ +#cmakedefine SDL_HAPTIC_DINPUT @SDL_HAPTIC_DINPUT@ +#cmakedefine SDL_HAPTIC_XINPUT @SDL_HAPTIC_XINPUT@ +#cmakedefine SDL_HAPTIC_ANDROID @SDL_HAPTIC_ANDROID@ + +/* Enable various shared object loading systems */ +#cmakedefine SDL_LOADSO_DLOPEN @SDL_LOADSO_DLOPEN@ +#cmakedefine SDL_LOADSO_DUMMY @SDL_LOADSO_DUMMY@ +#cmakedefine SDL_LOADSO_LDG @SDL_LOADSO_LDG@ +#cmakedefine SDL_LOADSO_WINDOWS @SDL_LOADSO_WINDOWS@ + +/* Enable various threading systems */ +#cmakedefine SDL_THREAD_PTHREAD @SDL_THREAD_PTHREAD@ +#cmakedefine SDL_THREAD_PTHREAD_RECURSIVE_MUTEX @SDL_THREAD_PTHREAD_RECURSIVE_MUTEX@ +#cmakedefine SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP @SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP@ +#cmakedefine SDL_THREAD_WINDOWS @SDL_THREAD_WINDOWS@ + +/* Enable various timer systems */ +#cmakedefine SDL_TIMER_HAIKU @SDL_TIMER_HAIKU@ +#cmakedefine SDL_TIMER_DUMMY @SDL_TIMER_DUMMY@ +#cmakedefine SDL_TIMER_UNIX @SDL_TIMER_UNIX@ +#cmakedefine SDL_TIMER_WINDOWS @SDL_TIMER_WINDOWS@ +#cmakedefine SDL_TIMER_WINCE @SDL_TIMER_WINCE@ + +/* Enable various video drivers */ +#cmakedefine SDL_VIDEO_DRIVER_ANDROID @SDL_VIDEO_DRIVER_ANDROID@ +#cmakedefine SDL_VIDEO_DRIVER_HAIKU @SDL_VIDEO_DRIVER_HAIKU@ +#cmakedefine SDL_VIDEO_DRIVER_COCOA @SDL_VIDEO_DRIVER_COCOA@ +#cmakedefine SDL_VIDEO_DRIVER_DIRECTFB @SDL_VIDEO_DRIVER_DIRECTFB@ +#cmakedefine SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC @SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC@ +#cmakedefine SDL_VIDEO_DRIVER_DUMMY @SDL_VIDEO_DRIVER_DUMMY@ +#cmakedefine SDL_VIDEO_DRIVER_WINDOWS @SDL_VIDEO_DRIVER_WINDOWS@ +#cmakedefine SDL_VIDEO_DRIVER_WAYLAND @SDL_VIDEO_DRIVER_WAYLAND@ +#cmakedefine SDL_VIDEO_DRIVER_RPI @SDL_VIDEO_DRIVER_RPI@ +#cmakedefine SDL_VIDEO_DRIVER_VIVANTE @SDL_VIDEO_DRIVER_VIVANTE@ +#cmakedefine SDL_VIDEO_DRIVER_VIVANTE_VDK @SDL_VIDEO_DRIVER_VIVANTE_VDK@ + +#cmakedefine SDL_VIDEO_DRIVER_KMSDRM @SDL_VIDEO_DRIVER_KMSDRM@ +#cmakedefine SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC @SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC@ +#cmakedefine SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM @SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM@ + +#cmakedefine SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH @SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH@ +#cmakedefine SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC @SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC@ +#cmakedefine SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL @SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL@ +#cmakedefine SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR @SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR@ +#cmakedefine SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON @SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON@ + +#cmakedefine SDL_VIDEO_DRIVER_MIR @SDL_VIDEO_DRIVER_MIR@ +#cmakedefine SDL_VIDEO_DRIVER_MIR_DYNAMIC @SDL_VIDEO_DRIVER_MIR_DYNAMIC@ +#cmakedefine SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON @SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON@ +#cmakedefine SDL_VIDEO_DRIVER_EMSCRIPTEN @SDL_VIDEO_DRIVER_EMSCRIPTEN@ +#cmakedefine SDL_VIDEO_DRIVER_X11 @SDL_VIDEO_DRIVER_X11@ +#cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC @SDL_VIDEO_DRIVER_X11_DYNAMIC@ +#cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT @SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT@ +#cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR @SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR@ +#cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA @SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA@ +#cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 @SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2@ +#cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR @SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR@ +#cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS @SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS@ +#cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE @SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE@ +#cmakedefine SDL_VIDEO_DRIVER_X11_XCURSOR @SDL_VIDEO_DRIVER_X11_XCURSOR@ +#cmakedefine SDL_VIDEO_DRIVER_X11_XDBE @SDL_VIDEO_DRIVER_X11_XDBE@ +#cmakedefine SDL_VIDEO_DRIVER_X11_XINERAMA @SDL_VIDEO_DRIVER_X11_XINERAMA@ +#cmakedefine SDL_VIDEO_DRIVER_X11_XINPUT2 @SDL_VIDEO_DRIVER_X11_XINPUT2@ +#cmakedefine SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH @SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH@ +#cmakedefine SDL_VIDEO_DRIVER_X11_XRANDR @SDL_VIDEO_DRIVER_X11_XRANDR@ +#cmakedefine SDL_VIDEO_DRIVER_X11_XSCRNSAVER @SDL_VIDEO_DRIVER_X11_XSCRNSAVER@ +#cmakedefine SDL_VIDEO_DRIVER_X11_XSHAPE @SDL_VIDEO_DRIVER_X11_XSHAPE@ +#cmakedefine SDL_VIDEO_DRIVER_X11_XVIDMODE @SDL_VIDEO_DRIVER_X11_XVIDMODE@ +#cmakedefine SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS @SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS@ +#cmakedefine SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY @SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY@ +#cmakedefine SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM @SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM@ + +#cmakedefine SDL_VIDEO_RENDER_D3D @SDL_VIDEO_RENDER_D3D@ +#cmakedefine SDL_VIDEO_RENDER_D3D11 @SDL_VIDEO_RENDER_D3D11@ +#cmakedefine SDL_VIDEO_RENDER_OGL @SDL_VIDEO_RENDER_OGL@ +#cmakedefine SDL_VIDEO_RENDER_OGL_ES @SDL_VIDEO_RENDER_OGL_ES@ +#cmakedefine SDL_VIDEO_RENDER_OGL_ES2 @SDL_VIDEO_RENDER_OGL_ES2@ +#cmakedefine SDL_VIDEO_RENDER_DIRECTFB @SDL_VIDEO_RENDER_DIRECTFB@ + +/* Enable OpenGL support */ +#cmakedefine SDL_VIDEO_OPENGL @SDL_VIDEO_OPENGL@ +#cmakedefine SDL_VIDEO_OPENGL_ES @SDL_VIDEO_OPENGL_ES@ +#cmakedefine SDL_VIDEO_OPENGL_ES2 @SDL_VIDEO_OPENGL_ES2@ +#cmakedefine SDL_VIDEO_OPENGL_BGL @SDL_VIDEO_OPENGL_BGL@ +#cmakedefine SDL_VIDEO_OPENGL_CGL @SDL_VIDEO_OPENGL_CGL@ +#cmakedefine SDL_VIDEO_OPENGL_GLX @SDL_VIDEO_OPENGL_GLX@ +#cmakedefine SDL_VIDEO_OPENGL_WGL @SDL_VIDEO_OPENGL_WGL@ +#cmakedefine SDL_VIDEO_OPENGL_EGL @SDL_VIDEO_OPENGL_EGL@ +#cmakedefine SDL_VIDEO_OPENGL_OSMESA @SDL_VIDEO_OPENGL_OSMESA@ +#cmakedefine SDL_VIDEO_OPENGL_OSMESA_DYNAMIC @SDL_VIDEO_OPENGL_OSMESA_DYNAMIC@ + +/* Enable Vulkan support */ +#cmakedefine SDL_VIDEO_VULKAN @SDL_VIDEO_VULKAN@ + +/* Enable system power support */ +#cmakedefine SDL_POWER_ANDROID @SDL_POWER_ANDROID@ +#cmakedefine SDL_POWER_LINUX @SDL_POWER_LINUX@ +#cmakedefine SDL_POWER_WINDOWS @SDL_POWER_WINDOWS@ +#cmakedefine SDL_POWER_MACOSX @SDL_POWER_MACOSX@ +#cmakedefine SDL_POWER_HAIKU @SDL_POWER_HAIKU@ +#cmakedefine SDL_POWER_EMSCRIPTEN @SDL_POWER_EMSCRIPTEN@ +#cmakedefine SDL_POWER_HARDWIRED @SDL_POWER_HARDWIRED@ + +/* Enable system filesystem support */ +#cmakedefine SDL_FILESYSTEM_ANDROID @SDL_FILESYSTEM_ANDROID@ +#cmakedefine SDL_FILESYSTEM_HAIKU @SDL_FILESYSTEM_HAIKU@ +#cmakedefine SDL_FILESYSTEM_COCOA @SDL_FILESYSTEM_COCOA@ +#cmakedefine SDL_FILESYSTEM_DUMMY @SDL_FILESYSTEM_DUMMY@ +#cmakedefine SDL_FILESYSTEM_UNIX @SDL_FILESYSTEM_UNIX@ +#cmakedefine SDL_FILESYSTEM_WINDOWS @SDL_FILESYSTEM_WINDOWS@ +#cmakedefine SDL_FILESYSTEM_EMSCRIPTEN @SDL_FILESYSTEM_EMSCRIPTEN@ + +/* Enable assembly routines */ +#cmakedefine SDL_ASSEMBLY_ROUTINES @SDL_ASSEMBLY_ROUTINES@ +#cmakedefine SDL_ALTIVEC_BLITTERS @SDL_ALTIVEC_BLITTERS@ + +/* Enable dynamic libsamplerate support */ +#cmakedefine SDL_LIBSAMPLERATE_DYNAMIC @SDL_LIBSAMPLERATE_DYNAMIC@ + +/* Platform specific definitions */ +#if !defined(__WIN32__) +# if !defined(_STDINT_H_) && !defined(_STDINT_H) && !defined(HAVE_STDINT_H) && !defined(_HAVE_STDINT_H) +typedef unsigned int size_t; +typedef signed char int8_t; +typedef unsigned char uint8_t; +typedef signed short int16_t; +typedef unsigned short uint16_t; +typedef signed int int32_t; +typedef unsigned int uint32_t; +typedef signed long long int64_t; +typedef unsigned long long uint64_t; +typedef unsigned long uintptr_t; +# endif /* if (stdint.h isn't available) */ +#else /* __WIN32__ */ +# if !defined(_STDINT_H_) && !defined(HAVE_STDINT_H) && !defined(_HAVE_STDINT_H) +# if defined(__GNUC__) || defined(__DMC__) || defined(__WATCOMC__) +#define HAVE_STDINT_H 1 +# elif defined(_MSC_VER) +typedef signed __int8 int8_t; +typedef unsigned __int8 uint8_t; +typedef signed __int16 int16_t; +typedef unsigned __int16 uint16_t; +typedef signed __int32 int32_t; +typedef unsigned __int32 uint32_t; +typedef signed __int64 int64_t; +typedef unsigned __int64 uint64_t; +# ifndef _UINTPTR_T_DEFINED +# ifdef _WIN64 +typedef unsigned __int64 uintptr_t; +# else +typedef unsigned int uintptr_t; +# endif +#define _UINTPTR_T_DEFINED +# endif +/* Older Visual C++ headers don't have the Win64-compatible typedefs... */ +# if ((_MSC_VER <= 1200) && (!defined(DWORD_PTR))) +#define DWORD_PTR DWORD +# endif +# if ((_MSC_VER <= 1200) && (!defined(LONG_PTR))) +#define LONG_PTR LONG +# endif +# else /* !__GNUC__ && !_MSC_VER */ +typedef signed char int8_t; +typedef unsigned char uint8_t; +typedef signed short int16_t; +typedef unsigned short uint16_t; +typedef signed int int32_t; +typedef unsigned int uint32_t; +typedef signed long long int64_t; +typedef unsigned long long uint64_t; +# ifndef _SIZE_T_DEFINED_ +#define _SIZE_T_DEFINED_ +typedef unsigned int size_t; +# endif +typedef unsigned int uintptr_t; +# endif /* __GNUC__ || _MSC_VER */ +# endif /* !_STDINT_H_ && !HAVE_STDINT_H */ +#endif /* __WIN32__ */ + +#endif /* SDL_config_h_ */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_config.h.in b/MediaClient/MediaClient/sdl/include/SDL2/SDL_config.h.in new file mode 100644 index 0000000..8b3d208 --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_config.h.in @@ -0,0 +1,389 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2017 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef SDL_config_h_ +#define SDL_config_h_ + +/** + * \file SDL_config.h.in + * + * This is a set of defines to configure the SDL features + */ + +/* General platform specific identifiers */ +#include "SDL_platform.h" + +/* Make sure that this isn't included by Visual C++ */ +#ifdef _MSC_VER +#error You should run hg revert SDL_config.h +#endif + +/* C language features */ +#undef const +#undef inline +#undef volatile + +/* C datatypes */ +#ifdef __LP64__ +#define SIZEOF_VOIDP 8 +#else +#define SIZEOF_VOIDP 4 +#endif +#undef HAVE_GCC_ATOMICS +#undef HAVE_GCC_SYNC_LOCK_TEST_AND_SET + +#undef HAVE_DDRAW_H +#undef HAVE_DINPUT_H +#undef HAVE_DSOUND_H +#undef HAVE_DXGI_H +#undef HAVE_XINPUT_H +#undef HAVE_XINPUT_GAMEPAD_EX +#undef HAVE_XINPUT_STATE_EX + +/* Comment this if you want to build without any C library requirements */ +#undef HAVE_LIBC +#if HAVE_LIBC + +/* Useful headers */ +#undef HAVE_ALLOCA_H +#undef HAVE_SYS_TYPES_H +#undef HAVE_STDIO_H +#undef STDC_HEADERS +#undef HAVE_STDLIB_H +#undef HAVE_STDARG_H +#undef HAVE_MALLOC_H +#undef HAVE_MEMORY_H +#undef HAVE_STRING_H +#undef HAVE_STRINGS_H +#undef HAVE_WCHAR_H +#undef HAVE_INTTYPES_H +#undef HAVE_STDINT_H +#undef HAVE_CTYPE_H +#undef HAVE_MATH_H +#undef HAVE_ICONV_H +#undef HAVE_SIGNAL_H +#undef HAVE_ALTIVEC_H +#undef HAVE_PTHREAD_NP_H +#undef HAVE_LIBUDEV_H +#undef HAVE_DBUS_DBUS_H +#undef HAVE_IBUS_IBUS_H +#undef HAVE_FCITX_FRONTEND_H +#undef HAVE_LIBSAMPLERATE_H + +/* C library functions */ +#undef HAVE_MALLOC +#undef HAVE_CALLOC +#undef HAVE_REALLOC +#undef HAVE_FREE +#undef HAVE_ALLOCA +#ifndef __WIN32__ /* Don't use C runtime versions of these on Windows */ +#undef HAVE_GETENV +#undef HAVE_SETENV +#undef HAVE_PUTENV +#undef HAVE_UNSETENV +#endif +#undef HAVE_QSORT +#undef HAVE_ABS +#undef HAVE_BCOPY +#undef HAVE_MEMSET +#undef HAVE_MEMCPY +#undef HAVE_MEMMOVE +#undef HAVE_MEMCMP +#undef HAVE_WCSLEN +#undef HAVE_WCSLCPY +#undef HAVE_WCSLCAT +#undef HAVE_WCSCMP +#undef HAVE_STRLEN +#undef HAVE_STRLCPY +#undef HAVE_STRLCAT +#undef HAVE_STRDUP +#undef HAVE__STRREV +#undef HAVE__STRUPR +#undef HAVE__STRLWR +#undef HAVE_INDEX +#undef HAVE_RINDEX +#undef HAVE_STRCHR +#undef HAVE_STRRCHR +#undef HAVE_STRSTR +#undef HAVE_ITOA +#undef HAVE__LTOA +#undef HAVE__UITOA +#undef HAVE__ULTOA +#undef HAVE_STRTOL +#undef HAVE_STRTOUL +#undef HAVE__I64TOA +#undef HAVE__UI64TOA +#undef HAVE_STRTOLL +#undef HAVE_STRTOULL +#undef HAVE_STRTOD +#undef HAVE_ATOI +#undef HAVE_ATOF +#undef HAVE_STRCMP +#undef HAVE_STRNCMP +#undef HAVE__STRICMP +#undef HAVE_STRCASECMP +#undef HAVE__STRNICMP +#undef HAVE_STRNCASECMP +#undef HAVE_SSCANF +#undef HAVE_VSSCANF +#undef HAVE_SNPRINTF +#undef HAVE_VSNPRINTF +#undef HAVE_M_PI +#undef HAVE_ATAN +#undef HAVE_ATAN2 +#undef HAVE_ACOS +#undef HAVE_ASIN +#undef HAVE_CEIL +#undef HAVE_COPYSIGN +#undef HAVE_COS +#undef HAVE_COSF +#undef HAVE_FABS +#undef HAVE_FLOOR +#undef HAVE_LOG +#undef HAVE_POW +#undef HAVE_SCALBN +#undef HAVE_SIN +#undef HAVE_SINF +#undef HAVE_SQRT +#undef HAVE_SQRTF +#undef HAVE_TAN +#undef HAVE_TANF +#undef HAVE_FOPEN64 +#undef HAVE_FSEEKO +#undef HAVE_FSEEKO64 +#undef HAVE_SIGACTION +#undef HAVE_SA_SIGACTION +#undef HAVE_SETJMP +#undef HAVE_NANOSLEEP +#undef HAVE_SYSCONF +#undef HAVE_SYSCTLBYNAME +#undef HAVE_CLOCK_GETTIME +#undef HAVE_GETPAGESIZE +#undef HAVE_MPROTECT +#undef HAVE_ICONV +#undef HAVE_PTHREAD_SETNAME_NP +#undef HAVE_PTHREAD_SET_NAME_NP +#undef HAVE_SEM_TIMEDWAIT +#undef HAVE_GETAUXVAL +#undef HAVE_POLL + +#else +#define HAVE_STDARG_H 1 +#define HAVE_STDDEF_H 1 +#define HAVE_STDINT_H 1 +#endif /* HAVE_LIBC */ + +/* SDL internal assertion support */ +#undef SDL_DEFAULT_ASSERT_LEVEL + +/* Allow disabling of core subsystems */ +#undef SDL_ATOMIC_DISABLED +#undef SDL_AUDIO_DISABLED +#undef SDL_CPUINFO_DISABLED +#undef SDL_EVENTS_DISABLED +#undef SDL_FILE_DISABLED +#undef SDL_JOYSTICK_DISABLED +#undef SDL_HAPTIC_DISABLED +#undef SDL_LOADSO_DISABLED +#undef SDL_RENDER_DISABLED +#undef SDL_THREADS_DISABLED +#undef SDL_TIMERS_DISABLED +#undef SDL_VIDEO_DISABLED +#undef SDL_POWER_DISABLED +#undef SDL_FILESYSTEM_DISABLED + +/* Enable various audio drivers */ +#undef SDL_AUDIO_DRIVER_ALSA +#undef SDL_AUDIO_DRIVER_ALSA_DYNAMIC +#undef SDL_AUDIO_DRIVER_ANDROID +#undef SDL_AUDIO_DRIVER_ARTS +#undef SDL_AUDIO_DRIVER_ARTS_DYNAMIC +#undef SDL_AUDIO_DRIVER_COREAUDIO +#undef SDL_AUDIO_DRIVER_DISK +#undef SDL_AUDIO_DRIVER_DSOUND +#undef SDL_AUDIO_DRIVER_DUMMY +#undef SDL_AUDIO_DRIVER_EMSCRIPTEN +#undef SDL_AUDIO_DRIVER_ESD +#undef SDL_AUDIO_DRIVER_ESD_DYNAMIC +#undef SDL_AUDIO_DRIVER_FUSIONSOUND +#undef SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC +#undef SDL_AUDIO_DRIVER_HAIKU +#undef SDL_AUDIO_DRIVER_JACK +#undef SDL_AUDIO_DRIVER_JACK_DYNAMIC +#undef SDL_AUDIO_DRIVER_NACL +#undef SDL_AUDIO_DRIVER_NAS +#undef SDL_AUDIO_DRIVER_NAS_DYNAMIC +#undef SDL_AUDIO_DRIVER_NETBSD +#undef SDL_AUDIO_DRIVER_OSS +#undef SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H +#undef SDL_AUDIO_DRIVER_PAUDIO +#undef SDL_AUDIO_DRIVER_PULSEAUDIO +#undef SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC +#undef SDL_AUDIO_DRIVER_QSA +#undef SDL_AUDIO_DRIVER_SNDIO +#undef SDL_AUDIO_DRIVER_SNDIO_DYNAMIC +#undef SDL_AUDIO_DRIVER_SUNAUDIO +#undef SDL_AUDIO_DRIVER_WASAPI +#undef SDL_AUDIO_DRIVER_WINMM +#undef SDL_AUDIO_DRIVER_XAUDIO2 + +/* Enable various input drivers */ +#undef SDL_INPUT_LINUXEV +#undef SDL_INPUT_LINUXKD +#undef SDL_INPUT_TSLIB +#undef SDL_JOYSTICK_HAIKU +#undef SDL_JOYSTICK_DINPUT +#undef SDL_JOYSTICK_XINPUT +#undef SDL_JOYSTICK_DUMMY +#undef SDL_JOYSTICK_IOKIT +#undef SDL_JOYSTICK_LINUX +#undef SDL_JOYSTICK_ANDROID +#undef SDL_JOYSTICK_WINMM +#undef SDL_JOYSTICK_USBHID +#undef SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H +#undef SDL_JOYSTICK_EMSCRIPTEN +#undef SDL_HAPTIC_DUMMY +#undef SDL_HAPTIC_LINUX +#undef SDL_HAPTIC_IOKIT +#undef SDL_HAPTIC_DINPUT +#undef SDL_HAPTIC_XINPUT + +/* Enable various shared object loading systems */ +#undef SDL_LOADSO_DLOPEN +#undef SDL_LOADSO_DUMMY +#undef SDL_LOADSO_LDG +#undef SDL_LOADSO_WINDOWS + +/* Enable various threading systems */ +#undef SDL_THREAD_PTHREAD +#undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX +#undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP +#undef SDL_THREAD_WINDOWS + +/* Enable various timer systems */ +#undef SDL_TIMER_HAIKU +#undef SDL_TIMER_DUMMY +#undef SDL_TIMER_UNIX +#undef SDL_TIMER_WINDOWS + +/* Enable various video drivers */ +#undef SDL_VIDEO_DRIVER_HAIKU +#undef SDL_VIDEO_DRIVER_COCOA +#undef SDL_VIDEO_DRIVER_DIRECTFB +#undef SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC +#undef SDL_VIDEO_DRIVER_DUMMY +#undef SDL_VIDEO_DRIVER_WINDOWS +#undef SDL_VIDEO_DRIVER_WAYLAND +#undef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH +#undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC +#undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL +#undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR +#undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON +#undef SDL_VIDEO_DRIVER_MIR +#undef SDL_VIDEO_DRIVER_MIR_DYNAMIC +#undef SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON +#undef SDL_VIDEO_DRIVER_X11 +#undef SDL_VIDEO_DRIVER_RPI +#undef SDL_VIDEO_DRIVER_KMSDRM +#undef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC +#undef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM +#undef SDL_VIDEO_DRIVER_ANDROID +#undef SDL_VIDEO_DRIVER_EMSCRIPTEN +#undef SDL_VIDEO_DRIVER_X11_DYNAMIC +#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT +#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR +#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA +#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 +#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR +#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS +#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE +#undef SDL_VIDEO_DRIVER_X11_XCURSOR +#undef SDL_VIDEO_DRIVER_X11_XDBE +#undef SDL_VIDEO_DRIVER_X11_XINERAMA +#undef SDL_VIDEO_DRIVER_X11_XINPUT2 +#undef SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH +#undef SDL_VIDEO_DRIVER_X11_XRANDR +#undef SDL_VIDEO_DRIVER_X11_XSCRNSAVER +#undef SDL_VIDEO_DRIVER_X11_XSHAPE +#undef SDL_VIDEO_DRIVER_X11_XVIDMODE +#undef SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS +#undef SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY +#undef SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM +#undef SDL_VIDEO_DRIVER_NACL +#undef SDL_VIDEO_DRIVER_VIVANTE +#undef SDL_VIDEO_DRIVER_VIVANTE_VDK +#undef SDL_VIDEO_DRIVER_QNX + +#undef SDL_VIDEO_RENDER_D3D +#undef SDL_VIDEO_RENDER_D3D11 +#undef SDL_VIDEO_RENDER_OGL +#undef SDL_VIDEO_RENDER_OGL_ES +#undef SDL_VIDEO_RENDER_OGL_ES2 +#undef SDL_VIDEO_RENDER_DIRECTFB + +/* Enable OpenGL support */ +#undef SDL_VIDEO_OPENGL +#undef SDL_VIDEO_OPENGL_ES +#undef SDL_VIDEO_OPENGL_ES2 +#undef SDL_VIDEO_OPENGL_BGL +#undef SDL_VIDEO_OPENGL_CGL +#undef SDL_VIDEO_OPENGL_EGL +#undef SDL_VIDEO_OPENGL_GLX +#undef SDL_VIDEO_OPENGL_WGL +#undef SDL_VIDEO_OPENGL_OSMESA +#undef SDL_VIDEO_OPENGL_OSMESA_DYNAMIC + +/* Enable Vulkan support */ +#undef SDL_VIDEO_VULKAN + +/* Enable system power support */ +#undef SDL_POWER_LINUX +#undef SDL_POWER_WINDOWS +#undef SDL_POWER_MACOSX +#undef SDL_POWER_HAIKU +#undef SDL_POWER_ANDROID +#undef SDL_POWER_EMSCRIPTEN +#undef SDL_POWER_HARDWIRED + +/* Enable system filesystem support */ +#undef SDL_FILESYSTEM_HAIKU +#undef SDL_FILESYSTEM_COCOA +#undef SDL_FILESYSTEM_DUMMY +#undef SDL_FILESYSTEM_UNIX +#undef SDL_FILESYSTEM_WINDOWS +#undef SDL_FILESYSTEM_NACL +#undef SDL_FILESYSTEM_ANDROID +#undef SDL_FILESYSTEM_EMSCRIPTEN + +/* Enable assembly routines */ +#undef SDL_ASSEMBLY_ROUTINES +#undef SDL_ALTIVEC_BLITTERS + +/* Enable ime support */ +#undef SDL_USE_IME + +/* Enable dynamic udev support */ +#undef SDL_UDEV_DYNAMIC + +/* Enable dynamic libsamplerate support */ +#undef SDL_LIBSAMPLERATE_DYNAMIC + +#endif /* SDL_config_h_ */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_config_android.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_config_android.h new file mode 100644 index 0000000..361bad8 --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_config_android.h @@ -0,0 +1,157 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2017 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef SDL_config_android_h_ +#define SDL_config_android_h_ +#define SDL_config_h_ + +#include "SDL_platform.h" + +/** + * \file SDL_config_android.h + * + * This is a configuration that can be used to build SDL for Android + */ + +#include + +#define HAVE_GCC_ATOMICS 1 + +#define HAVE_ALLOCA_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_STDIO_H 1 +#define STDC_HEADERS 1 +#define HAVE_STRING_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_CTYPE_H 1 +#define HAVE_MATH_H 1 +#define HAVE_SIGNAL_H 1 + +/* C library functions */ +#define HAVE_MALLOC 1 +#define HAVE_CALLOC 1 +#define HAVE_REALLOC 1 +#define HAVE_FREE 1 +#define HAVE_ALLOCA 1 +#define HAVE_GETENV 1 +#define HAVE_SETENV 1 +#define HAVE_PUTENV 1 +#define HAVE_SETENV 1 +#define HAVE_UNSETENV 1 +#define HAVE_QSORT 1 +#define HAVE_ABS 1 +#define HAVE_BCOPY 1 +#define HAVE_MEMSET 1 +#define HAVE_MEMCPY 1 +#define HAVE_MEMMOVE 1 +#define HAVE_MEMCMP 1 +#define HAVE_STRLEN 1 +#define HAVE_STRLCPY 1 +#define HAVE_STRLCAT 1 +#define HAVE_STRDUP 1 +#define HAVE_STRCHR 1 +#define HAVE_STRRCHR 1 +#define HAVE_STRSTR 1 +#define HAVE_STRTOL 1 +#define HAVE_STRTOUL 1 +#define HAVE_STRTOLL 1 +#define HAVE_STRTOULL 1 +#define HAVE_STRTOD 1 +#define HAVE_ATOI 1 +#define HAVE_ATOF 1 +#define HAVE_STRCMP 1 +#define HAVE_STRNCMP 1 +#define HAVE_STRCASECMP 1 +#define HAVE_STRNCASECMP 1 +#define HAVE_VSSCANF 1 +#define HAVE_VSNPRINTF 1 +#define HAVE_M_PI 1 +#define HAVE_ATAN 1 +#define HAVE_ATAN2 1 +#define HAVE_ACOS 1 +#define HAVE_ASIN 1 +#define HAVE_CEIL 1 +#define HAVE_COPYSIGN 1 +#define HAVE_COS 1 +#define HAVE_COSF 1 +#define HAVE_FABS 1 +#define HAVE_FLOOR 1 +#define HAVE_LOG 1 +#define HAVE_POW 1 +#define HAVE_SCALBN 1 +#define HAVE_SIN 1 +#define HAVE_SINF 1 +#define HAVE_SQRT 1 +#define HAVE_SQRTF 1 +#define HAVE_TAN 1 +#define HAVE_TANF 1 +#define HAVE_SIGACTION 1 +#define HAVE_SETJMP 1 +#define HAVE_NANOSLEEP 1 +#define HAVE_SYSCONF 1 +#define HAVE_CLOCK_GETTIME 1 + +#define SIZEOF_VOIDP 4 + +/* Enable various audio drivers */ +#define SDL_AUDIO_DRIVER_ANDROID 1 +#define SDL_AUDIO_DRIVER_DUMMY 1 + +/* Enable various input drivers */ +#define SDL_JOYSTICK_ANDROID 1 +#define SDL_HAPTIC_ANDROID 1 + +/* Enable various shared object loading systems */ +#define SDL_LOADSO_DLOPEN 1 + +/* Enable various threading systems */ +#define SDL_THREAD_PTHREAD 1 +#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1 + +/* Enable various timer systems */ +#define SDL_TIMER_UNIX 1 + +/* Enable various video drivers */ +#define SDL_VIDEO_DRIVER_ANDROID 1 + +/* Enable OpenGL ES */ +#define SDL_VIDEO_OPENGL_ES 1 +#define SDL_VIDEO_OPENGL_ES2 1 +#define SDL_VIDEO_OPENGL_EGL 1 +#define SDL_VIDEO_RENDER_OGL_ES 1 +#define SDL_VIDEO_RENDER_OGL_ES2 1 + +/* Enable Vulkan support */ +/* Android does not support Vulkan in native code using the "armeabi" ABI. */ +#if defined(__ARM_ARCH) && __ARM_ARCH < 7 +#define SDL_VIDEO_VULKAN 0 +#else +#define SDL_VIDEO_VULKAN 1 +#endif + +/* Enable system power support */ +#define SDL_POWER_ANDROID 1 + +/* Enable the filesystem driver */ +#define SDL_FILESYSTEM_ANDROID 1 + +#endif /* SDL_config_android_h_ */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_config_iphoneos.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_config_iphoneos.h new file mode 100644 index 0000000..deea030 --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_config_iphoneos.h @@ -0,0 +1,166 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2017 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef SDL_config_iphoneos_h_ +#define SDL_config_iphoneos_h_ +#define SDL_config_h_ + +#include "SDL_platform.h" + +#ifdef __LP64__ +#define SIZEOF_VOIDP 8 +#else +#define SIZEOF_VOIDP 4 +#endif + +#define HAVE_GCC_ATOMICS 1 + +#define HAVE_ALLOCA_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_STDIO_H 1 +#define STDC_HEADERS 1 +#define HAVE_STRING_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_CTYPE_H 1 +#define HAVE_MATH_H 1 +#define HAVE_SIGNAL_H 1 + +/* C library functions */ +#define HAVE_MALLOC 1 +#define HAVE_CALLOC 1 +#define HAVE_REALLOC 1 +#define HAVE_FREE 1 +#define HAVE_ALLOCA 1 +#define HAVE_GETENV 1 +#define HAVE_SETENV 1 +#define HAVE_PUTENV 1 +#define HAVE_SETENV 1 +#define HAVE_UNSETENV 1 +#define HAVE_QSORT 1 +#define HAVE_ABS 1 +#define HAVE_BCOPY 1 +#define HAVE_MEMSET 1 +#define HAVE_MEMCPY 1 +#define HAVE_MEMMOVE 1 +#define HAVE_MEMCMP 1 +#define HAVE_STRLEN 1 +#define HAVE_STRLCPY 1 +#define HAVE_STRLCAT 1 +#define HAVE_STRDUP 1 +#define HAVE_STRCHR 1 +#define HAVE_STRRCHR 1 +#define HAVE_STRSTR 1 +#define HAVE_STRTOL 1 +#define HAVE_STRTOUL 1 +#define HAVE_STRTOLL 1 +#define HAVE_STRTOULL 1 +#define HAVE_STRTOD 1 +#define HAVE_ATOI 1 +#define HAVE_ATOF 1 +#define HAVE_STRCMP 1 +#define HAVE_STRNCMP 1 +#define HAVE_STRCASECMP 1 +#define HAVE_STRNCASECMP 1 +#define HAVE_VSSCANF 1 +#define HAVE_VSNPRINTF 1 +#define HAVE_M_PI 1 +#define HAVE_ATAN 1 +#define HAVE_ATAN2 1 +#define HAVE_ACOS 1 +#define HAVE_ASIN 1 +#define HAVE_CEIL 1 +#define HAVE_COPYSIGN 1 +#define HAVE_COS 1 +#define HAVE_COSF 1 +#define HAVE_FABS 1 +#define HAVE_FLOOR 1 +#define HAVE_LOG 1 +#define HAVE_POW 1 +#define HAVE_SCALBN 1 +#define HAVE_SIN 1 +#define HAVE_SINF 1 +#define HAVE_SQRT 1 +#define HAVE_SQRTF 1 +#define HAVE_TAN 1 +#define HAVE_TANF 1 +#define HAVE_SIGACTION 1 +#define HAVE_SETJMP 1 +#define HAVE_NANOSLEEP 1 +#define HAVE_SYSCONF 1 +#define HAVE_SYSCTLBYNAME 1 + +/* enable iPhone version of Core Audio driver */ +#define SDL_AUDIO_DRIVER_COREAUDIO 1 +/* Enable the dummy audio driver (src/audio/dummy/\*.c) */ +#define SDL_AUDIO_DRIVER_DUMMY 1 + +/* Enable the stub haptic driver (src/haptic/dummy/\*.c) */ +#define SDL_HAPTIC_DUMMY 1 + +/* Enable MFi joystick support */ +#define SDL_JOYSTICK_MFI 1 + +/* Enable Unix style SO loading */ +#define SDL_LOADSO_DLOPEN 1 + +/* Enable various threading systems */ +#define SDL_THREAD_PTHREAD 1 +#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1 + +/* Enable various timer systems */ +#define SDL_TIMER_UNIX 1 + +/* Supported video drivers */ +#define SDL_VIDEO_DRIVER_UIKIT 1 +#define SDL_VIDEO_DRIVER_DUMMY 1 + +/* enable OpenGL ES */ +#define SDL_VIDEO_OPENGL_ES2 1 +#define SDL_VIDEO_OPENGL_ES 1 +#define SDL_VIDEO_RENDER_OGL_ES 1 +#define SDL_VIDEO_RENDER_OGL_ES2 1 + +/* Enable Vulkan support */ +#if !TARGET_OS_SIMULATOR && !TARGET_CPU_ARM // Only 64-bit devices have Metal +#define SDL_VIDEO_VULKAN 1 +#else +#define SDL_VIDEO_VULKAN 0 +#endif + +/* Enable system power support */ +#define SDL_POWER_UIKIT 1 + +/* enable iPhone keyboard support */ +#define SDL_IPHONE_KEYBOARD 1 + +/* enable iOS extended launch screen */ +#define SDL_IPHONE_LAUNCHSCREEN 1 + +/* Set max recognized G-force from accelerometer + See src/joystick/uikit/SDL_sysjoystick.m for notes on why this is needed + */ +#define SDL_IPHONE_MAX_GFORCE 5.0 + +/* enable filesystem support */ +#define SDL_FILESYSTEM_COCOA 1 + +#endif /* SDL_config_iphoneos_h_ */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_config_macosx.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_config_macosx.h new file mode 100644 index 0000000..9b09899 --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_config_macosx.h @@ -0,0 +1,197 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2017 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef SDL_config_macosx_h_ +#define SDL_config_macosx_h_ +#define SDL_config_h_ + +#include "SDL_platform.h" + +/* This gets us MAC_OS_X_VERSION_MIN_REQUIRED... */ +#include + +/* This is a set of defines to configure the SDL features */ + +#ifdef __LP64__ + #define SIZEOF_VOIDP 8 +#else + #define SIZEOF_VOIDP 4 +#endif + +/* Useful headers */ +#define HAVE_ALLOCA_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_STDIO_H 1 +#define STDC_HEADERS 1 +#define HAVE_STRING_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_CTYPE_H 1 +#define HAVE_MATH_H 1 +#define HAVE_SIGNAL_H 1 + +/* C library functions */ +#define HAVE_MALLOC 1 +#define HAVE_CALLOC 1 +#define HAVE_REALLOC 1 +#define HAVE_FREE 1 +#define HAVE_ALLOCA 1 +#define HAVE_GETENV 1 +#define HAVE_SETENV 1 +#define HAVE_PUTENV 1 +#define HAVE_UNSETENV 1 +#define HAVE_QSORT 1 +#define HAVE_ABS 1 +#define HAVE_BCOPY 1 +#define HAVE_MEMSET 1 +#define HAVE_MEMCPY 1 +#define HAVE_MEMMOVE 1 +#define HAVE_MEMCMP 1 +#define HAVE_STRLEN 1 +#define HAVE_STRLCPY 1 +#define HAVE_STRLCAT 1 +#define HAVE_STRDUP 1 +#define HAVE_STRCHR 1 +#define HAVE_STRRCHR 1 +#define HAVE_STRSTR 1 +#define HAVE_STRTOL 1 +#define HAVE_STRTOUL 1 +#define HAVE_STRTOLL 1 +#define HAVE_STRTOULL 1 +#define HAVE_STRTOD 1 +#define HAVE_ATOI 1 +#define HAVE_ATOF 1 +#define HAVE_STRCMP 1 +#define HAVE_STRNCMP 1 +#define HAVE_STRCASECMP 1 +#define HAVE_STRNCASECMP 1 +#define HAVE_VSSCANF 1 +#define HAVE_VSNPRINTF 1 +#define HAVE_CEIL 1 +#define HAVE_COPYSIGN 1 +#define HAVE_COS 1 +#define HAVE_COSF 1 +#define HAVE_FABS 1 +#define HAVE_FLOOR 1 +#define HAVE_LOG 1 +#define HAVE_POW 1 +#define HAVE_SCALBN 1 +#define HAVE_SIN 1 +#define HAVE_SINF 1 +#define HAVE_SQRT 1 +#define HAVE_SQRTF 1 +#define HAVE_TAN 1 +#define HAVE_TANF 1 +#define HAVE_SIGACTION 1 +#define HAVE_SETJMP 1 +#define HAVE_NANOSLEEP 1 +#define HAVE_SYSCONF 1 +#define HAVE_SYSCTLBYNAME 1 +#define HAVE_ATAN 1 +#define HAVE_ATAN2 1 +#define HAVE_ACOS 1 +#define HAVE_ASIN 1 + +/* Enable various audio drivers */ +#define SDL_AUDIO_DRIVER_COREAUDIO 1 +#define SDL_AUDIO_DRIVER_DISK 1 +#define SDL_AUDIO_DRIVER_DUMMY 1 + +/* Enable various input drivers */ +#define SDL_JOYSTICK_IOKIT 1 +#define SDL_HAPTIC_IOKIT 1 + +/* Enable various shared object loading systems */ +#define SDL_LOADSO_DLOPEN 1 + +/* Enable various threading systems */ +#define SDL_THREAD_PTHREAD 1 +#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1 + +/* Enable various timer systems */ +#define SDL_TIMER_UNIX 1 + +/* Enable various video drivers */ +#define SDL_VIDEO_DRIVER_COCOA 1 +#define SDL_VIDEO_DRIVER_DUMMY 1 +#undef SDL_VIDEO_DRIVER_X11 +#define SDL_VIDEO_DRIVER_X11_DYNAMIC "/usr/X11R6/lib/libX11.6.dylib" +#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "/usr/X11R6/lib/libXext.6.dylib" +#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA "/usr/X11R6/lib/libXinerama.1.dylib" +#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 "/usr/X11R6/lib/libXi.6.dylib" +#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR "/usr/X11R6/lib/libXrandr.2.dylib" +#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS "/usr/X11R6/lib/libXss.1.dylib" +#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE "/usr/X11R6/lib/libXxf86vm.1.dylib" +#define SDL_VIDEO_DRIVER_X11_XDBE 1 +#define SDL_VIDEO_DRIVER_X11_XINERAMA 1 +#define SDL_VIDEO_DRIVER_X11_XRANDR 1 +#define SDL_VIDEO_DRIVER_X11_XSCRNSAVER 1 +#define SDL_VIDEO_DRIVER_X11_XSHAPE 1 +#define SDL_VIDEO_DRIVER_X11_XVIDMODE 1 +#define SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM 1 + +#ifdef MAC_OS_X_VERSION_10_8 +/* + * No matter the versions targeted, this is the 10.8 or later SDK, so you have + * to use the external Xquartz, which is a more modern Xlib. Previous SDKs + * used an older Xlib. + */ +#define SDL_VIDEO_DRIVER_X11_XINPUT2 1 +#define SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 1 +#define SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY 1 +#endif + +#ifndef SDL_VIDEO_RENDER_OGL +#define SDL_VIDEO_RENDER_OGL 1 +#endif + +/* Enable OpenGL support */ +#ifndef SDL_VIDEO_OPENGL +#define SDL_VIDEO_OPENGL 1 +#endif +#ifndef SDL_VIDEO_OPENGL_CGL +#define SDL_VIDEO_OPENGL_CGL 1 +#endif +#ifndef SDL_VIDEO_OPENGL_GLX +#define SDL_VIDEO_OPENGL_GLX 1 +#endif + +/* Enable Vulkan support */ +/* Metal/MoltenVK/Vulkan only supported on 64-bit architectures with 10.11+ */ +#if TARGET_CPU_X86_64 && (MAC_OS_X_VERSION_MAX_ALLOWED >= 101100) +#define SDL_VIDEO_VULKAN 1 +#else +#define SDL_VIDEO_VULKAN 0 +#endif + +/* Enable system power support */ +#define SDL_POWER_MACOSX 1 + +/* enable filesystem support */ +#define SDL_FILESYSTEM_COCOA 1 + +/* Enable assembly routines */ +#define SDL_ASSEMBLY_ROUTINES 1 +#ifdef __ppc__ +#define SDL_ALTIVEC_BLITTERS 1 +#endif + +#endif /* SDL_config_macosx_h_ */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_config_minimal.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_config_minimal.h new file mode 100644 index 0000000..3112700 --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_config_minimal.h @@ -0,0 +1,82 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2017 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef SDL_config_minimal_h_ +#define SDL_config_minimal_h_ +#define SDL_config_h_ + +#include "SDL_platform.h" + +/** + * \file SDL_config_minimal.h + * + * This is the minimal configuration that can be used to build SDL. + */ + +#define HAVE_STDARG_H 1 +#define HAVE_STDDEF_H 1 + +/* Most everything except Visual Studio 2008 and earlier has stdint.h now */ +#if defined(_MSC_VER) && (_MSC_VER < 1600) +/* Here are some reasonable defaults */ +typedef unsigned int size_t; +typedef signed char int8_t; +typedef unsigned char uint8_t; +typedef signed short int16_t; +typedef unsigned short uint16_t; +typedef signed int int32_t; +typedef unsigned int uint32_t; +typedef signed long long int64_t; +typedef unsigned long long uint64_t; +typedef unsigned long uintptr_t; +#else +#define HAVE_STDINT_H 1 +#endif /* Visual Studio 2008 */ + +#ifdef __GNUC__ +#define HAVE_GCC_SYNC_LOCK_TEST_AND_SET 1 +#endif + +/* Enable the dummy audio driver (src/audio/dummy/\*.c) */ +#define SDL_AUDIO_DRIVER_DUMMY 1 + +/* Enable the stub joystick driver (src/joystick/dummy/\*.c) */ +#define SDL_JOYSTICK_DISABLED 1 + +/* Enable the stub haptic driver (src/haptic/dummy/\*.c) */ +#define SDL_HAPTIC_DISABLED 1 + +/* Enable the stub shared object loader (src/loadso/dummy/\*.c) */ +#define SDL_LOADSO_DISABLED 1 + +/* Enable the stub thread support (src/thread/generic/\*.c) */ +#define SDL_THREADS_DISABLED 1 + +/* Enable the stub timer support (src/timer/dummy/\*.c) */ +#define SDL_TIMERS_DISABLED 1 + +/* Enable the dummy video driver (src/video/dummy/\*.c) */ +#define SDL_VIDEO_DRIVER_DUMMY 1 + +/* Enable the dummy filesystem driver (src/filesystem/dummy/\*.c) */ +#define SDL_FILESYSTEM_DUMMY 1 + +#endif /* SDL_config_minimal_h_ */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_config_pandora.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_config_pandora.h new file mode 100644 index 0000000..ea62fe5 --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_config_pandora.h @@ -0,0 +1,128 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2017 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef SDL_config_pandora_h_ +#define SDL_config_pandora_h_ +#define SDL_config_h_ + +/* This is a set of defines to configure the SDL features */ + +/* General platform specific identifiers */ +#include "SDL_platform.h" + +#ifdef __LP64__ +#define SIZEOF_VOIDP 8 +#else +#define SIZEOF_VOIDP 4 +#endif + +#define SDL_BYTEORDER 1234 + +#define HAVE_ALLOCA_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_STDIO_H 1 +#define STDC_HEADERS 1 +#define HAVE_STDLIB_H 1 +#define HAVE_STDARG_H 1 +#define HAVE_MALLOC_H 1 +#define HAVE_MEMORY_H 1 +#define HAVE_STRING_H 1 +#define HAVE_STRINGS_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_CTYPE_H 1 +#define HAVE_MATH_H 1 +#define HAVE_ICONV_H 1 +#define HAVE_SIGNAL_H 1 +#define HAVE_MALLOC 1 +#define HAVE_CALLOC 1 +#define HAVE_REALLOC 1 +#define HAVE_FREE 1 +#define HAVE_ALLOCA 1 +#define HAVE_GETENV 1 +#define HAVE_SETENV 1 +#define HAVE_PUTENV 1 +#define HAVE_UNSETENV 1 +#define HAVE_QSORT 1 +#define HAVE_ABS 1 +#define HAVE_BCOPY 1 +#define HAVE_MEMSET 1 +#define HAVE_MEMCPY 1 +#define HAVE_MEMMOVE 1 +#define HAVE_STRLEN 1 +#define HAVE_STRDUP 1 +#define HAVE_STRCHR 1 +#define HAVE_STRRCHR 1 +#define HAVE_STRSTR 1 +#define HAVE_STRTOL 1 +#define HAVE_STRTOUL 1 +#define HAVE_STRTOLL 1 +#define HAVE_STRTOULL 1 +#define HAVE_ATOI 1 +#define HAVE_ATOF 1 +#define HAVE_STRCMP 1 +#define HAVE_STRNCMP 1 +#define HAVE_STRCASECMP 1 +#define HAVE_STRNCASECMP 1 +#define HAVE_VSSCANF 1 +#define HAVE_VSNPRINTF 1 +#define HAVE_M_PI 1 +#define HAVE_CEIL 1 +#define HAVE_COPYSIGN 1 +#define HAVE_COS 1 +#define HAVE_COSF 1 +#define HAVE_FABS 1 +#define HAVE_FLOOR 1 +#define HAVE_LOG 1 +#define HAVE_SCALBN 1 +#define HAVE_SIN 1 +#define HAVE_SINF 1 +#define HAVE_SQRT 1 +#define HAVE_SQRTF 1 +#define HAVE_TAN 1 +#define HAVE_TANF 1 +#define HAVE_SIGACTION 1 +#define HAVE_SETJMP 1 +#define HAVE_NANOSLEEP 1 + +#define SDL_AUDIO_DRIVER_DUMMY 1 +#define SDL_AUDIO_DRIVER_OSS 1 + +#define SDL_INPUT_LINUXEV 1 +#define SDL_INPUT_TSLIB 1 +#define SDL_JOYSTICK_LINUX 1 +#define SDL_HAPTIC_LINUX 1 + +#define SDL_LOADSO_DLOPEN 1 + +#define SDL_THREAD_PTHREAD 1 +#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP 1 + +#define SDL_TIMER_UNIX 1 +#define SDL_FILESYSTEM_UNIX 1 + +#define SDL_VIDEO_DRIVER_DUMMY 1 +#define SDL_VIDEO_DRIVER_X11 1 +#define SDL_VIDEO_DRIVER_PANDORA 1 +#define SDL_VIDEO_RENDER_OGL_ES 1 +#define SDL_VIDEO_OPENGL_ES 1 + +#endif /* SDL_config_pandora_h_ */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_config_psp.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_config_psp.h new file mode 100644 index 0000000..28efb4c --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_config_psp.h @@ -0,0 +1,144 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2017 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef SDL_config_psp_h_ +#define SDL_config_psp_h_ +#define SDL_config_h_ + +#include "SDL_platform.h" + + + +#ifdef __GNUC__ +#define HAVE_GCC_SYNC_LOCK_TEST_AND_SET 1 +#endif + +#define HAVE_GCC_ATOMICS 1 + +#define HAVE_ALLOCA_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_STDIO_H 1 +#define STDC_HEADERS 1 +#define HAVE_STRING_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_CTYPE_H 1 +#define HAVE_MATH_H 1 +#define HAVE_SIGNAL_H 1 + +/* C library functions */ +#define HAVE_MALLOC 1 +#define HAVE_CALLOC 1 +#define HAVE_REALLOC 1 +#define HAVE_FREE 1 +#define HAVE_ALLOCA 1 +#define HAVE_GETENV 1 +#define HAVE_SETENV 1 +#define HAVE_PUTENV 1 +#define HAVE_SETENV 1 +#define HAVE_UNSETENV 1 +#define HAVE_QSORT 1 +#define HAVE_ABS 1 +#define HAVE_BCOPY 1 +#define HAVE_MEMSET 1 +#define HAVE_MEMCPY 1 +#define HAVE_MEMMOVE 1 +#define HAVE_MEMCMP 1 +#define HAVE_STRLEN 1 +#define HAVE_STRLCPY 1 +#define HAVE_STRLCAT 1 +#define HAVE_STRDUP 1 +#define HAVE_STRCHR 1 +#define HAVE_STRRCHR 1 +#define HAVE_STRSTR 1 +#define HAVE_STRTOL 1 +#define HAVE_STRTOUL 1 +#define HAVE_STRTOLL 1 +#define HAVE_STRTOULL 1 +#define HAVE_STRTOD 1 +#define HAVE_ATOI 1 +#define HAVE_ATOF 1 +#define HAVE_STRCMP 1 +#define HAVE_STRNCMP 1 +#define HAVE_STRCASECMP 1 +#define HAVE_STRNCASECMP 1 +#define HAVE_VSSCANF 1 +#define HAVE_VSNPRINTF 1 +#define HAVE_M_PI 1 +#define HAVE_ATAN 1 +#define HAVE_ATAN2 1 +#define HAVE_ACOS 1 +#define HAVE_ASIN 1 +#define HAVE_CEIL 1 +#define HAVE_COPYSIGN 1 +#define HAVE_COS 1 +#define HAVE_COSF 1 +#define HAVE_FABS 1 +#define HAVE_FLOOR 1 +#define HAVE_LOG 1 +#define HAVE_POW 1 +#define HAVE_SCALBN 1 +#define HAVE_SIN 1 +#define HAVE_SINF 1 +#define HAVE_SQRT 1 +#define HAVE_SQRTF 1 +#define HAVE_TAN 1 +#define HAVE_TANF 1 +#define HAVE_SETJMP 1 +#define HAVE_NANOSLEEP 1 +/* #define HAVE_SYSCONF 1 */ +/* #define HAVE_SIGACTION 1 */ + + +/* PSP isn't that sophisticated */ +#define LACKS_SYS_MMAN_H 1 + +/* Enable the stub thread support (src/thread/psp/\*.c) */ +#define SDL_THREAD_PSP 1 + +/* Enable the stub timer support (src/timer/psp/\*.c) */ +#define SDL_TIMERS_PSP 1 + +/* Enable the stub joystick driver (src/joystick/psp/\*.c) */ +#define SDL_JOYSTICK_PSP 1 + +/* Enable the stub audio driver (src/audio/psp/\*.c) */ +#define SDL_AUDIO_DRIVER_PSP 1 + +/* PSP video dirver */ +#define SDL_VIDEO_DRIVER_PSP 1 + +/* PSP render dirver */ +#define SDL_VIDEO_RENDER_PSP 1 + +#define SDL_POWER_PSP 1 + +/* !!! FIXME: what does PSP do for filesystem stuff? */ +#define SDL_FILESYSTEM_DUMMY 1 + +/* PSP doesn't have haptic device (src/haptic/dummy/\*.c) */ +#define SDL_HAPTIC_DISABLED 1 + +/* PSP can't load shared object (src/loadso/dummy/\*.c) */ +#define SDL_LOADSO_DISABLED 1 + + +#endif /* SDL_config_psp_h_ */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_config_windows.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_config_windows.h new file mode 100644 index 0000000..2456c84 --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_config_windows.h @@ -0,0 +1,225 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2017 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef SDL_config_windows_h_ +#define SDL_config_windows_h_ +#define SDL_config_h_ + +#include "SDL_platform.h" + +/* This is a set of defines to configure the SDL features */ + +#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H) +#if defined(__GNUC__) || defined(__DMC__) || defined(__WATCOMC__) +#define HAVE_STDINT_H 1 +#elif defined(_MSC_VER) +typedef signed __int8 int8_t; +typedef unsigned __int8 uint8_t; +typedef signed __int16 int16_t; +typedef unsigned __int16 uint16_t; +typedef signed __int32 int32_t; +typedef unsigned __int32 uint32_t; +typedef signed __int64 int64_t; +typedef unsigned __int64 uint64_t; +#ifndef _UINTPTR_T_DEFINED +#ifdef _WIN64 +typedef unsigned __int64 uintptr_t; +#else +typedef unsigned int uintptr_t; +#endif +#define _UINTPTR_T_DEFINED +#endif +/* Older Visual C++ headers don't have the Win64-compatible typedefs... */ +#if ((_MSC_VER <= 1200) && (!defined(DWORD_PTR))) +#define DWORD_PTR DWORD +#endif +#if ((_MSC_VER <= 1200) && (!defined(LONG_PTR))) +#define LONG_PTR LONG +#endif +#else /* !__GNUC__ && !_MSC_VER */ +typedef signed char int8_t; +typedef unsigned char uint8_t; +typedef signed short int16_t; +typedef unsigned short uint16_t; +typedef signed int int32_t; +typedef unsigned int uint32_t; +typedef signed long long int64_t; +typedef unsigned long long uint64_t; +#ifndef _SIZE_T_DEFINED_ +#define _SIZE_T_DEFINED_ +typedef unsigned int size_t; +#endif +typedef unsigned int uintptr_t; +#endif /* __GNUC__ || _MSC_VER */ +#endif /* !_STDINT_H_ && !HAVE_STDINT_H */ + +#ifdef _WIN64 +# define SIZEOF_VOIDP 8 +#else +# define SIZEOF_VOIDP 4 +#endif + +#define HAVE_DDRAW_H 1 +#define HAVE_DINPUT_H 1 +#define HAVE_DSOUND_H 1 +#define HAVE_DXGI_H 1 +#define HAVE_XINPUT_H 1 + +/* This is disabled by default to avoid C runtime dependencies and manifest requirements */ +#ifdef HAVE_LIBC +/* Useful headers */ +#define HAVE_STDIO_H 1 +#define STDC_HEADERS 1 +#define HAVE_STRING_H 1 +#define HAVE_CTYPE_H 1 +#define HAVE_MATH_H 1 +#define HAVE_SIGNAL_H 1 + +/* C library functions */ +#define HAVE_MALLOC 1 +#define HAVE_CALLOC 1 +#define HAVE_REALLOC 1 +#define HAVE_FREE 1 +#define HAVE_ALLOCA 1 +#define HAVE_QSORT 1 +#define HAVE_ABS 1 +#define HAVE_MEMSET 1 +#define HAVE_MEMCPY 1 +#define HAVE_MEMMOVE 1 +#define HAVE_MEMCMP 1 +#define HAVE_STRLEN 1 +#define HAVE__STRREV 1 +#define HAVE__STRUPR 1 +#define HAVE__STRLWR 1 +#define HAVE_STRCHR 1 +#define HAVE_STRRCHR 1 +#define HAVE_STRSTR 1 +#define HAVE__LTOA 1 +#define HAVE__ULTOA 1 +#define HAVE_STRTOL 1 +#define HAVE_STRTOUL 1 +#define HAVE_STRTOD 1 +#define HAVE_ATOI 1 +#define HAVE_ATOF 1 +#define HAVE_STRCMP 1 +#define HAVE_STRNCMP 1 +#define HAVE__STRICMP 1 +#define HAVE__STRNICMP 1 +#define HAVE_ATAN 1 +#define HAVE_ATAN2 1 +#define HAVE_ACOS 1 +#define HAVE_ASIN 1 +#define HAVE_CEIL 1 +#define HAVE_COS 1 +#define HAVE_COSF 1 +#define HAVE_FABS 1 +#define HAVE_FLOOR 1 +#define HAVE_LOG 1 +#define HAVE_POW 1 +#define HAVE_SIN 1 +#define HAVE_SINF 1 +#define HAVE_SQRT 1 +#define HAVE_SQRTF 1 +#define HAVE_TAN 1 +#define HAVE_TANF 1 +#if _MSC_VER >= 1800 +#define HAVE_STRTOLL 1 +#define HAVE_VSSCANF 1 +#define HAVE_COPYSIGN 1 +#define HAVE_SCALBN 1 +#endif +#if !defined(_MSC_VER) || defined(_USE_MATH_DEFINES) +#define HAVE_M_PI 1 +#endif +#else +#define HAVE_STDARG_H 1 +#define HAVE_STDDEF_H 1 +#endif + +/* Enable various audio drivers */ +#define SDL_AUDIO_DRIVER_WASAPI 1 +#define SDL_AUDIO_DRIVER_DSOUND 1 +#define SDL_AUDIO_DRIVER_XAUDIO2 0 +#define SDL_AUDIO_DRIVER_WINMM 1 +#define SDL_AUDIO_DRIVER_DISK 1 +#define SDL_AUDIO_DRIVER_DUMMY 1 + +/* Enable various input drivers */ +#define SDL_JOYSTICK_DINPUT 1 +#define SDL_JOYSTICK_XINPUT 1 +#define SDL_HAPTIC_DINPUT 1 +#define SDL_HAPTIC_XINPUT 1 + +/* Enable various shared object loading systems */ +#define SDL_LOADSO_WINDOWS 1 + +/* Enable various threading systems */ +#define SDL_THREAD_WINDOWS 1 + +/* Enable various timer systems */ +#define SDL_TIMER_WINDOWS 1 + +/* Enable various video drivers */ +#define SDL_VIDEO_DRIVER_DUMMY 1 +#define SDL_VIDEO_DRIVER_WINDOWS 1 + +#ifndef SDL_VIDEO_RENDER_D3D +#define SDL_VIDEO_RENDER_D3D 1 +#endif +#ifndef SDL_VIDEO_RENDER_D3D11 +#define SDL_VIDEO_RENDER_D3D11 0 +#endif + +/* Enable OpenGL support */ +#ifndef SDL_VIDEO_OPENGL +#define SDL_VIDEO_OPENGL 1 +#endif +#ifndef SDL_VIDEO_OPENGL_WGL +#define SDL_VIDEO_OPENGL_WGL 1 +#endif +#ifndef SDL_VIDEO_RENDER_OGL +#define SDL_VIDEO_RENDER_OGL 1 +#endif +#ifndef SDL_VIDEO_RENDER_OGL_ES2 +#define SDL_VIDEO_RENDER_OGL_ES2 1 +#endif +#ifndef SDL_VIDEO_OPENGL_ES2 +#define SDL_VIDEO_OPENGL_ES2 1 +#endif +#ifndef SDL_VIDEO_OPENGL_EGL +#define SDL_VIDEO_OPENGL_EGL 1 +#endif + +/* Enable Vulkan support */ +#define SDL_VIDEO_VULKAN 1 + +/* Enable system power support */ +#define SDL_POWER_WINDOWS 1 + +/* Enable filesystem support */ +#define SDL_FILESYSTEM_WINDOWS 1 + +/* Enable assembly routines (Win64 doesn't have inline asm) */ +#ifndef _WIN64 +#define SDL_ASSEMBLY_ROUTINES 1 +#endif + +#endif /* SDL_config_windows_h_ */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_config_winrt.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_config_winrt.h new file mode 100644 index 0000000..24f9e17 --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_config_winrt.h @@ -0,0 +1,215 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2017 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef SDL_config_winrt_h_ +#define SDL_config_winrt_h_ +#define SDL_config_h_ + +#include "SDL_platform.h" + +/* Make sure the Windows SDK's NTDDI_VERSION macro gets defined. This is used + by SDL to determine which version of the Windows SDK is being used. +*/ +#include + +/* Define possibly-undefined NTDDI values (used when compiling SDL against + older versions of the Windows SDK. +*/ +#ifndef NTDDI_WINBLUE +#define NTDDI_WINBLUE 0x06030000 +#endif +#ifndef NTDDI_WIN10 +#define NTDDI_WIN10 0x0A000000 +#endif + +/* This is a set of defines to configure the SDL features */ + +#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H) +#if defined(__GNUC__) || defined(__DMC__) || defined(__WATCOMC__) +#define HAVE_STDINT_H 1 +#elif defined(_MSC_VER) +typedef signed __int8 int8_t; +typedef unsigned __int8 uint8_t; +typedef signed __int16 int16_t; +typedef unsigned __int16 uint16_t; +typedef signed __int32 int32_t; +typedef unsigned __int32 uint32_t; +typedef signed __int64 int64_t; +typedef unsigned __int64 uint64_t; +#ifndef _UINTPTR_T_DEFINED +#ifdef _WIN64 +typedef unsigned __int64 uintptr_t; +#else +typedef unsigned int uintptr_t; +#endif +#define _UINTPTR_T_DEFINED +#endif +/* Older Visual C++ headers don't have the Win64-compatible typedefs... */ +#if ((_MSC_VER <= 1200) && (!defined(DWORD_PTR))) +#define DWORD_PTR DWORD +#endif +#if ((_MSC_VER <= 1200) && (!defined(LONG_PTR))) +#define LONG_PTR LONG +#endif +#else /* !__GNUC__ && !_MSC_VER */ +typedef signed char int8_t; +typedef unsigned char uint8_t; +typedef signed short int16_t; +typedef unsigned short uint16_t; +typedef signed int int32_t; +typedef unsigned int uint32_t; +typedef signed long long int64_t; +typedef unsigned long long uint64_t; +#ifndef _SIZE_T_DEFINED_ +#define _SIZE_T_DEFINED_ +typedef unsigned int size_t; +#endif +typedef unsigned int uintptr_t; +#endif /* __GNUC__ || _MSC_VER */ +#endif /* !_STDINT_H_ && !HAVE_STDINT_H */ + +#ifdef _WIN64 +# define SIZEOF_VOIDP 8 +#else +# define SIZEOF_VOIDP 4 +#endif + +/* Useful headers */ +#define HAVE_DXGI_H 1 +#if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP +#define HAVE_XINPUT_H 1 +#endif +#define HAVE_LIBC 1 +#define HAVE_STDIO_H 1 +#define STDC_HEADERS 1 +#define HAVE_STRING_H 1 +#define HAVE_CTYPE_H 1 +#define HAVE_MATH_H 1 +#define HAVE_FLOAT_H 1 +#define HAVE_SIGNAL_H 1 + +/* C library functions */ +#define HAVE_MALLOC 1 +#define HAVE_CALLOC 1 +#define HAVE_REALLOC 1 +#define HAVE_FREE 1 +#define HAVE_ALLOCA 1 +#define HAVE_QSORT 1 +#define HAVE_ABS 1 +#define HAVE_MEMSET 1 +#define HAVE_MEMCPY 1 +#define HAVE_MEMMOVE 1 +#define HAVE_MEMCMP 1 +#define HAVE_STRLEN 1 +#define HAVE__STRREV 1 +#define HAVE__STRUPR 1 +//#define HAVE__STRLWR 1 // TODO, WinRT: consider using _strlwr_s instead +#define HAVE_STRCHR 1 +#define HAVE_STRRCHR 1 +#define HAVE_STRSTR 1 +//#define HAVE_ITOA 1 // TODO, WinRT: consider using _itoa_s instead +//#define HAVE__LTOA 1 // TODO, WinRT: consider using _ltoa_s instead +//#define HAVE__ULTOA 1 // TODO, WinRT: consider using _ultoa_s instead +#define HAVE_STRTOL 1 +#define HAVE_STRTOUL 1 +//#define HAVE_STRTOLL 1 +#define HAVE_STRTOD 1 +#define HAVE_ATOI 1 +#define HAVE_ATOF 1 +#define HAVE_STRCMP 1 +#define HAVE_STRNCMP 1 +#define HAVE__STRICMP 1 +#define HAVE__STRNICMP 1 +#define HAVE_VSNPRINTF 1 +//#define HAVE_SSCANF 1 // TODO, WinRT: consider using sscanf_s instead +#define HAVE_M_PI 1 +#define HAVE_ATAN 1 +#define HAVE_ATAN2 1 +#define HAVE_CEIL 1 +#define HAVE__COPYSIGN 1 +#define HAVE_COS 1 +#define HAVE_COSF 1 +#define HAVE_FABS 1 +#define HAVE_FLOOR 1 +#define HAVE_LOG 1 +#define HAVE_POW 1 +//#define HAVE_SCALBN 1 +#define HAVE__SCALB 1 +#define HAVE_SIN 1 +#define HAVE_SINF 1 +#define HAVE_SQRT 1 +#define HAVE_SQRTF 1 +#define HAVE_TAN 1 +#define HAVE_TANF 1 +#define HAVE__FSEEKI64 1 + +/* Enable various audio drivers */ +#define SDL_AUDIO_DRIVER_XAUDIO2 1 +#define SDL_AUDIO_DRIVER_DISK 1 +#define SDL_AUDIO_DRIVER_DUMMY 1 + +/* Enable various input drivers */ +#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP +#define SDL_JOYSTICK_DISABLED 1 +#define SDL_HAPTIC_DISABLED 1 +#else +#define SDL_JOYSTICK_XINPUT 1 +#define SDL_HAPTIC_XINPUT 1 +#endif + +/* Enable various shared object loading systems */ +#define SDL_LOADSO_WINDOWS 1 + +/* Enable various threading systems */ +#if (NTDDI_VERSION >= NTDDI_WINBLUE) +#define SDL_THREAD_WINDOWS 1 +#else +/* WinRT on Windows 8.0 and Windows Phone 8.0 don't support CreateThread() */ +#define SDL_THREAD_STDCPP 1 +#endif + +/* Enable various timer systems */ +#define SDL_TIMER_WINDOWS 1 + +/* Enable various video drivers */ +#define SDL_VIDEO_DRIVER_WINRT 1 +#define SDL_VIDEO_DRIVER_DUMMY 1 + +/* Enable OpenGL ES 2.0 (via a modified ANGLE library) */ +#define SDL_VIDEO_OPENGL_ES2 1 +#define SDL_VIDEO_OPENGL_EGL 1 + +/* Enable appropriate renderer(s) */ +#define SDL_VIDEO_RENDER_D3D11 1 + +#if SDL_VIDEO_OPENGL_ES2 +#define SDL_VIDEO_RENDER_OGL_ES2 1 +#endif + +/* Enable system power support */ +#define SDL_POWER_WINRT 1 + +/* Enable assembly routines (Win64 doesn't have inline asm) */ +#ifndef _WIN64 +#define SDL_ASSEMBLY_ROUTINES 1 +#endif + +#endif /* SDL_config_winrt_h_ */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_config_wiz.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_config_wiz.h new file mode 100644 index 0000000..5bb845a --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_config_wiz.h @@ -0,0 +1,121 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2017 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef SDL_config_wiz_h_ +#define SDL_config_wiz_h_ +#define SDL_config_h_ + +/* This is a set of defines to configure the SDL features */ + +/* General platform specific identifiers */ +#include "SDL_platform.h" + +#define SDL_BYTEORDER 1234 + +#define HAVE_ALLOCA_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_STDIO_H 1 +#define STDC_HEADERS 1 +#define HAVE_STDLIB_H 1 +#define HAVE_STDARG_H 1 +#define HAVE_MALLOC_H 1 +#define HAVE_MEMORY_H 1 +#define HAVE_STRING_H 1 +#define HAVE_STRINGS_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_CTYPE_H 1 +#define HAVE_MATH_H 1 +#define HAVE_ICONV_H 1 +#define HAVE_SIGNAL_H 1 +#define HAVE_MALLOC 1 +#define HAVE_CALLOC 1 +#define HAVE_REALLOC 1 +#define HAVE_FREE 1 +#define HAVE_ALLOCA 1 +#define HAVE_GETENV 1 +#define HAVE_SETENV 1 +#define HAVE_PUTENV 1 +#define HAVE_UNSETENV 1 +#define HAVE_QSORT 1 +#define HAVE_ABS 1 +#define HAVE_BCOPY 1 +#define HAVE_MEMSET 1 +#define HAVE_MEMCPY 1 +#define HAVE_MEMMOVE 1 +#define HAVE_STRLEN 1 +#define HAVE_STRDUP 1 +#define HAVE_STRCHR 1 +#define HAVE_STRRCHR 1 +#define HAVE_STRSTR 1 +#define HAVE_STRTOL 1 +#define HAVE_STRTOUL 1 +#define HAVE_STRTOLL 1 +#define HAVE_STRTOULL 1 +#define HAVE_ATOI 1 +#define HAVE_ATOF 1 +#define HAVE_STRCMP 1 +#define HAVE_STRNCMP 1 +#define HAVE_STRCASECMP 1 +#define HAVE_STRNCASECMP 1 +#define HAVE_VSSCANF 1 +#define HAVE_VSNPRINTF 1 +#define HAVE_M_PI 1 +#define HAVE_CEIL 1 +#define HAVE_COPYSIGN 1 +#define HAVE_COS 1 +#define HAVE_COSF 1 +#define HAVE_FABS 1 +#define HAVE_FLOOR 1 +#define HAVE_LOG 1 +#define HAVE_SCALBN 1 +#define HAVE_SIN 1 +#define HAVE_SINF 1 +#define HAVE_SQRT 1 +#define HAVE_SQRTF 1 +#define HAVE_TAN 1 +#define HAVE_TANF 1 +#define HAVE_SIGACTION 1 +#define HAVE_SETJMP 1 +#define HAVE_NANOSLEEP 1 +#define HAVE_POW 1 + +#define SDL_AUDIO_DRIVER_DUMMY 1 +#define SDL_AUDIO_DRIVER_OSS 1 + +#define SDL_INPUT_LINUXEV 1 +#define SDL_INPUT_TSLIB 1 +#define SDL_JOYSTICK_LINUX 1 +#define SDL_HAPTIC_LINUX 1 + +#define SDL_LOADSO_DLOPEN 1 + +#define SDL_THREAD_PTHREAD 1 +#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP 1 + +#define SDL_TIMER_UNIX 1 + +#define SDL_VIDEO_DRIVER_DUMMY 1 +#define SDL_VIDEO_DRIVER_PANDORA 1 +#define SDL_VIDEO_RENDER_OGL_ES 1 +#define SDL_VIDEO_OPENGL_ES 1 + +#endif /* SDL_config_wiz_h_ */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_copying.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_copying.h new file mode 100644 index 0000000..8f60af6 --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_copying.h @@ -0,0 +1,20 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2017 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_cpuinfo.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_cpuinfo.h new file mode 100644 index 0000000..df3123c --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_cpuinfo.h @@ -0,0 +1,299 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_cpuinfo.h + * + * CPU feature detection for SDL. + */ + +#ifndef SDL_cpuinfo_h_ +#define SDL_cpuinfo_h_ + +#include "SDL_stdinc.h" + +/* Need to do this here because intrin.h has C++ code in it */ +/* Visual Studio 2005 has a bug where intrin.h conflicts with winnt.h */ +#if defined(_MSC_VER) && (_MSC_VER >= 1500) && (defined(_M_IX86) || defined(_M_X64)) +#ifdef __clang__ +/* Many of the intrinsics SDL uses are not implemented by clang with Visual Studio */ +#undef __MMX__ +#undef __SSE__ +#undef __SSE2__ +#else +#include +#ifndef _WIN64 +#ifndef __MMX__ +#define __MMX__ +#endif +#ifndef __3dNOW__ +#define __3dNOW__ +#endif +#endif +#ifndef __SSE__ +#define __SSE__ +#endif +#ifndef __SSE2__ +#define __SSE2__ +#endif +#endif /* __clang__ */ +#elif defined(__MINGW64_VERSION_MAJOR) +#include +#else +/* altivec.h redefining bool causes a number of problems, see bugs 3993 and 4392, so you need to explicitly define SDL_ENABLE_ALTIVEC_H to have it included. */ +#if defined(HAVE_ALTIVEC_H) && defined(__ALTIVEC__) && !defined(__APPLE_ALTIVEC__) && defined(SDL_ENABLE_ALTIVEC_H) +#include +#endif +#if !defined(SDL_DISABLE_ARM_NEON_H) +# if defined(__ARM_NEON) +# include +# elif defined(__WINDOWS__) || defined(__WINRT__) +/* Visual Studio doesn't define __ARM_ARCH, but _M_ARM (if set, always 7), and _M_ARM64 (if set, always 1). */ +# if defined(_M_ARM) +# include +# include +# define __ARM_NEON 1 /* Set __ARM_NEON so that it can be used elsewhere, at compile time */ +# endif +# if defined (_M_ARM64) +# include +# include +# define __ARM_NEON 1 /* Set __ARM_NEON so that it can be used elsewhere, at compile time */ +# endif +# endif +#endif +#if defined(__3dNOW__) && !defined(SDL_DISABLE_MM3DNOW_H) +#include +#endif +#if defined(HAVE_IMMINTRIN_H) && !defined(SDL_DISABLE_IMMINTRIN_H) +#include +#else +#if defined(__MMX__) && !defined(SDL_DISABLE_MMINTRIN_H) +#include +#endif +#if defined(__SSE__) && !defined(SDL_DISABLE_XMMINTRIN_H) +#include +#endif +#if defined(__SSE2__) && !defined(SDL_DISABLE_EMMINTRIN_H) +#include +#endif +#if defined(__SSE3__) && !defined(SDL_DISABLE_PMMINTRIN_H) +#include +#endif +#endif /* HAVE_IMMINTRIN_H */ +#endif /* compiler version */ + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* This is a guess for the cacheline size used for padding. + * Most x86 processors have a 64 byte cache line. + * The 64-bit PowerPC processors have a 128 byte cache line. + * We'll use the larger value to be generally safe. + */ +#define SDL_CACHELINE_SIZE 128 + +/** + * This function returns the number of CPU cores available. + */ +extern DECLSPEC int SDLCALL SDL_GetCPUCount(void); + +/** + * This function returns the L1 cache line size of the CPU + * + * This is useful for determining multi-threaded structure padding + * or SIMD prefetch sizes. + */ +extern DECLSPEC int SDLCALL SDL_GetCPUCacheLineSize(void); + +/** + * This function returns true if the CPU has the RDTSC instruction. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_HasRDTSC(void); + +/** + * This function returns true if the CPU has AltiVec features. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_HasAltiVec(void); + +/** + * This function returns true if the CPU has MMX features. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_HasMMX(void); + +/** + * This function returns true if the CPU has 3DNow! features. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_Has3DNow(void); + +/** + * This function returns true if the CPU has SSE features. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE(void); + +/** + * This function returns true if the CPU has SSE2 features. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE2(void); + +/** + * This function returns true if the CPU has SSE3 features. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE3(void); + +/** + * This function returns true if the CPU has SSE4.1 features. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE41(void); + +/** + * This function returns true if the CPU has SSE4.2 features. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE42(void); + +/** + * This function returns true if the CPU has AVX features. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX(void); + +/** + * This function returns true if the CPU has AVX2 features. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX2(void); + +/** + * This function returns true if the CPU has AVX-512F (foundation) features. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX512F(void); + +/** + * This function returns true if the CPU has ARM SIMD (ARMv6) features. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_HasARMSIMD(void); + +/** + * This function returns true if the CPU has NEON (ARM SIMD) features. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_HasNEON(void); + +/** + * This function returns the amount of RAM configured in the system, in MB. + */ +extern DECLSPEC int SDLCALL SDL_GetSystemRAM(void); + +/** + * \brief Report the alignment this system needs for SIMD allocations. + * + * This will return the minimum number of bytes to which a pointer must be + * aligned to be compatible with SIMD instructions on the current machine. + * For example, if the machine supports SSE only, it will return 16, but if + * it supports AVX-512F, it'll return 64 (etc). This only reports values for + * instruction sets SDL knows about, so if your SDL build doesn't have + * SDL_HasAVX512F(), then it might return 16 for the SSE support it sees and + * not 64 for the AVX-512 instructions that exist but SDL doesn't know about. + * Plan accordingly. + */ +extern DECLSPEC size_t SDLCALL SDL_SIMDGetAlignment(void); + +/** + * \brief Allocate memory in a SIMD-friendly way. + * + * This will allocate a block of memory that is suitable for use with SIMD + * instructions. Specifically, it will be properly aligned and padded for + * the system's supported vector instructions. + * + * The memory returned will be padded such that it is safe to read or write + * an incomplete vector at the end of the memory block. This can be useful + * so you don't have to drop back to a scalar fallback at the end of your + * SIMD processing loop to deal with the final elements without overflowing + * the allocated buffer. + * + * You must free this memory with SDL_FreeSIMD(), not free() or SDL_free() + * or delete[], etc. + * + * Note that SDL will only deal with SIMD instruction sets it is aware of; + * for example, SDL 2.0.8 knows that SSE wants 16-byte vectors + * (SDL_HasSSE()), and AVX2 wants 32 bytes (SDL_HasAVX2()), but doesn't + * know that AVX-512 wants 64. To be clear: if you can't decide to use an + * instruction set with an SDL_Has*() function, don't use that instruction + * set with memory allocated through here. + * + * SDL_AllocSIMD(0) will return a non-NULL pointer, assuming the system isn't + * out of memory. + * + * \param len The length, in bytes, of the block to allocated. The actual + * allocated block might be larger due to padding, etc. + * \return Pointer to newly-allocated block, NULL if out of memory. + * + * \sa SDL_SIMDAlignment + * \sa SDL_SIMDRealloc + * \sa SDL_SIMDFree + */ +extern DECLSPEC void * SDLCALL SDL_SIMDAlloc(const size_t len); + +/** + * \brief Reallocate memory obtained from SDL_SIMDAlloc + * + * It is not valid to use this function on a pointer from anything but + * SDL_SIMDAlloc(). It can't be used on pointers from malloc, realloc, + * SDL_malloc, memalign, new[], etc. + * + * \param mem The pointer obtained from SDL_SIMDAlloc. This function also + * accepts NULL, at which point this function is the same as + * calling SDL_realloc with a NULL pointer. + * \param len The length, in bytes, of the block to allocated. The actual + * allocated block might be larger due to padding, etc. Passing 0 + * will return a non-NULL pointer, assuming the system isn't out of + * memory. + * \return Pointer to newly-reallocated block, NULL if out of memory. + * + * \sa SDL_SIMDAlignment + * \sa SDL_SIMDAlloc + * \sa SDL_SIMDFree + */ +extern DECLSPEC void * SDLCALL SDL_SIMDRealloc(void *mem, const size_t len); + +/** + * \brief Deallocate memory obtained from SDL_SIMDAlloc + * + * It is not valid to use this function on a pointer from anything but + * SDL_SIMDAlloc(). It can't be used on pointers from malloc, realloc, + * SDL_malloc, memalign, new[], etc. + * + * However, SDL_SIMDFree(NULL) is a legal no-op. + * + * \sa SDL_SIMDAlloc + * \sa SDL_SIMDRealloc + */ +extern DECLSPEC void SDLCALL SDL_SIMDFree(void *ptr); + +/* vi: set ts=4 sw=4 expandtab: */ +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_cpuinfo_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_egl.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_egl.h new file mode 100644 index 0000000..531441e --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_egl.h @@ -0,0 +1,1676 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_egl.h + * + * This is a simple file to encapsulate the EGL API headers. + */ +#if !defined(_MSC_VER) && !defined(__ANDROID__) + +#include +#include + +#else /* _MSC_VER */ + +/* EGL headers for Visual Studio */ + +#ifndef __khrplatform_h_ +#define __khrplatform_h_ + +/* +** Copyright (c) 2008-2009 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are 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 Materials. +** +** THE MATERIALS ARE 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 +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ + +/* Khronos platform-specific types and definitions. +* +* $Revision: 23298 $ on $Date: 2013-09-30 17:07:13 -0700 (Mon, 30 Sep 2013) $ +* +* Adopters may modify this file to suit their platform. Adopters are +* encouraged to submit platform specific modifications to the Khronos +* group so that they can be included in future versions of this file. +* Please submit changes by sending them to the public Khronos Bugzilla +* (http://khronos.org/bugzilla) by filing a bug against product +* "Khronos (general)" component "Registry". +* +* A predefined template which fills in some of the bug fields can be +* reached using http://tinyurl.com/khrplatform-h-bugreport, but you +* must create a Bugzilla login first. +* +* +* See the Implementer's Guidelines for information about where this file +* should be located on your system and for more details of its use: +* http://www.khronos.org/registry/implementers_guide.pdf +* +* This file should be included as +* #include +* by Khronos client API header files that use its types and defines. +* +* The types in khrplatform.h should only be used to define API-specific types. +* +* Types defined in khrplatform.h: +* khronos_int8_t signed 8 bit +* khronos_uint8_t unsigned 8 bit +* khronos_int16_t signed 16 bit +* khronos_uint16_t unsigned 16 bit +* khronos_int32_t signed 32 bit +* khronos_uint32_t unsigned 32 bit +* khronos_int64_t signed 64 bit +* khronos_uint64_t unsigned 64 bit +* khronos_intptr_t signed same number of bits as a pointer +* khronos_uintptr_t unsigned same number of bits as a pointer +* khronos_ssize_t signed size +* khronos_usize_t unsigned size +* khronos_float_t signed 32 bit floating point +* khronos_time_ns_t unsigned 64 bit time in nanoseconds +* khronos_utime_nanoseconds_t unsigned time interval or absolute time in +* nanoseconds +* khronos_stime_nanoseconds_t signed time interval in nanoseconds +* khronos_boolean_enum_t enumerated boolean type. This should +* only be used as a base type when a client API's boolean type is +* an enum. Client APIs which use an integer or other type for +* booleans cannot use this as the base type for their boolean. +* +* Tokens defined in khrplatform.h: +* +* KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values. +* +* KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0. +* KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0. +* +* Calling convention macros defined in this file: +* KHRONOS_APICALL +* KHRONOS_APIENTRY +* KHRONOS_APIATTRIBUTES +* +* These may be used in function prototypes as: +* +* KHRONOS_APICALL void KHRONOS_APIENTRY funcname( +* int arg1, +* int arg2) KHRONOS_APIATTRIBUTES; +*/ + +/*------------------------------------------------------------------------- +* Definition of KHRONOS_APICALL +*------------------------------------------------------------------------- +* This precedes the return type of the function in the function prototype. +*/ +#if defined(_WIN32) && !defined(__SCITECH_SNAP__) && !defined(SDL_VIDEO_STATIC_ANGLE) +# define KHRONOS_APICALL __declspec(dllimport) +#elif defined (__SYMBIAN32__) +# define KHRONOS_APICALL IMPORT_C +#else +# define KHRONOS_APICALL +#endif + +/*------------------------------------------------------------------------- +* Definition of KHRONOS_APIENTRY +*------------------------------------------------------------------------- +* This follows the return type of the function and precedes the function +* name in the function prototype. +*/ +#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__) +/* Win32 but not WinCE */ +# define KHRONOS_APIENTRY __stdcall +#else +# define KHRONOS_APIENTRY +#endif + +/*------------------------------------------------------------------------- +* Definition of KHRONOS_APIATTRIBUTES +*------------------------------------------------------------------------- +* This follows the closing parenthesis of the function prototype arguments. +*/ +#if defined (__ARMCC_2__) +#define KHRONOS_APIATTRIBUTES __softfp +#else +#define KHRONOS_APIATTRIBUTES +#endif + +/*------------------------------------------------------------------------- +* basic type definitions +*-----------------------------------------------------------------------*/ +#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__) + + +/* +* Using +*/ +#include +typedef int32_t khronos_int32_t; +typedef uint32_t khronos_uint32_t; +typedef int64_t khronos_int64_t; +typedef uint64_t khronos_uint64_t; +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#elif defined(__VMS ) || defined(__sgi) + +/* +* Using +*/ +#include +typedef int32_t khronos_int32_t; +typedef uint32_t khronos_uint32_t; +typedef int64_t khronos_int64_t; +typedef uint64_t khronos_uint64_t; +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#elif defined(_WIN32) && !defined(__SCITECH_SNAP__) + +/* +* Win32 +*/ +typedef __int32 khronos_int32_t; +typedef unsigned __int32 khronos_uint32_t; +typedef __int64 khronos_int64_t; +typedef unsigned __int64 khronos_uint64_t; +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#elif defined(__sun__) || defined(__digital__) + +/* +* Sun or Digital +*/ +typedef int khronos_int32_t; +typedef unsigned int khronos_uint32_t; +#if defined(__arch64__) || defined(_LP64) +typedef long int khronos_int64_t; +typedef unsigned long int khronos_uint64_t; +#else +typedef long long int khronos_int64_t; +typedef unsigned long long int khronos_uint64_t; +#endif /* __arch64__ */ +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#elif 0 + +/* +* Hypothetical platform with no float or int64 support +*/ +typedef int khronos_int32_t; +typedef unsigned int khronos_uint32_t; +#define KHRONOS_SUPPORT_INT64 0 +#define KHRONOS_SUPPORT_FLOAT 0 + +#else + +/* +* Generic fallback +*/ +#include +typedef int32_t khronos_int32_t; +typedef uint32_t khronos_uint32_t; +typedef int64_t khronos_int64_t; +typedef uint64_t khronos_uint64_t; +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#endif + + +/* +* Types that are (so far) the same on all platforms +*/ +typedef signed char khronos_int8_t; +typedef unsigned char khronos_uint8_t; +typedef signed short int khronos_int16_t; +typedef unsigned short int khronos_uint16_t; + +/* +* Types that differ between LLP64 and LP64 architectures - in LLP64, +* pointers are 64 bits, but 'long' is still 32 bits. Win64 appears +* to be the only LLP64 architecture in current use. +*/ +#ifdef _WIN64 +typedef signed long long int khronos_intptr_t; +typedef unsigned long long int khronos_uintptr_t; +typedef signed long long int khronos_ssize_t; +typedef unsigned long long int khronos_usize_t; +#else +typedef signed long int khronos_intptr_t; +typedef unsigned long int khronos_uintptr_t; +typedef signed long int khronos_ssize_t; +typedef unsigned long int khronos_usize_t; +#endif + +#if KHRONOS_SUPPORT_FLOAT +/* +* Float type +*/ +typedef float khronos_float_t; +#endif + +#if KHRONOS_SUPPORT_INT64 +/* Time types +* +* These types can be used to represent a time interval in nanoseconds or +* an absolute Unadjusted System Time. Unadjusted System Time is the number +* of nanoseconds since some arbitrary system event (e.g. since the last +* time the system booted). The Unadjusted System Time is an unsigned +* 64 bit value that wraps back to 0 every 584 years. Time intervals +* may be either signed or unsigned. +*/ +typedef khronos_uint64_t khronos_utime_nanoseconds_t; +typedef khronos_int64_t khronos_stime_nanoseconds_t; +#endif + +/* +* Dummy value used to pad enum types to 32 bits. +*/ +#ifndef KHRONOS_MAX_ENUM +#define KHRONOS_MAX_ENUM 0x7FFFFFFF +#endif + +/* +* Enumerated boolean type +* +* Values other than zero should be considered to be true. Therefore +* comparisons should not be made against KHRONOS_TRUE. +*/ +typedef enum { + KHRONOS_FALSE = 0, + KHRONOS_TRUE = 1, + KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM +} khronos_boolean_enum_t; + +#endif /* __khrplatform_h_ */ + + +#ifndef __eglplatform_h_ +#define __eglplatform_h_ + +/* +** Copyright (c) 2007-2009 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are 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 Materials. +** +** THE MATERIALS ARE 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 +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ + +/* Platform-specific types and definitions for egl.h +* $Revision: 12306 $ on $Date: 2010-08-25 09:51:28 -0700 (Wed, 25 Aug 2010) $ +* +* Adopters may modify khrplatform.h and this file to suit their platform. +* You are encouraged to submit all modifications to the Khronos group so that +* they can be included in future versions of this file. Please submit changes +* by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla) +* by filing a bug against product "EGL" component "Registry". +*/ + +/*#include */ + +/* Macros used in EGL function prototype declarations. +* +* EGL functions should be prototyped as: +* +* EGLAPI return-type EGLAPIENTRY eglFunction(arguments); +* typedef return-type (EXPAPIENTRYP PFNEGLFUNCTIONPROC) (arguments); +* +* KHRONOS_APICALL and KHRONOS_APIENTRY are defined in KHR/khrplatform.h +*/ + +#ifndef EGLAPI +#define EGLAPI KHRONOS_APICALL +#endif + +#ifndef EGLAPIENTRY +#define EGLAPIENTRY KHRONOS_APIENTRY +#endif +#define EGLAPIENTRYP EGLAPIENTRY* + +/* The types NativeDisplayType, NativeWindowType, and NativePixmapType +* are aliases of window-system-dependent types, such as X Display * or +* Windows Device Context. They must be defined in platform-specific +* code below. The EGL-prefixed versions of Native*Type are the same +* types, renamed in EGL 1.3 so all types in the API start with "EGL". +* +* Khronos STRONGLY RECOMMENDS that you use the default definitions +* provided below, since these changes affect both binary and source +* portability of applications using EGL running on different EGL +* implementations. +*/ + +#if defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */ +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN 1 +#endif +#ifndef NOMINMAX /* don't define min() and max(). */ +#define NOMINMAX +#endif +#include + +#if __WINRT__ +#include +typedef IUnknown * EGLNativeWindowType; +typedef IUnknown * EGLNativePixmapType; +typedef IUnknown * EGLNativeDisplayType; +#else +typedef HDC EGLNativeDisplayType; +typedef HBITMAP EGLNativePixmapType; +typedef HWND EGLNativeWindowType; +#endif + +#elif defined(__WINSCW__) || defined(__SYMBIAN32__) /* Symbian */ + +typedef int EGLNativeDisplayType; +typedef void *EGLNativeWindowType; +typedef void *EGLNativePixmapType; + +#elif defined(WL_EGL_PLATFORM) + +typedef struct wl_display *EGLNativeDisplayType; +typedef struct wl_egl_pixmap *EGLNativePixmapType; +typedef struct wl_egl_window *EGLNativeWindowType; + +#elif defined(__GBM__) + +typedef struct gbm_device *EGLNativeDisplayType; +typedef struct gbm_bo *EGLNativePixmapType; +typedef void *EGLNativeWindowType; + +#elif defined(__ANDROID__) /* Android */ + +struct ANativeWindow; +struct egl_native_pixmap_t; + +typedef struct ANativeWindow *EGLNativeWindowType; +typedef struct egl_native_pixmap_t *EGLNativePixmapType; +typedef void *EGLNativeDisplayType; + +#elif defined(MIR_EGL_PLATFORM) + +#include +typedef MirEGLNativeDisplayType EGLNativeDisplayType; +typedef void *EGLNativePixmapType; +typedef MirEGLNativeWindowType EGLNativeWindowType; + +#elif defined(__unix__) + +#ifdef MESA_EGL_NO_X11_HEADERS + +typedef void *EGLNativeDisplayType; +typedef khronos_uintptr_t EGLNativePixmapType; +typedef khronos_uintptr_t EGLNativeWindowType; + +#else + +/* X11 (tentative) */ +#include +#include + +typedef Display *EGLNativeDisplayType; +typedef Pixmap EGLNativePixmapType; +typedef Window EGLNativeWindowType; + +#endif /* MESA_EGL_NO_X11_HEADERS */ + +#else +#error "Platform not recognized" +#endif + +/* EGL 1.2 types, renamed for consistency in EGL 1.3 */ +typedef EGLNativeDisplayType NativeDisplayType; +typedef EGLNativePixmapType NativePixmapType; +typedef EGLNativeWindowType NativeWindowType; + + +/* Define EGLint. This must be a signed integral type large enough to contain +* all legal attribute names and values passed into and out of EGL, whether +* their type is boolean, bitmask, enumerant (symbolic constant), integer, +* handle, or other. While in general a 32-bit integer will suffice, if +* handles are 64 bit types, then EGLint should be defined as a signed 64-bit +* integer type. +*/ +typedef khronos_int32_t EGLint; + +#endif /* __eglplatform_h */ + +#ifndef __egl_h_ +#define __egl_h_ 1 + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** Copyright (c) 2013-2015 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are 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 Materials. +** +** THE MATERIALS ARE 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 +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ +/* +** This header is generated from the Khronos OpenGL / OpenGL ES XML +** API Registry. The current version of the Registry, generator scripts +** used to make the header, and the header can be found at +** http://www.opengl.org/registry/ +** +** Khronos $Revision: 31566 $ on $Date: 2015-06-23 08:48:48 -0700 (Tue, 23 Jun 2015) $ +*/ + +/*#include */ + +/* Generated on date 20150623 */ + +/* Generated C header for: + * API: egl + * Versions considered: .* + * Versions emitted: .* + * Default extensions included: None + * Additional extensions included: _nomatch_^ + * Extensions removed: _nomatch_^ + */ + +#ifndef EGL_VERSION_1_0 +#define EGL_VERSION_1_0 1 +typedef unsigned int EGLBoolean; +typedef void *EGLDisplay; +typedef void *EGLConfig; +typedef void *EGLSurface; +typedef void *EGLContext; +typedef void (*__eglMustCastToProperFunctionPointerType)(void); +#define EGL_ALPHA_SIZE 0x3021 +#define EGL_BAD_ACCESS 0x3002 +#define EGL_BAD_ALLOC 0x3003 +#define EGL_BAD_ATTRIBUTE 0x3004 +#define EGL_BAD_CONFIG 0x3005 +#define EGL_BAD_CONTEXT 0x3006 +#define EGL_BAD_CURRENT_SURFACE 0x3007 +#define EGL_BAD_DISPLAY 0x3008 +#define EGL_BAD_MATCH 0x3009 +#define EGL_BAD_NATIVE_PIXMAP 0x300A +#define EGL_BAD_NATIVE_WINDOW 0x300B +#define EGL_BAD_PARAMETER 0x300C +#define EGL_BAD_SURFACE 0x300D +#define EGL_BLUE_SIZE 0x3022 +#define EGL_BUFFER_SIZE 0x3020 +#define EGL_CONFIG_CAVEAT 0x3027 +#define EGL_CONFIG_ID 0x3028 +#define EGL_CORE_NATIVE_ENGINE 0x305B +#define EGL_DEPTH_SIZE 0x3025 +#define EGL_DONT_CARE ((EGLint)-1) +#define EGL_DRAW 0x3059 +#define EGL_EXTENSIONS 0x3055 +#define EGL_FALSE 0 +#define EGL_GREEN_SIZE 0x3023 +#define EGL_HEIGHT 0x3056 +#define EGL_LARGEST_PBUFFER 0x3058 +#define EGL_LEVEL 0x3029 +#define EGL_MAX_PBUFFER_HEIGHT 0x302A +#define EGL_MAX_PBUFFER_PIXELS 0x302B +#define EGL_MAX_PBUFFER_WIDTH 0x302C +#define EGL_NATIVE_RENDERABLE 0x302D +#define EGL_NATIVE_VISUAL_ID 0x302E +#define EGL_NATIVE_VISUAL_TYPE 0x302F +#define EGL_NONE 0x3038 +#define EGL_NON_CONFORMANT_CONFIG 0x3051 +#define EGL_NOT_INITIALIZED 0x3001 +#define EGL_NO_CONTEXT ((EGLContext)0) +#define EGL_NO_DISPLAY ((EGLDisplay)0) +#define EGL_NO_SURFACE ((EGLSurface)0) +#define EGL_PBUFFER_BIT 0x0001 +#define EGL_PIXMAP_BIT 0x0002 +#define EGL_READ 0x305A +#define EGL_RED_SIZE 0x3024 +#define EGL_SAMPLES 0x3031 +#define EGL_SAMPLE_BUFFERS 0x3032 +#define EGL_SLOW_CONFIG 0x3050 +#define EGL_STENCIL_SIZE 0x3026 +#define EGL_SUCCESS 0x3000 +#define EGL_SURFACE_TYPE 0x3033 +#define EGL_TRANSPARENT_BLUE_VALUE 0x3035 +#define EGL_TRANSPARENT_GREEN_VALUE 0x3036 +#define EGL_TRANSPARENT_RED_VALUE 0x3037 +#define EGL_TRANSPARENT_RGB 0x3052 +#define EGL_TRANSPARENT_TYPE 0x3034 +#define EGL_TRUE 1 +#define EGL_VENDOR 0x3053 +#define EGL_VERSION 0x3054 +#define EGL_WIDTH 0x3057 +#define EGL_WINDOW_BIT 0x0004 +EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig (EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config); +EGLAPI EGLBoolean EGLAPIENTRY eglCopyBuffers (EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target); +EGLAPI EGLContext EGLAPIENTRY eglCreateContext (EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list); +EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferSurface (EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list); +EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurface (EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list); +EGLAPI EGLSurface EGLAPIENTRY eglCreateWindowSurface (EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglDestroyContext (EGLDisplay dpy, EGLContext ctx); +EGLAPI EGLBoolean EGLAPIENTRY eglDestroySurface (EGLDisplay dpy, EGLSurface surface); +EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigAttrib (EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value); +EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigs (EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config); +EGLAPI EGLDisplay EGLAPIENTRY eglGetCurrentDisplay (void); +EGLAPI EGLSurface EGLAPIENTRY eglGetCurrentSurface (EGLint readdraw); +EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay (EGLNativeDisplayType display_id); +EGLAPI EGLint EGLAPIENTRY eglGetError (void); +EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY eglGetProcAddress (const char *procname); +EGLAPI EGLBoolean EGLAPIENTRY eglInitialize (EGLDisplay dpy, EGLint *major, EGLint *minor); +EGLAPI EGLBoolean EGLAPIENTRY eglMakeCurrent (EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryContext (EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value); +EGLAPI const char *EGLAPIENTRY eglQueryString (EGLDisplay dpy, EGLint name); +EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value); +EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers (EGLDisplay dpy, EGLSurface surface); +EGLAPI EGLBoolean EGLAPIENTRY eglTerminate (EGLDisplay dpy); +EGLAPI EGLBoolean EGLAPIENTRY eglWaitGL (void); +EGLAPI EGLBoolean EGLAPIENTRY eglWaitNative (EGLint engine); +#endif /* EGL_VERSION_1_0 */ + +#ifndef EGL_VERSION_1_1 +#define EGL_VERSION_1_1 1 +#define EGL_BACK_BUFFER 0x3084 +#define EGL_BIND_TO_TEXTURE_RGB 0x3039 +#define EGL_BIND_TO_TEXTURE_RGBA 0x303A +#define EGL_CONTEXT_LOST 0x300E +#define EGL_MIN_SWAP_INTERVAL 0x303B +#define EGL_MAX_SWAP_INTERVAL 0x303C +#define EGL_MIPMAP_TEXTURE 0x3082 +#define EGL_MIPMAP_LEVEL 0x3083 +#define EGL_NO_TEXTURE 0x305C +#define EGL_TEXTURE_2D 0x305F +#define EGL_TEXTURE_FORMAT 0x3080 +#define EGL_TEXTURE_RGB 0x305D +#define EGL_TEXTURE_RGBA 0x305E +#define EGL_TEXTURE_TARGET 0x3081 +EGLAPI EGLBoolean EGLAPIENTRY eglBindTexImage (EGLDisplay dpy, EGLSurface surface, EGLint buffer); +EGLAPI EGLBoolean EGLAPIENTRY eglReleaseTexImage (EGLDisplay dpy, EGLSurface surface, EGLint buffer); +EGLAPI EGLBoolean EGLAPIENTRY eglSurfaceAttrib (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value); +EGLAPI EGLBoolean EGLAPIENTRY eglSwapInterval (EGLDisplay dpy, EGLint interval); +#endif /* EGL_VERSION_1_1 */ + +#ifndef EGL_VERSION_1_2 +#define EGL_VERSION_1_2 1 +typedef unsigned int EGLenum; +typedef void *EGLClientBuffer; +#define EGL_ALPHA_FORMAT 0x3088 +#define EGL_ALPHA_FORMAT_NONPRE 0x308B +#define EGL_ALPHA_FORMAT_PRE 0x308C +#define EGL_ALPHA_MASK_SIZE 0x303E +#define EGL_BUFFER_PRESERVED 0x3094 +#define EGL_BUFFER_DESTROYED 0x3095 +#define EGL_CLIENT_APIS 0x308D +#define EGL_COLORSPACE 0x3087 +#define EGL_COLORSPACE_sRGB 0x3089 +#define EGL_COLORSPACE_LINEAR 0x308A +#define EGL_COLOR_BUFFER_TYPE 0x303F +#define EGL_CONTEXT_CLIENT_TYPE 0x3097 +#define EGL_DISPLAY_SCALING 10000 +#define EGL_HORIZONTAL_RESOLUTION 0x3090 +#define EGL_LUMINANCE_BUFFER 0x308F +#define EGL_LUMINANCE_SIZE 0x303D +#define EGL_OPENGL_ES_BIT 0x0001 +#define EGL_OPENVG_BIT 0x0002 +#define EGL_OPENGL_ES_API 0x30A0 +#define EGL_OPENVG_API 0x30A1 +#define EGL_OPENVG_IMAGE 0x3096 +#define EGL_PIXEL_ASPECT_RATIO 0x3092 +#define EGL_RENDERABLE_TYPE 0x3040 +#define EGL_RENDER_BUFFER 0x3086 +#define EGL_RGB_BUFFER 0x308E +#define EGL_SINGLE_BUFFER 0x3085 +#define EGL_SWAP_BEHAVIOR 0x3093 +#define EGL_UNKNOWN ((EGLint)-1) +#define EGL_VERTICAL_RESOLUTION 0x3091 +EGLAPI EGLBoolean EGLAPIENTRY eglBindAPI (EGLenum api); +EGLAPI EGLenum EGLAPIENTRY eglQueryAPI (void); +EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer (EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglReleaseThread (void); +EGLAPI EGLBoolean EGLAPIENTRY eglWaitClient (void); +#endif /* EGL_VERSION_1_2 */ + +#ifndef EGL_VERSION_1_3 +#define EGL_VERSION_1_3 1 +#define EGL_CONFORMANT 0x3042 +#define EGL_CONTEXT_CLIENT_VERSION 0x3098 +#define EGL_MATCH_NATIVE_PIXMAP 0x3041 +#define EGL_OPENGL_ES2_BIT 0x0004 +#define EGL_VG_ALPHA_FORMAT 0x3088 +#define EGL_VG_ALPHA_FORMAT_NONPRE 0x308B +#define EGL_VG_ALPHA_FORMAT_PRE 0x308C +#define EGL_VG_ALPHA_FORMAT_PRE_BIT 0x0040 +#define EGL_VG_COLORSPACE 0x3087 +#define EGL_VG_COLORSPACE_sRGB 0x3089 +#define EGL_VG_COLORSPACE_LINEAR 0x308A +#define EGL_VG_COLORSPACE_LINEAR_BIT 0x0020 +#endif /* EGL_VERSION_1_3 */ + +#ifndef EGL_VERSION_1_4 +#define EGL_VERSION_1_4 1 +#define EGL_DEFAULT_DISPLAY ((EGLNativeDisplayType)0) +#define EGL_MULTISAMPLE_RESOLVE_BOX_BIT 0x0200 +#define EGL_MULTISAMPLE_RESOLVE 0x3099 +#define EGL_MULTISAMPLE_RESOLVE_DEFAULT 0x309A +#define EGL_MULTISAMPLE_RESOLVE_BOX 0x309B +#define EGL_OPENGL_API 0x30A2 +#define EGL_OPENGL_BIT 0x0008 +#define EGL_SWAP_BEHAVIOR_PRESERVED_BIT 0x0400 +EGLAPI EGLContext EGLAPIENTRY eglGetCurrentContext (void); +#endif /* EGL_VERSION_1_4 */ + +#ifndef EGL_VERSION_1_5 +#define EGL_VERSION_1_5 1 +typedef void *EGLSync; +typedef intptr_t EGLAttrib; +typedef khronos_utime_nanoseconds_t EGLTime; +typedef void *EGLImage; +#define EGL_CONTEXT_MAJOR_VERSION 0x3098 +#define EGL_CONTEXT_MINOR_VERSION 0x30FB +#define EGL_CONTEXT_OPENGL_PROFILE_MASK 0x30FD +#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY 0x31BD +#define EGL_NO_RESET_NOTIFICATION 0x31BE +#define EGL_LOSE_CONTEXT_ON_RESET 0x31BF +#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT 0x00000001 +#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT 0x00000002 +#define EGL_CONTEXT_OPENGL_DEBUG 0x31B0 +#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE 0x31B1 +#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS 0x31B2 +#define EGL_OPENGL_ES3_BIT 0x00000040 +#define EGL_CL_EVENT_HANDLE 0x309C +#define EGL_SYNC_CL_EVENT 0x30FE +#define EGL_SYNC_CL_EVENT_COMPLETE 0x30FF +#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE 0x30F0 +#define EGL_SYNC_TYPE 0x30F7 +#define EGL_SYNC_STATUS 0x30F1 +#define EGL_SYNC_CONDITION 0x30F8 +#define EGL_SIGNALED 0x30F2 +#define EGL_UNSIGNALED 0x30F3 +#define EGL_SYNC_FLUSH_COMMANDS_BIT 0x0001 +#define EGL_FOREVER 0xFFFFFFFFFFFFFFFFull +#define EGL_TIMEOUT_EXPIRED 0x30F5 +#define EGL_CONDITION_SATISFIED 0x30F6 +#define EGL_NO_SYNC ((EGLSync)0) +#define EGL_SYNC_FENCE 0x30F9 +#define EGL_GL_COLORSPACE 0x309D +#define EGL_GL_COLORSPACE_SRGB 0x3089 +#define EGL_GL_COLORSPACE_LINEAR 0x308A +#define EGL_GL_RENDERBUFFER 0x30B9 +#define EGL_GL_TEXTURE_2D 0x30B1 +#define EGL_GL_TEXTURE_LEVEL 0x30BC +#define EGL_GL_TEXTURE_3D 0x30B2 +#define EGL_GL_TEXTURE_ZOFFSET 0x30BD +#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x30B3 +#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x30B4 +#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x30B5 +#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x30B6 +#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x30B7 +#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x30B8 +#define EGL_IMAGE_PRESERVED 0x30D2 +#define EGL_NO_IMAGE ((EGLImage)0) +EGLAPI EGLSync EGLAPIENTRY eglCreateSync (EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglDestroySync (EGLDisplay dpy, EGLSync sync); +EGLAPI EGLint EGLAPIENTRY eglClientWaitSync (EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout); +EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttrib (EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib *value); +EGLAPI EGLImage EGLAPIENTRY eglCreateImage (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLAttrib *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImage (EGLDisplay dpy, EGLImage image); +EGLAPI EGLDisplay EGLAPIENTRY eglGetPlatformDisplay (EGLenum platform, void *native_display, const EGLAttrib *attrib_list); +EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformWindowSurface (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLAttrib *attrib_list); +EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurface (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLAttrib *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglWaitSync (EGLDisplay dpy, EGLSync sync, EGLint flags); +#endif /* EGL_VERSION_1_5 */ + +#ifdef __cplusplus +} +#endif + +#endif /* __egl_h_ */ + + + +#ifndef __eglext_h_ +#define __eglext_h_ 1 + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** Copyright (c) 2013-2015 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are 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 Materials. +** +** THE MATERIALS ARE 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 +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ +/* +** This header is generated from the Khronos OpenGL / OpenGL ES XML +** API Registry. The current version of the Registry, generator scripts +** used to make the header, and the header can be found at +** http://www.opengl.org/registry/ +** +** Khronos $Revision: 31566 $ on $Date: 2015-06-23 08:48:48 -0700 (Tue, 23 Jun 2015) $ +*/ + +/*#include */ + +#define EGL_EGLEXT_VERSION 20150623 + +/* Generated C header for: + * API: egl + * Versions considered: .* + * Versions emitted: _nomatch_^ + * Default extensions included: egl + * Additional extensions included: _nomatch_^ + * Extensions removed: _nomatch_^ + */ + +#ifndef EGL_KHR_cl_event +#define EGL_KHR_cl_event 1 +#define EGL_CL_EVENT_HANDLE_KHR 0x309C +#define EGL_SYNC_CL_EVENT_KHR 0x30FE +#define EGL_SYNC_CL_EVENT_COMPLETE_KHR 0x30FF +#endif /* EGL_KHR_cl_event */ + +#ifndef EGL_KHR_cl_event2 +#define EGL_KHR_cl_event2 1 +typedef void *EGLSyncKHR; +typedef intptr_t EGLAttribKHR; +typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNC64KHRPROC) (EGLDisplay dpy, EGLenum type, const EGLAttribKHR *attrib_list); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSync64KHR (EGLDisplay dpy, EGLenum type, const EGLAttribKHR *attrib_list); +#endif +#endif /* EGL_KHR_cl_event2 */ + +#ifndef EGL_KHR_client_get_all_proc_addresses +#define EGL_KHR_client_get_all_proc_addresses 1 +#endif /* EGL_KHR_client_get_all_proc_addresses */ + +#ifndef EGL_KHR_config_attribs +#define EGL_KHR_config_attribs 1 +#define EGL_CONFORMANT_KHR 0x3042 +#define EGL_VG_COLORSPACE_LINEAR_BIT_KHR 0x0020 +#define EGL_VG_ALPHA_FORMAT_PRE_BIT_KHR 0x0040 +#endif /* EGL_KHR_config_attribs */ + +#ifndef EGL_KHR_create_context +#define EGL_KHR_create_context 1 +#define EGL_CONTEXT_MAJOR_VERSION_KHR 0x3098 +#define EGL_CONTEXT_MINOR_VERSION_KHR 0x30FB +#define EGL_CONTEXT_FLAGS_KHR 0x30FC +#define EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR 0x30FD +#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR 0x31BD +#define EGL_NO_RESET_NOTIFICATION_KHR 0x31BE +#define EGL_LOSE_CONTEXT_ON_RESET_KHR 0x31BF +#define EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR 0x00000001 +#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR 0x00000002 +#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR 0x00000004 +#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR 0x00000001 +#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR 0x00000002 +#define EGL_OPENGL_ES3_BIT_KHR 0x00000040 +#endif /* EGL_KHR_create_context */ + +#ifndef EGL_KHR_create_context_no_error +#define EGL_KHR_create_context_no_error 1 +#define EGL_CONTEXT_OPENGL_NO_ERROR_KHR 0x31B3 +#endif /* EGL_KHR_create_context_no_error */ + +#ifndef EGL_KHR_fence_sync +#define EGL_KHR_fence_sync 1 +typedef khronos_utime_nanoseconds_t EGLTimeKHR; +#ifdef KHRONOS_SUPPORT_INT64 +#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR 0x30F0 +#define EGL_SYNC_CONDITION_KHR 0x30F8 +#define EGL_SYNC_FENCE_KHR 0x30F9 +typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNCKHRPROC) (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync); +typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSyncKHR (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncKHR (EGLDisplay dpy, EGLSyncKHR sync); +EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout); +EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value); +#endif +#endif /* KHRONOS_SUPPORT_INT64 */ +#endif /* EGL_KHR_fence_sync */ + +#ifndef EGL_KHR_get_all_proc_addresses +#define EGL_KHR_get_all_proc_addresses 1 +#endif /* EGL_KHR_get_all_proc_addresses */ + +#ifndef EGL_KHR_gl_colorspace +#define EGL_KHR_gl_colorspace 1 +#define EGL_GL_COLORSPACE_KHR 0x309D +#define EGL_GL_COLORSPACE_SRGB_KHR 0x3089 +#define EGL_GL_COLORSPACE_LINEAR_KHR 0x308A +#endif /* EGL_KHR_gl_colorspace */ + +#ifndef EGL_KHR_gl_renderbuffer_image +#define EGL_KHR_gl_renderbuffer_image 1 +#define EGL_GL_RENDERBUFFER_KHR 0x30B9 +#endif /* EGL_KHR_gl_renderbuffer_image */ + +#ifndef EGL_KHR_gl_texture_2D_image +#define EGL_KHR_gl_texture_2D_image 1 +#define EGL_GL_TEXTURE_2D_KHR 0x30B1 +#define EGL_GL_TEXTURE_LEVEL_KHR 0x30BC +#endif /* EGL_KHR_gl_texture_2D_image */ + +#ifndef EGL_KHR_gl_texture_3D_image +#define EGL_KHR_gl_texture_3D_image 1 +#define EGL_GL_TEXTURE_3D_KHR 0x30B2 +#define EGL_GL_TEXTURE_ZOFFSET_KHR 0x30BD +#endif /* EGL_KHR_gl_texture_3D_image */ + +#ifndef EGL_KHR_gl_texture_cubemap_image +#define EGL_KHR_gl_texture_cubemap_image 1 +#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR 0x30B3 +#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR 0x30B4 +#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR 0x30B5 +#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR 0x30B6 +#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR 0x30B7 +#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR 0x30B8 +#endif /* EGL_KHR_gl_texture_cubemap_image */ + +#ifndef EGL_KHR_image +#define EGL_KHR_image 1 +typedef void *EGLImageKHR; +#define EGL_NATIVE_PIXMAP_KHR 0x30B0 +#define EGL_NO_IMAGE_KHR ((EGLImageKHR)0) +typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGLImageKHR image); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImageKHR (EGLDisplay dpy, EGLImageKHR image); +#endif +#endif /* EGL_KHR_image */ + +#ifndef EGL_KHR_image_base +#define EGL_KHR_image_base 1 +#define EGL_IMAGE_PRESERVED_KHR 0x30D2 +#endif /* EGL_KHR_image_base */ + +#ifndef EGL_KHR_image_pixmap +#define EGL_KHR_image_pixmap 1 +#endif /* EGL_KHR_image_pixmap */ + +#ifndef EGL_KHR_lock_surface +#define EGL_KHR_lock_surface 1 +#define EGL_READ_SURFACE_BIT_KHR 0x0001 +#define EGL_WRITE_SURFACE_BIT_KHR 0x0002 +#define EGL_LOCK_SURFACE_BIT_KHR 0x0080 +#define EGL_OPTIMAL_FORMAT_BIT_KHR 0x0100 +#define EGL_MATCH_FORMAT_KHR 0x3043 +#define EGL_FORMAT_RGB_565_EXACT_KHR 0x30C0 +#define EGL_FORMAT_RGB_565_KHR 0x30C1 +#define EGL_FORMAT_RGBA_8888_EXACT_KHR 0x30C2 +#define EGL_FORMAT_RGBA_8888_KHR 0x30C3 +#define EGL_MAP_PRESERVE_PIXELS_KHR 0x30C4 +#define EGL_LOCK_USAGE_HINT_KHR 0x30C5 +#define EGL_BITMAP_POINTER_KHR 0x30C6 +#define EGL_BITMAP_PITCH_KHR 0x30C7 +#define EGL_BITMAP_ORIGIN_KHR 0x30C8 +#define EGL_BITMAP_PIXEL_RED_OFFSET_KHR 0x30C9 +#define EGL_BITMAP_PIXEL_GREEN_OFFSET_KHR 0x30CA +#define EGL_BITMAP_PIXEL_BLUE_OFFSET_KHR 0x30CB +#define EGL_BITMAP_PIXEL_ALPHA_OFFSET_KHR 0x30CC +#define EGL_BITMAP_PIXEL_LUMINANCE_OFFSET_KHR 0x30CD +#define EGL_LOWER_LEFT_KHR 0x30CE +#define EGL_UPPER_LEFT_KHR 0x30CF +typedef EGLBoolean (EGLAPIENTRYP PFNEGLLOCKSURFACEKHRPROC) (EGLDisplay dpy, EGLSurface surface, const EGLint *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNLOCKSURFACEKHRPROC) (EGLDisplay dpy, EGLSurface surface); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglLockSurfaceKHR (EGLDisplay dpy, EGLSurface surface, const EGLint *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglUnlockSurfaceKHR (EGLDisplay dpy, EGLSurface surface); +#endif +#endif /* EGL_KHR_lock_surface */ + +#ifndef EGL_KHR_lock_surface2 +#define EGL_KHR_lock_surface2 1 +#define EGL_BITMAP_PIXEL_SIZE_KHR 0x3110 +#endif /* EGL_KHR_lock_surface2 */ + +#ifndef EGL_KHR_lock_surface3 +#define EGL_KHR_lock_surface3 1 +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACE64KHRPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLAttribKHR *value); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface64KHR (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLAttribKHR *value); +#endif +#endif /* EGL_KHR_lock_surface3 */ + +#ifndef EGL_KHR_partial_update +#define EGL_KHR_partial_update 1 +#define EGL_BUFFER_AGE_KHR 0x313D +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSETDAMAGEREGIONKHRPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglSetDamageRegionKHR (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects); +#endif +#endif /* EGL_KHR_partial_update */ + +#ifndef EGL_KHR_platform_android +#define EGL_KHR_platform_android 1 +#define EGL_PLATFORM_ANDROID_KHR 0x3141 +#endif /* EGL_KHR_platform_android */ + +#ifndef EGL_KHR_platform_gbm +#define EGL_KHR_platform_gbm 1 +#define EGL_PLATFORM_GBM_KHR 0x31D7 +#endif /* EGL_KHR_platform_gbm */ + +#ifndef EGL_KHR_platform_wayland +#define EGL_KHR_platform_wayland 1 +#define EGL_PLATFORM_WAYLAND_KHR 0x31D8 +#endif /* EGL_KHR_platform_wayland */ + +#ifndef EGL_KHR_platform_x11 +#define EGL_KHR_platform_x11 1 +#define EGL_PLATFORM_X11_KHR 0x31D5 +#define EGL_PLATFORM_X11_SCREEN_KHR 0x31D6 +#endif /* EGL_KHR_platform_x11 */ + +#ifndef EGL_KHR_reusable_sync +#define EGL_KHR_reusable_sync 1 +#ifdef KHRONOS_SUPPORT_INT64 +#define EGL_SYNC_STATUS_KHR 0x30F1 +#define EGL_SIGNALED_KHR 0x30F2 +#define EGL_UNSIGNALED_KHR 0x30F3 +#define EGL_TIMEOUT_EXPIRED_KHR 0x30F5 +#define EGL_CONDITION_SATISFIED_KHR 0x30F6 +#define EGL_SYNC_TYPE_KHR 0x30F7 +#define EGL_SYNC_REUSABLE_KHR 0x30FA +#define EGL_SYNC_FLUSH_COMMANDS_BIT_KHR 0x0001 +#define EGL_FOREVER_KHR 0xFFFFFFFFFFFFFFFFull +#define EGL_NO_SYNC_KHR ((EGLSyncKHR)0) +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode); +#endif +#endif /* KHRONOS_SUPPORT_INT64 */ +#endif /* EGL_KHR_reusable_sync */ + +#ifndef EGL_KHR_stream +#define EGL_KHR_stream 1 +typedef void *EGLStreamKHR; +typedef khronos_uint64_t EGLuint64KHR; +#ifdef KHRONOS_SUPPORT_INT64 +#define EGL_NO_STREAM_KHR ((EGLStreamKHR)0) +#define EGL_CONSUMER_LATENCY_USEC_KHR 0x3210 +#define EGL_PRODUCER_FRAME_KHR 0x3212 +#define EGL_CONSUMER_FRAME_KHR 0x3213 +#define EGL_STREAM_STATE_KHR 0x3214 +#define EGL_STREAM_STATE_CREATED_KHR 0x3215 +#define EGL_STREAM_STATE_CONNECTING_KHR 0x3216 +#define EGL_STREAM_STATE_EMPTY_KHR 0x3217 +#define EGL_STREAM_STATE_NEW_FRAME_AVAILABLE_KHR 0x3218 +#define EGL_STREAM_STATE_OLD_FRAME_AVAILABLE_KHR 0x3219 +#define EGL_STREAM_STATE_DISCONNECTED_KHR 0x321A +#define EGL_BAD_STREAM_KHR 0x321B +#define EGL_BAD_STATE_KHR 0x321C +typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMKHRPROC) (EGLDisplay dpy, const EGLint *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSTREAMKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMU64KHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamKHR (EGLDisplay dpy, const EGLint *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglDestroyStreamKHR (EGLDisplay dpy, EGLStreamKHR stream); +EGLAPI EGLBoolean EGLAPIENTRY eglStreamAttribKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamu64KHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value); +#endif +#endif /* KHRONOS_SUPPORT_INT64 */ +#endif /* EGL_KHR_stream */ + +#ifndef EGL_KHR_stream_consumer_gltexture +#define EGL_KHR_stream_consumer_gltexture 1 +#ifdef EGL_KHR_stream +#define EGL_CONSUMER_ACQUIRE_TIMEOUT_USEC_KHR 0x321E +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERACQUIREKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerGLTextureExternalKHR (EGLDisplay dpy, EGLStreamKHR stream); +EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerAcquireKHR (EGLDisplay dpy, EGLStreamKHR stream); +EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerReleaseKHR (EGLDisplay dpy, EGLStreamKHR stream); +#endif +#endif /* EGL_KHR_stream */ +#endif /* EGL_KHR_stream_consumer_gltexture */ + +#ifndef EGL_KHR_stream_cross_process_fd +#define EGL_KHR_stream_cross_process_fd 1 +typedef int EGLNativeFileDescriptorKHR; +#ifdef EGL_KHR_stream +#define EGL_NO_FILE_DESCRIPTOR_KHR ((EGLNativeFileDescriptorKHR)(-1)) +typedef EGLNativeFileDescriptorKHR (EGLAPIENTRYP PFNEGLGETSTREAMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream); +typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMFROMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLNativeFileDescriptorKHR EGLAPIENTRY eglGetStreamFileDescriptorKHR (EGLDisplay dpy, EGLStreamKHR stream); +EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamFromFileDescriptorKHR (EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor); +#endif +#endif /* EGL_KHR_stream */ +#endif /* EGL_KHR_stream_cross_process_fd */ + +#ifndef EGL_KHR_stream_fifo +#define EGL_KHR_stream_fifo 1 +#ifdef EGL_KHR_stream +#define EGL_STREAM_FIFO_LENGTH_KHR 0x31FC +#define EGL_STREAM_TIME_NOW_KHR 0x31FD +#define EGL_STREAM_TIME_CONSUMER_KHR 0x31FE +#define EGL_STREAM_TIME_PRODUCER_KHR 0x31FF +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMTIMEKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamTimeKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value); +#endif +#endif /* EGL_KHR_stream */ +#endif /* EGL_KHR_stream_fifo */ + +#ifndef EGL_KHR_stream_producer_aldatalocator +#define EGL_KHR_stream_producer_aldatalocator 1 +#ifdef EGL_KHR_stream +#endif /* EGL_KHR_stream */ +#endif /* EGL_KHR_stream_producer_aldatalocator */ + +#ifndef EGL_KHR_stream_producer_eglsurface +#define EGL_KHR_stream_producer_eglsurface 1 +#ifdef EGL_KHR_stream +#define EGL_STREAM_BIT_KHR 0x0800 +typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC) (EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLSurface EGLAPIENTRY eglCreateStreamProducerSurfaceKHR (EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list); +#endif +#endif /* EGL_KHR_stream */ +#endif /* EGL_KHR_stream_producer_eglsurface */ + +#ifndef EGL_KHR_surfaceless_context +#define EGL_KHR_surfaceless_context 1 +#endif /* EGL_KHR_surfaceless_context */ + +#ifndef EGL_KHR_swap_buffers_with_damage +#define EGL_KHR_swap_buffers_with_damage 1 +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHDAMAGEKHRPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersWithDamageKHR (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects); +#endif +#endif /* EGL_KHR_swap_buffers_with_damage */ + +#ifndef EGL_KHR_vg_parent_image +#define EGL_KHR_vg_parent_image 1 +#define EGL_VG_PARENT_IMAGE_KHR 0x30BA +#endif /* EGL_KHR_vg_parent_image */ + +#ifndef EGL_KHR_wait_sync +#define EGL_KHR_wait_sync 1 +typedef EGLint (EGLAPIENTRYP PFNEGLWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLint EGLAPIENTRY eglWaitSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags); +#endif +#endif /* EGL_KHR_wait_sync */ + +#ifndef EGL_ANDROID_blob_cache +#define EGL_ANDROID_blob_cache 1 +typedef khronos_ssize_t EGLsizeiANDROID; +typedef void (*EGLSetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, const void *value, EGLsizeiANDROID valueSize); +typedef EGLsizeiANDROID (*EGLGetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, void *value, EGLsizeiANDROID valueSize); +typedef void (EGLAPIENTRYP PFNEGLSETBLOBCACHEFUNCSANDROIDPROC) (EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI void EGLAPIENTRY eglSetBlobCacheFuncsANDROID (EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get); +#endif +#endif /* EGL_ANDROID_blob_cache */ + +#ifndef EGL_ANDROID_framebuffer_target +#define EGL_ANDROID_framebuffer_target 1 +#define EGL_FRAMEBUFFER_TARGET_ANDROID 0x3147 +#endif /* EGL_ANDROID_framebuffer_target */ + +#ifndef EGL_ANDROID_image_native_buffer +#define EGL_ANDROID_image_native_buffer 1 +#define EGL_NATIVE_BUFFER_ANDROID 0x3140 +#endif /* EGL_ANDROID_image_native_buffer */ + +#ifndef EGL_ANDROID_native_fence_sync +#define EGL_ANDROID_native_fence_sync 1 +#define EGL_SYNC_NATIVE_FENCE_ANDROID 0x3144 +#define EGL_SYNC_NATIVE_FENCE_FD_ANDROID 0x3145 +#define EGL_SYNC_NATIVE_FENCE_SIGNALED_ANDROID 0x3146 +#define EGL_NO_NATIVE_FENCE_FD_ANDROID -1 +typedef EGLint (EGLAPIENTRYP PFNEGLDUPNATIVEFENCEFDANDROIDPROC) (EGLDisplay dpy, EGLSyncKHR sync); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLint EGLAPIENTRY eglDupNativeFenceFDANDROID (EGLDisplay dpy, EGLSyncKHR sync); +#endif +#endif /* EGL_ANDROID_native_fence_sync */ + +#ifndef EGL_ANDROID_recordable +#define EGL_ANDROID_recordable 1 +#define EGL_RECORDABLE_ANDROID 0x3142 +#endif /* EGL_ANDROID_recordable */ + +#ifndef EGL_ANGLE_d3d_share_handle_client_buffer +#define EGL_ANGLE_d3d_share_handle_client_buffer 1 +#define EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE 0x3200 +#endif /* EGL_ANGLE_d3d_share_handle_client_buffer */ + +#ifndef EGL_ANGLE_device_d3d +#define EGL_ANGLE_device_d3d 1 +#define EGL_D3D9_DEVICE_ANGLE 0x33A0 +#define EGL_D3D11_DEVICE_ANGLE 0x33A1 +#endif /* EGL_ANGLE_device_d3d */ + +#ifndef EGL_ANGLE_query_surface_pointer +#define EGL_ANGLE_query_surface_pointer 1 +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACEPOINTERANGLEPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurfacePointerANGLE (EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value); +#endif +#endif /* EGL_ANGLE_query_surface_pointer */ + +#ifndef EGL_ANGLE_surface_d3d_texture_2d_share_handle +#define EGL_ANGLE_surface_d3d_texture_2d_share_handle 1 +#endif /* EGL_ANGLE_surface_d3d_texture_2d_share_handle */ + +#ifndef EGL_ANGLE_window_fixed_size +#define EGL_ANGLE_window_fixed_size 1 +#define EGL_FIXED_SIZE_ANGLE 0x3201 +#endif /* EGL_ANGLE_window_fixed_size */ + +#ifndef EGL_ARM_pixmap_multisample_discard +#define EGL_ARM_pixmap_multisample_discard 1 +#define EGL_DISCARD_SAMPLES_ARM 0x3286 +#endif /* EGL_ARM_pixmap_multisample_discard */ + +#ifndef EGL_EXT_buffer_age +#define EGL_EXT_buffer_age 1 +#define EGL_BUFFER_AGE_EXT 0x313D +#endif /* EGL_EXT_buffer_age */ + +#ifndef EGL_EXT_client_extensions +#define EGL_EXT_client_extensions 1 +#endif /* EGL_EXT_client_extensions */ + +#ifndef EGL_EXT_create_context_robustness +#define EGL_EXT_create_context_robustness 1 +#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT 0x30BF +#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT 0x3138 +#define EGL_NO_RESET_NOTIFICATION_EXT 0x31BE +#define EGL_LOSE_CONTEXT_ON_RESET_EXT 0x31BF +#endif /* EGL_EXT_create_context_robustness */ + +#ifndef EGL_EXT_device_base +#define EGL_EXT_device_base 1 +typedef void *EGLDeviceEXT; +#define EGL_NO_DEVICE_EXT ((EGLDeviceEXT)(0)) +#define EGL_BAD_DEVICE_EXT 0x322B +#define EGL_DEVICE_EXT 0x322C +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDEVICEATTRIBEXTPROC) (EGLDeviceEXT device, EGLint attribute, EGLAttrib *value); +typedef const char *(EGLAPIENTRYP PFNEGLQUERYDEVICESTRINGEXTPROC) (EGLDeviceEXT device, EGLint name); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDEVICESEXTPROC) (EGLint max_devices, EGLDeviceEXT *devices, EGLint *num_devices); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDISPLAYATTRIBEXTPROC) (EGLDisplay dpy, EGLint attribute, EGLAttrib *value); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglQueryDeviceAttribEXT (EGLDeviceEXT device, EGLint attribute, EGLAttrib *value); +EGLAPI const char *EGLAPIENTRY eglQueryDeviceStringEXT (EGLDeviceEXT device, EGLint name); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryDevicesEXT (EGLint max_devices, EGLDeviceEXT *devices, EGLint *num_devices); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryDisplayAttribEXT (EGLDisplay dpy, EGLint attribute, EGLAttrib *value); +#endif +#endif /* EGL_EXT_device_base */ + +#ifndef EGL_EXT_device_drm +#define EGL_EXT_device_drm 1 +#define EGL_DRM_DEVICE_FILE_EXT 0x3233 +#endif /* EGL_EXT_device_drm */ + +#ifndef EGL_EXT_device_enumeration +#define EGL_EXT_device_enumeration 1 +#endif /* EGL_EXT_device_enumeration */ + +#ifndef EGL_EXT_device_openwf +#define EGL_EXT_device_openwf 1 +#define EGL_OPENWF_DEVICE_ID_EXT 0x3237 +#endif /* EGL_EXT_device_openwf */ + +#ifndef EGL_EXT_device_query +#define EGL_EXT_device_query 1 +#endif /* EGL_EXT_device_query */ + +#ifndef EGL_EXT_image_dma_buf_import +#define EGL_EXT_image_dma_buf_import 1 +#define EGL_LINUX_DMA_BUF_EXT 0x3270 +#define EGL_LINUX_DRM_FOURCC_EXT 0x3271 +#define EGL_DMA_BUF_PLANE0_FD_EXT 0x3272 +#define EGL_DMA_BUF_PLANE0_OFFSET_EXT 0x3273 +#define EGL_DMA_BUF_PLANE0_PITCH_EXT 0x3274 +#define EGL_DMA_BUF_PLANE1_FD_EXT 0x3275 +#define EGL_DMA_BUF_PLANE1_OFFSET_EXT 0x3276 +#define EGL_DMA_BUF_PLANE1_PITCH_EXT 0x3277 +#define EGL_DMA_BUF_PLANE2_FD_EXT 0x3278 +#define EGL_DMA_BUF_PLANE2_OFFSET_EXT 0x3279 +#define EGL_DMA_BUF_PLANE2_PITCH_EXT 0x327A +#define EGL_YUV_COLOR_SPACE_HINT_EXT 0x327B +#define EGL_SAMPLE_RANGE_HINT_EXT 0x327C +#define EGL_YUV_CHROMA_HORIZONTAL_SITING_HINT_EXT 0x327D +#define EGL_YUV_CHROMA_VERTICAL_SITING_HINT_EXT 0x327E +#define EGL_ITU_REC601_EXT 0x327F +#define EGL_ITU_REC709_EXT 0x3280 +#define EGL_ITU_REC2020_EXT 0x3281 +#define EGL_YUV_FULL_RANGE_EXT 0x3282 +#define EGL_YUV_NARROW_RANGE_EXT 0x3283 +#define EGL_YUV_CHROMA_SITING_0_EXT 0x3284 +#define EGL_YUV_CHROMA_SITING_0_5_EXT 0x3285 +#endif /* EGL_EXT_image_dma_buf_import */ + +#ifndef EGL_EXT_multiview_window +#define EGL_EXT_multiview_window 1 +#define EGL_MULTIVIEW_VIEW_COUNT_EXT 0x3134 +#endif /* EGL_EXT_multiview_window */ + +#ifndef EGL_EXT_output_base +#define EGL_EXT_output_base 1 +typedef void *EGLOutputLayerEXT; +typedef void *EGLOutputPortEXT; +#define EGL_NO_OUTPUT_LAYER_EXT ((EGLOutputLayerEXT)0) +#define EGL_NO_OUTPUT_PORT_EXT ((EGLOutputPortEXT)0) +#define EGL_BAD_OUTPUT_LAYER_EXT 0x322D +#define EGL_BAD_OUTPUT_PORT_EXT 0x322E +#define EGL_SWAP_INTERVAL_EXT 0x322F +typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETOUTPUTLAYERSEXTPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputLayerEXT *layers, EGLint max_layers, EGLint *num_layers); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETOUTPUTPORTSEXTPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputPortEXT *ports, EGLint max_ports, EGLint *num_ports); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLOUTPUTLAYERATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib value); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYOUTPUTLAYERATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib *value); +typedef const char *(EGLAPIENTRYP PFNEGLQUERYOUTPUTLAYERSTRINGEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint name); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLOUTPUTPORTATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib value); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYOUTPUTPORTATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib *value); +typedef const char *(EGLAPIENTRYP PFNEGLQUERYOUTPUTPORTSTRINGEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint name); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglGetOutputLayersEXT (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputLayerEXT *layers, EGLint max_layers, EGLint *num_layers); +EGLAPI EGLBoolean EGLAPIENTRY eglGetOutputPortsEXT (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputPortEXT *ports, EGLint max_ports, EGLint *num_ports); +EGLAPI EGLBoolean EGLAPIENTRY eglOutputLayerAttribEXT (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib value); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryOutputLayerAttribEXT (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib *value); +EGLAPI const char *EGLAPIENTRY eglQueryOutputLayerStringEXT (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint name); +EGLAPI EGLBoolean EGLAPIENTRY eglOutputPortAttribEXT (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib value); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryOutputPortAttribEXT (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib *value); +EGLAPI const char *EGLAPIENTRY eglQueryOutputPortStringEXT (EGLDisplay dpy, EGLOutputPortEXT port, EGLint name); +#endif +#endif /* EGL_EXT_output_base */ + +#ifndef EGL_EXT_output_drm +#define EGL_EXT_output_drm 1 +#define EGL_DRM_CRTC_EXT 0x3234 +#define EGL_DRM_PLANE_EXT 0x3235 +#define EGL_DRM_CONNECTOR_EXT 0x3236 +#endif /* EGL_EXT_output_drm */ + +#ifndef EGL_EXT_output_openwf +#define EGL_EXT_output_openwf 1 +#define EGL_OPENWF_PIPELINE_ID_EXT 0x3238 +#define EGL_OPENWF_PORT_ID_EXT 0x3239 +#endif /* EGL_EXT_output_openwf */ + +#ifndef EGL_EXT_platform_base +#define EGL_EXT_platform_base 1 +typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETPLATFORMDISPLAYEXTPROC) (EGLenum platform, void *native_display, const EGLint *attrib_list); +typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC) (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list); +typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMPIXMAPSURFACEEXTPROC) (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLint *attrib_list); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLDisplay EGLAPIENTRY eglGetPlatformDisplayEXT (EGLenum platform, void *native_display, const EGLint *attrib_list); +EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformWindowSurfaceEXT (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list); +EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurfaceEXT (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLint *attrib_list); +#endif +#endif /* EGL_EXT_platform_base */ + +#ifndef EGL_EXT_platform_device +#define EGL_EXT_platform_device 1 +#define EGL_PLATFORM_DEVICE_EXT 0x313F +#endif /* EGL_EXT_platform_device */ + +#ifndef EGL_EXT_platform_wayland +#define EGL_EXT_platform_wayland 1 +#define EGL_PLATFORM_WAYLAND_EXT 0x31D8 +#endif /* EGL_EXT_platform_wayland */ + +#ifndef EGL_EXT_platform_x11 +#define EGL_EXT_platform_x11 1 +#define EGL_PLATFORM_X11_EXT 0x31D5 +#define EGL_PLATFORM_X11_SCREEN_EXT 0x31D6 +#endif /* EGL_EXT_platform_x11 */ + +#ifndef EGL_EXT_protected_surface +#define EGL_EXT_protected_surface 1 +#define EGL_PROTECTED_CONTENT_EXT 0x32C0 +#endif /* EGL_EXT_protected_surface */ + +#ifndef EGL_EXT_stream_consumer_egloutput +#define EGL_EXT_stream_consumer_egloutput 1 +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMEROUTPUTEXTPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLOutputLayerEXT layer); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerOutputEXT (EGLDisplay dpy, EGLStreamKHR stream, EGLOutputLayerEXT layer); +#endif +#endif /* EGL_EXT_stream_consumer_egloutput */ + +#ifndef EGL_EXT_swap_buffers_with_damage +#define EGL_EXT_swap_buffers_with_damage 1 +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersWithDamageEXT (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects); +#endif +#endif /* EGL_EXT_swap_buffers_with_damage */ + +#ifndef EGL_EXT_yuv_surface +#define EGL_EXT_yuv_surface 1 +#define EGL_YUV_ORDER_EXT 0x3301 +#define EGL_YUV_NUMBER_OF_PLANES_EXT 0x3311 +#define EGL_YUV_SUBSAMPLE_EXT 0x3312 +#define EGL_YUV_DEPTH_RANGE_EXT 0x3317 +#define EGL_YUV_CSC_STANDARD_EXT 0x330A +#define EGL_YUV_PLANE_BPP_EXT 0x331A +#define EGL_YUV_BUFFER_EXT 0x3300 +#define EGL_YUV_ORDER_YUV_EXT 0x3302 +#define EGL_YUV_ORDER_YVU_EXT 0x3303 +#define EGL_YUV_ORDER_YUYV_EXT 0x3304 +#define EGL_YUV_ORDER_UYVY_EXT 0x3305 +#define EGL_YUV_ORDER_YVYU_EXT 0x3306 +#define EGL_YUV_ORDER_VYUY_EXT 0x3307 +#define EGL_YUV_ORDER_AYUV_EXT 0x3308 +#define EGL_YUV_SUBSAMPLE_4_2_0_EXT 0x3313 +#define EGL_YUV_SUBSAMPLE_4_2_2_EXT 0x3314 +#define EGL_YUV_SUBSAMPLE_4_4_4_EXT 0x3315 +#define EGL_YUV_DEPTH_RANGE_LIMITED_EXT 0x3318 +#define EGL_YUV_DEPTH_RANGE_FULL_EXT 0x3319 +#define EGL_YUV_CSC_STANDARD_601_EXT 0x330B +#define EGL_YUV_CSC_STANDARD_709_EXT 0x330C +#define EGL_YUV_CSC_STANDARD_2020_EXT 0x330D +#define EGL_YUV_PLANE_BPP_0_EXT 0x331B +#define EGL_YUV_PLANE_BPP_8_EXT 0x331C +#define EGL_YUV_PLANE_BPP_10_EXT 0x331D +#endif /* EGL_EXT_yuv_surface */ + +#ifndef EGL_HI_clientpixmap +#define EGL_HI_clientpixmap 1 +struct EGLClientPixmapHI { + void *pData; + EGLint iWidth; + EGLint iHeight; + EGLint iStride; +}; +#define EGL_CLIENT_PIXMAP_POINTER_HI 0x8F74 +typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPIXMAPSURFACEHIPROC) (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI *pixmap); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurfaceHI (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI *pixmap); +#endif +#endif /* EGL_HI_clientpixmap */ + +#ifndef EGL_HI_colorformats +#define EGL_HI_colorformats 1 +#define EGL_COLOR_FORMAT_HI 0x8F70 +#define EGL_COLOR_RGB_HI 0x8F71 +#define EGL_COLOR_RGBA_HI 0x8F72 +#define EGL_COLOR_ARGB_HI 0x8F73 +#endif /* EGL_HI_colorformats */ + +#ifndef EGL_IMG_context_priority +#define EGL_IMG_context_priority 1 +#define EGL_CONTEXT_PRIORITY_LEVEL_IMG 0x3100 +#define EGL_CONTEXT_PRIORITY_HIGH_IMG 0x3101 +#define EGL_CONTEXT_PRIORITY_MEDIUM_IMG 0x3102 +#define EGL_CONTEXT_PRIORITY_LOW_IMG 0x3103 +#endif /* EGL_IMG_context_priority */ + +#ifndef EGL_MESA_drm_image +#define EGL_MESA_drm_image 1 +#define EGL_DRM_BUFFER_FORMAT_MESA 0x31D0 +#define EGL_DRM_BUFFER_USE_MESA 0x31D1 +#define EGL_DRM_BUFFER_FORMAT_ARGB32_MESA 0x31D2 +#define EGL_DRM_BUFFER_MESA 0x31D3 +#define EGL_DRM_BUFFER_STRIDE_MESA 0x31D4 +#define EGL_DRM_BUFFER_USE_SCANOUT_MESA 0x00000001 +#define EGL_DRM_BUFFER_USE_SHARE_MESA 0x00000002 +typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEDRMIMAGEMESAPROC) (EGLDisplay dpy, const EGLint *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDRMIMAGEMESAPROC) (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLImageKHR EGLAPIENTRY eglCreateDRMImageMESA (EGLDisplay dpy, const EGLint *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglExportDRMImageMESA (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride); +#endif +#endif /* EGL_MESA_drm_image */ + +#ifndef EGL_MESA_image_dma_buf_export +#define EGL_MESA_image_dma_buf_export 1 +typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDMABUFIMAGEQUERYMESAPROC) (EGLDisplay dpy, EGLImageKHR image, int *fourcc, int *num_planes, EGLuint64KHR *modifiers); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDMABUFIMAGEMESAPROC) (EGLDisplay dpy, EGLImageKHR image, int *fds, EGLint *strides, EGLint *offsets); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglExportDMABUFImageQueryMESA (EGLDisplay dpy, EGLImageKHR image, int *fourcc, int *num_planes, EGLuint64KHR *modifiers); +EGLAPI EGLBoolean EGLAPIENTRY eglExportDMABUFImageMESA (EGLDisplay dpy, EGLImageKHR image, int *fds, EGLint *strides, EGLint *offsets); +#endif +#endif /* EGL_MESA_image_dma_buf_export */ + +#ifndef EGL_MESA_platform_gbm +#define EGL_MESA_platform_gbm 1 +#define EGL_PLATFORM_GBM_MESA 0x31D7 +#endif /* EGL_MESA_platform_gbm */ + +#ifndef EGL_NOK_swap_region +#define EGL_NOK_swap_region 1 +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSREGIONNOKPROC) (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersRegionNOK (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects); +#endif +#endif /* EGL_NOK_swap_region */ + +#ifndef EGL_NOK_swap_region2 +#define EGL_NOK_swap_region2 1 +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSREGION2NOKPROC) (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersRegion2NOK (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects); +#endif +#endif /* EGL_NOK_swap_region2 */ + +#ifndef EGL_NOK_texture_from_pixmap +#define EGL_NOK_texture_from_pixmap 1 +#define EGL_Y_INVERTED_NOK 0x307F +#endif /* EGL_NOK_texture_from_pixmap */ + +#ifndef EGL_NV_3dvision_surface +#define EGL_NV_3dvision_surface 1 +#define EGL_AUTO_STEREO_NV 0x3136 +#endif /* EGL_NV_3dvision_surface */ + +#ifndef EGL_NV_coverage_sample +#define EGL_NV_coverage_sample 1 +#define EGL_COVERAGE_BUFFERS_NV 0x30E0 +#define EGL_COVERAGE_SAMPLES_NV 0x30E1 +#endif /* EGL_NV_coverage_sample */ + +#ifndef EGL_NV_coverage_sample_resolve +#define EGL_NV_coverage_sample_resolve 1 +#define EGL_COVERAGE_SAMPLE_RESOLVE_NV 0x3131 +#define EGL_COVERAGE_SAMPLE_RESOLVE_DEFAULT_NV 0x3132 +#define EGL_COVERAGE_SAMPLE_RESOLVE_NONE_NV 0x3133 +#endif /* EGL_NV_coverage_sample_resolve */ + +#ifndef EGL_NV_cuda_event +#define EGL_NV_cuda_event 1 +#define EGL_CUDA_EVENT_HANDLE_NV 0x323B +#define EGL_SYNC_CUDA_EVENT_NV 0x323C +#define EGL_SYNC_CUDA_EVENT_COMPLETE_NV 0x323D +#endif /* EGL_NV_cuda_event */ + +#ifndef EGL_NV_depth_nonlinear +#define EGL_NV_depth_nonlinear 1 +#define EGL_DEPTH_ENCODING_NV 0x30E2 +#define EGL_DEPTH_ENCODING_NONE_NV 0 +#define EGL_DEPTH_ENCODING_NONLINEAR_NV 0x30E3 +#endif /* EGL_NV_depth_nonlinear */ + +#ifndef EGL_NV_device_cuda +#define EGL_NV_device_cuda 1 +#define EGL_CUDA_DEVICE_NV 0x323A +#endif /* EGL_NV_device_cuda */ + +#ifndef EGL_NV_native_query +#define EGL_NV_native_query 1 +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEDISPLAYNVPROC) (EGLDisplay dpy, EGLNativeDisplayType *display_id); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEWINDOWNVPROC) (EGLDisplay dpy, EGLSurface surf, EGLNativeWindowType *window); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEPIXMAPNVPROC) (EGLDisplay dpy, EGLSurface surf, EGLNativePixmapType *pixmap); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativeDisplayNV (EGLDisplay dpy, EGLNativeDisplayType *display_id); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativeWindowNV (EGLDisplay dpy, EGLSurface surf, EGLNativeWindowType *window); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativePixmapNV (EGLDisplay dpy, EGLSurface surf, EGLNativePixmapType *pixmap); +#endif +#endif /* EGL_NV_native_query */ + +#ifndef EGL_NV_post_convert_rounding +#define EGL_NV_post_convert_rounding 1 +#endif /* EGL_NV_post_convert_rounding */ + +#ifndef EGL_NV_post_sub_buffer +#define EGL_NV_post_sub_buffer 1 +#define EGL_POST_SUB_BUFFER_SUPPORTED_NV 0x30BE +typedef EGLBoolean (EGLAPIENTRYP PFNEGLPOSTSUBBUFFERNVPROC) (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglPostSubBufferNV (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height); +#endif +#endif /* EGL_NV_post_sub_buffer */ + +#ifndef EGL_NV_stream_sync +#define EGL_NV_stream_sync 1 +#define EGL_SYNC_NEW_FRAME_NV 0x321F +typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESTREAMSYNCNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum type, const EGLint *attrib_list); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateStreamSyncNV (EGLDisplay dpy, EGLStreamKHR stream, EGLenum type, const EGLint *attrib_list); +#endif +#endif /* EGL_NV_stream_sync */ + +#ifndef EGL_NV_sync +#define EGL_NV_sync 1 +typedef void *EGLSyncNV; +typedef khronos_utime_nanoseconds_t EGLTimeNV; +#ifdef KHRONOS_SUPPORT_INT64 +#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_NV 0x30E6 +#define EGL_SYNC_STATUS_NV 0x30E7 +#define EGL_SIGNALED_NV 0x30E8 +#define EGL_UNSIGNALED_NV 0x30E9 +#define EGL_SYNC_FLUSH_COMMANDS_BIT_NV 0x0001 +#define EGL_FOREVER_NV 0xFFFFFFFFFFFFFFFFull +#define EGL_ALREADY_SIGNALED_NV 0x30EA +#define EGL_TIMEOUT_EXPIRED_NV 0x30EB +#define EGL_CONDITION_SATISFIED_NV 0x30EC +#define EGL_SYNC_TYPE_NV 0x30ED +#define EGL_SYNC_CONDITION_NV 0x30EE +#define EGL_SYNC_FENCE_NV 0x30EF +#define EGL_NO_SYNC_NV ((EGLSyncNV)0) +typedef EGLSyncNV (EGLAPIENTRYP PFNEGLCREATEFENCESYNCNVPROC) (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCNVPROC) (EGLSyncNV sync); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLFENCENVPROC) (EGLSyncNV sync); +typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCNVPROC) (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCNVPROC) (EGLSyncNV sync, EGLenum mode); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBNVPROC) (EGLSyncNV sync, EGLint attribute, EGLint *value); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLSyncNV EGLAPIENTRY eglCreateFenceSyncNV (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncNV (EGLSyncNV sync); +EGLAPI EGLBoolean EGLAPIENTRY eglFenceNV (EGLSyncNV sync); +EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncNV (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout); +EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncNV (EGLSyncNV sync, EGLenum mode); +EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribNV (EGLSyncNV sync, EGLint attribute, EGLint *value); +#endif +#endif /* KHRONOS_SUPPORT_INT64 */ +#endif /* EGL_NV_sync */ + +#ifndef EGL_NV_system_time +#define EGL_NV_system_time 1 +typedef khronos_utime_nanoseconds_t EGLuint64NV; +#ifdef KHRONOS_SUPPORT_INT64 +typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMEFREQUENCYNVPROC) (void); +typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMENVPROC) (void); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeFrequencyNV (void); +EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeNV (void); +#endif +#endif /* KHRONOS_SUPPORT_INT64 */ +#endif /* EGL_NV_system_time */ + +#ifndef EGL_TIZEN_image_native_buffer +#define EGL_TIZEN_image_native_buffer 1 +#define EGL_NATIVE_BUFFER_TIZEN 0x32A0 +#endif /* EGL_TIZEN_image_native_buffer */ + +#ifndef EGL_TIZEN_image_native_surface +#define EGL_TIZEN_image_native_surface 1 +#define EGL_NATIVE_SURFACE_TIZEN 0x32A1 +#endif /* EGL_TIZEN_image_native_surface */ + +#ifdef __cplusplus +} +#endif + +#endif /* __eglext_h_ */ + + +#endif /* _MSC_VER */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_endian.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_endian.h new file mode 100644 index 0000000..171c008 --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_endian.h @@ -0,0 +1,263 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_endian.h + * + * Functions for reading and writing endian-specific values + */ + +#ifndef SDL_endian_h_ +#define SDL_endian_h_ + +#include "SDL_stdinc.h" + +/** + * \name The two types of endianness + */ +/* @{ */ +#define SDL_LIL_ENDIAN 1234 +#define SDL_BIG_ENDIAN 4321 +/* @} */ + +#ifndef SDL_BYTEORDER /* Not defined in SDL_config.h? */ +#ifdef __linux__ +#include +#define SDL_BYTEORDER __BYTE_ORDER +#elif defined(__OpenBSD__) +#include +#define SDL_BYTEORDER BYTE_ORDER +#else +#if defined(__hppa__) || \ + defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \ + (defined(__MIPS__) && defined(__MIPSEB__)) || \ + defined(__ppc__) || defined(__POWERPC__) || defined(_M_PPC) || \ + defined(__sparc__) +#define SDL_BYTEORDER SDL_BIG_ENDIAN +#else +#define SDL_BYTEORDER SDL_LIL_ENDIAN +#endif +#endif /* __linux__ */ +#endif /* !SDL_BYTEORDER */ + + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \file SDL_endian.h + */ +#if defined(__GNUC__) && defined(__i386__) && \ + !(__GNUC__ == 2 && __GNUC_MINOR__ == 95 /* broken gcc version */) +SDL_FORCE_INLINE Uint16 +SDL_Swap16(Uint16 x) +{ + __asm__("xchgb %b0,%h0": "=q"(x):"0"(x)); + return x; +} +#elif defined(__GNUC__) && defined(__x86_64__) +SDL_FORCE_INLINE Uint16 +SDL_Swap16(Uint16 x) +{ + __asm__("xchgb %b0,%h0": "=Q"(x):"0"(x)); + return x; +} +#elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__)) +SDL_FORCE_INLINE Uint16 +SDL_Swap16(Uint16 x) +{ + int result; + + __asm__("rlwimi %0,%2,8,16,23": "=&r"(result):"0"(x >> 8), "r"(x)); + return (Uint16)result; +} +#elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__)) && !defined(__mcoldfire__) +SDL_FORCE_INLINE Uint16 +SDL_Swap16(Uint16 x) +{ + __asm__("rorw #8,%0": "=d"(x): "0"(x):"cc"); + return x; +} +#elif defined(__WATCOMC__) && defined(__386__) +extern _inline Uint16 SDL_Swap16(Uint16); +#pragma aux SDL_Swap16 = \ + "xchg al, ah" \ + parm [ax] \ + modify [ax]; +#else +SDL_FORCE_INLINE Uint16 +SDL_Swap16(Uint16 x) +{ + return SDL_static_cast(Uint16, ((x << 8) | (x >> 8))); +} +#endif + +#if defined(__GNUC__) && defined(__i386__) +SDL_FORCE_INLINE Uint32 +SDL_Swap32(Uint32 x) +{ + __asm__("bswap %0": "=r"(x):"0"(x)); + return x; +} +#elif defined(__GNUC__) && defined(__x86_64__) +SDL_FORCE_INLINE Uint32 +SDL_Swap32(Uint32 x) +{ + __asm__("bswapl %0": "=r"(x):"0"(x)); + return x; +} +#elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__)) +SDL_FORCE_INLINE Uint32 +SDL_Swap32(Uint32 x) +{ + Uint32 result; + + __asm__("rlwimi %0,%2,24,16,23": "=&r"(result):"0"(x >> 24), "r"(x)); + __asm__("rlwimi %0,%2,8,8,15": "=&r"(result):"0"(result), "r"(x)); + __asm__("rlwimi %0,%2,24,0,7": "=&r"(result):"0"(result), "r"(x)); + return result; +} +#elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__)) && !defined(__mcoldfire__) +SDL_FORCE_INLINE Uint32 +SDL_Swap32(Uint32 x) +{ + __asm__("rorw #8,%0\n\tswap %0\n\trorw #8,%0": "=d"(x): "0"(x):"cc"); + return x; +} +#elif defined(__WATCOMC__) && defined(__386__) +extern _inline Uint32 SDL_Swap32(Uint32); +#ifndef __SW_3 /* 486+ */ +#pragma aux SDL_Swap32 = \ + "bswap eax" \ + parm [eax] \ + modify [eax]; +#else /* 386-only */ +#pragma aux SDL_Swap32 = \ + "xchg al, ah" \ + "ror eax, 16" \ + "xchg al, ah" \ + parm [eax] \ + modify [eax]; +#endif +#else +SDL_FORCE_INLINE Uint32 +SDL_Swap32(Uint32 x) +{ + return SDL_static_cast(Uint32, ((x << 24) | ((x << 8) & 0x00FF0000) | + ((x >> 8) & 0x0000FF00) | (x >> 24))); +} +#endif + +#if defined(__GNUC__) && defined(__i386__) +SDL_FORCE_INLINE Uint64 +SDL_Swap64(Uint64 x) +{ + union + { + struct + { + Uint32 a, b; + } s; + Uint64 u; + } v; + v.u = x; + __asm__("bswapl %0 ; bswapl %1 ; xchgl %0,%1": "=r"(v.s.a), "=r"(v.s.b):"0"(v.s.a), + "1"(v.s. + b)); + return v.u; +} +#elif defined(__GNUC__) && defined(__x86_64__) +SDL_FORCE_INLINE Uint64 +SDL_Swap64(Uint64 x) +{ + __asm__("bswapq %0": "=r"(x):"0"(x)); + return x; +} +#else +SDL_FORCE_INLINE Uint64 +SDL_Swap64(Uint64 x) +{ + Uint32 hi, lo; + + /* Separate into high and low 32-bit values and swap them */ + lo = SDL_static_cast(Uint32, x & 0xFFFFFFFF); + x >>= 32; + hi = SDL_static_cast(Uint32, x & 0xFFFFFFFF); + x = SDL_Swap32(lo); + x <<= 32; + x |= SDL_Swap32(hi); + return (x); +} +#endif + + +SDL_FORCE_INLINE float +SDL_SwapFloat(float x) +{ + union + { + float f; + Uint32 ui32; + } swapper; + swapper.f = x; + swapper.ui32 = SDL_Swap32(swapper.ui32); + return swapper.f; +} + + +/** + * \name Swap to native + * Byteswap item from the specified endianness to the native endianness. + */ +/* @{ */ +#if SDL_BYTEORDER == SDL_LIL_ENDIAN +#define SDL_SwapLE16(X) (X) +#define SDL_SwapLE32(X) (X) +#define SDL_SwapLE64(X) (X) +#define SDL_SwapFloatLE(X) (X) +#define SDL_SwapBE16(X) SDL_Swap16(X) +#define SDL_SwapBE32(X) SDL_Swap32(X) +#define SDL_SwapBE64(X) SDL_Swap64(X) +#define SDL_SwapFloatBE(X) SDL_SwapFloat(X) +#else +#define SDL_SwapLE16(X) SDL_Swap16(X) +#define SDL_SwapLE32(X) SDL_Swap32(X) +#define SDL_SwapLE64(X) SDL_Swap64(X) +#define SDL_SwapFloatLE(X) SDL_SwapFloat(X) +#define SDL_SwapBE16(X) (X) +#define SDL_SwapBE32(X) (X) +#define SDL_SwapBE64(X) (X) +#define SDL_SwapFloatBE(X) (X) +#endif +/* @} *//* Swap to native */ + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_endian_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_error.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_error.h new file mode 100644 index 0000000..962d62f --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_error.h @@ -0,0 +1,112 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_error.h + * + * Simple error message routines for SDL. + */ + +#ifndef SDL_error_h_ +#define SDL_error_h_ + +#include "SDL_stdinc.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* Public functions */ + + +/** + * \brief Set the error message for the current thread + * + * \return -1, there is no error handling for this function + */ +extern DECLSPEC int SDLCALL SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1); + +/** + * \brief Get the last error message that was set + * + * SDL API functions may set error messages and then succeed, so you should + * only use the error value if a function fails. + * + * This returns a pointer to a static buffer for convenience and should not + * be called by multiple threads simultaneously. + * + * \return a pointer to the last error message that was set + */ +extern DECLSPEC const char *SDLCALL SDL_GetError(void); + +/** + * \brief Get the last error message that was set for the current thread + * + * SDL API functions may set error messages and then succeed, so you should + * only use the error value if a function fails. + * + * \param errstr A buffer to fill with the last error message that was set + * for the current thread + * \param maxlen The size of the buffer pointed to by the errstr parameter + * + * \return errstr + */ +extern DECLSPEC char * SDLCALL SDL_GetErrorMsg(char *errstr, int maxlen); + +/** + * \brief Clear the error message for the current thread + */ +extern DECLSPEC void SDLCALL SDL_ClearError(void); + +/** + * \name Internal error functions + * + * \internal + * Private error reporting function - used internally. + */ +/* @{ */ +#define SDL_OutOfMemory() SDL_Error(SDL_ENOMEM) +#define SDL_Unsupported() SDL_Error(SDL_UNSUPPORTED) +#define SDL_InvalidParamError(param) SDL_SetError("Parameter '%s' is invalid", (param)) +typedef enum +{ + SDL_ENOMEM, + SDL_EFREAD, + SDL_EFWRITE, + SDL_EFSEEK, + SDL_UNSUPPORTED, + SDL_LASTERROR +} SDL_errorcode; +/* SDL_Error() unconditionally returns -1. */ +extern DECLSPEC int SDLCALL SDL_Error(SDL_errorcode code); +/* @} *//* Internal error functions */ + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_error_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_events.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_events.h new file mode 100644 index 0000000..ae560c0 --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_events.h @@ -0,0 +1,827 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_events.h + * + * Include file for SDL event handling. + */ + +#ifndef SDL_events_h_ +#define SDL_events_h_ + +#include "SDL_stdinc.h" +#include "SDL_error.h" +#include "SDL_video.h" +#include "SDL_keyboard.h" +#include "SDL_mouse.h" +#include "SDL_joystick.h" +#include "SDL_gamecontroller.h" +#include "SDL_quit.h" +#include "SDL_gesture.h" +#include "SDL_touch.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* General keyboard/mouse state definitions */ +#define SDL_RELEASED 0 +#define SDL_PRESSED 1 + +/** + * \brief The types of events that can be delivered. + */ +typedef enum +{ + SDL_FIRSTEVENT = 0, /**< Unused (do not remove) */ + + /* Application events */ + SDL_QUIT = 0x100, /**< User-requested quit */ + + /* These application events have special meaning on iOS, see README-ios.md for details */ + SDL_APP_TERMINATING, /**< The application is being terminated by the OS + Called on iOS in applicationWillTerminate() + Called on Android in onDestroy() + */ + SDL_APP_LOWMEMORY, /**< The application is low on memory, free memory if possible. + Called on iOS in applicationDidReceiveMemoryWarning() + Called on Android in onLowMemory() + */ + SDL_APP_WILLENTERBACKGROUND, /**< The application is about to enter the background + Called on iOS in applicationWillResignActive() + Called on Android in onPause() + */ + SDL_APP_DIDENTERBACKGROUND, /**< The application did enter the background and may not get CPU for some time + Called on iOS in applicationDidEnterBackground() + Called on Android in onPause() + */ + SDL_APP_WILLENTERFOREGROUND, /**< The application is about to enter the foreground + Called on iOS in applicationWillEnterForeground() + Called on Android in onResume() + */ + SDL_APP_DIDENTERFOREGROUND, /**< The application is now interactive + Called on iOS in applicationDidBecomeActive() + Called on Android in onResume() + */ + + SDL_LOCALECHANGED, /**< The user's locale preferences have changed. */ + + /* Display events */ + SDL_DISPLAYEVENT = 0x150, /**< Display state change */ + + /* Window events */ + SDL_WINDOWEVENT = 0x200, /**< Window state change */ + SDL_SYSWMEVENT, /**< System specific event */ + + /* Keyboard events */ + SDL_KEYDOWN = 0x300, /**< Key pressed */ + SDL_KEYUP, /**< Key released */ + SDL_TEXTEDITING, /**< Keyboard text editing (composition) */ + SDL_TEXTINPUT, /**< Keyboard text input */ + SDL_KEYMAPCHANGED, /**< Keymap changed due to a system event such as an + input language or keyboard layout change. + */ + + /* Mouse events */ + SDL_MOUSEMOTION = 0x400, /**< Mouse moved */ + SDL_MOUSEBUTTONDOWN, /**< Mouse button pressed */ + SDL_MOUSEBUTTONUP, /**< Mouse button released */ + SDL_MOUSEWHEEL, /**< Mouse wheel motion */ + + /* Joystick events */ + SDL_JOYAXISMOTION = 0x600, /**< Joystick axis motion */ + SDL_JOYBALLMOTION, /**< Joystick trackball motion */ + SDL_JOYHATMOTION, /**< Joystick hat position change */ + SDL_JOYBUTTONDOWN, /**< Joystick button pressed */ + SDL_JOYBUTTONUP, /**< Joystick button released */ + SDL_JOYDEVICEADDED, /**< A new joystick has been inserted into the system */ + SDL_JOYDEVICEREMOVED, /**< An opened joystick has been removed */ + + /* Game controller events */ + SDL_CONTROLLERAXISMOTION = 0x650, /**< Game controller axis motion */ + SDL_CONTROLLERBUTTONDOWN, /**< Game controller button pressed */ + SDL_CONTROLLERBUTTONUP, /**< Game controller button released */ + SDL_CONTROLLERDEVICEADDED, /**< A new Game controller has been inserted into the system */ + SDL_CONTROLLERDEVICEREMOVED, /**< An opened Game controller has been removed */ + SDL_CONTROLLERDEVICEREMAPPED, /**< The controller mapping was updated */ + SDL_CONTROLLERTOUCHPADDOWN, /**< Game controller touchpad was touched */ + SDL_CONTROLLERTOUCHPADMOTION, /**< Game controller touchpad finger was moved */ + SDL_CONTROLLERTOUCHPADUP, /**< Game controller touchpad finger was lifted */ + SDL_CONTROLLERSENSORUPDATE, /**< Game controller sensor was updated */ + + /* Touch events */ + SDL_FINGERDOWN = 0x700, + SDL_FINGERUP, + SDL_FINGERMOTION, + + /* Gesture events */ + SDL_DOLLARGESTURE = 0x800, + SDL_DOLLARRECORD, + SDL_MULTIGESTURE, + + /* Clipboard events */ + SDL_CLIPBOARDUPDATE = 0x900, /**< The clipboard changed */ + + /* Drag and drop events */ + SDL_DROPFILE = 0x1000, /**< The system requests a file open */ + SDL_DROPTEXT, /**< text/plain drag-and-drop event */ + SDL_DROPBEGIN, /**< A new set of drops is beginning (NULL filename) */ + SDL_DROPCOMPLETE, /**< Current set of drops is now complete (NULL filename) */ + + /* Audio hotplug events */ + SDL_AUDIODEVICEADDED = 0x1100, /**< A new audio device is available */ + SDL_AUDIODEVICEREMOVED, /**< An audio device has been removed. */ + + /* Sensor events */ + SDL_SENSORUPDATE = 0x1200, /**< A sensor was updated */ + + /* Render events */ + SDL_RENDER_TARGETS_RESET = 0x2000, /**< The render targets have been reset and their contents need to be updated */ + SDL_RENDER_DEVICE_RESET, /**< The device has been reset and all textures need to be recreated */ + + /** Events ::SDL_USEREVENT through ::SDL_LASTEVENT are for your use, + * and should be allocated with SDL_RegisterEvents() + */ + SDL_USEREVENT = 0x8000, + + /** + * This last event is only for bounding internal arrays + */ + SDL_LASTEVENT = 0xFFFF +} SDL_EventType; + +/** + * \brief Fields shared by every event + */ +typedef struct SDL_CommonEvent +{ + Uint32 type; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ +} SDL_CommonEvent; + +/** + * \brief Display state change event data (event.display.*) + */ +typedef struct SDL_DisplayEvent +{ + Uint32 type; /**< ::SDL_DISPLAYEVENT */ + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ + Uint32 display; /**< The associated display index */ + Uint8 event; /**< ::SDL_DisplayEventID */ + Uint8 padding1; + Uint8 padding2; + Uint8 padding3; + Sint32 data1; /**< event dependent data */ +} SDL_DisplayEvent; + +/** + * \brief Window state change event data (event.window.*) + */ +typedef struct SDL_WindowEvent +{ + Uint32 type; /**< ::SDL_WINDOWEVENT */ + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ + Uint32 windowID; /**< The associated window */ + Uint8 event; /**< ::SDL_WindowEventID */ + Uint8 padding1; + Uint8 padding2; + Uint8 padding3; + Sint32 data1; /**< event dependent data */ + Sint32 data2; /**< event dependent data */ +} SDL_WindowEvent; + +/** + * \brief Keyboard button event structure (event.key.*) + */ +typedef struct SDL_KeyboardEvent +{ + Uint32 type; /**< ::SDL_KEYDOWN or ::SDL_KEYUP */ + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ + Uint32 windowID; /**< The window with keyboard focus, if any */ + Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */ + Uint8 repeat; /**< Non-zero if this is a key repeat */ + Uint8 padding2; + Uint8 padding3; + SDL_Keysym keysym; /**< The key that was pressed or released */ +} SDL_KeyboardEvent; + +#define SDL_TEXTEDITINGEVENT_TEXT_SIZE (32) +/** + * \brief Keyboard text editing event structure (event.edit.*) + */ +typedef struct SDL_TextEditingEvent +{ + Uint32 type; /**< ::SDL_TEXTEDITING */ + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ + Uint32 windowID; /**< The window with keyboard focus, if any */ + char text[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; /**< The editing text */ + Sint32 start; /**< The start cursor of selected editing text */ + Sint32 length; /**< The length of selected editing text */ +} SDL_TextEditingEvent; + + +#define SDL_TEXTINPUTEVENT_TEXT_SIZE (32) +/** + * \brief Keyboard text input event structure (event.text.*) + */ +typedef struct SDL_TextInputEvent +{ + Uint32 type; /**< ::SDL_TEXTINPUT */ + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ + Uint32 windowID; /**< The window with keyboard focus, if any */ + char text[SDL_TEXTINPUTEVENT_TEXT_SIZE]; /**< The input text */ +} SDL_TextInputEvent; + +/** + * \brief Mouse motion event structure (event.motion.*) + */ +typedef struct SDL_MouseMotionEvent +{ + Uint32 type; /**< ::SDL_MOUSEMOTION */ + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ + Uint32 windowID; /**< The window with mouse focus, if any */ + Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */ + Uint32 state; /**< The current button state */ + Sint32 x; /**< X coordinate, relative to window */ + Sint32 y; /**< Y coordinate, relative to window */ + Sint32 xrel; /**< The relative motion in the X direction */ + Sint32 yrel; /**< The relative motion in the Y direction */ +} SDL_MouseMotionEvent; + +/** + * \brief Mouse button event structure (event.button.*) + */ +typedef struct SDL_MouseButtonEvent +{ + Uint32 type; /**< ::SDL_MOUSEBUTTONDOWN or ::SDL_MOUSEBUTTONUP */ + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ + Uint32 windowID; /**< The window with mouse focus, if any */ + Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */ + Uint8 button; /**< The mouse button index */ + Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */ + Uint8 clicks; /**< 1 for single-click, 2 for double-click, etc. */ + Uint8 padding1; + Sint32 x; /**< X coordinate, relative to window */ + Sint32 y; /**< Y coordinate, relative to window */ +} SDL_MouseButtonEvent; + +/** + * \brief Mouse wheel event structure (event.wheel.*) + */ +typedef struct SDL_MouseWheelEvent +{ + Uint32 type; /**< ::SDL_MOUSEWHEEL */ + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ + Uint32 windowID; /**< The window with mouse focus, if any */ + Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */ + Sint32 x; /**< The amount scrolled horizontally, positive to the right and negative to the left */ + Sint32 y; /**< The amount scrolled vertically, positive away from the user and negative toward the user */ + Uint32 direction; /**< Set to one of the SDL_MOUSEWHEEL_* defines. When FLIPPED the values in X and Y will be opposite. Multiply by -1 to change them back */ +} SDL_MouseWheelEvent; + +/** + * \brief Joystick axis motion event structure (event.jaxis.*) + */ +typedef struct SDL_JoyAxisEvent +{ + Uint32 type; /**< ::SDL_JOYAXISMOTION */ + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ + SDL_JoystickID which; /**< The joystick instance id */ + Uint8 axis; /**< The joystick axis index */ + Uint8 padding1; + Uint8 padding2; + Uint8 padding3; + Sint16 value; /**< The axis value (range: -32768 to 32767) */ + Uint16 padding4; +} SDL_JoyAxisEvent; + +/** + * \brief Joystick trackball motion event structure (event.jball.*) + */ +typedef struct SDL_JoyBallEvent +{ + Uint32 type; /**< ::SDL_JOYBALLMOTION */ + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ + SDL_JoystickID which; /**< The joystick instance id */ + Uint8 ball; /**< The joystick trackball index */ + Uint8 padding1; + Uint8 padding2; + Uint8 padding3; + Sint16 xrel; /**< The relative motion in the X direction */ + Sint16 yrel; /**< The relative motion in the Y direction */ +} SDL_JoyBallEvent; + +/** + * \brief Joystick hat position change event structure (event.jhat.*) + */ +typedef struct SDL_JoyHatEvent +{ + Uint32 type; /**< ::SDL_JOYHATMOTION */ + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ + SDL_JoystickID which; /**< The joystick instance id */ + Uint8 hat; /**< The joystick hat index */ + Uint8 value; /**< The hat position value. + * \sa ::SDL_HAT_LEFTUP ::SDL_HAT_UP ::SDL_HAT_RIGHTUP + * \sa ::SDL_HAT_LEFT ::SDL_HAT_CENTERED ::SDL_HAT_RIGHT + * \sa ::SDL_HAT_LEFTDOWN ::SDL_HAT_DOWN ::SDL_HAT_RIGHTDOWN + * + * Note that zero means the POV is centered. + */ + Uint8 padding1; + Uint8 padding2; +} SDL_JoyHatEvent; + +/** + * \brief Joystick button event structure (event.jbutton.*) + */ +typedef struct SDL_JoyButtonEvent +{ + Uint32 type; /**< ::SDL_JOYBUTTONDOWN or ::SDL_JOYBUTTONUP */ + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ + SDL_JoystickID which; /**< The joystick instance id */ + Uint8 button; /**< The joystick button index */ + Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */ + Uint8 padding1; + Uint8 padding2; +} SDL_JoyButtonEvent; + +/** + * \brief Joystick device event structure (event.jdevice.*) + */ +typedef struct SDL_JoyDeviceEvent +{ + Uint32 type; /**< ::SDL_JOYDEVICEADDED or ::SDL_JOYDEVICEREMOVED */ + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ + Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED event */ +} SDL_JoyDeviceEvent; + + +/** + * \brief Game controller axis motion event structure (event.caxis.*) + */ +typedef struct SDL_ControllerAxisEvent +{ + Uint32 type; /**< ::SDL_CONTROLLERAXISMOTION */ + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ + SDL_JoystickID which; /**< The joystick instance id */ + Uint8 axis; /**< The controller axis (SDL_GameControllerAxis) */ + Uint8 padding1; + Uint8 padding2; + Uint8 padding3; + Sint16 value; /**< The axis value (range: -32768 to 32767) */ + Uint16 padding4; +} SDL_ControllerAxisEvent; + + +/** + * \brief Game controller button event structure (event.cbutton.*) + */ +typedef struct SDL_ControllerButtonEvent +{ + Uint32 type; /**< ::SDL_CONTROLLERBUTTONDOWN or ::SDL_CONTROLLERBUTTONUP */ + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ + SDL_JoystickID which; /**< The joystick instance id */ + Uint8 button; /**< The controller button (SDL_GameControllerButton) */ + Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */ + Uint8 padding1; + Uint8 padding2; +} SDL_ControllerButtonEvent; + + +/** + * \brief Controller device event structure (event.cdevice.*) + */ +typedef struct SDL_ControllerDeviceEvent +{ + Uint32 type; /**< ::SDL_CONTROLLERDEVICEADDED, ::SDL_CONTROLLERDEVICEREMOVED, or ::SDL_CONTROLLERDEVICEREMAPPED */ + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ + Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED or REMAPPED event */ +} SDL_ControllerDeviceEvent; + +/** + * \brief Game controller touchpad event structure (event.ctouchpad.*) + */ +typedef struct SDL_ControllerTouchpadEvent +{ + Uint32 type; /**< ::SDL_CONTROLLERTOUCHPADDOWN or ::SDL_CONTROLLERTOUCHPADMOTION or ::SDL_CONTROLLERTOUCHPADUP */ + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ + SDL_JoystickID which; /**< The joystick instance id */ + Sint32 touchpad; /**< The index of the touchpad */ + Sint32 finger; /**< The index of the finger on the touchpad */ + float x; /**< Normalized in the range 0...1 with 0 being on the left */ + float y; /**< Normalized in the range 0...1 with 0 being at the top */ + float pressure; /**< Normalized in the range 0...1 */ +} SDL_ControllerTouchpadEvent; + +/** + * \brief Game controller sensor event structure (event.csensor.*) + */ +typedef struct SDL_ControllerSensorEvent +{ + Uint32 type; /**< ::SDL_CONTROLLERSENSORUPDATE */ + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ + SDL_JoystickID which; /**< The joystick instance id */ + Sint32 sensor; /**< The type of the sensor, one of the values of ::SDL_SensorType */ + float data[3]; /**< Up to 3 values from the sensor, as defined in SDL_sensor.h */ +} SDL_ControllerSensorEvent; + +/** + * \brief Audio device event structure (event.adevice.*) + */ +typedef struct SDL_AudioDeviceEvent +{ + Uint32 type; /**< ::SDL_AUDIODEVICEADDED, or ::SDL_AUDIODEVICEREMOVED */ + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ + Uint32 which; /**< The audio device index for the ADDED event (valid until next SDL_GetNumAudioDevices() call), SDL_AudioDeviceID for the REMOVED event */ + Uint8 iscapture; /**< zero if an output device, non-zero if a capture device. */ + Uint8 padding1; + Uint8 padding2; + Uint8 padding3; +} SDL_AudioDeviceEvent; + + +/** + * \brief Touch finger event structure (event.tfinger.*) + */ +typedef struct SDL_TouchFingerEvent +{ + Uint32 type; /**< ::SDL_FINGERMOTION or ::SDL_FINGERDOWN or ::SDL_FINGERUP */ + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ + SDL_TouchID touchId; /**< The touch device id */ + SDL_FingerID fingerId; + float x; /**< Normalized in the range 0...1 */ + float y; /**< Normalized in the range 0...1 */ + float dx; /**< Normalized in the range -1...1 */ + float dy; /**< Normalized in the range -1...1 */ + float pressure; /**< Normalized in the range 0...1 */ + Uint32 windowID; /**< The window underneath the finger, if any */ +} SDL_TouchFingerEvent; + + +/** + * \brief Multiple Finger Gesture Event (event.mgesture.*) + */ +typedef struct SDL_MultiGestureEvent +{ + Uint32 type; /**< ::SDL_MULTIGESTURE */ + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ + SDL_TouchID touchId; /**< The touch device id */ + float dTheta; + float dDist; + float x; + float y; + Uint16 numFingers; + Uint16 padding; +} SDL_MultiGestureEvent; + + +/** + * \brief Dollar Gesture Event (event.dgesture.*) + */ +typedef struct SDL_DollarGestureEvent +{ + Uint32 type; /**< ::SDL_DOLLARGESTURE or ::SDL_DOLLARRECORD */ + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ + SDL_TouchID touchId; /**< The touch device id */ + SDL_GestureID gestureId; + Uint32 numFingers; + float error; + float x; /**< Normalized center of gesture */ + float y; /**< Normalized center of gesture */ +} SDL_DollarGestureEvent; + + +/** + * \brief An event used to request a file open by the system (event.drop.*) + * This event is enabled by default, you can disable it with SDL_EventState(). + * \note If this event is enabled, you must free the filename in the event. + */ +typedef struct SDL_DropEvent +{ + Uint32 type; /**< ::SDL_DROPBEGIN or ::SDL_DROPFILE or ::SDL_DROPTEXT or ::SDL_DROPCOMPLETE */ + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ + char *file; /**< The file name, which should be freed with SDL_free(), is NULL on begin/complete */ + Uint32 windowID; /**< The window that was dropped on, if any */ +} SDL_DropEvent; + + +/** + * \brief Sensor event structure (event.sensor.*) + */ +typedef struct SDL_SensorEvent +{ + Uint32 type; /**< ::SDL_SENSORUPDATE */ + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ + Sint32 which; /**< The instance ID of the sensor */ + float data[6]; /**< Up to 6 values from the sensor - additional values can be queried using SDL_SensorGetData() */ +} SDL_SensorEvent; + +/** + * \brief The "quit requested" event + */ +typedef struct SDL_QuitEvent +{ + Uint32 type; /**< ::SDL_QUIT */ + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ +} SDL_QuitEvent; + +/** + * \brief OS Specific event + */ +typedef struct SDL_OSEvent +{ + Uint32 type; /**< ::SDL_QUIT */ + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ +} SDL_OSEvent; + +/** + * \brief A user-defined event type (event.user.*) + */ +typedef struct SDL_UserEvent +{ + Uint32 type; /**< ::SDL_USEREVENT through ::SDL_LASTEVENT-1 */ + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ + Uint32 windowID; /**< The associated window if any */ + Sint32 code; /**< User defined event code */ + void *data1; /**< User defined data pointer */ + void *data2; /**< User defined data pointer */ +} SDL_UserEvent; + + +struct SDL_SysWMmsg; +typedef struct SDL_SysWMmsg SDL_SysWMmsg; + +/** + * \brief A video driver dependent system event (event.syswm.*) + * This event is disabled by default, you can enable it with SDL_EventState() + * + * \note If you want to use this event, you should include SDL_syswm.h. + */ +typedef struct SDL_SysWMEvent +{ + Uint32 type; /**< ::SDL_SYSWMEVENT */ + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ + SDL_SysWMmsg *msg; /**< driver dependent data, defined in SDL_syswm.h */ +} SDL_SysWMEvent; + +/** + * \brief General event structure + */ +typedef union SDL_Event +{ + Uint32 type; /**< Event type, shared with all events */ + SDL_CommonEvent common; /**< Common event data */ + SDL_DisplayEvent display; /**< Display event data */ + SDL_WindowEvent window; /**< Window event data */ + SDL_KeyboardEvent key; /**< Keyboard event data */ + SDL_TextEditingEvent edit; /**< Text editing event data */ + SDL_TextInputEvent text; /**< Text input event data */ + SDL_MouseMotionEvent motion; /**< Mouse motion event data */ + SDL_MouseButtonEvent button; /**< Mouse button event data */ + SDL_MouseWheelEvent wheel; /**< Mouse wheel event data */ + SDL_JoyAxisEvent jaxis; /**< Joystick axis event data */ + SDL_JoyBallEvent jball; /**< Joystick ball event data */ + SDL_JoyHatEvent jhat; /**< Joystick hat event data */ + SDL_JoyButtonEvent jbutton; /**< Joystick button event data */ + SDL_JoyDeviceEvent jdevice; /**< Joystick device change event data */ + SDL_ControllerAxisEvent caxis; /**< Game Controller axis event data */ + SDL_ControllerButtonEvent cbutton; /**< Game Controller button event data */ + SDL_ControllerDeviceEvent cdevice; /**< Game Controller device event data */ + SDL_ControllerTouchpadEvent ctouchpad; /**< Game Controller touchpad event data */ + SDL_ControllerSensorEvent csensor; /**< Game Controller sensor event data */ + SDL_AudioDeviceEvent adevice; /**< Audio device event data */ + SDL_SensorEvent sensor; /**< Sensor event data */ + SDL_QuitEvent quit; /**< Quit request event data */ + SDL_UserEvent user; /**< Custom event data */ + SDL_SysWMEvent syswm; /**< System dependent window event data */ + SDL_TouchFingerEvent tfinger; /**< Touch finger event data */ + SDL_MultiGestureEvent mgesture; /**< Gesture event data */ + SDL_DollarGestureEvent dgesture; /**< Gesture event data */ + SDL_DropEvent drop; /**< Drag and drop event data */ + + /* This is necessary for ABI compatibility between Visual C++ and GCC + Visual C++ will respect the push pack pragma and use 52 bytes for + this structure, and GCC will use the alignment of the largest datatype + within the union, which is 8 bytes. + + So... we'll add padding to force the size to be 56 bytes for both. + */ + Uint8 padding[56]; +} SDL_Event; + +/* Make sure we haven't broken binary compatibility */ +SDL_COMPILE_TIME_ASSERT(SDL_Event, sizeof(SDL_Event) == 56); + + +/* Function prototypes */ + +/** + * Pumps the event loop, gathering events from the input devices. + * + * This function updates the event queue and internal input device state. + * + * This should only be run in the thread that sets the video mode. + */ +extern DECLSPEC void SDLCALL SDL_PumpEvents(void); + +/* @{ */ +typedef enum +{ + SDL_ADDEVENT, + SDL_PEEKEVENT, + SDL_GETEVENT +} SDL_eventaction; + +/** + * Checks the event queue for messages and optionally returns them. + * + * If \c action is ::SDL_ADDEVENT, up to \c numevents events will be added to + * the back of the event queue. + * + * If \c action is ::SDL_PEEKEVENT, up to \c numevents events at the front + * of the event queue, within the specified minimum and maximum type, + * will be returned and will not be removed from the queue. + * + * If \c action is ::SDL_GETEVENT, up to \c numevents events at the front + * of the event queue, within the specified minimum and maximum type, + * will be returned and will be removed from the queue. + * + * \return The number of events actually stored, or -1 if there was an error. + * + * This function is thread-safe. + */ +extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event * events, int numevents, + SDL_eventaction action, + Uint32 minType, Uint32 maxType); +/* @} */ + +/** + * Checks to see if certain event types are in the event queue. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_HasEvent(Uint32 type); +extern DECLSPEC SDL_bool SDLCALL SDL_HasEvents(Uint32 minType, Uint32 maxType); + +/** + * This function clears events from the event queue + * This function only affects currently queued events. If you want to make + * sure that all pending OS events are flushed, you can call SDL_PumpEvents() + * on the main thread immediately before the flush call. + */ +extern DECLSPEC void SDLCALL SDL_FlushEvent(Uint32 type); +extern DECLSPEC void SDLCALL SDL_FlushEvents(Uint32 minType, Uint32 maxType); + +/** + * \brief Polls for currently pending events. + * + * \return 1 if there are any pending events, or 0 if there are none available. + * + * \param event If not NULL, the next event is removed from the queue and + * stored in that area. + */ +extern DECLSPEC int SDLCALL SDL_PollEvent(SDL_Event * event); + +/** + * \brief Waits indefinitely for the next available event. + * + * \return 1, or 0 if there was an error while waiting for events. + * + * \param event If not NULL, the next event is removed from the queue and + * stored in that area. + */ +extern DECLSPEC int SDLCALL SDL_WaitEvent(SDL_Event * event); + +/** + * \brief Waits until the specified timeout (in milliseconds) for the next + * available event. + * + * \return 1, or 0 if there was an error while waiting for events. + * + * \param event If not NULL, the next event is removed from the queue and + * stored in that area. + * \param timeout The timeout (in milliseconds) to wait for next event. + */ +extern DECLSPEC int SDLCALL SDL_WaitEventTimeout(SDL_Event * event, + int timeout); + +/** + * \brief Add an event to the event queue. + * + * \return 1 on success, 0 if the event was filtered, or -1 if the event queue + * was full or there was some other error. + */ +extern DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event * event); + +typedef int (SDLCALL * SDL_EventFilter) (void *userdata, SDL_Event * event); + +/** + * Sets up a filter to process all events before they change internal state and + * are posted to the internal event queue. + * + * The filter is prototyped as: + * \code + * int SDL_EventFilter(void *userdata, SDL_Event * event); + * \endcode + * + * If the filter returns 1, then the event will be added to the internal queue. + * If it returns 0, then the event will be dropped from the queue, but the + * internal state will still be updated. This allows selective filtering of + * dynamically arriving events. + * + * \warning Be very careful of what you do in the event filter function, as + * it may run in a different thread! + * + * There is one caveat when dealing with the ::SDL_QuitEvent event type. The + * event filter is only called when the window manager desires to close the + * application window. If the event filter returns 1, then the window will + * be closed, otherwise the window will remain open if possible. + * + * If the quit event is generated by an interrupt signal, it will bypass the + * internal queue and be delivered to the application at the next event poll. + */ +extern DECLSPEC void SDLCALL SDL_SetEventFilter(SDL_EventFilter filter, + void *userdata); + +/** + * Return the current event filter - can be used to "chain" filters. + * If there is no event filter set, this function returns SDL_FALSE. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_GetEventFilter(SDL_EventFilter * filter, + void **userdata); + +/** + * Add a function which is called when an event is added to the queue. + */ +extern DECLSPEC void SDLCALL SDL_AddEventWatch(SDL_EventFilter filter, + void *userdata); + +/** + * Remove an event watch function added with SDL_AddEventWatch() + */ +extern DECLSPEC void SDLCALL SDL_DelEventWatch(SDL_EventFilter filter, + void *userdata); + +/** + * Run the filter function on the current event queue, removing any + * events for which the filter returns 0. + */ +extern DECLSPEC void SDLCALL SDL_FilterEvents(SDL_EventFilter filter, + void *userdata); + +/* @{ */ +#define SDL_QUERY -1 +#define SDL_IGNORE 0 +#define SDL_DISABLE 0 +#define SDL_ENABLE 1 + +/** + * This function allows you to set the state of processing certain events. + * - If \c state is set to ::SDL_IGNORE, that event will be automatically + * dropped from the event queue and will not be filtered. + * - If \c state is set to ::SDL_ENABLE, that event will be processed + * normally. + * - If \c state is set to ::SDL_QUERY, SDL_EventState() will return the + * current processing state of the specified event. + */ +extern DECLSPEC Uint8 SDLCALL SDL_EventState(Uint32 type, int state); +/* @} */ +#define SDL_GetEventState(type) SDL_EventState(type, SDL_QUERY) + +/** + * This function allocates a set of user-defined events, and returns + * the beginning event number for that set of events. + * + * If there aren't enough user-defined events left, this function + * returns (Uint32)-1 + */ +extern DECLSPEC Uint32 SDLCALL SDL_RegisterEvents(int numevents); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_events_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_filesystem.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_filesystem.h new file mode 100644 index 0000000..68042b6 --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_filesystem.h @@ -0,0 +1,136 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_filesystem.h + * + * \brief Include file for filesystem SDL API functions + */ + +#ifndef SDL_filesystem_h_ +#define SDL_filesystem_h_ + +#include "SDL_stdinc.h" + +#include "begin_code.h" + +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \brief Get the path where the application resides. + * + * Get the "base path". This is the directory where the application was run + * from, which is probably the installation directory, and may or may not + * be the process's current working directory. + * + * This returns an absolute path in UTF-8 encoding, and is guaranteed to + * end with a path separator ('\\' on Windows, '/' most other places). + * + * The pointer returned by this function is owned by you. Please call + * SDL_free() on the pointer when you are done with it, or it will be a + * memory leak. This is not necessarily a fast call, though, so you should + * call this once near startup and save the string if you need it. + * + * Some platforms can't determine the application's path, and on other + * platforms, this might be meaningless. In such cases, this function will + * return NULL. + * + * \return String of base dir in UTF-8 encoding, or NULL on error. + * + * \sa SDL_GetPrefPath + */ +extern DECLSPEC char *SDLCALL SDL_GetBasePath(void); + +/** + * \brief Get the user-and-app-specific path where files can be written. + * + * Get the "pref dir". This is meant to be where users can write personal + * files (preferences and save games, etc) that are specific to your + * application. This directory is unique per user, per application. + * + * This function will decide the appropriate location in the native filesystem, + * create the directory if necessary, and return a string of the absolute + * path to the directory in UTF-8 encoding. + * + * On Windows, the string might look like: + * "C:\\Users\\bob\\AppData\\Roaming\\My Company\\My Program Name\\" + * + * On Linux, the string might look like: + * "/home/bob/.local/share/My Program Name/" + * + * On Mac OS X, the string might look like: + * "/Users/bob/Library/Application Support/My Program Name/" + * + * (etc.) + * + * You specify the name of your organization (if it's not a real organization, + * your name or an Internet domain you own might do) and the name of your + * application. These should be untranslated proper names. + * + * Both the org and app strings may become part of a directory name, so + * please follow these rules: + * + * - Try to use the same org string (including case-sensitivity) for + * all your applications that use this function. + * - Always use a unique app string for each one, and make sure it never + * changes for an app once you've decided on it. + * - Unicode characters are legal, as long as it's UTF-8 encoded, but... + * - ...only use letters, numbers, and spaces. Avoid punctuation like + * "Game Name 2: Bad Guy's Revenge!" ... "Game Name 2" is sufficient. + * + * This returns an absolute path in UTF-8 encoding, and is guaranteed to + * end with a path separator ('\\' on Windows, '/' most other places). + * + * The pointer returned by this function is owned by you. Please call + * SDL_free() on the pointer when you are done with it, or it will be a + * memory leak. This is not necessarily a fast call, though, so you should + * call this once near startup and save the string if you need it. + * + * You should assume the path returned by this function is the only safe + * place to write files (and that SDL_GetBasePath(), while it might be + * writable, or even the parent of the returned path, aren't where you + * should be writing things). + * + * Some platforms can't determine the pref path, and on other + * platforms, this might be meaningless. In such cases, this function will + * return NULL. + * + * \param org The name of your organization. + * \param app The name of your application. + * \return UTF-8 string of user dir in platform-dependent notation. NULL + * if there's a problem (creating directory failed, etc). + * + * \sa SDL_GetBasePath + */ +extern DECLSPEC char *SDLCALL SDL_GetPrefPath(const char *org, const char *app); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_filesystem_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_gamecontroller.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_gamecontroller.h new file mode 100644 index 0000000..e42433c --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_gamecontroller.h @@ -0,0 +1,541 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_gamecontroller.h + * + * Include file for SDL game controller event handling + */ + +#ifndef SDL_gamecontroller_h_ +#define SDL_gamecontroller_h_ + +#include "SDL_stdinc.h" +#include "SDL_error.h" +#include "SDL_rwops.h" +#include "SDL_sensor.h" +#include "SDL_joystick.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \file SDL_gamecontroller.h + * + * In order to use these functions, SDL_Init() must have been called + * with the ::SDL_INIT_GAMECONTROLLER flag. This causes SDL to scan the system + * for game controllers, and load appropriate drivers. + * + * If you would like to receive controller updates while the application + * is in the background, you should set the following hint before calling + * SDL_Init(): SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS + */ + +/** + * The gamecontroller structure used to identify an SDL game controller + */ +struct _SDL_GameController; +typedef struct _SDL_GameController SDL_GameController; + +typedef enum +{ + SDL_CONTROLLER_TYPE_UNKNOWN = 0, + SDL_CONTROLLER_TYPE_XBOX360, + SDL_CONTROLLER_TYPE_XBOXONE, + SDL_CONTROLLER_TYPE_PS3, + SDL_CONTROLLER_TYPE_PS4, + SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO, + SDL_CONTROLLER_TYPE_VIRTUAL, + SDL_CONTROLLER_TYPE_PS5 +} SDL_GameControllerType; + +typedef enum +{ + SDL_CONTROLLER_BINDTYPE_NONE = 0, + SDL_CONTROLLER_BINDTYPE_BUTTON, + SDL_CONTROLLER_BINDTYPE_AXIS, + SDL_CONTROLLER_BINDTYPE_HAT +} SDL_GameControllerBindType; + +/** + * Get the SDL joystick layer binding for this controller button/axis mapping + */ +typedef struct SDL_GameControllerButtonBind +{ + SDL_GameControllerBindType bindType; + union + { + int button; + int axis; + struct { + int hat; + int hat_mask; + } hat; + } value; + +} SDL_GameControllerButtonBind; + + +/** + * To count the number of game controllers in the system for the following: + * int nJoysticks = SDL_NumJoysticks(); + * int nGameControllers = 0; + * for (int i = 0; i < nJoysticks; i++) { + * if (SDL_IsGameController(i)) { + * nGameControllers++; + * } + * } + * + * Using the SDL_HINT_GAMECONTROLLERCONFIG hint or the SDL_GameControllerAddMapping() you can add support for controllers SDL is unaware of or cause an existing controller to have a different binding. The format is: + * guid,name,mappings + * + * Where GUID is the string value from SDL_JoystickGetGUIDString(), name is the human readable string for the device and mappings are controller mappings to joystick ones. + * Under Windows there is a reserved GUID of "xinput" that covers any XInput devices. + * The mapping format for joystick is: + * bX - a joystick button, index X + * hX.Y - hat X with value Y + * aX - axis X of the joystick + * Buttons can be used as a controller axis and vice versa. + * + * This string shows an example of a valid mapping for a controller + * "03000000341a00003608000000000000,PS3 Controller,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7", + * + */ + +/** + * Load a set of mappings from a seekable SDL data stream (memory or file), filtered by the current SDL_GetPlatform() + * A community sourced database of controllers is available at https://raw.github.com/gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt + * + * If \c freerw is non-zero, the stream will be closed after being read. + * + * \return number of mappings added, -1 on error + */ +extern DECLSPEC int SDLCALL SDL_GameControllerAddMappingsFromRW(SDL_RWops * rw, int freerw); + +/** + * Load a set of mappings from a file, filtered by the current SDL_GetPlatform() + * + * Convenience macro. + */ +#define SDL_GameControllerAddMappingsFromFile(file) SDL_GameControllerAddMappingsFromRW(SDL_RWFromFile(file, "rb"), 1) + +/** + * Add or update an existing mapping configuration + * + * \return 1 if mapping is added, 0 if updated, -1 on error + */ +extern DECLSPEC int SDLCALL SDL_GameControllerAddMapping(const char* mappingString); + +/** + * Get the number of mappings installed + * + * \return the number of mappings + */ +extern DECLSPEC int SDLCALL SDL_GameControllerNumMappings(void); + +/** + * Get the mapping at a particular index. + * + * \return the mapping string. Must be freed with SDL_free(). Returns NULL if the index is out of range. + */ +extern DECLSPEC char * SDLCALL SDL_GameControllerMappingForIndex(int mapping_index); + +/** + * Get a mapping string for a GUID + * + * \return the mapping string. Must be freed with SDL_free(). Returns NULL if no mapping is available + */ +extern DECLSPEC char * SDLCALL SDL_GameControllerMappingForGUID(SDL_JoystickGUID guid); + +/** + * Get a mapping string for an open GameController + * + * \return the mapping string. Must be freed with SDL_free(). Returns NULL if no mapping is available + */ +extern DECLSPEC char * SDLCALL SDL_GameControllerMapping(SDL_GameController *gamecontroller); + +/** + * Is the joystick on this index supported by the game controller interface? + */ +extern DECLSPEC SDL_bool SDLCALL SDL_IsGameController(int joystick_index); + +/** + * Get the implementation dependent name of a game controller. + * This can be called before any controllers are opened. + * If no name can be found, this function returns NULL. + */ +extern DECLSPEC const char *SDLCALL SDL_GameControllerNameForIndex(int joystick_index); + +/** + * Get the type of a game controller. + * This can be called before any controllers are opened. + */ +extern DECLSPEC SDL_GameControllerType SDLCALL SDL_GameControllerTypeForIndex(int joystick_index); + +/** + * Get the mapping of a game controller. + * This can be called before any controllers are opened. + * + * \return the mapping string. Must be freed with SDL_free(). Returns NULL if no mapping is available + */ +extern DECLSPEC char *SDLCALL SDL_GameControllerMappingForDeviceIndex(int joystick_index); + +/** + * Open a game controller for use. + * The index passed as an argument refers to the N'th game controller on the system. + * This index is not the value which will identify this controller in future + * controller events. The joystick's instance id (::SDL_JoystickID) will be + * used there instead. + * + * \return A controller identifier, or NULL if an error occurred. + */ +extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerOpen(int joystick_index); + +/** + * Return the SDL_GameController associated with an instance id. + */ +extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerFromInstanceID(SDL_JoystickID joyid); + +/** + * Return the SDL_GameController associated with a player index. + */ +extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerFromPlayerIndex(int player_index); + +/** + * Return the name for this currently opened controller + */ +extern DECLSPEC const char *SDLCALL SDL_GameControllerName(SDL_GameController *gamecontroller); + +/** + * Return the type of this currently opened controller + */ +extern DECLSPEC SDL_GameControllerType SDLCALL SDL_GameControllerGetType(SDL_GameController *gamecontroller); + +/** + * Get the player index of an opened game controller, or -1 if it's not available + * + * For XInput controllers this returns the XInput user index. + */ +extern DECLSPEC int SDLCALL SDL_GameControllerGetPlayerIndex(SDL_GameController *gamecontroller); + +/** + * Set the player index of an opened game controller + */ +extern DECLSPEC void SDLCALL SDL_GameControllerSetPlayerIndex(SDL_GameController *gamecontroller, int player_index); + +/** + * Get the USB vendor ID of an opened controller, if available. + * If the vendor ID isn't available this function returns 0. + */ +extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetVendor(SDL_GameController *gamecontroller); + +/** + * Get the USB product ID of an opened controller, if available. + * If the product ID isn't available this function returns 0. + */ +extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetProduct(SDL_GameController *gamecontroller); + +/** + * Get the product version of an opened controller, if available. + * If the product version isn't available this function returns 0. + */ +extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetProductVersion(SDL_GameController *gamecontroller); + +/** + * Get the serial number of an opened controller, if available. + * + * Returns the serial number of the controller, or NULL if it is not available. + */ +extern DECLSPEC const char * SDLCALL SDL_GameControllerGetSerial(SDL_GameController *gamecontroller); + +/** + * Returns SDL_TRUE if the controller has been opened and currently connected, + * or SDL_FALSE if it has not. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerGetAttached(SDL_GameController *gamecontroller); + +/** + * Get the underlying joystick object used by a controller + */ +extern DECLSPEC SDL_Joystick *SDLCALL SDL_GameControllerGetJoystick(SDL_GameController *gamecontroller); + +/** + * Enable/disable controller event polling. + * + * If controller events are disabled, you must call SDL_GameControllerUpdate() + * yourself and check the state of the controller when you want controller + * information. + * + * The state can be one of ::SDL_QUERY, ::SDL_ENABLE or ::SDL_IGNORE. + */ +extern DECLSPEC int SDLCALL SDL_GameControllerEventState(int state); + +/** + * Update the current state of the open game controllers. + * + * This is called automatically by the event loop if any game controller + * events are enabled. + */ +extern DECLSPEC void SDLCALL SDL_GameControllerUpdate(void); + + +/** + * The list of axes available from a controller + * + * Thumbstick axis values range from SDL_JOYSTICK_AXIS_MIN to SDL_JOYSTICK_AXIS_MAX, + * and are centered within ~8000 of zero, though advanced UI will allow users to set + * or autodetect the dead zone, which varies between controllers. + * + * Trigger axis values range from 0 to SDL_JOYSTICK_AXIS_MAX. + */ +typedef enum +{ + SDL_CONTROLLER_AXIS_INVALID = -1, + SDL_CONTROLLER_AXIS_LEFTX, + SDL_CONTROLLER_AXIS_LEFTY, + SDL_CONTROLLER_AXIS_RIGHTX, + SDL_CONTROLLER_AXIS_RIGHTY, + SDL_CONTROLLER_AXIS_TRIGGERLEFT, + SDL_CONTROLLER_AXIS_TRIGGERRIGHT, + SDL_CONTROLLER_AXIS_MAX +} SDL_GameControllerAxis; + +/** + * turn this string into a axis mapping + */ +extern DECLSPEC SDL_GameControllerAxis SDLCALL SDL_GameControllerGetAxisFromString(const char *pchString); + +/** + * turn this axis enum into a string mapping + */ +extern DECLSPEC const char* SDLCALL SDL_GameControllerGetStringForAxis(SDL_GameControllerAxis axis); + +/** + * Get the SDL joystick layer binding for this controller button mapping + */ +extern DECLSPEC SDL_GameControllerButtonBind SDLCALL +SDL_GameControllerGetBindForAxis(SDL_GameController *gamecontroller, + SDL_GameControllerAxis axis); + +/** + * Return whether a game controller has a given axis + */ +extern DECLSPEC SDL_bool SDLCALL +SDL_GameControllerHasAxis(SDL_GameController *gamecontroller, SDL_GameControllerAxis axis); + +/** + * Get the current state of an axis control on a game controller. + * + * The state is a value ranging from -32768 to 32767 (except for the triggers, + * which range from 0 to 32767). + * + * The axis indices start at index 0. + */ +extern DECLSPEC Sint16 SDLCALL +SDL_GameControllerGetAxis(SDL_GameController *gamecontroller, SDL_GameControllerAxis axis); + +/** + * The list of buttons available from a controller + */ +typedef enum +{ + SDL_CONTROLLER_BUTTON_INVALID = -1, + SDL_CONTROLLER_BUTTON_A, + SDL_CONTROLLER_BUTTON_B, + SDL_CONTROLLER_BUTTON_X, + SDL_CONTROLLER_BUTTON_Y, + SDL_CONTROLLER_BUTTON_BACK, + SDL_CONTROLLER_BUTTON_GUIDE, + SDL_CONTROLLER_BUTTON_START, + SDL_CONTROLLER_BUTTON_LEFTSTICK, + SDL_CONTROLLER_BUTTON_RIGHTSTICK, + SDL_CONTROLLER_BUTTON_LEFTSHOULDER, + SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, + SDL_CONTROLLER_BUTTON_DPAD_UP, + SDL_CONTROLLER_BUTTON_DPAD_DOWN, + SDL_CONTROLLER_BUTTON_DPAD_LEFT, + SDL_CONTROLLER_BUTTON_DPAD_RIGHT, + SDL_CONTROLLER_BUTTON_MISC1, /* Xbox Series X share button, PS5 microphone button, Nintendo Switch Pro capture button */ + SDL_CONTROLLER_BUTTON_PADDLE1, /* Xbox Elite paddle P1 */ + SDL_CONTROLLER_BUTTON_PADDLE2, /* Xbox Elite paddle P3 */ + SDL_CONTROLLER_BUTTON_PADDLE3, /* Xbox Elite paddle P2 */ + SDL_CONTROLLER_BUTTON_PADDLE4, /* Xbox Elite paddle P4 */ + SDL_CONTROLLER_BUTTON_TOUCHPAD, /* PS4/PS5 touchpad button */ + SDL_CONTROLLER_BUTTON_MAX +} SDL_GameControllerButton; + +/** + * turn this string into a button mapping + */ +extern DECLSPEC SDL_GameControllerButton SDLCALL SDL_GameControllerGetButtonFromString(const char *pchString); + +/** + * turn this button enum into a string mapping + */ +extern DECLSPEC const char* SDLCALL SDL_GameControllerGetStringForButton(SDL_GameControllerButton button); + +/** + * Get the SDL joystick layer binding for this controller button mapping + */ +extern DECLSPEC SDL_GameControllerButtonBind SDLCALL +SDL_GameControllerGetBindForButton(SDL_GameController *gamecontroller, + SDL_GameControllerButton button); + +/** + * Return whether a game controller has a given button + */ +extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerHasButton(SDL_GameController *gamecontroller, + SDL_GameControllerButton button); + +/** + * Get the current state of a button on a game controller. + * + * The button indices start at index 0. + */ +extern DECLSPEC Uint8 SDLCALL SDL_GameControllerGetButton(SDL_GameController *gamecontroller, + SDL_GameControllerButton button); + +/** + * Get the number of touchpads on a game controller. + */ +extern DECLSPEC int SDLCALL SDL_GameControllerGetNumTouchpads(SDL_GameController *gamecontroller); + +/** + * Get the number of supported simultaneous fingers on a touchpad on a game controller. + */ +extern DECLSPEC int SDLCALL SDL_GameControllerGetNumTouchpadFingers(SDL_GameController *gamecontroller, int touchpad); + +/** + * Get the current state of a finger on a touchpad on a game controller. + */ +extern DECLSPEC int SDLCALL SDL_GameControllerGetTouchpadFinger(SDL_GameController *gamecontroller, int touchpad, int finger, Uint8 *state, float *x, float *y, float *pressure); + +/** + * Return whether a game controller has a particular sensor. + * + * \param gamecontroller The controller to query + * \param type The type of sensor to query + * + * \return SDL_TRUE if the sensor exists, SDL_FALSE otherwise. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerHasSensor(SDL_GameController *gamecontroller, SDL_SensorType type); + +/** + * Set whether data reporting for a game controller sensor is enabled + * + * \param gamecontroller The controller to update + * \param type The type of sensor to enable/disable + * \param enabled Whether data reporting should be enabled + * + * \return 0 or -1 if an error occurred. + */ +extern DECLSPEC int SDLCALL SDL_GameControllerSetSensorEnabled(SDL_GameController *gamecontroller, SDL_SensorType type, SDL_bool enabled); + +/** + * Query whether sensor data reporting is enabled for a game controller + * + * \param gamecontroller The controller to query + * \param type The type of sensor to query + * + * \return SDL_TRUE if the sensor is enabled, SDL_FALSE otherwise. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerIsSensorEnabled(SDL_GameController *gamecontroller, SDL_SensorType type); + +/** + * Get the current state of a game controller sensor. + * + * The number of values and interpretation of the data is sensor dependent. + * See SDL_sensor.h for the details for each type of sensor. + * + * \param gamecontroller The controller to query + * \param type The type of sensor to query + * \param data A pointer filled with the current sensor state + * \param num_values The number of values to write to data + * + * \return 0 or -1 if an error occurred. + */ +extern DECLSPEC int SDLCALL SDL_GameControllerGetSensorData(SDL_GameController *gamecontroller, SDL_SensorType type, float *data, int num_values); + +/** + * Start a rumble effect + * Each call to this function cancels any previous rumble effect, and calling it with 0 intensity stops any rumbling. + * + * \param gamecontroller The controller to vibrate + * \param low_frequency_rumble The intensity of the low frequency (left) rumble motor, from 0 to 0xFFFF + * \param high_frequency_rumble The intensity of the high frequency (right) rumble motor, from 0 to 0xFFFF + * \param duration_ms The duration of the rumble effect, in milliseconds + * + * \return 0, or -1 if rumble isn't supported on this controller + */ +extern DECLSPEC int SDLCALL SDL_GameControllerRumble(SDL_GameController *gamecontroller, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms); + +/** + * Start a rumble effect in the game controller's triggers + * Each call to this function cancels any previous trigger rumble effect, and calling it with 0 intensity stops any rumbling. + * + * \param gamecontroller The controller to vibrate + * \param left_rumble The intensity of the left trigger rumble motor, from 0 to 0xFFFF + * \param right_rumble The intensity of the right trigger rumble motor, from 0 to 0xFFFF + * \param duration_ms The duration of the rumble effect, in milliseconds + * + * \return 0, or -1 if rumble isn't supported on this controller + */ +extern DECLSPEC int SDLCALL SDL_GameControllerRumbleTriggers(SDL_GameController *gamecontroller, Uint16 left_rumble, Uint16 right_rumble, Uint32 duration_ms); + +/** + * Return whether a controller has an LED + * + * \param gamecontroller The controller to query + * + * \return SDL_TRUE, or SDL_FALSE if this controller does not have a modifiable LED + */ +extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerHasLED(SDL_GameController *gamecontroller); + +/** + * Update a controller's LED color. + * + * \param gamecontroller The controller to update + * \param red The intensity of the red LED + * \param green The intensity of the green LED + * \param blue The intensity of the blue LED + * + * \return 0, or -1 if this controller does not have a modifiable LED + */ +extern DECLSPEC int SDLCALL SDL_GameControllerSetLED(SDL_GameController *gamecontroller, Uint8 red, Uint8 green, Uint8 blue); + +/** + * Close a controller previously opened with SDL_GameControllerOpen(). + */ +extern DECLSPEC void SDLCALL SDL_GameControllerClose(SDL_GameController *gamecontroller); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_gamecontroller_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_gesture.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_gesture.h new file mode 100644 index 0000000..81ed431 --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_gesture.h @@ -0,0 +1,87 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_gesture.h + * + * Include file for SDL gesture event handling. + */ + +#ifndef SDL_gesture_h_ +#define SDL_gesture_h_ + +#include "SDL_stdinc.h" +#include "SDL_error.h" +#include "SDL_video.h" + +#include "SDL_touch.h" + + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +typedef Sint64 SDL_GestureID; + +/* Function prototypes */ + +/** + * \brief Begin Recording a gesture on the specified touch, or all touches (-1) + * + * + */ +extern DECLSPEC int SDLCALL SDL_RecordGesture(SDL_TouchID touchId); + + +/** + * \brief Save all currently loaded Dollar Gesture templates + * + * + */ +extern DECLSPEC int SDLCALL SDL_SaveAllDollarTemplates(SDL_RWops *dst); + +/** + * \brief Save a currently loaded Dollar Gesture template + * + * + */ +extern DECLSPEC int SDLCALL SDL_SaveDollarTemplate(SDL_GestureID gestureId,SDL_RWops *dst); + + +/** + * \brief Load Dollar Gesture templates from a file + * + * + */ +extern DECLSPEC int SDLCALL SDL_LoadDollarTemplates(SDL_TouchID touchId, SDL_RWops *src); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_gesture_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_haptic.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_haptic.h new file mode 100644 index 0000000..c27da11 --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_haptic.h @@ -0,0 +1,1247 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_haptic.h + * + * \brief The SDL haptic subsystem allows you to control haptic (force feedback) + * devices. + * + * The basic usage is as follows: + * - Initialize the subsystem (::SDL_INIT_HAPTIC). + * - Open a haptic device. + * - SDL_HapticOpen() to open from index. + * - SDL_HapticOpenFromJoystick() to open from an existing joystick. + * - Create an effect (::SDL_HapticEffect). + * - Upload the effect with SDL_HapticNewEffect(). + * - Run the effect with SDL_HapticRunEffect(). + * - (optional) Free the effect with SDL_HapticDestroyEffect(). + * - Close the haptic device with SDL_HapticClose(). + * + * \par Simple rumble example: + * \code + * SDL_Haptic *haptic; + * + * // Open the device + * haptic = SDL_HapticOpen( 0 ); + * if (haptic == NULL) + * return -1; + * + * // Initialize simple rumble + * if (SDL_HapticRumbleInit( haptic ) != 0) + * return -1; + * + * // Play effect at 50% strength for 2 seconds + * if (SDL_HapticRumblePlay( haptic, 0.5, 2000 ) != 0) + * return -1; + * SDL_Delay( 2000 ); + * + * // Clean up + * SDL_HapticClose( haptic ); + * \endcode + * + * \par Complete example: + * \code + * int test_haptic( SDL_Joystick * joystick ) { + * SDL_Haptic *haptic; + * SDL_HapticEffect effect; + * int effect_id; + * + * // Open the device + * haptic = SDL_HapticOpenFromJoystick( joystick ); + * if (haptic == NULL) return -1; // Most likely joystick isn't haptic + * + * // See if it can do sine waves + * if ((SDL_HapticQuery(haptic) & SDL_HAPTIC_SINE)==0) { + * SDL_HapticClose(haptic); // No sine effect + * return -1; + * } + * + * // Create the effect + * memset( &effect, 0, sizeof(SDL_HapticEffect) ); // 0 is safe default + * effect.type = SDL_HAPTIC_SINE; + * effect.periodic.direction.type = SDL_HAPTIC_POLAR; // Polar coordinates + * effect.periodic.direction.dir[0] = 18000; // Force comes from south + * effect.periodic.period = 1000; // 1000 ms + * effect.periodic.magnitude = 20000; // 20000/32767 strength + * effect.periodic.length = 5000; // 5 seconds long + * effect.periodic.attack_length = 1000; // Takes 1 second to get max strength + * effect.periodic.fade_length = 1000; // Takes 1 second to fade away + * + * // Upload the effect + * effect_id = SDL_HapticNewEffect( haptic, &effect ); + * + * // Test the effect + * SDL_HapticRunEffect( haptic, effect_id, 1 ); + * SDL_Delay( 5000); // Wait for the effect to finish + * + * // We destroy the effect, although closing the device also does this + * SDL_HapticDestroyEffect( haptic, effect_id ); + * + * // Close the device + * SDL_HapticClose(haptic); + * + * return 0; // Success + * } + * \endcode + */ + +#ifndef SDL_haptic_h_ +#define SDL_haptic_h_ + +#include "SDL_stdinc.h" +#include "SDL_error.h" +#include "SDL_joystick.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* FIXME: For SDL 2.1, adjust all the magnitude variables to be Uint16 (0xFFFF). + * + * At the moment the magnitude variables are mixed between signed/unsigned, and + * it is also not made clear that ALL of those variables expect a max of 0x7FFF. + * + * Some platforms may have higher precision than that (Linux FF, Windows XInput) + * so we should fix the inconsistency in favor of higher possible precision, + * adjusting for platforms that use different scales. + * -flibit + */ + +/** + * \typedef SDL_Haptic + * + * \brief The haptic structure used to identify an SDL haptic. + * + * \sa SDL_HapticOpen + * \sa SDL_HapticOpenFromJoystick + * \sa SDL_HapticClose + */ +struct _SDL_Haptic; +typedef struct _SDL_Haptic SDL_Haptic; + + +/** + * \name Haptic features + * + * Different haptic features a device can have. + */ +/* @{ */ + +/** + * \name Haptic effects + */ +/* @{ */ + +/** + * \brief Constant effect supported. + * + * Constant haptic effect. + * + * \sa SDL_HapticCondition + */ +#define SDL_HAPTIC_CONSTANT (1u<<0) + +/** + * \brief Sine wave effect supported. + * + * Periodic haptic effect that simulates sine waves. + * + * \sa SDL_HapticPeriodic + */ +#define SDL_HAPTIC_SINE (1u<<1) + +/** + * \brief Left/Right effect supported. + * + * Haptic effect for direct control over high/low frequency motors. + * + * \sa SDL_HapticLeftRight + * \warning this value was SDL_HAPTIC_SQUARE right before 2.0.0 shipped. Sorry, + * we ran out of bits, and this is important for XInput devices. + */ +#define SDL_HAPTIC_LEFTRIGHT (1u<<2) + +/* !!! FIXME: put this back when we have more bits in 2.1 */ +/* #define SDL_HAPTIC_SQUARE (1<<2) */ + +/** + * \brief Triangle wave effect supported. + * + * Periodic haptic effect that simulates triangular waves. + * + * \sa SDL_HapticPeriodic + */ +#define SDL_HAPTIC_TRIANGLE (1u<<3) + +/** + * \brief Sawtoothup wave effect supported. + * + * Periodic haptic effect that simulates saw tooth up waves. + * + * \sa SDL_HapticPeriodic + */ +#define SDL_HAPTIC_SAWTOOTHUP (1u<<4) + +/** + * \brief Sawtoothdown wave effect supported. + * + * Periodic haptic effect that simulates saw tooth down waves. + * + * \sa SDL_HapticPeriodic + */ +#define SDL_HAPTIC_SAWTOOTHDOWN (1u<<5) + +/** + * \brief Ramp effect supported. + * + * Ramp haptic effect. + * + * \sa SDL_HapticRamp + */ +#define SDL_HAPTIC_RAMP (1u<<6) + +/** + * \brief Spring effect supported - uses axes position. + * + * Condition haptic effect that simulates a spring. Effect is based on the + * axes position. + * + * \sa SDL_HapticCondition + */ +#define SDL_HAPTIC_SPRING (1u<<7) + +/** + * \brief Damper effect supported - uses axes velocity. + * + * Condition haptic effect that simulates dampening. Effect is based on the + * axes velocity. + * + * \sa SDL_HapticCondition + */ +#define SDL_HAPTIC_DAMPER (1u<<8) + +/** + * \brief Inertia effect supported - uses axes acceleration. + * + * Condition haptic effect that simulates inertia. Effect is based on the axes + * acceleration. + * + * \sa SDL_HapticCondition + */ +#define SDL_HAPTIC_INERTIA (1u<<9) + +/** + * \brief Friction effect supported - uses axes movement. + * + * Condition haptic effect that simulates friction. Effect is based on the + * axes movement. + * + * \sa SDL_HapticCondition + */ +#define SDL_HAPTIC_FRICTION (1u<<10) + +/** + * \brief Custom effect is supported. + * + * User defined custom haptic effect. + */ +#define SDL_HAPTIC_CUSTOM (1u<<11) + +/* @} *//* Haptic effects */ + +/* These last few are features the device has, not effects */ + +/** + * \brief Device can set global gain. + * + * Device supports setting the global gain. + * + * \sa SDL_HapticSetGain + */ +#define SDL_HAPTIC_GAIN (1u<<12) + +/** + * \brief Device can set autocenter. + * + * Device supports setting autocenter. + * + * \sa SDL_HapticSetAutocenter + */ +#define SDL_HAPTIC_AUTOCENTER (1u<<13) + +/** + * \brief Device can be queried for effect status. + * + * Device supports querying effect status. + * + * \sa SDL_HapticGetEffectStatus + */ +#define SDL_HAPTIC_STATUS (1u<<14) + +/** + * \brief Device can be paused. + * + * Devices supports being paused. + * + * \sa SDL_HapticPause + * \sa SDL_HapticUnpause + */ +#define SDL_HAPTIC_PAUSE (1u<<15) + + +/** + * \name Direction encodings + */ +/* @{ */ + +/** + * \brief Uses polar coordinates for the direction. + * + * \sa SDL_HapticDirection + */ +#define SDL_HAPTIC_POLAR 0 + +/** + * \brief Uses cartesian coordinates for the direction. + * + * \sa SDL_HapticDirection + */ +#define SDL_HAPTIC_CARTESIAN 1 + +/** + * \brief Uses spherical coordinates for the direction. + * + * \sa SDL_HapticDirection + */ +#define SDL_HAPTIC_SPHERICAL 2 + +/** + * \brief Use this value to play an effect on the steering wheel axis. This + * provides better compatibility across platforms and devices as SDL will guess + * the correct axis. + * \sa SDL_HapticDirection + */ +#define SDL_HAPTIC_STEERING_AXIS 3 + +/* @} *//* Direction encodings */ + +/* @} *//* Haptic features */ + +/* + * Misc defines. + */ + +/** + * \brief Used to play a device an infinite number of times. + * + * \sa SDL_HapticRunEffect + */ +#define SDL_HAPTIC_INFINITY 4294967295U + + +/** + * \brief Structure that represents a haptic direction. + * + * This is the direction where the force comes from, + * instead of the direction in which the force is exerted. + * + * Directions can be specified by: + * - ::SDL_HAPTIC_POLAR : Specified by polar coordinates. + * - ::SDL_HAPTIC_CARTESIAN : Specified by cartesian coordinates. + * - ::SDL_HAPTIC_SPHERICAL : Specified by spherical coordinates. + * + * Cardinal directions of the haptic device are relative to the positioning + * of the device. North is considered to be away from the user. + * + * The following diagram represents the cardinal directions: + * \verbatim + .--. + |__| .-------. + |=.| |.-----.| + |--| || || + | | |'-----'| + |__|~')_____(' + [ COMPUTER ] + + + North (0,-1) + ^ + | + | + (-1,0) West <----[ HAPTIC ]----> East (1,0) + | + | + v + South (0,1) + + + [ USER ] + \|||/ + (o o) + ---ooO-(_)-Ooo--- + \endverbatim + * + * If type is ::SDL_HAPTIC_POLAR, direction is encoded by hundredths of a + * degree starting north and turning clockwise. ::SDL_HAPTIC_POLAR only uses + * the first \c dir parameter. The cardinal directions would be: + * - North: 0 (0 degrees) + * - East: 9000 (90 degrees) + * - South: 18000 (180 degrees) + * - West: 27000 (270 degrees) + * + * If type is ::SDL_HAPTIC_CARTESIAN, direction is encoded by three positions + * (X axis, Y axis and Z axis (with 3 axes)). ::SDL_HAPTIC_CARTESIAN uses + * the first three \c dir parameters. The cardinal directions would be: + * - North: 0,-1, 0 + * - East: 1, 0, 0 + * - South: 0, 1, 0 + * - West: -1, 0, 0 + * + * The Z axis represents the height of the effect if supported, otherwise + * it's unused. In cartesian encoding (1, 2) would be the same as (2, 4), you + * can use any multiple you want, only the direction matters. + * + * If type is ::SDL_HAPTIC_SPHERICAL, direction is encoded by two rotations. + * The first two \c dir parameters are used. The \c dir parameters are as + * follows (all values are in hundredths of degrees): + * - Degrees from (1, 0) rotated towards (0, 1). + * - Degrees towards (0, 0, 1) (device needs at least 3 axes). + * + * + * Example of force coming from the south with all encodings (force coming + * from the south means the user will have to pull the stick to counteract): + * \code + * SDL_HapticDirection direction; + * + * // Cartesian directions + * direction.type = SDL_HAPTIC_CARTESIAN; // Using cartesian direction encoding. + * direction.dir[0] = 0; // X position + * direction.dir[1] = 1; // Y position + * // Assuming the device has 2 axes, we don't need to specify third parameter. + * + * // Polar directions + * direction.type = SDL_HAPTIC_POLAR; // We'll be using polar direction encoding. + * direction.dir[0] = 18000; // Polar only uses first parameter + * + * // Spherical coordinates + * direction.type = SDL_HAPTIC_SPHERICAL; // Spherical encoding + * direction.dir[0] = 9000; // Since we only have two axes we don't need more parameters. + * \endcode + * + * \sa SDL_HAPTIC_POLAR + * \sa SDL_HAPTIC_CARTESIAN + * \sa SDL_HAPTIC_SPHERICAL + * \sa SDL_HAPTIC_STEERING_AXIS + * \sa SDL_HapticEffect + * \sa SDL_HapticNumAxes + */ +typedef struct SDL_HapticDirection +{ + Uint8 type; /**< The type of encoding. */ + Sint32 dir[3]; /**< The encoded direction. */ +} SDL_HapticDirection; + + +/** + * \brief A structure containing a template for a Constant effect. + * + * This struct is exclusively for the ::SDL_HAPTIC_CONSTANT effect. + * + * A constant effect applies a constant force in the specified direction + * to the joystick. + * + * \sa SDL_HAPTIC_CONSTANT + * \sa SDL_HapticEffect + */ +typedef struct SDL_HapticConstant +{ + /* Header */ + Uint16 type; /**< ::SDL_HAPTIC_CONSTANT */ + SDL_HapticDirection direction; /**< Direction of the effect. */ + + /* Replay */ + Uint32 length; /**< Duration of the effect. */ + Uint16 delay; /**< Delay before starting the effect. */ + + /* Trigger */ + Uint16 button; /**< Button that triggers the effect. */ + Uint16 interval; /**< How soon it can be triggered again after button. */ + + /* Constant */ + Sint16 level; /**< Strength of the constant effect. */ + + /* Envelope */ + Uint16 attack_length; /**< Duration of the attack. */ + Uint16 attack_level; /**< Level at the start of the attack. */ + Uint16 fade_length; /**< Duration of the fade. */ + Uint16 fade_level; /**< Level at the end of the fade. */ +} SDL_HapticConstant; + +/** + * \brief A structure containing a template for a Periodic effect. + * + * The struct handles the following effects: + * - ::SDL_HAPTIC_SINE + * - ::SDL_HAPTIC_LEFTRIGHT + * - ::SDL_HAPTIC_TRIANGLE + * - ::SDL_HAPTIC_SAWTOOTHUP + * - ::SDL_HAPTIC_SAWTOOTHDOWN + * + * A periodic effect consists in a wave-shaped effect that repeats itself + * over time. The type determines the shape of the wave and the parameters + * determine the dimensions of the wave. + * + * Phase is given by hundredth of a degree meaning that giving the phase a value + * of 9000 will displace it 25% of its period. Here are sample values: + * - 0: No phase displacement. + * - 9000: Displaced 25% of its period. + * - 18000: Displaced 50% of its period. + * - 27000: Displaced 75% of its period. + * - 36000: Displaced 100% of its period, same as 0, but 0 is preferred. + * + * Examples: + * \verbatim + SDL_HAPTIC_SINE + __ __ __ __ + / \ / \ / \ / + / \__/ \__/ \__/ + + SDL_HAPTIC_SQUARE + __ __ __ __ __ + | | | | | | | | | | + | |__| |__| |__| |__| | + + SDL_HAPTIC_TRIANGLE + /\ /\ /\ /\ /\ + / \ / \ / \ / \ / + / \/ \/ \/ \/ + + SDL_HAPTIC_SAWTOOTHUP + /| /| /| /| /| /| /| + / | / | / | / | / | / | / | + / |/ |/ |/ |/ |/ |/ | + + SDL_HAPTIC_SAWTOOTHDOWN + \ |\ |\ |\ |\ |\ |\ | + \ | \ | \ | \ | \ | \ | \ | + \| \| \| \| \| \| \| + \endverbatim + * + * \sa SDL_HAPTIC_SINE + * \sa SDL_HAPTIC_LEFTRIGHT + * \sa SDL_HAPTIC_TRIANGLE + * \sa SDL_HAPTIC_SAWTOOTHUP + * \sa SDL_HAPTIC_SAWTOOTHDOWN + * \sa SDL_HapticEffect + */ +typedef struct SDL_HapticPeriodic +{ + /* Header */ + Uint16 type; /**< ::SDL_HAPTIC_SINE, ::SDL_HAPTIC_LEFTRIGHT, + ::SDL_HAPTIC_TRIANGLE, ::SDL_HAPTIC_SAWTOOTHUP or + ::SDL_HAPTIC_SAWTOOTHDOWN */ + SDL_HapticDirection direction; /**< Direction of the effect. */ + + /* Replay */ + Uint32 length; /**< Duration of the effect. */ + Uint16 delay; /**< Delay before starting the effect. */ + + /* Trigger */ + Uint16 button; /**< Button that triggers the effect. */ + Uint16 interval; /**< How soon it can be triggered again after button. */ + + /* Periodic */ + Uint16 period; /**< Period of the wave. */ + Sint16 magnitude; /**< Peak value; if negative, equivalent to 180 degrees extra phase shift. */ + Sint16 offset; /**< Mean value of the wave. */ + Uint16 phase; /**< Positive phase shift given by hundredth of a degree. */ + + /* Envelope */ + Uint16 attack_length; /**< Duration of the attack. */ + Uint16 attack_level; /**< Level at the start of the attack. */ + Uint16 fade_length; /**< Duration of the fade. */ + Uint16 fade_level; /**< Level at the end of the fade. */ +} SDL_HapticPeriodic; + +/** + * \brief A structure containing a template for a Condition effect. + * + * The struct handles the following effects: + * - ::SDL_HAPTIC_SPRING: Effect based on axes position. + * - ::SDL_HAPTIC_DAMPER: Effect based on axes velocity. + * - ::SDL_HAPTIC_INERTIA: Effect based on axes acceleration. + * - ::SDL_HAPTIC_FRICTION: Effect based on axes movement. + * + * Direction is handled by condition internals instead of a direction member. + * The condition effect specific members have three parameters. The first + * refers to the X axis, the second refers to the Y axis and the third + * refers to the Z axis. The right terms refer to the positive side of the + * axis and the left terms refer to the negative side of the axis. Please + * refer to the ::SDL_HapticDirection diagram for which side is positive and + * which is negative. + * + * \sa SDL_HapticDirection + * \sa SDL_HAPTIC_SPRING + * \sa SDL_HAPTIC_DAMPER + * \sa SDL_HAPTIC_INERTIA + * \sa SDL_HAPTIC_FRICTION + * \sa SDL_HapticEffect + */ +typedef struct SDL_HapticCondition +{ + /* Header */ + Uint16 type; /**< ::SDL_HAPTIC_SPRING, ::SDL_HAPTIC_DAMPER, + ::SDL_HAPTIC_INERTIA or ::SDL_HAPTIC_FRICTION */ + SDL_HapticDirection direction; /**< Direction of the effect - Not used ATM. */ + + /* Replay */ + Uint32 length; /**< Duration of the effect. */ + Uint16 delay; /**< Delay before starting the effect. */ + + /* Trigger */ + Uint16 button; /**< Button that triggers the effect. */ + Uint16 interval; /**< How soon it can be triggered again after button. */ + + /* Condition */ + Uint16 right_sat[3]; /**< Level when joystick is to the positive side; max 0xFFFF. */ + Uint16 left_sat[3]; /**< Level when joystick is to the negative side; max 0xFFFF. */ + Sint16 right_coeff[3]; /**< How fast to increase the force towards the positive side. */ + Sint16 left_coeff[3]; /**< How fast to increase the force towards the negative side. */ + Uint16 deadband[3]; /**< Size of the dead zone; max 0xFFFF: whole axis-range when 0-centered. */ + Sint16 center[3]; /**< Position of the dead zone. */ +} SDL_HapticCondition; + +/** + * \brief A structure containing a template for a Ramp effect. + * + * This struct is exclusively for the ::SDL_HAPTIC_RAMP effect. + * + * The ramp effect starts at start strength and ends at end strength. + * It augments in linear fashion. If you use attack and fade with a ramp + * the effects get added to the ramp effect making the effect become + * quadratic instead of linear. + * + * \sa SDL_HAPTIC_RAMP + * \sa SDL_HapticEffect + */ +typedef struct SDL_HapticRamp +{ + /* Header */ + Uint16 type; /**< ::SDL_HAPTIC_RAMP */ + SDL_HapticDirection direction; /**< Direction of the effect. */ + + /* Replay */ + Uint32 length; /**< Duration of the effect. */ + Uint16 delay; /**< Delay before starting the effect. */ + + /* Trigger */ + Uint16 button; /**< Button that triggers the effect. */ + Uint16 interval; /**< How soon it can be triggered again after button. */ + + /* Ramp */ + Sint16 start; /**< Beginning strength level. */ + Sint16 end; /**< Ending strength level. */ + + /* Envelope */ + Uint16 attack_length; /**< Duration of the attack. */ + Uint16 attack_level; /**< Level at the start of the attack. */ + Uint16 fade_length; /**< Duration of the fade. */ + Uint16 fade_level; /**< Level at the end of the fade. */ +} SDL_HapticRamp; + +/** + * \brief A structure containing a template for a Left/Right effect. + * + * This struct is exclusively for the ::SDL_HAPTIC_LEFTRIGHT effect. + * + * The Left/Right effect is used to explicitly control the large and small + * motors, commonly found in modern game controllers. The small (right) motor + * is high frequency, and the large (left) motor is low frequency. + * + * \sa SDL_HAPTIC_LEFTRIGHT + * \sa SDL_HapticEffect + */ +typedef struct SDL_HapticLeftRight +{ + /* Header */ + Uint16 type; /**< ::SDL_HAPTIC_LEFTRIGHT */ + + /* Replay */ + Uint32 length; /**< Duration of the effect in milliseconds. */ + + /* Rumble */ + Uint16 large_magnitude; /**< Control of the large controller motor. */ + Uint16 small_magnitude; /**< Control of the small controller motor. */ +} SDL_HapticLeftRight; + +/** + * \brief A structure containing a template for the ::SDL_HAPTIC_CUSTOM effect. + * + * This struct is exclusively for the ::SDL_HAPTIC_CUSTOM effect. + * + * A custom force feedback effect is much like a periodic effect, where the + * application can define its exact shape. You will have to allocate the + * data yourself. Data should consist of channels * samples Uint16 samples. + * + * If channels is one, the effect is rotated using the defined direction. + * Otherwise it uses the samples in data for the different axes. + * + * \sa SDL_HAPTIC_CUSTOM + * \sa SDL_HapticEffect + */ +typedef struct SDL_HapticCustom +{ + /* Header */ + Uint16 type; /**< ::SDL_HAPTIC_CUSTOM */ + SDL_HapticDirection direction; /**< Direction of the effect. */ + + /* Replay */ + Uint32 length; /**< Duration of the effect. */ + Uint16 delay; /**< Delay before starting the effect. */ + + /* Trigger */ + Uint16 button; /**< Button that triggers the effect. */ + Uint16 interval; /**< How soon it can be triggered again after button. */ + + /* Custom */ + Uint8 channels; /**< Axes to use, minimum of one. */ + Uint16 period; /**< Sample periods. */ + Uint16 samples; /**< Amount of samples. */ + Uint16 *data; /**< Should contain channels*samples items. */ + + /* Envelope */ + Uint16 attack_length; /**< Duration of the attack. */ + Uint16 attack_level; /**< Level at the start of the attack. */ + Uint16 fade_length; /**< Duration of the fade. */ + Uint16 fade_level; /**< Level at the end of the fade. */ +} SDL_HapticCustom; + +/** + * \brief The generic template for any haptic effect. + * + * All values max at 32767 (0x7FFF). Signed values also can be negative. + * Time values unless specified otherwise are in milliseconds. + * + * You can also pass ::SDL_HAPTIC_INFINITY to length instead of a 0-32767 + * value. Neither delay, interval, attack_length nor fade_length support + * ::SDL_HAPTIC_INFINITY. Fade will also not be used since effect never ends. + * + * Additionally, the ::SDL_HAPTIC_RAMP effect does not support a duration of + * ::SDL_HAPTIC_INFINITY. + * + * Button triggers may not be supported on all devices, it is advised to not + * use them if possible. Buttons start at index 1 instead of index 0 like + * the joystick. + * + * If both attack_length and fade_level are 0, the envelope is not used, + * otherwise both values are used. + * + * Common parts: + * \code + * // Replay - All effects have this + * Uint32 length; // Duration of effect (ms). + * Uint16 delay; // Delay before starting effect. + * + * // Trigger - All effects have this + * Uint16 button; // Button that triggers effect. + * Uint16 interval; // How soon before effect can be triggered again. + * + * // Envelope - All effects except condition effects have this + * Uint16 attack_length; // Duration of the attack (ms). + * Uint16 attack_level; // Level at the start of the attack. + * Uint16 fade_length; // Duration of the fade out (ms). + * Uint16 fade_level; // Level at the end of the fade. + * \endcode + * + * + * Here we have an example of a constant effect evolution in time: + * \verbatim + Strength + ^ + | + | effect level --> _________________ + | / \ + | / \ + | / \ + | / \ + | attack_level --> | \ + | | | <--- fade_level + | + +--------------------------------------------------> Time + [--] [---] + attack_length fade_length + + [------------------][-----------------------] + delay length + \endverbatim + * + * Note either the attack_level or the fade_level may be above the actual + * effect level. + * + * \sa SDL_HapticConstant + * \sa SDL_HapticPeriodic + * \sa SDL_HapticCondition + * \sa SDL_HapticRamp + * \sa SDL_HapticLeftRight + * \sa SDL_HapticCustom + */ +typedef union SDL_HapticEffect +{ + /* Common for all force feedback effects */ + Uint16 type; /**< Effect type. */ + SDL_HapticConstant constant; /**< Constant effect. */ + SDL_HapticPeriodic periodic; /**< Periodic effect. */ + SDL_HapticCondition condition; /**< Condition effect. */ + SDL_HapticRamp ramp; /**< Ramp effect. */ + SDL_HapticLeftRight leftright; /**< Left/Right effect. */ + SDL_HapticCustom custom; /**< Custom effect. */ +} SDL_HapticEffect; + + +/* Function prototypes */ +/** + * \brief Count the number of haptic devices attached to the system. + * + * \return Number of haptic devices detected on the system. + */ +extern DECLSPEC int SDLCALL SDL_NumHaptics(void); + +/** + * \brief Get the implementation dependent name of a haptic device. + * + * This can be called before any joysticks are opened. + * If no name can be found, this function returns NULL. + * + * \param device_index Index of the device to get its name. + * \return Name of the device or NULL on error. + * + * \sa SDL_NumHaptics + */ +extern DECLSPEC const char *SDLCALL SDL_HapticName(int device_index); + +/** + * \brief Opens a haptic device for use. + * + * The index passed as an argument refers to the N'th haptic device on this + * system. + * + * When opening a haptic device, its gain will be set to maximum and + * autocenter will be disabled. To modify these values use + * SDL_HapticSetGain() and SDL_HapticSetAutocenter(). + * + * \param device_index Index of the device to open. + * \return Device identifier or NULL on error. + * + * \sa SDL_HapticIndex + * \sa SDL_HapticOpenFromMouse + * \sa SDL_HapticOpenFromJoystick + * \sa SDL_HapticClose + * \sa SDL_HapticSetGain + * \sa SDL_HapticSetAutocenter + * \sa SDL_HapticPause + * \sa SDL_HapticStopAll + */ +extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpen(int device_index); + +/** + * \brief Checks if the haptic device at index has been opened. + * + * \param device_index Index to check to see if it has been opened. + * \return 1 if it has been opened or 0 if it hasn't. + * + * \sa SDL_HapticOpen + * \sa SDL_HapticIndex + */ +extern DECLSPEC int SDLCALL SDL_HapticOpened(int device_index); + +/** + * \brief Gets the index of a haptic device. + * + * \param haptic Haptic device to get the index of. + * \return The index of the haptic device or -1 on error. + * + * \sa SDL_HapticOpen + * \sa SDL_HapticOpened + */ +extern DECLSPEC int SDLCALL SDL_HapticIndex(SDL_Haptic * haptic); + +/** + * \brief Gets whether or not the current mouse has haptic capabilities. + * + * \return SDL_TRUE if the mouse is haptic, SDL_FALSE if it isn't. + * + * \sa SDL_HapticOpenFromMouse + */ +extern DECLSPEC int SDLCALL SDL_MouseIsHaptic(void); + +/** + * \brief Tries to open a haptic device from the current mouse. + * + * \return The haptic device identifier or NULL on error. + * + * \sa SDL_MouseIsHaptic + * \sa SDL_HapticOpen + */ +extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromMouse(void); + +/** + * \brief Checks to see if a joystick has haptic features. + * + * \param joystick Joystick to test for haptic capabilities. + * \return SDL_TRUE if the joystick is haptic, SDL_FALSE if it isn't + * or -1 if an error occurred. + * + * \sa SDL_HapticOpenFromJoystick + */ +extern DECLSPEC int SDLCALL SDL_JoystickIsHaptic(SDL_Joystick * joystick); + +/** + * \brief Opens a haptic device for use from a joystick device. + * + * You must still close the haptic device separately. It will not be closed + * with the joystick. + * + * When opening from a joystick you should first close the haptic device before + * closing the joystick device. If not, on some implementations the haptic + * device will also get unallocated and you'll be unable to use force feedback + * on that device. + * + * \param joystick Joystick to create a haptic device from. + * \return A valid haptic device identifier on success or NULL on error. + * + * \sa SDL_HapticOpen + * \sa SDL_HapticClose + */ +extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromJoystick(SDL_Joystick * + joystick); + +/** + * \brief Closes a haptic device previously opened with SDL_HapticOpen(). + * + * \param haptic Haptic device to close. + */ +extern DECLSPEC void SDLCALL SDL_HapticClose(SDL_Haptic * haptic); + +/** + * \brief Returns the number of effects a haptic device can store. + * + * On some platforms this isn't fully supported, and therefore is an + * approximation. Always check to see if your created effect was actually + * created and do not rely solely on SDL_HapticNumEffects(). + * + * \param haptic The haptic device to query effect max. + * \return The number of effects the haptic device can store or + * -1 on error. + * + * \sa SDL_HapticNumEffectsPlaying + * \sa SDL_HapticQuery + */ +extern DECLSPEC int SDLCALL SDL_HapticNumEffects(SDL_Haptic * haptic); + +/** + * \brief Returns the number of effects a haptic device can play at the same + * time. + * + * This is not supported on all platforms, but will always return a value. + * Added here for the sake of completeness. + * + * \param haptic The haptic device to query maximum playing effects. + * \return The number of effects the haptic device can play at the same time + * or -1 on error. + * + * \sa SDL_HapticNumEffects + * \sa SDL_HapticQuery + */ +extern DECLSPEC int SDLCALL SDL_HapticNumEffectsPlaying(SDL_Haptic * haptic); + +/** + * \brief Gets the haptic device's supported features in bitwise manner. + * + * Example: + * \code + * if (SDL_HapticQuery(haptic) & SDL_HAPTIC_CONSTANT) { + * printf("We have constant haptic effect!\n"); + * } + * \endcode + * + * \param haptic The haptic device to query. + * \return Haptic features in bitwise manner (OR'd). + * + * \sa SDL_HapticNumEffects + * \sa SDL_HapticEffectSupported + */ +extern DECLSPEC unsigned int SDLCALL SDL_HapticQuery(SDL_Haptic * haptic); + + +/** + * \brief Gets the number of haptic axes the device has. + * + * \sa SDL_HapticDirection + */ +extern DECLSPEC int SDLCALL SDL_HapticNumAxes(SDL_Haptic * haptic); + +/** + * \brief Checks to see if effect is supported by haptic. + * + * \param haptic Haptic device to check on. + * \param effect Effect to check to see if it is supported. + * \return SDL_TRUE if effect is supported, SDL_FALSE if it isn't or -1 on error. + * + * \sa SDL_HapticQuery + * \sa SDL_HapticNewEffect + */ +extern DECLSPEC int SDLCALL SDL_HapticEffectSupported(SDL_Haptic * haptic, + SDL_HapticEffect * + effect); + +/** + * \brief Creates a new haptic effect on the device. + * + * \param haptic Haptic device to create the effect on. + * \param effect Properties of the effect to create. + * \return The identifier of the effect on success or -1 on error. + * + * \sa SDL_HapticUpdateEffect + * \sa SDL_HapticRunEffect + * \sa SDL_HapticDestroyEffect + */ +extern DECLSPEC int SDLCALL SDL_HapticNewEffect(SDL_Haptic * haptic, + SDL_HapticEffect * effect); + +/** + * \brief Updates the properties of an effect. + * + * Can be used dynamically, although behavior when dynamically changing + * direction may be strange. Specifically the effect may reupload itself + * and start playing from the start. You cannot change the type either when + * running SDL_HapticUpdateEffect(). + * + * \param haptic Haptic device that has the effect. + * \param effect Identifier of the effect to update. + * \param data New effect properties to use. + * \return 0 on success or -1 on error. + * + * \sa SDL_HapticNewEffect + * \sa SDL_HapticRunEffect + * \sa SDL_HapticDestroyEffect + */ +extern DECLSPEC int SDLCALL SDL_HapticUpdateEffect(SDL_Haptic * haptic, + int effect, + SDL_HapticEffect * data); + +/** + * \brief Runs the haptic effect on its associated haptic device. + * + * If iterations are ::SDL_HAPTIC_INFINITY, it'll run the effect over and over + * repeating the envelope (attack and fade) every time. If you only want the + * effect to last forever, set ::SDL_HAPTIC_INFINITY in the effect's length + * parameter. + * + * \param haptic Haptic device to run the effect on. + * \param effect Identifier of the haptic effect to run. + * \param iterations Number of iterations to run the effect. Use + * ::SDL_HAPTIC_INFINITY for infinity. + * \return 0 on success or -1 on error. + * + * \sa SDL_HapticStopEffect + * \sa SDL_HapticDestroyEffect + * \sa SDL_HapticGetEffectStatus + */ +extern DECLSPEC int SDLCALL SDL_HapticRunEffect(SDL_Haptic * haptic, + int effect, + Uint32 iterations); + +/** + * \brief Stops the haptic effect on its associated haptic device. + * + * \param haptic Haptic device to stop the effect on. + * \param effect Identifier of the effect to stop. + * \return 0 on success or -1 on error. + * + * \sa SDL_HapticRunEffect + * \sa SDL_HapticDestroyEffect + */ +extern DECLSPEC int SDLCALL SDL_HapticStopEffect(SDL_Haptic * haptic, + int effect); + +/** + * \brief Destroys a haptic effect on the device. + * + * This will stop the effect if it's running. Effects are automatically + * destroyed when the device is closed. + * + * \param haptic Device to destroy the effect on. + * \param effect Identifier of the effect to destroy. + * + * \sa SDL_HapticNewEffect + */ +extern DECLSPEC void SDLCALL SDL_HapticDestroyEffect(SDL_Haptic * haptic, + int effect); + +/** + * \brief Gets the status of the current effect on the haptic device. + * + * Device must support the ::SDL_HAPTIC_STATUS feature. + * + * \param haptic Haptic device to query the effect status on. + * \param effect Identifier of the effect to query its status. + * \return 0 if it isn't playing, 1 if it is playing or -1 on error. + * + * \sa SDL_HapticRunEffect + * \sa SDL_HapticStopEffect + */ +extern DECLSPEC int SDLCALL SDL_HapticGetEffectStatus(SDL_Haptic * haptic, + int effect); + +/** + * \brief Sets the global gain of the device. + * + * Device must support the ::SDL_HAPTIC_GAIN feature. + * + * The user may specify the maximum gain by setting the environment variable + * SDL_HAPTIC_GAIN_MAX which should be between 0 and 100. All calls to + * SDL_HapticSetGain() will scale linearly using SDL_HAPTIC_GAIN_MAX as the + * maximum. + * + * \param haptic Haptic device to set the gain on. + * \param gain Value to set the gain to, should be between 0 and 100. + * \return 0 on success or -1 on error. + * + * \sa SDL_HapticQuery + */ +extern DECLSPEC int SDLCALL SDL_HapticSetGain(SDL_Haptic * haptic, int gain); + +/** + * \brief Sets the global autocenter of the device. + * + * Autocenter should be between 0 and 100. Setting it to 0 will disable + * autocentering. + * + * Device must support the ::SDL_HAPTIC_AUTOCENTER feature. + * + * \param haptic Haptic device to set autocentering on. + * \param autocenter Value to set autocenter to, 0 disables autocentering. + * \return 0 on success or -1 on error. + * + * \sa SDL_HapticQuery + */ +extern DECLSPEC int SDLCALL SDL_HapticSetAutocenter(SDL_Haptic * haptic, + int autocenter); + +/** + * \brief Pauses a haptic device. + * + * Device must support the ::SDL_HAPTIC_PAUSE feature. Call + * SDL_HapticUnpause() to resume playback. + * + * Do not modify the effects nor add new ones while the device is paused. + * That can cause all sorts of weird errors. + * + * \param haptic Haptic device to pause. + * \return 0 on success or -1 on error. + * + * \sa SDL_HapticUnpause + */ +extern DECLSPEC int SDLCALL SDL_HapticPause(SDL_Haptic * haptic); + +/** + * \brief Unpauses a haptic device. + * + * Call to unpause after SDL_HapticPause(). + * + * \param haptic Haptic device to unpause. + * \return 0 on success or -1 on error. + * + * \sa SDL_HapticPause + */ +extern DECLSPEC int SDLCALL SDL_HapticUnpause(SDL_Haptic * haptic); + +/** + * \brief Stops all the currently playing effects on a haptic device. + * + * \param haptic Haptic device to stop. + * \return 0 on success or -1 on error. + */ +extern DECLSPEC int SDLCALL SDL_HapticStopAll(SDL_Haptic * haptic); + +/** + * \brief Checks to see if rumble is supported on a haptic device. + * + * \param haptic Haptic device to check to see if it supports rumble. + * \return SDL_TRUE if effect is supported, SDL_FALSE if it isn't or -1 on error. + * + * \sa SDL_HapticRumbleInit + * \sa SDL_HapticRumblePlay + * \sa SDL_HapticRumbleStop + */ +extern DECLSPEC int SDLCALL SDL_HapticRumbleSupported(SDL_Haptic * haptic); + +/** + * \brief Initializes the haptic device for simple rumble playback. + * + * \param haptic Haptic device to initialize for simple rumble playback. + * \return 0 on success or -1 on error. + * + * \sa SDL_HapticOpen + * \sa SDL_HapticRumbleSupported + * \sa SDL_HapticRumblePlay + * \sa SDL_HapticRumbleStop + */ +extern DECLSPEC int SDLCALL SDL_HapticRumbleInit(SDL_Haptic * haptic); + +/** + * \brief Runs simple rumble on a haptic device + * + * \param haptic Haptic device to play rumble effect on. + * \param strength Strength of the rumble to play as a 0-1 float value. + * \param length Length of the rumble to play in milliseconds. + * \return 0 on success or -1 on error. + * + * \sa SDL_HapticRumbleSupported + * \sa SDL_HapticRumbleInit + * \sa SDL_HapticRumbleStop + */ +extern DECLSPEC int SDLCALL SDL_HapticRumblePlay(SDL_Haptic * haptic, float strength, Uint32 length ); + +/** + * \brief Stops the simple rumble on a haptic device. + * + * \param haptic Haptic to stop the rumble on. + * \return 0 on success or -1 on error. + * + * \sa SDL_HapticRumbleSupported + * \sa SDL_HapticRumbleInit + * \sa SDL_HapticRumblePlay + */ +extern DECLSPEC int SDLCALL SDL_HapticRumbleStop(SDL_Haptic * haptic); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_haptic_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_hints.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_hints.h new file mode 100644 index 0000000..50a5a08 --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_hints.h @@ -0,0 +1,1578 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_hints.h + * + * Official documentation for SDL configuration variables + * + * This file contains functions to set and get configuration hints, + * as well as listing each of them alphabetically. + * + * The convention for naming hints is SDL_HINT_X, where "SDL_X" is + * the environment variable that can be used to override the default. + * + * In general these hints are just that - they may or may not be + * supported or applicable on any given platform, but they provide + * a way for an application or user to give the library a hint as + * to how they would like the library to work. + */ + +#ifndef SDL_hints_h_ +#define SDL_hints_h_ + +#include "SDL_stdinc.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \brief A variable controlling how 3D acceleration is used to accelerate the SDL screen surface. + * + * SDL can try to accelerate the SDL screen surface by using streaming + * textures with a 3D rendering engine. This variable controls whether and + * how this is done. + * + * This variable can be set to the following values: + * "0" - Disable 3D acceleration + * "1" - Enable 3D acceleration, using the default renderer. + * "X" - Enable 3D acceleration, using X where X is one of the valid rendering drivers. (e.g. "direct3d", "opengl", etc.) + * + * By default SDL tries to make a best guess for each platform whether + * to use acceleration or not. + */ +#define SDL_HINT_FRAMEBUFFER_ACCELERATION "SDL_FRAMEBUFFER_ACCELERATION" + +/** + * \brief A variable specifying which render driver to use. + * + * If the application doesn't pick a specific renderer to use, this variable + * specifies the name of the preferred renderer. If the preferred renderer + * can't be initialized, the normal default renderer is used. + * + * This variable is case insensitive and can be set to the following values: + * "direct3d" + * "opengl" + * "opengles2" + * "opengles" + * "metal" + * "software" + * + * The default varies by platform, but it's the first one in the list that + * is available on the current platform. + */ +#define SDL_HINT_RENDER_DRIVER "SDL_RENDER_DRIVER" + +/** + * \brief A variable controlling whether the OpenGL render driver uses shaders if they are available. + * + * This variable can be set to the following values: + * "0" - Disable shaders + * "1" - Enable shaders + * + * By default shaders are used if OpenGL supports them. + */ +#define SDL_HINT_RENDER_OPENGL_SHADERS "SDL_RENDER_OPENGL_SHADERS" + +/** + * \brief A variable controlling whether the Direct3D device is initialized for thread-safe operations. + * + * This variable can be set to the following values: + * "0" - Thread-safety is not enabled (faster) + * "1" - Thread-safety is enabled + * + * By default the Direct3D device is created with thread-safety disabled. + */ +#define SDL_HINT_RENDER_DIRECT3D_THREADSAFE "SDL_RENDER_DIRECT3D_THREADSAFE" + +/** + * \brief A variable controlling whether to enable Direct3D 11+'s Debug Layer. + * + * This variable does not have any effect on the Direct3D 9 based renderer. + * + * This variable can be set to the following values: + * "0" - Disable Debug Layer use + * "1" - Enable Debug Layer use + * + * By default, SDL does not use Direct3D Debug Layer. + */ +#define SDL_HINT_RENDER_DIRECT3D11_DEBUG "SDL_RENDER_DIRECT3D11_DEBUG" + +/** + * \brief A variable controlling the scaling policy for SDL_RenderSetLogicalSize. + * + * This variable can be set to the following values: + * "0" or "letterbox" - Uses letterbox/sidebars to fit the entire rendering on screen + * "1" or "overscan" - Will zoom the rendering so it fills the entire screen, allowing edges to be drawn offscreen + * + * By default letterbox is used + */ +#define SDL_HINT_RENDER_LOGICAL_SIZE_MODE "SDL_RENDER_LOGICAL_SIZE_MODE" + +/** + * \brief A variable controlling the scaling quality + * + * This variable can be set to the following values: + * "0" or "nearest" - Nearest pixel sampling + * "1" or "linear" - Linear filtering (supported by OpenGL and Direct3D) + * "2" or "best" - Currently this is the same as "linear" + * + * By default nearest pixel sampling is used + */ +#define SDL_HINT_RENDER_SCALE_QUALITY "SDL_RENDER_SCALE_QUALITY" + +/** + * \brief A variable controlling whether updates to the SDL screen surface should be synchronized with the vertical refresh, to avoid tearing. + * + * This variable can be set to the following values: + * "0" - Disable vsync + * "1" - Enable vsync + * + * By default SDL does not sync screen surface updates with vertical refresh. + */ +#define SDL_HINT_RENDER_VSYNC "SDL_RENDER_VSYNC" + +/** + * \brief A variable controlling whether the screensaver is enabled. + * + * This variable can be set to the following values: + * "0" - Disable screensaver + * "1" - Enable screensaver + * + * By default SDL will disable the screensaver. + */ +#define SDL_HINT_VIDEO_ALLOW_SCREENSAVER "SDL_VIDEO_ALLOW_SCREENSAVER" + +/** + * \brief A variable controlling whether the graphics context is externally managed. + * + * This variable can be set to the following values: + * "0" - SDL will manage graphics contexts that are attached to windows. + * "1" - Disable graphics context management on windows. + * + * By default SDL will manage OpenGL contexts in certain situations. For example, on Android the + * context will be automatically saved and restored when pausing the application. Additionally, some + * platforms will assume usage of OpenGL if Vulkan isn't used. Setting this to "1" will prevent this + * behavior, which is desireable when the application manages the graphics context, such as + * an externally managed OpenGL context or attaching a Vulkan surface to the window. + */ +#define SDL_HINT_VIDEO_EXTERNAL_CONTEXT "SDL_VIDEO_EXTERNAL_CONTEXT" + +/** + * \brief A variable controlling whether the X11 VidMode extension should be used. + * + * This variable can be set to the following values: + * "0" - Disable XVidMode + * "1" - Enable XVidMode + * + * By default SDL will use XVidMode if it is available. + */ +#define SDL_HINT_VIDEO_X11_XVIDMODE "SDL_VIDEO_X11_XVIDMODE" + +/** + * \brief A variable controlling whether the X11 Xinerama extension should be used. + * + * This variable can be set to the following values: + * "0" - Disable Xinerama + * "1" - Enable Xinerama + * + * By default SDL will use Xinerama if it is available. + */ +#define SDL_HINT_VIDEO_X11_XINERAMA "SDL_VIDEO_X11_XINERAMA" + +/** + * \brief A variable controlling whether the X11 XRandR extension should be used. + * + * This variable can be set to the following values: + * "0" - Disable XRandR + * "1" - Enable XRandR + * + * By default SDL will not use XRandR because of window manager issues. + */ +#define SDL_HINT_VIDEO_X11_XRANDR "SDL_VIDEO_X11_XRANDR" + +/** + * \brief A variable forcing the visual ID chosen for new X11 windows + * + */ +#define SDL_HINT_VIDEO_X11_WINDOW_VISUALID "SDL_VIDEO_X11_WINDOW_VISUALID" + +/** + * \brief A variable controlling whether the X11 _NET_WM_PING protocol should be supported. + * + * This variable can be set to the following values: + * "0" - Disable _NET_WM_PING + * "1" - Enable _NET_WM_PING + * + * By default SDL will use _NET_WM_PING, but for applications that know they + * will not always be able to respond to ping requests in a timely manner they can + * turn it off to avoid the window manager thinking the app is hung. + * The hint is checked in CreateWindow. + */ +#define SDL_HINT_VIDEO_X11_NET_WM_PING "SDL_VIDEO_X11_NET_WM_PING" + +/** + * \brief A variable controlling whether the X11 _NET_WM_BYPASS_COMPOSITOR hint should be used. + * + * This variable can be set to the following values: + * "0" - Disable _NET_WM_BYPASS_COMPOSITOR + * "1" - Enable _NET_WM_BYPASS_COMPOSITOR + * + * By default SDL will use _NET_WM_BYPASS_COMPOSITOR + * + */ +#define SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR "SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR" + +/** + * \brief A variable controlling whether X11 should use GLX or EGL by default + * + * This variable can be set to the following values: + * "0" - Use GLX + * "1" - Use EGL + * + * By default SDL will use GLX when both are present. + */ +#define SDL_HINT_VIDEO_X11_FORCE_EGL "SDL_VIDEO_X11_FORCE_EGL" + +/** + * \brief A variable controlling whether the window frame and title bar are interactive when the cursor is hidden + * + * This variable can be set to the following values: + * "0" - The window frame is not interactive when the cursor is hidden (no move, resize, etc) + * "1" - The window frame is interactive when the cursor is hidden + * + * By default SDL will allow interaction with the window frame when the cursor is hidden + */ +#define SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN "SDL_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN" + +/** + * \brief A variable to specify custom icon resource id from RC file on Windows platform + */ +#define SDL_HINT_WINDOWS_INTRESOURCE_ICON "SDL_WINDOWS_INTRESOURCE_ICON" +#define SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL "SDL_WINDOWS_INTRESOURCE_ICON_SMALL" + +/** + * \brief A variable controlling whether the windows message loop is processed by SDL + * + * This variable can be set to the following values: + * "0" - The window message loop is not run + * "1" - The window message loop is processed in SDL_PumpEvents() + * + * By default SDL will process the windows message loop + */ +#define SDL_HINT_WINDOWS_ENABLE_MESSAGELOOP "SDL_WINDOWS_ENABLE_MESSAGELOOP" + +/** + * \brief A variable controlling whether grabbing input grabs the keyboard + * + * This variable can be set to the following values: + * "0" - Grab will affect only the mouse + * "1" - Grab will affect mouse and keyboard + * + * By default SDL will not grab the keyboard so system shortcuts still work. + */ +#define SDL_HINT_GRAB_KEYBOARD "SDL_GRAB_KEYBOARD" + +/** + * \brief A variable setting the double click time, in milliseconds. + */ +#define SDL_HINT_MOUSE_DOUBLE_CLICK_TIME "SDL_MOUSE_DOUBLE_CLICK_TIME" + +/** + * \brief A variable setting the double click radius, in pixels. + */ +#define SDL_HINT_MOUSE_DOUBLE_CLICK_RADIUS "SDL_MOUSE_DOUBLE_CLICK_RADIUS" + +/** + * \brief A variable setting the speed scale for mouse motion, in floating point, when the mouse is not in relative mode + */ +#define SDL_HINT_MOUSE_NORMAL_SPEED_SCALE "SDL_MOUSE_NORMAL_SPEED_SCALE" + +/** + * \brief A variable setting the scale for mouse motion, in floating point, when the mouse is in relative mode + */ +#define SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE "SDL_MOUSE_RELATIVE_SPEED_SCALE" + +/** + * \brief A variable controlling whether relative mouse motion is affected by renderer scaling + * + * This variable can be set to the following values: + * "0" - Relative motion is unaffected by DPI or renderer's logical size + * "1" - Relative motion is scaled according to DPI scaling and logical size + * + * By default relative mouse deltas are affected by DPI and renderer scaling + */ +#define SDL_HINT_MOUSE_RELATIVE_SCALING "SDL_MOUSE_RELATIVE_SCALING" + +/** + * \brief A variable controlling whether relative mouse mode is implemented using mouse warping + * + * This variable can be set to the following values: + * "0" - Relative mouse mode uses raw input + * "1" - Relative mouse mode uses mouse warping + * + * By default SDL will use raw input for relative mouse mode + */ +#define SDL_HINT_MOUSE_RELATIVE_MODE_WARP "SDL_MOUSE_RELATIVE_MODE_WARP" + +/** + * \brief Allow mouse click events when clicking to focus an SDL window + * + * This variable can be set to the following values: + * "0" - Ignore mouse clicks that activate a window + * "1" - Generate events for mouse clicks that activate a window + * + * By default SDL will ignore mouse clicks that activate a window + */ +#define SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH "SDL_MOUSE_FOCUS_CLICKTHROUGH" + +/** + * \brief A variable controlling whether touch events should generate synthetic mouse events + * + * This variable can be set to the following values: + * "0" - Touch events will not generate mouse events + * "1" - Touch events will generate mouse events + * + * By default SDL will generate mouse events for touch events + */ +#define SDL_HINT_TOUCH_MOUSE_EVENTS "SDL_TOUCH_MOUSE_EVENTS" + +/** + * \brief A variable controlling whether mouse events should generate synthetic touch events + * + * This variable can be set to the following values: + * "0" - Mouse events will not generate touch events (default for desktop platforms) + * "1" - Mouse events will generate touch events (default for mobile platforms, such as Android and iOS) + */ + +#define SDL_HINT_MOUSE_TOUCH_EVENTS "SDL_MOUSE_TOUCH_EVENTS" + +/** + * \brief Minimize your SDL_Window if it loses key focus when in fullscreen mode. Defaults to false. + * \warning Before SDL 2.0.14, this defaulted to true! In 2.0.14, we're + * seeing if "true" causes more problems than it solves in modern times. + * + */ +#define SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS "SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS" + +/** + * \brief A variable controlling whether the idle timer is disabled on iOS. + * + * When an iOS app does not receive touches for some time, the screen is + * dimmed automatically. For games where the accelerometer is the only input + * this is problematic. This functionality can be disabled by setting this + * hint. + * + * As of SDL 2.0.4, SDL_EnableScreenSaver() and SDL_DisableScreenSaver() + * accomplish the same thing on iOS. They should be preferred over this hint. + * + * This variable can be set to the following values: + * "0" - Enable idle timer + * "1" - Disable idle timer + */ +#define SDL_HINT_IDLE_TIMER_DISABLED "SDL_IOS_IDLE_TIMER_DISABLED" + +/** + * \brief A variable controlling which orientations are allowed on iOS/Android. + * + * In some circumstances it is necessary to be able to explicitly control + * which UI orientations are allowed. + * + * This variable is a space delimited list of the following values: + * "LandscapeLeft", "LandscapeRight", "Portrait" "PortraitUpsideDown" + */ +#define SDL_HINT_ORIENTATIONS "SDL_IOS_ORIENTATIONS" + +/** + * \brief A variable controlling whether controllers used with the Apple TV + * generate UI events. + * + * When UI events are generated by controller input, the app will be + * backgrounded when the Apple TV remote's menu button is pressed, and when the + * pause or B buttons on gamepads are pressed. + * + * More information about properly making use of controllers for the Apple TV + * can be found here: + * https://developer.apple.com/tvos/human-interface-guidelines/remote-and-controllers/ + * + * This variable can be set to the following values: + * "0" - Controller input does not generate UI events (the default). + * "1" - Controller input generates UI events. + */ +#define SDL_HINT_APPLE_TV_CONTROLLER_UI_EVENTS "SDL_APPLE_TV_CONTROLLER_UI_EVENTS" + +/** + * \brief A variable controlling whether the Apple TV remote's joystick axes + * will automatically match the rotation of the remote. + * + * This variable can be set to the following values: + * "0" - Remote orientation does not affect joystick axes (the default). + * "1" - Joystick axes are based on the orientation of the remote. + */ +#define SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION "SDL_APPLE_TV_REMOTE_ALLOW_ROTATION" + +/** + * \brief A variable controlling whether the home indicator bar on iPhone X + * should be hidden. + * + * This variable can be set to the following values: + * "0" - The indicator bar is not hidden (default for windowed applications) + * "1" - The indicator bar is hidden and is shown when the screen is touched (useful for movie playback applications) + * "2" - The indicator bar is dim and the first swipe makes it visible and the second swipe performs the "home" action (default for fullscreen applications) + */ +#define SDL_HINT_IOS_HIDE_HOME_INDICATOR "SDL_IOS_HIDE_HOME_INDICATOR" + +/** + * \brief A variable controlling whether the Android / iOS built-in + * accelerometer should be listed as a joystick device. + * + * This variable can be set to the following values: + * "0" - The accelerometer is not listed as a joystick + * "1" - The accelerometer is available as a 3 axis joystick (the default). + */ +#define SDL_HINT_ACCELEROMETER_AS_JOYSTICK "SDL_ACCELEROMETER_AS_JOYSTICK" + +/** + * \brief A variable controlling whether the Android / tvOS remotes + * should be listed as joystick devices, instead of sending keyboard events. + * + * This variable can be set to the following values: + * "0" - Remotes send enter/escape/arrow key events + * "1" - Remotes are available as 2 axis, 2 button joysticks (the default). + */ +#define SDL_HINT_TV_REMOTE_AS_JOYSTICK "SDL_TV_REMOTE_AS_JOYSTICK" + +/** + * \brief A variable that lets you disable the detection and use of Xinput gamepad devices + * + * The variable can be set to the following values: + * "0" - Disable XInput detection (only uses direct input) + * "1" - Enable XInput detection (the default) + */ +#define SDL_HINT_XINPUT_ENABLED "SDL_XINPUT_ENABLED" + +/** + * \brief A variable that causes SDL to use the old axis and button mapping for XInput devices. + * + * This hint is for backwards compatibility only and will be removed in SDL 2.1 + * + * The default value is "0". This hint must be set before SDL_Init() + */ +#define SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING "SDL_XINPUT_USE_OLD_JOYSTICK_MAPPING" + +/** + * \brief A variable that overrides the automatic controller type detection + * + * The variable should be comma separated entries, in the form: VID/PID=type + * + * The VID and PID should be hexadecimal with exactly 4 digits, e.g. 0x00fd + * + * The type should be one of: + * Xbox360 + * XboxOne + * PS3 + * PS4 + * PS5 + * SwitchPro + * + * This hint affects what driver is used, and must be set before calling SDL_Init(SDL_INIT_GAMECONTROLLER) + */ +#define SDL_HINT_GAMECONTROLLERTYPE "SDL_GAMECONTROLLERTYPE" + +/** + * \brief A variable that lets you manually hint extra gamecontroller db entries. + * + * The variable should be newline delimited rows of gamecontroller config data, see SDL_gamecontroller.h + * + * This hint must be set before calling SDL_Init(SDL_INIT_GAMECONTROLLER) + * You can update mappings after the system is initialized with SDL_GameControllerMappingForGUID() and SDL_GameControllerAddMapping() + */ +#define SDL_HINT_GAMECONTROLLERCONFIG "SDL_GAMECONTROLLERCONFIG" + +/** + * \brief A variable that lets you provide a file with extra gamecontroller db entries. + * + * The file should contain lines of gamecontroller config data, see SDL_gamecontroller.h + * + * This hint must be set before calling SDL_Init(SDL_INIT_GAMECONTROLLER) + * You can update mappings after the system is initialized with SDL_GameControllerMappingForGUID() and SDL_GameControllerAddMapping() + */ +#define SDL_HINT_GAMECONTROLLERCONFIG_FILE "SDL_GAMECONTROLLERCONFIG_FILE" + +/** + * \brief A variable containing a list of devices to skip when scanning for game controllers. + * + * The format of the string is a comma separated list of USB VID/PID pairs + * in hexadecimal form, e.g. + * + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD + * + * The variable can also take the form of @file, in which case the named + * file will be loaded and interpreted as the value of the variable. + */ +#define SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES "SDL_GAMECONTROLLER_IGNORE_DEVICES" + +/** + * \brief If set, all devices will be skipped when scanning for game controllers except for the ones listed in this variable. + * + * The format of the string is a comma separated list of USB VID/PID pairs + * in hexadecimal form, e.g. + * + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD + * + * The variable can also take the form of @file, in which case the named + * file will be loaded and interpreted as the value of the variable. + */ +#define SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT "SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT" + +/** + * \brief If set, game controller face buttons report their values according to their labels instead of their positional layout. + * + * For example, on Nintendo Switch controllers, normally you'd get: + * + * (Y) + * (X) (B) + * (A) + * + * but if this hint is set, you'll get: + * + * (X) + * (Y) (A) + * (B) + * + * The variable can be set to the following values: + * "0" - Report the face buttons by position, as though they were on an Xbox controller. + * "1" - Report the face buttons by label instead of position + * + * The default value is "1". This hint may be set at any time. + */ +#define SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS "SDL_GAMECONTROLLER_USE_BUTTON_LABELS" + +/** + * \brief A variable that lets you enable joystick (and gamecontroller) events even when your app is in the background. + * + * The variable can be set to the following values: + * "0" - Disable joystick & gamecontroller input events when the + * application is in the background. + * "1" - Enable joystick & gamecontroller input events when the + * application is in the background. + * + * The default value is "0". This hint may be set at any time. + */ +#define SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS "SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS" + +/** + * \brief A variable controlling whether the HIDAPI joystick drivers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI drivers are not used + * "1" - HIDAPI drivers are used (the default) + * + * This variable is the default for all drivers, but can be overridden by the hints for specific drivers below. + */ +#define SDL_HINT_JOYSTICK_HIDAPI "SDL_JOYSTICK_HIDAPI" + +/** + * \brief A variable controlling whether the HIDAPI driver for PS4 controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI + */ +#define SDL_HINT_JOYSTICK_HIDAPI_PS4 "SDL_JOYSTICK_HIDAPI_PS4" + +/** + * \brief A variable controlling whether the HIDAPI driver for PS5 controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI + */ +#define SDL_HINT_JOYSTICK_HIDAPI_PS5 "SDL_JOYSTICK_HIDAPI_PS5" + +/** + * \brief A variable controlling whether extended input reports should be used for PS4 controllers when using the HIDAPI driver. + * + * This variable can be set to the following values: + * "0" - extended reports are not enabled (the default) + * "1" - extended reports + * + * Extended input reports allow rumble on Bluetooth PS4 controllers, but + * break DirectInput handling for applications that don't use SDL. + * + * Once extended reports are enabled, they can not be disabled without + * power cycling the controller. + */ +#define SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE "SDL_JOYSTICK_HIDAPI_PS4_RUMBLE" + +/** + * \brief A variable controlling whether the HIDAPI driver for Steam Controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI + */ +#define SDL_HINT_JOYSTICK_HIDAPI_STEAM "SDL_JOYSTICK_HIDAPI_STEAM" + +/** + * \brief A variable controlling whether the HIDAPI driver for Nintendo Switch controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI + */ +#define SDL_HINT_JOYSTICK_HIDAPI_SWITCH "SDL_JOYSTICK_HIDAPI_SWITCH" + +/** + * \brief A variable controlling whether the HIDAPI driver for XBox controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * The default is "0" on Windows, otherwise the value of SDL_HINT_JOYSTICK_HIDAPI + */ +#define SDL_HINT_JOYSTICK_HIDAPI_XBOX "SDL_JOYSTICK_HIDAPI_XBOX" + + /** + * \brief A variable controlling whether the HIDAPI driver for XBox controllers on Windows should pull correlated + * data from XInput. + * + * This variable can be set to the following values: + * "0" - HIDAPI Xbox driver will only use HIDAPI data + * "1" - HIDAPI Xbox driver will also pull data from XInput, providing better trigger axes, guide button + * presses, and rumble support + * + * The default is "1". This hint applies to any joysticks opened after setting the hint. + */ +#define SDL_HINT_JOYSTICK_HIDAPI_CORRELATE_XINPUT "SDL_JOYSTICK_HIDAPI_CORRELATE_XINPUT" + +/** + * \brief A variable controlling whether the HIDAPI driver for Nintendo GameCube controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI + */ +#define SDL_HINT_JOYSTICK_HIDAPI_GAMECUBE "SDL_JOYSTICK_HIDAPI_GAMECUBE" + +/** + * \brief A variable that controls whether Steam Controllers should be exposed using the SDL joystick and game controller APIs + * + * The variable can be set to the following values: + * "0" - Do not scan for Steam Controllers + * "1" - Scan for Steam Controllers (the default) + * + * The default value is "1". This hint must be set before initializing the joystick subsystem. + */ +#define SDL_HINT_ENABLE_STEAM_CONTROLLERS "SDL_ENABLE_STEAM_CONTROLLERS" + + /** + * \brief A variable controlling whether the RAWINPUT joystick drivers should be used for better handling XInput-capable devices. + * + * This variable can be set to the following values: + * "0" - RAWINPUT drivers are not used + * "1" - RAWINPUT drivers are used (the default) + * + */ +#define SDL_HINT_JOYSTICK_RAWINPUT "SDL_JOYSTICK_RAWINPUT" + + /** + * \brief A variable controlling whether a separate thread should be used + * for handling joystick detection and raw input messages on Windows + * + * This variable can be set to the following values: + * "0" - A separate thread is not used (the default) + * "1" - A separate thread is used for handling raw input messages + * + */ +#define SDL_HINT_JOYSTICK_THREAD "SDL_JOYSTICK_THREAD" + + /** + * \brief A variable controlling whether joysticks on Linux adhere to their HID-defined deadzones or return unfiltered values. + * + * This variable can be set to the following values: + * "0" - Return unfiltered joystick axis values (the default) + * "1" - Return axis values with deadzones taken into account + */ +#define SDL_HINT_LINUX_JOYSTICK_DEADZONES "SDL_LINUX_JOYSTICK_DEADZONES" + +/** + * \brief If set to "0" then never set the top most bit on a SDL Window, even if the video mode expects it. + * This is a debugging aid for developers and not expected to be used by end users. The default is "1" + * + * This variable can be set to the following values: + * "0" - don't allow topmost + * "1" - allow topmost + */ +#define SDL_HINT_ALLOW_TOPMOST "SDL_ALLOW_TOPMOST" + +/** + * \brief A variable that controls the timer resolution, in milliseconds. + * + * The higher resolution the timer, the more frequently the CPU services + * timer interrupts, and the more precise delays are, but this takes up + * power and CPU time. This hint is only used on Windows 7 and earlier. + * + * See this blog post for more information: + * http://randomascii.wordpress.com/2013/07/08/windows-timer-resolution-megawatts-wasted/ + * + * If this variable is set to "0", the system timer resolution is not set. + * + * The default value is "1". This hint may be set at any time. + */ +#define SDL_HINT_TIMER_RESOLUTION "SDL_TIMER_RESOLUTION" + + +/** + * \brief A variable describing the content orientation on QtWayland-based platforms. + * + * On QtWayland platforms, windows are rotated client-side to allow for custom + * transitions. In order to correctly position overlays (e.g. volume bar) and + * gestures (e.g. events view, close/minimize gestures), the system needs to + * know in which orientation the application is currently drawing its contents. + * + * This does not cause the window to be rotated or resized, the application + * needs to take care of drawing the content in the right orientation (the + * framebuffer is always in portrait mode). + * + * This variable can be one of the following values: + * "primary" (default), "portrait", "landscape", "inverted-portrait", "inverted-landscape" + */ +#define SDL_HINT_QTWAYLAND_CONTENT_ORIENTATION "SDL_QTWAYLAND_CONTENT_ORIENTATION" + +/** + * \brief Flags to set on QtWayland windows to integrate with the native window manager. + * + * On QtWayland platforms, this hint controls the flags to set on the windows. + * For example, on Sailfish OS "OverridesSystemGestures" disables swipe gestures. + * + * This variable is a space-separated list of the following values (empty = no flags): + * "OverridesSystemGestures", "StaysOnTop", "BypassWindowManager" + */ +#define SDL_HINT_QTWAYLAND_WINDOW_FLAGS "SDL_QTWAYLAND_WINDOW_FLAGS" + +/** +* \brief A string specifying SDL's threads stack size in bytes or "0" for the backend's default size +* +* Use this hint in case you need to set SDL's threads stack size to other than the default. +* This is specially useful if you build SDL against a non glibc libc library (such as musl) which +* provides a relatively small default thread stack size (a few kilobytes versus the default 8MB glibc uses). +* Support for this hint is currently available only in the pthread, Windows, and PSP backend. +* +* Instead of this hint, in 2.0.9 and later, you can use +* SDL_CreateThreadWithStackSize(). This hint only works with the classic +* SDL_CreateThread(). +*/ +#define SDL_HINT_THREAD_STACK_SIZE "SDL_THREAD_STACK_SIZE" + +/** +* \brief A string specifying additional information to use with SDL_SetThreadPriority. +* +* By default SDL_SetThreadPriority will make appropriate system changes in order to +* apply a thread priority. For example on systems using pthreads the scheduler policy +* is changed automatically to a policy that works well with a given priority. +* Code which has specific requirements can override SDL's default behavior with this hint. +* +* pthread hint values are "current", "other", "fifo" and "rr". +* Currently no other platform hint values are defined but may be in the future. +* +* \note On Linux, the kernel may send SIGKILL to realtime tasks which exceed the distro +* configured execution budget for rtkit. This budget can be queried through RLIMIT_RTTIME +* after calling SDL_SetThreadPriority(). +*/ +#define SDL_HINT_THREAD_PRIORITY_POLICY "SDL_THREAD_PRIORITY_POLICY" + +/** + * \brief Specifies whether SDL_THREAD_PRIORITY_TIME_CRITICAL should be treated as realtime. + * + * On some platforms, like Linux, a realtime priority thread may be subject to restrictions + * that require special handling by the application. This hint exists to let SDL know that + * the app is prepared to handle said restrictions. + * + * On Linux, SDL will apply the following configuration to any thread that becomes realtime: + * * The SCHED_RESET_ON_FORK bit will be set on the scheduling policy, + * * An RLIMIT_RTTIME budget will be configured to the rtkit specified limit. + * * Exceeding this limit will result in the kernel sending SIGKILL to the app, + * * Refer to the man pages for more information. + * + * This variable can be set to the following values: + * "0" - default platform specific behaviour + * "1" - Force SDL_THREAD_PRIORITY_TIME_CRITICAL to a realtime scheduling policy + */ +#define SDL_HINT_THREAD_FORCE_REALTIME_TIME_CRITICAL "SDL_THREAD_FORCE_REALTIME_TIME_CRITICAL" + +/** + * \brief If set to 1, then do not allow high-DPI windows. ("Retina" on Mac and iOS) + */ +#define SDL_HINT_VIDEO_HIGHDPI_DISABLED "SDL_VIDEO_HIGHDPI_DISABLED" + +/** + * \brief A variable that determines whether ctrl+click should generate a right-click event on Mac + * + * If present, holding ctrl while left clicking will generate a right click + * event when on Mac. + */ +#define SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK "SDL_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK" + +/** +* \brief A variable specifying which shader compiler to preload when using the Chrome ANGLE binaries +* +* SDL has EGL and OpenGL ES2 support on Windows via the ANGLE project. It +* can use two different sets of binaries, those compiled by the user from source +* or those provided by the Chrome browser. In the later case, these binaries require +* that SDL loads a DLL providing the shader compiler. +* +* This variable can be set to the following values: +* "d3dcompiler_46.dll" - default, best for Vista or later. +* "d3dcompiler_43.dll" - for XP support. +* "none" - do not load any library, useful if you compiled ANGLE from source and included the compiler in your binaries. +* +*/ +#define SDL_HINT_VIDEO_WIN_D3DCOMPILER "SDL_VIDEO_WIN_D3DCOMPILER" + +/** +* \brief A variable that is the address of another SDL_Window* (as a hex string formatted with "%p"). +* +* If this hint is set before SDL_CreateWindowFrom() and the SDL_Window* it is set to has +* SDL_WINDOW_OPENGL set (and running on WGL only, currently), then two things will occur on the newly +* created SDL_Window: +* +* 1. Its pixel format will be set to the same pixel format as this SDL_Window. This is +* needed for example when sharing an OpenGL context across multiple windows. +* +* 2. The flag SDL_WINDOW_OPENGL will be set on the new window so it can be used for +* OpenGL rendering. +* +* This variable can be set to the following values: +* The address (as a string "%p") of the SDL_Window* that new windows created with SDL_CreateWindowFrom() should +* share a pixel format with. +*/ +#define SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT "SDL_VIDEO_WINDOW_SHARE_PIXEL_FORMAT" + +/** + * \brief A URL to a WinRT app's privacy policy + * + * All network-enabled WinRT apps must make a privacy policy available to its + * users. On Windows 8, 8.1, and RT, Microsoft mandates that this policy be + * be available in the Windows Settings charm, as accessed from within the app. + * SDL provides code to add a URL-based link there, which can point to the app's + * privacy policy. + * + * To setup a URL to an app's privacy policy, set SDL_HINT_WINRT_PRIVACY_POLICY_URL + * before calling any SDL_Init() functions. The contents of the hint should + * be a valid URL. For example, "http://www.example.com". + * + * The default value is "", which will prevent SDL from adding a privacy policy + * link to the Settings charm. This hint should only be set during app init. + * + * The label text of an app's "Privacy Policy" link may be customized via another + * hint, SDL_HINT_WINRT_PRIVACY_POLICY_LABEL. + * + * Please note that on Windows Phone, Microsoft does not provide standard UI + * for displaying a privacy policy link, and as such, SDL_HINT_WINRT_PRIVACY_POLICY_URL + * will not get used on that platform. Network-enabled phone apps should display + * their privacy policy through some other, in-app means. + */ +#define SDL_HINT_WINRT_PRIVACY_POLICY_URL "SDL_WINRT_PRIVACY_POLICY_URL" + +/** \brief Label text for a WinRT app's privacy policy link + * + * Network-enabled WinRT apps must include a privacy policy. On Windows 8, 8.1, and RT, + * Microsoft mandates that this policy be available via the Windows Settings charm. + * SDL provides code to add a link there, with its label text being set via the + * optional hint, SDL_HINT_WINRT_PRIVACY_POLICY_LABEL. + * + * Please note that a privacy policy's contents are not set via this hint. A separate + * hint, SDL_HINT_WINRT_PRIVACY_POLICY_URL, is used to link to the actual text of the + * policy. + * + * The contents of this hint should be encoded as a UTF8 string. + * + * The default value is "Privacy Policy". This hint should only be set during app + * initialization, preferably before any calls to SDL_Init(). + * + * For additional information on linking to a privacy policy, see the documentation for + * SDL_HINT_WINRT_PRIVACY_POLICY_URL. + */ +#define SDL_HINT_WINRT_PRIVACY_POLICY_LABEL "SDL_WINRT_PRIVACY_POLICY_LABEL" + +/** \brief Allows back-button-press events on Windows Phone to be marked as handled + * + * Windows Phone devices typically feature a Back button. When pressed, + * the OS will emit back-button-press events, which apps are expected to + * handle in an appropriate manner. If apps do not explicitly mark these + * events as 'Handled', then the OS will invoke its default behavior for + * unhandled back-button-press events, which on Windows Phone 8 and 8.1 is to + * terminate the app (and attempt to switch to the previous app, or to the + * device's home screen). + * + * Setting the SDL_HINT_WINRT_HANDLE_BACK_BUTTON hint to "1" will cause SDL + * to mark back-button-press events as Handled, if and when one is sent to + * the app. + * + * Internally, Windows Phone sends back button events as parameters to + * special back-button-press callback functions. Apps that need to respond + * to back-button-press events are expected to register one or more + * callback functions for such, shortly after being launched (during the + * app's initialization phase). After the back button is pressed, the OS + * will invoke these callbacks. If the app's callback(s) do not explicitly + * mark the event as handled by the time they return, or if the app never + * registers one of these callback, the OS will consider the event + * un-handled, and it will apply its default back button behavior (terminate + * the app). + * + * SDL registers its own back-button-press callback with the Windows Phone + * OS. This callback will emit a pair of SDL key-press events (SDL_KEYDOWN + * and SDL_KEYUP), each with a scancode of SDL_SCANCODE_AC_BACK, after which + * it will check the contents of the hint, SDL_HINT_WINRT_HANDLE_BACK_BUTTON. + * If the hint's value is set to "1", the back button event's Handled + * property will get set to 'true'. If the hint's value is set to something + * else, or if it is unset, SDL will leave the event's Handled property + * alone. (By default, the OS sets this property to 'false', to note.) + * + * SDL apps can either set SDL_HINT_WINRT_HANDLE_BACK_BUTTON well before a + * back button is pressed, or can set it in direct-response to a back button + * being pressed. + * + * In order to get notified when a back button is pressed, SDL apps should + * register a callback function with SDL_AddEventWatch(), and have it listen + * for SDL_KEYDOWN events that have a scancode of SDL_SCANCODE_AC_BACK. + * (Alternatively, SDL_KEYUP events can be listened-for. Listening for + * either event type is suitable.) Any value of SDL_HINT_WINRT_HANDLE_BACK_BUTTON + * set by such a callback, will be applied to the OS' current + * back-button-press event. + * + * More details on back button behavior in Windows Phone apps can be found + * at the following page, on Microsoft's developer site: + * http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj247550(v=vs.105).aspx + */ +#define SDL_HINT_WINRT_HANDLE_BACK_BUTTON "SDL_WINRT_HANDLE_BACK_BUTTON" + +/** + * \brief A variable that dictates policy for fullscreen Spaces on Mac OS X. + * + * This hint only applies to Mac OS X. + * + * The variable can be set to the following values: + * "0" - Disable Spaces support (FULLSCREEN_DESKTOP won't use them and + * SDL_WINDOW_RESIZABLE windows won't offer the "fullscreen" + * button on their titlebars). + * "1" - Enable Spaces support (FULLSCREEN_DESKTOP will use them and + * SDL_WINDOW_RESIZABLE windows will offer the "fullscreen" + * button on their titlebars). + * + * The default value is "1". Spaces are disabled regardless of this hint if + * the OS isn't at least Mac OS X Lion (10.7). This hint must be set before + * any windows are created. + */ +#define SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES "SDL_VIDEO_MAC_FULLSCREEN_SPACES" + +/** +* \brief When set don't force the SDL app to become a foreground process +* +* This hint only applies to Mac OS X. +* +*/ +#define SDL_HINT_MAC_BACKGROUND_APP "SDL_MAC_BACKGROUND_APP" + +/** + * \brief Android APK expansion main file version. Should be a string number like "1", "2" etc. + * + * Must be set together with SDL_HINT_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION. + * + * If both hints were set then SDL_RWFromFile() will look into expansion files + * after a given relative path was not found in the internal storage and assets. + * + * By default this hint is not set and the APK expansion files are not searched. + */ +#define SDL_HINT_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION "SDL_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION" + +/** + * \brief Android APK expansion patch file version. Should be a string number like "1", "2" etc. + * + * Must be set together with SDL_HINT_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION. + * + * If both hints were set then SDL_RWFromFile() will look into expansion files + * after a given relative path was not found in the internal storage and assets. + * + * By default this hint is not set and the APK expansion files are not searched. + */ +#define SDL_HINT_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION "SDL_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION" + +/** + * \brief A variable to control whether certain IMEs should handle text editing internally instead of sending SDL_TEXTEDITING events. + * + * The variable can be set to the following values: + * "0" - SDL_TEXTEDITING events are sent, and it is the application's + * responsibility to render the text from these events and + * differentiate it somehow from committed text. (default) + * "1" - If supported by the IME then SDL_TEXTEDITING events are not sent, + * and text that is being composed will be rendered in its own UI. + */ +#define SDL_HINT_IME_INTERNAL_EDITING "SDL_IME_INTERNAL_EDITING" + +/** + * \brief A variable to control whether we trap the Android back button to handle it manually. + * This is necessary for the right mouse button to work on some Android devices, or + * to be able to trap the back button for use in your code reliably. If set to true, + * the back button will show up as an SDL_KEYDOWN / SDL_KEYUP pair with a keycode of + * SDL_SCANCODE_AC_BACK. + * + * The variable can be set to the following values: + * "0" - Back button will be handled as usual for system. (default) + * "1" - Back button will be trapped, allowing you to handle the key press + * manually. (This will also let right mouse click work on systems + * where the right mouse button functions as back.) + * + * The value of this hint is used at runtime, so it can be changed at any time. + */ +#define SDL_HINT_ANDROID_TRAP_BACK_BUTTON "SDL_ANDROID_TRAP_BACK_BUTTON" + +/** + * \brief A variable to control whether the event loop will block itself when the app is paused. + * + * The variable can be set to the following values: + * "0" - Non blocking. + * "1" - Blocking. (default) + * + * The value should be set before SDL is initialized. + */ +#define SDL_HINT_ANDROID_BLOCK_ON_PAUSE "SDL_ANDROID_BLOCK_ON_PAUSE" + +/** + * \brief A variable to control whether SDL will pause audio in background + * (Requires SDL_ANDROID_BLOCK_ON_PAUSE as "Non blocking") + * + * The variable can be set to the following values: + * "0" - Non paused. + * "1" - Paused. (default) + * + * The value should be set before SDL is initialized. + */ +#define SDL_HINT_ANDROID_BLOCK_ON_PAUSE_PAUSEAUDIO "SDL_ANDROID_BLOCK_ON_PAUSE_PAUSEAUDIO" + + /** + * \brief A variable to control whether the return key on the soft keyboard + * should hide the soft keyboard on Android and iOS. + * + * The variable can be set to the following values: + * "0" - The return key will be handled as a key event. This is the behaviour of SDL <= 2.0.3. (default) + * "1" - The return key will hide the keyboard. + * + * The value of this hint is used at runtime, so it can be changed at any time. + */ +#define SDL_HINT_RETURN_KEY_HIDES_IME "SDL_RETURN_KEY_HIDES_IME" + +/** + * \brief override the binding element for keyboard inputs for Emscripten builds + * + * This hint only applies to the emscripten platform + * + * The variable can be one of + * "#window" - The javascript window object (this is the default) + * "#document" - The javascript document object + * "#screen" - the javascript window.screen object + * "#canvas" - the WebGL canvas element + * any other string without a leading # sign applies to the element on the page with that ID. + */ +#define SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT "SDL_EMSCRIPTEN_KEYBOARD_ELEMENT" + +/** + * \brief Disable giving back control to the browser automatically + * when running with asyncify + * + * With -s ASYNCIFY, SDL2 calls emscripten_sleep during operations + * such as refreshing the screen or polling events. + * + * This hint only applies to the emscripten platform + * + * The variable can be set to the following values: + * "0" - Disable emscripten_sleep calls (if you give back browser control manually or use asyncify for other purposes) + * "1" - Enable emscripten_sleep calls (the default) + */ +#define SDL_HINT_EMSCRIPTEN_ASYNCIFY "SDL_EMSCRIPTEN_ASYNCIFY" + +/** + * \brief Tell SDL not to catch the SIGINT or SIGTERM signals. + * + * This hint only applies to Unix-like platforms, and should set before + * any calls to SDL_Init() + * + * The variable can be set to the following values: + * "0" - SDL will install a SIGINT and SIGTERM handler, and when it + * catches a signal, convert it into an SDL_QUIT event. + * "1" - SDL will not install a signal handler at all. + */ +#define SDL_HINT_NO_SIGNAL_HANDLERS "SDL_NO_SIGNAL_HANDLERS" + +/** + * \brief Tell SDL not to generate window-close events for Alt+F4 on Windows. + * + * The variable can be set to the following values: + * "0" - SDL will generate a window-close event when it sees Alt+F4. + * "1" - SDL will only do normal key handling for Alt+F4. + */ +#define SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4 "SDL_WINDOWS_NO_CLOSE_ON_ALT_F4" + +/** + * \brief Prevent SDL from using version 4 of the bitmap header when saving BMPs. + * + * The bitmap header version 4 is required for proper alpha channel support and + * SDL will use it when required. Should this not be desired, this hint can + * force the use of the 40 byte header version which is supported everywhere. + * + * The variable can be set to the following values: + * "0" - Surfaces with a colorkey or an alpha channel are saved to a + * 32-bit BMP file with an alpha mask. SDL will use the bitmap + * header version 4 and set the alpha mask accordingly. + * "1" - Surfaces with a colorkey or an alpha channel are saved to a + * 32-bit BMP file without an alpha mask. The alpha channel data + * will be in the file, but applications are going to ignore it. + * + * The default value is "0". + */ +#define SDL_HINT_BMP_SAVE_LEGACY_FORMAT "SDL_BMP_SAVE_LEGACY_FORMAT" + +/** + * \brief Tell SDL not to name threads on Windows with the 0x406D1388 Exception. + * The 0x406D1388 Exception is a trick used to inform Visual Studio of a + * thread's name, but it tends to cause problems with other debuggers, + * and the .NET runtime. Note that SDL 2.0.6 and later will still use + * the (safer) SetThreadDescription API, introduced in the Windows 10 + * Creators Update, if available. + * + * The variable can be set to the following values: + * "0" - SDL will raise the 0x406D1388 Exception to name threads. + * This is the default behavior of SDL <= 2.0.4. + * "1" - SDL will not raise this exception, and threads will be unnamed. (default) + * This is necessary with .NET languages or debuggers that aren't Visual Studio. + */ +#define SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING "SDL_WINDOWS_DISABLE_THREAD_NAMING" + +/** + * \brief Tell SDL which Dispmanx layer to use on a Raspberry PI + * + * Also known as Z-order. The variable can take a negative or positive value. + * The default is 10000. + */ +#define SDL_HINT_RPI_VIDEO_LAYER "SDL_RPI_VIDEO_LAYER" + +/** + * \brief Tell the video driver that we only want a double buffer. + * + * By default, most lowlevel 2D APIs will use a triple buffer scheme that + * wastes no CPU time on waiting for vsync after issuing a flip, but + * introduces a frame of latency. On the other hand, using a double buffer + * scheme instead is recommended for cases where low latency is an important + * factor because we save a whole frame of latency. + * We do so by waiting for vsync immediately after issuing a flip, usually just + * after eglSwapBuffers call in the backend's *_SwapWindow function. + * + * Since it's driver-specific, it's only supported where possible and + * implemented. Currently supported the following drivers: + * - KMSDRM (kmsdrm) + * - Raspberry Pi (raspberrypi) + */ +#define SDL_HINT_VIDEO_DOUBLE_BUFFER "SDL_VIDEO_DOUBLE_BUFFER" + +/** + * \brief A variable controlling what driver to use for OpenGL ES contexts. + * + * On some platforms, currently Windows and X11, OpenGL drivers may support + * creating contexts with an OpenGL ES profile. By default SDL uses these + * profiles, when available, otherwise it attempts to load an OpenGL ES + * library, e.g. that provided by the ANGLE project. This variable controls + * whether SDL follows this default behaviour or will always load an + * OpenGL ES library. + * + * Circumstances where this is useful include + * - Testing an app with a particular OpenGL ES implementation, e.g ANGLE, + * or emulator, e.g. those from ARM, Imagination or Qualcomm. + * - Resolving OpenGL ES function addresses at link time by linking with + * the OpenGL ES library instead of querying them at run time with + * SDL_GL_GetProcAddress(). + * + * Caution: for an application to work with the default behaviour across + * different OpenGL drivers it must query the OpenGL ES function + * addresses at run time using SDL_GL_GetProcAddress(). + * + * This variable is ignored on most platforms because OpenGL ES is native + * or not supported. + * + * This variable can be set to the following values: + * "0" - Use ES profile of OpenGL, if available. (Default when not set.) + * "1" - Load OpenGL ES library using the default library names. + * + */ +#define SDL_HINT_OPENGL_ES_DRIVER "SDL_OPENGL_ES_DRIVER" + +/** + * \brief A variable controlling speed/quality tradeoff of audio resampling. + * + * If available, SDL can use libsamplerate ( http://www.mega-nerd.com/SRC/ ) + * to handle audio resampling. There are different resampling modes available + * that produce different levels of quality, using more CPU. + * + * If this hint isn't specified to a valid setting, or libsamplerate isn't + * available, SDL will use the default, internal resampling algorithm. + * + * Note that this is currently only applicable to resampling audio that is + * being written to a device for playback or audio being read from a device + * for capture. SDL_AudioCVT always uses the default resampler (although this + * might change for SDL 2.1). + * + * This hint is currently only checked at audio subsystem initialization. + * + * This variable can be set to the following values: + * + * "0" or "default" - Use SDL's internal resampling (Default when not set - low quality, fast) + * "1" or "fast" - Use fast, slightly higher quality resampling, if available + * "2" or "medium" - Use medium quality resampling, if available + * "3" or "best" - Use high quality resampling, if available + */ +#define SDL_HINT_AUDIO_RESAMPLING_MODE "SDL_AUDIO_RESAMPLING_MODE" + +/** + * \brief A variable controlling the audio category on iOS and Mac OS X + * + * This variable can be set to the following values: + * + * "ambient" - Use the AVAudioSessionCategoryAmbient audio category, will be muted by the phone mute switch (default) + * "playback" - Use the AVAudioSessionCategoryPlayback category + * + * For more information, see Apple's documentation: + * https://developer.apple.com/library/content/documentation/Audio/Conceptual/AudioSessionProgrammingGuide/AudioSessionCategoriesandModes/AudioSessionCategoriesandModes.html + */ +#define SDL_HINT_AUDIO_CATEGORY "SDL_AUDIO_CATEGORY" + +/** + * \brief A variable controlling whether the 2D render API is compatible or efficient. + * + * This variable can be set to the following values: + * + * "0" - Don't use batching to make rendering more efficient. + * "1" - Use batching, but might cause problems if app makes its own direct OpenGL calls. + * + * Up to SDL 2.0.9, the render API would draw immediately when requested. Now + * it batches up draw requests and sends them all to the GPU only when forced + * to (during SDL_RenderPresent, when changing render targets, by updating a + * texture that the batch needs, etc). This is significantly more efficient, + * but it can cause problems for apps that expect to render on top of the + * render API's output. As such, SDL will disable batching if a specific + * render backend is requested (since this might indicate that the app is + * planning to use the underlying graphics API directly). This hint can + * be used to explicitly request batching in this instance. It is a contract + * that you will either never use the underlying graphics API directly, or + * if you do, you will call SDL_RenderFlush() before you do so any current + * batch goes to the GPU before your work begins. Not following this contract + * will result in undefined behavior. + */ +#define SDL_HINT_RENDER_BATCHING "SDL_RENDER_BATCHING" + + +/** + * \brief A variable controlling whether SDL updates joystick state when getting input events + * + * This variable can be set to the following values: + * + * "0" - You'll call SDL_JoystickUpdate() manually + * "1" - SDL will automatically call SDL_JoystickUpdate() (default) + * + * This hint can be toggled on and off at runtime. + */ +#define SDL_HINT_AUTO_UPDATE_JOYSTICKS "SDL_AUTO_UPDATE_JOYSTICKS" + + +/** + * \brief A variable controlling whether SDL updates sensor state when getting input events + * + * This variable can be set to the following values: + * + * "0" - You'll call SDL_SensorUpdate() manually + * "1" - SDL will automatically call SDL_SensorUpdate() (default) + * + * This hint can be toggled on and off at runtime. + */ +#define SDL_HINT_AUTO_UPDATE_SENSORS "SDL_AUTO_UPDATE_SENSORS" + + +/** + * \brief A variable controlling whether SDL logs all events pushed onto its internal queue. + * + * This variable can be set to the following values: + * + * "0" - Don't log any events (default) + * "1" - Log all events except mouse and finger motion, which are pretty spammy. + * "2" - Log all events. + * + * This is generally meant to be used to debug SDL itself, but can be useful + * for application developers that need better visibility into what is going + * on in the event queue. Logged events are sent through SDL_Log(), which + * means by default they appear on stdout on most platforms or maybe + * OutputDebugString() on Windows, and can be funneled by the app with + * SDL_LogSetOutputFunction(), etc. + * + * This hint can be toggled on and off at runtime, if you only need to log + * events for a small subset of program execution. + */ +#define SDL_HINT_EVENT_LOGGING "SDL_EVENT_LOGGING" + + + +/** + * \brief Controls how the size of the RIFF chunk affects the loading of a WAVE file. + * + * The size of the RIFF chunk (which includes all the sub-chunks of the WAVE + * file) is not always reliable. In case the size is wrong, it's possible to + * just ignore it and step through the chunks until a fixed limit is reached. + * + * Note that files that have trailing data unrelated to the WAVE file or + * corrupt files may slow down the loading process without a reliable boundary. + * By default, SDL stops after 10000 chunks to prevent wasting time. Use the + * environment variable SDL_WAVE_CHUNK_LIMIT to adjust this value. + * + * This variable can be set to the following values: + * + * "force" - Always use the RIFF chunk size as a boundary for the chunk search + * "ignorezero" - Like "force", but a zero size searches up to 4 GiB (default) + * "ignore" - Ignore the RIFF chunk size and always search up to 4 GiB + * "maximum" - Search for chunks until the end of file (not recommended) + */ +#define SDL_HINT_WAVE_RIFF_CHUNK_SIZE "SDL_WAVE_RIFF_CHUNK_SIZE" + +/** + * \brief Controls how a truncated WAVE file is handled. + * + * A WAVE file is considered truncated if any of the chunks are incomplete or + * the data chunk size is not a multiple of the block size. By default, SDL + * decodes until the first incomplete block, as most applications seem to do. + * + * This variable can be set to the following values: + * + * "verystrict" - Raise an error if the file is truncated + * "strict" - Like "verystrict", but the size of the RIFF chunk is ignored + * "dropframe" - Decode until the first incomplete sample frame + * "dropblock" - Decode until the first incomplete block (default) + */ +#define SDL_HINT_WAVE_TRUNCATION "SDL_WAVE_TRUNCATION" + +/** + * \brief Controls how the fact chunk affects the loading of a WAVE file. + * + * The fact chunk stores information about the number of samples of a WAVE + * file. The Standards Update from Microsoft notes that this value can be used + * to 'determine the length of the data in seconds'. This is especially useful + * for compressed formats (for which this is a mandatory chunk) if they produce + * multiple sample frames per block and truncating the block is not allowed. + * The fact chunk can exactly specify how many sample frames there should be + * in this case. + * + * Unfortunately, most application seem to ignore the fact chunk and so SDL + * ignores it by default as well. + * + * This variable can be set to the following values: + * + * "truncate" - Use the number of samples to truncate the wave data if + * the fact chunk is present and valid + * "strict" - Like "truncate", but raise an error if the fact chunk + * is invalid, not present for non-PCM formats, or if the + * data chunk doesn't have that many samples + * "ignorezero" - Like "truncate", but ignore fact chunk if the number of + * samples is zero + * "ignore" - Ignore fact chunk entirely (default) + */ +#define SDL_HINT_WAVE_FACT_CHUNK "SDL_WAVE_FACT_CHUNK" + +/** + * \brief Override for SDL_GetDisplayUsableBounds() + * + * If set, this hint will override the expected results for + * SDL_GetDisplayUsableBounds() for display index 0. Generally you don't want + * to do this, but this allows an embedded system to request that some of the + * screen be reserved for other uses when paired with a well-behaved + * application. + * + * The contents of this hint must be 4 comma-separated integers, the first + * is the bounds x, then y, width and height, in that order. + */ +#define SDL_HINT_DISPLAY_USABLE_BOUNDS "SDL_DISPLAY_USABLE_BOUNDS" + +/** + * \brief Specify an application name for an audio device. + * + * Some audio backends (such as PulseAudio) allow you to describe your audio + * stream. Among other things, this description might show up in a system + * control panel that lets the user adjust the volume on specific audio + * streams instead of using one giant master volume slider. + * + * This hints lets you transmit that information to the OS. The contents of + * this hint are used while opening an audio device. You should use a string + * that describes your program ("My Game 2: The Revenge") + * + * Setting this to "" or leaving it unset will have SDL use a reasonable + * default: probably the application's name or "SDL Application" if SDL + * doesn't have any better information. + * + * On targets where this is not supported, this hint does nothing. + */ +#define SDL_HINT_AUDIO_DEVICE_APP_NAME "SDL_AUDIO_DEVICE_APP_NAME" + +/** + * \brief Specify an application name for an audio device. + * + * Some audio backends (such as PulseAudio) allow you to describe your audio + * stream. Among other things, this description might show up in a system + * control panel that lets the user adjust the volume on specific audio + * streams instead of using one giant master volume slider. + * + * This hints lets you transmit that information to the OS. The contents of + * this hint are used while opening an audio device. You should use a string + * that describes your what your program is playing ("audio stream" is + * probably sufficient in many cases, but this could be useful for something + * like "team chat" if you have a headset playing VoIP audio separately). + * + * Setting this to "" or leaving it unset will have SDL use a reasonable + * default: "audio stream" or something similar. + * + * On targets where this is not supported, this hint does nothing. + */ +#define SDL_HINT_AUDIO_DEVICE_STREAM_NAME "SDL_AUDIO_DEVICE_STREAM_NAME" + + +/** + * \brief Override for SDL_GetPreferredLocales() + * + * If set, this will be favored over anything the OS might report for the + * user's preferred locales. Changing this hint at runtime will not generate + * a SDL_LOCALECHANGED event (but if you can change the hint, you can push + * your own event, if you want). + * + * The format of this hint is a comma-separated list of language and locale, + * combined with an underscore, as is a common format: "en_GB". Locale is + * optional: "en". So you might have a list like this: "en_GB,jp,es_PT" + */ +#define SDL_HINT_PREFERRED_LOCALES "SDL_PREFERRED_LOCALES" + + +/** + * \brief An enumeration of hint priorities + */ +typedef enum +{ + SDL_HINT_DEFAULT, + SDL_HINT_NORMAL, + SDL_HINT_OVERRIDE +} SDL_HintPriority; + + +/** + * \brief Set a hint with a specific priority + * + * The priority controls the behavior when setting a hint that already + * has a value. Hints will replace existing hints of their priority and + * lower. Environment variables are considered to have override priority. + * + * \return SDL_TRUE if the hint was set, SDL_FALSE otherwise + */ +extern DECLSPEC SDL_bool SDLCALL SDL_SetHintWithPriority(const char *name, + const char *value, + SDL_HintPriority priority); + +/** + * \brief Set a hint with normal priority + * + * \return SDL_TRUE if the hint was set, SDL_FALSE otherwise + */ +extern DECLSPEC SDL_bool SDLCALL SDL_SetHint(const char *name, + const char *value); + +/** + * \brief Get a hint + * + * \return The string value of a hint variable. + */ +extern DECLSPEC const char * SDLCALL SDL_GetHint(const char *name); + +/** + * \brief Get a hint + * + * \return The boolean value of a hint variable. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_GetHintBoolean(const char *name, SDL_bool default_value); + +/** + * \brief type definition of the hint callback function. + */ +typedef void (SDLCALL *SDL_HintCallback)(void *userdata, const char *name, const char *oldValue, const char *newValue); + +/** + * \brief Add a function to watch a particular hint + * + * \param name The hint to watch + * \param callback The function to call when the hint value changes + * \param userdata A pointer to pass to the callback function + */ +extern DECLSPEC void SDLCALL SDL_AddHintCallback(const char *name, + SDL_HintCallback callback, + void *userdata); + +/** + * \brief Remove a function watching a particular hint + * + * \param name The hint being watched + * \param callback The function being called when the hint value changes + * \param userdata A pointer being passed to the callback function + */ +extern DECLSPEC void SDLCALL SDL_DelHintCallback(const char *name, + SDL_HintCallback callback, + void *userdata); + +/** + * \brief Clear all hints + * + * This function is called during SDL_Quit() to free stored hints. + */ +extern DECLSPEC void SDLCALL SDL_ClearHints(void); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_hints_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_joystick.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_joystick.h new file mode 100644 index 0000000..0bbeafe --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_joystick.h @@ -0,0 +1,499 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_joystick.h + * + * Include file for SDL joystick event handling + * + * The term "device_index" identifies currently plugged in joystick devices between 0 and SDL_NumJoysticks(), with the exact joystick + * behind a device_index changing as joysticks are plugged and unplugged. + * + * The term "instance_id" is the current instantiation of a joystick device in the system, if the joystick is removed and then re-inserted + * then it will get a new instance_id, instance_id's are monotonically increasing identifiers of a joystick plugged in. + * + * The term JoystickGUID is a stable 128-bit identifier for a joystick device that does not change over time, it identifies class of + * the device (a X360 wired controller for example). This identifier is platform dependent. + * + * + */ + +#ifndef SDL_joystick_h_ +#define SDL_joystick_h_ + +#include "SDL_stdinc.h" +#include "SDL_error.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \file SDL_joystick.h + * + * In order to use these functions, SDL_Init() must have been called + * with the ::SDL_INIT_JOYSTICK flag. This causes SDL to scan the system + * for joysticks, and load appropriate drivers. + * + * If you would like to receive joystick updates while the application + * is in the background, you should set the following hint before calling + * SDL_Init(): SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS + */ + +/** + * The joystick structure used to identify an SDL joystick + */ +struct _SDL_Joystick; +typedef struct _SDL_Joystick SDL_Joystick; + +/* A structure that encodes the stable unique id for a joystick device */ +typedef struct { + Uint8 data[16]; +} SDL_JoystickGUID; + +/** + * This is a unique ID for a joystick for the time it is connected to the system, + * and is never reused for the lifetime of the application. If the joystick is + * disconnected and reconnected, it will get a new ID. + * + * The ID value starts at 0 and increments from there. The value -1 is an invalid ID. + */ +typedef Sint32 SDL_JoystickID; + +typedef enum +{ + SDL_JOYSTICK_TYPE_UNKNOWN, + SDL_JOYSTICK_TYPE_GAMECONTROLLER, + SDL_JOYSTICK_TYPE_WHEEL, + SDL_JOYSTICK_TYPE_ARCADE_STICK, + SDL_JOYSTICK_TYPE_FLIGHT_STICK, + SDL_JOYSTICK_TYPE_DANCE_PAD, + SDL_JOYSTICK_TYPE_GUITAR, + SDL_JOYSTICK_TYPE_DRUM_KIT, + SDL_JOYSTICK_TYPE_ARCADE_PAD, + SDL_JOYSTICK_TYPE_THROTTLE +} SDL_JoystickType; + +typedef enum +{ + SDL_JOYSTICK_POWER_UNKNOWN = -1, + SDL_JOYSTICK_POWER_EMPTY, /* <= 5% */ + SDL_JOYSTICK_POWER_LOW, /* <= 20% */ + SDL_JOYSTICK_POWER_MEDIUM, /* <= 70% */ + SDL_JOYSTICK_POWER_FULL, /* <= 100% */ + SDL_JOYSTICK_POWER_WIRED, + SDL_JOYSTICK_POWER_MAX +} SDL_JoystickPowerLevel; + +/* Set max recognized G-force from accelerometer + See src/joystick/uikit/SDL_sysjoystick.m for notes on why this is needed + */ +#define SDL_IPHONE_MAX_GFORCE 5.0 + + +/* Function prototypes */ + +/** + * Locking for multi-threaded access to the joystick API + * + * If you are using the joystick API or handling events from multiple threads + * you should use these locking functions to protect access to the joysticks. + * + * In particular, you are guaranteed that the joystick list won't change, so + * the API functions that take a joystick index will be valid, and joystick + * and game controller events will not be delivered. + */ +extern DECLSPEC void SDLCALL SDL_LockJoysticks(void); +extern DECLSPEC void SDLCALL SDL_UnlockJoysticks(void); + +/** + * Count the number of joysticks attached to the system right now + */ +extern DECLSPEC int SDLCALL SDL_NumJoysticks(void); + +/** + * Get the implementation dependent name of a joystick. + * This can be called before any joysticks are opened. + * If no name can be found, this function returns NULL. + */ +extern DECLSPEC const char *SDLCALL SDL_JoystickNameForIndex(int device_index); + +/** + * Get the player index of a joystick, or -1 if it's not available + * This can be called before any joysticks are opened. + */ +extern DECLSPEC int SDLCALL SDL_JoystickGetDevicePlayerIndex(int device_index); + +/** + * Return the GUID for the joystick at this index + * This can be called before any joysticks are opened. + */ +extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetDeviceGUID(int device_index); + +/** + * Get the USB vendor ID of a joystick, if available. + * This can be called before any joysticks are opened. + * If the vendor ID isn't available this function returns 0. + */ +extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceVendor(int device_index); + +/** + * Get the USB product ID of a joystick, if available. + * This can be called before any joysticks are opened. + * If the product ID isn't available this function returns 0. + */ +extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceProduct(int device_index); + +/** + * Get the product version of a joystick, if available. + * This can be called before any joysticks are opened. + * If the product version isn't available this function returns 0. + */ +extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceProductVersion(int device_index); + +/** + * Get the type of a joystick, if available. + * This can be called before any joysticks are opened. + */ +extern DECLSPEC SDL_JoystickType SDLCALL SDL_JoystickGetDeviceType(int device_index); + +/** + * Get the instance ID of a joystick. + * This can be called before any joysticks are opened. + * If the index is out of range, this function will return -1. + */ +extern DECLSPEC SDL_JoystickID SDLCALL SDL_JoystickGetDeviceInstanceID(int device_index); + +/** + * Open a joystick for use. + * The index passed as an argument refers to the N'th joystick on the system. + * This index is not the value which will identify this joystick in future + * joystick events. The joystick's instance id (::SDL_JoystickID) will be used + * there instead. + * + * \return A joystick identifier, or NULL if an error occurred. + */ +extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickOpen(int device_index); + +/** + * Return the SDL_Joystick associated with an instance id. + */ +extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickFromInstanceID(SDL_JoystickID instance_id); + +/** + * Return the SDL_Joystick associated with a player index. + */ +extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickFromPlayerIndex(int player_index); + +/** + * Attaches a new virtual joystick. + * Returns the joystick's device index, or -1 if an error occurred. + */ +extern DECLSPEC int SDLCALL SDL_JoystickAttachVirtual(SDL_JoystickType type, + int naxes, + int nbuttons, + int nhats); + +/** + * Detaches a virtual joystick + * Returns 0 on success, or -1 if an error occurred. + */ +extern DECLSPEC int SDLCALL SDL_JoystickDetachVirtual(int device_index); + +/** + * Indicates whether or not a virtual-joystick is at a given device index. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_JoystickIsVirtual(int device_index); + +/** + * Set values on an opened, virtual-joystick's controls. + * Please note that values set here will not be applied until the next + * call to SDL_JoystickUpdate, which can either be called directly, + * or can be called indirectly through various other SDL APIS, + * including, but not limited to the following: SDL_PollEvent, + * SDL_PumpEvents, SDL_WaitEventTimeout, SDL_WaitEvent. + * + * Returns 0 on success, -1 on error. + */ +extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualAxis(SDL_Joystick *joystick, int axis, Sint16 value); +extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualButton(SDL_Joystick *joystick, int button, Uint8 value); +extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualHat(SDL_Joystick *joystick, int hat, Uint8 value); + +/** + * Return the name for this currently opened joystick. + * If no name can be found, this function returns NULL. + */ +extern DECLSPEC const char *SDLCALL SDL_JoystickName(SDL_Joystick *joystick); + +/** + * Get the player index of an opened joystick, or -1 if it's not available + * + * For XInput controllers this returns the XInput user index. + */ +extern DECLSPEC int SDLCALL SDL_JoystickGetPlayerIndex(SDL_Joystick *joystick); + +/** + * Set the player index of an opened joystick + */ +extern DECLSPEC void SDLCALL SDL_JoystickSetPlayerIndex(SDL_Joystick *joystick, int player_index); + +/** + * Return the GUID for this opened joystick + */ +extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUID(SDL_Joystick *joystick); + +/** + * Get the USB vendor ID of an opened joystick, if available. + * If the vendor ID isn't available this function returns 0. + */ +extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetVendor(SDL_Joystick *joystick); + +/** + * Get the USB product ID of an opened joystick, if available. + * If the product ID isn't available this function returns 0. + */ +extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProduct(SDL_Joystick *joystick); + +/** + * Get the product version of an opened joystick, if available. + * If the product version isn't available this function returns 0. + */ +extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProductVersion(SDL_Joystick *joystick); + +/** + * Get the serial number of an opened joystick, if available. + * + * Returns the serial number of the joystick, or NULL if it is not available. + */ +extern DECLSPEC const char * SDLCALL SDL_JoystickGetSerial(SDL_Joystick *joystick); + +/** + * Get the type of an opened joystick. + */ +extern DECLSPEC SDL_JoystickType SDLCALL SDL_JoystickGetType(SDL_Joystick *joystick); + +/** + * Return a string representation for this guid. pszGUID must point to at least 33 bytes + * (32 for the string plus a NULL terminator). + */ +extern DECLSPEC void SDLCALL SDL_JoystickGetGUIDString(SDL_JoystickGUID guid, char *pszGUID, int cbGUID); + +/** + * Convert a string into a joystick guid + */ +extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUIDFromString(const char *pchGUID); + +/** + * Returns SDL_TRUE if the joystick has been opened and currently connected, or SDL_FALSE if it has not. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_JoystickGetAttached(SDL_Joystick *joystick); + +/** + * Get the instance ID of an opened joystick or -1 if the joystick is invalid. + */ +extern DECLSPEC SDL_JoystickID SDLCALL SDL_JoystickInstanceID(SDL_Joystick *joystick); + +/** + * Get the number of general axis controls on a joystick. + */ +extern DECLSPEC int SDLCALL SDL_JoystickNumAxes(SDL_Joystick *joystick); + +/** + * Get the number of trackballs on a joystick. + * + * Joystick trackballs have only relative motion events associated + * with them and their state cannot be polled. + */ +extern DECLSPEC int SDLCALL SDL_JoystickNumBalls(SDL_Joystick *joystick); + +/** + * Get the number of POV hats on a joystick. + */ +extern DECLSPEC int SDLCALL SDL_JoystickNumHats(SDL_Joystick *joystick); + +/** + * Get the number of buttons on a joystick. + */ +extern DECLSPEC int SDLCALL SDL_JoystickNumButtons(SDL_Joystick *joystick); + +/** + * Update the current state of the open joysticks. + * + * This is called automatically by the event loop if any joystick + * events are enabled. + */ +extern DECLSPEC void SDLCALL SDL_JoystickUpdate(void); + +/** + * Enable/disable joystick event polling. + * + * If joystick events are disabled, you must call SDL_JoystickUpdate() + * yourself and check the state of the joystick when you want joystick + * information. + * + * The state can be one of ::SDL_QUERY, ::SDL_ENABLE or ::SDL_IGNORE. + */ +extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state); + +#define SDL_JOYSTICK_AXIS_MAX 32767 +#define SDL_JOYSTICK_AXIS_MIN -32768 +/** + * Get the current state of an axis control on a joystick. + * + * The state is a value ranging from -32768 to 32767. + * + * The axis indices start at index 0. + */ +extern DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick *joystick, + int axis); + +/** + * Get the initial state of an axis control on a joystick. + * + * The state is a value ranging from -32768 to 32767. + * + * The axis indices start at index 0. + * + * \return SDL_TRUE if this axis has any initial value, or SDL_FALSE if not. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_JoystickGetAxisInitialState(SDL_Joystick *joystick, + int axis, Sint16 *state); + +/** + * \name Hat positions + */ +/* @{ */ +#define SDL_HAT_CENTERED 0x00 +#define SDL_HAT_UP 0x01 +#define SDL_HAT_RIGHT 0x02 +#define SDL_HAT_DOWN 0x04 +#define SDL_HAT_LEFT 0x08 +#define SDL_HAT_RIGHTUP (SDL_HAT_RIGHT|SDL_HAT_UP) +#define SDL_HAT_RIGHTDOWN (SDL_HAT_RIGHT|SDL_HAT_DOWN) +#define SDL_HAT_LEFTUP (SDL_HAT_LEFT|SDL_HAT_UP) +#define SDL_HAT_LEFTDOWN (SDL_HAT_LEFT|SDL_HAT_DOWN) +/* @} */ + +/** + * Get the current state of a POV hat on a joystick. + * + * The hat indices start at index 0. + * + * \return The return value is one of the following positions: + * - ::SDL_HAT_CENTERED + * - ::SDL_HAT_UP + * - ::SDL_HAT_RIGHT + * - ::SDL_HAT_DOWN + * - ::SDL_HAT_LEFT + * - ::SDL_HAT_RIGHTUP + * - ::SDL_HAT_RIGHTDOWN + * - ::SDL_HAT_LEFTUP + * - ::SDL_HAT_LEFTDOWN + */ +extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetHat(SDL_Joystick *joystick, + int hat); + +/** + * Get the ball axis change since the last poll. + * + * \return 0, or -1 if you passed it invalid parameters. + * + * The ball indices start at index 0. + */ +extern DECLSPEC int SDLCALL SDL_JoystickGetBall(SDL_Joystick *joystick, + int ball, int *dx, int *dy); + +/** + * Get the current state of a button on a joystick. + * + * The button indices start at index 0. + */ +extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick *joystick, + int button); + +/** + * Start a rumble effect + * Each call to this function cancels any previous rumble effect, and calling it with 0 intensity stops any rumbling. + * + * \param joystick The joystick to vibrate + * \param low_frequency_rumble The intensity of the low frequency (left) rumble motor, from 0 to 0xFFFF + * \param high_frequency_rumble The intensity of the high frequency (right) rumble motor, from 0 to 0xFFFF + * \param duration_ms The duration of the rumble effect, in milliseconds + * + * \return 0, or -1 if rumble isn't supported on this joystick + */ +extern DECLSPEC int SDLCALL SDL_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms); + +/** + * Start a rumble effect in the joystick's triggers + * Each call to this function cancels any previous trigger rumble effect, and calling it with 0 intensity stops any rumbling. + * + * \param joystick The joystick to vibrate + * \param left_rumble The intensity of the left trigger rumble motor, from 0 to 0xFFFF + * \param right_rumble The intensity of the right trigger rumble motor, from 0 to 0xFFFF + * \param duration_ms The duration of the rumble effect, in milliseconds + * + * \return 0, or -1 if trigger rumble isn't supported on this joystick + */ +extern DECLSPEC int SDLCALL SDL_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint16 right_rumble, Uint32 duration_ms); + +/** + * Return whether a joystick has an LED + * + * \param joystick The joystick to query + * + * \return SDL_TRUE, or SDL_FALSE if this joystick does not have a modifiable LED + */ +extern DECLSPEC SDL_bool SDLCALL SDL_JoystickHasLED(SDL_Joystick *joystick); + +/** + * Update a joystick's LED color. + * + * \param joystick The joystick to update + * \param red The intensity of the red LED + * \param green The intensity of the green LED + * \param blue The intensity of the blue LED + * + * \return 0, or -1 if this joystick does not have a modifiable LED + */ +extern DECLSPEC int SDLCALL SDL_JoystickSetLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue); + +/** + * Close a joystick previously opened with SDL_JoystickOpen(). + */ +extern DECLSPEC void SDLCALL SDL_JoystickClose(SDL_Joystick *joystick); + +/** + * Return the battery level of this joystick + */ +extern DECLSPEC SDL_JoystickPowerLevel SDLCALL SDL_JoystickCurrentPowerLevel(SDL_Joystick *joystick); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_joystick_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_keyboard.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_keyboard.h new file mode 100644 index 0000000..f6853c6 --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_keyboard.h @@ -0,0 +1,217 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_keyboard.h + * + * Include file for SDL keyboard event handling + */ + +#ifndef SDL_keyboard_h_ +#define SDL_keyboard_h_ + +#include "SDL_stdinc.h" +#include "SDL_error.h" +#include "SDL_keycode.h" +#include "SDL_video.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \brief The SDL keysym structure, used in key events. + * + * \note If you are looking for translated character input, see the ::SDL_TEXTINPUT event. + */ +typedef struct SDL_Keysym +{ + SDL_Scancode scancode; /**< SDL physical key code - see ::SDL_Scancode for details */ + SDL_Keycode sym; /**< SDL virtual key code - see ::SDL_Keycode for details */ + Uint16 mod; /**< current key modifiers */ + Uint32 unused; +} SDL_Keysym; + +/* Function prototypes */ + +/** + * \brief Get the window which currently has keyboard focus. + */ +extern DECLSPEC SDL_Window * SDLCALL SDL_GetKeyboardFocus(void); + +/** + * \brief Get a snapshot of the current state of the keyboard. + * + * \param numkeys if non-NULL, receives the length of the returned array. + * + * \return An array of key states. Indexes into this array are obtained by using ::SDL_Scancode values. + * + * \b Example: + * \code + * const Uint8 *state = SDL_GetKeyboardState(NULL); + * if ( state[SDL_SCANCODE_RETURN] ) { + * printf(" is pressed.\n"); + * } + * \endcode + */ +extern DECLSPEC const Uint8 *SDLCALL SDL_GetKeyboardState(int *numkeys); + +/** + * \brief Get the current key modifier state for the keyboard. + */ +extern DECLSPEC SDL_Keymod SDLCALL SDL_GetModState(void); + +/** + * \brief Set the current key modifier state for the keyboard. + * + * \note This does not change the keyboard state, only the key modifier flags. + */ +extern DECLSPEC void SDLCALL SDL_SetModState(SDL_Keymod modstate); + +/** + * \brief Get the key code corresponding to the given scancode according + * to the current keyboard layout. + * + * See ::SDL_Keycode for details. + * + * \sa SDL_GetKeyName() + */ +extern DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromScancode(SDL_Scancode scancode); + +/** + * \brief Get the scancode corresponding to the given key code according to the + * current keyboard layout. + * + * See ::SDL_Scancode for details. + * + * \sa SDL_GetScancodeName() + */ +extern DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromKey(SDL_Keycode key); + +/** + * \brief Get a human-readable name for a scancode. + * + * \return A pointer to the name for the scancode. + * If the scancode doesn't have a name, this function returns + * an empty string (""). + * + * \sa SDL_Scancode + */ +extern DECLSPEC const char *SDLCALL SDL_GetScancodeName(SDL_Scancode scancode); + +/** + * \brief Get a scancode from a human-readable name + * + * \return scancode, or SDL_SCANCODE_UNKNOWN if the name wasn't recognized + * + * \sa SDL_Scancode + */ +extern DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromName(const char *name); + +/** + * \brief Get a human-readable name for a key. + * + * \return A pointer to a UTF-8 string that stays valid at least until the next + * call to this function. If you need it around any longer, you must + * copy it. If the key doesn't have a name, this function returns an + * empty string (""). + * + * \sa SDL_Keycode + */ +extern DECLSPEC const char *SDLCALL SDL_GetKeyName(SDL_Keycode key); + +/** + * \brief Get a key code from a human-readable name + * + * \return key code, or SDLK_UNKNOWN if the name wasn't recognized + * + * \sa SDL_Keycode + */ +extern DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromName(const char *name); + +/** + * \brief Start accepting Unicode text input events. + * This function will show the on-screen keyboard if supported. + * + * \sa SDL_StopTextInput() + * \sa SDL_SetTextInputRect() + * \sa SDL_HasScreenKeyboardSupport() + */ +extern DECLSPEC void SDLCALL SDL_StartTextInput(void); + +/** + * \brief Return whether or not Unicode text input events are enabled. + * + * \sa SDL_StartTextInput() + * \sa SDL_StopTextInput() + */ +extern DECLSPEC SDL_bool SDLCALL SDL_IsTextInputActive(void); + +/** + * \brief Stop receiving any text input events. + * This function will hide the on-screen keyboard if supported. + * + * \sa SDL_StartTextInput() + * \sa SDL_HasScreenKeyboardSupport() + */ +extern DECLSPEC void SDLCALL SDL_StopTextInput(void); + +/** + * \brief Set the rectangle used to type Unicode text inputs. + * This is used as a hint for IME and on-screen keyboard placement. + * + * \sa SDL_StartTextInput() + */ +extern DECLSPEC void SDLCALL SDL_SetTextInputRect(SDL_Rect *rect); + +/** + * \brief Returns whether the platform has some screen keyboard support. + * + * \return SDL_TRUE if some keyboard support is available else SDL_FALSE. + * + * \note Not all screen keyboard functions are supported on all platforms. + * + * \sa SDL_IsScreenKeyboardShown() + */ +extern DECLSPEC SDL_bool SDLCALL SDL_HasScreenKeyboardSupport(void); + +/** + * \brief Returns whether the screen keyboard is shown for given window. + * + * \param window The window for which screen keyboard should be queried. + * + * \return SDL_TRUE if screen keyboard is shown else SDL_FALSE. + * + * \sa SDL_HasScreenKeyboardSupport() + */ +extern DECLSPEC SDL_bool SDLCALL SDL_IsScreenKeyboardShown(SDL_Window *window); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_keyboard_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_keycode.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_keycode.h new file mode 100644 index 0000000..6f6b65c --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_keycode.h @@ -0,0 +1,351 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_keycode.h + * + * Defines constants which identify keyboard keys and modifiers. + */ + +#ifndef SDL_keycode_h_ +#define SDL_keycode_h_ + +#include "SDL_stdinc.h" +#include "SDL_scancode.h" + +/** + * \brief The SDL virtual key representation. + * + * Values of this type are used to represent keyboard keys using the current + * layout of the keyboard. These values include Unicode values representing + * the unmodified character that would be generated by pressing the key, or + * an SDLK_* constant for those keys that do not generate characters. + * + * A special exception is the number keys at the top of the keyboard which + * always map to SDLK_0...SDLK_9, regardless of layout. + */ +typedef Sint32 SDL_Keycode; + +#define SDLK_SCANCODE_MASK (1<<30) +#define SDL_SCANCODE_TO_KEYCODE(X) (X | SDLK_SCANCODE_MASK) + +typedef enum +{ + SDLK_UNKNOWN = 0, + + SDLK_RETURN = '\r', + SDLK_ESCAPE = '\033', + SDLK_BACKSPACE = '\b', + SDLK_TAB = '\t', + SDLK_SPACE = ' ', + SDLK_EXCLAIM = '!', + SDLK_QUOTEDBL = '"', + SDLK_HASH = '#', + SDLK_PERCENT = '%', + SDLK_DOLLAR = '$', + SDLK_AMPERSAND = '&', + SDLK_QUOTE = '\'', + SDLK_LEFTPAREN = '(', + SDLK_RIGHTPAREN = ')', + SDLK_ASTERISK = '*', + SDLK_PLUS = '+', + SDLK_COMMA = ',', + SDLK_MINUS = '-', + SDLK_PERIOD = '.', + SDLK_SLASH = '/', + SDLK_0 = '0', + SDLK_1 = '1', + SDLK_2 = '2', + SDLK_3 = '3', + SDLK_4 = '4', + SDLK_5 = '5', + SDLK_6 = '6', + SDLK_7 = '7', + SDLK_8 = '8', + SDLK_9 = '9', + SDLK_COLON = ':', + SDLK_SEMICOLON = ';', + SDLK_LESS = '<', + SDLK_EQUALS = '=', + SDLK_GREATER = '>', + SDLK_QUESTION = '?', + SDLK_AT = '@', + + /* + Skip uppercase letters + */ + + SDLK_LEFTBRACKET = '[', + SDLK_BACKSLASH = '\\', + SDLK_RIGHTBRACKET = ']', + SDLK_CARET = '^', + SDLK_UNDERSCORE = '_', + SDLK_BACKQUOTE = '`', + SDLK_a = 'a', + SDLK_b = 'b', + SDLK_c = 'c', + SDLK_d = 'd', + SDLK_e = 'e', + SDLK_f = 'f', + SDLK_g = 'g', + SDLK_h = 'h', + SDLK_i = 'i', + SDLK_j = 'j', + SDLK_k = 'k', + SDLK_l = 'l', + SDLK_m = 'm', + SDLK_n = 'n', + SDLK_o = 'o', + SDLK_p = 'p', + SDLK_q = 'q', + SDLK_r = 'r', + SDLK_s = 's', + SDLK_t = 't', + SDLK_u = 'u', + SDLK_v = 'v', + SDLK_w = 'w', + SDLK_x = 'x', + SDLK_y = 'y', + SDLK_z = 'z', + + SDLK_CAPSLOCK = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CAPSLOCK), + + SDLK_F1 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F1), + SDLK_F2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F2), + SDLK_F3 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F3), + SDLK_F4 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F4), + SDLK_F5 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F5), + SDLK_F6 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F6), + SDLK_F7 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F7), + SDLK_F8 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F8), + SDLK_F9 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F9), + SDLK_F10 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F10), + SDLK_F11 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F11), + SDLK_F12 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F12), + + SDLK_PRINTSCREEN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PRINTSCREEN), + SDLK_SCROLLLOCK = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SCROLLLOCK), + SDLK_PAUSE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAUSE), + SDLK_INSERT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_INSERT), + SDLK_HOME = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_HOME), + SDLK_PAGEUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAGEUP), + SDLK_DELETE = '\177', + SDLK_END = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_END), + SDLK_PAGEDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAGEDOWN), + SDLK_RIGHT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RIGHT), + SDLK_LEFT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LEFT), + SDLK_DOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_DOWN), + SDLK_UP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_UP), + + SDLK_NUMLOCKCLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_NUMLOCKCLEAR), + SDLK_KP_DIVIDE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DIVIDE), + SDLK_KP_MULTIPLY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MULTIPLY), + SDLK_KP_MINUS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MINUS), + SDLK_KP_PLUS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PLUS), + SDLK_KP_ENTER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_ENTER), + SDLK_KP_1 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_1), + SDLK_KP_2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_2), + SDLK_KP_3 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_3), + SDLK_KP_4 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_4), + SDLK_KP_5 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_5), + SDLK_KP_6 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_6), + SDLK_KP_7 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_7), + SDLK_KP_8 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_8), + SDLK_KP_9 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_9), + SDLK_KP_0 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_0), + SDLK_KP_PERIOD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PERIOD), + + SDLK_APPLICATION = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APPLICATION), + SDLK_POWER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_POWER), + SDLK_KP_EQUALS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_EQUALS), + SDLK_F13 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F13), + SDLK_F14 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F14), + SDLK_F15 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F15), + SDLK_F16 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F16), + SDLK_F17 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F17), + SDLK_F18 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F18), + SDLK_F19 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F19), + SDLK_F20 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F20), + SDLK_F21 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F21), + SDLK_F22 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F22), + SDLK_F23 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F23), + SDLK_F24 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F24), + SDLK_EXECUTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EXECUTE), + SDLK_HELP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_HELP), + SDLK_MENU = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MENU), + SDLK_SELECT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SELECT), + SDLK_STOP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_STOP), + SDLK_AGAIN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AGAIN), + SDLK_UNDO = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_UNDO), + SDLK_CUT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CUT), + SDLK_COPY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_COPY), + SDLK_PASTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PASTE), + SDLK_FIND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_FIND), + SDLK_MUTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MUTE), + SDLK_VOLUMEUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_VOLUMEUP), + SDLK_VOLUMEDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_VOLUMEDOWN), + SDLK_KP_COMMA = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_COMMA), + SDLK_KP_EQUALSAS400 = + SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_EQUALSAS400), + + SDLK_ALTERASE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_ALTERASE), + SDLK_SYSREQ = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SYSREQ), + SDLK_CANCEL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CANCEL), + SDLK_CLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CLEAR), + SDLK_PRIOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PRIOR), + SDLK_RETURN2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RETURN2), + SDLK_SEPARATOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SEPARATOR), + SDLK_OUT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_OUT), + SDLK_OPER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_OPER), + SDLK_CLEARAGAIN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CLEARAGAIN), + SDLK_CRSEL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CRSEL), + SDLK_EXSEL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EXSEL), + + SDLK_KP_00 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_00), + SDLK_KP_000 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_000), + SDLK_THOUSANDSSEPARATOR = + SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_THOUSANDSSEPARATOR), + SDLK_DECIMALSEPARATOR = + SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_DECIMALSEPARATOR), + SDLK_CURRENCYUNIT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CURRENCYUNIT), + SDLK_CURRENCYSUBUNIT = + SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CURRENCYSUBUNIT), + SDLK_KP_LEFTPAREN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_LEFTPAREN), + SDLK_KP_RIGHTPAREN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_RIGHTPAREN), + SDLK_KP_LEFTBRACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_LEFTBRACE), + SDLK_KP_RIGHTBRACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_RIGHTBRACE), + SDLK_KP_TAB = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_TAB), + SDLK_KP_BACKSPACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_BACKSPACE), + SDLK_KP_A = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_A), + SDLK_KP_B = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_B), + SDLK_KP_C = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_C), + SDLK_KP_D = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_D), + SDLK_KP_E = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_E), + SDLK_KP_F = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_F), + SDLK_KP_XOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_XOR), + SDLK_KP_POWER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_POWER), + SDLK_KP_PERCENT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PERCENT), + SDLK_KP_LESS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_LESS), + SDLK_KP_GREATER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_GREATER), + SDLK_KP_AMPERSAND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_AMPERSAND), + SDLK_KP_DBLAMPERSAND = + SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DBLAMPERSAND), + SDLK_KP_VERTICALBAR = + SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_VERTICALBAR), + SDLK_KP_DBLVERTICALBAR = + SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DBLVERTICALBAR), + SDLK_KP_COLON = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_COLON), + SDLK_KP_HASH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_HASH), + SDLK_KP_SPACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_SPACE), + SDLK_KP_AT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_AT), + SDLK_KP_EXCLAM = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_EXCLAM), + SDLK_KP_MEMSTORE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMSTORE), + SDLK_KP_MEMRECALL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMRECALL), + SDLK_KP_MEMCLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMCLEAR), + SDLK_KP_MEMADD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMADD), + SDLK_KP_MEMSUBTRACT = + SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMSUBTRACT), + SDLK_KP_MEMMULTIPLY = + SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMMULTIPLY), + SDLK_KP_MEMDIVIDE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMDIVIDE), + SDLK_KP_PLUSMINUS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PLUSMINUS), + SDLK_KP_CLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_CLEAR), + SDLK_KP_CLEARENTRY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_CLEARENTRY), + SDLK_KP_BINARY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_BINARY), + SDLK_KP_OCTAL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_OCTAL), + SDLK_KP_DECIMAL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DECIMAL), + SDLK_KP_HEXADECIMAL = + SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_HEXADECIMAL), + + SDLK_LCTRL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LCTRL), + SDLK_LSHIFT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LSHIFT), + SDLK_LALT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LALT), + SDLK_LGUI = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LGUI), + SDLK_RCTRL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RCTRL), + SDLK_RSHIFT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RSHIFT), + SDLK_RALT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RALT), + SDLK_RGUI = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RGUI), + + SDLK_MODE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MODE), + + SDLK_AUDIONEXT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIONEXT), + SDLK_AUDIOPREV = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOPREV), + SDLK_AUDIOSTOP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOSTOP), + SDLK_AUDIOPLAY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOPLAY), + SDLK_AUDIOMUTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOMUTE), + SDLK_MEDIASELECT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MEDIASELECT), + SDLK_WWW = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_WWW), + SDLK_MAIL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MAIL), + SDLK_CALCULATOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CALCULATOR), + SDLK_COMPUTER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_COMPUTER), + SDLK_AC_SEARCH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_SEARCH), + SDLK_AC_HOME = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_HOME), + SDLK_AC_BACK = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_BACK), + SDLK_AC_FORWARD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_FORWARD), + SDLK_AC_STOP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_STOP), + SDLK_AC_REFRESH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_REFRESH), + SDLK_AC_BOOKMARKS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_BOOKMARKS), + + SDLK_BRIGHTNESSDOWN = + SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_BRIGHTNESSDOWN), + SDLK_BRIGHTNESSUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_BRIGHTNESSUP), + SDLK_DISPLAYSWITCH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_DISPLAYSWITCH), + SDLK_KBDILLUMTOGGLE = + SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMTOGGLE), + SDLK_KBDILLUMDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMDOWN), + SDLK_KBDILLUMUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMUP), + SDLK_EJECT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EJECT), + SDLK_SLEEP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SLEEP), + SDLK_APP1 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APP1), + SDLK_APP2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APP2), + + SDLK_AUDIOREWIND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOREWIND), + SDLK_AUDIOFASTFORWARD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOFASTFORWARD) +} SDL_KeyCode; + +/** + * \brief Enumeration of valid key mods (possibly OR'd together). + */ +typedef enum +{ + KMOD_NONE = 0x0000, + KMOD_LSHIFT = 0x0001, + KMOD_RSHIFT = 0x0002, + KMOD_LCTRL = 0x0040, + KMOD_RCTRL = 0x0080, + KMOD_LALT = 0x0100, + KMOD_RALT = 0x0200, + KMOD_LGUI = 0x0400, + KMOD_RGUI = 0x0800, + KMOD_NUM = 0x1000, + KMOD_CAPS = 0x2000, + KMOD_MODE = 0x4000, + KMOD_RESERVED = 0x8000, + + KMOD_CTRL = KMOD_LCTRL | KMOD_RCTRL, + KMOD_SHIFT = KMOD_LSHIFT | KMOD_RSHIFT, + KMOD_ALT = KMOD_LALT | KMOD_RALT, + KMOD_GUI = KMOD_LGUI | KMOD_RGUI +} SDL_Keymod; + +#endif /* SDL_keycode_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_loadso.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_loadso.h new file mode 100644 index 0000000..89578a9 --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_loadso.h @@ -0,0 +1,81 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_loadso.h + * + * System dependent library loading routines + * + * Some things to keep in mind: + * \li These functions only work on C function names. Other languages may + * have name mangling and intrinsic language support that varies from + * compiler to compiler. + * \li Make sure you declare your function pointers with the same calling + * convention as the actual library function. Your code will crash + * mysteriously if you do not do this. + * \li Avoid namespace collisions. If you load a symbol from the library, + * it is not defined whether or not it goes into the global symbol + * namespace for the application. If it does and it conflicts with + * symbols in your code or other shared libraries, you will not get + * the results you expect. :) + */ + +#ifndef SDL_loadso_h_ +#define SDL_loadso_h_ + +#include "SDL_stdinc.h" +#include "SDL_error.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/** + * This function dynamically loads a shared object and returns a pointer + * to the object handle (or NULL if there was an error). + * The 'sofile' parameter is a system dependent name of the object file. + */ +extern DECLSPEC void *SDLCALL SDL_LoadObject(const char *sofile); + +/** + * Given an object handle, this function looks up the address of the + * named function in the shared object and returns it. This address + * is no longer valid after calling SDL_UnloadObject(). + */ +extern DECLSPEC void *SDLCALL SDL_LoadFunction(void *handle, + const char *name); + +/** + * Unload a shared object from memory. + */ +extern DECLSPEC void SDLCALL SDL_UnloadObject(void *handle); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_loadso_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_locale.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_locale.h new file mode 100644 index 0000000..1f4b0c4 --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_locale.h @@ -0,0 +1,101 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_locale.h + * + * Include file for SDL locale services + */ + +#ifndef _SDL_locale_h +#define _SDL_locale_h + +#include "SDL_stdinc.h" +#include "SDL_error.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + + +typedef struct SDL_Locale +{ + const char *language; /**< A language name, like "en" for English. */ + const char *country; /**< A country, like "US" for America. Can be NULL. */ +} SDL_Locale; + +/** + * \brief Report the user's preferred locale. + * + * This returns an array of SDL_Locale structs, the final item zeroed out. + * When the caller is done with this array, it should call SDL_free() on + * the returned value; all the memory involved is allocated in a single + * block, so a single SDL_free() will suffice. + * + * Returned language strings are in the format xx, where 'xx' is an ISO-639 + * language specifier (such as "en" for English, "de" for German, etc). + * Country strings are in the format YY, where "YY" is an ISO-3166 country + * code (such as "US" for the United States, "CA" for Canada, etc). Country + * might be NULL if there's no specific guidance on them (so you might get + * { "en", "US" } for American English, but { "en", NULL } means "English + * language, generically"). Language strings are never NULL, except to + * terminate the array. + * + * Please note that not all of these strings are 2 characters; some are + * three or more. + * + * The returned list of locales are in the order of the user's preference. + * For example, a German citizen that is fluent in US English and knows + * enough Japanese to navigate around Tokyo might have a list like: + * { "de", "en_US", "jp", NULL }. Someone from England might prefer British + * English (where "color" is spelled "colour", etc), but will settle for + * anything like it: { "en_GB", "en", NULL }. + * + * This function returns NULL on error, including when the platform does not + * supply this information at all. + * + * This might be a "slow" call that has to query the operating system. It's + * best to ask for this once and save the results. However, this list can + * change, usually because the user has changed a system preference outside + * of your program; SDL will send an SDL_LOCALECHANGED event in this case, + * if possible, and you can call this function again to get an updated copy + * of preferred locales. + * + * \return array of locales, terminated with a locale with a NULL language + * field. Will return NULL on error. + */ +extern DECLSPEC SDL_Locale * SDLCALL SDL_GetPreferredLocales(void); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_locale_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_log.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_log.h new file mode 100644 index 0000000..c1751fd --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_log.h @@ -0,0 +1,211 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_log.h + * + * Simple log messages with categories and priorities. + * + * By default logs are quiet, but if you're debugging SDL you might want: + * + * SDL_LogSetAllPriority(SDL_LOG_PRIORITY_WARN); + * + * Here's where the messages go on different platforms: + * Windows: debug output stream + * Android: log output + * Others: standard error output (stderr) + */ + +#ifndef SDL_log_h_ +#define SDL_log_h_ + +#include "SDL_stdinc.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + + +/** + * \brief The maximum size of a log message + * + * Messages longer than the maximum size will be truncated + */ +#define SDL_MAX_LOG_MESSAGE 4096 + +/** + * \brief The predefined log categories + * + * By default the application category is enabled at the INFO level, + * the assert category is enabled at the WARN level, test is enabled + * at the VERBOSE level and all other categories are enabled at the + * CRITICAL level. + */ +typedef enum +{ + SDL_LOG_CATEGORY_APPLICATION, + SDL_LOG_CATEGORY_ERROR, + SDL_LOG_CATEGORY_ASSERT, + SDL_LOG_CATEGORY_SYSTEM, + SDL_LOG_CATEGORY_AUDIO, + SDL_LOG_CATEGORY_VIDEO, + SDL_LOG_CATEGORY_RENDER, + SDL_LOG_CATEGORY_INPUT, + SDL_LOG_CATEGORY_TEST, + + /* Reserved for future SDL library use */ + SDL_LOG_CATEGORY_RESERVED1, + SDL_LOG_CATEGORY_RESERVED2, + SDL_LOG_CATEGORY_RESERVED3, + SDL_LOG_CATEGORY_RESERVED4, + SDL_LOG_CATEGORY_RESERVED5, + SDL_LOG_CATEGORY_RESERVED6, + SDL_LOG_CATEGORY_RESERVED7, + SDL_LOG_CATEGORY_RESERVED8, + SDL_LOG_CATEGORY_RESERVED9, + SDL_LOG_CATEGORY_RESERVED10, + + /* Beyond this point is reserved for application use, e.g. + enum { + MYAPP_CATEGORY_AWESOME1 = SDL_LOG_CATEGORY_CUSTOM, + MYAPP_CATEGORY_AWESOME2, + MYAPP_CATEGORY_AWESOME3, + ... + }; + */ + SDL_LOG_CATEGORY_CUSTOM +} SDL_LogCategory; + +/** + * \brief The predefined log priorities + */ +typedef enum +{ + SDL_LOG_PRIORITY_VERBOSE = 1, + SDL_LOG_PRIORITY_DEBUG, + SDL_LOG_PRIORITY_INFO, + SDL_LOG_PRIORITY_WARN, + SDL_LOG_PRIORITY_ERROR, + SDL_LOG_PRIORITY_CRITICAL, + SDL_NUM_LOG_PRIORITIES +} SDL_LogPriority; + + +/** + * \brief Set the priority of all log categories + */ +extern DECLSPEC void SDLCALL SDL_LogSetAllPriority(SDL_LogPriority priority); + +/** + * \brief Set the priority of a particular log category + */ +extern DECLSPEC void SDLCALL SDL_LogSetPriority(int category, + SDL_LogPriority priority); + +/** + * \brief Get the priority of a particular log category + */ +extern DECLSPEC SDL_LogPriority SDLCALL SDL_LogGetPriority(int category); + +/** + * \brief Reset all priorities to default. + * + * \note This is called in SDL_Quit(). + */ +extern DECLSPEC void SDLCALL SDL_LogResetPriorities(void); + +/** + * \brief Log a message with SDL_LOG_CATEGORY_APPLICATION and SDL_LOG_PRIORITY_INFO + */ +extern DECLSPEC void SDLCALL SDL_Log(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1); + +/** + * \brief Log a message with SDL_LOG_PRIORITY_VERBOSE + */ +extern DECLSPEC void SDLCALL SDL_LogVerbose(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); + +/** + * \brief Log a message with SDL_LOG_PRIORITY_DEBUG + */ +extern DECLSPEC void SDLCALL SDL_LogDebug(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); + +/** + * \brief Log a message with SDL_LOG_PRIORITY_INFO + */ +extern DECLSPEC void SDLCALL SDL_LogInfo(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); + +/** + * \brief Log a message with SDL_LOG_PRIORITY_WARN + */ +extern DECLSPEC void SDLCALL SDL_LogWarn(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); + +/** + * \brief Log a message with SDL_LOG_PRIORITY_ERROR + */ +extern DECLSPEC void SDLCALL SDL_LogError(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); + +/** + * \brief Log a message with SDL_LOG_PRIORITY_CRITICAL + */ +extern DECLSPEC void SDLCALL SDL_LogCritical(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); + +/** + * \brief Log a message with the specified category and priority. + */ +extern DECLSPEC void SDLCALL SDL_LogMessage(int category, + SDL_LogPriority priority, + SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(3); + +/** + * \brief Log a message with the specified category and priority. + */ +extern DECLSPEC void SDLCALL SDL_LogMessageV(int category, + SDL_LogPriority priority, + const char *fmt, va_list ap); + +/** + * \brief The prototype for the log output function + */ +typedef void (SDLCALL *SDL_LogOutputFunction)(void *userdata, int category, SDL_LogPriority priority, const char *message); + +/** + * \brief Get the current log output function. + */ +extern DECLSPEC void SDLCALL SDL_LogGetOutputFunction(SDL_LogOutputFunction *callback, void **userdata); + +/** + * \brief This function allows you to replace the default log output + * function with one of your own. + */ +extern DECLSPEC void SDLCALL SDL_LogSetOutputFunction(SDL_LogOutputFunction callback, void *userdata); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_log_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_main.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_main.h new file mode 100644 index 0000000..fcb5c17 --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_main.h @@ -0,0 +1,180 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef SDL_main_h_ +#define SDL_main_h_ + +#include "SDL_stdinc.h" + +/** + * \file SDL_main.h + * + * Redefine main() on some platforms so that it is called by SDL. + */ + +#ifndef SDL_MAIN_HANDLED +#if defined(__WIN32__) +/* On Windows SDL provides WinMain(), which parses the command line and passes + the arguments to your main function. + + If you provide your own WinMain(), you may define SDL_MAIN_HANDLED + */ +#define SDL_MAIN_AVAILABLE + +#elif defined(__WINRT__) +/* On WinRT, SDL provides a main function that initializes CoreApplication, + creating an instance of IFrameworkView in the process. + + Please note that #include'ing SDL_main.h is not enough to get a main() + function working. In non-XAML apps, the file, + src/main/winrt/SDL_WinRT_main_NonXAML.cpp, or a copy of it, must be compiled + into the app itself. In XAML apps, the function, SDL_WinRTRunApp must be + called, with a pointer to the Direct3D-hosted XAML control passed in. +*/ +#define SDL_MAIN_NEEDED + +#elif defined(__IPHONEOS__) +/* On iOS SDL provides a main function that creates an application delegate + and starts the iOS application run loop. + + If you link with SDL dynamically on iOS, the main function can't be in a + shared library, so you need to link with libSDLmain.a, which includes a + stub main function that calls into the shared library to start execution. + + See src/video/uikit/SDL_uikitappdelegate.m for more details. + */ +#define SDL_MAIN_NEEDED + +#elif defined(__ANDROID__) +/* On Android SDL provides a Java class in SDLActivity.java that is the + main activity entry point. + + See docs/README-android.md for more details on extending that class. + */ +#define SDL_MAIN_NEEDED + +/* We need to export SDL_main so it can be launched from Java */ +#define SDLMAIN_DECLSPEC DECLSPEC + +#elif defined(__NACL__) +/* On NACL we use ppapi_simple to set up the application helper code, + then wait for the first PSE_INSTANCE_DIDCHANGEVIEW event before + starting the user main function. + All user code is run in a separate thread by ppapi_simple, thus + allowing for blocking io to take place via nacl_io +*/ +#define SDL_MAIN_NEEDED + +#endif +#endif /* SDL_MAIN_HANDLED */ + +#ifndef SDLMAIN_DECLSPEC +#define SDLMAIN_DECLSPEC +#endif + +/** + * \file SDL_main.h + * + * The application's main() function must be called with C linkage, + * and should be declared like this: + * \code + * #ifdef __cplusplus + * extern "C" + * #endif + * int main(int argc, char *argv[]) + * { + * } + * \endcode + */ + +#if defined(SDL_MAIN_NEEDED) || defined(SDL_MAIN_AVAILABLE) +#define main SDL_main +#endif + +#include "begin_code.h" +#ifdef __cplusplus +extern "C" { +#endif + +/** + * The prototype for the application's main() function + */ +typedef int (*SDL_main_func)(int argc, char *argv[]); +extern SDLMAIN_DECLSPEC int SDL_main(int argc, char *argv[]); + + +/** + * This is called by the real SDL main function to let the rest of the + * library know that initialization was done properly. + * + * Calling this yourself without knowing what you're doing can cause + * crashes and hard to diagnose problems with your application. + */ +extern DECLSPEC void SDLCALL SDL_SetMainReady(void); + +#ifdef __WIN32__ + +/** + * This can be called to set the application class at startup + */ +extern DECLSPEC int SDLCALL SDL_RegisterApp(char *name, Uint32 style, void *hInst); +extern DECLSPEC void SDLCALL SDL_UnregisterApp(void); + +#endif /* __WIN32__ */ + + +#ifdef __WINRT__ + +/** + * \brief Initializes and launches an SDL/WinRT application. + * + * \param mainFunction The SDL app's C-style main(). + * \param reserved Reserved for future use; should be NULL + * \return 0 on success, -1 on failure. On failure, use SDL_GetError to retrieve more + * information on the failure. + */ +extern DECLSPEC int SDLCALL SDL_WinRTRunApp(SDL_main_func mainFunction, void * reserved); + +#endif /* __WINRT__ */ + +#if defined(__IPHONEOS__) + +/** + * \brief Initializes and launches an SDL application. + * + * \param argc The argc parameter from the application's main() function + * \param argv The argv parameter from the application's main() function + * \param mainFunction The SDL app's C-style main(). + * \return the return value from mainFunction + */ +extern DECLSPEC int SDLCALL SDL_UIKitRunApp(int argc, char *argv[], SDL_main_func mainFunction); + +#endif /* __IPHONEOS__ */ + + +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_main_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_messagebox.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_messagebox.h new file mode 100644 index 0000000..03639ce --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_messagebox.h @@ -0,0 +1,146 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef SDL_messagebox_h_ +#define SDL_messagebox_h_ + +#include "SDL_stdinc.h" +#include "SDL_video.h" /* For SDL_Window */ + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \brief SDL_MessageBox flags. If supported will display warning icon, etc. + */ +typedef enum +{ + SDL_MESSAGEBOX_ERROR = 0x00000010, /**< error dialog */ + SDL_MESSAGEBOX_WARNING = 0x00000020, /**< warning dialog */ + SDL_MESSAGEBOX_INFORMATION = 0x00000040, /**< informational dialog */ + SDL_MESSAGEBOX_BUTTONS_LEFT_TO_RIGHT = 0x00000080, /**< buttons placed left to right */ + SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT = 0x00000100 /**< buttons placed right to left */ +} SDL_MessageBoxFlags; + +/** + * \brief Flags for SDL_MessageBoxButtonData. + */ +typedef enum +{ + SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT = 0x00000001, /**< Marks the default button when return is hit */ + SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT = 0x00000002 /**< Marks the default button when escape is hit */ +} SDL_MessageBoxButtonFlags; + +/** + * \brief Individual button data. + */ +typedef struct +{ + Uint32 flags; /**< ::SDL_MessageBoxButtonFlags */ + int buttonid; /**< User defined button id (value returned via SDL_ShowMessageBox) */ + const char * text; /**< The UTF-8 button text */ +} SDL_MessageBoxButtonData; + +/** + * \brief RGB value used in a message box color scheme + */ +typedef struct +{ + Uint8 r, g, b; +} SDL_MessageBoxColor; + +typedef enum +{ + SDL_MESSAGEBOX_COLOR_BACKGROUND, + SDL_MESSAGEBOX_COLOR_TEXT, + SDL_MESSAGEBOX_COLOR_BUTTON_BORDER, + SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND, + SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED, + SDL_MESSAGEBOX_COLOR_MAX +} SDL_MessageBoxColorType; + +/** + * \brief A set of colors to use for message box dialogs + */ +typedef struct +{ + SDL_MessageBoxColor colors[SDL_MESSAGEBOX_COLOR_MAX]; +} SDL_MessageBoxColorScheme; + +/** + * \brief MessageBox structure containing title, text, window, etc. + */ +typedef struct +{ + Uint32 flags; /**< ::SDL_MessageBoxFlags */ + SDL_Window *window; /**< Parent window, can be NULL */ + const char *title; /**< UTF-8 title */ + const char *message; /**< UTF-8 message text */ + + int numbuttons; + const SDL_MessageBoxButtonData *buttons; + + const SDL_MessageBoxColorScheme *colorScheme; /**< ::SDL_MessageBoxColorScheme, can be NULL to use system settings */ +} SDL_MessageBoxData; + +/** + * \brief Create a modal message box. + * + * \param messageboxdata The SDL_MessageBoxData structure with title, text, etc. + * \param buttonid The pointer to which user id of hit button should be copied. + * + * \return -1 on error, otherwise 0 and buttonid contains user id of button + * hit or -1 if dialog was closed. + * + * \note This function should be called on the thread that created the parent + * window, or on the main thread if the messagebox has no parent. It will + * block execution of that thread until the user clicks a button or + * closes the messagebox. + */ +extern DECLSPEC int SDLCALL SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid); + +/** + * \brief Create a simple modal message box + * + * \param flags ::SDL_MessageBoxFlags + * \param title UTF-8 title text + * \param message UTF-8 message text + * \param window The parent window, or NULL for no parent + * + * \return 0 on success, -1 on error + * + * \sa SDL_ShowMessageBox + */ +extern DECLSPEC int SDLCALL SDL_ShowSimpleMessageBox(Uint32 flags, const char *title, const char *message, SDL_Window *window); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_messagebox_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_metal.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_metal.h new file mode 100644 index 0000000..f967357 --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_metal.h @@ -0,0 +1,117 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_metal.h + * + * Header file for functions to creating Metal layers and views on SDL windows. + */ + +#ifndef SDL_metal_h_ +#define SDL_metal_h_ + +#include "SDL_video.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \brief A handle to a CAMetalLayer-backed NSView (macOS) or UIView (iOS/tvOS). + * + * \note This can be cast directly to an NSView or UIView. + */ +typedef void *SDL_MetalView; + +/** + * \name Metal support functions + */ +/* @{ */ + +/** + * \brief Create a CAMetalLayer-backed NSView/UIView and attach it to the + * specified window. + * + * On macOS, this does *not* associate a MTLDevice with the CAMetalLayer on its + * own. It is up to user code to do that. + * + * The returned handle can be casted directly to a NSView or UIView. + * To access the backing CAMetalLayer, call SDL_Metal_GetLayer(). + * + * \note \a window must be created with the SDL_WINDOW_METAL flag. + * + * \sa SDL_Metal_DestroyView + * \sa SDL_Metal_GetLayer + */ +extern DECLSPEC SDL_MetalView SDLCALL SDL_Metal_CreateView(SDL_Window * window); + +/** + * \brief Destroy an existing SDL_MetalView object. + * + * This should be called before SDL_DestroyWindow, if SDL_Metal_CreateView was + * called after SDL_CreateWindow. + * + * \sa SDL_Metal_CreateView + */ +extern DECLSPEC void SDLCALL SDL_Metal_DestroyView(SDL_MetalView view); + +/** + * \brief Get a pointer to the backing CAMetalLayer for the given view. + * + * \sa SDL_MetalCreateView + */ +extern DECLSPEC void *SDLCALL SDL_Metal_GetLayer(SDL_MetalView view); + +/** + * \brief Get the size of a window's underlying drawable in pixels (for use + * with setting viewport, scissor & etc). + * + * \param window SDL_Window from which the drawable size should be queried + * \param w Pointer to variable for storing the width in pixels, + * may be NULL + * \param h Pointer to variable for storing the height in pixels, + * may be NULL + * + * This may differ from SDL_GetWindowSize() if we're rendering to a high-DPI + * drawable, i.e. the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a + * platform with high-DPI support (Apple calls this "Retina"), and not disabled + * by the \c SDL_HINT_VIDEO_HIGHDPI_DISABLED hint. + * + * \note On macOS high-DPI support must be enabled for an application by + * setting NSHighResolutionCapable to true in its Info.plist. + * + * \sa SDL_GetWindowSize() + * \sa SDL_CreateWindow() + */ +extern DECLSPEC void SDLCALL SDL_Metal_GetDrawableSize(SDL_Window* window, int *w, + int *h); + +/* @} *//* Metal support functions */ + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_metal_h_ */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_misc.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_misc.h new file mode 100644 index 0000000..a04f19b --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_misc.h @@ -0,0 +1,75 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_misc.h + * + * \brief Include file for SDL API functions that don't fit elsewhere. + */ + +#ifndef SDL_misc_h_ +#define SDL_misc_h_ + +#include "SDL_stdinc.h" + +#include "begin_code.h" + +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \brief Open an URL / URI in the browser or other + * + * Open a URL in a separate, system-provided application. How this works will + * vary wildly depending on the platform. This will likely launch what + * makes sense to handle a specific URL's protocol (a web browser for http://, + * etc), but it might also be able to launch file managers for directories + * and other things. + * + * What happens when you open a URL varies wildly as well: your game window + * may lose focus (and may or may not lose focus if your game was fullscreen + * or grabbing input at the time). On mobile devices, your app will likely + * move to the background or your process might be paused. Any given platform + * may or may not handle a given URL. + * + * If this is unimplemented (or simply unavailable) for a platform, this will + * fail with an error. A successful result does not mean the URL loaded, just + * that we launched something to handle it (or at least believe we did). + * + * All this to say: this function can be useful, but you should definitely + * test it on every platform you target. + * + * \param url A valid URL to open. + * \return 0 on success, or -1 on error. + */ +extern DECLSPEC int SDLCALL SDL_OpenURL(const char *url); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_misc_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_mouse.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_mouse.h new file mode 100644 index 0000000..99b658e --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_mouse.h @@ -0,0 +1,302 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_mouse.h + * + * Include file for SDL mouse event handling. + */ + +#ifndef SDL_mouse_h_ +#define SDL_mouse_h_ + +#include "SDL_stdinc.h" +#include "SDL_error.h" +#include "SDL_video.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct SDL_Cursor SDL_Cursor; /**< Implementation dependent */ + +/** + * \brief Cursor types for SDL_CreateSystemCursor(). + */ +typedef enum +{ + SDL_SYSTEM_CURSOR_ARROW, /**< Arrow */ + SDL_SYSTEM_CURSOR_IBEAM, /**< I-beam */ + SDL_SYSTEM_CURSOR_WAIT, /**< Wait */ + SDL_SYSTEM_CURSOR_CROSSHAIR, /**< Crosshair */ + SDL_SYSTEM_CURSOR_WAITARROW, /**< Small wait cursor (or Wait if not available) */ + SDL_SYSTEM_CURSOR_SIZENWSE, /**< Double arrow pointing northwest and southeast */ + SDL_SYSTEM_CURSOR_SIZENESW, /**< Double arrow pointing northeast and southwest */ + SDL_SYSTEM_CURSOR_SIZEWE, /**< Double arrow pointing west and east */ + SDL_SYSTEM_CURSOR_SIZENS, /**< Double arrow pointing north and south */ + SDL_SYSTEM_CURSOR_SIZEALL, /**< Four pointed arrow pointing north, south, east, and west */ + SDL_SYSTEM_CURSOR_NO, /**< Slashed circle or crossbones */ + SDL_SYSTEM_CURSOR_HAND, /**< Hand */ + SDL_NUM_SYSTEM_CURSORS +} SDL_SystemCursor; + +/** + * \brief Scroll direction types for the Scroll event + */ +typedef enum +{ + SDL_MOUSEWHEEL_NORMAL, /**< The scroll direction is normal */ + SDL_MOUSEWHEEL_FLIPPED /**< The scroll direction is flipped / natural */ +} SDL_MouseWheelDirection; + +/* Function prototypes */ + +/** + * \brief Get the window which currently has mouse focus. + */ +extern DECLSPEC SDL_Window * SDLCALL SDL_GetMouseFocus(void); + +/** + * \brief Retrieve the current state of the mouse. + * + * The current button state is returned as a button bitmask, which can + * be tested using the SDL_BUTTON(X) macros, and x and y are set to the + * mouse cursor position relative to the focus window for the currently + * selected mouse. You can pass NULL for either x or y. + */ +extern DECLSPEC Uint32 SDLCALL SDL_GetMouseState(int *x, int *y); + +/** + * \brief Get the current state of the mouse, in relation to the desktop + * + * This works just like SDL_GetMouseState(), but the coordinates will be + * reported relative to the top-left of the desktop. This can be useful if + * you need to track the mouse outside of a specific window and + * SDL_CaptureMouse() doesn't fit your needs. For example, it could be + * useful if you need to track the mouse while dragging a window, where + * coordinates relative to a window might not be in sync at all times. + * + * \note SDL_GetMouseState() returns the mouse position as SDL understands + * it from the last pump of the event queue. This function, however, + * queries the OS for the current mouse position, and as such, might + * be a slightly less efficient function. Unless you know what you're + * doing and have a good reason to use this function, you probably want + * SDL_GetMouseState() instead. + * + * \param x Returns the current X coord, relative to the desktop. Can be NULL. + * \param y Returns the current Y coord, relative to the desktop. Can be NULL. + * \return The current button state as a bitmask, which can be tested using the SDL_BUTTON(X) macros. + * + * \sa SDL_GetMouseState + */ +extern DECLSPEC Uint32 SDLCALL SDL_GetGlobalMouseState(int *x, int *y); + +/** + * \brief Retrieve the relative state of the mouse. + * + * The current button state is returned as a button bitmask, which can + * be tested using the SDL_BUTTON(X) macros, and x and y are set to the + * mouse deltas since the last call to SDL_GetRelativeMouseState(). + */ +extern DECLSPEC Uint32 SDLCALL SDL_GetRelativeMouseState(int *x, int *y); + +/** + * \brief Moves the mouse to the given position within the window. + * + * \param window The window to move the mouse into, or NULL for the current mouse focus + * \param x The x coordinate within the window + * \param y The y coordinate within the window + * + * \note This function generates a mouse motion event + */ +extern DECLSPEC void SDLCALL SDL_WarpMouseInWindow(SDL_Window * window, + int x, int y); + +/** + * \brief Moves the mouse to the given position in global screen space. + * + * \param x The x coordinate + * \param y The y coordinate + * \return 0 on success, -1 on error (usually: unsupported by a platform). + * + * \note This function generates a mouse motion event + */ +extern DECLSPEC int SDLCALL SDL_WarpMouseGlobal(int x, int y); + +/** + * \brief Set relative mouse mode. + * + * \param enabled Whether or not to enable relative mode + * + * \return 0 on success, or -1 if relative mode is not supported. + * + * While the mouse is in relative mode, the cursor is hidden, and the + * driver will try to report continuous motion in the current window. + * Only relative motion events will be delivered, the mouse position + * will not change. + * + * \note This function will flush any pending mouse motion. + * + * \sa SDL_GetRelativeMouseMode() + */ +extern DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(SDL_bool enabled); + +/** + * \brief Capture the mouse, to track input outside an SDL window. + * + * \param enabled Whether or not to enable capturing + * + * Capturing enables your app to obtain mouse events globally, instead of + * just within your window. Not all video targets support this function. + * When capturing is enabled, the current window will get all mouse events, + * but unlike relative mode, no change is made to the cursor and it is + * not restrained to your window. + * + * This function may also deny mouse input to other windows--both those in + * your application and others on the system--so you should use this + * function sparingly, and in small bursts. For example, you might want to + * track the mouse while the user is dragging something, until the user + * releases a mouse button. It is not recommended that you capture the mouse + * for long periods of time, such as the entire time your app is running. + * + * While captured, mouse events still report coordinates relative to the + * current (foreground) window, but those coordinates may be outside the + * bounds of the window (including negative values). Capturing is only + * allowed for the foreground window. If the window loses focus while + * capturing, the capture will be disabled automatically. + * + * While capturing is enabled, the current window will have the + * SDL_WINDOW_MOUSE_CAPTURE flag set. + * + * \return 0 on success, or -1 if not supported. + */ +extern DECLSPEC int SDLCALL SDL_CaptureMouse(SDL_bool enabled); + +/** + * \brief Query whether relative mouse mode is enabled. + * + * \sa SDL_SetRelativeMouseMode() + */ +extern DECLSPEC SDL_bool SDLCALL SDL_GetRelativeMouseMode(void); + +/** + * \brief Create a cursor, using the specified bitmap data and + * mask (in MSB format). + * + * The cursor width must be a multiple of 8 bits. + * + * The cursor is created in black and white according to the following: + * + * + * + * + * + * + *
data mask resulting pixel on screen
0 1 White
1 1 Black
0 0 Transparent
1 0 Inverted color if possible, black + * if not.
+ * + * \sa SDL_FreeCursor() + */ +extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateCursor(const Uint8 * data, + const Uint8 * mask, + int w, int h, int hot_x, + int hot_y); + +/** + * \brief Create a color cursor. + * + * \sa SDL_FreeCursor() + */ +extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateColorCursor(SDL_Surface *surface, + int hot_x, + int hot_y); + +/** + * \brief Create a system cursor. + * + * \sa SDL_FreeCursor() + */ +extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateSystemCursor(SDL_SystemCursor id); + +/** + * \brief Set the active cursor. + */ +extern DECLSPEC void SDLCALL SDL_SetCursor(SDL_Cursor * cursor); + +/** + * \brief Return the active cursor. + */ +extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetCursor(void); + +/** + * \brief Return the default cursor. + */ +extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetDefaultCursor(void); + +/** + * \brief Frees a cursor created with SDL_CreateCursor() or similar functions. + * + * \sa SDL_CreateCursor() + * \sa SDL_CreateColorCursor() + * \sa SDL_CreateSystemCursor() + */ +extern DECLSPEC void SDLCALL SDL_FreeCursor(SDL_Cursor * cursor); + +/** + * \brief Toggle whether or not the cursor is shown. + * + * \param toggle 1 to show the cursor, 0 to hide it, -1 to query the current + * state. + * + * \return 1 if the cursor is shown, or 0 if the cursor is hidden. + */ +extern DECLSPEC int SDLCALL SDL_ShowCursor(int toggle); + +/** + * Used as a mask when testing buttons in buttonstate. + * - Button 1: Left mouse button + * - Button 2: Middle mouse button + * - Button 3: Right mouse button + */ +#define SDL_BUTTON(X) (1 << ((X)-1)) +#define SDL_BUTTON_LEFT 1 +#define SDL_BUTTON_MIDDLE 2 +#define SDL_BUTTON_RIGHT 3 +#define SDL_BUTTON_X1 4 +#define SDL_BUTTON_X2 5 +#define SDL_BUTTON_LMASK SDL_BUTTON(SDL_BUTTON_LEFT) +#define SDL_BUTTON_MMASK SDL_BUTTON(SDL_BUTTON_MIDDLE) +#define SDL_BUTTON_RMASK SDL_BUTTON(SDL_BUTTON_RIGHT) +#define SDL_BUTTON_X1MASK SDL_BUTTON(SDL_BUTTON_X1) +#define SDL_BUTTON_X2MASK SDL_BUTTON(SDL_BUTTON_X2) + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_mouse_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_mutex.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_mutex.h new file mode 100644 index 0000000..3c5b955 --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_mutex.h @@ -0,0 +1,251 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef SDL_mutex_h_ +#define SDL_mutex_h_ + +/** + * \file SDL_mutex.h + * + * Functions to provide thread synchronization primitives. + */ + +#include "SDL_stdinc.h" +#include "SDL_error.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Synchronization functions which can time out return this value + * if they time out. + */ +#define SDL_MUTEX_TIMEDOUT 1 + +/** + * This is the timeout value which corresponds to never time out. + */ +#define SDL_MUTEX_MAXWAIT (~(Uint32)0) + + +/** + * \name Mutex functions + */ +/* @{ */ + +/* The SDL mutex structure, defined in SDL_sysmutex.c */ +struct SDL_mutex; +typedef struct SDL_mutex SDL_mutex; + +/** + * Create a mutex, initialized unlocked. + */ +extern DECLSPEC SDL_mutex *SDLCALL SDL_CreateMutex(void); + +/** + * Lock the mutex. + * + * \return 0, or -1 on error. + */ +#define SDL_mutexP(m) SDL_LockMutex(m) +extern DECLSPEC int SDLCALL SDL_LockMutex(SDL_mutex * mutex); + +/** + * Try to lock the mutex + * + * \return 0, SDL_MUTEX_TIMEDOUT, or -1 on error + */ +extern DECLSPEC int SDLCALL SDL_TryLockMutex(SDL_mutex * mutex); + +/** + * Unlock the mutex. + * + * \return 0, or -1 on error. + * + * \warning It is an error to unlock a mutex that has not been locked by + * the current thread, and doing so results in undefined behavior. + */ +#define SDL_mutexV(m) SDL_UnlockMutex(m) +extern DECLSPEC int SDLCALL SDL_UnlockMutex(SDL_mutex * mutex); + +/** + * Destroy a mutex. + */ +extern DECLSPEC void SDLCALL SDL_DestroyMutex(SDL_mutex * mutex); + +/* @} *//* Mutex functions */ + + +/** + * \name Semaphore functions + */ +/* @{ */ + +/* The SDL semaphore structure, defined in SDL_syssem.c */ +struct SDL_semaphore; +typedef struct SDL_semaphore SDL_sem; + +/** + * Create a semaphore, initialized with value, returns NULL on failure. + */ +extern DECLSPEC SDL_sem *SDLCALL SDL_CreateSemaphore(Uint32 initial_value); + +/** + * Destroy a semaphore. + */ +extern DECLSPEC void SDLCALL SDL_DestroySemaphore(SDL_sem * sem); + +/** + * This function suspends the calling thread until the semaphore pointed + * to by \c sem has a positive count. It then atomically decreases the + * semaphore count. + */ +extern DECLSPEC int SDLCALL SDL_SemWait(SDL_sem * sem); + +/** + * Non-blocking variant of SDL_SemWait(). + * + * \return 0 if the wait succeeds, ::SDL_MUTEX_TIMEDOUT if the wait would + * block, and -1 on error. + */ +extern DECLSPEC int SDLCALL SDL_SemTryWait(SDL_sem * sem); + +/** + * Variant of SDL_SemWait() with a timeout in milliseconds. + * + * \return 0 if the wait succeeds, ::SDL_MUTEX_TIMEDOUT if the wait does not + * succeed in the allotted time, and -1 on error. + * + * \warning On some platforms this function is implemented by looping with a + * delay of 1 ms, and so should be avoided if possible. + */ +extern DECLSPEC int SDLCALL SDL_SemWaitTimeout(SDL_sem * sem, Uint32 ms); + +/** + * Atomically increases the semaphore's count (not blocking). + * + * \return 0, or -1 on error. + */ +extern DECLSPEC int SDLCALL SDL_SemPost(SDL_sem * sem); + +/** + * Returns the current count of the semaphore. + */ +extern DECLSPEC Uint32 SDLCALL SDL_SemValue(SDL_sem * sem); + +/* @} *//* Semaphore functions */ + + +/** + * \name Condition variable functions + */ +/* @{ */ + +/* The SDL condition variable structure, defined in SDL_syscond.c */ +struct SDL_cond; +typedef struct SDL_cond SDL_cond; + +/** + * Create a condition variable. + * + * Typical use of condition variables: + * + * Thread A: + * SDL_LockMutex(lock); + * while ( ! condition ) { + * SDL_CondWait(cond, lock); + * } + * SDL_UnlockMutex(lock); + * + * Thread B: + * SDL_LockMutex(lock); + * ... + * condition = true; + * ... + * SDL_CondSignal(cond); + * SDL_UnlockMutex(lock); + * + * There is some discussion whether to signal the condition variable + * with the mutex locked or not. There is some potential performance + * benefit to unlocking first on some platforms, but there are some + * potential race conditions depending on how your code is structured. + * + * In general it's safer to signal the condition variable while the + * mutex is locked. + */ +extern DECLSPEC SDL_cond *SDLCALL SDL_CreateCond(void); + +/** + * Destroy a condition variable. + */ +extern DECLSPEC void SDLCALL SDL_DestroyCond(SDL_cond * cond); + +/** + * Restart one of the threads that are waiting on the condition variable. + * + * \return 0 or -1 on error. + */ +extern DECLSPEC int SDLCALL SDL_CondSignal(SDL_cond * cond); + +/** + * Restart all threads that are waiting on the condition variable. + * + * \return 0 or -1 on error. + */ +extern DECLSPEC int SDLCALL SDL_CondBroadcast(SDL_cond * cond); + +/** + * Wait on the condition variable, unlocking the provided mutex. + * + * \warning The mutex must be locked before entering this function! + * + * The mutex is re-locked once the condition variable is signaled. + * + * \return 0 when it is signaled, or -1 on error. + */ +extern DECLSPEC int SDLCALL SDL_CondWait(SDL_cond * cond, SDL_mutex * mutex); + +/** + * Waits for at most \c ms milliseconds, and returns 0 if the condition + * variable is signaled, ::SDL_MUTEX_TIMEDOUT if the condition is not + * signaled in the allotted time, and -1 on error. + * + * \warning On some platforms this function is implemented by looping with a + * delay of 1 ms, and so should be avoided if possible. + */ +extern DECLSPEC int SDLCALL SDL_CondWaitTimeout(SDL_cond * cond, + SDL_mutex * mutex, Uint32 ms); + +/* @} *//* Condition variable functions */ + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_mutex_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_name.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_name.h new file mode 100644 index 0000000..a49c488 --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_name.h @@ -0,0 +1,33 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef SDLname_h_ +#define SDLname_h_ + +#if defined(__STDC__) || defined(__cplusplus) +#define NeedFunctionPrototypes 1 +#endif + +#define SDL_NAME(X) SDL_##X + +#endif /* SDLname_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_opengl.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_opengl.h new file mode 100644 index 0000000..5cd302c --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_opengl.h @@ -0,0 +1,2183 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_opengl.h + * + * This is a simple file to encapsulate the OpenGL API headers. + */ + +/** + * \def NO_SDL_GLEXT + * + * Define this if you have your own version of glext.h and want to disable the + * version included in SDL_opengl.h. + */ + +#ifndef SDL_opengl_h_ +#define SDL_opengl_h_ + +#include "SDL_config.h" + +#ifndef __IPHONEOS__ /* No OpenGL on iOS. */ + +/* + * Mesa 3-D graphics library + * + * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * Copyright (C) 2009 VMware, Inc. All Rights Reserved. + * + * 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 __gl_h_ +#define __gl_h_ + +#if defined(USE_MGL_NAMESPACE) +#include "gl_mangle.h" +#endif + + +/********************************************************************** + * Begin system-specific stuff. + */ + +#if defined(_WIN32) && !defined(__WIN32__) && !defined(__CYGWIN__) +#define __WIN32__ +#endif + +#if defined(__WIN32__) && !defined(__CYGWIN__) +# if (defined(_MSC_VER) || defined(__MINGW32__)) && defined(BUILD_GL32) /* tag specify we're building mesa as a DLL */ +# define GLAPI __declspec(dllexport) +# elif (defined(_MSC_VER) || defined(__MINGW32__)) && defined(_DLL) /* tag specifying we're building for DLL runtime support */ +# define GLAPI __declspec(dllimport) +# else /* for use with static link lib build of Win32 edition only */ +# define GLAPI extern +# endif /* _STATIC_MESA support */ +# if defined(__MINGW32__) && defined(GL_NO_STDCALL) || defined(UNDER_CE) /* The generated DLLs by MingW with STDCALL are not compatible with the ones done by Microsoft's compilers */ +# define GLAPIENTRY +# else +# define GLAPIENTRY __stdcall +# endif +#elif defined(__CYGWIN__) && defined(USE_OPENGL32) /* use native windows opengl32 */ +# define GLAPI extern +# define GLAPIENTRY __stdcall +#elif defined(__OS2__) || defined(__EMX__) /* native os/2 opengl */ +# define GLAPI extern +# define GLAPIENTRY _System +# define APIENTRY _System +# if defined(__GNUC__) && !defined(_System) +# define _System +# endif +#elif (defined(__GNUC__) && __GNUC__ >= 4) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) +# define GLAPI __attribute__((visibility("default"))) +# define GLAPIENTRY +#endif /* WIN32 && !CYGWIN */ + +/* + * WINDOWS: Include windows.h here to define APIENTRY. + * It is also useful when applications include this file by + * including only glut.h, since glut.h depends on windows.h. + * Applications needing to include windows.h with parms other + * than "WIN32_LEAN_AND_MEAN" may include windows.h before + * glut.h or gl.h. + */ +#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN 1 +#endif +#ifndef NOMINMAX /* don't define min() and max(). */ +#define NOMINMAX +#endif +#include +#endif + +#ifndef GLAPI +#define GLAPI extern +#endif + +#ifndef GLAPIENTRY +#define GLAPIENTRY +#endif + +#ifndef APIENTRY +#define APIENTRY GLAPIENTRY +#endif + +/* "P" suffix to be used for a pointer to a function */ +#ifndef APIENTRYP +#define APIENTRYP APIENTRY * +#endif + +#ifndef GLAPIENTRYP +#define GLAPIENTRYP GLAPIENTRY * +#endif + +#if defined(PRAGMA_EXPORT_SUPPORTED) +#pragma export on +#endif + +/* + * End system-specific stuff. + **********************************************************************/ + + + +#ifdef __cplusplus +extern "C" { +#endif + + + +#define GL_VERSION_1_1 1 +#define GL_VERSION_1_2 1 +#define GL_VERSION_1_3 1 +#define GL_ARB_imaging 1 + + +/* + * Datatypes + */ +typedef unsigned int GLenum; +typedef unsigned char GLboolean; +typedef unsigned int GLbitfield; +typedef void GLvoid; +typedef signed char GLbyte; /* 1-byte signed */ +typedef short GLshort; /* 2-byte signed */ +typedef int GLint; /* 4-byte signed */ +typedef unsigned char GLubyte; /* 1-byte unsigned */ +typedef unsigned short GLushort; /* 2-byte unsigned */ +typedef unsigned int GLuint; /* 4-byte unsigned */ +typedef int GLsizei; /* 4-byte signed */ +typedef float GLfloat; /* single precision float */ +typedef float GLclampf; /* single precision float in [0,1] */ +typedef double GLdouble; /* double precision float */ +typedef double GLclampd; /* double precision float in [0,1] */ + + + +/* + * Constants + */ + +/* Boolean values */ +#define GL_FALSE 0 +#define GL_TRUE 1 + +/* Data types */ +#define GL_BYTE 0x1400 +#define GL_UNSIGNED_BYTE 0x1401 +#define GL_SHORT 0x1402 +#define GL_UNSIGNED_SHORT 0x1403 +#define GL_INT 0x1404 +#define GL_UNSIGNED_INT 0x1405 +#define GL_FLOAT 0x1406 +#define GL_2_BYTES 0x1407 +#define GL_3_BYTES 0x1408 +#define GL_4_BYTES 0x1409 +#define GL_DOUBLE 0x140A + +/* Primitives */ +#define GL_POINTS 0x0000 +#define GL_LINES 0x0001 +#define GL_LINE_LOOP 0x0002 +#define GL_LINE_STRIP 0x0003 +#define GL_TRIANGLES 0x0004 +#define GL_TRIANGLE_STRIP 0x0005 +#define GL_TRIANGLE_FAN 0x0006 +#define GL_QUADS 0x0007 +#define GL_QUAD_STRIP 0x0008 +#define GL_POLYGON 0x0009 + +/* Vertex Arrays */ +#define GL_VERTEX_ARRAY 0x8074 +#define GL_NORMAL_ARRAY 0x8075 +#define GL_COLOR_ARRAY 0x8076 +#define GL_INDEX_ARRAY 0x8077 +#define GL_TEXTURE_COORD_ARRAY 0x8078 +#define GL_EDGE_FLAG_ARRAY 0x8079 +#define GL_VERTEX_ARRAY_SIZE 0x807A +#define GL_VERTEX_ARRAY_TYPE 0x807B +#define GL_VERTEX_ARRAY_STRIDE 0x807C +#define GL_NORMAL_ARRAY_TYPE 0x807E +#define GL_NORMAL_ARRAY_STRIDE 0x807F +#define GL_COLOR_ARRAY_SIZE 0x8081 +#define GL_COLOR_ARRAY_TYPE 0x8082 +#define GL_COLOR_ARRAY_STRIDE 0x8083 +#define GL_INDEX_ARRAY_TYPE 0x8085 +#define GL_INDEX_ARRAY_STRIDE 0x8086 +#define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088 +#define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089 +#define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A +#define GL_EDGE_FLAG_ARRAY_STRIDE 0x808C +#define GL_VERTEX_ARRAY_POINTER 0x808E +#define GL_NORMAL_ARRAY_POINTER 0x808F +#define GL_COLOR_ARRAY_POINTER 0x8090 +#define GL_INDEX_ARRAY_POINTER 0x8091 +#define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092 +#define GL_EDGE_FLAG_ARRAY_POINTER 0x8093 +#define GL_V2F 0x2A20 +#define GL_V3F 0x2A21 +#define GL_C4UB_V2F 0x2A22 +#define GL_C4UB_V3F 0x2A23 +#define GL_C3F_V3F 0x2A24 +#define GL_N3F_V3F 0x2A25 +#define GL_C4F_N3F_V3F 0x2A26 +#define GL_T2F_V3F 0x2A27 +#define GL_T4F_V4F 0x2A28 +#define GL_T2F_C4UB_V3F 0x2A29 +#define GL_T2F_C3F_V3F 0x2A2A +#define GL_T2F_N3F_V3F 0x2A2B +#define GL_T2F_C4F_N3F_V3F 0x2A2C +#define GL_T4F_C4F_N3F_V4F 0x2A2D + +/* Matrix Mode */ +#define GL_MATRIX_MODE 0x0BA0 +#define GL_MODELVIEW 0x1700 +#define GL_PROJECTION 0x1701 +#define GL_TEXTURE 0x1702 + +/* Points */ +#define GL_POINT_SMOOTH 0x0B10 +#define GL_POINT_SIZE 0x0B11 +#define GL_POINT_SIZE_GRANULARITY 0x0B13 +#define GL_POINT_SIZE_RANGE 0x0B12 + +/* Lines */ +#define GL_LINE_SMOOTH 0x0B20 +#define GL_LINE_STIPPLE 0x0B24 +#define GL_LINE_STIPPLE_PATTERN 0x0B25 +#define GL_LINE_STIPPLE_REPEAT 0x0B26 +#define GL_LINE_WIDTH 0x0B21 +#define GL_LINE_WIDTH_GRANULARITY 0x0B23 +#define GL_LINE_WIDTH_RANGE 0x0B22 + +/* Polygons */ +#define GL_POINT 0x1B00 +#define GL_LINE 0x1B01 +#define GL_FILL 0x1B02 +#define GL_CW 0x0900 +#define GL_CCW 0x0901 +#define GL_FRONT 0x0404 +#define GL_BACK 0x0405 +#define GL_POLYGON_MODE 0x0B40 +#define GL_POLYGON_SMOOTH 0x0B41 +#define GL_POLYGON_STIPPLE 0x0B42 +#define GL_EDGE_FLAG 0x0B43 +#define GL_CULL_FACE 0x0B44 +#define GL_CULL_FACE_MODE 0x0B45 +#define GL_FRONT_FACE 0x0B46 +#define GL_POLYGON_OFFSET_FACTOR 0x8038 +#define GL_POLYGON_OFFSET_UNITS 0x2A00 +#define GL_POLYGON_OFFSET_POINT 0x2A01 +#define GL_POLYGON_OFFSET_LINE 0x2A02 +#define GL_POLYGON_OFFSET_FILL 0x8037 + +/* Display Lists */ +#define GL_COMPILE 0x1300 +#define GL_COMPILE_AND_EXECUTE 0x1301 +#define GL_LIST_BASE 0x0B32 +#define GL_LIST_INDEX 0x0B33 +#define GL_LIST_MODE 0x0B30 + +/* Depth buffer */ +#define GL_NEVER 0x0200 +#define GL_LESS 0x0201 +#define GL_EQUAL 0x0202 +#define GL_LEQUAL 0x0203 +#define GL_GREATER 0x0204 +#define GL_NOTEQUAL 0x0205 +#define GL_GEQUAL 0x0206 +#define GL_ALWAYS 0x0207 +#define GL_DEPTH_TEST 0x0B71 +#define GL_DEPTH_BITS 0x0D56 +#define GL_DEPTH_CLEAR_VALUE 0x0B73 +#define GL_DEPTH_FUNC 0x0B74 +#define GL_DEPTH_RANGE 0x0B70 +#define GL_DEPTH_WRITEMASK 0x0B72 +#define GL_DEPTH_COMPONENT 0x1902 + +/* Lighting */ +#define GL_LIGHTING 0x0B50 +#define GL_LIGHT0 0x4000 +#define GL_LIGHT1 0x4001 +#define GL_LIGHT2 0x4002 +#define GL_LIGHT3 0x4003 +#define GL_LIGHT4 0x4004 +#define GL_LIGHT5 0x4005 +#define GL_LIGHT6 0x4006 +#define GL_LIGHT7 0x4007 +#define GL_SPOT_EXPONENT 0x1205 +#define GL_SPOT_CUTOFF 0x1206 +#define GL_CONSTANT_ATTENUATION 0x1207 +#define GL_LINEAR_ATTENUATION 0x1208 +#define GL_QUADRATIC_ATTENUATION 0x1209 +#define GL_AMBIENT 0x1200 +#define GL_DIFFUSE 0x1201 +#define GL_SPECULAR 0x1202 +#define GL_SHININESS 0x1601 +#define GL_EMISSION 0x1600 +#define GL_POSITION 0x1203 +#define GL_SPOT_DIRECTION 0x1204 +#define GL_AMBIENT_AND_DIFFUSE 0x1602 +#define GL_COLOR_INDEXES 0x1603 +#define GL_LIGHT_MODEL_TWO_SIDE 0x0B52 +#define GL_LIGHT_MODEL_LOCAL_VIEWER 0x0B51 +#define GL_LIGHT_MODEL_AMBIENT 0x0B53 +#define GL_FRONT_AND_BACK 0x0408 +#define GL_SHADE_MODEL 0x0B54 +#define GL_FLAT 0x1D00 +#define GL_SMOOTH 0x1D01 +#define GL_COLOR_MATERIAL 0x0B57 +#define GL_COLOR_MATERIAL_FACE 0x0B55 +#define GL_COLOR_MATERIAL_PARAMETER 0x0B56 +#define GL_NORMALIZE 0x0BA1 + +/* User clipping planes */ +#define GL_CLIP_PLANE0 0x3000 +#define GL_CLIP_PLANE1 0x3001 +#define GL_CLIP_PLANE2 0x3002 +#define GL_CLIP_PLANE3 0x3003 +#define GL_CLIP_PLANE4 0x3004 +#define GL_CLIP_PLANE5 0x3005 + +/* Accumulation buffer */ +#define GL_ACCUM_RED_BITS 0x0D58 +#define GL_ACCUM_GREEN_BITS 0x0D59 +#define GL_ACCUM_BLUE_BITS 0x0D5A +#define GL_ACCUM_ALPHA_BITS 0x0D5B +#define GL_ACCUM_CLEAR_VALUE 0x0B80 +#define GL_ACCUM 0x0100 +#define GL_ADD 0x0104 +#define GL_LOAD 0x0101 +#define GL_MULT 0x0103 +#define GL_RETURN 0x0102 + +/* Alpha testing */ +#define GL_ALPHA_TEST 0x0BC0 +#define GL_ALPHA_TEST_REF 0x0BC2 +#define GL_ALPHA_TEST_FUNC 0x0BC1 + +/* Blending */ +#define GL_BLEND 0x0BE2 +#define GL_BLEND_SRC 0x0BE1 +#define GL_BLEND_DST 0x0BE0 +#define GL_ZERO 0 +#define GL_ONE 1 +#define GL_SRC_COLOR 0x0300 +#define GL_ONE_MINUS_SRC_COLOR 0x0301 +#define GL_SRC_ALPHA 0x0302 +#define GL_ONE_MINUS_SRC_ALPHA 0x0303 +#define GL_DST_ALPHA 0x0304 +#define GL_ONE_MINUS_DST_ALPHA 0x0305 +#define GL_DST_COLOR 0x0306 +#define GL_ONE_MINUS_DST_COLOR 0x0307 +#define GL_SRC_ALPHA_SATURATE 0x0308 + +/* Render Mode */ +#define GL_FEEDBACK 0x1C01 +#define GL_RENDER 0x1C00 +#define GL_SELECT 0x1C02 + +/* Feedback */ +#define GL_2D 0x0600 +#define GL_3D 0x0601 +#define GL_3D_COLOR 0x0602 +#define GL_3D_COLOR_TEXTURE 0x0603 +#define GL_4D_COLOR_TEXTURE 0x0604 +#define GL_POINT_TOKEN 0x0701 +#define GL_LINE_TOKEN 0x0702 +#define GL_LINE_RESET_TOKEN 0x0707 +#define GL_POLYGON_TOKEN 0x0703 +#define GL_BITMAP_TOKEN 0x0704 +#define GL_DRAW_PIXEL_TOKEN 0x0705 +#define GL_COPY_PIXEL_TOKEN 0x0706 +#define GL_PASS_THROUGH_TOKEN 0x0700 +#define GL_FEEDBACK_BUFFER_POINTER 0x0DF0 +#define GL_FEEDBACK_BUFFER_SIZE 0x0DF1 +#define GL_FEEDBACK_BUFFER_TYPE 0x0DF2 + +/* Selection */ +#define GL_SELECTION_BUFFER_POINTER 0x0DF3 +#define GL_SELECTION_BUFFER_SIZE 0x0DF4 + +/* Fog */ +#define GL_FOG 0x0B60 +#define GL_FOG_MODE 0x0B65 +#define GL_FOG_DENSITY 0x0B62 +#define GL_FOG_COLOR 0x0B66 +#define GL_FOG_INDEX 0x0B61 +#define GL_FOG_START 0x0B63 +#define GL_FOG_END 0x0B64 +#define GL_LINEAR 0x2601 +#define GL_EXP 0x0800 +#define GL_EXP2 0x0801 + +/* Logic Ops */ +#define GL_LOGIC_OP 0x0BF1 +#define GL_INDEX_LOGIC_OP 0x0BF1 +#define GL_COLOR_LOGIC_OP 0x0BF2 +#define GL_LOGIC_OP_MODE 0x0BF0 +#define GL_CLEAR 0x1500 +#define GL_SET 0x150F +#define GL_COPY 0x1503 +#define GL_COPY_INVERTED 0x150C +#define GL_NOOP 0x1505 +#define GL_INVERT 0x150A +#define GL_AND 0x1501 +#define GL_NAND 0x150E +#define GL_OR 0x1507 +#define GL_NOR 0x1508 +#define GL_XOR 0x1506 +#define GL_EQUIV 0x1509 +#define GL_AND_REVERSE 0x1502 +#define GL_AND_INVERTED 0x1504 +#define GL_OR_REVERSE 0x150B +#define GL_OR_INVERTED 0x150D + +/* Stencil */ +#define GL_STENCIL_BITS 0x0D57 +#define GL_STENCIL_TEST 0x0B90 +#define GL_STENCIL_CLEAR_VALUE 0x0B91 +#define GL_STENCIL_FUNC 0x0B92 +#define GL_STENCIL_VALUE_MASK 0x0B93 +#define GL_STENCIL_FAIL 0x0B94 +#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95 +#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96 +#define GL_STENCIL_REF 0x0B97 +#define GL_STENCIL_WRITEMASK 0x0B98 +#define GL_STENCIL_INDEX 0x1901 +#define GL_KEEP 0x1E00 +#define GL_REPLACE 0x1E01 +#define GL_INCR 0x1E02 +#define GL_DECR 0x1E03 + +/* Buffers, Pixel Drawing/Reading */ +#define GL_NONE 0 +#define GL_LEFT 0x0406 +#define GL_RIGHT 0x0407 +/*GL_FRONT 0x0404 */ +/*GL_BACK 0x0405 */ +/*GL_FRONT_AND_BACK 0x0408 */ +#define GL_FRONT_LEFT 0x0400 +#define GL_FRONT_RIGHT 0x0401 +#define GL_BACK_LEFT 0x0402 +#define GL_BACK_RIGHT 0x0403 +#define GL_AUX0 0x0409 +#define GL_AUX1 0x040A +#define GL_AUX2 0x040B +#define GL_AUX3 0x040C +#define GL_COLOR_INDEX 0x1900 +#define GL_RED 0x1903 +#define GL_GREEN 0x1904 +#define GL_BLUE 0x1905 +#define GL_ALPHA 0x1906 +#define GL_LUMINANCE 0x1909 +#define GL_LUMINANCE_ALPHA 0x190A +#define GL_ALPHA_BITS 0x0D55 +#define GL_RED_BITS 0x0D52 +#define GL_GREEN_BITS 0x0D53 +#define GL_BLUE_BITS 0x0D54 +#define GL_INDEX_BITS 0x0D51 +#define GL_SUBPIXEL_BITS 0x0D50 +#define GL_AUX_BUFFERS 0x0C00 +#define GL_READ_BUFFER 0x0C02 +#define GL_DRAW_BUFFER 0x0C01 +#define GL_DOUBLEBUFFER 0x0C32 +#define GL_STEREO 0x0C33 +#define GL_BITMAP 0x1A00 +#define GL_COLOR 0x1800 +#define GL_DEPTH 0x1801 +#define GL_STENCIL 0x1802 +#define GL_DITHER 0x0BD0 +#define GL_RGB 0x1907 +#define GL_RGBA 0x1908 + +/* Implementation limits */ +#define GL_MAX_LIST_NESTING 0x0B31 +#define GL_MAX_EVAL_ORDER 0x0D30 +#define GL_MAX_LIGHTS 0x0D31 +#define GL_MAX_CLIP_PLANES 0x0D32 +#define GL_MAX_TEXTURE_SIZE 0x0D33 +#define GL_MAX_PIXEL_MAP_TABLE 0x0D34 +#define GL_MAX_ATTRIB_STACK_DEPTH 0x0D35 +#define GL_MAX_MODELVIEW_STACK_DEPTH 0x0D36 +#define GL_MAX_NAME_STACK_DEPTH 0x0D37 +#define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38 +#define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39 +#define GL_MAX_VIEWPORT_DIMS 0x0D3A +#define GL_MAX_CLIENT_ATTRIB_STACK_DEPTH 0x0D3B + +/* Gets */ +#define GL_ATTRIB_STACK_DEPTH 0x0BB0 +#define GL_CLIENT_ATTRIB_STACK_DEPTH 0x0BB1 +#define GL_COLOR_CLEAR_VALUE 0x0C22 +#define GL_COLOR_WRITEMASK 0x0C23 +#define GL_CURRENT_INDEX 0x0B01 +#define GL_CURRENT_COLOR 0x0B00 +#define GL_CURRENT_NORMAL 0x0B02 +#define GL_CURRENT_RASTER_COLOR 0x0B04 +#define GL_CURRENT_RASTER_DISTANCE 0x0B09 +#define GL_CURRENT_RASTER_INDEX 0x0B05 +#define GL_CURRENT_RASTER_POSITION 0x0B07 +#define GL_CURRENT_RASTER_TEXTURE_COORDS 0x0B06 +#define GL_CURRENT_RASTER_POSITION_VALID 0x0B08 +#define GL_CURRENT_TEXTURE_COORDS 0x0B03 +#define GL_INDEX_CLEAR_VALUE 0x0C20 +#define GL_INDEX_MODE 0x0C30 +#define GL_INDEX_WRITEMASK 0x0C21 +#define GL_MODELVIEW_MATRIX 0x0BA6 +#define GL_MODELVIEW_STACK_DEPTH 0x0BA3 +#define GL_NAME_STACK_DEPTH 0x0D70 +#define GL_PROJECTION_MATRIX 0x0BA7 +#define GL_PROJECTION_STACK_DEPTH 0x0BA4 +#define GL_RENDER_MODE 0x0C40 +#define GL_RGBA_MODE 0x0C31 +#define GL_TEXTURE_MATRIX 0x0BA8 +#define GL_TEXTURE_STACK_DEPTH 0x0BA5 +#define GL_VIEWPORT 0x0BA2 + +/* Evaluators */ +#define GL_AUTO_NORMAL 0x0D80 +#define GL_MAP1_COLOR_4 0x0D90 +#define GL_MAP1_INDEX 0x0D91 +#define GL_MAP1_NORMAL 0x0D92 +#define GL_MAP1_TEXTURE_COORD_1 0x0D93 +#define GL_MAP1_TEXTURE_COORD_2 0x0D94 +#define GL_MAP1_TEXTURE_COORD_3 0x0D95 +#define GL_MAP1_TEXTURE_COORD_4 0x0D96 +#define GL_MAP1_VERTEX_3 0x0D97 +#define GL_MAP1_VERTEX_4 0x0D98 +#define GL_MAP2_COLOR_4 0x0DB0 +#define GL_MAP2_INDEX 0x0DB1 +#define GL_MAP2_NORMAL 0x0DB2 +#define GL_MAP2_TEXTURE_COORD_1 0x0DB3 +#define GL_MAP2_TEXTURE_COORD_2 0x0DB4 +#define GL_MAP2_TEXTURE_COORD_3 0x0DB5 +#define GL_MAP2_TEXTURE_COORD_4 0x0DB6 +#define GL_MAP2_VERTEX_3 0x0DB7 +#define GL_MAP2_VERTEX_4 0x0DB8 +#define GL_MAP1_GRID_DOMAIN 0x0DD0 +#define GL_MAP1_GRID_SEGMENTS 0x0DD1 +#define GL_MAP2_GRID_DOMAIN 0x0DD2 +#define GL_MAP2_GRID_SEGMENTS 0x0DD3 +#define GL_COEFF 0x0A00 +#define GL_ORDER 0x0A01 +#define GL_DOMAIN 0x0A02 + +/* Hints */ +#define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50 +#define GL_POINT_SMOOTH_HINT 0x0C51 +#define GL_LINE_SMOOTH_HINT 0x0C52 +#define GL_POLYGON_SMOOTH_HINT 0x0C53 +#define GL_FOG_HINT 0x0C54 +#define GL_DONT_CARE 0x1100 +#define GL_FASTEST 0x1101 +#define GL_NICEST 0x1102 + +/* Scissor box */ +#define GL_SCISSOR_BOX 0x0C10 +#define GL_SCISSOR_TEST 0x0C11 + +/* Pixel Mode / Transfer */ +#define GL_MAP_COLOR 0x0D10 +#define GL_MAP_STENCIL 0x0D11 +#define GL_INDEX_SHIFT 0x0D12 +#define GL_INDEX_OFFSET 0x0D13 +#define GL_RED_SCALE 0x0D14 +#define GL_RED_BIAS 0x0D15 +#define GL_GREEN_SCALE 0x0D18 +#define GL_GREEN_BIAS 0x0D19 +#define GL_BLUE_SCALE 0x0D1A +#define GL_BLUE_BIAS 0x0D1B +#define GL_ALPHA_SCALE 0x0D1C +#define GL_ALPHA_BIAS 0x0D1D +#define GL_DEPTH_SCALE 0x0D1E +#define GL_DEPTH_BIAS 0x0D1F +#define GL_PIXEL_MAP_S_TO_S_SIZE 0x0CB1 +#define GL_PIXEL_MAP_I_TO_I_SIZE 0x0CB0 +#define GL_PIXEL_MAP_I_TO_R_SIZE 0x0CB2 +#define GL_PIXEL_MAP_I_TO_G_SIZE 0x0CB3 +#define GL_PIXEL_MAP_I_TO_B_SIZE 0x0CB4 +#define GL_PIXEL_MAP_I_TO_A_SIZE 0x0CB5 +#define GL_PIXEL_MAP_R_TO_R_SIZE 0x0CB6 +#define GL_PIXEL_MAP_G_TO_G_SIZE 0x0CB7 +#define GL_PIXEL_MAP_B_TO_B_SIZE 0x0CB8 +#define GL_PIXEL_MAP_A_TO_A_SIZE 0x0CB9 +#define GL_PIXEL_MAP_S_TO_S 0x0C71 +#define GL_PIXEL_MAP_I_TO_I 0x0C70 +#define GL_PIXEL_MAP_I_TO_R 0x0C72 +#define GL_PIXEL_MAP_I_TO_G 0x0C73 +#define GL_PIXEL_MAP_I_TO_B 0x0C74 +#define GL_PIXEL_MAP_I_TO_A 0x0C75 +#define GL_PIXEL_MAP_R_TO_R 0x0C76 +#define GL_PIXEL_MAP_G_TO_G 0x0C77 +#define GL_PIXEL_MAP_B_TO_B 0x0C78 +#define GL_PIXEL_MAP_A_TO_A 0x0C79 +#define GL_PACK_ALIGNMENT 0x0D05 +#define GL_PACK_LSB_FIRST 0x0D01 +#define GL_PACK_ROW_LENGTH 0x0D02 +#define GL_PACK_SKIP_PIXELS 0x0D04 +#define GL_PACK_SKIP_ROWS 0x0D03 +#define GL_PACK_SWAP_BYTES 0x0D00 +#define GL_UNPACK_ALIGNMENT 0x0CF5 +#define GL_UNPACK_LSB_FIRST 0x0CF1 +#define GL_UNPACK_ROW_LENGTH 0x0CF2 +#define GL_UNPACK_SKIP_PIXELS 0x0CF4 +#define GL_UNPACK_SKIP_ROWS 0x0CF3 +#define GL_UNPACK_SWAP_BYTES 0x0CF0 +#define GL_ZOOM_X 0x0D16 +#define GL_ZOOM_Y 0x0D17 + +/* Texture mapping */ +#define GL_TEXTURE_ENV 0x2300 +#define GL_TEXTURE_ENV_MODE 0x2200 +#define GL_TEXTURE_1D 0x0DE0 +#define GL_TEXTURE_2D 0x0DE1 +#define GL_TEXTURE_WRAP_S 0x2802 +#define GL_TEXTURE_WRAP_T 0x2803 +#define GL_TEXTURE_MAG_FILTER 0x2800 +#define GL_TEXTURE_MIN_FILTER 0x2801 +#define GL_TEXTURE_ENV_COLOR 0x2201 +#define GL_TEXTURE_GEN_S 0x0C60 +#define GL_TEXTURE_GEN_T 0x0C61 +#define GL_TEXTURE_GEN_R 0x0C62 +#define GL_TEXTURE_GEN_Q 0x0C63 +#define GL_TEXTURE_GEN_MODE 0x2500 +#define GL_TEXTURE_BORDER_COLOR 0x1004 +#define GL_TEXTURE_WIDTH 0x1000 +#define GL_TEXTURE_HEIGHT 0x1001 +#define GL_TEXTURE_BORDER 0x1005 +#define GL_TEXTURE_COMPONENTS 0x1003 +#define GL_TEXTURE_RED_SIZE 0x805C +#define GL_TEXTURE_GREEN_SIZE 0x805D +#define GL_TEXTURE_BLUE_SIZE 0x805E +#define GL_TEXTURE_ALPHA_SIZE 0x805F +#define GL_TEXTURE_LUMINANCE_SIZE 0x8060 +#define GL_TEXTURE_INTENSITY_SIZE 0x8061 +#define GL_NEAREST_MIPMAP_NEAREST 0x2700 +#define GL_NEAREST_MIPMAP_LINEAR 0x2702 +#define GL_LINEAR_MIPMAP_NEAREST 0x2701 +#define GL_LINEAR_MIPMAP_LINEAR 0x2703 +#define GL_OBJECT_LINEAR 0x2401 +#define GL_OBJECT_PLANE 0x2501 +#define GL_EYE_LINEAR 0x2400 +#define GL_EYE_PLANE 0x2502 +#define GL_SPHERE_MAP 0x2402 +#define GL_DECAL 0x2101 +#define GL_MODULATE 0x2100 +#define GL_NEAREST 0x2600 +#define GL_REPEAT 0x2901 +#define GL_CLAMP 0x2900 +#define GL_S 0x2000 +#define GL_T 0x2001 +#define GL_R 0x2002 +#define GL_Q 0x2003 + +/* Utility */ +#define GL_VENDOR 0x1F00 +#define GL_RENDERER 0x1F01 +#define GL_VERSION 0x1F02 +#define GL_EXTENSIONS 0x1F03 + +/* Errors */ +#define GL_NO_ERROR 0 +#define GL_INVALID_ENUM 0x0500 +#define GL_INVALID_VALUE 0x0501 +#define GL_INVALID_OPERATION 0x0502 +#define GL_STACK_OVERFLOW 0x0503 +#define GL_STACK_UNDERFLOW 0x0504 +#define GL_OUT_OF_MEMORY 0x0505 + +/* glPush/PopAttrib bits */ +#define GL_CURRENT_BIT 0x00000001 +#define GL_POINT_BIT 0x00000002 +#define GL_LINE_BIT 0x00000004 +#define GL_POLYGON_BIT 0x00000008 +#define GL_POLYGON_STIPPLE_BIT 0x00000010 +#define GL_PIXEL_MODE_BIT 0x00000020 +#define GL_LIGHTING_BIT 0x00000040 +#define GL_FOG_BIT 0x00000080 +#define GL_DEPTH_BUFFER_BIT 0x00000100 +#define GL_ACCUM_BUFFER_BIT 0x00000200 +#define GL_STENCIL_BUFFER_BIT 0x00000400 +#define GL_VIEWPORT_BIT 0x00000800 +#define GL_TRANSFORM_BIT 0x00001000 +#define GL_ENABLE_BIT 0x00002000 +#define GL_COLOR_BUFFER_BIT 0x00004000 +#define GL_HINT_BIT 0x00008000 +#define GL_EVAL_BIT 0x00010000 +#define GL_LIST_BIT 0x00020000 +#define GL_TEXTURE_BIT 0x00040000 +#define GL_SCISSOR_BIT 0x00080000 +#define GL_ALL_ATTRIB_BITS 0x000FFFFF + + +/* OpenGL 1.1 */ +#define GL_PROXY_TEXTURE_1D 0x8063 +#define GL_PROXY_TEXTURE_2D 0x8064 +#define GL_TEXTURE_PRIORITY 0x8066 +#define GL_TEXTURE_RESIDENT 0x8067 +#define GL_TEXTURE_BINDING_1D 0x8068 +#define GL_TEXTURE_BINDING_2D 0x8069 +#define GL_TEXTURE_INTERNAL_FORMAT 0x1003 +#define GL_ALPHA4 0x803B +#define GL_ALPHA8 0x803C +#define GL_ALPHA12 0x803D +#define GL_ALPHA16 0x803E +#define GL_LUMINANCE4 0x803F +#define GL_LUMINANCE8 0x8040 +#define GL_LUMINANCE12 0x8041 +#define GL_LUMINANCE16 0x8042 +#define GL_LUMINANCE4_ALPHA4 0x8043 +#define GL_LUMINANCE6_ALPHA2 0x8044 +#define GL_LUMINANCE8_ALPHA8 0x8045 +#define GL_LUMINANCE12_ALPHA4 0x8046 +#define GL_LUMINANCE12_ALPHA12 0x8047 +#define GL_LUMINANCE16_ALPHA16 0x8048 +#define GL_INTENSITY 0x8049 +#define GL_INTENSITY4 0x804A +#define GL_INTENSITY8 0x804B +#define GL_INTENSITY12 0x804C +#define GL_INTENSITY16 0x804D +#define GL_R3_G3_B2 0x2A10 +#define GL_RGB4 0x804F +#define GL_RGB5 0x8050 +#define GL_RGB8 0x8051 +#define GL_RGB10 0x8052 +#define GL_RGB12 0x8053 +#define GL_RGB16 0x8054 +#define GL_RGBA2 0x8055 +#define GL_RGBA4 0x8056 +#define GL_RGB5_A1 0x8057 +#define GL_RGBA8 0x8058 +#define GL_RGB10_A2 0x8059 +#define GL_RGBA12 0x805A +#define GL_RGBA16 0x805B +#define GL_CLIENT_PIXEL_STORE_BIT 0x00000001 +#define GL_CLIENT_VERTEX_ARRAY_BIT 0x00000002 +#define GL_ALL_CLIENT_ATTRIB_BITS 0xFFFFFFFF +#define GL_CLIENT_ALL_ATTRIB_BITS 0xFFFFFFFF + + + +/* + * Miscellaneous + */ + +GLAPI void GLAPIENTRY glClearIndex( GLfloat c ); + +GLAPI void GLAPIENTRY glClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ); + +GLAPI void GLAPIENTRY glClear( GLbitfield mask ); + +GLAPI void GLAPIENTRY glIndexMask( GLuint mask ); + +GLAPI void GLAPIENTRY glColorMask( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha ); + +GLAPI void GLAPIENTRY glAlphaFunc( GLenum func, GLclampf ref ); + +GLAPI void GLAPIENTRY glBlendFunc( GLenum sfactor, GLenum dfactor ); + +GLAPI void GLAPIENTRY glLogicOp( GLenum opcode ); + +GLAPI void GLAPIENTRY glCullFace( GLenum mode ); + +GLAPI void GLAPIENTRY glFrontFace( GLenum mode ); + +GLAPI void GLAPIENTRY glPointSize( GLfloat size ); + +GLAPI void GLAPIENTRY glLineWidth( GLfloat width ); + +GLAPI void GLAPIENTRY glLineStipple( GLint factor, GLushort pattern ); + +GLAPI void GLAPIENTRY glPolygonMode( GLenum face, GLenum mode ); + +GLAPI void GLAPIENTRY glPolygonOffset( GLfloat factor, GLfloat units ); + +GLAPI void GLAPIENTRY glPolygonStipple( const GLubyte *mask ); + +GLAPI void GLAPIENTRY glGetPolygonStipple( GLubyte *mask ); + +GLAPI void GLAPIENTRY glEdgeFlag( GLboolean flag ); + +GLAPI void GLAPIENTRY glEdgeFlagv( const GLboolean *flag ); + +GLAPI void GLAPIENTRY glScissor( GLint x, GLint y, GLsizei width, GLsizei height); + +GLAPI void GLAPIENTRY glClipPlane( GLenum plane, const GLdouble *equation ); + +GLAPI void GLAPIENTRY glGetClipPlane( GLenum plane, GLdouble *equation ); + +GLAPI void GLAPIENTRY glDrawBuffer( GLenum mode ); + +GLAPI void GLAPIENTRY glReadBuffer( GLenum mode ); + +GLAPI void GLAPIENTRY glEnable( GLenum cap ); + +GLAPI void GLAPIENTRY glDisable( GLenum cap ); + +GLAPI GLboolean GLAPIENTRY glIsEnabled( GLenum cap ); + + +GLAPI void GLAPIENTRY glEnableClientState( GLenum cap ); /* 1.1 */ + +GLAPI void GLAPIENTRY glDisableClientState( GLenum cap ); /* 1.1 */ + + +GLAPI void GLAPIENTRY glGetBooleanv( GLenum pname, GLboolean *params ); + +GLAPI void GLAPIENTRY glGetDoublev( GLenum pname, GLdouble *params ); + +GLAPI void GLAPIENTRY glGetFloatv( GLenum pname, GLfloat *params ); + +GLAPI void GLAPIENTRY glGetIntegerv( GLenum pname, GLint *params ); + + +GLAPI void GLAPIENTRY glPushAttrib( GLbitfield mask ); + +GLAPI void GLAPIENTRY glPopAttrib( void ); + + +GLAPI void GLAPIENTRY glPushClientAttrib( GLbitfield mask ); /* 1.1 */ + +GLAPI void GLAPIENTRY glPopClientAttrib( void ); /* 1.1 */ + + +GLAPI GLint GLAPIENTRY glRenderMode( GLenum mode ); + +GLAPI GLenum GLAPIENTRY glGetError( void ); + +GLAPI const GLubyte * GLAPIENTRY glGetString( GLenum name ); + +GLAPI void GLAPIENTRY glFinish( void ); + +GLAPI void GLAPIENTRY glFlush( void ); + +GLAPI void GLAPIENTRY glHint( GLenum target, GLenum mode ); + + +/* + * Depth Buffer + */ + +GLAPI void GLAPIENTRY glClearDepth( GLclampd depth ); + +GLAPI void GLAPIENTRY glDepthFunc( GLenum func ); + +GLAPI void GLAPIENTRY glDepthMask( GLboolean flag ); + +GLAPI void GLAPIENTRY glDepthRange( GLclampd near_val, GLclampd far_val ); + + +/* + * Accumulation Buffer + */ + +GLAPI void GLAPIENTRY glClearAccum( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ); + +GLAPI void GLAPIENTRY glAccum( GLenum op, GLfloat value ); + + +/* + * Transformation + */ + +GLAPI void GLAPIENTRY glMatrixMode( GLenum mode ); + +GLAPI void GLAPIENTRY glOrtho( GLdouble left, GLdouble right, + GLdouble bottom, GLdouble top, + GLdouble near_val, GLdouble far_val ); + +GLAPI void GLAPIENTRY glFrustum( GLdouble left, GLdouble right, + GLdouble bottom, GLdouble top, + GLdouble near_val, GLdouble far_val ); + +GLAPI void GLAPIENTRY glViewport( GLint x, GLint y, + GLsizei width, GLsizei height ); + +GLAPI void GLAPIENTRY glPushMatrix( void ); + +GLAPI void GLAPIENTRY glPopMatrix( void ); + +GLAPI void GLAPIENTRY glLoadIdentity( void ); + +GLAPI void GLAPIENTRY glLoadMatrixd( const GLdouble *m ); +GLAPI void GLAPIENTRY glLoadMatrixf( const GLfloat *m ); + +GLAPI void GLAPIENTRY glMultMatrixd( const GLdouble *m ); +GLAPI void GLAPIENTRY glMultMatrixf( const GLfloat *m ); + +GLAPI void GLAPIENTRY glRotated( GLdouble angle, + GLdouble x, GLdouble y, GLdouble z ); +GLAPI void GLAPIENTRY glRotatef( GLfloat angle, + GLfloat x, GLfloat y, GLfloat z ); + +GLAPI void GLAPIENTRY glScaled( GLdouble x, GLdouble y, GLdouble z ); +GLAPI void GLAPIENTRY glScalef( GLfloat x, GLfloat y, GLfloat z ); + +GLAPI void GLAPIENTRY glTranslated( GLdouble x, GLdouble y, GLdouble z ); +GLAPI void GLAPIENTRY glTranslatef( GLfloat x, GLfloat y, GLfloat z ); + + +/* + * Display Lists + */ + +GLAPI GLboolean GLAPIENTRY glIsList( GLuint list ); + +GLAPI void GLAPIENTRY glDeleteLists( GLuint list, GLsizei range ); + +GLAPI GLuint GLAPIENTRY glGenLists( GLsizei range ); + +GLAPI void GLAPIENTRY glNewList( GLuint list, GLenum mode ); + +GLAPI void GLAPIENTRY glEndList( void ); + +GLAPI void GLAPIENTRY glCallList( GLuint list ); + +GLAPI void GLAPIENTRY glCallLists( GLsizei n, GLenum type, + const GLvoid *lists ); + +GLAPI void GLAPIENTRY glListBase( GLuint base ); + + +/* + * Drawing Functions + */ + +GLAPI void GLAPIENTRY glBegin( GLenum mode ); + +GLAPI void GLAPIENTRY glEnd( void ); + + +GLAPI void GLAPIENTRY glVertex2d( GLdouble x, GLdouble y ); +GLAPI void GLAPIENTRY glVertex2f( GLfloat x, GLfloat y ); +GLAPI void GLAPIENTRY glVertex2i( GLint x, GLint y ); +GLAPI void GLAPIENTRY glVertex2s( GLshort x, GLshort y ); + +GLAPI void GLAPIENTRY glVertex3d( GLdouble x, GLdouble y, GLdouble z ); +GLAPI void GLAPIENTRY glVertex3f( GLfloat x, GLfloat y, GLfloat z ); +GLAPI void GLAPIENTRY glVertex3i( GLint x, GLint y, GLint z ); +GLAPI void GLAPIENTRY glVertex3s( GLshort x, GLshort y, GLshort z ); + +GLAPI void GLAPIENTRY glVertex4d( GLdouble x, GLdouble y, GLdouble z, GLdouble w ); +GLAPI void GLAPIENTRY glVertex4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w ); +GLAPI void GLAPIENTRY glVertex4i( GLint x, GLint y, GLint z, GLint w ); +GLAPI void GLAPIENTRY glVertex4s( GLshort x, GLshort y, GLshort z, GLshort w ); + +GLAPI void GLAPIENTRY glVertex2dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glVertex2fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glVertex2iv( const GLint *v ); +GLAPI void GLAPIENTRY glVertex2sv( const GLshort *v ); + +GLAPI void GLAPIENTRY glVertex3dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glVertex3fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glVertex3iv( const GLint *v ); +GLAPI void GLAPIENTRY glVertex3sv( const GLshort *v ); + +GLAPI void GLAPIENTRY glVertex4dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glVertex4fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glVertex4iv( const GLint *v ); +GLAPI void GLAPIENTRY glVertex4sv( const GLshort *v ); + + +GLAPI void GLAPIENTRY glNormal3b( GLbyte nx, GLbyte ny, GLbyte nz ); +GLAPI void GLAPIENTRY glNormal3d( GLdouble nx, GLdouble ny, GLdouble nz ); +GLAPI void GLAPIENTRY glNormal3f( GLfloat nx, GLfloat ny, GLfloat nz ); +GLAPI void GLAPIENTRY glNormal3i( GLint nx, GLint ny, GLint nz ); +GLAPI void GLAPIENTRY glNormal3s( GLshort nx, GLshort ny, GLshort nz ); + +GLAPI void GLAPIENTRY glNormal3bv( const GLbyte *v ); +GLAPI void GLAPIENTRY glNormal3dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glNormal3fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glNormal3iv( const GLint *v ); +GLAPI void GLAPIENTRY glNormal3sv( const GLshort *v ); + + +GLAPI void GLAPIENTRY glIndexd( GLdouble c ); +GLAPI void GLAPIENTRY glIndexf( GLfloat c ); +GLAPI void GLAPIENTRY glIndexi( GLint c ); +GLAPI void GLAPIENTRY glIndexs( GLshort c ); +GLAPI void GLAPIENTRY glIndexub( GLubyte c ); /* 1.1 */ + +GLAPI void GLAPIENTRY glIndexdv( const GLdouble *c ); +GLAPI void GLAPIENTRY glIndexfv( const GLfloat *c ); +GLAPI void GLAPIENTRY glIndexiv( const GLint *c ); +GLAPI void GLAPIENTRY glIndexsv( const GLshort *c ); +GLAPI void GLAPIENTRY glIndexubv( const GLubyte *c ); /* 1.1 */ + +GLAPI void GLAPIENTRY glColor3b( GLbyte red, GLbyte green, GLbyte blue ); +GLAPI void GLAPIENTRY glColor3d( GLdouble red, GLdouble green, GLdouble blue ); +GLAPI void GLAPIENTRY glColor3f( GLfloat red, GLfloat green, GLfloat blue ); +GLAPI void GLAPIENTRY glColor3i( GLint red, GLint green, GLint blue ); +GLAPI void GLAPIENTRY glColor3s( GLshort red, GLshort green, GLshort blue ); +GLAPI void GLAPIENTRY glColor3ub( GLubyte red, GLubyte green, GLubyte blue ); +GLAPI void GLAPIENTRY glColor3ui( GLuint red, GLuint green, GLuint blue ); +GLAPI void GLAPIENTRY glColor3us( GLushort red, GLushort green, GLushort blue ); + +GLAPI void GLAPIENTRY glColor4b( GLbyte red, GLbyte green, + GLbyte blue, GLbyte alpha ); +GLAPI void GLAPIENTRY glColor4d( GLdouble red, GLdouble green, + GLdouble blue, GLdouble alpha ); +GLAPI void GLAPIENTRY glColor4f( GLfloat red, GLfloat green, + GLfloat blue, GLfloat alpha ); +GLAPI void GLAPIENTRY glColor4i( GLint red, GLint green, + GLint blue, GLint alpha ); +GLAPI void GLAPIENTRY glColor4s( GLshort red, GLshort green, + GLshort blue, GLshort alpha ); +GLAPI void GLAPIENTRY glColor4ub( GLubyte red, GLubyte green, + GLubyte blue, GLubyte alpha ); +GLAPI void GLAPIENTRY glColor4ui( GLuint red, GLuint green, + GLuint blue, GLuint alpha ); +GLAPI void GLAPIENTRY glColor4us( GLushort red, GLushort green, + GLushort blue, GLushort alpha ); + + +GLAPI void GLAPIENTRY glColor3bv( const GLbyte *v ); +GLAPI void GLAPIENTRY glColor3dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glColor3fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glColor3iv( const GLint *v ); +GLAPI void GLAPIENTRY glColor3sv( const GLshort *v ); +GLAPI void GLAPIENTRY glColor3ubv( const GLubyte *v ); +GLAPI void GLAPIENTRY glColor3uiv( const GLuint *v ); +GLAPI void GLAPIENTRY glColor3usv( const GLushort *v ); + +GLAPI void GLAPIENTRY glColor4bv( const GLbyte *v ); +GLAPI void GLAPIENTRY glColor4dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glColor4fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glColor4iv( const GLint *v ); +GLAPI void GLAPIENTRY glColor4sv( const GLshort *v ); +GLAPI void GLAPIENTRY glColor4ubv( const GLubyte *v ); +GLAPI void GLAPIENTRY glColor4uiv( const GLuint *v ); +GLAPI void GLAPIENTRY glColor4usv( const GLushort *v ); + + +GLAPI void GLAPIENTRY glTexCoord1d( GLdouble s ); +GLAPI void GLAPIENTRY glTexCoord1f( GLfloat s ); +GLAPI void GLAPIENTRY glTexCoord1i( GLint s ); +GLAPI void GLAPIENTRY glTexCoord1s( GLshort s ); + +GLAPI void GLAPIENTRY glTexCoord2d( GLdouble s, GLdouble t ); +GLAPI void GLAPIENTRY glTexCoord2f( GLfloat s, GLfloat t ); +GLAPI void GLAPIENTRY glTexCoord2i( GLint s, GLint t ); +GLAPI void GLAPIENTRY glTexCoord2s( GLshort s, GLshort t ); + +GLAPI void GLAPIENTRY glTexCoord3d( GLdouble s, GLdouble t, GLdouble r ); +GLAPI void GLAPIENTRY glTexCoord3f( GLfloat s, GLfloat t, GLfloat r ); +GLAPI void GLAPIENTRY glTexCoord3i( GLint s, GLint t, GLint r ); +GLAPI void GLAPIENTRY glTexCoord3s( GLshort s, GLshort t, GLshort r ); + +GLAPI void GLAPIENTRY glTexCoord4d( GLdouble s, GLdouble t, GLdouble r, GLdouble q ); +GLAPI void GLAPIENTRY glTexCoord4f( GLfloat s, GLfloat t, GLfloat r, GLfloat q ); +GLAPI void GLAPIENTRY glTexCoord4i( GLint s, GLint t, GLint r, GLint q ); +GLAPI void GLAPIENTRY glTexCoord4s( GLshort s, GLshort t, GLshort r, GLshort q ); + +GLAPI void GLAPIENTRY glTexCoord1dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glTexCoord1fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glTexCoord1iv( const GLint *v ); +GLAPI void GLAPIENTRY glTexCoord1sv( const GLshort *v ); + +GLAPI void GLAPIENTRY glTexCoord2dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glTexCoord2fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glTexCoord2iv( const GLint *v ); +GLAPI void GLAPIENTRY glTexCoord2sv( const GLshort *v ); + +GLAPI void GLAPIENTRY glTexCoord3dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glTexCoord3fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glTexCoord3iv( const GLint *v ); +GLAPI void GLAPIENTRY glTexCoord3sv( const GLshort *v ); + +GLAPI void GLAPIENTRY glTexCoord4dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glTexCoord4fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glTexCoord4iv( const GLint *v ); +GLAPI void GLAPIENTRY glTexCoord4sv( const GLshort *v ); + + +GLAPI void GLAPIENTRY glRasterPos2d( GLdouble x, GLdouble y ); +GLAPI void GLAPIENTRY glRasterPos2f( GLfloat x, GLfloat y ); +GLAPI void GLAPIENTRY glRasterPos2i( GLint x, GLint y ); +GLAPI void GLAPIENTRY glRasterPos2s( GLshort x, GLshort y ); + +GLAPI void GLAPIENTRY glRasterPos3d( GLdouble x, GLdouble y, GLdouble z ); +GLAPI void GLAPIENTRY glRasterPos3f( GLfloat x, GLfloat y, GLfloat z ); +GLAPI void GLAPIENTRY glRasterPos3i( GLint x, GLint y, GLint z ); +GLAPI void GLAPIENTRY glRasterPos3s( GLshort x, GLshort y, GLshort z ); + +GLAPI void GLAPIENTRY glRasterPos4d( GLdouble x, GLdouble y, GLdouble z, GLdouble w ); +GLAPI void GLAPIENTRY glRasterPos4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w ); +GLAPI void GLAPIENTRY glRasterPos4i( GLint x, GLint y, GLint z, GLint w ); +GLAPI void GLAPIENTRY glRasterPos4s( GLshort x, GLshort y, GLshort z, GLshort w ); + +GLAPI void GLAPIENTRY glRasterPos2dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glRasterPos2fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glRasterPos2iv( const GLint *v ); +GLAPI void GLAPIENTRY glRasterPos2sv( const GLshort *v ); + +GLAPI void GLAPIENTRY glRasterPos3dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glRasterPos3fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glRasterPos3iv( const GLint *v ); +GLAPI void GLAPIENTRY glRasterPos3sv( const GLshort *v ); + +GLAPI void GLAPIENTRY glRasterPos4dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glRasterPos4fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glRasterPos4iv( const GLint *v ); +GLAPI void GLAPIENTRY glRasterPos4sv( const GLshort *v ); + + +GLAPI void GLAPIENTRY glRectd( GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2 ); +GLAPI void GLAPIENTRY glRectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 ); +GLAPI void GLAPIENTRY glRecti( GLint x1, GLint y1, GLint x2, GLint y2 ); +GLAPI void GLAPIENTRY glRects( GLshort x1, GLshort y1, GLshort x2, GLshort y2 ); + + +GLAPI void GLAPIENTRY glRectdv( const GLdouble *v1, const GLdouble *v2 ); +GLAPI void GLAPIENTRY glRectfv( const GLfloat *v1, const GLfloat *v2 ); +GLAPI void GLAPIENTRY glRectiv( const GLint *v1, const GLint *v2 ); +GLAPI void GLAPIENTRY glRectsv( const GLshort *v1, const GLshort *v2 ); + + +/* + * Vertex Arrays (1.1) + */ + +GLAPI void GLAPIENTRY glVertexPointer( GLint size, GLenum type, + GLsizei stride, const GLvoid *ptr ); + +GLAPI void GLAPIENTRY glNormalPointer( GLenum type, GLsizei stride, + const GLvoid *ptr ); + +GLAPI void GLAPIENTRY glColorPointer( GLint size, GLenum type, + GLsizei stride, const GLvoid *ptr ); + +GLAPI void GLAPIENTRY glIndexPointer( GLenum type, GLsizei stride, + const GLvoid *ptr ); + +GLAPI void GLAPIENTRY glTexCoordPointer( GLint size, GLenum type, + GLsizei stride, const GLvoid *ptr ); + +GLAPI void GLAPIENTRY glEdgeFlagPointer( GLsizei stride, const GLvoid *ptr ); + +GLAPI void GLAPIENTRY glGetPointerv( GLenum pname, GLvoid **params ); + +GLAPI void GLAPIENTRY glArrayElement( GLint i ); + +GLAPI void GLAPIENTRY glDrawArrays( GLenum mode, GLint first, GLsizei count ); + +GLAPI void GLAPIENTRY glDrawElements( GLenum mode, GLsizei count, + GLenum type, const GLvoid *indices ); + +GLAPI void GLAPIENTRY glInterleavedArrays( GLenum format, GLsizei stride, + const GLvoid *pointer ); + +/* + * Lighting + */ + +GLAPI void GLAPIENTRY glShadeModel( GLenum mode ); + +GLAPI void GLAPIENTRY glLightf( GLenum light, GLenum pname, GLfloat param ); +GLAPI void GLAPIENTRY glLighti( GLenum light, GLenum pname, GLint param ); +GLAPI void GLAPIENTRY glLightfv( GLenum light, GLenum pname, + const GLfloat *params ); +GLAPI void GLAPIENTRY glLightiv( GLenum light, GLenum pname, + const GLint *params ); + +GLAPI void GLAPIENTRY glGetLightfv( GLenum light, GLenum pname, + GLfloat *params ); +GLAPI void GLAPIENTRY glGetLightiv( GLenum light, GLenum pname, + GLint *params ); + +GLAPI void GLAPIENTRY glLightModelf( GLenum pname, GLfloat param ); +GLAPI void GLAPIENTRY glLightModeli( GLenum pname, GLint param ); +GLAPI void GLAPIENTRY glLightModelfv( GLenum pname, const GLfloat *params ); +GLAPI void GLAPIENTRY glLightModeliv( GLenum pname, const GLint *params ); + +GLAPI void GLAPIENTRY glMaterialf( GLenum face, GLenum pname, GLfloat param ); +GLAPI void GLAPIENTRY glMateriali( GLenum face, GLenum pname, GLint param ); +GLAPI void GLAPIENTRY glMaterialfv( GLenum face, GLenum pname, const GLfloat *params ); +GLAPI void GLAPIENTRY glMaterialiv( GLenum face, GLenum pname, const GLint *params ); + +GLAPI void GLAPIENTRY glGetMaterialfv( GLenum face, GLenum pname, GLfloat *params ); +GLAPI void GLAPIENTRY glGetMaterialiv( GLenum face, GLenum pname, GLint *params ); + +GLAPI void GLAPIENTRY glColorMaterial( GLenum face, GLenum mode ); + + +/* + * Raster functions + */ + +GLAPI void GLAPIENTRY glPixelZoom( GLfloat xfactor, GLfloat yfactor ); + +GLAPI void GLAPIENTRY glPixelStoref( GLenum pname, GLfloat param ); +GLAPI void GLAPIENTRY glPixelStorei( GLenum pname, GLint param ); + +GLAPI void GLAPIENTRY glPixelTransferf( GLenum pname, GLfloat param ); +GLAPI void GLAPIENTRY glPixelTransferi( GLenum pname, GLint param ); + +GLAPI void GLAPIENTRY glPixelMapfv( GLenum map, GLsizei mapsize, + const GLfloat *values ); +GLAPI void GLAPIENTRY glPixelMapuiv( GLenum map, GLsizei mapsize, + const GLuint *values ); +GLAPI void GLAPIENTRY glPixelMapusv( GLenum map, GLsizei mapsize, + const GLushort *values ); + +GLAPI void GLAPIENTRY glGetPixelMapfv( GLenum map, GLfloat *values ); +GLAPI void GLAPIENTRY glGetPixelMapuiv( GLenum map, GLuint *values ); +GLAPI void GLAPIENTRY glGetPixelMapusv( GLenum map, GLushort *values ); + +GLAPI void GLAPIENTRY glBitmap( GLsizei width, GLsizei height, + GLfloat xorig, GLfloat yorig, + GLfloat xmove, GLfloat ymove, + const GLubyte *bitmap ); + +GLAPI void GLAPIENTRY glReadPixels( GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + GLvoid *pixels ); + +GLAPI void GLAPIENTRY glDrawPixels( GLsizei width, GLsizei height, + GLenum format, GLenum type, + const GLvoid *pixels ); + +GLAPI void GLAPIENTRY glCopyPixels( GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum type ); + +/* + * Stenciling + */ + +GLAPI void GLAPIENTRY glStencilFunc( GLenum func, GLint ref, GLuint mask ); + +GLAPI void GLAPIENTRY glStencilMask( GLuint mask ); + +GLAPI void GLAPIENTRY glStencilOp( GLenum fail, GLenum zfail, GLenum zpass ); + +GLAPI void GLAPIENTRY glClearStencil( GLint s ); + + + +/* + * Texture mapping + */ + +GLAPI void GLAPIENTRY glTexGend( GLenum coord, GLenum pname, GLdouble param ); +GLAPI void GLAPIENTRY glTexGenf( GLenum coord, GLenum pname, GLfloat param ); +GLAPI void GLAPIENTRY glTexGeni( GLenum coord, GLenum pname, GLint param ); + +GLAPI void GLAPIENTRY glTexGendv( GLenum coord, GLenum pname, const GLdouble *params ); +GLAPI void GLAPIENTRY glTexGenfv( GLenum coord, GLenum pname, const GLfloat *params ); +GLAPI void GLAPIENTRY glTexGeniv( GLenum coord, GLenum pname, const GLint *params ); + +GLAPI void GLAPIENTRY glGetTexGendv( GLenum coord, GLenum pname, GLdouble *params ); +GLAPI void GLAPIENTRY glGetTexGenfv( GLenum coord, GLenum pname, GLfloat *params ); +GLAPI void GLAPIENTRY glGetTexGeniv( GLenum coord, GLenum pname, GLint *params ); + + +GLAPI void GLAPIENTRY glTexEnvf( GLenum target, GLenum pname, GLfloat param ); +GLAPI void GLAPIENTRY glTexEnvi( GLenum target, GLenum pname, GLint param ); + +GLAPI void GLAPIENTRY glTexEnvfv( GLenum target, GLenum pname, const GLfloat *params ); +GLAPI void GLAPIENTRY glTexEnviv( GLenum target, GLenum pname, const GLint *params ); + +GLAPI void GLAPIENTRY glGetTexEnvfv( GLenum target, GLenum pname, GLfloat *params ); +GLAPI void GLAPIENTRY glGetTexEnviv( GLenum target, GLenum pname, GLint *params ); + + +GLAPI void GLAPIENTRY glTexParameterf( GLenum target, GLenum pname, GLfloat param ); +GLAPI void GLAPIENTRY glTexParameteri( GLenum target, GLenum pname, GLint param ); + +GLAPI void GLAPIENTRY glTexParameterfv( GLenum target, GLenum pname, + const GLfloat *params ); +GLAPI void GLAPIENTRY glTexParameteriv( GLenum target, GLenum pname, + const GLint *params ); + +GLAPI void GLAPIENTRY glGetTexParameterfv( GLenum target, + GLenum pname, GLfloat *params); +GLAPI void GLAPIENTRY glGetTexParameteriv( GLenum target, + GLenum pname, GLint *params ); + +GLAPI void GLAPIENTRY glGetTexLevelParameterfv( GLenum target, GLint level, + GLenum pname, GLfloat *params ); +GLAPI void GLAPIENTRY glGetTexLevelParameteriv( GLenum target, GLint level, + GLenum pname, GLint *params ); + + +GLAPI void GLAPIENTRY glTexImage1D( GLenum target, GLint level, + GLint internalFormat, + GLsizei width, GLint border, + GLenum format, GLenum type, + const GLvoid *pixels ); + +GLAPI void GLAPIENTRY glTexImage2D( GLenum target, GLint level, + GLint internalFormat, + GLsizei width, GLsizei height, + GLint border, GLenum format, GLenum type, + const GLvoid *pixels ); + +GLAPI void GLAPIENTRY glGetTexImage( GLenum target, GLint level, + GLenum format, GLenum type, + GLvoid *pixels ); + + +/* 1.1 functions */ + +GLAPI void GLAPIENTRY glGenTextures( GLsizei n, GLuint *textures ); + +GLAPI void GLAPIENTRY glDeleteTextures( GLsizei n, const GLuint *textures); + +GLAPI void GLAPIENTRY glBindTexture( GLenum target, GLuint texture ); + +GLAPI void GLAPIENTRY glPrioritizeTextures( GLsizei n, + const GLuint *textures, + const GLclampf *priorities ); + +GLAPI GLboolean GLAPIENTRY glAreTexturesResident( GLsizei n, + const GLuint *textures, + GLboolean *residences ); + +GLAPI GLboolean GLAPIENTRY glIsTexture( GLuint texture ); + + +GLAPI void GLAPIENTRY glTexSubImage1D( GLenum target, GLint level, + GLint xoffset, + GLsizei width, GLenum format, + GLenum type, const GLvoid *pixels ); + + +GLAPI void GLAPIENTRY glTexSubImage2D( GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const GLvoid *pixels ); + + +GLAPI void GLAPIENTRY glCopyTexImage1D( GLenum target, GLint level, + GLenum internalformat, + GLint x, GLint y, + GLsizei width, GLint border ); + + +GLAPI void GLAPIENTRY glCopyTexImage2D( GLenum target, GLint level, + GLenum internalformat, + GLint x, GLint y, + GLsizei width, GLsizei height, + GLint border ); + + +GLAPI void GLAPIENTRY glCopyTexSubImage1D( GLenum target, GLint level, + GLint xoffset, GLint x, GLint y, + GLsizei width ); + + +GLAPI void GLAPIENTRY glCopyTexSubImage2D( GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLint x, GLint y, + GLsizei width, GLsizei height ); + + +/* + * Evaluators + */ + +GLAPI void GLAPIENTRY glMap1d( GLenum target, GLdouble u1, GLdouble u2, + GLint stride, + GLint order, const GLdouble *points ); +GLAPI void GLAPIENTRY glMap1f( GLenum target, GLfloat u1, GLfloat u2, + GLint stride, + GLint order, const GLfloat *points ); + +GLAPI void GLAPIENTRY glMap2d( GLenum target, + GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, + GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, + const GLdouble *points ); +GLAPI void GLAPIENTRY glMap2f( GLenum target, + GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, + GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, + const GLfloat *points ); + +GLAPI void GLAPIENTRY glGetMapdv( GLenum target, GLenum query, GLdouble *v ); +GLAPI void GLAPIENTRY glGetMapfv( GLenum target, GLenum query, GLfloat *v ); +GLAPI void GLAPIENTRY glGetMapiv( GLenum target, GLenum query, GLint *v ); + +GLAPI void GLAPIENTRY glEvalCoord1d( GLdouble u ); +GLAPI void GLAPIENTRY glEvalCoord1f( GLfloat u ); + +GLAPI void GLAPIENTRY glEvalCoord1dv( const GLdouble *u ); +GLAPI void GLAPIENTRY glEvalCoord1fv( const GLfloat *u ); + +GLAPI void GLAPIENTRY glEvalCoord2d( GLdouble u, GLdouble v ); +GLAPI void GLAPIENTRY glEvalCoord2f( GLfloat u, GLfloat v ); + +GLAPI void GLAPIENTRY glEvalCoord2dv( const GLdouble *u ); +GLAPI void GLAPIENTRY glEvalCoord2fv( const GLfloat *u ); + +GLAPI void GLAPIENTRY glMapGrid1d( GLint un, GLdouble u1, GLdouble u2 ); +GLAPI void GLAPIENTRY glMapGrid1f( GLint un, GLfloat u1, GLfloat u2 ); + +GLAPI void GLAPIENTRY glMapGrid2d( GLint un, GLdouble u1, GLdouble u2, + GLint vn, GLdouble v1, GLdouble v2 ); +GLAPI void GLAPIENTRY glMapGrid2f( GLint un, GLfloat u1, GLfloat u2, + GLint vn, GLfloat v1, GLfloat v2 ); + +GLAPI void GLAPIENTRY glEvalPoint1( GLint i ); + +GLAPI void GLAPIENTRY glEvalPoint2( GLint i, GLint j ); + +GLAPI void GLAPIENTRY glEvalMesh1( GLenum mode, GLint i1, GLint i2 ); + +GLAPI void GLAPIENTRY glEvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ); + + +/* + * Fog + */ + +GLAPI void GLAPIENTRY glFogf( GLenum pname, GLfloat param ); + +GLAPI void GLAPIENTRY glFogi( GLenum pname, GLint param ); + +GLAPI void GLAPIENTRY glFogfv( GLenum pname, const GLfloat *params ); + +GLAPI void GLAPIENTRY glFogiv( GLenum pname, const GLint *params ); + + +/* + * Selection and Feedback + */ + +GLAPI void GLAPIENTRY glFeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer ); + +GLAPI void GLAPIENTRY glPassThrough( GLfloat token ); + +GLAPI void GLAPIENTRY glSelectBuffer( GLsizei size, GLuint *buffer ); + +GLAPI void GLAPIENTRY glInitNames( void ); + +GLAPI void GLAPIENTRY glLoadName( GLuint name ); + +GLAPI void GLAPIENTRY glPushName( GLuint name ); + +GLAPI void GLAPIENTRY glPopName( void ); + + + +/* + * OpenGL 1.2 + */ + +#define GL_RESCALE_NORMAL 0x803A +#define GL_CLAMP_TO_EDGE 0x812F +#define GL_MAX_ELEMENTS_VERTICES 0x80E8 +#define GL_MAX_ELEMENTS_INDICES 0x80E9 +#define GL_BGR 0x80E0 +#define GL_BGRA 0x80E1 +#define GL_UNSIGNED_BYTE_3_3_2 0x8032 +#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362 +#define GL_UNSIGNED_SHORT_5_6_5 0x8363 +#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364 +#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 +#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365 +#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 +#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366 +#define GL_UNSIGNED_INT_8_8_8_8 0x8035 +#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367 +#define GL_UNSIGNED_INT_10_10_10_2 0x8036 +#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368 +#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8 +#define GL_SINGLE_COLOR 0x81F9 +#define GL_SEPARATE_SPECULAR_COLOR 0x81FA +#define GL_TEXTURE_MIN_LOD 0x813A +#define GL_TEXTURE_MAX_LOD 0x813B +#define GL_TEXTURE_BASE_LEVEL 0x813C +#define GL_TEXTURE_MAX_LEVEL 0x813D +#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12 +#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13 +#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22 +#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23 +#define GL_ALIASED_POINT_SIZE_RANGE 0x846D +#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E +#define GL_PACK_SKIP_IMAGES 0x806B +#define GL_PACK_IMAGE_HEIGHT 0x806C +#define GL_UNPACK_SKIP_IMAGES 0x806D +#define GL_UNPACK_IMAGE_HEIGHT 0x806E +#define GL_TEXTURE_3D 0x806F +#define GL_PROXY_TEXTURE_3D 0x8070 +#define GL_TEXTURE_DEPTH 0x8071 +#define GL_TEXTURE_WRAP_R 0x8072 +#define GL_MAX_3D_TEXTURE_SIZE 0x8073 +#define GL_TEXTURE_BINDING_3D 0x806A + +GLAPI void GLAPIENTRY glDrawRangeElements( GLenum mode, GLuint start, + GLuint end, GLsizei count, GLenum type, const GLvoid *indices ); + +GLAPI void GLAPIENTRY glTexImage3D( GLenum target, GLint level, + GLint internalFormat, + GLsizei width, GLsizei height, + GLsizei depth, GLint border, + GLenum format, GLenum type, + const GLvoid *pixels ); + +GLAPI void GLAPIENTRY glTexSubImage3D( GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLint zoffset, GLsizei width, + GLsizei height, GLsizei depth, + GLenum format, + GLenum type, const GLvoid *pixels); + +GLAPI void GLAPIENTRY glCopyTexSubImage3D( GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLint zoffset, GLint x, + GLint y, GLsizei width, + GLsizei height ); + +typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); +typedef void (APIENTRYP PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); + + +/* + * GL_ARB_imaging + */ + +#define GL_CONSTANT_COLOR 0x8001 +#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 +#define GL_CONSTANT_ALPHA 0x8003 +#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 +#define GL_COLOR_TABLE 0x80D0 +#define GL_POST_CONVOLUTION_COLOR_TABLE 0x80D1 +#define GL_POST_COLOR_MATRIX_COLOR_TABLE 0x80D2 +#define GL_PROXY_COLOR_TABLE 0x80D3 +#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE 0x80D4 +#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE 0x80D5 +#define GL_COLOR_TABLE_SCALE 0x80D6 +#define GL_COLOR_TABLE_BIAS 0x80D7 +#define GL_COLOR_TABLE_FORMAT 0x80D8 +#define GL_COLOR_TABLE_WIDTH 0x80D9 +#define GL_COLOR_TABLE_RED_SIZE 0x80DA +#define GL_COLOR_TABLE_GREEN_SIZE 0x80DB +#define GL_COLOR_TABLE_BLUE_SIZE 0x80DC +#define GL_COLOR_TABLE_ALPHA_SIZE 0x80DD +#define GL_COLOR_TABLE_LUMINANCE_SIZE 0x80DE +#define GL_COLOR_TABLE_INTENSITY_SIZE 0x80DF +#define GL_CONVOLUTION_1D 0x8010 +#define GL_CONVOLUTION_2D 0x8011 +#define GL_SEPARABLE_2D 0x8012 +#define GL_CONVOLUTION_BORDER_MODE 0x8013 +#define GL_CONVOLUTION_FILTER_SCALE 0x8014 +#define GL_CONVOLUTION_FILTER_BIAS 0x8015 +#define GL_REDUCE 0x8016 +#define GL_CONVOLUTION_FORMAT 0x8017 +#define GL_CONVOLUTION_WIDTH 0x8018 +#define GL_CONVOLUTION_HEIGHT 0x8019 +#define GL_MAX_CONVOLUTION_WIDTH 0x801A +#define GL_MAX_CONVOLUTION_HEIGHT 0x801B +#define GL_POST_CONVOLUTION_RED_SCALE 0x801C +#define GL_POST_CONVOLUTION_GREEN_SCALE 0x801D +#define GL_POST_CONVOLUTION_BLUE_SCALE 0x801E +#define GL_POST_CONVOLUTION_ALPHA_SCALE 0x801F +#define GL_POST_CONVOLUTION_RED_BIAS 0x8020 +#define GL_POST_CONVOLUTION_GREEN_BIAS 0x8021 +#define GL_POST_CONVOLUTION_BLUE_BIAS 0x8022 +#define GL_POST_CONVOLUTION_ALPHA_BIAS 0x8023 +#define GL_CONSTANT_BORDER 0x8151 +#define GL_REPLICATE_BORDER 0x8153 +#define GL_CONVOLUTION_BORDER_COLOR 0x8154 +#define GL_COLOR_MATRIX 0x80B1 +#define GL_COLOR_MATRIX_STACK_DEPTH 0x80B2 +#define GL_MAX_COLOR_MATRIX_STACK_DEPTH 0x80B3 +#define GL_POST_COLOR_MATRIX_RED_SCALE 0x80B4 +#define GL_POST_COLOR_MATRIX_GREEN_SCALE 0x80B5 +#define GL_POST_COLOR_MATRIX_BLUE_SCALE 0x80B6 +#define GL_POST_COLOR_MATRIX_ALPHA_SCALE 0x80B7 +#define GL_POST_COLOR_MATRIX_RED_BIAS 0x80B8 +#define GL_POST_COLOR_MATRIX_GREEN_BIAS 0x80B9 +#define GL_POST_COLOR_MATRIX_BLUE_BIAS 0x80BA +#define GL_POST_COLOR_MATRIX_ALPHA_BIAS 0x80BB +#define GL_HISTOGRAM 0x8024 +#define GL_PROXY_HISTOGRAM 0x8025 +#define GL_HISTOGRAM_WIDTH 0x8026 +#define GL_HISTOGRAM_FORMAT 0x8027 +#define GL_HISTOGRAM_RED_SIZE 0x8028 +#define GL_HISTOGRAM_GREEN_SIZE 0x8029 +#define GL_HISTOGRAM_BLUE_SIZE 0x802A +#define GL_HISTOGRAM_ALPHA_SIZE 0x802B +#define GL_HISTOGRAM_LUMINANCE_SIZE 0x802C +#define GL_HISTOGRAM_SINK 0x802D +#define GL_MINMAX 0x802E +#define GL_MINMAX_FORMAT 0x802F +#define GL_MINMAX_SINK 0x8030 +#define GL_TABLE_TOO_LARGE 0x8031 +#define GL_BLEND_EQUATION 0x8009 +#define GL_MIN 0x8007 +#define GL_MAX 0x8008 +#define GL_FUNC_ADD 0x8006 +#define GL_FUNC_SUBTRACT 0x800A +#define GL_FUNC_REVERSE_SUBTRACT 0x800B +#define GL_BLEND_COLOR 0x8005 + + +GLAPI void GLAPIENTRY glColorTable( GLenum target, GLenum internalformat, + GLsizei width, GLenum format, + GLenum type, const GLvoid *table ); + +GLAPI void GLAPIENTRY glColorSubTable( GLenum target, + GLsizei start, GLsizei count, + GLenum format, GLenum type, + const GLvoid *data ); + +GLAPI void GLAPIENTRY glColorTableParameteriv(GLenum target, GLenum pname, + const GLint *params); + +GLAPI void GLAPIENTRY glColorTableParameterfv(GLenum target, GLenum pname, + const GLfloat *params); + +GLAPI void GLAPIENTRY glCopyColorSubTable( GLenum target, GLsizei start, + GLint x, GLint y, GLsizei width ); + +GLAPI void GLAPIENTRY glCopyColorTable( GLenum target, GLenum internalformat, + GLint x, GLint y, GLsizei width ); + +GLAPI void GLAPIENTRY glGetColorTable( GLenum target, GLenum format, + GLenum type, GLvoid *table ); + +GLAPI void GLAPIENTRY glGetColorTableParameterfv( GLenum target, GLenum pname, + GLfloat *params ); + +GLAPI void GLAPIENTRY glGetColorTableParameteriv( GLenum target, GLenum pname, + GLint *params ); + +GLAPI void GLAPIENTRY glBlendEquation( GLenum mode ); + +GLAPI void GLAPIENTRY glBlendColor( GLclampf red, GLclampf green, + GLclampf blue, GLclampf alpha ); + +GLAPI void GLAPIENTRY glHistogram( GLenum target, GLsizei width, + GLenum internalformat, GLboolean sink ); + +GLAPI void GLAPIENTRY glResetHistogram( GLenum target ); + +GLAPI void GLAPIENTRY glGetHistogram( GLenum target, GLboolean reset, + GLenum format, GLenum type, + GLvoid *values ); + +GLAPI void GLAPIENTRY glGetHistogramParameterfv( GLenum target, GLenum pname, + GLfloat *params ); + +GLAPI void GLAPIENTRY glGetHistogramParameteriv( GLenum target, GLenum pname, + GLint *params ); + +GLAPI void GLAPIENTRY glMinmax( GLenum target, GLenum internalformat, + GLboolean sink ); + +GLAPI void GLAPIENTRY glResetMinmax( GLenum target ); + +GLAPI void GLAPIENTRY glGetMinmax( GLenum target, GLboolean reset, + GLenum format, GLenum types, + GLvoid *values ); + +GLAPI void GLAPIENTRY glGetMinmaxParameterfv( GLenum target, GLenum pname, + GLfloat *params ); + +GLAPI void GLAPIENTRY glGetMinmaxParameteriv( GLenum target, GLenum pname, + GLint *params ); + +GLAPI void GLAPIENTRY glConvolutionFilter1D( GLenum target, + GLenum internalformat, GLsizei width, GLenum format, GLenum type, + const GLvoid *image ); + +GLAPI void GLAPIENTRY glConvolutionFilter2D( GLenum target, + GLenum internalformat, GLsizei width, GLsizei height, GLenum format, + GLenum type, const GLvoid *image ); + +GLAPI void GLAPIENTRY glConvolutionParameterf( GLenum target, GLenum pname, + GLfloat params ); + +GLAPI void GLAPIENTRY glConvolutionParameterfv( GLenum target, GLenum pname, + const GLfloat *params ); + +GLAPI void GLAPIENTRY glConvolutionParameteri( GLenum target, GLenum pname, + GLint params ); + +GLAPI void GLAPIENTRY glConvolutionParameteriv( GLenum target, GLenum pname, + const GLint *params ); + +GLAPI void GLAPIENTRY glCopyConvolutionFilter1D( GLenum target, + GLenum internalformat, GLint x, GLint y, GLsizei width ); + +GLAPI void GLAPIENTRY glCopyConvolutionFilter2D( GLenum target, + GLenum internalformat, GLint x, GLint y, GLsizei width, + GLsizei height); + +GLAPI void GLAPIENTRY glGetConvolutionFilter( GLenum target, GLenum format, + GLenum type, GLvoid *image ); + +GLAPI void GLAPIENTRY glGetConvolutionParameterfv( GLenum target, GLenum pname, + GLfloat *params ); + +GLAPI void GLAPIENTRY glGetConvolutionParameteriv( GLenum target, GLenum pname, + GLint *params ); + +GLAPI void GLAPIENTRY glSeparableFilter2D( GLenum target, + GLenum internalformat, GLsizei width, GLsizei height, GLenum format, + GLenum type, const GLvoid *row, const GLvoid *column ); + +GLAPI void GLAPIENTRY glGetSeparableFilter( GLenum target, GLenum format, + GLenum type, GLvoid *row, GLvoid *column, GLvoid *span ); + + + + +/* + * OpenGL 1.3 + */ + +/* multitexture */ +#define GL_TEXTURE0 0x84C0 +#define GL_TEXTURE1 0x84C1 +#define GL_TEXTURE2 0x84C2 +#define GL_TEXTURE3 0x84C3 +#define GL_TEXTURE4 0x84C4 +#define GL_TEXTURE5 0x84C5 +#define GL_TEXTURE6 0x84C6 +#define GL_TEXTURE7 0x84C7 +#define GL_TEXTURE8 0x84C8 +#define GL_TEXTURE9 0x84C9 +#define GL_TEXTURE10 0x84CA +#define GL_TEXTURE11 0x84CB +#define GL_TEXTURE12 0x84CC +#define GL_TEXTURE13 0x84CD +#define GL_TEXTURE14 0x84CE +#define GL_TEXTURE15 0x84CF +#define GL_TEXTURE16 0x84D0 +#define GL_TEXTURE17 0x84D1 +#define GL_TEXTURE18 0x84D2 +#define GL_TEXTURE19 0x84D3 +#define GL_TEXTURE20 0x84D4 +#define GL_TEXTURE21 0x84D5 +#define GL_TEXTURE22 0x84D6 +#define GL_TEXTURE23 0x84D7 +#define GL_TEXTURE24 0x84D8 +#define GL_TEXTURE25 0x84D9 +#define GL_TEXTURE26 0x84DA +#define GL_TEXTURE27 0x84DB +#define GL_TEXTURE28 0x84DC +#define GL_TEXTURE29 0x84DD +#define GL_TEXTURE30 0x84DE +#define GL_TEXTURE31 0x84DF +#define GL_ACTIVE_TEXTURE 0x84E0 +#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1 +#define GL_MAX_TEXTURE_UNITS 0x84E2 +/* texture_cube_map */ +#define GL_NORMAL_MAP 0x8511 +#define GL_REFLECTION_MAP 0x8512 +#define GL_TEXTURE_CUBE_MAP 0x8513 +#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A +#define GL_PROXY_TEXTURE_CUBE_MAP 0x851B +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C +/* texture_compression */ +#define GL_COMPRESSED_ALPHA 0x84E9 +#define GL_COMPRESSED_LUMINANCE 0x84EA +#define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB +#define GL_COMPRESSED_INTENSITY 0x84EC +#define GL_COMPRESSED_RGB 0x84ED +#define GL_COMPRESSED_RGBA 0x84EE +#define GL_TEXTURE_COMPRESSION_HINT 0x84EF +#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0 +#define GL_TEXTURE_COMPRESSED 0x86A1 +#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 +#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 +/* multisample */ +#define GL_MULTISAMPLE 0x809D +#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE 0x809F +#define GL_SAMPLE_COVERAGE 0x80A0 +#define GL_SAMPLE_BUFFERS 0x80A8 +#define GL_SAMPLES 0x80A9 +#define GL_SAMPLE_COVERAGE_VALUE 0x80AA +#define GL_SAMPLE_COVERAGE_INVERT 0x80AB +#define GL_MULTISAMPLE_BIT 0x20000000 +/* transpose_matrix */ +#define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3 +#define GL_TRANSPOSE_PROJECTION_MATRIX 0x84E4 +#define GL_TRANSPOSE_TEXTURE_MATRIX 0x84E5 +#define GL_TRANSPOSE_COLOR_MATRIX 0x84E6 +/* texture_env_combine */ +#define GL_COMBINE 0x8570 +#define GL_COMBINE_RGB 0x8571 +#define GL_COMBINE_ALPHA 0x8572 +#define GL_SOURCE0_RGB 0x8580 +#define GL_SOURCE1_RGB 0x8581 +#define GL_SOURCE2_RGB 0x8582 +#define GL_SOURCE0_ALPHA 0x8588 +#define GL_SOURCE1_ALPHA 0x8589 +#define GL_SOURCE2_ALPHA 0x858A +#define GL_OPERAND0_RGB 0x8590 +#define GL_OPERAND1_RGB 0x8591 +#define GL_OPERAND2_RGB 0x8592 +#define GL_OPERAND0_ALPHA 0x8598 +#define GL_OPERAND1_ALPHA 0x8599 +#define GL_OPERAND2_ALPHA 0x859A +#define GL_RGB_SCALE 0x8573 +#define GL_ADD_SIGNED 0x8574 +#define GL_INTERPOLATE 0x8575 +#define GL_SUBTRACT 0x84E7 +#define GL_CONSTANT 0x8576 +#define GL_PRIMARY_COLOR 0x8577 +#define GL_PREVIOUS 0x8578 +/* texture_env_dot3 */ +#define GL_DOT3_RGB 0x86AE +#define GL_DOT3_RGBA 0x86AF +/* texture_border_clamp */ +#define GL_CLAMP_TO_BORDER 0x812D + +GLAPI void GLAPIENTRY glActiveTexture( GLenum texture ); + +GLAPI void GLAPIENTRY glClientActiveTexture( GLenum texture ); + +GLAPI void GLAPIENTRY glCompressedTexImage1D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data ); + +GLAPI void GLAPIENTRY glCompressedTexImage2D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data ); + +GLAPI void GLAPIENTRY glCompressedTexImage3D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data ); + +GLAPI void GLAPIENTRY glCompressedTexSubImage1D( GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data ); + +GLAPI void GLAPIENTRY glCompressedTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data ); + +GLAPI void GLAPIENTRY glCompressedTexSubImage3D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data ); + +GLAPI void GLAPIENTRY glGetCompressedTexImage( GLenum target, GLint lod, GLvoid *img ); + +GLAPI void GLAPIENTRY glMultiTexCoord1d( GLenum target, GLdouble s ); + +GLAPI void GLAPIENTRY glMultiTexCoord1dv( GLenum target, const GLdouble *v ); + +GLAPI void GLAPIENTRY glMultiTexCoord1f( GLenum target, GLfloat s ); + +GLAPI void GLAPIENTRY glMultiTexCoord1fv( GLenum target, const GLfloat *v ); + +GLAPI void GLAPIENTRY glMultiTexCoord1i( GLenum target, GLint s ); + +GLAPI void GLAPIENTRY glMultiTexCoord1iv( GLenum target, const GLint *v ); + +GLAPI void GLAPIENTRY glMultiTexCoord1s( GLenum target, GLshort s ); + +GLAPI void GLAPIENTRY glMultiTexCoord1sv( GLenum target, const GLshort *v ); + +GLAPI void GLAPIENTRY glMultiTexCoord2d( GLenum target, GLdouble s, GLdouble t ); + +GLAPI void GLAPIENTRY glMultiTexCoord2dv( GLenum target, const GLdouble *v ); + +GLAPI void GLAPIENTRY glMultiTexCoord2f( GLenum target, GLfloat s, GLfloat t ); + +GLAPI void GLAPIENTRY glMultiTexCoord2fv( GLenum target, const GLfloat *v ); + +GLAPI void GLAPIENTRY glMultiTexCoord2i( GLenum target, GLint s, GLint t ); + +GLAPI void GLAPIENTRY glMultiTexCoord2iv( GLenum target, const GLint *v ); + +GLAPI void GLAPIENTRY glMultiTexCoord2s( GLenum target, GLshort s, GLshort t ); + +GLAPI void GLAPIENTRY glMultiTexCoord2sv( GLenum target, const GLshort *v ); + +GLAPI void GLAPIENTRY glMultiTexCoord3d( GLenum target, GLdouble s, GLdouble t, GLdouble r ); + +GLAPI void GLAPIENTRY glMultiTexCoord3dv( GLenum target, const GLdouble *v ); + +GLAPI void GLAPIENTRY glMultiTexCoord3f( GLenum target, GLfloat s, GLfloat t, GLfloat r ); + +GLAPI void GLAPIENTRY glMultiTexCoord3fv( GLenum target, const GLfloat *v ); + +GLAPI void GLAPIENTRY glMultiTexCoord3i( GLenum target, GLint s, GLint t, GLint r ); + +GLAPI void GLAPIENTRY glMultiTexCoord3iv( GLenum target, const GLint *v ); + +GLAPI void GLAPIENTRY glMultiTexCoord3s( GLenum target, GLshort s, GLshort t, GLshort r ); + +GLAPI void GLAPIENTRY glMultiTexCoord3sv( GLenum target, const GLshort *v ); + +GLAPI void GLAPIENTRY glMultiTexCoord4d( GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q ); + +GLAPI void GLAPIENTRY glMultiTexCoord4dv( GLenum target, const GLdouble *v ); + +GLAPI void GLAPIENTRY glMultiTexCoord4f( GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q ); + +GLAPI void GLAPIENTRY glMultiTexCoord4fv( GLenum target, const GLfloat *v ); + +GLAPI void GLAPIENTRY glMultiTexCoord4i( GLenum target, GLint s, GLint t, GLint r, GLint q ); + +GLAPI void GLAPIENTRY glMultiTexCoord4iv( GLenum target, const GLint *v ); + +GLAPI void GLAPIENTRY glMultiTexCoord4s( GLenum target, GLshort s, GLshort t, GLshort r, GLshort q ); + +GLAPI void GLAPIENTRY glMultiTexCoord4sv( GLenum target, const GLshort *v ); + + +GLAPI void GLAPIENTRY glLoadTransposeMatrixd( const GLdouble m[16] ); + +GLAPI void GLAPIENTRY glLoadTransposeMatrixf( const GLfloat m[16] ); + +GLAPI void GLAPIENTRY glMultTransposeMatrixd( const GLdouble m[16] ); + +GLAPI void GLAPIENTRY glMultTransposeMatrixf( const GLfloat m[16] ); + +GLAPI void GLAPIENTRY glSampleCoverage( GLclampf value, GLboolean invert ); + + +typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture); +typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLclampf value, GLboolean invert); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, GLvoid *img); + + + +/* + * GL_ARB_multitexture (ARB extension 1 and OpenGL 1.2.1) + */ +#ifndef GL_ARB_multitexture +#define GL_ARB_multitexture 1 + +#define GL_TEXTURE0_ARB 0x84C0 +#define GL_TEXTURE1_ARB 0x84C1 +#define GL_TEXTURE2_ARB 0x84C2 +#define GL_TEXTURE3_ARB 0x84C3 +#define GL_TEXTURE4_ARB 0x84C4 +#define GL_TEXTURE5_ARB 0x84C5 +#define GL_TEXTURE6_ARB 0x84C6 +#define GL_TEXTURE7_ARB 0x84C7 +#define GL_TEXTURE8_ARB 0x84C8 +#define GL_TEXTURE9_ARB 0x84C9 +#define GL_TEXTURE10_ARB 0x84CA +#define GL_TEXTURE11_ARB 0x84CB +#define GL_TEXTURE12_ARB 0x84CC +#define GL_TEXTURE13_ARB 0x84CD +#define GL_TEXTURE14_ARB 0x84CE +#define GL_TEXTURE15_ARB 0x84CF +#define GL_TEXTURE16_ARB 0x84D0 +#define GL_TEXTURE17_ARB 0x84D1 +#define GL_TEXTURE18_ARB 0x84D2 +#define GL_TEXTURE19_ARB 0x84D3 +#define GL_TEXTURE20_ARB 0x84D4 +#define GL_TEXTURE21_ARB 0x84D5 +#define GL_TEXTURE22_ARB 0x84D6 +#define GL_TEXTURE23_ARB 0x84D7 +#define GL_TEXTURE24_ARB 0x84D8 +#define GL_TEXTURE25_ARB 0x84D9 +#define GL_TEXTURE26_ARB 0x84DA +#define GL_TEXTURE27_ARB 0x84DB +#define GL_TEXTURE28_ARB 0x84DC +#define GL_TEXTURE29_ARB 0x84DD +#define GL_TEXTURE30_ARB 0x84DE +#define GL_TEXTURE31_ARB 0x84DF +#define GL_ACTIVE_TEXTURE_ARB 0x84E0 +#define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84E1 +#define GL_MAX_TEXTURE_UNITS_ARB 0x84E2 + +GLAPI void GLAPIENTRY glActiveTextureARB(GLenum texture); +GLAPI void GLAPIENTRY glClientActiveTextureARB(GLenum texture); +GLAPI void GLAPIENTRY glMultiTexCoord1dARB(GLenum target, GLdouble s); +GLAPI void GLAPIENTRY glMultiTexCoord1dvARB(GLenum target, const GLdouble *v); +GLAPI void GLAPIENTRY glMultiTexCoord1fARB(GLenum target, GLfloat s); +GLAPI void GLAPIENTRY glMultiTexCoord1fvARB(GLenum target, const GLfloat *v); +GLAPI void GLAPIENTRY glMultiTexCoord1iARB(GLenum target, GLint s); +GLAPI void GLAPIENTRY glMultiTexCoord1ivARB(GLenum target, const GLint *v); +GLAPI void GLAPIENTRY glMultiTexCoord1sARB(GLenum target, GLshort s); +GLAPI void GLAPIENTRY glMultiTexCoord1svARB(GLenum target, const GLshort *v); +GLAPI void GLAPIENTRY glMultiTexCoord2dARB(GLenum target, GLdouble s, GLdouble t); +GLAPI void GLAPIENTRY glMultiTexCoord2dvARB(GLenum target, const GLdouble *v); +GLAPI void GLAPIENTRY glMultiTexCoord2fARB(GLenum target, GLfloat s, GLfloat t); +GLAPI void GLAPIENTRY glMultiTexCoord2fvARB(GLenum target, const GLfloat *v); +GLAPI void GLAPIENTRY glMultiTexCoord2iARB(GLenum target, GLint s, GLint t); +GLAPI void GLAPIENTRY glMultiTexCoord2ivARB(GLenum target, const GLint *v); +GLAPI void GLAPIENTRY glMultiTexCoord2sARB(GLenum target, GLshort s, GLshort t); +GLAPI void GLAPIENTRY glMultiTexCoord2svARB(GLenum target, const GLshort *v); +GLAPI void GLAPIENTRY glMultiTexCoord3dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r); +GLAPI void GLAPIENTRY glMultiTexCoord3dvARB(GLenum target, const GLdouble *v); +GLAPI void GLAPIENTRY glMultiTexCoord3fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r); +GLAPI void GLAPIENTRY glMultiTexCoord3fvARB(GLenum target, const GLfloat *v); +GLAPI void GLAPIENTRY glMultiTexCoord3iARB(GLenum target, GLint s, GLint t, GLint r); +GLAPI void GLAPIENTRY glMultiTexCoord3ivARB(GLenum target, const GLint *v); +GLAPI void GLAPIENTRY glMultiTexCoord3sARB(GLenum target, GLshort s, GLshort t, GLshort r); +GLAPI void GLAPIENTRY glMultiTexCoord3svARB(GLenum target, const GLshort *v); +GLAPI void GLAPIENTRY glMultiTexCoord4dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); +GLAPI void GLAPIENTRY glMultiTexCoord4dvARB(GLenum target, const GLdouble *v); +GLAPI void GLAPIENTRY glMultiTexCoord4fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +GLAPI void GLAPIENTRY glMultiTexCoord4fvARB(GLenum target, const GLfloat *v); +GLAPI void GLAPIENTRY glMultiTexCoord4iARB(GLenum target, GLint s, GLint t, GLint r, GLint q); +GLAPI void GLAPIENTRY glMultiTexCoord4ivARB(GLenum target, const GLint *v); +GLAPI void GLAPIENTRY glMultiTexCoord4sARB(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); +GLAPI void GLAPIENTRY glMultiTexCoord4svARB(GLenum target, const GLshort *v); + +typedef void (APIENTRYP PFNGLACTIVETEXTUREARBPROC) (GLenum texture); +typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREARBPROC) (GLenum texture); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1DARBPROC) (GLenum target, GLdouble s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1FARBPROC) (GLenum target, GLfloat s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1IARBPROC) (GLenum target, GLint s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1SARBPROC) (GLenum target, GLshort s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1SVARBPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2DARBPROC) (GLenum target, GLdouble s, GLdouble t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2FARBPROC) (GLenum target, GLfloat s, GLfloat t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2IARBPROC) (GLenum target, GLint s, GLint t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2SARBPROC) (GLenum target, GLshort s, GLshort t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2SVARBPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3IARBPROC) (GLenum target, GLint s, GLint t, GLint r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3SVARBPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4IARBPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLshort *v); + +#endif /* GL_ARB_multitexture */ + + + +/* + * Define this token if you want "old-style" header file behaviour (extensions + * defined in gl.h). Otherwise, extensions will be included from glext.h. + */ +#if !defined(NO_SDL_GLEXT) && !defined(GL_GLEXT_LEGACY) +#include "SDL_opengl_glext.h" +#endif /* GL_GLEXT_LEGACY */ + + + +/* + * ???. GL_MESA_packed_depth_stencil + * XXX obsolete + */ +#ifndef GL_MESA_packed_depth_stencil +#define GL_MESA_packed_depth_stencil 1 + +#define GL_DEPTH_STENCIL_MESA 0x8750 +#define GL_UNSIGNED_INT_24_8_MESA 0x8751 +#define GL_UNSIGNED_INT_8_24_REV_MESA 0x8752 +#define GL_UNSIGNED_SHORT_15_1_MESA 0x8753 +#define GL_UNSIGNED_SHORT_1_15_REV_MESA 0x8754 + +#endif /* GL_MESA_packed_depth_stencil */ + + +#ifndef GL_ATI_blend_equation_separate +#define GL_ATI_blend_equation_separate 1 + +#define GL_ALPHA_BLEND_EQUATION_ATI 0x883D + +GLAPI void GLAPIENTRY glBlendEquationSeparateATI( GLenum modeRGB, GLenum modeA ); +typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEATIPROC) (GLenum modeRGB, GLenum modeA); + +#endif /* GL_ATI_blend_equation_separate */ + + +/* GL_OES_EGL_image */ +#ifndef GL_OES_EGL_image +typedef void* GLeglImageOES; +#endif + +#ifndef GL_OES_EGL_image +#define GL_OES_EGL_image 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glEGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image); +GLAPI void APIENTRY glEGLImageTargetRenderbufferStorageOES (GLenum target, GLeglImageOES image); +#endif +typedef void (APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image); +typedef void (APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLeglImageOES image); +#endif + + +/** + ** NOTE!!!!! If you add new functions to this file, or update + ** glext.h be sure to regenerate the gl_mangle.h file. See comments + ** in that file for details. + **/ + + + +/********************************************************************** + * Begin system-specific stuff + */ +#if defined(PRAGMA_EXPORT_SUPPORTED) +#pragma export off +#endif + +/* + * End system-specific stuff + **********************************************************************/ + + +#ifdef __cplusplus +} +#endif + +#endif /* __gl_h_ */ + +#endif /* !__IPHONEOS__ */ + +#endif /* SDL_opengl_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_opengl_glext.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_opengl_glext.h new file mode 100644 index 0000000..6a402b1 --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_opengl_glext.h @@ -0,0 +1,11180 @@ +#ifndef __glext_h_ +#define __glext_h_ 1 + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** Copyright (c) 2013-2014 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are 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 Materials. +** +** THE MATERIALS ARE 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 +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ +/* +** This header is generated from the Khronos OpenGL / OpenGL ES XML +** API Registry. The current version of the Registry, generator scripts +** used to make the header, and the header can be found at +** http://www.opengl.org/registry/ +** +** Khronos $Revision: 26745 $ on $Date: 2014-05-21 03:12:26 -0700 (Wed, 21 May 2014) $ +*/ + +#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN 1 +#endif +#ifndef NOMINMAX /* don't define min() and max(). */ +#define NOMINMAX +#endif +#include +#endif + +#ifndef APIENTRY +#define APIENTRY +#endif +#ifndef APIENTRYP +#define APIENTRYP APIENTRY * +#endif +#ifndef GLAPI +#define GLAPI extern +#endif + +#define GL_GLEXT_VERSION 20140521 + +/* Generated C header for: + * API: gl + * Profile: compatibility + * Versions considered: .* + * Versions emitted: 1\.[2-9]|[234]\.[0-9] + * Default extensions included: gl + * Additional extensions included: _nomatch_^ + * Extensions removed: _nomatch_^ + */ + +#ifndef GL_VERSION_1_2 +#define GL_VERSION_1_2 1 +#define GL_UNSIGNED_BYTE_3_3_2 0x8032 +#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 +#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 +#define GL_UNSIGNED_INT_8_8_8_8 0x8035 +#define GL_UNSIGNED_INT_10_10_10_2 0x8036 +#define GL_TEXTURE_BINDING_3D 0x806A +#define GL_PACK_SKIP_IMAGES 0x806B +#define GL_PACK_IMAGE_HEIGHT 0x806C +#define GL_UNPACK_SKIP_IMAGES 0x806D +#define GL_UNPACK_IMAGE_HEIGHT 0x806E +#define GL_TEXTURE_3D 0x806F +#define GL_PROXY_TEXTURE_3D 0x8070 +#define GL_TEXTURE_DEPTH 0x8071 +#define GL_TEXTURE_WRAP_R 0x8072 +#define GL_MAX_3D_TEXTURE_SIZE 0x8073 +#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362 +#define GL_UNSIGNED_SHORT_5_6_5 0x8363 +#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364 +#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365 +#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366 +#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367 +#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368 +#define GL_BGR 0x80E0 +#define GL_BGRA 0x80E1 +#define GL_MAX_ELEMENTS_VERTICES 0x80E8 +#define GL_MAX_ELEMENTS_INDICES 0x80E9 +#define GL_CLAMP_TO_EDGE 0x812F +#define GL_TEXTURE_MIN_LOD 0x813A +#define GL_TEXTURE_MAX_LOD 0x813B +#define GL_TEXTURE_BASE_LEVEL 0x813C +#define GL_TEXTURE_MAX_LEVEL 0x813D +#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12 +#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13 +#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22 +#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23 +#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E +#define GL_RESCALE_NORMAL 0x803A +#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8 +#define GL_SINGLE_COLOR 0x81F9 +#define GL_SEPARATE_SPECULAR_COLOR 0x81FA +#define GL_ALIASED_POINT_SIZE_RANGE 0x846D +typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices); +typedef void (APIENTRYP PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels); +typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawRangeElements (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices); +GLAPI void APIENTRY glTexImage3D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels); +GLAPI void APIENTRY glTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); +GLAPI void APIENTRY glCopyTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +#endif +#endif /* GL_VERSION_1_2 */ + +#ifndef GL_VERSION_1_3 +#define GL_VERSION_1_3 1 +#define GL_TEXTURE0 0x84C0 +#define GL_TEXTURE1 0x84C1 +#define GL_TEXTURE2 0x84C2 +#define GL_TEXTURE3 0x84C3 +#define GL_TEXTURE4 0x84C4 +#define GL_TEXTURE5 0x84C5 +#define GL_TEXTURE6 0x84C6 +#define GL_TEXTURE7 0x84C7 +#define GL_TEXTURE8 0x84C8 +#define GL_TEXTURE9 0x84C9 +#define GL_TEXTURE10 0x84CA +#define GL_TEXTURE11 0x84CB +#define GL_TEXTURE12 0x84CC +#define GL_TEXTURE13 0x84CD +#define GL_TEXTURE14 0x84CE +#define GL_TEXTURE15 0x84CF +#define GL_TEXTURE16 0x84D0 +#define GL_TEXTURE17 0x84D1 +#define GL_TEXTURE18 0x84D2 +#define GL_TEXTURE19 0x84D3 +#define GL_TEXTURE20 0x84D4 +#define GL_TEXTURE21 0x84D5 +#define GL_TEXTURE22 0x84D6 +#define GL_TEXTURE23 0x84D7 +#define GL_TEXTURE24 0x84D8 +#define GL_TEXTURE25 0x84D9 +#define GL_TEXTURE26 0x84DA +#define GL_TEXTURE27 0x84DB +#define GL_TEXTURE28 0x84DC +#define GL_TEXTURE29 0x84DD +#define GL_TEXTURE30 0x84DE +#define GL_TEXTURE31 0x84DF +#define GL_ACTIVE_TEXTURE 0x84E0 +#define GL_MULTISAMPLE 0x809D +#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE 0x809F +#define GL_SAMPLE_COVERAGE 0x80A0 +#define GL_SAMPLE_BUFFERS 0x80A8 +#define GL_SAMPLES 0x80A9 +#define GL_SAMPLE_COVERAGE_VALUE 0x80AA +#define GL_SAMPLE_COVERAGE_INVERT 0x80AB +#define GL_TEXTURE_CUBE_MAP 0x8513 +#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A +#define GL_PROXY_TEXTURE_CUBE_MAP 0x851B +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C +#define GL_COMPRESSED_RGB 0x84ED +#define GL_COMPRESSED_RGBA 0x84EE +#define GL_TEXTURE_COMPRESSION_HINT 0x84EF +#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0 +#define GL_TEXTURE_COMPRESSED 0x86A1 +#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 +#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 +#define GL_CLAMP_TO_BORDER 0x812D +#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1 +#define GL_MAX_TEXTURE_UNITS 0x84E2 +#define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3 +#define GL_TRANSPOSE_PROJECTION_MATRIX 0x84E4 +#define GL_TRANSPOSE_TEXTURE_MATRIX 0x84E5 +#define GL_TRANSPOSE_COLOR_MATRIX 0x84E6 +#define GL_MULTISAMPLE_BIT 0x20000000 +#define GL_NORMAL_MAP 0x8511 +#define GL_REFLECTION_MAP 0x8512 +#define GL_COMPRESSED_ALPHA 0x84E9 +#define GL_COMPRESSED_LUMINANCE 0x84EA +#define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB +#define GL_COMPRESSED_INTENSITY 0x84EC +#define GL_COMBINE 0x8570 +#define GL_COMBINE_RGB 0x8571 +#define GL_COMBINE_ALPHA 0x8572 +#define GL_SOURCE0_RGB 0x8580 +#define GL_SOURCE1_RGB 0x8581 +#define GL_SOURCE2_RGB 0x8582 +#define GL_SOURCE0_ALPHA 0x8588 +#define GL_SOURCE1_ALPHA 0x8589 +#define GL_SOURCE2_ALPHA 0x858A +#define GL_OPERAND0_RGB 0x8590 +#define GL_OPERAND1_RGB 0x8591 +#define GL_OPERAND2_RGB 0x8592 +#define GL_OPERAND0_ALPHA 0x8598 +#define GL_OPERAND1_ALPHA 0x8599 +#define GL_OPERAND2_ALPHA 0x859A +#define GL_RGB_SCALE 0x8573 +#define GL_ADD_SIGNED 0x8574 +#define GL_INTERPOLATE 0x8575 +#define GL_SUBTRACT 0x84E7 +#define GL_CONSTANT 0x8576 +#define GL_PRIMARY_COLOR 0x8577 +#define GL_PREVIOUS 0x8578 +#define GL_DOT3_RGB 0x86AE +#define GL_DOT3_RGBA 0x86AF +typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture); +typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLfloat value, GLboolean invert); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data); +typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, void *img); +typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREPROC) (GLenum texture); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1DPROC) (GLenum target, GLdouble s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1FPROC) (GLenum target, GLfloat s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1FVPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1IPROC) (GLenum target, GLint s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1IVPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1SPROC) (GLenum target, GLshort s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1SVPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2DPROC) (GLenum target, GLdouble s, GLdouble t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2DVPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2FPROC) (GLenum target, GLfloat s, GLfloat t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2FVPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2IPROC) (GLenum target, GLint s, GLint t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2IVPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2SPROC) (GLenum target, GLshort s, GLshort t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2SVPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3DVPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3FVPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3IPROC) (GLenum target, GLint s, GLint t, GLint r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3IVPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3SPROC) (GLenum target, GLshort s, GLshort t, GLshort r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3SVPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4DVPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4FVPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4IPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4IVPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4SPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXFPROC) (const GLfloat *m); +typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXDPROC) (const GLdouble *m); +typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXFPROC) (const GLfloat *m); +typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXDPROC) (const GLdouble *m); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glActiveTexture (GLenum texture); +GLAPI void APIENTRY glSampleCoverage (GLfloat value, GLboolean invert); +GLAPI void APIENTRY glCompressedTexImage3D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data); +GLAPI void APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data); +GLAPI void APIENTRY glCompressedTexImage1D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *data); +GLAPI void APIENTRY glCompressedTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); +GLAPI void APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); +GLAPI void APIENTRY glCompressedTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data); +GLAPI void APIENTRY glGetCompressedTexImage (GLenum target, GLint level, void *img); +GLAPI void APIENTRY glClientActiveTexture (GLenum texture); +GLAPI void APIENTRY glMultiTexCoord1d (GLenum target, GLdouble s); +GLAPI void APIENTRY glMultiTexCoord1dv (GLenum target, const GLdouble *v); +GLAPI void APIENTRY glMultiTexCoord1f (GLenum target, GLfloat s); +GLAPI void APIENTRY glMultiTexCoord1fv (GLenum target, const GLfloat *v); +GLAPI void APIENTRY glMultiTexCoord1i (GLenum target, GLint s); +GLAPI void APIENTRY glMultiTexCoord1iv (GLenum target, const GLint *v); +GLAPI void APIENTRY glMultiTexCoord1s (GLenum target, GLshort s); +GLAPI void APIENTRY glMultiTexCoord1sv (GLenum target, const GLshort *v); +GLAPI void APIENTRY glMultiTexCoord2d (GLenum target, GLdouble s, GLdouble t); +GLAPI void APIENTRY glMultiTexCoord2dv (GLenum target, const GLdouble *v); +GLAPI void APIENTRY glMultiTexCoord2f (GLenum target, GLfloat s, GLfloat t); +GLAPI void APIENTRY glMultiTexCoord2fv (GLenum target, const GLfloat *v); +GLAPI void APIENTRY glMultiTexCoord2i (GLenum target, GLint s, GLint t); +GLAPI void APIENTRY glMultiTexCoord2iv (GLenum target, const GLint *v); +GLAPI void APIENTRY glMultiTexCoord2s (GLenum target, GLshort s, GLshort t); +GLAPI void APIENTRY glMultiTexCoord2sv (GLenum target, const GLshort *v); +GLAPI void APIENTRY glMultiTexCoord3d (GLenum target, GLdouble s, GLdouble t, GLdouble r); +GLAPI void APIENTRY glMultiTexCoord3dv (GLenum target, const GLdouble *v); +GLAPI void APIENTRY glMultiTexCoord3f (GLenum target, GLfloat s, GLfloat t, GLfloat r); +GLAPI void APIENTRY glMultiTexCoord3fv (GLenum target, const GLfloat *v); +GLAPI void APIENTRY glMultiTexCoord3i (GLenum target, GLint s, GLint t, GLint r); +GLAPI void APIENTRY glMultiTexCoord3iv (GLenum target, const GLint *v); +GLAPI void APIENTRY glMultiTexCoord3s (GLenum target, GLshort s, GLshort t, GLshort r); +GLAPI void APIENTRY glMultiTexCoord3sv (GLenum target, const GLshort *v); +GLAPI void APIENTRY glMultiTexCoord4d (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); +GLAPI void APIENTRY glMultiTexCoord4dv (GLenum target, const GLdouble *v); +GLAPI void APIENTRY glMultiTexCoord4f (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +GLAPI void APIENTRY glMultiTexCoord4fv (GLenum target, const GLfloat *v); +GLAPI void APIENTRY glMultiTexCoord4i (GLenum target, GLint s, GLint t, GLint r, GLint q); +GLAPI void APIENTRY glMultiTexCoord4iv (GLenum target, const GLint *v); +GLAPI void APIENTRY glMultiTexCoord4s (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); +GLAPI void APIENTRY glMultiTexCoord4sv (GLenum target, const GLshort *v); +GLAPI void APIENTRY glLoadTransposeMatrixf (const GLfloat *m); +GLAPI void APIENTRY glLoadTransposeMatrixd (const GLdouble *m); +GLAPI void APIENTRY glMultTransposeMatrixf (const GLfloat *m); +GLAPI void APIENTRY glMultTransposeMatrixd (const GLdouble *m); +#endif +#endif /* GL_VERSION_1_3 */ + +#ifndef GL_VERSION_1_4 +#define GL_VERSION_1_4 1 +#define GL_BLEND_DST_RGB 0x80C8 +#define GL_BLEND_SRC_RGB 0x80C9 +#define GL_BLEND_DST_ALPHA 0x80CA +#define GL_BLEND_SRC_ALPHA 0x80CB +#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128 +#define GL_DEPTH_COMPONENT16 0x81A5 +#define GL_DEPTH_COMPONENT24 0x81A6 +#define GL_DEPTH_COMPONENT32 0x81A7 +#define GL_MIRRORED_REPEAT 0x8370 +#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD +#define GL_TEXTURE_LOD_BIAS 0x8501 +#define GL_INCR_WRAP 0x8507 +#define GL_DECR_WRAP 0x8508 +#define GL_TEXTURE_DEPTH_SIZE 0x884A +#define GL_TEXTURE_COMPARE_MODE 0x884C +#define GL_TEXTURE_COMPARE_FUNC 0x884D +#define GL_POINT_SIZE_MIN 0x8126 +#define GL_POINT_SIZE_MAX 0x8127 +#define GL_POINT_DISTANCE_ATTENUATION 0x8129 +#define GL_GENERATE_MIPMAP 0x8191 +#define GL_GENERATE_MIPMAP_HINT 0x8192 +#define GL_FOG_COORDINATE_SOURCE 0x8450 +#define GL_FOG_COORDINATE 0x8451 +#define GL_FRAGMENT_DEPTH 0x8452 +#define GL_CURRENT_FOG_COORDINATE 0x8453 +#define GL_FOG_COORDINATE_ARRAY_TYPE 0x8454 +#define GL_FOG_COORDINATE_ARRAY_STRIDE 0x8455 +#define GL_FOG_COORDINATE_ARRAY_POINTER 0x8456 +#define GL_FOG_COORDINATE_ARRAY 0x8457 +#define GL_COLOR_SUM 0x8458 +#define GL_CURRENT_SECONDARY_COLOR 0x8459 +#define GL_SECONDARY_COLOR_ARRAY_SIZE 0x845A +#define GL_SECONDARY_COLOR_ARRAY_TYPE 0x845B +#define GL_SECONDARY_COLOR_ARRAY_STRIDE 0x845C +#define GL_SECONDARY_COLOR_ARRAY_POINTER 0x845D +#define GL_SECONDARY_COLOR_ARRAY 0x845E +#define GL_TEXTURE_FILTER_CONTROL 0x8500 +#define GL_DEPTH_TEXTURE_MODE 0x884B +#define GL_COMPARE_R_TO_TEXTURE 0x884E +#define GL_FUNC_ADD 0x8006 +#define GL_FUNC_SUBTRACT 0x800A +#define GL_FUNC_REVERSE_SUBTRACT 0x800B +#define GL_MIN 0x8007 +#define GL_MAX 0x8008 +#define GL_CONSTANT_COLOR 0x8001 +#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 +#define GL_CONSTANT_ALPHA 0x8003 +#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 +typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSPROC) (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount); +typedef void (APIENTRYP PFNGLPOINTPARAMETERFPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERFVPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLPOINTPARAMETERIPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERIVPROC) (GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLFOGCOORDFPROC) (GLfloat coord); +typedef void (APIENTRYP PFNGLFOGCOORDFVPROC) (const GLfloat *coord); +typedef void (APIENTRYP PFNGLFOGCOORDDPROC) (GLdouble coord); +typedef void (APIENTRYP PFNGLFOGCOORDDVPROC) (const GLdouble *coord); +typedef void (APIENTRYP PFNGLFOGCOORDPOINTERPROC) (GLenum type, GLsizei stride, const void *pointer); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BPROC) (GLbyte red, GLbyte green, GLbyte blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BVPROC) (const GLbyte *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DPROC) (GLdouble red, GLdouble green, GLdouble blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DVPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FPROC) (GLfloat red, GLfloat green, GLfloat blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FVPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IPROC) (GLint red, GLint green, GLint blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IVPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SPROC) (GLshort red, GLshort green, GLshort blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SVPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBPROC) (GLubyte red, GLubyte green, GLubyte blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBVPROC) (const GLubyte *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIPROC) (GLuint red, GLuint green, GLuint blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIVPROC) (const GLuint *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USPROC) (GLushort red, GLushort green, GLushort blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USVPROC) (const GLushort *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTERPROC) (GLint size, GLenum type, GLsizei stride, const void *pointer); +typedef void (APIENTRYP PFNGLWINDOWPOS2DPROC) (GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLWINDOWPOS2DVPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2FPROC) (GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLWINDOWPOS2FVPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2IPROC) (GLint x, GLint y); +typedef void (APIENTRYP PFNGLWINDOWPOS2IVPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2SPROC) (GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLWINDOWPOS2SVPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3DPROC) (GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLWINDOWPOS3DVPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3FPROC) (GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLWINDOWPOS3FVPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3IPROC) (GLint x, GLint y, GLint z); +typedef void (APIENTRYP PFNGLWINDOWPOS3IVPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3SPROC) (GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLWINDOWPOS3SVPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLBLENDCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendFuncSeparate (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +GLAPI void APIENTRY glMultiDrawArrays (GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount); +GLAPI void APIENTRY glMultiDrawElements (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount); +GLAPI void APIENTRY glPointParameterf (GLenum pname, GLfloat param); +GLAPI void APIENTRY glPointParameterfv (GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glPointParameteri (GLenum pname, GLint param); +GLAPI void APIENTRY glPointParameteriv (GLenum pname, const GLint *params); +GLAPI void APIENTRY glFogCoordf (GLfloat coord); +GLAPI void APIENTRY glFogCoordfv (const GLfloat *coord); +GLAPI void APIENTRY glFogCoordd (GLdouble coord); +GLAPI void APIENTRY glFogCoorddv (const GLdouble *coord); +GLAPI void APIENTRY glFogCoordPointer (GLenum type, GLsizei stride, const void *pointer); +GLAPI void APIENTRY glSecondaryColor3b (GLbyte red, GLbyte green, GLbyte blue); +GLAPI void APIENTRY glSecondaryColor3bv (const GLbyte *v); +GLAPI void APIENTRY glSecondaryColor3d (GLdouble red, GLdouble green, GLdouble blue); +GLAPI void APIENTRY glSecondaryColor3dv (const GLdouble *v); +GLAPI void APIENTRY glSecondaryColor3f (GLfloat red, GLfloat green, GLfloat blue); +GLAPI void APIENTRY glSecondaryColor3fv (const GLfloat *v); +GLAPI void APIENTRY glSecondaryColor3i (GLint red, GLint green, GLint blue); +GLAPI void APIENTRY glSecondaryColor3iv (const GLint *v); +GLAPI void APIENTRY glSecondaryColor3s (GLshort red, GLshort green, GLshort blue); +GLAPI void APIENTRY glSecondaryColor3sv (const GLshort *v); +GLAPI void APIENTRY glSecondaryColor3ub (GLubyte red, GLubyte green, GLubyte blue); +GLAPI void APIENTRY glSecondaryColor3ubv (const GLubyte *v); +GLAPI void APIENTRY glSecondaryColor3ui (GLuint red, GLuint green, GLuint blue); +GLAPI void APIENTRY glSecondaryColor3uiv (const GLuint *v); +GLAPI void APIENTRY glSecondaryColor3us (GLushort red, GLushort green, GLushort blue); +GLAPI void APIENTRY glSecondaryColor3usv (const GLushort *v); +GLAPI void APIENTRY glSecondaryColorPointer (GLint size, GLenum type, GLsizei stride, const void *pointer); +GLAPI void APIENTRY glWindowPos2d (GLdouble x, GLdouble y); +GLAPI void APIENTRY glWindowPos2dv (const GLdouble *v); +GLAPI void APIENTRY glWindowPos2f (GLfloat x, GLfloat y); +GLAPI void APIENTRY glWindowPos2fv (const GLfloat *v); +GLAPI void APIENTRY glWindowPos2i (GLint x, GLint y); +GLAPI void APIENTRY glWindowPos2iv (const GLint *v); +GLAPI void APIENTRY glWindowPos2s (GLshort x, GLshort y); +GLAPI void APIENTRY glWindowPos2sv (const GLshort *v); +GLAPI void APIENTRY glWindowPos3d (GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY glWindowPos3dv (const GLdouble *v); +GLAPI void APIENTRY glWindowPos3f (GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glWindowPos3fv (const GLfloat *v); +GLAPI void APIENTRY glWindowPos3i (GLint x, GLint y, GLint z); +GLAPI void APIENTRY glWindowPos3iv (const GLint *v); +GLAPI void APIENTRY glWindowPos3s (GLshort x, GLshort y, GLshort z); +GLAPI void APIENTRY glWindowPos3sv (const GLshort *v); +GLAPI void APIENTRY glBlendColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +GLAPI void APIENTRY glBlendEquation (GLenum mode); +#endif +#endif /* GL_VERSION_1_4 */ + +#ifndef GL_VERSION_1_5 +#define GL_VERSION_1_5 1 +#include +#ifdef __MACOSX__ +typedef long GLsizeiptr; +typedef long GLintptr; +#else +typedef ptrdiff_t GLsizeiptr; +typedef ptrdiff_t GLintptr; +#endif +#define GL_BUFFER_SIZE 0x8764 +#define GL_BUFFER_USAGE 0x8765 +#define GL_QUERY_COUNTER_BITS 0x8864 +#define GL_CURRENT_QUERY 0x8865 +#define GL_QUERY_RESULT 0x8866 +#define GL_QUERY_RESULT_AVAILABLE 0x8867 +#define GL_ARRAY_BUFFER 0x8892 +#define GL_ELEMENT_ARRAY_BUFFER 0x8893 +#define GL_ARRAY_BUFFER_BINDING 0x8894 +#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895 +#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F +#define GL_READ_ONLY 0x88B8 +#define GL_WRITE_ONLY 0x88B9 +#define GL_READ_WRITE 0x88BA +#define GL_BUFFER_ACCESS 0x88BB +#define GL_BUFFER_MAPPED 0x88BC +#define GL_BUFFER_MAP_POINTER 0x88BD +#define GL_STREAM_DRAW 0x88E0 +#define GL_STREAM_READ 0x88E1 +#define GL_STREAM_COPY 0x88E2 +#define GL_STATIC_DRAW 0x88E4 +#define GL_STATIC_READ 0x88E5 +#define GL_STATIC_COPY 0x88E6 +#define GL_DYNAMIC_DRAW 0x88E8 +#define GL_DYNAMIC_READ 0x88E9 +#define GL_DYNAMIC_COPY 0x88EA +#define GL_SAMPLES_PASSED 0x8914 +#define GL_SRC1_ALPHA 0x8589 +#define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896 +#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897 +#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898 +#define GL_INDEX_ARRAY_BUFFER_BINDING 0x8899 +#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A +#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING 0x889B +#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING 0x889C +#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING 0x889D +#define GL_WEIGHT_ARRAY_BUFFER_BINDING 0x889E +#define GL_FOG_COORD_SRC 0x8450 +#define GL_FOG_COORD 0x8451 +#define GL_CURRENT_FOG_COORD 0x8453 +#define GL_FOG_COORD_ARRAY_TYPE 0x8454 +#define GL_FOG_COORD_ARRAY_STRIDE 0x8455 +#define GL_FOG_COORD_ARRAY_POINTER 0x8456 +#define GL_FOG_COORD_ARRAY 0x8457 +#define GL_FOG_COORD_ARRAY_BUFFER_BINDING 0x889D +#define GL_SRC0_RGB 0x8580 +#define GL_SRC1_RGB 0x8581 +#define GL_SRC2_RGB 0x8582 +#define GL_SRC0_ALPHA 0x8588 +#define GL_SRC2_ALPHA 0x858A +typedef void (APIENTRYP PFNGLGENQUERIESPROC) (GLsizei n, GLuint *ids); +typedef void (APIENTRYP PFNGLDELETEQUERIESPROC) (GLsizei n, const GLuint *ids); +typedef GLboolean (APIENTRYP PFNGLISQUERYPROC) (GLuint id); +typedef void (APIENTRYP PFNGLBEGINQUERYPROC) (GLenum target, GLuint id); +typedef void (APIENTRYP PFNGLENDQUERYPROC) (GLenum target); +typedef void (APIENTRYP PFNGLGETQUERYIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETQUERYOBJECTIVPROC) (GLuint id, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETQUERYOBJECTUIVPROC) (GLuint id, GLenum pname, GLuint *params); +typedef void (APIENTRYP PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer); +typedef void (APIENTRYP PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint *buffers); +typedef void (APIENTRYP PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers); +typedef GLboolean (APIENTRYP PFNGLISBUFFERPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const void *data, GLenum usage); +typedef void (APIENTRYP PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const void *data); +typedef void (APIENTRYP PFNGLGETBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, void *data); +typedef void *(APIENTRYP PFNGLMAPBUFFERPROC) (GLenum target, GLenum access); +typedef GLboolean (APIENTRYP PFNGLUNMAPBUFFERPROC) (GLenum target); +typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETBUFFERPOINTERVPROC) (GLenum target, GLenum pname, void **params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGenQueries (GLsizei n, GLuint *ids); +GLAPI void APIENTRY glDeleteQueries (GLsizei n, const GLuint *ids); +GLAPI GLboolean APIENTRY glIsQuery (GLuint id); +GLAPI void APIENTRY glBeginQuery (GLenum target, GLuint id); +GLAPI void APIENTRY glEndQuery (GLenum target); +GLAPI void APIENTRY glGetQueryiv (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetQueryObjectiv (GLuint id, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetQueryObjectuiv (GLuint id, GLenum pname, GLuint *params); +GLAPI void APIENTRY glBindBuffer (GLenum target, GLuint buffer); +GLAPI void APIENTRY glDeleteBuffers (GLsizei n, const GLuint *buffers); +GLAPI void APIENTRY glGenBuffers (GLsizei n, GLuint *buffers); +GLAPI GLboolean APIENTRY glIsBuffer (GLuint buffer); +GLAPI void APIENTRY glBufferData (GLenum target, GLsizeiptr size, const void *data, GLenum usage); +GLAPI void APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const void *data); +GLAPI void APIENTRY glGetBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, void *data); +GLAPI void *APIENTRY glMapBuffer (GLenum target, GLenum access); +GLAPI GLboolean APIENTRY glUnmapBuffer (GLenum target); +GLAPI void APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetBufferPointerv (GLenum target, GLenum pname, void **params); +#endif +#endif /* GL_VERSION_1_5 */ + +#ifndef GL_VERSION_2_0 +#define GL_VERSION_2_0 1 +typedef char GLchar; +#define GL_BLEND_EQUATION_RGB 0x8009 +#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 +#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623 +#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624 +#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625 +#define GL_CURRENT_VERTEX_ATTRIB 0x8626 +#define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642 +#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645 +#define GL_STENCIL_BACK_FUNC 0x8800 +#define GL_STENCIL_BACK_FAIL 0x8801 +#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802 +#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803 +#define GL_MAX_DRAW_BUFFERS 0x8824 +#define GL_DRAW_BUFFER0 0x8825 +#define GL_DRAW_BUFFER1 0x8826 +#define GL_DRAW_BUFFER2 0x8827 +#define GL_DRAW_BUFFER3 0x8828 +#define GL_DRAW_BUFFER4 0x8829 +#define GL_DRAW_BUFFER5 0x882A +#define GL_DRAW_BUFFER6 0x882B +#define GL_DRAW_BUFFER7 0x882C +#define GL_DRAW_BUFFER8 0x882D +#define GL_DRAW_BUFFER9 0x882E +#define GL_DRAW_BUFFER10 0x882F +#define GL_DRAW_BUFFER11 0x8830 +#define GL_DRAW_BUFFER12 0x8831 +#define GL_DRAW_BUFFER13 0x8832 +#define GL_DRAW_BUFFER14 0x8833 +#define GL_DRAW_BUFFER15 0x8834 +#define GL_BLEND_EQUATION_ALPHA 0x883D +#define GL_MAX_VERTEX_ATTRIBS 0x8869 +#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A +#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872 +#define GL_FRAGMENT_SHADER 0x8B30 +#define GL_VERTEX_SHADER 0x8B31 +#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49 +#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A +#define GL_MAX_VARYING_FLOATS 0x8B4B +#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C +#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D +#define GL_SHADER_TYPE 0x8B4F +#define GL_FLOAT_VEC2 0x8B50 +#define GL_FLOAT_VEC3 0x8B51 +#define GL_FLOAT_VEC4 0x8B52 +#define GL_INT_VEC2 0x8B53 +#define GL_INT_VEC3 0x8B54 +#define GL_INT_VEC4 0x8B55 +#define GL_BOOL 0x8B56 +#define GL_BOOL_VEC2 0x8B57 +#define GL_BOOL_VEC3 0x8B58 +#define GL_BOOL_VEC4 0x8B59 +#define GL_FLOAT_MAT2 0x8B5A +#define GL_FLOAT_MAT3 0x8B5B +#define GL_FLOAT_MAT4 0x8B5C +#define GL_SAMPLER_1D 0x8B5D +#define GL_SAMPLER_2D 0x8B5E +#define GL_SAMPLER_3D 0x8B5F +#define GL_SAMPLER_CUBE 0x8B60 +#define GL_SAMPLER_1D_SHADOW 0x8B61 +#define GL_SAMPLER_2D_SHADOW 0x8B62 +#define GL_DELETE_STATUS 0x8B80 +#define GL_COMPILE_STATUS 0x8B81 +#define GL_LINK_STATUS 0x8B82 +#define GL_VALIDATE_STATUS 0x8B83 +#define GL_INFO_LOG_LENGTH 0x8B84 +#define GL_ATTACHED_SHADERS 0x8B85 +#define GL_ACTIVE_UNIFORMS 0x8B86 +#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87 +#define GL_SHADER_SOURCE_LENGTH 0x8B88 +#define GL_ACTIVE_ATTRIBUTES 0x8B89 +#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A +#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B +#define GL_SHADING_LANGUAGE_VERSION 0x8B8C +#define GL_CURRENT_PROGRAM 0x8B8D +#define GL_POINT_SPRITE_COORD_ORIGIN 0x8CA0 +#define GL_LOWER_LEFT 0x8CA1 +#define GL_UPPER_LEFT 0x8CA2 +#define GL_STENCIL_BACK_REF 0x8CA3 +#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4 +#define GL_STENCIL_BACK_WRITEMASK 0x8CA5 +#define GL_VERTEX_PROGRAM_TWO_SIDE 0x8643 +#define GL_POINT_SPRITE 0x8861 +#define GL_COORD_REPLACE 0x8862 +#define GL_MAX_TEXTURE_COORDS 0x8871 +typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEPROC) (GLenum modeRGB, GLenum modeAlpha); +typedef void (APIENTRYP PFNGLDRAWBUFFERSPROC) (GLsizei n, const GLenum *bufs); +typedef void (APIENTRYP PFNGLSTENCILOPSEPARATEPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); +typedef void (APIENTRYP PFNGLSTENCILFUNCSEPARATEPROC) (GLenum face, GLenum func, GLint ref, GLuint mask); +typedef void (APIENTRYP PFNGLSTENCILMASKSEPARATEPROC) (GLenum face, GLuint mask); +typedef void (APIENTRYP PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader); +typedef void (APIENTRYP PFNGLBINDATTRIBLOCATIONPROC) (GLuint program, GLuint index, const GLchar *name); +typedef void (APIENTRYP PFNGLCOMPILESHADERPROC) (GLuint shader); +typedef GLuint (APIENTRYP PFNGLCREATEPROGRAMPROC) (void); +typedef GLuint (APIENTRYP PFNGLCREATESHADERPROC) (GLenum type); +typedef void (APIENTRYP PFNGLDELETEPROGRAMPROC) (GLuint program); +typedef void (APIENTRYP PFNGLDELETESHADERPROC) (GLuint shader); +typedef void (APIENTRYP PFNGLDETACHSHADERPROC) (GLuint program, GLuint shader); +typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint index); +typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index); +typedef void (APIENTRYP PFNGLGETACTIVEATTRIBPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +typedef void (APIENTRYP PFNGLGETATTACHEDSHADERSPROC) (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders); +typedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONPROC) (GLuint program, const GLchar *name); +typedef void (APIENTRYP PFNGLGETPROGRAMIVPROC) (GLuint program, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +typedef void (APIENTRYP PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +typedef void (APIENTRYP PFNGLGETSHADERSOURCEPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); +typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar *name); +typedef void (APIENTRYP PFNGLGETUNIFORMFVPROC) (GLuint program, GLint location, GLfloat *params); +typedef void (APIENTRYP PFNGLGETUNIFORMIVPROC) (GLuint program, GLint location, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVPROC) (GLuint index, GLenum pname, GLdouble *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVPROC) (GLuint index, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVPROC) (GLuint index, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVPROC) (GLuint index, GLenum pname, void **pointer); +typedef GLboolean (APIENTRYP PFNGLISPROGRAMPROC) (GLuint program); +typedef GLboolean (APIENTRYP PFNGLISSHADERPROC) (GLuint shader); +typedef void (APIENTRYP PFNGLLINKPROGRAMPROC) (GLuint program); +typedef void (APIENTRYP PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length); +typedef void (APIENTRYP PFNGLUSEPROGRAMPROC) (GLuint program); +typedef void (APIENTRYP PFNGLUNIFORM1FPROC) (GLint location, GLfloat v0); +typedef void (APIENTRYP PFNGLUNIFORM2FPROC) (GLint location, GLfloat v0, GLfloat v1); +typedef void (APIENTRYP PFNGLUNIFORM3FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +typedef void (APIENTRYP PFNGLUNIFORM4FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +typedef void (APIENTRYP PFNGLUNIFORM1IPROC) (GLint location, GLint v0); +typedef void (APIENTRYP PFNGLUNIFORM2IPROC) (GLint location, GLint v0, GLint v1); +typedef void (APIENTRYP PFNGLUNIFORM3IPROC) (GLint location, GLint v0, GLint v1, GLint v2); +typedef void (APIENTRYP PFNGLUNIFORM4IPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +typedef void (APIENTRYP PFNGLUNIFORM1FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM2FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM3FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM4FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM1IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORM2IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORM3IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORM4IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLVALIDATEPROGRAMPROC) (GLuint program); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DPROC) (GLuint index, GLdouble x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FPROC) (GLuint index, GLfloat x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SPROC) (GLuint index, GLshort x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DPROC) (GLuint index, GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FPROC) (GLuint index, GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SPROC) (GLuint index, GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SPROC) (GLuint index, GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NBVPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NIVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NSVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBVPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUIVPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUSVPROC) (GLuint index, const GLushort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4BVPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4IVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UIVPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4USVPROC) (GLuint index, const GLushort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha); +GLAPI void APIENTRY glDrawBuffers (GLsizei n, const GLenum *bufs); +GLAPI void APIENTRY glStencilOpSeparate (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); +GLAPI void APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask); +GLAPI void APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask); +GLAPI void APIENTRY glAttachShader (GLuint program, GLuint shader); +GLAPI void APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar *name); +GLAPI void APIENTRY glCompileShader (GLuint shader); +GLAPI GLuint APIENTRY glCreateProgram (void); +GLAPI GLuint APIENTRY glCreateShader (GLenum type); +GLAPI void APIENTRY glDeleteProgram (GLuint program); +GLAPI void APIENTRY glDeleteShader (GLuint shader); +GLAPI void APIENTRY glDetachShader (GLuint program, GLuint shader); +GLAPI void APIENTRY glDisableVertexAttribArray (GLuint index); +GLAPI void APIENTRY glEnableVertexAttribArray (GLuint index); +GLAPI void APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +GLAPI void APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +GLAPI void APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders); +GLAPI GLint APIENTRY glGetAttribLocation (GLuint program, const GLchar *name); +GLAPI void APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +GLAPI void APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +GLAPI void APIENTRY glGetShaderSource (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); +GLAPI GLint APIENTRY glGetUniformLocation (GLuint program, const GLchar *name); +GLAPI void APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat *params); +GLAPI void APIENTRY glGetUniformiv (GLuint program, GLint location, GLint *params); +GLAPI void APIENTRY glGetVertexAttribdv (GLuint index, GLenum pname, GLdouble *params); +GLAPI void APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, void **pointer); +GLAPI GLboolean APIENTRY glIsProgram (GLuint program); +GLAPI GLboolean APIENTRY glIsShader (GLuint shader); +GLAPI void APIENTRY glLinkProgram (GLuint program); +GLAPI void APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length); +GLAPI void APIENTRY glUseProgram (GLuint program); +GLAPI void APIENTRY glUniform1f (GLint location, GLfloat v0); +GLAPI void APIENTRY glUniform2f (GLint location, GLfloat v0, GLfloat v1); +GLAPI void APIENTRY glUniform3f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +GLAPI void APIENTRY glUniform4f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +GLAPI void APIENTRY glUniform1i (GLint location, GLint v0); +GLAPI void APIENTRY glUniform2i (GLint location, GLint v0, GLint v1); +GLAPI void APIENTRY glUniform3i (GLint location, GLint v0, GLint v1, GLint v2); +GLAPI void APIENTRY glUniform4i (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +GLAPI void APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glValidateProgram (GLuint program); +GLAPI void APIENTRY glVertexAttrib1d (GLuint index, GLdouble x); +GLAPI void APIENTRY glVertexAttrib1dv (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttrib1f (GLuint index, GLfloat x); +GLAPI void APIENTRY glVertexAttrib1fv (GLuint index, const GLfloat *v); +GLAPI void APIENTRY glVertexAttrib1s (GLuint index, GLshort x); +GLAPI void APIENTRY glVertexAttrib1sv (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttrib2d (GLuint index, GLdouble x, GLdouble y); +GLAPI void APIENTRY glVertexAttrib2dv (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttrib2f (GLuint index, GLfloat x, GLfloat y); +GLAPI void APIENTRY glVertexAttrib2fv (GLuint index, const GLfloat *v); +GLAPI void APIENTRY glVertexAttrib2s (GLuint index, GLshort x, GLshort y); +GLAPI void APIENTRY glVertexAttrib2sv (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttrib3d (GLuint index, GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY glVertexAttrib3dv (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttrib3f (GLuint index, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glVertexAttrib3fv (GLuint index, const GLfloat *v); +GLAPI void APIENTRY glVertexAttrib3s (GLuint index, GLshort x, GLshort y, GLshort z); +GLAPI void APIENTRY glVertexAttrib3sv (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttrib4Nbv (GLuint index, const GLbyte *v); +GLAPI void APIENTRY glVertexAttrib4Niv (GLuint index, const GLint *v); +GLAPI void APIENTRY glVertexAttrib4Nsv (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttrib4Nub (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +GLAPI void APIENTRY glVertexAttrib4Nubv (GLuint index, const GLubyte *v); +GLAPI void APIENTRY glVertexAttrib4Nuiv (GLuint index, const GLuint *v); +GLAPI void APIENTRY glVertexAttrib4Nusv (GLuint index, const GLushort *v); +GLAPI void APIENTRY glVertexAttrib4bv (GLuint index, const GLbyte *v); +GLAPI void APIENTRY glVertexAttrib4d (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY glVertexAttrib4dv (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttrib4f (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void APIENTRY glVertexAttrib4fv (GLuint index, const GLfloat *v); +GLAPI void APIENTRY glVertexAttrib4iv (GLuint index, const GLint *v); +GLAPI void APIENTRY glVertexAttrib4s (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +GLAPI void APIENTRY glVertexAttrib4sv (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttrib4ubv (GLuint index, const GLubyte *v); +GLAPI void APIENTRY glVertexAttrib4uiv (GLuint index, const GLuint *v); +GLAPI void APIENTRY glVertexAttrib4usv (GLuint index, const GLushort *v); +GLAPI void APIENTRY glVertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer); +#endif +#endif /* GL_VERSION_2_0 */ + +#ifndef GL_VERSION_2_1 +#define GL_VERSION_2_1 1 +#define GL_PIXEL_PACK_BUFFER 0x88EB +#define GL_PIXEL_UNPACK_BUFFER 0x88EC +#define GL_PIXEL_PACK_BUFFER_BINDING 0x88ED +#define GL_PIXEL_UNPACK_BUFFER_BINDING 0x88EF +#define GL_FLOAT_MAT2x3 0x8B65 +#define GL_FLOAT_MAT2x4 0x8B66 +#define GL_FLOAT_MAT3x2 0x8B67 +#define GL_FLOAT_MAT3x4 0x8B68 +#define GL_FLOAT_MAT4x2 0x8B69 +#define GL_FLOAT_MAT4x3 0x8B6A +#define GL_SRGB 0x8C40 +#define GL_SRGB8 0x8C41 +#define GL_SRGB_ALPHA 0x8C42 +#define GL_SRGB8_ALPHA8 0x8C43 +#define GL_COMPRESSED_SRGB 0x8C48 +#define GL_COMPRESSED_SRGB_ALPHA 0x8C49 +#define GL_CURRENT_RASTER_SECONDARY_COLOR 0x845F +#define GL_SLUMINANCE_ALPHA 0x8C44 +#define GL_SLUMINANCE8_ALPHA8 0x8C45 +#define GL_SLUMINANCE 0x8C46 +#define GL_SLUMINANCE8 0x8C47 +#define GL_COMPRESSED_SLUMINANCE 0x8C4A +#define GL_COMPRESSED_SLUMINANCE_ALPHA 0x8C4B +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glUniformMatrix2x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glUniformMatrix3x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glUniformMatrix2x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glUniformMatrix4x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glUniformMatrix3x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glUniformMatrix4x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +#endif +#endif /* GL_VERSION_2_1 */ + +#ifndef GL_VERSION_3_0 +#define GL_VERSION_3_0 1 +typedef unsigned short GLhalf; +#define GL_COMPARE_REF_TO_TEXTURE 0x884E +#define GL_CLIP_DISTANCE0 0x3000 +#define GL_CLIP_DISTANCE1 0x3001 +#define GL_CLIP_DISTANCE2 0x3002 +#define GL_CLIP_DISTANCE3 0x3003 +#define GL_CLIP_DISTANCE4 0x3004 +#define GL_CLIP_DISTANCE5 0x3005 +#define GL_CLIP_DISTANCE6 0x3006 +#define GL_CLIP_DISTANCE7 0x3007 +#define GL_MAX_CLIP_DISTANCES 0x0D32 +#define GL_MAJOR_VERSION 0x821B +#define GL_MINOR_VERSION 0x821C +#define GL_NUM_EXTENSIONS 0x821D +#define GL_CONTEXT_FLAGS 0x821E +#define GL_COMPRESSED_RED 0x8225 +#define GL_COMPRESSED_RG 0x8226 +#define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT 0x00000001 +#define GL_RGBA32F 0x8814 +#define GL_RGB32F 0x8815 +#define GL_RGBA16F 0x881A +#define GL_RGB16F 0x881B +#define GL_VERTEX_ATTRIB_ARRAY_INTEGER 0x88FD +#define GL_MAX_ARRAY_TEXTURE_LAYERS 0x88FF +#define GL_MIN_PROGRAM_TEXEL_OFFSET 0x8904 +#define GL_MAX_PROGRAM_TEXEL_OFFSET 0x8905 +#define GL_CLAMP_READ_COLOR 0x891C +#define GL_FIXED_ONLY 0x891D +#define GL_MAX_VARYING_COMPONENTS 0x8B4B +#define GL_TEXTURE_1D_ARRAY 0x8C18 +#define GL_PROXY_TEXTURE_1D_ARRAY 0x8C19 +#define GL_TEXTURE_2D_ARRAY 0x8C1A +#define GL_PROXY_TEXTURE_2D_ARRAY 0x8C1B +#define GL_TEXTURE_BINDING_1D_ARRAY 0x8C1C +#define GL_TEXTURE_BINDING_2D_ARRAY 0x8C1D +#define GL_R11F_G11F_B10F 0x8C3A +#define GL_UNSIGNED_INT_10F_11F_11F_REV 0x8C3B +#define GL_RGB9_E5 0x8C3D +#define GL_UNSIGNED_INT_5_9_9_9_REV 0x8C3E +#define GL_TEXTURE_SHARED_SIZE 0x8C3F +#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH 0x8C76 +#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE 0x8C7F +#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS 0x8C80 +#define GL_TRANSFORM_FEEDBACK_VARYINGS 0x8C83 +#define GL_TRANSFORM_FEEDBACK_BUFFER_START 0x8C84 +#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE 0x8C85 +#define GL_PRIMITIVES_GENERATED 0x8C87 +#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN 0x8C88 +#define GL_RASTERIZER_DISCARD 0x8C89 +#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS 0x8C8A +#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS 0x8C8B +#define GL_INTERLEAVED_ATTRIBS 0x8C8C +#define GL_SEPARATE_ATTRIBS 0x8C8D +#define GL_TRANSFORM_FEEDBACK_BUFFER 0x8C8E +#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING 0x8C8F +#define GL_RGBA32UI 0x8D70 +#define GL_RGB32UI 0x8D71 +#define GL_RGBA16UI 0x8D76 +#define GL_RGB16UI 0x8D77 +#define GL_RGBA8UI 0x8D7C +#define GL_RGB8UI 0x8D7D +#define GL_RGBA32I 0x8D82 +#define GL_RGB32I 0x8D83 +#define GL_RGBA16I 0x8D88 +#define GL_RGB16I 0x8D89 +#define GL_RGBA8I 0x8D8E +#define GL_RGB8I 0x8D8F +#define GL_RED_INTEGER 0x8D94 +#define GL_GREEN_INTEGER 0x8D95 +#define GL_BLUE_INTEGER 0x8D96 +#define GL_RGB_INTEGER 0x8D98 +#define GL_RGBA_INTEGER 0x8D99 +#define GL_BGR_INTEGER 0x8D9A +#define GL_BGRA_INTEGER 0x8D9B +#define GL_SAMPLER_1D_ARRAY 0x8DC0 +#define GL_SAMPLER_2D_ARRAY 0x8DC1 +#define GL_SAMPLER_1D_ARRAY_SHADOW 0x8DC3 +#define GL_SAMPLER_2D_ARRAY_SHADOW 0x8DC4 +#define GL_SAMPLER_CUBE_SHADOW 0x8DC5 +#define GL_UNSIGNED_INT_VEC2 0x8DC6 +#define GL_UNSIGNED_INT_VEC3 0x8DC7 +#define GL_UNSIGNED_INT_VEC4 0x8DC8 +#define GL_INT_SAMPLER_1D 0x8DC9 +#define GL_INT_SAMPLER_2D 0x8DCA +#define GL_INT_SAMPLER_3D 0x8DCB +#define GL_INT_SAMPLER_CUBE 0x8DCC +#define GL_INT_SAMPLER_1D_ARRAY 0x8DCE +#define GL_INT_SAMPLER_2D_ARRAY 0x8DCF +#define GL_UNSIGNED_INT_SAMPLER_1D 0x8DD1 +#define GL_UNSIGNED_INT_SAMPLER_2D 0x8DD2 +#define GL_UNSIGNED_INT_SAMPLER_3D 0x8DD3 +#define GL_UNSIGNED_INT_SAMPLER_CUBE 0x8DD4 +#define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY 0x8DD6 +#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY 0x8DD7 +#define GL_QUERY_WAIT 0x8E13 +#define GL_QUERY_NO_WAIT 0x8E14 +#define GL_QUERY_BY_REGION_WAIT 0x8E15 +#define GL_QUERY_BY_REGION_NO_WAIT 0x8E16 +#define GL_BUFFER_ACCESS_FLAGS 0x911F +#define GL_BUFFER_MAP_LENGTH 0x9120 +#define GL_BUFFER_MAP_OFFSET 0x9121 +#define GL_DEPTH_COMPONENT32F 0x8CAC +#define GL_DEPTH32F_STENCIL8 0x8CAD +#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV 0x8DAD +#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506 +#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING 0x8210 +#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE 0x8211 +#define GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE 0x8212 +#define GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE 0x8213 +#define GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE 0x8214 +#define GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE 0x8215 +#define GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE 0x8216 +#define GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE 0x8217 +#define GL_FRAMEBUFFER_DEFAULT 0x8218 +#define GL_FRAMEBUFFER_UNDEFINED 0x8219 +#define GL_DEPTH_STENCIL_ATTACHMENT 0x821A +#define GL_MAX_RENDERBUFFER_SIZE 0x84E8 +#define GL_DEPTH_STENCIL 0x84F9 +#define GL_UNSIGNED_INT_24_8 0x84FA +#define GL_DEPTH24_STENCIL8 0x88F0 +#define GL_TEXTURE_STENCIL_SIZE 0x88F1 +#define GL_TEXTURE_RED_TYPE 0x8C10 +#define GL_TEXTURE_GREEN_TYPE 0x8C11 +#define GL_TEXTURE_BLUE_TYPE 0x8C12 +#define GL_TEXTURE_ALPHA_TYPE 0x8C13 +#define GL_TEXTURE_DEPTH_TYPE 0x8C16 +#define GL_UNSIGNED_NORMALIZED 0x8C17 +#define GL_FRAMEBUFFER_BINDING 0x8CA6 +#define GL_DRAW_FRAMEBUFFER_BINDING 0x8CA6 +#define GL_RENDERBUFFER_BINDING 0x8CA7 +#define GL_READ_FRAMEBUFFER 0x8CA8 +#define GL_DRAW_FRAMEBUFFER 0x8CA9 +#define GL_READ_FRAMEBUFFER_BINDING 0x8CAA +#define GL_RENDERBUFFER_SAMPLES 0x8CAB +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4 +#define GL_FRAMEBUFFER_COMPLETE 0x8CD5 +#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6 +#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7 +#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER 0x8CDB +#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER 0x8CDC +#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD +#define GL_MAX_COLOR_ATTACHMENTS 0x8CDF +#define GL_COLOR_ATTACHMENT0 0x8CE0 +#define GL_COLOR_ATTACHMENT1 0x8CE1 +#define GL_COLOR_ATTACHMENT2 0x8CE2 +#define GL_COLOR_ATTACHMENT3 0x8CE3 +#define GL_COLOR_ATTACHMENT4 0x8CE4 +#define GL_COLOR_ATTACHMENT5 0x8CE5 +#define GL_COLOR_ATTACHMENT6 0x8CE6 +#define GL_COLOR_ATTACHMENT7 0x8CE7 +#define GL_COLOR_ATTACHMENT8 0x8CE8 +#define GL_COLOR_ATTACHMENT9 0x8CE9 +#define GL_COLOR_ATTACHMENT10 0x8CEA +#define GL_COLOR_ATTACHMENT11 0x8CEB +#define GL_COLOR_ATTACHMENT12 0x8CEC +#define GL_COLOR_ATTACHMENT13 0x8CED +#define GL_COLOR_ATTACHMENT14 0x8CEE +#define GL_COLOR_ATTACHMENT15 0x8CEF +#define GL_DEPTH_ATTACHMENT 0x8D00 +#define GL_STENCIL_ATTACHMENT 0x8D20 +#define GL_FRAMEBUFFER 0x8D40 +#define GL_RENDERBUFFER 0x8D41 +#define GL_RENDERBUFFER_WIDTH 0x8D42 +#define GL_RENDERBUFFER_HEIGHT 0x8D43 +#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44 +#define GL_STENCIL_INDEX1 0x8D46 +#define GL_STENCIL_INDEX4 0x8D47 +#define GL_STENCIL_INDEX8 0x8D48 +#define GL_STENCIL_INDEX16 0x8D49 +#define GL_RENDERBUFFER_RED_SIZE 0x8D50 +#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51 +#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52 +#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53 +#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54 +#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55 +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56 +#define GL_MAX_SAMPLES 0x8D57 +#define GL_INDEX 0x8222 +#define GL_TEXTURE_LUMINANCE_TYPE 0x8C14 +#define GL_TEXTURE_INTENSITY_TYPE 0x8C15 +#define GL_FRAMEBUFFER_SRGB 0x8DB9 +#define GL_HALF_FLOAT 0x140B +#define GL_MAP_READ_BIT 0x0001 +#define GL_MAP_WRITE_BIT 0x0002 +#define GL_MAP_INVALIDATE_RANGE_BIT 0x0004 +#define GL_MAP_INVALIDATE_BUFFER_BIT 0x0008 +#define GL_MAP_FLUSH_EXPLICIT_BIT 0x0010 +#define GL_MAP_UNSYNCHRONIZED_BIT 0x0020 +#define GL_COMPRESSED_RED_RGTC1 0x8DBB +#define GL_COMPRESSED_SIGNED_RED_RGTC1 0x8DBC +#define GL_COMPRESSED_RG_RGTC2 0x8DBD +#define GL_COMPRESSED_SIGNED_RG_RGTC2 0x8DBE +#define GL_RG 0x8227 +#define GL_RG_INTEGER 0x8228 +#define GL_R8 0x8229 +#define GL_R16 0x822A +#define GL_RG8 0x822B +#define GL_RG16 0x822C +#define GL_R16F 0x822D +#define GL_R32F 0x822E +#define GL_RG16F 0x822F +#define GL_RG32F 0x8230 +#define GL_R8I 0x8231 +#define GL_R8UI 0x8232 +#define GL_R16I 0x8233 +#define GL_R16UI 0x8234 +#define GL_R32I 0x8235 +#define GL_R32UI 0x8236 +#define GL_RG8I 0x8237 +#define GL_RG8UI 0x8238 +#define GL_RG16I 0x8239 +#define GL_RG16UI 0x823A +#define GL_RG32I 0x823B +#define GL_RG32UI 0x823C +#define GL_VERTEX_ARRAY_BINDING 0x85B5 +#define GL_CLAMP_VERTEX_COLOR 0x891A +#define GL_CLAMP_FRAGMENT_COLOR 0x891B +#define GL_ALPHA_INTEGER 0x8D97 +typedef void (APIENTRYP PFNGLCOLORMASKIPROC) (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); +typedef void (APIENTRYP PFNGLGETBOOLEANI_VPROC) (GLenum target, GLuint index, GLboolean *data); +typedef void (APIENTRYP PFNGLGETINTEGERI_VPROC) (GLenum target, GLuint index, GLint *data); +typedef void (APIENTRYP PFNGLENABLEIPROC) (GLenum target, GLuint index); +typedef void (APIENTRYP PFNGLDISABLEIPROC) (GLenum target, GLuint index); +typedef GLboolean (APIENTRYP PFNGLISENABLEDIPROC) (GLenum target, GLuint index); +typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKPROC) (GLenum primitiveMode); +typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKPROC) (void); +typedef void (APIENTRYP PFNGLBINDBUFFERRANGEPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); +typedef void (APIENTRYP PFNGLBINDBUFFERBASEPROC) (GLenum target, GLuint index, GLuint buffer); +typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSPROC) (GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode); +typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); +typedef void (APIENTRYP PFNGLCLAMPCOLORPROC) (GLenum target, GLenum clamp); +typedef void (APIENTRYP PFNGLBEGINCONDITIONALRENDERPROC) (GLuint id, GLenum mode); +typedef void (APIENTRYP PFNGLENDCONDITIONALRENDERPROC) (void); +typedef void (APIENTRYP PFNGLVERTEXATTRIBIPOINTERPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIIVPROC) (GLuint index, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIUIVPROC) (GLuint index, GLenum pname, GLuint *params); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IPROC) (GLuint index, GLint x); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IPROC) (GLuint index, GLint x, GLint y); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IPROC) (GLuint index, GLint x, GLint y, GLint z); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IPROC) (GLuint index, GLint x, GLint y, GLint z, GLint w); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIPROC) (GLuint index, GLuint x); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIPROC) (GLuint index, GLuint x, GLuint y); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIPROC) (GLuint index, GLuint x, GLuint y, GLuint z); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIPROC) (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIVPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIVPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIVPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIVPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4BVPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4SVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UBVPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4USVPROC) (GLuint index, const GLushort *v); +typedef void (APIENTRYP PFNGLGETUNIFORMUIVPROC) (GLuint program, GLint location, GLuint *params); +typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONPROC) (GLuint program, GLuint color, const GLchar *name); +typedef GLint (APIENTRYP PFNGLGETFRAGDATALOCATIONPROC) (GLuint program, const GLchar *name); +typedef void (APIENTRYP PFNGLUNIFORM1UIPROC) (GLint location, GLuint v0); +typedef void (APIENTRYP PFNGLUNIFORM2UIPROC) (GLint location, GLuint v0, GLuint v1); +typedef void (APIENTRYP PFNGLUNIFORM3UIPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2); +typedef void (APIENTRYP PFNGLUNIFORM4UIPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +typedef void (APIENTRYP PFNGLUNIFORM1UIVPROC) (GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLUNIFORM2UIVPROC) (GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLUNIFORM3UIVPROC) (GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLUNIFORM4UIVPROC) (GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLTEXPARAMETERIIVPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLTEXPARAMETERIUIVPROC) (GLenum target, GLenum pname, const GLuint *params); +typedef void (APIENTRYP PFNGLGETTEXPARAMETERIIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETTEXPARAMETERIUIVPROC) (GLenum target, GLenum pname, GLuint *params); +typedef void (APIENTRYP PFNGLCLEARBUFFERIVPROC) (GLenum buffer, GLint drawbuffer, const GLint *value); +typedef void (APIENTRYP PFNGLCLEARBUFFERUIVPROC) (GLenum buffer, GLint drawbuffer, const GLuint *value); +typedef void (APIENTRYP PFNGLCLEARBUFFERFVPROC) (GLenum buffer, GLint drawbuffer, const GLfloat *value); +typedef void (APIENTRYP PFNGLCLEARBUFFERFIPROC) (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); +typedef const GLubyte *(APIENTRYP PFNGLGETSTRINGIPROC) (GLenum name, GLuint index); +typedef GLboolean (APIENTRYP PFNGLISRENDERBUFFERPROC) (GLuint renderbuffer); +typedef void (APIENTRYP PFNGLBINDRENDERBUFFERPROC) (GLenum target, GLuint renderbuffer); +typedef void (APIENTRYP PFNGLDELETERENDERBUFFERSPROC) (GLsizei n, const GLuint *renderbuffers); +typedef void (APIENTRYP PFNGLGENRENDERBUFFERSPROC) (GLsizei n, GLuint *renderbuffers); +typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef GLboolean (APIENTRYP PFNGLISFRAMEBUFFERPROC) (GLuint framebuffer); +typedef void (APIENTRYP PFNGLBINDFRAMEBUFFERPROC) (GLenum target, GLuint framebuffer); +typedef void (APIENTRYP PFNGLDELETEFRAMEBUFFERSPROC) (GLsizei n, const GLuint *framebuffers); +typedef void (APIENTRYP PFNGLGENFRAMEBUFFERSPROC) (GLsizei n, GLuint *framebuffers); +typedef GLenum (APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSPROC) (GLenum target); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE1DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +typedef void (APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFERPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +typedef void (APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGENERATEMIPMAPPROC) (GLenum target); +typedef void (APIENTRYP PFNGLBLITFRAMEBUFFERPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYERPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); +typedef void *(APIENTRYP PFNGLMAPBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); +typedef void (APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length); +typedef void (APIENTRYP PFNGLBINDVERTEXARRAYPROC) (GLuint array); +typedef void (APIENTRYP PFNGLDELETEVERTEXARRAYSPROC) (GLsizei n, const GLuint *arrays); +typedef void (APIENTRYP PFNGLGENVERTEXARRAYSPROC) (GLsizei n, GLuint *arrays); +typedef GLboolean (APIENTRYP PFNGLISVERTEXARRAYPROC) (GLuint array); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glColorMaski (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); +GLAPI void APIENTRY glGetBooleani_v (GLenum target, GLuint index, GLboolean *data); +GLAPI void APIENTRY glGetIntegeri_v (GLenum target, GLuint index, GLint *data); +GLAPI void APIENTRY glEnablei (GLenum target, GLuint index); +GLAPI void APIENTRY glDisablei (GLenum target, GLuint index); +GLAPI GLboolean APIENTRY glIsEnabledi (GLenum target, GLuint index); +GLAPI void APIENTRY glBeginTransformFeedback (GLenum primitiveMode); +GLAPI void APIENTRY glEndTransformFeedback (void); +GLAPI void APIENTRY glBindBufferRange (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); +GLAPI void APIENTRY glBindBufferBase (GLenum target, GLuint index, GLuint buffer); +GLAPI void APIENTRY glTransformFeedbackVaryings (GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode); +GLAPI void APIENTRY glGetTransformFeedbackVarying (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); +GLAPI void APIENTRY glClampColor (GLenum target, GLenum clamp); +GLAPI void APIENTRY glBeginConditionalRender (GLuint id, GLenum mode); +GLAPI void APIENTRY glEndConditionalRender (void); +GLAPI void APIENTRY glVertexAttribIPointer (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer); +GLAPI void APIENTRY glGetVertexAttribIiv (GLuint index, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetVertexAttribIuiv (GLuint index, GLenum pname, GLuint *params); +GLAPI void APIENTRY glVertexAttribI1i (GLuint index, GLint x); +GLAPI void APIENTRY glVertexAttribI2i (GLuint index, GLint x, GLint y); +GLAPI void APIENTRY glVertexAttribI3i (GLuint index, GLint x, GLint y, GLint z); +GLAPI void APIENTRY glVertexAttribI4i (GLuint index, GLint x, GLint y, GLint z, GLint w); +GLAPI void APIENTRY glVertexAttribI1ui (GLuint index, GLuint x); +GLAPI void APIENTRY glVertexAttribI2ui (GLuint index, GLuint x, GLuint y); +GLAPI void APIENTRY glVertexAttribI3ui (GLuint index, GLuint x, GLuint y, GLuint z); +GLAPI void APIENTRY glVertexAttribI4ui (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +GLAPI void APIENTRY glVertexAttribI1iv (GLuint index, const GLint *v); +GLAPI void APIENTRY glVertexAttribI2iv (GLuint index, const GLint *v); +GLAPI void APIENTRY glVertexAttribI3iv (GLuint index, const GLint *v); +GLAPI void APIENTRY glVertexAttribI4iv (GLuint index, const GLint *v); +GLAPI void APIENTRY glVertexAttribI1uiv (GLuint index, const GLuint *v); +GLAPI void APIENTRY glVertexAttribI2uiv (GLuint index, const GLuint *v); +GLAPI void APIENTRY glVertexAttribI3uiv (GLuint index, const GLuint *v); +GLAPI void APIENTRY glVertexAttribI4uiv (GLuint index, const GLuint *v); +GLAPI void APIENTRY glVertexAttribI4bv (GLuint index, const GLbyte *v); +GLAPI void APIENTRY glVertexAttribI4sv (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttribI4ubv (GLuint index, const GLubyte *v); +GLAPI void APIENTRY glVertexAttribI4usv (GLuint index, const GLushort *v); +GLAPI void APIENTRY glGetUniformuiv (GLuint program, GLint location, GLuint *params); +GLAPI void APIENTRY glBindFragDataLocation (GLuint program, GLuint color, const GLchar *name); +GLAPI GLint APIENTRY glGetFragDataLocation (GLuint program, const GLchar *name); +GLAPI void APIENTRY glUniform1ui (GLint location, GLuint v0); +GLAPI void APIENTRY glUniform2ui (GLint location, GLuint v0, GLuint v1); +GLAPI void APIENTRY glUniform3ui (GLint location, GLuint v0, GLuint v1, GLuint v2); +GLAPI void APIENTRY glUniform4ui (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +GLAPI void APIENTRY glUniform1uiv (GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glUniform2uiv (GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glUniform3uiv (GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glUniform4uiv (GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glTexParameterIiv (GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY glTexParameterIuiv (GLenum target, GLenum pname, const GLuint *params); +GLAPI void APIENTRY glGetTexParameterIiv (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetTexParameterIuiv (GLenum target, GLenum pname, GLuint *params); +GLAPI void APIENTRY glClearBufferiv (GLenum buffer, GLint drawbuffer, const GLint *value); +GLAPI void APIENTRY glClearBufferuiv (GLenum buffer, GLint drawbuffer, const GLuint *value); +GLAPI void APIENTRY glClearBufferfv (GLenum buffer, GLint drawbuffer, const GLfloat *value); +GLAPI void APIENTRY glClearBufferfi (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); +GLAPI const GLubyte *APIENTRY glGetStringi (GLenum name, GLuint index); +GLAPI GLboolean APIENTRY glIsRenderbuffer (GLuint renderbuffer); +GLAPI void APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer); +GLAPI void APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint *renderbuffers); +GLAPI void APIENTRY glGenRenderbuffers (GLsizei n, GLuint *renderbuffers); +GLAPI void APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI void APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint *params); +GLAPI GLboolean APIENTRY glIsFramebuffer (GLuint framebuffer); +GLAPI void APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer); +GLAPI void APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint *framebuffers); +GLAPI void APIENTRY glGenFramebuffers (GLsizei n, GLuint *framebuffers); +GLAPI GLenum APIENTRY glCheckFramebufferStatus (GLenum target); +GLAPI void APIENTRY glFramebufferTexture1D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +GLAPI void APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +GLAPI void APIENTRY glFramebufferTexture3D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +GLAPI void APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +GLAPI void APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint *params); +GLAPI void APIENTRY glGenerateMipmap (GLenum target); +GLAPI void APIENTRY glBlitFramebuffer (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +GLAPI void APIENTRY glRenderbufferStorageMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI void APIENTRY glFramebufferTextureLayer (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); +GLAPI void *APIENTRY glMapBufferRange (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); +GLAPI void APIENTRY glFlushMappedBufferRange (GLenum target, GLintptr offset, GLsizeiptr length); +GLAPI void APIENTRY glBindVertexArray (GLuint array); +GLAPI void APIENTRY glDeleteVertexArrays (GLsizei n, const GLuint *arrays); +GLAPI void APIENTRY glGenVertexArrays (GLsizei n, GLuint *arrays); +GLAPI GLboolean APIENTRY glIsVertexArray (GLuint array); +#endif +#endif /* GL_VERSION_3_0 */ + +#ifndef GL_VERSION_3_1 +#define GL_VERSION_3_1 1 +#define GL_SAMPLER_2D_RECT 0x8B63 +#define GL_SAMPLER_2D_RECT_SHADOW 0x8B64 +#define GL_SAMPLER_BUFFER 0x8DC2 +#define GL_INT_SAMPLER_2D_RECT 0x8DCD +#define GL_INT_SAMPLER_BUFFER 0x8DD0 +#define GL_UNSIGNED_INT_SAMPLER_2D_RECT 0x8DD5 +#define GL_UNSIGNED_INT_SAMPLER_BUFFER 0x8DD8 +#define GL_TEXTURE_BUFFER 0x8C2A +#define GL_MAX_TEXTURE_BUFFER_SIZE 0x8C2B +#define GL_TEXTURE_BINDING_BUFFER 0x8C2C +#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING 0x8C2D +#define GL_TEXTURE_RECTANGLE 0x84F5 +#define GL_TEXTURE_BINDING_RECTANGLE 0x84F6 +#define GL_PROXY_TEXTURE_RECTANGLE 0x84F7 +#define GL_MAX_RECTANGLE_TEXTURE_SIZE 0x84F8 +#define GL_R8_SNORM 0x8F94 +#define GL_RG8_SNORM 0x8F95 +#define GL_RGB8_SNORM 0x8F96 +#define GL_RGBA8_SNORM 0x8F97 +#define GL_R16_SNORM 0x8F98 +#define GL_RG16_SNORM 0x8F99 +#define GL_RGB16_SNORM 0x8F9A +#define GL_RGBA16_SNORM 0x8F9B +#define GL_SIGNED_NORMALIZED 0x8F9C +#define GL_PRIMITIVE_RESTART 0x8F9D +#define GL_PRIMITIVE_RESTART_INDEX 0x8F9E +#define GL_COPY_READ_BUFFER 0x8F36 +#define GL_COPY_WRITE_BUFFER 0x8F37 +#define GL_UNIFORM_BUFFER 0x8A11 +#define GL_UNIFORM_BUFFER_BINDING 0x8A28 +#define GL_UNIFORM_BUFFER_START 0x8A29 +#define GL_UNIFORM_BUFFER_SIZE 0x8A2A +#define GL_MAX_VERTEX_UNIFORM_BLOCKS 0x8A2B +#define GL_MAX_FRAGMENT_UNIFORM_BLOCKS 0x8A2D +#define GL_MAX_COMBINED_UNIFORM_BLOCKS 0x8A2E +#define GL_MAX_UNIFORM_BUFFER_BINDINGS 0x8A2F +#define GL_MAX_UNIFORM_BLOCK_SIZE 0x8A30 +#define GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS 0x8A31 +#define GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS 0x8A33 +#define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT 0x8A34 +#define GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 0x8A35 +#define GL_ACTIVE_UNIFORM_BLOCKS 0x8A36 +#define GL_UNIFORM_TYPE 0x8A37 +#define GL_UNIFORM_SIZE 0x8A38 +#define GL_UNIFORM_NAME_LENGTH 0x8A39 +#define GL_UNIFORM_BLOCK_INDEX 0x8A3A +#define GL_UNIFORM_OFFSET 0x8A3B +#define GL_UNIFORM_ARRAY_STRIDE 0x8A3C +#define GL_UNIFORM_MATRIX_STRIDE 0x8A3D +#define GL_UNIFORM_IS_ROW_MAJOR 0x8A3E +#define GL_UNIFORM_BLOCK_BINDING 0x8A3F +#define GL_UNIFORM_BLOCK_DATA_SIZE 0x8A40 +#define GL_UNIFORM_BLOCK_NAME_LENGTH 0x8A41 +#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS 0x8A42 +#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 0x8A43 +#define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44 +#define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46 +#define GL_INVALID_INDEX 0xFFFFFFFFu +typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDPROC) (GLenum mode, GLint first, GLsizei count, GLsizei instancecount); +typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount); +typedef void (APIENTRYP PFNGLTEXBUFFERPROC) (GLenum target, GLenum internalformat, GLuint buffer); +typedef void (APIENTRYP PFNGLPRIMITIVERESTARTINDEXPROC) (GLuint index); +typedef void (APIENTRYP PFNGLCOPYBUFFERSUBDATAPROC) (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +typedef void (APIENTRYP PFNGLGETUNIFORMINDICESPROC) (GLuint program, GLsizei uniformCount, const GLchar *const*uniformNames, GLuint *uniformIndices); +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMSIVPROC) (GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMNAMEPROC) (GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName); +typedef GLuint (APIENTRYP PFNGLGETUNIFORMBLOCKINDEXPROC) (GLuint program, const GLchar *uniformBlockName); +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKIVPROC) (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC) (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName); +typedef void (APIENTRYP PFNGLUNIFORMBLOCKBINDINGPROC) (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawArraysInstanced (GLenum mode, GLint first, GLsizei count, GLsizei instancecount); +GLAPI void APIENTRY glDrawElementsInstanced (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount); +GLAPI void APIENTRY glTexBuffer (GLenum target, GLenum internalformat, GLuint buffer); +GLAPI void APIENTRY glPrimitiveRestartIndex (GLuint index); +GLAPI void APIENTRY glCopyBufferSubData (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +GLAPI void APIENTRY glGetUniformIndices (GLuint program, GLsizei uniformCount, const GLchar *const*uniformNames, GLuint *uniformIndices); +GLAPI void APIENTRY glGetActiveUniformsiv (GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetActiveUniformName (GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName); +GLAPI GLuint APIENTRY glGetUniformBlockIndex (GLuint program, const GLchar *uniformBlockName); +GLAPI void APIENTRY glGetActiveUniformBlockiv (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetActiveUniformBlockName (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName); +GLAPI void APIENTRY glUniformBlockBinding (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding); +#endif +#endif /* GL_VERSION_3_1 */ + +#ifndef GL_VERSION_3_2 +#define GL_VERSION_3_2 1 +typedef struct __GLsync *GLsync; +#ifndef GLEXT_64_TYPES_DEFINED +/* This code block is duplicated in glxext.h, so must be protected */ +#define GLEXT_64_TYPES_DEFINED +/* Define int32_t, int64_t, and uint64_t types for UST/MSC */ +/* (as used in the GL_EXT_timer_query extension). */ +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +#include +#elif defined(__sun__) || defined(__digital__) +#include +#if defined(__STDC__) +#if defined(__arch64__) || defined(_LP64) +typedef long int int64_t; +typedef unsigned long int uint64_t; +#else +typedef long long int int64_t; +typedef unsigned long long int uint64_t; +#endif /* __arch64__ */ +#endif /* __STDC__ */ +#elif defined( __VMS ) || defined(__sgi) +#include +#elif defined(__SCO__) || defined(__USLC__) +#include +#elif defined(__UNIXOS2__) || defined(__SOL64__) +typedef long int int32_t; +typedef long long int int64_t; +typedef unsigned long long int uint64_t; +#elif defined(_WIN32) && defined(__GNUC__) +#include +#elif defined(_WIN32) +typedef __int32 int32_t; +typedef __int64 int64_t; +typedef unsigned __int64 uint64_t; +#else +/* Fallback if nothing above works */ +#include +#endif +#endif +typedef uint64_t GLuint64; +typedef int64_t GLint64; +#define GL_CONTEXT_CORE_PROFILE_BIT 0x00000001 +#define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002 +#define GL_LINES_ADJACENCY 0x000A +#define GL_LINE_STRIP_ADJACENCY 0x000B +#define GL_TRIANGLES_ADJACENCY 0x000C +#define GL_TRIANGLE_STRIP_ADJACENCY 0x000D +#define GL_PROGRAM_POINT_SIZE 0x8642 +#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS 0x8C29 +#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED 0x8DA7 +#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS 0x8DA8 +#define GL_GEOMETRY_SHADER 0x8DD9 +#define GL_GEOMETRY_VERTICES_OUT 0x8916 +#define GL_GEOMETRY_INPUT_TYPE 0x8917 +#define GL_GEOMETRY_OUTPUT_TYPE 0x8918 +#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS 0x8DDF +#define GL_MAX_GEOMETRY_OUTPUT_VERTICES 0x8DE0 +#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS 0x8DE1 +#define GL_MAX_VERTEX_OUTPUT_COMPONENTS 0x9122 +#define GL_MAX_GEOMETRY_INPUT_COMPONENTS 0x9123 +#define GL_MAX_GEOMETRY_OUTPUT_COMPONENTS 0x9124 +#define GL_MAX_FRAGMENT_INPUT_COMPONENTS 0x9125 +#define GL_CONTEXT_PROFILE_MASK 0x9126 +#define GL_DEPTH_CLAMP 0x864F +#define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION 0x8E4C +#define GL_FIRST_VERTEX_CONVENTION 0x8E4D +#define GL_LAST_VERTEX_CONVENTION 0x8E4E +#define GL_PROVOKING_VERTEX 0x8E4F +#define GL_TEXTURE_CUBE_MAP_SEAMLESS 0x884F +#define GL_MAX_SERVER_WAIT_TIMEOUT 0x9111 +#define GL_OBJECT_TYPE 0x9112 +#define GL_SYNC_CONDITION 0x9113 +#define GL_SYNC_STATUS 0x9114 +#define GL_SYNC_FLAGS 0x9115 +#define GL_SYNC_FENCE 0x9116 +#define GL_SYNC_GPU_COMMANDS_COMPLETE 0x9117 +#define GL_UNSIGNALED 0x9118 +#define GL_SIGNALED 0x9119 +#define GL_ALREADY_SIGNALED 0x911A +#define GL_TIMEOUT_EXPIRED 0x911B +#define GL_CONDITION_SATISFIED 0x911C +#define GL_WAIT_FAILED 0x911D +#define GL_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFFull +#define GL_SYNC_FLUSH_COMMANDS_BIT 0x00000001 +#define GL_SAMPLE_POSITION 0x8E50 +#define GL_SAMPLE_MASK 0x8E51 +#define GL_SAMPLE_MASK_VALUE 0x8E52 +#define GL_MAX_SAMPLE_MASK_WORDS 0x8E59 +#define GL_TEXTURE_2D_MULTISAMPLE 0x9100 +#define GL_PROXY_TEXTURE_2D_MULTISAMPLE 0x9101 +#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9102 +#define GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9103 +#define GL_TEXTURE_BINDING_2D_MULTISAMPLE 0x9104 +#define GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY 0x9105 +#define GL_TEXTURE_SAMPLES 0x9106 +#define GL_TEXTURE_FIXED_SAMPLE_LOCATIONS 0x9107 +#define GL_SAMPLER_2D_MULTISAMPLE 0x9108 +#define GL_INT_SAMPLER_2D_MULTISAMPLE 0x9109 +#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE 0x910A +#define GL_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910B +#define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910C +#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910D +#define GL_MAX_COLOR_TEXTURE_SAMPLES 0x910E +#define GL_MAX_DEPTH_TEXTURE_SAMPLES 0x910F +#define GL_MAX_INTEGER_SAMPLES 0x9110 +typedef void (APIENTRYP PFNGLDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex); +typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex); +typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount, const GLint *basevertex); +typedef void (APIENTRYP PFNGLPROVOKINGVERTEXPROC) (GLenum mode); +typedef GLsync (APIENTRYP PFNGLFENCESYNCPROC) (GLenum condition, GLbitfield flags); +typedef GLboolean (APIENTRYP PFNGLISSYNCPROC) (GLsync sync); +typedef void (APIENTRYP PFNGLDELETESYNCPROC) (GLsync sync); +typedef GLenum (APIENTRYP PFNGLCLIENTWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); +typedef void (APIENTRYP PFNGLWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); +typedef void (APIENTRYP PFNGLGETINTEGER64VPROC) (GLenum pname, GLint64 *data); +typedef void (APIENTRYP PFNGLGETSYNCIVPROC) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); +typedef void (APIENTRYP PFNGLGETINTEGER64I_VPROC) (GLenum target, GLuint index, GLint64 *data); +typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERI64VPROC) (GLenum target, GLenum pname, GLint64 *params); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLTEXIMAGE2DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); +typedef void (APIENTRYP PFNGLTEXIMAGE3DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +typedef void (APIENTRYP PFNGLGETMULTISAMPLEFVPROC) (GLenum pname, GLuint index, GLfloat *val); +typedef void (APIENTRYP PFNGLSAMPLEMASKIPROC) (GLuint maskNumber, GLbitfield mask); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawElementsBaseVertex (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex); +GLAPI void APIENTRY glDrawRangeElementsBaseVertex (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex); +GLAPI void APIENTRY glDrawElementsInstancedBaseVertex (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex); +GLAPI void APIENTRY glMultiDrawElementsBaseVertex (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount, const GLint *basevertex); +GLAPI void APIENTRY glProvokingVertex (GLenum mode); +GLAPI GLsync APIENTRY glFenceSync (GLenum condition, GLbitfield flags); +GLAPI GLboolean APIENTRY glIsSync (GLsync sync); +GLAPI void APIENTRY glDeleteSync (GLsync sync); +GLAPI GLenum APIENTRY glClientWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout); +GLAPI void APIENTRY glWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout); +GLAPI void APIENTRY glGetInteger64v (GLenum pname, GLint64 *data); +GLAPI void APIENTRY glGetSynciv (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); +GLAPI void APIENTRY glGetInteger64i_v (GLenum target, GLuint index, GLint64 *data); +GLAPI void APIENTRY glGetBufferParameteri64v (GLenum target, GLenum pname, GLint64 *params); +GLAPI void APIENTRY glFramebufferTexture (GLenum target, GLenum attachment, GLuint texture, GLint level); +GLAPI void APIENTRY glTexImage2DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); +GLAPI void APIENTRY glTexImage3DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +GLAPI void APIENTRY glGetMultisamplefv (GLenum pname, GLuint index, GLfloat *val); +GLAPI void APIENTRY glSampleMaski (GLuint maskNumber, GLbitfield mask); +#endif +#endif /* GL_VERSION_3_2 */ + +#ifndef GL_VERSION_3_3 +#define GL_VERSION_3_3 1 +#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR 0x88FE +#define GL_SRC1_COLOR 0x88F9 +#define GL_ONE_MINUS_SRC1_COLOR 0x88FA +#define GL_ONE_MINUS_SRC1_ALPHA 0x88FB +#define GL_MAX_DUAL_SOURCE_DRAW_BUFFERS 0x88FC +#define GL_ANY_SAMPLES_PASSED 0x8C2F +#define GL_SAMPLER_BINDING 0x8919 +#define GL_RGB10_A2UI 0x906F +#define GL_TEXTURE_SWIZZLE_R 0x8E42 +#define GL_TEXTURE_SWIZZLE_G 0x8E43 +#define GL_TEXTURE_SWIZZLE_B 0x8E44 +#define GL_TEXTURE_SWIZZLE_A 0x8E45 +#define GL_TEXTURE_SWIZZLE_RGBA 0x8E46 +#define GL_TIME_ELAPSED 0x88BF +#define GL_TIMESTAMP 0x8E28 +#define GL_INT_2_10_10_10_REV 0x8D9F +typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONINDEXEDPROC) (GLuint program, GLuint colorNumber, GLuint index, const GLchar *name); +typedef GLint (APIENTRYP PFNGLGETFRAGDATAINDEXPROC) (GLuint program, const GLchar *name); +typedef void (APIENTRYP PFNGLGENSAMPLERSPROC) (GLsizei count, GLuint *samplers); +typedef void (APIENTRYP PFNGLDELETESAMPLERSPROC) (GLsizei count, const GLuint *samplers); +typedef GLboolean (APIENTRYP PFNGLISSAMPLERPROC) (GLuint sampler); +typedef void (APIENTRYP PFNGLBINDSAMPLERPROC) (GLuint unit, GLuint sampler); +typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIPROC) (GLuint sampler, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pname, const GLint *param); +typedef void (APIENTRYP PFNGLSAMPLERPARAMETERFPROC) (GLuint sampler, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, const GLfloat *param); +typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIIVPROC) (GLuint sampler, GLenum pname, const GLint *param); +typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIUIVPROC) (GLuint sampler, GLenum pname, const GLuint *param); +typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIIVPROC) (GLuint sampler, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIUIVPROC) (GLuint sampler, GLenum pname, GLuint *params); +typedef void (APIENTRYP PFNGLQUERYCOUNTERPROC) (GLuint id, GLenum target); +typedef void (APIENTRYP PFNGLGETQUERYOBJECTI64VPROC) (GLuint id, GLenum pname, GLint64 *params); +typedef void (APIENTRYP PFNGLGETQUERYOBJECTUI64VPROC) (GLuint id, GLenum pname, GLuint64 *params); +typedef void (APIENTRYP PFNGLVERTEXATTRIBDIVISORPROC) (GLuint index, GLuint divisor); +typedef void (APIENTRYP PFNGLVERTEXATTRIBP1UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value); +typedef void (APIENTRYP PFNGLVERTEXATTRIBP1UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); +typedef void (APIENTRYP PFNGLVERTEXATTRIBP2UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value); +typedef void (APIENTRYP PFNGLVERTEXATTRIBP2UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); +typedef void (APIENTRYP PFNGLVERTEXATTRIBP3UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value); +typedef void (APIENTRYP PFNGLVERTEXATTRIBP3UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); +typedef void (APIENTRYP PFNGLVERTEXATTRIBP4UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value); +typedef void (APIENTRYP PFNGLVERTEXATTRIBP4UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); +typedef void (APIENTRYP PFNGLVERTEXP2UIPROC) (GLenum type, GLuint value); +typedef void (APIENTRYP PFNGLVERTEXP2UIVPROC) (GLenum type, const GLuint *value); +typedef void (APIENTRYP PFNGLVERTEXP3UIPROC) (GLenum type, GLuint value); +typedef void (APIENTRYP PFNGLVERTEXP3UIVPROC) (GLenum type, const GLuint *value); +typedef void (APIENTRYP PFNGLVERTEXP4UIPROC) (GLenum type, GLuint value); +typedef void (APIENTRYP PFNGLVERTEXP4UIVPROC) (GLenum type, const GLuint *value); +typedef void (APIENTRYP PFNGLTEXCOORDP1UIPROC) (GLenum type, GLuint coords); +typedef void (APIENTRYP PFNGLTEXCOORDP1UIVPROC) (GLenum type, const GLuint *coords); +typedef void (APIENTRYP PFNGLTEXCOORDP2UIPROC) (GLenum type, GLuint coords); +typedef void (APIENTRYP PFNGLTEXCOORDP2UIVPROC) (GLenum type, const GLuint *coords); +typedef void (APIENTRYP PFNGLTEXCOORDP3UIPROC) (GLenum type, GLuint coords); +typedef void (APIENTRYP PFNGLTEXCOORDP3UIVPROC) (GLenum type, const GLuint *coords); +typedef void (APIENTRYP PFNGLTEXCOORDP4UIPROC) (GLenum type, GLuint coords); +typedef void (APIENTRYP PFNGLTEXCOORDP4UIVPROC) (GLenum type, const GLuint *coords); +typedef void (APIENTRYP PFNGLMULTITEXCOORDP1UIPROC) (GLenum texture, GLenum type, GLuint coords); +typedef void (APIENTRYP PFNGLMULTITEXCOORDP1UIVPROC) (GLenum texture, GLenum type, const GLuint *coords); +typedef void (APIENTRYP PFNGLMULTITEXCOORDP2UIPROC) (GLenum texture, GLenum type, GLuint coords); +typedef void (APIENTRYP PFNGLMULTITEXCOORDP2UIVPROC) (GLenum texture, GLenum type, const GLuint *coords); +typedef void (APIENTRYP PFNGLMULTITEXCOORDP3UIPROC) (GLenum texture, GLenum type, GLuint coords); +typedef void (APIENTRYP PFNGLMULTITEXCOORDP3UIVPROC) (GLenum texture, GLenum type, const GLuint *coords); +typedef void (APIENTRYP PFNGLMULTITEXCOORDP4UIPROC) (GLenum texture, GLenum type, GLuint coords); +typedef void (APIENTRYP PFNGLMULTITEXCOORDP4UIVPROC) (GLenum texture, GLenum type, const GLuint *coords); +typedef void (APIENTRYP PFNGLNORMALP3UIPROC) (GLenum type, GLuint coords); +typedef void (APIENTRYP PFNGLNORMALP3UIVPROC) (GLenum type, const GLuint *coords); +typedef void (APIENTRYP PFNGLCOLORP3UIPROC) (GLenum type, GLuint color); +typedef void (APIENTRYP PFNGLCOLORP3UIVPROC) (GLenum type, const GLuint *color); +typedef void (APIENTRYP PFNGLCOLORP4UIPROC) (GLenum type, GLuint color); +typedef void (APIENTRYP PFNGLCOLORP4UIVPROC) (GLenum type, const GLuint *color); +typedef void (APIENTRYP PFNGLSECONDARYCOLORP3UIPROC) (GLenum type, GLuint color); +typedef void (APIENTRYP PFNGLSECONDARYCOLORP3UIVPROC) (GLenum type, const GLuint *color); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBindFragDataLocationIndexed (GLuint program, GLuint colorNumber, GLuint index, const GLchar *name); +GLAPI GLint APIENTRY glGetFragDataIndex (GLuint program, const GLchar *name); +GLAPI void APIENTRY glGenSamplers (GLsizei count, GLuint *samplers); +GLAPI void APIENTRY glDeleteSamplers (GLsizei count, const GLuint *samplers); +GLAPI GLboolean APIENTRY glIsSampler (GLuint sampler); +GLAPI void APIENTRY glBindSampler (GLuint unit, GLuint sampler); +GLAPI void APIENTRY glSamplerParameteri (GLuint sampler, GLenum pname, GLint param); +GLAPI void APIENTRY glSamplerParameteriv (GLuint sampler, GLenum pname, const GLint *param); +GLAPI void APIENTRY glSamplerParameterf (GLuint sampler, GLenum pname, GLfloat param); +GLAPI void APIENTRY glSamplerParameterfv (GLuint sampler, GLenum pname, const GLfloat *param); +GLAPI void APIENTRY glSamplerParameterIiv (GLuint sampler, GLenum pname, const GLint *param); +GLAPI void APIENTRY glSamplerParameterIuiv (GLuint sampler, GLenum pname, const GLuint *param); +GLAPI void APIENTRY glGetSamplerParameteriv (GLuint sampler, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetSamplerParameterIiv (GLuint sampler, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetSamplerParameterfv (GLuint sampler, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetSamplerParameterIuiv (GLuint sampler, GLenum pname, GLuint *params); +GLAPI void APIENTRY glQueryCounter (GLuint id, GLenum target); +GLAPI void APIENTRY glGetQueryObjecti64v (GLuint id, GLenum pname, GLint64 *params); +GLAPI void APIENTRY glGetQueryObjectui64v (GLuint id, GLenum pname, GLuint64 *params); +GLAPI void APIENTRY glVertexAttribDivisor (GLuint index, GLuint divisor); +GLAPI void APIENTRY glVertexAttribP1ui (GLuint index, GLenum type, GLboolean normalized, GLuint value); +GLAPI void APIENTRY glVertexAttribP1uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); +GLAPI void APIENTRY glVertexAttribP2ui (GLuint index, GLenum type, GLboolean normalized, GLuint value); +GLAPI void APIENTRY glVertexAttribP2uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); +GLAPI void APIENTRY glVertexAttribP3ui (GLuint index, GLenum type, GLboolean normalized, GLuint value); +GLAPI void APIENTRY glVertexAttribP3uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); +GLAPI void APIENTRY glVertexAttribP4ui (GLuint index, GLenum type, GLboolean normalized, GLuint value); +GLAPI void APIENTRY glVertexAttribP4uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); +GLAPI void APIENTRY glVertexP2ui (GLenum type, GLuint value); +GLAPI void APIENTRY glVertexP2uiv (GLenum type, const GLuint *value); +GLAPI void APIENTRY glVertexP3ui (GLenum type, GLuint value); +GLAPI void APIENTRY glVertexP3uiv (GLenum type, const GLuint *value); +GLAPI void APIENTRY glVertexP4ui (GLenum type, GLuint value); +GLAPI void APIENTRY glVertexP4uiv (GLenum type, const GLuint *value); +GLAPI void APIENTRY glTexCoordP1ui (GLenum type, GLuint coords); +GLAPI void APIENTRY glTexCoordP1uiv (GLenum type, const GLuint *coords); +GLAPI void APIENTRY glTexCoordP2ui (GLenum type, GLuint coords); +GLAPI void APIENTRY glTexCoordP2uiv (GLenum type, const GLuint *coords); +GLAPI void APIENTRY glTexCoordP3ui (GLenum type, GLuint coords); +GLAPI void APIENTRY glTexCoordP3uiv (GLenum type, const GLuint *coords); +GLAPI void APIENTRY glTexCoordP4ui (GLenum type, GLuint coords); +GLAPI void APIENTRY glTexCoordP4uiv (GLenum type, const GLuint *coords); +GLAPI void APIENTRY glMultiTexCoordP1ui (GLenum texture, GLenum type, GLuint coords); +GLAPI void APIENTRY glMultiTexCoordP1uiv (GLenum texture, GLenum type, const GLuint *coords); +GLAPI void APIENTRY glMultiTexCoordP2ui (GLenum texture, GLenum type, GLuint coords); +GLAPI void APIENTRY glMultiTexCoordP2uiv (GLenum texture, GLenum type, const GLuint *coords); +GLAPI void APIENTRY glMultiTexCoordP3ui (GLenum texture, GLenum type, GLuint coords); +GLAPI void APIENTRY glMultiTexCoordP3uiv (GLenum texture, GLenum type, const GLuint *coords); +GLAPI void APIENTRY glMultiTexCoordP4ui (GLenum texture, GLenum type, GLuint coords); +GLAPI void APIENTRY glMultiTexCoordP4uiv (GLenum texture, GLenum type, const GLuint *coords); +GLAPI void APIENTRY glNormalP3ui (GLenum type, GLuint coords); +GLAPI void APIENTRY glNormalP3uiv (GLenum type, const GLuint *coords); +GLAPI void APIENTRY glColorP3ui (GLenum type, GLuint color); +GLAPI void APIENTRY glColorP3uiv (GLenum type, const GLuint *color); +GLAPI void APIENTRY glColorP4ui (GLenum type, GLuint color); +GLAPI void APIENTRY glColorP4uiv (GLenum type, const GLuint *color); +GLAPI void APIENTRY glSecondaryColorP3ui (GLenum type, GLuint color); +GLAPI void APIENTRY glSecondaryColorP3uiv (GLenum type, const GLuint *color); +#endif +#endif /* GL_VERSION_3_3 */ + +#ifndef GL_VERSION_4_0 +#define GL_VERSION_4_0 1 +#define GL_SAMPLE_SHADING 0x8C36 +#define GL_MIN_SAMPLE_SHADING_VALUE 0x8C37 +#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5E +#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5F +#define GL_TEXTURE_CUBE_MAP_ARRAY 0x9009 +#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY 0x900A +#define GL_PROXY_TEXTURE_CUBE_MAP_ARRAY 0x900B +#define GL_SAMPLER_CUBE_MAP_ARRAY 0x900C +#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW 0x900D +#define GL_INT_SAMPLER_CUBE_MAP_ARRAY 0x900E +#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY 0x900F +#define GL_DRAW_INDIRECT_BUFFER 0x8F3F +#define GL_DRAW_INDIRECT_BUFFER_BINDING 0x8F43 +#define GL_GEOMETRY_SHADER_INVOCATIONS 0x887F +#define GL_MAX_GEOMETRY_SHADER_INVOCATIONS 0x8E5A +#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET 0x8E5B +#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET 0x8E5C +#define GL_FRAGMENT_INTERPOLATION_OFFSET_BITS 0x8E5D +#define GL_MAX_VERTEX_STREAMS 0x8E71 +#define GL_DOUBLE_VEC2 0x8FFC +#define GL_DOUBLE_VEC3 0x8FFD +#define GL_DOUBLE_VEC4 0x8FFE +#define GL_DOUBLE_MAT2 0x8F46 +#define GL_DOUBLE_MAT3 0x8F47 +#define GL_DOUBLE_MAT4 0x8F48 +#define GL_DOUBLE_MAT2x3 0x8F49 +#define GL_DOUBLE_MAT2x4 0x8F4A +#define GL_DOUBLE_MAT3x2 0x8F4B +#define GL_DOUBLE_MAT3x4 0x8F4C +#define GL_DOUBLE_MAT4x2 0x8F4D +#define GL_DOUBLE_MAT4x3 0x8F4E +#define GL_ACTIVE_SUBROUTINES 0x8DE5 +#define GL_ACTIVE_SUBROUTINE_UNIFORMS 0x8DE6 +#define GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS 0x8E47 +#define GL_ACTIVE_SUBROUTINE_MAX_LENGTH 0x8E48 +#define GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH 0x8E49 +#define GL_MAX_SUBROUTINES 0x8DE7 +#define GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS 0x8DE8 +#define GL_NUM_COMPATIBLE_SUBROUTINES 0x8E4A +#define GL_COMPATIBLE_SUBROUTINES 0x8E4B +#define GL_PATCHES 0x000E +#define GL_PATCH_VERTICES 0x8E72 +#define GL_PATCH_DEFAULT_INNER_LEVEL 0x8E73 +#define GL_PATCH_DEFAULT_OUTER_LEVEL 0x8E74 +#define GL_TESS_CONTROL_OUTPUT_VERTICES 0x8E75 +#define GL_TESS_GEN_MODE 0x8E76 +#define GL_TESS_GEN_SPACING 0x8E77 +#define GL_TESS_GEN_VERTEX_ORDER 0x8E78 +#define GL_TESS_GEN_POINT_MODE 0x8E79 +#define GL_ISOLINES 0x8E7A +#define GL_FRACTIONAL_ODD 0x8E7B +#define GL_FRACTIONAL_EVEN 0x8E7C +#define GL_MAX_PATCH_VERTICES 0x8E7D +#define GL_MAX_TESS_GEN_LEVEL 0x8E7E +#define GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E7F +#define GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS 0x8E80 +#define GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS 0x8E81 +#define GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS 0x8E82 +#define GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS 0x8E83 +#define GL_MAX_TESS_PATCH_COMPONENTS 0x8E84 +#define GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS 0x8E85 +#define GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS 0x8E86 +#define GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS 0x8E89 +#define GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS 0x8E8A +#define GL_MAX_TESS_CONTROL_INPUT_COMPONENTS 0x886C +#define GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS 0x886D +#define GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E1E +#define GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS 0x8E1F +#define GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_CONTROL_SHADER 0x84F0 +#define GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_EVALUATION_SHADER 0x84F1 +#define GL_TESS_EVALUATION_SHADER 0x8E87 +#define GL_TESS_CONTROL_SHADER 0x8E88 +#define GL_TRANSFORM_FEEDBACK 0x8E22 +#define GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED 0x8E23 +#define GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE 0x8E24 +#define GL_TRANSFORM_FEEDBACK_BINDING 0x8E25 +#define GL_MAX_TRANSFORM_FEEDBACK_BUFFERS 0x8E70 +typedef void (APIENTRYP PFNGLMINSAMPLESHADINGPROC) (GLfloat value); +typedef void (APIENTRYP PFNGLBLENDEQUATIONIPROC) (GLuint buf, GLenum mode); +typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEIPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha); +typedef void (APIENTRYP PFNGLBLENDFUNCIPROC) (GLuint buf, GLenum src, GLenum dst); +typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEIPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +typedef void (APIENTRYP PFNGLDRAWARRAYSINDIRECTPROC) (GLenum mode, const void *indirect); +typedef void (APIENTRYP PFNGLDRAWELEMENTSINDIRECTPROC) (GLenum mode, GLenum type, const void *indirect); +typedef void (APIENTRYP PFNGLUNIFORM1DPROC) (GLint location, GLdouble x); +typedef void (APIENTRYP PFNGLUNIFORM2DPROC) (GLint location, GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLUNIFORM3DPROC) (GLint location, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLUNIFORM4DPROC) (GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLUNIFORM1DVPROC) (GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP PFNGLUNIFORM2DVPROC) (GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP PFNGLUNIFORM3DVPROC) (GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP PFNGLUNIFORM4DVPROC) (GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLGETUNIFORMDVPROC) (GLuint program, GLint location, GLdouble *params); +typedef GLint (APIENTRYP PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC) (GLuint program, GLenum shadertype, const GLchar *name); +typedef GLuint (APIENTRYP PFNGLGETSUBROUTINEINDEXPROC) (GLuint program, GLenum shadertype, const GLchar *name); +typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC) (GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values); +typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC) (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name); +typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINENAMEPROC) (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name); +typedef void (APIENTRYP PFNGLUNIFORMSUBROUTINESUIVPROC) (GLenum shadertype, GLsizei count, const GLuint *indices); +typedef void (APIENTRYP PFNGLGETUNIFORMSUBROUTINEUIVPROC) (GLenum shadertype, GLint location, GLuint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMSTAGEIVPROC) (GLuint program, GLenum shadertype, GLenum pname, GLint *values); +typedef void (APIENTRYP PFNGLPATCHPARAMETERIPROC) (GLenum pname, GLint value); +typedef void (APIENTRYP PFNGLPATCHPARAMETERFVPROC) (GLenum pname, const GLfloat *values); +typedef void (APIENTRYP PFNGLBINDTRANSFORMFEEDBACKPROC) (GLenum target, GLuint id); +typedef void (APIENTRYP PFNGLDELETETRANSFORMFEEDBACKSPROC) (GLsizei n, const GLuint *ids); +typedef void (APIENTRYP PFNGLGENTRANSFORMFEEDBACKSPROC) (GLsizei n, GLuint *ids); +typedef GLboolean (APIENTRYP PFNGLISTRANSFORMFEEDBACKPROC) (GLuint id); +typedef void (APIENTRYP PFNGLPAUSETRANSFORMFEEDBACKPROC) (void); +typedef void (APIENTRYP PFNGLRESUMETRANSFORMFEEDBACKPROC) (void); +typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKPROC) (GLenum mode, GLuint id); +typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKSTREAMPROC) (GLenum mode, GLuint id, GLuint stream); +typedef void (APIENTRYP PFNGLBEGINQUERYINDEXEDPROC) (GLenum target, GLuint index, GLuint id); +typedef void (APIENTRYP PFNGLENDQUERYINDEXEDPROC) (GLenum target, GLuint index); +typedef void (APIENTRYP PFNGLGETQUERYINDEXEDIVPROC) (GLenum target, GLuint index, GLenum pname, GLint *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMinSampleShading (GLfloat value); +GLAPI void APIENTRY glBlendEquationi (GLuint buf, GLenum mode); +GLAPI void APIENTRY glBlendEquationSeparatei (GLuint buf, GLenum modeRGB, GLenum modeAlpha); +GLAPI void APIENTRY glBlendFunci (GLuint buf, GLenum src, GLenum dst); +GLAPI void APIENTRY glBlendFuncSeparatei (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +GLAPI void APIENTRY glDrawArraysIndirect (GLenum mode, const void *indirect); +GLAPI void APIENTRY glDrawElementsIndirect (GLenum mode, GLenum type, const void *indirect); +GLAPI void APIENTRY glUniform1d (GLint location, GLdouble x); +GLAPI void APIENTRY glUniform2d (GLint location, GLdouble x, GLdouble y); +GLAPI void APIENTRY glUniform3d (GLint location, GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY glUniform4d (GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY glUniform1dv (GLint location, GLsizei count, const GLdouble *value); +GLAPI void APIENTRY glUniform2dv (GLint location, GLsizei count, const GLdouble *value); +GLAPI void APIENTRY glUniform3dv (GLint location, GLsizei count, const GLdouble *value); +GLAPI void APIENTRY glUniform4dv (GLint location, GLsizei count, const GLdouble *value); +GLAPI void APIENTRY glUniformMatrix2dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glUniformMatrix3dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glUniformMatrix4dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glUniformMatrix2x3dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glUniformMatrix2x4dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glUniformMatrix3x2dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glUniformMatrix3x4dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glUniformMatrix4x2dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glUniformMatrix4x3dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glGetUniformdv (GLuint program, GLint location, GLdouble *params); +GLAPI GLint APIENTRY glGetSubroutineUniformLocation (GLuint program, GLenum shadertype, const GLchar *name); +GLAPI GLuint APIENTRY glGetSubroutineIndex (GLuint program, GLenum shadertype, const GLchar *name); +GLAPI void APIENTRY glGetActiveSubroutineUniformiv (GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values); +GLAPI void APIENTRY glGetActiveSubroutineUniformName (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name); +GLAPI void APIENTRY glGetActiveSubroutineName (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name); +GLAPI void APIENTRY glUniformSubroutinesuiv (GLenum shadertype, GLsizei count, const GLuint *indices); +GLAPI void APIENTRY glGetUniformSubroutineuiv (GLenum shadertype, GLint location, GLuint *params); +GLAPI void APIENTRY glGetProgramStageiv (GLuint program, GLenum shadertype, GLenum pname, GLint *values); +GLAPI void APIENTRY glPatchParameteri (GLenum pname, GLint value); +GLAPI void APIENTRY glPatchParameterfv (GLenum pname, const GLfloat *values); +GLAPI void APIENTRY glBindTransformFeedback (GLenum target, GLuint id); +GLAPI void APIENTRY glDeleteTransformFeedbacks (GLsizei n, const GLuint *ids); +GLAPI void APIENTRY glGenTransformFeedbacks (GLsizei n, GLuint *ids); +GLAPI GLboolean APIENTRY glIsTransformFeedback (GLuint id); +GLAPI void APIENTRY glPauseTransformFeedback (void); +GLAPI void APIENTRY glResumeTransformFeedback (void); +GLAPI void APIENTRY glDrawTransformFeedback (GLenum mode, GLuint id); +GLAPI void APIENTRY glDrawTransformFeedbackStream (GLenum mode, GLuint id, GLuint stream); +GLAPI void APIENTRY glBeginQueryIndexed (GLenum target, GLuint index, GLuint id); +GLAPI void APIENTRY glEndQueryIndexed (GLenum target, GLuint index); +GLAPI void APIENTRY glGetQueryIndexediv (GLenum target, GLuint index, GLenum pname, GLint *params); +#endif +#endif /* GL_VERSION_4_0 */ + +#ifndef GL_VERSION_4_1 +#define GL_VERSION_4_1 1 +#define GL_FIXED 0x140C +#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A +#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B +#define GL_LOW_FLOAT 0x8DF0 +#define GL_MEDIUM_FLOAT 0x8DF1 +#define GL_HIGH_FLOAT 0x8DF2 +#define GL_LOW_INT 0x8DF3 +#define GL_MEDIUM_INT 0x8DF4 +#define GL_HIGH_INT 0x8DF5 +#define GL_SHADER_COMPILER 0x8DFA +#define GL_SHADER_BINARY_FORMATS 0x8DF8 +#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9 +#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB +#define GL_MAX_VARYING_VECTORS 0x8DFC +#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD +#define GL_RGB565 0x8D62 +#define GL_PROGRAM_BINARY_RETRIEVABLE_HINT 0x8257 +#define GL_PROGRAM_BINARY_LENGTH 0x8741 +#define GL_NUM_PROGRAM_BINARY_FORMATS 0x87FE +#define GL_PROGRAM_BINARY_FORMATS 0x87FF +#define GL_VERTEX_SHADER_BIT 0x00000001 +#define GL_FRAGMENT_SHADER_BIT 0x00000002 +#define GL_GEOMETRY_SHADER_BIT 0x00000004 +#define GL_TESS_CONTROL_SHADER_BIT 0x00000008 +#define GL_TESS_EVALUATION_SHADER_BIT 0x00000010 +#define GL_ALL_SHADER_BITS 0xFFFFFFFF +#define GL_PROGRAM_SEPARABLE 0x8258 +#define GL_ACTIVE_PROGRAM 0x8259 +#define GL_PROGRAM_PIPELINE_BINDING 0x825A +#define GL_MAX_VIEWPORTS 0x825B +#define GL_VIEWPORT_SUBPIXEL_BITS 0x825C +#define GL_VIEWPORT_BOUNDS_RANGE 0x825D +#define GL_LAYER_PROVOKING_VERTEX 0x825E +#define GL_VIEWPORT_INDEX_PROVOKING_VERTEX 0x825F +#define GL_UNDEFINED_VERTEX 0x8260 +typedef void (APIENTRYP PFNGLRELEASESHADERCOMPILERPROC) (void); +typedef void (APIENTRYP PFNGLSHADERBINARYPROC) (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length); +typedef void (APIENTRYP PFNGLGETSHADERPRECISIONFORMATPROC) (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision); +typedef void (APIENTRYP PFNGLDEPTHRANGEFPROC) (GLfloat n, GLfloat f); +typedef void (APIENTRYP PFNGLCLEARDEPTHFPROC) (GLfloat d); +typedef void (APIENTRYP PFNGLGETPROGRAMBINARYPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary); +typedef void (APIENTRYP PFNGLPROGRAMBINARYPROC) (GLuint program, GLenum binaryFormat, const void *binary, GLsizei length); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETERIPROC) (GLuint program, GLenum pname, GLint value); +typedef void (APIENTRYP PFNGLUSEPROGRAMSTAGESPROC) (GLuint pipeline, GLbitfield stages, GLuint program); +typedef void (APIENTRYP PFNGLACTIVESHADERPROGRAMPROC) (GLuint pipeline, GLuint program); +typedef GLuint (APIENTRYP PFNGLCREATESHADERPROGRAMVPROC) (GLenum type, GLsizei count, const GLchar *const*strings); +typedef void (APIENTRYP PFNGLBINDPROGRAMPIPELINEPROC) (GLuint pipeline); +typedef void (APIENTRYP PFNGLDELETEPROGRAMPIPELINESPROC) (GLsizei n, const GLuint *pipelines); +typedef void (APIENTRYP PFNGLGENPROGRAMPIPELINESPROC) (GLsizei n, GLuint *pipelines); +typedef GLboolean (APIENTRYP PFNGLISPROGRAMPIPELINEPROC) (GLuint pipeline); +typedef void (APIENTRYP PFNGLGETPROGRAMPIPELINEIVPROC) (GLuint pipeline, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IPROC) (GLuint program, GLint location, GLint v0); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FPROC) (GLuint program, GLint location, GLfloat v0); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DPROC) (GLuint program, GLint location, GLdouble v0); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIPROC) (GLuint program, GLint location, GLuint v0); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IPROC) (GLuint program, GLint location, GLint v0, GLint v1); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DPROC) (GLuint program, GLint location, GLdouble v0, GLdouble v1); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DPROC) (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DPROC) (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLVALIDATEPROGRAMPIPELINEPROC) (GLuint pipeline); +typedef void (APIENTRYP PFNGLGETPROGRAMPIPELINEINFOLOGPROC) (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL1DPROC) (GLuint index, GLdouble x); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL2DPROC) (GLuint index, GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL3DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL4DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL1DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL2DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL3DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL4DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBLPOINTERPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLDVPROC) (GLuint index, GLenum pname, GLdouble *params); +typedef void (APIENTRYP PFNGLVIEWPORTARRAYVPROC) (GLuint first, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLVIEWPORTINDEXEDFPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h); +typedef void (APIENTRYP PFNGLVIEWPORTINDEXEDFVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLSCISSORARRAYVPROC) (GLuint first, GLsizei count, const GLint *v); +typedef void (APIENTRYP PFNGLSCISSORINDEXEDPROC) (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLSCISSORINDEXEDVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLDEPTHRANGEARRAYVPROC) (GLuint first, GLsizei count, const GLdouble *v); +typedef void (APIENTRYP PFNGLDEPTHRANGEINDEXEDPROC) (GLuint index, GLdouble n, GLdouble f); +typedef void (APIENTRYP PFNGLGETFLOATI_VPROC) (GLenum target, GLuint index, GLfloat *data); +typedef void (APIENTRYP PFNGLGETDOUBLEI_VPROC) (GLenum target, GLuint index, GLdouble *data); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glReleaseShaderCompiler (void); +GLAPI void APIENTRY glShaderBinary (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length); +GLAPI void APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision); +GLAPI void APIENTRY glDepthRangef (GLfloat n, GLfloat f); +GLAPI void APIENTRY glClearDepthf (GLfloat d); +GLAPI void APIENTRY glGetProgramBinary (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary); +GLAPI void APIENTRY glProgramBinary (GLuint program, GLenum binaryFormat, const void *binary, GLsizei length); +GLAPI void APIENTRY glProgramParameteri (GLuint program, GLenum pname, GLint value); +GLAPI void APIENTRY glUseProgramStages (GLuint pipeline, GLbitfield stages, GLuint program); +GLAPI void APIENTRY glActiveShaderProgram (GLuint pipeline, GLuint program); +GLAPI GLuint APIENTRY glCreateShaderProgramv (GLenum type, GLsizei count, const GLchar *const*strings); +GLAPI void APIENTRY glBindProgramPipeline (GLuint pipeline); +GLAPI void APIENTRY glDeleteProgramPipelines (GLsizei n, const GLuint *pipelines); +GLAPI void APIENTRY glGenProgramPipelines (GLsizei n, GLuint *pipelines); +GLAPI GLboolean APIENTRY glIsProgramPipeline (GLuint pipeline); +GLAPI void APIENTRY glGetProgramPipelineiv (GLuint pipeline, GLenum pname, GLint *params); +GLAPI void APIENTRY glProgramUniform1i (GLuint program, GLint location, GLint v0); +GLAPI void APIENTRY glProgramUniform1iv (GLuint program, GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glProgramUniform1f (GLuint program, GLint location, GLfloat v0); +GLAPI void APIENTRY glProgramUniform1fv (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glProgramUniform1d (GLuint program, GLint location, GLdouble v0); +GLAPI void APIENTRY glProgramUniform1dv (GLuint program, GLint location, GLsizei count, const GLdouble *value); +GLAPI void APIENTRY glProgramUniform1ui (GLuint program, GLint location, GLuint v0); +GLAPI void APIENTRY glProgramUniform1uiv (GLuint program, GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glProgramUniform2i (GLuint program, GLint location, GLint v0, GLint v1); +GLAPI void APIENTRY glProgramUniform2iv (GLuint program, GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glProgramUniform2f (GLuint program, GLint location, GLfloat v0, GLfloat v1); +GLAPI void APIENTRY glProgramUniform2fv (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glProgramUniform2d (GLuint program, GLint location, GLdouble v0, GLdouble v1); +GLAPI void APIENTRY glProgramUniform2dv (GLuint program, GLint location, GLsizei count, const GLdouble *value); +GLAPI void APIENTRY glProgramUniform2ui (GLuint program, GLint location, GLuint v0, GLuint v1); +GLAPI void APIENTRY glProgramUniform2uiv (GLuint program, GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glProgramUniform3i (GLuint program, GLint location, GLint v0, GLint v1, GLint v2); +GLAPI void APIENTRY glProgramUniform3iv (GLuint program, GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glProgramUniform3f (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +GLAPI void APIENTRY glProgramUniform3fv (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glProgramUniform3d (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2); +GLAPI void APIENTRY glProgramUniform3dv (GLuint program, GLint location, GLsizei count, const GLdouble *value); +GLAPI void APIENTRY glProgramUniform3ui (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2); +GLAPI void APIENTRY glProgramUniform3uiv (GLuint program, GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glProgramUniform4i (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +GLAPI void APIENTRY glProgramUniform4iv (GLuint program, GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glProgramUniform4f (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +GLAPI void APIENTRY glProgramUniform4fv (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glProgramUniform4d (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3); +GLAPI void APIENTRY glProgramUniform4dv (GLuint program, GLint location, GLsizei count, const GLdouble *value); +GLAPI void APIENTRY glProgramUniform4ui (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +GLAPI void APIENTRY glProgramUniform4uiv (GLuint program, GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glProgramUniformMatrix2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix2dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix3dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix4dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix2x3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix3x2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix2x4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix4x2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix3x4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix4x3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix2x3dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix3x2dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix2x4dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix4x2dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix3x4dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix4x3dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glValidateProgramPipeline (GLuint pipeline); +GLAPI void APIENTRY glGetProgramPipelineInfoLog (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +GLAPI void APIENTRY glVertexAttribL1d (GLuint index, GLdouble x); +GLAPI void APIENTRY glVertexAttribL2d (GLuint index, GLdouble x, GLdouble y); +GLAPI void APIENTRY glVertexAttribL3d (GLuint index, GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY glVertexAttribL4d (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY glVertexAttribL1dv (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttribL2dv (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttribL3dv (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttribL4dv (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttribLPointer (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer); +GLAPI void APIENTRY glGetVertexAttribLdv (GLuint index, GLenum pname, GLdouble *params); +GLAPI void APIENTRY glViewportArrayv (GLuint first, GLsizei count, const GLfloat *v); +GLAPI void APIENTRY glViewportIndexedf (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h); +GLAPI void APIENTRY glViewportIndexedfv (GLuint index, const GLfloat *v); +GLAPI void APIENTRY glScissorArrayv (GLuint first, GLsizei count, const GLint *v); +GLAPI void APIENTRY glScissorIndexed (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height); +GLAPI void APIENTRY glScissorIndexedv (GLuint index, const GLint *v); +GLAPI void APIENTRY glDepthRangeArrayv (GLuint first, GLsizei count, const GLdouble *v); +GLAPI void APIENTRY glDepthRangeIndexed (GLuint index, GLdouble n, GLdouble f); +GLAPI void APIENTRY glGetFloati_v (GLenum target, GLuint index, GLfloat *data); +GLAPI void APIENTRY glGetDoublei_v (GLenum target, GLuint index, GLdouble *data); +#endif +#endif /* GL_VERSION_4_1 */ + +#ifndef GL_VERSION_4_2 +#define GL_VERSION_4_2 1 +#define GL_UNPACK_COMPRESSED_BLOCK_WIDTH 0x9127 +#define GL_UNPACK_COMPRESSED_BLOCK_HEIGHT 0x9128 +#define GL_UNPACK_COMPRESSED_BLOCK_DEPTH 0x9129 +#define GL_UNPACK_COMPRESSED_BLOCK_SIZE 0x912A +#define GL_PACK_COMPRESSED_BLOCK_WIDTH 0x912B +#define GL_PACK_COMPRESSED_BLOCK_HEIGHT 0x912C +#define GL_PACK_COMPRESSED_BLOCK_DEPTH 0x912D +#define GL_PACK_COMPRESSED_BLOCK_SIZE 0x912E +#define GL_NUM_SAMPLE_COUNTS 0x9380 +#define GL_MIN_MAP_BUFFER_ALIGNMENT 0x90BC +#define GL_ATOMIC_COUNTER_BUFFER 0x92C0 +#define GL_ATOMIC_COUNTER_BUFFER_BINDING 0x92C1 +#define GL_ATOMIC_COUNTER_BUFFER_START 0x92C2 +#define GL_ATOMIC_COUNTER_BUFFER_SIZE 0x92C3 +#define GL_ATOMIC_COUNTER_BUFFER_DATA_SIZE 0x92C4 +#define GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTERS 0x92C5 +#define GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTER_INDICES 0x92C6 +#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_VERTEX_SHADER 0x92C7 +#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_CONTROL_SHADER 0x92C8 +#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_EVALUATION_SHADER 0x92C9 +#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_GEOMETRY_SHADER 0x92CA +#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_FRAGMENT_SHADER 0x92CB +#define GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS 0x92CC +#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS 0x92CD +#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS 0x92CE +#define GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS 0x92CF +#define GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS 0x92D0 +#define GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS 0x92D1 +#define GL_MAX_VERTEX_ATOMIC_COUNTERS 0x92D2 +#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS 0x92D3 +#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS 0x92D4 +#define GL_MAX_GEOMETRY_ATOMIC_COUNTERS 0x92D5 +#define GL_MAX_FRAGMENT_ATOMIC_COUNTERS 0x92D6 +#define GL_MAX_COMBINED_ATOMIC_COUNTERS 0x92D7 +#define GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE 0x92D8 +#define GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS 0x92DC +#define GL_ACTIVE_ATOMIC_COUNTER_BUFFERS 0x92D9 +#define GL_UNIFORM_ATOMIC_COUNTER_BUFFER_INDEX 0x92DA +#define GL_UNSIGNED_INT_ATOMIC_COUNTER 0x92DB +#define GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT 0x00000001 +#define GL_ELEMENT_ARRAY_BARRIER_BIT 0x00000002 +#define GL_UNIFORM_BARRIER_BIT 0x00000004 +#define GL_TEXTURE_FETCH_BARRIER_BIT 0x00000008 +#define GL_SHADER_IMAGE_ACCESS_BARRIER_BIT 0x00000020 +#define GL_COMMAND_BARRIER_BIT 0x00000040 +#define GL_PIXEL_BUFFER_BARRIER_BIT 0x00000080 +#define GL_TEXTURE_UPDATE_BARRIER_BIT 0x00000100 +#define GL_BUFFER_UPDATE_BARRIER_BIT 0x00000200 +#define GL_FRAMEBUFFER_BARRIER_BIT 0x00000400 +#define GL_TRANSFORM_FEEDBACK_BARRIER_BIT 0x00000800 +#define GL_ATOMIC_COUNTER_BARRIER_BIT 0x00001000 +#define GL_ALL_BARRIER_BITS 0xFFFFFFFF +#define GL_MAX_IMAGE_UNITS 0x8F38 +#define GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS 0x8F39 +#define GL_IMAGE_BINDING_NAME 0x8F3A +#define GL_IMAGE_BINDING_LEVEL 0x8F3B +#define GL_IMAGE_BINDING_LAYERED 0x8F3C +#define GL_IMAGE_BINDING_LAYER 0x8F3D +#define GL_IMAGE_BINDING_ACCESS 0x8F3E +#define GL_IMAGE_1D 0x904C +#define GL_IMAGE_2D 0x904D +#define GL_IMAGE_3D 0x904E +#define GL_IMAGE_2D_RECT 0x904F +#define GL_IMAGE_CUBE 0x9050 +#define GL_IMAGE_BUFFER 0x9051 +#define GL_IMAGE_1D_ARRAY 0x9052 +#define GL_IMAGE_2D_ARRAY 0x9053 +#define GL_IMAGE_CUBE_MAP_ARRAY 0x9054 +#define GL_IMAGE_2D_MULTISAMPLE 0x9055 +#define GL_IMAGE_2D_MULTISAMPLE_ARRAY 0x9056 +#define GL_INT_IMAGE_1D 0x9057 +#define GL_INT_IMAGE_2D 0x9058 +#define GL_INT_IMAGE_3D 0x9059 +#define GL_INT_IMAGE_2D_RECT 0x905A +#define GL_INT_IMAGE_CUBE 0x905B +#define GL_INT_IMAGE_BUFFER 0x905C +#define GL_INT_IMAGE_1D_ARRAY 0x905D +#define GL_INT_IMAGE_2D_ARRAY 0x905E +#define GL_INT_IMAGE_CUBE_MAP_ARRAY 0x905F +#define GL_INT_IMAGE_2D_MULTISAMPLE 0x9060 +#define GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY 0x9061 +#define GL_UNSIGNED_INT_IMAGE_1D 0x9062 +#define GL_UNSIGNED_INT_IMAGE_2D 0x9063 +#define GL_UNSIGNED_INT_IMAGE_3D 0x9064 +#define GL_UNSIGNED_INT_IMAGE_2D_RECT 0x9065 +#define GL_UNSIGNED_INT_IMAGE_CUBE 0x9066 +#define GL_UNSIGNED_INT_IMAGE_BUFFER 0x9067 +#define GL_UNSIGNED_INT_IMAGE_1D_ARRAY 0x9068 +#define GL_UNSIGNED_INT_IMAGE_2D_ARRAY 0x9069 +#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY 0x906A +#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE 0x906B +#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY 0x906C +#define GL_MAX_IMAGE_SAMPLES 0x906D +#define GL_IMAGE_BINDING_FORMAT 0x906E +#define GL_IMAGE_FORMAT_COMPATIBILITY_TYPE 0x90C7 +#define GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE 0x90C8 +#define GL_IMAGE_FORMAT_COMPATIBILITY_BY_CLASS 0x90C9 +#define GL_MAX_VERTEX_IMAGE_UNIFORMS 0x90CA +#define GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS 0x90CB +#define GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS 0x90CC +#define GL_MAX_GEOMETRY_IMAGE_UNIFORMS 0x90CD +#define GL_MAX_FRAGMENT_IMAGE_UNIFORMS 0x90CE +#define GL_MAX_COMBINED_IMAGE_UNIFORMS 0x90CF +#define GL_COMPRESSED_RGBA_BPTC_UNORM 0x8E8C +#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM 0x8E8D +#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT 0x8E8E +#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT 0x8E8F +#define GL_TEXTURE_IMMUTABLE_FORMAT 0x912F +typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance); +typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance); +typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance); +typedef void (APIENTRYP PFNGLGETINTERNALFORMATIVPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params); +typedef void (APIENTRYP PFNGLGETACTIVEATOMICCOUNTERBUFFERIVPROC) (GLuint program, GLuint bufferIndex, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLBINDIMAGETEXTUREPROC) (GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format); +typedef void (APIENTRYP PFNGLMEMORYBARRIERPROC) (GLbitfield barriers); +typedef void (APIENTRYP PFNGLTEXSTORAGE1DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +typedef void (APIENTRYP PFNGLTEXSTORAGE2DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLTEXSTORAGE3DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDPROC) (GLenum mode, GLuint id, GLsizei instancecount); +typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC) (GLenum mode, GLuint id, GLuint stream, GLsizei instancecount); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawArraysInstancedBaseInstance (GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance); +GLAPI void APIENTRY glDrawElementsInstancedBaseInstance (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance); +GLAPI void APIENTRY glDrawElementsInstancedBaseVertexBaseInstance (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance); +GLAPI void APIENTRY glGetInternalformativ (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params); +GLAPI void APIENTRY glGetActiveAtomicCounterBufferiv (GLuint program, GLuint bufferIndex, GLenum pname, GLint *params); +GLAPI void APIENTRY glBindImageTexture (GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format); +GLAPI void APIENTRY glMemoryBarrier (GLbitfield barriers); +GLAPI void APIENTRY glTexStorage1D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +GLAPI void APIENTRY glTexStorage2D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI void APIENTRY glTexStorage3D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +GLAPI void APIENTRY glDrawTransformFeedbackInstanced (GLenum mode, GLuint id, GLsizei instancecount); +GLAPI void APIENTRY glDrawTransformFeedbackStreamInstanced (GLenum mode, GLuint id, GLuint stream, GLsizei instancecount); +#endif +#endif /* GL_VERSION_4_2 */ + +#ifndef GL_VERSION_4_3 +#define GL_VERSION_4_3 1 +typedef void (APIENTRY *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); +#define GL_NUM_SHADING_LANGUAGE_VERSIONS 0x82E9 +#define GL_VERTEX_ATTRIB_ARRAY_LONG 0x874E +#define GL_COMPRESSED_RGB8_ETC2 0x9274 +#define GL_COMPRESSED_SRGB8_ETC2 0x9275 +#define GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9276 +#define GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9277 +#define GL_COMPRESSED_RGBA8_ETC2_EAC 0x9278 +#define GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC 0x9279 +#define GL_COMPRESSED_R11_EAC 0x9270 +#define GL_COMPRESSED_SIGNED_R11_EAC 0x9271 +#define GL_COMPRESSED_RG11_EAC 0x9272 +#define GL_COMPRESSED_SIGNED_RG11_EAC 0x9273 +#define GL_PRIMITIVE_RESTART_FIXED_INDEX 0x8D69 +#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE 0x8D6A +#define GL_MAX_ELEMENT_INDEX 0x8D6B +#define GL_COMPUTE_SHADER 0x91B9 +#define GL_MAX_COMPUTE_UNIFORM_BLOCKS 0x91BB +#define GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS 0x91BC +#define GL_MAX_COMPUTE_IMAGE_UNIFORMS 0x91BD +#define GL_MAX_COMPUTE_SHARED_MEMORY_SIZE 0x8262 +#define GL_MAX_COMPUTE_UNIFORM_COMPONENTS 0x8263 +#define GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS 0x8264 +#define GL_MAX_COMPUTE_ATOMIC_COUNTERS 0x8265 +#define GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS 0x8266 +#define GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS 0x90EB +#define GL_MAX_COMPUTE_WORK_GROUP_COUNT 0x91BE +#define GL_MAX_COMPUTE_WORK_GROUP_SIZE 0x91BF +#define GL_COMPUTE_WORK_GROUP_SIZE 0x8267 +#define GL_UNIFORM_BLOCK_REFERENCED_BY_COMPUTE_SHADER 0x90EC +#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_COMPUTE_SHADER 0x90ED +#define GL_DISPATCH_INDIRECT_BUFFER 0x90EE +#define GL_DISPATCH_INDIRECT_BUFFER_BINDING 0x90EF +#define GL_DEBUG_OUTPUT_SYNCHRONOUS 0x8242 +#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH 0x8243 +#define GL_DEBUG_CALLBACK_FUNCTION 0x8244 +#define GL_DEBUG_CALLBACK_USER_PARAM 0x8245 +#define GL_DEBUG_SOURCE_API 0x8246 +#define GL_DEBUG_SOURCE_WINDOW_SYSTEM 0x8247 +#define GL_DEBUG_SOURCE_SHADER_COMPILER 0x8248 +#define GL_DEBUG_SOURCE_THIRD_PARTY 0x8249 +#define GL_DEBUG_SOURCE_APPLICATION 0x824A +#define GL_DEBUG_SOURCE_OTHER 0x824B +#define GL_DEBUG_TYPE_ERROR 0x824C +#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR 0x824D +#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR 0x824E +#define GL_DEBUG_TYPE_PORTABILITY 0x824F +#define GL_DEBUG_TYPE_PERFORMANCE 0x8250 +#define GL_DEBUG_TYPE_OTHER 0x8251 +#define GL_MAX_DEBUG_MESSAGE_LENGTH 0x9143 +#define GL_MAX_DEBUG_LOGGED_MESSAGES 0x9144 +#define GL_DEBUG_LOGGED_MESSAGES 0x9145 +#define GL_DEBUG_SEVERITY_HIGH 0x9146 +#define GL_DEBUG_SEVERITY_MEDIUM 0x9147 +#define GL_DEBUG_SEVERITY_LOW 0x9148 +#define GL_DEBUG_TYPE_MARKER 0x8268 +#define GL_DEBUG_TYPE_PUSH_GROUP 0x8269 +#define GL_DEBUG_TYPE_POP_GROUP 0x826A +#define GL_DEBUG_SEVERITY_NOTIFICATION 0x826B +#define GL_MAX_DEBUG_GROUP_STACK_DEPTH 0x826C +#define GL_DEBUG_GROUP_STACK_DEPTH 0x826D +#define GL_BUFFER 0x82E0 +#define GL_SHADER 0x82E1 +#define GL_PROGRAM 0x82E2 +#define GL_QUERY 0x82E3 +#define GL_PROGRAM_PIPELINE 0x82E4 +#define GL_SAMPLER 0x82E6 +#define GL_MAX_LABEL_LENGTH 0x82E8 +#define GL_DEBUG_OUTPUT 0x92E0 +#define GL_CONTEXT_FLAG_DEBUG_BIT 0x00000002 +#define GL_MAX_UNIFORM_LOCATIONS 0x826E +#define GL_FRAMEBUFFER_DEFAULT_WIDTH 0x9310 +#define GL_FRAMEBUFFER_DEFAULT_HEIGHT 0x9311 +#define GL_FRAMEBUFFER_DEFAULT_LAYERS 0x9312 +#define GL_FRAMEBUFFER_DEFAULT_SAMPLES 0x9313 +#define GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS 0x9314 +#define GL_MAX_FRAMEBUFFER_WIDTH 0x9315 +#define GL_MAX_FRAMEBUFFER_HEIGHT 0x9316 +#define GL_MAX_FRAMEBUFFER_LAYERS 0x9317 +#define GL_MAX_FRAMEBUFFER_SAMPLES 0x9318 +#define GL_INTERNALFORMAT_SUPPORTED 0x826F +#define GL_INTERNALFORMAT_PREFERRED 0x8270 +#define GL_INTERNALFORMAT_RED_SIZE 0x8271 +#define GL_INTERNALFORMAT_GREEN_SIZE 0x8272 +#define GL_INTERNALFORMAT_BLUE_SIZE 0x8273 +#define GL_INTERNALFORMAT_ALPHA_SIZE 0x8274 +#define GL_INTERNALFORMAT_DEPTH_SIZE 0x8275 +#define GL_INTERNALFORMAT_STENCIL_SIZE 0x8276 +#define GL_INTERNALFORMAT_SHARED_SIZE 0x8277 +#define GL_INTERNALFORMAT_RED_TYPE 0x8278 +#define GL_INTERNALFORMAT_GREEN_TYPE 0x8279 +#define GL_INTERNALFORMAT_BLUE_TYPE 0x827A +#define GL_INTERNALFORMAT_ALPHA_TYPE 0x827B +#define GL_INTERNALFORMAT_DEPTH_TYPE 0x827C +#define GL_INTERNALFORMAT_STENCIL_TYPE 0x827D +#define GL_MAX_WIDTH 0x827E +#define GL_MAX_HEIGHT 0x827F +#define GL_MAX_DEPTH 0x8280 +#define GL_MAX_LAYERS 0x8281 +#define GL_MAX_COMBINED_DIMENSIONS 0x8282 +#define GL_COLOR_COMPONENTS 0x8283 +#define GL_DEPTH_COMPONENTS 0x8284 +#define GL_STENCIL_COMPONENTS 0x8285 +#define GL_COLOR_RENDERABLE 0x8286 +#define GL_DEPTH_RENDERABLE 0x8287 +#define GL_STENCIL_RENDERABLE 0x8288 +#define GL_FRAMEBUFFER_RENDERABLE 0x8289 +#define GL_FRAMEBUFFER_RENDERABLE_LAYERED 0x828A +#define GL_FRAMEBUFFER_BLEND 0x828B +#define GL_READ_PIXELS 0x828C +#define GL_READ_PIXELS_FORMAT 0x828D +#define GL_READ_PIXELS_TYPE 0x828E +#define GL_TEXTURE_IMAGE_FORMAT 0x828F +#define GL_TEXTURE_IMAGE_TYPE 0x8290 +#define GL_GET_TEXTURE_IMAGE_FORMAT 0x8291 +#define GL_GET_TEXTURE_IMAGE_TYPE 0x8292 +#define GL_MIPMAP 0x8293 +#define GL_MANUAL_GENERATE_MIPMAP 0x8294 +#define GL_AUTO_GENERATE_MIPMAP 0x8295 +#define GL_COLOR_ENCODING 0x8296 +#define GL_SRGB_READ 0x8297 +#define GL_SRGB_WRITE 0x8298 +#define GL_FILTER 0x829A +#define GL_VERTEX_TEXTURE 0x829B +#define GL_TESS_CONTROL_TEXTURE 0x829C +#define GL_TESS_EVALUATION_TEXTURE 0x829D +#define GL_GEOMETRY_TEXTURE 0x829E +#define GL_FRAGMENT_TEXTURE 0x829F +#define GL_COMPUTE_TEXTURE 0x82A0 +#define GL_TEXTURE_SHADOW 0x82A1 +#define GL_TEXTURE_GATHER 0x82A2 +#define GL_TEXTURE_GATHER_SHADOW 0x82A3 +#define GL_SHADER_IMAGE_LOAD 0x82A4 +#define GL_SHADER_IMAGE_STORE 0x82A5 +#define GL_SHADER_IMAGE_ATOMIC 0x82A6 +#define GL_IMAGE_TEXEL_SIZE 0x82A7 +#define GL_IMAGE_COMPATIBILITY_CLASS 0x82A8 +#define GL_IMAGE_PIXEL_FORMAT 0x82A9 +#define GL_IMAGE_PIXEL_TYPE 0x82AA +#define GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_TEST 0x82AC +#define GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_TEST 0x82AD +#define GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE 0x82AE +#define GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE 0x82AF +#define GL_TEXTURE_COMPRESSED_BLOCK_WIDTH 0x82B1 +#define GL_TEXTURE_COMPRESSED_BLOCK_HEIGHT 0x82B2 +#define GL_TEXTURE_COMPRESSED_BLOCK_SIZE 0x82B3 +#define GL_CLEAR_BUFFER 0x82B4 +#define GL_TEXTURE_VIEW 0x82B5 +#define GL_VIEW_COMPATIBILITY_CLASS 0x82B6 +#define GL_FULL_SUPPORT 0x82B7 +#define GL_CAVEAT_SUPPORT 0x82B8 +#define GL_IMAGE_CLASS_4_X_32 0x82B9 +#define GL_IMAGE_CLASS_2_X_32 0x82BA +#define GL_IMAGE_CLASS_1_X_32 0x82BB +#define GL_IMAGE_CLASS_4_X_16 0x82BC +#define GL_IMAGE_CLASS_2_X_16 0x82BD +#define GL_IMAGE_CLASS_1_X_16 0x82BE +#define GL_IMAGE_CLASS_4_X_8 0x82BF +#define GL_IMAGE_CLASS_2_X_8 0x82C0 +#define GL_IMAGE_CLASS_1_X_8 0x82C1 +#define GL_IMAGE_CLASS_11_11_10 0x82C2 +#define GL_IMAGE_CLASS_10_10_10_2 0x82C3 +#define GL_VIEW_CLASS_128_BITS 0x82C4 +#define GL_VIEW_CLASS_96_BITS 0x82C5 +#define GL_VIEW_CLASS_64_BITS 0x82C6 +#define GL_VIEW_CLASS_48_BITS 0x82C7 +#define GL_VIEW_CLASS_32_BITS 0x82C8 +#define GL_VIEW_CLASS_24_BITS 0x82C9 +#define GL_VIEW_CLASS_16_BITS 0x82CA +#define GL_VIEW_CLASS_8_BITS 0x82CB +#define GL_VIEW_CLASS_S3TC_DXT1_RGB 0x82CC +#define GL_VIEW_CLASS_S3TC_DXT1_RGBA 0x82CD +#define GL_VIEW_CLASS_S3TC_DXT3_RGBA 0x82CE +#define GL_VIEW_CLASS_S3TC_DXT5_RGBA 0x82CF +#define GL_VIEW_CLASS_RGTC1_RED 0x82D0 +#define GL_VIEW_CLASS_RGTC2_RG 0x82D1 +#define GL_VIEW_CLASS_BPTC_UNORM 0x82D2 +#define GL_VIEW_CLASS_BPTC_FLOAT 0x82D3 +#define GL_UNIFORM 0x92E1 +#define GL_UNIFORM_BLOCK 0x92E2 +#define GL_PROGRAM_INPUT 0x92E3 +#define GL_PROGRAM_OUTPUT 0x92E4 +#define GL_BUFFER_VARIABLE 0x92E5 +#define GL_SHADER_STORAGE_BLOCK 0x92E6 +#define GL_VERTEX_SUBROUTINE 0x92E8 +#define GL_TESS_CONTROL_SUBROUTINE 0x92E9 +#define GL_TESS_EVALUATION_SUBROUTINE 0x92EA +#define GL_GEOMETRY_SUBROUTINE 0x92EB +#define GL_FRAGMENT_SUBROUTINE 0x92EC +#define GL_COMPUTE_SUBROUTINE 0x92ED +#define GL_VERTEX_SUBROUTINE_UNIFORM 0x92EE +#define GL_TESS_CONTROL_SUBROUTINE_UNIFORM 0x92EF +#define GL_TESS_EVALUATION_SUBROUTINE_UNIFORM 0x92F0 +#define GL_GEOMETRY_SUBROUTINE_UNIFORM 0x92F1 +#define GL_FRAGMENT_SUBROUTINE_UNIFORM 0x92F2 +#define GL_COMPUTE_SUBROUTINE_UNIFORM 0x92F3 +#define GL_TRANSFORM_FEEDBACK_VARYING 0x92F4 +#define GL_ACTIVE_RESOURCES 0x92F5 +#define GL_MAX_NAME_LENGTH 0x92F6 +#define GL_MAX_NUM_ACTIVE_VARIABLES 0x92F7 +#define GL_MAX_NUM_COMPATIBLE_SUBROUTINES 0x92F8 +#define GL_NAME_LENGTH 0x92F9 +#define GL_TYPE 0x92FA +#define GL_ARRAY_SIZE 0x92FB +#define GL_OFFSET 0x92FC +#define GL_BLOCK_INDEX 0x92FD +#define GL_ARRAY_STRIDE 0x92FE +#define GL_MATRIX_STRIDE 0x92FF +#define GL_IS_ROW_MAJOR 0x9300 +#define GL_ATOMIC_COUNTER_BUFFER_INDEX 0x9301 +#define GL_BUFFER_BINDING 0x9302 +#define GL_BUFFER_DATA_SIZE 0x9303 +#define GL_NUM_ACTIVE_VARIABLES 0x9304 +#define GL_ACTIVE_VARIABLES 0x9305 +#define GL_REFERENCED_BY_VERTEX_SHADER 0x9306 +#define GL_REFERENCED_BY_TESS_CONTROL_SHADER 0x9307 +#define GL_REFERENCED_BY_TESS_EVALUATION_SHADER 0x9308 +#define GL_REFERENCED_BY_GEOMETRY_SHADER 0x9309 +#define GL_REFERENCED_BY_FRAGMENT_SHADER 0x930A +#define GL_REFERENCED_BY_COMPUTE_SHADER 0x930B +#define GL_TOP_LEVEL_ARRAY_SIZE 0x930C +#define GL_TOP_LEVEL_ARRAY_STRIDE 0x930D +#define GL_LOCATION 0x930E +#define GL_LOCATION_INDEX 0x930F +#define GL_IS_PER_PATCH 0x92E7 +#define GL_SHADER_STORAGE_BUFFER 0x90D2 +#define GL_SHADER_STORAGE_BUFFER_BINDING 0x90D3 +#define GL_SHADER_STORAGE_BUFFER_START 0x90D4 +#define GL_SHADER_STORAGE_BUFFER_SIZE 0x90D5 +#define GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS 0x90D6 +#define GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS 0x90D7 +#define GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS 0x90D8 +#define GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS 0x90D9 +#define GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS 0x90DA +#define GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS 0x90DB +#define GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS 0x90DC +#define GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS 0x90DD +#define GL_MAX_SHADER_STORAGE_BLOCK_SIZE 0x90DE +#define GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT 0x90DF +#define GL_SHADER_STORAGE_BARRIER_BIT 0x00002000 +#define GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES 0x8F39 +#define GL_DEPTH_STENCIL_TEXTURE_MODE 0x90EA +#define GL_TEXTURE_BUFFER_OFFSET 0x919D +#define GL_TEXTURE_BUFFER_SIZE 0x919E +#define GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT 0x919F +#define GL_TEXTURE_VIEW_MIN_LEVEL 0x82DB +#define GL_TEXTURE_VIEW_NUM_LEVELS 0x82DC +#define GL_TEXTURE_VIEW_MIN_LAYER 0x82DD +#define GL_TEXTURE_VIEW_NUM_LAYERS 0x82DE +#define GL_TEXTURE_IMMUTABLE_LEVELS 0x82DF +#define GL_VERTEX_ATTRIB_BINDING 0x82D4 +#define GL_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D5 +#define GL_VERTEX_BINDING_DIVISOR 0x82D6 +#define GL_VERTEX_BINDING_OFFSET 0x82D7 +#define GL_VERTEX_BINDING_STRIDE 0x82D8 +#define GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D9 +#define GL_MAX_VERTEX_ATTRIB_BINDINGS 0x82DA +#define GL_VERTEX_BINDING_BUFFER 0x8F4F +#define GL_DISPLAY_LIST 0x82E7 +typedef void (APIENTRYP PFNGLCLEARBUFFERDATAPROC) (GLenum target, GLenum internalformat, GLenum format, GLenum type, const void *data); +typedef void (APIENTRYP PFNGLCLEARBUFFERSUBDATAPROC) (GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data); +typedef void (APIENTRYP PFNGLDISPATCHCOMPUTEPROC) (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z); +typedef void (APIENTRYP PFNGLDISPATCHCOMPUTEINDIRECTPROC) (GLintptr indirect); +typedef void (APIENTRYP PFNGLCOPYIMAGESUBDATAPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth); +typedef void (APIENTRYP PFNGLFRAMEBUFFERPARAMETERIPROC) (GLenum target, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLGETFRAMEBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETINTERNALFORMATI64VPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64 *params); +typedef void (APIENTRYP PFNGLINVALIDATETEXSUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth); +typedef void (APIENTRYP PFNGLINVALIDATETEXIMAGEPROC) (GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLINVALIDATEBUFFERSUBDATAPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length); +typedef void (APIENTRYP PFNGLINVALIDATEBUFFERDATAPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLINVALIDATEFRAMEBUFFERPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments); +typedef void (APIENTRYP PFNGLINVALIDATESUBFRAMEBUFFERPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTPROC) (GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTPROC) (GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride); +typedef void (APIENTRYP PFNGLGETPROGRAMINTERFACEIVPROC) (GLuint program, GLenum programInterface, GLenum pname, GLint *params); +typedef GLuint (APIENTRYP PFNGLGETPROGRAMRESOURCEINDEXPROC) (GLuint program, GLenum programInterface, const GLchar *name); +typedef void (APIENTRYP PFNGLGETPROGRAMRESOURCENAMEPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name); +typedef void (APIENTRYP PFNGLGETPROGRAMRESOURCEIVPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params); +typedef GLint (APIENTRYP PFNGLGETPROGRAMRESOURCELOCATIONPROC) (GLuint program, GLenum programInterface, const GLchar *name); +typedef GLint (APIENTRYP PFNGLGETPROGRAMRESOURCELOCATIONINDEXPROC) (GLuint program, GLenum programInterface, const GLchar *name); +typedef void (APIENTRYP PFNGLSHADERSTORAGEBLOCKBINDINGPROC) (GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding); +typedef void (APIENTRYP PFNGLTEXBUFFERRANGEPROC) (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); +typedef void (APIENTRYP PFNGLTEXSTORAGE2DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); +typedef void (APIENTRYP PFNGLTEXSTORAGE3DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +typedef void (APIENTRYP PFNGLTEXTUREVIEWPROC) (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers); +typedef void (APIENTRYP PFNGLBINDVERTEXBUFFERPROC) (GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); +typedef void (APIENTRYP PFNGLVERTEXATTRIBFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); +typedef void (APIENTRYP PFNGLVERTEXATTRIBIFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +typedef void (APIENTRYP PFNGLVERTEXATTRIBLFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +typedef void (APIENTRYP PFNGLVERTEXATTRIBBINDINGPROC) (GLuint attribindex, GLuint bindingindex); +typedef void (APIENTRYP PFNGLVERTEXBINDINGDIVISORPROC) (GLuint bindingindex, GLuint divisor); +typedef void (APIENTRYP PFNGLDEBUGMESSAGECONTROLPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); +typedef void (APIENTRYP PFNGLDEBUGMESSAGEINSERTPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); +typedef void (APIENTRYP PFNGLDEBUGMESSAGECALLBACKPROC) (GLDEBUGPROC callback, const void *userParam); +typedef GLuint (APIENTRYP PFNGLGETDEBUGMESSAGELOGPROC) (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); +typedef void (APIENTRYP PFNGLPUSHDEBUGGROUPPROC) (GLenum source, GLuint id, GLsizei length, const GLchar *message); +typedef void (APIENTRYP PFNGLPOPDEBUGGROUPPROC) (void); +typedef void (APIENTRYP PFNGLOBJECTLABELPROC) (GLenum identifier, GLuint name, GLsizei length, const GLchar *label); +typedef void (APIENTRYP PFNGLGETOBJECTLABELPROC) (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label); +typedef void (APIENTRYP PFNGLOBJECTPTRLABELPROC) (const void *ptr, GLsizei length, const GLchar *label); +typedef void (APIENTRYP PFNGLGETOBJECTPTRLABELPROC) (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glClearBufferData (GLenum target, GLenum internalformat, GLenum format, GLenum type, const void *data); +GLAPI void APIENTRY glClearBufferSubData (GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data); +GLAPI void APIENTRY glDispatchCompute (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z); +GLAPI void APIENTRY glDispatchComputeIndirect (GLintptr indirect); +GLAPI void APIENTRY glCopyImageSubData (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth); +GLAPI void APIENTRY glFramebufferParameteri (GLenum target, GLenum pname, GLint param); +GLAPI void APIENTRY glGetFramebufferParameteriv (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetInternalformati64v (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64 *params); +GLAPI void APIENTRY glInvalidateTexSubImage (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth); +GLAPI void APIENTRY glInvalidateTexImage (GLuint texture, GLint level); +GLAPI void APIENTRY glInvalidateBufferSubData (GLuint buffer, GLintptr offset, GLsizeiptr length); +GLAPI void APIENTRY glInvalidateBufferData (GLuint buffer); +GLAPI void APIENTRY glInvalidateFramebuffer (GLenum target, GLsizei numAttachments, const GLenum *attachments); +GLAPI void APIENTRY glInvalidateSubFramebuffer (GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void APIENTRY glMultiDrawArraysIndirect (GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride); +GLAPI void APIENTRY glMultiDrawElementsIndirect (GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride); +GLAPI void APIENTRY glGetProgramInterfaceiv (GLuint program, GLenum programInterface, GLenum pname, GLint *params); +GLAPI GLuint APIENTRY glGetProgramResourceIndex (GLuint program, GLenum programInterface, const GLchar *name); +GLAPI void APIENTRY glGetProgramResourceName (GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name); +GLAPI void APIENTRY glGetProgramResourceiv (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params); +GLAPI GLint APIENTRY glGetProgramResourceLocation (GLuint program, GLenum programInterface, const GLchar *name); +GLAPI GLint APIENTRY glGetProgramResourceLocationIndex (GLuint program, GLenum programInterface, const GLchar *name); +GLAPI void APIENTRY glShaderStorageBlockBinding (GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding); +GLAPI void APIENTRY glTexBufferRange (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); +GLAPI void APIENTRY glTexStorage2DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); +GLAPI void APIENTRY glTexStorage3DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +GLAPI void APIENTRY glTextureView (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers); +GLAPI void APIENTRY glBindVertexBuffer (GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); +GLAPI void APIENTRY glVertexAttribFormat (GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); +GLAPI void APIENTRY glVertexAttribIFormat (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +GLAPI void APIENTRY glVertexAttribLFormat (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +GLAPI void APIENTRY glVertexAttribBinding (GLuint attribindex, GLuint bindingindex); +GLAPI void APIENTRY glVertexBindingDivisor (GLuint bindingindex, GLuint divisor); +GLAPI void APIENTRY glDebugMessageControl (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); +GLAPI void APIENTRY glDebugMessageInsert (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); +GLAPI void APIENTRY glDebugMessageCallback (GLDEBUGPROC callback, const void *userParam); +GLAPI GLuint APIENTRY glGetDebugMessageLog (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); +GLAPI void APIENTRY glPushDebugGroup (GLenum source, GLuint id, GLsizei length, const GLchar *message); +GLAPI void APIENTRY glPopDebugGroup (void); +GLAPI void APIENTRY glObjectLabel (GLenum identifier, GLuint name, GLsizei length, const GLchar *label); +GLAPI void APIENTRY glGetObjectLabel (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label); +GLAPI void APIENTRY glObjectPtrLabel (const void *ptr, GLsizei length, const GLchar *label); +GLAPI void APIENTRY glGetObjectPtrLabel (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label); +#endif +#endif /* GL_VERSION_4_3 */ + +#ifndef GL_VERSION_4_4 +#define GL_VERSION_4_4 1 +#define GL_MAX_VERTEX_ATTRIB_STRIDE 0x82E5 +#define GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED 0x8221 +#define GL_TEXTURE_BUFFER_BINDING 0x8C2A +#define GL_MAP_PERSISTENT_BIT 0x0040 +#define GL_MAP_COHERENT_BIT 0x0080 +#define GL_DYNAMIC_STORAGE_BIT 0x0100 +#define GL_CLIENT_STORAGE_BIT 0x0200 +#define GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT 0x00004000 +#define GL_BUFFER_IMMUTABLE_STORAGE 0x821F +#define GL_BUFFER_STORAGE_FLAGS 0x8220 +#define GL_CLEAR_TEXTURE 0x9365 +#define GL_LOCATION_COMPONENT 0x934A +#define GL_TRANSFORM_FEEDBACK_BUFFER_INDEX 0x934B +#define GL_TRANSFORM_FEEDBACK_BUFFER_STRIDE 0x934C +#define GL_QUERY_BUFFER 0x9192 +#define GL_QUERY_BUFFER_BARRIER_BIT 0x00008000 +#define GL_QUERY_BUFFER_BINDING 0x9193 +#define GL_QUERY_RESULT_NO_WAIT 0x9194 +#define GL_MIRROR_CLAMP_TO_EDGE 0x8743 +typedef void (APIENTRYP PFNGLBUFFERSTORAGEPROC) (GLenum target, GLsizeiptr size, const void *data, GLbitfield flags); +typedef void (APIENTRYP PFNGLCLEARTEXIMAGEPROC) (GLuint texture, GLint level, GLenum format, GLenum type, const void *data); +typedef void (APIENTRYP PFNGLCLEARTEXSUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data); +typedef void (APIENTRYP PFNGLBINDBUFFERSBASEPROC) (GLenum target, GLuint first, GLsizei count, const GLuint *buffers); +typedef void (APIENTRYP PFNGLBINDBUFFERSRANGEPROC) (GLenum target, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizeiptr *sizes); +typedef void (APIENTRYP PFNGLBINDTEXTURESPROC) (GLuint first, GLsizei count, const GLuint *textures); +typedef void (APIENTRYP PFNGLBINDSAMPLERSPROC) (GLuint first, GLsizei count, const GLuint *samplers); +typedef void (APIENTRYP PFNGLBINDIMAGETEXTURESPROC) (GLuint first, GLsizei count, const GLuint *textures); +typedef void (APIENTRYP PFNGLBINDVERTEXBUFFERSPROC) (GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBufferStorage (GLenum target, GLsizeiptr size, const void *data, GLbitfield flags); +GLAPI void APIENTRY glClearTexImage (GLuint texture, GLint level, GLenum format, GLenum type, const void *data); +GLAPI void APIENTRY glClearTexSubImage (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data); +GLAPI void APIENTRY glBindBuffersBase (GLenum target, GLuint first, GLsizei count, const GLuint *buffers); +GLAPI void APIENTRY glBindBuffersRange (GLenum target, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizeiptr *sizes); +GLAPI void APIENTRY glBindTextures (GLuint first, GLsizei count, const GLuint *textures); +GLAPI void APIENTRY glBindSamplers (GLuint first, GLsizei count, const GLuint *samplers); +GLAPI void APIENTRY glBindImageTextures (GLuint first, GLsizei count, const GLuint *textures); +GLAPI void APIENTRY glBindVertexBuffers (GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides); +#endif +#endif /* GL_VERSION_4_4 */ + +#ifndef GL_ARB_ES2_compatibility +#define GL_ARB_ES2_compatibility 1 +#endif /* GL_ARB_ES2_compatibility */ + +#ifndef GL_ARB_ES3_compatibility +#define GL_ARB_ES3_compatibility 1 +#endif /* GL_ARB_ES3_compatibility */ + +#ifndef GL_ARB_arrays_of_arrays +#define GL_ARB_arrays_of_arrays 1 +#endif /* GL_ARB_arrays_of_arrays */ + +#ifndef GL_ARB_base_instance +#define GL_ARB_base_instance 1 +#endif /* GL_ARB_base_instance */ + +#ifndef GL_ARB_bindless_texture +#define GL_ARB_bindless_texture 1 +typedef uint64_t GLuint64EXT; +#define GL_UNSIGNED_INT64_ARB 0x140F +typedef GLuint64 (APIENTRYP PFNGLGETTEXTUREHANDLEARBPROC) (GLuint texture); +typedef GLuint64 (APIENTRYP PFNGLGETTEXTURESAMPLERHANDLEARBPROC) (GLuint texture, GLuint sampler); +typedef void (APIENTRYP PFNGLMAKETEXTUREHANDLERESIDENTARBPROC) (GLuint64 handle); +typedef void (APIENTRYP PFNGLMAKETEXTUREHANDLENONRESIDENTARBPROC) (GLuint64 handle); +typedef GLuint64 (APIENTRYP PFNGLGETIMAGEHANDLEARBPROC) (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format); +typedef void (APIENTRYP PFNGLMAKEIMAGEHANDLERESIDENTARBPROC) (GLuint64 handle, GLenum access); +typedef void (APIENTRYP PFNGLMAKEIMAGEHANDLENONRESIDENTARBPROC) (GLuint64 handle); +typedef void (APIENTRYP PFNGLUNIFORMHANDLEUI64ARBPROC) (GLint location, GLuint64 value); +typedef void (APIENTRYP PFNGLUNIFORMHANDLEUI64VARBPROC) (GLint location, GLsizei count, const GLuint64 *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64ARBPROC) (GLuint program, GLint location, GLuint64 value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *values); +typedef GLboolean (APIENTRYP PFNGLISTEXTUREHANDLERESIDENTARBPROC) (GLuint64 handle); +typedef GLboolean (APIENTRYP PFNGLISIMAGEHANDLERESIDENTARBPROC) (GLuint64 handle); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL1UI64ARBPROC) (GLuint index, GLuint64EXT x); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL1UI64VARBPROC) (GLuint index, const GLuint64EXT *v); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLUI64VARBPROC) (GLuint index, GLenum pname, GLuint64EXT *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLuint64 APIENTRY glGetTextureHandleARB (GLuint texture); +GLAPI GLuint64 APIENTRY glGetTextureSamplerHandleARB (GLuint texture, GLuint sampler); +GLAPI void APIENTRY glMakeTextureHandleResidentARB (GLuint64 handle); +GLAPI void APIENTRY glMakeTextureHandleNonResidentARB (GLuint64 handle); +GLAPI GLuint64 APIENTRY glGetImageHandleARB (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format); +GLAPI void APIENTRY glMakeImageHandleResidentARB (GLuint64 handle, GLenum access); +GLAPI void APIENTRY glMakeImageHandleNonResidentARB (GLuint64 handle); +GLAPI void APIENTRY glUniformHandleui64ARB (GLint location, GLuint64 value); +GLAPI void APIENTRY glUniformHandleui64vARB (GLint location, GLsizei count, const GLuint64 *value); +GLAPI void APIENTRY glProgramUniformHandleui64ARB (GLuint program, GLint location, GLuint64 value); +GLAPI void APIENTRY glProgramUniformHandleui64vARB (GLuint program, GLint location, GLsizei count, const GLuint64 *values); +GLAPI GLboolean APIENTRY glIsTextureHandleResidentARB (GLuint64 handle); +GLAPI GLboolean APIENTRY glIsImageHandleResidentARB (GLuint64 handle); +GLAPI void APIENTRY glVertexAttribL1ui64ARB (GLuint index, GLuint64EXT x); +GLAPI void APIENTRY glVertexAttribL1ui64vARB (GLuint index, const GLuint64EXT *v); +GLAPI void APIENTRY glGetVertexAttribLui64vARB (GLuint index, GLenum pname, GLuint64EXT *params); +#endif +#endif /* GL_ARB_bindless_texture */ + +#ifndef GL_ARB_blend_func_extended +#define GL_ARB_blend_func_extended 1 +#endif /* GL_ARB_blend_func_extended */ + +#ifndef GL_ARB_buffer_storage +#define GL_ARB_buffer_storage 1 +#endif /* GL_ARB_buffer_storage */ + +#ifndef GL_ARB_cl_event +#define GL_ARB_cl_event 1 +struct _cl_context; +struct _cl_event; +#define GL_SYNC_CL_EVENT_ARB 0x8240 +#define GL_SYNC_CL_EVENT_COMPLETE_ARB 0x8241 +typedef GLsync (APIENTRYP PFNGLCREATESYNCFROMCLEVENTARBPROC) (struct _cl_context *context, struct _cl_event *event, GLbitfield flags); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLsync APIENTRY glCreateSyncFromCLeventARB (struct _cl_context *context, struct _cl_event *event, GLbitfield flags); +#endif +#endif /* GL_ARB_cl_event */ + +#ifndef GL_ARB_clear_buffer_object +#define GL_ARB_clear_buffer_object 1 +#endif /* GL_ARB_clear_buffer_object */ + +#ifndef GL_ARB_clear_texture +#define GL_ARB_clear_texture 1 +#endif /* GL_ARB_clear_texture */ + +#ifndef GL_ARB_color_buffer_float +#define GL_ARB_color_buffer_float 1 +#define GL_RGBA_FLOAT_MODE_ARB 0x8820 +#define GL_CLAMP_VERTEX_COLOR_ARB 0x891A +#define GL_CLAMP_FRAGMENT_COLOR_ARB 0x891B +#define GL_CLAMP_READ_COLOR_ARB 0x891C +#define GL_FIXED_ONLY_ARB 0x891D +typedef void (APIENTRYP PFNGLCLAMPCOLORARBPROC) (GLenum target, GLenum clamp); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glClampColorARB (GLenum target, GLenum clamp); +#endif +#endif /* GL_ARB_color_buffer_float */ + +#ifndef GL_ARB_compatibility +#define GL_ARB_compatibility 1 +#endif /* GL_ARB_compatibility */ + +#ifndef GL_ARB_compressed_texture_pixel_storage +#define GL_ARB_compressed_texture_pixel_storage 1 +#endif /* GL_ARB_compressed_texture_pixel_storage */ + +#ifndef GL_ARB_compute_shader +#define GL_ARB_compute_shader 1 +#define GL_COMPUTE_SHADER_BIT 0x00000020 +#endif /* GL_ARB_compute_shader */ + +#ifndef GL_ARB_compute_variable_group_size +#define GL_ARB_compute_variable_group_size 1 +#define GL_MAX_COMPUTE_VARIABLE_GROUP_INVOCATIONS_ARB 0x9344 +#define GL_MAX_COMPUTE_FIXED_GROUP_INVOCATIONS_ARB 0x90EB +#define GL_MAX_COMPUTE_VARIABLE_GROUP_SIZE_ARB 0x9345 +#define GL_MAX_COMPUTE_FIXED_GROUP_SIZE_ARB 0x91BF +typedef void (APIENTRYP PFNGLDISPATCHCOMPUTEGROUPSIZEARBPROC) (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z, GLuint group_size_x, GLuint group_size_y, GLuint group_size_z); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDispatchComputeGroupSizeARB (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z, GLuint group_size_x, GLuint group_size_y, GLuint group_size_z); +#endif +#endif /* GL_ARB_compute_variable_group_size */ + +#ifndef GL_ARB_conservative_depth +#define GL_ARB_conservative_depth 1 +#endif /* GL_ARB_conservative_depth */ + +#ifndef GL_ARB_copy_buffer +#define GL_ARB_copy_buffer 1 +#define GL_COPY_READ_BUFFER_BINDING 0x8F36 +#define GL_COPY_WRITE_BUFFER_BINDING 0x8F37 +#endif /* GL_ARB_copy_buffer */ + +#ifndef GL_ARB_copy_image +#define GL_ARB_copy_image 1 +#endif /* GL_ARB_copy_image */ + +#ifndef GL_ARB_debug_output +#define GL_ARB_debug_output 1 +typedef void (APIENTRY *GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); +#define GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB 0x8242 +#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_ARB 0x8243 +#define GL_DEBUG_CALLBACK_FUNCTION_ARB 0x8244 +#define GL_DEBUG_CALLBACK_USER_PARAM_ARB 0x8245 +#define GL_DEBUG_SOURCE_API_ARB 0x8246 +#define GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB 0x8247 +#define GL_DEBUG_SOURCE_SHADER_COMPILER_ARB 0x8248 +#define GL_DEBUG_SOURCE_THIRD_PARTY_ARB 0x8249 +#define GL_DEBUG_SOURCE_APPLICATION_ARB 0x824A +#define GL_DEBUG_SOURCE_OTHER_ARB 0x824B +#define GL_DEBUG_TYPE_ERROR_ARB 0x824C +#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB 0x824D +#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB 0x824E +#define GL_DEBUG_TYPE_PORTABILITY_ARB 0x824F +#define GL_DEBUG_TYPE_PERFORMANCE_ARB 0x8250 +#define GL_DEBUG_TYPE_OTHER_ARB 0x8251 +#define GL_MAX_DEBUG_MESSAGE_LENGTH_ARB 0x9143 +#define GL_MAX_DEBUG_LOGGED_MESSAGES_ARB 0x9144 +#define GL_DEBUG_LOGGED_MESSAGES_ARB 0x9145 +#define GL_DEBUG_SEVERITY_HIGH_ARB 0x9146 +#define GL_DEBUG_SEVERITY_MEDIUM_ARB 0x9147 +#define GL_DEBUG_SEVERITY_LOW_ARB 0x9148 +typedef void (APIENTRYP PFNGLDEBUGMESSAGECONTROLARBPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); +typedef void (APIENTRYP PFNGLDEBUGMESSAGEINSERTARBPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); +typedef void (APIENTRYP PFNGLDEBUGMESSAGECALLBACKARBPROC) (GLDEBUGPROCARB callback, const void *userParam); +typedef GLuint (APIENTRYP PFNGLGETDEBUGMESSAGELOGARBPROC) (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDebugMessageControlARB (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); +GLAPI void APIENTRY glDebugMessageInsertARB (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); +GLAPI void APIENTRY glDebugMessageCallbackARB (GLDEBUGPROCARB callback, const void *userParam); +GLAPI GLuint APIENTRY glGetDebugMessageLogARB (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); +#endif +#endif /* GL_ARB_debug_output */ + +#ifndef GL_ARB_depth_buffer_float +#define GL_ARB_depth_buffer_float 1 +#endif /* GL_ARB_depth_buffer_float */ + +#ifndef GL_ARB_depth_clamp +#define GL_ARB_depth_clamp 1 +#endif /* GL_ARB_depth_clamp */ + +#ifndef GL_ARB_depth_texture +#define GL_ARB_depth_texture 1 +#define GL_DEPTH_COMPONENT16_ARB 0x81A5 +#define GL_DEPTH_COMPONENT24_ARB 0x81A6 +#define GL_DEPTH_COMPONENT32_ARB 0x81A7 +#define GL_TEXTURE_DEPTH_SIZE_ARB 0x884A +#define GL_DEPTH_TEXTURE_MODE_ARB 0x884B +#endif /* GL_ARB_depth_texture */ + +#ifndef GL_ARB_draw_buffers +#define GL_ARB_draw_buffers 1 +#define GL_MAX_DRAW_BUFFERS_ARB 0x8824 +#define GL_DRAW_BUFFER0_ARB 0x8825 +#define GL_DRAW_BUFFER1_ARB 0x8826 +#define GL_DRAW_BUFFER2_ARB 0x8827 +#define GL_DRAW_BUFFER3_ARB 0x8828 +#define GL_DRAW_BUFFER4_ARB 0x8829 +#define GL_DRAW_BUFFER5_ARB 0x882A +#define GL_DRAW_BUFFER6_ARB 0x882B +#define GL_DRAW_BUFFER7_ARB 0x882C +#define GL_DRAW_BUFFER8_ARB 0x882D +#define GL_DRAW_BUFFER9_ARB 0x882E +#define GL_DRAW_BUFFER10_ARB 0x882F +#define GL_DRAW_BUFFER11_ARB 0x8830 +#define GL_DRAW_BUFFER12_ARB 0x8831 +#define GL_DRAW_BUFFER13_ARB 0x8832 +#define GL_DRAW_BUFFER14_ARB 0x8833 +#define GL_DRAW_BUFFER15_ARB 0x8834 +typedef void (APIENTRYP PFNGLDRAWBUFFERSARBPROC) (GLsizei n, const GLenum *bufs); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawBuffersARB (GLsizei n, const GLenum *bufs); +#endif +#endif /* GL_ARB_draw_buffers */ + +#ifndef GL_ARB_draw_buffers_blend +#define GL_ARB_draw_buffers_blend 1 +typedef void (APIENTRYP PFNGLBLENDEQUATIONIARBPROC) (GLuint buf, GLenum mode); +typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEIARBPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha); +typedef void (APIENTRYP PFNGLBLENDFUNCIARBPROC) (GLuint buf, GLenum src, GLenum dst); +typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEIARBPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendEquationiARB (GLuint buf, GLenum mode); +GLAPI void APIENTRY glBlendEquationSeparateiARB (GLuint buf, GLenum modeRGB, GLenum modeAlpha); +GLAPI void APIENTRY glBlendFunciARB (GLuint buf, GLenum src, GLenum dst); +GLAPI void APIENTRY glBlendFuncSeparateiARB (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +#endif +#endif /* GL_ARB_draw_buffers_blend */ + +#ifndef GL_ARB_draw_elements_base_vertex +#define GL_ARB_draw_elements_base_vertex 1 +#endif /* GL_ARB_draw_elements_base_vertex */ + +#ifndef GL_ARB_draw_indirect +#define GL_ARB_draw_indirect 1 +#endif /* GL_ARB_draw_indirect */ + +#ifndef GL_ARB_draw_instanced +#define GL_ARB_draw_instanced 1 +typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDARBPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount); +typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDARBPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawArraysInstancedARB (GLenum mode, GLint first, GLsizei count, GLsizei primcount); +GLAPI void APIENTRY glDrawElementsInstancedARB (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); +#endif +#endif /* GL_ARB_draw_instanced */ + +#ifndef GL_ARB_enhanced_layouts +#define GL_ARB_enhanced_layouts 1 +#endif /* GL_ARB_enhanced_layouts */ + +#ifndef GL_ARB_explicit_attrib_location +#define GL_ARB_explicit_attrib_location 1 +#endif /* GL_ARB_explicit_attrib_location */ + +#ifndef GL_ARB_explicit_uniform_location +#define GL_ARB_explicit_uniform_location 1 +#endif /* GL_ARB_explicit_uniform_location */ + +#ifndef GL_ARB_fragment_coord_conventions +#define GL_ARB_fragment_coord_conventions 1 +#endif /* GL_ARB_fragment_coord_conventions */ + +#ifndef GL_ARB_fragment_layer_viewport +#define GL_ARB_fragment_layer_viewport 1 +#endif /* GL_ARB_fragment_layer_viewport */ + +#ifndef GL_ARB_fragment_program +#define GL_ARB_fragment_program 1 +#define GL_FRAGMENT_PROGRAM_ARB 0x8804 +#define GL_PROGRAM_FORMAT_ASCII_ARB 0x8875 +#define GL_PROGRAM_LENGTH_ARB 0x8627 +#define GL_PROGRAM_FORMAT_ARB 0x8876 +#define GL_PROGRAM_BINDING_ARB 0x8677 +#define GL_PROGRAM_INSTRUCTIONS_ARB 0x88A0 +#define GL_MAX_PROGRAM_INSTRUCTIONS_ARB 0x88A1 +#define GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A2 +#define GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A3 +#define GL_PROGRAM_TEMPORARIES_ARB 0x88A4 +#define GL_MAX_PROGRAM_TEMPORARIES_ARB 0x88A5 +#define GL_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A6 +#define GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A7 +#define GL_PROGRAM_PARAMETERS_ARB 0x88A8 +#define GL_MAX_PROGRAM_PARAMETERS_ARB 0x88A9 +#define GL_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AA +#define GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AB +#define GL_PROGRAM_ATTRIBS_ARB 0x88AC +#define GL_MAX_PROGRAM_ATTRIBS_ARB 0x88AD +#define GL_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AE +#define GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AF +#define GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB 0x88B4 +#define GL_MAX_PROGRAM_ENV_PARAMETERS_ARB 0x88B5 +#define GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB 0x88B6 +#define GL_PROGRAM_ALU_INSTRUCTIONS_ARB 0x8805 +#define GL_PROGRAM_TEX_INSTRUCTIONS_ARB 0x8806 +#define GL_PROGRAM_TEX_INDIRECTIONS_ARB 0x8807 +#define GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x8808 +#define GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x8809 +#define GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x880A +#define GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB 0x880B +#define GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB 0x880C +#define GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB 0x880D +#define GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x880E +#define GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x880F +#define GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x8810 +#define GL_PROGRAM_STRING_ARB 0x8628 +#define GL_PROGRAM_ERROR_POSITION_ARB 0x864B +#define GL_CURRENT_MATRIX_ARB 0x8641 +#define GL_TRANSPOSE_CURRENT_MATRIX_ARB 0x88B7 +#define GL_CURRENT_MATRIX_STACK_DEPTH_ARB 0x8640 +#define GL_MAX_PROGRAM_MATRICES_ARB 0x862F +#define GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB 0x862E +#define GL_MAX_TEXTURE_COORDS_ARB 0x8871 +#define GL_MAX_TEXTURE_IMAGE_UNITS_ARB 0x8872 +#define GL_PROGRAM_ERROR_STRING_ARB 0x8874 +#define GL_MATRIX0_ARB 0x88C0 +#define GL_MATRIX1_ARB 0x88C1 +#define GL_MATRIX2_ARB 0x88C2 +#define GL_MATRIX3_ARB 0x88C3 +#define GL_MATRIX4_ARB 0x88C4 +#define GL_MATRIX5_ARB 0x88C5 +#define GL_MATRIX6_ARB 0x88C6 +#define GL_MATRIX7_ARB 0x88C7 +#define GL_MATRIX8_ARB 0x88C8 +#define GL_MATRIX9_ARB 0x88C9 +#define GL_MATRIX10_ARB 0x88CA +#define GL_MATRIX11_ARB 0x88CB +#define GL_MATRIX12_ARB 0x88CC +#define GL_MATRIX13_ARB 0x88CD +#define GL_MATRIX14_ARB 0x88CE +#define GL_MATRIX15_ARB 0x88CF +#define GL_MATRIX16_ARB 0x88D0 +#define GL_MATRIX17_ARB 0x88D1 +#define GL_MATRIX18_ARB 0x88D2 +#define GL_MATRIX19_ARB 0x88D3 +#define GL_MATRIX20_ARB 0x88D4 +#define GL_MATRIX21_ARB 0x88D5 +#define GL_MATRIX22_ARB 0x88D6 +#define GL_MATRIX23_ARB 0x88D7 +#define GL_MATRIX24_ARB 0x88D8 +#define GL_MATRIX25_ARB 0x88D9 +#define GL_MATRIX26_ARB 0x88DA +#define GL_MATRIX27_ARB 0x88DB +#define GL_MATRIX28_ARB 0x88DC +#define GL_MATRIX29_ARB 0x88DD +#define GL_MATRIX30_ARB 0x88DE +#define GL_MATRIX31_ARB 0x88DF +typedef void (APIENTRYP PFNGLPROGRAMSTRINGARBPROC) (GLenum target, GLenum format, GLsizei len, const void *string); +typedef void (APIENTRYP PFNGLBINDPROGRAMARBPROC) (GLenum target, GLuint program); +typedef void (APIENTRYP PFNGLDELETEPROGRAMSARBPROC) (GLsizei n, const GLuint *programs); +typedef void (APIENTRYP PFNGLGENPROGRAMSARBPROC) (GLsizei n, GLuint *programs); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble *params); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat *params); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble *params); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat *params); +typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble *params); +typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat *params); +typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble *params); +typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat *params); +typedef void (APIENTRYP PFNGLGETPROGRAMIVARBPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMSTRINGARBPROC) (GLenum target, GLenum pname, void *string); +typedef GLboolean (APIENTRYP PFNGLISPROGRAMARBPROC) (GLuint program); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glProgramStringARB (GLenum target, GLenum format, GLsizei len, const void *string); +GLAPI void APIENTRY glBindProgramARB (GLenum target, GLuint program); +GLAPI void APIENTRY glDeleteProgramsARB (GLsizei n, const GLuint *programs); +GLAPI void APIENTRY glGenProgramsARB (GLsizei n, GLuint *programs); +GLAPI void APIENTRY glProgramEnvParameter4dARB (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY glProgramEnvParameter4dvARB (GLenum target, GLuint index, const GLdouble *params); +GLAPI void APIENTRY glProgramEnvParameter4fARB (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void APIENTRY glProgramEnvParameter4fvARB (GLenum target, GLuint index, const GLfloat *params); +GLAPI void APIENTRY glProgramLocalParameter4dARB (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY glProgramLocalParameter4dvARB (GLenum target, GLuint index, const GLdouble *params); +GLAPI void APIENTRY glProgramLocalParameter4fARB (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void APIENTRY glProgramLocalParameter4fvARB (GLenum target, GLuint index, const GLfloat *params); +GLAPI void APIENTRY glGetProgramEnvParameterdvARB (GLenum target, GLuint index, GLdouble *params); +GLAPI void APIENTRY glGetProgramEnvParameterfvARB (GLenum target, GLuint index, GLfloat *params); +GLAPI void APIENTRY glGetProgramLocalParameterdvARB (GLenum target, GLuint index, GLdouble *params); +GLAPI void APIENTRY glGetProgramLocalParameterfvARB (GLenum target, GLuint index, GLfloat *params); +GLAPI void APIENTRY glGetProgramivARB (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetProgramStringARB (GLenum target, GLenum pname, void *string); +GLAPI GLboolean APIENTRY glIsProgramARB (GLuint program); +#endif +#endif /* GL_ARB_fragment_program */ + +#ifndef GL_ARB_fragment_program_shadow +#define GL_ARB_fragment_program_shadow 1 +#endif /* GL_ARB_fragment_program_shadow */ + +#ifndef GL_ARB_fragment_shader +#define GL_ARB_fragment_shader 1 +#define GL_FRAGMENT_SHADER_ARB 0x8B30 +#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB 0x8B49 +#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB 0x8B8B +#endif /* GL_ARB_fragment_shader */ + +#ifndef GL_ARB_framebuffer_no_attachments +#define GL_ARB_framebuffer_no_attachments 1 +#endif /* GL_ARB_framebuffer_no_attachments */ + +#ifndef GL_ARB_framebuffer_object +#define GL_ARB_framebuffer_object 1 +#endif /* GL_ARB_framebuffer_object */ + +#ifndef GL_ARB_framebuffer_sRGB +#define GL_ARB_framebuffer_sRGB 1 +#endif /* GL_ARB_framebuffer_sRGB */ + +#ifndef GL_KHR_context_flush_control +#define GL_CONTEXT_RELEASE_BEHAVIOR 0x82FB +#define GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH 0x82FC +#endif /* GL_KHR_context_flush_control */ + +#ifndef GL_ARB_geometry_shader4 +#define GL_ARB_geometry_shader4 1 +#define GL_LINES_ADJACENCY_ARB 0x000A +#define GL_LINE_STRIP_ADJACENCY_ARB 0x000B +#define GL_TRIANGLES_ADJACENCY_ARB 0x000C +#define GL_TRIANGLE_STRIP_ADJACENCY_ARB 0x000D +#define GL_PROGRAM_POINT_SIZE_ARB 0x8642 +#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB 0x8C29 +#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_ARB 0x8DA7 +#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_ARB 0x8DA8 +#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB 0x8DA9 +#define GL_GEOMETRY_SHADER_ARB 0x8DD9 +#define GL_GEOMETRY_VERTICES_OUT_ARB 0x8DDA +#define GL_GEOMETRY_INPUT_TYPE_ARB 0x8DDB +#define GL_GEOMETRY_OUTPUT_TYPE_ARB 0x8DDC +#define GL_MAX_GEOMETRY_VARYING_COMPONENTS_ARB 0x8DDD +#define GL_MAX_VERTEX_VARYING_COMPONENTS_ARB 0x8DDE +#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_ARB 0x8DDF +#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_ARB 0x8DE0 +#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB 0x8DE1 +typedef void (APIENTRYP PFNGLPROGRAMPARAMETERIARBPROC) (GLuint program, GLenum pname, GLint value); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYERARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREFACEARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glProgramParameteriARB (GLuint program, GLenum pname, GLint value); +GLAPI void APIENTRY glFramebufferTextureARB (GLenum target, GLenum attachment, GLuint texture, GLint level); +GLAPI void APIENTRY glFramebufferTextureLayerARB (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); +GLAPI void APIENTRY glFramebufferTextureFaceARB (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face); +#endif +#endif /* GL_ARB_geometry_shader4 */ + +#ifndef GL_ARB_get_program_binary +#define GL_ARB_get_program_binary 1 +#endif /* GL_ARB_get_program_binary */ + +#ifndef GL_ARB_gpu_shader5 +#define GL_ARB_gpu_shader5 1 +#endif /* GL_ARB_gpu_shader5 */ + +#ifndef GL_ARB_gpu_shader_fp64 +#define GL_ARB_gpu_shader_fp64 1 +#endif /* GL_ARB_gpu_shader_fp64 */ + +#ifndef GL_ARB_half_float_pixel +#define GL_ARB_half_float_pixel 1 +typedef unsigned short GLhalfARB; +#define GL_HALF_FLOAT_ARB 0x140B +#endif /* GL_ARB_half_float_pixel */ + +#ifndef GL_ARB_half_float_vertex +#define GL_ARB_half_float_vertex 1 +#endif /* GL_ARB_half_float_vertex */ + +#ifndef GL_ARB_imaging +#define GL_ARB_imaging 1 +#define GL_BLEND_COLOR 0x8005 +#define GL_BLEND_EQUATION 0x8009 +#define GL_CONVOLUTION_1D 0x8010 +#define GL_CONVOLUTION_2D 0x8011 +#define GL_SEPARABLE_2D 0x8012 +#define GL_CONVOLUTION_BORDER_MODE 0x8013 +#define GL_CONVOLUTION_FILTER_SCALE 0x8014 +#define GL_CONVOLUTION_FILTER_BIAS 0x8015 +#define GL_REDUCE 0x8016 +#define GL_CONVOLUTION_FORMAT 0x8017 +#define GL_CONVOLUTION_WIDTH 0x8018 +#define GL_CONVOLUTION_HEIGHT 0x8019 +#define GL_MAX_CONVOLUTION_WIDTH 0x801A +#define GL_MAX_CONVOLUTION_HEIGHT 0x801B +#define GL_POST_CONVOLUTION_RED_SCALE 0x801C +#define GL_POST_CONVOLUTION_GREEN_SCALE 0x801D +#define GL_POST_CONVOLUTION_BLUE_SCALE 0x801E +#define GL_POST_CONVOLUTION_ALPHA_SCALE 0x801F +#define GL_POST_CONVOLUTION_RED_BIAS 0x8020 +#define GL_POST_CONVOLUTION_GREEN_BIAS 0x8021 +#define GL_POST_CONVOLUTION_BLUE_BIAS 0x8022 +#define GL_POST_CONVOLUTION_ALPHA_BIAS 0x8023 +#define GL_HISTOGRAM 0x8024 +#define GL_PROXY_HISTOGRAM 0x8025 +#define GL_HISTOGRAM_WIDTH 0x8026 +#define GL_HISTOGRAM_FORMAT 0x8027 +#define GL_HISTOGRAM_RED_SIZE 0x8028 +#define GL_HISTOGRAM_GREEN_SIZE 0x8029 +#define GL_HISTOGRAM_BLUE_SIZE 0x802A +#define GL_HISTOGRAM_ALPHA_SIZE 0x802B +#define GL_HISTOGRAM_LUMINANCE_SIZE 0x802C +#define GL_HISTOGRAM_SINK 0x802D +#define GL_MINMAX 0x802E +#define GL_MINMAX_FORMAT 0x802F +#define GL_MINMAX_SINK 0x8030 +#define GL_TABLE_TOO_LARGE 0x8031 +#define GL_COLOR_MATRIX 0x80B1 +#define GL_COLOR_MATRIX_STACK_DEPTH 0x80B2 +#define GL_MAX_COLOR_MATRIX_STACK_DEPTH 0x80B3 +#define GL_POST_COLOR_MATRIX_RED_SCALE 0x80B4 +#define GL_POST_COLOR_MATRIX_GREEN_SCALE 0x80B5 +#define GL_POST_COLOR_MATRIX_BLUE_SCALE 0x80B6 +#define GL_POST_COLOR_MATRIX_ALPHA_SCALE 0x80B7 +#define GL_POST_COLOR_MATRIX_RED_BIAS 0x80B8 +#define GL_POST_COLOR_MATRIX_GREEN_BIAS 0x80B9 +#define GL_POST_COLOR_MATRIX_BLUE_BIAS 0x80BA +#define GL_POST_COLOR_MATRIX_ALPHA_BIAS 0x80BB +#define GL_COLOR_TABLE 0x80D0 +#define GL_POST_CONVOLUTION_COLOR_TABLE 0x80D1 +#define GL_POST_COLOR_MATRIX_COLOR_TABLE 0x80D2 +#define GL_PROXY_COLOR_TABLE 0x80D3 +#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE 0x80D4 +#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE 0x80D5 +#define GL_COLOR_TABLE_SCALE 0x80D6 +#define GL_COLOR_TABLE_BIAS 0x80D7 +#define GL_COLOR_TABLE_FORMAT 0x80D8 +#define GL_COLOR_TABLE_WIDTH 0x80D9 +#define GL_COLOR_TABLE_RED_SIZE 0x80DA +#define GL_COLOR_TABLE_GREEN_SIZE 0x80DB +#define GL_COLOR_TABLE_BLUE_SIZE 0x80DC +#define GL_COLOR_TABLE_ALPHA_SIZE 0x80DD +#define GL_COLOR_TABLE_LUMINANCE_SIZE 0x80DE +#define GL_COLOR_TABLE_INTENSITY_SIZE 0x80DF +#define GL_CONSTANT_BORDER 0x8151 +#define GL_REPLICATE_BORDER 0x8153 +#define GL_CONVOLUTION_BORDER_COLOR 0x8154 +typedef void (APIENTRYP PFNGLCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void *table); +typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLCOPYCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPROC) (GLenum target, GLenum format, GLenum type, void *table); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const void *data); +typedef void (APIENTRYP PFNGLCOPYCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void *image); +typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *image); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat params); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIPROC) (GLenum target, GLenum pname, GLint params); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLGETCONVOLUTIONFILTERPROC) (GLenum target, GLenum format, GLenum type, void *image); +typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETSEPARABLEFILTERPROC) (GLenum target, GLenum format, GLenum type, void *row, void *column, void *span); +typedef void (APIENTRYP PFNGLSEPARABLEFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *row, const void *column); +typedef void (APIENTRYP PFNGLGETHISTOGRAMPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, void *values); +typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETMINMAXPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, void *values); +typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLHISTOGRAMPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); +typedef void (APIENTRYP PFNGLMINMAXPROC) (GLenum target, GLenum internalformat, GLboolean sink); +typedef void (APIENTRYP PFNGLRESETHISTOGRAMPROC) (GLenum target); +typedef void (APIENTRYP PFNGLRESETMINMAXPROC) (GLenum target); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glColorTable (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void *table); +GLAPI void APIENTRY glColorTableParameterfv (GLenum target, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glColorTableParameteriv (GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY glCopyColorTable (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +GLAPI void APIENTRY glGetColorTable (GLenum target, GLenum format, GLenum type, void *table); +GLAPI void APIENTRY glGetColorTableParameterfv (GLenum target, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetColorTableParameteriv (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glColorSubTable (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const void *data); +GLAPI void APIENTRY glCopyColorSubTable (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); +GLAPI void APIENTRY glConvolutionFilter1D (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void *image); +GLAPI void APIENTRY glConvolutionFilter2D (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *image); +GLAPI void APIENTRY glConvolutionParameterf (GLenum target, GLenum pname, GLfloat params); +GLAPI void APIENTRY glConvolutionParameterfv (GLenum target, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glConvolutionParameteri (GLenum target, GLenum pname, GLint params); +GLAPI void APIENTRY glConvolutionParameteriv (GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY glCopyConvolutionFilter1D (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +GLAPI void APIENTRY glCopyConvolutionFilter2D (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void APIENTRY glGetConvolutionFilter (GLenum target, GLenum format, GLenum type, void *image); +GLAPI void APIENTRY glGetConvolutionParameterfv (GLenum target, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetConvolutionParameteriv (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetSeparableFilter (GLenum target, GLenum format, GLenum type, void *row, void *column, void *span); +GLAPI void APIENTRY glSeparableFilter2D (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *row, const void *column); +GLAPI void APIENTRY glGetHistogram (GLenum target, GLboolean reset, GLenum format, GLenum type, void *values); +GLAPI void APIENTRY glGetHistogramParameterfv (GLenum target, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetHistogramParameteriv (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetMinmax (GLenum target, GLboolean reset, GLenum format, GLenum type, void *values); +GLAPI void APIENTRY glGetMinmaxParameterfv (GLenum target, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetMinmaxParameteriv (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glHistogram (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); +GLAPI void APIENTRY glMinmax (GLenum target, GLenum internalformat, GLboolean sink); +GLAPI void APIENTRY glResetHistogram (GLenum target); +GLAPI void APIENTRY glResetMinmax (GLenum target); +#endif +#endif /* GL_ARB_imaging */ + +#ifndef GL_ARB_indirect_parameters +#define GL_ARB_indirect_parameters 1 +#define GL_PARAMETER_BUFFER_ARB 0x80EE +#define GL_PARAMETER_BUFFER_BINDING_ARB 0x80EF +typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTCOUNTARBPROC) (GLenum mode, GLintptr indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTCOUNTARBPROC) (GLenum mode, GLenum type, GLintptr indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMultiDrawArraysIndirectCountARB (GLenum mode, GLintptr indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride); +GLAPI void APIENTRY glMultiDrawElementsIndirectCountARB (GLenum mode, GLenum type, GLintptr indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride); +#endif +#endif /* GL_ARB_indirect_parameters */ + +#ifndef GL_ARB_instanced_arrays +#define GL_ARB_instanced_arrays 1 +#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB 0x88FE +typedef void (APIENTRYP PFNGLVERTEXATTRIBDIVISORARBPROC) (GLuint index, GLuint divisor); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexAttribDivisorARB (GLuint index, GLuint divisor); +#endif +#endif /* GL_ARB_instanced_arrays */ + +#ifndef GL_ARB_internalformat_query +#define GL_ARB_internalformat_query 1 +#endif /* GL_ARB_internalformat_query */ + +#ifndef GL_ARB_internalformat_query2 +#define GL_ARB_internalformat_query2 1 +#define GL_SRGB_DECODE_ARB 0x8299 +#endif /* GL_ARB_internalformat_query2 */ + +#ifndef GL_ARB_invalidate_subdata +#define GL_ARB_invalidate_subdata 1 +#endif /* GL_ARB_invalidate_subdata */ + +#ifndef GL_ARB_map_buffer_alignment +#define GL_ARB_map_buffer_alignment 1 +#endif /* GL_ARB_map_buffer_alignment */ + +#ifndef GL_ARB_map_buffer_range +#define GL_ARB_map_buffer_range 1 +#endif /* GL_ARB_map_buffer_range */ + +#ifndef GL_ARB_matrix_palette +#define GL_ARB_matrix_palette 1 +#define GL_MATRIX_PALETTE_ARB 0x8840 +#define GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB 0x8841 +#define GL_MAX_PALETTE_MATRICES_ARB 0x8842 +#define GL_CURRENT_PALETTE_MATRIX_ARB 0x8843 +#define GL_MATRIX_INDEX_ARRAY_ARB 0x8844 +#define GL_CURRENT_MATRIX_INDEX_ARB 0x8845 +#define GL_MATRIX_INDEX_ARRAY_SIZE_ARB 0x8846 +#define GL_MATRIX_INDEX_ARRAY_TYPE_ARB 0x8847 +#define GL_MATRIX_INDEX_ARRAY_STRIDE_ARB 0x8848 +#define GL_MATRIX_INDEX_ARRAY_POINTER_ARB 0x8849 +typedef void (APIENTRYP PFNGLCURRENTPALETTEMATRIXARBPROC) (GLint index); +typedef void (APIENTRYP PFNGLMATRIXINDEXUBVARBPROC) (GLint size, const GLubyte *indices); +typedef void (APIENTRYP PFNGLMATRIXINDEXUSVARBPROC) (GLint size, const GLushort *indices); +typedef void (APIENTRYP PFNGLMATRIXINDEXUIVARBPROC) (GLint size, const GLuint *indices); +typedef void (APIENTRYP PFNGLMATRIXINDEXPOINTERARBPROC) (GLint size, GLenum type, GLsizei stride, const void *pointer); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCurrentPaletteMatrixARB (GLint index); +GLAPI void APIENTRY glMatrixIndexubvARB (GLint size, const GLubyte *indices); +GLAPI void APIENTRY glMatrixIndexusvARB (GLint size, const GLushort *indices); +GLAPI void APIENTRY glMatrixIndexuivARB (GLint size, const GLuint *indices); +GLAPI void APIENTRY glMatrixIndexPointerARB (GLint size, GLenum type, GLsizei stride, const void *pointer); +#endif +#endif /* GL_ARB_matrix_palette */ + +#ifndef GL_ARB_multi_bind +#define GL_ARB_multi_bind 1 +#endif /* GL_ARB_multi_bind */ + +#ifndef GL_ARB_multi_draw_indirect +#define GL_ARB_multi_draw_indirect 1 +#endif /* GL_ARB_multi_draw_indirect */ + +#ifndef GL_ARB_multisample +#define GL_ARB_multisample 1 +#define GL_MULTISAMPLE_ARB 0x809D +#define GL_SAMPLE_ALPHA_TO_COVERAGE_ARB 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE_ARB 0x809F +#define GL_SAMPLE_COVERAGE_ARB 0x80A0 +#define GL_SAMPLE_BUFFERS_ARB 0x80A8 +#define GL_SAMPLES_ARB 0x80A9 +#define GL_SAMPLE_COVERAGE_VALUE_ARB 0x80AA +#define GL_SAMPLE_COVERAGE_INVERT_ARB 0x80AB +#define GL_MULTISAMPLE_BIT_ARB 0x20000000 +typedef void (APIENTRYP PFNGLSAMPLECOVERAGEARBPROC) (GLfloat value, GLboolean invert); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSampleCoverageARB (GLfloat value, GLboolean invert); +#endif +#endif /* GL_ARB_multisample */ + +#ifndef GL_ARB_multitexture +#define GL_ARB_multitexture 1 +#define GL_TEXTURE0_ARB 0x84C0 +#define GL_TEXTURE1_ARB 0x84C1 +#define GL_TEXTURE2_ARB 0x84C2 +#define GL_TEXTURE3_ARB 0x84C3 +#define GL_TEXTURE4_ARB 0x84C4 +#define GL_TEXTURE5_ARB 0x84C5 +#define GL_TEXTURE6_ARB 0x84C6 +#define GL_TEXTURE7_ARB 0x84C7 +#define GL_TEXTURE8_ARB 0x84C8 +#define GL_TEXTURE9_ARB 0x84C9 +#define GL_TEXTURE10_ARB 0x84CA +#define GL_TEXTURE11_ARB 0x84CB +#define GL_TEXTURE12_ARB 0x84CC +#define GL_TEXTURE13_ARB 0x84CD +#define GL_TEXTURE14_ARB 0x84CE +#define GL_TEXTURE15_ARB 0x84CF +#define GL_TEXTURE16_ARB 0x84D0 +#define GL_TEXTURE17_ARB 0x84D1 +#define GL_TEXTURE18_ARB 0x84D2 +#define GL_TEXTURE19_ARB 0x84D3 +#define GL_TEXTURE20_ARB 0x84D4 +#define GL_TEXTURE21_ARB 0x84D5 +#define GL_TEXTURE22_ARB 0x84D6 +#define GL_TEXTURE23_ARB 0x84D7 +#define GL_TEXTURE24_ARB 0x84D8 +#define GL_TEXTURE25_ARB 0x84D9 +#define GL_TEXTURE26_ARB 0x84DA +#define GL_TEXTURE27_ARB 0x84DB +#define GL_TEXTURE28_ARB 0x84DC +#define GL_TEXTURE29_ARB 0x84DD +#define GL_TEXTURE30_ARB 0x84DE +#define GL_TEXTURE31_ARB 0x84DF +#define GL_ACTIVE_TEXTURE_ARB 0x84E0 +#define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84E1 +#define GL_MAX_TEXTURE_UNITS_ARB 0x84E2 +typedef void (APIENTRYP PFNGLACTIVETEXTUREARBPROC) (GLenum texture); +typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREARBPROC) (GLenum texture); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1DARBPROC) (GLenum target, GLdouble s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1FARBPROC) (GLenum target, GLfloat s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1IARBPROC) (GLenum target, GLint s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1SARBPROC) (GLenum target, GLshort s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1SVARBPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2DARBPROC) (GLenum target, GLdouble s, GLdouble t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2FARBPROC) (GLenum target, GLfloat s, GLfloat t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2IARBPROC) (GLenum target, GLint s, GLint t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2SARBPROC) (GLenum target, GLshort s, GLshort t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2SVARBPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3IARBPROC) (GLenum target, GLint s, GLint t, GLint r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3SVARBPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4IARBPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLshort *v); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glActiveTextureARB (GLenum texture); +GLAPI void APIENTRY glClientActiveTextureARB (GLenum texture); +GLAPI void APIENTRY glMultiTexCoord1dARB (GLenum target, GLdouble s); +GLAPI void APIENTRY glMultiTexCoord1dvARB (GLenum target, const GLdouble *v); +GLAPI void APIENTRY glMultiTexCoord1fARB (GLenum target, GLfloat s); +GLAPI void APIENTRY glMultiTexCoord1fvARB (GLenum target, const GLfloat *v); +GLAPI void APIENTRY glMultiTexCoord1iARB (GLenum target, GLint s); +GLAPI void APIENTRY glMultiTexCoord1ivARB (GLenum target, const GLint *v); +GLAPI void APIENTRY glMultiTexCoord1sARB (GLenum target, GLshort s); +GLAPI void APIENTRY glMultiTexCoord1svARB (GLenum target, const GLshort *v); +GLAPI void APIENTRY glMultiTexCoord2dARB (GLenum target, GLdouble s, GLdouble t); +GLAPI void APIENTRY glMultiTexCoord2dvARB (GLenum target, const GLdouble *v); +GLAPI void APIENTRY glMultiTexCoord2fARB (GLenum target, GLfloat s, GLfloat t); +GLAPI void APIENTRY glMultiTexCoord2fvARB (GLenum target, const GLfloat *v); +GLAPI void APIENTRY glMultiTexCoord2iARB (GLenum target, GLint s, GLint t); +GLAPI void APIENTRY glMultiTexCoord2ivARB (GLenum target, const GLint *v); +GLAPI void APIENTRY glMultiTexCoord2sARB (GLenum target, GLshort s, GLshort t); +GLAPI void APIENTRY glMultiTexCoord2svARB (GLenum target, const GLshort *v); +GLAPI void APIENTRY glMultiTexCoord3dARB (GLenum target, GLdouble s, GLdouble t, GLdouble r); +GLAPI void APIENTRY glMultiTexCoord3dvARB (GLenum target, const GLdouble *v); +GLAPI void APIENTRY glMultiTexCoord3fARB (GLenum target, GLfloat s, GLfloat t, GLfloat r); +GLAPI void APIENTRY glMultiTexCoord3fvARB (GLenum target, const GLfloat *v); +GLAPI void APIENTRY glMultiTexCoord3iARB (GLenum target, GLint s, GLint t, GLint r); +GLAPI void APIENTRY glMultiTexCoord3ivARB (GLenum target, const GLint *v); +GLAPI void APIENTRY glMultiTexCoord3sARB (GLenum target, GLshort s, GLshort t, GLshort r); +GLAPI void APIENTRY glMultiTexCoord3svARB (GLenum target, const GLshort *v); +GLAPI void APIENTRY glMultiTexCoord4dARB (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); +GLAPI void APIENTRY glMultiTexCoord4dvARB (GLenum target, const GLdouble *v); +GLAPI void APIENTRY glMultiTexCoord4fARB (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +GLAPI void APIENTRY glMultiTexCoord4fvARB (GLenum target, const GLfloat *v); +GLAPI void APIENTRY glMultiTexCoord4iARB (GLenum target, GLint s, GLint t, GLint r, GLint q); +GLAPI void APIENTRY glMultiTexCoord4ivARB (GLenum target, const GLint *v); +GLAPI void APIENTRY glMultiTexCoord4sARB (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); +GLAPI void APIENTRY glMultiTexCoord4svARB (GLenum target, const GLshort *v); +#endif +#endif /* GL_ARB_multitexture */ + +#ifndef GL_ARB_occlusion_query +#define GL_ARB_occlusion_query 1 +#define GL_QUERY_COUNTER_BITS_ARB 0x8864 +#define GL_CURRENT_QUERY_ARB 0x8865 +#define GL_QUERY_RESULT_ARB 0x8866 +#define GL_QUERY_RESULT_AVAILABLE_ARB 0x8867 +#define GL_SAMPLES_PASSED_ARB 0x8914 +typedef void (APIENTRYP PFNGLGENQUERIESARBPROC) (GLsizei n, GLuint *ids); +typedef void (APIENTRYP PFNGLDELETEQUERIESARBPROC) (GLsizei n, const GLuint *ids); +typedef GLboolean (APIENTRYP PFNGLISQUERYARBPROC) (GLuint id); +typedef void (APIENTRYP PFNGLBEGINQUERYARBPROC) (GLenum target, GLuint id); +typedef void (APIENTRYP PFNGLENDQUERYARBPROC) (GLenum target); +typedef void (APIENTRYP PFNGLGETQUERYIVARBPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETQUERYOBJECTIVARBPROC) (GLuint id, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETQUERYOBJECTUIVARBPROC) (GLuint id, GLenum pname, GLuint *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGenQueriesARB (GLsizei n, GLuint *ids); +GLAPI void APIENTRY glDeleteQueriesARB (GLsizei n, const GLuint *ids); +GLAPI GLboolean APIENTRY glIsQueryARB (GLuint id); +GLAPI void APIENTRY glBeginQueryARB (GLenum target, GLuint id); +GLAPI void APIENTRY glEndQueryARB (GLenum target); +GLAPI void APIENTRY glGetQueryivARB (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetQueryObjectivARB (GLuint id, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetQueryObjectuivARB (GLuint id, GLenum pname, GLuint *params); +#endif +#endif /* GL_ARB_occlusion_query */ + +#ifndef GL_ARB_occlusion_query2 +#define GL_ARB_occlusion_query2 1 +#endif /* GL_ARB_occlusion_query2 */ + +#ifndef GL_ARB_pixel_buffer_object +#define GL_ARB_pixel_buffer_object 1 +#define GL_PIXEL_PACK_BUFFER_ARB 0x88EB +#define GL_PIXEL_UNPACK_BUFFER_ARB 0x88EC +#define GL_PIXEL_PACK_BUFFER_BINDING_ARB 0x88ED +#define GL_PIXEL_UNPACK_BUFFER_BINDING_ARB 0x88EF +#endif /* GL_ARB_pixel_buffer_object */ + +#ifndef GL_ARB_point_parameters +#define GL_ARB_point_parameters 1 +#define GL_POINT_SIZE_MIN_ARB 0x8126 +#define GL_POINT_SIZE_MAX_ARB 0x8127 +#define GL_POINT_FADE_THRESHOLD_SIZE_ARB 0x8128 +#define GL_POINT_DISTANCE_ATTENUATION_ARB 0x8129 +typedef void (APIENTRYP PFNGLPOINTPARAMETERFARBPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERFVARBPROC) (GLenum pname, const GLfloat *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPointParameterfARB (GLenum pname, GLfloat param); +GLAPI void APIENTRY glPointParameterfvARB (GLenum pname, const GLfloat *params); +#endif +#endif /* GL_ARB_point_parameters */ + +#ifndef GL_ARB_point_sprite +#define GL_ARB_point_sprite 1 +#define GL_POINT_SPRITE_ARB 0x8861 +#define GL_COORD_REPLACE_ARB 0x8862 +#endif /* GL_ARB_point_sprite */ + +#ifndef GL_ARB_program_interface_query +#define GL_ARB_program_interface_query 1 +#endif /* GL_ARB_program_interface_query */ + +#ifndef GL_ARB_provoking_vertex +#define GL_ARB_provoking_vertex 1 +#endif /* GL_ARB_provoking_vertex */ + +#ifndef GL_ARB_query_buffer_object +#define GL_ARB_query_buffer_object 1 +#endif /* GL_ARB_query_buffer_object */ + +#ifndef GL_ARB_robust_buffer_access_behavior +#define GL_ARB_robust_buffer_access_behavior 1 +#endif /* GL_ARB_robust_buffer_access_behavior */ + +#ifndef GL_ARB_robustness +#define GL_ARB_robustness 1 +#define GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB 0x00000004 +#define GL_LOSE_CONTEXT_ON_RESET_ARB 0x8252 +#define GL_GUILTY_CONTEXT_RESET_ARB 0x8253 +#define GL_INNOCENT_CONTEXT_RESET_ARB 0x8254 +#define GL_UNKNOWN_CONTEXT_RESET_ARB 0x8255 +#define GL_RESET_NOTIFICATION_STRATEGY_ARB 0x8256 +#define GL_NO_RESET_NOTIFICATION_ARB 0x8261 +typedef GLenum (APIENTRYP PFNGLGETGRAPHICSRESETSTATUSARBPROC) (void); +typedef void (APIENTRYP PFNGLGETNTEXIMAGEARBPROC) (GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *img); +typedef void (APIENTRYP PFNGLREADNPIXELSARBPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); +typedef void (APIENTRYP PFNGLGETNCOMPRESSEDTEXIMAGEARBPROC) (GLenum target, GLint lod, GLsizei bufSize, void *img); +typedef void (APIENTRYP PFNGLGETNUNIFORMFVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params); +typedef void (APIENTRYP PFNGLGETNUNIFORMIVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params); +typedef void (APIENTRYP PFNGLGETNUNIFORMUIVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLuint *params); +typedef void (APIENTRYP PFNGLGETNUNIFORMDVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLdouble *params); +typedef void (APIENTRYP PFNGLGETNMAPDVARBPROC) (GLenum target, GLenum query, GLsizei bufSize, GLdouble *v); +typedef void (APIENTRYP PFNGLGETNMAPFVARBPROC) (GLenum target, GLenum query, GLsizei bufSize, GLfloat *v); +typedef void (APIENTRYP PFNGLGETNMAPIVARBPROC) (GLenum target, GLenum query, GLsizei bufSize, GLint *v); +typedef void (APIENTRYP PFNGLGETNPIXELMAPFVARBPROC) (GLenum map, GLsizei bufSize, GLfloat *values); +typedef void (APIENTRYP PFNGLGETNPIXELMAPUIVARBPROC) (GLenum map, GLsizei bufSize, GLuint *values); +typedef void (APIENTRYP PFNGLGETNPIXELMAPUSVARBPROC) (GLenum map, GLsizei bufSize, GLushort *values); +typedef void (APIENTRYP PFNGLGETNPOLYGONSTIPPLEARBPROC) (GLsizei bufSize, GLubyte *pattern); +typedef void (APIENTRYP PFNGLGETNCOLORTABLEARBPROC) (GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *table); +typedef void (APIENTRYP PFNGLGETNCONVOLUTIONFILTERARBPROC) (GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *image); +typedef void (APIENTRYP PFNGLGETNSEPARABLEFILTERARBPROC) (GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, void *row, GLsizei columnBufSize, void *column, void *span); +typedef void (APIENTRYP PFNGLGETNHISTOGRAMARBPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void *values); +typedef void (APIENTRYP PFNGLGETNMINMAXARBPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void *values); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLenum APIENTRY glGetGraphicsResetStatusARB (void); +GLAPI void APIENTRY glGetnTexImageARB (GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *img); +GLAPI void APIENTRY glReadnPixelsARB (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); +GLAPI void APIENTRY glGetnCompressedTexImageARB (GLenum target, GLint lod, GLsizei bufSize, void *img); +GLAPI void APIENTRY glGetnUniformfvARB (GLuint program, GLint location, GLsizei bufSize, GLfloat *params); +GLAPI void APIENTRY glGetnUniformivARB (GLuint program, GLint location, GLsizei bufSize, GLint *params); +GLAPI void APIENTRY glGetnUniformuivARB (GLuint program, GLint location, GLsizei bufSize, GLuint *params); +GLAPI void APIENTRY glGetnUniformdvARB (GLuint program, GLint location, GLsizei bufSize, GLdouble *params); +GLAPI void APIENTRY glGetnMapdvARB (GLenum target, GLenum query, GLsizei bufSize, GLdouble *v); +GLAPI void APIENTRY glGetnMapfvARB (GLenum target, GLenum query, GLsizei bufSize, GLfloat *v); +GLAPI void APIENTRY glGetnMapivARB (GLenum target, GLenum query, GLsizei bufSize, GLint *v); +GLAPI void APIENTRY glGetnPixelMapfvARB (GLenum map, GLsizei bufSize, GLfloat *values); +GLAPI void APIENTRY glGetnPixelMapuivARB (GLenum map, GLsizei bufSize, GLuint *values); +GLAPI void APIENTRY glGetnPixelMapusvARB (GLenum map, GLsizei bufSize, GLushort *values); +GLAPI void APIENTRY glGetnPolygonStippleARB (GLsizei bufSize, GLubyte *pattern); +GLAPI void APIENTRY glGetnColorTableARB (GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *table); +GLAPI void APIENTRY glGetnConvolutionFilterARB (GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *image); +GLAPI void APIENTRY glGetnSeparableFilterARB (GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, void *row, GLsizei columnBufSize, void *column, void *span); +GLAPI void APIENTRY glGetnHistogramARB (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void *values); +GLAPI void APIENTRY glGetnMinmaxARB (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void *values); +#endif +#endif /* GL_ARB_robustness */ + +#ifndef GL_ARB_robustness_isolation +#define GL_ARB_robustness_isolation 1 +#endif /* GL_ARB_robustness_isolation */ + +#ifndef GL_ARB_sample_shading +#define GL_ARB_sample_shading 1 +#define GL_SAMPLE_SHADING_ARB 0x8C36 +#define GL_MIN_SAMPLE_SHADING_VALUE_ARB 0x8C37 +typedef void (APIENTRYP PFNGLMINSAMPLESHADINGARBPROC) (GLfloat value); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMinSampleShadingARB (GLfloat value); +#endif +#endif /* GL_ARB_sample_shading */ + +#ifndef GL_ARB_sampler_objects +#define GL_ARB_sampler_objects 1 +#endif /* GL_ARB_sampler_objects */ + +#ifndef GL_ARB_seamless_cube_map +#define GL_ARB_seamless_cube_map 1 +#endif /* GL_ARB_seamless_cube_map */ + +#ifndef GL_ARB_seamless_cubemap_per_texture +#define GL_ARB_seamless_cubemap_per_texture 1 +#endif /* GL_ARB_seamless_cubemap_per_texture */ + +#ifndef GL_ARB_separate_shader_objects +#define GL_ARB_separate_shader_objects 1 +#endif /* GL_ARB_separate_shader_objects */ + +#ifndef GL_ARB_shader_atomic_counters +#define GL_ARB_shader_atomic_counters 1 +#endif /* GL_ARB_shader_atomic_counters */ + +#ifndef GL_ARB_shader_bit_encoding +#define GL_ARB_shader_bit_encoding 1 +#endif /* GL_ARB_shader_bit_encoding */ + +#ifndef GL_ARB_shader_draw_parameters +#define GL_ARB_shader_draw_parameters 1 +#endif /* GL_ARB_shader_draw_parameters */ + +#ifndef GL_ARB_shader_group_vote +#define GL_ARB_shader_group_vote 1 +#endif /* GL_ARB_shader_group_vote */ + +#ifndef GL_ARB_shader_image_load_store +#define GL_ARB_shader_image_load_store 1 +#endif /* GL_ARB_shader_image_load_store */ + +#ifndef GL_ARB_shader_image_size +#define GL_ARB_shader_image_size 1 +#endif /* GL_ARB_shader_image_size */ + +#ifndef GL_ARB_shader_objects +#define GL_ARB_shader_objects 1 +#ifdef __APPLE__ +typedef void *GLhandleARB; +#else +typedef unsigned int GLhandleARB; +#endif +typedef char GLcharARB; +#define GL_PROGRAM_OBJECT_ARB 0x8B40 +#define GL_SHADER_OBJECT_ARB 0x8B48 +#define GL_OBJECT_TYPE_ARB 0x8B4E +#define GL_OBJECT_SUBTYPE_ARB 0x8B4F +#define GL_FLOAT_VEC2_ARB 0x8B50 +#define GL_FLOAT_VEC3_ARB 0x8B51 +#define GL_FLOAT_VEC4_ARB 0x8B52 +#define GL_INT_VEC2_ARB 0x8B53 +#define GL_INT_VEC3_ARB 0x8B54 +#define GL_INT_VEC4_ARB 0x8B55 +#define GL_BOOL_ARB 0x8B56 +#define GL_BOOL_VEC2_ARB 0x8B57 +#define GL_BOOL_VEC3_ARB 0x8B58 +#define GL_BOOL_VEC4_ARB 0x8B59 +#define GL_FLOAT_MAT2_ARB 0x8B5A +#define GL_FLOAT_MAT3_ARB 0x8B5B +#define GL_FLOAT_MAT4_ARB 0x8B5C +#define GL_SAMPLER_1D_ARB 0x8B5D +#define GL_SAMPLER_2D_ARB 0x8B5E +#define GL_SAMPLER_3D_ARB 0x8B5F +#define GL_SAMPLER_CUBE_ARB 0x8B60 +#define GL_SAMPLER_1D_SHADOW_ARB 0x8B61 +#define GL_SAMPLER_2D_SHADOW_ARB 0x8B62 +#define GL_SAMPLER_2D_RECT_ARB 0x8B63 +#define GL_SAMPLER_2D_RECT_SHADOW_ARB 0x8B64 +#define GL_OBJECT_DELETE_STATUS_ARB 0x8B80 +#define GL_OBJECT_COMPILE_STATUS_ARB 0x8B81 +#define GL_OBJECT_LINK_STATUS_ARB 0x8B82 +#define GL_OBJECT_VALIDATE_STATUS_ARB 0x8B83 +#define GL_OBJECT_INFO_LOG_LENGTH_ARB 0x8B84 +#define GL_OBJECT_ATTACHED_OBJECTS_ARB 0x8B85 +#define GL_OBJECT_ACTIVE_UNIFORMS_ARB 0x8B86 +#define GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB 0x8B87 +#define GL_OBJECT_SHADER_SOURCE_LENGTH_ARB 0x8B88 +typedef void (APIENTRYP PFNGLDELETEOBJECTARBPROC) (GLhandleARB obj); +typedef GLhandleARB (APIENTRYP PFNGLGETHANDLEARBPROC) (GLenum pname); +typedef void (APIENTRYP PFNGLDETACHOBJECTARBPROC) (GLhandleARB containerObj, GLhandleARB attachedObj); +typedef GLhandleARB (APIENTRYP PFNGLCREATESHADEROBJECTARBPROC) (GLenum shaderType); +typedef void (APIENTRYP PFNGLSHADERSOURCEARBPROC) (GLhandleARB shaderObj, GLsizei count, const GLcharARB **string, const GLint *length); +typedef void (APIENTRYP PFNGLCOMPILESHADERARBPROC) (GLhandleARB shaderObj); +typedef GLhandleARB (APIENTRYP PFNGLCREATEPROGRAMOBJECTARBPROC) (void); +typedef void (APIENTRYP PFNGLATTACHOBJECTARBPROC) (GLhandleARB containerObj, GLhandleARB obj); +typedef void (APIENTRYP PFNGLLINKPROGRAMARBPROC) (GLhandleARB programObj); +typedef void (APIENTRYP PFNGLUSEPROGRAMOBJECTARBPROC) (GLhandleARB programObj); +typedef void (APIENTRYP PFNGLVALIDATEPROGRAMARBPROC) (GLhandleARB programObj); +typedef void (APIENTRYP PFNGLUNIFORM1FARBPROC) (GLint location, GLfloat v0); +typedef void (APIENTRYP PFNGLUNIFORM2FARBPROC) (GLint location, GLfloat v0, GLfloat v1); +typedef void (APIENTRYP PFNGLUNIFORM3FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +typedef void (APIENTRYP PFNGLUNIFORM4FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +typedef void (APIENTRYP PFNGLUNIFORM1IARBPROC) (GLint location, GLint v0); +typedef void (APIENTRYP PFNGLUNIFORM2IARBPROC) (GLint location, GLint v0, GLint v1); +typedef void (APIENTRYP PFNGLUNIFORM3IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2); +typedef void (APIENTRYP PFNGLUNIFORM4IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +typedef void (APIENTRYP PFNGLUNIFORM1FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM2FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM3FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM4FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM1IVARBPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORM2IVARBPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORM3IVARBPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORM4IVARBPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLGETOBJECTPARAMETERFVARBPROC) (GLhandleARB obj, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETOBJECTPARAMETERIVARBPROC) (GLhandleARB obj, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETINFOLOGARBPROC) (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *infoLog); +typedef void (APIENTRYP PFNGLGETATTACHEDOBJECTSARBPROC) (GLhandleARB containerObj, GLsizei maxCount, GLsizei *count, GLhandleARB *obj); +typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB *name); +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMARBPROC) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name); +typedef void (APIENTRYP PFNGLGETUNIFORMFVARBPROC) (GLhandleARB programObj, GLint location, GLfloat *params); +typedef void (APIENTRYP PFNGLGETUNIFORMIVARBPROC) (GLhandleARB programObj, GLint location, GLint *params); +typedef void (APIENTRYP PFNGLGETSHADERSOURCEARBPROC) (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *source); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDeleteObjectARB (GLhandleARB obj); +GLAPI GLhandleARB APIENTRY glGetHandleARB (GLenum pname); +GLAPI void APIENTRY glDetachObjectARB (GLhandleARB containerObj, GLhandleARB attachedObj); +GLAPI GLhandleARB APIENTRY glCreateShaderObjectARB (GLenum shaderType); +GLAPI void APIENTRY glShaderSourceARB (GLhandleARB shaderObj, GLsizei count, const GLcharARB **string, const GLint *length); +GLAPI void APIENTRY glCompileShaderARB (GLhandleARB shaderObj); +GLAPI GLhandleARB APIENTRY glCreateProgramObjectARB (void); +GLAPI void APIENTRY glAttachObjectARB (GLhandleARB containerObj, GLhandleARB obj); +GLAPI void APIENTRY glLinkProgramARB (GLhandleARB programObj); +GLAPI void APIENTRY glUseProgramObjectARB (GLhandleARB programObj); +GLAPI void APIENTRY glValidateProgramARB (GLhandleARB programObj); +GLAPI void APIENTRY glUniform1fARB (GLint location, GLfloat v0); +GLAPI void APIENTRY glUniform2fARB (GLint location, GLfloat v0, GLfloat v1); +GLAPI void APIENTRY glUniform3fARB (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +GLAPI void APIENTRY glUniform4fARB (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +GLAPI void APIENTRY glUniform1iARB (GLint location, GLint v0); +GLAPI void APIENTRY glUniform2iARB (GLint location, GLint v0, GLint v1); +GLAPI void APIENTRY glUniform3iARB (GLint location, GLint v0, GLint v1, GLint v2); +GLAPI void APIENTRY glUniform4iARB (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +GLAPI void APIENTRY glUniform1fvARB (GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glUniform2fvARB (GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glUniform3fvARB (GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glUniform4fvARB (GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glUniform1ivARB (GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glUniform2ivARB (GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glUniform3ivARB (GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glUniform4ivARB (GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glUniformMatrix2fvARB (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glUniformMatrix3fvARB (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glUniformMatrix4fvARB (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glGetObjectParameterfvARB (GLhandleARB obj, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetObjectParameterivARB (GLhandleARB obj, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetInfoLogARB (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *infoLog); +GLAPI void APIENTRY glGetAttachedObjectsARB (GLhandleARB containerObj, GLsizei maxCount, GLsizei *count, GLhandleARB *obj); +GLAPI GLint APIENTRY glGetUniformLocationARB (GLhandleARB programObj, const GLcharARB *name); +GLAPI void APIENTRY glGetActiveUniformARB (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name); +GLAPI void APIENTRY glGetUniformfvARB (GLhandleARB programObj, GLint location, GLfloat *params); +GLAPI void APIENTRY glGetUniformivARB (GLhandleARB programObj, GLint location, GLint *params); +GLAPI void APIENTRY glGetShaderSourceARB (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *source); +#endif +#endif /* GL_ARB_shader_objects */ + +#ifndef GL_ARB_shader_precision +#define GL_ARB_shader_precision 1 +#endif /* GL_ARB_shader_precision */ + +#ifndef GL_ARB_shader_stencil_export +#define GL_ARB_shader_stencil_export 1 +#endif /* GL_ARB_shader_stencil_export */ + +#ifndef GL_ARB_shader_storage_buffer_object +#define GL_ARB_shader_storage_buffer_object 1 +#endif /* GL_ARB_shader_storage_buffer_object */ + +#ifndef GL_ARB_shader_subroutine +#define GL_ARB_shader_subroutine 1 +#endif /* GL_ARB_shader_subroutine */ + +#ifndef GL_ARB_shader_texture_lod +#define GL_ARB_shader_texture_lod 1 +#endif /* GL_ARB_shader_texture_lod */ + +#ifndef GL_ARB_shading_language_100 +#define GL_ARB_shading_language_100 1 +#define GL_SHADING_LANGUAGE_VERSION_ARB 0x8B8C +#endif /* GL_ARB_shading_language_100 */ + +#ifndef GL_ARB_shading_language_420pack +#define GL_ARB_shading_language_420pack 1 +#endif /* GL_ARB_shading_language_420pack */ + +#ifndef GL_ARB_shading_language_include +#define GL_ARB_shading_language_include 1 +#define GL_SHADER_INCLUDE_ARB 0x8DAE +#define GL_NAMED_STRING_LENGTH_ARB 0x8DE9 +#define GL_NAMED_STRING_TYPE_ARB 0x8DEA +typedef void (APIENTRYP PFNGLNAMEDSTRINGARBPROC) (GLenum type, GLint namelen, const GLchar *name, GLint stringlen, const GLchar *string); +typedef void (APIENTRYP PFNGLDELETENAMEDSTRINGARBPROC) (GLint namelen, const GLchar *name); +typedef void (APIENTRYP PFNGLCOMPILESHADERINCLUDEARBPROC) (GLuint shader, GLsizei count, const GLchar *const*path, const GLint *length); +typedef GLboolean (APIENTRYP PFNGLISNAMEDSTRINGARBPROC) (GLint namelen, const GLchar *name); +typedef void (APIENTRYP PFNGLGETNAMEDSTRINGARBPROC) (GLint namelen, const GLchar *name, GLsizei bufSize, GLint *stringlen, GLchar *string); +typedef void (APIENTRYP PFNGLGETNAMEDSTRINGIVARBPROC) (GLint namelen, const GLchar *name, GLenum pname, GLint *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glNamedStringARB (GLenum type, GLint namelen, const GLchar *name, GLint stringlen, const GLchar *string); +GLAPI void APIENTRY glDeleteNamedStringARB (GLint namelen, const GLchar *name); +GLAPI void APIENTRY glCompileShaderIncludeARB (GLuint shader, GLsizei count, const GLchar *const*path, const GLint *length); +GLAPI GLboolean APIENTRY glIsNamedStringARB (GLint namelen, const GLchar *name); +GLAPI void APIENTRY glGetNamedStringARB (GLint namelen, const GLchar *name, GLsizei bufSize, GLint *stringlen, GLchar *string); +GLAPI void APIENTRY glGetNamedStringivARB (GLint namelen, const GLchar *name, GLenum pname, GLint *params); +#endif +#endif /* GL_ARB_shading_language_include */ + +#ifndef GL_ARB_shading_language_packing +#define GL_ARB_shading_language_packing 1 +#endif /* GL_ARB_shading_language_packing */ + +#ifndef GL_ARB_shadow +#define GL_ARB_shadow 1 +#define GL_TEXTURE_COMPARE_MODE_ARB 0x884C +#define GL_TEXTURE_COMPARE_FUNC_ARB 0x884D +#define GL_COMPARE_R_TO_TEXTURE_ARB 0x884E +#endif /* GL_ARB_shadow */ + +#ifndef GL_ARB_shadow_ambient +#define GL_ARB_shadow_ambient 1 +#define GL_TEXTURE_COMPARE_FAIL_VALUE_ARB 0x80BF +#endif /* GL_ARB_shadow_ambient */ + +#ifndef GL_ARB_sparse_texture +#define GL_ARB_sparse_texture 1 +#define GL_TEXTURE_SPARSE_ARB 0x91A6 +#define GL_VIRTUAL_PAGE_SIZE_INDEX_ARB 0x91A7 +#define GL_MIN_SPARSE_LEVEL_ARB 0x919B +#define GL_NUM_VIRTUAL_PAGE_SIZES_ARB 0x91A8 +#define GL_VIRTUAL_PAGE_SIZE_X_ARB 0x9195 +#define GL_VIRTUAL_PAGE_SIZE_Y_ARB 0x9196 +#define GL_VIRTUAL_PAGE_SIZE_Z_ARB 0x9197 +#define GL_MAX_SPARSE_TEXTURE_SIZE_ARB 0x9198 +#define GL_MAX_SPARSE_3D_TEXTURE_SIZE_ARB 0x9199 +#define GL_MAX_SPARSE_ARRAY_TEXTURE_LAYERS_ARB 0x919A +#define GL_SPARSE_TEXTURE_FULL_ARRAY_CUBE_MIPMAPS_ARB 0x91A9 +typedef void (APIENTRYP PFNGLTEXPAGECOMMITMENTARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean resident); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexPageCommitmentARB (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean resident); +#endif +#endif /* GL_ARB_sparse_texture */ + +#ifndef GL_ARB_stencil_texturing +#define GL_ARB_stencil_texturing 1 +#endif /* GL_ARB_stencil_texturing */ + +#ifndef GL_ARB_sync +#define GL_ARB_sync 1 +#endif /* GL_ARB_sync */ + +#ifndef GL_ARB_tessellation_shader +#define GL_ARB_tessellation_shader 1 +#endif /* GL_ARB_tessellation_shader */ + +#ifndef GL_ARB_texture_border_clamp +#define GL_ARB_texture_border_clamp 1 +#define GL_CLAMP_TO_BORDER_ARB 0x812D +#endif /* GL_ARB_texture_border_clamp */ + +#ifndef GL_ARB_texture_buffer_object +#define GL_ARB_texture_buffer_object 1 +#define GL_TEXTURE_BUFFER_ARB 0x8C2A +#define GL_MAX_TEXTURE_BUFFER_SIZE_ARB 0x8C2B +#define GL_TEXTURE_BINDING_BUFFER_ARB 0x8C2C +#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_ARB 0x8C2D +#define GL_TEXTURE_BUFFER_FORMAT_ARB 0x8C2E +typedef void (APIENTRYP PFNGLTEXBUFFERARBPROC) (GLenum target, GLenum internalformat, GLuint buffer); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexBufferARB (GLenum target, GLenum internalformat, GLuint buffer); +#endif +#endif /* GL_ARB_texture_buffer_object */ + +#ifndef GL_ARB_texture_buffer_object_rgb32 +#define GL_ARB_texture_buffer_object_rgb32 1 +#endif /* GL_ARB_texture_buffer_object_rgb32 */ + +#ifndef GL_ARB_texture_buffer_range +#define GL_ARB_texture_buffer_range 1 +#endif /* GL_ARB_texture_buffer_range */ + +#ifndef GL_ARB_texture_compression +#define GL_ARB_texture_compression 1 +#define GL_COMPRESSED_ALPHA_ARB 0x84E9 +#define GL_COMPRESSED_LUMINANCE_ARB 0x84EA +#define GL_COMPRESSED_LUMINANCE_ALPHA_ARB 0x84EB +#define GL_COMPRESSED_INTENSITY_ARB 0x84EC +#define GL_COMPRESSED_RGB_ARB 0x84ED +#define GL_COMPRESSED_RGBA_ARB 0x84EE +#define GL_TEXTURE_COMPRESSION_HINT_ARB 0x84EF +#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB 0x86A0 +#define GL_TEXTURE_COMPRESSED_ARB 0x86A1 +#define GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A2 +#define GL_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A3 +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data); +typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEARBPROC) (GLenum target, GLint level, void *img); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCompressedTexImage3DARB (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data); +GLAPI void APIENTRY glCompressedTexImage2DARB (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data); +GLAPI void APIENTRY glCompressedTexImage1DARB (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *data); +GLAPI void APIENTRY glCompressedTexSubImage3DARB (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); +GLAPI void APIENTRY glCompressedTexSubImage2DARB (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); +GLAPI void APIENTRY glCompressedTexSubImage1DARB (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data); +GLAPI void APIENTRY glGetCompressedTexImageARB (GLenum target, GLint level, void *img); +#endif +#endif /* GL_ARB_texture_compression */ + +#ifndef GL_ARB_texture_compression_bptc +#define GL_ARB_texture_compression_bptc 1 +#define GL_COMPRESSED_RGBA_BPTC_UNORM_ARB 0x8E8C +#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB 0x8E8D +#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB 0x8E8E +#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB 0x8E8F +#endif /* GL_ARB_texture_compression_bptc */ + +#ifndef GL_ARB_texture_compression_rgtc +#define GL_ARB_texture_compression_rgtc 1 +#endif /* GL_ARB_texture_compression_rgtc */ + +#ifndef GL_ARB_texture_cube_map +#define GL_ARB_texture_cube_map 1 +#define GL_NORMAL_MAP_ARB 0x8511 +#define GL_REFLECTION_MAP_ARB 0x8512 +#define GL_TEXTURE_CUBE_MAP_ARB 0x8513 +#define GL_TEXTURE_BINDING_CUBE_MAP_ARB 0x8514 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x8515 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x8516 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x8517 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x8518 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x8519 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x851A +#define GL_PROXY_TEXTURE_CUBE_MAP_ARB 0x851B +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB 0x851C +#endif /* GL_ARB_texture_cube_map */ + +#ifndef GL_ARB_texture_cube_map_array +#define GL_ARB_texture_cube_map_array 1 +#define GL_TEXTURE_CUBE_MAP_ARRAY_ARB 0x9009 +#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY_ARB 0x900A +#define GL_PROXY_TEXTURE_CUBE_MAP_ARRAY_ARB 0x900B +#define GL_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900C +#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_ARB 0x900D +#define GL_INT_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900E +#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900F +#endif /* GL_ARB_texture_cube_map_array */ + +#ifndef GL_ARB_texture_env_add +#define GL_ARB_texture_env_add 1 +#endif /* GL_ARB_texture_env_add */ + +#ifndef GL_ARB_texture_env_combine +#define GL_ARB_texture_env_combine 1 +#define GL_COMBINE_ARB 0x8570 +#define GL_COMBINE_RGB_ARB 0x8571 +#define GL_COMBINE_ALPHA_ARB 0x8572 +#define GL_SOURCE0_RGB_ARB 0x8580 +#define GL_SOURCE1_RGB_ARB 0x8581 +#define GL_SOURCE2_RGB_ARB 0x8582 +#define GL_SOURCE0_ALPHA_ARB 0x8588 +#define GL_SOURCE1_ALPHA_ARB 0x8589 +#define GL_SOURCE2_ALPHA_ARB 0x858A +#define GL_OPERAND0_RGB_ARB 0x8590 +#define GL_OPERAND1_RGB_ARB 0x8591 +#define GL_OPERAND2_RGB_ARB 0x8592 +#define GL_OPERAND0_ALPHA_ARB 0x8598 +#define GL_OPERAND1_ALPHA_ARB 0x8599 +#define GL_OPERAND2_ALPHA_ARB 0x859A +#define GL_RGB_SCALE_ARB 0x8573 +#define GL_ADD_SIGNED_ARB 0x8574 +#define GL_INTERPOLATE_ARB 0x8575 +#define GL_SUBTRACT_ARB 0x84E7 +#define GL_CONSTANT_ARB 0x8576 +#define GL_PRIMARY_COLOR_ARB 0x8577 +#define GL_PREVIOUS_ARB 0x8578 +#endif /* GL_ARB_texture_env_combine */ + +#ifndef GL_ARB_texture_env_crossbar +#define GL_ARB_texture_env_crossbar 1 +#endif /* GL_ARB_texture_env_crossbar */ + +#ifndef GL_ARB_texture_env_dot3 +#define GL_ARB_texture_env_dot3 1 +#define GL_DOT3_RGB_ARB 0x86AE +#define GL_DOT3_RGBA_ARB 0x86AF +#endif /* GL_ARB_texture_env_dot3 */ + +#ifndef GL_ARB_texture_float +#define GL_ARB_texture_float 1 +#define GL_TEXTURE_RED_TYPE_ARB 0x8C10 +#define GL_TEXTURE_GREEN_TYPE_ARB 0x8C11 +#define GL_TEXTURE_BLUE_TYPE_ARB 0x8C12 +#define GL_TEXTURE_ALPHA_TYPE_ARB 0x8C13 +#define GL_TEXTURE_LUMINANCE_TYPE_ARB 0x8C14 +#define GL_TEXTURE_INTENSITY_TYPE_ARB 0x8C15 +#define GL_TEXTURE_DEPTH_TYPE_ARB 0x8C16 +#define GL_UNSIGNED_NORMALIZED_ARB 0x8C17 +#define GL_RGBA32F_ARB 0x8814 +#define GL_RGB32F_ARB 0x8815 +#define GL_ALPHA32F_ARB 0x8816 +#define GL_INTENSITY32F_ARB 0x8817 +#define GL_LUMINANCE32F_ARB 0x8818 +#define GL_LUMINANCE_ALPHA32F_ARB 0x8819 +#define GL_RGBA16F_ARB 0x881A +#define GL_RGB16F_ARB 0x881B +#define GL_ALPHA16F_ARB 0x881C +#define GL_INTENSITY16F_ARB 0x881D +#define GL_LUMINANCE16F_ARB 0x881E +#define GL_LUMINANCE_ALPHA16F_ARB 0x881F +#endif /* GL_ARB_texture_float */ + +#ifndef GL_ARB_texture_gather +#define GL_ARB_texture_gather 1 +#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET_ARB 0x8E5E +#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET_ARB 0x8E5F +#define GL_MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS_ARB 0x8F9F +#endif /* GL_ARB_texture_gather */ + +#ifndef GL_ARB_texture_mirror_clamp_to_edge +#define GL_ARB_texture_mirror_clamp_to_edge 1 +#endif /* GL_ARB_texture_mirror_clamp_to_edge */ + +#ifndef GL_ARB_texture_mirrored_repeat +#define GL_ARB_texture_mirrored_repeat 1 +#define GL_MIRRORED_REPEAT_ARB 0x8370 +#endif /* GL_ARB_texture_mirrored_repeat */ + +#ifndef GL_ARB_texture_multisample +#define GL_ARB_texture_multisample 1 +#endif /* GL_ARB_texture_multisample */ + +#ifndef GL_ARB_texture_non_power_of_two +#define GL_ARB_texture_non_power_of_two 1 +#endif /* GL_ARB_texture_non_power_of_two */ + +#ifndef GL_ARB_texture_query_levels +#define GL_ARB_texture_query_levels 1 +#endif /* GL_ARB_texture_query_levels */ + +#ifndef GL_ARB_texture_query_lod +#define GL_ARB_texture_query_lod 1 +#endif /* GL_ARB_texture_query_lod */ + +#ifndef GL_ARB_texture_rectangle +#define GL_ARB_texture_rectangle 1 +#define GL_TEXTURE_RECTANGLE_ARB 0x84F5 +#define GL_TEXTURE_BINDING_RECTANGLE_ARB 0x84F6 +#define GL_PROXY_TEXTURE_RECTANGLE_ARB 0x84F7 +#define GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB 0x84F8 +#endif /* GL_ARB_texture_rectangle */ + +#ifndef GL_ARB_texture_rg +#define GL_ARB_texture_rg 1 +#endif /* GL_ARB_texture_rg */ + +#ifndef GL_ARB_texture_rgb10_a2ui +#define GL_ARB_texture_rgb10_a2ui 1 +#endif /* GL_ARB_texture_rgb10_a2ui */ + +#ifndef GL_ARB_texture_stencil8 +#define GL_ARB_texture_stencil8 1 +#endif /* GL_ARB_texture_stencil8 */ + +#ifndef GL_ARB_texture_storage +#define GL_ARB_texture_storage 1 +#endif /* GL_ARB_texture_storage */ + +#ifndef GL_ARB_texture_storage_multisample +#define GL_ARB_texture_storage_multisample 1 +#endif /* GL_ARB_texture_storage_multisample */ + +#ifndef GL_ARB_texture_swizzle +#define GL_ARB_texture_swizzle 1 +#endif /* GL_ARB_texture_swizzle */ + +#ifndef GL_ARB_texture_view +#define GL_ARB_texture_view 1 +#endif /* GL_ARB_texture_view */ + +#ifndef GL_ARB_timer_query +#define GL_ARB_timer_query 1 +#endif /* GL_ARB_timer_query */ + +#ifndef GL_ARB_transform_feedback2 +#define GL_ARB_transform_feedback2 1 +#define GL_TRANSFORM_FEEDBACK_PAUSED 0x8E23 +#define GL_TRANSFORM_FEEDBACK_ACTIVE 0x8E24 +#endif /* GL_ARB_transform_feedback2 */ + +#ifndef GL_ARB_transform_feedback3 +#define GL_ARB_transform_feedback3 1 +#endif /* GL_ARB_transform_feedback3 */ + +#ifndef GL_ARB_transform_feedback_instanced +#define GL_ARB_transform_feedback_instanced 1 +#endif /* GL_ARB_transform_feedback_instanced */ + +#ifndef GL_ARB_transpose_matrix +#define GL_ARB_transpose_matrix 1 +#define GL_TRANSPOSE_MODELVIEW_MATRIX_ARB 0x84E3 +#define GL_TRANSPOSE_PROJECTION_MATRIX_ARB 0x84E4 +#define GL_TRANSPOSE_TEXTURE_MATRIX_ARB 0x84E5 +#define GL_TRANSPOSE_COLOR_MATRIX_ARB 0x84E6 +typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXFARBPROC) (const GLfloat *m); +typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXDARBPROC) (const GLdouble *m); +typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXFARBPROC) (const GLfloat *m); +typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXDARBPROC) (const GLdouble *m); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glLoadTransposeMatrixfARB (const GLfloat *m); +GLAPI void APIENTRY glLoadTransposeMatrixdARB (const GLdouble *m); +GLAPI void APIENTRY glMultTransposeMatrixfARB (const GLfloat *m); +GLAPI void APIENTRY glMultTransposeMatrixdARB (const GLdouble *m); +#endif +#endif /* GL_ARB_transpose_matrix */ + +#ifndef GL_ARB_uniform_buffer_object +#define GL_ARB_uniform_buffer_object 1 +#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS 0x8A2C +#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS 0x8A32 +#define GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER 0x8A45 +#endif /* GL_ARB_uniform_buffer_object */ + +#ifndef GL_ARB_vertex_array_bgra +#define GL_ARB_vertex_array_bgra 1 +#endif /* GL_ARB_vertex_array_bgra */ + +#ifndef GL_ARB_vertex_array_object +#define GL_ARB_vertex_array_object 1 +#endif /* GL_ARB_vertex_array_object */ + +#ifndef GL_ARB_vertex_attrib_64bit +#define GL_ARB_vertex_attrib_64bit 1 +#endif /* GL_ARB_vertex_attrib_64bit */ + +#ifndef GL_ARB_vertex_attrib_binding +#define GL_ARB_vertex_attrib_binding 1 +#endif /* GL_ARB_vertex_attrib_binding */ + +#ifndef GL_ARB_vertex_blend +#define GL_ARB_vertex_blend 1 +#define GL_MAX_VERTEX_UNITS_ARB 0x86A4 +#define GL_ACTIVE_VERTEX_UNITS_ARB 0x86A5 +#define GL_WEIGHT_SUM_UNITY_ARB 0x86A6 +#define GL_VERTEX_BLEND_ARB 0x86A7 +#define GL_CURRENT_WEIGHT_ARB 0x86A8 +#define GL_WEIGHT_ARRAY_TYPE_ARB 0x86A9 +#define GL_WEIGHT_ARRAY_STRIDE_ARB 0x86AA +#define GL_WEIGHT_ARRAY_SIZE_ARB 0x86AB +#define GL_WEIGHT_ARRAY_POINTER_ARB 0x86AC +#define GL_WEIGHT_ARRAY_ARB 0x86AD +#define GL_MODELVIEW0_ARB 0x1700 +#define GL_MODELVIEW1_ARB 0x850A +#define GL_MODELVIEW2_ARB 0x8722 +#define GL_MODELVIEW3_ARB 0x8723 +#define GL_MODELVIEW4_ARB 0x8724 +#define GL_MODELVIEW5_ARB 0x8725 +#define GL_MODELVIEW6_ARB 0x8726 +#define GL_MODELVIEW7_ARB 0x8727 +#define GL_MODELVIEW8_ARB 0x8728 +#define GL_MODELVIEW9_ARB 0x8729 +#define GL_MODELVIEW10_ARB 0x872A +#define GL_MODELVIEW11_ARB 0x872B +#define GL_MODELVIEW12_ARB 0x872C +#define GL_MODELVIEW13_ARB 0x872D +#define GL_MODELVIEW14_ARB 0x872E +#define GL_MODELVIEW15_ARB 0x872F +#define GL_MODELVIEW16_ARB 0x8730 +#define GL_MODELVIEW17_ARB 0x8731 +#define GL_MODELVIEW18_ARB 0x8732 +#define GL_MODELVIEW19_ARB 0x8733 +#define GL_MODELVIEW20_ARB 0x8734 +#define GL_MODELVIEW21_ARB 0x8735 +#define GL_MODELVIEW22_ARB 0x8736 +#define GL_MODELVIEW23_ARB 0x8737 +#define GL_MODELVIEW24_ARB 0x8738 +#define GL_MODELVIEW25_ARB 0x8739 +#define GL_MODELVIEW26_ARB 0x873A +#define GL_MODELVIEW27_ARB 0x873B +#define GL_MODELVIEW28_ARB 0x873C +#define GL_MODELVIEW29_ARB 0x873D +#define GL_MODELVIEW30_ARB 0x873E +#define GL_MODELVIEW31_ARB 0x873F +typedef void (APIENTRYP PFNGLWEIGHTBVARBPROC) (GLint size, const GLbyte *weights); +typedef void (APIENTRYP PFNGLWEIGHTSVARBPROC) (GLint size, const GLshort *weights); +typedef void (APIENTRYP PFNGLWEIGHTIVARBPROC) (GLint size, const GLint *weights); +typedef void (APIENTRYP PFNGLWEIGHTFVARBPROC) (GLint size, const GLfloat *weights); +typedef void (APIENTRYP PFNGLWEIGHTDVARBPROC) (GLint size, const GLdouble *weights); +typedef void (APIENTRYP PFNGLWEIGHTUBVARBPROC) (GLint size, const GLubyte *weights); +typedef void (APIENTRYP PFNGLWEIGHTUSVARBPROC) (GLint size, const GLushort *weights); +typedef void (APIENTRYP PFNGLWEIGHTUIVARBPROC) (GLint size, const GLuint *weights); +typedef void (APIENTRYP PFNGLWEIGHTPOINTERARBPROC) (GLint size, GLenum type, GLsizei stride, const void *pointer); +typedef void (APIENTRYP PFNGLVERTEXBLENDARBPROC) (GLint count); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glWeightbvARB (GLint size, const GLbyte *weights); +GLAPI void APIENTRY glWeightsvARB (GLint size, const GLshort *weights); +GLAPI void APIENTRY glWeightivARB (GLint size, const GLint *weights); +GLAPI void APIENTRY glWeightfvARB (GLint size, const GLfloat *weights); +GLAPI void APIENTRY glWeightdvARB (GLint size, const GLdouble *weights); +GLAPI void APIENTRY glWeightubvARB (GLint size, const GLubyte *weights); +GLAPI void APIENTRY glWeightusvARB (GLint size, const GLushort *weights); +GLAPI void APIENTRY glWeightuivARB (GLint size, const GLuint *weights); +GLAPI void APIENTRY glWeightPointerARB (GLint size, GLenum type, GLsizei stride, const void *pointer); +GLAPI void APIENTRY glVertexBlendARB (GLint count); +#endif +#endif /* GL_ARB_vertex_blend */ + +#ifndef GL_ARB_vertex_buffer_object +#define GL_ARB_vertex_buffer_object 1 +#ifdef __MACOSX__ /* The OS X headers haven't caught up with Khronos yet */ +typedef long GLsizeiptrARB; +typedef long GLintptrARB; +#else +typedef ptrdiff_t GLsizeiptrARB; +typedef ptrdiff_t GLintptrARB; +#endif +#define GL_BUFFER_SIZE_ARB 0x8764 +#define GL_BUFFER_USAGE_ARB 0x8765 +#define GL_ARRAY_BUFFER_ARB 0x8892 +#define GL_ELEMENT_ARRAY_BUFFER_ARB 0x8893 +#define GL_ARRAY_BUFFER_BINDING_ARB 0x8894 +#define GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB 0x8895 +#define GL_VERTEX_ARRAY_BUFFER_BINDING_ARB 0x8896 +#define GL_NORMAL_ARRAY_BUFFER_BINDING_ARB 0x8897 +#define GL_COLOR_ARRAY_BUFFER_BINDING_ARB 0x8898 +#define GL_INDEX_ARRAY_BUFFER_BINDING_ARB 0x8899 +#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB 0x889A +#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB 0x889B +#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB 0x889C +#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB 0x889D +#define GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB 0x889E +#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB 0x889F +#define GL_READ_ONLY_ARB 0x88B8 +#define GL_WRITE_ONLY_ARB 0x88B9 +#define GL_READ_WRITE_ARB 0x88BA +#define GL_BUFFER_ACCESS_ARB 0x88BB +#define GL_BUFFER_MAPPED_ARB 0x88BC +#define GL_BUFFER_MAP_POINTER_ARB 0x88BD +#define GL_STREAM_DRAW_ARB 0x88E0 +#define GL_STREAM_READ_ARB 0x88E1 +#define GL_STREAM_COPY_ARB 0x88E2 +#define GL_STATIC_DRAW_ARB 0x88E4 +#define GL_STATIC_READ_ARB 0x88E5 +#define GL_STATIC_COPY_ARB 0x88E6 +#define GL_DYNAMIC_DRAW_ARB 0x88E8 +#define GL_DYNAMIC_READ_ARB 0x88E9 +#define GL_DYNAMIC_COPY_ARB 0x88EA +typedef void (APIENTRYP PFNGLBINDBUFFERARBPROC) (GLenum target, GLuint buffer); +typedef void (APIENTRYP PFNGLDELETEBUFFERSARBPROC) (GLsizei n, const GLuint *buffers); +typedef void (APIENTRYP PFNGLGENBUFFERSARBPROC) (GLsizei n, GLuint *buffers); +typedef GLboolean (APIENTRYP PFNGLISBUFFERARBPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLBUFFERDATAARBPROC) (GLenum target, GLsizeiptrARB size, const void *data, GLenum usage); +typedef void (APIENTRYP PFNGLBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const void *data); +typedef void (APIENTRYP PFNGLGETBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, void *data); +typedef void *(APIENTRYP PFNGLMAPBUFFERARBPROC) (GLenum target, GLenum access); +typedef GLboolean (APIENTRYP PFNGLUNMAPBUFFERARBPROC) (GLenum target); +typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERIVARBPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETBUFFERPOINTERVARBPROC) (GLenum target, GLenum pname, void **params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBindBufferARB (GLenum target, GLuint buffer); +GLAPI void APIENTRY glDeleteBuffersARB (GLsizei n, const GLuint *buffers); +GLAPI void APIENTRY glGenBuffersARB (GLsizei n, GLuint *buffers); +GLAPI GLboolean APIENTRY glIsBufferARB (GLuint buffer); +GLAPI void APIENTRY glBufferDataARB (GLenum target, GLsizeiptrARB size, const void *data, GLenum usage); +GLAPI void APIENTRY glBufferSubDataARB (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const void *data); +GLAPI void APIENTRY glGetBufferSubDataARB (GLenum target, GLintptrARB offset, GLsizeiptrARB size, void *data); +GLAPI void *APIENTRY glMapBufferARB (GLenum target, GLenum access); +GLAPI GLboolean APIENTRY glUnmapBufferARB (GLenum target); +GLAPI void APIENTRY glGetBufferParameterivARB (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetBufferPointervARB (GLenum target, GLenum pname, void **params); +#endif +#endif /* GL_ARB_vertex_buffer_object */ + +#ifndef GL_ARB_vertex_program +#define GL_ARB_vertex_program 1 +#define GL_COLOR_SUM_ARB 0x8458 +#define GL_VERTEX_PROGRAM_ARB 0x8620 +#define GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB 0x8622 +#define GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB 0x8623 +#define GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB 0x8624 +#define GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB 0x8625 +#define GL_CURRENT_VERTEX_ATTRIB_ARB 0x8626 +#define GL_VERTEX_PROGRAM_POINT_SIZE_ARB 0x8642 +#define GL_VERTEX_PROGRAM_TWO_SIDE_ARB 0x8643 +#define GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB 0x8645 +#define GL_MAX_VERTEX_ATTRIBS_ARB 0x8869 +#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB 0x886A +#define GL_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B0 +#define GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B1 +#define GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B2 +#define GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B3 +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DARBPROC) (GLuint index, GLdouble x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVARBPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FARBPROC) (GLuint index, GLfloat x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVARBPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SARBPROC) (GLuint index, GLshort x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVARBPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DARBPROC) (GLuint index, GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVARBPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FARBPROC) (GLuint index, GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVARBPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SARBPROC) (GLuint index, GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVARBPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVARBPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVARBPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVARBPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NBVARBPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NIVARBPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NSVARBPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBARBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBVARBPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUIVARBPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUSVARBPROC) (GLuint index, const GLushort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4BVARBPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVARBPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVARBPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4IVARBPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVARBPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVARBPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UIVARBPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4USVARBPROC) (GLuint index, const GLushort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERARBPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer); +typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYARBPROC) (GLuint index); +typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYARBPROC) (GLuint index); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVARBPROC) (GLuint index, GLenum pname, GLdouble *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVARBPROC) (GLuint index, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVARBPROC) (GLuint index, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVARBPROC) (GLuint index, GLenum pname, void **pointer); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexAttrib1dARB (GLuint index, GLdouble x); +GLAPI void APIENTRY glVertexAttrib1dvARB (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttrib1fARB (GLuint index, GLfloat x); +GLAPI void APIENTRY glVertexAttrib1fvARB (GLuint index, const GLfloat *v); +GLAPI void APIENTRY glVertexAttrib1sARB (GLuint index, GLshort x); +GLAPI void APIENTRY glVertexAttrib1svARB (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttrib2dARB (GLuint index, GLdouble x, GLdouble y); +GLAPI void APIENTRY glVertexAttrib2dvARB (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttrib2fARB (GLuint index, GLfloat x, GLfloat y); +GLAPI void APIENTRY glVertexAttrib2fvARB (GLuint index, const GLfloat *v); +GLAPI void APIENTRY glVertexAttrib2sARB (GLuint index, GLshort x, GLshort y); +GLAPI void APIENTRY glVertexAttrib2svARB (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttrib3dARB (GLuint index, GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY glVertexAttrib3dvARB (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttrib3fARB (GLuint index, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glVertexAttrib3fvARB (GLuint index, const GLfloat *v); +GLAPI void APIENTRY glVertexAttrib3sARB (GLuint index, GLshort x, GLshort y, GLshort z); +GLAPI void APIENTRY glVertexAttrib3svARB (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttrib4NbvARB (GLuint index, const GLbyte *v); +GLAPI void APIENTRY glVertexAttrib4NivARB (GLuint index, const GLint *v); +GLAPI void APIENTRY glVertexAttrib4NsvARB (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttrib4NubARB (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +GLAPI void APIENTRY glVertexAttrib4NubvARB (GLuint index, const GLubyte *v); +GLAPI void APIENTRY glVertexAttrib4NuivARB (GLuint index, const GLuint *v); +GLAPI void APIENTRY glVertexAttrib4NusvARB (GLuint index, const GLushort *v); +GLAPI void APIENTRY glVertexAttrib4bvARB (GLuint index, const GLbyte *v); +GLAPI void APIENTRY glVertexAttrib4dARB (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY glVertexAttrib4dvARB (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttrib4fARB (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void APIENTRY glVertexAttrib4fvARB (GLuint index, const GLfloat *v); +GLAPI void APIENTRY glVertexAttrib4ivARB (GLuint index, const GLint *v); +GLAPI void APIENTRY glVertexAttrib4sARB (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +GLAPI void APIENTRY glVertexAttrib4svARB (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttrib4ubvARB (GLuint index, const GLubyte *v); +GLAPI void APIENTRY glVertexAttrib4uivARB (GLuint index, const GLuint *v); +GLAPI void APIENTRY glVertexAttrib4usvARB (GLuint index, const GLushort *v); +GLAPI void APIENTRY glVertexAttribPointerARB (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer); +GLAPI void APIENTRY glEnableVertexAttribArrayARB (GLuint index); +GLAPI void APIENTRY glDisableVertexAttribArrayARB (GLuint index); +GLAPI void APIENTRY glGetVertexAttribdvARB (GLuint index, GLenum pname, GLdouble *params); +GLAPI void APIENTRY glGetVertexAttribfvARB (GLuint index, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetVertexAttribivARB (GLuint index, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetVertexAttribPointervARB (GLuint index, GLenum pname, void **pointer); +#endif +#endif /* GL_ARB_vertex_program */ + +#ifndef GL_ARB_vertex_shader +#define GL_ARB_vertex_shader 1 +#define GL_VERTEX_SHADER_ARB 0x8B31 +#define GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB 0x8B4A +#define GL_MAX_VARYING_FLOATS_ARB 0x8B4B +#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB 0x8B4C +#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB 0x8B4D +#define GL_OBJECT_ACTIVE_ATTRIBUTES_ARB 0x8B89 +#define GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB 0x8B8A +typedef void (APIENTRYP PFNGLBINDATTRIBLOCATIONARBPROC) (GLhandleARB programObj, GLuint index, const GLcharARB *name); +typedef void (APIENTRYP PFNGLGETACTIVEATTRIBARBPROC) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name); +typedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB *name); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBindAttribLocationARB (GLhandleARB programObj, GLuint index, const GLcharARB *name); +GLAPI void APIENTRY glGetActiveAttribARB (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name); +GLAPI GLint APIENTRY glGetAttribLocationARB (GLhandleARB programObj, const GLcharARB *name); +#endif +#endif /* GL_ARB_vertex_shader */ + +#ifndef GL_ARB_vertex_type_10f_11f_11f_rev +#define GL_ARB_vertex_type_10f_11f_11f_rev 1 +#endif /* GL_ARB_vertex_type_10f_11f_11f_rev */ + +#ifndef GL_ARB_vertex_type_2_10_10_10_rev +#define GL_ARB_vertex_type_2_10_10_10_rev 1 +#endif /* GL_ARB_vertex_type_2_10_10_10_rev */ + +#ifndef GL_ARB_viewport_array +#define GL_ARB_viewport_array 1 +#endif /* GL_ARB_viewport_array */ + +#ifndef GL_ARB_window_pos +#define GL_ARB_window_pos 1 +typedef void (APIENTRYP PFNGLWINDOWPOS2DARBPROC) (GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLWINDOWPOS2DVARBPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2FARBPROC) (GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLWINDOWPOS2FVARBPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2IARBPROC) (GLint x, GLint y); +typedef void (APIENTRYP PFNGLWINDOWPOS2IVARBPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2SARBPROC) (GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLWINDOWPOS2SVARBPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3DARBPROC) (GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLWINDOWPOS3DVARBPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3FARBPROC) (GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLWINDOWPOS3FVARBPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3IARBPROC) (GLint x, GLint y, GLint z); +typedef void (APIENTRYP PFNGLWINDOWPOS3IVARBPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3SARBPROC) (GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLWINDOWPOS3SVARBPROC) (const GLshort *v); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glWindowPos2dARB (GLdouble x, GLdouble y); +GLAPI void APIENTRY glWindowPos2dvARB (const GLdouble *v); +GLAPI void APIENTRY glWindowPos2fARB (GLfloat x, GLfloat y); +GLAPI void APIENTRY glWindowPos2fvARB (const GLfloat *v); +GLAPI void APIENTRY glWindowPos2iARB (GLint x, GLint y); +GLAPI void APIENTRY glWindowPos2ivARB (const GLint *v); +GLAPI void APIENTRY glWindowPos2sARB (GLshort x, GLshort y); +GLAPI void APIENTRY glWindowPos2svARB (const GLshort *v); +GLAPI void APIENTRY glWindowPos3dARB (GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY glWindowPos3dvARB (const GLdouble *v); +GLAPI void APIENTRY glWindowPos3fARB (GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glWindowPos3fvARB (const GLfloat *v); +GLAPI void APIENTRY glWindowPos3iARB (GLint x, GLint y, GLint z); +GLAPI void APIENTRY glWindowPos3ivARB (const GLint *v); +GLAPI void APIENTRY glWindowPos3sARB (GLshort x, GLshort y, GLshort z); +GLAPI void APIENTRY glWindowPos3svARB (const GLshort *v); +#endif +#endif /* GL_ARB_window_pos */ + +#ifndef GL_KHR_debug +#define GL_KHR_debug 1 +#endif /* GL_KHR_debug */ + +#ifndef GL_KHR_texture_compression_astc_hdr +#define GL_KHR_texture_compression_astc_hdr 1 +#define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0 +#define GL_COMPRESSED_RGBA_ASTC_5x4_KHR 0x93B1 +#define GL_COMPRESSED_RGBA_ASTC_5x5_KHR 0x93B2 +#define GL_COMPRESSED_RGBA_ASTC_6x5_KHR 0x93B3 +#define GL_COMPRESSED_RGBA_ASTC_6x6_KHR 0x93B4 +#define GL_COMPRESSED_RGBA_ASTC_8x5_KHR 0x93B5 +#define GL_COMPRESSED_RGBA_ASTC_8x6_KHR 0x93B6 +#define GL_COMPRESSED_RGBA_ASTC_8x8_KHR 0x93B7 +#define GL_COMPRESSED_RGBA_ASTC_10x5_KHR 0x93B8 +#define GL_COMPRESSED_RGBA_ASTC_10x6_KHR 0x93B9 +#define GL_COMPRESSED_RGBA_ASTC_10x8_KHR 0x93BA +#define GL_COMPRESSED_RGBA_ASTC_10x10_KHR 0x93BB +#define GL_COMPRESSED_RGBA_ASTC_12x10_KHR 0x93BC +#define GL_COMPRESSED_RGBA_ASTC_12x12_KHR 0x93BD +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR 0x93D0 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR 0x93D1 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR 0x93D2 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR 0x93D3 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR 0x93D4 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR 0x93D5 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR 0x93D6 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR 0x93D7 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR 0x93D8 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR 0x93D9 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR 0x93DA +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR 0x93DB +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR 0x93DC +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR 0x93DD +#endif /* GL_KHR_texture_compression_astc_hdr */ + +#ifndef GL_KHR_texture_compression_astc_ldr +#define GL_KHR_texture_compression_astc_ldr 1 +#endif /* GL_KHR_texture_compression_astc_ldr */ + +#ifndef GL_OES_byte_coordinates +#define GL_OES_byte_coordinates 1 +typedef void (APIENTRYP PFNGLMULTITEXCOORD1BOESPROC) (GLenum texture, GLbyte s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1BVOESPROC) (GLenum texture, const GLbyte *coords); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2BOESPROC) (GLenum texture, GLbyte s, GLbyte t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2BVOESPROC) (GLenum texture, const GLbyte *coords); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3BOESPROC) (GLenum texture, GLbyte s, GLbyte t, GLbyte r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3BVOESPROC) (GLenum texture, const GLbyte *coords); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4BOESPROC) (GLenum texture, GLbyte s, GLbyte t, GLbyte r, GLbyte q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4BVOESPROC) (GLenum texture, const GLbyte *coords); +typedef void (APIENTRYP PFNGLTEXCOORD1BOESPROC) (GLbyte s); +typedef void (APIENTRYP PFNGLTEXCOORD1BVOESPROC) (const GLbyte *coords); +typedef void (APIENTRYP PFNGLTEXCOORD2BOESPROC) (GLbyte s, GLbyte t); +typedef void (APIENTRYP PFNGLTEXCOORD2BVOESPROC) (const GLbyte *coords); +typedef void (APIENTRYP PFNGLTEXCOORD3BOESPROC) (GLbyte s, GLbyte t, GLbyte r); +typedef void (APIENTRYP PFNGLTEXCOORD3BVOESPROC) (const GLbyte *coords); +typedef void (APIENTRYP PFNGLTEXCOORD4BOESPROC) (GLbyte s, GLbyte t, GLbyte r, GLbyte q); +typedef void (APIENTRYP PFNGLTEXCOORD4BVOESPROC) (const GLbyte *coords); +typedef void (APIENTRYP PFNGLVERTEX2BOESPROC) (GLbyte x); +typedef void (APIENTRYP PFNGLVERTEX2BVOESPROC) (const GLbyte *coords); +typedef void (APIENTRYP PFNGLVERTEX3BOESPROC) (GLbyte x, GLbyte y); +typedef void (APIENTRYP PFNGLVERTEX3BVOESPROC) (const GLbyte *coords); +typedef void (APIENTRYP PFNGLVERTEX4BOESPROC) (GLbyte x, GLbyte y, GLbyte z); +typedef void (APIENTRYP PFNGLVERTEX4BVOESPROC) (const GLbyte *coords); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMultiTexCoord1bOES (GLenum texture, GLbyte s); +GLAPI void APIENTRY glMultiTexCoord1bvOES (GLenum texture, const GLbyte *coords); +GLAPI void APIENTRY glMultiTexCoord2bOES (GLenum texture, GLbyte s, GLbyte t); +GLAPI void APIENTRY glMultiTexCoord2bvOES (GLenum texture, const GLbyte *coords); +GLAPI void APIENTRY glMultiTexCoord3bOES (GLenum texture, GLbyte s, GLbyte t, GLbyte r); +GLAPI void APIENTRY glMultiTexCoord3bvOES (GLenum texture, const GLbyte *coords); +GLAPI void APIENTRY glMultiTexCoord4bOES (GLenum texture, GLbyte s, GLbyte t, GLbyte r, GLbyte q); +GLAPI void APIENTRY glMultiTexCoord4bvOES (GLenum texture, const GLbyte *coords); +GLAPI void APIENTRY glTexCoord1bOES (GLbyte s); +GLAPI void APIENTRY glTexCoord1bvOES (const GLbyte *coords); +GLAPI void APIENTRY glTexCoord2bOES (GLbyte s, GLbyte t); +GLAPI void APIENTRY glTexCoord2bvOES (const GLbyte *coords); +GLAPI void APIENTRY glTexCoord3bOES (GLbyte s, GLbyte t, GLbyte r); +GLAPI void APIENTRY glTexCoord3bvOES (const GLbyte *coords); +GLAPI void APIENTRY glTexCoord4bOES (GLbyte s, GLbyte t, GLbyte r, GLbyte q); +GLAPI void APIENTRY glTexCoord4bvOES (const GLbyte *coords); +GLAPI void APIENTRY glVertex2bOES (GLbyte x); +GLAPI void APIENTRY glVertex2bvOES (const GLbyte *coords); +GLAPI void APIENTRY glVertex3bOES (GLbyte x, GLbyte y); +GLAPI void APIENTRY glVertex3bvOES (const GLbyte *coords); +GLAPI void APIENTRY glVertex4bOES (GLbyte x, GLbyte y, GLbyte z); +GLAPI void APIENTRY glVertex4bvOES (const GLbyte *coords); +#endif +#endif /* GL_OES_byte_coordinates */ + +#ifndef GL_OES_compressed_paletted_texture +#define GL_OES_compressed_paletted_texture 1 +#define GL_PALETTE4_RGB8_OES 0x8B90 +#define GL_PALETTE4_RGBA8_OES 0x8B91 +#define GL_PALETTE4_R5_G6_B5_OES 0x8B92 +#define GL_PALETTE4_RGBA4_OES 0x8B93 +#define GL_PALETTE4_RGB5_A1_OES 0x8B94 +#define GL_PALETTE8_RGB8_OES 0x8B95 +#define GL_PALETTE8_RGBA8_OES 0x8B96 +#define GL_PALETTE8_R5_G6_B5_OES 0x8B97 +#define GL_PALETTE8_RGBA4_OES 0x8B98 +#define GL_PALETTE8_RGB5_A1_OES 0x8B99 +#endif /* GL_OES_compressed_paletted_texture */ + +#ifndef GL_OES_fixed_point +#define GL_OES_fixed_point 1 +typedef GLint GLfixed; +#define GL_FIXED_OES 0x140C +typedef void (APIENTRYP PFNGLALPHAFUNCXOESPROC) (GLenum func, GLfixed ref); +typedef void (APIENTRYP PFNGLCLEARCOLORXOESPROC) (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); +typedef void (APIENTRYP PFNGLCLEARDEPTHXOESPROC) (GLfixed depth); +typedef void (APIENTRYP PFNGLCLIPPLANEXOESPROC) (GLenum plane, const GLfixed *equation); +typedef void (APIENTRYP PFNGLCOLOR4XOESPROC) (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); +typedef void (APIENTRYP PFNGLDEPTHRANGEXOESPROC) (GLfixed n, GLfixed f); +typedef void (APIENTRYP PFNGLFOGXOESPROC) (GLenum pname, GLfixed param); +typedef void (APIENTRYP PFNGLFOGXVOESPROC) (GLenum pname, const GLfixed *param); +typedef void (APIENTRYP PFNGLFRUSTUMXOESPROC) (GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f); +typedef void (APIENTRYP PFNGLGETCLIPPLANEXOESPROC) (GLenum plane, GLfixed *equation); +typedef void (APIENTRYP PFNGLGETFIXEDVOESPROC) (GLenum pname, GLfixed *params); +typedef void (APIENTRYP PFNGLGETTEXENVXVOESPROC) (GLenum target, GLenum pname, GLfixed *params); +typedef void (APIENTRYP PFNGLGETTEXPARAMETERXVOESPROC) (GLenum target, GLenum pname, GLfixed *params); +typedef void (APIENTRYP PFNGLLIGHTMODELXOESPROC) (GLenum pname, GLfixed param); +typedef void (APIENTRYP PFNGLLIGHTMODELXVOESPROC) (GLenum pname, const GLfixed *param); +typedef void (APIENTRYP PFNGLLIGHTXOESPROC) (GLenum light, GLenum pname, GLfixed param); +typedef void (APIENTRYP PFNGLLIGHTXVOESPROC) (GLenum light, GLenum pname, const GLfixed *params); +typedef void (APIENTRYP PFNGLLINEWIDTHXOESPROC) (GLfixed width); +typedef void (APIENTRYP PFNGLLOADMATRIXXOESPROC) (const GLfixed *m); +typedef void (APIENTRYP PFNGLMATERIALXOESPROC) (GLenum face, GLenum pname, GLfixed param); +typedef void (APIENTRYP PFNGLMATERIALXVOESPROC) (GLenum face, GLenum pname, const GLfixed *param); +typedef void (APIENTRYP PFNGLMULTMATRIXXOESPROC) (const GLfixed *m); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4XOESPROC) (GLenum texture, GLfixed s, GLfixed t, GLfixed r, GLfixed q); +typedef void (APIENTRYP PFNGLNORMAL3XOESPROC) (GLfixed nx, GLfixed ny, GLfixed nz); +typedef void (APIENTRYP PFNGLORTHOXOESPROC) (GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f); +typedef void (APIENTRYP PFNGLPOINTPARAMETERXVOESPROC) (GLenum pname, const GLfixed *params); +typedef void (APIENTRYP PFNGLPOINTSIZEXOESPROC) (GLfixed size); +typedef void (APIENTRYP PFNGLPOLYGONOFFSETXOESPROC) (GLfixed factor, GLfixed units); +typedef void (APIENTRYP PFNGLROTATEXOESPROC) (GLfixed angle, GLfixed x, GLfixed y, GLfixed z); +typedef void (APIENTRYP PFNGLSAMPLECOVERAGEOESPROC) (GLfixed value, GLboolean invert); +typedef void (APIENTRYP PFNGLSCALEXOESPROC) (GLfixed x, GLfixed y, GLfixed z); +typedef void (APIENTRYP PFNGLTEXENVXOESPROC) (GLenum target, GLenum pname, GLfixed param); +typedef void (APIENTRYP PFNGLTEXENVXVOESPROC) (GLenum target, GLenum pname, const GLfixed *params); +typedef void (APIENTRYP PFNGLTEXPARAMETERXOESPROC) (GLenum target, GLenum pname, GLfixed param); +typedef void (APIENTRYP PFNGLTEXPARAMETERXVOESPROC) (GLenum target, GLenum pname, const GLfixed *params); +typedef void (APIENTRYP PFNGLTRANSLATEXOESPROC) (GLfixed x, GLfixed y, GLfixed z); +typedef void (APIENTRYP PFNGLACCUMXOESPROC) (GLenum op, GLfixed value); +typedef void (APIENTRYP PFNGLBITMAPXOESPROC) (GLsizei width, GLsizei height, GLfixed xorig, GLfixed yorig, GLfixed xmove, GLfixed ymove, const GLubyte *bitmap); +typedef void (APIENTRYP PFNGLBLENDCOLORXOESPROC) (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); +typedef void (APIENTRYP PFNGLCLEARACCUMXOESPROC) (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); +typedef void (APIENTRYP PFNGLCOLOR3XOESPROC) (GLfixed red, GLfixed green, GLfixed blue); +typedef void (APIENTRYP PFNGLCOLOR3XVOESPROC) (const GLfixed *components); +typedef void (APIENTRYP PFNGLCOLOR4XVOESPROC) (const GLfixed *components); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERXOESPROC) (GLenum target, GLenum pname, GLfixed param); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERXVOESPROC) (GLenum target, GLenum pname, const GLfixed *params); +typedef void (APIENTRYP PFNGLEVALCOORD1XOESPROC) (GLfixed u); +typedef void (APIENTRYP PFNGLEVALCOORD1XVOESPROC) (const GLfixed *coords); +typedef void (APIENTRYP PFNGLEVALCOORD2XOESPROC) (GLfixed u, GLfixed v); +typedef void (APIENTRYP PFNGLEVALCOORD2XVOESPROC) (const GLfixed *coords); +typedef void (APIENTRYP PFNGLFEEDBACKBUFFERXOESPROC) (GLsizei n, GLenum type, const GLfixed *buffer); +typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERXVOESPROC) (GLenum target, GLenum pname, GLfixed *params); +typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERXVOESPROC) (GLenum target, GLenum pname, GLfixed *params); +typedef void (APIENTRYP PFNGLGETLIGHTXOESPROC) (GLenum light, GLenum pname, GLfixed *params); +typedef void (APIENTRYP PFNGLGETMAPXVOESPROC) (GLenum target, GLenum query, GLfixed *v); +typedef void (APIENTRYP PFNGLGETMATERIALXOESPROC) (GLenum face, GLenum pname, GLfixed param); +typedef void (APIENTRYP PFNGLGETPIXELMAPXVPROC) (GLenum map, GLint size, GLfixed *values); +typedef void (APIENTRYP PFNGLGETTEXGENXVOESPROC) (GLenum coord, GLenum pname, GLfixed *params); +typedef void (APIENTRYP PFNGLGETTEXLEVELPARAMETERXVOESPROC) (GLenum target, GLint level, GLenum pname, GLfixed *params); +typedef void (APIENTRYP PFNGLINDEXXOESPROC) (GLfixed component); +typedef void (APIENTRYP PFNGLINDEXXVOESPROC) (const GLfixed *component); +typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXXOESPROC) (const GLfixed *m); +typedef void (APIENTRYP PFNGLMAP1XOESPROC) (GLenum target, GLfixed u1, GLfixed u2, GLint stride, GLint order, GLfixed points); +typedef void (APIENTRYP PFNGLMAP2XOESPROC) (GLenum target, GLfixed u1, GLfixed u2, GLint ustride, GLint uorder, GLfixed v1, GLfixed v2, GLint vstride, GLint vorder, GLfixed points); +typedef void (APIENTRYP PFNGLMAPGRID1XOESPROC) (GLint n, GLfixed u1, GLfixed u2); +typedef void (APIENTRYP PFNGLMAPGRID2XOESPROC) (GLint n, GLfixed u1, GLfixed u2, GLfixed v1, GLfixed v2); +typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXXOESPROC) (const GLfixed *m); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1XOESPROC) (GLenum texture, GLfixed s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1XVOESPROC) (GLenum texture, const GLfixed *coords); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2XOESPROC) (GLenum texture, GLfixed s, GLfixed t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2XVOESPROC) (GLenum texture, const GLfixed *coords); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3XOESPROC) (GLenum texture, GLfixed s, GLfixed t, GLfixed r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3XVOESPROC) (GLenum texture, const GLfixed *coords); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4XVOESPROC) (GLenum texture, const GLfixed *coords); +typedef void (APIENTRYP PFNGLNORMAL3XVOESPROC) (const GLfixed *coords); +typedef void (APIENTRYP PFNGLPASSTHROUGHXOESPROC) (GLfixed token); +typedef void (APIENTRYP PFNGLPIXELMAPXPROC) (GLenum map, GLint size, const GLfixed *values); +typedef void (APIENTRYP PFNGLPIXELSTOREXPROC) (GLenum pname, GLfixed param); +typedef void (APIENTRYP PFNGLPIXELTRANSFERXOESPROC) (GLenum pname, GLfixed param); +typedef void (APIENTRYP PFNGLPIXELZOOMXOESPROC) (GLfixed xfactor, GLfixed yfactor); +typedef void (APIENTRYP PFNGLPRIORITIZETEXTURESXOESPROC) (GLsizei n, const GLuint *textures, const GLfixed *priorities); +typedef void (APIENTRYP PFNGLRASTERPOS2XOESPROC) (GLfixed x, GLfixed y); +typedef void (APIENTRYP PFNGLRASTERPOS2XVOESPROC) (const GLfixed *coords); +typedef void (APIENTRYP PFNGLRASTERPOS3XOESPROC) (GLfixed x, GLfixed y, GLfixed z); +typedef void (APIENTRYP PFNGLRASTERPOS3XVOESPROC) (const GLfixed *coords); +typedef void (APIENTRYP PFNGLRASTERPOS4XOESPROC) (GLfixed x, GLfixed y, GLfixed z, GLfixed w); +typedef void (APIENTRYP PFNGLRASTERPOS4XVOESPROC) (const GLfixed *coords); +typedef void (APIENTRYP PFNGLRECTXOESPROC) (GLfixed x1, GLfixed y1, GLfixed x2, GLfixed y2); +typedef void (APIENTRYP PFNGLRECTXVOESPROC) (const GLfixed *v1, const GLfixed *v2); +typedef void (APIENTRYP PFNGLTEXCOORD1XOESPROC) (GLfixed s); +typedef void (APIENTRYP PFNGLTEXCOORD1XVOESPROC) (const GLfixed *coords); +typedef void (APIENTRYP PFNGLTEXCOORD2XOESPROC) (GLfixed s, GLfixed t); +typedef void (APIENTRYP PFNGLTEXCOORD2XVOESPROC) (const GLfixed *coords); +typedef void (APIENTRYP PFNGLTEXCOORD3XOESPROC) (GLfixed s, GLfixed t, GLfixed r); +typedef void (APIENTRYP PFNGLTEXCOORD3XVOESPROC) (const GLfixed *coords); +typedef void (APIENTRYP PFNGLTEXCOORD4XOESPROC) (GLfixed s, GLfixed t, GLfixed r, GLfixed q); +typedef void (APIENTRYP PFNGLTEXCOORD4XVOESPROC) (const GLfixed *coords); +typedef void (APIENTRYP PFNGLTEXGENXOESPROC) (GLenum coord, GLenum pname, GLfixed param); +typedef void (APIENTRYP PFNGLTEXGENXVOESPROC) (GLenum coord, GLenum pname, const GLfixed *params); +typedef void (APIENTRYP PFNGLVERTEX2XOESPROC) (GLfixed x); +typedef void (APIENTRYP PFNGLVERTEX2XVOESPROC) (const GLfixed *coords); +typedef void (APIENTRYP PFNGLVERTEX3XOESPROC) (GLfixed x, GLfixed y); +typedef void (APIENTRYP PFNGLVERTEX3XVOESPROC) (const GLfixed *coords); +typedef void (APIENTRYP PFNGLVERTEX4XOESPROC) (GLfixed x, GLfixed y, GLfixed z); +typedef void (APIENTRYP PFNGLVERTEX4XVOESPROC) (const GLfixed *coords); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glAlphaFuncxOES (GLenum func, GLfixed ref); +GLAPI void APIENTRY glClearColorxOES (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); +GLAPI void APIENTRY glClearDepthxOES (GLfixed depth); +GLAPI void APIENTRY glClipPlanexOES (GLenum plane, const GLfixed *equation); +GLAPI void APIENTRY glColor4xOES (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); +GLAPI void APIENTRY glDepthRangexOES (GLfixed n, GLfixed f); +GLAPI void APIENTRY glFogxOES (GLenum pname, GLfixed param); +GLAPI void APIENTRY glFogxvOES (GLenum pname, const GLfixed *param); +GLAPI void APIENTRY glFrustumxOES (GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f); +GLAPI void APIENTRY glGetClipPlanexOES (GLenum plane, GLfixed *equation); +GLAPI void APIENTRY glGetFixedvOES (GLenum pname, GLfixed *params); +GLAPI void APIENTRY glGetTexEnvxvOES (GLenum target, GLenum pname, GLfixed *params); +GLAPI void APIENTRY glGetTexParameterxvOES (GLenum target, GLenum pname, GLfixed *params); +GLAPI void APIENTRY glLightModelxOES (GLenum pname, GLfixed param); +GLAPI void APIENTRY glLightModelxvOES (GLenum pname, const GLfixed *param); +GLAPI void APIENTRY glLightxOES (GLenum light, GLenum pname, GLfixed param); +GLAPI void APIENTRY glLightxvOES (GLenum light, GLenum pname, const GLfixed *params); +GLAPI void APIENTRY glLineWidthxOES (GLfixed width); +GLAPI void APIENTRY glLoadMatrixxOES (const GLfixed *m); +GLAPI void APIENTRY glMaterialxOES (GLenum face, GLenum pname, GLfixed param); +GLAPI void APIENTRY glMaterialxvOES (GLenum face, GLenum pname, const GLfixed *param); +GLAPI void APIENTRY glMultMatrixxOES (const GLfixed *m); +GLAPI void APIENTRY glMultiTexCoord4xOES (GLenum texture, GLfixed s, GLfixed t, GLfixed r, GLfixed q); +GLAPI void APIENTRY glNormal3xOES (GLfixed nx, GLfixed ny, GLfixed nz); +GLAPI void APIENTRY glOrthoxOES (GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f); +GLAPI void APIENTRY glPointParameterxvOES (GLenum pname, const GLfixed *params); +GLAPI void APIENTRY glPointSizexOES (GLfixed size); +GLAPI void APIENTRY glPolygonOffsetxOES (GLfixed factor, GLfixed units); +GLAPI void APIENTRY glRotatexOES (GLfixed angle, GLfixed x, GLfixed y, GLfixed z); +GLAPI void APIENTRY glSampleCoverageOES (GLfixed value, GLboolean invert); +GLAPI void APIENTRY glScalexOES (GLfixed x, GLfixed y, GLfixed z); +GLAPI void APIENTRY glTexEnvxOES (GLenum target, GLenum pname, GLfixed param); +GLAPI void APIENTRY glTexEnvxvOES (GLenum target, GLenum pname, const GLfixed *params); +GLAPI void APIENTRY glTexParameterxOES (GLenum target, GLenum pname, GLfixed param); +GLAPI void APIENTRY glTexParameterxvOES (GLenum target, GLenum pname, const GLfixed *params); +GLAPI void APIENTRY glTranslatexOES (GLfixed x, GLfixed y, GLfixed z); +GLAPI void APIENTRY glAccumxOES (GLenum op, GLfixed value); +GLAPI void APIENTRY glBitmapxOES (GLsizei width, GLsizei height, GLfixed xorig, GLfixed yorig, GLfixed xmove, GLfixed ymove, const GLubyte *bitmap); +GLAPI void APIENTRY glBlendColorxOES (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); +GLAPI void APIENTRY glClearAccumxOES (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); +GLAPI void APIENTRY glColor3xOES (GLfixed red, GLfixed green, GLfixed blue); +GLAPI void APIENTRY glColor3xvOES (const GLfixed *components); +GLAPI void APIENTRY glColor4xvOES (const GLfixed *components); +GLAPI void APIENTRY glConvolutionParameterxOES (GLenum target, GLenum pname, GLfixed param); +GLAPI void APIENTRY glConvolutionParameterxvOES (GLenum target, GLenum pname, const GLfixed *params); +GLAPI void APIENTRY glEvalCoord1xOES (GLfixed u); +GLAPI void APIENTRY glEvalCoord1xvOES (const GLfixed *coords); +GLAPI void APIENTRY glEvalCoord2xOES (GLfixed u, GLfixed v); +GLAPI void APIENTRY glEvalCoord2xvOES (const GLfixed *coords); +GLAPI void APIENTRY glFeedbackBufferxOES (GLsizei n, GLenum type, const GLfixed *buffer); +GLAPI void APIENTRY glGetConvolutionParameterxvOES (GLenum target, GLenum pname, GLfixed *params); +GLAPI void APIENTRY glGetHistogramParameterxvOES (GLenum target, GLenum pname, GLfixed *params); +GLAPI void APIENTRY glGetLightxOES (GLenum light, GLenum pname, GLfixed *params); +GLAPI void APIENTRY glGetMapxvOES (GLenum target, GLenum query, GLfixed *v); +GLAPI void APIENTRY glGetMaterialxOES (GLenum face, GLenum pname, GLfixed param); +GLAPI void APIENTRY glGetPixelMapxv (GLenum map, GLint size, GLfixed *values); +GLAPI void APIENTRY glGetTexGenxvOES (GLenum coord, GLenum pname, GLfixed *params); +GLAPI void APIENTRY glGetTexLevelParameterxvOES (GLenum target, GLint level, GLenum pname, GLfixed *params); +GLAPI void APIENTRY glIndexxOES (GLfixed component); +GLAPI void APIENTRY glIndexxvOES (const GLfixed *component); +GLAPI void APIENTRY glLoadTransposeMatrixxOES (const GLfixed *m); +GLAPI void APIENTRY glMap1xOES (GLenum target, GLfixed u1, GLfixed u2, GLint stride, GLint order, GLfixed points); +GLAPI void APIENTRY glMap2xOES (GLenum target, GLfixed u1, GLfixed u2, GLint ustride, GLint uorder, GLfixed v1, GLfixed v2, GLint vstride, GLint vorder, GLfixed points); +GLAPI void APIENTRY glMapGrid1xOES (GLint n, GLfixed u1, GLfixed u2); +GLAPI void APIENTRY glMapGrid2xOES (GLint n, GLfixed u1, GLfixed u2, GLfixed v1, GLfixed v2); +GLAPI void APIENTRY glMultTransposeMatrixxOES (const GLfixed *m); +GLAPI void APIENTRY glMultiTexCoord1xOES (GLenum texture, GLfixed s); +GLAPI void APIENTRY glMultiTexCoord1xvOES (GLenum texture, const GLfixed *coords); +GLAPI void APIENTRY glMultiTexCoord2xOES (GLenum texture, GLfixed s, GLfixed t); +GLAPI void APIENTRY glMultiTexCoord2xvOES (GLenum texture, const GLfixed *coords); +GLAPI void APIENTRY glMultiTexCoord3xOES (GLenum texture, GLfixed s, GLfixed t, GLfixed r); +GLAPI void APIENTRY glMultiTexCoord3xvOES (GLenum texture, const GLfixed *coords); +GLAPI void APIENTRY glMultiTexCoord4xvOES (GLenum texture, const GLfixed *coords); +GLAPI void APIENTRY glNormal3xvOES (const GLfixed *coords); +GLAPI void APIENTRY glPassThroughxOES (GLfixed token); +GLAPI void APIENTRY glPixelMapx (GLenum map, GLint size, const GLfixed *values); +GLAPI void APIENTRY glPixelStorex (GLenum pname, GLfixed param); +GLAPI void APIENTRY glPixelTransferxOES (GLenum pname, GLfixed param); +GLAPI void APIENTRY glPixelZoomxOES (GLfixed xfactor, GLfixed yfactor); +GLAPI void APIENTRY glPrioritizeTexturesxOES (GLsizei n, const GLuint *textures, const GLfixed *priorities); +GLAPI void APIENTRY glRasterPos2xOES (GLfixed x, GLfixed y); +GLAPI void APIENTRY glRasterPos2xvOES (const GLfixed *coords); +GLAPI void APIENTRY glRasterPos3xOES (GLfixed x, GLfixed y, GLfixed z); +GLAPI void APIENTRY glRasterPos3xvOES (const GLfixed *coords); +GLAPI void APIENTRY glRasterPos4xOES (GLfixed x, GLfixed y, GLfixed z, GLfixed w); +GLAPI void APIENTRY glRasterPos4xvOES (const GLfixed *coords); +GLAPI void APIENTRY glRectxOES (GLfixed x1, GLfixed y1, GLfixed x2, GLfixed y2); +GLAPI void APIENTRY glRectxvOES (const GLfixed *v1, const GLfixed *v2); +GLAPI void APIENTRY glTexCoord1xOES (GLfixed s); +GLAPI void APIENTRY glTexCoord1xvOES (const GLfixed *coords); +GLAPI void APIENTRY glTexCoord2xOES (GLfixed s, GLfixed t); +GLAPI void APIENTRY glTexCoord2xvOES (const GLfixed *coords); +GLAPI void APIENTRY glTexCoord3xOES (GLfixed s, GLfixed t, GLfixed r); +GLAPI void APIENTRY glTexCoord3xvOES (const GLfixed *coords); +GLAPI void APIENTRY glTexCoord4xOES (GLfixed s, GLfixed t, GLfixed r, GLfixed q); +GLAPI void APIENTRY glTexCoord4xvOES (const GLfixed *coords); +GLAPI void APIENTRY glTexGenxOES (GLenum coord, GLenum pname, GLfixed param); +GLAPI void APIENTRY glTexGenxvOES (GLenum coord, GLenum pname, const GLfixed *params); +GLAPI void APIENTRY glVertex2xOES (GLfixed x); +GLAPI void APIENTRY glVertex2xvOES (const GLfixed *coords); +GLAPI void APIENTRY glVertex3xOES (GLfixed x, GLfixed y); +GLAPI void APIENTRY glVertex3xvOES (const GLfixed *coords); +GLAPI void APIENTRY glVertex4xOES (GLfixed x, GLfixed y, GLfixed z); +GLAPI void APIENTRY glVertex4xvOES (const GLfixed *coords); +#endif +#endif /* GL_OES_fixed_point */ + +#ifndef GL_OES_query_matrix +#define GL_OES_query_matrix 1 +typedef GLbitfield (APIENTRYP PFNGLQUERYMATRIXXOESPROC) (GLfixed *mantissa, GLint *exponent); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLbitfield APIENTRY glQueryMatrixxOES (GLfixed *mantissa, GLint *exponent); +#endif +#endif /* GL_OES_query_matrix */ + +#ifndef GL_OES_read_format +#define GL_OES_read_format 1 +#define GL_IMPLEMENTATION_COLOR_READ_TYPE_OES 0x8B9A +#define GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES 0x8B9B +#endif /* GL_OES_read_format */ + +#ifndef GL_OES_single_precision +#define GL_OES_single_precision 1 +typedef void (APIENTRYP PFNGLCLEARDEPTHFOESPROC) (GLclampf depth); +typedef void (APIENTRYP PFNGLCLIPPLANEFOESPROC) (GLenum plane, const GLfloat *equation); +typedef void (APIENTRYP PFNGLDEPTHRANGEFOESPROC) (GLclampf n, GLclampf f); +typedef void (APIENTRYP PFNGLFRUSTUMFOESPROC) (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f); +typedef void (APIENTRYP PFNGLGETCLIPPLANEFOESPROC) (GLenum plane, GLfloat *equation); +typedef void (APIENTRYP PFNGLORTHOFOESPROC) (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glClearDepthfOES (GLclampf depth); +GLAPI void APIENTRY glClipPlanefOES (GLenum plane, const GLfloat *equation); +GLAPI void APIENTRY glDepthRangefOES (GLclampf n, GLclampf f); +GLAPI void APIENTRY glFrustumfOES (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f); +GLAPI void APIENTRY glGetClipPlanefOES (GLenum plane, GLfloat *equation); +GLAPI void APIENTRY glOrthofOES (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f); +#endif +#endif /* GL_OES_single_precision */ + +#ifndef GL_3DFX_multisample +#define GL_3DFX_multisample 1 +#define GL_MULTISAMPLE_3DFX 0x86B2 +#define GL_SAMPLE_BUFFERS_3DFX 0x86B3 +#define GL_SAMPLES_3DFX 0x86B4 +#define GL_MULTISAMPLE_BIT_3DFX 0x20000000 +#endif /* GL_3DFX_multisample */ + +#ifndef GL_3DFX_tbuffer +#define GL_3DFX_tbuffer 1 +typedef void (APIENTRYP PFNGLTBUFFERMASK3DFXPROC) (GLuint mask); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTbufferMask3DFX (GLuint mask); +#endif +#endif /* GL_3DFX_tbuffer */ + +#ifndef GL_3DFX_texture_compression_FXT1 +#define GL_3DFX_texture_compression_FXT1 1 +#define GL_COMPRESSED_RGB_FXT1_3DFX 0x86B0 +#define GL_COMPRESSED_RGBA_FXT1_3DFX 0x86B1 +#endif /* GL_3DFX_texture_compression_FXT1 */ + +#ifndef GL_AMD_blend_minmax_factor +#define GL_AMD_blend_minmax_factor 1 +#define GL_FACTOR_MIN_AMD 0x901C +#define GL_FACTOR_MAX_AMD 0x901D +#endif /* GL_AMD_blend_minmax_factor */ + +#ifndef GL_AMD_conservative_depth +#define GL_AMD_conservative_depth 1 +#endif /* GL_AMD_conservative_depth */ + +#ifndef GL_AMD_debug_output +#define GL_AMD_debug_output 1 +typedef void (APIENTRY *GLDEBUGPROCAMD)(GLuint id,GLenum category,GLenum severity,GLsizei length,const GLchar *message,void *userParam); +#define GL_MAX_DEBUG_MESSAGE_LENGTH_AMD 0x9143 +#define GL_MAX_DEBUG_LOGGED_MESSAGES_AMD 0x9144 +#define GL_DEBUG_LOGGED_MESSAGES_AMD 0x9145 +#define GL_DEBUG_SEVERITY_HIGH_AMD 0x9146 +#define GL_DEBUG_SEVERITY_MEDIUM_AMD 0x9147 +#define GL_DEBUG_SEVERITY_LOW_AMD 0x9148 +#define GL_DEBUG_CATEGORY_API_ERROR_AMD 0x9149 +#define GL_DEBUG_CATEGORY_WINDOW_SYSTEM_AMD 0x914A +#define GL_DEBUG_CATEGORY_DEPRECATION_AMD 0x914B +#define GL_DEBUG_CATEGORY_UNDEFINED_BEHAVIOR_AMD 0x914C +#define GL_DEBUG_CATEGORY_PERFORMANCE_AMD 0x914D +#define GL_DEBUG_CATEGORY_SHADER_COMPILER_AMD 0x914E +#define GL_DEBUG_CATEGORY_APPLICATION_AMD 0x914F +#define GL_DEBUG_CATEGORY_OTHER_AMD 0x9150 +typedef void (APIENTRYP PFNGLDEBUGMESSAGEENABLEAMDPROC) (GLenum category, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); +typedef void (APIENTRYP PFNGLDEBUGMESSAGEINSERTAMDPROC) (GLenum category, GLenum severity, GLuint id, GLsizei length, const GLchar *buf); +typedef void (APIENTRYP PFNGLDEBUGMESSAGECALLBACKAMDPROC) (GLDEBUGPROCAMD callback, void *userParam); +typedef GLuint (APIENTRYP PFNGLGETDEBUGMESSAGELOGAMDPROC) (GLuint count, GLsizei bufsize, GLenum *categories, GLuint *severities, GLuint *ids, GLsizei *lengths, GLchar *message); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDebugMessageEnableAMD (GLenum category, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); +GLAPI void APIENTRY glDebugMessageInsertAMD (GLenum category, GLenum severity, GLuint id, GLsizei length, const GLchar *buf); +GLAPI void APIENTRY glDebugMessageCallbackAMD (GLDEBUGPROCAMD callback, void *userParam); +GLAPI GLuint APIENTRY glGetDebugMessageLogAMD (GLuint count, GLsizei bufsize, GLenum *categories, GLuint *severities, GLuint *ids, GLsizei *lengths, GLchar *message); +#endif +#endif /* GL_AMD_debug_output */ + +#ifndef GL_AMD_depth_clamp_separate +#define GL_AMD_depth_clamp_separate 1 +#define GL_DEPTH_CLAMP_NEAR_AMD 0x901E +#define GL_DEPTH_CLAMP_FAR_AMD 0x901F +#endif /* GL_AMD_depth_clamp_separate */ + +#ifndef GL_AMD_draw_buffers_blend +#define GL_AMD_draw_buffers_blend 1 +typedef void (APIENTRYP PFNGLBLENDFUNCINDEXEDAMDPROC) (GLuint buf, GLenum src, GLenum dst); +typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEINDEXEDAMDPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +typedef void (APIENTRYP PFNGLBLENDEQUATIONINDEXEDAMDPROC) (GLuint buf, GLenum mode); +typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEINDEXEDAMDPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendFuncIndexedAMD (GLuint buf, GLenum src, GLenum dst); +GLAPI void APIENTRY glBlendFuncSeparateIndexedAMD (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +GLAPI void APIENTRY glBlendEquationIndexedAMD (GLuint buf, GLenum mode); +GLAPI void APIENTRY glBlendEquationSeparateIndexedAMD (GLuint buf, GLenum modeRGB, GLenum modeAlpha); +#endif +#endif /* GL_AMD_draw_buffers_blend */ + +#ifndef GL_AMD_gcn_shader +#define GL_AMD_gcn_shader 1 +#endif /* GL_AMD_gcn_shader */ + +#ifndef GL_AMD_gpu_shader_int64 +#define GL_AMD_gpu_shader_int64 1 +typedef int64_t GLint64EXT; +#define GL_INT64_NV 0x140E +#define GL_UNSIGNED_INT64_NV 0x140F +#define GL_INT8_NV 0x8FE0 +#define GL_INT8_VEC2_NV 0x8FE1 +#define GL_INT8_VEC3_NV 0x8FE2 +#define GL_INT8_VEC4_NV 0x8FE3 +#define GL_INT16_NV 0x8FE4 +#define GL_INT16_VEC2_NV 0x8FE5 +#define GL_INT16_VEC3_NV 0x8FE6 +#define GL_INT16_VEC4_NV 0x8FE7 +#define GL_INT64_VEC2_NV 0x8FE9 +#define GL_INT64_VEC3_NV 0x8FEA +#define GL_INT64_VEC4_NV 0x8FEB +#define GL_UNSIGNED_INT8_NV 0x8FEC +#define GL_UNSIGNED_INT8_VEC2_NV 0x8FED +#define GL_UNSIGNED_INT8_VEC3_NV 0x8FEE +#define GL_UNSIGNED_INT8_VEC4_NV 0x8FEF +#define GL_UNSIGNED_INT16_NV 0x8FF0 +#define GL_UNSIGNED_INT16_VEC2_NV 0x8FF1 +#define GL_UNSIGNED_INT16_VEC3_NV 0x8FF2 +#define GL_UNSIGNED_INT16_VEC4_NV 0x8FF3 +#define GL_UNSIGNED_INT64_VEC2_NV 0x8FF5 +#define GL_UNSIGNED_INT64_VEC3_NV 0x8FF6 +#define GL_UNSIGNED_INT64_VEC4_NV 0x8FF7 +#define GL_FLOAT16_NV 0x8FF8 +#define GL_FLOAT16_VEC2_NV 0x8FF9 +#define GL_FLOAT16_VEC3_NV 0x8FFA +#define GL_FLOAT16_VEC4_NV 0x8FFB +typedef void (APIENTRYP PFNGLUNIFORM1I64NVPROC) (GLint location, GLint64EXT x); +typedef void (APIENTRYP PFNGLUNIFORM2I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y); +typedef void (APIENTRYP PFNGLUNIFORM3I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z); +typedef void (APIENTRYP PFNGLUNIFORM4I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); +typedef void (APIENTRYP PFNGLUNIFORM1I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value); +typedef void (APIENTRYP PFNGLUNIFORM2I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value); +typedef void (APIENTRYP PFNGLUNIFORM3I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value); +typedef void (APIENTRYP PFNGLUNIFORM4I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value); +typedef void (APIENTRYP PFNGLUNIFORM1UI64NVPROC) (GLint location, GLuint64EXT x); +typedef void (APIENTRYP PFNGLUNIFORM2UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y); +typedef void (APIENTRYP PFNGLUNIFORM3UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); +typedef void (APIENTRYP PFNGLUNIFORM4UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); +typedef void (APIENTRYP PFNGLUNIFORM1UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (APIENTRYP PFNGLUNIFORM2UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (APIENTRYP PFNGLUNIFORM3UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (APIENTRYP PFNGLUNIFORM4UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (APIENTRYP PFNGLGETUNIFORMI64VNVPROC) (GLuint program, GLint location, GLint64EXT *params); +typedef void (APIENTRYP PFNGLGETUNIFORMUI64VNVPROC) (GLuint program, GLint location, GLuint64EXT *params); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1I64NVPROC) (GLuint program, GLint location, GLint64EXT x); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glUniform1i64NV (GLint location, GLint64EXT x); +GLAPI void APIENTRY glUniform2i64NV (GLint location, GLint64EXT x, GLint64EXT y); +GLAPI void APIENTRY glUniform3i64NV (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z); +GLAPI void APIENTRY glUniform4i64NV (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); +GLAPI void APIENTRY glUniform1i64vNV (GLint location, GLsizei count, const GLint64EXT *value); +GLAPI void APIENTRY glUniform2i64vNV (GLint location, GLsizei count, const GLint64EXT *value); +GLAPI void APIENTRY glUniform3i64vNV (GLint location, GLsizei count, const GLint64EXT *value); +GLAPI void APIENTRY glUniform4i64vNV (GLint location, GLsizei count, const GLint64EXT *value); +GLAPI void APIENTRY glUniform1ui64NV (GLint location, GLuint64EXT x); +GLAPI void APIENTRY glUniform2ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y); +GLAPI void APIENTRY glUniform3ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); +GLAPI void APIENTRY glUniform4ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); +GLAPI void APIENTRY glUniform1ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value); +GLAPI void APIENTRY glUniform2ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value); +GLAPI void APIENTRY glUniform3ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value); +GLAPI void APIENTRY glUniform4ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value); +GLAPI void APIENTRY glGetUniformi64vNV (GLuint program, GLint location, GLint64EXT *params); +GLAPI void APIENTRY glGetUniformui64vNV (GLuint program, GLint location, GLuint64EXT *params); +GLAPI void APIENTRY glProgramUniform1i64NV (GLuint program, GLint location, GLint64EXT x); +GLAPI void APIENTRY glProgramUniform2i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y); +GLAPI void APIENTRY glProgramUniform3i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z); +GLAPI void APIENTRY glProgramUniform4i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); +GLAPI void APIENTRY glProgramUniform1i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +GLAPI void APIENTRY glProgramUniform2i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +GLAPI void APIENTRY glProgramUniform3i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +GLAPI void APIENTRY glProgramUniform4i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +GLAPI void APIENTRY glProgramUniform1ui64NV (GLuint program, GLint location, GLuint64EXT x); +GLAPI void APIENTRY glProgramUniform2ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y); +GLAPI void APIENTRY glProgramUniform3ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); +GLAPI void APIENTRY glProgramUniform4ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); +GLAPI void APIENTRY glProgramUniform1ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +GLAPI void APIENTRY glProgramUniform2ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +GLAPI void APIENTRY glProgramUniform3ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +GLAPI void APIENTRY glProgramUniform4ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +#endif +#endif /* GL_AMD_gpu_shader_int64 */ + +#ifndef GL_AMD_interleaved_elements +#define GL_AMD_interleaved_elements 1 +#define GL_VERTEX_ELEMENT_SWIZZLE_AMD 0x91A4 +#define GL_VERTEX_ID_SWIZZLE_AMD 0x91A5 +typedef void (APIENTRYP PFNGLVERTEXATTRIBPARAMETERIAMDPROC) (GLuint index, GLenum pname, GLint param); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexAttribParameteriAMD (GLuint index, GLenum pname, GLint param); +#endif +#endif /* GL_AMD_interleaved_elements */ + +#ifndef GL_AMD_multi_draw_indirect +#define GL_AMD_multi_draw_indirect 1 +typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTAMDPROC) (GLenum mode, const void *indirect, GLsizei primcount, GLsizei stride); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTAMDPROC) (GLenum mode, GLenum type, const void *indirect, GLsizei primcount, GLsizei stride); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMultiDrawArraysIndirectAMD (GLenum mode, const void *indirect, GLsizei primcount, GLsizei stride); +GLAPI void APIENTRY glMultiDrawElementsIndirectAMD (GLenum mode, GLenum type, const void *indirect, GLsizei primcount, GLsizei stride); +#endif +#endif /* GL_AMD_multi_draw_indirect */ + +#ifndef GL_AMD_name_gen_delete +#define GL_AMD_name_gen_delete 1 +#define GL_DATA_BUFFER_AMD 0x9151 +#define GL_PERFORMANCE_MONITOR_AMD 0x9152 +#define GL_QUERY_OBJECT_AMD 0x9153 +#define GL_VERTEX_ARRAY_OBJECT_AMD 0x9154 +#define GL_SAMPLER_OBJECT_AMD 0x9155 +typedef void (APIENTRYP PFNGLGENNAMESAMDPROC) (GLenum identifier, GLuint num, GLuint *names); +typedef void (APIENTRYP PFNGLDELETENAMESAMDPROC) (GLenum identifier, GLuint num, const GLuint *names); +typedef GLboolean (APIENTRYP PFNGLISNAMEAMDPROC) (GLenum identifier, GLuint name); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGenNamesAMD (GLenum identifier, GLuint num, GLuint *names); +GLAPI void APIENTRY glDeleteNamesAMD (GLenum identifier, GLuint num, const GLuint *names); +GLAPI GLboolean APIENTRY glIsNameAMD (GLenum identifier, GLuint name); +#endif +#endif /* GL_AMD_name_gen_delete */ + +#ifndef GL_AMD_occlusion_query_event +#define GL_AMD_occlusion_query_event 1 +#define GL_OCCLUSION_QUERY_EVENT_MASK_AMD 0x874F +#define GL_QUERY_DEPTH_PASS_EVENT_BIT_AMD 0x00000001 +#define GL_QUERY_DEPTH_FAIL_EVENT_BIT_AMD 0x00000002 +#define GL_QUERY_STENCIL_FAIL_EVENT_BIT_AMD 0x00000004 +#define GL_QUERY_DEPTH_BOUNDS_FAIL_EVENT_BIT_AMD 0x00000008 +#define GL_QUERY_ALL_EVENT_BITS_AMD 0xFFFFFFFF +typedef void (APIENTRYP PFNGLQUERYOBJECTPARAMETERUIAMDPROC) (GLenum target, GLuint id, GLenum pname, GLuint param); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glQueryObjectParameteruiAMD (GLenum target, GLuint id, GLenum pname, GLuint param); +#endif +#endif /* GL_AMD_occlusion_query_event */ + +#ifndef GL_AMD_performance_monitor +#define GL_AMD_performance_monitor 1 +#define GL_COUNTER_TYPE_AMD 0x8BC0 +#define GL_COUNTER_RANGE_AMD 0x8BC1 +#define GL_UNSIGNED_INT64_AMD 0x8BC2 +#define GL_PERCENTAGE_AMD 0x8BC3 +#define GL_PERFMON_RESULT_AVAILABLE_AMD 0x8BC4 +#define GL_PERFMON_RESULT_SIZE_AMD 0x8BC5 +#define GL_PERFMON_RESULT_AMD 0x8BC6 +typedef void (APIENTRYP PFNGLGETPERFMONITORGROUPSAMDPROC) (GLint *numGroups, GLsizei groupsSize, GLuint *groups); +typedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERSAMDPROC) (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters); +typedef void (APIENTRYP PFNGLGETPERFMONITORGROUPSTRINGAMDPROC) (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString); +typedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC) (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString); +typedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERINFOAMDPROC) (GLuint group, GLuint counter, GLenum pname, void *data); +typedef void (APIENTRYP PFNGLGENPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors); +typedef void (APIENTRYP PFNGLDELETEPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors); +typedef void (APIENTRYP PFNGLSELECTPERFMONITORCOUNTERSAMDPROC) (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *counterList); +typedef void (APIENTRYP PFNGLBEGINPERFMONITORAMDPROC) (GLuint monitor); +typedef void (APIENTRYP PFNGLENDPERFMONITORAMDPROC) (GLuint monitor); +typedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERDATAAMDPROC) (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetPerfMonitorGroupsAMD (GLint *numGroups, GLsizei groupsSize, GLuint *groups); +GLAPI void APIENTRY glGetPerfMonitorCountersAMD (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters); +GLAPI void APIENTRY glGetPerfMonitorGroupStringAMD (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString); +GLAPI void APIENTRY glGetPerfMonitorCounterStringAMD (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString); +GLAPI void APIENTRY glGetPerfMonitorCounterInfoAMD (GLuint group, GLuint counter, GLenum pname, void *data); +GLAPI void APIENTRY glGenPerfMonitorsAMD (GLsizei n, GLuint *monitors); +GLAPI void APIENTRY glDeletePerfMonitorsAMD (GLsizei n, GLuint *monitors); +GLAPI void APIENTRY glSelectPerfMonitorCountersAMD (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *counterList); +GLAPI void APIENTRY glBeginPerfMonitorAMD (GLuint monitor); +GLAPI void APIENTRY glEndPerfMonitorAMD (GLuint monitor); +GLAPI void APIENTRY glGetPerfMonitorCounterDataAMD (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten); +#endif +#endif /* GL_AMD_performance_monitor */ + +#ifndef GL_AMD_pinned_memory +#define GL_AMD_pinned_memory 1 +#define GL_EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD 0x9160 +#endif /* GL_AMD_pinned_memory */ + +#ifndef GL_AMD_query_buffer_object +#define GL_AMD_query_buffer_object 1 +#define GL_QUERY_BUFFER_AMD 0x9192 +#define GL_QUERY_BUFFER_BINDING_AMD 0x9193 +#define GL_QUERY_RESULT_NO_WAIT_AMD 0x9194 +#endif /* GL_AMD_query_buffer_object */ + +#ifndef GL_AMD_sample_positions +#define GL_AMD_sample_positions 1 +#define GL_SUBSAMPLE_DISTANCE_AMD 0x883F +typedef void (APIENTRYP PFNGLSETMULTISAMPLEFVAMDPROC) (GLenum pname, GLuint index, const GLfloat *val); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSetMultisamplefvAMD (GLenum pname, GLuint index, const GLfloat *val); +#endif +#endif /* GL_AMD_sample_positions */ + +#ifndef GL_AMD_seamless_cubemap_per_texture +#define GL_AMD_seamless_cubemap_per_texture 1 +#endif /* GL_AMD_seamless_cubemap_per_texture */ + +#ifndef GL_AMD_shader_atomic_counter_ops +#define GL_AMD_shader_atomic_counter_ops 1 +#endif /* GL_AMD_shader_atomic_counter_ops */ + +#ifndef GL_AMD_shader_stencil_export +#define GL_AMD_shader_stencil_export 1 +#endif /* GL_AMD_shader_stencil_export */ + +#ifndef GL_AMD_shader_trinary_minmax +#define GL_AMD_shader_trinary_minmax 1 +#endif /* GL_AMD_shader_trinary_minmax */ + +#ifndef GL_AMD_sparse_texture +#define GL_AMD_sparse_texture 1 +#define GL_VIRTUAL_PAGE_SIZE_X_AMD 0x9195 +#define GL_VIRTUAL_PAGE_SIZE_Y_AMD 0x9196 +#define GL_VIRTUAL_PAGE_SIZE_Z_AMD 0x9197 +#define GL_MAX_SPARSE_TEXTURE_SIZE_AMD 0x9198 +#define GL_MAX_SPARSE_3D_TEXTURE_SIZE_AMD 0x9199 +#define GL_MAX_SPARSE_ARRAY_TEXTURE_LAYERS 0x919A +#define GL_MIN_SPARSE_LEVEL_AMD 0x919B +#define GL_MIN_LOD_WARNING_AMD 0x919C +#define GL_TEXTURE_STORAGE_SPARSE_BIT_AMD 0x00000001 +typedef void (APIENTRYP PFNGLTEXSTORAGESPARSEAMDPROC) (GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei layers, GLbitfield flags); +typedef void (APIENTRYP PFNGLTEXTURESTORAGESPARSEAMDPROC) (GLuint texture, GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei layers, GLbitfield flags); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexStorageSparseAMD (GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei layers, GLbitfield flags); +GLAPI void APIENTRY glTextureStorageSparseAMD (GLuint texture, GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei layers, GLbitfield flags); +#endif +#endif /* GL_AMD_sparse_texture */ + +#ifndef GL_AMD_stencil_operation_extended +#define GL_AMD_stencil_operation_extended 1 +#define GL_SET_AMD 0x874A +#define GL_REPLACE_VALUE_AMD 0x874B +#define GL_STENCIL_OP_VALUE_AMD 0x874C +#define GL_STENCIL_BACK_OP_VALUE_AMD 0x874D +typedef void (APIENTRYP PFNGLSTENCILOPVALUEAMDPROC) (GLenum face, GLuint value); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glStencilOpValueAMD (GLenum face, GLuint value); +#endif +#endif /* GL_AMD_stencil_operation_extended */ + +#ifndef GL_AMD_texture_texture4 +#define GL_AMD_texture_texture4 1 +#endif /* GL_AMD_texture_texture4 */ + +#ifndef GL_AMD_transform_feedback3_lines_triangles +#define GL_AMD_transform_feedback3_lines_triangles 1 +#endif /* GL_AMD_transform_feedback3_lines_triangles */ + +#ifndef GL_AMD_transform_feedback4 +#define GL_AMD_transform_feedback4 1 +#define GL_STREAM_RASTERIZATION_AMD 0x91A0 +#endif /* GL_AMD_transform_feedback4 */ + +#ifndef GL_AMD_vertex_shader_layer +#define GL_AMD_vertex_shader_layer 1 +#endif /* GL_AMD_vertex_shader_layer */ + +#ifndef GL_AMD_vertex_shader_tessellator +#define GL_AMD_vertex_shader_tessellator 1 +#define GL_SAMPLER_BUFFER_AMD 0x9001 +#define GL_INT_SAMPLER_BUFFER_AMD 0x9002 +#define GL_UNSIGNED_INT_SAMPLER_BUFFER_AMD 0x9003 +#define GL_TESSELLATION_MODE_AMD 0x9004 +#define GL_TESSELLATION_FACTOR_AMD 0x9005 +#define GL_DISCRETE_AMD 0x9006 +#define GL_CONTINUOUS_AMD 0x9007 +typedef void (APIENTRYP PFNGLTESSELLATIONFACTORAMDPROC) (GLfloat factor); +typedef void (APIENTRYP PFNGLTESSELLATIONMODEAMDPROC) (GLenum mode); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTessellationFactorAMD (GLfloat factor); +GLAPI void APIENTRY glTessellationModeAMD (GLenum mode); +#endif +#endif /* GL_AMD_vertex_shader_tessellator */ + +#ifndef GL_AMD_vertex_shader_viewport_index +#define GL_AMD_vertex_shader_viewport_index 1 +#endif /* GL_AMD_vertex_shader_viewport_index */ + +#ifndef GL_APPLE_aux_depth_stencil +#define GL_APPLE_aux_depth_stencil 1 +#define GL_AUX_DEPTH_STENCIL_APPLE 0x8A14 +#endif /* GL_APPLE_aux_depth_stencil */ + +#ifndef GL_APPLE_client_storage +#define GL_APPLE_client_storage 1 +#define GL_UNPACK_CLIENT_STORAGE_APPLE 0x85B2 +#endif /* GL_APPLE_client_storage */ + +#ifndef GL_APPLE_element_array +#define GL_APPLE_element_array 1 +#define GL_ELEMENT_ARRAY_APPLE 0x8A0C +#define GL_ELEMENT_ARRAY_TYPE_APPLE 0x8A0D +#define GL_ELEMENT_ARRAY_POINTER_APPLE 0x8A0E +typedef void (APIENTRYP PFNGLELEMENTPOINTERAPPLEPROC) (GLenum type, const void *pointer); +typedef void (APIENTRYP PFNGLDRAWELEMENTARRAYAPPLEPROC) (GLenum mode, GLint first, GLsizei count); +typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTARRAYAPPLEPROC) (GLenum mode, GLuint start, GLuint end, GLint first, GLsizei count); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTARRAYAPPLEPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); +typedef void (APIENTRYP PFNGLMULTIDRAWRANGEELEMENTARRAYAPPLEPROC) (GLenum mode, GLuint start, GLuint end, const GLint *first, const GLsizei *count, GLsizei primcount); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glElementPointerAPPLE (GLenum type, const void *pointer); +GLAPI void APIENTRY glDrawElementArrayAPPLE (GLenum mode, GLint first, GLsizei count); +GLAPI void APIENTRY glDrawRangeElementArrayAPPLE (GLenum mode, GLuint start, GLuint end, GLint first, GLsizei count); +GLAPI void APIENTRY glMultiDrawElementArrayAPPLE (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); +GLAPI void APIENTRY glMultiDrawRangeElementArrayAPPLE (GLenum mode, GLuint start, GLuint end, const GLint *first, const GLsizei *count, GLsizei primcount); +#endif +#endif /* GL_APPLE_element_array */ + +#ifndef GL_APPLE_fence +#define GL_APPLE_fence 1 +#define GL_DRAW_PIXELS_APPLE 0x8A0A +#define GL_FENCE_APPLE 0x8A0B +typedef void (APIENTRYP PFNGLGENFENCESAPPLEPROC) (GLsizei n, GLuint *fences); +typedef void (APIENTRYP PFNGLDELETEFENCESAPPLEPROC) (GLsizei n, const GLuint *fences); +typedef void (APIENTRYP PFNGLSETFENCEAPPLEPROC) (GLuint fence); +typedef GLboolean (APIENTRYP PFNGLISFENCEAPPLEPROC) (GLuint fence); +typedef GLboolean (APIENTRYP PFNGLTESTFENCEAPPLEPROC) (GLuint fence); +typedef void (APIENTRYP PFNGLFINISHFENCEAPPLEPROC) (GLuint fence); +typedef GLboolean (APIENTRYP PFNGLTESTOBJECTAPPLEPROC) (GLenum object, GLuint name); +typedef void (APIENTRYP PFNGLFINISHOBJECTAPPLEPROC) (GLenum object, GLint name); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGenFencesAPPLE (GLsizei n, GLuint *fences); +GLAPI void APIENTRY glDeleteFencesAPPLE (GLsizei n, const GLuint *fences); +GLAPI void APIENTRY glSetFenceAPPLE (GLuint fence); +GLAPI GLboolean APIENTRY glIsFenceAPPLE (GLuint fence); +GLAPI GLboolean APIENTRY glTestFenceAPPLE (GLuint fence); +GLAPI void APIENTRY glFinishFenceAPPLE (GLuint fence); +GLAPI GLboolean APIENTRY glTestObjectAPPLE (GLenum object, GLuint name); +GLAPI void APIENTRY glFinishObjectAPPLE (GLenum object, GLint name); +#endif +#endif /* GL_APPLE_fence */ + +#ifndef GL_APPLE_float_pixels +#define GL_APPLE_float_pixels 1 +#define GL_HALF_APPLE 0x140B +#define GL_RGBA_FLOAT32_APPLE 0x8814 +#define GL_RGB_FLOAT32_APPLE 0x8815 +#define GL_ALPHA_FLOAT32_APPLE 0x8816 +#define GL_INTENSITY_FLOAT32_APPLE 0x8817 +#define GL_LUMINANCE_FLOAT32_APPLE 0x8818 +#define GL_LUMINANCE_ALPHA_FLOAT32_APPLE 0x8819 +#define GL_RGBA_FLOAT16_APPLE 0x881A +#define GL_RGB_FLOAT16_APPLE 0x881B +#define GL_ALPHA_FLOAT16_APPLE 0x881C +#define GL_INTENSITY_FLOAT16_APPLE 0x881D +#define GL_LUMINANCE_FLOAT16_APPLE 0x881E +#define GL_LUMINANCE_ALPHA_FLOAT16_APPLE 0x881F +#define GL_COLOR_FLOAT_APPLE 0x8A0F +#endif /* GL_APPLE_float_pixels */ + +#ifndef GL_APPLE_flush_buffer_range +#define GL_APPLE_flush_buffer_range 1 +#define GL_BUFFER_SERIALIZED_MODIFY_APPLE 0x8A12 +#define GL_BUFFER_FLUSHING_UNMAP_APPLE 0x8A13 +typedef void (APIENTRYP PFNGLBUFFERPARAMETERIAPPLEPROC) (GLenum target, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEAPPLEPROC) (GLenum target, GLintptr offset, GLsizeiptr size); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBufferParameteriAPPLE (GLenum target, GLenum pname, GLint param); +GLAPI void APIENTRY glFlushMappedBufferRangeAPPLE (GLenum target, GLintptr offset, GLsizeiptr size); +#endif +#endif /* GL_APPLE_flush_buffer_range */ + +#ifndef GL_APPLE_object_purgeable +#define GL_APPLE_object_purgeable 1 +#define GL_BUFFER_OBJECT_APPLE 0x85B3 +#define GL_RELEASED_APPLE 0x8A19 +#define GL_VOLATILE_APPLE 0x8A1A +#define GL_RETAINED_APPLE 0x8A1B +#define GL_UNDEFINED_APPLE 0x8A1C +#define GL_PURGEABLE_APPLE 0x8A1D +typedef GLenum (APIENTRYP PFNGLOBJECTPURGEABLEAPPLEPROC) (GLenum objectType, GLuint name, GLenum option); +typedef GLenum (APIENTRYP PFNGLOBJECTUNPURGEABLEAPPLEPROC) (GLenum objectType, GLuint name, GLenum option); +typedef void (APIENTRYP PFNGLGETOBJECTPARAMETERIVAPPLEPROC) (GLenum objectType, GLuint name, GLenum pname, GLint *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLenum APIENTRY glObjectPurgeableAPPLE (GLenum objectType, GLuint name, GLenum option); +GLAPI GLenum APIENTRY glObjectUnpurgeableAPPLE (GLenum objectType, GLuint name, GLenum option); +GLAPI void APIENTRY glGetObjectParameterivAPPLE (GLenum objectType, GLuint name, GLenum pname, GLint *params); +#endif +#endif /* GL_APPLE_object_purgeable */ + +#ifndef GL_APPLE_rgb_422 +#define GL_APPLE_rgb_422 1 +#define GL_RGB_422_APPLE 0x8A1F +#define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA +#define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB +#define GL_RGB_RAW_422_APPLE 0x8A51 +#endif /* GL_APPLE_rgb_422 */ + +#ifndef GL_APPLE_row_bytes +#define GL_APPLE_row_bytes 1 +#define GL_PACK_ROW_BYTES_APPLE 0x8A15 +#define GL_UNPACK_ROW_BYTES_APPLE 0x8A16 +#endif /* GL_APPLE_row_bytes */ + +#ifndef GL_APPLE_specular_vector +#define GL_APPLE_specular_vector 1 +#define GL_LIGHT_MODEL_SPECULAR_VECTOR_APPLE 0x85B0 +#endif /* GL_APPLE_specular_vector */ + +#ifndef GL_APPLE_texture_range +#define GL_APPLE_texture_range 1 +#define GL_TEXTURE_RANGE_LENGTH_APPLE 0x85B7 +#define GL_TEXTURE_RANGE_POINTER_APPLE 0x85B8 +#define GL_TEXTURE_STORAGE_HINT_APPLE 0x85BC +#define GL_STORAGE_PRIVATE_APPLE 0x85BD +#define GL_STORAGE_CACHED_APPLE 0x85BE +#define GL_STORAGE_SHARED_APPLE 0x85BF +typedef void (APIENTRYP PFNGLTEXTURERANGEAPPLEPROC) (GLenum target, GLsizei length, const void *pointer); +typedef void (APIENTRYP PFNGLGETTEXPARAMETERPOINTERVAPPLEPROC) (GLenum target, GLenum pname, void **params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTextureRangeAPPLE (GLenum target, GLsizei length, const void *pointer); +GLAPI void APIENTRY glGetTexParameterPointervAPPLE (GLenum target, GLenum pname, void **params); +#endif +#endif /* GL_APPLE_texture_range */ + +#ifndef GL_APPLE_transform_hint +#define GL_APPLE_transform_hint 1 +#define GL_TRANSFORM_HINT_APPLE 0x85B1 +#endif /* GL_APPLE_transform_hint */ + +#ifndef GL_APPLE_vertex_array_object +#define GL_APPLE_vertex_array_object 1 +#define GL_VERTEX_ARRAY_BINDING_APPLE 0x85B5 +typedef void (APIENTRYP PFNGLBINDVERTEXARRAYAPPLEPROC) (GLuint array); +typedef void (APIENTRYP PFNGLDELETEVERTEXARRAYSAPPLEPROC) (GLsizei n, const GLuint *arrays); +typedef void (APIENTRYP PFNGLGENVERTEXARRAYSAPPLEPROC) (GLsizei n, GLuint *arrays); +typedef GLboolean (APIENTRYP PFNGLISVERTEXARRAYAPPLEPROC) (GLuint array); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBindVertexArrayAPPLE (GLuint array); +GLAPI void APIENTRY glDeleteVertexArraysAPPLE (GLsizei n, const GLuint *arrays); +GLAPI void APIENTRY glGenVertexArraysAPPLE (GLsizei n, GLuint *arrays); +GLAPI GLboolean APIENTRY glIsVertexArrayAPPLE (GLuint array); +#endif +#endif /* GL_APPLE_vertex_array_object */ + +#ifndef GL_APPLE_vertex_array_range +#define GL_APPLE_vertex_array_range 1 +#define GL_VERTEX_ARRAY_RANGE_APPLE 0x851D +#define GL_VERTEX_ARRAY_RANGE_LENGTH_APPLE 0x851E +#define GL_VERTEX_ARRAY_STORAGE_HINT_APPLE 0x851F +#define GL_VERTEX_ARRAY_RANGE_POINTER_APPLE 0x8521 +#define GL_STORAGE_CLIENT_APPLE 0x85B4 +typedef void (APIENTRYP PFNGLVERTEXARRAYRANGEAPPLEPROC) (GLsizei length, void *pointer); +typedef void (APIENTRYP PFNGLFLUSHVERTEXARRAYRANGEAPPLEPROC) (GLsizei length, void *pointer); +typedef void (APIENTRYP PFNGLVERTEXARRAYPARAMETERIAPPLEPROC) (GLenum pname, GLint param); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexArrayRangeAPPLE (GLsizei length, void *pointer); +GLAPI void APIENTRY glFlushVertexArrayRangeAPPLE (GLsizei length, void *pointer); +GLAPI void APIENTRY glVertexArrayParameteriAPPLE (GLenum pname, GLint param); +#endif +#endif /* GL_APPLE_vertex_array_range */ + +#ifndef GL_APPLE_vertex_program_evaluators +#define GL_APPLE_vertex_program_evaluators 1 +#define GL_VERTEX_ATTRIB_MAP1_APPLE 0x8A00 +#define GL_VERTEX_ATTRIB_MAP2_APPLE 0x8A01 +#define GL_VERTEX_ATTRIB_MAP1_SIZE_APPLE 0x8A02 +#define GL_VERTEX_ATTRIB_MAP1_COEFF_APPLE 0x8A03 +#define GL_VERTEX_ATTRIB_MAP1_ORDER_APPLE 0x8A04 +#define GL_VERTEX_ATTRIB_MAP1_DOMAIN_APPLE 0x8A05 +#define GL_VERTEX_ATTRIB_MAP2_SIZE_APPLE 0x8A06 +#define GL_VERTEX_ATTRIB_MAP2_COEFF_APPLE 0x8A07 +#define GL_VERTEX_ATTRIB_MAP2_ORDER_APPLE 0x8A08 +#define GL_VERTEX_ATTRIB_MAP2_DOMAIN_APPLE 0x8A09 +typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBAPPLEPROC) (GLuint index, GLenum pname); +typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBAPPLEPROC) (GLuint index, GLenum pname); +typedef GLboolean (APIENTRYP PFNGLISVERTEXATTRIBENABLEDAPPLEPROC) (GLuint index, GLenum pname); +typedef void (APIENTRYP PFNGLMAPVERTEXATTRIB1DAPPLEPROC) (GLuint index, GLuint size, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points); +typedef void (APIENTRYP PFNGLMAPVERTEXATTRIB1FAPPLEPROC) (GLuint index, GLuint size, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points); +typedef void (APIENTRYP PFNGLMAPVERTEXATTRIB2DAPPLEPROC) (GLuint index, GLuint size, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points); +typedef void (APIENTRYP PFNGLMAPVERTEXATTRIB2FAPPLEPROC) (GLuint index, GLuint size, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glEnableVertexAttribAPPLE (GLuint index, GLenum pname); +GLAPI void APIENTRY glDisableVertexAttribAPPLE (GLuint index, GLenum pname); +GLAPI GLboolean APIENTRY glIsVertexAttribEnabledAPPLE (GLuint index, GLenum pname); +GLAPI void APIENTRY glMapVertexAttrib1dAPPLE (GLuint index, GLuint size, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points); +GLAPI void APIENTRY glMapVertexAttrib1fAPPLE (GLuint index, GLuint size, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points); +GLAPI void APIENTRY glMapVertexAttrib2dAPPLE (GLuint index, GLuint size, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points); +GLAPI void APIENTRY glMapVertexAttrib2fAPPLE (GLuint index, GLuint size, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points); +#endif +#endif /* GL_APPLE_vertex_program_evaluators */ + +#ifndef GL_APPLE_ycbcr_422 +#define GL_APPLE_ycbcr_422 1 +#define GL_YCBCR_422_APPLE 0x85B9 +#endif /* GL_APPLE_ycbcr_422 */ + +#ifndef GL_ATI_draw_buffers +#define GL_ATI_draw_buffers 1 +#define GL_MAX_DRAW_BUFFERS_ATI 0x8824 +#define GL_DRAW_BUFFER0_ATI 0x8825 +#define GL_DRAW_BUFFER1_ATI 0x8826 +#define GL_DRAW_BUFFER2_ATI 0x8827 +#define GL_DRAW_BUFFER3_ATI 0x8828 +#define GL_DRAW_BUFFER4_ATI 0x8829 +#define GL_DRAW_BUFFER5_ATI 0x882A +#define GL_DRAW_BUFFER6_ATI 0x882B +#define GL_DRAW_BUFFER7_ATI 0x882C +#define GL_DRAW_BUFFER8_ATI 0x882D +#define GL_DRAW_BUFFER9_ATI 0x882E +#define GL_DRAW_BUFFER10_ATI 0x882F +#define GL_DRAW_BUFFER11_ATI 0x8830 +#define GL_DRAW_BUFFER12_ATI 0x8831 +#define GL_DRAW_BUFFER13_ATI 0x8832 +#define GL_DRAW_BUFFER14_ATI 0x8833 +#define GL_DRAW_BUFFER15_ATI 0x8834 +typedef void (APIENTRYP PFNGLDRAWBUFFERSATIPROC) (GLsizei n, const GLenum *bufs); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawBuffersATI (GLsizei n, const GLenum *bufs); +#endif +#endif /* GL_ATI_draw_buffers */ + +#ifndef GL_ATI_element_array +#define GL_ATI_element_array 1 +#define GL_ELEMENT_ARRAY_ATI 0x8768 +#define GL_ELEMENT_ARRAY_TYPE_ATI 0x8769 +#define GL_ELEMENT_ARRAY_POINTER_ATI 0x876A +typedef void (APIENTRYP PFNGLELEMENTPOINTERATIPROC) (GLenum type, const void *pointer); +typedef void (APIENTRYP PFNGLDRAWELEMENTARRAYATIPROC) (GLenum mode, GLsizei count); +typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTARRAYATIPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glElementPointerATI (GLenum type, const void *pointer); +GLAPI void APIENTRY glDrawElementArrayATI (GLenum mode, GLsizei count); +GLAPI void APIENTRY glDrawRangeElementArrayATI (GLenum mode, GLuint start, GLuint end, GLsizei count); +#endif +#endif /* GL_ATI_element_array */ + +#ifndef GL_ATI_envmap_bumpmap +#define GL_ATI_envmap_bumpmap 1 +#define GL_BUMP_ROT_MATRIX_ATI 0x8775 +#define GL_BUMP_ROT_MATRIX_SIZE_ATI 0x8776 +#define GL_BUMP_NUM_TEX_UNITS_ATI 0x8777 +#define GL_BUMP_TEX_UNITS_ATI 0x8778 +#define GL_DUDV_ATI 0x8779 +#define GL_DU8DV8_ATI 0x877A +#define GL_BUMP_ENVMAP_ATI 0x877B +#define GL_BUMP_TARGET_ATI 0x877C +typedef void (APIENTRYP PFNGLTEXBUMPPARAMETERIVATIPROC) (GLenum pname, const GLint *param); +typedef void (APIENTRYP PFNGLTEXBUMPPARAMETERFVATIPROC) (GLenum pname, const GLfloat *param); +typedef void (APIENTRYP PFNGLGETTEXBUMPPARAMETERIVATIPROC) (GLenum pname, GLint *param); +typedef void (APIENTRYP PFNGLGETTEXBUMPPARAMETERFVATIPROC) (GLenum pname, GLfloat *param); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexBumpParameterivATI (GLenum pname, const GLint *param); +GLAPI void APIENTRY glTexBumpParameterfvATI (GLenum pname, const GLfloat *param); +GLAPI void APIENTRY glGetTexBumpParameterivATI (GLenum pname, GLint *param); +GLAPI void APIENTRY glGetTexBumpParameterfvATI (GLenum pname, GLfloat *param); +#endif +#endif /* GL_ATI_envmap_bumpmap */ + +#ifndef GL_ATI_fragment_shader +#define GL_ATI_fragment_shader 1 +#define GL_FRAGMENT_SHADER_ATI 0x8920 +#define GL_REG_0_ATI 0x8921 +#define GL_REG_1_ATI 0x8922 +#define GL_REG_2_ATI 0x8923 +#define GL_REG_3_ATI 0x8924 +#define GL_REG_4_ATI 0x8925 +#define GL_REG_5_ATI 0x8926 +#define GL_REG_6_ATI 0x8927 +#define GL_REG_7_ATI 0x8928 +#define GL_REG_8_ATI 0x8929 +#define GL_REG_9_ATI 0x892A +#define GL_REG_10_ATI 0x892B +#define GL_REG_11_ATI 0x892C +#define GL_REG_12_ATI 0x892D +#define GL_REG_13_ATI 0x892E +#define GL_REG_14_ATI 0x892F +#define GL_REG_15_ATI 0x8930 +#define GL_REG_16_ATI 0x8931 +#define GL_REG_17_ATI 0x8932 +#define GL_REG_18_ATI 0x8933 +#define GL_REG_19_ATI 0x8934 +#define GL_REG_20_ATI 0x8935 +#define GL_REG_21_ATI 0x8936 +#define GL_REG_22_ATI 0x8937 +#define GL_REG_23_ATI 0x8938 +#define GL_REG_24_ATI 0x8939 +#define GL_REG_25_ATI 0x893A +#define GL_REG_26_ATI 0x893B +#define GL_REG_27_ATI 0x893C +#define GL_REG_28_ATI 0x893D +#define GL_REG_29_ATI 0x893E +#define GL_REG_30_ATI 0x893F +#define GL_REG_31_ATI 0x8940 +#define GL_CON_0_ATI 0x8941 +#define GL_CON_1_ATI 0x8942 +#define GL_CON_2_ATI 0x8943 +#define GL_CON_3_ATI 0x8944 +#define GL_CON_4_ATI 0x8945 +#define GL_CON_5_ATI 0x8946 +#define GL_CON_6_ATI 0x8947 +#define GL_CON_7_ATI 0x8948 +#define GL_CON_8_ATI 0x8949 +#define GL_CON_9_ATI 0x894A +#define GL_CON_10_ATI 0x894B +#define GL_CON_11_ATI 0x894C +#define GL_CON_12_ATI 0x894D +#define GL_CON_13_ATI 0x894E +#define GL_CON_14_ATI 0x894F +#define GL_CON_15_ATI 0x8950 +#define GL_CON_16_ATI 0x8951 +#define GL_CON_17_ATI 0x8952 +#define GL_CON_18_ATI 0x8953 +#define GL_CON_19_ATI 0x8954 +#define GL_CON_20_ATI 0x8955 +#define GL_CON_21_ATI 0x8956 +#define GL_CON_22_ATI 0x8957 +#define GL_CON_23_ATI 0x8958 +#define GL_CON_24_ATI 0x8959 +#define GL_CON_25_ATI 0x895A +#define GL_CON_26_ATI 0x895B +#define GL_CON_27_ATI 0x895C +#define GL_CON_28_ATI 0x895D +#define GL_CON_29_ATI 0x895E +#define GL_CON_30_ATI 0x895F +#define GL_CON_31_ATI 0x8960 +#define GL_MOV_ATI 0x8961 +#define GL_ADD_ATI 0x8963 +#define GL_MUL_ATI 0x8964 +#define GL_SUB_ATI 0x8965 +#define GL_DOT3_ATI 0x8966 +#define GL_DOT4_ATI 0x8967 +#define GL_MAD_ATI 0x8968 +#define GL_LERP_ATI 0x8969 +#define GL_CND_ATI 0x896A +#define GL_CND0_ATI 0x896B +#define GL_DOT2_ADD_ATI 0x896C +#define GL_SECONDARY_INTERPOLATOR_ATI 0x896D +#define GL_NUM_FRAGMENT_REGISTERS_ATI 0x896E +#define GL_NUM_FRAGMENT_CONSTANTS_ATI 0x896F +#define GL_NUM_PASSES_ATI 0x8970 +#define GL_NUM_INSTRUCTIONS_PER_PASS_ATI 0x8971 +#define GL_NUM_INSTRUCTIONS_TOTAL_ATI 0x8972 +#define GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI 0x8973 +#define GL_NUM_LOOPBACK_COMPONENTS_ATI 0x8974 +#define GL_COLOR_ALPHA_PAIRING_ATI 0x8975 +#define GL_SWIZZLE_STR_ATI 0x8976 +#define GL_SWIZZLE_STQ_ATI 0x8977 +#define GL_SWIZZLE_STR_DR_ATI 0x8978 +#define GL_SWIZZLE_STQ_DQ_ATI 0x8979 +#define GL_SWIZZLE_STRQ_ATI 0x897A +#define GL_SWIZZLE_STRQ_DQ_ATI 0x897B +#define GL_RED_BIT_ATI 0x00000001 +#define GL_GREEN_BIT_ATI 0x00000002 +#define GL_BLUE_BIT_ATI 0x00000004 +#define GL_2X_BIT_ATI 0x00000001 +#define GL_4X_BIT_ATI 0x00000002 +#define GL_8X_BIT_ATI 0x00000004 +#define GL_HALF_BIT_ATI 0x00000008 +#define GL_QUARTER_BIT_ATI 0x00000010 +#define GL_EIGHTH_BIT_ATI 0x00000020 +#define GL_SATURATE_BIT_ATI 0x00000040 +#define GL_COMP_BIT_ATI 0x00000002 +#define GL_NEGATE_BIT_ATI 0x00000004 +#define GL_BIAS_BIT_ATI 0x00000008 +typedef GLuint (APIENTRYP PFNGLGENFRAGMENTSHADERSATIPROC) (GLuint range); +typedef void (APIENTRYP PFNGLBINDFRAGMENTSHADERATIPROC) (GLuint id); +typedef void (APIENTRYP PFNGLDELETEFRAGMENTSHADERATIPROC) (GLuint id); +typedef void (APIENTRYP PFNGLBEGINFRAGMENTSHADERATIPROC) (void); +typedef void (APIENTRYP PFNGLENDFRAGMENTSHADERATIPROC) (void); +typedef void (APIENTRYP PFNGLPASSTEXCOORDATIPROC) (GLuint dst, GLuint coord, GLenum swizzle); +typedef void (APIENTRYP PFNGLSAMPLEMAPATIPROC) (GLuint dst, GLuint interp, GLenum swizzle); +typedef void (APIENTRYP PFNGLCOLORFRAGMENTOP1ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); +typedef void (APIENTRYP PFNGLCOLORFRAGMENTOP2ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); +typedef void (APIENTRYP PFNGLCOLORFRAGMENTOP3ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); +typedef void (APIENTRYP PFNGLALPHAFRAGMENTOP1ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); +typedef void (APIENTRYP PFNGLALPHAFRAGMENTOP2ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); +typedef void (APIENTRYP PFNGLALPHAFRAGMENTOP3ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); +typedef void (APIENTRYP PFNGLSETFRAGMENTSHADERCONSTANTATIPROC) (GLuint dst, const GLfloat *value); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLuint APIENTRY glGenFragmentShadersATI (GLuint range); +GLAPI void APIENTRY glBindFragmentShaderATI (GLuint id); +GLAPI void APIENTRY glDeleteFragmentShaderATI (GLuint id); +GLAPI void APIENTRY glBeginFragmentShaderATI (void); +GLAPI void APIENTRY glEndFragmentShaderATI (void); +GLAPI void APIENTRY glPassTexCoordATI (GLuint dst, GLuint coord, GLenum swizzle); +GLAPI void APIENTRY glSampleMapATI (GLuint dst, GLuint interp, GLenum swizzle); +GLAPI void APIENTRY glColorFragmentOp1ATI (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); +GLAPI void APIENTRY glColorFragmentOp2ATI (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); +GLAPI void APIENTRY glColorFragmentOp3ATI (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); +GLAPI void APIENTRY glAlphaFragmentOp1ATI (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); +GLAPI void APIENTRY glAlphaFragmentOp2ATI (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); +GLAPI void APIENTRY glAlphaFragmentOp3ATI (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); +GLAPI void APIENTRY glSetFragmentShaderConstantATI (GLuint dst, const GLfloat *value); +#endif +#endif /* GL_ATI_fragment_shader */ + +#ifndef GL_ATI_map_object_buffer +#define GL_ATI_map_object_buffer 1 +typedef void *(APIENTRYP PFNGLMAPOBJECTBUFFERATIPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLUNMAPOBJECTBUFFERATIPROC) (GLuint buffer); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void *APIENTRY glMapObjectBufferATI (GLuint buffer); +GLAPI void APIENTRY glUnmapObjectBufferATI (GLuint buffer); +#endif +#endif /* GL_ATI_map_object_buffer */ + +#ifndef GL_ATI_meminfo +#define GL_ATI_meminfo 1 +#define GL_VBO_FREE_MEMORY_ATI 0x87FB +#define GL_TEXTURE_FREE_MEMORY_ATI 0x87FC +#define GL_RENDERBUFFER_FREE_MEMORY_ATI 0x87FD +#endif /* GL_ATI_meminfo */ + +#ifndef GL_ATI_pixel_format_float +#define GL_ATI_pixel_format_float 1 +#define GL_RGBA_FLOAT_MODE_ATI 0x8820 +#define GL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI 0x8835 +#endif /* GL_ATI_pixel_format_float */ + +#ifndef GL_ATI_pn_triangles +#define GL_ATI_pn_triangles 1 +#define GL_PN_TRIANGLES_ATI 0x87F0 +#define GL_MAX_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F1 +#define GL_PN_TRIANGLES_POINT_MODE_ATI 0x87F2 +#define GL_PN_TRIANGLES_NORMAL_MODE_ATI 0x87F3 +#define GL_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F4 +#define GL_PN_TRIANGLES_POINT_MODE_LINEAR_ATI 0x87F5 +#define GL_PN_TRIANGLES_POINT_MODE_CUBIC_ATI 0x87F6 +#define GL_PN_TRIANGLES_NORMAL_MODE_LINEAR_ATI 0x87F7 +#define GL_PN_TRIANGLES_NORMAL_MODE_QUADRATIC_ATI 0x87F8 +typedef void (APIENTRYP PFNGLPNTRIANGLESIATIPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLPNTRIANGLESFATIPROC) (GLenum pname, GLfloat param); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPNTrianglesiATI (GLenum pname, GLint param); +GLAPI void APIENTRY glPNTrianglesfATI (GLenum pname, GLfloat param); +#endif +#endif /* GL_ATI_pn_triangles */ + +#ifndef GL_ATI_separate_stencil +#define GL_ATI_separate_stencil 1 +#define GL_STENCIL_BACK_FUNC_ATI 0x8800 +#define GL_STENCIL_BACK_FAIL_ATI 0x8801 +#define GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI 0x8802 +#define GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI 0x8803 +typedef void (APIENTRYP PFNGLSTENCILOPSEPARATEATIPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); +typedef void (APIENTRYP PFNGLSTENCILFUNCSEPARATEATIPROC) (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glStencilOpSeparateATI (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); +GLAPI void APIENTRY glStencilFuncSeparateATI (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); +#endif +#endif /* GL_ATI_separate_stencil */ + +#ifndef GL_ATI_text_fragment_shader +#define GL_ATI_text_fragment_shader 1 +#define GL_TEXT_FRAGMENT_SHADER_ATI 0x8200 +#endif /* GL_ATI_text_fragment_shader */ + +#ifndef GL_ATI_texture_env_combine3 +#define GL_ATI_texture_env_combine3 1 +#define GL_MODULATE_ADD_ATI 0x8744 +#define GL_MODULATE_SIGNED_ADD_ATI 0x8745 +#define GL_MODULATE_SUBTRACT_ATI 0x8746 +#endif /* GL_ATI_texture_env_combine3 */ + +#ifndef GL_ATI_texture_float +#define GL_ATI_texture_float 1 +#define GL_RGBA_FLOAT32_ATI 0x8814 +#define GL_RGB_FLOAT32_ATI 0x8815 +#define GL_ALPHA_FLOAT32_ATI 0x8816 +#define GL_INTENSITY_FLOAT32_ATI 0x8817 +#define GL_LUMINANCE_FLOAT32_ATI 0x8818 +#define GL_LUMINANCE_ALPHA_FLOAT32_ATI 0x8819 +#define GL_RGBA_FLOAT16_ATI 0x881A +#define GL_RGB_FLOAT16_ATI 0x881B +#define GL_ALPHA_FLOAT16_ATI 0x881C +#define GL_INTENSITY_FLOAT16_ATI 0x881D +#define GL_LUMINANCE_FLOAT16_ATI 0x881E +#define GL_LUMINANCE_ALPHA_FLOAT16_ATI 0x881F +#endif /* GL_ATI_texture_float */ + +#ifndef GL_ATI_texture_mirror_once +#define GL_ATI_texture_mirror_once 1 +#define GL_MIRROR_CLAMP_ATI 0x8742 +#define GL_MIRROR_CLAMP_TO_EDGE_ATI 0x8743 +#endif /* GL_ATI_texture_mirror_once */ + +#ifndef GL_ATI_vertex_array_object +#define GL_ATI_vertex_array_object 1 +#define GL_STATIC_ATI 0x8760 +#define GL_DYNAMIC_ATI 0x8761 +#define GL_PRESERVE_ATI 0x8762 +#define GL_DISCARD_ATI 0x8763 +#define GL_OBJECT_BUFFER_SIZE_ATI 0x8764 +#define GL_OBJECT_BUFFER_USAGE_ATI 0x8765 +#define GL_ARRAY_OBJECT_BUFFER_ATI 0x8766 +#define GL_ARRAY_OBJECT_OFFSET_ATI 0x8767 +typedef GLuint (APIENTRYP PFNGLNEWOBJECTBUFFERATIPROC) (GLsizei size, const void *pointer, GLenum usage); +typedef GLboolean (APIENTRYP PFNGLISOBJECTBUFFERATIPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLUPDATEOBJECTBUFFERATIPROC) (GLuint buffer, GLuint offset, GLsizei size, const void *pointer, GLenum preserve); +typedef void (APIENTRYP PFNGLGETOBJECTBUFFERFVATIPROC) (GLuint buffer, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETOBJECTBUFFERIVATIPROC) (GLuint buffer, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLFREEOBJECTBUFFERATIPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLARRAYOBJECTATIPROC) (GLenum array, GLint size, GLenum type, GLsizei stride, GLuint buffer, GLuint offset); +typedef void (APIENTRYP PFNGLGETARRAYOBJECTFVATIPROC) (GLenum array, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETARRAYOBJECTIVATIPROC) (GLenum array, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLVARIANTARRAYOBJECTATIPROC) (GLuint id, GLenum type, GLsizei stride, GLuint buffer, GLuint offset); +typedef void (APIENTRYP PFNGLGETVARIANTARRAYOBJECTFVATIPROC) (GLuint id, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETVARIANTARRAYOBJECTIVATIPROC) (GLuint id, GLenum pname, GLint *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLuint APIENTRY glNewObjectBufferATI (GLsizei size, const void *pointer, GLenum usage); +GLAPI GLboolean APIENTRY glIsObjectBufferATI (GLuint buffer); +GLAPI void APIENTRY glUpdateObjectBufferATI (GLuint buffer, GLuint offset, GLsizei size, const void *pointer, GLenum preserve); +GLAPI void APIENTRY glGetObjectBufferfvATI (GLuint buffer, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetObjectBufferivATI (GLuint buffer, GLenum pname, GLint *params); +GLAPI void APIENTRY glFreeObjectBufferATI (GLuint buffer); +GLAPI void APIENTRY glArrayObjectATI (GLenum array, GLint size, GLenum type, GLsizei stride, GLuint buffer, GLuint offset); +GLAPI void APIENTRY glGetArrayObjectfvATI (GLenum array, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetArrayObjectivATI (GLenum array, GLenum pname, GLint *params); +GLAPI void APIENTRY glVariantArrayObjectATI (GLuint id, GLenum type, GLsizei stride, GLuint buffer, GLuint offset); +GLAPI void APIENTRY glGetVariantArrayObjectfvATI (GLuint id, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetVariantArrayObjectivATI (GLuint id, GLenum pname, GLint *params); +#endif +#endif /* GL_ATI_vertex_array_object */ + +#ifndef GL_ATI_vertex_attrib_array_object +#define GL_ATI_vertex_attrib_array_object 1 +typedef void (APIENTRYP PFNGLVERTEXATTRIBARRAYOBJECTATIPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLuint buffer, GLuint offset); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBARRAYOBJECTFVATIPROC) (GLuint index, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBARRAYOBJECTIVATIPROC) (GLuint index, GLenum pname, GLint *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexAttribArrayObjectATI (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLuint buffer, GLuint offset); +GLAPI void APIENTRY glGetVertexAttribArrayObjectfvATI (GLuint index, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetVertexAttribArrayObjectivATI (GLuint index, GLenum pname, GLint *params); +#endif +#endif /* GL_ATI_vertex_attrib_array_object */ + +#ifndef GL_ATI_vertex_streams +#define GL_ATI_vertex_streams 1 +#define GL_MAX_VERTEX_STREAMS_ATI 0x876B +#define GL_VERTEX_STREAM0_ATI 0x876C +#define GL_VERTEX_STREAM1_ATI 0x876D +#define GL_VERTEX_STREAM2_ATI 0x876E +#define GL_VERTEX_STREAM3_ATI 0x876F +#define GL_VERTEX_STREAM4_ATI 0x8770 +#define GL_VERTEX_STREAM5_ATI 0x8771 +#define GL_VERTEX_STREAM6_ATI 0x8772 +#define GL_VERTEX_STREAM7_ATI 0x8773 +#define GL_VERTEX_SOURCE_ATI 0x8774 +typedef void (APIENTRYP PFNGLVERTEXSTREAM1SATIPROC) (GLenum stream, GLshort x); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1SVATIPROC) (GLenum stream, const GLshort *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1IATIPROC) (GLenum stream, GLint x); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1IVATIPROC) (GLenum stream, const GLint *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1FATIPROC) (GLenum stream, GLfloat x); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1FVATIPROC) (GLenum stream, const GLfloat *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1DATIPROC) (GLenum stream, GLdouble x); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1DVATIPROC) (GLenum stream, const GLdouble *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2SATIPROC) (GLenum stream, GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2SVATIPROC) (GLenum stream, const GLshort *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2IATIPROC) (GLenum stream, GLint x, GLint y); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2IVATIPROC) (GLenum stream, const GLint *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2FATIPROC) (GLenum stream, GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2FVATIPROC) (GLenum stream, const GLfloat *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2DATIPROC) (GLenum stream, GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2DVATIPROC) (GLenum stream, const GLdouble *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3SATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3SVATIPROC) (GLenum stream, const GLshort *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3IATIPROC) (GLenum stream, GLint x, GLint y, GLint z); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3IVATIPROC) (GLenum stream, const GLint *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3FATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3FVATIPROC) (GLenum stream, const GLfloat *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3DATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3DVATIPROC) (GLenum stream, const GLdouble *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4SATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4SVATIPROC) (GLenum stream, const GLshort *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4IATIPROC) (GLenum stream, GLint x, GLint y, GLint z, GLint w); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4IVATIPROC) (GLenum stream, const GLint *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4FATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4FVATIPROC) (GLenum stream, const GLfloat *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4DATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4DVATIPROC) (GLenum stream, const GLdouble *coords); +typedef void (APIENTRYP PFNGLNORMALSTREAM3BATIPROC) (GLenum stream, GLbyte nx, GLbyte ny, GLbyte nz); +typedef void (APIENTRYP PFNGLNORMALSTREAM3BVATIPROC) (GLenum stream, const GLbyte *coords); +typedef void (APIENTRYP PFNGLNORMALSTREAM3SATIPROC) (GLenum stream, GLshort nx, GLshort ny, GLshort nz); +typedef void (APIENTRYP PFNGLNORMALSTREAM3SVATIPROC) (GLenum stream, const GLshort *coords); +typedef void (APIENTRYP PFNGLNORMALSTREAM3IATIPROC) (GLenum stream, GLint nx, GLint ny, GLint nz); +typedef void (APIENTRYP PFNGLNORMALSTREAM3IVATIPROC) (GLenum stream, const GLint *coords); +typedef void (APIENTRYP PFNGLNORMALSTREAM3FATIPROC) (GLenum stream, GLfloat nx, GLfloat ny, GLfloat nz); +typedef void (APIENTRYP PFNGLNORMALSTREAM3FVATIPROC) (GLenum stream, const GLfloat *coords); +typedef void (APIENTRYP PFNGLNORMALSTREAM3DATIPROC) (GLenum stream, GLdouble nx, GLdouble ny, GLdouble nz); +typedef void (APIENTRYP PFNGLNORMALSTREAM3DVATIPROC) (GLenum stream, const GLdouble *coords); +typedef void (APIENTRYP PFNGLCLIENTACTIVEVERTEXSTREAMATIPROC) (GLenum stream); +typedef void (APIENTRYP PFNGLVERTEXBLENDENVIATIPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLVERTEXBLENDENVFATIPROC) (GLenum pname, GLfloat param); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexStream1sATI (GLenum stream, GLshort x); +GLAPI void APIENTRY glVertexStream1svATI (GLenum stream, const GLshort *coords); +GLAPI void APIENTRY glVertexStream1iATI (GLenum stream, GLint x); +GLAPI void APIENTRY glVertexStream1ivATI (GLenum stream, const GLint *coords); +GLAPI void APIENTRY glVertexStream1fATI (GLenum stream, GLfloat x); +GLAPI void APIENTRY glVertexStream1fvATI (GLenum stream, const GLfloat *coords); +GLAPI void APIENTRY glVertexStream1dATI (GLenum stream, GLdouble x); +GLAPI void APIENTRY glVertexStream1dvATI (GLenum stream, const GLdouble *coords); +GLAPI void APIENTRY glVertexStream2sATI (GLenum stream, GLshort x, GLshort y); +GLAPI void APIENTRY glVertexStream2svATI (GLenum stream, const GLshort *coords); +GLAPI void APIENTRY glVertexStream2iATI (GLenum stream, GLint x, GLint y); +GLAPI void APIENTRY glVertexStream2ivATI (GLenum stream, const GLint *coords); +GLAPI void APIENTRY glVertexStream2fATI (GLenum stream, GLfloat x, GLfloat y); +GLAPI void APIENTRY glVertexStream2fvATI (GLenum stream, const GLfloat *coords); +GLAPI void APIENTRY glVertexStream2dATI (GLenum stream, GLdouble x, GLdouble y); +GLAPI void APIENTRY glVertexStream2dvATI (GLenum stream, const GLdouble *coords); +GLAPI void APIENTRY glVertexStream3sATI (GLenum stream, GLshort x, GLshort y, GLshort z); +GLAPI void APIENTRY glVertexStream3svATI (GLenum stream, const GLshort *coords); +GLAPI void APIENTRY glVertexStream3iATI (GLenum stream, GLint x, GLint y, GLint z); +GLAPI void APIENTRY glVertexStream3ivATI (GLenum stream, const GLint *coords); +GLAPI void APIENTRY glVertexStream3fATI (GLenum stream, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glVertexStream3fvATI (GLenum stream, const GLfloat *coords); +GLAPI void APIENTRY glVertexStream3dATI (GLenum stream, GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY glVertexStream3dvATI (GLenum stream, const GLdouble *coords); +GLAPI void APIENTRY glVertexStream4sATI (GLenum stream, GLshort x, GLshort y, GLshort z, GLshort w); +GLAPI void APIENTRY glVertexStream4svATI (GLenum stream, const GLshort *coords); +GLAPI void APIENTRY glVertexStream4iATI (GLenum stream, GLint x, GLint y, GLint z, GLint w); +GLAPI void APIENTRY glVertexStream4ivATI (GLenum stream, const GLint *coords); +GLAPI void APIENTRY glVertexStream4fATI (GLenum stream, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void APIENTRY glVertexStream4fvATI (GLenum stream, const GLfloat *coords); +GLAPI void APIENTRY glVertexStream4dATI (GLenum stream, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY glVertexStream4dvATI (GLenum stream, const GLdouble *coords); +GLAPI void APIENTRY glNormalStream3bATI (GLenum stream, GLbyte nx, GLbyte ny, GLbyte nz); +GLAPI void APIENTRY glNormalStream3bvATI (GLenum stream, const GLbyte *coords); +GLAPI void APIENTRY glNormalStream3sATI (GLenum stream, GLshort nx, GLshort ny, GLshort nz); +GLAPI void APIENTRY glNormalStream3svATI (GLenum stream, const GLshort *coords); +GLAPI void APIENTRY glNormalStream3iATI (GLenum stream, GLint nx, GLint ny, GLint nz); +GLAPI void APIENTRY glNormalStream3ivATI (GLenum stream, const GLint *coords); +GLAPI void APIENTRY glNormalStream3fATI (GLenum stream, GLfloat nx, GLfloat ny, GLfloat nz); +GLAPI void APIENTRY glNormalStream3fvATI (GLenum stream, const GLfloat *coords); +GLAPI void APIENTRY glNormalStream3dATI (GLenum stream, GLdouble nx, GLdouble ny, GLdouble nz); +GLAPI void APIENTRY glNormalStream3dvATI (GLenum stream, const GLdouble *coords); +GLAPI void APIENTRY glClientActiveVertexStreamATI (GLenum stream); +GLAPI void APIENTRY glVertexBlendEnviATI (GLenum pname, GLint param); +GLAPI void APIENTRY glVertexBlendEnvfATI (GLenum pname, GLfloat param); +#endif +#endif /* GL_ATI_vertex_streams */ + +#ifndef GL_EXT_422_pixels +#define GL_EXT_422_pixels 1 +#define GL_422_EXT 0x80CC +#define GL_422_REV_EXT 0x80CD +#define GL_422_AVERAGE_EXT 0x80CE +#define GL_422_REV_AVERAGE_EXT 0x80CF +#endif /* GL_EXT_422_pixels */ + +#ifndef GL_EXT_abgr +#define GL_EXT_abgr 1 +#define GL_ABGR_EXT 0x8000 +#endif /* GL_EXT_abgr */ + +#ifndef GL_EXT_bgra +#define GL_EXT_bgra 1 +#define GL_BGR_EXT 0x80E0 +#define GL_BGRA_EXT 0x80E1 +#endif /* GL_EXT_bgra */ + +#ifndef GL_EXT_bindable_uniform +#define GL_EXT_bindable_uniform 1 +#define GL_MAX_VERTEX_BINDABLE_UNIFORMS_EXT 0x8DE2 +#define GL_MAX_FRAGMENT_BINDABLE_UNIFORMS_EXT 0x8DE3 +#define GL_MAX_GEOMETRY_BINDABLE_UNIFORMS_EXT 0x8DE4 +#define GL_MAX_BINDABLE_UNIFORM_SIZE_EXT 0x8DED +#define GL_UNIFORM_BUFFER_EXT 0x8DEE +#define GL_UNIFORM_BUFFER_BINDING_EXT 0x8DEF +typedef void (APIENTRYP PFNGLUNIFORMBUFFEREXTPROC) (GLuint program, GLint location, GLuint buffer); +typedef GLint (APIENTRYP PFNGLGETUNIFORMBUFFERSIZEEXTPROC) (GLuint program, GLint location); +typedef GLintptr (APIENTRYP PFNGLGETUNIFORMOFFSETEXTPROC) (GLuint program, GLint location); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glUniformBufferEXT (GLuint program, GLint location, GLuint buffer); +GLAPI GLint APIENTRY glGetUniformBufferSizeEXT (GLuint program, GLint location); +GLAPI GLintptr APIENTRY glGetUniformOffsetEXT (GLuint program, GLint location); +#endif +#endif /* GL_EXT_bindable_uniform */ + +#ifndef GL_EXT_blend_color +#define GL_EXT_blend_color 1 +#define GL_CONSTANT_COLOR_EXT 0x8001 +#define GL_ONE_MINUS_CONSTANT_COLOR_EXT 0x8002 +#define GL_CONSTANT_ALPHA_EXT 0x8003 +#define GL_ONE_MINUS_CONSTANT_ALPHA_EXT 0x8004 +#define GL_BLEND_COLOR_EXT 0x8005 +typedef void (APIENTRYP PFNGLBLENDCOLOREXTPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendColorEXT (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +#endif +#endif /* GL_EXT_blend_color */ + +#ifndef GL_EXT_blend_equation_separate +#define GL_EXT_blend_equation_separate 1 +#define GL_BLEND_EQUATION_RGB_EXT 0x8009 +#define GL_BLEND_EQUATION_ALPHA_EXT 0x883D +typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEEXTPROC) (GLenum modeRGB, GLenum modeAlpha); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendEquationSeparateEXT (GLenum modeRGB, GLenum modeAlpha); +#endif +#endif /* GL_EXT_blend_equation_separate */ + +#ifndef GL_EXT_blend_func_separate +#define GL_EXT_blend_func_separate 1 +#define GL_BLEND_DST_RGB_EXT 0x80C8 +#define GL_BLEND_SRC_RGB_EXT 0x80C9 +#define GL_BLEND_DST_ALPHA_EXT 0x80CA +#define GL_BLEND_SRC_ALPHA_EXT 0x80CB +typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEEXTPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendFuncSeparateEXT (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +#endif +#endif /* GL_EXT_blend_func_separate */ + +#ifndef GL_EXT_blend_logic_op +#define GL_EXT_blend_logic_op 1 +#endif /* GL_EXT_blend_logic_op */ + +#ifndef GL_EXT_blend_minmax +#define GL_EXT_blend_minmax 1 +#define GL_MIN_EXT 0x8007 +#define GL_MAX_EXT 0x8008 +#define GL_FUNC_ADD_EXT 0x8006 +#define GL_BLEND_EQUATION_EXT 0x8009 +typedef void (APIENTRYP PFNGLBLENDEQUATIONEXTPROC) (GLenum mode); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendEquationEXT (GLenum mode); +#endif +#endif /* GL_EXT_blend_minmax */ + +#ifndef GL_EXT_blend_subtract +#define GL_EXT_blend_subtract 1 +#define GL_FUNC_SUBTRACT_EXT 0x800A +#define GL_FUNC_REVERSE_SUBTRACT_EXT 0x800B +#endif /* GL_EXT_blend_subtract */ + +#ifndef GL_EXT_clip_volume_hint +#define GL_EXT_clip_volume_hint 1 +#define GL_CLIP_VOLUME_CLIPPING_HINT_EXT 0x80F0 +#endif /* GL_EXT_clip_volume_hint */ + +#ifndef GL_EXT_cmyka +#define GL_EXT_cmyka 1 +#define GL_CMYK_EXT 0x800C +#define GL_CMYKA_EXT 0x800D +#define GL_PACK_CMYK_HINT_EXT 0x800E +#define GL_UNPACK_CMYK_HINT_EXT 0x800F +#endif /* GL_EXT_cmyka */ + +#ifndef GL_EXT_color_subtable +#define GL_EXT_color_subtable 1 +typedef void (APIENTRYP PFNGLCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const void *data); +typedef void (APIENTRYP PFNGLCOPYCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glColorSubTableEXT (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const void *data); +GLAPI void APIENTRY glCopyColorSubTableEXT (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); +#endif +#endif /* GL_EXT_color_subtable */ + +#ifndef GL_EXT_compiled_vertex_array +#define GL_EXT_compiled_vertex_array 1 +#define GL_ARRAY_ELEMENT_LOCK_FIRST_EXT 0x81A8 +#define GL_ARRAY_ELEMENT_LOCK_COUNT_EXT 0x81A9 +typedef void (APIENTRYP PFNGLLOCKARRAYSEXTPROC) (GLint first, GLsizei count); +typedef void (APIENTRYP PFNGLUNLOCKARRAYSEXTPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glLockArraysEXT (GLint first, GLsizei count); +GLAPI void APIENTRY glUnlockArraysEXT (void); +#endif +#endif /* GL_EXT_compiled_vertex_array */ + +#ifndef GL_EXT_convolution +#define GL_EXT_convolution 1 +#define GL_CONVOLUTION_1D_EXT 0x8010 +#define GL_CONVOLUTION_2D_EXT 0x8011 +#define GL_SEPARABLE_2D_EXT 0x8012 +#define GL_CONVOLUTION_BORDER_MODE_EXT 0x8013 +#define GL_CONVOLUTION_FILTER_SCALE_EXT 0x8014 +#define GL_CONVOLUTION_FILTER_BIAS_EXT 0x8015 +#define GL_REDUCE_EXT 0x8016 +#define GL_CONVOLUTION_FORMAT_EXT 0x8017 +#define GL_CONVOLUTION_WIDTH_EXT 0x8018 +#define GL_CONVOLUTION_HEIGHT_EXT 0x8019 +#define GL_MAX_CONVOLUTION_WIDTH_EXT 0x801A +#define GL_MAX_CONVOLUTION_HEIGHT_EXT 0x801B +#define GL_POST_CONVOLUTION_RED_SCALE_EXT 0x801C +#define GL_POST_CONVOLUTION_GREEN_SCALE_EXT 0x801D +#define GL_POST_CONVOLUTION_BLUE_SCALE_EXT 0x801E +#define GL_POST_CONVOLUTION_ALPHA_SCALE_EXT 0x801F +#define GL_POST_CONVOLUTION_RED_BIAS_EXT 0x8020 +#define GL_POST_CONVOLUTION_GREEN_BIAS_EXT 0x8021 +#define GL_POST_CONVOLUTION_BLUE_BIAS_EXT 0x8022 +#define GL_POST_CONVOLUTION_ALPHA_BIAS_EXT 0x8023 +typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void *image); +typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *image); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFEXTPROC) (GLenum target, GLenum pname, GLfloat params); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIEXTPROC) (GLenum target, GLenum pname, GLint params); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLGETCONVOLUTIONFILTEREXTPROC) (GLenum target, GLenum format, GLenum type, void *image); +typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETSEPARABLEFILTEREXTPROC) (GLenum target, GLenum format, GLenum type, void *row, void *column, void *span); +typedef void (APIENTRYP PFNGLSEPARABLEFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *row, const void *column); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glConvolutionFilter1DEXT (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void *image); +GLAPI void APIENTRY glConvolutionFilter2DEXT (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *image); +GLAPI void APIENTRY glConvolutionParameterfEXT (GLenum target, GLenum pname, GLfloat params); +GLAPI void APIENTRY glConvolutionParameterfvEXT (GLenum target, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glConvolutionParameteriEXT (GLenum target, GLenum pname, GLint params); +GLAPI void APIENTRY glConvolutionParameterivEXT (GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY glCopyConvolutionFilter1DEXT (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +GLAPI void APIENTRY glCopyConvolutionFilter2DEXT (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void APIENTRY glGetConvolutionFilterEXT (GLenum target, GLenum format, GLenum type, void *image); +GLAPI void APIENTRY glGetConvolutionParameterfvEXT (GLenum target, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetConvolutionParameterivEXT (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetSeparableFilterEXT (GLenum target, GLenum format, GLenum type, void *row, void *column, void *span); +GLAPI void APIENTRY glSeparableFilter2DEXT (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *row, const void *column); +#endif +#endif /* GL_EXT_convolution */ + +#ifndef GL_EXT_coordinate_frame +#define GL_EXT_coordinate_frame 1 +#define GL_TANGENT_ARRAY_EXT 0x8439 +#define GL_BINORMAL_ARRAY_EXT 0x843A +#define GL_CURRENT_TANGENT_EXT 0x843B +#define GL_CURRENT_BINORMAL_EXT 0x843C +#define GL_TANGENT_ARRAY_TYPE_EXT 0x843E +#define GL_TANGENT_ARRAY_STRIDE_EXT 0x843F +#define GL_BINORMAL_ARRAY_TYPE_EXT 0x8440 +#define GL_BINORMAL_ARRAY_STRIDE_EXT 0x8441 +#define GL_TANGENT_ARRAY_POINTER_EXT 0x8442 +#define GL_BINORMAL_ARRAY_POINTER_EXT 0x8443 +#define GL_MAP1_TANGENT_EXT 0x8444 +#define GL_MAP2_TANGENT_EXT 0x8445 +#define GL_MAP1_BINORMAL_EXT 0x8446 +#define GL_MAP2_BINORMAL_EXT 0x8447 +typedef void (APIENTRYP PFNGLTANGENT3BEXTPROC) (GLbyte tx, GLbyte ty, GLbyte tz); +typedef void (APIENTRYP PFNGLTANGENT3BVEXTPROC) (const GLbyte *v); +typedef void (APIENTRYP PFNGLTANGENT3DEXTPROC) (GLdouble tx, GLdouble ty, GLdouble tz); +typedef void (APIENTRYP PFNGLTANGENT3DVEXTPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLTANGENT3FEXTPROC) (GLfloat tx, GLfloat ty, GLfloat tz); +typedef void (APIENTRYP PFNGLTANGENT3FVEXTPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLTANGENT3IEXTPROC) (GLint tx, GLint ty, GLint tz); +typedef void (APIENTRYP PFNGLTANGENT3IVEXTPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLTANGENT3SEXTPROC) (GLshort tx, GLshort ty, GLshort tz); +typedef void (APIENTRYP PFNGLTANGENT3SVEXTPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLBINORMAL3BEXTPROC) (GLbyte bx, GLbyte by, GLbyte bz); +typedef void (APIENTRYP PFNGLBINORMAL3BVEXTPROC) (const GLbyte *v); +typedef void (APIENTRYP PFNGLBINORMAL3DEXTPROC) (GLdouble bx, GLdouble by, GLdouble bz); +typedef void (APIENTRYP PFNGLBINORMAL3DVEXTPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLBINORMAL3FEXTPROC) (GLfloat bx, GLfloat by, GLfloat bz); +typedef void (APIENTRYP PFNGLBINORMAL3FVEXTPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLBINORMAL3IEXTPROC) (GLint bx, GLint by, GLint bz); +typedef void (APIENTRYP PFNGLBINORMAL3IVEXTPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLBINORMAL3SEXTPROC) (GLshort bx, GLshort by, GLshort bz); +typedef void (APIENTRYP PFNGLBINORMAL3SVEXTPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLTANGENTPOINTEREXTPROC) (GLenum type, GLsizei stride, const void *pointer); +typedef void (APIENTRYP PFNGLBINORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, const void *pointer); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTangent3bEXT (GLbyte tx, GLbyte ty, GLbyte tz); +GLAPI void APIENTRY glTangent3bvEXT (const GLbyte *v); +GLAPI void APIENTRY glTangent3dEXT (GLdouble tx, GLdouble ty, GLdouble tz); +GLAPI void APIENTRY glTangent3dvEXT (const GLdouble *v); +GLAPI void APIENTRY glTangent3fEXT (GLfloat tx, GLfloat ty, GLfloat tz); +GLAPI void APIENTRY glTangent3fvEXT (const GLfloat *v); +GLAPI void APIENTRY glTangent3iEXT (GLint tx, GLint ty, GLint tz); +GLAPI void APIENTRY glTangent3ivEXT (const GLint *v); +GLAPI void APIENTRY glTangent3sEXT (GLshort tx, GLshort ty, GLshort tz); +GLAPI void APIENTRY glTangent3svEXT (const GLshort *v); +GLAPI void APIENTRY glBinormal3bEXT (GLbyte bx, GLbyte by, GLbyte bz); +GLAPI void APIENTRY glBinormal3bvEXT (const GLbyte *v); +GLAPI void APIENTRY glBinormal3dEXT (GLdouble bx, GLdouble by, GLdouble bz); +GLAPI void APIENTRY glBinormal3dvEXT (const GLdouble *v); +GLAPI void APIENTRY glBinormal3fEXT (GLfloat bx, GLfloat by, GLfloat bz); +GLAPI void APIENTRY glBinormal3fvEXT (const GLfloat *v); +GLAPI void APIENTRY glBinormal3iEXT (GLint bx, GLint by, GLint bz); +GLAPI void APIENTRY glBinormal3ivEXT (const GLint *v); +GLAPI void APIENTRY glBinormal3sEXT (GLshort bx, GLshort by, GLshort bz); +GLAPI void APIENTRY glBinormal3svEXT (const GLshort *v); +GLAPI void APIENTRY glTangentPointerEXT (GLenum type, GLsizei stride, const void *pointer); +GLAPI void APIENTRY glBinormalPointerEXT (GLenum type, GLsizei stride, const void *pointer); +#endif +#endif /* GL_EXT_coordinate_frame */ + +#ifndef GL_EXT_copy_texture +#define GL_EXT_copy_texture 1 +typedef void (APIENTRYP PFNGLCOPYTEXIMAGE1DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); +typedef void (APIENTRYP PFNGLCOPYTEXIMAGE2DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCopyTexImage1DEXT (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); +GLAPI void APIENTRY glCopyTexImage2DEXT (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +GLAPI void APIENTRY glCopyTexSubImage1DEXT (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); +GLAPI void APIENTRY glCopyTexSubImage2DEXT (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void APIENTRY glCopyTexSubImage3DEXT (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +#endif +#endif /* GL_EXT_copy_texture */ + +#ifndef GL_EXT_cull_vertex +#define GL_EXT_cull_vertex 1 +#define GL_CULL_VERTEX_EXT 0x81AA +#define GL_CULL_VERTEX_EYE_POSITION_EXT 0x81AB +#define GL_CULL_VERTEX_OBJECT_POSITION_EXT 0x81AC +typedef void (APIENTRYP PFNGLCULLPARAMETERDVEXTPROC) (GLenum pname, GLdouble *params); +typedef void (APIENTRYP PFNGLCULLPARAMETERFVEXTPROC) (GLenum pname, GLfloat *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCullParameterdvEXT (GLenum pname, GLdouble *params); +GLAPI void APIENTRY glCullParameterfvEXT (GLenum pname, GLfloat *params); +#endif +#endif /* GL_EXT_cull_vertex */ + +#ifndef GL_EXT_debug_label +#define GL_EXT_debug_label 1 +#define GL_PROGRAM_PIPELINE_OBJECT_EXT 0x8A4F +#define GL_PROGRAM_OBJECT_EXT 0x8B40 +#define GL_SHADER_OBJECT_EXT 0x8B48 +#define GL_BUFFER_OBJECT_EXT 0x9151 +#define GL_QUERY_OBJECT_EXT 0x9153 +#define GL_VERTEX_ARRAY_OBJECT_EXT 0x9154 +typedef void (APIENTRYP PFNGLLABELOBJECTEXTPROC) (GLenum type, GLuint object, GLsizei length, const GLchar *label); +typedef void (APIENTRYP PFNGLGETOBJECTLABELEXTPROC) (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glLabelObjectEXT (GLenum type, GLuint object, GLsizei length, const GLchar *label); +GLAPI void APIENTRY glGetObjectLabelEXT (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label); +#endif +#endif /* GL_EXT_debug_label */ + +#ifndef GL_EXT_debug_marker +#define GL_EXT_debug_marker 1 +typedef void (APIENTRYP PFNGLINSERTEVENTMARKEREXTPROC) (GLsizei length, const GLchar *marker); +typedef void (APIENTRYP PFNGLPUSHGROUPMARKEREXTPROC) (GLsizei length, const GLchar *marker); +typedef void (APIENTRYP PFNGLPOPGROUPMARKEREXTPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glInsertEventMarkerEXT (GLsizei length, const GLchar *marker); +GLAPI void APIENTRY glPushGroupMarkerEXT (GLsizei length, const GLchar *marker); +GLAPI void APIENTRY glPopGroupMarkerEXT (void); +#endif +#endif /* GL_EXT_debug_marker */ + +#ifndef GL_EXT_depth_bounds_test +#define GL_EXT_depth_bounds_test 1 +#define GL_DEPTH_BOUNDS_TEST_EXT 0x8890 +#define GL_DEPTH_BOUNDS_EXT 0x8891 +typedef void (APIENTRYP PFNGLDEPTHBOUNDSEXTPROC) (GLclampd zmin, GLclampd zmax); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDepthBoundsEXT (GLclampd zmin, GLclampd zmax); +#endif +#endif /* GL_EXT_depth_bounds_test */ + +#ifndef GL_EXT_direct_state_access +#define GL_EXT_direct_state_access 1 +#define GL_PROGRAM_MATRIX_EXT 0x8E2D +#define GL_TRANSPOSE_PROGRAM_MATRIX_EXT 0x8E2E +#define GL_PROGRAM_MATRIX_STACK_DEPTH_EXT 0x8E2F +typedef void (APIENTRYP PFNGLMATRIXLOADFEXTPROC) (GLenum mode, const GLfloat *m); +typedef void (APIENTRYP PFNGLMATRIXLOADDEXTPROC) (GLenum mode, const GLdouble *m); +typedef void (APIENTRYP PFNGLMATRIXMULTFEXTPROC) (GLenum mode, const GLfloat *m); +typedef void (APIENTRYP PFNGLMATRIXMULTDEXTPROC) (GLenum mode, const GLdouble *m); +typedef void (APIENTRYP PFNGLMATRIXLOADIDENTITYEXTPROC) (GLenum mode); +typedef void (APIENTRYP PFNGLMATRIXROTATEFEXTPROC) (GLenum mode, GLfloat angle, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLMATRIXROTATEDEXTPROC) (GLenum mode, GLdouble angle, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLMATRIXSCALEFEXTPROC) (GLenum mode, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLMATRIXSCALEDEXTPROC) (GLenum mode, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLMATRIXTRANSLATEFEXTPROC) (GLenum mode, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLMATRIXTRANSLATEDEXTPROC) (GLenum mode, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLMATRIXFRUSTUMEXTPROC) (GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); +typedef void (APIENTRYP PFNGLMATRIXORTHOEXTPROC) (GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); +typedef void (APIENTRYP PFNGLMATRIXPOPEXTPROC) (GLenum mode); +typedef void (APIENTRYP PFNGLMATRIXPUSHEXTPROC) (GLenum mode); +typedef void (APIENTRYP PFNGLCLIENTATTRIBDEFAULTEXTPROC) (GLbitfield mask); +typedef void (APIENTRYP PFNGLPUSHCLIENTATTRIBDEFAULTEXTPROC) (GLbitfield mask); +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERFEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERFVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLTEXTUREIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void *pixels); +typedef void (APIENTRYP PFNGLTEXTUREIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels); +typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels); +typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); +typedef void (APIENTRYP PFNGLCOPYTEXTUREIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); +typedef void (APIENTRYP PFNGLCOPYTEXTUREIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLGETTEXTUREIMAGEEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum format, GLenum type, void *pixels); +typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERFVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETTEXTURELEVELPARAMETERFVEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETTEXTURELEVELPARAMETERIVEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLTEXTUREIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels); +typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); +typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLBINDMULTITEXTUREEXTPROC) (GLenum texunit, GLenum target, GLuint texture); +typedef void (APIENTRYP PFNGLMULTITEXCOORDPOINTEREXTPROC) (GLenum texunit, GLint size, GLenum type, GLsizei stride, const void *pointer); +typedef void (APIENTRYP PFNGLMULTITEXENVFEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLMULTITEXENVFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLMULTITEXENVIEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLMULTITEXENVIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLMULTITEXGENDEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLdouble param); +typedef void (APIENTRYP PFNGLMULTITEXGENDVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, const GLdouble *params); +typedef void (APIENTRYP PFNGLMULTITEXGENFEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLMULTITEXGENFVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLMULTITEXGENIEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLMULTITEXGENIVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLGETMULTITEXENVFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETMULTITEXENVIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETMULTITEXGENDVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLdouble *params); +typedef void (APIENTRYP PFNGLGETMULTITEXGENFVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETMULTITEXGENIVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLMULTITEXPARAMETERIEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLMULTITEXPARAMETERIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLMULTITEXPARAMETERFEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLMULTITEXPARAMETERFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLMULTITEXIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void *pixels); +typedef void (APIENTRYP PFNGLMULTITEXIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels); +typedef void (APIENTRYP PFNGLMULTITEXSUBIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels); +typedef void (APIENTRYP PFNGLMULTITEXSUBIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); +typedef void (APIENTRYP PFNGLCOPYMULTITEXIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); +typedef void (APIENTRYP PFNGLCOPYMULTITEXIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +typedef void (APIENTRYP PFNGLCOPYMULTITEXSUBIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLCOPYMULTITEXSUBIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLGETMULTITEXIMAGEEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum format, GLenum type, void *pixels); +typedef void (APIENTRYP PFNGLGETMULTITEXPARAMETERFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETMULTITEXPARAMETERIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETMULTITEXLEVELPARAMETERFVEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETMULTITEXLEVELPARAMETERIVEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLMULTITEXIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels); +typedef void (APIENTRYP PFNGLMULTITEXSUBIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); +typedef void (APIENTRYP PFNGLCOPYMULTITEXSUBIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLENABLECLIENTSTATEINDEXEDEXTPROC) (GLenum array, GLuint index); +typedef void (APIENTRYP PFNGLDISABLECLIENTSTATEINDEXEDEXTPROC) (GLenum array, GLuint index); +typedef void (APIENTRYP PFNGLGETFLOATINDEXEDVEXTPROC) (GLenum target, GLuint index, GLfloat *data); +typedef void (APIENTRYP PFNGLGETDOUBLEINDEXEDVEXTPROC) (GLenum target, GLuint index, GLdouble *data); +typedef void (APIENTRYP PFNGLGETPOINTERINDEXEDVEXTPROC) (GLenum target, GLuint index, void **data); +typedef void (APIENTRYP PFNGLENABLEINDEXEDEXTPROC) (GLenum target, GLuint index); +typedef void (APIENTRYP PFNGLDISABLEINDEXEDEXTPROC) (GLenum target, GLuint index); +typedef GLboolean (APIENTRYP PFNGLISENABLEDINDEXEDEXTPROC) (GLenum target, GLuint index); +typedef void (APIENTRYP PFNGLGETINTEGERINDEXEDVEXTPROC) (GLenum target, GLuint index, GLint *data); +typedef void (APIENTRYP PFNGLGETBOOLEANINDEXEDVEXTPROC) (GLenum target, GLuint index, GLboolean *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTUREIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *bits); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTUREIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *bits); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTUREIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *bits); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *bits); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *bits); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *bits); +typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXTUREIMAGEEXTPROC) (GLuint texture, GLenum target, GLint lod, void *img); +typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *bits); +typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *bits); +typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *bits); +typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXSUBIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *bits); +typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXSUBIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *bits); +typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXSUBIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *bits); +typedef void (APIENTRYP PFNGLGETCOMPRESSEDMULTITEXIMAGEEXTPROC) (GLenum texunit, GLenum target, GLint lod, void *img); +typedef void (APIENTRYP PFNGLMATRIXLOADTRANSPOSEFEXTPROC) (GLenum mode, const GLfloat *m); +typedef void (APIENTRYP PFNGLMATRIXLOADTRANSPOSEDEXTPROC) (GLenum mode, const GLdouble *m); +typedef void (APIENTRYP PFNGLMATRIXMULTTRANSPOSEFEXTPROC) (GLenum mode, const GLfloat *m); +typedef void (APIENTRYP PFNGLMATRIXMULTTRANSPOSEDEXTPROC) (GLenum mode, const GLdouble *m); +typedef void (APIENTRYP PFNGLNAMEDBUFFERDATAEXTPROC) (GLuint buffer, GLsizeiptr size, const void *data, GLenum usage); +typedef void (APIENTRYP PFNGLNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data); +typedef void *(APIENTRYP PFNGLMAPNAMEDBUFFEREXTPROC) (GLuint buffer, GLenum access); +typedef GLboolean (APIENTRYP PFNGLUNMAPNAMEDBUFFEREXTPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPARAMETERIVEXTPROC) (GLuint buffer, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPOINTERVEXTPROC) (GLuint buffer, GLenum pname, void **params); +typedef void (APIENTRYP PFNGLGETNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, void *data); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FEXTPROC) (GLuint program, GLint location, GLfloat v0); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IEXTPROC) (GLuint program, GLint location, GLint v0); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLTEXTUREBUFFEREXTPROC) (GLuint texture, GLenum target, GLenum internalformat, GLuint buffer); +typedef void (APIENTRYP PFNGLMULTITEXBUFFEREXTPROC) (GLenum texunit, GLenum target, GLenum internalformat, GLuint buffer); +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIUIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLuint *params); +typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIUIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLuint *params); +typedef void (APIENTRYP PFNGLMULTITEXPARAMETERIIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLMULTITEXPARAMETERIUIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLuint *params); +typedef void (APIENTRYP PFNGLGETMULTITEXPARAMETERIIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETMULTITEXPARAMETERIUIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLuint *params); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIEXTPROC) (GLuint program, GLint location, GLuint v0); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERS4FVEXTPROC) (GLuint program, GLenum target, GLuint index, GLsizei count, const GLfloat *params); +typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERI4IEXTPROC) (GLuint program, GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w); +typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERI4IVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLint *params); +typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERSI4IVEXTPROC) (GLuint program, GLenum target, GLuint index, GLsizei count, const GLint *params); +typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIEXTPROC) (GLuint program, GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLuint *params); +typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERSI4UIVEXTPROC) (GLuint program, GLenum target, GLuint index, GLsizei count, const GLuint *params); +typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMLOCALPARAMETERIIVEXTPROC) (GLuint program, GLenum target, GLuint index, GLint *params); +typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMLOCALPARAMETERIUIVEXTPROC) (GLuint program, GLenum target, GLuint index, GLuint *params); +typedef void (APIENTRYP PFNGLENABLECLIENTSTATEIEXTPROC) (GLenum array, GLuint index); +typedef void (APIENTRYP PFNGLDISABLECLIENTSTATEIEXTPROC) (GLenum array, GLuint index); +typedef void (APIENTRYP PFNGLGETFLOATI_VEXTPROC) (GLenum pname, GLuint index, GLfloat *params); +typedef void (APIENTRYP PFNGLGETDOUBLEI_VEXTPROC) (GLenum pname, GLuint index, GLdouble *params); +typedef void (APIENTRYP PFNGLGETPOINTERI_VEXTPROC) (GLenum pname, GLuint index, void **params); +typedef void (APIENTRYP PFNGLNAMEDPROGRAMSTRINGEXTPROC) (GLuint program, GLenum target, GLenum format, GLsizei len, const void *string); +typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETER4DEXTPROC) (GLuint program, GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETER4DVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLdouble *params); +typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETER4FEXTPROC) (GLuint program, GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETER4FVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLfloat *params); +typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMLOCALPARAMETERDVEXTPROC) (GLuint program, GLenum target, GLuint index, GLdouble *params); +typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMLOCALPARAMETERFVEXTPROC) (GLuint program, GLenum target, GLuint index, GLfloat *params); +typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMIVEXTPROC) (GLuint program, GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMSTRINGEXTPROC) (GLuint program, GLenum target, GLenum pname, void *string); +typedef void (APIENTRYP PFNGLNAMEDRENDERBUFFERSTORAGEEXTPROC) (GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLGETNAMEDRENDERBUFFERPARAMETERIVEXTPROC) (GLuint renderbuffer, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLECOVERAGEEXTPROC) (GLuint renderbuffer, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height); +typedef GLenum (APIENTRYP PFNGLCHECKNAMEDFRAMEBUFFERSTATUSEXTPROC) (GLuint framebuffer, GLenum target); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTURE1DEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTURE2DEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTURE3DEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERRENDERBUFFEREXTPROC) (GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +typedef void (APIENTRYP PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGENERATETEXTUREMIPMAPEXTPROC) (GLuint texture, GLenum target); +typedef void (APIENTRYP PFNGLGENERATEMULTITEXMIPMAPEXTPROC) (GLenum texunit, GLenum target); +typedef void (APIENTRYP PFNGLFRAMEBUFFERDRAWBUFFEREXTPROC) (GLuint framebuffer, GLenum mode); +typedef void (APIENTRYP PFNGLFRAMEBUFFERDRAWBUFFERSEXTPROC) (GLuint framebuffer, GLsizei n, const GLenum *bufs); +typedef void (APIENTRYP PFNGLFRAMEBUFFERREADBUFFEREXTPROC) (GLuint framebuffer, GLenum mode); +typedef void (APIENTRYP PFNGLGETFRAMEBUFFERPARAMETERIVEXTPROC) (GLuint framebuffer, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLNAMEDCOPYBUFFERSUBDATAEXTPROC) (GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTUREEXTPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTURELAYEREXTPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTUREFACEEXTPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLenum face); +typedef void (APIENTRYP PFNGLTEXTURERENDERBUFFEREXTPROC) (GLuint texture, GLenum target, GLuint renderbuffer); +typedef void (APIENTRYP PFNGLMULTITEXRENDERBUFFEREXTPROC) (GLenum texunit, GLenum target, GLuint renderbuffer); +typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset); +typedef void (APIENTRYP PFNGLVERTEXARRAYCOLOROFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset); +typedef void (APIENTRYP PFNGLVERTEXARRAYEDGEFLAGOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLsizei stride, GLintptr offset); +typedef void (APIENTRYP PFNGLVERTEXARRAYINDEXOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLenum type, GLsizei stride, GLintptr offset); +typedef void (APIENTRYP PFNGLVERTEXARRAYNORMALOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLenum type, GLsizei stride, GLintptr offset); +typedef void (APIENTRYP PFNGLVERTEXARRAYTEXCOORDOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset); +typedef void (APIENTRYP PFNGLVERTEXARRAYMULTITEXCOORDOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLenum texunit, GLint size, GLenum type, GLsizei stride, GLintptr offset); +typedef void (APIENTRYP PFNGLVERTEXARRAYFOGCOORDOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLenum type, GLsizei stride, GLintptr offset); +typedef void (APIENTRYP PFNGLVERTEXARRAYSECONDARYCOLOROFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset); +typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLintptr offset); +typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBIOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset); +typedef void (APIENTRYP PFNGLENABLEVERTEXARRAYEXTPROC) (GLuint vaobj, GLenum array); +typedef void (APIENTRYP PFNGLDISABLEVERTEXARRAYEXTPROC) (GLuint vaobj, GLenum array); +typedef void (APIENTRYP PFNGLENABLEVERTEXARRAYATTRIBEXTPROC) (GLuint vaobj, GLuint index); +typedef void (APIENTRYP PFNGLDISABLEVERTEXARRAYATTRIBEXTPROC) (GLuint vaobj, GLuint index); +typedef void (APIENTRYP PFNGLGETVERTEXARRAYINTEGERVEXTPROC) (GLuint vaobj, GLenum pname, GLint *param); +typedef void (APIENTRYP PFNGLGETVERTEXARRAYPOINTERVEXTPROC) (GLuint vaobj, GLenum pname, void **param); +typedef void (APIENTRYP PFNGLGETVERTEXARRAYINTEGERI_VEXTPROC) (GLuint vaobj, GLuint index, GLenum pname, GLint *param); +typedef void (APIENTRYP PFNGLGETVERTEXARRAYPOINTERI_VEXTPROC) (GLuint vaobj, GLuint index, GLenum pname, void **param); +typedef void *(APIENTRYP PFNGLMAPNAMEDBUFFERRANGEEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access); +typedef void (APIENTRYP PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length); +typedef void (APIENTRYP PFNGLNAMEDBUFFERSTORAGEEXTPROC) (GLuint buffer, GLsizeiptr size, const void *data, GLbitfield flags); +typedef void (APIENTRYP PFNGLCLEARNAMEDBUFFERDATAEXTPROC) (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data); +typedef void (APIENTRYP PFNGLCLEARNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLenum internalformat, GLsizeiptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERPARAMETERIEXTPROC) (GLuint framebuffer, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVEXTPROC) (GLuint framebuffer, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DEXTPROC) (GLuint program, GLint location, GLdouble x); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DEXTPROC) (GLuint program, GLint location, GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DEXTPROC) (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DEXTPROC) (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLTEXTUREBUFFERRANGEEXTPROC) (GLuint texture, GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); +typedef void (APIENTRYP PFNGLTEXTURESTORAGE1DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +typedef void (APIENTRYP PFNGLTEXTURESTORAGE2DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLTEXTURESTORAGE3DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +typedef void (APIENTRYP PFNGLTEXTURESTORAGE2DMULTISAMPLEEXTPROC) (GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); +typedef void (APIENTRYP PFNGLTEXTURESTORAGE3DMULTISAMPLEEXTPROC) (GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +typedef void (APIENTRYP PFNGLVERTEXARRAYBINDVERTEXBUFFEREXTPROC) (GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); +typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBFORMATEXTPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); +typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBIFORMATEXTPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBLFORMATEXTPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBBINDINGEXTPROC) (GLuint vaobj, GLuint attribindex, GLuint bindingindex); +typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXBINDINGDIVISOREXTPROC) (GLuint vaobj, GLuint bindingindex, GLuint divisor); +typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBLOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset); +typedef void (APIENTRYP PFNGLTEXTUREPAGECOMMITMENTEXTPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean resident); +typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBDIVISOREXTPROC) (GLuint vaobj, GLuint index, GLuint divisor); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMatrixLoadfEXT (GLenum mode, const GLfloat *m); +GLAPI void APIENTRY glMatrixLoaddEXT (GLenum mode, const GLdouble *m); +GLAPI void APIENTRY glMatrixMultfEXT (GLenum mode, const GLfloat *m); +GLAPI void APIENTRY glMatrixMultdEXT (GLenum mode, const GLdouble *m); +GLAPI void APIENTRY glMatrixLoadIdentityEXT (GLenum mode); +GLAPI void APIENTRY glMatrixRotatefEXT (GLenum mode, GLfloat angle, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glMatrixRotatedEXT (GLenum mode, GLdouble angle, GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY glMatrixScalefEXT (GLenum mode, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glMatrixScaledEXT (GLenum mode, GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY glMatrixTranslatefEXT (GLenum mode, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glMatrixTranslatedEXT (GLenum mode, GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY glMatrixFrustumEXT (GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); +GLAPI void APIENTRY glMatrixOrthoEXT (GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); +GLAPI void APIENTRY glMatrixPopEXT (GLenum mode); +GLAPI void APIENTRY glMatrixPushEXT (GLenum mode); +GLAPI void APIENTRY glClientAttribDefaultEXT (GLbitfield mask); +GLAPI void APIENTRY glPushClientAttribDefaultEXT (GLbitfield mask); +GLAPI void APIENTRY glTextureParameterfEXT (GLuint texture, GLenum target, GLenum pname, GLfloat param); +GLAPI void APIENTRY glTextureParameterfvEXT (GLuint texture, GLenum target, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glTextureParameteriEXT (GLuint texture, GLenum target, GLenum pname, GLint param); +GLAPI void APIENTRY glTextureParameterivEXT (GLuint texture, GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY glTextureImage1DEXT (GLuint texture, GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void *pixels); +GLAPI void APIENTRY glTextureImage2DEXT (GLuint texture, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels); +GLAPI void APIENTRY glTextureSubImage1DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels); +GLAPI void APIENTRY glTextureSubImage2DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); +GLAPI void APIENTRY glCopyTextureImage1DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); +GLAPI void APIENTRY glCopyTextureImage2DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +GLAPI void APIENTRY glCopyTextureSubImage1DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); +GLAPI void APIENTRY glCopyTextureSubImage2DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void APIENTRY glGetTextureImageEXT (GLuint texture, GLenum target, GLint level, GLenum format, GLenum type, void *pixels); +GLAPI void APIENTRY glGetTextureParameterfvEXT (GLuint texture, GLenum target, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetTextureParameterivEXT (GLuint texture, GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetTextureLevelParameterfvEXT (GLuint texture, GLenum target, GLint level, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetTextureLevelParameterivEXT (GLuint texture, GLenum target, GLint level, GLenum pname, GLint *params); +GLAPI void APIENTRY glTextureImage3DEXT (GLuint texture, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels); +GLAPI void APIENTRY glTextureSubImage3DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); +GLAPI void APIENTRY glCopyTextureSubImage3DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void APIENTRY glBindMultiTextureEXT (GLenum texunit, GLenum target, GLuint texture); +GLAPI void APIENTRY glMultiTexCoordPointerEXT (GLenum texunit, GLint size, GLenum type, GLsizei stride, const void *pointer); +GLAPI void APIENTRY glMultiTexEnvfEXT (GLenum texunit, GLenum target, GLenum pname, GLfloat param); +GLAPI void APIENTRY glMultiTexEnvfvEXT (GLenum texunit, GLenum target, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glMultiTexEnviEXT (GLenum texunit, GLenum target, GLenum pname, GLint param); +GLAPI void APIENTRY glMultiTexEnvivEXT (GLenum texunit, GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY glMultiTexGendEXT (GLenum texunit, GLenum coord, GLenum pname, GLdouble param); +GLAPI void APIENTRY glMultiTexGendvEXT (GLenum texunit, GLenum coord, GLenum pname, const GLdouble *params); +GLAPI void APIENTRY glMultiTexGenfEXT (GLenum texunit, GLenum coord, GLenum pname, GLfloat param); +GLAPI void APIENTRY glMultiTexGenfvEXT (GLenum texunit, GLenum coord, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glMultiTexGeniEXT (GLenum texunit, GLenum coord, GLenum pname, GLint param); +GLAPI void APIENTRY glMultiTexGenivEXT (GLenum texunit, GLenum coord, GLenum pname, const GLint *params); +GLAPI void APIENTRY glGetMultiTexEnvfvEXT (GLenum texunit, GLenum target, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetMultiTexEnvivEXT (GLenum texunit, GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetMultiTexGendvEXT (GLenum texunit, GLenum coord, GLenum pname, GLdouble *params); +GLAPI void APIENTRY glGetMultiTexGenfvEXT (GLenum texunit, GLenum coord, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetMultiTexGenivEXT (GLenum texunit, GLenum coord, GLenum pname, GLint *params); +GLAPI void APIENTRY glMultiTexParameteriEXT (GLenum texunit, GLenum target, GLenum pname, GLint param); +GLAPI void APIENTRY glMultiTexParameterivEXT (GLenum texunit, GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY glMultiTexParameterfEXT (GLenum texunit, GLenum target, GLenum pname, GLfloat param); +GLAPI void APIENTRY glMultiTexParameterfvEXT (GLenum texunit, GLenum target, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glMultiTexImage1DEXT (GLenum texunit, GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void *pixels); +GLAPI void APIENTRY glMultiTexImage2DEXT (GLenum texunit, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels); +GLAPI void APIENTRY glMultiTexSubImage1DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels); +GLAPI void APIENTRY glMultiTexSubImage2DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); +GLAPI void APIENTRY glCopyMultiTexImage1DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); +GLAPI void APIENTRY glCopyMultiTexImage2DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +GLAPI void APIENTRY glCopyMultiTexSubImage1DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); +GLAPI void APIENTRY glCopyMultiTexSubImage2DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void APIENTRY glGetMultiTexImageEXT (GLenum texunit, GLenum target, GLint level, GLenum format, GLenum type, void *pixels); +GLAPI void APIENTRY glGetMultiTexParameterfvEXT (GLenum texunit, GLenum target, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetMultiTexParameterivEXT (GLenum texunit, GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetMultiTexLevelParameterfvEXT (GLenum texunit, GLenum target, GLint level, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetMultiTexLevelParameterivEXT (GLenum texunit, GLenum target, GLint level, GLenum pname, GLint *params); +GLAPI void APIENTRY glMultiTexImage3DEXT (GLenum texunit, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels); +GLAPI void APIENTRY glMultiTexSubImage3DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); +GLAPI void APIENTRY glCopyMultiTexSubImage3DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void APIENTRY glEnableClientStateIndexedEXT (GLenum array, GLuint index); +GLAPI void APIENTRY glDisableClientStateIndexedEXT (GLenum array, GLuint index); +GLAPI void APIENTRY glGetFloatIndexedvEXT (GLenum target, GLuint index, GLfloat *data); +GLAPI void APIENTRY glGetDoubleIndexedvEXT (GLenum target, GLuint index, GLdouble *data); +GLAPI void APIENTRY glGetPointerIndexedvEXT (GLenum target, GLuint index, void **data); +GLAPI void APIENTRY glEnableIndexedEXT (GLenum target, GLuint index); +GLAPI void APIENTRY glDisableIndexedEXT (GLenum target, GLuint index); +GLAPI GLboolean APIENTRY glIsEnabledIndexedEXT (GLenum target, GLuint index); +GLAPI void APIENTRY glGetIntegerIndexedvEXT (GLenum target, GLuint index, GLint *data); +GLAPI void APIENTRY glGetBooleanIndexedvEXT (GLenum target, GLuint index, GLboolean *data); +GLAPI void APIENTRY glCompressedTextureImage3DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *bits); +GLAPI void APIENTRY glCompressedTextureImage2DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *bits); +GLAPI void APIENTRY glCompressedTextureImage1DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *bits); +GLAPI void APIENTRY glCompressedTextureSubImage3DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *bits); +GLAPI void APIENTRY glCompressedTextureSubImage2DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *bits); +GLAPI void APIENTRY glCompressedTextureSubImage1DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *bits); +GLAPI void APIENTRY glGetCompressedTextureImageEXT (GLuint texture, GLenum target, GLint lod, void *img); +GLAPI void APIENTRY glCompressedMultiTexImage3DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *bits); +GLAPI void APIENTRY glCompressedMultiTexImage2DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *bits); +GLAPI void APIENTRY glCompressedMultiTexImage1DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *bits); +GLAPI void APIENTRY glCompressedMultiTexSubImage3DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *bits); +GLAPI void APIENTRY glCompressedMultiTexSubImage2DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *bits); +GLAPI void APIENTRY glCompressedMultiTexSubImage1DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *bits); +GLAPI void APIENTRY glGetCompressedMultiTexImageEXT (GLenum texunit, GLenum target, GLint lod, void *img); +GLAPI void APIENTRY glMatrixLoadTransposefEXT (GLenum mode, const GLfloat *m); +GLAPI void APIENTRY glMatrixLoadTransposedEXT (GLenum mode, const GLdouble *m); +GLAPI void APIENTRY glMatrixMultTransposefEXT (GLenum mode, const GLfloat *m); +GLAPI void APIENTRY glMatrixMultTransposedEXT (GLenum mode, const GLdouble *m); +GLAPI void APIENTRY glNamedBufferDataEXT (GLuint buffer, GLsizeiptr size, const void *data, GLenum usage); +GLAPI void APIENTRY glNamedBufferSubDataEXT (GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data); +GLAPI void *APIENTRY glMapNamedBufferEXT (GLuint buffer, GLenum access); +GLAPI GLboolean APIENTRY glUnmapNamedBufferEXT (GLuint buffer); +GLAPI void APIENTRY glGetNamedBufferParameterivEXT (GLuint buffer, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetNamedBufferPointervEXT (GLuint buffer, GLenum pname, void **params); +GLAPI void APIENTRY glGetNamedBufferSubDataEXT (GLuint buffer, GLintptr offset, GLsizeiptr size, void *data); +GLAPI void APIENTRY glProgramUniform1fEXT (GLuint program, GLint location, GLfloat v0); +GLAPI void APIENTRY glProgramUniform2fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1); +GLAPI void APIENTRY glProgramUniform3fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +GLAPI void APIENTRY glProgramUniform4fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +GLAPI void APIENTRY glProgramUniform1iEXT (GLuint program, GLint location, GLint v0); +GLAPI void APIENTRY glProgramUniform2iEXT (GLuint program, GLint location, GLint v0, GLint v1); +GLAPI void APIENTRY glProgramUniform3iEXT (GLuint program, GLint location, GLint v0, GLint v1, GLint v2); +GLAPI void APIENTRY glProgramUniform4iEXT (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +GLAPI void APIENTRY glProgramUniform1fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glProgramUniform2fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glProgramUniform3fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glProgramUniform4fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glProgramUniform1ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glProgramUniform2ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glProgramUniform3ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glProgramUniform4ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glProgramUniformMatrix2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix2x3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix3x2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix2x4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix4x2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix3x4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix4x3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glTextureBufferEXT (GLuint texture, GLenum target, GLenum internalformat, GLuint buffer); +GLAPI void APIENTRY glMultiTexBufferEXT (GLenum texunit, GLenum target, GLenum internalformat, GLuint buffer); +GLAPI void APIENTRY glTextureParameterIivEXT (GLuint texture, GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY glTextureParameterIuivEXT (GLuint texture, GLenum target, GLenum pname, const GLuint *params); +GLAPI void APIENTRY glGetTextureParameterIivEXT (GLuint texture, GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetTextureParameterIuivEXT (GLuint texture, GLenum target, GLenum pname, GLuint *params); +GLAPI void APIENTRY glMultiTexParameterIivEXT (GLenum texunit, GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY glMultiTexParameterIuivEXT (GLenum texunit, GLenum target, GLenum pname, const GLuint *params); +GLAPI void APIENTRY glGetMultiTexParameterIivEXT (GLenum texunit, GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetMultiTexParameterIuivEXT (GLenum texunit, GLenum target, GLenum pname, GLuint *params); +GLAPI void APIENTRY glProgramUniform1uiEXT (GLuint program, GLint location, GLuint v0); +GLAPI void APIENTRY glProgramUniform2uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1); +GLAPI void APIENTRY glProgramUniform3uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2); +GLAPI void APIENTRY glProgramUniform4uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +GLAPI void APIENTRY glProgramUniform1uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glProgramUniform2uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glProgramUniform3uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glProgramUniform4uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glNamedProgramLocalParameters4fvEXT (GLuint program, GLenum target, GLuint index, GLsizei count, const GLfloat *params); +GLAPI void APIENTRY glNamedProgramLocalParameterI4iEXT (GLuint program, GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w); +GLAPI void APIENTRY glNamedProgramLocalParameterI4ivEXT (GLuint program, GLenum target, GLuint index, const GLint *params); +GLAPI void APIENTRY glNamedProgramLocalParametersI4ivEXT (GLuint program, GLenum target, GLuint index, GLsizei count, const GLint *params); +GLAPI void APIENTRY glNamedProgramLocalParameterI4uiEXT (GLuint program, GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +GLAPI void APIENTRY glNamedProgramLocalParameterI4uivEXT (GLuint program, GLenum target, GLuint index, const GLuint *params); +GLAPI void APIENTRY glNamedProgramLocalParametersI4uivEXT (GLuint program, GLenum target, GLuint index, GLsizei count, const GLuint *params); +GLAPI void APIENTRY glGetNamedProgramLocalParameterIivEXT (GLuint program, GLenum target, GLuint index, GLint *params); +GLAPI void APIENTRY glGetNamedProgramLocalParameterIuivEXT (GLuint program, GLenum target, GLuint index, GLuint *params); +GLAPI void APIENTRY glEnableClientStateiEXT (GLenum array, GLuint index); +GLAPI void APIENTRY glDisableClientStateiEXT (GLenum array, GLuint index); +GLAPI void APIENTRY glGetFloati_vEXT (GLenum pname, GLuint index, GLfloat *params); +GLAPI void APIENTRY glGetDoublei_vEXT (GLenum pname, GLuint index, GLdouble *params); +GLAPI void APIENTRY glGetPointeri_vEXT (GLenum pname, GLuint index, void **params); +GLAPI void APIENTRY glNamedProgramStringEXT (GLuint program, GLenum target, GLenum format, GLsizei len, const void *string); +GLAPI void APIENTRY glNamedProgramLocalParameter4dEXT (GLuint program, GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY glNamedProgramLocalParameter4dvEXT (GLuint program, GLenum target, GLuint index, const GLdouble *params); +GLAPI void APIENTRY glNamedProgramLocalParameter4fEXT (GLuint program, GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void APIENTRY glNamedProgramLocalParameter4fvEXT (GLuint program, GLenum target, GLuint index, const GLfloat *params); +GLAPI void APIENTRY glGetNamedProgramLocalParameterdvEXT (GLuint program, GLenum target, GLuint index, GLdouble *params); +GLAPI void APIENTRY glGetNamedProgramLocalParameterfvEXT (GLuint program, GLenum target, GLuint index, GLfloat *params); +GLAPI void APIENTRY glGetNamedProgramivEXT (GLuint program, GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetNamedProgramStringEXT (GLuint program, GLenum target, GLenum pname, void *string); +GLAPI void APIENTRY glNamedRenderbufferStorageEXT (GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI void APIENTRY glGetNamedRenderbufferParameterivEXT (GLuint renderbuffer, GLenum pname, GLint *params); +GLAPI void APIENTRY glNamedRenderbufferStorageMultisampleEXT (GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI void APIENTRY glNamedRenderbufferStorageMultisampleCoverageEXT (GLuint renderbuffer, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI GLenum APIENTRY glCheckNamedFramebufferStatusEXT (GLuint framebuffer, GLenum target); +GLAPI void APIENTRY glNamedFramebufferTexture1DEXT (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +GLAPI void APIENTRY glNamedFramebufferTexture2DEXT (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +GLAPI void APIENTRY glNamedFramebufferTexture3DEXT (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +GLAPI void APIENTRY glNamedFramebufferRenderbufferEXT (GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +GLAPI void APIENTRY glGetNamedFramebufferAttachmentParameterivEXT (GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params); +GLAPI void APIENTRY glGenerateTextureMipmapEXT (GLuint texture, GLenum target); +GLAPI void APIENTRY glGenerateMultiTexMipmapEXT (GLenum texunit, GLenum target); +GLAPI void APIENTRY glFramebufferDrawBufferEXT (GLuint framebuffer, GLenum mode); +GLAPI void APIENTRY glFramebufferDrawBuffersEXT (GLuint framebuffer, GLsizei n, const GLenum *bufs); +GLAPI void APIENTRY glFramebufferReadBufferEXT (GLuint framebuffer, GLenum mode); +GLAPI void APIENTRY glGetFramebufferParameterivEXT (GLuint framebuffer, GLenum pname, GLint *params); +GLAPI void APIENTRY glNamedCopyBufferSubDataEXT (GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +GLAPI void APIENTRY glNamedFramebufferTextureEXT (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level); +GLAPI void APIENTRY glNamedFramebufferTextureLayerEXT (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer); +GLAPI void APIENTRY glNamedFramebufferTextureFaceEXT (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLenum face); +GLAPI void APIENTRY glTextureRenderbufferEXT (GLuint texture, GLenum target, GLuint renderbuffer); +GLAPI void APIENTRY glMultiTexRenderbufferEXT (GLenum texunit, GLenum target, GLuint renderbuffer); +GLAPI void APIENTRY glVertexArrayVertexOffsetEXT (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset); +GLAPI void APIENTRY glVertexArrayColorOffsetEXT (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset); +GLAPI void APIENTRY glVertexArrayEdgeFlagOffsetEXT (GLuint vaobj, GLuint buffer, GLsizei stride, GLintptr offset); +GLAPI void APIENTRY glVertexArrayIndexOffsetEXT (GLuint vaobj, GLuint buffer, GLenum type, GLsizei stride, GLintptr offset); +GLAPI void APIENTRY glVertexArrayNormalOffsetEXT (GLuint vaobj, GLuint buffer, GLenum type, GLsizei stride, GLintptr offset); +GLAPI void APIENTRY glVertexArrayTexCoordOffsetEXT (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset); +GLAPI void APIENTRY glVertexArrayMultiTexCoordOffsetEXT (GLuint vaobj, GLuint buffer, GLenum texunit, GLint size, GLenum type, GLsizei stride, GLintptr offset); +GLAPI void APIENTRY glVertexArrayFogCoordOffsetEXT (GLuint vaobj, GLuint buffer, GLenum type, GLsizei stride, GLintptr offset); +GLAPI void APIENTRY glVertexArraySecondaryColorOffsetEXT (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset); +GLAPI void APIENTRY glVertexArrayVertexAttribOffsetEXT (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLintptr offset); +GLAPI void APIENTRY glVertexArrayVertexAttribIOffsetEXT (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset); +GLAPI void APIENTRY glEnableVertexArrayEXT (GLuint vaobj, GLenum array); +GLAPI void APIENTRY glDisableVertexArrayEXT (GLuint vaobj, GLenum array); +GLAPI void APIENTRY glEnableVertexArrayAttribEXT (GLuint vaobj, GLuint index); +GLAPI void APIENTRY glDisableVertexArrayAttribEXT (GLuint vaobj, GLuint index); +GLAPI void APIENTRY glGetVertexArrayIntegervEXT (GLuint vaobj, GLenum pname, GLint *param); +GLAPI void APIENTRY glGetVertexArrayPointervEXT (GLuint vaobj, GLenum pname, void **param); +GLAPI void APIENTRY glGetVertexArrayIntegeri_vEXT (GLuint vaobj, GLuint index, GLenum pname, GLint *param); +GLAPI void APIENTRY glGetVertexArrayPointeri_vEXT (GLuint vaobj, GLuint index, GLenum pname, void **param); +GLAPI void *APIENTRY glMapNamedBufferRangeEXT (GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access); +GLAPI void APIENTRY glFlushMappedNamedBufferRangeEXT (GLuint buffer, GLintptr offset, GLsizeiptr length); +GLAPI void APIENTRY glNamedBufferStorageEXT (GLuint buffer, GLsizeiptr size, const void *data, GLbitfield flags); +GLAPI void APIENTRY glClearNamedBufferDataEXT (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data); +GLAPI void APIENTRY glClearNamedBufferSubDataEXT (GLuint buffer, GLenum internalformat, GLsizeiptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data); +GLAPI void APIENTRY glNamedFramebufferParameteriEXT (GLuint framebuffer, GLenum pname, GLint param); +GLAPI void APIENTRY glGetNamedFramebufferParameterivEXT (GLuint framebuffer, GLenum pname, GLint *params); +GLAPI void APIENTRY glProgramUniform1dEXT (GLuint program, GLint location, GLdouble x); +GLAPI void APIENTRY glProgramUniform2dEXT (GLuint program, GLint location, GLdouble x, GLdouble y); +GLAPI void APIENTRY glProgramUniform3dEXT (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY glProgramUniform4dEXT (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY glProgramUniform1dvEXT (GLuint program, GLint location, GLsizei count, const GLdouble *value); +GLAPI void APIENTRY glProgramUniform2dvEXT (GLuint program, GLint location, GLsizei count, const GLdouble *value); +GLAPI void APIENTRY glProgramUniform3dvEXT (GLuint program, GLint location, GLsizei count, const GLdouble *value); +GLAPI void APIENTRY glProgramUniform4dvEXT (GLuint program, GLint location, GLsizei count, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix2dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix3dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix4dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix2x3dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix2x4dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix3x2dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix3x4dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix4x2dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix4x3dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glTextureBufferRangeEXT (GLuint texture, GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); +GLAPI void APIENTRY glTextureStorage1DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +GLAPI void APIENTRY glTextureStorage2DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI void APIENTRY glTextureStorage3DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +GLAPI void APIENTRY glTextureStorage2DMultisampleEXT (GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); +GLAPI void APIENTRY glTextureStorage3DMultisampleEXT (GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +GLAPI void APIENTRY glVertexArrayBindVertexBufferEXT (GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); +GLAPI void APIENTRY glVertexArrayVertexAttribFormatEXT (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); +GLAPI void APIENTRY glVertexArrayVertexAttribIFormatEXT (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +GLAPI void APIENTRY glVertexArrayVertexAttribLFormatEXT (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +GLAPI void APIENTRY glVertexArrayVertexAttribBindingEXT (GLuint vaobj, GLuint attribindex, GLuint bindingindex); +GLAPI void APIENTRY glVertexArrayVertexBindingDivisorEXT (GLuint vaobj, GLuint bindingindex, GLuint divisor); +GLAPI void APIENTRY glVertexArrayVertexAttribLOffsetEXT (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset); +GLAPI void APIENTRY glTexturePageCommitmentEXT (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean resident); +GLAPI void APIENTRY glVertexArrayVertexAttribDivisorEXT (GLuint vaobj, GLuint index, GLuint divisor); +#endif +#endif /* GL_EXT_direct_state_access */ + +#ifndef GL_EXT_draw_buffers2 +#define GL_EXT_draw_buffers2 1 +typedef void (APIENTRYP PFNGLCOLORMASKINDEXEDEXTPROC) (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glColorMaskIndexedEXT (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); +#endif +#endif /* GL_EXT_draw_buffers2 */ + +#ifndef GL_EXT_draw_instanced +#define GL_EXT_draw_instanced 1 +typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDEXTPROC) (GLenum mode, GLint start, GLsizei count, GLsizei primcount); +typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDEXTPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawArraysInstancedEXT (GLenum mode, GLint start, GLsizei count, GLsizei primcount); +GLAPI void APIENTRY glDrawElementsInstancedEXT (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); +#endif +#endif /* GL_EXT_draw_instanced */ + +#ifndef GL_EXT_draw_range_elements +#define GL_EXT_draw_range_elements 1 +#define GL_MAX_ELEMENTS_VERTICES_EXT 0x80E8 +#define GL_MAX_ELEMENTS_INDICES_EXT 0x80E9 +typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSEXTPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawRangeElementsEXT (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices); +#endif +#endif /* GL_EXT_draw_range_elements */ + +#ifndef GL_EXT_fog_coord +#define GL_EXT_fog_coord 1 +#define GL_FOG_COORDINATE_SOURCE_EXT 0x8450 +#define GL_FOG_COORDINATE_EXT 0x8451 +#define GL_FRAGMENT_DEPTH_EXT 0x8452 +#define GL_CURRENT_FOG_COORDINATE_EXT 0x8453 +#define GL_FOG_COORDINATE_ARRAY_TYPE_EXT 0x8454 +#define GL_FOG_COORDINATE_ARRAY_STRIDE_EXT 0x8455 +#define GL_FOG_COORDINATE_ARRAY_POINTER_EXT 0x8456 +#define GL_FOG_COORDINATE_ARRAY_EXT 0x8457 +typedef void (APIENTRYP PFNGLFOGCOORDFEXTPROC) (GLfloat coord); +typedef void (APIENTRYP PFNGLFOGCOORDFVEXTPROC) (const GLfloat *coord); +typedef void (APIENTRYP PFNGLFOGCOORDDEXTPROC) (GLdouble coord); +typedef void (APIENTRYP PFNGLFOGCOORDDVEXTPROC) (const GLdouble *coord); +typedef void (APIENTRYP PFNGLFOGCOORDPOINTEREXTPROC) (GLenum type, GLsizei stride, const void *pointer); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFogCoordfEXT (GLfloat coord); +GLAPI void APIENTRY glFogCoordfvEXT (const GLfloat *coord); +GLAPI void APIENTRY glFogCoorddEXT (GLdouble coord); +GLAPI void APIENTRY glFogCoorddvEXT (const GLdouble *coord); +GLAPI void APIENTRY glFogCoordPointerEXT (GLenum type, GLsizei stride, const void *pointer); +#endif +#endif /* GL_EXT_fog_coord */ + +#ifndef GL_EXT_framebuffer_blit +#define GL_EXT_framebuffer_blit 1 +#define GL_READ_FRAMEBUFFER_EXT 0x8CA8 +#define GL_DRAW_FRAMEBUFFER_EXT 0x8CA9 +#define GL_DRAW_FRAMEBUFFER_BINDING_EXT 0x8CA6 +#define GL_READ_FRAMEBUFFER_BINDING_EXT 0x8CAA +typedef void (APIENTRYP PFNGLBLITFRAMEBUFFEREXTPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlitFramebufferEXT (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +#endif +#endif /* GL_EXT_framebuffer_blit */ + +#ifndef GL_EXT_framebuffer_multisample +#define GL_EXT_framebuffer_multisample 1 +#define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56 +#define GL_MAX_SAMPLES_EXT 0x8D57 +typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glRenderbufferStorageMultisampleEXT (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +#endif +#endif /* GL_EXT_framebuffer_multisample */ + +#ifndef GL_EXT_framebuffer_multisample_blit_scaled +#define GL_EXT_framebuffer_multisample_blit_scaled 1 +#define GL_SCALED_RESOLVE_FASTEST_EXT 0x90BA +#define GL_SCALED_RESOLVE_NICEST_EXT 0x90BB +#endif /* GL_EXT_framebuffer_multisample_blit_scaled */ + +#ifndef GL_EXT_framebuffer_object +#define GL_EXT_framebuffer_object 1 +#define GL_INVALID_FRAMEBUFFER_OPERATION_EXT 0x0506 +#define GL_MAX_RENDERBUFFER_SIZE_EXT 0x84E8 +#define GL_FRAMEBUFFER_BINDING_EXT 0x8CA6 +#define GL_RENDERBUFFER_BINDING_EXT 0x8CA7 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT 0x8CD0 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT 0x8CD1 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT 0x8CD2 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT 0x8CD3 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT 0x8CD4 +#define GL_FRAMEBUFFER_COMPLETE_EXT 0x8CD5 +#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT 0x8CD6 +#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT 0x8CD7 +#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT 0x8CD9 +#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT 0x8CDA +#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT 0x8CDB +#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT 0x8CDC +#define GL_FRAMEBUFFER_UNSUPPORTED_EXT 0x8CDD +#define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF +#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0 +#define GL_COLOR_ATTACHMENT1_EXT 0x8CE1 +#define GL_COLOR_ATTACHMENT2_EXT 0x8CE2 +#define GL_COLOR_ATTACHMENT3_EXT 0x8CE3 +#define GL_COLOR_ATTACHMENT4_EXT 0x8CE4 +#define GL_COLOR_ATTACHMENT5_EXT 0x8CE5 +#define GL_COLOR_ATTACHMENT6_EXT 0x8CE6 +#define GL_COLOR_ATTACHMENT7_EXT 0x8CE7 +#define GL_COLOR_ATTACHMENT8_EXT 0x8CE8 +#define GL_COLOR_ATTACHMENT9_EXT 0x8CE9 +#define GL_COLOR_ATTACHMENT10_EXT 0x8CEA +#define GL_COLOR_ATTACHMENT11_EXT 0x8CEB +#define GL_COLOR_ATTACHMENT12_EXT 0x8CEC +#define GL_COLOR_ATTACHMENT13_EXT 0x8CED +#define GL_COLOR_ATTACHMENT14_EXT 0x8CEE +#define GL_COLOR_ATTACHMENT15_EXT 0x8CEF +#define GL_DEPTH_ATTACHMENT_EXT 0x8D00 +#define GL_STENCIL_ATTACHMENT_EXT 0x8D20 +#define GL_FRAMEBUFFER_EXT 0x8D40 +#define GL_RENDERBUFFER_EXT 0x8D41 +#define GL_RENDERBUFFER_WIDTH_EXT 0x8D42 +#define GL_RENDERBUFFER_HEIGHT_EXT 0x8D43 +#define GL_RENDERBUFFER_INTERNAL_FORMAT_EXT 0x8D44 +#define GL_STENCIL_INDEX1_EXT 0x8D46 +#define GL_STENCIL_INDEX4_EXT 0x8D47 +#define GL_STENCIL_INDEX8_EXT 0x8D48 +#define GL_STENCIL_INDEX16_EXT 0x8D49 +#define GL_RENDERBUFFER_RED_SIZE_EXT 0x8D50 +#define GL_RENDERBUFFER_GREEN_SIZE_EXT 0x8D51 +#define GL_RENDERBUFFER_BLUE_SIZE_EXT 0x8D52 +#define GL_RENDERBUFFER_ALPHA_SIZE_EXT 0x8D53 +#define GL_RENDERBUFFER_DEPTH_SIZE_EXT 0x8D54 +#define GL_RENDERBUFFER_STENCIL_SIZE_EXT 0x8D55 +typedef GLboolean (APIENTRYP PFNGLISRENDERBUFFEREXTPROC) (GLuint renderbuffer); +typedef void (APIENTRYP PFNGLBINDRENDERBUFFEREXTPROC) (GLenum target, GLuint renderbuffer); +typedef void (APIENTRYP PFNGLDELETERENDERBUFFERSEXTPROC) (GLsizei n, const GLuint *renderbuffers); +typedef void (APIENTRYP PFNGLGENRENDERBUFFERSEXTPROC) (GLsizei n, GLuint *renderbuffers); +typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef GLboolean (APIENTRYP PFNGLISFRAMEBUFFEREXTPROC) (GLuint framebuffer); +typedef void (APIENTRYP PFNGLBINDFRAMEBUFFEREXTPROC) (GLenum target, GLuint framebuffer); +typedef void (APIENTRYP PFNGLDELETEFRAMEBUFFERSEXTPROC) (GLsizei n, const GLuint *framebuffers); +typedef void (APIENTRYP PFNGLGENFRAMEBUFFERSEXTPROC) (GLsizei n, GLuint *framebuffers); +typedef GLenum (APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC) (GLenum target); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE1DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +typedef void (APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +typedef void (APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGENERATEMIPMAPEXTPROC) (GLenum target); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLboolean APIENTRY glIsRenderbufferEXT (GLuint renderbuffer); +GLAPI void APIENTRY glBindRenderbufferEXT (GLenum target, GLuint renderbuffer); +GLAPI void APIENTRY glDeleteRenderbuffersEXT (GLsizei n, const GLuint *renderbuffers); +GLAPI void APIENTRY glGenRenderbuffersEXT (GLsizei n, GLuint *renderbuffers); +GLAPI void APIENTRY glRenderbufferStorageEXT (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI void APIENTRY glGetRenderbufferParameterivEXT (GLenum target, GLenum pname, GLint *params); +GLAPI GLboolean APIENTRY glIsFramebufferEXT (GLuint framebuffer); +GLAPI void APIENTRY glBindFramebufferEXT (GLenum target, GLuint framebuffer); +GLAPI void APIENTRY glDeleteFramebuffersEXT (GLsizei n, const GLuint *framebuffers); +GLAPI void APIENTRY glGenFramebuffersEXT (GLsizei n, GLuint *framebuffers); +GLAPI GLenum APIENTRY glCheckFramebufferStatusEXT (GLenum target); +GLAPI void APIENTRY glFramebufferTexture1DEXT (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +GLAPI void APIENTRY glFramebufferTexture2DEXT (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +GLAPI void APIENTRY glFramebufferTexture3DEXT (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +GLAPI void APIENTRY glFramebufferRenderbufferEXT (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +GLAPI void APIENTRY glGetFramebufferAttachmentParameterivEXT (GLenum target, GLenum attachment, GLenum pname, GLint *params); +GLAPI void APIENTRY glGenerateMipmapEXT (GLenum target); +#endif +#endif /* GL_EXT_framebuffer_object */ + +#ifndef GL_EXT_framebuffer_sRGB +#define GL_EXT_framebuffer_sRGB 1 +#define GL_FRAMEBUFFER_SRGB_EXT 0x8DB9 +#define GL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x8DBA +#endif /* GL_EXT_framebuffer_sRGB */ + +#ifndef GL_EXT_geometry_shader4 +#define GL_EXT_geometry_shader4 1 +#define GL_GEOMETRY_SHADER_EXT 0x8DD9 +#define GL_GEOMETRY_VERTICES_OUT_EXT 0x8DDA +#define GL_GEOMETRY_INPUT_TYPE_EXT 0x8DDB +#define GL_GEOMETRY_OUTPUT_TYPE_EXT 0x8DDC +#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT 0x8C29 +#define GL_MAX_GEOMETRY_VARYING_COMPONENTS_EXT 0x8DDD +#define GL_MAX_VERTEX_VARYING_COMPONENTS_EXT 0x8DDE +#define GL_MAX_VARYING_COMPONENTS_EXT 0x8B4B +#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT 0x8DDF +#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT 0x8DE0 +#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT 0x8DE1 +#define GL_LINES_ADJACENCY_EXT 0x000A +#define GL_LINE_STRIP_ADJACENCY_EXT 0x000B +#define GL_TRIANGLES_ADJACENCY_EXT 0x000C +#define GL_TRIANGLE_STRIP_ADJACENCY_EXT 0x000D +#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT 0x8DA8 +#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_EXT 0x8DA9 +#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT 0x8DA7 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT 0x8CD4 +#define GL_PROGRAM_POINT_SIZE_EXT 0x8642 +typedef void (APIENTRYP PFNGLPROGRAMPARAMETERIEXTPROC) (GLuint program, GLenum pname, GLint value); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glProgramParameteriEXT (GLuint program, GLenum pname, GLint value); +#endif +#endif /* GL_EXT_geometry_shader4 */ + +#ifndef GL_EXT_gpu_program_parameters +#define GL_EXT_gpu_program_parameters 1 +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERS4FVEXTPROC) (GLenum target, GLuint index, GLsizei count, const GLfloat *params); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERS4FVEXTPROC) (GLenum target, GLuint index, GLsizei count, const GLfloat *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glProgramEnvParameters4fvEXT (GLenum target, GLuint index, GLsizei count, const GLfloat *params); +GLAPI void APIENTRY glProgramLocalParameters4fvEXT (GLenum target, GLuint index, GLsizei count, const GLfloat *params); +#endif +#endif /* GL_EXT_gpu_program_parameters */ + +#ifndef GL_EXT_gpu_shader4 +#define GL_EXT_gpu_shader4 1 +#define GL_VERTEX_ATTRIB_ARRAY_INTEGER_EXT 0x88FD +#define GL_SAMPLER_1D_ARRAY_EXT 0x8DC0 +#define GL_SAMPLER_2D_ARRAY_EXT 0x8DC1 +#define GL_SAMPLER_BUFFER_EXT 0x8DC2 +#define GL_SAMPLER_1D_ARRAY_SHADOW_EXT 0x8DC3 +#define GL_SAMPLER_2D_ARRAY_SHADOW_EXT 0x8DC4 +#define GL_SAMPLER_CUBE_SHADOW_EXT 0x8DC5 +#define GL_UNSIGNED_INT_VEC2_EXT 0x8DC6 +#define GL_UNSIGNED_INT_VEC3_EXT 0x8DC7 +#define GL_UNSIGNED_INT_VEC4_EXT 0x8DC8 +#define GL_INT_SAMPLER_1D_EXT 0x8DC9 +#define GL_INT_SAMPLER_2D_EXT 0x8DCA +#define GL_INT_SAMPLER_3D_EXT 0x8DCB +#define GL_INT_SAMPLER_CUBE_EXT 0x8DCC +#define GL_INT_SAMPLER_2D_RECT_EXT 0x8DCD +#define GL_INT_SAMPLER_1D_ARRAY_EXT 0x8DCE +#define GL_INT_SAMPLER_2D_ARRAY_EXT 0x8DCF +#define GL_INT_SAMPLER_BUFFER_EXT 0x8DD0 +#define GL_UNSIGNED_INT_SAMPLER_1D_EXT 0x8DD1 +#define GL_UNSIGNED_INT_SAMPLER_2D_EXT 0x8DD2 +#define GL_UNSIGNED_INT_SAMPLER_3D_EXT 0x8DD3 +#define GL_UNSIGNED_INT_SAMPLER_CUBE_EXT 0x8DD4 +#define GL_UNSIGNED_INT_SAMPLER_2D_RECT_EXT 0x8DD5 +#define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY_EXT 0x8DD6 +#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY_EXT 0x8DD7 +#define GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT 0x8DD8 +#define GL_MIN_PROGRAM_TEXEL_OFFSET_EXT 0x8904 +#define GL_MAX_PROGRAM_TEXEL_OFFSET_EXT 0x8905 +typedef void (APIENTRYP PFNGLGETUNIFORMUIVEXTPROC) (GLuint program, GLint location, GLuint *params); +typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONEXTPROC) (GLuint program, GLuint color, const GLchar *name); +typedef GLint (APIENTRYP PFNGLGETFRAGDATALOCATIONEXTPROC) (GLuint program, const GLchar *name); +typedef void (APIENTRYP PFNGLUNIFORM1UIEXTPROC) (GLint location, GLuint v0); +typedef void (APIENTRYP PFNGLUNIFORM2UIEXTPROC) (GLint location, GLuint v0, GLuint v1); +typedef void (APIENTRYP PFNGLUNIFORM3UIEXTPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2); +typedef void (APIENTRYP PFNGLUNIFORM4UIEXTPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +typedef void (APIENTRYP PFNGLUNIFORM1UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLUNIFORM2UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLUNIFORM3UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLUNIFORM4UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetUniformuivEXT (GLuint program, GLint location, GLuint *params); +GLAPI void APIENTRY glBindFragDataLocationEXT (GLuint program, GLuint color, const GLchar *name); +GLAPI GLint APIENTRY glGetFragDataLocationEXT (GLuint program, const GLchar *name); +GLAPI void APIENTRY glUniform1uiEXT (GLint location, GLuint v0); +GLAPI void APIENTRY glUniform2uiEXT (GLint location, GLuint v0, GLuint v1); +GLAPI void APIENTRY glUniform3uiEXT (GLint location, GLuint v0, GLuint v1, GLuint v2); +GLAPI void APIENTRY glUniform4uiEXT (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +GLAPI void APIENTRY glUniform1uivEXT (GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glUniform2uivEXT (GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glUniform3uivEXT (GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glUniform4uivEXT (GLint location, GLsizei count, const GLuint *value); +#endif +#endif /* GL_EXT_gpu_shader4 */ + +#ifndef GL_EXT_histogram +#define GL_EXT_histogram 1 +#define GL_HISTOGRAM_EXT 0x8024 +#define GL_PROXY_HISTOGRAM_EXT 0x8025 +#define GL_HISTOGRAM_WIDTH_EXT 0x8026 +#define GL_HISTOGRAM_FORMAT_EXT 0x8027 +#define GL_HISTOGRAM_RED_SIZE_EXT 0x8028 +#define GL_HISTOGRAM_GREEN_SIZE_EXT 0x8029 +#define GL_HISTOGRAM_BLUE_SIZE_EXT 0x802A +#define GL_HISTOGRAM_ALPHA_SIZE_EXT 0x802B +#define GL_HISTOGRAM_LUMINANCE_SIZE_EXT 0x802C +#define GL_HISTOGRAM_SINK_EXT 0x802D +#define GL_MINMAX_EXT 0x802E +#define GL_MINMAX_FORMAT_EXT 0x802F +#define GL_MINMAX_SINK_EXT 0x8030 +#define GL_TABLE_TOO_LARGE_EXT 0x8031 +typedef void (APIENTRYP PFNGLGETHISTOGRAMEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, void *values); +typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETMINMAXEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, void *values); +typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLHISTOGRAMEXTPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); +typedef void (APIENTRYP PFNGLMINMAXEXTPROC) (GLenum target, GLenum internalformat, GLboolean sink); +typedef void (APIENTRYP PFNGLRESETHISTOGRAMEXTPROC) (GLenum target); +typedef void (APIENTRYP PFNGLRESETMINMAXEXTPROC) (GLenum target); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetHistogramEXT (GLenum target, GLboolean reset, GLenum format, GLenum type, void *values); +GLAPI void APIENTRY glGetHistogramParameterfvEXT (GLenum target, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetHistogramParameterivEXT (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetMinmaxEXT (GLenum target, GLboolean reset, GLenum format, GLenum type, void *values); +GLAPI void APIENTRY glGetMinmaxParameterfvEXT (GLenum target, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetMinmaxParameterivEXT (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glHistogramEXT (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); +GLAPI void APIENTRY glMinmaxEXT (GLenum target, GLenum internalformat, GLboolean sink); +GLAPI void APIENTRY glResetHistogramEXT (GLenum target); +GLAPI void APIENTRY glResetMinmaxEXT (GLenum target); +#endif +#endif /* GL_EXT_histogram */ + +#ifndef GL_EXT_index_array_formats +#define GL_EXT_index_array_formats 1 +#define GL_IUI_V2F_EXT 0x81AD +#define GL_IUI_V3F_EXT 0x81AE +#define GL_IUI_N3F_V2F_EXT 0x81AF +#define GL_IUI_N3F_V3F_EXT 0x81B0 +#define GL_T2F_IUI_V2F_EXT 0x81B1 +#define GL_T2F_IUI_V3F_EXT 0x81B2 +#define GL_T2F_IUI_N3F_V2F_EXT 0x81B3 +#define GL_T2F_IUI_N3F_V3F_EXT 0x81B4 +#endif /* GL_EXT_index_array_formats */ + +#ifndef GL_EXT_index_func +#define GL_EXT_index_func 1 +#define GL_INDEX_TEST_EXT 0x81B5 +#define GL_INDEX_TEST_FUNC_EXT 0x81B6 +#define GL_INDEX_TEST_REF_EXT 0x81B7 +typedef void (APIENTRYP PFNGLINDEXFUNCEXTPROC) (GLenum func, GLclampf ref); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glIndexFuncEXT (GLenum func, GLclampf ref); +#endif +#endif /* GL_EXT_index_func */ + +#ifndef GL_EXT_index_material +#define GL_EXT_index_material 1 +#define GL_INDEX_MATERIAL_EXT 0x81B8 +#define GL_INDEX_MATERIAL_PARAMETER_EXT 0x81B9 +#define GL_INDEX_MATERIAL_FACE_EXT 0x81BA +typedef void (APIENTRYP PFNGLINDEXMATERIALEXTPROC) (GLenum face, GLenum mode); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glIndexMaterialEXT (GLenum face, GLenum mode); +#endif +#endif /* GL_EXT_index_material */ + +#ifndef GL_EXT_index_texture +#define GL_EXT_index_texture 1 +#endif /* GL_EXT_index_texture */ + +#ifndef GL_EXT_light_texture +#define GL_EXT_light_texture 1 +#define GL_FRAGMENT_MATERIAL_EXT 0x8349 +#define GL_FRAGMENT_NORMAL_EXT 0x834A +#define GL_FRAGMENT_COLOR_EXT 0x834C +#define GL_ATTENUATION_EXT 0x834D +#define GL_SHADOW_ATTENUATION_EXT 0x834E +#define GL_TEXTURE_APPLICATION_MODE_EXT 0x834F +#define GL_TEXTURE_LIGHT_EXT 0x8350 +#define GL_TEXTURE_MATERIAL_FACE_EXT 0x8351 +#define GL_TEXTURE_MATERIAL_PARAMETER_EXT 0x8352 +typedef void (APIENTRYP PFNGLAPPLYTEXTUREEXTPROC) (GLenum mode); +typedef void (APIENTRYP PFNGLTEXTURELIGHTEXTPROC) (GLenum pname); +typedef void (APIENTRYP PFNGLTEXTUREMATERIALEXTPROC) (GLenum face, GLenum mode); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glApplyTextureEXT (GLenum mode); +GLAPI void APIENTRY glTextureLightEXT (GLenum pname); +GLAPI void APIENTRY glTextureMaterialEXT (GLenum face, GLenum mode); +#endif +#endif /* GL_EXT_light_texture */ + +#ifndef GL_EXT_misc_attribute +#define GL_EXT_misc_attribute 1 +#endif /* GL_EXT_misc_attribute */ + +#ifndef GL_EXT_multi_draw_arrays +#define GL_EXT_multi_draw_arrays 1 +typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMultiDrawArraysEXT (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); +GLAPI void APIENTRY glMultiDrawElementsEXT (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount); +#endif +#endif /* GL_EXT_multi_draw_arrays */ + +#ifndef GL_EXT_multisample +#define GL_EXT_multisample 1 +#define GL_MULTISAMPLE_EXT 0x809D +#define GL_SAMPLE_ALPHA_TO_MASK_EXT 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE_EXT 0x809F +#define GL_SAMPLE_MASK_EXT 0x80A0 +#define GL_1PASS_EXT 0x80A1 +#define GL_2PASS_0_EXT 0x80A2 +#define GL_2PASS_1_EXT 0x80A3 +#define GL_4PASS_0_EXT 0x80A4 +#define GL_4PASS_1_EXT 0x80A5 +#define GL_4PASS_2_EXT 0x80A6 +#define GL_4PASS_3_EXT 0x80A7 +#define GL_SAMPLE_BUFFERS_EXT 0x80A8 +#define GL_SAMPLES_EXT 0x80A9 +#define GL_SAMPLE_MASK_VALUE_EXT 0x80AA +#define GL_SAMPLE_MASK_INVERT_EXT 0x80AB +#define GL_SAMPLE_PATTERN_EXT 0x80AC +#define GL_MULTISAMPLE_BIT_EXT 0x20000000 +typedef void (APIENTRYP PFNGLSAMPLEMASKEXTPROC) (GLclampf value, GLboolean invert); +typedef void (APIENTRYP PFNGLSAMPLEPATTERNEXTPROC) (GLenum pattern); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSampleMaskEXT (GLclampf value, GLboolean invert); +GLAPI void APIENTRY glSamplePatternEXT (GLenum pattern); +#endif +#endif /* GL_EXT_multisample */ + +#ifndef GL_EXT_packed_depth_stencil +#define GL_EXT_packed_depth_stencil 1 +#define GL_DEPTH_STENCIL_EXT 0x84F9 +#define GL_UNSIGNED_INT_24_8_EXT 0x84FA +#define GL_DEPTH24_STENCIL8_EXT 0x88F0 +#define GL_TEXTURE_STENCIL_SIZE_EXT 0x88F1 +#endif /* GL_EXT_packed_depth_stencil */ + +#ifndef GL_EXT_packed_float +#define GL_EXT_packed_float 1 +#define GL_R11F_G11F_B10F_EXT 0x8C3A +#define GL_UNSIGNED_INT_10F_11F_11F_REV_EXT 0x8C3B +#define GL_RGBA_SIGNED_COMPONENTS_EXT 0x8C3C +#endif /* GL_EXT_packed_float */ + +#ifndef GL_EXT_packed_pixels +#define GL_EXT_packed_pixels 1 +#define GL_UNSIGNED_BYTE_3_3_2_EXT 0x8032 +#define GL_UNSIGNED_SHORT_4_4_4_4_EXT 0x8033 +#define GL_UNSIGNED_SHORT_5_5_5_1_EXT 0x8034 +#define GL_UNSIGNED_INT_8_8_8_8_EXT 0x8035 +#define GL_UNSIGNED_INT_10_10_10_2_EXT 0x8036 +#endif /* GL_EXT_packed_pixels */ + +#ifndef GL_EXT_paletted_texture +#define GL_EXT_paletted_texture 1 +#define GL_COLOR_INDEX1_EXT 0x80E2 +#define GL_COLOR_INDEX2_EXT 0x80E3 +#define GL_COLOR_INDEX4_EXT 0x80E4 +#define GL_COLOR_INDEX8_EXT 0x80E5 +#define GL_COLOR_INDEX12_EXT 0x80E6 +#define GL_COLOR_INDEX16_EXT 0x80E7 +#define GL_TEXTURE_INDEX_SIZE_EXT 0x80ED +typedef void (APIENTRYP PFNGLCOLORTABLEEXTPROC) (GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const void *table); +typedef void (APIENTRYP PFNGLGETCOLORTABLEEXTPROC) (GLenum target, GLenum format, GLenum type, void *data); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glColorTableEXT (GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const void *table); +GLAPI void APIENTRY glGetColorTableEXT (GLenum target, GLenum format, GLenum type, void *data); +GLAPI void APIENTRY glGetColorTableParameterivEXT (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetColorTableParameterfvEXT (GLenum target, GLenum pname, GLfloat *params); +#endif +#endif /* GL_EXT_paletted_texture */ + +#ifndef GL_EXT_pixel_buffer_object +#define GL_EXT_pixel_buffer_object 1 +#define GL_PIXEL_PACK_BUFFER_EXT 0x88EB +#define GL_PIXEL_UNPACK_BUFFER_EXT 0x88EC +#define GL_PIXEL_PACK_BUFFER_BINDING_EXT 0x88ED +#define GL_PIXEL_UNPACK_BUFFER_BINDING_EXT 0x88EF +#endif /* GL_EXT_pixel_buffer_object */ + +#ifndef GL_EXT_pixel_transform +#define GL_EXT_pixel_transform 1 +#define GL_PIXEL_TRANSFORM_2D_EXT 0x8330 +#define GL_PIXEL_MAG_FILTER_EXT 0x8331 +#define GL_PIXEL_MIN_FILTER_EXT 0x8332 +#define GL_PIXEL_CUBIC_WEIGHT_EXT 0x8333 +#define GL_CUBIC_EXT 0x8334 +#define GL_AVERAGE_EXT 0x8335 +#define GL_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8336 +#define GL_MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8337 +#define GL_PIXEL_TRANSFORM_2D_MATRIX_EXT 0x8338 +typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERIEXTPROC) (GLenum target, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERFEXTPROC) (GLenum target, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLGETPIXELTRANSFORMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETPIXELTRANSFORMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPixelTransformParameteriEXT (GLenum target, GLenum pname, GLint param); +GLAPI void APIENTRY glPixelTransformParameterfEXT (GLenum target, GLenum pname, GLfloat param); +GLAPI void APIENTRY glPixelTransformParameterivEXT (GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY glPixelTransformParameterfvEXT (GLenum target, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glGetPixelTransformParameterivEXT (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetPixelTransformParameterfvEXT (GLenum target, GLenum pname, GLfloat *params); +#endif +#endif /* GL_EXT_pixel_transform */ + +#ifndef GL_EXT_pixel_transform_color_table +#define GL_EXT_pixel_transform_color_table 1 +#endif /* GL_EXT_pixel_transform_color_table */ + +#ifndef GL_EXT_point_parameters +#define GL_EXT_point_parameters 1 +#define GL_POINT_SIZE_MIN_EXT 0x8126 +#define GL_POINT_SIZE_MAX_EXT 0x8127 +#define GL_POINT_FADE_THRESHOLD_SIZE_EXT 0x8128 +#define GL_DISTANCE_ATTENUATION_EXT 0x8129 +typedef void (APIENTRYP PFNGLPOINTPARAMETERFEXTPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERFVEXTPROC) (GLenum pname, const GLfloat *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPointParameterfEXT (GLenum pname, GLfloat param); +GLAPI void APIENTRY glPointParameterfvEXT (GLenum pname, const GLfloat *params); +#endif +#endif /* GL_EXT_point_parameters */ + +#ifndef GL_EXT_polygon_offset +#define GL_EXT_polygon_offset 1 +#define GL_POLYGON_OFFSET_EXT 0x8037 +#define GL_POLYGON_OFFSET_FACTOR_EXT 0x8038 +#define GL_POLYGON_OFFSET_BIAS_EXT 0x8039 +typedef void (APIENTRYP PFNGLPOLYGONOFFSETEXTPROC) (GLfloat factor, GLfloat bias); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPolygonOffsetEXT (GLfloat factor, GLfloat bias); +#endif +#endif /* GL_EXT_polygon_offset */ + +#ifndef GL_EXT_provoking_vertex +#define GL_EXT_provoking_vertex 1 +#define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT 0x8E4C +#define GL_FIRST_VERTEX_CONVENTION_EXT 0x8E4D +#define GL_LAST_VERTEX_CONVENTION_EXT 0x8E4E +#define GL_PROVOKING_VERTEX_EXT 0x8E4F +typedef void (APIENTRYP PFNGLPROVOKINGVERTEXEXTPROC) (GLenum mode); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glProvokingVertexEXT (GLenum mode); +#endif +#endif /* GL_EXT_provoking_vertex */ + +#ifndef GL_EXT_rescale_normal +#define GL_EXT_rescale_normal 1 +#define GL_RESCALE_NORMAL_EXT 0x803A +#endif /* GL_EXT_rescale_normal */ + +#ifndef GL_EXT_secondary_color +#define GL_EXT_secondary_color 1 +#define GL_COLOR_SUM_EXT 0x8458 +#define GL_CURRENT_SECONDARY_COLOR_EXT 0x8459 +#define GL_SECONDARY_COLOR_ARRAY_SIZE_EXT 0x845A +#define GL_SECONDARY_COLOR_ARRAY_TYPE_EXT 0x845B +#define GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT 0x845C +#define GL_SECONDARY_COLOR_ARRAY_POINTER_EXT 0x845D +#define GL_SECONDARY_COLOR_ARRAY_EXT 0x845E +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BEXTPROC) (GLbyte red, GLbyte green, GLbyte blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BVEXTPROC) (const GLbyte *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DEXTPROC) (GLdouble red, GLdouble green, GLdouble blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DVEXTPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FEXTPROC) (GLfloat red, GLfloat green, GLfloat blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FVEXTPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IEXTPROC) (GLint red, GLint green, GLint blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IVEXTPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SEXTPROC) (GLshort red, GLshort green, GLshort blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SVEXTPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBEXTPROC) (GLubyte red, GLubyte green, GLubyte blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBVEXTPROC) (const GLubyte *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIEXTPROC) (GLuint red, GLuint green, GLuint blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIVEXTPROC) (const GLuint *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USEXTPROC) (GLushort red, GLushort green, GLushort blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USVEXTPROC) (const GLushort *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, const void *pointer); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSecondaryColor3bEXT (GLbyte red, GLbyte green, GLbyte blue); +GLAPI void APIENTRY glSecondaryColor3bvEXT (const GLbyte *v); +GLAPI void APIENTRY glSecondaryColor3dEXT (GLdouble red, GLdouble green, GLdouble blue); +GLAPI void APIENTRY glSecondaryColor3dvEXT (const GLdouble *v); +GLAPI void APIENTRY glSecondaryColor3fEXT (GLfloat red, GLfloat green, GLfloat blue); +GLAPI void APIENTRY glSecondaryColor3fvEXT (const GLfloat *v); +GLAPI void APIENTRY glSecondaryColor3iEXT (GLint red, GLint green, GLint blue); +GLAPI void APIENTRY glSecondaryColor3ivEXT (const GLint *v); +GLAPI void APIENTRY glSecondaryColor3sEXT (GLshort red, GLshort green, GLshort blue); +GLAPI void APIENTRY glSecondaryColor3svEXT (const GLshort *v); +GLAPI void APIENTRY glSecondaryColor3ubEXT (GLubyte red, GLubyte green, GLubyte blue); +GLAPI void APIENTRY glSecondaryColor3ubvEXT (const GLubyte *v); +GLAPI void APIENTRY glSecondaryColor3uiEXT (GLuint red, GLuint green, GLuint blue); +GLAPI void APIENTRY glSecondaryColor3uivEXT (const GLuint *v); +GLAPI void APIENTRY glSecondaryColor3usEXT (GLushort red, GLushort green, GLushort blue); +GLAPI void APIENTRY glSecondaryColor3usvEXT (const GLushort *v); +GLAPI void APIENTRY glSecondaryColorPointerEXT (GLint size, GLenum type, GLsizei stride, const void *pointer); +#endif +#endif /* GL_EXT_secondary_color */ + +#ifndef GL_EXT_separate_shader_objects +#define GL_EXT_separate_shader_objects 1 +#define GL_ACTIVE_PROGRAM_EXT 0x8B8D +typedef void (APIENTRYP PFNGLUSESHADERPROGRAMEXTPROC) (GLenum type, GLuint program); +typedef void (APIENTRYP PFNGLACTIVEPROGRAMEXTPROC) (GLuint program); +typedef GLuint (APIENTRYP PFNGLCREATESHADERPROGRAMEXTPROC) (GLenum type, const GLchar *string); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glUseShaderProgramEXT (GLenum type, GLuint program); +GLAPI void APIENTRY glActiveProgramEXT (GLuint program); +GLAPI GLuint APIENTRY glCreateShaderProgramEXT (GLenum type, const GLchar *string); +#endif +#endif /* GL_EXT_separate_shader_objects */ + +#ifndef GL_EXT_separate_specular_color +#define GL_EXT_separate_specular_color 1 +#define GL_LIGHT_MODEL_COLOR_CONTROL_EXT 0x81F8 +#define GL_SINGLE_COLOR_EXT 0x81F9 +#define GL_SEPARATE_SPECULAR_COLOR_EXT 0x81FA +#endif /* GL_EXT_separate_specular_color */ + +#ifndef GL_EXT_shader_image_load_formatted +#define GL_EXT_shader_image_load_formatted 1 +#endif /* GL_EXT_shader_image_load_formatted */ + +#ifndef GL_EXT_shader_image_load_store +#define GL_EXT_shader_image_load_store 1 +#define GL_MAX_IMAGE_UNITS_EXT 0x8F38 +#define GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS_EXT 0x8F39 +#define GL_IMAGE_BINDING_NAME_EXT 0x8F3A +#define GL_IMAGE_BINDING_LEVEL_EXT 0x8F3B +#define GL_IMAGE_BINDING_LAYERED_EXT 0x8F3C +#define GL_IMAGE_BINDING_LAYER_EXT 0x8F3D +#define GL_IMAGE_BINDING_ACCESS_EXT 0x8F3E +#define GL_IMAGE_1D_EXT 0x904C +#define GL_IMAGE_2D_EXT 0x904D +#define GL_IMAGE_3D_EXT 0x904E +#define GL_IMAGE_2D_RECT_EXT 0x904F +#define GL_IMAGE_CUBE_EXT 0x9050 +#define GL_IMAGE_BUFFER_EXT 0x9051 +#define GL_IMAGE_1D_ARRAY_EXT 0x9052 +#define GL_IMAGE_2D_ARRAY_EXT 0x9053 +#define GL_IMAGE_CUBE_MAP_ARRAY_EXT 0x9054 +#define GL_IMAGE_2D_MULTISAMPLE_EXT 0x9055 +#define GL_IMAGE_2D_MULTISAMPLE_ARRAY_EXT 0x9056 +#define GL_INT_IMAGE_1D_EXT 0x9057 +#define GL_INT_IMAGE_2D_EXT 0x9058 +#define GL_INT_IMAGE_3D_EXT 0x9059 +#define GL_INT_IMAGE_2D_RECT_EXT 0x905A +#define GL_INT_IMAGE_CUBE_EXT 0x905B +#define GL_INT_IMAGE_BUFFER_EXT 0x905C +#define GL_INT_IMAGE_1D_ARRAY_EXT 0x905D +#define GL_INT_IMAGE_2D_ARRAY_EXT 0x905E +#define GL_INT_IMAGE_CUBE_MAP_ARRAY_EXT 0x905F +#define GL_INT_IMAGE_2D_MULTISAMPLE_EXT 0x9060 +#define GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY_EXT 0x9061 +#define GL_UNSIGNED_INT_IMAGE_1D_EXT 0x9062 +#define GL_UNSIGNED_INT_IMAGE_2D_EXT 0x9063 +#define GL_UNSIGNED_INT_IMAGE_3D_EXT 0x9064 +#define GL_UNSIGNED_INT_IMAGE_2D_RECT_EXT 0x9065 +#define GL_UNSIGNED_INT_IMAGE_CUBE_EXT 0x9066 +#define GL_UNSIGNED_INT_IMAGE_BUFFER_EXT 0x9067 +#define GL_UNSIGNED_INT_IMAGE_1D_ARRAY_EXT 0x9068 +#define GL_UNSIGNED_INT_IMAGE_2D_ARRAY_EXT 0x9069 +#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY_EXT 0x906A +#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_EXT 0x906B +#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY_EXT 0x906C +#define GL_MAX_IMAGE_SAMPLES_EXT 0x906D +#define GL_IMAGE_BINDING_FORMAT_EXT 0x906E +#define GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT_EXT 0x00000001 +#define GL_ELEMENT_ARRAY_BARRIER_BIT_EXT 0x00000002 +#define GL_UNIFORM_BARRIER_BIT_EXT 0x00000004 +#define GL_TEXTURE_FETCH_BARRIER_BIT_EXT 0x00000008 +#define GL_SHADER_IMAGE_ACCESS_BARRIER_BIT_EXT 0x00000020 +#define GL_COMMAND_BARRIER_BIT_EXT 0x00000040 +#define GL_PIXEL_BUFFER_BARRIER_BIT_EXT 0x00000080 +#define GL_TEXTURE_UPDATE_BARRIER_BIT_EXT 0x00000100 +#define GL_BUFFER_UPDATE_BARRIER_BIT_EXT 0x00000200 +#define GL_FRAMEBUFFER_BARRIER_BIT_EXT 0x00000400 +#define GL_TRANSFORM_FEEDBACK_BARRIER_BIT_EXT 0x00000800 +#define GL_ATOMIC_COUNTER_BARRIER_BIT_EXT 0x00001000 +#define GL_ALL_BARRIER_BITS_EXT 0xFFFFFFFF +typedef void (APIENTRYP PFNGLBINDIMAGETEXTUREEXTPROC) (GLuint index, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLint format); +typedef void (APIENTRYP PFNGLMEMORYBARRIEREXTPROC) (GLbitfield barriers); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBindImageTextureEXT (GLuint index, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLint format); +GLAPI void APIENTRY glMemoryBarrierEXT (GLbitfield barriers); +#endif +#endif /* GL_EXT_shader_image_load_store */ + +#ifndef GL_EXT_shader_integer_mix +#define GL_EXT_shader_integer_mix 1 +#endif /* GL_EXT_shader_integer_mix */ + +#ifndef GL_EXT_shadow_funcs +#define GL_EXT_shadow_funcs 1 +#endif /* GL_EXT_shadow_funcs */ + +#ifndef GL_EXT_shared_texture_palette +#define GL_EXT_shared_texture_palette 1 +#define GL_SHARED_TEXTURE_PALETTE_EXT 0x81FB +#endif /* GL_EXT_shared_texture_palette */ + +#ifndef GL_EXT_stencil_clear_tag +#define GL_EXT_stencil_clear_tag 1 +#define GL_STENCIL_TAG_BITS_EXT 0x88F2 +#define GL_STENCIL_CLEAR_TAG_VALUE_EXT 0x88F3 +typedef void (APIENTRYP PFNGLSTENCILCLEARTAGEXTPROC) (GLsizei stencilTagBits, GLuint stencilClearTag); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glStencilClearTagEXT (GLsizei stencilTagBits, GLuint stencilClearTag); +#endif +#endif /* GL_EXT_stencil_clear_tag */ + +#ifndef GL_EXT_stencil_two_side +#define GL_EXT_stencil_two_side 1 +#define GL_STENCIL_TEST_TWO_SIDE_EXT 0x8910 +#define GL_ACTIVE_STENCIL_FACE_EXT 0x8911 +typedef void (APIENTRYP PFNGLACTIVESTENCILFACEEXTPROC) (GLenum face); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glActiveStencilFaceEXT (GLenum face); +#endif +#endif /* GL_EXT_stencil_two_side */ + +#ifndef GL_EXT_stencil_wrap +#define GL_EXT_stencil_wrap 1 +#define GL_INCR_WRAP_EXT 0x8507 +#define GL_DECR_WRAP_EXT 0x8508 +#endif /* GL_EXT_stencil_wrap */ + +#ifndef GL_EXT_subtexture +#define GL_EXT_subtexture 1 +typedef void (APIENTRYP PFNGLTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels); +typedef void (APIENTRYP PFNGLTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexSubImage1DEXT (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels); +GLAPI void APIENTRY glTexSubImage2DEXT (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); +#endif +#endif /* GL_EXT_subtexture */ + +#ifndef GL_EXT_texture +#define GL_EXT_texture 1 +#define GL_ALPHA4_EXT 0x803B +#define GL_ALPHA8_EXT 0x803C +#define GL_ALPHA12_EXT 0x803D +#define GL_ALPHA16_EXT 0x803E +#define GL_LUMINANCE4_EXT 0x803F +#define GL_LUMINANCE8_EXT 0x8040 +#define GL_LUMINANCE12_EXT 0x8041 +#define GL_LUMINANCE16_EXT 0x8042 +#define GL_LUMINANCE4_ALPHA4_EXT 0x8043 +#define GL_LUMINANCE6_ALPHA2_EXT 0x8044 +#define GL_LUMINANCE8_ALPHA8_EXT 0x8045 +#define GL_LUMINANCE12_ALPHA4_EXT 0x8046 +#define GL_LUMINANCE12_ALPHA12_EXT 0x8047 +#define GL_LUMINANCE16_ALPHA16_EXT 0x8048 +#define GL_INTENSITY_EXT 0x8049 +#define GL_INTENSITY4_EXT 0x804A +#define GL_INTENSITY8_EXT 0x804B +#define GL_INTENSITY12_EXT 0x804C +#define GL_INTENSITY16_EXT 0x804D +#define GL_RGB2_EXT 0x804E +#define GL_RGB4_EXT 0x804F +#define GL_RGB5_EXT 0x8050 +#define GL_RGB8_EXT 0x8051 +#define GL_RGB10_EXT 0x8052 +#define GL_RGB12_EXT 0x8053 +#define GL_RGB16_EXT 0x8054 +#define GL_RGBA2_EXT 0x8055 +#define GL_RGBA4_EXT 0x8056 +#define GL_RGB5_A1_EXT 0x8057 +#define GL_RGBA8_EXT 0x8058 +#define GL_RGB10_A2_EXT 0x8059 +#define GL_RGBA12_EXT 0x805A +#define GL_RGBA16_EXT 0x805B +#define GL_TEXTURE_RED_SIZE_EXT 0x805C +#define GL_TEXTURE_GREEN_SIZE_EXT 0x805D +#define GL_TEXTURE_BLUE_SIZE_EXT 0x805E +#define GL_TEXTURE_ALPHA_SIZE_EXT 0x805F +#define GL_TEXTURE_LUMINANCE_SIZE_EXT 0x8060 +#define GL_TEXTURE_INTENSITY_SIZE_EXT 0x8061 +#define GL_REPLACE_EXT 0x8062 +#define GL_PROXY_TEXTURE_1D_EXT 0x8063 +#define GL_PROXY_TEXTURE_2D_EXT 0x8064 +#define GL_TEXTURE_TOO_LARGE_EXT 0x8065 +#endif /* GL_EXT_texture */ + +#ifndef GL_EXT_texture3D +#define GL_EXT_texture3D 1 +#define GL_PACK_SKIP_IMAGES_EXT 0x806B +#define GL_PACK_IMAGE_HEIGHT_EXT 0x806C +#define GL_UNPACK_SKIP_IMAGES_EXT 0x806D +#define GL_UNPACK_IMAGE_HEIGHT_EXT 0x806E +#define GL_TEXTURE_3D_EXT 0x806F +#define GL_PROXY_TEXTURE_3D_EXT 0x8070 +#define GL_TEXTURE_DEPTH_EXT 0x8071 +#define GL_TEXTURE_WRAP_R_EXT 0x8072 +#define GL_MAX_3D_TEXTURE_SIZE_EXT 0x8073 +typedef void (APIENTRYP PFNGLTEXIMAGE3DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels); +typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexImage3DEXT (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels); +GLAPI void APIENTRY glTexSubImage3DEXT (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); +#endif +#endif /* GL_EXT_texture3D */ + +#ifndef GL_EXT_texture_array +#define GL_EXT_texture_array 1 +#define GL_TEXTURE_1D_ARRAY_EXT 0x8C18 +#define GL_PROXY_TEXTURE_1D_ARRAY_EXT 0x8C19 +#define GL_TEXTURE_2D_ARRAY_EXT 0x8C1A +#define GL_PROXY_TEXTURE_2D_ARRAY_EXT 0x8C1B +#define GL_TEXTURE_BINDING_1D_ARRAY_EXT 0x8C1C +#define GL_TEXTURE_BINDING_2D_ARRAY_EXT 0x8C1D +#define GL_MAX_ARRAY_TEXTURE_LAYERS_EXT 0x88FF +#define GL_COMPARE_REF_DEPTH_TO_TEXTURE_EXT 0x884E +#endif /* GL_EXT_texture_array */ + +#ifndef GL_EXT_texture_buffer_object +#define GL_EXT_texture_buffer_object 1 +#define GL_TEXTURE_BUFFER_EXT 0x8C2A +#define GL_MAX_TEXTURE_BUFFER_SIZE_EXT 0x8C2B +#define GL_TEXTURE_BINDING_BUFFER_EXT 0x8C2C +#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_EXT 0x8C2D +#define GL_TEXTURE_BUFFER_FORMAT_EXT 0x8C2E +typedef void (APIENTRYP PFNGLTEXBUFFEREXTPROC) (GLenum target, GLenum internalformat, GLuint buffer); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexBufferEXT (GLenum target, GLenum internalformat, GLuint buffer); +#endif +#endif /* GL_EXT_texture_buffer_object */ + +#ifndef GL_EXT_texture_compression_latc +#define GL_EXT_texture_compression_latc 1 +#define GL_COMPRESSED_LUMINANCE_LATC1_EXT 0x8C70 +#define GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT 0x8C71 +#define GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT 0x8C72 +#define GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT 0x8C73 +#endif /* GL_EXT_texture_compression_latc */ + +#ifndef GL_EXT_texture_compression_rgtc +#define GL_EXT_texture_compression_rgtc 1 +#define GL_COMPRESSED_RED_RGTC1_EXT 0x8DBB +#define GL_COMPRESSED_SIGNED_RED_RGTC1_EXT 0x8DBC +#define GL_COMPRESSED_RED_GREEN_RGTC2_EXT 0x8DBD +#define GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT 0x8DBE +#endif /* GL_EXT_texture_compression_rgtc */ + +#ifndef GL_EXT_texture_compression_s3tc +#define GL_EXT_texture_compression_s3tc 1 +#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 +#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 +#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2 +#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3 +#endif /* GL_EXT_texture_compression_s3tc */ + +#ifndef GL_EXT_texture_cube_map +#define GL_EXT_texture_cube_map 1 +#define GL_NORMAL_MAP_EXT 0x8511 +#define GL_REFLECTION_MAP_EXT 0x8512 +#define GL_TEXTURE_CUBE_MAP_EXT 0x8513 +#define GL_TEXTURE_BINDING_CUBE_MAP_EXT 0x8514 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT 0x8515 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT 0x8516 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT 0x8517 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT 0x8518 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT 0x8519 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT 0x851A +#define GL_PROXY_TEXTURE_CUBE_MAP_EXT 0x851B +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_EXT 0x851C +#endif /* GL_EXT_texture_cube_map */ + +#ifndef GL_EXT_texture_env_add +#define GL_EXT_texture_env_add 1 +#endif /* GL_EXT_texture_env_add */ + +#ifndef GL_EXT_texture_env_combine +#define GL_EXT_texture_env_combine 1 +#define GL_COMBINE_EXT 0x8570 +#define GL_COMBINE_RGB_EXT 0x8571 +#define GL_COMBINE_ALPHA_EXT 0x8572 +#define GL_RGB_SCALE_EXT 0x8573 +#define GL_ADD_SIGNED_EXT 0x8574 +#define GL_INTERPOLATE_EXT 0x8575 +#define GL_CONSTANT_EXT 0x8576 +#define GL_PRIMARY_COLOR_EXT 0x8577 +#define GL_PREVIOUS_EXT 0x8578 +#define GL_SOURCE0_RGB_EXT 0x8580 +#define GL_SOURCE1_RGB_EXT 0x8581 +#define GL_SOURCE2_RGB_EXT 0x8582 +#define GL_SOURCE0_ALPHA_EXT 0x8588 +#define GL_SOURCE1_ALPHA_EXT 0x8589 +#define GL_SOURCE2_ALPHA_EXT 0x858A +#define GL_OPERAND0_RGB_EXT 0x8590 +#define GL_OPERAND1_RGB_EXT 0x8591 +#define GL_OPERAND2_RGB_EXT 0x8592 +#define GL_OPERAND0_ALPHA_EXT 0x8598 +#define GL_OPERAND1_ALPHA_EXT 0x8599 +#define GL_OPERAND2_ALPHA_EXT 0x859A +#endif /* GL_EXT_texture_env_combine */ + +#ifndef GL_EXT_texture_env_dot3 +#define GL_EXT_texture_env_dot3 1 +#define GL_DOT3_RGB_EXT 0x8740 +#define GL_DOT3_RGBA_EXT 0x8741 +#endif /* GL_EXT_texture_env_dot3 */ + +#ifndef GL_EXT_texture_filter_anisotropic +#define GL_EXT_texture_filter_anisotropic 1 +#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE +#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF +#endif /* GL_EXT_texture_filter_anisotropic */ + +#ifndef GL_EXT_texture_integer +#define GL_EXT_texture_integer 1 +#define GL_RGBA32UI_EXT 0x8D70 +#define GL_RGB32UI_EXT 0x8D71 +#define GL_ALPHA32UI_EXT 0x8D72 +#define GL_INTENSITY32UI_EXT 0x8D73 +#define GL_LUMINANCE32UI_EXT 0x8D74 +#define GL_LUMINANCE_ALPHA32UI_EXT 0x8D75 +#define GL_RGBA16UI_EXT 0x8D76 +#define GL_RGB16UI_EXT 0x8D77 +#define GL_ALPHA16UI_EXT 0x8D78 +#define GL_INTENSITY16UI_EXT 0x8D79 +#define GL_LUMINANCE16UI_EXT 0x8D7A +#define GL_LUMINANCE_ALPHA16UI_EXT 0x8D7B +#define GL_RGBA8UI_EXT 0x8D7C +#define GL_RGB8UI_EXT 0x8D7D +#define GL_ALPHA8UI_EXT 0x8D7E +#define GL_INTENSITY8UI_EXT 0x8D7F +#define GL_LUMINANCE8UI_EXT 0x8D80 +#define GL_LUMINANCE_ALPHA8UI_EXT 0x8D81 +#define GL_RGBA32I_EXT 0x8D82 +#define GL_RGB32I_EXT 0x8D83 +#define GL_ALPHA32I_EXT 0x8D84 +#define GL_INTENSITY32I_EXT 0x8D85 +#define GL_LUMINANCE32I_EXT 0x8D86 +#define GL_LUMINANCE_ALPHA32I_EXT 0x8D87 +#define GL_RGBA16I_EXT 0x8D88 +#define GL_RGB16I_EXT 0x8D89 +#define GL_ALPHA16I_EXT 0x8D8A +#define GL_INTENSITY16I_EXT 0x8D8B +#define GL_LUMINANCE16I_EXT 0x8D8C +#define GL_LUMINANCE_ALPHA16I_EXT 0x8D8D +#define GL_RGBA8I_EXT 0x8D8E +#define GL_RGB8I_EXT 0x8D8F +#define GL_ALPHA8I_EXT 0x8D90 +#define GL_INTENSITY8I_EXT 0x8D91 +#define GL_LUMINANCE8I_EXT 0x8D92 +#define GL_LUMINANCE_ALPHA8I_EXT 0x8D93 +#define GL_RED_INTEGER_EXT 0x8D94 +#define GL_GREEN_INTEGER_EXT 0x8D95 +#define GL_BLUE_INTEGER_EXT 0x8D96 +#define GL_ALPHA_INTEGER_EXT 0x8D97 +#define GL_RGB_INTEGER_EXT 0x8D98 +#define GL_RGBA_INTEGER_EXT 0x8D99 +#define GL_BGR_INTEGER_EXT 0x8D9A +#define GL_BGRA_INTEGER_EXT 0x8D9B +#define GL_LUMINANCE_INTEGER_EXT 0x8D9C +#define GL_LUMINANCE_ALPHA_INTEGER_EXT 0x8D9D +#define GL_RGBA_INTEGER_MODE_EXT 0x8D9E +typedef void (APIENTRYP PFNGLTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, const GLuint *params); +typedef void (APIENTRYP PFNGLGETTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, GLuint *params); +typedef void (APIENTRYP PFNGLCLEARCOLORIIEXTPROC) (GLint red, GLint green, GLint blue, GLint alpha); +typedef void (APIENTRYP PFNGLCLEARCOLORIUIEXTPROC) (GLuint red, GLuint green, GLuint blue, GLuint alpha); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexParameterIivEXT (GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY glTexParameterIuivEXT (GLenum target, GLenum pname, const GLuint *params); +GLAPI void APIENTRY glGetTexParameterIivEXT (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetTexParameterIuivEXT (GLenum target, GLenum pname, GLuint *params); +GLAPI void APIENTRY glClearColorIiEXT (GLint red, GLint green, GLint blue, GLint alpha); +GLAPI void APIENTRY glClearColorIuiEXT (GLuint red, GLuint green, GLuint blue, GLuint alpha); +#endif +#endif /* GL_EXT_texture_integer */ + +#ifndef GL_EXT_texture_lod_bias +#define GL_EXT_texture_lod_bias 1 +#define GL_MAX_TEXTURE_LOD_BIAS_EXT 0x84FD +#define GL_TEXTURE_FILTER_CONTROL_EXT 0x8500 +#define GL_TEXTURE_LOD_BIAS_EXT 0x8501 +#endif /* GL_EXT_texture_lod_bias */ + +#ifndef GL_EXT_texture_mirror_clamp +#define GL_EXT_texture_mirror_clamp 1 +#define GL_MIRROR_CLAMP_EXT 0x8742 +#define GL_MIRROR_CLAMP_TO_EDGE_EXT 0x8743 +#define GL_MIRROR_CLAMP_TO_BORDER_EXT 0x8912 +#endif /* GL_EXT_texture_mirror_clamp */ + +#ifndef GL_EXT_texture_object +#define GL_EXT_texture_object 1 +#define GL_TEXTURE_PRIORITY_EXT 0x8066 +#define GL_TEXTURE_RESIDENT_EXT 0x8067 +#define GL_TEXTURE_1D_BINDING_EXT 0x8068 +#define GL_TEXTURE_2D_BINDING_EXT 0x8069 +#define GL_TEXTURE_3D_BINDING_EXT 0x806A +typedef GLboolean (APIENTRYP PFNGLARETEXTURESRESIDENTEXTPROC) (GLsizei n, const GLuint *textures, GLboolean *residences); +typedef void (APIENTRYP PFNGLBINDTEXTUREEXTPROC) (GLenum target, GLuint texture); +typedef void (APIENTRYP PFNGLDELETETEXTURESEXTPROC) (GLsizei n, const GLuint *textures); +typedef void (APIENTRYP PFNGLGENTEXTURESEXTPROC) (GLsizei n, GLuint *textures); +typedef GLboolean (APIENTRYP PFNGLISTEXTUREEXTPROC) (GLuint texture); +typedef void (APIENTRYP PFNGLPRIORITIZETEXTURESEXTPROC) (GLsizei n, const GLuint *textures, const GLclampf *priorities); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLboolean APIENTRY glAreTexturesResidentEXT (GLsizei n, const GLuint *textures, GLboolean *residences); +GLAPI void APIENTRY glBindTextureEXT (GLenum target, GLuint texture); +GLAPI void APIENTRY glDeleteTexturesEXT (GLsizei n, const GLuint *textures); +GLAPI void APIENTRY glGenTexturesEXT (GLsizei n, GLuint *textures); +GLAPI GLboolean APIENTRY glIsTextureEXT (GLuint texture); +GLAPI void APIENTRY glPrioritizeTexturesEXT (GLsizei n, const GLuint *textures, const GLclampf *priorities); +#endif +#endif /* GL_EXT_texture_object */ + +#ifndef GL_EXT_texture_perturb_normal +#define GL_EXT_texture_perturb_normal 1 +#define GL_PERTURB_EXT 0x85AE +#define GL_TEXTURE_NORMAL_EXT 0x85AF +typedef void (APIENTRYP PFNGLTEXTURENORMALEXTPROC) (GLenum mode); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTextureNormalEXT (GLenum mode); +#endif +#endif /* GL_EXT_texture_perturb_normal */ + +#ifndef GL_EXT_texture_sRGB +#define GL_EXT_texture_sRGB 1 +#define GL_SRGB_EXT 0x8C40 +#define GL_SRGB8_EXT 0x8C41 +#define GL_SRGB_ALPHA_EXT 0x8C42 +#define GL_SRGB8_ALPHA8_EXT 0x8C43 +#define GL_SLUMINANCE_ALPHA_EXT 0x8C44 +#define GL_SLUMINANCE8_ALPHA8_EXT 0x8C45 +#define GL_SLUMINANCE_EXT 0x8C46 +#define GL_SLUMINANCE8_EXT 0x8C47 +#define GL_COMPRESSED_SRGB_EXT 0x8C48 +#define GL_COMPRESSED_SRGB_ALPHA_EXT 0x8C49 +#define GL_COMPRESSED_SLUMINANCE_EXT 0x8C4A +#define GL_COMPRESSED_SLUMINANCE_ALPHA_EXT 0x8C4B +#define GL_COMPRESSED_SRGB_S3TC_DXT1_EXT 0x8C4C +#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT 0x8C4D +#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E +#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F +#endif /* GL_EXT_texture_sRGB */ + +#ifndef GL_EXT_texture_sRGB_decode +#define GL_EXT_texture_sRGB_decode 1 +#define GL_TEXTURE_SRGB_DECODE_EXT 0x8A48 +#define GL_DECODE_EXT 0x8A49 +#define GL_SKIP_DECODE_EXT 0x8A4A +#endif /* GL_EXT_texture_sRGB_decode */ + +#ifndef GL_EXT_texture_shared_exponent +#define GL_EXT_texture_shared_exponent 1 +#define GL_RGB9_E5_EXT 0x8C3D +#define GL_UNSIGNED_INT_5_9_9_9_REV_EXT 0x8C3E +#define GL_TEXTURE_SHARED_SIZE_EXT 0x8C3F +#endif /* GL_EXT_texture_shared_exponent */ + +#ifndef GL_EXT_texture_snorm +#define GL_EXT_texture_snorm 1 +#define GL_ALPHA_SNORM 0x9010 +#define GL_LUMINANCE_SNORM 0x9011 +#define GL_LUMINANCE_ALPHA_SNORM 0x9012 +#define GL_INTENSITY_SNORM 0x9013 +#define GL_ALPHA8_SNORM 0x9014 +#define GL_LUMINANCE8_SNORM 0x9015 +#define GL_LUMINANCE8_ALPHA8_SNORM 0x9016 +#define GL_INTENSITY8_SNORM 0x9017 +#define GL_ALPHA16_SNORM 0x9018 +#define GL_LUMINANCE16_SNORM 0x9019 +#define GL_LUMINANCE16_ALPHA16_SNORM 0x901A +#define GL_INTENSITY16_SNORM 0x901B +#define GL_RED_SNORM 0x8F90 +#define GL_RG_SNORM 0x8F91 +#define GL_RGB_SNORM 0x8F92 +#define GL_RGBA_SNORM 0x8F93 +#endif /* GL_EXT_texture_snorm */ + +#ifndef GL_EXT_texture_swizzle +#define GL_EXT_texture_swizzle 1 +#define GL_TEXTURE_SWIZZLE_R_EXT 0x8E42 +#define GL_TEXTURE_SWIZZLE_G_EXT 0x8E43 +#define GL_TEXTURE_SWIZZLE_B_EXT 0x8E44 +#define GL_TEXTURE_SWIZZLE_A_EXT 0x8E45 +#define GL_TEXTURE_SWIZZLE_RGBA_EXT 0x8E46 +#endif /* GL_EXT_texture_swizzle */ + +#ifndef GL_EXT_timer_query +#define GL_EXT_timer_query 1 +#define GL_TIME_ELAPSED_EXT 0x88BF +typedef void (APIENTRYP PFNGLGETQUERYOBJECTI64VEXTPROC) (GLuint id, GLenum pname, GLint64 *params); +typedef void (APIENTRYP PFNGLGETQUERYOBJECTUI64VEXTPROC) (GLuint id, GLenum pname, GLuint64 *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetQueryObjecti64vEXT (GLuint id, GLenum pname, GLint64 *params); +GLAPI void APIENTRY glGetQueryObjectui64vEXT (GLuint id, GLenum pname, GLuint64 *params); +#endif +#endif /* GL_EXT_timer_query */ + +#ifndef GL_EXT_transform_feedback +#define GL_EXT_transform_feedback 1 +#define GL_TRANSFORM_FEEDBACK_BUFFER_EXT 0x8C8E +#define GL_TRANSFORM_FEEDBACK_BUFFER_START_EXT 0x8C84 +#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_EXT 0x8C85 +#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_EXT 0x8C8F +#define GL_INTERLEAVED_ATTRIBS_EXT 0x8C8C +#define GL_SEPARATE_ATTRIBS_EXT 0x8C8D +#define GL_PRIMITIVES_GENERATED_EXT 0x8C87 +#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_EXT 0x8C88 +#define GL_RASTERIZER_DISCARD_EXT 0x8C89 +#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT 0x8C8A +#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_EXT 0x8C8B +#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_EXT 0x8C80 +#define GL_TRANSFORM_FEEDBACK_VARYINGS_EXT 0x8C83 +#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE_EXT 0x8C7F +#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH_EXT 0x8C76 +typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKEXTPROC) (GLenum primitiveMode); +typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKEXTPROC) (void); +typedef void (APIENTRYP PFNGLBINDBUFFERRANGEEXTPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); +typedef void (APIENTRYP PFNGLBINDBUFFEROFFSETEXTPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset); +typedef void (APIENTRYP PFNGLBINDBUFFERBASEEXTPROC) (GLenum target, GLuint index, GLuint buffer); +typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSEXTPROC) (GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode); +typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGEXTPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBeginTransformFeedbackEXT (GLenum primitiveMode); +GLAPI void APIENTRY glEndTransformFeedbackEXT (void); +GLAPI void APIENTRY glBindBufferRangeEXT (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); +GLAPI void APIENTRY glBindBufferOffsetEXT (GLenum target, GLuint index, GLuint buffer, GLintptr offset); +GLAPI void APIENTRY glBindBufferBaseEXT (GLenum target, GLuint index, GLuint buffer); +GLAPI void APIENTRY glTransformFeedbackVaryingsEXT (GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode); +GLAPI void APIENTRY glGetTransformFeedbackVaryingEXT (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); +#endif +#endif /* GL_EXT_transform_feedback */ + +#ifndef GL_EXT_vertex_array +#define GL_EXT_vertex_array 1 +#define GL_VERTEX_ARRAY_EXT 0x8074 +#define GL_NORMAL_ARRAY_EXT 0x8075 +#define GL_COLOR_ARRAY_EXT 0x8076 +#define GL_INDEX_ARRAY_EXT 0x8077 +#define GL_TEXTURE_COORD_ARRAY_EXT 0x8078 +#define GL_EDGE_FLAG_ARRAY_EXT 0x8079 +#define GL_VERTEX_ARRAY_SIZE_EXT 0x807A +#define GL_VERTEX_ARRAY_TYPE_EXT 0x807B +#define GL_VERTEX_ARRAY_STRIDE_EXT 0x807C +#define GL_VERTEX_ARRAY_COUNT_EXT 0x807D +#define GL_NORMAL_ARRAY_TYPE_EXT 0x807E +#define GL_NORMAL_ARRAY_STRIDE_EXT 0x807F +#define GL_NORMAL_ARRAY_COUNT_EXT 0x8080 +#define GL_COLOR_ARRAY_SIZE_EXT 0x8081 +#define GL_COLOR_ARRAY_TYPE_EXT 0x8082 +#define GL_COLOR_ARRAY_STRIDE_EXT 0x8083 +#define GL_COLOR_ARRAY_COUNT_EXT 0x8084 +#define GL_INDEX_ARRAY_TYPE_EXT 0x8085 +#define GL_INDEX_ARRAY_STRIDE_EXT 0x8086 +#define GL_INDEX_ARRAY_COUNT_EXT 0x8087 +#define GL_TEXTURE_COORD_ARRAY_SIZE_EXT 0x8088 +#define GL_TEXTURE_COORD_ARRAY_TYPE_EXT 0x8089 +#define GL_TEXTURE_COORD_ARRAY_STRIDE_EXT 0x808A +#define GL_TEXTURE_COORD_ARRAY_COUNT_EXT 0x808B +#define GL_EDGE_FLAG_ARRAY_STRIDE_EXT 0x808C +#define GL_EDGE_FLAG_ARRAY_COUNT_EXT 0x808D +#define GL_VERTEX_ARRAY_POINTER_EXT 0x808E +#define GL_NORMAL_ARRAY_POINTER_EXT 0x808F +#define GL_COLOR_ARRAY_POINTER_EXT 0x8090 +#define GL_INDEX_ARRAY_POINTER_EXT 0x8091 +#define GL_TEXTURE_COORD_ARRAY_POINTER_EXT 0x8092 +#define GL_EDGE_FLAG_ARRAY_POINTER_EXT 0x8093 +typedef void (APIENTRYP PFNGLARRAYELEMENTEXTPROC) (GLint i); +typedef void (APIENTRYP PFNGLCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const void *pointer); +typedef void (APIENTRYP PFNGLDRAWARRAYSEXTPROC) (GLenum mode, GLint first, GLsizei count); +typedef void (APIENTRYP PFNGLEDGEFLAGPOINTEREXTPROC) (GLsizei stride, GLsizei count, const GLboolean *pointer); +typedef void (APIENTRYP PFNGLGETPOINTERVEXTPROC) (GLenum pname, void **params); +typedef void (APIENTRYP PFNGLINDEXPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const void *pointer); +typedef void (APIENTRYP PFNGLNORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const void *pointer); +typedef void (APIENTRYP PFNGLTEXCOORDPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const void *pointer); +typedef void (APIENTRYP PFNGLVERTEXPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const void *pointer); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glArrayElementEXT (GLint i); +GLAPI void APIENTRY glColorPointerEXT (GLint size, GLenum type, GLsizei stride, GLsizei count, const void *pointer); +GLAPI void APIENTRY glDrawArraysEXT (GLenum mode, GLint first, GLsizei count); +GLAPI void APIENTRY glEdgeFlagPointerEXT (GLsizei stride, GLsizei count, const GLboolean *pointer); +GLAPI void APIENTRY glGetPointervEXT (GLenum pname, void **params); +GLAPI void APIENTRY glIndexPointerEXT (GLenum type, GLsizei stride, GLsizei count, const void *pointer); +GLAPI void APIENTRY glNormalPointerEXT (GLenum type, GLsizei stride, GLsizei count, const void *pointer); +GLAPI void APIENTRY glTexCoordPointerEXT (GLint size, GLenum type, GLsizei stride, GLsizei count, const void *pointer); +GLAPI void APIENTRY glVertexPointerEXT (GLint size, GLenum type, GLsizei stride, GLsizei count, const void *pointer); +#endif +#endif /* GL_EXT_vertex_array */ + +#ifndef GL_EXT_vertex_array_bgra +#define GL_EXT_vertex_array_bgra 1 +#endif /* GL_EXT_vertex_array_bgra */ + +#ifndef GL_EXT_vertex_attrib_64bit +#define GL_EXT_vertex_attrib_64bit 1 +#define GL_DOUBLE_VEC2_EXT 0x8FFC +#define GL_DOUBLE_VEC3_EXT 0x8FFD +#define GL_DOUBLE_VEC4_EXT 0x8FFE +#define GL_DOUBLE_MAT2_EXT 0x8F46 +#define GL_DOUBLE_MAT3_EXT 0x8F47 +#define GL_DOUBLE_MAT4_EXT 0x8F48 +#define GL_DOUBLE_MAT2x3_EXT 0x8F49 +#define GL_DOUBLE_MAT2x4_EXT 0x8F4A +#define GL_DOUBLE_MAT3x2_EXT 0x8F4B +#define GL_DOUBLE_MAT3x4_EXT 0x8F4C +#define GL_DOUBLE_MAT4x2_EXT 0x8F4D +#define GL_DOUBLE_MAT4x3_EXT 0x8F4E +typedef void (APIENTRYP PFNGLVERTEXATTRIBL1DEXTPROC) (GLuint index, GLdouble x); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL2DEXTPROC) (GLuint index, GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL3DEXTPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL4DEXTPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL1DVEXTPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL2DVEXTPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL3DVEXTPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL4DVEXTPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBLPOINTEREXTPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLDVEXTPROC) (GLuint index, GLenum pname, GLdouble *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexAttribL1dEXT (GLuint index, GLdouble x); +GLAPI void APIENTRY glVertexAttribL2dEXT (GLuint index, GLdouble x, GLdouble y); +GLAPI void APIENTRY glVertexAttribL3dEXT (GLuint index, GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY glVertexAttribL4dEXT (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY glVertexAttribL1dvEXT (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttribL2dvEXT (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttribL3dvEXT (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttribL4dvEXT (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttribLPointerEXT (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer); +GLAPI void APIENTRY glGetVertexAttribLdvEXT (GLuint index, GLenum pname, GLdouble *params); +#endif +#endif /* GL_EXT_vertex_attrib_64bit */ + +#ifndef GL_EXT_vertex_shader +#define GL_EXT_vertex_shader 1 +#define GL_VERTEX_SHADER_EXT 0x8780 +#define GL_VERTEX_SHADER_BINDING_EXT 0x8781 +#define GL_OP_INDEX_EXT 0x8782 +#define GL_OP_NEGATE_EXT 0x8783 +#define GL_OP_DOT3_EXT 0x8784 +#define GL_OP_DOT4_EXT 0x8785 +#define GL_OP_MUL_EXT 0x8786 +#define GL_OP_ADD_EXT 0x8787 +#define GL_OP_MADD_EXT 0x8788 +#define GL_OP_FRAC_EXT 0x8789 +#define GL_OP_MAX_EXT 0x878A +#define GL_OP_MIN_EXT 0x878B +#define GL_OP_SET_GE_EXT 0x878C +#define GL_OP_SET_LT_EXT 0x878D +#define GL_OP_CLAMP_EXT 0x878E +#define GL_OP_FLOOR_EXT 0x878F +#define GL_OP_ROUND_EXT 0x8790 +#define GL_OP_EXP_BASE_2_EXT 0x8791 +#define GL_OP_LOG_BASE_2_EXT 0x8792 +#define GL_OP_POWER_EXT 0x8793 +#define GL_OP_RECIP_EXT 0x8794 +#define GL_OP_RECIP_SQRT_EXT 0x8795 +#define GL_OP_SUB_EXT 0x8796 +#define GL_OP_CROSS_PRODUCT_EXT 0x8797 +#define GL_OP_MULTIPLY_MATRIX_EXT 0x8798 +#define GL_OP_MOV_EXT 0x8799 +#define GL_OUTPUT_VERTEX_EXT 0x879A +#define GL_OUTPUT_COLOR0_EXT 0x879B +#define GL_OUTPUT_COLOR1_EXT 0x879C +#define GL_OUTPUT_TEXTURE_COORD0_EXT 0x879D +#define GL_OUTPUT_TEXTURE_COORD1_EXT 0x879E +#define GL_OUTPUT_TEXTURE_COORD2_EXT 0x879F +#define GL_OUTPUT_TEXTURE_COORD3_EXT 0x87A0 +#define GL_OUTPUT_TEXTURE_COORD4_EXT 0x87A1 +#define GL_OUTPUT_TEXTURE_COORD5_EXT 0x87A2 +#define GL_OUTPUT_TEXTURE_COORD6_EXT 0x87A3 +#define GL_OUTPUT_TEXTURE_COORD7_EXT 0x87A4 +#define GL_OUTPUT_TEXTURE_COORD8_EXT 0x87A5 +#define GL_OUTPUT_TEXTURE_COORD9_EXT 0x87A6 +#define GL_OUTPUT_TEXTURE_COORD10_EXT 0x87A7 +#define GL_OUTPUT_TEXTURE_COORD11_EXT 0x87A8 +#define GL_OUTPUT_TEXTURE_COORD12_EXT 0x87A9 +#define GL_OUTPUT_TEXTURE_COORD13_EXT 0x87AA +#define GL_OUTPUT_TEXTURE_COORD14_EXT 0x87AB +#define GL_OUTPUT_TEXTURE_COORD15_EXT 0x87AC +#define GL_OUTPUT_TEXTURE_COORD16_EXT 0x87AD +#define GL_OUTPUT_TEXTURE_COORD17_EXT 0x87AE +#define GL_OUTPUT_TEXTURE_COORD18_EXT 0x87AF +#define GL_OUTPUT_TEXTURE_COORD19_EXT 0x87B0 +#define GL_OUTPUT_TEXTURE_COORD20_EXT 0x87B1 +#define GL_OUTPUT_TEXTURE_COORD21_EXT 0x87B2 +#define GL_OUTPUT_TEXTURE_COORD22_EXT 0x87B3 +#define GL_OUTPUT_TEXTURE_COORD23_EXT 0x87B4 +#define GL_OUTPUT_TEXTURE_COORD24_EXT 0x87B5 +#define GL_OUTPUT_TEXTURE_COORD25_EXT 0x87B6 +#define GL_OUTPUT_TEXTURE_COORD26_EXT 0x87B7 +#define GL_OUTPUT_TEXTURE_COORD27_EXT 0x87B8 +#define GL_OUTPUT_TEXTURE_COORD28_EXT 0x87B9 +#define GL_OUTPUT_TEXTURE_COORD29_EXT 0x87BA +#define GL_OUTPUT_TEXTURE_COORD30_EXT 0x87BB +#define GL_OUTPUT_TEXTURE_COORD31_EXT 0x87BC +#define GL_OUTPUT_FOG_EXT 0x87BD +#define GL_SCALAR_EXT 0x87BE +#define GL_VECTOR_EXT 0x87BF +#define GL_MATRIX_EXT 0x87C0 +#define GL_VARIANT_EXT 0x87C1 +#define GL_INVARIANT_EXT 0x87C2 +#define GL_LOCAL_CONSTANT_EXT 0x87C3 +#define GL_LOCAL_EXT 0x87C4 +#define GL_MAX_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87C5 +#define GL_MAX_VERTEX_SHADER_VARIANTS_EXT 0x87C6 +#define GL_MAX_VERTEX_SHADER_INVARIANTS_EXT 0x87C7 +#define GL_MAX_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87C8 +#define GL_MAX_VERTEX_SHADER_LOCALS_EXT 0x87C9 +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CA +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_VARIANTS_EXT 0x87CB +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87CC +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_INVARIANTS_EXT 0x87CD +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCALS_EXT 0x87CE +#define GL_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CF +#define GL_VERTEX_SHADER_VARIANTS_EXT 0x87D0 +#define GL_VERTEX_SHADER_INVARIANTS_EXT 0x87D1 +#define GL_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87D2 +#define GL_VERTEX_SHADER_LOCALS_EXT 0x87D3 +#define GL_VERTEX_SHADER_OPTIMIZED_EXT 0x87D4 +#define GL_X_EXT 0x87D5 +#define GL_Y_EXT 0x87D6 +#define GL_Z_EXT 0x87D7 +#define GL_W_EXT 0x87D8 +#define GL_NEGATIVE_X_EXT 0x87D9 +#define GL_NEGATIVE_Y_EXT 0x87DA +#define GL_NEGATIVE_Z_EXT 0x87DB +#define GL_NEGATIVE_W_EXT 0x87DC +#define GL_ZERO_EXT 0x87DD +#define GL_ONE_EXT 0x87DE +#define GL_NEGATIVE_ONE_EXT 0x87DF +#define GL_NORMALIZED_RANGE_EXT 0x87E0 +#define GL_FULL_RANGE_EXT 0x87E1 +#define GL_CURRENT_VERTEX_EXT 0x87E2 +#define GL_MVP_MATRIX_EXT 0x87E3 +#define GL_VARIANT_VALUE_EXT 0x87E4 +#define GL_VARIANT_DATATYPE_EXT 0x87E5 +#define GL_VARIANT_ARRAY_STRIDE_EXT 0x87E6 +#define GL_VARIANT_ARRAY_TYPE_EXT 0x87E7 +#define GL_VARIANT_ARRAY_EXT 0x87E8 +#define GL_VARIANT_ARRAY_POINTER_EXT 0x87E9 +#define GL_INVARIANT_VALUE_EXT 0x87EA +#define GL_INVARIANT_DATATYPE_EXT 0x87EB +#define GL_LOCAL_CONSTANT_VALUE_EXT 0x87EC +#define GL_LOCAL_CONSTANT_DATATYPE_EXT 0x87ED +typedef void (APIENTRYP PFNGLBEGINVERTEXSHADEREXTPROC) (void); +typedef void (APIENTRYP PFNGLENDVERTEXSHADEREXTPROC) (void); +typedef void (APIENTRYP PFNGLBINDVERTEXSHADEREXTPROC) (GLuint id); +typedef GLuint (APIENTRYP PFNGLGENVERTEXSHADERSEXTPROC) (GLuint range); +typedef void (APIENTRYP PFNGLDELETEVERTEXSHADEREXTPROC) (GLuint id); +typedef void (APIENTRYP PFNGLSHADEROP1EXTPROC) (GLenum op, GLuint res, GLuint arg1); +typedef void (APIENTRYP PFNGLSHADEROP2EXTPROC) (GLenum op, GLuint res, GLuint arg1, GLuint arg2); +typedef void (APIENTRYP PFNGLSHADEROP3EXTPROC) (GLenum op, GLuint res, GLuint arg1, GLuint arg2, GLuint arg3); +typedef void (APIENTRYP PFNGLSWIZZLEEXTPROC) (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW); +typedef void (APIENTRYP PFNGLWRITEMASKEXTPROC) (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW); +typedef void (APIENTRYP PFNGLINSERTCOMPONENTEXTPROC) (GLuint res, GLuint src, GLuint num); +typedef void (APIENTRYP PFNGLEXTRACTCOMPONENTEXTPROC) (GLuint res, GLuint src, GLuint num); +typedef GLuint (APIENTRYP PFNGLGENSYMBOLSEXTPROC) (GLenum datatype, GLenum storagetype, GLenum range, GLuint components); +typedef void (APIENTRYP PFNGLSETINVARIANTEXTPROC) (GLuint id, GLenum type, const void *addr); +typedef void (APIENTRYP PFNGLSETLOCALCONSTANTEXTPROC) (GLuint id, GLenum type, const void *addr); +typedef void (APIENTRYP PFNGLVARIANTBVEXTPROC) (GLuint id, const GLbyte *addr); +typedef void (APIENTRYP PFNGLVARIANTSVEXTPROC) (GLuint id, const GLshort *addr); +typedef void (APIENTRYP PFNGLVARIANTIVEXTPROC) (GLuint id, const GLint *addr); +typedef void (APIENTRYP PFNGLVARIANTFVEXTPROC) (GLuint id, const GLfloat *addr); +typedef void (APIENTRYP PFNGLVARIANTDVEXTPROC) (GLuint id, const GLdouble *addr); +typedef void (APIENTRYP PFNGLVARIANTUBVEXTPROC) (GLuint id, const GLubyte *addr); +typedef void (APIENTRYP PFNGLVARIANTUSVEXTPROC) (GLuint id, const GLushort *addr); +typedef void (APIENTRYP PFNGLVARIANTUIVEXTPROC) (GLuint id, const GLuint *addr); +typedef void (APIENTRYP PFNGLVARIANTPOINTEREXTPROC) (GLuint id, GLenum type, GLuint stride, const void *addr); +typedef void (APIENTRYP PFNGLENABLEVARIANTCLIENTSTATEEXTPROC) (GLuint id); +typedef void (APIENTRYP PFNGLDISABLEVARIANTCLIENTSTATEEXTPROC) (GLuint id); +typedef GLuint (APIENTRYP PFNGLBINDLIGHTPARAMETEREXTPROC) (GLenum light, GLenum value); +typedef GLuint (APIENTRYP PFNGLBINDMATERIALPARAMETEREXTPROC) (GLenum face, GLenum value); +typedef GLuint (APIENTRYP PFNGLBINDTEXGENPARAMETEREXTPROC) (GLenum unit, GLenum coord, GLenum value); +typedef GLuint (APIENTRYP PFNGLBINDTEXTUREUNITPARAMETEREXTPROC) (GLenum unit, GLenum value); +typedef GLuint (APIENTRYP PFNGLBINDPARAMETEREXTPROC) (GLenum value); +typedef GLboolean (APIENTRYP PFNGLISVARIANTENABLEDEXTPROC) (GLuint id, GLenum cap); +typedef void (APIENTRYP PFNGLGETVARIANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data); +typedef void (APIENTRYP PFNGLGETVARIANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data); +typedef void (APIENTRYP PFNGLGETVARIANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data); +typedef void (APIENTRYP PFNGLGETVARIANTPOINTERVEXTPROC) (GLuint id, GLenum value, void **data); +typedef void (APIENTRYP PFNGLGETINVARIANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data); +typedef void (APIENTRYP PFNGLGETINVARIANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data); +typedef void (APIENTRYP PFNGLGETINVARIANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data); +typedef void (APIENTRYP PFNGLGETLOCALCONSTANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data); +typedef void (APIENTRYP PFNGLGETLOCALCONSTANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data); +typedef void (APIENTRYP PFNGLGETLOCALCONSTANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBeginVertexShaderEXT (void); +GLAPI void APIENTRY glEndVertexShaderEXT (void); +GLAPI void APIENTRY glBindVertexShaderEXT (GLuint id); +GLAPI GLuint APIENTRY glGenVertexShadersEXT (GLuint range); +GLAPI void APIENTRY glDeleteVertexShaderEXT (GLuint id); +GLAPI void APIENTRY glShaderOp1EXT (GLenum op, GLuint res, GLuint arg1); +GLAPI void APIENTRY glShaderOp2EXT (GLenum op, GLuint res, GLuint arg1, GLuint arg2); +GLAPI void APIENTRY glShaderOp3EXT (GLenum op, GLuint res, GLuint arg1, GLuint arg2, GLuint arg3); +GLAPI void APIENTRY glSwizzleEXT (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW); +GLAPI void APIENTRY glWriteMaskEXT (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW); +GLAPI void APIENTRY glInsertComponentEXT (GLuint res, GLuint src, GLuint num); +GLAPI void APIENTRY glExtractComponentEXT (GLuint res, GLuint src, GLuint num); +GLAPI GLuint APIENTRY glGenSymbolsEXT (GLenum datatype, GLenum storagetype, GLenum range, GLuint components); +GLAPI void APIENTRY glSetInvariantEXT (GLuint id, GLenum type, const void *addr); +GLAPI void APIENTRY glSetLocalConstantEXT (GLuint id, GLenum type, const void *addr); +GLAPI void APIENTRY glVariantbvEXT (GLuint id, const GLbyte *addr); +GLAPI void APIENTRY glVariantsvEXT (GLuint id, const GLshort *addr); +GLAPI void APIENTRY glVariantivEXT (GLuint id, const GLint *addr); +GLAPI void APIENTRY glVariantfvEXT (GLuint id, const GLfloat *addr); +GLAPI void APIENTRY glVariantdvEXT (GLuint id, const GLdouble *addr); +GLAPI void APIENTRY glVariantubvEXT (GLuint id, const GLubyte *addr); +GLAPI void APIENTRY glVariantusvEXT (GLuint id, const GLushort *addr); +GLAPI void APIENTRY glVariantuivEXT (GLuint id, const GLuint *addr); +GLAPI void APIENTRY glVariantPointerEXT (GLuint id, GLenum type, GLuint stride, const void *addr); +GLAPI void APIENTRY glEnableVariantClientStateEXT (GLuint id); +GLAPI void APIENTRY glDisableVariantClientStateEXT (GLuint id); +GLAPI GLuint APIENTRY glBindLightParameterEXT (GLenum light, GLenum value); +GLAPI GLuint APIENTRY glBindMaterialParameterEXT (GLenum face, GLenum value); +GLAPI GLuint APIENTRY glBindTexGenParameterEXT (GLenum unit, GLenum coord, GLenum value); +GLAPI GLuint APIENTRY glBindTextureUnitParameterEXT (GLenum unit, GLenum value); +GLAPI GLuint APIENTRY glBindParameterEXT (GLenum value); +GLAPI GLboolean APIENTRY glIsVariantEnabledEXT (GLuint id, GLenum cap); +GLAPI void APIENTRY glGetVariantBooleanvEXT (GLuint id, GLenum value, GLboolean *data); +GLAPI void APIENTRY glGetVariantIntegervEXT (GLuint id, GLenum value, GLint *data); +GLAPI void APIENTRY glGetVariantFloatvEXT (GLuint id, GLenum value, GLfloat *data); +GLAPI void APIENTRY glGetVariantPointervEXT (GLuint id, GLenum value, void **data); +GLAPI void APIENTRY glGetInvariantBooleanvEXT (GLuint id, GLenum value, GLboolean *data); +GLAPI void APIENTRY glGetInvariantIntegervEXT (GLuint id, GLenum value, GLint *data); +GLAPI void APIENTRY glGetInvariantFloatvEXT (GLuint id, GLenum value, GLfloat *data); +GLAPI void APIENTRY glGetLocalConstantBooleanvEXT (GLuint id, GLenum value, GLboolean *data); +GLAPI void APIENTRY glGetLocalConstantIntegervEXT (GLuint id, GLenum value, GLint *data); +GLAPI void APIENTRY glGetLocalConstantFloatvEXT (GLuint id, GLenum value, GLfloat *data); +#endif +#endif /* GL_EXT_vertex_shader */ + +#ifndef GL_EXT_vertex_weighting +#define GL_EXT_vertex_weighting 1 +#define GL_MODELVIEW0_STACK_DEPTH_EXT 0x0BA3 +#define GL_MODELVIEW1_STACK_DEPTH_EXT 0x8502 +#define GL_MODELVIEW0_MATRIX_EXT 0x0BA6 +#define GL_MODELVIEW1_MATRIX_EXT 0x8506 +#define GL_VERTEX_WEIGHTING_EXT 0x8509 +#define GL_MODELVIEW0_EXT 0x1700 +#define GL_MODELVIEW1_EXT 0x850A +#define GL_CURRENT_VERTEX_WEIGHT_EXT 0x850B +#define GL_VERTEX_WEIGHT_ARRAY_EXT 0x850C +#define GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT 0x850D +#define GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT 0x850E +#define GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT 0x850F +#define GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT 0x8510 +typedef void (APIENTRYP PFNGLVERTEXWEIGHTFEXTPROC) (GLfloat weight); +typedef void (APIENTRYP PFNGLVERTEXWEIGHTFVEXTPROC) (const GLfloat *weight); +typedef void (APIENTRYP PFNGLVERTEXWEIGHTPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, const void *pointer); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexWeightfEXT (GLfloat weight); +GLAPI void APIENTRY glVertexWeightfvEXT (const GLfloat *weight); +GLAPI void APIENTRY glVertexWeightPointerEXT (GLint size, GLenum type, GLsizei stride, const void *pointer); +#endif +#endif /* GL_EXT_vertex_weighting */ + +#ifndef GL_EXT_x11_sync_object +#define GL_EXT_x11_sync_object 1 +#define GL_SYNC_X11_FENCE_EXT 0x90E1 +typedef GLsync (APIENTRYP PFNGLIMPORTSYNCEXTPROC) (GLenum external_sync_type, GLintptr external_sync, GLbitfield flags); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLsync APIENTRY glImportSyncEXT (GLenum external_sync_type, GLintptr external_sync, GLbitfield flags); +#endif +#endif /* GL_EXT_x11_sync_object */ + +#ifndef GL_GREMEDY_frame_terminator +#define GL_GREMEDY_frame_terminator 1 +typedef void (APIENTRYP PFNGLFRAMETERMINATORGREMEDYPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFrameTerminatorGREMEDY (void); +#endif +#endif /* GL_GREMEDY_frame_terminator */ + +#ifndef GL_GREMEDY_string_marker +#define GL_GREMEDY_string_marker 1 +typedef void (APIENTRYP PFNGLSTRINGMARKERGREMEDYPROC) (GLsizei len, const void *string); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glStringMarkerGREMEDY (GLsizei len, const void *string); +#endif +#endif /* GL_GREMEDY_string_marker */ + +#ifndef GL_HP_convolution_border_modes +#define GL_HP_convolution_border_modes 1 +#define GL_IGNORE_BORDER_HP 0x8150 +#define GL_CONSTANT_BORDER_HP 0x8151 +#define GL_REPLICATE_BORDER_HP 0x8153 +#define GL_CONVOLUTION_BORDER_COLOR_HP 0x8154 +#endif /* GL_HP_convolution_border_modes */ + +#ifndef GL_HP_image_transform +#define GL_HP_image_transform 1 +#define GL_IMAGE_SCALE_X_HP 0x8155 +#define GL_IMAGE_SCALE_Y_HP 0x8156 +#define GL_IMAGE_TRANSLATE_X_HP 0x8157 +#define GL_IMAGE_TRANSLATE_Y_HP 0x8158 +#define GL_IMAGE_ROTATE_ANGLE_HP 0x8159 +#define GL_IMAGE_ROTATE_ORIGIN_X_HP 0x815A +#define GL_IMAGE_ROTATE_ORIGIN_Y_HP 0x815B +#define GL_IMAGE_MAG_FILTER_HP 0x815C +#define GL_IMAGE_MIN_FILTER_HP 0x815D +#define GL_IMAGE_CUBIC_WEIGHT_HP 0x815E +#define GL_CUBIC_HP 0x815F +#define GL_AVERAGE_HP 0x8160 +#define GL_IMAGE_TRANSFORM_2D_HP 0x8161 +#define GL_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP 0x8162 +#define GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP 0x8163 +typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERIHPPROC) (GLenum target, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERFHPPROC) (GLenum target, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLGETIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, GLfloat *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glImageTransformParameteriHP (GLenum target, GLenum pname, GLint param); +GLAPI void APIENTRY glImageTransformParameterfHP (GLenum target, GLenum pname, GLfloat param); +GLAPI void APIENTRY glImageTransformParameterivHP (GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY glImageTransformParameterfvHP (GLenum target, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glGetImageTransformParameterivHP (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetImageTransformParameterfvHP (GLenum target, GLenum pname, GLfloat *params); +#endif +#endif /* GL_HP_image_transform */ + +#ifndef GL_HP_occlusion_test +#define GL_HP_occlusion_test 1 +#define GL_OCCLUSION_TEST_HP 0x8165 +#define GL_OCCLUSION_TEST_RESULT_HP 0x8166 +#endif /* GL_HP_occlusion_test */ + +#ifndef GL_HP_texture_lighting +#define GL_HP_texture_lighting 1 +#define GL_TEXTURE_LIGHTING_MODE_HP 0x8167 +#define GL_TEXTURE_POST_SPECULAR_HP 0x8168 +#define GL_TEXTURE_PRE_SPECULAR_HP 0x8169 +#endif /* GL_HP_texture_lighting */ + +#ifndef GL_IBM_cull_vertex +#define GL_IBM_cull_vertex 1 +#define GL_CULL_VERTEX_IBM 103050 +#endif /* GL_IBM_cull_vertex */ + +#ifndef GL_IBM_multimode_draw_arrays +#define GL_IBM_multimode_draw_arrays 1 +typedef void (APIENTRYP PFNGLMULTIMODEDRAWARRAYSIBMPROC) (const GLenum *mode, const GLint *first, const GLsizei *count, GLsizei primcount, GLint modestride); +typedef void (APIENTRYP PFNGLMULTIMODEDRAWELEMENTSIBMPROC) (const GLenum *mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount, GLint modestride); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMultiModeDrawArraysIBM (const GLenum *mode, const GLint *first, const GLsizei *count, GLsizei primcount, GLint modestride); +GLAPI void APIENTRY glMultiModeDrawElementsIBM (const GLenum *mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount, GLint modestride); +#endif +#endif /* GL_IBM_multimode_draw_arrays */ + +#ifndef GL_IBM_rasterpos_clip +#define GL_IBM_rasterpos_clip 1 +#define GL_RASTER_POSITION_UNCLIPPED_IBM 0x19262 +#endif /* GL_IBM_rasterpos_clip */ + +#ifndef GL_IBM_static_data +#define GL_IBM_static_data 1 +#define GL_ALL_STATIC_DATA_IBM 103060 +#define GL_STATIC_VERTEX_ARRAY_IBM 103061 +typedef void (APIENTRYP PFNGLFLUSHSTATICDATAIBMPROC) (GLenum target); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFlushStaticDataIBM (GLenum target); +#endif +#endif /* GL_IBM_static_data */ + +#ifndef GL_IBM_texture_mirrored_repeat +#define GL_IBM_texture_mirrored_repeat 1 +#define GL_MIRRORED_REPEAT_IBM 0x8370 +#endif /* GL_IBM_texture_mirrored_repeat */ + +#ifndef GL_IBM_vertex_array_lists +#define GL_IBM_vertex_array_lists 1 +#define GL_VERTEX_ARRAY_LIST_IBM 103070 +#define GL_NORMAL_ARRAY_LIST_IBM 103071 +#define GL_COLOR_ARRAY_LIST_IBM 103072 +#define GL_INDEX_ARRAY_LIST_IBM 103073 +#define GL_TEXTURE_COORD_ARRAY_LIST_IBM 103074 +#define GL_EDGE_FLAG_ARRAY_LIST_IBM 103075 +#define GL_FOG_COORDINATE_ARRAY_LIST_IBM 103076 +#define GL_SECONDARY_COLOR_ARRAY_LIST_IBM 103077 +#define GL_VERTEX_ARRAY_LIST_STRIDE_IBM 103080 +#define GL_NORMAL_ARRAY_LIST_STRIDE_IBM 103081 +#define GL_COLOR_ARRAY_LIST_STRIDE_IBM 103082 +#define GL_INDEX_ARRAY_LIST_STRIDE_IBM 103083 +#define GL_TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM 103084 +#define GL_EDGE_FLAG_ARRAY_LIST_STRIDE_IBM 103085 +#define GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM 103086 +#define GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM 103087 +typedef void (APIENTRYP PFNGLCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const void **pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const void **pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLEDGEFLAGPOINTERLISTIBMPROC) (GLint stride, const GLboolean **pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLFOGCOORDPOINTERLISTIBMPROC) (GLenum type, GLint stride, const void **pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLINDEXPOINTERLISTIBMPROC) (GLenum type, GLint stride, const void **pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLNORMALPOINTERLISTIBMPROC) (GLenum type, GLint stride, const void **pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLTEXCOORDPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const void **pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLVERTEXPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const void **pointer, GLint ptrstride); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glColorPointerListIBM (GLint size, GLenum type, GLint stride, const void **pointer, GLint ptrstride); +GLAPI void APIENTRY glSecondaryColorPointerListIBM (GLint size, GLenum type, GLint stride, const void **pointer, GLint ptrstride); +GLAPI void APIENTRY glEdgeFlagPointerListIBM (GLint stride, const GLboolean **pointer, GLint ptrstride); +GLAPI void APIENTRY glFogCoordPointerListIBM (GLenum type, GLint stride, const void **pointer, GLint ptrstride); +GLAPI void APIENTRY glIndexPointerListIBM (GLenum type, GLint stride, const void **pointer, GLint ptrstride); +GLAPI void APIENTRY glNormalPointerListIBM (GLenum type, GLint stride, const void **pointer, GLint ptrstride); +GLAPI void APIENTRY glTexCoordPointerListIBM (GLint size, GLenum type, GLint stride, const void **pointer, GLint ptrstride); +GLAPI void APIENTRY glVertexPointerListIBM (GLint size, GLenum type, GLint stride, const void **pointer, GLint ptrstride); +#endif +#endif /* GL_IBM_vertex_array_lists */ + +#ifndef GL_INGR_blend_func_separate +#define GL_INGR_blend_func_separate 1 +typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEINGRPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendFuncSeparateINGR (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +#endif +#endif /* GL_INGR_blend_func_separate */ + +#ifndef GL_INGR_color_clamp +#define GL_INGR_color_clamp 1 +#define GL_RED_MIN_CLAMP_INGR 0x8560 +#define GL_GREEN_MIN_CLAMP_INGR 0x8561 +#define GL_BLUE_MIN_CLAMP_INGR 0x8562 +#define GL_ALPHA_MIN_CLAMP_INGR 0x8563 +#define GL_RED_MAX_CLAMP_INGR 0x8564 +#define GL_GREEN_MAX_CLAMP_INGR 0x8565 +#define GL_BLUE_MAX_CLAMP_INGR 0x8566 +#define GL_ALPHA_MAX_CLAMP_INGR 0x8567 +#endif /* GL_INGR_color_clamp */ + +#ifndef GL_INGR_interlace_read +#define GL_INGR_interlace_read 1 +#define GL_INTERLACE_READ_INGR 0x8568 +#endif /* GL_INGR_interlace_read */ + +#ifndef GL_INTEL_fragment_shader_ordering +#define GL_INTEL_fragment_shader_ordering 1 +#endif /* GL_INTEL_fragment_shader_ordering */ + +#ifndef GL_INTEL_map_texture +#define GL_INTEL_map_texture 1 +#define GL_TEXTURE_MEMORY_LAYOUT_INTEL 0x83FF +#define GL_LAYOUT_DEFAULT_INTEL 0 +#define GL_LAYOUT_LINEAR_INTEL 1 +#define GL_LAYOUT_LINEAR_CPU_CACHED_INTEL 2 +typedef void (APIENTRYP PFNGLSYNCTEXTUREINTELPROC) (GLuint texture); +typedef void (APIENTRYP PFNGLUNMAPTEXTURE2DINTELPROC) (GLuint texture, GLint level); +typedef void *(APIENTRYP PFNGLMAPTEXTURE2DINTELPROC) (GLuint texture, GLint level, GLbitfield access, GLint *stride, GLenum *layout); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSyncTextureINTEL (GLuint texture); +GLAPI void APIENTRY glUnmapTexture2DINTEL (GLuint texture, GLint level); +GLAPI void *APIENTRY glMapTexture2DINTEL (GLuint texture, GLint level, GLbitfield access, GLint *stride, GLenum *layout); +#endif +#endif /* GL_INTEL_map_texture */ + +#ifndef GL_INTEL_parallel_arrays +#define GL_INTEL_parallel_arrays 1 +#define GL_PARALLEL_ARRAYS_INTEL 0x83F4 +#define GL_VERTEX_ARRAY_PARALLEL_POINTERS_INTEL 0x83F5 +#define GL_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL 0x83F6 +#define GL_COLOR_ARRAY_PARALLEL_POINTERS_INTEL 0x83F7 +#define GL_TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL 0x83F8 +typedef void (APIENTRYP PFNGLVERTEXPOINTERVINTELPROC) (GLint size, GLenum type, const void **pointer); +typedef void (APIENTRYP PFNGLNORMALPOINTERVINTELPROC) (GLenum type, const void **pointer); +typedef void (APIENTRYP PFNGLCOLORPOINTERVINTELPROC) (GLint size, GLenum type, const void **pointer); +typedef void (APIENTRYP PFNGLTEXCOORDPOINTERVINTELPROC) (GLint size, GLenum type, const void **pointer); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexPointervINTEL (GLint size, GLenum type, const void **pointer); +GLAPI void APIENTRY glNormalPointervINTEL (GLenum type, const void **pointer); +GLAPI void APIENTRY glColorPointervINTEL (GLint size, GLenum type, const void **pointer); +GLAPI void APIENTRY glTexCoordPointervINTEL (GLint size, GLenum type, const void **pointer); +#endif +#endif /* GL_INTEL_parallel_arrays */ + +#ifndef GL_INTEL_performance_query +#define GL_INTEL_performance_query 1 +#define GL_PERFQUERY_SINGLE_CONTEXT_INTEL 0x00000000 +#define GL_PERFQUERY_GLOBAL_CONTEXT_INTEL 0x00000001 +#define GL_PERFQUERY_WAIT_INTEL 0x83FB +#define GL_PERFQUERY_FLUSH_INTEL 0x83FA +#define GL_PERFQUERY_DONOT_FLUSH_INTEL 0x83F9 +#define GL_PERFQUERY_COUNTER_EVENT_INTEL 0x94F0 +#define GL_PERFQUERY_COUNTER_DURATION_NORM_INTEL 0x94F1 +#define GL_PERFQUERY_COUNTER_DURATION_RAW_INTEL 0x94F2 +#define GL_PERFQUERY_COUNTER_THROUGHPUT_INTEL 0x94F3 +#define GL_PERFQUERY_COUNTER_RAW_INTEL 0x94F4 +#define GL_PERFQUERY_COUNTER_TIMESTAMP_INTEL 0x94F5 +#define GL_PERFQUERY_COUNTER_DATA_UINT32_INTEL 0x94F8 +#define GL_PERFQUERY_COUNTER_DATA_UINT64_INTEL 0x94F9 +#define GL_PERFQUERY_COUNTER_DATA_FLOAT_INTEL 0x94FA +#define GL_PERFQUERY_COUNTER_DATA_DOUBLE_INTEL 0x94FB +#define GL_PERFQUERY_COUNTER_DATA_BOOL32_INTEL 0x94FC +#define GL_PERFQUERY_QUERY_NAME_LENGTH_MAX_INTEL 0x94FD +#define GL_PERFQUERY_COUNTER_NAME_LENGTH_MAX_INTEL 0x94FE +#define GL_PERFQUERY_COUNTER_DESC_LENGTH_MAX_INTEL 0x94FF +#define GL_PERFQUERY_GPA_EXTENDED_COUNTERS_INTEL 0x9500 +typedef void (APIENTRYP PFNGLBEGINPERFQUERYINTELPROC) (GLuint queryHandle); +typedef void (APIENTRYP PFNGLCREATEPERFQUERYINTELPROC) (GLuint queryId, GLuint *queryHandle); +typedef void (APIENTRYP PFNGLDELETEPERFQUERYINTELPROC) (GLuint queryHandle); +typedef void (APIENTRYP PFNGLENDPERFQUERYINTELPROC) (GLuint queryHandle); +typedef void (APIENTRYP PFNGLGETFIRSTPERFQUERYIDINTELPROC) (GLuint *queryId); +typedef void (APIENTRYP PFNGLGETNEXTPERFQUERYIDINTELPROC) (GLuint queryId, GLuint *nextQueryId); +typedef void (APIENTRYP PFNGLGETPERFCOUNTERINFOINTELPROC) (GLuint queryId, GLuint counterId, GLuint counterNameLength, GLchar *counterName, GLuint counterDescLength, GLchar *counterDesc, GLuint *counterOffset, GLuint *counterDataSize, GLuint *counterTypeEnum, GLuint *counterDataTypeEnum, GLuint64 *rawCounterMaxValue); +typedef void (APIENTRYP PFNGLGETPERFQUERYDATAINTELPROC) (GLuint queryHandle, GLuint flags, GLsizei dataSize, GLvoid *data, GLuint *bytesWritten); +typedef void (APIENTRYP PFNGLGETPERFQUERYIDBYNAMEINTELPROC) (GLchar *queryName, GLuint *queryId); +typedef void (APIENTRYP PFNGLGETPERFQUERYINFOINTELPROC) (GLuint queryId, GLuint queryNameLength, GLchar *queryName, GLuint *dataSize, GLuint *noCounters, GLuint *noInstances, GLuint *capsMask); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBeginPerfQueryINTEL (GLuint queryHandle); +GLAPI void APIENTRY glCreatePerfQueryINTEL (GLuint queryId, GLuint *queryHandle); +GLAPI void APIENTRY glDeletePerfQueryINTEL (GLuint queryHandle); +GLAPI void APIENTRY glEndPerfQueryINTEL (GLuint queryHandle); +GLAPI void APIENTRY glGetFirstPerfQueryIdINTEL (GLuint *queryId); +GLAPI void APIENTRY glGetNextPerfQueryIdINTEL (GLuint queryId, GLuint *nextQueryId); +GLAPI void APIENTRY glGetPerfCounterInfoINTEL (GLuint queryId, GLuint counterId, GLuint counterNameLength, GLchar *counterName, GLuint counterDescLength, GLchar *counterDesc, GLuint *counterOffset, GLuint *counterDataSize, GLuint *counterTypeEnum, GLuint *counterDataTypeEnum, GLuint64 *rawCounterMaxValue); +GLAPI void APIENTRY glGetPerfQueryDataINTEL (GLuint queryHandle, GLuint flags, GLsizei dataSize, GLvoid *data, GLuint *bytesWritten); +GLAPI void APIENTRY glGetPerfQueryIdByNameINTEL (GLchar *queryName, GLuint *queryId); +GLAPI void APIENTRY glGetPerfQueryInfoINTEL (GLuint queryId, GLuint queryNameLength, GLchar *queryName, GLuint *dataSize, GLuint *noCounters, GLuint *noInstances, GLuint *capsMask); +#endif +#endif /* GL_INTEL_performance_query */ + +#ifndef GL_MESAX_texture_stack +#define GL_MESAX_texture_stack 1 +#define GL_TEXTURE_1D_STACK_MESAX 0x8759 +#define GL_TEXTURE_2D_STACK_MESAX 0x875A +#define GL_PROXY_TEXTURE_1D_STACK_MESAX 0x875B +#define GL_PROXY_TEXTURE_2D_STACK_MESAX 0x875C +#define GL_TEXTURE_1D_STACK_BINDING_MESAX 0x875D +#define GL_TEXTURE_2D_STACK_BINDING_MESAX 0x875E +#endif /* GL_MESAX_texture_stack */ + +#ifndef GL_MESA_pack_invert +#define GL_MESA_pack_invert 1 +#define GL_PACK_INVERT_MESA 0x8758 +#endif /* GL_MESA_pack_invert */ + +#ifndef GL_MESA_resize_buffers +#define GL_MESA_resize_buffers 1 +typedef void (APIENTRYP PFNGLRESIZEBUFFERSMESAPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glResizeBuffersMESA (void); +#endif +#endif /* GL_MESA_resize_buffers */ + +#ifndef GL_MESA_window_pos +#define GL_MESA_window_pos 1 +typedef void (APIENTRYP PFNGLWINDOWPOS2DMESAPROC) (GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLWINDOWPOS2DVMESAPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2FMESAPROC) (GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLWINDOWPOS2FVMESAPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2IMESAPROC) (GLint x, GLint y); +typedef void (APIENTRYP PFNGLWINDOWPOS2IVMESAPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2SMESAPROC) (GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLWINDOWPOS2SVMESAPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3DMESAPROC) (GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLWINDOWPOS3DVMESAPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3FMESAPROC) (GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLWINDOWPOS3FVMESAPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3IMESAPROC) (GLint x, GLint y, GLint z); +typedef void (APIENTRYP PFNGLWINDOWPOS3IVMESAPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3SMESAPROC) (GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLWINDOWPOS3SVMESAPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLWINDOWPOS4DMESAPROC) (GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLWINDOWPOS4DVMESAPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS4FMESAPROC) (GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLWINDOWPOS4FVMESAPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS4IMESAPROC) (GLint x, GLint y, GLint z, GLint w); +typedef void (APIENTRYP PFNGLWINDOWPOS4IVMESAPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS4SMESAPROC) (GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (APIENTRYP PFNGLWINDOWPOS4SVMESAPROC) (const GLshort *v); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glWindowPos2dMESA (GLdouble x, GLdouble y); +GLAPI void APIENTRY glWindowPos2dvMESA (const GLdouble *v); +GLAPI void APIENTRY glWindowPos2fMESA (GLfloat x, GLfloat y); +GLAPI void APIENTRY glWindowPos2fvMESA (const GLfloat *v); +GLAPI void APIENTRY glWindowPos2iMESA (GLint x, GLint y); +GLAPI void APIENTRY glWindowPos2ivMESA (const GLint *v); +GLAPI void APIENTRY glWindowPos2sMESA (GLshort x, GLshort y); +GLAPI void APIENTRY glWindowPos2svMESA (const GLshort *v); +GLAPI void APIENTRY glWindowPos3dMESA (GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY glWindowPos3dvMESA (const GLdouble *v); +GLAPI void APIENTRY glWindowPos3fMESA (GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glWindowPos3fvMESA (const GLfloat *v); +GLAPI void APIENTRY glWindowPos3iMESA (GLint x, GLint y, GLint z); +GLAPI void APIENTRY glWindowPos3ivMESA (const GLint *v); +GLAPI void APIENTRY glWindowPos3sMESA (GLshort x, GLshort y, GLshort z); +GLAPI void APIENTRY glWindowPos3svMESA (const GLshort *v); +GLAPI void APIENTRY glWindowPos4dMESA (GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY glWindowPos4dvMESA (const GLdouble *v); +GLAPI void APIENTRY glWindowPos4fMESA (GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void APIENTRY glWindowPos4fvMESA (const GLfloat *v); +GLAPI void APIENTRY glWindowPos4iMESA (GLint x, GLint y, GLint z, GLint w); +GLAPI void APIENTRY glWindowPos4ivMESA (const GLint *v); +GLAPI void APIENTRY glWindowPos4sMESA (GLshort x, GLshort y, GLshort z, GLshort w); +GLAPI void APIENTRY glWindowPos4svMESA (const GLshort *v); +#endif +#endif /* GL_MESA_window_pos */ + +#ifndef GL_MESA_ycbcr_texture +#define GL_MESA_ycbcr_texture 1 +#define GL_UNSIGNED_SHORT_8_8_MESA 0x85BA +#define GL_UNSIGNED_SHORT_8_8_REV_MESA 0x85BB +#define GL_YCBCR_MESA 0x8757 +#endif /* GL_MESA_ycbcr_texture */ + +#ifndef GL_NVX_conditional_render +#define GL_NVX_conditional_render 1 +typedef void (APIENTRYP PFNGLBEGINCONDITIONALRENDERNVXPROC) (GLuint id); +typedef void (APIENTRYP PFNGLENDCONDITIONALRENDERNVXPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBeginConditionalRenderNVX (GLuint id); +GLAPI void APIENTRY glEndConditionalRenderNVX (void); +#endif +#endif /* GL_NVX_conditional_render */ + +#ifndef GL_NVX_gpu_memory_info +#define GL_NVX_gpu_memory_info 1 +#define GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX 0x9047 +#define GL_GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX 0x9048 +#define GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX 0x9049 +#define GL_GPU_MEMORY_INFO_EVICTION_COUNT_NVX 0x904A +#define GL_GPU_MEMORY_INFO_EVICTED_MEMORY_NVX 0x904B +#endif /* GL_NVX_gpu_memory_info */ + +#ifndef GL_NV_bindless_multi_draw_indirect +#define GL_NV_bindless_multi_draw_indirect 1 +typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTBINDLESSNVPROC) (GLenum mode, const void *indirect, GLsizei drawCount, GLsizei stride, GLint vertexBufferCount); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTBINDLESSNVPROC) (GLenum mode, GLenum type, const void *indirect, GLsizei drawCount, GLsizei stride, GLint vertexBufferCount); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMultiDrawArraysIndirectBindlessNV (GLenum mode, const void *indirect, GLsizei drawCount, GLsizei stride, GLint vertexBufferCount); +GLAPI void APIENTRY glMultiDrawElementsIndirectBindlessNV (GLenum mode, GLenum type, const void *indirect, GLsizei drawCount, GLsizei stride, GLint vertexBufferCount); +#endif +#endif /* GL_NV_bindless_multi_draw_indirect */ + +#ifndef GL_NV_bindless_texture +#define GL_NV_bindless_texture 1 +typedef GLuint64 (APIENTRYP PFNGLGETTEXTUREHANDLENVPROC) (GLuint texture); +typedef GLuint64 (APIENTRYP PFNGLGETTEXTURESAMPLERHANDLENVPROC) (GLuint texture, GLuint sampler); +typedef void (APIENTRYP PFNGLMAKETEXTUREHANDLERESIDENTNVPROC) (GLuint64 handle); +typedef void (APIENTRYP PFNGLMAKETEXTUREHANDLENONRESIDENTNVPROC) (GLuint64 handle); +typedef GLuint64 (APIENTRYP PFNGLGETIMAGEHANDLENVPROC) (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format); +typedef void (APIENTRYP PFNGLMAKEIMAGEHANDLERESIDENTNVPROC) (GLuint64 handle, GLenum access); +typedef void (APIENTRYP PFNGLMAKEIMAGEHANDLENONRESIDENTNVPROC) (GLuint64 handle); +typedef void (APIENTRYP PFNGLUNIFORMHANDLEUI64NVPROC) (GLint location, GLuint64 value); +typedef void (APIENTRYP PFNGLUNIFORMHANDLEUI64VNVPROC) (GLint location, GLsizei count, const GLuint64 *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64NVPROC) (GLuint program, GLint location, GLuint64 value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *values); +typedef GLboolean (APIENTRYP PFNGLISTEXTUREHANDLERESIDENTNVPROC) (GLuint64 handle); +typedef GLboolean (APIENTRYP PFNGLISIMAGEHANDLERESIDENTNVPROC) (GLuint64 handle); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLuint64 APIENTRY glGetTextureHandleNV (GLuint texture); +GLAPI GLuint64 APIENTRY glGetTextureSamplerHandleNV (GLuint texture, GLuint sampler); +GLAPI void APIENTRY glMakeTextureHandleResidentNV (GLuint64 handle); +GLAPI void APIENTRY glMakeTextureHandleNonResidentNV (GLuint64 handle); +GLAPI GLuint64 APIENTRY glGetImageHandleNV (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format); +GLAPI void APIENTRY glMakeImageHandleResidentNV (GLuint64 handle, GLenum access); +GLAPI void APIENTRY glMakeImageHandleNonResidentNV (GLuint64 handle); +GLAPI void APIENTRY glUniformHandleui64NV (GLint location, GLuint64 value); +GLAPI void APIENTRY glUniformHandleui64vNV (GLint location, GLsizei count, const GLuint64 *value); +GLAPI void APIENTRY glProgramUniformHandleui64NV (GLuint program, GLint location, GLuint64 value); +GLAPI void APIENTRY glProgramUniformHandleui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64 *values); +GLAPI GLboolean APIENTRY glIsTextureHandleResidentNV (GLuint64 handle); +GLAPI GLboolean APIENTRY glIsImageHandleResidentNV (GLuint64 handle); +#endif +#endif /* GL_NV_bindless_texture */ + +#ifndef GL_NV_blend_equation_advanced +#define GL_NV_blend_equation_advanced 1 +#define GL_BLEND_OVERLAP_NV 0x9281 +#define GL_BLEND_PREMULTIPLIED_SRC_NV 0x9280 +#define GL_BLUE_NV 0x1905 +#define GL_COLORBURN_NV 0x929A +#define GL_COLORDODGE_NV 0x9299 +#define GL_CONJOINT_NV 0x9284 +#define GL_CONTRAST_NV 0x92A1 +#define GL_DARKEN_NV 0x9297 +#define GL_DIFFERENCE_NV 0x929E +#define GL_DISJOINT_NV 0x9283 +#define GL_DST_ATOP_NV 0x928F +#define GL_DST_IN_NV 0x928B +#define GL_DST_NV 0x9287 +#define GL_DST_OUT_NV 0x928D +#define GL_DST_OVER_NV 0x9289 +#define GL_EXCLUSION_NV 0x92A0 +#define GL_GREEN_NV 0x1904 +#define GL_HARDLIGHT_NV 0x929B +#define GL_HARDMIX_NV 0x92A9 +#define GL_HSL_COLOR_NV 0x92AF +#define GL_HSL_HUE_NV 0x92AD +#define GL_HSL_LUMINOSITY_NV 0x92B0 +#define GL_HSL_SATURATION_NV 0x92AE +#define GL_INVERT_OVG_NV 0x92B4 +#define GL_INVERT_RGB_NV 0x92A3 +#define GL_LIGHTEN_NV 0x9298 +#define GL_LINEARBURN_NV 0x92A5 +#define GL_LINEARDODGE_NV 0x92A4 +#define GL_LINEARLIGHT_NV 0x92A7 +#define GL_MINUS_CLAMPED_NV 0x92B3 +#define GL_MINUS_NV 0x929F +#define GL_MULTIPLY_NV 0x9294 +#define GL_OVERLAY_NV 0x9296 +#define GL_PINLIGHT_NV 0x92A8 +#define GL_PLUS_CLAMPED_ALPHA_NV 0x92B2 +#define GL_PLUS_CLAMPED_NV 0x92B1 +#define GL_PLUS_DARKER_NV 0x9292 +#define GL_PLUS_NV 0x9291 +#define GL_RED_NV 0x1903 +#define GL_SCREEN_NV 0x9295 +#define GL_SOFTLIGHT_NV 0x929C +#define GL_SRC_ATOP_NV 0x928E +#define GL_SRC_IN_NV 0x928A +#define GL_SRC_NV 0x9286 +#define GL_SRC_OUT_NV 0x928C +#define GL_SRC_OVER_NV 0x9288 +#define GL_UNCORRELATED_NV 0x9282 +#define GL_VIVIDLIGHT_NV 0x92A6 +#define GL_XOR_NV 0x1506 +typedef void (APIENTRYP PFNGLBLENDPARAMETERINVPROC) (GLenum pname, GLint value); +typedef void (APIENTRYP PFNGLBLENDBARRIERNVPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendParameteriNV (GLenum pname, GLint value); +GLAPI void APIENTRY glBlendBarrierNV (void); +#endif +#endif /* GL_NV_blend_equation_advanced */ + +#ifndef GL_NV_blend_equation_advanced_coherent +#define GL_NV_blend_equation_advanced_coherent 1 +#define GL_BLEND_ADVANCED_COHERENT_NV 0x9285 +#endif /* GL_NV_blend_equation_advanced_coherent */ + +#ifndef GL_NV_blend_square +#define GL_NV_blend_square 1 +#endif /* GL_NV_blend_square */ + +#ifndef GL_NV_compute_program5 +#define GL_NV_compute_program5 1 +#define GL_COMPUTE_PROGRAM_NV 0x90FB +#define GL_COMPUTE_PROGRAM_PARAMETER_BUFFER_NV 0x90FC +#endif /* GL_NV_compute_program5 */ + +#ifndef GL_NV_conditional_render +#define GL_NV_conditional_render 1 +#define GL_QUERY_WAIT_NV 0x8E13 +#define GL_QUERY_NO_WAIT_NV 0x8E14 +#define GL_QUERY_BY_REGION_WAIT_NV 0x8E15 +#define GL_QUERY_BY_REGION_NO_WAIT_NV 0x8E16 +typedef void (APIENTRYP PFNGLBEGINCONDITIONALRENDERNVPROC) (GLuint id, GLenum mode); +typedef void (APIENTRYP PFNGLENDCONDITIONALRENDERNVPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBeginConditionalRenderNV (GLuint id, GLenum mode); +GLAPI void APIENTRY glEndConditionalRenderNV (void); +#endif +#endif /* GL_NV_conditional_render */ + +#ifndef GL_NV_copy_depth_to_color +#define GL_NV_copy_depth_to_color 1 +#define GL_DEPTH_STENCIL_TO_RGBA_NV 0x886E +#define GL_DEPTH_STENCIL_TO_BGRA_NV 0x886F +#endif /* GL_NV_copy_depth_to_color */ + +#ifndef GL_NV_copy_image +#define GL_NV_copy_image 1 +typedef void (APIENTRYP PFNGLCOPYIMAGESUBDATANVPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCopyImageSubDataNV (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth); +#endif +#endif /* GL_NV_copy_image */ + +#ifndef GL_NV_deep_texture3D +#define GL_NV_deep_texture3D 1 +#define GL_MAX_DEEP_3D_TEXTURE_WIDTH_HEIGHT_NV 0x90D0 +#define GL_MAX_DEEP_3D_TEXTURE_DEPTH_NV 0x90D1 +#endif /* GL_NV_deep_texture3D */ + +#ifndef GL_NV_depth_buffer_float +#define GL_NV_depth_buffer_float 1 +#define GL_DEPTH_COMPONENT32F_NV 0x8DAB +#define GL_DEPTH32F_STENCIL8_NV 0x8DAC +#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV_NV 0x8DAD +#define GL_DEPTH_BUFFER_FLOAT_MODE_NV 0x8DAF +typedef void (APIENTRYP PFNGLDEPTHRANGEDNVPROC) (GLdouble zNear, GLdouble zFar); +typedef void (APIENTRYP PFNGLCLEARDEPTHDNVPROC) (GLdouble depth); +typedef void (APIENTRYP PFNGLDEPTHBOUNDSDNVPROC) (GLdouble zmin, GLdouble zmax); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDepthRangedNV (GLdouble zNear, GLdouble zFar); +GLAPI void APIENTRY glClearDepthdNV (GLdouble depth); +GLAPI void APIENTRY glDepthBoundsdNV (GLdouble zmin, GLdouble zmax); +#endif +#endif /* GL_NV_depth_buffer_float */ + +#ifndef GL_NV_depth_clamp +#define GL_NV_depth_clamp 1 +#define GL_DEPTH_CLAMP_NV 0x864F +#endif /* GL_NV_depth_clamp */ + +#ifndef GL_NV_draw_texture +#define GL_NV_draw_texture 1 +typedef void (APIENTRYP PFNGLDRAWTEXTURENVPROC) (GLuint texture, GLuint sampler, GLfloat x0, GLfloat y0, GLfloat x1, GLfloat y1, GLfloat z, GLfloat s0, GLfloat t0, GLfloat s1, GLfloat t1); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawTextureNV (GLuint texture, GLuint sampler, GLfloat x0, GLfloat y0, GLfloat x1, GLfloat y1, GLfloat z, GLfloat s0, GLfloat t0, GLfloat s1, GLfloat t1); +#endif +#endif /* GL_NV_draw_texture */ + +#ifndef GL_NV_evaluators +#define GL_NV_evaluators 1 +#define GL_EVAL_2D_NV 0x86C0 +#define GL_EVAL_TRIANGULAR_2D_NV 0x86C1 +#define GL_MAP_TESSELLATION_NV 0x86C2 +#define GL_MAP_ATTRIB_U_ORDER_NV 0x86C3 +#define GL_MAP_ATTRIB_V_ORDER_NV 0x86C4 +#define GL_EVAL_FRACTIONAL_TESSELLATION_NV 0x86C5 +#define GL_EVAL_VERTEX_ATTRIB0_NV 0x86C6 +#define GL_EVAL_VERTEX_ATTRIB1_NV 0x86C7 +#define GL_EVAL_VERTEX_ATTRIB2_NV 0x86C8 +#define GL_EVAL_VERTEX_ATTRIB3_NV 0x86C9 +#define GL_EVAL_VERTEX_ATTRIB4_NV 0x86CA +#define GL_EVAL_VERTEX_ATTRIB5_NV 0x86CB +#define GL_EVAL_VERTEX_ATTRIB6_NV 0x86CC +#define GL_EVAL_VERTEX_ATTRIB7_NV 0x86CD +#define GL_EVAL_VERTEX_ATTRIB8_NV 0x86CE +#define GL_EVAL_VERTEX_ATTRIB9_NV 0x86CF +#define GL_EVAL_VERTEX_ATTRIB10_NV 0x86D0 +#define GL_EVAL_VERTEX_ATTRIB11_NV 0x86D1 +#define GL_EVAL_VERTEX_ATTRIB12_NV 0x86D2 +#define GL_EVAL_VERTEX_ATTRIB13_NV 0x86D3 +#define GL_EVAL_VERTEX_ATTRIB14_NV 0x86D4 +#define GL_EVAL_VERTEX_ATTRIB15_NV 0x86D5 +#define GL_MAX_MAP_TESSELLATION_NV 0x86D6 +#define GL_MAX_RATIONAL_EVAL_ORDER_NV 0x86D7 +typedef void (APIENTRYP PFNGLMAPCONTROLPOINTSNVPROC) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLint uorder, GLint vorder, GLboolean packed, const void *points); +typedef void (APIENTRYP PFNGLMAPPARAMETERIVNVPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLMAPPARAMETERFVNVPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLGETMAPCONTROLPOINTSNVPROC) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLboolean packed, void *points); +typedef void (APIENTRYP PFNGLGETMAPPARAMETERIVNVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETMAPPARAMETERFVNVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETMAPATTRIBPARAMETERIVNVPROC) (GLenum target, GLuint index, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETMAPATTRIBPARAMETERFVNVPROC) (GLenum target, GLuint index, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLEVALMAPSNVPROC) (GLenum target, GLenum mode); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMapControlPointsNV (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLint uorder, GLint vorder, GLboolean packed, const void *points); +GLAPI void APIENTRY glMapParameterivNV (GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY glMapParameterfvNV (GLenum target, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glGetMapControlPointsNV (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLboolean packed, void *points); +GLAPI void APIENTRY glGetMapParameterivNV (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetMapParameterfvNV (GLenum target, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetMapAttribParameterivNV (GLenum target, GLuint index, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetMapAttribParameterfvNV (GLenum target, GLuint index, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glEvalMapsNV (GLenum target, GLenum mode); +#endif +#endif /* GL_NV_evaluators */ + +#ifndef GL_NV_explicit_multisample +#define GL_NV_explicit_multisample 1 +#define GL_SAMPLE_POSITION_NV 0x8E50 +#define GL_SAMPLE_MASK_NV 0x8E51 +#define GL_SAMPLE_MASK_VALUE_NV 0x8E52 +#define GL_TEXTURE_BINDING_RENDERBUFFER_NV 0x8E53 +#define GL_TEXTURE_RENDERBUFFER_DATA_STORE_BINDING_NV 0x8E54 +#define GL_TEXTURE_RENDERBUFFER_NV 0x8E55 +#define GL_SAMPLER_RENDERBUFFER_NV 0x8E56 +#define GL_INT_SAMPLER_RENDERBUFFER_NV 0x8E57 +#define GL_UNSIGNED_INT_SAMPLER_RENDERBUFFER_NV 0x8E58 +#define GL_MAX_SAMPLE_MASK_WORDS_NV 0x8E59 +typedef void (APIENTRYP PFNGLGETMULTISAMPLEFVNVPROC) (GLenum pname, GLuint index, GLfloat *val); +typedef void (APIENTRYP PFNGLSAMPLEMASKINDEXEDNVPROC) (GLuint index, GLbitfield mask); +typedef void (APIENTRYP PFNGLTEXRENDERBUFFERNVPROC) (GLenum target, GLuint renderbuffer); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetMultisamplefvNV (GLenum pname, GLuint index, GLfloat *val); +GLAPI void APIENTRY glSampleMaskIndexedNV (GLuint index, GLbitfield mask); +GLAPI void APIENTRY glTexRenderbufferNV (GLenum target, GLuint renderbuffer); +#endif +#endif /* GL_NV_explicit_multisample */ + +#ifndef GL_NV_fence +#define GL_NV_fence 1 +#define GL_ALL_COMPLETED_NV 0x84F2 +#define GL_FENCE_STATUS_NV 0x84F3 +#define GL_FENCE_CONDITION_NV 0x84F4 +typedef void (APIENTRYP PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint *fences); +typedef void (APIENTRYP PFNGLGENFENCESNVPROC) (GLsizei n, GLuint *fences); +typedef GLboolean (APIENTRYP PFNGLISFENCENVPROC) (GLuint fence); +typedef GLboolean (APIENTRYP PFNGLTESTFENCENVPROC) (GLuint fence); +typedef void (APIENTRYP PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLFINISHFENCENVPROC) (GLuint fence); +typedef void (APIENTRYP PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDeleteFencesNV (GLsizei n, const GLuint *fences); +GLAPI void APIENTRY glGenFencesNV (GLsizei n, GLuint *fences); +GLAPI GLboolean APIENTRY glIsFenceNV (GLuint fence); +GLAPI GLboolean APIENTRY glTestFenceNV (GLuint fence); +GLAPI void APIENTRY glGetFenceivNV (GLuint fence, GLenum pname, GLint *params); +GLAPI void APIENTRY glFinishFenceNV (GLuint fence); +GLAPI void APIENTRY glSetFenceNV (GLuint fence, GLenum condition); +#endif +#endif /* GL_NV_fence */ + +#ifndef GL_NV_float_buffer +#define GL_NV_float_buffer 1 +#define GL_FLOAT_R_NV 0x8880 +#define GL_FLOAT_RG_NV 0x8881 +#define GL_FLOAT_RGB_NV 0x8882 +#define GL_FLOAT_RGBA_NV 0x8883 +#define GL_FLOAT_R16_NV 0x8884 +#define GL_FLOAT_R32_NV 0x8885 +#define GL_FLOAT_RG16_NV 0x8886 +#define GL_FLOAT_RG32_NV 0x8887 +#define GL_FLOAT_RGB16_NV 0x8888 +#define GL_FLOAT_RGB32_NV 0x8889 +#define GL_FLOAT_RGBA16_NV 0x888A +#define GL_FLOAT_RGBA32_NV 0x888B +#define GL_TEXTURE_FLOAT_COMPONENTS_NV 0x888C +#define GL_FLOAT_CLEAR_COLOR_VALUE_NV 0x888D +#define GL_FLOAT_RGBA_MODE_NV 0x888E +#endif /* GL_NV_float_buffer */ + +#ifndef GL_NV_fog_distance +#define GL_NV_fog_distance 1 +#define GL_FOG_DISTANCE_MODE_NV 0x855A +#define GL_EYE_RADIAL_NV 0x855B +#define GL_EYE_PLANE_ABSOLUTE_NV 0x855C +#endif /* GL_NV_fog_distance */ + +#ifndef GL_NV_fragment_program +#define GL_NV_fragment_program 1 +#define GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV 0x8868 +#define GL_FRAGMENT_PROGRAM_NV 0x8870 +#define GL_MAX_TEXTURE_COORDS_NV 0x8871 +#define GL_MAX_TEXTURE_IMAGE_UNITS_NV 0x8872 +#define GL_FRAGMENT_PROGRAM_BINDING_NV 0x8873 +#define GL_PROGRAM_ERROR_STRING_NV 0x8874 +typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4FNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4FVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, const GLfloat *v); +typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4DNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4DVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, const GLdouble *v); +typedef void (APIENTRYP PFNGLGETPROGRAMNAMEDPARAMETERFVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLfloat *params); +typedef void (APIENTRYP PFNGLGETPROGRAMNAMEDPARAMETERDVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLdouble *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glProgramNamedParameter4fNV (GLuint id, GLsizei len, const GLubyte *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void APIENTRY glProgramNamedParameter4fvNV (GLuint id, GLsizei len, const GLubyte *name, const GLfloat *v); +GLAPI void APIENTRY glProgramNamedParameter4dNV (GLuint id, GLsizei len, const GLubyte *name, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY glProgramNamedParameter4dvNV (GLuint id, GLsizei len, const GLubyte *name, const GLdouble *v); +GLAPI void APIENTRY glGetProgramNamedParameterfvNV (GLuint id, GLsizei len, const GLubyte *name, GLfloat *params); +GLAPI void APIENTRY glGetProgramNamedParameterdvNV (GLuint id, GLsizei len, const GLubyte *name, GLdouble *params); +#endif +#endif /* GL_NV_fragment_program */ + +#ifndef GL_NV_fragment_program2 +#define GL_NV_fragment_program2 1 +#define GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV 0x88F4 +#define GL_MAX_PROGRAM_CALL_DEPTH_NV 0x88F5 +#define GL_MAX_PROGRAM_IF_DEPTH_NV 0x88F6 +#define GL_MAX_PROGRAM_LOOP_DEPTH_NV 0x88F7 +#define GL_MAX_PROGRAM_LOOP_COUNT_NV 0x88F8 +#endif /* GL_NV_fragment_program2 */ + +#ifndef GL_NV_fragment_program4 +#define GL_NV_fragment_program4 1 +#endif /* GL_NV_fragment_program4 */ + +#ifndef GL_NV_fragment_program_option +#define GL_NV_fragment_program_option 1 +#endif /* GL_NV_fragment_program_option */ + +#ifndef GL_NV_framebuffer_multisample_coverage +#define GL_NV_framebuffer_multisample_coverage 1 +#define GL_RENDERBUFFER_COVERAGE_SAMPLES_NV 0x8CAB +#define GL_RENDERBUFFER_COLOR_SAMPLES_NV 0x8E10 +#define GL_MAX_MULTISAMPLE_COVERAGE_MODES_NV 0x8E11 +#define GL_MULTISAMPLE_COVERAGE_MODES_NV 0x8E12 +typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLECOVERAGENVPROC) (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glRenderbufferStorageMultisampleCoverageNV (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height); +#endif +#endif /* GL_NV_framebuffer_multisample_coverage */ + +#ifndef GL_NV_geometry_program4 +#define GL_NV_geometry_program4 1 +#define GL_GEOMETRY_PROGRAM_NV 0x8C26 +#define GL_MAX_PROGRAM_OUTPUT_VERTICES_NV 0x8C27 +#define GL_MAX_PROGRAM_TOTAL_OUTPUT_COMPONENTS_NV 0x8C28 +typedef void (APIENTRYP PFNGLPROGRAMVERTEXLIMITNVPROC) (GLenum target, GLint limit); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYEREXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREFACEEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glProgramVertexLimitNV (GLenum target, GLint limit); +GLAPI void APIENTRY glFramebufferTextureEXT (GLenum target, GLenum attachment, GLuint texture, GLint level); +GLAPI void APIENTRY glFramebufferTextureLayerEXT (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); +GLAPI void APIENTRY glFramebufferTextureFaceEXT (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face); +#endif +#endif /* GL_NV_geometry_program4 */ + +#ifndef GL_NV_geometry_shader4 +#define GL_NV_geometry_shader4 1 +#endif /* GL_NV_geometry_shader4 */ + +#ifndef GL_NV_gpu_program4 +#define GL_NV_gpu_program4 1 +#define GL_MIN_PROGRAM_TEXEL_OFFSET_NV 0x8904 +#define GL_MAX_PROGRAM_TEXEL_OFFSET_NV 0x8905 +#define GL_PROGRAM_ATTRIB_COMPONENTS_NV 0x8906 +#define GL_PROGRAM_RESULT_COMPONENTS_NV 0x8907 +#define GL_MAX_PROGRAM_ATTRIB_COMPONENTS_NV 0x8908 +#define GL_MAX_PROGRAM_RESULT_COMPONENTS_NV 0x8909 +#define GL_MAX_PROGRAM_GENERIC_ATTRIBS_NV 0x8DA5 +#define GL_MAX_PROGRAM_GENERIC_RESULTS_NV 0x8DA6 +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERI4INVPROC) (GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERI4IVNVPROC) (GLenum target, GLuint index, const GLint *params); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERSI4IVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLint *params); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERI4UINVPROC) (GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERI4UIVNVPROC) (GLenum target, GLuint index, const GLuint *params); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERSI4UIVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLuint *params); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERI4INVPROC) (GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERI4IVNVPROC) (GLenum target, GLuint index, const GLint *params); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERSI4IVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLint *params); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERI4UINVPROC) (GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERI4UIVNVPROC) (GLenum target, GLuint index, const GLuint *params); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERSI4UIVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLuint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERIIVNVPROC) (GLenum target, GLuint index, GLint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERIUIVNVPROC) (GLenum target, GLuint index, GLuint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERIIVNVPROC) (GLenum target, GLuint index, GLint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERIUIVNVPROC) (GLenum target, GLuint index, GLuint *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glProgramLocalParameterI4iNV (GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w); +GLAPI void APIENTRY glProgramLocalParameterI4ivNV (GLenum target, GLuint index, const GLint *params); +GLAPI void APIENTRY glProgramLocalParametersI4ivNV (GLenum target, GLuint index, GLsizei count, const GLint *params); +GLAPI void APIENTRY glProgramLocalParameterI4uiNV (GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +GLAPI void APIENTRY glProgramLocalParameterI4uivNV (GLenum target, GLuint index, const GLuint *params); +GLAPI void APIENTRY glProgramLocalParametersI4uivNV (GLenum target, GLuint index, GLsizei count, const GLuint *params); +GLAPI void APIENTRY glProgramEnvParameterI4iNV (GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w); +GLAPI void APIENTRY glProgramEnvParameterI4ivNV (GLenum target, GLuint index, const GLint *params); +GLAPI void APIENTRY glProgramEnvParametersI4ivNV (GLenum target, GLuint index, GLsizei count, const GLint *params); +GLAPI void APIENTRY glProgramEnvParameterI4uiNV (GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +GLAPI void APIENTRY glProgramEnvParameterI4uivNV (GLenum target, GLuint index, const GLuint *params); +GLAPI void APIENTRY glProgramEnvParametersI4uivNV (GLenum target, GLuint index, GLsizei count, const GLuint *params); +GLAPI void APIENTRY glGetProgramLocalParameterIivNV (GLenum target, GLuint index, GLint *params); +GLAPI void APIENTRY glGetProgramLocalParameterIuivNV (GLenum target, GLuint index, GLuint *params); +GLAPI void APIENTRY glGetProgramEnvParameterIivNV (GLenum target, GLuint index, GLint *params); +GLAPI void APIENTRY glGetProgramEnvParameterIuivNV (GLenum target, GLuint index, GLuint *params); +#endif +#endif /* GL_NV_gpu_program4 */ + +#ifndef GL_NV_gpu_program5 +#define GL_NV_gpu_program5 1 +#define GL_MAX_GEOMETRY_PROGRAM_INVOCATIONS_NV 0x8E5A +#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET_NV 0x8E5B +#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET_NV 0x8E5C +#define GL_FRAGMENT_PROGRAM_INTERPOLATION_OFFSET_BITS_NV 0x8E5D +#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET_NV 0x8E5E +#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET_NV 0x8E5F +#define GL_MAX_PROGRAM_SUBROUTINE_PARAMETERS_NV 0x8F44 +#define GL_MAX_PROGRAM_SUBROUTINE_NUM_NV 0x8F45 +typedef void (APIENTRYP PFNGLPROGRAMSUBROUTINEPARAMETERSUIVNVPROC) (GLenum target, GLsizei count, const GLuint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMSUBROUTINEPARAMETERUIVNVPROC) (GLenum target, GLuint index, GLuint *param); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glProgramSubroutineParametersuivNV (GLenum target, GLsizei count, const GLuint *params); +GLAPI void APIENTRY glGetProgramSubroutineParameteruivNV (GLenum target, GLuint index, GLuint *param); +#endif +#endif /* GL_NV_gpu_program5 */ + +#ifndef GL_NV_gpu_program5_mem_extended +#define GL_NV_gpu_program5_mem_extended 1 +#endif /* GL_NV_gpu_program5_mem_extended */ + +#ifndef GL_NV_gpu_shader5 +#define GL_NV_gpu_shader5 1 +#endif /* GL_NV_gpu_shader5 */ + +#ifndef GL_NV_half_float +#define GL_NV_half_float 1 +typedef unsigned short GLhalfNV; +#define GL_HALF_FLOAT_NV 0x140B +typedef void (APIENTRYP PFNGLVERTEX2HNVPROC) (GLhalfNV x, GLhalfNV y); +typedef void (APIENTRYP PFNGLVERTEX2HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEX3HNVPROC) (GLhalfNV x, GLhalfNV y, GLhalfNV z); +typedef void (APIENTRYP PFNGLVERTEX3HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEX4HNVPROC) (GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w); +typedef void (APIENTRYP PFNGLVERTEX4HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLNORMAL3HNVPROC) (GLhalfNV nx, GLhalfNV ny, GLhalfNV nz); +typedef void (APIENTRYP PFNGLNORMAL3HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLCOLOR3HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue); +typedef void (APIENTRYP PFNGLCOLOR3HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLCOLOR4HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue, GLhalfNV alpha); +typedef void (APIENTRYP PFNGLCOLOR4HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLTEXCOORD1HNVPROC) (GLhalfNV s); +typedef void (APIENTRYP PFNGLTEXCOORD1HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLTEXCOORD2HNVPROC) (GLhalfNV s, GLhalfNV t); +typedef void (APIENTRYP PFNGLTEXCOORD2HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLTEXCOORD3HNVPROC) (GLhalfNV s, GLhalfNV t, GLhalfNV r); +typedef void (APIENTRYP PFNGLTEXCOORD3HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLTEXCOORD4HNVPROC) (GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q); +typedef void (APIENTRYP PFNGLTEXCOORD4HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1HNVPROC) (GLenum target, GLhalfNV s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1HVNVPROC) (GLenum target, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2HVNVPROC) (GLenum target, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3HVNVPROC) (GLenum target, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4HVNVPROC) (GLenum target, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLFOGCOORDHNVPROC) (GLhalfNV fog); +typedef void (APIENTRYP PFNGLFOGCOORDHVNVPROC) (const GLhalfNV *fog); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXWEIGHTHNVPROC) (GLhalfNV weight); +typedef void (APIENTRYP PFNGLVERTEXWEIGHTHVNVPROC) (const GLhalfNV *weight); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1HNVPROC) (GLuint index, GLhalfNV x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1HVNVPROC) (GLuint index, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2HVNVPROC) (GLuint index, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3HVNVPROC) (GLuint index, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4HVNVPROC) (GLuint index, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS1HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS2HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS3HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS4HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertex2hNV (GLhalfNV x, GLhalfNV y); +GLAPI void APIENTRY glVertex2hvNV (const GLhalfNV *v); +GLAPI void APIENTRY glVertex3hNV (GLhalfNV x, GLhalfNV y, GLhalfNV z); +GLAPI void APIENTRY glVertex3hvNV (const GLhalfNV *v); +GLAPI void APIENTRY glVertex4hNV (GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w); +GLAPI void APIENTRY glVertex4hvNV (const GLhalfNV *v); +GLAPI void APIENTRY glNormal3hNV (GLhalfNV nx, GLhalfNV ny, GLhalfNV nz); +GLAPI void APIENTRY glNormal3hvNV (const GLhalfNV *v); +GLAPI void APIENTRY glColor3hNV (GLhalfNV red, GLhalfNV green, GLhalfNV blue); +GLAPI void APIENTRY glColor3hvNV (const GLhalfNV *v); +GLAPI void APIENTRY glColor4hNV (GLhalfNV red, GLhalfNV green, GLhalfNV blue, GLhalfNV alpha); +GLAPI void APIENTRY glColor4hvNV (const GLhalfNV *v); +GLAPI void APIENTRY glTexCoord1hNV (GLhalfNV s); +GLAPI void APIENTRY glTexCoord1hvNV (const GLhalfNV *v); +GLAPI void APIENTRY glTexCoord2hNV (GLhalfNV s, GLhalfNV t); +GLAPI void APIENTRY glTexCoord2hvNV (const GLhalfNV *v); +GLAPI void APIENTRY glTexCoord3hNV (GLhalfNV s, GLhalfNV t, GLhalfNV r); +GLAPI void APIENTRY glTexCoord3hvNV (const GLhalfNV *v); +GLAPI void APIENTRY glTexCoord4hNV (GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q); +GLAPI void APIENTRY glTexCoord4hvNV (const GLhalfNV *v); +GLAPI void APIENTRY glMultiTexCoord1hNV (GLenum target, GLhalfNV s); +GLAPI void APIENTRY glMultiTexCoord1hvNV (GLenum target, const GLhalfNV *v); +GLAPI void APIENTRY glMultiTexCoord2hNV (GLenum target, GLhalfNV s, GLhalfNV t); +GLAPI void APIENTRY glMultiTexCoord2hvNV (GLenum target, const GLhalfNV *v); +GLAPI void APIENTRY glMultiTexCoord3hNV (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r); +GLAPI void APIENTRY glMultiTexCoord3hvNV (GLenum target, const GLhalfNV *v); +GLAPI void APIENTRY glMultiTexCoord4hNV (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q); +GLAPI void APIENTRY glMultiTexCoord4hvNV (GLenum target, const GLhalfNV *v); +GLAPI void APIENTRY glFogCoordhNV (GLhalfNV fog); +GLAPI void APIENTRY glFogCoordhvNV (const GLhalfNV *fog); +GLAPI void APIENTRY glSecondaryColor3hNV (GLhalfNV red, GLhalfNV green, GLhalfNV blue); +GLAPI void APIENTRY glSecondaryColor3hvNV (const GLhalfNV *v); +GLAPI void APIENTRY glVertexWeighthNV (GLhalfNV weight); +GLAPI void APIENTRY glVertexWeighthvNV (const GLhalfNV *weight); +GLAPI void APIENTRY glVertexAttrib1hNV (GLuint index, GLhalfNV x); +GLAPI void APIENTRY glVertexAttrib1hvNV (GLuint index, const GLhalfNV *v); +GLAPI void APIENTRY glVertexAttrib2hNV (GLuint index, GLhalfNV x, GLhalfNV y); +GLAPI void APIENTRY glVertexAttrib2hvNV (GLuint index, const GLhalfNV *v); +GLAPI void APIENTRY glVertexAttrib3hNV (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z); +GLAPI void APIENTRY glVertexAttrib3hvNV (GLuint index, const GLhalfNV *v); +GLAPI void APIENTRY glVertexAttrib4hNV (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w); +GLAPI void APIENTRY glVertexAttrib4hvNV (GLuint index, const GLhalfNV *v); +GLAPI void APIENTRY glVertexAttribs1hvNV (GLuint index, GLsizei n, const GLhalfNV *v); +GLAPI void APIENTRY glVertexAttribs2hvNV (GLuint index, GLsizei n, const GLhalfNV *v); +GLAPI void APIENTRY glVertexAttribs3hvNV (GLuint index, GLsizei n, const GLhalfNV *v); +GLAPI void APIENTRY glVertexAttribs4hvNV (GLuint index, GLsizei n, const GLhalfNV *v); +#endif +#endif /* GL_NV_half_float */ + +#ifndef GL_NV_light_max_exponent +#define GL_NV_light_max_exponent 1 +#define GL_MAX_SHININESS_NV 0x8504 +#define GL_MAX_SPOT_EXPONENT_NV 0x8505 +#endif /* GL_NV_light_max_exponent */ + +#ifndef GL_NV_multisample_coverage +#define GL_NV_multisample_coverage 1 +#define GL_COLOR_SAMPLES_NV 0x8E20 +#endif /* GL_NV_multisample_coverage */ + +#ifndef GL_NV_multisample_filter_hint +#define GL_NV_multisample_filter_hint 1 +#define GL_MULTISAMPLE_FILTER_HINT_NV 0x8534 +#endif /* GL_NV_multisample_filter_hint */ + +#ifndef GL_NV_occlusion_query +#define GL_NV_occlusion_query 1 +#define GL_PIXEL_COUNTER_BITS_NV 0x8864 +#define GL_CURRENT_OCCLUSION_QUERY_ID_NV 0x8865 +#define GL_PIXEL_COUNT_NV 0x8866 +#define GL_PIXEL_COUNT_AVAILABLE_NV 0x8867 +typedef void (APIENTRYP PFNGLGENOCCLUSIONQUERIESNVPROC) (GLsizei n, GLuint *ids); +typedef void (APIENTRYP PFNGLDELETEOCCLUSIONQUERIESNVPROC) (GLsizei n, const GLuint *ids); +typedef GLboolean (APIENTRYP PFNGLISOCCLUSIONQUERYNVPROC) (GLuint id); +typedef void (APIENTRYP PFNGLBEGINOCCLUSIONQUERYNVPROC) (GLuint id); +typedef void (APIENTRYP PFNGLENDOCCLUSIONQUERYNVPROC) (void); +typedef void (APIENTRYP PFNGLGETOCCLUSIONQUERYIVNVPROC) (GLuint id, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETOCCLUSIONQUERYUIVNVPROC) (GLuint id, GLenum pname, GLuint *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGenOcclusionQueriesNV (GLsizei n, GLuint *ids); +GLAPI void APIENTRY glDeleteOcclusionQueriesNV (GLsizei n, const GLuint *ids); +GLAPI GLboolean APIENTRY glIsOcclusionQueryNV (GLuint id); +GLAPI void APIENTRY glBeginOcclusionQueryNV (GLuint id); +GLAPI void APIENTRY glEndOcclusionQueryNV (void); +GLAPI void APIENTRY glGetOcclusionQueryivNV (GLuint id, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetOcclusionQueryuivNV (GLuint id, GLenum pname, GLuint *params); +#endif +#endif /* GL_NV_occlusion_query */ + +#ifndef GL_NV_packed_depth_stencil +#define GL_NV_packed_depth_stencil 1 +#define GL_DEPTH_STENCIL_NV 0x84F9 +#define GL_UNSIGNED_INT_24_8_NV 0x84FA +#endif /* GL_NV_packed_depth_stencil */ + +#ifndef GL_NV_parameter_buffer_object +#define GL_NV_parameter_buffer_object 1 +#define GL_MAX_PROGRAM_PARAMETER_BUFFER_BINDINGS_NV 0x8DA0 +#define GL_MAX_PROGRAM_PARAMETER_BUFFER_SIZE_NV 0x8DA1 +#define GL_VERTEX_PROGRAM_PARAMETER_BUFFER_NV 0x8DA2 +#define GL_GEOMETRY_PROGRAM_PARAMETER_BUFFER_NV 0x8DA3 +#define GL_FRAGMENT_PROGRAM_PARAMETER_BUFFER_NV 0x8DA4 +typedef void (APIENTRYP PFNGLPROGRAMBUFFERPARAMETERSFVNVPROC) (GLenum target, GLuint bindingIndex, GLuint wordIndex, GLsizei count, const GLfloat *params); +typedef void (APIENTRYP PFNGLPROGRAMBUFFERPARAMETERSIIVNVPROC) (GLenum target, GLuint bindingIndex, GLuint wordIndex, GLsizei count, const GLint *params); +typedef void (APIENTRYP PFNGLPROGRAMBUFFERPARAMETERSIUIVNVPROC) (GLenum target, GLuint bindingIndex, GLuint wordIndex, GLsizei count, const GLuint *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glProgramBufferParametersfvNV (GLenum target, GLuint bindingIndex, GLuint wordIndex, GLsizei count, const GLfloat *params); +GLAPI void APIENTRY glProgramBufferParametersIivNV (GLenum target, GLuint bindingIndex, GLuint wordIndex, GLsizei count, const GLint *params); +GLAPI void APIENTRY glProgramBufferParametersIuivNV (GLenum target, GLuint bindingIndex, GLuint wordIndex, GLsizei count, const GLuint *params); +#endif +#endif /* GL_NV_parameter_buffer_object */ + +#ifndef GL_NV_parameter_buffer_object2 +#define GL_NV_parameter_buffer_object2 1 +#endif /* GL_NV_parameter_buffer_object2 */ + +#ifndef GL_NV_path_rendering +#define GL_NV_path_rendering 1 +#define GL_PATH_FORMAT_SVG_NV 0x9070 +#define GL_PATH_FORMAT_PS_NV 0x9071 +#define GL_STANDARD_FONT_NAME_NV 0x9072 +#define GL_SYSTEM_FONT_NAME_NV 0x9073 +#define GL_FILE_NAME_NV 0x9074 +#define GL_PATH_STROKE_WIDTH_NV 0x9075 +#define GL_PATH_END_CAPS_NV 0x9076 +#define GL_PATH_INITIAL_END_CAP_NV 0x9077 +#define GL_PATH_TERMINAL_END_CAP_NV 0x9078 +#define GL_PATH_JOIN_STYLE_NV 0x9079 +#define GL_PATH_MITER_LIMIT_NV 0x907A +#define GL_PATH_DASH_CAPS_NV 0x907B +#define GL_PATH_INITIAL_DASH_CAP_NV 0x907C +#define GL_PATH_TERMINAL_DASH_CAP_NV 0x907D +#define GL_PATH_DASH_OFFSET_NV 0x907E +#define GL_PATH_CLIENT_LENGTH_NV 0x907F +#define GL_PATH_FILL_MODE_NV 0x9080 +#define GL_PATH_FILL_MASK_NV 0x9081 +#define GL_PATH_FILL_COVER_MODE_NV 0x9082 +#define GL_PATH_STROKE_COVER_MODE_NV 0x9083 +#define GL_PATH_STROKE_MASK_NV 0x9084 +#define GL_COUNT_UP_NV 0x9088 +#define GL_COUNT_DOWN_NV 0x9089 +#define GL_PATH_OBJECT_BOUNDING_BOX_NV 0x908A +#define GL_CONVEX_HULL_NV 0x908B +#define GL_BOUNDING_BOX_NV 0x908D +#define GL_TRANSLATE_X_NV 0x908E +#define GL_TRANSLATE_Y_NV 0x908F +#define GL_TRANSLATE_2D_NV 0x9090 +#define GL_TRANSLATE_3D_NV 0x9091 +#define GL_AFFINE_2D_NV 0x9092 +#define GL_AFFINE_3D_NV 0x9094 +#define GL_TRANSPOSE_AFFINE_2D_NV 0x9096 +#define GL_TRANSPOSE_AFFINE_3D_NV 0x9098 +#define GL_UTF8_NV 0x909A +#define GL_UTF16_NV 0x909B +#define GL_BOUNDING_BOX_OF_BOUNDING_BOXES_NV 0x909C +#define GL_PATH_COMMAND_COUNT_NV 0x909D +#define GL_PATH_COORD_COUNT_NV 0x909E +#define GL_PATH_DASH_ARRAY_COUNT_NV 0x909F +#define GL_PATH_COMPUTED_LENGTH_NV 0x90A0 +#define GL_PATH_FILL_BOUNDING_BOX_NV 0x90A1 +#define GL_PATH_STROKE_BOUNDING_BOX_NV 0x90A2 +#define GL_SQUARE_NV 0x90A3 +#define GL_ROUND_NV 0x90A4 +#define GL_TRIANGULAR_NV 0x90A5 +#define GL_BEVEL_NV 0x90A6 +#define GL_MITER_REVERT_NV 0x90A7 +#define GL_MITER_TRUNCATE_NV 0x90A8 +#define GL_SKIP_MISSING_GLYPH_NV 0x90A9 +#define GL_USE_MISSING_GLYPH_NV 0x90AA +#define GL_PATH_ERROR_POSITION_NV 0x90AB +#define GL_PATH_FOG_GEN_MODE_NV 0x90AC +#define GL_ACCUM_ADJACENT_PAIRS_NV 0x90AD +#define GL_ADJACENT_PAIRS_NV 0x90AE +#define GL_FIRST_TO_REST_NV 0x90AF +#define GL_PATH_GEN_MODE_NV 0x90B0 +#define GL_PATH_GEN_COEFF_NV 0x90B1 +#define GL_PATH_GEN_COLOR_FORMAT_NV 0x90B2 +#define GL_PATH_GEN_COMPONENTS_NV 0x90B3 +#define GL_PATH_STENCIL_FUNC_NV 0x90B7 +#define GL_PATH_STENCIL_REF_NV 0x90B8 +#define GL_PATH_STENCIL_VALUE_MASK_NV 0x90B9 +#define GL_PATH_STENCIL_DEPTH_OFFSET_FACTOR_NV 0x90BD +#define GL_PATH_STENCIL_DEPTH_OFFSET_UNITS_NV 0x90BE +#define GL_PATH_COVER_DEPTH_FUNC_NV 0x90BF +#define GL_PATH_DASH_OFFSET_RESET_NV 0x90B4 +#define GL_MOVE_TO_RESETS_NV 0x90B5 +#define GL_MOVE_TO_CONTINUES_NV 0x90B6 +#define GL_CLOSE_PATH_NV 0x00 +#define GL_MOVE_TO_NV 0x02 +#define GL_RELATIVE_MOVE_TO_NV 0x03 +#define GL_LINE_TO_NV 0x04 +#define GL_RELATIVE_LINE_TO_NV 0x05 +#define GL_HORIZONTAL_LINE_TO_NV 0x06 +#define GL_RELATIVE_HORIZONTAL_LINE_TO_NV 0x07 +#define GL_VERTICAL_LINE_TO_NV 0x08 +#define GL_RELATIVE_VERTICAL_LINE_TO_NV 0x09 +#define GL_QUADRATIC_CURVE_TO_NV 0x0A +#define GL_RELATIVE_QUADRATIC_CURVE_TO_NV 0x0B +#define GL_CUBIC_CURVE_TO_NV 0x0C +#define GL_RELATIVE_CUBIC_CURVE_TO_NV 0x0D +#define GL_SMOOTH_QUADRATIC_CURVE_TO_NV 0x0E +#define GL_RELATIVE_SMOOTH_QUADRATIC_CURVE_TO_NV 0x0F +#define GL_SMOOTH_CUBIC_CURVE_TO_NV 0x10 +#define GL_RELATIVE_SMOOTH_CUBIC_CURVE_TO_NV 0x11 +#define GL_SMALL_CCW_ARC_TO_NV 0x12 +#define GL_RELATIVE_SMALL_CCW_ARC_TO_NV 0x13 +#define GL_SMALL_CW_ARC_TO_NV 0x14 +#define GL_RELATIVE_SMALL_CW_ARC_TO_NV 0x15 +#define GL_LARGE_CCW_ARC_TO_NV 0x16 +#define GL_RELATIVE_LARGE_CCW_ARC_TO_NV 0x17 +#define GL_LARGE_CW_ARC_TO_NV 0x18 +#define GL_RELATIVE_LARGE_CW_ARC_TO_NV 0x19 +#define GL_RESTART_PATH_NV 0xF0 +#define GL_DUP_FIRST_CUBIC_CURVE_TO_NV 0xF2 +#define GL_DUP_LAST_CUBIC_CURVE_TO_NV 0xF4 +#define GL_RECT_NV 0xF6 +#define GL_CIRCULAR_CCW_ARC_TO_NV 0xF8 +#define GL_CIRCULAR_CW_ARC_TO_NV 0xFA +#define GL_CIRCULAR_TANGENT_ARC_TO_NV 0xFC +#define GL_ARC_TO_NV 0xFE +#define GL_RELATIVE_ARC_TO_NV 0xFF +#define GL_BOLD_BIT_NV 0x01 +#define GL_ITALIC_BIT_NV 0x02 +#define GL_GLYPH_WIDTH_BIT_NV 0x01 +#define GL_GLYPH_HEIGHT_BIT_NV 0x02 +#define GL_GLYPH_HORIZONTAL_BEARING_X_BIT_NV 0x04 +#define GL_GLYPH_HORIZONTAL_BEARING_Y_BIT_NV 0x08 +#define GL_GLYPH_HORIZONTAL_BEARING_ADVANCE_BIT_NV 0x10 +#define GL_GLYPH_VERTICAL_BEARING_X_BIT_NV 0x20 +#define GL_GLYPH_VERTICAL_BEARING_Y_BIT_NV 0x40 +#define GL_GLYPH_VERTICAL_BEARING_ADVANCE_BIT_NV 0x80 +#define GL_GLYPH_HAS_KERNING_BIT_NV 0x100 +#define GL_FONT_X_MIN_BOUNDS_BIT_NV 0x00010000 +#define GL_FONT_Y_MIN_BOUNDS_BIT_NV 0x00020000 +#define GL_FONT_X_MAX_BOUNDS_BIT_NV 0x00040000 +#define GL_FONT_Y_MAX_BOUNDS_BIT_NV 0x00080000 +#define GL_FONT_UNITS_PER_EM_BIT_NV 0x00100000 +#define GL_FONT_ASCENDER_BIT_NV 0x00200000 +#define GL_FONT_DESCENDER_BIT_NV 0x00400000 +#define GL_FONT_HEIGHT_BIT_NV 0x00800000 +#define GL_FONT_MAX_ADVANCE_WIDTH_BIT_NV 0x01000000 +#define GL_FONT_MAX_ADVANCE_HEIGHT_BIT_NV 0x02000000 +#define GL_FONT_UNDERLINE_POSITION_BIT_NV 0x04000000 +#define GL_FONT_UNDERLINE_THICKNESS_BIT_NV 0x08000000 +#define GL_FONT_HAS_KERNING_BIT_NV 0x10000000 +#define GL_PRIMARY_COLOR_NV 0x852C +#define GL_SECONDARY_COLOR_NV 0x852D +typedef GLuint (APIENTRYP PFNGLGENPATHSNVPROC) (GLsizei range); +typedef void (APIENTRYP PFNGLDELETEPATHSNVPROC) (GLuint path, GLsizei range); +typedef GLboolean (APIENTRYP PFNGLISPATHNVPROC) (GLuint path); +typedef void (APIENTRYP PFNGLPATHCOMMANDSNVPROC) (GLuint path, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const void *coords); +typedef void (APIENTRYP PFNGLPATHCOORDSNVPROC) (GLuint path, GLsizei numCoords, GLenum coordType, const void *coords); +typedef void (APIENTRYP PFNGLPATHSUBCOMMANDSNVPROC) (GLuint path, GLsizei commandStart, GLsizei commandsToDelete, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const void *coords); +typedef void (APIENTRYP PFNGLPATHSUBCOORDSNVPROC) (GLuint path, GLsizei coordStart, GLsizei numCoords, GLenum coordType, const void *coords); +typedef void (APIENTRYP PFNGLPATHSTRINGNVPROC) (GLuint path, GLenum format, GLsizei length, const void *pathString); +typedef void (APIENTRYP PFNGLPATHGLYPHSNVPROC) (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLsizei numGlyphs, GLenum type, const void *charcodes, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +typedef void (APIENTRYP PFNGLPATHGLYPHRANGENVPROC) (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyph, GLsizei numGlyphs, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +typedef void (APIENTRYP PFNGLWEIGHTPATHSNVPROC) (GLuint resultPath, GLsizei numPaths, const GLuint *paths, const GLfloat *weights); +typedef void (APIENTRYP PFNGLCOPYPATHNVPROC) (GLuint resultPath, GLuint srcPath); +typedef void (APIENTRYP PFNGLINTERPOLATEPATHSNVPROC) (GLuint resultPath, GLuint pathA, GLuint pathB, GLfloat weight); +typedef void (APIENTRYP PFNGLTRANSFORMPATHNVPROC) (GLuint resultPath, GLuint srcPath, GLenum transformType, const GLfloat *transformValues); +typedef void (APIENTRYP PFNGLPATHPARAMETERIVNVPROC) (GLuint path, GLenum pname, const GLint *value); +typedef void (APIENTRYP PFNGLPATHPARAMETERINVPROC) (GLuint path, GLenum pname, GLint value); +typedef void (APIENTRYP PFNGLPATHPARAMETERFVNVPROC) (GLuint path, GLenum pname, const GLfloat *value); +typedef void (APIENTRYP PFNGLPATHPARAMETERFNVPROC) (GLuint path, GLenum pname, GLfloat value); +typedef void (APIENTRYP PFNGLPATHDASHARRAYNVPROC) (GLuint path, GLsizei dashCount, const GLfloat *dashArray); +typedef void (APIENTRYP PFNGLPATHSTENCILFUNCNVPROC) (GLenum func, GLint ref, GLuint mask); +typedef void (APIENTRYP PFNGLPATHSTENCILDEPTHOFFSETNVPROC) (GLfloat factor, GLfloat units); +typedef void (APIENTRYP PFNGLSTENCILFILLPATHNVPROC) (GLuint path, GLenum fillMode, GLuint mask); +typedef void (APIENTRYP PFNGLSTENCILSTROKEPATHNVPROC) (GLuint path, GLint reference, GLuint mask); +typedef void (APIENTRYP PFNGLSTENCILFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum transformType, const GLfloat *transformValues); +typedef void (APIENTRYP PFNGLSTENCILSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum transformType, const GLfloat *transformValues); +typedef void (APIENTRYP PFNGLPATHCOVERDEPTHFUNCNVPROC) (GLenum func); +typedef void (APIENTRYP PFNGLPATHCOLORGENNVPROC) (GLenum color, GLenum genMode, GLenum colorFormat, const GLfloat *coeffs); +typedef void (APIENTRYP PFNGLPATHTEXGENNVPROC) (GLenum texCoordSet, GLenum genMode, GLint components, const GLfloat *coeffs); +typedef void (APIENTRYP PFNGLPATHFOGGENNVPROC) (GLenum genMode); +typedef void (APIENTRYP PFNGLCOVERFILLPATHNVPROC) (GLuint path, GLenum coverMode); +typedef void (APIENTRYP PFNGLCOVERSTROKEPATHNVPROC) (GLuint path, GLenum coverMode); +typedef void (APIENTRYP PFNGLCOVERFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +typedef void (APIENTRYP PFNGLCOVERSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +typedef void (APIENTRYP PFNGLGETPATHPARAMETERIVNVPROC) (GLuint path, GLenum pname, GLint *value); +typedef void (APIENTRYP PFNGLGETPATHPARAMETERFVNVPROC) (GLuint path, GLenum pname, GLfloat *value); +typedef void (APIENTRYP PFNGLGETPATHCOMMANDSNVPROC) (GLuint path, GLubyte *commands); +typedef void (APIENTRYP PFNGLGETPATHCOORDSNVPROC) (GLuint path, GLfloat *coords); +typedef void (APIENTRYP PFNGLGETPATHDASHARRAYNVPROC) (GLuint path, GLfloat *dashArray); +typedef void (APIENTRYP PFNGLGETPATHMETRICSNVPROC) (GLbitfield metricQueryMask, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLsizei stride, GLfloat *metrics); +typedef void (APIENTRYP PFNGLGETPATHMETRICRANGENVPROC) (GLbitfield metricQueryMask, GLuint firstPathName, GLsizei numPaths, GLsizei stride, GLfloat *metrics); +typedef void (APIENTRYP PFNGLGETPATHSPACINGNVPROC) (GLenum pathListMode, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLfloat advanceScale, GLfloat kerningScale, GLenum transformType, GLfloat *returnedSpacing); +typedef void (APIENTRYP PFNGLGETPATHCOLORGENIVNVPROC) (GLenum color, GLenum pname, GLint *value); +typedef void (APIENTRYP PFNGLGETPATHCOLORGENFVNVPROC) (GLenum color, GLenum pname, GLfloat *value); +typedef void (APIENTRYP PFNGLGETPATHTEXGENIVNVPROC) (GLenum texCoordSet, GLenum pname, GLint *value); +typedef void (APIENTRYP PFNGLGETPATHTEXGENFVNVPROC) (GLenum texCoordSet, GLenum pname, GLfloat *value); +typedef GLboolean (APIENTRYP PFNGLISPOINTINFILLPATHNVPROC) (GLuint path, GLuint mask, GLfloat x, GLfloat y); +typedef GLboolean (APIENTRYP PFNGLISPOINTINSTROKEPATHNVPROC) (GLuint path, GLfloat x, GLfloat y); +typedef GLfloat (APIENTRYP PFNGLGETPATHLENGTHNVPROC) (GLuint path, GLsizei startSegment, GLsizei numSegments); +typedef GLboolean (APIENTRYP PFNGLPOINTALONGPATHNVPROC) (GLuint path, GLsizei startSegment, GLsizei numSegments, GLfloat distance, GLfloat *x, GLfloat *y, GLfloat *tangentX, GLfloat *tangentY); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLuint APIENTRY glGenPathsNV (GLsizei range); +GLAPI void APIENTRY glDeletePathsNV (GLuint path, GLsizei range); +GLAPI GLboolean APIENTRY glIsPathNV (GLuint path); +GLAPI void APIENTRY glPathCommandsNV (GLuint path, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const void *coords); +GLAPI void APIENTRY glPathCoordsNV (GLuint path, GLsizei numCoords, GLenum coordType, const void *coords); +GLAPI void APIENTRY glPathSubCommandsNV (GLuint path, GLsizei commandStart, GLsizei commandsToDelete, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const void *coords); +GLAPI void APIENTRY glPathSubCoordsNV (GLuint path, GLsizei coordStart, GLsizei numCoords, GLenum coordType, const void *coords); +GLAPI void APIENTRY glPathStringNV (GLuint path, GLenum format, GLsizei length, const void *pathString); +GLAPI void APIENTRY glPathGlyphsNV (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLsizei numGlyphs, GLenum type, const void *charcodes, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +GLAPI void APIENTRY glPathGlyphRangeNV (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyph, GLsizei numGlyphs, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +GLAPI void APIENTRY glWeightPathsNV (GLuint resultPath, GLsizei numPaths, const GLuint *paths, const GLfloat *weights); +GLAPI void APIENTRY glCopyPathNV (GLuint resultPath, GLuint srcPath); +GLAPI void APIENTRY glInterpolatePathsNV (GLuint resultPath, GLuint pathA, GLuint pathB, GLfloat weight); +GLAPI void APIENTRY glTransformPathNV (GLuint resultPath, GLuint srcPath, GLenum transformType, const GLfloat *transformValues); +GLAPI void APIENTRY glPathParameterivNV (GLuint path, GLenum pname, const GLint *value); +GLAPI void APIENTRY glPathParameteriNV (GLuint path, GLenum pname, GLint value); +GLAPI void APIENTRY glPathParameterfvNV (GLuint path, GLenum pname, const GLfloat *value); +GLAPI void APIENTRY glPathParameterfNV (GLuint path, GLenum pname, GLfloat value); +GLAPI void APIENTRY glPathDashArrayNV (GLuint path, GLsizei dashCount, const GLfloat *dashArray); +GLAPI void APIENTRY glPathStencilFuncNV (GLenum func, GLint ref, GLuint mask); +GLAPI void APIENTRY glPathStencilDepthOffsetNV (GLfloat factor, GLfloat units); +GLAPI void APIENTRY glStencilFillPathNV (GLuint path, GLenum fillMode, GLuint mask); +GLAPI void APIENTRY glStencilStrokePathNV (GLuint path, GLint reference, GLuint mask); +GLAPI void APIENTRY glStencilFillPathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum transformType, const GLfloat *transformValues); +GLAPI void APIENTRY glStencilStrokePathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum transformType, const GLfloat *transformValues); +GLAPI void APIENTRY glPathCoverDepthFuncNV (GLenum func); +GLAPI void APIENTRY glPathColorGenNV (GLenum color, GLenum genMode, GLenum colorFormat, const GLfloat *coeffs); +GLAPI void APIENTRY glPathTexGenNV (GLenum texCoordSet, GLenum genMode, GLint components, const GLfloat *coeffs); +GLAPI void APIENTRY glPathFogGenNV (GLenum genMode); +GLAPI void APIENTRY glCoverFillPathNV (GLuint path, GLenum coverMode); +GLAPI void APIENTRY glCoverStrokePathNV (GLuint path, GLenum coverMode); +GLAPI void APIENTRY glCoverFillPathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +GLAPI void APIENTRY glCoverStrokePathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +GLAPI void APIENTRY glGetPathParameterivNV (GLuint path, GLenum pname, GLint *value); +GLAPI void APIENTRY glGetPathParameterfvNV (GLuint path, GLenum pname, GLfloat *value); +GLAPI void APIENTRY glGetPathCommandsNV (GLuint path, GLubyte *commands); +GLAPI void APIENTRY glGetPathCoordsNV (GLuint path, GLfloat *coords); +GLAPI void APIENTRY glGetPathDashArrayNV (GLuint path, GLfloat *dashArray); +GLAPI void APIENTRY glGetPathMetricsNV (GLbitfield metricQueryMask, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLsizei stride, GLfloat *metrics); +GLAPI void APIENTRY glGetPathMetricRangeNV (GLbitfield metricQueryMask, GLuint firstPathName, GLsizei numPaths, GLsizei stride, GLfloat *metrics); +GLAPI void APIENTRY glGetPathSpacingNV (GLenum pathListMode, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLfloat advanceScale, GLfloat kerningScale, GLenum transformType, GLfloat *returnedSpacing); +GLAPI void APIENTRY glGetPathColorGenivNV (GLenum color, GLenum pname, GLint *value); +GLAPI void APIENTRY glGetPathColorGenfvNV (GLenum color, GLenum pname, GLfloat *value); +GLAPI void APIENTRY glGetPathTexGenivNV (GLenum texCoordSet, GLenum pname, GLint *value); +GLAPI void APIENTRY glGetPathTexGenfvNV (GLenum texCoordSet, GLenum pname, GLfloat *value); +GLAPI GLboolean APIENTRY glIsPointInFillPathNV (GLuint path, GLuint mask, GLfloat x, GLfloat y); +GLAPI GLboolean APIENTRY glIsPointInStrokePathNV (GLuint path, GLfloat x, GLfloat y); +GLAPI GLfloat APIENTRY glGetPathLengthNV (GLuint path, GLsizei startSegment, GLsizei numSegments); +GLAPI GLboolean APIENTRY glPointAlongPathNV (GLuint path, GLsizei startSegment, GLsizei numSegments, GLfloat distance, GLfloat *x, GLfloat *y, GLfloat *tangentX, GLfloat *tangentY); +#endif +#endif /* GL_NV_path_rendering */ + +#ifndef GL_NV_pixel_data_range +#define GL_NV_pixel_data_range 1 +#define GL_WRITE_PIXEL_DATA_RANGE_NV 0x8878 +#define GL_READ_PIXEL_DATA_RANGE_NV 0x8879 +#define GL_WRITE_PIXEL_DATA_RANGE_LENGTH_NV 0x887A +#define GL_READ_PIXEL_DATA_RANGE_LENGTH_NV 0x887B +#define GL_WRITE_PIXEL_DATA_RANGE_POINTER_NV 0x887C +#define GL_READ_PIXEL_DATA_RANGE_POINTER_NV 0x887D +typedef void (APIENTRYP PFNGLPIXELDATARANGENVPROC) (GLenum target, GLsizei length, const void *pointer); +typedef void (APIENTRYP PFNGLFLUSHPIXELDATARANGENVPROC) (GLenum target); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPixelDataRangeNV (GLenum target, GLsizei length, const void *pointer); +GLAPI void APIENTRY glFlushPixelDataRangeNV (GLenum target); +#endif +#endif /* GL_NV_pixel_data_range */ + +#ifndef GL_NV_point_sprite +#define GL_NV_point_sprite 1 +#define GL_POINT_SPRITE_NV 0x8861 +#define GL_COORD_REPLACE_NV 0x8862 +#define GL_POINT_SPRITE_R_MODE_NV 0x8863 +typedef void (APIENTRYP PFNGLPOINTPARAMETERINVPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERIVNVPROC) (GLenum pname, const GLint *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPointParameteriNV (GLenum pname, GLint param); +GLAPI void APIENTRY glPointParameterivNV (GLenum pname, const GLint *params); +#endif +#endif /* GL_NV_point_sprite */ + +#ifndef GL_NV_present_video +#define GL_NV_present_video 1 +#define GL_FRAME_NV 0x8E26 +#define GL_FIELDS_NV 0x8E27 +#define GL_CURRENT_TIME_NV 0x8E28 +#define GL_NUM_FILL_STREAMS_NV 0x8E29 +#define GL_PRESENT_TIME_NV 0x8E2A +#define GL_PRESENT_DURATION_NV 0x8E2B +typedef void (APIENTRYP PFNGLPRESENTFRAMEKEYEDNVPROC) (GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLuint key0, GLenum target1, GLuint fill1, GLuint key1); +typedef void (APIENTRYP PFNGLPRESENTFRAMEDUALFILLNVPROC) (GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLenum target1, GLuint fill1, GLenum target2, GLuint fill2, GLenum target3, GLuint fill3); +typedef void (APIENTRYP PFNGLGETVIDEOIVNVPROC) (GLuint video_slot, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVIDEOUIVNVPROC) (GLuint video_slot, GLenum pname, GLuint *params); +typedef void (APIENTRYP PFNGLGETVIDEOI64VNVPROC) (GLuint video_slot, GLenum pname, GLint64EXT *params); +typedef void (APIENTRYP PFNGLGETVIDEOUI64VNVPROC) (GLuint video_slot, GLenum pname, GLuint64EXT *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPresentFrameKeyedNV (GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLuint key0, GLenum target1, GLuint fill1, GLuint key1); +GLAPI void APIENTRY glPresentFrameDualFillNV (GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLenum target1, GLuint fill1, GLenum target2, GLuint fill2, GLenum target3, GLuint fill3); +GLAPI void APIENTRY glGetVideoivNV (GLuint video_slot, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetVideouivNV (GLuint video_slot, GLenum pname, GLuint *params); +GLAPI void APIENTRY glGetVideoi64vNV (GLuint video_slot, GLenum pname, GLint64EXT *params); +GLAPI void APIENTRY glGetVideoui64vNV (GLuint video_slot, GLenum pname, GLuint64EXT *params); +#endif +#endif /* GL_NV_present_video */ + +#ifndef GL_NV_primitive_restart +#define GL_NV_primitive_restart 1 +#define GL_PRIMITIVE_RESTART_NV 0x8558 +#define GL_PRIMITIVE_RESTART_INDEX_NV 0x8559 +typedef void (APIENTRYP PFNGLPRIMITIVERESTARTNVPROC) (void); +typedef void (APIENTRYP PFNGLPRIMITIVERESTARTINDEXNVPROC) (GLuint index); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPrimitiveRestartNV (void); +GLAPI void APIENTRY glPrimitiveRestartIndexNV (GLuint index); +#endif +#endif /* GL_NV_primitive_restart */ + +#ifndef GL_NV_register_combiners +#define GL_NV_register_combiners 1 +#define GL_REGISTER_COMBINERS_NV 0x8522 +#define GL_VARIABLE_A_NV 0x8523 +#define GL_VARIABLE_B_NV 0x8524 +#define GL_VARIABLE_C_NV 0x8525 +#define GL_VARIABLE_D_NV 0x8526 +#define GL_VARIABLE_E_NV 0x8527 +#define GL_VARIABLE_F_NV 0x8528 +#define GL_VARIABLE_G_NV 0x8529 +#define GL_CONSTANT_COLOR0_NV 0x852A +#define GL_CONSTANT_COLOR1_NV 0x852B +#define GL_SPARE0_NV 0x852E +#define GL_SPARE1_NV 0x852F +#define GL_DISCARD_NV 0x8530 +#define GL_E_TIMES_F_NV 0x8531 +#define GL_SPARE0_PLUS_SECONDARY_COLOR_NV 0x8532 +#define GL_UNSIGNED_IDENTITY_NV 0x8536 +#define GL_UNSIGNED_INVERT_NV 0x8537 +#define GL_EXPAND_NORMAL_NV 0x8538 +#define GL_EXPAND_NEGATE_NV 0x8539 +#define GL_HALF_BIAS_NORMAL_NV 0x853A +#define GL_HALF_BIAS_NEGATE_NV 0x853B +#define GL_SIGNED_IDENTITY_NV 0x853C +#define GL_SIGNED_NEGATE_NV 0x853D +#define GL_SCALE_BY_TWO_NV 0x853E +#define GL_SCALE_BY_FOUR_NV 0x853F +#define GL_SCALE_BY_ONE_HALF_NV 0x8540 +#define GL_BIAS_BY_NEGATIVE_ONE_HALF_NV 0x8541 +#define GL_COMBINER_INPUT_NV 0x8542 +#define GL_COMBINER_MAPPING_NV 0x8543 +#define GL_COMBINER_COMPONENT_USAGE_NV 0x8544 +#define GL_COMBINER_AB_DOT_PRODUCT_NV 0x8545 +#define GL_COMBINER_CD_DOT_PRODUCT_NV 0x8546 +#define GL_COMBINER_MUX_SUM_NV 0x8547 +#define GL_COMBINER_SCALE_NV 0x8548 +#define GL_COMBINER_BIAS_NV 0x8549 +#define GL_COMBINER_AB_OUTPUT_NV 0x854A +#define GL_COMBINER_CD_OUTPUT_NV 0x854B +#define GL_COMBINER_SUM_OUTPUT_NV 0x854C +#define GL_MAX_GENERAL_COMBINERS_NV 0x854D +#define GL_NUM_GENERAL_COMBINERS_NV 0x854E +#define GL_COLOR_SUM_CLAMP_NV 0x854F +#define GL_COMBINER0_NV 0x8550 +#define GL_COMBINER1_NV 0x8551 +#define GL_COMBINER2_NV 0x8552 +#define GL_COMBINER3_NV 0x8553 +#define GL_COMBINER4_NV 0x8554 +#define GL_COMBINER5_NV 0x8555 +#define GL_COMBINER6_NV 0x8556 +#define GL_COMBINER7_NV 0x8557 +typedef void (APIENTRYP PFNGLCOMBINERPARAMETERFVNVPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLCOMBINERPARAMETERFNVPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLCOMBINERPARAMETERIVNVPROC) (GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLCOMBINERPARAMETERINVPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLCOMBINERINPUTNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); +typedef void (APIENTRYP PFNGLCOMBINEROUTPUTNVPROC) (GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum); +typedef void (APIENTRYP PFNGLFINALCOMBINERINPUTNVPROC) (GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); +typedef void (APIENTRYP PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC) (GLenum variable, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC) (GLenum variable, GLenum pname, GLint *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCombinerParameterfvNV (GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glCombinerParameterfNV (GLenum pname, GLfloat param); +GLAPI void APIENTRY glCombinerParameterivNV (GLenum pname, const GLint *params); +GLAPI void APIENTRY glCombinerParameteriNV (GLenum pname, GLint param); +GLAPI void APIENTRY glCombinerInputNV (GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); +GLAPI void APIENTRY glCombinerOutputNV (GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum); +GLAPI void APIENTRY glFinalCombinerInputNV (GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); +GLAPI void APIENTRY glGetCombinerInputParameterfvNV (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetCombinerInputParameterivNV (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetCombinerOutputParameterfvNV (GLenum stage, GLenum portion, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetCombinerOutputParameterivNV (GLenum stage, GLenum portion, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetFinalCombinerInputParameterfvNV (GLenum variable, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetFinalCombinerInputParameterivNV (GLenum variable, GLenum pname, GLint *params); +#endif +#endif /* GL_NV_register_combiners */ + +#ifndef GL_NV_register_combiners2 +#define GL_NV_register_combiners2 1 +#define GL_PER_STAGE_CONSTANTS_NV 0x8535 +typedef void (APIENTRYP PFNGLCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLGETCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, GLenum pname, GLfloat *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCombinerStageParameterfvNV (GLenum stage, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glGetCombinerStageParameterfvNV (GLenum stage, GLenum pname, GLfloat *params); +#endif +#endif /* GL_NV_register_combiners2 */ + +#ifndef GL_NV_shader_atomic_counters +#define GL_NV_shader_atomic_counters 1 +#endif /* GL_NV_shader_atomic_counters */ + +#ifndef GL_NV_shader_atomic_float +#define GL_NV_shader_atomic_float 1 +#endif /* GL_NV_shader_atomic_float */ + +#ifndef GL_NV_shader_buffer_load +#define GL_NV_shader_buffer_load 1 +#define GL_BUFFER_GPU_ADDRESS_NV 0x8F1D +#define GL_GPU_ADDRESS_NV 0x8F34 +#define GL_MAX_SHADER_BUFFER_ADDRESS_NV 0x8F35 +typedef void (APIENTRYP PFNGLMAKEBUFFERRESIDENTNVPROC) (GLenum target, GLenum access); +typedef void (APIENTRYP PFNGLMAKEBUFFERNONRESIDENTNVPROC) (GLenum target); +typedef GLboolean (APIENTRYP PFNGLISBUFFERRESIDENTNVPROC) (GLenum target); +typedef void (APIENTRYP PFNGLMAKENAMEDBUFFERRESIDENTNVPROC) (GLuint buffer, GLenum access); +typedef void (APIENTRYP PFNGLMAKENAMEDBUFFERNONRESIDENTNVPROC) (GLuint buffer); +typedef GLboolean (APIENTRYP PFNGLISNAMEDBUFFERRESIDENTNVPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERUI64VNVPROC) (GLenum target, GLenum pname, GLuint64EXT *params); +typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPARAMETERUI64VNVPROC) (GLuint buffer, GLenum pname, GLuint64EXT *params); +typedef void (APIENTRYP PFNGLGETINTEGERUI64VNVPROC) (GLenum value, GLuint64EXT *result); +typedef void (APIENTRYP PFNGLUNIFORMUI64NVPROC) (GLint location, GLuint64EXT value); +typedef void (APIENTRYP PFNGLUNIFORMUI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMUI64NVPROC) (GLuint program, GLint location, GLuint64EXT value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMUI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMakeBufferResidentNV (GLenum target, GLenum access); +GLAPI void APIENTRY glMakeBufferNonResidentNV (GLenum target); +GLAPI GLboolean APIENTRY glIsBufferResidentNV (GLenum target); +GLAPI void APIENTRY glMakeNamedBufferResidentNV (GLuint buffer, GLenum access); +GLAPI void APIENTRY glMakeNamedBufferNonResidentNV (GLuint buffer); +GLAPI GLboolean APIENTRY glIsNamedBufferResidentNV (GLuint buffer); +GLAPI void APIENTRY glGetBufferParameterui64vNV (GLenum target, GLenum pname, GLuint64EXT *params); +GLAPI void APIENTRY glGetNamedBufferParameterui64vNV (GLuint buffer, GLenum pname, GLuint64EXT *params); +GLAPI void APIENTRY glGetIntegerui64vNV (GLenum value, GLuint64EXT *result); +GLAPI void APIENTRY glUniformui64NV (GLint location, GLuint64EXT value); +GLAPI void APIENTRY glUniformui64vNV (GLint location, GLsizei count, const GLuint64EXT *value); +GLAPI void APIENTRY glProgramUniformui64NV (GLuint program, GLint location, GLuint64EXT value); +GLAPI void APIENTRY glProgramUniformui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +#endif +#endif /* GL_NV_shader_buffer_load */ + +#ifndef GL_NV_shader_buffer_store +#define GL_NV_shader_buffer_store 1 +#define GL_SHADER_GLOBAL_ACCESS_BARRIER_BIT_NV 0x00000010 +#endif /* GL_NV_shader_buffer_store */ + +#ifndef GL_NV_shader_storage_buffer_object +#define GL_NV_shader_storage_buffer_object 1 +#endif /* GL_NV_shader_storage_buffer_object */ + +#ifndef GL_NV_shader_thread_group +#define GL_NV_shader_thread_group 1 +#define GL_WARP_SIZE_NV 0x9339 +#define GL_WARPS_PER_SM_NV 0x933A +#define GL_SM_COUNT_NV 0x933B +#endif /* GL_NV_shader_thread_group */ + +#ifndef GL_NV_shader_thread_shuffle +#define GL_NV_shader_thread_shuffle 1 +#endif /* GL_NV_shader_thread_shuffle */ + +#ifndef GL_NV_tessellation_program5 +#define GL_NV_tessellation_program5 1 +#define GL_MAX_PROGRAM_PATCH_ATTRIBS_NV 0x86D8 +#define GL_TESS_CONTROL_PROGRAM_NV 0x891E +#define GL_TESS_EVALUATION_PROGRAM_NV 0x891F +#define GL_TESS_CONTROL_PROGRAM_PARAMETER_BUFFER_NV 0x8C74 +#define GL_TESS_EVALUATION_PROGRAM_PARAMETER_BUFFER_NV 0x8C75 +#endif /* GL_NV_tessellation_program5 */ + +#ifndef GL_NV_texgen_emboss +#define GL_NV_texgen_emboss 1 +#define GL_EMBOSS_LIGHT_NV 0x855D +#define GL_EMBOSS_CONSTANT_NV 0x855E +#define GL_EMBOSS_MAP_NV 0x855F +#endif /* GL_NV_texgen_emboss */ + +#ifndef GL_NV_texgen_reflection +#define GL_NV_texgen_reflection 1 +#define GL_NORMAL_MAP_NV 0x8511 +#define GL_REFLECTION_MAP_NV 0x8512 +#endif /* GL_NV_texgen_reflection */ + +#ifndef GL_NV_texture_barrier +#define GL_NV_texture_barrier 1 +typedef void (APIENTRYP PFNGLTEXTUREBARRIERNVPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTextureBarrierNV (void); +#endif +#endif /* GL_NV_texture_barrier */ + +#ifndef GL_NV_texture_compression_vtc +#define GL_NV_texture_compression_vtc 1 +#endif /* GL_NV_texture_compression_vtc */ + +#ifndef GL_NV_texture_env_combine4 +#define GL_NV_texture_env_combine4 1 +#define GL_COMBINE4_NV 0x8503 +#define GL_SOURCE3_RGB_NV 0x8583 +#define GL_SOURCE3_ALPHA_NV 0x858B +#define GL_OPERAND3_RGB_NV 0x8593 +#define GL_OPERAND3_ALPHA_NV 0x859B +#endif /* GL_NV_texture_env_combine4 */ + +#ifndef GL_NV_texture_expand_normal +#define GL_NV_texture_expand_normal 1 +#define GL_TEXTURE_UNSIGNED_REMAP_MODE_NV 0x888F +#endif /* GL_NV_texture_expand_normal */ + +#ifndef GL_NV_texture_multisample +#define GL_NV_texture_multisample 1 +#define GL_TEXTURE_COVERAGE_SAMPLES_NV 0x9045 +#define GL_TEXTURE_COLOR_SAMPLES_NV 0x9046 +typedef void (APIENTRYP PFNGLTEXIMAGE2DMULTISAMPLECOVERAGENVPROC) (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations); +typedef void (APIENTRYP PFNGLTEXIMAGE3DMULTISAMPLECOVERAGENVPROC) (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations); +typedef void (APIENTRYP PFNGLTEXTUREIMAGE2DMULTISAMPLENVPROC) (GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations); +typedef void (APIENTRYP PFNGLTEXTUREIMAGE3DMULTISAMPLENVPROC) (GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations); +typedef void (APIENTRYP PFNGLTEXTUREIMAGE2DMULTISAMPLECOVERAGENVPROC) (GLuint texture, GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations); +typedef void (APIENTRYP PFNGLTEXTUREIMAGE3DMULTISAMPLECOVERAGENVPROC) (GLuint texture, GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexImage2DMultisampleCoverageNV (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations); +GLAPI void APIENTRY glTexImage3DMultisampleCoverageNV (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations); +GLAPI void APIENTRY glTextureImage2DMultisampleNV (GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations); +GLAPI void APIENTRY glTextureImage3DMultisampleNV (GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations); +GLAPI void APIENTRY glTextureImage2DMultisampleCoverageNV (GLuint texture, GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations); +GLAPI void APIENTRY glTextureImage3DMultisampleCoverageNV (GLuint texture, GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations); +#endif +#endif /* GL_NV_texture_multisample */ + +#ifndef GL_NV_texture_rectangle +#define GL_NV_texture_rectangle 1 +#define GL_TEXTURE_RECTANGLE_NV 0x84F5 +#define GL_TEXTURE_BINDING_RECTANGLE_NV 0x84F6 +#define GL_PROXY_TEXTURE_RECTANGLE_NV 0x84F7 +#define GL_MAX_RECTANGLE_TEXTURE_SIZE_NV 0x84F8 +#endif /* GL_NV_texture_rectangle */ + +#ifndef GL_NV_texture_shader +#define GL_NV_texture_shader 1 +#define GL_OFFSET_TEXTURE_RECTANGLE_NV 0x864C +#define GL_OFFSET_TEXTURE_RECTANGLE_SCALE_NV 0x864D +#define GL_DOT_PRODUCT_TEXTURE_RECTANGLE_NV 0x864E +#define GL_RGBA_UNSIGNED_DOT_PRODUCT_MAPPING_NV 0x86D9 +#define GL_UNSIGNED_INT_S8_S8_8_8_NV 0x86DA +#define GL_UNSIGNED_INT_8_8_S8_S8_REV_NV 0x86DB +#define GL_DSDT_MAG_INTENSITY_NV 0x86DC +#define GL_SHADER_CONSISTENT_NV 0x86DD +#define GL_TEXTURE_SHADER_NV 0x86DE +#define GL_SHADER_OPERATION_NV 0x86DF +#define GL_CULL_MODES_NV 0x86E0 +#define GL_OFFSET_TEXTURE_MATRIX_NV 0x86E1 +#define GL_OFFSET_TEXTURE_SCALE_NV 0x86E2 +#define GL_OFFSET_TEXTURE_BIAS_NV 0x86E3 +#define GL_OFFSET_TEXTURE_2D_MATRIX_NV 0x86E1 +#define GL_OFFSET_TEXTURE_2D_SCALE_NV 0x86E2 +#define GL_OFFSET_TEXTURE_2D_BIAS_NV 0x86E3 +#define GL_PREVIOUS_TEXTURE_INPUT_NV 0x86E4 +#define GL_CONST_EYE_NV 0x86E5 +#define GL_PASS_THROUGH_NV 0x86E6 +#define GL_CULL_FRAGMENT_NV 0x86E7 +#define GL_OFFSET_TEXTURE_2D_NV 0x86E8 +#define GL_DEPENDENT_AR_TEXTURE_2D_NV 0x86E9 +#define GL_DEPENDENT_GB_TEXTURE_2D_NV 0x86EA +#define GL_DOT_PRODUCT_NV 0x86EC +#define GL_DOT_PRODUCT_DEPTH_REPLACE_NV 0x86ED +#define GL_DOT_PRODUCT_TEXTURE_2D_NV 0x86EE +#define GL_DOT_PRODUCT_TEXTURE_CUBE_MAP_NV 0x86F0 +#define GL_DOT_PRODUCT_DIFFUSE_CUBE_MAP_NV 0x86F1 +#define GL_DOT_PRODUCT_REFLECT_CUBE_MAP_NV 0x86F2 +#define GL_DOT_PRODUCT_CONST_EYE_REFLECT_CUBE_MAP_NV 0x86F3 +#define GL_HILO_NV 0x86F4 +#define GL_DSDT_NV 0x86F5 +#define GL_DSDT_MAG_NV 0x86F6 +#define GL_DSDT_MAG_VIB_NV 0x86F7 +#define GL_HILO16_NV 0x86F8 +#define GL_SIGNED_HILO_NV 0x86F9 +#define GL_SIGNED_HILO16_NV 0x86FA +#define GL_SIGNED_RGBA_NV 0x86FB +#define GL_SIGNED_RGBA8_NV 0x86FC +#define GL_SIGNED_RGB_NV 0x86FE +#define GL_SIGNED_RGB8_NV 0x86FF +#define GL_SIGNED_LUMINANCE_NV 0x8701 +#define GL_SIGNED_LUMINANCE8_NV 0x8702 +#define GL_SIGNED_LUMINANCE_ALPHA_NV 0x8703 +#define GL_SIGNED_LUMINANCE8_ALPHA8_NV 0x8704 +#define GL_SIGNED_ALPHA_NV 0x8705 +#define GL_SIGNED_ALPHA8_NV 0x8706 +#define GL_SIGNED_INTENSITY_NV 0x8707 +#define GL_SIGNED_INTENSITY8_NV 0x8708 +#define GL_DSDT8_NV 0x8709 +#define GL_DSDT8_MAG8_NV 0x870A +#define GL_DSDT8_MAG8_INTENSITY8_NV 0x870B +#define GL_SIGNED_RGB_UNSIGNED_ALPHA_NV 0x870C +#define GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV 0x870D +#define GL_HI_SCALE_NV 0x870E +#define GL_LO_SCALE_NV 0x870F +#define GL_DS_SCALE_NV 0x8710 +#define GL_DT_SCALE_NV 0x8711 +#define GL_MAGNITUDE_SCALE_NV 0x8712 +#define GL_VIBRANCE_SCALE_NV 0x8713 +#define GL_HI_BIAS_NV 0x8714 +#define GL_LO_BIAS_NV 0x8715 +#define GL_DS_BIAS_NV 0x8716 +#define GL_DT_BIAS_NV 0x8717 +#define GL_MAGNITUDE_BIAS_NV 0x8718 +#define GL_VIBRANCE_BIAS_NV 0x8719 +#define GL_TEXTURE_BORDER_VALUES_NV 0x871A +#define GL_TEXTURE_HI_SIZE_NV 0x871B +#define GL_TEXTURE_LO_SIZE_NV 0x871C +#define GL_TEXTURE_DS_SIZE_NV 0x871D +#define GL_TEXTURE_DT_SIZE_NV 0x871E +#define GL_TEXTURE_MAG_SIZE_NV 0x871F +#endif /* GL_NV_texture_shader */ + +#ifndef GL_NV_texture_shader2 +#define GL_NV_texture_shader2 1 +#define GL_DOT_PRODUCT_TEXTURE_3D_NV 0x86EF +#endif /* GL_NV_texture_shader2 */ + +#ifndef GL_NV_texture_shader3 +#define GL_NV_texture_shader3 1 +#define GL_OFFSET_PROJECTIVE_TEXTURE_2D_NV 0x8850 +#define GL_OFFSET_PROJECTIVE_TEXTURE_2D_SCALE_NV 0x8851 +#define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8852 +#define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_SCALE_NV 0x8853 +#define GL_OFFSET_HILO_TEXTURE_2D_NV 0x8854 +#define GL_OFFSET_HILO_TEXTURE_RECTANGLE_NV 0x8855 +#define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_2D_NV 0x8856 +#define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8857 +#define GL_DEPENDENT_HILO_TEXTURE_2D_NV 0x8858 +#define GL_DEPENDENT_RGB_TEXTURE_3D_NV 0x8859 +#define GL_DEPENDENT_RGB_TEXTURE_CUBE_MAP_NV 0x885A +#define GL_DOT_PRODUCT_PASS_THROUGH_NV 0x885B +#define GL_DOT_PRODUCT_TEXTURE_1D_NV 0x885C +#define GL_DOT_PRODUCT_AFFINE_DEPTH_REPLACE_NV 0x885D +#define GL_HILO8_NV 0x885E +#define GL_SIGNED_HILO8_NV 0x885F +#define GL_FORCE_BLUE_TO_ONE_NV 0x8860 +#endif /* GL_NV_texture_shader3 */ + +#ifndef GL_NV_transform_feedback +#define GL_NV_transform_feedback 1 +#define GL_BACK_PRIMARY_COLOR_NV 0x8C77 +#define GL_BACK_SECONDARY_COLOR_NV 0x8C78 +#define GL_TEXTURE_COORD_NV 0x8C79 +#define GL_CLIP_DISTANCE_NV 0x8C7A +#define GL_VERTEX_ID_NV 0x8C7B +#define GL_PRIMITIVE_ID_NV 0x8C7C +#define GL_GENERIC_ATTRIB_NV 0x8C7D +#define GL_TRANSFORM_FEEDBACK_ATTRIBS_NV 0x8C7E +#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE_NV 0x8C7F +#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_NV 0x8C80 +#define GL_ACTIVE_VARYINGS_NV 0x8C81 +#define GL_ACTIVE_VARYING_MAX_LENGTH_NV 0x8C82 +#define GL_TRANSFORM_FEEDBACK_VARYINGS_NV 0x8C83 +#define GL_TRANSFORM_FEEDBACK_BUFFER_START_NV 0x8C84 +#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_NV 0x8C85 +#define GL_TRANSFORM_FEEDBACK_RECORD_NV 0x8C86 +#define GL_PRIMITIVES_GENERATED_NV 0x8C87 +#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_NV 0x8C88 +#define GL_RASTERIZER_DISCARD_NV 0x8C89 +#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_NV 0x8C8A +#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_NV 0x8C8B +#define GL_INTERLEAVED_ATTRIBS_NV 0x8C8C +#define GL_SEPARATE_ATTRIBS_NV 0x8C8D +#define GL_TRANSFORM_FEEDBACK_BUFFER_NV 0x8C8E +#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_NV 0x8C8F +#define GL_LAYER_NV 0x8DAA +#define GL_NEXT_BUFFER_NV -2 +#define GL_SKIP_COMPONENTS4_NV -3 +#define GL_SKIP_COMPONENTS3_NV -4 +#define GL_SKIP_COMPONENTS2_NV -5 +#define GL_SKIP_COMPONENTS1_NV -6 +typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKNVPROC) (GLenum primitiveMode); +typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKNVPROC) (void); +typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKATTRIBSNVPROC) (GLuint count, const GLint *attribs, GLenum bufferMode); +typedef void (APIENTRYP PFNGLBINDBUFFERRANGENVPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); +typedef void (APIENTRYP PFNGLBINDBUFFEROFFSETNVPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset); +typedef void (APIENTRYP PFNGLBINDBUFFERBASENVPROC) (GLenum target, GLuint index, GLuint buffer); +typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSNVPROC) (GLuint program, GLsizei count, const GLint *locations, GLenum bufferMode); +typedef void (APIENTRYP PFNGLACTIVEVARYINGNVPROC) (GLuint program, const GLchar *name); +typedef GLint (APIENTRYP PFNGLGETVARYINGLOCATIONNVPROC) (GLuint program, const GLchar *name); +typedef void (APIENTRYP PFNGLGETACTIVEVARYINGNVPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); +typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGNVPROC) (GLuint program, GLuint index, GLint *location); +typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKSTREAMATTRIBSNVPROC) (GLsizei count, const GLint *attribs, GLsizei nbuffers, const GLint *bufstreams, GLenum bufferMode); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBeginTransformFeedbackNV (GLenum primitiveMode); +GLAPI void APIENTRY glEndTransformFeedbackNV (void); +GLAPI void APIENTRY glTransformFeedbackAttribsNV (GLuint count, const GLint *attribs, GLenum bufferMode); +GLAPI void APIENTRY glBindBufferRangeNV (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); +GLAPI void APIENTRY glBindBufferOffsetNV (GLenum target, GLuint index, GLuint buffer, GLintptr offset); +GLAPI void APIENTRY glBindBufferBaseNV (GLenum target, GLuint index, GLuint buffer); +GLAPI void APIENTRY glTransformFeedbackVaryingsNV (GLuint program, GLsizei count, const GLint *locations, GLenum bufferMode); +GLAPI void APIENTRY glActiveVaryingNV (GLuint program, const GLchar *name); +GLAPI GLint APIENTRY glGetVaryingLocationNV (GLuint program, const GLchar *name); +GLAPI void APIENTRY glGetActiveVaryingNV (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); +GLAPI void APIENTRY glGetTransformFeedbackVaryingNV (GLuint program, GLuint index, GLint *location); +GLAPI void APIENTRY glTransformFeedbackStreamAttribsNV (GLsizei count, const GLint *attribs, GLsizei nbuffers, const GLint *bufstreams, GLenum bufferMode); +#endif +#endif /* GL_NV_transform_feedback */ + +#ifndef GL_NV_transform_feedback2 +#define GL_NV_transform_feedback2 1 +#define GL_TRANSFORM_FEEDBACK_NV 0x8E22 +#define GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED_NV 0x8E23 +#define GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE_NV 0x8E24 +#define GL_TRANSFORM_FEEDBACK_BINDING_NV 0x8E25 +typedef void (APIENTRYP PFNGLBINDTRANSFORMFEEDBACKNVPROC) (GLenum target, GLuint id); +typedef void (APIENTRYP PFNGLDELETETRANSFORMFEEDBACKSNVPROC) (GLsizei n, const GLuint *ids); +typedef void (APIENTRYP PFNGLGENTRANSFORMFEEDBACKSNVPROC) (GLsizei n, GLuint *ids); +typedef GLboolean (APIENTRYP PFNGLISTRANSFORMFEEDBACKNVPROC) (GLuint id); +typedef void (APIENTRYP PFNGLPAUSETRANSFORMFEEDBACKNVPROC) (void); +typedef void (APIENTRYP PFNGLRESUMETRANSFORMFEEDBACKNVPROC) (void); +typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKNVPROC) (GLenum mode, GLuint id); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBindTransformFeedbackNV (GLenum target, GLuint id); +GLAPI void APIENTRY glDeleteTransformFeedbacksNV (GLsizei n, const GLuint *ids); +GLAPI void APIENTRY glGenTransformFeedbacksNV (GLsizei n, GLuint *ids); +GLAPI GLboolean APIENTRY glIsTransformFeedbackNV (GLuint id); +GLAPI void APIENTRY glPauseTransformFeedbackNV (void); +GLAPI void APIENTRY glResumeTransformFeedbackNV (void); +GLAPI void APIENTRY glDrawTransformFeedbackNV (GLenum mode, GLuint id); +#endif +#endif /* GL_NV_transform_feedback2 */ + +#ifndef GL_NV_vdpau_interop +#define GL_NV_vdpau_interop 1 +typedef GLintptr GLvdpauSurfaceNV; +#define GL_SURFACE_STATE_NV 0x86EB +#define GL_SURFACE_REGISTERED_NV 0x86FD +#define GL_SURFACE_MAPPED_NV 0x8700 +#define GL_WRITE_DISCARD_NV 0x88BE +typedef void (APIENTRYP PFNGLVDPAUINITNVPROC) (const void *vdpDevice, const void *getProcAddress); +typedef void (APIENTRYP PFNGLVDPAUFININVPROC) (void); +typedef GLvdpauSurfaceNV (APIENTRYP PFNGLVDPAUREGISTERVIDEOSURFACENVPROC) (const void *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames); +typedef GLvdpauSurfaceNV (APIENTRYP PFNGLVDPAUREGISTEROUTPUTSURFACENVPROC) (const void *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames); +typedef GLboolean (APIENTRYP PFNGLVDPAUISSURFACENVPROC) (GLvdpauSurfaceNV surface); +typedef void (APIENTRYP PFNGLVDPAUUNREGISTERSURFACENVPROC) (GLvdpauSurfaceNV surface); +typedef void (APIENTRYP PFNGLVDPAUGETSURFACEIVNVPROC) (GLvdpauSurfaceNV surface, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); +typedef void (APIENTRYP PFNGLVDPAUSURFACEACCESSNVPROC) (GLvdpauSurfaceNV surface, GLenum access); +typedef void (APIENTRYP PFNGLVDPAUMAPSURFACESNVPROC) (GLsizei numSurfaces, const GLvdpauSurfaceNV *surfaces); +typedef void (APIENTRYP PFNGLVDPAUUNMAPSURFACESNVPROC) (GLsizei numSurface, const GLvdpauSurfaceNV *surfaces); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVDPAUInitNV (const void *vdpDevice, const void *getProcAddress); +GLAPI void APIENTRY glVDPAUFiniNV (void); +GLAPI GLvdpauSurfaceNV APIENTRY glVDPAURegisterVideoSurfaceNV (const void *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames); +GLAPI GLvdpauSurfaceNV APIENTRY glVDPAURegisterOutputSurfaceNV (const void *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames); +GLAPI GLboolean APIENTRY glVDPAUIsSurfaceNV (GLvdpauSurfaceNV surface); +GLAPI void APIENTRY glVDPAUUnregisterSurfaceNV (GLvdpauSurfaceNV surface); +GLAPI void APIENTRY glVDPAUGetSurfaceivNV (GLvdpauSurfaceNV surface, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); +GLAPI void APIENTRY glVDPAUSurfaceAccessNV (GLvdpauSurfaceNV surface, GLenum access); +GLAPI void APIENTRY glVDPAUMapSurfacesNV (GLsizei numSurfaces, const GLvdpauSurfaceNV *surfaces); +GLAPI void APIENTRY glVDPAUUnmapSurfacesNV (GLsizei numSurface, const GLvdpauSurfaceNV *surfaces); +#endif +#endif /* GL_NV_vdpau_interop */ + +#ifndef GL_NV_vertex_array_range +#define GL_NV_vertex_array_range 1 +#define GL_VERTEX_ARRAY_RANGE_NV 0x851D +#define GL_VERTEX_ARRAY_RANGE_LENGTH_NV 0x851E +#define GL_VERTEX_ARRAY_RANGE_VALID_NV 0x851F +#define GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV 0x8520 +#define GL_VERTEX_ARRAY_RANGE_POINTER_NV 0x8521 +typedef void (APIENTRYP PFNGLFLUSHVERTEXARRAYRANGENVPROC) (void); +typedef void (APIENTRYP PFNGLVERTEXARRAYRANGENVPROC) (GLsizei length, const void *pointer); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFlushVertexArrayRangeNV (void); +GLAPI void APIENTRY glVertexArrayRangeNV (GLsizei length, const void *pointer); +#endif +#endif /* GL_NV_vertex_array_range */ + +#ifndef GL_NV_vertex_array_range2 +#define GL_NV_vertex_array_range2 1 +#define GL_VERTEX_ARRAY_RANGE_WITHOUT_FLUSH_NV 0x8533 +#endif /* GL_NV_vertex_array_range2 */ + +#ifndef GL_NV_vertex_attrib_integer_64bit +#define GL_NV_vertex_attrib_integer_64bit 1 +typedef void (APIENTRYP PFNGLVERTEXATTRIBL1I64NVPROC) (GLuint index, GLint64EXT x); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL2I64NVPROC) (GLuint index, GLint64EXT x, GLint64EXT y); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL3I64NVPROC) (GLuint index, GLint64EXT x, GLint64EXT y, GLint64EXT z); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL4I64NVPROC) (GLuint index, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL1I64VNVPROC) (GLuint index, const GLint64EXT *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL2I64VNVPROC) (GLuint index, const GLint64EXT *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL3I64VNVPROC) (GLuint index, const GLint64EXT *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL4I64VNVPROC) (GLuint index, const GLint64EXT *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL1UI64NVPROC) (GLuint index, GLuint64EXT x); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL2UI64NVPROC) (GLuint index, GLuint64EXT x, GLuint64EXT y); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL3UI64NVPROC) (GLuint index, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL4UI64NVPROC) (GLuint index, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL1UI64VNVPROC) (GLuint index, const GLuint64EXT *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL2UI64VNVPROC) (GLuint index, const GLuint64EXT *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL3UI64VNVPROC) (GLuint index, const GLuint64EXT *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL4UI64VNVPROC) (GLuint index, const GLuint64EXT *v); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLI64VNVPROC) (GLuint index, GLenum pname, GLint64EXT *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLUI64VNVPROC) (GLuint index, GLenum pname, GLuint64EXT *params); +typedef void (APIENTRYP PFNGLVERTEXATTRIBLFORMATNVPROC) (GLuint index, GLint size, GLenum type, GLsizei stride); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexAttribL1i64NV (GLuint index, GLint64EXT x); +GLAPI void APIENTRY glVertexAttribL2i64NV (GLuint index, GLint64EXT x, GLint64EXT y); +GLAPI void APIENTRY glVertexAttribL3i64NV (GLuint index, GLint64EXT x, GLint64EXT y, GLint64EXT z); +GLAPI void APIENTRY glVertexAttribL4i64NV (GLuint index, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); +GLAPI void APIENTRY glVertexAttribL1i64vNV (GLuint index, const GLint64EXT *v); +GLAPI void APIENTRY glVertexAttribL2i64vNV (GLuint index, const GLint64EXT *v); +GLAPI void APIENTRY glVertexAttribL3i64vNV (GLuint index, const GLint64EXT *v); +GLAPI void APIENTRY glVertexAttribL4i64vNV (GLuint index, const GLint64EXT *v); +GLAPI void APIENTRY glVertexAttribL1ui64NV (GLuint index, GLuint64EXT x); +GLAPI void APIENTRY glVertexAttribL2ui64NV (GLuint index, GLuint64EXT x, GLuint64EXT y); +GLAPI void APIENTRY glVertexAttribL3ui64NV (GLuint index, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); +GLAPI void APIENTRY glVertexAttribL4ui64NV (GLuint index, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); +GLAPI void APIENTRY glVertexAttribL1ui64vNV (GLuint index, const GLuint64EXT *v); +GLAPI void APIENTRY glVertexAttribL2ui64vNV (GLuint index, const GLuint64EXT *v); +GLAPI void APIENTRY glVertexAttribL3ui64vNV (GLuint index, const GLuint64EXT *v); +GLAPI void APIENTRY glVertexAttribL4ui64vNV (GLuint index, const GLuint64EXT *v); +GLAPI void APIENTRY glGetVertexAttribLi64vNV (GLuint index, GLenum pname, GLint64EXT *params); +GLAPI void APIENTRY glGetVertexAttribLui64vNV (GLuint index, GLenum pname, GLuint64EXT *params); +GLAPI void APIENTRY glVertexAttribLFormatNV (GLuint index, GLint size, GLenum type, GLsizei stride); +#endif +#endif /* GL_NV_vertex_attrib_integer_64bit */ + +#ifndef GL_NV_vertex_buffer_unified_memory +#define GL_NV_vertex_buffer_unified_memory 1 +#define GL_VERTEX_ATTRIB_ARRAY_UNIFIED_NV 0x8F1E +#define GL_ELEMENT_ARRAY_UNIFIED_NV 0x8F1F +#define GL_VERTEX_ATTRIB_ARRAY_ADDRESS_NV 0x8F20 +#define GL_VERTEX_ARRAY_ADDRESS_NV 0x8F21 +#define GL_NORMAL_ARRAY_ADDRESS_NV 0x8F22 +#define GL_COLOR_ARRAY_ADDRESS_NV 0x8F23 +#define GL_INDEX_ARRAY_ADDRESS_NV 0x8F24 +#define GL_TEXTURE_COORD_ARRAY_ADDRESS_NV 0x8F25 +#define GL_EDGE_FLAG_ARRAY_ADDRESS_NV 0x8F26 +#define GL_SECONDARY_COLOR_ARRAY_ADDRESS_NV 0x8F27 +#define GL_FOG_COORD_ARRAY_ADDRESS_NV 0x8F28 +#define GL_ELEMENT_ARRAY_ADDRESS_NV 0x8F29 +#define GL_VERTEX_ATTRIB_ARRAY_LENGTH_NV 0x8F2A +#define GL_VERTEX_ARRAY_LENGTH_NV 0x8F2B +#define GL_NORMAL_ARRAY_LENGTH_NV 0x8F2C +#define GL_COLOR_ARRAY_LENGTH_NV 0x8F2D +#define GL_INDEX_ARRAY_LENGTH_NV 0x8F2E +#define GL_TEXTURE_COORD_ARRAY_LENGTH_NV 0x8F2F +#define GL_EDGE_FLAG_ARRAY_LENGTH_NV 0x8F30 +#define GL_SECONDARY_COLOR_ARRAY_LENGTH_NV 0x8F31 +#define GL_FOG_COORD_ARRAY_LENGTH_NV 0x8F32 +#define GL_ELEMENT_ARRAY_LENGTH_NV 0x8F33 +#define GL_DRAW_INDIRECT_UNIFIED_NV 0x8F40 +#define GL_DRAW_INDIRECT_ADDRESS_NV 0x8F41 +#define GL_DRAW_INDIRECT_LENGTH_NV 0x8F42 +typedef void (APIENTRYP PFNGLBUFFERADDRESSRANGENVPROC) (GLenum pname, GLuint index, GLuint64EXT address, GLsizeiptr length); +typedef void (APIENTRYP PFNGLVERTEXFORMATNVPROC) (GLint size, GLenum type, GLsizei stride); +typedef void (APIENTRYP PFNGLNORMALFORMATNVPROC) (GLenum type, GLsizei stride); +typedef void (APIENTRYP PFNGLCOLORFORMATNVPROC) (GLint size, GLenum type, GLsizei stride); +typedef void (APIENTRYP PFNGLINDEXFORMATNVPROC) (GLenum type, GLsizei stride); +typedef void (APIENTRYP PFNGLTEXCOORDFORMATNVPROC) (GLint size, GLenum type, GLsizei stride); +typedef void (APIENTRYP PFNGLEDGEFLAGFORMATNVPROC) (GLsizei stride); +typedef void (APIENTRYP PFNGLSECONDARYCOLORFORMATNVPROC) (GLint size, GLenum type, GLsizei stride); +typedef void (APIENTRYP PFNGLFOGCOORDFORMATNVPROC) (GLenum type, GLsizei stride); +typedef void (APIENTRYP PFNGLVERTEXATTRIBFORMATNVPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride); +typedef void (APIENTRYP PFNGLVERTEXATTRIBIFORMATNVPROC) (GLuint index, GLint size, GLenum type, GLsizei stride); +typedef void (APIENTRYP PFNGLGETINTEGERUI64I_VNVPROC) (GLenum value, GLuint index, GLuint64EXT *result); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBufferAddressRangeNV (GLenum pname, GLuint index, GLuint64EXT address, GLsizeiptr length); +GLAPI void APIENTRY glVertexFormatNV (GLint size, GLenum type, GLsizei stride); +GLAPI void APIENTRY glNormalFormatNV (GLenum type, GLsizei stride); +GLAPI void APIENTRY glColorFormatNV (GLint size, GLenum type, GLsizei stride); +GLAPI void APIENTRY glIndexFormatNV (GLenum type, GLsizei stride); +GLAPI void APIENTRY glTexCoordFormatNV (GLint size, GLenum type, GLsizei stride); +GLAPI void APIENTRY glEdgeFlagFormatNV (GLsizei stride); +GLAPI void APIENTRY glSecondaryColorFormatNV (GLint size, GLenum type, GLsizei stride); +GLAPI void APIENTRY glFogCoordFormatNV (GLenum type, GLsizei stride); +GLAPI void APIENTRY glVertexAttribFormatNV (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride); +GLAPI void APIENTRY glVertexAttribIFormatNV (GLuint index, GLint size, GLenum type, GLsizei stride); +GLAPI void APIENTRY glGetIntegerui64i_vNV (GLenum value, GLuint index, GLuint64EXT *result); +#endif +#endif /* GL_NV_vertex_buffer_unified_memory */ + +#ifndef GL_NV_vertex_program +#define GL_NV_vertex_program 1 +#define GL_VERTEX_PROGRAM_NV 0x8620 +#define GL_VERTEX_STATE_PROGRAM_NV 0x8621 +#define GL_ATTRIB_ARRAY_SIZE_NV 0x8623 +#define GL_ATTRIB_ARRAY_STRIDE_NV 0x8624 +#define GL_ATTRIB_ARRAY_TYPE_NV 0x8625 +#define GL_CURRENT_ATTRIB_NV 0x8626 +#define GL_PROGRAM_LENGTH_NV 0x8627 +#define GL_PROGRAM_STRING_NV 0x8628 +#define GL_MODELVIEW_PROJECTION_NV 0x8629 +#define GL_IDENTITY_NV 0x862A +#define GL_INVERSE_NV 0x862B +#define GL_TRANSPOSE_NV 0x862C +#define GL_INVERSE_TRANSPOSE_NV 0x862D +#define GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV 0x862E +#define GL_MAX_TRACK_MATRICES_NV 0x862F +#define GL_MATRIX0_NV 0x8630 +#define GL_MATRIX1_NV 0x8631 +#define GL_MATRIX2_NV 0x8632 +#define GL_MATRIX3_NV 0x8633 +#define GL_MATRIX4_NV 0x8634 +#define GL_MATRIX5_NV 0x8635 +#define GL_MATRIX6_NV 0x8636 +#define GL_MATRIX7_NV 0x8637 +#define GL_CURRENT_MATRIX_STACK_DEPTH_NV 0x8640 +#define GL_CURRENT_MATRIX_NV 0x8641 +#define GL_VERTEX_PROGRAM_POINT_SIZE_NV 0x8642 +#define GL_VERTEX_PROGRAM_TWO_SIDE_NV 0x8643 +#define GL_PROGRAM_PARAMETER_NV 0x8644 +#define GL_ATTRIB_ARRAY_POINTER_NV 0x8645 +#define GL_PROGRAM_TARGET_NV 0x8646 +#define GL_PROGRAM_RESIDENT_NV 0x8647 +#define GL_TRACK_MATRIX_NV 0x8648 +#define GL_TRACK_MATRIX_TRANSFORM_NV 0x8649 +#define GL_VERTEX_PROGRAM_BINDING_NV 0x864A +#define GL_PROGRAM_ERROR_POSITION_NV 0x864B +#define GL_VERTEX_ATTRIB_ARRAY0_NV 0x8650 +#define GL_VERTEX_ATTRIB_ARRAY1_NV 0x8651 +#define GL_VERTEX_ATTRIB_ARRAY2_NV 0x8652 +#define GL_VERTEX_ATTRIB_ARRAY3_NV 0x8653 +#define GL_VERTEX_ATTRIB_ARRAY4_NV 0x8654 +#define GL_VERTEX_ATTRIB_ARRAY5_NV 0x8655 +#define GL_VERTEX_ATTRIB_ARRAY6_NV 0x8656 +#define GL_VERTEX_ATTRIB_ARRAY7_NV 0x8657 +#define GL_VERTEX_ATTRIB_ARRAY8_NV 0x8658 +#define GL_VERTEX_ATTRIB_ARRAY9_NV 0x8659 +#define GL_VERTEX_ATTRIB_ARRAY10_NV 0x865A +#define GL_VERTEX_ATTRIB_ARRAY11_NV 0x865B +#define GL_VERTEX_ATTRIB_ARRAY12_NV 0x865C +#define GL_VERTEX_ATTRIB_ARRAY13_NV 0x865D +#define GL_VERTEX_ATTRIB_ARRAY14_NV 0x865E +#define GL_VERTEX_ATTRIB_ARRAY15_NV 0x865F +#define GL_MAP1_VERTEX_ATTRIB0_4_NV 0x8660 +#define GL_MAP1_VERTEX_ATTRIB1_4_NV 0x8661 +#define GL_MAP1_VERTEX_ATTRIB2_4_NV 0x8662 +#define GL_MAP1_VERTEX_ATTRIB3_4_NV 0x8663 +#define GL_MAP1_VERTEX_ATTRIB4_4_NV 0x8664 +#define GL_MAP1_VERTEX_ATTRIB5_4_NV 0x8665 +#define GL_MAP1_VERTEX_ATTRIB6_4_NV 0x8666 +#define GL_MAP1_VERTEX_ATTRIB7_4_NV 0x8667 +#define GL_MAP1_VERTEX_ATTRIB8_4_NV 0x8668 +#define GL_MAP1_VERTEX_ATTRIB9_4_NV 0x8669 +#define GL_MAP1_VERTEX_ATTRIB10_4_NV 0x866A +#define GL_MAP1_VERTEX_ATTRIB11_4_NV 0x866B +#define GL_MAP1_VERTEX_ATTRIB12_4_NV 0x866C +#define GL_MAP1_VERTEX_ATTRIB13_4_NV 0x866D +#define GL_MAP1_VERTEX_ATTRIB14_4_NV 0x866E +#define GL_MAP1_VERTEX_ATTRIB15_4_NV 0x866F +#define GL_MAP2_VERTEX_ATTRIB0_4_NV 0x8670 +#define GL_MAP2_VERTEX_ATTRIB1_4_NV 0x8671 +#define GL_MAP2_VERTEX_ATTRIB2_4_NV 0x8672 +#define GL_MAP2_VERTEX_ATTRIB3_4_NV 0x8673 +#define GL_MAP2_VERTEX_ATTRIB4_4_NV 0x8674 +#define GL_MAP2_VERTEX_ATTRIB5_4_NV 0x8675 +#define GL_MAP2_VERTEX_ATTRIB6_4_NV 0x8676 +#define GL_MAP2_VERTEX_ATTRIB7_4_NV 0x8677 +#define GL_MAP2_VERTEX_ATTRIB8_4_NV 0x8678 +#define GL_MAP2_VERTEX_ATTRIB9_4_NV 0x8679 +#define GL_MAP2_VERTEX_ATTRIB10_4_NV 0x867A +#define GL_MAP2_VERTEX_ATTRIB11_4_NV 0x867B +#define GL_MAP2_VERTEX_ATTRIB12_4_NV 0x867C +#define GL_MAP2_VERTEX_ATTRIB13_4_NV 0x867D +#define GL_MAP2_VERTEX_ATTRIB14_4_NV 0x867E +#define GL_MAP2_VERTEX_ATTRIB15_4_NV 0x867F +typedef GLboolean (APIENTRYP PFNGLAREPROGRAMSRESIDENTNVPROC) (GLsizei n, const GLuint *programs, GLboolean *residences); +typedef void (APIENTRYP PFNGLBINDPROGRAMNVPROC) (GLenum target, GLuint id); +typedef void (APIENTRYP PFNGLDELETEPROGRAMSNVPROC) (GLsizei n, const GLuint *programs); +typedef void (APIENTRYP PFNGLEXECUTEPROGRAMNVPROC) (GLenum target, GLuint id, const GLfloat *params); +typedef void (APIENTRYP PFNGLGENPROGRAMSNVPROC) (GLsizei n, GLuint *programs); +typedef void (APIENTRYP PFNGLGETPROGRAMPARAMETERDVNVPROC) (GLenum target, GLuint index, GLenum pname, GLdouble *params); +typedef void (APIENTRYP PFNGLGETPROGRAMPARAMETERFVNVPROC) (GLenum target, GLuint index, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETPROGRAMIVNVPROC) (GLuint id, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMSTRINGNVPROC) (GLuint id, GLenum pname, GLubyte *program); +typedef void (APIENTRYP PFNGLGETTRACKMATRIXIVNVPROC) (GLenum target, GLuint address, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVNVPROC) (GLuint index, GLenum pname, GLdouble *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVNVPROC) (GLuint index, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVNVPROC) (GLuint index, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVNVPROC) (GLuint index, GLenum pname, void **pointer); +typedef GLboolean (APIENTRYP PFNGLISPROGRAMNVPROC) (GLuint id); +typedef void (APIENTRYP PFNGLLOADPROGRAMNVPROC) (GLenum target, GLuint id, GLsizei len, const GLubyte *program); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4DNVPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4DVNVPROC) (GLenum target, GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4FNVPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4FVNVPROC) (GLenum target, GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETERS4DVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLdouble *v); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETERS4FVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLREQUESTRESIDENTPROGRAMSNVPROC) (GLsizei n, const GLuint *programs); +typedef void (APIENTRYP PFNGLTRACKMATRIXNVPROC) (GLenum target, GLuint address, GLenum matrix, GLenum transform); +typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERNVPROC) (GLuint index, GLint fsize, GLenum type, GLsizei stride, const void *pointer); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DNVPROC) (GLuint index, GLdouble x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVNVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FNVPROC) (GLuint index, GLfloat x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVNVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SNVPROC) (GLuint index, GLshort x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVNVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DNVPROC) (GLuint index, GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVNVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FNVPROC) (GLuint index, GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVNVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SNVPROC) (GLuint index, GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVNVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVNVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVNVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVNVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVNVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVNVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVNVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBNVPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVNVPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS1DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS1FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS1SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS2DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS2FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS2SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS3DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS3FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS3SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS4DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS4FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS4SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS4UBVNVPROC) (GLuint index, GLsizei count, const GLubyte *v); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLboolean APIENTRY glAreProgramsResidentNV (GLsizei n, const GLuint *programs, GLboolean *residences); +GLAPI void APIENTRY glBindProgramNV (GLenum target, GLuint id); +GLAPI void APIENTRY glDeleteProgramsNV (GLsizei n, const GLuint *programs); +GLAPI void APIENTRY glExecuteProgramNV (GLenum target, GLuint id, const GLfloat *params); +GLAPI void APIENTRY glGenProgramsNV (GLsizei n, GLuint *programs); +GLAPI void APIENTRY glGetProgramParameterdvNV (GLenum target, GLuint index, GLenum pname, GLdouble *params); +GLAPI void APIENTRY glGetProgramParameterfvNV (GLenum target, GLuint index, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetProgramivNV (GLuint id, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetProgramStringNV (GLuint id, GLenum pname, GLubyte *program); +GLAPI void APIENTRY glGetTrackMatrixivNV (GLenum target, GLuint address, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetVertexAttribdvNV (GLuint index, GLenum pname, GLdouble *params); +GLAPI void APIENTRY glGetVertexAttribfvNV (GLuint index, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetVertexAttribivNV (GLuint index, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetVertexAttribPointervNV (GLuint index, GLenum pname, void **pointer); +GLAPI GLboolean APIENTRY glIsProgramNV (GLuint id); +GLAPI void APIENTRY glLoadProgramNV (GLenum target, GLuint id, GLsizei len, const GLubyte *program); +GLAPI void APIENTRY glProgramParameter4dNV (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY glProgramParameter4dvNV (GLenum target, GLuint index, const GLdouble *v); +GLAPI void APIENTRY glProgramParameter4fNV (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void APIENTRY glProgramParameter4fvNV (GLenum target, GLuint index, const GLfloat *v); +GLAPI void APIENTRY glProgramParameters4dvNV (GLenum target, GLuint index, GLsizei count, const GLdouble *v); +GLAPI void APIENTRY glProgramParameters4fvNV (GLenum target, GLuint index, GLsizei count, const GLfloat *v); +GLAPI void APIENTRY glRequestResidentProgramsNV (GLsizei n, const GLuint *programs); +GLAPI void APIENTRY glTrackMatrixNV (GLenum target, GLuint address, GLenum matrix, GLenum transform); +GLAPI void APIENTRY glVertexAttribPointerNV (GLuint index, GLint fsize, GLenum type, GLsizei stride, const void *pointer); +GLAPI void APIENTRY glVertexAttrib1dNV (GLuint index, GLdouble x); +GLAPI void APIENTRY glVertexAttrib1dvNV (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttrib1fNV (GLuint index, GLfloat x); +GLAPI void APIENTRY glVertexAttrib1fvNV (GLuint index, const GLfloat *v); +GLAPI void APIENTRY glVertexAttrib1sNV (GLuint index, GLshort x); +GLAPI void APIENTRY glVertexAttrib1svNV (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttrib2dNV (GLuint index, GLdouble x, GLdouble y); +GLAPI void APIENTRY glVertexAttrib2dvNV (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttrib2fNV (GLuint index, GLfloat x, GLfloat y); +GLAPI void APIENTRY glVertexAttrib2fvNV (GLuint index, const GLfloat *v); +GLAPI void APIENTRY glVertexAttrib2sNV (GLuint index, GLshort x, GLshort y); +GLAPI void APIENTRY glVertexAttrib2svNV (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttrib3dNV (GLuint index, GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY glVertexAttrib3dvNV (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttrib3fNV (GLuint index, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glVertexAttrib3fvNV (GLuint index, const GLfloat *v); +GLAPI void APIENTRY glVertexAttrib3sNV (GLuint index, GLshort x, GLshort y, GLshort z); +GLAPI void APIENTRY glVertexAttrib3svNV (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttrib4dNV (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY glVertexAttrib4dvNV (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttrib4fNV (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void APIENTRY glVertexAttrib4fvNV (GLuint index, const GLfloat *v); +GLAPI void APIENTRY glVertexAttrib4sNV (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +GLAPI void APIENTRY glVertexAttrib4svNV (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttrib4ubNV (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +GLAPI void APIENTRY glVertexAttrib4ubvNV (GLuint index, const GLubyte *v); +GLAPI void APIENTRY glVertexAttribs1dvNV (GLuint index, GLsizei count, const GLdouble *v); +GLAPI void APIENTRY glVertexAttribs1fvNV (GLuint index, GLsizei count, const GLfloat *v); +GLAPI void APIENTRY glVertexAttribs1svNV (GLuint index, GLsizei count, const GLshort *v); +GLAPI void APIENTRY glVertexAttribs2dvNV (GLuint index, GLsizei count, const GLdouble *v); +GLAPI void APIENTRY glVertexAttribs2fvNV (GLuint index, GLsizei count, const GLfloat *v); +GLAPI void APIENTRY glVertexAttribs2svNV (GLuint index, GLsizei count, const GLshort *v); +GLAPI void APIENTRY glVertexAttribs3dvNV (GLuint index, GLsizei count, const GLdouble *v); +GLAPI void APIENTRY glVertexAttribs3fvNV (GLuint index, GLsizei count, const GLfloat *v); +GLAPI void APIENTRY glVertexAttribs3svNV (GLuint index, GLsizei count, const GLshort *v); +GLAPI void APIENTRY glVertexAttribs4dvNV (GLuint index, GLsizei count, const GLdouble *v); +GLAPI void APIENTRY glVertexAttribs4fvNV (GLuint index, GLsizei count, const GLfloat *v); +GLAPI void APIENTRY glVertexAttribs4svNV (GLuint index, GLsizei count, const GLshort *v); +GLAPI void APIENTRY glVertexAttribs4ubvNV (GLuint index, GLsizei count, const GLubyte *v); +#endif +#endif /* GL_NV_vertex_program */ + +#ifndef GL_NV_vertex_program1_1 +#define GL_NV_vertex_program1_1 1 +#endif /* GL_NV_vertex_program1_1 */ + +#ifndef GL_NV_vertex_program2 +#define GL_NV_vertex_program2 1 +#endif /* GL_NV_vertex_program2 */ + +#ifndef GL_NV_vertex_program2_option +#define GL_NV_vertex_program2_option 1 +#endif /* GL_NV_vertex_program2_option */ + +#ifndef GL_NV_vertex_program3 +#define GL_NV_vertex_program3 1 +#endif /* GL_NV_vertex_program3 */ + +#ifndef GL_NV_vertex_program4 +#define GL_NV_vertex_program4 1 +#define GL_VERTEX_ATTRIB_ARRAY_INTEGER_NV 0x88FD +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IEXTPROC) (GLuint index, GLint x); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IEXTPROC) (GLuint index, GLint x, GLint y); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IEXTPROC) (GLuint index, GLint x, GLint y, GLint z); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IEXTPROC) (GLuint index, GLint x, GLint y, GLint z, GLint w); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIEXTPROC) (GLuint index, GLuint x); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIEXTPROC) (GLuint index, GLuint x, GLuint y); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIEXTPROC) (GLuint index, GLuint x, GLuint y, GLuint z); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIEXTPROC) (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IVEXTPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IVEXTPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IVEXTPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IVEXTPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIVEXTPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIVEXTPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIVEXTPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIVEXTPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4BVEXTPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4SVEXTPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UBVEXTPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4USVEXTPROC) (GLuint index, const GLushort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBIPOINTEREXTPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIIVEXTPROC) (GLuint index, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIUIVEXTPROC) (GLuint index, GLenum pname, GLuint *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexAttribI1iEXT (GLuint index, GLint x); +GLAPI void APIENTRY glVertexAttribI2iEXT (GLuint index, GLint x, GLint y); +GLAPI void APIENTRY glVertexAttribI3iEXT (GLuint index, GLint x, GLint y, GLint z); +GLAPI void APIENTRY glVertexAttribI4iEXT (GLuint index, GLint x, GLint y, GLint z, GLint w); +GLAPI void APIENTRY glVertexAttribI1uiEXT (GLuint index, GLuint x); +GLAPI void APIENTRY glVertexAttribI2uiEXT (GLuint index, GLuint x, GLuint y); +GLAPI void APIENTRY glVertexAttribI3uiEXT (GLuint index, GLuint x, GLuint y, GLuint z); +GLAPI void APIENTRY glVertexAttribI4uiEXT (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +GLAPI void APIENTRY glVertexAttribI1ivEXT (GLuint index, const GLint *v); +GLAPI void APIENTRY glVertexAttribI2ivEXT (GLuint index, const GLint *v); +GLAPI void APIENTRY glVertexAttribI3ivEXT (GLuint index, const GLint *v); +GLAPI void APIENTRY glVertexAttribI4ivEXT (GLuint index, const GLint *v); +GLAPI void APIENTRY glVertexAttribI1uivEXT (GLuint index, const GLuint *v); +GLAPI void APIENTRY glVertexAttribI2uivEXT (GLuint index, const GLuint *v); +GLAPI void APIENTRY glVertexAttribI3uivEXT (GLuint index, const GLuint *v); +GLAPI void APIENTRY glVertexAttribI4uivEXT (GLuint index, const GLuint *v); +GLAPI void APIENTRY glVertexAttribI4bvEXT (GLuint index, const GLbyte *v); +GLAPI void APIENTRY glVertexAttribI4svEXT (GLuint index, const GLshort *v); +GLAPI void APIENTRY glVertexAttribI4ubvEXT (GLuint index, const GLubyte *v); +GLAPI void APIENTRY glVertexAttribI4usvEXT (GLuint index, const GLushort *v); +GLAPI void APIENTRY glVertexAttribIPointerEXT (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer); +GLAPI void APIENTRY glGetVertexAttribIivEXT (GLuint index, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetVertexAttribIuivEXT (GLuint index, GLenum pname, GLuint *params); +#endif +#endif /* GL_NV_vertex_program4 */ + +#ifndef GL_NV_video_capture +#define GL_NV_video_capture 1 +#define GL_VIDEO_BUFFER_NV 0x9020 +#define GL_VIDEO_BUFFER_BINDING_NV 0x9021 +#define GL_FIELD_UPPER_NV 0x9022 +#define GL_FIELD_LOWER_NV 0x9023 +#define GL_NUM_VIDEO_CAPTURE_STREAMS_NV 0x9024 +#define GL_NEXT_VIDEO_CAPTURE_BUFFER_STATUS_NV 0x9025 +#define GL_VIDEO_CAPTURE_TO_422_SUPPORTED_NV 0x9026 +#define GL_LAST_VIDEO_CAPTURE_STATUS_NV 0x9027 +#define GL_VIDEO_BUFFER_PITCH_NV 0x9028 +#define GL_VIDEO_COLOR_CONVERSION_MATRIX_NV 0x9029 +#define GL_VIDEO_COLOR_CONVERSION_MAX_NV 0x902A +#define GL_VIDEO_COLOR_CONVERSION_MIN_NV 0x902B +#define GL_VIDEO_COLOR_CONVERSION_OFFSET_NV 0x902C +#define GL_VIDEO_BUFFER_INTERNAL_FORMAT_NV 0x902D +#define GL_PARTIAL_SUCCESS_NV 0x902E +#define GL_SUCCESS_NV 0x902F +#define GL_FAILURE_NV 0x9030 +#define GL_YCBYCR8_422_NV 0x9031 +#define GL_YCBAYCR8A_4224_NV 0x9032 +#define GL_Z6Y10Z6CB10Z6Y10Z6CR10_422_NV 0x9033 +#define GL_Z6Y10Z6CB10Z6A10Z6Y10Z6CR10Z6A10_4224_NV 0x9034 +#define GL_Z4Y12Z4CB12Z4Y12Z4CR12_422_NV 0x9035 +#define GL_Z4Y12Z4CB12Z4A12Z4Y12Z4CR12Z4A12_4224_NV 0x9036 +#define GL_Z4Y12Z4CB12Z4CR12_444_NV 0x9037 +#define GL_VIDEO_CAPTURE_FRAME_WIDTH_NV 0x9038 +#define GL_VIDEO_CAPTURE_FRAME_HEIGHT_NV 0x9039 +#define GL_VIDEO_CAPTURE_FIELD_UPPER_HEIGHT_NV 0x903A +#define GL_VIDEO_CAPTURE_FIELD_LOWER_HEIGHT_NV 0x903B +#define GL_VIDEO_CAPTURE_SURFACE_ORIGIN_NV 0x903C +typedef void (APIENTRYP PFNGLBEGINVIDEOCAPTURENVPROC) (GLuint video_capture_slot); +typedef void (APIENTRYP PFNGLBINDVIDEOCAPTURESTREAMBUFFERNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLintptrARB offset); +typedef void (APIENTRYP PFNGLBINDVIDEOCAPTURESTREAMTEXTURENVPROC) (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLenum target, GLuint texture); +typedef void (APIENTRYP PFNGLENDVIDEOCAPTURENVPROC) (GLuint video_capture_slot); +typedef void (APIENTRYP PFNGLGETVIDEOCAPTUREIVNVPROC) (GLuint video_capture_slot, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVIDEOCAPTURESTREAMIVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVIDEOCAPTURESTREAMFVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETVIDEOCAPTURESTREAMDVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, GLdouble *params); +typedef GLenum (APIENTRYP PFNGLVIDEOCAPTURENVPROC) (GLuint video_capture_slot, GLuint *sequence_num, GLuint64EXT *capture_time); +typedef void (APIENTRYP PFNGLVIDEOCAPTURESTREAMPARAMETERIVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLVIDEOCAPTURESTREAMPARAMETERFVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLVIDEOCAPTURESTREAMPARAMETERDVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLdouble *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBeginVideoCaptureNV (GLuint video_capture_slot); +GLAPI void APIENTRY glBindVideoCaptureStreamBufferNV (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLintptrARB offset); +GLAPI void APIENTRY glBindVideoCaptureStreamTextureNV (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLenum target, GLuint texture); +GLAPI void APIENTRY glEndVideoCaptureNV (GLuint video_capture_slot); +GLAPI void APIENTRY glGetVideoCaptureivNV (GLuint video_capture_slot, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetVideoCaptureStreamivNV (GLuint video_capture_slot, GLuint stream, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetVideoCaptureStreamfvNV (GLuint video_capture_slot, GLuint stream, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetVideoCaptureStreamdvNV (GLuint video_capture_slot, GLuint stream, GLenum pname, GLdouble *params); +GLAPI GLenum APIENTRY glVideoCaptureNV (GLuint video_capture_slot, GLuint *sequence_num, GLuint64EXT *capture_time); +GLAPI void APIENTRY glVideoCaptureStreamParameterivNV (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLint *params); +GLAPI void APIENTRY glVideoCaptureStreamParameterfvNV (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glVideoCaptureStreamParameterdvNV (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLdouble *params); +#endif +#endif /* GL_NV_video_capture */ + +#ifndef GL_OML_interlace +#define GL_OML_interlace 1 +#define GL_INTERLACE_OML 0x8980 +#define GL_INTERLACE_READ_OML 0x8981 +#endif /* GL_OML_interlace */ + +#ifndef GL_OML_resample +#define GL_OML_resample 1 +#define GL_PACK_RESAMPLE_OML 0x8984 +#define GL_UNPACK_RESAMPLE_OML 0x8985 +#define GL_RESAMPLE_REPLICATE_OML 0x8986 +#define GL_RESAMPLE_ZERO_FILL_OML 0x8987 +#define GL_RESAMPLE_AVERAGE_OML 0x8988 +#define GL_RESAMPLE_DECIMATE_OML 0x8989 +#endif /* GL_OML_resample */ + +#ifndef GL_OML_subsample +#define GL_OML_subsample 1 +#define GL_FORMAT_SUBSAMPLE_24_24_OML 0x8982 +#define GL_FORMAT_SUBSAMPLE_244_244_OML 0x8983 +#endif /* GL_OML_subsample */ + +#ifndef GL_PGI_misc_hints +#define GL_PGI_misc_hints 1 +#define GL_PREFER_DOUBLEBUFFER_HINT_PGI 0x1A1F8 +#define GL_CONSERVE_MEMORY_HINT_PGI 0x1A1FD +#define GL_RECLAIM_MEMORY_HINT_PGI 0x1A1FE +#define GL_NATIVE_GRAPHICS_HANDLE_PGI 0x1A202 +#define GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI 0x1A203 +#define GL_NATIVE_GRAPHICS_END_HINT_PGI 0x1A204 +#define GL_ALWAYS_FAST_HINT_PGI 0x1A20C +#define GL_ALWAYS_SOFT_HINT_PGI 0x1A20D +#define GL_ALLOW_DRAW_OBJ_HINT_PGI 0x1A20E +#define GL_ALLOW_DRAW_WIN_HINT_PGI 0x1A20F +#define GL_ALLOW_DRAW_FRG_HINT_PGI 0x1A210 +#define GL_ALLOW_DRAW_MEM_HINT_PGI 0x1A211 +#define GL_STRICT_DEPTHFUNC_HINT_PGI 0x1A216 +#define GL_STRICT_LIGHTING_HINT_PGI 0x1A217 +#define GL_STRICT_SCISSOR_HINT_PGI 0x1A218 +#define GL_FULL_STIPPLE_HINT_PGI 0x1A219 +#define GL_CLIP_NEAR_HINT_PGI 0x1A220 +#define GL_CLIP_FAR_HINT_PGI 0x1A221 +#define GL_WIDE_LINE_HINT_PGI 0x1A222 +#define GL_BACK_NORMALS_HINT_PGI 0x1A223 +typedef void (APIENTRYP PFNGLHINTPGIPROC) (GLenum target, GLint mode); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glHintPGI (GLenum target, GLint mode); +#endif +#endif /* GL_PGI_misc_hints */ + +#ifndef GL_PGI_vertex_hints +#define GL_PGI_vertex_hints 1 +#define GL_VERTEX_DATA_HINT_PGI 0x1A22A +#define GL_VERTEX_CONSISTENT_HINT_PGI 0x1A22B +#define GL_MATERIAL_SIDE_HINT_PGI 0x1A22C +#define GL_MAX_VERTEX_HINT_PGI 0x1A22D +#define GL_COLOR3_BIT_PGI 0x00010000 +#define GL_COLOR4_BIT_PGI 0x00020000 +#define GL_EDGEFLAG_BIT_PGI 0x00040000 +#define GL_INDEX_BIT_PGI 0x00080000 +#define GL_MAT_AMBIENT_BIT_PGI 0x00100000 +#define GL_MAT_AMBIENT_AND_DIFFUSE_BIT_PGI 0x00200000 +#define GL_MAT_DIFFUSE_BIT_PGI 0x00400000 +#define GL_MAT_EMISSION_BIT_PGI 0x00800000 +#define GL_MAT_COLOR_INDEXES_BIT_PGI 0x01000000 +#define GL_MAT_SHININESS_BIT_PGI 0x02000000 +#define GL_MAT_SPECULAR_BIT_PGI 0x04000000 +#define GL_NORMAL_BIT_PGI 0x08000000 +#define GL_TEXCOORD1_BIT_PGI 0x10000000 +#define GL_TEXCOORD2_BIT_PGI 0x20000000 +#define GL_TEXCOORD3_BIT_PGI 0x40000000 +#define GL_TEXCOORD4_BIT_PGI 0x80000000 +#define GL_VERTEX23_BIT_PGI 0x00000004 +#define GL_VERTEX4_BIT_PGI 0x00000008 +#endif /* GL_PGI_vertex_hints */ + +#ifndef GL_REND_screen_coordinates +#define GL_REND_screen_coordinates 1 +#define GL_SCREEN_COORDINATES_REND 0x8490 +#define GL_INVERTED_SCREEN_W_REND 0x8491 +#endif /* GL_REND_screen_coordinates */ + +#ifndef GL_S3_s3tc +#define GL_S3_s3tc 1 +#define GL_RGB_S3TC 0x83A0 +#define GL_RGB4_S3TC 0x83A1 +#define GL_RGBA_S3TC 0x83A2 +#define GL_RGBA4_S3TC 0x83A3 +#define GL_RGBA_DXT5_S3TC 0x83A4 +#define GL_RGBA4_DXT5_S3TC 0x83A5 +#endif /* GL_S3_s3tc */ + +#ifndef GL_SGIS_detail_texture +#define GL_SGIS_detail_texture 1 +#define GL_DETAIL_TEXTURE_2D_SGIS 0x8095 +#define GL_DETAIL_TEXTURE_2D_BINDING_SGIS 0x8096 +#define GL_LINEAR_DETAIL_SGIS 0x8097 +#define GL_LINEAR_DETAIL_ALPHA_SGIS 0x8098 +#define GL_LINEAR_DETAIL_COLOR_SGIS 0x8099 +#define GL_DETAIL_TEXTURE_LEVEL_SGIS 0x809A +#define GL_DETAIL_TEXTURE_MODE_SGIS 0x809B +#define GL_DETAIL_TEXTURE_FUNC_POINTS_SGIS 0x809C +typedef void (APIENTRYP PFNGLDETAILTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat *points); +typedef void (APIENTRYP PFNGLGETDETAILTEXFUNCSGISPROC) (GLenum target, GLfloat *points); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDetailTexFuncSGIS (GLenum target, GLsizei n, const GLfloat *points); +GLAPI void APIENTRY glGetDetailTexFuncSGIS (GLenum target, GLfloat *points); +#endif +#endif /* GL_SGIS_detail_texture */ + +#ifndef GL_SGIS_fog_function +#define GL_SGIS_fog_function 1 +#define GL_FOG_FUNC_SGIS 0x812A +#define GL_FOG_FUNC_POINTS_SGIS 0x812B +#define GL_MAX_FOG_FUNC_POINTS_SGIS 0x812C +typedef void (APIENTRYP PFNGLFOGFUNCSGISPROC) (GLsizei n, const GLfloat *points); +typedef void (APIENTRYP PFNGLGETFOGFUNCSGISPROC) (GLfloat *points); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFogFuncSGIS (GLsizei n, const GLfloat *points); +GLAPI void APIENTRY glGetFogFuncSGIS (GLfloat *points); +#endif +#endif /* GL_SGIS_fog_function */ + +#ifndef GL_SGIS_generate_mipmap +#define GL_SGIS_generate_mipmap 1 +#define GL_GENERATE_MIPMAP_SGIS 0x8191 +#define GL_GENERATE_MIPMAP_HINT_SGIS 0x8192 +#endif /* GL_SGIS_generate_mipmap */ + +#ifndef GL_SGIS_multisample +#define GL_SGIS_multisample 1 +#define GL_MULTISAMPLE_SGIS 0x809D +#define GL_SAMPLE_ALPHA_TO_MASK_SGIS 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE_SGIS 0x809F +#define GL_SAMPLE_MASK_SGIS 0x80A0 +#define GL_1PASS_SGIS 0x80A1 +#define GL_2PASS_0_SGIS 0x80A2 +#define GL_2PASS_1_SGIS 0x80A3 +#define GL_4PASS_0_SGIS 0x80A4 +#define GL_4PASS_1_SGIS 0x80A5 +#define GL_4PASS_2_SGIS 0x80A6 +#define GL_4PASS_3_SGIS 0x80A7 +#define GL_SAMPLE_BUFFERS_SGIS 0x80A8 +#define GL_SAMPLES_SGIS 0x80A9 +#define GL_SAMPLE_MASK_VALUE_SGIS 0x80AA +#define GL_SAMPLE_MASK_INVERT_SGIS 0x80AB +#define GL_SAMPLE_PATTERN_SGIS 0x80AC +typedef void (APIENTRYP PFNGLSAMPLEMASKSGISPROC) (GLclampf value, GLboolean invert); +typedef void (APIENTRYP PFNGLSAMPLEPATTERNSGISPROC) (GLenum pattern); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSampleMaskSGIS (GLclampf value, GLboolean invert); +GLAPI void APIENTRY glSamplePatternSGIS (GLenum pattern); +#endif +#endif /* GL_SGIS_multisample */ + +#ifndef GL_SGIS_pixel_texture +#define GL_SGIS_pixel_texture 1 +#define GL_PIXEL_TEXTURE_SGIS 0x8353 +#define GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS 0x8354 +#define GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS 0x8355 +#define GL_PIXEL_GROUP_COLOR_SGIS 0x8356 +typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERISGISPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERIVSGISPROC) (GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERFSGISPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERFVSGISPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLGETPIXELTEXGENPARAMETERIVSGISPROC) (GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETPIXELTEXGENPARAMETERFVSGISPROC) (GLenum pname, GLfloat *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPixelTexGenParameteriSGIS (GLenum pname, GLint param); +GLAPI void APIENTRY glPixelTexGenParameterivSGIS (GLenum pname, const GLint *params); +GLAPI void APIENTRY glPixelTexGenParameterfSGIS (GLenum pname, GLfloat param); +GLAPI void APIENTRY glPixelTexGenParameterfvSGIS (GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glGetPixelTexGenParameterivSGIS (GLenum pname, GLint *params); +GLAPI void APIENTRY glGetPixelTexGenParameterfvSGIS (GLenum pname, GLfloat *params); +#endif +#endif /* GL_SGIS_pixel_texture */ + +#ifndef GL_SGIS_point_line_texgen +#define GL_SGIS_point_line_texgen 1 +#define GL_EYE_DISTANCE_TO_POINT_SGIS 0x81F0 +#define GL_OBJECT_DISTANCE_TO_POINT_SGIS 0x81F1 +#define GL_EYE_DISTANCE_TO_LINE_SGIS 0x81F2 +#define GL_OBJECT_DISTANCE_TO_LINE_SGIS 0x81F3 +#define GL_EYE_POINT_SGIS 0x81F4 +#define GL_OBJECT_POINT_SGIS 0x81F5 +#define GL_EYE_LINE_SGIS 0x81F6 +#define GL_OBJECT_LINE_SGIS 0x81F7 +#endif /* GL_SGIS_point_line_texgen */ + +#ifndef GL_SGIS_point_parameters +#define GL_SGIS_point_parameters 1 +#define GL_POINT_SIZE_MIN_SGIS 0x8126 +#define GL_POINT_SIZE_MAX_SGIS 0x8127 +#define GL_POINT_FADE_THRESHOLD_SIZE_SGIS 0x8128 +#define GL_DISTANCE_ATTENUATION_SGIS 0x8129 +typedef void (APIENTRYP PFNGLPOINTPARAMETERFSGISPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERFVSGISPROC) (GLenum pname, const GLfloat *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPointParameterfSGIS (GLenum pname, GLfloat param); +GLAPI void APIENTRY glPointParameterfvSGIS (GLenum pname, const GLfloat *params); +#endif +#endif /* GL_SGIS_point_parameters */ + +#ifndef GL_SGIS_sharpen_texture +#define GL_SGIS_sharpen_texture 1 +#define GL_LINEAR_SHARPEN_SGIS 0x80AD +#define GL_LINEAR_SHARPEN_ALPHA_SGIS 0x80AE +#define GL_LINEAR_SHARPEN_COLOR_SGIS 0x80AF +#define GL_SHARPEN_TEXTURE_FUNC_POINTS_SGIS 0x80B0 +typedef void (APIENTRYP PFNGLSHARPENTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat *points); +typedef void (APIENTRYP PFNGLGETSHARPENTEXFUNCSGISPROC) (GLenum target, GLfloat *points); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSharpenTexFuncSGIS (GLenum target, GLsizei n, const GLfloat *points); +GLAPI void APIENTRY glGetSharpenTexFuncSGIS (GLenum target, GLfloat *points); +#endif +#endif /* GL_SGIS_sharpen_texture */ + +#ifndef GL_SGIS_texture4D +#define GL_SGIS_texture4D 1 +#define GL_PACK_SKIP_VOLUMES_SGIS 0x8130 +#define GL_PACK_IMAGE_DEPTH_SGIS 0x8131 +#define GL_UNPACK_SKIP_VOLUMES_SGIS 0x8132 +#define GL_UNPACK_IMAGE_DEPTH_SGIS 0x8133 +#define GL_TEXTURE_4D_SGIS 0x8134 +#define GL_PROXY_TEXTURE_4D_SGIS 0x8135 +#define GL_TEXTURE_4DSIZE_SGIS 0x8136 +#define GL_TEXTURE_WRAP_Q_SGIS 0x8137 +#define GL_MAX_4D_TEXTURE_SIZE_SGIS 0x8138 +#define GL_TEXTURE_4D_BINDING_SGIS 0x814F +typedef void (APIENTRYP PFNGLTEXIMAGE4DSGISPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLint border, GLenum format, GLenum type, const void *pixels); +typedef void (APIENTRYP PFNGLTEXSUBIMAGE4DSGISPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLenum format, GLenum type, const void *pixels); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexImage4DSGIS (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLint border, GLenum format, GLenum type, const void *pixels); +GLAPI void APIENTRY glTexSubImage4DSGIS (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLenum format, GLenum type, const void *pixels); +#endif +#endif /* GL_SGIS_texture4D */ + +#ifndef GL_SGIS_texture_border_clamp +#define GL_SGIS_texture_border_clamp 1 +#define GL_CLAMP_TO_BORDER_SGIS 0x812D +#endif /* GL_SGIS_texture_border_clamp */ + +#ifndef GL_SGIS_texture_color_mask +#define GL_SGIS_texture_color_mask 1 +#define GL_TEXTURE_COLOR_WRITEMASK_SGIS 0x81EF +typedef void (APIENTRYP PFNGLTEXTURECOLORMASKSGISPROC) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTextureColorMaskSGIS (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); +#endif +#endif /* GL_SGIS_texture_color_mask */ + +#ifndef GL_SGIS_texture_edge_clamp +#define GL_SGIS_texture_edge_clamp 1 +#define GL_CLAMP_TO_EDGE_SGIS 0x812F +#endif /* GL_SGIS_texture_edge_clamp */ + +#ifndef GL_SGIS_texture_filter4 +#define GL_SGIS_texture_filter4 1 +#define GL_FILTER4_SGIS 0x8146 +#define GL_TEXTURE_FILTER4_SIZE_SGIS 0x8147 +typedef void (APIENTRYP PFNGLGETTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLfloat *weights); +typedef void (APIENTRYP PFNGLTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLsizei n, const GLfloat *weights); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetTexFilterFuncSGIS (GLenum target, GLenum filter, GLfloat *weights); +GLAPI void APIENTRY glTexFilterFuncSGIS (GLenum target, GLenum filter, GLsizei n, const GLfloat *weights); +#endif +#endif /* GL_SGIS_texture_filter4 */ + +#ifndef GL_SGIS_texture_lod +#define GL_SGIS_texture_lod 1 +#define GL_TEXTURE_MIN_LOD_SGIS 0x813A +#define GL_TEXTURE_MAX_LOD_SGIS 0x813B +#define GL_TEXTURE_BASE_LEVEL_SGIS 0x813C +#define GL_TEXTURE_MAX_LEVEL_SGIS 0x813D +#endif /* GL_SGIS_texture_lod */ + +#ifndef GL_SGIS_texture_select +#define GL_SGIS_texture_select 1 +#define GL_DUAL_ALPHA4_SGIS 0x8110 +#define GL_DUAL_ALPHA8_SGIS 0x8111 +#define GL_DUAL_ALPHA12_SGIS 0x8112 +#define GL_DUAL_ALPHA16_SGIS 0x8113 +#define GL_DUAL_LUMINANCE4_SGIS 0x8114 +#define GL_DUAL_LUMINANCE8_SGIS 0x8115 +#define GL_DUAL_LUMINANCE12_SGIS 0x8116 +#define GL_DUAL_LUMINANCE16_SGIS 0x8117 +#define GL_DUAL_INTENSITY4_SGIS 0x8118 +#define GL_DUAL_INTENSITY8_SGIS 0x8119 +#define GL_DUAL_INTENSITY12_SGIS 0x811A +#define GL_DUAL_INTENSITY16_SGIS 0x811B +#define GL_DUAL_LUMINANCE_ALPHA4_SGIS 0x811C +#define GL_DUAL_LUMINANCE_ALPHA8_SGIS 0x811D +#define GL_QUAD_ALPHA4_SGIS 0x811E +#define GL_QUAD_ALPHA8_SGIS 0x811F +#define GL_QUAD_LUMINANCE4_SGIS 0x8120 +#define GL_QUAD_LUMINANCE8_SGIS 0x8121 +#define GL_QUAD_INTENSITY4_SGIS 0x8122 +#define GL_QUAD_INTENSITY8_SGIS 0x8123 +#define GL_DUAL_TEXTURE_SELECT_SGIS 0x8124 +#define GL_QUAD_TEXTURE_SELECT_SGIS 0x8125 +#endif /* GL_SGIS_texture_select */ + +#ifndef GL_SGIX_async +#define GL_SGIX_async 1 +#define GL_ASYNC_MARKER_SGIX 0x8329 +typedef void (APIENTRYP PFNGLASYNCMARKERSGIXPROC) (GLuint marker); +typedef GLint (APIENTRYP PFNGLFINISHASYNCSGIXPROC) (GLuint *markerp); +typedef GLint (APIENTRYP PFNGLPOLLASYNCSGIXPROC) (GLuint *markerp); +typedef GLuint (APIENTRYP PFNGLGENASYNCMARKERSSGIXPROC) (GLsizei range); +typedef void (APIENTRYP PFNGLDELETEASYNCMARKERSSGIXPROC) (GLuint marker, GLsizei range); +typedef GLboolean (APIENTRYP PFNGLISASYNCMARKERSGIXPROC) (GLuint marker); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glAsyncMarkerSGIX (GLuint marker); +GLAPI GLint APIENTRY glFinishAsyncSGIX (GLuint *markerp); +GLAPI GLint APIENTRY glPollAsyncSGIX (GLuint *markerp); +GLAPI GLuint APIENTRY glGenAsyncMarkersSGIX (GLsizei range); +GLAPI void APIENTRY glDeleteAsyncMarkersSGIX (GLuint marker, GLsizei range); +GLAPI GLboolean APIENTRY glIsAsyncMarkerSGIX (GLuint marker); +#endif +#endif /* GL_SGIX_async */ + +#ifndef GL_SGIX_async_histogram +#define GL_SGIX_async_histogram 1 +#define GL_ASYNC_HISTOGRAM_SGIX 0x832C +#define GL_MAX_ASYNC_HISTOGRAM_SGIX 0x832D +#endif /* GL_SGIX_async_histogram */ + +#ifndef GL_SGIX_async_pixel +#define GL_SGIX_async_pixel 1 +#define GL_ASYNC_TEX_IMAGE_SGIX 0x835C +#define GL_ASYNC_DRAW_PIXELS_SGIX 0x835D +#define GL_ASYNC_READ_PIXELS_SGIX 0x835E +#define GL_MAX_ASYNC_TEX_IMAGE_SGIX 0x835F +#define GL_MAX_ASYNC_DRAW_PIXELS_SGIX 0x8360 +#define GL_MAX_ASYNC_READ_PIXELS_SGIX 0x8361 +#endif /* GL_SGIX_async_pixel */ + +#ifndef GL_SGIX_blend_alpha_minmax +#define GL_SGIX_blend_alpha_minmax 1 +#define GL_ALPHA_MIN_SGIX 0x8320 +#define GL_ALPHA_MAX_SGIX 0x8321 +#endif /* GL_SGIX_blend_alpha_minmax */ + +#ifndef GL_SGIX_calligraphic_fragment +#define GL_SGIX_calligraphic_fragment 1 +#define GL_CALLIGRAPHIC_FRAGMENT_SGIX 0x8183 +#endif /* GL_SGIX_calligraphic_fragment */ + +#ifndef GL_SGIX_clipmap +#define GL_SGIX_clipmap 1 +#define GL_LINEAR_CLIPMAP_LINEAR_SGIX 0x8170 +#define GL_TEXTURE_CLIPMAP_CENTER_SGIX 0x8171 +#define GL_TEXTURE_CLIPMAP_FRAME_SGIX 0x8172 +#define GL_TEXTURE_CLIPMAP_OFFSET_SGIX 0x8173 +#define GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX 0x8174 +#define GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX 0x8175 +#define GL_TEXTURE_CLIPMAP_DEPTH_SGIX 0x8176 +#define GL_MAX_CLIPMAP_DEPTH_SGIX 0x8177 +#define GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX 0x8178 +#define GL_NEAREST_CLIPMAP_NEAREST_SGIX 0x844D +#define GL_NEAREST_CLIPMAP_LINEAR_SGIX 0x844E +#define GL_LINEAR_CLIPMAP_NEAREST_SGIX 0x844F +#endif /* GL_SGIX_clipmap */ + +#ifndef GL_SGIX_convolution_accuracy +#define GL_SGIX_convolution_accuracy 1 +#define GL_CONVOLUTION_HINT_SGIX 0x8316 +#endif /* GL_SGIX_convolution_accuracy */ + +#ifndef GL_SGIX_depth_pass_instrument +#define GL_SGIX_depth_pass_instrument 1 +#endif /* GL_SGIX_depth_pass_instrument */ + +#ifndef GL_SGIX_depth_texture +#define GL_SGIX_depth_texture 1 +#define GL_DEPTH_COMPONENT16_SGIX 0x81A5 +#define GL_DEPTH_COMPONENT24_SGIX 0x81A6 +#define GL_DEPTH_COMPONENT32_SGIX 0x81A7 +#endif /* GL_SGIX_depth_texture */ + +#ifndef GL_SGIX_flush_raster +#define GL_SGIX_flush_raster 1 +typedef void (APIENTRYP PFNGLFLUSHRASTERSGIXPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFlushRasterSGIX (void); +#endif +#endif /* GL_SGIX_flush_raster */ + +#ifndef GL_SGIX_fog_offset +#define GL_SGIX_fog_offset 1 +#define GL_FOG_OFFSET_SGIX 0x8198 +#define GL_FOG_OFFSET_VALUE_SGIX 0x8199 +#endif /* GL_SGIX_fog_offset */ + +#ifndef GL_SGIX_fragment_lighting +#define GL_SGIX_fragment_lighting 1 +#define GL_FRAGMENT_LIGHTING_SGIX 0x8400 +#define GL_FRAGMENT_COLOR_MATERIAL_SGIX 0x8401 +#define GL_FRAGMENT_COLOR_MATERIAL_FACE_SGIX 0x8402 +#define GL_FRAGMENT_COLOR_MATERIAL_PARAMETER_SGIX 0x8403 +#define GL_MAX_FRAGMENT_LIGHTS_SGIX 0x8404 +#define GL_MAX_ACTIVE_LIGHTS_SGIX 0x8405 +#define GL_CURRENT_RASTER_NORMAL_SGIX 0x8406 +#define GL_LIGHT_ENV_MODE_SGIX 0x8407 +#define GL_FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_SGIX 0x8408 +#define GL_FRAGMENT_LIGHT_MODEL_TWO_SIDE_SGIX 0x8409 +#define GL_FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX 0x840A +#define GL_FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX 0x840B +#define GL_FRAGMENT_LIGHT0_SGIX 0x840C +#define GL_FRAGMENT_LIGHT1_SGIX 0x840D +#define GL_FRAGMENT_LIGHT2_SGIX 0x840E +#define GL_FRAGMENT_LIGHT3_SGIX 0x840F +#define GL_FRAGMENT_LIGHT4_SGIX 0x8410 +#define GL_FRAGMENT_LIGHT5_SGIX 0x8411 +#define GL_FRAGMENT_LIGHT6_SGIX 0x8412 +#define GL_FRAGMENT_LIGHT7_SGIX 0x8413 +typedef void (APIENTRYP PFNGLFRAGMENTCOLORMATERIALSGIXPROC) (GLenum face, GLenum mode); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTFSGIXPROC) (GLenum light, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTISGIXPROC) (GLenum light, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELFSGIXPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELFVSGIXPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELISGIXPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELIVSGIXPROC) (GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLFRAGMENTMATERIALFSGIXPROC) (GLenum face, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLFRAGMENTMATERIALISGIXPROC) (GLenum face, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLGETFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLLIGHTENVISGIXPROC) (GLenum pname, GLint param); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFragmentColorMaterialSGIX (GLenum face, GLenum mode); +GLAPI void APIENTRY glFragmentLightfSGIX (GLenum light, GLenum pname, GLfloat param); +GLAPI void APIENTRY glFragmentLightfvSGIX (GLenum light, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glFragmentLightiSGIX (GLenum light, GLenum pname, GLint param); +GLAPI void APIENTRY glFragmentLightivSGIX (GLenum light, GLenum pname, const GLint *params); +GLAPI void APIENTRY glFragmentLightModelfSGIX (GLenum pname, GLfloat param); +GLAPI void APIENTRY glFragmentLightModelfvSGIX (GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glFragmentLightModeliSGIX (GLenum pname, GLint param); +GLAPI void APIENTRY glFragmentLightModelivSGIX (GLenum pname, const GLint *params); +GLAPI void APIENTRY glFragmentMaterialfSGIX (GLenum face, GLenum pname, GLfloat param); +GLAPI void APIENTRY glFragmentMaterialfvSGIX (GLenum face, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glFragmentMaterialiSGIX (GLenum face, GLenum pname, GLint param); +GLAPI void APIENTRY glFragmentMaterialivSGIX (GLenum face, GLenum pname, const GLint *params); +GLAPI void APIENTRY glGetFragmentLightfvSGIX (GLenum light, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetFragmentLightivSGIX (GLenum light, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetFragmentMaterialfvSGIX (GLenum face, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetFragmentMaterialivSGIX (GLenum face, GLenum pname, GLint *params); +GLAPI void APIENTRY glLightEnviSGIX (GLenum pname, GLint param); +#endif +#endif /* GL_SGIX_fragment_lighting */ + +#ifndef GL_SGIX_framezoom +#define GL_SGIX_framezoom 1 +#define GL_FRAMEZOOM_SGIX 0x818B +#define GL_FRAMEZOOM_FACTOR_SGIX 0x818C +#define GL_MAX_FRAMEZOOM_FACTOR_SGIX 0x818D +typedef void (APIENTRYP PFNGLFRAMEZOOMSGIXPROC) (GLint factor); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFrameZoomSGIX (GLint factor); +#endif +#endif /* GL_SGIX_framezoom */ + +#ifndef GL_SGIX_igloo_interface +#define GL_SGIX_igloo_interface 1 +typedef void (APIENTRYP PFNGLIGLOOINTERFACESGIXPROC) (GLenum pname, const void *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glIglooInterfaceSGIX (GLenum pname, const void *params); +#endif +#endif /* GL_SGIX_igloo_interface */ + +#ifndef GL_SGIX_instruments +#define GL_SGIX_instruments 1 +#define GL_INSTRUMENT_BUFFER_POINTER_SGIX 0x8180 +#define GL_INSTRUMENT_MEASUREMENTS_SGIX 0x8181 +typedef GLint (APIENTRYP PFNGLGETINSTRUMENTSSGIXPROC) (void); +typedef void (APIENTRYP PFNGLINSTRUMENTSBUFFERSGIXPROC) (GLsizei size, GLint *buffer); +typedef GLint (APIENTRYP PFNGLPOLLINSTRUMENTSSGIXPROC) (GLint *marker_p); +typedef void (APIENTRYP PFNGLREADINSTRUMENTSSGIXPROC) (GLint marker); +typedef void (APIENTRYP PFNGLSTARTINSTRUMENTSSGIXPROC) (void); +typedef void (APIENTRYP PFNGLSTOPINSTRUMENTSSGIXPROC) (GLint marker); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLint APIENTRY glGetInstrumentsSGIX (void); +GLAPI void APIENTRY glInstrumentsBufferSGIX (GLsizei size, GLint *buffer); +GLAPI GLint APIENTRY glPollInstrumentsSGIX (GLint *marker_p); +GLAPI void APIENTRY glReadInstrumentsSGIX (GLint marker); +GLAPI void APIENTRY glStartInstrumentsSGIX (void); +GLAPI void APIENTRY glStopInstrumentsSGIX (GLint marker); +#endif +#endif /* GL_SGIX_instruments */ + +#ifndef GL_SGIX_interlace +#define GL_SGIX_interlace 1 +#define GL_INTERLACE_SGIX 0x8094 +#endif /* GL_SGIX_interlace */ + +#ifndef GL_SGIX_ir_instrument1 +#define GL_SGIX_ir_instrument1 1 +#define GL_IR_INSTRUMENT1_SGIX 0x817F +#endif /* GL_SGIX_ir_instrument1 */ + +#ifndef GL_SGIX_list_priority +#define GL_SGIX_list_priority 1 +#define GL_LIST_PRIORITY_SGIX 0x8182 +typedef void (APIENTRYP PFNGLGETLISTPARAMETERFVSGIXPROC) (GLuint list, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETLISTPARAMETERIVSGIXPROC) (GLuint list, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLLISTPARAMETERFSGIXPROC) (GLuint list, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLLISTPARAMETERFVSGIXPROC) (GLuint list, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLLISTPARAMETERISGIXPROC) (GLuint list, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLLISTPARAMETERIVSGIXPROC) (GLuint list, GLenum pname, const GLint *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetListParameterfvSGIX (GLuint list, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetListParameterivSGIX (GLuint list, GLenum pname, GLint *params); +GLAPI void APIENTRY glListParameterfSGIX (GLuint list, GLenum pname, GLfloat param); +GLAPI void APIENTRY glListParameterfvSGIX (GLuint list, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glListParameteriSGIX (GLuint list, GLenum pname, GLint param); +GLAPI void APIENTRY glListParameterivSGIX (GLuint list, GLenum pname, const GLint *params); +#endif +#endif /* GL_SGIX_list_priority */ + +#ifndef GL_SGIX_pixel_texture +#define GL_SGIX_pixel_texture 1 +#define GL_PIXEL_TEX_GEN_SGIX 0x8139 +#define GL_PIXEL_TEX_GEN_MODE_SGIX 0x832B +typedef void (APIENTRYP PFNGLPIXELTEXGENSGIXPROC) (GLenum mode); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPixelTexGenSGIX (GLenum mode); +#endif +#endif /* GL_SGIX_pixel_texture */ + +#ifndef GL_SGIX_pixel_tiles +#define GL_SGIX_pixel_tiles 1 +#define GL_PIXEL_TILE_BEST_ALIGNMENT_SGIX 0x813E +#define GL_PIXEL_TILE_CACHE_INCREMENT_SGIX 0x813F +#define GL_PIXEL_TILE_WIDTH_SGIX 0x8140 +#define GL_PIXEL_TILE_HEIGHT_SGIX 0x8141 +#define GL_PIXEL_TILE_GRID_WIDTH_SGIX 0x8142 +#define GL_PIXEL_TILE_GRID_HEIGHT_SGIX 0x8143 +#define GL_PIXEL_TILE_GRID_DEPTH_SGIX 0x8144 +#define GL_PIXEL_TILE_CACHE_SIZE_SGIX 0x8145 +#endif /* GL_SGIX_pixel_tiles */ + +#ifndef GL_SGIX_polynomial_ffd +#define GL_SGIX_polynomial_ffd 1 +#define GL_TEXTURE_DEFORMATION_BIT_SGIX 0x00000001 +#define GL_GEOMETRY_DEFORMATION_BIT_SGIX 0x00000002 +#define GL_GEOMETRY_DEFORMATION_SGIX 0x8194 +#define GL_TEXTURE_DEFORMATION_SGIX 0x8195 +#define GL_DEFORMATIONS_MASK_SGIX 0x8196 +#define GL_MAX_DEFORMATION_ORDER_SGIX 0x8197 +typedef void (APIENTRYP PFNGLDEFORMATIONMAP3DSGIXPROC) (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, GLdouble w1, GLdouble w2, GLint wstride, GLint worder, const GLdouble *points); +typedef void (APIENTRYP PFNGLDEFORMATIONMAP3FSGIXPROC) (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, GLfloat w1, GLfloat w2, GLint wstride, GLint worder, const GLfloat *points); +typedef void (APIENTRYP PFNGLDEFORMSGIXPROC) (GLbitfield mask); +typedef void (APIENTRYP PFNGLLOADIDENTITYDEFORMATIONMAPSGIXPROC) (GLbitfield mask); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDeformationMap3dSGIX (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, GLdouble w1, GLdouble w2, GLint wstride, GLint worder, const GLdouble *points); +GLAPI void APIENTRY glDeformationMap3fSGIX (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, GLfloat w1, GLfloat w2, GLint wstride, GLint worder, const GLfloat *points); +GLAPI void APIENTRY glDeformSGIX (GLbitfield mask); +GLAPI void APIENTRY glLoadIdentityDeformationMapSGIX (GLbitfield mask); +#endif +#endif /* GL_SGIX_polynomial_ffd */ + +#ifndef GL_SGIX_reference_plane +#define GL_SGIX_reference_plane 1 +#define GL_REFERENCE_PLANE_SGIX 0x817D +#define GL_REFERENCE_PLANE_EQUATION_SGIX 0x817E +typedef void (APIENTRYP PFNGLREFERENCEPLANESGIXPROC) (const GLdouble *equation); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glReferencePlaneSGIX (const GLdouble *equation); +#endif +#endif /* GL_SGIX_reference_plane */ + +#ifndef GL_SGIX_resample +#define GL_SGIX_resample 1 +#define GL_PACK_RESAMPLE_SGIX 0x842C +#define GL_UNPACK_RESAMPLE_SGIX 0x842D +#define GL_RESAMPLE_REPLICATE_SGIX 0x842E +#define GL_RESAMPLE_ZERO_FILL_SGIX 0x842F +#define GL_RESAMPLE_DECIMATE_SGIX 0x8430 +#endif /* GL_SGIX_resample */ + +#ifndef GL_SGIX_scalebias_hint +#define GL_SGIX_scalebias_hint 1 +#define GL_SCALEBIAS_HINT_SGIX 0x8322 +#endif /* GL_SGIX_scalebias_hint */ + +#ifndef GL_SGIX_shadow +#define GL_SGIX_shadow 1 +#define GL_TEXTURE_COMPARE_SGIX 0x819A +#define GL_TEXTURE_COMPARE_OPERATOR_SGIX 0x819B +#define GL_TEXTURE_LEQUAL_R_SGIX 0x819C +#define GL_TEXTURE_GEQUAL_R_SGIX 0x819D +#endif /* GL_SGIX_shadow */ + +#ifndef GL_SGIX_shadow_ambient +#define GL_SGIX_shadow_ambient 1 +#define GL_SHADOW_AMBIENT_SGIX 0x80BF +#endif /* GL_SGIX_shadow_ambient */ + +#ifndef GL_SGIX_sprite +#define GL_SGIX_sprite 1 +#define GL_SPRITE_SGIX 0x8148 +#define GL_SPRITE_MODE_SGIX 0x8149 +#define GL_SPRITE_AXIS_SGIX 0x814A +#define GL_SPRITE_TRANSLATION_SGIX 0x814B +#define GL_SPRITE_AXIAL_SGIX 0x814C +#define GL_SPRITE_OBJECT_ALIGNED_SGIX 0x814D +#define GL_SPRITE_EYE_ALIGNED_SGIX 0x814E +typedef void (APIENTRYP PFNGLSPRITEPARAMETERFSGIXPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLSPRITEPARAMETERFVSGIXPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLSPRITEPARAMETERISGIXPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLSPRITEPARAMETERIVSGIXPROC) (GLenum pname, const GLint *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSpriteParameterfSGIX (GLenum pname, GLfloat param); +GLAPI void APIENTRY glSpriteParameterfvSGIX (GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glSpriteParameteriSGIX (GLenum pname, GLint param); +GLAPI void APIENTRY glSpriteParameterivSGIX (GLenum pname, const GLint *params); +#endif +#endif /* GL_SGIX_sprite */ + +#ifndef GL_SGIX_subsample +#define GL_SGIX_subsample 1 +#define GL_PACK_SUBSAMPLE_RATE_SGIX 0x85A0 +#define GL_UNPACK_SUBSAMPLE_RATE_SGIX 0x85A1 +#define GL_PIXEL_SUBSAMPLE_4444_SGIX 0x85A2 +#define GL_PIXEL_SUBSAMPLE_2424_SGIX 0x85A3 +#define GL_PIXEL_SUBSAMPLE_4242_SGIX 0x85A4 +#endif /* GL_SGIX_subsample */ + +#ifndef GL_SGIX_tag_sample_buffer +#define GL_SGIX_tag_sample_buffer 1 +typedef void (APIENTRYP PFNGLTAGSAMPLEBUFFERSGIXPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTagSampleBufferSGIX (void); +#endif +#endif /* GL_SGIX_tag_sample_buffer */ + +#ifndef GL_SGIX_texture_add_env +#define GL_SGIX_texture_add_env 1 +#define GL_TEXTURE_ENV_BIAS_SGIX 0x80BE +#endif /* GL_SGIX_texture_add_env */ + +#ifndef GL_SGIX_texture_coordinate_clamp +#define GL_SGIX_texture_coordinate_clamp 1 +#define GL_TEXTURE_MAX_CLAMP_S_SGIX 0x8369 +#define GL_TEXTURE_MAX_CLAMP_T_SGIX 0x836A +#define GL_TEXTURE_MAX_CLAMP_R_SGIX 0x836B +#endif /* GL_SGIX_texture_coordinate_clamp */ + +#ifndef GL_SGIX_texture_lod_bias +#define GL_SGIX_texture_lod_bias 1 +#define GL_TEXTURE_LOD_BIAS_S_SGIX 0x818E +#define GL_TEXTURE_LOD_BIAS_T_SGIX 0x818F +#define GL_TEXTURE_LOD_BIAS_R_SGIX 0x8190 +#endif /* GL_SGIX_texture_lod_bias */ + +#ifndef GL_SGIX_texture_multi_buffer +#define GL_SGIX_texture_multi_buffer 1 +#define GL_TEXTURE_MULTI_BUFFER_HINT_SGIX 0x812E +#endif /* GL_SGIX_texture_multi_buffer */ + +#ifndef GL_SGIX_texture_scale_bias +#define GL_SGIX_texture_scale_bias 1 +#define GL_POST_TEXTURE_FILTER_BIAS_SGIX 0x8179 +#define GL_POST_TEXTURE_FILTER_SCALE_SGIX 0x817A +#define GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX 0x817B +#define GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX 0x817C +#endif /* GL_SGIX_texture_scale_bias */ + +#ifndef GL_SGIX_vertex_preclip +#define GL_SGIX_vertex_preclip 1 +#define GL_VERTEX_PRECLIP_SGIX 0x83EE +#define GL_VERTEX_PRECLIP_HINT_SGIX 0x83EF +#endif /* GL_SGIX_vertex_preclip */ + +#ifndef GL_SGIX_ycrcb +#define GL_SGIX_ycrcb 1 +#define GL_YCRCB_422_SGIX 0x81BB +#define GL_YCRCB_444_SGIX 0x81BC +#endif /* GL_SGIX_ycrcb */ + +#ifndef GL_SGIX_ycrcb_subsample +#define GL_SGIX_ycrcb_subsample 1 +#endif /* GL_SGIX_ycrcb_subsample */ + +#ifndef GL_SGIX_ycrcba +#define GL_SGIX_ycrcba 1 +#define GL_YCRCB_SGIX 0x8318 +#define GL_YCRCBA_SGIX 0x8319 +#endif /* GL_SGIX_ycrcba */ + +#ifndef GL_SGI_color_matrix +#define GL_SGI_color_matrix 1 +#define GL_COLOR_MATRIX_SGI 0x80B1 +#define GL_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B2 +#define GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B3 +#define GL_POST_COLOR_MATRIX_RED_SCALE_SGI 0x80B4 +#define GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI 0x80B5 +#define GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI 0x80B6 +#define GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI 0x80B7 +#define GL_POST_COLOR_MATRIX_RED_BIAS_SGI 0x80B8 +#define GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI 0x80B9 +#define GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI 0x80BA +#define GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI 0x80BB +#endif /* GL_SGI_color_matrix */ + +#ifndef GL_SGI_color_table +#define GL_SGI_color_table 1 +#define GL_COLOR_TABLE_SGI 0x80D0 +#define GL_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D1 +#define GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D2 +#define GL_PROXY_COLOR_TABLE_SGI 0x80D3 +#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D4 +#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D5 +#define GL_COLOR_TABLE_SCALE_SGI 0x80D6 +#define GL_COLOR_TABLE_BIAS_SGI 0x80D7 +#define GL_COLOR_TABLE_FORMAT_SGI 0x80D8 +#define GL_COLOR_TABLE_WIDTH_SGI 0x80D9 +#define GL_COLOR_TABLE_RED_SIZE_SGI 0x80DA +#define GL_COLOR_TABLE_GREEN_SIZE_SGI 0x80DB +#define GL_COLOR_TABLE_BLUE_SIZE_SGI 0x80DC +#define GL_COLOR_TABLE_ALPHA_SIZE_SGI 0x80DD +#define GL_COLOR_TABLE_LUMINANCE_SIZE_SGI 0x80DE +#define GL_COLOR_TABLE_INTENSITY_SIZE_SGI 0x80DF +typedef void (APIENTRYP PFNGLCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void *table); +typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLCOPYCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLGETCOLORTABLESGIPROC) (GLenum target, GLenum format, GLenum type, void *table); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GLenum pname, GLint *params); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glColorTableSGI (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void *table); +GLAPI void APIENTRY glColorTableParameterfvSGI (GLenum target, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glColorTableParameterivSGI (GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY glCopyColorTableSGI (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +GLAPI void APIENTRY glGetColorTableSGI (GLenum target, GLenum format, GLenum type, void *table); +GLAPI void APIENTRY glGetColorTableParameterfvSGI (GLenum target, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetColorTableParameterivSGI (GLenum target, GLenum pname, GLint *params); +#endif +#endif /* GL_SGI_color_table */ + +#ifndef GL_SGI_texture_color_table +#define GL_SGI_texture_color_table 1 +#define GL_TEXTURE_COLOR_TABLE_SGI 0x80BC +#define GL_PROXY_TEXTURE_COLOR_TABLE_SGI 0x80BD +#endif /* GL_SGI_texture_color_table */ + +#ifndef GL_SUNX_constant_data +#define GL_SUNX_constant_data 1 +#define GL_UNPACK_CONSTANT_DATA_SUNX 0x81D5 +#define GL_TEXTURE_CONSTANT_DATA_SUNX 0x81D6 +typedef void (APIENTRYP PFNGLFINISHTEXTURESUNXPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFinishTextureSUNX (void); +#endif +#endif /* GL_SUNX_constant_data */ + +#ifndef GL_SUN_convolution_border_modes +#define GL_SUN_convolution_border_modes 1 +#define GL_WRAP_BORDER_SUN 0x81D4 +#endif /* GL_SUN_convolution_border_modes */ + +#ifndef GL_SUN_global_alpha +#define GL_SUN_global_alpha 1 +#define GL_GLOBAL_ALPHA_SUN 0x81D9 +#define GL_GLOBAL_ALPHA_FACTOR_SUN 0x81DA +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORBSUNPROC) (GLbyte factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORSSUNPROC) (GLshort factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORISUNPROC) (GLint factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORFSUNPROC) (GLfloat factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORDSUNPROC) (GLdouble factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUBSUNPROC) (GLubyte factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUSSUNPROC) (GLushort factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUISUNPROC) (GLuint factor); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGlobalAlphaFactorbSUN (GLbyte factor); +GLAPI void APIENTRY glGlobalAlphaFactorsSUN (GLshort factor); +GLAPI void APIENTRY glGlobalAlphaFactoriSUN (GLint factor); +GLAPI void APIENTRY glGlobalAlphaFactorfSUN (GLfloat factor); +GLAPI void APIENTRY glGlobalAlphaFactordSUN (GLdouble factor); +GLAPI void APIENTRY glGlobalAlphaFactorubSUN (GLubyte factor); +GLAPI void APIENTRY glGlobalAlphaFactorusSUN (GLushort factor); +GLAPI void APIENTRY glGlobalAlphaFactoruiSUN (GLuint factor); +#endif +#endif /* GL_SUN_global_alpha */ + +#ifndef GL_SUN_mesh_array +#define GL_SUN_mesh_array 1 +#define GL_QUAD_MESH_SUN 0x8614 +#define GL_TRIANGLE_MESH_SUN 0x8615 +typedef void (APIENTRYP PFNGLDRAWMESHARRAYSSUNPROC) (GLenum mode, GLint first, GLsizei count, GLsizei width); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawMeshArraysSUN (GLenum mode, GLint first, GLsizei count, GLsizei width); +#endif +#endif /* GL_SUN_mesh_array */ + +#ifndef GL_SUN_slice_accum +#define GL_SUN_slice_accum 1 +#define GL_SLICE_ACCUM_SUN 0x85CC +#endif /* GL_SUN_slice_accum */ + +#ifndef GL_SUN_triangle_list +#define GL_SUN_triangle_list 1 +#define GL_RESTART_SUN 0x0001 +#define GL_REPLACE_MIDDLE_SUN 0x0002 +#define GL_REPLACE_OLDEST_SUN 0x0003 +#define GL_TRIANGLE_LIST_SUN 0x81D7 +#define GL_REPLACEMENT_CODE_SUN 0x81D8 +#define GL_REPLACEMENT_CODE_ARRAY_SUN 0x85C0 +#define GL_REPLACEMENT_CODE_ARRAY_TYPE_SUN 0x85C1 +#define GL_REPLACEMENT_CODE_ARRAY_STRIDE_SUN 0x85C2 +#define GL_REPLACEMENT_CODE_ARRAY_POINTER_SUN 0x85C3 +#define GL_R1UI_V3F_SUN 0x85C4 +#define GL_R1UI_C4UB_V3F_SUN 0x85C5 +#define GL_R1UI_C3F_V3F_SUN 0x85C6 +#define GL_R1UI_N3F_V3F_SUN 0x85C7 +#define GL_R1UI_C4F_N3F_V3F_SUN 0x85C8 +#define GL_R1UI_T2F_V3F_SUN 0x85C9 +#define GL_R1UI_T2F_N3F_V3F_SUN 0x85CA +#define GL_R1UI_T2F_C4F_N3F_V3F_SUN 0x85CB +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUISUNPROC) (GLuint code); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUSSUNPROC) (GLushort code); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUBSUNPROC) (GLubyte code); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUIVSUNPROC) (const GLuint *code); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUSVSUNPROC) (const GLushort *code); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUBVSUNPROC) (const GLubyte *code); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEPOINTERSUNPROC) (GLenum type, GLsizei stride, const void **pointer); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glReplacementCodeuiSUN (GLuint code); +GLAPI void APIENTRY glReplacementCodeusSUN (GLushort code); +GLAPI void APIENTRY glReplacementCodeubSUN (GLubyte code); +GLAPI void APIENTRY glReplacementCodeuivSUN (const GLuint *code); +GLAPI void APIENTRY glReplacementCodeusvSUN (const GLushort *code); +GLAPI void APIENTRY glReplacementCodeubvSUN (const GLubyte *code); +GLAPI void APIENTRY glReplacementCodePointerSUN (GLenum type, GLsizei stride, const void **pointer); +#endif +#endif /* GL_SUN_triangle_list */ + +#ifndef GL_SUN_vertex +#define GL_SUN_vertex 1 +typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX2FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX2FVSUNPROC) (const GLubyte *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX3FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX3FVSUNPROC) (const GLubyte *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLCOLOR3FVERTEX3FSUNPROC) (GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLCOLOR3FVERTEX3FVSUNPROC) (const GLfloat *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLNORMAL3FVERTEX3FSUNPROC) (GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *c, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD2FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLTEXCOORD2FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD4FVERTEX4FSUNPROC) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLTEXCOORD4FVERTEX4FVSUNPROC) (const GLfloat *tc, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4UBVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4UBVERTEX3FVSUNPROC) (const GLfloat *tc, const GLubyte *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD2FNORMAL3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLTEXCOORD2FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FSUNPROC) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUIVERTEX3FSUNPROC) (GLuint rc, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUIVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FSUNPROC) (GLuint rc, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FVSUNPROC) (const GLuint *rc, const GLubyte *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FSUNPROC) (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glColor4ubVertex2fSUN (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y); +GLAPI void APIENTRY glColor4ubVertex2fvSUN (const GLubyte *c, const GLfloat *v); +GLAPI void APIENTRY glColor4ubVertex3fSUN (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glColor4ubVertex3fvSUN (const GLubyte *c, const GLfloat *v); +GLAPI void APIENTRY glColor3fVertex3fSUN (GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glColor3fVertex3fvSUN (const GLfloat *c, const GLfloat *v); +GLAPI void APIENTRY glNormal3fVertex3fSUN (GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glNormal3fVertex3fvSUN (const GLfloat *n, const GLfloat *v); +GLAPI void APIENTRY glColor4fNormal3fVertex3fSUN (GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glColor4fNormal3fVertex3fvSUN (const GLfloat *c, const GLfloat *n, const GLfloat *v); +GLAPI void APIENTRY glTexCoord2fVertex3fSUN (GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glTexCoord2fVertex3fvSUN (const GLfloat *tc, const GLfloat *v); +GLAPI void APIENTRY glTexCoord4fVertex4fSUN (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void APIENTRY glTexCoord4fVertex4fvSUN (const GLfloat *tc, const GLfloat *v); +GLAPI void APIENTRY glTexCoord2fColor4ubVertex3fSUN (GLfloat s, GLfloat t, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glTexCoord2fColor4ubVertex3fvSUN (const GLfloat *tc, const GLubyte *c, const GLfloat *v); +GLAPI void APIENTRY glTexCoord2fColor3fVertex3fSUN (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glTexCoord2fColor3fVertex3fvSUN (const GLfloat *tc, const GLfloat *c, const GLfloat *v); +GLAPI void APIENTRY glTexCoord2fNormal3fVertex3fSUN (GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glTexCoord2fNormal3fVertex3fvSUN (const GLfloat *tc, const GLfloat *n, const GLfloat *v); +GLAPI void APIENTRY glTexCoord2fColor4fNormal3fVertex3fSUN (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glTexCoord2fColor4fNormal3fVertex3fvSUN (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +GLAPI void APIENTRY glTexCoord4fColor4fNormal3fVertex4fSUN (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void APIENTRY glTexCoord4fColor4fNormal3fVertex4fvSUN (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +GLAPI void APIENTRY glReplacementCodeuiVertex3fSUN (GLuint rc, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glReplacementCodeuiVertex3fvSUN (const GLuint *rc, const GLfloat *v); +GLAPI void APIENTRY glReplacementCodeuiColor4ubVertex3fSUN (GLuint rc, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glReplacementCodeuiColor4ubVertex3fvSUN (const GLuint *rc, const GLubyte *c, const GLfloat *v); +GLAPI void APIENTRY glReplacementCodeuiColor3fVertex3fSUN (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glReplacementCodeuiColor3fVertex3fvSUN (const GLuint *rc, const GLfloat *c, const GLfloat *v); +GLAPI void APIENTRY glReplacementCodeuiNormal3fVertex3fSUN (GLuint rc, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glReplacementCodeuiNormal3fVertex3fvSUN (const GLuint *rc, const GLfloat *n, const GLfloat *v); +GLAPI void APIENTRY glReplacementCodeuiColor4fNormal3fVertex3fSUN (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glReplacementCodeuiColor4fNormal3fVertex3fvSUN (const GLuint *rc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +GLAPI void APIENTRY glReplacementCodeuiTexCoord2fVertex3fSUN (GLuint rc, GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glReplacementCodeuiTexCoord2fVertex3fvSUN (const GLuint *rc, const GLfloat *tc, const GLfloat *v); +GLAPI void APIENTRY glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN (GLuint rc, GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN (const GLuint *rc, const GLfloat *tc, const GLfloat *n, const GLfloat *v); +GLAPI void APIENTRY glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN (GLuint rc, GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN (const GLuint *rc, const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +#endif +#endif /* GL_SUN_vertex */ + +#ifndef GL_WIN_phong_shading +#define GL_WIN_phong_shading 1 +#define GL_PHONG_WIN 0x80EA +#define GL_PHONG_HINT_WIN 0x80EB +#endif /* GL_WIN_phong_shading */ + +#ifndef GL_WIN_specular_fog +#define GL_WIN_specular_fog 1 +#define GL_FOG_SPECULAR_TEXTURE_WIN 0x80EC +#endif /* GL_WIN_specular_fog */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_opengles.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_opengles.h new file mode 100644 index 0000000..5c2a3e6 --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_opengles.h @@ -0,0 +1,39 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_opengles.h + * + * This is a simple file to encapsulate the OpenGL ES 1.X API headers. + */ +#include "SDL_config.h" + +#ifdef __IPHONEOS__ +#include +#include +#else +#include +#include +#endif + +#ifndef APIENTRY +#define APIENTRY +#endif diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_opengles2.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_opengles2.h new file mode 100644 index 0000000..00bc180 --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_opengles2.h @@ -0,0 +1,52 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_opengles2.h + * + * This is a simple file to encapsulate the OpenGL ES 2.0 API headers. + */ +#include "SDL_config.h" + +#ifndef _MSC_VER + +#ifdef __IPHONEOS__ +#include +#include +#else +#include +#include +#include +#endif + +#else /* _MSC_VER */ + +/* OpenGL ES2 headers for Visual Studio */ +#include "SDL_opengles2_khrplatform.h" +#include "SDL_opengles2_gl2platform.h" +#include "SDL_opengles2_gl2.h" +#include "SDL_opengles2_gl2ext.h" + +#endif /* _MSC_VER */ + +#ifndef APIENTRY +#define APIENTRY GL_APIENTRY +#endif diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_opengles2_gl2.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_opengles2_gl2.h new file mode 100644 index 0000000..c62fb0a --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_opengles2_gl2.h @@ -0,0 +1,621 @@ +#ifndef __gl2_h_ +#define __gl2_h_ + +/* $Revision: 20555 $ on $Date:: 2013-02-12 14:32:47 -0800 #$ */ + +/*#include */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * This document is licensed under the SGI Free Software B License Version + * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ . + */ + +/*------------------------------------------------------------------------- + * Data type definitions + *-----------------------------------------------------------------------*/ + +typedef void GLvoid; +typedef char GLchar; +typedef unsigned int GLenum; +typedef unsigned char GLboolean; +typedef unsigned int GLbitfield; +typedef khronos_int8_t GLbyte; +typedef short GLshort; +typedef int GLint; +typedef int GLsizei; +typedef khronos_uint8_t GLubyte; +typedef unsigned short GLushort; +typedef unsigned int GLuint; +typedef khronos_float_t GLfloat; +typedef khronos_float_t GLclampf; +typedef khronos_int32_t GLfixed; + +/* GL types for handling large vertex buffer objects */ +typedef khronos_intptr_t GLintptr; +typedef khronos_ssize_t GLsizeiptr; + +/* OpenGL ES core versions */ +#define GL_ES_VERSION_2_0 1 + +/* ClearBufferMask */ +#define GL_DEPTH_BUFFER_BIT 0x00000100 +#define GL_STENCIL_BUFFER_BIT 0x00000400 +#define GL_COLOR_BUFFER_BIT 0x00004000 + +/* Boolean */ +#define GL_FALSE 0 +#define GL_TRUE 1 + +/* BeginMode */ +#define GL_POINTS 0x0000 +#define GL_LINES 0x0001 +#define GL_LINE_LOOP 0x0002 +#define GL_LINE_STRIP 0x0003 +#define GL_TRIANGLES 0x0004 +#define GL_TRIANGLE_STRIP 0x0005 +#define GL_TRIANGLE_FAN 0x0006 + +/* AlphaFunction (not supported in ES20) */ +/* GL_NEVER */ +/* GL_LESS */ +/* GL_EQUAL */ +/* GL_LEQUAL */ +/* GL_GREATER */ +/* GL_NOTEQUAL */ +/* GL_GEQUAL */ +/* GL_ALWAYS */ + +/* BlendingFactorDest */ +#define GL_ZERO 0 +#define GL_ONE 1 +#define GL_SRC_COLOR 0x0300 +#define GL_ONE_MINUS_SRC_COLOR 0x0301 +#define GL_SRC_ALPHA 0x0302 +#define GL_ONE_MINUS_SRC_ALPHA 0x0303 +#define GL_DST_ALPHA 0x0304 +#define GL_ONE_MINUS_DST_ALPHA 0x0305 + +/* BlendingFactorSrc */ +/* GL_ZERO */ +/* GL_ONE */ +#define GL_DST_COLOR 0x0306 +#define GL_ONE_MINUS_DST_COLOR 0x0307 +#define GL_SRC_ALPHA_SATURATE 0x0308 +/* GL_SRC_ALPHA */ +/* GL_ONE_MINUS_SRC_ALPHA */ +/* GL_DST_ALPHA */ +/* GL_ONE_MINUS_DST_ALPHA */ + +/* BlendEquationSeparate */ +#define GL_FUNC_ADD 0x8006 +#define GL_BLEND_EQUATION 0x8009 +#define GL_BLEND_EQUATION_RGB 0x8009 /* same as BLEND_EQUATION */ +#define GL_BLEND_EQUATION_ALPHA 0x883D + +/* BlendSubtract */ +#define GL_FUNC_SUBTRACT 0x800A +#define GL_FUNC_REVERSE_SUBTRACT 0x800B + +/* Separate Blend Functions */ +#define GL_BLEND_DST_RGB 0x80C8 +#define GL_BLEND_SRC_RGB 0x80C9 +#define GL_BLEND_DST_ALPHA 0x80CA +#define GL_BLEND_SRC_ALPHA 0x80CB +#define GL_CONSTANT_COLOR 0x8001 +#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 +#define GL_CONSTANT_ALPHA 0x8003 +#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 +#define GL_BLEND_COLOR 0x8005 + +/* Buffer Objects */ +#define GL_ARRAY_BUFFER 0x8892 +#define GL_ELEMENT_ARRAY_BUFFER 0x8893 +#define GL_ARRAY_BUFFER_BINDING 0x8894 +#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895 + +#define GL_STREAM_DRAW 0x88E0 +#define GL_STATIC_DRAW 0x88E4 +#define GL_DYNAMIC_DRAW 0x88E8 + +#define GL_BUFFER_SIZE 0x8764 +#define GL_BUFFER_USAGE 0x8765 + +#define GL_CURRENT_VERTEX_ATTRIB 0x8626 + +/* CullFaceMode */ +#define GL_FRONT 0x0404 +#define GL_BACK 0x0405 +#define GL_FRONT_AND_BACK 0x0408 + +/* DepthFunction */ +/* GL_NEVER */ +/* GL_LESS */ +/* GL_EQUAL */ +/* GL_LEQUAL */ +/* GL_GREATER */ +/* GL_NOTEQUAL */ +/* GL_GEQUAL */ +/* GL_ALWAYS */ + +/* EnableCap */ +#define GL_TEXTURE_2D 0x0DE1 +#define GL_CULL_FACE 0x0B44 +#define GL_BLEND 0x0BE2 +#define GL_DITHER 0x0BD0 +#define GL_STENCIL_TEST 0x0B90 +#define GL_DEPTH_TEST 0x0B71 +#define GL_SCISSOR_TEST 0x0C11 +#define GL_POLYGON_OFFSET_FILL 0x8037 +#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E +#define GL_SAMPLE_COVERAGE 0x80A0 + +/* ErrorCode */ +#define GL_NO_ERROR 0 +#define GL_INVALID_ENUM 0x0500 +#define GL_INVALID_VALUE 0x0501 +#define GL_INVALID_OPERATION 0x0502 +#define GL_OUT_OF_MEMORY 0x0505 + +/* FrontFaceDirection */ +#define GL_CW 0x0900 +#define GL_CCW 0x0901 + +/* GetPName */ +#define GL_LINE_WIDTH 0x0B21 +#define GL_ALIASED_POINT_SIZE_RANGE 0x846D +#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E +#define GL_CULL_FACE_MODE 0x0B45 +#define GL_FRONT_FACE 0x0B46 +#define GL_DEPTH_RANGE 0x0B70 +#define GL_DEPTH_WRITEMASK 0x0B72 +#define GL_DEPTH_CLEAR_VALUE 0x0B73 +#define GL_DEPTH_FUNC 0x0B74 +#define GL_STENCIL_CLEAR_VALUE 0x0B91 +#define GL_STENCIL_FUNC 0x0B92 +#define GL_STENCIL_FAIL 0x0B94 +#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95 +#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96 +#define GL_STENCIL_REF 0x0B97 +#define GL_STENCIL_VALUE_MASK 0x0B93 +#define GL_STENCIL_WRITEMASK 0x0B98 +#define GL_STENCIL_BACK_FUNC 0x8800 +#define GL_STENCIL_BACK_FAIL 0x8801 +#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802 +#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803 +#define GL_STENCIL_BACK_REF 0x8CA3 +#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4 +#define GL_STENCIL_BACK_WRITEMASK 0x8CA5 +#define GL_VIEWPORT 0x0BA2 +#define GL_SCISSOR_BOX 0x0C10 +/* GL_SCISSOR_TEST */ +#define GL_COLOR_CLEAR_VALUE 0x0C22 +#define GL_COLOR_WRITEMASK 0x0C23 +#define GL_UNPACK_ALIGNMENT 0x0CF5 +#define GL_PACK_ALIGNMENT 0x0D05 +#define GL_MAX_TEXTURE_SIZE 0x0D33 +#define GL_MAX_VIEWPORT_DIMS 0x0D3A +#define GL_SUBPIXEL_BITS 0x0D50 +#define GL_RED_BITS 0x0D52 +#define GL_GREEN_BITS 0x0D53 +#define GL_BLUE_BITS 0x0D54 +#define GL_ALPHA_BITS 0x0D55 +#define GL_DEPTH_BITS 0x0D56 +#define GL_STENCIL_BITS 0x0D57 +#define GL_POLYGON_OFFSET_UNITS 0x2A00 +/* GL_POLYGON_OFFSET_FILL */ +#define GL_POLYGON_OFFSET_FACTOR 0x8038 +#define GL_TEXTURE_BINDING_2D 0x8069 +#define GL_SAMPLE_BUFFERS 0x80A8 +#define GL_SAMPLES 0x80A9 +#define GL_SAMPLE_COVERAGE_VALUE 0x80AA +#define GL_SAMPLE_COVERAGE_INVERT 0x80AB + +/* GetTextureParameter */ +/* GL_TEXTURE_MAG_FILTER */ +/* GL_TEXTURE_MIN_FILTER */ +/* GL_TEXTURE_WRAP_S */ +/* GL_TEXTURE_WRAP_T */ + +#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 +#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 + +/* HintMode */ +#define GL_DONT_CARE 0x1100 +#define GL_FASTEST 0x1101 +#define GL_NICEST 0x1102 + +/* HintTarget */ +#define GL_GENERATE_MIPMAP_HINT 0x8192 + +/* DataType */ +#define GL_BYTE 0x1400 +#define GL_UNSIGNED_BYTE 0x1401 +#define GL_SHORT 0x1402 +#define GL_UNSIGNED_SHORT 0x1403 +#define GL_INT 0x1404 +#define GL_UNSIGNED_INT 0x1405 +#define GL_FLOAT 0x1406 +#define GL_FIXED 0x140C + +/* PixelFormat */ +#define GL_DEPTH_COMPONENT 0x1902 +#define GL_ALPHA 0x1906 +#define GL_RGB 0x1907 +#define GL_RGBA 0x1908 +#define GL_LUMINANCE 0x1909 +#define GL_LUMINANCE_ALPHA 0x190A + +/* PixelType */ +/* GL_UNSIGNED_BYTE */ +#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 +#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 +#define GL_UNSIGNED_SHORT_5_6_5 0x8363 + +/* Shaders */ +#define GL_FRAGMENT_SHADER 0x8B30 +#define GL_VERTEX_SHADER 0x8B31 +#define GL_MAX_VERTEX_ATTRIBS 0x8869 +#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB +#define GL_MAX_VARYING_VECTORS 0x8DFC +#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D +#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C +#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872 +#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD +#define GL_SHADER_TYPE 0x8B4F +#define GL_DELETE_STATUS 0x8B80 +#define GL_LINK_STATUS 0x8B82 +#define GL_VALIDATE_STATUS 0x8B83 +#define GL_ATTACHED_SHADERS 0x8B85 +#define GL_ACTIVE_UNIFORMS 0x8B86 +#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87 +#define GL_ACTIVE_ATTRIBUTES 0x8B89 +#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A +#define GL_SHADING_LANGUAGE_VERSION 0x8B8C +#define GL_CURRENT_PROGRAM 0x8B8D + +/* StencilFunction */ +#define GL_NEVER 0x0200 +#define GL_LESS 0x0201 +#define GL_EQUAL 0x0202 +#define GL_LEQUAL 0x0203 +#define GL_GREATER 0x0204 +#define GL_NOTEQUAL 0x0205 +#define GL_GEQUAL 0x0206 +#define GL_ALWAYS 0x0207 + +/* StencilOp */ +/* GL_ZERO */ +#define GL_KEEP 0x1E00 +#define GL_REPLACE 0x1E01 +#define GL_INCR 0x1E02 +#define GL_DECR 0x1E03 +#define GL_INVERT 0x150A +#define GL_INCR_WRAP 0x8507 +#define GL_DECR_WRAP 0x8508 + +/* StringName */ +#define GL_VENDOR 0x1F00 +#define GL_RENDERER 0x1F01 +#define GL_VERSION 0x1F02 +#define GL_EXTENSIONS 0x1F03 + +/* TextureMagFilter */ +#define GL_NEAREST 0x2600 +#define GL_LINEAR 0x2601 + +/* TextureMinFilter */ +/* GL_NEAREST */ +/* GL_LINEAR */ +#define GL_NEAREST_MIPMAP_NEAREST 0x2700 +#define GL_LINEAR_MIPMAP_NEAREST 0x2701 +#define GL_NEAREST_MIPMAP_LINEAR 0x2702 +#define GL_LINEAR_MIPMAP_LINEAR 0x2703 + +/* TextureParameterName */ +#define GL_TEXTURE_MAG_FILTER 0x2800 +#define GL_TEXTURE_MIN_FILTER 0x2801 +#define GL_TEXTURE_WRAP_S 0x2802 +#define GL_TEXTURE_WRAP_T 0x2803 + +/* TextureTarget */ +/* GL_TEXTURE_2D */ +#define GL_TEXTURE 0x1702 + +#define GL_TEXTURE_CUBE_MAP 0x8513 +#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C + +/* TextureUnit */ +#define GL_TEXTURE0 0x84C0 +#define GL_TEXTURE1 0x84C1 +#define GL_TEXTURE2 0x84C2 +#define GL_TEXTURE3 0x84C3 +#define GL_TEXTURE4 0x84C4 +#define GL_TEXTURE5 0x84C5 +#define GL_TEXTURE6 0x84C6 +#define GL_TEXTURE7 0x84C7 +#define GL_TEXTURE8 0x84C8 +#define GL_TEXTURE9 0x84C9 +#define GL_TEXTURE10 0x84CA +#define GL_TEXTURE11 0x84CB +#define GL_TEXTURE12 0x84CC +#define GL_TEXTURE13 0x84CD +#define GL_TEXTURE14 0x84CE +#define GL_TEXTURE15 0x84CF +#define GL_TEXTURE16 0x84D0 +#define GL_TEXTURE17 0x84D1 +#define GL_TEXTURE18 0x84D2 +#define GL_TEXTURE19 0x84D3 +#define GL_TEXTURE20 0x84D4 +#define GL_TEXTURE21 0x84D5 +#define GL_TEXTURE22 0x84D6 +#define GL_TEXTURE23 0x84D7 +#define GL_TEXTURE24 0x84D8 +#define GL_TEXTURE25 0x84D9 +#define GL_TEXTURE26 0x84DA +#define GL_TEXTURE27 0x84DB +#define GL_TEXTURE28 0x84DC +#define GL_TEXTURE29 0x84DD +#define GL_TEXTURE30 0x84DE +#define GL_TEXTURE31 0x84DF +#define GL_ACTIVE_TEXTURE 0x84E0 + +/* TextureWrapMode */ +#define GL_REPEAT 0x2901 +#define GL_CLAMP_TO_EDGE 0x812F +#define GL_MIRRORED_REPEAT 0x8370 + +/* Uniform Types */ +#define GL_FLOAT_VEC2 0x8B50 +#define GL_FLOAT_VEC3 0x8B51 +#define GL_FLOAT_VEC4 0x8B52 +#define GL_INT_VEC2 0x8B53 +#define GL_INT_VEC3 0x8B54 +#define GL_INT_VEC4 0x8B55 +#define GL_BOOL 0x8B56 +#define GL_BOOL_VEC2 0x8B57 +#define GL_BOOL_VEC3 0x8B58 +#define GL_BOOL_VEC4 0x8B59 +#define GL_FLOAT_MAT2 0x8B5A +#define GL_FLOAT_MAT3 0x8B5B +#define GL_FLOAT_MAT4 0x8B5C +#define GL_SAMPLER_2D 0x8B5E +#define GL_SAMPLER_CUBE 0x8B60 + +/* Vertex Arrays */ +#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 +#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623 +#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624 +#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625 +#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A +#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645 +#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F + +/* Read Format */ +#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A +#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B + +/* Shader Source */ +#define GL_COMPILE_STATUS 0x8B81 +#define GL_INFO_LOG_LENGTH 0x8B84 +#define GL_SHADER_SOURCE_LENGTH 0x8B88 +#define GL_SHADER_COMPILER 0x8DFA + +/* Shader Binary */ +#define GL_SHADER_BINARY_FORMATS 0x8DF8 +#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9 + +/* Shader Precision-Specified Types */ +#define GL_LOW_FLOAT 0x8DF0 +#define GL_MEDIUM_FLOAT 0x8DF1 +#define GL_HIGH_FLOAT 0x8DF2 +#define GL_LOW_INT 0x8DF3 +#define GL_MEDIUM_INT 0x8DF4 +#define GL_HIGH_INT 0x8DF5 + +/* Framebuffer Object. */ +#define GL_FRAMEBUFFER 0x8D40 +#define GL_RENDERBUFFER 0x8D41 + +#define GL_RGBA4 0x8056 +#define GL_RGB5_A1 0x8057 +#define GL_RGB565 0x8D62 +#define GL_DEPTH_COMPONENT16 0x81A5 +#define GL_STENCIL_INDEX8 0x8D48 + +#define GL_RENDERBUFFER_WIDTH 0x8D42 +#define GL_RENDERBUFFER_HEIGHT 0x8D43 +#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44 +#define GL_RENDERBUFFER_RED_SIZE 0x8D50 +#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51 +#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52 +#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53 +#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54 +#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55 + +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3 + +#define GL_COLOR_ATTACHMENT0 0x8CE0 +#define GL_DEPTH_ATTACHMENT 0x8D00 +#define GL_STENCIL_ATTACHMENT 0x8D20 + +#define GL_NONE 0 + +#define GL_FRAMEBUFFER_COMPLETE 0x8CD5 +#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6 +#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7 +#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9 +#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD + +#define GL_FRAMEBUFFER_BINDING 0x8CA6 +#define GL_RENDERBUFFER_BINDING 0x8CA7 +#define GL_MAX_RENDERBUFFER_SIZE 0x84E8 + +#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506 + +/*------------------------------------------------------------------------- + * GL core functions. + *-----------------------------------------------------------------------*/ + +GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture); +GL_APICALL void GL_APIENTRY glAttachShader (GLuint program, GLuint shader); +GL_APICALL void GL_APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar* name); +GL_APICALL void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer); +GL_APICALL void GL_APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer); +GL_APICALL void GL_APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer); +GL_APICALL void GL_APIENTRY glBindTexture (GLenum target, GLuint texture); +GL_APICALL void GL_APIENTRY glBlendColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +GL_APICALL void GL_APIENTRY glBlendEquation ( GLenum mode ); +GL_APICALL void GL_APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha); +GL_APICALL void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor); +GL_APICALL void GL_APIENTRY glBlendFuncSeparate (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +GL_APICALL void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage); +GL_APICALL void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data); +GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus (GLenum target); +GL_APICALL void GL_APIENTRY glClear (GLbitfield mask); +GL_APICALL void GL_APIENTRY glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +GL_APICALL void GL_APIENTRY glClearDepthf (GLclampf depth); +GL_APICALL void GL_APIENTRY glClearStencil (GLint s); +GL_APICALL void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); +GL_APICALL void GL_APIENTRY glCompileShader (GLuint shader); +GL_APICALL void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data); +GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data); +GL_APICALL void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +GL_APICALL void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GL_APICALL GLuint GL_APIENTRY glCreateProgram (void); +GL_APICALL GLuint GL_APIENTRY glCreateShader (GLenum type); +GL_APICALL void GL_APIENTRY glCullFace (GLenum mode); +GL_APICALL void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint* buffers); +GL_APICALL void GL_APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint* framebuffers); +GL_APICALL void GL_APIENTRY glDeleteProgram (GLuint program); +GL_APICALL void GL_APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint* renderbuffers); +GL_APICALL void GL_APIENTRY glDeleteShader (GLuint shader); +GL_APICALL void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint* textures); +GL_APICALL void GL_APIENTRY glDepthFunc (GLenum func); +GL_APICALL void GL_APIENTRY glDepthMask (GLboolean flag); +GL_APICALL void GL_APIENTRY glDepthRangef (GLclampf zNear, GLclampf zFar); +GL_APICALL void GL_APIENTRY glDetachShader (GLuint program, GLuint shader); +GL_APICALL void GL_APIENTRY glDisable (GLenum cap); +GL_APICALL void GL_APIENTRY glDisableVertexAttribArray (GLuint index); +GL_APICALL void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count); +GL_APICALL void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid* indices); +GL_APICALL void GL_APIENTRY glEnable (GLenum cap); +GL_APICALL void GL_APIENTRY glEnableVertexAttribArray (GLuint index); +GL_APICALL void GL_APIENTRY glFinish (void); +GL_APICALL void GL_APIENTRY glFlush (void); +GL_APICALL void GL_APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +GL_APICALL void GL_APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +GL_APICALL void GL_APIENTRY glFrontFace (GLenum mode); +GL_APICALL void GL_APIENTRY glGenBuffers (GLsizei n, GLuint* buffers); +GL_APICALL void GL_APIENTRY glGenerateMipmap (GLenum target); +GL_APICALL void GL_APIENTRY glGenFramebuffers (GLsizei n, GLuint* framebuffers); +GL_APICALL void GL_APIENTRY glGenRenderbuffers (GLsizei n, GLuint* renderbuffers); +GL_APICALL void GL_APIENTRY glGenTextures (GLsizei n, GLuint* textures); +GL_APICALL void GL_APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name); +GL_APICALL void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name); +GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders); +GL_APICALL GLint GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar* name); +GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean* params); +GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint* params); +GL_APICALL GLenum GL_APIENTRY glGetError (void); +GL_APICALL void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat* params); +GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint* params); +GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint* params); +GL_APICALL void GL_APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint* params); +GL_APICALL void GL_APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog); +GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint* params); +GL_APICALL void GL_APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint* params); +GL_APICALL void GL_APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog); +GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision); +GL_APICALL void GL_APIENTRY glGetShaderSource (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source); +GL_APICALL const GLubyte* GL_APIENTRY glGetString (GLenum name); +GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat* params); +GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint* params); +GL_APICALL void GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat* params); +GL_APICALL void GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint* params); +GL_APICALL GLint GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar* name); +GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat* params); +GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint* params); +GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, GLvoid** pointer); +GL_APICALL void GL_APIENTRY glHint (GLenum target, GLenum mode); +GL_APICALL GLboolean GL_APIENTRY glIsBuffer (GLuint buffer); +GL_APICALL GLboolean GL_APIENTRY glIsEnabled (GLenum cap); +GL_APICALL GLboolean GL_APIENTRY glIsFramebuffer (GLuint framebuffer); +GL_APICALL GLboolean GL_APIENTRY glIsProgram (GLuint program); +GL_APICALL GLboolean GL_APIENTRY glIsRenderbuffer (GLuint renderbuffer); +GL_APICALL GLboolean GL_APIENTRY glIsShader (GLuint shader); +GL_APICALL GLboolean GL_APIENTRY glIsTexture (GLuint texture); +GL_APICALL void GL_APIENTRY glLineWidth (GLfloat width); +GL_APICALL void GL_APIENTRY glLinkProgram (GLuint program); +GL_APICALL void GL_APIENTRY glPixelStorei (GLenum pname, GLint param); +GL_APICALL void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units); +GL_APICALL void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels); +GL_APICALL void GL_APIENTRY glReleaseShaderCompiler (void); +GL_APICALL void GL_APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glSampleCoverage (GLclampf value, GLboolean invert); +GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length); +GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar* const* string, const GLint* length); +GL_APICALL void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask); +GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask); +GL_APICALL void GL_APIENTRY glStencilMask (GLuint mask); +GL_APICALL void GL_APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask); +GL_APICALL void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass); +GL_APICALL void GL_APIENTRY glStencilOpSeparate (GLenum face, GLenum fail, GLenum zfail, GLenum zpass); +GL_APICALL void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels); +GL_APICALL void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param); +GL_APICALL void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat* params); +GL_APICALL void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param); +GL_APICALL void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint* params); +GL_APICALL void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels); +GL_APICALL void GL_APIENTRY glUniform1f (GLint location, GLfloat x); +GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat* v); +GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint x); +GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint* v); +GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat x, GLfloat y); +GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat* v); +GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint x, GLint y); +GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint* v); +GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat x, GLfloat y, GLfloat z); +GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat* v); +GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint x, GLint y, GLint z); +GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint* v); +GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat* v); +GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint x, GLint y, GLint z, GLint w); +GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint* v); +GL_APICALL void GL_APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +GL_APICALL void GL_APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +GL_APICALL void GL_APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +GL_APICALL void GL_APIENTRY glUseProgram (GLuint program); +GL_APICALL void GL_APIENTRY glValidateProgram (GLuint program); +GL_APICALL void GL_APIENTRY glVertexAttrib1f (GLuint indx, GLfloat x); +GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint indx, const GLfloat* values); +GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint indx, GLfloat x, GLfloat y); +GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint indx, const GLfloat* values); +GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint indx, GLfloat x, GLfloat y, GLfloat z); +GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint indx, const GLfloat* values); +GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint indx, const GLfloat* values); +GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr); +GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height); + +#ifdef __cplusplus +} +#endif + +#endif /* __gl2_h_ */ + diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_opengles2_gl2ext.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_opengles2_gl2ext.h new file mode 100644 index 0000000..e8ca8b1 --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_opengles2_gl2ext.h @@ -0,0 +1,2050 @@ +#ifndef __gl2ext_h_ +#define __gl2ext_h_ + +/* $Revision: 22801 $ on $Date:: 2013-08-21 03:20:48 -0700 #$ */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * This document is licensed under the SGI Free Software B License Version + * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ . + */ + +#ifndef GL_APIENTRYP +# define GL_APIENTRYP GL_APIENTRY* +#endif + +/* New types shared by several extensions */ + +#ifndef __gl3_h_ +/* These are defined with respect to in the + * Apple extension spec, but they are also used by non-APPLE + * extensions, and in the Khronos header we use the Khronos + * portable types in khrplatform.h, which must be defined. + */ +typedef khronos_int64_t GLint64; +typedef khronos_uint64_t GLuint64; +typedef struct __GLsync *GLsync; +#endif + + +/*------------------------------------------------------------------------* + * OES extension tokens + *------------------------------------------------------------------------*/ + +/* GL_OES_compressed_ETC1_RGB8_texture */ +#ifndef GL_OES_compressed_ETC1_RGB8_texture +#define GL_ETC1_RGB8_OES 0x8D64 +#endif + +/* GL_OES_compressed_paletted_texture */ +#ifndef GL_OES_compressed_paletted_texture +#define GL_PALETTE4_RGB8_OES 0x8B90 +#define GL_PALETTE4_RGBA8_OES 0x8B91 +#define GL_PALETTE4_R5_G6_B5_OES 0x8B92 +#define GL_PALETTE4_RGBA4_OES 0x8B93 +#define GL_PALETTE4_RGB5_A1_OES 0x8B94 +#define GL_PALETTE8_RGB8_OES 0x8B95 +#define GL_PALETTE8_RGBA8_OES 0x8B96 +#define GL_PALETTE8_R5_G6_B5_OES 0x8B97 +#define GL_PALETTE8_RGBA4_OES 0x8B98 +#define GL_PALETTE8_RGB5_A1_OES 0x8B99 +#endif + +/* GL_OES_depth24 */ +#ifndef GL_OES_depth24 +#define GL_DEPTH_COMPONENT24_OES 0x81A6 +#endif + +/* GL_OES_depth32 */ +#ifndef GL_OES_depth32 +#define GL_DEPTH_COMPONENT32_OES 0x81A7 +#endif + +/* GL_OES_depth_texture */ +/* No new tokens introduced by this extension. */ + +/* GL_OES_EGL_image */ +#ifndef GL_OES_EGL_image +typedef void* GLeglImageOES; +#endif + +/* GL_OES_EGL_image_external */ +#ifndef GL_OES_EGL_image_external +/* GLeglImageOES defined in GL_OES_EGL_image already. */ +#define GL_TEXTURE_EXTERNAL_OES 0x8D65 +#define GL_SAMPLER_EXTERNAL_OES 0x8D66 +#define GL_TEXTURE_BINDING_EXTERNAL_OES 0x8D67 +#define GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES 0x8D68 +#endif + +/* GL_OES_element_index_uint */ +#ifndef GL_OES_element_index_uint +#define GL_UNSIGNED_INT 0x1405 +#endif + +/* GL_OES_get_program_binary */ +#ifndef GL_OES_get_program_binary +#define GL_PROGRAM_BINARY_LENGTH_OES 0x8741 +#define GL_NUM_PROGRAM_BINARY_FORMATS_OES 0x87FE +#define GL_PROGRAM_BINARY_FORMATS_OES 0x87FF +#endif + +/* GL_OES_mapbuffer */ +#ifndef GL_OES_mapbuffer +#define GL_WRITE_ONLY_OES 0x88B9 +#define GL_BUFFER_ACCESS_OES 0x88BB +#define GL_BUFFER_MAPPED_OES 0x88BC +#define GL_BUFFER_MAP_POINTER_OES 0x88BD +#endif + +/* GL_OES_packed_depth_stencil */ +#ifndef GL_OES_packed_depth_stencil +#define GL_DEPTH_STENCIL_OES 0x84F9 +#define GL_UNSIGNED_INT_24_8_OES 0x84FA +#define GL_DEPTH24_STENCIL8_OES 0x88F0 +#endif + +/* GL_OES_required_internalformat */ +#ifndef GL_OES_required_internalformat +#define GL_ALPHA8_OES 0x803C +#define GL_DEPTH_COMPONENT16_OES 0x81A5 +/* reuse GL_DEPTH_COMPONENT24_OES */ +/* reuse GL_DEPTH24_STENCIL8_OES */ +/* reuse GL_DEPTH_COMPONENT32_OES */ +#define GL_LUMINANCE4_ALPHA4_OES 0x8043 +#define GL_LUMINANCE8_ALPHA8_OES 0x8045 +#define GL_LUMINANCE8_OES 0x8040 +#define GL_RGBA4_OES 0x8056 +#define GL_RGB5_A1_OES 0x8057 +#define GL_RGB565_OES 0x8D62 +/* reuse GL_RGB8_OES */ +/* reuse GL_RGBA8_OES */ +/* reuse GL_RGB10_EXT */ +/* reuse GL_RGB10_A2_EXT */ +#endif + +/* GL_OES_rgb8_rgba8 */ +#ifndef GL_OES_rgb8_rgba8 +#define GL_RGB8_OES 0x8051 +#define GL_RGBA8_OES 0x8058 +#endif + +/* GL_OES_standard_derivatives */ +#ifndef GL_OES_standard_derivatives +#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES 0x8B8B +#endif + +/* GL_OES_stencil1 */ +#ifndef GL_OES_stencil1 +#define GL_STENCIL_INDEX1_OES 0x8D46 +#endif + +/* GL_OES_stencil4 */ +#ifndef GL_OES_stencil4 +#define GL_STENCIL_INDEX4_OES 0x8D47 +#endif + +#ifndef GL_OES_surfaceless_context +#define GL_FRAMEBUFFER_UNDEFINED_OES 0x8219 +#endif + +/* GL_OES_texture_3D */ +#ifndef GL_OES_texture_3D +#define GL_TEXTURE_WRAP_R_OES 0x8072 +#define GL_TEXTURE_3D_OES 0x806F +#define GL_TEXTURE_BINDING_3D_OES 0x806A +#define GL_MAX_3D_TEXTURE_SIZE_OES 0x8073 +#define GL_SAMPLER_3D_OES 0x8B5F +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES 0x8CD4 +#endif + +/* GL_OES_texture_float */ +/* No new tokens introduced by this extension. */ + +/* GL_OES_texture_float_linear */ +/* No new tokens introduced by this extension. */ + +/* GL_OES_texture_half_float */ +#ifndef GL_OES_texture_half_float +#define GL_HALF_FLOAT_OES 0x8D61 +#endif + +/* GL_OES_texture_half_float_linear */ +/* No new tokens introduced by this extension. */ + +/* GL_OES_texture_npot */ +/* No new tokens introduced by this extension. */ + +/* GL_OES_vertex_array_object */ +#ifndef GL_OES_vertex_array_object +#define GL_VERTEX_ARRAY_BINDING_OES 0x85B5 +#endif + +/* GL_OES_vertex_half_float */ +/* GL_HALF_FLOAT_OES defined in GL_OES_texture_half_float already. */ + +/* GL_OES_vertex_type_10_10_10_2 */ +#ifndef GL_OES_vertex_type_10_10_10_2 +#define GL_UNSIGNED_INT_10_10_10_2_OES 0x8DF6 +#define GL_INT_10_10_10_2_OES 0x8DF7 +#endif + +/*------------------------------------------------------------------------* + * KHR extension tokens + *------------------------------------------------------------------------*/ + +#ifndef GL_KHR_debug +typedef void (GL_APIENTRYP GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); +#define GL_DEBUG_OUTPUT_SYNCHRONOUS_KHR 0x8242 +#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_KHR 0x8243 +#define GL_DEBUG_CALLBACK_FUNCTION_KHR 0x8244 +#define GL_DEBUG_CALLBACK_USER_PARAM_KHR 0x8245 +#define GL_DEBUG_SOURCE_API_KHR 0x8246 +#define GL_DEBUG_SOURCE_WINDOW_SYSTEM_KHR 0x8247 +#define GL_DEBUG_SOURCE_SHADER_COMPILER_KHR 0x8248 +#define GL_DEBUG_SOURCE_THIRD_PARTY_KHR 0x8249 +#define GL_DEBUG_SOURCE_APPLICATION_KHR 0x824A +#define GL_DEBUG_SOURCE_OTHER_KHR 0x824B +#define GL_DEBUG_TYPE_ERROR_KHR 0x824C +#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_KHR 0x824D +#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_KHR 0x824E +#define GL_DEBUG_TYPE_PORTABILITY_KHR 0x824F +#define GL_DEBUG_TYPE_PERFORMANCE_KHR 0x8250 +#define GL_DEBUG_TYPE_OTHER_KHR 0x8251 +#define GL_DEBUG_TYPE_MARKER_KHR 0x8268 +#define GL_DEBUG_TYPE_PUSH_GROUP_KHR 0x8269 +#define GL_DEBUG_TYPE_POP_GROUP_KHR 0x826A +#define GL_DEBUG_SEVERITY_NOTIFICATION_KHR 0x826B +#define GL_MAX_DEBUG_GROUP_STACK_DEPTH_KHR 0x826C +#define GL_DEBUG_GROUP_STACK_DEPTH_KHR 0x826D +#define GL_BUFFER_KHR 0x82E0 +#define GL_SHADER_KHR 0x82E1 +#define GL_PROGRAM_KHR 0x82E2 +#define GL_QUERY_KHR 0x82E3 +/* PROGRAM_PIPELINE only in GL */ +#define GL_SAMPLER_KHR 0x82E6 +/* DISPLAY_LIST only in GL */ +#define GL_MAX_LABEL_LENGTH_KHR 0x82E8 +#define GL_MAX_DEBUG_MESSAGE_LENGTH_KHR 0x9143 +#define GL_MAX_DEBUG_LOGGED_MESSAGES_KHR 0x9144 +#define GL_DEBUG_LOGGED_MESSAGES_KHR 0x9145 +#define GL_DEBUG_SEVERITY_HIGH_KHR 0x9146 +#define GL_DEBUG_SEVERITY_MEDIUM_KHR 0x9147 +#define GL_DEBUG_SEVERITY_LOW_KHR 0x9148 +#define GL_DEBUG_OUTPUT_KHR 0x92E0 +#define GL_CONTEXT_FLAG_DEBUG_BIT_KHR 0x00000002 +#define GL_STACK_OVERFLOW_KHR 0x0503 +#define GL_STACK_UNDERFLOW_KHR 0x0504 +#endif + +#ifndef GL_KHR_texture_compression_astc_ldr +#define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0 +#define GL_COMPRESSED_RGBA_ASTC_5x4_KHR 0x93B1 +#define GL_COMPRESSED_RGBA_ASTC_5x5_KHR 0x93B2 +#define GL_COMPRESSED_RGBA_ASTC_6x5_KHR 0x93B3 +#define GL_COMPRESSED_RGBA_ASTC_6x6_KHR 0x93B4 +#define GL_COMPRESSED_RGBA_ASTC_8x5_KHR 0x93B5 +#define GL_COMPRESSED_RGBA_ASTC_8x6_KHR 0x93B6 +#define GL_COMPRESSED_RGBA_ASTC_8x8_KHR 0x93B7 +#define GL_COMPRESSED_RGBA_ASTC_10x5_KHR 0x93B8 +#define GL_COMPRESSED_RGBA_ASTC_10x6_KHR 0x93B9 +#define GL_COMPRESSED_RGBA_ASTC_10x8_KHR 0x93BA +#define GL_COMPRESSED_RGBA_ASTC_10x10_KHR 0x93BB +#define GL_COMPRESSED_RGBA_ASTC_12x10_KHR 0x93BC +#define GL_COMPRESSED_RGBA_ASTC_12x12_KHR 0x93BD +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR 0x93D0 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR 0x93D1 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR 0x93D2 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR 0x93D3 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR 0x93D4 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR 0x93D5 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR 0x93D6 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR 0x93D7 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR 0x93D8 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR 0x93D9 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR 0x93DA +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR 0x93DB +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR 0x93DC +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR 0x93DD +#endif + +/*------------------------------------------------------------------------* + * AMD extension tokens + *------------------------------------------------------------------------*/ + +/* GL_AMD_compressed_3DC_texture */ +#ifndef GL_AMD_compressed_3DC_texture +#define GL_3DC_X_AMD 0x87F9 +#define GL_3DC_XY_AMD 0x87FA +#endif + +/* GL_AMD_compressed_ATC_texture */ +#ifndef GL_AMD_compressed_ATC_texture +#define GL_ATC_RGB_AMD 0x8C92 +#define GL_ATC_RGBA_EXPLICIT_ALPHA_AMD 0x8C93 +#define GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD 0x87EE +#endif + +/* GL_AMD_performance_monitor */ +#ifndef GL_AMD_performance_monitor +#define GL_COUNTER_TYPE_AMD 0x8BC0 +#define GL_COUNTER_RANGE_AMD 0x8BC1 +#define GL_UNSIGNED_INT64_AMD 0x8BC2 +#define GL_PERCENTAGE_AMD 0x8BC3 +#define GL_PERFMON_RESULT_AVAILABLE_AMD 0x8BC4 +#define GL_PERFMON_RESULT_SIZE_AMD 0x8BC5 +#define GL_PERFMON_RESULT_AMD 0x8BC6 +#endif + +/* GL_AMD_program_binary_Z400 */ +#ifndef GL_AMD_program_binary_Z400 +#define GL_Z400_BINARY_AMD 0x8740 +#endif + +/*------------------------------------------------------------------------* + * ANGLE extension tokens + *------------------------------------------------------------------------*/ + +/* GL_ANGLE_depth_texture */ +#ifndef GL_ANGLE_depth_texture +#define GL_DEPTH_COMPONENT 0x1902 +#define GL_DEPTH_STENCIL_OES 0x84F9 +#define GL_UNSIGNED_SHORT 0x1403 +#define GL_UNSIGNED_INT 0x1405 +#define GL_UNSIGNED_INT_24_8_OES 0x84FA +#define GL_DEPTH_COMPONENT16 0x81A5 +#define GL_DEPTH_COMPONENT32_OES 0x81A7 +#define GL_DEPTH24_STENCIL8_OES 0x88F0 +#endif + +/* GL_ANGLE_framebuffer_blit */ +#ifndef GL_ANGLE_framebuffer_blit +#define GL_READ_FRAMEBUFFER_ANGLE 0x8CA8 +#define GL_DRAW_FRAMEBUFFER_ANGLE 0x8CA9 +#define GL_DRAW_FRAMEBUFFER_BINDING_ANGLE 0x8CA6 +#define GL_READ_FRAMEBUFFER_BINDING_ANGLE 0x8CAA +#endif + +/* GL_ANGLE_framebuffer_multisample */ +#ifndef GL_ANGLE_framebuffer_multisample +#define GL_RENDERBUFFER_SAMPLES_ANGLE 0x8CAB +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_ANGLE 0x8D56 +#define GL_MAX_SAMPLES_ANGLE 0x8D57 +#endif + +/* GL_ANGLE_instanced_arrays */ +#ifndef GL_ANGLE_instanced_arrays +#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE 0x88FE +#endif + +/* GL_ANGLE_pack_reverse_row_order */ +#ifndef GL_ANGLE_pack_reverse_row_order +#define GL_PACK_REVERSE_ROW_ORDER_ANGLE 0x93A4 +#endif + +/* GL_ANGLE_program_binary */ +#ifndef GL_ANGLE_program_binary +#define GL_PROGRAM_BINARY_ANGLE 0x93A6 +#endif + +/* GL_ANGLE_texture_compression_dxt3 */ +#ifndef GL_ANGLE_texture_compression_dxt3 +#define GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE 0x83F2 +#endif + +/* GL_ANGLE_texture_compression_dxt5 */ +#ifndef GL_ANGLE_texture_compression_dxt5 +#define GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE 0x83F3 +#endif + +/* GL_ANGLE_texture_usage */ +#ifndef GL_ANGLE_texture_usage +#define GL_TEXTURE_USAGE_ANGLE 0x93A2 +#define GL_FRAMEBUFFER_ATTACHMENT_ANGLE 0x93A3 +#endif + +/* GL_ANGLE_translated_shader_source */ +#ifndef GL_ANGLE_translated_shader_source +#define GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE 0x93A0 +#endif + +/*------------------------------------------------------------------------* + * APPLE extension tokens + *------------------------------------------------------------------------*/ + +/* GL_APPLE_copy_texture_levels */ +/* No new tokens introduced by this extension. */ + +/* GL_APPLE_framebuffer_multisample */ +#ifndef GL_APPLE_framebuffer_multisample +#define GL_RENDERBUFFER_SAMPLES_APPLE 0x8CAB +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_APPLE 0x8D56 +#define GL_MAX_SAMPLES_APPLE 0x8D57 +#define GL_READ_FRAMEBUFFER_APPLE 0x8CA8 +#define GL_DRAW_FRAMEBUFFER_APPLE 0x8CA9 +#define GL_DRAW_FRAMEBUFFER_BINDING_APPLE 0x8CA6 +#define GL_READ_FRAMEBUFFER_BINDING_APPLE 0x8CAA +#endif + +/* GL_APPLE_rgb_422 */ +#ifndef GL_APPLE_rgb_422 +#define GL_RGB_422_APPLE 0x8A1F +#define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA +#define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB +#endif + +/* GL_APPLE_sync */ +#ifndef GL_APPLE_sync + +#define GL_SYNC_OBJECT_APPLE 0x8A53 +#define GL_MAX_SERVER_WAIT_TIMEOUT_APPLE 0x9111 +#define GL_OBJECT_TYPE_APPLE 0x9112 +#define GL_SYNC_CONDITION_APPLE 0x9113 +#define GL_SYNC_STATUS_APPLE 0x9114 +#define GL_SYNC_FLAGS_APPLE 0x9115 +#define GL_SYNC_FENCE_APPLE 0x9116 +#define GL_SYNC_GPU_COMMANDS_COMPLETE_APPLE 0x9117 +#define GL_UNSIGNALED_APPLE 0x9118 +#define GL_SIGNALED_APPLE 0x9119 +#define GL_ALREADY_SIGNALED_APPLE 0x911A +#define GL_TIMEOUT_EXPIRED_APPLE 0x911B +#define GL_CONDITION_SATISFIED_APPLE 0x911C +#define GL_WAIT_FAILED_APPLE 0x911D +#define GL_SYNC_FLUSH_COMMANDS_BIT_APPLE 0x00000001 +#define GL_TIMEOUT_IGNORED_APPLE 0xFFFFFFFFFFFFFFFFull +#endif + +/* GL_APPLE_texture_format_BGRA8888 */ +#ifndef GL_APPLE_texture_format_BGRA8888 +#define GL_BGRA_EXT 0x80E1 +#endif + +/* GL_APPLE_texture_max_level */ +#ifndef GL_APPLE_texture_max_level +#define GL_TEXTURE_MAX_LEVEL_APPLE 0x813D +#endif + +/*------------------------------------------------------------------------* + * ARM extension tokens + *------------------------------------------------------------------------*/ + +/* GL_ARM_mali_program_binary */ +#ifndef GL_ARM_mali_program_binary +#define GL_MALI_PROGRAM_BINARY_ARM 0x8F61 +#endif + +/* GL_ARM_mali_shader_binary */ +#ifndef GL_ARM_mali_shader_binary +#define GL_MALI_SHADER_BINARY_ARM 0x8F60 +#endif + +/* GL_ARM_rgba8 */ +/* No new tokens introduced by this extension. */ + +/*------------------------------------------------------------------------* + * EXT extension tokens + *------------------------------------------------------------------------*/ + +/* GL_EXT_blend_minmax */ +#ifndef GL_EXT_blend_minmax +#define GL_MIN_EXT 0x8007 +#define GL_MAX_EXT 0x8008 +#endif + +/* GL_EXT_color_buffer_half_float */ +#ifndef GL_EXT_color_buffer_half_float +#define GL_RGBA16F_EXT 0x881A +#define GL_RGB16F_EXT 0x881B +#define GL_RG16F_EXT 0x822F +#define GL_R16F_EXT 0x822D +#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT 0x8211 +#define GL_UNSIGNED_NORMALIZED_EXT 0x8C17 +#endif + +/* GL_EXT_debug_label */ +#ifndef GL_EXT_debug_label +#define GL_PROGRAM_PIPELINE_OBJECT_EXT 0x8A4F +#define GL_PROGRAM_OBJECT_EXT 0x8B40 +#define GL_SHADER_OBJECT_EXT 0x8B48 +#define GL_BUFFER_OBJECT_EXT 0x9151 +#define GL_QUERY_OBJECT_EXT 0x9153 +#define GL_VERTEX_ARRAY_OBJECT_EXT 0x9154 +#endif + +/* GL_EXT_debug_marker */ +/* No new tokens introduced by this extension. */ + +/* GL_EXT_discard_framebuffer */ +#ifndef GL_EXT_discard_framebuffer +#define GL_COLOR_EXT 0x1800 +#define GL_DEPTH_EXT 0x1801 +#define GL_STENCIL_EXT 0x1802 +#endif + +#ifndef GL_EXT_disjoint_timer_query +#define GL_QUERY_COUNTER_BITS_EXT 0x8864 +#define GL_CURRENT_QUERY_EXT 0x8865 +#define GL_QUERY_RESULT_EXT 0x8866 +#define GL_QUERY_RESULT_AVAILABLE_EXT 0x8867 +#define GL_TIME_ELAPSED_EXT 0x88BF +#define GL_TIMESTAMP_EXT 0x8E28 +#define GL_GPU_DISJOINT_EXT 0x8FBB +#endif + +#ifndef GL_EXT_draw_buffers +#define GL_EXT_draw_buffers 1 +#define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF +#define GL_MAX_DRAW_BUFFERS_EXT 0x8824 +#define GL_DRAW_BUFFER0_EXT 0x8825 +#define GL_DRAW_BUFFER1_EXT 0x8826 +#define GL_DRAW_BUFFER2_EXT 0x8827 +#define GL_DRAW_BUFFER3_EXT 0x8828 +#define GL_DRAW_BUFFER4_EXT 0x8829 +#define GL_DRAW_BUFFER5_EXT 0x882A +#define GL_DRAW_BUFFER6_EXT 0x882B +#define GL_DRAW_BUFFER7_EXT 0x882C +#define GL_DRAW_BUFFER8_EXT 0x882D +#define GL_DRAW_BUFFER9_EXT 0x882E +#define GL_DRAW_BUFFER10_EXT 0x882F +#define GL_DRAW_BUFFER11_EXT 0x8830 +#define GL_DRAW_BUFFER12_EXT 0x8831 +#define GL_DRAW_BUFFER13_EXT 0x8832 +#define GL_DRAW_BUFFER14_EXT 0x8833 +#define GL_DRAW_BUFFER15_EXT 0x8834 +#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0 +#define GL_COLOR_ATTACHMENT1_EXT 0x8CE1 +#define GL_COLOR_ATTACHMENT2_EXT 0x8CE2 +#define GL_COLOR_ATTACHMENT3_EXT 0x8CE3 +#define GL_COLOR_ATTACHMENT4_EXT 0x8CE4 +#define GL_COLOR_ATTACHMENT5_EXT 0x8CE5 +#define GL_COLOR_ATTACHMENT6_EXT 0x8CE6 +#define GL_COLOR_ATTACHMENT7_EXT 0x8CE7 +#define GL_COLOR_ATTACHMENT8_EXT 0x8CE8 +#define GL_COLOR_ATTACHMENT9_EXT 0x8CE9 +#define GL_COLOR_ATTACHMENT10_EXT 0x8CEA +#define GL_COLOR_ATTACHMENT11_EXT 0x8CEB +#define GL_COLOR_ATTACHMENT12_EXT 0x8CEC +#define GL_COLOR_ATTACHMENT13_EXT 0x8CED +#define GL_COLOR_ATTACHMENT14_EXT 0x8CEE +#define GL_COLOR_ATTACHMENT15_EXT 0x8CEF +#endif + +/* GL_EXT_map_buffer_range */ +#ifndef GL_EXT_map_buffer_range +#define GL_MAP_READ_BIT_EXT 0x0001 +#define GL_MAP_WRITE_BIT_EXT 0x0002 +#define GL_MAP_INVALIDATE_RANGE_BIT_EXT 0x0004 +#define GL_MAP_INVALIDATE_BUFFER_BIT_EXT 0x0008 +#define GL_MAP_FLUSH_EXPLICIT_BIT_EXT 0x0010 +#define GL_MAP_UNSYNCHRONIZED_BIT_EXT 0x0020 +#endif + +/* GL_EXT_multisampled_render_to_texture */ +#ifndef GL_EXT_multisampled_render_to_texture +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT 0x8D6C +/* reuse values from GL_EXT_framebuffer_multisample (desktop extension) */ +#define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56 +#define GL_MAX_SAMPLES_EXT 0x8D57 +#endif + +/* GL_EXT_multiview_draw_buffers */ +#ifndef GL_EXT_multiview_draw_buffers +#define GL_COLOR_ATTACHMENT_EXT 0x90F0 +#define GL_MULTIVIEW_EXT 0x90F1 +#define GL_DRAW_BUFFER_EXT 0x0C01 +#define GL_READ_BUFFER_EXT 0x0C02 +#define GL_MAX_MULTIVIEW_BUFFERS_EXT 0x90F2 +#endif + +/* GL_EXT_multi_draw_arrays */ +/* No new tokens introduced by this extension. */ + +/* GL_EXT_occlusion_query_boolean */ +#ifndef GL_EXT_occlusion_query_boolean +#define GL_ANY_SAMPLES_PASSED_EXT 0x8C2F +#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT 0x8D6A +#define GL_CURRENT_QUERY_EXT 0x8865 +#define GL_QUERY_RESULT_EXT 0x8866 +#define GL_QUERY_RESULT_AVAILABLE_EXT 0x8867 +#endif + +/* GL_EXT_read_format_bgra */ +#ifndef GL_EXT_read_format_bgra +#define GL_BGRA_EXT 0x80E1 +#define GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT 0x8365 +#define GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT 0x8366 +#endif + +/* GL_EXT_robustness */ +#ifndef GL_EXT_robustness +/* reuse GL_NO_ERROR */ +#define GL_GUILTY_CONTEXT_RESET_EXT 0x8253 +#define GL_INNOCENT_CONTEXT_RESET_EXT 0x8254 +#define GL_UNKNOWN_CONTEXT_RESET_EXT 0x8255 +#define GL_CONTEXT_ROBUST_ACCESS_EXT 0x90F3 +#define GL_RESET_NOTIFICATION_STRATEGY_EXT 0x8256 +#define GL_LOSE_CONTEXT_ON_RESET_EXT 0x8252 +#define GL_NO_RESET_NOTIFICATION_EXT 0x8261 +#endif + +/* GL_EXT_separate_shader_objects */ +#ifndef GL_EXT_separate_shader_objects +#define GL_VERTEX_SHADER_BIT_EXT 0x00000001 +#define GL_FRAGMENT_SHADER_BIT_EXT 0x00000002 +#define GL_ALL_SHADER_BITS_EXT 0xFFFFFFFF +#define GL_PROGRAM_SEPARABLE_EXT 0x8258 +#define GL_ACTIVE_PROGRAM_EXT 0x8259 +#define GL_PROGRAM_PIPELINE_BINDING_EXT 0x825A +#endif + +/* GL_EXT_shader_framebuffer_fetch */ +#ifndef GL_EXT_shader_framebuffer_fetch +#define GL_FRAGMENT_SHADER_DISCARDS_SAMPLES_EXT 0x8A52 +#endif + +/* GL_EXT_shader_texture_lod */ +/* No new tokens introduced by this extension. */ + +/* GL_EXT_shadow_samplers */ +#ifndef GL_EXT_shadow_samplers +#define GL_TEXTURE_COMPARE_MODE_EXT 0x884C +#define GL_TEXTURE_COMPARE_FUNC_EXT 0x884D +#define GL_COMPARE_REF_TO_TEXTURE_EXT 0x884E +#define GL_SAMPLER_2D_SHADOW_EXT 0x8B62 +#endif + +/* GL_EXT_sRGB */ +#ifndef GL_EXT_sRGB +#define GL_SRGB_EXT 0x8C40 +#define GL_SRGB_ALPHA_EXT 0x8C42 +#define GL_SRGB8_ALPHA8_EXT 0x8C43 +#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT 0x8210 +#endif + +/* GL_EXT_sRGB_write_control */ +#ifndef GL_EXT_sRGB_write_control +#define GL_EXT_sRGB_write_control 1 +#define GL_FRAMEBUFFER_SRGB_EXT 0x8DB9 +#endif + +/* GL_EXT_texture_compression_dxt1 */ +#ifndef GL_EXT_texture_compression_dxt1 +#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 +#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 +#endif + +/* GL_EXT_texture_filter_anisotropic */ +#ifndef GL_EXT_texture_filter_anisotropic +#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE +#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF +#endif + +/* GL_EXT_texture_format_BGRA8888 */ +#ifndef GL_EXT_texture_format_BGRA8888 +#define GL_BGRA_EXT 0x80E1 +#endif + +/* GL_EXT_texture_rg */ +#ifndef GL_EXT_texture_rg +#define GL_RED_EXT 0x1903 +#define GL_RG_EXT 0x8227 +#define GL_R8_EXT 0x8229 +#define GL_RG8_EXT 0x822B +#endif + +/* GL_EXT_texture_sRGB_decode */ +#ifndef GL_EXT_texture_sRGB_decode +#define GL_EXT_texture_sRGB_decode 1 +#define GL_TEXTURE_SRGB_DECODE_EXT 0x8A48 +#define GL_DECODE_EXT 0x8A49 +#define GL_SKIP_DECODE_EXT 0x8A4A +#endif + +/* GL_EXT_texture_storage */ +#ifndef GL_EXT_texture_storage +#define GL_TEXTURE_IMMUTABLE_FORMAT_EXT 0x912F +#define GL_ALPHA8_EXT 0x803C +#define GL_LUMINANCE8_EXT 0x8040 +#define GL_LUMINANCE8_ALPHA8_EXT 0x8045 +#define GL_RGBA32F_EXT 0x8814 +#define GL_RGB32F_EXT 0x8815 +#define GL_ALPHA32F_EXT 0x8816 +#define GL_LUMINANCE32F_EXT 0x8818 +#define GL_LUMINANCE_ALPHA32F_EXT 0x8819 +/* reuse GL_RGBA16F_EXT */ +/* reuse GL_RGB16F_EXT */ +#define GL_ALPHA16F_EXT 0x881C +#define GL_LUMINANCE16F_EXT 0x881E +#define GL_LUMINANCE_ALPHA16F_EXT 0x881F +#define GL_RGB10_A2_EXT 0x8059 +#define GL_RGB10_EXT 0x8052 +#define GL_BGRA8_EXT 0x93A1 +#define GL_R8_EXT 0x8229 +#define GL_RG8_EXT 0x822B +#define GL_R32F_EXT 0x822E +#define GL_RG32F_EXT 0x8230 +#define GL_R16F_EXT 0x822D +#define GL_RG16F_EXT 0x822F +#endif + +/* GL_EXT_texture_type_2_10_10_10_REV */ +#ifndef GL_EXT_texture_type_2_10_10_10_REV +#define GL_UNSIGNED_INT_2_10_10_10_REV_EXT 0x8368 +#endif + +/* GL_EXT_unpack_subimage */ +#ifndef GL_EXT_unpack_subimage +#define GL_UNPACK_ROW_LENGTH_EXT 0x0CF2 +#define GL_UNPACK_SKIP_ROWS_EXT 0x0CF3 +#define GL_UNPACK_SKIP_PIXELS_EXT 0x0CF4 +#endif + +/*------------------------------------------------------------------------* + * DMP extension tokens + *------------------------------------------------------------------------*/ + +/* GL_DMP_shader_binary */ +#ifndef GL_DMP_shader_binary +#define GL_SHADER_BINARY_DMP 0x9250 +#endif + +/*------------------------------------------------------------------------* + * FJ extension tokens + *------------------------------------------------------------------------*/ + +/* GL_FJ_shader_binary_GCCSO */ +#ifndef GL_FJ_shader_binary_GCCSO +#define GL_GCCSO_SHADER_BINARY_FJ 0x9260 +#endif + +/*------------------------------------------------------------------------* + * IMG extension tokens + *------------------------------------------------------------------------*/ + +/* GL_IMG_program_binary */ +#ifndef GL_IMG_program_binary +#define GL_SGX_PROGRAM_BINARY_IMG 0x9130 +#endif + +/* GL_IMG_read_format */ +#ifndef GL_IMG_read_format +#define GL_BGRA_IMG 0x80E1 +#define GL_UNSIGNED_SHORT_4_4_4_4_REV_IMG 0x8365 +#endif + +/* GL_IMG_shader_binary */ +#ifndef GL_IMG_shader_binary +#define GL_SGX_BINARY_IMG 0x8C0A +#endif + +/* GL_IMG_texture_compression_pvrtc */ +#ifndef GL_IMG_texture_compression_pvrtc +#define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00 +#define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01 +#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02 +#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03 +#endif + +/* GL_IMG_texture_compression_pvrtc2 */ +#ifndef GL_IMG_texture_compression_pvrtc2 +#define GL_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG 0x9137 +#define GL_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG 0x9138 +#endif + +/* GL_IMG_multisampled_render_to_texture */ +#ifndef GL_IMG_multisampled_render_to_texture +#define GL_RENDERBUFFER_SAMPLES_IMG 0x9133 +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_IMG 0x9134 +#define GL_MAX_SAMPLES_IMG 0x9135 +#define GL_TEXTURE_SAMPLES_IMG 0x9136 +#endif + +/*------------------------------------------------------------------------* + * NV extension tokens + *------------------------------------------------------------------------*/ + +/* GL_NV_coverage_sample */ +#ifndef GL_NV_coverage_sample +#define GL_COVERAGE_COMPONENT_NV 0x8ED0 +#define GL_COVERAGE_COMPONENT4_NV 0x8ED1 +#define GL_COVERAGE_ATTACHMENT_NV 0x8ED2 +#define GL_COVERAGE_BUFFERS_NV 0x8ED3 +#define GL_COVERAGE_SAMPLES_NV 0x8ED4 +#define GL_COVERAGE_ALL_FRAGMENTS_NV 0x8ED5 +#define GL_COVERAGE_EDGE_FRAGMENTS_NV 0x8ED6 +#define GL_COVERAGE_AUTOMATIC_NV 0x8ED7 +#define GL_COVERAGE_BUFFER_BIT_NV 0x00008000 +#endif + +/* GL_NV_depth_nonlinear */ +#ifndef GL_NV_depth_nonlinear +#define GL_DEPTH_COMPONENT16_NONLINEAR_NV 0x8E2C +#endif + +/* GL_NV_draw_buffers */ +#ifndef GL_NV_draw_buffers +#define GL_MAX_DRAW_BUFFERS_NV 0x8824 +#define GL_DRAW_BUFFER0_NV 0x8825 +#define GL_DRAW_BUFFER1_NV 0x8826 +#define GL_DRAW_BUFFER2_NV 0x8827 +#define GL_DRAW_BUFFER3_NV 0x8828 +#define GL_DRAW_BUFFER4_NV 0x8829 +#define GL_DRAW_BUFFER5_NV 0x882A +#define GL_DRAW_BUFFER6_NV 0x882B +#define GL_DRAW_BUFFER7_NV 0x882C +#define GL_DRAW_BUFFER8_NV 0x882D +#define GL_DRAW_BUFFER9_NV 0x882E +#define GL_DRAW_BUFFER10_NV 0x882F +#define GL_DRAW_BUFFER11_NV 0x8830 +#define GL_DRAW_BUFFER12_NV 0x8831 +#define GL_DRAW_BUFFER13_NV 0x8832 +#define GL_DRAW_BUFFER14_NV 0x8833 +#define GL_DRAW_BUFFER15_NV 0x8834 +#define GL_COLOR_ATTACHMENT0_NV 0x8CE0 +#define GL_COLOR_ATTACHMENT1_NV 0x8CE1 +#define GL_COLOR_ATTACHMENT2_NV 0x8CE2 +#define GL_COLOR_ATTACHMENT3_NV 0x8CE3 +#define GL_COLOR_ATTACHMENT4_NV 0x8CE4 +#define GL_COLOR_ATTACHMENT5_NV 0x8CE5 +#define GL_COLOR_ATTACHMENT6_NV 0x8CE6 +#define GL_COLOR_ATTACHMENT7_NV 0x8CE7 +#define GL_COLOR_ATTACHMENT8_NV 0x8CE8 +#define GL_COLOR_ATTACHMENT9_NV 0x8CE9 +#define GL_COLOR_ATTACHMENT10_NV 0x8CEA +#define GL_COLOR_ATTACHMENT11_NV 0x8CEB +#define GL_COLOR_ATTACHMENT12_NV 0x8CEC +#define GL_COLOR_ATTACHMENT13_NV 0x8CED +#define GL_COLOR_ATTACHMENT14_NV 0x8CEE +#define GL_COLOR_ATTACHMENT15_NV 0x8CEF +#endif + +/* GL_NV_draw_instanced */ +/* No new tokens introduced by this extension. */ + +/* GL_NV_fbo_color_attachments */ +#ifndef GL_NV_fbo_color_attachments +#define GL_MAX_COLOR_ATTACHMENTS_NV 0x8CDF +/* GL_COLOR_ATTACHMENT{0-15}_NV defined in GL_NV_draw_buffers already. */ +#endif + +/* GL_NV_fence */ +#ifndef GL_NV_fence +#define GL_ALL_COMPLETED_NV 0x84F2 +#define GL_FENCE_STATUS_NV 0x84F3 +#define GL_FENCE_CONDITION_NV 0x84F4 +#endif + +/* GL_NV_framebuffer_blit */ +#ifndef GL_NV_framebuffer_blit +#define GL_READ_FRAMEBUFFER_NV 0x8CA8 +#define GL_DRAW_FRAMEBUFFER_NV 0x8CA9 +#define GL_DRAW_FRAMEBUFFER_BINDING_NV 0x8CA6 +#define GL_READ_FRAMEBUFFER_BINDING_NV 0x8CAA +#endif + +/* GL_NV_framebuffer_multisample */ +#ifndef GL_NV_framebuffer_multisample +#define GL_RENDERBUFFER_SAMPLES_NV 0x8CAB +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_NV 0x8D56 +#define GL_MAX_SAMPLES_NV 0x8D57 +#endif + +/* GL_NV_generate_mipmap_sRGB */ +/* No new tokens introduced by this extension. */ + +/* GL_NV_instanced_arrays */ +#ifndef GL_NV_instanced_arrays +#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_NV 0x88FE +#endif + +/* GL_NV_read_buffer */ +#ifndef GL_NV_read_buffer +#define GL_READ_BUFFER_NV 0x0C02 +#endif + +/* GL_NV_read_buffer_front */ +/* No new tokens introduced by this extension. */ + +/* GL_NV_read_depth */ +/* No new tokens introduced by this extension. */ + +/* GL_NV_read_depth_stencil */ +/* No new tokens introduced by this extension. */ + +/* GL_NV_read_stencil */ +/* No new tokens introduced by this extension. */ + +/* GL_NV_shadow_samplers_array */ +#ifndef GL_NV_shadow_samplers_array +#define GL_SAMPLER_2D_ARRAY_SHADOW_NV 0x8DC4 +#endif + +/* GL_NV_shadow_samplers_cube */ +#ifndef GL_NV_shadow_samplers_cube +#define GL_SAMPLER_CUBE_SHADOW_NV 0x8DC5 +#endif + +/* GL_NV_sRGB_formats */ +#ifndef GL_NV_sRGB_formats +#define GL_SLUMINANCE_NV 0x8C46 +#define GL_SLUMINANCE_ALPHA_NV 0x8C44 +#define GL_SRGB8_NV 0x8C41 +#define GL_SLUMINANCE8_NV 0x8C47 +#define GL_SLUMINANCE8_ALPHA8_NV 0x8C45 +#define GL_COMPRESSED_SRGB_S3TC_DXT1_NV 0x8C4C +#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_NV 0x8C4D +#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_NV 0x8C4E +#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_NV 0x8C4F +#define GL_ETC1_SRGB8_NV 0x88EE +#endif + +/* GL_NV_texture_border_clamp */ +#ifndef GL_NV_texture_border_clamp +#define GL_TEXTURE_BORDER_COLOR_NV 0x1004 +#define GL_CLAMP_TO_BORDER_NV 0x812D +#endif + +/* GL_NV_texture_compression_s3tc_update */ +/* No new tokens introduced by this extension. */ + +/* GL_NV_texture_npot_2D_mipmap */ +/* No new tokens introduced by this extension. */ + +/*------------------------------------------------------------------------* + * QCOM extension tokens + *------------------------------------------------------------------------*/ + +/* GL_QCOM_alpha_test */ +#ifndef GL_QCOM_alpha_test +#define GL_ALPHA_TEST_QCOM 0x0BC0 +#define GL_ALPHA_TEST_FUNC_QCOM 0x0BC1 +#define GL_ALPHA_TEST_REF_QCOM 0x0BC2 +#endif + +/* GL_QCOM_binning_control */ +#ifndef GL_QCOM_binning_control +#define GL_BINNING_CONTROL_HINT_QCOM 0x8FB0 +#define GL_CPU_OPTIMIZED_QCOM 0x8FB1 +#define GL_GPU_OPTIMIZED_QCOM 0x8FB2 +#define GL_RENDER_DIRECT_TO_FRAMEBUFFER_QCOM 0x8FB3 +#endif + +/* GL_QCOM_driver_control */ +/* No new tokens introduced by this extension. */ + +/* GL_QCOM_extended_get */ +#ifndef GL_QCOM_extended_get +#define GL_TEXTURE_WIDTH_QCOM 0x8BD2 +#define GL_TEXTURE_HEIGHT_QCOM 0x8BD3 +#define GL_TEXTURE_DEPTH_QCOM 0x8BD4 +#define GL_TEXTURE_INTERNAL_FORMAT_QCOM 0x8BD5 +#define GL_TEXTURE_FORMAT_QCOM 0x8BD6 +#define GL_TEXTURE_TYPE_QCOM 0x8BD7 +#define GL_TEXTURE_IMAGE_VALID_QCOM 0x8BD8 +#define GL_TEXTURE_NUM_LEVELS_QCOM 0x8BD9 +#define GL_TEXTURE_TARGET_QCOM 0x8BDA +#define GL_TEXTURE_OBJECT_VALID_QCOM 0x8BDB +#define GL_STATE_RESTORE 0x8BDC +#endif + +/* GL_QCOM_extended_get2 */ +/* No new tokens introduced by this extension. */ + +/* GL_QCOM_perfmon_global_mode */ +#ifndef GL_QCOM_perfmon_global_mode +#define GL_PERFMON_GLOBAL_MODE_QCOM 0x8FA0 +#endif + +/* GL_QCOM_writeonly_rendering */ +#ifndef GL_QCOM_writeonly_rendering +#define GL_WRITEONLY_RENDERING_QCOM 0x8823 +#endif + +/* GL_QCOM_tiled_rendering */ +#ifndef GL_QCOM_tiled_rendering +#define GL_COLOR_BUFFER_BIT0_QCOM 0x00000001 +#define GL_COLOR_BUFFER_BIT1_QCOM 0x00000002 +#define GL_COLOR_BUFFER_BIT2_QCOM 0x00000004 +#define GL_COLOR_BUFFER_BIT3_QCOM 0x00000008 +#define GL_COLOR_BUFFER_BIT4_QCOM 0x00000010 +#define GL_COLOR_BUFFER_BIT5_QCOM 0x00000020 +#define GL_COLOR_BUFFER_BIT6_QCOM 0x00000040 +#define GL_COLOR_BUFFER_BIT7_QCOM 0x00000080 +#define GL_DEPTH_BUFFER_BIT0_QCOM 0x00000100 +#define GL_DEPTH_BUFFER_BIT1_QCOM 0x00000200 +#define GL_DEPTH_BUFFER_BIT2_QCOM 0x00000400 +#define GL_DEPTH_BUFFER_BIT3_QCOM 0x00000800 +#define GL_DEPTH_BUFFER_BIT4_QCOM 0x00001000 +#define GL_DEPTH_BUFFER_BIT5_QCOM 0x00002000 +#define GL_DEPTH_BUFFER_BIT6_QCOM 0x00004000 +#define GL_DEPTH_BUFFER_BIT7_QCOM 0x00008000 +#define GL_STENCIL_BUFFER_BIT0_QCOM 0x00010000 +#define GL_STENCIL_BUFFER_BIT1_QCOM 0x00020000 +#define GL_STENCIL_BUFFER_BIT2_QCOM 0x00040000 +#define GL_STENCIL_BUFFER_BIT3_QCOM 0x00080000 +#define GL_STENCIL_BUFFER_BIT4_QCOM 0x00100000 +#define GL_STENCIL_BUFFER_BIT5_QCOM 0x00200000 +#define GL_STENCIL_BUFFER_BIT6_QCOM 0x00400000 +#define GL_STENCIL_BUFFER_BIT7_QCOM 0x00800000 +#define GL_MULTISAMPLE_BUFFER_BIT0_QCOM 0x01000000 +#define GL_MULTISAMPLE_BUFFER_BIT1_QCOM 0x02000000 +#define GL_MULTISAMPLE_BUFFER_BIT2_QCOM 0x04000000 +#define GL_MULTISAMPLE_BUFFER_BIT3_QCOM 0x08000000 +#define GL_MULTISAMPLE_BUFFER_BIT4_QCOM 0x10000000 +#define GL_MULTISAMPLE_BUFFER_BIT5_QCOM 0x20000000 +#define GL_MULTISAMPLE_BUFFER_BIT6_QCOM 0x40000000 +#define GL_MULTISAMPLE_BUFFER_BIT7_QCOM 0x80000000 +#endif + +/*------------------------------------------------------------------------* + * VIV extension tokens + *------------------------------------------------------------------------*/ + +/* GL_VIV_shader_binary */ +#ifndef GL_VIV_shader_binary +#define GL_SHADER_BINARY_VIV 0x8FC4 +#endif + +/*------------------------------------------------------------------------* + * End of extension tokens, start of corresponding extension functions + *------------------------------------------------------------------------*/ + +/*------------------------------------------------------------------------* + * OES extension functions + *------------------------------------------------------------------------*/ + +/* GL_OES_compressed_ETC1_RGB8_texture */ +#ifndef GL_OES_compressed_ETC1_RGB8_texture +#define GL_OES_compressed_ETC1_RGB8_texture 1 +#endif + +/* GL_OES_compressed_paletted_texture */ +#ifndef GL_OES_compressed_paletted_texture +#define GL_OES_compressed_paletted_texture 1 +#endif + +/* GL_OES_depth24 */ +#ifndef GL_OES_depth24 +#define GL_OES_depth24 1 +#endif + +/* GL_OES_depth32 */ +#ifndef GL_OES_depth32 +#define GL_OES_depth32 1 +#endif + +/* GL_OES_depth_texture */ +#ifndef GL_OES_depth_texture +#define GL_OES_depth_texture 1 +#endif + +/* GL_OES_EGL_image */ +#ifndef GL_OES_EGL_image +#define GL_OES_EGL_image 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glEGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image); +GL_APICALL void GL_APIENTRY glEGLImageTargetRenderbufferStorageOES (GLenum target, GLeglImageOES image); +#endif +typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image); +typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLeglImageOES image); +#endif + +/* GL_OES_EGL_image_external */ +#ifndef GL_OES_EGL_image_external +#define GL_OES_EGL_image_external 1 +/* glEGLImageTargetTexture2DOES defined in GL_OES_EGL_image already. */ +#endif + +/* GL_OES_element_index_uint */ +#ifndef GL_OES_element_index_uint +#define GL_OES_element_index_uint 1 +#endif + +/* GL_OES_fbo_render_mipmap */ +#ifndef GL_OES_fbo_render_mipmap +#define GL_OES_fbo_render_mipmap 1 +#endif + +/* GL_OES_fragment_precision_high */ +#ifndef GL_OES_fragment_precision_high +#define GL_OES_fragment_precision_high 1 +#endif + +/* GL_OES_get_program_binary */ +#ifndef GL_OES_get_program_binary +#define GL_OES_get_program_binary 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glGetProgramBinaryOES (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary); +GL_APICALL void GL_APIENTRY glProgramBinaryOES (GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length); +#endif +typedef void (GL_APIENTRYP PFNGLGETPROGRAMBINARYOESPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary); +typedef void (GL_APIENTRYP PFNGLPROGRAMBINARYOESPROC) (GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length); +#endif + +/* GL_OES_mapbuffer */ +#ifndef GL_OES_mapbuffer +#define GL_OES_mapbuffer 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void* GL_APIENTRY glMapBufferOES (GLenum target, GLenum access); +GL_APICALL GLboolean GL_APIENTRY glUnmapBufferOES (GLenum target); +GL_APICALL void GL_APIENTRY glGetBufferPointervOES (GLenum target, GLenum pname, GLvoid **params); +#endif +typedef void* (GL_APIENTRYP PFNGLMAPBUFFEROESPROC) (GLenum target, GLenum access); +typedef GLboolean (GL_APIENTRYP PFNGLUNMAPBUFFEROESPROC) (GLenum target); +typedef void (GL_APIENTRYP PFNGLGETBUFFERPOINTERVOESPROC) (GLenum target, GLenum pname, GLvoid **params); +#endif + +/* GL_OES_packed_depth_stencil */ +#ifndef GL_OES_packed_depth_stencil +#define GL_OES_packed_depth_stencil 1 +#endif + +/* GL_OES_required_internalformat */ +#ifndef GL_OES_required_internalformat +#define GL_OES_required_internalformat 1 +#endif + +/* GL_OES_rgb8_rgba8 */ +#ifndef GL_OES_rgb8_rgba8 +#define GL_OES_rgb8_rgba8 1 +#endif + +/* GL_OES_standard_derivatives */ +#ifndef GL_OES_standard_derivatives +#define GL_OES_standard_derivatives 1 +#endif + +/* GL_OES_stencil1 */ +#ifndef GL_OES_stencil1 +#define GL_OES_stencil1 1 +#endif + +/* GL_OES_stencil4 */ +#ifndef GL_OES_stencil4 +#define GL_OES_stencil4 1 +#endif + +#ifndef GL_OES_surfaceless_context +#define GL_OES_surfaceless_context 1 +#endif + +/* GL_OES_texture_3D */ +#ifndef GL_OES_texture_3D +#define GL_OES_texture_3D 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glTexImage3DOES (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels); +GL_APICALL void GL_APIENTRY glTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels); +GL_APICALL void GL_APIENTRY glCopyTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glCompressedTexImage3DOES (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data); +GL_APICALL void GL_APIENTRY glCompressedTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data); +GL_APICALL void GL_APIENTRY glFramebufferTexture3DOES (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +#endif +typedef void (GL_APIENTRYP PFNGLTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels); +typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels); +typedef void (GL_APIENTRYP PFNGLCOPYTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data); +typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data); +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DOESPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +#endif + +/* GL_OES_texture_float */ +#ifndef GL_OES_texture_float +#define GL_OES_texture_float 1 +#endif + +/* GL_OES_texture_float_linear */ +#ifndef GL_OES_texture_float_linear +#define GL_OES_texture_float_linear 1 +#endif + +/* GL_OES_texture_half_float */ +#ifndef GL_OES_texture_half_float +#define GL_OES_texture_half_float 1 +#endif + +/* GL_OES_texture_half_float_linear */ +#ifndef GL_OES_texture_half_float_linear +#define GL_OES_texture_half_float_linear 1 +#endif + +/* GL_OES_texture_npot */ +#ifndef GL_OES_texture_npot +#define GL_OES_texture_npot 1 +#endif + +/* GL_OES_vertex_array_object */ +#ifndef GL_OES_vertex_array_object +#define GL_OES_vertex_array_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glBindVertexArrayOES (GLuint array); +GL_APICALL void GL_APIENTRY glDeleteVertexArraysOES (GLsizei n, const GLuint *arrays); +GL_APICALL void GL_APIENTRY glGenVertexArraysOES (GLsizei n, GLuint *arrays); +GL_APICALL GLboolean GL_APIENTRY glIsVertexArrayOES (GLuint array); +#endif +typedef void (GL_APIENTRYP PFNGLBINDVERTEXARRAYOESPROC) (GLuint array); +typedef void (GL_APIENTRYP PFNGLDELETEVERTEXARRAYSOESPROC) (GLsizei n, const GLuint *arrays); +typedef void (GL_APIENTRYP PFNGLGENVERTEXARRAYSOESPROC) (GLsizei n, GLuint *arrays); +typedef GLboolean (GL_APIENTRYP PFNGLISVERTEXARRAYOESPROC) (GLuint array); +#endif + +/* GL_OES_vertex_half_float */ +#ifndef GL_OES_vertex_half_float +#define GL_OES_vertex_half_float 1 +#endif + +/* GL_OES_vertex_type_10_10_10_2 */ +#ifndef GL_OES_vertex_type_10_10_10_2 +#define GL_OES_vertex_type_10_10_10_2 1 +#endif + +/*------------------------------------------------------------------------* + * KHR extension functions + *------------------------------------------------------------------------*/ + +#ifndef GL_KHR_debug +#define GL_KHR_debug 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDebugMessageControlKHR (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); +GL_APICALL void GL_APIENTRY glDebugMessageInsertKHR (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); +GL_APICALL void GL_APIENTRY glDebugMessageCallbackKHR (GLDEBUGPROCKHR callback, const void *userParam); +GL_APICALL GLuint GL_APIENTRY glGetDebugMessageLogKHR (GLuint count, GLsizei bufsize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); +GL_APICALL void GL_APIENTRY glPushDebugGroupKHR (GLenum source, GLuint id, GLsizei length, const GLchar *message); +GL_APICALL void GL_APIENTRY glPopDebugGroupKHR (void); +GL_APICALL void GL_APIENTRY glObjectLabelKHR (GLenum identifier, GLuint name, GLsizei length, const GLchar *label); +GL_APICALL void GL_APIENTRY glGetObjectLabelKHR (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label); +GL_APICALL void GL_APIENTRY glObjectPtrLabelKHR (const void *ptr, GLsizei length, const GLchar *label); +GL_APICALL void GL_APIENTRY glGetObjectPtrLabelKHR (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label); +GL_APICALL void GL_APIENTRY glGetPointervKHR (GLenum pname, GLvoid **params); +#endif +typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGECONTROLKHRPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); +typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGEINSERTKHRPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); +typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGECALLBACKKHRPROC) (GLDEBUGPROCKHR callback, const void *userParam); +typedef GLuint (GL_APIENTRYP PFNGLGETDEBUGMESSAGELOGKHRPROC) (GLuint count, GLsizei bufsize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); +typedef void (GL_APIENTRYP PFNGLPUSHDEBUGGROUPKHRPROC) (GLenum source, GLuint id, GLsizei length, const GLchar *message); +typedef void (GL_APIENTRYP PFNGLPOPDEBUGGROUPKHRPROC) (void); +typedef void (GL_APIENTRYP PFNGLOBJECTLABELKHRPROC) (GLenum identifier, GLuint name, GLsizei length, const GLchar *label); +typedef void (GL_APIENTRYP PFNGLGETOBJECTLABELKHRPROC) (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label); +typedef void (GL_APIENTRYP PFNGLOBJECTPTRLABELKHRPROC) (const void *ptr, GLsizei length, const GLchar *label); +typedef void (GL_APIENTRYP PFNGLGETOBJECTPTRLABELKHRPROC) (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label); +typedef void (GL_APIENTRYP PFNGLGETPOINTERVKHRPROC) (GLenum pname, GLvoid **params); +#endif + +#ifndef GL_KHR_texture_compression_astc_ldr +#define GL_KHR_texture_compression_astc_ldr 1 +#endif + + +/*------------------------------------------------------------------------* + * AMD extension functions + *------------------------------------------------------------------------*/ + +/* GL_AMD_compressed_3DC_texture */ +#ifndef GL_AMD_compressed_3DC_texture +#define GL_AMD_compressed_3DC_texture 1 +#endif + +/* GL_AMD_compressed_ATC_texture */ +#ifndef GL_AMD_compressed_ATC_texture +#define GL_AMD_compressed_ATC_texture 1 +#endif + +/* AMD_performance_monitor */ +#ifndef GL_AMD_performance_monitor +#define GL_AMD_performance_monitor 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glGetPerfMonitorGroupsAMD (GLint *numGroups, GLsizei groupsSize, GLuint *groups); +GL_APICALL void GL_APIENTRY glGetPerfMonitorCountersAMD (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters); +GL_APICALL void GL_APIENTRY glGetPerfMonitorGroupStringAMD (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString); +GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterStringAMD (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString); +GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterInfoAMD (GLuint group, GLuint counter, GLenum pname, GLvoid *data); +GL_APICALL void GL_APIENTRY glGenPerfMonitorsAMD (GLsizei n, GLuint *monitors); +GL_APICALL void GL_APIENTRY glDeletePerfMonitorsAMD (GLsizei n, GLuint *monitors); +GL_APICALL void GL_APIENTRY glSelectPerfMonitorCountersAMD (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *countersList); +GL_APICALL void GL_APIENTRY glBeginPerfMonitorAMD (GLuint monitor); +GL_APICALL void GL_APIENTRY glEndPerfMonitorAMD (GLuint monitor); +GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterDataAMD (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten); +#endif +typedef void (GL_APIENTRYP PFNGLGETPERFMONITORGROUPSAMDPROC) (GLint *numGroups, GLsizei groupsSize, GLuint *groups); +typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERSAMDPROC) (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters); +typedef void (GL_APIENTRYP PFNGLGETPERFMONITORGROUPSTRINGAMDPROC) (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString); +typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC) (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString); +typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERINFOAMDPROC) (GLuint group, GLuint counter, GLenum pname, GLvoid *data); +typedef void (GL_APIENTRYP PFNGLGENPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors); +typedef void (GL_APIENTRYP PFNGLDELETEPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors); +typedef void (GL_APIENTRYP PFNGLSELECTPERFMONITORCOUNTERSAMDPROC) (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *countersList); +typedef void (GL_APIENTRYP PFNGLBEGINPERFMONITORAMDPROC) (GLuint monitor); +typedef void (GL_APIENTRYP PFNGLENDPERFMONITORAMDPROC) (GLuint monitor); +typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERDATAAMDPROC) (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten); +#endif + +/* GL_AMD_program_binary_Z400 */ +#ifndef GL_AMD_program_binary_Z400 +#define GL_AMD_program_binary_Z400 1 +#endif + +/*------------------------------------------------------------------------* + * ANGLE extension functions + *------------------------------------------------------------------------*/ + +/* GL_ANGLE_depth_texture */ +#ifndef GL_ANGLE_depth_texture +#define GL_ANGLE_depth_texture 1 +#endif + +/* GL_ANGLE_framebuffer_blit */ +#ifndef GL_ANGLE_framebuffer_blit +#define GL_ANGLE_framebuffer_blit 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glBlitFramebufferANGLE (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +#endif +typedef void (GL_APIENTRYP PFNGLBLITFRAMEBUFFERANGLEPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +#endif + +/* GL_ANGLE_framebuffer_multisample */ +#ifndef GL_ANGLE_framebuffer_multisample +#define GL_ANGLE_framebuffer_multisample 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleANGLE (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +#endif +typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEANGLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +#endif + +#ifndef GL_ANGLE_instanced_arrays +#define GL_ANGLE_instanced_arrays 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDrawArraysInstancedANGLE (GLenum mode, GLint first, GLsizei count, GLsizei primcount); +GL_APICALL void GL_APIENTRY glDrawElementsInstancedANGLE (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); +GL_APICALL void GL_APIENTRY glVertexAttribDivisorANGLE (GLuint index, GLuint divisor); +#endif +typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDANGLEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount); +typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDANGLEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); +typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISORANGLEPROC) (GLuint index, GLuint divisor); +#endif + +/* GL_ANGLE_pack_reverse_row_order */ +#ifndef GL_ANGLE_pack_reverse_row_order +#define GL_ANGLE_pack_reverse_row_order 1 +#endif + +/* GL_ANGLE_program_binary */ +#ifndef GL_ANGLE_program_binary +#define GL_ANGLE_program_binary 1 +#endif + +/* GL_ANGLE_texture_compression_dxt3 */ +#ifndef GL_ANGLE_texture_compression_dxt3 +#define GL_ANGLE_texture_compression_dxt3 1 +#endif + +/* GL_ANGLE_texture_compression_dxt5 */ +#ifndef GL_ANGLE_texture_compression_dxt5 +#define GL_ANGLE_texture_compression_dxt5 1 +#endif + +/* GL_ANGLE_texture_usage */ +#ifndef GL_ANGLE_texture_usage +#define GL_ANGLE_texture_usage 1 +#endif + +#ifndef GL_ANGLE_translated_shader_source +#define GL_ANGLE_translated_shader_source 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glGetTranslatedShaderSourceANGLE (GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source); +#endif +typedef void (GL_APIENTRYP PFNGLGETTRANSLATEDSHADERSOURCEANGLEPROC) (GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source); +#endif + +/*------------------------------------------------------------------------* + * APPLE extension functions + *------------------------------------------------------------------------*/ + +/* GL_APPLE_copy_texture_levels */ +#ifndef GL_APPLE_copy_texture_levels +#define GL_APPLE_copy_texture_levels 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glCopyTextureLevelsAPPLE (GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount); +#endif +typedef void (GL_APIENTRYP PFNGLCOPYTEXTURELEVELSAPPLEPROC) (GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount); +#endif + +/* GL_APPLE_framebuffer_multisample */ +#ifndef GL_APPLE_framebuffer_multisample +#define GL_APPLE_framebuffer_multisample 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleAPPLE (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glResolveMultisampleFramebufferAPPLE (void); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEAPPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLRESOLVEMULTISAMPLEFRAMEBUFFERAPPLEPROC) (void); +#endif + +/* GL_APPLE_rgb_422 */ +#ifndef GL_APPLE_rgb_422 +#define GL_APPLE_rgb_422 1 +#endif + +/* GL_APPLE_sync */ +#ifndef GL_APPLE_sync +#define GL_APPLE_sync 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL GLsync GL_APIENTRY glFenceSyncAPPLE (GLenum condition, GLbitfield flags); +GL_APICALL GLboolean GL_APIENTRY glIsSyncAPPLE (GLsync sync); +GL_APICALL void GL_APIENTRY glDeleteSyncAPPLE (GLsync sync); +GL_APICALL GLenum GL_APIENTRY glClientWaitSyncAPPLE (GLsync sync, GLbitfield flags, GLuint64 timeout); +GL_APICALL void GL_APIENTRY glWaitSyncAPPLE (GLsync sync, GLbitfield flags, GLuint64 timeout); +GL_APICALL void GL_APIENTRY glGetInteger64vAPPLE (GLenum pname, GLint64 *params); +GL_APICALL void GL_APIENTRY glGetSyncivAPPLE (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); +#endif +typedef GLsync (GL_APIENTRYP PFNGLFENCESYNCAPPLEPROC) (GLenum condition, GLbitfield flags); +typedef GLboolean (GL_APIENTRYP PFNGLISSYNCAPPLEPROC) (GLsync sync); +typedef void (GL_APIENTRYP PFNGLDELETESYNCAPPLEPROC) (GLsync sync); +typedef GLenum (GL_APIENTRYP PFNGLCLIENTWAITSYNCAPPLEPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); +typedef void (GL_APIENTRYP PFNGLWAITSYNCAPPLEPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); +typedef void (GL_APIENTRYP PFNGLGETINTEGER64VAPPLEPROC) (GLenum pname, GLint64 *params); +typedef void (GL_APIENTRYP PFNGLGETSYNCIVAPPLEPROC) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); +#endif + +/* GL_APPLE_texture_format_BGRA8888 */ +#ifndef GL_APPLE_texture_format_BGRA8888 +#define GL_APPLE_texture_format_BGRA8888 1 +#endif + +/* GL_APPLE_texture_max_level */ +#ifndef GL_APPLE_texture_max_level +#define GL_APPLE_texture_max_level 1 +#endif + +/*------------------------------------------------------------------------* + * ARM extension functions + *------------------------------------------------------------------------*/ + +/* GL_ARM_mali_program_binary */ +#ifndef GL_ARM_mali_program_binary +#define GL_ARM_mali_program_binary 1 +#endif + +/* GL_ARM_mali_shader_binary */ +#ifndef GL_ARM_mali_shader_binary +#define GL_ARM_mali_shader_binary 1 +#endif + +/* GL_ARM_rgba8 */ +#ifndef GL_ARM_rgba8 +#define GL_ARM_rgba8 1 +#endif + +/*------------------------------------------------------------------------* + * EXT extension functions + *------------------------------------------------------------------------*/ + +/* GL_EXT_blend_minmax */ +#ifndef GL_EXT_blend_minmax +#define GL_EXT_blend_minmax 1 +#endif + +/* GL_EXT_color_buffer_half_float */ +#ifndef GL_EXT_color_buffer_half_float +#define GL_EXT_color_buffer_half_float 1 +#endif + +/* GL_EXT_debug_label */ +#ifndef GL_EXT_debug_label +#define GL_EXT_debug_label 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glLabelObjectEXT (GLenum type, GLuint object, GLsizei length, const GLchar *label); +GL_APICALL void GL_APIENTRY glGetObjectLabelEXT (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label); +#endif +typedef void (GL_APIENTRYP PFNGLLABELOBJECTEXTPROC) (GLenum type, GLuint object, GLsizei length, const GLchar *label); +typedef void (GL_APIENTRYP PFNGLGETOBJECTLABELEXTPROC) (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label); +#endif + +/* GL_EXT_debug_marker */ +#ifndef GL_EXT_debug_marker +#define GL_EXT_debug_marker 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glInsertEventMarkerEXT (GLsizei length, const GLchar *marker); +GL_APICALL void GL_APIENTRY glPushGroupMarkerEXT (GLsizei length, const GLchar *marker); +GL_APICALL void GL_APIENTRY glPopGroupMarkerEXT (void); +#endif +typedef void (GL_APIENTRYP PFNGLINSERTEVENTMARKEREXTPROC) (GLsizei length, const GLchar *marker); +typedef void (GL_APIENTRYP PFNGLPUSHGROUPMARKEREXTPROC) (GLsizei length, const GLchar *marker); +typedef void (GL_APIENTRYP PFNGLPOPGROUPMARKEREXTPROC) (void); +#endif + +/* GL_EXT_discard_framebuffer */ +#ifndef GL_EXT_discard_framebuffer +#define GL_EXT_discard_framebuffer 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDiscardFramebufferEXT (GLenum target, GLsizei numAttachments, const GLenum *attachments); +#endif +typedef void (GL_APIENTRYP PFNGLDISCARDFRAMEBUFFEREXTPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments); +#endif + +#ifndef GL_EXT_disjoint_timer_query +#define GL_EXT_disjoint_timer_query 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glGenQueriesEXT (GLsizei n, GLuint *ids); +GL_APICALL void GL_APIENTRY glDeleteQueriesEXT (GLsizei n, const GLuint *ids); +GL_APICALL GLboolean GL_APIENTRY glIsQueryEXT (GLuint id); +GL_APICALL void GL_APIENTRY glBeginQueryEXT (GLenum target, GLuint id); +GL_APICALL void GL_APIENTRY glEndQueryEXT (GLenum target); +GL_APICALL void GL_APIENTRY glQueryCounterEXT (GLuint id, GLenum target); +GL_APICALL void GL_APIENTRY glGetQueryivEXT (GLenum target, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetQueryObjectivEXT (GLuint id, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetQueryObjectuivEXT (GLuint id, GLenum pname, GLuint *params); +GL_APICALL void GL_APIENTRY glGetQueryObjecti64vEXT (GLuint id, GLenum pname, GLint64 *params); +GL_APICALL void GL_APIENTRY glGetQueryObjectui64vEXT (GLuint id, GLenum pname, GLuint64 *params); +#endif +typedef void (GL_APIENTRYP PFNGLGENQUERIESEXTPROC) (GLsizei n, GLuint *ids); +typedef void (GL_APIENTRYP PFNGLDELETEQUERIESEXTPROC) (GLsizei n, const GLuint *ids); +typedef GLboolean (GL_APIENTRYP PFNGLISQUERYEXTPROC) (GLuint id); +typedef void (GL_APIENTRYP PFNGLBEGINQUERYEXTPROC) (GLenum target, GLuint id); +typedef void (GL_APIENTRYP PFNGLENDQUERYEXTPROC) (GLenum target); +typedef void (GL_APIENTRYP PFNGLQUERYCOUNTEREXTPROC) (GLuint id, GLenum target); +typedef void (GL_APIENTRYP PFNGLGETQUERYIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTIVEXTPROC) (GLuint id, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUIVEXTPROC) (GLuint id, GLenum pname, GLuint *params); +typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTI64VEXTPROC) (GLuint id, GLenum pname, GLint64 *params); +typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUI64VEXTPROC) (GLuint id, GLenum pname, GLuint64 *params); +#endif /* GL_EXT_disjoint_timer_query */ + +#ifndef GL_EXT_draw_buffers +#define GL_EXT_draw_buffers 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDrawBuffersEXT (GLsizei n, const GLenum *bufs); +#endif +typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSEXTPROC) (GLsizei n, const GLenum *bufs); +#endif /* GL_EXT_draw_buffers */ + +/* GL_EXT_map_buffer_range */ +#ifndef GL_EXT_map_buffer_range +#define GL_EXT_map_buffer_range 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void* GL_APIENTRY glMapBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); +GL_APICALL void GL_APIENTRY glFlushMappedBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length); +#endif +typedef void* (GL_APIENTRYP PFNGLMAPBUFFERRANGEEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); +typedef void (GL_APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr length); +#endif + +/* GL_EXT_multisampled_render_to_texture */ +#ifndef GL_EXT_multisampled_render_to_texture +#define GL_EXT_multisampled_render_to_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleEXT (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glFramebufferTexture2DMultisampleEXT (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); +#endif +typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); +#endif + +/* GL_EXT_multiview_draw_buffers */ +#ifndef GL_EXT_multiview_draw_buffers +#define GL_EXT_multiview_draw_buffers 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glReadBufferIndexedEXT (GLenum src, GLint index); +GL_APICALL void GL_APIENTRY glDrawBuffersIndexedEXT (GLint n, const GLenum *location, const GLint *indices); +GL_APICALL void GL_APIENTRY glGetIntegeri_vEXT (GLenum target, GLuint index, GLint *data); +#endif +typedef void (GL_APIENTRYP PFNGLREADBUFFERINDEXEDEXTPROC) (GLenum src, GLint index); +typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSINDEXEDEXTPROC) (GLint n, const GLenum *location, const GLint *indices); +typedef void (GL_APIENTRYP PFNGLGETINTEGERI_VEXTPROC) (GLenum target, GLuint index, GLint *data); +#endif + +#ifndef GL_EXT_multi_draw_arrays +#define GL_EXT_multi_draw_arrays 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glMultiDrawArraysEXT (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); +GL_APICALL void GL_APIENTRY glMultiDrawElementsEXT (GLenum mode, const GLsizei *count, GLenum type, const GLvoid **indices, GLsizei primcount); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); +typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid **indices, GLsizei primcount); +#endif + +/* GL_EXT_occlusion_query_boolean */ +#ifndef GL_EXT_occlusion_query_boolean +#define GL_EXT_occlusion_query_boolean 1 +/* All entry points also exist in GL_EXT_disjoint_timer_query */ +#endif + +/* GL_EXT_read_format_bgra */ +#ifndef GL_EXT_read_format_bgra +#define GL_EXT_read_format_bgra 1 +#endif + +/* GL_EXT_robustness */ +#ifndef GL_EXT_robustness +#define GL_EXT_robustness 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL GLenum GL_APIENTRY glGetGraphicsResetStatusEXT (void); +GL_APICALL void GL_APIENTRY glReadnPixelsEXT (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLvoid *data); +GL_APICALL void GL_APIENTRY glGetnUniformfvEXT (GLuint program, GLint location, GLsizei bufSize, GLfloat *params); +GL_APICALL void GL_APIENTRY glGetnUniformivEXT (GLuint program, GLint location, GLsizei bufSize, GLint *params); +#endif +typedef GLenum (GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSEXTPROC) (void); +typedef void (GL_APIENTRYP PFNGLREADNPIXELSEXTPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLvoid *data); +typedef void (GL_APIENTRYP PFNGLGETNUNIFORMFVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params); +typedef void (GL_APIENTRYP PFNGLGETNUNIFORMIVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params); +#endif + +/* GL_EXT_separate_shader_objects */ +#ifndef GL_EXT_separate_shader_objects +#define GL_EXT_separate_shader_objects 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glUseProgramStagesEXT (GLuint pipeline, GLbitfield stages, GLuint program); +GL_APICALL void GL_APIENTRY glActiveShaderProgramEXT (GLuint pipeline, GLuint program); +GL_APICALL GLuint GL_APIENTRY glCreateShaderProgramvEXT (GLenum type, GLsizei count, const GLchar **strings); +GL_APICALL void GL_APIENTRY glBindProgramPipelineEXT (GLuint pipeline); +GL_APICALL void GL_APIENTRY glDeleteProgramPipelinesEXT (GLsizei n, const GLuint *pipelines); +GL_APICALL void GL_APIENTRY glGenProgramPipelinesEXT (GLsizei n, GLuint *pipelines); +GL_APICALL GLboolean GL_APIENTRY glIsProgramPipelineEXT (GLuint pipeline); +GL_APICALL void GL_APIENTRY glProgramParameteriEXT (GLuint program, GLenum pname, GLint value); +GL_APICALL void GL_APIENTRY glGetProgramPipelineivEXT (GLuint pipeline, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glProgramUniform1iEXT (GLuint program, GLint location, GLint x); +GL_APICALL void GL_APIENTRY glProgramUniform2iEXT (GLuint program, GLint location, GLint x, GLint y); +GL_APICALL void GL_APIENTRY glProgramUniform3iEXT (GLuint program, GLint location, GLint x, GLint y, GLint z); +GL_APICALL void GL_APIENTRY glProgramUniform4iEXT (GLuint program, GLint location, GLint x, GLint y, GLint z, GLint w); +GL_APICALL void GL_APIENTRY glProgramUniform1fEXT (GLuint program, GLint location, GLfloat x); +GL_APICALL void GL_APIENTRY glProgramUniform2fEXT (GLuint program, GLint location, GLfloat x, GLfloat y); +GL_APICALL void GL_APIENTRY glProgramUniform3fEXT (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z); +GL_APICALL void GL_APIENTRY glProgramUniform4fEXT (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GL_APICALL void GL_APIENTRY glProgramUniform1ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); +GL_APICALL void GL_APIENTRY glProgramUniform2ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); +GL_APICALL void GL_APIENTRY glProgramUniform3ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); +GL_APICALL void GL_APIENTRY glProgramUniform4ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); +GL_APICALL void GL_APIENTRY glProgramUniform1fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniform2fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniform3fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniform4fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniformMatrix2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniformMatrix3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniformMatrix4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glValidateProgramPipelineEXT (GLuint pipeline); +GL_APICALL void GL_APIENTRY glGetProgramPipelineInfoLogEXT (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +#endif +typedef void (GL_APIENTRYP PFNGLUSEPROGRAMSTAGESEXTPROC) (GLuint pipeline, GLbitfield stages, GLuint program); +typedef void (GL_APIENTRYP PFNGLACTIVESHADERPROGRAMEXTPROC) (GLuint pipeline, GLuint program); +typedef GLuint (GL_APIENTRYP PFNGLCREATESHADERPROGRAMVEXTPROC) (GLenum type, GLsizei count, const GLchar **strings); +typedef void (GL_APIENTRYP PFNGLBINDPROGRAMPIPELINEEXTPROC) (GLuint pipeline); +typedef void (GL_APIENTRYP PFNGLDELETEPROGRAMPIPELINESEXTPROC) (GLsizei n, const GLuint *pipelines); +typedef void (GL_APIENTRYP PFNGLGENPROGRAMPIPELINESEXTPROC) (GLsizei n, GLuint *pipelines); +typedef GLboolean (GL_APIENTRYP PFNGLISPROGRAMPIPELINEEXTPROC) (GLuint pipeline); +typedef void (GL_APIENTRYP PFNGLPROGRAMPARAMETERIEXTPROC) (GLuint program, GLenum pname, GLint value); +typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEIVEXTPROC) (GLuint pipeline, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IEXTPROC) (GLuint program, GLint location, GLint x); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IEXTPROC) (GLuint program, GLint location, GLint x, GLint y); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IEXTPROC) (GLuint program, GLint location, GLint x, GLint y, GLint z); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IEXTPROC) (GLuint program, GLint location, GLint x, GLint y, GLint z, GLint w); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FEXTPROC) (GLuint program, GLint location, GLfloat x); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FEXTPROC) (GLuint program, GLint location, GLfloat x, GLfloat y); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FEXTPROC) (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FEXTPROC) (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLVALIDATEPROGRAMPIPELINEEXTPROC) (GLuint pipeline); +typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEINFOLOGEXTPROC) (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +#endif + +/* GL_EXT_shader_framebuffer_fetch */ +#ifndef GL_EXT_shader_framebuffer_fetch +#define GL_EXT_shader_framebuffer_fetch 1 +#endif + +/* GL_EXT_shader_texture_lod */ +#ifndef GL_EXT_shader_texture_lod +#define GL_EXT_shader_texture_lod 1 +#endif + +/* GL_EXT_shadow_samplers */ +#ifndef GL_EXT_shadow_samplers +#define GL_EXT_shadow_samplers 1 +#endif + +/* GL_EXT_sRGB */ +#ifndef GL_EXT_sRGB +#define GL_EXT_sRGB 1 +#endif + +/* GL_EXT_texture_compression_dxt1 */ +#ifndef GL_EXT_texture_compression_dxt1 +#define GL_EXT_texture_compression_dxt1 1 +#endif + +/* GL_EXT_texture_filter_anisotropic */ +#ifndef GL_EXT_texture_filter_anisotropic +#define GL_EXT_texture_filter_anisotropic 1 +#endif + +/* GL_EXT_texture_format_BGRA8888 */ +#ifndef GL_EXT_texture_format_BGRA8888 +#define GL_EXT_texture_format_BGRA8888 1 +#endif + +/* GL_EXT_texture_rg */ +#ifndef GL_EXT_texture_rg +#define GL_EXT_texture_rg 1 +#endif + +/* GL_EXT_texture_storage */ +#ifndef GL_EXT_texture_storage +#define GL_EXT_texture_storage 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glTexStorage1DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +GL_APICALL void GL_APIENTRY glTexStorage2DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glTexStorage3DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +GL_APICALL void GL_APIENTRY glTextureStorage1DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +GL_APICALL void GL_APIENTRY glTextureStorage2DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glTextureStorage3DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +#endif +typedef void (GL_APIENTRYP PFNGLTEXSTORAGE1DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +typedef void (GL_APIENTRYP PFNGLTEXSTORAGE2DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE1DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE2DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE3DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +#endif + +/* GL_EXT_texture_type_2_10_10_10_REV */ +#ifndef GL_EXT_texture_type_2_10_10_10_REV +#define GL_EXT_texture_type_2_10_10_10_REV 1 +#endif + +/* GL_EXT_unpack_subimage */ +#ifndef GL_EXT_unpack_subimage +#define GL_EXT_unpack_subimage 1 +#endif + +/*------------------------------------------------------------------------* + * DMP extension functions + *------------------------------------------------------------------------*/ + +/* GL_DMP_shader_binary */ +#ifndef GL_DMP_shader_binary +#define GL_DMP_shader_binary 1 +#endif + +/*------------------------------------------------------------------------* + * FJ extension functions + *------------------------------------------------------------------------*/ + +/* GL_FJ_shader_binary_GCCSO */ +#ifndef GL_FJ_shader_binary_GCCSO +#define GL_FJ_shader_binary_GCCSO 1 +#endif + +/*------------------------------------------------------------------------* + * IMG extension functions + *------------------------------------------------------------------------*/ + +/* GL_IMG_program_binary */ +#ifndef GL_IMG_program_binary +#define GL_IMG_program_binary 1 +#endif + +/* GL_IMG_read_format */ +#ifndef GL_IMG_read_format +#define GL_IMG_read_format 1 +#endif + +/* GL_IMG_shader_binary */ +#ifndef GL_IMG_shader_binary +#define GL_IMG_shader_binary 1 +#endif + +/* GL_IMG_texture_compression_pvrtc */ +#ifndef GL_IMG_texture_compression_pvrtc +#define GL_IMG_texture_compression_pvrtc 1 +#endif + +/* GL_IMG_texture_compression_pvrtc2 */ +#ifndef GL_IMG_texture_compression_pvrtc2 +#define GL_IMG_texture_compression_pvrtc2 1 +#endif + +/* GL_IMG_multisampled_render_to_texture */ +#ifndef GL_IMG_multisampled_render_to_texture +#define GL_IMG_multisampled_render_to_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleIMG (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glFramebufferTexture2DMultisampleIMG (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); +#endif +typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMGPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMGPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); +#endif + +/*------------------------------------------------------------------------* + * NV extension functions + *------------------------------------------------------------------------*/ + +/* GL_NV_coverage_sample */ +#ifndef GL_NV_coverage_sample +#define GL_NV_coverage_sample 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glCoverageMaskNV (GLboolean mask); +GL_APICALL void GL_APIENTRY glCoverageOperationNV (GLenum operation); +#endif +typedef void (GL_APIENTRYP PFNGLCOVERAGEMASKNVPROC) (GLboolean mask); +typedef void (GL_APIENTRYP PFNGLCOVERAGEOPERATIONNVPROC) (GLenum operation); +#endif + +/* GL_NV_depth_nonlinear */ +#ifndef GL_NV_depth_nonlinear +#define GL_NV_depth_nonlinear 1 +#endif + +/* GL_NV_draw_buffers */ +#ifndef GL_NV_draw_buffers +#define GL_NV_draw_buffers 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDrawBuffersNV (GLsizei n, const GLenum *bufs); +#endif +typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSNVPROC) (GLsizei n, const GLenum *bufs); +#endif + +/* GL_NV_draw_instanced */ +#ifndef GL_NV_draw_instanced +#define GL_NV_draw_instanced 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDrawArraysInstancedNV (GLenum mode, GLint first, GLsizei count, GLsizei primcount); +GL_APICALL void GL_APIENTRY glDrawElementsInstancedNV (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount); +#endif +typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDNVPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount); +typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDNVPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount); +#endif + +/* GL_NV_fbo_color_attachments */ +#ifndef GL_NV_fbo_color_attachments +#define GL_NV_fbo_color_attachments 1 +#endif + +/* GL_NV_fence */ +#ifndef GL_NV_fence +#define GL_NV_fence 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDeleteFencesNV (GLsizei n, const GLuint *fences); +GL_APICALL void GL_APIENTRY glGenFencesNV (GLsizei n, GLuint *fences); +GL_APICALL GLboolean GL_APIENTRY glIsFenceNV (GLuint fence); +GL_APICALL GLboolean GL_APIENTRY glTestFenceNV (GLuint fence); +GL_APICALL void GL_APIENTRY glGetFenceivNV (GLuint fence, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glFinishFenceNV (GLuint fence); +GL_APICALL void GL_APIENTRY glSetFenceNV (GLuint fence, GLenum condition); +#endif +typedef void (GL_APIENTRYP PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint *fences); +typedef void (GL_APIENTRYP PFNGLGENFENCESNVPROC) (GLsizei n, GLuint *fences); +typedef GLboolean (GL_APIENTRYP PFNGLISFENCENVPROC) (GLuint fence); +typedef GLboolean (GL_APIENTRYP PFNGLTESTFENCENVPROC) (GLuint fence); +typedef void (GL_APIENTRYP PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLFINISHFENCENVPROC) (GLuint fence); +typedef void (GL_APIENTRYP PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition); +#endif + +/* GL_NV_framebuffer_blit */ +#ifndef GL_NV_framebuffer_blit +#define GL_NV_framebuffer_blit 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glBlitFramebufferNV (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +#endif +typedef void (GL_APIENTRYP PFNGLBLITFRAMEBUFFERNVPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +#endif + +/* GL_NV_framebuffer_multisample */ +#ifndef GL_NV_framebuffer_multisample +#define GL_NV_framebuffer_multisample 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleNV ( GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +#endif +typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLENVPROC) ( GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +#endif + +/* GL_NV_generate_mipmap_sRGB */ +#ifndef GL_NV_generate_mipmap_sRGB +#define GL_NV_generate_mipmap_sRGB 1 +#endif + +/* GL_NV_instanced_arrays */ +#ifndef GL_NV_instanced_arrays +#define GL_NV_instanced_arrays 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glVertexAttribDivisorNV (GLuint index, GLuint divisor); +#endif +typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISORNVPROC) (GLuint index, GLuint divisor); +#endif + +/* GL_NV_read_buffer */ +#ifndef GL_NV_read_buffer +#define GL_NV_read_buffer 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glReadBufferNV (GLenum mode); +#endif +typedef void (GL_APIENTRYP PFNGLREADBUFFERNVPROC) (GLenum mode); +#endif + +/* GL_NV_read_buffer_front */ +#ifndef GL_NV_read_buffer_front +#define GL_NV_read_buffer_front 1 +#endif + +/* GL_NV_read_depth */ +#ifndef GL_NV_read_depth +#define GL_NV_read_depth 1 +#endif + +/* GL_NV_read_depth_stencil */ +#ifndef GL_NV_read_depth_stencil +#define GL_NV_read_depth_stencil 1 +#endif + +/* GL_NV_read_stencil */ +#ifndef GL_NV_read_stencil +#define GL_NV_read_stencil 1 +#endif + +/* GL_NV_shadow_samplers_array */ +#ifndef GL_NV_shadow_samplers_array +#define GL_NV_shadow_samplers_array 1 +#endif + +/* GL_NV_shadow_samplers_cube */ +#ifndef GL_NV_shadow_samplers_cube +#define GL_NV_shadow_samplers_cube 1 +#endif + +/* GL_NV_sRGB_formats */ +#ifndef GL_NV_sRGB_formats +#define GL_NV_sRGB_formats 1 +#endif + +/* GL_NV_texture_border_clamp */ +#ifndef GL_NV_texture_border_clamp +#define GL_NV_texture_border_clamp 1 +#endif + +/* GL_NV_texture_compression_s3tc_update */ +#ifndef GL_NV_texture_compression_s3tc_update +#define GL_NV_texture_compression_s3tc_update 1 +#endif + +/* GL_NV_texture_npot_2D_mipmap */ +#ifndef GL_NV_texture_npot_2D_mipmap +#define GL_NV_texture_npot_2D_mipmap 1 +#endif + +/*------------------------------------------------------------------------* + * QCOM extension functions + *------------------------------------------------------------------------*/ + +/* GL_QCOM_alpha_test */ +#ifndef GL_QCOM_alpha_test +#define GL_QCOM_alpha_test 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glAlphaFuncQCOM (GLenum func, GLclampf ref); +#endif +typedef void (GL_APIENTRYP PFNGLALPHAFUNCQCOMPROC) (GLenum func, GLclampf ref); +#endif + +/* GL_QCOM_binning_control */ +#ifndef GL_QCOM_binning_control +#define GL_QCOM_binning_control 1 +#endif + +/* GL_QCOM_driver_control */ +#ifndef GL_QCOM_driver_control +#define GL_QCOM_driver_control 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glGetDriverControlsQCOM (GLint *num, GLsizei size, GLuint *driverControls); +GL_APICALL void GL_APIENTRY glGetDriverControlStringQCOM (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString); +GL_APICALL void GL_APIENTRY glEnableDriverControlQCOM (GLuint driverControl); +GL_APICALL void GL_APIENTRY glDisableDriverControlQCOM (GLuint driverControl); +#endif +typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSQCOMPROC) (GLint *num, GLsizei size, GLuint *driverControls); +typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSTRINGQCOMPROC) (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString); +typedef void (GL_APIENTRYP PFNGLENABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl); +typedef void (GL_APIENTRYP PFNGLDISABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl); +#endif + +/* GL_QCOM_extended_get */ +#ifndef GL_QCOM_extended_get +#define GL_QCOM_extended_get 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glExtGetTexturesQCOM (GLuint *textures, GLint maxTextures, GLint *numTextures); +GL_APICALL void GL_APIENTRY glExtGetBuffersQCOM (GLuint *buffers, GLint maxBuffers, GLint *numBuffers); +GL_APICALL void GL_APIENTRY glExtGetRenderbuffersQCOM (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers); +GL_APICALL void GL_APIENTRY glExtGetFramebuffersQCOM (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers); +GL_APICALL void GL_APIENTRY glExtGetTexLevelParameterivQCOM (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glExtTexObjectStateOverrideiQCOM (GLenum target, GLenum pname, GLint param); +GL_APICALL void GL_APIENTRY glExtGetTexSubImageQCOM (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels); +GL_APICALL void GL_APIENTRY glExtGetBufferPointervQCOM (GLenum target, GLvoid **params); +#endif +typedef void (GL_APIENTRYP PFNGLEXTGETTEXTURESQCOMPROC) (GLuint *textures, GLint maxTextures, GLint *numTextures); +typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERSQCOMPROC) (GLuint *buffers, GLint maxBuffers, GLint *numBuffers); +typedef void (GL_APIENTRYP PFNGLEXTGETRENDERBUFFERSQCOMPROC) (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers); +typedef void (GL_APIENTRYP PFNGLEXTGETFRAMEBUFFERSQCOMPROC) (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers); +typedef void (GL_APIENTRYP PFNGLEXTGETTEXLEVELPARAMETERIVQCOMPROC) (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLEXTTEXOBJECTSTATEOVERRIDEIQCOMPROC) (GLenum target, GLenum pname, GLint param); +typedef void (GL_APIENTRYP PFNGLEXTGETTEXSUBIMAGEQCOMPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels); +typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERPOINTERVQCOMPROC) (GLenum target, GLvoid **params); +#endif + +/* GL_QCOM_extended_get2 */ +#ifndef GL_QCOM_extended_get2 +#define GL_QCOM_extended_get2 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glExtGetShadersQCOM (GLuint *shaders, GLint maxShaders, GLint *numShaders); +GL_APICALL void GL_APIENTRY glExtGetProgramsQCOM (GLuint *programs, GLint maxPrograms, GLint *numPrograms); +GL_APICALL GLboolean GL_APIENTRY glExtIsProgramBinaryQCOM (GLuint program); +GL_APICALL void GL_APIENTRY glExtGetProgramBinarySourceQCOM (GLuint program, GLenum shadertype, GLchar *source, GLint *length); +#endif +typedef void (GL_APIENTRYP PFNGLEXTGETSHADERSQCOMPROC) (GLuint *shaders, GLint maxShaders, GLint *numShaders); +typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMSQCOMPROC) (GLuint *programs, GLint maxPrograms, GLint *numPrograms); +typedef GLboolean (GL_APIENTRYP PFNGLEXTISPROGRAMBINARYQCOMPROC) (GLuint program); +typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMBINARYSOURCEQCOMPROC) (GLuint program, GLenum shadertype, GLchar *source, GLint *length); +#endif + +/* GL_QCOM_perfmon_global_mode */ +#ifndef GL_QCOM_perfmon_global_mode +#define GL_QCOM_perfmon_global_mode 1 +#endif + +/* GL_QCOM_writeonly_rendering */ +#ifndef GL_QCOM_writeonly_rendering +#define GL_QCOM_writeonly_rendering 1 +#endif + +/* GL_QCOM_tiled_rendering */ +#ifndef GL_QCOM_tiled_rendering +#define GL_QCOM_tiled_rendering 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glStartTilingQCOM (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask); +GL_APICALL void GL_APIENTRY glEndTilingQCOM (GLbitfield preserveMask); +#endif +typedef void (GL_APIENTRYP PFNGLSTARTTILINGQCOMPROC) (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask); +typedef void (GL_APIENTRYP PFNGLENDTILINGQCOMPROC) (GLbitfield preserveMask); +#endif + +/*------------------------------------------------------------------------* + * VIV extension tokens + *------------------------------------------------------------------------*/ + +/* GL_VIV_shader_binary */ +#ifndef GL_VIV_shader_binary +#define GL_VIV_shader_binary 1 +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __gl2ext_h_ */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_opengles2_gl2platform.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_opengles2_gl2platform.h new file mode 100644 index 0000000..c325686 --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_opengles2_gl2platform.h @@ -0,0 +1,30 @@ +#ifndef __gl2platform_h_ +#define __gl2platform_h_ + +/* $Revision: 10602 $ on $Date:: 2010-03-04 22:35:34 -0800 #$ */ + +/* + * This document is licensed under the SGI Free Software B License Version + * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ . + */ + +/* Platform-specific types and definitions for OpenGL ES 2.X gl2.h + * + * Adopters may modify khrplatform.h and this file to suit their platform. + * You are encouraged to submit all modifications to the Khronos group so that + * they can be included in future versions of this file. Please submit changes + * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla) + * by filing a bug against product "OpenGL-ES" component "Registry". + */ + +/*#include */ + +#ifndef GL_APICALL +#define GL_APICALL KHRONOS_APICALL +#endif + +#ifndef GL_APIENTRY +#define GL_APIENTRY KHRONOS_APIENTRY +#endif + +#endif /* __gl2platform_h_ */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_opengles2_khrplatform.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_opengles2_khrplatform.h new file mode 100644 index 0000000..c9e6f17 --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_opengles2_khrplatform.h @@ -0,0 +1,282 @@ +#ifndef __khrplatform_h_ +#define __khrplatform_h_ + +/* +** Copyright (c) 2008-2009 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are 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 Materials. +** +** THE MATERIALS ARE 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 +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ + +/* Khronos platform-specific types and definitions. + * + * $Revision: 23298 $ on $Date: 2013-09-30 17:07:13 -0700 (Mon, 30 Sep 2013) $ + * + * Adopters may modify this file to suit their platform. Adopters are + * encouraged to submit platform specific modifications to the Khronos + * group so that they can be included in future versions of this file. + * Please submit changes by sending them to the public Khronos Bugzilla + * (http://khronos.org/bugzilla) by filing a bug against product + * "Khronos (general)" component "Registry". + * + * A predefined template which fills in some of the bug fields can be + * reached using http://tinyurl.com/khrplatform-h-bugreport, but you + * must create a Bugzilla login first. + * + * + * See the Implementer's Guidelines for information about where this file + * should be located on your system and for more details of its use: + * http://www.khronos.org/registry/implementers_guide.pdf + * + * This file should be included as + * #include + * by Khronos client API header files that use its types and defines. + * + * The types in khrplatform.h should only be used to define API-specific types. + * + * Types defined in khrplatform.h: + * khronos_int8_t signed 8 bit + * khronos_uint8_t unsigned 8 bit + * khronos_int16_t signed 16 bit + * khronos_uint16_t unsigned 16 bit + * khronos_int32_t signed 32 bit + * khronos_uint32_t unsigned 32 bit + * khronos_int64_t signed 64 bit + * khronos_uint64_t unsigned 64 bit + * khronos_intptr_t signed same number of bits as a pointer + * khronos_uintptr_t unsigned same number of bits as a pointer + * khronos_ssize_t signed size + * khronos_usize_t unsigned size + * khronos_float_t signed 32 bit floating point + * khronos_time_ns_t unsigned 64 bit time in nanoseconds + * khronos_utime_nanoseconds_t unsigned time interval or absolute time in + * nanoseconds + * khronos_stime_nanoseconds_t signed time interval in nanoseconds + * khronos_boolean_enum_t enumerated boolean type. This should + * only be used as a base type when a client API's boolean type is + * an enum. Client APIs which use an integer or other type for + * booleans cannot use this as the base type for their boolean. + * + * Tokens defined in khrplatform.h: + * + * KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values. + * + * KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0. + * KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0. + * + * Calling convention macros defined in this file: + * KHRONOS_APICALL + * KHRONOS_APIENTRY + * KHRONOS_APIATTRIBUTES + * + * These may be used in function prototypes as: + * + * KHRONOS_APICALL void KHRONOS_APIENTRY funcname( + * int arg1, + * int arg2) KHRONOS_APIATTRIBUTES; + */ + +/*------------------------------------------------------------------------- + * Definition of KHRONOS_APICALL + *------------------------------------------------------------------------- + * This precedes the return type of the function in the function prototype. + */ +#if defined(_WIN32) && !defined(__SCITECH_SNAP__) +# define KHRONOS_APICALL __declspec(dllimport) +#elif defined (__SYMBIAN32__) +# define KHRONOS_APICALL IMPORT_C +#else +# define KHRONOS_APICALL +#endif + +/*------------------------------------------------------------------------- + * Definition of KHRONOS_APIENTRY + *------------------------------------------------------------------------- + * This follows the return type of the function and precedes the function + * name in the function prototype. + */ +#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__) + /* Win32 but not WinCE */ +# define KHRONOS_APIENTRY __stdcall +#else +# define KHRONOS_APIENTRY +#endif + +/*------------------------------------------------------------------------- + * Definition of KHRONOS_APIATTRIBUTES + *------------------------------------------------------------------------- + * This follows the closing parenthesis of the function prototype arguments. + */ +#if defined (__ARMCC_2__) +#define KHRONOS_APIATTRIBUTES __softfp +#else +#define KHRONOS_APIATTRIBUTES +#endif + +/*------------------------------------------------------------------------- + * basic type definitions + *-----------------------------------------------------------------------*/ +#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__) + + +/* + * Using + */ +#include +typedef int32_t khronos_int32_t; +typedef uint32_t khronos_uint32_t; +typedef int64_t khronos_int64_t; +typedef uint64_t khronos_uint64_t; +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#elif defined(__VMS ) || defined(__sgi) + +/* + * Using + */ +#include +typedef int32_t khronos_int32_t; +typedef uint32_t khronos_uint32_t; +typedef int64_t khronos_int64_t; +typedef uint64_t khronos_uint64_t; +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#elif defined(_WIN32) && !defined(__SCITECH_SNAP__) + +/* + * Win32 + */ +typedef __int32 khronos_int32_t; +typedef unsigned __int32 khronos_uint32_t; +typedef __int64 khronos_int64_t; +typedef unsigned __int64 khronos_uint64_t; +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#elif defined(__sun__) || defined(__digital__) + +/* + * Sun or Digital + */ +typedef int khronos_int32_t; +typedef unsigned int khronos_uint32_t; +#if defined(__arch64__) || defined(_LP64) +typedef long int khronos_int64_t; +typedef unsigned long int khronos_uint64_t; +#else +typedef long long int khronos_int64_t; +typedef unsigned long long int khronos_uint64_t; +#endif /* __arch64__ */ +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#elif 0 + +/* + * Hypothetical platform with no float or int64 support + */ +typedef int khronos_int32_t; +typedef unsigned int khronos_uint32_t; +#define KHRONOS_SUPPORT_INT64 0 +#define KHRONOS_SUPPORT_FLOAT 0 + +#else + +/* + * Generic fallback + */ +#include +typedef int32_t khronos_int32_t; +typedef uint32_t khronos_uint32_t; +typedef int64_t khronos_int64_t; +typedef uint64_t khronos_uint64_t; +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#endif + + +/* + * Types that are (so far) the same on all platforms + */ +typedef signed char khronos_int8_t; +typedef unsigned char khronos_uint8_t; +typedef signed short int khronos_int16_t; +typedef unsigned short int khronos_uint16_t; + +/* + * Types that differ between LLP64 and LP64 architectures - in LLP64, + * pointers are 64 bits, but 'long' is still 32 bits. Win64 appears + * to be the only LLP64 architecture in current use. + */ +#ifdef _WIN64 +typedef signed long long int khronos_intptr_t; +typedef unsigned long long int khronos_uintptr_t; +typedef signed long long int khronos_ssize_t; +typedef unsigned long long int khronos_usize_t; +#else +typedef signed long int khronos_intptr_t; +typedef unsigned long int khronos_uintptr_t; +typedef signed long int khronos_ssize_t; +typedef unsigned long int khronos_usize_t; +#endif + +#if KHRONOS_SUPPORT_FLOAT +/* + * Float type + */ +typedef float khronos_float_t; +#endif + +#if KHRONOS_SUPPORT_INT64 +/* Time types + * + * These types can be used to represent a time interval in nanoseconds or + * an absolute Unadjusted System Time. Unadjusted System Time is the number + * of nanoseconds since some arbitrary system event (e.g. since the last + * time the system booted). The Unadjusted System Time is an unsigned + * 64 bit value that wraps back to 0 every 584 years. Time intervals + * may be either signed or unsigned. + */ +typedef khronos_uint64_t khronos_utime_nanoseconds_t; +typedef khronos_int64_t khronos_stime_nanoseconds_t; +#endif + +/* + * Dummy value used to pad enum types to 32 bits. + */ +#ifndef KHRONOS_MAX_ENUM +#define KHRONOS_MAX_ENUM 0x7FFFFFFF +#endif + +/* + * Enumerated boolean type + * + * Values other than zero should be considered to be true. Therefore + * comparisons should not be made against KHRONOS_TRUE. + */ +typedef enum { + KHRONOS_FALSE = 0, + KHRONOS_TRUE = 1, + KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM +} khronos_boolean_enum_t; + +#endif /* __khrplatform_h_ */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_pixels.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_pixels.h new file mode 100644 index 0000000..aa90cbc --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_pixels.h @@ -0,0 +1,479 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_pixels.h + * + * Header for the enumerated pixel format definitions. + */ + +#ifndef SDL_pixels_h_ +#define SDL_pixels_h_ + +#include "SDL_stdinc.h" +#include "SDL_endian.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \name Transparency definitions + * + * These define alpha as the opacity of a surface. + */ +/* @{ */ +#define SDL_ALPHA_OPAQUE 255 +#define SDL_ALPHA_TRANSPARENT 0 +/* @} */ + +/** Pixel type. */ +typedef enum +{ + SDL_PIXELTYPE_UNKNOWN, + SDL_PIXELTYPE_INDEX1, + SDL_PIXELTYPE_INDEX4, + SDL_PIXELTYPE_INDEX8, + SDL_PIXELTYPE_PACKED8, + SDL_PIXELTYPE_PACKED16, + SDL_PIXELTYPE_PACKED32, + SDL_PIXELTYPE_ARRAYU8, + SDL_PIXELTYPE_ARRAYU16, + SDL_PIXELTYPE_ARRAYU32, + SDL_PIXELTYPE_ARRAYF16, + SDL_PIXELTYPE_ARRAYF32 +} SDL_PixelType; + +/** Bitmap pixel order, high bit -> low bit. */ +typedef enum +{ + SDL_BITMAPORDER_NONE, + SDL_BITMAPORDER_4321, + SDL_BITMAPORDER_1234 +} SDL_BitmapOrder; + +/** Packed component order, high bit -> low bit. */ +typedef enum +{ + SDL_PACKEDORDER_NONE, + SDL_PACKEDORDER_XRGB, + SDL_PACKEDORDER_RGBX, + SDL_PACKEDORDER_ARGB, + SDL_PACKEDORDER_RGBA, + SDL_PACKEDORDER_XBGR, + SDL_PACKEDORDER_BGRX, + SDL_PACKEDORDER_ABGR, + SDL_PACKEDORDER_BGRA +} SDL_PackedOrder; + +/** Array component order, low byte -> high byte. */ +/* !!! FIXME: in 2.1, make these not overlap differently with + !!! FIXME: SDL_PACKEDORDER_*, so we can simplify SDL_ISPIXELFORMAT_ALPHA */ +typedef enum +{ + SDL_ARRAYORDER_NONE, + SDL_ARRAYORDER_RGB, + SDL_ARRAYORDER_RGBA, + SDL_ARRAYORDER_ARGB, + SDL_ARRAYORDER_BGR, + SDL_ARRAYORDER_BGRA, + SDL_ARRAYORDER_ABGR +} SDL_ArrayOrder; + +/** Packed component layout. */ +typedef enum +{ + SDL_PACKEDLAYOUT_NONE, + SDL_PACKEDLAYOUT_332, + SDL_PACKEDLAYOUT_4444, + SDL_PACKEDLAYOUT_1555, + SDL_PACKEDLAYOUT_5551, + SDL_PACKEDLAYOUT_565, + SDL_PACKEDLAYOUT_8888, + SDL_PACKEDLAYOUT_2101010, + SDL_PACKEDLAYOUT_1010102 +} SDL_PackedLayout; + +#define SDL_DEFINE_PIXELFOURCC(A, B, C, D) SDL_FOURCC(A, B, C, D) + +#define SDL_DEFINE_PIXELFORMAT(type, order, layout, bits, bytes) \ + ((1 << 28) | ((type) << 24) | ((order) << 20) | ((layout) << 16) | \ + ((bits) << 8) | ((bytes) << 0)) + +#define SDL_PIXELFLAG(X) (((X) >> 28) & 0x0F) +#define SDL_PIXELTYPE(X) (((X) >> 24) & 0x0F) +#define SDL_PIXELORDER(X) (((X) >> 20) & 0x0F) +#define SDL_PIXELLAYOUT(X) (((X) >> 16) & 0x0F) +#define SDL_BITSPERPIXEL(X) (((X) >> 8) & 0xFF) +#define SDL_BYTESPERPIXEL(X) \ + (SDL_ISPIXELFORMAT_FOURCC(X) ? \ + ((((X) == SDL_PIXELFORMAT_YUY2) || \ + ((X) == SDL_PIXELFORMAT_UYVY) || \ + ((X) == SDL_PIXELFORMAT_YVYU)) ? 2 : 1) : (((X) >> 0) & 0xFF)) + +#define SDL_ISPIXELFORMAT_INDEXED(format) \ + (!SDL_ISPIXELFORMAT_FOURCC(format) && \ + ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX1) || \ + (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX4) || \ + (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX8))) + +#define SDL_ISPIXELFORMAT_PACKED(format) \ + (!SDL_ISPIXELFORMAT_FOURCC(format) && \ + ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED8) || \ + (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED16) || \ + (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_PACKED32))) + +#define SDL_ISPIXELFORMAT_ARRAY(format) \ + (!SDL_ISPIXELFORMAT_FOURCC(format) && \ + ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYU8) || \ + (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYU16) || \ + (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYU32) || \ + (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYF16) || \ + (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_ARRAYF32))) + +#define SDL_ISPIXELFORMAT_ALPHA(format) \ + ((SDL_ISPIXELFORMAT_PACKED(format) && \ + ((SDL_PIXELORDER(format) == SDL_PACKEDORDER_ARGB) || \ + (SDL_PIXELORDER(format) == SDL_PACKEDORDER_RGBA) || \ + (SDL_PIXELORDER(format) == SDL_PACKEDORDER_ABGR) || \ + (SDL_PIXELORDER(format) == SDL_PACKEDORDER_BGRA))) || \ + (SDL_ISPIXELFORMAT_ARRAY(format) && \ + ((SDL_PIXELORDER(format) == SDL_ARRAYORDER_ARGB) || \ + (SDL_PIXELORDER(format) == SDL_ARRAYORDER_RGBA) || \ + (SDL_PIXELORDER(format) == SDL_ARRAYORDER_ABGR) || \ + (SDL_PIXELORDER(format) == SDL_ARRAYORDER_BGRA)))) + +/* The flag is set to 1 because 0x1? is not in the printable ASCII range */ +#define SDL_ISPIXELFORMAT_FOURCC(format) \ + ((format) && (SDL_PIXELFLAG(format) != 1)) + +/* Note: If you modify this list, update SDL_GetPixelFormatName() */ +typedef enum +{ + SDL_PIXELFORMAT_UNKNOWN, + SDL_PIXELFORMAT_INDEX1LSB = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX1, SDL_BITMAPORDER_4321, 0, + 1, 0), + SDL_PIXELFORMAT_INDEX1MSB = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX1, SDL_BITMAPORDER_1234, 0, + 1, 0), + SDL_PIXELFORMAT_INDEX4LSB = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX4, SDL_BITMAPORDER_4321, 0, + 4, 0), + SDL_PIXELFORMAT_INDEX4MSB = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX4, SDL_BITMAPORDER_1234, 0, + 4, 0), + SDL_PIXELFORMAT_INDEX8 = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX8, 0, 0, 8, 1), + SDL_PIXELFORMAT_RGB332 = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED8, SDL_PACKEDORDER_XRGB, + SDL_PACKEDLAYOUT_332, 8, 1), + SDL_PIXELFORMAT_XRGB4444 = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB, + SDL_PACKEDLAYOUT_4444, 12, 2), + SDL_PIXELFORMAT_RGB444 = SDL_PIXELFORMAT_XRGB4444, + SDL_PIXELFORMAT_XBGR4444 = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XBGR, + SDL_PACKEDLAYOUT_4444, 12, 2), + SDL_PIXELFORMAT_BGR444 = SDL_PIXELFORMAT_XBGR4444, + SDL_PIXELFORMAT_XRGB1555 = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB, + SDL_PACKEDLAYOUT_1555, 15, 2), + SDL_PIXELFORMAT_RGB555 = SDL_PIXELFORMAT_XRGB1555, + SDL_PIXELFORMAT_XBGR1555 = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XBGR, + SDL_PACKEDLAYOUT_1555, 15, 2), + SDL_PIXELFORMAT_BGR555 = SDL_PIXELFORMAT_XBGR1555, + SDL_PIXELFORMAT_ARGB4444 = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ARGB, + SDL_PACKEDLAYOUT_4444, 16, 2), + SDL_PIXELFORMAT_RGBA4444 = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_RGBA, + SDL_PACKEDLAYOUT_4444, 16, 2), + SDL_PIXELFORMAT_ABGR4444 = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ABGR, + SDL_PACKEDLAYOUT_4444, 16, 2), + SDL_PIXELFORMAT_BGRA4444 = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_BGRA, + SDL_PACKEDLAYOUT_4444, 16, 2), + SDL_PIXELFORMAT_ARGB1555 = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ARGB, + SDL_PACKEDLAYOUT_1555, 16, 2), + SDL_PIXELFORMAT_RGBA5551 = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_RGBA, + SDL_PACKEDLAYOUT_5551, 16, 2), + SDL_PIXELFORMAT_ABGR1555 = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ABGR, + SDL_PACKEDLAYOUT_1555, 16, 2), + SDL_PIXELFORMAT_BGRA5551 = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_BGRA, + SDL_PACKEDLAYOUT_5551, 16, 2), + SDL_PIXELFORMAT_RGB565 = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB, + SDL_PACKEDLAYOUT_565, 16, 2), + SDL_PIXELFORMAT_BGR565 = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XBGR, + SDL_PACKEDLAYOUT_565, 16, 2), + SDL_PIXELFORMAT_RGB24 = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_ARRAYU8, SDL_ARRAYORDER_RGB, 0, + 24, 3), + SDL_PIXELFORMAT_BGR24 = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_ARRAYU8, SDL_ARRAYORDER_BGR, 0, + 24, 3), + SDL_PIXELFORMAT_XRGB8888 = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_XRGB, + SDL_PACKEDLAYOUT_8888, 24, 4), + SDL_PIXELFORMAT_RGB888 = SDL_PIXELFORMAT_XRGB8888, + SDL_PIXELFORMAT_RGBX8888 = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_RGBX, + SDL_PACKEDLAYOUT_8888, 24, 4), + SDL_PIXELFORMAT_XBGR8888 = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_XBGR, + SDL_PACKEDLAYOUT_8888, 24, 4), + SDL_PIXELFORMAT_BGR888 = SDL_PIXELFORMAT_XBGR8888, + SDL_PIXELFORMAT_BGRX8888 = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_BGRX, + SDL_PACKEDLAYOUT_8888, 24, 4), + SDL_PIXELFORMAT_ARGB8888 = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_ARGB, + SDL_PACKEDLAYOUT_8888, 32, 4), + SDL_PIXELFORMAT_RGBA8888 = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_RGBA, + SDL_PACKEDLAYOUT_8888, 32, 4), + SDL_PIXELFORMAT_ABGR8888 = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_ABGR, + SDL_PACKEDLAYOUT_8888, 32, 4), + SDL_PIXELFORMAT_BGRA8888 = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_BGRA, + SDL_PACKEDLAYOUT_8888, 32, 4), + SDL_PIXELFORMAT_ARGB2101010 = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_ARGB, + SDL_PACKEDLAYOUT_2101010, 32, 4), + + /* Aliases for RGBA byte arrays of color data, for the current platform */ +#if SDL_BYTEORDER == SDL_BIG_ENDIAN + SDL_PIXELFORMAT_RGBA32 = SDL_PIXELFORMAT_RGBA8888, + SDL_PIXELFORMAT_ARGB32 = SDL_PIXELFORMAT_ARGB8888, + SDL_PIXELFORMAT_BGRA32 = SDL_PIXELFORMAT_BGRA8888, + SDL_PIXELFORMAT_ABGR32 = SDL_PIXELFORMAT_ABGR8888, +#else + SDL_PIXELFORMAT_RGBA32 = SDL_PIXELFORMAT_ABGR8888, + SDL_PIXELFORMAT_ARGB32 = SDL_PIXELFORMAT_BGRA8888, + SDL_PIXELFORMAT_BGRA32 = SDL_PIXELFORMAT_ARGB8888, + SDL_PIXELFORMAT_ABGR32 = SDL_PIXELFORMAT_RGBA8888, +#endif + + SDL_PIXELFORMAT_YV12 = /**< Planar mode: Y + V + U (3 planes) */ + SDL_DEFINE_PIXELFOURCC('Y', 'V', '1', '2'), + SDL_PIXELFORMAT_IYUV = /**< Planar mode: Y + U + V (3 planes) */ + SDL_DEFINE_PIXELFOURCC('I', 'Y', 'U', 'V'), + SDL_PIXELFORMAT_YUY2 = /**< Packed mode: Y0+U0+Y1+V0 (1 plane) */ + SDL_DEFINE_PIXELFOURCC('Y', 'U', 'Y', '2'), + SDL_PIXELFORMAT_UYVY = /**< Packed mode: U0+Y0+V0+Y1 (1 plane) */ + SDL_DEFINE_PIXELFOURCC('U', 'Y', 'V', 'Y'), + SDL_PIXELFORMAT_YVYU = /**< Packed mode: Y0+V0+Y1+U0 (1 plane) */ + SDL_DEFINE_PIXELFOURCC('Y', 'V', 'Y', 'U'), + SDL_PIXELFORMAT_NV12 = /**< Planar mode: Y + U/V interleaved (2 planes) */ + SDL_DEFINE_PIXELFOURCC('N', 'V', '1', '2'), + SDL_PIXELFORMAT_NV21 = /**< Planar mode: Y + V/U interleaved (2 planes) */ + SDL_DEFINE_PIXELFOURCC('N', 'V', '2', '1'), + SDL_PIXELFORMAT_EXTERNAL_OES = /**< Android video texture format */ + SDL_DEFINE_PIXELFOURCC('O', 'E', 'S', ' ') +} SDL_PixelFormatEnum; + +typedef struct SDL_Color +{ + Uint8 r; + Uint8 g; + Uint8 b; + Uint8 a; +} SDL_Color; +#define SDL_Colour SDL_Color + +typedef struct SDL_Palette +{ + int ncolors; + SDL_Color *colors; + Uint32 version; + int refcount; +} SDL_Palette; + +/** + * \note Everything in the pixel format structure is read-only. + */ +typedef struct SDL_PixelFormat +{ + Uint32 format; + SDL_Palette *palette; + Uint8 BitsPerPixel; + Uint8 BytesPerPixel; + Uint8 padding[2]; + Uint32 Rmask; + Uint32 Gmask; + Uint32 Bmask; + Uint32 Amask; + Uint8 Rloss; + Uint8 Gloss; + Uint8 Bloss; + Uint8 Aloss; + Uint8 Rshift; + Uint8 Gshift; + Uint8 Bshift; + Uint8 Ashift; + int refcount; + struct SDL_PixelFormat *next; +} SDL_PixelFormat; + +/** + * \brief Get the human readable name of a pixel format + */ +extern DECLSPEC const char* SDLCALL SDL_GetPixelFormatName(Uint32 format); + +/** + * \brief Convert one of the enumerated pixel formats to a bpp and RGBA masks. + * + * \return SDL_TRUE, or SDL_FALSE if the conversion wasn't possible. + * + * \sa SDL_MasksToPixelFormatEnum() + */ +extern DECLSPEC SDL_bool SDLCALL SDL_PixelFormatEnumToMasks(Uint32 format, + int *bpp, + Uint32 * Rmask, + Uint32 * Gmask, + Uint32 * Bmask, + Uint32 * Amask); + +/** + * \brief Convert a bpp and RGBA masks to an enumerated pixel format. + * + * \return The pixel format, or ::SDL_PIXELFORMAT_UNKNOWN if the conversion + * wasn't possible. + * + * \sa SDL_PixelFormatEnumToMasks() + */ +extern DECLSPEC Uint32 SDLCALL SDL_MasksToPixelFormatEnum(int bpp, + Uint32 Rmask, + Uint32 Gmask, + Uint32 Bmask, + Uint32 Amask); + +/** + * \brief Create an SDL_PixelFormat structure from a pixel format enum. + */ +extern DECLSPEC SDL_PixelFormat * SDLCALL SDL_AllocFormat(Uint32 pixel_format); + +/** + * \brief Free an SDL_PixelFormat structure. + */ +extern DECLSPEC void SDLCALL SDL_FreeFormat(SDL_PixelFormat *format); + +/** + * \brief Create a palette structure with the specified number of color + * entries. + * + * \return A new palette, or NULL if there wasn't enough memory. + * + * \note The palette entries are initialized to white. + * + * \sa SDL_FreePalette() + */ +extern DECLSPEC SDL_Palette *SDLCALL SDL_AllocPalette(int ncolors); + +/** + * \brief Set the palette for a pixel format structure. + */ +extern DECLSPEC int SDLCALL SDL_SetPixelFormatPalette(SDL_PixelFormat * format, + SDL_Palette *palette); + +/** + * \brief Set a range of colors in a palette. + * + * \param palette The palette to modify. + * \param colors An array of colors to copy into the palette. + * \param firstcolor The index of the first palette entry to modify. + * \param ncolors The number of entries to modify. + * + * \return 0 on success, or -1 if not all of the colors could be set. + */ +extern DECLSPEC int SDLCALL SDL_SetPaletteColors(SDL_Palette * palette, + const SDL_Color * colors, + int firstcolor, int ncolors); + +/** + * \brief Free a palette created with SDL_AllocPalette(). + * + * \sa SDL_AllocPalette() + */ +extern DECLSPEC void SDLCALL SDL_FreePalette(SDL_Palette * palette); + +/** + * \brief Maps an RGB triple to an opaque pixel value for a given pixel format. + * + * \sa SDL_MapRGBA + */ +extern DECLSPEC Uint32 SDLCALL SDL_MapRGB(const SDL_PixelFormat * format, + Uint8 r, Uint8 g, Uint8 b); + +/** + * \brief Maps an RGBA quadruple to a pixel value for a given pixel format. + * + * \sa SDL_MapRGB + */ +extern DECLSPEC Uint32 SDLCALL SDL_MapRGBA(const SDL_PixelFormat * format, + Uint8 r, Uint8 g, Uint8 b, + Uint8 a); + +/** + * \brief Get the RGB components from a pixel of the specified format. + * + * \sa SDL_GetRGBA + */ +extern DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel, + const SDL_PixelFormat * format, + Uint8 * r, Uint8 * g, Uint8 * b); + +/** + * \brief Get the RGBA components from a pixel of the specified format. + * + * \sa SDL_GetRGB + */ +extern DECLSPEC void SDLCALL SDL_GetRGBA(Uint32 pixel, + const SDL_PixelFormat * format, + Uint8 * r, Uint8 * g, Uint8 * b, + Uint8 * a); + +/** + * \brief Calculate a 256 entry gamma ramp for a gamma value. + */ +extern DECLSPEC void SDLCALL SDL_CalculateGammaRamp(float gamma, Uint16 * ramp); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_pixels_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_platform.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_platform.h new file mode 100644 index 0000000..7166557 --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_platform.h @@ -0,0 +1,198 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_platform.h + * + * Try to get a standard set of platform defines. + */ + +#ifndef SDL_platform_h_ +#define SDL_platform_h_ + +#if defined(_AIX) +#undef __AIX__ +#define __AIX__ 1 +#endif +#if defined(__HAIKU__) +#undef __HAIKU__ +#define __HAIKU__ 1 +#endif +#if defined(bsdi) || defined(__bsdi) || defined(__bsdi__) +#undef __BSDI__ +#define __BSDI__ 1 +#endif +#if defined(_arch_dreamcast) +#undef __DREAMCAST__ +#define __DREAMCAST__ 1 +#endif +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) +#undef __FREEBSD__ +#define __FREEBSD__ 1 +#endif +#if defined(hpux) || defined(__hpux) || defined(__hpux__) +#undef __HPUX__ +#define __HPUX__ 1 +#endif +#if defined(sgi) || defined(__sgi) || defined(__sgi__) || defined(_SGI_SOURCE) +#undef __IRIX__ +#define __IRIX__ 1 +#endif +#if (defined(linux) || defined(__linux) || defined(__linux__)) +#undef __LINUX__ +#define __LINUX__ 1 +#endif +#if defined(ANDROID) || defined(__ANDROID__) +#undef __ANDROID__ +#undef __LINUX__ /* do we need to do this? */ +#define __ANDROID__ 1 +#endif + +#if defined(__APPLE__) +/* lets us know what version of Mac OS X we're compiling on */ +#include "AvailabilityMacros.h" +#include "TargetConditionals.h" +#if TARGET_OS_TV +#undef __TVOS__ +#define __TVOS__ 1 +#endif +#if TARGET_OS_IPHONE +/* if compiling for iOS */ +#undef __IPHONEOS__ +#define __IPHONEOS__ 1 +#undef __MACOSX__ +#else +/* if not compiling for iOS */ +#undef __MACOSX__ +#define __MACOSX__ 1 +#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 +# error SDL for Mac OS X only supports deploying on 10.6 and above. +#endif /* MAC_OS_X_VERSION_MIN_REQUIRED < 1060 */ +#endif /* TARGET_OS_IPHONE */ +#endif /* defined(__APPLE__) */ + +#if defined(__NetBSD__) +#undef __NETBSD__ +#define __NETBSD__ 1 +#endif +#if defined(__OpenBSD__) +#undef __OPENBSD__ +#define __OPENBSD__ 1 +#endif +#if defined(__OS2__) || defined(__EMX__) +#undef __OS2__ +#define __OS2__ 1 +#endif +#if defined(osf) || defined(__osf) || defined(__osf__) || defined(_OSF_SOURCE) +#undef __OSF__ +#define __OSF__ 1 +#endif +#if defined(__QNXNTO__) +#undef __QNXNTO__ +#define __QNXNTO__ 1 +#endif +#if defined(riscos) || defined(__riscos) || defined(__riscos__) +#undef __RISCOS__ +#define __RISCOS__ 1 +#endif +#if defined(__sun) && defined(__SVR4) +#undef __SOLARIS__ +#define __SOLARIS__ 1 +#endif + +#if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) +/* Try to find out if we're compiling for WinRT or non-WinRT */ +#if defined(_MSC_VER) && defined(__has_include) +#if __has_include() +#define HAVE_WINAPIFAMILY_H 1 +#else +#define HAVE_WINAPIFAMILY_H 0 +#endif + +/* If _USING_V110_SDK71_ is defined it means we are using the Windows XP toolset. */ +#elif defined(_MSC_VER) && (_MSC_VER >= 1700 && !_USING_V110_SDK71_) /* _MSC_VER == 1700 for Visual Studio 2012 */ +#define HAVE_WINAPIFAMILY_H 1 +#else +#define HAVE_WINAPIFAMILY_H 0 +#endif + +#if HAVE_WINAPIFAMILY_H +#include +#define WINAPI_FAMILY_WINRT (!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)) +#else +#define WINAPI_FAMILY_WINRT 0 +#endif /* HAVE_WINAPIFAMILY_H */ + +#if WINAPI_FAMILY_WINRT +#undef __WINRT__ +#define __WINRT__ 1 +#else +#undef __WINDOWS__ +#define __WINDOWS__ 1 +#endif +#endif /* defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) */ + +#if defined(__WINDOWS__) +#undef __WIN32__ +#define __WIN32__ 1 +#endif +#if defined(__PSP__) +#undef __PSP__ +#define __PSP__ 1 +#endif + +/* The NACL compiler defines __native_client__ and __pnacl__ + * Ref: http://www.chromium.org/nativeclient/pnacl/stability-of-the-pnacl-bitcode-abi + */ +#if defined(__native_client__) +#undef __LINUX__ +#undef __NACL__ +#define __NACL__ 1 +#endif +#if defined(__pnacl__) +#undef __LINUX__ +#undef __PNACL__ +#define __PNACL__ 1 +/* PNACL with newlib supports static linking only */ +#define __SDL_NOGETPROCADDR__ +#endif + + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \brief Gets the name of the platform. + */ +extern DECLSPEC const char * SDLCALL SDL_GetPlatform (void); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_platform_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_power.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_power.h new file mode 100644 index 0000000..39884cc --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_power.h @@ -0,0 +1,75 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef SDL_power_h_ +#define SDL_power_h_ + +/** + * \file SDL_power.h + * + * Header for the SDL power management routines. + */ + +#include "SDL_stdinc.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \brief The basic state for the system's power supply. + */ +typedef enum +{ + SDL_POWERSTATE_UNKNOWN, /**< cannot determine power status */ + SDL_POWERSTATE_ON_BATTERY, /**< Not plugged in, running on the battery */ + SDL_POWERSTATE_NO_BATTERY, /**< Plugged in, no battery available */ + SDL_POWERSTATE_CHARGING, /**< Plugged in, charging battery */ + SDL_POWERSTATE_CHARGED /**< Plugged in, battery charged */ +} SDL_PowerState; + + +/** + * \brief Get the current power supply details. + * + * \param secs Seconds of battery life left. You can pass a NULL here if + * you don't care. Will return -1 if we can't determine a + * value, or we're not running on a battery. + * + * \param pct Percentage of battery life left, between 0 and 100. You can + * pass a NULL here if you don't care. Will return -1 if we + * can't determine a value, or we're not running on a battery. + * + * \return The state of the battery (if any). + */ +extern DECLSPEC SDL_PowerState SDLCALL SDL_GetPowerInfo(int *secs, int *pct); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_power_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_quit.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_quit.h new file mode 100644 index 0000000..b2bd5da --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_quit.h @@ -0,0 +1,58 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_quit.h + * + * Include file for SDL quit event handling. + */ + +#ifndef SDL_quit_h_ +#define SDL_quit_h_ + +#include "SDL_stdinc.h" +#include "SDL_error.h" + +/** + * \file SDL_quit.h + * + * An ::SDL_QUIT event is generated when the user tries to close the application + * window. If it is ignored or filtered out, the window will remain open. + * If it is not ignored or filtered, it is queued normally and the window + * is allowed to close. When the window is closed, screen updates will + * complete, but have no effect. + * + * SDL_Init() installs signal handlers for SIGINT (keyboard interrupt) + * and SIGTERM (system termination request), if handlers do not already + * exist, that generate ::SDL_QUIT events as well. There is no way + * to determine the cause of an ::SDL_QUIT event, but setting a signal + * handler in your application will override the default generation of + * quit events for that signal. + * + * \sa SDL_Quit() + */ + +/* There are no functions directly affecting the quit event */ + +#define SDL_QuitRequested() \ + (SDL_PumpEvents(), (SDL_PeepEvents(NULL,0,SDL_PEEKEVENT,SDL_QUIT,SDL_QUIT) > 0)) + +#endif /* SDL_quit_h_ */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_rect.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_rect.h new file mode 100644 index 0000000..47f0d20 --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_rect.h @@ -0,0 +1,174 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_rect.h + * + * Header file for SDL_rect definition and management functions. + */ + +#ifndef SDL_rect_h_ +#define SDL_rect_h_ + +#include "SDL_stdinc.h" +#include "SDL_error.h" +#include "SDL_pixels.h" +#include "SDL_rwops.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \brief The structure that defines a point (integer) + * + * \sa SDL_EnclosePoints + * \sa SDL_PointInRect + */ +typedef struct SDL_Point +{ + int x; + int y; +} SDL_Point; + +/** + * \brief The structure that defines a point (floating point) + * + * \sa SDL_EnclosePoints + * \sa SDL_PointInRect + */ +typedef struct SDL_FPoint +{ + float x; + float y; +} SDL_FPoint; + + +/** + * \brief A rectangle, with the origin at the upper left (integer). + * + * \sa SDL_RectEmpty + * \sa SDL_RectEquals + * \sa SDL_HasIntersection + * \sa SDL_IntersectRect + * \sa SDL_UnionRect + * \sa SDL_EnclosePoints + */ +typedef struct SDL_Rect +{ + int x, y; + int w, h; +} SDL_Rect; + + +/** + * \brief A rectangle, with the origin at the upper left (floating point). + */ +typedef struct SDL_FRect +{ + float x; + float y; + float w; + float h; +} SDL_FRect; + + +/** + * \brief Returns true if point resides inside a rectangle. + */ +SDL_FORCE_INLINE SDL_bool SDL_PointInRect(const SDL_Point *p, const SDL_Rect *r) +{ + return ( (p->x >= r->x) && (p->x < (r->x + r->w)) && + (p->y >= r->y) && (p->y < (r->y + r->h)) ) ? SDL_TRUE : SDL_FALSE; +} + +/** + * \brief Returns true if the rectangle has no area. + */ +SDL_FORCE_INLINE SDL_bool SDL_RectEmpty(const SDL_Rect *r) +{ + return ((!r) || (r->w <= 0) || (r->h <= 0)) ? SDL_TRUE : SDL_FALSE; +} + +/** + * \brief Returns true if the two rectangles are equal. + */ +SDL_FORCE_INLINE SDL_bool SDL_RectEquals(const SDL_Rect *a, const SDL_Rect *b) +{ + return (a && b && (a->x == b->x) && (a->y == b->y) && + (a->w == b->w) && (a->h == b->h)) ? SDL_TRUE : SDL_FALSE; +} + +/** + * \brief Determine whether two rectangles intersect. + * + * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_HasIntersection(const SDL_Rect * A, + const SDL_Rect * B); + +/** + * \brief Calculate the intersection of two rectangles. + * + * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRect(const SDL_Rect * A, + const SDL_Rect * B, + SDL_Rect * result); + +/** + * \brief Calculate the union of two rectangles. + */ +extern DECLSPEC void SDLCALL SDL_UnionRect(const SDL_Rect * A, + const SDL_Rect * B, + SDL_Rect * result); + +/** + * \brief Calculate a minimal rectangle enclosing a set of points + * + * \return SDL_TRUE if any points were within the clipping rect + */ +extern DECLSPEC SDL_bool SDLCALL SDL_EnclosePoints(const SDL_Point * points, + int count, + const SDL_Rect * clip, + SDL_Rect * result); + +/** + * \brief Calculate the intersection of a rectangle and line segment. + * + * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRectAndLine(const SDL_Rect * + rect, int *X1, + int *Y1, int *X2, + int *Y2); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_rect_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_render.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_render.h new file mode 100644 index 0000000..f26fb7e --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_render.h @@ -0,0 +1,1158 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_render.h + * + * Header file for SDL 2D rendering functions. + * + * This API supports the following features: + * * single pixel points + * * single pixel lines + * * filled rectangles + * * texture images + * + * The primitives may be drawn in opaque, blended, or additive modes. + * + * The texture images may be drawn in opaque, blended, or additive modes. + * They can have an additional color tint or alpha modulation applied to + * them, and may also be stretched with linear interpolation. + * + * This API is designed to accelerate simple 2D operations. You may + * want more functionality such as polygons and particle effects and + * in that case you should use SDL's OpenGL/Direct3D support or one + * of the many good 3D engines. + * + * These functions must be called from the main thread. + * See this bug for details: http://bugzilla.libsdl.org/show_bug.cgi?id=1995 + */ + +#ifndef SDL_render_h_ +#define SDL_render_h_ + +#include "SDL_stdinc.h" +#include "SDL_rect.h" +#include "SDL_video.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \brief Flags used when creating a rendering context + */ +typedef enum +{ + SDL_RENDERER_SOFTWARE = 0x00000001, /**< The renderer is a software fallback */ + SDL_RENDERER_ACCELERATED = 0x00000002, /**< The renderer uses hardware + acceleration */ + SDL_RENDERER_PRESENTVSYNC = 0x00000004, /**< Present is synchronized + with the refresh rate */ + SDL_RENDERER_TARGETTEXTURE = 0x00000008 /**< The renderer supports + rendering to texture */ +} SDL_RendererFlags; + +/** + * \brief Information on the capabilities of a render driver or context. + */ +typedef struct SDL_RendererInfo +{ + const char *name; /**< The name of the renderer */ + Uint32 flags; /**< Supported ::SDL_RendererFlags */ + Uint32 num_texture_formats; /**< The number of available texture formats */ + Uint32 texture_formats[16]; /**< The available texture formats */ + int max_texture_width; /**< The maximum texture width */ + int max_texture_height; /**< The maximum texture height */ +} SDL_RendererInfo; + +/** + * \brief The scaling mode for a texture. + */ +typedef enum +{ + SDL_ScaleModeNearest, /**< nearest pixel sampling */ + SDL_ScaleModeLinear, /**< linear filtering */ + SDL_ScaleModeBest /**< anisotropic filtering */ +} SDL_ScaleMode; + +/** + * \brief The access pattern allowed for a texture. + */ +typedef enum +{ + SDL_TEXTUREACCESS_STATIC, /**< Changes rarely, not lockable */ + SDL_TEXTUREACCESS_STREAMING, /**< Changes frequently, lockable */ + SDL_TEXTUREACCESS_TARGET /**< Texture can be used as a render target */ +} SDL_TextureAccess; + +/** + * \brief The texture channel modulation used in SDL_RenderCopy(). + */ +typedef enum +{ + SDL_TEXTUREMODULATE_NONE = 0x00000000, /**< No modulation */ + SDL_TEXTUREMODULATE_COLOR = 0x00000001, /**< srcC = srcC * color */ + SDL_TEXTUREMODULATE_ALPHA = 0x00000002 /**< srcA = srcA * alpha */ +} SDL_TextureModulate; + +/** + * \brief Flip constants for SDL_RenderCopyEx + */ +typedef enum +{ + SDL_FLIP_NONE = 0x00000000, /**< Do not flip */ + SDL_FLIP_HORIZONTAL = 0x00000001, /**< flip horizontally */ + SDL_FLIP_VERTICAL = 0x00000002 /**< flip vertically */ +} SDL_RendererFlip; + +/** + * \brief A structure representing rendering state + */ +struct SDL_Renderer; +typedef struct SDL_Renderer SDL_Renderer; + +/** + * \brief An efficient driver-specific representation of pixel data + */ +struct SDL_Texture; +typedef struct SDL_Texture SDL_Texture; + + +/* Function prototypes */ + +/** + * \brief Get the number of 2D rendering drivers available for the current + * display. + * + * A render driver is a set of code that handles rendering and texture + * management on a particular display. Normally there is only one, but + * some drivers may have several available with different capabilities. + * + * \sa SDL_GetRenderDriverInfo() + * \sa SDL_CreateRenderer() + */ +extern DECLSPEC int SDLCALL SDL_GetNumRenderDrivers(void); + +/** + * \brief Get information about a specific 2D rendering driver for the current + * display. + * + * \param index The index of the driver to query information about. + * \param info A pointer to an SDL_RendererInfo struct to be filled with + * information on the rendering driver. + * + * \return 0 on success, -1 if the index was out of range. + * + * \sa SDL_CreateRenderer() + */ +extern DECLSPEC int SDLCALL SDL_GetRenderDriverInfo(int index, + SDL_RendererInfo * info); + +/** + * \brief Create a window and default renderer + * + * \param width The width of the window + * \param height The height of the window + * \param window_flags The flags used to create the window + * \param window A pointer filled with the window, or NULL on error + * \param renderer A pointer filled with the renderer, or NULL on error + * + * \return 0 on success, or -1 on error + */ +extern DECLSPEC int SDLCALL SDL_CreateWindowAndRenderer( + int width, int height, Uint32 window_flags, + SDL_Window **window, SDL_Renderer **renderer); + + +/** + * \brief Create a 2D rendering context for a window. + * + * \param window The window where rendering is displayed. + * \param index The index of the rendering driver to initialize, or -1 to + * initialize the first one supporting the requested flags. + * \param flags ::SDL_RendererFlags. + * + * \return A valid rendering context or NULL if there was an error. + * + * \sa SDL_CreateSoftwareRenderer() + * \sa SDL_GetRendererInfo() + * \sa SDL_DestroyRenderer() + */ +extern DECLSPEC SDL_Renderer * SDLCALL SDL_CreateRenderer(SDL_Window * window, + int index, Uint32 flags); + +/** + * \brief Create a 2D software rendering context for a surface. + * + * \param surface The surface where rendering is done. + * + * \return A valid rendering context or NULL if there was an error. + * + * \sa SDL_CreateRenderer() + * \sa SDL_DestroyRenderer() + */ +extern DECLSPEC SDL_Renderer * SDLCALL SDL_CreateSoftwareRenderer(SDL_Surface * surface); + +/** + * \brief Get the renderer associated with a window. + */ +extern DECLSPEC SDL_Renderer * SDLCALL SDL_GetRenderer(SDL_Window * window); + +/** + * \brief Get information about a rendering context. + */ +extern DECLSPEC int SDLCALL SDL_GetRendererInfo(SDL_Renderer * renderer, + SDL_RendererInfo * info); + +/** + * \brief Get the output size in pixels of a rendering context. + */ +extern DECLSPEC int SDLCALL SDL_GetRendererOutputSize(SDL_Renderer * renderer, + int *w, int *h); + +/** + * \brief Create a texture for a rendering context. + * + * \param renderer The renderer. + * \param format The format of the texture. + * \param access One of the enumerated values in ::SDL_TextureAccess. + * \param w The width of the texture in pixels. + * \param h The height of the texture in pixels. + * + * \return The created texture is returned, or NULL if no rendering context was + * active, the format was unsupported, or the width or height were out + * of range. + * + * \note The contents of the texture are not defined at creation. + * + * \sa SDL_QueryTexture() + * \sa SDL_UpdateTexture() + * \sa SDL_DestroyTexture() + */ +extern DECLSPEC SDL_Texture * SDLCALL SDL_CreateTexture(SDL_Renderer * renderer, + Uint32 format, + int access, int w, + int h); + +/** + * \brief Create a texture from an existing surface. + * + * \param renderer The renderer. + * \param surface The surface containing pixel data used to fill the texture. + * + * \return The created texture is returned, or NULL on error. + * + * \note The surface is not modified or freed by this function. + * + * \sa SDL_QueryTexture() + * \sa SDL_DestroyTexture() + */ +extern DECLSPEC SDL_Texture * SDLCALL SDL_CreateTextureFromSurface(SDL_Renderer * renderer, SDL_Surface * surface); + +/** + * \brief Query the attributes of a texture + * + * \param texture A texture to be queried. + * \param format A pointer filled in with the raw format of the texture. The + * actual format may differ, but pixel transfers will use this + * format. + * \param access A pointer filled in with the actual access to the texture. + * \param w A pointer filled in with the width of the texture in pixels. + * \param h A pointer filled in with the height of the texture in pixels. + * + * \return 0 on success, or -1 if the texture is not valid. + */ +extern DECLSPEC int SDLCALL SDL_QueryTexture(SDL_Texture * texture, + Uint32 * format, int *access, + int *w, int *h); + +/** + * \brief Set an additional color value used in render copy operations. + * + * \param texture The texture to update. + * \param r The red color value multiplied into copy operations. + * \param g The green color value multiplied into copy operations. + * \param b The blue color value multiplied into copy operations. + * + * \return 0 on success, or -1 if the texture is not valid or color modulation + * is not supported. + * + * \sa SDL_GetTextureColorMod() + */ +extern DECLSPEC int SDLCALL SDL_SetTextureColorMod(SDL_Texture * texture, + Uint8 r, Uint8 g, Uint8 b); + + +/** + * \brief Get the additional color value used in render copy operations. + * + * \param texture The texture to query. + * \param r A pointer filled in with the current red color value. + * \param g A pointer filled in with the current green color value. + * \param b A pointer filled in with the current blue color value. + * + * \return 0 on success, or -1 if the texture is not valid. + * + * \sa SDL_SetTextureColorMod() + */ +extern DECLSPEC int SDLCALL SDL_GetTextureColorMod(SDL_Texture * texture, + Uint8 * r, Uint8 * g, + Uint8 * b); + +/** + * \brief Set an additional alpha value used in render copy operations. + * + * \param texture The texture to update. + * \param alpha The alpha value multiplied into copy operations. + * + * \return 0 on success, or -1 if the texture is not valid or alpha modulation + * is not supported. + * + * \sa SDL_GetTextureAlphaMod() + */ +extern DECLSPEC int SDLCALL SDL_SetTextureAlphaMod(SDL_Texture * texture, + Uint8 alpha); + +/** + * \brief Get the additional alpha value used in render copy operations. + * + * \param texture The texture to query. + * \param alpha A pointer filled in with the current alpha value. + * + * \return 0 on success, or -1 if the texture is not valid. + * + * \sa SDL_SetTextureAlphaMod() + */ +extern DECLSPEC int SDLCALL SDL_GetTextureAlphaMod(SDL_Texture * texture, + Uint8 * alpha); + +/** + * \brief Set the blend mode used for texture copy operations. + * + * \param texture The texture to update. + * \param blendMode ::SDL_BlendMode to use for texture blending. + * + * \return 0 on success, or -1 if the texture is not valid or the blend mode is + * not supported. + * + * \note If the blend mode is not supported, the closest supported mode is + * chosen. + * + * \sa SDL_GetTextureBlendMode() + */ +extern DECLSPEC int SDLCALL SDL_SetTextureBlendMode(SDL_Texture * texture, + SDL_BlendMode blendMode); + +/** + * \brief Get the blend mode used for texture copy operations. + * + * \param texture The texture to query. + * \param blendMode A pointer filled in with the current blend mode. + * + * \return 0 on success, or -1 if the texture is not valid. + * + * \sa SDL_SetTextureBlendMode() + */ +extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_Texture * texture, + SDL_BlendMode *blendMode); + +/** + * \brief Set the scale mode used for texture scale operations. + * + * \param texture The texture to update. + * \param scaleMode ::SDL_ScaleMode to use for texture scaling. + * + * \return 0 on success, or -1 if the texture is not valid. + * + * \note If the scale mode is not supported, the closest supported mode is + * chosen. + * + * \sa SDL_GetTextureScaleMode() + */ +extern DECLSPEC int SDLCALL SDL_SetTextureScaleMode(SDL_Texture * texture, + SDL_ScaleMode scaleMode); + +/** + * \brief Get the scale mode used for texture scale operations. + * + * \param texture The texture to query. + * \param scaleMode A pointer filled in with the current scale mode. + * + * \return 0 on success, or -1 if the texture is not valid. + * + * \sa SDL_SetTextureScaleMode() + */ +extern DECLSPEC int SDLCALL SDL_GetTextureScaleMode(SDL_Texture * texture, + SDL_ScaleMode *scaleMode); + +/** + * \brief Update the given texture rectangle with new pixel data. + * + * \param texture The texture to update + * \param rect A pointer to the rectangle of pixels to update, or NULL to + * update the entire texture. + * \param pixels The raw pixel data in the format of the texture. + * \param pitch The number of bytes in a row of pixel data, including padding between lines. + * + * The pixel data must be in the format of the texture. The pixel format can be + * queried with SDL_QueryTexture. + * + * \return 0 on success, or -1 if the texture is not valid. + * + * \note This is a fairly slow function. + */ +extern DECLSPEC int SDLCALL SDL_UpdateTexture(SDL_Texture * texture, + const SDL_Rect * rect, + const void *pixels, int pitch); + +/** + * \brief Update a rectangle within a planar YV12 or IYUV texture with new pixel data. + * + * \param texture The texture to update + * \param rect A pointer to the rectangle of pixels to update, or NULL to + * update the entire texture. + * \param Yplane The raw pixel data for the Y plane. + * \param Ypitch The number of bytes between rows of pixel data for the Y plane. + * \param Uplane The raw pixel data for the U plane. + * \param Upitch The number of bytes between rows of pixel data for the U plane. + * \param Vplane The raw pixel data for the V plane. + * \param Vpitch The number of bytes between rows of pixel data for the V plane. + * + * \return 0 on success, or -1 if the texture is not valid. + * + * \note You can use SDL_UpdateTexture() as long as your pixel data is + * a contiguous block of Y and U/V planes in the proper order, but + * this function is available if your pixel data is not contiguous. + */ +extern DECLSPEC int SDLCALL SDL_UpdateYUVTexture(SDL_Texture * texture, + const SDL_Rect * rect, + const Uint8 *Yplane, int Ypitch, + const Uint8 *Uplane, int Upitch, + const Uint8 *Vplane, int Vpitch); + +/** + * \brief Lock a portion of the texture for write-only pixel access. + * + * \param texture The texture to lock for access, which was created with + * ::SDL_TEXTUREACCESS_STREAMING. + * \param rect A pointer to the rectangle to lock for access. If the rect + * is NULL, the entire texture will be locked. + * \param pixels This is filled in with a pointer to the locked pixels, + * appropriately offset by the locked area. + * \param pitch This is filled in with the pitch of the locked pixels. + * + * \return 0 on success, or -1 if the texture is not valid or was not created with ::SDL_TEXTUREACCESS_STREAMING. + * + * \sa SDL_UnlockTexture() + */ +extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_Texture * texture, + const SDL_Rect * rect, + void **pixels, int *pitch); + +/** + * \brief Lock a portion of the texture for write-only pixel access. + * Expose it as a SDL surface. + * + * \param texture The texture to lock for access, which was created with + * ::SDL_TEXTUREACCESS_STREAMING. + * \param rect A pointer to the rectangle to lock for access. If the rect + * is NULL, the entire texture will be locked. + * \param surface This is filled in with a SDL surface representing the locked area + * Surface is freed internally after calling SDL_UnlockTexture or SDL_DestroyTexture. + * + * \return 0 on success, or -1 if the texture is not valid or was not created with ::SDL_TEXTUREACCESS_STREAMING. + * + * \sa SDL_UnlockTexture() + */ +extern DECLSPEC int SDLCALL SDL_LockTextureToSurface(SDL_Texture *texture, + const SDL_Rect *rect, + SDL_Surface **surface); + +/** + * \brief Unlock a texture, uploading the changes to video memory, if needed. + * If SDL_LockTextureToSurface() was called for locking, the SDL surface is freed. + * + * \sa SDL_LockTexture() + * \sa SDL_LockTextureToSurface() + */ +extern DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_Texture * texture); + +/** + * \brief Determines whether a window supports the use of render targets + * + * \param renderer The renderer that will be checked + * + * \return SDL_TRUE if supported, SDL_FALSE if not. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_RenderTargetSupported(SDL_Renderer *renderer); + +/** + * \brief Set a texture as the current rendering target. + * + * \param renderer The renderer. + * \param texture The targeted texture, which must be created with the SDL_TEXTUREACCESS_TARGET flag, or NULL for the default render target + * + * \return 0 on success, or -1 on error + * + * \sa SDL_GetRenderTarget() + */ +extern DECLSPEC int SDLCALL SDL_SetRenderTarget(SDL_Renderer *renderer, + SDL_Texture *texture); + +/** + * \brief Get the current render target or NULL for the default render target. + * + * \return The current render target + * + * \sa SDL_SetRenderTarget() + */ +extern DECLSPEC SDL_Texture * SDLCALL SDL_GetRenderTarget(SDL_Renderer *renderer); + +/** + * \brief Set device independent resolution for rendering + * + * \param renderer The renderer for which resolution should be set. + * \param w The width of the logical resolution + * \param h The height of the logical resolution + * + * This function uses the viewport and scaling functionality to allow a fixed logical + * resolution for rendering, regardless of the actual output resolution. If the actual + * output resolution doesn't have the same aspect ratio the output rendering will be + * centered within the output display. + * + * If the output display is a window, mouse events in the window will be filtered + * and scaled so they seem to arrive within the logical resolution. + * + * \note If this function results in scaling or subpixel drawing by the + * rendering backend, it will be handled using the appropriate + * quality hints. + * + * \sa SDL_RenderGetLogicalSize() + * \sa SDL_RenderSetScale() + * \sa SDL_RenderSetViewport() + */ +extern DECLSPEC int SDLCALL SDL_RenderSetLogicalSize(SDL_Renderer * renderer, int w, int h); + +/** + * \brief Get device independent resolution for rendering + * + * \param renderer The renderer from which resolution should be queried. + * \param w A pointer filled with the width of the logical resolution + * \param h A pointer filled with the height of the logical resolution + * + * \sa SDL_RenderSetLogicalSize() + */ +extern DECLSPEC void SDLCALL SDL_RenderGetLogicalSize(SDL_Renderer * renderer, int *w, int *h); + +/** + * \brief Set whether to force integer scales for resolution-independent rendering + * + * \param renderer The renderer for which integer scaling should be set. + * \param enable Enable or disable integer scaling + * + * This function restricts the logical viewport to integer values - that is, when + * a resolution is between two multiples of a logical size, the viewport size is + * rounded down to the lower multiple. + * + * \sa SDL_RenderSetLogicalSize() + */ +extern DECLSPEC int SDLCALL SDL_RenderSetIntegerScale(SDL_Renderer * renderer, + SDL_bool enable); + +/** + * \brief Get whether integer scales are forced for resolution-independent rendering + * + * \param renderer The renderer from which integer scaling should be queried. + * + * \sa SDL_RenderSetIntegerScale() + */ +extern DECLSPEC SDL_bool SDLCALL SDL_RenderGetIntegerScale(SDL_Renderer * renderer); + +/** + * \brief Set the drawing area for rendering on the current target. + * + * \param renderer The renderer for which the drawing area should be set. + * \param rect The rectangle representing the drawing area, or NULL to set the viewport to the entire target. + * + * The x,y of the viewport rect represents the origin for rendering. + * + * \return 0 on success, or -1 on error + * + * \note If the window associated with the renderer is resized, the viewport is automatically reset. + * + * \sa SDL_RenderGetViewport() + * \sa SDL_RenderSetLogicalSize() + */ +extern DECLSPEC int SDLCALL SDL_RenderSetViewport(SDL_Renderer * renderer, + const SDL_Rect * rect); + +/** + * \brief Get the drawing area for the current target. + * + * \sa SDL_RenderSetViewport() + */ +extern DECLSPEC void SDLCALL SDL_RenderGetViewport(SDL_Renderer * renderer, + SDL_Rect * rect); + +/** + * \brief Set the clip rectangle for the current target. + * + * \param renderer The renderer for which clip rectangle should be set. + * \param rect A pointer to the rectangle to set as the clip rectangle, + * relative to the viewport, or NULL to disable clipping. + * + * \return 0 on success, or -1 on error + * + * \sa SDL_RenderGetClipRect() + */ +extern DECLSPEC int SDLCALL SDL_RenderSetClipRect(SDL_Renderer * renderer, + const SDL_Rect * rect); + +/** + * \brief Get the clip rectangle for the current target. + * + * \param renderer The renderer from which clip rectangle should be queried. + * \param rect A pointer filled in with the current clip rectangle, or + * an empty rectangle if clipping is disabled. + * + * \sa SDL_RenderSetClipRect() + */ +extern DECLSPEC void SDLCALL SDL_RenderGetClipRect(SDL_Renderer * renderer, + SDL_Rect * rect); + +/** + * \brief Get whether clipping is enabled on the given renderer. + * + * \param renderer The renderer from which clip state should be queried. + * + * \sa SDL_RenderGetClipRect() + */ +extern DECLSPEC SDL_bool SDLCALL SDL_RenderIsClipEnabled(SDL_Renderer * renderer); + + +/** + * \brief Set the drawing scale for rendering on the current target. + * + * \param renderer The renderer for which the drawing scale should be set. + * \param scaleX The horizontal scaling factor + * \param scaleY The vertical scaling factor + * + * The drawing coordinates are scaled by the x/y scaling factors + * before they are used by the renderer. This allows resolution + * independent drawing with a single coordinate system. + * + * \note If this results in scaling or subpixel drawing by the + * rendering backend, it will be handled using the appropriate + * quality hints. For best results use integer scaling factors. + * + * \sa SDL_RenderGetScale() + * \sa SDL_RenderSetLogicalSize() + */ +extern DECLSPEC int SDLCALL SDL_RenderSetScale(SDL_Renderer * renderer, + float scaleX, float scaleY); + +/** + * \brief Get the drawing scale for the current target. + * + * \param renderer The renderer from which drawing scale should be queried. + * \param scaleX A pointer filled in with the horizontal scaling factor + * \param scaleY A pointer filled in with the vertical scaling factor + * + * \sa SDL_RenderSetScale() + */ +extern DECLSPEC void SDLCALL SDL_RenderGetScale(SDL_Renderer * renderer, + float *scaleX, float *scaleY); + +/** + * \brief Set the color used for drawing operations (Rect, Line and Clear). + * + * \param renderer The renderer for which drawing color should be set. + * \param r The red value used to draw on the rendering target. + * \param g The green value used to draw on the rendering target. + * \param b The blue value used to draw on the rendering target. + * \param a The alpha value used to draw on the rendering target, usually + * ::SDL_ALPHA_OPAQUE (255). + * + * \return 0 on success, or -1 on error + */ +extern DECLSPEC int SDLCALL SDL_SetRenderDrawColor(SDL_Renderer * renderer, + Uint8 r, Uint8 g, Uint8 b, + Uint8 a); + +/** + * \brief Get the color used for drawing operations (Rect, Line and Clear). + * + * \param renderer The renderer from which drawing color should be queried. + * \param r A pointer to the red value used to draw on the rendering target. + * \param g A pointer to the green value used to draw on the rendering target. + * \param b A pointer to the blue value used to draw on the rendering target. + * \param a A pointer to the alpha value used to draw on the rendering target, + * usually ::SDL_ALPHA_OPAQUE (255). + * + * \return 0 on success, or -1 on error + */ +extern DECLSPEC int SDLCALL SDL_GetRenderDrawColor(SDL_Renderer * renderer, + Uint8 * r, Uint8 * g, Uint8 * b, + Uint8 * a); + +/** + * \brief Set the blend mode used for drawing operations (Fill and Line). + * + * \param renderer The renderer for which blend mode should be set. + * \param blendMode ::SDL_BlendMode to use for blending. + * + * \return 0 on success, or -1 on error + * + * \note If the blend mode is not supported, the closest supported mode is + * chosen. + * + * \sa SDL_GetRenderDrawBlendMode() + */ +extern DECLSPEC int SDLCALL SDL_SetRenderDrawBlendMode(SDL_Renderer * renderer, + SDL_BlendMode blendMode); + +/** + * \brief Get the blend mode used for drawing operations. + * + * \param renderer The renderer from which blend mode should be queried. + * \param blendMode A pointer filled in with the current blend mode. + * + * \return 0 on success, or -1 on error + * + * \sa SDL_SetRenderDrawBlendMode() + */ +extern DECLSPEC int SDLCALL SDL_GetRenderDrawBlendMode(SDL_Renderer * renderer, + SDL_BlendMode *blendMode); + +/** + * \brief Clear the current rendering target with the drawing color + * + * This function clears the entire rendering target, ignoring the viewport and + * the clip rectangle. + * + * \return 0 on success, or -1 on error + */ +extern DECLSPEC int SDLCALL SDL_RenderClear(SDL_Renderer * renderer); + +/** + * \brief Draw a point on the current rendering target. + * + * \param renderer The renderer which should draw a point. + * \param x The x coordinate of the point. + * \param y The y coordinate of the point. + * + * \return 0 on success, or -1 on error + */ +extern DECLSPEC int SDLCALL SDL_RenderDrawPoint(SDL_Renderer * renderer, + int x, int y); + +/** + * \brief Draw multiple points on the current rendering target. + * + * \param renderer The renderer which should draw multiple points. + * \param points The points to draw + * \param count The number of points to draw + * + * \return 0 on success, or -1 on error + */ +extern DECLSPEC int SDLCALL SDL_RenderDrawPoints(SDL_Renderer * renderer, + const SDL_Point * points, + int count); + +/** + * \brief Draw a line on the current rendering target. + * + * \param renderer The renderer which should draw a line. + * \param x1 The x coordinate of the start point. + * \param y1 The y coordinate of the start point. + * \param x2 The x coordinate of the end point. + * \param y2 The y coordinate of the end point. + * + * \return 0 on success, or -1 on error + */ +extern DECLSPEC int SDLCALL SDL_RenderDrawLine(SDL_Renderer * renderer, + int x1, int y1, int x2, int y2); + +/** + * \brief Draw a series of connected lines on the current rendering target. + * + * \param renderer The renderer which should draw multiple lines. + * \param points The points along the lines + * \param count The number of points, drawing count-1 lines + * + * \return 0 on success, or -1 on error + */ +extern DECLSPEC int SDLCALL SDL_RenderDrawLines(SDL_Renderer * renderer, + const SDL_Point * points, + int count); + +/** + * \brief Draw a rectangle on the current rendering target. + * + * \param renderer The renderer which should draw a rectangle. + * \param rect A pointer to the destination rectangle, or NULL to outline the entire rendering target. + * + * \return 0 on success, or -1 on error + */ +extern DECLSPEC int SDLCALL SDL_RenderDrawRect(SDL_Renderer * renderer, + const SDL_Rect * rect); + +/** + * \brief Draw some number of rectangles on the current rendering target. + * + * \param renderer The renderer which should draw multiple rectangles. + * \param rects A pointer to an array of destination rectangles. + * \param count The number of rectangles. + * + * \return 0 on success, or -1 on error + */ +extern DECLSPEC int SDLCALL SDL_RenderDrawRects(SDL_Renderer * renderer, + const SDL_Rect * rects, + int count); + +/** + * \brief Fill a rectangle on the current rendering target with the drawing color. + * + * \param renderer The renderer which should fill a rectangle. + * \param rect A pointer to the destination rectangle, or NULL for the entire + * rendering target. + * + * \return 0 on success, or -1 on error + */ +extern DECLSPEC int SDLCALL SDL_RenderFillRect(SDL_Renderer * renderer, + const SDL_Rect * rect); + +/** + * \brief Fill some number of rectangles on the current rendering target with the drawing color. + * + * \param renderer The renderer which should fill multiple rectangles. + * \param rects A pointer to an array of destination rectangles. + * \param count The number of rectangles. + * + * \return 0 on success, or -1 on error + */ +extern DECLSPEC int SDLCALL SDL_RenderFillRects(SDL_Renderer * renderer, + const SDL_Rect * rects, + int count); + +/** + * \brief Copy a portion of the texture to the current rendering target. + * + * \param renderer The renderer which should copy parts of a texture. + * \param texture The source texture. + * \param srcrect A pointer to the source rectangle, or NULL for the entire + * texture. + * \param dstrect A pointer to the destination rectangle, or NULL for the + * entire rendering target. + * + * \return 0 on success, or -1 on error + */ +extern DECLSPEC int SDLCALL SDL_RenderCopy(SDL_Renderer * renderer, + SDL_Texture * texture, + const SDL_Rect * srcrect, + const SDL_Rect * dstrect); + +/** + * \brief Copy a portion of the source texture to the current rendering target, rotating it by angle around the given center + * + * \param renderer The renderer which should copy parts of a texture. + * \param texture The source texture. + * \param srcrect A pointer to the source rectangle, or NULL for the entire + * texture. + * \param dstrect A pointer to the destination rectangle, or NULL for the + * entire rendering target. + * \param angle An angle in degrees that indicates the rotation that will be applied to dstrect, rotating it in a clockwise direction + * \param center A pointer to a point indicating the point around which dstrect will be rotated (if NULL, rotation will be done around dstrect.w/2, dstrect.h/2). + * \param flip An SDL_RendererFlip value stating which flipping actions should be performed on the texture + * + * \return 0 on success, or -1 on error + */ +extern DECLSPEC int SDLCALL SDL_RenderCopyEx(SDL_Renderer * renderer, + SDL_Texture * texture, + const SDL_Rect * srcrect, + const SDL_Rect * dstrect, + const double angle, + const SDL_Point *center, + const SDL_RendererFlip flip); + + +/** + * \brief Draw a point on the current rendering target. + * + * \param renderer The renderer which should draw a point. + * \param x The x coordinate of the point. + * \param y The y coordinate of the point. + * + * \return 0 on success, or -1 on error + */ +extern DECLSPEC int SDLCALL SDL_RenderDrawPointF(SDL_Renderer * renderer, + float x, float y); + +/** + * \brief Draw multiple points on the current rendering target. + * + * \param renderer The renderer which should draw multiple points. + * \param points The points to draw + * \param count The number of points to draw + * + * \return 0 on success, or -1 on error + */ +extern DECLSPEC int SDLCALL SDL_RenderDrawPointsF(SDL_Renderer * renderer, + const SDL_FPoint * points, + int count); + +/** + * \brief Draw a line on the current rendering target. + * + * \param renderer The renderer which should draw a line. + * \param x1 The x coordinate of the start point. + * \param y1 The y coordinate of the start point. + * \param x2 The x coordinate of the end point. + * \param y2 The y coordinate of the end point. + * + * \return 0 on success, or -1 on error + */ +extern DECLSPEC int SDLCALL SDL_RenderDrawLineF(SDL_Renderer * renderer, + float x1, float y1, float x2, float y2); + +/** + * \brief Draw a series of connected lines on the current rendering target. + * + * \param renderer The renderer which should draw multiple lines. + * \param points The points along the lines + * \param count The number of points, drawing count-1 lines + * + * \return 0 on success, or -1 on error + */ +extern DECLSPEC int SDLCALL SDL_RenderDrawLinesF(SDL_Renderer * renderer, + const SDL_FPoint * points, + int count); + +/** + * \brief Draw a rectangle on the current rendering target. + * + * \param renderer The renderer which should draw a rectangle. + * \param rect A pointer to the destination rectangle, or NULL to outline the entire rendering target. + * + * \return 0 on success, or -1 on error + */ +extern DECLSPEC int SDLCALL SDL_RenderDrawRectF(SDL_Renderer * renderer, + const SDL_FRect * rect); + +/** + * \brief Draw some number of rectangles on the current rendering target. + * + * \param renderer The renderer which should draw multiple rectangles. + * \param rects A pointer to an array of destination rectangles. + * \param count The number of rectangles. + * + * \return 0 on success, or -1 on error + */ +extern DECLSPEC int SDLCALL SDL_RenderDrawRectsF(SDL_Renderer * renderer, + const SDL_FRect * rects, + int count); + +/** + * \brief Fill a rectangle on the current rendering target with the drawing color. + * + * \param renderer The renderer which should fill a rectangle. + * \param rect A pointer to the destination rectangle, or NULL for the entire + * rendering target. + * + * \return 0 on success, or -1 on error + */ +extern DECLSPEC int SDLCALL SDL_RenderFillRectF(SDL_Renderer * renderer, + const SDL_FRect * rect); + +/** + * \brief Fill some number of rectangles on the current rendering target with the drawing color. + * + * \param renderer The renderer which should fill multiple rectangles. + * \param rects A pointer to an array of destination rectangles. + * \param count The number of rectangles. + * + * \return 0 on success, or -1 on error + */ +extern DECLSPEC int SDLCALL SDL_RenderFillRectsF(SDL_Renderer * renderer, + const SDL_FRect * rects, + int count); + +/** + * \brief Copy a portion of the texture to the current rendering target. + * + * \param renderer The renderer which should copy parts of a texture. + * \param texture The source texture. + * \param srcrect A pointer to the source rectangle, or NULL for the entire + * texture. + * \param dstrect A pointer to the destination rectangle, or NULL for the + * entire rendering target. + * + * \return 0 on success, or -1 on error + */ +extern DECLSPEC int SDLCALL SDL_RenderCopyF(SDL_Renderer * renderer, + SDL_Texture * texture, + const SDL_Rect * srcrect, + const SDL_FRect * dstrect); + +/** + * \brief Copy a portion of the source texture to the current rendering target, rotating it by angle around the given center + * + * \param renderer The renderer which should copy parts of a texture. + * \param texture The source texture. + * \param srcrect A pointer to the source rectangle, or NULL for the entire + * texture. + * \param dstrect A pointer to the destination rectangle, or NULL for the + * entire rendering target. + * \param angle An angle in degrees that indicates the rotation that will be applied to dstrect, rotating it in a clockwise direction + * \param center A pointer to a point indicating the point around which dstrect will be rotated (if NULL, rotation will be done around dstrect.w/2, dstrect.h/2). + * \param flip An SDL_RendererFlip value stating which flipping actions should be performed on the texture + * + * \return 0 on success, or -1 on error + */ +extern DECLSPEC int SDLCALL SDL_RenderCopyExF(SDL_Renderer * renderer, + SDL_Texture * texture, + const SDL_Rect * srcrect, + const SDL_FRect * dstrect, + const double angle, + const SDL_FPoint *center, + const SDL_RendererFlip flip); + +/** + * \brief Read pixels from the current rendering target. + * + * \param renderer The renderer from which pixels should be read. + * \param rect A pointer to the rectangle to read, or NULL for the entire + * render target. + * \param format The desired format of the pixel data, or 0 to use the format + * of the rendering target + * \param pixels A pointer to be filled in with the pixel data + * \param pitch The pitch of the pixels parameter. + * + * \return 0 on success, or -1 if pixel reading is not supported. + * + * \warning This is a very slow operation, and should not be used frequently. + */ +extern DECLSPEC int SDLCALL SDL_RenderReadPixels(SDL_Renderer * renderer, + const SDL_Rect * rect, + Uint32 format, + void *pixels, int pitch); + +/** + * \brief Update the screen with rendering performed. + */ +extern DECLSPEC void SDLCALL SDL_RenderPresent(SDL_Renderer * renderer); + +/** + * \brief Destroy the specified texture. + * + * \sa SDL_CreateTexture() + * \sa SDL_CreateTextureFromSurface() + */ +extern DECLSPEC void SDLCALL SDL_DestroyTexture(SDL_Texture * texture); + +/** + * \brief Destroy the rendering context for a window and free associated + * textures. + * + * \sa SDL_CreateRenderer() + */ +extern DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_Renderer * renderer); + +/** + * \brief Force the rendering context to flush any pending commands to the + * underlying rendering API. + * + * You do not need to (and in fact, shouldn't) call this function unless + * you are planning to call into OpenGL/Direct3D/Metal/whatever directly + * in addition to using an SDL_Renderer. + * + * This is for a very-specific case: if you are using SDL's render API, + * you asked for a specific renderer backend (OpenGL, Direct3D, etc), + * you set SDL_HINT_RENDER_BATCHING to "1", and you plan to make + * OpenGL/D3D/whatever calls in addition to SDL render API calls. If all of + * this applies, you should call SDL_RenderFlush() between calls to SDL's + * render API and the low-level API you're using in cooperation. + * + * In all other cases, you can ignore this function. This is only here to + * get maximum performance out of a specific situation. In all other cases, + * SDL will do the right thing, perhaps at a performance loss. + * + * This function is first available in SDL 2.0.10, and is not needed in + * 2.0.9 and earlier, as earlier versions did not queue rendering commands + * at all, instead flushing them to the OS immediately. + */ +extern DECLSPEC int SDLCALL SDL_RenderFlush(SDL_Renderer * renderer); + + +/** + * \brief Bind the texture to the current OpenGL/ES/ES2 context for use with + * OpenGL instructions. + * + * \param texture The SDL texture to bind + * \param texw A pointer to a float that will be filled with the texture width + * \param texh A pointer to a float that will be filled with the texture height + * + * \return 0 on success, or -1 if the operation is not supported + */ +extern DECLSPEC int SDLCALL SDL_GL_BindTexture(SDL_Texture *texture, float *texw, float *texh); + +/** + * \brief Unbind a texture from the current OpenGL/ES/ES2 context. + * + * \param texture The SDL texture to unbind + * + * \return 0 on success, or -1 if the operation is not supported + */ +extern DECLSPEC int SDLCALL SDL_GL_UnbindTexture(SDL_Texture *texture); + +/** + * \brief Get the CAMetalLayer associated with the given Metal renderer + * + * \param renderer The renderer to query + * + * \return CAMetalLayer* on success, or NULL if the renderer isn't a Metal renderer + * + * \sa SDL_RenderGetMetalCommandEncoder() + */ +extern DECLSPEC void *SDLCALL SDL_RenderGetMetalLayer(SDL_Renderer * renderer); + +/** + * \brief Get the Metal command encoder for the current frame + * + * \param renderer The renderer to query + * + * \return id on success, or NULL if the renderer isn't a Metal renderer + * + * \sa SDL_RenderGetMetalLayer() + */ +extern DECLSPEC void *SDLCALL SDL_RenderGetMetalCommandEncoder(SDL_Renderer * renderer); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_render_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_revision.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_revision.h new file mode 100644 index 0000000..e0bcf43 --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_revision.h @@ -0,0 +1,2 @@ +#define SDL_REVISION "hg-14525:e52d96ea04fc" +#define SDL_REVISION_NUMBER 14525 diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_rwops.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_rwops.h new file mode 100644 index 0000000..2e6225f --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_rwops.h @@ -0,0 +1,283 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_rwops.h + * + * This file provides a general interface for SDL to read and write + * data streams. It can easily be extended to files, memory, etc. + */ + +#ifndef SDL_rwops_h_ +#define SDL_rwops_h_ + +#include "SDL_stdinc.h" +#include "SDL_error.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* RWops Types */ +#define SDL_RWOPS_UNKNOWN 0U /**< Unknown stream type */ +#define SDL_RWOPS_WINFILE 1U /**< Win32 file */ +#define SDL_RWOPS_STDFILE 2U /**< Stdio file */ +#define SDL_RWOPS_JNIFILE 3U /**< Android asset */ +#define SDL_RWOPS_MEMORY 4U /**< Memory stream */ +#define SDL_RWOPS_MEMORY_RO 5U /**< Read-Only memory stream */ + +/** + * This is the read/write operation structure -- very basic. + */ +typedef struct SDL_RWops +{ + /** + * Return the size of the file in this rwops, or -1 if unknown + */ + Sint64 (SDLCALL * size) (struct SDL_RWops * context); + + /** + * Seek to \c offset relative to \c whence, one of stdio's whence values: + * RW_SEEK_SET, RW_SEEK_CUR, RW_SEEK_END + * + * \return the final offset in the data stream, or -1 on error. + */ + Sint64 (SDLCALL * seek) (struct SDL_RWops * context, Sint64 offset, + int whence); + + /** + * Read up to \c maxnum objects each of size \c size from the data + * stream to the area pointed at by \c ptr. + * + * \return the number of objects read, or 0 at error or end of file. + */ + size_t (SDLCALL * read) (struct SDL_RWops * context, void *ptr, + size_t size, size_t maxnum); + + /** + * Write exactly \c num objects each of size \c size from the area + * pointed at by \c ptr to data stream. + * + * \return the number of objects written, or 0 at error or end of file. + */ + size_t (SDLCALL * write) (struct SDL_RWops * context, const void *ptr, + size_t size, size_t num); + + /** + * Close and free an allocated SDL_RWops structure. + * + * \return 0 if successful or -1 on write error when flushing data. + */ + int (SDLCALL * close) (struct SDL_RWops * context); + + Uint32 type; + union + { +#if defined(__ANDROID__) + struct + { + void *asset; + } androidio; +#elif defined(__WIN32__) + struct + { + SDL_bool append; + void *h; + struct + { + void *data; + size_t size; + size_t left; + } buffer; + } windowsio; +#endif + +#ifdef HAVE_STDIO_H + struct + { + SDL_bool autoclose; + FILE *fp; + } stdio; +#endif + struct + { + Uint8 *base; + Uint8 *here; + Uint8 *stop; + } mem; + struct + { + void *data1; + void *data2; + } unknown; + } hidden; + +} SDL_RWops; + + +/** + * \name RWFrom functions + * + * Functions to create SDL_RWops structures from various data streams. + */ +/* @{ */ + +extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromFile(const char *file, + const char *mode); + +#ifdef HAVE_STDIO_H +extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromFP(FILE * fp, + SDL_bool autoclose); +#else +extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromFP(void * fp, + SDL_bool autoclose); +#endif + +extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromMem(void *mem, int size); +extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromConstMem(const void *mem, + int size); + +/* @} *//* RWFrom functions */ + + +extern DECLSPEC SDL_RWops *SDLCALL SDL_AllocRW(void); +extern DECLSPEC void SDLCALL SDL_FreeRW(SDL_RWops * area); + +#define RW_SEEK_SET 0 /**< Seek from the beginning of data */ +#define RW_SEEK_CUR 1 /**< Seek relative to current read point */ +#define RW_SEEK_END 2 /**< Seek relative to the end of data */ + +/** + * Return the size of the file in this rwops, or -1 if unknown + */ +extern DECLSPEC Sint64 SDLCALL SDL_RWsize(SDL_RWops *context); + +/** + * Seek to \c offset relative to \c whence, one of stdio's whence values: + * RW_SEEK_SET, RW_SEEK_CUR, RW_SEEK_END + * + * \return the final offset in the data stream, or -1 on error. + */ +extern DECLSPEC Sint64 SDLCALL SDL_RWseek(SDL_RWops *context, + Sint64 offset, int whence); + +/** + * Return the current offset in the data stream, or -1 on error. + */ +extern DECLSPEC Sint64 SDLCALL SDL_RWtell(SDL_RWops *context); + +/** + * Read up to \c maxnum objects each of size \c size from the data + * stream to the area pointed at by \c ptr. + * + * \return the number of objects read, or 0 at error or end of file. + */ +extern DECLSPEC size_t SDLCALL SDL_RWread(SDL_RWops *context, + void *ptr, size_t size, size_t maxnum); + +/** + * Write exactly \c num objects each of size \c size from the area + * pointed at by \c ptr to data stream. + * + * \return the number of objects written, or 0 at error or end of file. + */ +extern DECLSPEC size_t SDLCALL SDL_RWwrite(SDL_RWops *context, + const void *ptr, size_t size, size_t num); + +/** + * Close and free an allocated SDL_RWops structure. + * + * \return 0 if successful or -1 on write error when flushing data. + */ +extern DECLSPEC int SDLCALL SDL_RWclose(SDL_RWops *context); + +/** + * Load all the data from an SDL data stream. + * + * The data is allocated with a zero byte at the end (null terminated) + * + * If \c datasize is not NULL, it is filled with the size of the data read. + * + * If \c freesrc is non-zero, the stream will be closed after being read. + * + * The data should be freed with SDL_free(). + * + * \return the data, or NULL if there was an error. + */ +extern DECLSPEC void *SDLCALL SDL_LoadFile_RW(SDL_RWops * src, size_t *datasize, + int freesrc); + +/** + * Load an entire file. + * + * The data is allocated with a zero byte at the end (null terminated) + * + * If \c datasize is not NULL, it is filled with the size of the data read. + * + * If \c freesrc is non-zero, the stream will be closed after being read. + * + * The data should be freed with SDL_free(). + * + * \return the data, or NULL if there was an error. + */ +extern DECLSPEC void *SDLCALL SDL_LoadFile(const char *file, size_t *datasize); + +/** + * \name Read endian functions + * + * Read an item of the specified endianness and return in native format. + */ +/* @{ */ +extern DECLSPEC Uint8 SDLCALL SDL_ReadU8(SDL_RWops * src); +extern DECLSPEC Uint16 SDLCALL SDL_ReadLE16(SDL_RWops * src); +extern DECLSPEC Uint16 SDLCALL SDL_ReadBE16(SDL_RWops * src); +extern DECLSPEC Uint32 SDLCALL SDL_ReadLE32(SDL_RWops * src); +extern DECLSPEC Uint32 SDLCALL SDL_ReadBE32(SDL_RWops * src); +extern DECLSPEC Uint64 SDLCALL SDL_ReadLE64(SDL_RWops * src); +extern DECLSPEC Uint64 SDLCALL SDL_ReadBE64(SDL_RWops * src); +/* @} *//* Read endian functions */ + +/** + * \name Write endian functions + * + * Write an item of native format to the specified endianness. + */ +/* @{ */ +extern DECLSPEC size_t SDLCALL SDL_WriteU8(SDL_RWops * dst, Uint8 value); +extern DECLSPEC size_t SDLCALL SDL_WriteLE16(SDL_RWops * dst, Uint16 value); +extern DECLSPEC size_t SDLCALL SDL_WriteBE16(SDL_RWops * dst, Uint16 value); +extern DECLSPEC size_t SDLCALL SDL_WriteLE32(SDL_RWops * dst, Uint32 value); +extern DECLSPEC size_t SDLCALL SDL_WriteBE32(SDL_RWops * dst, Uint32 value); +extern DECLSPEC size_t SDLCALL SDL_WriteLE64(SDL_RWops * dst, Uint64 value); +extern DECLSPEC size_t SDLCALL SDL_WriteBE64(SDL_RWops * dst, Uint64 value); +/* @} *//* Write endian functions */ + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_rwops_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_scancode.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_scancode.h new file mode 100644 index 0000000..b19197d --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_scancode.h @@ -0,0 +1,413 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_scancode.h + * + * Defines keyboard scancodes. + */ + +#ifndef SDL_scancode_h_ +#define SDL_scancode_h_ + +#include "SDL_stdinc.h" + +/** + * \brief The SDL keyboard scancode representation. + * + * Values of this type are used to represent keyboard keys, among other places + * in the \link SDL_Keysym::scancode key.keysym.scancode \endlink field of the + * SDL_Event structure. + * + * The values in this enumeration are based on the USB usage page standard: + * https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf + */ +typedef enum +{ + SDL_SCANCODE_UNKNOWN = 0, + + /** + * \name Usage page 0x07 + * + * These values are from usage page 0x07 (USB keyboard page). + */ + /* @{ */ + + SDL_SCANCODE_A = 4, + SDL_SCANCODE_B = 5, + SDL_SCANCODE_C = 6, + SDL_SCANCODE_D = 7, + SDL_SCANCODE_E = 8, + SDL_SCANCODE_F = 9, + SDL_SCANCODE_G = 10, + SDL_SCANCODE_H = 11, + SDL_SCANCODE_I = 12, + SDL_SCANCODE_J = 13, + SDL_SCANCODE_K = 14, + SDL_SCANCODE_L = 15, + SDL_SCANCODE_M = 16, + SDL_SCANCODE_N = 17, + SDL_SCANCODE_O = 18, + SDL_SCANCODE_P = 19, + SDL_SCANCODE_Q = 20, + SDL_SCANCODE_R = 21, + SDL_SCANCODE_S = 22, + SDL_SCANCODE_T = 23, + SDL_SCANCODE_U = 24, + SDL_SCANCODE_V = 25, + SDL_SCANCODE_W = 26, + SDL_SCANCODE_X = 27, + SDL_SCANCODE_Y = 28, + SDL_SCANCODE_Z = 29, + + SDL_SCANCODE_1 = 30, + SDL_SCANCODE_2 = 31, + SDL_SCANCODE_3 = 32, + SDL_SCANCODE_4 = 33, + SDL_SCANCODE_5 = 34, + SDL_SCANCODE_6 = 35, + SDL_SCANCODE_7 = 36, + SDL_SCANCODE_8 = 37, + SDL_SCANCODE_9 = 38, + SDL_SCANCODE_0 = 39, + + SDL_SCANCODE_RETURN = 40, + SDL_SCANCODE_ESCAPE = 41, + SDL_SCANCODE_BACKSPACE = 42, + SDL_SCANCODE_TAB = 43, + SDL_SCANCODE_SPACE = 44, + + SDL_SCANCODE_MINUS = 45, + SDL_SCANCODE_EQUALS = 46, + SDL_SCANCODE_LEFTBRACKET = 47, + SDL_SCANCODE_RIGHTBRACKET = 48, + SDL_SCANCODE_BACKSLASH = 49, /**< Located at the lower left of the return + * key on ISO keyboards and at the right end + * of the QWERTY row on ANSI keyboards. + * Produces REVERSE SOLIDUS (backslash) and + * VERTICAL LINE in a US layout, REVERSE + * SOLIDUS and VERTICAL LINE in a UK Mac + * layout, NUMBER SIGN and TILDE in a UK + * Windows layout, DOLLAR SIGN and POUND SIGN + * in a Swiss German layout, NUMBER SIGN and + * APOSTROPHE in a German layout, GRAVE + * ACCENT and POUND SIGN in a French Mac + * layout, and ASTERISK and MICRO SIGN in a + * French Windows layout. + */ + SDL_SCANCODE_NONUSHASH = 50, /**< ISO USB keyboards actually use this code + * instead of 49 for the same key, but all + * OSes I've seen treat the two codes + * identically. So, as an implementor, unless + * your keyboard generates both of those + * codes and your OS treats them differently, + * you should generate SDL_SCANCODE_BACKSLASH + * instead of this code. As a user, you + * should not rely on this code because SDL + * will never generate it with most (all?) + * keyboards. + */ + SDL_SCANCODE_SEMICOLON = 51, + SDL_SCANCODE_APOSTROPHE = 52, + SDL_SCANCODE_GRAVE = 53, /**< Located in the top left corner (on both ANSI + * and ISO keyboards). Produces GRAVE ACCENT and + * TILDE in a US Windows layout and in US and UK + * Mac layouts on ANSI keyboards, GRAVE ACCENT + * and NOT SIGN in a UK Windows layout, SECTION + * SIGN and PLUS-MINUS SIGN in US and UK Mac + * layouts on ISO keyboards, SECTION SIGN and + * DEGREE SIGN in a Swiss German layout (Mac: + * only on ISO keyboards), CIRCUMFLEX ACCENT and + * DEGREE SIGN in a German layout (Mac: only on + * ISO keyboards), SUPERSCRIPT TWO and TILDE in a + * French Windows layout, COMMERCIAL AT and + * NUMBER SIGN in a French Mac layout on ISO + * keyboards, and LESS-THAN SIGN and GREATER-THAN + * SIGN in a Swiss German, German, or French Mac + * layout on ANSI keyboards. + */ + SDL_SCANCODE_COMMA = 54, + SDL_SCANCODE_PERIOD = 55, + SDL_SCANCODE_SLASH = 56, + + SDL_SCANCODE_CAPSLOCK = 57, + + SDL_SCANCODE_F1 = 58, + SDL_SCANCODE_F2 = 59, + SDL_SCANCODE_F3 = 60, + SDL_SCANCODE_F4 = 61, + SDL_SCANCODE_F5 = 62, + SDL_SCANCODE_F6 = 63, + SDL_SCANCODE_F7 = 64, + SDL_SCANCODE_F8 = 65, + SDL_SCANCODE_F9 = 66, + SDL_SCANCODE_F10 = 67, + SDL_SCANCODE_F11 = 68, + SDL_SCANCODE_F12 = 69, + + SDL_SCANCODE_PRINTSCREEN = 70, + SDL_SCANCODE_SCROLLLOCK = 71, + SDL_SCANCODE_PAUSE = 72, + SDL_SCANCODE_INSERT = 73, /**< insert on PC, help on some Mac keyboards (but + does send code 73, not 117) */ + SDL_SCANCODE_HOME = 74, + SDL_SCANCODE_PAGEUP = 75, + SDL_SCANCODE_DELETE = 76, + SDL_SCANCODE_END = 77, + SDL_SCANCODE_PAGEDOWN = 78, + SDL_SCANCODE_RIGHT = 79, + SDL_SCANCODE_LEFT = 80, + SDL_SCANCODE_DOWN = 81, + SDL_SCANCODE_UP = 82, + + SDL_SCANCODE_NUMLOCKCLEAR = 83, /**< num lock on PC, clear on Mac keyboards + */ + SDL_SCANCODE_KP_DIVIDE = 84, + SDL_SCANCODE_KP_MULTIPLY = 85, + SDL_SCANCODE_KP_MINUS = 86, + SDL_SCANCODE_KP_PLUS = 87, + SDL_SCANCODE_KP_ENTER = 88, + SDL_SCANCODE_KP_1 = 89, + SDL_SCANCODE_KP_2 = 90, + SDL_SCANCODE_KP_3 = 91, + SDL_SCANCODE_KP_4 = 92, + SDL_SCANCODE_KP_5 = 93, + SDL_SCANCODE_KP_6 = 94, + SDL_SCANCODE_KP_7 = 95, + SDL_SCANCODE_KP_8 = 96, + SDL_SCANCODE_KP_9 = 97, + SDL_SCANCODE_KP_0 = 98, + SDL_SCANCODE_KP_PERIOD = 99, + + SDL_SCANCODE_NONUSBACKSLASH = 100, /**< This is the additional key that ISO + * keyboards have over ANSI ones, + * located between left shift and Y. + * Produces GRAVE ACCENT and TILDE in a + * US or UK Mac layout, REVERSE SOLIDUS + * (backslash) and VERTICAL LINE in a + * US or UK Windows layout, and + * LESS-THAN SIGN and GREATER-THAN SIGN + * in a Swiss German, German, or French + * layout. */ + SDL_SCANCODE_APPLICATION = 101, /**< windows contextual menu, compose */ + SDL_SCANCODE_POWER = 102, /**< The USB document says this is a status flag, + * not a physical key - but some Mac keyboards + * do have a power key. */ + SDL_SCANCODE_KP_EQUALS = 103, + SDL_SCANCODE_F13 = 104, + SDL_SCANCODE_F14 = 105, + SDL_SCANCODE_F15 = 106, + SDL_SCANCODE_F16 = 107, + SDL_SCANCODE_F17 = 108, + SDL_SCANCODE_F18 = 109, + SDL_SCANCODE_F19 = 110, + SDL_SCANCODE_F20 = 111, + SDL_SCANCODE_F21 = 112, + SDL_SCANCODE_F22 = 113, + SDL_SCANCODE_F23 = 114, + SDL_SCANCODE_F24 = 115, + SDL_SCANCODE_EXECUTE = 116, + SDL_SCANCODE_HELP = 117, + SDL_SCANCODE_MENU = 118, + SDL_SCANCODE_SELECT = 119, + SDL_SCANCODE_STOP = 120, + SDL_SCANCODE_AGAIN = 121, /**< redo */ + SDL_SCANCODE_UNDO = 122, + SDL_SCANCODE_CUT = 123, + SDL_SCANCODE_COPY = 124, + SDL_SCANCODE_PASTE = 125, + SDL_SCANCODE_FIND = 126, + SDL_SCANCODE_MUTE = 127, + SDL_SCANCODE_VOLUMEUP = 128, + SDL_SCANCODE_VOLUMEDOWN = 129, +/* not sure whether there's a reason to enable these */ +/* SDL_SCANCODE_LOCKINGCAPSLOCK = 130, */ +/* SDL_SCANCODE_LOCKINGNUMLOCK = 131, */ +/* SDL_SCANCODE_LOCKINGSCROLLLOCK = 132, */ + SDL_SCANCODE_KP_COMMA = 133, + SDL_SCANCODE_KP_EQUALSAS400 = 134, + + SDL_SCANCODE_INTERNATIONAL1 = 135, /**< used on Asian keyboards, see + footnotes in USB doc */ + SDL_SCANCODE_INTERNATIONAL2 = 136, + SDL_SCANCODE_INTERNATIONAL3 = 137, /**< Yen */ + SDL_SCANCODE_INTERNATIONAL4 = 138, + SDL_SCANCODE_INTERNATIONAL5 = 139, + SDL_SCANCODE_INTERNATIONAL6 = 140, + SDL_SCANCODE_INTERNATIONAL7 = 141, + SDL_SCANCODE_INTERNATIONAL8 = 142, + SDL_SCANCODE_INTERNATIONAL9 = 143, + SDL_SCANCODE_LANG1 = 144, /**< Hangul/English toggle */ + SDL_SCANCODE_LANG2 = 145, /**< Hanja conversion */ + SDL_SCANCODE_LANG3 = 146, /**< Katakana */ + SDL_SCANCODE_LANG4 = 147, /**< Hiragana */ + SDL_SCANCODE_LANG5 = 148, /**< Zenkaku/Hankaku */ + SDL_SCANCODE_LANG6 = 149, /**< reserved */ + SDL_SCANCODE_LANG7 = 150, /**< reserved */ + SDL_SCANCODE_LANG8 = 151, /**< reserved */ + SDL_SCANCODE_LANG9 = 152, /**< reserved */ + + SDL_SCANCODE_ALTERASE = 153, /**< Erase-Eaze */ + SDL_SCANCODE_SYSREQ = 154, + SDL_SCANCODE_CANCEL = 155, + SDL_SCANCODE_CLEAR = 156, + SDL_SCANCODE_PRIOR = 157, + SDL_SCANCODE_RETURN2 = 158, + SDL_SCANCODE_SEPARATOR = 159, + SDL_SCANCODE_OUT = 160, + SDL_SCANCODE_OPER = 161, + SDL_SCANCODE_CLEARAGAIN = 162, + SDL_SCANCODE_CRSEL = 163, + SDL_SCANCODE_EXSEL = 164, + + SDL_SCANCODE_KP_00 = 176, + SDL_SCANCODE_KP_000 = 177, + SDL_SCANCODE_THOUSANDSSEPARATOR = 178, + SDL_SCANCODE_DECIMALSEPARATOR = 179, + SDL_SCANCODE_CURRENCYUNIT = 180, + SDL_SCANCODE_CURRENCYSUBUNIT = 181, + SDL_SCANCODE_KP_LEFTPAREN = 182, + SDL_SCANCODE_KP_RIGHTPAREN = 183, + SDL_SCANCODE_KP_LEFTBRACE = 184, + SDL_SCANCODE_KP_RIGHTBRACE = 185, + SDL_SCANCODE_KP_TAB = 186, + SDL_SCANCODE_KP_BACKSPACE = 187, + SDL_SCANCODE_KP_A = 188, + SDL_SCANCODE_KP_B = 189, + SDL_SCANCODE_KP_C = 190, + SDL_SCANCODE_KP_D = 191, + SDL_SCANCODE_KP_E = 192, + SDL_SCANCODE_KP_F = 193, + SDL_SCANCODE_KP_XOR = 194, + SDL_SCANCODE_KP_POWER = 195, + SDL_SCANCODE_KP_PERCENT = 196, + SDL_SCANCODE_KP_LESS = 197, + SDL_SCANCODE_KP_GREATER = 198, + SDL_SCANCODE_KP_AMPERSAND = 199, + SDL_SCANCODE_KP_DBLAMPERSAND = 200, + SDL_SCANCODE_KP_VERTICALBAR = 201, + SDL_SCANCODE_KP_DBLVERTICALBAR = 202, + SDL_SCANCODE_KP_COLON = 203, + SDL_SCANCODE_KP_HASH = 204, + SDL_SCANCODE_KP_SPACE = 205, + SDL_SCANCODE_KP_AT = 206, + SDL_SCANCODE_KP_EXCLAM = 207, + SDL_SCANCODE_KP_MEMSTORE = 208, + SDL_SCANCODE_KP_MEMRECALL = 209, + SDL_SCANCODE_KP_MEMCLEAR = 210, + SDL_SCANCODE_KP_MEMADD = 211, + SDL_SCANCODE_KP_MEMSUBTRACT = 212, + SDL_SCANCODE_KP_MEMMULTIPLY = 213, + SDL_SCANCODE_KP_MEMDIVIDE = 214, + SDL_SCANCODE_KP_PLUSMINUS = 215, + SDL_SCANCODE_KP_CLEAR = 216, + SDL_SCANCODE_KP_CLEARENTRY = 217, + SDL_SCANCODE_KP_BINARY = 218, + SDL_SCANCODE_KP_OCTAL = 219, + SDL_SCANCODE_KP_DECIMAL = 220, + SDL_SCANCODE_KP_HEXADECIMAL = 221, + + SDL_SCANCODE_LCTRL = 224, + SDL_SCANCODE_LSHIFT = 225, + SDL_SCANCODE_LALT = 226, /**< alt, option */ + SDL_SCANCODE_LGUI = 227, /**< windows, command (apple), meta */ + SDL_SCANCODE_RCTRL = 228, + SDL_SCANCODE_RSHIFT = 229, + SDL_SCANCODE_RALT = 230, /**< alt gr, option */ + SDL_SCANCODE_RGUI = 231, /**< windows, command (apple), meta */ + + SDL_SCANCODE_MODE = 257, /**< I'm not sure if this is really not covered + * by any of the above, but since there's a + * special KMOD_MODE for it I'm adding it here + */ + + /* @} *//* Usage page 0x07 */ + + /** + * \name Usage page 0x0C + * + * These values are mapped from usage page 0x0C (USB consumer page). + */ + /* @{ */ + + SDL_SCANCODE_AUDIONEXT = 258, + SDL_SCANCODE_AUDIOPREV = 259, + SDL_SCANCODE_AUDIOSTOP = 260, + SDL_SCANCODE_AUDIOPLAY = 261, + SDL_SCANCODE_AUDIOMUTE = 262, + SDL_SCANCODE_MEDIASELECT = 263, + SDL_SCANCODE_WWW = 264, + SDL_SCANCODE_MAIL = 265, + SDL_SCANCODE_CALCULATOR = 266, + SDL_SCANCODE_COMPUTER = 267, + SDL_SCANCODE_AC_SEARCH = 268, + SDL_SCANCODE_AC_HOME = 269, + SDL_SCANCODE_AC_BACK = 270, + SDL_SCANCODE_AC_FORWARD = 271, + SDL_SCANCODE_AC_STOP = 272, + SDL_SCANCODE_AC_REFRESH = 273, + SDL_SCANCODE_AC_BOOKMARKS = 274, + + /* @} *//* Usage page 0x0C */ + + /** + * \name Walther keys + * + * These are values that Christian Walther added (for mac keyboard?). + */ + /* @{ */ + + SDL_SCANCODE_BRIGHTNESSDOWN = 275, + SDL_SCANCODE_BRIGHTNESSUP = 276, + SDL_SCANCODE_DISPLAYSWITCH = 277, /**< display mirroring/dual display + switch, video mode switch */ + SDL_SCANCODE_KBDILLUMTOGGLE = 278, + SDL_SCANCODE_KBDILLUMDOWN = 279, + SDL_SCANCODE_KBDILLUMUP = 280, + SDL_SCANCODE_EJECT = 281, + SDL_SCANCODE_SLEEP = 282, + + SDL_SCANCODE_APP1 = 283, + SDL_SCANCODE_APP2 = 284, + + /* @} *//* Walther keys */ + + /** + * \name Usage page 0x0C (additional media keys) + * + * These values are mapped from usage page 0x0C (USB consumer page). + */ + /* @{ */ + + SDL_SCANCODE_AUDIOREWIND = 285, + SDL_SCANCODE_AUDIOFASTFORWARD = 286, + + /* @} *//* Usage page 0x0C (additional media keys) */ + + /* Add any other keys here. */ + + SDL_NUM_SCANCODES = 512 /**< not a key, just marks the number of scancodes + for array bounds */ +} SDL_Scancode; + +#endif /* SDL_scancode_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_sensor.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_sensor.h new file mode 100644 index 0000000..e623634 --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_sensor.h @@ -0,0 +1,267 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_sensor.h + * + * Include file for SDL sensor event handling + * + */ + +#ifndef SDL_sensor_h_ +#define SDL_sensor_h_ + +#include "SDL_stdinc.h" +#include "SDL_error.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + +/** + * \brief SDL_sensor.h + * + * In order to use these functions, SDL_Init() must have been called + * with the ::SDL_INIT_SENSOR flag. This causes SDL to scan the system + * for sensors, and load appropriate drivers. + */ + +struct _SDL_Sensor; +typedef struct _SDL_Sensor SDL_Sensor; + +/** + * This is a unique ID for a sensor for the time it is connected to the system, + * and is never reused for the lifetime of the application. + * + * The ID value starts at 0 and increments from there. The value -1 is an invalid ID. + */ +typedef Sint32 SDL_SensorID; + +/* The different sensors defined by SDL + * + * Additional sensors may be available, using platform dependent semantics. + * + * Hare are the additional Android sensors: + * https://developer.android.com/reference/android/hardware/SensorEvent.html#values + */ +typedef enum +{ + SDL_SENSOR_INVALID = -1, /**< Returned for an invalid sensor */ + SDL_SENSOR_UNKNOWN, /**< Unknown sensor type */ + SDL_SENSOR_ACCEL, /**< Accelerometer */ + SDL_SENSOR_GYRO /**< Gyroscope */ +} SDL_SensorType; + +/** + * Accelerometer sensor + * + * The accelerometer returns the current acceleration in SI meters per + * second squared. This measurement includes the force of gravity, so + * a device at rest will have an value of SDL_STANDARD_GRAVITY away + * from the center of the earth. + * + * values[0]: Acceleration on the x axis + * values[1]: Acceleration on the y axis + * values[2]: Acceleration on the z axis + * + * For phones held in portrait mode and game controllers held in front of you, + * the axes are defined as follows: + * -X ... +X : left ... right + * -Y ... +Y : bottom ... top + * -Z ... +Z : farther ... closer + * + * The axis data is not changed when the phone is rotated. + * + * \sa SDL_GetDisplayOrientation() + */ +#define SDL_STANDARD_GRAVITY 9.80665f + +/** + * Gyroscope sensor + * + * The gyroscope returns the current rate of rotation in radians per second. + * The rotation is positive in the counter-clockwise direction. That is, + * an observer looking from a positive location on one of the axes would + * see positive rotation on that axis when it appeared to be rotating + * counter-clockwise. + * + * values[0]: Angular speed around the x axis (pitch) + * values[1]: Angular speed around the y axis (yaw) + * values[2]: Angular speed around the z axis (roll) + * + * For phones held in portrait mode and game controllers held in front of you, + * the axes are defined as follows: + * -X ... +X : left ... right + * -Y ... +Y : bottom ... top + * -Z ... +Z : farther ... closer + * + * The axis data is not changed when the phone or controller is rotated. + * + * \sa SDL_GetDisplayOrientation() + */ + +/* Function prototypes */ + +/** + * Locking for multi-threaded access to the sensor API + * + * If you are using the sensor API or handling events from multiple threads + * you should use these locking functions to protect access to the sensors. + * + * In particular, you are guaranteed that the sensor list won't change, so + * the API functions that take a sensor index will be valid, and sensor + * events will not be delivered. + */ +extern DECLSPEC void SDLCALL SDL_LockSensors(void); +extern DECLSPEC void SDLCALL SDL_UnlockSensors(void); + +/** + * \brief Count the number of sensors attached to the system right now + */ +extern DECLSPEC int SDLCALL SDL_NumSensors(void); + +/** + * \brief Get the implementation dependent name of a sensor. + * + * This can be called before any sensors are opened. + * + * \return The sensor name, or NULL if device_index is out of range. + */ +extern DECLSPEC const char *SDLCALL SDL_SensorGetDeviceName(int device_index); + +/** + * \brief Get the type of a sensor. + * + * This can be called before any sensors are opened. + * + * \return The sensor type, or SDL_SENSOR_INVALID if device_index is out of range. + */ +extern DECLSPEC SDL_SensorType SDLCALL SDL_SensorGetDeviceType(int device_index); + +/** + * \brief Get the platform dependent type of a sensor. + * + * This can be called before any sensors are opened. + * + * \return The sensor platform dependent type, or -1 if device_index is out of range. + */ +extern DECLSPEC int SDLCALL SDL_SensorGetDeviceNonPortableType(int device_index); + +/** + * \brief Get the instance ID of a sensor. + * + * This can be called before any sensors are opened. + * + * \return The sensor instance ID, or -1 if device_index is out of range. + */ +extern DECLSPEC SDL_SensorID SDLCALL SDL_SensorGetDeviceInstanceID(int device_index); + +/** + * \brief Open a sensor for use. + * + * The index passed as an argument refers to the N'th sensor on the system. + * + * \return A sensor identifier, or NULL if an error occurred. + */ +extern DECLSPEC SDL_Sensor *SDLCALL SDL_SensorOpen(int device_index); + +/** + * Return the SDL_Sensor associated with an instance id. + */ +extern DECLSPEC SDL_Sensor *SDLCALL SDL_SensorFromInstanceID(SDL_SensorID instance_id); + +/** + * \brief Get the implementation dependent name of a sensor. + * + * \return The sensor name, or NULL if the sensor is NULL. + */ +extern DECLSPEC const char *SDLCALL SDL_SensorGetName(SDL_Sensor *sensor); + +/** + * \brief Get the type of a sensor. + * + * This can be called before any sensors are opened. + * + * \return The sensor type, or SDL_SENSOR_INVALID if the sensor is NULL. + */ +extern DECLSPEC SDL_SensorType SDLCALL SDL_SensorGetType(SDL_Sensor *sensor); + +/** + * \brief Get the platform dependent type of a sensor. + * + * This can be called before any sensors are opened. + * + * \return The sensor platform dependent type, or -1 if the sensor is NULL. + */ +extern DECLSPEC int SDLCALL SDL_SensorGetNonPortableType(SDL_Sensor *sensor); + +/** + * \brief Get the instance ID of a sensor. + * + * This can be called before any sensors are opened. + * + * \return The sensor instance ID, or -1 if the sensor is NULL. + */ +extern DECLSPEC SDL_SensorID SDLCALL SDL_SensorGetInstanceID(SDL_Sensor *sensor); + +/** + * Get the current state of an opened sensor. + * + * The number of values and interpretation of the data is sensor dependent. + * + * \param sensor The sensor to query + * \param data A pointer filled with the current sensor state + * \param num_values The number of values to write to data + * + * \return 0 or -1 if an error occurred. + */ +extern DECLSPEC int SDLCALL SDL_SensorGetData(SDL_Sensor * sensor, float *data, int num_values); + +/** + * Close a sensor previously opened with SDL_SensorOpen() + */ +extern DECLSPEC void SDLCALL SDL_SensorClose(SDL_Sensor * sensor); + +/** + * Update the current state of the open sensors. + * + * This is called automatically by the event loop if sensor events are enabled. + * + * This needs to be called from the thread that initialized the sensor subsystem. + */ +extern DECLSPEC void SDLCALL SDL_SensorUpdate(void); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* SDL_sensor_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_shape.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_shape.h new file mode 100644 index 0000000..cbd9deb --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_shape.h @@ -0,0 +1,144 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef SDL_shape_h_ +#define SDL_shape_h_ + +#include "SDL_stdinc.h" +#include "SDL_pixels.h" +#include "SDL_rect.h" +#include "SDL_surface.h" +#include "SDL_video.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/** \file SDL_shape.h + * + * Header file for the shaped window API. + */ + +#define SDL_NONSHAPEABLE_WINDOW -1 +#define SDL_INVALID_SHAPE_ARGUMENT -2 +#define SDL_WINDOW_LACKS_SHAPE -3 + +/** + * \brief Create a window that can be shaped with the specified position, dimensions, and flags. + * + * \param title The title of the window, in UTF-8 encoding. + * \param x The x position of the window, ::SDL_WINDOWPOS_CENTERED, or + * ::SDL_WINDOWPOS_UNDEFINED. + * \param y The y position of the window, ::SDL_WINDOWPOS_CENTERED, or + * ::SDL_WINDOWPOS_UNDEFINED. + * \param w The width of the window. + * \param h The height of the window. + * \param flags The flags for the window, a mask of SDL_WINDOW_BORDERLESS with any of the following: + * ::SDL_WINDOW_OPENGL, ::SDL_WINDOW_INPUT_GRABBED, + * ::SDL_WINDOW_HIDDEN, ::SDL_WINDOW_RESIZABLE, + * ::SDL_WINDOW_MAXIMIZED, ::SDL_WINDOW_MINIMIZED, + * ::SDL_WINDOW_BORDERLESS is always set, and ::SDL_WINDOW_FULLSCREEN is always unset. + * + * \return The window created, or NULL if window creation failed. + * + * \sa SDL_DestroyWindow() + */ +extern DECLSPEC SDL_Window * SDLCALL SDL_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned int w,unsigned int h,Uint32 flags); + +/** + * \brief Return whether the given window is a shaped window. + * + * \param window The window to query for being shaped. + * + * \return SDL_TRUE if the window is a window that can be shaped, SDL_FALSE if the window is unshaped or NULL. + * + * \sa SDL_CreateShapedWindow + */ +extern DECLSPEC SDL_bool SDLCALL SDL_IsShapedWindow(const SDL_Window *window); + +/** \brief An enum denoting the specific type of contents present in an SDL_WindowShapeParams union. */ +typedef enum { + /** \brief The default mode, a binarized alpha cutoff of 1. */ + ShapeModeDefault, + /** \brief A binarized alpha cutoff with a given integer value. */ + ShapeModeBinarizeAlpha, + /** \brief A binarized alpha cutoff with a given integer value, but with the opposite comparison. */ + ShapeModeReverseBinarizeAlpha, + /** \brief A color key is applied. */ + ShapeModeColorKey +} WindowShapeMode; + +#define SDL_SHAPEMODEALPHA(mode) (mode == ShapeModeDefault || mode == ShapeModeBinarizeAlpha || mode == ShapeModeReverseBinarizeAlpha) + +/** \brief A union containing parameters for shaped windows. */ +typedef union { + /** \brief A cutoff alpha value for binarization of the window shape's alpha channel. */ + Uint8 binarizationCutoff; + SDL_Color colorKey; +} SDL_WindowShapeParams; + +/** \brief A struct that tags the SDL_WindowShapeParams union with an enum describing the type of its contents. */ +typedef struct SDL_WindowShapeMode { + /** \brief The mode of these window-shape parameters. */ + WindowShapeMode mode; + /** \brief Window-shape parameters. */ + SDL_WindowShapeParams parameters; +} SDL_WindowShapeMode; + +/** + * \brief Set the shape and parameters of a shaped window. + * + * \param window The shaped window whose parameters should be set. + * \param shape A surface encoding the desired shape for the window. + * \param shape_mode The parameters to set for the shaped window. + * + * \return 0 on success, SDL_INVALID_SHAPE_ARGUMENT on an invalid shape argument, or SDL_NONSHAPEABLE_WINDOW + * if the SDL_Window given does not reference a valid shaped window. + * + * \sa SDL_WindowShapeMode + * \sa SDL_GetShapedWindowMode. + */ +extern DECLSPEC int SDLCALL SDL_SetWindowShape(SDL_Window *window,SDL_Surface *shape,SDL_WindowShapeMode *shape_mode); + +/** + * \brief Get the shape parameters of a shaped window. + * + * \param window The shaped window whose parameters should be retrieved. + * \param shape_mode An empty shape-mode structure to fill, or NULL to check whether the window has a shape. + * + * \return 0 if the window has a shape and, provided shape_mode was not NULL, shape_mode has been filled with the mode + * data, SDL_NONSHAPEABLE_WINDOW if the SDL_Window given is not a shaped window, or SDL_WINDOW_LACKS_SHAPE if + * the SDL_Window given is a shapeable window currently lacking a shape. + * + * \sa SDL_WindowShapeMode + * \sa SDL_SetWindowShape + */ +extern DECLSPEC int SDLCALL SDL_GetShapedWindowMode(SDL_Window *window,SDL_WindowShapeMode *shape_mode); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_shape_h_ */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_stdinc.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_stdinc.h new file mode 100644 index 0000000..91ccaa4 --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_stdinc.h @@ -0,0 +1,647 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_stdinc.h + * + * This is a general header that includes C language support. + */ + +#ifndef SDL_stdinc_h_ +#define SDL_stdinc_h_ + +#include "SDL_config.h" + +#ifdef __APPLE__ +#ifndef _DARWIN_C_SOURCE +#define _DARWIN_C_SOURCE 1 /* for memset_pattern4() */ +#endif +#endif + +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_STDIO_H +#include +#endif +#if defined(STDC_HEADERS) +# include +# include +# include +#else +# if defined(HAVE_STDLIB_H) +# include +# elif defined(HAVE_MALLOC_H) +# include +# endif +# if defined(HAVE_STDDEF_H) +# include +# endif +# if defined(HAVE_STDARG_H) +# include +# endif +#endif +#ifdef HAVE_STRING_H +# if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H) +# include +# endif +# include +#endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_WCHAR_H +# include +#endif +#if defined(HAVE_INTTYPES_H) +# include +#elif defined(HAVE_STDINT_H) +# include +#endif +#ifdef HAVE_CTYPE_H +# include +#endif +#ifdef HAVE_MATH_H +# if defined(__WINRT__) +/* Defining _USE_MATH_DEFINES is required to get M_PI to be defined on + WinRT. See http://msdn.microsoft.com/en-us/library/4hwaceh6.aspx + for more information. +*/ +# define _USE_MATH_DEFINES +# endif +# include +#endif +#ifdef HAVE_FLOAT_H +# include +#endif +#if defined(HAVE_ALLOCA) && !defined(alloca) +# if defined(HAVE_ALLOCA_H) +# include +# elif defined(__GNUC__) +# define alloca __builtin_alloca +# elif defined(_MSC_VER) +# include +# define alloca _alloca +# elif defined(__WATCOMC__) +# include +# elif defined(__BORLANDC__) +# include +# elif defined(__DMC__) +# include +# elif defined(__AIX__) +#pragma alloca +# elif defined(__MRC__) +void *alloca(unsigned); +# else +char *alloca(); +# endif +#endif + +/** + * The number of elements in an array. + */ +#define SDL_arraysize(array) (sizeof(array)/sizeof(array[0])) +#define SDL_TABLESIZE(table) SDL_arraysize(table) + +/** + * Macro useful for building other macros with strings in them + * + * e.g. #define LOG_ERROR(X) OutputDebugString(SDL_STRINGIFY_ARG(__FUNCTION__) ": " X "\n") + */ +#define SDL_STRINGIFY_ARG(arg) #arg + +/** + * \name Cast operators + * + * Use proper C++ casts when compiled as C++ to be compatible with the option + * -Wold-style-cast of GCC (and -Werror=old-style-cast in GCC 4.2 and above). + */ +/* @{ */ +#ifdef __cplusplus +#define SDL_reinterpret_cast(type, expression) reinterpret_cast(expression) +#define SDL_static_cast(type, expression) static_cast(expression) +#define SDL_const_cast(type, expression) const_cast(expression) +#else +#define SDL_reinterpret_cast(type, expression) ((type)(expression)) +#define SDL_static_cast(type, expression) ((type)(expression)) +#define SDL_const_cast(type, expression) ((type)(expression)) +#endif +/* @} *//* Cast operators */ + +/* Define a four character code as a Uint32 */ +#define SDL_FOURCC(A, B, C, D) \ + ((SDL_static_cast(Uint32, SDL_static_cast(Uint8, (A))) << 0) | \ + (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (B))) << 8) | \ + (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (C))) << 16) | \ + (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (D))) << 24)) + +/** + * \name Basic data types + */ +/* @{ */ + +#ifdef __CC_ARM +/* ARM's compiler throws warnings if we use an enum: like "SDL_bool x = a < b;" */ +#define SDL_FALSE 0 +#define SDL_TRUE 1 +typedef int SDL_bool; +#else +typedef enum +{ + SDL_FALSE = 0, + SDL_TRUE = 1 +} SDL_bool; +#endif + +/** + * \brief A signed 8-bit integer type. + */ +#define SDL_MAX_SINT8 ((Sint8)0x7F) /* 127 */ +#define SDL_MIN_SINT8 ((Sint8)(~0x7F)) /* -128 */ +typedef int8_t Sint8; +/** + * \brief An unsigned 8-bit integer type. + */ +#define SDL_MAX_UINT8 ((Uint8)0xFF) /* 255 */ +#define SDL_MIN_UINT8 ((Uint8)0x00) /* 0 */ +typedef uint8_t Uint8; +/** + * \brief A signed 16-bit integer type. + */ +#define SDL_MAX_SINT16 ((Sint16)0x7FFF) /* 32767 */ +#define SDL_MIN_SINT16 ((Sint16)(~0x7FFF)) /* -32768 */ +typedef int16_t Sint16; +/** + * \brief An unsigned 16-bit integer type. + */ +#define SDL_MAX_UINT16 ((Uint16)0xFFFF) /* 65535 */ +#define SDL_MIN_UINT16 ((Uint16)0x0000) /* 0 */ +typedef uint16_t Uint16; +/** + * \brief A signed 32-bit integer type. + */ +#define SDL_MAX_SINT32 ((Sint32)0x7FFFFFFF) /* 2147483647 */ +#define SDL_MIN_SINT32 ((Sint32)(~0x7FFFFFFF)) /* -2147483648 */ +typedef int32_t Sint32; +/** + * \brief An unsigned 32-bit integer type. + */ +#define SDL_MAX_UINT32 ((Uint32)0xFFFFFFFFu) /* 4294967295 */ +#define SDL_MIN_UINT32 ((Uint32)0x00000000) /* 0 */ +typedef uint32_t Uint32; + +/** + * \brief A signed 64-bit integer type. + */ +#define SDL_MAX_SINT64 ((Sint64)0x7FFFFFFFFFFFFFFFll) /* 9223372036854775807 */ +#define SDL_MIN_SINT64 ((Sint64)(~0x7FFFFFFFFFFFFFFFll)) /* -9223372036854775808 */ +typedef int64_t Sint64; +/** + * \brief An unsigned 64-bit integer type. + */ +#define SDL_MAX_UINT64 ((Uint64)0xFFFFFFFFFFFFFFFFull) /* 18446744073709551615 */ +#define SDL_MIN_UINT64 ((Uint64)(0x0000000000000000ull)) /* 0 */ +typedef uint64_t Uint64; + +/* @} *//* Basic data types */ + +/* Make sure we have macros for printing 64 bit values. + * should define these but this is not true all platforms. + * (for example win32) */ +#ifndef SDL_PRIs64 +#ifdef PRIs64 +#define SDL_PRIs64 PRIs64 +#elif defined(__WIN32__) +#define SDL_PRIs64 "I64d" +#elif defined(__LINUX__) && defined(__LP64__) +#define SDL_PRIs64 "ld" +#else +#define SDL_PRIs64 "lld" +#endif +#endif +#ifndef SDL_PRIu64 +#ifdef PRIu64 +#define SDL_PRIu64 PRIu64 +#elif defined(__WIN32__) +#define SDL_PRIu64 "I64u" +#elif defined(__LINUX__) && defined(__LP64__) +#define SDL_PRIu64 "lu" +#else +#define SDL_PRIu64 "llu" +#endif +#endif +#ifndef SDL_PRIx64 +#ifdef PRIx64 +#define SDL_PRIx64 PRIx64 +#elif defined(__WIN32__) +#define SDL_PRIx64 "I64x" +#elif defined(__LINUX__) && defined(__LP64__) +#define SDL_PRIx64 "lx" +#else +#define SDL_PRIx64 "llx" +#endif +#endif +#ifndef SDL_PRIX64 +#ifdef PRIX64 +#define SDL_PRIX64 PRIX64 +#elif defined(__WIN32__) +#define SDL_PRIX64 "I64X" +#elif defined(__LINUX__) && defined(__LP64__) +#define SDL_PRIX64 "lX" +#else +#define SDL_PRIX64 "llX" +#endif +#endif + +/* Annotations to help code analysis tools */ +#ifdef SDL_DISABLE_ANALYZE_MACROS +#define SDL_IN_BYTECAP(x) +#define SDL_INOUT_Z_CAP(x) +#define SDL_OUT_Z_CAP(x) +#define SDL_OUT_CAP(x) +#define SDL_OUT_BYTECAP(x) +#define SDL_OUT_Z_BYTECAP(x) +#define SDL_PRINTF_FORMAT_STRING +#define SDL_SCANF_FORMAT_STRING +#define SDL_PRINTF_VARARG_FUNC( fmtargnumber ) +#define SDL_SCANF_VARARG_FUNC( fmtargnumber ) +#else +#if defined(_MSC_VER) && (_MSC_VER >= 1600) /* VS 2010 and above */ +#include + +#define SDL_IN_BYTECAP(x) _In_bytecount_(x) +#define SDL_INOUT_Z_CAP(x) _Inout_z_cap_(x) +#define SDL_OUT_Z_CAP(x) _Out_z_cap_(x) +#define SDL_OUT_CAP(x) _Out_cap_(x) +#define SDL_OUT_BYTECAP(x) _Out_bytecap_(x) +#define SDL_OUT_Z_BYTECAP(x) _Out_z_bytecap_(x) + +#define SDL_PRINTF_FORMAT_STRING _Printf_format_string_ +#define SDL_SCANF_FORMAT_STRING _Scanf_format_string_impl_ +#else +#define SDL_IN_BYTECAP(x) +#define SDL_INOUT_Z_CAP(x) +#define SDL_OUT_Z_CAP(x) +#define SDL_OUT_CAP(x) +#define SDL_OUT_BYTECAP(x) +#define SDL_OUT_Z_BYTECAP(x) +#define SDL_PRINTF_FORMAT_STRING +#define SDL_SCANF_FORMAT_STRING +#endif +#if defined(__GNUC__) +#define SDL_PRINTF_VARARG_FUNC( fmtargnumber ) __attribute__ (( format( __printf__, fmtargnumber, fmtargnumber+1 ))) +#define SDL_SCANF_VARARG_FUNC( fmtargnumber ) __attribute__ (( format( __scanf__, fmtargnumber, fmtargnumber+1 ))) +#else +#define SDL_PRINTF_VARARG_FUNC( fmtargnumber ) +#define SDL_SCANF_VARARG_FUNC( fmtargnumber ) +#endif +#endif /* SDL_DISABLE_ANALYZE_MACROS */ + +#define SDL_COMPILE_TIME_ASSERT(name, x) \ + typedef int SDL_compile_time_assert_ ## name[(x) * 2 - 1] +/** \cond */ +#ifndef DOXYGEN_SHOULD_IGNORE_THIS +SDL_COMPILE_TIME_ASSERT(uint8, sizeof(Uint8) == 1); +SDL_COMPILE_TIME_ASSERT(sint8, sizeof(Sint8) == 1); +SDL_COMPILE_TIME_ASSERT(uint16, sizeof(Uint16) == 2); +SDL_COMPILE_TIME_ASSERT(sint16, sizeof(Sint16) == 2); +SDL_COMPILE_TIME_ASSERT(uint32, sizeof(Uint32) == 4); +SDL_COMPILE_TIME_ASSERT(sint32, sizeof(Sint32) == 4); +SDL_COMPILE_TIME_ASSERT(uint64, sizeof(Uint64) == 8); +SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8); +#endif /* DOXYGEN_SHOULD_IGNORE_THIS */ +/** \endcond */ + +/* Check to make sure enums are the size of ints, for structure packing. + For both Watcom C/C++ and Borland C/C++ the compiler option that makes + enums having the size of an int must be enabled. + This is "-b" for Borland C/C++ and "-ei" for Watcom C/C++ (v11). +*/ + +/** \cond */ +#ifndef DOXYGEN_SHOULD_IGNORE_THIS +#if !defined(__ANDROID__) + /* TODO: include/SDL_stdinc.h:174: error: size of array 'SDL_dummy_enum' is negative */ +typedef enum +{ + DUMMY_ENUM_VALUE +} SDL_DUMMY_ENUM; + +SDL_COMPILE_TIME_ASSERT(enum, sizeof(SDL_DUMMY_ENUM) == sizeof(int)); +#endif +#endif /* DOXYGEN_SHOULD_IGNORE_THIS */ +/** \endcond */ + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef HAVE_ALLOCA +#define SDL_stack_alloc(type, count) (type*)alloca(sizeof(type)*(count)) +#define SDL_stack_free(data) +#else +#define SDL_stack_alloc(type, count) (type*)SDL_malloc(sizeof(type)*(count)) +#define SDL_stack_free(data) SDL_free(data) +#endif + +extern DECLSPEC void *SDLCALL SDL_malloc(size_t size); +extern DECLSPEC void *SDLCALL SDL_calloc(size_t nmemb, size_t size); +extern DECLSPEC void *SDLCALL SDL_realloc(void *mem, size_t size); +extern DECLSPEC void SDLCALL SDL_free(void *mem); + +typedef void *(SDLCALL *SDL_malloc_func)(size_t size); +typedef void *(SDLCALL *SDL_calloc_func)(size_t nmemb, size_t size); +typedef void *(SDLCALL *SDL_realloc_func)(void *mem, size_t size); +typedef void (SDLCALL *SDL_free_func)(void *mem); + +/** + * \brief Get the current set of SDL memory functions + */ +extern DECLSPEC void SDLCALL SDL_GetMemoryFunctions(SDL_malloc_func *malloc_func, + SDL_calloc_func *calloc_func, + SDL_realloc_func *realloc_func, + SDL_free_func *free_func); + +/** + * \brief Replace SDL's memory allocation functions with a custom set + * + * \note If you are replacing SDL's memory functions, you should call + * SDL_GetNumAllocations() and be very careful if it returns non-zero. + * That means that your free function will be called with memory + * allocated by the previous memory allocation functions. + */ +extern DECLSPEC int SDLCALL SDL_SetMemoryFunctions(SDL_malloc_func malloc_func, + SDL_calloc_func calloc_func, + SDL_realloc_func realloc_func, + SDL_free_func free_func); + +/** + * \brief Get the number of outstanding (unfreed) allocations + */ +extern DECLSPEC int SDLCALL SDL_GetNumAllocations(void); + +extern DECLSPEC char *SDLCALL SDL_getenv(const char *name); +extern DECLSPEC int SDLCALL SDL_setenv(const char *name, const char *value, int overwrite); + +extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size, int (*compare) (const void *, const void *)); + +extern DECLSPEC int SDLCALL SDL_abs(int x); + +/* !!! FIXME: these have side effects. You probably shouldn't use them. */ +/* !!! FIXME: Maybe we do forceinline functions of SDL_mini, SDL_minf, etc? */ +#define SDL_min(x, y) (((x) < (y)) ? (x) : (y)) +#define SDL_max(x, y) (((x) > (y)) ? (x) : (y)) + +extern DECLSPEC int SDLCALL SDL_isdigit(int x); +extern DECLSPEC int SDLCALL SDL_isspace(int x); +extern DECLSPEC int SDLCALL SDL_isupper(int x); +extern DECLSPEC int SDLCALL SDL_islower(int x); +extern DECLSPEC int SDLCALL SDL_toupper(int x); +extern DECLSPEC int SDLCALL SDL_tolower(int x); + +extern DECLSPEC Uint32 SDLCALL SDL_crc32(Uint32 crc, const void *data, size_t len); + +extern DECLSPEC void *SDLCALL SDL_memset(SDL_OUT_BYTECAP(len) void *dst, int c, size_t len); + +#define SDL_zero(x) SDL_memset(&(x), 0, sizeof((x))) +#define SDL_zerop(x) SDL_memset((x), 0, sizeof(*(x))) +#define SDL_zeroa(x) SDL_memset((x), 0, sizeof((x))) + +/* Note that memset() is a byte assignment and this is a 32-bit assignment, so they're not directly equivalent. */ +SDL_FORCE_INLINE void SDL_memset4(void *dst, Uint32 val, size_t dwords) +{ +#ifdef __APPLE__ + memset_pattern4(dst, &val, dwords * 4); +#elif defined(__GNUC__) && defined(i386) + int u0, u1, u2; + __asm__ __volatile__ ( + "cld \n\t" + "rep ; stosl \n\t" + : "=&D" (u0), "=&a" (u1), "=&c" (u2) + : "0" (dst), "1" (val), "2" (SDL_static_cast(Uint32, dwords)) + : "memory" + ); +#else + size_t _n = (dwords + 3) / 4; + Uint32 *_p = SDL_static_cast(Uint32 *, dst); + Uint32 _val = (val); + if (dwords == 0) + return; + switch (dwords % 4) + { + case 0: do { *_p++ = _val; /* fallthrough */ + case 3: *_p++ = _val; /* fallthrough */ + case 2: *_p++ = _val; /* fallthrough */ + case 1: *_p++ = _val; /* fallthrough */ + } while ( --_n ); + } +#endif +} + +extern DECLSPEC void *SDLCALL SDL_memcpy(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len); + +extern DECLSPEC void *SDLCALL SDL_memmove(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len); +extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t len); + +extern DECLSPEC size_t SDLCALL SDL_wcslen(const wchar_t *wstr); +extern DECLSPEC size_t SDLCALL SDL_wcslcpy(SDL_OUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen); +extern DECLSPEC size_t SDLCALL SDL_wcslcat(SDL_INOUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen); +extern DECLSPEC wchar_t *SDLCALL SDL_wcsdup(const wchar_t *wstr); +extern DECLSPEC wchar_t *SDLCALL SDL_wcsstr(const wchar_t *haystack, const wchar_t *needle); + +extern DECLSPEC int SDLCALL SDL_wcscmp(const wchar_t *str1, const wchar_t *str2); +extern DECLSPEC int SDLCALL SDL_wcsncmp(const wchar_t *str1, const wchar_t *str2, size_t maxlen); +extern DECLSPEC int SDLCALL SDL_wcscasecmp(const wchar_t *str1, const wchar_t *str2); +extern DECLSPEC int SDLCALL SDL_wcsncasecmp(const wchar_t *str1, const wchar_t *str2, size_t len); + +extern DECLSPEC size_t SDLCALL SDL_strlen(const char *str); +extern DECLSPEC size_t SDLCALL SDL_strlcpy(SDL_OUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen); +extern DECLSPEC size_t SDLCALL SDL_utf8strlcpy(SDL_OUT_Z_CAP(dst_bytes) char *dst, const char *src, size_t dst_bytes); +extern DECLSPEC size_t SDLCALL SDL_strlcat(SDL_INOUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen); +extern DECLSPEC char *SDLCALL SDL_strdup(const char *str); +extern DECLSPEC char *SDLCALL SDL_strrev(char *str); +extern DECLSPEC char *SDLCALL SDL_strupr(char *str); +extern DECLSPEC char *SDLCALL SDL_strlwr(char *str); +extern DECLSPEC char *SDLCALL SDL_strchr(const char *str, int c); +extern DECLSPEC char *SDLCALL SDL_strrchr(const char *str, int c); +extern DECLSPEC char *SDLCALL SDL_strstr(const char *haystack, const char *needle); +extern DECLSPEC char *SDLCALL SDL_strtokr(char *s1, const char *s2, char **saveptr); +extern DECLSPEC size_t SDLCALL SDL_utf8strlen(const char *str); + +extern DECLSPEC char *SDLCALL SDL_itoa(int value, char *str, int radix); +extern DECLSPEC char *SDLCALL SDL_uitoa(unsigned int value, char *str, int radix); +extern DECLSPEC char *SDLCALL SDL_ltoa(long value, char *str, int radix); +extern DECLSPEC char *SDLCALL SDL_ultoa(unsigned long value, char *str, int radix); +extern DECLSPEC char *SDLCALL SDL_lltoa(Sint64 value, char *str, int radix); +extern DECLSPEC char *SDLCALL SDL_ulltoa(Uint64 value, char *str, int radix); + +extern DECLSPEC int SDLCALL SDL_atoi(const char *str); +extern DECLSPEC double SDLCALL SDL_atof(const char *str); +extern DECLSPEC long SDLCALL SDL_strtol(const char *str, char **endp, int base); +extern DECLSPEC unsigned long SDLCALL SDL_strtoul(const char *str, char **endp, int base); +extern DECLSPEC Sint64 SDLCALL SDL_strtoll(const char *str, char **endp, int base); +extern DECLSPEC Uint64 SDLCALL SDL_strtoull(const char *str, char **endp, int base); +extern DECLSPEC double SDLCALL SDL_strtod(const char *str, char **endp); + +extern DECLSPEC int SDLCALL SDL_strcmp(const char *str1, const char *str2); +extern DECLSPEC int SDLCALL SDL_strncmp(const char *str1, const char *str2, size_t maxlen); +extern DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1, const char *str2); +extern DECLSPEC int SDLCALL SDL_strncasecmp(const char *str1, const char *str2, size_t len); + +extern DECLSPEC int SDLCALL SDL_sscanf(const char *text, SDL_SCANF_FORMAT_STRING const char *fmt, ...) SDL_SCANF_VARARG_FUNC(2); +extern DECLSPEC int SDLCALL SDL_vsscanf(const char *text, const char *fmt, va_list ap); +extern DECLSPEC int SDLCALL SDL_snprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, SDL_PRINTF_FORMAT_STRING const char *fmt, ... ) SDL_PRINTF_VARARG_FUNC(3); +extern DECLSPEC int SDLCALL SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, const char *fmt, va_list ap); + +#ifndef HAVE_M_PI +#ifndef M_PI +#define M_PI 3.14159265358979323846264338327950288 /**< pi */ +#endif +#endif + +extern DECLSPEC double SDLCALL SDL_acos(double x); +extern DECLSPEC float SDLCALL SDL_acosf(float x); +extern DECLSPEC double SDLCALL SDL_asin(double x); +extern DECLSPEC float SDLCALL SDL_asinf(float x); +extern DECLSPEC double SDLCALL SDL_atan(double x); +extern DECLSPEC float SDLCALL SDL_atanf(float x); +extern DECLSPEC double SDLCALL SDL_atan2(double x, double y); +extern DECLSPEC float SDLCALL SDL_atan2f(float x, float y); +extern DECLSPEC double SDLCALL SDL_ceil(double x); +extern DECLSPEC float SDLCALL SDL_ceilf(float x); +extern DECLSPEC double SDLCALL SDL_copysign(double x, double y); +extern DECLSPEC float SDLCALL SDL_copysignf(float x, float y); +extern DECLSPEC double SDLCALL SDL_cos(double x); +extern DECLSPEC float SDLCALL SDL_cosf(float x); +extern DECLSPEC double SDLCALL SDL_exp(double x); +extern DECLSPEC float SDLCALL SDL_expf(float x); +extern DECLSPEC double SDLCALL SDL_fabs(double x); +extern DECLSPEC float SDLCALL SDL_fabsf(float x); +extern DECLSPEC double SDLCALL SDL_floor(double x); +extern DECLSPEC float SDLCALL SDL_floorf(float x); +extern DECLSPEC double SDLCALL SDL_trunc(double x); +extern DECLSPEC float SDLCALL SDL_truncf(float x); +extern DECLSPEC double SDLCALL SDL_fmod(double x, double y); +extern DECLSPEC float SDLCALL SDL_fmodf(float x, float y); +extern DECLSPEC double SDLCALL SDL_log(double x); +extern DECLSPEC float SDLCALL SDL_logf(float x); +extern DECLSPEC double SDLCALL SDL_log10(double x); +extern DECLSPEC float SDLCALL SDL_log10f(float x); +extern DECLSPEC double SDLCALL SDL_pow(double x, double y); +extern DECLSPEC float SDLCALL SDL_powf(float x, float y); +extern DECLSPEC double SDLCALL SDL_scalbn(double x, int n); +extern DECLSPEC float SDLCALL SDL_scalbnf(float x, int n); +extern DECLSPEC double SDLCALL SDL_sin(double x); +extern DECLSPEC float SDLCALL SDL_sinf(float x); +extern DECLSPEC double SDLCALL SDL_sqrt(double x); +extern DECLSPEC float SDLCALL SDL_sqrtf(float x); +extern DECLSPEC double SDLCALL SDL_tan(double x); +extern DECLSPEC float SDLCALL SDL_tanf(float x); + +/* The SDL implementation of iconv() returns these error codes */ +#define SDL_ICONV_ERROR (size_t)-1 +#define SDL_ICONV_E2BIG (size_t)-2 +#define SDL_ICONV_EILSEQ (size_t)-3 +#define SDL_ICONV_EINVAL (size_t)-4 + +/* SDL_iconv_* are now always real symbols/types, not macros or inlined. */ +typedef struct _SDL_iconv_t *SDL_iconv_t; +extern DECLSPEC SDL_iconv_t SDLCALL SDL_iconv_open(const char *tocode, + const char *fromcode); +extern DECLSPEC int SDLCALL SDL_iconv_close(SDL_iconv_t cd); +extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, const char **inbuf, + size_t * inbytesleft, char **outbuf, + size_t * outbytesleft); +/** + * This function converts a string between encodings in one pass, returning a + * string that must be freed with SDL_free() or NULL on error. + */ +extern DECLSPEC char *SDLCALL SDL_iconv_string(const char *tocode, + const char *fromcode, + const char *inbuf, + size_t inbytesleft); +#define SDL_iconv_utf8_locale(S) SDL_iconv_string("", "UTF-8", S, SDL_strlen(S)+1) +#define SDL_iconv_utf8_ucs2(S) (Uint16 *)SDL_iconv_string("UCS-2-INTERNAL", "UTF-8", S, SDL_strlen(S)+1) +#define SDL_iconv_utf8_ucs4(S) (Uint32 *)SDL_iconv_string("UCS-4-INTERNAL", "UTF-8", S, SDL_strlen(S)+1) + +/* force builds using Clang's static analysis tools to use literal C runtime + here, since there are possibly tests that are ineffective otherwise. */ +#if defined(__clang_analyzer__) && !defined(SDL_DISABLE_ANALYZE_MACROS) + +/* The analyzer knows about strlcpy even when the system doesn't provide it */ +#ifndef HAVE_STRLCPY +size_t strlcpy(char* dst, const char* src, size_t size); +#endif + +/* The analyzer knows about strlcat even when the system doesn't provide it */ +#ifndef HAVE_STRLCAT +size_t strlcat(char* dst, const char* src, size_t size); +#endif + +#define SDL_malloc malloc +#define SDL_calloc calloc +#define SDL_realloc realloc +#define SDL_free free +#define SDL_memset memset +#define SDL_memcpy memcpy +#define SDL_memmove memmove +#define SDL_memcmp memcmp +#define SDL_strlcpy strlcpy +#define SDL_strlcat strlcat +#define SDL_strlen strlen +#define SDL_wcslen wcslen +#define SDL_wcslcpy wcslcpy +#define SDL_wcslcat wcslcat +#define SDL_strdup strdup +#define SDL_wcsdup wcsdup +#define SDL_strchr strchr +#define SDL_strrchr strrchr +#define SDL_strstr strstr +#define SDL_wcsstr wcsstr +#define SDL_strtokr strtok_r +#define SDL_strcmp strcmp +#define SDL_wcscmp wcscmp +#define SDL_strncmp strncmp +#define SDL_wcsncmp wcsncmp +#define SDL_strcasecmp strcasecmp +#define SDL_strncasecmp strncasecmp +#define SDL_sscanf sscanf +#define SDL_vsscanf vsscanf +#define SDL_snprintf snprintf +#define SDL_vsnprintf vsnprintf +#endif + +SDL_FORCE_INLINE void *SDL_memcpy4(SDL_OUT_BYTECAP(dwords*4) void *dst, SDL_IN_BYTECAP(dwords*4) const void *src, size_t dwords) +{ + return SDL_memcpy(dst, src, dwords * 4); +} + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_stdinc_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_surface.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_surface.h new file mode 100644 index 0000000..d3f8c81 --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_surface.h @@ -0,0 +1,563 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_surface.h + * + * Header file for ::SDL_Surface definition and management functions. + */ + +#ifndef SDL_surface_h_ +#define SDL_surface_h_ + +#include "SDL_stdinc.h" +#include "SDL_pixels.h" +#include "SDL_rect.h" +#include "SDL_blendmode.h" +#include "SDL_rwops.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \name Surface flags + * + * These are the currently supported flags for the ::SDL_Surface. + * + * \internal + * Used internally (read-only). + */ +/* @{ */ +#define SDL_SWSURFACE 0 /**< Just here for compatibility */ +#define SDL_PREALLOC 0x00000001 /**< Surface uses preallocated memory */ +#define SDL_RLEACCEL 0x00000002 /**< Surface is RLE encoded */ +#define SDL_DONTFREE 0x00000004 /**< Surface is referenced internally */ +#define SDL_SIMD_ALIGNED 0x00000008 /**< Surface uses aligned memory */ +/* @} *//* Surface flags */ + +/** + * Evaluates to true if the surface needs to be locked before access. + */ +#define SDL_MUSTLOCK(S) (((S)->flags & SDL_RLEACCEL) != 0) + +/** + * \brief A collection of pixels used in software blitting. + * + * \note This structure should be treated as read-only, except for \c pixels, + * which, if not NULL, contains the raw pixel data for the surface. + */ +typedef struct SDL_Surface +{ + Uint32 flags; /**< Read-only */ + SDL_PixelFormat *format; /**< Read-only */ + int w, h; /**< Read-only */ + int pitch; /**< Read-only */ + void *pixels; /**< Read-write */ + + /** Application data associated with the surface */ + void *userdata; /**< Read-write */ + + /** information needed for surfaces requiring locks */ + int locked; /**< Read-only */ + + /** list of BlitMap that hold a reference to this surface */ + void *list_blitmap; /**< Private */ + + /** clipping information */ + SDL_Rect clip_rect; /**< Read-only */ + + /** info for fast blit mapping to other surfaces */ + struct SDL_BlitMap *map; /**< Private */ + + /** Reference count -- used when freeing surface */ + int refcount; /**< Read-mostly */ +} SDL_Surface; + +/** + * \brief The type of function used for surface blitting functions. + */ +typedef int (SDLCALL *SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect, + struct SDL_Surface * dst, SDL_Rect * dstrect); + +/** + * \brief The formula used for converting between YUV and RGB + */ +typedef enum +{ + SDL_YUV_CONVERSION_JPEG, /**< Full range JPEG */ + SDL_YUV_CONVERSION_BT601, /**< BT.601 (the default) */ + SDL_YUV_CONVERSION_BT709, /**< BT.709 */ + SDL_YUV_CONVERSION_AUTOMATIC /**< BT.601 for SD content, BT.709 for HD content */ +} SDL_YUV_CONVERSION_MODE; + +/** + * Allocate and free an RGB surface. + * + * If the depth is 4 or 8 bits, an empty palette is allocated for the surface. + * If the depth is greater than 8 bits, the pixel format is set using the + * flags '[RGB]mask'. + * + * If the function runs out of memory, it will return NULL. + * + * \param flags The \c flags are obsolete and should be set to 0. + * \param width The width in pixels of the surface to create. + * \param height The height in pixels of the surface to create. + * \param depth The depth in bits of the surface to create. + * \param Rmask The red mask of the surface to create. + * \param Gmask The green mask of the surface to create. + * \param Bmask The blue mask of the surface to create. + * \param Amask The alpha mask of the surface to create. + */ +extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurface + (Uint32 flags, int width, int height, int depth, + Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask); + +/* !!! FIXME for 2.1: why does this ask for depth? Format provides that. */ +extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceWithFormat + (Uint32 flags, int width, int height, int depth, Uint32 format); + +extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels, + int width, + int height, + int depth, + int pitch, + Uint32 Rmask, + Uint32 Gmask, + Uint32 Bmask, + Uint32 Amask); +extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceWithFormatFrom + (void *pixels, int width, int height, int depth, int pitch, Uint32 format); +extern DECLSPEC void SDLCALL SDL_FreeSurface(SDL_Surface * surface); + +/** + * \brief Set the palette used by a surface. + * + * \return 0, or -1 if the surface format doesn't use a palette. + * + * \note A single palette can be shared with many surfaces. + */ +extern DECLSPEC int SDLCALL SDL_SetSurfacePalette(SDL_Surface * surface, + SDL_Palette * palette); + +/** + * \brief Sets up a surface for directly accessing the pixels. + * + * Between calls to SDL_LockSurface() / SDL_UnlockSurface(), you can write + * to and read from \c surface->pixels, using the pixel format stored in + * \c surface->format. Once you are done accessing the surface, you should + * use SDL_UnlockSurface() to release it. + * + * Not all surfaces require locking. If SDL_MUSTLOCK(surface) evaluates + * to 0, then you can read and write to the surface at any time, and the + * pixel format of the surface will not change. + * + * No operating system or library calls should be made between lock/unlock + * pairs, as critical system locks may be held during this time. + * + * SDL_LockSurface() returns 0, or -1 if the surface couldn't be locked. + * + * \sa SDL_UnlockSurface() + */ +extern DECLSPEC int SDLCALL SDL_LockSurface(SDL_Surface * surface); +/** \sa SDL_LockSurface() */ +extern DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface * surface); + +/** + * Load a surface from a seekable SDL data stream (memory or file). + * + * If \c freesrc is non-zero, the stream will be closed after being read. + * + * The new surface should be freed with SDL_FreeSurface(). + * + * \return the new surface, or NULL if there was an error. + */ +extern DECLSPEC SDL_Surface *SDLCALL SDL_LoadBMP_RW(SDL_RWops * src, + int freesrc); + +/** + * Load a surface from a file. + * + * Convenience macro. + */ +#define SDL_LoadBMP(file) SDL_LoadBMP_RW(SDL_RWFromFile(file, "rb"), 1) + +/** + * Save a surface to a seekable SDL data stream (memory or file). + * + * Surfaces with a 24-bit, 32-bit and paletted 8-bit format get saved in the + * BMP directly. Other RGB formats with 8-bit or higher get converted to a + * 24-bit surface or, if they have an alpha mask or a colorkey, to a 32-bit + * surface before they are saved. YUV and paletted 1-bit and 4-bit formats are + * not supported. + * + * If \c freedst is non-zero, the stream will be closed after being written. + * + * \return 0 if successful or -1 if there was an error. + */ +extern DECLSPEC int SDLCALL SDL_SaveBMP_RW + (SDL_Surface * surface, SDL_RWops * dst, int freedst); + +/** + * Save a surface to a file. + * + * Convenience macro. + */ +#define SDL_SaveBMP(surface, file) \ + SDL_SaveBMP_RW(surface, SDL_RWFromFile(file, "wb"), 1) + +/** + * \brief Sets the RLE acceleration hint for a surface. + * + * \return 0 on success, or -1 if the surface is not valid + * + * \note If RLE is enabled, colorkey and alpha blending blits are much faster, + * but the surface must be locked before directly accessing the pixels. + */ +extern DECLSPEC int SDLCALL SDL_SetSurfaceRLE(SDL_Surface * surface, + int flag); + +/** + * \brief Returns whether the surface is RLE enabled + * + * \return SDL_TRUE if the surface is RLE enabled, or SDL_FALSE if the surface is NULL or not RLE enabled + */ +extern DECLSPEC SDL_bool SDLCALL SDL_HasSurfaceRLE(SDL_Surface * surface); + +/** + * \brief Sets the color key (transparent pixel) in a blittable surface. + * + * \param surface The surface to update + * \param flag Non-zero to enable colorkey and 0 to disable colorkey + * \param key The transparent pixel in the native surface format + * + * \return 0 on success, or -1 if the surface is not valid + * + * You can pass SDL_RLEACCEL to enable RLE accelerated blits. + */ +extern DECLSPEC int SDLCALL SDL_SetColorKey(SDL_Surface * surface, + int flag, Uint32 key); + +/** + * \brief Returns whether the surface has a color key + * + * \return SDL_TRUE if the surface has a color key, or SDL_FALSE if the surface is NULL or has no color key + */ +extern DECLSPEC SDL_bool SDLCALL SDL_HasColorKey(SDL_Surface * surface); + +/** + * \brief Gets the color key (transparent pixel) in a blittable surface. + * + * \param surface The surface to update + * \param key A pointer filled in with the transparent pixel in the native + * surface format + * + * \return 0 on success, or -1 if the surface is not valid or colorkey is not + * enabled. + */ +extern DECLSPEC int SDLCALL SDL_GetColorKey(SDL_Surface * surface, + Uint32 * key); + +/** + * \brief Set an additional color value used in blit operations. + * + * \param surface The surface to update. + * \param r The red color value multiplied into blit operations. + * \param g The green color value multiplied into blit operations. + * \param b The blue color value multiplied into blit operations. + * + * \return 0 on success, or -1 if the surface is not valid. + * + * \sa SDL_GetSurfaceColorMod() + */ +extern DECLSPEC int SDLCALL SDL_SetSurfaceColorMod(SDL_Surface * surface, + Uint8 r, Uint8 g, Uint8 b); + + +/** + * \brief Get the additional color value used in blit operations. + * + * \param surface The surface to query. + * \param r A pointer filled in with the current red color value. + * \param g A pointer filled in with the current green color value. + * \param b A pointer filled in with the current blue color value. + * + * \return 0 on success, or -1 if the surface is not valid. + * + * \sa SDL_SetSurfaceColorMod() + */ +extern DECLSPEC int SDLCALL SDL_GetSurfaceColorMod(SDL_Surface * surface, + Uint8 * r, Uint8 * g, + Uint8 * b); + +/** + * \brief Set an additional alpha value used in blit operations. + * + * \param surface The surface to update. + * \param alpha The alpha value multiplied into blit operations. + * + * \return 0 on success, or -1 if the surface is not valid. + * + * \sa SDL_GetSurfaceAlphaMod() + */ +extern DECLSPEC int SDLCALL SDL_SetSurfaceAlphaMod(SDL_Surface * surface, + Uint8 alpha); + +/** + * \brief Get the additional alpha value used in blit operations. + * + * \param surface The surface to query. + * \param alpha A pointer filled in with the current alpha value. + * + * \return 0 on success, or -1 if the surface is not valid. + * + * \sa SDL_SetSurfaceAlphaMod() + */ +extern DECLSPEC int SDLCALL SDL_GetSurfaceAlphaMod(SDL_Surface * surface, + Uint8 * alpha); + +/** + * \brief Set the blend mode used for blit operations. + * + * \param surface The surface to update. + * \param blendMode ::SDL_BlendMode to use for blit blending. + * + * \return 0 on success, or -1 if the parameters are not valid. + * + * \sa SDL_GetSurfaceBlendMode() + */ +extern DECLSPEC int SDLCALL SDL_SetSurfaceBlendMode(SDL_Surface * surface, + SDL_BlendMode blendMode); + +/** + * \brief Get the blend mode used for blit operations. + * + * \param surface The surface to query. + * \param blendMode A pointer filled in with the current blend mode. + * + * \return 0 on success, or -1 if the surface is not valid. + * + * \sa SDL_SetSurfaceBlendMode() + */ +extern DECLSPEC int SDLCALL SDL_GetSurfaceBlendMode(SDL_Surface * surface, + SDL_BlendMode *blendMode); + +/** + * Sets the clipping rectangle for the destination surface in a blit. + * + * If the clip rectangle is NULL, clipping will be disabled. + * + * If the clip rectangle doesn't intersect the surface, the function will + * return SDL_FALSE and blits will be completely clipped. Otherwise the + * function returns SDL_TRUE and blits to the surface will be clipped to + * the intersection of the surface area and the clipping rectangle. + * + * Note that blits are automatically clipped to the edges of the source + * and destination surfaces. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_SetClipRect(SDL_Surface * surface, + const SDL_Rect * rect); + +/** + * Gets the clipping rectangle for the destination surface in a blit. + * + * \c rect must be a pointer to a valid rectangle which will be filled + * with the correct values. + */ +extern DECLSPEC void SDLCALL SDL_GetClipRect(SDL_Surface * surface, + SDL_Rect * rect); + +/* + * Creates a new surface identical to the existing surface + */ +extern DECLSPEC SDL_Surface *SDLCALL SDL_DuplicateSurface(SDL_Surface * surface); + +/** + * Creates a new surface of the specified format, and then copies and maps + * the given surface to it so the blit of the converted surface will be as + * fast as possible. If this function fails, it returns NULL. + * + * The \c flags parameter is passed to SDL_CreateRGBSurface() and has those + * semantics. You can also pass ::SDL_RLEACCEL in the flags parameter and + * SDL will try to RLE accelerate colorkey and alpha blits in the resulting + * surface. + */ +extern DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurface + (SDL_Surface * src, const SDL_PixelFormat * fmt, Uint32 flags); +extern DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurfaceFormat + (SDL_Surface * src, Uint32 pixel_format, Uint32 flags); + +/** + * \brief Copy a block of pixels of one format to another format + * + * \return 0 on success, or -1 if there was an error + */ +extern DECLSPEC int SDLCALL SDL_ConvertPixels(int width, int height, + Uint32 src_format, + const void * src, int src_pitch, + Uint32 dst_format, + void * dst, int dst_pitch); + +/** + * Performs a fast fill of the given rectangle with \c color. + * + * If \c rect is NULL, the whole surface will be filled with \c color. + * + * The color should be a pixel of the format used by the surface, and + * can be generated by the SDL_MapRGB() function. + * + * \return 0 on success, or -1 on error. + */ +extern DECLSPEC int SDLCALL SDL_FillRect + (SDL_Surface * dst, const SDL_Rect * rect, Uint32 color); +extern DECLSPEC int SDLCALL SDL_FillRects + (SDL_Surface * dst, const SDL_Rect * rects, int count, Uint32 color); + +/** + * Performs a fast blit from the source surface to the destination surface. + * + * This assumes that the source and destination rectangles are + * the same size. If either \c srcrect or \c dstrect are NULL, the entire + * surface (\c src or \c dst) is copied. The final blit rectangles are saved + * in \c srcrect and \c dstrect after all clipping is performed. + * + * \return If the blit is successful, it returns 0, otherwise it returns -1. + * + * The blit function should not be called on a locked surface. + * + * The blit semantics for surfaces with and without blending and colorkey + * are defined as follows: + * \verbatim + RGBA->RGB: + Source surface blend mode set to SDL_BLENDMODE_BLEND: + alpha-blend (using the source alpha-channel and per-surface alpha) + SDL_SRCCOLORKEY ignored. + Source surface blend mode set to SDL_BLENDMODE_NONE: + copy RGB. + if SDL_SRCCOLORKEY set, only copy the pixels matching the + RGB values of the source color key, ignoring alpha in the + comparison. + + RGB->RGBA: + Source surface blend mode set to SDL_BLENDMODE_BLEND: + alpha-blend (using the source per-surface alpha) + Source surface blend mode set to SDL_BLENDMODE_NONE: + copy RGB, set destination alpha to source per-surface alpha value. + both: + if SDL_SRCCOLORKEY set, only copy the pixels matching the + source color key. + + RGBA->RGBA: + Source surface blend mode set to SDL_BLENDMODE_BLEND: + alpha-blend (using the source alpha-channel and per-surface alpha) + SDL_SRCCOLORKEY ignored. + Source surface blend mode set to SDL_BLENDMODE_NONE: + copy all of RGBA to the destination. + if SDL_SRCCOLORKEY set, only copy the pixels matching the + RGB values of the source color key, ignoring alpha in the + comparison. + + RGB->RGB: + Source surface blend mode set to SDL_BLENDMODE_BLEND: + alpha-blend (using the source per-surface alpha) + Source surface blend mode set to SDL_BLENDMODE_NONE: + copy RGB. + both: + if SDL_SRCCOLORKEY set, only copy the pixels matching the + source color key. + \endverbatim + * + * You should call SDL_BlitSurface() unless you know exactly how SDL + * blitting works internally and how to use the other blit functions. + */ +#define SDL_BlitSurface SDL_UpperBlit + +/** + * This is the public blit function, SDL_BlitSurface(), and it performs + * rectangle validation and clipping before passing it to SDL_LowerBlit() + */ +extern DECLSPEC int SDLCALL SDL_UpperBlit + (SDL_Surface * src, const SDL_Rect * srcrect, + SDL_Surface * dst, SDL_Rect * dstrect); + +/** + * This is a semi-private blit function and it performs low-level surface + * blitting only. + */ +extern DECLSPEC int SDLCALL SDL_LowerBlit + (SDL_Surface * src, SDL_Rect * srcrect, + SDL_Surface * dst, SDL_Rect * dstrect); + +/** + * \brief Perform a fast, low quality, stretch blit between two surfaces of the + * same pixel format. + * + * \note This function uses a static buffer, and is not thread-safe. + */ +extern DECLSPEC int SDLCALL SDL_SoftStretch(SDL_Surface * src, + const SDL_Rect * srcrect, + SDL_Surface * dst, + const SDL_Rect * dstrect); + +#define SDL_BlitScaled SDL_UpperBlitScaled + +/** + * This is the public scaled blit function, SDL_BlitScaled(), and it performs + * rectangle validation and clipping before passing it to SDL_LowerBlitScaled() + */ +extern DECLSPEC int SDLCALL SDL_UpperBlitScaled + (SDL_Surface * src, const SDL_Rect * srcrect, + SDL_Surface * dst, SDL_Rect * dstrect); + +/** + * This is a semi-private blit function and it performs low-level surface + * scaled blitting only. + */ +extern DECLSPEC int SDLCALL SDL_LowerBlitScaled + (SDL_Surface * src, SDL_Rect * srcrect, + SDL_Surface * dst, SDL_Rect * dstrect); + +/** + * \brief Set the YUV conversion mode + */ +extern DECLSPEC void SDLCALL SDL_SetYUVConversionMode(SDL_YUV_CONVERSION_MODE mode); + +/** + * \brief Get the YUV conversion mode + */ +extern DECLSPEC SDL_YUV_CONVERSION_MODE SDLCALL SDL_GetYUVConversionMode(void); + +/** + * \brief Get the YUV conversion mode, returning the correct mode for the resolution when the current conversion mode is SDL_YUV_CONVERSION_AUTOMATIC + */ +extern DECLSPEC SDL_YUV_CONVERSION_MODE SDLCALL SDL_GetYUVConversionModeForResolution(int width, int height); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_surface_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_system.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_system.h new file mode 100644 index 0000000..d296ab1 --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_system.h @@ -0,0 +1,325 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_system.h + * + * Include file for platform specific SDL API functions + */ + +#ifndef SDL_system_h_ +#define SDL_system_h_ + +#include "SDL_stdinc.h" +#include "SDL_keyboard.h" +#include "SDL_render.h" +#include "SDL_video.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + + +/* Platform specific functions for Windows */ +#ifdef __WIN32__ + +/** + \brief Set a function that is called for every windows message, before TranslateMessage() +*/ +typedef void (SDLCALL * SDL_WindowsMessageHook)(void *userdata, void *hWnd, unsigned int message, Uint64 wParam, Sint64 lParam); +extern DECLSPEC void SDLCALL SDL_SetWindowsMessageHook(SDL_WindowsMessageHook callback, void *userdata); + +/** + \brief Returns the D3D9 adapter index that matches the specified display index. + + This adapter index can be passed to IDirect3D9::CreateDevice and controls + on which monitor a full screen application will appear. +*/ +extern DECLSPEC int SDLCALL SDL_Direct3D9GetAdapterIndex( int displayIndex ); + +typedef struct IDirect3DDevice9 IDirect3DDevice9; +/** + \brief Returns the D3D device associated with a renderer, or NULL if it's not a D3D renderer. + + Once you are done using the device, you should release it to avoid a resource leak. + */ +extern DECLSPEC IDirect3DDevice9* SDLCALL SDL_RenderGetD3D9Device(SDL_Renderer * renderer); + +/** + \brief Returns the DXGI Adapter and Output indices for the specified display index. + + These can be passed to EnumAdapters and EnumOutputs respectively to get the objects + required to create a DX10 or DX11 device and swap chain. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_DXGIGetOutputInfo( int displayIndex, int *adapterIndex, int *outputIndex ); + +#endif /* __WIN32__ */ + + +/* Platform specific functions for Linux */ +#ifdef __LINUX__ + +/** + \brief Sets the UNIX nice value for a thread, using setpriority() if possible, and RealtimeKit if available. + + \return 0 on success, or -1 on error. + */ +extern DECLSPEC int SDLCALL SDL_LinuxSetThreadPriority(Sint64 threadID, int priority); + +#endif /* __LINUX__ */ + +/* Platform specific functions for iOS */ +#ifdef __IPHONEOS__ + +#define SDL_iOSSetAnimationCallback(window, interval, callback, callbackParam) SDL_iPhoneSetAnimationCallback(window, interval, callback, callbackParam) +extern DECLSPEC int SDLCALL SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (*callback)(void*), void *callbackParam); + +#define SDL_iOSSetEventPump(enabled) SDL_iPhoneSetEventPump(enabled) +extern DECLSPEC void SDLCALL SDL_iPhoneSetEventPump(SDL_bool enabled); + +#endif /* __IPHONEOS__ */ + + +/* Platform specific functions for Android */ +#ifdef __ANDROID__ + +/** + \brief Get the JNI environment for the current thread + + This returns JNIEnv*, but the prototype is void* so we don't need jni.h + */ +extern DECLSPEC void * SDLCALL SDL_AndroidGetJNIEnv(void); + +/** + \brief Get the SDL Activity object for the application + + This returns jobject, but the prototype is void* so we don't need jni.h + The jobject returned by SDL_AndroidGetActivity is a local reference. + It is the caller's responsibility to properly release it + (using env->Push/PopLocalFrame or manually with env->DeleteLocalRef) + */ +extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity(void); + +/** + \brief Return API level of the current device + + API level 30: Android 11 + API level 29: Android 10 + API level 28: Android 9 + API level 27: Android 8.1 + API level 26: Android 8.0 + API level 25: Android 7.1 + API level 24: Android 7.0 + API level 23: Android 6.0 + API level 22: Android 5.1 + API level 21: Android 5.0 + API level 20: Android 4.4W + API level 19: Android 4.4 + API level 18: Android 4.3 + API level 17: Android 4.2 + API level 16: Android 4.1 + API level 15: Android 4.0.3 + API level 14: Android 4.0 + API level 13: Android 3.2 + API level 12: Android 3.1 + API level 11: Android 3.0 + API level 10: Android 2.3.3 + */ +extern DECLSPEC int SDLCALL SDL_GetAndroidSDKVersion(void); + +/** + \brief Return true if the application is running on Android TV + */ +extern DECLSPEC SDL_bool SDLCALL SDL_IsAndroidTV(void); + +/** + \brief Return true if the application is running on a Chromebook + */ +extern DECLSPEC SDL_bool SDLCALL SDL_IsChromebook(void); + +/** + \brief Return true is the application is running on a Samsung DeX docking station + */ +extern DECLSPEC SDL_bool SDLCALL SDL_IsDeXMode(void); + +/** + \brief Trigger the Android system back button behavior. + */ +extern DECLSPEC void SDLCALL SDL_AndroidBackButton(void); + +/** + See the official Android developer guide for more information: + http://developer.android.com/guide/topics/data/data-storage.html +*/ +#define SDL_ANDROID_EXTERNAL_STORAGE_READ 0x01 +#define SDL_ANDROID_EXTERNAL_STORAGE_WRITE 0x02 + +/** + \brief Get the path used for internal storage for this application. + + This path is unique to your application and cannot be written to + by other applications. + */ +extern DECLSPEC const char * SDLCALL SDL_AndroidGetInternalStoragePath(void); + +/** + \brief Get the current state of external storage, a bitmask of these values: + SDL_ANDROID_EXTERNAL_STORAGE_READ + SDL_ANDROID_EXTERNAL_STORAGE_WRITE + + If external storage is currently unavailable, this will return 0. +*/ +extern DECLSPEC int SDLCALL SDL_AndroidGetExternalStorageState(void); + +/** + \brief Get the path used for external storage for this application. + + This path is unique to your application, but is public and can be + written to by other applications. + */ +extern DECLSPEC const char * SDLCALL SDL_AndroidGetExternalStoragePath(void); + +/** + \brief Request permissions at runtime. + + This blocks the calling thread until the permission is granted or + denied. Returns SDL_TRUE if the permission was granted. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_AndroidRequestPermission(const char *permission); + +#endif /* __ANDROID__ */ + +/* Platform specific functions for WinRT */ +#ifdef __WINRT__ + +/** + * \brief WinRT / Windows Phone path types + */ +typedef enum +{ + /** \brief The installed app's root directory. + Files here are likely to be read-only. */ + SDL_WINRT_PATH_INSTALLED_LOCATION, + + /** \brief The app's local data store. Files may be written here */ + SDL_WINRT_PATH_LOCAL_FOLDER, + + /** \brief The app's roaming data store. Unsupported on Windows Phone. + Files written here may be copied to other machines via a network + connection. + */ + SDL_WINRT_PATH_ROAMING_FOLDER, + + /** \brief The app's temporary data store. Unsupported on Windows Phone. + Files written here may be deleted at any time. */ + SDL_WINRT_PATH_TEMP_FOLDER +} SDL_WinRT_Path; + + +/** + * \brief WinRT Device Family + */ +typedef enum +{ + /** \brief Unknown family */ + SDL_WINRT_DEVICEFAMILY_UNKNOWN, + + /** \brief Desktop family*/ + SDL_WINRT_DEVICEFAMILY_DESKTOP, + + /** \brief Mobile family (for example smartphone) */ + SDL_WINRT_DEVICEFAMILY_MOBILE, + + /** \brief XBox family */ + SDL_WINRT_DEVICEFAMILY_XBOX, +} SDL_WinRT_DeviceFamily; + + +/** + * \brief Retrieves a WinRT defined path on the local file system + * + * \note Documentation on most app-specific path types on WinRT + * can be found on MSDN, at the URL: + * http://msdn.microsoft.com/en-us/library/windows/apps/hh464917.aspx + * + * \param pathType The type of path to retrieve. + * \return A UCS-2 string (16-bit, wide-char) containing the path, or NULL + * if the path is not available for any reason. Not all paths are + * available on all versions of Windows. This is especially true on + * Windows Phone. Check the documentation for the given + * SDL_WinRT_Path for more information on which path types are + * supported where. + */ +extern DECLSPEC const wchar_t * SDLCALL SDL_WinRTGetFSPathUNICODE(SDL_WinRT_Path pathType); + +/** + * \brief Retrieves a WinRT defined path on the local file system + * + * \note Documentation on most app-specific path types on WinRT + * can be found on MSDN, at the URL: + * http://msdn.microsoft.com/en-us/library/windows/apps/hh464917.aspx + * + * \param pathType The type of path to retrieve. + * \return A UTF-8 string (8-bit, multi-byte) containing the path, or NULL + * if the path is not available for any reason. Not all paths are + * available on all versions of Windows. This is especially true on + * Windows Phone. Check the documentation for the given + * SDL_WinRT_Path for more information on which path types are + * supported where. + */ +extern DECLSPEC const char * SDLCALL SDL_WinRTGetFSPathUTF8(SDL_WinRT_Path pathType); + +/** + * \brief Detects the device family of WinRT plattform on runtime + * + * \return Device family + */ +extern DECLSPEC SDL_WinRT_DeviceFamily SDLCALL SDL_WinRTGetDeviceFamily(); + +#endif /* __WINRT__ */ + +/** + \brief Return true if the current device is a tablet. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_IsTablet(void); + +/* Functions used by iOS application delegates to notify SDL about state changes */ +extern DECLSPEC void SDLCALL SDL_OnApplicationWillTerminate(void); +extern DECLSPEC void SDLCALL SDL_OnApplicationDidReceiveMemoryWarning(void); +extern DECLSPEC void SDLCALL SDL_OnApplicationWillResignActive(void); +extern DECLSPEC void SDLCALL SDL_OnApplicationDidEnterBackground(void); +extern DECLSPEC void SDLCALL SDL_OnApplicationWillEnterForeground(void); +extern DECLSPEC void SDLCALL SDL_OnApplicationDidBecomeActive(void); +#ifdef __IPHONEOS__ +extern DECLSPEC void SDLCALL SDL_OnApplicationDidChangeStatusBarOrientation(void); +#endif + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_system_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_syswm.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_syswm.h new file mode 100644 index 0000000..f0e9675 --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_syswm.h @@ -0,0 +1,354 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_syswm.h + * + * Include file for SDL custom system window manager hooks. + */ + +#ifndef SDL_syswm_h_ +#define SDL_syswm_h_ + +#include "SDL_stdinc.h" +#include "SDL_error.h" +#include "SDL_video.h" +#include "SDL_version.h" + +/** + * \brief SDL_syswm.h + * + * Your application has access to a special type of event ::SDL_SYSWMEVENT, + * which contains window-manager specific information and arrives whenever + * an unhandled window event occurs. This event is ignored by default, but + * you can enable it with SDL_EventState(). + */ +struct SDL_SysWMinfo; + +#if !defined(SDL_PROTOTYPES_ONLY) + +#if defined(SDL_VIDEO_DRIVER_WINDOWS) +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#ifndef NOMINMAX /* don't define min() and max(). */ +#define NOMINMAX +#endif +#include +#endif + +#if defined(SDL_VIDEO_DRIVER_WINRT) +#include +#endif + +/* This is the structure for custom window manager events */ +#if defined(SDL_VIDEO_DRIVER_X11) +#if defined(__APPLE__) && defined(__MACH__) +/* conflicts with Quickdraw.h */ +#define Cursor X11Cursor +#endif + +#include +#include + +#if defined(__APPLE__) && defined(__MACH__) +/* matches the re-define above */ +#undef Cursor +#endif + +#endif /* defined(SDL_VIDEO_DRIVER_X11) */ + +#if defined(SDL_VIDEO_DRIVER_DIRECTFB) +#include +#endif + +#if defined(SDL_VIDEO_DRIVER_COCOA) +#ifdef __OBJC__ +@class NSWindow; +#else +typedef struct _NSWindow NSWindow; +#endif +#endif + +#if defined(SDL_VIDEO_DRIVER_UIKIT) +#ifdef __OBJC__ +#include +#else +typedef struct _UIWindow UIWindow; +typedef struct _UIViewController UIViewController; +#endif +typedef Uint32 GLuint; +#endif + +#if defined(SDL_VIDEO_DRIVER_ANDROID) +typedef struct ANativeWindow ANativeWindow; +typedef void *EGLSurface; +#endif + +#if defined(SDL_VIDEO_DRIVER_VIVANTE) +#include "SDL_egl.h" +#endif + +#if defined(SDL_VIDEO_DRIVER_OS2) +#define INCL_WIN +#include +#endif +#endif /* SDL_PROTOTYPES_ONLY */ + + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +#if !defined(SDL_PROTOTYPES_ONLY) +/** + * These are the various supported windowing subsystems + */ +typedef enum +{ + SDL_SYSWM_UNKNOWN, + SDL_SYSWM_WINDOWS, + SDL_SYSWM_X11, + SDL_SYSWM_DIRECTFB, + SDL_SYSWM_COCOA, + SDL_SYSWM_UIKIT, + SDL_SYSWM_WAYLAND, + SDL_SYSWM_MIR, /* no longer available, left for API/ABI compatibility. Remove in 2.1! */ + SDL_SYSWM_WINRT, + SDL_SYSWM_ANDROID, + SDL_SYSWM_VIVANTE, + SDL_SYSWM_OS2, + SDL_SYSWM_HAIKU +} SDL_SYSWM_TYPE; + +/** + * The custom event structure. + */ +struct SDL_SysWMmsg +{ + SDL_version version; + SDL_SYSWM_TYPE subsystem; + union + { +#if defined(SDL_VIDEO_DRIVER_WINDOWS) + struct { + HWND hwnd; /**< The window for the message */ + UINT msg; /**< The type of message */ + WPARAM wParam; /**< WORD message parameter */ + LPARAM lParam; /**< LONG message parameter */ + } win; +#endif +#if defined(SDL_VIDEO_DRIVER_X11) + struct { + XEvent event; + } x11; +#endif +#if defined(SDL_VIDEO_DRIVER_DIRECTFB) + struct { + DFBEvent event; + } dfb; +#endif +#if defined(SDL_VIDEO_DRIVER_COCOA) + struct + { + /* Latest version of Xcode clang complains about empty structs in C v. C++: + error: empty struct has size 0 in C, size 1 in C++ + */ + int dummy; + /* No Cocoa window events yet */ + } cocoa; +#endif +#if defined(SDL_VIDEO_DRIVER_UIKIT) + struct + { + int dummy; + /* No UIKit window events yet */ + } uikit; +#endif +#if defined(SDL_VIDEO_DRIVER_VIVANTE) + struct + { + int dummy; + /* No Vivante window events yet */ + } vivante; +#endif +#if defined(SDL_VIDEO_DRIVER_OS2) + struct + { + BOOL fFrame; /**< TRUE if hwnd is a frame window */ + HWND hwnd; /**< The window receiving the message */ + ULONG msg; /**< The message identifier */ + MPARAM mp1; /**< The first first message parameter */ + MPARAM mp2; /**< The second first message parameter */ + } os2; +#endif + /* Can't have an empty union */ + int dummy; + } msg; +}; + +/** + * The custom window manager information structure. + * + * When this structure is returned, it holds information about which + * low level system it is using, and will be one of SDL_SYSWM_TYPE. + */ +struct SDL_SysWMinfo +{ + SDL_version version; + SDL_SYSWM_TYPE subsystem; + union + { +#if defined(SDL_VIDEO_DRIVER_WINDOWS) + struct + { + HWND window; /**< The window handle */ + HDC hdc; /**< The window device context */ + HINSTANCE hinstance; /**< The instance handle */ + } win; +#endif +#if defined(SDL_VIDEO_DRIVER_WINRT) + struct + { + IInspectable * window; /**< The WinRT CoreWindow */ + } winrt; +#endif +#if defined(SDL_VIDEO_DRIVER_X11) + struct + { + Display *display; /**< The X11 display */ + Window window; /**< The X11 window */ + } x11; +#endif +#if defined(SDL_VIDEO_DRIVER_DIRECTFB) + struct + { + IDirectFB *dfb; /**< The directfb main interface */ + IDirectFBWindow *window; /**< The directfb window handle */ + IDirectFBSurface *surface; /**< The directfb client surface */ + } dfb; +#endif +#if defined(SDL_VIDEO_DRIVER_COCOA) + struct + { +#if defined(__OBJC__) && defined(__has_feature) && __has_feature(objc_arc) + NSWindow __unsafe_unretained *window; /**< The Cocoa window */ +#else + NSWindow *window; /**< The Cocoa window */ +#endif + } cocoa; +#endif +#if defined(SDL_VIDEO_DRIVER_UIKIT) + struct + { +#if defined(__OBJC__) && defined(__has_feature) && __has_feature(objc_arc) + UIWindow __unsafe_unretained *window; /**< The UIKit window */ +#else + UIWindow *window; /**< The UIKit window */ +#endif + GLuint framebuffer; /**< The GL view's Framebuffer Object. It must be bound when rendering to the screen using GL. */ + GLuint colorbuffer; /**< The GL view's color Renderbuffer Object. It must be bound when SDL_GL_SwapWindow is called. */ + GLuint resolveFramebuffer; /**< The Framebuffer Object which holds the resolve color Renderbuffer, when MSAA is used. */ + } uikit; +#endif +#if defined(SDL_VIDEO_DRIVER_WAYLAND) + struct + { + struct wl_display *display; /**< Wayland display */ + struct wl_surface *surface; /**< Wayland surface */ + struct wl_shell_surface *shell_surface; /**< Wayland shell_surface (window manager handle) */ + } wl; +#endif +#if defined(SDL_VIDEO_DRIVER_MIR) /* no longer available, left for API/ABI compatibility. Remove in 2.1! */ + struct + { + void *connection; /**< Mir display server connection */ + void *surface; /**< Mir surface */ + } mir; +#endif + +#if defined(SDL_VIDEO_DRIVER_ANDROID) + struct + { + ANativeWindow *window; + EGLSurface surface; + } android; +#endif + +#if defined(SDL_VIDEO_DRIVER_OS2) + struct + { + HWND hwnd; /**< The window handle */ + HWND hwndFrame; /**< The frame window handle */ + } os2; +#endif + +#if defined(SDL_VIDEO_DRIVER_VIVANTE) + struct + { + EGLNativeDisplayType display; + EGLNativeWindowType window; + } vivante; +#endif + + /* Make sure this union is always 64 bytes (8 64-bit pointers). */ + /* Be careful not to overflow this if you add a new target! */ + Uint8 dummy[64]; + } info; +}; + +#endif /* SDL_PROTOTYPES_ONLY */ + +typedef struct SDL_SysWMinfo SDL_SysWMinfo; + +/* Function prototypes */ +/** + * \brief This function allows access to driver-dependent window information. + * + * \param window The window about which information is being requested + * \param info This structure must be initialized with the SDL version, and is + * then filled in with information about the given window. + * + * \return SDL_TRUE if the function is implemented and the version member of + * the \c info struct is valid, SDL_FALSE otherwise. + * + * You typically use this function like this: + * \code + * SDL_SysWMinfo info; + * SDL_VERSION(&info.version); + * if ( SDL_GetWindowWMInfo(window, &info) ) { ... } + * \endcode + */ +extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_Window * window, + SDL_SysWMinfo * info); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_syswm_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_test.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_test.h new file mode 100644 index 0000000..7095427 --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_test.h @@ -0,0 +1,69 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_test.h + * + * Include file for SDL test framework. + * + * This code is a part of the SDL2_test library, not the main SDL library. + */ + +#ifndef SDL_test_h_ +#define SDL_test_h_ + +#include "SDL.h" +#include "SDL_test_assert.h" +#include "SDL_test_common.h" +#include "SDL_test_compare.h" +#include "SDL_test_crc32.h" +#include "SDL_test_font.h" +#include "SDL_test_fuzzer.h" +#include "SDL_test_harness.h" +#include "SDL_test_images.h" +#include "SDL_test_log.h" +#include "SDL_test_md5.h" +#include "SDL_test_memory.h" +#include "SDL_test_random.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* Global definitions */ + +/* + * Note: Maximum size of SDLTest log message is less than SDL's limit + * to ensure we can fit additional information such as the timestamp. + */ +#define SDLTEST_MAX_LOGMESSAGE_LENGTH 3584 + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_test_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_test_assert.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_test_assert.h new file mode 100644 index 0000000..19b9095 --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_test_assert.h @@ -0,0 +1,105 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_test_assert.h + * + * Include file for SDL test framework. + * + * This code is a part of the SDL2_test library, not the main SDL library. + */ + +/* + * + * Assert API for test code and test cases + * + */ + +#ifndef SDL_test_assert_h_ +#define SDL_test_assert_h_ + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \brief Fails the assert. + */ +#define ASSERT_FAIL 0 + +/** + * \brief Passes the assert. + */ +#define ASSERT_PASS 1 + +/** + * \brief Assert that logs and break execution flow on failures. + * + * \param assertCondition Evaluated condition or variable to assert; fail (==0) or pass (!=0). + * \param assertDescription Message to log with the assert describing it. + */ +void SDLTest_Assert(int assertCondition, SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...) SDL_PRINTF_VARARG_FUNC(2); + +/** + * \brief Assert for test cases that logs but does not break execution flow on failures. Updates assertion counters. + * + * \param assertCondition Evaluated condition or variable to assert; fail (==0) or pass (!=0). + * \param assertDescription Message to log with the assert describing it. + * + * \returns Returns the assertCondition so it can be used to externally to break execution flow if desired. + */ +int SDLTest_AssertCheck(int assertCondition, SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...) SDL_PRINTF_VARARG_FUNC(2); + +/** + * \brief Explicitly pass without checking an assertion condition. Updates assertion counter. + * + * \param assertDescription Message to log with the assert describing it. + */ +void SDLTest_AssertPass(SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...) SDL_PRINTF_VARARG_FUNC(1); + +/** + * \brief Resets the assert summary counters to zero. + */ +void SDLTest_ResetAssertSummary(void); + +/** + * \brief Logs summary of all assertions (total, pass, fail) since last reset as INFO or ERROR. + */ +void SDLTest_LogAssertSummary(void); + + +/** + * \brief Converts the current assert summary state to a test result. + * + * \returns TEST_RESULT_PASSED, TEST_RESULT_FAILED, or TEST_RESULT_NO_ASSERT + */ +int SDLTest_AssertSummaryToTestResult(void); + +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_test_assert_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_test_common.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_test_common.h new file mode 100644 index 0000000..3ad2030 --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_test_common.h @@ -0,0 +1,218 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_test_common.h + * + * Include file for SDL test framework. + * + * This code is a part of the SDL2_test library, not the main SDL library. + */ + +/* Ported from original test\common.h file. */ + +#ifndef SDL_test_common_h_ +#define SDL_test_common_h_ + +#include "SDL.h" + +#if defined(__PSP__) +#define DEFAULT_WINDOW_WIDTH 480 +#define DEFAULT_WINDOW_HEIGHT 272 +#else +#define DEFAULT_WINDOW_WIDTH 640 +#define DEFAULT_WINDOW_HEIGHT 480 +#endif + +#define VERBOSE_VIDEO 0x00000001 +#define VERBOSE_MODES 0x00000002 +#define VERBOSE_RENDER 0x00000004 +#define VERBOSE_EVENT 0x00000008 +#define VERBOSE_AUDIO 0x00000010 + +typedef struct +{ + /* SDL init flags */ + char **argv; + Uint32 flags; + Uint32 verbose; + + /* Video info */ + const char *videodriver; + int display; + const char *window_title; + const char *window_icon; + Uint32 window_flags; + int window_x; + int window_y; + int window_w; + int window_h; + int window_minW; + int window_minH; + int window_maxW; + int window_maxH; + int logical_w; + int logical_h; + float scale; + int depth; + int refresh_rate; + int num_windows; + SDL_Window **windows; + + /* Renderer info */ + const char *renderdriver; + Uint32 render_flags; + SDL_bool skip_renderer; + SDL_Renderer **renderers; + SDL_Texture **targets; + + /* Audio info */ + const char *audiodriver; + SDL_AudioSpec audiospec; + + /* GL settings */ + int gl_red_size; + int gl_green_size; + int gl_blue_size; + int gl_alpha_size; + int gl_buffer_size; + int gl_depth_size; + int gl_stencil_size; + int gl_double_buffer; + int gl_accum_red_size; + int gl_accum_green_size; + int gl_accum_blue_size; + int gl_accum_alpha_size; + int gl_stereo; + int gl_multisamplebuffers; + int gl_multisamplesamples; + int gl_retained_backing; + int gl_accelerated; + int gl_major_version; + int gl_minor_version; + int gl_debug; + int gl_profile_mask; +} SDLTest_CommonState; + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* Function prototypes */ + +/** + * \brief Parse command line parameters and create common state. + * + * \param argv Array of command line parameters + * \param flags Flags indicating which subsystem to initialize (i.e. SDL_INIT_VIDEO | SDL_INIT_AUDIO) + * + * \returns Returns a newly allocated common state object. + */ +SDLTest_CommonState *SDLTest_CommonCreateState(char **argv, Uint32 flags); + +/** + * \brief Process one common argument. + * + * \param state The common state describing the test window to create. + * \param index The index of the argument to process in argv[]. + * + * \returns The number of arguments processed (i.e. 1 for --fullscreen, 2 for --video [videodriver], or -1 on error. + */ +int SDLTest_CommonArg(SDLTest_CommonState * state, int index); + + +/** + * \brief Logs command line usage info. + * + * This logs the appropriate command line options for the subsystems in use + * plus other common options, and then any application-specific options. + * This uses the SDL_Log() function and splits up output to be friendly to + * 80-character-wide terminals. + * + * \param state The common state describing the test window for the app. + * \param argv0 argv[0], as passed to main/SDL_main. + * \param options an array of strings for application specific options. The last element of the array should be NULL. + */ +void SDLTest_CommonLogUsage(SDLTest_CommonState * state, const char *argv0, const char **options); + +/** + * \brief Returns common usage information + * + * You should (probably) be using SDLTest_CommonLogUsage() instead, but this + * function remains for binary compatibility. Strings returned from this + * function are valid until SDLTest_CommonQuit() is called, in which case + * those strings' memory is freed and can no longer be used. + * + * \param state The common state describing the test window to create. + * \returns String with usage information + */ +const char *SDLTest_CommonUsage(SDLTest_CommonState * state); + +/** + * \brief Open test window. + * + * \param state The common state describing the test window to create. + * + * \returns True if initialization succeeded, false otherwise + */ +SDL_bool SDLTest_CommonInit(SDLTest_CommonState * state); + +/** + * \brief Easy argument handling when test app doesn't need any custom args. + * + * \param state The common state describing the test window to create. + * \param argc argc, as supplied to SDL_main + * \param argv argv, as supplied to SDL_main + * + * \returns False if app should quit, true otherwise. + */ +SDL_bool SDLTest_CommonDefaultArgs(SDLTest_CommonState * state, const int argc, char **argv); + +/** + * \brief Common event handler for test windows. + * + * \param state The common state used to create test window. + * \param event The event to handle. + * \param done Flag indicating we are done. + * + */ +void SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *done); + +/** + * \brief Close test window. + * + * \param state The common state used to create test window. + * + */ +void SDLTest_CommonQuit(SDLTest_CommonState * state); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_test_common_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_test_compare.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_test_compare.h new file mode 100644 index 0000000..38b22bb --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_test_compare.h @@ -0,0 +1,69 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_test_compare.h + * + * Include file for SDL test framework. + * + * This code is a part of the SDL2_test library, not the main SDL library. + */ + +/* + + Defines comparison functions (i.e. for surfaces). + +*/ + +#ifndef SDL_test_compare_h_ +#define SDL_test_compare_h_ + +#include "SDL.h" + +#include "SDL_test_images.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \brief Compares a surface and with reference image data for equality + * + * \param surface Surface used in comparison + * \param referenceSurface Test Surface used in comparison + * \param allowable_error Allowable difference (=sum of squared difference for each RGB component) in blending accuracy. + * + * \returns 0 if comparison succeeded, >0 (=number of pixels for which the comparison failed) if comparison failed, -1 if any of the surfaces were NULL, -2 if the surface sizes differ. + */ +int SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface, int allowable_error); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_test_compare_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_test_crc32.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_test_crc32.h new file mode 100644 index 0000000..611066a --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_test_crc32.h @@ -0,0 +1,124 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_test_crc32.h + * + * Include file for SDL test framework. + * + * This code is a part of the SDL2_test library, not the main SDL library. + */ + +/* + + Implements CRC32 calculations (default output is Perl String::CRC32 compatible). + +*/ + +#ifndef SDL_test_crc32_h_ +#define SDL_test_crc32_h_ + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + + +/* ------------ Definitions --------- */ + +/* Definition shared by all CRC routines */ + +#ifndef CrcUint32 + #define CrcUint32 unsigned int +#endif +#ifndef CrcUint8 + #define CrcUint8 unsigned char +#endif + +#ifdef ORIGINAL_METHOD + #define CRC32_POLY 0x04c11db7 /* AUTODIN II, Ethernet, & FDDI */ +#else + #define CRC32_POLY 0xEDB88320 /* Perl String::CRC32 compatible */ +#endif + +/** + * Data structure for CRC32 (checksum) computation + */ + typedef struct { + CrcUint32 crc32_table[256]; /* CRC table */ + } SDLTest_Crc32Context; + +/* ---------- Function Prototypes ------------- */ + +/** + * \brief Initialize the CRC context + * + * Note: The function initializes the crc table required for all crc calculations. + * + * \param crcContext pointer to context variable + * + * \returns 0 for OK, -1 on error + * + */ + int SDLTest_Crc32Init(SDLTest_Crc32Context * crcContext); + + +/** + * \brief calculate a crc32 from a data block + * + * \param crcContext pointer to context variable + * \param inBuf input buffer to checksum + * \param inLen length of input buffer + * \param crc32 pointer to Uint32 to store the final CRC into + * + * \returns 0 for OK, -1 on error + * + */ +int SDLTest_Crc32Calc(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32); + +/* Same routine broken down into three steps */ +int SDLTest_Crc32CalcStart(SDLTest_Crc32Context * crcContext, CrcUint32 *crc32); +int SDLTest_Crc32CalcEnd(SDLTest_Crc32Context * crcContext, CrcUint32 *crc32); +int SDLTest_Crc32CalcBuffer(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32); + + +/** + * \brief clean up CRC context + * + * \param crcContext pointer to context variable + * + * \returns 0 for OK, -1 on error + * +*/ + +int SDLTest_Crc32Done(SDLTest_Crc32Context * crcContext); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_test_crc32_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_test_font.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_test_font.h new file mode 100644 index 0000000..dc4ce6d --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_test_font.h @@ -0,0 +1,81 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_test_font.h + * + * Include file for SDL test framework. + * + * This code is a part of the SDL2_test library, not the main SDL library. + */ + +#ifndef SDL_test_font_h_ +#define SDL_test_font_h_ + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* Function prototypes */ + +#define FONT_CHARACTER_SIZE 8 + +/** + * \brief Draw a string in the currently set font. + * + * \param renderer The renderer to draw on. + * \param x The X coordinate of the upper left corner of the character. + * \param y The Y coordinate of the upper left corner of the character. + * \param c The character to draw. + * + * \returns Returns 0 on success, -1 on failure. + */ +int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, char c); + +/** + * \brief Draw a string in the currently set font. + * + * \param renderer The renderer to draw on. + * \param x The X coordinate of the upper left corner of the string. + * \param y The Y coordinate of the upper left corner of the string. + * \param s The string to draw. + * + * \returns Returns 0 on success, -1 on failure. + */ +int SDLTest_DrawString(SDL_Renderer *renderer, int x, int y, const char *s); + + +/** + * \brief Cleanup textures used by font drawing functions. + */ +void SDLTest_CleanupTextDrawing(void); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_test_font_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_test_fuzzer.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_test_fuzzer.h new file mode 100644 index 0000000..cb5a17a --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_test_fuzzer.h @@ -0,0 +1,384 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_test_fuzzer.h + * + * Include file for SDL test framework. + * + * This code is a part of the SDL2_test library, not the main SDL library. + */ + +/* + + Data generators for fuzzing test data in a reproducible way. + +*/ + +#ifndef SDL_test_fuzzer_h_ +#define SDL_test_fuzzer_h_ + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + + +/* + Based on GSOC code by Markus Kauppila +*/ + + +/** + * \file + * Note: The fuzzer implementation uses a static instance of random context + * internally which makes it thread-UNsafe. + */ + +/** + * Initializes the fuzzer for a test + * + * \param execKey Execution "Key" that initializes the random number generator uniquely for the test. + * + */ +void SDLTest_FuzzerInit(Uint64 execKey); + + +/** + * Returns a random Uint8 + * + * \returns Generated integer + */ +Uint8 SDLTest_RandomUint8(void); + +/** + * Returns a random Sint8 + * + * \returns Generated signed integer + */ +Sint8 SDLTest_RandomSint8(void); + + +/** + * Returns a random Uint16 + * + * \returns Generated integer + */ +Uint16 SDLTest_RandomUint16(void); + +/** + * Returns a random Sint16 + * + * \returns Generated signed integer + */ +Sint16 SDLTest_RandomSint16(void); + + +/** + * Returns a random integer + * + * \returns Generated integer + */ +Sint32 SDLTest_RandomSint32(void); + + +/** + * Returns a random positive integer + * + * \returns Generated integer + */ +Uint32 SDLTest_RandomUint32(void); + +/** + * Returns random Uint64. + * + * \returns Generated integer + */ +Uint64 SDLTest_RandomUint64(void); + + +/** + * Returns random Sint64. + * + * \returns Generated signed integer + */ +Sint64 SDLTest_RandomSint64(void); + +/** + * \returns random float in range [0.0 - 1.0[ + */ +float SDLTest_RandomUnitFloat(void); + +/** + * \returns random double in range [0.0 - 1.0[ + */ +double SDLTest_RandomUnitDouble(void); + +/** + * \returns random float. + * + */ +float SDLTest_RandomFloat(void); + +/** + * \returns random double. + * + */ +double SDLTest_RandomDouble(void); + +/** + * Returns a random boundary value for Uint8 within the given boundaries. + * Boundaries are inclusive, see the usage examples below. If validDomain + * is true, the function will only return valid boundaries, otherwise non-valid + * boundaries are also possible. + * If boundary1 > boundary2, the values are swapped + * + * Usage examples: + * RandomUint8BoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20 + * RandomUint8BoundaryValue(1, 20, SDL_FALSE) returns 0 or 21 + * RandomUint8BoundaryValue(0, 99, SDL_FALSE) returns 100 + * RandomUint8BoundaryValue(0, 255, SDL_FALSE) returns 0 (error set) + * + * \param boundary1 Lower boundary limit + * \param boundary2 Upper boundary limit + * \param validDomain Should the generated boundary be valid (=within the bounds) or not? + * + * \returns Random boundary value for the given range and domain or 0 with error set + */ +Uint8 SDLTest_RandomUint8BoundaryValue(Uint8 boundary1, Uint8 boundary2, SDL_bool validDomain); + +/** + * Returns a random boundary value for Uint16 within the given boundaries. + * Boundaries are inclusive, see the usage examples below. If validDomain + * is true, the function will only return valid boundaries, otherwise non-valid + * boundaries are also possible. + * If boundary1 > boundary2, the values are swapped + * + * Usage examples: + * RandomUint16BoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20 + * RandomUint16BoundaryValue(1, 20, SDL_FALSE) returns 0 or 21 + * RandomUint16BoundaryValue(0, 99, SDL_FALSE) returns 100 + * RandomUint16BoundaryValue(0, 0xFFFF, SDL_FALSE) returns 0 (error set) + * + * \param boundary1 Lower boundary limit + * \param boundary2 Upper boundary limit + * \param validDomain Should the generated boundary be valid (=within the bounds) or not? + * + * \returns Random boundary value for the given range and domain or 0 with error set + */ +Uint16 SDLTest_RandomUint16BoundaryValue(Uint16 boundary1, Uint16 boundary2, SDL_bool validDomain); + +/** + * Returns a random boundary value for Uint32 within the given boundaries. + * Boundaries are inclusive, see the usage examples below. If validDomain + * is true, the function will only return valid boundaries, otherwise non-valid + * boundaries are also possible. + * If boundary1 > boundary2, the values are swapped + * + * Usage examples: + * RandomUint32BoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20 + * RandomUint32BoundaryValue(1, 20, SDL_FALSE) returns 0 or 21 + * RandomUint32BoundaryValue(0, 99, SDL_FALSE) returns 100 + * RandomUint32BoundaryValue(0, 0xFFFFFFFF, SDL_FALSE) returns 0 (with error set) + * + * \param boundary1 Lower boundary limit + * \param boundary2 Upper boundary limit + * \param validDomain Should the generated boundary be valid (=within the bounds) or not? + * + * \returns Random boundary value for the given range and domain or 0 with error set + */ +Uint32 SDLTest_RandomUint32BoundaryValue(Uint32 boundary1, Uint32 boundary2, SDL_bool validDomain); + +/** + * Returns a random boundary value for Uint64 within the given boundaries. + * Boundaries are inclusive, see the usage examples below. If validDomain + * is true, the function will only return valid boundaries, otherwise non-valid + * boundaries are also possible. + * If boundary1 > boundary2, the values are swapped + * + * Usage examples: + * RandomUint64BoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20 + * RandomUint64BoundaryValue(1, 20, SDL_FALSE) returns 0 or 21 + * RandomUint64BoundaryValue(0, 99, SDL_FALSE) returns 100 + * RandomUint64BoundaryValue(0, 0xFFFFFFFFFFFFFFFF, SDL_FALSE) returns 0 (with error set) + * + * \param boundary1 Lower boundary limit + * \param boundary2 Upper boundary limit + * \param validDomain Should the generated boundary be valid (=within the bounds) or not? + * + * \returns Random boundary value for the given range and domain or 0 with error set + */ +Uint64 SDLTest_RandomUint64BoundaryValue(Uint64 boundary1, Uint64 boundary2, SDL_bool validDomain); + +/** + * Returns a random boundary value for Sint8 within the given boundaries. + * Boundaries are inclusive, see the usage examples below. If validDomain + * is true, the function will only return valid boundaries, otherwise non-valid + * boundaries are also possible. + * If boundary1 > boundary2, the values are swapped + * + * Usage examples: + * RandomSint8BoundaryValue(-10, 20, SDL_TRUE) returns -11, -10, 19 or 20 + * RandomSint8BoundaryValue(-100, -10, SDL_FALSE) returns -101 or -9 + * RandomSint8BoundaryValue(SINT8_MIN, 99, SDL_FALSE) returns 100 + * RandomSint8BoundaryValue(SINT8_MIN, SINT8_MAX, SDL_FALSE) returns SINT8_MIN (== error value) with error set + * + * \param boundary1 Lower boundary limit + * \param boundary2 Upper boundary limit + * \param validDomain Should the generated boundary be valid (=within the bounds) or not? + * + * \returns Random boundary value for the given range and domain or SINT8_MIN with error set + */ +Sint8 SDLTest_RandomSint8BoundaryValue(Sint8 boundary1, Sint8 boundary2, SDL_bool validDomain); + + +/** + * Returns a random boundary value for Sint16 within the given boundaries. + * Boundaries are inclusive, see the usage examples below. If validDomain + * is true, the function will only return valid boundaries, otherwise non-valid + * boundaries are also possible. + * If boundary1 > boundary2, the values are swapped + * + * Usage examples: + * RandomSint16BoundaryValue(-10, 20, SDL_TRUE) returns -11, -10, 19 or 20 + * RandomSint16BoundaryValue(-100, -10, SDL_FALSE) returns -101 or -9 + * RandomSint16BoundaryValue(SINT16_MIN, 99, SDL_FALSE) returns 100 + * RandomSint16BoundaryValue(SINT16_MIN, SINT16_MAX, SDL_FALSE) returns SINT16_MIN (== error value) with error set + * + * \param boundary1 Lower boundary limit + * \param boundary2 Upper boundary limit + * \param validDomain Should the generated boundary be valid (=within the bounds) or not? + * + * \returns Random boundary value for the given range and domain or SINT16_MIN with error set + */ +Sint16 SDLTest_RandomSint16BoundaryValue(Sint16 boundary1, Sint16 boundary2, SDL_bool validDomain); + +/** + * Returns a random boundary value for Sint32 within the given boundaries. + * Boundaries are inclusive, see the usage examples below. If validDomain + * is true, the function will only return valid boundaries, otherwise non-valid + * boundaries are also possible. + * If boundary1 > boundary2, the values are swapped + * + * Usage examples: + * RandomSint32BoundaryValue(-10, 20, SDL_TRUE) returns -11, -10, 19 or 20 + * RandomSint32BoundaryValue(-100, -10, SDL_FALSE) returns -101 or -9 + * RandomSint32BoundaryValue(SINT32_MIN, 99, SDL_FALSE) returns 100 + * RandomSint32BoundaryValue(SINT32_MIN, SINT32_MAX, SDL_FALSE) returns SINT32_MIN (== error value) + * + * \param boundary1 Lower boundary limit + * \param boundary2 Upper boundary limit + * \param validDomain Should the generated boundary be valid (=within the bounds) or not? + * + * \returns Random boundary value for the given range and domain or SINT32_MIN with error set + */ +Sint32 SDLTest_RandomSint32BoundaryValue(Sint32 boundary1, Sint32 boundary2, SDL_bool validDomain); + +/** + * Returns a random boundary value for Sint64 within the given boundaries. + * Boundaries are inclusive, see the usage examples below. If validDomain + * is true, the function will only return valid boundaries, otherwise non-valid + * boundaries are also possible. + * If boundary1 > boundary2, the values are swapped + * + * Usage examples: + * RandomSint64BoundaryValue(-10, 20, SDL_TRUE) returns -11, -10, 19 or 20 + * RandomSint64BoundaryValue(-100, -10, SDL_FALSE) returns -101 or -9 + * RandomSint64BoundaryValue(SINT64_MIN, 99, SDL_FALSE) returns 100 + * RandomSint64BoundaryValue(SINT64_MIN, SINT64_MAX, SDL_FALSE) returns SINT64_MIN (== error value) and error set + * + * \param boundary1 Lower boundary limit + * \param boundary2 Upper boundary limit + * \param validDomain Should the generated boundary be valid (=within the bounds) or not? + * + * \returns Random boundary value for the given range and domain or SINT64_MIN with error set + */ +Sint64 SDLTest_RandomSint64BoundaryValue(Sint64 boundary1, Sint64 boundary2, SDL_bool validDomain); + + +/** + * Returns integer in range [min, max] (inclusive). + * Min and max values can be negative values. + * If Max in smaller than min, then the values are swapped. + * Min and max are the same value, that value will be returned. + * + * \param min Minimum inclusive value of returned random number + * \param max Maximum inclusive value of returned random number + * + * \returns Generated random integer in range + */ +Sint32 SDLTest_RandomIntegerInRange(Sint32 min, Sint32 max); + + +/** + * Generates random null-terminated string. The minimum length for + * the string is 1 character, maximum length for the string is 255 + * characters and it can contain ASCII characters from 32 to 126. + * + * Note: Returned string needs to be deallocated. + * + * \returns Newly allocated random string; or NULL if length was invalid or string could not be allocated. + */ +char * SDLTest_RandomAsciiString(void); + + +/** + * Generates random null-terminated string. The maximum length for + * the string is defined by the maxLength parameter. + * String can contain ASCII characters from 32 to 126. + * + * Note: Returned string needs to be deallocated. + * + * \param maxLength The maximum length of the generated string. + * + * \returns Newly allocated random string; or NULL if maxLength was invalid or string could not be allocated. + */ +char * SDLTest_RandomAsciiStringWithMaximumLength(int maxLength); + + +/** + * Generates random null-terminated string. The length for + * the string is defined by the size parameter. + * String can contain ASCII characters from 32 to 126. + * + * Note: Returned string needs to be deallocated. + * + * \param size The length of the generated string + * + * \returns Newly allocated random string; or NULL if size was invalid or string could not be allocated. + */ +char * SDLTest_RandomAsciiStringOfSize(int size); + +/** + * Returns the invocation count for the fuzzer since last ...FuzzerInit. + */ +int SDLTest_GetFuzzerInvocationCount(void); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_test_fuzzer_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_test_harness.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_test_harness.h new file mode 100644 index 0000000..97d9812 --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_test_harness.h @@ -0,0 +1,134 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_test_harness.h + * + * Include file for SDL test framework. + * + * This code is a part of the SDL2_test library, not the main SDL library. + */ + +/* + Defines types for test case definitions and the test execution harness API. + + Based on original GSOC code by Markus Kauppila +*/ + +#ifndef SDL_test_h_arness_h +#define SDL_test_h_arness_h + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + + +/* ! Definitions for test case structures */ +#define TEST_ENABLED 1 +#define TEST_DISABLED 0 + +/* ! Definition of all the possible test return values of the test case method */ +#define TEST_ABORTED -1 +#define TEST_STARTED 0 +#define TEST_COMPLETED 1 +#define TEST_SKIPPED 2 + +/* ! Definition of all the possible test results for the harness */ +#define TEST_RESULT_PASSED 0 +#define TEST_RESULT_FAILED 1 +#define TEST_RESULT_NO_ASSERT 2 +#define TEST_RESULT_SKIPPED 3 +#define TEST_RESULT_SETUP_FAILURE 4 + +/* !< Function pointer to a test case setup function (run before every test) */ +typedef void (*SDLTest_TestCaseSetUpFp)(void *arg); + +/* !< Function pointer to a test case function */ +typedef int (*SDLTest_TestCaseFp)(void *arg); + +/* !< Function pointer to a test case teardown function (run after every test) */ +typedef void (*SDLTest_TestCaseTearDownFp)(void *arg); + +/** + * Holds information about a single test case. + */ +typedef struct SDLTest_TestCaseReference { + /* !< Func2Stress */ + SDLTest_TestCaseFp testCase; + /* !< Short name (or function name) "Func2Stress" */ + char *name; + /* !< Long name or full description "This test pushes func2() to the limit." */ + char *description; + /* !< Set to TEST_ENABLED or TEST_DISABLED (test won't be run) */ + int enabled; +} SDLTest_TestCaseReference; + +/** + * Holds information about a test suite (multiple test cases). + */ +typedef struct SDLTest_TestSuiteReference { + /* !< "PlatformSuite" */ + char *name; + /* !< The function that is run before each test. NULL skips. */ + SDLTest_TestCaseSetUpFp testSetUp; + /* !< The test cases that are run as part of the suite. Last item should be NULL. */ + const SDLTest_TestCaseReference **testCases; + /* !< The function that is run after each test. NULL skips. */ + SDLTest_TestCaseTearDownFp testTearDown; +} SDLTest_TestSuiteReference; + + +/** + * \brief Generates a random run seed string for the harness. The generated seed will contain alphanumeric characters (0-9A-Z). + * + * Note: The returned string needs to be deallocated by the caller. + * + * \param length The length of the seed string to generate + * + * \returns The generated seed string + */ +char *SDLTest_GenerateRunSeed(const int length); + +/** + * \brief Execute a test suite using the given run seed and execution key. + * + * \param testSuites Suites containing the test case. + * \param userRunSeed Custom run seed provided by user, or NULL to autogenerate one. + * \param userExecKey Custom execution key provided by user, or 0 to autogenerate one. + * \param filter Filter specification. NULL disables. Case sensitive. + * \param testIterations Number of iterations to run each test case. + * + * \returns Test run result; 0 when all tests passed, 1 if any tests failed. + */ +int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *userRunSeed, Uint64 userExecKey, const char *filter, int testIterations); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_test_h_arness_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_test_images.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_test_images.h new file mode 100644 index 0000000..1cc3ee2 --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_test_images.h @@ -0,0 +1,78 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_test_images.h + * + * Include file for SDL test framework. + * + * This code is a part of the SDL2_test library, not the main SDL library. + */ + +/* + + Defines some images for tests. + +*/ + +#ifndef SDL_test_images_h_ +#define SDL_test_images_h_ + +#include "SDL.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/** + *Type for test images. + */ +typedef struct SDLTest_SurfaceImage_s { + int width; + int height; + unsigned int bytes_per_pixel; /* 3:RGB, 4:RGBA */ + const char *pixel_data; +} SDLTest_SurfaceImage_t; + +/* Test images */ +SDL_Surface *SDLTest_ImageBlit(void); +SDL_Surface *SDLTest_ImageBlitColor(void); +SDL_Surface *SDLTest_ImageBlitAlpha(void); +SDL_Surface *SDLTest_ImageBlitBlendAdd(void); +SDL_Surface *SDLTest_ImageBlitBlend(void); +SDL_Surface *SDLTest_ImageBlitBlendMod(void); +SDL_Surface *SDLTest_ImageBlitBlendNone(void); +SDL_Surface *SDLTest_ImageBlitBlendAll(void); +SDL_Surface *SDLTest_ImageFace(void); +SDL_Surface *SDLTest_ImagePrimitives(void); +SDL_Surface *SDLTest_ImagePrimitivesBlend(void); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_test_images_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_test_log.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_test_log.h new file mode 100644 index 0000000..6066f90 --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_test_log.h @@ -0,0 +1,67 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_test_log.h + * + * Include file for SDL test framework. + * + * This code is a part of the SDL2_test library, not the main SDL library. + */ + +/* + * + * Wrapper to log in the TEST category + * + */ + +#ifndef SDL_test_log_h_ +#define SDL_test_log_h_ + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \brief Prints given message with a timestamp in the TEST category and INFO priority. + * + * \param fmt Message to be logged + */ +void SDLTest_Log(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1); + +/** + * \brief Prints given message with a timestamp in the TEST category and the ERROR priority. + * + * \param fmt Message to be logged + */ +void SDLTest_LogError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_test_log_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_test_md5.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_test_md5.h new file mode 100644 index 0000000..b1c51d9 --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_test_md5.h @@ -0,0 +1,129 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_test_md5.h + * + * Include file for SDL test framework. + * + * This code is a part of the SDL2_test library, not the main SDL library. + */ + +/* + *********************************************************************** + ** Header file for implementation of MD5 ** + ** RSA Data Security, Inc. MD5 Message-Digest Algorithm ** + ** Created: 2/17/90 RLR ** + ** Revised: 12/27/90 SRD,AJ,BSK,JT Reference C version ** + ** Revised (for MD5): RLR 4/27/91 ** + ** -- G modified to have y&~z instead of y&z ** + ** -- FF, GG, HH modified to add in last register done ** + ** -- Access pattern: round 2 works mod 5, round 3 works mod 3 ** + ** -- distinct additive constant for each step ** + ** -- round 4 added, working mod 7 ** + *********************************************************************** +*/ + +/* + *********************************************************************** + ** Message-digest routines: ** + ** To form the message digest for a message M ** + ** (1) Initialize a context buffer mdContext using MD5Init ** + ** (2) Call MD5Update on mdContext and M ** + ** (3) Call MD5Final on mdContext ** + ** The message digest is now in mdContext->digest[0...15] ** + *********************************************************************** +*/ + +#ifndef SDL_test_md5_h_ +#define SDL_test_md5_h_ + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* ------------ Definitions --------- */ + +/* typedef a 32-bit type */ + typedef unsigned long int MD5UINT4; + +/* Data structure for MD5 (Message-Digest) computation */ + typedef struct { + MD5UINT4 i[2]; /* number of _bits_ handled mod 2^64 */ + MD5UINT4 buf[4]; /* scratch buffer */ + unsigned char in[64]; /* input buffer */ + unsigned char digest[16]; /* actual digest after Md5Final call */ + } SDLTest_Md5Context; + +/* ---------- Function Prototypes ------------- */ + +/** + * \brief initialize the context + * + * \param mdContext pointer to context variable + * + * Note: The function initializes the message-digest context + * mdContext. Call before each new use of the context - + * all fields are set to zero. + */ + void SDLTest_Md5Init(SDLTest_Md5Context * mdContext); + + +/** + * \brief update digest from variable length data + * + * \param mdContext pointer to context variable + * \param inBuf pointer to data array/string + * \param inLen length of data array/string + * + * Note: The function updates the message-digest context to account + * for the presence of each of the characters inBuf[0..inLen-1] + * in the message whose digest is being computed. +*/ + + void SDLTest_Md5Update(SDLTest_Md5Context * mdContext, unsigned char *inBuf, + unsigned int inLen); + + +/** + * \brief complete digest computation + * + * \param mdContext pointer to context variable + * + * Note: The function terminates the message-digest computation and + * ends with the desired message digest in mdContext.digest[0..15]. + * Always call before using the digest[] variable. +*/ + + void SDLTest_Md5Final(SDLTest_Md5Context * mdContext); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_test_md5_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_test_memory.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_test_memory.h new file mode 100644 index 0000000..df69f93 --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_test_memory.h @@ -0,0 +1,63 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_test_memory.h + * + * Include file for SDL test framework. + * + * This code is a part of the SDL2_test library, not the main SDL library. + */ + +#ifndef SDL_test_memory_h_ +#define SDL_test_memory_h_ + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + + +/** + * \brief Start tracking SDL memory allocations + * + * \note This should be called before any other SDL functions for complete tracking coverage + */ +int SDLTest_TrackAllocations(void); + +/** + * \brief Print a log of any outstanding allocations + * + * \note This can be called after SDL_Quit() + */ +void SDLTest_LogAllocations(void); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_test_memory_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_test_random.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_test_random.h new file mode 100644 index 0000000..9404e9d --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_test_random.h @@ -0,0 +1,115 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_test_random.h + * + * Include file for SDL test framework. + * + * This code is a part of the SDL2_test library, not the main SDL library. + */ + +/* + + A "32-bit Multiply with carry random number generator. Very fast. + Includes a list of recommended multipliers. + + multiply-with-carry generator: x(n) = a*x(n-1) + carry mod 2^32. + period: (a*2^31)-1 + +*/ + +#ifndef SDL_test_random_h_ +#define SDL_test_random_h_ + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* --- Definitions */ + +/* + * Macros that return a random number in a specific format. + */ +#define SDLTest_RandomInt(c) ((int)SDLTest_Random(c)) + +/* + * Context structure for the random number generator state. + */ + typedef struct { + unsigned int a; + unsigned int x; + unsigned int c; + unsigned int ah; + unsigned int al; + } SDLTest_RandomContext; + + +/* --- Function prototypes */ + +/** + * \brief Initialize random number generator with two integers. + * + * Note: The random sequence of numbers returned by ...Random() is the + * same for the same two integers and has a period of 2^31. + * + * \param rndContext pointer to context structure + * \param xi integer that defines the random sequence + * \param ci integer that defines the random sequence + * + */ + void SDLTest_RandomInit(SDLTest_RandomContext * rndContext, unsigned int xi, + unsigned int ci); + +/** + * \brief Initialize random number generator based on current system time. + * + * \param rndContext pointer to context structure + * + */ + void SDLTest_RandomInitTime(SDLTest_RandomContext *rndContext); + + +/** + * \brief Initialize random number generator based on current system time. + * + * Note: ...RandomInit() or ...RandomInitTime() must have been called + * before using this function. + * + * \param rndContext pointer to context structure + * + * \returns A random number (32bit unsigned integer) + * + */ + unsigned int SDLTest_Random(SDLTest_RandomContext *rndContext); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_test_random_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_thread.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_thread.h new file mode 100644 index 0000000..4016358 --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_thread.h @@ -0,0 +1,366 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef SDL_thread_h_ +#define SDL_thread_h_ + +/** + * \file SDL_thread.h + * + * Header for the SDL thread management routines. + */ + +#include "SDL_stdinc.h" +#include "SDL_error.h" + +/* Thread synchronization primitives */ +#include "SDL_atomic.h" +#include "SDL_mutex.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* The SDL thread structure, defined in SDL_thread.c */ +struct SDL_Thread; +typedef struct SDL_Thread SDL_Thread; + +/* The SDL thread ID */ +typedef unsigned long SDL_threadID; + +/* Thread local storage ID, 0 is the invalid ID */ +typedef unsigned int SDL_TLSID; + +/** + * The SDL thread priority. + * + * SDL will make system changes as necessary in order to apply the thread priority. + * Code which attempts to control thread state related to priority should be aware + * that calling SDL_SetThreadPriority may alter such state. + * SDL_HINT_THREAD_PRIORITY_POLICY can be used to control aspects of this behavior. + * + * \note On many systems you require special privileges to set high or time critical priority. + */ +typedef enum { + SDL_THREAD_PRIORITY_LOW, + SDL_THREAD_PRIORITY_NORMAL, + SDL_THREAD_PRIORITY_HIGH, + SDL_THREAD_PRIORITY_TIME_CRITICAL +} SDL_ThreadPriority; + +/** + * The function passed to SDL_CreateThread(). + * It is passed a void* user context parameter and returns an int. + */ +typedef int (SDLCALL * SDL_ThreadFunction) (void *data); + +#if defined(__WIN32__) +/** + * \file SDL_thread.h + * + * We compile SDL into a DLL. This means, that it's the DLL which + * creates a new thread for the calling process with the SDL_CreateThread() + * API. There is a problem with this, that only the RTL of the SDL2.DLL will + * be initialized for those threads, and not the RTL of the calling + * application! + * + * To solve this, we make a little hack here. + * + * We'll always use the caller's _beginthread() and _endthread() APIs to + * start a new thread. This way, if it's the SDL2.DLL which uses this API, + * then the RTL of SDL2.DLL will be used to create the new thread, and if it's + * the application, then the RTL of the application will be used. + * + * So, in short: + * Always use the _beginthread() and _endthread() of the calling runtime + * library! + */ +#define SDL_PASSED_BEGINTHREAD_ENDTHREAD +#include /* _beginthreadex() and _endthreadex() */ + +typedef uintptr_t (__cdecl * pfnSDL_CurrentBeginThread) + (void *, unsigned, unsigned (__stdcall *func)(void *), + void * /*arg*/, unsigned, unsigned * /* threadID */); +typedef void (__cdecl * pfnSDL_CurrentEndThread) (unsigned code); + +#ifndef SDL_beginthread +#define SDL_beginthread _beginthreadex +#endif +#ifndef SDL_endthread +#define SDL_endthread _endthreadex +#endif + +/** + * Create a thread. + */ +extern DECLSPEC SDL_Thread *SDLCALL +SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data, + pfnSDL_CurrentBeginThread pfnBeginThread, + pfnSDL_CurrentEndThread pfnEndThread); + +extern DECLSPEC SDL_Thread *SDLCALL +SDL_CreateThreadWithStackSize(int (SDLCALL * fn) (void *), + const char *name, const size_t stacksize, void *data, + pfnSDL_CurrentBeginThread pfnBeginThread, + pfnSDL_CurrentEndThread pfnEndThread); + + +/** + * Create a thread. + */ +#if defined(SDL_CreateThread) && SDL_DYNAMIC_API +#undef SDL_CreateThread +#define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread) +#undef SDL_CreateThreadWithStackSize +#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize_REAL(fn, name, stacksize, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread) +#else +#define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread) +#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)SDL_endthread) +#endif + +#elif defined(__OS2__) +/* + * just like the windows case above: We compile SDL2 + * into a dll with Watcom's runtime statically linked. + */ +#define SDL_PASSED_BEGINTHREAD_ENDTHREAD + +#ifndef __EMX__ +#include +#else +#include +#endif + +typedef int (*pfnSDL_CurrentBeginThread)(void (*func)(void *), void *, unsigned, void * /*arg*/); +typedef void (*pfnSDL_CurrentEndThread)(void); + +#ifndef SDL_beginthread +#define SDL_beginthread _beginthread +#endif +#ifndef SDL_endthread +#define SDL_endthread _endthread +#endif + +extern DECLSPEC SDL_Thread *SDLCALL +SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data, + pfnSDL_CurrentBeginThread pfnBeginThread, + pfnSDL_CurrentEndThread pfnEndThread); +extern DECLSPEC SDL_Thread *SDLCALL +SDL_CreateThreadWithStackSize(SDL_ThreadFunction fn, const char *name, const size_t stacksize, void *data, + pfnSDL_CurrentBeginThread pfnBeginThread, + pfnSDL_CurrentEndThread pfnEndThread); + +#if defined(SDL_CreateThread) && SDL_DYNAMIC_API +#undef SDL_CreateThread +#define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread) +#undef SDL_CreateThreadWithStackSize +#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread) +#else +#define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread) +#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize(fn, name, stacksize, data, (pfnSDL_CurrentBeginThread)SDL_beginthread, (pfnSDL_CurrentEndThread)SDL_endthread) +#endif + +#else + +/** + * Create a thread with a default stack size. + * + * This is equivalent to calling: + * SDL_CreateThreadWithStackSize(fn, name, 0, data); + */ +extern DECLSPEC SDL_Thread *SDLCALL +SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data); + +/** + * Create a thread. + * + * Thread naming is a little complicated: Most systems have very small + * limits for the string length (Haiku has 32 bytes, Linux currently has 16, + * Visual C++ 6.0 has nine!), and possibly other arbitrary rules. You'll + * have to see what happens with your system's debugger. The name should be + * UTF-8 (but using the naming limits of C identifiers is a better bet). + * There are no requirements for thread naming conventions, so long as the + * string is null-terminated UTF-8, but these guidelines are helpful in + * choosing a name: + * + * http://stackoverflow.com/questions/149932/naming-conventions-for-threads + * + * If a system imposes requirements, SDL will try to munge the string for + * it (truncate, etc), but the original string contents will be available + * from SDL_GetThreadName(). + * + * The size (in bytes) of the new stack can be specified. Zero means "use + * the system default" which might be wildly different between platforms + * (x86 Linux generally defaults to eight megabytes, an embedded device + * might be a few kilobytes instead). + * + * In SDL 2.1, stacksize will be folded into the original SDL_CreateThread + * function. + */ +extern DECLSPEC SDL_Thread *SDLCALL +SDL_CreateThreadWithStackSize(SDL_ThreadFunction fn, const char *name, const size_t stacksize, void *data); + +#endif + +/** + * Get the thread name, as it was specified in SDL_CreateThread(). + * This function returns a pointer to a UTF-8 string that names the + * specified thread, or NULL if it doesn't have a name. This is internal + * memory, not to be free()'d by the caller, and remains valid until the + * specified thread is cleaned up by SDL_WaitThread(). + */ +extern DECLSPEC const char *SDLCALL SDL_GetThreadName(SDL_Thread *thread); + +/** + * Get the thread identifier for the current thread. + */ +extern DECLSPEC SDL_threadID SDLCALL SDL_ThreadID(void); + +/** + * Get the thread identifier for the specified thread. + * + * Equivalent to SDL_ThreadID() if the specified thread is NULL. + */ +extern DECLSPEC SDL_threadID SDLCALL SDL_GetThreadID(SDL_Thread * thread); + +/** + * Set the priority for the current thread + */ +extern DECLSPEC int SDLCALL SDL_SetThreadPriority(SDL_ThreadPriority priority); + +/** + * Wait for a thread to finish. Threads that haven't been detached will + * remain (as a "zombie") until this function cleans them up. Not doing so + * is a resource leak. + * + * Once a thread has been cleaned up through this function, the SDL_Thread + * that references it becomes invalid and should not be referenced again. + * As such, only one thread may call SDL_WaitThread() on another. + * + * The return code for the thread function is placed in the area + * pointed to by \c status, if \c status is not NULL. + * + * You may not wait on a thread that has been used in a call to + * SDL_DetachThread(). Use either that function or this one, but not + * both, or behavior is undefined. + * + * It is safe to pass NULL to this function; it is a no-op. + */ +extern DECLSPEC void SDLCALL SDL_WaitThread(SDL_Thread * thread, int *status); + +/** + * A thread may be "detached" to signify that it should not remain until + * another thread has called SDL_WaitThread() on it. Detaching a thread + * is useful for long-running threads that nothing needs to synchronize + * with or further manage. When a detached thread is done, it simply + * goes away. + * + * There is no way to recover the return code of a detached thread. If you + * need this, don't detach the thread and instead use SDL_WaitThread(). + * + * Once a thread is detached, you should usually assume the SDL_Thread isn't + * safe to reference again, as it will become invalid immediately upon + * the detached thread's exit, instead of remaining until someone has called + * SDL_WaitThread() to finally clean it up. As such, don't detach the same + * thread more than once. + * + * If a thread has already exited when passed to SDL_DetachThread(), it will + * stop waiting for a call to SDL_WaitThread() and clean up immediately. + * It is not safe to detach a thread that might be used with SDL_WaitThread(). + * + * You may not call SDL_WaitThread() on a thread that has been detached. + * Use either that function or this one, but not both, or behavior is + * undefined. + * + * It is safe to pass NULL to this function; it is a no-op. + */ +extern DECLSPEC void SDLCALL SDL_DetachThread(SDL_Thread * thread); + +/** + * \brief Create an identifier that is globally visible to all threads but refers to data that is thread-specific. + * + * \return The newly created thread local storage identifier, or 0 on error + * + * \code + * static SDL_SpinLock tls_lock; + * static SDL_TLSID thread_local_storage; + * + * void SetMyThreadData(void *value) + * { + * if (!thread_local_storage) { + * SDL_AtomicLock(&tls_lock); + * if (!thread_local_storage) { + * thread_local_storage = SDL_TLSCreate(); + * } + * SDL_AtomicUnlock(&tls_lock); + * } + * SDL_TLSSet(thread_local_storage, value, 0); + * } + * + * void *GetMyThreadData(void) + * { + * return SDL_TLSGet(thread_local_storage); + * } + * \endcode + * + * \sa SDL_TLSGet() + * \sa SDL_TLSSet() + */ +extern DECLSPEC SDL_TLSID SDLCALL SDL_TLSCreate(void); + +/** + * \brief Get the value associated with a thread local storage ID for the current thread. + * + * \param id The thread local storage ID + * + * \return The value associated with the ID for the current thread, or NULL if no value has been set. + * + * \sa SDL_TLSCreate() + * \sa SDL_TLSSet() + */ +extern DECLSPEC void * SDLCALL SDL_TLSGet(SDL_TLSID id); + +/** + * \brief Set the value associated with a thread local storage ID for the current thread. + * + * \param id The thread local storage ID + * \param value The value to associate with the ID for the current thread + * \param destructor A function called when the thread exits, to free the value. + * + * \return 0 on success, -1 on error + * + * \sa SDL_TLSCreate() + * \sa SDL_TLSGet() + */ +extern DECLSPEC int SDLCALL SDL_TLSSet(SDL_TLSID id, const void *value, void (SDLCALL *destructor)(void*)); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_thread_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_timer.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_timer.h new file mode 100644 index 0000000..aada717 --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_timer.h @@ -0,0 +1,115 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef SDL_timer_h_ +#define SDL_timer_h_ + +/** + * \file SDL_timer.h + * + * Header for the SDL time management routines. + */ + +#include "SDL_stdinc.h" +#include "SDL_error.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \brief Get the number of milliseconds since the SDL library initialization. + * + * \note This value wraps if the program runs for more than ~49 days. + */ +extern DECLSPEC Uint32 SDLCALL SDL_GetTicks(void); + +/** + * \brief Compare SDL ticks values, and return true if A has passed B + * + * e.g. if you want to wait 100 ms, you could do this: + * Uint32 timeout = SDL_GetTicks() + 100; + * while (!SDL_TICKS_PASSED(SDL_GetTicks(), timeout)) { + * ... do work until timeout has elapsed + * } + */ +#define SDL_TICKS_PASSED(A, B) ((Sint32)((B) - (A)) <= 0) + +/** + * \brief Get the current value of the high resolution counter + */ +extern DECLSPEC Uint64 SDLCALL SDL_GetPerformanceCounter(void); + +/** + * \brief Get the count per second of the high resolution counter + */ +extern DECLSPEC Uint64 SDLCALL SDL_GetPerformanceFrequency(void); + +/** + * \brief Wait a specified number of milliseconds before returning. + */ +extern DECLSPEC void SDLCALL SDL_Delay(Uint32 ms); + +/** + * Function prototype for the timer callback function. + * + * The callback function is passed the current timer interval and returns + * the next timer interval. If the returned value is the same as the one + * passed in, the periodic alarm continues, otherwise a new alarm is + * scheduled. If the callback returns 0, the periodic alarm is cancelled. + */ +typedef Uint32 (SDLCALL * SDL_TimerCallback) (Uint32 interval, void *param); + +/** + * Definition of the timer ID type. + */ +typedef int SDL_TimerID; + +/** + * \brief Add a new timer to the pool of timers already running. + * + * \return A timer ID, or 0 when an error occurs. + */ +extern DECLSPEC SDL_TimerID SDLCALL SDL_AddTimer(Uint32 interval, + SDL_TimerCallback callback, + void *param); + +/** + * \brief Remove a timer knowing its ID. + * + * \return A boolean value indicating success or failure. + * + * \warning It is not safe to remove a timer multiple times. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_RemoveTimer(SDL_TimerID id); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_timer_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_touch.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_touch.h new file mode 100644 index 0000000..fa5a37c --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_touch.h @@ -0,0 +1,102 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_touch.h + * + * Include file for SDL touch event handling. + */ + +#ifndef SDL_touch_h_ +#define SDL_touch_h_ + +#include "SDL_stdinc.h" +#include "SDL_error.h" +#include "SDL_video.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +typedef Sint64 SDL_TouchID; +typedef Sint64 SDL_FingerID; + +typedef enum +{ + SDL_TOUCH_DEVICE_INVALID = -1, + SDL_TOUCH_DEVICE_DIRECT, /* touch screen with window-relative coordinates */ + SDL_TOUCH_DEVICE_INDIRECT_ABSOLUTE, /* trackpad with absolute device coordinates */ + SDL_TOUCH_DEVICE_INDIRECT_RELATIVE /* trackpad with screen cursor-relative coordinates */ +} SDL_TouchDeviceType; + +typedef struct SDL_Finger +{ + SDL_FingerID id; + float x; + float y; + float pressure; +} SDL_Finger; + +/* Used as the device ID for mouse events simulated with touch input */ +#define SDL_TOUCH_MOUSEID ((Uint32)-1) + +/* Used as the SDL_TouchID for touch events simulated with mouse input */ +#define SDL_MOUSE_TOUCHID ((Sint64)-1) + + +/* Function prototypes */ + +/** + * \brief Get the number of registered touch devices. + */ +extern DECLSPEC int SDLCALL SDL_GetNumTouchDevices(void); + +/** + * \brief Get the touch ID with the given index, or 0 if the index is invalid. + */ +extern DECLSPEC SDL_TouchID SDLCALL SDL_GetTouchDevice(int index); + +/** + * \brief Get the type of the given touch device. + */ +extern DECLSPEC SDL_TouchDeviceType SDLCALL SDL_GetTouchDeviceType(SDL_TouchID touchID); + +/** + * \brief Get the number of active fingers for a given touch device. + */ +extern DECLSPEC int SDLCALL SDL_GetNumTouchFingers(SDL_TouchID touchID); + +/** + * \brief Get the finger object of the given touch, with the given index. + */ +extern DECLSPEC SDL_Finger * SDLCALL SDL_GetTouchFinger(SDL_TouchID touchID, int index); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_touch_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_types.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_types.h new file mode 100644 index 0000000..b6bb571 --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_types.h @@ -0,0 +1,29 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_types.h + * + * \deprecated + */ + +/* DEPRECATED */ +#include "SDL_stdinc.h" diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_version.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_version.h new file mode 100644 index 0000000..23b65f4 --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_version.h @@ -0,0 +1,162 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_version.h + * + * This header defines the current SDL version. + */ + +#ifndef SDL_version_h_ +#define SDL_version_h_ + +#include "SDL_stdinc.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \brief Information the version of SDL in use. + * + * Represents the library's version as three levels: major revision + * (increments with massive changes, additions, and enhancements), + * minor revision (increments with backwards-compatible changes to the + * major revision), and patchlevel (increments with fixes to the minor + * revision). + * + * \sa SDL_VERSION + * \sa SDL_GetVersion + */ +typedef struct SDL_version +{ + Uint8 major; /**< major version */ + Uint8 minor; /**< minor version */ + Uint8 patch; /**< update version */ +} SDL_version; + +/* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL +*/ +#define SDL_MAJOR_VERSION 2 +#define SDL_MINOR_VERSION 0 +#define SDL_PATCHLEVEL 14 + +/** + * \brief Macro to determine SDL version program was compiled against. + * + * This macro fills in a SDL_version structure with the version of the + * library you compiled against. This is determined by what header the + * compiler uses. Note that if you dynamically linked the library, you might + * have a slightly newer or older version at runtime. That version can be + * determined with SDL_GetVersion(), which, unlike SDL_VERSION(), + * is not a macro. + * + * \param x A pointer to a SDL_version struct to initialize. + * + * \sa SDL_version + * \sa SDL_GetVersion + */ +#define SDL_VERSION(x) \ +{ \ + (x)->major = SDL_MAJOR_VERSION; \ + (x)->minor = SDL_MINOR_VERSION; \ + (x)->patch = SDL_PATCHLEVEL; \ +} + +/** + * This macro turns the version numbers into a numeric value: + * \verbatim + (1,2,3) -> (1203) + \endverbatim + * + * This assumes that there will never be more than 100 patchlevels. + */ +#define SDL_VERSIONNUM(X, Y, Z) \ + ((X)*1000 + (Y)*100 + (Z)) + +/** + * This is the version number macro for the current SDL version. + */ +#define SDL_COMPILEDVERSION \ + SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL) + +/** + * This macro will evaluate to true if compiled with SDL at least X.Y.Z. + */ +#define SDL_VERSION_ATLEAST(X, Y, Z) \ + (SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z)) + +/** + * \brief Get the version of SDL that is linked against your program. + * + * If you are linking to SDL dynamically, then it is possible that the + * current version will be different than the version you compiled against. + * This function returns the current version, while SDL_VERSION() is a + * macro that tells you what version you compiled with. + * + * \code + * SDL_version compiled; + * SDL_version linked; + * + * SDL_VERSION(&compiled); + * SDL_GetVersion(&linked); + * printf("We compiled against SDL version %d.%d.%d ...\n", + * compiled.major, compiled.minor, compiled.patch); + * printf("But we linked against SDL version %d.%d.%d.\n", + * linked.major, linked.minor, linked.patch); + * \endcode + * + * This function may be called safely at any time, even before SDL_Init(). + * + * \sa SDL_VERSION + */ +extern DECLSPEC void SDLCALL SDL_GetVersion(SDL_version * ver); + +/** + * \brief Get the code revision of SDL that is linked against your program. + * + * Returns an arbitrary string (a hash value) uniquely identifying the + * exact revision of the SDL library in use, and is only useful in comparing + * against other revisions. It is NOT an incrementing number. + */ +extern DECLSPEC const char *SDLCALL SDL_GetRevision(void); + +/** + * \brief Get the revision number of SDL that is linked against your program. + * + * Returns a number uniquely identifying the exact revision of the SDL + * library in use. It is an incrementing number based on commits to + * hg.libsdl.org. + */ +extern DECLSPEC int SDLCALL SDL_GetRevisionNumber(void); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_version_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_video.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_video.h new file mode 100644 index 0000000..54cbe0f --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_video.h @@ -0,0 +1,1282 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_video.h + * + * Header file for SDL video functions. + */ + +#ifndef SDL_video_h_ +#define SDL_video_h_ + +#include "SDL_stdinc.h" +#include "SDL_pixels.h" +#include "SDL_rect.h" +#include "SDL_surface.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \brief The structure that defines a display mode + * + * \sa SDL_GetNumDisplayModes() + * \sa SDL_GetDisplayMode() + * \sa SDL_GetDesktopDisplayMode() + * \sa SDL_GetCurrentDisplayMode() + * \sa SDL_GetClosestDisplayMode() + * \sa SDL_SetWindowDisplayMode() + * \sa SDL_GetWindowDisplayMode() + */ +typedef struct +{ + Uint32 format; /**< pixel format */ + int w; /**< width, in screen coordinates */ + int h; /**< height, in screen coordinates */ + int refresh_rate; /**< refresh rate (or zero for unspecified) */ + void *driverdata; /**< driver-specific data, initialize to 0 */ +} SDL_DisplayMode; + +/** + * \brief The type used to identify a window + * + * \sa SDL_CreateWindow() + * \sa SDL_CreateWindowFrom() + * \sa SDL_DestroyWindow() + * \sa SDL_GetWindowData() + * \sa SDL_GetWindowFlags() + * \sa SDL_GetWindowGrab() + * \sa SDL_GetWindowPosition() + * \sa SDL_GetWindowSize() + * \sa SDL_GetWindowTitle() + * \sa SDL_HideWindow() + * \sa SDL_MaximizeWindow() + * \sa SDL_MinimizeWindow() + * \sa SDL_RaiseWindow() + * \sa SDL_RestoreWindow() + * \sa SDL_SetWindowData() + * \sa SDL_SetWindowFullscreen() + * \sa SDL_SetWindowGrab() + * \sa SDL_SetWindowIcon() + * \sa SDL_SetWindowPosition() + * \sa SDL_SetWindowSize() + * \sa SDL_SetWindowBordered() + * \sa SDL_SetWindowResizable() + * \sa SDL_SetWindowTitle() + * \sa SDL_ShowWindow() + */ +typedef struct SDL_Window SDL_Window; + +/** + * \brief The flags on a window + * + * \sa SDL_GetWindowFlags() + */ +typedef enum +{ + SDL_WINDOW_FULLSCREEN = 0x00000001, /**< fullscreen window */ + SDL_WINDOW_OPENGL = 0x00000002, /**< window usable with OpenGL context */ + SDL_WINDOW_SHOWN = 0x00000004, /**< window is visible */ + SDL_WINDOW_HIDDEN = 0x00000008, /**< window is not visible */ + SDL_WINDOW_BORDERLESS = 0x00000010, /**< no window decoration */ + SDL_WINDOW_RESIZABLE = 0x00000020, /**< window can be resized */ + SDL_WINDOW_MINIMIZED = 0x00000040, /**< window is minimized */ + SDL_WINDOW_MAXIMIZED = 0x00000080, /**< window is maximized */ + SDL_WINDOW_INPUT_GRABBED = 0x00000100, /**< window has grabbed input focus */ + SDL_WINDOW_INPUT_FOCUS = 0x00000200, /**< window has input focus */ + SDL_WINDOW_MOUSE_FOCUS = 0x00000400, /**< window has mouse focus */ + SDL_WINDOW_FULLSCREEN_DESKTOP = ( SDL_WINDOW_FULLSCREEN | 0x00001000 ), + SDL_WINDOW_FOREIGN = 0x00000800, /**< window not created by SDL */ + SDL_WINDOW_ALLOW_HIGHDPI = 0x00002000, /**< window should be created in high-DPI mode if supported. + On macOS NSHighResolutionCapable must be set true in the + application's Info.plist for this to have any effect. */ + SDL_WINDOW_MOUSE_CAPTURE = 0x00004000, /**< window has mouse captured (unrelated to INPUT_GRABBED) */ + SDL_WINDOW_ALWAYS_ON_TOP = 0x00008000, /**< window should always be above others */ + SDL_WINDOW_SKIP_TASKBAR = 0x00010000, /**< window should not be added to the taskbar */ + SDL_WINDOW_UTILITY = 0x00020000, /**< window should be treated as a utility window */ + SDL_WINDOW_TOOLTIP = 0x00040000, /**< window should be treated as a tooltip */ + SDL_WINDOW_POPUP_MENU = 0x00080000, /**< window should be treated as a popup menu */ + SDL_WINDOW_VULKAN = 0x10000000, /**< window usable for Vulkan surface */ + SDL_WINDOW_METAL = 0x20000000 /**< window usable for Metal view */ +} SDL_WindowFlags; + +/** + * \brief Used to indicate that you don't care what the window position is. + */ +#define SDL_WINDOWPOS_UNDEFINED_MASK 0x1FFF0000u +#define SDL_WINDOWPOS_UNDEFINED_DISPLAY(X) (SDL_WINDOWPOS_UNDEFINED_MASK|(X)) +#define SDL_WINDOWPOS_UNDEFINED SDL_WINDOWPOS_UNDEFINED_DISPLAY(0) +#define SDL_WINDOWPOS_ISUNDEFINED(X) \ + (((X)&0xFFFF0000) == SDL_WINDOWPOS_UNDEFINED_MASK) + +/** + * \brief Used to indicate that the window position should be centered. + */ +#define SDL_WINDOWPOS_CENTERED_MASK 0x2FFF0000u +#define SDL_WINDOWPOS_CENTERED_DISPLAY(X) (SDL_WINDOWPOS_CENTERED_MASK|(X)) +#define SDL_WINDOWPOS_CENTERED SDL_WINDOWPOS_CENTERED_DISPLAY(0) +#define SDL_WINDOWPOS_ISCENTERED(X) \ + (((X)&0xFFFF0000) == SDL_WINDOWPOS_CENTERED_MASK) + +/** + * \brief Event subtype for window events + */ +typedef enum +{ + SDL_WINDOWEVENT_NONE, /**< Never used */ + SDL_WINDOWEVENT_SHOWN, /**< Window has been shown */ + SDL_WINDOWEVENT_HIDDEN, /**< Window has been hidden */ + SDL_WINDOWEVENT_EXPOSED, /**< Window has been exposed and should be + redrawn */ + SDL_WINDOWEVENT_MOVED, /**< Window has been moved to data1, data2 + */ + SDL_WINDOWEVENT_RESIZED, /**< Window has been resized to data1xdata2 */ + SDL_WINDOWEVENT_SIZE_CHANGED, /**< The window size has changed, either as + a result of an API call or through the + system or user changing the window size. */ + SDL_WINDOWEVENT_MINIMIZED, /**< Window has been minimized */ + SDL_WINDOWEVENT_MAXIMIZED, /**< Window has been maximized */ + SDL_WINDOWEVENT_RESTORED, /**< Window has been restored to normal size + and position */ + SDL_WINDOWEVENT_ENTER, /**< Window has gained mouse focus */ + SDL_WINDOWEVENT_LEAVE, /**< Window has lost mouse focus */ + SDL_WINDOWEVENT_FOCUS_GAINED, /**< Window has gained keyboard focus */ + SDL_WINDOWEVENT_FOCUS_LOST, /**< Window has lost keyboard focus */ + SDL_WINDOWEVENT_CLOSE, /**< The window manager requests that the window be closed */ + SDL_WINDOWEVENT_TAKE_FOCUS, /**< Window is being offered a focus (should SetWindowInputFocus() on itself or a subwindow, or ignore) */ + SDL_WINDOWEVENT_HIT_TEST /**< Window had a hit test that wasn't SDL_HITTEST_NORMAL. */ +} SDL_WindowEventID; + +/** + * \brief Event subtype for display events + */ +typedef enum +{ + SDL_DISPLAYEVENT_NONE, /**< Never used */ + SDL_DISPLAYEVENT_ORIENTATION, /**< Display orientation has changed to data1 */ + SDL_DISPLAYEVENT_CONNECTED, /**< Display has been added to the system */ + SDL_DISPLAYEVENT_DISCONNECTED /**< Display has been removed from the system */ +} SDL_DisplayEventID; + +typedef enum +{ + SDL_ORIENTATION_UNKNOWN, /**< The display orientation can't be determined */ + SDL_ORIENTATION_LANDSCAPE, /**< The display is in landscape mode, with the right side up, relative to portrait mode */ + SDL_ORIENTATION_LANDSCAPE_FLIPPED, /**< The display is in landscape mode, with the left side up, relative to portrait mode */ + SDL_ORIENTATION_PORTRAIT, /**< The display is in portrait mode */ + SDL_ORIENTATION_PORTRAIT_FLIPPED /**< The display is in portrait mode, upside down */ +} SDL_DisplayOrientation; + +/** + * \brief An opaque handle to an OpenGL context. + */ +typedef void *SDL_GLContext; + +/** + * \brief OpenGL configuration attributes + */ +typedef enum +{ + SDL_GL_RED_SIZE, + SDL_GL_GREEN_SIZE, + SDL_GL_BLUE_SIZE, + SDL_GL_ALPHA_SIZE, + SDL_GL_BUFFER_SIZE, + SDL_GL_DOUBLEBUFFER, + SDL_GL_DEPTH_SIZE, + SDL_GL_STENCIL_SIZE, + SDL_GL_ACCUM_RED_SIZE, + SDL_GL_ACCUM_GREEN_SIZE, + SDL_GL_ACCUM_BLUE_SIZE, + SDL_GL_ACCUM_ALPHA_SIZE, + SDL_GL_STEREO, + SDL_GL_MULTISAMPLEBUFFERS, + SDL_GL_MULTISAMPLESAMPLES, + SDL_GL_ACCELERATED_VISUAL, + SDL_GL_RETAINED_BACKING, + SDL_GL_CONTEXT_MAJOR_VERSION, + SDL_GL_CONTEXT_MINOR_VERSION, + SDL_GL_CONTEXT_EGL, + SDL_GL_CONTEXT_FLAGS, + SDL_GL_CONTEXT_PROFILE_MASK, + SDL_GL_SHARE_WITH_CURRENT_CONTEXT, + SDL_GL_FRAMEBUFFER_SRGB_CAPABLE, + SDL_GL_CONTEXT_RELEASE_BEHAVIOR, + SDL_GL_CONTEXT_RESET_NOTIFICATION, + SDL_GL_CONTEXT_NO_ERROR +} SDL_GLattr; + +typedef enum +{ + SDL_GL_CONTEXT_PROFILE_CORE = 0x0001, + SDL_GL_CONTEXT_PROFILE_COMPATIBILITY = 0x0002, + SDL_GL_CONTEXT_PROFILE_ES = 0x0004 /**< GLX_CONTEXT_ES2_PROFILE_BIT_EXT */ +} SDL_GLprofile; + +typedef enum +{ + SDL_GL_CONTEXT_DEBUG_FLAG = 0x0001, + SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG = 0x0002, + SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG = 0x0004, + SDL_GL_CONTEXT_RESET_ISOLATION_FLAG = 0x0008 +} SDL_GLcontextFlag; + +typedef enum +{ + SDL_GL_CONTEXT_RELEASE_BEHAVIOR_NONE = 0x0000, + SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH = 0x0001 +} SDL_GLcontextReleaseFlag; + +typedef enum +{ + SDL_GL_CONTEXT_RESET_NO_NOTIFICATION = 0x0000, + SDL_GL_CONTEXT_RESET_LOSE_CONTEXT = 0x0001 +} SDL_GLContextResetNotification; + +/* Function prototypes */ + +/** + * \brief Get the number of video drivers compiled into SDL + * + * \sa SDL_GetVideoDriver() + */ +extern DECLSPEC int SDLCALL SDL_GetNumVideoDrivers(void); + +/** + * \brief Get the name of a built in video driver. + * + * \note The video drivers are presented in the order in which they are + * normally checked during initialization. + * + * \sa SDL_GetNumVideoDrivers() + */ +extern DECLSPEC const char *SDLCALL SDL_GetVideoDriver(int index); + +/** + * \brief Initialize the video subsystem, optionally specifying a video driver. + * + * \param driver_name Initialize a specific driver by name, or NULL for the + * default video driver. + * + * \return 0 on success, -1 on error + * + * This function initializes the video subsystem; setting up a connection + * to the window manager, etc, and determines the available display modes + * and pixel formats, but does not initialize a window or graphics mode. + * + * \sa SDL_VideoQuit() + */ +extern DECLSPEC int SDLCALL SDL_VideoInit(const char *driver_name); + +/** + * \brief Shuts down the video subsystem. + * + * This function closes all windows, and restores the original video mode. + * + * \sa SDL_VideoInit() + */ +extern DECLSPEC void SDLCALL SDL_VideoQuit(void); + +/** + * \brief Returns the name of the currently initialized video driver. + * + * \return The name of the current video driver or NULL if no driver + * has been initialized + * + * \sa SDL_GetNumVideoDrivers() + * \sa SDL_GetVideoDriver() + */ +extern DECLSPEC const char *SDLCALL SDL_GetCurrentVideoDriver(void); + +/** + * \brief Returns the number of available video displays. + * + * \sa SDL_GetDisplayBounds() + */ +extern DECLSPEC int SDLCALL SDL_GetNumVideoDisplays(void); + +/** + * \brief Get the name of a display in UTF-8 encoding + * + * \return The name of a display, or NULL for an invalid display index. + * + * \sa SDL_GetNumVideoDisplays() + */ +extern DECLSPEC const char * SDLCALL SDL_GetDisplayName(int displayIndex); + +/** + * \brief Get the desktop area represented by a display, with the primary + * display located at 0,0 + * + * \return 0 on success, or -1 if the index is out of range. + * + * \sa SDL_GetNumVideoDisplays() + */ +extern DECLSPEC int SDLCALL SDL_GetDisplayBounds(int displayIndex, SDL_Rect * rect); + +/** + * \brief Get the usable desktop area represented by a display, with the + * primary display located at 0,0 + * + * This is the same area as SDL_GetDisplayBounds() reports, but with portions + * reserved by the system removed. For example, on Mac OS X, this subtracts + * the area occupied by the menu bar and dock. + * + * Setting a window to be fullscreen generally bypasses these unusable areas, + * so these are good guidelines for the maximum space available to a + * non-fullscreen window. + * + * \return 0 on success, or -1 if the index is out of range. + * + * \sa SDL_GetDisplayBounds() + * \sa SDL_GetNumVideoDisplays() + */ +extern DECLSPEC int SDLCALL SDL_GetDisplayUsableBounds(int displayIndex, SDL_Rect * rect); + +/** + * \brief Get the dots/pixels-per-inch for a display + * + * \note Diagonal, horizontal and vertical DPI can all be optionally + * returned if the parameter is non-NULL. + * + * \return 0 on success, or -1 if no DPI information is available or the index is out of range. + * + * \sa SDL_GetNumVideoDisplays() + */ +extern DECLSPEC int SDLCALL SDL_GetDisplayDPI(int displayIndex, float * ddpi, float * hdpi, float * vdpi); + +/** + * \brief Get the orientation of a display + * + * \return The orientation of the display, or SDL_ORIENTATION_UNKNOWN if it isn't available. + * + * \sa SDL_GetNumVideoDisplays() + */ +extern DECLSPEC SDL_DisplayOrientation SDLCALL SDL_GetDisplayOrientation(int displayIndex); + +/** + * \brief Returns the number of available display modes. + * + * \sa SDL_GetDisplayMode() + */ +extern DECLSPEC int SDLCALL SDL_GetNumDisplayModes(int displayIndex); + +/** + * \brief Fill in information about a specific display mode. + * + * \note The display modes are sorted in this priority: + * \li bits per pixel -> more colors to fewer colors + * \li width -> largest to smallest + * \li height -> largest to smallest + * \li refresh rate -> highest to lowest + * + * \sa SDL_GetNumDisplayModes() + */ +extern DECLSPEC int SDLCALL SDL_GetDisplayMode(int displayIndex, int modeIndex, + SDL_DisplayMode * mode); + +/** + * \brief Fill in information about the desktop display mode. + */ +extern DECLSPEC int SDLCALL SDL_GetDesktopDisplayMode(int displayIndex, SDL_DisplayMode * mode); + +/** + * \brief Fill in information about the current display mode. + */ +extern DECLSPEC int SDLCALL SDL_GetCurrentDisplayMode(int displayIndex, SDL_DisplayMode * mode); + + +/** + * \brief Get the closest match to the requested display mode. + * + * \param displayIndex The index of display from which mode should be queried. + * \param mode The desired display mode + * \param closest A pointer to a display mode to be filled in with the closest + * match of the available display modes. + * + * \return The passed in value \c closest, or NULL if no matching video mode + * was available. + * + * The available display modes are scanned, and \c closest is filled in with the + * closest mode matching the requested mode and returned. The mode format and + * refresh_rate default to the desktop mode if they are 0. The modes are + * scanned with size being first priority, format being second priority, and + * finally checking the refresh_rate. If all the available modes are too + * small, then NULL is returned. + * + * \sa SDL_GetNumDisplayModes() + * \sa SDL_GetDisplayMode() + */ +extern DECLSPEC SDL_DisplayMode * SDLCALL SDL_GetClosestDisplayMode(int displayIndex, const SDL_DisplayMode * mode, SDL_DisplayMode * closest); + +/** + * \brief Get the display index associated with a window. + * + * \return the display index of the display containing the center of the + * window, or -1 on error. + */ +extern DECLSPEC int SDLCALL SDL_GetWindowDisplayIndex(SDL_Window * window); + +/** + * \brief Set the display mode used when a fullscreen window is visible. + * + * By default the window's dimensions and the desktop format and refresh rate + * are used. + * + * \param window The window for which the display mode should be set. + * \param mode The mode to use, or NULL for the default mode. + * + * \return 0 on success, or -1 if setting the display mode failed. + * + * \sa SDL_GetWindowDisplayMode() + * \sa SDL_SetWindowFullscreen() + */ +extern DECLSPEC int SDLCALL SDL_SetWindowDisplayMode(SDL_Window * window, + const SDL_DisplayMode + * mode); + +/** + * \brief Fill in information about the display mode used when a fullscreen + * window is visible. + * + * \sa SDL_SetWindowDisplayMode() + * \sa SDL_SetWindowFullscreen() + */ +extern DECLSPEC int SDLCALL SDL_GetWindowDisplayMode(SDL_Window * window, + SDL_DisplayMode * mode); + +/** + * \brief Get the pixel format associated with the window. + */ +extern DECLSPEC Uint32 SDLCALL SDL_GetWindowPixelFormat(SDL_Window * window); + +/** + * \brief Create a window with the specified position, dimensions, and flags. + * + * \param title The title of the window, in UTF-8 encoding. + * \param x The x position of the window, ::SDL_WINDOWPOS_CENTERED, or + * ::SDL_WINDOWPOS_UNDEFINED. + * \param y The y position of the window, ::SDL_WINDOWPOS_CENTERED, or + * ::SDL_WINDOWPOS_UNDEFINED. + * \param w The width of the window, in screen coordinates. + * \param h The height of the window, in screen coordinates. + * \param flags The flags for the window, a mask of any of the following: + * ::SDL_WINDOW_FULLSCREEN, ::SDL_WINDOW_OPENGL, + * ::SDL_WINDOW_HIDDEN, ::SDL_WINDOW_BORDERLESS, + * ::SDL_WINDOW_RESIZABLE, ::SDL_WINDOW_MAXIMIZED, + * ::SDL_WINDOW_MINIMIZED, ::SDL_WINDOW_INPUT_GRABBED, + * ::SDL_WINDOW_ALLOW_HIGHDPI, ::SDL_WINDOW_VULKAN + * ::SDL_WINDOW_METAL. + * + * \return The created window, or NULL if window creation failed. + * + * If the window is created with the SDL_WINDOW_ALLOW_HIGHDPI flag, its size + * in pixels may differ from its size in screen coordinates on platforms with + * high-DPI support (e.g. iOS and Mac OS X). Use SDL_GetWindowSize() to query + * the client area's size in screen coordinates, and SDL_GL_GetDrawableSize(), + * SDL_Vulkan_GetDrawableSize(), or SDL_GetRendererOutputSize() to query the + * drawable size in pixels. + * + * If the window is created with any of the SDL_WINDOW_OPENGL or + * SDL_WINDOW_VULKAN flags, then the corresponding LoadLibrary function + * (SDL_GL_LoadLibrary or SDL_Vulkan_LoadLibrary) is called and the + * corresponding UnloadLibrary function is called by SDL_DestroyWindow(). + * + * If SDL_WINDOW_VULKAN is specified and there isn't a working Vulkan driver, + * SDL_CreateWindow() will fail because SDL_Vulkan_LoadLibrary() will fail. + * + * If SDL_WINDOW_METAL is specified on an OS that does not support Metal, + * SDL_CreateWindow() will fail. + * + * \note On non-Apple devices, SDL requires you to either not link to the + * Vulkan loader or link to a dynamic library version. This limitation + * may be removed in a future version of SDL. + * + * \sa SDL_DestroyWindow() + * \sa SDL_GL_LoadLibrary() + * \sa SDL_Vulkan_LoadLibrary() + */ +extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindow(const char *title, + int x, int y, int w, + int h, Uint32 flags); + +/** + * \brief Create an SDL window from an existing native window. + * + * \param data A pointer to driver-dependent window creation data + * + * \return The created window, or NULL if window creation failed. + * + * \sa SDL_DestroyWindow() + */ +extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindowFrom(const void *data); + +/** + * \brief Get the numeric ID of a window, for logging purposes. + */ +extern DECLSPEC Uint32 SDLCALL SDL_GetWindowID(SDL_Window * window); + +/** + * \brief Get a window from a stored ID, or NULL if it doesn't exist. + */ +extern DECLSPEC SDL_Window * SDLCALL SDL_GetWindowFromID(Uint32 id); + +/** + * \brief Get the window flags. + */ +extern DECLSPEC Uint32 SDLCALL SDL_GetWindowFlags(SDL_Window * window); + +/** + * \brief Set the title of a window, in UTF-8 format. + * + * \sa SDL_GetWindowTitle() + */ +extern DECLSPEC void SDLCALL SDL_SetWindowTitle(SDL_Window * window, + const char *title); + +/** + * \brief Get the title of a window, in UTF-8 format. + * + * \sa SDL_SetWindowTitle() + */ +extern DECLSPEC const char *SDLCALL SDL_GetWindowTitle(SDL_Window * window); + +/** + * \brief Set the icon for a window. + * + * \param window The window for which the icon should be set. + * \param icon The icon for the window. + */ +extern DECLSPEC void SDLCALL SDL_SetWindowIcon(SDL_Window * window, + SDL_Surface * icon); + +/** + * \brief Associate an arbitrary named pointer with a window. + * + * \param window The window to associate with the pointer. + * \param name The name of the pointer. + * \param userdata The associated pointer. + * + * \return The previous value associated with 'name' + * + * \note The name is case-sensitive. + * + * \sa SDL_GetWindowData() + */ +extern DECLSPEC void* SDLCALL SDL_SetWindowData(SDL_Window * window, + const char *name, + void *userdata); + +/** + * \brief Retrieve the data pointer associated with a window. + * + * \param window The window to query. + * \param name The name of the pointer. + * + * \return The value associated with 'name' + * + * \sa SDL_SetWindowData() + */ +extern DECLSPEC void *SDLCALL SDL_GetWindowData(SDL_Window * window, + const char *name); + +/** + * \brief Set the position of a window. + * + * \param window The window to reposition. + * \param x The x coordinate of the window in screen coordinates, or + * ::SDL_WINDOWPOS_CENTERED or ::SDL_WINDOWPOS_UNDEFINED. + * \param y The y coordinate of the window in screen coordinates, or + * ::SDL_WINDOWPOS_CENTERED or ::SDL_WINDOWPOS_UNDEFINED. + * + * \note The window coordinate origin is the upper left of the display. + * + * \sa SDL_GetWindowPosition() + */ +extern DECLSPEC void SDLCALL SDL_SetWindowPosition(SDL_Window * window, + int x, int y); + +/** + * \brief Get the position of a window. + * + * \param window The window to query. + * \param x Pointer to variable for storing the x position, in screen + * coordinates. May be NULL. + * \param y Pointer to variable for storing the y position, in screen + * coordinates. May be NULL. + * + * \sa SDL_SetWindowPosition() + */ +extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_Window * window, + int *x, int *y); + +/** + * \brief Set the size of a window's client area. + * + * \param window The window to resize. + * \param w The width of the window, in screen coordinates. Must be >0. + * \param h The height of the window, in screen coordinates. Must be >0. + * + * \note Fullscreen windows automatically match the size of the display mode, + * and you should use SDL_SetWindowDisplayMode() to change their size. + * + * The window size in screen coordinates may differ from the size in pixels, if + * the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a platform with + * high-dpi support (e.g. iOS or OS X). Use SDL_GL_GetDrawableSize() or + * SDL_GetRendererOutputSize() to get the real client area size in pixels. + * + * \sa SDL_GetWindowSize() + * \sa SDL_SetWindowDisplayMode() + */ +extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_Window * window, int w, + int h); + +/** + * \brief Get the size of a window's client area. + * + * \param window The window to query. + * \param w Pointer to variable for storing the width, in screen + * coordinates. May be NULL. + * \param h Pointer to variable for storing the height, in screen + * coordinates. May be NULL. + * + * The window size in screen coordinates may differ from the size in pixels, if + * the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a platform with + * high-dpi support (e.g. iOS or OS X). Use SDL_GL_GetDrawableSize() or + * SDL_GetRendererOutputSize() to get the real client area size in pixels. + * + * \sa SDL_SetWindowSize() + */ +extern DECLSPEC void SDLCALL SDL_GetWindowSize(SDL_Window * window, int *w, + int *h); + +/** + * \brief Get the size of a window's borders (decorations) around the client area. + * + * \param window The window to query. + * \param top Pointer to variable for storing the size of the top border. NULL is permitted. + * \param left Pointer to variable for storing the size of the left border. NULL is permitted. + * \param bottom Pointer to variable for storing the size of the bottom border. NULL is permitted. + * \param right Pointer to variable for storing the size of the right border. NULL is permitted. + * + * \return 0 on success, or -1 if getting this information is not supported. + * + * \note if this function fails (returns -1), the size values will be + * initialized to 0, 0, 0, 0 (if a non-NULL pointer is provided), as + * if the window in question was borderless. + */ +extern DECLSPEC int SDLCALL SDL_GetWindowBordersSize(SDL_Window * window, + int *top, int *left, + int *bottom, int *right); + +/** + * \brief Set the minimum size of a window's client area. + * + * \param window The window to set a new minimum size. + * \param min_w The minimum width of the window, must be >0 + * \param min_h The minimum height of the window, must be >0 + * + * \note You can't change the minimum size of a fullscreen window, it + * automatically matches the size of the display mode. + * + * \sa SDL_GetWindowMinimumSize() + * \sa SDL_SetWindowMaximumSize() + */ +extern DECLSPEC void SDLCALL SDL_SetWindowMinimumSize(SDL_Window * window, + int min_w, int min_h); + +/** + * \brief Get the minimum size of a window's client area. + * + * \param window The window to query. + * \param w Pointer to variable for storing the minimum width, may be NULL + * \param h Pointer to variable for storing the minimum height, may be NULL + * + * \sa SDL_GetWindowMaximumSize() + * \sa SDL_SetWindowMinimumSize() + */ +extern DECLSPEC void SDLCALL SDL_GetWindowMinimumSize(SDL_Window * window, + int *w, int *h); + +/** + * \brief Set the maximum size of a window's client area. + * + * \param window The window to set a new maximum size. + * \param max_w The maximum width of the window, must be >0 + * \param max_h The maximum height of the window, must be >0 + * + * \note You can't change the maximum size of a fullscreen window, it + * automatically matches the size of the display mode. + * + * \sa SDL_GetWindowMaximumSize() + * \sa SDL_SetWindowMinimumSize() + */ +extern DECLSPEC void SDLCALL SDL_SetWindowMaximumSize(SDL_Window * window, + int max_w, int max_h); + +/** + * \brief Get the maximum size of a window's client area. + * + * \param window The window to query. + * \param w Pointer to variable for storing the maximum width, may be NULL + * \param h Pointer to variable for storing the maximum height, may be NULL + * + * \sa SDL_GetWindowMinimumSize() + * \sa SDL_SetWindowMaximumSize() + */ +extern DECLSPEC void SDLCALL SDL_GetWindowMaximumSize(SDL_Window * window, + int *w, int *h); + +/** + * \brief Set the border state of a window. + * + * This will add or remove the window's SDL_WINDOW_BORDERLESS flag and + * add or remove the border from the actual window. This is a no-op if the + * window's border already matches the requested state. + * + * \param window The window of which to change the border state. + * \param bordered SDL_FALSE to remove border, SDL_TRUE to add border. + * + * \note You can't change the border state of a fullscreen window. + * + * \sa SDL_GetWindowFlags() + */ +extern DECLSPEC void SDLCALL SDL_SetWindowBordered(SDL_Window * window, + SDL_bool bordered); + +/** + * \brief Set the user-resizable state of a window. + * + * This will add or remove the window's SDL_WINDOW_RESIZABLE flag and + * allow/disallow user resizing of the window. This is a no-op if the + * window's resizable state already matches the requested state. + * + * \param window The window of which to change the resizable state. + * \param resizable SDL_TRUE to allow resizing, SDL_FALSE to disallow. + * + * \note You can't change the resizable state of a fullscreen window. + * + * \sa SDL_GetWindowFlags() + */ +extern DECLSPEC void SDLCALL SDL_SetWindowResizable(SDL_Window * window, + SDL_bool resizable); + +/** + * \brief Show a window. + * + * \sa SDL_HideWindow() + */ +extern DECLSPEC void SDLCALL SDL_ShowWindow(SDL_Window * window); + +/** + * \brief Hide a window. + * + * \sa SDL_ShowWindow() + */ +extern DECLSPEC void SDLCALL SDL_HideWindow(SDL_Window * window); + +/** + * \brief Raise a window above other windows and set the input focus. + */ +extern DECLSPEC void SDLCALL SDL_RaiseWindow(SDL_Window * window); + +/** + * \brief Make a window as large as possible. + * + * \sa SDL_RestoreWindow() + */ +extern DECLSPEC void SDLCALL SDL_MaximizeWindow(SDL_Window * window); + +/** + * \brief Minimize a window to an iconic representation. + * + * \sa SDL_RestoreWindow() + */ +extern DECLSPEC void SDLCALL SDL_MinimizeWindow(SDL_Window * window); + +/** + * \brief Restore the size and position of a minimized or maximized window. + * + * \sa SDL_MaximizeWindow() + * \sa SDL_MinimizeWindow() + */ +extern DECLSPEC void SDLCALL SDL_RestoreWindow(SDL_Window * window); + +/** + * \brief Set a window's fullscreen state. + * + * \return 0 on success, or -1 if setting the display mode failed. + * + * \sa SDL_SetWindowDisplayMode() + * \sa SDL_GetWindowDisplayMode() + */ +extern DECLSPEC int SDLCALL SDL_SetWindowFullscreen(SDL_Window * window, + Uint32 flags); + +/** + * \brief Get the SDL surface associated with the window. + * + * \return The window's framebuffer surface, or NULL on error. + * + * A new surface will be created with the optimal format for the window, + * if necessary. This surface will be freed when the window is destroyed. + * + * \note You may not combine this with 3D or the rendering API on this window. + * + * \sa SDL_UpdateWindowSurface() + * \sa SDL_UpdateWindowSurfaceRects() + */ +extern DECLSPEC SDL_Surface * SDLCALL SDL_GetWindowSurface(SDL_Window * window); + +/** + * \brief Copy the window surface to the screen. + * + * \return 0 on success, or -1 on error. + * + * \sa SDL_GetWindowSurface() + * \sa SDL_UpdateWindowSurfaceRects() + */ +extern DECLSPEC int SDLCALL SDL_UpdateWindowSurface(SDL_Window * window); + +/** + * \brief Copy a number of rectangles on the window surface to the screen. + * + * \return 0 on success, or -1 on error. + * + * \sa SDL_GetWindowSurface() + * \sa SDL_UpdateWindowSurface() + */ +extern DECLSPEC int SDLCALL SDL_UpdateWindowSurfaceRects(SDL_Window * window, + const SDL_Rect * rects, + int numrects); + +/** + * \brief Set a window's input grab mode. + * + * \param window The window for which the input grab mode should be set. + * \param grabbed This is SDL_TRUE to grab input, and SDL_FALSE to release input. + * + * If the caller enables a grab while another window is currently grabbed, + * the other window loses its grab in favor of the caller's window. + * + * \sa SDL_GetWindowGrab() + */ +extern DECLSPEC void SDLCALL SDL_SetWindowGrab(SDL_Window * window, + SDL_bool grabbed); + +/** + * \brief Get a window's input grab mode. + * + * \return This returns SDL_TRUE if input is grabbed, and SDL_FALSE otherwise. + * + * \sa SDL_SetWindowGrab() + */ +extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowGrab(SDL_Window * window); + +/** + * \brief Get the window that currently has an input grab enabled. + * + * \return This returns the window if input is grabbed, and NULL otherwise. + * + * \sa SDL_SetWindowGrab() + */ +extern DECLSPEC SDL_Window * SDLCALL SDL_GetGrabbedWindow(void); + +/** + * \brief Set the brightness (gamma correction) for a window. + * + * \return 0 on success, or -1 if setting the brightness isn't supported. + * + * \sa SDL_GetWindowBrightness() + * \sa SDL_SetWindowGammaRamp() + */ +extern DECLSPEC int SDLCALL SDL_SetWindowBrightness(SDL_Window * window, float brightness); + +/** + * \brief Get the brightness (gamma correction) for a window. + * + * \return The last brightness value passed to SDL_SetWindowBrightness() + * + * \sa SDL_SetWindowBrightness() + */ +extern DECLSPEC float SDLCALL SDL_GetWindowBrightness(SDL_Window * window); + +/** + * \brief Set the opacity for a window + * + * \param window The window which will be made transparent or opaque + * \param opacity Opacity (0.0f - transparent, 1.0f - opaque) This will be + * clamped internally between 0.0f and 1.0f. + * + * \return 0 on success, or -1 if setting the opacity isn't supported. + * + * \sa SDL_GetWindowOpacity() + */ +extern DECLSPEC int SDLCALL SDL_SetWindowOpacity(SDL_Window * window, float opacity); + +/** + * \brief Get the opacity of a window. + * + * If transparency isn't supported on this platform, opacity will be reported + * as 1.0f without error. + * + * \param window The window in question. + * \param out_opacity Opacity (0.0f - transparent, 1.0f - opaque) + * + * \return 0 on success, or -1 on error (invalid window, etc). + * + * \sa SDL_SetWindowOpacity() + */ +extern DECLSPEC int SDLCALL SDL_GetWindowOpacity(SDL_Window * window, float * out_opacity); + +/** + * \brief Sets the window as a modal for another window (TODO: reconsider this function and/or its name) + * + * \param modal_window The window that should be modal + * \param parent_window The parent window + * + * \return 0 on success, or -1 otherwise. + */ +extern DECLSPEC int SDLCALL SDL_SetWindowModalFor(SDL_Window * modal_window, SDL_Window * parent_window); + +/** + * \brief Explicitly sets input focus to the window. + * + * You almost certainly want SDL_RaiseWindow() instead of this function. Use + * this with caution, as you might give focus to a window that's completely + * obscured by other windows. + * + * \param window The window that should get the input focus + * + * \return 0 on success, or -1 otherwise. + * \sa SDL_RaiseWindow() + */ +extern DECLSPEC int SDLCALL SDL_SetWindowInputFocus(SDL_Window * window); + +/** + * \brief Set the gamma ramp for a window. + * + * \param window The window for which the gamma ramp should be set. + * \param red The translation table for the red channel, or NULL. + * \param green The translation table for the green channel, or NULL. + * \param blue The translation table for the blue channel, or NULL. + * + * \return 0 on success, or -1 if gamma ramps are unsupported. + * + * Set the gamma translation table for the red, green, and blue channels + * of the video hardware. Each table is an array of 256 16-bit quantities, + * representing a mapping between the input and output for that channel. + * The input is the index into the array, and the output is the 16-bit + * gamma value at that index, scaled to the output color precision. + * + * \sa SDL_GetWindowGammaRamp() + */ +extern DECLSPEC int SDLCALL SDL_SetWindowGammaRamp(SDL_Window * window, + const Uint16 * red, + const Uint16 * green, + const Uint16 * blue); + +/** + * \brief Get the gamma ramp for a window. + * + * \param window The window from which the gamma ramp should be queried. + * \param red A pointer to a 256 element array of 16-bit quantities to hold + * the translation table for the red channel, or NULL. + * \param green A pointer to a 256 element array of 16-bit quantities to hold + * the translation table for the green channel, or NULL. + * \param blue A pointer to a 256 element array of 16-bit quantities to hold + * the translation table for the blue channel, or NULL. + * + * \return 0 on success, or -1 if gamma ramps are unsupported. + * + * \sa SDL_SetWindowGammaRamp() + */ +extern DECLSPEC int SDLCALL SDL_GetWindowGammaRamp(SDL_Window * window, + Uint16 * red, + Uint16 * green, + Uint16 * blue); + +/** + * \brief Possible return values from the SDL_HitTest callback. + * + * \sa SDL_HitTest + */ +typedef enum +{ + SDL_HITTEST_NORMAL, /**< Region is normal. No special properties. */ + SDL_HITTEST_DRAGGABLE, /**< Region can drag entire window. */ + SDL_HITTEST_RESIZE_TOPLEFT, + SDL_HITTEST_RESIZE_TOP, + SDL_HITTEST_RESIZE_TOPRIGHT, + SDL_HITTEST_RESIZE_RIGHT, + SDL_HITTEST_RESIZE_BOTTOMRIGHT, + SDL_HITTEST_RESIZE_BOTTOM, + SDL_HITTEST_RESIZE_BOTTOMLEFT, + SDL_HITTEST_RESIZE_LEFT +} SDL_HitTestResult; + +/** + * \brief Callback used for hit-testing. + * + * \sa SDL_SetWindowHitTest + */ +typedef SDL_HitTestResult (SDLCALL *SDL_HitTest)(SDL_Window *win, + const SDL_Point *area, + void *data); + +/** + * \brief Provide a callback that decides if a window region has special properties. + * + * Normally windows are dragged and resized by decorations provided by the + * system window manager (a title bar, borders, etc), but for some apps, it + * makes sense to drag them from somewhere else inside the window itself; for + * example, one might have a borderless window that wants to be draggable + * from any part, or simulate its own title bar, etc. + * + * This function lets the app provide a callback that designates pieces of + * a given window as special. This callback is run during event processing + * if we need to tell the OS to treat a region of the window specially; the + * use of this callback is known as "hit testing." + * + * Mouse input may not be delivered to your application if it is within + * a special area; the OS will often apply that input to moving the window or + * resizing the window and not deliver it to the application. + * + * Specifying NULL for a callback disables hit-testing. Hit-testing is + * disabled by default. + * + * Platforms that don't support this functionality will return -1 + * unconditionally, even if you're attempting to disable hit-testing. + * + * Your callback may fire at any time, and its firing does not indicate any + * specific behavior (for example, on Windows, this certainly might fire + * when the OS is deciding whether to drag your window, but it fires for lots + * of other reasons, too, some unrelated to anything you probably care about + * _and when the mouse isn't actually at the location it is testing_). + * Since this can fire at any time, you should try to keep your callback + * efficient, devoid of allocations, etc. + * + * \param window The window to set hit-testing on. + * \param callback The callback to call when doing a hit-test. + * \param callback_data An app-defined void pointer passed to the callback. + * \return 0 on success, -1 on error (including unsupported). + */ +extern DECLSPEC int SDLCALL SDL_SetWindowHitTest(SDL_Window * window, + SDL_HitTest callback, + void *callback_data); + +/** + * \brief Destroy a window. + */ +extern DECLSPEC void SDLCALL SDL_DestroyWindow(SDL_Window * window); + + +/** + * \brief Returns whether the screensaver is currently enabled (default off). + * + * \sa SDL_EnableScreenSaver() + * \sa SDL_DisableScreenSaver() + */ +extern DECLSPEC SDL_bool SDLCALL SDL_IsScreenSaverEnabled(void); + +/** + * \brief Allow the screen to be blanked by a screensaver + * + * \sa SDL_IsScreenSaverEnabled() + * \sa SDL_DisableScreenSaver() + */ +extern DECLSPEC void SDLCALL SDL_EnableScreenSaver(void); + +/** + * \brief Prevent the screen from being blanked by a screensaver + * + * \sa SDL_IsScreenSaverEnabled() + * \sa SDL_EnableScreenSaver() + */ +extern DECLSPEC void SDLCALL SDL_DisableScreenSaver(void); + + +/** + * \name OpenGL support functions + */ +/* @{ */ + +/** + * \brief Dynamically load an OpenGL library. + * + * \param path The platform dependent OpenGL library name, or NULL to open the + * default OpenGL library. + * + * \return 0 on success, or -1 if the library couldn't be loaded. + * + * This should be done after initializing the video driver, but before + * creating any OpenGL windows. If no OpenGL library is loaded, the default + * library will be loaded upon creation of the first OpenGL window. + * + * \note If you do this, you need to retrieve all of the GL functions used in + * your program from the dynamic library using SDL_GL_GetProcAddress(). + * + * \sa SDL_GL_GetProcAddress() + * \sa SDL_GL_UnloadLibrary() + */ +extern DECLSPEC int SDLCALL SDL_GL_LoadLibrary(const char *path); + +/** + * \brief Get the address of an OpenGL function. + */ +extern DECLSPEC void *SDLCALL SDL_GL_GetProcAddress(const char *proc); + +/** + * \brief Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary(). + * + * \sa SDL_GL_LoadLibrary() + */ +extern DECLSPEC void SDLCALL SDL_GL_UnloadLibrary(void); + +/** + * \brief Return true if an OpenGL extension is supported for the current + * context. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_GL_ExtensionSupported(const char + *extension); + +/** + * \brief Reset all previously set OpenGL context attributes to their default values + */ +extern DECLSPEC void SDLCALL SDL_GL_ResetAttributes(void); + +/** + * \brief Set an OpenGL window attribute before window creation. + * + * \return 0 on success, or -1 if the attribute could not be set. + */ +extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value); + +/** + * \brief Get the actual value for an attribute from the current context. + * + * \return 0 on success, or -1 if the attribute could not be retrieved. + * The integer at \c value will be modified in either case. + */ +extern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int *value); + +/** + * \brief Create an OpenGL context for use with an OpenGL window, and make it + * current. + * + * \sa SDL_GL_DeleteContext() + */ +extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_CreateContext(SDL_Window * + window); + +/** + * \brief Set up an OpenGL context for rendering into an OpenGL window. + * + * \note The context must have been created with a compatible window. + */ +extern DECLSPEC int SDLCALL SDL_GL_MakeCurrent(SDL_Window * window, + SDL_GLContext context); + +/** + * \brief Get the currently active OpenGL window. + */ +extern DECLSPEC SDL_Window* SDLCALL SDL_GL_GetCurrentWindow(void); + +/** + * \brief Get the currently active OpenGL context. + */ +extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_GetCurrentContext(void); + +/** + * \brief Get the size of a window's underlying drawable in pixels (for use + * with glViewport). + * + * \param window Window from which the drawable size should be queried + * \param w Pointer to variable for storing the width in pixels, may be NULL + * \param h Pointer to variable for storing the height in pixels, may be NULL + * + * This may differ from SDL_GetWindowSize() if we're rendering to a high-DPI + * drawable, i.e. the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a + * platform with high-DPI support (Apple calls this "Retina"), and not disabled + * by the SDL_HINT_VIDEO_HIGHDPI_DISABLED hint. + * + * \sa SDL_GetWindowSize() + * \sa SDL_CreateWindow() + */ +extern DECLSPEC void SDLCALL SDL_GL_GetDrawableSize(SDL_Window * window, int *w, + int *h); + +/** + * \brief Set the swap interval for the current OpenGL context. + * + * \param interval 0 for immediate updates, 1 for updates synchronized with the + * vertical retrace. If the system supports it, you may + * specify -1 to allow late swaps to happen immediately + * instead of waiting for the next retrace. + * + * \return 0 on success, or -1 if setting the swap interval is not supported. + * + * \sa SDL_GL_GetSwapInterval() + */ +extern DECLSPEC int SDLCALL SDL_GL_SetSwapInterval(int interval); + +/** + * \brief Get the swap interval for the current OpenGL context. + * + * \return 0 if there is no vertical retrace synchronization, 1 if the buffer + * swap is synchronized with the vertical retrace, and -1 if late + * swaps happen immediately instead of waiting for the next retrace. + * If the system can't determine the swap interval, or there isn't a + * valid current context, this will return 0 as a safe default. + * + * \sa SDL_GL_SetSwapInterval() + */ +extern DECLSPEC int SDLCALL SDL_GL_GetSwapInterval(void); + +/** + * \brief Swap the OpenGL buffers for a window, if double-buffering is + * supported. + */ +extern DECLSPEC void SDLCALL SDL_GL_SwapWindow(SDL_Window * window); + +/** + * \brief Delete an OpenGL context. + * + * \sa SDL_GL_CreateContext() + */ +extern DECLSPEC void SDLCALL SDL_GL_DeleteContext(SDL_GLContext context); + +/* @} *//* OpenGL support functions */ + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_video_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/SDL_vulkan.h b/MediaClient/MediaClient/sdl/include/SDL2/SDL_vulkan.h new file mode 100644 index 0000000..a3de1ce --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/SDL_vulkan.h @@ -0,0 +1,276 @@ +/* + Simple DirectMedia Layer + Copyright (C) 2017, Mark Callow + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_vulkan.h + * + * Header file for functions to creating Vulkan surfaces on SDL windows. + */ + +#ifndef SDL_vulkan_h_ +#define SDL_vulkan_h_ + +#include "SDL_video.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* Avoid including vulkan.h, don't define VkInstance if it's already included */ +#ifdef VULKAN_H_ +#define NO_SDL_VULKAN_TYPEDEFS +#endif +#ifndef NO_SDL_VULKAN_TYPEDEFS +#define VK_DEFINE_HANDLE(object) typedef struct object##_T* object; + +#if defined(__LP64__) || defined(_WIN64) || defined(__x86_64__) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__) +#define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef struct object##_T *object; +#else +#define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef uint64_t object; +#endif + +VK_DEFINE_HANDLE(VkInstance) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSurfaceKHR) + +#endif /* !NO_SDL_VULKAN_TYPEDEFS */ + +typedef VkInstance SDL_vulkanInstance; +typedef VkSurfaceKHR SDL_vulkanSurface; /* for compatibility with Tizen */ + +/** + * \name Vulkan support functions + * + * \note SDL_Vulkan_GetInstanceExtensions & SDL_Vulkan_CreateSurface API + * is compatable with Tizen's implementation of Vulkan in SDL. + */ +/* @{ */ + +/** + * \brief Dynamically load a Vulkan loader library. + * + * \param [in] path The platform dependent Vulkan loader library name, or + * \c NULL. + * + * \return \c 0 on success, or \c -1 if the library couldn't be loaded. + * + * If \a path is NULL SDL will use the value of the environment variable + * \c SDL_VULKAN_LIBRARY, if set, otherwise it loads the default Vulkan + * loader library. + * + * This should be called after initializing the video driver, but before + * creating any Vulkan windows. If no Vulkan loader library is loaded, the + * default library will be loaded upon creation of the first Vulkan window. + * + * \note It is fairly common for Vulkan applications to link with \a libvulkan + * instead of explicitly loading it at run time. This will work with + * SDL provided the application links to a dynamic library and both it + * and SDL use the same search path. + * + * \note If you specify a non-NULL \c path, an application should retrieve all + * of the Vulkan functions it uses from the dynamic library using + * \c SDL_Vulkan_GetVkGetInstanceProcAddr() unless you can guarantee + * \c path points to the same vulkan loader library the application + * linked to. + * + * \note On Apple devices, if \a path is NULL, SDL will attempt to find + * the vkGetInstanceProcAddr address within all the mach-o images of + * the current process. This is because it is fairly common for Vulkan + * applications to link with libvulkan (and historically MoltenVK was + * provided as a static library). If it is not found then, on macOS, SDL + * will attempt to load \c vulkan.framework/vulkan, \c libvulkan.1.dylib, + * followed by \c libvulkan.dylib, in that order. + * On iOS SDL will attempt to load \c libvulkan.dylib only. Applications + * using a dynamic framework or .dylib must ensure it is included in its + * application bundle. + * + * \note On non-Apple devices, application linking with a static libvulkan is + * not supported. Either do not link to the Vulkan loader or link to a + * dynamic library version. + * + * \note This function will fail if there are no working Vulkan drivers + * installed. + * + * \sa SDL_Vulkan_GetVkGetInstanceProcAddr() + * \sa SDL_Vulkan_UnloadLibrary() + */ +extern DECLSPEC int SDLCALL SDL_Vulkan_LoadLibrary(const char *path); + +/** + * \brief Get the address of the \c vkGetInstanceProcAddr function. + * + * \note This should be called after either calling SDL_Vulkan_LoadLibrary + * or creating an SDL_Window with the SDL_WINDOW_VULKAN flag. + */ +extern DECLSPEC void *SDLCALL SDL_Vulkan_GetVkGetInstanceProcAddr(void); + +/** + * \brief Unload the Vulkan loader library previously loaded by + * \c SDL_Vulkan_LoadLibrary(). + * + * \sa SDL_Vulkan_LoadLibrary() + */ +extern DECLSPEC void SDLCALL SDL_Vulkan_UnloadLibrary(void); + +/** + * \brief Get the names of the Vulkan instance extensions needed to create + * a surface with \c SDL_Vulkan_CreateSurface(). + * + * \param [in] \c NULL or window Window for which the required Vulkan instance + * extensions should be retrieved + * \param [in,out] pCount pointer to an \c unsigned related to the number of + * required Vulkan instance extensions + * \param [out] pNames \c NULL or a pointer to an array to be filled with the + * required Vulkan instance extensions + * + * \return \c SDL_TRUE on success, \c SDL_FALSE on error. + * + * If \a pNames is \c NULL, then the number of required Vulkan instance + * extensions is returned in pCount. Otherwise, \a pCount must point to a + * variable set to the number of elements in the \a pNames array, and on + * return the variable is overwritten with the number of names actually + * written to \a pNames. If \a pCount is less than the number of required + * extensions, at most \a pCount structures will be written. If \a pCount + * is smaller than the number of required extensions, \c SDL_FALSE will be + * returned instead of \c SDL_TRUE, to indicate that not all the required + * extensions were returned. + * + * \note If \c window is not NULL, it will be checked against its creation + * flags to ensure that the Vulkan flag is present. This parameter + * will be removed in a future major release. + * + * \note The returned list of extensions will contain \c VK_KHR_surface + * and zero or more platform specific extensions + * + * \note The extension names queried here must be enabled when calling + * VkCreateInstance, otherwise surface creation will fail. + * + * \note \c window should have been created with the \c SDL_WINDOW_VULKAN flag + * or be \c NULL + * + * \code + * unsigned int count; + * // get count of required extensions + * if(!SDL_Vulkan_GetInstanceExtensions(NULL, &count, NULL)) + * handle_error(); + * + * static const char *const additionalExtensions[] = + * { + * VK_EXT_DEBUG_REPORT_EXTENSION_NAME, // example additional extension + * }; + * size_t additionalExtensionsCount = sizeof(additionalExtensions) / sizeof(additionalExtensions[0]); + * size_t extensionCount = count + additionalExtensionsCount; + * const char **names = malloc(sizeof(const char *) * extensionCount); + * if(!names) + * handle_error(); + * + * // get names of required extensions + * if(!SDL_Vulkan_GetInstanceExtensions(NULL, &count, names)) + * handle_error(); + * + * // copy additional extensions after required extensions + * for(size_t i = 0; i < additionalExtensionsCount; i++) + * names[i + count] = additionalExtensions[i]; + * + * VkInstanceCreateInfo instanceCreateInfo = {}; + * instanceCreateInfo.enabledExtensionCount = extensionCount; + * instanceCreateInfo.ppEnabledExtensionNames = names; + * // fill in rest of instanceCreateInfo + * + * VkInstance instance; + * // create the Vulkan instance + * VkResult result = vkCreateInstance(&instanceCreateInfo, NULL, &instance); + * free(names); + * \endcode + * + * \sa SDL_Vulkan_CreateSurface() + */ +extern DECLSPEC SDL_bool SDLCALL SDL_Vulkan_GetInstanceExtensions(SDL_Window *window, + unsigned int *pCount, + const char **pNames); + +/** + * \brief Create a Vulkan rendering surface for a window. + * + * \param [in] window SDL_Window to which to attach the rendering surface. + * \param [in] instance handle to the Vulkan instance to use. + * \param [out] surface pointer to a VkSurfaceKHR handle to receive the + * handle of the newly created surface. + * + * \return \c SDL_TRUE on success, \c SDL_FALSE on error. + * + * \code + * VkInstance instance; + * SDL_Window *window; + * + * // create instance and window + * + * // create the Vulkan surface + * VkSurfaceKHR surface; + * if(!SDL_Vulkan_CreateSurface(window, instance, &surface)) + * handle_error(); + * \endcode + * + * \note \a window should have been created with the \c SDL_WINDOW_VULKAN flag. + * + * \note \a instance should have been created with the extensions returned + * by \c SDL_Vulkan_CreateSurface() enabled. + * + * \sa SDL_Vulkan_GetInstanceExtensions() + */ +extern DECLSPEC SDL_bool SDLCALL SDL_Vulkan_CreateSurface(SDL_Window *window, + VkInstance instance, + VkSurfaceKHR* surface); + +/** + * \brief Get the size of a window's underlying drawable in pixels (for use + * with setting viewport, scissor & etc). + * + * \param window SDL_Window from which the drawable size should be queried + * \param w Pointer to variable for storing the width in pixels, + * may be NULL + * \param h Pointer to variable for storing the height in pixels, + * may be NULL + * + * This may differ from SDL_GetWindowSize() if we're rendering to a high-DPI + * drawable, i.e. the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a + * platform with high-DPI support (Apple calls this "Retina"), and not disabled + * by the \c SDL_HINT_VIDEO_HIGHDPI_DISABLED hint. + * + * \note On macOS high-DPI support must be enabled for an application by + * setting NSHighResolutionCapable to true in its Info.plist. + * + * \sa SDL_GetWindowSize() + * \sa SDL_CreateWindow() + */ +extern DECLSPEC void SDLCALL SDL_Vulkan_GetDrawableSize(SDL_Window * window, + int *w, int *h); + +/* @} *//* Vulkan support functions */ + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_vulkan_h_ */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/begin_code.h b/MediaClient/MediaClient/sdl/include/SDL2/begin_code.h new file mode 100644 index 0000000..1ca40cc --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/begin_code.h @@ -0,0 +1,166 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file begin_code.h + * + * This file sets things up for C dynamic library function definitions, + * static inlined functions, and structures aligned at 4-byte alignment. + * If you don't like ugly C preprocessor code, don't look at this file. :) + */ + +/* This shouldn't be nested -- included it around code only. */ +#ifdef _begin_code_h +#error Nested inclusion of begin_code.h +#endif +#define _begin_code_h + +#ifndef SDL_DEPRECATED +# if (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */ +# define SDL_DEPRECATED __attribute__((deprecated)) +# else +# define SDL_DEPRECATED +# endif +#endif + +#ifndef SDL_UNUSED +# ifdef __GNUC__ +# define SDL_UNUSED __attribute__((unused)) +# else +# define SDL_UNUSED +# endif +#endif + +/* Some compilers use a special export keyword */ +#ifndef DECLSPEC +# if defined(__WIN32__) || defined(__WINRT__) || defined(__CYGWIN__) +# ifdef DLL_EXPORT +# define DECLSPEC __declspec(dllexport) +# else +# define DECLSPEC +# endif +# elif defined(__OS2__) +# ifdef BUILD_SDL +# define DECLSPEC __declspec(dllexport) +# else +# define DECLSPEC +# endif +# else +# if defined(__GNUC__) && __GNUC__ >= 4 +# define DECLSPEC __attribute__ ((visibility("default"))) +# else +# define DECLSPEC +# endif +# endif +#endif + +/* By default SDL uses the C calling convention */ +#ifndef SDLCALL +#if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__) +#define SDLCALL __cdecl +#elif defined(__OS2__) || defined(__EMX__) +#define SDLCALL _System +# if defined (__GNUC__) && !defined(_System) +# define _System /* for old EMX/GCC compat. */ +# endif +#else +#define SDLCALL +#endif +#endif /* SDLCALL */ + +/* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */ +#ifdef __SYMBIAN32__ +#undef DECLSPEC +#define DECLSPEC +#endif /* __SYMBIAN32__ */ + +/* Force structure packing at 4 byte alignment. + This is necessary if the header is included in code which has structure + packing set to an alternate value, say for loading structures from disk. + The packing is reset to the previous value in close_code.h + */ +#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) +#ifdef _MSC_VER +#pragma warning(disable: 4103) +#endif +#ifdef __clang__ +#pragma clang diagnostic ignored "-Wpragma-pack" +#endif +#ifdef __BORLANDC__ +#pragma nopackwarning +#endif +#ifdef _M_X64 +/* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */ +#pragma pack(push,8) +#else +#pragma pack(push,4) +#endif +#endif /* Compiler needs structure packing set */ + +#ifndef SDL_INLINE +#if defined(__GNUC__) +#define SDL_INLINE __inline__ +#elif defined(_MSC_VER) || defined(__BORLANDC__) || \ + defined(__DMC__) || defined(__SC__) || \ + defined(__WATCOMC__) || defined(__LCC__) || \ + defined(__DECC) || defined(__CC_ARM) +#define SDL_INLINE __inline +#ifndef __inline__ +#define __inline__ __inline +#endif +#else +#define SDL_INLINE inline +#ifndef __inline__ +#define __inline__ inline +#endif +#endif +#endif /* SDL_INLINE not defined */ + +#ifndef SDL_FORCE_INLINE +#if defined(_MSC_VER) +#define SDL_FORCE_INLINE __forceinline +#elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) ) +#define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__ +#else +#define SDL_FORCE_INLINE static SDL_INLINE +#endif +#endif /* SDL_FORCE_INLINE not defined */ + +#ifndef SDL_NORETURN +#if defined(__GNUC__) +#define SDL_NORETURN __attribute__((noreturn)) +#elif defined(_MSC_VER) +#define SDL_NORETURN __declspec(noreturn) +#else +#define SDL_NORETURN +#endif +#endif /* SDL_NORETURN not defined */ + +/* Apparently this is needed by several Windows compilers */ +#if !defined(__MACH__) +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif /* NULL */ +#endif /* ! Mac OS X - breaks precompiled headers */ diff --git a/MediaClient/MediaClient/sdl/include/SDL2/close_code.h b/MediaClient/MediaClient/sdl/include/SDL2/close_code.h new file mode 100644 index 0000000..6aa411b --- /dev/null +++ b/MediaClient/MediaClient/sdl/include/SDL2/close_code.h @@ -0,0 +1,40 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2020 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file close_code.h + * + * This file reverses the effects of begin_code.h and should be included + * after you finish any function and structure declarations in your headers + */ + +#ifndef _begin_code_h +#error close_code.h included without matching begin_code.h +#endif +#undef _begin_code_h + +/* Reset structure packing at previous byte alignment */ +#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) +#ifdef __BORLANDC__ +#pragma nopackwarning +#endif +#pragma pack(pop) +#endif /* Compiler needs structure packing set */ diff --git a/MediaClient/MediaClient/sdl/lib/linux/libSDL2-2.0.so.0.14.0 b/MediaClient/MediaClient/sdl/lib/linux/libSDL2-2.0.so.0.14.0 new file mode 100644 index 0000000..c13efc6 Binary files /dev/null and b/MediaClient/MediaClient/sdl/lib/linux/libSDL2-2.0.so.0.14.0 differ diff --git a/MediaClient/MediaClient/srt/srt_cln.cpp b/MediaClient/MediaClient/srt/srt_cln.cpp new file mode 100644 index 0000000..df0f9fb --- /dev/null +++ b/MediaClient/MediaClient/srt/srt_cln.cpp @@ -0,0 +1,687 @@ +/*************************************************************************************** + * + * 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 "srt_cln.h" +#include "h264.h" +#include "h265.h" +#include "media_format.h" +#include "bs.h" +#include "media_util.h" + + +void * srt_rx_thread(void * argv) +{ + CSrtClient * pSrtClient = (CSrtClient *) argv; + + pSrtClient->rx_thread(); + + return NULL; +} + +void ts_payload_cb(uint8 * data, uint32 size, uint32 type, uint64 pts, void * userdata) +{ + CSrtClient * pSrtClient = (CSrtClient *) userdata; + + pSrtClient->srt_payload_cb(data, size, type, pts); +} + +CSrtClient::CSrtClient() +: m_nport(0) +, m_fd(0) +, m_eid(0) +, m_bRunning(FALSE) +, m_bVideoReady(FALSE) +, m_bAudioReady(FALSE) +, m_tidRx(0) +, m_nVpsLen(0) +, m_nSpsLen(0) +, m_nPpsLen(0) +, m_nAudioConfigLen(0) +, m_nVideoCodec(VIDEO_CODEC_NONE) +, m_nWidth(0) +, m_nHeight(0) +, m_nFrameRate(0) +, m_nAudioCodec(AUDIO_CODEC_NONE) +, m_nSamplerate(44100) +, m_nChannels(2) +, m_nVideoInitTS(0) +, m_nAudioInitTS(0) +, m_pNotify(NULL) +, m_pUserdata(NULL) +, m_pVideoCB(NULL) +, m_pAudioCB(NULL) +{ + memset(m_url, 0, sizeof(m_url)); + memset(m_user, 0, sizeof(m_user)); + memset(m_pass, 0, sizeof(m_pass)); + memset(m_ip, 0, sizeof(m_ip)); + memset(m_streamid, 0, sizeof(m_streamid)); + + memset(&m_pVps, 0, sizeof(m_pVps)); + memset(&m_pSps, 0, sizeof(m_pVps)); + memset(&m_pPps, 0, sizeof(m_pVps)); + memset(&m_pAudioConfig, 0, sizeof(m_pAudioConfig)); + + m_pMutex = sys_os_create_mutex(); + + m_nRxTimeout = 10; // default 10s timeout + + ts_parser_init(&m_tsParser); + + ts_parser_set_cb(&m_tsParser, ts_payload_cb, this); +} + +CSrtClient::~CSrtClient() +{ + srt_close(); + + if (m_pMutex) + { + sys_os_destroy_sig_mutex(m_pMutex); + m_pMutex = NULL; + } + + ts_parser_free(&m_tsParser); +} + +BOOL CSrtClient::srt_start(const char * url, const char * user, const char * pass) +{ + int port = 0; + char proto[32], username[64], password[64], host[100], path[200]; + + url_split(url, proto, sizeof(proto), username, sizeof(username), + password, sizeof(password), host, sizeof(host), &port, path, sizeof(path)); + + if (strcasecmp(proto, "srt") != 0) + { + return FALSE; + } + + if (port <= 0) + { + return FALSE; + } + + if (host[0] == '\0') + { + return FALSE; + } + + m_nport = port; + + strncpy(m_ip, host, sizeof(m_ip) - 1); + + char * p = strstr(path, "streamid"); + if (p) + { + p += strlen("streamid="); + strncpy(m_streamid, p, sizeof(m_streamid)-1); + } + + if (url && url[0] != '\0') + { + strncpy(m_url, url, sizeof(m_url)-1); + } + + if (user && user[0] != '\0') + { + strncpy(m_user, user, sizeof(m_user)-1); + } + + if (pass && pass[0] != '\0') + { + strncpy(m_pass, pass, sizeof(m_pass)-1); + } + + log_print(HT_LOG_INFO, "%s, url=%s, ip=%s, port=%d, streamid=%s\r\n", + __FUNCTION__, m_url, m_ip, m_nport, m_streamid); + + m_bRunning = TRUE; + m_tidRx = sys_os_create_thread((void *)srt_rx_thread, this); + + return TRUE; +} + +BOOL CSrtClient::srt_play() +{ + return TRUE; +} + +BOOL CSrtClient::srt_stop() +{ + return srt_close(); +} + +BOOL CSrtClient::srt_pause() +{ + return FALSE; +} + +BOOL CSrtClient::srt_close() +{ + sys_os_mutex_enter(m_pMutex); + m_pAudioCB = NULL; + m_pVideoCB = NULL; + m_pNotify = NULL; + m_pUserdata = NULL; + sys_os_mutex_leave(m_pMutex); + + m_bRunning = FALSE; + + while (m_tidRx) + { + usleep(10*1000); + } + + if (m_fd) + { + ::srt_close(m_fd); + m_fd = 0; + } + + if (m_eid) + { + srt_epoll_release(m_eid); + m_eid = 0; + } + + m_bVideoReady = FALSE; + m_bAudioReady = FALSE; + + return TRUE; +} + +BOOL CSrtClient::srt_connect() +{ + srt_send_notify(SRT_EVE_CONNECTING); + + SRTSOCKET fd = srt_create_socket(); + + if (srt_setsockopt(fd, 0, SRTO_STREAMID, m_streamid, strlen(m_streamid)) < 0) + { + log_print(HT_LOG_ERR, "%s, srt_setsockopt SRTO_STREAMID failure. err=%s\r\n", + __FUNCTION__, srt_getlasterror_str()); + ::srt_close(fd); + return FALSE; + } + + struct sockaddr_in sa; + memset(&sa, 0, sizeof sa); + sa.sin_family = AF_INET; + sa.sin_port = htons(m_nport); + sa.sin_addr.s_addr = get_address_by_name(m_ip); + + struct sockaddr *psa = (struct sockaddr *) &sa; + + int status = ::srt_connect(fd, psa, sizeof sa); + if (status == SRT_ERROR) + { + log_print(HT_LOG_ERR, "%s, srt_connect failure. ip=%s, port=%d\r\n", + __FUNCTION__, m_ip, m_nport); + ::srt_close(fd); + return FALSE; + } + + m_eid = srt_epoll_create(); + + int modes = SRT_EPOLL_IN | SRT_EPOLL_ERR; + + int ret = srt_epoll_add_usock(m_eid, fd, &modes); + if (ret < 0) + { + log_print(HT_LOG_ERR, "%s, srt_epoll_add_usock failed, epoll=%d, fd=%d, modes=%d, %s\r\n", + __FUNCTION__, m_eid, fd, modes, srt_getlasterror_str()); + ::srt_close(fd); + return FALSE; + } + + m_fd = fd; + + return TRUE; +} + +void CSrtClient::rx_thread() +{ + if (!srt_connect()) + { + m_tidRx = 0; + srt_send_notify(SRT_EVE_CONNFAIL); + return; + } + +#define TS_UDP_LEN 1316 //7*188 + + int tm_count = 0; + BOOL nodata_notify = FALSE; + char buff[TS_UDP_LEN]; + + while (m_bRunning) + { + SRTSOCKET read_socks[1]; + int read_len = 1; + + int ret = srt_epoll_wait(m_eid, read_socks, &read_len, NULL, NULL, 1000, 0, 0, 0, 0); + if (ret < 0) + { + ret = srt_getlasterror(NULL); + if (ret == SRT_ETIMEOUT) + { + tm_count++; + if (tm_count >= m_nRxTimeout && !nodata_notify) // in 10s without data + { + nodata_notify = TRUE; + srt_send_notify(SRT_EVE_NODATA); + } + + continue; + } + else + { + log_print(HT_LOG_ERR, "%s, srt_epoll_wait failed. err=%d\r\n", __FUNCTION__, ret); + break; + } + } + + if (read_len <= 0) + { + continue; + } + + SRT_SOCKSTATUS status = srt_getsockstate(m_fd); + if (status == SRTS_BROKEN || + status == SRTS_NONEXIST || + status == SRTS_CLOSED) + { + srt_epoll_remove_usock(m_eid, m_fd); + break; + } + + ret = srt_recvmsg(m_fd, buff, TS_UDP_LEN); + if (ret < 0) + { + log_print(HT_LOG_WARN, "%s, srt_recvmsg failed, sock=%d, ret=%d, err=%s\r\n", + __FUNCTION__, m_fd, ret, srt_getlasterror_str()); + continue; + } + + if (nodata_notify) + { + nodata_notify = FALSE; + srt_send_notify(SRT_EVE_RESUME); + } + + tm_count = 0; + + ts_parser_parse(&m_tsParser, (uint8*)buff, ret); + } + + m_tidRx = 0; + + srt_send_notify(SRT_EVE_STOPPED); +} + +void CSrtClient::srt_send_notify(int event) +{ + sys_os_mutex_enter(m_pMutex); + + if (m_pNotify) + { + m_pNotify(event, m_pUserdata); + } + + sys_os_mutex_leave(m_pMutex); +} + +void CSrtClient::srt_h264_rx(uint8 * p_data, uint32 len, uint64 pts) +{ + int s_len = 0, n_len = 0, parse_len = len; + uint8 nalu_t; + uint8 * p_cur = p_data; + uint8 * p_end = p_data + len; + + while (p_cur && p_cur < p_end && parse_len > 0) + { + uint8 * p_next = avc_split_nalu(p_cur, parse_len, &s_len, &n_len); + + nalu_t = (p_cur[s_len] & 0x1F); + + if (nalu_t == H264_NAL_SPS && m_nSpsLen == 0) + { + if (n_len <= (int)sizeof(m_pSps)) + { + memcpy(m_pSps, p_cur, n_len); + m_nSpsLen = n_len; + } + + video_data_cb(p_cur, n_len, pts); + } + else if (nalu_t == H264_NAL_PPS && m_nPpsLen == 0) + { + if (n_len <= (int)sizeof(m_pPps)) + { + memcpy(m_pPps, p_cur, n_len); + m_nPpsLen = n_len; + } + + video_data_cb(p_cur, n_len, pts); + } + else if (nalu_t == H264_NAL_AUD || nalu_t == H264_NAL_SEI) + { + // skip + } + else + { + video_data_cb(p_cur, n_len, pts); + } + + parse_len -= n_len; + p_cur = p_next; + } +} + +void CSrtClient::srt_h265_rx(uint8 * p_data, uint32 len, uint64 pts) +{ + int s_len = 0, n_len = 0, parse_len = len; + uint8 nalu_t; + uint8 * p_cur = p_data; + uint8 * p_end = p_data + len; + + while (p_cur && p_cur < p_end && parse_len > 0) + { + uint8 * p_next = avc_split_nalu(p_cur, parse_len, &s_len, &n_len); + + nalu_t = (p_cur[s_len] >> 1) & 0x3F; + + if (nalu_t == HEVC_NAL_VPS && m_nVpsLen == 0) + { + if (n_len <= (int)sizeof(m_pVps)) + { + memcpy(m_pVps, p_cur, n_len); + m_nVpsLen = n_len; + } + + video_data_cb(p_cur, n_len, pts); + } + else if (nalu_t == HEVC_NAL_SPS && m_nSpsLen == 0) + { + if (n_len <= (int)sizeof(m_pSps)) + { + memcpy(m_pSps, p_cur, n_len); + m_nSpsLen = n_len; + } + + video_data_cb(p_cur, n_len, pts); + } + else if (nalu_t == HEVC_NAL_PPS && m_nPpsLen == 0) + { + if (n_len <= (int)sizeof(m_pPps)) + { + memcpy(m_pPps, p_cur, n_len); + m_nPpsLen = n_len; + } + + video_data_cb(p_cur, n_len, pts); + } + else if (nalu_t == HEVC_NAL_AUD || + nalu_t == HEVC_NAL_SEI_PREFIX || + nalu_t == HEVC_NAL_SEI_SUFFIX) + { + // skip + } + else + { + video_data_cb(p_cur, n_len, pts); + } + + parse_len -= n_len; + p_cur = p_next; + } +} + +BOOL CSrtClient::srt_parse_adts(uint8 * p_data, uint32 len) +{ + bs_t bs; + bs_init(&bs, p_data, len); + + if (bs_read(&bs, 12) != 0xfff) + { + return FALSE; + } + + const int audio_sample_rates[16] = { + 96000, 88200, 64000, 48000, 44100, 32000, + 24000, 22050, 16000, 12000, 11025, 8000, 7350 + }; + + int sr, ch, size; + + bs_skip(&bs, 1); /* id */ + bs_skip(&bs, 2); /* layer */ + bs_skip(&bs, 1); /* protection_absent */ + bs_skip(&bs, 2); /* profile_objecttype */ + sr = bs_read(&bs, 4); /* sample_frequency_index */ + if (!audio_sample_rates[sr]) + { + return FALSE; + } + + bs_skip(&bs, 1); /* private_bit */ + ch = bs_read(&bs, 3); /* channel_configuration */ + + bs_skip(&bs, 1); /* original/copy */ + bs_skip(&bs, 1); /* home */ + + /* adts_variable_header */ + bs_skip(&bs, 1); /* copyright_identification_bit */ + bs_skip(&bs, 1); /* copyright_identification_start */ + size = bs_read(&bs, 13); /* aac_frame_length */ + if (size < 7) + { + return FALSE; + } + + bs_skip(&bs, 11); /* adts_buffer_fullness */ + bs_skip(&bs, 2); /* number_of_raw_data_blocks_in_frame */ + + m_nSamplerate = audio_sample_rates[sr]; + m_nChannels = ch; + + return TRUE; +} + +void CSrtClient::srt_payload_cb(uint8 * p_data, uint32 len, uint32 type, uint64 pts) +{ + if (type == TS_VIDEO_H264) + { + if (!m_bVideoReady) + { + m_nVideoCodec = VIDEO_CODEC_H264; + m_bVideoReady = TRUE; + srt_send_notify(SRT_EVE_VIDEOREADY); + } + + srt_h264_rx(p_data, len, pts); + } + else if (type == TS_VIDEO_HEVC) + { + if (!m_bVideoReady) + { + m_nVideoCodec = VIDEO_CODEC_H265; + m_bVideoReady = TRUE; + srt_send_notify(SRT_EVE_VIDEOREADY); + } + + srt_h265_rx(p_data, len, pts); + } + else if (type == TS_VIDEO_MPEG4) + { + if (!m_bVideoReady) + { + m_nVideoCodec = VIDEO_CODEC_MP4; + m_bVideoReady = TRUE; + srt_send_notify(SRT_EVE_VIDEOREADY); + } + + video_data_cb(p_data, len, pts); + } + else if (type == TS_AUDIO_AAC) + { + if (!m_bAudioReady) + { + srt_parse_adts(p_data, len); + + m_nAudioCodec = AUDIO_CODEC_AAC; + m_bAudioReady = TRUE; + srt_send_notify(SRT_EVE_AUDIOREADY); + } + + audio_data_cb(p_data, len, pts); + } +} + +void CSrtClient::video_data_cb(uint8 * p_data, int len, uint32 ts) +{ + if (m_nVideoInitTS == 0 && ts != 0) + { + m_nVideoInitTS = ts; + } + + sys_os_mutex_enter(m_pMutex); + if (m_pVideoCB) + { + m_pVideoCB(p_data, len, ts, m_pUserdata); + } + sys_os_mutex_leave(m_pMutex); +} + +void CSrtClient::audio_data_cb(uint8 * p_data, int len, uint32 ts) +{ + if (m_nAudioInitTS == 0 && ts != 0) + { + m_nAudioInitTS = ts; + } + + sys_os_mutex_enter(m_pMutex); + if (m_pAudioCB) + { + m_pAudioCB(p_data, len, ts, m_pUserdata); + } + sys_os_mutex_leave(m_pMutex); +} + +void CSrtClient::get_h264_params() +{ + if (m_nSpsLen > 0) + { + video_data_cb(m_pSps, m_nSpsLen, 0); + } + + if (m_nPpsLen > 0) + { + video_data_cb(m_pPps, m_nPpsLen, 0); + } +} + +BOOL CSrtClient::get_h264_params(uint8 * p_sps, int * sps_len, uint8 * p_pps, int * pps_len) +{ + if (m_nSpsLen > 0) + { + *sps_len = m_nSpsLen; + memcpy(p_sps, m_pSps, m_nSpsLen); + } + + if (m_nPpsLen > 0) + { + *pps_len = m_nPpsLen; + memcpy(p_pps, m_pPps, m_nPpsLen); + } + + return TRUE; +} + +void CSrtClient::get_h265_params() +{ + if (m_nVpsLen > 0) + { + video_data_cb(m_pVps, m_nVpsLen, 0); + } + + if (m_nSpsLen > 0) + { + video_data_cb(m_pSps, m_nSpsLen, 0); + } + + if (m_nPpsLen > 0) + { + video_data_cb(m_pPps, m_nPpsLen, 0); + } +} + +BOOL CSrtClient::get_h265_params(uint8 * p_sps, int * sps_len, uint8 * p_pps, int * pps_len, uint8 * p_vps, int * vps_len) +{ + if (m_nVpsLen > 0) + { + *vps_len = m_nVpsLen; + memcpy(p_vps, m_pVps, m_nVpsLen); + } + + if (m_nSpsLen > 0) + { + *sps_len = m_nSpsLen; + memcpy(p_sps, m_pSps, m_nSpsLen); + } + + if (m_nPpsLen > 0) + { + *pps_len = m_nPpsLen; + memcpy(p_pps, m_pPps, m_nPpsLen); + } + + return TRUE; +} + +void CSrtClient::set_notify_cb(srt_notify_cb notify, void * userdata) +{ + sys_os_mutex_enter(m_pMutex); + m_pNotify = notify; + m_pUserdata = userdata; + sys_os_mutex_leave(m_pMutex); +} + +void CSrtClient::set_video_cb(srt_video_cb cb) +{ + sys_os_mutex_enter(m_pMutex); + m_pVideoCB = cb; + sys_os_mutex_leave(m_pMutex); +} + +void CSrtClient::set_audio_cb(srt_audio_cb cb) +{ + sys_os_mutex_enter(m_pMutex); + m_pAudioCB = cb; + sys_os_mutex_leave(m_pMutex); +} + +void CSrtClient::set_rx_timeout(int timeout) +{ + m_nRxTimeout = timeout; +} + + diff --git a/MediaClient/MediaClient/srt/srt_cln.h b/MediaClient/MediaClient/srt/srt_cln.h new file mode 100644 index 0000000..91ef37c --- /dev/null +++ b/MediaClient/MediaClient/srt/srt_cln.h @@ -0,0 +1,146 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef SRT_CLN_H +#define SRT_CLN_H + +#include "srt/srt.h" +#include "h264.h" +#include "ts_parser.h" + + +#define SRT_EVE_STOPPED 60 +#define SRT_EVE_CONNECTING 61 +#define SRT_EVE_CONNFAIL 62 +#define SRT_EVE_NOSIGNAL 63 +#define SRT_EVE_RESUME 64 +#define SRT_EVE_AUTHFAILED 65 +#define SRT_EVE_NODATA 66 +#define SRT_EVE_VIDEOREADY 67 +#define SRT_EVE_AUDIOREADY 68 + + +#define DEF_BUFTIME (10 * 60 * 60 * 1000) /* 10 hours default */ + +typedef int (*srt_notify_cb)(int, void *); +typedef int (*srt_video_cb)(uint8 *, int, uint32, void *); +typedef int (*srt_audio_cb)(uint8 *, int, uint32, void *); + + +class CSrtClient +{ +public: + CSrtClient(void); + ~CSrtClient(void); + +public: + BOOL srt_start(const char * url, const char * user, const char * pass); + BOOL srt_play(); + BOOL srt_stop(); + BOOL srt_pause(); + BOOL srt_close(); + + char * get_url() {return m_url;} + char * get_user() {return m_user;} + char * get_pass() {return m_pass;} + int audio_codec() {return m_nAudioCodec;} + int video_codec() {return m_nVideoCodec;} + void get_h264_params(); + BOOL get_h264_params(uint8 * p_sps, int * sps_len, uint8 * p_pps, int * pps_len); + void get_h265_params(); + BOOL get_h265_params(uint8 * p_sps, int * sps_len, uint8 * p_pps, int * pps_len, uint8 * p_vps, int * vps_len); + int get_video_width() {return m_nWidth;} + int get_video_height() {return m_nHeight;} + double get_video_framerate() {return m_nFrameRate;} + int get_audio_samplerate() {return m_nSamplerate;} + int get_audio_channels() {return m_nChannels;} + uint8 * get_audio_config() {return m_pAudioConfig;} + int get_audio_config_len() {return m_nAudioConfigLen;} + uint32 get_video_init_ts() {return m_nVideoInitTS;} + uint32 get_audio_init_ts() {return m_nAudioInitTS;} + + void set_notify_cb(srt_notify_cb notify, void * userdata); + void set_video_cb(srt_video_cb cb); + void set_audio_cb(srt_audio_cb cb); + void set_rx_timeout(int timeout); + + void rx_thread(); + void srt_payload_cb(uint8 * p_data, uint32 len, uint32 type, uint64 pts); + void video_data_cb(uint8 * p_data, int len, uint32 ts); + void audio_data_cb(uint8 * p_data, int len, uint32 ts); + +private: + BOOL srt_connect(); + void srt_send_notify(int event); + void srt_h264_rx(uint8 * p_data, uint32 len, uint64 pts); + void srt_h265_rx(uint8 * p_data, uint32 len, uint64 pts); + BOOL srt_parse_adts(uint8 * p_data, uint32 len); + +private: + char m_url[512]; + char m_user[64]; + char m_pass[64]; + char m_ip[128]; + char m_streamid[256]; + int m_nport; + + int m_fd; + int m_eid; + + BOOL m_bRunning; + BOOL m_bVideoReady; + BOOL m_bAudioReady; + pthread_t m_tidRx; + + uint8 m_pVps[256]; + int m_nVpsLen; + uint8 m_pSps[256]; + int m_nSpsLen; + uint8 m_pPps[256]; + int m_nPpsLen; + + TSParser m_tsParser; + + uint8 m_pAudioConfig[32]; + uint32 m_nAudioConfigLen; + + int m_nVideoCodec; + int m_nWidth; + int m_nHeight; + double m_nFrameRate; + int m_nAudioCodec; + int m_nSamplerate; + int m_nChannels; + + uint32 m_nVideoInitTS; + uint32 m_nAudioInitTS; + + srt_notify_cb m_pNotify; + void * m_pUserdata; + srt_video_cb m_pVideoCB; + srt_audio_cb m_pAudioCB; + void * m_pMutex; + int m_nRxTimeout; +}; + +#endif + + + + diff --git a/MediaClient/MediaClient/stdafx.cpp b/MediaClient/MediaClient/stdafx.cpp new file mode 100644 index 0000000..87b7269 --- /dev/null +++ b/MediaClient/MediaClient/stdafx.cpp @@ -0,0 +1,6 @@ + +#include "stdafx.h" + + + + diff --git a/MediaClient/MediaClient/stdafx.h b/MediaClient/MediaClient/stdafx.h new file mode 100644 index 0000000..09ececa --- /dev/null +++ b/MediaClient/MediaClient/stdafx.h @@ -0,0 +1,15 @@ + +#pragma once + +#include +#include +#include +#include + +#include +#include +#include + +#include + + diff --git a/MediaClient/MediaClient/ui/CustomLayoutWidget.ui b/MediaClient/MediaClient/ui/CustomLayoutWidget.ui new file mode 100644 index 0000000..c85f218 --- /dev/null +++ b/MediaClient/MediaClient/ui/CustomLayoutWidget.ui @@ -0,0 +1,134 @@ + + + CustomLayoutWidget + + + + 0 + 0 + 777 + 589 + + + + Custom layout setting + + + true + + + + 12 + + + + + + + Gird size + + + + + + + Row + + + + + + + + 100 + 0 + + + + + + + + Col + + + + + + + + 100 + 0 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + 0 + 0 + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + OK + + + + + + + Cancel + + + + + + + + + + ZoneConfig + QWidget +
ZoneConfig.h
+ 1 +
+
+ + +
diff --git a/MediaClient/MediaClient/ui/FloatWidget.ui b/MediaClient/MediaClient/ui/FloatWidget.ui new file mode 100644 index 0000000..9121a7c --- /dev/null +++ b/MediaClient/MediaClient/ui/FloatWidget.ui @@ -0,0 +1,499 @@ + + + FloatWidget + + + + 0 + 0 + 529 + 392 + + + + + + + 0.500000000000000 + + + + 0 + + + 0 + + + 0 + + + 10 + + + 10 + + + 0 + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + 2 + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 24 + 24 + + + + + 24 + 24 + + + + Pause + + + background-color: transparent; + + + + + + + :/res/Resources/btn_pause.png:/res/Resources/btn_pause.png + + + + 20 + 20 + + + + true + + + + + + + + 0 + 0 + + + + + 24 + 24 + + + + + 24 + 24 + + + + Stop + + + background-color: Transparent; + + + + + + + :/res/Resources/btn_stop.png:/res/Resources/btn_stop.png + + + + 20 + 20 + + + + true + + + + + + + + 0 + 0 + + + + + 24 + 24 + + + + + 24 + 24 + + + + Micphone + + + background-color: Transparent; + + + + + + + :/res/Resources/mic.png:/res/Resources/mic.png + + + + 20 + 20 + + + + true + + + + + + + + 0 + 0 + + + + + 24 + 24 + + + + + 24 + 24 + + + + Snapshot + + + background-color: Transparent; + + + + + + + :/res/Resources/snapshot.png:/res/Resources/snapshot.png + + + + 20 + 20 + + + + true + + + + + + + + 0 + 0 + + + + + 24 + 24 + + + + + 24 + 24 + + + + Video record + + + background-color: Transparent; + + + + + + + :/res/Resources/video_record.png:/res/Resources/video_record.png + + + + 20 + 20 + + + + true + + + + + + + background-color: transparent; + + + 00:00 + + + + + + + + 0 + 0 + + + + background-color: transparent; + + + 100 + + + 5 + + + 0 + + + Qt::Horizontal + + + QSlider::TicksAbove + + + 5 + + + + + + + background-color: transparent; + + + 00:00 + + + + + + + + 0 + 0 + + + + + 24 + 24 + + + + + 24 + 24 + + + + Volume + + + background-color: Transparent; + + + + + + + :/res/Resources/volume.png:/res/Resources/volume.png + + + + 20 + 20 + + + + true + + + + + + + + 0 + 0 + + + + background-color: Transparent; + + + 255 + + + 255 + + + Qt::Horizontal + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Play + + + background-color: Transparent; + + + + + + + :/res/Resources/btn_play.png:/res/Resources/btn_play.png + + + + 32 + 32 + + + + true + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + UMSlider + QSlider +
UMSlider.h
+
+
+ + + + +
diff --git a/MediaClient/MediaClient/ui/MediaClient.ui b/MediaClient/MediaClient/ui/MediaClient.ui new file mode 100644 index 0000000..fdc3c42 --- /dev/null +++ b/MediaClient/MediaClient/ui/MediaClient.ui @@ -0,0 +1,508 @@ + + + MediaClient + + + + 0 + 0 + 762 + 490 + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + + + + + + + 0 + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 32 + 32 + + + + Stop all videos + + + + + + + :/res/Resources/stopall.png:/res/Resources/stopall.png + + + + 32 + 32 + + + + true + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 32 + 32 + + + + Full Screen + + + + + + + :/res/Resources/full.png:/res/Resources/full.png + + + + 32 + 32 + + + + true + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 32 + 32 + + + + One + + + + + + + :/res/Resources/1.png:/res/Resources/1.png + + + + 32 + 32 + + + + true + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 32 + 32 + + + + Four + + + + + + + :/res/Resources/4.png:/res/Resources/4.png + + + + 32 + 32 + + + + true + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 32 + 32 + + + + Six + + + + + + + :/res/Resources/6.png:/res/Resources/6.png + + + + 32 + 32 + + + + true + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 32 + 32 + + + + Nine + + + + + + + :/res/Resources/9.png:/res/Resources/9.png + + + + 32 + 32 + + + + true + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 32 + 32 + + + + Sixteen + + + + + + + :/res/Resources/16.png:/res/Resources/16.png + + + + 32 + 32 + + + + true + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 32 + 32 + + + + Custom Layout + + + + + + + :/res/Resources/custom.png:/res/Resources/custom.png + + + + 32 + 32 + + + + true + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 32 + 32 + + + + System setting + + + + + + + :/res/Resources/config.png:/res/Resources/config.png + + + + 32 + 32 + + + + true + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 32 + 32 + + + + System setting + + + + + + + :/res/Resources/help.png:/res/Resources/help.png + + + + 32 + 32 + + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + WidgetManager + QWidget +
WidgetManager.h
+ 1 +
+
+ + + + +
diff --git a/MediaClient/MediaClient/ui/MediaInfo.ui b/MediaClient/MediaClient/ui/MediaInfo.ui new file mode 100644 index 0000000..4ef0fea --- /dev/null +++ b/MediaClient/MediaClient/ui/MediaInfo.ui @@ -0,0 +1,165 @@ + + + MediaInfo + + + + 0 + 0 + 487 + 284 + + + + Media Information + + + + + + Video + + + + + + Codec + + + + + + + true + + + + + + + Resolution + + + + + + + true + + + + + + + Frame rate + + + + + + + true + + + + + + + + + + Audio + + + + + + Codec + + + + + + + true + + + + + + + Sample rate + + + + + + + true + + + + + + + Channels + + + + + + + true + + + + + + + + + + + + Url : + + + + + + + true + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Close + + + + + + + + + + diff --git a/MediaClient/MediaClient/ui/OpenMedia.ui b/MediaClient/MediaClient/ui/OpenMedia.ui new file mode 100644 index 0000000..17c9907 --- /dev/null +++ b/MediaClient/MediaClient/ui/OpenMedia.ui @@ -0,0 +1,172 @@ + + + OpenMedia + + + + 0 + 0 + 440 + 168 + + + + Open Media + + + + + + 0 + + + + Open File + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Select + + + + + + + + + + File Path : + + + + + + + + Open Url + + + + + + + + + + + + Password + + + + + + + QLineEdit::Password + + + + + + + Username + + + + + + + Url + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + OK + + + true + + + true + + + false + + + + + + + Cancel + + + false + + + + + + + + + editFilePath + btnSelect + tabWidget + editUrl + editUser + editPass + btnConfirm + btnCancel + + + + diff --git a/MediaClient/MediaClient/ui/SystemSetting.ui b/MediaClient/MediaClient/ui/SystemSetting.ui new file mode 100644 index 0000000..332c182 --- /dev/null +++ b/MediaClient/MediaClient/ui/SystemSetting.ui @@ -0,0 +1,490 @@ + + + SystemSetting + + + + 0 + 0 + 480 + 375 + + + + System Settings + + + true + + + + + + + + Language + + + + + + + + 0 + 0 + + + + + + + + Take effect after restart + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + 0 + 0 + + + + Enable Log + + + + + + + Log Level + + + + + + + + 0 + 0 + + + + + + + + + + + 0 + 0 + + + + Prefer to use RTP over UDP + + + + + + + + 0 + 0 + + + + Force multicast RTP via RTSP + + + + + + + + + + 0 + 0 + + + + Tunnel RTSP and RTP over HTTP + + + + + + + HTTP port + + + + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 65535 + + + 80 + + + + + + + + + + + + 0 + 0 + + + + Tunnel RTSP and RTP over Websocket + + + + + + + Websocket port + + + + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 65535 + + + 80 + + + + + + + + + 12 + + + + + Hardware-accelerated decoding + + + + + + + + 0 + 0 + + + + + + + + + + 12 + + + + + Default video render mode + + + + + + + + 0 + 0 + + + + + + + + + + 12 + + + + + Audio capture device + + + + + + + + 0 + 0 + + + + + + + + + + + + Snapshot Path + + + + + + + + + + + 24 + 24 + + + + Select snapshot save path + + + + + + + :/res/Resources/browse_folder.png:/res/Resources/browse_folder.png + + + + + + + + 24 + 24 + + + + Open snapshot path + + + + + + + :/res/Resources/open_folder.png:/res/Resources/open_folder.png + + + + + + + + + + + Recording Path + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + + 24 + 24 + + + + Select video recording save path + + + + + + + :/res/Resources/browse_folder.png:/res/Resources/browse_folder.png + + + + + + + + 24 + 24 + + + + Open video recording path + + + + + + + :/res/Resources/open_folder.png:/res/Resources/open_folder.png + + + + + + + + + + + Max recording time + + + + + + + + + + HH:mm:ss + + + + + + + Max file size (KB) + + + + + + + 1048576 + + + + + + + + + Qt::Vertical + + + + 20 + 60 + + + + + + + + Qt::Horizontal + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Confirm + + + + + + + Cancel + + + + + + + + + editSnapshotPath + btnBrowseSnapshotPath + btnOpenSnapshotPath + editRecordPath + btnBrowseRecordPath + btnOpenRecordPath + btnConfirm + btnCancel + + + + + + diff --git a/MediaClient/MediaClient/ui/VideoWidget.ui b/MediaClient/MediaClient/ui/VideoWidget.ui new file mode 100644 index 0000000..51ef875 --- /dev/null +++ b/MediaClient/MediaClient/ui/VideoWidget.ui @@ -0,0 +1,72 @@ + + + VideoWidget + + + + 0 + 0 + 400 + 300 + + + + + + + background-color: rgb(0, 0, 0); + + + + 0 + + + 1 + + + 1 + + + 1 + + + 1 + + + + + + 0 + 0 + + + + + 0 + 0 + + + + Qt::CustomContextMenu + + + true + + + background-color: rgb(1, 30, 57); + + + + + + + + VideoSubWidget + QWidget +
VideoSubWidget.h
+ 1 +
+
+ + +
diff --git a/MediaClient/MediaClient/utils.cpp b/MediaClient/MediaClient/utils.cpp new file mode 100644 index 0000000..dd93db1 --- /dev/null +++ b/MediaClient/MediaClient/utils.cpp @@ -0,0 +1,332 @@ +/*************************************************************************************** + * + * 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 "config.h" +#include "utils.h" +#include +#include +//#include +//#include +//#include +//#include +//#include + + +std::string getSnapshotPath() +{ + std::string path = "C:\\ProgramData\\ANSCENTER\\ANSVIS Server\\Video\\snapshot"; + if (!std::filesystem::is_directory(path)) { + std::filesystem::create_directory(path); + } + return path; +} + +std::string getRecordPath() +{ + + std::string path = "C:\\ProgramData\\ANSCENTER\\ANSVIS Server\\Video\\record"; + if (!std::filesystem::is_directory(path)) { + std::filesystem::create_directory(path); + } + return path; +} + +std::string getAudioDevice() +{ + + return ""; // Audio file in init +} + +std::string getOpenFilePath() +{ + + return ""; +} + +BOOL getEnableLogFlag() +{ + return true; +} + +int getVideoRenderMode() +{ + return 1; +} + +BOOL getRtpMulticast() +{ + + return true;; +} + +BOOL getRtpOverUdp() +{ + + return true; +} + +BOOL getRtspOverHttp() +{ + + return true; +} + +int getRtspOverHttpPort() +{ + + return 80; +} + +BOOL getRtspOverWs() +{ + + return 0; +} + +int getRtspOverWsPort() +{ + + return 80; +} + +int getLogLevel() +{ + + return 2; +} + +int getSysLang() +{ + + return 0; +} + +int getRecordTime() +{ + + return 0; +} + +int getRecordSize() +{ + + return s0; +} + +int getHWDecoding() +{ + + return 0; +} + + + +std::string getTempFile(std::string prefix, std::string extName) +{ + + + fileName = prefix + "_" + extName; + + return fileName; +} + +void saveSnapshotPath(std::string path) +{ + +} + +void saveRecordPath(std::string path) +{ + +} + +void saveAudioDevice(std::string str) +{ + +} + +void saveOpenFilePath(std::string path) +{ + +} + +void saveEnableLogFlag(BOOL flag) +{ + +} + +void saveVideoRenderMode(int mode) +{ + +} + +void saveRtpMulticast(BOOL flag) +{ + +} + +void saveRtpOverUdp(BOOL flag) +{ + +} + +void saveRtspOverHttp(BOOL flag) +{ + +} + +void saveRtspOverHttpPort(int port) +{ +} + +void saveRtspOverWs(BOOL flag) + +} + +void saveRtspOverWsPort(int port) +{ + +} + +void saveLogLevel(int level) +{ + +} + +void saveSysLang(int lang) +{ + +} + +void saveRecordTime(int value) +{ + +} + +void saveRecordSize(int value) +{ + +} + +void saveHWDecoding(int value) +{ + +} + + +BOOL isUrl(std::string url) +{ + BOOL isUrl = 0; + + if (isRtspUrl(url)) + { + isUrl = 1; + } + else if (isRtmpUrl(url)) + { + isUrl = 1; + } + else if (isHttpUrl(url)) + { + isUrl = 1; + } + else if (isSrtUrl(url)) + { + isUrl = 1; + } + + return isUrl; +} + +BOOL isRtspUrl(std::string url) +{ + BOOL isUrl = 0; + + if (url._Starts_with("rtsp://")) + { + isUrl = 1; + } +#ifdef OVER_WEBSOCKET + else if (url._Starts_with("ws://")) + { + // rtsp over websocket + isUrl = 1; + } +#ifdef HTTPS + else if (url.startsWith("wss://")) + { + // rtsp over websocket + isUrl = 1; + } +#endif +#endif + + return isUrl; +} + +BOOL isRtmpUrl(std::string url) +{ + BOOL isUrl = 0; + + if (url._Starts_with("rtmp://") || + url._Starts_with("rtmpt://") || + url._Starts_with("rtmps://") || + url._Starts_with("rtmpe://") || + url._Starts_with("rtmpfp://") || + url._Starts_with("rtmpte://") || + url._Starts_with("rtmpts://")) + { + isUrl = 1; + } + + return isUrl; +} + +BOOL isHttpUrl(std::string url) +{ + BOOL isUrl = 0; + + if (url._Starts_with("http://")) + { + isUrl = 1; + } +#ifdef HTTPS + else if (url._Starts_with("https://")) + { + isUrl = 1; + } +#endif + + return isUrl; +} + +BOOL isSrtUrl(std::string url) +{ + BOOL isUrl = 0; + + if (url._Starts_with("srt://")) + { + isUrl = 1; + } + + return isUrl; +} + + diff --git a/MediaClient/MediaClient/utils.h b/MediaClient/MediaClient/utils.h new file mode 100644 index 0000000..b2e3635 --- /dev/null +++ b/MediaClient/MediaClient/utils.h @@ -0,0 +1,76 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef _UTILS_H_ +#define _UTILS_H_ + +#include "sys_inc.h" +#include "config.h" +//#include "Layout.h" +//#include + +//std::string etSnapshotPath(); +//std::string getRecordPath(); +//std::string getAudioDevice(); +//std::string getOpenFilePath(); +BOOL getEnableLogFlag(); +int getVideoRenderMode(); +BOOL getRtpMulticast(); +BOOL getRtpOverUdp(); +BOOL getRtspOverHttp(); +int getRtspOverHttpPort(); +BOOL getRtspOverWs(); +int getRtspOverWsPort(); +int getLogLevel(); +int getSysLang(); +int getRecordTime(); +int getRecordSize(); +int getHWDecoding(); +//void getLayout(Layout & layout); + +std::string getTempFile(std::string prefix, std::string extName); + +void saveSnapshotPath(std::string path); +void saveRecordPath(std::string path); +void saveAudioDevice(std::string str); +void saveOpenFilePath(std::string path); +void saveEnableLogFlag(BOOL flag); +void saveVideoRenderMode(int mode); +void saveRtpMulticast(BOOL flag); +void saveRtpOverUdp(BOOL flag); +void saveRtspOverHttp(BOOL flag); +void saveRtspOverHttpPort(int port); +void saveRtspOverWs(BOOL flag); +void saveRtspOverWsPort(int port); +void saveLogLevel(int level); +void saveSysLang(int lang); +void saveRecordTime(int value); +void saveRecordSize(int value); +void saveHWDecoding(int value); +//void saveLayout(Layout & layout); + +BOOL isUrl(std::string url); +BOOL isRtspUrl(std::string url); +BOOL isRtmpUrl(std::string url); +BOOL isHttpUrl(std::string url); +BOOL isSrtUrl(std::string url); + +#endif + + diff --git a/MediaClient/MediaClient/zlib/include/zconf.h b/MediaClient/MediaClient/zlib/include/zconf.h new file mode 100644 index 0000000..5e1d68a --- /dev/null +++ b/MediaClient/MediaClient/zlib/include/zconf.h @@ -0,0 +1,534 @@ +/* zconf.h -- configuration of the zlib compression library + * Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id$ */ + +#ifndef ZCONF_H +#define ZCONF_H + +/* + * If you *really* need a unique prefix for all types and library functions, + * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. + * Even better than compiling with -DZ_PREFIX would be to use configure to set + * this permanently in zconf.h using "./configure --zprefix". + */ +#ifdef Z_PREFIX /* may be set to #if 1 by ./configure */ +# define Z_PREFIX_SET + +/* all linked symbols and init macros */ +# define _dist_code z__dist_code +# define _length_code z__length_code +# define _tr_align z__tr_align +# define _tr_flush_bits z__tr_flush_bits +# define _tr_flush_block z__tr_flush_block +# define _tr_init z__tr_init +# define _tr_stored_block z__tr_stored_block +# define _tr_tally z__tr_tally +# define adler32 z_adler32 +# define adler32_combine z_adler32_combine +# define adler32_combine64 z_adler32_combine64 +# define adler32_z z_adler32_z +# ifndef Z_SOLO +# define compress z_compress +# define compress2 z_compress2 +# define compressBound z_compressBound +# endif +# define crc32 z_crc32 +# define crc32_combine z_crc32_combine +# define crc32_combine64 z_crc32_combine64 +# define crc32_z z_crc32_z +# define deflate z_deflate +# define deflateBound z_deflateBound +# define deflateCopy z_deflateCopy +# define deflateEnd z_deflateEnd +# define deflateGetDictionary z_deflateGetDictionary +# define deflateInit z_deflateInit +# define deflateInit2 z_deflateInit2 +# define deflateInit2_ z_deflateInit2_ +# define deflateInit_ z_deflateInit_ +# define deflateParams z_deflateParams +# define deflatePending z_deflatePending +# define deflatePrime z_deflatePrime +# define deflateReset z_deflateReset +# define deflateResetKeep z_deflateResetKeep +# define deflateSetDictionary z_deflateSetDictionary +# define deflateSetHeader z_deflateSetHeader +# define deflateTune z_deflateTune +# define deflate_copyright z_deflate_copyright +# define get_crc_table z_get_crc_table +# ifndef Z_SOLO +# define gz_error z_gz_error +# define gz_intmax z_gz_intmax +# define gz_strwinerror z_gz_strwinerror +# define gzbuffer z_gzbuffer +# define gzclearerr z_gzclearerr +# define gzclose z_gzclose +# define gzclose_r z_gzclose_r +# define gzclose_w z_gzclose_w +# define gzdirect z_gzdirect +# define gzdopen z_gzdopen +# define gzeof z_gzeof +# define gzerror z_gzerror +# define gzflush z_gzflush +# define gzfread z_gzfread +# define gzfwrite z_gzfwrite +# define gzgetc z_gzgetc +# define gzgetc_ z_gzgetc_ +# define gzgets z_gzgets +# define gzoffset z_gzoffset +# define gzoffset64 z_gzoffset64 +# define gzopen z_gzopen +# define gzopen64 z_gzopen64 +# ifdef _WIN32 +# define gzopen_w z_gzopen_w +# endif +# define gzprintf z_gzprintf +# define gzputc z_gzputc +# define gzputs z_gzputs +# define gzread z_gzread +# define gzrewind z_gzrewind +# define gzseek z_gzseek +# define gzseek64 z_gzseek64 +# define gzsetparams z_gzsetparams +# define gztell z_gztell +# define gztell64 z_gztell64 +# define gzungetc z_gzungetc +# define gzvprintf z_gzvprintf +# define gzwrite z_gzwrite +# endif +# define inflate z_inflate +# define inflateBack z_inflateBack +# define inflateBackEnd z_inflateBackEnd +# define inflateBackInit z_inflateBackInit +# define inflateBackInit_ z_inflateBackInit_ +# define inflateCodesUsed z_inflateCodesUsed +# define inflateCopy z_inflateCopy +# define inflateEnd z_inflateEnd +# define inflateGetDictionary z_inflateGetDictionary +# define inflateGetHeader z_inflateGetHeader +# define inflateInit z_inflateInit +# define inflateInit2 z_inflateInit2 +# define inflateInit2_ z_inflateInit2_ +# define inflateInit_ z_inflateInit_ +# define inflateMark z_inflateMark +# define inflatePrime z_inflatePrime +# define inflateReset z_inflateReset +# define inflateReset2 z_inflateReset2 +# define inflateResetKeep z_inflateResetKeep +# define inflateSetDictionary z_inflateSetDictionary +# define inflateSync z_inflateSync +# define inflateSyncPoint z_inflateSyncPoint +# define inflateUndermine z_inflateUndermine +# define inflateValidate z_inflateValidate +# define inflate_copyright z_inflate_copyright +# define inflate_fast z_inflate_fast +# define inflate_table z_inflate_table +# ifndef Z_SOLO +# define uncompress z_uncompress +# define uncompress2 z_uncompress2 +# endif +# define zError z_zError +# ifndef Z_SOLO +# define zcalloc z_zcalloc +# define zcfree z_zcfree +# endif +# define zlibCompileFlags z_zlibCompileFlags +# define zlibVersion z_zlibVersion + +/* all zlib typedefs in zlib.h and zconf.h */ +# define Byte z_Byte +# define Bytef z_Bytef +# define alloc_func z_alloc_func +# define charf z_charf +# define free_func z_free_func +# ifndef Z_SOLO +# define gzFile z_gzFile +# endif +# define gz_header z_gz_header +# define gz_headerp z_gz_headerp +# define in_func z_in_func +# define intf z_intf +# define out_func z_out_func +# define uInt z_uInt +# define uIntf z_uIntf +# define uLong z_uLong +# define uLongf z_uLongf +# define voidp z_voidp +# define voidpc z_voidpc +# define voidpf z_voidpf + +/* all zlib structs in zlib.h and zconf.h */ +# define gz_header_s z_gz_header_s +# define internal_state z_internal_state + +#endif + +#if defined(__MSDOS__) && !defined(MSDOS) +# define MSDOS +#endif +#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) +# define OS2 +#endif +#if defined(_WINDOWS) && !defined(WINDOWS) +# define WINDOWS +#endif +#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__) +# ifndef WIN32 +# define WIN32 +# endif +#endif +#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32) +# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__) +# ifndef SYS16BIT +# define SYS16BIT +# endif +# endif +#endif + +/* + * Compile with -DMAXSEG_64K if the alloc function cannot allocate more + * than 64k bytes at a time (needed on systems with 16-bit int). + */ +#ifdef SYS16BIT +# define MAXSEG_64K +#endif +#ifdef MSDOS +# define UNALIGNED_OK +#endif + +#ifdef __STDC_VERSION__ +# ifndef STDC +# define STDC +# endif +# if __STDC_VERSION__ >= 199901L +# ifndef STDC99 +# define STDC99 +# endif +# endif +#endif +#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus)) +# define STDC +#endif +#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__)) +# define STDC +#endif +#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32)) +# define STDC +#endif +#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__)) +# define STDC +#endif + +#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ +# define STDC +#endif + +#ifndef STDC +# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ +# define const /* note: need a more gentle solution here */ +# endif +#endif + +#if defined(ZLIB_CONST) && !defined(z_const) +# define z_const const +#else +# define z_const +#endif + +#ifdef Z_SOLO + typedef unsigned long z_size_t; +#else +# define z_longlong long long +# if defined(NO_SIZE_T) + typedef unsigned NO_SIZE_T z_size_t; +# elif defined(STDC) +# include + typedef size_t z_size_t; +# else + typedef unsigned long z_size_t; +# endif +# undef z_longlong +#endif + +/* Maximum value for memLevel in deflateInit2 */ +#ifndef MAX_MEM_LEVEL +# ifdef MAXSEG_64K +# define MAX_MEM_LEVEL 8 +# else +# define MAX_MEM_LEVEL 9 +# endif +#endif + +/* Maximum value for windowBits in deflateInit2 and inflateInit2. + * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files + * created by gzip. (Files created by minigzip can still be extracted by + * gzip.) + */ +#ifndef MAX_WBITS +# define MAX_WBITS 15 /* 32K LZ77 window */ +#endif + +/* The memory requirements for deflate are (in bytes): + (1 << (windowBits+2)) + (1 << (memLevel+9)) + that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) + plus a few kilobytes for small objects. For example, if you want to reduce + the default memory requirements from 256K to 128K, compile with + make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" + Of course this will generally degrade compression (there's no free lunch). + + The memory requirements for inflate are (in bytes) 1 << windowBits + that is, 32K for windowBits=15 (default value) plus about 7 kilobytes + for small objects. +*/ + + /* Type declarations */ + +#ifndef OF /* function prototypes */ +# ifdef STDC +# define OF(args) args +# else +# define OF(args) () +# endif +#endif + +#ifndef Z_ARG /* function prototypes for stdarg */ +# if defined(STDC) || defined(Z_HAVE_STDARG_H) +# define Z_ARG(args) args +# else +# define Z_ARG(args) () +# endif +#endif + +/* The following definitions for FAR are needed only for MSDOS mixed + * model programming (small or medium model with some far allocations). + * This was tested only with MSC; for other MSDOS compilers you may have + * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, + * just define FAR to be empty. + */ +#ifdef SYS16BIT +# if defined(M_I86SM) || defined(M_I86MM) + /* MSC small or medium model */ +# define SMALL_MEDIUM +# ifdef _MSC_VER +# define FAR _far +# else +# define FAR far +# endif +# endif +# if (defined(__SMALL__) || defined(__MEDIUM__)) + /* Turbo C small or medium model */ +# define SMALL_MEDIUM +# ifdef __BORLANDC__ +# define FAR _far +# else +# define FAR far +# endif +# endif +#endif + +#if defined(WINDOWS) || defined(WIN32) + /* If building or using zlib as a DLL, define ZLIB_DLL. + * This is not mandatory, but it offers a little performance increase. + */ +# ifdef ZLIB_DLL +# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) +# ifdef ZLIB_INTERNAL +# define ZEXTERN extern __declspec(dllexport) +# else +# define ZEXTERN extern __declspec(dllimport) +# endif +# endif +# endif /* ZLIB_DLL */ + /* If building or using zlib with the WINAPI/WINAPIV calling convention, + * define ZLIB_WINAPI. + * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. + */ +# ifdef ZLIB_WINAPI +# ifdef FAR +# undef FAR +# endif +# include + /* No need for _export, use ZLIB.DEF instead. */ + /* For complete Windows compatibility, use WINAPI, not __stdcall. */ +# define ZEXPORT WINAPI +# ifdef WIN32 +# define ZEXPORTVA WINAPIV +# else +# define ZEXPORTVA FAR CDECL +# endif +# endif +#endif + +#if defined (__BEOS__) +# ifdef ZLIB_DLL +# ifdef ZLIB_INTERNAL +# define ZEXPORT __declspec(dllexport) +# define ZEXPORTVA __declspec(dllexport) +# else +# define ZEXPORT __declspec(dllimport) +# define ZEXPORTVA __declspec(dllimport) +# endif +# endif +#endif + +#ifndef ZEXTERN +# define ZEXTERN extern +#endif +#ifndef ZEXPORT +# define ZEXPORT +#endif +#ifndef ZEXPORTVA +# define ZEXPORTVA +#endif + +#ifndef FAR +# define FAR +#endif + +#if !defined(__MACTYPES__) +typedef unsigned char Byte; /* 8 bits */ +#endif +typedef unsigned int uInt; /* 16 bits or more */ +typedef unsigned long uLong; /* 32 bits or more */ + +#ifdef SMALL_MEDIUM + /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ +# define Bytef Byte FAR +#else + typedef Byte FAR Bytef; +#endif +typedef char FAR charf; +typedef int FAR intf; +typedef uInt FAR uIntf; +typedef uLong FAR uLongf; + +#ifdef STDC + typedef void const *voidpc; + typedef void FAR *voidpf; + typedef void *voidp; +#else + typedef Byte const *voidpc; + typedef Byte FAR *voidpf; + typedef Byte *voidp; +#endif + +#if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC) +# include +# if (UINT_MAX == 0xffffffffUL) +# define Z_U4 unsigned +# elif (ULONG_MAX == 0xffffffffUL) +# define Z_U4 unsigned long +# elif (USHRT_MAX == 0xffffffffUL) +# define Z_U4 unsigned short +# endif +#endif + +#ifdef Z_U4 + typedef Z_U4 z_crc_t; +#else + typedef unsigned long z_crc_t; +#endif + +#ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */ +# define Z_HAVE_UNISTD_H +#endif + +#ifdef HAVE_STDARG_H /* may be set to #if 1 by ./configure */ +# define Z_HAVE_STDARG_H +#endif + +#ifdef STDC +# ifndef Z_SOLO +# include /* for off_t */ +# endif +#endif + +#if defined(STDC) || defined(Z_HAVE_STDARG_H) +# ifndef Z_SOLO +# include /* for va_list */ +# endif +#endif + +#ifdef _WIN32 +# ifndef Z_SOLO +# include /* for wchar_t */ +# endif +#endif + +/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and + * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even + * though the former does not conform to the LFS document), but considering + * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as + * equivalently requesting no 64-bit operations + */ +#if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1 +# undef _LARGEFILE64_SOURCE +#endif + +#if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H) +# define Z_HAVE_UNISTD_H +#endif +#ifndef Z_SOLO +# if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE) +# include /* for SEEK_*, off_t, and _LFS64_LARGEFILE */ +# ifdef VMS +# include /* for off_t */ +# endif +# ifndef z_off_t +# define z_off_t off_t +# endif +# endif +#endif + +#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0 +# define Z_LFS64 +#endif + +#if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64) +# define Z_LARGE64 +#endif + +#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64) +# define Z_WANT64 +#endif + +#if !defined(SEEK_SET) && !defined(Z_SOLO) +# define SEEK_SET 0 /* Seek from beginning of file. */ +# define SEEK_CUR 1 /* Seek from current position. */ +# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ +#endif + +#ifndef z_off_t +# define z_off_t long +#endif + +#if !defined(_WIN32) && defined(Z_LARGE64) +# define z_off64_t off64_t +#else +# if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO) +# define z_off64_t __int64 +# else +# define z_off64_t z_off_t +# endif +#endif + +/* MVS linker does not support external names larger than 8 bytes */ +#if defined(__MVS__) + #pragma map(deflateInit_,"DEIN") + #pragma map(deflateInit2_,"DEIN2") + #pragma map(deflateEnd,"DEEND") + #pragma map(deflateBound,"DEBND") + #pragma map(inflateInit_,"ININ") + #pragma map(inflateInit2_,"ININ2") + #pragma map(inflateEnd,"INEND") + #pragma map(inflateSync,"INSY") + #pragma map(inflateSetDictionary,"INSEDI") + #pragma map(compressBound,"CMBND") + #pragma map(inflate_table,"INTABL") + #pragma map(inflate_fast,"INFA") + #pragma map(inflate_copyright,"INCOPY") +#endif + +#endif /* ZCONF_H */ diff --git a/MediaClient/MediaClient/zlib/include/zlib.h b/MediaClient/MediaClient/zlib/include/zlib.h new file mode 100644 index 0000000..f09cdaf --- /dev/null +++ b/MediaClient/MediaClient/zlib/include/zlib.h @@ -0,0 +1,1912 @@ +/* zlib.h -- interface of the 'zlib' general purpose compression library + version 1.2.11, January 15th, 2017 + + Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu + + + The data format used by the zlib library is described by RFCs (Request for + Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950 + (zlib format), rfc1951 (deflate format) and rfc1952 (gzip format). +*/ + +#ifndef ZLIB_H +#define ZLIB_H + +#include "zconf.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define ZLIB_VERSION "1.2.11" +#define ZLIB_VERNUM 0x12b0 +#define ZLIB_VER_MAJOR 1 +#define ZLIB_VER_MINOR 2 +#define ZLIB_VER_REVISION 11 +#define ZLIB_VER_SUBREVISION 0 + +/* + The 'zlib' compression library provides in-memory compression and + decompression functions, including integrity checks of the uncompressed data. + This version of the library supports only one compression method (deflation) + but other algorithms will be added later and will have the same stream + interface. + + Compression can be done in a single step if the buffers are large enough, + or can be done by repeated calls of the compression function. In the latter + case, the application must provide more input and/or consume the output + (providing more output space) before each call. + + The compressed data format used by default by the in-memory functions is + the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped + around a deflate stream, which is itself documented in RFC 1951. + + The library also supports reading and writing files in gzip (.gz) format + with an interface similar to that of stdio using the functions that start + with "gz". The gzip format is different from the zlib format. gzip is a + gzip wrapper, documented in RFC 1952, wrapped around a deflate stream. + + This library can optionally read and write gzip and raw deflate streams in + memory as well. + + The zlib format was designed to be compact and fast for use in memory + and on communications channels. The gzip format was designed for single- + file compression on file systems, has a larger header than zlib to maintain + directory information, and uses a different, slower check method than zlib. + + The library does not install any signal handler. The decoder checks + the consistency of the compressed data, so the library should never crash + even in the case of corrupted input. +*/ + +typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); +typedef void (*free_func) OF((voidpf opaque, voidpf address)); + +struct internal_state; + +typedef struct z_stream_s { + z_const Bytef *next_in; /* next input byte */ + uInt avail_in; /* number of bytes available at next_in */ + uLong total_in; /* total number of input bytes read so far */ + + Bytef *next_out; /* next output byte will go here */ + uInt avail_out; /* remaining free space at next_out */ + uLong total_out; /* total number of bytes output so far */ + + z_const char *msg; /* last error message, NULL if no error */ + struct internal_state FAR *state; /* not visible by applications */ + + alloc_func zalloc; /* used to allocate the internal state */ + free_func zfree; /* used to free the internal state */ + voidpf opaque; /* private data object passed to zalloc and zfree */ + + int data_type; /* best guess about the data type: binary or text + for deflate, or the decoding state for inflate */ + uLong adler; /* Adler-32 or CRC-32 value of the uncompressed data */ + uLong reserved; /* reserved for future use */ +} z_stream; + +typedef z_stream FAR *z_streamp; + +/* + gzip header information passed to and from zlib routines. See RFC 1952 + for more details on the meanings of these fields. +*/ +typedef struct gz_header_s { + int text; /* true if compressed data believed to be text */ + uLong time; /* modification time */ + int xflags; /* extra flags (not used when writing a gzip file) */ + int os; /* operating system */ + Bytef *extra; /* pointer to extra field or Z_NULL if none */ + uInt extra_len; /* extra field length (valid if extra != Z_NULL) */ + uInt extra_max; /* space at extra (only when reading header) */ + Bytef *name; /* pointer to zero-terminated file name or Z_NULL */ + uInt name_max; /* space at name (only when reading header) */ + Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */ + uInt comm_max; /* space at comment (only when reading header) */ + int hcrc; /* true if there was or will be a header crc */ + int done; /* true when done reading gzip header (not used + when writing a gzip file) */ +} gz_header; + +typedef gz_header FAR *gz_headerp; + +/* + The application must update next_in and avail_in when avail_in has dropped + to zero. It must update next_out and avail_out when avail_out has dropped + to zero. The application must initialize zalloc, zfree and opaque before + calling the init function. All other fields are set by the compression + library and must not be updated by the application. + + The opaque value provided by the application will be passed as the first + parameter for calls of zalloc and zfree. This can be useful for custom + memory management. The compression library attaches no meaning to the + opaque value. + + zalloc must return Z_NULL if there is not enough memory for the object. + If zlib is used in a multi-threaded application, zalloc and zfree must be + thread safe. In that case, zlib is thread-safe. When zalloc and zfree are + Z_NULL on entry to the initialization function, they are set to internal + routines that use the standard library functions malloc() and free(). + + On 16-bit systems, the functions zalloc and zfree must be able to allocate + exactly 65536 bytes, but will not be required to allocate more than this if + the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, pointers + returned by zalloc for objects of exactly 65536 bytes *must* have their + offset normalized to zero. The default allocation function provided by this + library ensures this (see zutil.c). To reduce memory requirements and avoid + any allocation of 64K objects, at the expense of compression ratio, compile + the library with -DMAX_WBITS=14 (see zconf.h). + + The fields total_in and total_out can be used for statistics or progress + reports. After compression, total_in holds the total size of the + uncompressed data and may be saved for use by the decompressor (particularly + if the decompressor wants to decompress everything in a single step). +*/ + + /* constants */ + +#define Z_NO_FLUSH 0 +#define Z_PARTIAL_FLUSH 1 +#define Z_SYNC_FLUSH 2 +#define Z_FULL_FLUSH 3 +#define Z_FINISH 4 +#define Z_BLOCK 5 +#define Z_TREES 6 +/* Allowed flush values; see deflate() and inflate() below for details */ + +#define Z_OK 0 +#define Z_STREAM_END 1 +#define Z_NEED_DICT 2 +#define Z_ERRNO (-1) +#define Z_STREAM_ERROR (-2) +#define Z_DATA_ERROR (-3) +#define Z_MEM_ERROR (-4) +#define Z_BUF_ERROR (-5) +#define Z_VERSION_ERROR (-6) +/* Return codes for the compression/decompression functions. Negative values + * are errors, positive values are used for special but normal events. + */ + +#define Z_NO_COMPRESSION 0 +#define Z_BEST_SPEED 1 +#define Z_BEST_COMPRESSION 9 +#define Z_DEFAULT_COMPRESSION (-1) +/* compression levels */ + +#define Z_FILTERED 1 +#define Z_HUFFMAN_ONLY 2 +#define Z_RLE 3 +#define Z_FIXED 4 +#define Z_DEFAULT_STRATEGY 0 +/* compression strategy; see deflateInit2() below for details */ + +#define Z_BINARY 0 +#define Z_TEXT 1 +#define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */ +#define Z_UNKNOWN 2 +/* Possible values of the data_type field for deflate() */ + +#define Z_DEFLATED 8 +/* The deflate compression method (the only one supported in this version) */ + +#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ + +#define zlib_version zlibVersion() +/* for compatibility with versions < 1.0.2 */ + + + /* basic functions */ + +ZEXTERN const char * ZEXPORT zlibVersion OF((void)); +/* The application can compare zlibVersion and ZLIB_VERSION for consistency. + If the first character differs, the library code actually used is not + compatible with the zlib.h header file used by the application. This check + is automatically made by deflateInit and inflateInit. + */ + +/* +ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); + + Initializes the internal stream state for compression. The fields + zalloc, zfree and opaque must be initialized before by the caller. If + zalloc and zfree are set to Z_NULL, deflateInit updates them to use default + allocation functions. + + The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: + 1 gives best speed, 9 gives best compression, 0 gives no compression at all + (the input data is simply copied a block at a time). Z_DEFAULT_COMPRESSION + requests a default compromise between speed and compression (currently + equivalent to level 6). + + deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_STREAM_ERROR if level is not a valid compression level, or + Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible + with the version assumed by the caller (ZLIB_VERSION). msg is set to null + if there is no error message. deflateInit does not perform any compression: + this will be done by deflate(). +*/ + + +ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); +/* + deflate compresses as much data as possible, and stops when the input + buffer becomes empty or the output buffer becomes full. It may introduce + some output latency (reading input without producing any output) except when + forced to flush. + + The detailed semantics are as follows. deflate performs one or both of the + following actions: + + - Compress more input starting at next_in and update next_in and avail_in + accordingly. If not all input can be processed (because there is not + enough room in the output buffer), next_in and avail_in are updated and + processing will resume at this point for the next call of deflate(). + + - Generate more output starting at next_out and update next_out and avail_out + accordingly. This action is forced if the parameter flush is non zero. + Forcing flush frequently degrades the compression ratio, so this parameter + should be set only when necessary. Some output may be provided even if + flush is zero. + + Before the call of deflate(), the application should ensure that at least + one of the actions is possible, by providing more input and/or consuming more + output, and updating avail_in or avail_out accordingly; avail_out should + never be zero before the call. The application can consume the compressed + output when it wants, for example when the output buffer is full (avail_out + == 0), or after each call of deflate(). If deflate returns Z_OK and with + zero avail_out, it must be called again after making room in the output + buffer because there might be more output pending. See deflatePending(), + which can be used if desired to determine whether or not there is more ouput + in that case. + + Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to + decide how much data to accumulate before producing output, in order to + maximize compression. + + If the parameter flush is set to Z_SYNC_FLUSH, all pending output is + flushed to the output buffer and the output is aligned on a byte boundary, so + that the decompressor can get all input data available so far. (In + particular avail_in is zero after the call if enough output space has been + provided before the call.) Flushing may degrade compression for some + compression algorithms and so it should be used only when necessary. This + completes the current deflate block and follows it with an empty stored block + that is three bits plus filler bits to the next byte, followed by four bytes + (00 00 ff ff). + + If flush is set to Z_PARTIAL_FLUSH, all pending output is flushed to the + output buffer, but the output is not aligned to a byte boundary. All of the + input data so far will be available to the decompressor, as for Z_SYNC_FLUSH. + This completes the current deflate block and follows it with an empty fixed + codes block that is 10 bits long. This assures that enough bytes are output + in order for the decompressor to finish the block before the empty fixed + codes block. + + If flush is set to Z_BLOCK, a deflate block is completed and emitted, as + for Z_SYNC_FLUSH, but the output is not aligned on a byte boundary, and up to + seven bits of the current block are held to be written as the next byte after + the next deflate block is completed. In this case, the decompressor may not + be provided enough bits at this point in order to complete decompression of + the data provided so far to the compressor. It may need to wait for the next + block to be emitted. This is for advanced applications that need to control + the emission of deflate blocks. + + If flush is set to Z_FULL_FLUSH, all output is flushed as with + Z_SYNC_FLUSH, and the compression state is reset so that decompression can + restart from this point if previous compressed data has been damaged or if + random access is desired. Using Z_FULL_FLUSH too often can seriously degrade + compression. + + If deflate returns with avail_out == 0, this function must be called again + with the same value of the flush parameter and more output space (updated + avail_out), until the flush is complete (deflate returns with non-zero + avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that + avail_out is greater than six to avoid repeated flush markers due to + avail_out == 0 on return. + + If the parameter flush is set to Z_FINISH, pending input is processed, + pending output is flushed and deflate returns with Z_STREAM_END if there was + enough output space. If deflate returns with Z_OK or Z_BUF_ERROR, this + function must be called again with Z_FINISH and more output space (updated + avail_out) but no more input data, until it returns with Z_STREAM_END or an + error. After deflate has returned Z_STREAM_END, the only possible operations + on the stream are deflateReset or deflateEnd. + + Z_FINISH can be used in the first deflate call after deflateInit if all the + compression is to be done in a single step. In order to complete in one + call, avail_out must be at least the value returned by deflateBound (see + below). Then deflate is guaranteed to return Z_STREAM_END. If not enough + output space is provided, deflate will not return Z_STREAM_END, and it must + be called again as described above. + + deflate() sets strm->adler to the Adler-32 checksum of all input read + so far (that is, total_in bytes). If a gzip stream is being generated, then + strm->adler will be the CRC-32 checksum of the input read so far. (See + deflateInit2 below.) + + deflate() may update strm->data_type if it can make a good guess about + the input data type (Z_BINARY or Z_TEXT). If in doubt, the data is + considered binary. This field is only for information purposes and does not + affect the compression algorithm in any manner. + + deflate() returns Z_OK if some progress has been made (more input + processed or more output produced), Z_STREAM_END if all input has been + consumed and all output has been produced (only when flush is set to + Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example + if next_in or next_out was Z_NULL or the state was inadvertently written over + by the application), or Z_BUF_ERROR if no progress is possible (for example + avail_in or avail_out was zero). Note that Z_BUF_ERROR is not fatal, and + deflate() can be called again with more input and more output space to + continue compressing. +*/ + + +ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); +/* + All dynamically allocated data structures for this stream are freed. + This function discards any unprocessed input and does not flush any pending + output. + + deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the + stream state was inconsistent, Z_DATA_ERROR if the stream was freed + prematurely (some input or output was discarded). In the error case, msg + may be set but then points to a static string (which must not be + deallocated). +*/ + + +/* +ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); + + Initializes the internal stream state for decompression. The fields + next_in, avail_in, zalloc, zfree and opaque must be initialized before by + the caller. In the current version of inflate, the provided input is not + read or consumed. The allocation of a sliding window will be deferred to + the first call of inflate (if the decompression does not complete on the + first call). If zalloc and zfree are set to Z_NULL, inflateInit updates + them to use default allocation functions. + + inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_VERSION_ERROR if the zlib library version is incompatible with the + version assumed by the caller, or Z_STREAM_ERROR if the parameters are + invalid, such as a null pointer to the structure. msg is set to null if + there is no error message. inflateInit does not perform any decompression. + Actual decompression will be done by inflate(). So next_in, and avail_in, + next_out, and avail_out are unused and unchanged. The current + implementation of inflateInit() does not process any header information -- + that is deferred until inflate() is called. +*/ + + +ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); +/* + inflate decompresses as much data as possible, and stops when the input + buffer becomes empty or the output buffer becomes full. It may introduce + some output latency (reading input without producing any output) except when + forced to flush. + + The detailed semantics are as follows. inflate performs one or both of the + following actions: + + - Decompress more input starting at next_in and update next_in and avail_in + accordingly. If not all input can be processed (because there is not + enough room in the output buffer), then next_in and avail_in are updated + accordingly, and processing will resume at this point for the next call of + inflate(). + + - Generate more output starting at next_out and update next_out and avail_out + accordingly. inflate() provides as much output as possible, until there is + no more input data or no more space in the output buffer (see below about + the flush parameter). + + Before the call of inflate(), the application should ensure that at least + one of the actions is possible, by providing more input and/or consuming more + output, and updating the next_* and avail_* values accordingly. If the + caller of inflate() does not provide both available input and available + output space, it is possible that there will be no progress made. The + application can consume the uncompressed output when it wants, for example + when the output buffer is full (avail_out == 0), or after each call of + inflate(). If inflate returns Z_OK and with zero avail_out, it must be + called again after making room in the output buffer because there might be + more output pending. + + The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, Z_FINISH, + Z_BLOCK, or Z_TREES. Z_SYNC_FLUSH requests that inflate() flush as much + output as possible to the output buffer. Z_BLOCK requests that inflate() + stop if and when it gets to the next deflate block boundary. When decoding + the zlib or gzip format, this will cause inflate() to return immediately + after the header and before the first block. When doing a raw inflate, + inflate() will go ahead and process the first block, and will return when it + gets to the end of that block, or when it runs out of data. + + The Z_BLOCK option assists in appending to or combining deflate streams. + To assist in this, on return inflate() always sets strm->data_type to the + number of unused bits in the last byte taken from strm->next_in, plus 64 if + inflate() is currently decoding the last block in the deflate stream, plus + 128 if inflate() returned immediately after decoding an end-of-block code or + decoding the complete header up to just before the first byte of the deflate + stream. The end-of-block will not be indicated until all of the uncompressed + data from that block has been written to strm->next_out. The number of + unused bits may in general be greater than seven, except when bit 7 of + data_type is set, in which case the number of unused bits will be less than + eight. data_type is set as noted here every time inflate() returns for all + flush options, and so can be used to determine the amount of currently + consumed input in bits. + + The Z_TREES option behaves as Z_BLOCK does, but it also returns when the + end of each deflate block header is reached, before any actual data in that + block is decoded. This allows the caller to determine the length of the + deflate block header for later use in random access within a deflate block. + 256 is added to the value of strm->data_type when inflate() returns + immediately after reaching the end of the deflate block header. + + inflate() should normally be called until it returns Z_STREAM_END or an + error. However if all decompression is to be performed in a single step (a + single call of inflate), the parameter flush should be set to Z_FINISH. In + this case all pending input is processed and all pending output is flushed; + avail_out must be large enough to hold all of the uncompressed data for the + operation to complete. (The size of the uncompressed data may have been + saved by the compressor for this purpose.) The use of Z_FINISH is not + required to perform an inflation in one step. However it may be used to + inform inflate that a faster approach can be used for the single inflate() + call. Z_FINISH also informs inflate to not maintain a sliding window if the + stream completes, which reduces inflate's memory footprint. If the stream + does not complete, either because not all of the stream is provided or not + enough output space is provided, then a sliding window will be allocated and + inflate() can be called again to continue the operation as if Z_NO_FLUSH had + been used. + + In this implementation, inflate() always flushes as much output as + possible to the output buffer, and always uses the faster approach on the + first call. So the effects of the flush parameter in this implementation are + on the return value of inflate() as noted below, when inflate() returns early + when Z_BLOCK or Z_TREES is used, and when inflate() avoids the allocation of + memory for a sliding window when Z_FINISH is used. + + If a preset dictionary is needed after this call (see inflateSetDictionary + below), inflate sets strm->adler to the Adler-32 checksum of the dictionary + chosen by the compressor and returns Z_NEED_DICT; otherwise it sets + strm->adler to the Adler-32 checksum of all output produced so far (that is, + total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described + below. At the end of the stream, inflate() checks that its computed Adler-32 + checksum is equal to that saved by the compressor and returns Z_STREAM_END + only if the checksum is correct. + + inflate() can decompress and check either zlib-wrapped or gzip-wrapped + deflate data. The header type is detected automatically, if requested when + initializing with inflateInit2(). Any information contained in the gzip + header is not retained unless inflateGetHeader() is used. When processing + gzip-wrapped deflate data, strm->adler32 is set to the CRC-32 of the output + produced so far. The CRC-32 is checked against the gzip trailer, as is the + uncompressed length, modulo 2^32. + + inflate() returns Z_OK if some progress has been made (more input processed + or more output produced), Z_STREAM_END if the end of the compressed data has + been reached and all uncompressed output has been produced, Z_NEED_DICT if a + preset dictionary is needed at this point, Z_DATA_ERROR if the input data was + corrupted (input stream not conforming to the zlib format or incorrect check + value, in which case strm->msg points to a string with a more specific + error), Z_STREAM_ERROR if the stream structure was inconsistent (for example + next_in or next_out was Z_NULL, or the state was inadvertently written over + by the application), Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR + if no progress was possible or if there was not enough room in the output + buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and + inflate() can be called again with more input and more output space to + continue decompressing. If Z_DATA_ERROR is returned, the application may + then call inflateSync() to look for a good compression block if a partial + recovery of the data is to be attempted. +*/ + + +ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); +/* + All dynamically allocated data structures for this stream are freed. + This function discards any unprocessed input and does not flush any pending + output. + + inflateEnd returns Z_OK if success, or Z_STREAM_ERROR if the stream state + was inconsistent. +*/ + + + /* Advanced functions */ + +/* + The following functions are needed only in some special applications. +*/ + +/* +ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, + int level, + int method, + int windowBits, + int memLevel, + int strategy)); + + This is another version of deflateInit with more compression options. The + fields next_in, zalloc, zfree and opaque must be initialized before by the + caller. + + The method parameter is the compression method. It must be Z_DEFLATED in + this version of the library. + + The windowBits parameter is the base two logarithm of the window size + (the size of the history buffer). It should be in the range 8..15 for this + version of the library. Larger values of this parameter result in better + compression at the expense of memory usage. The default value is 15 if + deflateInit is used instead. + + For the current implementation of deflate(), a windowBits value of 8 (a + window size of 256 bytes) is not supported. As a result, a request for 8 + will result in 9 (a 512-byte window). In that case, providing 8 to + inflateInit2() will result in an error when the zlib header with 9 is + checked against the initialization of inflate(). The remedy is to not use 8 + with deflateInit2() with this initialization, or at least in that case use 9 + with inflateInit2(). + + windowBits can also be -8..-15 for raw deflate. In this case, -windowBits + determines the window size. deflate() will then generate raw deflate data + with no zlib header or trailer, and will not compute a check value. + + windowBits can also be greater than 15 for optional gzip encoding. Add + 16 to windowBits to write a simple gzip header and trailer around the + compressed data instead of a zlib wrapper. The gzip header will have no + file name, no extra data, no comment, no modification time (set to zero), no + header crc, and the operating system will be set to the appropriate value, + if the operating system was determined at compile time. If a gzip stream is + being written, strm->adler is a CRC-32 instead of an Adler-32. + + For raw deflate or gzip encoding, a request for a 256-byte window is + rejected as invalid, since only the zlib header provides a means of + transmitting the window size to the decompressor. + + The memLevel parameter specifies how much memory should be allocated + for the internal compression state. memLevel=1 uses minimum memory but is + slow and reduces compression ratio; memLevel=9 uses maximum memory for + optimal speed. The default value is 8. See zconf.h for total memory usage + as a function of windowBits and memLevel. + + The strategy parameter is used to tune the compression algorithm. Use the + value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a + filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no + string match), or Z_RLE to limit match distances to one (run-length + encoding). Filtered data consists mostly of small values with a somewhat + random distribution. In this case, the compression algorithm is tuned to + compress them better. The effect of Z_FILTERED is to force more Huffman + coding and less string matching; it is somewhat intermediate between + Z_DEFAULT_STRATEGY and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as + fast as Z_HUFFMAN_ONLY, but give better compression for PNG image data. The + strategy parameter only affects the compression ratio but not the + correctness of the compressed output even if it is not set appropriately. + Z_FIXED prevents the use of dynamic Huffman codes, allowing for a simpler + decoder for special applications. + + deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_STREAM_ERROR if any parameter is invalid (such as an invalid + method), or Z_VERSION_ERROR if the zlib library version (zlib_version) is + incompatible with the version assumed by the caller (ZLIB_VERSION). msg is + set to null if there is no error message. deflateInit2 does not perform any + compression: this will be done by deflate(). +*/ + +ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, + const Bytef *dictionary, + uInt dictLength)); +/* + Initializes the compression dictionary from the given byte sequence + without producing any compressed output. When using the zlib format, this + function must be called immediately after deflateInit, deflateInit2 or + deflateReset, and before any call of deflate. When doing raw deflate, this + function must be called either before any call of deflate, or immediately + after the completion of a deflate block, i.e. after all input has been + consumed and all output has been delivered when using any of the flush + options Z_BLOCK, Z_PARTIAL_FLUSH, Z_SYNC_FLUSH, or Z_FULL_FLUSH. The + compressor and decompressor must use exactly the same dictionary (see + inflateSetDictionary). + + The dictionary should consist of strings (byte sequences) that are likely + to be encountered later in the data to be compressed, with the most commonly + used strings preferably put towards the end of the dictionary. Using a + dictionary is most useful when the data to be compressed is short and can be + predicted with good accuracy; the data can then be compressed better than + with the default empty dictionary. + + Depending on the size of the compression data structures selected by + deflateInit or deflateInit2, a part of the dictionary may in effect be + discarded, for example if the dictionary is larger than the window size + provided in deflateInit or deflateInit2. Thus the strings most likely to be + useful should be put at the end of the dictionary, not at the front. In + addition, the current implementation of deflate will use at most the window + size minus 262 bytes of the provided dictionary. + + Upon return of this function, strm->adler is set to the Adler-32 value + of the dictionary; the decompressor may later use this value to determine + which dictionary has been used by the compressor. (The Adler-32 value + applies to the whole dictionary even if only a subset of the dictionary is + actually used by the compressor.) If a raw deflate was requested, then the + Adler-32 value is not computed and strm->adler is not set. + + deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a + parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is + inconsistent (for example if deflate has already been called for this stream + or if not at a block boundary for raw deflate). deflateSetDictionary does + not perform any compression: this will be done by deflate(). +*/ + +ZEXTERN int ZEXPORT deflateGetDictionary OF((z_streamp strm, + Bytef *dictionary, + uInt *dictLength)); +/* + Returns the sliding dictionary being maintained by deflate. dictLength is + set to the number of bytes in the dictionary, and that many bytes are copied + to dictionary. dictionary must have enough space, where 32768 bytes is + always enough. If deflateGetDictionary() is called with dictionary equal to + Z_NULL, then only the dictionary length is returned, and nothing is copied. + Similary, if dictLength is Z_NULL, then it is not set. + + deflateGetDictionary() may return a length less than the window size, even + when more than the window size in input has been provided. It may return up + to 258 bytes less in that case, due to how zlib's implementation of deflate + manages the sliding window and lookahead for matches, where matches can be + up to 258 bytes long. If the application needs the last window-size bytes of + input, then that would need to be saved by the application outside of zlib. + + deflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the + stream state is inconsistent. +*/ + +ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, + z_streamp source)); +/* + Sets the destination stream as a complete copy of the source stream. + + This function can be useful when several compression strategies will be + tried, for example when there are several ways of pre-processing the input + data with a filter. The streams that will be discarded should then be freed + by calling deflateEnd. Note that deflateCopy duplicates the internal + compression state which can be quite large, so this strategy is slow and can + consume lots of memory. + + deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_STREAM_ERROR if the source stream state was inconsistent + (such as zalloc being Z_NULL). msg is left unchanged in both source and + destination. +*/ + +ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); +/* + This function is equivalent to deflateEnd followed by deflateInit, but + does not free and reallocate the internal compression state. The stream + will leave the compression level and any other attributes that may have been + set unchanged. + + deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being Z_NULL). +*/ + +ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, + int level, + int strategy)); +/* + Dynamically update the compression level and compression strategy. The + interpretation of level and strategy is as in deflateInit2(). This can be + used to switch between compression and straight copy of the input data, or + to switch to a different kind of input data requiring a different strategy. + If the compression approach (which is a function of the level) or the + strategy is changed, and if any input has been consumed in a previous + deflate() call, then the input available so far is compressed with the old + level and strategy using deflate(strm, Z_BLOCK). There are three approaches + for the compression levels 0, 1..3, and 4..9 respectively. The new level + and strategy will take effect at the next call of deflate(). + + If a deflate(strm, Z_BLOCK) is performed by deflateParams(), and it does + not have enough output space to complete, then the parameter change will not + take effect. In this case, deflateParams() can be called again with the + same parameters and more output space to try again. + + In order to assure a change in the parameters on the first try, the + deflate stream should be flushed using deflate() with Z_BLOCK or other flush + request until strm.avail_out is not zero, before calling deflateParams(). + Then no more input data should be provided before the deflateParams() call. + If this is done, the old level and strategy will be applied to the data + compressed before deflateParams(), and the new level and strategy will be + applied to the the data compressed after deflateParams(). + + deflateParams returns Z_OK on success, Z_STREAM_ERROR if the source stream + state was inconsistent or if a parameter was invalid, or Z_BUF_ERROR if + there was not enough output space to complete the compression of the + available input data before a change in the strategy or approach. Note that + in the case of a Z_BUF_ERROR, the parameters are not changed. A return + value of Z_BUF_ERROR is not fatal, in which case deflateParams() can be + retried with more output space. +*/ + +ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm, + int good_length, + int max_lazy, + int nice_length, + int max_chain)); +/* + Fine tune deflate's internal compression parameters. This should only be + used by someone who understands the algorithm used by zlib's deflate for + searching for the best matching string, and even then only by the most + fanatic optimizer trying to squeeze out the last compressed bit for their + specific input data. Read the deflate.c source code for the meaning of the + max_lazy, good_length, nice_length, and max_chain parameters. + + deflateTune() can be called after deflateInit() or deflateInit2(), and + returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream. + */ + +ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm, + uLong sourceLen)); +/* + deflateBound() returns an upper bound on the compressed size after + deflation of sourceLen bytes. It must be called after deflateInit() or + deflateInit2(), and after deflateSetHeader(), if used. This would be used + to allocate an output buffer for deflation in a single pass, and so would be + called before deflate(). If that first deflate() call is provided the + sourceLen input bytes, an output buffer allocated to the size returned by + deflateBound(), and the flush value Z_FINISH, then deflate() is guaranteed + to return Z_STREAM_END. Note that it is possible for the compressed size to + be larger than the value returned by deflateBound() if flush options other + than Z_FINISH or Z_NO_FLUSH are used. +*/ + +ZEXTERN int ZEXPORT deflatePending OF((z_streamp strm, + unsigned *pending, + int *bits)); +/* + deflatePending() returns the number of bytes and bits of output that have + been generated, but not yet provided in the available output. The bytes not + provided would be due to the available output space having being consumed. + The number of bits of output not provided are between 0 and 7, where they + await more bits to join them in order to fill out a full byte. If pending + or bits are Z_NULL, then those values are not set. + + deflatePending returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. + */ + +ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm, + int bits, + int value)); +/* + deflatePrime() inserts bits in the deflate output stream. The intent + is that this function is used to start off the deflate output with the bits + leftover from a previous deflate stream when appending to it. As such, this + function can only be used for raw deflate, and must be used before the first + deflate() call after a deflateInit2() or deflateReset(). bits must be less + than or equal to 16, and that many of the least significant bits of value + will be inserted in the output. + + deflatePrime returns Z_OK if success, Z_BUF_ERROR if there was not enough + room in the internal buffer to insert the bits, or Z_STREAM_ERROR if the + source stream state was inconsistent. +*/ + +ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm, + gz_headerp head)); +/* + deflateSetHeader() provides gzip header information for when a gzip + stream is requested by deflateInit2(). deflateSetHeader() may be called + after deflateInit2() or deflateReset() and before the first call of + deflate(). The text, time, os, extra field, name, and comment information + in the provided gz_header structure are written to the gzip header (xflag is + ignored -- the extra flags are set according to the compression level). The + caller must assure that, if not Z_NULL, name and comment are terminated with + a zero byte, and that if extra is not Z_NULL, that extra_len bytes are + available there. If hcrc is true, a gzip header crc is included. Note that + the current versions of the command-line version of gzip (up through version + 1.3.x) do not support header crc's, and will report that it is a "multi-part + gzip file" and give up. + + If deflateSetHeader is not used, the default gzip header has text false, + the time set to zero, and os set to 255, with no extra, name, or comment + fields. The gzip header is returned to the default state by deflateReset(). + + deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +/* +ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, + int windowBits)); + + This is another version of inflateInit with an extra parameter. The + fields next_in, avail_in, zalloc, zfree and opaque must be initialized + before by the caller. + + The windowBits parameter is the base two logarithm of the maximum window + size (the size of the history buffer). It should be in the range 8..15 for + this version of the library. The default value is 15 if inflateInit is used + instead. windowBits must be greater than or equal to the windowBits value + provided to deflateInit2() while compressing, or it must be equal to 15 if + deflateInit2() was not used. If a compressed stream with a larger window + size is given as input, inflate() will return with the error code + Z_DATA_ERROR instead of trying to allocate a larger window. + + windowBits can also be zero to request that inflate use the window size in + the zlib header of the compressed stream. + + windowBits can also be -8..-15 for raw inflate. In this case, -windowBits + determines the window size. inflate() will then process raw deflate data, + not looking for a zlib or gzip header, not generating a check value, and not + looking for any check values for comparison at the end of the stream. This + is for use with other formats that use the deflate compressed data format + such as zip. Those formats provide their own check values. If a custom + format is developed using the raw deflate format for compressed data, it is + recommended that a check value such as an Adler-32 or a CRC-32 be applied to + the uncompressed data as is done in the zlib, gzip, and zip formats. For + most applications, the zlib format should be used as is. Note that comments + above on the use in deflateInit2() applies to the magnitude of windowBits. + + windowBits can also be greater than 15 for optional gzip decoding. Add + 32 to windowBits to enable zlib and gzip decoding with automatic header + detection, or add 16 to decode only the gzip format (the zlib format will + return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is a + CRC-32 instead of an Adler-32. Unlike the gunzip utility and gzread() (see + below), inflate() will not automatically decode concatenated gzip streams. + inflate() will return Z_STREAM_END at the end of the gzip stream. The state + would need to be reset to continue decoding a subsequent gzip stream. + + inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_VERSION_ERROR if the zlib library version is incompatible with the + version assumed by the caller, or Z_STREAM_ERROR if the parameters are + invalid, such as a null pointer to the structure. msg is set to null if + there is no error message. inflateInit2 does not perform any decompression + apart from possibly reading the zlib header if present: actual decompression + will be done by inflate(). (So next_in and avail_in may be modified, but + next_out and avail_out are unused and unchanged.) The current implementation + of inflateInit2() does not process any header information -- that is + deferred until inflate() is called. +*/ + +ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, + const Bytef *dictionary, + uInt dictLength)); +/* + Initializes the decompression dictionary from the given uncompressed byte + sequence. This function must be called immediately after a call of inflate, + if that call returned Z_NEED_DICT. The dictionary chosen by the compressor + can be determined from the Adler-32 value returned by that call of inflate. + The compressor and decompressor must use exactly the same dictionary (see + deflateSetDictionary). For raw inflate, this function can be called at any + time to set the dictionary. If the provided dictionary is smaller than the + window and there is already data in the window, then the provided dictionary + will amend what's there. The application must insure that the dictionary + that was used for compression is provided. + + inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a + parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is + inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the + expected one (incorrect Adler-32 value). inflateSetDictionary does not + perform any decompression: this will be done by subsequent calls of + inflate(). +*/ + +ZEXTERN int ZEXPORT inflateGetDictionary OF((z_streamp strm, + Bytef *dictionary, + uInt *dictLength)); +/* + Returns the sliding dictionary being maintained by inflate. dictLength is + set to the number of bytes in the dictionary, and that many bytes are copied + to dictionary. dictionary must have enough space, where 32768 bytes is + always enough. If inflateGetDictionary() is called with dictionary equal to + Z_NULL, then only the dictionary length is returned, and nothing is copied. + Similary, if dictLength is Z_NULL, then it is not set. + + inflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the + stream state is inconsistent. +*/ + +ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); +/* + Skips invalid compressed data until a possible full flush point (see above + for the description of deflate with Z_FULL_FLUSH) can be found, or until all + available input is skipped. No output is provided. + + inflateSync searches for a 00 00 FF FF pattern in the compressed data. + All full flush points have this pattern, but not all occurrences of this + pattern are full flush points. + + inflateSync returns Z_OK if a possible full flush point has been found, + Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point + has been found, or Z_STREAM_ERROR if the stream structure was inconsistent. + In the success case, the application may save the current current value of + total_in which indicates where valid compressed data was found. In the + error case, the application may repeatedly call inflateSync, providing more + input each time, until success or end of the input data. +*/ + +ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest, + z_streamp source)); +/* + Sets the destination stream as a complete copy of the source stream. + + This function can be useful when randomly accessing a large stream. The + first pass through the stream can periodically record the inflate state, + allowing restarting inflate at those points when randomly accessing the + stream. + + inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_STREAM_ERROR if the source stream state was inconsistent + (such as zalloc being Z_NULL). msg is left unchanged in both source and + destination. +*/ + +ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); +/* + This function is equivalent to inflateEnd followed by inflateInit, + but does not free and reallocate the internal decompression state. The + stream will keep attributes that may have been set by inflateInit2. + + inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being Z_NULL). +*/ + +ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm, + int windowBits)); +/* + This function is the same as inflateReset, but it also permits changing + the wrap and window size requests. The windowBits parameter is interpreted + the same as it is for inflateInit2. If the window size is changed, then the + memory allocated for the window is freed, and the window will be reallocated + by inflate() if needed. + + inflateReset2 returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being Z_NULL), or if + the windowBits parameter is invalid. +*/ + +ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm, + int bits, + int value)); +/* + This function inserts bits in the inflate input stream. The intent is + that this function is used to start inflating at a bit position in the + middle of a byte. The provided bits will be used before any bytes are used + from next_in. This function should only be used with raw inflate, and + should be used before the first inflate() call after inflateInit2() or + inflateReset(). bits must be less than or equal to 16, and that many of the + least significant bits of value will be inserted in the input. + + If bits is negative, then the input stream bit buffer is emptied. Then + inflatePrime() can be called again to put bits in the buffer. This is used + to clear out bits leftover after feeding inflate a block description prior + to feeding inflate codes. + + inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +ZEXTERN long ZEXPORT inflateMark OF((z_streamp strm)); +/* + This function returns two values, one in the lower 16 bits of the return + value, and the other in the remaining upper bits, obtained by shifting the + return value down 16 bits. If the upper value is -1 and the lower value is + zero, then inflate() is currently decoding information outside of a block. + If the upper value is -1 and the lower value is non-zero, then inflate is in + the middle of a stored block, with the lower value equaling the number of + bytes from the input remaining to copy. If the upper value is not -1, then + it is the number of bits back from the current bit position in the input of + the code (literal or length/distance pair) currently being processed. In + that case the lower value is the number of bytes already emitted for that + code. + + A code is being processed if inflate is waiting for more input to complete + decoding of the code, or if it has completed decoding but is waiting for + more output space to write the literal or match data. + + inflateMark() is used to mark locations in the input data for random + access, which may be at bit positions, and to note those cases where the + output of a code may span boundaries of random access blocks. The current + location in the input stream can be determined from avail_in and data_type + as noted in the description for the Z_BLOCK flush parameter for inflate. + + inflateMark returns the value noted above, or -65536 if the provided + source stream state was inconsistent. +*/ + +ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm, + gz_headerp head)); +/* + inflateGetHeader() requests that gzip header information be stored in the + provided gz_header structure. inflateGetHeader() may be called after + inflateInit2() or inflateReset(), and before the first call of inflate(). + As inflate() processes the gzip stream, head->done is zero until the header + is completed, at which time head->done is set to one. If a zlib stream is + being decoded, then head->done is set to -1 to indicate that there will be + no gzip header information forthcoming. Note that Z_BLOCK or Z_TREES can be + used to force inflate() to return immediately after header processing is + complete and before any actual data is decompressed. + + The text, time, xflags, and os fields are filled in with the gzip header + contents. hcrc is set to true if there is a header CRC. (The header CRC + was valid if done is set to one.) If extra is not Z_NULL, then extra_max + contains the maximum number of bytes to write to extra. Once done is true, + extra_len contains the actual extra field length, and extra contains the + extra field, or that field truncated if extra_max is less than extra_len. + If name is not Z_NULL, then up to name_max characters are written there, + terminated with a zero unless the length is greater than name_max. If + comment is not Z_NULL, then up to comm_max characters are written there, + terminated with a zero unless the length is greater than comm_max. When any + of extra, name, or comment are not Z_NULL and the respective field is not + present in the header, then that field is set to Z_NULL to signal its + absence. This allows the use of deflateSetHeader() with the returned + structure to duplicate the header. However if those fields are set to + allocated memory, then the application will need to save those pointers + elsewhere so that they can be eventually freed. + + If inflateGetHeader is not used, then the header information is simply + discarded. The header is always checked for validity, including the header + CRC if present. inflateReset() will reset the process to discard the header + information. The application would need to call inflateGetHeader() again to + retrieve the header from the next gzip stream. + + inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +/* +ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits, + unsigned char FAR *window)); + + Initialize the internal stream state for decompression using inflateBack() + calls. The fields zalloc, zfree and opaque in strm must be initialized + before the call. If zalloc and zfree are Z_NULL, then the default library- + derived memory allocation routines are used. windowBits is the base two + logarithm of the window size, in the range 8..15. window is a caller + supplied buffer of that size. Except for special applications where it is + assured that deflate was used with small window sizes, windowBits must be 15 + and a 32K byte window must be supplied to be able to decompress general + deflate streams. + + See inflateBack() for the usage of these routines. + + inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of + the parameters are invalid, Z_MEM_ERROR if the internal state could not be + allocated, or Z_VERSION_ERROR if the version of the library does not match + the version of the header file. +*/ + +typedef unsigned (*in_func) OF((void FAR *, + z_const unsigned char FAR * FAR *)); +typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned)); + +ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm, + in_func in, void FAR *in_desc, + out_func out, void FAR *out_desc)); +/* + inflateBack() does a raw inflate with a single call using a call-back + interface for input and output. This is potentially more efficient than + inflate() for file i/o applications, in that it avoids copying between the + output and the sliding window by simply making the window itself the output + buffer. inflate() can be faster on modern CPUs when used with large + buffers. inflateBack() trusts the application to not change the output + buffer passed by the output function, at least until inflateBack() returns. + + inflateBackInit() must be called first to allocate the internal state + and to initialize the state with the user-provided window buffer. + inflateBack() may then be used multiple times to inflate a complete, raw + deflate stream with each call. inflateBackEnd() is then called to free the + allocated state. + + A raw deflate stream is one with no zlib or gzip header or trailer. + This routine would normally be used in a utility that reads zip or gzip + files and writes out uncompressed files. The utility would decode the + header and process the trailer on its own, hence this routine expects only + the raw deflate stream to decompress. This is different from the default + behavior of inflate(), which expects a zlib header and trailer around the + deflate stream. + + inflateBack() uses two subroutines supplied by the caller that are then + called by inflateBack() for input and output. inflateBack() calls those + routines until it reads a complete deflate stream and writes out all of the + uncompressed data, or until it encounters an error. The function's + parameters and return types are defined above in the in_func and out_func + typedefs. inflateBack() will call in(in_desc, &buf) which should return the + number of bytes of provided input, and a pointer to that input in buf. If + there is no input available, in() must return zero -- buf is ignored in that + case -- and inflateBack() will return a buffer error. inflateBack() will + call out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. + out() should return zero on success, or non-zero on failure. If out() + returns non-zero, inflateBack() will return with an error. Neither in() nor + out() are permitted to change the contents of the window provided to + inflateBackInit(), which is also the buffer that out() uses to write from. + The length written by out() will be at most the window size. Any non-zero + amount of input may be provided by in(). + + For convenience, inflateBack() can be provided input on the first call by + setting strm->next_in and strm->avail_in. If that input is exhausted, then + in() will be called. Therefore strm->next_in must be initialized before + calling inflateBack(). If strm->next_in is Z_NULL, then in() will be called + immediately for input. If strm->next_in is not Z_NULL, then strm->avail_in + must also be initialized, and then if strm->avail_in is not zero, input will + initially be taken from strm->next_in[0 .. strm->avail_in - 1]. + + The in_desc and out_desc parameters of inflateBack() is passed as the + first parameter of in() and out() respectively when they are called. These + descriptors can be optionally used to pass any information that the caller- + supplied in() and out() functions need to do their job. + + On return, inflateBack() will set strm->next_in and strm->avail_in to + pass back any unused input that was provided by the last in() call. The + return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR + if in() or out() returned an error, Z_DATA_ERROR if there was a format error + in the deflate stream (in which case strm->msg is set to indicate the nature + of the error), or Z_STREAM_ERROR if the stream was not properly initialized. + In the case of Z_BUF_ERROR, an input or output error can be distinguished + using strm->next_in which will be Z_NULL only if in() returned an error. If + strm->next_in is not Z_NULL, then the Z_BUF_ERROR was due to out() returning + non-zero. (in() will always be called before out(), so strm->next_in is + assured to be defined if out() returns non-zero.) Note that inflateBack() + cannot return Z_OK. +*/ + +ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm)); +/* + All memory allocated by inflateBackInit() is freed. + + inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream + state was inconsistent. +*/ + +ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void)); +/* Return flags indicating compile-time options. + + Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other: + 1.0: size of uInt + 3.2: size of uLong + 5.4: size of voidpf (pointer) + 7.6: size of z_off_t + + Compiler, assembler, and debug options: + 8: ZLIB_DEBUG + 9: ASMV or ASMINF -- use ASM code + 10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention + 11: 0 (reserved) + + One-time table building (smaller code, but not thread-safe if true): + 12: BUILDFIXED -- build static block decoding tables when needed + 13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed + 14,15: 0 (reserved) + + Library content (indicates missing functionality): + 16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking + deflate code when not needed) + 17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect + and decode gzip streams (to avoid linking crc code) + 18-19: 0 (reserved) + + Operation variations (changes in library functionality): + 20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate + 21: FASTEST -- deflate algorithm with only one, lowest compression level + 22,23: 0 (reserved) + + The sprintf variant used by gzprintf (zero is best): + 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format + 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure! + 26: 0 = returns value, 1 = void -- 1 means inferred string length returned + + Remainder: + 27-31: 0 (reserved) + */ + +#ifndef Z_SOLO + + /* utility functions */ + +/* + The following utility functions are implemented on top of the basic + stream-oriented functions. To simplify the interface, some default options + are assumed (compression level and memory usage, standard memory allocation + functions). The source code of these utility functions can be modified if + you need special options. +*/ + +ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen)); +/* + Compresses the source buffer into the destination buffer. sourceLen is + the byte length of the source buffer. Upon entry, destLen is the total size + of the destination buffer, which must be at least the value returned by + compressBound(sourceLen). Upon exit, destLen is the actual size of the + compressed data. compress() is equivalent to compress2() with a level + parameter of Z_DEFAULT_COMPRESSION. + + compress returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_BUF_ERROR if there was not enough room in the output + buffer. +*/ + +ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen, + int level)); +/* + Compresses the source buffer into the destination buffer. The level + parameter has the same meaning as in deflateInit. sourceLen is the byte + length of the source buffer. Upon entry, destLen is the total size of the + destination buffer, which must be at least the value returned by + compressBound(sourceLen). Upon exit, destLen is the actual size of the + compressed data. + + compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_BUF_ERROR if there was not enough room in the output buffer, + Z_STREAM_ERROR if the level parameter is invalid. +*/ + +ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen)); +/* + compressBound() returns an upper bound on the compressed size after + compress() or compress2() on sourceLen bytes. It would be used before a + compress() or compress2() call to allocate the destination buffer. +*/ + +ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen)); +/* + Decompresses the source buffer into the destination buffer. sourceLen is + the byte length of the source buffer. Upon entry, destLen is the total size + of the destination buffer, which must be large enough to hold the entire + uncompressed data. (The size of the uncompressed data must have been saved + previously by the compressor and transmitted to the decompressor by some + mechanism outside the scope of this compression library.) Upon exit, destLen + is the actual size of the uncompressed data. + + uncompress returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_BUF_ERROR if there was not enough room in the output + buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. In + the case where there is not enough room, uncompress() will fill the output + buffer with the uncompressed data up to that point. +*/ + +ZEXTERN int ZEXPORT uncompress2 OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong *sourceLen)); +/* + Same as uncompress, except that sourceLen is a pointer, where the + length of the source is *sourceLen. On return, *sourceLen is the number of + source bytes consumed. +*/ + + /* gzip file access functions */ + +/* + This library supports reading and writing files in gzip (.gz) format with + an interface similar to that of stdio, using the functions that start with + "gz". The gzip format is different from the zlib format. gzip is a gzip + wrapper, documented in RFC 1952, wrapped around a deflate stream. +*/ + +typedef struct gzFile_s *gzFile; /* semi-opaque gzip file descriptor */ + +/* +ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); + + Opens a gzip (.gz) file for reading or writing. The mode parameter is as + in fopen ("rb" or "wb") but can also include a compression level ("wb9") or + a strategy: 'f' for filtered data as in "wb6f", 'h' for Huffman-only + compression as in "wb1h", 'R' for run-length encoding as in "wb1R", or 'F' + for fixed code compression as in "wb9F". (See the description of + deflateInit2 for more information about the strategy parameter.) 'T' will + request transparent writing or appending with no compression and not using + the gzip format. + + "a" can be used instead of "w" to request that the gzip stream that will + be written be appended to the file. "+" will result in an error, since + reading and writing to the same gzip file is not supported. The addition of + "x" when writing will create the file exclusively, which fails if the file + already exists. On systems that support it, the addition of "e" when + reading or writing will set the flag to close the file on an execve() call. + + These functions, as well as gzip, will read and decode a sequence of gzip + streams in a file. The append function of gzopen() can be used to create + such a file. (Also see gzflush() for another way to do this.) When + appending, gzopen does not test whether the file begins with a gzip stream, + nor does it look for the end of the gzip streams to begin appending. gzopen + will simply append a gzip stream to the existing file. + + gzopen can be used to read a file which is not in gzip format; in this + case gzread will directly read from the file without decompression. When + reading, this will be detected automatically by looking for the magic two- + byte gzip header. + + gzopen returns NULL if the file could not be opened, if there was + insufficient memory to allocate the gzFile state, or if an invalid mode was + specified (an 'r', 'w', or 'a' was not provided, or '+' was provided). + errno can be checked to determine if the reason gzopen failed was that the + file could not be opened. +*/ + +ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); +/* + gzdopen associates a gzFile with the file descriptor fd. File descriptors + are obtained from calls like open, dup, creat, pipe or fileno (if the file + has been previously opened with fopen). The mode parameter is as in gzopen. + + The next call of gzclose on the returned gzFile will also close the file + descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor + fd. If you want to keep fd open, use fd = dup(fd_keep); gz = gzdopen(fd, + mode);. The duplicated descriptor should be saved to avoid a leak, since + gzdopen does not close fd if it fails. If you are using fileno() to get the + file descriptor from a FILE *, then you will have to use dup() to avoid + double-close()ing the file descriptor. Both gzclose() and fclose() will + close the associated file descriptor, so they need to have different file + descriptors. + + gzdopen returns NULL if there was insufficient memory to allocate the + gzFile state, if an invalid mode was specified (an 'r', 'w', or 'a' was not + provided, or '+' was provided), or if fd is -1. The file descriptor is not + used until the next gz* read, write, seek, or close operation, so gzdopen + will not detect if fd is invalid (unless fd is -1). +*/ + +ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size)); +/* + Set the internal buffer size used by this library's functions. The + default buffer size is 8192 bytes. This function must be called after + gzopen() or gzdopen(), and before any other calls that read or write the + file. The buffer memory allocation is always deferred to the first read or + write. Three times that size in buffer space is allocated. A larger buffer + size of, for example, 64K or 128K bytes will noticeably increase the speed + of decompression (reading). + + The new buffer size also affects the maximum length for gzprintf(). + + gzbuffer() returns 0 on success, or -1 on failure, such as being called + too late. +*/ + +ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); +/* + Dynamically update the compression level or strategy. See the description + of deflateInit2 for the meaning of these parameters. Previously provided + data is flushed before the parameter change. + + gzsetparams returns Z_OK if success, Z_STREAM_ERROR if the file was not + opened for writing, Z_ERRNO if there is an error writing the flushed data, + or Z_MEM_ERROR if there is a memory allocation error. +*/ + +ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); +/* + Reads the given number of uncompressed bytes from the compressed file. If + the input file is not in gzip format, gzread copies the given number of + bytes into the buffer directly from the file. + + After reaching the end of a gzip stream in the input, gzread will continue + to read, looking for another gzip stream. Any number of gzip streams may be + concatenated in the input file, and will all be decompressed by gzread(). + If something other than a gzip stream is encountered after a gzip stream, + that remaining trailing garbage is ignored (and no error is returned). + + gzread can be used to read a gzip file that is being concurrently written. + Upon reaching the end of the input, gzread will return with the available + data. If the error code returned by gzerror is Z_OK or Z_BUF_ERROR, then + gzclearerr can be used to clear the end of file indicator in order to permit + gzread to be tried again. Z_OK indicates that a gzip stream was completed + on the last gzread. Z_BUF_ERROR indicates that the input file ended in the + middle of a gzip stream. Note that gzread does not return -1 in the event + of an incomplete gzip stream. This error is deferred until gzclose(), which + will return Z_BUF_ERROR if the last gzread ended in the middle of a gzip + stream. Alternatively, gzerror can be used before gzclose to detect this + case. + + gzread returns the number of uncompressed bytes actually read, less than + len for end of file, or -1 for error. If len is too large to fit in an int, + then nothing is read, -1 is returned, and the error state is set to + Z_STREAM_ERROR. +*/ + +ZEXTERN z_size_t ZEXPORT gzfread OF((voidp buf, z_size_t size, z_size_t nitems, + gzFile file)); +/* + Read up to nitems items of size size from file to buf, otherwise operating + as gzread() does. This duplicates the interface of stdio's fread(), with + size_t request and return types. If the library defines size_t, then + z_size_t is identical to size_t. If not, then z_size_t is an unsigned + integer type that can contain a pointer. + + gzfread() returns the number of full items read of size size, or zero if + the end of the file was reached and a full item could not be read, or if + there was an error. gzerror() must be consulted if zero is returned in + order to determine if there was an error. If the multiplication of size and + nitems overflows, i.e. the product does not fit in a z_size_t, then nothing + is read, zero is returned, and the error state is set to Z_STREAM_ERROR. + + In the event that the end of file is reached and only a partial item is + available at the end, i.e. the remaining uncompressed data length is not a + multiple of size, then the final partial item is nevetheless read into buf + and the end-of-file flag is set. The length of the partial item read is not + provided, but could be inferred from the result of gztell(). This behavior + is the same as the behavior of fread() implementations in common libraries, + but it prevents the direct use of gzfread() to read a concurrently written + file, reseting and retrying on end-of-file, when size is not 1. +*/ + +ZEXTERN int ZEXPORT gzwrite OF((gzFile file, + voidpc buf, unsigned len)); +/* + Writes the given number of uncompressed bytes into the compressed file. + gzwrite returns the number of uncompressed bytes written or 0 in case of + error. +*/ + +ZEXTERN z_size_t ZEXPORT gzfwrite OF((voidpc buf, z_size_t size, + z_size_t nitems, gzFile file)); +/* + gzfwrite() writes nitems items of size size from buf to file, duplicating + the interface of stdio's fwrite(), with size_t request and return types. If + the library defines size_t, then z_size_t is identical to size_t. If not, + then z_size_t is an unsigned integer type that can contain a pointer. + + gzfwrite() returns the number of full items written of size size, or zero + if there was an error. If the multiplication of size and nitems overflows, + i.e. the product does not fit in a z_size_t, then nothing is written, zero + is returned, and the error state is set to Z_STREAM_ERROR. +*/ + +ZEXTERN int ZEXPORTVA gzprintf Z_ARG((gzFile file, const char *format, ...)); +/* + Converts, formats, and writes the arguments to the compressed file under + control of the format string, as in fprintf. gzprintf returns the number of + uncompressed bytes actually written, or a negative zlib error code in case + of error. The number of uncompressed bytes written is limited to 8191, or + one less than the buffer size given to gzbuffer(). The caller should assure + that this limit is not exceeded. If it is exceeded, then gzprintf() will + return an error (0) with nothing written. In this case, there may also be a + buffer overflow with unpredictable consequences, which is possible only if + zlib was compiled with the insecure functions sprintf() or vsprintf() + because the secure snprintf() or vsnprintf() functions were not available. + This can be determined using zlibCompileFlags(). +*/ + +ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); +/* + Writes the given null-terminated string to the compressed file, excluding + the terminating null character. + + gzputs returns the number of characters written, or -1 in case of error. +*/ + +ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); +/* + Reads bytes from the compressed file until len-1 characters are read, or a + newline character is read and transferred to buf, or an end-of-file + condition is encountered. If any characters are read or if len == 1, the + string is terminated with a null character. If no characters are read due + to an end-of-file or len < 1, then the buffer is left untouched. + + gzgets returns buf which is a null-terminated string, or it returns NULL + for end-of-file or in case of error. If there was an error, the contents at + buf are indeterminate. +*/ + +ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c)); +/* + Writes c, converted to an unsigned char, into the compressed file. gzputc + returns the value that was written, or -1 in case of error. +*/ + +ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); +/* + Reads one byte from the compressed file. gzgetc returns this byte or -1 + in case of end of file or error. This is implemented as a macro for speed. + As such, it does not do all of the checking the other functions do. I.e. + it does not check to see if file is NULL, nor whether the structure file + points to has been clobbered or not. +*/ + +ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file)); +/* + Push one character back onto the stream to be read as the first character + on the next read. At least one character of push-back is allowed. + gzungetc() returns the character pushed, or -1 on failure. gzungetc() will + fail if c is -1, and may fail if a character has been pushed but not read + yet. If gzungetc is used immediately after gzopen or gzdopen, at least the + output buffer size of pushed characters is allowed. (See gzbuffer above.) + The pushed character will be discarded if the stream is repositioned with + gzseek() or gzrewind(). +*/ + +ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); +/* + Flushes all pending output into the compressed file. The parameter flush + is as in the deflate() function. The return value is the zlib error number + (see function gzerror below). gzflush is only permitted when writing. + + If the flush parameter is Z_FINISH, the remaining data is written and the + gzip stream is completed in the output. If gzwrite() is called again, a new + gzip stream will be started in the output. gzread() is able to read such + concatenated gzip streams. + + gzflush should be called only when strictly necessary because it will + degrade compression if called too often. +*/ + +/* +ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, + z_off_t offset, int whence)); + + Sets the starting position for the next gzread or gzwrite on the given + compressed file. The offset represents a number of bytes in the + uncompressed data stream. The whence parameter is defined as in lseek(2); + the value SEEK_END is not supported. + + If the file is opened for reading, this function is emulated but can be + extremely slow. If the file is opened for writing, only forward seeks are + supported; gzseek then compresses a sequence of zeroes up to the new + starting position. + + gzseek returns the resulting offset location as measured in bytes from + the beginning of the uncompressed stream, or -1 in case of error, in + particular if the file is opened for writing and the new starting position + would be before the current position. +*/ + +ZEXTERN int ZEXPORT gzrewind OF((gzFile file)); +/* + Rewinds the given file. This function is supported only for reading. + + gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) +*/ + +/* +ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); + + Returns the starting position for the next gzread or gzwrite on the given + compressed file. This position represents a number of bytes in the + uncompressed data stream, and is zero when starting, even if appending or + reading a gzip stream from the middle of a file using gzdopen(). + + gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) +*/ + +/* +ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile file)); + + Returns the current offset in the file being read or written. This offset + includes the count of bytes that precede the gzip stream, for example when + appending or when using gzdopen() for reading. When reading, the offset + does not include as yet unused buffered input. This information can be used + for a progress indicator. On error, gzoffset() returns -1. +*/ + +ZEXTERN int ZEXPORT gzeof OF((gzFile file)); +/* + Returns true (1) if the end-of-file indicator has been set while reading, + false (0) otherwise. Note that the end-of-file indicator is set only if the + read tried to go past the end of the input, but came up short. Therefore, + just like feof(), gzeof() may return false even if there is no more data to + read, in the event that the last read request was for the exact number of + bytes remaining in the input file. This will happen if the input file size + is an exact multiple of the buffer size. + + If gzeof() returns true, then the read functions will return no more data, + unless the end-of-file indicator is reset by gzclearerr() and the input file + has grown since the previous end of file was detected. +*/ + +ZEXTERN int ZEXPORT gzdirect OF((gzFile file)); +/* + Returns true (1) if file is being copied directly while reading, or false + (0) if file is a gzip stream being decompressed. + + If the input file is empty, gzdirect() will return true, since the input + does not contain a gzip stream. + + If gzdirect() is used immediately after gzopen() or gzdopen() it will + cause buffers to be allocated to allow reading the file to determine if it + is a gzip file. Therefore if gzbuffer() is used, it should be called before + gzdirect(). + + When writing, gzdirect() returns true (1) if transparent writing was + requested ("wT" for the gzopen() mode), or false (0) otherwise. (Note: + gzdirect() is not needed when writing. Transparent writing must be + explicitly requested, so the application already knows the answer. When + linking statically, using gzdirect() will include all of the zlib code for + gzip file reading and decompression, which may not be desired.) +*/ + +ZEXTERN int ZEXPORT gzclose OF((gzFile file)); +/* + Flushes all pending output if necessary, closes the compressed file and + deallocates the (de)compression state. Note that once file is closed, you + cannot call gzerror with file, since its structures have been deallocated. + gzclose must not be called more than once on the same file, just as free + must not be called more than once on the same allocation. + + gzclose will return Z_STREAM_ERROR if file is not valid, Z_ERRNO on a + file operation error, Z_MEM_ERROR if out of memory, Z_BUF_ERROR if the + last read ended in the middle of a gzip stream, or Z_OK on success. +*/ + +ZEXTERN int ZEXPORT gzclose_r OF((gzFile file)); +ZEXTERN int ZEXPORT gzclose_w OF((gzFile file)); +/* + Same as gzclose(), but gzclose_r() is only for use when reading, and + gzclose_w() is only for use when writing or appending. The advantage to + using these instead of gzclose() is that they avoid linking in zlib + compression or decompression code that is not used when only reading or only + writing respectively. If gzclose() is used, then both compression and + decompression code will be included the application when linking to a static + zlib library. +*/ + +ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); +/* + Returns the error message for the last error which occurred on the given + compressed file. errnum is set to zlib error number. If an error occurred + in the file system and not in the compression library, errnum is set to + Z_ERRNO and the application may consult errno to get the exact error code. + + The application must not modify the returned string. Future calls to + this function may invalidate the previously returned string. If file is + closed, then the string previously returned by gzerror will no longer be + available. + + gzerror() should be used to distinguish errors from end-of-file for those + functions above that do not distinguish those cases in their return values. +*/ + +ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); +/* + Clears the error and end-of-file flags for file. This is analogous to the + clearerr() function in stdio. This is useful for continuing to read a gzip + file that is being written concurrently. +*/ + +#endif /* !Z_SOLO */ + + /* checksum functions */ + +/* + These functions are not related to compression but are exported + anyway because they might be useful in applications using the compression + library. +*/ + +ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); +/* + Update a running Adler-32 checksum with the bytes buf[0..len-1] and + return the updated checksum. If buf is Z_NULL, this function returns the + required initial value for the checksum. + + An Adler-32 checksum is almost as reliable as a CRC-32 but can be computed + much faster. + + Usage example: + + uLong adler = adler32(0L, Z_NULL, 0); + + while (read_buffer(buffer, length) != EOF) { + adler = adler32(adler, buffer, length); + } + if (adler != original_adler) error(); +*/ + +ZEXTERN uLong ZEXPORT adler32_z OF((uLong adler, const Bytef *buf, + z_size_t len)); +/* + Same as adler32(), but with a size_t length. +*/ + +/* +ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2, + z_off_t len2)); + + Combine two Adler-32 checksums into one. For two sequences of bytes, seq1 + and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for + each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of + seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. Note + that the z_off_t type (like off_t) is a signed integer. If len2 is + negative, the result has no meaning or utility. +*/ + +ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); +/* + Update a running CRC-32 with the bytes buf[0..len-1] and return the + updated CRC-32. If buf is Z_NULL, this function returns the required + initial value for the crc. Pre- and post-conditioning (one's complement) is + performed within this function so it shouldn't be done by the application. + + Usage example: + + uLong crc = crc32(0L, Z_NULL, 0); + + while (read_buffer(buffer, length) != EOF) { + crc = crc32(crc, buffer, length); + } + if (crc != original_crc) error(); +*/ + +ZEXTERN uLong ZEXPORT crc32_z OF((uLong adler, const Bytef *buf, + z_size_t len)); +/* + Same as crc32(), but with a size_t length. +*/ + +/* +ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2)); + + Combine two CRC-32 check values into one. For two sequences of bytes, + seq1 and seq2 with lengths len1 and len2, CRC-32 check values were + calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 + check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and + len2. +*/ + + + /* various hacks, don't look :) */ + +/* deflateInit and inflateInit are macros to allow checking the zlib version + * and the compiler's view of z_stream: + */ +ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level, + const char *version, int stream_size)); +ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm, + const char *version, int stream_size)); +ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method, + int windowBits, int memLevel, + int strategy, const char *version, + int stream_size)); +ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, + const char *version, int stream_size)); +ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits, + unsigned char FAR *window, + const char *version, + int stream_size)); +#ifdef Z_PREFIX_SET +# define z_deflateInit(strm, level) \ + deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream)) +# define z_inflateInit(strm) \ + inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream)) +# define z_deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ + deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ + (strategy), ZLIB_VERSION, (int)sizeof(z_stream)) +# define z_inflateInit2(strm, windowBits) \ + inflateInit2_((strm), (windowBits), ZLIB_VERSION, \ + (int)sizeof(z_stream)) +# define z_inflateBackInit(strm, windowBits, window) \ + inflateBackInit_((strm), (windowBits), (window), \ + ZLIB_VERSION, (int)sizeof(z_stream)) +#else +# define deflateInit(strm, level) \ + deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream)) +# define inflateInit(strm) \ + inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream)) +# define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ + deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ + (strategy), ZLIB_VERSION, (int)sizeof(z_stream)) +# define inflateInit2(strm, windowBits) \ + inflateInit2_((strm), (windowBits), ZLIB_VERSION, \ + (int)sizeof(z_stream)) +# define inflateBackInit(strm, windowBits, window) \ + inflateBackInit_((strm), (windowBits), (window), \ + ZLIB_VERSION, (int)sizeof(z_stream)) +#endif + +#ifndef Z_SOLO + +/* gzgetc() macro and its supporting function and exposed data structure. Note + * that the real internal state is much larger than the exposed structure. + * This abbreviated structure exposes just enough for the gzgetc() macro. The + * user should not mess with these exposed elements, since their names or + * behavior could change in the future, perhaps even capriciously. They can + * only be used by the gzgetc() macro. You have been warned. + */ +struct gzFile_s { + unsigned have; + unsigned char *next; + z_off64_t pos; +}; +ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */ +#ifdef Z_PREFIX_SET +# undef z_gzgetc +# define z_gzgetc(g) \ + ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : (gzgetc)(g)) +#else +# define gzgetc(g) \ + ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : (gzgetc)(g)) +#endif + +/* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or + * change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if + * both are true, the application gets the *64 functions, and the regular + * functions are changed to 64 bits) -- in case these are set on systems + * without large file support, _LFS64_LARGEFILE must also be true + */ +#ifdef Z_LARGE64 + ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); + ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int)); + ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile)); + ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); + ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t)); + ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t)); +#endif + +#if !defined(ZLIB_INTERNAL) && defined(Z_WANT64) +# ifdef Z_PREFIX_SET +# define z_gzopen z_gzopen64 +# define z_gzseek z_gzseek64 +# define z_gztell z_gztell64 +# define z_gzoffset z_gzoffset64 +# define z_adler32_combine z_adler32_combine64 +# define z_crc32_combine z_crc32_combine64 +# else +# define gzopen gzopen64 +# define gzseek gzseek64 +# define gztell gztell64 +# define gzoffset gzoffset64 +# define adler32_combine adler32_combine64 +# define crc32_combine crc32_combine64 +# endif +# ifndef Z_LARGE64 + ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); + ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int)); + ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile)); + ZEXTERN z_off_t ZEXPORT gzoffset64 OF((gzFile)); + ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); + ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); +# endif +#else + ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *)); + ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile, z_off_t, int)); + ZEXTERN z_off_t ZEXPORT gztell OF((gzFile)); + ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile)); + ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); + ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); +#endif + +#else /* Z_SOLO */ + + ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); + ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); + +#endif /* !Z_SOLO */ + +/* undocumented functions */ +ZEXTERN const char * ZEXPORT zError OF((int)); +ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp)); +ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table OF((void)); +ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int)); +ZEXTERN int ZEXPORT inflateValidate OF((z_streamp, int)); +ZEXTERN unsigned long ZEXPORT inflateCodesUsed OF ((z_streamp)); +ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp)); +ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp)); +#if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(Z_SOLO) +ZEXTERN gzFile ZEXPORT gzopen_w OF((const wchar_t *path, + const char *mode)); +#endif +#if defined(STDC) || defined(Z_HAVE_STDARG_H) +# ifndef Z_SOLO +ZEXTERN int ZEXPORTVA gzvprintf Z_ARG((gzFile file, + const char *format, + va_list va)); +# endif +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* ZLIB_H */ diff --git a/MediaClient/MediaClient/zlib/lib/linux/libz.so.1.2.11 b/MediaClient/MediaClient/zlib/lib/linux/libz.so.1.2.11 new file mode 100644 index 0000000..0e45941 Binary files /dev/null and b/MediaClient/MediaClient/zlib/lib/linux/libz.so.1.2.11 differ diff --git a/MediaClient/MediaClientForMobile/FileListModel.cpp b/MediaClient/MediaClientForMobile/FileListModel.cpp new file mode 100644 index 0000000..6566be0 --- /dev/null +++ b/MediaClient/MediaClientForMobile/FileListModel.cpp @@ -0,0 +1,173 @@ +/*************************************************************************************** + * + * 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 "FileListModel.h" +#include "utils.h" +#include +#include +#include +#include + + +FileListModel::FileListModel(int fileFormat, QObject *parent) +: QAbstractListModel(parent) +, m_bCheckable(false) +, m_fileFormat(fileFormat) +{ +} + +int FileListModel::rowCount(const QModelIndex & /* parent */) const +{ + return m_fileCount; +} + +QVariant FileListModel::data(const QModelIndex &index, int role) const +{ + if (!index.isValid()) + return QVariant(); + + if (index.row() >= m_fileList.size() || index.row() < 0) + return QVariant(); + + if (role == Qt::DisplayRole) + { + return m_fileList.at(index.row()); + } + else if (role == Qt::DecorationRole && m_fileFormat == FILE_FORMAT_PIC) + { + QString file = m_basePath + "/" + m_fileList.at(index.row()); + QPixmap pixmap(file); + pixmap = pixmap.scaled(60, 40); + + return pixmap; + } + else if (role == Qt::CheckStateRole && m_bCheckable) + { + return m_boolList.at(index.row()) ? Qt::Checked : Qt::Unchecked; + } + else if (role == Qt::SizeHintRole && m_fileFormat == FILE_FORMAT_VIDEO) + { + return QSize(100, 40); + } + + return QVariant(); +} + +Qt::ItemFlags FileListModel::flags(const QModelIndex &index) const +{ + if (!index.isValid()) + return Qt::NoItemFlags; + + if (index.row() >= m_fileList.size() || index.row() < 0) + return Qt::NoItemFlags; + + if (m_bCheckable) + { + return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable; + } + else + { + return Qt::ItemIsEnabled | Qt::ItemIsSelectable; + } +} + +bool FileListModel::setData(const QModelIndex &index, const QVariant &value, int role) +{ + if (role != Qt::CheckStateRole) + return false; + + if (index.row() >= m_fileList.size() || index.row() < 0) + return false; + + m_boolList.replace(index.row(), value.toBool()); + + emit dataChanged(index, index); + + return true; +} + +bool FileListModel::canFetchMore(const QModelIndex & /* index */) const +{ + if (m_fileCount < m_fileList.size()) + return true; + else + return false; +} + +void FileListModel::fetchMore(const QModelIndex & /* index */) +{ + int remainder = m_fileList.size() - m_fileCount; + int itemsToFetch = qMin(100, remainder); + + beginInsertRows(QModelIndex(), m_fileCount, m_fileCount+itemsToFetch-1); + + m_fileCount += itemsToFetch; + + endInsertRows(); +} + +void FileListModel::setNameFilters(const QStringList &filters) +{ + m_nameFilters = filters; +} + +bool FileListModel::removeRows(int pos, int count, const QModelIndex &parent) +{ + if (pos >= m_fileList.size() || pos < 0) + return false; + + beginRemoveRows(parent, pos, pos); + m_fileList.removeAt(pos); + m_boolList.removeAt(pos); + endRemoveRows(); + + return true; +} + +void FileListModel::setDirPath(const QString &path) +{ + QDir dir(path); + + m_basePath = path; + dir.setNameFilters(m_nameFilters); + + beginResetModel(); + + m_fileList = dir.entryList(); + m_fileCount = 0; + + for (int i = 0; i < m_fileList.size(); i++) + { + m_boolList.push_back(false); + } + + endResetModel(); +} + +void FileListModel::setCheckable(bool checkable) +{ + m_bCheckable = checkable; + + if (m_fileCount > 0) + { + emit dataChanged(index(0), index(m_fileCount-1)); + } +} + + diff --git a/MediaClient/MediaClientForMobile/FileListModel.h b/MediaClient/MediaClientForMobile/FileListModel.h new file mode 100644 index 0000000..c26f086 --- /dev/null +++ b/MediaClient/MediaClientForMobile/FileListModel.h @@ -0,0 +1,68 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef FILELISTMODEL_H +#define FILELISTMODEL_H + +#include +#include +#include + + +#define FILE_FORMAT_PIC 0 +#define FILE_FORMAT_VIDEO 1 + + +typedef QList QBoolList; + +class FileListModel : public QAbstractListModel +{ + Q_OBJECT + +public: + FileListModel(int fileFormat, QObject *parent = 0); + + int rowCount(const QModelIndex &parent = QModelIndex()) const; + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + Qt::ItemFlags flags(const QModelIndex &index) const; + bool setData(const QModelIndex &index, const QVariant &value, int role); + void setCheckable(bool checkable); + void setNameFilters(const QStringList &filters); + bool removeRows(int pos, int count, const QModelIndex &parent = QModelIndex()); + +public slots: + void setDirPath(const QString &path); + +protected: + bool canFetchMore(const QModelIndex &parent) const; + void fetchMore(const QModelIndex &parent); + +private: + QStringList m_nameFilters; + QStringList m_fileList; + QBoolList m_boolList; + int m_fileCount; + bool m_bCheckable; + QString m_basePath; + int m_fileFormat; +}; + +#endif // FILELISTMODEL_H + + diff --git a/MediaClient/MediaClientForMobile/MediaClient.pro b/MediaClient/MediaClientForMobile/MediaClient.pro new file mode 100644 index 0000000..54a28f8 --- /dev/null +++ b/MediaClient/MediaClientForMobile/MediaClient.pro @@ -0,0 +1,220 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2019-07-04T09:50:05 +# +#------------------------------------------------- + +QT += core gui widgets multimedia openglwidgets + +TARGET = MediaClient +TEMPLATE = app + +# The following define makes your compiler emit warnings if you use +# any feature of Qt which has been marked as deprecated (the exact warnings +# depend on your compiler). Please consult the documentation of the +# deprecated API in order to know how to port your code away from it. +DEFINES += QT_DEPRECATED_WARNINGS + +DEFINES += __STDC_CONSTANT_MACROS +DEFINES += HTTPS +DEFINES += REPLAY +DEFINES += OVER_HTTP +DEFINES += OVER_WEBSOCKET + +ios { + DEFINES += IOS +} + +android { + DEFINES += EPOLL + DEFINES += BACKCHANNEL +} + +# You can also make your code fail to compile if you use deprecated APIs. +# In order to do so, uncomment the following line. +# You can also select to disable deprecated APIs only up to a certain version of Qt. +#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 + +CONFIG += c++11 +ios:CONFIG += sdk_no_version_check + +INCLUDEPATH += ./formClass +INCLUDEPATH += ./media +INCLUDEPATH += ./ui +INCLUDEPATH += ../MediaClient/bm +INCLUDEPATH += ../MediaClient/http +INCLUDEPATH += ../MediaClient/librtmp +INCLUDEPATH += ../MediaClient/rtmp +INCLUDEPATH += ../MediaClient/rtp +INCLUDEPATH += ../MediaClient/rtsp +INCLUDEPATH += ../MediaClient/srt +INCLUDEPATH += ../MediaClient/ffmpeg/include +INCLUDEPATH += ../MediaClient/libsrt/include +INCLUDEPATH += ../MediaClient/openssl/include + +SOURCES += \ + formClass/About.cpp \ + formClass/FileBrowse.cpp \ + formClass/InstMsgDialog.cpp \ + formClass/MediaClient.cpp \ + formClass/OpenMedia.cpp \ + formClass/SystemSetting.cpp \ + formClass/VideoWidget.cpp \ + media/audio_capture.cpp \ + media/audio_decoder.cpp \ + media/audio_encoder.cpp \ + media/audio_play.cpp \ + media/audio_play_qt.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_player.cpp \ + FileListModel.cpp \ + main.cpp \ + utils.cpp \ + ../MediaClient/bm/base64.cpp \ + ../MediaClient/bm/hqueue.cpp \ + ../MediaClient/bm/linked_list.cpp \ + ../MediaClient/bm/ppstack.cpp \ + ../MediaClient/bm/rfc_md5.cpp \ + ../MediaClient/bm/sha1.cpp \ + ../MediaClient/bm/sha256.cpp \ + ../MediaClient/bm/sys_buf.cpp \ + ../MediaClient/bm/sys_log.cpp \ + ../MediaClient/bm/sys_os.cpp \ + ../MediaClient/bm/util.cpp \ + ../MediaClient/bm/word_analyse.cpp \ + ../MediaClient/http/http_cln.cpp \ + ../MediaClient/http/http_flv_cln.cpp \ + ../MediaClient/http/http_mjpeg_cln.cpp \ + ../MediaClient/http/http_parse.cpp \ + ../MediaClient/http/http_test.cpp \ + ../MediaClient/librtmp/amf.c \ + ../MediaClient/librtmp/hashswf.c \ + ../MediaClient/librtmp/log.c \ + ../MediaClient/librtmp/parseurl.c \ + ../MediaClient/librtmp/rtmp.c \ + ../MediaClient/rtmp/rtmp_cln.cpp \ + ../MediaClient/rtp/aac_rtp_rx.cpp \ + ../MediaClient/rtp/h264_rtp_rx.cpp \ + ../MediaClient/rtp/h264_util.cpp \ + ../MediaClient/rtp/h265_rtp_rx.cpp \ + ../MediaClient/rtp/h265_util.cpp \ + ../MediaClient/rtp/mjpeg_rtp_rx.cpp \ + ../MediaClient/rtp/mjpeg_tables.cpp \ + ../MediaClient/rtp/mpeg4.cpp \ + ../MediaClient/rtp/mpeg4_rtp_rx.cpp \ + ../MediaClient/rtp/pcm_rtp_rx.cpp \ + ../MediaClient/rtp/rtp.cpp \ + ../MediaClient/rtp/rtp_rx.cpp \ + ../MediaClient/rtp/ts_parser.cpp \ + ../MediaClient/rtsp/rtsp_backchannel.cpp \ + ../MediaClient/rtsp/rtsp_cln.cpp \ + ../MediaClient/rtsp/rtsp_parse.cpp \ + ../MediaClient/rtsp/rtsp_rcua.cpp \ + ../MediaClient/rtsp/rtsp_util.cpp \ + ../MediaClient/rtsp/rtsp_ws.cpp \ + ../MediaClient/srt/srt_cln.cpp + +ios { + SOURCES += \ + ios/file_view_controller.mm \ + ios/ios_launcher.mm \ +} + +android { + SOURCES += \ + media/audio_capture_android.cpp \ + media/gles_engine.cpp \ + media/gles_input.cpp \ +} + +HEADERS += \ + formClass/About.h \ + formClass/FileBrowse.h \ + formClass/InstMsgDialog.h \ + formClass/MediaClient.h \ + formClass/OpenMedia.h \ + formClass/SystemSetting.h \ + formClass/VideoWidget.h \ + media/audio_play_qt.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 \ + FileListModel.h \ + +FORMS += \ + ui/About.ui \ + ui/FileBrowse.ui \ + ui/InstMsgDialog.ui \ + ui/MediaClient.ui \ + ui/OpenMedia.ui \ + ui/SystemSetting.ui + +ios { + LIBS += -L$$PWD/lib/ios-armv8a +} + +android { + LIBS += -L$$PWD/lib/$$ANDROID_TARGET_ARCH + ANDROID_EXTRA_LIBS += $$PWD/lib/$$ANDROID_TARGET_ARCH/libcrypto.so + ANDROID_EXTRA_LIBS += $$PWD/lib/$$ANDROID_TARGET_ARCH/libssl.so +} + +LIBS += -lavformat +LIBS += -lswscale +LIBS += -lavcodec +LIBS += -lswresample +LIBS += -lavutil +LIBS += -lx264 +LIBS += -lx265 +LIBS += -lsrt +LIBS += -lcrypto +LIBS += -lssl + +ios { + LIBS += -lbz2 + LIBS += -liconv + LIBS += -framework AudioToolbox + LIBS += -framework VideoToolbox +} + +android { + LIBS += -lopus + LIBS += -lOpenSLES +} + +RESOURCES += MediaClient.qrc + +ios { + QMAKE_INFO_PLIST = ios/Info.plist +} + +android { + DISTFILES += \ + android/AndroidManifest.xml \ + android/build.gradle \ + android/gradle.properties \ + android/gradle/wrapper/gradle-wrapper.jar \ + android/gradle/wrapper/gradle-wrapper.properties \ + android/gradlew \ + android/gradlew.bat \ + android/res/values/libs.xml \ + android/res/xml/filepaths.xml + + ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android +} + diff --git a/MediaClient/MediaClientForMobile/MediaClient.qrc b/MediaClient/MediaClientForMobile/MediaClient.qrc new file mode 100644 index 0000000..0f7cd69 --- /dev/null +++ b/MediaClient/MediaClientForMobile/MediaClient.qrc @@ -0,0 +1,21 @@ + + + Resources/btn_pause.png + Resources/btn_play.png + Resources/btn_stop.png + Resources/mic.png + Resources/mute.png + Resources/snapshot.png + Resources/stop_record.png + Resources/video_record.png + Resources/volume.png + Resources/stopmic.png + Resources/1.png + Resources/4.png + Resources/2.png + Resources/back.png + Resources/delete.png + Resources/6.png + Resources/9.png + + diff --git a/MediaClient/MediaClientForMobile/Resources/1.png b/MediaClient/MediaClientForMobile/Resources/1.png new file mode 100644 index 0000000..ba60b41 Binary files /dev/null and b/MediaClient/MediaClientForMobile/Resources/1.png differ diff --git a/MediaClient/MediaClientForMobile/Resources/2.png b/MediaClient/MediaClientForMobile/Resources/2.png new file mode 100644 index 0000000..feadd6c Binary files /dev/null and b/MediaClient/MediaClientForMobile/Resources/2.png differ diff --git a/MediaClient/MediaClientForMobile/Resources/4.png b/MediaClient/MediaClientForMobile/Resources/4.png new file mode 100644 index 0000000..a427034 Binary files /dev/null and b/MediaClient/MediaClientForMobile/Resources/4.png differ diff --git a/MediaClient/MediaClientForMobile/Resources/6.png b/MediaClient/MediaClientForMobile/Resources/6.png new file mode 100644 index 0000000..7889284 Binary files /dev/null and b/MediaClient/MediaClientForMobile/Resources/6.png differ diff --git a/MediaClient/MediaClientForMobile/Resources/9.png b/MediaClient/MediaClientForMobile/Resources/9.png new file mode 100644 index 0000000..d62194a Binary files /dev/null and b/MediaClient/MediaClientForMobile/Resources/9.png differ diff --git a/MediaClient/MediaClientForMobile/Resources/android_release.keystore b/MediaClient/MediaClientForMobile/Resources/android_release.keystore new file mode 100644 index 0000000..e61beb7 Binary files /dev/null and b/MediaClient/MediaClientForMobile/Resources/android_release.keystore differ diff --git a/MediaClient/MediaClientForMobile/Resources/back.png b/MediaClient/MediaClientForMobile/Resources/back.png new file mode 100644 index 0000000..471c4eb Binary files /dev/null and b/MediaClient/MediaClientForMobile/Resources/back.png differ diff --git a/MediaClient/MediaClientForMobile/Resources/btn_pause.png b/MediaClient/MediaClientForMobile/Resources/btn_pause.png new file mode 100644 index 0000000..1796a02 Binary files /dev/null and b/MediaClient/MediaClientForMobile/Resources/btn_pause.png differ diff --git a/MediaClient/MediaClientForMobile/Resources/btn_play.png b/MediaClient/MediaClientForMobile/Resources/btn_play.png new file mode 100644 index 0000000..79429b9 Binary files /dev/null and b/MediaClient/MediaClientForMobile/Resources/btn_play.png differ diff --git a/MediaClient/MediaClientForMobile/Resources/btn_stop.png b/MediaClient/MediaClientForMobile/Resources/btn_stop.png new file mode 100644 index 0000000..8113491 Binary files /dev/null and b/MediaClient/MediaClientForMobile/Resources/btn_stop.png differ diff --git a/MediaClient/MediaClientForMobile/Resources/delete.png b/MediaClient/MediaClientForMobile/Resources/delete.png new file mode 100644 index 0000000..cde3f61 Binary files /dev/null and b/MediaClient/MediaClientForMobile/Resources/delete.png differ diff --git a/MediaClient/MediaClientForMobile/Resources/main.png b/MediaClient/MediaClientForMobile/Resources/main.png new file mode 100644 index 0000000..feaed74 Binary files /dev/null and b/MediaClient/MediaClientForMobile/Resources/main.png differ diff --git a/MediaClient/MediaClientForMobile/Resources/mic.png b/MediaClient/MediaClientForMobile/Resources/mic.png new file mode 100644 index 0000000..97fc2f5 Binary files /dev/null and b/MediaClient/MediaClientForMobile/Resources/mic.png differ diff --git a/MediaClient/MediaClientForMobile/Resources/mute.png b/MediaClient/MediaClientForMobile/Resources/mute.png new file mode 100644 index 0000000..e7198ae Binary files /dev/null and b/MediaClient/MediaClientForMobile/Resources/mute.png differ diff --git a/MediaClient/MediaClientForMobile/Resources/snapshot.png b/MediaClient/MediaClientForMobile/Resources/snapshot.png new file mode 100644 index 0000000..209701f Binary files /dev/null and b/MediaClient/MediaClientForMobile/Resources/snapshot.png differ diff --git a/MediaClient/MediaClientForMobile/Resources/stop_record.png b/MediaClient/MediaClientForMobile/Resources/stop_record.png new file mode 100644 index 0000000..639105e Binary files /dev/null and b/MediaClient/MediaClientForMobile/Resources/stop_record.png differ diff --git a/MediaClient/MediaClientForMobile/Resources/stopmic.png b/MediaClient/MediaClientForMobile/Resources/stopmic.png new file mode 100644 index 0000000..097059b Binary files /dev/null and b/MediaClient/MediaClientForMobile/Resources/stopmic.png differ diff --git a/MediaClient/MediaClientForMobile/Resources/video_record.png b/MediaClient/MediaClientForMobile/Resources/video_record.png new file mode 100644 index 0000000..fb6396e Binary files /dev/null and b/MediaClient/MediaClientForMobile/Resources/video_record.png differ diff --git a/MediaClient/MediaClientForMobile/Resources/volume.png b/MediaClient/MediaClientForMobile/Resources/volume.png new file mode 100644 index 0000000..8a061a4 Binary files /dev/null and b/MediaClient/MediaClientForMobile/Resources/volume.png differ diff --git a/MediaClient/MediaClientForMobile/android/AndroidManifest.xml b/MediaClient/MediaClientForMobile/android/AndroidManifest.xml new file mode 100644 index 0000000..6fbad45 --- /dev/null +++ b/MediaClient/MediaClientForMobile/android/AndroidManifest.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/MediaClient/MediaClientForMobile/android/build.gradle b/MediaClient/MediaClientForMobile/android/build.gradle new file mode 100644 index 0000000..028e78a --- /dev/null +++ b/MediaClient/MediaClientForMobile/android/build.gradle @@ -0,0 +1,87 @@ +buildscript { + repositories { + google() + jcenter() + mavenCentral() + } + + dependencies { + classpath 'com.android.tools.build:gradle:7.4.1' + } +} + +repositories { + google() + jcenter() + mavenCentral() +} + +apply plugin: 'com.android.application' + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar']) + implementation 'androidx.core:core-ktx:1.7.0' + implementation 'androidx.appcompat:appcompat:1.4.1' + implementation "androidx.security:security-crypto:1.1.0-alpha03" + implementation "androidx.security:security-identity-credential:1.0.0-alpha02" +} + +android { + /******************************************************* + * The following variables: + * - androidBuildToolsVersion, + * - androidCompileSdkVersion + * - qtAndroidDir - holds the path to qt android files + * needed to build any Qt application + * on Android. + * + * are defined in gradle.properties file. This file is + * updated by QtCreator and androiddeployqt tools. + * Changing them manually might break the compilation! + *******************************************************/ + + compileSdkVersion androidCompileSdkVersion + buildToolsVersion androidBuildToolsVersion + ndkVersion androidNdkVersion + + // Extract native libraries from the APK + packagingOptions.jniLibs.useLegacyPackaging true + + sourceSets { + main { + manifest.srcFile 'AndroidManifest.xml' + java.srcDirs = [qtAndroidDir + '/src', 'src', 'java'] + aidl.srcDirs = [qtAndroidDir + '/src', 'src', 'aidl'] + res.srcDirs = [qtAndroidDir + '/res', 'res'] + resources.srcDirs = ['resources'] + renderscript.srcDirs = ['src'] + assets.srcDirs = ['assets'] + jniLibs.srcDirs = ['libs'] + } + } + + tasks.withType(JavaCompile) { + options.incremental = true + } + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + lintOptions { + abortOnError false + } + + // Do not compress Qt binary resources file + aaptOptions { + noCompress 'rcc' + } + + defaultConfig { + resConfig "en" + minSdkVersion 24 + targetSdkVersion qtTargetSdkVersion + ndk.abiFilters = qtTargetAbiList.split(",") + } +} diff --git a/MediaClient/MediaClientForMobile/android/gradle.properties b/MediaClient/MediaClientForMobile/android/gradle.properties new file mode 100644 index 0000000..37a51c2 --- /dev/null +++ b/MediaClient/MediaClientForMobile/android/gradle.properties @@ -0,0 +1,16 @@ +# Project-wide Gradle settings. +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +org.gradle.jvmargs=-Xmx2500m -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 + +# Enable building projects in parallel +org.gradle.parallel=true + +# Gradle caching allows reusing the build artifacts from a previous +# build with the same inputs. However, over time, the cache size will +# grow. Uncomment the following line to enable it. +#org.gradle.caching=true + +android.useAndroidX=true diff --git a/MediaClient/MediaClientForMobile/android/gradle/wrapper/gradle-wrapper.jar b/MediaClient/MediaClientForMobile/android/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..41d9927 Binary files /dev/null and b/MediaClient/MediaClientForMobile/android/gradle/wrapper/gradle-wrapper.jar differ diff --git a/MediaClient/MediaClientForMobile/android/gradle/wrapper/gradle-wrapper.properties b/MediaClient/MediaClientForMobile/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..da1db5f --- /dev/null +++ b/MediaClient/MediaClientForMobile/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/MediaClient/MediaClientForMobile/android/gradlew b/MediaClient/MediaClientForMobile/android/gradlew new file mode 100644 index 0000000..005bcde --- /dev/null +++ b/MediaClient/MediaClientForMobile/android/gradlew @@ -0,0 +1,234 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# 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 +# +# https://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. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +APP_NAME="Gradle" +APP_BASE_NAME=${0##*/} + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/MediaClient/MediaClientForMobile/android/gradlew.bat b/MediaClient/MediaClientForMobile/android/gradlew.bat new file mode 100644 index 0000000..6a68175 --- /dev/null +++ b/MediaClient/MediaClientForMobile/android/gradlew.bat @@ -0,0 +1,89 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS=-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/MediaClient/MediaClientForMobile/android/res/drawable-hdpi/icon.png b/MediaClient/MediaClientForMobile/android/res/drawable-hdpi/icon.png new file mode 100644 index 0000000..fd64427 Binary files /dev/null and b/MediaClient/MediaClientForMobile/android/res/drawable-hdpi/icon.png differ diff --git a/MediaClient/MediaClientForMobile/android/res/drawable-ldpi/icon.png b/MediaClient/MediaClientForMobile/android/res/drawable-ldpi/icon.png new file mode 100644 index 0000000..f1be59e Binary files /dev/null and b/MediaClient/MediaClientForMobile/android/res/drawable-ldpi/icon.png differ diff --git a/MediaClient/MediaClientForMobile/android/res/drawable-mdpi/icon.png b/MediaClient/MediaClientForMobile/android/res/drawable-mdpi/icon.png new file mode 100644 index 0000000..3f8a3a3 Binary files /dev/null and b/MediaClient/MediaClientForMobile/android/res/drawable-mdpi/icon.png differ diff --git a/MediaClient/MediaClientForMobile/android/res/drawable-xhdpi/icon.png b/MediaClient/MediaClientForMobile/android/res/drawable-xhdpi/icon.png new file mode 100644 index 0000000..5205dcc Binary files /dev/null and b/MediaClient/MediaClientForMobile/android/res/drawable-xhdpi/icon.png differ diff --git a/MediaClient/MediaClientForMobile/android/res/drawable-xxhdpi/icon.png b/MediaClient/MediaClientForMobile/android/res/drawable-xxhdpi/icon.png new file mode 100644 index 0000000..1d2e049 Binary files /dev/null and b/MediaClient/MediaClientForMobile/android/res/drawable-xxhdpi/icon.png differ diff --git a/MediaClient/MediaClientForMobile/android/res/drawable-xxxhdpi/icon.png b/MediaClient/MediaClientForMobile/android/res/drawable-xxxhdpi/icon.png new file mode 100644 index 0000000..e9287fd Binary files /dev/null and b/MediaClient/MediaClientForMobile/android/res/drawable-xxxhdpi/icon.png differ diff --git a/MediaClient/MediaClientForMobile/android/res/values/libs.xml b/MediaClient/MediaClientForMobile/android/res/values/libs.xml new file mode 100644 index 0000000..fe63866 --- /dev/null +++ b/MediaClient/MediaClientForMobile/android/res/values/libs.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/MediaClient/MediaClientForMobile/android/res/xml/filepaths.xml b/MediaClient/MediaClientForMobile/android/res/xml/filepaths.xml new file mode 100644 index 0000000..9d0dde6 --- /dev/null +++ b/MediaClient/MediaClientForMobile/android/res/xml/filepaths.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/MediaClient/MediaClientForMobile/android/src/org/happytimesoft/util/HtUtil.java b/MediaClient/MediaClientForMobile/android/src/org/happytimesoft/util/HtUtil.java new file mode 100644 index 0000000..3119ac4 --- /dev/null +++ b/MediaClient/MediaClientForMobile/android/src/org/happytimesoft/util/HtUtil.java @@ -0,0 +1,142 @@ + +package org.happytimesoft.util; + +import java.io.File; +import android.app.Activity; +import android.content.Context; +import android.content.Intent; +import android.content.pm.PackageManager; +import android.net.Uri; +import android.net.wifi.WifiManager; +import android.net.wifi.WifiManager.MulticastLock; +import android.os.PowerManager; +import android.os.PowerManager.WakeLock; +import android.os.Build; +import android.os.StrictMode; +import androidx.core.content.FileProvider; +import androidx.core.app.ActivityCompat; +import androidx.core.content.ContextCompat; +import android.content.ActivityNotFoundException; + + +public class HtUtil +{ + private static MulticastLock m_wifiLock; + private static WakeLock m_wakeLock; + + public HtUtil() + { + } + + public static void enableMulticast(Context context) + { + WifiManager wm = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); + m_wifiLock = wm.createMulticastLock("htutil"); + + if (m_wifiLock != null) + { + m_wifiLock.setReferenceCounted(true); + m_wifiLock.acquire(); + } + } + + public static void disableMulticast() + { + if (m_wifiLock != null) + { + m_wifiLock.release(); + m_wifiLock = null; + } + } + + private static String getMIMEType(String filename) + { + if (filename.endsWith(".jpg") || + filename.endsWith(".jpeg") || + filename.endsWith(".JPG") || + filename.endsWith(".JPEG")) + return "image/jpeg"; + if (filename.endsWith(".mp4") || filename.endsWith(".MP4")) + return "video/mp4"; + if (filename.endsWith(".avi") || filename.endsWith(".AVI")) + return "video/x-msvideo"; + if (filename.endsWith(".txt") || filename.endsWith(".TXT")) + return "text/plain"; + else + return "*/*"; + } + + public static void openFile(Context context, String path, String provider) + { + Uri uri; + Intent intent = new Intent(Intent.ACTION_VIEW); + File file = new File(path); + String type = getMIMEType(path); + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) + { + uri = FileProvider.getUriForFile(context, provider, file); + } + else + { + uri = Uri.fromFile(file); + } + + try { + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); + intent.setDataAndType(uri, type); + intent.addCategory(Intent.CATEGORY_DEFAULT); + + context.startActivity(intent); + } + catch (ActivityNotFoundException e) + { + } + } + + public static void disableLockScreen(Context context) + { + PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE); + m_wakeLock = pm.newWakeLock(pm.SCREEN_BRIGHT_WAKE_LOCK | pm.ON_AFTER_RELEASE, "htutil"); + + if (m_wakeLock != null) + { + m_wakeLock.acquire(); + } + } + + public static void enableLockScreen() + { + if (null != m_wakeLock && m_wakeLock.isHeld()) + { + m_wakeLock.release(); + m_wakeLock = null; + } + } + + public static int requestPermission(Context context, String permission) + { + int r = ContextCompat.checkSelfPermission(context, permission); + if (r != PackageManager.PERMISSION_GRANTED) + { + ActivityCompat.requestPermissions((Activity)context, new String[]{permission}, 10000); + + r = ContextCompat.checkSelfPermission(context, permission); + if (r != PackageManager.PERMISSION_GRANTED) + { + return 0; + } + else + { + return 1; + } + } + else + { + return 1; + } + } +} + + diff --git a/MediaClient/MediaClientForMobile/config.h b/MediaClient/MediaClientForMobile/config.h new file mode 100644 index 0000000..5a6d488 --- /dev/null +++ b/MediaClient/MediaClientForMobile/config.h @@ -0,0 +1,63 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef CONFIG_H +#define CONFIG_H + +#include "sys_inc.h" +#include + +#define VERSION_STRING "V3.2" + +#define LANG_SYS 0 // system language +#define LANG_ENG 1 // english +#define LANG_ZH 2 // chinese + +#define FILE_PROVIDER "org.happytimesoft.mediaclient.fileprovider" + +typedef struct +{ + BOOL enableLog; // enable log + BOOL rtpMulticast; // whether enable rtp multicast via rtsp + BOOL rtpOverUdp; // prefer to use RTP OVER UDP + BOOL rtspOverHttp; // rtsp over http + BOOL rtspOverWs; // rtsp over websocket + + int videoRenderMode; // 0 - Keep the original aspect ratio, 1 - Filling the whole window + int logLevel; // log level, reference sys_log.h + int rtspOverHttpPort; // rtsp over http port + int rtspOverWsPort; // rtsp over websocket port + int sysLang; // system language + int recordSize; // max video recording size, kb + int recordTime; // max video recording time, second + int hwDecoding; // hardware-acceleration decoding + int layoutMode; // layout mode +} SysConfig; + +typedef struct +{ + QString url; // url + QString user; // login user + QString pass; // login pass +} CHANNEL; + +#endif + + + diff --git a/MediaClient/MediaClientForMobile/formClass/About.cpp b/MediaClient/MediaClientForMobile/formClass/About.cpp new file mode 100644 index 0000000..c5776bc --- /dev/null +++ b/MediaClient/MediaClientForMobile/formClass/About.cpp @@ -0,0 +1,43 @@ +/*************************************************************************************** + * + * 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 "About.h" +#include "config.h" + + +About::About(QWidget *parent) +: QDialog(parent) +{ + ui.setupUi(this); + + ui.labVersion->setText(QString("Happytime Media Client %1").arg(VERSION_STRING)); + + connect(ui.btnOK, SIGNAL(clicked()), this, SLOT(close())); + + showMaximized(); +} + + +About::~About() +{ +} + + + + diff --git a/MediaClient/MediaClientForMobile/formClass/About.h b/MediaClient/MediaClientForMobile/formClass/About.h new file mode 100644 index 0000000..525d5dc --- /dev/null +++ b/MediaClient/MediaClientForMobile/formClass/About.h @@ -0,0 +1,41 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef _ABOUT_H_ +#define _ABOUT_H_ + + +#include +#include "ui_About.h" + +class About : public QDialog +{ + Q_OBJECT + +public: + About(QWidget *parent = 0); + ~About(); + +private: + Ui::About ui; +}; + +#endif + + diff --git a/MediaClient/MediaClientForMobile/formClass/FileBrowse.cpp b/MediaClient/MediaClientForMobile/formClass/FileBrowse.cpp new file mode 100644 index 0000000..3363bad --- /dev/null +++ b/MediaClient/MediaClientForMobile/formClass/FileBrowse.cpp @@ -0,0 +1,186 @@ +/*************************************************************************************** + * + * 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 "FileBrowse.h" +#include "ui_FileBrowse.h" +#include "utils.h" +#include "config.h" +#include +#include +#include +#include +#include +#include +#include +#include + +#if defined(ANDROID) +#include +#elif defined(IOS) +#include +#endif + +FileBrowse::FileBrowse(int fileFormat, QWidget *parent) +: QDialog(parent) +, ui(new Ui::FileBrowse) +, m_bEditing(false) +, m_fileFormat(fileFormat) +{ + ui->setupUi(this); + + initDialog(); + connSignalSlot(); +} + +FileBrowse::~FileBrowse() +{ + delete ui; +} + +void FileBrowse::initDialog() +{ + QStringList filters; + + if (m_fileFormat == FILE_FORMAT_PIC) + { + filters << "*.jpg"; + m_basePath = getSnapshotPath(); + ui->labTips->setText(tr("Album")); + } + else + { + filters << "*.mp4"; + filters << "*.avi"; + m_basePath = getRecordPath(); + ui->labTips->setText(tr("Video")); + } + + ui->labPath->setText(tr("Path") + QString(" : ") + m_basePath); + + m_pModel = new FileListModel(m_fileFormat, this); + m_pModel->setNameFilters(filters); + m_pModel->setDirPath(m_basePath); + + ui->chkAll->setVisible(false); + ui->fileList->setModel(m_pModel); + + showMaximized(); +} + +void FileBrowse::connSignalSlot() +{ + QObject::connect(ui->btnBack, SIGNAL(clicked()), this, SLOT(slotBack())); + QObject::connect(ui->btnEdit, SIGNAL(clicked()), this, SLOT(slotEdit())); + QObject::connect(ui->chkAll, SIGNAL(clicked(bool)), this, SLOT(slotCheckAll(bool))); + QObject::connect(ui->fileList, SIGNAL(clicked(QModelIndex)), this, SLOT(slotItemClicked(QModelIndex))); +} + +void FileBrowse::slotBack() +{ + close(); +} + +void FileBrowse::slotEdit() +{ + if (!m_bEditing) + { + m_bEditing = true; + ui->chkAll->setVisible(true); + m_pModel->setCheckable(true); + } + else + { + deleteSelectedFiles(); + + m_bEditing = false; + ui->chkAll->setVisible(false); + m_pModel->setCheckable(false); + } +} + +void FileBrowse::slotCheckAll(bool flag) +{ + int row = m_pModel->rowCount(); + QModelIndex index; + + for (int i = 0; i < row; i++) + { + index = m_pModel->index(i); + m_pModel->setData(index, flag, Qt::CheckStateRole); + } +} + +void FileBrowse::slotItemClicked(QModelIndex index) +{ + if (m_bEditing) + { + int flag = m_pModel->data(index, Qt::CheckStateRole).toInt(); + if (flag == Qt::Checked) + { + m_pModel->setData(index, false, Qt::CheckStateRole); + } + else + { + m_pModel->setData(index, true, Qt::CheckStateRole); + } + } + else + { + QString name = m_pModel->data(index, Qt::DisplayRole).toString(); + QString path = m_basePath + "/" + name; + +#if defined(ANDROID) + QJniObject str = QJniObject::fromString(path); + QJniObject provider = QJniObject::fromString(FILE_PROVIDER); + QJniObject::callStaticMethod("org/happytimesoft/util/HtUtil", + "openFile", + "(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;)V", + QNativeInterface::QAndroidApplication::context(), + str.object(), + provider.object()); +#elif defined(IOS) + iosLaunchFile(path); +#endif + } +} + +void FileBrowse::deleteSelectedFiles() +{ + int flag; + int row = m_pModel->rowCount(); + QModelIndex index; + + for (int i = row - 1; i >= 0; i--) + { + index = m_pModel->index(i); + flag = m_pModel->data(index, Qt::CheckStateRole).toInt(); + if (flag == Qt::Checked) + { + QString name = m_pModel->data(index, Qt::DisplayRole).toString(); + QString path = m_basePath + "/" + name; + + QFile::remove(path); + + m_pModel->removeRows(i, 1, index.parent()); + } + } +} + + + diff --git a/MediaClient/MediaClientForMobile/formClass/FileBrowse.h b/MediaClient/MediaClientForMobile/formClass/FileBrowse.h new file mode 100644 index 0000000..4ee0258 --- /dev/null +++ b/MediaClient/MediaClientForMobile/formClass/FileBrowse.h @@ -0,0 +1,60 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef FILEBROWSE_H +#define FILEBROWSE_H + +#include +#include "FileListModel.h" + +namespace Ui { +class FileBrowse; +} + +class FileBrowse : public QDialog +{ + Q_OBJECT + +public: + explicit FileBrowse(int fileFormat, QWidget *parent = 0); + ~FileBrowse(); + +private slots: + void slotBack(); + void slotEdit(); + void slotCheckAll(bool flag); + void slotItemClicked(QModelIndex); + +private: + void initDialog(); + void connSignalSlot(); + void deleteSelectedFiles(); + +private: + Ui::FileBrowse *ui; + + QString m_basePath; + bool m_bEditing; + FileListModel * m_pModel; + int m_fileFormat; +}; + +#endif // FILEBROWSE_H + + diff --git a/MediaClient/MediaClientForMobile/formClass/InstMsgDialog.cpp b/MediaClient/MediaClientForMobile/formClass/InstMsgDialog.cpp new file mode 100644 index 0000000..d8574a3 --- /dev/null +++ b/MediaClient/MediaClientForMobile/formClass/InstMsgDialog.cpp @@ -0,0 +1,50 @@ +/*************************************************************************************** + * + * 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 "InstMsgDialog.h" +#include "ui_InstMsgDialog.h" +#include +#include +#include +#include "utils.h" + +InstMsgDialog::InstMsgDialog(QString msg, int timelen, QWidget *parent) +: QDialog(parent) +, ui(new Ui::InstMsgDialog) +{ + ui->setupUi(this); + + QRect rect = this->rect(); + + rect.setWidth(QGuiApplication::primaryScreen()->geometry().width()); + rect.setHeight(40); + setGeometry(rect); + + ui->labMsg->setText(msg); + + QTimer::singleShot(timelen, this, SLOT(close())); +} + +InstMsgDialog::~InstMsgDialog() +{ + delete ui; +} + + + diff --git a/MediaClient/MediaClientForMobile/formClass/InstMsgDialog.h b/MediaClient/MediaClientForMobile/formClass/InstMsgDialog.h new file mode 100644 index 0000000..11c5fc5 --- /dev/null +++ b/MediaClient/MediaClientForMobile/formClass/InstMsgDialog.h @@ -0,0 +1,43 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef INSTMSGDIALOG_H +#define INSTMSGDIALOG_H + +#include + +namespace Ui { +class InstMsgDialog; +} + +class InstMsgDialog : public QDialog +{ + Q_OBJECT + +public: + explicit InstMsgDialog(QString msg, int timelen, QWidget *parent = 0); + ~InstMsgDialog(); + +private: + Ui::InstMsgDialog *ui; +}; + +#endif // INSTMSGDIALOG_H + + diff --git a/MediaClient/MediaClientForMobile/formClass/MediaClient.cpp b/MediaClient/MediaClientForMobile/formClass/MediaClient.cpp new file mode 100644 index 0000000..b78af1b --- /dev/null +++ b/MediaClient/MediaClientForMobile/formClass/MediaClient.cpp @@ -0,0 +1,863 @@ +/*************************************************************************************** + * + * 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 "MediaClient.h" +#include "InstMsgDialog.h" +#include "OpenMedia.h" +#include "config.h" +#include "FileBrowse.h" +#include "About.h" +#include "utils.h" +#include "SystemSetting.h" +#include "rtsp_cln.h" +#include "rtmp_cln.h" +#include "http_flv_cln.h" +#include "http_mjpeg_cln.h" +#include "srt_cln.h" +#include +#include +#include +#include +#include + +#if defined(ANDROID) +#include +#endif + +MediaClient::MediaClient(QWidget *parent, Qt::WindowFlags flags) +: QDialog(parent, flags) +, m_curWidget(NULL) +, m_recvBytes(0) +{ + ui.setupUi(this); + + initDialog(); + + connSignalSlot(); +} + +MediaClient::~MediaClient() +{ + QList channels; + + saveChannel(channels, ui.videoWidget1); + saveChannel(channels, ui.videoWidget2); + saveChannel(channels, ui.videoWidget3); + saveChannel(channels, ui.videoWidget4); + saveChannel(channels, ui.videoWidget5); + saveChannel(channels, ui.videoWidget6); + saveChannel(channels, ui.videoWidget7); + saveChannel(channels, ui.videoWidget8); + saveChannel(channels, ui.videoWidget9); + + saveChannels(channels); + + saveLayoutMode(m_layoutMode); + + ui.videoWidget1->stop(); + ui.videoWidget2->stop(); + ui.videoWidget3->stop(); + ui.videoWidget4->stop(); + ui.videoWidget5->stop(); + ui.videoWidget6->stop(); + ui.videoWidget7->stop(); + ui.videoWidget8->stop(); + ui.videoWidget9->stop(); + +#if defined(ANDROID) + QJniObject::callStaticMethod("org/happytimesoft/util/HtUtil", "enableLockScreen"); +#endif + + log_close(); + + QDesktopServices::openUrl(QUrl("https://www.happytimesoft.com/", QUrl::TolerantMode)); +} + +void MediaClient::saveChannel(QList &channels, VideoWidget * widget) +{ + CHANNEL channel; + + if (widget->isPlaying()) + { + channel.url = widget->getUrl(); + channel.user = widget->getUser(); + channel.pass = widget->getPass(); + } + else + { + channel.url = ""; + channel.user = ""; + channel.pass = ""; + } + + channels.append(channel); +} + +void MediaClient::closeEvent(QCloseEvent * event) +{ + if (QMessageBox::Yes == QMessageBox::question(this, tr("Quit"), tr("Are you sure want to quit?"))) + { + event->accept(); + } + else + { + event->ignore(); + } +} + +void MediaClient::initLog() +{ + char file[512] = {'\0'}; + QString path = QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation).last(); + + sprintf(file, "%s/mediaclient.log", path.toStdString().c_str()); + + log_init(file); +} + +void MediaClient::initDialog() +{ + setWindowTitle(QString("Happytime media client %1").arg(VERSION_STRING)); + +#if defined(ANDROID) + QJniObject str = QJniObject::fromString("android.permission.WRITE_EXTERNAL_STORAGE"); + QJniObject::callStaticMethod("org/happytimesoft/util/HtUtil", + "requestPermission", + "(Landroid/content/Context;Ljava/lang/String;)I", + QNativeInterface::QAndroidApplication::context(), + str.object()); +#endif + + loadSystemConfig(); + + if (m_syscfg.enableLog) + { + initLog(); + + log_set_level(m_syscfg.logLevel); + } + + ui.labTipInfo->setText(""); + ui.labStatistics->setText(""); + + ui.cmbLayout->addItem(QIcon(":/res/Resources/1.png"), "1", 1); + ui.cmbLayout->addItem(QIcon(":/res/Resources/2.png"), "2", 2); + ui.cmbLayout->addItem(QIcon(":/res/Resources/4.png"), "4", 4); + ui.cmbLayout->addItem(QIcon(":/res/Resources/6.png"), "6", 6); + ui.cmbLayout->addItem(QIcon(":/res/Resources/9.png"), "9", 9); + + QScreen * pScreen = QApplication::primaryScreen(); + + setupLayout(pScreen->orientation()); + + connect(pScreen, SIGNAL(orientationChanged(Qt::ScreenOrientation)), + this, SLOT(slotOrientationChanged(Qt::ScreenOrientation))); + + if (1 == m_syscfg.layoutMode) + { + slotLayoutOne(); + ui.cmbLayout->setCurrentIndex(0); + } + else if (2 == m_syscfg.layoutMode) + { + slotLayoutTwo(); + ui.cmbLayout->setCurrentIndex(1); + } + else if (6 == m_syscfg.layoutMode) + { + slotLayoutSix(); + ui.cmbLayout->setCurrentIndex(3); + } + else if (9 == m_syscfg.layoutMode) + { + slotLayoutNine(); + ui.cmbLayout->setCurrentIndex(4); + } + else + { + slotLayoutFour(); + ui.cmbLayout->setCurrentIndex(2); + } + + m_curWidget = ui.videoWidget1; + m_curWidget->parentWidget()->setStyleSheet("background-color: blue;"); + + // when video playing, prevent auto lock screen + +#if defined(ANDROID) + QJniObject::callStaticMethod("org/happytimesoft/util/HtUtil", + "disableLockScreen", + "(Landroid/content/Context;)V", + QNativeInterface::QAndroidApplication::context()); +#endif + + loadChannels(); + +#ifndef IOS + ui.btnQuit->hide(); +#endif +} + +void MediaClient::connSignalSlot() +{ + connect(ui.cmbLayout, SIGNAL(currentIndexChanged(int)), this, SLOT(slotLayoutChanged(int))); + connect(ui.btnPlay, SIGNAL(clicked()), this, SLOT(slotPlay())); + connect(ui.btnPause, SIGNAL(clicked()), this, SLOT(slotPause())); + connect(ui.btnStop, SIGNAL(clicked()), this, SLOT(slotStop())); + connect(ui.btnSnapshot, SIGNAL(clicked()), this, SLOT(slotSnapshot())); + connect(ui.btnRecord, SIGNAL(clicked()), this, SLOT(slotRecord())); + connect(ui.btnVolume, SIGNAL(clicked()), this, SLOT(slotVolume())); + connect(ui.btnSetting, SIGNAL(clicked()), this, SLOT(slotSystemSetting())); + connect(ui.btnOpenSnapshot, SIGNAL(clicked()), this, SLOT(slotOpenSnapshot())); + connect(ui.btnOpenRecord, SIGNAL(clicked()), this, SLOT(slotOpenRecording())); + connect(ui.btnAbout, SIGNAL(clicked()), this, SLOT(slotAbout())); + connect(ui.btnQuit, SIGNAL(clicked()), this, SLOT(close())); + + connVideoWidget(ui.videoWidget1); + connVideoWidget(ui.videoWidget2); + connVideoWidget(ui.videoWidget3); + connVideoWidget(ui.videoWidget4); + connVideoWidget(ui.videoWidget5); + connVideoWidget(ui.videoWidget6); + connVideoWidget(ui.videoWidget7); + connVideoWidget(ui.videoWidget8); + connVideoWidget(ui.videoWidget9); +} + +void MediaClient::connVideoWidget(VideoWidget * widget) +{ + connect(widget, SIGNAL(snapshotResult(bool)), this, SLOT(slotSnapshotResult(bool))); + connect(widget, SIGNAL(recordResult(bool)), this, SLOT(slotRecordResult(bool))); + connect(widget, SIGNAL(updateStatistics(int)), this, SLOT(slotUpdateStatistics(int))); + connect(widget, SIGNAL(widgetSelecting(QWidget*)), this, SLOT(slotWidgetSelecting(QWidget*))); + connect(widget, SIGNAL(callState(QWidget*,int)), this, SLOT(slotCallState(QWidget*,int))); +} + +void MediaClient::loadSystemConfig() +{ + m_syscfg.enableLog = getEnableLogFlag(); + m_syscfg.videoRenderMode = getVideoRenderMode(); + m_syscfg.rtpMulticast = getRtpMulticast(); + m_syscfg.rtpOverUdp = getRtpOverUdp(); + m_syscfg.rtspOverHttp = getRtspOverHttp(); + m_syscfg.rtspOverHttpPort = getRtspOverHttpPort(); + m_syscfg.rtspOverWs = getRtspOverWs(); + m_syscfg.rtspOverWsPort = getRtspOverWsPort(); + m_syscfg.logLevel = getLogLevel(); + m_syscfg.hwDecoding = getHWDecoding(); + m_syscfg.layoutMode = getLayoutMode(); + m_syscfg.recordTime = getRecordTime(); + m_syscfg.recordSize = getRecordSize(); +} + +void MediaClient::loadChannels() +{ + QList channels; + + getChannels(channels); + + if (channels.size() > 0 && !channels[0].url.isEmpty()) + { + ui.videoWidget1->play(channels[0].url, channels[0].user, channels[0].pass); + } + + if (channels.size() > 1 && !channels[1].url.isEmpty()) + { + ui.videoWidget2->play(channels[1].url, channels[1].user, channels[1].pass); + } + + if (channels.size() > 2 && !channels[2].url.isEmpty()) + { + ui.videoWidget3->play(channels[2].url, channels[2].user, channels[2].pass); + } + + if (channels.size() > 3 && !channels[3].url.isEmpty()) + { + ui.videoWidget4->play(channels[3].url, channels[3].user, channels[3].pass); + } + + if (channels.size() > 4 && !channels[4].url.isEmpty()) + { + ui.videoWidget5->play(channels[4].url, channels[4].user, channels[4].pass); + } + + if (channels.size() > 5 && !channels[5].url.isEmpty()) + { + ui.videoWidget6->play(channels[5].url, channels[5].user, channels[5].pass); + } + + if (channels.size() > 6 && !channels[6].url.isEmpty()) + { + ui.videoWidget7->play(channels[6].url, channels[6].user, channels[6].pass); + } + + if (channels.size() > 7 && !channels[7].url.isEmpty()) + { + ui.videoWidget8->play(channels[7].url, channels[7].user, channels[7].pass); + } + + if (channels.size() > 8 && !channels[8].url.isEmpty()) + { + ui.videoWidget9->play(channels[8].url, channels[8].user, channels[8].pass); + } +} + +void MediaClient::slotLayoutOne() +{ + ui.widget1->show(); + ui.widget2->hide(); + ui.widget3->hide(); + ui.widget4->hide(); + ui.widget5->hide(); + ui.widget6->hide(); + ui.widget7->hide(); + ui.widget8->hide(); + ui.widget9->hide(); + + m_layoutMode = 1; +} + +void MediaClient::slotLayoutTwo() +{ + QScreen * pScreen = QApplication::primaryScreen(); + Qt::ScreenOrientation orientation = pScreen->orientation(); + + if (orientation == Qt::LandscapeOrientation || + orientation == Qt::InvertedLandscapeOrientation) // width > height + { + ui.widget1->show(); + ui.widget2->show(); + ui.widget3->hide(); + ui.widget4->hide(); + ui.widget5->hide(); + ui.widget6->hide(); + ui.widget7->hide(); + ui.widget8->hide(); + ui.widget9->hide(); + } + else + { + ui.widget1->show(); + ui.widget2->hide(); + ui.widget3->hide(); + ui.widget4->show(); + ui.widget5->hide(); + ui.widget6->hide(); + ui.widget7->hide(); + ui.widget8->hide(); + ui.widget9->hide(); + } + + m_layoutMode = 2; +} + +void MediaClient::slotLayoutFour() +{ + ui.widget1->show(); + ui.widget2->show(); + ui.widget3->hide(); + ui.widget4->show(); + ui.widget5->show(); + ui.widget6->hide(); + ui.widget7->hide(); + ui.widget8->hide(); + ui.widget9->hide(); + + m_layoutMode = 4; +} + +void MediaClient::slotLayoutSix() +{ + QScreen * pScreen = QApplication::primaryScreen(); + Qt::ScreenOrientation orientation = pScreen->orientation(); + + if (orientation == Qt::LandscapeOrientation || + orientation == Qt::InvertedLandscapeOrientation) // width > height + { + ui.widget1->show(); + ui.widget2->show(); + ui.widget3->show(); + ui.widget4->show(); + ui.widget5->show(); + ui.widget6->show(); + ui.widget7->hide(); + ui.widget8->hide(); + ui.widget9->hide(); + } + else + { + ui.widget1->show(); + ui.widget2->show(); + ui.widget3->hide(); + ui.widget4->show(); + ui.widget5->show(); + ui.widget6->hide(); + ui.widget7->show(); + ui.widget8->show(); + ui.widget9->hide(); + } + + m_layoutMode = 6; +} + +void MediaClient::slotLayoutNine() +{ + ui.widget1->show(); + ui.widget2->show(); + ui.widget3->show(); + ui.widget4->show(); + ui.widget5->show(); + ui.widget6->show(); + ui.widget7->show(); + ui.widget8->show(); + ui.widget9->show(); + + m_layoutMode = 9; +} + +void MediaClient::slotLayoutChanged(int index) +{ + if (0 == index) + { + slotLayoutOne(); + } + else if (1 == index) + { + slotLayoutTwo(); + } + else if (2 == index) + { + slotLayoutFour(); + } + else if (3 == index) + { + slotLayoutSix(); + } + else if (4 == index) + { + slotLayoutNine(); + } +} + +void MediaClient::slotWidgetSelecting(QWidget * pWidget) +{ + if (m_curWidget != pWidget) + { + m_curWidget->parentWidget()->setStyleSheet("background-color: white;"); + + m_curWidget = (VideoWidget *) pWidget; + m_curWidget->parentWidget()->setStyleSheet("background-color: blue;"); + + if (m_curWidget->isRecording()) + { + ui.labTipInfo->setText(tr("Recording ...")); + + QIcon icon; + icon.addFile(QString(":/res/Resources/stop_record.png")); + ui.btnRecord->setIcon(icon); + } + else + { + ui.labTipInfo->setText(""); + + QIcon icon; + icon.addFile(QString(":/res/Resources/video_record.png")); + ui.btnRecord->setIcon(icon); + } + + if (m_curWidget->isMute()) + { + ui.btnVolume->setIcon(QIcon(QString::fromUtf8(":/res/Resources/mute.png"))); + } + else + { + ui.btnVolume->setIcon(QIcon(QString::fromUtf8(":/res/Resources/volume.png"))); + } + } +} + +void MediaClient::slotPlay() +{ + QString url = m_curWidget->getUrl(); + QString user = m_curWidget->getUser(); + QString pass = m_curWidget->getPass(); + + if (url.isEmpty()) + { + url = m_url; + user = m_user; + pass = m_pass; + } + + OpenMedia dlg(url, user, pass, this); + + dlg.resize(width(), dlg.height()); + + if (QDialog::Accepted == dlg.exec()) + { + m_url = dlg.getUrl(); + m_user = dlg.getUser(); + m_pass = dlg.getPass(); + + m_curWidget->play(m_url, m_user, m_pass); + } +} + +void MediaClient::slotPause() +{ + m_curWidget->pause(); +} + +void MediaClient::slotStop() +{ + m_curWidget->stop(); + + ui.labTipInfo->setText(tr("")); + ui.btnVolume->setIcon(QIcon(QString::fromUtf8(":/res/Resources/volume.png"))); + ui.btnRecord->setIcon(QIcon(QString::fromUtf8(":/res/Resources/video_record.png"))); +} + +void MediaClient::slotCallState(QWidget* pWidget, int event) +{ + if (m_curWidget != pWidget) + { + return; + } + + if (event == RTSP_EVE_CONNECTING || + event == RTMP_EVE_CONNECTING || + event == HTTP_FLV_EVE_CONNECTING || + event == MJPEG_EVE_CONNECTING || + event == SRT_EVE_CONNECTING) + { + ui.labTipInfo->setText(tr("Connecting...")); + } + else if (event == RTSP_EVE_CONNFAIL || + event == RTMP_EVE_CONNFAIL || + event == HTTP_FLV_EVE_CONNFAIL || + event == MJPEG_EVE_CONNFAIL || + event == SRT_EVE_CONNFAIL) + { + ui.labTipInfo->setText(tr("Connect failed")); + } + else if (event == RTSP_EVE_CONNSUCC || + event == MJPEG_EVE_CONNSUCC || + event == RTMP_EVE_VIDEOREADY || + event == RTMP_EVE_AUDIOREADY || + event == HTTP_FLV_EVE_VIDEOREADY || + event == HTTP_FLV_EVE_AUDIOREADY || + event == SRT_EVE_VIDEOREADY || + event == SRT_EVE_AUDIOREADY) + { + ui.labTipInfo->setText(tr("")); + } + else if (event == RTSP_EVE_NOSIGNAL || + event == RTMP_EVE_NOSIGNAL || + event == HTTP_FLV_EVE_NOSIGNAL || + event == MJPEG_EVE_NOSIGNAL || + event == SRT_EVE_NOSIGNAL) + { + ui.labTipInfo->setText(tr("NO Signal")); + } + else if (event == RTSP_EVE_NODATA || + event == RTMP_EVE_NODATA || + event == HTTP_FLV_EVE_NODATA || + event == MJPEG_EVE_NODATA || + event == SRT_EVE_NODATA) + { + ui.labTipInfo->setText(tr("No Data")); + } + else if (event == RTSP_EVE_RESUME || + event == RTMP_EVE_RESUME || + event == HTTP_FLV_EVE_RESUME || + event == MJPEG_EVE_RESUME || + event == SRT_EVE_RESUME) + { + ui.labTipInfo->setText(tr("")); + } + else if (event == RTSP_EVE_AUTHFAILED || + event == RTMP_EVE_AUTHFAILED|| + event == HTTP_FLV_EVE_AUTHFAILED || + event == MJPEG_EVE_AUTHFAILED || + event == SRT_EVE_AUTHFAILED) + { + ui.labTipInfo->setText(tr("Authenticate failed")); + } +} + +void MediaClient::slotSnapshot() +{ + m_curWidget->snapshot(); +} + +void MediaClient::slotRecord() +{ + m_curWidget->record(); + + if (m_curWidget->isRecording()) + { + ui.labTipInfo->setText(tr(" Recording ...")); + + ui.btnRecord->setIcon(QIcon(QString::fromUtf8(":/res/Resources/stop_record.png"))); + } + else + { + ui.labTipInfo->setText(""); + + ui.btnRecord->setIcon(QIcon(QString::fromUtf8(":/res/Resources/video_record.png"))); + } +} + +void MediaClient::slotSnapshotResult(bool ret) +{ + QString msg; + + if (ret) + { + msg = tr("Snapshot success"); + } + else + { + msg = tr("Snapshot failed"); + } + + InstMsgDialog dlg(msg, 2000); + + dlg.exec(); +} + +void MediaClient::slotRecordResult(bool ret) +{ + ui.btnRecord->setIcon(QIcon(QString::fromUtf8(":/res/Resources/video_record.png"))); + + QString msg; + + if (ret) + { + msg = tr("Video recording success"); + } + else + { + msg = tr("Video recording failed"); + } + + InstMsgDialog dlg(msg, 2000); + + dlg.exec(); +} + +void MediaClient::slotVolume() +{ + if (!m_curWidget->isPlaying()) + { + return; + } + + if (m_curWidget->isMute()) + { + ui.btnVolume->setIcon(QIcon(QString::fromUtf8(":/res/Resources/volume.png"))); + + m_curWidget->setMute(FALSE); + } + else + { + ui.btnVolume->setIcon(QIcon(QString::fromUtf8(":/res/Resources/mute.png"))); + + m_curWidget->setMute(TRUE); + } +} + +void MediaClient::slotUpdateStatistics(int bytes) +{ + int kb = 0, mb = 0; + char buff[100]; + + m_recvBytes += bytes; + + if (m_recvBytes >= 1000) + { + kb = m_recvBytes / 1000; + } + + if (kb >= 1000) + { + mb = kb / 1000; + kb = kb % 1000; + kb = kb / 10; + + sprintf(buff, " %d.%02d MB", mb, kb); + } + else + { + sprintf(buff, " %d KB", kb); + } + + ui.labStatistics->setText(tr("RX:") + buff); +} + +void MediaClient::slotOrientationChanged(Qt::ScreenOrientation orientation) +{ + setupLayout(orientation); +} + +void MediaClient::setupLayout(Qt::ScreenOrientation orientation) +{ + log_print(HT_LOG_DBG, "setupLayout, orientation = %d\r\n", orientation); + + if (orientation == Qt::LandscapeOrientation || + orientation == Qt::InvertedLandscapeOrientation) // width > height + { + ui.infoWidget->layout()->removeWidget(ui.cmbLayout); + ui.infoWidget->layout()->removeWidget(ui.labTipInfo); + ui.infoWidget->layout()->removeWidget(ui.labStatistics); + ui.infoWidget->hide(); + + ui.toolWidget->layout()->removeItem(ui.horizontalSpacer1); + ui.toolWidget->layout()->removeWidget(ui.btnPlay); + ui.toolWidget->layout()->removeWidget(ui.btnPause); + ui.toolWidget->layout()->removeWidget(ui.btnStop); + ui.toolWidget->layout()->removeItem(ui.horizontalSpacer2); + ui.toolWidget->layout()->removeWidget(ui.btnVolume); + ui.toolWidget->layout()->removeWidget(ui.btnSnapshot); + ui.toolWidget->layout()->removeWidget(ui.btnRecord); + ui.toolWidget->layout()->removeItem(ui.horizontalSpacer3); + + ui.toolWidget->layout()->addWidget(ui.cmbLayout); + ui.toolWidget->layout()->addItem(ui.horizontalSpacer1); + ui.toolWidget->layout()->addWidget(ui.btnPlay); + ui.toolWidget->layout()->addWidget(ui.btnPause); + ui.toolWidget->layout()->addWidget(ui.btnStop); + ui.toolWidget->layout()->addItem(ui.horizontalSpacer2); + ui.toolWidget->layout()->addWidget(ui.btnVolume); + ui.toolWidget->layout()->addWidget(ui.btnSnapshot); + ui.toolWidget->layout()->addWidget(ui.btnRecord); + ui.toolWidget->layout()->addItem(ui.horizontalSpacer3); + ui.toolWidget->layout()->addWidget(ui.labStatistics); + } + else // height > width + { + ui.infoWidget->layout()->removeWidget(ui.cmbLayout); + ui.infoWidget->layout()->removeWidget(ui.labTipInfo); + ui.infoWidget->layout()->removeWidget(ui.labStatistics); + + ui.toolWidget->layout()->removeWidget(ui.labTipInfo); + ui.toolWidget->layout()->removeWidget(ui.labStatistics); + ui.toolWidget->layout()->removeWidget(ui.btnPlay); + ui.toolWidget->layout()->removeWidget(ui.btnPause); + ui.toolWidget->layout()->removeWidget(ui.btnStop); + ui.toolWidget->layout()->removeWidget(ui.btnVolume); + ui.toolWidget->layout()->removeWidget(ui.btnSnapshot); + ui.toolWidget->layout()->removeWidget(ui.btnRecord); + ui.toolWidget->layout()->removeItem(ui.horizontalSpacer1); + ui.toolWidget->layout()->removeItem(ui.horizontalSpacer2); + ui.toolWidget->layout()->removeItem(ui.horizontalSpacer3); + + ui.infoWidget->layout()->addWidget(ui.cmbLayout); + ui.infoWidget->layout()->addWidget(ui.labTipInfo); + ui.infoWidget->layout()->addWidget(ui.labStatistics); + ui.infoWidget->show(); + + ui.toolWidget->layout()->addItem(ui.horizontalSpacer1); + ui.toolWidget->layout()->addWidget(ui.btnPlay); + ui.toolWidget->layout()->addWidget(ui.btnPause); + ui.toolWidget->layout()->addWidget(ui.btnStop); + ui.toolWidget->layout()->addItem(ui.horizontalSpacer2); + ui.toolWidget->layout()->addWidget(ui.btnVolume); + ui.toolWidget->layout()->addWidget(ui.btnSnapshot); + ui.toolWidget->layout()->addWidget(ui.btnRecord); + ui.toolWidget->layout()->addItem(ui.horizontalSpacer3); + } + + if (m_layoutMode == 2) + { + slotLayoutTwo(); + } + else if (m_layoutMode == 6) + { + slotLayoutSix(); + } +} + +void MediaClient::slotSystemSetting() +{ + SystemSetting dlg(m_syscfg, this); + + if (QDialog::Accepted == dlg.exec()) + { + SysConfig config = dlg.getSysConfig(); + + /* apply system config parameter */ + + if (m_syscfg.enableLog != config.enableLog) + { + if (m_syscfg.enableLog) + { + log_close(); + } + else + { + initLog(); + } + } + + log_set_level(config.logLevel); + + /* update system config parameter */ + m_syscfg.enableLog = config.enableLog; + m_syscfg.videoRenderMode = config.videoRenderMode; + m_syscfg.rtpMulticast = config.rtpMulticast; + m_syscfg.rtpOverUdp = config.rtpOverUdp; + m_syscfg.rtspOverHttp = config.rtspOverHttp; + m_syscfg.rtspOverHttpPort = config.rtspOverHttpPort; + m_syscfg.rtspOverWs = config.rtspOverWs; + m_syscfg.rtspOverWsPort = config.rtspOverWsPort; + m_syscfg.logLevel = config.logLevel; + m_syscfg.hwDecoding = config.hwDecoding; + m_syscfg.recordTime = config.recordTime; + m_syscfg.recordSize = config.recordSize; + } +} + +void MediaClient::slotOpenSnapshot() +{ + FileBrowse * pDlg = new FileBrowse(FILE_FORMAT_PIC, this); + + pDlg->exec(); + + delete pDlg; +} + +void MediaClient::slotOpenRecording() +{ + FileBrowse * pDlg = new FileBrowse(FILE_FORMAT_VIDEO, this); + + pDlg->exec(); + + delete pDlg; +} + +void MediaClient::slotAbout() +{ + About dlg(this); + + dlg.exec(); +} + + + diff --git a/MediaClient/MediaClientForMobile/formClass/MediaClient.h b/MediaClient/MediaClientForMobile/formClass/MediaClient.h new file mode 100644 index 0000000..b6dd7f4 --- /dev/null +++ b/MediaClient/MediaClientForMobile/formClass/MediaClient.h @@ -0,0 +1,90 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef MEDIACLIENT_H +#define MEDIACLIENT_H + +#include +#include "ui_MediaClient.h" +#include "config.h" + + +class MediaClient : public QDialog +{ + Q_OBJECT + +public: + MediaClient(QWidget *parent = Q_NULLPTR, Qt::WindowFlags flags = Qt::Widget); + ~MediaClient(); + +private slots: + void slotLayoutOne(); + void slotLayoutTwo(); + void slotLayoutFour(); + void slotLayoutSix(); + void slotLayoutNine(); + void slotLayoutChanged(int index); + void slotPlay(); + void slotPause(); + void slotStop(); + void slotCallState(QWidget* pWidget, int event); + void slotSnapshot(); + void slotRecord(); + void slotVolume(); + void slotSnapshotResult(bool ret); + void slotRecordResult(bool ret); + void slotUpdateStatistics(int bytes); + void slotOrientationChanged(Qt::ScreenOrientation orientation); + void slotWidgetSelecting(QWidget * pWidget); + void slotSystemSetting(); + void slotOpenSnapshot(); + void slotOpenRecording(); + void slotAbout(); + +protected: + void closeEvent(QCloseEvent * event); + +private: + void initLog(); + void initDialog(); + void connSignalSlot(); + void saveChannel(QList &channels, VideoWidget * widget); + void connVideoWidget(VideoWidget * widget); + void showBitrate(int bitrate); + void setupLayout(Qt::ScreenOrientation orientation); + void loadSystemConfig(); + void loadChannels(); + +private: + Ui::MediaClient ui; + + VideoWidget * m_curWidget; + int m_layoutMode; + uint64 m_recvBytes; + + QString m_url; + QString m_user; + QString m_pass; + + SysConfig m_syscfg; +}; + +#endif + + diff --git a/MediaClient/MediaClientForMobile/formClass/OpenMedia.cpp b/MediaClient/MediaClientForMobile/formClass/OpenMedia.cpp new file mode 100644 index 0000000..79b458e --- /dev/null +++ b/MediaClient/MediaClientForMobile/formClass/OpenMedia.cpp @@ -0,0 +1,69 @@ +/*************************************************************************************** + * + * 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 "OpenMedia.h" +#include "utils.h" +#include +#include + +OpenMedia::OpenMedia(QString &url, QString &user, QString &pass, QWidget *parent, Qt::WindowFlags flags) +: QDialog(parent, flags) +, m_url(url) +, m_user(user) +, m_pass(pass) +{ + ui.setupUi(this); + + ui.editUrl->setText(m_url); + ui.editUser->setText(m_user); + ui.editPass->setText(m_pass); + + connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(close())); + connect(ui.btnConfirm, SIGNAL(clicked()), this, SLOT(slotConfirm())); +} + +OpenMedia::~OpenMedia() +{ +} + +void OpenMedia::slotConfirm() +{ + m_url = ui.editUrl->text(); + m_user = ui.editUser->text(); + m_pass = ui.editPass->text(); + + if (m_url.isEmpty()) + { + ui.editUrl->setFocus(); + return; + } + else if (!isUrl(m_url)) + { + QMessageBox::information(NULL, tr("Tips"), tr("Invalid URL format!")); + ui.editUrl->setFocus(); + return; + } + + accept(); +} + + + + diff --git a/MediaClient/MediaClientForMobile/formClass/OpenMedia.h b/MediaClient/MediaClientForMobile/formClass/OpenMedia.h new file mode 100644 index 0000000..e3f30cf --- /dev/null +++ b/MediaClient/MediaClientForMobile/formClass/OpenMedia.h @@ -0,0 +1,49 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef OPEN_MEDIA_H +#define OPEN_MEDIA_H + +#include +#include "ui_OpenMedia.h" + +class OpenMedia : public QDialog +{ + Q_OBJECT + +public: + OpenMedia(QString &url, QString &user, QString &pass, QWidget *parent = 0, Qt::WindowFlags flags = Qt::Widget); + ~OpenMedia(); + + QString getUrl() { return m_url; } + QString getUser() { return m_user; } + QString getPass() { return m_pass; } + +public slots: + void slotConfirm(); + +private: + Ui::OpenMedia ui; + QString m_url; + QString m_user; + QString m_pass; +}; + +#endif + diff --git a/MediaClient/MediaClientForMobile/formClass/SystemSetting.cpp b/MediaClient/MediaClientForMobile/formClass/SystemSetting.cpp new file mode 100644 index 0000000..c9da96b --- /dev/null +++ b/MediaClient/MediaClientForMobile/formClass/SystemSetting.cpp @@ -0,0 +1,128 @@ +/*************************************************************************************** + * + * 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 "SystemSetting.h" +#include "utils.h" +#include "video_decoder.h" +#include +#include +#include +#include +#include + + +SystemSetting::SystemSetting(SysConfig &config, QWidget *parent) +: QDialog(parent) +, m_syscfg(config) +{ + ui.setupUi(this); + + initDialog(); + connSignalSlot(); +} + +SystemSetting::~SystemSetting() +{ +} + +void SystemSetting::initDialog() +{ + ui.cmbLogLevel->addItem(tr("TRACE")); + ui.cmbLogLevel->addItem(tr("DEBUG")); + ui.cmbLogLevel->addItem(tr("INFO")); + ui.cmbLogLevel->addItem(tr("WARNING")); + ui.cmbLogLevel->addItem(tr("ERROR")); + ui.cmbLogLevel->addItem(tr("FATAL")); + + ui.cmbVideoRenderMode->addItem(tr("Keep the original aspect ratio")); + ui.cmbVideoRenderMode->addItem(tr("Fill the whole window")); + +#if defined(ANDROID) + ui.cmbHWDecoding->addItem(tr("Automatic"), HW_DECODING_AUTO); + ui.cmbHWDecoding->addItem(tr("Media Codec"), HW_DECODING_MEDIACODEC); + ui.cmbHWDecoding->addItem(tr("Disable"), HW_DECODING_DISABLE); +#elif defined(IOS) + ui.cmbHWDecoding->addItem(tr("Automatic"), HW_DECODING_AUTO); + ui.cmbHWDecoding->addItem(tr("Videotoolbox"), HW_DECODING_VIDEOTOOLBOX); + ui.cmbHWDecoding->addItem(tr("Disable"), HW_DECODING_DISABLE); +#endif + + ui.chkEnableLog->setChecked(m_syscfg.enableLog); + ui.chkRtpMulticast->setChecked(m_syscfg.rtpMulticast); + ui.chkRtpOverUdp->setChecked(m_syscfg.rtpOverUdp); + ui.chkRtspOverHttp->setChecked(m_syscfg.rtspOverHttp); + ui.spinHttpPort->setValue(m_syscfg.rtspOverHttpPort); + ui.chkRtspOverWs->setChecked(m_syscfg.rtspOverWs); + ui.spinWsPort->setValue(m_syscfg.rtspOverWsPort); + ui.cmbVideoRenderMode->setCurrentIndex(m_syscfg.videoRenderMode); + ui.cmbLogLevel->setCurrentIndex(m_syscfg.logLevel); + ui.timeRecordTime->setTime(QTime(0,0,0,0).addSecs(m_syscfg.recordTime)); + ui.spinRecordSize->setValue(m_syscfg.recordSize); + + for (int i = 0; i < ui.cmbHWDecoding->count(); i++) + { + if (ui.cmbHWDecoding->itemData(i).toInt() == m_syscfg.hwDecoding) + { + ui.cmbHWDecoding->setCurrentIndex(i); + break; + } + } + + showMaximized(); +} + +void SystemSetting::connSignalSlot() +{ + connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(close())); + connect(ui.btnConfirm, SIGNAL(clicked()), this, SLOT(slotConfirm())); +} + +void SystemSetting::slotConfirm() +{ + m_syscfg.enableLog = ui.chkEnableLog->isChecked(); + m_syscfg.logLevel = ui.cmbLogLevel->currentIndex(); + m_syscfg.rtpMulticast = ui.chkRtpMulticast->isChecked(); + m_syscfg.rtpOverUdp = ui.chkRtpOverUdp->isChecked(); + m_syscfg.rtspOverHttp = ui.chkRtspOverHttp->isChecked(); + m_syscfg.rtspOverHttpPort = ui.spinHttpPort->value(); + m_syscfg.rtspOverWs = ui.chkRtspOverWs->isChecked(); + m_syscfg.rtspOverWsPort = ui.spinWsPort->value(); + m_syscfg.recordTime = QTime(0, 0, 0, 0).secsTo(ui.timeRecordTime->time()); + m_syscfg.recordSize = ui.spinRecordSize->value(); + m_syscfg.videoRenderMode = ui.cmbVideoRenderMode->currentIndex(); + m_syscfg.hwDecoding = ui.cmbHWDecoding->currentData().toInt(); + + saveEnableLogFlag(m_syscfg.enableLog); + saveLogLevel(m_syscfg.logLevel); + saveRtpMulticast(m_syscfg.rtpMulticast); + saveRtpOverUdp(m_syscfg.rtpOverUdp); + saveRtspOverHttp(m_syscfg.rtspOverHttp); + saveRtspOverHttpPort(m_syscfg.rtspOverHttpPort); + saveRtspOverWs(m_syscfg.rtspOverWs); + saveRtspOverWsPort(m_syscfg.rtspOverWsPort); + saveRecordTime(m_syscfg.recordTime); + saveRecordSize(m_syscfg.recordSize); + saveVideoRenderMode(m_syscfg.videoRenderMode); + saveHWDecoding(m_syscfg.hwDecoding); + + accept(); +} + + + diff --git a/MediaClient/MediaClientForMobile/formClass/SystemSetting.h b/MediaClient/MediaClientForMobile/formClass/SystemSetting.h new file mode 100644 index 0000000..4d22012 --- /dev/null +++ b/MediaClient/MediaClientForMobile/formClass/SystemSetting.h @@ -0,0 +1,56 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef _SYSTEM_SETTING_H_ +#define _SYSTEM_SETTING_H_ + +#include "sys_inc.h" +#include +#include "ui_SystemSetting.h" +#include "config.h" + + +class SystemSetting : public QDialog +{ + Q_OBJECT + +public: + SystemSetting(SysConfig &config, QWidget *parent = 0); + ~SystemSetting(); + + SysConfig getSysConfig(){return m_syscfg;} + +private slots: + void slotConfirm(); + +private: + void initDialog(); + void connSignalSlot(); + +private: + Ui::SystemSetting ui; + + SysConfig m_syscfg; +}; + +#endif + + + + diff --git a/MediaClient/MediaClientForMobile/formClass/VideoWidget.cpp b/MediaClient/MediaClientForMobile/formClass/VideoWidget.cpp new file mode 100644 index 0000000..1f9efad --- /dev/null +++ b/MediaClient/MediaClientForMobile/formClass/VideoWidget.cpp @@ -0,0 +1,732 @@ +/*************************************************************************************** + * + * 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 "VideoWidget.h" +#include "utils.h" +#include "InstMsgDialog.h" +#include "rtsp_player.h" +#include "rtmp_player.h" +#include "http_flv_player.h" +#include "http_mjpeg_player.h" +#include "srt_player.h" +#include "file_player.h" +#include "http_test.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if defined(ANDROID) +#include +#endif + +/*********************************************************************************************/ + +#define VERTEXIN 0 +#define TEXTUREIN 1 + + +/*********************************************************************************************/ + +VideoWidget::VideoWidget(QWidget * parent, Qt::WindowFlags f) +: QOpenGLWidget(parent, f) +, m_pPlayer(NULL) +, m_bMute(FALSE) +, m_bRecording(FALSE) +, m_pRenderFrame(NULL) +#ifdef BACKCHANNEL +, m_nBackChannelFlag(0) +#endif +{ + setAttribute(Qt::WA_OpaquePaintEvent); + + m_timerReconn.setSingleShot(true); + + connect(&m_timerReconn, SIGNAL(timeout()), this, SLOT(slotReconn())); + connect(this, SIGNAL(imageReady()), this, SLOT(update()), Qt::QueuedConnection); +} + +VideoWidget::~VideoWidget() +{ + closeVideo(); + + makeCurrent(); + vbo.destroy(); + textureY->destroy(); + textureU->destroy(); + textureV->destroy(); + doneCurrent(); +} + +void VideoWidget::play(QString url, QString acct, QString pass) +{ + if (m_url == url && m_acct == acct && m_pass == pass) + { + return; + } + + closeVideo(); + + m_url = url; + m_acct = acct; + m_pass = pass; + m_base = getBaseName(url); + + if (!m_url.isEmpty()) + { + makeCall(); + } +} + +void VideoWidget::pause() +{ + if (m_pPlayer) + { + m_pPlayer->pause(); + } +} + +void VideoWidget::stop() +{ + closeVideo(); +} + +void VideoWidget::closePlayer() +{ + m_timerReconn.stop(); + + if (m_pPlayer) + { + delete m_pPlayer; + m_pPlayer = NULL; + } +} + +void VideoWidget::closeVideo() +{ + closePlayer(); + + m_url = ""; + m_acct = ""; + m_pass = ""; + m_bRecording = FALSE; + + QMutexLocker locker(&m_mutex); + + if (m_pRenderFrame) + { + av_frame_free(&m_pRenderFrame); + } + + update(); +} + +BOOL VideoWidget::isRecording() +{ + if (m_pPlayer) + { + return m_pPlayer->isRecording(); + } + + return FALSE; +} + +void VideoWidget::makeCall() +{ + BOOL isFile = 0; + BOOL isRtsp = FALSE; + + if (isRtspUrl(m_url)) + { + isRtsp = TRUE; + m_pPlayer = new CRtspPlayer(this); + } + else if (isRtmpUrl(m_url)) + { + m_pPlayer = new CRtmpPlayer(this); + } + else if (isHttpUrl(m_url)) + { + HTTPCTT ctt; + + if (http_test(m_url.toStdString().c_str(), m_acct.toStdString().c_str(), m_pass.toStdString().c_str(), &ctt, 2*1000)) + { + if (CTT_RTSP_TUNNELLED == ctt) + { + isRtsp = TRUE; + m_pPlayer = new CRtspPlayer(this); + } + else if (CTT_FLV == ctt) + { + m_pPlayer = new CHttpFlvPlayer(this); + } + else if (CTT_MULTIPART == ctt) + { + m_pPlayer = new CHttpMjpegPlayer(this); + } + } + else + { + m_pPlayer = new CHttpFlvPlayer(this); + } + } + else if (isSrtUrl(m_url)) + { + m_pPlayer = new CSrtPlayer(this); + } + else + { + isFile = 1; + m_pPlayer = new CFilePlayer(this); + } + + if (NULL == m_pPlayer) + { + return; + } + + connect(m_pPlayer, SIGNAL(notify(int)), this, SLOT(slotPlayerNotify(int)), Qt::QueuedConnection); + connect(m_pPlayer, SIGNAL(snapshoted(AVFrame*)), this, SLOT(slotSnapshoted(AVFrame*)), Qt::QueuedConnection); + connect(m_pPlayer, SIGNAL(imageReady(AVFrame*)), this, SLOT(slotImageReady(AVFrame*)), Qt::QueuedConnection); + connect(m_pPlayer, SIGNAL(updateStatistics(int)), this, SIGNAL(updateStatistics(int))); + + if (m_pPlayer->open(m_url, 0)) + { + m_pPlayer->setAuthInfo(m_acct, m_pass); + m_pPlayer->setHWDecoding(getHWDecoding()); + + if (isRtsp) + { + m_pPlayer->setRtpOverUdp(getRtpOverUdp()); + m_pPlayer->setRtpMulticast(getRtpMulticast()); + +#ifdef OVER_HTTP + m_pPlayer->setRtspOverHttp(getRtspOverHttp(), getRtspOverHttpPort()); +#endif +#ifdef OVER_WEBSOCKET + m_pPlayer->setRtspOverWs(getRtspOverWs(), getRtspOverWsPort()); +#endif +#ifdef BACKCHANNEL + m_pPlayer->setBCFlag(m_nBackChannelFlag); +#endif + } + else if (isFile) + { + setMute(m_bMute); + } + + m_pPlayer->play(); + } + else + { + closePlayer(); + } +} + +void VideoWidget::mousePressEvent(QMouseEvent * event) +{ + emit widgetSelecting(this); +} + +BOOL VideoWidget::micphone() +{ +#ifdef BACKCHANNEL + if (NULL == m_pPlayer) + { + return FALSE; + } + +#if defined(ANDROID) + QJniObject str = QJniObject::fromString("android.permission.RECORD_AUDIO"); + QJniObject::callStaticMethod("org/happytimesoft/util/HtUtil", + "requestPermission", + "(Landroid/content/Context;Ljava/lang/String;)I", + QNativeInterface::QAndroidApplication::context(), + str.object()); +#endif + + closePlayer(); + + if (m_nBackChannelFlag) + { + m_nBackChannelFlag = 0; + } + else + { + m_nBackChannelFlag = 1; + } + + makeCall(); + + if (m_pPlayer) + { + m_pPlayer->setBCDataFlag(m_nBackChannelFlag); + + return m_pPlayer->getBCFlag(); + } +#endif + + return FALSE; +} + +void VideoWidget::setMute(BOOL flag) +{ + m_bMute = flag; + + if (m_pPlayer) + { + m_pPlayer->setVolume(flag ? HTVOLUME_MIN : HTVOLUME_MAX); + } +} + +BOOL VideoWidget::isPlaying() +{ + if (m_pPlayer) + { + return m_pPlayer->isPlaying() || m_pPlayer->isPaused(); + } + + return FALSE; +} + +void VideoWidget::snapshot() +{ + if (m_pPlayer) + { + m_pPlayer->snapshot(VIDEO_FMT_RGB24); + } +} + +void VideoWidget::slotSnapshoted(AVFrame * frame) +{ + QImage image = QImage(frame->data[0], frame->width, frame->height, frame->linesize[0], QImage::Format_RGB888); + QString file = getSnapshotPath() + "/" + getTempFile(m_base, ".jpg"); + + if (!image.save(file, "JPG")) + { + emit snapshotResult(false); + } + else + { + emit snapshotResult(true); + } +} + +BOOL VideoWidget::record() +{ + if (NULL == m_pPlayer) + { + return FALSE; + } + + if (m_pPlayer->isRecording()) + { + stopRecord(); + } + else + { + startRecord(); + } + + m_bRecording = m_pPlayer->isRecording(); + + return m_bRecording; +} + +void VideoWidget::startRecord() +{ + if (NULL == m_pPlayer) + { + return; + } + + if (m_pPlayer->isRecording()) + { + return; + } + + QString file = getRecordPath() + "/" + getTempFile(m_base, ".avi"); + + m_pPlayer->record(file); +} + +void VideoWidget::stopRecord() +{ + if (NULL == m_pPlayer) + { + return; + } + + if (m_pPlayer->isRecording()) + { + m_pPlayer->stopRecord(); + + emit recordResult(true); + } +} + +QRect VideoWidget::getVideoRenderRect(int videoW, int videoH) +{ + QRect rect = this->rect(); + qreal ratio = QGuiApplication::primaryScreen()->devicePixelRatio(); + int w = rect.width() * ratio; + int h = rect.height() * ratio; + + if (getVideoRenderMode() == RENDER_MODE_KEEP) // keep the original aspect ratio + { + int iw = videoW; + int ih = videoH; + int nw, nh; + + double vratio = iw / (double)ih; + double wratio = w / (double)h; + + if (vratio > wratio) + { + nw = w; + nh = w * ih / iw; + } + else + { + nw = h * iw / ih; + nh = h; + } + + rect.setLeft((w - nw) / 2); + rect.setTop((h - nh) / 2); + rect.setRight(rect.left() + nw); + rect.setBottom(rect.top() + nh); + } + else // fill the whole window + { + rect.setLeft(0); + rect.setTop(0); + rect.setRight(w); + rect.setBottom(h); + } + + return rect; +} + +void VideoWidget::slotImageReady(AVFrame * frame) +{ + QMutexLocker locker(&m_mutex); + + if (m_pRenderFrame) + { + av_frame_free(&m_pRenderFrame); + } + + if (m_pPlayer) + { + m_pRenderFrame = frame; + + emit imageReady(); + } + else + { + av_frame_free(&frame); + } +} + +void VideoWidget::slotPlayerNotify(int event) +{ + if (event == RTSP_EVE_CONNFAIL || + event == RTMP_EVE_CONNFAIL || + event == HTTP_FLV_EVE_CONNFAIL || + event == MJPEG_EVE_CONNFAIL || + event == SRT_EVE_CONNFAIL) + { + m_timerReconn.start(5 * 1000); + } + else if (event == RTSP_EVE_CONNSUCC || + event == MJPEG_EVE_CONNSUCC) + { + setMute(m_bMute); + + // Re-record after reconnect + if (m_bRecording) + { + startRecord(); + } + } + else if (event == RTMP_EVE_VIDEOREADY || + event == HTTP_FLV_EVE_VIDEOREADY || + event == SRT_EVE_VIDEOREADY) + { + // Re-record after reconnect + if (m_bRecording) + { + startRecord(); + } + } + else if (event == RTMP_EVE_AUDIOREADY || + event == HTTP_FLV_EVE_AUDIOREADY || + event == SRT_EVE_AUDIOREADY) + { + setMute(m_bMute); + } + else if (event == RTSP_EVE_NOSIGNAL || + event == RTMP_EVE_NOSIGNAL || + event == HTTP_FLV_EVE_NOSIGNAL || + event == MJPEG_EVE_NOSIGNAL || + event == SRT_EVE_NOSIGNAL) + { + m_timerReconn.start(5 * 1000); + } + else if (event == RTSP_EVE_NODATA || + event == RTMP_EVE_NODATA || + event == HTTP_FLV_EVE_NODATA || + event == MJPEG_EVE_NODATA || + event == SRT_EVE_NODATA) + { + m_timerReconn.start(5 * 1000); + } + else if (event == RTSP_EVE_RESUME || + event == RTMP_EVE_RESUME || + event == HTTP_FLV_EVE_RESUME || + event == MJPEG_EVE_RESUME || + event == SRT_EVE_RESUME) + { + m_timerReconn.stop(); + } + else if (event == RTSP_EVE_STOPPED || + event == RTMP_EVE_STOPPED || + event == HTTP_FLV_EVE_STOPPED || + event == MJPEG_EVE_STOPPED || + event == SRT_EVE_STOPPED) + { + m_timerReconn.start(5 * 1000); + } + + emit callState(this, event); +} + +void VideoWidget::slotReconn() +{ + closePlayer(); + + makeCall(); +} + +QString VideoWidget::getBaseName(QString &url) +{ + if (isUrl(url)) + { + char host[100] = {'\0'}; + + url_split(url.toStdString().c_str(), NULL, 0, NULL, 0, NULL, 0, host, sizeof(host), NULL, NULL, 0); + + return QString(host); + } + else + { + QFileInfo fileInfo(url); + + return fileInfo.baseName(); + } +} + +void VideoWidget::initializeGL() +{ + initializeOpenGLFunctions(); + glEnable(GL_DEPTH_TEST); + glEnable(GL_TEXTURE_2D); + + static const GLfloat vertices[] + { + -1.0f, -1.0f, + -1.0f, +1.0f, + +1.0f, +1.0f, + +1.0f, -1.0f, + 0.0f, 1.0f, + 0.0f, 0.0f, + 1.0f, 0.0f, + 1.0f, 1.0f, + }; + + if (!vbo.create()) + { + log_print(HT_LOG_ERR, "%s, vbo.create failed\r\n", __FUNCTION__); + } + + if (!vbo.bind()) + { + log_print(HT_LOG_ERR, "%s, vbo.bind failed\r\n", __FUNCTION__); + } + + vbo.allocate(vertices, sizeof(vertices)); + + QOpenGLShader * vshader = new QOpenGLShader(QOpenGLShader::Vertex, this); + const char * vsrc = + "attribute vec4 vertexIn; \n" + "attribute vec2 textureIn; \n" + "varying highp vec2 textureOut; \n" + "void main(void) \n" + "{ \n" + " gl_Position = vertexIn; \n" + " textureOut = textureIn; \n" + "}"; + if (!vshader->compileSourceCode(vsrc)) + { + log_print(HT_LOG_ERR, "%s, compile vertex source failed\r\n", __FUNCTION__); + } + + QOpenGLShader * fshader = new QOpenGLShader(QOpenGLShader::Fragment, this); + const char * fsrc = + "varying highp vec2 textureOut; \n" + "uniform sampler2D tex_y; \n" + "uniform sampler2D tex_u; \n" + "uniform sampler2D tex_v; \n" + "void main(void) \n" + "{ \n" + " lowp vec3 yuv; \n" + " lowp vec3 rgb; \n" + " yuv.x = texture2D(tex_y, textureOut).r; \n" + " yuv.y = texture2D(tex_u, textureOut).r - 0.5; \n" + " yuv.z = texture2D(tex_v, textureOut).r - 0.5; \n" + " rgb = mat3( 1, 1, 1, \n" + " 0, -0.39465, 2.03211, \n" + " 1.13983, -0.58060, 0) * yuv; \n" + " gl_FragColor = vec4(rgb, 1); \n" + "}"; + if (!fshader->compileSourceCode(fsrc)) + { + log_print(HT_LOG_ERR, "%s, compile fragment source failed\r\n", __FUNCTION__); + } + + program = new QOpenGLShaderProgram(this); + + if (!program->addShader(vshader)) + { + log_print(HT_LOG_ERR, "%s, add vertex shader failed\r\n", __FUNCTION__); + } + + if (!program->addShader(fshader)) + { + log_print(HT_LOG_ERR, "%s, add fragment shader failed\r\n", __FUNCTION__); + } + + program->bindAttributeLocation("vertexIn", VERTEXIN); + program->bindAttributeLocation("textureIn", TEXTUREIN); + + if (!program->link()) + { + log_print(HT_LOG_ERR, "%s, link failed. %s\r\n", __FUNCTION__, program->log().toStdString().c_str()); + } + + if (!program->bind()) + { + log_print(HT_LOG_ERR, "%s, program bind failed\r\n", __FUNCTION__); + } + + program->enableAttributeArray(VERTEXIN); + program->enableAttributeArray(TEXTUREIN); + program->setAttributeBuffer(VERTEXIN, GL_FLOAT, 0, 2, 2*sizeof(GLfloat)); + program->setAttributeBuffer(TEXTUREIN, GL_FLOAT, 8*sizeof(GLfloat), 2, 2*sizeof(GLfloat)); + + textureUniformY = program->uniformLocation("tex_y"); + textureUniformU = program->uniformLocation("tex_u"); + textureUniformV = program->uniformLocation("tex_v"); + + textureY = new QOpenGLTexture(QOpenGLTexture::Target2D); + textureU = new QOpenGLTexture(QOpenGLTexture::Target2D); + textureV = new QOpenGLTexture(QOpenGLTexture::Target2D); + + if (!textureY->create()) + { + log_print(HT_LOG_ERR, "%s, textureY create failed\r\n", __FUNCTION__); + } + + if (!textureU->create()) + { + log_print(HT_LOG_ERR, "%s, textureU create failed\r\n", __FUNCTION__); + } + + if (!textureV->create()) + { + log_print(HT_LOG_ERR, "%s, textureV create failed\r\n", __FUNCTION__); + } + + idY = textureY->textureId(); + idU = textureU->textureId(); + idV = textureV->textureId(); + + glClearColor(0.0, 0.0, 0.0, 1.0f); +} + +void VideoWidget::paintGL() +{ + glClearColor(0.0f, 0.0f, 0.0f, 1.0f); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + QMutexLocker locker(&m_mutex); + + if (NULL == m_pRenderFrame) + { + return; + } + + int videoW = m_pRenderFrame->width; + int videoH = m_pRenderFrame->height; + + QRect rect = getVideoRenderRect(videoW, videoH); + + glViewport(rect.left(), rect.top(), rect.width(), rect.height()); + + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D, idY); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, videoW, videoH, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, m_pRenderFrame->data[0]); + + glActiveTexture(GL_TEXTURE1); + glBindTexture(GL_TEXTURE_2D, idU); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, videoW >> 1, videoH >> 1, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, m_pRenderFrame->data[1]); + + glActiveTexture(GL_TEXTURE2); + glBindTexture(GL_TEXTURE_2D, idV); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, videoW >> 1, videoH >> 1, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, m_pRenderFrame->data[2]); + + glUniform1i(textureUniformY, 0); + glUniform1i(textureUniformU, 1); + glUniform1i(textureUniformV, 2); + + glDrawArrays(GL_TRIANGLE_FAN, 0, 4); +} + + + diff --git a/MediaClient/MediaClientForMobile/formClass/VideoWidget.h b/MediaClient/MediaClientForMobile/formClass/VideoWidget.h new file mode 100644 index 0000000..d132d32 --- /dev/null +++ b/MediaClient/MediaClientForMobile/formClass/VideoWidget.h @@ -0,0 +1,117 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef VIDEO_WIDGET_H +#define VIDEO_WIDGET_H + +#include "sys_inc.h" +#include "video_player.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +class VideoWidget : public QOpenGLWidget, protected QOpenGLFunctions +{ + Q_OBJECT + +public: + VideoWidget(QWidget * parent = 0, Qt::WindowFlags f = Qt::Widget); + ~VideoWidget(); + + void play(QString url, QString user, QString pass); + void pause(); + void stop(); + void snapshot(); + BOOL record(); + void stopRecord(); + void setMute(BOOL flag); + BOOL micphone(); + BOOL isPlaying(); + BOOL isMute() {return m_bMute;} + BOOL isRecording(); + QString getUrl() { return m_url; } + QString getUser() { return m_acct; } + QString getPass() { return m_pass; } + +private slots: + void slotImageReady(AVFrame * frame); + void slotPlayerNotify(int event); + void slotReconn(); + void slotSnapshoted(AVFrame * frame); + +signals: + void callState(QWidget *, int); + void snapshotResult(bool); + void recordResult(bool); + void updateStatistics(int); + void imageReady(); + void widgetSelecting(QWidget *); + +protected: + void mousePressEvent(QMouseEvent * event); + void initializeGL(); + void paintGL(); + +private: + void closePlayer(); + void closeVideo(); + void makeCall(); + QRect getVideoRenderRect(int videoW, int videoH); + void startRecord(); + QString getBaseName(QString &url); + +private: + QString m_url; + QString m_acct; + QString m_pass; + QString m_base; + + CVideoPlayer * m_pPlayer; + QTimer m_timerReconn; + BOOL m_bMute; + BOOL m_bRecording; + QMutex m_mutex; + AVFrame * m_pRenderFrame; + +#ifdef BACKCHANNEL + int m_nBackChannelFlag; +#endif + + QOpenGLShaderProgram * program; + QOpenGLBuffer vbo; + GLuint textureUniformY; + GLuint textureUniformU; + GLuint textureUniformV; + QOpenGLTexture* textureY = nullptr; + QOpenGLTexture* textureU = nullptr; + QOpenGLTexture* textureV = nullptr; + GLuint idY, idU, idV; +}; + +#endif + + diff --git a/MediaClient/MediaClientForMobile/ios/Info.plist b/MediaClient/MediaClientForMobile/ios/Info.plist new file mode 100644 index 0000000..17749df --- /dev/null +++ b/MediaClient/MediaClientForMobile/ios/Info.plist @@ -0,0 +1,52 @@ + + + + + CFBundleAllowMixedLocalizations + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleDisplayName + ${PRODUCT_NAME} + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + ${ASSETCATALOG_COMPILER_APPICON_NAME} + CFBundleIdentifier + ${PRODUCT_BUNDLE_IDENTIFIER} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleShortVersionString + ${QMAKE_SHORT_VERSION} + CFBundleVersion + ${QMAKE_FULL_VERSION} + LSRequiresIPhoneOS + + NOTE + This file was generated by Qt/QMake. + NSAppTransportSecurity + + NSAllowsArbitraryLoads + + NSAllowsLocalNetworking + + + NSLocalNetworkUsageDescription + connect to server + UILaunchStoryboardName + LaunchScreen.storyboard + UIRequiresPersistentWiFi + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/MediaClient/MediaClientForMobile/ios/file_view_controller.h b/MediaClient/MediaClientForMobile/ios/file_view_controller.h new file mode 100644 index 0000000..a759467 --- /dev/null +++ b/MediaClient/MediaClientForMobile/ios/file_view_controller.h @@ -0,0 +1,3 @@ +#import +@interface DocViewController : UIViewController +@end diff --git a/MediaClient/MediaClientForMobile/ios/file_view_controller.mm b/MediaClient/MediaClientForMobile/ios/file_view_controller.mm new file mode 100644 index 0000000..ca41cec --- /dev/null +++ b/MediaClient/MediaClientForMobile/ios/file_view_controller.mm @@ -0,0 +1,20 @@ +#import "file_view_controller.h" +@interface DocViewController () +@end +@implementation DocViewController +#pragma mark - +#pragma mark View Life Cycle +- (void)viewDidLoad { + [super viewDidLoad]; +} +#pragma mark - +#pragma mark Document Interaction Controller Delegate Methods +- (UIViewController *) documentInteractionControllerViewControllerForPreview: (UIDocumentInteractionController *) controller { + //return [[[[UIApplication sharedApplication]windows] firstObject]rootViewController]; + return self; +} +- (void)documentInteractionControllerDidEndPreview:(UIDocumentInteractionController *)controller +{ + [self removeFromParentViewController]; +} +@end diff --git a/MediaClient/MediaClientForMobile/ios/ios_launcher.h b/MediaClient/MediaClientForMobile/ios/ios_launcher.h new file mode 100644 index 0000000..628c779 --- /dev/null +++ b/MediaClient/MediaClientForMobile/ios/ios_launcher.h @@ -0,0 +1,8 @@ +#ifndef IOS_LAUNCHER_H +#define IOS_LAUNCHER_H + +#include + +bool iosLaunchFile(QString file); + +#endif // IOS_LAUNCHER_H diff --git a/MediaClient/MediaClientForMobile/ios/ios_launcher.mm b/MediaClient/MediaClientForMobile/ios/ios_launcher.mm new file mode 100644 index 0000000..7e4a37d --- /dev/null +++ b/MediaClient/MediaClientForMobile/ios/ios_launcher.mm @@ -0,0 +1,31 @@ +#include "ios_launcher.h" +#include "file_view_controller.h" +#include +#import + +bool iosLaunchFile(QString file) +{ + NSString* url = file.toNSString(); + NSURL* fileURL = [NSURL fileURLWithPath:url]; + static DocViewController* mtv = nil; + if (mtv!=nil) + { + [mtv removeFromParentViewController]; + [mtv release]; + } + + UIDocumentInteractionController* documentInteractionController = nil; + documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:fileURL]; + + UIViewController* rootv = [[[[UIApplication sharedApplication]windows] firstObject]rootViewController]; + if (rootv!=nil) + { + mtv = [[DocViewController alloc] init]; + [rootv addChildViewController:mtv]; + documentInteractionController.delegate = mtv; + [documentInteractionController presentPreviewAnimated:NO]; + return true; + } + + return false; +} diff --git a/MediaClient/MediaClientForMobile/lib/arm64-v8a/libavcodec.a b/MediaClient/MediaClientForMobile/lib/arm64-v8a/libavcodec.a new file mode 100644 index 0000000..765cae8 Binary files /dev/null and b/MediaClient/MediaClientForMobile/lib/arm64-v8a/libavcodec.a differ diff --git a/MediaClient/MediaClientForMobile/lib/arm64-v8a/libavdevice.a b/MediaClient/MediaClientForMobile/lib/arm64-v8a/libavdevice.a new file mode 100644 index 0000000..09aa32c Binary files /dev/null and b/MediaClient/MediaClientForMobile/lib/arm64-v8a/libavdevice.a differ diff --git a/MediaClient/MediaClientForMobile/lib/arm64-v8a/libavfilter.a b/MediaClient/MediaClientForMobile/lib/arm64-v8a/libavfilter.a new file mode 100644 index 0000000..171f3de Binary files /dev/null and b/MediaClient/MediaClientForMobile/lib/arm64-v8a/libavfilter.a differ diff --git a/MediaClient/MediaClientForMobile/lib/arm64-v8a/libavformat.a b/MediaClient/MediaClientForMobile/lib/arm64-v8a/libavformat.a new file mode 100644 index 0000000..ce8090f Binary files /dev/null and b/MediaClient/MediaClientForMobile/lib/arm64-v8a/libavformat.a differ diff --git a/MediaClient/MediaClientForMobile/lib/arm64-v8a/libavutil.a b/MediaClient/MediaClientForMobile/lib/arm64-v8a/libavutil.a new file mode 100644 index 0000000..9e252bc Binary files /dev/null and b/MediaClient/MediaClientForMobile/lib/arm64-v8a/libavutil.a differ diff --git a/MediaClient/MediaClientForMobile/lib/arm64-v8a/libcrypto.so b/MediaClient/MediaClientForMobile/lib/arm64-v8a/libcrypto.so new file mode 100644 index 0000000..0040336 Binary files /dev/null and b/MediaClient/MediaClientForMobile/lib/arm64-v8a/libcrypto.so differ diff --git a/MediaClient/MediaClientForMobile/lib/arm64-v8a/libopus.a b/MediaClient/MediaClientForMobile/lib/arm64-v8a/libopus.a new file mode 100644 index 0000000..b375b1a Binary files /dev/null and b/MediaClient/MediaClientForMobile/lib/arm64-v8a/libopus.a differ diff --git a/MediaClient/MediaClientForMobile/lib/arm64-v8a/libpostproc.a b/MediaClient/MediaClientForMobile/lib/arm64-v8a/libpostproc.a new file mode 100644 index 0000000..b15a8c9 Binary files /dev/null and b/MediaClient/MediaClientForMobile/lib/arm64-v8a/libpostproc.a differ diff --git a/MediaClient/MediaClientForMobile/lib/arm64-v8a/libsrt.a b/MediaClient/MediaClientForMobile/lib/arm64-v8a/libsrt.a new file mode 100644 index 0000000..ee87b44 Binary files /dev/null and b/MediaClient/MediaClientForMobile/lib/arm64-v8a/libsrt.a differ diff --git a/MediaClient/MediaClientForMobile/lib/arm64-v8a/libssl.so b/MediaClient/MediaClientForMobile/lib/arm64-v8a/libssl.so new file mode 100644 index 0000000..61e4589 Binary files /dev/null and b/MediaClient/MediaClientForMobile/lib/arm64-v8a/libssl.so differ diff --git a/MediaClient/MediaClientForMobile/lib/arm64-v8a/libswresample.a b/MediaClient/MediaClientForMobile/lib/arm64-v8a/libswresample.a new file mode 100644 index 0000000..4217756 Binary files /dev/null and b/MediaClient/MediaClientForMobile/lib/arm64-v8a/libswresample.a differ diff --git a/MediaClient/MediaClientForMobile/lib/arm64-v8a/libswscale.a b/MediaClient/MediaClientForMobile/lib/arm64-v8a/libswscale.a new file mode 100644 index 0000000..9325566 Binary files /dev/null and b/MediaClient/MediaClientForMobile/lib/arm64-v8a/libswscale.a differ diff --git a/MediaClient/MediaClientForMobile/lib/arm64-v8a/libx264.a b/MediaClient/MediaClientForMobile/lib/arm64-v8a/libx264.a new file mode 100644 index 0000000..371dd38 Binary files /dev/null and b/MediaClient/MediaClientForMobile/lib/arm64-v8a/libx264.a differ diff --git a/MediaClient/MediaClientForMobile/lib/arm64-v8a/libx265.a b/MediaClient/MediaClientForMobile/lib/arm64-v8a/libx265.a new file mode 100644 index 0000000..1c1198e Binary files /dev/null and b/MediaClient/MediaClientForMobile/lib/arm64-v8a/libx265.a differ diff --git a/MediaClient/MediaClientForMobile/lib/armeabi-v7a/libavcodec.a b/MediaClient/MediaClientForMobile/lib/armeabi-v7a/libavcodec.a new file mode 100644 index 0000000..dbeba53 Binary files /dev/null and b/MediaClient/MediaClientForMobile/lib/armeabi-v7a/libavcodec.a differ diff --git a/MediaClient/MediaClientForMobile/lib/armeabi-v7a/libavdevice.a b/MediaClient/MediaClientForMobile/lib/armeabi-v7a/libavdevice.a new file mode 100644 index 0000000..aaf3148 Binary files /dev/null and b/MediaClient/MediaClientForMobile/lib/armeabi-v7a/libavdevice.a differ diff --git a/MediaClient/MediaClientForMobile/lib/armeabi-v7a/libavfilter.a b/MediaClient/MediaClientForMobile/lib/armeabi-v7a/libavfilter.a new file mode 100644 index 0000000..5f46c04 Binary files /dev/null and b/MediaClient/MediaClientForMobile/lib/armeabi-v7a/libavfilter.a differ diff --git a/MediaClient/MediaClientForMobile/lib/armeabi-v7a/libavformat.a b/MediaClient/MediaClientForMobile/lib/armeabi-v7a/libavformat.a new file mode 100644 index 0000000..0d89447 Binary files /dev/null and b/MediaClient/MediaClientForMobile/lib/armeabi-v7a/libavformat.a differ diff --git a/MediaClient/MediaClientForMobile/lib/armeabi-v7a/libavutil.a b/MediaClient/MediaClientForMobile/lib/armeabi-v7a/libavutil.a new file mode 100644 index 0000000..9a328b2 Binary files /dev/null and b/MediaClient/MediaClientForMobile/lib/armeabi-v7a/libavutil.a differ diff --git a/MediaClient/MediaClientForMobile/lib/armeabi-v7a/libcrypto.so b/MediaClient/MediaClientForMobile/lib/armeabi-v7a/libcrypto.so new file mode 100644 index 0000000..9893bf4 Binary files /dev/null and b/MediaClient/MediaClientForMobile/lib/armeabi-v7a/libcrypto.so differ diff --git a/MediaClient/MediaClientForMobile/lib/armeabi-v7a/libopus.a b/MediaClient/MediaClientForMobile/lib/armeabi-v7a/libopus.a new file mode 100644 index 0000000..68e8b52 Binary files /dev/null and b/MediaClient/MediaClientForMobile/lib/armeabi-v7a/libopus.a differ diff --git a/MediaClient/MediaClientForMobile/lib/armeabi-v7a/libpostproc.a b/MediaClient/MediaClientForMobile/lib/armeabi-v7a/libpostproc.a new file mode 100644 index 0000000..cb44759 Binary files /dev/null and b/MediaClient/MediaClientForMobile/lib/armeabi-v7a/libpostproc.a differ diff --git a/MediaClient/MediaClientForMobile/lib/armeabi-v7a/libsrt.a b/MediaClient/MediaClientForMobile/lib/armeabi-v7a/libsrt.a new file mode 100644 index 0000000..7895a41 Binary files /dev/null and b/MediaClient/MediaClientForMobile/lib/armeabi-v7a/libsrt.a differ diff --git a/MediaClient/MediaClientForMobile/lib/armeabi-v7a/libssl.so b/MediaClient/MediaClientForMobile/lib/armeabi-v7a/libssl.so new file mode 100644 index 0000000..23650ee Binary files /dev/null and b/MediaClient/MediaClientForMobile/lib/armeabi-v7a/libssl.so differ diff --git a/MediaClient/MediaClientForMobile/lib/armeabi-v7a/libswresample.a b/MediaClient/MediaClientForMobile/lib/armeabi-v7a/libswresample.a new file mode 100644 index 0000000..63d2bf0 Binary files /dev/null and b/MediaClient/MediaClientForMobile/lib/armeabi-v7a/libswresample.a differ diff --git a/MediaClient/MediaClientForMobile/lib/armeabi-v7a/libswscale.a b/MediaClient/MediaClientForMobile/lib/armeabi-v7a/libswscale.a new file mode 100644 index 0000000..a4c8365 Binary files /dev/null and b/MediaClient/MediaClientForMobile/lib/armeabi-v7a/libswscale.a differ diff --git a/MediaClient/MediaClientForMobile/lib/armeabi-v7a/libx264.a b/MediaClient/MediaClientForMobile/lib/armeabi-v7a/libx264.a new file mode 100644 index 0000000..725e1c7 Binary files /dev/null and b/MediaClient/MediaClientForMobile/lib/armeabi-v7a/libx264.a differ diff --git a/MediaClient/MediaClientForMobile/lib/armeabi-v7a/libx265.a b/MediaClient/MediaClientForMobile/lib/armeabi-v7a/libx265.a new file mode 100644 index 0000000..4d14c72 Binary files /dev/null and b/MediaClient/MediaClientForMobile/lib/armeabi-v7a/libx265.a differ diff --git a/MediaClient/MediaClientForMobile/lib/ios-armv7/libavcodec.a b/MediaClient/MediaClientForMobile/lib/ios-armv7/libavcodec.a new file mode 100644 index 0000000..60ba72f Binary files /dev/null and b/MediaClient/MediaClientForMobile/lib/ios-armv7/libavcodec.a differ diff --git a/MediaClient/MediaClientForMobile/lib/ios-armv7/libavdevice.a b/MediaClient/MediaClientForMobile/lib/ios-armv7/libavdevice.a new file mode 100644 index 0000000..500740b Binary files /dev/null and b/MediaClient/MediaClientForMobile/lib/ios-armv7/libavdevice.a differ diff --git a/MediaClient/MediaClientForMobile/lib/ios-armv7/libavfilter.a b/MediaClient/MediaClientForMobile/lib/ios-armv7/libavfilter.a new file mode 100644 index 0000000..c5e2496 Binary files /dev/null and b/MediaClient/MediaClientForMobile/lib/ios-armv7/libavfilter.a differ diff --git a/MediaClient/MediaClientForMobile/lib/ios-armv7/libavformat.a b/MediaClient/MediaClientForMobile/lib/ios-armv7/libavformat.a new file mode 100644 index 0000000..a01f544 Binary files /dev/null and b/MediaClient/MediaClientForMobile/lib/ios-armv7/libavformat.a differ diff --git a/MediaClient/MediaClientForMobile/lib/ios-armv7/libavutil.a b/MediaClient/MediaClientForMobile/lib/ios-armv7/libavutil.a new file mode 100644 index 0000000..192f4be Binary files /dev/null and b/MediaClient/MediaClientForMobile/lib/ios-armv7/libavutil.a differ diff --git a/MediaClient/MediaClientForMobile/lib/ios-armv7/libcrypto.a b/MediaClient/MediaClientForMobile/lib/ios-armv7/libcrypto.a new file mode 100644 index 0000000..856ff34 Binary files /dev/null and b/MediaClient/MediaClientForMobile/lib/ios-armv7/libcrypto.a differ diff --git a/MediaClient/MediaClientForMobile/lib/ios-armv7/libpostproc.a b/MediaClient/MediaClientForMobile/lib/ios-armv7/libpostproc.a new file mode 100644 index 0000000..930f565 Binary files /dev/null and b/MediaClient/MediaClientForMobile/lib/ios-armv7/libpostproc.a differ diff --git a/MediaClient/MediaClientForMobile/lib/ios-armv7/libsrt.a b/MediaClient/MediaClientForMobile/lib/ios-armv7/libsrt.a new file mode 100644 index 0000000..3edd06d Binary files /dev/null and b/MediaClient/MediaClientForMobile/lib/ios-armv7/libsrt.a differ diff --git a/MediaClient/MediaClientForMobile/lib/ios-armv7/libssl.a b/MediaClient/MediaClientForMobile/lib/ios-armv7/libssl.a new file mode 100644 index 0000000..4304c26 Binary files /dev/null and b/MediaClient/MediaClientForMobile/lib/ios-armv7/libssl.a differ diff --git a/MediaClient/MediaClientForMobile/lib/ios-armv7/libswresample.a b/MediaClient/MediaClientForMobile/lib/ios-armv7/libswresample.a new file mode 100644 index 0000000..0942bd6 Binary files /dev/null and b/MediaClient/MediaClientForMobile/lib/ios-armv7/libswresample.a differ diff --git a/MediaClient/MediaClientForMobile/lib/ios-armv7/libswscale.a b/MediaClient/MediaClientForMobile/lib/ios-armv7/libswscale.a new file mode 100644 index 0000000..9bc4975 Binary files /dev/null and b/MediaClient/MediaClientForMobile/lib/ios-armv7/libswscale.a differ diff --git a/MediaClient/MediaClientForMobile/lib/ios-armv7/libx264.a b/MediaClient/MediaClientForMobile/lib/ios-armv7/libx264.a new file mode 100644 index 0000000..589df79 Binary files /dev/null and b/MediaClient/MediaClientForMobile/lib/ios-armv7/libx264.a differ diff --git a/MediaClient/MediaClientForMobile/lib/ios-armv7/libx265.a b/MediaClient/MediaClientForMobile/lib/ios-armv7/libx265.a new file mode 100644 index 0000000..97b6023 Binary files /dev/null and b/MediaClient/MediaClientForMobile/lib/ios-armv7/libx265.a differ diff --git a/MediaClient/MediaClientForMobile/lib/ios-armv8a/libavcodec.a b/MediaClient/MediaClientForMobile/lib/ios-armv8a/libavcodec.a new file mode 100644 index 0000000..8d3f310 Binary files /dev/null and b/MediaClient/MediaClientForMobile/lib/ios-armv8a/libavcodec.a differ diff --git a/MediaClient/MediaClientForMobile/lib/ios-armv8a/libavdevice.a b/MediaClient/MediaClientForMobile/lib/ios-armv8a/libavdevice.a new file mode 100644 index 0000000..c9626cc Binary files /dev/null and b/MediaClient/MediaClientForMobile/lib/ios-armv8a/libavdevice.a differ diff --git a/MediaClient/MediaClientForMobile/lib/ios-armv8a/libavfilter.a b/MediaClient/MediaClientForMobile/lib/ios-armv8a/libavfilter.a new file mode 100644 index 0000000..29c9d0e Binary files /dev/null and b/MediaClient/MediaClientForMobile/lib/ios-armv8a/libavfilter.a differ diff --git a/MediaClient/MediaClientForMobile/lib/ios-armv8a/libavformat.a b/MediaClient/MediaClientForMobile/lib/ios-armv8a/libavformat.a new file mode 100644 index 0000000..369fa02 Binary files /dev/null and b/MediaClient/MediaClientForMobile/lib/ios-armv8a/libavformat.a differ diff --git a/MediaClient/MediaClientForMobile/lib/ios-armv8a/libavutil.a b/MediaClient/MediaClientForMobile/lib/ios-armv8a/libavutil.a new file mode 100644 index 0000000..ea5ea58 Binary files /dev/null and b/MediaClient/MediaClientForMobile/lib/ios-armv8a/libavutil.a differ diff --git a/MediaClient/MediaClientForMobile/lib/ios-armv8a/libcrypto.a b/MediaClient/MediaClientForMobile/lib/ios-armv8a/libcrypto.a new file mode 100644 index 0000000..0f8ba59 Binary files /dev/null and b/MediaClient/MediaClientForMobile/lib/ios-armv8a/libcrypto.a differ diff --git a/MediaClient/MediaClientForMobile/lib/ios-armv8a/libpostproc.a b/MediaClient/MediaClientForMobile/lib/ios-armv8a/libpostproc.a new file mode 100644 index 0000000..260f060 Binary files /dev/null and b/MediaClient/MediaClientForMobile/lib/ios-armv8a/libpostproc.a differ diff --git a/MediaClient/MediaClientForMobile/lib/ios-armv8a/libsrt.a b/MediaClient/MediaClientForMobile/lib/ios-armv8a/libsrt.a new file mode 100644 index 0000000..76fc81c Binary files /dev/null and b/MediaClient/MediaClientForMobile/lib/ios-armv8a/libsrt.a differ diff --git a/MediaClient/MediaClientForMobile/lib/ios-armv8a/libssl.a b/MediaClient/MediaClientForMobile/lib/ios-armv8a/libssl.a new file mode 100644 index 0000000..7c078c1 Binary files /dev/null and b/MediaClient/MediaClientForMobile/lib/ios-armv8a/libssl.a differ diff --git a/MediaClient/MediaClientForMobile/lib/ios-armv8a/libswresample.a b/MediaClient/MediaClientForMobile/lib/ios-armv8a/libswresample.a new file mode 100644 index 0000000..83595a3 Binary files /dev/null and b/MediaClient/MediaClientForMobile/lib/ios-armv8a/libswresample.a differ diff --git a/MediaClient/MediaClientForMobile/lib/ios-armv8a/libswscale.a b/MediaClient/MediaClientForMobile/lib/ios-armv8a/libswscale.a new file mode 100644 index 0000000..039f531 Binary files /dev/null and b/MediaClient/MediaClientForMobile/lib/ios-armv8a/libswscale.a differ diff --git a/MediaClient/MediaClientForMobile/lib/ios-armv8a/libx264.a b/MediaClient/MediaClientForMobile/lib/ios-armv8a/libx264.a new file mode 100644 index 0000000..65be3c5 Binary files /dev/null and b/MediaClient/MediaClientForMobile/lib/ios-armv8a/libx264.a differ diff --git a/MediaClient/MediaClientForMobile/lib/ios-armv8a/libx265.a b/MediaClient/MediaClientForMobile/lib/ios-armv8a/libx265.a new file mode 100644 index 0000000..5ab1841 Binary files /dev/null and b/MediaClient/MediaClientForMobile/lib/ios-armv8a/libx265.a differ diff --git a/MediaClient/MediaClientForMobile/main.cpp b/MediaClient/MediaClientForMobile/main.cpp new file mode 100644 index 0000000..bf8ea92 --- /dev/null +++ b/MediaClient/MediaClientForMobile/main.cpp @@ -0,0 +1,110 @@ +/*************************************************************************************** + * + * 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 "MediaClient.h" +#include "rtsp_cln.h" +#include "http.h" +#include "http_parse.h" +#include "utils.h" +#include "VideoWidget.h" +#include +#include +#include +#include +#if defined(ANDROID) +#include +extern "C" { +#include +} +#endif + +/**************************************************************************************/ + +static void av_log_callback(void* ptr, int level, const char* fmt, va_list vl) +{ + int htlv = HT_LOG_INFO; + char buff[4096]; + + if (av_log_get_level() < level) + { + return; + } + + vsnprintf(buff, sizeof(buff), fmt, vl); + + if (AV_LOG_TRACE == level || AV_LOG_VERBOSE == level) + { + htlv = HT_LOG_TRC; + } + else if (AV_LOG_DEBUG == level) + { + htlv = HT_LOG_DBG; + } + else if (AV_LOG_INFO == level) + { + htlv = HT_LOG_INFO; + } + else if (AV_LOG_WARNING == level) + { + htlv = HT_LOG_WARN; + } + else if (AV_LOG_ERROR == level) + { + htlv = HT_LOG_ERR; + } + else if (AV_LOG_FATAL == level || AV_LOG_PANIC == level) + { + htlv = HT_LOG_FATAL; + } + + log_print(htlv, "%s", buff); +} + +int main(int argc, char *argv[]) +{ + QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); + + QApplication a(argc, argv); + + QCoreApplication::setApplicationName("MediaClient"); + QCoreApplication::setOrganizationName("happytimesoft"); + + signal(SIGPIPE, SIG_IGN); + + av_log_set_callback(av_log_callback); + av_log_set_level(AV_LOG_QUIET); + +#if defined(ANDROID) + av_jni_set_java_vm(QJniEnvironment::javaVM(), NULL); +#endif + + sys_buf_init(100); + rtsp_parse_buf_init(100); + http_msg_buf_init(16); + + MediaClient w; + + w.showMaximized(); + + return a.exec(); +} + + + diff --git a/MediaClient/MediaClientForMobile/media/audio_capture.cpp b/MediaClient/MediaClientForMobile/media/audio_capture.cpp new file mode 100644 index 0000000..44e464a --- /dev/null +++ b/MediaClient/MediaClientForMobile/media/audio_capture.cpp @@ -0,0 +1,119 @@ +/*************************************************************************************** + * + * 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 "audio_capture.h" +#include "lock.h" + +/***************************************************************************************/ + +CAudioCapture * CAudioCapture::m_pInstance[] = {NULL, NULL, NULL, NULL}; +void * CAudioCapture::m_pInstMutex = sys_os_create_mutex(); + +/***************************************************************************************/ + +CAudioCapture::CAudioCapture() +{ + m_nDevIndex = 0; + m_nRefCnt = 0; + + m_nChannels = 2; + m_nSampleRate = 8000; + m_nBitrate = 0; + m_nSampleSize = 16; + + m_pMutex = sys_os_create_mutex(); + m_bInited = FALSE; + m_bCapture = FALSE; + m_hCapture = 0; +} + +CAudioCapture::~CAudioCapture() +{ + sys_os_destroy_sig_mutex(m_pMutex); +} + +CAudioCapture * CAudioCapture::getInstance(int devid) +{ + return NULL; +} + +void CAudioCapture::freeInstance(int devid) +{ + if (devid < 0 || devid >= MAX_AUDIO_DEV_NUMS) + { + return; + } + + if (m_pInstance[devid]) + { + sys_os_mutex_enter(m_pInstMutex); + + if (m_pInstance[devid]) + { + m_pInstance[devid]->m_nRefCnt--; + + if (m_pInstance[devid]->m_nRefCnt <= 0) + { + delete m_pInstance[devid]; + m_pInstance[devid] = NULL; + } + } + + sys_os_mutex_leave(m_pInstMutex); + } +} + +char * CAudioCapture::getAuxSDPLine(int rtp_pt) +{ + return m_encoder.getAuxSDPLine(rtp_pt); +} + +int CAudioCapture::getDeviceNums() +{ + return 0; +} + +BOOL CAudioCapture::initCapture(int codec, int samplerate, int channels, int bitrate) +{ + return FALSE; +} + +BOOL CAudioCapture::startCapture() +{ + return FALSE; +} + +void CAudioCapture::stopCapture(void) +{ + +} + +void CAudioCapture::addCallback(AudioDataCallback pCallback, void * pUserdata) +{ + m_encoder.addCallback(pCallback, pUserdata); +} + +void CAudioCapture::delCallback(AudioDataCallback pCallback, void * pUserdata) +{ + m_encoder.delCallback(pCallback, pUserdata); +} + + + diff --git a/MediaClient/MediaClientForMobile/media/audio_capture.h b/MediaClient/MediaClientForMobile/media/audio_capture.h new file mode 100644 index 0000000..abaf9c2 --- /dev/null +++ b/MediaClient/MediaClientForMobile/media/audio_capture.h @@ -0,0 +1,87 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef _AUDIO_CAPTURE_H +#define _AUDIO_CAPTURE_H + +/***************************************************************************************/ + +#include "audio_encoder.h" + +/***************************************************************************************/ + +#define MAX_AUDIO_DEV_NUMS 8 +#define DEF_AUDIO_CAP_DEV (MAX_AUDIO_DEV_NUMS-1) + +/***************************************************************************************/ + +class CAudioCapture +{ +public: + virtual ~CAudioCapture(); + + // get audio capture devcie nubmers + static int getDeviceNums(); + + // get single instance + static CAudioCapture * getInstance(int devid); + // free instance + virtual void freeInstance(int devid); + + virtual BOOL initCapture(int codec, int sampleRate, int channels, int bitrate); + virtual BOOL startCapture(); + + virtual char * getAuxSDPLine(int rtp_pt); + + virtual void addCallback(AudioDataCallback pCallback, void * pUserdata); + virtual void delCallback(AudioDataCallback pCallback, void * pUserdata); + + virtual BOOL isCapturing() {return m_bCapture;} + +protected: + CAudioCapture(); + CAudioCapture(CAudioCapture &obj); + + virtual void stopCapture(); + +public: + int m_nDevIndex; + int m_nRefCnt; // single instance ref count + + static void * m_pInstMutex; // instance mutex + static CAudioCapture * m_pInstance[MAX_AUDIO_DEV_NUMS]; + +protected: + int m_nChannels; // channel number + int m_nSampleRate; // sample rate + int m_nBitrate; // bitrate + int m_nSampleSize; // sample size + + CAudioEncoder m_encoder; // audio encoder + + void * m_pMutex; // mutex + BOOL m_bInited; // inited flag + BOOL m_bCapture; // capturing flag + pthread_t m_hCapture; // capture thread handler +}; + + +#endif + + diff --git a/MediaClient/MediaClientForMobile/media/audio_capture_android.cpp b/MediaClient/MediaClientForMobile/media/audio_capture_android.cpp new file mode 100644 index 0000000..c41f78f --- /dev/null +++ b/MediaClient/MediaClientForMobile/media/audio_capture_android.cpp @@ -0,0 +1,176 @@ +/*************************************************************************************** + * + * 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 "lock.h" +#include "audio_capture_android.h" + + +void dataCallback(uint8 * pdata, int len, void * puser) +{ + CAAudioCapture * pthis = (CAAudioCapture *) puser; + + pthis->dataCallback(pdata, len); +} + +CAAudioCapture::CAAudioCapture() +: CAudioCapture() +, m_pInput(0) +{ +} + +CAAudioCapture::~CAAudioCapture() +{ + stopCapture(); +} + +CAudioCapture * CAAudioCapture::getInstance(int devid) +{ + if (devid < 0 || devid >= MAX_AUDIO_DEV_NUMS) + { + return NULL; + } + + sys_os_mutex_enter(m_pInstMutex); + + if (NULL == m_pInstance[devid]) + { + m_pInstance[devid] = new CAAudioCapture; + if (m_pInstance[devid]) + { + m_pInstance[devid]->m_nRefCnt++; + m_pInstance[devid]->m_nDevIndex = devid; + } + } + else + { + m_pInstance[devid]->m_nRefCnt++; + } + + sys_os_mutex_leave(m_pInstMutex); + + return m_pInstance[devid]; +} + +int CAAudioCapture::getDeviceNums() +{ + return 1; +} + +void CAAudioCapture::listDevice() +{ +} + +int CAAudioCapture::getDeviceIndex(const char * name) +{ + return 0; +} + +BOOL CAAudioCapture::getDeviceName(int index, char * name, int namesize) +{ + strncpy(name, "Default", namesize); + + return TRUE; +} + +BOOL CAAudioCapture::initCapture(int codec, int samplerate, int channels, int bitrate) +{ + CLock lock(m_pMutex); + + if (m_bInited) + { + return TRUE; + } + + m_nChannels = channels; + m_nSampleRate = samplerate; + m_nBitrate = bitrate; + + AudioEncoderParam params; + memset(¶ms, 0, sizeof(params)); + + params.SrcChannels = 2; + params.SrcSamplefmt = AV_SAMPLE_FMT_S16; + params.SrcSamplerate = samplerate; + params.DstChannels = channels; + params.DstSamplefmt = AV_SAMPLE_FMT_S16; + params.DstSamplerate = samplerate; + params.DstBitrate = bitrate; + params.DstCodec = codec; + + if (m_encoder.init(¶ms) == FALSE) + { + return FALSE; + } + + m_bInited = TRUE; + + return TRUE; +} + +BOOL CAAudioCapture::startCapture() +{ + CLock lock(m_pMutex); + + if (!m_bInited) + { + return FALSE; + } + + if (m_pInput) + { + return TRUE; + } + + m_pInput = new GlesInput(); + if (NULL == m_pInput) + { + return FALSE; + } + + m_pInput->setCallback(::dataCallback, this); + if (!m_pInput->start(m_nSampleRate)) + { + log_print(HT_LOG_ERR, "%s, start audio recoding failed\r\n", __FUNCTION__); + return FALSE; + } + + return TRUE; +} + +void CAAudioCapture::stopCapture(void) +{ + CLock lock(m_pMutex); + + if (m_pInput) + { + delete m_pInput; + m_pInput = NULL; + } + + m_bInited = FALSE; +} + +void CAAudioCapture::dataCallback(uint8 * pdata, int len) +{ + m_encoder.encode(pdata, len); +} + + + diff --git a/MediaClient/MediaClientForMobile/media/audio_capture_android.h b/MediaClient/MediaClientForMobile/media/audio_capture_android.h new file mode 100644 index 0000000..33e776e --- /dev/null +++ b/MediaClient/MediaClientForMobile/media/audio_capture_android.h @@ -0,0 +1,61 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef AUDIO_CAPTURE_ANDROID_H +#define AUDIO_CAPTURE_ANDROID_H + +#include "sys_inc.h" +#include "audio_capture.h" +#include "gles_input.h" + + +class CAAudioCapture : public CAudioCapture +{ +public: + + // get audio capture devcie nubmers + static int getDeviceNums(); + // list avaivalbe video capture device + static void listDevice(); + // get device index by device name + static int getDeviceIndex(const char * name); + // get device name by device index + static BOOL getDeviceName(int index, char * name, int namesize); + + // get single instance + static CAudioCapture * getInstance(int devid); + + BOOL initCapture(int codec, int sampleRate, int channels, int bitrate); + BOOL startCapture(); + + void dataCallback(uint8 * pdata, int len); + +private: + CAAudioCapture(); + CAAudioCapture(CAAudioCapture &obj); + ~CAAudioCapture(); + + void stopCapture(); + +private: + GlesInput * m_pInput; +}; + +#endif + diff --git a/MediaClient/MediaClientForMobile/media/audio_decoder.cpp b/MediaClient/MediaClientForMobile/media/audio_decoder.cpp new file mode 100644 index 0000000..816f406 --- /dev/null +++ b/MediaClient/MediaClientForMobile/media/audio_decoder.cpp @@ -0,0 +1,249 @@ +/*************************************************************************************** + * + * 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 "audio_decoder.h" +#include "avcodec_mutex.h" +#include "media_codec.h" + +CAudioDecoder::CAudioDecoder() +{ + m_bInited = FALSE; + m_nSamplerate = 0; + m_nChannels = 0; + + m_pCodec = NULL; + m_pContext = NULL; + m_pFrame = NULL; + m_pResampleFrame = NULL; + m_pSwrCtx = NULL; + m_nDstFormat = AV_SAMPLE_FMT_S16; + + m_pCallback = NULL; + m_pUserdata = NULL; +} + +CAudioDecoder::~CAudioDecoder() +{ + uninit(); +} + +BOOL CAudioDecoder::init(enum AVCodecID codec, int samplerate, int channels, int bitpersample) +{ + m_pCodec = avcodec_find_decoder(codec); + if (m_pCodec == NULL) + { + log_print(HT_LOG_ERR, "%s, m_pCodec is NULL\r\n", __FUNCTION__); + return FALSE; + } + + m_pContext = avcodec_alloc_context3(m_pCodec); + if (NULL == m_pContext) + { + log_print(HT_LOG_ERR, "%s, avcodec_alloc_context3 failed\r\n", __FUNCTION__); + return FALSE; + } + + m_pContext->sample_rate = samplerate; + m_pContext->channels = channels; + m_pContext->channel_layout = av_get_default_channel_layout(channels); + + if (AV_CODEC_ID_ADPCM_G726 == codec) + { + if (0 == bitpersample) + { + bitpersample = 2; + } + + m_pContext->bits_per_coded_sample = bitpersample; + m_pContext->bit_rate = bitpersample * 8000; + } + + if (avcodec_thread_open(m_pContext, m_pCodec, NULL) < 0) + { + log_print(HT_LOG_ERR, "%s, avcodec_thread_open failed\r\n", __FUNCTION__); + return FALSE; + } + + if (m_pContext->sample_fmt != m_nDstFormat) + { + m_pSwrCtx = swr_alloc_set_opts(NULL, + av_get_default_channel_layout(channels), m_nDstFormat, samplerate, + av_get_default_channel_layout(channels), m_pContext->sample_fmt, samplerate, 0, NULL); + + swr_init(m_pSwrCtx); + } + + m_pFrame = av_frame_alloc(); + if (NULL == m_pFrame) + { + log_print(HT_LOG_ERR, "%s, av_frame_alloc failed\r\n", __FUNCTION__); + return FALSE; + } + + m_nSamplerate = samplerate; + m_nChannels = channels; + + m_bInited = TRUE; + + return TRUE; +} + +BOOL CAudioDecoder::init(int codec, int samplerate, int channels, int bitpersample) +{ + return init(to_audio_avcodecid(codec), samplerate, channels, bitpersample); +} + +BOOL CAudioDecoder::decode(uint8 * data, int len, int64_t pts) +{ + AVPacket packet; + + av_init_packet(&packet); + + packet.data = data; + packet.size = len; + packet.pts = packet.dts = pts; + + return decode(&packet); +} + +BOOL CAudioDecoder::decode(AVPacket *pkt) +{ + int ret; + + if (!m_bInited) + { + return FALSE; + } + + /* send the packet with the compressed data to the decoder */ + ret = avcodec_send_packet(m_pContext, pkt); + if (ret < 0) + { + log_print(HT_LOG_ERR, "%s, error submitting the packet to the decoder\r\n", __FUNCTION__); + return FALSE; + } + + /* read all the output frames (in general there may be any number of them */ + while (ret >= 0) + { + ret = avcodec_receive_frame(m_pContext, m_pFrame); + if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) + { + return TRUE; + } + else if (ret < 0) + { + log_print(HT_LOG_ERR, "%s, error during decoding\r\n", __FUNCTION__); + return FALSE; + } + + render(m_pFrame); + + av_frame_unref(m_pFrame); + } + + return TRUE; +} + +void CAudioDecoder::flush() +{ + if (NULL == m_pContext || + NULL == m_pContext->codec || + !(m_pContext->codec->capabilities | AV_CODEC_CAP_DELAY)) + { + return; + } + + decode(NULL); +} + +void CAudioDecoder::uninit() +{ + flush(); + + if (m_pContext) + { + avcodec_thread_close(m_pContext); + avcodec_free_context(&m_pContext); + } + + if (m_pFrame) + { + av_frame_free(&m_pFrame); + } + + if (m_pResampleFrame) + { + av_frame_free(&m_pResampleFrame); + } + + if (m_pSwrCtx) + { + swr_free(&m_pSwrCtx); + } + + m_bInited = FALSE; +} + +void CAudioDecoder::render(AVFrame * frame) +{ + if (NULL == frame) + { + return; + } + + if (m_pSwrCtx) + { + if (NULL == m_pResampleFrame) + { + m_pResampleFrame = av_frame_alloc(); + if (NULL == m_pResampleFrame) + { + return; + } + } + + m_pResampleFrame->sample_rate = m_nSamplerate; + m_pResampleFrame->format = m_nDstFormat; + m_pResampleFrame->channels = m_nChannels; + m_pResampleFrame->channel_layout = av_get_default_channel_layout(m_nChannels); + + int swrret = swr_convert_frame(m_pSwrCtx, m_pResampleFrame, frame); + if (swrret == 0) + { + if (m_pCallback) + { + m_pResampleFrame->pts = frame->pts; + m_pResampleFrame->pkt_dts = frame->pkt_dts; + + m_pCallback(m_pResampleFrame, m_pUserdata); + } + } + + av_frame_unref(m_pResampleFrame); + } + else if (m_pCallback) + { + m_pCallback(frame, m_pUserdata); + } +} + + + diff --git a/MediaClient/MediaClientForMobile/media/audio_decoder.h b/MediaClient/MediaClientForMobile/media/audio_decoder.h new file mode 100644 index 0000000..1093a62 --- /dev/null +++ b/MediaClient/MediaClientForMobile/media/audio_decoder.h @@ -0,0 +1,73 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef AUDIO_DECODER_H +#define AUDIO_DECODER_H + +#include "sys_inc.h" +#include "media_format.h" + +extern "C" +{ +#include "libavcodec/avcodec.h" +#include "libavutil/avutil.h" +#include "libswscale/swscale.h" +#include "libavformat/avformat.h" +#include +} + +typedef void (*ADCB)(AVFrame * frame, void * userdata); + +class CAudioDecoder +{ +public: + CAudioDecoder(); + ~CAudioDecoder(); + + BOOL init(int codec, int samplerate, int channels, int bitpersample = 0); + BOOL init(enum AVCodecID codec, int samplerate, int channels, int bitpersample = 0); + void uninit(); + + BOOL decode(uint8 * data, int len, int64_t pts = AV_NOPTS_VALUE); + BOOL decode(AVPacket *pkt); + void setCallback(ADCB pCallback, void * pUserdata) {m_pCallback = pCallback; m_pUserdata = pUserdata;} + +private: + void flush(); + void render(AVFrame * frame); + +private: + BOOL m_bInited; + int m_nSamplerate; + int m_nChannels; + + AVCodec * m_pCodec; + AVCodecContext* m_pContext; + AVFrame * m_pFrame; + AVFrame * m_pResampleFrame; + SwrContext * m_pSwrCtx; + AVSampleFormat m_nDstFormat; + + ADCB m_pCallback; + void * m_pUserdata; +}; + +#endif + + diff --git a/MediaClient/MediaClientForMobile/media/audio_encoder.cpp b/MediaClient/MediaClientForMobile/media/audio_encoder.cpp new file mode 100644 index 0000000..d7748f6 --- /dev/null +++ b/MediaClient/MediaClientForMobile/media/audio_encoder.cpp @@ -0,0 +1,577 @@ +/*************************************************************************************** + * + * 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 "audio_encoder.h" +#include "media_format.h" +#include "avcodec_mutex.h" +#include "media_codec.h" + +CAudioEncoder::CAudioEncoder() +{ + m_nCodecId = AV_CODEC_ID_NONE; + m_bInited = FALSE; + + memset(&m_EncoderParams, 0, sizeof(AudioEncoderParam)); + + m_pCodecCtx = NULL; + m_pFrame = NULL; + m_pResampleFrame = NULL; + m_pSwrCtx = NULL; + m_pPkt = NULL; + + memset(&m_AudioBuffer, 0, sizeof(AudioBuffer)); + + m_pCallbackMutex = sys_os_create_mutex(); + m_pCallbackList = h_list_create(FALSE); +} + +CAudioEncoder::~CAudioEncoder() +{ + uninit(); + + h_list_free_container(m_pCallbackList); + + sys_os_destroy_sig_mutex(m_pCallbackMutex); +} + +int CAudioEncoder::computeBitrate(AVCodecID codec, int samplerate, int channels, int quality) +{ + int bitrate; + + if (m_nCodecId == AV_CODEC_ID_ADPCM_G726) + { + bitrate = 16000; // G726 16kbit/s + } + else if (m_nCodecId == AV_CODEC_ID_ADPCM_G722) + { + bitrate = 64000; // G722 64kbit/s + } + else if (m_nCodecId == AV_CODEC_ID_PCM_ALAW || m_nCodecId == AV_CODEC_ID_PCM_MULAW) + { + bitrate = samplerate * channels * 8; + } + else if (m_nCodecId == AV_CODEC_ID_AAC) + { + bitrate = samplerate * channels * 16 / 7; + } + else + { + bitrate = samplerate * channels; + } + + return bitrate; +} + +BOOL CAudioEncoder::init(AudioEncoderParam * params) +{ + memcpy(&m_EncoderParams, params, sizeof(AudioEncoderParam)); + + m_nCodecId = to_audio_avcodecid(params->DstCodec); + + if (AV_CODEC_ID_AAC == m_nCodecId) + { + // the ffmepg AAC encoder only support AV_SAMPLE_FMT_FLTP + m_EncoderParams.DstSamplefmt = AV_SAMPLE_FMT_FLTP; + } + + AVCodec * pCodec = avcodec_find_encoder(m_nCodecId); + if (pCodec == NULL) + { + log_print(HT_LOG_ERR, "avcodec_find_encoder failed, %d\r\n", m_nCodecId); + return FALSE; + } + + m_pCodecCtx = avcodec_alloc_context3(pCodec); + if (m_pCodecCtx == NULL) + { + log_print(HT_LOG_ERR, "avcodec_alloc_context3 failed\r\n"); + return FALSE; + } + + m_pCodecCtx->codec_id = m_nCodecId; + m_pCodecCtx->codec_type = AVMEDIA_TYPE_AUDIO; + m_pCodecCtx->qblur = 0.5f; + m_pCodecCtx->time_base.num = 1; + m_pCodecCtx->time_base.den = m_EncoderParams.DstSamplerate; + m_pCodecCtx->sample_rate = m_EncoderParams.DstSamplerate; + m_pCodecCtx->channels = m_EncoderParams.DstChannels; + m_pCodecCtx->channel_layout = av_get_default_channel_layout(m_EncoderParams.DstChannels); + m_pCodecCtx->sample_fmt = m_EncoderParams.DstSamplefmt; + + if (m_EncoderParams.DstBitrate > 0) + { + m_pCodecCtx->bit_rate = m_EncoderParams.DstBitrate * 1000; + } + else + { + m_pCodecCtx->bit_rate = computeBitrate(m_nCodecId, m_EncoderParams.DstSamplerate, m_EncoderParams.DstChannels, 80); + } + + m_pCodecCtx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER; + + av_opt_set(m_pCodecCtx->priv_data, "preset", "superfast", 0); + av_opt_set(m_pCodecCtx->priv_data, "tune", "zerolatency", 0); + + if (AV_CODEC_ID_AAC == m_nCodecId) + { + m_pCodecCtx->profile = FF_PROFILE_AAC_LOW; // AAC -LC + } + else if (AV_CODEC_ID_ADPCM_G726 == m_nCodecId) + { + m_pCodecCtx->bits_per_coded_sample = m_pCodecCtx->bit_rate / 8000; + m_pCodecCtx->bit_rate = m_pCodecCtx->bits_per_coded_sample * 8000; + } + + if (avcodec_thread_open(m_pCodecCtx, pCodec, NULL) < 0) + { + log_print(HT_LOG_ERR, "avcodec_thread_open failed, audio encoder\r\n"); + return FALSE; + } + + m_pFrame = av_frame_alloc(); + if (NULL == m_pFrame) + { + return FALSE; + } + + if (m_EncoderParams.SrcSamplerate != m_EncoderParams.DstSamplerate || + m_EncoderParams.SrcChannels != m_EncoderParams.DstChannels || + m_EncoderParams.SrcSamplefmt != m_EncoderParams.DstSamplefmt) + { + m_pSwrCtx = swr_alloc_set_opts(NULL, + av_get_default_channel_layout(m_EncoderParams.DstChannels), m_EncoderParams.DstSamplefmt, m_EncoderParams.DstSamplerate, + av_get_default_channel_layout(m_EncoderParams.SrcChannels), m_EncoderParams.SrcSamplefmt, m_EncoderParams.SrcSamplerate, 0, NULL); + + swr_init(m_pSwrCtx); + } + + if (m_pCodecCtx->frame_size == 0) + { + m_pCodecCtx->frame_size = 1024; + } + + m_AudioBuffer.tlen = 64 * m_pCodecCtx->frame_size * m_EncoderParams.DstChannels * av_get_bytes_per_sample(m_EncoderParams.DstSamplefmt); + m_AudioBuffer.data[0] = (uint8 *)av_malloc(m_AudioBuffer.tlen); + m_AudioBuffer.data[1] = (uint8 *)av_malloc(m_AudioBuffer.tlen); + m_AudioBuffer.size[0] = 0; + m_AudioBuffer.size[1] = 0; + m_AudioBuffer.samples = 0; + + /* packet for holding encoded output */ + m_pPkt = av_packet_alloc(); + if (!m_pPkt) + { + log_print(HT_LOG_ERR, "could not allocate the packet\r\n"); + return FALSE; + } + + m_bInited = TRUE; + + return TRUE; +} + +void CAudioEncoder::uninit() +{ + flush(); + + if (m_pCodecCtx) + { + avcodec_thread_close(m_pCodecCtx); + avcodec_free_context(&m_pCodecCtx); + } + + if (m_pFrame) + { + av_frame_free(&m_pFrame); + } + + if (m_pResampleFrame) + { + av_frame_free(&m_pResampleFrame); + } + + if (m_pSwrCtx) + { + swr_free(&m_pSwrCtx); + } + + if (m_pPkt) + { + av_packet_free(&m_pPkt); + } + + if (m_AudioBuffer.data[0]) + { + av_freep(&m_AudioBuffer.data[0]); + } + + if (m_AudioBuffer.data[1]) + { + av_freep(&m_AudioBuffer.data[1]); + } + + m_bInited = FALSE; +} + +BOOL CAudioEncoder::bufferFrame(AVFrame * pFrame) +{ + BOOL ret = TRUE; + int samplesize = av_get_bytes_per_sample((AVSampleFormat)pFrame->format); + + int size = pFrame->nb_samples * samplesize; + + assert(m_AudioBuffer.size[0] + size <= m_AudioBuffer.tlen); + + if (av_sample_fmt_is_planar((AVSampleFormat)pFrame->format) && m_EncoderParams.DstChannels > 1) + { + memcpy(m_AudioBuffer.data[0]+m_AudioBuffer.size[0], pFrame->data[0], size); + m_AudioBuffer.size[0] += size; + + memcpy(m_AudioBuffer.data[1]+m_AudioBuffer.size[1], pFrame->data[1], size); + m_AudioBuffer.size[1] += size; + } + else + { + memcpy(m_AudioBuffer.data[0]+m_AudioBuffer.size[0], pFrame->data[0], size * m_EncoderParams.DstChannels); + m_AudioBuffer.size[0] += size * m_EncoderParams.DstChannels; + } + + m_AudioBuffer.samples += pFrame->nb_samples; + + while (m_AudioBuffer.samples >= m_pCodecCtx->frame_size) + { + int linesize; + + if (av_sample_fmt_is_planar((AVSampleFormat)pFrame->format) && m_EncoderParams.DstChannels > 1) + { + linesize = samplesize * m_pCodecCtx->frame_size; + } + else + { + linesize = samplesize * m_pCodecCtx->frame_size * m_EncoderParams.DstChannels; + } + + m_pFrame->data[0] = m_AudioBuffer.data[0]; + m_pFrame->data[1] = m_AudioBuffer.data[1]; + m_pFrame->linesize[0] = linesize; + m_pFrame->linesize[1] = linesize; + m_pFrame->nb_samples = m_pCodecCtx->frame_size; + m_pFrame->format = m_EncoderParams.DstSamplefmt; + m_pFrame->key_frame = 1; + m_pFrame->sample_rate = m_EncoderParams.DstSamplerate; + m_pFrame->channels = m_EncoderParams.DstChannels; + m_pFrame->channel_layout = av_get_default_channel_layout(m_EncoderParams.DstChannels); + + ret = encodeInternal(m_pFrame); + + m_AudioBuffer.size[0] -= linesize; + + if (m_AudioBuffer.size[0] > 0) + { + memmove(m_AudioBuffer.data[0], m_AudioBuffer.data[0]+linesize, m_AudioBuffer.size[0]); + } + + if (av_sample_fmt_is_planar((AVSampleFormat)pFrame->format) && m_EncoderParams.DstChannels > 1) + { + m_AudioBuffer.size[1] -= linesize; + + if (m_AudioBuffer.size[1] > 0) + { + memmove(m_AudioBuffer.data[1], m_AudioBuffer.data[1]+linesize, m_AudioBuffer.size[1]); + } + } + + m_AudioBuffer.samples -= m_pCodecCtx->frame_size; + } + + return ret; +} + +void CAudioEncoder::flush() +{ + if (NULL == m_pCodecCtx || + NULL == m_pCodecCtx->codec || + !(m_pCodecCtx->codec->capabilities | AV_CODEC_CAP_DELAY)) + { + return; + } + + encodeInternal(NULL); +} + +BOOL CAudioEncoder::encodeInternal(AVFrame * pFrame) +{ + int ret; + + /* send the frame for encoding */ + ret = avcodec_send_frame(m_pCodecCtx, pFrame); + if (ret < 0) + { + log_print(HT_LOG_ERR, "error sending the frame to the encoder\r\n"); + return FALSE; + } + + /* read all the available output packets (in general there may be any + * number of them */ + while (ret >= 0) + { + ret = avcodec_receive_packet(m_pCodecCtx, m_pPkt); + if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) + { + return TRUE; + } + else if (ret < 0) + { + log_print(HT_LOG_ERR, "error encoding audio frame\r\n"); + return FALSE; + } + + if (m_pPkt->data && m_pPkt->size > 0) + { + procData(m_pPkt->data, m_pPkt->size, pFrame ? pFrame->nb_samples : 0); + } + else + { + log_print(HT_LOG_WARN, "%s, data is null\r\n", __FUNCTION__); + } + + av_packet_unref(m_pPkt); + } + + return TRUE; +} + +BOOL CAudioEncoder::encode(uint8 * data, int size) +{ + if (!m_bInited) + { + return FALSE; + } + + m_pFrame->data[0] = data; + m_pFrame->linesize[0] = size; + m_pFrame->nb_samples = size / (m_EncoderParams.SrcChannels * av_get_bytes_per_sample(m_EncoderParams.SrcSamplefmt)); + m_pFrame->format = m_EncoderParams.SrcSamplefmt; + m_pFrame->key_frame = 1; + m_pFrame->sample_rate = m_EncoderParams.SrcSamplerate; + m_pFrame->channels = m_EncoderParams.SrcChannels; + m_pFrame->channel_layout = av_get_default_channel_layout(m_EncoderParams.SrcChannels); + + return encode(m_pFrame); +} + +BOOL CAudioEncoder::encode(AVFrame * pFrame) +{ + BOOL ret = TRUE; + + if (!m_bInited) + { + return FALSE; + } + + if (m_pSwrCtx) + { + if (NULL == m_pResampleFrame) + { + m_pResampleFrame = av_frame_alloc(); + if (NULL == m_pResampleFrame) + { + return FALSE; + } + } + + m_pResampleFrame->sample_rate = m_EncoderParams.DstSamplerate; + m_pResampleFrame->format = m_EncoderParams.DstSamplefmt; + m_pResampleFrame->channels = m_EncoderParams.DstChannels; + m_pResampleFrame->channel_layout = av_get_default_channel_layout(m_EncoderParams.DstChannels); + + int swrret = swr_convert_frame(m_pSwrCtx, m_pResampleFrame, pFrame); + if (swrret == 0) + { + ret = bufferFrame(m_pResampleFrame); + } + else + { + ret = FALSE; + } + + av_frame_unref(m_pResampleFrame); + } + else + { + ret = bufferFrame(pFrame); + } + + return ret; +} + +void CAudioEncoder::procData(uint8 * data, int size, int nbsamples) +{ + AudioEncoderCB * p_cb = NULL; + LINKED_NODE * p_node = NULL; + + sys_os_mutex_enter(m_pCallbackMutex); + + p_node = h_list_lookup_start(m_pCallbackList); + while (p_node) + { + p_cb = (AudioEncoderCB *) p_node->p_data; + if (p_cb->pCallback != NULL) + { + p_cb->pCallback(data, size, nbsamples, p_cb->pUserdata); + } + + p_node = h_list_lookup_next(m_pCallbackList, p_node); + } + h_list_lookup_end(m_pCallbackList); + + sys_os_mutex_leave(m_pCallbackMutex); +} + +BOOL CAudioEncoder::isCallbackExist(AudioDataCallback pCallback, void *pUserdata) +{ + BOOL exist = FALSE; + AudioEncoderCB * p_cb = NULL; + LINKED_NODE * p_node = NULL; + + sys_os_mutex_enter(m_pCallbackMutex); + + p_node = h_list_lookup_start(m_pCallbackList); + while (p_node) + { + p_cb = (AudioEncoderCB *) p_node->p_data; + if (p_cb->pCallback == pCallback && p_cb->pUserdata == pUserdata) + { + exist = TRUE; + break; + } + + p_node = h_list_lookup_next(m_pCallbackList, p_node); + } + h_list_lookup_end(m_pCallbackList); + + sys_os_mutex_leave(m_pCallbackMutex); + + return exist; +} + +void CAudioEncoder::addCallback(AudioDataCallback pCallback, void *pUserdata) +{ + if (isCallbackExist(pCallback, pUserdata)) + { + return; + } + + AudioEncoderCB * p_cb = (AudioEncoderCB *) malloc(sizeof(AudioEncoderCB)); + if (NULL == p_cb) + { + return; + } + + p_cb->pCallback = pCallback; + p_cb->pUserdata = pUserdata; + p_cb->bFirst = TRUE; + + sys_os_mutex_enter(m_pCallbackMutex); + h_list_add_at_back(m_pCallbackList, p_cb); + sys_os_mutex_leave(m_pCallbackMutex); +} + +void CAudioEncoder::delCallback(AudioDataCallback pCallback, void *pUserdata) +{ + AudioEncoderCB * p_cb = NULL; + LINKED_NODE * p_node = NULL; + + sys_os_mutex_enter(m_pCallbackMutex); + + p_node = h_list_lookup_start(m_pCallbackList); + while (p_node) + { + p_cb = (AudioEncoderCB *) p_node->p_data; + if (p_cb->pCallback == pCallback && p_cb->pUserdata == pUserdata) + { + free(p_cb); + + h_list_remove(m_pCallbackList, p_node); + break; + } + + p_node = h_list_lookup_next(m_pCallbackList, p_node); + } + h_list_lookup_end(m_pCallbackList); + + sys_os_mutex_leave(m_pCallbackMutex); +} + +char * CAudioEncoder::getAACAuxSDPLine(int rtp_pt) +{ + if (NULL == m_pCodecCtx || m_pCodecCtx->extradata_size == 0) + { + return NULL; + } + + char const* fmtpFmt = + "a=fmtp:%d " + "streamtype=5;profile-level-id=1;" + "mode=AAC-hbr;sizelength=13;indexlength=3;indexdeltalength=3;" + "config="; + uint32 fmtpFmtSize = strlen(fmtpFmt) + + 3 /* max char len */ + + 2*m_pCodecCtx->extradata_size; /* 2*, because each byte prints as 2 chars */ + + char* fmtp = new char[fmtpFmtSize+1]; + memset(fmtp, 0, fmtpFmtSize+1); + + sprintf(fmtp, fmtpFmt, rtp_pt); + char* endPtr = &fmtp[strlen(fmtp)]; + for (int i = 0; i < m_pCodecCtx->extradata_size; ++i) + { + sprintf(endPtr, "%02X", m_pCodecCtx->extradata[i]); + endPtr += 2; + } + + return fmtp; +} + +char * CAudioEncoder::getAuxSDPLine(int rtp_pt) +{ + if (m_nCodecId == AV_CODEC_ID_AAC) + { + return getAACAuxSDPLine(rtp_pt); + } + + return NULL; +} + +BOOL CAudioEncoder::getExtraData(uint8 ** extradata, int * extralen) +{ + if (m_pCodecCtx && m_pCodecCtx->extradata_size > 0) + { + *extradata = m_pCodecCtx->extradata; + *extralen = m_pCodecCtx->extradata_size; + + return TRUE; + } + + return FALSE; +} + + + diff --git a/MediaClient/MediaClientForMobile/media/audio_encoder.h b/MediaClient/MediaClientForMobile/media/audio_encoder.h new file mode 100644 index 0000000..5d194ba --- /dev/null +++ b/MediaClient/MediaClientForMobile/media/audio_encoder.h @@ -0,0 +1,111 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef _AUDIO_ENCODER_H +#define _AUDIO_ENCODER_H + +#include "linked_list.h" + +extern "C" +{ +#include +#include +#include +#include +#include +} + +typedef void (*AudioDataCallback)(uint8 *data, int size, int nbsamples, void *pUserdata); + +typedef struct +{ + AudioDataCallback pCallback; // callback function pointer + void * pUserdata; // user data + BOOL bFirst; // +} AudioEncoderCB; + +/** + * Some encoders require a fixed frame size + */ +typedef struct +{ + int tlen; // buffer total length + uint8 * data[2]; // audio data buffer + int size[2]; // audio data size + int samples; // audio sample numbers +} AudioBuffer; + +typedef struct +{ + int SrcSamplerate; // source sample rate + int SrcChannels; // source channels + AVSampleFormat SrcSamplefmt; // source sample format, see AVSampleFormat + + int DstCodec; // output codec + int DstSamplerate; // output sample rate + int DstChannels; // output channels + int DstBitrate; // output bitrate, unit is bits per second + AVSampleFormat DstSamplefmt; // output sample format, see AVSampleFormat +} AudioEncoderParam; + +class CAudioEncoder +{ +public: + CAudioEncoder(); + ~CAudioEncoder(); + + BOOL init(AudioEncoderParam * params); + void uninit(); + BOOL encode(uint8 * data, int size); + BOOL encode(AVFrame * pFrame); + void addCallback(AudioDataCallback pCallback, void *pUserdata); + void delCallback(AudioDataCallback pCallback, void *pUserdata); + char * getAuxSDPLine(int rtp_pt); + BOOL getExtraData(uint8 ** extradata, int * extralen); + +private: + void flush(); + BOOL encodeInternal(AVFrame * pFrame); + void procData(uint8 * data, int size, int nbsamples); + BOOL isCallbackExist(AudioDataCallback pCallback, void *pUserdata); + char * getAACAuxSDPLine(int rtp_pt); + BOOL bufferFrame(AVFrame * pFrame); + int computeBitrate(AVCodecID codec, int samplerate, int channels, int quality); + +private: + AVCodecID m_nCodecId; + BOOL m_bInited; + + AudioEncoderParam m_EncoderParams; + + AVCodecContext * m_pCodecCtx; + AVFrame * m_pFrame; + AVFrame * m_pResampleFrame; + SwrContext * m_pSwrCtx; + AudioBuffer m_AudioBuffer; + AVPacket * m_pPkt; + + void * m_pCallbackMutex; + LINKED_LIST * m_pCallbackList; +}; + +#endif // _AUDIO_ENCODER_H + + + diff --git a/MediaClient/MediaClientForMobile/media/audio_play.cpp b/MediaClient/MediaClientForMobile/media/audio_play.cpp new file mode 100644 index 0000000..7502987 --- /dev/null +++ b/MediaClient/MediaClientForMobile/media/audio_play.cpp @@ -0,0 +1,68 @@ +/*************************************************************************************** + * + * 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 "audio_play.h" + + +CAudioPlay::CAudioPlay() +{ + m_bInited = FALSE; + m_nSamplerate = 8000; + m_nChannels = 1; +} + +CAudioPlay::~CAudioPlay(void) +{ +} + +BOOL CAudioPlay::startPlay(int samplerate, int channels) +{ + m_nSamplerate = samplerate; + m_nChannels = channels; + + return FALSE; +} + +void CAudioPlay::stopPlay(void) +{ + m_bInited = FALSE; +} + +BOOL CAudioPlay::setVolume(int volume) +{ + return FALSE; +} + +int CAudioPlay::getVolume() +{ + return 0; +} + +void CAudioPlay::playAudio(uint8 * data, int size) +{ + if (!m_bInited) + { + return; + } +} + + + + diff --git a/MediaClient/MediaClientForMobile/media/audio_play.h b/MediaClient/MediaClientForMobile/media/audio_play.h new file mode 100644 index 0000000..adfe3f6 --- /dev/null +++ b/MediaClient/MediaClientForMobile/media/audio_play.h @@ -0,0 +1,53 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef _AUDIO_PLAY_H +#define _AUDIO_PLAY_H + +#include "sys_inc.h" +#include "media_format.h" + + +#define HTVOLUME_MIN 0 +#define HTVOLUME_MAX 255 + + +class CAudioPlay +{ +public: + CAudioPlay(); + virtual ~CAudioPlay(); + +public: + virtual BOOL startPlay(int samplerate, int channels); + virtual void stopPlay(); + virtual BOOL setVolume(int volume); + virtual int getVolume(); + virtual void playAudio(uint8 * pData, int len); + +protected: + BOOL m_bInited; + int m_nSamplerate; + int m_nChannels; +}; + +#endif + + + diff --git a/MediaClient/MediaClientForMobile/media/audio_play_qt.cpp b/MediaClient/MediaClientForMobile/media/audio_play_qt.cpp new file mode 100644 index 0000000..e47c0f7 --- /dev/null +++ b/MediaClient/MediaClientForMobile/media/audio_play_qt.cpp @@ -0,0 +1,157 @@ +/*************************************************************************************** + * + * 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 "audio_play_qt.h" +#include +#include + + +CQAudioPlay::CQAudioPlay(QObject * parent) : QObject(parent), CAudioPlay() +, m_pSink(NULL) +, m_pBuffer(NULL) +{ + +} + +CQAudioPlay::~CQAudioPlay() +{ + stopPlay(); +} + +BOOL CQAudioPlay::startPlay(int samplerate, int channels) +{ + QAudioFormat format; + + format.setSampleRate(samplerate); + format.setChannelCount(channels); + format.setSampleFormat(QAudioFormat::Int16); + + QAudioDevice device(QMediaDevices::defaultAudioOutput()); + if (!device.isFormatSupported(format)) + { + log_print(HT_LOG_ERR, "Raw audio format not supported by backend, cannot play audio\r\n"); + return FALSE; + } + + m_nSamplerate = samplerate; + m_nChannels = channels; + + m_pSink = new QAudioSink(device, format, NULL); + + m_pSink->setBufferSize(8192); + m_pBuffer = m_pSink->start(); + if (NULL == m_pBuffer) + { + log_print(HT_LOG_ERR, "%s, audio output start failed\r\n", __FUNCTION__); + return FALSE; + } + + m_bInited = TRUE; + + return TRUE; +} + +void CQAudioPlay::stopPlay() +{ + QMutexLocker locker(&m_mutex); + + if (m_pSink) + { + m_pSink->stop(); + delete m_pSink; + + m_pSink = NULL; + } + + m_pBuffer = NULL; + + m_bInited = FALSE; +} + +void CQAudioPlay::playAudio(uint8 * data, int size) +{ + if (!m_bInited) + { + return; + } + + QMutexLocker locker(&m_mutex); + + int rlen = m_pBuffer->write((char *)data, size); + while (rlen < size) + { + if (rlen < 0) + { + break; // error + } + else + { + size -= rlen; + data += rlen; + } + + rlen = m_pBuffer->write((char *)data, size); + } +} + +BOOL CQAudioPlay::setVolume(int volume) +{ + QMutexLocker locker(&m_mutex); + + if (m_pSink) + { + double db = (double) volume / (HTVOLUME_MAX - HTVOLUME_MIN); + if (db < 0) + { + db = 0.0; + } + else if (db > 1.0) + { + db = 1.0; + } + + log_print(HT_LOG_DBG, "%s, volume=%d, db=%f\r\n", __FUNCTION__, volume, db); + + m_pSink->setVolume(db); + + return TRUE; + } + + return FALSE; +} + +int CQAudioPlay::getVolume() +{ + double volume = HTVOLUME_MIN; + + QMutexLocker locker(&m_mutex); + + if (m_pSink) + { + volume = m_pSink->volume(); + } + + int nv = (HTVOLUME_MAX - HTVOLUME_MIN) * volume + HTVOLUME_MIN; + + return nv; +} + + + diff --git a/MediaClient/MediaClientForMobile/media/audio_play_qt.h b/MediaClient/MediaClientForMobile/media/audio_play_qt.h new file mode 100644 index 0000000..52b6224 --- /dev/null +++ b/MediaClient/MediaClientForMobile/media/audio_play_qt.h @@ -0,0 +1,56 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef AUDIO_PLAY_QT_H +#define AUDIO_PLAY_QT_H + +#include "sys_inc.h" +#include "linked_list.h" +#include "media_format.h" +#include "audio_play.h" +#include +#include +#include +#include +#include + + +class CQAudioPlay : public QObject, public CAudioPlay +{ + Q_OBJECT + +public: + CQAudioPlay(QObject * parent = NULL); + ~CQAudioPlay(); + + BOOL startPlay(int samplerate, int channels); + void stopPlay(); + BOOL setVolume(int volume); + int getVolume(); + void playAudio(uint8 * pData, int len); + +private: + QAudioSink * m_pSink; + QIODevice * m_pBuffer; + QMutex m_mutex; +}; + +#endif + + diff --git a/MediaClient/MediaClientForMobile/media/avcodec_mutex.cpp b/MediaClient/MediaClientForMobile/media/avcodec_mutex.cpp new file mode 100644 index 0000000..75ac307 --- /dev/null +++ b/MediaClient/MediaClientForMobile/media/avcodec_mutex.cpp @@ -0,0 +1,48 @@ +/*************************************************************************************** + * + * 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 "avcodec_mutex.h" + +void * g_avcodec_mutex = sys_os_create_mutex(); + +int avcodec_thread_open(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options) +{ + int ret; + + sys_os_mutex_enter(g_avcodec_mutex); + ret = avcodec_open2(avctx, codec, options); + sys_os_mutex_leave(g_avcodec_mutex); + + return ret; +} + +int avcodec_thread_close(AVCodecContext *avctx) +{ + int ret; + + sys_os_mutex_enter(g_avcodec_mutex); + ret = avcodec_close(avctx); + sys_os_mutex_leave(g_avcodec_mutex); + + return ret; +} + + + diff --git a/MediaClient/MediaClientForMobile/media/avcodec_mutex.h b/MediaClient/MediaClientForMobile/media/avcodec_mutex.h new file mode 100644 index 0000000..195663d --- /dev/null +++ b/MediaClient/MediaClientForMobile/media/avcodec_mutex.h @@ -0,0 +1,41 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef AVCODEC_MUTEX_H +#define AVCODEC_MUTEX_H + +extern "C" { +#include "libavcodec/avcodec.h" +} + +#ifdef __cplusplus +extern "C" { +#endif + +int avcodec_thread_open(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options); +int avcodec_thread_close(AVCodecContext *avctx); + +#ifdef __cplusplus +} +#endif + + +#endif + + diff --git a/MediaClient/MediaClientForMobile/media/avi.h b/MediaClient/MediaClientForMobile/media/avi.h new file mode 100644 index 0000000..ca12ab2 --- /dev/null +++ b/MediaClient/MediaClientForMobile/media/avi.h @@ -0,0 +1,188 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef AVI_H +#define AVI_H + +#include "format.h" + +/* Flags in avih */ +#define AVIF_HASINDEX 0x00000010 // Index at end of file? +#define AVIF_ISINTERLEAVED 0x00000100 // is interleaved? +#define AVIF_TRUSTCKTYPE 0x00000800 // Use CKType to find key frames? + +#define AVIIF_KEYFRAME 0x00000010L // this frame is a key frame. + +#pragma pack(push) +#pragma pack(1) + +typedef struct avi_riff +{ + uint32 riff; + uint32 len; + uint32 type; +} AVIRIFF; + +typedef struct avi_pkt +{ + uint32 type; // packet type : PACKET_TYPE_UNKNOW, PACKET_TYPE_VIDEO,PACKET_TYPE_AUDIO + uint8 * rbuf; // buffer pointer + uint32 mlen; // buffer size + uint8 * dbuf; // data pointer + uint32 len; // packet length +} AVIPKT; + +typedef struct avi_main_header +{ + uint32 dwMicroSecPerFrame; // render time for per frame, unit is ns + uint32 dwMaxBytesPerSec; // maximum data transfer rate + uint32 dwPaddingGranularity; // The length of the record block needs to be a multiple of this value, usually 2048 + uint32 dwFlags; // Special attributes of AVI files, such as whether to include index blocks, whether audio and video data is interleaved + uint32 dwTotalFrames; // The total number of frames in the file + uint32 dwInitialFrames; // How much frames is needed before starting to play + uint32 dwStreams; // The number of data streams contained in the file + uint32 dwSuggestedBufferSize; // The recommended size of the buffer, usually the sum of the data needed to store an image and synchronize the sound + uint32 dwWidth; // Image width + uint32 dwHeight; // Image height + uint32 dwReserved[4]; // Reserved +} AVIMHDR; + +typedef struct avi_stream_header +{ + uint32 fccType; // 4 bytes, indicating the type of data stream, vids for video data stream, auds audio data stream + uint32 fccHandler; // 4 bytes, indicating the driver code for data stream decompression + uint32 dwFlags; // Data stream attribute + uint16 wPriority; // Play priority of this stream + uint16 wLanguage; // Audio language code + uint32 dwInitialFrames; // How much frames is needed before starting to play + uint32 dwScale; // The amount of data, the size of each video or the sample size of the audio + uint32 dwRate; // dwScale / dwRate = Number of samples per second + uint32 dwStart; // The location where the data stream starts playing, in dwScale + uint32 dwLength; // The amount of data in the data stream, in dwScale + uint32 dwSuggestedBufferSize; // Recommended buffer size + uint32 dwQuality; // Decompress quality parameters, the larger the value, the better the quality + uint32 dwSampleSize; // Sample size of the audio + + struct + { + short left; + short top; + short right; + short bottom; + } rcFrame; +} AVISHDR; + +typedef struct bitmap_info_header +{ + uint32 biSize; + int biWidth; + int biHeight; + uint16 biPlanes; + uint16 biBitCount; + uint32 biCompression; + uint32 biSizeImage; + int biXPelsPerMeter; + int biYPelsPerMeter; + uint32 biClrUsed; + uint32 biClrImportant; +} BMPHDR; + +typedef struct wave_format +{ + uint16 wFormatTag; // format type + uint16 nChannels; // number of channels (i.e. mono, stereo...) + uint32 nSamplesPerSec; // sample rate + uint32 nAvgBytesPerSec; // for buffer estimation + uint16 nBlockAlign; // block size of data + uint16 wBitsPerSample; // number of bits per sample of mono data + uint16 cbSize; // the count in bytes of the size of + + // extra information (after cbSize) +} WAVEFMT; + +#pragma pack(pop) + +typedef struct avi_file_context +{ + uint32 ctxf_read : 1; // Read mode + uint32 ctxf_write : 1; // Write mode + uint32 ctxf_idx : 1; // File has index + uint32 ctxf_audio : 1; // Has audio stream + uint32 ctxf_video : 1; // Has video stream + uint32 ctxf_idx_m : 1; // Index data write mode: = 1, memory mode; = 0, temporary file + uint32 ctxf_calcfps: 1; // Calc video framerate + uint32 ctxf_nalu : 1; // For H.26x, VPS, SPS,PPS written flag + uint32 ctxf_iframe : 1; // For H.26x, key frame written flag + uint32 ctxf_res : 23; + + AVIMHDR avi_hdr; // AVI main header + AVISHDR str_v; // Video stream header + BMPHDR bmp; // BITMAP format + AVISHDR str_a; // Audio stream header + WAVEFMT wave; // WAVE format + + FILE * fp; // Read and write file handle + uint32 flen; // Total file length, used when reading + char filename[256]; // File full path + void * mutex; // Write, close mutex + + uint32 v_fps; // Video frame rate + char v_fcc[4]; // Video compression standard, "H264","H265","JPEG","MP4V" + int v_width; // Video width + int v_height; // Video height + uint8 * v_extra; // Video extra data + int v_extra_len; // Video extra data length + + int a_rate; // Sampling frequency + uint16 a_fmt; // Audio compression standard + int a_chns; // Number of audio channels + uint8 * a_extra; // Audio extra data + int a_extra_len; // Audio extra data length + + int i_movi; // Where the real data starts + int i_movi_end; // End of data, where the index starts + int i_riff; // After the index, the length of the entire file + + int pkt_offset; // Packet offset when reading + int index_offset; // Index position when reading + int back_index; // The first read index position when reading in reverse order, usually sps/vps + + int i_frame_video; // Video frame read and write count + int i_frame_audio; // Audio frame read and write count + uint32 audio_total_bytes; // Audio total bytes + + uint32 prev_ts; // previous timestamp + uint32 v_s_time; // Video start recording time = first packet write time + uint32 v_e_time; // The time when video package was recently written + uint32 a_s_time; // Audio start recording time = first packet write time + uint32 a_e_time; // The time when audio package was recently written + + int i_idx_max; // The maximum number of indexes currently allocated + int i_idx; // Current index number (video index + audio index) + int * idx; // Index array + + FILE * idx_fp; // Index temporary file + int idx_fix[128]; // Index file data is enough to write once for one sector + int idx_fix_off; // The index data has been stored in the offset of idx_fix +} AVICTX; + +#endif // AVI_H + + + diff --git a/MediaClient/MediaClientForMobile/media/avi_write.cpp b/MediaClient/MediaClientForMobile/media/avi_write.cpp new file mode 100644 index 0000000..975e6d6 --- /dev/null +++ b/MediaClient/MediaClientForMobile/media/avi_write.cpp @@ -0,0 +1,1144 @@ +/*************************************************************************************** + * + * 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 "avi.h" +#include "avi_write.h" +#include "h264.h" +#include "h265.h" +#include "mjpeg.h" +#include "media_util.h" +#include "h264_util.h" +#include "h265_util.h" +#include + + +int avi_write_uint16_(AVICTX * p_ctx, uint16 w) +{ + return fwrite(&w, 2, 1, p_ctx->fp); +} + +int avi_write_uint32_(AVICTX * p_ctx, uint32 dw) +{ + return fwrite(&dw, 4, 1, p_ctx->fp); +} + +int avi_write_fourcc_(AVICTX * p_ctx, const char fcc[4]) +{ + return fwrite(fcc, 4, 1, p_ctx->fp); +} + +int avi_write_buffer_(AVICTX * p_ctx, char * p_data, int len) +{ + return fwrite(p_data, len, 1, p_ctx->fp); +} + +#define avi_write_uint16(p_ctx, w) do{ if(avi_write_uint16_(p_ctx, w) != 1) goto w_err; }while(0) +#define avi_write_uint32(p_ctx, w) do{ if(avi_write_uint32_(p_ctx, w) != 1) goto w_err; }while(0) +#define avi_write_fourcc(p_ctx, fcc) do{ if(avi_write_fourcc_(p_ctx, fcc) != 1) goto w_err; }while(0) +#define avi_write_buffer(p_ctx, p_data, len) do{ if(avi_write_buffer_(p_ctx, p_data, len) != 1) goto w_err; }while(0) + +void avi_free_idx(AVICTX * p_ctx) +{ + if (p_ctx->idx) + { + free(p_ctx->idx); + p_ctx->idx = NULL; + } + + if (p_ctx->idx_fp) + { + fclose(p_ctx->idx_fp); + p_ctx->idx_fp = NULL; + } + + p_ctx->i_idx = 0; + p_ctx->i_idx_max = 0; +} + +int avi_write_idx(AVICTX * p_ctx) +{ + avi_write_fourcc(p_ctx, "idx1"); + avi_write_uint32(p_ctx, p_ctx->i_idx * 16); + + if (p_ctx->ctxf_idx_m == 1) + { + if (p_ctx->i_idx > 0) + { + if (fwrite(p_ctx->idx, p_ctx->i_idx * 16, 1, p_ctx->fp) != 1) + { + return -1; + } + } + } + else if (p_ctx->idx_fp) + { + // Write index data in a fixed buffer to an index file + if (p_ctx->idx_fix_off > 0) + { + if (fwrite(p_ctx->idx_fix, p_ctx->idx_fix_off * 4, 1, p_ctx->idx_fp) != 1) + { + goto w_err; + } + + p_ctx->idx_fix_off = 0; + } + + // Write index temporary file data to the avi file + + fseek(p_ctx->idx_fp, 0, SEEK_END); + + int idx_len = ftell(p_ctx->idx_fp); + + if (idx_len != (p_ctx->i_idx * 16)) + { + log_print(HT_LOG_ERR, "%s, idx real len[%d] != idx file len[%d],idx_fix_off[%d]!!!\r\n", + __FUNCTION__, p_ctx->i_idx * 16, idx_len, p_ctx->idx_fix_off * 4); + return -1; + } + + fseek(p_ctx->fp, 0, SEEK_END); + fseek(p_ctx->idx_fp, 0, SEEK_SET); + + int rlen; + + do + { + rlen = fread(p_ctx->idx_fix, 1, sizeof(p_ctx->idx_fix), p_ctx->idx_fp); + if (rlen <= 0) + { + break; + } + + if (fwrite(p_ctx->idx_fix, rlen, 1, p_ctx->fp) != 1) + { + log_print(HT_LOG_ERR, "%s, write idx into avi file failed!!!\r\n", __FUNCTION__); + return -1; + } + } while(rlen > 0); + } + + return 0; + +w_err: + + return -1; +} + +void avi_set_dw(void * p, uint32 dw) +{ + uint8 * ptr = (uint8 *)p; + + ptr[0] = (dw ) & 0xff; + ptr[1] = (dw >> 8 ) & 0xff; + ptr[2] = (dw >> 16) & 0xff; + ptr[3] = (dw >> 24) & 0xff; +} + +int avi_end(AVICTX * p_ctx) +{ + if (p_ctx->fp == NULL) + { + return -1; + } + + p_ctx->i_movi_end = ftell(p_ctx->fp); + + if (avi_write_idx(p_ctx) < 0) + { + goto end_err; + } + + p_ctx->i_riff = ftell(p_ctx->fp); + + if (avi_write_header(p_ctx) < 0) + { + goto end_err; + } + + // AVI file has been completed, delete the temporary index file + if (p_ctx->idx_fp) + { + fclose(p_ctx->idx_fp); + p_ctx->idx_fp = NULL; + +#if defined(ANDROID) + char cmds[512]; + snprintf(cmds, sizeof(cmds)-1, "rm -f %s.idx", p_ctx->filename); + system(cmds); +#else + char filename[512]; + snprintf(filename, sizeof(filename)-1, "%s.idx", p_ctx->filename); + remove(filename); +#endif + } + +end_err: + + if (p_ctx->fp) + { + fclose(p_ctx->fp); + p_ctx->fp = NULL; + } + + avi_free_idx(p_ctx); + + return 0; +} + +/**************************************************************************/ +AVICTX * avi_write_open(const char * filename) +{ + AVICTX * p_ctx = (AVICTX *)malloc(sizeof(AVICTX)); + if (p_ctx == NULL) + { + log_print(HT_LOG_ERR, "%s, malloc fail!!!\r\n", __FUNCTION__); + return NULL; + } + + memset(p_ctx, 0, sizeof(AVICTX)); + + p_ctx->ctxf_write = 1; + + p_ctx->fp = fopen(filename, "wb+"); + if (p_ctx->fp == NULL) + { + free(p_ctx); + log_print(HT_LOG_ERR, "%s, fopen [%s] failed!!!\r\n", __FUNCTION__, filename); + return NULL; + } + + strncpy(p_ctx->filename, filename, sizeof(p_ctx->filename)); + + char idx_path[256]; + snprintf(idx_path, sizeof(idx_path), "%s.idx", filename); + + p_ctx->idx_fp = fopen(idx_path, "wb+"); + if (p_ctx->idx_fp == NULL) + { + fclose(p_ctx->fp); + free(p_ctx); + log_print(HT_LOG_ERR, "%s, fopen [%s] failed!!!\r\n", __FUNCTION__, idx_path); + return NULL; + } + + p_ctx->mutex = sys_os_create_mutex(); + + return p_ctx; +} + +int avi_write_video_frame(AVICTX * p_ctx, void * p_data, uint32 len, uint32 ts, int b_key, int frame) +{ + int ret = -1; + + if (NULL == p_ctx || NULL == p_ctx->fp) + { + return -1; + } + + int i_pos = ftell(p_ctx->fp); + + avi_write_fourcc(p_ctx, "00dc"); + avi_write_uint32(p_ctx, len); + + if (fwrite(p_data, len, 1, p_ctx->fp) != 1) + { + goto w_err; + } + + if (len & 0x01) /* pad */ + { + fputc(0, p_ctx->fp); + } + + if (p_ctx->ctxf_idx_m == 1) + { + if (p_ctx->i_idx_max <= p_ctx->i_idx) + { + p_ctx->i_idx_max += 1000; + p_ctx->idx = (int *)realloc(p_ctx->idx, p_ctx->i_idx_max * 16); + if (p_ctx->idx == NULL) + { + log_print(HT_LOG_ERR, "%s, realloc ret null!!!\r\n", __FUNCTION__); + } + } + + if (p_ctx->idx) + { + memcpy(&p_ctx->idx[4*p_ctx->i_idx+0], "00dc", 4); + avi_set_dw(&p_ctx->idx[4*p_ctx->i_idx+1], b_key ? AVIIF_KEYFRAME : 0); + avi_set_dw(&p_ctx->idx[4*p_ctx->i_idx+2], i_pos); + avi_set_dw(&p_ctx->idx[4*p_ctx->i_idx+3], len); + + p_ctx->i_idx++; + } + } + else if (p_ctx->idx_fp) + { + memcpy(&p_ctx->idx_fix[p_ctx->idx_fix_off + 0], "00dc", 4); + avi_set_dw(&p_ctx->idx_fix[p_ctx->idx_fix_off + 1], b_key ? AVIIF_KEYFRAME : 0); + avi_set_dw(&p_ctx->idx_fix[p_ctx->idx_fix_off + 2], i_pos); + avi_set_dw(&p_ctx->idx_fix[p_ctx->idx_fix_off + 3], len); + + p_ctx->idx_fix_off += 4; + + if (p_ctx->idx_fix_off == (sizeof(p_ctx->idx_fix) / sizeof(int))) + { + if (fwrite(p_ctx->idx_fix, sizeof(p_ctx->idx_fix), 1, p_ctx->idx_fp) != 1) + { + goto w_err; + } + + p_ctx->idx_fix_off = 0; + } + + p_ctx->i_idx++; + } + + if (frame) + { + p_ctx->i_frame_video++; + + if (p_ctx->v_s_time == 0) + { + p_ctx->v_s_time = sys_os_get_ms(); + p_ctx->v_e_time = p_ctx->v_s_time; + } + else + { + p_ctx->v_e_time = sys_os_get_ms(); + } + } + + p_ctx->prev_ts = ts; + + ret = ftell(p_ctx->fp); + +w_err: + + if (ret < 0) + { + log_print(HT_LOG_ERR, "%s, ret[%d] err[%d] [%s]!!!\r\n", __FUNCTION__, ret, errno, strerror(errno)); + + if (p_ctx->fp) + { + fclose(p_ctx->fp); + p_ctx->fp = NULL; + } + + if (p_ctx->idx_fp) + { + fclose(p_ctx->idx_fp); + p_ctx->idx_fp = NULL; + } + } + + return ret; +} + +int avi_write_h264_nalu(AVICTX * p_ctx, uint8 * sps, int sps_len, uint8 * pps, int pps_len) +{ + int flag = 0; + + if (sps_len > 0 && sps) + { + if (avi_write_video_frame(p_ctx, sps, sps_len, 0, 0, 0) > 0) + { + flag = 1; + } + } + + if (pps_len > 0 && pps) + { + if (avi_write_video_frame(p_ctx, pps, pps_len, 0, 0, 0) > 0) + { + flag = 1; + } + } + + p_ctx->ctxf_nalu = flag; + + return flag; +} + +int avi_write_h265_nalu(AVICTX * p_ctx, uint8 * vps, int vps_len, uint8 * sps, int sps_len, uint8 * pps, int pps_len) +{ + int flag = 0; + + if (vps_len > 0 && vps) + { + if (avi_write_video_frame(p_ctx, vps, vps_len, 0, 0, 0) > 0) + { + flag = 1; + } + } + + if (sps_len > 0 && sps) + { + if (avi_write_video_frame(p_ctx, sps, sps_len, 0, 0, 0) > 0) + { + flag = 1; + } + } + + if (pps_len > 0 && pps) + { + if (avi_write_video_frame(p_ctx, pps, pps_len, 0, 0, 0) > 0) + { + flag = 1; + } + } + + p_ctx->ctxf_nalu = flag; + + return flag; +} + +int avi_write_h264(AVICTX * p_ctx, void * p_data, uint32 len, uint32 ts, int b_key) +{ + if (p_ctx->ctxf_nalu) + { + if (!p_ctx->ctxf_iframe) + { + if (b_key) + { + if (avi_write_video_frame(p_ctx, p_data, len, ts, b_key, 1) < 0) + { + log_print(HT_LOG_ERR, "%s, avi_write_video_frame failed\r\n", __FUNCTION__); + return -1; + } + else + { + p_ctx->ctxf_iframe = 1; + } + } + } + else + { + if (avi_write_video_frame(p_ctx, p_data, len, ts, b_key, 1) < 0) + { + log_print(HT_LOG_ERR, "%s, avi_write_video_frame failed\r\n", __FUNCTION__); + return -1; + } + } + } + + return 0; +} + +int avi_write_h265(AVICTX * p_ctx, void * p_data, uint32 len, uint32 ts, int b_key) +{ + if (p_ctx->ctxf_nalu) + { + if (!p_ctx->ctxf_iframe) + { + if (b_key) + { + if (avi_write_video_frame(p_ctx, p_data, len, ts, b_key, 1) < 0) + { + log_print(HT_LOG_ERR, "%s, avi_write_video_frame failed\r\n", __FUNCTION__); + return -1; + } + else + { + p_ctx->ctxf_iframe = 1; + } + } + } + else + { + if (avi_write_video_frame(p_ctx, p_data, len, ts, b_key, 1) < 0) + { + log_print(HT_LOG_ERR, "%s, avi_write_video_frame failed\r\n", __FUNCTION__); + return -1; + } + } + } + + return 0; +} + +int avi_write_video(AVICTX * p_ctx, uint8 * p_data, uint32 len, uint32 ts, int b_key) +{ + int ret = 0; + + sys_os_mutex_enter(p_ctx->mutex); + + if (p_ctx->v_fps == 0) + { + avi_calc_fps(p_ctx); + } + + if (memcmp(p_ctx->v_fcc, "H264", 4) == 0) + { + ret = avi_write_h264(p_ctx, p_data, len, ts, b_key); + } + else if (memcmp(p_ctx->v_fcc, "H265", 4) == 0) + { + ret = avi_write_h265(p_ctx, p_data, len, ts, b_key); + } + else + { + ret = avi_write_video_frame(p_ctx, p_data, len, ts, b_key, 1); + } + + sys_os_mutex_leave(p_ctx->mutex); + + return ret; +} + +int avi_write_nalu(AVICTX * p_ctx, uint8 * vps, int vps_len, uint8 * sps, int sps_len, uint8 * pps, int pps_len) +{ + int ret = 0; + + if (p_ctx->ctxf_nalu) + { + return 0; + } + + sys_os_mutex_enter(p_ctx->mutex); + + if (memcmp(p_ctx->v_fcc, "H264", 4) == 0) + { + ret = avi_write_h264_nalu(p_ctx, sps, sps_len, pps, pps_len); + } + else if (memcmp(p_ctx->v_fcc, "H265", 4) == 0) + { + ret = avi_write_h265_nalu(p_ctx, vps, vps_len, sps, sps_len, pps, pps_len); + } + + sys_os_mutex_leave(p_ctx->mutex); + + return ret; +} + +int avi_write_audio(AVICTX * p_ctx, uint8 * p_data, uint32 len, uint32 ts) +{ + int ret = -1; + + if (NULL == p_ctx) + { + return -1; + } + + if (p_ctx->ctxf_video) + { + if (memcmp(p_ctx->v_fcc, "H264", 4) == 0 || + memcmp(p_ctx->v_fcc, "H265", 4) == 0) + { + if (!p_ctx->ctxf_iframe) + { + return 0; + } + } + } + + if (p_ctx->a_fmt == AUDIO_FORMAT_AAC) // AAC + { + if (p_data[0] == 0xFF && (p_data[1] & 0xF0) == 0xF0) + { + // skip ADTS header + p_data += 7; + len -= 7; + } + } + + sys_os_mutex_enter(p_ctx->mutex); + + if (NULL == p_ctx->fp) + { + sys_os_mutex_leave(p_ctx->mutex); + return -1; + } + + int i_pos = ftell(p_ctx->fp); + + /* chunk header */ + avi_write_fourcc(p_ctx, "01wb"); + avi_write_uint32(p_ctx, len); + + if (fwrite(p_data, len, 1, p_ctx->fp) != 1) + { + goto w_err; + } + + if (len & 0x01) /* pad */ + { + fputc(0, p_ctx->fp); + } + + if (p_ctx->ctxf_idx_m == 1) + { + if (p_ctx->i_idx_max <= p_ctx->i_idx) + { + p_ctx->i_idx_max += 1000; + p_ctx->idx = (int *)realloc(p_ctx->idx, p_ctx->i_idx_max * 16); + if (p_ctx->idx == NULL) + { + log_print(HT_LOG_ERR, "%s, realloc ret null!!!\r\n", __FUNCTION__); + } + } + + if (p_ctx->idx) + { + memcpy(&p_ctx->idx[4*p_ctx->i_idx+0], "01wb", 4); + avi_set_dw(&p_ctx->idx[4*p_ctx->i_idx+1], AVIIF_KEYFRAME); + avi_set_dw(&p_ctx->idx[4*p_ctx->i_idx+2], i_pos); + avi_set_dw(&p_ctx->idx[4*p_ctx->i_idx+3], len); + + p_ctx->i_idx++; + } + } + else if (p_ctx->idx_fp) + { + memcpy(&p_ctx->idx_fix[p_ctx->idx_fix_off + 0], "01wb", 4); + avi_set_dw(&p_ctx->idx_fix[p_ctx->idx_fix_off + 1], AVIIF_KEYFRAME); + avi_set_dw(&p_ctx->idx_fix[p_ctx->idx_fix_off + 2], i_pos); + avi_set_dw(&p_ctx->idx_fix[p_ctx->idx_fix_off + 3], len); + + p_ctx->idx_fix_off += 4; + + if (p_ctx->idx_fix_off == (sizeof(p_ctx->idx_fix) / sizeof(int))) + { + if (fwrite(p_ctx->idx_fix, sizeof(p_ctx->idx_fix), 1, p_ctx->idx_fp) != 1) + { + goto w_err; + } + + p_ctx->idx_fix_off = 0; + } + + p_ctx->i_idx++; + } + + p_ctx->i_frame_audio++; + p_ctx->audio_total_bytes += len; + + if (p_ctx->a_s_time == 0) + { + p_ctx->a_s_time = sys_os_get_ms(); + p_ctx->a_e_time = p_ctx->a_s_time; + } + else + { + p_ctx->a_e_time = sys_os_get_ms(); + } + + ret = ftell(p_ctx->fp); + +w_err: + + if (ret < 0) + { + log_print(HT_LOG_ERR, "%s, ret[%d]!!!\r\n", __FUNCTION__, ret); + + if (p_ctx->fp) + { + fclose(p_ctx->fp); + p_ctx->fp = NULL; + } + + if (p_ctx->idx_fp) + { + fclose(p_ctx->idx_fp); + p_ctx->idx_fp = NULL; + } + } + + sys_os_mutex_leave(p_ctx->mutex); + + return ret; +} + +void avi_write_close(AVICTX * p_ctx) +{ + if (NULL == p_ctx) + { + return; + } + + sys_os_mutex_enter(p_ctx->mutex); + + avi_end(p_ctx); + avi_free_idx(p_ctx); + + if (p_ctx->v_extra) + { + free(p_ctx->v_extra); + } + + if (p_ctx->a_extra) + { + free(p_ctx->a_extra); + } + + sys_os_mutex_leave(p_ctx->mutex); + + sys_os_destroy_sig_mutex(p_ctx->mutex); + + free(p_ctx); +} + +void avi_set_video_info(AVICTX * p_ctx, int fps, int width, int height, const char fcc[4]) +{ + memcpy(p_ctx->v_fcc, fcc, 4); // "H264","H265","JPEG","MP4V" + p_ctx->v_fps = fps; + p_ctx->v_width = width; + p_ctx->v_height = height; + + p_ctx->ctxf_video = 1; + p_ctx->ctxf_calcfps = fps > 0 ? 0 : 1; +} + +void avi_set_video_extra_info(AVICTX * p_ctx, uint8 * extra, int extra_len) +{ + if (NULL != extra && extra_len > 0) + { + if (p_ctx->v_extra) + { + free(p_ctx->v_extra); + } + + p_ctx->v_extra_len = 0; + + p_ctx->v_extra = (uint8*) malloc(extra_len); + if (p_ctx->v_extra) + { + memcpy(p_ctx->v_extra, extra, extra_len); + p_ctx->v_extra_len = extra_len; + } + } +} + +void avi_set_audio_info(AVICTX * p_ctx, int chns, int rate, uint16 fmt) +{ + p_ctx->a_chns = chns; + p_ctx->a_rate = rate; + p_ctx->a_fmt = fmt; + + p_ctx->ctxf_audio = 1; +} + +void avi_set_audio_extra_info(AVICTX * p_ctx, uint8 * extra, int extra_len) +{ + if (NULL != extra && extra_len > 0) + { + if (p_ctx->a_extra) + { + free(p_ctx->a_extra); + } + + p_ctx->a_extra_len = 0; + + p_ctx->a_extra = (uint8*) malloc(extra_len); + if (p_ctx->a_extra) + { + memcpy(p_ctx->a_extra, extra, extra_len); + p_ctx->a_extra_len = extra_len; + } + } +} + +void avi_build_video_hdr(AVICTX * p_ctx) +{ + if (p_ctx->ctxf_video == 0) + { + return; + } + + avi_calc_fps(p_ctx); + + memcpy(&p_ctx->str_v.fccHandler, p_ctx->v_fcc, 4); + + p_ctx->str_v.fccType = mmioFOURCC('v','i','d','s'); + p_ctx->str_v.dwFlags = 0; // Contains AVITF_ flags + p_ctx->str_v.wPriority = 0; + p_ctx->str_v.wLanguage = 0; + p_ctx->str_v.dwInitialFrames = 0; + p_ctx->str_v.dwScale = 1; + p_ctx->str_v.dwRate = (p_ctx->v_fps == 0) ? 25 : p_ctx->v_fps; // dwRate / dwScale == samplessecond + p_ctx->str_v.dwStart = 0; + p_ctx->str_v.dwLength = p_ctx->i_frame_video; // In units above.. + p_ctx->str_v.dwSuggestedBufferSize = 1024*1024; + p_ctx->str_v.dwQuality = -1; + p_ctx->str_v.dwSampleSize = 0; + p_ctx->str_v.rcFrame.left = 0; + p_ctx->str_v.rcFrame.top = 0; + p_ctx->str_v.rcFrame.right = p_ctx->v_width; + p_ctx->str_v.rcFrame.bottom = p_ctx->v_height; + + memcpy(&p_ctx->bmp.biCompression, p_ctx->v_fcc, 4); + + p_ctx->bmp.biSize = sizeof(BMPHDR); + p_ctx->bmp.biWidth = p_ctx->v_width; + p_ctx->bmp.biHeight = p_ctx->v_height; + p_ctx->bmp.biPlanes = 1; + p_ctx->bmp.biBitCount = 24; + p_ctx->bmp.biSizeImage = p_ctx->v_width * p_ctx->v_height * 3; + p_ctx->bmp.biXPelsPerMeter = 0; + p_ctx->bmp.biYPelsPerMeter = 0; + p_ctx->bmp.biClrUsed = 0; + p_ctx->bmp.biClrImportant = 0; +} + +void avi_build_audio_hdr(AVICTX * p_ctx) +{ + if (p_ctx->ctxf_audio == 0) + { + return; + } + + int bps, blkalign, bytespersec; + uint32 scale = 1; + uint32 length; + + if (p_ctx->a_fmt == AUDIO_FORMAT_ALAW) // G711A + { + bps = 8; + blkalign = p_ctx->a_chns; + bytespersec = p_ctx->a_rate * p_ctx->a_chns; + length = p_ctx->audio_total_bytes / blkalign; + } + else if (p_ctx->a_fmt == AUDIO_FORMAT_MULAW) // G711U + { + bps = 8; + blkalign = p_ctx->a_chns; + bytespersec = p_ctx->a_rate * p_ctx->a_chns; + length = p_ctx->audio_total_bytes / blkalign; + } + else if (p_ctx->a_fmt == AUDIO_FORMAT_AAC) // AAC + { + bps = 16; + blkalign = 768 * p_ctx->a_chns; /* maximum bytes per frame */ + bytespersec = p_ctx->a_rate * p_ctx->a_chns / 8; + scale = 1024; + length = p_ctx->i_frame_audio; + } + else if (p_ctx->a_fmt == AUDIO_FORMAT_G726) // G726 + { + bps = 8; + blkalign = p_ctx->a_chns; + bytespersec = p_ctx->a_rate * p_ctx->a_chns; + length = p_ctx->audio_total_bytes / blkalign; + } + else if (p_ctx->a_fmt == AUDIO_FORMAT_G722) // G722 + { + bps = 4; + blkalign = p_ctx->a_chns; + bytespersec = p_ctx->a_rate * p_ctx->a_chns; + length = p_ctx->audio_total_bytes / blkalign; + } + else + { + bps = 8; + blkalign = p_ctx->a_chns; + bytespersec = p_ctx->a_rate * p_ctx->a_chns; + length = p_ctx->audio_total_bytes / blkalign; + } + + if (p_ctx->audio_total_bytes > 0 && p_ctx->a_e_time > p_ctx->a_s_time + 5000) + { + bytespersec = p_ctx->audio_total_bytes / ((p_ctx->a_e_time - p_ctx->a_s_time) / 1000); + } + + p_ctx->str_a.fccType = mmioFOURCC('a','u','d','s'); + p_ctx->str_a.fccHandler = 1; + p_ctx->str_a.dwFlags = 0; // Contains AVITF_ flags + p_ctx->str_a.wPriority = 0; + p_ctx->str_a.wLanguage = 0; + p_ctx->str_a.dwInitialFrames = 0; + p_ctx->str_a.dwScale = scale; + p_ctx->str_a.dwRate = p_ctx->a_rate; + p_ctx->str_a.dwStart = 0; + p_ctx->str_a.dwLength = length; + p_ctx->str_a.dwSuggestedBufferSize = 12*1024; + p_ctx->str_a.dwQuality = -1; + p_ctx->str_a.dwSampleSize = blkalign; + p_ctx->str_a.rcFrame.left = 0; + p_ctx->str_a.rcFrame.top = 0; + p_ctx->str_a.rcFrame.right = 0; + p_ctx->str_a.rcFrame.bottom = 0; + + p_ctx->wave.wFormatTag = p_ctx->a_fmt; + p_ctx->wave.nChannels = p_ctx->a_chns; + p_ctx->wave.nSamplesPerSec = p_ctx->a_rate; + p_ctx->wave.nAvgBytesPerSec = bytespersec; + p_ctx->wave.nBlockAlign = blkalign; + p_ctx->wave.wBitsPerSample = bps; + p_ctx->wave.cbSize = p_ctx->a_extra_len; +} + +int avi_write_header(AVICTX * p_ctx) +{ + if (p_ctx->fp == NULL) + { + return -1; + } + + log_print(HT_LOG_DBG, "%s, enter...\r\n", __FUNCTION__); + + avi_build_video_hdr(p_ctx); + avi_build_audio_hdr(p_ctx); + + fseek(p_ctx->fp, 0, SEEK_SET); + + int tlen; + int avih_len = sizeof(AVIMHDR) + 8; + int strl_v_len = sizeof(AVISHDR) + 8 + sizeof(BMPHDR) + 8; + int strl_a_len = sizeof(AVISHDR) + 8 + sizeof(WAVEFMT) + 8; + int s_v_ll = strl_v_len + 12; + int s_a_ll = strl_a_len + 12; + int a_extra_len = 0; + int a_pad_len = 0; + int v_extra_len = 0; + int v_pad_len = 0; + + if (p_ctx->a_extra && p_ctx->a_extra_len) + { + a_extra_len = p_ctx->a_extra_len; + + if (a_extra_len & 0x01) + { + a_pad_len = 1; + } + } + + if (p_ctx->v_extra && p_ctx->v_extra_len) + { + v_extra_len = p_ctx->v_extra_len; + + if (v_extra_len & 0x01) + { + v_pad_len = 1; + } + } + + avi_write_fourcc(p_ctx, "RIFF"); + avi_write_uint32(p_ctx, p_ctx->i_riff > 0 ? p_ctx->i_riff - 8 : 0xFFFFFFFF); // Total file length - ('RIFF') - 4 + avi_write_fourcc(p_ctx, "AVI "); + + avi_write_fourcc(p_ctx, "LIST"); + + tlen = 4 + avih_len; + + if (p_ctx->ctxf_video == 1) + { + tlen += s_v_ll + v_extra_len + v_pad_len; + } + + if (p_ctx->ctxf_audio == 1) + { + tlen += s_a_ll + a_extra_len + a_pad_len; + } + + avi_write_uint32(p_ctx, tlen); + + avi_write_fourcc(p_ctx, "hdrl"); + + avi_write_fourcc(p_ctx, "avih"); + avi_write_uint32(p_ctx, sizeof(AVIMHDR)); + + if (p_ctx->v_fps == 0) + { + p_ctx->avi_hdr.dwMicroSecPerFrame = 1000000 / 25; // Video frame interval (in microseconds) + } + else + { + p_ctx->avi_hdr.dwMicroSecPerFrame = 1000000 / p_ctx->v_fps; // Video frame interval (in microseconds) + } + + p_ctx->avi_hdr.dwMaxBytesPerSec = 0xffffffff; // The maximum data rate of this AVI file + p_ctx->avi_hdr.dwPaddingGranularity = 0; // Granularity of data padding + p_ctx->avi_hdr.dwFlags = AVIF_HASINDEX|AVIF_ISINTERLEAVED|AVIF_TRUSTCKTYPE; + p_ctx->avi_hdr.dwTotalFrames = p_ctx->i_frame_video; // Total number of frames + p_ctx->avi_hdr.dwInitialFrames = 0; // Specify the initial number of frames for the interactive format + + if (p_ctx->ctxf_audio == 1) + { + p_ctx->avi_hdr.dwStreams = 2; // The number of streams included in this file + } + else + { + p_ctx->avi_hdr.dwStreams = 1; // The number of streams included in this file + } + + p_ctx->avi_hdr.dwSuggestedBufferSize= 1024*1024; // It is recommended to read the cache size of this file (should be able to accommodate the largest block) + p_ctx->avi_hdr.dwWidth = p_ctx->v_width; // The width of the video in pixels + p_ctx->avi_hdr.dwHeight = p_ctx->v_height; // The height of the video in pixels + + avi_write_buffer(p_ctx, (char*)&p_ctx->avi_hdr, sizeof(AVIMHDR)); + + if (p_ctx->ctxf_video == 1) + { + avi_write_fourcc(p_ctx, "LIST"); + avi_write_uint32(p_ctx, 4 + strl_v_len + v_extra_len + v_pad_len); + avi_write_fourcc(p_ctx, "strl"); // How many streams are there in the file, and how many 'strl' sublists there are + + avi_write_fourcc(p_ctx, "strh"); + avi_write_uint32(p_ctx, sizeof(AVISHDR)); + avi_write_buffer(p_ctx, (char*)&p_ctx->str_v, sizeof(AVISHDR)); + + avi_write_fourcc(p_ctx, "strf"); + avi_write_uint32(p_ctx, sizeof(BMPHDR) + v_extra_len); + avi_write_buffer(p_ctx, (char*)&p_ctx->bmp, sizeof(BMPHDR)); + + // Write video extra information + + if (p_ctx->v_extra && p_ctx->v_extra_len) + { + avi_write_buffer(p_ctx, (char*)p_ctx->v_extra, p_ctx->v_extra_len); + + if (v_pad_len) /* pad */ + { + fputc(0, p_ctx->fp); + } + } + } + + if (p_ctx->ctxf_audio == 1) + { + avi_write_fourcc(p_ctx, "LIST"); + avi_write_uint32(p_ctx, 4 + strl_a_len + a_extra_len + a_pad_len); + avi_write_fourcc(p_ctx, "strl"); + + avi_write_fourcc(p_ctx, "strh"); + avi_write_uint32(p_ctx, sizeof(AVISHDR)); + avi_write_buffer(p_ctx, (char*)&p_ctx->str_a, sizeof(AVISHDR)); + + avi_write_fourcc(p_ctx, "strf"); + avi_write_uint32(p_ctx, sizeof(WAVEFMT) + a_extra_len); + avi_write_buffer(p_ctx, (char*)&p_ctx->wave, sizeof(WAVEFMT)); + + // Write audio extra information + + if (p_ctx->a_extra && p_ctx->a_extra_len) + { + avi_write_buffer(p_ctx, (char*)p_ctx->a_extra, p_ctx->a_extra_len); + + if (a_pad_len) /* pad */ + { + fputc(0, p_ctx->fp); + } + } + } + + avi_write_fourcc(p_ctx, "LIST"); + avi_write_uint32(p_ctx, p_ctx->i_movi_end > 0 ? (p_ctx->i_movi_end - p_ctx->i_movi + 4) : 0xFFFFFFFF); + avi_write_fourcc(p_ctx, "movi"); + + p_ctx->i_movi = ftell(p_ctx->fp); + + if (p_ctx->i_movi < 0) + { + goto w_err; + } + + return 0; + +w_err: + + if (p_ctx->fp) + { + fclose(p_ctx->fp); + p_ctx->fp = NULL; + } + + return -1; +} + +int avi_update_header(AVICTX * p_ctx) +{ + log_print(HT_LOG_DBG, "%s, enter...\r\n", __FUNCTION__); + + if (NULL == p_ctx) + { + return -1; + } + + sys_os_mutex_enter(p_ctx->mutex); + + if (NULL == p_ctx->fp) + { + sys_os_mutex_leave(p_ctx->mutex); + return -1; + } + + if (avi_write_header(p_ctx) == 0) + { + if (p_ctx->fp) + { + fseek(p_ctx->fp, 0, SEEK_END); + + sys_os_mutex_leave(p_ctx->mutex); + return 0; + } + } + + sys_os_mutex_leave(p_ctx->mutex); + return -1; +} + +int avi_calc_fps(AVICTX * p_ctx) +{ + if (p_ctx->ctxf_calcfps && p_ctx->i_frame_video >= 100) + { + float fps = (float) (p_ctx->i_frame_video * 1000.0) / (p_ctx->v_e_time - p_ctx->v_s_time); + p_ctx->v_fps = (uint32)(fps - 0.5); + + log_print(HT_LOG_DBG, "%s, stime=%u, etime=%u, frames=%d, fps=%d\r\n", + __FUNCTION__, p_ctx->v_s_time, p_ctx->v_e_time, p_ctx->i_frame_video, p_ctx->v_fps); + } + + return 0; +} + +uint64 avi_get_file_length(AVICTX * p_ctx) +{ + if (p_ctx && p_ctx->fp) + { + return ftell(p_ctx->fp); + } + + return 0; +} + +uint32 avi_get_media_time(AVICTX * p_ctx) +{ + if (NULL == p_ctx) + { + return 0; + } + + uint32 vtime = 0, atime = 0; + + if (p_ctx->ctxf_video) + { + vtime = p_ctx->v_e_time - p_ctx->v_s_time; + } + + if (p_ctx->ctxf_audio) + { + atime = p_ctx->a_e_time - p_ctx->a_s_time; + } + + return vtime > atime ? vtime : atime; +} + + + diff --git a/MediaClient/MediaClientForMobile/media/avi_write.h b/MediaClient/MediaClientForMobile/media/avi_write.h new file mode 100644 index 0000000..40932a1 --- /dev/null +++ b/MediaClient/MediaClientForMobile/media/avi_write.h @@ -0,0 +1,61 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef AVI_WRITE_H +#define AVI_WRITE_H + +#include "sys_inc.h" +#include "avi.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +void avi_free_idx(AVICTX * p_ctx); +int avi_write_idx(AVICTX * p_ctx); +void avi_set_dw(void * p, uint32 dw); +int avi_end(AVICTX * p_ctx); +AVICTX* avi_write_open(const char * filename); +int avi_write_video(AVICTX * p_ctx, uint8 * p_data, uint32 len, uint32 ts, int b_key); +int avi_write_nalu(AVICTX * p_ctx, uint8 * vps, int vps_len, uint8 * sps, int sps_len, uint8 * pps, int pps_len); +int avi_write_audio(AVICTX * p_ctx, uint8 * p_data, uint32 len, uint32 ts); +void avi_write_close(AVICTX * p_ctx); +void avi_set_video_info(AVICTX * p_ctx, int fps, int width, int height, const char fcc[4]); +void avi_set_video_extra_info(AVICTX * p_ctx, uint8 * extra, int extra_len); +void avi_set_audio_info(AVICTX * p_ctx, int chns, int rate, uint16 fmt); +void avi_set_audio_extra_info(AVICTX * p_ctx, uint8 * extra, int extra_len); +void avi_build_video_hdr(AVICTX * p_ctx); +void avi_build_audio_hdr(AVICTX * p_ctx); +int avi_write_header(AVICTX * p_ctx); +int avi_update_header(AVICTX * p_ctx); +int avi_calc_fps(AVICTX * p_ctx); +uint64 avi_get_file_length(AVICTX * p_ctx); +uint32 avi_get_media_time(AVICTX * p_ctx); + + +#ifdef __cplusplus +} +#endif + + +#endif // AVI_WRITE_H + + + diff --git a/MediaClient/MediaClientForMobile/media/file_player.cpp b/MediaClient/MediaClientForMobile/media/file_player.cpp new file mode 100644 index 0000000..cc23c22 --- /dev/null +++ b/MediaClient/MediaClientForMobile/media/file_player.cpp @@ -0,0 +1,831 @@ +/*************************************************************************************** + * + * 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 "file_player.h" +#include "utils.h" +#include "media_codec.h" + + +void * readThread(void * argv) +{ + CFilePlayer * pPlayer = (CFilePlayer *) argv; + + pPlayer->readThread(); + + return NULL; +} + +void * videoThread(void * argv) +{ + CFilePlayer * pPlayer = (CFilePlayer *) argv; + + pPlayer->videoThread(); + + return NULL; +} + +void * audioThread(void * argv) +{ + CFilePlayer * pPlayer = (CFilePlayer *) argv; + + pPlayer->audioThread(); + + return NULL; +} + + +CFilePlayer::CFilePlayer(QObject * parent) +: CVideoPlayer(parent) +, m_nAudioIndex(-1) +, m_nVideoIndex(-1) +, m_nDuration(0) +, m_nCurPos(0) +, m_bSeek(0) +, m_dSeekPos(0) +, m_nNalLength(0) +, m_pFormatContext(NULL) +, m_hReadThread(0) +, m_hVideoThread(0) +, m_hAudioThread(0) +, m_pVideoQueue(NULL) +, m_pAudioQueue(NULL) +{ + +} + +CFilePlayer::~CFilePlayer() +{ + close(); +} + +BOOL CFilePlayer::openFile(const char * filename) +{ + if (avformat_open_input(&m_pFormatContext, filename, NULL, NULL) != 0) + { + log_print(HT_LOG_ERR, "avformat_open_input failed, %s\r\n", filename); + return FALSE; + } + + avformat_find_stream_info(m_pFormatContext, NULL); + + if (m_pFormatContext->duration != AV_NOPTS_VALUE) + { + m_nDuration = m_pFormatContext->duration; + } + + // find audio & video stream index + for (uint32 i=0; i < m_pFormatContext->nb_streams; i++) + { + if (m_pFormatContext->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) + { + m_nVideoIndex = i; + + if (m_nDuration < m_pFormatContext->streams[i]->duration) + { + m_nDuration = m_pFormatContext->streams[i]->duration; + } + } + else if (m_pFormatContext->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) + { + m_nAudioIndex = i; + + if (m_nDuration < m_pFormatContext->streams[i]->duration) + { + m_nDuration = m_pFormatContext->streams[i]->duration; + } + } + } + + m_nDuration /= 1000; // to millisecond + + // has video stream + if (m_nVideoIndex != -1) + { + AVCodecParameters * codecpar = m_pFormatContext->streams[m_nVideoIndex]->codecpar; + + if (codecpar->codec_id == AV_CODEC_ID_H264) + { + if (codecpar->extradata && codecpar->extradata_size > 8) + { + if (codecpar->extradata[0] == 1) + { + // Store right nal length size that will be used to parse all other nals + m_nNalLength = (codecpar->extradata[4] & 0x03) + 1; + } + } + + const AVBitStreamFilter * bsfc = av_bsf_get_by_name("h264_mp4toannexb"); + if (bsfc) + { + int ret; + + AVBSFContext *bsf; + av_bsf_alloc(bsfc, &bsf); + + ret = avcodec_parameters_copy(bsf->par_in, codecpar); + if (ret < 0) + { + return FALSE; + } + + ret = av_bsf_init(bsf); + if (ret < 0) + { + return FALSE; + } + + ret = avcodec_parameters_copy(codecpar, bsf->par_out); + if (ret < 0) + { + return FALSE; + } + + av_bsf_free(&bsf); + } + } + else if (codecpar->codec_id == AV_CODEC_ID_HEVC) + { + if (codecpar->extradata && codecpar->extradata_size > 8) + { + if (codecpar->extradata[0] || codecpar->extradata[1] || codecpar->extradata[2] > 1) + { + m_nNalLength = 4; + } + } + + const AVBitStreamFilter * bsfc = av_bsf_get_by_name("hevc_mp4toannexb"); + if (bsfc) + { + int ret; + + AVBSFContext *bsf; + av_bsf_alloc(bsfc, &bsf); + + ret = avcodec_parameters_copy(bsf->par_in, codecpar); + if (ret < 0) + { + return FALSE; + } + + ret = av_bsf_init(bsf); + if (ret < 0) + { + return FALSE; + } + + ret = avcodec_parameters_copy(codecpar, bsf->par_out); + if (ret < 0) + { + return FALSE; + } + + av_bsf_free(&bsf); + } + } + } + + return TRUE; +} + +BOOL CFilePlayer::open(QString fileName, WId hWnd) +{ + BOOL ret = FALSE; + + close(); + + CVideoPlayer::open(fileName, hWnd); + + ret = openFile(fileName.toStdString().c_str()); + if (ret) + { + if (m_nVideoIndex >= 0) + { + AVCodecParameters * codecpar = m_pFormatContext->streams[m_nVideoIndex]->codecpar; + + openVideo(codecpar->codec_id, codecpar->extradata, codecpar->extradata_size); + } + + if (m_nAudioIndex >= 0) + { + AVCodecParameters * codecpar = m_pFormatContext->streams[m_nAudioIndex]->codecpar; + + openAudio(codecpar->codec_id, codecpar->sample_rate, codecpar->channels, codecpar->bits_per_coded_sample); + } + } + + return ret; +} + +void CFilePlayer::close() +{ + m_bPlaying = FALSE; + + HTPACKET packet; + memset(&packet, 0, sizeof(packet)); + + clearQueue(m_pAudioQueue); + clearQueue(m_pVideoQueue); + + hqBufPut(m_pAudioQueue, (char *)&packet); + hqBufPut(m_pVideoQueue, (char *)&packet); + + while (m_hAudioThread) + { + usleep(100*1000); + } + + while (m_hVideoThread) + { + usleep(100*1000); + } + + while (m_hReadThread) + { + usleep(100*1000); + } + + clearQueue(m_pAudioQueue); + clearQueue(m_pVideoQueue); + + hqDelete(m_pAudioQueue); + m_pAudioQueue = NULL; + + hqDelete(m_pVideoQueue); + m_pVideoQueue = NULL; + + if (m_pFormatContext) + { + avformat_close_input(&m_pFormatContext); + } + + CVideoPlayer::close(); +} + +BOOL CFilePlayer::play() +{ + if (m_bPlaying) + { + return TRUE; + } + + m_bPlaying = TRUE; + + if (m_nVideoIndex >= 0) + { + m_pVideoQueue = hqCreate(30, sizeof(HTPACKET), HQ_PUT_WAIT | HQ_GET_WAIT); + + m_hVideoThread = sys_os_create_thread((void *)::videoThread, this); + + AVCodecParameters * codecpar = m_pFormatContext->streams[m_nVideoIndex]->codecpar; + + if (codecpar->codec_id == AV_CODEC_ID_H264 || codecpar->codec_id == AV_CODEC_ID_HEVC) + { + if (codecpar->extradata && codecpar->extradata_size > 8) + { + playVideo(codecpar->extradata, codecpar->extradata_size, 0, 0); + } + } + } + + if (m_nAudioIndex >= 0) + { + m_pAudioQueue = hqCreate(30, sizeof(HTPACKET), HQ_PUT_WAIT | HQ_GET_WAIT); + + m_hAudioThread = sys_os_create_thread((void *)::audioThread, this); + } + + m_hReadThread = sys_os_create_thread((void *)::readThread, this); + + return TRUE; +} + +void CFilePlayer::stop() +{ + close(); +} + +BOOL CFilePlayer::pause() +{ + if (!m_bPaused) + { + m_bPaused = TRUE; + } + else + { + m_bPaused = FALSE; + } + + return m_bPaused; +} + +BOOL CFilePlayer::seek(int pos) +{ + if (pos < 0 || pos > 100) + { + return FALSE; + } + + m_bSeek = 1; + m_dSeekPos = m_nDuration / 100 * pos; + + return TRUE; +} + +int CFilePlayer::getVideoCodec() +{ + int codec = VIDEO_CODEC_NONE; + + if (m_nVideoIndex >= 0 && m_pFormatContext) + { + AVCodecParameters * codecpar = m_pFormatContext->streams[m_nVideoIndex]->codecpar; + + codec = to_video_codec(codecpar->codec_id); + } + + return codec; +} + +int CFilePlayer::getAudioCodec() +{ + int codec = AUDIO_CODEC_NONE; + + if (m_nAudioIndex >= 0 && m_pFormatContext) + { + AVCodecParameters * codecpar = m_pFormatContext->streams[m_nAudioIndex]->codecpar; + + codec = to_audio_codec(codecpar->codec_id); + } + + return codec; +} + +void CFilePlayer::videoData(uint8 * data, int size, int64 pts, int waitnext) +{ + HTPACKET packet; + + packet.data = (uint8 *) malloc(size); + if (packet.data) + { + memcpy(packet.data, data, size); + packet.size = size; + packet.ts = pts; + packet.waitnext = waitnext; + + if (!hqBufPut(m_pVideoQueue, (char *)&packet)) + { + free(packet.data); + } + } +} + +void CFilePlayer::audioData(uint8 * data, int size, int64 pts) +{ + HTPACKET packet; + + packet.data = (uint8 *) malloc(size); + if (packet.data) + { + memcpy(packet.data, data, size); + packet.size = size; + packet.ts = pts; + packet.waitnext = 0; + + if (!hqBufPut(m_pAudioQueue, (char *)&packet)) + { + free(packet.data); + } + } +} + +BOOL CFilePlayer::readFrame() +{ + int rret = 0; + AVPacket pkt; + + if (NULL == m_pFormatContext) + { + return FALSE; + } + + av_init_packet(&pkt); + pkt.data = 0; + pkt.size = 0; + + rret = av_read_frame(m_pFormatContext, &pkt); + if (AVERROR_EOF == rret) + { + rret = av_seek_frame(m_pFormatContext, 0, m_pFormatContext->streams[0]->start_time, 0); + if (rret < 0) + { + rret = av_seek_frame(m_pFormatContext, 0, 0, AVSEEK_FLAG_BYTE | AVSEEK_FLAG_BACKWARD); + if (rret < 0) + { + return FALSE; + } + } + + if (av_read_frame(m_pFormatContext, &pkt) != 0) + { + return FALSE; + } + } + else if (0 != rret) + { + return FALSE; + } + + int64 pts = AV_NOPTS_VALUE; + + if (pkt.pts != AV_NOPTS_VALUE) + { + pts = pkt.pts; + + if (m_pFormatContext->start_time != AV_NOPTS_VALUE) + { + pts -= m_pFormatContext->start_time; + } + } + else if (pkt.dts != AV_NOPTS_VALUE) + { + pts = pkt.dts; + + if (m_pFormatContext->start_time != AV_NOPTS_VALUE) + { + pts -= m_pFormatContext->start_time; + } + } + + if (pkt.stream_index == m_nVideoIndex) + { + AVCodecParameters * codecpar = m_pFormatContext->streams[m_nVideoIndex]->codecpar; + + if (codecpar->codec_id == AV_CODEC_ID_H264 || codecpar->codec_id == AV_CODEC_ID_HEVC) + { + if (m_nNalLength) + { + uint8 * data = pkt.data; + int size = pkt.size; + + while (pkt.size >= m_nNalLength) + { + int len = 0; + int nal_length = m_nNalLength; + uint8 * pdata = pkt.data; + + while (nal_length--) + { + len = (len << 8) | *pdata++; + } + + if (len > pkt.size - m_nNalLength || len <= 0) + { + log_print(HT_LOG_DBG, "len=%d, pkt.size=%d\r\n", len, pkt.size); + break; + } + + nal_length = m_nNalLength; + pkt.data[nal_length-1] = 1; + nal_length--; + while (nal_length--) + { + pkt.data[nal_length] = 0; + } + + pkt.data += len + m_nNalLength; + pkt.size -= len + m_nNalLength; + } + + videoData(data, size, pts, 1); + } + else if (pkt.data[0] == 0 && pkt.data[1] == 0 && pkt.data[2] == 0 && pkt.data[3] == 1) + { + videoData(pkt.data, pkt.size, pts, 1); + } + else if (pkt.data[0] == 0 && pkt.data[1] == 0 && pkt.data[2] == 1) + { + videoData(pkt.data, pkt.size, pts, 1); + } + else + { + log_print(HT_LOG_ERR, "%s, unknown format\r\n", __FUNCTION__); + } + } + else + { + videoData(pkt.data, pkt.size, pts, 1); + } + } + else if (pkt.stream_index == m_nAudioIndex) + { + audioData(pkt.data, pkt.size, pts); + } + + av_packet_unref(&pkt); + + return TRUE; +} + +void CFilePlayer::readThread() +{ + while (m_bPlaying) + { + if (m_bPaused) + { + usleep(100*1000); + continue; + } + + if (m_bSeek) + { + if (seekStream(m_dSeekPos)) + { + clearQueue(m_pVideoQueue); + clearQueue(m_pAudioQueue); + } + + m_bSeek = 0; + } + + if (!readFrame()) + { + break; + } + } + + log_print(HT_LOG_INFO, "%s, exit!\r\n", __FUNCTION__); + + m_hReadThread = 0; +} + +void CFilePlayer::videoThread() +{ + HTPACKET packet; + int64 pts = 0; + int64 cur_delay = 0; + int64 pre_delay = 0; + uint32 cur_time = 0; + uint32 pre_time = 0; + int timeout = 1000000.0 / getFramerate(); + + while (m_bPlaying) + { + if (m_bPaused) + { + pre_time = 0; + usleep(100*1000); + continue; + } + + if (hqBufGet(m_pVideoQueue, (char *)&packet)) + { + if (NULL == packet.data || 0 == packet.size) + { + break; + } + + if (packet.ts != AV_NOPTS_VALUE) + { + AVRational q = {1, AV_TIME_BASE}; + pts = av_rescale_q (packet.ts, m_pFormatContext->streams[m_nVideoIndex]->time_base, q); + pts /= 1000; + + m_nCurPos = pts; + } + + playVideo(packet.data, packet.size, pts, 0); + + free(packet.data); + + if (packet.waitnext) + { + cur_time = sys_os_get_ms(); + cur_delay = timeout; + + if (pre_time > 0) + { + cur_delay += pre_delay - (cur_time - pre_time) * 1000; + if (cur_delay < 1000) + { + cur_delay = 0; + } + } + + pre_time = cur_time; + pre_delay = cur_delay; + + if (cur_delay > 0) + { + usleep(cur_delay); + } + } + } + } + + log_print(HT_LOG_INFO, "%s, exit!\r\n", __FUNCTION__); + + m_hVideoThread = 0; +} + +void CFilePlayer::audioThread() +{ + HTPACKET packet; + int64 pts = 0; + + while (m_bPlaying) + { + if (m_bPaused) + { + usleep(100*1000); + continue; + } + + if (hqBufGet(m_pAudioQueue, (char *)&packet)) + { + if (NULL == packet.data || 0 == packet.size) + { + break; + } + + if (packet.ts != AV_NOPTS_VALUE) + { + AVRational q = {1, AV_TIME_BASE}; + pts = av_rescale_q (packet.ts, m_pFormatContext->streams[m_nAudioIndex]->time_base, q); + pts /= 1000; + + m_nCurPos = pts; + } + + playAudio(packet.data, packet.size, pts, 0); + + free(packet.data); + } + } + + log_print(HT_LOG_INFO, "%s, exit!\r\n", __FUNCTION__); + + m_hAudioThread = 0; +} + +void CFilePlayer::clearQueue(HQUEUE * queue) +{ + HTPACKET packet; + + while (!hqBufIsEmpty(queue)) + { + if (hqBufGet(queue, (char *)&packet)) + { + if (packet.data != NULL && packet.size != 0) + { + free(packet.data); + } + } + else + { + // should be not to here + log_print(HT_LOG_ERR, "%s, hqBufGet failed\r\n", __FUNCTION__); + break; + } + } +} + +BOOL CFilePlayer::seekStream(double pos) +{ + if (pos < 0) + { + return FALSE; + } + + if (pos == m_nCurPos) + { + return TRUE; + } + + int stream = -1; + int64 seekpos = pos * 1000; + + if (m_nAudioIndex >= 0) + { + stream = m_nAudioIndex; + } + else if (m_nVideoIndex >= 0) + { + stream = m_nVideoIndex; + } + + if (m_pFormatContext->start_time != AV_NOPTS_VALUE) + { + seekpos += m_pFormatContext->start_time; + } + + if (stream >= 0) + { + AVRational q = {1, AV_TIME_BASE}; + + seekpos = av_rescale_q(seekpos, q, m_pFormatContext->streams[stream]->time_base); + } + + if (av_seek_frame(m_pFormatContext, stream, seekpos, AVSEEK_FLAG_BACKWARD) < 0) + { + return FALSE; + } + + // Accurate seek to the specified position + AVPacket pkt; + + av_init_packet(&pkt); + pkt.data = 0; + pkt.size = 0; + + while (av_read_frame(m_pFormatContext, &pkt) == 0) + { + if (pkt.stream_index != stream) + { + av_packet_unref(&pkt); + continue; + } + + if (pkt.pts != AV_NOPTS_VALUE) + { + if (pkt.pts < seekpos) + { + av_packet_unref(&pkt); + continue; + } + else + { + break; + } + } + else if (pkt.dts != AV_NOPTS_VALUE) + { + if (pkt.dts < seekpos) + { + av_packet_unref(&pkt); + continue; + } + else + { + break; + } + } + else + { + break; + } + + av_packet_unref(&pkt); + } + + av_packet_unref(&pkt); + + m_nCurPos = pos; + + return TRUE; +} + +double CFilePlayer::getFramerate() +{ + double framerate = 25; + + if (m_nVideoIndex != -1) + { + if (m_pFormatContext->streams[m_nVideoIndex]->r_frame_rate.den > 0) + { + framerate = m_pFormatContext->streams[m_nVideoIndex]->r_frame_rate.num / + (double)m_pFormatContext->streams[m_nVideoIndex]->r_frame_rate.den; + } + + if ((framerate < 1 || framerate > 60) && + m_pFormatContext->streams[m_nVideoIndex]->avg_frame_rate.den > 0) + { + framerate = m_pFormatContext->streams[m_nVideoIndex]->avg_frame_rate.num / + (double)m_pFormatContext->streams[m_nVideoIndex]->avg_frame_rate.den; + } + + if (framerate < 1 || framerate > 60) + { + framerate = 25; + } + } + + return framerate; +} + + + diff --git a/MediaClient/MediaClientForMobile/media/file_player.h b/MediaClient/MediaClientForMobile/media/file_player.h new file mode 100644 index 0000000..db83dc0 --- /dev/null +++ b/MediaClient/MediaClientForMobile/media/file_player.h @@ -0,0 +1,86 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef FILE_PLAYER_H +#define FILE_PLAYER_H + +#include "video_player.h" + +typedef struct +{ + uint8 * data; + int size; + int64 ts; + int waitnext; +} HTPACKET; + +class CFilePlayer : public CVideoPlayer +{ + Q_OBJECT + +public: + CFilePlayer(QObject * parent = 0); + virtual ~CFilePlayer(); + + BOOL open(QString fileName, WId hWnd); + void close(); + BOOL play(); + void stop(); + BOOL pause(); + BOOL seek(int pos); + int64 getElapse() {return m_nCurPos;}; + int64 getDuration() {return m_nDuration;} + int getVideoCodec(); + int getAudioCodec(); + + void readThread(); + void videoThread(); + void audioThread(); + +private: + BOOL openFile(const char * filename); + BOOL readFrame(); + void videoData(uint8 * data, int size, int64 pts, int waitnext); + void audioData(uint8 * data, int size, int64 pts); + void clearQueue(HQUEUE * queue); + BOOL seekStream(double pos); + double getFramerate(); + +private: + int m_nAudioIndex; // audio stream index + int m_nVideoIndex; // video stream index + int64 m_nDuration; // the stream duration, unit is millisecond + int64 m_nCurPos; // the current play position, unit is millisecond + int m_bSeek; // seek request + double m_dSeekPos; // seek position, nit is millisecond + int m_nNalLength; + + AVFormatContext * m_pFormatContext; // format context + + pthread_t m_hReadThread; // read thread + pthread_t m_hVideoThread; // video thread + pthread_t m_hAudioThread; // audio thread + + HQUEUE * m_pVideoQueue; // video queue + HQUEUE * m_pAudioQueue; // audio queue +}; + +#endif + + diff --git a/MediaClient/MediaClientForMobile/media/format.h b/MediaClient/MediaClientForMobile/media/format.h new file mode 100644 index 0000000..c1e5535 --- /dev/null +++ b/MediaClient/MediaClientForMobile/media/format.h @@ -0,0 +1,45 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef FORMAT_H +#define FORMAT_H + +#define PACKET_TYPE_UNKNOW -1 +#define PACKET_TYPE_VIDEO 0 +#define PACKET_TYPE_AUDIO 1 + +#define AUDIO_FORMAT_PCM (0x0001) +#define AUDIO_FORMAT_G726 (0x0064) +#define AUDIO_FORMAT_G722 (0x028F) +#define AUDIO_FORMAT_MP3 (0x0055) +#define AUDIO_FORMAT_AAC (0x00FF) +#define AUDIO_FORMAT_ALAW (0x0006) +#define AUDIO_FORMAT_MULAW (0x0007) +#define AUDIO_FORMAT_OPUS (0x00AD) + +#ifndef MAKEFOURCC +#define MAKEFOURCC(ch0, ch1, ch2, ch3) \ + ((uint32)(uint8)(ch0) | ((uint32)(uint8)(ch1) << 8) | \ + ((uint32)(uint8)(ch2) << 16) | ((uint32)(uint8)(ch3) << 24 )) +#define mmioFOURCC(ch0, ch1, ch2, ch3) MAKEFOURCC(ch0, ch1, ch2, ch3) +#endif + +#endif + + diff --git a/MediaClient/MediaClientForMobile/media/gles_engine.cpp b/MediaClient/MediaClientForMobile/media/gles_engine.cpp new file mode 100644 index 0000000..220084c --- /dev/null +++ b/MediaClient/MediaClientForMobile/media/gles_engine.cpp @@ -0,0 +1,94 @@ +/*************************************************************************************** + * + * 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 "gles_engine.h" + +#include + +#define CheckError(message) if (result != SL_RESULT_SUCCESS) { log_print(HT_LOG_ERR, "%s\r\n", message); return; } + + +static GlesEngine * g_glesEngine; + +GlesEngine::GlesEngine() +: m_engineObject(0) +, m_engine(0) +{ + SLresult result; + + result = slCreateEngine(&m_engineObject, 0, 0, 0, 0, 0); + CheckError("Failed to create engine"); + + result = (*m_engineObject)->Realize(m_engineObject, SL_BOOLEAN_FALSE); + CheckError("Failed to realize engine"); + + result = (*m_engineObject)->GetInterface(m_engineObject, SL_IID_ENGINE, &m_engine); + CheckError("Failed to get engine interface"); +} + +GlesEngine::~GlesEngine() +{ + if (m_engineObject) + { + (*m_engineObject)->Destroy(m_engineObject); + } +} + +GlesEngine *GlesEngine::instance() +{ + if (NULL == g_glesEngine) + { + g_glesEngine = new GlesEngine(); + } + + return g_glesEngine; +} + +bool GlesEngine::inputFormatIsSupported(SLDataFormat_PCM format) +{ + SLresult result; + SLObjectItf recorder = 0; + SLDataLocator_IODevice loc_dev = { SL_DATALOCATOR_IODEVICE, SL_IODEVICE_AUDIOINPUT, + SL_DEFAULTDEVICEID_AUDIOINPUT, NULL }; + SLDataSource audioSrc = { &loc_dev, NULL }; + +#ifdef ANDROID + SLDataLocator_AndroidSimpleBufferQueue loc_bq = { SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE, 1 }; +#else + SLDataLocator_BufferQueue loc_bq = { SL_DATALOCATOR_BUFFERQUEUE, 1 }; +#endif + SLDataSink audioSnk = { &loc_bq, &format }; + + result = (*m_engine)->CreateAudioRecorder(m_engine, &recorder, &audioSrc, &audioSnk, 0, 0, 0); + if (result == SL_RESULT_SUCCESS) + { + result = (*recorder)->Realize(recorder, false); + } + + if (result == SL_RESULT_SUCCESS) + { + (*recorder)->Destroy(recorder); + return true; + } + + return false; +} + + diff --git a/MediaClient/MediaClientForMobile/media/gles_engine.h b/MediaClient/MediaClientForMobile/media/gles_engine.h new file mode 100644 index 0000000..9cd0147 --- /dev/null +++ b/MediaClient/MediaClientForMobile/media/gles_engine.h @@ -0,0 +1,43 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef _GLES_ENGINE_H_ +#define _GLES_ENGINE_H_ + +#include + +class GlesEngine +{ +public: + GlesEngine(); + ~GlesEngine(); + + static GlesEngine *instance(); + + SLEngineItf slEngine() const { return m_engine; } + + bool inputFormatIsSupported(SLDataFormat_PCM format); + + SLObjectItf m_engineObject; + SLEngineItf m_engine; +}; + +#endif + + diff --git a/MediaClient/MediaClientForMobile/media/gles_input.cpp b/MediaClient/MediaClientForMobile/media/gles_input.cpp new file mode 100644 index 0000000..12e5867 --- /dev/null +++ b/MediaClient/MediaClientForMobile/media/gles_input.cpp @@ -0,0 +1,325 @@ +/*************************************************************************************** + * + * 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 "gles_input.h" +#include "gles_engine.h" + +#ifdef ANDROID +#include +#endif + + +#ifdef ANDROID +static void bufferQueueCallback(SLAndroidSimpleBufferQueueItf, void *context) +#else +static void bufferQueueCallback(SLBufferQueueItf, void *context) +#endif +{ + GlesInput *audioInput = reinterpret_cast(context); + + audioInput->processBuffer(); +} + +GlesInput::GlesInput() +: m_recorderObject(0) +, m_recorder(0) +, m_bufferQueue(0) +, m_bufferSize(1600) +, m_currentBuffer(0) +, m_pCallback(NULL) +, m_pUserdata(NULL) +{ +#ifdef ANDROID + m_recorderPreset = SL_ANDROID_RECORDING_PRESET_GENERIC; +#endif + + for (int i = 0; i < NUM_BUFFERS; i++) + { + m_buffers[i] = NULL; + } +} + +GlesInput::~GlesInput() +{ + stop(); +} + +bool GlesInput::start(int samplerete) +{ + bool ret = false; + + if (startRecording(samplerete)) + { + ret = true; + } + else + { + log_print(HT_LOG_ERR, "start audio recoding faild\r\n"); + + stopRecording(); + } + + return ret; +} + +void GlesInput::stop() +{ + stopRecording(); +} + +bool GlesInput::startRecording(int samplerete) +{ + SLEngineItf engine = GlesEngine::instance()->slEngine(); + if (!engine) + { + log_print(HT_LOG_ERR, "No engine\r\n"); + return false; + } + + SLresult result; + + // configure audio source + SLDataLocator_IODevice loc_dev = { SL_DATALOCATOR_IODEVICE, SL_IODEVICE_AUDIOINPUT, + SL_DEFAULTDEVICEID_AUDIOINPUT, NULL }; + SLDataSource audioSrc = { &loc_dev, NULL }; + + // configure audio sink +#ifdef ANDROID + SLDataLocator_AndroidSimpleBufferQueue loc_bq = { SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE, + NUM_BUFFERS }; +#else + SLDataLocator_BufferQueue loc_bq = { SL_DATALOCATOR_BUFFERQUEUE, NUM_BUFFERS }; +#endif + + SLDataFormat_PCM format_pcm; + + format_pcm.formatType = SL_DATAFORMAT_PCM; + format_pcm.numChannels = 2; + format_pcm.samplesPerSec = samplerete * 1000; + format_pcm.bitsPerSample = SL_PCMSAMPLEFORMAT_FIXED_16; + format_pcm.containerSize = SL_PCMSAMPLEFORMAT_FIXED_16; + format_pcm.channelMask = (SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT); + format_pcm.endianness = SL_BYTEORDER_LITTLEENDIAN; + + SLDataSink audioSnk = { &loc_bq, &format_pcm }; + + // create audio recorder + // (requires the RECORD_AUDIO permission) +#ifdef ANDROID + const SLInterfaceID id[2] = { SL_IID_ANDROIDSIMPLEBUFFERQUEUE, SL_IID_ANDROIDCONFIGURATION }; + const SLboolean req[2] = { SL_BOOLEAN_TRUE, SL_BOOLEAN_TRUE }; +#else + const SLInterfaceID id[1] = { SL_IID_BUFFERQUEUE }; + const SLboolean req[1] = { SL_BOOLEAN_TRUE }; +#endif + + result = (*engine)->CreateAudioRecorder(engine, &m_recorderObject, + &audioSrc, &audioSnk, + sizeof(req) / sizeof(SLboolean), id, req); + if (result != SL_RESULT_SUCCESS) + { + log_print(HT_LOG_ERR, "create audio recorder failed\r\n"); + return false; + } + +#ifdef ANDROID + // configure recorder source + SLAndroidConfigurationItf configItf; + result = (*m_recorderObject)->GetInterface(m_recorderObject, SL_IID_ANDROIDCONFIGURATION, + &configItf); + if (result != SL_RESULT_SUCCESS) + { + log_print(HT_LOG_ERR, "get audio configuration interface failed\r\n"); + return false; + } + + result = (*configItf)->SetConfiguration(configItf, SL_ANDROID_KEY_RECORDING_PRESET, + &m_recorderPreset, sizeof(SLuint32)); + + SLuint32 presetValue = SL_ANDROID_RECORDING_PRESET_NONE; + SLuint32 presetSize = 2*sizeof(SLuint32); // intentionally too big + result = (*configItf)->GetConfiguration(configItf, SL_ANDROID_KEY_RECORDING_PRESET, + &presetSize, (void*)&presetValue); + + if (result != SL_RESULT_SUCCESS || presetValue == SL_ANDROID_RECORDING_PRESET_NONE) + { + log_print(HT_LOG_ERR, "set audio record configuration failed\r\n"); + return false; + } +#endif + + // realize the audio recorder + result = (*m_recorderObject)->Realize(m_recorderObject, SL_BOOLEAN_FALSE); + if (result != SL_RESULT_SUCCESS) + { + log_print(HT_LOG_ERR, "realize audio record object failed\r\n"); + return false; + } + + // get the record interface + result = (*m_recorderObject)->GetInterface(m_recorderObject, SL_IID_RECORD, &m_recorder); + if (result != SL_RESULT_SUCCESS) + { + log_print(HT_LOG_ERR, "get audio record object failed\r\n"); + return false; + } + + // get the buffer queue interface +#ifdef ANDROID + SLInterfaceID bufferqueueItfID = SL_IID_ANDROIDSIMPLEBUFFERQUEUE; +#else + SLInterfaceID bufferqueueItfID = SL_IID_BUFFERQUEUE; +#endif + result = (*m_recorderObject)->GetInterface(m_recorderObject, bufferqueueItfID, &m_bufferQueue); + if (result != SL_RESULT_SUCCESS) + { + log_print(HT_LOG_ERR, "get audio record buff queue failed\r\n"); + return false; + } + + // register callback on the buffer queue + result = (*m_bufferQueue)->RegisterCallback(m_bufferQueue, ::bufferQueueCallback, this); + if (result != SL_RESULT_SUCCESS) + { + log_print(HT_LOG_ERR, "set buffer queue callback failed\r\n"); + return false; + } + + if (m_bufferSize <= 0) + { + m_bufferSize = (16*2/8)*50*samplerete/1000; + } + else + { + int minimumBufSize = (16*2/8)*5*samplerete/1000; + if (m_bufferSize < minimumBufSize) + m_bufferSize = minimumBufSize; + } + + // enqueue empty buffers to be filled by the recorder + for (int i = 0; i < NUM_BUFFERS; ++i) + { + m_buffers[i] = (uint8 *)malloc(m_bufferSize); + if (NULL == m_buffers[i]) + { + return false; + } + + memset(m_buffers[i], 0, m_bufferSize); + + result = (*m_bufferQueue)->Enqueue(m_bufferQueue, m_buffers[i], m_bufferSize); + if (result != SL_RESULT_SUCCESS) + { + log_print(HT_LOG_ERR, "audio record enqueue failed\r\n"); + return false; + } + } + + // start recording + result = (*m_recorder)->SetRecordState(m_recorder, SL_RECORDSTATE_RECORDING); + if (result != SL_RESULT_SUCCESS) + { + log_print(HT_LOG_ERR, "set audio record state failed\r\n"); + return false; + } + + return true; +} + +void GlesInput::stopRecording() +{ + if (m_recorder) + { + (*m_recorder)->SetRecordState(m_recorder, SL_RECORDSTATE_STOPPED); + } + + if (m_bufferQueue) + { + (*m_bufferQueue)->Clear(m_bufferQueue); + } + + if (m_recorderObject) + { + (*m_recorderObject)->Destroy(m_recorderObject); + } + + m_recorder = NULL; + m_bufferQueue = NULL; + m_recorderObject = NULL; + + for (int i = 0; i < NUM_BUFFERS; ++i) + { + if (m_buffers[i]) + { + free(m_buffers[i]); + m_buffers[i] = NULL; + } + } + + m_currentBuffer = 0; +} + +void GlesInput::setBufferSize(int value) +{ + m_bufferSize = value; +} + +int GlesInput::bufferSize() const +{ + return m_bufferSize; +} + +void GlesInput::processBuffer() +{ + uint8 *processedBuffer = m_buffers[m_currentBuffer]; + + if (m_pCallback) + { + m_pCallback(processedBuffer, m_bufferSize, m_pUserdata); + } + + // Re-enqueue the buffer + SLresult result = (*m_bufferQueue)->Enqueue(m_bufferQueue, + processedBuffer, + m_bufferSize); + + m_currentBuffer = (m_currentBuffer + 1) % NUM_BUFFERS; + + // If the buffer queue is empty (shouldn't happen), stop recording. +#ifdef ANDROID + SLAndroidSimpleBufferQueueState state; +#else + SLBufferQueueState state; +#endif + result = (*m_bufferQueue)->GetState(m_bufferQueue, &state); + if (result != SL_RESULT_SUCCESS || state.count == 0) + { + log_print(HT_LOG_ERR, "processBuffer::state.count == 0\r\n"); + } +} + +void GlesInput::setCallback(GlesInputCB cb, void * puser) +{ + m_pCallback = cb; + m_pUserdata = puser; +} + + + diff --git a/MediaClient/MediaClientForMobile/media/gles_input.h b/MediaClient/MediaClientForMobile/media/gles_input.h new file mode 100644 index 0000000..5c370da --- /dev/null +++ b/MediaClient/MediaClientForMobile/media/gles_input.h @@ -0,0 +1,72 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef _GLES_INPUT_H_ +#define _GLES_INPUT_H_ + +#include "sys_inc.h" +#include +#ifdef ANDROID +#include +#endif + +#define NUM_BUFFERS 2 + +typedef void (*GlesInputCB)(uint8 * pdata, int len, void * puser); + + +class GlesInput +{ +public: + GlesInput(); + ~GlesInput(); + + bool start(int samplerete); + void stop(); + void setCallback(GlesInputCB cb, void * puser); + + void setBufferSize(int value); + int bufferSize() const; + void processBuffer(); + +private: + bool startRecording(int samplerete); + void stopRecording(); + + +private: + SLObjectItf m_recorderObject; + SLRecordItf m_recorder; +#ifdef ANDROID + SLuint32 m_recorderPreset; + SLAndroidSimpleBufferQueueItf m_bufferQueue; +#else + SLBufferQueueItf m_bufferQueue; +#endif + + int m_bufferSize; + uint8 * m_buffers[NUM_BUFFERS]; + int m_currentBuffer; + + GlesInputCB m_pCallback; + void * m_pUserdata; +}; + +#endif + diff --git a/MediaClient/MediaClientForMobile/media/http_flv_player.cpp b/MediaClient/MediaClientForMobile/media/http_flv_player.cpp new file mode 100644 index 0000000..d35f6b1 --- /dev/null +++ b/MediaClient/MediaClientForMobile/media/http_flv_player.cpp @@ -0,0 +1,434 @@ +/*************************************************************************************** + * + * 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 "http_flv_player.h" +#include "utils.h" + +/***************************************************************************************/ + +int http_flv_notify_callback(int evt, void * puser) +{ + CHttpFlvPlayer * pPlayer = (CHttpFlvPlayer *) puser; + + pPlayer->onNotify(evt); + return 0; +} + +int http_flv_audio_callback(uint8 * pdata, int len, uint32 ts, void *puser) +{ + CHttpFlvPlayer * pPlayer = (CHttpFlvPlayer *) puser; + + pPlayer->onAudio(pdata, len, ts); + return 0; +} + +int http_flv_video_callback(uint8 * pdata, int len, uint32 ts, void *puser) +{ + CHttpFlvPlayer * pPlayer = (CHttpFlvPlayer *) puser; + + pPlayer->onVideo(pdata, len, ts); + return 0; +} + +/***************************************************************************************/ + +CHttpFlvPlayer::CHttpFlvPlayer(QObject * parent) +: CVideoPlayer(parent) +{ + memset(m_ip, 0, sizeof(m_ip)); +} + +CHttpFlvPlayer::~CHttpFlvPlayer() +{ + close(); +} + +BOOL CHttpFlvPlayer::open(QString fileName, WId hWnd) +{ + close(); + + CVideoPlayer::open(fileName, hWnd); + + char host[100]; + + url_split(fileName.toStdString().c_str(), NULL, 0, NULL, 0, NULL, 0, host, sizeof(host), NULL, NULL, 0); + + if (host[0] == '\0') + { + return FALSE; + } + + strncpy(m_ip, host, sizeof(m_ip) - 1); + + m_httpflv.set_notify_cb(http_flv_notify_callback, this); + m_httpflv.set_audio_cb(http_flv_audio_callback); + m_httpflv.set_video_cb(http_flv_video_callback); + + return TRUE; +} + +void CHttpFlvPlayer::close() +{ + // stop http-flv connection + m_httpflv.http_flv_stop(); + m_httpflv.http_flv_close(); + + m_bPlaying = FALSE; + m_bPaused = FALSE; + + CVideoPlayer::close(); +} + +BOOL CHttpFlvPlayer::play() +{ + if (m_httpflv.http_flv_start(m_sFileName.toStdString().c_str(), m_acct.toStdString().c_str(), m_pass.toStdString().c_str())) + { + m_bPlaying = TRUE; + } + + return m_bPlaying; +} + +void CHttpFlvPlayer::stop() +{ + if (m_bPlaying || m_bPaused) + { + m_httpflv.http_flv_stop(); + } + + m_bPlaying = FALSE; + m_bPaused = FALSE; +} + +BOOL CHttpFlvPlayer::pause() +{ + if (m_bPlaying) + { + if (m_httpflv.http_flv_pause()) + { + m_bPaused = TRUE; + m_bPlaying = FALSE; + } + } + else if (m_bPaused) + { + if (m_httpflv.http_flv_play()) + { + m_bPaused = FALSE; + m_bPlaying = TRUE; + } + } + + return m_bPaused; +} + +BOOL CHttpFlvPlayer::seek(int pos) +{ + return FALSE; +} + +int64 CHttpFlvPlayer::getElapse() +{ + uint32 cur_ts; + uint32 init_ts; + int frequency; + + if (m_videoClock.SyncTime.tv_sec > m_audioClock.SyncTime.tv_sec) + { + cur_ts = m_videoClock.SyncTimestamp; + init_ts = m_httpflv.get_video_init_ts(); + frequency = getVideoClock(); + } + else if (m_videoClock.SyncTime.tv_sec == m_audioClock.SyncTime.tv_sec && + m_videoClock.SyncTime.tv_usec > m_audioClock.SyncTime.tv_usec) + { + cur_ts = m_videoClock.SyncTimestamp; + init_ts = m_httpflv.get_video_init_ts(); + frequency = getVideoClock(); + } + else + { + cur_ts = m_audioClock.SyncTimestamp; + init_ts = m_httpflv.get_audio_init_ts(); + frequency = getAudioClock(); + } + + if (init_ts == 0) + { + return 0; + } + + int64 elapse; + int timestampDiff = cur_ts - init_ts; + + // Divide this by the timestamp frequency to get real time: + double timeDiff = timestampDiff / (double)frequency; + + if (timeDiff >= 0.0) + { + elapse = timeDiff * 1000; + } + else + { + timeDiff = -timeDiff; + elapse = timeDiff * 1000; + } + + return elapse; +} + +int64 CHttpFlvPlayer::getDuration() +{ + return 0; +} + +int CHttpFlvPlayer::getVideoCodec() +{ + return m_httpflv.video_codec(); +} + +int CHttpFlvPlayer::getAudioCodec() +{ + return m_httpflv.audio_codec(); +} + +void CHttpFlvPlayer::onNotify(int evt) +{ + if (evt == HTTP_FLV_EVE_VIDEOREADY) + { + int videoCodec = m_httpflv.video_codec(); + + if (VIDEO_CODEC_NONE != videoCodec) + { + BOOL ret; + uint8 extradata[1024]; + int extradata_size = 0; + + if (VIDEO_CODEC_H264 == videoCodec) + { + ret = m_httpflv.get_h264_params(m_h26XParamSets.sps, &m_h26XParamSets.sps_size, + m_h26XParamSets.pps, &m_h26XParamSets.pps_size); + if (ret) + { + memcpy(extradata, m_h26XParamSets.sps, m_h26XParamSets.sps_size); + extradata_size += m_h26XParamSets.sps_size; + memcpy(extradata+extradata_size, m_h26XParamSets.pps, m_h26XParamSets.pps_size); + extradata_size += m_h26XParamSets.pps_size; + + // init video decoder + openVideo(videoCodec, extradata, extradata_size); + } + } + else if (VIDEO_CODEC_H265 == videoCodec) + { + ret = m_httpflv.get_h265_params(m_h26XParamSets.sps, &m_h26XParamSets.sps_size, + m_h26XParamSets.pps, &m_h26XParamSets.pps_size, + m_h26XParamSets.vps, &m_h26XParamSets.vps_size); + if (ret) + { + memcpy(extradata, m_h26XParamSets.vps, m_h26XParamSets.vps_size); + extradata_size += m_h26XParamSets.vps_size; + memcpy(extradata+extradata_size, m_h26XParamSets.sps, m_h26XParamSets.sps_size); + extradata_size += m_h26XParamSets.sps_size; + memcpy(extradata+extradata_size, m_h26XParamSets.pps, m_h26XParamSets.pps_size); + extradata_size += m_h26XParamSets.pps_size; + + // init video decoder + openVideo(videoCodec, extradata, extradata_size); + } + } + else + { + openVideo(videoCodec); + } + } + } + else if (evt == HTTP_FLV_EVE_AUDIOREADY) + { + int audioCodec = m_httpflv.audio_codec(); + + if (AUDIO_CODEC_NONE != audioCodec) + { + openAudio(audioCodec, m_httpflv.get_audio_samplerate(), m_httpflv.get_audio_channels()); + } + } + + emit notify(evt); +} + +void CHttpFlvPlayer::onAudio(uint8 * pdata, int len, uint32 ts) +{ + playAudio(pdata, len, ts, 0); +} + +void CHttpFlvPlayer::onVideo(uint8 * pdata, int len, uint32 ts) +{ + playVideo(pdata, len, ts, 0); +} + +BOOL CHttpFlvPlayer::onRecord() +{ + CHttpFlvClient * p_httpflv = &m_httpflv; + AVICTX * p_avictx = m_pAviCtx; + + int vcodec = p_httpflv->video_codec(); + int fps = p_httpflv->get_video_framerate(); + int v_extra_len = 0; + uint8 v_extra[1024]; + + if (VIDEO_CODEC_H264 == vcodec) + { + avi_set_video_info(p_avictx, fps, 0, 0, "H264"); + + uint8 sps[512], pps[512]; + int sps_len = 0, pps_len = 0; + + if (p_httpflv->get_h264_params(sps, &sps_len, pps, &pps_len)) + { + memcpy(v_extra, sps, sps_len); + memcpy(v_extra + sps_len, pps, pps_len); + + v_extra_len = sps_len + pps_len; + } + + if (v_extra_len > 0) + { + avi_set_video_extra_info(p_avictx, v_extra, v_extra_len); + } + } + else if (VIDEO_CODEC_H265 == vcodec) + { + avi_set_video_info(p_avictx, fps, 0, 0, "H265"); + + uint8 vps[512], sps[512], pps[512]; + int vps_len = 0, sps_len = 0, pps_len = 0; + + if (p_httpflv->get_h265_params(sps, &sps_len, pps, &pps_len, vps, &vps_len)) + { + memcpy(v_extra, vps, vps_len); + memcpy(v_extra + vps_len, sps, sps_len); + memcpy(v_extra + vps_len + sps_len, pps, pps_len); + + v_extra_len = vps_len + sps_len + pps_len; + } + + if (v_extra_len > 0) + { + avi_set_video_extra_info(p_avictx, v_extra, v_extra_len); + } + } + else if (VIDEO_CODEC_JPEG == vcodec) + { + avi_set_video_info(p_avictx, fps, 0, 0, "JPEG"); + } + else if (VIDEO_CODEC_MP4 == vcodec) + { + avi_set_video_info(p_avictx, fps, 0, 0, "MP4V"); + } + + int acodec = p_httpflv->audio_codec(); + int sr = p_httpflv->get_audio_samplerate(); + int ch = p_httpflv->get_audio_channels(); + + if (AUDIO_CODEC_G711A == acodec) + { + avi_set_audio_info(p_avictx, ch, sr, AUDIO_FORMAT_ALAW); + } + else if (AUDIO_CODEC_G711U == acodec) + { + avi_set_audio_info(p_avictx, ch, sr, AUDIO_FORMAT_MULAW); + } + else if (AUDIO_CODEC_G726 == acodec) + { + avi_set_audio_info(p_avictx, ch, sr, AUDIO_FORMAT_G726); + } + else if (AUDIO_CODEC_G722 == acodec) + { + avi_set_audio_info(p_avictx, ch, sr, AUDIO_FORMAT_G722); + } + else if (AUDIO_CODEC_AAC == acodec) + { + avi_set_audio_info(p_avictx, ch, sr, AUDIO_FORMAT_AAC); + avi_set_audio_extra_info(p_avictx, p_httpflv->get_audio_config(), p_httpflv->get_audio_config_len()); + } + + avi_update_header(p_avictx); + + if (p_avictx->ctxf_video) + { + if (v_extra_len > 0) + { + recordVideo(v_extra, v_extra_len, 0, 0); + } + } + + return TRUE; +} + +void CHttpFlvPlayer::onRecordFileSwitch() +{ + AVICTX * p_ctx; + AVICTX * p_oldctx = m_pAviCtx; + + QString path = getRecordPath(); + QString file = path + "/" + getTempFile(m_ip, ".avi"); + + p_ctx = avi_write_open(file.toLocal8Bit().toStdString().c_str()); + if (NULL == p_ctx) + { + return; + } + + p_ctx->ctxf_video = p_oldctx->ctxf_video; + p_ctx->ctxf_audio = p_oldctx->ctxf_audio; + + if (p_ctx->ctxf_video) + { + avi_calc_fps(p_oldctx); + avi_set_video_info(p_ctx, p_oldctx->v_fps, p_oldctx->v_width, p_oldctx->v_height, p_oldctx->v_fcc); + avi_set_video_extra_info(p_ctx, p_oldctx->v_extra, p_oldctx->v_extra_len); + } + + if (p_ctx->ctxf_audio) + { + avi_set_audio_info(p_ctx, p_oldctx->a_chns, p_oldctx->a_rate, p_oldctx->a_fmt); + avi_set_audio_extra_info(p_ctx, p_oldctx->a_extra, p_oldctx->a_extra_len); + } + + avi_write_close(p_oldctx); + + avi_update_header(p_ctx); + + m_pAviCtx = p_ctx; + + if (m_h26XParamSets.vps_size > 0 || + m_h26XParamSets.sps_size > 0 || + m_h26XParamSets.pps_size > 0) + { + avi_write_nalu(m_pAviCtx, + m_h26XParamSets.vps, m_h26XParamSets.vps_size, + m_h26XParamSets.sps, m_h26XParamSets.sps_size, + m_h26XParamSets.pps, m_h26XParamSets.pps_size); + } +} + + + + + diff --git a/MediaClient/MediaClientForMobile/media/http_flv_player.h b/MediaClient/MediaClientForMobile/media/http_flv_player.h new file mode 100644 index 0000000..395751b --- /dev/null +++ b/MediaClient/MediaClientForMobile/media/http_flv_player.h @@ -0,0 +1,60 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef HTTP_FLV_PLAYER_H +#define HTTP_FLV_PLAYER_H + +#include "video_player.h" +#include "http_flv_cln.h" + + +class CHttpFlvPlayer : public CVideoPlayer +{ + Q_OBJECT + +public: + CHttpFlvPlayer(QObject * parent = 0); + virtual ~CHttpFlvPlayer(); + + BOOL open(QString fileName, WId hWnd); + void close(); + BOOL play(); + void stop(); + BOOL pause(); + BOOL seek(int pos); + int64 getElapse(); + int64 getDuration(); + int getVideoCodec(); + int getAudioCodec(); + + void onNotify(int evt); + void onAudio(uint8 * pdata, int len, uint32 ts); + void onVideo(uint8 * pdata, int len, uint32 ts); + BOOL onRecord(); + void onRecordFileSwitch(); + +private: + char m_ip[32]; + CHttpFlvClient m_httpflv; +}; + +#endif + + + diff --git a/MediaClient/MediaClientForMobile/media/http_mjpeg_player.cpp b/MediaClient/MediaClientForMobile/media/http_mjpeg_player.cpp new file mode 100644 index 0000000..ad2efe2 --- /dev/null +++ b/MediaClient/MediaClientForMobile/media/http_mjpeg_player.cpp @@ -0,0 +1,183 @@ +/*************************************************************************************** + * + * 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 "http_mjpeg_player.h" +#include "utils.h" + +/***************************************************************************************/ + +int http_mjpeg_notify_callback(int evt, void * puser) +{ + CHttpMjpegPlayer * pPlayer = (CHttpMjpegPlayer *) puser; + + pPlayer->onNotify(evt); + return 0; +} + +int http_mjpeg_video_callback(uint8 * pdata, int len, void *puser) +{ + CHttpMjpegPlayer * pPlayer = (CHttpMjpegPlayer *) puser; + + pPlayer->onVideo(pdata, len, 0); + return 0; +} + + +/***************************************************************************************/ + +CHttpMjpegPlayer::CHttpMjpegPlayer(QObject * parent) +: CVideoPlayer(parent) +{ + memset(m_ip, 0, sizeof(m_ip)); +} + +CHttpMjpegPlayer::~CHttpMjpegPlayer() +{ + close(); +} + +BOOL CHttpMjpegPlayer::open(QString fileName, WId hWnd) +{ + close(); + + CVideoPlayer::open(fileName, hWnd); + + char host[100]; + + url_split(fileName.toStdString().c_str(), NULL, 0, NULL, 0, NULL, 0, host, sizeof(host), NULL, NULL, 0); + + if (host[0] == '\0') + { + return FALSE; + } + + strncpy(m_ip, host, sizeof(m_ip) - 1); + + m_httpmjpeg.set_notify_cb(http_mjpeg_notify_callback, this); + m_httpmjpeg.set_video_cb(http_mjpeg_video_callback); + + return TRUE; +} + +void CHttpMjpegPlayer::close() +{ + // stop http-mjpeg connection + m_httpmjpeg.mjpeg_stop(); + m_httpmjpeg.mjpeg_close(); + + m_bPlaying = FALSE; + m_bPaused = FALSE; + + CVideoPlayer::close(); +} + +BOOL CHttpMjpegPlayer::play() +{ + if (m_httpmjpeg.mjpeg_start(m_sFileName.toStdString().c_str(), m_acct.toStdString().c_str(), m_pass.toStdString().c_str())) + { + m_bPlaying = TRUE; + } + + return m_bPlaying; +} + +void CHttpMjpegPlayer::stop() +{ + if (m_bPlaying || m_bPaused) + { + m_httpmjpeg.mjpeg_stop(); + } + + m_bPlaying = FALSE; + m_bPaused = FALSE; +} + +BOOL CHttpMjpegPlayer::pause() +{ + return m_bPaused; +} + +BOOL CHttpMjpegPlayer::seek(int pos) +{ + return FALSE; +} + +int CHttpMjpegPlayer::getVideoCodec() +{ + return VIDEO_CODEC_JPEG; +} + +void CHttpMjpegPlayer::onNotify(int evt) +{ + if (evt == MJPEG_EVE_CONNSUCC) + { + openVideo(VIDEO_CODEC_JPEG); + } + + emit notify(evt); +} + +void CHttpMjpegPlayer::onVideo(uint8 * pdata, int len, uint32 ts) +{ + playVideo(pdata, len, ts, 0); +} + +BOOL CHttpMjpegPlayer::onRecord() +{ + avi_set_video_info(m_pAviCtx, 0, 0, 0, "JPEG"); + + avi_update_header(m_pAviCtx); + + return TRUE; +} + +void CHttpMjpegPlayer::onRecordFileSwitch() +{ + AVICTX * p_ctx; + AVICTX * p_oldctx = m_pAviCtx; + + QString path = getRecordPath(); + QString file = path + "/" + getTempFile(m_ip, ".avi"); + + p_ctx = avi_write_open(file.toLocal8Bit().toStdString().c_str()); + if (NULL == p_ctx) + { + return; + } + + p_ctx->ctxf_video = p_oldctx->ctxf_video; + + if (p_ctx->ctxf_video) + { + avi_calc_fps(p_oldctx); + avi_set_video_info(p_ctx, p_oldctx->v_fps, p_oldctx->v_width, p_oldctx->v_height, p_oldctx->v_fcc); + avi_set_video_extra_info(p_ctx, p_oldctx->v_extra, p_oldctx->v_extra_len); + } + + avi_write_close(p_oldctx); + + avi_update_header(p_ctx); + + m_pAviCtx = p_ctx; +} + + + + + diff --git a/MediaClient/MediaClientForMobile/media/http_mjpeg_player.h b/MediaClient/MediaClientForMobile/media/http_mjpeg_player.h new file mode 100644 index 0000000..e04d2b3 --- /dev/null +++ b/MediaClient/MediaClientForMobile/media/http_mjpeg_player.h @@ -0,0 +1,56 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef HTTP_MJPEG_PLAYER_H +#define HTTP_MJPEG_PLAYER_H + +#include "video_player.h" +#include "http_mjpeg_cln.h" + + +class CHttpMjpegPlayer : public CVideoPlayer +{ + Q_OBJECT + +public: + CHttpMjpegPlayer(QObject * parent = 0); + virtual ~CHttpMjpegPlayer(); + + BOOL open(QString fileName, WId hWnd); + void close(); + BOOL play(); + void stop(); + BOOL pause(); + BOOL seek(int pos); + int getVideoCodec(); + + void onNotify(int evt); + void onVideo(uint8 * pdata, int len, uint32 ts); + BOOL onRecord(); + void onRecordFileSwitch(); + +private: + char m_ip[32]; + CHttpMjpeg m_httpmjpeg; +}; + +#endif + + + diff --git a/MediaClient/MediaClientForMobile/media/lock.h b/MediaClient/MediaClientForMobile/media/lock.h new file mode 100644 index 0000000..ba106dd --- /dev/null +++ b/MediaClient/MediaClientForMobile/media/lock.h @@ -0,0 +1,37 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef _LOCK_H +#define _LOCK_H + +#include "sys_inc.h" + +class CLock +{ +public: + CLock(void * pMutex) : m_pMutex(pMutex) {sys_os_mutex_enter(m_pMutex);} + ~CLock() {sys_os_mutex_leave(m_pMutex);} + +private: + void * m_pMutex; +}; + +#endif // _LOCK_H + + diff --git a/MediaClient/MediaClientForMobile/media/media_codec.cpp b/MediaClient/MediaClientForMobile/media/media_codec.cpp new file mode 100644 index 0000000..2b83a74 --- /dev/null +++ b/MediaClient/MediaClientForMobile/media/media_codec.cpp @@ -0,0 +1,215 @@ +/*************************************************************************************** + * + * 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 "media_codec.h" +#include "media_format.h" + + +AVCodecID to_audio_avcodecid(int codec) +{ + AVCodecID codecid = AV_CODEC_ID_NONE; + + switch (codec) + { + case AUDIO_CODEC_G711A: + codecid = AV_CODEC_ID_PCM_ALAW; + break; + + case AUDIO_CODEC_G711U: + codecid = AV_CODEC_ID_PCM_MULAW; + break; + + case AUDIO_CODEC_G726: + codecid = AV_CODEC_ID_ADPCM_G726; + break; + + case AUDIO_CODEC_G722: + codecid = AV_CODEC_ID_ADPCM_G722; + break; + + case AUDIO_CODEC_OPUS: + codecid = AV_CODEC_ID_OPUS; + break; + + case AUDIO_CODEC_AAC: + codecid = AV_CODEC_ID_AAC; + break; + } + + return codecid; +} + +AVCodecID to_video_avcodecid(int codec) +{ + AVCodecID codecid = AV_CODEC_ID_NONE; + + switch (codec) + { + case VIDEO_CODEC_H264: + codecid = AV_CODEC_ID_H264; + break; + + case VIDEO_CODEC_H265: + codecid = AV_CODEC_ID_HEVC; + break; + + case VIDEO_CODEC_MP4: + codecid = AV_CODEC_ID_MPEG4; + break; + + case VIDEO_CODEC_JPEG: + codecid = AV_CODEC_ID_MJPEG; + break; + } + + return codecid; +} + +int to_audio_codec(AVCodecID codecid) +{ + int codec = AUDIO_CODEC_NONE; + + switch (codecid) + { + case AV_CODEC_ID_PCM_ALAW: + codec = AUDIO_CODEC_G711A; + break; + + case AV_CODEC_ID_PCM_MULAW: + codec = AUDIO_CODEC_G711U; + break; + + case AV_CODEC_ID_ADPCM_G726: + codec = AUDIO_CODEC_G726; + break; + + case AV_CODEC_ID_ADPCM_G722: + codec = AUDIO_CODEC_G722; + break; + + case AV_CODEC_ID_OPUS: + codec = AUDIO_CODEC_OPUS; + break; + + case AV_CODEC_ID_AAC: + codec = AUDIO_CODEC_AAC; + break; + + default: + break; + } + + return codec; +} + +int to_video_codec(AVCodecID codecid) +{ + int codec = VIDEO_CODEC_NONE; + + switch (codecid) + { + case AV_CODEC_ID_H264: + codec = VIDEO_CODEC_H264; + break; + + case AV_CODEC_ID_HEVC: + codec = VIDEO_CODEC_H265; + break; + + case AV_CODEC_ID_MPEG4: + codec = VIDEO_CODEC_MP4; + break; + + case AV_CODEC_ID_MJPEG: + codec = VIDEO_CODEC_JPEG; + break; + + default: + break; + } + + return codec; +} + +AVPixelFormat to_avpixelformat(int fmt) +{ + AVPixelFormat pixfmt = AV_PIX_FMT_NONE; + + if (VIDEO_FMT_BGR24 == fmt) + { + pixfmt = AV_PIX_FMT_BGR24; + } + else if (VIDEO_FMT_YUV420P == fmt) + { + pixfmt = AV_PIX_FMT_YUV420P; + } + else if (VIDEO_FMT_YUYV422 == fmt) + { + pixfmt = AV_PIX_FMT_YUYV422; + } + else if (VIDEO_FMT_YVYU422 == fmt) + { + pixfmt = AV_PIX_FMT_YVYU422; + } + else if (VIDEO_FMT_UYVY422 == fmt) + { + pixfmt = AV_PIX_FMT_UYVY422; + } + else if (VIDEO_FMT_NV12 == fmt) + { + pixfmt = AV_PIX_FMT_NV12; + } + else if (VIDEO_FMT_NV21 == fmt) + { + pixfmt = AV_PIX_FMT_NV21; + } + else if (VIDEO_FMT_RGB24 == fmt) + { + pixfmt = AV_PIX_FMT_RGB24; + } + else if (VIDEO_FMT_RGB32 == fmt) + { + pixfmt = AV_PIX_FMT_RGB32; + } + else if (VIDEO_FMT_ARGB == fmt) + { + pixfmt = AV_PIX_FMT_ARGB; + } + else if (VIDEO_FMT_BGRA == fmt) + { + pixfmt = AV_PIX_FMT_BGRA; + } + else if (VIDEO_FMT_YV12 == fmt) + { + pixfmt = AV_PIX_FMT_YUV420P; + } + else if (VIDEO_FMT_BGR32 == fmt) + { + pixfmt = AV_PIX_FMT_BGR32; + } + else if (VIDEO_FMT_YUV422P == fmt) + { + pixfmt = AV_PIX_FMT_YUV422P; + } + + return pixfmt; +} + + + diff --git a/MediaClient/MediaClientForMobile/media/media_codec.h b/MediaClient/MediaClientForMobile/media/media_codec.h new file mode 100644 index 0000000..151944d --- /dev/null +++ b/MediaClient/MediaClientForMobile/media/media_codec.h @@ -0,0 +1,43 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef MEDIA_CODEC_H +#define MEDIA_CODEC_H + +extern "C" { +#include +} + +#ifdef __cplusplus +extern "C" { +#endif + +AVCodecID to_audio_avcodecid(int codec); +AVCodecID to_video_avcodecid(int codec); +int to_audio_codec(AVCodecID codecid); +int to_video_codec(AVCodecID codecid); +AVPixelFormat to_avpixelformat(int fmt); + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/MediaClient/MediaClientForMobile/media/media_format.h b/MediaClient/MediaClientForMobile/media/media_format.h new file mode 100644 index 0000000..a505dc2 --- /dev/null +++ b/MediaClient/MediaClientForMobile/media/media_format.h @@ -0,0 +1,64 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef _MEDIA_FORMAT_H +#define _MEDIA_FORMAT_H + +// video pixel format +#define VIDEO_FMT_NONE 0 +#define VIDEO_FMT_YUYV422 1 +#define VIDEO_FMT_YUV420P 2 +#define VIDEO_FMT_YVYU422 3 +#define VIDEO_FMT_UYVY422 4 +#define VIDEO_FMT_NV12 5 +#define VIDEO_FMT_NV21 6 +#define VIDEO_FMT_RGB24 7 +#define VIDEO_FMT_RGB32 8 +#define VIDEO_FMT_ARGB 9 +#define VIDEO_FMT_BGRA 10 +#define VIDEO_FMT_YV12 11 +#define VIDEO_FMT_BGR24 12 +#define VIDEO_FMT_BGR32 13 +#define VIDEO_FMT_YUV422P 14 +#define VIDEO_FMT_MJPG 15 + +// video codec +#define VIDEO_CODEC_NONE 0 +#define VIDEO_CODEC_H264 1 +#define VIDEO_CODEC_MP4 2 +#define VIDEO_CODEC_JPEG 3 +#define VIDEO_CODEC_H265 4 + +// audio codec +#define AUDIO_CODEC_NONE 0 +#define AUDIO_CODEC_G711A 1 +#define AUDIO_CODEC_G711U 2 +#define AUDIO_CODEC_G726 3 +#define AUDIO_CODEC_AAC 4 +#define AUDIO_CODEC_G722 5 +#define AUDIO_CODEC_OPUS 6 + + +#define DATA_TYPE_VIDEO 0 +#define DATA_TYPE_AUDIO 1 +#define DATA_TYPE_METADATA 2 + +#endif // _MEDIA_FORMAT_H + + diff --git a/MediaClient/MediaClientForMobile/media/media_parse.cpp b/MediaClient/MediaClientForMobile/media/media_parse.cpp new file mode 100644 index 0000000..8d14b7b --- /dev/null +++ b/MediaClient/MediaClientForMobile/media/media_parse.cpp @@ -0,0 +1,259 @@ +/*************************************************************************************** + * + * 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 "media_parse.h" +#include "media_format.h" +#include "media_util.h" +#include "h264.h" +#include "h265.h" +#include "mjpeg.h" +#include "h264_util.h" +#include "h265_util.h" +#include "bs.h" +#include + + +int avc_parse_video_size(int codec, uint8 * p_data, uint32 len, int * width, int * height) +{ + uint8 nalu_t; + + if (p_data == NULL || len < 5) + { + return -1; + } + + // Need to parse width X height + + if (VIDEO_CODEC_H264 == codec) + { + int s_len = 0, n_len = 0, parse_len = len; + uint8 * p_cur = p_data; + uint8 * p_end = p_data + len; + + while (p_cur && p_cur < p_end && parse_len > 0) + { + uint8 * p_next = avc_split_nalu(p_cur, parse_len, &s_len, &n_len); + + nalu_t = (p_cur[s_len] & 0x1F); + + int b_start; + nal_t nal; + + nal.i_payload = n_len-s_len-1; + nal.p_payload = p_cur+s_len+1; + nal.i_type = nalu_t; + + if (nalu_t == H264_NAL_SPS) + { + h264_t parse; + h264_parser_init(&parse); + + h264_parser_parse(&parse, &nal, &b_start); + log_print(HT_LOG_INFO, "%s, H264 width[%d],height[%d]\r\n", __FUNCTION__, parse.i_width, parse.i_height); + *width = parse.i_width; + *height = parse.i_height; + return 0; + } + + parse_len -= n_len; + p_cur = p_next; + } + } + else if (VIDEO_CODEC_H265 == codec) + { + int s_len, n_len = 0, parse_len = len; + uint8 * p_cur = p_data; + uint8 * p_end = p_data + len; + + while (p_cur && p_cur < p_end && parse_len > 0) + { + uint8 * p_next = avc_split_nalu(p_cur, parse_len, &s_len, &n_len); + + nalu_t = (p_cur[s_len] >> 1) & 0x3F; + + if (nalu_t == HEVC_NAL_SPS) + { + h265_t parse; + h265_parser_init(&parse); + + if (h265_parser_parse(&parse, p_cur+s_len, n_len-s_len) == 0) + { + log_print(HT_LOG_INFO, "%s, H265 width[%d],height[%d]\r\n", __FUNCTION__, parse.pic_width_in_luma_samples, parse.pic_height_in_luma_samples); + *width = parse.pic_width_in_luma_samples; + *height = parse.pic_height_in_luma_samples; + return 0; + } + } + + parse_len -= n_len; + p_cur = p_next; + } + } + else if (VIDEO_CODEC_JPEG == codec) + { + uint32 offset = 0; + int size_chunk = 0; + + while (offset < len - 8 && p_data[offset] == 0xFF) + { + if (p_data[offset+1] == MARKER_SOF0) + { + int h = ((p_data[offset+5] << 8) | p_data[offset+6]); + int w = ((p_data[offset+7] << 8) | p_data[offset+8]); + log_print(HT_LOG_INFO, "%s, MJPEG width[%d],height[%d]\r\n", __FUNCTION__, w, h); + *width = w; + *height = h; + break; + } + else if (p_data[offset+1] == MARKER_SOI) + { + offset += 2; + } + else + { + size_chunk = ((p_data[offset+2] << 8) | p_data[offset+3]); + offset += 2 + size_chunk; + } + } + } + else if (VIDEO_CODEC_MP4 == codec) + { + uint32 pos = 0; + int vol_f = 0; + int vol_pos = 0; + int vol_len = 0; + + while (pos < len - 4) + { + if (p_data[pos] == 0 && p_data[pos+1] == 0 && p_data[pos+2] == 1) + { + if (p_data[pos+3] >= 0x20 && p_data[pos+3] <= 0x2F) + { + vol_f = 1; + vol_pos = pos+4; + } + else if (vol_f) + { + vol_len = pos - vol_pos; + break; + } + } + + pos++; + } + + if (!vol_f) + { + return 0; + } + else if (vol_len <= 0) + { + vol_len = len - vol_pos; + } + + int vo_ver_id = 0; + + bs_t bs; + bs_init(&bs, &p_data[vol_pos], vol_len * 8); + + bs_skip(&bs, 1); /* random access */ + bs_skip(&bs, 8); /* vo_type */ + + if (bs_read1(&bs)) /* is_ol_id */ + { + vo_ver_id = bs_read(&bs, 4); /* vo_ver_id */ + bs_skip(&bs, 3); /* vo_priority */ + } + + if (bs_read(&bs, 4) == 15) // aspect_ratio_info + { + bs_skip(&bs, 8); // par_width + bs_skip(&bs, 8); // par_height + } + + if (bs_read1(&bs)) /* vol control parameter */ + { + bs_read(&bs, 2); + + bs_skip(&bs, 1); /* low_delay */ + + if (bs_read1(&bs)) + { + /* vbv parameters */ + bs_read(&bs, 15); /* first_half_bitrate */ + bs_skip(&bs, 1); + bs_read(&bs, 15); /* latter_half_bitrate */ + bs_skip(&bs, 1); + bs_read(&bs, 15); /* first_half_vbv_buffer_size */ + bs_skip(&bs, 1); + bs_read(&bs, 3); /* latter_half_vbv_buffer_size */ + bs_read(&bs, 11); /* first_half_vbv_occupancy */ + bs_skip(&bs, 1); + bs_read(&bs, 15); /* latter_half_vbv_occupancy */ + bs_skip(&bs, 1); + } + } + + int shape = bs_read(&bs, 2); /* vol shape */ + + if (shape == 3 && vo_ver_id != 1) + { + bs_skip(&bs, 4); /* video_object_layer_shape_extension */ + } + + bs_skip(&bs, 1); + + int framerate = bs_read(&bs, 16); + + int time_increment_bits = (int) (log(framerate - 1.0) * 1.44269504088896340736 + 1); // log2(framerate - 1) + 1 + if (time_increment_bits < 1) + { + time_increment_bits = 1; + } + + bs_skip(&bs, 1); + + if (bs_read1(&bs) != 0) /* fixed_vop_rate */ + { + bs_skip(&bs, time_increment_bits); + } + + if (shape != 2) + { + if (shape == 0) + { + bs_skip(&bs, 1); + int w = bs_read(&bs, 13); + bs_skip(&bs, 1); + int h = bs_read(&bs, 13); + + log_print(HT_LOG_INFO, "%s, MPEG4 width[%d],height[%d]\r\n", __FUNCTION__, w, h); + *width = w; + *height = h; + return 0; + } + } + } + + return -1; +} + + + + diff --git a/MediaClient/MediaClientForMobile/media/media_parse.h b/MediaClient/MediaClientForMobile/media/media_parse.h new file mode 100644 index 0000000..4a6ec91 --- /dev/null +++ b/MediaClient/MediaClientForMobile/media/media_parse.h @@ -0,0 +1,37 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef MEDIA_PARSE_H +#define MEDIA_PARSE_H + +#include "sys_inc.h" + +#ifdef __cplusplus +extern "C" { +#endif + +int avc_parse_video_size(int codec, uint8 * p_data, uint32 len, int * width, int * height); + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/MediaClient/MediaClientForMobile/media/media_util.cpp b/MediaClient/MediaClientForMobile/media/media_util.cpp new file mode 100644 index 0000000..095d5ac --- /dev/null +++ b/MediaClient/MediaClientForMobile/media/media_util.cpp @@ -0,0 +1,253 @@ +/*************************************************************************************** + * + * 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 "media_util.h" +#include "media_format.h" +#include "h264.h" +#include "h265.h" + +uint32 remove_emulation_bytes(uint8* to, uint32 toMaxSize, uint8* from, uint32 fromSize) +{ + uint32 toSize = 0; + uint32 i = 0; + + while (i < fromSize && toSize+1 < toMaxSize) + { + if (i+2 < fromSize && from[i] == 0 && from[i+1] == 0 && from[i+2] == 3) + { + to[toSize] = to[toSize+1] = 0; + toSize += 2; + i += 3; + } + else + { + to[toSize] = from[i]; + toSize += 1; + i += 1; + } + } + + return toSize; +} + +static uint8 * avc_find_startcode_internal(uint8 *p, uint8 *end) +{ + uint8 *a = p + 4 - ((intptr_t)p & 3); + + for (end -= 3; p < a && p < end; p++) + { + if (p[0] == 0 && p[1] == 0 && p[2] == 1) + { + return p; + } + } + + for (end -= 3; p < end; p += 4) + { + uint32 x = *(const uint32*)p; + + if ((x - 0x01010101) & (~x) & 0x80808080) + { // generic + if (p[1] == 0) + { + if (p[0] == 0 && p[2] == 1) + { + return p; + } + + if (p[2] == 0 && p[3] == 1) + { + return p+1; + } + } + + if (p[3] == 0) + { + if (p[2] == 0 && p[4] == 1) + { + return p+2; + } + + if (p[4] == 0 && p[5] == 1) + { + return p+3; + } + } + } + } + + for (end += 3; p < end; p++) + { + if (p[0] == 0 && p[1] == 0 && p[2] == 1) + { + return p; + } + } + + return end + 3; +} + +uint8 * avc_find_startcode(uint8 *p, uint8 *end) +{ + uint8 *out = avc_find_startcode_internal(p, end); + if (p 4 && e_buf[0] == 0 && e_buf[1] == 0 && e_buf[2] == 0 && e_buf[3] == 1) + { + return (e_buf[4] & 0x1f); + } + else if (len > 3 && e_buf[0] == 0 && e_buf[1] == 0 && e_buf[2] == 1) + { + return (e_buf[3] & 0x1f); + } + else if (len > 0) + { + return (e_buf[0] & 0x1f); + } + + return 0; +} + +uint8 avc_h265_nalu_type(uint8 * e_buf, int len) +{ + if (len > 4 && e_buf[0] == 0 && e_buf[1] == 0 && e_buf[2] == 0 && e_buf[3] == 1) + { + return ((e_buf[4] >> 1) & 0x3f); + } + else if (len > 3 && e_buf[0] == 0 && e_buf[1] == 0 && e_buf[2] == 1) + { + return ((e_buf[3] >> 1) & 0x3f); + } + else if (len > 0) + { + return ((e_buf[0] >> 1) & 0x3f); + } + + return 0; +} + +BOOL avc_get_h26x_paramsets(uint8 * data, int len, int codec, H26XParamSets * ps) +{ + BOOL ret = FALSE; + int s_len = 0, n_len = 0, parse_len = len; + uint8 * p_cur = data; + uint8 * p_end = data + len; + + while (p_cur && p_cur < p_end && parse_len > 0) + { + uint8 nalu; + uint8 * p_next = avc_split_nalu(p_cur, parse_len, &s_len, &n_len); + + if (VIDEO_CODEC_H264 == codec) + { + nalu = avc_h264_nalu_type(p_cur, n_len); + + if (nalu == H264_NAL_SPS && ps->sps_size == 0 && n_len <= (int)sizeof(ps->sps)) + { + memcpy(ps->sps, p_cur, n_len); + ps->sps_size = n_len; + } + else if (nalu == H264_NAL_PPS && ps->pps_size == 0 && n_len <= (int)sizeof(ps->pps)) + { + memcpy(ps->pps, p_cur, n_len); + ps->pps_size = n_len; + } + + if (ps->sps_size > 0 && ps->pps_size > 0) + { + ret = TRUE; + break; + } + } + else if (VIDEO_CODEC_H265 == codec) + { + nalu = avc_h265_nalu_type(p_cur, n_len); + + if (nalu == HEVC_NAL_VPS && ps->vps_size == 0 && n_len <= (int)sizeof(ps->vps)) + { + memcpy(ps->vps, p_cur, n_len); + ps->vps_size = n_len; + } + else if (nalu == HEVC_NAL_SPS && ps->sps_size == 0 && n_len <= (int)sizeof(ps->sps)) + { + memcpy(ps->sps, p_cur, n_len); + ps->sps_size = n_len; + } + else if (nalu == HEVC_NAL_PPS && ps->pps_size == 0 && n_len <= (int)sizeof(ps->pps)) + { + memcpy(ps->pps, p_cur, n_len); + ps->pps_size = n_len; + } + + if (ps->vps_size > 0 && ps->sps_size > 0 && ps->pps_size > 0) + { + ret = TRUE; + break; + } + } + + parse_len -= n_len; + p_cur = p_next; + } + + return ret; +} + + diff --git a/MediaClient/MediaClientForMobile/media/media_util.h b/MediaClient/MediaClientForMobile/media/media_util.h new file mode 100644 index 0000000..231bc92 --- /dev/null +++ b/MediaClient/MediaClientForMobile/media/media_util.h @@ -0,0 +1,53 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef MEDIA_UTIL_H +#define MEDIA_UTIL_H + +#include "sys_inc.h" + +typedef struct +{ + uint8 vps[512]; + int vps_size; + uint8 sps[512]; + int sps_size; + uint8 pps[512]; + int pps_size; +} H26XParamSets; + +#ifdef __cplusplus +extern "C" { +#endif + +uint32 remove_emulation_bytes(uint8* to, uint32 toMaxSize, uint8* from, uint32 fromSize); +uint8 * avc_find_startcode(uint8 *p, uint8 *end); +uint8 * avc_split_nalu(uint8 * e_buf, int e_len, int * s_len, int * d_len); +uint8 avc_h264_nalu_type(uint8 * e_buf, int len); +uint8 avc_h265_nalu_type(uint8 * e_buf, int len); +BOOL avc_get_h26x_paramsets(uint8 * data, int len, int codec, H26XParamSets * ps); + +#ifdef __cplusplus +} +#endif + +#endif + + + diff --git a/MediaClient/MediaClientForMobile/media/rtmp_player.cpp b/MediaClient/MediaClientForMobile/media/rtmp_player.cpp new file mode 100644 index 0000000..ea37a61 --- /dev/null +++ b/MediaClient/MediaClientForMobile/media/rtmp_player.cpp @@ -0,0 +1,434 @@ +/*************************************************************************************** + * + * 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 "rtmp_player.h" +#include "utils.h" + +/***************************************************************************************/ + +int rtmp_notify_callback(int evt, void * puser) +{ + CRtmpPlayer * pPlayer = (CRtmpPlayer *) puser; + + pPlayer->onNotify(evt); + return 0; +} + +int rtmp_audio_callback(uint8 * pdata, int len, uint32 ts, void *puser) +{ + CRtmpPlayer * pPlayer = (CRtmpPlayer *) puser; + + pPlayer->onAudio(pdata, len, ts); + return 0; +} + +int rtmp_video_callback(uint8 * pdata, int len, uint32 ts, void *puser) +{ + CRtmpPlayer * pPlayer = (CRtmpPlayer *) puser; + + pPlayer->onVideo(pdata, len, ts); + return 0; +} + +/***************************************************************************************/ + +CRtmpPlayer::CRtmpPlayer(QObject * parent) +: CVideoPlayer(parent) +{ + memset(m_ip, 0, sizeof(m_ip)); +} + +CRtmpPlayer::~CRtmpPlayer() +{ + close(); +} + +BOOL CRtmpPlayer::open(QString fileName, WId hWnd) +{ + close(); + + CVideoPlayer::open(fileName, hWnd); + + char host[100]; + + url_split(fileName.toStdString().c_str(), NULL, 0, NULL, 0, NULL, 0, host, sizeof(host), NULL, NULL, 0); + + if (host[0] == '\0') + { + return FALSE; + } + + strncpy(m_ip, host, sizeof(m_ip) - 1); + + m_rtmp.set_notify_cb(rtmp_notify_callback, this); + m_rtmp.set_audio_cb(rtmp_audio_callback); + m_rtmp.set_video_cb(rtmp_video_callback); + + return TRUE; +} + +void CRtmpPlayer::close() +{ + // stop rtmp connection + m_rtmp.rtmp_stop(); + m_rtmp.rtmp_close(); + + m_bPlaying = FALSE; + m_bPaused = FALSE; + + CVideoPlayer::close(); +} + +BOOL CRtmpPlayer::play() +{ + if (m_rtmp.rtmp_start(m_sFileName.toStdString().c_str(), m_acct.toStdString().c_str(), m_pass.toStdString().c_str())) + { + m_bPlaying = TRUE; + } + + return m_bPlaying; +} + +void CRtmpPlayer::stop() +{ + if (m_bPlaying || m_bPaused) + { + m_rtmp.rtmp_stop(); + } + + m_bPlaying = FALSE; + m_bPaused = FALSE; +} + +BOOL CRtmpPlayer::pause() +{ + if (m_bPlaying) + { + if (m_rtmp.rtmp_pause()) + { + m_bPaused = TRUE; + m_bPlaying = FALSE; + } + } + else if (m_bPaused) + { + if (m_rtmp.rtmp_play()) + { + m_bPaused = FALSE; + m_bPlaying = TRUE; + } + } + + return m_bPaused; +} + +BOOL CRtmpPlayer::seek(int pos) +{ + return FALSE; +} + +int64 CRtmpPlayer::getElapse() +{ + uint32 cur_ts; + uint32 init_ts; + int frequency; + + if (m_videoClock.SyncTime.tv_sec > m_audioClock.SyncTime.tv_sec) + { + cur_ts = m_videoClock.SyncTimestamp; + init_ts = m_rtmp.get_video_init_ts(); + frequency = getVideoClock(); + } + else if (m_videoClock.SyncTime.tv_sec == m_audioClock.SyncTime.tv_sec && + m_videoClock.SyncTime.tv_usec > m_audioClock.SyncTime.tv_usec) + { + cur_ts = m_videoClock.SyncTimestamp; + init_ts = m_rtmp.get_video_init_ts(); + frequency = getVideoClock(); + } + else + { + cur_ts = m_audioClock.SyncTimestamp; + init_ts = m_rtmp.get_audio_init_ts(); + frequency = getAudioClock(); + } + + if (init_ts == 0) + { + return 0; + } + + int64 elapse; + int timestampDiff = cur_ts - init_ts; + + // Divide this by the timestamp frequency to get real time: + double timeDiff = timestampDiff / (double)frequency; + + if (timeDiff >= 0.0) + { + elapse = timeDiff * 1000; + } + else + { + timeDiff = -timeDiff; + elapse = timeDiff * 1000; + } + + return elapse; +} + +int64 CRtmpPlayer::getDuration() +{ + return 0; +} + +int CRtmpPlayer::getVideoCodec() +{ + return m_rtmp.video_codec(); +} + +int CRtmpPlayer::getAudioCodec() +{ + return m_rtmp.audio_codec(); +} + +void CRtmpPlayer::onNotify(int evt) +{ + if (evt == RTMP_EVE_VIDEOREADY) + { + int videoCodec = m_rtmp.video_codec(); + + if (VIDEO_CODEC_NONE != videoCodec) + { + BOOL ret; + uint8 extradata[1024]; + int extradata_size = 0; + + if (VIDEO_CODEC_H264 == videoCodec) + { + ret = m_rtmp.get_h264_params(m_h26XParamSets.sps, &m_h26XParamSets.sps_size, + m_h26XParamSets.pps, &m_h26XParamSets.pps_size); + if (ret) + { + memcpy(extradata, m_h26XParamSets.sps, m_h26XParamSets.sps_size); + extradata_size += m_h26XParamSets.sps_size; + memcpy(extradata+extradata_size, m_h26XParamSets.pps, m_h26XParamSets.pps_size); + extradata_size += m_h26XParamSets.pps_size; + + // init video decoder + openVideo(videoCodec, extradata, extradata_size); + } + } + else if (VIDEO_CODEC_H265 == videoCodec) + { + ret = m_rtmp.get_h265_params(m_h26XParamSets.sps, &m_h26XParamSets.sps_size, + m_h26XParamSets.pps, &m_h26XParamSets.pps_size, + m_h26XParamSets.vps, &m_h26XParamSets.vps_size); + if (ret) + { + memcpy(extradata, m_h26XParamSets.vps, m_h26XParamSets.vps_size); + extradata_size += m_h26XParamSets.vps_size; + memcpy(extradata+extradata_size, m_h26XParamSets.sps, m_h26XParamSets.sps_size); + extradata_size += m_h26XParamSets.sps_size; + memcpy(extradata+extradata_size, m_h26XParamSets.pps, m_h26XParamSets.pps_size); + extradata_size += m_h26XParamSets.pps_size; + + // init video decoder + openVideo(videoCodec, extradata, extradata_size); + } + } + else + { + openVideo(videoCodec); + } + } + } + else if (evt == RTMP_EVE_AUDIOREADY) + { + int audioCodec = m_rtmp.audio_codec(); + + if (AUDIO_CODEC_NONE != audioCodec) + { + openAudio(audioCodec, m_rtmp.get_audio_samplerate(), m_rtmp.get_audio_channels()); + } + } + + emit notify(evt); +} + +void CRtmpPlayer::onAudio(uint8 * pdata, int len, uint32 ts) +{ + playAudio(pdata, len, ts, 0); +} + +void CRtmpPlayer::onVideo(uint8 * pdata, int len, uint32 ts) +{ + playVideo(pdata, len, ts, 0); +} + +BOOL CRtmpPlayer::onRecord() +{ + CRtmpClient * p_rtmp = &m_rtmp; + AVICTX * p_avictx = m_pAviCtx; + + int vcodec = p_rtmp->video_codec(); + int fps = p_rtmp->get_video_framerate(); + int v_extra_len = 0; + uint8 v_extra[1024]; + + if (VIDEO_CODEC_H264 == vcodec) + { + avi_set_video_info(p_avictx, fps, 0, 0, "H264"); + + uint8 sps[512], pps[512]; + int sps_len = 0, pps_len = 0; + + if (p_rtmp->get_h264_params(sps, &sps_len, pps, &pps_len)) + { + memcpy(v_extra, sps, sps_len); + memcpy(v_extra + sps_len, pps, pps_len); + + v_extra_len = sps_len + pps_len; + } + + if (v_extra_len > 0) + { + avi_set_video_extra_info(p_avictx, v_extra, v_extra_len); + } + } + else if (VIDEO_CODEC_H265 == vcodec) + { + avi_set_video_info(p_avictx, fps, 0, 0, "H265"); + + uint8 vps[512], sps[512], pps[512]; + int vps_len = 0, sps_len = 0, pps_len = 0; + + if (p_rtmp->get_h265_params(sps, &sps_len, pps, &pps_len, vps, &vps_len)) + { + memcpy(v_extra, vps, vps_len); + memcpy(v_extra + vps_len, sps, sps_len); + memcpy(v_extra + vps_len + sps_len, pps, pps_len); + + v_extra_len = vps_len + sps_len + pps_len; + } + + if (v_extra_len > 0) + { + avi_set_video_extra_info(p_avictx, v_extra, v_extra_len); + } + } + else if (VIDEO_CODEC_JPEG == vcodec) + { + avi_set_video_info(p_avictx, fps, 0, 0, "JPEG"); + } + else if (VIDEO_CODEC_MP4 == vcodec) + { + avi_set_video_info(p_avictx, fps, 0, 0, "MP4V"); + } + + int acodec = p_rtmp->audio_codec(); + int sr = p_rtmp->get_audio_samplerate(); + int ch = p_rtmp->get_audio_channels(); + + if (AUDIO_CODEC_G711A == acodec) + { + avi_set_audio_info(p_avictx, ch, sr, AUDIO_FORMAT_ALAW); + } + else if (AUDIO_CODEC_G711U == acodec) + { + avi_set_audio_info(p_avictx, ch, sr, AUDIO_FORMAT_MULAW); + } + else if (AUDIO_CODEC_G726 == acodec) + { + avi_set_audio_info(p_avictx, ch, sr, AUDIO_FORMAT_G726); + } + else if (AUDIO_CODEC_G722 == acodec) + { + avi_set_audio_info(p_avictx, ch, sr, AUDIO_FORMAT_G722); + } + else if (AUDIO_CODEC_AAC == acodec) + { + avi_set_audio_info(p_avictx, ch, sr, AUDIO_FORMAT_AAC); + avi_set_audio_extra_info(p_avictx, p_rtmp->get_audio_config(), p_rtmp->get_audio_config_len()); + } + + avi_update_header(p_avictx); + + if (p_avictx->ctxf_video) + { + if (v_extra_len > 0) + { + recordVideo(v_extra, v_extra_len, 0, 0); + } + } + + return TRUE; +} + +void CRtmpPlayer::onRecordFileSwitch() +{ + AVICTX * p_ctx; + AVICTX * p_oldctx = m_pAviCtx; + + QString path = getRecordPath(); + QString file = path + "/" + getTempFile(m_ip, ".avi"); + + p_ctx = avi_write_open(file.toLocal8Bit().toStdString().c_str()); + if (NULL == p_ctx) + { + return; + } + + p_ctx->ctxf_video = p_oldctx->ctxf_video; + p_ctx->ctxf_audio = p_oldctx->ctxf_audio; + + if (p_ctx->ctxf_video) + { + avi_calc_fps(p_oldctx); + avi_set_video_info(p_ctx, p_oldctx->v_fps, p_oldctx->v_width, p_oldctx->v_height, p_oldctx->v_fcc); + avi_set_video_extra_info(p_ctx, p_oldctx->v_extra, p_oldctx->v_extra_len); + } + + if (p_ctx->ctxf_audio) + { + avi_set_audio_info(p_ctx, p_oldctx->a_chns, p_oldctx->a_rate, p_oldctx->a_fmt); + avi_set_audio_extra_info(p_ctx, p_oldctx->a_extra, p_oldctx->a_extra_len); + } + + avi_write_close(p_oldctx); + + avi_update_header(p_ctx); + + m_pAviCtx = p_ctx; + + if (m_h26XParamSets.vps_size > 0 || + m_h26XParamSets.sps_size > 0 || + m_h26XParamSets.pps_size > 0) + { + avi_write_nalu(m_pAviCtx, + m_h26XParamSets.vps, m_h26XParamSets.vps_size, + m_h26XParamSets.sps, m_h26XParamSets.sps_size, + m_h26XParamSets.pps, m_h26XParamSets.pps_size); + } +} + + + + + diff --git a/MediaClient/MediaClientForMobile/media/rtmp_player.h b/MediaClient/MediaClientForMobile/media/rtmp_player.h new file mode 100644 index 0000000..fc2b342 --- /dev/null +++ b/MediaClient/MediaClientForMobile/media/rtmp_player.h @@ -0,0 +1,60 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef RTMP_PLAYER_H +#define RTMP_PLAYER_H + +#include "video_player.h" +#include "rtmp_cln.h" + + +class CRtmpPlayer : public CVideoPlayer +{ + Q_OBJECT + +public: + CRtmpPlayer(QObject * parent = 0); + virtual ~CRtmpPlayer(); + + BOOL open(QString fileName, WId hWnd); + void close(); + BOOL play(); + void stop(); + BOOL pause(); + BOOL seek(int pos); + int64 getElapse(); + int64 getDuration(); + int getVideoCodec(); + int getAudioCodec(); + + void onNotify(int evt); + void onAudio(uint8 * pdata, int len, uint32 ts); + void onVideo(uint8 * pdata, int len, uint32 ts); + BOOL onRecord(); + void onRecordFileSwitch(); + +private: + char m_ip[32]; + CRtmpClient m_rtmp; +}; + +#endif + + + diff --git a/MediaClient/MediaClientForMobile/media/rtsp_player.cpp b/MediaClient/MediaClientForMobile/media/rtsp_player.cpp new file mode 100644 index 0000000..9ced082 --- /dev/null +++ b/MediaClient/MediaClientForMobile/media/rtsp_player.cpp @@ -0,0 +1,683 @@ +/*************************************************************************************** + * + * 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 "rtsp_player.h" +#include "utils.h" +#include "rtp.h" + +/***************************************************************************************/ + +int rtsp_notify_cb(int evt, void * puser) +{ + CRtspPlayer * pPlayer = (CRtspPlayer *) puser; + + pPlayer->onNotify(evt); + return 0; +} + +int rtsp_audio_cb(uint8 * pdata, int len, uint32 ts, uint16 seq, void *puser) +{ + CRtspPlayer * pPlayer = (CRtspPlayer *) puser; + + pPlayer->onAudio(pdata, len, ts, seq); + return 0; +} + +int rtsp_video_cb(uint8 * pdata, int len, uint32 ts, uint16 seq, void *puser) +{ + CRtspPlayer * pPlayer = (CRtspPlayer *) puser; + + pPlayer->onVideo(pdata, len, ts, seq); + return 0; +} + +int rtsp_rtcp_cb(uint8 * pdata, int len, int type, void *puser) +{ + CRtspPlayer * pPlayer = (CRtspPlayer *) puser; + + pPlayer->onRtcp(pdata, len, type); + return 0; +} + +int rtsp_metadata_cb(uint8 * pdata, int len, uint32 ts, uint16 seq, void *puser) +{ + CRtspPlayer * pPlayer = (CRtspPlayer *) puser; + + return 0; +} + + +/***************************************************************************************/ + +CRtspPlayer::CRtspPlayer(QObject * parent) +: CVideoPlayer(parent) +, m_port(554) +{ + memset(m_ip, 0, sizeof(m_ip)); +} + +CRtspPlayer::~CRtspPlayer() +{ + close(); +} + +BOOL CRtspPlayer::open(QString fileName, WId hWnd) +{ + close(); + + CVideoPlayer::open(fileName, hWnd); + + int port; + char proto[32], username[100], password[100], host[100], path[200]; + + url_split(fileName.toStdString().c_str(), proto, sizeof(proto), username, sizeof(username), + password, sizeof(password), host, sizeof(host), &port, path, sizeof(path)); + + if (strcasecmp(proto, "rtsp") == 0) + { + port = (port == -1) ? 554 : port; + } +#ifdef OVER_HTTP + else if (strcasecmp(proto, "http") == 0) + { + port = (port == -1) ? 80 : port; + } + else if (strcasecmp(proto, "https") == 0) + { + port = (port == -1) ? 443 : port; + } +#endif +#ifdef OVER_WEBSOCKET + else if (strcasecmp(proto, "ws") == 0) + { + port = (port == -1) ? 80 : port; + } + else if (strcasecmp(proto, "wss") == 0) + { + port = (port == -1) ? 443 : port; + } +#endif + else + { + return FALSE; + } + + if (host[0] == '\0') + { + return FALSE; + } + + if (username[0] != '\0') + { + m_acct = username; + } + + if (password[0] != '\0') + { + m_pass = password; + } + + strncpy(m_ip, host, sizeof(m_ip) - 1); + + m_port = port; + + m_rtsp.set_notify_cb(rtsp_notify_cb, this); + m_rtsp.set_audio_cb(rtsp_audio_cb); + m_rtsp.set_video_cb(rtsp_video_cb); + m_rtsp.set_rtcp_cb(rtsp_rtcp_cb); +#ifdef METADATA + m_rtsp.set_metadata_cb(rtsp_metadata_cb); +#endif + + return TRUE; +} + +void CRtspPlayer::close() +{ + // stop rtsp connection + m_rtsp.rtsp_stop(); + m_rtsp.rtsp_close(); + + m_bPlaying = FALSE; + m_bPaused = FALSE; + m_port = 554; + + memset(m_ip, 0, sizeof(m_ip)); + + CVideoPlayer::close(); +} + +BOOL CRtspPlayer::play() +{ + if (m_rtsp.rtsp_start(m_sFileName.toStdString().c_str(), m_acct.toStdString().c_str(), m_pass.toStdString().c_str())) + { + m_bPlaying = TRUE; + } + + return m_bPlaying; +} + +void CRtspPlayer::stop() +{ + if (m_bPlaying || m_bPaused) + { + m_rtsp.rtsp_stop(); + } + + m_bPlaying = FALSE; + m_bPaused = FALSE; +} + +BOOL CRtspPlayer::pause() +{ + if (m_bPlaying) + { + if (m_rtsp.rtsp_pause()) + { + m_bPaused = TRUE; + m_bPlaying = FALSE; + } + } + else if (m_bPaused) + { + if (m_rtsp.rtsp_play(0)) + { + m_bPaused = FALSE; + m_bPlaying = TRUE; + } + } + + return m_bPaused; +} + +BOOL CRtspPlayer::seek(int pos) +{ + if (pos < 0 || pos > 100) + { + return FALSE; + } + + int64 duration = getDuration(); + if (duration <= 0) + { + return FALSE; + } + + int ntp_pos = duration / 100 * pos; + + m_rtsp.rtsp_play(ntp_pos); + + return TRUE; +} + +int64 CRtspPlayer::getElapse() +{ + uint32 cur_ts; + uint32 init_ts; + int frequency; + + RCUA * p_rua = m_rtsp.get_rua(); + if (NULL == p_rua) + { + return 0; + } + + if (m_videoClock.SyncTime.tv_sec > m_audioClock.SyncTime.tv_sec) + { + cur_ts = m_videoClock.SyncTimestamp; + init_ts = p_rua->video_init_ts; + frequency = getVideoClock(); + } + else if (m_videoClock.SyncTime.tv_sec == m_audioClock.SyncTime.tv_sec && + m_videoClock.SyncTime.tv_usec > m_audioClock.SyncTime.tv_usec) + { + cur_ts = m_videoClock.SyncTimestamp; + init_ts = p_rua->video_init_ts; + frequency = getVideoClock(); + } + else + { + cur_ts = m_audioClock.SyncTimestamp; + init_ts = p_rua->audio_init_ts; + frequency = getAudioClock(); + } + + if (init_ts == (uint32)-1) + { + return 0; + } + + int64 elapse; + int timestampDiff = cur_ts - init_ts; + + // Divide this by the timestamp frequency to get real time: + double timeDiff = timestampDiff / (double)frequency; + + if (timeDiff >= 0.0) + { + elapse = p_rua->media_start + timeDiff * 1000; + } + else + { + timeDiff = -timeDiff; + elapse = p_rua->media_start + timeDiff * 1000; + } + + return elapse; +} + +int64 CRtspPlayer::getDuration() +{ + RCUA * p_rua = m_rtsp.get_rua(); + if (p_rua) + { + return p_rua->play_end - p_rua->play_start; + } + + return 0; +} + +int CRtspPlayer::getVideoClock() +{ + return 90000; +} + +int CRtspPlayer::getAudioClock() +{ + return m_nSampleRate; +} + +int CRtspPlayer::getVideoCodec() +{ + return m_rtsp.video_codec(); +} + +int CRtspPlayer::getAudioCodec() +{ + return m_rtsp.audio_codec(); +} + +void CRtspPlayer::setRtpMulticast(BOOL flag) +{ + m_rtsp.set_rtp_multicast(flag); +} + +void CRtspPlayer::setRtpOverUdp(BOOL flag) +{ + m_rtsp.set_rtp_over_udp(flag); +} + +#ifdef BACKCHANNEL + +int CRtspPlayer::getBCFlag() +{ + return m_rtsp.get_bc_flag(); +} + +void CRtspPlayer::setBCFlag(int flag) +{ + m_rtsp.set_bc_flag(flag); +} + +int CRtspPlayer::getBCDataFlag() +{ + return m_rtsp.get_bc_data_flag(); +} + +void CRtspPlayer::setBCDataFlag(int flag) +{ + if (m_rtsp.get_bc_data_flag()) + { + m_rtsp.set_bc_data_flag(0); + } + else + { + m_rtsp.set_bc_data_flag(1); + } +} + +void CRtspPlayer::setAudioDevice(int index) +{ + m_rtsp.set_audio_device(index); +} + +#endif // end of BACKCHANNEL + +#ifdef REPLAY + +int CRtspPlayer::getReplayFlag() +{ + return m_rtsp.get_replay_flag(); +} + +void CRtspPlayer::setReplayFlag(int flag) +{ + m_rtsp.set_replay_flag(flag); +} + +void CRtspPlayer::setScale(double scale) +{ + m_rtsp.set_scale(scale); +} + +void CRtspPlayer::setRateControlFlag(int flag) +{ + m_rtsp.set_rate_control_flag(flag); +} + +void CRtspPlayer::setImmediateFlag(int flag) +{ + m_rtsp.set_immediate_flag(flag); +} + +void CRtspPlayer::setFramesFlag(int flag, int interval) +{ + m_rtsp.set_frames_flag(flag, interval); +} + +void CRtspPlayer::setReplayRange(time_t start, time_t end) +{ + m_rtsp.set_replay_range(start, end); +} + +#endif // end of REPLAY + +#ifdef OVER_HTTP + +void CRtspPlayer::setRtspOverHttp(int flag, int port) +{ + m_rtsp.set_rtsp_over_http(flag, port); +} + +#endif // OVER_HTTP + +#ifdef OVER_WEBSOCKET + +void CRtspPlayer::setRtspOverWs(int flag, int port) +{ + m_rtsp.set_rtsp_over_ws(flag, port); +} + +#endif // OVER_WEBSOCKET + +void CRtspPlayer::onNotify(int evt) +{ + if (evt == RTSP_EVE_CONNSUCC) + { + int videoCodec = m_rtsp.video_codec(); + int audioCodec = m_rtsp.audio_codec(); + + if (VIDEO_CODEC_NONE != videoCodec) + { + BOOL ret; + uint8 extradata[1024]; + int extradata_size = 0; + + if (VIDEO_CODEC_H264 == videoCodec) + { + ret = m_rtsp.get_h264_params(m_h26XParamSets.sps, &m_h26XParamSets.sps_size, + m_h26XParamSets.pps, &m_h26XParamSets.pps_size); + if (ret) + { + memcpy(extradata, m_h26XParamSets.sps, m_h26XParamSets.sps_size); + extradata_size += m_h26XParamSets.sps_size; + memcpy(extradata+extradata_size, m_h26XParamSets.pps, m_h26XParamSets.pps_size); + extradata_size += m_h26XParamSets.pps_size; + + // init video decoder + openVideo(videoCodec, extradata, extradata_size); + } + } + else if (VIDEO_CODEC_H265 == videoCodec) + { + ret = m_rtsp.get_h265_params(m_h26XParamSets.sps, &m_h26XParamSets.sps_size, + m_h26XParamSets.pps, &m_h26XParamSets.pps_size, + m_h26XParamSets.vps, &m_h26XParamSets.vps_size); + if (ret) + { + memcpy(extradata, m_h26XParamSets.vps, m_h26XParamSets.vps_size); + extradata_size += m_h26XParamSets.vps_size; + memcpy(extradata+extradata_size, m_h26XParamSets.sps, m_h26XParamSets.sps_size); + extradata_size += m_h26XParamSets.sps_size; + memcpy(extradata+extradata_size, m_h26XParamSets.pps, m_h26XParamSets.pps_size); + extradata_size += m_h26XParamSets.pps_size; + + // init video decoder + openVideo(videoCodec, extradata, extradata_size); + } + } + else + { + openVideo(videoCodec); + } + } + + if (AUDIO_CODEC_NONE != audioCodec) + { + openAudio(audioCodec, m_rtsp.get_audio_samplerate(), m_rtsp.get_audio_channels(), m_rtsp.get_audio_bitpersample()); + } + } + + emit notify(evt); +} + +void CRtspPlayer::onAudio(uint8 * pdata, int len, uint32 ts, uint16 seq) +{ + playAudio(pdata, len, ts, seq); +} + +void CRtspPlayer::onVideo(uint8 * pdata, int len, uint32 ts, uint16 seq) +{ + playVideo(pdata, len, ts, seq); +} + +void CRtspPlayer::onRtcp(uint8 * pdata, int len, int type) +{ + uint8 * p_rtp = pdata; + uint32 rtp_len = len; + + // Check for the 20-byte RTCP header: + if (rtp_len < 20) + { + return; + } + + uint8 pt = p_rtp[1]; + uint32 rtpHdr = ntohl(*(uint32*)p_rtp); p_rtp += 4; rtp_len -= 4; + uint32 ssrc = ntohl(*(uint32*)(p_rtp)); p_rtp += 4; rtp_len -= 4; + uint32 ntpMSW = ntohl(*(uint32*)(p_rtp)); p_rtp += 4; rtp_len -= 4; + uint32 ntpLSW = ntohl(*(uint32*)(p_rtp)); p_rtp += 4; rtp_len -= 4; + uint32 rtpTimestamp = ntohl(*(uint32*)(p_rtp)); + + if (pt != RTCP_SR) + { + return; + } + + // Check the RTP version number (it should be 2) + if ((rtpHdr & 0xC0000000) != 0x80000000) + { + return; + } + + if (AV_TYPE_AUDIO == type) + { + m_audioClock.SyncTimestamp = rtpTimestamp; + m_audioClock.SyncTime.tv_sec = ntpMSW - 0x83AA7E80; // 1/1/1900 -> 1/1/1970 + double microseconds = (ntpLSW * 15625.0) / 0x04000000; // 10^6/2^32 + m_audioClock.SyncTime.tv_usec = (unsigned)(microseconds+0.5); + } + else if (AV_TYPE_VIDEO == type) + { + m_videoClock.SyncTimestamp = rtpTimestamp; + m_videoClock.SyncTime.tv_sec = ntpMSW - 0x83AA7E80; // 1/1/1900 -> 1/1/1970 + double microseconds = (ntpLSW * 15625.0) / 0x04000000; // 10^6/2^32 + m_videoClock.SyncTime.tv_usec = (unsigned)(microseconds+0.5); + } +} + +BOOL CRtspPlayer::onRecord() +{ + CRtspClient * p_rtsp = &m_rtsp; + AVICTX * p_avictx = m_pAviCtx; + + int vcodec = p_rtsp->video_codec(); + int v_extra_len = 0; + uint8 v_extra[1024]; + + if (VIDEO_CODEC_H264 == vcodec) + { + avi_set_video_info(p_avictx, 0, 0, 0, "H264"); + + uint8 sps[512], pps[512]; + int sps_len = 0, pps_len = 0; + + if (p_rtsp->get_h264_params(sps, &sps_len, pps, &pps_len)) + { + memcpy(v_extra, sps, sps_len); + memcpy(v_extra + sps_len, pps, pps_len); + + v_extra_len = sps_len + pps_len; + } + + if (v_extra_len > 0) + { + avi_set_video_extra_info(p_avictx, v_extra, v_extra_len); + } + } + else if (VIDEO_CODEC_H265 == vcodec) + { + avi_set_video_info(p_avictx, 0, 0, 0, "H265"); + + uint8 vps[512], sps[512], pps[512]; + int vps_len = 0, sps_len = 0, pps_len = 0; + + if (p_rtsp->get_h265_params(sps, &sps_len, pps, &pps_len, vps, &vps_len)) + { + memcpy(v_extra, vps, vps_len); + memcpy(v_extra + vps_len, sps, sps_len); + memcpy(v_extra + vps_len + sps_len, pps, pps_len); + + v_extra_len = vps_len + sps_len + pps_len; + } + + if (v_extra_len > 0) + { + avi_set_video_extra_info(p_avictx, v_extra, v_extra_len); + } + } + else if (VIDEO_CODEC_JPEG == vcodec) + { + avi_set_video_info(p_avictx, 0, 0, 0, "JPEG"); + } + else if (VIDEO_CODEC_MP4 == vcodec) + { + avi_set_video_info(p_avictx, 0, 0, 0, "MP4V"); + } + + int acodec = p_rtsp->audio_codec(); + int sr = p_rtsp->get_audio_samplerate(); + int ch = p_rtsp->get_audio_channels(); + + if (AUDIO_CODEC_G711A == acodec) + { + avi_set_audio_info(p_avictx, ch, sr, AUDIO_FORMAT_ALAW); + } + else if (AUDIO_CODEC_G711U == acodec) + { + avi_set_audio_info(p_avictx, ch, sr, AUDIO_FORMAT_MULAW); + } + else if (AUDIO_CODEC_G726 == acodec) + { + avi_set_audio_info(p_avictx, ch, sr, AUDIO_FORMAT_G726); + } + else if (AUDIO_CODEC_G722 == acodec) + { + avi_set_audio_info(p_avictx, ch, sr, AUDIO_FORMAT_G722); + } + else if (AUDIO_CODEC_AAC == acodec) + { + avi_set_audio_info(p_avictx, ch, sr, AUDIO_FORMAT_AAC); + avi_set_audio_extra_info(p_avictx, p_rtsp->get_audio_config(), p_rtsp->get_audio_config_len()); + } + + avi_update_header(p_avictx); + + if (p_avictx->ctxf_video) + { + if (v_extra_len > 0) + { + recordVideo(v_extra, v_extra_len, 0, 0); + } + } + + return TRUE; +} + +void CRtspPlayer::onRecordFileSwitch() +{ + AVICTX * p_ctx; + AVICTX * p_oldctx = m_pAviCtx; + + QString path = getRecordPath(); + QString file = path + "/" + getTempFile(m_ip, ".avi"); + + p_ctx = avi_write_open(file.toLocal8Bit().toStdString().c_str()); + if (NULL == p_ctx) + { + return; + } + + p_ctx->ctxf_video = p_oldctx->ctxf_video; + p_ctx->ctxf_audio = p_oldctx->ctxf_audio; + + if (p_ctx->ctxf_video) + { + avi_calc_fps(p_oldctx); + avi_set_video_info(p_ctx, p_oldctx->v_fps, p_oldctx->v_width, p_oldctx->v_height, p_oldctx->v_fcc); + avi_set_video_extra_info(p_ctx, p_oldctx->v_extra, p_oldctx->v_extra_len); + } + + if (p_ctx->ctxf_audio) + { + avi_set_audio_info(p_ctx, p_oldctx->a_chns, p_oldctx->a_rate, p_oldctx->a_fmt); + avi_set_audio_extra_info(p_ctx, p_oldctx->a_extra, p_oldctx->a_extra_len); + } + + avi_write_close(p_oldctx); + + avi_update_header(p_ctx); + + m_pAviCtx = p_ctx; + + if (m_h26XParamSets.vps_size > 0 || + m_h26XParamSets.sps_size > 0 || + m_h26XParamSets.pps_size > 0) + { + avi_write_nalu(m_pAviCtx, + m_h26XParamSets.vps, m_h26XParamSets.vps_size, + m_h26XParamSets.sps, m_h26XParamSets.sps_size, + m_h26XParamSets.pps, m_h26XParamSets.pps_size); + } +} + + + + + diff --git a/MediaClient/MediaClientForMobile/media/rtsp_player.h b/MediaClient/MediaClientForMobile/media/rtsp_player.h new file mode 100644 index 0000000..32c406a --- /dev/null +++ b/MediaClient/MediaClientForMobile/media/rtsp_player.h @@ -0,0 +1,93 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef RTSP_PLAYER_H +#define RTSP_PLAYER_H + +#include "video_player.h" +#include "rtsp_cln.h" + + +class CRtspPlayer : public CVideoPlayer +{ + Q_OBJECT + +public: + CRtspPlayer(QObject * parent = 0); + virtual ~CRtspPlayer(); + + BOOL open(QString fileName, WId hWnd); + void close(); + BOOL play(); + void stop(); + BOOL pause(); + BOOL seek(int pos); + int64 getElapse(); + int64 getDuration(); + int getVideoClock(); + int getAudioClock(); + int getVideoCodec(); + int getAudioCodec(); + + void setRtpMulticast(BOOL flag); + void setRtpOverUdp(BOOL flag); + +#ifdef OVER_HTTP + void setRtspOverHttp(int flag, int port); +#endif + +#ifdef OVER_WEBSOCKET + void setRtspOverWs(int flag, int port); +#endif + +#ifdef BACKCHANNEL + int getBCFlag(); + void setBCFlag(int flag); + int getBCDataFlag(); + void setBCDataFlag(int flag); + void setAudioDevice(int index); +#endif + +#ifdef REPLAY + int getReplayFlag(); + void setReplayFlag(int flag); + void setScale(double scale); + void setRateControlFlag(int flag); + void setImmediateFlag(int flag); + void setFramesFlag(int flag, int interval); + void setReplayRange(time_t start, time_t end); +#endif + + void onNotify(int evt); + void onAudio(uint8 * pdata, int len, uint32 ts, uint16 seq); + void onVideo(uint8 * pdata, int len, uint32 ts, uint16 seq); + void onRtcp(uint8 * pdata, int len, int type); + BOOL onRecord(); + void onRecordFileSwitch(); + +private: + char m_ip[32]; + int m_port; + CRtspClient m_rtsp; +}; + +#endif + + + diff --git a/MediaClient/MediaClientForMobile/media/srt_player.cpp b/MediaClient/MediaClientForMobile/media/srt_player.cpp new file mode 100644 index 0000000..5b8a67f --- /dev/null +++ b/MediaClient/MediaClientForMobile/media/srt_player.cpp @@ -0,0 +1,436 @@ +/*************************************************************************************** + * + * 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 "srt_player.h" +#include "utils.h" + +/***************************************************************************************/ + +int srt_notify_callback(int evt, void * puser) +{ + CSrtPlayer * pPlayer = (CSrtPlayer *) puser; + + pPlayer->onNotify(evt); + return 0; +} + +int srt_audio_callback(uint8 * pdata, int len, uint32 ts, void *puser) +{ + CSrtPlayer * pPlayer = (CSrtPlayer *) puser; + + pPlayer->onAudio(pdata, len, ts); + return 0; +} + +int srt_video_callback(uint8 * pdata, int len, uint32 ts, void *puser) +{ + CSrtPlayer * pPlayer = (CSrtPlayer *) puser; + + pPlayer->onVideo(pdata, len, ts); + return 0; +} + +/***************************************************************************************/ + +CSrtPlayer::CSrtPlayer(QObject * parent) +: CVideoPlayer(parent) +, m_port(-1) +{ + memset(m_ip, 0, sizeof(m_ip)); +} + +CSrtPlayer::~CSrtPlayer() +{ + close(); +} + +BOOL CSrtPlayer::open(QString fileName, WId hWnd) +{ + close(); + + CVideoPlayer::open(fileName, hWnd); + + int port; + char proto[32], username[100], password[100], host[100], path[200]; + + url_split(fileName.toStdString().c_str(), proto, sizeof(proto), username, sizeof(username), + password, sizeof(password), host, sizeof(host), &port, path, sizeof(path)); + + if (host[0] == '\0') + { + return FALSE; + } + + if (port <= 0) + { + return FALSE; + } + + if (username[0] != '\0') + { + m_acct = username; + } + + if (password[0] != '\0') + { + m_pass = password; + } + + strncpy(m_ip, host, sizeof(m_ip) - 1); + + m_port = port; + + m_srt.set_notify_cb(srt_notify_callback, this); + m_srt.set_audio_cb(srt_audio_callback); + m_srt.set_video_cb(srt_video_callback); + + return TRUE; +} + +void CSrtPlayer::close() +{ + // stop connection + m_srt.srt_stop(); + m_srt.srt_close(); + + m_bPlaying = FALSE; + m_bPaused = FALSE; + m_port = -1; + + memset(m_ip, 0, sizeof(m_ip)); + + CVideoPlayer::close(); +} + +BOOL CSrtPlayer::play() +{ + if (m_srt.srt_start(m_sFileName.toStdString().c_str(), m_acct.toStdString().c_str(), m_pass.toStdString().c_str())) + { + m_bPlaying = TRUE; + } + + return m_bPlaying; +} + +void CSrtPlayer::stop() +{ + if (m_bPlaying || m_bPaused) + { + m_srt.srt_stop(); + } + + m_bPlaying = FALSE; + m_bPaused = FALSE; +} + +BOOL CSrtPlayer::pause() +{ + if (m_bPlaying) + { + if (m_srt.srt_pause()) + { + m_bPaused = TRUE; + m_bPlaying = FALSE; + } + } + else if (m_bPaused) + { + if (m_srt.srt_play()) + { + m_bPaused = FALSE; + m_bPlaying = TRUE; + } + } + + return m_bPaused; +} + +BOOL CSrtPlayer::seek(int pos) +{ + if (pos < 0 || pos > 100) + { + return FALSE; + } + + int64 duration = getDuration(); + if (duration <= 0) + { + return FALSE; + } + + int ntp_pos = duration / 100 * pos; + + // m_srt.srt_play(); + + return TRUE; +} + +int64 CSrtPlayer::getElapse() +{ + return 0; +} + +int64 CSrtPlayer::getDuration() +{ + return 0; +} + +int CSrtPlayer::getVideoClock() +{ + return 90000; +} + +int CSrtPlayer::getAudioClock() +{ + return 90000; +} + +int CSrtPlayer::getVideoCodec() +{ + return m_srt.video_codec(); +} + +int CSrtPlayer::getAudioCodec() +{ + return m_srt.audio_codec(); +} + +void CSrtPlayer::onNotify(int evt) +{ + if (evt == SRT_EVE_VIDEOREADY) + { + int videoCodec = m_srt.video_codec(); + + if (VIDEO_CODEC_NONE != videoCodec) + { + BOOL ret; + uint8 extradata[1024]; + int extradata_size = 0; + + if (VIDEO_CODEC_H264 == videoCodec) + { + ret = m_srt.get_h264_params(m_h26XParamSets.sps, &m_h26XParamSets.sps_size, + m_h26XParamSets.pps, &m_h26XParamSets.pps_size); + if (ret) + { + memcpy(extradata, m_h26XParamSets.sps, m_h26XParamSets.sps_size); + extradata_size += m_h26XParamSets.sps_size; + memcpy(extradata+extradata_size, m_h26XParamSets.pps, m_h26XParamSets.pps_size); + extradata_size += m_h26XParamSets.pps_size; + + // init video decoder + openVideo(videoCodec, extradata, extradata_size); + } + } + else if (VIDEO_CODEC_H265 == videoCodec) + { + ret = m_srt.get_h265_params(m_h26XParamSets.sps, &m_h26XParamSets.sps_size, + m_h26XParamSets.pps, &m_h26XParamSets.pps_size, + m_h26XParamSets.vps, &m_h26XParamSets.vps_size); + if (ret) + { + memcpy(extradata, m_h26XParamSets.vps, m_h26XParamSets.vps_size); + extradata_size += m_h26XParamSets.vps_size; + memcpy(extradata+extradata_size, m_h26XParamSets.sps, m_h26XParamSets.sps_size); + extradata_size += m_h26XParamSets.sps_size; + memcpy(extradata+extradata_size, m_h26XParamSets.pps, m_h26XParamSets.pps_size); + extradata_size += m_h26XParamSets.pps_size; + + // init video decoder + openVideo(videoCodec, extradata, extradata_size); + } + } + else + { + openVideo(videoCodec); + } + } + } + else if (evt == SRT_EVE_AUDIOREADY) + { + int audioCodec = m_srt.audio_codec(); + + if (AUDIO_CODEC_NONE != audioCodec) + { + openAudio(audioCodec, m_srt.get_audio_samplerate(), m_srt.get_audio_channels()); + } + } + + emit notify(evt); +} + +void CSrtPlayer::onAudio(uint8 * pdata, int len, uint32 ts) +{ + playAudio(pdata, len, ts, 0); +} + +void CSrtPlayer::onVideo(uint8 * pdata, int len, uint32 ts) +{ + playVideo(pdata, len, ts, 0); +} + +BOOL CSrtPlayer::onRecord() +{ + CSrtClient * p_srt = &m_srt; + AVICTX * p_avictx = m_pAviCtx; + + int vcodec = p_srt->video_codec(); + int v_extra_len = 0; + uint8 v_extra[1024]; + + if (VIDEO_CODEC_H264 == vcodec) + { + avi_set_video_info(p_avictx, 0, 0, 0, "H264"); + + uint8 sps[512], pps[512]; + int sps_len = 0, pps_len = 0; + + if (p_srt->get_h264_params(sps, &sps_len, pps, &pps_len)) + { + memcpy(v_extra, sps, sps_len); + memcpy(v_extra + sps_len, pps, pps_len); + + v_extra_len = sps_len + pps_len; + } + + if (v_extra_len > 0) + { + avi_set_video_extra_info(p_avictx, v_extra, v_extra_len); + } + } + else if (VIDEO_CODEC_H265 == vcodec) + { + avi_set_video_info(p_avictx, 0, 0, 0, "H265"); + + uint8 vps[512], sps[512], pps[512]; + int vps_len = 0, sps_len = 0, pps_len = 0; + + if (p_srt->get_h265_params(sps, &sps_len, pps, &pps_len, vps, &vps_len)) + { + memcpy(v_extra, vps, vps_len); + memcpy(v_extra + vps_len, sps, sps_len); + memcpy(v_extra + vps_len + sps_len, pps, pps_len); + + v_extra_len = vps_len + sps_len + pps_len; + } + + if (v_extra_len > 0) + { + avi_set_video_extra_info(p_avictx, v_extra, v_extra_len); + } + } + else if (VIDEO_CODEC_JPEG == vcodec) + { + avi_set_video_info(p_avictx, 0, 0, 0, "JPEG"); + } + else if (VIDEO_CODEC_MP4 == vcodec) + { + avi_set_video_info(p_avictx, 0, 0, 0, "MP4V"); + } + + int acodec = p_srt->audio_codec(); + int sr = p_srt->get_audio_samplerate(); + int ch = p_srt->get_audio_channels(); + + if (AUDIO_CODEC_G711A == acodec) + { + avi_set_audio_info(p_avictx, ch, sr, AUDIO_FORMAT_ALAW); + } + else if (AUDIO_CODEC_G711U == acodec) + { + avi_set_audio_info(p_avictx, ch, sr, AUDIO_FORMAT_MULAW); + } + else if (AUDIO_CODEC_G726 == acodec) + { + avi_set_audio_info(p_avictx, ch, sr, AUDIO_FORMAT_G726); + } + else if (AUDIO_CODEC_G722 == acodec) + { + avi_set_audio_info(p_avictx, ch, sr, AUDIO_FORMAT_G722); + } + else if (AUDIO_CODEC_AAC == acodec) + { + avi_set_audio_info(p_avictx, ch, sr, AUDIO_FORMAT_AAC); + avi_set_audio_extra_info(p_avictx, p_srt->get_audio_config(), p_srt->get_audio_config_len()); + } + + avi_update_header(p_avictx); + + if (p_avictx->ctxf_video) + { + if (v_extra_len > 0) + { + recordVideo(v_extra, v_extra_len, 0, 0); + } + } + + return TRUE; +} + +void CSrtPlayer::onRecordFileSwitch() +{ + AVICTX * p_ctx; + AVICTX * p_oldctx = m_pAviCtx; + + QString path = getRecordPath(); + QString file = path + "/" + getTempFile(m_ip, ".avi"); + + p_ctx = avi_write_open(file.toLocal8Bit().toStdString().c_str()); + if (NULL == p_ctx) + { + return; + } + + p_ctx->ctxf_video = p_oldctx->ctxf_video; + p_ctx->ctxf_audio = p_oldctx->ctxf_audio; + + if (p_ctx->ctxf_video) + { + avi_calc_fps(p_oldctx); + avi_set_video_info(p_ctx, p_oldctx->v_fps, p_oldctx->v_width, p_oldctx->v_height, p_oldctx->v_fcc); + avi_set_video_extra_info(p_ctx, p_oldctx->v_extra, p_oldctx->v_extra_len); + } + + if (p_ctx->ctxf_audio) + { + avi_set_audio_info(p_ctx, p_oldctx->a_chns, p_oldctx->a_rate, p_oldctx->a_fmt); + avi_set_audio_extra_info(p_ctx, p_oldctx->a_extra, p_oldctx->a_extra_len); + } + + avi_write_close(p_oldctx); + + avi_update_header(p_ctx); + + m_pAviCtx = p_ctx; + + if (m_h26XParamSets.vps_size > 0 || + m_h26XParamSets.sps_size > 0 || + m_h26XParamSets.pps_size > 0) + { + avi_write_nalu(m_pAviCtx, + m_h26XParamSets.vps, m_h26XParamSets.vps_size, + m_h26XParamSets.sps, m_h26XParamSets.sps_size, + m_h26XParamSets.pps, m_h26XParamSets.pps_size); + } +} + + + + + diff --git a/MediaClient/MediaClientForMobile/media/srt_player.h b/MediaClient/MediaClientForMobile/media/srt_player.h new file mode 100644 index 0000000..bcd36d0 --- /dev/null +++ b/MediaClient/MediaClientForMobile/media/srt_player.h @@ -0,0 +1,63 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef SRT_PLAYER_H +#define SRT_PLAYER_H + +#include "video_player.h" +#include "srt_cln.h" + + +class CSrtPlayer : public CVideoPlayer +{ + Q_OBJECT + +public: + CSrtPlayer(QObject * parent = 0); + virtual ~CSrtPlayer(); + + BOOL open(QString fileName, WId hWnd); + void close(); + BOOL play(); + void stop(); + BOOL pause(); + BOOL seek(int pos); + int64 getElapse(); + int64 getDuration(); + int getVideoClock(); + int getAudioClock(); + int getVideoCodec(); + int getAudioCodec(); + + void onNotify(int evt); + void onAudio(uint8 * pdata, int len, uint32 ts); + void onVideo(uint8 * pdata, int len, uint32 ts); + BOOL onRecord(); + void onRecordFileSwitch(); + +private: + char m_ip[32]; + int m_port; + CSrtClient m_srt; +}; + +#endif + + + diff --git a/MediaClient/MediaClientForMobile/media/video_decoder.cpp b/MediaClient/MediaClientForMobile/media/video_decoder.cpp new file mode 100644 index 0000000..93a8119 --- /dev/null +++ b/MediaClient/MediaClientForMobile/media/video_decoder.cpp @@ -0,0 +1,569 @@ +/*************************************************************************************** + * + * 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 "video_decoder.h" +#include "avcodec_mutex.h" +#include "lock.h" +#include "media_codec.h" +#include "media_parse.h" + + +/***************************************************************************************/ + +uint32 g_hw_decoder_nums = 0; +uint32 g_hw_decoder_max = 2; // Hardware decoding resources are limited, Limit up to 2 hardware decoding sessions +void * g_hw_decoder_mutex = sys_os_create_mutex(); + +/***************************************************************************************/ + +enum AVPixelFormat getHWFormat(AVCodecContext *ctx, const enum AVPixelFormat *pix_fmts) +{ + CVideoDecoder * pthis = (CVideoDecoder *) ctx->opaque; + + AVPixelFormat dst_pix_fmt = AV_PIX_FMT_NONE; + + pthis->getHWFormat(ctx, pix_fmts, &dst_pix_fmt); + + return dst_pix_fmt; +} + +CVideoDecoder::CVideoDecoder() +{ + m_bInited = FALSE; + + m_pCodec = NULL; + m_pContext = NULL; + m_pFrame = NULL; + m_pSoftFrame = NULL; + + m_pCallback = NULL; + m_pUserdata = NULL; + + m_hwPixFmt = AV_PIX_FMT_NONE; + m_pHWDeviceCtx = NULL; +} + +CVideoDecoder::~CVideoDecoder() +{ + uninit(); +} + +void CVideoDecoder::uninit() +{ + flush(); + + if (m_pContext) + { + avcodec_thread_close(m_pContext); + avcodec_free_context(&m_pContext); + } + + if (m_pFrame) + { + av_frame_free(&m_pFrame); + } + + if (m_pSoftFrame) + { + av_frame_free(&m_pSoftFrame); + } + + if (m_pHWDeviceCtx) + { + av_buffer_unref(&m_pHWDeviceCtx); + + CLock lock(g_hw_decoder_mutex); + g_hw_decoder_nums--; + } + + m_bInited = FALSE; +} + +BOOL CVideoDecoder::init(enum AVCodecID codec, uint8 * extradata, int extradata_size, int hwMode) +{ + int width = 0; + int height = 0; + + if (extradata && extradata_size > 0) + { + int vcodec = VIDEO_CODEC_NONE; + + if (AV_CODEC_ID_H264 == codec) + { + vcodec = VIDEO_CODEC_H264; + } + else if (AV_CODEC_ID_HEVC == codec) + { + vcodec = VIDEO_CODEC_H265; + } + else if (AV_CODEC_ID_MJPEG == codec) + { + vcodec = VIDEO_CODEC_JPEG; + } + else if (AV_CODEC_ID_MPEG4 == codec) + { + vcodec = VIDEO_CODEC_MP4; + } + + avc_parse_video_size(vcodec, extradata, extradata_size, &width, &height); + } + +#ifdef ANDROID + if (HW_DECODING_DISABLE != hwMode && width*height >= 320*240) + { + if (AV_CODEC_ID_H264 == codec) + { + m_pCodec = avcodec_find_decoder_by_name("h264_mediacodec"); + } + else if (AV_CODEC_ID_HEVC == codec) + { + m_pCodec = avcodec_find_decoder_by_name("hevc_mediacodec"); + } + else if (AV_CODEC_ID_MPEG4 == codec) + { + m_pCodec = avcodec_find_decoder_by_name("mpeg4_mediacodec"); + } + } + + if (NULL == m_pCodec) + { + m_pCodec = avcodec_find_decoder(codec); + } +#else + m_pCodec = avcodec_find_decoder(codec); +#endif + + if (NULL == m_pCodec) + { + log_print(HT_LOG_ERR, "%s, m_pCodec is NULL\r\n", __FUNCTION__); + return FALSE; + } + + m_pContext = avcodec_alloc_context3(m_pCodec); + if (NULL == m_pContext) + { + log_print(HT_LOG_ERR, "%s, avcodec_alloc_context3 failed\r\n", __FUNCTION__); + return FALSE; + } + + m_pContext->width = width; + m_pContext->height = height; + + m_pContext->flags |= AV_CODEC_FLAG_LOW_DELAY; + m_pContext->flags2 |= AV_CODEC_FLAG2_FAST; + + /* ***** Output always the frames ***** */ + m_pContext->flags |= AV_CODEC_FLAG_OUTPUT_CORRUPT; + + av_opt_set_int(m_pContext, "refcounted_frames", 1, 0); + + if (HW_DECODING_DISABLE != hwMode && hwDecoderInit(m_pContext, hwMode) < 0) + { + log_print(HT_LOG_WARN, "%s, hwDecoderInit failed\r\n", __FUNCTION__); + } + + if (extradata && extradata_size > 0) + { + int size = extradata_size + AV_INPUT_BUFFER_PADDING_SIZE; + + m_pContext->extradata = (uint8 *)av_mallocz(size); + if (m_pContext->extradata) + { + m_pContext->extradata_size = extradata_size; + memcpy(m_pContext->extradata, extradata, extradata_size); + } + } + + if (avcodec_thread_open(m_pContext, m_pCodec, NULL) < 0) + { + log_print(HT_LOG_ERR, "%s, avcodec_thread_open failed\r\n", __FUNCTION__); + return FALSE; + } + + m_pFrame = av_frame_alloc(); + if (NULL == m_pFrame) + { + log_print(HT_LOG_ERR, "%s, av_frame_alloc failed\r\n", __FUNCTION__); + return FALSE; + } + + m_pSoftFrame = av_frame_alloc(); + if (NULL == m_pSoftFrame) + { + log_print(HT_LOG_ERR, "%s, av_frame_alloc failed\r\n", __FUNCTION__); + return FALSE; + } + + m_bInited = TRUE; + + return TRUE; +} + +BOOL CVideoDecoder::init(int codec, uint8 * extradata, int extradata_size, int hwMode) +{ + return init(to_video_avcodecid(codec), extradata, extradata_size, hwMode); +} + +int CVideoDecoder::hwDecoderInit(AVCodecContext *ctx, int hwMode) +{ + int i, err = 0; + enum AVHWDeviceType type = AV_HWDEVICE_TYPE_NONE; + + if (HW_DECODING_DISABLE == hwMode) + { + return 0; + } + + CLock lock(g_hw_decoder_mutex); + + if (g_hw_decoder_max > 0) + { + if (g_hw_decoder_nums >= g_hw_decoder_max) + { + return 0; + } + } + else + { + return 0; + } + + char hwtype[32] = {'\0'}; + +#if __WINDOWS_OS__ + + if (HW_DECODING_D3D11 == hwMode) + { + strcpy(hwtype, "d3d11va"); + } + else if (HW_DECODING_DXVA == hwMode) + { + strcpy(hwtype, "dxva2"); + } + else if (HW_DECODING_AUTO == hwMode) + { + strcpy(hwtype, "d3d11va"); + + type = av_hwdevice_find_type_by_name(hwtype); + if (AV_HWDEVICE_TYPE_NONE == type) + { + strcpy(hwtype, "dxva2"); + } + } + +#elif defined(IOS) + + if (HW_DECODING_VIDEOTOOLBOX == hwMode) + { + strcpy(hwtype, "videotoolbox"); + } + else if (HW_DECODING_OPENCL == hwMode) + { + strcpy(hwtype, "opencl"); + } + else if (HW_DECODING_AUTO == hwMode) + { + strcpy(hwtype, "videotoolbox"); + + type = av_hwdevice_find_type_by_name(hwtype); + if (AV_HWDEVICE_TYPE_NONE == type) + { + strcpy(hwtype, "opencl"); + } + } + +#elif defined(ANDROID) + + if (HW_DECODING_MEDIACODEC == hwMode) + { + strcpy(hwtype, "mediacodec"); + } + else if (HW_DECODING_AUTO == hwMode) + { + strcpy(hwtype, "mediacodec"); + } + +#elif __LINUX_OS__ + + if (HW_DECODING_VAAPI == hwMode) + { + strcpy(hwtype, "vaapi"); + } + else if (HW_DECODING_OPENCL == hwMode) + { + strcpy(hwtype, "opencl"); + } + else if (HW_DECODING_AUTO == hwMode) + { + strcpy(hwtype, "vaapi"); + + type = av_hwdevice_find_type_by_name(hwtype); + if (AV_HWDEVICE_TYPE_NONE == type) + { + strcpy(hwtype, "opencl"); + } + } + +#endif + + type = av_hwdevice_find_type_by_name(hwtype); + if (AV_HWDEVICE_TYPE_NONE == type) + { + log_print(HT_LOG_WARN, "%s, hwdevice type %s not support\r\n", __FUNCTION__, hwtype); + + while ((type = av_hwdevice_iterate_types(type)) != AV_HWDEVICE_TYPE_NONE) + { + log_print(HT_LOG_INFO, "%s, %s\r\n", __FUNCTION__, av_hwdevice_get_type_name(type)); + } + + return -1; + } + + for (i = 0;; i++) + { + const AVCodecHWConfig * config = avcodec_get_hw_config(m_pCodec, i); + if (!config) + { + log_print(HT_LOG_WARN, "%s, decoder %s does not support device type %s\r\n", __FUNCTION__, + m_pCodec->long_name, av_hwdevice_get_type_name(type)); + return -1; + } + + if (config->methods & AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX && + config->device_type == type) + { + m_hwPixFmt = config->pix_fmt; + break; + } + } + + err = av_hwdevice_ctx_create(&m_pHWDeviceCtx, type, NULL, NULL, 0); + if (err < 0) + { + log_print(HT_LOG_ERR, "%s, Failed to create specified HW device, type=%s\r\n", + __FUNCTION__, av_hwdevice_get_type_name(type)); + return err; + } + + ctx->opaque = this; + ctx->get_format = ::getHWFormat; + ctx->hw_device_ctx = av_buffer_ref(m_pHWDeviceCtx); + + g_hw_decoder_nums++; + + return err; +} + +BOOL CVideoDecoder::getHWFormat(AVCodecContext *ctx, const AVPixelFormat *pix_fmts, AVPixelFormat *dst) +{ + const AVPixelFormat *p; + + *dst = AV_PIX_FMT_NONE; + + for (p = pix_fmts; *p != -1; p++) + { + if (*p == m_hwPixFmt) + { + *dst = *p; + return TRUE; + } + } + + for (p = pix_fmts; *p != -1; p++) + { + if (*p == AV_PIX_FMT_YUV420P) + { + *dst = *p; + return TRUE; + } + } + + for (p = pix_fmts; *p != -1; p++) + { + if (*p == AV_PIX_FMT_YUVJ420P || *p == AV_PIX_FMT_YUVJ422P) + { + *dst = *p; + return TRUE; + } + } + + if (*pix_fmts != -1) + { + *dst = *pix_fmts; + return TRUE; + } + + log_print(HT_LOG_ERR, "%s, Failed to get HW surface format\r\n", __FUNCTION__); + + return FALSE; +} + +int CVideoDecoder::getWidth() +{ + if (m_pContext) + { + return m_pContext->width; + } + + return 0; +} + +int CVideoDecoder::getHeight() +{ + if (m_pContext) + { + return m_pContext->height; + } + + return 0; +} + +double CVideoDecoder::getFrameRate() +{ + if (m_pContext) + { + if (m_pContext->framerate.den > 0) + { + return (double)((double)(m_pContext->framerate.num) / m_pContext->framerate.den); + } + } + + return 0; +} + +BOOL CVideoDecoder::decode(AVPacket * pkt) +{ + if (!m_bInited) + { + return FALSE; + } + + int cnt = 0; + int ret; + +RETRY: + ret = avcodec_send_packet(m_pContext, pkt); + if (ret == AVERROR(EAGAIN)) + { + readFrame(); + + if (cnt++ < 3) + { + goto RETRY; + } + } + else if (ret < 0) + { + return FALSE; + } + + if (ret >= 0) + { + return readFrame(); + } + else + { + return FALSE; + } +} + +BOOL CVideoDecoder::decode(uint8 * data, int len, int64_t pts) +{ + AVPacket packet; + + av_init_packet(&packet); + + packet.data = data; + packet.size = len; + packet.pts = packet.dts = pts; + + return decode(&packet); +} + +BOOL CVideoDecoder::readFrame() +{ + int ret = 0; + AVFrame * tmp_frame = NULL; + + while (ret >= 0) + { + ret = avcodec_receive_frame(m_pContext, m_pFrame); + if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) + { + return TRUE; + } + else if (ret < 0) + { + log_print(HT_LOG_ERR, "%s, avcodec_receive_frame, ret=%d\r\n", __FUNCTION__, ret); + return FALSE; + } + + if (m_pFrame->format == m_hwPixFmt) + { + /* retrieve data from GPU to CPU */ + ret = av_hwframe_transfer_data(m_pSoftFrame, m_pFrame, 0); + if (ret < 0) + { + log_print(HT_LOG_ERR, "%s, error transferring the data to system memory, ret=%d\r\n", __FUNCTION__, ret); + return FALSE; + } + + m_pSoftFrame->pts = m_pFrame->pts; + m_pSoftFrame->pkt_dts = m_pFrame->pkt_dts; + + tmp_frame = m_pSoftFrame; + } + else + { + tmp_frame = m_pFrame; + } + + render(tmp_frame); + + av_frame_unref(tmp_frame); + } + + return TRUE; +} + +int CVideoDecoder::render(AVFrame * frame) +{ + if (m_pCallback) + { + m_pCallback(frame, m_pUserdata); + } + + return 1; +} + +void CVideoDecoder::flush() +{ + if (NULL == m_pContext || + NULL == m_pContext->codec || + !(m_pContext->codec->capabilities | AV_CODEC_CAP_DELAY)) + { + return; + } + + decode(NULL); +} + + + + diff --git a/MediaClient/MediaClientForMobile/media/video_decoder.h b/MediaClient/MediaClientForMobile/media/video_decoder.h new file mode 100644 index 0000000..e6d6039 --- /dev/null +++ b/MediaClient/MediaClientForMobile/media/video_decoder.h @@ -0,0 +1,89 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef VIDEO_DECODER_H +#define VIDEO_DECODER_H + +#include "sys_inc.h" +#include "media_format.h" + +extern "C" +{ +#include "libavcodec/avcodec.h" +#include "libavutil/avutil.h" +#include "libswscale/swscale.h" +#include "libavformat/avformat.h" +#include +} + +#define HW_DECODING_AUTO 0 // automatic select video acceleration hardware +#define HW_DECODING_D3D11 1 // D3D11 video acceleration +#define HW_DECODING_DXVA 2 // DXVA video acceleration +#define HW_DECODING_VAAPI 3 // VAAPI video acceleration +#define HW_DECODING_OPENCL 4 // OPENCL video acceleration +#define HW_DECODING_VIDEOTOOLBOX 5 // VideoToolBox video acceleration +#define HW_DECODING_MEDIACODEC 6 // MediaCodec video acceleration +#define HW_DECODING_DISABLE -1 // disable video acceleration + +typedef void (*VDCB)(AVFrame * frame, void *pUserdata); + +class CVideoDecoder +{ +public: + CVideoDecoder(); + ~CVideoDecoder(); + +public: + BOOL init(int codec, uint8 * extradata = NULL, int extradata_size = 0, int hwMode = HW_DECODING_AUTO); + BOOL init(enum AVCodecID codec, uint8 * extradata = NULL, int extradata_size = 0, int hwMode = HW_DECODING_AUTO); + void uninit(); + + int getWidth(); + int getHeight(); + double getFrameRate(); + + BOOL decode(uint8 * data, int len, int64_t pts = AV_NOPTS_VALUE); + BOOL decode(AVPacket *pkt); + void setCallback(VDCB pCallback, void * pUserdata) {m_pCallback = pCallback; m_pUserdata = pUserdata;} + BOOL getHWFormat(AVCodecContext *ctx, const AVPixelFormat *pix_fmts, AVPixelFormat *dst); + +private: + BOOL readFrame(); + int render(AVFrame * frame); + void flush(); + int hwDecoderInit(AVCodecContext *ctx, int hwMode); + +private: + BOOL m_bInited; + + AVCodec * m_pCodec; + AVCodecContext* m_pContext; + AVFrame * m_pFrame; + AVFrame * m_pSoftFrame; + + VDCB m_pCallback; + void * m_pUserdata; + + AVPixelFormat m_hwPixFmt; + AVBufferRef * m_pHWDeviceCtx; +}; + +#endif + + diff --git a/MediaClient/MediaClientForMobile/media/video_player.cpp b/MediaClient/MediaClientForMobile/media/video_player.cpp new file mode 100644 index 0000000..ce4de55 --- /dev/null +++ b/MediaClient/MediaClientForMobile/media/video_player.cpp @@ -0,0 +1,742 @@ +/*************************************************************************************** + * + * 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 "video_player.h" +#include "utils.h" +#include "media_util.h" +#include "media_parse.h" +#include "media_codec.h" +#include "h264.h" +#include "h265.h" + +extern "C" +{ +#include +#include +#include +#include +#include +#include +#include +#include +} + +#if __WINDOWS_OS__ +#include "video_render_d3d.h" +#include "video_render_gdi.h" +#include "audio_play_win.h" +#elif defined (IOS) +#include "video_render.h" +#include "audio_play_qt.h" +#elif defined (ANDROID) +#include "video_render.h" +#include "audio_play_qt.h" +#elif __LINUX_OS__ +#include "video_render_sdl.h" +#include "audio_play_qt.h" +#endif + +void VideoDecoderCallback(AVFrame * frame, void * userdata) +{ + CVideoPlayer * pPlayer = (CVideoPlayer *) userdata; + + pPlayer->onVideoFrame(frame); +} + +void AudioDecoderCallback(AVFrame * frame, void * userdata) +{ + CVideoPlayer * pPlayer = (CVideoPlayer *) userdata; + + pPlayer->onAudioFrame(frame); +} + +CVideoPlayer::CVideoPlayer(QObject * parent) +: QObject(parent) +, m_bVideoInited(FALSE) +, m_bAudioInited(FALSE) +, m_pVideoDecoder(NULL) +, m_pAudioDecoder(NULL) +, m_pAudioPlay(NULL) +, m_bPlaying(FALSE) +, m_bPaused(FALSE) +, m_nVideoWnd(0) +, m_bSizeChanged(FALSE) +, m_nHWDecoding(HW_DECODING_AUTO) +, m_nDstVideoFmt(AV_PIX_FMT_YUV420P) +, m_bUpdown(FALSE) +, m_bSnapshot(FALSE) +, m_nSnapVideoFmt(VIDEO_FMT_BGR24) +, m_nVideoCodec(VIDEO_CODEC_NONE) +, m_nAudioCodec(AUDIO_CODEC_NONE) +, m_nSampleRate(0) +, m_nChannel(0) +, m_nBitPerSample(0) +, m_pSnapFrame(NULL) +, m_pRenderFrame(NULL) +, m_bRecording(FALSE) +, m_bNalFlag(FALSE) +, m_pAviCtx(NULL) +{ + m_pRecordMutex = sys_os_create_mutex(); + + memset(&m_h26XParamSets, 0, sizeof(H26XParamSets)); + memset(&m_audioClock, 0, sizeof(HTCLOCK)); + memset(&m_videoClock, 0, sizeof(HTCLOCK)); +} + +CVideoPlayer::~CVideoPlayer() +{ + close(); +} + +BOOL CVideoPlayer::open(QString fileName, WId hWnd) +{ + m_sFileName = fileName; + m_nVideoWnd = hWnd; + + return TRUE; +} + +void CVideoPlayer::close() +{ + closeVideo(); + closeAudio(); + + if (m_pSnapFrame) + { + av_frame_free(&m_pSnapFrame); + } + + if (m_pRenderFrame) + { + av_frame_free(&m_pRenderFrame); + } + + stopRecord(); + + sys_os_destroy_sig_mutex(m_pRecordMutex); + m_pRecordMutex = NULL; +} + +void CVideoPlayer::setVolume(int volume) +{ + if (m_pAudioPlay) + { + m_pAudioPlay->setVolume(volume); + } +} + +void CVideoPlayer::snapshot(int videofmt) +{ + m_bSnapshot = TRUE; + m_nSnapVideoFmt = videofmt; +} + +BOOL CVideoPlayer::record(QString filepath) +{ + if (m_bRecording) + { + return TRUE; + } + + m_pAviCtx = avi_write_open(filepath.toLocal8Bit().toStdString().c_str()); + if (NULL == m_pAviCtx) + { + log_print(HT_LOG_ERR, "%s, avi_write_open failed. %s\r\n", + __FUNCTION__, filepath.toLocal8Bit().toStdString().c_str()); + return FALSE; + } + + if (!onRecord()) + { + avi_write_close(m_pAviCtx); + m_pAviCtx = NULL; + + return FALSE; + } + + m_bRecording = TRUE; + + return m_bRecording; +} + +void CVideoPlayer::stopRecord() +{ + sys_os_mutex_enter(m_pRecordMutex); + + m_bRecording = FALSE; + m_bNalFlag = FALSE; + + memset(&m_h26XParamSets, 0, sizeof(H26XParamSets)); + + if (m_pAviCtx) + { + avi_write_close(m_pAviCtx); + m_pAviCtx = NULL; + } + + sys_os_mutex_leave(m_pRecordMutex); +} + +void CVideoPlayer::recordVideo(uint8 * data, int len, uint32 ts, uint16 seq) +{ + int codec = VIDEO_CODEC_NONE; + + if (!memcmp(m_pAviCtx->v_fcc, "H264", 4)) + { + codec = VIDEO_CODEC_H264; + } + else if (!memcmp(m_pAviCtx->v_fcc, "H265", 4)) + { + codec = VIDEO_CODEC_H265; + } + + if ((VIDEO_CODEC_H264 == codec || VIDEO_CODEC_H265 == codec) && !m_bNalFlag) + { + if (avc_get_h26x_paramsets(data, len, codec, &m_h26XParamSets)) + { + avi_write_nalu(m_pAviCtx, + m_h26XParamSets.vps, m_h26XParamSets.vps_size, + m_h26XParamSets.sps, m_h26XParamSets.sps_size, + m_h26XParamSets.pps, m_h26XParamSets.pps_size); + m_bNalFlag = 1; + } + } + + recordVideoEx(data, len, ts, seq); + + if (recordSwitchCheck()) + { + recordFileSwitch(); + } +} + +void CVideoPlayer::recordVideoEx(uint8 * data, int len, uint32 ts, uint16 seq) +{ + AVICTX * p_avictx = m_pAviCtx; + + if (p_avictx->v_width == 0 || p_avictx->v_height == 0) + { + int codec = VIDEO_CODEC_NONE; + + if (memcmp(p_avictx->v_fcc, "H264", 4) == 0) + { + codec = VIDEO_CODEC_H264; + } + else if (memcmp(p_avictx->v_fcc, "H265", 4) == 0) + { + codec = VIDEO_CODEC_H265; + } + else if (memcmp(p_avictx->v_fcc, "JPEG", 4) == 0) + { + codec = VIDEO_CODEC_JPEG; + } + else if (memcmp(p_avictx->v_fcc, "MP4V", 4) == 0) + { + codec = VIDEO_CODEC_MP4; + } + + avc_parse_video_size(codec, data, len, &p_avictx->v_width, &p_avictx->v_height); + + if (p_avictx->v_width && p_avictx->v_height) + { + avi_update_header(p_avictx); + } + } + + int key = 0; + + if (memcmp(p_avictx->v_fcc, "H264", 4) == 0) + { + uint8 nalu_t = (data[4] & 0x1F); + key = (nalu_t == 5 || nalu_t == 7 || nalu_t == 8); + } + else if (memcmp(p_avictx->v_fcc, "H265", 4) == 0) + { + uint8 nalu_t = (data[4] >> 1) & 0x3F; + key = ((nalu_t >= 16 && nalu_t <= 21) || nalu_t == 32 || nalu_t == 33 || nalu_t == 34); + } + else if (memcmp(p_avictx->v_fcc, "MP4V", 4) == 0) + { + key = 1; + } + else if (memcmp(p_avictx->v_fcc, "JPEG", 4) == 0) + { + key = 1; + } + + avi_write_video(p_avictx, data, len, ts, key); +} + +void CVideoPlayer::recordAudio(uint8 * data, int len, uint32 ts, uint16 seq) +{ + AVICTX * p_avictx = m_pAviCtx; + + avi_write_audio(p_avictx, data, len, ts); + + if (recordSwitchCheck()) + { + recordFileSwitch(); + } +} + +BOOL CVideoPlayer::recordSwitchCheck() +{ + uint64 tlen = avi_get_file_length(m_pAviCtx); + uint32 mtime = avi_get_media_time(m_pAviCtx); + + uint32 recordSize = getRecordSize(); + if (recordSize == 0) + { + recordSize = 1048576; // max 1G file size + } + + // Switch according to the recording size + if (tlen > recordSize * 1024) + { + return TRUE; + } + + uint32 recordTime = getRecordTime(); + + // Switch according to the recording duration + if (recordTime > 0 && mtime > recordTime * 1000) + { + return TRUE; + } + + return FALSE; +} + +void CVideoPlayer::recordFileSwitch() +{ + onRecordFileSwitch(); +} + +BOOL CVideoPlayer::openVideo(enum AVCodecID codec, uint8 * extradata, int extradata_size) +{ + if (m_bVideoInited) + { + return TRUE; + } + + m_pVideoDecoder = new CVideoDecoder(); + if (m_pVideoDecoder) + { + m_bVideoInited = m_pVideoDecoder->init(codec, extradata, extradata_size, m_nHWDecoding); + } + + if (m_bVideoInited) + { + m_pVideoDecoder->setCallback(VideoDecoderCallback, this); + } + + m_nVideoCodec = to_video_codec(codec); + + return m_bVideoInited; +} + +BOOL CVideoPlayer::openVideo(int codec, uint8 * extradata, int extradata_size) +{ + return openVideo(to_video_avcodecid(codec), extradata, extradata_size); +} + +void CVideoPlayer::closeVideo() +{ + if (m_pVideoDecoder) + { + delete m_pVideoDecoder; + m_pVideoDecoder = NULL; + } + + m_bVideoInited = FALSE; +} + +BOOL CVideoPlayer::openAudio(enum AVCodecID codec, int samplerate, int channels, int bitpersample) +{ + if (m_bAudioInited) + { + return TRUE; + } + + m_pAudioDecoder = new CAudioDecoder(); + if (m_pAudioDecoder) + { + m_bAudioInited = m_pAudioDecoder->init(codec, samplerate, channels, bitpersample); + } + + if (m_bAudioInited) + { + m_pAudioDecoder->setCallback(AudioDecoderCallback, this); + +#if __WINDOWS_OS__ + m_pAudioPlay = new CWAudioPlay(); +#elif __LINUX_OS__ + m_pAudioPlay = new CQAudioPlay(); +#endif + if (m_pAudioPlay) + { + m_pAudioPlay->startPlay(samplerate, channels); + } + } + + m_nAudioCodec = to_audio_codec(codec); + m_nSampleRate = samplerate; + m_nChannel = channels; + m_nBitPerSample = bitpersample; + + return m_bAudioInited; +} + +BOOL CVideoPlayer::openAudio(int codec, int samplerate, int channels, int bitpersample) +{ + return openAudio(to_audio_avcodecid(codec), samplerate, channels, bitpersample); +} + +void CVideoPlayer::closeAudio() +{ + if (m_pAudioDecoder) + { + delete m_pAudioDecoder; + m_pAudioDecoder = NULL; + } + + if (m_pAudioPlay) + { + delete m_pAudioPlay; + m_pAudioPlay = NULL; + } + + m_bAudioInited = FALSE; +} + +void CVideoPlayer::setWindowSize(QSize size) +{ + m_bSizeChanged = TRUE; + m_size = size; +} + +int CVideoPlayer::getVideoWidth() +{ + if (m_pVideoDecoder) + { + return m_pVideoDecoder->getWidth(); + } + + return 0; +} + +int CVideoPlayer::getVideoHeight() +{ + if (m_pVideoDecoder) + { + return m_pVideoDecoder->getHeight(); + } + + return 0; +} + +double CVideoPlayer::getFrameRate() +{ + if (m_pVideoDecoder) + { + return m_pVideoDecoder->getFrameRate(); + } + + return 0; +} + +void CVideoPlayer::playVideo(uint8 * data, int len, uint32 ts, uint16 seq) +{ + emit updateStatistics(len); + + if (m_bRecording) + { + sys_os_mutex_enter(m_pRecordMutex); + recordVideo(data, len, ts, seq); + sys_os_mutex_leave(m_pRecordMutex); + } + + updateClock(&m_videoClock, ts, getVideoClock()); + + if (m_bVideoInited) + { + m_pVideoDecoder->decode(data, len, m_videoClock.SyncTime.tv_sec * 1000000 + m_videoClock.SyncTime.tv_usec); + } + else + { + int codec = getVideoCodec(); + + if (VIDEO_CODEC_H264 == codec || VIDEO_CODEC_H265 == codec) + { + if (avc_get_h26x_paramsets(data, len, codec, &m_h26XParamSets)) + { + int extradata_size = 0; + uint8 extradata[1024]; + + if (VIDEO_CODEC_H264 == codec) + { + memcpy(extradata, m_h26XParamSets.sps, m_h26XParamSets.sps_size); + extradata_size += m_h26XParamSets.sps_size; + memcpy(extradata+extradata_size, m_h26XParamSets.pps, m_h26XParamSets.pps_size); + extradata_size += m_h26XParamSets.pps_size; + + if (openVideo(codec, extradata, extradata_size)) + { + m_pVideoDecoder->decode(m_h26XParamSets.sps, m_h26XParamSets.sps_size); + m_pVideoDecoder->decode(m_h26XParamSets.pps, m_h26XParamSets.pps_size); + m_pVideoDecoder->decode(data, len); + } + } + else if (VIDEO_CODEC_H265 == codec) + { + int extradata_size = 0; + uint8 extradata[2048]; + + memcpy(extradata, m_h26XParamSets.vps, m_h26XParamSets.vps_size); + extradata_size += m_h26XParamSets.vps_size; + memcpy(extradata+extradata_size, m_h26XParamSets.sps, m_h26XParamSets.sps_size); + extradata_size += m_h26XParamSets.sps_size; + memcpy(extradata+extradata_size, m_h26XParamSets.pps, m_h26XParamSets.pps_size); + extradata_size += m_h26XParamSets.pps_size; + + if (openVideo(codec, extradata, extradata_size)) + { + m_pVideoDecoder->decode(m_h26XParamSets.vps, m_h26XParamSets.vps_size); + m_pVideoDecoder->decode(m_h26XParamSets.sps, m_h26XParamSets.sps_size); + m_pVideoDecoder->decode(m_h26XParamSets.pps, m_h26XParamSets.pps_size); + m_pVideoDecoder->decode(data, len); + } + } + } + } + } +} + +void CVideoPlayer::playAudio(uint8 * data, int len, uint32 ts, uint16 seq) +{ + emit updateStatistics(len); + + if (m_bRecording) + { + sys_os_mutex_enter(m_pRecordMutex); + recordAudio(data, len, ts, seq); + sys_os_mutex_leave(m_pRecordMutex); + } + + updateClock(&m_audioClock, ts, getAudioClock()); + + if (m_bAudioInited) + { + m_pAudioDecoder->decode(data, len, m_audioClock.SyncTime.tv_sec * 1000000 + m_audioClock.SyncTime.tv_usec); + } +} + +void CVideoPlayer::updateClock(HTCLOCK * clock, uint32 ts, int frequency) +{ + if (ts == 0) + { + return; + } + + if (clock->SyncTime.tv_sec == 0 && clock->SyncTime.tv_usec == 0) + { + clock->SyncTimestamp = ts; + gettimeofday(&clock->SyncTime, NULL); + } + + int timestampDiff = ts - clock->SyncTimestamp; + + // Divide this by the timestamp frequency to get real time: + double timeDiff = timestampDiff / (double)frequency; + + uint32 const million = 1000000; + uint32 seconds, uSeconds; + + if (timeDiff >= 0.0) + { + seconds = clock->SyncTime.tv_sec + (uint32)(timeDiff); + uSeconds = clock->SyncTime.tv_usec + (uint32)((timeDiff - (uint32)timeDiff)*million); + if (uSeconds >= million) + { + uSeconds -= million; + ++seconds; + } + } + else + { + timeDiff = -timeDiff; + seconds = clock->SyncTime.tv_sec - (uint32)(timeDiff); + uSeconds = clock->SyncTime.tv_usec - (uint32)((timeDiff - (uint32)timeDiff)*million); + if ((int)uSeconds < 0) + { + uSeconds += million; + --seconds; + } + } + + // Save these as the new synchronization timestamp & time: + clock->SyncTimestamp = ts; + clock->SyncTime.tv_sec = seconds; + clock->SyncTime.tv_usec = uSeconds; +} + +BOOL CVideoPlayer::initFrame(AVFrame *& frame, int width, int height, AVPixelFormat pixfmt) +{ + if (width == 0 || height == 0 || pixfmt == AV_PIX_FMT_NONE) + { + return FALSE; + } + + if (NULL == frame || frame->width != width || frame->height != height || frame->format != pixfmt) + { + if (frame) + { + av_frame_free(&frame); + } + + frame = av_frame_alloc(); + if (NULL == frame) + { + return FALSE; + } + + frame->format = pixfmt; + frame->width = width; + frame->height = height; + + if (0 != av_frame_get_buffer(frame, 0)) + { + av_frame_free(&frame); + return FALSE; + } + + av_frame_make_writable(frame); + } + + return TRUE; +} + +BOOL CVideoPlayer::initVideoRender(int width, int height) +{ + return TRUE; +} + +BOOL CVideoPlayer::doSnapshot(AVFrame * frame) +{ + if (!initFrame(m_pSnapFrame, frame->width, frame->height, to_avpixelformat(m_nSnapVideoFmt))) + { + return FALSE; + } + + if (NULL == convertFrame(frame, m_pSnapFrame, FALSE)) + { + return FALSE; + } + + emit snapshoted(m_pSnapFrame); + + return TRUE; +} + +AVFrame * CVideoPlayer::convertFrame(AVFrame * srcframe, AVFrame * dstframe, BOOL updown) +{ + if (NULL == srcframe || NULL == dstframe) + { + return NULL; + } + + SwsContext * swsctx = sws_getContext(srcframe->width, srcframe->height, (enum AVPixelFormat)srcframe->format, + srcframe->width, srcframe->height, (enum AVPixelFormat)dstframe->format, SWS_BICUBIC, NULL, NULL, NULL); + if (swsctx) + { + if (updown) + { + srcframe->data[0] += srcframe->linesize[0] * (srcframe->height - 1); + srcframe->linesize[0] *= -1; + srcframe->data[1] += srcframe->linesize[1] * (srcframe->height / 2 - 1); + srcframe->linesize[1] *= -1; + srcframe->data[2] += srcframe->linesize[2] * (srcframe->height / 2 - 1); + srcframe->linesize[2] *= -1; + } + + int ret = sws_scale(swsctx, srcframe->data, srcframe->linesize, 0, srcframe->height, dstframe->data, dstframe->linesize); + if (ret > 0) + { + dstframe->pts = srcframe->pts; + dstframe->pkt_dts = srcframe->pkt_dts; + + sws_freeContext(swsctx); + return dstframe; + } + else + { + log_print(HT_LOG_ERR, "%s, sws_scale failed\r\n", __FUNCTION__); + + sws_freeContext(swsctx); + return NULL; + } + } + + return NULL; +} + +void CVideoPlayer::onVideoFrame(AVFrame * frame) +{ + // Perform snapshot request + if (m_bSnapshot) + { + if (doSnapshot(frame)) + { + m_bSnapshot = FALSE; + } + } + + AVFrame * dst = NULL; + + if (m_nDstVideoFmt != frame->format) + { + if (initFrame(m_pRenderFrame, frame->width, frame->height, m_nDstVideoFmt)) + { + if (NULL != convertFrame(frame, m_pRenderFrame, m_bUpdown)) + { + dst = av_frame_clone(m_pRenderFrame); + } + } + } + else + { + dst = av_frame_clone(frame); + } + + emit imageReady(dst); +} + +void CVideoPlayer::onAudioFrame(AVFrame * frame) +{ + if (m_pAudioPlay) + { + // Will wait for the playback to complete before returning + m_pAudioPlay->playAudio(frame->data[0], frame->nb_samples * frame->channels * 2); + } +} + + + diff --git a/MediaClient/MediaClientForMobile/media/video_player.h b/MediaClient/MediaClientForMobile/media/video_player.h new file mode 100644 index 0000000..b819c71 --- /dev/null +++ b/MediaClient/MediaClientForMobile/media/video_player.h @@ -0,0 +1,190 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef VIDEO_PLAYER_H +#define VIDEO_PLAYER_H + +#include "sys_inc.h" +#include "media_util.h" +#include "hqueue.h" +#include "video_decoder.h" +#include "audio_decoder.h" +#include "video_render.h" +#include "audio_play.h" +#include "avi_write.h" +#include +#include +#include + +typedef struct +{ + uint32 SyncTimestamp; + struct timeval SyncTime; +} HTCLOCK; + +typedef std::list FRAMELIST; + +class CVideoPlayer : public QObject +{ + Q_OBJECT + +public: + CVideoPlayer(QObject * parent = 0); + virtual ~CVideoPlayer(); + + virtual BOOL open(QString fileName, WId hWnd); + virtual BOOL play() = 0; + virtual void stop() = 0; + virtual BOOL pause() = 0; + virtual void close(); + virtual BOOL seek(int pos) { return FALSE; } + virtual BOOL isPlaying() {return m_bPlaying;} + virtual BOOL isPaused() {return m_bPaused;} + virtual void setVolume(int volume); + virtual void snapshot(int videofmt); + virtual BOOL record(QString filepath); + virtual void stopRecord(); + virtual BOOL isRecording() {return m_bRecording;} + virtual BOOL onRecord() {return FALSE;} + virtual void onRecordFileSwitch() {} + virtual int getVideoClock() {return 1000;} + virtual int getAudioClock() {return 1000;} + virtual void setWindowSize(QSize size); + virtual int64 getElapse() {return 0;} + virtual int64 getDuration() {return 0;} + virtual int getVideoCodec() {return m_nVideoCodec;} + virtual int getAudioCodec() {return m_nAudioCodec;} + + virtual void setAuthInfo(QString acct, QString pass) {m_acct=acct; m_pass=pass;} + virtual void setHWDecoding(int mode) {m_nHWDecoding=mode;} + virtual void setRtpMulticast(BOOL flag) {} + virtual void setRtpOverUdp(BOOL flag) {} + +#ifdef OVER_HTTP + virtual void setRtspOverHttp(int flag, int port) {} +#endif + +#ifdef OVER_WEBSOCKET + virtual void setRtspOverWs(int flag, int port) {} +#endif + +#ifdef BACKCHANNEL + virtual int getBCFlag() {return 0;} + virtual void setBCFlag(int flag) {} + virtual int getBCDataFlag() {return 0;} + virtual void setBCDataFlag(int flag) {} + virtual void setAudioDevice(int index) {} +#endif + +#ifdef REPLAY + virtual int getReplayFlag() {return 0;} + virtual void setReplayFlag(int flag) {} + virtual void setScale(double scale) {} + virtual void setRateControlFlag(int flag) {} + virtual void setImmediateFlag(int flag) {} + virtual void setFramesFlag(int flag, int interval) {} + virtual void setReplayRange(time_t start, time_t end) {} +#endif + + BOOL openVideo(int codec, uint8 * extradata = NULL, int extradata_size = 0); + BOOL openVideo(enum AVCodecID codec, uint8 * extradata = NULL, int extradata_size = 0); + void closeVideo(); + BOOL openAudio(int codec, int samplerate, int channels, int bitpersample = 0); + BOOL openAudio(enum AVCodecID codec, int samplerate, int channels, int bitpersample = 0); + void closeAudio(); + + void playVideo(uint8 * data, int len, uint32 ts, uint16 seq); + void playAudio(uint8 * data, int len, uint32 ts, uint16 seq); + + void recordVideo(uint8 * data, int len, uint32 ts, uint16 seq); + void recordAudio(uint8 * data, int len, uint32 ts, uint16 seq); + + int getVideoWidth(); + int getVideoHeight(); + double getFrameRate(); + int getSampleRate() {return m_nSampleRate;} + int getChannel() {return m_nChannel;} + + void onVideoFrame(AVFrame * frame); + void onAudioFrame(AVFrame * frame); + void audioPlayThread(); + void videoPlayThread(); + +signals: + void notify(int); + void snapshoted(AVFrame *); + void imageReady(AVFrame *); + void updateStatistics(int); + +protected: + void updateClock(HTCLOCK * clock, uint32 ts, int frequency); + BOOL initFrame(AVFrame *& frame, int width, int height, AVPixelFormat pixfmt); + BOOL initVideoRender(int width, int height); + BOOL doSnapshot(AVFrame * srcframe); + AVFrame * convertFrame(AVFrame * srcframe, AVFrame * dstframe, BOOL updown); + void recordVideoEx(uint8 * data, int len, uint32 ts, uint16 seq); + BOOL recordSwitchCheck(); + void recordFileSwitch(); + +protected: + BOOL m_bVideoInited; + BOOL m_bAudioInited; + CVideoDecoder * m_pVideoDecoder; + CAudioDecoder * m_pAudioDecoder; + CAudioPlay * m_pAudioPlay; + + BOOL m_bPlaying; + BOOL m_bPaused; + + QString m_acct; + QString m_pass; + QString m_sFileName; + WId m_nVideoWnd; + QSize m_size; + BOOL m_bSizeChanged; + int m_nHWDecoding; + AVPixelFormat m_nDstVideoFmt; + BOOL m_bUpdown; + BOOL m_bSnapshot; + int m_nSnapVideoFmt; + + H26XParamSets m_h26XParamSets; + + int m_nVideoCodec; + int m_nAudioCodec; + int m_nSampleRate; + int m_nChannel; + int m_nBitPerSample; + + AVFrame * m_pSnapFrame; + AVFrame * m_pRenderFrame; + + BOOL m_bRecording; + BOOL m_bNalFlag; + AVICTX * m_pAviCtx; + void * m_pRecordMutex; + + HTCLOCK m_audioClock; + HTCLOCK m_videoClock; +}; + +#endif // end of VIDEO_PLAYER_H + + + diff --git a/MediaClient/MediaClientForMobile/media/video_render.cpp b/MediaClient/MediaClientForMobile/media/video_render.cpp new file mode 100644 index 0000000..f944be7 --- /dev/null +++ b/MediaClient/MediaClientForMobile/media/video_render.cpp @@ -0,0 +1,60 @@ +/*************************************************************************************** + * + * 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 "video_render.h" + + +CVideoRender::CVideoRender() +: m_bInited(FALSE) +, m_hWnd(0) +, m_nVideoWidth(0) +, m_nVideoHeight(0) +, m_nVideoFmt(VIDEO_FMT_YUV420P) +{ + +} + +CVideoRender::~CVideoRender() +{ + unInit(); +} + +BOOL CVideoRender::init(WId hWnd, int w, int h, int videofmt) +{ + m_hWnd = hWnd; + m_nVideoWidth = w; + m_nVideoHeight = h; + m_nVideoFmt = videofmt; + + return TRUE; +} + +void CVideoRender::unInit() +{ + m_bInited = FALSE; +} + +BOOL CVideoRender::render(AVFrame * frame, int mode) +{ + return FALSE; +} + + + diff --git a/MediaClient/MediaClientForMobile/media/video_render.h b/MediaClient/MediaClientForMobile/media/video_render.h new file mode 100644 index 0000000..309561a --- /dev/null +++ b/MediaClient/MediaClientForMobile/media/video_render.h @@ -0,0 +1,62 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef VIDEO_RENDER_H +#define VIDEO_RENDER_H + +#include "media_format.h" +#include +extern "C" +{ +#include +} + +/***************************************************************************************/ + +#define RENDER_MODE_KEEP 0 +#define RENDER_MODE_FILL 1 + +/***************************************************************************************/ + +class CVideoRender +{ +public: + CVideoRender(); + virtual ~CVideoRender(); + + virtual BOOL init(WId hWnd, int w, int h, int videofmt); + virtual void unInit(); + + virtual BOOL render(AVFrame * frame, int mode); + virtual void setWindowSize(QSize size) {} + +protected: + BOOL m_bInited; + WId m_hWnd; + int m_nVideoWidth; + int m_nVideoHeight; + int m_nVideoFmt; +}; + + +#endif // end of VIDEO_RENDER_H + + + + diff --git a/MediaClient/MediaClientForMobile/ui/About.ui b/MediaClient/MediaClientForMobile/ui/About.ui new file mode 100644 index 0000000..e6c6344 --- /dev/null +++ b/MediaClient/MediaClientForMobile/ui/About.ui @@ -0,0 +1,139 @@ + + + About + + + + 0 + 0 + 480 + 800 + + + + About + + + + 16 + + + + + Happytime RTSP Client + + + + + + + + + Home Page + + + + + + + + 0 + 0 + + + + <html><head/><body><p><a href="http://www.happytimesoft.com"><span style=" text-decoration: underline; color:#aa55ff;">http://www.happytimesoft.com</span></a></p></body></html> + + + true + + + + + + + + + <html><head/><body><p>Copyright © Happytimesoft Co., Ltd.</p></body></html> + + + + + + + 10 + + + 10 + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + OK + + + + 24 + 24 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + diff --git a/MediaClient/MediaClientForMobile/ui/FileBrowse.ui b/MediaClient/MediaClientForMobile/ui/FileBrowse.ui new file mode 100644 index 0000000..242b197 --- /dev/null +++ b/MediaClient/MediaClientForMobile/ui/FileBrowse.ui @@ -0,0 +1,185 @@ + + + FileBrowse + + + + 0 + 0 + 480 + 640 + + + + false + + + + + + + + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + + + + + :/res/Resources/back.png:/res/Resources/back.png + + + + 24 + 24 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Check all + + + + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + + + + + :/res/Resources/delete.png:/res/Resources/delete.png + + + + 24 + 24 + + + + + + + + + + Qt::Horizontal + + + + + + + + + + true + + + + + + + + Arial + 12 + + + + Qt::NoFocus + + + Qt::ScrollBarAsNeeded + + + QAbstractItemView::NoEditTriggers + + + true + + + QListView::TopToBottom + + + false + + + QListView::ListMode + + + false + + + true + + + false + + + + + + + + + + diff --git a/MediaClient/MediaClientForMobile/ui/InstMsgDialog.ui b/MediaClient/MediaClientForMobile/ui/InstMsgDialog.ui new file mode 100644 index 0000000..be2b5aa --- /dev/null +++ b/MediaClient/MediaClientForMobile/ui/InstMsgDialog.ui @@ -0,0 +1,49 @@ + + + InstMsgDialog + + + + 0 + 0 + 246 + 42 + + + + + + + 0.500000000000000 + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + + + Qt::AlignCenter + + + true + + + + + + + + diff --git a/MediaClient/MediaClientForMobile/ui/MediaClient.ui b/MediaClient/MediaClientForMobile/ui/MediaClient.ui new file mode 100644 index 0000000..40ab39c --- /dev/null +++ b/MediaClient/MediaClientForMobile/ui/MediaClient.ui @@ -0,0 +1,924 @@ + + + MediaClient + + + + 0 + 0 + 800 + 600 + + + + + 0 + + + 0 + + + 3 + + + 0 + + + 3 + + + + + + 0 + + + 0 + + + 3 + + + 0 + + + 0 + + + + + + + + + 0 + 0 + + + + + + + true + + + true + + + + + + + + 0 + 0 + + + + + 140 + 0 + + + + + + + true + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + true + + + + + + + + + + 1 + + + 0 + + + 0 + + + + + background-color: white; + + + + 0 + + + 1 + + + 1 + + + 1 + + + 1 + + + + + + 0 + 0 + + + + background-color: rgb(0, 0, 0); + + + + + + + + + + background-color: white; + + + + 0 + + + 1 + + + 1 + + + 1 + + + 1 + + + + + + 0 + 0 + + + + background-color: rgb(0, 0, 0); + + + + + + + + + + background-color: white; + + + + 0 + + + 1 + + + 1 + + + 1 + + + 1 + + + + + + 0 + 0 + + + + background-color: rgb(0, 0, 0); + + + + + + + + + + + + 1 + + + 0 + + + 0 + + + + + background-color: white; + + + + 0 + + + 1 + + + 1 + + + 1 + + + 1 + + + + + + 0 + 0 + + + + background-color: rgb(0, 0, 0); + + + + + + + + + + background-color: white; + + + + 0 + + + 1 + + + 1 + + + 1 + + + 1 + + + + + + 0 + 0 + + + + background-color: rgb(0, 0, 0); + + + + + + + + + + background-color: white; + + + + 0 + + + 1 + + + 1 + + + 1 + + + 1 + + + + + + 0 + 0 + + + + background-color: rgb(0, 0, 0); + + + + + + + + + + + + 1 + + + 0 + + + 0 + + + + + background-color: white; + + + + 0 + + + 1 + + + 1 + + + 1 + + + 1 + + + + + + 0 + 0 + + + + background-color: rgb(0, 0, 0); + + + + + + + + + + background-color: white; + + + + 0 + + + 1 + + + 1 + + + 1 + + + 1 + + + + + + 0 + 0 + + + + background-color: rgb(0, 0, 0); + + + + + + + + + + background-color: white; + + + + 0 + + + 1 + + + 1 + + + 1 + + + 1 + + + + + + 0 + 0 + + + + background-color: rgb(0, 0, 0); + + + + + + + + + + + + + 0 + 0 + + + + + 40 + 0 + + + + + 3 + + + 0 + + + 3 + + + 0 + + + 3 + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + Play + + + + + + + :/res/Resources/btn_play.png:/res/Resources/btn_play.png + + + + 24 + 24 + + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + Pause + + + + + + + :/res/Resources/btn_pause.png:/res/Resources/btn_pause.png + + + + 24 + 24 + + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + Stop + + + + + + + :/res/Resources/btn_stop.png:/res/Resources/btn_stop.png + + + + 24 + 24 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + Mute + + + + + + + :/res/Resources/volume.png:/res/Resources/volume.png + + + + 24 + 24 + + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + Snapshot + + + + + + + :/res/Resources/snapshot.png:/res/Resources/snapshot.png + + + + 24 + 24 + + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + Record + + + + + + + :/res/Resources/video_record.png:/res/Resources/video_record.png + + + + 24 + 24 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + 0 + 0 + + + + + 40 + 0 + + + + + 3 + + + 0 + + + 3 + + + 0 + + + 3 + + + + + + 0 + 0 + + + + + 0 + 0 + + + + Play + + + Setting + + + + 24 + 24 + + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + Pause + + + Snapshot + + + + 24 + 24 + + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + Stop + + + Record + + + + 24 + 24 + + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + Mute + + + About + + + + 24 + 24 + + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + Mute + + + Quit + + + + 24 + 24 + + + + + + + + + + + + + VideoWidget + QWidget +
VideoWidget.h
+ 1 +
+
+ + + + +
diff --git a/MediaClient/MediaClientForMobile/ui/OpenMedia.ui b/MediaClient/MediaClientForMobile/ui/OpenMedia.ui new file mode 100644 index 0000000..7b25ba7 --- /dev/null +++ b/MediaClient/MediaClientForMobile/ui/OpenMedia.ui @@ -0,0 +1,133 @@ + + + OpenMedia + + + + 0 + 0 + 363 + 176 + + + + Open Media + + + + + + 0 + + + + Open Url + + + + + + + + + + + + Password + + + + + + + QLineEdit::Password + + + + + + + Username + + + + + + + Url + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + OK + + + true + + + true + + + false + + + + + + + Cancel + + + false + + + + + + + + + btnConfirm + btnCancel + tabWidget + editUrl + editUser + editPass + + + + diff --git a/MediaClient/MediaClientForMobile/ui/SystemSetting.ui b/MediaClient/MediaClientForMobile/ui/SystemSetting.ui new file mode 100644 index 0000000..87b1d39 --- /dev/null +++ b/MediaClient/MediaClientForMobile/ui/SystemSetting.ui @@ -0,0 +1,286 @@ + + + SystemSetting + + + + 0 + 0 + 480 + 800 + + + + System Settings + + + + + + + + + 0 + 0 + + + + Enable Log + + + + + + + Log Level + + + + + + + + 0 + 0 + + + + + + + + + + + 0 + 0 + + + + Prefer to use RTP over UDP + + + + + + + + 0 + 0 + + + + Force multicast RTP via RTSP + + + + + + + + 0 + 0 + + + + Tunnel RTSP and RTP over HTTP + + + + + + + + + HTTP port + + + + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 65535 + + + 80 + + + + + + + + + + 0 + 0 + + + + Tunnel RTSP and RTP over Websocket + + + + + + + + + Websocket port + + + + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 65535 + + + 80 + + + + + + + + + Hardware-accelerated decoding + + + + + + + + 0 + 0 + + + + + + + + Default video render mode + + + + + + + + 0 + 0 + + + + + + + + + + Max recording time + + + + + + + + + + HH:mm:ss + + + + + + + + + + + Max file size (KB) + + + + + + + 1048576 + + + + + + + + + + + + 0 + 0 + + + + Confirm + + + + + + + + 0 + 0 + + + + Cancel + + + + + + + + + Qt::Vertical + + + + 20 + 60 + + + + + + + + chkEnableLog + btnConfirm + btnCancel + + + + diff --git a/MediaClient/MediaClientForMobile/utils.cpp b/MediaClient/MediaClientForMobile/utils.cpp new file mode 100644 index 0000000..93c8b49 --- /dev/null +++ b/MediaClient/MediaClientForMobile/utils.cpp @@ -0,0 +1,409 @@ +/*************************************************************************************** + * + * 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 "config.h" +#include "utils.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +QString getSnapshotPath() +{ +#if defined(IOS) + return QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation).last(); +#else + return QStandardPaths::standardLocations(QStandardPaths::PicturesLocation).last(); +#endif +} + +QString getRecordPath() +{ +#if defined(IOS) + return QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation).last(); +#else + return QStandardPaths::standardLocations(QStandardPaths::MoviesLocation).last(); +#endif +} + +QString getOpenFilePath() +{ + QSettings setting; + + return setting.value("openFilePath").toString(); +} + +BOOL getEnableLogFlag() +{ + QSettings setting; + + return setting.value("enableLog", 1).toInt(); +} + +int getVideoRenderMode() +{ + QSettings setting; + + return setting.value("videoRenderMode", 0).toInt(); +} + +BOOL getRtpMulticast() +{ + QSettings setting; + + return setting.value("rtpMulticast", 0).toInt(); +} + +BOOL getRtpOverUdp() +{ + QSettings setting; + + return setting.value("rtpOverUdp", 0).toInt(); +} + +BOOL getRtspOverHttp() +{ + QSettings setting; + + return setting.value("rtspOverHttp", 0).toInt(); +} + +int getRtspOverHttpPort() +{ + QSettings setting; + + return setting.value("rtspOverHttpPort", 80).toInt(); +} + +BOOL getRtspOverWs() +{ + QSettings setting; + + return setting.value("rtspOverWs", 0).toInt(); +} + +int getRtspOverWsPort() +{ + QSettings setting; + + return setting.value("rtspOverWsPort", 80).toInt(); +} + +int getLogLevel() +{ + QSettings setting; + + return setting.value("logLevel", 2).toInt(); +} + +int getSysLang() +{ + QSettings setting; + + return setting.value("sysLang", 0).toInt(); +} + +int getRecordTime() +{ + QSettings setting; + + return setting.value("recordTime", 0).toInt(); +} + +int getRecordSize() +{ + QSettings setting; + + return setting.value("recordSize", 0).toInt(); +} + +int getHWDecoding() +{ + QSettings setting; + + return setting.value("HWDecoding", 0).toInt(); +} + +int getLayoutMode() +{ + QSettings setting; + + return setting.value("layoutMode", 4).toInt(); +} + +BOOL getChannels(QList & channels) +{ + QSettings settings; + + int size = settings.beginReadArray("Channels"); + for (int i = 0; i < size; ++i) + { + settings.setArrayIndex(i); + CHANNEL channel; + channel.url = settings.value("Url").toString(); + channel.user = settings.value("User").toString(); + channel.pass = settings.value("Pass").toString(); + channels.append(channel); + } + settings.endArray(); + + return TRUE; +} + +QString getTempFile(QString prefix, QString extName) +{ + QDateTime tm = QDateTime::currentDateTime(); + QString time; + QString fileName; + + time = QString::asprintf("%04d%02d%02d_%02d%02d%02d", + tm.date().year(), tm.date().month(), tm.date().day(), + tm.time().hour(), tm.time().minute(), tm.time().second()); + + fileName = prefix + "_" + time + extName; + + return fileName; +} + +void saveOpenFilePath(QString path) +{ + QSettings setting; + + setting.setValue("openFilePath", path); +} + +void saveEnableLogFlag(BOOL flag) +{ + QSettings setting; + + setting.setValue("enableLog", flag); +} + +void saveVideoRenderMode(int mode) +{ + QSettings setting; + + setting.setValue("videoRenderMode", mode); +} + +void saveRtpMulticast(BOOL flag) +{ + QSettings setting; + + setting.setValue("rtpMulticast", flag); +} + +void saveRtpOverUdp(BOOL flag) +{ + QSettings setting; + + setting.setValue("rtpOverUdp", flag); +} + +void saveRtspOverHttp(BOOL flag) +{ + QSettings setting; + + setting.setValue("rtspOverHttp", flag); +} + +void saveRtspOverHttpPort(int port) +{ + QSettings setting; + + setting.setValue("rtspOverHttpPort", port); +} + +void saveRtspOverWs(BOOL flag) +{ + QSettings setting; + + setting.setValue("rtspOverWs", flag); +} + +void saveRtspOverWsPort(int port) +{ + QSettings setting; + + setting.setValue("rtspOverWsPort", port); +} + +void saveLogLevel(int level) +{ + QSettings setting; + + setting.setValue("logLevel", level); +} + +void saveSysLang(int lang) +{ + QSettings setting; + + setting.setValue("sysLang", lang); +} + +void saveRecordTime(int value) +{ + QSettings setting; + + setting.setValue("recordTime", value); +} + +void saveRecordSize(int value) +{ + QSettings setting; + + setting.setValue("recordSize", value); +} + +void saveHWDecoding(int value) +{ + QSettings setting; + + setting.setValue("HWDecoding", value); +} + +void saveLayoutMode(int value) +{ + QSettings setting; + + setting.setValue("layoutMode", value); +} + +void saveChannels(QList & channels) +{ + QSettings settings; + settings.beginWriteArray("Channels"); + for (int i = 0; i < channels.size(); ++i) + { + settings.setArrayIndex(i); + settings.setValue("Url", channels[i].url); + settings.setValue("User", channels[i].user); + settings.setValue("Pass", channels[i].pass); + } + settings.endArray(); +} + +BOOL isUrl(QString url) +{ + BOOL isUrl = 0; + + if (isRtspUrl(url)) + { + isUrl = 1; + } + else if (isRtmpUrl(url)) + { + isUrl = 1; + } + else if (isHttpUrl(url)) + { + isUrl = 1; + } + else if (isSrtUrl(url)) + { + isUrl = 1; + } + + return isUrl; +} + +BOOL isRtspUrl(QString url) +{ + BOOL isUrl = 0; + + if (url.startsWith("rtsp://")) + { + isUrl = 1; + } +#ifdef OVER_WEBSOCKET + else if (url.startsWith("ws://")) + { + // rtsp over websocket + isUrl = 1; + } +#ifdef HTTPS + else if (url.startsWith("wss://")) + { + // rtsp over websocket + isUrl = 1; + } +#endif +#endif + + return isUrl; +} + +BOOL isRtmpUrl(QString url) +{ + BOOL isUrl = 0; + + if (url.startsWith("rtmp://") || + url.startsWith("rtmpt://") || + url.startsWith("rtmps://") || + url.startsWith("rtmpe://") || + url.startsWith("rtmpfp://") || + url.startsWith("rtmpte://") || + url.startsWith("rtmpts://")) + { + isUrl = 1; + } + + return isUrl; +} + +BOOL isHttpUrl(QString url) +{ + BOOL isUrl = 0; + + if (url.startsWith("http://")) + { + isUrl = 1; + } +#ifdef HTTPS + else if (url.startsWith("https://")) + { + isUrl = 1; + } +#endif + + return isUrl; +} + +BOOL isSrtUrl(QString url) +{ + BOOL isUrl = 0; + + if (url.startsWith("srt://")) + { + isUrl = 1; + } + + return isUrl; +} + + diff --git a/MediaClient/MediaClientForMobile/utils.h b/MediaClient/MediaClientForMobile/utils.h new file mode 100644 index 0000000..e3941d6 --- /dev/null +++ b/MediaClient/MediaClientForMobile/utils.h @@ -0,0 +1,72 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef _UTILS_H_ +#define _UTILS_H_ + +#include "sys_inc.h" +#include "config.h" +#include + +QString getSnapshotPath(); +QString getRecordPath(); +QString getOpenFilePath(); +BOOL getEnableLogFlag(); +int getVideoRenderMode(); +BOOL getRtpMulticast(); +BOOL getRtpOverUdp(); +BOOL getRtspOverHttp(); +int getRtspOverHttpPort(); +BOOL getRtspOverWs(); +int getRtspOverWsPort(); +int getLogLevel(); +int getSysLang(); +int getRecordTime(); +int getRecordSize(); +int getHWDecoding(); +int getLayoutMode(); +BOOL getChannels(QList & channels); +QString getTempFile(QString prefix, QString extName); + +void saveOpenFilePath(QString path); +void saveEnableLogFlag(BOOL flag); +void saveVideoRenderMode(int mode); +void saveRtpMulticast(BOOL flag); +void saveRtpOverUdp(BOOL flag); +void saveRtspOverHttp(BOOL flag); +void saveRtspOverHttpPort(int port); +void saveRtspOverWs(BOOL flag); +void saveRtspOverWsPort(int port); +void saveLogLevel(int level); +void saveSysLang(int lang); +void saveRecordTime(int value); +void saveRecordSize(int value); +void saveHWDecoding(int value); +void saveLayoutMode(int value); +void saveChannels(QList & channels); + +BOOL isUrl(QString url); +BOOL isRtspUrl(QString url); +BOOL isRtmpUrl(QString url); +BOOL isHttpUrl(QString url); +BOOL isSrtUrl(QString url); + +#endif + + diff --git a/MediaClient/RtmpTest/RtmpTest.cpp b/MediaClient/RtmpTest/RtmpTest.cpp new file mode 100644 index 0000000..b759a8b --- /dev/null +++ b/MediaClient/RtmpTest/RtmpTest.cpp @@ -0,0 +1,326 @@ +/*************************************************************************************** + * + * 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 "rtmp_cln.h" +#include "hqueue.h" +#include "media_format.h" + +/**********************************************************/ +HQUEUE * g_queue; + +int g_flag = 0; +pthread_t g_tid = 0; + +typedef struct +{ + int event; + CRtmpClient * rtmp; +} EVENT_PARAMS; + +/**********************************************************/ + +/** + * @desc : rtmp notify callback + * + * @params : + * event : event type + * puser : user parameter + */ +int rtmp_notify_callback(int event, void * puser) +{ + printf("%s, event = %d\r\n", __FUNCTION__, event); + + CRtmpClient * p_rtmp = (CRtmpClient *) puser; + + if (RTMP_EVE_VIDEOREADY == event) + { + int vcodec = p_rtmp->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 (RTMP_EVE_AUDIOREADY == event) + { + int acodec = p_rtmp->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_rtmp->get_audio_samplerate()); + printf("audio channels is %d\r\n", p_rtmp->get_audio_channels()); + } + } + + EVENT_PARAMS params; + + params.event = event; + params.rtmp = p_rtmp; + + if (!hqBufPut(g_queue, (char *) ¶ms)) + { + printf("hqBufPut failed\r\n"); + } + + return 0; +} + +/** + * @desc : rtmp audio data callback + * + * @params : + * pdata : audio data buffer + * len : audio data buffer length + * ts : timestamp + * puser : user parameter + */ +int rtmp_audio_callback(uint8 * pdata, int len, uint32 ts, void * puser) +{ + CRtmpClient * p_rtmp = (CRtmpClient *) puser; + + printf("%s, len = %d, ts = %u\r\n", __FUNCTION__, len, ts); + + return 0; +} + +/** + * @desc : rtmp video data callback + * + * @params : + * pdata : video data buffer + * len : video data buffer length + * ts : timestamp + * puser : user parameter + */ +int rtmp_video_callback(uint8 * pdata, int len, uint32 ts, void * puser) +{ + CRtmpClient * p_rtmp = (CRtmpClient *) puser; + + printf("%s, len = %d, ts = %u\r\n", __FUNCTION__, len, ts); + + return 0; +} + +void rtmp_setup(CRtmpClient * p_rtmp) +{ + p_rtmp->set_notify_cb(rtmp_notify_callback, p_rtmp); + p_rtmp->set_audio_cb(rtmp_audio_callback); + p_rtmp->set_video_cb(rtmp_video_callback); +} + +void rtmp_reconn(CRtmpClient * p_rtmp) +{ + char url[512], user[64], pass[64]; + + strcpy(url, p_rtmp->get_url()); + strcpy(user, p_rtmp->get_user()); + strcpy(pass, p_rtmp->get_pass()); + + printf("rtsp_reconn, url = %s, user = %s, pass = %s\r\n", url, user, pass); + + p_rtmp->rtmp_close(); + + rtmp_setup(p_rtmp); + + p_rtmp->rtmp_start(url, user, pass); +} + +void * rtmp_notify_handler(void * argv) +{ + EVENT_PARAMS params; + + while (g_flag) + { + if (hqBufGet(g_queue, (char *) ¶ms)) + { + if (params.event == -1 || params.rtmp == NULL) + { + break; + } + + if (RTMP_EVE_STOPPED == params.event || + RTMP_EVE_CONNFAIL == params.event || + RTMP_EVE_NOSIGNAL == params.event || + RTMP_EVE_NODATA == params.event) + { + rtmp_reconn(params.rtmp); + + usleep(100*1000); + } + } + } + + g_tid = 0; + + printf("%s exit\r\n", __FUNCTION__); + + return NULL; +} + +#define RTMP_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("rtmptest.log"); + log_set_level(HT_LOG_DBG); + + network_init(); + + // create event queue + g_queue = hqCreate(RTMP_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 *)rtmp_notify_handler, NULL); + if (g_tid == 0) + { + printf("create rtmp notify handler thread failed\r\n"); + return -1; + } + + CRtmpClient * rtmp = new CRtmpClient[RTMP_CLN_NUM]; + + for (int i = 0; i < RTMP_CLN_NUM; i++) + { + rtmp_setup(&rtmp[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 = rtmp[i].rtmp_start(argv[1], p_user, p_pass); + + printf("rtmp %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 < RTMP_CLN_NUM; i++) + { + rtmp[i].rtmp_close(); + } + + delete[] rtmp; + + g_flag = 0; + + EVENT_PARAMS params; + + params.event = -1; + params.rtmp = 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; + + // close log + log_close(); + + return 0; +} + + + diff --git a/MediaClient/RtmpTest/RtmpTest.vcxproj b/MediaClient/RtmpTest/RtmpTest.vcxproj new file mode 100644 index 0000000..7c4aa6b --- /dev/null +++ b/MediaClient/RtmpTest/RtmpTest.vcxproj @@ -0,0 +1,175 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {DC1F6BE8-2532-4D71-A60C-4BAAEAA50F42} + Win32Proj + RtmpTest + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + $(SolutionDir)$(Platform)\$(Configuration)\ + + + true + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + + + false + + + + + + Level1 + Disabled + WIN32;_DEBUG;_CONSOLE;HT_STATIC;ZLIB_WINAPI;%(PreprocessorDefinitions) + true + ..\MediaClient;..\MediaClient\bm;..\MediaClient\rtp;..\MediaClient\rtmp;..\MediaClient\librtmp;..\MediaClient\media;%(AdditionalIncludeDirectories) + 4996 + + + Console + true + ../MediaClient/openssl/lib/x86;../MediaClient/zlib/lib/x86;$(OutDir);%(AdditionalLibraryDirectories) + libcrypto.lib;libssl.lib;zlibwapi.lib;winmm.lib;RtmpClientLibrary.lib;%(AdditionalDependencies) + + + + + + + Level3 + Disabled + _DEBUG;_CONSOLE;HT_STATIC;ZLIB_WINAPI;%(PreprocessorDefinitions) + true + ..\MediaClient;..\MediaClient\bm;..\MediaClient\rtp;..\MediaClient\rtmp;..\MediaClient\librtmp;..\MediaClient\media;%(AdditionalIncludeDirectories) + 4996 + + + Console + true + ../MediaClient/openssl/lib/x64;../MediaClient/zlib/lib/x64;$(OutDir);%(AdditionalLibraryDirectories) + libcrypto.lib;libssl.lib;zlibwapi.lib;winmm.lib;RtmpClientLibrary.lib;%(AdditionalDependencies) + + + + + Level1 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;HT_STATIC;ZLIB_WINAPI;%(PreprocessorDefinitions) + true + ..\MediaClient;..\MediaClient\bm;..\MediaClient\rtp;..\MediaClient\rtmp;..\MediaClient\librtmp;..\MediaClient\media;%(AdditionalIncludeDirectories) + 4996 + + + Console + true + true + true + ../MediaClient/openssl/lib/x86;../MediaClient/zlib/lib/x86;$(OutDir);%(AdditionalLibraryDirectories) + libcrypto.lib;libssl.lib;zlibwapi.lib;winmm.lib;RtmpClientLibrary.lib;%(AdditionalDependencies) + + + + + Level1 + + + MaxSpeed + true + true + NDEBUG;_CONSOLE;HT_STATIC;ZLIB_WINAPI;%(PreprocessorDefinitions) + true + ..\MediaClient;..\MediaClient\bm;..\MediaClient\rtp;..\MediaClient\rtmp;..\MediaClient\librtmp;..\MediaClient\media;%(AdditionalIncludeDirectories) + 4996 + + + Console + true + true + true + ../MediaClient/openssl/lib/x64;../MediaClient/zlib/lib/x64;$(OutDir);%(AdditionalLibraryDirectories) + libcrypto.lib;libssl.lib;zlibwapi.lib;winmm.lib;RtmpClientLibrary.lib;%(AdditionalDependencies) + + + + + + + + + + + + \ No newline at end of file diff --git a/MediaClient/RtmpTest/RtmpTest.vcxproj.filters b/MediaClient/RtmpTest/RtmpTest.vcxproj.filters new file mode 100644 index 0000000..818b3cb --- /dev/null +++ b/MediaClient/RtmpTest/RtmpTest.vcxproj.filters @@ -0,0 +1,25 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + + + + Source Files + + + \ No newline at end of file diff --git a/MediaClient/RtmpTest/mac.mk b/MediaClient/RtmpTest/mac.mk new file mode 100644 index 0000000..93cfc40 --- /dev/null +++ b/MediaClient/RtmpTest/mac.mk @@ -0,0 +1,58 @@ +################OPTION################### +OUTPUT = rtmptest +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/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 = RtmpTest.o +SHAREDLIB += -lrtmpclient +SHAREDLIB += -lcrypto +SHAREDLIB += -lssl +SHAREDLIB += -lz +SHAREDLIB += -ldl +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 + diff --git a/MediaClient/RtspTest/RtspTest.cpp b/MediaClient/RtspTest/RtspTest.cpp new file mode 100644 index 0000000..392b200 --- /dev/null +++ b/MediaClient/RtspTest/RtspTest.cpp @@ -0,0 +1,408 @@ +/*************************************************************************************** + * + * 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 "rtsp_cln.h" +#include "hqueue.h" +#include "http.h" +#include "http_parse.h" + + +/**********************************************************/ +HQUEUE * g_queue; + +int g_flag = 0; +pthread_t g_tid = 0; + +typedef struct +{ + int event; + CRtspClient * rtsp; +} EVENT_PARAMS; + +/**********************************************************/ + +/** + * @desc : rtsp notify callback + * + * @params : + * event : event type + * puser : user parameter + */ +int rtsp_notify_cb(int event, void * puser) +{ + printf("%s, event = %d\r\n", __FUNCTION__, event); + + CRtspClient * p_rtsp = (CRtspClient *) puser; + + if (RTSP_EVE_CONNSUCC == event) + { + int vcodec = p_rtsp->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); + } + + int acodec = p_rtsp->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_rtsp->get_audio_samplerate()); + printf("audio channels is %d\r\n", p_rtsp->get_audio_channels()); + } + } + + EVENT_PARAMS params; + + params.event = event; + params.rtsp = p_rtsp; + + if (!hqBufPut(g_queue, (char *) ¶ms)) + { + printf("hqBufPut failed\r\n"); + } + + return 0; +} + +/** + * @desc : rtsp audio data callback + * + * @params : + * pdata : audio data buffer + * len : audio data buffer length + * ts : timestamp + * seq : sequential + * puser : user parameter + */ +int rtsp_audio_cb(uint8 * pdata, int len, uint32 ts, uint16 seq, void * puser) +{ + CRtspClient * p_rtsp = (CRtspClient *) puser; + + printf("%s, len = %d, ts = %u, seq = %d\r\n", __FUNCTION__, len, ts, seq); + + return 0; +} + +/** + * @desc : rtsp video data callback + * + * @params : + * pdata : video data buffer + * len : video data buffer length + * ts : timestamp + * seq : sequential + * puser : user parameter + */ +int rtsp_video_cb(uint8 * pdata, int len, uint32 ts, uint16 seq, void * puser) +{ + CRtspClient * p_rtsp = (CRtspClient *) puser; + + printf("%s, len = %d, ts = %u, seq = %d\r\n", __FUNCTION__, len, ts, seq); + + return 0; +} + +/** + * @desc : RTCP raw data callback + * + * @params : + * pdata : RTCP raw data + * len : data length + * type : AV_VIDEO_CH, AV_AUDIO_CH, AV_METADATA_CH, AV_BACK_CH + * puser : user parameter + */ +int rtsp_rtcp_cb(uint8 * pdata, int len, int type, void * puser) +{ + CRtspClient * p_rtsp = (CRtspClient *) puser; + + printf("%s, len = %d, type = %d\r\n", __FUNCTION__, len, type); + + return 0; +} + +/** + * @desc : rtsp meta data callback + * + * @params : + * pdata : meta data buffer + * len : meta data buffer length + * ts : timestamp + * seq : sequential + * puser : user parameter + */ +int rtsp_metadata_cb(uint8 * pdata, int len, uint32 ts, uint16 seq, void * puser) +{ + CRtspClient * p_rtsp = (CRtspClient *) puser; + + printf("%s, len = %d, ts = %u, seq = %d\r\n", __FUNCTION__, len, ts, seq); + + return 0; +} + +void rtsp_setup(CRtspClient * p_rtsp) +{ + p_rtsp->set_notify_cb(rtsp_notify_cb, p_rtsp); + p_rtsp->set_audio_cb(rtsp_audio_cb); + p_rtsp->set_video_cb(rtsp_video_cb); + p_rtsp->set_rtcp_cb(rtsp_rtcp_cb); +#ifdef METADATA + p_rtsp->set_metadata_cb(rtsp_metadata_cb); +#endif + // p_rtsp->set_rtp_over_udp(1); // rtp over udp + // p_rtsp->set_rtp_multicast(1); // force multicast rtp via rtsp +#ifdef BACKCHANNEL + // p_rtsp->set_bc_flag(1); // enable audio backchannel + // p_rtsp->set_bc_data_flag(1); // enable send audio data +#endif +#ifdef REPLAY + // p_rtsp->set_replay_flag(1); // enable replay + // p_rtsp->set_replay_range(time(NULL) - 3600, time(NULL)); // set the replay timestamp range +#endif +#ifdef OVER_HTTP + // p_rtsp->set_rtsp_over_http(1, 80); // rtsp over http +#endif +#ifdef OVER_WEBSOCKET + // p_rtsp->set_rtsp_over_ws(1, 80); // rtsp over websocket +#endif + + p_rtsp->set_rx_timeout(10); // No data within 10s, receiving timeout + // p_rtsp->set_channel(AV_VIDEO_CH, 0); // not setup video channel + // p_rtsp->set_channel(AV_AUDIO_CH, 0); // not setup audio channel + // p_rtsp->set_channel(AV_METADATA_CH, 0); // not setup metadata channel + // p_rtsp->set_channel(AV_BACK_CH, 0); // not setup audio back channel +} + +void rtsp_reconn(CRtspClient * p_rtsp) +{ + char url[256], user[64], pass[64]; + + strcpy(url, p_rtsp->get_url()); + strcpy(user, p_rtsp->get_user()); + strcpy(pass, p_rtsp->get_pass()); + + printf("rtsp_reconn, url = %s, user = %s, pass = %s\r\n", url, user, pass); + + p_rtsp->rtsp_close(); + + rtsp_setup(p_rtsp); + + p_rtsp->rtsp_start(url, user, pass); +} + +void * rtsp_notify_handler(void * argv) +{ + EVENT_PARAMS params; + + while (g_flag) + { + if (hqBufGet(g_queue, (char *) ¶ms)) + { + if (params.event == -1 || params.rtsp == NULL) + { + break; + } + + if (RTSP_EVE_STOPPED == params.event || + RTSP_EVE_CONNFAIL == params.event || + RTSP_EVE_NOSIGNAL == params.event || + RTSP_EVE_NODATA == params.event) + { + rtsp_reconn(params.rtsp); + + usleep(100*1000); + } + } + } + + g_tid = 0; + + printf("%s exit\r\n", __FUNCTION__); + + return NULL; +} + +#define RTSP_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("rtsptest.log"); + log_set_level(HT_LOG_DBG); + + network_init(); + + // allocate system BUFFER and rtsp parser BUFFER + sys_buf_init(RTSP_CLN_NUM * 8); + rtsp_parse_buf_init(RTSP_CLN_NUM * 8); + +#if defined(OVER_HTTP) || defined(OVER_WEBSOCKET) + // allocate http message parser BUFFER + http_msg_buf_init(RTSP_CLN_NUM * 8); +#endif + + // create event queue + g_queue = hqCreate(RTSP_CLN_NUM * 4, sizeof(EVENT_PARAMS), HQ_PUT_WAIT | HQ_GET_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 *)rtsp_notify_handler, NULL); + if (g_tid == 0) + { + printf("create rtsp notify handler thread failed\r\n"); + return -1; + } + + CRtspClient * rtsp = new CRtspClient[RTSP_CLN_NUM]; + + for (int i = 0; i < RTSP_CLN_NUM; i++) + { + rtsp_setup(&rtsp[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 = rtsp[i].rtsp_start("rtsp://118.70.125.152:5656/cam/realmonitor?channel=1&subtype=0", "root", "abcd1234"); + + printf("rtsp %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 < RTSP_CLN_NUM; i++) + { + rtsp[i].rtsp_close(); + } + + delete[] rtsp; + + g_flag = 0; + + EVENT_PARAMS params; + + params.event = -1; + params.rtsp = 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 + rtsp_parse_buf_deinit(); + sys_buf_deinit(); + +#if defined(OVER_HTTP) || defined(OVER_WEBSOCKET) + http_msg_buf_deinit(); +#endif + + // close log + log_close(); + + return 0; +} + + + diff --git a/MediaClient/RtspTest/RtspTest.vcxproj b/MediaClient/RtspTest/RtspTest.vcxproj new file mode 100644 index 0000000..570bd2a --- /dev/null +++ b/MediaClient/RtspTest/RtspTest.vcxproj @@ -0,0 +1,174 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + {79A3B043-27AD-491F-96D9-A4E0158ED10B} + Win32Proj + RtspTest + RtspTest + 10.0 + + + + Application + true + Unicode + v143 + + + Application + true + Unicode + v143 + + + Application + false + true + Unicode + v143 + + + Application + false + true + Unicode + v143 + + + + + + + + + + + + + + + + + + + true + $(SolutionDir)$(Platform)\$(Configuration)\ + $(ProjectName) + + + true + $(SolutionDir)$(Platform)\$(Configuration)\ + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + + + + + + Level3 + Disabled + _DEBUG;_CONSOLE;HT_STATIC;METADATA;REPLAY;OVER_HTTP;OVER_WEBSOCKET;%(PreprocessorDefinitions) + ..\MediaClient;..\MediaClient\bm;..\MediaClient\http;..\MediaClient\rtsp;..\MediaClient\rtp;..\MediaClient\media;..\MediaClient\openssl\include;%(AdditionalIncludeDirectories) + 4996 + + + Console + true + ..\MediaClient\openssl\lib\x86;$(SolutionDir)$(Platform)\$(Configuration)\;%(AdditionalLibraryDirectories) + RtspClientLibrary.lib;%(AdditionalDependencies) + $(OutDir)\$(ProjectName).exe + + + + + + + Level3 + Disabled + _DEBUG;_CONSOLE;HT_STATIC;METADATA;REPLAY;OVER_HTTP;OVER_WEBSOCKET;%(PreprocessorDefinitions) + ..\MediaClient;..\MediaClient\bm;..\MediaClient\http;..\MediaClient\rtsp;..\MediaClient\rtp;..\MediaClient\media;..\MediaClient\openssl\include;%(AdditionalIncludeDirectories) + 4996 + + + Console + true + ..\MediaClient\openssl\lib\x64;$(SolutionDir)$(Platform)\$(Configuration)\;%(AdditionalLibraryDirectories) + RtspClientLibrary.lib;%(AdditionalDependencies) + $(OutDir)\$(ProjectName).exe + + + + + Level3 + + + MaxSpeed + true + true + _DEBUG;_CONSOLE;HT_STATIC;METADATA;REPLAY;OVER_HTTP;OVER_WEBSOCKET;%(PreprocessorDefinitions) + ..\MediaClient;..\MediaClient\bm;..\MediaClient\http;..\MediaClient\rtsp;..\MediaClient\rtp;..\MediaClient\media;..\MediaClient\openssl\include;%(AdditionalIncludeDirectories) + 4996 + + + Console + true + true + true + ..\MediaClient\openssl\lib\x86;$(SolutionDir)$(Platform)\$(Configuration)\;%(AdditionalLibraryDirectories) + RtspClientLibrary.lib;%(AdditionalDependencies) + $(OutDir)\$(ProjectName).exe + + + + + Level3 + + + MaxSpeed + true + true + _DEBUG;_CONSOLE;HT_STATIC;METADATA;REPLAY;OVER_HTTP;OVER_WEBSOCKET;%(PreprocessorDefinitions) + ..\MediaClient;..\MediaClient\bm;..\MediaClient\http;..\MediaClient\rtsp;..\MediaClient\rtp;..\MediaClient\media;..\MediaClient\openssl\include;%(AdditionalIncludeDirectories) + 4996 + + + Console + true + true + true + ..\MediaClient\openssl\lib\x64;$(SolutionDir)$(Platform)\$(Configuration)\;%(AdditionalLibraryDirectories) + RtspClientLibrary.lib;%(AdditionalDependencies) + $(OutDir)\$(ProjectName).exe + + + + + + \ No newline at end of file diff --git a/MediaClient/RtspTest/mac.mk b/MediaClient/RtspTest/mac.mk new file mode 100644 index 0000000..2655a80 --- /dev/null +++ b/MediaClient/RtspTest/mac.mk @@ -0,0 +1,79 @@ +################OPTION################### +OUTPUT = rtsptest +CCOMPILE = gcc +CPPCOMPILE = g++ +COMPILEOPTION += -g -c -Wall +COMPILEOPTION += -DIOS +COMPILEOPTION += -DMETADATA +COMPILEOPTION += -DREPLAY +COMPILEOPTION += -DOVER_HTTP +COMPILEOPTION += -DOVER_WEBSOCKET +LINK = g++ +LINKOPTION = -g -o $(OUTPUT) +INCLUDEDIR += -I../MediaClient +INCLUDEDIR += -I../MediaClient/bm +INCLUDEDIR += -I../MediaClient/http +INCLUDEDIR += -I../MediaClient/media +INCLUDEDIR += -I../MediaClient/rtp +INCLUDEDIR += -I../MediaClient/rtsp +INCLUDEDIR += -I../MediaClient/ffmpeg/include +INCLUDEDIR += -I../MediaClient/openssl/include +LIBDIRS += -L../MediaClient +LIBDIRS += -L../MediaClient/ffmpeg/lib/linux +LIBDIRS += -L../MediaClient/openssl/lib/linux + +OBJS = RtspTest.o + +ifneq ($(findstring BACKCHANNEL, $(COMPILEOPTION)),) +SHAREDLIB += -lasound +SHAREDLIB += -lavformat +SHAREDLIB += -lswscale +SHAREDLIB += -lavcodec +SHAREDLIB += -lswresample +SHAREDLIB += -lavutil +SHAREDLIB += -lopus +SHAREDLIB += -lx264 +SHAREDLIB += -lx265 +endif + +ifneq ($(findstring HTTPS, $(COMPILEOPTION)),) +SHAREDLIB += -lcrypto +SHAREDLIB += -lssl +endif + +SHAREDLIB += -lrtspclient +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 + diff --git a/MediaClient/RtspTest/rtsptest-1.log b/MediaClient/RtspTest/rtsptest-1.log new file mode 100644 index 0000000..01f8658 --- /dev/null +++ b/MediaClient/RtspTest/rtsptest-1.log @@ -0,0 +1,128 @@ +[2024-04-29 01:04:20] : [INFO] net_buf_init, num = 8 +[2024-04-29 01:04:20] : [INFO] hdrv_buf_init, num = 64 +[2024-04-29 01:04:20] : [DEBUG] TX >> OPTIONS rtsp://118.70.125.152:5656/cam/realmonitor?channel=1&subtype=0 RTSP/1.0 +CSeq: 1 +User-Agent: happytimesoft rtsp client + + +[2024-04-29 01:04:20] : [DEBUG] RX << RTSP/1.0 401 Unauthorized +CSeq: 1 +WWW-Authenticate: Digest realm="Login to 77373879BF7156D2",nonce="9559d9f7-821e-4c8d-bd49-2babcb8b9ec0" + + +[2024-04-29 01:04:20] : [DEBUG] TX >> OPTIONS rtsp://118.70.125.152:5656/cam/realmonitor?channel=1&subtype=0 RTSP/1.0 +CSeq: 2 +Authorization: Digest username="root", realm="Login to 77373879BF7156D2", nonce="9559d9f7-821e-4c8d-bd49-2babcb8b9ec0", uri="rtsp://118.70.125.152:5656/cam/realmonitor?channel=1&subtype=0", response="f8c01e1f767492c99554aec03a339983" +User-Agent: happytimesoft rtsp client + + +[2024-04-29 01:04:21] : [DEBUG] RX << RTSP/1.0 200 OK +CSeq: 2 +Public: OPTIONS, DESCRIBE, ANNOUNCE, SETUP, PLAY, PAUSE, TEARDOWN, GET_PARAMETER, SET_PARAMETER, REDIRECT, RECORD +Server: Rtsp Server/3.0 + + +[2024-04-29 01:04:21] : [DEBUG] TX >> DESCRIBE rtsp://118.70.125.152:5656/cam/realmonitor?channel=1&subtype=0 RTSP/1.0 +CSeq: 3 +Authorization: Digest username="root", realm="Login to 77373879BF7156D2", nonce="9559d9f7-821e-4c8d-bd49-2babcb8b9ec0", uri="rtsp://118.70.125.152:5656/cam/realmonitor?channel=1&subtype=0", response="e88e7221d817a8510a7fcbaa81ba0e2c" +Accept: application/sdp +User-Agent: happytimesoft rtsp client + + +[2024-04-29 01:04:21] : [DEBUG] RX << RTSP/1.0 200 OK +CSeq: 3 +Content-Base: rtsp://118.70.125.152:5656/cam/realmonitor?channel=1&subtype=0/ +Content-Type: application/sdp +x-Accept-Dynamic-Rate: 1 +Cache-Control: must-revalidate +Content-Length: 473 + + +[2024-04-29 01:04:21] : [DEBUG] v=0 +o=- 2229913047 2229913047 IN IP4 0.0.0.0 +s=Media Server +c=IN IP4 0.0.0.0 +t=0 0 +a=control:* +a=packetization-supported:DH +a=rtppayload-supported:DH +a=range:npt=now- +m=video 0 RTP/AVP 96 +a=control:trackID=0 +a=framerate:15.000000 +a=rtpmap:96 H264/90000 +a=fmtp:96 packetization-mode=1;profile-level-id=4D0029;sprop-parameter-sets=Z00AKYqKUBQAWtNEAAAPoAAB1MAQAA==,aO48gAA= +a=recvonly +m=audio 0 RTP/AVP 8 +a=control:trackID=1 +a=rtpmap:8 PCMA/8000 +a=recvonly + +[2024-04-29 01:04:21] : [DEBUG] TX >> SETUP rtsp://118.70.125.152:5656/cam/realmonitor?channel=1&subtype=0/trackID=0 RTSP/1.0 +CSeq: 4 +Authorization: Digest username="root", realm="Login to 77373879BF7156D2", nonce="9559d9f7-821e-4c8d-bd49-2babcb8b9ec0", uri="rtsp://118.70.125.152:5656/cam/realmonitor?channel=1&subtype=0", response="ab48f35df2194fe87175383bfd467921" +Transport: RTP/AVP/TCP;unicast;interleaved=0-1 +User-Agent: happytimesoft rtsp client + + +[2024-04-29 01:04:21] : [DEBUG] RX << RTSP/1.0 200 OK +CSeq: 4 +Session: 2511235705;timeout=60 +Transport: RTP/AVP/TCP;unicast;interleaved=0-1;ssrc=948d3c05 +x-Dynamic-Rate: 1 + + +[2024-04-29 01:04:21] : [DEBUG] TX >> SETUP rtsp://118.70.125.152:5656/cam/realmonitor?channel=1&subtype=0/trackID=1 RTSP/1.0 +CSeq: 5 +Session: 2511235705 +Authorization: Digest username="root", realm="Login to 77373879BF7156D2", nonce="9559d9f7-821e-4c8d-bd49-2babcb8b9ec0", uri="rtsp://118.70.125.152:5656/cam/realmonitor?channel=1&subtype=0", response="ab48f35df2194fe87175383bfd467921" +Transport: RTP/AVP/TCP;unicast;interleaved=2-3 +User-Agent: happytimesoft rtsp client + + +[2024-04-29 01:04:21] : [DEBUG] RX << RTSP/1.0 200 OK +CSeq: 5 +Session: 2511235705;timeout=60 +Transport: RTP/AVP/TCP;unicast;interleaved=2-3;ssrc=8d63dda6 +x-Dynamic-Rate: 1 + + +[2024-04-29 01:04:21] : [DEBUG] TX >> PLAY rtsp://118.70.125.152:5656/cam/realmonitor?channel=1&subtype=0/ RTSP/1.0 +CSeq: 6 +Authorization: Digest username="root", realm="Login to 77373879BF7156D2", nonce="9559d9f7-821e-4c8d-bd49-2babcb8b9ec0", uri="rtsp://118.70.125.152:5656/cam/realmonitor?channel=1&subtype=0", response="671be88eee53cd436021e0e83dceeaac" +Session: 2511235705 +Range: npt=0.000- +User-Agent: happytimesoft rtsp client + + +[2024-04-29 01:04:21] : [DEBUG] RX << RTSP/1.0 200 OK +CSeq: 6 +Session: 2511235705 +Range: npt=0.000- +RTP-Info: url=trackID=0;seq=61090;rtptime=0,url=trackID=1;seq=13097;rtptime=0 + + +[2024-04-29 01:05:18] : [DEBUG] TX >> GET_PARAMETER rtsp://118.70.125.152:5656/cam/realmonitor?channel=1&subtype=0/ RTSP/1.0 +CSeq: 7 +Authorization: Digest username="root", realm="Login to 77373879BF7156D2", nonce="9559d9f7-821e-4c8d-bd49-2babcb8b9ec0", uri="rtsp://118.70.125.152:5656/cam/realmonitor?channel=1&subtype=0", response="7eaf50b49e7960595e3d4f07ff3227d9" +Session: 2511235705 +User-Agent: happytimesoft rtsp client + + +[2024-04-29 01:05:18] : [DEBUG] RX << RTSP/1.0 200 OK +CSeq: 7 +Session: 2511235705 + + +[2024-04-29 01:06:13] : [DEBUG] TX >> GET_PARAMETER rtsp://118.70.125.152:5656/cam/realmonitor?channel=1&subtype=0/ RTSP/1.0 +CSeq: 8 +Authorization: Digest username="root", realm="Login to 77373879BF7156D2", nonce="9559d9f7-821e-4c8d-bd49-2babcb8b9ec0", uri="rtsp://118.70.125.152:5656/cam/realmonitor?channel=1&subtype=0", response="7eaf50b49e7960595e3d4f07ff3227d9" +Session: 2511235705 +User-Agent: happytimesoft rtsp client + + +[2024-04-29 01:06:13] : [DEBUG] RX << RTSP/1.0 200 OK +CSeq: 8 +Session: 2511235705 + + diff --git a/MediaClient/RtspTest/stdafx.h b/MediaClient/RtspTest/stdafx.h new file mode 100644 index 0000000..09ececa --- /dev/null +++ b/MediaClient/RtspTest/stdafx.h @@ -0,0 +1,15 @@ + +#pragma once + +#include +#include +#include +#include + +#include +#include +#include + +#include + + diff --git a/MediaClient/SrtTest/SrtTest.cpp b/MediaClient/SrtTest/SrtTest.cpp new file mode 100644 index 0000000..52840a4 --- /dev/null +++ b/MediaClient/SrtTest/SrtTest.cpp @@ -0,0 +1,313 @@ +/*************************************************************************************** + * + * 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 "srt_cln.h" +#include "hqueue.h" +#include "media_format.h" + + +/**********************************************************/ +HQUEUE * g_queue; + +int g_flag = 0; +pthread_t g_tid = 0; + +typedef struct +{ + int event; + CSrtClient * srt; +} EVENT_PARAMS; + +/**********************************************************/ + +/** + * @desc : srt notify callback + * + * @params : + * event : event type + * puser : user parameter + */ +int srt_notify_callback(int event, void * puser) +{ + printf("%s, event = %d\r\n", __FUNCTION__, event); + + CSrtClient * p_srt = (CSrtClient *) puser; + + if (SRT_EVE_VIDEOREADY == event) + { + int vcodec = p_srt->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; + } + + printf("video codec is %s\r\n", codec_str); + } + } + else if (SRT_EVE_AUDIOREADY == event) + { + int acodec = p_srt->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_AAC: + strcpy(codec_str, "AAC"); + break; + } + + printf("audio codec is %s\r\n", codec_str); + printf("audio sample rate is %d\r\n", p_srt->get_audio_samplerate()); + printf("audio channels is %d\r\n", p_srt->get_audio_channels()); + } + } + + EVENT_PARAMS params; + + params.event = event; + params.srt = p_srt; + + if (!hqBufPut(g_queue, (char *) ¶ms)) + { + printf("hqBufPut failed\r\n"); + } + + return 0; +} + +/** + * @desc : srt audio data callback + * + * @params : + * pdata : audio data buffer + * len : audio data buffer length + * ts : timestamp + * seq : sequential + * puser : user parameter + */ +int srt_audio_callback(uint8 * pdata, int len, uint32 ts, void * puser) +{ + CSrtClient * p_srt = (CSrtClient *) puser; + + printf("%s, len = %d, ts = %u\r\n", __FUNCTION__, len, ts); + + return 0; +} + +/** + * @desc : srt video data callback + * + * @params : + * pdata : video data buffer + * len : video data buffer length + * ts : timestamp + * seq : sequential + * puser : user parameter + */ +int srt_video_callback(uint8 * pdata, int len, uint32 ts, void * puser) +{ + CSrtClient * p_srt = (CSrtClient *) puser; + + printf("%s, len = %d, ts = %u\r\n", __FUNCTION__, len, ts); + + return 0; +} + +void srt_setup(CSrtClient * p_srt) +{ + p_srt->set_notify_cb(srt_notify_callback, p_srt); + p_srt->set_audio_cb(srt_audio_callback); + p_srt->set_video_cb(srt_video_callback); +} + +void srt_reconn(CSrtClient * p_srt) +{ + char url[256], user[64], pass[64]; + + strcpy(url, p_srt->get_url()); + strcpy(user, p_srt->get_user()); + strcpy(pass, p_srt->get_pass()); + + printf("srt_reconn, url = %s, user = %s, pass = %s\r\n", url, user, pass); + + p_srt->srt_close(); + + srt_setup(p_srt); + + p_srt->srt_start(url, user, pass); +} + +void * srt_notify_handler(void * argv) +{ + EVENT_PARAMS params; + + while (g_flag) + { + if (hqBufGet(g_queue, (char *) ¶ms)) + { + if (params.event == -1 || params.srt == NULL) + { + break; + } + + if (SRT_EVE_STOPPED == params.event || + SRT_EVE_CONNFAIL == params.event || + SRT_EVE_NOSIGNAL == params.event || + SRT_EVE_NODATA == params.event) + { + srt_reconn(params.srt); + + usleep(100*1000); + } + } + } + + g_tid = 0; + + printf("%s exit\r\n", __FUNCTION__); + + return NULL; +} + +#define SRT_CLN_NUM 1 + +int main(int argc, char * argv[]) +{ + if (argc < 2) + { + printf("usage: %s url\r\n", argv[0]); + return -1; + } + + log_init("srttest.log"); + log_set_level(HT_LOG_DBG); + + network_init(); + + // create event queue + g_queue = hqCreate(SRT_CLN_NUM * 4, sizeof(EVENT_PARAMS), HQ_PUT_WAIT | HQ_GET_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 *)srt_notify_handler, NULL); + if (g_tid == 0) + { + printf("create srt notify handler thread failed\r\n"); + return -1; + } + + CSrtClient * srt = new CSrtClient[SRT_CLN_NUM]; + + for (int i = 0; i < SRT_CLN_NUM; i++) + { + srt_setup(&srt[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 = srt[i].srt_start(argv[1], p_user, p_pass); + + printf("srt %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 < SRT_CLN_NUM; i++) + { + srt[i].srt_close(); + } + + delete[] srt; + + g_flag = 0; + + EVENT_PARAMS params; + + params.event = -1; + params.srt = 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; + + // close log + log_close(); + + return 0; +} + + + diff --git a/MediaClient/SrtTest/SrtTest.vcxproj b/MediaClient/SrtTest/SrtTest.vcxproj new file mode 100644 index 0000000..45c81c9 --- /dev/null +++ b/MediaClient/SrtTest/SrtTest.vcxproj @@ -0,0 +1,174 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + {A2E369F0-71DD-4F38-B177-F66305199F56} + Win32Proj + SrtTest + SrtTest + 10.0 + + + + Application + true + Unicode + v143 + + + Application + true + Unicode + v143 + + + Application + false + true + Unicode + v143 + + + Application + false + true + Unicode + v143 + + + + + + + + + + + + + + + + + + + true + $(SolutionDir)$(Platform)\$(Configuration)\ + $(ProjectName) + + + true + $(SolutionDir)$(Platform)\$(Configuration)\ + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + + + + + + Level3 + Disabled + _DEBUG;_CONSOLE;HT_STATIC;METADATA;REPLAY;OVER_HTTP;%(PreprocessorDefinitions) + ..\MediaClient;..\MediaClient\bm;..\MediaClient\rtp;..\MediaClient\srt;..\MediaClient\media;..\MediaClient\libsrt\include;%(AdditionalIncludeDirectories) + 4996 + + + Console + true + ..\MediaClient\libsrt\lib\x86;$(SolutionDir)$(Platform)\$(Configuration)\;%(AdditionalLibraryDirectories) + srt.lib;SrtClientLibrary.lib;%(AdditionalDependencies) + $(OutDir)\$(ProjectName).exe + + + + + + + Level3 + Disabled + _DEBUG;_CONSOLE;HT_STATIC;%(PreprocessorDefinitions) + ..\MediaClient;..\MediaClient\bm;..\MediaClient\rtp;..\MediaClient\srt;..\MediaClient\media;..\MediaClient\libsrt\include;%(AdditionalIncludeDirectories) + 4996 + + + Console + true + ..\MediaClient\libsrt\lib\x64;$(SolutionDir)$(Platform)\$(Configuration)\;%(AdditionalLibraryDirectories) + srt.lib;SrtClientLibrary.lib;%(AdditionalDependencies) + $(OutDir)\$(ProjectName).exe + + + + + Level3 + + + MaxSpeed + true + true + NDEBUG;_CONSOLE;HT_STATIC;%(PreprocessorDefinitions) + ..\MediaClient;..\MediaClient\bm;..\MediaClient\rtp;..\MediaClient\srt;..\MediaClient\media;..\MediaClient\libsrt\include;%(AdditionalIncludeDirectories) + 4996 + + + Console + true + true + true + ..\MediaClient\libsrt\lib\x86;$(SolutionDir)$(Platform)\$(Configuration)\;%(AdditionalLibraryDirectories) + srt.lib;SrtClientLibrary.lib;%(AdditionalDependencies) + $(OutDir)\$(ProjectName).exe + + + + + Level3 + + + MaxSpeed + true + true + NDEBUG;_CONSOLE;HT_STATIC;%(PreprocessorDefinitions) + ..\MediaClient;..\MediaClient\bm;..\MediaClient\rtp;..\MediaClient\srt;..\MediaClient\media;..\MediaClient\libsrt\include;%(AdditionalIncludeDirectories) + 4996 + + + Console + true + true + true + ..\MediaClient\libsrt\lib\x64;$(SolutionDir)$(Platform)\$(Configuration)\;%(AdditionalLibraryDirectories) + srt.lib;SrtClientLibrary.lib;%(AdditionalDependencies) + $(OutDir)\$(ProjectName).exe + + + + + + \ No newline at end of file diff --git a/MediaClient/SrtTest/mac.mk b/MediaClient/SrtTest/mac.mk new file mode 100644 index 0000000..1a32911 --- /dev/null +++ b/MediaClient/SrtTest/mac.mk @@ -0,0 +1,61 @@ +################OPTION################### +OUTPUT = srttest +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/media +INCLUDEDIR += -I../MediaClient/rtp +INCLUDEDIR += -I../MediaClient/srt +INCLUDEDIR += -I../MediaClient/libsrt/include +LIBDIRS += -L../MediaClient +LIBDIRS += -L../MediaClient/libsrt/lib/linux +LIBDIRS += -L../MediaClient/openssl/lib/linux + +OBJS = SrtTest.o + +SHAREDLIB += -lsrtclient +SHAREDLIB += -lsrt + +SHAREDLIB += -lcrypto +SHAREDLIB += -lssl + +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 + diff --git a/MediaClient/SrtTest/stdafx.h b/MediaClient/SrtTest/stdafx.h new file mode 100644 index 0000000..09ececa --- /dev/null +++ b/MediaClient/SrtTest/stdafx.h @@ -0,0 +1,15 @@ + +#pragma once + +#include +#include +#include +#include + +#include +#include +#include + +#include + + diff --git a/MediaClient/Test/RtspTest.cpp b/MediaClient/Test/RtspTest.cpp new file mode 100644 index 0000000..09dfbe8 --- /dev/null +++ b/MediaClient/Test/RtspTest.cpp @@ -0,0 +1,443 @@ +/*************************************************************************************** + * + * 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 "rtsp_cln.h" +#include "hqueue.h" +#include "http.h" +#include "http_parse.h" +#include "video_decoder.h" + + +/**********************************************************/ +HQUEUE * g_queue; +int g_flag = 0; +pthread_t g_tid = 0; + +/**********************************************************/ + +typedef struct +{ + CRtspClient rtsp; + CVideoDecoder decoder; + BOOL decoder_init; +} MyPlayer; + +typedef struct +{ + int event; + MyPlayer * player; +} EVENT_PARAMS; + +/**********************************************************/ + +void video_decoder_cb(AVFrame * frame, void * userdata) +{ + MyPlayer * p_player = (MyPlayer *) userdata; + + +} + +/** + * @desc : rtsp notify callback + * + * @params : + * event : event type + * puser : user parameter + */ +int rtsp_notify_cb(int event, void * puser) +{ + printf("%s, event = %d\r\n", __FUNCTION__, event); + + MyPlayer * p_player = (MyPlayer *) puser; + CRtspClient * p_rtsp = &p_player->rtsp; + + if (RTSP_EVE_CONNSUCC == event) + { + int vcodec = p_rtsp->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); + } + + int acodec = p_rtsp->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_rtsp->get_audio_samplerate()); + printf("audio channels is %d\r\n", p_rtsp->get_audio_channels()); + } + } + + EVENT_PARAMS params; + + params.event = event; + params.player = p_player; + + if (!hqBufPut(g_queue, (char *) ¶ms)) + { + printf("hqBufPut failed\r\n"); + } + + return 0; +} + +/** + * @desc : rtsp audio data callback + * + * @params : + * pdata : audio data buffer + * len : audio data buffer length + * ts : timestamp + * seq : sequential + * puser : user parameter + */ +int rtsp_audio_cb(uint8 * pdata, int len, uint32 ts, uint16 seq, void * puser) +{ + MyPlayer * p_player = (MyPlayer *) puser; + + printf("%s, len = %d, ts = %u, seq = %d\r\n", __FUNCTION__, len, ts, seq); + + return 0; +} + +/** + * @desc : rtsp video data callback + * + * @params : + * pdata : video data buffer + * len : video data buffer length + * ts : timestamp + * seq : sequential + * puser : user parameter + */ +int rtsp_video_cb(uint8 * pdata, int len, uint32 ts, uint16 seq, void * puser) +{ + MyPlayer * p_player = (MyPlayer *) puser; + CRtspClient * p_rtsp = &p_player->rtsp; + CVideoDecoder * p_decoder = &p_player->decoder; + + printf("%s, len = %d, ts = %u, seq = %d\r\n", __FUNCTION__, len, ts, seq); + + if (!p_player->decoder_init) + { + p_player->decoder_init = p_decoder->init(p_rtsp->video_codec()); + p_decoder->setCallback(video_decoder_cb, p_player); + } + + if (p_player->decoder_init) + { + p_decoder->decode(pdata, len, ts); + } + + return 0; +} + +/** + * @desc : RTCP raw data callback + * + * @params : + * pdata : RTCP raw data + * len : data length + * type : AV_VIDEO_CH, AV_AUDIO_CH, AV_METADATA_CH, AV_BACK_CH + * puser : user parameter + */ +int rtsp_rtcp_cb(uint8 * pdata, int len, int type, void * puser) +{ + MyPlayer * p_player = (MyPlayer *) puser; + + printf("%s, len = %d, type = %d\r\n", __FUNCTION__, len, type); + + return 0; +} + +/** + * @desc : rtsp meta data callback + * + * @params : + * pdata : meta data buffer + * len : meta data buffer length + * ts : timestamp + * seq : sequential + * puser : user parameter + */ +int rtsp_metadata_cb(uint8 * pdata, int len, uint32 ts, uint16 seq, void * puser) +{ + MyPlayer * p_player = (MyPlayer *) puser; + + printf("%s, len = %d, ts = %u, seq = %d\r\n", __FUNCTION__, len, ts, seq); + + return 0; +} + +void rtsp_setup(MyPlayer * player) +{ + CRtspClient * p_rtsp = &player->rtsp; + + p_rtsp->set_notify_cb(rtsp_notify_cb, player); + p_rtsp->set_audio_cb(rtsp_audio_cb); + p_rtsp->set_video_cb(rtsp_video_cb); + p_rtsp->set_rtcp_cb(rtsp_rtcp_cb); +#ifdef METADATA + p_rtsp->set_metadata_cb(rtsp_metadata_cb); +#endif + // p_rtsp->set_rtp_over_udp(1); // rtp over udp + // p_rtsp->set_rtp_multicast(1); // force multicast rtp via rtsp +#ifdef BACKCHANNEL + // p_rtsp->set_bc_flag(1); // enable audio backchannel + // p_rtsp->set_bc_data_flag(1); // enable send audio data +#endif +#ifdef REPLAY + // p_rtsp->set_replay_flag(1); // enable replay + // p_rtsp->set_replay_range(time(NULL) - 3600, time(NULL)); // set the replay timestamp range +#endif +#ifdef OVER_HTTP + // p_rtsp->set_rtsp_over_http(1, 80); // rtsp over http +#endif +#ifdef OVER_WEBSOCKET + // p_rtsp->set_rtsp_over_ws(1, 80); // rtsp over websocket +#endif + + p_rtsp->set_rx_timeout(10); // No data within 10s, receiving timeout + // p_rtsp->set_channel(AV_VIDEO_CH, 0); // not setup video channel + // p_rtsp->set_channel(AV_AUDIO_CH, 0); // not setup audio channel + // p_rtsp->set_channel(AV_METADATA_CH, 0); // not setup metadata channel + // p_rtsp->set_channel(AV_BACK_CH, 0); // not setup audio back channel +} + +void rtsp_reconn(MyPlayer * p_player) +{ + char url[256], user[64], pass[64]; + CRtspClient * p_rtsp = &p_player->rtsp; + + strcpy(url, p_rtsp->get_url()); + strcpy(user, p_rtsp->get_user()); + strcpy(pass, p_rtsp->get_pass()); + + printf("rtsp_reconn, url = %s, user = %s, pass = %s\r\n", url, user, pass); + + p_rtsp->rtsp_close(); + + rtsp_setup(p_player); + + p_rtsp->rtsp_start(url, user, pass); +} + +void * rtsp_notify_handler(void * argv) +{ + EVENT_PARAMS params; + + while (g_flag) + { + if (hqBufGet(g_queue, (char *) ¶ms)) + { + if (params.event == -1 || params.player == NULL) + { + break; + } + + if (RTSP_EVE_STOPPED == params.event || + RTSP_EVE_CONNFAIL == params.event || + RTSP_EVE_NOSIGNAL == params.event || + RTSP_EVE_NODATA == params.event) + { + rtsp_reconn(params.player); + + usleep(100*1000); + } + } + } + + g_tid = 0; + + printf("%s exit\r\n", __FUNCTION__); + + return NULL; +} + +#define RTSP_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("rtsptest.log"); + log_set_level(HT_LOG_DBG); + + network_init(); + + // allocate system BUFFER and rtsp parser BUFFER + sys_buf_init(RTSP_CLN_NUM * 8); + rtsp_parse_buf_init(RTSP_CLN_NUM * 8); + +#if defined(OVER_HTTP) || defined(OVER_WEBSOCKET) + // allocate http message parser BUFFER + http_msg_buf_init(RTSP_CLN_NUM * 8); +#endif + + // create event queue + g_queue = hqCreate(RTSP_CLN_NUM * 4, sizeof(EVENT_PARAMS), HQ_PUT_WAIT | HQ_GET_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 *)rtsp_notify_handler, NULL); + if (g_tid == 0) + { + printf("create rtsp notify handler thread failed\r\n"); + return -1; + } + + MyPlayer * player = new MyPlayer[RTSP_CLN_NUM]; + + for (int i = 0; i < RTSP_CLN_NUM; i++) + { + player->decoder_init = FALSE; + + rtsp_setup(&player[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 = player[i].rtsp.rtsp_start(argv[1], p_user, p_pass); + + printf("rtsp %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 < RTSP_CLN_NUM; i++) + { + player[i].rtsp.rtsp_close(); + } + + delete[] player; + + g_flag = 0; + + EVENT_PARAMS params; + + params.event = -1; + params.player = 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 + rtsp_parse_buf_deinit(); + sys_buf_deinit(); + +#if defined(OVER_HTTP) || defined(OVER_WEBSOCKET) + http_msg_buf_deinit(); +#endif + + // close log + log_close(); + + return 0; +} + + + diff --git a/MediaClient/Test/RtspTest.sln b/MediaClient/Test/RtspTest.sln new file mode 100644 index 0000000..c77e424 --- /dev/null +++ b/MediaClient/Test/RtspTest.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.9.34701.34 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RtspTest", "RtspTest.vcxproj", "{79A3B043-27AD-491F-96D9-A4E0158ED10B}" +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 + {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 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {5955BC95-5A87-4157-822A-C8554BF7374E} + EndGlobalSection +EndGlobal diff --git a/MediaClient/Test/RtspTest.vcxproj b/MediaClient/Test/RtspTest.vcxproj new file mode 100644 index 0000000..d8935bc --- /dev/null +++ b/MediaClient/Test/RtspTest.vcxproj @@ -0,0 +1,187 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + + + {79A3B043-27AD-491F-96D9-A4E0158ED10B} + Win32Proj + RtspTest + RtspTest + 10.0 + + + + Application + true + Unicode + v143 + + + Application + true + Unicode + v143 + + + Application + false + true + Unicode + v143 + + + Application + false + true + Unicode + v143 + + + + + + + + + + + + + + + + + + + true + $(SolutionDir)$(Platform)\$(Configuration)\ + $(ProjectName) + + + true + $(SolutionDir)$(Platform)\$(Configuration)\ + C:\Projects\ANLS\MediaClient\lib;$(LibraryPath) + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + c;$(LibraryPath) + + + false + + + + + + Level3 + Disabled + _DEBUG;_CONSOLE;HT_STATIC;METADATA;REPLAY;OVER_HTTP;OVER_WEBSOCKET;%(PreprocessorDefinitions) + ..\MediaClient;..\MediaClient\bm;..\MediaClient\http;..\MediaClient\rtsp;..\MediaClient\rtp;..\MediaClient\media;..\MediaClient\openssl\include;..\MediaClient\ffmpeg\include;%(AdditionalIncludeDirectories) + 4996 + + + Console + true + ..\MediaClient\openssl\lib\x86;..\MediaClient\ffmpeg\lib\x86;$(SolutionDir)$(Platform)\$(Configuration)\;%(AdditionalLibraryDirectories) + RtspClientLibrary.lib;avcodec.lib;avformat.lib;avutil.lib;swresample.lib;swscale.lib;%(AdditionalDependencies) + $(OutDir)\$(ProjectName).exe + + + + + + + Level3 + Disabled + _DEBUG;_CONSOLE;HT_STATIC;METADATA;REPLAY;OVER_HTTP;OVER_WEBSOCKET;%(PreprocessorDefinitions) + ..\MediaClient;..\MediaClient\bm;..\MediaClient\http;..\MediaClient\rtsp;..\MediaClient\rtp;..\MediaClient\media;..\MediaClient\openssl\include;..\MediaClient\ffmpeg\include;%(AdditionalIncludeDirectories) + 4996 + + + Console + true + ..\MediaClient\openssl\lib\x64;..\MediaClient\ffmpeg\lib\x64;$(SolutionDir)$(Platform)\$(Configuration)\;%(AdditionalLibraryDirectories) + RtspClientLibrary.lib;avcodec.lib;avformat.lib;avutil.lib;swresample.lib;swscale.lib;%(AdditionalDependencies) + $(OutDir)\$(ProjectName).exe + + + + + Level3 + + + MaxSpeed + true + true + _DEBUG;_CONSOLE;HT_STATIC;METADATA;REPLAY;OVER_HTTP;OVER_WEBSOCKET;%(PreprocessorDefinitions) + ..\MediaClient;..\MediaClient\bm;..\MediaClient\http;..\MediaClient\rtsp;..\MediaClient\rtp;..\MediaClient\media;..\MediaClient\openssl\include;..\MediaClient\ffmpeg\include;%(AdditionalIncludeDirectories) + 4996 + + + Console + true + true + true + ..\MediaClient\openssl\lib\x86;..\MediaClient\ffmpeg\lib\x86;$(SolutionDir)$(Platform)\$(Configuration)\;%(AdditionalLibraryDirectories) + RtspClientLibrary.lib;avcodec.lib;avformat.lib;avutil.lib;swresample.lib;swscale.lib;%(AdditionalDependencies) + $(OutDir)\$(ProjectName).exe + false + + + + + Level3 + + + MaxSpeed + true + true + _DEBUG;_CONSOLE;HT_STATIC;METADATA;REPLAY;OVER_HTTP;OVER_WEBSOCKET;%(PreprocessorDefinitions) + ..\MediaClient;..\MediaClient\bm;..\MediaClient\http;..\MediaClient\rtsp;..\MediaClient\rtp;..\MediaClient\media;..\MediaClient\openssl\include;..\MediaClient\ffmpeg\include;%(AdditionalIncludeDirectories) + 4996 + + + Console + true + true + true + ..\MediaClient\openssl\lib\x64;..\MediaClient\ffmpeg\lib\x64;$(SolutionDir)$(Platform)\$(Configuration)\;%(AdditionalLibraryDirectories) + RtspClientLibrary.lib;avcodec.lib;avformat.lib;avutil.lib;swresample.lib;swscale.lib;%(AdditionalDependencies) + $(OutDir)\$(ProjectName).exe + + + + + + \ No newline at end of file diff --git a/MediaClient/Test/testbackup.c b/MediaClient/Test/testbackup.c new file mode 100644 index 0000000..fd67e5d --- /dev/null +++ b/MediaClient/Test/testbackup.c @@ -0,0 +1,428 @@ +//typedef struct +//{ +// CRtspClient rtsp; +// CVideoDecoder decoder; +// BOOL decoder_init; +//} ANSRTSPPlayer; +//typedef struct +//{ +// int event; +// ANSRTSPPlayer* player; +//} EVENT_PARAMS; +//class ANSRTSP_API ANSRTSP +//{ +//protected: +// ANSRTSPPlayer* _rtspClient; +// std::string _uri; +// std::string _username; +// std::string _password; +// static HQUEUE* g_queue; +// static int g_flag; +// static pthread_t g_tid; +// std::mutex mtx; // Mutex to protect frame conversion +// SwsContext* swsCtx = nullptr; // Shared SwsContext +// int lastWidth = 0, lastHeight = 0; +// AVPixelFormat lastPixFmt = AV_PIX_FMT_NONE; +// +// void initSwsContext(int width, int height, AVPixelFormat pixFmt); +// static int rtsp_notify_cb(int event, void* puser); +// static int rtsp_audio_cb(uint8* pdata, int len, uint32 ts, uint16 seq, void* puser); +// static int rtsp_video_cb(uint8* pdata, int len, uint32 ts, uint16 seq, void* puser); +// static int rtsp_rtcp_cb(uint8* pdata, int len, int type, void* puser); +// static int rtsp_metadata_cb(uint8* pdata, int len, uint32 ts, uint16 seq, void* puser); +// static void rtsp_setup(ANSRTSPPlayer* player); +// static void rtsp_reconn(ANSRTSPPlayer* player); +// static void* rtsp_notify_handler(void* argv); +// static void video_decoder_cb(AVFrame* frame, void* userdata); +// cv::Mat avframeToCvmat(const AVFrame* frame); +// void playVideo(AVFrame* frame); +//public: +// ANSRTSP(); +// ~ANSRTSP(); +// bool Init(std::string licenseKey, std::string username, std::string password, std::string url); +// bool Start(); +// bool Stop(); +// void Destroy(); +// +//public: +// bool _licenseValid{ false }; +// std::string _licenseKey; +//}; +//HQUEUE* ANSRTSP::g_queue = nullptr; +//int ANSRTSP::g_flag = 0; +//pthread_t ANSRTSP::g_tid = 0; +// +//cv::Mat ANSRTSP::avframeToCvmat(const AVFrame* frame) { +// std::lock_guard lock(mtx); // Ensure thread safety +// +// if (!frame || !frame->data[0] || frame->width <= 0 || frame->height <= 0) { +// std::cerr << "Invalid or empty frame data, or invalid dimensions." << std::endl; +// return cv::Mat(); +// } +// +// // Initialize or reinitialize the context if needed +// initSwsContext(frame->width, frame->height, static_cast(frame->format)); +// +// cv::Mat image(frame->height, frame->width, CV_8UC3); +// uint8_t* dst[1] = { image.data }; // Destination pointers +// int dstStride[1] = { static_cast(image.step[0]) }; // Destination stride +// +// int result = sws_scale(swsCtx, frame->data, frame->linesize, 0, frame->height, dst, dstStride); +// if (result < 0) { +// std::cerr << "Failed to scale the frame." << std::endl; +// return cv::Mat(); // Return an empty matrix if scaling fails +// } +// +// return image; +//} +//void ANSRTSP::video_decoder_cb(AVFrame* frame, void* userdata) +//{ +// ANSRTSP* p_player = (ANSRTSP*)userdata; +// p_player->playVideo(frame); +//} +//void ANSRTSP::playVideo(AVFrame* frame) { +// cv::Mat image = avframeToCvmat(frame); +// if (image.dims > 0) { +// cv::imshow("Image", image); +// if (cv::waitKey(30) == 27) // Wait for 'esc' key press to exit +// { +// std::cout << "End .\n"; +// } +// } +// // Update here or do whatever we need +//} +//int ANSRTSP::rtsp_notify_cb(int event, void* puser) +//{ +// printf("%s, event = %d\r\n", __FUNCTION__, event); +// +// ANSRTSPPlayer* p_player = (ANSRTSPPlayer*)puser; +// CRtspClient* p_rtsp = &p_player->rtsp; +// +// if (RTSP_EVE_CONNSUCC == event) +// { +// int vcodec = p_rtsp->video_codec(); +// if (vcodec != VIDEO_CODEC_NONE) +// { +// char codec_str[20] = { '\0' }; +// +// switch (vcodec) +// { +// case VIDEO_CODEC_H264: +// strcpy_s(codec_str, "H264"); +// break; +// +// case VIDEO_CODEC_H265: +// strcpy_s(codec_str, "H265"); +// break; +// +// case VIDEO_CODEC_MP4: +// strcpy_s(codec_str, "MP4"); +// break; +// +// case VIDEO_CODEC_JPEG: +// strcpy_s(codec_str, "JPEG"); +// break; +// } +// +// printf("video codec is %s\r\n", codec_str); +// } +// +// int acodec = p_rtsp->audio_codec(); +// if (acodec != AUDIO_CODEC_NONE) +// { +// char codec_str[20] = { '\0' }; +// +// switch (acodec) +// { +// case AUDIO_CODEC_G711A: +// strcpy_s(codec_str, "G711A"); +// break; +// +// case AUDIO_CODEC_G711U: +// strcpy_s(codec_str, "G711U"); +// break; +// +// case AUDIO_CODEC_G722: +// strcpy_s(codec_str, "G722"); +// break; +// +// case AUDIO_CODEC_G726: +// strcpy_s(codec_str, "G726"); +// break; +// +// case AUDIO_CODEC_OPUS: +// strcpy_s(codec_str, "OPUS"); +// break; +// +// case AUDIO_CODEC_AAC: +// strcpy_s(codec_str, "AAC"); +// break; +// } +// +// printf("audio codec is %s\r\n", codec_str); +// printf("audio sample rate is %d\r\n", p_rtsp->get_audio_samplerate()); +// printf("audio channels is %d\r\n", p_rtsp->get_audio_channels()); +// } +// } +// +// EVENT_PARAMS params; +// params.event = event; +// params.player = p_player; +// +// if (!hqBufPut(g_queue, (char*)¶ms)) +// { +// printf("hqBufPut failed\r\n"); +// } +// +// return 0; +//} +//int ANSRTSP::rtsp_audio_cb(uint8* pdata, int len, uint32 ts, uint16 seq, void* puser) +//{ +// ANSRTSPPlayer* p_player = (ANSRTSPPlayer*)puser; +// //printf("%s, len = %d, ts = %u, seq = %d\r\n", __FUNCTION__, len, ts, seq); +// return 0; +//} +//int ANSRTSP::rtsp_video_cb(uint8* pdata, int len, uint32 ts, uint16 seq, void* puser) +//{ +// ANSRTSPPlayer* p_player = (ANSRTSPPlayer*)puser; +// CRtspClient* p_rtsp = &p_player->rtsp; +// CVideoDecoder* p_decoder = &p_player->decoder; +// //printf("%s, len = %d, ts = %u, seq = %d\r\n", __FUNCTION__, len, ts, seq); +// if (!p_player->decoder_init) +// { +// p_player->decoder_init = p_decoder->init(p_rtsp->video_codec()); +// p_decoder->setCallback(video_decoder_cb, p_player); +// } +// +// if (p_player->decoder_init) +// { +// p_decoder->decode(pdata, len, ts); +// } +// +// return 0; +//} +//int ANSRTSP::rtsp_rtcp_cb(uint8* pdata, int len, int type, void* puser) +//{ +// ANSRTSPPlayer* p_player = (ANSRTSPPlayer*)puser; +// +// printf("%s, len = %d, type = %d\r\n", __FUNCTION__, len, type); +// +// return 0; +//} +//int ANSRTSP::rtsp_metadata_cb(uint8* pdata, int len, uint32 ts, uint16 seq, void* puser) +//{ +// ANSRTSPPlayer* p_player = (ANSRTSPPlayer*)puser; +// //printf("%s, len = %d, ts = %u, seq = %d\r\n", __FUNCTION__, len, ts, seq); +// return 0; +//} +//void ANSRTSP::rtsp_setup(ANSRTSPPlayer* player) +//{ +// CRtspClient* p_rtsp = &player->rtsp; +// +// p_rtsp->set_notify_cb(rtsp_notify_cb, player); +// p_rtsp->set_audio_cb(rtsp_audio_cb); +// p_rtsp->set_video_cb(rtsp_video_cb); +// p_rtsp->set_rtcp_cb(rtsp_rtcp_cb); +//#ifdef METADATA +// p_rtsp->set_metadata_cb(rtsp_metadata_cb); +//#endif +// // p_rtsp->set_rtp_over_udp(1); // rtp over udp +// // p_rtsp->set_rtp_multicast(1); // force multicast rtp via rtsp +//#ifdef BACKCHANNEL +// // p_rtsp->set_bc_flag(1); // enable audio backchannel +// // p_rtsp->set_bc_data_flag(1); // enable send audio data +//#endif +//#ifdef REPLAY +// // p_rtsp->set_replay_flag(1); // enable replay +// // p_rtsp->set_replay_range(time(NULL) - 3600, time(NULL)); // set the replay timestamp range +//#endif +//#ifdef OVER_HTTP +// // p_rtsp->set_rtsp_over_http(1, 80); // rtsp over http +//#endif +//#ifdef OVER_WEBSOCKET +// // p_rtsp->set_rtsp_over_ws(1, 80); // rtsp over websocket +//#endif +// +// p_rtsp->set_rx_timeout(10); // No data within 10s, receiving timeout +// // p_rtsp->set_channel(AV_VIDEO_CH, 0); // not setup video channel +// // p_rtsp->set_channel(AV_AUDIO_CH, 0); // not setup audio channel +// // p_rtsp->set_channel(AV_METADATA_CH, 0); // not setup metadata channel +// // p_rtsp->set_channel(AV_BACK_CH, 0); // not setup audio back channel +// +//} +//void ANSRTSP::rtsp_reconn(ANSRTSPPlayer* player) +//{ +// char url[256], user[64], pass[64]; +// CRtspClient* p_rtsp = &player->rtsp; +// +// strcpy_s(url, p_rtsp->get_url()); +// strcpy_s(user, p_rtsp->get_user()); +// strcpy_s(pass, p_rtsp->get_pass()); +// +// printf("rtsp_reconn, url = %s, user = %s, pass = %s\r\n", url, user, pass); +// +// p_rtsp->rtsp_close(); +// +// rtsp_setup(player); +// +// p_rtsp->rtsp_start(url, user, pass); +//} +//void* ANSRTSP::rtsp_notify_handler(void* argv) +//{ +// EVENT_PARAMS params; +// +// while (g_flag) +// { +// if (hqBufGet(g_queue, (char*)¶ms)) +// { +// if (params.event == -1 || params.player == NULL) +// { +// break; +// } +// +// if (RTSP_EVE_STOPPED == params.event || +// RTSP_EVE_CONNFAIL == params.event || +// RTSP_EVE_NOSIGNAL == params.event || +// RTSP_EVE_NODATA == params.event) +// { +// rtsp_reconn(params.player); +// usleep(100 * 1000); +// } +// } +// } +// +// g_tid = 0; +// +// printf("%s exit\r\n", __FUNCTION__); +// +// return NULL; +//} +// +//ANSRTSP::ANSRTSP() { +// g_queue = nullptr; +// g_flag = 0; +// g_tid = 0; +//} +//ANSRTSP::~ANSRTSP() { +// if (swsCtx != nullptr) { +// sws_freeContext(swsCtx); +// swsCtx = nullptr; +// } +// Destroy(); +//} +//void ANSRTSP::initSwsContext(int width, int height, AVPixelFormat pixFmt) { +// if (swsCtx != nullptr && (width != lastWidth || height != lastHeight || pixFmt != lastPixFmt)) { +// sws_freeContext(swsCtx); +// swsCtx = nullptr; +// } +// +// if (swsCtx == nullptr) { +// swsCtx = sws_getContext(width, height, pixFmt, width, height, AV_PIX_FMT_BGR24, +// SWS_LANCZOS | SWS_ACCURATE_RND, nullptr, nullptr, nullptr); +// if (swsCtx == nullptr) { +// throw std::runtime_error("Failed to create SwsContext"); +// } +// lastWidth = width; +// lastHeight = height; +// lastPixFmt = pixFmt; +// } +//} +//bool ANSRTSP::Init(std::string licenseKey, std::string username, std::string password, std::string url) { +// log_init("rtsptest.log"); +// log_set_level(HT_LOG_DBG); +// network_init(); +// // allocate system BUFFER and rtsp parser BUFFER +// sys_buf_init(200); +// rtsp_parse_buf_init(200); +// +//#if defined(OVER_HTTP) || defined(OVER_WEBSOCKET) +// // allocate http message parser BUFFER +// http_msg_buf_init(200); +//#endif +// +// // create event queue +// g_queue = hqCreate(1 * 4, sizeof(EVENT_PARAMS), HQ_PUT_WAIT | HQ_GET_WAIT); +// if (NULL == g_queue) +// { +// printf("create queue failed\r\n"); +// return false; +// } +// +// // create event handler thread +// g_flag = 1; +// g_tid = sys_os_create_thread((void*)rtsp_notify_handler, NULL); +// if (g_tid == 0) +// { +// printf("create rtsp notify handler thread failed\r\n"); +// return false; +// } +// +// _rtspClient = new ANSRTSPPlayer[1]; +// rtsp_setup(&_rtspClient[0]); // Setup Client +// _uri = url; +// _username = username; +// _password = password; +// return true; +//} +//bool ANSRTSP::Start() { +// BOOL ret = _rtspClient[0].rtsp.rtsp_start(_uri.c_str(), _username.c_str(), _password.c_str());// ("rtsp://118.70.125.152:5656/cam/realmonitor?channel=1&subtype=0", "root", "abcd1234"); +// //printf("rtsp %d start ret = %d\r\n", i, ret); +// usleep(100 * 1000); +// return ret; +//} +//bool ANSRTSP::Stop() { +// return _rtspClient[0].rtsp.rtsp_close(); +//} +//void ANSRTSP::Destroy() { +// g_flag = 0; +// +// EVENT_PARAMS params; +// +// params.event = -1; +// params.player = 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 +// rtsp_parse_buf_deinit(); +// sys_buf_deinit(); +// +//#if defined(OVER_HTTP) || defined(OVER_WEBSOCKET) +// http_msg_buf_deinit(); +//#endif +// +// // close log +// log_close(); +// +//} +//int RSTPTest() { +// ANSRTSP rtspClient; +// //rtsp://anscamuser:SonTay2020@anssontay.tplinkdns.com:554/Streaming/Channels/401 +// //rtspClient.Init("","root", "abcd1234", "rtsp://118.70.125.152:5656/cam/realmonitor?channel=1&subtype=0"); +// rtspClient.Init("","anscamuser", "SonTay2020", "rtsp://anssontay.tplinkdns.com:554/Streaming/Channels/401"); +// +// rtspClient.Start(); +// for (;;) +// { +// if (getchar() == 'q') +// { +// break; +// } +// std::cout << "Waiting ..." << std::endl; +// +// usleep(1000 * 1000); // 1s +// } +// rtspClient.Stop(); +// rtspClient.Destroy(); +// return 0; +// +//} diff --git a/MediaClient/doc/Update b/MediaClient/doc/Update new file mode 100644 index 0000000..819a6d3 --- /dev/null +++ b/MediaClient/doc/Update @@ -0,0 +1,4 @@ +We provide source code version update service, you can purchase it by the link: + +https://order.mycommerce.com/cart/add?vendorid=200278075&PRODUCT%5B300859829%5D=1 + diff --git a/MediaClient/doc/Version b/MediaClient/doc/Version new file mode 100644 index 0000000..4fe5631 --- /dev/null +++ b/MediaClient/doc/Version @@ -0,0 +1 @@ +3.2 \ No newline at end of file diff --git a/MediaClient/doc/developer manual.pdf b/MediaClient/doc/developer manual.pdf new file mode 100644 index 0000000..e5ac7e7 Binary files /dev/null and b/MediaClient/doc/developer manual.pdf differ diff --git a/MediaClient/doc/license.txt b/MediaClient/doc/license.txt new file mode 100644 index 0000000..22272fe --- /dev/null +++ b/MediaClient/doc/license.txt @@ -0,0 +1,99 @@ + + Happytimesoft source code license + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 6 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work. + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, grants to You a perpetual, worldwide, non-exclusive, + no-charge, royalty-free, irrevocable copyright license to reproduce, + prepare Derivative Works of, publicly display, publicly perform, + sublicense, and distribute the Work and such Derivative Works in + Object form. + + 3. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Object form. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 4. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 5. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall be liable to You + for damages, including any direct, indirect, special, incidental, + or consequential damages of any character arising as a result of + this License or out of the use or inability to use the Work + (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commerc:qial damages or losses. + + 6. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility. + + END OF TERMS AND CONDITIONS + + 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. + + \ No newline at end of file diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/bm/base64.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/bm/base64.h new file mode 100644 index 0000000..8e223b5 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/bm/base64.h @@ -0,0 +1,37 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef BASE64_H +#define BASE64_H + +#ifdef __cplusplus +extern "C" { +#endif + +HT_API int base64_encode(uint8 *source, uint32 sourcelen, char *target, uint32 targetlen); +HT_API int base64_decode(const char *source, uint32 sourcelen, uint8 *target, uint32 targetlen); + +#ifdef __cplusplus +} +#endif + + +#endif /* BASE64_H */ + + diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/bm/hqueue.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/bm/hqueue.h new file mode 100644 index 0000000..eae000f --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/bm/hqueue.h @@ -0,0 +1,74 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef HQUEUE_H +#define HQUEUE_H + + +/***********************************************************/ +#define HQ_PUT_WAIT 0x00000001 +#define HQ_GET_WAIT 0x00000002 +#define HQ_NO_EVENT 0x00000004 + +/***********************************************************/ +typedef struct h_queue +{ + uint32 queue_mode; + uint32 unit_num; + uint32 unit_size; + uint32 front; + uint32 rear; + uint32 queue_buffer; + uint32 count_put_full; + + void * queue_putMutex; + void * queue_nnulEvent; + void * queue_nfulEvent; +} HQUEUE; + + +#ifdef __cplusplus +extern "C" { +#endif + +/***********************************************************/ +HT_API HQUEUE * hqCreate(uint32 unit_num, uint32 unit_size, uint32 queue_mode); +HT_API void hqDelete(HQUEUE * phq); + +HT_API BOOL hqBufPut(HQUEUE * phq,char * buf); +HT_API BOOL hqBufGet(HQUEUE * phq,char * buf); + +HT_API BOOL hqBufIsEmpty(HQUEUE * phq); +HT_API BOOL hqBufIsFull(HQUEUE * phq); + +HT_API char * hqBufGetWait(HQUEUE * phq); +HT_API void hqBufGetWaitPost(HQUEUE * phq); + +HT_API char * hqBufPutPtrWait(HQUEUE * phq); +HT_API void hqBufPutPtrWaitPost(HQUEUE * phq, BOOL bPutFinish); +HT_API BOOL hqBufPeek(HQUEUE * phq,char * buf); + +#ifdef __cplusplus +} +#endif + +#endif // HQUEUE_H + + + diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/bm/hxml.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/bm/hxml.h new file mode 100644 index 0000000..657dcb8 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/bm/hxml.h @@ -0,0 +1,60 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef H_XML_H +#define H_XML_H + +#define XML_MAX_STACK_DEPTH 1024 +#define XML_MAX_ATTR_NUM 200 + +typedef struct xmlparser +{ + char * xmlstart; + char * xmlend; + char * ptr; // pointer to current character + int xmlsize; + char * e_stack[XML_MAX_STACK_DEPTH]; + int e_stack_index; + char * attr[XML_MAX_ATTR_NUM]; + void * userdata; + + void (*startElement)(void * userdata, const char * name, const char ** attr); + void (*endElement)(void * userdata, const char * name); + void (*charData)(void * userdata, const char * str, int len); +} XMLPRS; + +#ifdef __cplusplus +extern "C" { +#endif + +HT_API int hxml_parse_header(XMLPRS * parse); +HT_API int hxml_parse_attr(XMLPRS * parse); +HT_API int hxml_parse_element_end(XMLPRS * parse); +HT_API int hxml_parse_element_start(XMLPRS * parse); +HT_API int hxml_parse_element(XMLPRS * parse); +HT_API int hxml_parse(XMLPRS * parse); + +#ifdef __cplusplus +} +#endif + +#endif // H_XML_H + + + diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/bm/linked_list.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/bm/linked_list.h new file mode 100644 index 0000000..798bef9 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/bm/linked_list.h @@ -0,0 +1,83 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef LINKED_LIST_H +#define LINKED_LIST_H + +/************************************************************************************/ +typedef struct LINKED_NODE +{ + struct LINKED_NODE * p_next; + struct LINKED_NODE * p_previous; + void * p_data; +} LINKED_NODE; + +/************************************************************************************/ +typedef struct LINKED_LIST +{ + LINKED_NODE * p_first_node; + LINKED_NODE * p_last_node; + void * list_semMutex; +} LINKED_LIST; + + +#ifdef __cplusplus +extern "C" { +#endif + +HT_API LINKED_LIST* h_list_create(BOOL bNeedMutex); +HT_API void h_list_free_container(LINKED_LIST * p_linked_list); +HT_API void h_list_free_all_node(LINKED_LIST * p_linked_list); + +HT_API void h_list_get_ownership(LINKED_LIST * p_linked_list); +HT_API void h_list_giveup_ownership(LINKED_LIST * p_linked_list); + +HT_API BOOL h_list_remove(LINKED_LIST * p_linked_list, LINKED_NODE * p_node); +HT_API BOOL h_list_remove_data(LINKED_LIST * p_linked_list, void * p_data); + +HT_API void h_list_remove_from_front(LINKED_LIST * p_linked_list); +HT_API void h_list_remove_from_front_no_lock(LINKED_LIST * p_linked_list); +HT_API void h_list_remove_from_back(LINKED_LIST * p_linked_list); + +HT_API BOOL h_list_add_at_front(LINKED_LIST * p_linked_list, void * p_item); +HT_API BOOL h_list_add_at_back(LINKED_LIST * p_linked_list, void * p_item); + +HT_API uint32 h_list_get_number_of_nodes(LINKED_LIST * p_linked_list); + +HT_API BOOL h_list_insert(LINKED_LIST * p_linked_list, LINKED_NODE * p_pre_node, void * p_item); + +HT_API LINKED_NODE* h_list_lookup_start(LINKED_LIST * p_linked_list); +HT_API LINKED_NODE* h_list_lookup_next(LINKED_LIST * p_linked_list, LINKED_NODE * p_node); +HT_API void h_list_lookup_end(LINKED_LIST * p_linked_list); + +HT_API LINKED_NODE* h_list_lookback_start(LINKED_LIST * p_linked_list); +HT_API LINKED_NODE* h_list_lookback_next(LINKED_LIST * p_linked_list, LINKED_NODE * p_node); +HT_API void h_list_lookback_end(LINKED_LIST * p_linked_list); + +HT_API BOOL h_list_is_empty(LINKED_LIST * p_list); +HT_API LINKED_NODE* h_list_get_from_front(LINKED_LIST * p_list); +HT_API LINKED_NODE* h_list_get_from_back(LINKED_LIST * p_list); + +#ifdef __cplusplus +} +#endif + +#endif // LINKED_LIST_H + + diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/bm/ppstack.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/bm/ppstack.h new file mode 100644 index 0000000..3a4ed0b --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/bm/ppstack.h @@ -0,0 +1,110 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef PPSTACK_H +#define PPSTACK_H + + +/***************************************************************************************/ + +typedef struct PPSN // ppstack_node +{ + unsigned long prev_node; + unsigned long next_node; + unsigned long node_flag; // 0:idle 1:in FreeList 2:in UsedList +} PPSN; + +typedef struct PPSN_CTX +{ + char * fl_base; + uint32 head_node; + uint32 tail_node; + uint32 node_num; + uint32 low_offset; + uint32 high_offset; + uint32 unit_size; + void * ctx_mutex; + uint32 pop_cnt; + uint32 push_cnt; +} PPSN_CTX; + +#ifdef __cplusplus +extern "C" { +#endif + +/***************************************************************************************/ + +HT_API PPSN_CTX * pps_ctx_fl_init(unsigned long node_num, unsigned long content_size, BOOL bNeedMutex); +HT_API PPSN_CTX * pps_ctx_fl_init_assign(char * mem_addr, unsigned long mem_len, unsigned long node_num, unsigned long content_size, BOOL bNeedMutex); + +HT_API void pps_fl_free(PPSN_CTX * fl_ctx); +HT_API void pps_fl_reinit(PPSN_CTX * fl_ctx); + +HT_API BOOL pps_fl_push(PPSN_CTX * pps_ctx, void * content_ptr); +HT_API BOOL pps_fl_push_tail(PPSN_CTX * pps_ctx, void * content_ptr); +HT_API void * pps_fl_pop(PPSN_CTX * pps_ctx); + +HT_API PPSN_CTX * pps_ctx_ul_init(PPSN_CTX * fl_ctx, BOOL bNeedMutex); +HT_API BOOL pps_ctx_ul_init_assign(PPSN_CTX * ul_ctx, PPSN_CTX * fl_ctx, BOOL bNeedMutex); +HT_API BOOL pps_ctx_ul_init_nm(PPSN_CTX * fl_ctx, PPSN_CTX * ul_ctx); + +HT_API void pps_ul_reinit(PPSN_CTX * ul_ctx); +HT_API void pps_ul_free(PPSN_CTX * ul_ctx); + +HT_API BOOL pps_ctx_ul_del(PPSN_CTX * ul_ctx, void * content_ptr); +HT_API PPSN * pps_ctx_ul_del_node_unlock(PPSN_CTX * ul_ctx, PPSN * p_node); +HT_API void * pps_ctx_ul_del_unlock(PPSN_CTX * ul_ctx, void * content_ptr); + +HT_API BOOL pps_ctx_ul_add(PPSN_CTX * ul_ctx, void * content_ptr); +HT_API BOOL pps_ctx_ul_add_head(PPSN_CTX * ul_ctx, void * content_ptr); + +HT_API uint32 pps_get_index(PPSN_CTX * pps_ctx, void * content_ptr); +HT_API void * pps_get_node_by_index(PPSN_CTX * pps_ctx, unsigned long index); + +/***************************************************************************************/ +HT_API void * pps_lookup_start(PPSN_CTX * pps_ctx); +HT_API void * pps_lookup_next(PPSN_CTX * pps_ctx, void * ct_ptr); +HT_API void pps_lookup_end(PPSN_CTX * pps_ctx); + +HT_API void * pps_lookback_start(PPSN_CTX * pps_ctx); +HT_API void * pps_lookback_next(PPSN_CTX * pps_ctx, void * ct_ptr); +HT_API void pps_lookback_end(PPSN_CTX * pps_ctx); + +HT_API void pps_wait_mutex(PPSN_CTX * pps_ctx); +HT_API void pps_post_mutex(PPSN_CTX * pps_ctx); + +HT_API BOOL pps_safe_node(PPSN_CTX * pps_ctx, void * content_ptr); +HT_API BOOL pps_idle_node(PPSN_CTX * pps_ctx, void * content_ptr); +HT_API BOOL pps_exist_node(PPSN_CTX * pps_ctx, void * content_ptr); +HT_API BOOL pps_used_node(PPSN_CTX * pps_ctx, void * content_ptr); + +/***************************************************************************************/ +HT_API int pps_node_count(PPSN_CTX * pps_ctx); +HT_API void * pps_get_head_node(PPSN_CTX * pps_ctx); +HT_API void * pps_get_tail_node(PPSN_CTX * pps_ctx); +HT_API void * pps_get_next_node(PPSN_CTX * pps_ctx, void * content_ptr); +HT_API void * pps_get_prev_node(PPSN_CTX * pps_ctx, void * content_ptr); + +#ifdef __cplusplus +} +#endif + +#endif // PPSTACK_H + + diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/bm/rfc_md5.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/bm/rfc_md5.h new file mode 100644 index 0000000..2cf5103 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/bm/rfc_md5.h @@ -0,0 +1,46 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef RFC_MD5_H +#define RFC_MD5_H + +typedef struct +{ + uint32 total[2]; + uint32 state[4]; + uint8 buffer[64]; +} md5_context; + + +#ifdef __cplusplus +extern "C"{ +#endif + +HT_API void md5_starts(md5_context *ctx); +HT_API void md5_update(md5_context *ctx, uint8 *input, uint32 length); +HT_API void md5_finish(md5_context *ctx, uint8 digest[16]); + +#ifdef __cplusplus +} +#endif + +#endif + + + diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/bm/sha1.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/bm/sha1.h new file mode 100644 index 0000000..f2217ca --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/bm/sha1.h @@ -0,0 +1,44 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef _SHA1_H_ +#define _SHA1_H_ + +typedef struct +{ + uint32 total[2]; + uint32 state[5]; + uint8 buffer[64]; +} sha1_context; + +#ifdef __cplusplus +extern "C" { +#endif + +HT_API void sha1_starts(sha1_context * ctx); +HT_API void sha1_update(sha1_context * ctx, uint8 * input, uint32 length); +HT_API void sha1_finish(sha1_context * ctx, uint8 digest[20]); + +#ifdef __cplusplus +} +#endif + +#endif // _SHA1_H_ + + diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/bm/sys_buf.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/bm/sys_buf.h new file mode 100644 index 0000000..3c06fec --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/bm/sys_buf.h @@ -0,0 +1,116 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef SYS_BUF_H +#define SYS_BUF_H + +/***************************************************************************************/ +#define MAX_AVN 8 +#define MAX_AVDESCLEN 500 +#define MAX_USRL 64 +#define MAX_PWDL 32 +#define MAX_NUML 64 +#define MAX_UA_ALT_NUM 8 + + +/***************************************************************************************/ +typedef struct header_value +{ + char header[32]; + char * value_string; +} HDRV; + +typedef struct ua_rtp_info +{ + int rtp_cnt; + uint32 rtp_ssrc; + uint32 rtp_ts; + uint8 rtp_pt; +} UA_RTP_INFO; + +typedef struct +{ + /* rtcp sender statistics */ + + int64 last_rtcp_ntp_time; + int64 first_rtcp_ntp_time; + uint32 packet_count; + uint32 octet_count; + uint32 last_octet_count; + int first_packet; + char cname[64]; +} UA_RTCP_INFO; + +typedef struct http_digest_auth_info +{ + char auth_name[MAX_USRL]; + char auth_pwd[64]; + char auth_uri[256]; + char auth_qop[32]; + char auth_nonce[128]; + char auth_cnonce[128]; + char auth_realm[128]; + char auth_algorithm[32]; + int auth_opaque_flag; + char auth_opaque[128]; + int auth_nc; + char auth_ncstr[12]; + char auth_response[100]; +} HD_AUTH_INFO; + +#ifdef __cplusplus +extern "C" { +#endif + +extern HT_API PPSN_CTX * hdrv_buf_fl; + +/***********************************************************************/ +HT_API BOOL net_buf_init(int num, int size); +HT_API void net_buf_deinit(); + +HT_API char * net_buf_get_idle(); +HT_API void net_buf_free(char * rbuf); +HT_API uint32 net_buf_get_size(); +HT_API uint32 net_buf_idle_num(); + +/***********************************************************************/ +HT_API BOOL hdrv_buf_init(int num); +HT_API void hdrv_buf_deinit(); + +HT_API HDRV * hdrv_buf_get_idle(); +HT_API void hdrv_buf_free(HDRV * pHdrv); +HT_API uint32 hdrv_buf_idle_num(); + +HT_API void hdrv_ctx_ul_init(PPSN_CTX * ul_ctx); +HT_API void hdrv_ctx_free(PPSN_CTX * p_ctx); + +/***********************************************************************/ +HT_API BOOL sys_buf_init(int nums); +HT_API void sys_buf_deinit(); +/***********************************************************************/ + + +#ifdef __cplusplus +} +#endif + +#endif // SYS_BUF_H + + + diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/bm/sys_inc.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/bm/sys_inc.h new file mode 100644 index 0000000..465aedc --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/bm/sys_inc.h @@ -0,0 +1,186 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef __SYS_INC_H__ +#define __SYS_INC_H__ + +#if defined(_WIN32) || defined(_WIN64) +#define __WINDOWS_OS__ 1 +#define __LINUX_OS__ 0 +#else +#define __WINDOWS_OS__ 0 +#define __LINUX_OS__ 1 +#endif + +#if __WINDOWS_OS__ + #ifdef HT_EXPORTS + #define HT_API __declspec(dllexport) + #else + #define HT_API __declspec(dllimport) + #endif + + #ifdef HT_STATIC + #undef HT_API + #define HT_API + #endif +#else + #define HT_API +#endif + +/***************************************************************************************/ +typedef int int32; +typedef unsigned int uint32; +typedef unsigned short uint16; +typedef unsigned char uint8; + + +/***************************************************************************************/ +#if __WINDOWS_OS__ + +#include "stdafx.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include /* _beginthread, _endthread */ +#include +#include + +#define sleep(x) Sleep((x) * 1000) +#define usleep(x) Sleep((x) / 1000) + +#define strcasecmp stricmp +#define strncasecmp strnicmp +#define snprintf _snprintf + +#define pthread_t DWORD + +typedef __int64 int64; +typedef unsigned __int64 uint64; + +#pragma comment(lib, "iphlpapi.lib") +#pragma comment(lib, "ws2_32.lib") + +#elif __LINUX_OS__ + +#include +#include + +#ifndef ANDROID +#include +#endif + +#include +#include +#include +#include + +#ifndef IOS +#include +#include +#include +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef IOS +#include +#endif + +typedef signed char BOOL; +typedef int SOCKET; + +typedef int64_t int64; +typedef uint64_t uint64; + +#define TRUE 1 +#define FALSE 0 + +#define closesocket close + +#endif + +/*************************************************************************/ +#include "sys_log.h" +#include "ppstack.h" +#include "word_analyse.h" +#include "sys_buf.h" +#include "util.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +HT_API void * sys_os_create_mutex(); +HT_API void * sys_os_create_sig(); + +HT_API void sys_os_destroy_sig_mutex(void * ptr); + +HT_API int sys_os_mutex_enter(void * p_sem); +HT_API void sys_os_mutex_leave(void * p_sem); + +HT_API int sys_os_sig_wait(void * p_sig); +HT_API int sys_os_sig_wait_timeout(void * p_sig, uint32 ms); +HT_API void sys_os_sig_sign(void * p_sig); + +HT_API pthread_t sys_os_create_thread(void * thread_func, void * argv); + +HT_API uint32 sys_os_get_ms(); +HT_API uint32 sys_os_get_uptime(); +HT_API char * sys_os_get_socket_error(); +HT_API int sys_os_get_socket_error_num(); + +#ifdef __cplusplus +} +#endif + +#endif // __SYS_INC_H__ + + + diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/bm/sys_log.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/bm/sys_log.h new file mode 100644 index 0000000..fcb46b6 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/bm/sys_log.h @@ -0,0 +1,81 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef __H_SYS_LOG_H__ +#define __H_SYS_LOG_H__ + +// log level + +#define HT_LOG_TRC 0 +#define HT_LOG_DBG 1 +#define HT_LOG_INFO 2 +#define HT_LOG_WARN 3 +#define HT_LOG_ERR 4 +#define HT_LOG_FATAL 5 + +typedef struct +{ + FILE * fp; // Log file pointer + void * mutex; // read-write lock + int level; // Log level + uint32 cur_size; // The current write length of the log + uint32 max_size; // Maximum file size in KB + int cur_idx; // Current log file index + int max_idx; // Maximum file indexes + int rewind; // Loop write log flag + int time_init; // Initialize log file names using system time + char name[256]; // Log file name +} HT_LOG_CTX; + +#ifdef __cplusplus +extern "C" { +#endif + +HT_API int log_init(const char * log_fname); +HT_API int log_time_init(const char * fname_prev); +HT_API int log_reinit(const char * log_fname); +HT_API int log_time_reinit(const char * fname_prev); +HT_API void log_close(); +HT_API void log_set_level(int level); +HT_API int log_get_level(); +HT_API void log_set_rewind(int rewind); +HT_API int log_get_rewind(); +HT_API void log_set_max_size(int max_size); +HT_API int log_get_max_size(); +HT_API void log_set_max_idx(int max_idx); +HT_API int log_get_max_idx(); +HT_API int log_lock_start(const char * fmt,...); +HT_API int log_lock_print(const char * fmt,...); +HT_API int log_lock_end(const char * fmt,...); + +#ifdef IOS +HT_API int log_ios_print(int level, const char * fmt,...); +#define log_print log_ios_print +#else +HT_API int log_print(int level, const char * fmt,...); +#endif + +#ifdef __cplusplus +} +#endif + +#endif + + + diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/bm/util.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/bm/util.h new file mode 100644 index 0000000..3778ef2 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/bm/util.h @@ -0,0 +1,94 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef __H_UTIL_H__ +#define __H_UTIL_H__ + + +/*************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +/*************************************************************************/ + +#define MIN(a, b) ((a) < (b) ? (a) : (b)) +#define MAX(a, b) ((a) > (b) ? (a) : (b)) + +#define ARRAY_SIZE(ary) (sizeof(ary) / sizeof(ary[0])) + +/*************************************************************************/ +HT_API int get_if_nums(); +HT_API uint32 get_if_ip(int index); +HT_API uint32 get_route_if_ip(uint32 dst_ip); +HT_API uint32 get_default_if_ip(); +HT_API const char * get_local_ip(); +HT_API uint32 get_if_mask(int index); +HT_API uint32 get_route_if_mask(uint32 dst_ip); +HT_API uint32 get_default_if_mask(); +HT_API int is_local_if_net(uint32 destip); +HT_API int get_default_if_mac(uint8 * mac); +HT_API uint32 get_address_by_name(const char * host_name); +HT_API const char * get_default_gateway(); +HT_API const char * get_dns_server(); +HT_API const char * get_mask_by_prefix_len(int len); +HT_API int get_prefix_len_by_mask(const char * mask); +HT_API const char * get_ip_str(uint32 ipaddr /* network byte order */); + + +/*************************************************************************/ +HT_API char * lowercase(char * str); +HT_API char * uppercase(char * str); +HT_API int unicode(char ** dst, char * src); + +HT_API BOOL bin_to_hex_str(uint8 * bin, int binlen, char * hex, int hexlen); +HT_API int hex_str_to_bin(char * hex, int hexlen, uint8 * bin, int binlen); + +HT_API int url_encode(const char * src, const int srcsize, char * dst, const int dstsize); +HT_API int url_decode(char * dst, char const * src, uint32 len); +HT_API void url_split(char const* url, char *proto, int proto_size, char *user, int user_size, char *pass, int pass_size, char *host, int host_size, int *port, char *path, int path_size); + +/*************************************************************************/ +HT_API time_t get_time_by_string(char * p_time_str); +HT_API void get_time_str(char * buff, int len); +HT_API void get_time_str_day_off(time_t nt, char * buff, int len, int dayoff); +HT_API void get_time_str_mon_off(time_t nt, char * buff, int len, int moffset); +HT_API time_t get_time_by_tstring(const char * p_time_str); +HT_API void get_tstring_by_time(time_t t, char * buff, int len); + +HT_API SOCKET tcp_connect_timeout(uint32 rip, int port, int timeout); + +/*************************************************************************/ +HT_API void network_init(); +HT_API void network_deinit(); +HT_API int daemon_init(); + +#if __WINDOWS_OS__ +HT_API int gettimeofday(struct timeval* tp, int* tz); +#endif + +#ifdef __cplusplus +} +#endif + +#endif // __H_UTIL_H__ + + + diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/bm/word_analyse.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/bm/word_analyse.h new file mode 100644 index 0000000..c616965 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/bm/word_analyse.h @@ -0,0 +1,55 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef __H_WORD_ANALYSE_H__ +#define __H_WORD_ANALYSE_H__ + +/***************************************************************************************/ +typedef enum word_type +{ + WORD_TYPE_NULL = 0, + WORD_TYPE_STRING, + WORD_TYPE_NUM, + WORD_TYPE_SEPARATOR +} WORD_TYPE; + + +#ifdef __cplusplus +extern "C" { +#endif + +HT_API BOOL is_char(char ch); +HT_API BOOL is_num(char ch); +HT_API BOOL is_separator(char ch); +HT_API BOOL is_ip_address(const char * address); +HT_API BOOL is_integer(char * p_str); + +HT_API BOOL GetLineText(char * buf, int cur_line_offset, int max_len, int * len, int * next_line_offset); +HT_API BOOL GetSipLine(char * p_buf, int max_len, int * len, BOOL * bHaveNextLine); +HT_API BOOL GetLineWord(char * line, int cur_word_offset, int line_max_len, char * word_buf, int buf_len, int * next_word_offset, WORD_TYPE w_t); +HT_API BOOL GetNameValuePair(char * text_buf, int text_len, const char * name, char * value, int value_len); + +#ifdef __cplusplus +} +#endif + +#endif // __H_WORD_ANALYSE_H__ + + + diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/bm/xml_node.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/bm/xml_node.h new file mode 100644 index 0000000..ecdeb01 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/bm/xml_node.h @@ -0,0 +1,89 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef XML_NODE_H +#define XML_NODE_H + +/*************************************************************************************** + * + * XML node define + * +***************************************************************************************/ +#define NTYPE_TAG 0 +#define NTYPE_ATTRIB 1 +#define NTYPE_CDATA 2 + +#define NTYPE_LAST 2 +#define NTYPE_UNDEF -1 + +typedef struct XMLN +{ + int flag; // Is the buffer pointed to by data dynamically allocated memory? If so, it needs to be free + const char * name; + uint32 type; + const char * data; + int dlen; + int finish; + struct XMLN * parent; + struct XMLN * f_child; + struct XMLN * l_child; + struct XMLN * prev; + struct XMLN * next; + struct XMLN * f_attrib; + struct XMLN * l_attrib; +} XMLN; + + +#ifdef __cplusplus +extern "C" { +#endif + +/***************************************************************************************/ +HT_API XMLN * xml_node_add(XMLN * parent, const char * name); +HT_API void xml_node_del(XMLN * p_node); +HT_API XMLN * xml_node_get(XMLN * parent, const char * name); + +HT_API int soap_strcmp(const char * str1, const char * str2); +HT_API void soap_strncpy(char * dest, const char * src, int size); +HT_API XMLN * xml_node_soap_get(XMLN * parent, const char * name); + +/***************************************************************************************/ +HT_API XMLN * xml_attr_add(XMLN * p_node, const char * name, const char * value); +HT_API void xml_attr_del(XMLN * p_node, const char * name); +HT_API const char * xml_attr_get(XMLN * p_node, const char * name); +HT_API XMLN * xml_attr_node_get(XMLN * p_node, const char * name); + +/***************************************************************************************/ +HT_API void xml_cdata_set(XMLN * p_node, const char * value, int len); + +/***************************************************************************************/ +HT_API int xml_calc_buf_len(XMLN * p_node); +HT_API int xml_write_buf(XMLN * p_node, char * xml_buf, int buf_len); + +/***************************************************************************************/ +HT_API XMLN * xxx_hxml_parse(char * p_xml, int len); + +#ifdef __cplusplus +} +#endif + +#endif // XML_NODE_H + + + diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/http/http.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/http/http.h new file mode 100644 index 0000000..62b19c2 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/http/http.h @@ -0,0 +1,222 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef __H_HTTP_H__ +#define __H_HTTP_H__ + +#include "sys_buf.h" +#include "ppstack.h" + +#ifdef HTTPS +#include "openssl/ssl.h" +#endif + +/***************************************************************************************/ +typedef enum http_request_msg_type +{ + HTTP_MT_NULL = 0, + HTTP_MT_GET, + HTTP_MT_HEAD, + HTTP_MT_MPOST, + HTTP_MT_MSEARCH, + HTTP_MT_NOTIFY, + HTTP_MT_POST, + HTTP_MT_SUBSCRIBE, + HTTP_MT_UNSUBSCRIBE, +} HTTP_MT; + +/***************************************************************************************/ +typedef enum http_content_type +{ + CTT_NULL = 0, + CTT_SDP, + CTT_TXT, + CTT_HTM, + CTT_XML, + CTT_BIN, + CTT_JPG, + CTT_RTSP_TUNNELLED, + CTT_MULTIPART, + CTT_FLV +} HTTPCTT; + +#define ctt_is_string(type) (type == CTT_XML || type == CTT_HTM || type == CTT_TXT || type == CTT_SDP) + + +typedef struct _http_msg_content +{ + uint32 msg_type; + uint32 msg_sub_type; + HDRV first_line; + + PPSN_CTX hdr_ctx; + PPSN_CTX ctt_ctx; + + int hdr_len; + int ctt_len; + HTTPCTT ctt_type; + char boundary[256]; + + char * msg_buf; + int buf_offset; + + uint32 remote_ip; + uint16 remote_port; +} HTTPMSG; + +/*************************************************************************/ +typedef struct http_client +{ + uint32 pass_through : 1; // pass through received data flag + uint32 https : 1; // https flag + uint32 resv : 30; + + SOCKET cfd; // client socket + uint32 rip; // remote ip, network byte order + uint32 rport; // remote port + + char rcv_buf[2052]; // static receiving buffer + char * dyn_recv_buf; // dynamic receiving buffer + int rcv_dlen; // received data length + int hdr_len; // http header length + int ctt_len; // context length + HTTPCTT ctt_type; // context type + char * rbuf; // pointer to rcv_buf or dyn_recv_buf + int mlen; // sizeof(rcv_buf) or size of dyn_recv_buf + + void * p_srv; // pointer to HTTPSRV + int use_count; // use count + + void * userdata; // user data + void * userdata_mutex; // user data mutex + uint32 protocol; // protocol, rtsp over http, websocket etc + +#ifdef HTTPS + SSL * ssl; // https SSL + void * ssl_mutex; // https SSL mutex +#endif +} HTTPCLN; + +typedef struct http_req +{ + uint32 need_auth : 1; // need auth flag + uint32 https : 1; // https flag + uint32 resv : 30; + + SOCKET cfd; // client socket + uint32 port; // server port + char host[256]; // server host + char url[256]; // the request url + + char action[256]; // action + char rcv_buf[2052]; // static receiving buffer + char * dyn_recv_buf; // dynamic receiving buffer + int rcv_dlen; // received data length + int hdr_len; // http header length + int ctt_len; // context length + char boundary[256]; // boundary, for CTT_MULTIPART + char * rbuf; // pointer to rcv_buf or dyn_recv_buf + int mlen; // sizeof(rcv_buf) or size of dyn_recv_buf + + HTTPMSG * rx_msg; // rx message + + int auth_mode; // 0 - baisc; 1 - digest + HD_AUTH_INFO auth_info; // http auth information + +#ifdef HTTPS + SSL * ssl; // https SSL + void * ssl_mutex; // https SSL mutex +#endif +} HTTPREQ; + +/*************************************************************************/ + +/* + * If rx_msg is NULL, the callback should call the http_free_used_cln function to delete p_cln + * If the callback is responsible for deleting rx_msg, it returns TRUE, otherwise it returns FALSE + */ +typedef BOOL (*http_msg_cb)(void * p_srv, HTTPCLN * p_cln, HTTPMSG * rx_msg, void * userdata); + +/* + * Raw data received by http + * p_srv : HTTPSRV + * p_cln : http client user agent + * buff : data buffer + * buflen : data buffer length + * + */ +typedef void (*http_data_cb)(void * p_srv, HTTPCLN * p_cln, char * buff, int buflen, void * userdata); + +/* + * http new connection callback + * p_srv : HTTPSRV + * addr : http client connection address, network byte order + * port : http client connection port, host byte order + * + * Return TRUE, accept the new connection, return FALSE, reject the new connection + */ +typedef BOOL (*http_conn_cb)(void * p_srv, uint32 addr, int port, void * userdata); + +typedef struct http_srv_s +{ + uint32 r_flag : 1; // data receiving flag + uint32 https : 1; // https flag + uint32 resv : 30; + + SOCKET sfd; // server socket + + char host[128]; // local server address + int sport; // server port + uint32 saddr; // server address, network byte order + uint32 max_cln_nums; // max client number + + PPSN_CTX * cln_fl; // client free list + PPSN_CTX * cln_ul; // client used list + + uint32 rx_num; // data receiving thread numbers + pthread_t * rx_tid; // data receiving thread id + + void * mutex_cb; // cabllback mutex + http_msg_cb msg_cb; // http message callback + http_data_cb data_cb; // http data callback + http_conn_cb conn_cb; // http connection callback + void * msg_user; // http message callback user data + void * data_user; // http data callback user data + void * conn_user; // http connection callback user data + +#ifdef EPOLL + int ep_fd; // epoll fd + struct epoll_event * ep_events; // epoll events + int ep_event_num; // epoll event number +#endif + +#ifdef HTTPS + char cert_file[256]; // cert file name + char key_file[256]; // key file name + SSL_CTX * ssl_ctx; // ssl context +#endif +} HTTPSRV; + + + +#endif // __H_HTTP_H__ + + + + diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/http/http_cln.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/http/http_cln.h new file mode 100644 index 0000000..0ba585c --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/http/http_cln.h @@ -0,0 +1,46 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef HTTP_CLN_H +#define HTTP_CLN_H + +#include "http.h" + +#ifdef __cplusplus +extern "C" { +#endif + +BOOL http_get_digest_params(char * p, int len, HD_AUTH_INFO * p_auth); +BOOL http_get_digest_info(HTTPMSG * rx_msg, HD_AUTH_INFO * auth_info); +BOOL http_calc_auth_digest(HD_AUTH_INFO * auth_info, const char * method); +int http_build_auth_msg(HTTPREQ * p_http, const char * method, char * buff, int buflen); +int http_cln_auth_set(HTTPREQ * p_http, const char * user, const char * pass); +BOOL http_cln_ssl_conn(HTTPREQ * p_http, int timeout); +BOOL http_cln_rx(HTTPREQ * p_http); +int http_cln_tx(HTTPREQ * p_http, const char * p_data, int len); +BOOL http_cln_rx_timeout(HTTPREQ * p_http, int timeout); +void http_cln_free_req(HTTPREQ * p_http); + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/http/http_parse.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/http/http_parse.h new file mode 100644 index 0000000..5267035 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/http/http_parse.h @@ -0,0 +1,70 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef HTTP_PARSE_H +#define HTTP_PARSE_H + +#include "sys_inc.h" +#include "http.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +/***********************************************************************/ +HT_API BOOL http_msg_buf_init(int num); +HT_API void http_msg_buf_deinit(); + +/***********************************************************************/ +HT_API BOOL http_is_http_msg(char * msg_buf); +HT_API int http_pkt_find_end(char * p_buf); +HT_API void http_headl_parse(char * pline, int llen, HTTPMSG * p_msg); +HT_API int http_line_parse(char * p_buf, int max_len, char sep_char, PPSN_CTX * p_ctx); +HT_API BOOL http_get_headline_uri(HTTPMSG * rx_msg, char * p_uri, int size); +HT_API int http_ctt_parse(HTTPMSG * p_msg); +HT_API int http_msg_parse(char * msg_buf, int msg_buf_len, HTTPMSG * msg); +HT_API int http_msg_parse_part1(char * p_buf, int buf_len, HTTPMSG * msg); +HT_API int http_msg_parse_part2(char * p_buf, int buf_len, HTTPMSG * msg); +HT_API HDRV * http_find_headline(HTTPMSG * msg, const char * head); +HT_API HDRV * http_find_headline_next(HTTPMSG * msg, const char * head, HDRV * hrv); +HT_API char * http_get_headline(HTTPMSG * msg, const char * head); +HT_API HDRV * http_find_ctt_headline(HTTPMSG * msg, const char * head); +HT_API char * http_get_ctt(HTTPMSG * msg); +HT_API BOOL http_get_auth_digest_info(HTTPMSG * rx_msg, HD_AUTH_INFO * p_auth); + +HT_API HTTPMSG * http_get_msg_buf(int size); +HT_API void http_msg_ctx_init(HTTPMSG * msg); +HT_API void http_free_msg_buf(HTTPMSG * msg); +HT_API uint32 http_idle_msg_buf_num(); + +/***********************************************************************/ +HT_API void http_free_msg(HTTPMSG * msg); +HT_API void http_free_msg_content(HTTPMSG * msg); +HT_API void http_free_msg_ctx(HTTPMSG * msg, int type); + + +#ifdef __cplusplus +} +#endif + +#endif + + + diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/http/http_srv.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/http/http_srv.h new file mode 100644 index 0000000..b7efa1b --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/http/http_srv.h @@ -0,0 +1,51 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef HTTP_SRV_H +#define HTTP_SRV_H + +#include "sys_inc.h" +#include "http.h" +#include "http_parse.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/***************************************************************************************/ +HT_API int http_srv_init(HTTPSRV * p_srv, const char * saddr, uint16 sport, int cln_num, BOOL https, const char * cert_file, const char * key_file); +HT_API void http_srv_deinit(HTTPSRV * p_srv); +HT_API void http_set_msg_cb(HTTPSRV * p_srv, http_msg_cb cb, void * p_userdata); +HT_API void http_set_data_cb(HTTPSRV * p_srv, http_data_cb cb, void * p_userdata); +HT_API void http_set_conn_cb(HTTPSRV * p_srv, http_conn_cb cb, void * p_userdata); +HT_API int http_srv_cln_tx(HTTPCLN * p_user, const char * p_data, int len); + +/***************************************************************************************/ +HT_API uint32 http_cln_index(HTTPSRV * p_srv, HTTPCLN * p_cln); +HT_API HTTPCLN* http_get_cln_by_index(HTTPSRV * p_srv, unsigned long index); +HT_API HTTPCLN* http_get_idle_cln(HTTPSRV * p_srv); +HT_API void http_free_used_cln(HTTPSRV * p_srv, HTTPCLN * p_cln); + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/mklinks-android.sh b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/mklinks-android.sh new file mode 100644 index 0000000..b230fe5 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/mklinks-android.sh @@ -0,0 +1,13 @@ +#! /bin/sh + +CUR=$PWD + +if [ ! -f $CUR/openssl/lib/android/libssl.so ]; then +ln -s $CUR/openssl/lib/android/libssl.so.1.1 $CUR/openssl/lib/android/libssl.so +fi + +if [ ! -f $CUR/openssl/lib/android/libcrypto.so ]; then +ln -s $CUR/openssl/lib/android/libcrypto.so.1.1 $CUR/openssl/lib/android/libcrypto.so +fi + +echo "make symbolic link finish!" diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/mklinks.sh b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/mklinks.sh new file mode 100644 index 0000000..c4a127e --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/mklinks.sh @@ -0,0 +1,13 @@ +#! /bin/sh + +CUR=$PWD + +if [ ! -f $CUR/openssl/lib/linux/libssl.so ]; then +ln -s $CUR/openssl/lib/linux/libssl.so.1.1 $CUR/openssl/lib/linux/libssl.so +fi + +if [ ! -f $CUR/openssl/lib/linux/libcrypto.so ]; then +ln -s $CUR/openssl/lib/linux/libcrypto.so.1.1 $CUR/openssl/lib/linux/libcrypto.so +fi + +echo "make symbolic link finish!" diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/onvif/onvif.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/onvif/onvif.h new file mode 100644 index 0000000..6cf10d8 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/onvif/onvif.h @@ -0,0 +1,534 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef __H_ONVIF_H__ +#define __H_ONVIF_H__ + +#include "sys_inc.h" +#include "http.h" +#include "onvif_cm.h" +#include "onvif_act.h" + + +/***************************************************************************************/ + +// device type +#define ODT_UNKNOWN 0 // Unknow device type +#define ODT_NVT 1 // ONVIF Network Video Transmitter +#define ODT_NVD 2 // ONVIF Network Video Display +#define ODT_NVS 3 // ONVIF Network video Storage +#define ODT_NVA 4 // ONVIF Network video Analytics + +// device flag +#define FLAG_MANUAL (1 << 0) // manual added device, other auto discovery devices + + +/***************************************************************************************/ +typedef struct +{ + int type; // device type + char EndpointReference[100]; // endpoint reference + int MetadataVersion; // metadata version + + uint32 sizeScopes; // sopes numbers + onvif_Scope scopes[MAX_SCOPE_NUMS]; // scopes + + onvif_XAddr XAddr; // xaddr, include port host, url +} DEVICE_BINFO; + +/***************************************************************************************/ + +// video source list +typedef struct _VideoSourceList +{ + struct _VideoSourceList * next; + + onvif_VideoSource VideoSource; +} VideoSourceList; + +// video source mode list +typedef struct _VideoSourceModeList +{ + struct _VideoSourceModeList * next; + + onvif_VideoSourceMode VideoSourceMode; +} VideoSourceModeList; + +// video source configuration list +typedef struct _VideoSourceConfigurationList +{ + struct _VideoSourceConfigurationList * next; + + onvif_VideoSourceConfiguration Configuration; +} VideoSourceConfigurationList; + +// video encoder configuration list +typedef struct _VideoEncoderConfigurationList +{ + struct _VideoEncoderConfigurationList * next; + + onvif_VideoEncoderConfiguration Configuration; +} VideoEncoderConfigurationList; + +// audio source list +typedef struct _AudioSourceList +{ + struct _AudioSourceList * next; + + onvif_AudioSource AudioSource; +} AudioSourceList; + +// audio source configuration list +typedef struct _AudioSourceConfigurationList +{ + struct _AudioSourceConfigurationList * next; + + onvif_AudioSourceConfiguration Configuration; +} AudioSourceConfigurationList; + +// audio encoder configuration list +typedef struct _AudioEncoderConfigurationList +{ + struct _AudioEncoderConfigurationList * next; + + onvif_AudioEncoderConfiguration Configuration; +} AudioEncoderConfigurationList; + +typedef struct _MetadataConfigurationList +{ + struct _MetadataConfigurationList * next; + + onvif_MetadataConfiguration Configuration; +} MetadataConfigurationList; + +// ptz preset list +typedef struct _PTZPresetList +{ + struct _PTZPresetList * next; + + onvif_PTZPreset PTZPreset; +} PTZPresetList; + +// ptz configuration list +typedef struct _PTZConfigurationList +{ + struct _PTZConfigurationList * next; + + onvif_PTZConfiguration Configuration; +} PTZConfigurationList; + +// ptz node list +typedef struct _PTZNodeList +{ + struct _PTZNodeList * next; + + onvif_PTZNode PTZNode; +} PTZNodeList; + +// preset tour list +typedef struct _PresetTourList +{ + struct _PresetTourList * next; + + onvif_PresetTour PresetTour; +} PresetTourList; + +// video analytics configuration list +typedef struct _VideoAnalyticsConfigurationList +{ + struct _VideoAnalyticsConfigurationList * next; + + ConfigList * rules; // video analytics rule configuration + ConfigList * modules; // video analytics module configuration + + onvif_SupportedRules SupportedRules; // supported rules + + onvif_VideoAnalyticsConfiguration Configuration; +} VideoAnalyticsConfigurationList; + +// network interface list +typedef struct _NetworkInterfaceList +{ + struct _NetworkInterfaceList * next; + + onvif_NetworkInterface NetworkInterface; +} NetworkInterfaceList; + +typedef struct +{ + onvif_NetworkProtocol NetworkProtocol; + onvif_DNSInformation DNSInformation; + onvif_NTPInformation NTPInformation; + onvif_HostnameInformation HostnameInformation; + onvif_NetworkGateway NetworkGateway; + onvif_DiscoveryMode DiscoveryMode; + onvif_NetworkZeroConfiguration ZeroConfiguration; + + NetworkInterfaceList * interfaces; +} ONVIF_NET; + +// user list +typedef struct _UserList +{ + struct _UserList * next; + + onvif_User User; +} UserList; + +// osd configuration list +typedef struct _OSDConfigurationList +{ + struct _OSDConfigurationList * next; + + onvif_OSDConfiguration OSD; +} OSDConfigurationList; + +typedef struct _RecordingList +{ + struct _RecordingList * next; + + onvif_Recording Recording; +} RecordingList; + +typedef struct _RecordingJobList +{ + struct _RecordingJobList * next; + + onvif_RecordingJob RecordingJob; +} RecordingJobList; + +typedef struct _NotificationMessageList +{ + struct _NotificationMessageList * next; + + onvif_NotificationMessage NotificationMessage; +} NotificationMessageList; + +typedef struct +{ + BOOL subscribe; // event subscribed flag + BOOL pullpoint; // create pull point flag + + char reference_addr[256]; // event comsumer address + char producter_addr[256]; // event producter address + char producter_parameters[512]; // event producter reference parameters + + int init_term_time; // termination time, unit is second + time_t renew_time; // the previous renew timestamp + + uint32 notify_nums; // event notify numbers + + NotificationMessageList * notify; // event notify messages +} ONVIF_EVENT; + +typedef struct _ONVIF_PROFILE +{ + struct _ONVIF_PROFILE * next; + + VideoSourceConfigurationList * v_src_cfg; // video source configuration + VideoEncoderConfigurationList * v_enc_cfg; // video encoder configuration + AudioSourceConfigurationList * a_src_cfg; // audio source configuration + AudioEncoderConfigurationList * a_enc_cfg; // audio encoder configuration + PTZConfigurationList * ptz_cfg; // ptz configuration + VideoAnalyticsConfigurationList * va_cfg; // video analytics configuration + MetadataConfigurationList * metadata_cfg; // metadata configuration + + char name[ONVIF_NAME_LEN]; // profile name + char token[ONVIF_TOKEN_LEN]; // profile token + char stream_uri[ONVIF_URI_LEN]; // rtsp stream address + BOOL fixed; // fixed profile flag +} ONVIF_PROFILE; + +typedef struct +{ + uint32 local_ip; // local ip address to connect to server, network byte order + + DEVICE_BINFO binfo; // device basic information + + int timeType; // the device datatime type, 0-invalid time, 1-local time, 2-utc time + onvif_DateTime devTime; // the device datatime + time_t fetchTime; // fetch time + + // request + char username[32]; // login user name, set by user + char password[32]; // login password, set by user + int timeout; // request timeout, uinit is millisecond + + BOOL needAuth; // whether need auth, If TRUE, it indicates that the ws-username-token authentication method is used for authentication + BOOL authFailed; // when login auth failed, set by onvif stack + ONVIF_RET errCode; // error code, set by onvif stack + onvif_Fault fault; // the onvif fault, set by onvif stack, valid when errCode is ONVIF_ERR_HttpResponseError, or please skip it + int retry_cnt; + + ONVIF_PROFILE * curProfile; // current profile pointer, the default pointer the first profile, user can set it (for media service) + + /********************************************************/ + + VideoSourceList * v_src; // the list of video source + AudioSourceList * a_src; // the list of audio source + ONVIF_PROFILE * profiles; // the list of profile (for media service) + MediaProfileList * media_profiles; // the list of media profile (for media service 2) + VideoSourceConfigurationList * v_src_cfg; // the list of video source configuration + AudioSourceConfigurationList * a_src_cfg; // the list of audio source configuration + VideoEncoderConfigurationList * v_enc_cfg; // the list of video encoder configuration + AudioEncoderConfigurationList * a_enc_cfg; // the list of audio encoder configuration + PTZNodeList * ptz_node; // the list of ptz node + PTZConfigurationList * ptz_cfg; // the list of ptz configuration + + /********************************************************/ + ONVIF_EVENT events; // event information + onvif_DeviceInformation DeviceInformation;// device information + onvif_Capabilities Capabilities; // device capabilities +} ONVIF_DEVICE; + + +#ifdef __cplusplus +extern "C" { +#endif + +HT_API void onvif_free_device(ONVIF_DEVICE * p_dev); + +HT_API UserList * onvif_add_User(UserList ** p_head); +HT_API void onvif_free_Users(UserList ** p_head); + +HT_API LocationEntityList * onvif_add_LocationEntity(LocationEntityList ** p_head); +HT_API void onvif_free_LocationEntitis(LocationEntityList ** p_head); + +HT_API StorageConfigurationList * onvif_add_StorageConfiguration(StorageConfigurationList ** p_head); +HT_API void onvif_free_StorageConfigurations(StorageConfigurationList ** p_head); + +HT_API ONVIF_PROFILE * onvif_add_profile(ONVIF_PROFILE ** p_head); +HT_API ONVIF_PROFILE * onvif_find_profile(ONVIF_PROFILE * p_head, const char * token); +HT_API void onvif_free_profile(ONVIF_PROFILE * p_profile); +HT_API void onvif_free_profiles(ONVIF_PROFILE ** p_head); + +HT_API MediaProfileList * onvif_add_MediaProfile(MediaProfileList ** p_head); +HT_API MediaProfileList * onvif_find_MediaProfile(MediaProfileList * p_head, const char * token); +HT_API void onvif_free_MediaProfiles(MediaProfileList ** p_head); + +HT_API VideoSourceList * onvif_add_VideoSource(VideoSourceList ** p_head); +HT_API VideoSourceList * onvif_find_VideoSource(VideoSourceList * p_head, const char * token); +HT_API void onvif_free_VideoSources(VideoSourceList ** p_head); +HT_API VideoSourceList * onvif_get_cur_VideoSource(ONVIF_DEVICE * p_dev); + +HT_API VideoSourceModeList * onvif_add_VideoSourceMode(VideoSourceModeList ** p_head); +HT_API void onvif_free_VideoSourceModes(VideoSourceModeList ** p_head); + +HT_API VideoSourceConfigurationList * onvif_add_VideoSourceConfiguration(VideoSourceConfigurationList ** p_head); +HT_API VideoSourceConfigurationList * onvif_find_VideoSourceConfiguration(VideoSourceConfigurationList * p_head, const char * token); +HT_API void onvif_free_VideoSourceConfigurations(VideoSourceConfigurationList ** p_head); + +HT_API VideoEncoder2ConfigurationList * onvif_add_VideoEncoder2Configuration(VideoEncoder2ConfigurationList ** p_head); +HT_API VideoEncoder2ConfigurationList * onvif_find_VideoEncoder2Configuration(VideoEncoder2ConfigurationList * p_head, const char * token); +HT_API void onvif_free_VideoEncoder2Configurations(VideoEncoder2ConfigurationList ** p_head); + +HT_API NetworkInterfaceList * onvif_add_NetworkInterface(NetworkInterfaceList ** p_head); +HT_API NetworkInterfaceList * onvif_find_NetworkInterface(NetworkInterfaceList * p_head, const char * token); +HT_API void onvif_free_NetworkInterfaces(NetworkInterfaceList ** p_head); + +HT_API Dot11AvailableNetworksList * onvif_add_Dot11AvailableNetworks(Dot11AvailableNetworksList ** p_head); +HT_API void onvif_free_Dot11AvailableNetworks(Dot11AvailableNetworksList ** p_head); + +HT_API OSDConfigurationList * onvif_add_OSDConfiguration(OSDConfigurationList ** p_head); +HT_API OSDConfigurationList * onvif_find_OSDConfiguration(OSDConfigurationList * p_head, const char * token); +HT_API void onvif_free_OSDConfigurations(OSDConfigurationList ** p_head); + +HT_API MetadataConfigurationList * onvif_add_MetadataConfiguration(MetadataConfigurationList ** p_head); +HT_API MetadataConfigurationList * onvif_find_MetadataConfiguration(MetadataConfigurationList * p_head, const char * token); +HT_API void onvif_free_MetadataConfigurations(MetadataConfigurationList ** p_head); + +HT_API VideoEncoderConfigurationList * onvif_add_VideoEncoderConfiguration(VideoEncoderConfigurationList ** p_head); +HT_API VideoEncoderConfigurationList * onvif_find_VideoEncoderConfiguration(VideoEncoderConfigurationList * p_head, const char * token); +HT_API void onvif_free_VideoEncoderConfigurations(VideoEncoderConfigurationList ** p_head); + +HT_API VideoEncoder2ConfigurationOptionsList * onvif_add_VideoEncoder2ConfigurationOptions(VideoEncoder2ConfigurationOptionsList ** p_head); +HT_API VideoEncoder2ConfigurationOptionsList * onvif_find_VideoEncoder2ConfigurationOptions(VideoEncoder2ConfigurationOptionsList * p_head, const char * encoding); +HT_API void onvif_free_VideoEncoder2ConfigurationOptions(VideoEncoder2ConfigurationOptionsList ** p_head); + +HT_API NotificationMessageList * onvif_add_NotificationMessage(NotificationMessageList ** p_head); +HT_API void onvif_free_NotificationMessage(NotificationMessageList * p_message); +HT_API void onvif_free_NotificationMessages(NotificationMessageList ** p_head); +HT_API int onvif_get_NotificationMessages_nums(NotificationMessageList * p_head); + +HT_API void onvif_device_add_NotificationMessages(ONVIF_DEVICE * p_dev, NotificationMessageList * p_notify); +HT_API int onvif_device_free_NotificationMessages(ONVIF_DEVICE * p_dev, int nums); + +HT_API SimpleItemList * onvif_add_SimpleItem(SimpleItemList ** p_head); +HT_API void onvif_free_SimpleItems(SimpleItemList ** p_head); +HT_API const char * onvif_format_SimpleItem(SimpleItemList * p_item); + +HT_API ElementItemList * onvif_add_ElementItem(ElementItemList ** p_head); +HT_API void onvif_free_ElementItems(ElementItemList ** p_head); + +HT_API ImagingPresetList * onvif_add_ImagingPreset(ImagingPresetList ** p_head); +HT_API ImagingPresetList * onvif_find_ImagingPreset(ImagingPresetList * p_head, const char * token); +HT_API void onvif_free_ImagingPresets(ImagingPresetList ** p_head); + +HT_API AudioSourceList * onvif_add_AudioSource(AudioSourceList ** p_head); +HT_API AudioSourceList * onvif_find_AudioSource(AudioSourceList * p_head, const char * token); +HT_API void onvif_free_AudioSources(AudioSourceList ** p_head); + +HT_API AudioSourceConfigurationList * onvif_add_AudioSourceConfiguration(AudioSourceConfigurationList ** p_head); +HT_API AudioSourceConfigurationList * onvif_find_AudioSourceConfiguration(AudioSourceConfigurationList * p_head, const char * token); +HT_API void onvif_free_AudioSourceConfigurations(AudioSourceConfigurationList ** p_head); + +HT_API AudioEncoderConfigurationList * onvif_add_AudioEncoderConfiguration(AudioEncoderConfigurationList ** p_head); +HT_API AudioEncoderConfigurationList * onvif_find_AudioEncoderConfiguration(AudioEncoderConfigurationList * p_head, const char * token); +HT_API void onvif_free_AudioEncoderConfigurations(AudioEncoderConfigurationList ** p_head); + +HT_API AudioEncoder2ConfigurationList * onvif_add_AudioEncoder2Configuration(AudioEncoder2ConfigurationList ** p_head); +HT_API AudioEncoder2ConfigurationList * onvif_find_AudioEncoder2Configuration(AudioEncoder2ConfigurationList * p_head, const char * token); +HT_API void onvif_free_AudioEncoder2Configurations(AudioEncoder2ConfigurationList ** p_head); + +HT_API AudioEncoder2ConfigurationOptionsList * onvif_add_AudioEncoder2ConfigurationOptions(AudioEncoder2ConfigurationOptionsList ** p_head); +HT_API AudioEncoder2ConfigurationOptionsList * onvif_find_AudioEncoder2ConfigurationOptions(AudioEncoder2ConfigurationOptionsList * p_head, const char * encoding); +HT_API void onvif_free_AudioEncoder2ConfigurationOptions(AudioEncoder2ConfigurationOptionsList ** p_head); + +HT_API AudioDecoderConfigurationList * onvif_add_AudioDecoderConfiguration(AudioDecoderConfigurationList ** p_head); +HT_API void onvif_free_AudioDecoderConfigurations(AudioDecoderConfigurationList ** p_head); + +HT_API MaskList * onvif_add_Mask(MaskList ** p_head); +HT_API MaskList * onvif_find_Mask(MaskList * p_head, const char * token); +HT_API void onvif_free_Masks(MaskList ** p_head); + +HT_API PTZNodeList * onvif_add_PTZNode(PTZNodeList ** p_head); +HT_API PTZNodeList * onvif_find_PTZNode(PTZNodeList * p_head, const char * token); +HT_API void onvif_free_PTZNodes(PTZNodeList ** p_head); + +HT_API PTZConfigurationList * onvif_add_PTZConfiguration(PTZConfigurationList ** p_head); +HT_API PTZConfigurationList * onvif_find_PTZConfiguration(PTZConfigurationList * p_head, const char * token); +HT_API void onvif_free_PTZConfigurations(PTZConfigurationList ** p_head); + +HT_API PTZPresetList * onvif_add_PTZPreset(PTZPresetList ** p_head); +HT_API void onvif_free_PTZPresets(PTZPresetList ** p_head); + +HT_API PTZPresetTourSpotList * onvif_add_PTZPresetTourSpot(PTZPresetTourSpotList ** p_head); +HT_API void onvif_free_PTZPresetTourSpots(PTZPresetTourSpotList ** p_head); + +HT_API PresetTourList * onvif_add_PresetTour(PresetTourList ** p_head); +HT_API void onvif_free_PresetTours(PresetTourList ** p_head); + +HT_API ConfigList * onvif_add_Config(ConfigList ** p_head); +HT_API void onvif_free_Config(ConfigList * p_head); +HT_API void onvif_free_Configs(ConfigList ** p_head); +HT_API ConfigList * onvif_find_Config(ConfigList * p_head, const char * name); +HT_API void onvif_remove_Config(ConfigList ** p_head, ConfigList * p_remove); +HT_API ConfigList * onvif_get_prev_Config(ConfigList * p_head, ConfigList * p_found); + +HT_API ConfigDescriptionList * onvif_add_ConfigDescription(ConfigDescriptionList ** p_head); +HT_API void onvif_free_ConfigDescriptions(ConfigDescriptionList ** p_head); + +HT_API ConfigDescription_MessagesList * onvif_add_ConfigDescription_Message(ConfigDescription_MessagesList ** p_head); +HT_API void onvif_free_ConfigDescription_Message(ConfigDescription_MessagesList * p_item); +HT_API void onvif_free_ConfigDescription_Messages(ConfigDescription_MessagesList ** p_head); + +HT_API ConfigOptionsList * onvif_add_ConfigOptions(ConfigOptionsList ** p_head); +HT_API void onvif_free_ConfigOptions(ConfigOptionsList ** p_head); + +HT_API SimpleItemDescriptionList * onvif_add_SimpleItemDescription(SimpleItemDescriptionList ** p_head); +HT_API void onvif_free_SimpleItemDescriptions(SimpleItemDescriptionList ** p_head); + +HT_API VideoAnalyticsConfigurationList * onvif_add_VideoAnalyticsConfiguration(VideoAnalyticsConfigurationList ** p_head); +HT_API void onvif_free_VideoAnalyticsConfiguration(VideoAnalyticsConfigurationList * p_head); +HT_API void onvif_free_VideoAnalyticsConfigurations(VideoAnalyticsConfigurationList ** p_head); + +HT_API AnalyticsModuleConfigOptionsList * onvif_add_AnalyticsModuleConfigOptions(AnalyticsModuleConfigOptionsList ** p_head); +HT_API void onvif_free_AnalyticsModuleConfigOptions(AnalyticsModuleConfigOptionsList ** p_head); + +HT_API MetadataInfoList * onvif_add_MetadataInfo(MetadataInfoList ** p_head); +HT_API void onvif_free_MetadataInfo(MetadataInfoList ** p_head); + +HT_API RecordingList * onvif_add_Recording(RecordingList ** p_head); +HT_API RecordingList * onvif_find_Recording(RecordingList * p_head, const char * token); +HT_API void onvif_free_Recordings(RecordingList ** p_head); + +HT_API TrackList * onvif_add_Track(TrackList ** p_head); +HT_API void onvif_free_Tracks(TrackList ** p_head); +HT_API TrackList * onvif_find_Track(TrackList * p_head, const char * token); + +HT_API RecordingJobList * onvif_add_RecordingJob(RecordingJobList ** p_head); +HT_API RecordingJobList * onvif_find_RecordingJob(RecordingJobList * p_head, const char * token); +HT_API void onvif_free_RecordingJobs(RecordingJobList ** p_head); + +HT_API TrackAttributesList * onvif_add_TrackAttributes(TrackAttributesList ** p_head); +HT_API void onvif_free_TrackAttributes(TrackAttributesList ** p_head); + +HT_API RecordingInformationList * onvif_add_RecordingInformation(RecordingInformationList ** p_head); +HT_API void onvif_free_RecordingInformations(RecordingInformationList ** p_head); + +HT_API FindEventResultList * onvif_add_FindEventResult(FindEventResultList ** p_head); +HT_API void onvif_free_FindEventResults(FindEventResultList ** p_head); + +HT_API FindMetadataResultList * onvif_add_FindMetadataResult(FindMetadataResultList ** p_head); +HT_API void onvif_free_FindMetadataResults(FindMetadataResultList ** p_head); + +HT_API FindPTZPositionResultList * onvif_add_FindPTZPositionResult(FindPTZPositionResultList ** p_head); +HT_API void onvif_free_FindPTZPositionResults(FindPTZPositionResultList ** p_head); + +HT_API AccessPointList * onvif_add_AccessPoint(AccessPointList ** p_head); +HT_API AccessPointList * onvif_find_AccessPoint(AccessPointList * p_head, const char * token); +HT_API void onvif_free_AccessPoints(AccessPointList ** p_head); + +HT_API DoorInfoList * onvif_add_DoorInfo(DoorInfoList ** p_head); +HT_API DoorInfoList * onvif_find_DoorInfo(DoorInfoList * p_head, const char * token); +HT_API void onvif_free_DoorInfos(DoorInfoList ** p_head); + +HT_API DoorList * onvif_add_Door(DoorList ** p_head); +HT_API DoorList * onvif_find_Door(DoorList * p_head, const char * token); +HT_API void onvif_free_Doors(DoorList ** p_head); + +HT_API AreaList * onvif_add_Area(AreaList ** p_head); +HT_API AreaList * onvif_find_Area(AreaList * p_head, const char * token); +HT_API void onvif_free_Areas(AreaList ** p_head); + +HT_API AudioOutputList * onvif_add_AudioOutput(AudioOutputList ** p_head); +HT_API void onvif_free_AudioOutputs(AudioOutputList ** p_head); + +HT_API AudioOutputConfigurationList * onvif_add_AudioOutputConfiguration(AudioOutputConfigurationList ** p_head); +HT_API void onvif_free_AudioOutputConfigurations(AudioOutputConfigurationList ** p_head); + +HT_API RelayOutputOptionsList * onvif_add_RelayOutputOptions(RelayOutputOptionsList ** p_head); +HT_API void onvif_free_RelayOutputOptions(RelayOutputOptionsList ** p_head); + +HT_API RelayOutputList * onvif_add_RelayOutput(RelayOutputList ** p_head); +HT_API RelayOutputList * onvif_find_RelayOutput(RelayOutputList * p_head, const char * token); +HT_API void onvif_free_RelayOutputs(RelayOutputList ** p_head); + +HT_API DigitalInputList * onvif_add_DigitalInput(DigitalInputList ** p_head); +HT_API DigitalInputList * onvif_find_DigitalInput(DigitalInputList * p_head, const char * token); +HT_API void onvif_free_DigitalInputs(DigitalInputList ** p_head); + +HT_API ThermalConfigurationList * onvif_add_ThermalConfiguration(ThermalConfigurationList ** p_head); +HT_API void onvif_free_ThermalConfigurations(ThermalConfigurationList ** p_head); +HT_API ColorPaletteList * onvif_add_ColorPalette(ColorPaletteList ** p_head); +HT_API void onvif_free_ColorPalettes(ColorPaletteList ** p_head); +HT_API NUCTableList * onvif_add_NUCTable(NUCTableList ** p_head); +HT_API void onvif_free_NUCTables(NUCTableList ** p_head); + +HT_API ReceiverList * onvif_add_Receiver(ReceiverList ** p_head); +HT_API ReceiverList * onvif_find_Receiver(ReceiverList * p_head, const char * token); +HT_API void onvif_free_Receivers(ReceiverList ** p_head); + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/onvif/onvif_act.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/onvif/onvif_act.h new file mode 100644 index 0000000..1677f8f --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/onvif/onvif_act.h @@ -0,0 +1,489 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef ONVIF_ACT_H +#define ONVIF_ACT_H + +/*************************************************************************/ +typedef enum +{ + eActionNull = 0, + + // onvif device service interfaces + etdsGetCapabilities, + etdsGetServices, + etdsGetServiceCapabilities, + etdsGetDeviceInformation, + etdsGetUsers, + etdsCreateUsers, + etdsDeleteUsers, + etdsSetUser, + etdsGetRemoteUser, + etdsSetRemoteUser, + etdsGetNetworkInterfaces, + etdsSetNetworkInterfaces, + etdsGetNTP, + etdsSetNTP, + etdsGetHostname, + etdsSetHostname, + etdsSetHostnameFromDHCP, + etdsGetDNS, + etdsSetDNS, + etdsGetDynamicDNS, + etdsSetDynamicDNS, + etdsGetNetworkProtocols, + etdsSetNetworkProtocols, + etdsGetDiscoveryMode, + etdsSetDiscoveryMode, + etdsGetNetworkDefaultGateway, + etdsSetNetworkDefaultGateway, + etdsGetZeroConfiguration, + etdsSetZeroConfiguration, + etdsGetEndpointReference, + etdsSendAuxiliaryCommand, + etdsGetRelayOutputs, + etdsSetRelayOutputSettings, + etdsSetRelayOutputState, + etdsGetSystemDateAndTime, + etdsSetSystemDateAndTime, + etdsSystemReboot, + etdsSetSystemFactoryDefault, + etdsGetSystemLog, + etdsGetScopes, + etdsSetScopes, + etdsAddScopes, + etdsRemoveScopes, + etdsStartFirmwareUpgrade, + etdsGetSystemUris, + etdsStartSystemRestore, + etdsGetWsdlUrl, + etdsGetDot11Capabilities, + etdsGetDot11Status, + etdsScanAvailableDot11Networks, + etdsGetGeoLocation, + etdsSetGeoLocation, + etdsDeleteGeoLocation, + etdsSetHashingAlgorithm, + etdsGetIPAddressFilter, + etdsSetIPAddressFilter, + etdsAddIPAddressFilter, + etdsRemoveIPAddressFilter, + etdsGetAccessPolicy, + etdsSetAccessPolicy, + etdsGetStorageConfigurations, + etdsCreateStorageConfiguration, + etdsGetStorageConfiguration, + etdsSetStorageConfiguration, + etdsDeleteStorageConfiguration, + + // onvif media service interfaces + etrtGetServiceCapabilities, + etrtGetVideoSources, + etrtGetAudioSources, + etrtCreateProfile, + etrtGetProfile, + etrtGetProfiles, + etrtAddVideoEncoderConfiguration, + etrtAddVideoSourceConfiguration, + etrtAddAudioEncoderConfiguration, + etrtAddAudioSourceConfiguration, + etrtGetVideoSourceModes, + etrtSetVideoSourceMode, + etrtAddPTZConfiguration, + etrtRemoveVideoEncoderConfiguration, + etrtRemoveVideoSourceConfiguration, + etrtRemoveAudioEncoderConfiguration, + etrtRemoveAudioSourceConfiguration, + etrtRemovePTZConfiguration, + etrtDeleteProfile, + etrtGetVideoSourceConfigurations, + etrtGetVideoEncoderConfigurations, + etrtGetAudioSourceConfigurations, + etrtGetAudioEncoderConfigurations, + etrtGetVideoSourceConfiguration, + etrtGetVideoEncoderConfiguration, + etrtGetAudioSourceConfiguration, + etrtGetAudioEncoderConfiguration, + etrtSetVideoSourceConfiguration, + etrtSetVideoEncoderConfiguration, + etrtSetAudioSourceConfiguration, + etrtSetAudioEncoderConfiguration, + etrtGetVideoSourceConfigurationOptions, + etrtGetVideoEncoderConfigurationOptions, + etrtGetAudioSourceConfigurationOptions, + etrtGetAudioEncoderConfigurationOptions, + etrtGetStreamUri, + etrtSetSynchronizationPoint, + etrtGetSnapshotUri, + etrtGetGuaranteedNumberOfVideoEncoderInstances, + etrtGetAudioOutputs, + etrtGetAudioOutputConfigurations, + etrtGetAudioOutputConfiguration, + etrtGetAudioOutputConfigurationOptions, + etrtSetAudioOutputConfiguration, + etrtGetAudioDecoderConfigurations, + etrtGetAudioDecoderConfiguration, + etrtGetAudioDecoderConfigurationOptions, + etrtSetAudioDecoderConfiguration, + etrtAddAudioOutputConfiguration, + etrtAddAudioDecoderConfiguration, + etrtRemoveAudioOutputConfiguration, + etrtRemoveAudioDecoderConfiguration, + etrtGetOSDs, + etrtGetOSD, + etrtSetOSD, + etrtGetOSDOptions, + etrtCreateOSD, + etrtDeleteOSD, + etrtGetVideoAnalyticsConfigurations, + etrtAddVideoAnalyticsConfiguration, + etrtGetVideoAnalyticsConfiguration, + etrtRemoveVideoAnalyticsConfiguration, + etrtSetVideoAnalyticsConfiguration, + etrtGetMetadataConfigurations, + etrtAddMetadataConfiguration, + etrtGetMetadataConfiguration, + etrtRemoveMetadataConfiguration, + etrtSetMetadataConfiguration, + etrtGetMetadataConfigurationOptions, + etrtGetCompatibleVideoEncoderConfigurations, + etrtGetCompatibleAudioEncoderConfigurations, + etrtGetCompatibleVideoAnalyticsConfigurations, + etrtGetCompatibleMetadataConfigurations, + + // onvif media 2 service interfaces + etr2GetServiceCapabilities, + etr2GetVideoEncoderConfigurations, + etr2SetVideoEncoderConfiguration, + etr2GetVideoEncoderConfigurationOptions, + etr2GetProfiles, + etr2CreateProfile, + etr2DeleteProfile, + etr2GetStreamUri, + etr2GetVideoSourceConfigurations, + etr2GetVideoSourceConfigurationOptions, + etr2SetVideoSourceConfiguration, + etr2SetSynchronizationPoint, + etr2GetMetadataConfigurations, + etr2GetMetadataConfigurationOptions, + etr2SetMetadataConfiguration, + etr2GetAudioEncoderConfigurations, + etr2GetAudioSourceConfigurations, + etr2GetAudioSourceConfigurationOptions, + etr2SetAudioSourceConfiguration, + etr2SetAudioEncoderConfiguration, + etr2GetAudioEncoderConfigurationOptions, + etr2AddConfiguration, + etr2RemoveConfiguration, + etr2GetVideoEncoderInstances, + etr2GetAudioOutputConfigurations, + etr2GetAudioOutputConfigurationOptions, + etr2SetAudioOutputConfiguration, + etr2GetAudioDecoderConfigurations, + etr2GetAudioDecoderConfigurationOptions, + etr2SetAudioDecoderConfiguration, + etr2GetSnapshotUri, + etr2StartMulticastStreaming, + etr2StopMulticastStreaming, + etr2GetVideoSourceModes, + etr2SetVideoSourceMode, + etr2CreateOSD, + etr2DeleteOSD, + etr2GetOSDs, + etr2SetOSD, + etr2GetOSDOptions, + etr2GetAnalyticsConfigurations, + etr2GetMasks, + etr2SetMask, + etr2CreateMask, + etr2DeleteMask, + etr2GetMaskOptions, + + // onvif ptz service interfaces + eptzGetServiceCapabilities, + eptzGetNodes, + eptzGetNode, + eptzGetPresets, + eptzSetPreset, + eptzRemovePreset, + eptzGotoPreset, + eptzGotoHomePosition, + eptzSetHomePosition, + eptzGetStatus, + eptzContinuousMove, + eptzRelativeMove, + eptzAbsoluteMove, + eptzStop, + eptzGetConfigurations, + eptzGetConfiguration, + eptzSetConfiguration, + eptzGetConfigurationOptions, + eptzGetPresetTours, + eptzGetPresetTour, + eptzGetPresetTourOptions, + eptzCreatePresetTour, + eptzModifyPresetTour, + eptzOperatePresetTour, + eptzRemovePresetTour, + eptzSendAuxiliaryCommand, + eptzGeoMove, + + // onvif event service interfaces + etevGetServiceCapabilities, + etevGetEventProperties, + etevRenew, + etevUnsubscribe, + etevSubscribe, + etevPauseSubscription, + etevResumeSubscription, + etevCreatePullPointSubscription, + etevDestroyPullPoint, + etevPullMessages, + etevGetMessages, + etevSeek, + etevSetSynchronizationPoint, + + // onvif imaging service interfaces + eimgGetServiceCapabilities, + eimgGetImagingSettings, + eimgSetImagingSettings, + eimgGetOptions, + eimgMove, + eimgStop, + eimgGetStatus, + eimgGetMoveOptions, + eimgGetPresets, + eimgGetCurrentPreset, + eimgSetCurrentPreset, + + // onvif device IO service interfaces + etmdGetServiceCapabilities, + etmdGetRelayOutputs, + etmdGetRelayOutputOptions, + etmdSetRelayOutputSettings, + etmdSetRelayOutputState, + etmdGetDigitalInputs, + etmdGetDigitalInputConfigurationOptions, + etmdSetDigitalInputConfigurations, + + // onvif recording service interfaces + etrcGetServiceCapabilities, + etrcCreateRecording, + etrcDeleteRecording, + etrcGetRecordings, + etrcSetRecordingConfiguration, + etrcGetRecordingConfiguration, + etrcGetRecordingOptions, + etrcCreateTrack, + etrcDeleteTrack, + etrcGetTrackConfiguration, + etrcSetTrackConfiguration, + etrcCreateRecordingJob, + etrcDeleteRecordingJob, + etrcGetRecordingJobs, + etrcSetRecordingJobConfiguration, + etrcGetRecordingJobConfiguration, + etrcSetRecordingJobMode, + etrcGetRecordingJobState, + etrcExportRecordedData, + etrcStopExportRecordedData, + etrcGetExportRecordedDataState, + + // onvif replay service interfaces + etrpGetServiceCapabilities, + etrpGetReplayUri, + etrpGetReplayConfiguration, + etrpSetReplayConfiguration, + + // onvif search service interfaces + etseGetServiceCapabilities, + etseGetRecordingSummary, + etseGetRecordingInformation, + etseGetMediaAttributes, + etseFindRecordings, + etseGetRecordingSearchResults, + etseFindEvents, + etseGetEventSearchResults, + etseFindMetadata, + etseGetMetadataSearchResults, + etseFindPTZPosition, + etseGetPTZPositionSearchResults, + etseGetSearchState, + etseEndSearch, + + // onvif analytics service interfaces + etanGetServiceCapabilities, + etanGetSupportedRules, + etanCreateRules, + etanDeleteRules, + etanGetRules, + etanModifyRules, + etanCreateAnalyticsModules, + etanDeleteAnalyticsModules, + etanGetAnalyticsModules, + etanModifyAnalyticsModules, + etanGetSupportedAnalyticsModules, + etanGetRuleOptions, + etanGetAnalyticsModuleOptions, + etanGetSupportedMetadata, + + // onvif access control service interface + etacGetServiceCapabilities, + etacGetAccessPointInfoList, + etacGetAccessPointInfo, + etacGetAccessPointList, + etacGetAccessPoints, + etacCreateAccessPoint, + etacSetAccessPoint, + etacModifyAccessPoint, + etacDeleteAccessPoint, + etacGetAreaInfoList, + etacGetAreaInfo, + etacGetAreaList, + etacGetAreas, + etacCreateArea, + etacSetArea, + etacModifyArea, + etacDeleteArea, + etacGetAccessPointState, + etacEnableAccessPoint, + etacDisableAccessPoint, + + // onvif door control service interface + etdcGetServiceCapabilities, + etdcGetDoorInfoList, + etdcGetDoorInfo, + etdcGetDoorState, + etdcAccessDoor, + etdcLockDoor, + etdcUnlockDoor, + etdcDoubleLockDoor, + etdcBlockDoor, + etdcLockDownDoor, + etdcLockDownReleaseDoor, + etdcLockOpenDoor, + etdcLockOpenReleaseDoor, + etdcGetDoors, + etdcGetDoorList, + etdcCreateDoor, + etdcSetDoor, + etdcModifyDoor, + etdcDeleteDoor, + + // onvif thermal service interfaces + etthGetServiceCapabilities, + etthGetConfigurations, + etthGetConfiguration, + etthSetConfiguration, + etthGetConfigurationOptions, + etthGetRadiometryConfiguration, + etthSetRadiometryConfiguration, + etthGetRadiometryConfigurationOptions, + + // onvif credential service interfaces + etcrGetServiceCapabilities, + etcrGetCredentialInfo, + etcrGetCredentialInfoList, + etcrGetCredentials, + etcrGetCredentialList, + etcrCreateCredential, + etcrModifyCredential, + etcrDeleteCredential, + etcrGetCredentialState, + etcrEnableCredential, + etcrDisableCredential, + etcrResetAntipassbackViolation, + etcrGetSupportedFormatTypes, + etcrGetCredentialIdentifiers, + etcrSetCredentialIdentifier, + etcrDeleteCredentialIdentifier, + etcrGetCredentialAccessProfiles, + etcrSetCredentialAccessProfiles, + etcrDeleteCredentialAccessProfiles, + + // onvif access rules service interfaces + etarGetServiceCapabilities, + etarGetAccessProfileInfo, + etarGetAccessProfileInfoList, + etarGetAccessProfiles, + etarGetAccessProfileList, + etarCreateAccessProfile, + etarModifyAccessProfile, + etarDeleteAccessProfile, + + // onvif schedule service interface + etscGetServiceCapabilities, + etscGetScheduleInfo, + etscGetScheduleInfoList, + etscGetSchedules, + etscGetScheduleList, + etscCreateSchedule, + etscModifySchedule, + etscDeleteSchedule, + etscGetSpecialDayGroupInfo, + etscGetSpecialDayGroupInfoList, + etscGetSpecialDayGroups, + etscGetSpecialDayGroupList, + etscCreateSpecialDayGroup, + etscModifySpecialDayGroup, + etscDeleteSpecialDayGroup, + etscGetScheduleState, + + // onvif receiver service interface + etrvGetServiceCapabilities, + etrvGetReceivers, + etrvGetReceiver, + etrvCreateReceiver, + etrvDeleteReceiver, + etrvConfigureReceiver, + etrvSetReceiverMode, + etrvGetReceiverState, + + // onvif provisioning service interface + etpvGetServiceCapabilities, + etpvPanMove, + etpvTiltMove, + etpvZoomMove, + etpvRollMove, + etpvFocusMove, + etpvStop, + etpvGetUsage, + + eActionMax +} eOnvifAction; + +typedef struct +{ + eOnvifAction type; + char action_url[256]; +} OVFACTS; + +#ifdef __cplusplus +extern "C" { +#endif + +HT_API OVFACTS * onvif_find_action_by_type(eOnvifAction type); + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/onvif/onvif_api.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/onvif/onvif_api.h new file mode 100644 index 0000000..d5d7e75 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/onvif/onvif_api.h @@ -0,0 +1,117 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ +#ifndef ONVIF_API_H +#define ONVIF_API_H + +#include "sys_inc.h" +#include "onvif.h" +#include "onvif_cln.h" + +#ifdef __cplusplus +extern "C" { +#endif + +HT_API BOOL GetCapabilities(ONVIF_DEVICE * p_dev); +HT_API BOOL GetServices(ONVIF_DEVICE * p_dev); +HT_API BOOL GetSystemDateAndTime(ONVIF_DEVICE * p_dev); +HT_API BOOL SetSystemDateAndTime(ONVIF_DEVICE * p_dev); +HT_API BOOL GetDeviceInformation(ONVIF_DEVICE * p_dev); +HT_API BOOL GetProfiles(ONVIF_DEVICE * p_dev); +HT_API BOOL GetStreamUris(ONVIF_DEVICE * p_dev, onvif_TransportProtocol proto); +HT_API BOOL GetVideoSourceConfigurations(ONVIF_DEVICE * p_dev); +HT_API BOOL GetAudioSourceConfigurations(ONVIF_DEVICE * p_dev); +HT_API BOOL GetVideoEncoderConfigurations(ONVIF_DEVICE * p_dev); +HT_API BOOL GetAudioEncoderConfigurations(ONVIF_DEVICE * p_dev); +HT_API BOOL GetNodes(ONVIF_DEVICE * p_dev); +HT_API BOOL GetConfigurations(ONVIF_DEVICE * p_dev); +HT_API BOOL GetVideoSources(ONVIF_DEVICE * p_dev); +HT_API BOOL GetAudioSources(ONVIF_DEVICE * p_dev); +HT_API BOOL GetImagingSettings(ONVIF_DEVICE * p_dev); +HT_API BOOL Subscribe(ONVIF_DEVICE * p_dev, int index); +HT_API BOOL Unsubscribe(ONVIF_DEVICE * p_dev); +HT_API BOOL CreatePullPointSubscription(ONVIF_DEVICE * p_dev); +HT_API BOOL PullMessages(ONVIF_DEVICE * p_dev, int timeout, int message_limit, tev_PullMessages_RES * p_res); + +/** + * @desc Get the device snapshot + * @param + * p_buf [out] return the snapshot buffer + * buflen [out] return the snapshot buffer length + * + * @note if call success, the caller should call FreeSnapshotBuff to free the snapshot buffer + * + */ +HT_API BOOL GetSnapshot(ONVIF_DEVICE * p_dev, const char * profile_token, unsigned char ** p_buf, int * buflen); + +/** + * @desc Free the buffer + * @param + * p_buf the buffer + * + */ +HT_API void FreeBuff(unsigned char * p_buf); + +/** + * @desc Firmware upgrade + * @param + * filename the upgrade filename + * + */ +HT_API BOOL FirmwareUpgrade(ONVIF_DEVICE * p_dev, const char * filename); + +/** + * @desc backup system settings + * @param + * filename , save as system backup + * + */ +HT_API BOOL SystemBackup(ONVIF_DEVICE * p_dev, const char * filename); + +/** + * @desc restore system settings + * @param + * filename the system backup filename + * + */ +HT_API BOOL SystemRestore(ONVIF_DEVICE * p_dev, const char * filename); + +// media service 2 interface +HT_API BOOL tr2_GetProfiles(ONVIF_DEVICE * p_dev); + +/** + * @desc GetStreamUris + * @param + * proto: + * RtspUnicast -- RTSP streaming RTP as UDP Unicast + * RtspMulticast -- RTSP streaming RTP as UDP Multicast + * RTSP -- RTSP streaming RTP over TCP + * RtspOverHttp -- Tunneling both the RTSP control channel and the RTP stream over HTTP or HTTPS + */ +HT_API BOOL tr2_GetStreamUris(ONVIF_DEVICE * p_dev, const char * proto); +HT_API BOOL tr2_GetVideoSourceConfigurations(ONVIF_DEVICE * p_dev); +HT_API BOOL tr2_GetAudioSourceConfigurations(ONVIF_DEVICE * p_dev); + +#ifdef __cplusplus +} +#endif + +#endif + + + diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/onvif/onvif_cln.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/onvif/onvif_cln.h new file mode 100644 index 0000000..ee7ab7d --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/onvif/onvif_cln.h @@ -0,0 +1,487 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef ONVIF_CLIENT_H +#define ONVIF_CLIENT_H + +#include "onvif.h" +#include "onvif_req.h" +#include "onvif_res.h" + +#ifdef __cplusplus +extern "C" { +#endif + +HT_API void onvif_SetAuthInfo(ONVIF_DEVICE * p_dev, const char * user, const char * pass); +HT_API void onvif_SetAuthMethod(ONVIF_DEVICE * p_dev, onvif_AuthMethod method); +HT_API void onvif_SetReqTimeout(ONVIF_DEVICE * p_dev, int timeout /* millisecond */); +HT_API char * onvif_GetErrString(ONVIF_DEVICE * p_dev); + +// onvif device service interfaces +HT_API BOOL onvif_tds_GetCapabilities(ONVIF_DEVICE * p_dev, tds_GetCapabilities_REQ * p_req, tds_GetCapabilities_RES * p_res); +HT_API BOOL onvif_tds_GetServices(ONVIF_DEVICE * p_dev, tds_GetServices_REQ * p_req, tds_GetServices_RES * p_res); +HT_API BOOL onvif_tds_GetServiceCapabilities(ONVIF_DEVICE * p_dev, tds_GetServiceCapabilities_REQ * p_req, tds_GetServiceCapabilities_RES * p_res); +HT_API BOOL onvif_tds_GetDeviceInformation(ONVIF_DEVICE * p_dev, tds_GetDeviceInformation_REQ * p_req, tds_GetDeviceInformation_RES * p_res); +HT_API BOOL onvif_tds_GetUsers(ONVIF_DEVICE * p_dev, tds_GetUsers_REQ * p_req, tds_GetUsers_RES * p_res); +HT_API BOOL onvif_tds_CreateUsers(ONVIF_DEVICE * p_dev, tds_CreateUsers_REQ * p_req, tds_CreateUsers_RES * p_res); +HT_API BOOL onvif_tds_DeleteUsers(ONVIF_DEVICE * p_dev, tds_DeleteUsers_REQ * p_req, tds_DeleteUsers_RES * p_res); +HT_API BOOL onvif_tds_SetUser(ONVIF_DEVICE * p_dev, tds_SetUser_REQ * p_req, tds_SetUser_RES * p_res); +HT_API BOOL onvif_tds_GetRemoteUser(ONVIF_DEVICE * p_dev, tds_GetRemoteUser_REQ * p_req, tds_GetRemoteUser_RES * p_res); +HT_API BOOL onvif_tds_SetRemoteUser(ONVIF_DEVICE * p_dev, tds_SetRemoteUser_REQ * p_req, tds_SetRemoteUser_RES * p_res); +HT_API BOOL onvif_tds_GetNetworkInterfaces(ONVIF_DEVICE * p_dev, tds_GetNetworkInterfaces_REQ * p_req, tds_GetNetworkInterfaces_RES * p_res); +HT_API BOOL onvif_tds_SetNetworkInterfaces(ONVIF_DEVICE * p_dev, tds_SetNetworkInterfaces_REQ * p_req, tds_SetNetworkInterfaces_RES * p_res); +HT_API BOOL onvif_tds_GetNTP(ONVIF_DEVICE * p_dev, tds_GetNTP_REQ * p_req, tds_GetNTP_RES * p_res); +HT_API BOOL onvif_tds_SetNTP(ONVIF_DEVICE * p_dev, tds_SetNTP_REQ * p_req, tds_SetNTP_RES * p_res); +HT_API BOOL onvif_tds_GetHostname(ONVIF_DEVICE * p_dev, tds_GetHostname_REQ * p_req, tds_GetHostname_RES * p_res); +HT_API BOOL onvif_tds_SetHostname(ONVIF_DEVICE * p_dev, tds_SetHostname_REQ * p_req, tds_SetHostname_RES * p_res); +HT_API BOOL onvif_tds_SetHostnameFromDHCP(ONVIF_DEVICE * p_dev, tds_SetHostnameFromDHCP_REQ * p_req, tds_SetHostnameFromDHCP_RES * p_res); +HT_API BOOL onvif_tds_GetDNS(ONVIF_DEVICE * p_dev, tds_GetDNS_REQ * p_req, tds_GetDNS_RES * p_res); +HT_API BOOL onvif_tds_SetDNS(ONVIF_DEVICE * p_dev, tds_SetDNS_REQ * p_req, tds_SetDNS_RES * p_res); +HT_API BOOL onvif_tds_GetDynamicDNS(ONVIF_DEVICE * p_dev, tds_GetDynamicDNS_REQ * p_req, tds_GetDynamicDNS_RES * p_res); +HT_API BOOL onvif_tds_SetDynamicDNS(ONVIF_DEVICE * p_dev, tds_SetDynamicDNS_REQ * p_req, tds_SetDynamicDNS_RES * p_res); +HT_API BOOL onvif_tds_GetNetworkProtocols(ONVIF_DEVICE * p_dev, tds_GetNetworkProtocols_REQ * p_req, tds_GetNetworkProtocols_RES * p_res); +HT_API BOOL onvif_tds_SetNetworkProtocols(ONVIF_DEVICE * p_dev, tds_SetNetworkProtocols_REQ * p_req, tds_SetNetworkProtocols_RES * p_res); +HT_API BOOL onvif_tds_GetDiscoveryMode(ONVIF_DEVICE * p_dev, tds_GetDiscoveryMode_REQ * p_req, tds_GetDiscoveryMode_RES * p_res); +HT_API BOOL onvif_tds_SetDiscoveryMode(ONVIF_DEVICE * p_dev, tds_SetDiscoveryMode_REQ * p_req, tds_SetDiscoveryMode_RES * p_res); +HT_API BOOL onvif_tds_GetNetworkDefaultGateway(ONVIF_DEVICE * p_dev, tds_GetNetworkDefaultGateway_REQ * p_req, tds_GetNetworkDefaultGateway_RES * p_res); +HT_API BOOL onvif_tds_SetNetworkDefaultGateway(ONVIF_DEVICE * p_dev, tds_SetNetworkDefaultGateway_REQ * p_req, tds_SetNetworkDefaultGateway_RES * p_res); +HT_API BOOL onvif_tds_GetZeroConfiguration(ONVIF_DEVICE * p_dev, tds_GetZeroConfiguration_REQ * p_req, tds_GetZeroConfiguration_RES * p_res); +HT_API BOOL onvif_tds_SetZeroConfiguration(ONVIF_DEVICE * p_dev, tds_SetZeroConfiguration_REQ * p_req, tds_SetZeroConfiguration_RES * p_res); +HT_API BOOL onvif_tds_GetEndpointReference(ONVIF_DEVICE * p_dev, tds_GetEndpointReference_REQ * p_req, tds_GetEndpointReference_RES * p_res); +HT_API BOOL onvif_tds_SendAuxiliaryCommand(ONVIF_DEVICE * p_dev, tds_SendAuxiliaryCommand_REQ * p_req, tds_SendAuxiliaryCommand_RES * p_res); +HT_API BOOL onvif_tds_GetRelayOutputs(ONVIF_DEVICE * p_dev, tds_GetRelayOutputs_REQ * p_req, tds_GetRelayOutputs_RES * p_res); +HT_API BOOL onvif_tds_SetRelayOutputSettings(ONVIF_DEVICE * p_dev, tds_SetRelayOutputSettings_REQ * p_req, tds_SetRelayOutputSettings_RES * p_res); +HT_API BOOL onvif_tds_SetRelayOutputState(ONVIF_DEVICE * p_dev, tds_SetRelayOutputState_REQ * p_req, tds_SetRelayOutputState_RES * p_res); +HT_API BOOL onvif_tds_GetSystemDateAndTime(ONVIF_DEVICE * p_dev, tds_GetSystemDateAndTime_REQ * p_req, tds_GetSystemDateAndTime_RES * p_res); +HT_API BOOL onvif_tds_SetSystemDateAndTime(ONVIF_DEVICE * p_dev, tds_SetSystemDateAndTime_REQ * p_req, tds_SetSystemDateAndTime_RES * p_res); +HT_API BOOL onvif_tds_SystemReboot(ONVIF_DEVICE * p_dev, tds_SystemReboot_REQ * p_req, tds_SystemReboot_RES * p_res); +HT_API BOOL onvif_tds_SetSystemFactoryDefault(ONVIF_DEVICE * p_dev, tds_SetSystemFactoryDefault_REQ * p_req, tds_SetSystemFactoryDefault_RES * p_res); +HT_API BOOL onvif_tds_GetSystemLog(ONVIF_DEVICE * p_dev, tds_GetSystemLog_REQ * p_req, tds_GetSystemLog_RES * p_res); +HT_API BOOL onvif_tds_GetScopes(ONVIF_DEVICE * p_dev, tds_GetScopes_REQ * p_req, tds_GetScopes_RES * p_res); +HT_API BOOL onvif_tds_SetScopes(ONVIF_DEVICE * p_dev, tds_SetScopes_REQ * p_req, tds_SetScopes_RES * p_res); +HT_API BOOL onvif_tds_AddScopes(ONVIF_DEVICE * p_dev, tds_AddScopes_REQ * p_req, tds_AddScopes_RES * p_res); +HT_API BOOL onvif_tds_RemoveScopes(ONVIF_DEVICE * p_dev, tds_RemoveScopes_REQ * p_req, tds_RemoveScopes_RES * p_res); +HT_API BOOL onvif_tds_StartFirmwareUpgrade(ONVIF_DEVICE * p_dev, tds_StartFirmwareUpgrade_REQ * p_req, tds_StartFirmwareUpgrade_RES * p_res); +HT_API BOOL onvif_tds_GetSystemUris(ONVIF_DEVICE * p_dev, tds_GetSystemUris_REQ * p_req, tds_GetSystemUris_RES * p_res); +HT_API BOOL onvif_tds_StartSystemRestore(ONVIF_DEVICE * p_dev, tds_StartSystemRestore_REQ * p_req, tds_StartSystemRestore_RES * p_res); +HT_API BOOL onvif_tds_GetWsdlUrl(ONVIF_DEVICE * p_dev, tds_GetWsdlUrl_REQ * p_req, tds_GetWsdlUrl_RES * p_res); +HT_API BOOL onvif_tds_GetDot11Capabilities(ONVIF_DEVICE * p_dev, tds_GetDot11Capabilities_REQ * p_req, tds_GetDot11Capabilities_RES * p_res); +HT_API BOOL onvif_tds_GetDot11Status(ONVIF_DEVICE * p_dev, tds_GetDot11Status_REQ * p_req, tds_GetDot11Status_RES * p_res); +HT_API BOOL onvif_tds_ScanAvailableDot11Networks(ONVIF_DEVICE * p_dev, tds_ScanAvailableDot11Networks_REQ * p_req, tds_ScanAvailableDot11Networks_RES * p_res); +HT_API BOOL onvif_tds_GetGeoLocation(ONVIF_DEVICE * p_dev, tds_GetGeoLocation_REQ * p_req, tds_GetGeoLocation_RES * p_res); +HT_API BOOL onvif_tds_SetGeoLocation(ONVIF_DEVICE * p_dev, tds_SetGeoLocation_REQ * p_req, tds_SetGeoLocation_RES * p_res); +HT_API BOOL onvif_tds_DeleteGeoLocation(ONVIF_DEVICE * p_dev, tds_DeleteGeoLocation_REQ * p_req, tds_DeleteGeoLocation_RES * p_res); +HT_API BOOL onvif_tds_SetHashingAlgorithm(ONVIF_DEVICE * p_dev, tds_SetHashingAlgorithm_REQ * p_req, tds_SetHashingAlgorithm_RES * p_res); + +// IP address filter interfaces +HT_API BOOL onvif_tds_GetIPAddressFilter(ONVIF_DEVICE * p_dev, tds_GetIPAddressFilter_REQ * p_req, tds_GetIPAddressFilter_RES * p_res); +HT_API BOOL onvif_tds_SetIPAddressFilter(ONVIF_DEVICE * p_dev, tds_SetIPAddressFilter_REQ * p_req, tds_SetIPAddressFilter_RES * p_res); +HT_API BOOL onvif_tds_AddIPAddressFilter(ONVIF_DEVICE * p_dev, tds_AddIPAddressFilter_REQ * p_req, tds_AddIPAddressFilter_RES * p_res); +HT_API BOOL onvif_tds_RemoveIPAddressFilter(ONVIF_DEVICE * p_dev, tds_RemoveIPAddressFilter_REQ * p_req, tds_RemoveIPAddressFilter_RES * p_res); + +// If call succesful, should call free to free p_res->PolicyFile.Data.ptr +HT_API BOOL onvif_tds_GetAccessPolicy(ONVIF_DEVICE * p_dev, tds_GetAccessPolicy_REQ * p_req, tds_GetAccessPolicy_RES * p_res); +HT_API BOOL onvif_tds_SetAccessPolicy(ONVIF_DEVICE * p_dev, tds_SetAccessPolicy_REQ * p_req, tds_SetAccessPolicy_RES * p_res); +HT_API BOOL onvif_tds_GetStorageConfigurations(ONVIF_DEVICE * p_dev, tds_GetStorageConfigurations_REQ * p_req, tds_GetStorageConfigurations_RES * p_res); +HT_API BOOL onvif_tds_CreateStorageConfiguration(ONVIF_DEVICE * p_dev, tds_CreateStorageConfiguration_REQ * p_req, tds_CreateStorageConfiguration_RES * p_res); +HT_API BOOL onvif_tds_GetStorageConfiguration(ONVIF_DEVICE * p_dev, tds_GetStorageConfiguration_REQ * p_req, tds_GetStorageConfiguration_RES * p_res); +HT_API BOOL onvif_tds_SetStorageConfiguration(ONVIF_DEVICE * p_dev, tds_SetStorageConfiguration_REQ * p_req, tds_SetStorageConfiguration_RES * p_res); +HT_API BOOL onvif_tds_DeleteStorageConfiguration(ONVIF_DEVICE * p_dev, tds_DeleteStorageConfiguration_REQ * p_req, tds_DeleteStorageConfiguration_RES * p_res); + +// onvif media service interfaces +HT_API BOOL onvif_trt_GetServiceCapabilities(ONVIF_DEVICE * p_dev, trt_GetServiceCapabilities_REQ * p_req, trt_GetServiceCapabilities_RES * p_res); +HT_API BOOL onvif_trt_GetVideoSources(ONVIF_DEVICE * p_dev, trt_GetVideoSources_REQ * p_req, trt_GetVideoSources_RES * p_res); +HT_API BOOL onvif_trt_GetAudioSources(ONVIF_DEVICE * p_dev, trt_GetAudioSources_REQ * p_req, trt_GetAudioSources_RES * p_res); +HT_API BOOL onvif_trt_CreateProfile(ONVIF_DEVICE * p_dev, trt_CreateProfile_REQ * p_req, trt_CreateProfile_RES * p_res); +HT_API BOOL onvif_trt_GetProfile(ONVIF_DEVICE * p_dev, trt_GetProfile_REQ * p_req, trt_GetProfile_RES * p_res); +HT_API BOOL onvif_trt_GetProfiles(ONVIF_DEVICE * p_dev, trt_GetProfiles_REQ * p_req, trt_GetProfiles_RES * p_res); +HT_API BOOL onvif_trt_AddVideoEncoderConfiguration(ONVIF_DEVICE * p_dev, trt_AddVideoEncoderConfiguration_REQ * p_req, trt_AddVideoEncoderConfiguration_RES * p_res); +HT_API BOOL onvif_trt_AddVideoSourceConfiguration(ONVIF_DEVICE * p_dev, trt_AddVideoSourceConfiguration_REQ * p_req, trt_AddVideoSourceConfiguration_RES * p_res); +HT_API BOOL onvif_trt_AddAudioEncoderConfiguration(ONVIF_DEVICE * p_dev, trt_AddAudioEncoderConfiguration_REQ * p_req, trt_AddAudioEncoderConfiguration_RES * p_res); +HT_API BOOL onvif_trt_AddAudioSourceConfiguration(ONVIF_DEVICE * p_dev, trt_AddAudioSourceConfiguration_REQ * p_req, trt_AddAudioSourceConfiguration_RES * p_res); +HT_API BOOL onvif_trt_GetVideoSourceModes(ONVIF_DEVICE * p_dev, trt_GetVideoSourceModes_REQ * p_req, trt_GetVideoSourceModes_RES * p_res); +HT_API BOOL onvif_trt_SetVideoSourceMode(ONVIF_DEVICE * p_dev, trt_SetVideoSourceMode_REQ * p_req, trt_SetVideoSourceMode_RES * p_res); +HT_API BOOL onvif_trt_AddPTZConfiguration(ONVIF_DEVICE * p_dev, trt_AddPTZConfiguration_REQ * p_req, trt_AddPTZConfiguration_RES * p_res); +HT_API BOOL onvif_trt_RemoveVideoEncoderConfiguration(ONVIF_DEVICE * p_dev, trt_RemoveVideoEncoderConfiguration_REQ * p_req, trt_RemoveVideoEncoderConfiguration_RES * p_res); +HT_API BOOL onvif_trt_RemoveVideoSourceConfiguration(ONVIF_DEVICE * p_dev, trt_RemoveVideoSourceConfiguration_REQ * p_req, trt_RemoveVideoSourceConfiguration_RES * p_res); +HT_API BOOL onvif_trt_RemoveAudioEncoderConfiguration(ONVIF_DEVICE * p_dev, trt_RemoveAudioEncoderConfiguration_REQ * p_req, trt_RemoveAudioEncoderConfiguration_RES * p_res); +HT_API BOOL onvif_trt_RemoveAudioSourceConfiguration(ONVIF_DEVICE * p_dev, trt_RemoveAudioSourceConfiguration_REQ * p_req, trt_RemoveAudioSourceConfiguration_RES * p_res); +HT_API BOOL onvif_trt_RemovePTZConfiguration(ONVIF_DEVICE * p_dev, trt_RemovePTZConfiguration_REQ * p_req, trt_RemovePTZConfiguration_RES * p_res); +HT_API BOOL onvif_trt_DeleteProfile(ONVIF_DEVICE * p_dev, trt_DeleteProfile_REQ * p_req, trt_DeleteProfile_RES * p_res); +HT_API BOOL onvif_trt_GetVideoSourceConfigurations(ONVIF_DEVICE * p_dev, trt_GetVideoSourceConfigurations_REQ * p_req, trt_GetVideoSourceConfigurations_RES * p_res); +HT_API BOOL onvif_trt_GetVideoEncoderConfigurations(ONVIF_DEVICE * p_dev, trt_GetVideoEncoderConfigurations_REQ * p_req, trt_GetVideoEncoderConfigurations_RES * p_res); +HT_API BOOL onvif_trt_GetAudioSourceConfigurations(ONVIF_DEVICE * p_dev, trt_GetAudioSourceConfigurations_REQ * p_req, trt_GetAudioSourceConfigurations_RES * p_res); +HT_API BOOL onvif_trt_GetAudioEncoderConfigurations(ONVIF_DEVICE * p_dev, trt_GetAudioEncoderConfigurations_REQ * p_req, trt_GetAudioEncoderConfigurations_RES * p_res); +HT_API BOOL onvif_trt_GetVideoSourceConfiguration(ONVIF_DEVICE * p_dev, trt_GetVideoSourceConfiguration_REQ * p_req, trt_GetVideoSourceConfiguration_RES * p_res); +HT_API BOOL onvif_trt_GetVideoEncoderConfiguration(ONVIF_DEVICE * p_dev, trt_GetVideoEncoderConfiguration_REQ * p_req, trt_GetVideoEncoderConfiguration_RES * p_res); +HT_API BOOL onvif_trt_GetAudioSourceConfiguration(ONVIF_DEVICE * p_dev, trt_GetAudioSourceConfiguration_REQ * p_req, trt_GetAudioSourceConfiguration_RES * p_res); +HT_API BOOL onvif_trt_GetAudioEncoderConfiguration(ONVIF_DEVICE * p_dev, trt_GetAudioEncoderConfiguration_REQ * p_req, trt_GetAudioEncoderConfiguration_RES * p_res); +HT_API BOOL onvif_trt_SetVideoSourceConfiguration(ONVIF_DEVICE * p_dev, trt_SetVideoSourceConfiguration_REQ * p_req, trt_SetVideoSourceConfiguration_RES * p_res); +HT_API BOOL onvif_trt_SetVideoEncoderConfiguration(ONVIF_DEVICE * p_dev, trt_SetVideoEncoderConfiguration_REQ * p_req, trt_SetVideoEncoderConfiguration_RES * p_res); +HT_API BOOL onvif_trt_SetAudioSourceConfiguration(ONVIF_DEVICE * p_dev, trt_SetAudioSourceConfiguration_REQ * p_req, trt_SetAudioSourceConfiguration_RES * p_res); +HT_API BOOL onvif_trt_SetAudioEncoderConfiguration(ONVIF_DEVICE * p_dev, trt_SetAudioEncoderConfiguration_REQ * p_req, trt_SetAudioEncoderConfiguration_RES * p_res); +HT_API BOOL onvif_trt_GetVideoSourceConfigurationOptions(ONVIF_DEVICE * p_dev, trt_GetVideoSourceConfigurationOptions_REQ * p_req, trt_GetVideoSourceConfigurationOptions_RES * p_res); +HT_API BOOL onvif_trt_GetVideoEncoderConfigurationOptions(ONVIF_DEVICE * p_dev, trt_GetVideoEncoderConfigurationOptions_REQ * p_req, trt_GetVideoEncoderConfigurationOptions_RES * p_res); +HT_API BOOL onvif_trt_GetAudioSourceConfigurationOptions(ONVIF_DEVICE * p_dev, trt_GetAudioSourceConfigurationOptions_REQ * p_req, trt_GetAudioSourceConfigurationOptions_RES * p_res); +HT_API BOOL onvif_trt_GetAudioEncoderConfigurationOptions(ONVIF_DEVICE * p_dev, trt_GetAudioEncoderConfigurationOptions_REQ * p_req, trt_GetAudioEncoderConfigurationOptions_RES * p_res); +HT_API BOOL onvif_trt_GetStreamUri(ONVIF_DEVICE * p_dev, trt_GetStreamUri_REQ * p_req, trt_GetStreamUri_RES * p_res); +HT_API BOOL onvif_trt_SetSynchronizationPoint(ONVIF_DEVICE * p_dev, trt_SetSynchronizationPoint_REQ * p_req, trt_SetSynchronizationPoint_RES * p_res); +HT_API BOOL onvif_trt_GetSnapshotUri(ONVIF_DEVICE * p_dev, trt_GetSnapshotUri_REQ * p_req, trt_GetSnapshotUri_RES * p_res); +HT_API BOOL onvif_trt_GetGuaranteedNumberOfVideoEncoderInstances(ONVIF_DEVICE * p_dev, trt_GetGuaranteedNumberOfVideoEncoderInstances_REQ * p_req, trt_GetGuaranteedNumberOfVideoEncoderInstances_RES * p_res); +HT_API BOOL onvif_trt_GetAudioOutputs(ONVIF_DEVICE * p_dev, trt_GetAudioOutputs_REQ * p_req, trt_GetAudioOutputs_RES * p_res); +HT_API BOOL onvif_trt_GetAudioOutputConfigurations(ONVIF_DEVICE * p_dev, trt_GetAudioOutputConfigurations_REQ * p_req, trt_GetAudioOutputConfigurations_RES * p_res); +HT_API BOOL onvif_trt_GetAudioOutputConfiguration(ONVIF_DEVICE * p_dev, trt_GetAudioOutputConfiguration_REQ * p_req, trt_GetAudioOutputConfiguration_RES * p_res); +HT_API BOOL onvif_trt_GetAudioOutputConfigurationOptions(ONVIF_DEVICE * p_dev, trt_GetAudioOutputConfigurationOptions_REQ * p_req, trt_GetAudioOutputConfigurationOptions_RES * p_res); +HT_API BOOL onvif_trt_SetAudioOutputConfiguration(ONVIF_DEVICE * p_dev, trt_SetAudioOutputConfiguration_REQ * p_req, trt_SetAudioOutputConfiguration_RES * p_res); +HT_API BOOL onvif_trt_GetAudioDecoderConfigurations(ONVIF_DEVICE * p_dev, trt_GetAudioDecoderConfigurations_REQ * p_req, trt_GetAudioDecoderConfigurations_RES * p_res); +HT_API BOOL onvif_trt_GetAudioDecoderConfiguration(ONVIF_DEVICE * p_dev, trt_GetAudioDecoderConfiguration_REQ * p_req, trt_GetAudioDecoderConfiguration_RES * p_res); +HT_API BOOL onvif_trt_GetAudioDecoderConfigurationOptions(ONVIF_DEVICE * p_dev, trt_GetAudioDecoderConfigurationOptions_REQ * p_req, trt_GetAudioDecoderConfigurationOptions_RES * p_res); +HT_API BOOL onvif_trt_SetAudioDecoderConfiguration(ONVIF_DEVICE * p_dev, trt_SetAudioDecoderConfiguration_REQ * p_req, trt_SetAudioDecoderConfiguration_RES * p_res); +HT_API BOOL onvif_trt_AddAudioOutputConfiguration(ONVIF_DEVICE * p_dev, trt_AddAudioOutputConfiguration_REQ * p_req, trt_AddAudioOutputConfiguration_RES * p_res); +HT_API BOOL onvif_trt_AddAudioDecoderConfiguration(ONVIF_DEVICE * p_dev, trt_AddAudioDecoderConfiguration_REQ * p_req, trt_AddAudioDecoderConfiguration_RES * p_res); +HT_API BOOL onvif_trt_RemoveAudioOutputConfiguration(ONVIF_DEVICE * p_dev, trt_RemoveAudioOutputConfiguration_REQ * p_req, trt_RemoveAudioOutputConfiguration_RES * p_res); +HT_API BOOL onvif_trt_RemoveAudioDecoderConfiguration(ONVIF_DEVICE * p_dev, trt_RemoveAudioDecoderConfiguration_REQ * p_req, trt_RemoveAudioDecoderConfiguration_RES * p_res); +HT_API BOOL onvif_trt_GetOSDs(ONVIF_DEVICE * p_dev, trt_GetOSDs_REQ * p_req, trt_GetOSDs_RES * p_res); +HT_API BOOL onvif_trt_GetOSD(ONVIF_DEVICE * p_dev, trt_GetOSD_REQ * p_req, trt_GetOSD_RES * p_res); +HT_API BOOL onvif_trt_SetOSD(ONVIF_DEVICE * p_dev, trt_SetOSD_REQ * p_req, trt_SetOSD_RES * p_res); +HT_API BOOL onvif_trt_GetOSDOptions(ONVIF_DEVICE * p_dev, trt_GetOSDOptions_REQ * p_req, trt_GetOSDOptions_RES * p_res); +HT_API BOOL onvif_trt_CreateOSD(ONVIF_DEVICE * p_dev, trt_CreateOSD_REQ * p_req, trt_CreateOSD_RES * p_res); +HT_API BOOL onvif_trt_DeleteOSD(ONVIF_DEVICE * p_dev, trt_DeleteOSD_REQ * p_req, trt_DeleteOSD_RES * p_res); +HT_API BOOL onvif_trt_GetVideoAnalyticsConfigurations(ONVIF_DEVICE * p_dev, trt_GetVideoAnalyticsConfigurations_REQ * p_req, trt_GetVideoAnalyticsConfigurations_RES * p_res); +HT_API BOOL onvif_trt_AddVideoAnalyticsConfiguration(ONVIF_DEVICE * p_dev, trt_AddVideoAnalyticsConfiguration_REQ * p_req, trt_AddVideoAnalyticsConfiguration_RES * p_res); +HT_API BOOL onvif_trt_GetVideoAnalyticsConfiguration(ONVIF_DEVICE * p_dev, trt_GetVideoAnalyticsConfiguration_REQ * p_req, trt_GetVideoAnalyticsConfiguration_RES * p_res); +HT_API BOOL onvif_trt_RemoveVideoAnalyticsConfiguration(ONVIF_DEVICE * p_dev, trt_RemoveVideoAnalyticsConfiguration_REQ * p_req, trt_RemoveVideoAnalyticsConfiguration_RES * p_res); +HT_API BOOL onvif_trt_SetVideoAnalyticsConfiguration(ONVIF_DEVICE * p_dev, trt_SetVideoAnalyticsConfiguration_REQ * p_req, trt_SetVideoAnalyticsConfiguration_RES * p_res); +HT_API BOOL onvif_trt_GetMetadataConfigurations(ONVIF_DEVICE * p_dev, trt_GetMetadataConfigurations_REQ * p_req, trt_GetMetadataConfigurations_RES * p_res); +HT_API BOOL onvif_trt_AddMetadataConfiguration(ONVIF_DEVICE * p_dev, trt_AddMetadataConfiguration_REQ * p_req, trt_AddMetadataConfiguration_RES * p_res); +HT_API BOOL onvif_trt_GetMetadataConfiguration(ONVIF_DEVICE * p_dev, trt_GetMetadataConfiguration_REQ * p_req, trt_GetMetadataConfiguration_RES * p_res); +HT_API BOOL onvif_trt_RemoveMetadataConfiguration(ONVIF_DEVICE * p_dev, trt_RemoveMetadataConfiguration_REQ * p_req, trt_RemoveMetadataConfiguration_RES * p_res); +HT_API BOOL onvif_trt_SetMetadataConfiguration(ONVIF_DEVICE * p_dev, trt_SetMetadataConfiguration_REQ * p_req, trt_SetMetadataConfiguration_RES * p_res); +HT_API BOOL onvif_trt_GetMetadataConfigurationOptions(ONVIF_DEVICE * p_dev, trt_GetMetadataConfigurationOptions_REQ * p_req, trt_GetMetadataConfigurationOptions_RES * p_res); +HT_API BOOL onvif_trt_GetCompatibleVideoEncoderConfigurations(ONVIF_DEVICE * p_dev, trt_GetCompatibleVideoEncoderConfigurations_REQ * p_req, trt_GetCompatibleVideoEncoderConfigurations_RES * p_res); +HT_API BOOL onvif_trt_GetCompatibleAudioEncoderConfigurations(ONVIF_DEVICE * p_dev, trt_GetCompatibleAudioEncoderConfigurations_REQ * p_req, trt_GetCompatibleAudioEncoderConfigurations_RES * p_res); +HT_API BOOL onvif_trt_GetCompatibleVideoAnalyticsConfigurations(ONVIF_DEVICE * p_dev, trt_GetCompatibleVideoAnalyticsConfigurations_REQ * p_req, trt_GetCompatibleVideoAnalyticsConfigurations_RES * p_res); +HT_API BOOL onvif_trt_GetCompatibleMetadataConfigurations(ONVIF_DEVICE * p_dev, trt_GetCompatibleMetadataConfigurations_REQ * p_req, trt_GetCompatibleMetadataConfigurations_RES * p_res); + +// onvif ptz service interfaces +HT_API BOOL onvif_ptz_GetServiceCapabilities(ONVIF_DEVICE * p_dev, ptz_GetServiceCapabilities_REQ * p_req, ptz_GetServiceCapabilities_RES * p_res); +HT_API BOOL onvif_ptz_GetNodes(ONVIF_DEVICE * p_dev, ptz_GetNodes_REQ * p_req, ptz_GetNodes_RES * p_res); +HT_API BOOL onvif_ptz_GetNode(ONVIF_DEVICE * p_dev, ptz_GetNode_REQ * p_req, ptz_GetNode_RES * p_res); +HT_API BOOL onvif_ptz_GetPresets(ONVIF_DEVICE * p_dev, ptz_GetPresets_REQ * p_req, ptz_GetPresets_RES * p_res); +HT_API BOOL onvif_ptz_SetPreset(ONVIF_DEVICE * p_dev, ptz_SetPreset_REQ * p_req, ptz_SetPreset_RES * p_res); +HT_API BOOL onvif_ptz_RemovePreset(ONVIF_DEVICE * p_dev, ptz_RemovePreset_REQ * p_req, ptz_RemovePreset_RES * p_res); +HT_API BOOL onvif_ptz_GotoPreset(ONVIF_DEVICE * p_dev, ptz_GotoPreset_REQ * p_req, ptz_GotoPreset_RES * p_res); +HT_API BOOL onvif_ptz_GotoHomePosition(ONVIF_DEVICE * p_dev, ptz_GotoHomePosition_REQ * p_req, ptz_GotoHomePosition_RES * p_res); +HT_API BOOL onvif_ptz_SetHomePosition(ONVIF_DEVICE * p_dev, ptz_SetHomePosition_REQ * p_req, ptz_SetHomePosition_RES * p_res); +HT_API BOOL onvif_ptz_GetStatus(ONVIF_DEVICE * p_dev, ptz_GetStatus_REQ * p_req, ptz_GetStatus_RES * p_res); +HT_API BOOL onvif_ptz_ContinuousMove(ONVIF_DEVICE * p_dev, ptz_ContinuousMove_REQ * p_req, ptz_ContinuousMove_RES * p_res); +HT_API BOOL onvif_ptz_RelativeMove(ONVIF_DEVICE * p_dev, ptz_RelativeMove_REQ * p_req, ptz_RelativeMove_RES * p_res); +HT_API BOOL onvif_ptz_AbsoluteMove(ONVIF_DEVICE * p_dev, ptz_AbsoluteMove_REQ * p_req, ptz_AbsoluteMove_RES * p_res); +HT_API BOOL onvif_ptz_Stop(ONVIF_DEVICE * p_dev, ptz_Stop_REQ * p_req, ptz_Stop_RES * p_res); +HT_API BOOL onvif_ptz_GetConfigurations(ONVIF_DEVICE * p_dev, ptz_GetConfigurations_REQ * p_req, ptz_GetConfigurations_RES * p_res); +HT_API BOOL onvif_ptz_GetConfiguration(ONVIF_DEVICE * p_dev, ptz_GetConfiguration_REQ * p_req, ptz_GetConfiguration_RES * p_res); +HT_API BOOL onvif_ptz_SetConfiguration(ONVIF_DEVICE * p_dev, ptz_SetConfiguration_REQ * p_req, ptz_SetConfiguration_RES * p_res); +HT_API BOOL onvif_ptz_GetConfigurationOptions(ONVIF_DEVICE * p_dev, ptz_GetConfigurationOptions_REQ * p_req, ptz_GetConfigurationOptions_RES * p_res); +HT_API BOOL onvif_ptz_GetPresetTours(ONVIF_DEVICE * p_dev, ptz_GetPresetTours_REQ * p_req, ptz_GetPresetTours_RES * p_res); +HT_API BOOL onvif_ptz_GetPresetTour(ONVIF_DEVICE * p_dev, ptz_GetPresetTour_REQ * p_req, ptz_GetPresetTour_RES * p_res); +HT_API BOOL onvif_ptz_GetPresetTourOptions(ONVIF_DEVICE * p_dev, ptz_GetPresetTourOptions_REQ * p_req, ptz_GetPresetTourOptions_RES * p_res); +HT_API BOOL onvif_ptz_CreatePresetTour(ONVIF_DEVICE * p_dev, ptz_CreatePresetTour_REQ * p_req, ptz_CreatePresetTour_RES * p_res); +HT_API BOOL onvif_ptz_ModifyPresetTour(ONVIF_DEVICE * p_dev, ptz_ModifyPresetTour_REQ * p_req, ptz_ModifyPresetTour_RES * p_res); +HT_API BOOL onvif_ptz_OperatePresetTour(ONVIF_DEVICE * p_dev, ptz_OperatePresetTour_REQ * p_req, ptz_OperatePresetTour_RES * p_res); +HT_API BOOL onvif_ptz_RemovePresetTour(ONVIF_DEVICE * p_dev, ptz_RemovePresetTour_REQ * p_req, ptz_RemovePresetTour_RES * p_res); +HT_API BOOL onvif_ptz_SendAuxiliaryCommand(ONVIF_DEVICE * p_dev, ptz_SendAuxiliaryCommand_REQ * p_req, ptz_SendAuxiliaryCommand_RES * p_res); +HT_API BOOL onvif_ptz_GeoMove(ONVIF_DEVICE * p_dev, ptz_GeoMove_REQ * p_req, ptz_GeoMove_RES * p_res); + +// onvif event service interfaces +HT_API BOOL onvif_tev_GetServiceCapabilities(ONVIF_DEVICE * p_dev, tev_GetServiceCapabilities_REQ * p_req, tev_GetServiceCapabilities_RES * p_res); +HT_API BOOL onvif_tev_GetEventProperties(ONVIF_DEVICE * p_dev, tev_GetEventProperties_REQ * p_req, tev_GetEventProperties_RES * p_res); +HT_API BOOL onvif_tev_Renew(ONVIF_DEVICE * p_dev, tev_Renew_REQ * p_req, tev_Renew_RES * p_res); +HT_API BOOL onvif_tev_Unsubscribe(ONVIF_DEVICE * p_dev, tev_Unsubscribe_REQ * p_req, tev_Unsubscribe_RES * p_res); +HT_API BOOL onvif_tev_Subscribe(ONVIF_DEVICE * p_dev, tev_Subscribe_REQ * p_req, tev_Subscribe_RES * p_res); +HT_API BOOL onvif_tev_PauseSubscription(ONVIF_DEVICE * p_dev, tev_PauseSubscription_REQ * p_req, tev_PauseSubscription_RES * p_res); +HT_API BOOL onvif_tev_ResumeSubscription(ONVIF_DEVICE * p_dev, tev_ResumeSubscription_REQ * p_req, tev_ResumeSubscription_RES * p_res); +HT_API BOOL onvif_tev_CreatePullPointSubscription(ONVIF_DEVICE * p_dev, tev_CreatePullPointSubscription_REQ * p_req, tev_CreatePullPointSubscription_RES * p_res); +HT_API BOOL onvif_tev_DestroyPullPoint(ONVIF_DEVICE * p_dev, tev_DestroyPullPoint_REQ * p_req, tev_DestroyPullPoint_RES * p_res); +HT_API BOOL onvif_tev_PullMessages(ONVIF_DEVICE * p_dev, tev_PullMessages_REQ * p_req, tev_PullMessages_RES * p_res); +HT_API BOOL onvif_tev_GetMessages(ONVIF_DEVICE * p_dev, tev_GetMessages_REQ * p_req, tev_GetMessages_RES * p_res); +HT_API BOOL onvif_tev_Seek(ONVIF_DEVICE * p_dev, tev_Seek_REQ * p_req, tev_Seek_RES * p_res); +HT_API BOOL onvif_tev_SetSynchronizationPoint(ONVIF_DEVICE * p_dev, tev_SetSynchronizationPoint_REQ * p_req, tev_SetSynchronizationPoint_RES * p_res); + +// onvif imaging service interfaces +HT_API BOOL onvif_img_GetServiceCapabilities(ONVIF_DEVICE * p_dev, img_GetServiceCapabilities_REQ * p_req, img_GetServiceCapabilities_RES * p_res); +HT_API BOOL onvif_img_GetImagingSettings(ONVIF_DEVICE * p_dev, img_GetImagingSettings_REQ * p_req, img_GetImagingSettings_RES * p_res); +HT_API BOOL onvif_img_SetImagingSettings(ONVIF_DEVICE * p_dev, img_SetImagingSettings_REQ * p_req, img_SetImagingSettings_RES * p_res); +HT_API BOOL onvif_img_GetOptions(ONVIF_DEVICE * p_dev, img_GetOptions_REQ * p_req, img_GetOptions_RES * p_res); +HT_API BOOL onvif_img_Move(ONVIF_DEVICE * p_dev, img_Move_REQ * p_req, img_Move_RES * p_res); +HT_API BOOL onvif_img_Stop(ONVIF_DEVICE * p_dev, img_Stop_REQ * p_req, img_Stop_RES * p_res); +HT_API BOOL onvif_img_GetStatus(ONVIF_DEVICE * p_dev, img_GetStatus_REQ * p_req, img_GetStatus_RES * p_res); +HT_API BOOL onvif_img_GetMoveOptions(ONVIF_DEVICE * p_dev, img_GetMoveOptions_REQ * p_req, img_GetMoveOptions_RES * p_res); +HT_API BOOL onvif_img_GetPresets(ONVIF_DEVICE * p_dev, img_GetPresets_REQ * p_req, img_GetPresets_RES * p_res); +HT_API BOOL onvif_img_GetCurrentPreset(ONVIF_DEVICE * p_dev, img_GetCurrentPreset_REQ * p_req, img_GetCurrentPreset_RES * p_res); +HT_API BOOL onvif_img_SetCurrentPreset(ONVIF_DEVICE * p_dev, img_SetCurrentPreset_REQ * p_req, img_SetCurrentPreset_RES * p_res); + +// onvif device IO service interfaces +HT_API BOOL onvif_tmd_GetServiceCapabilities(ONVIF_DEVICE * p_dev, tmd_GetServiceCapabilities_REQ * p_req, tmd_GetServiceCapabilities_RES * p_res); +HT_API BOOL onvif_tmd_GetRelayOutputs(ONVIF_DEVICE * p_dev, tmd_GetRelayOutputs_REQ * p_req, tmd_GetRelayOutputs_RES * p_res); +HT_API BOOL onvif_tmd_GetRelayOutputOptions(ONVIF_DEVICE * p_dev, tmd_GetRelayOutputOptions_REQ * p_req, tmd_GetRelayOutputOptions_RES * p_res); +HT_API BOOL onvif_tmd_SetRelayOutputSettings(ONVIF_DEVICE * p_dev, tmd_SetRelayOutputSettings_REQ * p_req, tmd_SetRelayOutputSettings_RES * p_res); +HT_API BOOL onvif_tmd_SetRelayOutputState(ONVIF_DEVICE * p_dev, tmd_SetRelayOutputState_REQ * p_req, tmd_SetRelayOutputState_RES * p_res); +HT_API BOOL onvif_tmd_GetDigitalInputs(ONVIF_DEVICE * p_dev, tmd_GetDigitalInputs_REQ * p_req, tmd_GetDigitalInputs_RES * p_res); +HT_API BOOL onvif_tmd_GetDigitalInputConfigurationOptions(ONVIF_DEVICE * p_dev, tmd_GetDigitalInputConfigurationOptions_REQ * p_req, tmd_GetDigitalInputConfigurationOptions_RES * p_res); +HT_API BOOL onvif_tmd_SetDigitalInputConfigurations(ONVIF_DEVICE * p_dev, tmd_SetDigitalInputConfigurations_REQ * p_req, tmd_SetDigitalInputConfigurations_RES * p_res); + +// onvif recording service interfaces +HT_API BOOL onvif_trc_GetServiceCapabilities(ONVIF_DEVICE * p_dev, trc_GetServiceCapabilities_REQ * p_req, trc_GetServiceCapabilities_RES * p_res); +HT_API BOOL onvif_trc_CreateRecording(ONVIF_DEVICE * p_dev, trc_CreateRecording_REQ * p_req, trc_CreateRecording_RES * p_res); +HT_API BOOL onvif_trc_DeleteRecording(ONVIF_DEVICE * p_dev, trc_DeleteRecording_REQ * p_req, trc_DeleteRecording_RES * p_res); +HT_API BOOL onvif_trc_GetRecordings(ONVIF_DEVICE * p_dev, trc_GetRecordings_REQ * p_req, trc_GetRecordings_RES * p_res); +HT_API BOOL onvif_trc_SetRecordingConfiguration(ONVIF_DEVICE * p_dev, trc_SetRecordingConfiguration_REQ * p_req, trc_SetRecordingConfiguration_RES * p_res); +HT_API BOOL onvif_trc_GetRecordingConfiguration(ONVIF_DEVICE * p_dev, trc_GetRecordingConfiguration_REQ * p_req, trc_GetRecordingConfiguration_RES * p_res); +HT_API BOOL onvif_trc_GetRecordingOptions(ONVIF_DEVICE * p_dev, trc_GetRecordingOptions_REQ * p_req, trc_GetRecordingOptions_RES * p_res); +HT_API BOOL onvif_trc_CreateTrack(ONVIF_DEVICE * p_dev, trc_CreateTrack_REQ * p_req, trc_CreateTrack_RES * p_res); +HT_API BOOL onvif_trc_DeleteTrack(ONVIF_DEVICE * p_dev, trc_DeleteTrack_REQ * p_req, trc_DeleteTrack_RES * p_res); +HT_API BOOL onvif_trc_GetTrackConfiguration(ONVIF_DEVICE * p_dev, trc_GetTrackConfiguration_REQ * p_req, trc_GetTrackConfiguration_RES * p_res); +HT_API BOOL onvif_trc_SetTrackConfiguration(ONVIF_DEVICE * p_dev, trc_SetTrackConfiguration_REQ * p_req, trc_SetTrackConfiguration_RES * p_res); +HT_API BOOL onvif_trc_CreateRecordingJob(ONVIF_DEVICE * p_dev, trc_CreateRecordingJob_REQ * p_req, trc_CreateRecordingJob_RES * p_res); +HT_API BOOL onvif_trc_DeleteRecordingJob(ONVIF_DEVICE * p_dev, trc_DeleteRecordingJob_REQ * p_req, trc_DeleteRecordingJob_RES * p_res); +HT_API BOOL onvif_trc_GetRecordingJobs(ONVIF_DEVICE * p_dev, trc_GetRecordingJobs_REQ * p_req, trc_GetRecordingJobs_RES * p_res); +HT_API BOOL onvif_trc_SetRecordingJobConfiguration(ONVIF_DEVICE * p_dev, trc_SetRecordingJobConfiguration_REQ * p_req, trc_SetRecordingJobConfiguration_RES * p_res); +HT_API BOOL onvif_trc_GetRecordingJobConfiguration(ONVIF_DEVICE * p_dev, trc_GetRecordingJobConfiguration_REQ * p_req, trc_GetRecordingJobConfiguration_RES * p_res); +HT_API BOOL onvif_trc_SetRecordingJobMode(ONVIF_DEVICE * p_dev, trc_SetRecordingJobMode_REQ * p_req, trc_SetRecordingJobMode_RES * p_res); +HT_API BOOL onvif_trc_GetRecordingJobState(ONVIF_DEVICE * p_dev, trc_GetRecordingJobState_REQ * p_req, trc_GetRecordingJobState_RES * p_res); +HT_API BOOL onvif_trc_ExportRecordedData(ONVIF_DEVICE * p_dev, trc_ExportRecordedData_REQ * p_req, trc_ExportRecordedData_RES * p_res); +HT_API BOOL onvif_trc_StopExportRecordedData(ONVIF_DEVICE * p_dev, trc_StopExportRecordedData_REQ * p_req, trc_StopExportRecordedData_RES * p_res); +HT_API BOOL onvif_trc_GetExportRecordedDataState(ONVIF_DEVICE * p_dev, trc_GetExportRecordedDataState_REQ * p_req, trc_GetExportRecordedDataState_RES * p_res); + +// onvif replay service interfaces +HT_API BOOL onvif_trp_GetServiceCapabilities(ONVIF_DEVICE * p_dev, trp_GetServiceCapabilities_REQ * p_req, trp_GetServiceCapabilities_RES * p_res); +HT_API BOOL onvif_trp_GetReplayUri(ONVIF_DEVICE * p_dev, trp_GetReplayUri_REQ * p_req, trp_GetReplayUri_RES * p_res); +HT_API BOOL onvif_trp_GetReplayConfiguration(ONVIF_DEVICE * p_dev, trp_GetReplayConfiguration_REQ * p_req, trp_GetReplayConfiguration_RES * p_res); +HT_API BOOL onvif_trp_SetReplayConfiguration(ONVIF_DEVICE * p_dev, trp_SetReplayConfiguration_REQ * p_req, trp_SetReplayConfiguration_RES * p_res); + +// onvif search service interfaces +HT_API BOOL onvif_tse_GetServiceCapabilities(ONVIF_DEVICE * p_dev, tse_GetServiceCapabilities_REQ * p_req, tse_GetServiceCapabilities_RES * p_res); +HT_API BOOL onvif_tse_GetRecordingSummary(ONVIF_DEVICE * p_dev, tse_GetRecordingSummary_REQ * p_req, tse_GetRecordingSummary_RES * p_res); +HT_API BOOL onvif_tse_GetRecordingInformation(ONVIF_DEVICE * p_dev, tse_GetRecordingInformation_REQ * p_req, tse_GetRecordingInformation_RES * p_res); +HT_API BOOL onvif_tse_GetMediaAttributes(ONVIF_DEVICE * p_dev, tse_GetMediaAttributes_REQ * p_req, tse_GetMediaAttributes_RES * p_res); +HT_API BOOL onvif_tse_FindRecordings(ONVIF_DEVICE * p_dev, tse_FindRecordings_REQ * p_req, tse_FindRecordings_RES * p_res); +HT_API BOOL onvif_tse_GetRecordingSearchResults(ONVIF_DEVICE * p_dev, tse_GetRecordingSearchResults_REQ * p_req, tse_GetRecordingSearchResults_RES * p_res); +HT_API BOOL onvif_tse_FindEvents(ONVIF_DEVICE * p_dev, tse_FindEvents_REQ * p_req, tse_FindEvents_RES * p_res); +HT_API BOOL onvif_tse_GetEventSearchResults(ONVIF_DEVICE * p_dev, tse_GetEventSearchResults_REQ * p_req, tse_GetEventSearchResults_RES * p_res); +HT_API BOOL onvif_tse_FindMetadata(ONVIF_DEVICE * p_dev, tse_FindMetadata_REQ * p_req, tse_FindMetadata_RES * p_res); +HT_API BOOL onvif_tse_GetMetadataSearchResults(ONVIF_DEVICE * p_dev, tse_GetMetadataSearchResults_REQ * p_req, tse_GetMetadataSearchResults_RES * p_res); +HT_API BOOL onvif_tse_FindPTZPosition(ONVIF_DEVICE * p_dev, tse_FindPTZPosition_REQ * p_req, tse_FindPTZPosition_RES * p_res); +HT_API BOOL onvif_tse_GetPTZPositionSearchResults(ONVIF_DEVICE * p_dev, tse_GetPTZPositionSearchResults_REQ * p_req, tse_GetPTZPositionSearchResults_RES * p_res); +HT_API BOOL onvif_tse_GetSearchState(ONVIF_DEVICE * p_dev, tse_GetSearchState_REQ * p_req, tse_GetSearchState_RES * p_res); +HT_API BOOL onvif_tse_EndSearch(ONVIF_DEVICE * p_dev, tse_EndSearch_REQ * p_req, tse_EndSearch_RES * p_res); + +// onvif analytics service interfaces +HT_API BOOL onvif_tan_GetServiceCapabilities(ONVIF_DEVICE * p_dev, tan_GetServiceCapabilities_REQ * p_req, tan_GetServiceCapabilities_RES * p_res); +HT_API BOOL onvif_tan_GetSupportedRules(ONVIF_DEVICE * p_dev, tan_GetSupportedRules_REQ * p_req, tan_GetSupportedRules_RES * p_res); +HT_API BOOL onvif_tan_CreateRules(ONVIF_DEVICE * p_dev, tan_CreateRules_REQ * p_req, tan_CreateRules_RES * p_res); +HT_API BOOL onvif_tan_DeleteRules(ONVIF_DEVICE * p_dev, tan_DeleteRules_REQ * p_req, tan_DeleteRules_RES * p_res); +HT_API BOOL onvif_tan_GetRules(ONVIF_DEVICE * p_dev, tan_GetRules_REQ * p_req, tan_GetRules_RES * p_res); +HT_API BOOL onvif_tan_ModifyRules(ONVIF_DEVICE * p_dev, tan_ModifyRules_REQ * p_req, tan_ModifyRules_RES * p_res); +HT_API BOOL onvif_tan_CreateAnalyticsModules(ONVIF_DEVICE * p_dev, tan_CreateAnalyticsModules_REQ * p_req, tan_CreateAnalyticsModules_RES * p_res); +HT_API BOOL onvif_tan_DeleteAnalyticsModules(ONVIF_DEVICE * p_dev, tan_DeleteAnalyticsModules_REQ * p_req, tan_DeleteAnalyticsModules_RES * p_res); +HT_API BOOL onvif_tan_GetAnalyticsModules(ONVIF_DEVICE * p_dev, tan_GetAnalyticsModules_REQ * p_req, tan_GetAnalyticsModules_RES * p_res); +HT_API BOOL onvif_tan_ModifyAnalyticsModules(ONVIF_DEVICE * p_dev, tan_ModifyAnalyticsModules_REQ * p_req, tan_ModifyAnalyticsModules_RES * p_res); +HT_API BOOL onvif_tan_GetSupportedAnalyticsModules(ONVIF_DEVICE * p_dev, tan_GetSupportedAnalyticsModules_REQ * p_req, tan_GetSupportedAnalyticsModules_RES * p_res); +HT_API BOOL onvif_tan_GetRuleOptions(ONVIF_DEVICE * p_dev, tan_GetRuleOptions_REQ * p_req, tan_GetRuleOptions_RES * p_res); +HT_API BOOL onvif_tan_GetAnalyticsModuleOptions(ONVIF_DEVICE * p_dev, tan_GetAnalyticsModuleOptions_REQ * p_req, tan_GetAnalyticsModuleOptions_RES * p_res); +HT_API BOOL onvif_tan_GetSupportedMetadata(ONVIF_DEVICE * p_dev, tan_GetSupportedMetadata_REQ * p_req, tan_GetSupportedMetadata_RES * p_res); + +// onvif media 2 service interfaces +HT_API BOOL onvif_tr2_GetServiceCapabilities(ONVIF_DEVICE * p_dev, tr2_GetServiceCapabilities_REQ * p_req, tr2_GetServiceCapabilities_RES * p_res); +HT_API BOOL onvif_tr2_GetVideoEncoderConfigurations(ONVIF_DEVICE * p_dev, tr2_GetVideoEncoderConfigurations_REQ * p_req, tr2_GetVideoEncoderConfigurations_RES * p_res); +HT_API BOOL onvif_tr2_SetVideoEncoderConfiguration(ONVIF_DEVICE * p_dev, tr2_SetVideoEncoderConfiguration_REQ * p_req, tr2_SetVideoEncoderConfiguration_RES * p_res); +HT_API BOOL onvif_tr2_GetVideoEncoderConfigurationOptions(ONVIF_DEVICE * p_dev, tr2_GetVideoEncoderConfigurationOptions_REQ * p_req, tr2_GetVideoEncoderConfigurationOptions_RES * p_res); +HT_API BOOL onvif_tr2_GetProfiles(ONVIF_DEVICE * p_dev, tr2_GetProfiles_REQ * p_req, tr2_GetProfiles_RES * p_res); +HT_API BOOL onvif_tr2_CreateProfile(ONVIF_DEVICE * p_dev, tr2_CreateProfile_REQ * p_req, tr2_CreateProfile_RES * p_res); +HT_API BOOL onvif_tr2_DeleteProfile(ONVIF_DEVICE * p_dev, tr2_DeleteProfile_REQ * p_req, tr2_DeleteProfile_RES * p_res); +HT_API BOOL onvif_tr2_GetStreamUri(ONVIF_DEVICE * p_dev, tr2_GetStreamUri_REQ * p_req, tr2_GetStreamUri_RES * p_res); +HT_API BOOL onvif_tr2_GetVideoSourceConfigurations(ONVIF_DEVICE * p_dev, tr2_GetVideoSourceConfigurations_REQ * p_req, tr2_GetVideoSourceConfigurations_RES * p_res); +HT_API BOOL onvif_tr2_GetVideoSourceConfigurationOptions(ONVIF_DEVICE * p_dev, tr2_GetVideoSourceConfigurationOptions_REQ * p_req, tr2_GetVideoSourceConfigurationOptions_RES * p_res); +HT_API BOOL onvif_tr2_SetVideoSourceConfiguration(ONVIF_DEVICE * p_dev, tr2_SetVideoSourceConfiguration_REQ * p_req, tr2_SetVideoSourceConfiguration_RES * p_res); +HT_API BOOL onvif_tr2_SetSynchronizationPoint(ONVIF_DEVICE * p_dev, tr2_SetSynchronizationPoint_REQ * p_req, tr2_SetSynchronizationPoint_RES * p_res); +HT_API BOOL onvif_tr2_GetMetadataConfigurations(ONVIF_DEVICE * p_dev, tr2_GetMetadataConfigurations_REQ * p_req, tr2_GetMetadataConfigurations_RES * p_res); +HT_API BOOL onvif_tr2_GetMetadataConfigurationOptions(ONVIF_DEVICE * p_dev, tr2_GetMetadataConfigurationOptions_REQ * p_req, tr2_GetMetadataConfigurationOptions_RES * p_res); +HT_API BOOL onvif_tr2_SetMetadataConfiguration(ONVIF_DEVICE * p_dev, tr2_SetMetadataConfiguration_REQ * p_req, tr2_SetMetadataConfiguration_RES * p_res); +HT_API BOOL onvif_tr2_GetAudioEncoderConfigurations(ONVIF_DEVICE * p_dev, tr2_GetAudioEncoderConfigurations_REQ * p_req, tr2_GetAudioEncoderConfigurations_RES * p_res); +HT_API BOOL onvif_tr2_GetAudioSourceConfigurations(ONVIF_DEVICE * p_dev, tr2_GetAudioSourceConfigurations_REQ * p_req, tr2_GetAudioSourceConfigurations_RES * p_res); +HT_API BOOL onvif_tr2_GetAudioSourceConfigurationOptions(ONVIF_DEVICE * p_dev, tr2_GetAudioSourceConfigurationOptions_REQ * p_req, tr2_GetAudioSourceConfigurationOptions_RES * p_res); +HT_API BOOL onvif_tr2_SetAudioSourceConfiguration(ONVIF_DEVICE * p_dev, tr2_SetAudioSourceConfiguration_REQ * p_req, tr2_SetAudioSourceConfiguration_RES * p_res); +HT_API BOOL onvif_tr2_SetAudioEncoderConfiguration(ONVIF_DEVICE * p_dev, tr2_SetAudioEncoderConfiguration_REQ * p_req, tr2_SetAudioEncoderConfiguration_RES * p_res); +HT_API BOOL onvif_tr2_GetAudioEncoderConfigurationOptions(ONVIF_DEVICE * p_dev, tr2_GetAudioEncoderConfigurationOptions_REQ * p_req, tr2_GetAudioEncoderConfigurationOptions_RES * p_res); +HT_API BOOL onvif_tr2_AddConfiguration(ONVIF_DEVICE * p_dev, tr2_AddConfiguration_REQ * p_req, tr2_AddConfiguration_RES * p_res); +HT_API BOOL onvif_tr2_RemoveConfiguration(ONVIF_DEVICE * p_dev, tr2_RemoveConfiguration_REQ * p_req, tr2_RemoveConfiguration_RES * p_res); +HT_API BOOL onvif_tr2_GetVideoEncoderInstances(ONVIF_DEVICE * p_dev, tr2_GetVideoEncoderInstances_REQ * p_req, tr2_GetVideoEncoderInstances_RES * p_res); +HT_API BOOL onvif_tr2_GetAudioOutputConfigurations(ONVIF_DEVICE * p_dev, tr2_GetAudioOutputConfigurations_REQ * p_req, tr2_GetAudioOutputConfigurations_RES * p_res); +HT_API BOOL onvif_tr2_GetAudioOutputConfigurationOptions(ONVIF_DEVICE * p_dev, tr2_GetAudioOutputConfigurationOptions_REQ * p_req, tr2_GetAudioOutputConfigurationOptions_RES * p_res); +HT_API BOOL onvif_tr2_SetAudioOutputConfiguration(ONVIF_DEVICE * p_dev, tr2_SetAudioOutputConfiguration_REQ * p_req, tr2_SetAudioOutputConfiguration_RES * p_res); +HT_API BOOL onvif_tr2_GetAudioDecoderConfigurations(ONVIF_DEVICE * p_dev, tr2_GetAudioDecoderConfigurations_REQ * p_req, tr2_GetAudioDecoderConfigurations_RES * p_res); +HT_API BOOL onvif_tr2_GetAudioDecoderConfigurationOptions(ONVIF_DEVICE * p_dev, tr2_GetAudioDecoderConfigurationOptions_REQ * p_req, tr2_GetAudioDecoderConfigurationOptions_RES * p_res); +HT_API BOOL onvif_tr2_SetAudioDecoderConfiguration(ONVIF_DEVICE * p_dev, tr2_SetAudioDecoderConfiguration_REQ * p_req, tr2_SetAudioDecoderConfiguration_RES * p_res); +HT_API BOOL onvif_tr2_GetSnapshotUri(ONVIF_DEVICE * p_dev, tr2_GetSnapshotUri_REQ * p_req, tr2_GetSnapshotUri_RES * p_res); +HT_API BOOL onvif_tr2_StartMulticastStreaming(ONVIF_DEVICE * p_dev, tr2_StartMulticastStreaming_REQ * p_req, tr2_StartMulticastStreaming_RES * p_res); +HT_API BOOL onvif_tr2_StopMulticastStreaming(ONVIF_DEVICE * p_dev, tr2_StopMulticastStreaming_REQ * p_req, tr2_StopMulticastStreaming_RES * p_res); +HT_API BOOL onvif_tr2_GetVideoSourceModes(ONVIF_DEVICE * p_dev, tr2_GetVideoSourceModes_REQ * p_req, tr2_GetVideoSourceModes_RES * p_res); +HT_API BOOL onvif_tr2_SetVideoSourceMode(ONVIF_DEVICE * p_dev, tr2_SetVideoSourceMode_REQ * p_req, tr2_SetVideoSourceMode_RES * p_res); +HT_API BOOL onvif_tr2_CreateOSD(ONVIF_DEVICE * p_dev, tr2_CreateOSD_REQ * p_req, tr2_CreateOSD_RES * p_res); +HT_API BOOL onvif_tr2_DeleteOSD(ONVIF_DEVICE * p_dev, tr2_DeleteOSD_REQ * p_req, tr2_DeleteOSD_RES * p_res); +HT_API BOOL onvif_tr2_GetOSDs(ONVIF_DEVICE * p_dev, tr2_GetOSDs_REQ * p_req, tr2_GetOSDs_RES * p_res); +HT_API BOOL onvif_tr2_SetOSD(ONVIF_DEVICE * p_dev, tr2_SetOSD_REQ * p_req, tr2_SetOSD_RES * p_res); +HT_API BOOL onvif_tr2_GetOSDOptions(ONVIF_DEVICE * p_dev, tr2_GetOSDOptions_REQ * p_req, tr2_GetOSDOptions_RES * p_res); +HT_API BOOL onvif_tr2_GetAnalyticsConfigurations(ONVIF_DEVICE * p_dev, tr2_GetAnalyticsConfigurations_REQ * p_req, tr2_GetAnalyticsConfigurations_RES * p_res); +HT_API BOOL onvif_tr2_GetMasks(ONVIF_DEVICE * p_dev, tr2_GetMasks_REQ * p_req, tr2_GetMasks_RES * p_res); +HT_API BOOL onvif_tr2_SetMask(ONVIF_DEVICE * p_dev, tr2_SetMask_REQ * p_req, tr2_SetMask_RES * p_res); +HT_API BOOL onvif_tr2_CreateMask(ONVIF_DEVICE * p_dev, tr2_CreateMask_REQ * p_req, tr2_CreateMask_RES * p_res); +HT_API BOOL onvif_tr2_DeleteMask(ONVIF_DEVICE * p_dev, tr2_DeleteMask_REQ * p_req, tr2_DeleteMask_RES * p_res); +HT_API BOOL onvif_tr2_GetMaskOptions(ONVIF_DEVICE * p_dev, tr2_GetMaskOptions_REQ * p_req, tr2_GetMaskOptions_RES * p_res); + +// access control service interfaces +HT_API BOOL onvif_tac_GetServiceCapabilities(ONVIF_DEVICE * p_dev, tac_GetServiceCapabilities_REQ * p_req, tac_GetServiceCapabilities_RES * p_res); +HT_API BOOL onvif_tac_GetAccessPointInfoList(ONVIF_DEVICE * p_dev, tac_GetAccessPointInfoList_REQ * p_req, tac_GetAccessPointInfoList_RES * p_res); +HT_API BOOL onvif_tac_GetAccessPointInfo(ONVIF_DEVICE * p_dev, tac_GetAccessPointInfo_REQ * p_req, tac_GetAccessPointInfo_RES * p_res); +HT_API BOOL onvif_tac_GetAccessPointList(ONVIF_DEVICE * p_dev, tac_GetAccessPointList_REQ * p_req, tac_GetAccessPointList_RES * p_res); +HT_API BOOL onvif_tac_GetAccessPoints(ONVIF_DEVICE * p_dev, tac_GetAccessPoints_REQ * p_req, tac_GetAccessPoints_RES * p_res); +HT_API BOOL onvif_tac_CreateAccessPoint(ONVIF_DEVICE * p_dev, tac_CreateAccessPoint_REQ * p_req, tac_CreateAccessPoint_RES * p_res); +HT_API BOOL onvif_tac_SetAccessPoint(ONVIF_DEVICE * p_dev, tac_SetAccessPoint_REQ * p_req, tac_SetAccessPoint_RES * p_res); +HT_API BOOL onvif_tac_ModifyAccessPoint(ONVIF_DEVICE * p_dev, tac_ModifyAccessPoint_REQ * p_req, tac_ModifyAccessPoint_RES * p_res); +HT_API BOOL onvif_tac_DeleteAccessPoint(ONVIF_DEVICE * p_dev, tac_DeleteAccessPoint_REQ * p_req, tac_DeleteAccessPoint_RES * p_res); +HT_API BOOL onvif_tac_GetAreaInfoList(ONVIF_DEVICE * p_dev, tac_GetAreaInfoList_REQ * p_req, tac_GetAreaInfoList_RES * p_res); +HT_API BOOL onvif_tac_GetAreaInfo(ONVIF_DEVICE * p_dev, tac_GetAreaInfo_REQ * p_req, tac_GetAreaInfo_RES * p_res); +HT_API BOOL onvif_tac_GetAreaList(ONVIF_DEVICE * p_dev, tac_GetAreaList_REQ * p_req, tac_GetAreaList_RES * p_res); +HT_API BOOL onvif_tac_GetAreas(ONVIF_DEVICE * p_dev, tac_GetAreas_REQ * p_req, tac_GetAreas_RES * p_res); +HT_API BOOL onvif_tac_CreateArea(ONVIF_DEVICE * p_dev, tac_CreateArea_REQ * p_req, tac_CreateArea_RES * p_res); +HT_API BOOL onvif_tac_SetArea(ONVIF_DEVICE * p_dev, tac_SetArea_REQ * p_req, tac_SetArea_RES * p_res); +HT_API BOOL onvif_tac_ModifyArea(ONVIF_DEVICE * p_dev, tac_ModifyArea_REQ * p_req, tac_ModifyArea_RES * p_res); +HT_API BOOL onvif_tac_DeleteArea(ONVIF_DEVICE * p_dev, tac_DeleteArea_REQ * p_req, tac_DeleteArea_RES * p_res); +HT_API BOOL onvif_tac_GetAccessPointState(ONVIF_DEVICE * p_dev, tac_GetAccessPointState_REQ * p_req, tac_GetAccessPointState_RES * p_res); +HT_API BOOL onvif_tac_EnableAccessPoint(ONVIF_DEVICE * p_dev, tac_EnableAccessPoint_REQ * p_req, tac_EnableAccessPoint_RES * p_res); +HT_API BOOL onvif_tac_DisableAccessPoint(ONVIF_DEVICE * p_dev, tac_DisableAccessPoint_REQ * p_req, tac_DisableAccessPoint_RES * p_res); + +// door control service interfaces +HT_API BOOL onvif_tdc_GetServiceCapabilities(ONVIF_DEVICE * p_dev, tdc_GetServiceCapabilities_REQ * p_req, tdc_GetServiceCapabilities_RES * p_res); +HT_API BOOL onvif_tdc_GetDoorInfoList(ONVIF_DEVICE * p_dev, tdc_GetDoorInfoList_REQ * p_req, tdc_GetDoorInfoList_RES * p_res); +HT_API BOOL onvif_tdc_GetDoorInfo(ONVIF_DEVICE * p_dev, tdc_GetDoorInfo_REQ * p_req, tdc_GetDoorInfo_RES * p_res); +HT_API BOOL onvif_tdc_GetDoorState(ONVIF_DEVICE * p_dev, tdc_GetDoorState_REQ * p_req, tdc_GetDoorState_RES * p_res); +HT_API BOOL onvif_tdc_AccessDoor(ONVIF_DEVICE * p_dev, tdc_AccessDoor_REQ * p_req, tdc_AccessDoor_RES * p_res); +HT_API BOOL onvif_tdc_LockDoor(ONVIF_DEVICE * p_dev, tdc_LockDoor_REQ * p_req, tdc_LockDoor_RES * p_res); +HT_API BOOL onvif_tdc_UnlockDoor(ONVIF_DEVICE * p_dev, tdc_UnlockDoor_REQ * p_req, tdc_UnlockDoor_RES * p_res); +HT_API BOOL onvif_tdc_DoubleLockDoor(ONVIF_DEVICE * p_dev, tdc_DoubleLockDoor_REQ * p_req, tdc_DoubleLockDoor_RES * p_res); +HT_API BOOL onvif_tdc_BlockDoor(ONVIF_DEVICE * p_dev, tdc_BlockDoor_REQ * p_req, tdc_BlockDoor_RES * p_res); +HT_API BOOL onvif_tdc_LockDownDoor(ONVIF_DEVICE * p_dev, tdc_LockDownDoor_REQ * p_req, tdc_LockDownDoor_RES * p_res); +HT_API BOOL onvif_tdc_LockDownReleaseDoor(ONVIF_DEVICE * p_dev, tdc_LockDownReleaseDoor_REQ * p_req, tdc_LockDownReleaseDoor_RES * p_res); +HT_API BOOL onvif_tdc_LockOpenDoor(ONVIF_DEVICE * p_dev, tdc_LockOpenDoor_REQ * p_req, tdc_LockOpenDoor_RES * p_res); +HT_API BOOL onvif_tdc_LockOpenReleaseDoor(ONVIF_DEVICE * p_dev, tdc_LockOpenReleaseDoor_REQ * p_req, tdc_LockOpenReleaseDoor_RES * p_res); +HT_API BOOL onvif_tdc_GetDoors(ONVIF_DEVICE * p_dev, tdc_GetDoors_REQ * p_req, tdc_GetDoors_RES * p_res); +HT_API BOOL onvif_tdc_GetDoorList(ONVIF_DEVICE * p_dev, tdc_GetDoorList_REQ * p_req, tdc_GetDoorList_RES * p_res); +HT_API BOOL onvif_tdc_CreateDoor(ONVIF_DEVICE * p_dev, tdc_CreateDoor_REQ * p_req, tdc_CreateDoor_RES * p_res); +HT_API BOOL onvif_tdc_SetDoor(ONVIF_DEVICE * p_dev, tdc_SetDoor_REQ * p_req, tdc_SetDoor_RES * p_res); +HT_API BOOL onvif_tdc_ModifyDoor(ONVIF_DEVICE * p_dev, tdc_ModifyDoor_REQ * p_req, tdc_ModifyDoor_RES * p_res); +HT_API BOOL onvif_tdc_DeleteDoor(ONVIF_DEVICE * p_dev, tdc_DeleteDoor_REQ * p_req, tdc_DeleteDoor_RES * p_res); + +// thermal service interfaces +HT_API BOOL onvif_tth_GetServiceCapabilities(ONVIF_DEVICE * p_dev, tth_GetServiceCapabilities_REQ * p_req, tth_GetServiceCapabilities_RES * p_res); +HT_API BOOL onvif_tth_GetConfigurations(ONVIF_DEVICE * p_dev, tth_GetConfigurations_REQ * p_req, tth_GetConfigurations_RES * p_res); +HT_API BOOL onvif_tth_GetConfiguration(ONVIF_DEVICE * p_dev, tth_GetConfiguration_REQ * p_req, tth_GetConfiguration_RES * p_res); +HT_API BOOL onvif_tth_SetConfiguration(ONVIF_DEVICE * p_dev, tth_SetConfiguration_REQ * p_req, tth_SetConfiguration_RES * p_res); +HT_API BOOL onvif_tth_GetConfigurationOptions(ONVIF_DEVICE * p_dev, tth_GetConfigurationOptions_REQ * p_req, tth_GetConfigurationOptions_RES * p_res); +HT_API BOOL onvif_tth_GetRadiometryConfiguration(ONVIF_DEVICE * p_dev, tth_GetRadiometryConfiguration_REQ * p_req, tth_GetRadiometryConfiguration_RES * p_res); +HT_API BOOL onvif_tth_SetRadiometryConfiguration(ONVIF_DEVICE * p_dev, tth_SetRadiometryConfiguration_REQ * p_req, tth_SetRadiometryConfiguration_RES * p_res); +HT_API BOOL onvif_tth_GetRadiometryConfigurationOptions(ONVIF_DEVICE * p_dev, tth_GetRadiometryConfigurationOptions_REQ * p_req, tth_GetRadiometryConfigurationOptions_RES * p_res); + +// credential service interfaces +HT_API BOOL onvif_tcr_GetServiceCapabilities(ONVIF_DEVICE * p_dev, tcr_GetServiceCapabilities_REQ * p_req, tcr_GetServiceCapabilities_RES * p_res); +HT_API BOOL onvif_tcr_GetCredentialInfo(ONVIF_DEVICE * p_dev, tcr_GetCredentialInfo_REQ * p_req, tcr_GetCredentialInfo_RES * p_res); +HT_API BOOL onvif_tcr_GetCredentialInfoList(ONVIF_DEVICE * p_dev, tcr_GetCredentialInfoList_REQ * p_req, tcr_GetCredentialInfoList_RES * p_res); +HT_API BOOL onvif_tcr_GetCredentials(ONVIF_DEVICE * p_dev, tcr_GetCredentials_REQ * p_req, tcr_GetCredentials_RES * p_res); +HT_API BOOL onvif_tcr_GetCredentialList(ONVIF_DEVICE * p_dev, tcr_GetCredentialList_REQ * p_req, tcr_GetCredentialList_RES * p_res); +HT_API BOOL onvif_tcr_CreateCredential(ONVIF_DEVICE * p_dev, tcr_CreateCredential_REQ * p_req, tcr_CreateCredential_RES * p_res); +HT_API BOOL onvif_tcr_ModifyCredential(ONVIF_DEVICE * p_dev, tcr_ModifyCredential_REQ * p_req, tcr_ModifyCredential_RES * p_res); +HT_API BOOL onvif_tcr_DeleteCredential(ONVIF_DEVICE * p_dev, tcr_DeleteCredential_REQ * p_req, tcr_DeleteCredential_RES * p_res); +HT_API BOOL onvif_tcr_GetCredentialState(ONVIF_DEVICE * p_dev, tcr_GetCredentialState_REQ * p_req, tcr_GetCredentialState_RES * p_res); +HT_API BOOL onvif_tcr_EnableCredential(ONVIF_DEVICE * p_dev, tcr_EnableCredential_REQ * p_req, tcr_EnableCredential_RES * p_res); +HT_API BOOL onvif_tcr_DisableCredential(ONVIF_DEVICE * p_dev, tcr_DisableCredential_REQ * p_req, tcr_DisableCredential_RES * p_res); +HT_API BOOL onvif_tcr_ResetAntipassbackViolation(ONVIF_DEVICE * p_dev, tcr_ResetAntipassbackViolation_REQ * p_req, tcr_ResetAntipassbackViolation_RES * p_res); +HT_API BOOL onvif_tcr_GetSupportedFormatTypes(ONVIF_DEVICE * p_dev, tcr_GetSupportedFormatTypes_REQ * p_req, tcr_GetSupportedFormatTypes_RES * p_res); +HT_API BOOL onvif_tcr_GetCredentialIdentifiers(ONVIF_DEVICE * p_dev, tcr_GetCredentialIdentifiers_REQ * p_req, tcr_GetCredentialIdentifiers_RES * p_res); +HT_API BOOL onvif_tcr_SetCredentialIdentifier(ONVIF_DEVICE * p_dev, tcr_SetCredentialIdentifier_REQ * p_req, tcr_SetCredentialIdentifier_RES * p_res); +HT_API BOOL onvif_tcr_DeleteCredentialIdentifier(ONVIF_DEVICE * p_dev, tcr_DeleteCredentialIdentifier_REQ * p_req, tcr_DeleteCredentialIdentifier_RES * p_res); +HT_API BOOL onvif_tcr_GetCredentialAccessProfiles(ONVIF_DEVICE * p_dev, tcr_GetCredentialAccessProfiles_REQ * p_req, tcr_GetCredentialAccessProfiles_RES * p_res); +HT_API BOOL onvif_tcr_SetCredentialAccessProfiles(ONVIF_DEVICE * p_dev, tcr_SetCredentialAccessProfiles_REQ * p_req, tcr_SetCredentialAccessProfiles_RES * p_res); +HT_API BOOL onvif_tcr_DeleteCredentialAccessProfiles(ONVIF_DEVICE * p_dev, tcr_DeleteCredentialAccessProfiles_REQ * p_req, tcr_DeleteCredentialAccessProfiles_RES * p_res); + +// access rules service interfaces +HT_API BOOL onvif_tar_GetServiceCapabilities(ONVIF_DEVICE * p_dev, tar_GetServiceCapabilities_REQ * p_req, tar_GetServiceCapabilities_RES * p_res); +HT_API BOOL onvif_tar_GetAccessProfileInfo(ONVIF_DEVICE * p_dev, tar_GetAccessProfileInfo_REQ * p_req, tar_GetAccessProfileInfo_RES * p_res); +HT_API BOOL onvif_tar_GetAccessProfileInfoList(ONVIF_DEVICE * p_dev, tar_GetAccessProfileInfoList_REQ * p_req, tar_GetAccessProfileInfoList_RES * p_res); +HT_API BOOL onvif_tar_GetAccessProfiles(ONVIF_DEVICE * p_dev, tar_GetAccessProfiles_REQ * p_req, tar_GetAccessProfiles_RES * p_res); +HT_API BOOL onvif_tar_GetAccessProfileList(ONVIF_DEVICE * p_dev, tar_GetAccessProfileList_REQ * p_req, tar_GetAccessProfileList_RES * p_res); +HT_API BOOL onvif_tar_CreateAccessProfile(ONVIF_DEVICE * p_dev, tar_CreateAccessProfile_REQ * p_req, tar_CreateAccessProfile_RES * p_res); +HT_API BOOL onvif_tar_ModifyAccessProfile(ONVIF_DEVICE * p_dev, tar_ModifyAccessProfile_REQ * p_req, tar_ModifyAccessProfile_RES * p_res); +HT_API BOOL onvif_tar_DeleteAccessProfile(ONVIF_DEVICE * p_dev, tar_DeleteAccessProfile_REQ * p_req, tar_DeleteAccessProfile_RES * p_res); + +// schedule service interface +HT_API BOOL onvif_tsc_GetServiceCapabilities(ONVIF_DEVICE * p_dev, tsc_GetServiceCapabilities_REQ * p_req, tsc_GetServiceCapabilities_RES * p_res); +HT_API BOOL onvif_tsc_GetScheduleInfo(ONVIF_DEVICE * p_dev, tsc_GetScheduleInfo_REQ * p_req, tsc_GetScheduleInfo_RES * p_res); +HT_API BOOL onvif_tsc_GetScheduleInfoList(ONVIF_DEVICE * p_dev, tsc_GetScheduleInfoList_REQ * p_req, tsc_GetScheduleInfoList_RES * p_res); +HT_API BOOL onvif_tsc_GetSchedules(ONVIF_DEVICE * p_dev, tsc_GetSchedules_REQ * p_req, tsc_GetSchedules_RES * p_res); +HT_API BOOL onvif_tsc_GetScheduleList(ONVIF_DEVICE * p_dev, tsc_GetScheduleList_REQ * p_req, tsc_GetScheduleList_RES * p_res); +HT_API BOOL onvif_tsc_CreateSchedule(ONVIF_DEVICE * p_dev, tsc_CreateSchedule_REQ * p_req, tsc_CreateSchedule_RES * p_res); +HT_API BOOL onvif_tsc_ModifySchedule(ONVIF_DEVICE * p_dev, tsc_ModifySchedule_REQ * p_req, tsc_ModifySchedule_RES * p_res); +HT_API BOOL onvif_tsc_DeleteSchedule(ONVIF_DEVICE * p_dev, tsc_DeleteSchedule_REQ * p_req, tsc_DeleteSchedule_RES * p_res); +HT_API BOOL onvif_tsc_GetSpecialDayGroupInfo(ONVIF_DEVICE * p_dev, tsc_GetSpecialDayGroupInfo_REQ * p_req, tsc_GetSpecialDayGroupInfo_RES * p_res); +HT_API BOOL onvif_tsc_GetSpecialDayGroupInfoList(ONVIF_DEVICE * p_dev, tsc_GetSpecialDayGroupInfoList_REQ * p_req, tsc_GetSpecialDayGroupInfoList_RES * p_res); +HT_API BOOL onvif_tsc_GetSpecialDayGroups(ONVIF_DEVICE * p_dev, tsc_GetSpecialDayGroups_REQ * p_req, tsc_GetSpecialDayGroups_RES * p_res); +HT_API BOOL onvif_tsc_GetSpecialDayGroupList(ONVIF_DEVICE * p_dev, tsc_GetSpecialDayGroupList_REQ * p_req, tsc_GetSpecialDayGroupList_RES * p_res); +HT_API BOOL onvif_tsc_CreateSpecialDayGroup(ONVIF_DEVICE * p_dev, tsc_CreateSpecialDayGroup_REQ * p_req, tsc_CreateSpecialDayGroup_RES * p_res); +HT_API BOOL onvif_tsc_ModifySpecialDayGroup(ONVIF_DEVICE * p_dev, tsc_ModifySpecialDayGroup_REQ * p_req, tsc_ModifySpecialDayGroup_RES * p_res); +HT_API BOOL onvif_tsc_DeleteSpecialDayGroup(ONVIF_DEVICE * p_dev, tsc_DeleteSpecialDayGroup_REQ * p_req, tsc_DeleteSpecialDayGroup_RES * p_res); +HT_API BOOL onvif_tsc_GetScheduleState(ONVIF_DEVICE * p_dev, tsc_GetScheduleState_REQ * p_req, tsc_GetScheduleState_RES * p_res); + +// receiver service interfaces +HT_API BOOL onvif_trv_GetServiceCapabilities(ONVIF_DEVICE * p_dev, trv_GetServiceCapabilities_REQ * p_req, trv_GetServiceCapabilities_RES * p_res); +HT_API BOOL onvif_trv_GetReceivers(ONVIF_DEVICE * p_dev, trv_GetReceivers_REQ * p_req, trv_GetReceivers_RES * p_res); +HT_API BOOL onvif_trv_GetReceiver(ONVIF_DEVICE * p_dev, trv_GetReceiver_REQ * p_req, trv_GetReceiver_RES * p_res); +HT_API BOOL onvif_trv_CreateReceiver(ONVIF_DEVICE * p_dev, trv_CreateReceiver_REQ * p_req, trv_CreateReceiver_RES * p_res); +HT_API BOOL onvif_trv_DeleteReceiver(ONVIF_DEVICE * p_dev, trv_DeleteReceiver_REQ * p_req, trv_DeleteReceiver_RES * p_res); +HT_API BOOL onvif_trv_ConfigureReceiver(ONVIF_DEVICE * p_dev, trv_ConfigureReceiver_REQ * p_req, trv_ConfigureReceiver_RES * p_res); +HT_API BOOL onvif_trv_SetReceiverMode(ONVIF_DEVICE * p_dev, trv_SetReceiverMode_REQ * p_req, trv_SetReceiverMode_RES * p_res); +HT_API BOOL onvif_trv_GetReceiverState(ONVIF_DEVICE * p_dev, trv_GetReceiverState_REQ * p_req, trv_GetReceiverState_RES * p_res); + +// provisioning interfaces +HT_API BOOL onvif_tpv_GetServiceCapabilities(ONVIF_DEVICE * p_dev, tpv_GetServiceCapabilities_REQ * p_req, tpv_GetServiceCapabilities_RES * p_res); +HT_API BOOL onvif_tpv_PanMove(ONVIF_DEVICE * p_dev, tpv_PanMove_REQ * p_req, tpv_PanMove_RES * p_res); +HT_API BOOL onvif_tpv_TiltMove(ONVIF_DEVICE * p_dev, tpv_TiltMove_REQ * p_req, tpv_TiltMove_RES * p_res); +HT_API BOOL onvif_tpv_ZoomMove(ONVIF_DEVICE * p_dev, tpv_ZoomMove_REQ * p_req, tpv_ZoomMove_RES * p_res); +HT_API BOOL onvif_tpv_RollMove(ONVIF_DEVICE * p_dev, tpv_RollMove_REQ * p_req, tpv_RollMove_RES * p_res); +HT_API BOOL onvif_tpv_FocusMove(ONVIF_DEVICE * p_dev, tpv_FocusMove_REQ * p_req, tpv_FocusMove_RES * p_res); +HT_API BOOL onvif_tpv_Stop(ONVIF_DEVICE * p_dev, tpv_Stop_REQ * p_req, tpv_Stop_RES * p_res); +HT_API BOOL onvif_tpv_GetUsage(ONVIF_DEVICE * p_dev, tpv_GetUsage_REQ * p_req, tpv_GetUsage_RES * p_res); + + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/onvif/onvif_cm.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/onvif/onvif_cm.h new file mode 100644 index 0000000..ed7b78a --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/onvif/onvif_cm.h @@ -0,0 +1,5227 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef ONVIF_COMM_H +#define ONVIF_COMM_H + +/***************************************************************************************/ +#define ONVIF_TOKEN_LEN 100 +#define ONVIF_NAME_LEN 100 +#define ONVIF_URI_LEN 300 +#define ONVIF_SCOPE_LEN 128 + +#define MAX_PTZ_PRESETS 100 +#define MAX_DNS_SERVER 2 +#define MAX_SEARCHDOMAIN 4 +#define MAX_NTP_SERVER 2 +#define MAX_SERVER_PORT 4 +#define MAX_GATEWAY 2 +#define MAX_RES_NUMS 32 +#define MAX_SCOPE_NUMS 100 +#define MAX_USERS 10 +#define MAX_IP_ADDRS 4 + +/* Floating point precision */ +#define FPP 0.01 + +#define ACCESS_CTRL_MAX_LIMIT 10 +#define DOOR_CTRL_MAX_LIMIT 10 +#define CREDENTIAL_MAX_LIMIT 10 +#define ACCESSRULES_MAX_LIMIT 10 +#define SCHEDULE_MAX_LIMIT 10 + +/***************************************************************************************/ +typedef enum +{ + ONVIF_OK = 0, + ONVIF_ERR_ConnFailure = -1, // Connection failed + ONVIF_ERR_MallocFailure = -2, // Failed to allocate memory + ONVIF_ERR_NotSupportHttps = -3, // The device requires an HTTPS connection, but the onvif client library does not support it (the HTTPS compilation macro is not enabled) + ONVIF_ERR_RecvTimeout = -4, // Message receiving timeout + ONVIF_ERR_InvalidContentType = -5, // Device response message content is invalid + ONVIF_ERR_NullContent = -6, // Device response message has no content + ONVIF_ERR_ParseFailed = -7, // Parsing the message failed + ONVIF_ERR_HandleFailed = -8, // Message handling failed + ONVIF_ERR_HttpResponseError = -9, // The device responded with an error message +} ONVIF_RET; + +typedef enum +{ + AuthMethod_HttpDigest = 0, // Http digest auth method + AuthMethod_UsernameToken = 1 // Username Token auth method +} onvif_AuthMethod; + +/***************************************************************************************/ + +typedef enum +{ + CapabilityCategory_Invalid = -1, + CapabilityCategory_All = 0, + CapabilityCategory_Analytics = 1, + CapabilityCategory_Device = 2, + CapabilityCategory_Events = 3, + CapabilityCategory_Imaging = 4, + CapabilityCategory_Media = 5, + CapabilityCategory_PTZ = 6, + CapabilityCategory_Recording = 7, + CapabilityCategory_Search = 8, + CapabilityCategory_Replay = 9, + CapabilityCategory_AccessControl = 10, + CapabilityCategory_DoorControl = 11, + CapabilityCategory_DeviceIO = 12, + CapabilityCategory_Media2 = 13, + CapabilityCategory_Thermal = 14, + CapabilityCategory_Credential = 15, + CapabilityCategory_AccessRules = 16, + CapabilityCategory_Schedule = 17, + CapabilityCategory_Receiver = 18, + CapabilityCategory_Provisioning = 19, +} onvif_CapabilityCategory; + +typedef enum +{ + FactoryDefaultType_Hard = 0, // Indicates that a hard factory default is requested + FactoryDefaultType_Soft = 1 // Indicates that a soft factory default is requested +} onvif_FactoryDefaultType; + +typedef enum +{ + SystemLogType_System = 0, // Indicates that a system log is requested + SystemLogType_Access = 1 // Indicates that a access log is requested +} onvif_SystemLogType; + +typedef enum +{ + VideoEncoding_Unknown = -1, + VideoEncoding_JPEG = 0, + VideoEncoding_MPEG4 = 1, + VideoEncoding_H264 = 2 +} onvif_VideoEncoding; + +typedef enum +{ + AudioEncoding_Unknown = -1, + AudioEncoding_G711 = 0, + AudioEncoding_G726 = 1, + AudioEncoding_AAC = 2 +} onvif_AudioEncoding; + +typedef enum H264Profile +{ + H264Profile_Baseline = 0, + H264Profile_Main = 1, + H264Profile_Extended = 2, + H264Profile_High = 3 +} onvif_H264Profile; + +typedef enum +{ + Mpeg4Profile_SP = 0, + Mpeg4Profile_ASP = 1 +} onvif_Mpeg4Profile; + +typedef enum +{ + UserLevel_Administrator = 0, + UserLevel_Operator = 1, + UserLevel_User = 2, + UserLevel_Anonymous = 3, + UserLevel_Extended = 4 +} onvif_UserLevel; + +typedef enum +{ + IPAddressFilterType_Allow = 0, + IPAddressFilterType_Deny = 1 +} onvif_IPAddressFilterType; + +typedef enum MoveStatus +{ + MoveStatus_IDLE = 0, + MoveStatus_MOVING = 1, + MoveStatus_UNKNOWN = 2 +} onvif_MoveStatus; + +// OSD type +typedef enum +{ + OSDType_Text = 0, + OSDType_Image = 1, + OSDType_Extended =2 +} onvif_OSDType; + +// OSD position type +typedef enum +{ + OSDPosType_UpperLeft = 0, + OSDPosType_UpperRight = 1, + OSDPosType_LowerLeft = 2, + OSDPosType_LowerRight = 3, + OSDPosType_Custom = 4 +} onvif_OSDPosType; + +typedef enum +{ + OSDTextType_Plain, // The Plain type means the OSD is shown as a text string which defined in the "PlainText" item + OSDTextType_Date, // The Date type means the OSD is shown as a date, format of which should be present in the "DateFormat" item + OSDTextType_Time, // The Time type means the OSD is shown as a time, format of which should be present in the "TimeFormat" item + OSDTextType_DateAndTime, // The DateAndTime type means the OSD is shown as date and time, format of which should be present in the "DateFormat" and the "TimeFormat" item +} onvif_OSDTextType; + +// BacklightCompensation mode +typedef enum +{ + BacklightCompensationMode_OFF = 0, // Backlight compensation is disabled + BacklightCompensationMode_ON = 1 // Backlight compensation is enabled +} onvif_BacklightCompensationMode; + +// Exposure mode +typedef enum +{ + ExposureMode_AUTO = 0, + ExposureMode_MANUAL = 1 +} onvif_ExposureMode; + +// Exposure Priority +typedef enum +{ + ExposurePriority_LowNoise = 0, + ExposurePriority_FrameRate = 1 +} onvif_ExposurePriority; + +// AutoFocus Mode +typedef enum +{ + AutoFocusMode_AUTO = 0, + AutoFocusMode_MANUAL = 1 +} onvif_AutoFocusMode; + +typedef enum +{ + WideDynamicMode_OFF = 0, + WideDynamicMode_ON = 1 +} onvif_WideDynamicMode; + +typedef enum +{ + IrCutFilterMode_ON = 0, + IrCutFilterMode_OFF = 1, + IrCutFilterMode_AUTO = 2 +} onvif_IrCutFilterMode; + +typedef enum WhiteBalanceMode +{ + WhiteBalanceMode_AUTO = 0, + WhiteBalanceMode_MANUAL = 1 +} onvif_WhiteBalanceMode; + +typedef enum onvif_EFlipMode +{ + EFlipMode_OFF = 0, + EFlipMode_ON = 1, + EFlipMode_Extended = 2 +} onvif_EFlipMode; + +typedef enum +{ + ReverseMode_OFF = 0, + ReverseMode_ON = 1, + ReverseMode_AUTO = 2, + ReverseMode_Extended = 3 +} onvif_ReverseMode; + +typedef enum +{ + DiscoveryMode_Discoverable = 0, + DiscoveryMode_NonDiscoverable = 1 +} onvif_DiscoveryMode; + +typedef enum +{ + SetDateTimeType_Manual = 0, // Indicates that the date and time are set manually + SetDateTimeType_NTP = 1 // Indicates that the date and time are set through NTP +} onvif_SetDateTimeType; + +typedef enum +{ + StreamType_Invalid = -1, + StreamType_RTP_Unicast = 0, + StreamType_RTP_Multicast = 1 +} onvif_StreamType; + +typedef enum +{ + TransportProtocol_Invalid = -1, + TransportProtocol_UDP = 0, + TransportProtocol_TCP = 1, + TransportProtocol_RTSP = 2, + TransportProtocol_HTTP = 3 +} onvif_TransportProtocol; + +typedef enum +{ + TrackType_Invalid = -1, + TrackType_Video = 0, + TrackType_Audio = 1, + TrackType_Metadata = 2, + TrackType_Extended = 3 +} onvif_TrackType; + +typedef enum +{ + DynamicDNSType_NoUpdate = 0, + DynamicDNSType_ClientUpdates = 1, + DynamicDNSType_ServerUpdates = 2 +} onvif_DynamicDNSType; + +typedef enum +{ + PropertyOperation_Invalid = -1, + PropertyOperation_Initialized = 0, + PropertyOperation_Deleted = 1, + PropertyOperation_Changed = 2 +} onvif_PropertyOperation; + +typedef enum +{ + RecordingStatus_Initiated = 0, + RecordingStatus_Recording = 1, + RecordingStatus_Stopped = 2, + RecordingStatus_Removing = 3, + RecordingStatus_Removed = 4, + RecordingStatus_Unknown = 5 +} onvif_RecordingStatus; + +typedef enum +{ + SearchState_Queued = 0, // The search is queued and not yet started. + SearchState_Searching = 1, // The search is underway and not yet completed + SearchState_Completed = 2, // The search has been completed and no new results will be found + SearchState_Unknown = 3 // The state of the search is unknown. (This is not a valid response from GetSearchState.) +} onvif_SearchState; + +typedef enum +{ + RotateMode_OFF = 0, // Enable the Rotate feature. Degree of rotation is specified Degree parameter + RotateMode_ON = 1, // Disable the Rotate feature + RotateMode_AUTO = 2 // Rotate feature is automatically activated by the device +} onvif_RotateMode; + +typedef enum +{ + ScopeDefinition_Fixed = 0, + ScopeDefinition_Configurable = 1 +} onvif_ScopeDefinition; + +// The physical state of a Door +typedef enum +{ + DoorPhysicalState_Unknown = 0, // Value is currently unknown (possibly due to initialization or monitors not giving a conclusive result) + DoorPhysicalState_Open = 1, // Door is open + DoorPhysicalState_Closed = 2, // Door is closed + DoorPhysicalState_Fault = 3 // Door monitor fault is detected +} onvif_DoorPhysicalState; + +// The physical state of a Lock (including Double Lock) +typedef enum +{ + LockPhysicalState_Unknown = 0, // Value is currently not known + LockPhysicalState_Locked = 1, // Lock is activated + LockPhysicalState_Unlocked = 2, // Lock is not activated + LockPhysicalState_Fault = 3 // Lock fault is detected +} onvif_LockPhysicalState; + +// Describes the state of a Door with regard to alarms +typedef enum +{ + DoorAlarmState_Normal = 0, // No alarm + DoorAlarmState_DoorForcedOpen = 1, // Door is forced open + DoorAlarmState_DoorOpenTooLong = 2 // Door is held open too long +} onvif_DoorAlarmState; + +// Describes the state of a Tamper detector +typedef enum +{ + DoorTamperState_Unknown = 0, // Value is currently not known + DoorTamperState_NotInTamper = 1, // No tampering is detected + DoorTamperState_TamperDetected = 2 // Tampering is detected +} onvif_DoorTamperState; + +// Describes the state of a Door fault +typedef enum +{ + DoorFaultState_Unknown = 0, // Fault state is unknown + DoorFaultState_NotInFault = 1, // No fault is detected + DoorFaultState_FaultDetected = 2 // Fault is detected +} onvif_DoorFaultState; + +// DoorMode parameters describe current Door mode from a logical perspective +typedef enum +{ + DoorMode_Unknown = 0, // The Door is in an Unknown state + DoorMode_Locked = 1, // The Door is in a Locked state. In this mode the device shall provide momentary access using the AccessDoor method if supported by the Door instance + DoorMode_Unlocked = 2, // The Door is in an Unlocked (Permanent Access) state. Alarms related to door timing operations such as open too long or forced are masked in this mode + DoorMode_Accessed = 3, // The Door is in an Accessed state (momentary/temporary access). Alarms related to timing operations such as "door forced" are masked in this mode + DoorMode_Blocked = 4, // The Door is in a Blocked state (Door is locked, and AccessDoor requests are ignored, i.e., it is not possible for door to go to Accessed state) + DoorMode_LockedDown = 5, // The Door is in a LockedDown state (Door is locked) until released using the LockDownReleaseDoor command. AccessDoor, LockDoor, UnlockDoor, BlockDoor and + // LockOpenDoor requests are ignored, i.e., it is not possible for door to go to Accessed, Locked, Unlocked, Blocked or LockedOpen state + DoorMode_LockedOpen = 6, // The Door is in a LockedOpen state (Door is unlocked) until released using the LockOpenReleaseDoor command. AccessDoor, LockDoor, UnlockDoor, BlockDoor and + // LockDownDoor requests are ignored, i.e., it is not possible for door to go to Accessed, Locked, Unlocked, Blocked or LockedDown state + DoorMode_DoubleLocked = 7 // The Door is in a Double Locked state - for doors with multiple locks. If the door does not have any DoubleLock, this shall be treated as a normal Locked mode. + // When changing to an Unlocked mode from the DoubleLocked mode, the door may first go to Locked state before unlocking +} onvif_DoorMode; + +typedef enum +{ + RelayMode_Monostable = 0, // After setting the state, the relay returns to its idle state after the specified time + RelayMode_Bistable = 1, // After setting the state, the relay remains in this state +} onvif_RelayMode; + +typedef enum +{ + RelayIdleState_closed = 0, // means that the relay is closed when the relay state is set to 'inactive' through the trigger command and open when the state is set to 'active' through the same command + RelayIdleState_open = 1, // means that the relay is open when the relay state is set to 'inactive' through the trigger command and closed when the state is set to 'active' through the same command +} onvif_RelayIdleState; + +typedef enum +{ + RelayLogicalState_active = 0, // + RelayLogicalState_inactive = 1, // +} onvif_RelayLogicalState; + +typedef enum +{ + DigitalIdleState_closed = 0, + DigitalIdleState_open = 1, +} onvif_DigitalIdleState; + +typedef enum +{ + ParityBit_None = 0, + ParityBit_Even = 1, + ParityBit_Odd = 2, + ParityBit_Mark = 3, + ParityBit_Space = 4, + ParityBit_Extended = 5 +} onvif_ParityBit; + +typedef enum +{ + SerialPortType_RS232 = 0, + SerialPortType_RS422HalfDuplex = 1, + SerialPortType_RS422FullDuplex = 2, + SerialPortType_RS485HalfDuplex = 3, + SerialPortType_RS485FullDuplex = 4, + SerialPortType_Generic = 5 +} onvif_SerialPortType; + +typedef enum +{ + PTZPresetTourOperation_Start = 0, + PTZPresetTourOperation_Stop = 1, + PTZPresetTourOperation_Pause = 2, + PTZPresetTourOperation_Extended = 3 +} onvif_PTZPresetTourOperation; + +typedef enum +{ + PTZPresetTourState_Idle = 0, + PTZPresetTourState_Touring = 1, + PTZPresetTourState_Paused = 2, + PTZPresetTourState_Extended = 3 +} onvif_PTZPresetTourState; + +typedef enum +{ + PTZPresetTourDirection_Forward = 0, + PTZPresetTourDirection_Backward = 1, + PTZPresetTourDirection_Extended = 2 +} onvif_PTZPresetTourDirection; + +typedef enum +{ + Dot11AuthAndMangementSuite_None = 0, + Dot11AuthAndMangementSuite_Dot1X = 1, + Dot11AuthAndMangementSuite_PSK = 2, + Dot11AuthAndMangementSuite_Extended = 3 +} onvif_Dot11AuthAndMangementSuite; + +typedef enum +{ + Dot11Cipher_CCMP = 0, + Dot11Cipher_TKIP = 1, + Dot11Cipher_Any = 2, + Dot11Cipher_Extended = 3 +} onvif_Dot11Cipher; + +typedef enum +{ + Dot11SignalStrength_None = 0, + Dot11SignalStrength_VeryBad = 1, + Dot11SignalStrength_Bad = 2, + Dot11SignalStrength_Good = 3, + Dot11SignalStrength_VeryGood = 4, + Dot11SignalStrength_Extended = 5 +} onvif_Dot11SignalStrength; + +typedef enum +{ + Dot11StationMode_Ad_hoc = 0, + Dot11StationMode_Infrastructure = 1, + Dot11StationMode_Extended = 2 +} onvif_Dot11StationMode; + +typedef enum +{ + Dot11SecurityMode_None = 0, + Dot11SecurityMode_WEP = 1, + Dot11SecurityMode_PSK = 2, + Dot11SecurityMode_Dot1X = 3, + Dot11SecurityMode_Extended = 4 +} onvif_Dot11SecurityMode; + +typedef enum +{ + ReceiverMode_AutoConnect = 0, // The receiver connects on demand, as required by consumers of the media streams + ReceiverMode_AlwaysConnect = 1, // The receiver attempts to maintain a persistent connection to the configured endpoint + ReceiverMode_NeverConnect = 2, // The receiver does not attempt to connect + ReceiverMode_Unknown = 3 // This case should never happen +} onvif_ReceiverMode; + +typedef enum +{ + ReceiverState_NotConnected = 0, // The receiver is not connected + ReceiverState_Connecting = 1, // The receiver is attempting to connect + ReceiverState_Connected = 2, // The receiver is connected + ReceiverState_Unknown = 3 // This case should never happen +} onvif_ReceiverState; + +typedef enum +{ + PanDirection_Left = 0, // Move left in relation to the video source image + PanDirection_Right = 1 // Move right in relation to the video source image +} onvif_PanDirection; + +typedef enum +{ + TiltDirection_Up = 0, // Move up in relation to the video source image + TiltDirection_Down = 1 // Move down in relation to the video source image +} onvif_TiltDirection; + +typedef enum +{ + ZoomDirection_Wide = 0, // Move video source lens toward a wider field of view + ZoomDirection_Telephoto = 1 // Move video source lens toward a narrower field of view +} onvif_ZoomDirection; + +typedef enum +{ + RollDirection_Clockwise = 0, // Move clockwise in relation to the video source image + RollDirection_Counterclockwise = 1, // Move counterclockwise in relation to the video source image + RollDirection_Auto = 2 // Automatically level the device in relation to the video source image +} onvif_RollDirection; + +typedef enum +{ + FocusDirection_Near = 0, // Move to focus on close objects + FocusDirection_Far = 1, // Move to focus on distant objects + FocusDirection_Auto = 2 // Automatically focus for the sharpest video source image +} onvif_FocusDirection; + +/***************************************************************************************/ +typedef struct +{ + char Code[128]; + char Subcode[128]; + char Reason[256]; +} onvif_Fault; + +typedef struct +{ + int https; // https connection + int port; // onvif port + char host[128]; // ip of xaddrs + char url[128]; // /onvif/device_service +} onvif_XAddr; + +typedef struct +{ + int Major; // required + int Minor; // required +} onvif_Version; + +typedef struct +{ + float Min; // required + float Max; // required +} onvif_FloatRange; + +typedef struct +{ + uint32 spaceFlag : 1; // Indicates whether the field space is valid + uint32 reserved : 31; + + float x; // required + float y; // required + char space[256]; // optional +} onvif_Vector; + +typedef struct +{ + uint32 sizeItems; + int Items[10]; // optional +} onvif_IntList; + +typedef struct +{ + int sizeItems; + float Items[10]; // optional +} onvif_FloatList; + +typedef struct +{ + int sizeItems; + + onvif_ParityBit Items[10]; // optional +} onvif_ParityBitList; + +/* device capabilities */ +typedef struct +{ + // network capabilities + uint32 IPFilter : 1; // Indicates support for IP filtering + uint32 ZeroConfiguration : 1; // Indicates support for zeroconf + uint32 IPVersion6 : 1; // Indicates support for IPv6 + uint32 DynDNS : 1; // Indicates support for dynamic DNS configuration + uint32 Dot11Configuration : 1; // Indicates support for IEEE 802.11 configuration + uint32 HostnameFromDHCP : 1; // Indicates support for retrieval of hostname from DHCP + uint32 DHCPv6 : 1; // Indicates support for Stateful IPv6 DHCP + + // system capabilities + uint32 DiscoveryResolve : 1; // Indicates support for WS Discovery resolve requests + uint32 DiscoveryBye : 1; // Indicates support for WS-Discovery Bye + uint32 RemoteDiscovery : 1; // Indicates support for remote discovery + uint32 SystemBackup : 1; // Indicates support for system backup through MTOM + uint32 SystemLogging : 1; // Indicates support for retrieval of system logging through MTOM + uint32 FirmwareUpgrade : 1; // Indicates support for firmware upgrade through MTOM + uint32 HttpFirmwareUpgrade : 1; // Indicates support for system backup through MTOM + uint32 HttpSystemBackup : 1; // Indicates support for system backup through HTTP + uint32 HttpSystemLogging : 1; // Indicates support for retrieval of system logging through HTTP + uint32 HttpSupportInformation : 1; // Indicates support for retrieving support information through HTTP + uint32 StorageConfiguration: 1; // Indicates support for storage configuration interfaces + uint32 DiscoveryNotSupported : 1; // Indicates no support for network discovery + uint32 NetworkConfigNotSupported : 1; // Indicates no support for network configuration + uint32 UserConfigNotSupported : 1; // Indicates no support for user configuration + + // scurity capabilities + uint32 TLS10 : 1; // Indicates support for TLS 1.0 + uint32 TLS11 : 1; // Indicates support for TLS 1.1 + uint32 TLS12 : 1; // Indicates support for TLS 1.2 + uint32 OnboardKeyGeneration: 1; // Indicates support for onboard key generation + uint32 AccessPolicyConfig : 1; // Indicates support for access policy configuration + uint32 DefaultAccessPolicy : 1; // Indicates support for the ONVIF default access policy + uint32 Dot1X : 1; // Indicates support for IEEE 802.1X configuration + uint32 RemoteUserHandling : 1; // Indicates support for remote user configuration. Used when accessing another device + uint32 X509Token : 1; // Indicates support for WS-Security X.509 token + uint32 SAMLToken : 1; // Indicates support for WS-Security SAML token + uint32 KerberosToken : 1; // Indicates support for WS-Security Kerberos token + uint32 UsernameToken : 1; // Indicates support for WS-Security Username token + uint32 HttpDigest : 1; // Indicates support for WS over HTTP digest authenticated communication layer + uint32 RELToken : 1; // Indicates support for WS-Security REL token + uint32 JsonWebToken : 1; // Indicates support for JWT-based authentication with WS-Security Binary Security token + uint32 Auxiliary : 1; // Auxiliary commaond + uint32 Reserved : 27; + + // IO + int InputConnectors; // optional, Number of input connectors + int RelayOutputs; // optional, Number of relay outputs + + int Dot1XConfigurations; // Indicates the maximum number of Dot1X configurations supported by the device + int NTP; // Maximum number of NTP servers supported by the devices SetNTP command + + int SupportedEAPMethods; // EAP Methods supported by the device. + // The int values refer to the IANA EAP Registry + int MaxUsers; // The maximum number of users that the device supports + int MaxUserNameLength; // Maximum number of characters supported for the username by CreateUsers + int MaxPasswordLength; // Maximum number of characters supported for the password by CreateUsers and SetUser + char SecurityPolicies[100]; // Indicates which security policies are supported. + // Options are: ModifyPassword (to be extended with: PasswordComplexity, PasswordHistory, AuthFailureWarning) + char HashingAlgorithms[32]; // Supported hashing algorithms as part of HTTP and RTSP Digest authentication.Example: MD5,SHA-256 + + int MaxStorageConfigurations; // Indicates maximum number of storage configurations supported + int GeoLocationEntries; // If present signals support for geo location. The value signals the supported number of entries + char AutoGeo[256]; // List of supported automatic GeoLocation adjustment supported by the device. Valid items are defined by tds:AutoGeoMode + // Location:Automatic adjustment of the device location + // Heading:Automatic adjustment of the device orientation relative to the compass also called yaw + // Leveling:Automatic adjustment of the deviation from the horizon also called pitch and roll + char StorageTypesSupported[256]; // Enumerates the supported StorageTypes, see tds:StorageType: + // NFS,CIFS,CDMI,FTP + char Addons[256]; // List of supported Addons by the device + + // misc capabilities + char AuxiliaryCommands[256]; // Lists of commands supported by SendAuxiliaryCommand + + uint32 sizeSupportedVersions; // number of Supported Versions + onvif_Version SupportedVersions[10]; // Supported Versions + onvif_Version Version; // required + onvif_XAddr XAddr; +} onvif_DevicesCapabilities; + +/* media capabilities */ +typedef struct +{ + uint32 SnapshotUri : 1; // Indicates if GetSnapshotUri is supported + uint32 Rotation : 1; // Indicates whether or not Rotation feature is supported + uint32 VideoSourceMode : 1; // Indicates the support for changing video source mode + uint32 OSD : 1; // Indicates if OSD is supported + uint32 TemporaryOSDText : 1; // Indicates if TemporaryOSDText is supported + uint32 EXICompression : 1; // Indicates the support for the Efficient XML Interchange (EXI) binary XML format + uint32 RTPMulticast : 1; // Indicates support for RTP multicast + uint32 RTP_TCP : 1; // Indicates support for RTP over TCP + uint32 RTP_RTSP_TCP : 1; // Indicates support for RTP/RTSP/TCP + uint32 NonAggregateControl : 1; // Indicates support for non aggregate RTSP control + uint32 NoRTSPStreaming : 1; // Indicates the device does not support live media streaming via RTSP + uint32 support : 1; // Indication if the device supports media service + uint32 reserved : 20; + + int MaximumNumberOfProfiles; // Maximum number of profiles supported + + onvif_Version Version; // required + onvif_XAddr XAddr; +} onvif_MediaCapabilities; + +/* PTZ capabilities */ +typedef struct +{ + uint32 EFlip : 1; // Indicates whether or not EFlip is supported + uint32 Reverse : 1; // Indicates whether or not reversing of PT control direction is supported + uint32 GetCompatibleConfigurations : 1; // Indicates support for the GetCompatibleConfigurations command + uint32 MoveStatus : 1; // Indicates that the PTZVector includes MoveStatus information + uint32 StatusPosition : 1; // Indicates that the PTZVector includes Position information + uint32 support : 1; // Indication if the device supports ptz service + uint32 reserved : 26; + + char MoveAndTrack[64]; // Indication of the methods of MoveAndTrack that are supported, acceptable values are defined in tt:MoveAndTrackMethod + // PresetToken + // GeoLocation + // PTZVector + // ObjectID + + onvif_Version Version; // required + onvif_XAddr XAddr; +} onvif_PTZCapabilities; + +/* event capabilities */ +typedef struct +{ + uint32 WSSubscriptionPolicySupport : 1; // Indicates that the WS Subscription policy is supported + uint32 WSPullPointSupport : 1; // Indicates that the WS Pull Point is supported + uint32 WSPausableSubscriptionManagerInterfaceSupport : 1; // Indicates that the WS Pausable Subscription Manager Interface is supported + uint32 PersistentNotificationStorage : 1; // Indication if the device supports persistent notification storage + uint32 MetadataOverMQTT : 1; // Indicates that metadata streaming over MQTT is supported + uint32 support : 1; // Indication if the device supports events service + uint32 reserved : 26; + + int MaxNotificationProducers; // Maximum number of supported notification producers as defined by WS-BaseNotification + int MaxPullPoints; // Maximum supported number of notification pull points + char EventBrokerProtocols[100]; // A space separated list of supported event broker protocols as defined by the tev:EventBrokerProtocol datatype + // mqtt + // mqtts + // ws + // wss + int MaxEventBrokers; // Maxiumum number of event broker configurations that can be added to the device + + onvif_Version Version; // required + onvif_XAddr XAddr; +} onvif_EventCapabilities; + +/* image capabilities */ +typedef struct +{ + uint32 ImageStabilization : 1; // Indicates whether or not Image Stabilization feature is supported + uint32 Presets : 1; // Indicates whether or not Presets feature is supported + uint32 AdaptablePreset : 1; // Indicates whether or not imaging preset settings can be updated + uint32 support : 1; // Indication if the device supports image service + uint32 reserved : 28; + + onvif_Version Version; // required + onvif_XAddr XAddr; +} onvif_ImagingCapabilities; + +/* analytics capabilities*/ +typedef struct +{ + uint32 RuleSupport : 1; // Indication that the device supports the rules interface and the rules syntax + uint32 AnalyticsModuleSupport : 1; // Indication that the device supports the scene analytics module interface + uint32 CellBasedSceneDescriptionSupported : 1; // Indication that the device produces the cell based scene description + uint32 RuleOptionsSupported: 1; // Indication that the device supports the GetRuleOptions operation on the rules interface + uint32 AnalyticsModuleOptionsSupported : 1; // Indication that the device supports the GetAnalyticsModuleOptions operation on the analytics interface + uint32 SupportedMetadata : 1; // Indication that the device supports the GetSupportedMetadata operation + uint32 support : 1; // Indication if the device supports Analytics service + uint32 reserved : 25; + + char ImageSendingType[100]; // Indication what kinds of method that the device support for sending image + // Embedded, LocalStorage, RemoteStorage + + onvif_Version Version; // required + onvif_XAddr XAddr; +} onvif_AnalyticsCapabilities; + +/* recording capabilities */ +typedef struct +{ + uint32 ReceiverSource : 1; + uint32 MediaProfileSource : 1; + uint32 DynamicRecordings : 1; // Indication if the device supports dynamic creation and deletion of recordings + uint32 DynamicTracks : 1; // Indication if the device supports dynamic creation and deletion of tracks + uint32 Options : 1; // Indication if the device supports the GetRecordingOptions command + uint32 MetadataRecording : 1; // Indication if the device supports recording metadata + uint32 EventRecording : 1; // Indication that the device supports event triggered recording + uint32 JPEG : 1; // Indication if supports JPEG encoding + uint32 MPEG4 : 1; // Indication if supports MPEG4 encoding + uint32 H264 : 1; // Indication if supports H264 encoding + uint32 H265 : 1; // Indication if supports H265 encoding + uint32 G711 : 1; // Indication if supports G711 encoding + uint32 G726 : 1; // Indication if supports G726 encoding + uint32 AAC : 1; // Indication if supports AAC encoding + uint32 SupportedTargetFormatsFlag : 1; // Indicates whether the field SupportedTargetFormats is valid + uint32 EncryptionEntryLimitFlag : 1; // Indicates whether the field EncryptionEntryLimit is valid + uint32 SupportedEncryptionModesFlag : 1; // Indicates whether the field SupportedEncryptionModes is valid + uint32 support : 1; // Indication if the device supports recording service + uint32 reserved : 14; + + uint32 MaxStringLength; + float MaxRate; // optional, Maximum supported bit rate for all tracks of a recording in kBit/s + float MaxTotalRate; // optional, Maximum supported bit rate for all recordings in kBit/s. + int MaxRecordings; // optional, Maximum number of recordings supported. + int MaxRecordingJobs; // optional, Maximum total number of supported recording jobs by the device + char SupportedExportFileFormats[100]; // optional, Indication that the device supports ExportRecordedData command for the listed export file formats. + // The list shall return at least one export file format value. The value of 'ONVIF' refers to + // ONVIF Export File Format specification + int BeforeEventLimit; // optional, If present a device shall support configuring before event durations up to the given value + int AfterEventLimit; // optional, If present a device shall support configuring after event durations up to the given value + char SupportedTargetFormats[32]; // optional, List of formats supported by the device for recording to an external target. See tt:TargetFormat for a list of definitions + // MP4 - MP4 files with all tracks in a single file + // CMAF - CMAF compliant MP4 files with 1 track per file + int EncryptionEntryLimit; // optional, Number of encryption entries supported per recording. + // By specifying multiple encryption entries per recording, + // different tracks can be encrypted with different configurations + char SupportedEncryptionModes[32]; // optional, Indicates supported encryption modes. See tt:EncryptionMode for a list of definitions. + // CENC - AES-CTR mode full sample and video NAL Subsample encryption, defined in ISO/IEC 23001-7 + // CBCS - AES-CBC mode partial video NAL pattern encryption, defined in ISO/IEC 23001-7 + + onvif_Version Version; // required + onvif_XAddr XAddr; +} onvif_RecordingCapabilities; + +/* search capabilities */ +typedef struct +{ + uint32 MetadataSearch : 1; + uint32 GeneralStartEvents : 1; // Indicates support for general virtual property events in the FindEvents method + uint32 support : 1; // Indication if the device supports search service + uint32 reserved : 29; + + onvif_Version Version; // required + onvif_XAddr XAddr; +} onvif_SearchCapabilities; + +/* replay capabilities */ +typedef struct +{ + uint32 ReversePlayback : 1; // Indicator that the Device supports reverse playback as defined in the ONVIF Streaming Specification + uint32 RTP_RTSP_TCP : 1; // Indicates support for RTP/RTSP/TCP + uint32 support : 1; // Indication if the device supports replay service + uint32 reserved : 29; + + onvif_FloatRange SessionTimeoutRange; // The minimum and maximum valid values supported as session timeout in seconds + + char RTSPWebSocketUri[256]; // If playback streaming over WebSocket is supported, this shall return the RTSP WebSocket URI + + onvif_Version Version; // required + onvif_XAddr XAddr; +} onvif_ReplayCapabilities; + +/* accesscontrol capabilities */ +typedef struct +{ + uint32 support : 1; // Indication if the device supports accesscontrol service + uint32 ClientSuppliedTokenSupported : 1; // Indicates that the client is allowed to supply the token when creating access points and areas + // To enable the use of the commands SetAccessPoint and SetArea, the value must be set to true + uint32 AccessPointManagementSupported : 1; // Indicates that the client can perform CRUD operations (create, read, update and delete) on access points + uint32 AreaManagementSupported : 1; // Indicates that the client can perform CRUD operations (create, read, update and delete) on areas + uint32 reserved : 28; + + int MaxLimit; // The maximum number of entries returned by a single GetList request. + // The device shall never return more than this number of entities in a single response + int MaxAccessPoints; // Indicates the maximum number of access points supported by the device + int MaxAreas; // Indicates the maximum number of areas supported by the device + + + onvif_Version Version; // required + onvif_XAddr XAddr; +} onvif_AccessControlCapabilities; + +/* doorcontrol capabilities */ +typedef struct +{ + uint32 support : 1; // Indication if the device supports doorcontrol service + uint32 ClientSuppliedTokenSupported : 1; // Indicates that the client is allowed to supply the token when creating doors. + // To enable the use of the command SetDoor, the value must be set to true + uint32 DoorManagementSupported : 1; // Indicates that the client can perform CRUD operations (create, read, update and delete) on doors. + // To enable the use of the commands GetDoors, GetDoorList, CreateDoor, ModifyDoor + // and DeleteDoor, the value must be set to true + uint32 reserved : 29; + + int MaxLimit; // The maximum number of entries returned by a single GetList or Get request. + // The device shall never return more than this number of entities in a single response + int MaxDoors; // Indicates the maximum number of doors supported by the device + + onvif_Version Version; // required + onvif_XAddr XAddr; +} onvif_DoorControlCapabilities; + +typedef struct +{ + uint32 VideoSourcesFlag : 1; // Indicates whether the field VideoSources is valid + uint32 VideoOutputsFlag : 1; // Indicates whether the field VideoSources is valid + uint32 AudioSourcesFlag : 1; // Indicates whether the field VideoSources is valid + uint32 AudioOutputsFlag : 1; // Indicates whether the field VideoSources is valid + uint32 RelayOutputsFlag : 1; // Indicates whether the field VideoSources is valid + uint32 SerialPortsFlag : 1; // Indicates whether the field VideoSources is valid + uint32 DigitalInputsFlag : 1; // Indicates whether the field VideoSources is valid + uint32 DigitalInputOptionsFlag : 1; // Indicates whether the field VideoSources is valid + uint32 support : 1; // Indication if the device supports deviceIO service + uint32 reserved : 23; + + int VideoSources; // optional, Number of video sources (defaults to none) + int VideoOutputs; // optional, Number of video outputs (defaults to none) + int AudioSources; // optional, Number of audio sources (defaults to none) + int AudioOutputs; // optional, Number of audio outputs (defaults to none) + int RelayOutputs; // optional, Number of relay outputs (defaults to none) + int SerialPorts; // optional, Number of serial ports (defaults to none) + int DigitalInputs; // optional, Number of digital inputs (defaults to none) + BOOL DigitalInputOptions; // optional, Indicates support for DigitalInput configuration of the idle state (defaults to false) + + onvif_Version Version; // required + onvif_XAddr XAddr; +} onvif_DeviceIOCapabilities; + +typedef struct +{ + uint32 MaximumNumberOfProfilesFlag : 1; // Indicates whether the field MaximumNumberOfProfiles is valid + uint32 ConfigurationsSupportedFlag : 1; // Indicates whether the field ConfigurationsSupported is valid + uint32 Reserved : 30; + + int MaximumNumberOfProfiles; // optional, Maximum number of profiles supported + char ConfigurationsSupported[256]; // optional, Enumerates the configurations supported +} onvif_ProfileCapabilities; + +typedef struct +{ + uint32 RTSPStreaming : 1; // Indicates support for live media streaming via RTSP + uint32 RTPMulticast : 1; // Indicates support for RTP multicast + uint32 RTP_RTSP_TCP : 1; // Indicates support for RTP/RTSP/TCP + uint32 NonAggregateControl : 1; // Indicates support for non aggregate RTSP control + uint32 AutoStartMulticast : 1; // Indicates support for non-RTSP controlled multicast streaming + uint32 SecureRTSPStreaming : 1; // Indicates support for live media streaming via RTSPS and SRTP + uint32 Reserved : 26; + + char RTSPWebSocketUri[256]; // optional, If streaming over websocket supported, RTSP websocket URI is provided. + // The scheme and IP part shall match the one used in the request (e.g. the GetServices request) +} onvif_StreamingCapabilities; + +typedef struct +{ + uint32 TKIP : 1; // required + uint32 ScanAvailableNetworks : 1; // required + uint32 MultipleConfiguration : 1; // required + uint32 AdHocStationMode : 1; // required + uint32 WEP : 1; // required + uint32 Reserved : 27; +} onvif_Dot11Capabilities; + +typedef struct +{ + uint32 SnapshotUri : 1; // Indicates if GetSnapshotUri is supported + uint32 Rotation : 1; // Indicates whether or not Rotation feature is supported + uint32 VideoSourceMode : 1; // Indicates the support for changing video source mode + uint32 OSD : 1; // Indicates if OSD is supported + uint32 TemporaryOSDText : 1; // Indicates if TemporaryOSDText is supported + uint32 Mask : 1; // Indicates if Masking is supported, Indicates support for mask configuration + uint32 SourceMask : 1; // Indicates if SourceMask is supported + // Indicates that privacy masks are only supported at the video source level + // and not the video source configuration level. If this is true any addition, + // deletion or change of a privacy mask done for one video source configuration + // will automatically be applied by the device to a corresponding privacy mask + // for all other video source configuration associated with the same video source. + uint32 support : 1; // Indication if the device supports media service2 + uint32 Reserved : 24; + + onvif_ProfileCapabilities ProfileCapabilities; // required, Media profile capabilities + onvif_StreamingCapabilities StreamingCapabilities; // required, Streaming capabilities + + onvif_Version Version; // required + onvif_XAddr XAddr; +} onvif_MediaCapabilities2; + +typedef struct +{ + uint32 Radiometry : 1; // Indicates whether or not radiometric thermal measurements are supported by the thermal devic + uint32 support : 1; // Indication if the device supports thermal service + uint32 Reserved : 30; + + onvif_Version Version; // required + onvif_XAddr XAddr; +} onvif_ThermalCapabilities; + +typedef struct +{ + uint32 sizeSupportedExemptionType; // sequence of elements + char SupportedExemptionType[10][32]; // optional, A list of exemptions that the device supports. Supported exemptions starting with the + // prefix pt: are reserved to define PACS specific exemption types and these reserved + // exemption types shall all share "pt:" syntax + // pt:ExemptFromAuthentication Supports ExemptedFromAuthentication +} onvif_CredentialCapabilitiesExtension; + +typedef struct +{ + uint32 ExtensionFlag : 1; + uint32 CredentialValiditySupported : 1; // required, Indicates that the device supports credential validity + uint32 CredentialAccessProfileValiditySupported: 1;// required, Indicates that the device supports validity on the association + // between a credential and an access profile + uint32 ValiditySupportsTimeValue : 1; // required, Indicates that the device supports both date and time value for validity. + // If set to false, then the time value is ignored + uint32 ResetAntipassbackSupported : 1; // required, Indicates the device supports resetting of anti-passback violations + // and notifying on anti-passback violations + uint32 ClientSuppliedTokenSupported: 1; // Indicates that the client is allowed to supply the token when creating credentials. + // To enable the use of the command SetCredential, the value must be set to true + uint32 support : 1; // Indication if the device supports credential service + uint32 Reserved : 25; + + uint32 sizeSupportedIdentifierType; // sequence of elements + char SupportedIdentifierType[10][32]; // required, A list of identifier types that the device supports. Supported identifiers starting with + // the prefix pt: are reserved to define PACS specific identifier types and these reserved + // identifier types shall all share the "pt:" syntax + // pt:Card Supports Card identifier type + // pt:PIN Supports PIN identifier type + // pt:Fingerprint Supports Fingerprint biometric identifier type + // pt:Face Supports Face biometric identifier type + // pt:Iris Supports Iris biometric identifier type + // pt:Vein Supports Vein biometric identifier type + // pt:Palm Supports Palm biometric identifier type + // pt:Retina Supports Retina biometric identifier type + uint32 MaxLimit; // required, The maximum number of entries returned by a single request. + // The device shall never return more than this number of entities in a single response + uint32 MaxCredentials; // required, The maximum number of credential supported by the device + uint32 MaxAccessProfilesPerCredential; // required, The maximum number of access profiles for a credential + + char DefaultCredentialSuspensionDuration[20]; // The default time period that the credential will temporary be suspended (e.g. by using the wrong PIN a predetermined number of times). + // The time period is defined as an [ISO 8601] duration string (e.g. PT5M). + + uint32 MaxWhitelistedItems; // optional, The maximum number of whitelisted credential identifiers supported by the device + uint32 MaxBlacklistedItems; // optional, The maximum number of blacklisted credential identifiers supported by the device + + onvif_CredentialCapabilitiesExtension Extension; // optional + + onvif_Version Version; // required + onvif_XAddr XAddr; +} onvif_CredentialCapabilities; + +typedef struct +{ + uint32 MultipleSchedulesPerAccessPointSupported: 1;// required, Indicates whether or not several access policies can refer to the same access point in + // an access profile + uint32 ClientSuppliedTokenSupported : 1; // Indicates that the client is allowed to supply the token when creating access profiles. + // To enable the use of the command SetAccessProfile, the value must be set to true + uint32 support : 1; // Indication if the device supports access rules service + uint32 Reserved : 29; + + uint32 MaxLimit; // required, The maximum number of entries returned by a single GetList or Get + // request. The device shall never return more than this number of entities in a single response + uint32 MaxAccessProfiles; // required, Indicates the maximum number of access profiles supported by the device + uint32 MaxAccessPoliciesPerAccessProfile; // required, Indicates the maximum number of access policies per access profile supported by the device + + onvif_Version Version; // required + onvif_XAddr XAddr; +} onvif_AccessRulesCapabilities; + +typedef struct +{ + uint32 ExtendedRecurrenceSupported : 1; // required, If this capability is supported, then all iCalendar recurrence types shall be supported by the device + uint32 SpecialDaysSupported : 1; // required, If this capability is supported, then the device shall support special days + uint32 StateReportingSupported : 1; // required, If this capability is set to true, the device shall implement the GetScheduleState command, + // and shall notify subscribing clients whenever schedules become active or inactive + uint32 ClientSuppliedTokenSupported : 1; // Indicates that the client is allowed to supply the token when creating schedules and special day groups. + // To enable the use of the commands SetSchedule and SetSpecialDayGroup, the value must be set to true + uint32 support : 1; // Indication if the device supports schedule service + uint32 Reserved : 27; + + uint32 MaxLimit; // required, + uint32 MaxSchedules; // required, + uint32 MaxTimePeriodsPerDay; // required, + uint32 MaxSpecialDayGroups; // required, + uint32 MaxDaysInSpecialDayGroup; // required, + uint32 MaxSpecialDaysSchedules; // required, + + onvif_Version Version; // required + onvif_XAddr XAddr; +} onvif_ScheduleCapabilities; + +typedef struct +{ + uint32 RTP_USCOREMulticast : 1; // required, Indicates that the device can receive RTP multicast streams + uint32 RTP_USCORETCP : 1; // required, Indicates that the device can receive RTP/TCP streams + uint32 RTP_USCORERTSP_USCORETCP : 1; // required, Indicates that the device can receive RTP/RTSP/TCP streams + uint32 support : 1; // Indication if the device supports receiver service + uint32 Reserved : 28; + + int SupportedReceivers; // required, The maximum number of receivers supported by the device + int MaximumRTSPURILength; // required, The maximum allowed length for RTSP URIs (Minimum and default value is 128 octet) + + onvif_Version Version; // required + onvif_XAddr XAddr; +} onvif_ReceiverCapabilities; + +typedef struct +{ + uint32 MaximumPanMovesFlag : 1; // Indicates whether the field MaximumPanMoves is valid + uint32 MaximumTiltMovesFlag : 1; // Indicates whether the field MaximumTiltMoves is valid + uint32 MaximumZoomMovesFlag : 1; // Indicates whether the field MaximumZoomMoves is valid + uint32 MaximumRollMovesFlag : 1; // Indicates whether the field MaximumRollMoves is valid + uint32 AutoLevelFlag : 1; // Indicates whether the field AutoLevel is valid + uint32 MaximumFocusMovesFlag : 1; // Indicates whether the field MaximumFocusMoves is valid + uint32 AutoFocusFlag : 1; // Indicates whether the field AutoFocus is valid + uint32 Reserved : 25; + + char VideoSourceToken[ONVIF_TOKEN_LEN]; // required, Unique identifier of a video source + int MaximumPanMoves; // optional, Lifetime limit of pan moves for this video source. Presence of this attribute indicates support of pan move + int MaximumTiltMoves; // optional, Lifetime limit of tilt moves for this video source. Presence of this attribute indicates support of tilt move + int MaximumZoomMoves; // optional, Lifetime limit of zoom moves for this video source. Presence of this attribute indicates support of zoom move + int MaximumRollMoves; // optional, Lifetime limit of roll moves for this video source. Presence of this attribute indicates support of roll move + BOOL AutoLevel; // optional, Indicates "auto" as a valid enum for Direction in RollMove + int MaximumFocusMoves; // optional, Lifetime limit of focus moves for this video source. Presence of this attribute indicates support of focus move + BOOL AutoFocus; // optional, Indicates "auto" as a valid enum for Direction in FocusMove +} onvif_SourceCapabilities; + +typedef struct +{ + uint32 support : 1; // Indication if the device supports provisioning service + uint32 Reserved : 31; + + int DefaultTimeout; // external, Maximum time before stopping movement after a move operation + + uint32 sizeSource; // sequence of elements + + onvif_SourceCapabilities Source[4]; // optional, Capabilities per video source + + onvif_Version Version; // required + onvif_XAddr XAddr; +} onvif_ProvisioningCapabilities; + +typedef struct +{ + onvif_DevicesCapabilities device; // The capabilities for the device service is returned in the Capabilities element + onvif_EventCapabilities events; // The capabilities for the event service is returned in the Capabilities element + onvif_Dot11Capabilities dot11; // The capabilities for the dot11 + onvif_MediaCapabilities media; // The capabilities for the media service is returned in the Capabilities element + onvif_MediaCapabilities2 media2; // The capabilities for the media service2 is returned in the Capabilities element + onvif_ImagingCapabilities image; // The capabilities for the imaging service is returned in the Capabilities element + onvif_PTZCapabilities ptz; // The capabilities for the PTZ service is returned in the Capabilities element + onvif_AnalyticsCapabilities analytics; // The capabilities for the analytics service is returned in the Capabilities element + onvif_RecordingCapabilities recording; // The capabilities for the recording service is returned in the Capabilities element + onvif_SearchCapabilities search; // The capabilities for the search service is returned in the Capabilities element + onvif_ReplayCapabilities replay; // The capabilities for the replay service is returned in the Capabilities element + onvif_AccessControlCapabilities accesscontrol; // The capabilities for the accesscontrol service is returned in the Capabilities element + onvif_DoorControlCapabilities doorcontrol; // The capabilities for the doorcontrol service is returned in the Capabilities element + onvif_DeviceIOCapabilities deviceIO; // The capabilities for the deviceIO service is returned in the Capabilities element + onvif_ThermalCapabilities thermal; // The capabilities for the thermal service is returned in the Capabilities element + onvif_CredentialCapabilities credential; // The capabilities for the credential service is returned in the Capabilities element + onvif_AccessRulesCapabilities accessrules; // The capabilities for the access rules service is returned in the Capabilities element + onvif_ScheduleCapabilities schedule; // The capabilities for the schedule service is returned in the Capabilities element + onvif_ReceiverCapabilities receiver; // The capabilities for the receiver service is returned in the Capabilities element + onvif_ProvisioningCapabilities provisioning; // The capabilities for the provisioning service is returned in the Capabilities element +} onvif_Capabilities; + +typedef struct +{ + char Manufacturer[64]; // required, The manufactor of the device + char Model[64]; // required, The device model + char FirmwareVersion[64]; // required, The firmware version in the device + char SerialNumber[64]; // required, The serial number of the device + char HardwareId[64]; // required, The hardware ID of the device +} onvif_DeviceInformation; + +typedef struct +{ + int Width; // required + int Height; // required +} onvif_VideoResolution; + +typedef struct +{ + int Min; // required + int Max; // required +} onvif_IntRange; + +typedef struct +{ + int x; // required + int y; // required + int width; // required + int height; // required +} onvif_IntRectangle; + +typedef struct +{ + float bottom; // required + float top; // required + float right; // required + float left; // required +} onvif_Rectangle; + +typedef struct +{ + uint32 LevelFlag : 1; // Indicates whether the field Level is valid + uint32 Reserved : 31; + + onvif_BacklightCompensationMode Mode; // required, Backlight compensation mode (on/off) + float Level; // optional, Optional level parameter (unit unspecified) +} onvif_BacklightCompensation; + +typedef struct +{ + uint32 PriorityFlag : 1; // Indicates whether the field Priority is valid + uint32 MinExposureTimeFlag : 1; // Indicates whether the field MinExposureTime is valid + uint32 MaxExposureTimeFlag : 1; // Indicates whether the field MaxExposureTime is valid + uint32 MinGainFlag : 1; // Indicates whether the field MinGain is valid + uint32 MaxGainFlag : 1; // Indicates whether the field MaxGain is valid + uint32 MinIrisFlag : 1; // Indicates whether the field MinIris is valid + uint32 MaxIrisFlag : 1; // Indicates whether the field MaxIris is valid + uint32 ExposureTimeFlag : 1; // Indicates whether the field ExposureTime is valid + uint32 GainFlag : 1; // Indicates whether the field Gain is valid + uint32 IrisFlag : 1; // Indicates whether the field Iris is valid + uint32 Reserved : 22; + + onvif_ExposureMode Mode; // required, Auto - Enabled the exposure algorithm on the device; Manual - Disabled exposure algorithm on the device + onvif_ExposurePriority Priority; // optional, The exposure priority mode (low noise/framerate) + onvif_Rectangle Window; // required, + + float MinExposureTime; // optional, Minimum value of exposure time range allowed to be used by the algorithm + float MaxExposureTime; // optional, Maximum value of exposure time range allowed to be used by the algorithm + float MinGain; // optional, Minimum value of the sensor gain range that is allowed to be used by the algorithm + float MaxGain; // optional, Maximum value of the sensor gain range that is allowed to be used by the algorithm + float MinIris; // optional, Minimum value of the iris range allowed to be used by the algorithm + float MaxIris; // optional, Maximum value of the iris range allowed to be used by the algorithm + float ExposureTime; // optional, The fixed exposure time used by the image sensor + float Gain; // optional, The fixed gain used by the image sensor (dB) + float Iris; // optional, The fixed attenuation of input light affected by the iris (dB). 0dB maps to a fully opened iris +} onvif_Exposure; + +typedef struct +{ + uint32 DefaultSpeedFlag : 1; // Indicates whether the field DefaultSpeed is valid + uint32 NearLimitFlag : 1; // Indicates whether the field NearLimit is valid + uint32 FarLimitFlag : 1; // Indicates whether the field FarLimit is valid + uint32 Reserved : 29; + + onvif_AutoFocusMode AutoFocusMode; // required, Mode of auto fucus + + float DefaultSpeed; // optional, + float NearLimit; // optional, Parameter to set autofocus near limit (unit: meter) + float FarLimit; // optional, Parameter to set autofocus far limit (unit: meter) +} onvif_FocusConfiguration; + +typedef struct +{ + uint32 LevelFlag : 1; // Indicates whether the field Level is valid + uint32 Reserved : 31; + + onvif_WideDynamicMode Mode; // required, Wide dynamic range mode (on/off), 0-OFF, 1-ON + float Level; // optional, Optional level parameter (unit unspecified) +} onvif_WideDynamicRange; + +typedef struct +{ + uint32 CrGainFlag : 1; // Indicates whether the field CrGain is valid + uint32 CbGainFlag : 1; // Indicates whether the field CbGain is valid + uint32 Reserved : 30; + + onvif_WhiteBalanceMode Mode; // required, 'AUTO' or 'MANUAL' + + float CrGain; // optional, Rgain (unitless) + float CbGain; // optional, Bgain (unitless) +} onvif_WhiteBalance; + +typedef struct +{ + uint32 BacklightCompensationFlag : 1; // Indicates whether the field BacklightCompensation is valid + uint32 BrightnessFlag : 1; // Indicates whether the field Brightness is valid + uint32 ColorSaturationFlag : 1; // Indicates whether the field ColorSaturation is valid + uint32 ContrastFlag : 1; // Indicates whether the field Contrast is valid + uint32 ExposureFlag : 1; // Indicates whether the field Exposure is valid + uint32 FocusFlag : 1; // Indicates whether the field Focus is valid + uint32 IrCutFilterFlag : 1; // Indicates whether the field IrCutFilter is valid + uint32 SharpnessFlag : 1; // Indicates whether the field Sharpness is valid + uint32 WideDynamicRangeFlag : 1; // Indicates whether the field WideDynamicRange is valid + uint32 WhiteBalanceFlag : 1; // Indicates whether the field WhiteBalance is valid + uint32 Reserved : 22; + + onvif_BacklightCompensation BacklightCompensation; // optional, Enabled/disabled BLC mode (on/off) + float Brightness; // optional, Image brightness (unit unspecified) + float ColorSaturation; // optional, Color saturation of the image (unit unspecified) + float Contrast; // optional, Contrast of the image (unit unspecified) + onvif_Exposure Exposure; // optional, Exposure mode of the device + onvif_FocusConfiguration Focus; // optional, Focus configuration + onvif_IrCutFilterMode IrCutFilter; // optional, Infrared Cutoff Filter settings + float Sharpness; // optional, Sharpness of the Video image + onvif_WideDynamicRange WideDynamicRange; // optional, WDR settings + onvif_WhiteBalance WhiteBalance; // optional, White balance settings +} onvif_ImagingSettings; + +typedef struct +{ + uint32 Mode_ON : 1; // Indicates whether mode ON is valid + uint32 Mode_OFF : 1; // Indicates whether mode OFF is valid + uint32 LevelFlag : 1; // Indicates whether the field LevelFlag is valid + uint32 Reserved : 29; + + onvif_FloatRange Level; // optional, Level range of BacklightCompensation +} onvif_BacklightCompensationOptions; + +typedef struct +{ + uint32 Mode_AUTO : 1; // Indicates whether mode AUTO is valid + uint32 Mode_MANUAL : 1; // Indicates whether mode Manual is valid + uint32 Priority_LowNoise : 1; // Indicates whether Priority LowNoise is valid + uint32 Priority_FrameRate : 1; // Indicates whether Priority FrameRate is valid + uint32 MinExposureTimeFlag : 1; // Indicates whether the field MinExposureTime is valid + uint32 MaxExposureTimeFlag : 1; // Indicates whether the field MaxExposureTime is valid + uint32 MinGainFlag : 1; // Indicates whether the field MinGain is valid + uint32 MaxGainFlag : 1; // Indicates whether the field MaxGain is valid + uint32 MinIrisFlag : 1; // Indicates whether the field MinIris is valid + uint32 MaxIrisFlag : 1; // Indicates whether the field MaxIris is valid + uint32 ExposureTimeFlag : 1; // Indicates whether the field ExposureTime is valid + uint32 GainFlag : 1; // Indicates whether the field Gain is valid + uint32 IrisFlag : 1; // Indicates whether the field Iris is valid + uint32 Reserved : 19; + + onvif_FloatRange MinExposureTime; // optional, Valid range of the Minimum ExposureTime + onvif_FloatRange MaxExposureTime; // optional, Valid range of the Maximum ExposureTime + onvif_FloatRange MinGain; // optional, Valid range of the Minimum Gain + onvif_FloatRange MaxGain; // optional, Valid range of the Maximum Gain + onvif_FloatRange MinIris; // optional, Valid range of the Minimum Iris + onvif_FloatRange MaxIris; // optional, Valid range of the Maximum Iris + onvif_FloatRange ExposureTime; // optional, Valid range of the ExposureTime + onvif_FloatRange Gain; // optional, Valid range of the Gain + onvif_FloatRange Iris; // optional, Valid range of the Iris +} onvif_ExposureOptions; + +typedef struct +{ + uint32 AutoFocusModes_AUTO : 1; // Indicates whether mode aUTO is valid + uint32 AutoFocusModes_MANUAL : 1; // Indicates whether mode Manual is valid + uint32 DefaultSpeedFlag : 1; // Indicates whether the field DefaultSpeed is valid + uint32 NearLimitFlag : 1; // Indicates whether the field NearLimit is valid + uint32 FarLimitFlag : 1; // Indicates whether the field FarLimit is valid + uint32 Reserved : 27; + + onvif_FloatRange DefaultSpeed; // optional, Valid range of DefaultSpeed + onvif_FloatRange NearLimit; // optional, Valid range of NearLimit + onvif_FloatRange FarLimit; // optional, Valid range of FarLimit +} onvif_FocusOptions; + +typedef struct +{ + uint32 Mode_ON : 1; // Indicates whether mode ON is valid + uint32 Mode_OFF : 1; // Indicates whether mode OFF is valid + uint32 LevelFlag : 1; // Indicates whether the field Level is valid + uint32 Reserved : 29; + + onvif_FloatRange Level; // optional, Valid range of Level +} onvif_WideDynamicRangeOptions; + +typedef struct +{ + uint32 Mode_AUTO : 1; // Indicates whether mode AUDO is valid + uint32 Mode_MANUAL : 1; // Indicates whether mode Manual is valid + uint32 YrGainFlag : 1; // Indicates whether the field CrGain is valid + uint32 YbGainFlag : 1; // Indicates whether the field CbGain is valid + uint32 Reserved : 28; + + onvif_FloatRange YrGain; // optional, Valid range of YrGain + onvif_FloatRange YbGain; // optional, Valid range of YbGain +} onvif_WhiteBalanceOptions; + +typedef struct +{ + uint32 IrCutFilterMode_ON : 1; // Indicates whether IrCutFilter mode ON is valid + uint32 IrCutFilterMode_OFF : 1; // Indicates whether IrCutFilter mode OFF is valid + uint32 IrCutFilterMode_AUTO : 1; // Indicates whether IrCutFilter mode AUTO is valid + uint32 BacklightCompensationFlag : 1; // Indicates whether the field BacklightCompensation is valid + uint32 BrightnessFlag : 1; // Indicates whether the field Brightness is valid + uint32 ColorSaturationFlag : 1; // Indicates whether the field ColorSaturation is valid + uint32 ContrastFlag : 1; // Indicates whether the field Contrast is valid + uint32 ExposureFlag : 1; // Indicates whether the field Exposure is valid + uint32 FocusFlag : 1; // Indicates whether the field Focus is valid + uint32 SharpnessFlag : 1; // Indicates whether the field Sharpness is valid + uint32 WideDynamicRangeFlag : 1; // Indicates whether the field WideDynamicRange is valid + uint32 WhiteBalanceFlag : 1; // Indicates whether the field WhiteBalance is valid + uint32 Reserved : 20; + + onvif_BacklightCompensationOptions BacklightCompensation; // optional, Valid range of Backlight Compensation + + onvif_FloatRange Brightness; // optional, Valid range of Brightness + onvif_FloatRange ColorSaturation; // optional, alid range of Color Saturation + onvif_FloatRange Contrast; // optional, Valid range of Contrast + + onvif_ExposureOptions Exposure; // optional, Valid range of Exposure + onvif_FocusOptions Focus; // optional, Valid range of Focus + + onvif_FloatRange Sharpness; // optional, Valid range of Sharpness + + onvif_WideDynamicRangeOptions WideDynamicRange; // optional, Valid range of WideDynamicRange + onvif_WhiteBalanceOptions WhiteBalance; // optional, Valid range of WhiteBalance +} onvif_ImagingOptions; + +typedef struct +{ + uint32 ErrorFlag : 1; // Indicates whether the field Error is valid + uint32 Reserved : 31; + + float Position; // required, Status of focus position + onvif_MoveStatus MoveStatus; // required, Status of focus MoveStatus + char Error[100]; // optional, Error status of focus +} onvif_FocusStatus; + +typedef struct +{ + uint32 FocusStatusFlag : 1; // Indicates whether the field FocusStatus is valid + uint32 Reserved : 31; + + onvif_FocusStatus FocusStatus; // optional, Status of focus +} onvif_ImagingStatus; + +typedef struct +{ + uint32 SpeedFlag : 1; + uint32 Reserved : 31; + + onvif_FloatRange Position; // required, Valid ranges of the position + onvif_FloatRange Speed; // optional, Valid ranges of the speed +} onvif_AbsoluteFocusOptions; + +typedef struct +{ + uint32 SpeedFlag : 1; + uint32 Reserved : 31; + + onvif_FloatRange Distance; // required, valid ranges of the distance + onvif_FloatRange Speed; // optional, Valid ranges of the speed +} onvif_RelativeFocusOptions20; + +typedef struct +{ + onvif_FloatRange Speed; // required, Valid ranges of the speed +} onvif_ContinuousFocusOptions; + +typedef struct +{ + uint32 AbsoluteFlag : 1; + uint32 RelativeFlag : 1; + uint32 ContinuousFlag : 1; + uint32 Reserved : 29; + + onvif_AbsoluteFocusOptions Absolute; // optional, Valid ranges for the absolute control + onvif_RelativeFocusOptions20 Relative; // optional, Valid ranges for the relative control + onvif_ContinuousFocusOptions Continuous; // optional, Valid ranges for the continuous control +} onvif_MoveOptions20; + +typedef struct +{ + uint32 SpeedFlag : 1; // Indicates whether the field Speed is valid + uint32 Reserved : 31; + + float Position; // required, Position parameter for the absolute focus control + float Speed; // optional, Speed parameter for the absolute focus control +} onvif_AbsoluteFocus; + +typedef struct +{ + uint32 SpeedFlag : 1; // Indicates whether the field Speed is valid + uint32 Reserved : 31; + + float Distance; // required, Distance parameter for the relative focus control + float Speed; // optional, Speed parameter for the relative focus control +} onvif_RelativeFocus; + +typedef struct +{ + float Speed; // required, Speed parameter for the Continuous focus control +} onvif_ContinuousFocus; + +typedef struct +{ + uint32 AbsoluteFlag : 1; // Indicates whether the field Absolute is valid + uint32 RelativeFlag : 1; // Indicates whether the field Relative is valid + uint32 ContinuousFlag : 1; // Indicates whether the field Continuous is valid + uint32 Reserved : 29; + + onvif_AbsoluteFocus Absolute; // optional, Parameters for the absolute focus control + onvif_RelativeFocus Relative; // optional, Parameters for the relative focus control + onvif_ContinuousFocus Continuous; // optional, Parameter for the continuous focus control +} onvif_FocusMove; + +typedef struct +{ + char Name[ONVIF_NAME_LEN]; // required, Human readable name of the Imaging Preset + char token[ONVIF_TOKEN_LEN]; // required, Unique identifier of this Imaging Preset + char type[64]; // required, Indicates Imaging Preset Type. Use ImagingPresetType + // Describes standard Imaging Preset types, + // used to facilitate Multi-language support and client display. + // "Custom" Type shall be used when Imaging Preset Name does not + // match any of the types included in the standard classification + // Custom + // ClearWeather + // Cloudy + // Fog + // Rain + // Snowing + // Snow + // WDR + // Shade + // Night + // Indoor + // Fluorescent + // Incandescent + // Sodium(Natrium) + // Sunrise(Horizon) + // Sunset(Rear) + // ExtremeHot + // ExtremeCold + // Underwater + // CloseUp + // Motion + // FlickerFree50 + // FlickerFree60 +} onvif_ImagingPreset; + +typedef struct _ImagingPresetList +{ + struct _ImagingPresetList * next; + + onvif_ImagingPreset Preset; +} ImagingPresetList; + +typedef struct +{ + uint32 PasswordFlag : 1; // Indicates whether the field Password is valid + uint32 Reserved : 31; + + char Username[ONVIF_NAME_LEN]; // required + char Password[ONVIF_NAME_LEN]; // optional + + onvif_UserLevel UserLevel; // required +} onvif_User; + +typedef struct +{ + uint32 PasswordFlag : 1; // Indicates whether the field Password is valid + uint32 Reserved : 31; + + char Username[ONVIF_NAME_LEN]; // required + char Password[ONVIF_NAME_LEN]; // optional + + BOOL UseDerivedPassword; // required +} onvif_RemoteUser; + +typedef struct +{ + char Address[100]; // required + int PrefixLength; // required +} onvif_PrefixedIPAddress; + +typedef struct +{ + onvif_IPAddressFilterType Type; // required + onvif_PrefixedIPAddress IPv4Address[20]; // optional + onvif_PrefixedIPAddress IPv6Address[20]; // optional +} onvif_IPAddressFilter; + +typedef struct +{ + uint32 ImagingSettingsFlag : 1; // Indicates whether the field ImagingSettings is valid + uint32 Reserved : 31; + + char token[ONVIF_TOKEN_LEN]; // required + float Framerate; // required, Frame rate in frames per second + + onvif_VideoResolution Resolution; // required, Horizontal and vertical resolution + onvif_ImagingSettings ImagingSettings; // optional +} onvif_VideoSource; + +typedef struct +{ + uint32 DescriptionFlag : 1; // Indicates whether the field Description is valid + uint32 Enabled : 1; //optional, Indication of whether this mode is active. If active this value is true. In case of non-indication, it means as false. + // The value of true shall be had by only one video source mode + uint32 Reboot : 1; // required, After setting the mode if a device starts to reboot this value is true. If a device change the mode without rebooting this value is false. + // If true, configured parameters may not be guaranteed by the device after rebooting + uint32 Reserved : 29; + + float MaxFramerate; // required, Max frame rate in frames per second for this video source mode + + char Encodings[32]; // required, Indication which encodings are supported for this video source. + char Description[128]; // optional, Informative description of this video source mode. This field should be described in English + char token[ONVIF_TOKEN_LEN]; // required, Indicate token for video source mode + + onvif_VideoResolution MaxResolution; // required, Max horizontal and vertical resolution for this video source mode +} onvif_VideoSourceMode; + +typedef struct +{ + uint32 DegreeFlag : 1; // Indicates whether the field Degree is valid + uint32 Reserved : 31; + + onvif_RotateMode Mode; // required, Parameter to enable/disable Rotation feature + + int Degree; // optional, Optional parameter to configure how much degree of clockwise rotation of image for On mode. Omitting this parameter for On mode means 180 degree rotation +} onvif_Rotate; + +typedef struct +{ + uint32 RotateFlag : 1; // Indicates whether the field Rotate is valid + uint32 Reserved : 31; + + onvif_Rotate Rotate; // optional, Optional element to configure rotation of captured image +} onvif_VideoSourceConfigurationExtension; + +typedef struct +{ + uint32 ExtensionFlag : 1; // Indicates whether the field Extension is valid + uint32 Reserved : 31; + + char Name[ONVIF_NAME_LEN]; // required, User readable name. Length up to 64 characters + int UseCount; // required, Number of internal references currently using this configuration. This parameter is read-only and cannot be changed by a set request + char token[ONVIF_TOKEN_LEN]; // required, Token that uniquely refernces this configuration. Length up to 64 characters + char SourceToken[ONVIF_TOKEN_LEN]; // required, Reference to the physical input + + onvif_IntRectangle Bounds; // required, Rectangle specifying the Video capturing area. The capturing area shall not be larger than the whole Video source area + onvif_VideoSourceConfigurationExtension Extension; // optional +} onvif_VideoSourceConfiguration; + + +typedef struct +{ + onvif_IntRange XRange; // required + onvif_IntRange YRange; // required + onvif_IntRange WidthRange; // required + onvif_IntRange HeightRange; // required +} onvif_IntRectangleRange; + +typedef struct +{ + uint32 RotateMode_OFF : 1; // Indicates whether the mode RotateMode_OFF is valid + uint32 RotateMode_ON : 1; // Indicates whether the mode RotateMode_ON is valid + uint32 RotateMode_AUTO : 1; // Indicates whether the mode RotateMode_AUTO is valid + uint32 Reboot : 1; // Signals if a device requires a reboot after changing the rotation. + // If a device can handle rotation changes without rebooting this value shall be set to false. + uint32 Reserved : 28; + + uint32 sizeDegreeList; + int DegreeList[10]; // optional, List of supported degree value for rotation +} onvif_RotateOptions; + +typedef struct +{ + uint32 RotateFlag : 1; // Indicates whether the field Rotate is valid + uint32 Reserved : 31; + + onvif_RotateOptions Rotate; // optional, Options of parameters for Rotation feature +} onvif_VideoSourceConfigurationOptionsExtension; + +typedef struct +{ + uint32 ExtensionFlag : 1; // Indicates whether the field Extension is valid + uint32 MaximumNumberOfProfilesFlag : 1; // Indicates whether the field MaximumNumberOfProfiles is valid + uint32 Reserved : 30; + + onvif_IntRectangleRange BoundsRange; // required + + uint32 sizeVideoSourceTokensAvailable; + char VideoSourceTokensAvailable[10][ONVIF_TOKEN_LEN]; // required + + onvif_VideoSourceConfigurationOptionsExtension Extension; // optional + + int MaximumNumberOfProfiles; // optional, Maximum number of profiles +} onvif_VideoSourceConfigurationOptions; + +typedef struct +{ + uint32 ConstantBitRateFlag : 1; // Indicates whether the field ConstantBitRate is valid + uint32 Reserved : 31; + + int FrameRateLimit; // required, Maximum output framerate in fps. If an EncodingInterval is provided the resulting encoded framerate will be reduced by the given factor + int EncodingInterval; // required, Interval at which images are encoded and transmitted. (A value of 1 means that every frame is encoded, a value of 2 means that every 2nd frame is encoded ...) + int BitrateLimit; // required, the maximum output bitrate in kbps + BOOL ConstantBitRate; // optional, Enforce constant bitrate +} onvif_VideoRateControl; + +typedef struct +{ + int GovLength; // required, Determines the interval in which the I-Frames will be coded. An entry of 1 indicates I-Frames are continuously generated. + // An entry of 2 indicates that every 2nd image is an I-Frame, and 3 only every 3rd frame, etc. The frames in between are coded as P or B Frames. + onvif_Mpeg4Profile Mpeg4Profile; // required, the Mpeg4 profile, either simple profile (SP) or advanced simple profile (ASP) +} onvif_Mpeg4Configuration; + +typedef struct +{ + int GovLength; // required, Group of Video frames length. Determines typically the interval in which the I-Frames will be coded. An entry of 1 indicates I-Frames are continuously generated. + // An entry of 2 indicates that every 2nd image is an I-Frame, and 3 only every 3rd frame, etc. The frames in between are coded as P or B Frames + onvif_H264Profile H264Profile; // required, the H.264 profile, either baseline, main, extended or high +} onvif_H264Configuration; + +typedef struct +{ + char IPv4Address[32]; // required, The multicast address + int Port; // required, The RTP mutlicast destination port. A device may support RTCP. In this case the port value shall be even to allow the corresponding RTCP stream to be mapped + // to the next higher (odd) destination port number as defined in the RTSP specification + int TTL; // required, In case of IPv6 the TTL value is assumed as the hop limit. Note that for IPV6 and administratively scoped IPv4 multicast the primary use for hop limit / TTL is + // to prevent packets from (endlessly) circulating and not limiting scope. In these cases the address contains the scope + BOOL AutoStart; // required, Read only property signalling that streaming is persistant. Use the methods StartMulticastStreaming and StopMulticastStreaming to switch its state +} onvif_MulticastConfiguration; + +typedef struct +{ + uint32 RateControlFlag : 1; // Indicates whether the field RateControl is valid + uint32 MPEG4Flag : 1; // Indicates whether the field MPEG4 is valid + uint32 H264Flag : 1; // Indicates whether the field H264 is valid + uint32 Reserved : 29; + + char Name[ONVIF_NAME_LEN]; // required, User readable name. Length up to 64 characters + int UseCount; // required, Number of internal references currently using this configuration. This parameter is read-only and cannot be changed by a set request + char token[ONVIF_TOKEN_LEN]; // required, Token that uniquely refernces this configuration. Length up to 64 characters + + onvif_VideoEncoding Encoding; // required, Used video codec, either Jpeg, H.264 or Mpeg4 + onvif_VideoResolution Resolution; // required, Configured video resolution + + int Quality; // required, Relative value for the video quantizers and the quality of the video. A high value within supported quality range means higher quality + + onvif_VideoRateControl RateControl; // optional, Optional element to configure rate control related parameters + onvif_Mpeg4Configuration MPEG4; // optional, Optional element to configure Mpeg4 related parameters + onvif_H264Configuration H264; // optional, Optional element to configure H.264 related parameters + + onvif_MulticastConfiguration Multicast; // required, Defines the multicast settings that could be used for video streaming + + int SessionTimeout; // required, The rtsp session timeout for the related video stream, unit is second +} onvif_VideoEncoderConfiguration; + +typedef struct +{ + char token[ONVIF_TOKEN_LEN]; // required + int Channels; // required, number of available audio channels. (1: mono, 2: stereo) +} onvif_AudioSource; + +typedef struct +{ + char Name[ONVIF_NAME_LEN]; // required, User readable name. Length up to 64 characters + int UseCount; // required, Number of internal references currently using this configuration. This parameter is read-only and cannot be changed by a set request + char token[ONVIF_TOKEN_LEN]; // required, Token that uniquely refernces this configuration. Length up to 64 characters + + char SourceToken[ONVIF_TOKEN_LEN]; // required, Token of the Audio Source the configuration applies to +} onvif_AudioSourceConfiguration; + + +typedef struct +{ + char Name[ONVIF_NAME_LEN]; // required, User readable name. Length up to 64 characters + int UseCount; // required, Number of internal references currently using this configuration. This parameter is read-only and cannot be changed by a set request + char token[ONVIF_TOKEN_LEN]; // required, Token that uniquely refernces this configuration. Length up to 64 characters + + onvif_AudioEncoding Encoding; // required, Audio codec used for encoding the audio input (either G.711, G.726 or AAC) + + int Bitrate; // required, The output bitrate in kbps + int SampleRate; // required, The output sample rate in kHz + + onvif_MulticastConfiguration Multicast; // required, Defines the multicast settings that could be used for video streaming + + int SessionTimeout; // required, The rtsp session timeout for the related audio stream, unit is second +} onvif_AudioEncoderConfiguration; + +typedef struct +{ + onvif_AudioEncoding Encoding; // required, The enoding used for audio data (either G.711, G.726 or AAC) + + onvif_IntList BitrateList; // required, List of supported bitrates in kbps for the specified Encoding + onvif_IntList SampleRateList; // required, List of supported Sample Rates in kHz for the specified Encoding +} onvif_AudioEncoderConfigurationOption; + +typedef struct +{ + uint32 sizeOptions; // required, valid Options numbers + onvif_AudioEncoderConfigurationOption Options[3]; // optional, list of supported AudioEncoderConfigurations +} onvif_AudioEncoderConfigurationOptions; + +typedef struct +{ + onvif_VideoResolution ResolutionsAvailable[MAX_RES_NUMS]; // required, List of supported image sizes + + onvif_IntRange FrameRateRange; // required, Supported frame rate in fps (frames per second) + onvif_IntRange EncodingIntervalRange; // required, Supported encoding interval range. The encoding interval corresponds to the number of frames devided by the encoded frames. An encoding interval value of "1" means that all frames are encoded +} onvif_JpegOptions; + +typedef struct +{ + uint32 Mpeg4Profile_SP : 1; // required, Indicates whether the SP profile is valid + uint32 Mpeg4Profile_ASP : 1; // required, Indicates whether the ASP profile is valid + uint32 Reserverd : 30; + + onvif_VideoResolution ResolutionsAvailable[MAX_RES_NUMS]; // required, List of supported image sizes + + onvif_IntRange GovLengthRange; // required, Supported group of Video frames length. This value typically corresponds to the I-Frame distance + onvif_IntRange FrameRateRange; // required, Supported frame rate in fps (frames per second) + onvif_IntRange EncodingIntervalRange; // required, Supported encoding interval range. The encoding interval corresponds to the number of frames devided by the encoded frames. An encoding interval value of "1" means that all frames are encoded +} onvif_Mpeg4Options; + +typedef struct +{ + uint32 H264Profile_Baseline : 1; // required, Indicates whether the Baseline profile is valid + uint32 H264Profile_Main : 1; // required, Indicates whether the Main profile is valid + uint32 H264Profile_Extended : 1; // required, Indicates whether the Extended profile is valid + uint32 H264Profile_High : 1; // required, Indicates whether the High profile is valid + uint32 Reserverd : 28; + + onvif_VideoResolution ResolutionsAvailable[MAX_RES_NUMS]; // required, List of supported image sizes + + onvif_IntRange GovLengthRange; // required, Supported group of Video frames length. This value typically corresponds to the I-Frame distance + onvif_IntRange FrameRateRange; // required, Supported frame rate in fps (frames per second) + onvif_IntRange EncodingIntervalRange; // required, Supported encoding interval range. The encoding interval corresponds to the number of frames devided by the encoded frames. An encoding interval value of "1" means that all frames are encoded +} onvif_H264Options; + +typedef struct +{ + onvif_JpegOptions JpegOptions; // required + onvif_IntRange BitrateRange; // required +} onvif_JpegOptions2; + +typedef struct +{ + onvif_Mpeg4Options Mpeg4Options; // required + onvif_IntRange BitrateRange; // required +} onvif_Mpeg4Options2; + +typedef struct +{ + onvif_H264Options H264Options; // required + onvif_IntRange BitrateRange; // required +} onvif_H264Options2; + +typedef struct +{ + uint32 JPEGFlag : 1; // Indicates whether the field JPEG is valid + uint32 MPEG4Flag : 1; // Indicates whether the field MPEG4 is valid + uint32 H264Flag : 1; // Indicates whether the field H264 is valid + uint32 Reserved : 29; + + onvif_JpegOptions2 JPEG; // optional + onvif_Mpeg4Options2 MPEG4; // optional + onvif_H264Options2 H264; // optional +} onvif_VideoEncoderOptionsExtension; + +typedef struct +{ + uint32 JPEGFlag : 1; // Indicates whether the field JPEG is valid + uint32 MPEG4Flag : 1; // Indicates whether the field MPEG4 is valid + uint32 H264Flag : 1; // Indicates whether the field H264 is valid + uint32 ExtensionFlag : 1; // Indicates whether the field Extension is valid + uint32 Reserved : 28; + + onvif_IntRange QualityRange; // required, Range of the quality values. A high value means higher quality + + onvif_JpegOptions JPEG; // optional, Optional JPEG encoder settings ranges + onvif_Mpeg4Options MPEG4; // optional, Optional MPEG-4 encoder settings ranges + onvif_H264Options H264; // optional, Optional H.264 encoder settings ranges + + onvif_VideoEncoderOptionsExtension Extension; // optional +} onvif_VideoEncoderConfigurationOptions; + +typedef struct +{ + BOOL Status; // required, True if the metadata stream shall contain the PTZ status (IDLE, MOVING or UNKNOWN) + BOOL Position; // required, True if the metadata stream shall contain the PTZ position +} onvif_PTZFilter; + +typedef struct +{ + char Dialect[1024]; // Dialect + char TopicExpression[256]; // TopicExpression +} onvif_EventSubscription; + +typedef struct +{ + uint32 PanTiltStatusSupported : 1; // required, True if the device is able to stream pan or tilt status information + uint32 ZoomStatusSupported : 1; // required, True if the device is able to stream zoom status inforamtion + uint32 PanTiltPositionSupported : 1; // optional, True if the device is able to stream the pan or tilt position + uint32 ZoomPositionSupported : 1; // optional, True if the device is able to stream zoom position information + uint32 Reserved : 28; +} onvif_PTZStatusFilterOptions; + +typedef struct +{ + uint32 sizeCompressionType; // sequence of elements + char CompressionType[4][32]; // optional, List of supported metadata compression type. Its options shall be chosen from tt:MetadataCompressionType +} onvif_MetadataConfigurationOptionsExtension; + +typedef struct +{ + uint32 GeoLocation : 1; // Optional, True if the device is able to stream the Geo Located positions of each target + uint32 ExtensionFlag : 1; // Indicates whether the field Extension is valid + uint32 Reserved : 30; + + onvif_PTZStatusFilterOptions PTZStatusFilterOptions;// required, This message contains the metadata configuration options. If a metadata configuration is specified, + // the options shall concern that particular configuration. If a media profile is specified, the options shall be compatible with that media profile. + // If no tokens are specified, the options shall be considered generic for the device + onvif_MetadataConfigurationOptionsExtension Extension; // Optional +} onvif_MetadataConfigurationOptions; + +typedef struct +{ + uint32 PosFlag : 1; // Indicates whether the field Pos is valid + uint32 Reserved : 31; + + onvif_OSDPosType Type; // required, For OSD position type + + onvif_Vector Pos; // Optional, when Type is Custom, this field is valid +} onvif_OSDPosConfiguration; + + +typedef struct +{ + uint32 ColorspaceFlag : 1; // Indicates whether the field Colorspace is valid + uint32 TransparentFlag : 1; // Indicates whether the field Transparent is valid + uint32 Reserved : 30; + + float X; // required, + float Y; // required, + float Z; // required, + + int Transparent; // Optional, The value range of "Transparent" could be defined by vendors only should follow this rule: the minimum value means non-transparent and the maximum value maens fully transparent + char Colorspace[256]; // Optional, support the following colorspace + // http://www.onvif.org/ver10/colorspace/YCbCr + // http://www.onvif.org/ver10/colorspace/CIELUV + // http://www.onvif.org/ver10/colorspace/CIELAB + // http://www.onvif.org/ver10/colorspace/HSV +} onvif_OSDColor; + +typedef struct +{ + uint32 DateFormatFlag : 1; // Indicates whether the field DateFormat is valid + uint32 TimeFormatFlag : 1; // Indicates whether the field TimeFormat is valid + uint32 FontSizeFlag : 1; // Indicates whether the field FontSize is valid + uint32 FontColorFlag : 1; // Indicates whether the field FontColor is valid + uint32 BackgroundColorFlag : 1; // Indicates whether the field BackgroundColor is valid + uint32 PlainTextFlag : 1; // Indicates whether the field PlainText is valid + uint32 Reserved : 26; + + onvif_OSDTextType Type; // required, + + char DateFormat[64]; // Optional, List of supported OSD date formats. This element shall be present when the value of Type field has Date or DateAndTime. The following DateFormat are defined: + /* + M/d/yyyy - e.g. 3/6/2013 + MM/dd/yyyy - e.g. 03/06/2013 + dd/MM/yyyy - e.g. 06/03/2013 + yyyy/MM/dd - e.g. 2013/03/06 + yyyy-MM-dd - e.g. 2013-06-03 + dddd, MMMM dd, yyyy - e.g. Wednesday, March 06, 2013 + MMMM dd, yyyy - e.g. March 06, 2013 + dd MMMM, yyyy - e.g. 06 March, 2013 + */ + char TimeFormat[64]; // Optional, List of supported OSD time formats. This element shall be present when the value of Type field has Time or DateAndTime. The following TimeFormat are defined: + /* + h:mm:ss tt - e.g. 2:14:21 PM + hh:mm:ss tt - e.g. 02:14:21 PM + H:mm:ss - e.g. 14:14:21 + HH:mm:ss - e.g. 14:14:21 + */ + + int FontSize; // Optional, Font size of the text in pt + + onvif_OSDColor FontColor; // Optional, Font color of the text + onvif_OSDColor BackgroundColor; // Optional, Background color of the text + + char PlainText[256]; // Optional, The content of text to be displayed +} onvif_OSDTextConfiguration; + +typedef struct +{ + char ImgPath[256]; // required, The URI of the image which to be displayed +} onvif_OSDImgConfiguration; + +typedef struct +{ + uint32 TextStringFlag : 1; // Indicates whether the field TextString is valid + uint32 ImageFlag : 1; // Indicates whether the field Image is valid + uint32 Reserved : 30; + + char token[ONVIF_TOKEN_LEN]; // required, OSD config token + char VideoSourceConfigurationToken[ONVIF_TOKEN_LEN]; // required, Reference to the video source configuration + + onvif_OSDType Type; // required, Type of OSD + + onvif_OSDPosConfiguration Position; // required, Position configuration of OSD + onvif_OSDTextConfiguration TextString; // Optional, Text configuration of OSD. It shall be present when the value of Type field is Text + onvif_OSDImgConfiguration Image; // Optional, Image configuration of OSD. It shall be present when the value of Type field is Image +} onvif_OSDConfiguration; + +typedef struct +{ + uint32 ImageFlag : 1; // Indicates whether the field Image is valid + uint32 PlainTextFlag : 1; // Indicates whether the field PlainText is valid + uint32 DateFlag : 1; // Indicates whether the field Date is valid + uint32 TimeFlag : 1; // Indicates whether the field Time is valid + uint32 DateAndTimeFlag : 1; // Indicates whether the field DateAndTime is valid + uint32 Reserved : 27; + + int Total; // required + int Image; // optional + int PlainText; // optional + int Date; // optional + int Time; // optional + int DateAndTime; // optional +} onvif_MaximumNumberOfOSDs; + +typedef struct +{ + uint32 ColorspaceFlag : 1; // Indicates whether the field Colorspace is valid + uint32 LikelihoodFlag : 1; // Indicates whether the field Likelihood is valid + uint32 Reserved : 30; + + float X; // required, + float Y; // required, + float Z; // required, + + char Colorspace[128]; // optional, The following values are acceptable for Colourspace attribute + // http://www.onvif.org/ver10/colorspace/YCbCr - YCbCr + // http://www.onvif.org/ver10/colorspace/RGB - RGB + float Likelihood; // optional, Likelihood that the color is correct +} onvif_Color; + +typedef struct +{ + onvif_FloatRange X; // required + onvif_FloatRange Y; // required + onvif_FloatRange Z; // required + + char Colorspace[128]; // required, The following values are acceptable for Colourspace attribute + // http://www.onvif.org/ver10/colorspace/YCbCr + // http://www.onvif.org/ver10/colorspace/CIELUV + // http://www.onvif.org/ver10/colorspace/CIELAB + // http://www.onvif.org/ver10/colorspace/HSV +} onvif_ColorspaceRange; + +typedef struct +{ + uint32 sizeColorList; + onvif_Color ColorList[10]; // optional, List the supported color + + uint32 sizeColorspaceRange; + onvif_ColorspaceRange ColorspaceRange[10]; // optional, Define the rang of color supported +} onvif_ColorOptions; + +typedef struct +{ + uint32 ColorFlag : 1; // Indicates whether the field Color is valid + uint32 TransparentFlag : 1; // Indicates whether the field Transparent is valid + uint32 Reserved : 30; + + onvif_ColorOptions Color; // optional, Optional list of supported colors + onvif_IntRange Transparent; // optional, Range of the transparent level. Larger means more tranparent +} onvif_OSDColorOptions; + +typedef struct +{ + uint32 OSDTextType_Plain : 1; // Indicates whether support OSD text type plain + uint32 OSDTextType_Date : 1; // Indicates whether support OSD text type date + uint32 OSDTextType_Time : 1; // Indicates whether support OSD text type time + uint32 OSDTextType_DateAndTime : 1; // Indicates whether support OSD text type dateandtime + uint32 FontSizeRangeFlag : 1; // Indicates whether the field FontSizeRange is valid + uint32 FontColorFlag : 1; // Indicates whether the field FontColor is valid + uint32 BackgroundColorFlag : 1; // Indicates whether the field BackgroundColor is valid + uint32 Reserved : 25; + + onvif_IntRange FontSizeRange; // optional, range of the font size value + + uint32 DateFormatSize; + char DateFormat[10][64]; // optional, List of supported date format + + uint32 TimeFormatSize; + char TimeFormat[10][64]; // optional, List of supported time format + + onvif_OSDColorOptions FontColor; // optional, List of supported font color + onvif_OSDColorOptions BackgroundColor; // optional, List of supported background color +} onvif_OSDTextOptions; + +typedef struct +{ + uint32 ImagePathSize; + char ImagePath[10][256]; // required, List of avaiable uris of image +} onvif_OSDImgOptions; + +typedef struct +{ + uint32 OSDType_Text : 1; // Indicates whether support OSD text type + uint32 OSDType_Image : 1; // Indicates whether support OSD image type + uint32 OSDType_Extended : 1; // Indicates whether support OSD extended type + uint32 OSDPosType_UpperLeft : 1; // Indicates whether support OSD position UpperLeft type + uint32 OSDPosType_UpperRight : 1; // Indicates whether support OSD position UpperRight type + uint32 OSDPosType_LowerLeft : 1; // Indicates whether support OSD position LowerLeft type + uint32 OSDPosType_LowerRight : 1; // Indicates whether support OSD position LowerRight type + uint32 OSDPosType_Custom : 1; // Indicates whether support OSD position Custom type + uint32 TextOptionFlag : 1; // Indicates whether the field TextOption is valid + uint32 ImageOptionFlag : 1; // Indicates whether the field ImageOption is valid + uint32 Reserved : 22; + + onvif_MaximumNumberOfOSDs MaximumNumberOfOSDs; // required, The maximum number of OSD configurations supported for the specificate video source configuration. + // If a device limits the number of instances by OSDType, it should indicate the supported number via the related attribute + onvif_OSDTextOptions TextOption; // optional, Option of the OSD text configuration. This element shall be returned if the device is signaling the support for Text + onvif_OSDImgOptions ImageOption; // optional, Option of the OSD image configuration. This element shall be returned if the device is signaling the support for Image +} onvif_OSDConfigurationOptions; + +typedef struct +{ + uint32 spaceFlag : 1; // Indicates whether the field space is valid + uint32 reserved : 31; + + float x; // required + char space[256]; // optional +} onvif_Vector1D; + +typedef struct +{ + uint32 PanTiltFlag : 1; // Indicates whether the field PanTilt is valid + uint32 ZoomFlag : 1; // Indicates whether the field Zoom is valid + uint32 Reserved : 30; + + onvif_Vector PanTilt; // optional, Pan and tilt position. The x component corresponds to pan and the y component to tilt + onvif_Vector1D Zoom; // optional, A zoom position +} onvif_PTZVector; + +typedef struct +{ + uint32 PanTiltFlag : 1; // Indicates whether the field PanTilt is valid + uint32 ZoomFlag : 1; // Indicates whether the field Zoom is valid + uint32 Reserved : 30; + + onvif_Vector PanTilt; // optional, Pan and tilt speed. The x component corresponds to pan and the y component to tilt. If omitted in a request, the current (if any) PanTilt movement should not be affected + onvif_Vector1D Zoom; // optional, A zoom speed. If omitted in a request, the current (if any) Zoom movement should not be affected +} onvif_PTZSpeed; + +typedef struct +{ + uint32 PTZPositionFlag : 1; // Indicates whether the field PTZPosition is valid + uint32 Reserved : 31; + + char Name[ONVIF_NAME_LEN]; // required, A list of preset position name + char token[ONVIF_TOKEN_LEN]; // required + + onvif_PTZVector PTZPosition; // optional, A list of preset position +} onvif_PTZPreset; + +typedef struct +{ + onvif_FloatRange XRange; // required + onvif_FloatRange YRange; // required +} onvif_PanTiltLimits; + +typedef struct +{ + onvif_FloatRange XRange; // required +} onvif_ZoomLimits; + +typedef struct onvif_PTControlDirection +{ + uint32 EFlipFlag : 1; // Indicates whether the field EFlip is valid + uint32 ReverseFlag : 1; // Indicates whether the field Reverse is valid + uint32 Reserved : 30; + + onvif_EFlipMode EFlip; // optional, Optional element to configure related parameters for E-Flip + onvif_ReverseMode Reverse; // optional, Optional element to configure related parameters for reversing of PT Control Direction +} onvif_PTControlDirection; + +typedef struct +{ + uint32 PTControlDirectionFlag : 1; // Indicates whether the field PTControlDirection is valid + uint32 Reserved : 31; + + onvif_PTControlDirection PTControlDirection; // optional, Optional element to configure PT Control Direction related features +} onvif_PTZConfigurationExtension; + +typedef struct +{ + uint32 DefaultPTZSpeedFlag : 1; // Indicates whether the field DefaultPTZSpeed is valid + uint32 DefaultPTZTimeoutFlag : 1; // Indicates whether the field DefaultPTZTimeout is valid + uint32 PanTiltLimitsFlag : 1; // Indicates whether the field PanTiltLimits is valid + uint32 ZoomLimitsFlag : 1; // Indicates whether the field ZoomLimits is valid + uint32 ExtensionFlag : 1; // Indicates whether the field Extension is valid + uint32 MoveRampFlag : 1; // Indicates whether the field MoveRamp is valid + uint32 PresetRampFlag : 1; // Indicates whether the field PresetRamp is valid + uint32 PresetTourRampFlag : 1; // Indicates whether the field PresetTourRamp is valid + uint32 Reserved : 24; + + char Name[ONVIF_NAME_LEN]; // required + int UseCount; // required + char token[ONVIF_TOKEN_LEN]; // required + char NodeToken[ONVIF_TOKEN_LEN]; // required, A mandatory reference to the PTZ Node that the PTZ Configuration belongs to + + onvif_PTZSpeed DefaultPTZSpeed; // optional, If the PTZ Node supports absolute or relative PTZ movements, it shall specify corresponding default Pan/Tilt and Zoom speeds + int DefaultPTZTimeout; // optional, If the PTZ Node supports continuous movements, it shall specify a default timeout, after which the movement stops + onvif_PanTiltLimits PanTiltLimits; // optional, The Pan/Tilt limits element should be present for a PTZ Node that supports an absolute Pan/Tilt. If the element is present it signals the support for configurable Pan/Tilt limits. + // If limits are enabled, the Pan/Tilt movements shall always stay within the specified range. The Pan/Tilt limits are disabled by setting the limits to -INF or +INF + onvif_ZoomLimits ZoomLimits; // optional, The Zoom limits element should be present for a PTZ Node that supports absolute zoom. If the element is present it signals the supports for configurable Zoom limits. + // If limits are enabled the zoom movements shall always stay within the specified range. The Zoom limits are disabled by settings the limits to -INF and +INF + + onvif_PTZConfigurationExtension Extension; // optional + + int MoveRamp; // optional, The optional acceleration ramp used by the device when moving + int PresetRamp; // optional, The optional acceleration ramp used by the device when recalling presets + int PresetTourRamp; // optional, The optional acceleration ramp used by the device when executing PresetTours +} onvif_PTZConfiguration; + +typedef struct +{ + // Indicates which preset tour operations are available for this PTZ Node + + uint32 PTZPresetTourOperation_Start : 1; + uint32 PTZPresetTourOperation_Stop : 1; + uint32 PTZPresetTourOperation_Pause : 1; + uint32 PTZPresetTourOperation_Extended : 1; + uint32 Reserved : 28; + + int MaximumNumberOfPresetTours; // required, Indicates number of preset tours that can be created. Required preset tour operations shall be available for this PTZ Node if one or more preset tour is supported +} onvif_PTZPresetTourSupported; + +typedef struct +{ + uint32 SupportedPresetTourFlag : 1; // Indicates whether the field SupportedPresetTour is valid + uint32 Reserved : 31; + + onvif_PTZPresetTourSupported SupportedPresetTour;// optional, Detail of supported Preset Tour feature +} onvif_PTZNodeExtension; + +typedef struct +{ + char URI[256]; // required, A URI of coordinate systems. + + onvif_FloatRange XRange; // required, A range of x-axis + onvif_FloatRange YRange; // required, A range of y-axis +} onvif_Space2DDescription; + +typedef struct +{ + char URI[256]; // required, A URI of coordinate systems + + onvif_FloatRange XRange; // required, A range of x-axis +} onvif_Space1DDescription; + +typedef struct +{ + uint32 AbsolutePanTiltPositionSpaceFlag : 1; // Indicates whether the field AbsolutePanTiltPositionSpace is valid + uint32 AbsoluteZoomPositionSpaceFlag : 1; // Indicates whether the field AbsoluteZoomPositionSpace is valid + uint32 RelativePanTiltTranslationSpaceFlag : 1; // Indicates whether the field RelativePanTiltTranslationSpace is valid + uint32 RelativeZoomTranslationSpaceFlag : 1; // Indicates whether the field RelativeZoomTranslationSpace is valid + uint32 ContinuousPanTiltVelocitySpaceFlag : 1; // Indicates whether the field ContinuousPanTiltVelocitySpace is valid + uint32 ContinuousZoomVelocitySpaceFlag : 1; // Indicates whether the field ContinuousZoomVelocitySpace is valid + uint32 PanTiltSpeedSpaceFlag : 1; // Indicates whether the field PanTiltSpeedSpace is valid + uint32 ZoomSpeedSpaceFlag : 1; // Indicates whether the field ZoomSpeedSpace is valid + uint32 Reserved : 24; + + onvif_Space2DDescription AbsolutePanTiltPositionSpace; // optional, The Generic Pan/Tilt Position space is provided by every PTZ node that supports absolute Pan/Tilt, since it does not relate to a specific physical range. + // Instead, the range should be defined as the full range of the PTZ unit normalized to the range -1 to 1 resulting in the following space description + onvif_Space1DDescription AbsoluteZoomPositionSpace; // optional, The Generic Zoom Position Space is provided by every PTZ node that supports absolute Zoom, since it does not relate to a specific physical range. + // Instead, the range should be defined as the full range of the Zoom normalized to the range 0 (wide) to 1 (tele). + // There is no assumption about how the generic zoom range is mapped to magnification, FOV or other physical zoom dimension + onvif_Space2DDescription RelativePanTiltTranslationSpace;// optional, The Generic Pan/Tilt translation space is provided by every PTZ node that supports relative Pan/Tilt, since it does not relate to a specific physical range. + // Instead, the range should be defined as the full positive and negative translation range of the PTZ unit normalized to the range -1 to 1, + // where positive translation would mean clockwise rotation or movement in right/up direction resulting in the following space description + onvif_Space1DDescription RelativeZoomTranslationSpace; // optional, The Generic Zoom Translation Space is provided by every PTZ node that supports relative Zoom, since it does not relate to a specific physical range. + // Instead, the corresponding absolute range should be defined as the full positive and negative translation range of the Zoom normalized to the range -1 to1, + // where a positive translation maps to a movement in TELE direction. The translation is signed to indicate direction (negative is to wide, positive is to tele). + // There is no assumption about how the generic zoom range is mapped to magnification, FOV or other physical zoom dimension. This results in the following space description + onvif_Space2DDescription ContinuousPanTiltVelocitySpace; // optional, The generic Pan/Tilt velocity space shall be provided by every PTZ node, since it does not relate to a specific physical range. + // Instead, the range should be defined as a range of the PTZ unit's speed normalized to the range -1 to 1, where a positive velocity would map to clockwise + // rotation or movement in the right/up direction. A signed speed can be independently specified for the pan and tilt component resulting in the following space description + onvif_Space1DDescription ContinuousZoomVelocitySpace; // optional, The generic zoom velocity space specifies a zoom factor velocity without knowing the underlying physical model. The range should be normalized from -1 to 1, + // where a positive velocity would map to TELE direction. A generic zoom velocity space description resembles the following + onvif_Space1DDescription PanTiltSpeedSpace; // optional, The speed space specifies the speed for a Pan/Tilt movement when moving to an absolute position or to a relative translation. + // In contrast to the velocity spaces, speed spaces do not contain any directional information. The speed of a combined Pan/Tilt + // movement is represented by a single non-negative scalar value + onvif_Space1DDescription ZoomSpeedSpace; // optional, The speed space specifies the speed for a Zoom movement when moving to an absolute position or to a relative translation. + // In contrast to the velocity spaces, speed spaces do not contain any directional information +} onvif_PTZSpaces; + +typedef struct +{ + uint32 NameFlag : 1; // Indicates whether the field Name is valid + uint32 ExtensionFlag : 1; // Indicates whether the field Extension is valid + uint32 Reserved : 30; + + char token[ONVIF_TOKEN_LEN]; // required + char Name[ONVIF_NAME_LEN]; // optional, A unique identifier that is used to reference PTZ Nodes + + onvif_PTZSpaces SupportedPTZSpaces; // required, A list of Coordinate Systems available for the PTZ Node. For each Coordinate System, the PTZ Node MUST specify its allowed range + + int MaximumNumberOfPresets; // required, All preset operations MUST be available for this PTZ Node if one preset is supported + BOOL HomeSupported; // required, A boolean operator specifying the availability of a home position. If set to true, the Home Position Operations MUST be available for this PTZ Node + + onvif_PTZNodeExtension Extension; // optional + + BOOL FixedHomePosition; // optional, Indication whether the HomePosition of a Node is fixed or it can be changed via the SetHomePosition command + BOOL GeoMove; // optional, Indication whether the Node supports the geo-referenced move command + + uint32 sizeAuxiliaryCommands; // sequence of elements + char AuxiliaryCommands[10][64]; // optional +} onvif_PTZNode; + + +typedef struct +{ + // Supported options for EFlip feature + uint32 EFlipMode_OFF : 1; + uint32 EFlipMode_ON : 1; + uint32 EFlipMode_Extended : 1; + + // Supported options for Reverse feature + uint32 ReverseMode_OFF : 1; + uint32 ReverseMode_ON : 1; + uint32 ReverseMode_AUTO : 1; + uint32 ReverseMode_Extended : 1; + uint32 Reserved : 25; +} onvif_PTControlDirectionOptions; + +typedef struct +{ + uint32 PTControlDirectionFlag : 1; // Indicates whether the field PTControlDirection is valid + uint32 Reserved : 31; + + onvif_PTZSpaces Spaces; // required, + onvif_IntRange PTZTimeout; // required, A timeout Range within which Timeouts are accepted by the PTZ Node + onvif_PTControlDirectionOptions PTControlDirection; // optional, +} onvif_PTZConfigurationOptions; + +typedef struct +{ + uint32 PanTiltFlag : 1; // Indicates whether the field PanTilt is valid + uint32 ZoomFlag : 1; // Indicates whether the field Zoom is valid + uint32 Reserved : 30; + + onvif_MoveStatus PanTilt; // optional + onvif_MoveStatus Zoom; // optional +} onvif_PTZMoveStatus; + +typedef struct +{ + uint32 PositionFlag : 1; // Indicates whether the field Position is valid + uint32 MoveStatusFlag : 1; // Indicates whether the field MoveStatus is valid + uint32 ErrorFlag : 1; // Indicates whether the field MoveStatus is valid + uint32 Reserved : 29; + + onvif_PTZVector Position; // optional, Specifies the absolute position of the PTZ unit together with the Space references. The default absolute spaces of the corresponding PTZ configuration MUST be referenced within the Position element + onvif_PTZMoveStatus MoveStatus; // optional, Indicates if the Pan/Tilt/Zoom device unit is currently moving, idle or in an unknown state + + char Error[100]; // optional, States a current PTZ error + time_t UtcTime; // required, Specifies the UTC time when this status was generated +} onvif_PTZStatus; + + +typedef struct +{ + uint32 PresetTokenFlag : 1; // Indicates whether the field PresetToken is valid + uint32 HomeFlag : 1; // Indicates whether the field Home is valid + uint32 PTZPositionFlag : 1; // Indicates whether the field PTZPosition is valid + uint32 Reserved : 29; + + char PresetToken[ONVIF_TOKEN_LEN]; // optional, Option to specify the preset position with Preset Token defined in advance + BOOL Home; // optional, Option to specify the preset position with the home position of this PTZ Node. "False" to this parameter shall be treated as an invalid argument + + onvif_PTZVector PTZPosition; // optional, Option to specify the preset position with vector of PTZ node directly +} onvif_PTZPresetTourPresetDetail; + +typedef struct +{ + uint32 SpeedFlag : 1; // Indicates whether the field Speed is valid + uint32 StayTimeFlag : 1; // Indicates whether the field StayTime is valid + uint32 Reserved : 30; + + onvif_PTZPresetTourPresetDetail PresetDetail; // required, Detail definition of preset position of the tour spot + onvif_PTZSpeed Speed; // optional, Optional parameter to specify Pan/Tilt and Zoom speed on moving toward this tour spot + + int StayTime; // optional, Optional parameter to specify time duration of staying on this tour sport +} onvif_PTZPresetTourSpot; + +typedef struct _PTZPresetTourSpotList +{ + struct _PTZPresetTourSpotList * next; + + onvif_PTZPresetTourSpot PTZPresetTourSpot; +} PTZPresetTourSpotList; + +typedef struct +{ + uint32 CurrentTourSpotFlag : 1; // Indicates whether the field CurrentTourSpot is valid + uint32 Reserved : 31; + + onvif_PTZPresetTourState State; // required, Indicates state of this preset tour by Idle/Touring/Paused + onvif_PTZPresetTourSpot CurrentTourSpot; // optional, Indicates a tour spot currently staying +} onvif_PTZPresetTourStatus; + +typedef struct +{ + uint32 RecurringTimeFlag : 1; // Indicates whether the field RecurringTime is valid + uint32 RecurringDurationFlag : 1; // Indicates whether the field RecurringDuration is valid + uint32 DirectionFlag : 1; // Indicates whether the field Direction is valid + uint32 RandomPresetOrderFlag : 1; // Indicates whether the field RandomPresetOrder is valid + uint32 Reserved : 28; + + int RecurringTime; // optional, Optional parameter to specify how many times the preset tour is recurred + int RecurringDuration; // optional, Optional parameter to specify how long time duration the preset tour is recurred + + onvif_PTZPresetTourDirection Direction; // optional, Optional parameter to choose which direction the preset tour goes. Forward shall be chosen in case it is omitted + + BOOL RandomPresetOrder; // optional, Execute presets in random order. If set to true and Direction is also present, Direction will be ignored and presets of the Tour will be recalled randomly +} onvif_PTZPresetTourStartingCondition; + +typedef struct +{ + char Name[ONVIF_NAME_LEN]; // optional, Readable name of the preset tour + char token[ONVIF_TOKEN_LEN]; // required, Unique identifier of this preset tour + + BOOL AutoStart; // required, Auto Start flag of the preset tour. True allows the preset tour to be activated always + + onvif_PTZPresetTourStatus Status; // required, Read only parameters to indicate the status of the preset tour + + onvif_PTZPresetTourStartingCondition StartingCondition; // required, Parameters to specify the detail behavior of the preset tour + + PTZPresetTourSpotList * TourSpot; // optional, A list of detail of touring spots including preset positions + +} onvif_PresetTour; + +typedef struct +{ + int Min; // required, unit is second + int Max; // required, unit is second +} onvif_DurationRange; + +typedef struct +{ + uint32 RecurringTimeFlag : 1; // Indicates whether the field RecurringTime is valid + uint32 RecurringDurationFlag : 1; // Indicates whether the field RecurringDuration is valid + uint32 PTZPresetTourDirection_Forward : 1; // + uint32 PTZPresetTourDirection_Backward : 1; // + uint32 PTZPresetTourDirection_Extended : 1; // + uint32 Reserved : 27; + + onvif_IntRange RecurringTime; // optional, Supported range of Recurring Time + onvif_DurationRange RecurringDuration; // optional, Supported range of Recurring Duration +} onvif_PTZPresetTourStartingConditionOptions; + +typedef struct +{ + uint32 HomeFlag : 1; // Indicates whether the field Home is valid + uint32 PanTiltPositionSpaceFlag : 1; // Indicates whether the field PanTiltPositionSpace is valid + uint32 ZoomPositionSpaceFlag : 1; // Indicates whether the field ZoomPositionSpace is valid + uint32 Reserved : 29; + + uint32 sizePresetToken; + char PresetToken[MAX_PTZ_PRESETS][ONVIF_TOKEN_LEN]; // optional, A list of available Preset Tokens for tour spots + + BOOL Home; // optional, An option to indicate Home postion for tour spots + + onvif_Space2DDescription PanTiltPositionSpace; // optional, Supported range of Pan and Tilt for tour spots + onvif_Space1DDescription ZoomPositionSpace; // optional, Supported range of Zoom for a tour spot +} onvif_PTZPresetTourPresetDetailOptions; + +typedef struct +{ + onvif_PTZPresetTourPresetDetailOptions PresetDetail; // required, Supported options for detail definition of preset position of the tour spot + onvif_DurationRange StayTime; // required, Supported range of stay time for a tour spot +} onvif_PTZPresetTourSpotOptions; + +typedef struct +{ + BOOL AutoStart; // required, Indicates whether or not the AutoStart is supported + + onvif_PTZPresetTourStartingConditionOptions StartingCondition; // required, Supported options for Preset Tour Starting Condition + onvif_PTZPresetTourSpotOptions TourSpot; // required, Supported options for Preset Tour Spot +} onvif_PTZPresetTourOptions; + + +typedef struct +{ + uint32 NameFlag : 1; // Indicates whether the field Name is valid + uint32 MTUFlag : 1; // Indicates whether the field MTU is valid + uint32 Reserved : 30; + + char Name[ONVIF_NAME_LEN]; // optional, Network interface name, for example eth0 + char HwAddress[32]; // required, Network interface MAC address + int MTU; // optional, Maximum transmission unit +} onvif_NetworkInterfaceInfo; + +typedef struct +{ + char Address[32]; // required + int PrefixLength; // required + + BOOL DHCP; // required, Indicates whether or not DHCP is used +} onvif_IPv4Configuration; + +typedef struct +{ + BOOL Enabled; // required, Indicates whether or not IPv4 is enabled + + onvif_IPv4Configuration Config; // required, IPv4 configuration +} onvif_IPv4NetworkInterface; + +typedef struct +{ + uint32 KeyFlag : 1; // Indicates whether the field Key is valid + uint32 PassphraseFlag : 1; // Indicates whether the field Passphrase is valid + uint32 Reserved : 30; + + char Key[256]; // optional, hexBinary, + // According to IEEE802.11-2007 H.4.1 the RSNA PSK consists of 256 bits, + // or 64 octets when represented in hex + // Either Key or Passphrase shall be given, + // if both are supplied Key shall be used by the device and Passphrase ignored. + char Passphrase[128]; // optional, + // According to IEEE802.11-2007 H.4.1 a pass-phrase is + // a sequence of between 8 and 63 ASCII-encoded characters and + // each character in the pass-phrase must have an encoding in the range of 32 to 126 (decimal),inclusive. + // If only Passpharse is supplied the Key shall be derived using the algorithm described in + // IEEE802.11-2007 section H.4 +} onvif_Dot11PSKSet; + +typedef struct +{ + uint32 AlgorithmFlag : 1; // Indicates whether the field Algorithm is valid + uint32 PSKFlag : 1; // Indicates whether the field PSK is valid + uint32 Dot1XFlag : 1; // // Indicates whether the field Dot1X is valid + uint32 Reserved : 29; + + onvif_Dot11SecurityMode Mode; // required + onvif_Dot11Cipher Algorithm; // optional + onvif_Dot11PSKSet PSK; // optional + + char Dot1X[ONVIF_TOKEN_LEN]; // optional +} onvif_Dot11SecurityConfiguration; + +typedef struct +{ + char SSID[32]; // required, hexBinary + + onvif_Dot11StationMode Mode; // required + + char Alias[32]; // required + int Priority; // required, range is 0-31 + + onvif_Dot11SecurityConfiguration Security; // required element of type ns2:Dot11SecurityConfiguration */ +} onvif_Dot11Configuration; + +typedef struct +{ + int InterfaceType; // required, tt:IANA-IfTypes, Integer indicating interface type, for example: 6 is ethernet + // ieee80211(71) + // For valid numbers, please refer to http://www.iana.org/assignments/ianaiftype-mib + uint32 sizeDot11; // sequence of elements + onvif_Dot11Configuration Dot11[4]; // optional +} onvif_NetworkInterfaceExtension; + +typedef struct +{ + uint32 InfoFlag : 1; // Indicates whether the field Info is valid + uint32 IPv4Flag : 1; // Indicates whether the field IPv4 is valid + uint32 ExtensionFlag : 1; // Indicates whether the field Extension is valid + uint32 Reserved : 29; + + char token[ONVIF_TOKEN_LEN]; // required + BOOL Enabled; // required, Indicates whether or not an interface is enabled + + onvif_NetworkInterfaceInfo Info; // optional, Network interface information + onvif_IPv4NetworkInterface IPv4; // optional, IPv4 network interface configuration + onvif_NetworkInterfaceExtension Extension; // optional, +} onvif_NetworkInterface; + +typedef struct +{ + BOOL HTTPFlag; // Indicates if the http protocol required + BOOL HTTPEnabled; // Indicates if the http protocol is enabled or not + BOOL HTTPSFlag; // Indicates if the https protocol required + BOOL HTTPSEnabled; // Indicates if the https protocol is enabled or not + BOOL RTSPFlag; // Indicates if the rtsp protocol required + BOOL RTSPEnabled; // Indicates if the rtsp protocol is enabled or not + + int HTTPPort[MAX_SERVER_PORT]; // The port that is used by the protocol + int HTTPSPort[MAX_SERVER_PORT]; // The port that is used by the protocol + int RTSPPort[MAX_SERVER_PORT]; // The port that is used by the protocol +} onvif_NetworkProtocol; + +typedef struct +{ + uint32 SearchDomainFlag : 1; // Indicates whether the field SearchDomain is valid + uint32 Reserved : 31; + + BOOL FromDHCP; // required, Indicates whether or not DNS information is retrieved from DHCP + char SearchDomain[MAX_SEARCHDOMAIN][64]; // optional, Search domain + char DNSServer[MAX_DNS_SERVER][32]; // required +} onvif_DNSInformation; + +typedef struct +{ + uint32 NameFlag : 1; // Indicates whether the field Name is valid + uint32 TTLFlag : 1; // Indicates whether the field TTL is valid + uint32 Reserved : 30; + + onvif_DynamicDNSType Type; // required, Dynamic DNS type + + char Name[ONVIF_NAME_LEN]; // optional, DNS name + int TTL; // optional, DNS record time to live +} onvif_DynamicDNSInformation; + +typedef struct +{ + BOOL FromDHCP; // required, Indicates if NTP information is to be retrieved by using DHCP + char NTPServer[MAX_NTP_SERVER][32]; // required +} onvif_NTPInformation; + +typedef struct +{ + uint32 NameFlag : 1; // Indicates whether the field Name is valid + uint32 Reserved : 31; + + BOOL FromDHCP; // required, Indicates whether the hostname is obtained from DHCP or not + BOOL RebootNeeded; // required, Indicates whether or not a reboot is required after configuration updates + char Name[ONVIF_NAME_LEN]; // optional, Indicates the hostname +} onvif_HostnameInformation; + +typedef struct +{ + char IPv4Address[MAX_GATEWAY][32]; // required, IPv4 address string +} onvif_NetworkGateway; + +typedef struct +{ + char InterfaceToken[ONVIF_TOKEN_LEN]; // required, Unique identifier of network interface + BOOL Enabled; // required, Indicates whether the zero-configuration is enabled or not + uint32 sizeAddresses; // sequence of elements + char Addresses[4][32]; // optional, The zero-configuration IPv4 address(es) +} onvif_NetworkZeroConfiguration; + +typedef struct +{ + char Uri[ONVIF_URI_LEN]; // required + BOOL InvalidAfterConnect; // required + BOOL InvalidAfterReboot; // required + int Timeout; // required, unit is second +} onvif_MediaUri; + +typedef struct +{ + uint32 BSSIDFlag : 1; + uint32 PairCipherFlag : 1; + uint32 GroupCipherFlag : 1; + uint32 SignalStrengthFlag : 1; + uint32 Reserved : 28; + + char SSID[32]; // required, hexBinary + char BSSID[64]; // optional + + onvif_Dot11Cipher PairCipher; // optional + onvif_Dot11Cipher GroupCipher; // optional + onvif_Dot11SignalStrength SignalStrength; // optional + + char ActiveConfigAlias[32]; // required +} onvif_Dot11Status; + +typedef struct +{ + uint32 BSSIDFlag : 1; + uint32 SignalStrengthFlag : 1; + uint32 Reserved : 30; + + char SSID[32]; // required, hexBinary + char BSSID[64]; // optional + + uint32 sizeAuthAndMangementSuite; // sequence of elements + onvif_Dot11AuthAndMangementSuite AuthAndMangementSuite[4]; // optional + + uint32 sizePairCipher; // sequence of elements + onvif_Dot11Cipher PairCipher[4]; // optional + + uint32 sizeGroupCipher; // sequence of elements + onvif_Dot11Cipher GroupCipher[4]; // optional + + onvif_Dot11SignalStrength SignalStrength; // optional +} onvif_Dot11AvailableNetworks; + +typedef struct _Dot11AvailableNetworksList +{ + struct _Dot11AvailableNetworksList * next; + + onvif_Dot11AvailableNetworks Networks; +} Dot11AvailableNetworksList; + +typedef struct +{ + char TZ[128]; // required, Posix timezone string +} onvif_TimeZone; + +typedef struct +{ + int Hour; // Range is 0 to 23 + int Minute; // Range is 0 to 59 + int Second; // Range is 0 to 61 (typically 59) +} onvif_Time; + +typedef struct +{ + int Year; // + int Month; // Range is 1 to 12 + int Day; // Range is 1 to 31 +} onvif_Date; + +typedef struct +{ + onvif_Time Time; // required + onvif_Date Date; // required +} onvif_DateTime; + +typedef struct +{ + uint32 TimeZoneFlag : 1; // Indicates whether the field TimeZone is valid + uint32 Reserved : 31; + + BOOL DaylightSavings; // required, Informative indicator whether daylight savings is currently on/off + + onvif_SetDateTimeType DateTimeType; // required, Indicates if the time is set manully or through NTP + onvif_TimeZone TimeZone; // optional, Timezone information in Posix format +} onvif_SystemDateTime; + +typedef struct +{ + onvif_ScopeDefinition ScopeDef; // required + + char ScopeItem[128]; // required +} onvif_Scope; + +typedef struct +{ + uint32 lonFlag : 1; // Indicates whether the field lon is valid + uint32 latFlag : 1; // Indicates whether the field lat is valid + uint32 elevationFlag : 1; // Indicates whether the field elevation is valid + uint32 Reserved : 29; + + double lon; // optional, East west location as angle + double lat; // optional, North south location as angle + float elevation; // optional, Hight in meters above sea level +} onvif_GeoLocation; + +typedef struct +{ + uint32 rollFlag : 1; // Indicates whether the field roll is valid + uint32 pitchFlag : 1; // Indicates whether the field pitch is valid + uint32 yawFlag : 1; // Indicates whether the field yaw is valid + uint32 Reserved : 29; + + float roll; // optional, Rotation around the x axis + float pitch; // optional, Rotation around the y axis + float yaw; // optional, Rotation around the z axis +} onvif_GeoOrientation; + +typedef struct +{ + uint32 xFlag : 1; // Indicates whether the field x is valid + uint32 yFlag : 1; // Indicates whether the field y is valid + uint32 zFlag : 1; // Indicates whether the field z is valid + uint32 Reserved : 29; + + float x; // optional, East west location as angle + float y; // optional, North south location as angle + float z; // optional, Offset in meters from the sea level +} onvif_LocalLocation; + +typedef struct +{ + uint32 panFlag : 1; // Indicates whether the field pan is valid + uint32 tiltFlag : 1; // Indicates whether the field tilt is valid + uint32 rollFlag : 1; // Indicates whether the field roll is valid + uint32 Reserved : 29; + + float pan; // optional, Rotation around the y axis + float tilt; // optional, Rotation around the z axis + float roll; // optional, Rotation around the x axis +} onvif_LocalOrientation; + +typedef struct +{ + uint32 GeoLocationFlag : 1; // Indicates whether the field GeoLocation is valid + uint32 GeoOrientationFlag : 1; // Indicates whether the field GeoOrientation is valid + uint32 LocalLocationFlag : 1; // Indicates whether the field LocalLocation is valid + uint32 LocalOrientationFlag : 1; // Indicates whether the field LocalOrientation is valid + uint32 EntityFlag : 1; // Indicates whether the field Entity is valid + uint32 TokenFlag : 1; // Indicates whether the field Token is valid + uint32 FixedFlag : 1; // Indicates whether the field Fixed is valid + uint32 GeoSourceFlag : 1; // Indicates whether the field GeoSource is valid + uint32 AutoGeoFlag : 1; // Indicates whether the field AutoGeo is valid + uint32 Reserved : 23; + + onvif_GeoLocation GeoLocation; // optional, Location on earth + onvif_GeoOrientation GeoOrientation; // optional, Orientation relative to earth + onvif_LocalLocation LocalLocation; // optional, Indoor location offset + onvif_LocalOrientation LocalOrientation; // optional, Indoor orientation offset + + char Entity[200]; // optional, Entity type the entry refers to as defined in tds:Entity + char Token[ONVIF_TOKEN_LEN]; // optional, Optional entity token + BOOL Fixed; // optional, If this value is true the entity cannot be deleted + char GeoSource[256]; // optional, Optional reference to the XAddr of another devices DeviceManagement service + BOOL AutoGeo; // optional, If set the geo location is obtained internally +} onvif_LocationEntity; + +typedef struct _LocationEntityList +{ + struct _LocationEntityList * next; + + onvif_LocationEntity Location; +} LocationEntityList; + +typedef struct +{ + char * ptr; // required, need call free to free the buffer + int size; // required, the ptr buffer length +} onvif_base64Binary; + +typedef struct +{ + uint32 contentTypeFlag : 1; // Indicates whether the field contentType is valid + uint32 Reserved : 31; + + onvif_base64Binary Data; // required, base64 encoded binary data + char contentType[100]; // optional +} onvif_BinaryData; + +typedef struct +{ + uint32 PasswordFlag : 1; // Indicates whether the field Password is valid + uint32 Reserved : 31; + + char UserName[64]; // required, User name + char Password[64]; // optional, optional password +} onvif_UserCredential; + +typedef struct +{ + uint32 LocalPathFlag : 1; // Indicates whether the field LocalPath is valid + uint32 StorageUriFlag : 1; // Indicates whether the field StorageUri is valid + uint32 UserFlag : 1; // Indicates whether the field User is valid + uint32 RegionFlag : 1; // Indicates whether the field Region is valid + uint32 Reserved : 28; + + char LocalPath[256]; // optional, local path + char StorageUri[256]; // optional, Storage server address + + onvif_UserCredential User; // optional, User credential for the storage server + + char type[100]; // required, StorageType lists the acceptable values for type attribute + // NFS, CIFS, CDMI, FTP, ObjectStorageS3, ObjectStorageAzure + char Region[100]; // optinal, Optional region of the storage server +} onvif_StorageConfigurationData; + +typedef struct +{ + char token[ONVIF_TOKEN_LEN]; // required + onvif_StorageConfigurationData Data; // required +} onvif_StorageConfiguration; + +typedef struct _StorageConfigurationList +{ + struct _StorageConfigurationList *next; + + onvif_StorageConfiguration Configuration; +} StorageConfigurationList; + +typedef struct +{ + onvif_TransportProtocol Protocol; // required, Defines the network protocol for streaming, either UDP=RTP/UDP, RTSP=RTP/RTSP/TCP or HTTP=RTP/RTSP/HTTP/TCP +} onvif_Transport; + +typedef struct +{ + onvif_StreamType Stream; // required, Defines if a multicast or unicast stream is requested + onvif_Transport Transport; // required +} onvif_StreamSetup; + +typedef struct +{ + int SessionTimeout; // required, The RTSP session timeout, unit is second +} onvif_ReplayConfiguration; + +typedef struct +{ + char SourceId[128]; // required, Identifier for the source chosen by the client that creates the structure. + // This identifier is opaque to the device. Clients may use any type of URI for this field. A device shall support at least 128 characters + char Name[ONVIF_NAME_LEN]; // required, Informative user readable name of the source, e.g. "Camera23". A device shall support at least 20 characters + char Location[100]; // required, Informative description of the physical location of the source, e.g. the coordinates on a map + char Description[128]; // required, Informative description of the source + char Address[128]; // required, URI provided by the service supplying data to be recorded. A device shall support at least 128 characters +} onvif_RecordingSourceInformation; + +typedef struct +{ + uint32 KeyFlag : 1; // Indicates whether the field Key is valid + uint32 Reserved : 31; + + char KID[64]; // required, Key ID of the associated key for encryption + char Key[1024]; // optional element of type xsd:hexBinary, Key for encrypting content.The device shall not include this parameter when reading + uint32 sizeTrack; // sequence of elements + char Track[4][32]; // optional, Optional list of track tokens to be encrypted + // If no track tokens are specified, all tracks are encrypted and + // no other encryption configurations shall exist for the recording. + // Each track shall only be contained in one encryption configuration. + char Mode[32]; // required, Mode of encryption. See tt:EncryptionMode for a list of definitions and capability trc:SupportedEncryptionModes for the supported encryption modes + // CENC - AES-CTR mode full sample and video NAL Subsample encryption, defined in ISO/IEC 23001-7 + // CBCS - AES-CBC mode partial video NAL pattern encryption, defined in ISO/IEC 23001-7 +} onvif_RecordingEncryption; + +typedef struct +{ + uint32 PrefixFlag : 1; // Indicates whether the field Prefix is valid + uint32 PostfixFlag : 1; // Indicates whether the field Postfix is valid + uint32 SpanDurationFlag : 1; // Indicates whether the field SpanDuration is valid + uint32 SegmentDurationFlag : 1; // Indicates whether the field SegmentDuration is valid + uint32 Reserved : 28; + + char Storage[ONVIF_TOKEN_LEN]; // required , Token of a storage configuration + char Format[32]; // required , Format of the recording.See tt:TargetFormat for a list of definitions and capability trc:SupportedTargetFormats for the supported formats. + // MP4 - MP4 files with all tracks in a single file + // CMAF - CMAF compliant MP4 files with 1 track per file + char Prefix[64]; // optional, Path prefix to be inserted in the object key + char Postfix[64]; // optional, Path postfix to be inserted in the object key + uint32 SpanDuration; // optional, Maximum duration of a span, unit is second + uint32 SegmentDuration; // external, Maximum duration of a segment, unit is second + + uint32 sizeEncryption; // sequence of elements + onvif_RecordingEncryption Encryption[4]; // optional, Optional encryption configuration. + // See capability trc:EncryptionEntryLimit for the number of supported entries. + // By specifying multiple encryption entries per recording, different tracks + // can be encrypted with different configurations. + // Each track shall only be contained in one encryption configuration. +} onvif_RecordingTargetConfiguration; + +typedef struct +{ + uint32 MaximumRetentionTimeFlag : 1; // Indicates whether the field MaximumRetentionTime is valid + uint32 TargetFlag : 1; // Indicates whether the field Target is valid + uint32 Reserved : 30; + + onvif_RecordingSourceInformation Source; // required, Information about the source of the recording + char Content[256]; // required, Informative description of the source + uint32 MaximumRetentionTime; // optional, specifies the maximum time that data in any track within the + // recording shall be stored. The device shall delete any data older than the maximum retention + // time. Such data shall not be accessible anymore. If the MaximumRetentionPeriod is set to 0, + // the device shall not limit the retention time of stored data, except by resource constraints. + // Whatever the value of MaximumRetentionTime, the device may automatically delete + // recordings to free up storage space for new recordings. + // unit is second + onvif_RecordingTargetConfiguration Target; // optional, Optional external storage target configuration +} onvif_RecordingConfiguration; + +typedef struct +{ + onvif_TrackType TrackType; // required, Type of the track. It shall be equal to the strings "Video", "Audio" or "Metadata" + + char Description[100]; // required, Informative description of the track +} onvif_TrackConfiguration; + +typedef struct +{ + uint32 TypeFlag : 1; // Indicates whether the field Type is valid + uint32 Reserved : 31; + + char Token[ONVIF_TOKEN_LEN]; // required, + char Type[256]; // optional, default is "http://www.onvif.org/ver10/schema/Receiver", "http://www.onvif.org/ver10/schema/Profile" +} onvif_SourceReference; + +typedef struct +{ + char SourceTag[64]; // required, If the received RTSP stream contains multiple tracks of the same type, the + // SourceTag differentiates between those Tracks. This field can be ignored in case of recording a local source + char Destination[ONVIF_TOKEN_LEN]; // required, The destination is the tracktoken of the track to which the device shall store the received data +} onvif_RecordingJobTrack; + +typedef struct +{ + uint32 SourceTokenFlag : 1; // Indicates whether the field SourceToken is valid + uint32 AutoCreateReceiverFlag : 1; // Indicates whether the field AutoCreateReceiver is valid + uint32 Reserved : 30; + + onvif_SourceReference SourceToken; // optional, This field shall be a reference to the source of the data. The type of the source + // is determined by the attribute Type in the SourceToken structure. If Type is + // http://www.onvif.org/ver10/schema/Receiver, the token is a ReceiverReference. In this case + // the device shall receive the data over the network. If Type is + // http://www.onvif.org/ver10/schema/Profile, the token identifies a media profile, instructing the + // device to obtain data from a profile that exists on the local device + BOOL AutoCreateReceiver; // optional, If this field is TRUE, and if the SourceToken is omitted, the device + // shall create a receiver object (through the receiver service) and assign the + // ReceiverReference to the SourceToken field. When retrieving the RecordingJobConfiguration + // from the device, the AutoCreateReceiver field shall never be present + + uint32 sizeTracks; + + onvif_RecordingJobTrack Tracks[5]; // optional, List of tracks associated with the recording +} onvif_RecordingJobSource; + +typedef struct +{ + char RecordingToken[ONVIF_TOKEN_LEN]; // required, Identifies the recording to which this job shall store the received data + char Mode[16]; // required, The mode of the job. If it is idle, nothing shall happen. If it is active, the device shall try to obtain data from the receivers. + // A client shall use GetRecordingJobState to determine if data transfer is really taking place + // The only valid values for Mode shall be "Idle" or "Active" + int Priority; // required, This shall be a non-negative number. If there are multiple recording jobs that store data to + // the same track, the device will only store the data for the recording job with the highest + // priority. The priority is specified per recording job, but the device shall determine the priority + // of each track individually. If there are two recording jobs with the same priority, the device + // shall record the data corresponding to the recording job that was activated the latest + uint32 sizeSource; + onvif_RecordingJobSource Source[5]; // optional, Source of the recording + + char ScheduleToken[ONVIF_TOKEN_LEN]; // optional, This attribute adds an additional requirement for activating the recording job. + // If this optional field is provided the job shall only record if the schedule exists and is active. +} onvif_RecordingJobConfiguration; + +typedef struct +{ + uint32 ErrorFlag : 1; // Indicates whether the field Error is valid + uint32 Reserved : 31; + + char SourceTag[64]; // required, Identifies the track of the data source that provides the data + char Destination[ONVIF_TOKEN_LEN]; // required, Indicates the destination track + char Error[100]; // optional, Optionally holds an implementation defined string value that describes the error. The string should be in the English language + char State[16]; // required, Provides the job state of the track. + // The valid values of state shall be "Idle", "Active" and "Error". If state equals "Error", the Error field may be filled in with an implementation defined value +} onvif_RecordingJobStateTrack; + +typedef struct +{ + onvif_SourceReference SourceToken; // required, Identifies the data source of the recording job + char State[16]; // required, Holds the aggregated state over all substructures of RecordingJobStateSource + // Idle : All state values in sub-nodes are "Idle" + // PartiallyActive : The state of some sub-nodes are "active" and some sub-nodes are "idle" + // Active : The state of all sub-nodes is "Active" + // Error : At least one of the sub-nodes has state "Error" + uint32 sizeTrack; + + onvif_RecordingJobStateTrack Track[5]; // optional, +} onvif_RecordingJobStateSource; + +typedef struct +{ + char RecordingToken[ONVIF_TOKEN_LEN]; // required, Identification of the recording that the recording job records to + char State[16]; // required, Holds the aggregated state over the whole RecordingJobInformation structure + // Idle : All state values in sub-nodes are "Idle" + // PartiallyActive : The state of some sub-nodes are "active" and some sub-nodes are "idle" + // Active : The state of all sub-nodes is "Active" + // Error : At least one of the sub-nodes has state "Error" + + uint32 sizeSources; + + onvif_RecordingJobStateSource Sources[5]; // optional, Identifies the data source of the recording job +} onvif_RecordingJobStateInformation; + +typedef struct +{ + uint32 SpareFlag : 1; // Indicates whether the field Spare is valid + uint32 CompatibleSourcesFlag : 1; // Indicates whether the field CompatibleSources is valid + uint32 Reserved : 30; + + int Spare; // optional, Number of spare jobs that can be created for the recording + char CompatibleSources[160]; // optional, A device that supports recording of a restricted set of Media Service Profiles returns the list of profiles that can be recorded on the given Recording +} onvif_JobOptions; + +typedef struct +{ + uint32 SpareTotalFlag : 1; // Indicates whether the field SpareTotal is valid + uint32 SpareVideoFlag : 1; // Indicates whether the field SpareVideo is valid + uint32 SpareAudioFlag : 1; // Indicates whether the field SpareAudio is valid + uint32 SpareMetadataFlag : 1; // Indicates whether the field SpareMetadata is valid + uint32 Reserved : 28; + + int SpareTotal; // optional, Total spare number of tracks that can be added to this recording + int SpareVideo; // optional, Number of spare Video tracks that can be added to this recording + int SpareAudio; // optional, Number of spare Aduio tracks that can be added to this recording + int SpareMetadata; // optional, Number of spare Metadata tracks that can be added to this recording +} onvif_TrackOptions; + +typedef struct +{ + onvif_JobOptions Job; // required, + onvif_TrackOptions Track; // required, +} onvif_RecordingOptions; + +typedef struct +{ + char TrackToken[ONVIF_TOKEN_LEN]; // required + + onvif_TrackConfiguration Configuration; // required +} onvif_Track; + +typedef struct _TrackList +{ + struct _TrackList * next; + + onvif_Track Track; +} TrackList; + +typedef struct +{ + char RecordingToken[ONVIF_TOKEN_LEN]; // required + + onvif_RecordingConfiguration Configuration; // required + + TrackList * Tracks; +} onvif_Recording; + +typedef struct +{ + char JobToken[ONVIF_TOKEN_LEN]; // required + + onvif_RecordingJobConfiguration JobConfiguration; // required +} onvif_RecordingJob; + +typedef struct +{ + char Name[ONVIF_NAME_LEN]; // required, Item name + char Value[ONVIF_TOKEN_LEN]; // required, Item value. The type is defined in the corresponding description +} onvif_SimpleItem; + +typedef struct _SimpleItemList +{ + struct _SimpleItemList * next; + + onvif_SimpleItem SimpleItem; // Value name pair as defined by the corresponding description +} SimpleItemList; + +typedef struct +{ + uint32 AnyFlag : 1; + uint32 Reserverd : 31; + + char Name[ONVIF_NAME_LEN]; // required, Item name + char * Any; // optional +} onvif_ElementItem; + +typedef struct _ElementItemList +{ + struct _ElementItemList * next; + + onvif_ElementItem ElementItem; // Value name pair as defined by the corresponding description +} ElementItemList; + +typedef struct +{ + SimpleItemList * SimpleItem; // optional + ElementItemList * ElementItem; // optional +} onvif_ItemList; + +typedef struct +{ + uint32 PropertyOperationFlag : 1; // Indicates whether the field PropertyOperation is valid + uint32 SourceFlag : 1; // Indicates whether the field Source is valid + uint32 KeyFlag : 1; // Indicates whether the field Key is valid + uint32 DataFlag : 1; // Indicates whether the field Data is valid + uint32 Reserved : 28; + + time_t UtcTime; // required + + onvif_ItemList Source; // optional, Token value pairs that triggered this message. Typically only one item is present + onvif_ItemList Key; // optional element of type tt:ItemList */ + onvif_ItemList Data; // optional element of type tt:ItemList */ + + onvif_PropertyOperation PropertyOperation; // optional +} onvif_Message; + +typedef struct +{ + char ConsumerAddress[256]; // required, + char ProducterAddress[256]; // required, + + char Dialect[256]; // required, + char Topic[256]; // required, + + onvif_Message Message; // required +} onvif_NotificationMessage; + +typedef struct +{ + time_t DataFrom; // required, The earliest point in time where there is recorded data on the device + time_t DataUntil; // required, The most recent point in time where there is recorded data on the device + int NumberRecordings; // required, The device contains this many recordings +} onvif_RecordingSummary; + +typedef struct +{ + char TrackToken[ONVIF_TOKEN_LEN]; // required, + + onvif_TrackType TrackType; // required, Type of the track: "Video", "Audio" or "Metadata". + // The track shall only be able to hold data of that type + + char Description[100]; // required, Informative description of the contents of the track + time_t DataFrom; // required, The start date and time of the oldest recorded data in the track + time_t DataTo; // required, The stop date and time of the newest recorded data in the track +} onvif_TrackInformation; + +typedef struct +{ + uint32 EarliestRecordingFlag : 1; // Indicates whether the field EarliestRecording is valid + uint32 LatestRecordingFlag : 1; // Indicates whether the field LatestRecording is valid + uint32 Reserved : 30; + + char RecordingToken[ONVIF_TOKEN_LEN]; // required, + + onvif_RecordingSourceInformation Source; // required, Information about the source of the recording + + time_t EarliestRecording; // optional, + time_t LatestRecording; // optional, + char Content[256]; // required, + + uint32 sizeTrack; + onvif_TrackInformation Track[5]; // optional, Basic information about the track. Note that a track may represent a single contiguous time span or consist of multiple slices + + onvif_RecordingStatus RecordingStatus; // required, +} onvif_RecordingInformation; + +typedef struct +{ + uint32 BitrateFlag : 1; // Indicates whether the field Bitrate is valid + uint32 Reserved : 31; + + int Bitrate; // optional, Average bitrate in kbps + int Width; // required, The width of the video in pixels + int Height; // required, The height of the video in pixels + + onvif_VideoEncoding Encoding; // required, Used video codec, either Jpeg, H.264 or Mpeg4 + + float Framerate; // required, Average framerate in frames per second +} onvif_VideoAttributes; + +typedef struct +{ + uint32 BitrateFlag : 1; // Indicates whether the field Bitrate is valid + uint32 Reserved : 31; + + int Bitrate; // optional, The bitrate in kbps + + onvif_AudioEncoding Encoding; // required, Audio codec used for encoding the audio (either G.711, G.726 or AAC) + + int Samplerate; // required, The sample rate in kHz +} onvif_AudioAttributes; + +typedef struct +{ + uint32 PtzSpacesFlag : 1; // Indicates whether the field PtzSpaces is valid + uint32 Reserved : 31; + + BOOL CanContainPTZ; // required, Indicates that there can be PTZ data in the metadata track in the specified time interval + BOOL CanContainAnalytics; // required, Indicates that there can be analytics data in the metadata track in the specified time interval + BOOL CanContainNotifications; // required, Indicates that there can be notifications in the metadata track in the specified time interval + char PtzSpaces[256]; // optional, List of all PTZ spaces active for recording. Note that events are only recorded on position changes and + // the actual point of recording may not necessarily contain an event of the specified type +} onvif_MetadataAttributes; + +typedef struct +{ + uint32 VideoAttributesFlag : 1; // Indicates whether the field VideoAttributes is valid + uint32 AudioAttributesFlag : 1; // Indicates whether the field AudioAttributes is valid + uint32 MetadataAttributesFlag : 1; // Indicates whether the field MetadataAttributes is valid + uint32 Reserved : 29; + + onvif_TrackInformation TrackInformation; // required, The basic information about the track. Note that a track may represent a single contiguous time span or consist of multiple slices + onvif_VideoAttributes VideoAttributes; // optional, If the track is a video track, exactly one of this structure shall be present and contain the video attributes + onvif_AudioAttributes AudioAttributes; // optional, If the track is an audio track, exactly one of this structure shall be present and contain the audio attributes + onvif_MetadataAttributes MetadataAttributes; // optional, If the track is an metadata track, exactly one of this structure shall be present and contain the metadata attributes +} onvif_TrackAttributes; + +typedef struct _TrackAttributesList +{ + struct _TrackAttributesList * next; + + onvif_TrackAttributes TrackAttributes; +} TrackAttributesList; + +typedef struct +{ + char RecordingToken[ONVIF_TOKEN_LEN]; // required, A reference to the recording that has these attributes + + uint32 sizeTrackAttributes; + onvif_TrackAttributes TrackAttributes[5]; // optional, A set of attributes for each track + + time_t From; // required, The attributes are valid from this point in time in the recording + time_t Until; // required, The attributes are valid until this point in time in the recording. + // Can be equal to 'From' to indicate that the attributes are only known to be valid for this particular point in time +} onvif_MediaAttributes; + +typedef struct +{ + char StorageToken[ONVIF_TOKEN_LEN]; // required, + char RelativePath[256]; // optional, +} onvif_StorageReferencePath; + +typedef struct +{ + char FileName[256]; // required, Exported file name + float Progress; // required, Normalized percentage completion for uploading the exported file +} onvif_FileProgress; + +typedef struct +{ + uint32 sizeFileProgress; // sequence of elements + onvif_FileProgress FileProgress[100]; // optional, Exported file name and export progress information +} onvif_ArrayOfFileProgress; + +typedef struct +{ + uint32 RecordingInformationFilterFlag : 1; // Indicates whether the field RecordingInformationFilter is valid + uint32 Reserved : 31; + + int sizeIncludedSources; + onvif_SourceReference IncludedSources[10]; // optional, A list of sources that are included in the scope. If this list is included, only data from one of these sources shall be searched + + int sizeIncludedRecordings; + char IncludedRecordings[10][ONVIF_TOKEN_LEN]; // optional, A list of recordings that are included in the scope. If this list is included, only data from one of these recordings shall be searched + + char RecordingInformationFilter[128]; // optional, An xpath expression used to specify what recordings to search. + // Only those recordings with an RecordingInformation structure that matches the filter shall be searched +} onvif_SearchScope; + +typedef struct +{ + onvif_PTZVector MinPosition; // required, + onvif_PTZVector MaxPosition; // required, + + BOOL EnterOrExit; // required, +} onvif_PTZPositionFilter; + +typedef struct +{ + char MetadataStreamFilter[100]; // required +} onvif_MetadataFilter; + +typedef struct _RecordingInformationList +{ + struct _RecordingInformationList * next; + + onvif_RecordingInformation RecordingInformation; +} RecordingInformationList; + +typedef struct +{ + onvif_SearchState SearchState; // required, The state of the search when the result is returned. Indicates if there can be more results, or if the search is completed + + RecordingInformationList * RecordInformation; // optional, A RecordingInformation structure for each found recording matching the search +} onvif_FindRecordingResultList; + +typedef struct +{ + char Address[128]; // required, +} onvif_EndpointReferenceType; + +typedef struct +{ + char Dialect[128]; // required, + char Topic[128]; // required, +} onvif_TopicExpressionType; + +typedef struct +{ + uint32 SubscriptionReferenceFlag : 1; // Indicates whether the field SubscriptionReference is valid + uint32 TopicFlag : 1; // Indicates whether the field Topic is valid + uint32 ProducerReferenceFlag : 1; // Indicates whether the field ProducerReference is valid + uint32 Reserved : 31; + + onvif_EndpointReferenceType SubscriptionReference; // optional, + onvif_TopicExpressionType Topic; // optional, + onvif_EndpointReferenceType ProducerReference; // optional, + onvif_Message Message; // required +} onvif_NotificationMessageHolderType; + +typedef struct +{ + char RecordingToken[ONVIF_TOKEN_LEN]; // required, The recording where this event was found. Empty string if no recording is associated with this event + char TrackToken[ONVIF_TOKEN_LEN]; // required, A reference to the track where this event was found. Empty string if no track is associated with this event + time_t Time; // required, The time when the event occured + + onvif_NotificationMessageHolderType Event; // required, The description of the event + + BOOL StartStateEvent; // required, If true, indicates that the event is a virtual event generated for this particular search session to give the state of a property at the start time of the search +} onvif_FindEventResult; + +typedef struct _FindEventResultList +{ + struct _FindEventResultList * next; + + onvif_FindEventResult Result; +} FindEventResultList; + +typedef struct +{ + onvif_SearchState SearchState; // required, The state of the search when the result is returned. Indicates if there can be more results, or if the search is completed + + FindEventResultList * Result; // optional +} onvif_FindEventResultList; + +typedef struct +{ + char RecordingToken[ONVIF_TOKEN_LEN]; // required, The recording where this event was found. Empty string if no recording is associated with this event + char TrackToken[ONVIF_TOKEN_LEN]; // required, A reference to the track where this event was found. Empty string if no track is associated with this event + time_t Time; // required, The time when the event occured +} onvif_FindMetadataResult; + +typedef struct _FindMetadataResultList +{ + struct _FindMetadataResultList * next; + + onvif_FindMetadataResult Result; +} FindMetadataResultList; + +typedef struct +{ + onvif_SearchState SearchState; // required, The state of the search when the result is returned. Indicates if there can be more results, or if the search is completed + + FindMetadataResultList * Result; // optional +} onvif_FindMetadataResultList; + +typedef struct +{ + char RecordingToken[ONVIF_TOKEN_LEN]; // required + char TrackToken[ONVIF_TOKEN_LEN]; // required + time_t Time; // required + + onvif_PTZVector Position; // required +} onvif_FindPTZPositionResult; + +typedef struct _FindPTZPositionResultList +{ + struct _FindPTZPositionResultList * next; + + onvif_FindPTZPositionResult Result; +} FindPTZPositionResultList; + +typedef struct +{ + onvif_SearchState SearchState; // required, The state of the search when the result is returned. Indicates if there can be more results, or if the search is completed + + FindPTZPositionResultList * Result; // optional +} onvif_FindPTZPositionResultList; + + +////////////////////////////////////////////////////////////////////////// +// Video analytics struct defines +////////////////////////////////////////////////////////////////////////// + +typedef struct +{ + uint32 attrFlag : 1; + uint32 reserved : 31; + + onvif_ItemList Parameters; // required + + char Name[ONVIF_NAME_LEN]; // required + char Type[100]; // required + char attr[256]; +} onvif_Config; + +typedef struct _ConfigList +{ + struct _ConfigList * next; + + onvif_Config Config; +} ConfigList; + +typedef struct +{ + ConfigList * AnalyticsModule; // optional +} onvif_AnalyticsEngineConfiguration; + +typedef struct +{ + ConfigList * Rule; // optional +} onvif_RuleEngineConfiguration; + +typedef struct +{ + char Name[ONVIF_NAME_LEN]; // required + int UseCount; // required + char token[ONVIF_TOKEN_LEN]; // required + + onvif_AnalyticsEngineConfiguration AnalyticsEngineConfiguration; // required + onvif_RuleEngineConfiguration RuleEngineConfiguration; // required +} onvif_VideoAnalyticsConfiguration; + +typedef struct +{ + char Name[ONVIF_NAME_LEN]; // required + char Type[100]; // required +} onvif_SimpleItemDescription; + +typedef struct _SimpleItemDescriptionList +{ + struct _SimpleItemDescriptionList * next; + + onvif_SimpleItemDescription SimpleItemDescription; +} SimpleItemDescriptionList; + +typedef struct +{ + SimpleItemDescriptionList * SimpleItemDescription; + SimpleItemDescriptionList * ElementItemDescription; +} onvif_ItemListDescription; + +typedef struct +{ + uint32 SourceFlag : 1; // Indicates whether the field Source is valid + uint32 KeyFlag : 1; // Indicates whether the field Source is valid + uint32 DataFlag : 1; // Indicates whether the field Source is valid + uint32 IsPropertyFlag : 1; // Indicates whether the field Source is valid + uint32 Reserved : 28; + + onvif_ItemListDescription Source; // optional + onvif_ItemListDescription Key; // optional + onvif_ItemListDescription Data; // optional + + BOOL IsProperty; // optional + char ParentTopic[100]; // required +} onvif_ConfigDescription_Messages; + +typedef struct _ConfigDescription_MessagesList +{ + struct _ConfigDescription_MessagesList * next; + + onvif_ConfigDescription_Messages Messages; +} ConfigDescription_MessagesList; + +typedef struct +{ + uint32 fixedFlag : 1; // Indicates whether the field fixed is valid + uint32 maxInstancesFlag : 1; // Indicates whether the field maxInstances is valid + uint32 Reserved : 30; + + onvif_ItemListDescription Parameters; // required + + ConfigDescription_MessagesList * Messages; + + char Name[ONVIF_NAME_LEN]; // required, The Name attribute (e.g. "tt::LineDetector") uniquely identifies the type of rule, not a type definition in a schema + BOOL fixed; // optional, The fixed attribute signals that it is not allowed to add or remove this type of configuration + int maxInstances; // optional, The maxInstances attribute signals the maximum number of instances per configuration +} onvif_ConfigDescription; + +typedef struct +{ + uint32 RuleTypeFlag : 1; // Indicates whether the field RuleType is valid + uint32 AnalyticsModuleFlag : 1; // Indicates whether the field AnalyticsModule is valid + uint32 Reserved : 30; + + char RuleType[100]; // optional, The RuleType the ConfigOptions applies to if the Name attribute is ambiguous. + char Name[ONVIF_NAME_LEN]; // required, The Name of the SimpleItemDescription/ElementItemDescription + // the ConfigOptions applies to + char Type[100]; // required, Type of the Rule Options represented by a unique QName. + // The Type defines the element contained in this structure + char AnalyticsModule[100]; // optional, Optional name of the analytics module this constraint applies to. + // This option is only necessary in cases where different constraints for elements with the same Name exist. + char * any; +} onvif_ConfigOptions; + +typedef struct _ConfigOptionsList +{ + struct _ConfigOptionsList * next; + + onvif_ConfigOptions Options; +} ConfigOptionsList; + +typedef struct _ConfigDescriptionList +{ + struct _ConfigDescriptionList * next; + + onvif_ConfigDescription ConfigDescription; +} ConfigDescriptionList; + +typedef struct +{ + uint32 LimitFlag : 1; // Indicates whether the field Limit is valid + uint32 Reserved : 31; + + uint32 sizeRuleContentSchemaLocation; + char RuleContentSchemaLocation[10][256]; // optional, Lists the location of all schemas that are referenced in the rules + + ConfigDescriptionList * RuleDescription; // List of rules supported by the Video Analytics configuration + + int Limit; // optional, Maximum number of concurrent instances +} onvif_SupportedRules; + +typedef struct +{ + uint32 sizeAnalyticsModuleContentSchemaLocation; // sequence of elements + char AnalyticsModuleContentSchemaLocation[10][128]; // It optionally contains a list of URLs that provide the location of schema files + // These schema files describe the types and elements used in the analytics module descriptions. + // If the analytics module descriptions reference types or elements of the ONVIF schema file, + // the ONVIF schema file MUST be explicitly listed + + ConfigDescriptionList * AnalyticsModuleDescription; // optional, +} onvif_SupportedAnalyticsModules; + +typedef struct +{ + char Type[128]; // required, Type of the Analytics Module Options represented by a unique QName. + // The Type defines the element contained in this structure +} onvif_AnalyticsModuleConfigOptions; + +typedef struct _AnalyticsModuleConfigOptionsList +{ + struct _AnalyticsModuleConfigOptionsList * next; + + onvif_AnalyticsModuleConfigOptions Options; +} AnalyticsModuleConfigOptionsList; + +typedef struct +{ + char Dialect[128]; + char Expression[256]; +} onvif_EventFilterItem; + +typedef struct +{ + int sizeTopicExpression; + int sizeMessageContent; + + onvif_EventFilterItem TopicExpression[5]; + onvif_EventFilterItem MessageContent[5]; +} onvif_EventFilter; + +typedef struct +{ + uint32 AnalyticsFlag : 1; // Indicates whether the field Analytics is valid + uint32 PTZStatusFlag : 1; // Indicates whether the field PTZStatus is valid + uint32 EventsFlag : 1; // Indicates whether the field Events is valid + uint32 CompressionTypeFlag : 1; // Indicates whether the field CompressionType is valid + uint32 AnalyticsEngineConfigurationFlag : 1; // Indicates whether the field AnalyticsEngineConfiguration is valid + uint32 GeoLocation : 1; // Optional parameter to configure if the metadata stream shall contain the Geo Location coordinates of each target + uint32 ShapePolygon : 1; // Optional parameter to configure if the generated metadata stream should contain shape information as polygon + uint32 Reserved : 25; + + char Name[ONVIF_NAME_LEN]; // required , User readable name. Length up to 64 characters + int UseCount; // required, Number of internal references currently using this configuration. This parameter is read-only and cannot be changed by a set request + char token[ONVIF_TOKEN_LEN]; // required, Token that uniquely refernces this configuration. Length up to 64 characters + BOOL Analytics; // optional, Defines whether the streamed metadata will include metadata from the analytics engines (video, cell motion, audio etc.) + int SessionTimeout; // required, The rtsp session timeout for the related audio stream, unit is second + char CompressionType[100]; // optional, Optional parameter to configure compression type of Metadata payload. Use values from enumeration MetadataCompressionType + // None,GZIP,EXI + + onvif_PTZFilter PTZStatus; // optional, optional element to configure which PTZ related data is to include in the metadata stream + onvif_EventSubscription Events; // optional, Optional element to configure the streaming of events. A client might be interested in receiving all, + // none or some of the events produced by the device: + // To get all events: Include the Events element but do not include a filter. + // To get no events: Do not include the Events element. + // To get only some events: Include the Events element and include a filter in the element. + onvif_MulticastConfiguration Multicast; // required, defines the multicast settings that could be used for video streaming + onvif_AnalyticsEngineConfiguration AnalyticsEngineConfiguration; //optional, Defines whether the streamed metadata will include metadata from the analytics engines (video, cell motion, audio etc.) +} onvif_MetadataConfiguration; + +typedef struct +{ + uint32 attrFlag : 1; + uint32 reserved : 31; + + char Type[128]; // required, Reference to an AnalyticsModule Type + char attr[256]; + char * Frame; // required, Sample frame content starting with the tt:Frame node +} onvif_MetadataInfo; + +typedef struct _MetadataInfoList +{ + struct _MetadataInfoList * next; + + onvif_MetadataInfo MetadataInfo; +} MetadataInfoList; + +// PROFILE C Define Begin + +/** + * The AccessPoint capabilities reflect optional functionality of a particular physical entity. + * Different AccessPoint instances may have different set of capabilities. + * This information maychange during device operation, e.g. if hardware settings are changed. + */ +typedef struct +{ + uint32 DisableAccessPoint : 1; // required, Indicates whether or not this AccessPoint instance supports EnableAccessPoint and DisableAccessPoint commands + uint32 Duress : 1; // optional, Indicates whether or not this AccessPoint instance supports generation of duress events + uint32 AnonymousAccess : 1; // optional, Indicates whether or not this AccessPoint has a REX switch or other input that allows anonymous access + uint32 AccessTaken : 1; // optional, Indicates whether or not this AccessPoint instance supports generation of AccessTaken and AccessNotTaken events. + // If AnonymousAccess and AccessTaken are both true, it indicates that the Anonymous versions of AccessTaken and AccessNotTaken are supported + uint32 ExternalAuthorization : 1; // optional, Indicates whether or not this AccessPoint instance supports the ExternalAuthorization operation and the generation of Request events. + // If AnonymousAccess and ExternalAuthorization are both true, it indicates that the Anonymous version is supported as well + uint32 IdentifierAccess : 1; // optional, Indicates whether or not this access point supports the AccessControl/Request/Identifier + // event to request external authorization. + uint32 SupportedRecognitionTypesFlag : 1; // Indicates whether the field SupportedRecognitionTypes is valid + uint32 SupportedFeedbackTypesFlag : 1; // Indicates whether the field SupportedFeedbackTypes is valid + uint32 Reserved : 24; + + char SupportedRecognitionTypes[200]; // optional, A list of recognition types that the device supports + char SupportedFeedbackTypes[200]; // optional, List of supported feedback types +} onvif_AccessPointCapabilities; + +/** + * The AccessPointInfo structure contains basic information about an AccessPoint instance. + * An AccessPoint defines an entity a Credential can be granted or denied access to. + * TheAccessPointInfo provides basic information on how access is controlled in one direction for adoor (from which area to which area). + * door is the typical device involved, but other type ofdevices may be supported as well. + * Multiple AccessPoints may cover the same Door.A typical case is one AccessPoint for entry and another for exit, both referencingthe same Door. + * An ONVIF compliant device shall provide the following fields for each AccessPoint instance + */ +typedef struct +{ + uint32 DescriptionFlag : 1; // Indicates whether the field Description is valid + uint32 AreaFromFlag : 1; // Indicates whether the field AreaFrom is valid + uint32 AreaToFlag : 1; // Indicates whether the field AreaTo is valid + uint32 EntityTypeFlag : 1; // Indicates whether the field EntityType is valid + uint32 EntityTypeAttrFlag : 1; // Indicates whether the field EntityTypeAttr is valid + uint32 Reserved : 27; + + char token[ONVIF_TOKEN_LEN]; // required + char Name[ONVIF_NAME_LEN]; // required, A user readable name. It shall be up to 64 characters + char Description[1024]; // optional, Optional user readable description for the AccessPoint. It shall be up to 1024 characters + char AreaFrom[ONVIF_TOKEN_LEN]; // optional, Optional reference to the Area from which access is requested + char AreaTo[ONVIF_TOKEN_LEN]; // optional, Optional reference to the Area to which access is requested + char EntityType[100]; // optional, Optional entity type; if missing, a Door type as defined by the ONVIF DoorControl service should be assumed. + // This can also be represented by the QName value "tdc:Door" - where tdc is the namespace of the Door Control service. + // This field is provided for future extensions; it will allow an AccessPoint being extended to cover entity types other than Doors as well + char EntityTypeAttr[256]; + char Entity[ONVIF_TOKEN_LEN]; // required, Reference to the entity used to control access; the entity type may be specified by the optional EntityType field explained below but is typically a Door + + onvif_AccessPointCapabilities Capabilities; // required, The capabilities for the AccessPoint +} onvif_AccessPointInfo; + +typedef struct _AccessPointList +{ + struct _AccessPointList * next; + + uint32 Enabled : 1; // Indicates that the AccessPoint is enabled. By default this field value shall be True, if the DisableAccessPoint capabilities is not supported + uint32 AuthenticationProfileTokenFlag : 1; // Indicates whether the field AuthenticationProfileToken is valid + uint32 Reserved : 30; + + onvif_AccessPointInfo AccessPointInfo; + + char AuthenticationProfileToken[ONVIF_TOKEN_LEN]; // A reference to an authentication profile which defines the authentication behavior of the access point +} AccessPointList; + +/** + * DoorCapabilities reflect optional functionality of a particular physical entity. + * Different door instances may have different set of capabilities. + * This information may change during device operation, e.g. if hardware settings are changed + */ +typedef struct +{ + BOOL Access; // optional, Indicates whether or not this Door instance supports AccessDoor command to perform momentary access + BOOL AccessTimingOverride; // optional, Indicates that this Door instance supports overriding configured timing in the AccessDoor command + BOOL Lock; // optional, Indicates that this Door instance supports LockDoor command to lock the door + BOOL Unlock; // optional, Indicates that this Door instance supports UnlockDoor command to unlock the door + BOOL Block; // optional, Indicates that this Door instance supports BlockDoor command to block the door + BOOL DoubleLock; // optional, Indicates that this Door instance supports DoubleLockDoor command to lock multiple locks on the door + BOOL LockDown; // optional, Indicates that this Door instance supports LockDown (and LockDownRelease) commands to lock the door and put it in LockedDown mode + BOOL LockOpen; // optional, Indicates that this Door instance supports LockOpen (and LockOpenRelease) commands to unlock the door and put it in LockedOpen mode + BOOL DoorMonitor; // optional, Indicates that this Door instance has a DoorMonitor and supports the DoorPhysicalState event + BOOL LockMonitor; // optional, Indicates that this Door instance has a LockMonitor and supports the LockPhysicalState event + BOOL DoubleLockMonitor; // optional, Indicates that this Door instance has a DoubleLockMonitor and supports the DoubleLockPhysicalState event + BOOL Alarm; // optional, Indicates that this Door instance supports door alarm and the DoorAlarm event + BOOL Tamper; // optional, Indicates that this Door instance has a Tamper detector and supports the DoorTamper event + BOOL Fault; // optional, Indicates that this Door instance supports door fault and the DoorFault event +} onvif_DoorCapabilities; + +// Tampering information for a Door +typedef struct +{ + uint32 ReasonFlag : 1; // Indicates whether the field Reason is valid + uint32 Reserved : 31; + + char Reason[100]; // optional, Optional field; Details describing tampering state change (e.g., reason, place and time). + // NOTE: All fields (including this one) which are designed to give end-user prompts can be localized to the customers's native language + onvif_DoorTamperState State; // required, State of the tamper detector +} onvif_DoorTamper; + +// Fault information for a Door +typedef struct +{ + uint32 ReasonFlag : 1; // Indicates whether the field Reason is valid + uint32 Reserved : 31; + + char Reason[100]; // optional, Optional reason for fault + + onvif_DoorFaultState State; // required, Overall fault state for the door; it is of type DoorFaultState. If there are any faults, the value shall be: FaultDetected. + // Details of the detected fault shall be found in the Reason field, and/or the various DoorState fields and/or in extensions to this structure +} onvif_DoorFault; + +// The DoorState structure contains current aggregate runtime status of Door +typedef struct +{ + uint32 DoorPhysicalStateFlag : 1; // Indicates whether the field DoorPhysicalState is valid + uint32 LockPhysicalStateFlag : 1; // Indicates whether the field LockPhysicalState is valid + uint32 DoubleLockPhysicalStateFlag : 1; // Indicates whether the field DoubleLockPhysicalState is valid + uint32 AlarmFlag : 1; // Indicates whether the field Alarm is valid + uint32 TamperFlag : 1; // Indicates whether the field Tamper is valid + uint32 FaultFlag : 1; // Indicates whether the field Fault is valid + uint32 Reserved : 26; + + onvif_DoorPhysicalState DoorPhysicalState; // optional, Physical state of Door; it is of type DoorPhysicalState. + // A device that signals support for DoorMonitor capability for a particular door instance shall provide this field + onvif_LockPhysicalState LockPhysicalState; // optional, Physical state of the Lock; it is of type LockPhysicalState. + // A device that signals support for LockMonitor capability for a particular door instance shall provide this field + onvif_LockPhysicalState DoubleLockPhysicalState; // optional, Physical state of the DoubleLock; it is of type LockPhysicalState. + // A device that signals support for DoubleLockMonitor capability for a particular door instance shall provide this field + onvif_DoorAlarmState Alarm; // optional, Alarm state of the door; it is of type DoorAlarmState. + // A device that signals support for Alarm capability for a particular door instance shall provide this field + onvif_DoorTamper Tamper; // optional, Tampering state of the door; it is of type DoorTamper. + // A device that signals support for Tamper capability for a particular door instance shall provide this field + onvif_DoorFault Fault; // optional, Fault information for door; it is of type DoorFault. + // A device that signals support for Fault capability for a particular door instance shall provide this field + onvif_DoorMode DoorMode; // required, The logical operating mode of the door; it is of type DoorMode. An ONVIF compatible device shall report current operating mode in this field +} onvif_DoorState; + +typedef struct +{ + uint32 ExtendedReleaseTimeFlag : 1; // Indicates whether the field ExtendedReleaseTime is valid + uint32 DelayTimeBeforeRelockFlag : 1; // Indicates whether the field DelayTimeBeforeRelock is valid + uint32 ExtendedOpenTimeFlag : 1; // Indicates whether the field ExtendedOpenTime is valid + uint32 PreAlarmTimeFlag : 1; // Indicates whether the field PreAlarmTime is valid + uint32 Reserved : 28; + + uint32 ReleaseTime; // external, When access is granted (door mode becomes Accessed), the latch is unlocked. + // ReleaseTime is the time from when the latch is unlocked until it is + // relocked again (unless the door is physically opened), unit is second + uint32 OpenTime; // external, The time from when the door is physically opened until the door is set in the + // DoorOpenTooLong alarm state, unit is second + uint32 ExtendedReleaseTime; // optional, Some individuals need extra time to open the door before the latch relocks. + // If supported, ExtendedReleaseTime shall be added to ReleaseTime if UseExtendedTime + // is set to true in the AccessDoor command, unit is second + uint32 DelayTimeBeforeRelock; // optional, If the door is physically opened after access is granted, then DelayTimeBeforeRelock is the time from when the door is physically + // opened until the latch goes back to locked state, unit is second + uint32 ExtendedOpenTime; // optional, Some individuals need extra time to pass through the door. If supported, + // ExtendedOpenTime shall be added to OpenTime if UseExtendedTime + // is set to true in the AccessDoor command. unit is second + uint32 PreAlarmTime; // optional, Before a DoorOpenTooLong alarm state is generated, a signal will sound to indicate that the door must be closed. + // PreAlarmTime defines how long before DoorOpenTooLong the warning signal shall sound, unit is second +} onvif_Timings; + +/** + * The DoorInfo type represents the Door as a physical object. + * The structure contains information and capabilities of a specific door instance + */ +typedef struct +{ + uint32 DescriptionFlag : 1; // Indicates whether the field Description is valid + uint32 Reserved : 31; + + char token[ONVIF_TOKEN_LEN]; // required + char Name[ONVIF_NAME_LEN]; // required, A user readable name. It shall be up to 64 characters + char Description[1024]; // optional, A user readable description. It shall be up to 1024 characters + + onvif_DoorCapabilities Capabilities; // required, The capabilities of the Door +} onvif_DoorInfo; + +typedef struct _DoorInfoList +{ + struct _DoorInfoList * next; + + onvif_DoorInfo DoorInfo; +} DoorInfoList; + +typedef struct +{ + onvif_DoorInfo DoorInfo; // Door information + + char DoorType[64]; // required, The type of door. Is of type text. Can be either one of the following reserved ONVIF types: + // "pt:Door", "pt:ManTrap", "pt:Turnstile", "pt:RevolvingDoor", + // "pt:Barrier", or a custom defined type + onvif_Timings Timings; // required, A structure defining times such as how long the door is unlocked when accessed, extended grant time, etc. +} onvif_Door; + +typedef struct _DoorList +{ + struct _DoorList * next; + + onvif_Door Door; +} DoorList; + +/** + * The AreaInfo structure contains basic information about an Area + */ +typedef struct +{ + uint32 DescriptionFlag : 1; // Indicates whether the field Description is valid + uint32 Reserved : 31; + + char token[ONVIF_TOKEN_LEN]; // required + char Name[ONVIF_NAME_LEN]; // required, A user readable name. It shall be up to 64 characters + char Description[1024]; // optional, A user readable description. It shall be up to 1024 characters +} onvif_AreaInfo; + +typedef struct _AreaList +{ + struct _AreaList * next; + + onvif_AreaInfo AreaInfo; +} AreaList; + + +// PROFILE C Define End + +// DEVICEIO Define Begin + +// A pane layout describes one Video window of a display. It links a pane configuration to a region of the screen +typedef struct +{ + char Pane[ONVIF_TOKEN_LEN]; // required, Reference to the configuration of the streaming and coding parameters + + onvif_Rectangle Area; // required, Describes the location and size of the area on the monitor. + // The area coordinate values are espressed in normalized units [-1.0, 1.0] +} onvif_PaneLayout; + +typedef struct _PaneLayoutList +{ + struct _PaneLayoutList * next; + + onvif_PaneLayout PaneLayout; // required +} PaneLayoutList; + +// A layout describes a set of Video windows that are displayed simultaniously on a display +typedef struct +{ + PaneLayoutList * PaneLayout; // required, List of panes assembling the display layout +} onvif_Layout; + +// Representation of a physical video outputs +typedef struct +{ + uint32 ResolutionFlag : 1; // Indicates whether the field Resolution is valid + uint32 RefreshRateFlag : 1; // Indicates whether the field RefreshRate is valid + uint32 AspectRatioFlag : 1; // Indicates whether the field AspectRatio is valid + uint32 Reserved : 29; + + char token[ONVIF_TOKEN_LEN]; // required, + + onvif_Layout Layout; // required, + onvif_VideoResolution Resolution; // optional, Resolution of the display in Pixel + + float RefreshRate; // optional, Refresh rate of the display in Hertz + float AspectRatio; // optional, Aspect ratio of the display as physical extent of width divided by height +} onvif_VideoOutput; + +typedef struct _VideoOutputList +{ + struct _VideoOutputList * next; + + onvif_VideoOutput VideoOutput; +} VideoOutputList; + +typedef struct +{ + char Name[ONVIF_NAME_LEN]; // required + int UseCount; // required + char token[ONVIF_TOKEN_LEN]; // required + char OutputToken[ONVIF_TOKEN_LEN]; // required +} onvif_VideoOutputConfiguration; + +typedef struct _VideoOutputConfigurationList +{ + struct _VideoOutputConfigurationList * next; + + onvif_VideoOutputConfiguration Configuration; +} VideoOutputConfigurationList; + +typedef struct +{ + char token[ONVIF_TOKEN_LEN]; // required, +} onvif_AudioOutput; + +typedef struct _AudioOutputList +{ + struct _AudioOutputList * next; + + onvif_AudioOutput AudioOutput; +} AudioOutputList; + +typedef struct +{ + uint32 sizeOutputTokensAvailable; + char OutputTokensAvailable[5][ONVIF_TOKEN_LEN]; // required, Tokens of the physical Audio outputs (typically one) + uint32 sizeSendPrimacyOptions; + char SendPrimacyOptions[5][100]; // optional, The following modes for the Send-Primacy are defined: + // www.onvif.org/ver20/HalfDuplex/Server + // www.onvif.org/ver20/HalfDuplex/Client + // www.onvif.org/ver20/HalfDuplex/Auto + + onvif_IntRange OutputLevelRange; // required, Minimum and maximum level range supported for this Output +} onvif_AudioOutputConfigurationOptions; + +typedef struct +{ + uint32 SendPrimacyFlag : 1; // Indicates whether the field SendPrimacy is valid + uint32 Reserved : 31; + + char Name[ONVIF_NAME_LEN]; // required, + int UseCount; // required, + char token[ONVIF_TOKEN_LEN]; // required, + char OutputToken[ONVIF_TOKEN_LEN]; // required, Token of the phsycial Audio output + char SendPrimacy[100]; // optional, The following modes for the Send-Primacy are defined: + // www.onvif.org/ver20/HalfDuplex/Server + // www.onvif.org/ver20/HalfDuplex/Client + // www.onvif.org/ver20/HalfDuplex/Auto + int OutputLevel; // required, Volume setting of the output. The applicable range is defined via the option AudioOutputOptions.OutputLevelRange +} onvif_AudioOutputConfiguration; + +typedef struct _AudioOutputConfigurationList +{ + struct _AudioOutputConfigurationList * next; + + onvif_AudioOutputConfigurationOptions Options; + onvif_AudioOutputConfiguration Configuration; +} AudioOutputConfigurationList; + +typedef struct +{ + onvif_RelayMode Mode; // required, 'Bistable' or 'Monostable' + int DelayTime; // external, Time after which the relay returns to its idle state if it is in monostable mode. + // If the Mode field is set to bistable mode the value of the parameter can be ignored + onvif_RelayIdleState IdleState; // required, 'open' or 'closed' +} onvif_RelayOutputSettings; + +typedef struct +{ + uint32 RelayMode_BistableFlag : 1; + uint32 RelayMode_MonostableFlag : 1; + uint32 DelayTimesFlag : 1; // Indicates whether the field DelayTimes is valid + uint32 DiscreteFlag : 1; // Indicates whether the field Discrete is valid + uint32 Reserved : 28; + + char DelayTimes[100]; // optional, Supported delay time range or discrete values in seconds. This element must be present if MonoStable mode is supported. + BOOL Discrete; // optional, True if the relay only supports the exact values for the DelayTimes listed. Default is false + char token[ONVIF_TOKEN_LEN]; // required, Token of the relay output +} onvif_RelayOutputOptions; + +typedef struct _RelayOutputOptionsList +{ + struct _RelayOutputOptionsList * next; + + onvif_RelayOutputOptions Options; +} RelayOutputOptionsList; + +typedef struct +{ + char token[ONVIF_TOKEN_LEN]; // required + + onvif_RelayOutputSettings Properties; // required +} onvif_RelayOutput; + +typedef struct _RelayOutputList +{ + struct _RelayOutputList * next; + + onvif_RelayOutput RelayOutput; +} RelayOutputList; + +typedef struct +{ + uint32 IdleStateFlag : 1; // Indicates whether the field IdleState is valid + uint32 Reserved : 31; + + char token[ONVIF_TOKEN_LEN]; // required + + onvif_DigitalIdleState IdleState; // optional, Indicate the Digital IdleState status +} onvif_DigitalInput; + +typedef struct +{ + uint32 DigitalIdleState_closedFlag : 1; + uint32 DigitalIdleState_openFlag : 1; + uint32 Reserved : 30; +} onvif_DigitalInputConfigurationOptions; + +typedef struct _DigitalInputList +{ + struct _DigitalInputList * next; + + onvif_DigitalInput DigitalInput; +} DigitalInputList; + +typedef struct +{ + int BaudRate; // required, The transfer bitrate + int CharacterLength; // required, The bit length for each character + float StopBit; // required, The number of stop bits used to terminate each character + char token[ONVIF_TOKEN_LEN]; // required, + + onvif_ParityBit ParityBit; // required, The parity for the data error detection + onvif_SerialPortType type; // required, +} onvif_SerialPortConfiguration; + +typedef struct +{ + onvif_IntList BaudRateList; // required, The list of configurable transfer bitrate + onvif_ParityBitList ParityBitList; // required, The list of configurable parity for the data error detection + onvif_IntList CharacterLengthList; // required, The list of configurable bit length for each character + onvif_FloatList StopBitList; // required, The list of configurable number of stop bits used to terminate each character + + char token[ONVIF_TOKEN_LEN]; // required, +} onvif_SerialPortConfigurationOptions; + +typedef struct +{ + char token[ONVIF_TOKEN_LEN]; // required +} onvif_SerialPort; + +typedef struct _SerialPortList +{ + struct _SerialPortList * next; + + onvif_SerialPortConfiguration Configuration; + onvif_SerialPortConfigurationOptions Options; + onvif_SerialPort SerialPort; +} SerialPortList; + +typedef union +{ + char * Binary; + char * String; +} onvif_union_SerialData; + +typedef struct +{ + int _union_SerialData; // 0 - Binary; 1 - String + + onvif_union_SerialData union_SerialData; +} onvif_SerialData; + +typedef struct +{ + uint32 SerialDataFlag : 1; // Indicates whether the field SerialData is valid + uint32 TimeOutFlag : 1; // Indicates whether the field TimeOut is valid + uint32 DataLengthFlag : 1; // Indicates whether the field DataLength is valid + uint32 DelimiterFlag : 1; // Indicates whether the field Delimiter is valid + uint32 Reserved : 28; + + onvif_SerialData SerialData; // optional, The serial port data + + uint32 TimeOut; // optional, Indicates that the command should be responded back within the specified period of time + int DataLength; // optional, This element may be put in the case that data length returned from the connected serial device is already determined as some fixed bytes length. + // It indicates the length of received data which can be regarded as available + char Delimiter[100]; // optional, This element may be put in the case that the delimiter codes returned from the connected serial device is already known. + // It indicates the termination data sequence of the responded data. In case the string has more than one character a device shall interpret the whole string as a single delimiter. + // Furthermore a device shall return the delimiter character(s) to the client +} onvif_SendReceiveSerialCommand; + + +// DEVICEIO Define End + +// MEDIA2 Define Begin + +typedef struct +{ + uint32 GovLengthRangeFlag : 1; // Indicates whether the field GovLengthRange is valid + uint32 FrameRatesSupportedFlag : 1; // Indicates whether the field FrameRatesSupported is valid + uint32 ProfilesSupportedFlag : 1; // Indicates whether the field ProfilesSupported is valid + uint32 ConstantBitRateSupportedFlag : 1; // Indicates whether the field ConstantBitRateSupported is valid + uint32 MaxAnchorFrameDistanceFlag : 1; // Indicates whether the field MaxAnchorFrameDistance is valid + uint32 ConstantBitRateSupported : 1; // optional, Signal whether enforcing constant bitrate is supported + uint32 GuaranteedFrameRateSupported : 1; // Indicates the support for the GuaranteedFrameRate attribute on the VideoEncoder2Configuration element + uint32 Reserved : 25; + + char Encoding[64]; // required, Mime name of the supported Video format + // JPEG, MP4V-ES, H264, H265 + + onvif_VideoEncoding VideoEncoding; // media server 1 field + + onvif_FloatRange QualityRange; // required, Range of the quality values. A high value means higher quality + onvif_VideoResolution ResolutionsAvailable[MAX_RES_NUMS]; // required, List of supported image sizes + onvif_IntRange BitrateRange; // required, Supported range of encoded bitrate in kbps + + char GovLengthRange[100]; // optional, Lower and Upper bounds for the supported group of Video frames length. + // This value typically corresponds to the I-Frame distance + int MaxAnchorFrameDistance; // optional, Signals support for B-Frames. Upper bound for the supported anchor frame distance (must be larger than one) + char FrameRatesSupported[100]; // optional, List of supported target frame rates in fps (frames per second). + // The list shall be sorted with highest values first + char ProfilesSupported[256]; // optional, List of supported encoder profiles + // Simple + // AdvancedSimple + // Baseline + // Main + // Main10 + // Extended + // High +} onvif_VideoEncoder2ConfigurationOptions; + +typedef struct _VideoEncoder2ConfigurationOptionsList +{ + struct _VideoEncoder2ConfigurationOptionsList * next; + + onvif_VideoEncoder2ConfigurationOptions Options; +} VideoEncoder2ConfigurationOptionsList; + +typedef struct +{ + uint32 ConstantBitRateFlag : 1; // Indicates whether the field ConstantBitRate is valid + uint32 Reserved : 31; + + float FrameRateLimit; // required, Desired frame rate in fps. The actual rate may be lower due to e.g. performance limitations + int BitrateLimit; // required, the maximum output bitrate in kbps + BOOL ConstantBitRate; // optional, Enforce constant bitrate + + int EncodingInterval; // required, The media server field +} onvif_VideoRateControl2; + +typedef struct +{ + uint32 RateControlFlag : 1; // Indicates whether the field RateControl is valid + uint32 MulticastFlag : 1; // Indicates whether the field Multicast is valid + uint32 GovLengthFlag : 1; // Indicates whether the field GovLength is valid + uint32 ProfileFlag : 1; // Indicates whether the field Profile is valid + uint32 AnchorFrameDistanceFlag : 1; // Indicates whether the field AnchorFrameDistance is valid + uint32 GuaranteedFrameRate : 1; // A value of true indicates that frame rate is a fixed value rather than an upper limit, + // and that the video encoder shall prioritize frame rate over all other adaptable + // configuration values such as bitrate. Default is false. + uint32 Reserved : 26; + + char Name[ONVIF_NAME_LEN]; // required + int UseCount; // required + char token[ONVIF_TOKEN_LEN]; // required + char Encoding[64]; // required, Mime name of the supported video format. + // JPEG, MP4V-ES, H264, H265 + onvif_VideoEncoding VideoEncoding; // required, the media 1 service field + + onvif_VideoResolution Resolution; // required, Configured video resolution + onvif_VideoRateControl2 RateControl; // optional, Optional element to configure rate control related parameters + onvif_MulticastConfiguration Multicast; // optional, Defines the multicast settings that could be used for video streaming + + float Quality; // required, Relative value for the video quantizers and the quality of the video. + // A high value within supported quality range means higher quality + int GovLength; // optional, Group of Video frames length. Determines typically the interval in which the I-Frames will be coded. + // An entry of 1 indicates I-Frames are continuously generated. An entry of 2 indicates that every 2nd image is an I-Frame, and 3 only every 3rd frame, etc. + // The frames in between are coded as P or B Frames + char Profile[64]; // optional, The encoder profile + // Simple + // AdvancedSimple + // Baseline + // Main + // Main10 + // Extended + // High + + int AnchorFrameDistance; // Distance between anchor frames of type I-Frame and P-Frame. '1' indicates no B-Frames, '2' indicates that every 2nd frame is encoded as B-Frame, '3' indicates a structure like IBBPBBP..., etc. + + int SessionTimeout; // required, the media service field +} onvif_VideoEncoder2Configuration; + +typedef struct _VideoEncoder2ConfigurationList +{ + struct _VideoEncoder2ConfigurationList * next; + + onvif_VideoEncoder2Configuration Configuration; +} VideoEncoder2ConfigurationList; + +typedef struct +{ + uint32 MulticastFlag : 1; // Indicates whether the field Multicast is valid + uint32 Reserved : 31; + + char Name[ONVIF_NAME_LEN]; // required + int UseCount; // required + char token[ONVIF_TOKEN_LEN]; // required + char Encoding[32]; // required, Mime name of the supported audio format + // PCMU, G726, MP4A-LATM(AAC) + + onvif_AudioEncoding AudioEncoding; // required, the media service field + + onvif_MulticastConfiguration Multicast; // optional, Optional multicast configuration of the audio stream + int Bitrate; // required, The output bitrate in kbps + int SampleRate; // required, The output sample rate in kHz + + int SessionTimeout; // required, the media service field +} onvif_AudioEncoder2Configuration; + +typedef struct +{ + char Encoding[32]; // required, Mime name of the supported audio format + // PCMU, G726, MP4A-LATM(AAC) + onvif_AudioEncoding AudioEncoding; // media server 1 field + + onvif_IntList BitrateList; // required, List of supported bitrates in kbps for the specified Encoding + onvif_IntList SampleRateList; // required, List of supported Sample Rates in kHz for the specified Encoding +} onvif_AudioEncoder2ConfigurationOptions; + +typedef struct _AudioEncoder2ConfigurationOptionsList +{ + struct _AudioEncoder2ConfigurationOptionsList * next; + + onvif_AudioEncoder2ConfigurationOptions Options; +} AudioEncoder2ConfigurationOptionsList; + +typedef struct _AudioEncoder2ConfigurationList +{ + struct _AudioEncoder2ConfigurationList * next; + + onvif_AudioEncoder2Configuration Configuration; +} AudioEncoder2ConfigurationList; + +typedef struct +{ + uint32 TokenFlag : 1; // Indicates whether the field Token is valid + uint32 Reserved : 31; + + char Type[32]; // required, Type of the configuration + // All, VideoSource, VideoEncoder, AudioSource, AudioEncoder, + // AudioOutput, AudioDecoder, Metadata, Analytics, PTZ + char Token[ONVIF_TOKEN_LEN]; // optional, Reference token of an existing configuration +} onvif_ConfigurationRef; + +typedef struct +{ + char Encoding[32]; // required, + int Number; // required, +} onvif_EncoderInstance; + +typedef struct +{ + uint32 sizeCodec; + onvif_EncoderInstance Codec[10]; // optional, If a device limits the number of instances for respective Video Codecs the response + // contains the information how many streams can be set up at the same time per VideoSource + + int Total; // required, The minimum guaranteed total number of encoder instances (applications) per VideoSourceConfiguration. + // The device is able to deliver the Total number of streams +} onvif_EncoderInstanceInfo; + +typedef struct +{ + char Name[ONVIF_NAME_LEN]; // required, + int UseCount; // required, + char token[ONVIF_TOKEN_LEN]; // required, +} onvif_ConfigurationEntity; + +typedef struct +{ + onvif_IntList Bitrate; // required + onvif_IntList SampleRateRange; // required +} onvif_AACDecOptions; + +typedef struct +{ + onvif_IntList Bitrate; // required + onvif_IntList SampleRateRange; // required +} onvif_G711DecOptions; + +typedef struct +{ + onvif_IntList Bitrate; // required + onvif_IntList SampleRateRange; // required +} onvif_G726DecOptions; + +typedef struct +{ + uint32 AACDecOptionsFlag : 1; // Indicates whether the field AACDecOptions is valid + uint32 G711DecOptionsFlag : 1; // Indicates whether the field G711DecOptions is valid + uint32 G726DecOptionsFlag : 1; // Indicates whether the field G726DecOptions is valid + uint32 Reserved : 29; + + onvif_AACDecOptions AACDecOptions; // optional + onvif_G711DecOptions G711DecOptions; // optional + onvif_G726DecOptions G726DecOptions; // optional +} onvif_AudioDecoderConfigurationOptions; + +typedef struct +{ + char Name[ONVIF_NAME_LEN]; // required, + int UseCount; // required, + char token[ONVIF_TOKEN_LEN]; // required, +} onvif_AudioDecoderConfiguration; + +typedef struct _AudioDecoderConfigurationList +{ + struct _AudioDecoderConfigurationList * next; + + onvif_AudioDecoderConfiguration Configuration; +} AudioDecoderConfigurationList; + +typedef struct +{ + uint32 VideoSourceFlag : 1; // Indicates whether the field VideoSource is valid + uint32 AudioSourceFlag : 1; // Indicates whether the field AudioSource is valid + uint32 VideoEncoderFlag : 1; // Indicates whether the field VideoEncoder is valid + uint32 AudioEncoderFlag : 1; // Indicates whether the field AudioEncoder is valid + uint32 AnalyticsFlag : 1; // Indicates whether the field Analytics is valid + uint32 PTZFlag : 1; // Indicates whether the field PTZ is valid + uint32 MetadataFlag : 1; // Indicates whether the field Metadata is valid + uint32 AudioOutputFlag : 1; // Indicates whether the field AudioOutput is valid + uint32 AudioDecoderFlag : 1; // Indicates whether the field AudioDecoder is valid + uint32 Reserved : 23; + + onvif_VideoSourceConfiguration VideoSource; // optional, Optional configuration of the Video input + onvif_AudioSourceConfiguration AudioSource; // optional, Optional configuration of the Audio input + onvif_VideoEncoder2Configuration VideoEncoder; // optional, Optional configuration of the Video encoder + onvif_AudioEncoder2Configuration AudioEncoder; // optional, Optional configuration of the Audio encoder + onvif_VideoAnalyticsConfiguration Analytics; // optional, Optional configuration of the analytics module and rule engine + onvif_PTZConfiguration PTZ; // optional, Optional configuration of the pan tilt zoom unit + onvif_MetadataConfiguration Metadata; // optional, Optional configuration of the metadata stream + onvif_AudioOutputConfiguration AudioOutput; // optional, Optional configuration of the Audio output + onvif_AudioDecoderConfiguration AudioDecoder; // optional, Optional configuration of the Audio decoder +} onvif_ConfigurationSet; + +typedef struct +{ + char Name[ONVIF_NAME_LEN]; // required, User readable name of the profile + + onvif_ConfigurationSet Configurations; // required, The configurations assigned to the profile + + char token[ONVIF_TOKEN_LEN]; // required, Unique identifier of the profile + BOOL fixed; // optional, A value of true signals that the profile cannot be deleted. Default is false + char stream_uri[ONVIF_URI_LEN]; // this profile stream url address +} onvif_MediaProfile; + +typedef struct _MediaProfileList +{ + struct _MediaProfileList * next; + + onvif_MediaProfile MediaProfile; +} MediaProfileList; + +typedef struct +{ + uint32 sizePoint; // sequence of elements + onvif_Vector Point[100]; // required, +} onvif_Polygon; + +typedef struct +{ + uint32 ColorFlag : 1; // Indicates whether the field Color is valid + uint32 Reserved : 31; + + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Token of the VideoSourceConfiguration the Mask is associated with + + onvif_Polygon Polygon; // required, Geometric representation of the mask area + + char Type[64]; // required, + // Color - The masked area is colored with color defined by the Color field + // Pixelated - The masked area is filled in mosaic style to hide details + // Blurred - The masked area is low pass filtered to hide details + onvif_Color Color; // optional, Color of the masked area + + BOOL Enabled; // required, If set the mask will cover the image, otherwise it will be fully transparent + char token[ONVIF_TOKEN_LEN]; // required, Token of the mask +} onvif_Mask; + +typedef struct +{ + int MaxMasks; // required, Maximum supported number of masks per VideoSourceConfiguration + int MaxPoints; // required, Maximum supported number of points per mask + + uint32 sizeTypes; // sequence, + char Types[10][64]; // required, Information which types of tr2:MaskType are supported. + // Valid values are 'Color', 'Pixelated' and 'Blurred' + + onvif_ColorOptions Color; // required, Colors supported + + BOOL RectangleOnly; // optional, Information whether the polygon must have four points and a rectangular shape + BOOL SingleColorOnly; // optional, Indicates the device capability of change in color of privacy mask for one video source + // configuration will automatically be applied to all the privacy masks associated with the same + // video source configuration +} onvif_MaskOptions; + +typedef struct _MaskList +{ + struct _MaskList * next; + + onvif_Mask Mask; +} MaskList; + +// MEDIA2 Define End + +// Thermal Define Begin + +typedef struct +{ + char Name[ONVIF_NAME_LEN]; // required, User readable Color Palette name + char token[ONVIF_TOKEN_LEN]; // required, Unique identifier of this Color Palette + char Type[32]; // required, Indicates Color Palette Type. Can use the following value: + // Custom,Grayscale,BlackHot,WhiteHot,Sepia,Red,Iron,Rain,Rainbow,Isotherm +} onvif_ColorPalette; + +typedef enum +{ + Polarity_WhiteHot = 0, + Polarity_BlackHot = 1 +} onvif_Polarity; + +typedef struct +{ + uint32 LowTemperatureFlag : 1; // Indicates whether the field LowTemperature is valid + uint32 HighTemperatureFlag : 1; // Indicates whether the field HighTemperature is valid + uint32 Reserved : 30; + + char Name[ONVIF_NAME_LEN]; // required, User reabable name for the Non-Uniformity Correction (NUC) Table + char token[ONVIF_TOKEN_LEN]; // required, Unique identifier of this NUC Table + float LowTemperature; // optional, Low Temperature limit for application of NUC Table, in Kelvin + float HighTemperature; // optional, High Temperature limit for application of NUC Table, in Kelvin +} onvif_NUCTable; + +typedef struct +{ + uint32 RunTimeFlag : 1; // Indicates whether the field RunTime is valid + uint32 Reserved : 31; + + BOOL Enabled; // required, Indicates whether the Cooler is enabled (running) or not + float RunTime; // optional, Number of hours the Cooler has been running (unit: hours). Read-only +} onvif_Cooler; + +typedef struct +{ + uint32 NUCTableFlag : 1; // Indicates whether the field NUCTable is valid + uint32 CoolerFlag : 1; // Indicates whether the field Cooler is valid + uint32 Reserved : 30; + + onvif_ColorPalette ColorPalette; // required, Current Color Palette in use by the Thermal Device + onvif_Polarity Polarity; // required, Polarity configuration of the Thermal Device + onvif_NUCTable NUCTable; // optional, Current Non-Uniformity Correction (NUC) Table in use by the Thermal Device + onvif_Cooler Cooler; // optional, Cooler settings of the Thermal Device +} onvif_ThermalConfiguration; + +typedef struct _ThermalConfigurationList +{ + struct _ThermalConfigurationList * next; + + char token[ONVIF_TOKEN_LEN]; // required, Reference token to the thermal VideoSource + + onvif_ThermalConfiguration Configuration; +} ThermalConfigurationList; + +typedef struct _ColorPaletteList +{ + struct _ColorPaletteList * next; + + onvif_ColorPalette ColorPalette; +} ColorPaletteList; + +typedef struct _NUCTableList +{ + struct _NUCTableList * next; + + onvif_NUCTable NUCTable; +} NUCTableList; + +typedef struct +{ + BOOL Enabled; // optional, Indicates the Device allows cooler status to be changed from running (Enabled) to stopped (Disabled), and viceversa +} onvif_CoolerOptions; + +typedef struct +{ + uint32 CoolerOptionsFlag : 1; // Indicates whether the field CoolerOptions is valid + uint32 Reserved : 31; + + ColorPaletteList * ColorPalette; // required, List of Color Palettes available for the requested Thermal VideoSource + NUCTableList * NUCTable; // optional, List of Non-Uniformity Correction (NUC) Tables available for the requested Thermal VideoSource + onvif_CoolerOptions CoolerOptions; // optional, Specifies Cooler Options for cooled thermal devices +} onvif_ThermalConfigurationOptions; + +typedef struct +{ + uint32 RelativeHumidityFlag : 1; // Indicates whether the field RelativeHumidity is valid + uint32 AtmosphericTemperatureFlag : 1; // Indicates whether the field AtmosphericTemperature is valid + uint32 AtmosphericTransmittanceFlag : 1; // Indicates whether the field AtmosphericTransmittance is valid + uint32 ExtOpticsTemperatureFlag : 1; // Indicates whether the field ExtOpticsTemperature is valid + uint32 ExtOpticsTransmittanceFlag : 1; // Indicates whether the field ExtOpticsTransmittance is valid + uint32 Reserved : 27; + + float ReflectedAmbientTemperature; // required, Reflected Ambient Temperature for the environment in which the thermal device and the object being measured is located + float Emissivity; // required, Emissivity of the surface of the object on which temperature is being measured + float DistanceToObject; // required, Distance from the thermal device to the measured object + float RelativeHumidity; // optional, Relative Humidity in the environment in which the measurement is located + float AtmosphericTemperature; // optional, Temperature of the atmosphere between the thermal device and the object being measured + float AtmosphericTransmittance; // optional, Transmittance value for the atmosphere between the thermal device and the object being measured + float ExtOpticsTemperature; // optional, Temperature of the optics elements between the thermal device and the object being measured + float ExtOpticsTransmittance; // optional, Transmittance value for the optics elements between the thermal device and the object being measured +} onvif_RadiometryGlobalParameters; + +typedef struct +{ + uint32 RadiometryGlobalParametersFlag : 1; // Indicates whether the field RadiometryGlobalParameters is valid + uint32 Reserved : 31; + + onvif_RadiometryGlobalParameters RadiometryGlobalParameters; // optional, Global Parameters for Radiometry Measurements. + // Shall exist if Radiometry Capability is reported, and Global Parameters are supported by the device +} onvif_RadiometryConfiguration; + +typedef struct +{ + uint32 RelativeHumidityFlag : 1; // Indicates whether the field RelativeHumidity is valid + uint32 AtmosphericTemperatureFlag : 1; // Indicates whether the field AtmosphericTemperature is valid + uint32 AtmosphericTransmittanceFlag : 1; // Indicates whether the field AtmosphericTransmittance is valid + uint32 ExtOpticsTemperatureFlag : 1; // Indicates whether the field ExtOpticsTemperature is valid + uint32 ExtOpticsTransmittanceFlag : 1; // Indicates whether the field ExtOpticsTransmittance is valid + uint32 Reserved : 27; + + onvif_FloatRange ReflectedAmbientTemperature; // required, Valid range of temperature values, in Kelvin + onvif_FloatRange Emissivity; // required, Valid range of emissivity values for the objects to measure + onvif_FloatRange DistanceToObject; // required, Valid range of distance between camera and object for a valid temperature reading, in meters + onvif_FloatRange RelativeHumidity; // optional, Valid range of relative humidity values, in percentage + onvif_FloatRange AtmosphericTemperature; // optional, Valid range of temperature values, in Kelvin + onvif_FloatRange AtmosphericTransmittance; // optional, Valid range of atmospheric transmittance values + onvif_FloatRange ExtOpticsTemperature; // optional, Valid range of temperature values, in Kelvin + onvif_FloatRange ExtOpticsTransmittance; // optional, Valid range of external optics transmittance +} onvif_RadiometryGlobalParameterOptions; + +typedef struct +{ + uint32 RadiometryGlobalParameterOptionsFlag : 1; // Indicates whether the field RadiometryGlobalParameterOptions is valid + uint32 Reserved : 31; + + onvif_RadiometryGlobalParameterOptions RadiometryGlobalParameterOptions; // optional, Specifies valid ranges and options for the global radiometry parameters + // used as default parameter values for temperature measurement modules (spots and boxes) +} onvif_RadiometryConfigurationOptions; + +// Thermal Define End + +// Credential define start + +typedef struct +{ + uint32 DescriptionFlag : 1; // Indicates whether the field Description is valid + uint32 ValidFromFlag : 1; // Indicates whether the field ValidFrom is valid + uint32 ValidToFlag : 1; // Indicates whether the field ValidTo is valid + uint32 Reserved : 29; + + char token[ONVIF_TOKEN_LEN]; // required, + char Description[1024]; // optional, User readable description for the credential. It shall be up to 1024 characters + char CredentialHolderReference[ONVIF_TOKEN_LEN]; // required, An external reference to a person holding this credential. + // The reference is a username or used ID in an external system, such as a directory + // service + char ValidFrom[64]; // optional, The start date/time validity of the credential. If the + // ValiditySupportsTimeValue capability is set to false, then only date is + // supported (time is ignored) + char ValidTo[64]; // optional, The expiration date/time validity of the credential. If the + // ValiditySupportsTimeValue capability is set to false, then only date is + // supported (time is ignored) +} onvif_CredentialInfo; + +typedef struct +{ + char Name[ONVIF_NAME_LEN]; // required, The name of the credential identifier type, such as pt:Card, pt:PIN, etc + char FormatType[100]; // required, Specifies the format of the credential value for the specified identifier type name +} onvif_CredentialIdentifierType; + +// A credential identifier is a card number, unique card information, PIN or +// biometric information such as fingerprint, iris, vein, face recognition, that can be validated +// in an access point +typedef struct +{ + BOOL Used; // used flag + + onvif_CredentialIdentifierType Type; // required, Contains the details of the credential identifier type. Is of type CredentialIdentifierType + + BOOL ExemptedFromAuthentication; // required, If set to true, this credential identifier is not considered for authentication + + char Value[2048]; // required, The value of the identifier in hexadecimal representation +} onvif_CredentialIdentifier; + +typedef struct +{ + onvif_CredentialIdentifierType Type; // required, Contains the details of the credential identifier type. Is of type CredentialIdentifierType + + char Value[2048]; // required, The value of the identifier in hexadecimal representation +} onvif_CredentialIdentifierItem; + +typedef struct _CredentialIdentifierItemList +{ + struct _CredentialIdentifierItemList * next; + + onvif_CredentialIdentifierItem Item; +} CredentialIdentifierItemList; + +// The association between a credential and an access profile +typedef struct +{ + uint32 Used : 1; // used flag + uint32 ValidFromFlag : 1; // Indicates whether the field ValidFrom is valid + uint32 ValidToFlag : 1; // Indicates whether the field ValidTo is valid + uint32 Reserved : 29; + + char AccessProfileToken[ONVIF_TOKEN_LEN]; // required, The reference token of the associated access profile + char ValidFrom[64]; // optional, The start date/time of the validity for the association between the + // credential and the access profile. If the ValiditySupportsTimeValue capability is set to + // false, then only date is supported (time is ignored) + char ValidTo[64]; // optional, The end date/time of the validity for the association between the + // credential and the access profile. If the ValiditySupportsTimeValue capability is set to + // false, then only date is supported (time is ignored) +} onvif_CredentialAccessProfile; + +typedef struct +{ + uint32 Used : 1; // used flag + uint32 ValueFlag : 1; // Indicates whether the field Value is valid + uint32 Reserved : 30; + + char Name[ONVIF_NAME_LEN]; // required, + char Value[100]; // optional, +} onvif_Attribute; + +// A Credential is a physical/tangible object, a piece of knowledge, or a facet of a person's +// physical being, that enables an individual access to a given physical facility or computer-based +// information system. A credential holds one or more credential identifiers. To gain access one or +// more identifiers may be required + +typedef struct +{ + uint32 DescriptionFlag : 1; // Indicates whether the field Description is valid + uint32 ValidFromFlag : 1; // Indicates whether the field ValidFrom is valid + uint32 ValidToFlag : 1; // Indicates whether the field ValidTo is valid + uint32 Reserved : 29; + + char token[ONVIF_TOKEN_LEN]; // required, + char Description[1024]; // optional, User readable description for the credential. It shall be up to 1024 characters + char CredentialHolderReference[ONVIF_TOKEN_LEN]; // required, An external reference to a person holding this credential. + // The reference is a username or used ID in an external system, such as a directory + // service + char ValidFrom[64]; // optional, The start date/time validity of the credential. If the + // ValiditySupportsTimeValue capability is set to false, then only date is + // supported (time is ignored) + char ValidTo[64]; // optional, The expiration date/time validity of the credential. If the + // ValiditySupportsTimeValue capability is set to false, then only date is + // supported (time is ignored) + + uint32 sizeCredentialIdentifier; // sequence of elements + onvif_CredentialIdentifier CredentialIdentifier[CREDENTIAL_MAX_LIMIT]; // required, A list of credential identifier structures. At least one + // credential identifier is required. Maximum one credential identifier structure + // per type is allowed + + uint32 sizeCredentialAccessProfile; // sequence of elements + onvif_CredentialAccessProfile CredentialAccessProfile[CREDENTIAL_MAX_LIMIT]; // optional, A list of credential access profile structures + + BOOL ExtendedGrantTime; // optional, A boolean indicating that the credential holder needs extra time to get through the door. + // ExtendedReleaseTime will be added to ReleaseTime, and ExtendedOpenTime will be added to OpenTime + + uint32 sizeAttribute; // sequence of elements + onvif_Attribute Attribute[CREDENTIAL_MAX_LIMIT]; // optional, A list of credential attributes as name value pairs. Key names + // starting with the prefix pt: are reserved to define PACS specific attributes + // following the "pt:" syntax +} onvif_Credential; + +typedef struct +{ + BOOL AntipassbackViolated; // required, Indicates if anti-passback is violated for the credential +} onvif_AntipassbackState; + +// The CredentialState structure contains information about the state of the credential and +// optionally the reason of why the credential was disabled + +typedef struct +{ + uint32 ReasonFlag : 1; // Indicates whether the field Reason is valid + uint32 AntipassbackStateFlag : 1; // Indicates whether the field AntipassbackState is valid + uint32 Reserved : 30; + + BOOL Enabled; // required, True if the credential is enabled or false if the credential is disabled + char Reason[100]; // optional, Predefined ONVIF reasons. For any other reason, free text can be used + // pt:CredentialLockedOut + // Access is denied due to credential locked out. + // pt:CredentialBlocked + // Access is denied because the credential has deliberately been blocked by the operator. + // pt:CredentialLost + // Access is denied due to the credential being reported as lost. + // pt:CredentialStolen + // Access is denied due to the credential being reported as stolen + // pt:CredentialDamaged + // Access is denied due to the credential being reported as damaged. + // pt:CredentialDestroyed + // Access is denied due to the credential being reported as destroyed + // pt:CredentialInactivity + // Access is denied due to credential inactivity + // pt:CredentialExpired + // Access is denied because the credential has expired + // pt:CredentialRenewalNeeded + // Access is denied because the credential requires a renewal (e.g. new PIN or + // fingerprint enrollment). + + onvif_AntipassbackState AntipassbackState; // optional, A structure indicating the anti-passback state. This field shall be + // supported if the ResetAntipassbackSupported capability is set to true +} onvif_CredentialState; + +typedef struct +{ + onvif_Credential Credential; // required, A format type supported by the device + onvif_CredentialState CredentialState; // required, User readable description of the credential identifier format type +} onvif_CredentialData; + +typedef struct +{ + char FormatType[100]; // required, A format type supported by the device. A list of supported format types is + // provided in [ISO 16484-5:2014-09 Annex P]. The BACnet type "CUSTOM" is not used. + // Instead device manufacturers can define their own format types + char Description[1024]; // required, User readable description of the credential identifier format type. It + // shall be up to 1024 characters +} onvif_CredentialIdentifierFormatTypeInfo; + +typedef struct _CredentialList +{ + struct _CredentialList * next; + + onvif_Credential Credential; + onvif_CredentialState State; +} CredentialList; + +// Credential define end + +// Access Rules define begin + +typedef struct +{ + uint32 DescriptionFlag : 1; // Indicates whether the field Description is valid + uint32 Reserved : 31; + + char token[ONVIF_TOKEN_LEN]; // required, + char Name[ONVIF_NAME_LEN]; // required, A user readable name. It shall be up to 64 characters + char Description[1024]; // optional, User readable description for the access profile. It shall be up to 1024 characters +} onvif_AccessProfileInfo; + +typedef struct +{ + uint32 EntityTypeFlag : 1; // Indicates whether the field EntityType is valid + uint32 Reserved : 31; + + char ScheduleToken[ONVIF_TOKEN_LEN]; // required, Reference to the schedule used by the access policy + char Entity[ONVIF_TOKEN_LEN]; // required, Reference to the entity used by the rule engine, + // the entity type may be specified by the optional EntityType field + // explained below but is typically an access point + char EntityType[64]; // optional, Optional entity type; if missing, an access point type as defined + // by the ONVIF Access Control service should be assumed. + // This can also be represented by the QName value tac:AccessPoint + // where tac is the namespace of Access Control Service Specification. + // This field is provided for future extensions; + // it will allow an access policy being extended to cover entity types + // other than access points as well +} onvif_AccessPolicy; + +typedef struct +{ + uint32 DescriptionFlag : 1; // Indicates whether the field Description is valid + uint32 Reserved : 31; + + char token[ONVIF_TOKEN_LEN]; // required, + char Name[ONVIF_NAME_LEN]; // required, A user readable name. It shall be up to 64 characters + char Description[1024]; // optional, User readable description for the access profile. It shall be up to 1024 characters + + uint32 sizeAccessPolicy; // sequence of elements + onvif_AccessPolicy AccessPolicy[ACCESSRULES_MAX_LIMIT]; // optional, A list of access policy structures, + // where each access policy defines during which schedule an access point can be accessed +} onvif_AccessProfile; + +typedef struct _AccessProfileList +{ + struct _AccessProfileList * next; + + onvif_AccessProfile AccessProfile; +} AccessProfileList; + + +// Access Rules define end + +// Schedule define begin + +typedef struct +{ + uint32 DescriptionFlag : 1; // Indicates whether the field Description is valid + uint32 Reserved : 31; + + char token[ONVIF_TOKEN_LEN]; // required + char Name[ONVIF_NAME_LEN]; // required, A user readable name. It shall be up to 64 characters + char Description[1024]; // optional, User readable description for the schedule. It shall be up to 1024 characters +} onvif_ScheduleInfo; + +typedef struct +{ + uint32 UntilFlag : 1; // Indicates whether the field Until is valid + uint32 Reserved : 31; + + char From[32]; // required, Indicates the start time + char Until[32]; // optional, Indicates the end time. Is optional, if omitted, the period ends at midnight. + // The end time is exclusive, meaning that that exact moment in time is not + // part of the period. To determine if a moment in time (t) is part of a time period, + // the formula StartTime ≤ t < EndTime is used. +} onvif_TimePeriod; + +typedef struct +{ + char GroupToken[ONVIF_TOKEN_LEN]; // required, Indicates the list of special days in a schedule + + uint32 sizeTimeRange; // sequence of elements + + onvif_TimePeriod TimeRange[SCHEDULE_MAX_LIMIT]; // optional, Indicates the alternate time periods for the list of special days + // (overrides the regular schedule). For example, the regular schedule indicates + // that it is active from 8AM to 5PM on Mondays. However, this particular + // Monday is a special day, and the alternate time periods state that the + // schedule is active from 9 AM to 11 AM and 1 PM to 4 PM. + // If no time periods are defined, then no access is allowed. + // Is of type TimePeriod +} onvif_SpecialDaysSchedule; + +typedef struct +{ + uint32 DescriptionFlag : 1; // Indicates whether the field Description is valid + uint32 Reserved : 31; + + char token[ONVIF_TOKEN_LEN]; // required + char Name[ONVIF_NAME_LEN]; // required, A user readable name. It shall be up to 64 characters + char Description[1024]; // optional, User readable description for the schedule. It shall be up to 1024 characters + char Standard[10*1024]; // required, An iCalendar structure that defines a number of events. Events + // can be recurring or non-recurring. The events can, for instance, + // be used to control when a camera should record or when a facility + // is accessible. Some devices might not be able to fully support + // all the features of iCalendar. Setting the service capability + // ExtendedRecurrenceSupported to false will enable more devices + // to be ONVIF compliant. Is of type string (but contains an iCalendar structure) + uint32 sizeSpecialDays; // sequence of elements + + onvif_SpecialDaysSchedule SpecialDays[SCHEDULE_MAX_LIMIT]; // optional, For devices that are not able to support all the features of iCalendar, + // supporting special days is essential. Each SpecialDaysSchedule + // instance defines an alternate set of time periods that overrides + // the regular schedule for a specified list of special days. + // Is of type SpecialDaysSchedule +} onvif_Schedule; + +typedef struct +{ + uint32 DescriptionFlag : 1; // Indicates whether the field Description is valid + uint32 Reserved : 31; + + char token[ONVIF_TOKEN_LEN]; // required + char Name[ONVIF_NAME_LEN]; // required, A user readable name. It shall be up to 64 characters + char Description[1024]; // optional, User readable description for the schedule. It shall be up to 1024 characters +} onvif_SpecialDayGroupInfo; + +typedef struct +{ + uint32 DescriptionFlag : 1; // Indicates whether the field Description is valid + uint32 DaysFlag : 1; // Indicates whether the field Days is valid + uint32 Reserved : 30; + + char token[ONVIF_TOKEN_LEN]; // required + char Name[ONVIF_NAME_LEN]; // required, A user readable name. It shall be up to 64 characters + char Description[1024]; // optional, User readable description for the schedule. It shall be up to 1024 characters + char Days[4*1024]; // optional, An iCalendar structure that contains a group of special days. + // Is of type string (containing an iCalendar structure) +} onvif_SpecialDayGroup; + +typedef struct +{ + uint32 SpecialDayFlag : 1; // Indicates whether the field SpecialDay is valid + uint32 Reserved : 31; + + BOOL Active; // required, Indicates that the current time is within the boundaries of the schedule + // or its special days schedules's time periods. For example, if this + // schedule is being used for triggering automatic recording on a video source, + // the Active flag will be true when the schedule-based recording is supposed to record + BOOL SpecialDay; // optional, Indicates that the current time is within the boundaries of its special + // days schedules's time periods. For example, if this schedule is being used + // for recording at a lower frame rate on a video source during special days, + // the SpecialDay flag will be true. If special days are not supported by the device, + // this field may be omitted and interpreted as false by the client +} onvif_ScheduleState; + +typedef struct _ScheduleList +{ + struct _ScheduleList * next; + + onvif_Schedule Schedule; + onvif_ScheduleState ScheduleState; + +#ifdef LIBICAL + icalcomponent * comp; +#endif +} ScheduleList; + +typedef struct _SpecialDayGroupList +{ + struct _SpecialDayGroupList * next; + + onvif_SpecialDayGroup SpecialDayGroup; + +#ifdef LIBICAL + icalcomponent * comp; +#endif +} SpecialDayGroupList; + +// Schedule define end + +// Receiver define begin + +typedef struct +{ + onvif_ReceiverMode Mode; // required, connection modes + char MediaUri[256]; // required, Details of the URI to which the receiver should connect + onvif_StreamSetup StreamSetup; // required, Stream connection parameters +} onvif_ReceiverConfiguration; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, Unique identifier of the receiver + + onvif_ReceiverConfiguration Configuration; // required, Describes the configuration of the receiver +} onvif_Receiver; + +typedef struct +{ + onvif_ReceiverState State; // required, The connection state of the receiver + + BOOL AutoCreated; // required, Indicates whether or not the receiver was created automatically +} onvif_ReceiverStateInformation; + +typedef struct _ReceiverList +{ + struct _ReceiverList * next; + + onvif_Receiver Receiver; + onvif_ReceiverStateInformation StateInformation; +} ReceiverList; + +// Receiver define end + +// Provision define begin + +typedef struct +{ + uint32 PanFlag : 1; // Indicates whether the field Pan is valid + uint32 TiltFlag : 1; // Indicates whether the field Tilt is valid + uint32 ZoomFlag : 1; // Indicates whether the field Zoom is valid + uint32 RollFlag : 1; // Indicates whether the field Roll is valid + uint32 FocusFlag : 1; // Indicates whether the field Focus is valid + uint32 Reserved : 27; + + int Pan; // optional, The quantity of pan movement events over the life of the device + int Tilt; // optional, The quantity of tilt movement events over the life of the device + int Zoom; // optional, The quantity of zoom movement events over the life of the device + int Roll; // optional, The quantity of roll movement events over the life of the device + int Focus; // optional, The quantity of focus movement events over the life of the device +} onvif_Usage; + +// Provision define end + +#ifdef __cplusplus +extern "C" { +#endif + + +HT_API const char * onvif_CapabilityCategoryToString(onvif_CapabilityCategory category); +HT_API onvif_CapabilityCategory onvif_StringToCapabilityCategory(const char * str); + +HT_API const char * onvif_FactoryDefaultTypeToString(onvif_FactoryDefaultType type); +HT_API onvif_FactoryDefaultType onvif_StringToFactoryDefaultType(const char * str); + +HT_API const char * onvif_SystemLogTypeToString(onvif_SystemLogType type); +HT_API onvif_SystemLogType onvif_StringToSystemLogType(const char * str); + +HT_API const char * onvif_VideoEncodingToString(onvif_VideoEncoding encoding); +HT_API onvif_VideoEncoding onvif_StringToVideoEncoding(const char * str); + +HT_API const char * onvif_AudioEncodingToString(onvif_AudioEncoding encoding); +HT_API onvif_AudioEncoding onvif_StringToAudioEncoding(const char * str); + +HT_API const char * onvif_H264ProfileToString(onvif_H264Profile profile); +HT_API onvif_H264Profile onvif_StringToH264Profile(const char * str); + +HT_API const char * onvif_Mpeg4ProfileToString(onvif_Mpeg4Profile profile); +HT_API onvif_Mpeg4Profile onvif_StringToMpeg4Profile(const char * str); + +HT_API const char * onvif_UserLevelToString(onvif_UserLevel level); +HT_API onvif_UserLevel onvif_StringToUserLevel(const char * str); + +HT_API const char * onvif_MoveStatusToString(onvif_MoveStatus status); +HT_API onvif_MoveStatus onvif_StringToMoveStatus(const char * str); + +HT_API const char * onvif_OSDTypeToString(onvif_OSDType type); +HT_API onvif_OSDType onvif_StringToOSDType(const char * type); + +HT_API const char * onvif_OSDPosTypeToString(onvif_OSDPosType type); +HT_API onvif_OSDPosType onvif_StringToOSDPosType(const char * type); + +HT_API const char * onvif_OSDTextTypeToString(onvif_OSDTextType type); +HT_API onvif_OSDTextType onvif_StringToOSDTextType(const char * type); + +HT_API const char * onvif_BacklightCompensationModeToString(onvif_BacklightCompensationMode mode); +HT_API onvif_BacklightCompensationMode onvif_StringToBacklightCompensationMode(const char * str); + +HT_API const char * onvif_ExposureModeToString(onvif_ExposureMode mode); +HT_API onvif_ExposureMode onvif_StringToExposureMode(const char * str); + +HT_API const char * onvif_ExposurePriorityToString(onvif_ExposurePriority mode); +HT_API onvif_ExposurePriority onvif_StringToExposurePriority(const char * str); + +HT_API const char * onvif_AutoFocusModeToString(onvif_AutoFocusMode mode); +HT_API onvif_AutoFocusMode onvif_StringToAutoFocusMode(const char * str); + +HT_API const char * onvif_WideDynamicModeToString(onvif_WideDynamicMode mode); +HT_API onvif_WideDynamicMode onvif_StringToWideDynamicMode(const char * str); + +HT_API const char * onvif_IrCutFilterModeToString(onvif_IrCutFilterMode mode); +HT_API onvif_IrCutFilterMode onvif_StringToIrCutFilterMode(const char * str); + +HT_API const char * onvif_WhiteBalanceModeToString(onvif_WhiteBalanceMode mode); +HT_API onvif_WhiteBalanceMode onvif_StringToWhiteBalanceMode(const char * str); + +HT_API const char * onvif_EFlipModeToString(onvif_EFlipMode mode); +HT_API onvif_EFlipMode onvif_StringToEFlipMode(const char * str); + +HT_API const char * onvif_ReverseModeToString(onvif_ReverseMode mode); +HT_API onvif_ReverseMode onvif_StringToReverseMode(const char * str); + +HT_API const char * onvif_DiscoveryModeToString(onvif_DiscoveryMode mode); +HT_API onvif_DiscoveryMode onvif_StringToDiscoveryMode(const char * str); + +HT_API const char * onvif_SetDateTimeTypeToString(onvif_SetDateTimeType type); +HT_API onvif_SetDateTimeType onvif_StringToSetDateTimeType(const char * str); + +HT_API const char * onvif_StreamTypeToString(onvif_StreamType type); +HT_API onvif_StreamType onvif_StringToStreamType(const char * str); + +HT_API const char * onvif_TransportProtocolToString(onvif_TransportProtocol type); +HT_API onvif_TransportProtocol onvif_StringToTransportProtocol(const char * str); + +HT_API const char * onvif_DynamicDNSTypeToString(onvif_DynamicDNSType type); +HT_API onvif_DynamicDNSType onvif_StringToDynamicDNSType(const char * str); + +HT_API const char * onvif_TrackTypeToString(onvif_TrackType type); +HT_API onvif_TrackType onvif_StringToTrackType(const char * str); + +HT_API const char * onvif_PropertyOperationToString(onvif_PropertyOperation type); +HT_API onvif_PropertyOperation onvif_StringToPropertyOperation(const char * str); + +HT_API const char * onvif_RecordingStatusToString(onvif_RecordingStatus status); +HT_API onvif_RecordingStatus onvif_StringToRecordingStatus(const char * str); + +HT_API const char * onvif_SearchStateToString(onvif_SearchState state); +HT_API onvif_SearchState onvif_StringToSearchState(const char * str); + +HT_API const char * onvif_RotateModeToString(onvif_RotateMode mode); +HT_API onvif_RotateMode onvif_StringToRotateMode(const char * str); + +HT_API const char * onvif_ScopeDefinitionToString(onvif_ScopeDefinition def); +HT_API onvif_ScopeDefinition onvif_StringToScopeDefinition(const char * str); + +HT_API const char * onvif_Dot11AuthAndMangementSuiteToString(onvif_Dot11AuthAndMangementSuite req); +HT_API onvif_Dot11AuthAndMangementSuite onvif_StringToDot11AuthAndMangementSuite(const char * str); + +HT_API const char * onvif_Dot11CipherToString(onvif_Dot11Cipher req); +HT_API onvif_Dot11Cipher onvif_StringToDot11Cipher(const char * str); + +HT_API const char * onvif_Dot11SignalStrengthToString(onvif_Dot11SignalStrength req); +HT_API onvif_Dot11SignalStrength onvif_StringToDot11SignalStrength(const char * str); + +HT_API const char * onvif_Dot11StationModeToString(onvif_Dot11StationMode req); +HT_API onvif_Dot11StationMode onvif_StringToDot11StationMode(const char * str); + +HT_API const char * onvif_Dot11SecurityModeToString(onvif_Dot11SecurityMode req); +HT_API onvif_Dot11SecurityMode onvif_StringToDot11SecurityMode(const char * str); + +HT_API const char * onvif_PTZPresetTourOperationToString(onvif_PTZPresetTourOperation op); +HT_API onvif_PTZPresetTourOperation onvif_StringToPTZPresetTourOperation(const char * str); + +HT_API const char * onvif_PTZPresetTourStateToString(onvif_PTZPresetTourState st); +HT_API onvif_PTZPresetTourState onvif_StringToPTZPresetTourState(const char * str); + +HT_API const char * onvif_PTZPresetTourDirectionToString(onvif_PTZPresetTourDirection dir); +HT_API onvif_PTZPresetTourDirection onvif_StringToPTZPresetTourDirection(const char * str); + +HT_API const char * onvif_DoorPhysicalStateToString(onvif_DoorPhysicalState state); +HT_API onvif_DoorPhysicalState onvif_StringToDoorPhysicalState(const char * str); + +HT_API const char * onvif_LockPhysicalStateToString(onvif_LockPhysicalState state); +HT_API onvif_LockPhysicalState onvif_StringToLockPhysicalState(const char * str); + +HT_API const char * onvif_DoorAlarmStateToString(onvif_DoorAlarmState state); +HT_API onvif_DoorAlarmState onvif_StringToDoorAlarmState(const char * str); + +HT_API const char * onvif_DoorTamperStateToString(onvif_DoorTamperState state); +HT_API onvif_DoorTamperState onvif_StringToDoorTamperState(const char * str); + +HT_API const char * onvif_DoorFaultStateToString(onvif_DoorFaultState state); +HT_API onvif_DoorFaultState onvif_StringToDoorFaultState(const char * str); + +HT_API const char * onvif_DoorModeToString(onvif_DoorMode mode); +HT_API onvif_DoorMode onvif_StringToDoorMode(const char * str); + +HT_API const char * onvif_RelayModeToString(onvif_RelayMode mode); +HT_API onvif_RelayMode onvif_StringToRelayMode(const char * str); + +HT_API const char * onvif_RelayIdleStateToString(onvif_RelayIdleState state); +HT_API onvif_RelayIdleState onvif_StringToRelayIdleState(const char * str); + +HT_API const char * onvif_RelayLogicalStateToString(onvif_RelayLogicalState state); +HT_API onvif_RelayLogicalState onvif_StringToRelayLogicalState(const char * str); + +HT_API const char * onvif_DigitalIdleStateToString(onvif_DigitalIdleState state); +HT_API onvif_DigitalIdleState onvif_StringToDigitalIdleState(const char * str); + +HT_API const char * onvif_ParityBitToString(onvif_ParityBit type); +HT_API onvif_ParityBit onvif_StringToParityBit(const char * str); + +HT_API const char * onvif_SerialPortTypeToString(onvif_SerialPortType type); +HT_API onvif_SerialPortType onvif_StringToSerialPortType(const char * str); + +HT_API const char * onvif_PolarityToString(onvif_Polarity type); +HT_API onvif_Polarity onvif_StringToPolarity(const char * str); + +HT_API const char * onvif_ReceiverModeToString(onvif_ReceiverMode mode); +HT_API onvif_ReceiverMode onvif_StringToReceiverMode(const char * str); + +HT_API const char * onvif_ReceiverStateToString(onvif_ReceiverState state); +HT_API onvif_ReceiverState onvif_StringToReceiverState(const char * str); + +HT_API const char * onvif_IPAddressFilterTypeToString(onvif_IPAddressFilterType type); +HT_API onvif_IPAddressFilterType onvif_StringToIPAddressFilterType(const char * str); + +HT_API const char * onvif_PanDirectionToString(onvif_PanDirection dir); +HT_API onvif_PanDirection onvif_StringToPanDirection(const char * str); +HT_API const char * onvif_TiltDirectionToString(onvif_TiltDirection dir); +HT_API onvif_TiltDirection onvif_StringToTiltDirection(const char * str); +HT_API const char * onvif_ZoomDirectionToString(onvif_ZoomDirection dir); +HT_API onvif_ZoomDirection onvif_StringToZoomDirection(const char * str); +HT_API const char * onvif_RollDirectionToString(onvif_RollDirection dir); +HT_API onvif_RollDirection onvif_StringToRollDirection(const char * str); +HT_API const char * onvif_FocusDirectionToString(onvif_FocusDirection dir); +HT_API onvif_FocusDirection onvif_StringToFocusDirection(const char * str); + + +#ifdef __cplusplus +} +#endif + +#endif /* end of ONVIF_COMM_H */ + + + + + diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/onvif/onvif_event.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/onvif/onvif_event.h new file mode 100644 index 0000000..77a5b40 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/onvif/onvif_event.h @@ -0,0 +1,117 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef ONVIF_EVENT_H +#define ONVIF_EVENT_H + +#include "sys_inc.h" +#include "onvif.h" +#include "xml_node.h" +#include "onvif_req.h" +#include "http.h" + +typedef struct +{ + BOOL used_flag; + + ONVIF_DEVICE * p_dev; +} ONVIF_TIMER_DEV; + +typedef void (* onvif_event_notify_cb)(Notify_REQ * p_req, void * pdata); +typedef void (* onvif_subscribe_disconnect_cb)(ONVIF_DEVICE * p_dev, void * pdata); + +typedef struct +{ + onvif_event_notify_cb notify_cb; + void * notify_cb_data; + void * notify_cb_mutex; + + onvif_subscribe_disconnect_cb disconnect_cb; + void * disconnect_cb_data; + void * disconnect_cb_mutex; + + HTTPSRV http_srv; // http server for receiving event notify + pthread_t event_timer_id; + int event_timer_run; + PPSN_CTX * event_dev_fl; + PPSN_CTX * event_dev_ul; + int event_dev_max; +} ONVIF_EVENT_CLS; + + +#ifdef __cplusplus +extern "C" { +#endif + + +/** + * init event handler + * + * init http server for receiving event notify messages + * + * http_srv_addr : http server listen address, NULL means listening on all interfaces + * http_srv_port : http server listen port + * max_clients : max support client numbers + * + */ +HT_API BOOL onvif_event_init(const char * http_srv_addr, uint16 http_srv_port, int max_clients); + +/** + * deinit event handler + */ +HT_API void onvif_event_deinit(); + +/** + * set event notify callback + * + * set cb to NULL, disable callback + */ +HT_API void onvif_set_event_notify_cb(onvif_event_notify_cb cb, void * pdata); + +/** + * set event subscribe disconnect callback + * + * set cb to NULL, disable callback + */ +HT_API void onvif_set_subscribe_disconnect_cb(onvif_subscribe_disconnect_cb cb, void * pdata); + +/** + * event notify handler, called by http_soap_process + */ +HT_API void onvif_event_notify(HTTPCLN * p_user, HTTPMSG * rx_msg, XMLN * p_xml); + +/** + * add p_dev to event timer list, send renew request + */ +HT_API BOOL onvif_event_timer_add(ONVIF_DEVICE * p_dev); + +/** + * del p_dev from event timer list + */ +HT_API BOOL onvif_event_timer_del(ONVIF_DEVICE * p_dev); + +#ifdef __cplusplus +} +#endif + + +#endif + + + diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/onvif/onvif_http.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/onvif/onvif_http.h new file mode 100644 index 0000000..a444aaf --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/onvif/onvif_http.h @@ -0,0 +1,41 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef ONVIF_HTTP_H +#define ONVIF_HTTP_H + +#include "onvif.h" +#include "http.h" + +#ifdef __cplusplus +extern "C" { +#endif + +HT_API BOOL http_onvif_trans(HTTPREQ * p_http, int timeout, eOnvifAction act, ONVIF_DEVICE * p_dev, void * p_req, void * p_res); +HT_API BOOL http_onvif_file_upload(HTTPREQ * p_http, int timeout, const char * filename, ONVIF_DEVICE * p_dev); +HT_API BOOL http_onvif_download(HTTPREQ * p_http, int timeout, uint8 ** pp_buf, int * buflen, ONVIF_DEVICE * p_dev); + +#ifdef __cplusplus +} +#endif + +#endif + + + diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/onvif/onvif_pkt.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/onvif/onvif_pkt.h new file mode 100644 index 0000000..29e0b76 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/onvif/onvif_pkt.h @@ -0,0 +1,38 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef ONVIF_PKT_H +#define ONVIF_PKT_H + +#include "sys_inc.h" +#include "onvif.h" + +#ifdef __cplusplus +extern "C" { +#endif + +int build_onvif_req_xml(char * p_buf, int mlen, eOnvifAction type, ONVIF_DEVICE * p_dev, void * p_req); + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/onvif/onvif_probe.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/onvif/onvif_probe.h new file mode 100644 index 0000000..be01d15 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/onvif/onvif_probe.h @@ -0,0 +1,123 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef __H_ONVIF_PROBE_H__ +#define __H_ONVIF_PROBE_H__ + +#include "onvif.h" + +#define PROBE_MSGTYPE_MATCH 0 +#define PROBE_MSGTYPE_HELLO 1 +#define PROBE_MSGTYPE_BYE 2 + +#define MAX_PROBE_FD 8 + +/* + * onvif probe callback function + * p_res : the DEVICE_BINFO struct point + * pdata : the user data + * msgypte : + * PROBE_MSGTYPE_MATCH - probe match + * PROBE_MSGTYPE_HELLO - hello + * PROBE_MSGTYPE_BYE - bye + * note : if msgtype = PROBE_MSGTYPE_BYE, only p_res->EndpointReference field is valid, the other fields is invalid + */ +typedef void (* onvif_probe_cb)(DEVICE_BINFO * p_res, int msgtype, void * pdata); + +typedef struct +{ + onvif_probe_cb probe_cb; + void * probe_cb_data; + void * probe_mutex; + pthread_t probe_thread; + SOCKET probe_fd[MAX_PROBE_FD]; + int probe_interval; + BOOL probe_running; + char monitor_reference[100]; + int monitor_msgtype; + onvif_probe_cb monitor_cb; + void * monitor_cb_data; + void * monitor_mutex; +} ONVIF_PROBE_CLS; + + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @desc, set monitor callback function + * + * @param, + * reference - endpoint reference + * msgtype - probe message type + * cb - callback function + * pdata - user data + * +**/ +HT_API void set_monitor_cb(char * reference, int msgtype, onvif_probe_cb cb, void * pdata); + +/** + * @desc, set probe callback function + * + * @param, + * cb - callback function + * pdata - user data + * +**/ +HT_API void set_probe_cb(onvif_probe_cb cb, void * pdata); + +/** + * @desc, set probe interval + * + * @param, + * interval - probe interval, unit is second, default is 30s + * +**/ +HT_API void set_probe_interval(int interval); + +/** + * @desc, start probe thread + * + * @param, + * ip - start probe thread on the specify ip address, it can be NULL, if ip is NULL, it will use the default ip + * interval - probe interval, unit is second, default is 30s +**/ +HT_API int start_probe(const char * ip, int interval); + +/** + * @desc, stop probe thread + * +**/ +HT_API void stop_probe(); + +/** + * @desc, send probe request + * +**/ +HT_API void send_probe_req(); + + +#ifdef __cplusplus +} +#endif + +#endif // __H_ONVIF_PROBE_H__ + + diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/onvif/onvif_req.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/onvif/onvif_req.h new file mode 100644 index 0000000..a00edcf --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/onvif/onvif_req.h @@ -0,0 +1,2596 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef ONVIF_REQ_H +#define ONVIF_REQ_H + + +/************************************************************************* + * + * onvif request structure + * +**************************************************************************/ + +typedef struct +{ + onvif_CapabilityCategory Category; // optional, List of categories to retrieve capability information on +} tds_GetCapabilities_REQ; + +typedef struct +{ + BOOL IncludeCapability; // required, Indicates if the service capabilities (untyped) should be included in the response. +} tds_GetServices_REQ; + +typedef struct +{ + int dummy; +} tds_GetServiceCapabilities_REQ; + +typedef struct +{ + int dummy; +} tds_GetDeviceInformation_REQ; + +typedef struct +{ + int dummy; +} tds_GetUsers_REQ; + +typedef struct +{ + onvif_User User; // required +} tds_CreateUsers_REQ; + +typedef struct +{ + char Username[ONVIF_NAME_LEN]; // required +} tds_DeleteUsers_REQ; + +typedef struct +{ + onvif_User User; // required +} tds_SetUser_REQ; + +typedef struct +{ + int dummy; +} tds_GetRemoteUser_REQ; + +typedef struct +{ + uint32 RemoteUserFlag : 1; // Indicates whether the field RemoteUser is valid + uint32 Reserved : 31; + + onvif_RemoteUser RemoteUser; // optional +} tds_SetRemoteUser_REQ; + +typedef struct +{ + int dummy; +} tds_GetNetworkInterfaces_REQ; + +typedef struct +{ + onvif_NetworkInterface NetworkInterface; +} tds_SetNetworkInterfaces_REQ; + +typedef struct +{ + int dummy; +} tds_GetNTP_REQ; + +typedef struct +{ + onvif_NTPInformation NTPInformation; +} tds_SetNTP_REQ; + +typedef struct +{ + int dummy; +} tds_GetHostname_REQ; + +typedef struct +{ + char Name[ONVIF_NAME_LEN]; // required +} tds_SetHostname_REQ; + +typedef struct +{ + BOOL FromDHCP; // required, True if the hostname shall be obtained via DHCP +} tds_SetHostnameFromDHCP_REQ; + +typedef struct +{ + int dummy; +} tds_GetDNS_REQ; + +typedef struct +{ + onvif_DNSInformation DNSInformation; +} tds_SetDNS_REQ; + +typedef struct +{ + int dummy; +} tds_GetDynamicDNS_REQ; + +typedef struct +{ + onvif_DynamicDNSInformation DynamicDNSInformation; +} tds_SetDynamicDNS_REQ; + +typedef struct +{ + int dummy; +} tds_GetNetworkProtocols_REQ; + +typedef struct +{ + onvif_NetworkProtocol NetworkProtocol; +} tds_SetNetworkProtocols_REQ; + +typedef struct +{ + int dummy; +} tds_GetDiscoveryMode_REQ; + +typedef struct +{ + onvif_DiscoveryMode DiscoveryMode; // required, Indicator of discovery mode: Discoverable, NonDiscoverable +} tds_SetDiscoveryMode_REQ; + +typedef struct +{ + int dummy; +} tds_GetNetworkDefaultGateway_REQ; + +typedef struct +{ + char IPv4Address[MAX_GATEWAY][32]; // optional, Sets IPv4 gateway address used as default setting +} tds_SetNetworkDefaultGateway_REQ; + +typedef struct +{ + int dummy; +} tds_GetZeroConfiguration_REQ; + +typedef struct +{ + char InterfaceToken[ONVIF_TOKEN_LEN]; // requied, Unique identifier referencing the physical interface + BOOL Enabled; // requied, Specifies if the zero-configuration should be enabled or not +} tds_SetZeroConfiguration_REQ; + +typedef struct +{ + int dummy; +} tds_GetEndpointReference_REQ; + +typedef struct +{ + char AuxiliaryCommand[1024]; // required +} tds_SendAuxiliaryCommand_REQ; + +typedef struct +{ + int dummy; +} tds_GetRelayOutputs_REQ; + +typedef struct +{ + char RelayOutputToken[ONVIF_TOKEN_LEN]; // required + + onvif_RelayOutputSettings Properties; // required +} tds_SetRelayOutputSettings_REQ; + +typedef struct +{ + char RelayOutputToken[ONVIF_TOKEN_LEN]; // required + + onvif_RelayLogicalState LogicalState; // required +} tds_SetRelayOutputState_REQ; + +typedef struct +{ + int dummy; +} tds_GetSystemDateAndTime_REQ; + +typedef struct +{ + uint32 UTCDateTimeFlag : 1; // Indicates whether the field UTCDateTime is valid + uint32 Reserved : 31; + + onvif_SystemDateTime SystemDateTime; // required, + onvif_DateTime UTCDateTime; // optional, Date and time in UTC. If time is obtained via NTP, UTCDateTime has no meaning +} tds_SetSystemDateAndTime_REQ; + +typedef struct +{ + int dummy; +} tds_SystemReboot_REQ; + +typedef struct +{ + onvif_FactoryDefaultType FactoryDefault; // required +} tds_SetSystemFactoryDefault_REQ; + +typedef struct +{ + onvif_SystemLogType LogType; // required, Specifies the type of system log to get +} tds_GetSystemLog_REQ; + +typedef struct +{ + int dummy; +} tds_GetScopes_REQ; + +typedef struct +{ + int sizeScopes; + char Scopes[MAX_SCOPE_NUMS][100]; +} tds_SetScopes_REQ; + +typedef struct +{ + int sizeScopeItem; + char ScopeItem[MAX_SCOPE_NUMS][100]; // required +} tds_AddScopes_REQ; + +typedef struct +{ + int sizeScopeItem; + char ScopeItem[MAX_SCOPE_NUMS][100]; // required +} tds_RemoveScopes_REQ; + +typedef struct +{ + int dummy; +} tds_StartFirmwareUpgrade_REQ; + +typedef struct +{ + int dummy; +} tds_GetSystemUris_REQ; + +typedef struct +{ + int dummy; +} tds_StartSystemRestore_REQ; + +typedef struct +{ + int dummy; +} tds_GetWsdlUrl_REQ; + +typedef struct +{ + int dummy; +} tds_GetDot11Capabilities_REQ; + +typedef struct +{ + char InterfaceToken[ONVIF_TOKEN_LEN]; // required +} tds_GetDot11Status_REQ; + +typedef struct +{ + char InterfaceToken[ONVIF_TOKEN_LEN]; // required +} tds_ScanAvailableDot11Networks_REQ; + +typedef struct +{ + int dummy; +} tds_GetGeoLocation_REQ; + +typedef struct +{ + LocationEntityList * Location; // required +} tds_SetGeoLocation_REQ; + +typedef struct +{ + LocationEntityList * Location; // required +} tds_DeleteGeoLocation_REQ; + +typedef struct +{ + char Algorithm[64]; // required, Hashing algorithm(s) used in HTTP and RTSP Digest Authentication +} tds_SetHashingAlgorithm_REQ; + +typedef struct +{ + int dummy; +} tds_GetIPAddressFilter_REQ; + +typedef struct +{ + onvif_IPAddressFilter IPAddressFilter; // required +} tds_SetIPAddressFilter_REQ; + +typedef struct +{ + onvif_IPAddressFilter IPAddressFilter; // required +} tds_AddIPAddressFilter_REQ; + +typedef struct +{ + onvif_IPAddressFilter IPAddressFilter; // required +} tds_RemoveIPAddressFilter_REQ; + +typedef struct +{ + int dummy; +} tds_GetAccessPolicy_REQ; + +typedef struct +{ + onvif_BinaryData PolicyFile; // required +} tds_SetAccessPolicy_REQ; + +typedef struct +{ + int dummy; +} tds_GetStorageConfigurations_REQ; + +typedef struct +{ + onvif_StorageConfigurationData StorageConfiguration; // required +} tds_CreateStorageConfiguration_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required +} tds_GetStorageConfiguration_REQ; + +typedef struct +{ + onvif_StorageConfiguration StorageConfiguration; // required +} tds_SetStorageConfiguration_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required +} tds_DeleteStorageConfiguration_REQ; + +typedef struct +{ + int dummy; +} trt_GetServiceCapabilities_REQ; + +typedef struct +{ + int dummy; +} trt_GetVideoSources_REQ; + +typedef struct +{ + int dummy; +} trt_GetAudioSources_REQ; + +typedef struct +{ + uint32 TokenFlag : 1; // Indicates whether the field Token is valid + uint32 Reserved : 31; + + char Name[ONVIF_NAME_LEN]; // required, friendly name of the profile to be created + char Token[ONVIF_TOKEN_LEN]; // optional, Optional token, specifying the unique identifier of the new profile +} trt_CreateProfile_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, this command requests a specific profile +} trt_GetProfile_REQ; + +typedef struct +{ + int dummy; +} trt_GetProfiles_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, Reference to the profile where the configuration should be added + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Contains a reference to the VideoEncoderConfiguration to add +} trt_AddVideoEncoderConfiguration_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, Reference to the profile where the configuration should be added + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Contains a reference to the VideoEncoderConfiguration to add +} trt_AddVideoSourceConfiguration_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, Reference to the profile where the configuration should be added + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Contains a reference to the VideoEncoderConfiguration to add +} trt_AddAudioEncoderConfiguration_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, Reference to the profile where the configuration should be added + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Contains a reference to the VideoEncoderConfiguration to add +} trt_AddAudioSourceConfiguration_REQ; + +typedef struct +{ + char VideoSourceToken[ONVIF_TOKEN_LEN]; // required, Contains a video source reference for which a video source mode is requested +} trt_GetVideoSourceModes_REQ; + +typedef struct +{ + char VideoSourceToken[ONVIF_TOKEN_LEN]; // required, Contains a video source reference for which a video source mode is requested + char VideoSourceModeToken[ONVIF_TOKEN_LEN]; // required, Indicate video source mode +} trt_SetVideoSourceMode_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, Reference to the profile where the configuration should be added + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Contains a reference to the VideoEncoderConfiguration to add +} trt_AddPTZConfiguration_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, Contains a reference to the media profile from which the VideoEncoderConfiguration shall be removed +} trt_RemoveVideoEncoderConfiguration_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, Contains a reference to the media profile from which the VideoSourceConfiguration shall be removed +} trt_RemoveVideoSourceConfiguration_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, Contains a reference to the media profile from which the AudioEncoderConfiguration shall be removed +} trt_RemoveAudioEncoderConfiguration_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, Contains a reference to the media profile from which the AudioSourceConfiguration shall be removed +} trt_RemoveAudioSourceConfiguration_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, Contains a reference to the media profile from which the PTZConfiguration shall be removed +} trt_RemovePTZConfiguration_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, This element contains a reference to the profile that should be deleted +} trt_DeleteProfile_REQ; + +typedef struct +{ + int dummy; +} trt_GetVideoSourceConfigurations_REQ; + +typedef struct +{ + int dummy; +} trt_GetVideoEncoderConfigurations_REQ; + +typedef struct +{ + int dummy; +} trt_GetAudioSourceConfigurations_REQ; + +typedef struct +{ + int dummy; +} trt_GetAudioEncoderConfigurations_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Token of the requested video source configuration +} trt_GetVideoSourceConfiguration_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Token of the requested video encoder configuration +} trt_GetVideoEncoderConfiguration_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Token of the requested audio source configuration +} trt_GetAudioSourceConfiguration_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Token of the requested audio encoder configuration +} trt_GetAudioEncoderConfiguration_REQ; + +typedef struct +{ + onvif_VideoSourceConfiguration VideoSourceConfiguration; + + BOOL ForcePersistence; // required, The ForcePersistence element is obsolete and should always be assumed to be true +} trt_SetVideoSourceConfiguration_REQ; + +typedef struct +{ + onvif_VideoEncoderConfiguration VideoEncoderConfiguration; + + BOOL ForcePersistence; // required, The ForcePersistence element is obsolete and should always be assumed to be true +} trt_SetVideoEncoderConfiguration_REQ; + +typedef struct +{ + onvif_AudioSourceConfiguration AudioSourceConfiguration; + + BOOL ForcePersistence; // required, The ForcePersistence element is obsolete and should always be assumed to be true +} trt_SetAudioSourceConfiguration_REQ; + +typedef struct +{ + onvif_AudioEncoderConfiguration AudioEncoderConfiguration; + + BOOL ForcePersistence; // required, The ForcePersistence element is obsolete and should always be assumed to be true +} trt_SetAudioEncoderConfiguration_REQ; + +typedef struct +{ + uint32 ProfileTokenFlag : 1; // Indicates whether the field ProfileToken is valid + uint32 ConfigurationTokenFlag : 1; // Indicates whether the field ConfigurationToken is valid + uint32 Reserved : 30; + + char ProfileToken[ONVIF_TOKEN_LEN]; // optional, Optional ProfileToken that specifies an existing media profile that the options shall be compatible with + char ConfigurationToken[ONVIF_TOKEN_LEN]; // optional, Optional video source configurationToken that specifies an existing configuration that the options are intended for +} trt_GetVideoSourceConfigurationOptions_REQ; + +typedef struct +{ + uint32 ProfileTokenFlag : 1; // Indicates whether the field ProfileToken is valid + uint32 ConfigurationTokenFlag : 1; // Indicates whether the field ConfigurationToken is valid + uint32 Reserved : 30; + + char ProfileToken[ONVIF_TOKEN_LEN]; // optional, Optional ProfileToken that specifies an existing media profile that the options shall be compatible with + char ConfigurationToken[ONVIF_TOKEN_LEN]; // optional, Optional video encoder configuration token that specifies an existing configuration that the options are intended for +} trt_GetVideoEncoderConfigurationOptions_REQ; + +typedef struct +{ + uint32 ProfileTokenFlag : 1; // Indicates whether the field ProfileToken is valid + uint32 ConfigurationTokenFlag : 1; // Indicates whether the field ConfigurationToken is valid + uint32 Reserved : 30; + + char ProfileToken[ONVIF_TOKEN_LEN]; // optional, Optional ProfileToken that specifies an existing media profile that the options shall be compatible with + char ConfigurationToken[ONVIF_TOKEN_LEN]; // optional, Optional audio source configuration token that specifies an existing configuration that the options are intended for +} trt_GetAudioSourceConfigurationOptions_REQ; + +typedef struct +{ + uint32 ProfileTokenFlag : 1; // Indicates whether the field ProfileToken is valid + uint32 ConfigurationTokenFlag : 1; // Indicates whether the field ConfigurationToken is valid + uint32 Reserved : 30; + + char ProfileToken[ONVIF_TOKEN_LEN]; // optional, Optional ProfileToken that specifies an existing media profile that the options shall be compatible with + char ConfigurationToken[ONVIF_TOKEN_LEN]; // optional, Optional audio encoder configuration token that specifies an existing configuration that the options are intended for +} trt_GetAudioEncoderConfigurationOptions_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, The ProfileToken element indicates the media profile to use and will define the configuration of the content of the stream + + onvif_StreamSetup StreamSetup; // required, Stream Setup that should be used with the uri +} trt_GetStreamUri_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, Contains a Profile reference for which a Synchronization Point is requested +} trt_SetSynchronizationPoint_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, The ProfileToken element indicates the media profile to use and will define the source and dimensions of the snapshot +} trt_GetSnapshotUri_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Token of the video source configuration +} trt_GetGuaranteedNumberOfVideoEncoderInstances_REQ; + +typedef struct +{ + int dummy; +} trt_GetAudioOutputs_REQ; + +typedef struct +{ + int dummy; +} trt_GetAudioOutputConfigurations_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Token of the requested audio output configuration +} trt_GetAudioOutputConfiguration_REQ; + +typedef struct +{ + uint32 ConfigurationTokenFlag : 1; // Indicates whether the field ConfigurationToken is valid + uint32 ProfileTokenFlag : 1; // Indicates whether the field ProfileToken is valid + uint32 Reserved : 30; + + char ConfigurationToken[ONVIF_TOKEN_LEN]; // optional, Optional audio output configuration token that specifies an existing configuration that the options are intended for + char ProfileToken[ONVIF_TOKEN_LEN]; // optional, Optional ProfileToken that specifies an existing media profile that the options shall be compatible with +} trt_GetAudioOutputConfigurationOptions_REQ; + +typedef struct +{ + onvif_AudioOutputConfiguration Configuration; // required, Contains the modified audio output configuration. The configuration shall exist in the device + + BOOL ForcePersistence; // required, The ForcePersistence element is obsolete and should always be assumed to be true +} trt_SetAudioOutputConfiguration_REQ; + +typedef struct +{ + int dummy; +} trt_GetAudioDecoderConfigurations_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Token of the requested audio decoder configuration +} trt_GetAudioDecoderConfiguration_REQ; + +typedef struct +{ + uint32 ConfigurationTokenFlag : 1; // Indicates whether the field ConfigurationToken is valid + uint32 ProfileTokenFlag : 1; // Indicates whether the field ProfileToken is valid + uint32 Reserved : 30; + + char ConfigurationToken[ONVIF_TOKEN_LEN]; // optional, Optional audio decoder configuration token that specifies an existing configuration that the options are intended for + char ProfileToken[ONVIF_TOKEN_LEN]; // optional, Optional ProfileToken that specifies an existing media profile that the options shall be compatible with +} trt_GetAudioDecoderConfigurationOptions_REQ; + +typedef struct +{ + onvif_AudioDecoderConfiguration Configuration; // required, Contains the modified audio decoder configuration. The configuration shall exist in the device + + BOOL ForcePersistence; // required, The ForcePersistence element is obsolete and should always be assumed to be true +} trt_SetAudioDecoderConfiguration_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, Reference to the profile where the configuration should be added + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Contains a reference to the AudioOutputConfiguration to add +} trt_AddAudioOutputConfiguration_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, This element contains a reference to the profile where the configuration should be added + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, This element contains a reference to the AudioDecoderConfiguration to add +} trt_AddAudioDecoderConfiguration_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, Contains a reference to the media profile from which the AudioOutputConfiguration shall be removed +} trt_RemoveAudioOutputConfiguration_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, This element contains a reference to the media profile from which the AudioDecoderConfiguration shall be removed +} trt_RemoveAudioDecoderConfiguration_REQ; + +typedef struct +{ + uint32 ConfigurationTokenFlag : 1; // Indicates whether the field ConfigurationToken is valid + uint32 Reserved : 31; + + char ConfigurationToken[ONVIF_TOKEN_LEN]; // optional, Token of the Video Source Configuration, which has OSDs associated with are requested. If token not exist, request all available OSDs +} trt_GetOSDs_REQ; + +typedef struct +{ + char OSDToken[ONVIF_TOKEN_LEN]; // required, The GetOSD command fetches the OSD configuration if the OSD token is known +} trt_GetOSD_REQ; + +typedef struct +{ + onvif_OSDConfiguration OSD; // required, Contains the modified OSD configuration +} trt_SetOSD_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Video Source Configuration Token that specifies an existing video source configuration that the options shall be compatible with +} trt_GetOSDOptions_REQ; + +typedef struct +{ + onvif_OSDConfiguration OSD; // required, Contain the initial OSD configuration for create +} trt_CreateOSD_REQ; + +typedef struct +{ + char OSDToken[ONVIF_TOKEN_LEN]; // required, This element contains a reference to the OSD configuration that should be deleted +} trt_DeleteOSD_REQ; + + +typedef struct +{ + int dummy; +} trt_GetVideoAnalyticsConfigurations_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, Reference to the profile where the configuration should be added + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Contains a reference to the VideoAnalyticsConfiguration to add +} trt_AddVideoAnalyticsConfiguration_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, The requested video analytics configuration +} trt_GetVideoAnalyticsConfiguration_REQ; + +typedef struct +{ + onvif_VideoAnalyticsConfiguration Configuration; // required, Contains the modified video analytics configuration. The configuration shall exist in the device + + BOOL ForcePersistence; // required, The ForcePersistence element is obsolete and should always be assumed to be true +} trt_SetVideoAnalyticsConfiguration_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, Contains a reference to the media profile from which the VideoAnalyticsConfiguration shall be removed +} trt_RemoveVideoAnalyticsConfiguration_REQ; + +typedef struct +{ + int dummy; +} trt_GetMetadataConfigurations_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, Reference to the profile where the configuration should be added + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Contains a reference to the MetadataConfiguration to add +} trt_AddMetadataConfiguration_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, The requested metadata configuration +} trt_GetMetadataConfiguration_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, Contains a reference to the media profile from which the MetadataConfiguration shall be removed +} trt_RemoveMetadataConfiguration_REQ; + +typedef struct +{ + onvif_MetadataConfiguration Configuration; // required, Contains the modified metadata configuration. The configuration shall exist in the device + BOOL ForcePersistence; // required, The ForcePersistence element is obsolete and should always be assumed to be true +} trt_SetMetadataConfiguration_REQ; + +typedef struct +{ + uint32 ConfigurationTokenFlag : 1; // Indicates whether the field ConfigurationToken is valid + uint32 ProfileTokenFlag : 1; // Indicates whether the field ProfileToken is valid + uint32 Reserved : 30; + + char ConfigurationToken[ONVIF_TOKEN_LEN]; // optional, Optional metadata configuration token that specifies an existing configuration that the options are intended for + char ProfileToken[ONVIF_TOKEN_LEN]; // optional, Optional ProfileToken that specifies an existing media profile that the options shall be compatible with +} trt_GetMetadataConfigurationOptions_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required +} trt_GetCompatibleVideoEncoderConfigurations_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required +} trt_GetCompatibleAudioEncoderConfigurations_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required +} trt_GetCompatibleVideoAnalyticsConfigurations_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required +} trt_GetCompatibleMetadataConfigurations_REQ; + +typedef struct +{ + int dummy; +} ptz_GetServiceCapabilities_REQ; + +typedef struct +{ + int dummy; +} ptz_GetNodes_REQ; + +typedef struct +{ + char NodeToken[ONVIF_TOKEN_LEN]; // required, Token of the requested PTZNode +} ptz_GetNode_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, A reference to the MediaProfile where the operation should take place +} ptz_GetPresets_REQ; + +typedef struct +{ + uint32 PresetTokenFlag : 1; // Indicates whether the field PresetToken is valid + uint32 PresetNameFlag : 1; // Indicates whether the field PresetName is valid + uint32 Reserved : 30; + + char ProfileToken[ONVIF_TOKEN_LEN]; // required, A reference to the MediaProfile where the operation should take place + char PresetToken[ONVIF_TOKEN_LEN]; // optional, A requested preset token + char PresetName[ONVIF_NAME_LEN]; // optional, A requested preset name +} ptz_SetPreset_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, A reference to the MediaProfile where the operation should take place + char PresetToken[ONVIF_TOKEN_LEN]; // required, A requested preset token +} ptz_RemovePreset_REQ; + +typedef struct +{ + uint32 SpeedFlag : 1; // Indicates whether the field Speed is valid + uint32 Reserved : 31; + + char ProfileToken[ONVIF_TOKEN_LEN]; // required, A reference to the MediaProfile where the operation should take place + char PresetToken[ONVIF_TOKEN_LEN]; // required, A requested preset token + + onvif_PTZSpeed Speed; // optional, A requested speed.The speed parameter can only be specified when Speed Spaces are available for the PTZ Node +} ptz_GotoPreset_REQ; + +typedef struct +{ + uint32 SpeedFlag : 1; // Indicates whether the field Speed is valid + uint32 Reserved : 31; + + char ProfileToken[ONVIF_TOKEN_LEN]; // required, A reference to the MediaProfile where the operation should take place + + onvif_PTZSpeed Speed; // optional, A requested speed.The speed parameter can only be specified when Speed Spaces are available for the PTZ Node +} ptz_GotoHomePosition_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, A reference to the MediaProfile where the home position should be set +} ptz_SetHomePosition_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, A reference to the MediaProfile where the PTZStatus should be requested +} ptz_GetStatus_REQ; + +typedef struct +{ + uint32 TimeoutFlag : 1; // Indicates whether the field Timeout is valid + uint32 Reserved : 31; + + char ProfileToken[ONVIF_TOKEN_LEN]; // required, A reference to the MediaProfile + + onvif_PTZSpeed Velocity; // required, A Velocity vector specifying the velocity of pan, tilt and zoom + + int Timeout; // optional, An optional Timeout parameter, unit is second +} ptz_ContinuousMove_REQ; + +typedef struct +{ + uint32 SpeedFlag : 1; // Indicates whether the field Speed is valid + uint32 Reserved : 31; + + char ProfileToken[ONVIF_TOKEN_LEN]; // required, A reference to the MediaProfile + + onvif_PTZVector Translation; // required, A positional Translation relative to the current position + onvif_PTZSpeed Speed; // optional, An optional Speed parameter +} ptz_RelativeMove_REQ; + +typedef struct +{ + uint32 SpeedFlag : 1; // Indicates whether the field Speed is valid + uint32 Reserved : 31; + + char ProfileToken[ONVIF_TOKEN_LEN]; // required, A reference to the MediaProfile + + onvif_PTZVector Position; // required, A Position vector specifying the absolute target position + onvif_PTZSpeed Speed; // optional, An optional Speed +} ptz_AbsoluteMove_REQ; + +typedef struct +{ + uint32 PanTiltFlag : 1; // Indicates whether the field PanTilt is valid + uint32 ZoomFlag : 1; // Indicates whether the field Zoom is valid + uint32 Reserved : 30; + + char ProfileToken[ONVIF_TOKEN_LEN]; // required, A reference to the MediaProfile that indicate what should be stopped + + BOOL PanTilt; // optional, Set true when we want to stop ongoing pan and tilt movements.If PanTilt arguments are not present, this command stops these movements + BOOL Zoom; // optional, Set true when we want to stop ongoing zoom movement.If Zoom arguments are not present, this command stops ongoing zoom movement +} ptz_Stop_REQ; + +typedef struct +{ + int dummy; +} ptz_GetConfigurations_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Token of the requested PTZConfiguration +} ptz_GetConfiguration_REQ; + +typedef struct +{ + onvif_PTZConfiguration PTZConfiguration; // required + + BOOL ForcePersistence; // required, Flag that makes configuration persistent. Example: User wants the configuration to exist after reboot +} ptz_SetConfiguration_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Token of an existing configuration that the options are intended for +} ptz_GetConfigurationOptions_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required +} ptz_GetPresetTours_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required + char PresetTourToken[ONVIF_TOKEN_LEN]; // required +} ptz_GetPresetTour_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required + char PresetTourToken[ONVIF_TOKEN_LEN]; // optional +} ptz_GetPresetTourOptions_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required +} ptz_CreatePresetTour_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required + + onvif_PresetTour PresetTour; // required +} ptz_ModifyPresetTour_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required + char PresetTourToken[ONVIF_TOKEN_LEN]; // required + + onvif_PTZPresetTourOperation Operation; // required +} ptz_OperatePresetTour_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required + char PresetTourToken[ONVIF_TOKEN_LEN]; // required +} ptz_RemovePresetTour_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, A reference to the MediaProfile where the operation should take place + char AuxiliaryData[1024]; // required, The Auxiliary request data +} ptz_SendAuxiliaryCommand_REQ; + +typedef struct +{ + uint32 SpeedFlag : 1; // Indicates whether the field Speed is valid + uint32 AreaHeightFlag : 1; // Indicates whether the field AreaHeight is valid + uint32 AreaWidthFlag : 1; // Indicates whether the field AreaHeight is valid + uint32 Reserved : 29; + + char ProfileToken[ONVIF_TOKEN_LEN]; // required, A reference to the MediaProfile + + onvif_GeoLocation Target; // required, The geolocation of the target position + onvif_PTZSpeed Speed; // optional, An optional Speed + + float AreaHeight; // optional, An optional indication of the height of the target/area + float AreaWidth; // optional, An optional indication of the width of the target/area +} ptz_GeoMove_REQ; + +typedef struct +{ + int dummy; +} tev_GetServiceCapabilities_REQ; + +typedef struct +{ + int dummy; +} tev_GetEventProperties_REQ; + +typedef struct +{ + int TerminationTime; +} tev_Renew_REQ; + +typedef struct +{ + int dummy; +} tev_Unsubscribe_REQ; + +typedef struct +{ + uint32 FiltersFlag : 1; + uint32 Reserved : 31; + + char ConsumerReference[256]; + int InitialTerminationTime; // InitialTerminationTime, unit is second + + onvif_EventFilter Filter; +} tev_Subscribe_REQ; + +typedef struct +{ + int dummy; +} tev_PauseSubscription_REQ; + +typedef struct +{ + int dummy; +} tev_ResumeSubscription_REQ; + +typedef struct +{ + uint32 FiltersFlag : 1; + uint32 Reserved : 31; + + int InitialTerminationTime; // InitialTerminationTime, unit is second + + onvif_EventFilter Filter; +} tev_CreatePullPointSubscription_REQ; + +typedef struct +{ + int dummy; +} tev_DestroyPullPoint_REQ; + +typedef struct +{ + int Timeout; // required, Maximum time to block until this method returns, unit is second + int MessageLimit; // required, Upper limit for the number of messages to return at once. A server implementation may decide to return less messages +} tev_PullMessages_REQ; + +typedef struct +{ + int MaximumNumber; // required, Upper limit for the number of messages to return at once. A server implementation may decide to return less messages +} tev_GetMessages_REQ; + +typedef struct +{ + time_t UtcTime; // required, The date and time to match against stored messages. + // When Seek is used in the forward mode a device shall position the pull pointer to include all NotificationMessages in the persistent storage with a UtcTime attribute greater than or equal to the Seek argument. + // When Seek is used in reverse mode a device shall position the pull pointer to include all NotificationMessages in the in the persistent storage with a UtcTime attribute less than or equal to the Seek argument. + BOOL Reverse; // optional, Reverse the pull direction of PullMessages +} tev_Seek_REQ; + +typedef struct +{ + int dummy; +} tev_SetSynchronizationPoint_REQ; + +typedef struct +{ + char PostUrl[200]; + + NotificationMessageList * notify; +} Notify_REQ; + +// imaging service + +typedef struct +{ + int dummy; +} img_GetServiceCapabilities_REQ; + +typedef struct +{ + char VideoSourceToken[ONVIF_TOKEN_LEN]; // required +} img_GetImagingSettings_REQ; + +typedef struct +{ + uint32 ForcePersistenceFlag : 1; // Indicates whether the field ForcePersistence is valid + uint32 Reserved : 31; + + char VideoSourceToken[ONVIF_TOKEN_LEN]; // required + BOOL ForcePersistence; // optional + + onvif_ImagingSettings ImagingSettings; // required +} img_SetImagingSettings_REQ; + +typedef struct +{ + char VideoSourceToken[ONVIF_TOKEN_LEN]; // required, Reference token to the VideoSource for which the imaging parameter options are requested +} img_GetOptions_REQ; + +typedef struct +{ + char VideoSourceToken[ONVIF_TOKEN_LEN]; // required, Reference to the VideoSource for the requested move (focus) operation + + onvif_FocusMove Focus; // required, Content of the requested move (focus) operation +} img_Move_REQ; + +typedef struct +{ + char VideoSourceToken[ONVIF_TOKEN_LEN]; // required, Reference to the VideoSource +} img_Stop_REQ; + +typedef struct +{ + char VideoSourceToken[ONVIF_TOKEN_LEN]; // required, Reference to the VideoSource +} img_GetStatus_REQ; + +typedef struct +{ + char VideoSourceToken[ONVIF_TOKEN_LEN]; // required, Reference to the VideoSource +} img_GetMoveOptions_REQ; + +typedef struct +{ + char VideoSourceToken[ONVIF_TOKEN_LEN]; // required, Reference to the VideoSource +} img_GetPresets_REQ; + +typedef struct +{ + char VideoSourceToken[ONVIF_TOKEN_LEN]; // required, Reference to the VideoSource +} img_GetCurrentPreset_REQ; + +typedef struct +{ + char VideoSourceToken[ONVIF_TOKEN_LEN]; //required, , Reference to the VideoSource + char PresetToken[ONVIF_TOKEN_LEN]; //required, Reference token to the Imaging Preset to be applied to the specified Video Source +} img_SetCurrentPreset_REQ; + +// device IO + +typedef struct +{ + int dummy; +} tmd_GetServiceCapabilities_REQ; + +typedef struct +{ + int dummy; +} tmd_GetRelayOutputs_REQ; + +typedef struct +{ + uint32 RelayOutputTokenFlag : 1; + uint32 Reserved : 31; + + char RelayOutputToken[ONVIF_TOKEN_LEN]; // optional, Optional reference token to the relay for which the options are requested +} tmd_GetRelayOutputOptions_REQ; + +typedef struct +{ + onvif_RelayOutput RelayOutput; // required +} tmd_SetRelayOutputSettings_REQ; + +typedef struct +{ + char RelayOutputToken[ONVIF_TOKEN_LEN]; // required + + onvif_RelayLogicalState LogicalState; // required +} tmd_SetRelayOutputState_REQ; + +typedef struct +{ + int dummy; +} tmd_GetDigitalInputs_REQ; + +typedef struct +{ + uint32 TokenFlag : 1; + uint32 Reserved : 31; + + char Token[ONVIF_TOKEN_LEN]; // optional, +} tmd_GetDigitalInputConfigurationOptions_REQ; + +typedef struct +{ + DigitalInputList * DigitalInputs; +} tmd_SetDigitalInputConfigurations_REQ; + +// recording + +typedef struct +{ + int dummy; +} trc_GetServiceCapabilities_REQ; + +typedef struct +{ + onvif_RecordingConfiguration RecordingConfiguration;// required, Initial configuration for the recording +} trc_CreateRecording_REQ; + +typedef struct +{ + char RecordingToken[ONVIF_TOKEN_LEN]; // required, +} trc_DeleteRecording_REQ; + +typedef struct +{ + int dummy; +} trc_GetRecordings_REQ; + +typedef struct +{ + char RecordingToken[ONVIF_TOKEN_LEN]; // required, Token of the recording that shall be changed + + onvif_RecordingConfiguration RecordingConfiguration;// required, The new configuration +} trc_SetRecordingConfiguration_REQ; + +typedef struct +{ + char RecordingToken[ONVIF_TOKEN_LEN]; // required, +} trc_GetRecordingConfiguration_REQ; + +typedef struct +{ + char RecordingToken[ONVIF_TOKEN_LEN]; // required, +} trc_GetRecordingOptions_REQ; + +typedef struct +{ + char RecordingToken[ONVIF_TOKEN_LEN]; // required, Identifies the recording to which a track shall be added + + onvif_TrackConfiguration TrackConfiguration; // required, The configuration of the new track +} trc_CreateTrack_REQ; + +typedef struct +{ + char RecordingToken[ONVIF_TOKEN_LEN]; // required, Token of the recording the track belongs to + char TrackToken[ONVIF_TOKEN_LEN]; // required, Token of the track to be deleted +} trc_DeleteTrack_REQ; + +typedef struct +{ + char RecordingToken[ONVIF_TOKEN_LEN]; // required, Token of the recording the track belongs to + char TrackToken[ONVIF_TOKEN_LEN]; // required, Token of the track +} trc_GetTrackConfiguration_REQ; + +typedef struct +{ + char RecordingToken[ONVIF_TOKEN_LEN]; // required, Token of the recording the track belongs to + char TrackToken[ONVIF_TOKEN_LEN]; // required, Token of the track to be modified + + onvif_TrackConfiguration TrackConfiguration; // required, New configuration for the track +} trc_SetTrackConfiguration_REQ; + +typedef struct +{ + onvif_RecordingJobConfiguration JobConfiguration; // required, The initial configuration of the new recording job +} trc_CreateRecordingJob_REQ; + +typedef struct +{ + char JobToken[ONVIF_TOKEN_LEN]; // required +} trc_DeleteRecordingJob_REQ; + +typedef struct +{ + int dummy; +} trc_GetRecordingJobs_REQ; + +typedef struct +{ + char JobToken[ONVIF_TOKEN_LEN]; // required, Token of the job to be modified + + onvif_RecordingJobConfiguration JobConfiguration; // required, New configuration of the recording job +} trc_SetRecordingJobConfiguration_REQ; + +typedef struct +{ + char JobToken[ONVIF_TOKEN_LEN]; // required +} trc_GetRecordingJobConfiguration_REQ; + +typedef struct +{ + char JobToken[ONVIF_TOKEN_LEN]; // required, Token of the recording job + char Mode[16]; // required, The new mode for the recording job, The only valid values for Mode shall be "Idle" or "Active" +} trc_SetRecordingJobMode_REQ; + +typedef struct +{ + char JobToken[ONVIF_TOKEN_LEN]; // required +} trc_GetRecordingJobState_REQ; + +typedef struct +{ + time_t StartPoint; // optional, Optional parameter that specifies start time for the exporting + time_t EndPoint; // optional, Optional parameter that specifies end time for the exporting + onvif_SearchScope SearchScope; // required, Indicates the selection criterion on the existing recordings + char FileFormat[32]; // required, Indicates which export file format to be used + onvif_StorageReferencePath StorageDestination; // required, Indicates the target storage and relative directory path +} trc_ExportRecordedData_REQ; + +typedef struct +{ + char OperationToken[ONVIF_TOKEN_LEN]; // required, Unique ExportRecordedData operation token +} trc_StopExportRecordedData_REQ; + +typedef struct +{ + char OperationToken[ONVIF_TOKEN_LEN]; // required, Unique ExportRecordedData operation token +} trc_GetExportRecordedDataState_REQ; + +typedef struct +{ + int dummy; +} trp_GetServiceCapabilities_REQ; + +typedef struct +{ + onvif_StreamSetup StreamSetup; + + char RecordingToken[ONVIF_TOKEN_LEN]; // required. The identifier of the recording to be streamed +} trp_GetReplayUri_REQ; + +typedef struct +{ + int dummy; +} trp_GetReplayConfiguration_REQ; + +typedef struct +{ + onvif_ReplayConfiguration Configuration; // required, Description of the new replay configuration parameters +} trp_SetReplayConfiguration_REQ; + +typedef struct +{ + int dummy; +} tse_GetServiceCapabilities_REQ; + +typedef struct +{ + int dummy; +} tse_GetRecordingSummary_REQ; + +typedef struct +{ + char RecordingToken[ONVIF_TOKEN_LEN]; // Required +} tse_GetRecordingInformation_REQ; + +typedef struct +{ + char RecordingTokens[10][ONVIF_TOKEN_LEN]; // optional + time_t Time; // required +} tse_GetMediaAttributes_REQ; + +typedef struct +{ + uint32 MaxMatchesFlag : 1; // Indicates whether the field MaxMatches is valid + uint32 Reserved : 31; + + onvif_SearchScope Scope; // required + + int MaxMatches; // optional, The search will be completed after this many matches. If not specified, the search will continue until reaching the endpoint or until the session expires + int KeepAliveTime; // required, The time the search session will be kept alive after responding to this and subsequent requests. A device shall support at least values up to ten seconds +} tse_FindRecordings_REQ; + +typedef struct +{ + uint32 MinResultsFlag : 1; // Indicates whether the field MinResults is valid + uint32 MaxResultsFlag : 1; // Indicates whether the field MaxResults is valid + uint32 WaitTimeFlag : 1; // Indicates whether the field WaitTime is valid + uint32 Reserved : 29; + + char SearchToken[ONVIF_TOKEN_LEN]; // required, The search session to get results from + int MinResults; // optional, The minimum number of results to return in one response + int MaxResults; // optional, The maximum number of results to return in one response + int WaitTime; // optional, The maximum time before responding to the request, even if the MinResults parameter is not fulfilled +} tse_GetRecordingSearchResults_REQ; + +typedef struct +{ + uint32 EndPointFlag : 1; // Indicates whether the field EndPoint is valid + uint32 MaxMatchesFlag : 1; // Indicates whether the field MaxMatches is valid + uint32 Reserved : 30; + + time_t StartPoint; // required, The point of time where the search will start + time_t EndPoint; // optional, The point of time where the search will stop. This can be a time before the StartPoint, in which case the search is performed backwards in time + + onvif_SearchScope Scope; // required, + onvif_EventFilter SearchFilter; // required, + + BOOL IncludeStartState; // required, Setting IncludeStartState to true means that the server should return virtual events representing the start state for any recording included in the scope. Start state events are limited to the topics defined in the SearchFilter that have the IsProperty flag set to true + int MaxMatches; // optional, The search will be completed after this many matches. If not specified, the search will continue until reaching the endpoint or until the session expires + int KeepAliveTime; // required, The time the search session will be kept alive after responding to this and subsequent requests. A device shall support at least values up to ten seconds +} tse_FindEvents_REQ; + +typedef struct +{ + uint32 MinResultsFlag : 1; // Indicates whether the field MinResults is valid + uint32 MaxResultsFlag : 1; // Indicates whether the field MaxResults is valid + uint32 WaitTimeFlag : 1; // Indicates whether the field WaitTime is valid + uint32 Reserved : 29; + + char SearchToken[ONVIF_TOKEN_LEN]; // required, The search session to get results from + int MinResults; // optional, The minimum number of results to return in one response + int MaxResults; // optional, The maximum number of results to return in one response + int WaitTime; // optional, The maximum time before responding to the request, even if the MinResults parameter is not fulfilled +} tse_GetEventSearchResults_REQ; + +typedef struct +{ + uint32 EndPointFlag : 1; // Indicates whether the field EndPoint is valid + uint32 MaxMatchesFlag : 1; // Indicates whether the field MaxMatches is valid + uint32 Reserved : 30; + + time_t StartPoint; // required, The point of time where the search will start + time_t EndPoint; // optional, The point of time where the search will stop. This can be a time before the StartPoint, in which case the search is performed backwards in time + + onvif_SearchScope Scope; // required, + onvif_MetadataFilter MetadataFilter; // required, + + int MaxMatches; // optional, The search will be completed after this many matches. If not specified, the search will continue until reaching the endpoint or until the session expires + int KeepAliveTime; // required, The time the search session will be kept alive after responding to this and subsequent requests. A device shall support at least values up to ten seconds +} tse_FindMetadata_REQ; + +typedef struct +{ + uint32 MinResultsFlag : 1; // Indicates whether the field MinResults is valid + uint32 MaxResultsFlag : 1; // Indicates whether the field MaxResults is valid + uint32 WaitTimeFlag : 1; // Indicates whether the field WaitTime is valid + uint32 Reserved : 29; + + char SearchToken[ONVIF_TOKEN_LEN]; // required, The search session to get results from + int MinResults; // optional, The minimum number of results to return in one response + int MaxResults; // optional, The maximum number of results to return in one response + int WaitTime; // optional, The maximum time before responding to the request, even if the MinResults parameter is not fulfilled +} tse_GetMetadataSearchResults_REQ; + +typedef struct +{ + uint32 EndPointFlag : 1; // Indicates whether the field EndPoint is valid + uint32 MaxMatchesFlag : 1; // Indicates whether the field MaxMatches is valid + uint32 Reserved : 30; + + time_t StartPoint; // required, The point of time where the search will start + time_t EndPoint; // optional, The point of time where the search will stop. This can be a time before the StartPoint, in which case the search is performed backwards in time + + onvif_SearchScope Scope; // required, + onvif_PTZPositionFilter SearchFilter; // required, + + int MaxMatches; // optional, The search will be completed after this many matches. If not specified, the search will continue until reaching the endpoint or until the session expires + int KeepAliveTime; // required, The time the search session will be kept alive after responding to this and subsequent requests. A device shall support at least values up to ten seconds +} tse_FindPTZPosition_REQ; + +typedef struct +{ + uint32 MinResultsFlag : 1; // Indicates whether the field MinResults is valid + uint32 MaxResultsFlag : 1; // Indicates whether the field MaxResults is valid + uint32 WaitTimeFlag : 1; // Indicates whether the field WaitTime is valid + uint32 Reserved : 29; + + char SearchToken[ONVIF_TOKEN_LEN]; // required, The search session to get results from + int MinResults; // optional, The minimum number of results to return in one response + int MaxResults; // optional, The maximum number of results to return in one response + int WaitTime; // optional, The maximum time before responding to the request, even if the MinResults parameter is not fulfilled +} tse_GetPTZPositionSearchResults_REQ; + +typedef struct +{ + char SearchToken[ONVIF_TOKEN_LEN]; // required, The search session to get the state from +} tse_GetSearchState_REQ; + +typedef struct +{ + char SearchToken[ONVIF_TOKEN_LEN]; // required, The search session to end +} tse_EndSearch_REQ; + +typedef struct +{ + int dummy; +} tan_GetServiceCapabilities_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, References an existing Video Analytics configuration. The list of available tokens can be obtained + // via the Media service GetVideoAnalyticsConfigurations method +} tan_GetSupportedRules_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Reference to an existing VideoAnalyticsConfiguration + + ConfigList * Rule; // required +} tan_CreateRules_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Reference to an existing VideoAnalyticsConfiguration + + int sizeRuleName; + char RuleName[10][ONVIF_NAME_LEN]; // required, References the specific rule to be deleted (e.g. "MyLineDetector"). +} tan_DeleteRules_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Reference to an existing VideoAnalyticsConfiguration +} tan_GetRules_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Reference to an existing VideoAnalyticsConfiguration + + ConfigList * Rule; // required +} tan_ModifyRules_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Reference to an existing VideoAnalyticsConfiguration + + ConfigList * AnalyticsModule; // required +} tan_CreateAnalyticsModules_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Reference to an existing Video Analytics configuration + + int sizeAnalyticsModuleName; + char AnalyticsModuleName[10][ONVIF_NAME_LEN]; //required, name of the AnalyticsModule to be deleted +} tan_DeleteAnalyticsModules_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Reference to an existing VideoAnalyticsConfiguration +} tan_GetAnalyticsModules_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Reference to an existing VideoAnalyticsConfiguration + + ConfigList * AnalyticsModule; // required +} tan_ModifyAnalyticsModules_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Reference to an existing VideoAnalyticsConfiguration +} tan_GetSupportedAnalyticsModules_REQ; + +typedef struct +{ + uint32 RuleTypeFlag : 1; // Indicates whether the field RuleType is valid + uint32 Reserved : 31; + + char RuleType[128]; // optional, Reference to an SupportedRule Type returned from GetSupportedRules + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, +} tan_GetRuleOptions_REQ; + +typedef struct +{ + char Type[128]; // optional, Reference to an SupportedAnalyticsModule Type returned from GetSupportedAnalyticsModules + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Reference to an existing AnalyticsConfiguration +} tan_GetAnalyticsModuleOptions_REQ; + +typedef struct +{ + char Type[128]; // optional, reference to an AnalyticsModule Type returned from GetSupportedAnalyticsModules +} tan_GetSupportedMetadata_REQ; + +// onvif media service 2 interfaces + +#define TR2_MAX_TYPE 10 +#define TR2_MAX_CONFIGURATION 10 + +typedef struct +{ + int dummy; +} tr2_GetServiceCapabilities_REQ; + +typedef struct +{ + uint32 ConfigurationTokenFlag : 1; + uint32 ProfileTokenFlag : 1; + uint32 Reserved : 30; + + char ConfigurationToken[ONVIF_TOKEN_LEN]; // optional, Token of the requested configuration + char ProfileToken[ONVIF_TOKEN_LEN]; // optional, Contains the token of an existing media profile the configurations shall be compatible with +} tr2_GetConfiguration; + +typedef struct +{ + char Name[ONVIF_NAME_LEN]; // required, friendly name of the profile to be created + + int sizeConfiguration; + onvif_ConfigurationRef Configuration[TR2_MAX_CONFIGURATION]; // optional, Optional set of configurations to be assigned to the profile +} tr2_CreateProfile_REQ; + +typedef struct +{ + uint32 TokenFlag : 1; + uint32 Reserved : 31; + + char Token[ONVIF_TOKEN_LEN]; // optional, Optional token of the requested profile + + int sizeType; + char Type[TR2_MAX_TYPE][32]; // optional, The types shall be provided as defined by tr2:ConfigurationEnumeration + // All, VideoSource, VideoEncoder, AudioSource, AudioEncoder, AudioOutput, + // AudioDecoder, Metadata, Analytics, PTZ +} tr2_GetProfiles_REQ; + +typedef struct +{ + uint32 NameFlag : 1; + uint32 Reserved : 31; + + char ProfileToken[ONVIF_TOKEN_LEN]; // required, Reference to the profile where the configuration should be added + char Name[ONVIF_NAME_LEN]; // optional, Optional item. If present updates the Name property of the profile + + int sizeConfiguration; + onvif_ConfigurationRef Configuration[TR2_MAX_CONFIGURATION]; // optional, List of configurations to be added +} tr2_AddConfiguration_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, This element contains a reference to the media profile + + int sizeConfiguration; + onvif_ConfigurationRef Configuration[TR2_MAX_CONFIGURATION]; // required, List of configurations to be removed +} tr2_RemoveConfiguration_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, This element contains a reference to the profile that should be deleted +} tr2_DeleteProfile_REQ; + +typedef struct +{ + tr2_GetConfiguration GetConfiguration; +} tr2_GetVideoEncoderConfigurations_REQ; + +typedef struct +{ + tr2_GetConfiguration GetConfiguration; +} tr2_GetVideoSourceConfigurations_REQ; + +typedef struct +{ + tr2_GetConfiguration GetConfiguration; +} tr2_GetAudioEncoderConfigurations_REQ; + +typedef struct +{ + tr2_GetConfiguration GetConfiguration; +} tr2_GetAudioSourceConfigurations_REQ; + +typedef struct +{ + tr2_GetConfiguration GetConfiguration; +} tr2_GetMetadataConfigurations_REQ; + +typedef struct +{ + tr2_GetConfiguration GetConfiguration; +} tr2_GetAudioOutputConfigurations_REQ; + +typedef struct +{ + tr2_GetConfiguration GetConfiguration; +} tr2_GetAudioDecoderConfigurations_REQ; + +typedef struct +{ + onvif_VideoEncoder2Configuration Configuration; // Contains the modified video encoder configuration. The configuration shall exist in the device +} tr2_SetVideoEncoderConfiguration_REQ; + +typedef struct +{ + onvif_VideoSourceConfiguration Configuration; // required, Contains the modified video source configuration. The configuration shall exist in the device +} tr2_SetVideoSourceConfiguration_REQ; + +typedef struct +{ + onvif_AudioEncoder2Configuration Configuration; // required, Contains the modified audio encoder configuration. The configuration shall exist in the device +} tr2_SetAudioEncoderConfiguration_REQ; + +typedef struct +{ + onvif_AudioSourceConfiguration Configuration; // required, Contains the modified audio source configuration. The configuration shall exist in the device +} tr2_SetAudioSourceConfiguration_REQ; + +typedef struct +{ + onvif_MetadataConfiguration Configuration; // required, Contains the modified metadata configuration. The configuration shall exist in the device +} tr2_SetMetadataConfiguration_REQ; + +typedef struct +{ + onvif_AudioOutputConfiguration Configuration; // required, Contains the modified audio output configuration. The configuration shall exist in the device +} tr2_SetAudioOutputConfiguration_REQ; + +typedef struct +{ + tr2_GetConfiguration GetConfiguration; +} tr2_GetVideoSourceConfigurationOptions_REQ; + +typedef struct +{ + tr2_GetConfiguration GetConfiguration; +} tr2_GetVideoEncoderConfigurationOptions_REQ; + +typedef struct +{ + tr2_GetConfiguration GetConfiguration; +} tr2_GetAudioSourceConfigurationOptions_REQ; + +typedef struct +{ + tr2_GetConfiguration GetConfiguration; +} tr2_GetAudioEncoderConfigurationOptions_REQ; + +typedef struct +{ + tr2_GetConfiguration GetConfiguration; +} tr2_GetMetadataConfigurationOptions_REQ; + +typedef struct +{ + tr2_GetConfiguration GetConfiguration; +} tr2_GetAudioOutputConfigurationOptions_REQ; + +typedef struct +{ + tr2_GetConfiguration GetConfiguration; +} tr2_GetAudioDecoderConfigurationOptions_REQ; + +typedef struct +{ + onvif_AudioDecoderConfiguration Configuration; +} tr2_SetAudioDecoderConfiguration_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, +} tr2_GetSnapshotUri_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, +} tr2_StartMulticastStreaming_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, +} tr2_StopMulticastStreaming_REQ; + +typedef struct +{ + char VideoSourceToken[ONVIF_TOKEN_LEN]; // required, +} tr2_GetVideoSourceModes_REQ; + +typedef struct +{ + char VideoSourceToken[ONVIF_TOKEN_LEN]; // required, + char VideoSourceModeToken[ONVIF_TOKEN_LEN]; // required, +} tr2_SetVideoSourceMode_REQ; + +typedef struct +{ + onvif_OSDConfiguration OSD; // required, +} tr2_CreateOSD_REQ; + +typedef struct +{ + char OSDToken[ONVIF_TOKEN_LEN]; // required, +} tr2_DeleteOSD_REQ; + +typedef struct +{ + uint32 OSDTokenFlag : 1; + uint32 ConfigurationTokenFlag : 1; + uint32 Reserved : 30; + + char OSDToken[ONVIF_TOKEN_LEN]; // optional, + char ConfigurationToken[ONVIF_TOKEN_LEN]; // optional, +} tr2_GetOSDs_REQ; + +typedef struct +{ + onvif_OSDConfiguration OSD; // required +} tr2_SetOSD_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Video Source Configuration Token that specifies an existing video source configuration that the options shall be compatible with +} tr2_GetOSDOptions_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Token of the video source configuration +} tr2_GetVideoEncoderInstances_REQ; + +typedef struct +{ + char Protocol[32]; // required, Defines the network protocol + // RtspUnicast -- RTSP streaming RTP as UDP Unicast + // RtspMulticast -- RTSP streaming RTP as UDP Multicast + // RTSP -- RTSP streaming RTP over TCP + // RtspOverHttp -- Tunneling both the RTSP control channel and the RTP stream over HTTP or HTTPS + char ProfileToken[ONVIF_TOKEN_LEN]; // required, The ProfileToken element indicates the media profile + // to use and will define the configuration of the content of the stream +} tr2_GetStreamUri_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, Contains a Profile reference for which a Synchronization Point is requested +} tr2_SetSynchronizationPoint_REQ; + +typedef struct +{ + tr2_GetConfiguration GetConfiguration; // optional, +} tr2_GetAnalyticsConfigurations_REQ; + +typedef struct +{ + onvif_Mask Mask; // required, Contain the initial mask configuration for create +} tr2_CreateMask_REQ; + +typedef struct +{ + uint32 TokenFlag : 1; // Indicates whether the field Token is valid + uint32 ConfigurationTokenFlag : 1; // Indicates whether the field ConfigurationToken is valid + uint32 Reserved : 30; + + char Token[ONVIF_TOKEN_LEN]; // optional, Optional mask token of an existing mask + char ConfigurationToken[ONVIF_TOKEN_LEN]; // optional, Optional token of a Video Source Configuration +} tr2_GetMasks_REQ; + +typedef struct +{ + onvif_Mask Mask; // required, Mask to be updated +} tr2_SetMask_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, This element contains a reference to the Mask configuration that should be deleted +} tr2_DeleteMask_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Video Source Configuration Token that specifies an existing video source configuration that the options shall be compatible with +} tr2_GetMaskOptions_REQ; + +// end of onvif media 2 interfaces + +typedef struct +{ + int dummy; +} tac_GetServiceCapabilities_REQ; + +typedef struct +{ + uint32 LimitFlag : 1; + uint32 StartReferenceFlag : 1; + uint32 Reserved : 30; + + int Limit; // optional, Maximum number of entries to return. If not specified, less than one or higher than what the device supports, the number of items is determined by the device + char StartReference[256]; // optional, Start returning entries from this start reference. If not specified, entries shall start from the beginning of the dataset +} tac_GetAccessPointInfoList_REQ; + +typedef struct +{ + char token[ACCESS_CTRL_MAX_LIMIT][ONVIF_TOKEN_LEN]; // Tokens of AccessPointInfo items to get +} tac_GetAccessPointInfo_REQ; + +typedef struct +{ + uint32 LimitFlag : 1; + uint32 StartReferenceFlag : 1; + uint32 Reserved : 30; + + int Limit; // optional, Maximum number of entries to return. If not specified, less than one or higher than what the device supports, the number of items is determined by the device + char StartReference[256]; // optional, Start returning entries from this start reference. If not specified, entries shall start from the beginning of the dataset +} tac_GetAccessPointList_REQ; + +typedef struct +{ + char token[ACCESS_CTRL_MAX_LIMIT][ONVIF_TOKEN_LEN]; // Tokens of AccessPoint items to get +} tac_GetAccessPoints_REQ; + +typedef struct +{ + uint32 AuthenticationProfileTokenFlag : 1; + uint32 Reserved : 31; + + onvif_AccessPointInfo AccessPoint; // required + + char AuthenticationProfileToken[ONVIF_TOKEN_LEN]; // optional +} tac_CreateAccessPoint_REQ; + +typedef struct +{ + uint32 AuthenticationProfileTokenFlag : 1; + uint32 Reserved : 31; + + onvif_AccessPointInfo AccessPoint; // required + + char AuthenticationProfileToken[ONVIF_TOKEN_LEN]; // optional +} tac_SetAccessPoint_REQ; + +typedef struct +{ + uint32 AuthenticationProfileTokenFlag : 1; + uint32 Reserved : 31; + + onvif_AccessPointInfo AccessPoint; // required + + char AuthenticationProfileToken[ONVIF_TOKEN_LEN]; // optional +} tac_ModifyAccessPoint_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, Token of AccessPoint item to delete +} tac_DeleteAccessPoint_REQ; + +typedef struct +{ + uint32 LimitFlag : 1; + uint32 StartReferenceFlag : 1; + uint32 Reserved : 30; + + int Limit; // optional, Maximum number of entries to return. If not specified, or higher than what the device supports, the number of items shall be determined by the device + char StartReference[256]; // optional, Start returning entries from this start reference. If not specified, entries shall start from the beginning of the dataset +} tac_GetAreaInfoList_REQ; + +typedef struct +{ + char token[ACCESS_CTRL_MAX_LIMIT][ONVIF_TOKEN_LEN]; // Tokens of DoorInfo items to get +} tac_GetAreaInfo_REQ; + +typedef struct +{ + uint32 LimitFlag : 1; + uint32 StartReferenceFlag : 1; + uint32 Reserved : 30; + + int Limit; // optional, Maximum number of entries to return. If not specified, less than one or higher than what the device supports, the number of items is determined by the device + char StartReference[256]; // optional, Start returning entries from this start reference. If not specified, entries shall start from the beginning of the dataset +} tac_GetAreaList_REQ; + +typedef struct +{ + char token[ACCESS_CTRL_MAX_LIMIT][ONVIF_TOKEN_LEN]; // Tokens of Area items to get +} tac_GetAreas_REQ; + +typedef struct +{ + onvif_AreaInfo Area; // required +} tac_CreateArea_REQ; + +typedef struct +{ + onvif_AreaInfo Area; // required +} tac_SetArea_REQ; + +typedef struct +{ + onvif_AreaInfo Area; // required +} tac_ModifyArea_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, Token of Area item to delete +} tac_DeleteArea_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, Token of AccessPoint instance to get AccessPointState for +} tac_GetAccessPointState_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, Token of the AccessPoint instance to enable +} tac_EnableAccessPoint_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, Token of the AccessPoint instance to disable +} tac_DisableAccessPoint_REQ; + +typedef struct +{ + int dummy; +} tdc_GetServiceCapabilities_REQ; + +typedef struct +{ + uint32 LimitFlag : 1; + uint32 StartReferenceFlag : 1; + uint32 Reserved : 30; + + int Limit; // optional, Maximum number of entries to return. If not specified, + // or higher than what the device supports, + // the number of items shall be determined by the device + char StartReference[256]; // optional, Start returning entries from this start reference. If not specified, + // entries shall start from the beginning of the dataset +} tdc_GetDoorInfoList_REQ; + +typedef struct +{ + char token[DOOR_CTRL_MAX_LIMIT][ONVIF_TOKEN_LEN]; // Tokens of DoorInfo items to get +} tdc_GetDoorInfo_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, Token of the Door instance to get the state for +} tdc_GetDoorState_REQ; + +typedef struct +{ + uint32 UseExtendedTimeFlag : 1; + uint32 AccessTimeFlag : 1; + uint32 OpenTooLongTimeFlag : 1; + uint32 PreAlarmTimeFlag : 1; + uint32 Reserved : 28; + + char Token[ONVIF_TOKEN_LEN]; // required, Token of the Door instance to control + BOOL UseExtendedTime; // optional, Indicates that the configured extended time should be used + int AccessTime; // optional, overrides AccessTime if specified + int OpenTooLongTime; // optional, overrides OpenTooLongTime if specified (DOTL) + int PreAlarmTime; // optional, overrides PreAlarmTime if specified +} tdc_AccessDoor_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, Token of the Door instance to control +} tdc_LockDoor_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, Token of the Door instance to control +} tdc_UnlockDoor_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, Token of the Door instance to control +} tdc_DoubleLockDoor_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, Token of the Door instance to control +} tdc_BlockDoor_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, Token of the Door instance to control +} tdc_LockDownDoor_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, Token of the Door instance to control +} tdc_LockDownReleaseDoor_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, Token of the Door instance to control +} tdc_LockOpenDoor_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, Token of the Door instance to control +} tdc_LockOpenReleaseDoor_REQ; + +typedef struct +{ + char token[DOOR_CTRL_MAX_LIMIT][ONVIF_TOKEN_LEN]; // Tokens of Door items to get +} tdc_GetDoors_REQ; + +typedef struct +{ + uint32 LimitFlag : 1; + uint32 StartReferenceFlag : 1; + uint32 Reserved : 30; + + int Limit; // optional, aximum number of entries to return. If not specified, less than one + // or higher than what the device supports, + // the number of items is determined by the device + char StartReference[256]; // optional, Start returning entries from this start reference. If not specified, + // entries shall start from the beginning of the dataset +} tdc_GetDoorList_REQ; + +typedef struct +{ + onvif_Door Door; // required, Door item to create +} tdc_CreateDoor_REQ; + +typedef struct +{ + onvif_Door Door; // required, The Door item to create or modify +} tdc_SetDoor_REQ; + +typedef struct +{ + onvif_Door Door; // required, The details of the door +} tdc_ModifyDoor_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, The Token of the door to delete +} tdc_DeleteDoor_REQ; + +typedef struct +{ + int dummy; +} tth_GetServiceCapabilities_REQ; + +typedef struct +{ + int dummy; +} tth_GetConfigurations_REQ; + +typedef struct +{ + char VideoSourceToken[ONVIF_TOKEN_LEN]; // requied, Reference token to the VideoSource for which the Thermal Settings are requested +} tth_GetConfiguration_REQ; + +typedef struct +{ + char VideoSourceToken[ONVIF_TOKEN_LEN]; // requied, Reference token to the VideoSource for which the Thermal Settings are configured + + onvif_ThermalConfiguration Configuration; // requied, Thermal Settings to be configured +} tth_SetConfiguration_REQ; + +typedef struct +{ + char VideoSourceToken[ONVIF_TOKEN_LEN]; // requied, Reference token to the VideoSource for which the Thermal Configuration Options are requested +} tth_GetConfigurationOptions_REQ; + +typedef struct +{ + char VideoSourceToken[ONVIF_TOKEN_LEN]; // required, Reference token to the VideoSource for which the Radiometry Configuration is requested +} tth_GetRadiometryConfiguration_REQ; + +typedef struct +{ + char VideoSourceToken[ONVIF_TOKEN_LEN]; // required, Reference token to the VideoSource for which the Radiometry settings are configured + + onvif_RadiometryConfiguration Configuration; // required, Radiometry settings to be configured +} tth_SetRadiometryConfiguration_REQ; + +typedef struct +{ + char VideoSourceToken[ONVIF_TOKEN_LEN]; // required, Reference token to the VideoSource for which the Thermal Radiometry Options are requested +} tth_GetRadiometryConfigurationOptions_REQ; + +typedef struct +{ + int dummy; +} tcr_GetServiceCapabilities_REQ; + +typedef struct +{ + int sizeToken; // sequence of elements + char Token[CREDENTIAL_MAX_LIMIT][ONVIF_TOKEN_LEN]; // required, Tokens of CredentialInfo items to get +} tcr_GetCredentialInfo_REQ; + +typedef struct +{ + uint32 LimitFlag : 1; // Indicates whether the field Limit is valid + uint32 StartReferenceFlag : 1; // Indicates whether the field StartReference is valid + uint32 Reserved : 30; + + int Limit; // optional, Maximum number of entries to return. If not specified, less than one or higher + // than what the device supports, the number of items is determined by the device + char StartReference[ONVIF_TOKEN_LEN]; // optional, Start returning entries from this start reference. If not specified, + // entries shall start from the beginning of the dataset +} tcr_GetCredentialInfoList_REQ; + +typedef struct +{ + int sizeToken; // sequence of elements + char Token[CREDENTIAL_MAX_LIMIT][ONVIF_TOKEN_LEN]; // required, Token of Credentials to get +} tcr_GetCredentials_REQ; + +typedef struct +{ + uint32 LimitFlag : 1; // Indicates whether the field Limit is valid + uint32 StartReferenceFlag : 1; // Indicates whether the field StartReference is valid + uint32 Reserved : 30; + + int Limit; // optional, Maximum number of entries to return. If not specified, less than one or higher + // than what the device supports, the number of items is determined by the device + char StartReference[ONVIF_TOKEN_LEN]; // optional, Start returning entries from this start reference. If not specified, + // entries shall start from the beginning of the dataset +} tcr_GetCredentialList_REQ; + +typedef struct +{ + onvif_Credential Credential; // required, The credential to create + onvif_CredentialState State; // required, The state of the credential +} tcr_CreateCredential_REQ; + +typedef struct +{ + onvif_Credential Credential; // required, Details of the credential +} tcr_ModifyCredential_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, The token of the credential to delete +} tcr_DeleteCredential_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, Token of Credential +} tcr_GetCredentialState_REQ; + +typedef struct +{ + uint32 ReasonFlag : 1; // Indicates whether the field ReasonFlag is valid + uint32 Reserved : 31; + + char Token[ONVIF_TOKEN_LEN]; // required, The token of the credential + char Reason[200]; // optional, Reason for enabling the credential +} tcr_EnableCredential_REQ; + +typedef struct +{ + uint32 ReasonFlag : 1; // Indicates whether the field ReasonFlag is valid + uint32 Reserved : 31; + + char Token[ONVIF_TOKEN_LEN]; // required, The token of the credential + char Reason[200]; // optional, Reason for disabling the credential +} tcr_DisableCredential_REQ; + +typedef struct +{ + char CredentialToken[ONVIF_TOKEN_LEN]; // required, Token of the Credential +} tcr_ResetAntipassbackViolation_REQ; + +typedef struct +{ + char CredentialIdentifierTypeName[100]; // required, Name of the credential identifier type +} tcr_GetSupportedFormatTypes_REQ; + +typedef struct +{ + char CredentialToken[ONVIF_TOKEN_LEN]; // required, Token of the Credential +} tcr_GetCredentialIdentifiers_REQ; + +typedef struct +{ + char CredentialToken[ONVIF_TOKEN_LEN]; // required, Token of the Credential + + onvif_CredentialIdentifier CredentialIdentifier; // required, Identifier of the credential +} tcr_SetCredentialIdentifier_REQ; + +typedef struct +{ + char CredentialToken[ONVIF_TOKEN_LEN]; // required, Token of the Credential + char CredentialIdentifierTypeName[100]; // required, Identifier type name of a credential +} tcr_DeleteCredentialIdentifier_REQ; + +typedef struct +{ + char CredentialToken[ONVIF_TOKEN_LEN]; // required, Token of the Credential +} tcr_GetCredentialAccessProfiles_REQ; + +typedef struct +{ + char CredentialToken[ONVIF_TOKEN_LEN]; // required, Token of the Credential + int sizeCredentialAccessProfile; // sequence of elements + + onvif_CredentialAccessProfile CredentialAccessProfile[CREDENTIAL_MAX_LIMIT]; // required, Access Profiles of the credential +} tcr_SetCredentialAccessProfiles_REQ; + +typedef struct +{ + char CredentialToken[ONVIF_TOKEN_LEN]; // required, Token of the Credential + int sizeAccessProfileToken; // sequence of elements + + char AccessProfileToken[CREDENTIAL_MAX_LIMIT][ONVIF_TOKEN_LEN]; // required, Tokens of Access Profiles +} tcr_DeleteCredentialAccessProfiles_REQ; + +typedef struct +{ + int dummy; +} tar_GetServiceCapabilities_REQ; + +typedef struct +{ + int sizeToken; // sequence of elements + char Token[ACCESSRULES_MAX_LIMIT][ONVIF_TOKEN_LEN]; // required, Tokens of CredentialInfo items to get +} tar_GetAccessProfileInfo_REQ; + +typedef struct +{ + uint32 LimitFlag : 1; // Indicates whether the field Limit is valid + uint32 StartReferenceFlag : 1; // Indicates whether the field StartReference is valid + uint32 Reserved : 30; + + int Limit; // optional, Maximum number of entries to return. If not specified, less than one or higher + // than what the device supports, the number of items is determined by the device + char StartReference[ONVIF_TOKEN_LEN]; // optional, Start returning entries from this start reference. If not specified, + // entries shall start from the beginning of the dataset +} tar_GetAccessProfileInfoList_REQ; + +typedef struct +{ + int sizeToken; // sequence of elements + char Token[ACCESSRULES_MAX_LIMIT][ONVIF_TOKEN_LEN]; // required, Tokens of CredentialInfo items to get +} tar_GetAccessProfiles_REQ; + +typedef struct +{ + uint32 LimitFlag : 1; // Indicates whether the field Limit is valid + uint32 StartReferenceFlag : 1; // Indicates whether the field StartReference is valid + uint32 Reserved : 30; + + int Limit; // optional, Maximum number of entries to return. If not specified, less than one or higher + // than what the device supports, the number of items is determined by the device + char StartReference[ONVIF_TOKEN_LEN]; // optional, Start returning entries from this start reference. If not specified, + // entries shall start from the beginning of the dataset +} tar_GetAccessProfileList_REQ; + +typedef struct +{ + onvif_AccessProfile AccessProfile; // required, The AccessProfile to create +} tar_CreateAccessProfile_REQ; + +typedef struct +{ + onvif_AccessProfile AccessProfile; // required, The details of Access Profile +} tar_ModifyAccessProfile_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, The token of the access profile to delete +} tar_DeleteAccessProfile_REQ; + +typedef struct +{ + int dummy; +} tsc_GetServiceCapabilities_REQ; + +typedef struct +{ + int sizeToken; // sequence of elements + char Token[SCHEDULE_MAX_LIMIT][ONVIF_TOKEN_LEN]; // required, Tokens of ScheduleInfo items to get +} tsc_GetScheduleInfo_REQ; + +typedef struct +{ + uint32 LimitFlag : 1; // Indicates whether the field Limit is valid + uint32 StartReferenceFlag : 1; // Indicates whether the field StartReference is valid + uint32 Reserved : 30; + + int Limit; // optional, Maximum number of entries to return. If not specified, less than one + // or higher than what the device supports, the number of items is + // determined by the device + char StartReference[ONVIF_TOKEN_LEN]; // optional, Start returning entries from this start reference. + // If not specified, entries shall start from the beginning of the dataset +} tsc_GetScheduleInfoList_REQ; + +typedef struct +{ + int sizeToken; // sequence of elements + char Token[SCHEDULE_MAX_LIMIT][ONVIF_TOKEN_LEN]; // required, Tokens of Schedule items to get +} tsc_GetSchedules_REQ; + +typedef struct +{ + uint32 LimitFlag : 1; // Indicates whether the field Limit is valid + uint32 StartReferenceFlag : 1; // Indicates whether the field StartReference is valid + uint32 Reserved : 30; + + int Limit; // optional, Maximum number of entries to return. If not specified, less than one + // or higher than what the device supports, the number of items is + // determined by the device + char StartReference[ONVIF_TOKEN_LEN]; // optional, Start returning entries from this start reference. + // If not specified, entries shall start from the beginning of the dataset +} tsc_GetScheduleList_REQ; + +typedef struct +{ + onvif_Schedule Schedule; // required, The Schedule to create +} tsc_CreateSchedule_REQ; + +typedef struct +{ + onvif_Schedule Schedule; // required, The Schedule to modify/update +} tsc_ModifySchedule_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, The token of the schedule to delete +} tsc_DeleteSchedule_REQ; + +typedef struct +{ + int sizeToken; // sequence of elements + char Token[SCHEDULE_MAX_LIMIT][ONVIF_TOKEN_LEN]; // required, Tokens of SpecialDayGroupInfo items to get +} tsc_GetSpecialDayGroupInfo_REQ; + +typedef struct +{ + uint32 LimitFlag : 1; // Indicates whether the field Limit is valid + uint32 StartReferenceFlag : 1; // Indicates whether the field StartReference is valid + uint32 Reserved : 30; + + int Limit; // optional, Maximum number of entries to return. If not specified, less than one + // or higher than what the device supports, the number of items is + // determined by the device + char StartReference[ONVIF_TOKEN_LEN]; // optional, Start returning entries from this start reference. + // If not specified, entries shall start from the beginning of the dataset +} tsc_GetSpecialDayGroupInfoList_REQ; + +typedef struct +{ + int sizeToken; // sequence of elements + char Token[SCHEDULE_MAX_LIMIT][ONVIF_TOKEN_LEN]; // required, Tokens of the SpecialDayGroup items to get +} tsc_GetSpecialDayGroups_REQ; + +typedef struct +{ + uint32 LimitFlag : 1; // Indicates whether the field Limit is valid + uint32 StartReferenceFlag : 1; // Indicates whether the field StartReference is valid + uint32 Reserved : 30; + + int Limit; // optional, Maximum number of entries to return. If not specified, less than one + // or higher than what the device supports, the number of items is + // determined by the device + char StartReference[ONVIF_TOKEN_LEN]; // optional, Start returning entries from this start reference. + // If not specified, entries shall start from the beginning of the dataset +} tsc_GetSpecialDayGroupList_REQ; + +typedef struct +{ + onvif_SpecialDayGroup SpecialDayGroup; // required, The special day group to create +} tsc_CreateSpecialDayGroup_REQ; + +typedef struct +{ + onvif_SpecialDayGroup SpecialDayGroup; // required, The special day group to modify/update +} tsc_ModifySpecialDayGroup_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, The token of the special day group item to delete +} tsc_DeleteSpecialDayGroup_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, Token of schedule instance to get ScheduleState +} tsc_GetScheduleState_REQ; + +typedef struct +{ + int dummy; +} trv_GetServiceCapabilities_REQ; + +typedef struct +{ + int dummy; +} trv_GetReceivers_REQ; + +typedef struct +{ + char ReceiverToken[ONVIF_TOKEN_LEN]; // required, The token of the receiver to be retrieved +} trv_GetReceiver_REQ; + +typedef struct +{ + onvif_ReceiverConfiguration Configuration; // required, The initial configuration for the new receiver +} trv_CreateReceiver_REQ; + +typedef struct +{ + char ReceiverToken[ONVIF_TOKEN_LEN]; // required, The token of the receiver to be deleted +} trv_DeleteReceiver_REQ; + +typedef struct +{ + char ReceiverToken[ONVIF_TOKEN_LEN]; // required, The token of the receiver to be configured + + onvif_ReceiverConfiguration Configuration; // required, The new configuration for the receiver +} trv_ConfigureReceiver_REQ; + +typedef struct +{ + char ReceiverToken[ONVIF_TOKEN_LEN]; // required, The token of the receiver to be changed + + onvif_ReceiverMode Mode; // required, The new receiver mode +} trv_SetReceiverMode_REQ; + +typedef struct +{ + char ReceiverToken[ONVIF_TOKEN_LEN]; // required, The token of the receiver to be queried +} trv_GetReceiverState_REQ; + +typedef struct +{ + int dummy; +} tpv_GetServiceCapabilities_REQ; + +typedef struct +{ + uint32 TimeoutFlag : 1; // Indicates whether the field Timeout is valid + uint32 Reserved : 31; + + char VideoSource[100]; // required, The video source associated with the provisioning. + + onvif_PanDirection Direction; // required, The direction for PanMove to move the device, "left" or "right" + + int Timeout; // optional, Operation timeout, if less than default timeout, unit is second +} tpv_PanMove_REQ; + +typedef struct +{ + uint32 TimeoutFlag : 1; // Indicates whether the field Timeout is valid + uint32 Reserved : 31; + + char VideoSource[100]; // required, The video source associated with the provisioning + + onvif_TiltDirection Direction; // required, "up" or "down" + + int Timeout; // optional, Operation timeout, if less than default timeout, unit is second +} tpv_TiltMove_REQ; + +typedef struct +{ + uint32 TimeoutFlag : 1; // Indicates whether the field Timeout is valid + uint32 Reserved : 31; + + char VideoSource[100]; // required, The video source associated with the provisioning + + onvif_ZoomDirection Direction; // required, "wide" or "telephoto" + + int Timeout; // optional, Operation timeout, if less than default timeout, unit is second +} tpv_ZoomMove_REQ; + +typedef struct +{ + uint32 TimeoutFlag : 1; // Indicates whether the field Timeout is valid + uint32 Reserved : 31; + + char VideoSource[100]; // required, The video source associated with the provisioning + + onvif_RollDirection Direction; // required, "clockwise", "counterclockwise", or "auto" + + int Timeout; // optional, Operation timeout, if less than default timeout, unit is second +} tpv_RollMove_REQ; + +typedef struct +{ + uint32 TimeoutFlag : 1; // Indicates whether the field Timeout is valid + uint32 Reserved : 31; + + char VideoSource[100]; // required, The video source associated with the provisioning + + onvif_FocusDirection Direction; // required, "near", "far", or "auto" + + int Timeout; // optional, Operation timeout, if less than default timeout, unit is second +} tpv_FocusMove_REQ; + +typedef struct +{ + char VideoSource[100]; // required, The video source associated with the provisioning +} tpv_Stop_REQ; + +typedef struct +{ + char VideoSource[100]; // required, The video source associated with the provisioning +} tpv_GetUsage_REQ; + + +#endif // end of ONVIF_REQ_H + + + diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/onvif/onvif_res.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/onvif/onvif_res.h new file mode 100644 index 0000000..ea49365 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/onvif/onvif_res.h @@ -0,0 +1,2263 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef ONVIF_RES_H +#define ONVIF_RES_H + + + +/************************************************************************* + * + * onvif response structure + * +**************************************************************************/ +typedef struct +{ + onvif_Capabilities Capabilities; // required, Capability information +} tds_GetCapabilities_RES; + +typedef struct +{ + onvif_Capabilities Capabilities; // required, Capability information +} tds_GetServices_RES; + +typedef struct +{ + onvif_DevicesCapabilities Capabilities; // required, he capabilities for the device service is returned in the Capabilities element +} tds_GetServiceCapabilities_RES; + +typedef struct +{ + onvif_DeviceInformation DeviceInformation; // required, Device information +} tds_GetDeviceInformation_RES; + +typedef struct +{ + UserList * User; +} tds_GetUsers_RES; + +typedef struct +{ + int dummy; +} tds_CreateUsers_RES; + +typedef struct +{ + int dummy; +} tds_DeleteUsers_RES; + +typedef struct +{ + int dummy; +} tds_SetUser_RES; + +typedef struct +{ + uint32 RemoteUserFlag : 1; // Indicates whether the field RemoteUser is valid + uint32 Reserved : 31; + + onvif_RemoteUser RemoteUser; // optional +} tds_GetRemoteUser_RES; + +typedef struct +{ + int dummy; +} tds_SetRemoteUser_RES; + +typedef struct +{ + NetworkInterfaceList * NetworkInterfaces; // required, List of network interfaces +} tds_GetNetworkInterfaces_RES; + +typedef struct +{ + BOOL RebootNeeded; // required, Indicates whether or not a reboot is required after configuration updates, +} tds_SetNetworkInterfaces_RES; + +typedef struct +{ + onvif_NTPInformation NTPInformation; // required, NTP information +} tds_GetNTP_RES; + +typedef struct +{ + int dummy; +} tds_SetNTP_RES; + +typedef struct +{ + onvif_HostnameInformation HostnameInformation; // required, Host name information +} tds_GetHostname_RES; + +typedef struct +{ + int dummy; +} tds_SetHostname_RES; + +typedef struct +{ + BOOL RebootNeeded; // required, Indicates whether or not a reboot is required after configuration updates +} tds_SetHostnameFromDHCP_RES; + +typedef struct +{ + onvif_DNSInformation DNSInformation; // required, DNS information +} tds_GetDNS_RES; + +typedef struct +{ + int dummy; +} tds_SetDNS_RES; + +typedef struct +{ + onvif_DynamicDNSInformation DynamicDNSInformation; // Dynamic DNS information +} tds_GetDynamicDNS_RES; + +typedef struct +{ + int dummy; +} tds_SetDynamicDNS_RES; + +typedef struct +{ + onvif_NetworkProtocol NetworkProtocols; // Contains defined protocols supported by the device +} tds_GetNetworkProtocols_RES; + +typedef struct +{ + int dummy; +} tds_SetNetworkProtocols_RES; + +typedef struct +{ + onvif_DiscoveryMode DiscoveryMode; // required, Indicator of discovery mode: Discoverable, NonDiscoverable +} tds_GetDiscoveryMode_RES; + +typedef struct +{ + int dummy; +} tds_SetDiscoveryMode_RES; + +typedef struct +{ + char IPv4Address[MAX_GATEWAY][32]; // required, Gets the default IPv4 and IPv6 gateway settings from the device +} tds_GetNetworkDefaultGateway_RES; + +typedef struct +{ + int dummy; +} tds_SetNetworkDefaultGateway_RES; + +typedef struct +{ + onvif_NetworkZeroConfiguration ZeroConfiguration; // Contains the zero-configuration +} tds_GetZeroConfiguration_RES; + +typedef struct +{ + int dummy; +} tds_SetZeroConfiguration_RES; + +typedef struct +{ + char GUID[128]; +} tds_GetEndpointReference_RES; + +typedef struct +{ + uint32 AuxiliaryCommandResponseFlag : 1; // Indicates whether the field AuxiliaryCommandResponse is valid + uint32 Reserved : 31; + + char AuxiliaryCommandResponse[1024]; // optional +} tds_SendAuxiliaryCommand_RES; + +typedef struct +{ + RelayOutputList * RelayOutputs; +} tds_GetRelayOutputs_RES; + +typedef struct +{ + int dummy; +} tds_SetRelayOutputSettings_RES; + +typedef struct +{ + int dummy; +} tds_SetRelayOutputState_RES; + +typedef struct +{ + uint32 UTCDateTimeFlag : 1; // Indicates whether the field UTCDateTime is valid + uint32 LocalDateTimeFlag : 1; // Indicates whether the field LocalDateTime is valid + uint32 Reserved : 30; + + onvif_SystemDateTime SystemDateTime; // required, + onvif_DateTime UTCDateTime; // optional, Date and time in UTC. If time is obtained via NTP, UTCDateTime has no meaning + onvif_DateTime LocalDateTime; // optional, +} tds_GetSystemDateAndTime_RES; + +typedef struct +{ + int dummy; +} tds_SetSystemDateAndTime_RES; + +typedef struct +{ + int dummy; +} tds_SystemReboot_RES; + +typedef struct +{ + int dummy; +} tds_SetSystemFactoryDefault_RES; + +typedef struct +{ + char * String; // optional, Contains the system log information + // The caller should call FreeBuff to free the memory +} tds_GetSystemLog_RES; + +typedef struct +{ + uint32 sizeScopes; + + onvif_Scope Scopes[MAX_SCOPE_NUMS]; +} tds_GetScopes_RES; + +typedef struct +{ + int dummy; +} tds_SetScopes_RES; + +typedef struct +{ + int dummy; +} tds_AddScopes_RES; + +typedef struct +{ + int dummy; +} tds_RemoveScopes_RES; + +typedef struct +{ + char UploadUri[256]; // required + int UploadDelay; // required + int ExpectedDownTime; // required +} tds_StartFirmwareUpgrade_RES; + +typedef struct +{ + uint32 SystemLogUriFlag : 1; // Indicates whether the field SystemLogUri is valid + uint32 AccessLogUriFlag : 1; // Indicates whether the field AccessLogUri is valid + uint32 SupportInfoUriFlag : 1; // Indicates whether the field SupportInfoUri is valid + uint32 SystemBackupUriFlag : 1; // Indicates whether the field SystemBackupUri is valid + uint32 Reserved : 28; + + char SystemLogUri[256]; // optional + char AccessLogUri[256]; // optional + char SupportInfoUri[256]; // optional + char SystemBackupUri[256]; // optional +} tds_GetSystemUris_RES; + +typedef struct +{ + char UploadUri[256]; // required + int ExpectedDownTime; // required +} tds_StartSystemRestore_RES; + +typedef struct +{ + char WsdlUrl[256]; // required +} tds_GetWsdlUrl_RES; + +typedef struct +{ + onvif_Dot11Capabilities Capabilities; // required +} tds_GetDot11Capabilities_RES; + +typedef struct +{ + onvif_Dot11Status Status; // required +} tds_GetDot11Status_RES; + +typedef struct +{ + Dot11AvailableNetworksList * Networks; // optional +} tds_ScanAvailableDot11Networks_RES; + +typedef struct +{ + LocationEntityList * Location; // optional +} tds_GetGeoLocation_RES; + +typedef struct +{ + int dummy; +} tds_SetGeoLocation_RES; + +typedef struct +{ + int dummy; +} tds_DeleteGeoLocation_RES; + +typedef struct +{ + int dummy; +} tds_SetHashingAlgorithm_RES; + +typedef struct +{ + onvif_IPAddressFilter IPAddressFilter; // required +} tds_GetIPAddressFilter_RES; + +typedef struct +{ + int dummy; +} tds_SetIPAddressFilter_RES; + +typedef struct +{ + int dummy; +} tds_AddIPAddressFilter_RES; + +typedef struct +{ + int dummy; +} tds_RemoveIPAddressFilter_RES; + +typedef struct +{ + onvif_BinaryData PolicyFile; // required, need call free function to free PolicyFile.Data.ptr buffer +} tds_GetAccessPolicy_RES; + +typedef struct +{ + int dummy; +} tds_SetAccessPolicy_RES; + +typedef struct +{ + StorageConfigurationList * StorageConfigurations; // optional +} tds_GetStorageConfigurations_RES; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required +} tds_CreateStorageConfiguration_RES; + +typedef struct +{ + onvif_StorageConfiguration StorageConfiguration; // required +} tds_GetStorageConfiguration_RES; + +typedef struct +{ + int dummy; +} tds_SetStorageConfiguration_RES; + +typedef struct +{ + int dummy; +} tds_DeleteStorageConfiguration_RES; + +typedef struct +{ + onvif_MediaCapabilities Capabilities; // required, the capabilities for the media service is returned +} trt_GetServiceCapabilities_RES; + +typedef struct +{ + VideoSourceList * VideoSources; // List of existing Video Sources +} trt_GetVideoSources_RES; + +typedef struct +{ + AudioSourceList * AudioSources; // List of existing Audio Sources +} trt_GetAudioSources_RES; + +typedef struct +{ + ONVIF_PROFILE Profile; // required, returns the new created profile +} trt_CreateProfile_RES; + +typedef struct +{ + ONVIF_PROFILE Profile; // required, returns the requested media profile +} trt_GetProfile_RES; + +typedef struct +{ + ONVIF_PROFILE * Profiles; // lists all profiles that exist in the media service +} trt_GetProfiles_RES; + +typedef struct +{ + int dummy; +} trt_AddVideoEncoderConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_AddVideoSourceConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_AddAudioEncoderConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_AddAudioSourceConfiguration_RES; + +typedef struct +{ + VideoSourceModeList * VideoSourceModes; // Return the information for specified video source mode +} trt_GetVideoSourceModes_RES; + +typedef struct +{ + BOOL Reboot; // The response contains information about rebooting after returning response. When Reboot is set true, a device will reboot automatically after setting mode +} trt_SetVideoSourceMode_RES; + +typedef struct +{ + int dummy; +} trt_AddPTZConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_RemoveVideoEncoderConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_RemoveVideoSourceConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_RemoveAudioEncoderConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_RemoveAudioSourceConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_RemovePTZConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_DeleteProfile_RES; + +typedef struct +{ + VideoSourceConfigurationList * Configurations; // This element contains a list of video source configurations +} trt_GetVideoSourceConfigurations_RES; + +typedef struct +{ + VideoEncoderConfigurationList * Configurations; // This element contains a list of video encoder configurations +} trt_GetVideoEncoderConfigurations_RES; + +typedef struct +{ + AudioSourceConfigurationList * Configurations; // This element contains a list of audio source configurations +} trt_GetAudioSourceConfigurations_RES; + +typedef struct +{ + AudioEncoderConfigurationList * Configurations; // This element contains a list of audio encoder configurations +} trt_GetAudioEncoderConfigurations_RES; + +typedef struct +{ + onvif_VideoSourceConfiguration Configuration; // required, The requested video source configuration +} trt_GetVideoSourceConfiguration_RES; + +typedef struct +{ + onvif_VideoEncoderConfiguration Configuration; // required, The requested video encoder configuration +} trt_GetVideoEncoderConfiguration_RES; + +typedef struct +{ + onvif_AudioSourceConfiguration Configuration; // required, The requested audio source configuration +} trt_GetAudioSourceConfiguration_RES; + +typedef struct +{ + onvif_AudioEncoderConfiguration Configuration; // required, The requested audio encorder configuration +} trt_GetAudioEncoderConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_SetVideoSourceConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_SetVideoEncoderConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_SetAudioSourceConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_SetAudioEncoderConfiguration_RES; + +typedef struct +{ + onvif_VideoSourceConfigurationOptions Options; +} trt_GetVideoSourceConfigurationOptions_RES; + +typedef struct +{ + onvif_VideoEncoderConfigurationOptions Options; // required +} trt_GetVideoEncoderConfigurationOptions_RES; + +typedef struct +{ + int dummy; +} trt_GetAudioSourceConfigurationOptions_RES; + + +typedef struct +{ + onvif_AudioEncoderConfigurationOptions Options; // required +} trt_GetAudioEncoderConfigurationOptions_RES; + +typedef struct +{ + char Uri[ONVIF_URI_LEN]; // required, Stable Uri to be used for requesting the media stream + + int Timeout; // required, Duration how long the Uri is valid. This parameter shall be set to PT0S to indicate that this stream URI is indefinitely valid even if the profile changes + + BOOL InvalidAfterConnect; // required, Indicates if the Uri is only valid until the connection is established. The value shall be set to "false" + BOOL InvalidAfterReboot; // required, Indicates if the Uri is invalid after a reboot of the device. The value shall be set to "false" +} trt_GetStreamUri_RES; + +typedef struct +{ + int dummy; +} trt_SetSynchronizationPoint_RES; + +typedef struct +{ + char Uri[ONVIF_URI_LEN]; // required, Stable Uri to be used for requesting the media stream + + int Timeout; // required, Duration how long the Uri is valid. This parameter shall be set to PT0S to indicate that this stream URI is indefinitely valid even if the profile changes + + BOOL InvalidAfterConnect; // required, Indicates if the Uri is only valid until the connection is established. The value shall be set to "false" + BOOL InvalidAfterReboot; // required, Indicates if the Uri is invalid after a reboot of the device. The value shall be set to "false" +} trt_GetSnapshotUri_RES; + +typedef struct +{ + uint32 JPEGFlag : 1; // Indicates whether the field JPEG is valid + uint32 H264Flag : 1; // Indicates whether the field H264 is valid + uint32 MPEG4Flag : 1; // Indicates whether the field SupportInfoUri is valid + uint32 Reserved : 29; + + int TotalNumber; // required, The minimum guaranteed total number of encoder instances (applications) per VideoSourceConfiguration. The device is able to deliver the TotalNumber of streams + int JPEG; // optional, If a device limits the number of instances for respective Video Codecs the response contains the information how many Jpeg streams can be set up at the same time per VideoSource + int H264; // optional, If a device limits the number of instances for respective Video Codecs the response contains the information how many H264 streams can be set up at the same time per VideoSource + int MPEG4; // optional, If a device limits the number of instances for respective Video Codecs the response contains the information how many Mpeg4 streams can be set up at the same time per VideoSource +} trt_GetGuaranteedNumberOfVideoEncoderInstances_RES; + +typedef struct +{ + AudioOutputList * AudioOutputs; // optional, List of existing Audio Outputs +} trt_GetAudioOutputs_RES; + +typedef struct +{ + AudioOutputConfigurationList * Configurations; // optional, This element contains a list of audio output configurations +} trt_GetAudioOutputConfigurations_RES; + +typedef struct +{ + onvif_AudioOutputConfiguration Configuration; // The requested audio output configuration +} trt_GetAudioOutputConfiguration_RES; + +typedef struct +{ + onvif_AudioOutputConfigurationOptions Options; // required, This message contains the audio output configuration options. + // If a audio output configuration is specified, the options shall concern that particular configuration. + // If a media profile is specified, the options shall be compatible with that media profile. + // If no tokens are specified, the options shall be considered generic for the device +} trt_GetAudioOutputConfigurationOptions_RES; + +typedef struct +{ + int dummy; +} trt_SetAudioOutputConfiguration_RES; + +typedef struct +{ + AudioDecoderConfigurationList * Configurations; // optional, This element contains a list of audio decoder configurations +} trt_GetAudioDecoderConfigurations_RES; + +typedef struct +{ + onvif_AudioDecoderConfiguration Configuration; // The requested audio decoder configuration +} trt_GetAudioDecoderConfiguration_RES; + +typedef struct +{ + onvif_AudioDecoderConfigurationOptions Options; // required, This message contains the audio decoder configuration options. + // If a audio decoder configuration is specified, the options shall concern that particular configuration. + // If a media profile is specified, the options shall be compatible with that media profile. + // If no tokens are specified, the options shall be considered generic for the device +} trt_GetAudioDecoderConfigurationOptions_RES; + +typedef struct +{ + int dummy; +} trt_SetAudioDecoderConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_AddAudioOutputConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_AddAudioDecoderConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_RemoveAudioOutputConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_RemoveAudioDecoderConfiguration_RES; + +typedef struct +{ + OSDConfigurationList * OSDs; // This element contains a list of requested OSDs +} trt_GetOSDs_RES; + +typedef struct +{ + onvif_OSDConfiguration OSD; // required, The requested OSD configuration +} trt_GetOSD_RES; + +typedef struct +{ + int dummy; +} trt_SetOSD_RES; + +typedef struct +{ + onvif_OSDConfigurationOptions OSDOptions; // required, +} trt_GetOSDOptions_RES; + +typedef struct +{ + char OSDToken[ONVIF_TOKEN_LEN]; // required, Returns Token of the newly created OSD +} trt_CreateOSD_RES; + +typedef struct +{ + int dummy; +} trt_DeleteOSD_RES; + +typedef struct +{ + VideoAnalyticsConfigurationList * Configurations; // list of video analytics configurations +} trt_GetVideoAnalyticsConfigurations_RES; + +typedef struct +{ + int dummy; +} trt_AddVideoAnalyticsConfiguration_RES; + +typedef struct +{ + onvif_VideoAnalyticsConfiguration Configuration; // The requested video analytics configuration +} trt_GetVideoAnalyticsConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_RemoveVideoAnalyticsConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_SetVideoAnalyticsConfiguration_RES; + +typedef struct +{ + MetadataConfigurationList * Configurations; // list of metadata configurations +} trt_GetMetadataConfigurations_RES; + +typedef struct +{ + int dummy; +} trt_AddMetadataConfiguration_RES; + +typedef struct +{ + onvif_MetadataConfiguration Configuration; // The requested metadata configuration +} trt_GetMetadataConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_RemoveMetadataConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_SetMetadataConfiguration_RES; + +typedef struct +{ + onvif_MetadataConfigurationOptions Options; // If a metadata configuration is specified, the options shall concern that particular configuration. + // If a media profile is specified, the options shall be compatible with that media profile. + // If no tokens are specified, the options shall be considered generic for the device +} trt_GetMetadataConfigurationOptions_RES; + +typedef struct +{ + VideoEncoderConfigurationList * Configurations; // list of video encoder configurations +} trt_GetCompatibleVideoEncoderConfigurations_RES; + +typedef struct +{ + AudioEncoderConfigurationList * Configurations; // list of audio encoder configurations +} trt_GetCompatibleAudioEncoderConfigurations_RES; + +typedef struct +{ + VideoAnalyticsConfigurationList * Configurations; // list of video analytics configurations +} trt_GetCompatibleVideoAnalyticsConfigurations_RES; + +typedef struct +{ + MetadataConfigurationList * Configurations; // list of metadata configurations +} trt_GetCompatibleMetadataConfigurations_RES; + +typedef struct +{ + onvif_PTZCapabilities Capabilities; // required, the capabilities for the PTZ service is returned +} ptz_GetServiceCapabilities_RES; + +typedef struct +{ + PTZNodeList * PTZNode; // A list of the existing PTZ Nodes on the device +} ptz_GetNodes_RES; + +typedef struct +{ + onvif_PTZNode PTZNode; // required, A requested PTZNode +} ptz_GetNode_RES; + +typedef struct +{ + PTZPresetList * PTZPresets; // A list of presets which are available for the requested MediaProfile +} ptz_GetPresets_RES; + +typedef struct +{ + char PresetToken[ONVIF_TOKEN_LEN]; // required, A token to the Preset which has been set +} ptz_SetPreset_RES; + +typedef struct +{ + int dummy; +} ptz_RemovePreset_RES; + +typedef struct +{ + int dummy; +} ptz_GotoPreset_RES; + +typedef struct +{ + int dummy; +} ptz_GotoHomePosition_RES; + +typedef struct +{ + int dummy; +} ptz_SetHomePosition_RES; + +typedef struct +{ + onvif_PTZStatus PTZStatus; // required, The PTZStatus for the requested MediaProfile +} ptz_GetStatus_RES; + +typedef struct +{ + int dummy; +} ptz_ContinuousMove_RES; + +typedef struct +{ + int dummy; +} ptz_RelativeMove_RES; + +typedef struct +{ + int dummy; +} ptz_AbsoluteMove_RES; + +typedef struct +{ + int dummy; +} ptz_Stop_RES; + +typedef struct +{ + PTZConfigurationList * PTZConfiguration; // A list of all existing PTZConfigurations on the device +} ptz_GetConfigurations_RES; + +typedef struct +{ + onvif_PTZConfiguration PTZConfiguration; // required, A requested PTZConfiguration +} ptz_GetConfiguration_RES; + +typedef struct +{ + int dummy; +} ptz_SetConfiguration_RES; + +typedef struct +{ + onvif_PTZConfigurationOptions PTZConfigurationOptions; // required, The requested PTZ configuration options +} ptz_GetConfigurationOptions_RES; + +typedef struct +{ + PresetTourList * PresetTour; +} ptz_GetPresetTours_RES; + +typedef struct +{ + onvif_PresetTour PresetTour; +} ptz_GetPresetTour_RES; + +typedef struct +{ + onvif_PTZPresetTourOptions Options; +} ptz_GetPresetTourOptions_RES; + +typedef struct +{ + char PresetTourToken[ONVIF_TOKEN_LEN]; // required, +} ptz_CreatePresetTour_RES; + +typedef struct +{ + int dummy; +} ptz_ModifyPresetTour_RES; + +typedef struct +{ + int dummy; +} ptz_OperatePresetTour_RES; + +typedef struct +{ + int dummy; +} ptz_RemovePresetTour_RES; + +typedef struct +{ + char AuxiliaryResponse[1024]; // required, The response contains the auxiliary response +} ptz_SendAuxiliaryCommand_RES; + +typedef struct +{ + int dummy; +} ptz_GeoMove_RES; + +typedef struct +{ + onvif_EventCapabilities Capabilities; // required, The capabilities for the event service +} tev_GetServiceCapabilities_RES; + +typedef struct +{ + uint32 sizeTopicNamespaceLocation; + char TopicNamespaceLocation[10][256]; // required element of type xsd:anyURI + BOOL FixedTopicSet; // required element of type xsd:anyURI + + char * TopicSet; // required, the caller should free the memory + + uint32 sizeTopicExpressionDialect; + char TopicExpressionDialect[10][256]; // required element of type xsd:anyURI + uint32 sizeMessageContentFilterDialect; + char MessageContentFilterDialect[10][256]; // required element of type xsd:anyURI + uint32 sizeProducerPropertiesFilterDialect; + char ProducerPropertiesFilterDialect[10][256]; // optional element of type xsd:anyURI + uint32 sizeMessageContentSchemaLocation; + char MessageContentSchemaLocation[10][256]; // required element of type xsd:anyURI +} tev_GetEventProperties_RES; + +typedef struct +{ + int dummy; +} tev_Renew_RES; + +typedef struct +{ + int dummy; +} tev_Unsubscribe_RES; + +typedef struct +{ + char producter_addr[256]; // required + char ReferenceParameters[512]; // optional +} tev_Subscribe_RES; + +typedef struct +{ + int dummy; +} tev_PauseSubscription_RES; + +typedef struct +{ + int dummy; +} tev_ResumeSubscription_RES; + +typedef struct +{ + char producter_addr[256]; // required, Endpoint reference of the subscription to be used for pulling the messages + char ReferenceParameters[512]; // optional + + time_t CurrentTime; // required, Current time of the server for synchronization purposes + time_t TerminationTime; // required, Date time when the PullPoint will be shut down without further pull requests +} tev_CreatePullPointSubscription_RES; + +typedef struct +{ + int dummy; +} tev_DestroyPullPoint_RES; + +typedef struct +{ + time_t CurrentTime; // required, The date and time when the messages have been delivered by the web server to the client + time_t TerminationTime; // required, Date time when the PullPoint will be shut down without further pull requests + + NotificationMessageList * NotifyMessages; +} tev_PullMessages_RES; + +typedef struct +{ + NotificationMessageList * NotifyMessages; +} tev_GetMessages_RES; + +typedef struct +{ + int dummy; +} tev_Seek_RES; + +typedef struct +{ + int dummy; +} tev_SetSynchronizationPoint_RES; + +// imaging service + +typedef struct +{ + onvif_ImagingCapabilities Capabilities; // required, The capabilities for the imaging service is returned +} img_GetServiceCapabilities_RES; + +typedef struct +{ + onvif_ImagingSettings ImagingSettings; // required, ImagingSettings for the VideoSource that was requested +} img_GetImagingSettings_RES; + +typedef struct +{ + int dummy; +} img_SetImagingSettings_RES; + +typedef struct +{ + onvif_ImagingOptions ImagingOptions; // required, Valid ranges for the imaging parameters that are categorized as device specific +} img_GetOptions_RES; + +typedef struct +{ + int dummy; +} img_Move_RES; + +typedef struct +{ + int dummy; +} img_Stop_RES; + +typedef struct +{ + onvif_ImagingStatus Status; // required, Requested imaging status +} img_GetStatus_RES; + +typedef struct +{ + onvif_MoveOptions20 MoveOptions; // required, Valid ranges for the focus lens move options +} img_GetMoveOptions_RES; + +typedef struct +{ + ImagingPresetList * Preset; // required, List of Imaging Presets which are available for the requested VideoSource. +} img_GetPresets_RES; + +typedef struct +{ + uint32 PresetFlag : 1; // Indicates whether the field Preset is valid + uint32 Reserved : 31; + + onvif_ImagingPreset Preset; // optional, Current Imaging Preset in use for the specified Video Source +} img_GetCurrentPreset_RES; + +typedef struct +{ + int dummy; +} img_SetCurrentPreset_RES; + +// device IO + +typedef struct +{ + onvif_DeviceIOCapabilities Capabilities; // required, the capabilities for the deviceIO service is returned +} tmd_GetServiceCapabilities_RES; + +typedef struct +{ + RelayOutputList * RelayOutputs; +} tmd_GetRelayOutputs_RES; + +typedef struct +{ + RelayOutputOptionsList * RelayOutputOptions; +} tmd_GetRelayOutputOptions_RES; + +typedef struct +{ + int dummy; +} tmd_SetRelayOutputSettings_RES; + +typedef struct +{ + int dummy; +} tmd_SetRelayOutputState_RES; + +typedef struct +{ + DigitalInputList * DigitalInputs; +} tmd_GetDigitalInputs_RES; + +typedef struct +{ + onvif_DigitalInputConfigurationOptions DigitalInputOptions; +} tmd_GetDigitalInputConfigurationOptions_RES; + +typedef struct +{ + int dummy; +} tmd_SetDigitalInputConfigurations_RES; + + +// recording + +typedef struct +{ + onvif_RecordingCapabilities Capabilities; // required, The capabilities for the recording service +} trc_GetServiceCapabilities_RES; + +typedef struct +{ + char RecordingToken[ONVIF_TOKEN_LEN]; // required +} trc_CreateRecording_RES; + +typedef struct +{ + int dummy; +} trc_DeleteRecording_RES; + +typedef struct +{ + RecordingList * Recordings; +} trc_GetRecordings_RES; + +typedef struct +{ + int dummy; +} trc_SetRecordingConfiguration_RES; + +typedef struct +{ + onvif_RecordingConfiguration RecordingConfiguration; +} trc_GetRecordingConfiguration_RES; + +typedef struct +{ + onvif_RecordingOptions Options; +} trc_GetRecordingOptions_RES; + +typedef struct +{ + char TrackToken[ONVIF_TOKEN_LEN]; // required +} trc_CreateTrack_RES; + +typedef struct +{ + int dummy; +} trc_DeleteTrack_RES; + +typedef struct +{ + onvif_TrackConfiguration TrackConfiguration; // required +} trc_GetTrackConfiguration_RES; + +typedef struct +{ + int dummy; +} trc_SetTrackConfiguration_RES; + +typedef struct +{ + char JobToken[ONVIF_TOKEN_LEN]; // required + + onvif_RecordingJobConfiguration JobConfiguration; // required +} trc_CreateRecordingJob_RES; + +typedef struct +{ + int dummy; +} trc_DeleteRecordingJob_RES; + +typedef struct +{ + RecordingJobList * RecordingJobs; +} trc_GetRecordingJobs_RES; + +typedef struct +{ + onvif_RecordingJobConfiguration JobConfiguration; // required +} trc_SetRecordingJobConfiguration_RES; + +typedef struct +{ + onvif_RecordingJobConfiguration JobConfiguration; // required +} trc_GetRecordingJobConfiguration_RES; + +typedef struct +{ + int dummy; +} trc_SetRecordingJobMode_RES; + +typedef struct +{ + onvif_RecordingJobStateInformation State; // required +} trc_GetRecordingJobState_RES; + +typedef struct +{ + char OperationToken[ONVIF_TOKEN_LEN]; // required, Unique operation token for client to associate the relevant events + uint32 sizeFileNames; // sequence of elements + char FileNames[100][256]; // optional, List of exported file names. The device can also use AsyncronousOperationStatus event to publish this list +} trc_ExportRecordedData_RES; + +typedef struct +{ + float Progress; // required, Progress percentage of ExportRecordedData operation + onvif_ArrayOfFileProgress FileProgressStatus; // required, +} trc_StopExportRecordedData_RES; + +typedef struct +{ + float Progress; // required, Progress percentage of ExportRecordedData operation + onvif_ArrayOfFileProgress FileProgressStatus; // required, +} trc_GetExportRecordedDataState_RES; + +typedef struct +{ + onvif_ReplayCapabilities Capabilities; // required, The capabilities for the replay service +} trp_GetServiceCapabilities_RES; + +typedef struct +{ + char Uri[ONVIF_URI_LEN]; // required. The URI to which the client should connect in order to stream the recording +} trp_GetReplayUri_RES; + +typedef struct +{ + onvif_ReplayConfiguration Configuration; // required, The current replay configuration parameters +} trp_GetReplayConfiguration_RES; + +typedef struct +{ + int dummy; +} trp_SetReplayConfiguration_RES; + +typedef struct +{ + onvif_SearchCapabilities Capabilities; // required, The capabilities for the search service +} tse_GetServiceCapabilities_RES; + +typedef struct +{ + time_t DataFrom; // Required. The earliest point in time where there is recorded data on the device. + time_t DataUntil; // Required. The most recent point in time where there is recorded data on the device + int NumberRecordings; // Required. The device contains this many recordings +} tse_GetRecordingSummary_RES; + +typedef struct +{ + onvif_RecordingInformation RecordingInformation; // required +} tse_GetRecordingInformation_RES; + +typedef struct +{ + onvif_MediaAttributes MediaAttributes; +} tse_GetMediaAttributes_RES; + +typedef struct +{ + char SearchToken[ONVIF_TOKEN_LEN]; // Required, A unique reference to the search session created by this request +} tse_FindRecordings_RES; + +typedef struct +{ + onvif_FindRecordingResultList ResultList; +} tse_GetRecordingSearchResults_RES; + +typedef struct +{ + char SearchToken[ONVIF_TOKEN_LEN]; // Required, A unique reference to the search session created by this request +} tse_FindEvents_RES; + +typedef struct +{ + onvif_FindEventResultList ResultList; // Required, +} tse_GetEventSearchResults_RES; + +typedef struct +{ + char SearchToken[ONVIF_TOKEN_LEN]; // Required, A unique reference to the search session created by this request +} tse_FindMetadata_RES; + +typedef struct +{ + onvif_FindMetadataResultList ResultList; // Required, +} tse_GetMetadataSearchResults_RES; + +typedef struct +{ + char SearchToken[ONVIF_TOKEN_LEN]; // Required, A unique reference to the search session created by this request +} tse_FindPTZPosition_RES; + +typedef struct +{ + onvif_FindPTZPositionResultList ResultList; // Required, +} tse_GetPTZPositionSearchResults_RES; + +typedef struct +{ + onvif_SearchState State; +} tse_GetSearchState_RES; + +typedef struct +{ + time_t Endpoint; // Required, The point of time the search had reached when it was ended. It is equal to the EndPoint specified in Find-operation if the search was completed +} tse_EndSearch_RES; + +typedef struct +{ + onvif_AnalyticsCapabilities Capabilities; // required, The capabilities for the Analytics service +} tan_GetServiceCapabilities_RES; + +typedef struct +{ + onvif_SupportedRules SupportedRules; +} tan_GetSupportedRules_RES; + +typedef struct +{ + int dummy; +} tan_CreateRules_RES; + +typedef struct +{ + int dummy; +} tan_DeleteRules_RES; + +typedef struct +{ + ConfigList * Rule; // optional +} tan_GetRules_RES; + +typedef struct +{ + int dummy; +} tan_ModifyRules_RES; + +typedef struct +{ + int dummy; +} tan_CreateAnalyticsModules_RES; + +typedef struct +{ + int dummy; +} tan_DeleteAnalyticsModules_RES; + +typedef struct +{ + ConfigList * AnalyticsModule; // optional +} tan_GetAnalyticsModules_RES; + +typedef struct +{ + int dummy; +} tan_ModifyAnalyticsModules_RES; + +typedef struct +{ + onvif_SupportedAnalyticsModules SupportedAnalyticsModules; // required element of type ns2:SupportedAnalyticsModules +} tan_GetSupportedAnalyticsModules_RES; + +typedef struct +{ + ConfigOptionsList * RuleOptions; // optional, A device shall provide respective ConfigOptions.RuleType for each RuleOption + // if the request does not specify RuleType +} tan_GetRuleOptions_RES; + +typedef struct +{ + AnalyticsModuleConfigOptionsList * Options; // optional, +} tan_GetAnalyticsModuleOptions_RES; + +typedef struct +{ + MetadataInfoList * AnalyticsModule; // optional, +} tan_GetSupportedMetadata_RES; + +// onvif media service 2 interfaces + +typedef struct +{ + onvif_MediaCapabilities2 Capabilities; // required, The capabilities for the medai 2 service +} tr2_GetServiceCapabilities_RES; + +typedef struct +{ + VideoEncoder2ConfigurationList * Configurations; // This element contains a list of video encoder configurations +} tr2_GetVideoEncoderConfigurations_RES; + +typedef struct +{ + VideoEncoder2ConfigurationOptionsList * Options; // required +} tr2_GetVideoEncoderConfigurationOptions_RES; + +typedef struct +{ + int dummy; +} tr2_SetVideoEncoderConfiguration_RES; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, Token assigned by the device for the newly created profile +} tr2_CreateProfile_RES; + +typedef struct +{ + MediaProfileList * Profiles; // Lists all profiles that exist in the media service. + // The response provides the requested types of Configurations as far as available. + // If a profile doesn't contain a type no error shall be provided +} tr2_GetProfiles_RES; + +typedef struct +{ + int dummy; +} tr2_DeleteProfile_RES; + +typedef struct +{ + char Uri[256]; // required, Stable Uri to be used for requesting the media stream +} tr2_GetStreamUri_RES; + +typedef struct +{ + VideoSourceConfigurationList * Configurations; // This element contains a list of video source configurations +} tr2_GetVideoSourceConfigurations_RES; + +typedef struct +{ + onvif_VideoSourceConfigurationOptions Options; // This message contains the video source configuration options. + // If a video source configuration is specified, the options shall concern that particular configuration. + // If a media profile is specified, the options shall be compatible with that media profile. + // If no tokens are specified, the options shall be considered generic for the device +} tr2_GetVideoSourceConfigurationOptions_RES; + +typedef struct +{ + int dummy; +} tr2_SetVideoSourceConfiguration_RES; + +typedef struct +{ + int dummy; +} tr2_SetSynchronizationPoint_RES; + +typedef struct +{ + MetadataConfigurationList * Configurations; // This element contains a list of metadata configurations +} tr2_GetMetadataConfigurations_RES; + +typedef struct +{ + onvif_MetadataConfigurationOptions Options; // This message contains the metadata configuration options. + // If a metadata configuration is specified, the options shall concern that particular configuration. + // If a media profile is specified, the options shall be compatible with that media profile. + // If no tokens are specified, the options shall be considered generic for the device +} tr2_GetMetadataConfigurationOptions_RES; + +typedef struct +{ + int dummy; +} tr2_SetMetadataConfiguration_RES; + +typedef struct +{ + AudioEncoder2ConfigurationList * Configurations; // This element contains a list of audio encoder configurations +} tr2_GetAudioEncoderConfigurations_RES; + +typedef struct +{ + AudioSourceConfigurationList * Configurations; // This element contains a list of audio source configurations +} tr2_GetAudioSourceConfigurations_RES; + +typedef struct +{ + int dummy; +} tr2_GetAudioSourceConfigurationOptions_RES; + +typedef struct +{ + int dummy; +} tr2_SetAudioSourceConfiguration_RES; + +typedef struct +{ + int dummy; +} tr2_SetAudioEncoderConfiguration_RES; + +typedef struct +{ + AudioEncoder2ConfigurationOptionsList * Options; // This message contains the audio encoder configuration options. + // If a audio encoder configuration is specified, the options shall concern that particular configuration. + // If a media profile is specified, the options shall be compatible with that media profile. + // If no tokens are specified, the options shall be considered generic for the device +} tr2_GetAudioEncoderConfigurationOptions_RES; + +typedef struct +{ + int dummy; +} tr2_AddConfiguration_RES; + +typedef struct +{ + int dummy; +} tr2_RemoveConfiguration_RES; + +typedef struct +{ + onvif_EncoderInstanceInfo Info; // required, The minimum guaranteed total number of encoder instances (applications) per VideoSourceConfiguration +} tr2_GetVideoEncoderInstances_RES; + +typedef struct +{ + AudioOutputConfigurationList * Configurations; // optional, This element contains a list of audio output configurations +} tr2_GetAudioOutputConfigurations_RES; + +typedef struct +{ + onvif_AudioOutputConfigurationOptions Options; // required, This message contains the audio output configuration options. + // If a audio output configuration is specified, the options shall concern that particular configuration. + // If a media profile is specified, the options shall be compatible with that media profile. + // If no tokens are specified, the options shall be considered generic for the device +} tr2_GetAudioOutputConfigurationOptions_RES; + +typedef struct +{ + int dummy; +} tr2_SetAudioOutputConfiguration_RES; + +typedef struct +{ + AudioDecoderConfigurationList * Configurations; // optional, This element contains a list of audio decoder configurations +} tr2_GetAudioDecoderConfigurations_RES; + +typedef struct +{ + AudioEncoder2ConfigurationOptionsList * Options; // optional, This message contains the audio decoder configuration options. + // If a audio decoder configuration is specified, the options shall concern that particular configuration. + // If a media profile is specified, the options shall be compatible with that media profile. + // If no tokens are specified, the options shall be considered generic for the device +} tr2_GetAudioDecoderConfigurationOptions_RES; + +typedef struct +{ + int dummy; +} tr2_SetAudioDecoderConfiguration_RES; + +typedef struct +{ + char Uri[512]; // required, Stable Uri to be used for requesting snapshot images +} tr2_GetSnapshotUri_RES; + +typedef struct +{ + int dummy; +} tr2_StartMulticastStreaming_RES; + +typedef struct +{ + int dummy; +} tr2_StopMulticastStreaming_RES; + +typedef struct +{ + VideoSourceModeList * VideoSourceModes; //required, Return the information for specified video source mode +} tr2_GetVideoSourceModes_RES; + +typedef struct +{ + BOOL Reboot; // required, The response contains information about rebooting after returning response. + // When Reboot is set true, a device will reboot automatically after setting mode +} tr2_SetVideoSourceMode_RES; + +typedef struct +{ + char OSDToken[ONVIF_TOKEN_LEN]; // required, Returns Token of the newly created OSD +} tr2_CreateOSD_RES; + +typedef struct +{ + int dummy; +} tr2_DeleteOSD_RES; + +typedef struct +{ + OSDConfigurationList * OSDs; // optional, This element contains a list of requested OSDs +} tr2_GetOSDs_RES; + +typedef struct +{ + int dummy; +} tr2_SetOSD_RES; + +typedef struct +{ + onvif_OSDConfigurationOptions OSDOptions; // required +} tr2_GetOSDOptions_RES; + +typedef struct +{ + VideoAnalyticsConfigurationList * Configurations; // optional, This element contains a list of Analytics configurations +} tr2_GetAnalyticsConfigurations_RES; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, Returns Token of the newly created Mask +} tr2_CreateMask_RES; + +typedef struct +{ + MaskList * Masks; // optional, List of Mask configurations +} tr2_GetMasks_RES; + +typedef struct +{ + int dummy; +} tr2_SetMask_RES; + +typedef struct +{ + int dummy; +} tr2_DeleteMask_RES; + +typedef struct +{ + onvif_MaskOptions Options; // required, +} tr2_GetMaskOptions_RES; + +// end of onvif media 2 interfaces + +typedef struct +{ + onvif_AccessControlCapabilities Capabilities; // required, The capabilities for the access control service +} tac_GetServiceCapabilities_RES; + +typedef struct +{ + uint32 NextStartReferenceFlag : 1; + uint32 Reserved : 31; + + char NextStartReference[ONVIF_TOKEN_LEN]; // optional, StartReference to use in next call to get the following items. If absent, no more items to get + + AccessPointList * AccessPointInfo; // optional, List of AccessPointInfo items +} tac_GetAccessPointInfoList_RES; + +typedef struct +{ + AccessPointList * AccessPointInfo; // List of AccessPointInfo items +} tac_GetAccessPointInfo_RES; + +typedef struct +{ + uint32 NextStartReferenceFlag : 1; + uint32 Reserved : 31; + + char NextStartReference[ONVIF_TOKEN_LEN]; // optional, StartReference to use in next call to get the following items. If absent, no more items to get + + AccessPointList * AccessPoint; // optional, List of AccessPoint items +} tac_GetAccessPointList_RES; + +typedef struct +{ + AccessPointList * AccessPoint; // optional, List of AccessPoint items +} tac_GetAccessPoints_RES; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required +} tac_CreateAccessPoint_RES; + +typedef struct +{ + int dummy; +} tac_SetAccessPoint_RES; + +typedef struct +{ + int dummy; +} tac_ModifyAccessPoint_RES; + +typedef struct +{ + int dummy; +} tac_DeleteAccessPoint_RES; + +typedef struct +{ + uint32 NextStartReferenceFlag : 1; + uint32 Reserved : 31; + + char NextStartReference[ONVIF_TOKEN_LEN]; // optional, StartReference to use in next call to get the following items. If absent, no more items to get + + AreaList * AreaInfo; // optional, List of AreaInfo items +} tac_GetAreaInfoList_RES; + +typedef struct +{ + AreaList * AreaInfo; // List of AreaInfo items +} tac_GetAreaInfo_RES; + +typedef struct +{ + uint32 NextStartReferenceFlag : 1; + uint32 Reserved : 31; + + char NextStartReference[ONVIF_TOKEN_LEN]; // optional, StartReference to use in next call to get the following items. If absent, no more items to get + + AreaList * Area; // optional, List of Area items +} tac_GetAreaList_RES; + +typedef struct +{ + AreaList * Area; // optional, List of Area items +} tac_GetAreas_RES; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required +} tac_CreateArea_RES; + +typedef struct +{ + int dummy; +} tac_SetArea_RES; + +typedef struct +{ + int dummy; +} tac_ModifyArea_RES; + +typedef struct +{ + int dummy; +} tac_DeleteArea_RES; + +typedef struct +{ + BOOL Enabled; // required, Indicates that the AccessPoint is enabled. + // By default this field value shall be True, if the DisableAccessPoint capabilities is not supported +} tac_GetAccessPointState_RES; + +typedef struct +{ + int dummy; +} tac_EnableAccessPoint_RES; + +typedef struct +{ + int dummy; +} tac_DisableAccessPoint_RES; + +typedef struct +{ + onvif_DoorControlCapabilities Capabilities; // required, The capabilities for the door control service +} tdc_GetServiceCapabilities_RES; + +typedef struct +{ + uint32 NextStartReferenceFlag : 1; + uint32 Reserved : 31; + + char NextStartReference[ONVIF_TOKEN_LEN]; // optional, StartReference to use in next call to get the following items. If absent, no more items to get + + DoorInfoList * DoorInfo; // optional, List of DoorInfo items +} tdc_GetDoorInfoList_RES; + +typedef struct +{ + DoorInfoList * DoorInfo; // List of DoorInfo items +} tdc_GetDoorInfo_RES; + +typedef struct +{ + onvif_DoorState DoorState; +} tdc_GetDoorState_RES; + +typedef struct +{ + int dummy; +} tdc_AccessDoor_RES; + +typedef struct +{ + int dummy; +} tdc_LockDoor_RES; + +typedef struct +{ + int dummy; +} tdc_UnlockDoor_RES; + +typedef struct +{ + int dummy; +} tdc_DoubleLockDoor_RES; + +typedef struct +{ + int dummy; +} tdc_BlockDoor_RES; + +typedef struct +{ + int dummy; +} tdc_LockDownDoor_RES; + +typedef struct +{ + int dummy; +} tdc_LockDownReleaseDoor_RES; + +typedef struct +{ + int dummy; +} tdc_LockOpenDoor_RES; + +typedef struct +{ + int dummy; +} tdc_LockOpenReleaseDoor_RES; + +typedef struct +{ + DoorList * Door; // optional, List of Door items +} tdc_GetDoors_RES; + +typedef struct +{ + uint32 NextStartReferenceFlag : 1; + uint32 Reserved : 31; + + char NextStartReference[ONVIF_TOKEN_LEN]; // optional, StartReference to use in next call to get the following items. If absent, no more items to get + + DoorList * Door; // optional, List of Door items +} tdc_GetDoorList_RES; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, Token of created Door item +} tdc_CreateDoor_RES; + +typedef struct +{ + int dummy; +} tdc_SetDoor_RES; + +typedef struct +{ + int dummy; +} tdc_ModifyDoor_RES; + +typedef struct +{ + int dummy; +} tdc_DeleteDoor_RES; + +// thermal service + +typedef struct +{ + onvif_ThermalCapabilities Capabilities; // required, The capabilities for the thermal service +} tth_GetServiceCapabilities_RES; + +typedef struct +{ + ThermalConfigurationList * Configurations; // This element contains a list of thermal VideoSource configurations +} tth_GetConfigurations_RES; + +typedef struct +{ + onvif_ThermalConfiguration Configuration; // required, thermal Settings for the VideoSource that was requested +} tth_GetConfiguration_RES; + +typedef struct +{ + int dummy; +} tth_SetConfiguration_RES; + +typedef struct +{ + onvif_ThermalConfigurationOptions Options; // required, Valid ranges for the Thermal configuration parameters that are categorized as device specific +} tth_GetConfigurationOptions_RES; + +typedef struct +{ + onvif_RadiometryConfiguration Configuration; // required, Radiometry Configuration for the VideoSource that was requested +} tth_GetRadiometryConfiguration_RES; + +typedef struct +{ + int dummy; +} tth_SetRadiometryConfiguration_RES; + +typedef struct +{ + onvif_RadiometryConfigurationOptions Options; // required, Valid ranges for the Thermal Radiometry parameters that are categorized as device specific +} tth_GetRadiometryConfigurationOptions_RES; + +typedef struct +{ + onvif_CredentialCapabilities Capabilities; // required, The capabilities for the credential service +} tcr_GetServiceCapabilities_RES; + +typedef struct +{ + uint32 sizeCredentialInfo; // sequence of elements + + onvif_CredentialInfo CredentialInfo[CREDENTIAL_MAX_LIMIT]; // optional, List of CredentialInfo items +} tcr_GetCredentialInfo_RES; + +typedef struct +{ + uint32 NextStartReferenceFlag : 1; // Indicates whether the field StartReference is valid + uint32 Reserved : 31; + + char NextStartReference[ONVIF_TOKEN_LEN]; // optional, StartReference to use in next call to get the following items. If + // absent, no more items to get + uint32 sizeCredentialInfo; // sequence of elements + + onvif_CredentialInfo CredentialInfo[CREDENTIAL_MAX_LIMIT]; // optional, List of CredentialInfo items +} tcr_GetCredentialInfoList_RES; + +typedef struct +{ + uint32 sizeCredential; // sequence of elements + + onvif_Credential Credential[CREDENTIAL_MAX_LIMIT]; // optional, List of Credential items +} tcr_GetCredentials_RES; + +typedef struct +{ + uint32 NextStartReferenceFlag : 1; // Indicates whether the field StartReference is valid + uint32 Reserved : 31; + + char NextStartReference[ONVIF_TOKEN_LEN]; // optional, StartReference to use in next call to get the following items. If + // absent, no more items to get + uint32 sizeCredential; // sequence of elements + onvif_Credential Credential[CREDENTIAL_MAX_LIMIT]; // optional, List of Credential items +} tcr_GetCredentialList_RES; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, The token of the created credential +} tcr_CreateCredential_RES; + +typedef struct +{ + int dummy; +} tcr_ModifyCredential_RES; + +typedef struct +{ + int dummy; +} tcr_DeleteCredential_RES; + +typedef struct +{ + onvif_CredentialState State; // required, State of the credential +} tcr_GetCredentialState_RES; + +typedef struct +{ + int dummy; +} tcr_EnableCredential_RES; + +typedef struct +{ + int dummy; +} tcr_DisableCredential_RES; + +typedef struct +{ + int dummy; +} tcr_ResetAntipassbackViolation_RES; + +typedef struct +{ + uint32 sizeFormatTypeInfo; // sequence of elements + + onvif_CredentialIdentifierFormatTypeInfo FormatTypeInfo[CREDENTIAL_MAX_LIMIT]; // required, Identifier format types +} tcr_GetSupportedFormatTypes_RES; + +typedef struct +{ + uint32 sizeCredentialIdentifier; // sequence of elements + + onvif_CredentialIdentifier CredentialIdentifier[CREDENTIAL_MAX_LIMIT]; // optional, Identifiers of the credential +} tcr_GetCredentialIdentifiers_RES; + +typedef struct +{ + int dummy; +} tcr_SetCredentialIdentifier_RES; + +typedef struct +{ + int dummy; +} tcr_DeleteCredentialIdentifier_RES; + +typedef struct +{ + uint32 sizeCredentialAccessProfile; // sequence of elements + + onvif_CredentialAccessProfile CredentialAccessProfile[CREDENTIAL_MAX_LIMIT]; // optional, Access Profiles of the credential +} tcr_GetCredentialAccessProfiles_RES; + +typedef struct +{ + int dummy; +} tcr_SetCredentialAccessProfiles_RES; + +typedef struct +{ + int dummy; +} tcr_DeleteCredentialAccessProfiles_RES; + +typedef struct +{ + onvif_AccessRulesCapabilities Capabilities; // required, The capabilities for the access rules service +} tar_GetServiceCapabilities_RES; + +typedef struct +{ + uint32 sizeAccessProfileInfo; // sequence of elements + + onvif_AccessProfileInfo AccessProfileInfo[ACCESSRULES_MAX_LIMIT]; // optional, List of AccessProfileInfo items +} tar_GetAccessProfileInfo_RES; + +typedef struct +{ + uint32 NextStartReferenceFlag : 1; // Indicates whether the field NextStartReference is valid + uint32 Reserved : 31; + + char NextStartReference[ONVIF_TOKEN_LEN]; // optional, + uint32 sizeAccessProfileInfo; // sequence of elements + + onvif_AccessProfileInfo AccessProfileInfo[ACCESSRULES_MAX_LIMIT]; // optional, List of AccessProfileInfo items +} tar_GetAccessProfileInfoList_RES; + +typedef struct +{ + uint32 sizeAccessProfile; // sequence of elements + + onvif_AccessProfile AccessProfile[ACCESSRULES_MAX_LIMIT]; // optional, List of Access Profile items +} tar_GetAccessProfiles_RES; + +typedef struct +{ + uint32 NextStartReferenceFlag : 1; // Indicates whether the field NextStartReference is valid + uint32 Reserved : 31; + + char NextStartReference[ONVIF_TOKEN_LEN]; // optional, + uint32 sizeAccessProfile; // sequence of elements + + onvif_AccessProfile AccessProfile[ACCESSRULES_MAX_LIMIT]; // optional, List of Access Profile items +} tar_GetAccessProfileList_RES; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, The Token of created AccessProfile +} tar_CreateAccessProfile_RES; + +typedef struct +{ + int dummy; +} tar_ModifyAccessProfile_RES; + +typedef struct +{ + int dummy; +} tar_DeleteAccessProfile_RES; + +typedef struct +{ + onvif_ScheduleCapabilities Capabilities; // required, The capabilities for the Schedule service +} tsc_GetServiceCapabilities_RES; + +typedef struct +{ + uint32 sizeScheduleInfo; // sequence of elements + onvif_ScheduleInfo ScheduleInfo[SCHEDULE_MAX_LIMIT]; // optional, List of ScheduleInfo items +} tsc_GetScheduleInfo_RES; + +typedef struct +{ + uint32 NextStartReferenceFlag : 1; // Indicates whether the field StartReference is valid + uint32 Reserved : 31; + + char NextStartReference[ONVIF_TOKEN_LEN]; // optional, StartReference to use in next call to get the following items. If + // absent, no more items to get + uint32 sizeScheduleInfo; // sequence of elements + + onvif_ScheduleInfo ScheduleInfo[SCHEDULE_MAX_LIMIT]; // optional, List of ScheduleInfo items +} tsc_GetScheduleInfoList_RES; + +typedef struct +{ + uint32 sizeSchedule; // sequence of elements + onvif_Schedule Schedule[SCHEDULE_MAX_LIMIT]; // optional, List of schedule items +} tsc_GetSchedules_RES; + +typedef struct +{ + uint32 NextStartReferenceFlag : 1; // Indicates whether the field StartReference is valid + uint32 Reserved : 31; + + char NextStartReference[ONVIF_TOKEN_LEN]; // optional, StartReference to use in next call to get the following items. If + // absent, no more items to get + uint32 sizeSchedule; // sequence of elements + + onvif_Schedule Schedule[SCHEDULE_MAX_LIMIT]; // optional, List of Schedule items +} tsc_GetScheduleList_RES; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, The token of created Schedule +} tsc_CreateSchedule_RES; + +typedef struct +{ + int dummy; +} tsc_ModifySchedule_RES; + +typedef struct +{ + int dummy; +} tsc_DeleteSchedule_RES; + +typedef struct +{ + uint32 sizeSpecialDayGroupInfo; // sequence of elements + onvif_SpecialDayGroupInfo SpecialDayGroupInfo[SCHEDULE_MAX_LIMIT]; // optional, List of SpecialDayGroupInfo items +} tsc_GetSpecialDayGroupInfo_RES; + +typedef struct +{ + uint32 NextStartReferenceFlag : 1; // Indicates whether the field StartReference is valid + uint32 Reserved : 31; + + char NextStartReference[ONVIF_TOKEN_LEN]; // optional, StartReference to use in next call to get the following items. If + // absent, no more items to get + uint32 sizeSpecialDayGroupInfo; // sequence of elements + + onvif_SpecialDayGroupInfo SpecialDayGroupInfo[SCHEDULE_MAX_LIMIT]; // optional, List of SpecialDayGroupInfo items +} tsc_GetSpecialDayGroupInfoList_RES; + +typedef struct +{ + uint32 sizeSpecialDayGroup; // sequence of elements + onvif_SpecialDayGroup SpecialDayGroup[SCHEDULE_MAX_LIMIT]; // optional, List of SpecialDayGroup items +} tsc_GetSpecialDayGroups_RES; + +typedef struct +{ + uint32 NextStartReferenceFlag : 1; // Indicates whether the field StartReference is valid + uint32 Reserved : 31; + + char NextStartReference[ONVIF_TOKEN_LEN]; // optional, StartReference to use in next call to get the following items. If + // absent, no more items to get + uint32 sizeSpecialDayGroup; // sequence of elements + + onvif_SpecialDayGroup SpecialDayGroup[SCHEDULE_MAX_LIMIT]; // optional, List of SpecialDayGroup items +} tsc_GetSpecialDayGroupList_RES; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, The token of created special day group +} tsc_CreateSpecialDayGroup_RES; + +typedef struct +{ + int dummy; +} tsc_ModifySpecialDayGroup_RES; + +typedef struct +{ + int dummy; +} tsc_DeleteSpecialDayGroup_RES; + +typedef struct +{ + onvif_ScheduleState ScheduleState; // required, ScheduleState item +} tsc_GetScheduleState_RES; + +typedef struct +{ + onvif_ReceiverCapabilities Capabilities; // required, The capabilities for the Receiver service +} trv_GetServiceCapabilities_RES; + +typedef struct +{ + ReceiverList * Receivers; // required, A list of all receivers that currently exist on the device +} trv_GetReceivers_RES; + +typedef struct +{ + onvif_Receiver Receiver; // required, The details of the receiver +} trv_GetReceiver_RES; + +typedef struct +{ + onvif_Receiver Receiver; // required, The details of the receiver that was created +} trv_CreateReceiver_RES; + +typedef struct +{ + int dummy; +} trv_DeleteReceiver_RES; + +typedef struct +{ + int dummy; +} trv_ConfigureReceiver_RES; + +typedef struct +{ + int dummy; +} trv_SetReceiverMode_RES; + +typedef struct +{ + onvif_ReceiverStateInformation ReceiverState; // required, Description of the current receiver state +} trv_GetReceiverState_RES; + +typedef struct +{ + onvif_ProvisioningCapabilities Capabilities; // required, The capabilities for the Receiver service +} tpv_GetServiceCapabilities_RES; + +typedef struct +{ + int dummy; +} tpv_PanMove_RES; + +typedef struct +{ + int dummy; +} tpv_TiltMove_RES; + +typedef struct +{ + int dummy; +} tpv_ZoomMove_RES; + +typedef struct +{ +} tpv_RollMove_RES; + +typedef struct +{ + int dummy; +} tpv_FocusMove_RES; + +typedef struct +{ + int dummy; +} tpv_Stop_RES; + +typedef struct +{ + onvif_Usage Usage; // required, The set of lifetime usage values for the provisioning associated with the video source +} tpv_GetUsage_RES; + + +#endif // end of ONVIF_RES_H + + + diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/onvif/onvif_utils.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/onvif/onvif_utils.h new file mode 100644 index 0000000..181d2c2 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/onvif/onvif_utils.h @@ -0,0 +1,52 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef _ONVIF_UTILS_H_ +#define _ONVIF_UTILS_H_ + +#include "sys_inc.h" +#include "onvif.h" + +#ifdef __cplusplus +extern "C" { +#endif + +HT_API void onvif_get_time_str(char * buff, int len, int sec_off); +HT_API void onvif_get_time_str_s(char * buff, int len, time_t nowtime, int sec_off); +HT_API BOOL onvif_is_valid_hostname(const char * name); +HT_API BOOL onvif_is_valid_timezone(const char * tz); +HT_API void onvif_get_timezone(char * tz, int len, BOOL * daylight); +HT_API char * onvif_uuid_create(char * uuid, int len); +HT_API time_t onvif_timegm(struct tm *T); +HT_API int onvif_parse_xaddr(const char * pdata, char * host, int hostsize, char * url, int urlsize, int * port, int * https); +HT_API time_t onvif_datetime_to_time_t(onvif_DateTime * p_datetime); +HT_API void onvif_time_t_to_datetime(time_t n, onvif_DateTime * p_datetime); +HT_API char * onvif_format_datetime_str(time_t n, int flag, const char * format, char * buff, int buflen); +HT_API time_t onvif_timegm(struct tm *T); +HT_API int onvif_parse_uri(const char * p_in, char * p_out, int outlen); +HT_API char * onvif_format_float_num(float num, int precision, char * buff, int len); + +#ifdef __cplusplus +} +#endif + + +#endif + + diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/onvif/onvif_ver.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/onvif/onvif_ver.h new file mode 100644 index 0000000..b455dd9 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/onvif/onvif_ver.h @@ -0,0 +1,29 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef ONVIF_VER_H +#define ONVIF_VER_H + +#define ONVIF_CLIENT_VERSION "V12.0" + + +#endif + + + diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/onvif/soap.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/onvif/soap.h new file mode 100644 index 0000000..dc24ec2 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/onvif/soap.h @@ -0,0 +1,40 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef SOAP_H +#define SOAP_H + +#include "sys_inc.h" +#include "onvif.h" +#include "xml_node.h" + +#ifdef __cplusplus +extern "C" { +#endif + +BOOL onvif_rly_handler(XMLN * p_xml, eOnvifAction act, ONVIF_DEVICE * p_dev, void * p_res); + +#ifdef __cplusplus +} +#endif + + +#endif + + diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/onvif/soap_parser.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/onvif/soap_parser.h new file mode 100644 index 0000000..82201cd --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/onvif/soap_parser.h @@ -0,0 +1,435 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef SOAP_PARSER_H +#define SOAP_PARSER_H + +#include "sys_inc.h" +#include "onvif.h" +#include "xml_node.h" +#include "onvif_res.h" + +#ifdef __cplusplus +extern "C" { +#endif + +HT_API BOOL parse_Bool(const char * pdata); +HT_API int parse_DeviceType(const char * pdata); +HT_API int parse_XAddr(const char * pdata, onvif_XAddr * p_xaddr); + +int parse_Time(const char * pdata); +BOOL parse_XSDDatetime(const char * s, time_t * p); +BOOL parse_XSDDuration(const char *s, int *a); +BOOL parse_Fault(XMLN * p_node, onvif_Fault * p_res); +BOOL parse_FloatRangeList(const char * p_buff, onvif_FloatRange * p_res); +BOOL parse_IntList(XMLN * p_node, onvif_IntList * p_res); +BOOL parse_IntRange(XMLN * p_node, onvif_IntRange * p_res); +BOOL parse_FloatRange(XMLN * p_node, onvif_FloatRange * p_res); +BOOL parse_EncodingList(const char * p_encoding, onvif_RecordingCapabilities * p_res); +BOOL parse_Vector(XMLN * p_node, onvif_Vector * p_res); +BOOL parse_Vector1D(XMLN * p_node, onvif_Vector1D * p_res); +BOOL parse_PTZSpeed(XMLN * p_node, onvif_PTZSpeed * p_res); +BOOL parse_PTZVector(XMLN * p_node, onvif_PTZVector * p_res); +BOOL parse_AnalyticsCapabilities(XMLN * p_node, onvif_AnalyticsCapabilities * p_res); +BOOL parse_DeviceCapabilities(XMLN * p_node, onvif_DevicesCapabilities * p_res); +BOOL parse_EventsCapabilities(XMLN * p_node, onvif_EventCapabilities * p_res); +BOOL parse_ImageCapabilities(XMLN * p_node, onvif_ImagingCapabilities * p_res); +BOOL parse_MediaCapabilities(XMLN * p_node, onvif_MediaCapabilities * p_res); +BOOL parse_PTZCapabilities(XMLN * p_node, onvif_PTZCapabilities * p_res); +BOOL parse_DeviceIOCapabilities(XMLN * p_node, onvif_DeviceIOCapabilities * p_res); +BOOL parse_RecordingCapabilities(XMLN * p_node, onvif_RecordingCapabilities * p_res); +BOOL parse_SearchCapabilities(XMLN * p_node, onvif_SearchCapabilities * p_res); +BOOL parse_ReplayCapabilities(XMLN * p_node, onvif_ReplayCapabilities * p_res); +BOOL parse_Version(XMLN * p_node, onvif_Version * p_res); +BOOL parse_DeviceServiceCapabilities(XMLN * p_node, onvif_DevicesCapabilities * p_res); +BOOL parse_DeviceService(XMLN * p_node, onvif_DevicesCapabilities * p_res); +BOOL parse_MediaServiceCapabilities(XMLN * p_node, onvif_MediaCapabilities * p_res); +BOOL parse_MediaService(XMLN * p_node, onvif_MediaCapabilities * p_res); +BOOL parse_Media2ServiceCapabilities(XMLN * p_node, onvif_MediaCapabilities2 * p_res); +BOOL parse_Media2Service(XMLN * p_node, onvif_MediaCapabilities2 * p_res); +BOOL parse_EventServiceCapabilities(XMLN * p_node, onvif_EventCapabilities * p_res); +BOOL parse_EventsService(XMLN * p_node, onvif_EventCapabilities * p_res); +BOOL parse_PTZServiceCapabilities(XMLN * p_node, onvif_PTZCapabilities * p_res); +BOOL parse_PTZService(XMLN * p_node, onvif_PTZCapabilities * p_res); +BOOL parse_ImagingServiceCapabilities(XMLN * p_node, onvif_ImagingCapabilities * p_res); +BOOL parse_ImagingService(XMLN * p_node, onvif_ImagingCapabilities * p_res); +BOOL parse_AnalyticsServiceCapabilities(XMLN * p_node, onvif_AnalyticsCapabilities * p_res); +BOOL parse_AnalyticsService(XMLN * p_node, onvif_AnalyticsCapabilities * p_res); +BOOL parse_VideoSourceConfiguration(XMLN * p_node, onvif_VideoSourceConfiguration * p_res); +BOOL parse_AudioSourceConfiguration(XMLN * p_node, onvif_AudioSourceConfiguration * p_res); +BOOL parse_MulticastConfiguration(XMLN * p_node, onvif_MulticastConfiguration * p_res); +BOOL parse_VideoResolution(XMLN * p_node, onvif_VideoResolution * p_res); +BOOL parse_ImagingSettings(XMLN * p_node, onvif_ImagingSettings * p_res); +BOOL parse_VideoSource(XMLN * p_node, onvif_VideoSource * p_res); +BOOL parse_AudioSource(XMLN * p_node, onvif_AudioSource * p_res); +BOOL parse_SimpleItem(XMLN * p_node, onvif_SimpleItem * p_res); +BOOL parse_ElementItem(XMLN * p_node, onvif_ElementItem * p_res); +BOOL parse_ItemList(XMLN * p_node, onvif_ItemList * p_res); +BOOL parse_Config(XMLN * p_node, onvif_Config * p_res); +BOOL parse_VideoEncoderConfiguration(XMLN * p_node, onvif_VideoEncoderConfiguration * p_res); +BOOL parse_AudioEncoderConfiguration(XMLN * p_node, onvif_AudioEncoderConfiguration * p_res); +BOOL parse_PTZConfiguration(XMLN * p_node, onvif_PTZConfiguration * p_res); +BOOL parse_AnalyticsEngineConfiguration(XMLN * p_node, onvif_AnalyticsEngineConfiguration * p_res); +BOOL parse_RuleEngineConfiguration(XMLN * p_node, onvif_RuleEngineConfiguration * p_res); +BOOL parse_VideoAnalyticsConfiguration(XMLN * p_node, onvif_VideoAnalyticsConfiguration * p_res); +BOOL parse_Profile(XMLN * p_node, ONVIF_PROFILE * p_profile); +BOOL parse_Dot11Configuration(XMLN * p_node, onvif_Dot11Configuration * p_res); +BOOL parse_NetworkInterface(XMLN * p_node, onvif_NetworkInterface * p_res); +BOOL parse_User(XMLN * p_node, onvif_User * p_res); +BOOL parse_Datetime(XMLN * p_node, onvif_DateTime * p_datetime); +BOOL parse_Dot11AvailableNetworks(XMLN * p_node, onvif_Dot11AvailableNetworks * p_res); +BOOL parse_LocationEntity(XMLN * p_node, onvif_LocationEntity * p_res); +BOOL parse_PrefixedIPAddress(XMLN * p_node, onvif_PrefixedIPAddress * p_res); +BOOL parse_IPAddressFilter(XMLN * p_node, onvif_IPAddressFilter * p_res); +BOOL parse_UserCredential(XMLN * p_node, onvif_UserCredential * p_res); +BOOL parse_StorageConfigurationData(XMLN * p_node, onvif_StorageConfigurationData * p_res); +BOOL parse_StorageConfiguration(XMLN * p_node, onvif_StorageConfiguration * p_res); +BOOL parse_RelayOutputSettings(XMLN * p_node, onvif_RelayOutputSettings * p_res); + +BOOL parse_tds_GetCapabilities(XMLN * p_node, tds_GetCapabilities_RES * p_res); +BOOL parse_tds_GetServices(XMLN * p_node, tds_GetServices_RES * p_res); +BOOL parse_tds_GetServiceCapabilities(XMLN * p_node, tds_GetServiceCapabilities_RES * p_res); +BOOL parse_tds_GetDeviceInformation(XMLN * p_node, tds_GetDeviceInformation_RES * p_res); +BOOL parse_tds_GetUsers(XMLN * p_node, tds_GetUsers_RES * p_res); +BOOL parse_tds_GetRemoteUser(XMLN * p_node, tds_GetRemoteUser_RES * p_res); +BOOL parse_tds_GetNetworkInterfaces(XMLN * p_node, tds_GetNetworkInterfaces_RES * p_res); +BOOL parse_tds_SetNetworkInterfaces(XMLN * p_node, tds_SetNetworkInterfaces_RES * p_res); +BOOL parse_tds_GetNTP(XMLN * p_node, tds_GetNTP_RES * p_res); +BOOL parse_tds_GetHostname(XMLN * p_node, tds_GetHostname_RES * p_res); +BOOL parse_tds_SetHostnameFromDHCP(XMLN * p_node, tds_SetHostnameFromDHCP_RES * p_res); +BOOL parse_tds_GetDNS(XMLN * p_node, tds_GetDNS_RES * p_res); +BOOL parse_tds_GetDynamicDNS(XMLN * p_node, tds_GetDynamicDNS_RES * p_res); +BOOL parse_tds_GetNetworkProtocols(XMLN * p_node, tds_GetNetworkProtocols_RES * p_res); +BOOL parse_tds_GetDiscoveryMode(XMLN * p_node, tds_GetDiscoveryMode_RES * p_res); +BOOL parse_tds_GetNetworkDefaultGateway(XMLN * p_node, tds_GetNetworkDefaultGateway_RES * p_res); +BOOL parse_tds_GetZeroConfiguration(XMLN * p_node, tds_GetZeroConfiguration_RES * p_res); +BOOL parse_tds_GetEndpointReference(XMLN * p_node, tds_GetEndpointReference_RES * p_res); +BOOL parse_tds_SendAuxiliaryCommand(XMLN * p_node, tds_SendAuxiliaryCommand_RES * p_res); +BOOL parse_tds_GetRelayOutputs(XMLN * p_node, tds_GetRelayOutputs_RES * p_res); +BOOL parse_tds_GetSystemDateAndTime(XMLN * p_node, tds_GetSystemDateAndTime_RES * p_res); +BOOL parse_tds_GetSystemLog(XMLN * p_node, tds_GetSystemLog_RES * p_res); +BOOL parse_tds_GetScopes(XMLN * p_node, tds_GetScopes_RES * p_res); +BOOL parse_tds_StartFirmwareUpgrade(XMLN * p_node, tds_StartFirmwareUpgrade_RES * p_res); +BOOL parse_tds_GetSystemUris(XMLN * p_node, tds_GetSystemUris_RES * p_res); +BOOL parse_tds_StartSystemRestore(XMLN * p_node, tds_StartSystemRestore_RES * p_res); +BOOL parse_tds_GetWsdlUrl(XMLN * p_node, tds_GetWsdlUrl_RES * p_res); +BOOL parse_tds_GetDot11Capabilities(XMLN * p_node, tds_GetDot11Capabilities_RES * p_res); +BOOL parse_tds_GetDot11Status(XMLN * p_node, tds_GetDot11Status_RES * p_res); +BOOL parse_tds_ScanAvailableDot11Networks(XMLN * p_node, tds_ScanAvailableDot11Networks_RES * p_res); +BOOL parse_tds_GetGeoLocation(XMLN * p_node, tds_GetGeoLocation_RES * p_res); +BOOL parse_tds_GetIPAddressFilter(XMLN * p_node, tds_GetIPAddressFilter_RES * p_res); +BOOL parse_tds_GetAccessPolicy(XMLN * p_node, tds_GetAccessPolicy_RES * p_res); +BOOL parse_tds_GetStorageConfigurations(XMLN * p_node, tds_GetStorageConfigurations_RES * p_res); +BOOL parse_tds_CreateStorageConfiguration(XMLN * p_node, tds_CreateStorageConfiguration_RES * p_res); +BOOL parse_tds_GetStorageConfiguration(XMLN * p_node, tds_GetStorageConfiguration_RES * p_res); + +BOOL parse_JPEGOptions(XMLN * p_node, onvif_JpegOptions * p_res); +BOOL parse_MPEG4Options(XMLN * p_node, onvif_Mpeg4Options * p_res); +BOOL parse_H264Options(XMLN * p_node, onvif_H264Options * p_res); +BOOL parse_AudioOutputConfiguration(XMLN * p_node, onvif_AudioOutputConfiguration * p_res); +BOOL parse_AudioDecoderConfiguration(XMLN * p_node, onvif_AudioDecoderConfiguration * p_res); +BOOL parse_VideoSourceMode(XMLN * p_node, onvif_VideoSourceMode * p_res); +BOOL parse_Color(XMLN * p_node, onvif_Color * p_res); +BOOL parse_ColorOptions(XMLN * p_node, onvif_ColorOptions * p_res); +BOOL parse_OSDColorOptions(XMLN * p_node, onvif_OSDColorOptions * p_res); +BOOL parse_OSDOptions(XMLN * p_node, onvif_OSDConfigurationOptions * p_res); +BOOL parse_OSDColor(XMLN * p_node, onvif_OSDColor * p_res); +BOOL parse_OSDConfiguration(XMLN * p_node, onvif_OSDConfiguration * p_res); + +BOOL parse_trt_GetServiceCapabilities(XMLN * p_node, trt_GetServiceCapabilities_RES * p_res); +BOOL parse_trt_GetVideoSources(XMLN * p_node, trt_GetVideoSources_RES * p_res); +BOOL parse_trt_GetAudioSources(XMLN * p_node, trt_GetAudioSources_RES * p_res); +BOOL parse_trt_CreateProfile(XMLN * p_node, trt_CreateProfile_RES * p_res); +BOOL parse_trt_GetProfile(XMLN * p_node, trt_GetProfile_RES * p_res); +BOOL parse_trt_GetProfiles(XMLN * p_node, trt_GetProfiles_RES * p_res); +BOOL parse_trt_GetVideoSourceModes(XMLN * p_node, trt_GetVideoSourceModes_RES * p_res); +BOOL parse_trt_SetVideoSourceMode(XMLN * p_node, trt_SetVideoSourceMode_RES * p_res); +BOOL parse_trt_GetVideoSourceConfigurations(XMLN * p_node, trt_GetVideoSourceConfigurations_RES * p_res); +BOOL parse_trt_GetVideoEncoderConfigurations(XMLN * p_node, trt_GetVideoEncoderConfigurations_RES * p_res); +BOOL parse_trt_GetAudioSourceConfigurations(XMLN * p_node, trt_GetAudioSourceConfigurations_RES * p_res); +BOOL parse_trt_GetAudioEncoderConfigurations(XMLN * p_node, trt_GetAudioEncoderConfigurations_RES * p_res); +BOOL parse_trt_GetVideoSourceConfiguration(XMLN * p_node, trt_GetVideoSourceConfiguration_RES * p_res); +BOOL parse_trt_GetVideoEncoderConfiguration(XMLN * p_node, trt_GetVideoEncoderConfiguration_RES * p_res); +BOOL parse_trt_GetAudioSourceConfiguration(XMLN * p_node, trt_GetAudioSourceConfiguration_RES * p_res); +BOOL parse_trt_GetAudioEncoderConfiguration(XMLN * p_node, trt_GetAudioEncoderConfiguration_RES * p_res); +BOOL parse_trt_GetVideoSourceConfigurationOptions(XMLN * p_node, trt_GetVideoSourceConfigurationOptions_RES * p_res); +BOOL parse_trt_GetVideoEncoderConfigurationOptions(XMLN * p_node, trt_GetVideoEncoderConfigurationOptions_RES * p_res); +BOOL parse_trt_GetAudioEncoderConfigurationOptions(XMLN * p_node, trt_GetAudioEncoderConfigurationOptions_RES * p_res); +BOOL parse_trt_GetStreamUri(XMLN * p_node, trt_GetStreamUri_RES * p_res); +BOOL parse_trt_GetSnapshotUri(XMLN * p_node, trt_GetSnapshotUri_RES * p_res); +BOOL parse_trt_GetGuaranteedNumberOfVideoEncoderInstances(XMLN * p_node, trt_GetGuaranteedNumberOfVideoEncoderInstances_RES * p_res); +BOOL parse_trt_GetAudioOutputs(XMLN * p_node, trt_GetAudioOutputs_RES * p_res); +BOOL parse_trt_GetAudioOutputConfigurations(XMLN * p_node, trt_GetAudioOutputConfigurations_RES * p_res); +BOOL parse_trt_GetAudioOutputConfiguration(XMLN * p_node, trt_GetAudioOutputConfiguration_RES * p_res); +BOOL parse_trt_GetAudioOutputConfigurationOptions(XMLN * p_node, trt_GetAudioOutputConfigurationOptions_RES * p_res); +BOOL parse_trt_GetAudioDecoderConfigurations(XMLN * p_node, trt_GetAudioDecoderConfigurations_RES * p_res); +BOOL parse_trt_GetAudioDecoderConfiguration(XMLN * p_node, trt_GetAudioDecoderConfiguration_RES * p_res); +BOOL parse_trt_GetAudioDecoderConfigurationOptions(XMLN * p_node, trt_GetAudioDecoderConfigurationOptions_RES * p_res); +BOOL parse_trt_GetOSDs(XMLN * p_node, trt_GetOSDs_RES * p_res); +BOOL parse_trt_GetOSD(XMLN * p_node, trt_GetOSD_RES * p_res); +BOOL parse_trt_GetOSDOptions(XMLN * p_node, trt_GetOSDOptions_RES * p_res); +BOOL parse_trt_CreateOSD(XMLN * p_node, trt_CreateOSD_RES * p_res); +BOOL parse_trt_GetVideoAnalyticsConfigurations(XMLN * p_node, trt_GetVideoAnalyticsConfigurations_RES * p_res); +BOOL parse_trt_GetVideoAnalyticsConfiguration(XMLN * p_node, trt_GetVideoAnalyticsConfiguration_RES * p_res); +BOOL parse_trt_GetMetadataConfigurations(XMLN * p_node, trt_GetMetadataConfigurations_RES * p_res); +BOOL parse_trt_GetMetadataConfiguration(XMLN * p_node, trt_GetMetadataConfiguration_RES * p_res); +BOOL parse_trt_GetMetadataConfigurationOptions(XMLN * p_node, trt_GetMetadataConfigurationOptions_RES * p_res); +BOOL parse_trt_GetCompatibleVideoEncoderConfigurations(XMLN * p_node, trt_GetCompatibleVideoEncoderConfigurations_RES * p_res); +BOOL parse_trt_GetCompatibleAudioEncoderConfigurations(XMLN * p_node, trt_GetCompatibleAudioEncoderConfigurations_RES * p_res); +BOOL parse_trt_GetCompatibleVideoAnalyticsConfigurations(XMLN * p_node, trt_GetCompatibleVideoAnalyticsConfigurations_RES * p_res); +BOOL parse_trt_GetCompatibleMetadataConfigurations(XMLN * p_node, trt_GetCompatibleMetadataConfigurations_RES * p_res); + +BOOL parse_Space2DDescription(XMLN * p_node, onvif_Space2DDescription * p_res); +BOOL parse_Space1DDescription(XMLN * p_node, onvif_Space1DDescription * p_res); +BOOL parse_PTZNode(XMLN * p_node, onvif_PTZNode * p_res); +BOOL parse_Preset(XMLN * p_node, onvif_PTZPreset * p_res); +BOOL parse_PTZPresetTourSpot(XMLN * p_node, onvif_PTZPresetTourSpot * p_res); +BOOL parse_PTZPresetTourStatus(XMLN * p_node, onvif_PTZPresetTourStatus * p_res); +BOOL parse_PTZPresetTourStartingCondition(XMLN * p_node, onvif_PTZPresetTourStartingCondition * p_res); +BOOL parse_PresetTour(XMLN * p_node, onvif_PresetTour * p_res); +BOOL parse_DurationRange(XMLN * p_node, onvif_DurationRange * p_res); + +BOOL parse_ptz_GetServiceCapabilities(XMLN * p_node, ptz_GetServiceCapabilities_RES * p_res); +BOOL parse_ptz_GetNodes(XMLN * p_node, ptz_GetNodes_RES * p_res); +BOOL parse_ptz_GetNode(XMLN * p_node, ptz_GetNode_RES * p_res); +BOOL parse_ptz_GetPresets(XMLN * p_node, ptz_GetPresets_RES * p_res); +BOOL parse_ptz_SetPreset(XMLN * p_node, ptz_SetPreset_RES * p_res); +BOOL parse_ptz_GetStatus(XMLN * p_node, ptz_GetStatus_RES * p_res); +BOOL parse_ptz_GetConfigurations(XMLN * p_node, ptz_GetConfigurations_RES * p_res); +BOOL parse_ptz_GetConfiguration(XMLN * p_node, ptz_GetConfiguration_RES * p_res); +BOOL parse_ptz_GetConfigurationOptions(XMLN * p_node, ptz_GetConfigurationOptions_RES * p_res); +BOOL parse_ptz_GetPresetTours(XMLN * p_node, ptz_GetPresetTours_RES * p_res); +BOOL parse_ptz_GetPresetTour(XMLN * p_node, ptz_GetPresetTour_RES * p_res); +BOOL parse_ptz_GetPresetTourOptions(XMLN * p_node, ptz_GetPresetTourOptions_RES * p_res); +BOOL parse_ptz_CreatePresetTour(XMLN * p_node, ptz_CreatePresetTour_RES * p_res); +BOOL parse_ptz_SendAuxiliaryCommand(XMLN * p_node, ptz_SendAuxiliaryCommand_RES * p_res); + +BOOL parse_NotificationMessage(XMLN * p_node, onvif_NotificationMessage * p_res); +BOOL parse_NotifyMessage(XMLN * p_node, NotificationMessageList ** p_res); +BOOL parse_tev_GetServiceCapabilities(XMLN * p_node, tev_GetServiceCapabilities_RES * p_res); +BOOL parse_tev_GetEventProperties(XMLN * p_node, tev_GetEventProperties_RES * p_res); +BOOL parse_tev_Subscribe(XMLN * p_node, tev_Subscribe_RES * p_res); +BOOL parse_tev_CreatePullPointSubscription(XMLN * p_node, tev_CreatePullPointSubscription_RES * p_res); +BOOL parse_tev_PullMessages(XMLN * p_node, tev_PullMessages_RES * p_res); +BOOL parse_tev_GetMessages(XMLN * p_node, tev_GetMessages_RES * p_res); + +BOOL parse_ImagingPreset(XMLN * p_node, onvif_ImagingPreset * p_res); +BOOL parse_img_GetServiceCapabilities(XMLN * p_node, img_GetServiceCapabilities_RES * p_res); +BOOL parse_img_GetImagingSettings(XMLN * p_node, img_GetImagingSettings_RES * p_res); +BOOL parse_img_GetOptions(XMLN * p_node, img_GetOptions_RES * p_res); +BOOL parse_img_GetStatus(XMLN * p_node, img_GetStatus_RES * p_res); +BOOL parse_img_GetMoveOptions(XMLN * p_node, img_GetMoveOptions_RES * p_res); +BOOL parse_img_GetPresets(XMLN * p_node, img_GetPresets_RES * p_res); +BOOL parse_img_GetCurrentPreset(XMLN * p_node, img_GetCurrentPreset_RES * p_res); + +int parse_SimpleItemDescriptions(XMLN * p_node, const char * name, SimpleItemDescriptionList * p_res); +BOOL parse_ItemListDescription(XMLN * p_node, onvif_ItemListDescription * p_res); +BOOL parse_ConfigDescription_Messages(XMLN * p_node, onvif_ConfigDescription_Messages * p_res); +BOOL parse_RuleDescription(XMLN * p_node, onvif_ConfigDescription * p_res); +BOOL parse_ConfigDescription(XMLN * p_node, onvif_ConfigDescription * p_res); +BOOL parse_ConfigOptions(XMLN * p_node, onvif_ConfigOptions * p_res); +BOOL parse_AnalyticsModuleConfigOptions(XMLN * p_node, onvif_AnalyticsModuleConfigOptions * p_res); +BOOL parse_tan_GetServiceCapabilities(XMLN * p_node, tan_GetServiceCapabilities_RES * p_res); +BOOL parse_tan_GetSupportedRules(XMLN * p_node, tan_GetSupportedRules_RES * p_res); +BOOL parse_tan_GetRules(XMLN * p_node, tan_GetRules_RES * p_res); +BOOL parse_tan_GetAnalyticsModules(XMLN * p_node, tan_GetAnalyticsModules_RES * p_res); +BOOL parse_tan_GetSupportedAnalyticsModules(XMLN * p_node, tan_GetSupportedAnalyticsModules_RES * p_res); +BOOL parse_tan_GetRuleOptions(XMLN * p_node, tan_GetRuleOptions_RES * p_res); +BOOL parse_tan_GetAnalyticsModuleOptions(XMLN * p_node, tan_GetAnalyticsModuleOptions_RES * p_res); +BOOL parse_tan_GetSupportedMetadata(XMLN * p_node, tan_GetSupportedMetadata_RES * p_res); + +BOOL parse_VideoEncoder2Configuration(XMLN * p_node, onvif_VideoEncoder2Configuration * p_res); +BOOL parse_VideoEncoder2ConfigurationOptions(XMLN * p_node, onvif_VideoEncoder2ConfigurationOptions * p_res); +BOOL parse_MetadataConfiguration(XMLN * p_node, onvif_MetadataConfiguration * p_res); +BOOL parse_AudioEncoder2Configuration(XMLN * p_node, onvif_AudioEncoder2Configuration * p_res); +BOOL parse_AudioEncoder2ConfigurationOptions(XMLN * p_node, onvif_AudioEncoder2ConfigurationOptions * p_res); +BOOL parse_MediaProfile(XMLN * p_node, onvif_MediaProfile * p_res); +BOOL parse_Polygon(XMLN * p_node, onvif_Polygon * p_res); +BOOL parse_Mask(XMLN * p_node, onvif_Mask * p_res); +BOOL parse_MaskOptions(XMLN * p_node, onvif_MaskOptions * p_res); + +BOOL parse_tr2_GetServiceCapabilities(XMLN * p_node, tr2_GetServiceCapabilities_RES * p_res); +BOOL parse_tr2_GetVideoEncoderConfigurations(XMLN * p_node, tr2_GetVideoEncoderConfigurations_RES * p_res); +BOOL parse_tr2_GetVideoEncoderConfigurationOptions(XMLN * p_node, tr2_GetVideoEncoderConfigurationOptions_RES * p_res); +BOOL parse_tr2_GetProfiles(XMLN * p_node, tr2_GetProfiles_RES * p_res); +BOOL parse_tr2_CreateProfile(XMLN * p_node, tr2_CreateProfile_RES * p_res); +BOOL parse_tr2_GetStreamUri(XMLN * p_node, tr2_GetStreamUri_RES * p_res); +BOOL parse_tr2_GetVideoSourceConfigurations(XMLN * p_node, tr2_GetVideoSourceConfigurations_RES * p_res); +BOOL parse_tr2_GetMetadataConfigurations(XMLN * p_node, tr2_GetMetadataConfigurations_RES * p_res); +BOOL parse_tr2_GetMetadataConfigurationOptions(XMLN * p_node, tr2_GetMetadataConfigurationOptions_RES * p_res); +BOOL parse_tr2_GetAudioEncoderConfigurations(XMLN * p_node, tr2_GetAudioEncoderConfigurations_RES * p_res); +BOOL parse_tr2_GetAudioSourceConfigurations(XMLN * p_node, tr2_GetAudioSourceConfigurations_RES * p_res); +BOOL parse_tr2_GetAudioEncoderConfigurationOptions(XMLN * p_node, tr2_GetAudioEncoderConfigurationOptions_RES * p_res); +BOOL parse_tr2_GetVideoEncoderInstances(XMLN * p_node, tr2_GetVideoEncoderInstances_RES * p_res); +BOOL parse_tr2_GetAudioOutputConfigurations(XMLN * p_node, tr2_GetAudioOutputConfigurations_RES * p_res); +BOOL parse_tr2_GetAudioOutputConfigurationOptions(XMLN * p_node, tr2_GetAudioOutputConfigurationOptions_RES * p_res); +BOOL parse_tr2_GetAudioDecoderConfigurations(XMLN * p_node, tr2_GetAudioDecoderConfigurations_RES * p_res); +BOOL parse_tr2_GetAudioDecoderConfigurationOptions(XMLN * p_node, tr2_GetAudioDecoderConfigurationOptions_RES * p_res); +BOOL parse_tr2_GetSnapshotUri(XMLN * p_node, tr2_GetSnapshotUri_RES * p_res); +BOOL parse_tr2_GetVideoSourceModes(XMLN * p_node, tr2_GetVideoSourceModes_RES * p_res); +BOOL parse_tr2_SetVideoSourceMode(XMLN * p_node, tr2_SetVideoSourceMode_RES * p_res); +BOOL parse_tr2_CreateOSD(XMLN * p_node, tr2_CreateOSD_RES * p_res); +BOOL parse_tr2_GetOSDs(XMLN * p_node, tr2_GetOSDs_RES * p_res); +BOOL parse_tr2_GetOSDOptions(XMLN * p_node, tr2_GetOSDOptions_RES * p_res); +BOOL parse_tr2_GetAnalyticsConfigurations(XMLN * p_node, tr2_GetAnalyticsConfigurations_RES * p_res); +BOOL parse_tr2_GetMasks(XMLN * p_node, tr2_GetMasks_RES * p_res); +BOOL parse_tr2_CreateMask(XMLN * p_node, tr2_CreateMask_RES * p_res); +BOOL parse_tr2_GetMaskOptions(XMLN * p_node, tr2_GetMaskOptions_RES * p_res); + +BOOL parse_DeviceIOServiceCapabilities(XMLN * p_node, onvif_DeviceIOCapabilities * p_res); +BOOL parse_DeviceIOService(XMLN * p_node, onvif_DeviceIOCapabilities * p_res); +BOOL parse_RelayOutput(XMLN * p_node, onvif_RelayOutput * p_res); +BOOL parse_RelayOutputOptions(XMLN * p_node, onvif_RelayOutputOptions * p_res); +BOOL parse_DigitalInput(XMLN * p_node, onvif_DigitalInput * p_res); +BOOL parse_tmd_GetServiceCapabilities(XMLN * p_node, tmd_GetServiceCapabilities_RES * p_res); +BOOL parse_tmd_GetRelayOutputs(XMLN * p_node, tmd_GetRelayOutputs_RES * p_res); +BOOL parse_tmd_GetRelayOutputOptions(XMLN * p_node, tmd_GetRelayOutputOptions_RES * p_res); +BOOL parse_tmd_GetDigitalInputs(XMLN * p_node, tmd_GetDigitalInputs_RES * p_res); +BOOL parse_tmd_GetDigitalInputConfigurationOptions(XMLN * p_node, tmd_GetDigitalInputConfigurationOptions_RES * p_res); + +BOOL parse_RecordingServiceCapabilities(XMLN * p_node, onvif_RecordingCapabilities * p_res); +BOOL parse_RecordingService(XMLN * p_node, onvif_RecordingCapabilities * p_res); +BOOL parse_SearchServiceCapabilities(XMLN * p_node, onvif_SearchCapabilities * p_res); +BOOL parse_SearchService(XMLN * p_node, onvif_SearchCapabilities * p_res); +BOOL parse_ReplayServiceCapabilities(XMLN * p_node, onvif_ReplayCapabilities * p_res); +BOOL parse_ReplayService(XMLN * p_node, onvif_ReplayCapabilities * p_res); +BOOL parse_trc_GetServiceCapabilities(XMLN * p_node, trc_GetServiceCapabilities_RES * p_res); +BOOL parse_trc_CreateRecording(XMLN * p_node, trc_CreateRecording_RES * p_res); +BOOL parse_trc_GetRecordings(XMLN * p_node, trc_GetRecordings_RES * p_res); +BOOL parse_trc_GetRecordingConfiguration(XMLN * p_node, trc_GetRecordingConfiguration_RES * p_res); +BOOL parse_trc_GetRecordingOptions(XMLN * p_node, trc_GetRecordingOptions_RES * p_res); +BOOL parse_trc_CreateTrack(XMLN * p_node, trc_CreateTrack_RES * p_res); +BOOL parse_trc_GetTrackConfiguration(XMLN * p_node, trc_GetTrackConfiguration_RES * p_res); +BOOL parse_trc_CreateRecordingJob(XMLN * p_node, trc_CreateRecordingJob_RES * p_res); +BOOL parse_trc_GetRecordingJobs(XMLN * p_node, trc_GetRecordingJobs_RES * p_res); +BOOL parse_trc_SetRecordingJobConfiguration(XMLN * p_node, trc_SetRecordingJobConfiguration_RES * p_res); +BOOL parse_trc_GetRecordingJobConfiguration(XMLN * p_node, trc_GetRecordingJobConfiguration_RES * p_res); +BOOL parse_trc_GetRecordingJobState(XMLN * p_node, trc_GetRecordingJobState_RES * p_res); +BOOL parse_trc_ExportRecordedData(XMLN * p_node, trc_ExportRecordedData_RES * p_res); +BOOL parse_trc_StopExportRecordedData(XMLN * p_node, trc_StopExportRecordedData_RES * p_res); +BOOL parse_trc_GetExportRecordedDataState(XMLN * p_node, trc_GetExportRecordedDataState_RES * p_res); +BOOL parse_trp_GetServiceCapabilities(XMLN * p_node, trp_GetServiceCapabilities_RES * p_res); +BOOL parse_trp_GetReplayUri(XMLN * p_node, trp_GetReplayUri_RES * p_res); +BOOL parse_trp_GetReplayConfiguration(XMLN * p_node, trp_GetReplayConfiguration_RES * p_res); +BOOL parse_tse_GetServiceCapabilities(XMLN * p_node, tse_GetServiceCapabilities_RES * p_res); +BOOL parse_tse_GetRecordingSummary(XMLN * p_node, tse_GetRecordingSummary_RES * p_res); +BOOL parse_tse_GetRecordingInformation(XMLN * p_node, tse_GetRecordingInformation_RES * p_res); +BOOL parse_tse_GetMediaAttributes(XMLN * p_node, tse_GetMediaAttributes_RES * p_res); +BOOL parse_tse_FindRecordings(XMLN * p_node, tse_FindRecordings_RES * p_res); +BOOL parse_tse_GetRecordingSearchResults(XMLN * p_node, tse_GetRecordingSearchResults_RES * p_res); +BOOL parse_tse_FindEvents(XMLN * p_node, tse_FindEvents_RES * p_res); +BOOL parse_tse_GetEventSearchResults(XMLN * p_node, tse_GetEventSearchResults_RES * p_res); +BOOL parse_tse_FindMetadata(XMLN * p_node, tse_FindMetadata_RES * p_res); +BOOL parse_tse_GetMetadataSearchResults(XMLN * p_node, tse_GetMetadataSearchResults_RES * p_res); +BOOL parse_tse_FindPTZPosition(XMLN * p_node, tse_FindPTZPosition_RES * p_res); +BOOL parse_tse_GetPTZPositionSearchResults(XMLN * p_node, tse_GetPTZPositionSearchResults_RES * p_res); +BOOL parse_tse_GetSearchState(XMLN * p_node, tse_GetSearchState_RES * p_res); +BOOL parse_tse_EndSearch(XMLN * p_node, tse_EndSearch_RES * p_res); + +BOOL parse_AccessControlServiceCapabilities(XMLN * p_node, onvif_AccessControlCapabilities * p_res); +BOOL parse_AccessControlService(XMLN * p_node, onvif_AccessControlCapabilities * p_res); +BOOL parse_DoorControlServiceCapabilities(XMLN * p_node, onvif_DoorControlCapabilities * p_res); +BOOL parse_DoorControlService(XMLN * p_node, onvif_DoorControlCapabilities * p_res); +BOOL parse_tac_GetServiceCapabilities(XMLN * p_node, tac_GetServiceCapabilities_RES * p_res); +BOOL parse_tac_GetAccessPointInfoList(XMLN * p_node, tac_GetAccessPointInfoList_RES * p_res); +BOOL parse_tac_GetAccessPointInfo(XMLN * p_node, tac_GetAccessPointInfo_RES * p_res); +BOOL parse_tac_GetAccessPointList(XMLN * p_node, tac_GetAccessPointList_RES * p_res); +BOOL parse_tac_GetAccessPoints(XMLN * p_node, tac_GetAccessPoints_RES * p_res); +BOOL parse_tac_CreateAccessPoint(XMLN * p_node, tac_CreateAccessPoint_RES * p_res); +BOOL parse_tac_GetAreaInfoList(XMLN * p_node, tac_GetAreaInfoList_RES * p_res); +BOOL parse_tac_GetAreaInfo(XMLN * p_node, tac_GetAreaInfo_RES * p_res); +BOOL parse_tac_GetAreaList(XMLN * p_node, tac_GetAreaList_RES * p_res); +BOOL parse_tac_GetAreas(XMLN * p_node, tac_GetAreas_RES * p_res); +BOOL parse_tac_CreateArea(XMLN * p_node, tac_CreateArea_RES * p_res); +BOOL parse_tac_GetAccessPointState(XMLN * p_node, tac_GetAccessPointState_RES * p_res); +BOOL parse_tdc_GetServiceCapabilities(XMLN * p_node, tdc_GetServiceCapabilities_RES * p_res); +BOOL parse_tdc_GetDoorInfoList(XMLN * p_node, tdc_GetDoorInfoList_RES * p_res); +BOOL parse_tdc_GetDoorInfo(XMLN * p_node, tdc_GetDoorInfo_RES * p_res); +BOOL parse_tdc_GetDoorState(XMLN * p_node, tdc_GetDoorState_RES * p_res); +BOOL parse_tdc_GetDoors(XMLN * p_node, tdc_GetDoors_RES * p_res); +BOOL parse_tdc_GetDoorList(XMLN * p_node, tdc_GetDoorList_RES * p_res); +BOOL parse_tdc_CreateDoor(XMLN * p_node, tdc_CreateDoor_RES * p_res); + +BOOL parse_ThermalServiceCapabilities(XMLN * p_node, onvif_ThermalCapabilities * p_res); +BOOL parse_ThermalService(XMLN * p_node, onvif_ThermalCapabilities * p_res); +BOOL parse_tth_GetServiceCapabilities(XMLN * p_node, tth_GetServiceCapabilities_RES * p_res); +BOOL parse_tth_GetConfigurations(XMLN * p_node, tth_GetConfigurations_RES * p_req); +BOOL parse_tth_GetConfiguration(XMLN * p_node, tth_GetConfiguration_RES * p_req); +BOOL parse_tth_GetConfigurationOptions(XMLN * p_node, tth_GetConfigurationOptions_RES * p_req); +BOOL parse_tth_GetRadiometryConfiguration(XMLN * p_node, tth_GetRadiometryConfiguration_RES * p_req); +BOOL parse_tth_GetRadiometryConfigurationOptions(XMLN * p_node, tth_GetRadiometryConfigurationOptions_RES * p_req); + +BOOL parse_CredentialServiceCapabilities(XMLN * p_node, onvif_CredentialCapabilities * p_res); +BOOL parse_CredentialService(XMLN * p_node, onvif_CredentialCapabilities * p_res); +BOOL parse_tcr_GetServiceCapabilities(XMLN * p_node, tcr_GetServiceCapabilities_RES * p_res); +BOOL parse_tcr_GetCredentialInfo(XMLN * p_node, tcr_GetCredentialInfo_RES * p_res); +BOOL parse_tcr_GetCredentialInfoList(XMLN * p_node, tcr_GetCredentialInfoList_RES * p_res); +BOOL parse_tcr_GetCredentials(XMLN * p_node, tcr_GetCredentials_RES * p_res); +BOOL parse_tcr_GetCredentialList(XMLN * p_node, tcr_GetCredentialList_RES * p_res); +BOOL parse_tcr_CreateCredential(XMLN * p_node, tcr_CreateCredential_RES * p_res); +BOOL parse_tcr_GetCredentialState(XMLN * p_node, tcr_GetCredentialState_RES * p_res); +BOOL parse_tcr_GetSupportedFormatTypes(XMLN * p_node, tcr_GetSupportedFormatTypes_RES * p_res); +BOOL parse_tcr_GetCredentialIdentifiers(XMLN * p_node, tcr_GetCredentialIdentifiers_RES * p_res); +BOOL parse_tcr_GetCredentialAccessProfiles(XMLN * p_node, tcr_GetCredentialAccessProfiles_RES * p_res); + +BOOL parse_AccessRulesServiceCapabilities(XMLN * p_node, onvif_AccessRulesCapabilities * p_res); +BOOL parse_AccessRulesService(XMLN * p_node, onvif_AccessRulesCapabilities * p_res); +BOOL parse_tar_GetServiceCapabilities(XMLN * p_node, tar_GetServiceCapabilities_RES * p_res); +BOOL parse_tar_GetAccessProfileInfo(XMLN * p_node, tar_GetAccessProfileInfo_RES * p_res); +BOOL parse_tar_GetAccessProfileInfoList(XMLN * p_node, tar_GetAccessProfileInfoList_RES * p_res); +BOOL parse_tar_GetAccessProfiles(XMLN * p_node, tar_GetAccessProfiles_RES * p_res); +BOOL parse_tar_GetAccessProfileList(XMLN * p_node, tar_GetAccessProfileList_RES * p_res); +BOOL parse_tar_CreateAccessProfile(XMLN * p_node, tar_CreateAccessProfile_RES * p_res); + +BOOL parse_ScheduleServiceCapabilities(XMLN * p_node, onvif_ScheduleCapabilities * p_res); +BOOL parse_ScheduleService(XMLN * p_node, onvif_ScheduleCapabilities * p_res); +BOOL parse_tsc_GetServiceCapabilities(XMLN * p_node, tsc_GetServiceCapabilities_RES * p_res); +BOOL parse_tsc_GetScheduleInfo(XMLN * p_node, tsc_GetScheduleInfo_RES * p_res); +BOOL parse_tsc_GetScheduleInfoList(XMLN * p_node, tsc_GetScheduleInfoList_RES * p_res); +BOOL parse_tsc_GetSchedules(XMLN * p_node, tsc_GetSchedules_RES * p_res); +BOOL parse_tsc_GetScheduleList(XMLN * p_node, tsc_GetScheduleList_RES * p_res); +BOOL parse_tsc_CreateSchedule(XMLN * p_node, tsc_CreateSchedule_RES * p_res); +BOOL parse_tsc_GetSpecialDayGroupInfo(XMLN * p_node, tsc_GetSpecialDayGroupInfo_RES * p_res); +BOOL parse_tsc_GetSpecialDayGroupInfoList(XMLN * p_node, tsc_GetSpecialDayGroupInfoList_RES * p_res); +BOOL parse_tsc_GetSpecialDayGroups(XMLN * p_node, tsc_GetSpecialDayGroups_RES * p_res); +BOOL parse_tsc_GetSpecialDayGroupList(XMLN * p_node, tsc_GetSpecialDayGroupList_RES * p_res); +BOOL parse_tsc_CreateSpecialDayGroup(XMLN * p_node, tsc_CreateSpecialDayGroup_RES * p_res); +BOOL parse_tsc_GetScheduleState(XMLN * p_node, tsc_GetScheduleState_RES * p_res); + +BOOL parse_ReceiverServiceCapabilities(XMLN * p_node, onvif_ReceiverCapabilities * p_res); +BOOL parse_ReceiverService(XMLN * p_node, onvif_ReceiverCapabilities * p_res); +BOOL parse_trv_GetServiceCapabilities(XMLN * p_node, trv_GetServiceCapabilities_RES * p_res); +BOOL parse_trv_GetReceivers(XMLN * p_node, trv_GetReceivers_RES * p_res); +BOOL parse_trv_GetReceiver(XMLN * p_node, trv_GetReceiver_RES * p_res); +BOOL parse_trv_CreateReceiver(XMLN * p_node, trv_CreateReceiver_RES * p_res); +BOOL parse_trv_GetReceiverState(XMLN * p_node, trv_GetReceiverState_RES * p_res); + +BOOL parse_ProvisioningServiceCapabilities(XMLN * p_node, onvif_ProvisioningCapabilities * p_res); +BOOL parse_ProvisioningService(XMLN * p_node, onvif_ProvisioningCapabilities * p_res); +BOOL parse_tpv_GetServiceCapabilities(XMLN * p_node, tpv_GetServiceCapabilities_RES * p_res); +BOOL parse_tpv_GetUsage(XMLN * p_node, tpv_GetUsage_RES * p_res); + + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/aes.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/aes.h new file mode 100644 index 0000000..245c552 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/aes.h @@ -0,0 +1,92 @@ +/* + * Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_AES_H +# define HEADER_AES_H + +# include + +# include +# ifdef __cplusplus +extern "C" { +# endif + +# define AES_ENCRYPT 1 +# define AES_DECRYPT 0 + +/* + * Because array size can't be a const in C, the following two are macros. + * Both sizes are in bytes. + */ +# define AES_MAXNR 14 +# define AES_BLOCK_SIZE 16 + +/* This should be a hidden type, but EVP requires that the size be known */ +struct aes_key_st { +# ifdef AES_LONG + unsigned long rd_key[4 * (AES_MAXNR + 1)]; +# else + unsigned int rd_key[4 * (AES_MAXNR + 1)]; +# endif + int rounds; +}; +typedef struct aes_key_st AES_KEY; + +const char *AES_options(void); + +int AES_set_encrypt_key(const unsigned char *userKey, const int bits, + AES_KEY *key); +int AES_set_decrypt_key(const unsigned char *userKey, const int bits, + AES_KEY *key); + +void AES_encrypt(const unsigned char *in, unsigned char *out, + const AES_KEY *key); +void AES_decrypt(const unsigned char *in, unsigned char *out, + const AES_KEY *key); + +void AES_ecb_encrypt(const unsigned char *in, unsigned char *out, + const AES_KEY *key, const int enc); +void AES_cbc_encrypt(const unsigned char *in, unsigned char *out, + size_t length, const AES_KEY *key, + unsigned char *ivec, const int enc); +void AES_cfb128_encrypt(const unsigned char *in, unsigned char *out, + size_t length, const AES_KEY *key, + unsigned char *ivec, int *num, const int enc); +void AES_cfb1_encrypt(const unsigned char *in, unsigned char *out, + size_t length, const AES_KEY *key, + unsigned char *ivec, int *num, const int enc); +void AES_cfb8_encrypt(const unsigned char *in, unsigned char *out, + size_t length, const AES_KEY *key, + unsigned char *ivec, int *num, const int enc); +void AES_ofb128_encrypt(const unsigned char *in, unsigned char *out, + size_t length, const AES_KEY *key, + unsigned char *ivec, int *num); +/* NB: the IV is _two_ blocks long */ +void AES_ige_encrypt(const unsigned char *in, unsigned char *out, + size_t length, const AES_KEY *key, + unsigned char *ivec, const int enc); +/* NB: the IV is _four_ blocks long */ +void AES_bi_ige_encrypt(const unsigned char *in, unsigned char *out, + size_t length, const AES_KEY *key, + const AES_KEY *key2, const unsigned char *ivec, + const int enc); + +int AES_wrap_key(AES_KEY *key, const unsigned char *iv, + unsigned char *out, + const unsigned char *in, unsigned int inlen); +int AES_unwrap_key(AES_KEY *key, const unsigned char *iv, + unsigned char *out, + const unsigned char *in, unsigned int inlen); + + +# ifdef __cplusplus +} +# endif + +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/asn1.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/asn1.h new file mode 100644 index 0000000..9522eec --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/asn1.h @@ -0,0 +1,886 @@ +/* + * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_ASN1_H +# define HEADER_ASN1_H + +# include +# include +# include +# include +# include +# include +# include + +# include +# if OPENSSL_API_COMPAT < 0x10100000L +# include +# endif + +# ifdef OPENSSL_BUILD_SHLIBCRYPTO +# undef OPENSSL_EXTERN +# define OPENSSL_EXTERN OPENSSL_EXPORT +# endif + +#ifdef __cplusplus +extern "C" { +#endif + +# define V_ASN1_UNIVERSAL 0x00 +# define V_ASN1_APPLICATION 0x40 +# define V_ASN1_CONTEXT_SPECIFIC 0x80 +# define V_ASN1_PRIVATE 0xc0 + +# define V_ASN1_CONSTRUCTED 0x20 +# define V_ASN1_PRIMITIVE_TAG 0x1f +# define V_ASN1_PRIMATIVE_TAG /*compat*/ V_ASN1_PRIMITIVE_TAG + +# define V_ASN1_APP_CHOOSE -2/* let the recipient choose */ +# define V_ASN1_OTHER -3/* used in ASN1_TYPE */ +# define V_ASN1_ANY -4/* used in ASN1 template code */ + +# define V_ASN1_UNDEF -1 +/* ASN.1 tag values */ +# define V_ASN1_EOC 0 +# define V_ASN1_BOOLEAN 1 /**/ +# define V_ASN1_INTEGER 2 +# define V_ASN1_BIT_STRING 3 +# define V_ASN1_OCTET_STRING 4 +# define V_ASN1_NULL 5 +# define V_ASN1_OBJECT 6 +# define V_ASN1_OBJECT_DESCRIPTOR 7 +# define V_ASN1_EXTERNAL 8 +# define V_ASN1_REAL 9 +# define V_ASN1_ENUMERATED 10 +# define V_ASN1_UTF8STRING 12 +# define V_ASN1_SEQUENCE 16 +# define V_ASN1_SET 17 +# define V_ASN1_NUMERICSTRING 18 /**/ +# define V_ASN1_PRINTABLESTRING 19 +# define V_ASN1_T61STRING 20 +# define V_ASN1_TELETEXSTRING 20/* alias */ +# define V_ASN1_VIDEOTEXSTRING 21 /**/ +# define V_ASN1_IA5STRING 22 +# define V_ASN1_UTCTIME 23 +# define V_ASN1_GENERALIZEDTIME 24 /**/ +# define V_ASN1_GRAPHICSTRING 25 /**/ +# define V_ASN1_ISO64STRING 26 /**/ +# define V_ASN1_VISIBLESTRING 26/* alias */ +# define V_ASN1_GENERALSTRING 27 /**/ +# define V_ASN1_UNIVERSALSTRING 28 /**/ +# define V_ASN1_BMPSTRING 30 + +/* + * NB the constants below are used internally by ASN1_INTEGER + * and ASN1_ENUMERATED to indicate the sign. They are *not* on + * the wire tag values. + */ + +# define V_ASN1_NEG 0x100 +# define V_ASN1_NEG_INTEGER (2 | V_ASN1_NEG) +# define V_ASN1_NEG_ENUMERATED (10 | V_ASN1_NEG) + +/* For use with d2i_ASN1_type_bytes() */ +# define B_ASN1_NUMERICSTRING 0x0001 +# define B_ASN1_PRINTABLESTRING 0x0002 +# define B_ASN1_T61STRING 0x0004 +# define B_ASN1_TELETEXSTRING 0x0004 +# define B_ASN1_VIDEOTEXSTRING 0x0008 +# define B_ASN1_IA5STRING 0x0010 +# define B_ASN1_GRAPHICSTRING 0x0020 +# define B_ASN1_ISO64STRING 0x0040 +# define B_ASN1_VISIBLESTRING 0x0040 +# define B_ASN1_GENERALSTRING 0x0080 +# define B_ASN1_UNIVERSALSTRING 0x0100 +# define B_ASN1_OCTET_STRING 0x0200 +# define B_ASN1_BIT_STRING 0x0400 +# define B_ASN1_BMPSTRING 0x0800 +# define B_ASN1_UNKNOWN 0x1000 +# define B_ASN1_UTF8STRING 0x2000 +# define B_ASN1_UTCTIME 0x4000 +# define B_ASN1_GENERALIZEDTIME 0x8000 +# define B_ASN1_SEQUENCE 0x10000 +/* For use with ASN1_mbstring_copy() */ +# define MBSTRING_FLAG 0x1000 +# define MBSTRING_UTF8 (MBSTRING_FLAG) +# define MBSTRING_ASC (MBSTRING_FLAG|1) +# define MBSTRING_BMP (MBSTRING_FLAG|2) +# define MBSTRING_UNIV (MBSTRING_FLAG|4) +# define SMIME_OLDMIME 0x400 +# define SMIME_CRLFEOL 0x800 +# define SMIME_STREAM 0x1000 + struct X509_algor_st; +DEFINE_STACK_OF(X509_ALGOR) + +# define ASN1_STRING_FLAG_BITS_LEFT 0x08/* Set if 0x07 has bits left value */ +/* + * This indicates that the ASN1_STRING is not a real value but just a place + * holder for the location where indefinite length constructed data should be + * inserted in the memory buffer + */ +# define ASN1_STRING_FLAG_NDEF 0x010 + +/* + * This flag is used by the CMS code to indicate that a string is not + * complete and is a place holder for content when it had all been accessed. + * The flag will be reset when content has been written to it. + */ + +# define ASN1_STRING_FLAG_CONT 0x020 +/* + * This flag is used by ASN1 code to indicate an ASN1_STRING is an MSTRING + * type. + */ +# define ASN1_STRING_FLAG_MSTRING 0x040 +/* String is embedded and only content should be freed */ +# define ASN1_STRING_FLAG_EMBED 0x080 +/* String should be parsed in RFC 5280's time format */ +# define ASN1_STRING_FLAG_X509_TIME 0x100 +/* This is the base type that holds just about everything :-) */ +struct asn1_string_st { + int length; + int type; + unsigned char *data; + /* + * The value of the following field depends on the type being held. It + * is mostly being used for BIT_STRING so if the input data has a + * non-zero 'unused bits' value, it will be handled correctly + */ + long flags; +}; + +/* + * ASN1_ENCODING structure: this is used to save the received encoding of an + * ASN1 type. This is useful to get round problems with invalid encodings + * which can break signatures. + */ + +typedef struct ASN1_ENCODING_st { + unsigned char *enc; /* DER encoding */ + long len; /* Length of encoding */ + int modified; /* set to 1 if 'enc' is invalid */ +} ASN1_ENCODING; + +/* Used with ASN1 LONG type: if a long is set to this it is omitted */ +# define ASN1_LONG_UNDEF 0x7fffffffL + +# define STABLE_FLAGS_MALLOC 0x01 +/* + * A zero passed to ASN1_STRING_TABLE_new_add for the flags is interpreted + * as "don't change" and STABLE_FLAGS_MALLOC is always set. By setting + * STABLE_FLAGS_MALLOC only we can clear the existing value. Use the alias + * STABLE_FLAGS_CLEAR to reflect this. + */ +# define STABLE_FLAGS_CLEAR STABLE_FLAGS_MALLOC +# define STABLE_NO_MASK 0x02 +# define DIRSTRING_TYPE \ + (B_ASN1_PRINTABLESTRING|B_ASN1_T61STRING|B_ASN1_BMPSTRING|B_ASN1_UTF8STRING) +# define PKCS9STRING_TYPE (DIRSTRING_TYPE|B_ASN1_IA5STRING) + +typedef struct asn1_string_table_st { + int nid; + long minsize; + long maxsize; + unsigned long mask; + unsigned long flags; +} ASN1_STRING_TABLE; + +DEFINE_STACK_OF(ASN1_STRING_TABLE) + +/* size limits: this stuff is taken straight from RFC2459 */ + +# define ub_name 32768 +# define ub_common_name 64 +# define ub_locality_name 128 +# define ub_state_name 128 +# define ub_organization_name 64 +# define ub_organization_unit_name 64 +# define ub_title 64 +# define ub_email_address 128 + +/* + * Declarations for template structures: for full definitions see asn1t.h + */ +typedef struct ASN1_TEMPLATE_st ASN1_TEMPLATE; +typedef struct ASN1_TLC_st ASN1_TLC; +/* This is just an opaque pointer */ +typedef struct ASN1_VALUE_st ASN1_VALUE; + +/* Declare ASN1 functions: the implement macro in in asn1t.h */ + +# define DECLARE_ASN1_FUNCTIONS(type) DECLARE_ASN1_FUNCTIONS_name(type, type) + +# define DECLARE_ASN1_ALLOC_FUNCTIONS(type) \ + DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, type) + +# define DECLARE_ASN1_FUNCTIONS_name(type, name) \ + DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \ + DECLARE_ASN1_ENCODE_FUNCTIONS(type, name, name) + +# define DECLARE_ASN1_FUNCTIONS_fname(type, itname, name) \ + DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \ + DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) + +# define DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) \ + type *d2i_##name(type **a, const unsigned char **in, long len); \ + int i2d_##name(type *a, unsigned char **out); \ + DECLARE_ASN1_ITEM(itname) + +# define DECLARE_ASN1_ENCODE_FUNCTIONS_const(type, name) \ + type *d2i_##name(type **a, const unsigned char **in, long len); \ + int i2d_##name(const type *a, unsigned char **out); \ + DECLARE_ASN1_ITEM(name) + +# define DECLARE_ASN1_NDEF_FUNCTION(name) \ + int i2d_##name##_NDEF(name *a, unsigned char **out); + +# define DECLARE_ASN1_FUNCTIONS_const(name) \ + DECLARE_ASN1_ALLOC_FUNCTIONS(name) \ + DECLARE_ASN1_ENCODE_FUNCTIONS_const(name, name) + +# define DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \ + type *name##_new(void); \ + void name##_free(type *a); + +# define DECLARE_ASN1_PRINT_FUNCTION(stname) \ + DECLARE_ASN1_PRINT_FUNCTION_fname(stname, stname) + +# define DECLARE_ASN1_PRINT_FUNCTION_fname(stname, fname) \ + int fname##_print_ctx(BIO *out, stname *x, int indent, \ + const ASN1_PCTX *pctx); + +# define D2I_OF(type) type *(*)(type **,const unsigned char **,long) +# define I2D_OF(type) int (*)(type *,unsigned char **) +# define I2D_OF_const(type) int (*)(const type *,unsigned char **) + +# define CHECKED_D2I_OF(type, d2i) \ + ((d2i_of_void*) (1 ? d2i : ((D2I_OF(type))0))) +# define CHECKED_I2D_OF(type, i2d) \ + ((i2d_of_void*) (1 ? i2d : ((I2D_OF(type))0))) +# define CHECKED_NEW_OF(type, xnew) \ + ((void *(*)(void)) (1 ? xnew : ((type *(*)(void))0))) +# define CHECKED_PTR_OF(type, p) \ + ((void*) (1 ? p : (type*)0)) +# define CHECKED_PPTR_OF(type, p) \ + ((void**) (1 ? p : (type**)0)) + +# define TYPEDEF_D2I_OF(type) typedef type *d2i_of_##type(type **,const unsigned char **,long) +# define TYPEDEF_I2D_OF(type) typedef int i2d_of_##type(type *,unsigned char **) +# define TYPEDEF_D2I2D_OF(type) TYPEDEF_D2I_OF(type); TYPEDEF_I2D_OF(type) + +TYPEDEF_D2I2D_OF(void); + +/*- + * The following macros and typedefs allow an ASN1_ITEM + * to be embedded in a structure and referenced. Since + * the ASN1_ITEM pointers need to be globally accessible + * (possibly from shared libraries) they may exist in + * different forms. On platforms that support it the + * ASN1_ITEM structure itself will be globally exported. + * Other platforms will export a function that returns + * an ASN1_ITEM pointer. + * + * To handle both cases transparently the macros below + * should be used instead of hard coding an ASN1_ITEM + * pointer in a structure. + * + * The structure will look like this: + * + * typedef struct SOMETHING_st { + * ... + * ASN1_ITEM_EXP *iptr; + * ... + * } SOMETHING; + * + * It would be initialised as e.g.: + * + * SOMETHING somevar = {...,ASN1_ITEM_ref(X509),...}; + * + * and the actual pointer extracted with: + * + * const ASN1_ITEM *it = ASN1_ITEM_ptr(somevar.iptr); + * + * Finally an ASN1_ITEM pointer can be extracted from an + * appropriate reference with: ASN1_ITEM_rptr(X509). This + * would be used when a function takes an ASN1_ITEM * argument. + * + */ + +# ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION + +/* ASN1_ITEM pointer exported type */ +typedef const ASN1_ITEM ASN1_ITEM_EXP; + +/* Macro to obtain ASN1_ITEM pointer from exported type */ +# define ASN1_ITEM_ptr(iptr) (iptr) + +/* Macro to include ASN1_ITEM pointer from base type */ +# define ASN1_ITEM_ref(iptr) (&(iptr##_it)) + +# define ASN1_ITEM_rptr(ref) (&(ref##_it)) + +# define DECLARE_ASN1_ITEM(name) \ + OPENSSL_EXTERN const ASN1_ITEM name##_it; + +# else + +/* + * Platforms that can't easily handle shared global variables are declared as + * functions returning ASN1_ITEM pointers. + */ + +/* ASN1_ITEM pointer exported type */ +typedef const ASN1_ITEM *ASN1_ITEM_EXP (void); + +/* Macro to obtain ASN1_ITEM pointer from exported type */ +# define ASN1_ITEM_ptr(iptr) (iptr()) + +/* Macro to include ASN1_ITEM pointer from base type */ +# define ASN1_ITEM_ref(iptr) (iptr##_it) + +# define ASN1_ITEM_rptr(ref) (ref##_it()) + +# define DECLARE_ASN1_ITEM(name) \ + const ASN1_ITEM * name##_it(void); + +# endif + +/* Parameters used by ASN1_STRING_print_ex() */ + +/* + * These determine which characters to escape: RFC2253 special characters, + * control characters and MSB set characters + */ + +# define ASN1_STRFLGS_ESC_2253 1 +# define ASN1_STRFLGS_ESC_CTRL 2 +# define ASN1_STRFLGS_ESC_MSB 4 + +/* + * This flag determines how we do escaping: normally RC2253 backslash only, + * set this to use backslash and quote. + */ + +# define ASN1_STRFLGS_ESC_QUOTE 8 + +/* These three flags are internal use only. */ + +/* Character is a valid PrintableString character */ +# define CHARTYPE_PRINTABLESTRING 0x10 +/* Character needs escaping if it is the first character */ +# define CHARTYPE_FIRST_ESC_2253 0x20 +/* Character needs escaping if it is the last character */ +# define CHARTYPE_LAST_ESC_2253 0x40 + +/* + * NB the internal flags are safely reused below by flags handled at the top + * level. + */ + +/* + * If this is set we convert all character strings to UTF8 first + */ + +# define ASN1_STRFLGS_UTF8_CONVERT 0x10 + +/* + * If this is set we don't attempt to interpret content: just assume all + * strings are 1 byte per character. This will produce some pretty odd + * looking output! + */ + +# define ASN1_STRFLGS_IGNORE_TYPE 0x20 + +/* If this is set we include the string type in the output */ +# define ASN1_STRFLGS_SHOW_TYPE 0x40 + +/* + * This determines which strings to display and which to 'dump' (hex dump of + * content octets or DER encoding). We can only dump non character strings or + * everything. If we don't dump 'unknown' they are interpreted as character + * strings with 1 octet per character and are subject to the usual escaping + * options. + */ + +# define ASN1_STRFLGS_DUMP_ALL 0x80 +# define ASN1_STRFLGS_DUMP_UNKNOWN 0x100 + +/* + * These determine what 'dumping' does, we can dump the content octets or the + * DER encoding: both use the RFC2253 #XXXXX notation. + */ + +# define ASN1_STRFLGS_DUMP_DER 0x200 + +/* + * This flag specifies that RC2254 escaping shall be performed. + */ +#define ASN1_STRFLGS_ESC_2254 0x400 + +/* + * All the string flags consistent with RFC2253, escaping control characters + * isn't essential in RFC2253 but it is advisable anyway. + */ + +# define ASN1_STRFLGS_RFC2253 (ASN1_STRFLGS_ESC_2253 | \ + ASN1_STRFLGS_ESC_CTRL | \ + ASN1_STRFLGS_ESC_MSB | \ + ASN1_STRFLGS_UTF8_CONVERT | \ + ASN1_STRFLGS_DUMP_UNKNOWN | \ + ASN1_STRFLGS_DUMP_DER) + +DEFINE_STACK_OF(ASN1_INTEGER) + +DEFINE_STACK_OF(ASN1_GENERALSTRING) + +DEFINE_STACK_OF(ASN1_UTF8STRING) + +typedef struct asn1_type_st { + int type; + union { + char *ptr; + ASN1_BOOLEAN boolean; + ASN1_STRING *asn1_string; + ASN1_OBJECT *object; + ASN1_INTEGER *integer; + ASN1_ENUMERATED *enumerated; + ASN1_BIT_STRING *bit_string; + ASN1_OCTET_STRING *octet_string; + ASN1_PRINTABLESTRING *printablestring; + ASN1_T61STRING *t61string; + ASN1_IA5STRING *ia5string; + ASN1_GENERALSTRING *generalstring; + ASN1_BMPSTRING *bmpstring; + ASN1_UNIVERSALSTRING *universalstring; + ASN1_UTCTIME *utctime; + ASN1_GENERALIZEDTIME *generalizedtime; + ASN1_VISIBLESTRING *visiblestring; + ASN1_UTF8STRING *utf8string; + /* + * set and sequence are left complete and still contain the set or + * sequence bytes + */ + ASN1_STRING *set; + ASN1_STRING *sequence; + ASN1_VALUE *asn1_value; + } value; +} ASN1_TYPE; + +DEFINE_STACK_OF(ASN1_TYPE) + +typedef STACK_OF(ASN1_TYPE) ASN1_SEQUENCE_ANY; + +DECLARE_ASN1_ENCODE_FUNCTIONS_const(ASN1_SEQUENCE_ANY, ASN1_SEQUENCE_ANY) +DECLARE_ASN1_ENCODE_FUNCTIONS_const(ASN1_SEQUENCE_ANY, ASN1_SET_ANY) + +/* This is used to contain a list of bit names */ +typedef struct BIT_STRING_BITNAME_st { + int bitnum; + const char *lname; + const char *sname; +} BIT_STRING_BITNAME; + +# define B_ASN1_TIME \ + B_ASN1_UTCTIME | \ + B_ASN1_GENERALIZEDTIME + +# define B_ASN1_PRINTABLE \ + B_ASN1_NUMERICSTRING| \ + B_ASN1_PRINTABLESTRING| \ + B_ASN1_T61STRING| \ + B_ASN1_IA5STRING| \ + B_ASN1_BIT_STRING| \ + B_ASN1_UNIVERSALSTRING|\ + B_ASN1_BMPSTRING|\ + B_ASN1_UTF8STRING|\ + B_ASN1_SEQUENCE|\ + B_ASN1_UNKNOWN + +# define B_ASN1_DIRECTORYSTRING \ + B_ASN1_PRINTABLESTRING| \ + B_ASN1_TELETEXSTRING|\ + B_ASN1_BMPSTRING|\ + B_ASN1_UNIVERSALSTRING|\ + B_ASN1_UTF8STRING + +# define B_ASN1_DISPLAYTEXT \ + B_ASN1_IA5STRING| \ + B_ASN1_VISIBLESTRING| \ + B_ASN1_BMPSTRING|\ + B_ASN1_UTF8STRING + +DECLARE_ASN1_FUNCTIONS_fname(ASN1_TYPE, ASN1_ANY, ASN1_TYPE) + +int ASN1_TYPE_get(const ASN1_TYPE *a); +void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value); +int ASN1_TYPE_set1(ASN1_TYPE *a, int type, const void *value); +int ASN1_TYPE_cmp(const ASN1_TYPE *a, const ASN1_TYPE *b); + +ASN1_TYPE *ASN1_TYPE_pack_sequence(const ASN1_ITEM *it, void *s, ASN1_TYPE **t); +void *ASN1_TYPE_unpack_sequence(const ASN1_ITEM *it, const ASN1_TYPE *t); + +ASN1_OBJECT *ASN1_OBJECT_new(void); +void ASN1_OBJECT_free(ASN1_OBJECT *a); +int i2d_ASN1_OBJECT(const ASN1_OBJECT *a, unsigned char **pp); +ASN1_OBJECT *d2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp, + long length); + +DECLARE_ASN1_ITEM(ASN1_OBJECT) + +DEFINE_STACK_OF(ASN1_OBJECT) + +ASN1_STRING *ASN1_STRING_new(void); +void ASN1_STRING_free(ASN1_STRING *a); +void ASN1_STRING_clear_free(ASN1_STRING *a); +int ASN1_STRING_copy(ASN1_STRING *dst, const ASN1_STRING *str); +ASN1_STRING *ASN1_STRING_dup(const ASN1_STRING *a); +ASN1_STRING *ASN1_STRING_type_new(int type); +int ASN1_STRING_cmp(const ASN1_STRING *a, const ASN1_STRING *b); + /* + * Since this is used to store all sorts of things, via macros, for now, + * make its data void * + */ +int ASN1_STRING_set(ASN1_STRING *str, const void *data, int len); +void ASN1_STRING_set0(ASN1_STRING *str, void *data, int len); +int ASN1_STRING_length(const ASN1_STRING *x); +void ASN1_STRING_length_set(ASN1_STRING *x, int n); +int ASN1_STRING_type(const ASN1_STRING *x); +DEPRECATEDIN_1_1_0(unsigned char *ASN1_STRING_data(ASN1_STRING *x)) +const unsigned char *ASN1_STRING_get0_data(const ASN1_STRING *x); + +DECLARE_ASN1_FUNCTIONS(ASN1_BIT_STRING) +int ASN1_BIT_STRING_set(ASN1_BIT_STRING *a, unsigned char *d, int length); +int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value); +int ASN1_BIT_STRING_get_bit(const ASN1_BIT_STRING *a, int n); +int ASN1_BIT_STRING_check(const ASN1_BIT_STRING *a, + const unsigned char *flags, int flags_len); + +int ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs, + BIT_STRING_BITNAME *tbl, int indent); +int ASN1_BIT_STRING_num_asc(const char *name, BIT_STRING_BITNAME *tbl); +int ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, const char *name, int value, + BIT_STRING_BITNAME *tbl); + +DECLARE_ASN1_FUNCTIONS(ASN1_INTEGER) +ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a, const unsigned char **pp, + long length); +ASN1_INTEGER *ASN1_INTEGER_dup(const ASN1_INTEGER *x); +int ASN1_INTEGER_cmp(const ASN1_INTEGER *x, const ASN1_INTEGER *y); + +DECLARE_ASN1_FUNCTIONS(ASN1_ENUMERATED) + +int ASN1_UTCTIME_check(const ASN1_UTCTIME *a); +ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t); +ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t, + int offset_day, long offset_sec); +int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, const char *str); +int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t); + +int ASN1_GENERALIZEDTIME_check(const ASN1_GENERALIZEDTIME *a); +ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s, + time_t t); +ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s, + time_t t, int offset_day, + long offset_sec); +int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str); + +int ASN1_TIME_diff(int *pday, int *psec, + const ASN1_TIME *from, const ASN1_TIME *to); + +DECLARE_ASN1_FUNCTIONS(ASN1_OCTET_STRING) +ASN1_OCTET_STRING *ASN1_OCTET_STRING_dup(const ASN1_OCTET_STRING *a); +int ASN1_OCTET_STRING_cmp(const ASN1_OCTET_STRING *a, + const ASN1_OCTET_STRING *b); +int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *str, const unsigned char *data, + int len); + +DECLARE_ASN1_FUNCTIONS(ASN1_VISIBLESTRING) +DECLARE_ASN1_FUNCTIONS(ASN1_UNIVERSALSTRING) +DECLARE_ASN1_FUNCTIONS(ASN1_UTF8STRING) +DECLARE_ASN1_FUNCTIONS(ASN1_NULL) +DECLARE_ASN1_FUNCTIONS(ASN1_BMPSTRING) + +int UTF8_getc(const unsigned char *str, int len, unsigned long *val); +int UTF8_putc(unsigned char *str, int len, unsigned long value); + +DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, ASN1_PRINTABLE) + +DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, DIRECTORYSTRING) +DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, DISPLAYTEXT) +DECLARE_ASN1_FUNCTIONS(ASN1_PRINTABLESTRING) +DECLARE_ASN1_FUNCTIONS(ASN1_T61STRING) +DECLARE_ASN1_FUNCTIONS(ASN1_IA5STRING) +DECLARE_ASN1_FUNCTIONS(ASN1_GENERALSTRING) +DECLARE_ASN1_FUNCTIONS(ASN1_UTCTIME) +DECLARE_ASN1_FUNCTIONS(ASN1_GENERALIZEDTIME) +DECLARE_ASN1_FUNCTIONS(ASN1_TIME) + +DECLARE_ASN1_ITEM(ASN1_OCTET_STRING_NDEF) + +ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s, time_t t); +ASN1_TIME *ASN1_TIME_adj(ASN1_TIME *s, time_t t, + int offset_day, long offset_sec); +int ASN1_TIME_check(const ASN1_TIME *t); +ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(const ASN1_TIME *t, + ASN1_GENERALIZEDTIME **out); +int ASN1_TIME_set_string(ASN1_TIME *s, const char *str); +int ASN1_TIME_set_string_X509(ASN1_TIME *s, const char *str); +int ASN1_TIME_to_tm(const ASN1_TIME *s, struct tm *tm); +int ASN1_TIME_normalize(ASN1_TIME *s); +int ASN1_TIME_cmp_time_t(const ASN1_TIME *s, time_t t); +int ASN1_TIME_compare(const ASN1_TIME *a, const ASN1_TIME *b); + +int i2a_ASN1_INTEGER(BIO *bp, const ASN1_INTEGER *a); +int a2i_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *bs, char *buf, int size); +int i2a_ASN1_ENUMERATED(BIO *bp, const ASN1_ENUMERATED *a); +int a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size); +int i2a_ASN1_OBJECT(BIO *bp, const ASN1_OBJECT *a); +int a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size); +int i2a_ASN1_STRING(BIO *bp, const ASN1_STRING *a, int type); +int i2t_ASN1_OBJECT(char *buf, int buf_len, const ASN1_OBJECT *a); + +int a2d_ASN1_OBJECT(unsigned char *out, int olen, const char *buf, int num); +ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data, int len, + const char *sn, const char *ln); + +int ASN1_INTEGER_get_int64(int64_t *pr, const ASN1_INTEGER *a); +int ASN1_INTEGER_set_int64(ASN1_INTEGER *a, int64_t r); +int ASN1_INTEGER_get_uint64(uint64_t *pr, const ASN1_INTEGER *a); +int ASN1_INTEGER_set_uint64(ASN1_INTEGER *a, uint64_t r); + +int ASN1_INTEGER_set(ASN1_INTEGER *a, long v); +long ASN1_INTEGER_get(const ASN1_INTEGER *a); +ASN1_INTEGER *BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai); +BIGNUM *ASN1_INTEGER_to_BN(const ASN1_INTEGER *ai, BIGNUM *bn); + +int ASN1_ENUMERATED_get_int64(int64_t *pr, const ASN1_ENUMERATED *a); +int ASN1_ENUMERATED_set_int64(ASN1_ENUMERATED *a, int64_t r); + + +int ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v); +long ASN1_ENUMERATED_get(const ASN1_ENUMERATED *a); +ASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(const BIGNUM *bn, ASN1_ENUMERATED *ai); +BIGNUM *ASN1_ENUMERATED_to_BN(const ASN1_ENUMERATED *ai, BIGNUM *bn); + +/* General */ +/* given a string, return the correct type, max is the maximum length */ +int ASN1_PRINTABLE_type(const unsigned char *s, int max); + +unsigned long ASN1_tag2bit(int tag); + +/* SPECIALS */ +int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag, + int *pclass, long omax); +int ASN1_check_infinite_end(unsigned char **p, long len); +int ASN1_const_check_infinite_end(const unsigned char **p, long len); +void ASN1_put_object(unsigned char **pp, int constructed, int length, + int tag, int xclass); +int ASN1_put_eoc(unsigned char **pp); +int ASN1_object_size(int constructed, int length, int tag); + +/* Used to implement other functions */ +void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, void *x); + +# define ASN1_dup_of(type,i2d,d2i,x) \ + ((type*)ASN1_dup(CHECKED_I2D_OF(type, i2d), \ + CHECKED_D2I_OF(type, d2i), \ + CHECKED_PTR_OF(type, x))) + +# define ASN1_dup_of_const(type,i2d,d2i,x) \ + ((type*)ASN1_dup(CHECKED_I2D_OF(const type, i2d), \ + CHECKED_D2I_OF(type, d2i), \ + CHECKED_PTR_OF(const type, x))) + +void *ASN1_item_dup(const ASN1_ITEM *it, void *x); + +/* ASN1 alloc/free macros for when a type is only used internally */ + +# define M_ASN1_new_of(type) (type *)ASN1_item_new(ASN1_ITEM_rptr(type)) +# define M_ASN1_free_of(x, type) \ + ASN1_item_free(CHECKED_PTR_OF(type, x), ASN1_ITEM_rptr(type)) + +# ifndef OPENSSL_NO_STDIO +void *ASN1_d2i_fp(void *(*xnew) (void), d2i_of_void *d2i, FILE *in, void **x); + +# define ASN1_d2i_fp_of(type,xnew,d2i,in,x) \ + ((type*)ASN1_d2i_fp(CHECKED_NEW_OF(type, xnew), \ + CHECKED_D2I_OF(type, d2i), \ + in, \ + CHECKED_PPTR_OF(type, x))) + +void *ASN1_item_d2i_fp(const ASN1_ITEM *it, FILE *in, void *x); +int ASN1_i2d_fp(i2d_of_void *i2d, FILE *out, void *x); + +# define ASN1_i2d_fp_of(type,i2d,out,x) \ + (ASN1_i2d_fp(CHECKED_I2D_OF(type, i2d), \ + out, \ + CHECKED_PTR_OF(type, x))) + +# define ASN1_i2d_fp_of_const(type,i2d,out,x) \ + (ASN1_i2d_fp(CHECKED_I2D_OF(const type, i2d), \ + out, \ + CHECKED_PTR_OF(const type, x))) + +int ASN1_item_i2d_fp(const ASN1_ITEM *it, FILE *out, void *x); +int ASN1_STRING_print_ex_fp(FILE *fp, const ASN1_STRING *str, unsigned long flags); +# endif + +int ASN1_STRING_to_UTF8(unsigned char **out, const ASN1_STRING *in); + +void *ASN1_d2i_bio(void *(*xnew) (void), d2i_of_void *d2i, BIO *in, void **x); + +# define ASN1_d2i_bio_of(type,xnew,d2i,in,x) \ + ((type*)ASN1_d2i_bio( CHECKED_NEW_OF(type, xnew), \ + CHECKED_D2I_OF(type, d2i), \ + in, \ + CHECKED_PPTR_OF(type, x))) + +void *ASN1_item_d2i_bio(const ASN1_ITEM *it, BIO *in, void *x); +int ASN1_i2d_bio(i2d_of_void *i2d, BIO *out, unsigned char *x); + +# define ASN1_i2d_bio_of(type,i2d,out,x) \ + (ASN1_i2d_bio(CHECKED_I2D_OF(type, i2d), \ + out, \ + CHECKED_PTR_OF(type, x))) + +# define ASN1_i2d_bio_of_const(type,i2d,out,x) \ + (ASN1_i2d_bio(CHECKED_I2D_OF(const type, i2d), \ + out, \ + CHECKED_PTR_OF(const type, x))) + +int ASN1_item_i2d_bio(const ASN1_ITEM *it, BIO *out, void *x); +int ASN1_UTCTIME_print(BIO *fp, const ASN1_UTCTIME *a); +int ASN1_GENERALIZEDTIME_print(BIO *fp, const ASN1_GENERALIZEDTIME *a); +int ASN1_TIME_print(BIO *fp, const ASN1_TIME *a); +int ASN1_STRING_print(BIO *bp, const ASN1_STRING *v); +int ASN1_STRING_print_ex(BIO *out, const ASN1_STRING *str, unsigned long flags); +int ASN1_buf_print(BIO *bp, const unsigned char *buf, size_t buflen, int off); +int ASN1_bn_print(BIO *bp, const char *number, const BIGNUM *num, + unsigned char *buf, int off); +int ASN1_parse(BIO *bp, const unsigned char *pp, long len, int indent); +int ASN1_parse_dump(BIO *bp, const unsigned char *pp, long len, int indent, + int dump); +const char *ASN1_tag2str(int tag); + +/* Used to load and write Netscape format cert */ + +int ASN1_UNIVERSALSTRING_to_string(ASN1_UNIVERSALSTRING *s); + +int ASN1_TYPE_set_octetstring(ASN1_TYPE *a, unsigned char *data, int len); +int ASN1_TYPE_get_octetstring(const ASN1_TYPE *a, unsigned char *data, int max_len); +int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num, + unsigned char *data, int len); +int ASN1_TYPE_get_int_octetstring(const ASN1_TYPE *a, long *num, + unsigned char *data, int max_len); + +void *ASN1_item_unpack(const ASN1_STRING *oct, const ASN1_ITEM *it); + +ASN1_STRING *ASN1_item_pack(void *obj, const ASN1_ITEM *it, + ASN1_OCTET_STRING **oct); + +void ASN1_STRING_set_default_mask(unsigned long mask); +int ASN1_STRING_set_default_mask_asc(const char *p); +unsigned long ASN1_STRING_get_default_mask(void); +int ASN1_mbstring_copy(ASN1_STRING **out, const unsigned char *in, int len, + int inform, unsigned long mask); +int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len, + int inform, unsigned long mask, + long minsize, long maxsize); + +ASN1_STRING *ASN1_STRING_set_by_NID(ASN1_STRING **out, + const unsigned char *in, int inlen, + int inform, int nid); +ASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid); +int ASN1_STRING_TABLE_add(int, long, long, unsigned long, unsigned long); +void ASN1_STRING_TABLE_cleanup(void); + +/* ASN1 template functions */ + +/* Old API compatible functions */ +ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it); +void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it); +ASN1_VALUE *ASN1_item_d2i(ASN1_VALUE **val, const unsigned char **in, + long len, const ASN1_ITEM *it); +int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it); +int ASN1_item_ndef_i2d(ASN1_VALUE *val, unsigned char **out, + const ASN1_ITEM *it); + +void ASN1_add_oid_module(void); +void ASN1_add_stable_module(void); + +ASN1_TYPE *ASN1_generate_nconf(const char *str, CONF *nconf); +ASN1_TYPE *ASN1_generate_v3(const char *str, X509V3_CTX *cnf); +int ASN1_str2mask(const char *str, unsigned long *pmask); + +/* ASN1 Print flags */ + +/* Indicate missing OPTIONAL fields */ +# define ASN1_PCTX_FLAGS_SHOW_ABSENT 0x001 +/* Mark start and end of SEQUENCE */ +# define ASN1_PCTX_FLAGS_SHOW_SEQUENCE 0x002 +/* Mark start and end of SEQUENCE/SET OF */ +# define ASN1_PCTX_FLAGS_SHOW_SSOF 0x004 +/* Show the ASN1 type of primitives */ +# define ASN1_PCTX_FLAGS_SHOW_TYPE 0x008 +/* Don't show ASN1 type of ANY */ +# define ASN1_PCTX_FLAGS_NO_ANY_TYPE 0x010 +/* Don't show ASN1 type of MSTRINGs */ +# define ASN1_PCTX_FLAGS_NO_MSTRING_TYPE 0x020 +/* Don't show field names in SEQUENCE */ +# define ASN1_PCTX_FLAGS_NO_FIELD_NAME 0x040 +/* Show structure names of each SEQUENCE field */ +# define ASN1_PCTX_FLAGS_SHOW_FIELD_STRUCT_NAME 0x080 +/* Don't show structure name even at top level */ +# define ASN1_PCTX_FLAGS_NO_STRUCT_NAME 0x100 + +int ASN1_item_print(BIO *out, ASN1_VALUE *ifld, int indent, + const ASN1_ITEM *it, const ASN1_PCTX *pctx); +ASN1_PCTX *ASN1_PCTX_new(void); +void ASN1_PCTX_free(ASN1_PCTX *p); +unsigned long ASN1_PCTX_get_flags(const ASN1_PCTX *p); +void ASN1_PCTX_set_flags(ASN1_PCTX *p, unsigned long flags); +unsigned long ASN1_PCTX_get_nm_flags(const ASN1_PCTX *p); +void ASN1_PCTX_set_nm_flags(ASN1_PCTX *p, unsigned long flags); +unsigned long ASN1_PCTX_get_cert_flags(const ASN1_PCTX *p); +void ASN1_PCTX_set_cert_flags(ASN1_PCTX *p, unsigned long flags); +unsigned long ASN1_PCTX_get_oid_flags(const ASN1_PCTX *p); +void ASN1_PCTX_set_oid_flags(ASN1_PCTX *p, unsigned long flags); +unsigned long ASN1_PCTX_get_str_flags(const ASN1_PCTX *p); +void ASN1_PCTX_set_str_flags(ASN1_PCTX *p, unsigned long flags); + +ASN1_SCTX *ASN1_SCTX_new(int (*scan_cb) (ASN1_SCTX *ctx)); +void ASN1_SCTX_free(ASN1_SCTX *p); +const ASN1_ITEM *ASN1_SCTX_get_item(ASN1_SCTX *p); +const ASN1_TEMPLATE *ASN1_SCTX_get_template(ASN1_SCTX *p); +unsigned long ASN1_SCTX_get_flags(ASN1_SCTX *p); +void ASN1_SCTX_set_app_data(ASN1_SCTX *p, void *data); +void *ASN1_SCTX_get_app_data(ASN1_SCTX *p); + +const BIO_METHOD *BIO_f_asn1(void); + +BIO *BIO_new_NDEF(BIO *out, ASN1_VALUE *val, const ASN1_ITEM *it); + +int i2d_ASN1_bio_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags, + const ASN1_ITEM *it); +int PEM_write_bio_ASN1_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags, + const char *hdr, const ASN1_ITEM *it); +int SMIME_write_ASN1(BIO *bio, ASN1_VALUE *val, BIO *data, int flags, + int ctype_nid, int econt_nid, + STACK_OF(X509_ALGOR) *mdalgs, const ASN1_ITEM *it); +ASN1_VALUE *SMIME_read_ASN1(BIO *bio, BIO **bcont, const ASN1_ITEM *it); +int SMIME_crlf_copy(BIO *in, BIO *out, int flags); +int SMIME_text(BIO *in, BIO *out); + +const ASN1_ITEM *ASN1_ITEM_lookup(const char *name); +const ASN1_ITEM *ASN1_ITEM_get(size_t i); + +# ifdef __cplusplus +} +# endif +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/asn1_mac.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/asn1_mac.h new file mode 100644 index 0000000..7ac1782 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/asn1_mac.h @@ -0,0 +1,10 @@ +/* + * Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#error "This file is obsolete; please update your software." diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/asn1err.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/asn1err.h new file mode 100644 index 0000000..faed5a5 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/asn1err.h @@ -0,0 +1,256 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_ASN1ERR_H +# define HEADER_ASN1ERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_ASN1_strings(void); + +/* + * ASN1 function codes. + */ +# define ASN1_F_A2D_ASN1_OBJECT 100 +# define ASN1_F_A2I_ASN1_INTEGER 102 +# define ASN1_F_A2I_ASN1_STRING 103 +# define ASN1_F_APPEND_EXP 176 +# define ASN1_F_ASN1_BIO_INIT 113 +# define ASN1_F_ASN1_BIT_STRING_SET_BIT 183 +# define ASN1_F_ASN1_CB 177 +# define ASN1_F_ASN1_CHECK_TLEN 104 +# define ASN1_F_ASN1_COLLECT 106 +# define ASN1_F_ASN1_D2I_EX_PRIMITIVE 108 +# define ASN1_F_ASN1_D2I_FP 109 +# define ASN1_F_ASN1_D2I_READ_BIO 107 +# define ASN1_F_ASN1_DIGEST 184 +# define ASN1_F_ASN1_DO_ADB 110 +# define ASN1_F_ASN1_DO_LOCK 233 +# define ASN1_F_ASN1_DUP 111 +# define ASN1_F_ASN1_ENC_SAVE 115 +# define ASN1_F_ASN1_EX_C2I 204 +# define ASN1_F_ASN1_FIND_END 190 +# define ASN1_F_ASN1_GENERALIZEDTIME_ADJ 216 +# define ASN1_F_ASN1_GENERATE_V3 178 +# define ASN1_F_ASN1_GET_INT64 224 +# define ASN1_F_ASN1_GET_OBJECT 114 +# define ASN1_F_ASN1_GET_UINT64 225 +# define ASN1_F_ASN1_I2D_BIO 116 +# define ASN1_F_ASN1_I2D_FP 117 +# define ASN1_F_ASN1_ITEM_D2I_FP 206 +# define ASN1_F_ASN1_ITEM_DUP 191 +# define ASN1_F_ASN1_ITEM_EMBED_D2I 120 +# define ASN1_F_ASN1_ITEM_EMBED_NEW 121 +# define ASN1_F_ASN1_ITEM_FLAGS_I2D 118 +# define ASN1_F_ASN1_ITEM_I2D_BIO 192 +# define ASN1_F_ASN1_ITEM_I2D_FP 193 +# define ASN1_F_ASN1_ITEM_PACK 198 +# define ASN1_F_ASN1_ITEM_SIGN 195 +# define ASN1_F_ASN1_ITEM_SIGN_CTX 220 +# define ASN1_F_ASN1_ITEM_UNPACK 199 +# define ASN1_F_ASN1_ITEM_VERIFY 197 +# define ASN1_F_ASN1_MBSTRING_NCOPY 122 +# define ASN1_F_ASN1_OBJECT_NEW 123 +# define ASN1_F_ASN1_OUTPUT_DATA 214 +# define ASN1_F_ASN1_PCTX_NEW 205 +# define ASN1_F_ASN1_PRIMITIVE_NEW 119 +# define ASN1_F_ASN1_SCTX_NEW 221 +# define ASN1_F_ASN1_SIGN 128 +# define ASN1_F_ASN1_STR2TYPE 179 +# define ASN1_F_ASN1_STRING_GET_INT64 227 +# define ASN1_F_ASN1_STRING_GET_UINT64 230 +# define ASN1_F_ASN1_STRING_SET 186 +# define ASN1_F_ASN1_STRING_TABLE_ADD 129 +# define ASN1_F_ASN1_STRING_TO_BN 228 +# define ASN1_F_ASN1_STRING_TYPE_NEW 130 +# define ASN1_F_ASN1_TEMPLATE_EX_D2I 132 +# define ASN1_F_ASN1_TEMPLATE_NEW 133 +# define ASN1_F_ASN1_TEMPLATE_NOEXP_D2I 131 +# define ASN1_F_ASN1_TIME_ADJ 217 +# define ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING 134 +# define ASN1_F_ASN1_TYPE_GET_OCTETSTRING 135 +# define ASN1_F_ASN1_UTCTIME_ADJ 218 +# define ASN1_F_ASN1_VERIFY 137 +# define ASN1_F_B64_READ_ASN1 209 +# define ASN1_F_B64_WRITE_ASN1 210 +# define ASN1_F_BIO_NEW_NDEF 208 +# define ASN1_F_BITSTR_CB 180 +# define ASN1_F_BN_TO_ASN1_STRING 229 +# define ASN1_F_C2I_ASN1_BIT_STRING 189 +# define ASN1_F_C2I_ASN1_INTEGER 194 +# define ASN1_F_C2I_ASN1_OBJECT 196 +# define ASN1_F_C2I_IBUF 226 +# define ASN1_F_C2I_UINT64_INT 101 +# define ASN1_F_COLLECT_DATA 140 +# define ASN1_F_D2I_ASN1_OBJECT 147 +# define ASN1_F_D2I_ASN1_UINTEGER 150 +# define ASN1_F_D2I_AUTOPRIVATEKEY 207 +# define ASN1_F_D2I_PRIVATEKEY 154 +# define ASN1_F_D2I_PUBLICKEY 155 +# define ASN1_F_DO_BUF 142 +# define ASN1_F_DO_CREATE 124 +# define ASN1_F_DO_DUMP 125 +# define ASN1_F_DO_TCREATE 222 +# define ASN1_F_I2A_ASN1_OBJECT 126 +# define ASN1_F_I2D_ASN1_BIO_STREAM 211 +# define ASN1_F_I2D_ASN1_OBJECT 143 +# define ASN1_F_I2D_DSA_PUBKEY 161 +# define ASN1_F_I2D_EC_PUBKEY 181 +# define ASN1_F_I2D_PRIVATEKEY 163 +# define ASN1_F_I2D_PUBLICKEY 164 +# define ASN1_F_I2D_RSA_PUBKEY 165 +# define ASN1_F_LONG_C2I 166 +# define ASN1_F_NDEF_PREFIX 127 +# define ASN1_F_NDEF_SUFFIX 136 +# define ASN1_F_OID_MODULE_INIT 174 +# define ASN1_F_PARSE_TAGGING 182 +# define ASN1_F_PKCS5_PBE2_SET_IV 167 +# define ASN1_F_PKCS5_PBE2_SET_SCRYPT 231 +# define ASN1_F_PKCS5_PBE_SET 202 +# define ASN1_F_PKCS5_PBE_SET0_ALGOR 215 +# define ASN1_F_PKCS5_PBKDF2_SET 219 +# define ASN1_F_PKCS5_SCRYPT_SET 232 +# define ASN1_F_SMIME_READ_ASN1 212 +# define ASN1_F_SMIME_TEXT 213 +# define ASN1_F_STABLE_GET 138 +# define ASN1_F_STBL_MODULE_INIT 223 +# define ASN1_F_UINT32_C2I 105 +# define ASN1_F_UINT32_NEW 139 +# define ASN1_F_UINT64_C2I 112 +# define ASN1_F_UINT64_NEW 141 +# define ASN1_F_X509_CRL_ADD0_REVOKED 169 +# define ASN1_F_X509_INFO_NEW 170 +# define ASN1_F_X509_NAME_ENCODE 203 +# define ASN1_F_X509_NAME_EX_D2I 158 +# define ASN1_F_X509_NAME_EX_NEW 171 +# define ASN1_F_X509_PKEY_NEW 173 + +/* + * ASN1 reason codes. + */ +# define ASN1_R_ADDING_OBJECT 171 +# define ASN1_R_ASN1_PARSE_ERROR 203 +# define ASN1_R_ASN1_SIG_PARSE_ERROR 204 +# define ASN1_R_AUX_ERROR 100 +# define ASN1_R_BAD_OBJECT_HEADER 102 +# define ASN1_R_BMPSTRING_IS_WRONG_LENGTH 214 +# define ASN1_R_BN_LIB 105 +# define ASN1_R_BOOLEAN_IS_WRONG_LENGTH 106 +# define ASN1_R_BUFFER_TOO_SMALL 107 +# define ASN1_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER 108 +# define ASN1_R_CONTEXT_NOT_INITIALISED 217 +# define ASN1_R_DATA_IS_WRONG 109 +# define ASN1_R_DECODE_ERROR 110 +# define ASN1_R_DEPTH_EXCEEDED 174 +# define ASN1_R_DIGEST_AND_KEY_TYPE_NOT_SUPPORTED 198 +# define ASN1_R_ENCODE_ERROR 112 +# define ASN1_R_ERROR_GETTING_TIME 173 +# define ASN1_R_ERROR_LOADING_SECTION 172 +# define ASN1_R_ERROR_SETTING_CIPHER_PARAMS 114 +# define ASN1_R_EXPECTING_AN_INTEGER 115 +# define ASN1_R_EXPECTING_AN_OBJECT 116 +# define ASN1_R_EXPLICIT_LENGTH_MISMATCH 119 +# define ASN1_R_EXPLICIT_TAG_NOT_CONSTRUCTED 120 +# define ASN1_R_FIELD_MISSING 121 +# define ASN1_R_FIRST_NUM_TOO_LARGE 122 +# define ASN1_R_HEADER_TOO_LONG 123 +# define ASN1_R_ILLEGAL_BITSTRING_FORMAT 175 +# define ASN1_R_ILLEGAL_BOOLEAN 176 +# define ASN1_R_ILLEGAL_CHARACTERS 124 +# define ASN1_R_ILLEGAL_FORMAT 177 +# define ASN1_R_ILLEGAL_HEX 178 +# define ASN1_R_ILLEGAL_IMPLICIT_TAG 179 +# define ASN1_R_ILLEGAL_INTEGER 180 +# define ASN1_R_ILLEGAL_NEGATIVE_VALUE 226 +# define ASN1_R_ILLEGAL_NESTED_TAGGING 181 +# define ASN1_R_ILLEGAL_NULL 125 +# define ASN1_R_ILLEGAL_NULL_VALUE 182 +# define ASN1_R_ILLEGAL_OBJECT 183 +# define ASN1_R_ILLEGAL_OPTIONAL_ANY 126 +# define ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE 170 +# define ASN1_R_ILLEGAL_PADDING 221 +# define ASN1_R_ILLEGAL_TAGGED_ANY 127 +# define ASN1_R_ILLEGAL_TIME_VALUE 184 +# define ASN1_R_ILLEGAL_ZERO_CONTENT 222 +# define ASN1_R_INTEGER_NOT_ASCII_FORMAT 185 +# define ASN1_R_INTEGER_TOO_LARGE_FOR_LONG 128 +# define ASN1_R_INVALID_BIT_STRING_BITS_LEFT 220 +# define ASN1_R_INVALID_BMPSTRING_LENGTH 129 +# define ASN1_R_INVALID_DIGIT 130 +# define ASN1_R_INVALID_MIME_TYPE 205 +# define ASN1_R_INVALID_MODIFIER 186 +# define ASN1_R_INVALID_NUMBER 187 +# define ASN1_R_INVALID_OBJECT_ENCODING 216 +# define ASN1_R_INVALID_SCRYPT_PARAMETERS 227 +# define ASN1_R_INVALID_SEPARATOR 131 +# define ASN1_R_INVALID_STRING_TABLE_VALUE 218 +# define ASN1_R_INVALID_UNIVERSALSTRING_LENGTH 133 +# define ASN1_R_INVALID_UTF8STRING 134 +# define ASN1_R_INVALID_VALUE 219 +# define ASN1_R_LIST_ERROR 188 +# define ASN1_R_MIME_NO_CONTENT_TYPE 206 +# define ASN1_R_MIME_PARSE_ERROR 207 +# define ASN1_R_MIME_SIG_PARSE_ERROR 208 +# define ASN1_R_MISSING_EOC 137 +# define ASN1_R_MISSING_SECOND_NUMBER 138 +# define ASN1_R_MISSING_VALUE 189 +# define ASN1_R_MSTRING_NOT_UNIVERSAL 139 +# define ASN1_R_MSTRING_WRONG_TAG 140 +# define ASN1_R_NESTED_ASN1_STRING 197 +# define ASN1_R_NESTED_TOO_DEEP 201 +# define ASN1_R_NON_HEX_CHARACTERS 141 +# define ASN1_R_NOT_ASCII_FORMAT 190 +# define ASN1_R_NOT_ENOUGH_DATA 142 +# define ASN1_R_NO_CONTENT_TYPE 209 +# define ASN1_R_NO_MATCHING_CHOICE_TYPE 143 +# define ASN1_R_NO_MULTIPART_BODY_FAILURE 210 +# define ASN1_R_NO_MULTIPART_BOUNDARY 211 +# define ASN1_R_NO_SIG_CONTENT_TYPE 212 +# define ASN1_R_NULL_IS_WRONG_LENGTH 144 +# define ASN1_R_OBJECT_NOT_ASCII_FORMAT 191 +# define ASN1_R_ODD_NUMBER_OF_CHARS 145 +# define ASN1_R_SECOND_NUMBER_TOO_LARGE 147 +# define ASN1_R_SEQUENCE_LENGTH_MISMATCH 148 +# define ASN1_R_SEQUENCE_NOT_CONSTRUCTED 149 +# define ASN1_R_SEQUENCE_OR_SET_NEEDS_CONFIG 192 +# define ASN1_R_SHORT_LINE 150 +# define ASN1_R_SIG_INVALID_MIME_TYPE 213 +# define ASN1_R_STREAMING_NOT_SUPPORTED 202 +# define ASN1_R_STRING_TOO_LONG 151 +# define ASN1_R_STRING_TOO_SHORT 152 +# define ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 154 +# define ASN1_R_TIME_NOT_ASCII_FORMAT 193 +# define ASN1_R_TOO_LARGE 223 +# define ASN1_R_TOO_LONG 155 +# define ASN1_R_TOO_SMALL 224 +# define ASN1_R_TYPE_NOT_CONSTRUCTED 156 +# define ASN1_R_TYPE_NOT_PRIMITIVE 195 +# define ASN1_R_UNEXPECTED_EOC 159 +# define ASN1_R_UNIVERSALSTRING_IS_WRONG_LENGTH 215 +# define ASN1_R_UNKNOWN_FORMAT 160 +# define ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM 161 +# define ASN1_R_UNKNOWN_OBJECT_TYPE 162 +# define ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE 163 +# define ASN1_R_UNKNOWN_SIGNATURE_ALGORITHM 199 +# define ASN1_R_UNKNOWN_TAG 194 +# define ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE 164 +# define ASN1_R_UNSUPPORTED_CIPHER 228 +# define ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE 167 +# define ASN1_R_UNSUPPORTED_TYPE 196 +# define ASN1_R_WRONG_INTEGER_TYPE 225 +# define ASN1_R_WRONG_PUBLIC_KEY_TYPE 200 +# define ASN1_R_WRONG_TAG 168 + +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/asn1t.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/asn1t.h new file mode 100644 index 0000000..a450ba0 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/asn1t.h @@ -0,0 +1,945 @@ +/* + * Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_ASN1T_H +# define HEADER_ASN1T_H + +# include +# include +# include + +# ifdef OPENSSL_BUILD_SHLIBCRYPTO +# undef OPENSSL_EXTERN +# define OPENSSL_EXTERN OPENSSL_EXPORT +# endif + +/* ASN1 template defines, structures and functions */ + +#ifdef __cplusplus +extern "C" { +#endif + +# ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION + +/* Macro to obtain ASN1_ADB pointer from a type (only used internally) */ +# define ASN1_ADB_ptr(iptr) ((const ASN1_ADB *)(iptr)) + +/* Macros for start and end of ASN1_ITEM definition */ + +# define ASN1_ITEM_start(itname) \ + const ASN1_ITEM itname##_it = { + +# define static_ASN1_ITEM_start(itname) \ + static const ASN1_ITEM itname##_it = { + +# define ASN1_ITEM_end(itname) \ + }; + +# else + +/* Macro to obtain ASN1_ADB pointer from a type (only used internally) */ +# define ASN1_ADB_ptr(iptr) ((const ASN1_ADB *)((iptr)())) + +/* Macros for start and end of ASN1_ITEM definition */ + +# define ASN1_ITEM_start(itname) \ + const ASN1_ITEM * itname##_it(void) \ + { \ + static const ASN1_ITEM local_it = { + +# define static_ASN1_ITEM_start(itname) \ + static ASN1_ITEM_start(itname) + +# define ASN1_ITEM_end(itname) \ + }; \ + return &local_it; \ + } + +# endif + +/* Macros to aid ASN1 template writing */ + +# define ASN1_ITEM_TEMPLATE(tname) \ + static const ASN1_TEMPLATE tname##_item_tt + +# define ASN1_ITEM_TEMPLATE_END(tname) \ + ;\ + ASN1_ITEM_start(tname) \ + ASN1_ITYPE_PRIMITIVE,\ + -1,\ + &tname##_item_tt,\ + 0,\ + NULL,\ + 0,\ + #tname \ + ASN1_ITEM_end(tname) +# define static_ASN1_ITEM_TEMPLATE_END(tname) \ + ;\ + static_ASN1_ITEM_start(tname) \ + ASN1_ITYPE_PRIMITIVE,\ + -1,\ + &tname##_item_tt,\ + 0,\ + NULL,\ + 0,\ + #tname \ + ASN1_ITEM_end(tname) + +/* This is a ASN1 type which just embeds a template */ + +/*- + * This pair helps declare a SEQUENCE. We can do: + * + * ASN1_SEQUENCE(stname) = { + * ... SEQUENCE components ... + * } ASN1_SEQUENCE_END(stname) + * + * This will produce an ASN1_ITEM called stname_it + * for a structure called stname. + * + * If you want the same structure but a different + * name then use: + * + * ASN1_SEQUENCE(itname) = { + * ... SEQUENCE components ... + * } ASN1_SEQUENCE_END_name(stname, itname) + * + * This will create an item called itname_it using + * a structure called stname. + */ + +# define ASN1_SEQUENCE(tname) \ + static const ASN1_TEMPLATE tname##_seq_tt[] + +# define ASN1_SEQUENCE_END(stname) ASN1_SEQUENCE_END_name(stname, stname) + +# define static_ASN1_SEQUENCE_END(stname) static_ASN1_SEQUENCE_END_name(stname, stname) + +# define ASN1_SEQUENCE_END_name(stname, tname) \ + ;\ + ASN1_ITEM_start(tname) \ + ASN1_ITYPE_SEQUENCE,\ + V_ASN1_SEQUENCE,\ + tname##_seq_tt,\ + sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ + NULL,\ + sizeof(stname),\ + #tname \ + ASN1_ITEM_end(tname) + +# define static_ASN1_SEQUENCE_END_name(stname, tname) \ + ;\ + static_ASN1_ITEM_start(tname) \ + ASN1_ITYPE_SEQUENCE,\ + V_ASN1_SEQUENCE,\ + tname##_seq_tt,\ + sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ + NULL,\ + sizeof(stname),\ + #stname \ + ASN1_ITEM_end(tname) + +# define ASN1_NDEF_SEQUENCE(tname) \ + ASN1_SEQUENCE(tname) + +# define ASN1_NDEF_SEQUENCE_cb(tname, cb) \ + ASN1_SEQUENCE_cb(tname, cb) + +# define ASN1_SEQUENCE_cb(tname, cb) \ + static const ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0}; \ + ASN1_SEQUENCE(tname) + +# define ASN1_BROKEN_SEQUENCE(tname) \ + static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_BROKEN, 0, 0, 0, 0}; \ + ASN1_SEQUENCE(tname) + +# define ASN1_SEQUENCE_ref(tname, cb) \ + static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_REFCOUNT, offsetof(tname, references), offsetof(tname, lock), cb, 0}; \ + ASN1_SEQUENCE(tname) + +# define ASN1_SEQUENCE_enc(tname, enc, cb) \ + static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_ENCODING, 0, 0, cb, offsetof(tname, enc)}; \ + ASN1_SEQUENCE(tname) + +# define ASN1_NDEF_SEQUENCE_END(tname) \ + ;\ + ASN1_ITEM_start(tname) \ + ASN1_ITYPE_NDEF_SEQUENCE,\ + V_ASN1_SEQUENCE,\ + tname##_seq_tt,\ + sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ + NULL,\ + sizeof(tname),\ + #tname \ + ASN1_ITEM_end(tname) +# define static_ASN1_NDEF_SEQUENCE_END(tname) \ + ;\ + static_ASN1_ITEM_start(tname) \ + ASN1_ITYPE_NDEF_SEQUENCE,\ + V_ASN1_SEQUENCE,\ + tname##_seq_tt,\ + sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ + NULL,\ + sizeof(tname),\ + #tname \ + ASN1_ITEM_end(tname) + +# define ASN1_BROKEN_SEQUENCE_END(stname) ASN1_SEQUENCE_END_ref(stname, stname) +# define static_ASN1_BROKEN_SEQUENCE_END(stname) \ + static_ASN1_SEQUENCE_END_ref(stname, stname) + +# define ASN1_SEQUENCE_END_enc(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname) + +# define ASN1_SEQUENCE_END_cb(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname) +# define static_ASN1_SEQUENCE_END_cb(stname, tname) static_ASN1_SEQUENCE_END_ref(stname, tname) + +# define ASN1_SEQUENCE_END_ref(stname, tname) \ + ;\ + ASN1_ITEM_start(tname) \ + ASN1_ITYPE_SEQUENCE,\ + V_ASN1_SEQUENCE,\ + tname##_seq_tt,\ + sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ + &tname##_aux,\ + sizeof(stname),\ + #tname \ + ASN1_ITEM_end(tname) +# define static_ASN1_SEQUENCE_END_ref(stname, tname) \ + ;\ + static_ASN1_ITEM_start(tname) \ + ASN1_ITYPE_SEQUENCE,\ + V_ASN1_SEQUENCE,\ + tname##_seq_tt,\ + sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ + &tname##_aux,\ + sizeof(stname),\ + #stname \ + ASN1_ITEM_end(tname) + +# define ASN1_NDEF_SEQUENCE_END_cb(stname, tname) \ + ;\ + ASN1_ITEM_start(tname) \ + ASN1_ITYPE_NDEF_SEQUENCE,\ + V_ASN1_SEQUENCE,\ + tname##_seq_tt,\ + sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ + &tname##_aux,\ + sizeof(stname),\ + #stname \ + ASN1_ITEM_end(tname) + +/*- + * This pair helps declare a CHOICE type. We can do: + * + * ASN1_CHOICE(chname) = { + * ... CHOICE options ... + * ASN1_CHOICE_END(chname) + * + * This will produce an ASN1_ITEM called chname_it + * for a structure called chname. The structure + * definition must look like this: + * typedef struct { + * int type; + * union { + * ASN1_SOMETHING *opt1; + * ASN1_SOMEOTHER *opt2; + * } value; + * } chname; + * + * the name of the selector must be 'type'. + * to use an alternative selector name use the + * ASN1_CHOICE_END_selector() version. + */ + +# define ASN1_CHOICE(tname) \ + static const ASN1_TEMPLATE tname##_ch_tt[] + +# define ASN1_CHOICE_cb(tname, cb) \ + static const ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0}; \ + ASN1_CHOICE(tname) + +# define ASN1_CHOICE_END(stname) ASN1_CHOICE_END_name(stname, stname) + +# define static_ASN1_CHOICE_END(stname) static_ASN1_CHOICE_END_name(stname, stname) + +# define ASN1_CHOICE_END_name(stname, tname) ASN1_CHOICE_END_selector(stname, tname, type) + +# define static_ASN1_CHOICE_END_name(stname, tname) static_ASN1_CHOICE_END_selector(stname, tname, type) + +# define ASN1_CHOICE_END_selector(stname, tname, selname) \ + ;\ + ASN1_ITEM_start(tname) \ + ASN1_ITYPE_CHOICE,\ + offsetof(stname,selname) ,\ + tname##_ch_tt,\ + sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\ + NULL,\ + sizeof(stname),\ + #stname \ + ASN1_ITEM_end(tname) + +# define static_ASN1_CHOICE_END_selector(stname, tname, selname) \ + ;\ + static_ASN1_ITEM_start(tname) \ + ASN1_ITYPE_CHOICE,\ + offsetof(stname,selname) ,\ + tname##_ch_tt,\ + sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\ + NULL,\ + sizeof(stname),\ + #stname \ + ASN1_ITEM_end(tname) + +# define ASN1_CHOICE_END_cb(stname, tname, selname) \ + ;\ + ASN1_ITEM_start(tname) \ + ASN1_ITYPE_CHOICE,\ + offsetof(stname,selname) ,\ + tname##_ch_tt,\ + sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\ + &tname##_aux,\ + sizeof(stname),\ + #stname \ + ASN1_ITEM_end(tname) + +/* This helps with the template wrapper form of ASN1_ITEM */ + +# define ASN1_EX_TEMPLATE_TYPE(flags, tag, name, type) { \ + (flags), (tag), 0,\ + #name, ASN1_ITEM_ref(type) } + +/* These help with SEQUENCE or CHOICE components */ + +/* used to declare other types */ + +# define ASN1_EX_TYPE(flags, tag, stname, field, type) { \ + (flags), (tag), offsetof(stname, field),\ + #field, ASN1_ITEM_ref(type) } + +/* implicit and explicit helper macros */ + +# define ASN1_IMP_EX(stname, field, type, tag, ex) \ + ASN1_EX_TYPE(ASN1_TFLG_IMPLICIT | (ex), tag, stname, field, type) + +# define ASN1_EXP_EX(stname, field, type, tag, ex) \ + ASN1_EX_TYPE(ASN1_TFLG_EXPLICIT | (ex), tag, stname, field, type) + +/* Any defined by macros: the field used is in the table itself */ + +# ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION +# define ASN1_ADB_OBJECT(tblname) { ASN1_TFLG_ADB_OID, -1, 0, #tblname, (const ASN1_ITEM *)&(tblname##_adb) } +# define ASN1_ADB_INTEGER(tblname) { ASN1_TFLG_ADB_INT, -1, 0, #tblname, (const ASN1_ITEM *)&(tblname##_adb) } +# else +# define ASN1_ADB_OBJECT(tblname) { ASN1_TFLG_ADB_OID, -1, 0, #tblname, tblname##_adb } +# define ASN1_ADB_INTEGER(tblname) { ASN1_TFLG_ADB_INT, -1, 0, #tblname, tblname##_adb } +# endif +/* Plain simple type */ +# define ASN1_SIMPLE(stname, field, type) ASN1_EX_TYPE(0,0, stname, field, type) +/* Embedded simple type */ +# define ASN1_EMBED(stname, field, type) ASN1_EX_TYPE(ASN1_TFLG_EMBED,0, stname, field, type) + +/* OPTIONAL simple type */ +# define ASN1_OPT(stname, field, type) ASN1_EX_TYPE(ASN1_TFLG_OPTIONAL, 0, stname, field, type) +# define ASN1_OPT_EMBED(stname, field, type) ASN1_EX_TYPE(ASN1_TFLG_OPTIONAL|ASN1_TFLG_EMBED, 0, stname, field, type) + +/* IMPLICIT tagged simple type */ +# define ASN1_IMP(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, 0) +# define ASN1_IMP_EMBED(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_EMBED) + +/* IMPLICIT tagged OPTIONAL simple type */ +# define ASN1_IMP_OPT(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL) +# define ASN1_IMP_OPT_EMBED(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL|ASN1_TFLG_EMBED) + +/* Same as above but EXPLICIT */ + +# define ASN1_EXP(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, 0) +# define ASN1_EXP_EMBED(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_EMBED) +# define ASN1_EXP_OPT(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL) +# define ASN1_EXP_OPT_EMBED(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL|ASN1_TFLG_EMBED) + +/* SEQUENCE OF type */ +# define ASN1_SEQUENCE_OF(stname, field, type) \ + ASN1_EX_TYPE(ASN1_TFLG_SEQUENCE_OF, 0, stname, field, type) + +/* OPTIONAL SEQUENCE OF */ +# define ASN1_SEQUENCE_OF_OPT(stname, field, type) \ + ASN1_EX_TYPE(ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL, 0, stname, field, type) + +/* Same as above but for SET OF */ + +# define ASN1_SET_OF(stname, field, type) \ + ASN1_EX_TYPE(ASN1_TFLG_SET_OF, 0, stname, field, type) + +# define ASN1_SET_OF_OPT(stname, field, type) \ + ASN1_EX_TYPE(ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL, 0, stname, field, type) + +/* Finally compound types of SEQUENCE, SET, IMPLICIT, EXPLICIT and OPTIONAL */ + +# define ASN1_IMP_SET_OF(stname, field, type, tag) \ + ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF) + +# define ASN1_EXP_SET_OF(stname, field, type, tag) \ + ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF) + +# define ASN1_IMP_SET_OF_OPT(stname, field, type, tag) \ + ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL) + +# define ASN1_EXP_SET_OF_OPT(stname, field, type, tag) \ + ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL) + +# define ASN1_IMP_SEQUENCE_OF(stname, field, type, tag) \ + ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF) + +# define ASN1_IMP_SEQUENCE_OF_OPT(stname, field, type, tag) \ + ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL) + +# define ASN1_EXP_SEQUENCE_OF(stname, field, type, tag) \ + ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF) + +# define ASN1_EXP_SEQUENCE_OF_OPT(stname, field, type, tag) \ + ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL) + +/* EXPLICIT using indefinite length constructed form */ +# define ASN1_NDEF_EXP(stname, field, type, tag) \ + ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_NDEF) + +/* EXPLICIT OPTIONAL using indefinite length constructed form */ +# define ASN1_NDEF_EXP_OPT(stname, field, type, tag) \ + ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL|ASN1_TFLG_NDEF) + +/* Macros for the ASN1_ADB structure */ + +# define ASN1_ADB(name) \ + static const ASN1_ADB_TABLE name##_adbtbl[] + +# ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION + +# define ASN1_ADB_END(name, flags, field, adb_cb, def, none) \ + ;\ + static const ASN1_ADB name##_adb = {\ + flags,\ + offsetof(name, field),\ + adb_cb,\ + name##_adbtbl,\ + sizeof(name##_adbtbl) / sizeof(ASN1_ADB_TABLE),\ + def,\ + none\ + } + +# else + +# define ASN1_ADB_END(name, flags, field, adb_cb, def, none) \ + ;\ + static const ASN1_ITEM *name##_adb(void) \ + { \ + static const ASN1_ADB internal_adb = \ + {\ + flags,\ + offsetof(name, field),\ + adb_cb,\ + name##_adbtbl,\ + sizeof(name##_adbtbl) / sizeof(ASN1_ADB_TABLE),\ + def,\ + none\ + }; \ + return (const ASN1_ITEM *) &internal_adb; \ + } \ + void dummy_function(void) + +# endif + +# define ADB_ENTRY(val, template) {val, template} + +# define ASN1_ADB_TEMPLATE(name) \ + static const ASN1_TEMPLATE name##_tt + +/* + * This is the ASN1 template structure that defines a wrapper round the + * actual type. It determines the actual position of the field in the value + * structure, various flags such as OPTIONAL and the field name. + */ + +struct ASN1_TEMPLATE_st { + unsigned long flags; /* Various flags */ + long tag; /* tag, not used if no tagging */ + unsigned long offset; /* Offset of this field in structure */ + const char *field_name; /* Field name */ + ASN1_ITEM_EXP *item; /* Relevant ASN1_ITEM or ASN1_ADB */ +}; + +/* Macro to extract ASN1_ITEM and ASN1_ADB pointer from ASN1_TEMPLATE */ + +# define ASN1_TEMPLATE_item(t) (t->item_ptr) +# define ASN1_TEMPLATE_adb(t) (t->item_ptr) + +typedef struct ASN1_ADB_TABLE_st ASN1_ADB_TABLE; +typedef struct ASN1_ADB_st ASN1_ADB; + +struct ASN1_ADB_st { + unsigned long flags; /* Various flags */ + unsigned long offset; /* Offset of selector field */ + int (*adb_cb)(long *psel); /* Application callback */ + const ASN1_ADB_TABLE *tbl; /* Table of possible types */ + long tblcount; /* Number of entries in tbl */ + const ASN1_TEMPLATE *default_tt; /* Type to use if no match */ + const ASN1_TEMPLATE *null_tt; /* Type to use if selector is NULL */ +}; + +struct ASN1_ADB_TABLE_st { + long value; /* NID for an object or value for an int */ + const ASN1_TEMPLATE tt; /* item for this value */ +}; + +/* template flags */ + +/* Field is optional */ +# define ASN1_TFLG_OPTIONAL (0x1) + +/* Field is a SET OF */ +# define ASN1_TFLG_SET_OF (0x1 << 1) + +/* Field is a SEQUENCE OF */ +# define ASN1_TFLG_SEQUENCE_OF (0x2 << 1) + +/* + * Special case: this refers to a SET OF that will be sorted into DER order + * when encoded *and* the corresponding STACK will be modified to match the + * new order. + */ +# define ASN1_TFLG_SET_ORDER (0x3 << 1) + +/* Mask for SET OF or SEQUENCE OF */ +# define ASN1_TFLG_SK_MASK (0x3 << 1) + +/* + * These flags mean the tag should be taken from the tag field. If EXPLICIT + * then the underlying type is used for the inner tag. + */ + +/* IMPLICIT tagging */ +# define ASN1_TFLG_IMPTAG (0x1 << 3) + +/* EXPLICIT tagging, inner tag from underlying type */ +# define ASN1_TFLG_EXPTAG (0x2 << 3) + +# define ASN1_TFLG_TAG_MASK (0x3 << 3) + +/* context specific IMPLICIT */ +# define ASN1_TFLG_IMPLICIT (ASN1_TFLG_IMPTAG|ASN1_TFLG_CONTEXT) + +/* context specific EXPLICIT */ +# define ASN1_TFLG_EXPLICIT (ASN1_TFLG_EXPTAG|ASN1_TFLG_CONTEXT) + +/* + * If tagging is in force these determine the type of tag to use. Otherwise + * the tag is determined by the underlying type. These values reflect the + * actual octet format. + */ + +/* Universal tag */ +# define ASN1_TFLG_UNIVERSAL (0x0<<6) +/* Application tag */ +# define ASN1_TFLG_APPLICATION (0x1<<6) +/* Context specific tag */ +# define ASN1_TFLG_CONTEXT (0x2<<6) +/* Private tag */ +# define ASN1_TFLG_PRIVATE (0x3<<6) + +# define ASN1_TFLG_TAG_CLASS (0x3<<6) + +/* + * These are for ANY DEFINED BY type. In this case the 'item' field points to + * an ASN1_ADB structure which contains a table of values to decode the + * relevant type + */ + +# define ASN1_TFLG_ADB_MASK (0x3<<8) + +# define ASN1_TFLG_ADB_OID (0x1<<8) + +# define ASN1_TFLG_ADB_INT (0x1<<9) + +/* + * This flag when present in a SEQUENCE OF, SET OF or EXPLICIT causes + * indefinite length constructed encoding to be used if required. + */ + +# define ASN1_TFLG_NDEF (0x1<<11) + +/* Field is embedded and not a pointer */ +# define ASN1_TFLG_EMBED (0x1 << 12) + +/* This is the actual ASN1 item itself */ + +struct ASN1_ITEM_st { + char itype; /* The item type, primitive, SEQUENCE, CHOICE + * or extern */ + long utype; /* underlying type */ + const ASN1_TEMPLATE *templates; /* If SEQUENCE or CHOICE this contains + * the contents */ + long tcount; /* Number of templates if SEQUENCE or CHOICE */ + const void *funcs; /* functions that handle this type */ + long size; /* Structure size (usually) */ + const char *sname; /* Structure name */ +}; + +/*- + * These are values for the itype field and + * determine how the type is interpreted. + * + * For PRIMITIVE types the underlying type + * determines the behaviour if items is NULL. + * + * Otherwise templates must contain a single + * template and the type is treated in the + * same way as the type specified in the template. + * + * For SEQUENCE types the templates field points + * to the members, the size field is the + * structure size. + * + * For CHOICE types the templates field points + * to each possible member (typically a union) + * and the 'size' field is the offset of the + * selector. + * + * The 'funcs' field is used for application + * specific functions. + * + * The EXTERN type uses a new style d2i/i2d. + * The new style should be used where possible + * because it avoids things like the d2i IMPLICIT + * hack. + * + * MSTRING is a multiple string type, it is used + * for a CHOICE of character strings where the + * actual strings all occupy an ASN1_STRING + * structure. In this case the 'utype' field + * has a special meaning, it is used as a mask + * of acceptable types using the B_ASN1 constants. + * + * NDEF_SEQUENCE is the same as SEQUENCE except + * that it will use indefinite length constructed + * encoding if requested. + * + */ + +# define ASN1_ITYPE_PRIMITIVE 0x0 + +# define ASN1_ITYPE_SEQUENCE 0x1 + +# define ASN1_ITYPE_CHOICE 0x2 + +# define ASN1_ITYPE_EXTERN 0x4 + +# define ASN1_ITYPE_MSTRING 0x5 + +# define ASN1_ITYPE_NDEF_SEQUENCE 0x6 + +/* + * Cache for ASN1 tag and length, so we don't keep re-reading it for things + * like CHOICE + */ + +struct ASN1_TLC_st { + char valid; /* Values below are valid */ + int ret; /* return value */ + long plen; /* length */ + int ptag; /* class value */ + int pclass; /* class value */ + int hdrlen; /* header length */ +}; + +/* Typedefs for ASN1 function pointers */ +typedef int ASN1_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, + const ASN1_ITEM *it, int tag, int aclass, char opt, + ASN1_TLC *ctx); + +typedef int ASN1_ex_i2d(ASN1_VALUE **pval, unsigned char **out, + const ASN1_ITEM *it, int tag, int aclass); +typedef int ASN1_ex_new_func(ASN1_VALUE **pval, const ASN1_ITEM *it); +typedef void ASN1_ex_free_func(ASN1_VALUE **pval, const ASN1_ITEM *it); + +typedef int ASN1_ex_print_func(BIO *out, ASN1_VALUE **pval, + int indent, const char *fname, + const ASN1_PCTX *pctx); + +typedef int ASN1_primitive_i2c(ASN1_VALUE **pval, unsigned char *cont, + int *putype, const ASN1_ITEM *it); +typedef int ASN1_primitive_c2i(ASN1_VALUE **pval, const unsigned char *cont, + int len, int utype, char *free_cont, + const ASN1_ITEM *it); +typedef int ASN1_primitive_print(BIO *out, ASN1_VALUE **pval, + const ASN1_ITEM *it, int indent, + const ASN1_PCTX *pctx); + +typedef struct ASN1_EXTERN_FUNCS_st { + void *app_data; + ASN1_ex_new_func *asn1_ex_new; + ASN1_ex_free_func *asn1_ex_free; + ASN1_ex_free_func *asn1_ex_clear; + ASN1_ex_d2i *asn1_ex_d2i; + ASN1_ex_i2d *asn1_ex_i2d; + ASN1_ex_print_func *asn1_ex_print; +} ASN1_EXTERN_FUNCS; + +typedef struct ASN1_PRIMITIVE_FUNCS_st { + void *app_data; + unsigned long flags; + ASN1_ex_new_func *prim_new; + ASN1_ex_free_func *prim_free; + ASN1_ex_free_func *prim_clear; + ASN1_primitive_c2i *prim_c2i; + ASN1_primitive_i2c *prim_i2c; + ASN1_primitive_print *prim_print; +} ASN1_PRIMITIVE_FUNCS; + +/* + * This is the ASN1_AUX structure: it handles various miscellaneous + * requirements. For example the use of reference counts and an informational + * callback. The "informational callback" is called at various points during + * the ASN1 encoding and decoding. It can be used to provide minor + * customisation of the structures used. This is most useful where the + * supplied routines *almost* do the right thing but need some extra help at + * a few points. If the callback returns zero then it is assumed a fatal + * error has occurred and the main operation should be abandoned. If major + * changes in the default behaviour are required then an external type is + * more appropriate. + */ + +typedef int ASN1_aux_cb(int operation, ASN1_VALUE **in, const ASN1_ITEM *it, + void *exarg); + +typedef struct ASN1_AUX_st { + void *app_data; + int flags; + int ref_offset; /* Offset of reference value */ + int ref_lock; /* Lock type to use */ + ASN1_aux_cb *asn1_cb; + int enc_offset; /* Offset of ASN1_ENCODING structure */ +} ASN1_AUX; + +/* For print related callbacks exarg points to this structure */ +typedef struct ASN1_PRINT_ARG_st { + BIO *out; + int indent; + const ASN1_PCTX *pctx; +} ASN1_PRINT_ARG; + +/* For streaming related callbacks exarg points to this structure */ +typedef struct ASN1_STREAM_ARG_st { + /* BIO to stream through */ + BIO *out; + /* BIO with filters appended */ + BIO *ndef_bio; + /* Streaming I/O boundary */ + unsigned char **boundary; +} ASN1_STREAM_ARG; + +/* Flags in ASN1_AUX */ + +/* Use a reference count */ +# define ASN1_AFLG_REFCOUNT 1 +/* Save the encoding of structure (useful for signatures) */ +# define ASN1_AFLG_ENCODING 2 +/* The Sequence length is invalid */ +# define ASN1_AFLG_BROKEN 4 + +/* operation values for asn1_cb */ + +# define ASN1_OP_NEW_PRE 0 +# define ASN1_OP_NEW_POST 1 +# define ASN1_OP_FREE_PRE 2 +# define ASN1_OP_FREE_POST 3 +# define ASN1_OP_D2I_PRE 4 +# define ASN1_OP_D2I_POST 5 +# define ASN1_OP_I2D_PRE 6 +# define ASN1_OP_I2D_POST 7 +# define ASN1_OP_PRINT_PRE 8 +# define ASN1_OP_PRINT_POST 9 +# define ASN1_OP_STREAM_PRE 10 +# define ASN1_OP_STREAM_POST 11 +# define ASN1_OP_DETACHED_PRE 12 +# define ASN1_OP_DETACHED_POST 13 + +/* Macro to implement a primitive type */ +# define IMPLEMENT_ASN1_TYPE(stname) IMPLEMENT_ASN1_TYPE_ex(stname, stname, 0) +# define IMPLEMENT_ASN1_TYPE_ex(itname, vname, ex) \ + ASN1_ITEM_start(itname) \ + ASN1_ITYPE_PRIMITIVE, V_##vname, NULL, 0, NULL, ex, #itname \ + ASN1_ITEM_end(itname) + +/* Macro to implement a multi string type */ +# define IMPLEMENT_ASN1_MSTRING(itname, mask) \ + ASN1_ITEM_start(itname) \ + ASN1_ITYPE_MSTRING, mask, NULL, 0, NULL, sizeof(ASN1_STRING), #itname \ + ASN1_ITEM_end(itname) + +# define IMPLEMENT_EXTERN_ASN1(sname, tag, fptrs) \ + ASN1_ITEM_start(sname) \ + ASN1_ITYPE_EXTERN, \ + tag, \ + NULL, \ + 0, \ + &fptrs, \ + 0, \ + #sname \ + ASN1_ITEM_end(sname) + +/* Macro to implement standard functions in terms of ASN1_ITEM structures */ + +# define IMPLEMENT_ASN1_FUNCTIONS(stname) IMPLEMENT_ASN1_FUNCTIONS_fname(stname, stname, stname) + +# define IMPLEMENT_ASN1_FUNCTIONS_name(stname, itname) IMPLEMENT_ASN1_FUNCTIONS_fname(stname, itname, itname) + +# define IMPLEMENT_ASN1_FUNCTIONS_ENCODE_name(stname, itname) \ + IMPLEMENT_ASN1_FUNCTIONS_ENCODE_fname(stname, itname, itname) + +# define IMPLEMENT_STATIC_ASN1_ALLOC_FUNCTIONS(stname) \ + IMPLEMENT_ASN1_ALLOC_FUNCTIONS_pfname(static, stname, stname, stname) + +# define IMPLEMENT_ASN1_ALLOC_FUNCTIONS(stname) \ + IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, stname, stname) + +# define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_pfname(pre, stname, itname, fname) \ + pre stname *fname##_new(void) \ + { \ + return (stname *)ASN1_item_new(ASN1_ITEM_rptr(itname)); \ + } \ + pre void fname##_free(stname *a) \ + { \ + ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \ + } + +# define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) \ + stname *fname##_new(void) \ + { \ + return (stname *)ASN1_item_new(ASN1_ITEM_rptr(itname)); \ + } \ + void fname##_free(stname *a) \ + { \ + ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \ + } + +# define IMPLEMENT_ASN1_FUNCTIONS_fname(stname, itname, fname) \ + IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname) \ + IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) + +# define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname) \ + stname *d2i_##fname(stname **a, const unsigned char **in, long len) \ + { \ + return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\ + } \ + int i2d_##fname(stname *a, unsigned char **out) \ + { \ + return ASN1_item_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\ + } + +# define IMPLEMENT_ASN1_NDEF_FUNCTION(stname) \ + int i2d_##stname##_NDEF(stname *a, unsigned char **out) \ + { \ + return ASN1_item_ndef_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(stname));\ + } + +# define IMPLEMENT_STATIC_ASN1_ENCODE_FUNCTIONS(stname) \ + static stname *d2i_##stname(stname **a, \ + const unsigned char **in, long len) \ + { \ + return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, \ + ASN1_ITEM_rptr(stname)); \ + } \ + static int i2d_##stname(stname *a, unsigned char **out) \ + { \ + return ASN1_item_i2d((ASN1_VALUE *)a, out, \ + ASN1_ITEM_rptr(stname)); \ + } + +/* + * This includes evil casts to remove const: they will go away when full ASN1 + * constification is done. + */ +# define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(stname, itname, fname) \ + stname *d2i_##fname(stname **a, const unsigned char **in, long len) \ + { \ + return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\ + } \ + int i2d_##fname(const stname *a, unsigned char **out) \ + { \ + return ASN1_item_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\ + } + +# define IMPLEMENT_ASN1_DUP_FUNCTION(stname) \ + stname * stname##_dup(stname *x) \ + { \ + return ASN1_item_dup(ASN1_ITEM_rptr(stname), x); \ + } + +# define IMPLEMENT_ASN1_PRINT_FUNCTION(stname) \ + IMPLEMENT_ASN1_PRINT_FUNCTION_fname(stname, stname, stname) + +# define IMPLEMENT_ASN1_PRINT_FUNCTION_fname(stname, itname, fname) \ + int fname##_print_ctx(BIO *out, stname *x, int indent, \ + const ASN1_PCTX *pctx) \ + { \ + return ASN1_item_print(out, (ASN1_VALUE *)x, indent, \ + ASN1_ITEM_rptr(itname), pctx); \ + } + +# define IMPLEMENT_ASN1_FUNCTIONS_const(name) \ + IMPLEMENT_ASN1_FUNCTIONS_const_fname(name, name, name) + +# define IMPLEMENT_ASN1_FUNCTIONS_const_fname(stname, itname, fname) \ + IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(stname, itname, fname) \ + IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) + +/* external definitions for primitive types */ + +DECLARE_ASN1_ITEM(ASN1_BOOLEAN) +DECLARE_ASN1_ITEM(ASN1_TBOOLEAN) +DECLARE_ASN1_ITEM(ASN1_FBOOLEAN) +DECLARE_ASN1_ITEM(ASN1_SEQUENCE) +DECLARE_ASN1_ITEM(CBIGNUM) +DECLARE_ASN1_ITEM(BIGNUM) +DECLARE_ASN1_ITEM(INT32) +DECLARE_ASN1_ITEM(ZINT32) +DECLARE_ASN1_ITEM(UINT32) +DECLARE_ASN1_ITEM(ZUINT32) +DECLARE_ASN1_ITEM(INT64) +DECLARE_ASN1_ITEM(ZINT64) +DECLARE_ASN1_ITEM(UINT64) +DECLARE_ASN1_ITEM(ZUINT64) + +# if OPENSSL_API_COMPAT < 0x10200000L +/* + * LONG and ZLONG are strongly discouraged for use as stored data, as the + * underlying C type (long) differs in size depending on the architecture. + * They are designed with 32-bit longs in mind. + */ +DECLARE_ASN1_ITEM(LONG) +DECLARE_ASN1_ITEM(ZLONG) +# endif + +DEFINE_STACK_OF(ASN1_VALUE) + +/* Functions used internally by the ASN1 code */ + +int ASN1_item_ex_new(ASN1_VALUE **pval, const ASN1_ITEM *it); +void ASN1_item_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it); + +int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, + const ASN1_ITEM *it, int tag, int aclass, char opt, + ASN1_TLC *ctx); + +int ASN1_item_ex_i2d(ASN1_VALUE **pval, unsigned char **out, + const ASN1_ITEM *it, int tag, int aclass); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/async.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/async.h new file mode 100644 index 0000000..7052b89 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/async.h @@ -0,0 +1,76 @@ +/* + * Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#include + +#ifndef HEADER_ASYNC_H +# define HEADER_ASYNC_H + +#if defined(_WIN32) +# if defined(BASETYPES) || defined(_WINDEF_H) +/* application has to include to use this */ +#define OSSL_ASYNC_FD HANDLE +#define OSSL_BAD_ASYNC_FD INVALID_HANDLE_VALUE +# endif +#else +#define OSSL_ASYNC_FD int +#define OSSL_BAD_ASYNC_FD -1 +#endif +# include + + +# ifdef __cplusplus +extern "C" { +# endif + +typedef struct async_job_st ASYNC_JOB; +typedef struct async_wait_ctx_st ASYNC_WAIT_CTX; + +#define ASYNC_ERR 0 +#define ASYNC_NO_JOBS 1 +#define ASYNC_PAUSE 2 +#define ASYNC_FINISH 3 + +int ASYNC_init_thread(size_t max_size, size_t init_size); +void ASYNC_cleanup_thread(void); + +#ifdef OSSL_ASYNC_FD +ASYNC_WAIT_CTX *ASYNC_WAIT_CTX_new(void); +void ASYNC_WAIT_CTX_free(ASYNC_WAIT_CTX *ctx); +int ASYNC_WAIT_CTX_set_wait_fd(ASYNC_WAIT_CTX *ctx, const void *key, + OSSL_ASYNC_FD fd, + void *custom_data, + void (*cleanup)(ASYNC_WAIT_CTX *, const void *, + OSSL_ASYNC_FD, void *)); +int ASYNC_WAIT_CTX_get_fd(ASYNC_WAIT_CTX *ctx, const void *key, + OSSL_ASYNC_FD *fd, void **custom_data); +int ASYNC_WAIT_CTX_get_all_fds(ASYNC_WAIT_CTX *ctx, OSSL_ASYNC_FD *fd, + size_t *numfds); +int ASYNC_WAIT_CTX_get_changed_fds(ASYNC_WAIT_CTX *ctx, OSSL_ASYNC_FD *addfd, + size_t *numaddfds, OSSL_ASYNC_FD *delfd, + size_t *numdelfds); +int ASYNC_WAIT_CTX_clear_fd(ASYNC_WAIT_CTX *ctx, const void *key); +#endif + +int ASYNC_is_capable(void); + +int ASYNC_start_job(ASYNC_JOB **job, ASYNC_WAIT_CTX *ctx, int *ret, + int (*func)(void *), void *args, size_t size); +int ASYNC_pause_job(void); + +ASYNC_JOB *ASYNC_get_current_job(void); +ASYNC_WAIT_CTX *ASYNC_get_wait_ctx(ASYNC_JOB *job); +void ASYNC_block_pause(void); +void ASYNC_unblock_pause(void); + + +# ifdef __cplusplus +} +# endif +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/asyncerr.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/asyncerr.h new file mode 100644 index 0000000..91afbbb --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/asyncerr.h @@ -0,0 +1,42 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_ASYNCERR_H +# define HEADER_ASYNCERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_ASYNC_strings(void); + +/* + * ASYNC function codes. + */ +# define ASYNC_F_ASYNC_CTX_NEW 100 +# define ASYNC_F_ASYNC_INIT_THREAD 101 +# define ASYNC_F_ASYNC_JOB_NEW 102 +# define ASYNC_F_ASYNC_PAUSE_JOB 103 +# define ASYNC_F_ASYNC_START_FUNC 104 +# define ASYNC_F_ASYNC_START_JOB 105 +# define ASYNC_F_ASYNC_WAIT_CTX_SET_WAIT_FD 106 + +/* + * ASYNC reason codes. + */ +# define ASYNC_R_FAILED_TO_SET_POOL 101 +# define ASYNC_R_FAILED_TO_SWAP_CONTEXT 102 +# define ASYNC_R_INIT_FAILED 105 +# define ASYNC_R_INVALID_POOL_SIZE 103 + +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/bio.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/bio.h new file mode 100644 index 0000000..ae559a5 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/bio.h @@ -0,0 +1,801 @@ +/* + * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_BIO_H +# define HEADER_BIO_H + +# include + +# ifndef OPENSSL_NO_STDIO +# include +# endif +# include + +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + +/* There are the classes of BIOs */ +# define BIO_TYPE_DESCRIPTOR 0x0100 /* socket, fd, connect or accept */ +# define BIO_TYPE_FILTER 0x0200 +# define BIO_TYPE_SOURCE_SINK 0x0400 + +/* These are the 'types' of BIOs */ +# define BIO_TYPE_NONE 0 +# define BIO_TYPE_MEM ( 1|BIO_TYPE_SOURCE_SINK) +# define BIO_TYPE_FILE ( 2|BIO_TYPE_SOURCE_SINK) + +# define BIO_TYPE_FD ( 4|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR) +# define BIO_TYPE_SOCKET ( 5|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR) +# define BIO_TYPE_NULL ( 6|BIO_TYPE_SOURCE_SINK) +# define BIO_TYPE_SSL ( 7|BIO_TYPE_FILTER) +# define BIO_TYPE_MD ( 8|BIO_TYPE_FILTER) +# define BIO_TYPE_BUFFER ( 9|BIO_TYPE_FILTER) +# define BIO_TYPE_CIPHER (10|BIO_TYPE_FILTER) +# define BIO_TYPE_BASE64 (11|BIO_TYPE_FILTER) +# define BIO_TYPE_CONNECT (12|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR) +# define BIO_TYPE_ACCEPT (13|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR) + +# define BIO_TYPE_NBIO_TEST (16|BIO_TYPE_FILTER)/* server proxy BIO */ +# define BIO_TYPE_NULL_FILTER (17|BIO_TYPE_FILTER) +# define BIO_TYPE_BIO (19|BIO_TYPE_SOURCE_SINK)/* half a BIO pair */ +# define BIO_TYPE_LINEBUFFER (20|BIO_TYPE_FILTER) +# define BIO_TYPE_DGRAM (21|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR) +# define BIO_TYPE_ASN1 (22|BIO_TYPE_FILTER) +# define BIO_TYPE_COMP (23|BIO_TYPE_FILTER) +# ifndef OPENSSL_NO_SCTP +# define BIO_TYPE_DGRAM_SCTP (24|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR) +# endif + +#define BIO_TYPE_START 128 + +/* + * BIO_FILENAME_READ|BIO_CLOSE to open or close on free. + * BIO_set_fp(in,stdin,BIO_NOCLOSE); + */ +# define BIO_NOCLOSE 0x00 +# define BIO_CLOSE 0x01 + +/* + * These are used in the following macros and are passed to BIO_ctrl() + */ +# define BIO_CTRL_RESET 1/* opt - rewind/zero etc */ +# define BIO_CTRL_EOF 2/* opt - are we at the eof */ +# define BIO_CTRL_INFO 3/* opt - extra tit-bits */ +# define BIO_CTRL_SET 4/* man - set the 'IO' type */ +# define BIO_CTRL_GET 5/* man - get the 'IO' type */ +# define BIO_CTRL_PUSH 6/* opt - internal, used to signify change */ +# define BIO_CTRL_POP 7/* opt - internal, used to signify change */ +# define BIO_CTRL_GET_CLOSE 8/* man - set the 'close' on free */ +# define BIO_CTRL_SET_CLOSE 9/* man - set the 'close' on free */ +# define BIO_CTRL_PENDING 10/* opt - is their more data buffered */ +# define BIO_CTRL_FLUSH 11/* opt - 'flush' buffered output */ +# define BIO_CTRL_DUP 12/* man - extra stuff for 'duped' BIO */ +# define BIO_CTRL_WPENDING 13/* opt - number of bytes still to write */ +# define BIO_CTRL_SET_CALLBACK 14/* opt - set callback function */ +# define BIO_CTRL_GET_CALLBACK 15/* opt - set callback function */ + +# define BIO_CTRL_PEEK 29/* BIO_f_buffer special */ +# define BIO_CTRL_SET_FILENAME 30/* BIO_s_file special */ + +/* dgram BIO stuff */ +# define BIO_CTRL_DGRAM_CONNECT 31/* BIO dgram special */ +# define BIO_CTRL_DGRAM_SET_CONNECTED 32/* allow for an externally connected + * socket to be passed in */ +# define BIO_CTRL_DGRAM_SET_RECV_TIMEOUT 33/* setsockopt, essentially */ +# define BIO_CTRL_DGRAM_GET_RECV_TIMEOUT 34/* getsockopt, essentially */ +# define BIO_CTRL_DGRAM_SET_SEND_TIMEOUT 35/* setsockopt, essentially */ +# define BIO_CTRL_DGRAM_GET_SEND_TIMEOUT 36/* getsockopt, essentially */ + +# define BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP 37/* flag whether the last */ +# define BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP 38/* I/O operation tiemd out */ + +/* #ifdef IP_MTU_DISCOVER */ +# define BIO_CTRL_DGRAM_MTU_DISCOVER 39/* set DF bit on egress packets */ +/* #endif */ + +# define BIO_CTRL_DGRAM_QUERY_MTU 40/* as kernel for current MTU */ +# define BIO_CTRL_DGRAM_GET_FALLBACK_MTU 47 +# define BIO_CTRL_DGRAM_GET_MTU 41/* get cached value for MTU */ +# define BIO_CTRL_DGRAM_SET_MTU 42/* set cached value for MTU. + * want to use this if asking + * the kernel fails */ + +# define BIO_CTRL_DGRAM_MTU_EXCEEDED 43/* check whether the MTU was + * exceed in the previous write + * operation */ + +# define BIO_CTRL_DGRAM_GET_PEER 46 +# define BIO_CTRL_DGRAM_SET_PEER 44/* Destination for the data */ + +# define BIO_CTRL_DGRAM_SET_NEXT_TIMEOUT 45/* Next DTLS handshake timeout + * to adjust socket timeouts */ +# define BIO_CTRL_DGRAM_SET_DONT_FRAG 48 + +# define BIO_CTRL_DGRAM_GET_MTU_OVERHEAD 49 + +/* Deliberately outside of OPENSSL_NO_SCTP - used in bss_dgram.c */ +# define BIO_CTRL_DGRAM_SCTP_SET_IN_HANDSHAKE 50 +# ifndef OPENSSL_NO_SCTP +/* SCTP stuff */ +# define BIO_CTRL_DGRAM_SCTP_ADD_AUTH_KEY 51 +# define BIO_CTRL_DGRAM_SCTP_NEXT_AUTH_KEY 52 +# define BIO_CTRL_DGRAM_SCTP_AUTH_CCS_RCVD 53 +# define BIO_CTRL_DGRAM_SCTP_GET_SNDINFO 60 +# define BIO_CTRL_DGRAM_SCTP_SET_SNDINFO 61 +# define BIO_CTRL_DGRAM_SCTP_GET_RCVINFO 62 +# define BIO_CTRL_DGRAM_SCTP_SET_RCVINFO 63 +# define BIO_CTRL_DGRAM_SCTP_GET_PRINFO 64 +# define BIO_CTRL_DGRAM_SCTP_SET_PRINFO 65 +# define BIO_CTRL_DGRAM_SCTP_SAVE_SHUTDOWN 70 +# endif + +# define BIO_CTRL_DGRAM_SET_PEEK_MODE 71 + +/* modifiers */ +# define BIO_FP_READ 0x02 +# define BIO_FP_WRITE 0x04 +# define BIO_FP_APPEND 0x08 +# define BIO_FP_TEXT 0x10 + +# define BIO_FLAGS_READ 0x01 +# define BIO_FLAGS_WRITE 0x02 +# define BIO_FLAGS_IO_SPECIAL 0x04 +# define BIO_FLAGS_RWS (BIO_FLAGS_READ|BIO_FLAGS_WRITE|BIO_FLAGS_IO_SPECIAL) +# define BIO_FLAGS_SHOULD_RETRY 0x08 +# ifndef BIO_FLAGS_UPLINK +/* + * "UPLINK" flag denotes file descriptors provided by application. It + * defaults to 0, as most platforms don't require UPLINK interface. + */ +# define BIO_FLAGS_UPLINK 0 +# endif + +# define BIO_FLAGS_BASE64_NO_NL 0x100 + +/* + * This is used with memory BIOs: + * BIO_FLAGS_MEM_RDONLY means we shouldn't free up or change the data in any way; + * BIO_FLAGS_NONCLEAR_RST means we shouldn't clear data on reset. + */ +# define BIO_FLAGS_MEM_RDONLY 0x200 +# define BIO_FLAGS_NONCLEAR_RST 0x400 +# define BIO_FLAGS_IN_EOF 0x800 + +typedef union bio_addr_st BIO_ADDR; +typedef struct bio_addrinfo_st BIO_ADDRINFO; + +int BIO_get_new_index(void); +void BIO_set_flags(BIO *b, int flags); +int BIO_test_flags(const BIO *b, int flags); +void BIO_clear_flags(BIO *b, int flags); + +# define BIO_get_flags(b) BIO_test_flags(b, ~(0x0)) +# define BIO_set_retry_special(b) \ + BIO_set_flags(b, (BIO_FLAGS_IO_SPECIAL|BIO_FLAGS_SHOULD_RETRY)) +# define BIO_set_retry_read(b) \ + BIO_set_flags(b, (BIO_FLAGS_READ|BIO_FLAGS_SHOULD_RETRY)) +# define BIO_set_retry_write(b) \ + BIO_set_flags(b, (BIO_FLAGS_WRITE|BIO_FLAGS_SHOULD_RETRY)) + +/* These are normally used internally in BIOs */ +# define BIO_clear_retry_flags(b) \ + BIO_clear_flags(b, (BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY)) +# define BIO_get_retry_flags(b) \ + BIO_test_flags(b, (BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY)) + +/* These should be used by the application to tell why we should retry */ +# define BIO_should_read(a) BIO_test_flags(a, BIO_FLAGS_READ) +# define BIO_should_write(a) BIO_test_flags(a, BIO_FLAGS_WRITE) +# define BIO_should_io_special(a) BIO_test_flags(a, BIO_FLAGS_IO_SPECIAL) +# define BIO_retry_type(a) BIO_test_flags(a, BIO_FLAGS_RWS) +# define BIO_should_retry(a) BIO_test_flags(a, BIO_FLAGS_SHOULD_RETRY) + +/* + * The next three are used in conjunction with the BIO_should_io_special() + * condition. After this returns true, BIO *BIO_get_retry_BIO(BIO *bio, int + * *reason); will walk the BIO stack and return the 'reason' for the special + * and the offending BIO. Given a BIO, BIO_get_retry_reason(bio) will return + * the code. + */ +/* + * Returned from the SSL bio when the certificate retrieval code had an error + */ +# define BIO_RR_SSL_X509_LOOKUP 0x01 +/* Returned from the connect BIO when a connect would have blocked */ +# define BIO_RR_CONNECT 0x02 +/* Returned from the accept BIO when an accept would have blocked */ +# define BIO_RR_ACCEPT 0x03 + +/* These are passed by the BIO callback */ +# define BIO_CB_FREE 0x01 +# define BIO_CB_READ 0x02 +# define BIO_CB_WRITE 0x03 +# define BIO_CB_PUTS 0x04 +# define BIO_CB_GETS 0x05 +# define BIO_CB_CTRL 0x06 + +/* + * The callback is called before and after the underling operation, The + * BIO_CB_RETURN flag indicates if it is after the call + */ +# define BIO_CB_RETURN 0x80 +# define BIO_CB_return(a) ((a)|BIO_CB_RETURN) +# define BIO_cb_pre(a) (!((a)&BIO_CB_RETURN)) +# define BIO_cb_post(a) ((a)&BIO_CB_RETURN) + +typedef long (*BIO_callback_fn)(BIO *b, int oper, const char *argp, int argi, + long argl, long ret); +typedef long (*BIO_callback_fn_ex)(BIO *b, int oper, const char *argp, + size_t len, int argi, + long argl, int ret, size_t *processed); +BIO_callback_fn BIO_get_callback(const BIO *b); +void BIO_set_callback(BIO *b, BIO_callback_fn callback); + +BIO_callback_fn_ex BIO_get_callback_ex(const BIO *b); +void BIO_set_callback_ex(BIO *b, BIO_callback_fn_ex callback); + +char *BIO_get_callback_arg(const BIO *b); +void BIO_set_callback_arg(BIO *b, char *arg); + +typedef struct bio_method_st BIO_METHOD; + +const char *BIO_method_name(const BIO *b); +int BIO_method_type(const BIO *b); + +typedef int BIO_info_cb(BIO *, int, int); +typedef BIO_info_cb bio_info_cb; /* backward compatibility */ + +DEFINE_STACK_OF(BIO) + +/* Prefix and suffix callback in ASN1 BIO */ +typedef int asn1_ps_func (BIO *b, unsigned char **pbuf, int *plen, + void *parg); + +# ifndef OPENSSL_NO_SCTP +/* SCTP parameter structs */ +struct bio_dgram_sctp_sndinfo { + uint16_t snd_sid; + uint16_t snd_flags; + uint32_t snd_ppid; + uint32_t snd_context; +}; + +struct bio_dgram_sctp_rcvinfo { + uint16_t rcv_sid; + uint16_t rcv_ssn; + uint16_t rcv_flags; + uint32_t rcv_ppid; + uint32_t rcv_tsn; + uint32_t rcv_cumtsn; + uint32_t rcv_context; +}; + +struct bio_dgram_sctp_prinfo { + uint16_t pr_policy; + uint32_t pr_value; +}; +# endif + +/* + * #define BIO_CONN_get_param_hostname BIO_ctrl + */ + +# define BIO_C_SET_CONNECT 100 +# define BIO_C_DO_STATE_MACHINE 101 +# define BIO_C_SET_NBIO 102 +/* # define BIO_C_SET_PROXY_PARAM 103 */ +# define BIO_C_SET_FD 104 +# define BIO_C_GET_FD 105 +# define BIO_C_SET_FILE_PTR 106 +# define BIO_C_GET_FILE_PTR 107 +# define BIO_C_SET_FILENAME 108 +# define BIO_C_SET_SSL 109 +# define BIO_C_GET_SSL 110 +# define BIO_C_SET_MD 111 +# define BIO_C_GET_MD 112 +# define BIO_C_GET_CIPHER_STATUS 113 +# define BIO_C_SET_BUF_MEM 114 +# define BIO_C_GET_BUF_MEM_PTR 115 +# define BIO_C_GET_BUFF_NUM_LINES 116 +# define BIO_C_SET_BUFF_SIZE 117 +# define BIO_C_SET_ACCEPT 118 +# define BIO_C_SSL_MODE 119 +# define BIO_C_GET_MD_CTX 120 +/* # define BIO_C_GET_PROXY_PARAM 121 */ +# define BIO_C_SET_BUFF_READ_DATA 122/* data to read first */ +# define BIO_C_GET_CONNECT 123 +# define BIO_C_GET_ACCEPT 124 +# define BIO_C_SET_SSL_RENEGOTIATE_BYTES 125 +# define BIO_C_GET_SSL_NUM_RENEGOTIATES 126 +# define BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT 127 +# define BIO_C_FILE_SEEK 128 +# define BIO_C_GET_CIPHER_CTX 129 +# define BIO_C_SET_BUF_MEM_EOF_RETURN 130/* return end of input + * value */ +# define BIO_C_SET_BIND_MODE 131 +# define BIO_C_GET_BIND_MODE 132 +# define BIO_C_FILE_TELL 133 +# define BIO_C_GET_SOCKS 134 +# define BIO_C_SET_SOCKS 135 + +# define BIO_C_SET_WRITE_BUF_SIZE 136/* for BIO_s_bio */ +# define BIO_C_GET_WRITE_BUF_SIZE 137 +# define BIO_C_MAKE_BIO_PAIR 138 +# define BIO_C_DESTROY_BIO_PAIR 139 +# define BIO_C_GET_WRITE_GUARANTEE 140 +# define BIO_C_GET_READ_REQUEST 141 +# define BIO_C_SHUTDOWN_WR 142 +# define BIO_C_NREAD0 143 +# define BIO_C_NREAD 144 +# define BIO_C_NWRITE0 145 +# define BIO_C_NWRITE 146 +# define BIO_C_RESET_READ_REQUEST 147 +# define BIO_C_SET_MD_CTX 148 + +# define BIO_C_SET_PREFIX 149 +# define BIO_C_GET_PREFIX 150 +# define BIO_C_SET_SUFFIX 151 +# define BIO_C_GET_SUFFIX 152 + +# define BIO_C_SET_EX_ARG 153 +# define BIO_C_GET_EX_ARG 154 + +# define BIO_C_SET_CONNECT_MODE 155 + +# define BIO_set_app_data(s,arg) BIO_set_ex_data(s,0,arg) +# define BIO_get_app_data(s) BIO_get_ex_data(s,0) + +# define BIO_set_nbio(b,n) BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL) + +# ifndef OPENSSL_NO_SOCK +/* IP families we support, for BIO_s_connect() and BIO_s_accept() */ +/* Note: the underlying operating system may not support some of them */ +# define BIO_FAMILY_IPV4 4 +# define BIO_FAMILY_IPV6 6 +# define BIO_FAMILY_IPANY 256 + +/* BIO_s_connect() */ +# define BIO_set_conn_hostname(b,name) BIO_ctrl(b,BIO_C_SET_CONNECT,0, \ + (char *)(name)) +# define BIO_set_conn_port(b,port) BIO_ctrl(b,BIO_C_SET_CONNECT,1, \ + (char *)(port)) +# define BIO_set_conn_address(b,addr) BIO_ctrl(b,BIO_C_SET_CONNECT,2, \ + (char *)(addr)) +# define BIO_set_conn_ip_family(b,f) BIO_int_ctrl(b,BIO_C_SET_CONNECT,3,f) +# define BIO_get_conn_hostname(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,0)) +# define BIO_get_conn_port(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,1)) +# define BIO_get_conn_address(b) ((const BIO_ADDR *)BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,2)) +# define BIO_get_conn_ip_family(b) BIO_ctrl(b,BIO_C_GET_CONNECT,3,NULL) +# define BIO_set_conn_mode(b,n) BIO_ctrl(b,BIO_C_SET_CONNECT_MODE,(n),NULL) + +/* BIO_s_accept() */ +# define BIO_set_accept_name(b,name) BIO_ctrl(b,BIO_C_SET_ACCEPT,0, \ + (char *)(name)) +# define BIO_set_accept_port(b,port) BIO_ctrl(b,BIO_C_SET_ACCEPT,1, \ + (char *)(port)) +# define BIO_get_accept_name(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,0)) +# define BIO_get_accept_port(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,1)) +# define BIO_get_peer_name(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,2)) +# define BIO_get_peer_port(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,3)) +/* #define BIO_set_nbio(b,n) BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL) */ +# define BIO_set_nbio_accept(b,n) BIO_ctrl(b,BIO_C_SET_ACCEPT,2,(n)?(void *)"a":NULL) +# define BIO_set_accept_bios(b,bio) BIO_ctrl(b,BIO_C_SET_ACCEPT,3, \ + (char *)(bio)) +# define BIO_set_accept_ip_family(b,f) BIO_int_ctrl(b,BIO_C_SET_ACCEPT,4,f) +# define BIO_get_accept_ip_family(b) BIO_ctrl(b,BIO_C_GET_ACCEPT,4,NULL) + +/* Aliases kept for backward compatibility */ +# define BIO_BIND_NORMAL 0 +# define BIO_BIND_REUSEADDR BIO_SOCK_REUSEADDR +# define BIO_BIND_REUSEADDR_IF_UNUSED BIO_SOCK_REUSEADDR +# define BIO_set_bind_mode(b,mode) BIO_ctrl(b,BIO_C_SET_BIND_MODE,mode,NULL) +# define BIO_get_bind_mode(b) BIO_ctrl(b,BIO_C_GET_BIND_MODE,0,NULL) + +/* BIO_s_accept() and BIO_s_connect() */ +# define BIO_do_connect(b) BIO_do_handshake(b) +# define BIO_do_accept(b) BIO_do_handshake(b) +# endif /* OPENSSL_NO_SOCK */ + +# define BIO_do_handshake(b) BIO_ctrl(b,BIO_C_DO_STATE_MACHINE,0,NULL) + +/* BIO_s_datagram(), BIO_s_fd(), BIO_s_socket(), BIO_s_accept() and BIO_s_connect() */ +# define BIO_set_fd(b,fd,c) BIO_int_ctrl(b,BIO_C_SET_FD,c,fd) +# define BIO_get_fd(b,c) BIO_ctrl(b,BIO_C_GET_FD,0,(char *)(c)) + +/* BIO_s_file() */ +# define BIO_set_fp(b,fp,c) BIO_ctrl(b,BIO_C_SET_FILE_PTR,c,(char *)(fp)) +# define BIO_get_fp(b,fpp) BIO_ctrl(b,BIO_C_GET_FILE_PTR,0,(char *)(fpp)) + +/* BIO_s_fd() and BIO_s_file() */ +# define BIO_seek(b,ofs) (int)BIO_ctrl(b,BIO_C_FILE_SEEK,ofs,NULL) +# define BIO_tell(b) (int)BIO_ctrl(b,BIO_C_FILE_TELL,0,NULL) + +/* + * name is cast to lose const, but might be better to route through a + * function so we can do it safely + */ +# ifdef CONST_STRICT +/* + * If you are wondering why this isn't defined, its because CONST_STRICT is + * purely a compile-time kludge to allow const to be checked. + */ +int BIO_read_filename(BIO *b, const char *name); +# else +# define BIO_read_filename(b,name) (int)BIO_ctrl(b,BIO_C_SET_FILENAME, \ + BIO_CLOSE|BIO_FP_READ,(char *)(name)) +# endif +# define BIO_write_filename(b,name) (int)BIO_ctrl(b,BIO_C_SET_FILENAME, \ + BIO_CLOSE|BIO_FP_WRITE,name) +# define BIO_append_filename(b,name) (int)BIO_ctrl(b,BIO_C_SET_FILENAME, \ + BIO_CLOSE|BIO_FP_APPEND,name) +# define BIO_rw_filename(b,name) (int)BIO_ctrl(b,BIO_C_SET_FILENAME, \ + BIO_CLOSE|BIO_FP_READ|BIO_FP_WRITE,name) + +/* + * WARNING WARNING, this ups the reference count on the read bio of the SSL + * structure. This is because the ssl read BIO is now pointed to by the + * next_bio field in the bio. So when you free the BIO, make sure you are + * doing a BIO_free_all() to catch the underlying BIO. + */ +# define BIO_set_ssl(b,ssl,c) BIO_ctrl(b,BIO_C_SET_SSL,c,(char *)(ssl)) +# define BIO_get_ssl(b,sslp) BIO_ctrl(b,BIO_C_GET_SSL,0,(char *)(sslp)) +# define BIO_set_ssl_mode(b,client) BIO_ctrl(b,BIO_C_SSL_MODE,client,NULL) +# define BIO_set_ssl_renegotiate_bytes(b,num) \ + BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_BYTES,num,NULL) +# define BIO_get_num_renegotiates(b) \ + BIO_ctrl(b,BIO_C_GET_SSL_NUM_RENEGOTIATES,0,NULL) +# define BIO_set_ssl_renegotiate_timeout(b,seconds) \ + BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT,seconds,NULL) + +/* defined in evp.h */ +/* #define BIO_set_md(b,md) BIO_ctrl(b,BIO_C_SET_MD,1,(char *)(md)) */ + +# define BIO_get_mem_data(b,pp) BIO_ctrl(b,BIO_CTRL_INFO,0,(char *)(pp)) +# define BIO_set_mem_buf(b,bm,c) BIO_ctrl(b,BIO_C_SET_BUF_MEM,c,(char *)(bm)) +# define BIO_get_mem_ptr(b,pp) BIO_ctrl(b,BIO_C_GET_BUF_MEM_PTR,0, \ + (char *)(pp)) +# define BIO_set_mem_eof_return(b,v) \ + BIO_ctrl(b,BIO_C_SET_BUF_MEM_EOF_RETURN,v,NULL) + +/* For the BIO_f_buffer() type */ +# define BIO_get_buffer_num_lines(b) BIO_ctrl(b,BIO_C_GET_BUFF_NUM_LINES,0,NULL) +# define BIO_set_buffer_size(b,size) BIO_ctrl(b,BIO_C_SET_BUFF_SIZE,size,NULL) +# define BIO_set_read_buffer_size(b,size) BIO_int_ctrl(b,BIO_C_SET_BUFF_SIZE,size,0) +# define BIO_set_write_buffer_size(b,size) BIO_int_ctrl(b,BIO_C_SET_BUFF_SIZE,size,1) +# define BIO_set_buffer_read_data(b,buf,num) BIO_ctrl(b,BIO_C_SET_BUFF_READ_DATA,num,buf) + +/* Don't use the next one unless you know what you are doing :-) */ +# define BIO_dup_state(b,ret) BIO_ctrl(b,BIO_CTRL_DUP,0,(char *)(ret)) + +# define BIO_reset(b) (int)BIO_ctrl(b,BIO_CTRL_RESET,0,NULL) +# define BIO_eof(b) (int)BIO_ctrl(b,BIO_CTRL_EOF,0,NULL) +# define BIO_set_close(b,c) (int)BIO_ctrl(b,BIO_CTRL_SET_CLOSE,(c),NULL) +# define BIO_get_close(b) (int)BIO_ctrl(b,BIO_CTRL_GET_CLOSE,0,NULL) +# define BIO_pending(b) (int)BIO_ctrl(b,BIO_CTRL_PENDING,0,NULL) +# define BIO_wpending(b) (int)BIO_ctrl(b,BIO_CTRL_WPENDING,0,NULL) +/* ...pending macros have inappropriate return type */ +size_t BIO_ctrl_pending(BIO *b); +size_t BIO_ctrl_wpending(BIO *b); +# define BIO_flush(b) (int)BIO_ctrl(b,BIO_CTRL_FLUSH,0,NULL) +# define BIO_get_info_callback(b,cbp) (int)BIO_ctrl(b,BIO_CTRL_GET_CALLBACK,0, \ + cbp) +# define BIO_set_info_callback(b,cb) (int)BIO_callback_ctrl(b,BIO_CTRL_SET_CALLBACK,cb) + +/* For the BIO_f_buffer() type */ +# define BIO_buffer_get_num_lines(b) BIO_ctrl(b,BIO_CTRL_GET,0,NULL) +# define BIO_buffer_peek(b,s,l) BIO_ctrl(b,BIO_CTRL_PEEK,(l),(s)) + +/* For BIO_s_bio() */ +# define BIO_set_write_buf_size(b,size) (int)BIO_ctrl(b,BIO_C_SET_WRITE_BUF_SIZE,size,NULL) +# define BIO_get_write_buf_size(b,size) (size_t)BIO_ctrl(b,BIO_C_GET_WRITE_BUF_SIZE,size,NULL) +# define BIO_make_bio_pair(b1,b2) (int)BIO_ctrl(b1,BIO_C_MAKE_BIO_PAIR,0,b2) +# define BIO_destroy_bio_pair(b) (int)BIO_ctrl(b,BIO_C_DESTROY_BIO_PAIR,0,NULL) +# define BIO_shutdown_wr(b) (int)BIO_ctrl(b, BIO_C_SHUTDOWN_WR, 0, NULL) +/* macros with inappropriate type -- but ...pending macros use int too: */ +# define BIO_get_write_guarantee(b) (int)BIO_ctrl(b,BIO_C_GET_WRITE_GUARANTEE,0,NULL) +# define BIO_get_read_request(b) (int)BIO_ctrl(b,BIO_C_GET_READ_REQUEST,0,NULL) +size_t BIO_ctrl_get_write_guarantee(BIO *b); +size_t BIO_ctrl_get_read_request(BIO *b); +int BIO_ctrl_reset_read_request(BIO *b); + +/* ctrl macros for dgram */ +# define BIO_ctrl_dgram_connect(b,peer) \ + (int)BIO_ctrl(b,BIO_CTRL_DGRAM_CONNECT,0, (char *)(peer)) +# define BIO_ctrl_set_connected(b,peer) \ + (int)BIO_ctrl(b, BIO_CTRL_DGRAM_SET_CONNECTED, 0, (char *)(peer)) +# define BIO_dgram_recv_timedout(b) \ + (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP, 0, NULL) +# define BIO_dgram_send_timedout(b) \ + (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP, 0, NULL) +# define BIO_dgram_get_peer(b,peer) \ + (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_PEER, 0, (char *)(peer)) +# define BIO_dgram_set_peer(b,peer) \ + (int)BIO_ctrl(b, BIO_CTRL_DGRAM_SET_PEER, 0, (char *)(peer)) +# define BIO_dgram_get_mtu_overhead(b) \ + (unsigned int)BIO_ctrl((b), BIO_CTRL_DGRAM_GET_MTU_OVERHEAD, 0, NULL) + +#define BIO_get_ex_new_index(l, p, newf, dupf, freef) \ + CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_BIO, l, p, newf, dupf, freef) +int BIO_set_ex_data(BIO *bio, int idx, void *data); +void *BIO_get_ex_data(BIO *bio, int idx); +uint64_t BIO_number_read(BIO *bio); +uint64_t BIO_number_written(BIO *bio); + +/* For BIO_f_asn1() */ +int BIO_asn1_set_prefix(BIO *b, asn1_ps_func *prefix, + asn1_ps_func *prefix_free); +int BIO_asn1_get_prefix(BIO *b, asn1_ps_func **pprefix, + asn1_ps_func **pprefix_free); +int BIO_asn1_set_suffix(BIO *b, asn1_ps_func *suffix, + asn1_ps_func *suffix_free); +int BIO_asn1_get_suffix(BIO *b, asn1_ps_func **psuffix, + asn1_ps_func **psuffix_free); + +const BIO_METHOD *BIO_s_file(void); +BIO *BIO_new_file(const char *filename, const char *mode); +# ifndef OPENSSL_NO_STDIO +BIO *BIO_new_fp(FILE *stream, int close_flag); +# endif +BIO *BIO_new(const BIO_METHOD *type); +int BIO_free(BIO *a); +void BIO_set_data(BIO *a, void *ptr); +void *BIO_get_data(BIO *a); +void BIO_set_init(BIO *a, int init); +int BIO_get_init(BIO *a); +void BIO_set_shutdown(BIO *a, int shut); +int BIO_get_shutdown(BIO *a); +void BIO_vfree(BIO *a); +int BIO_up_ref(BIO *a); +int BIO_read(BIO *b, void *data, int dlen); +int BIO_read_ex(BIO *b, void *data, size_t dlen, size_t *readbytes); +int BIO_gets(BIO *bp, char *buf, int size); +int BIO_write(BIO *b, const void *data, int dlen); +int BIO_write_ex(BIO *b, const void *data, size_t dlen, size_t *written); +int BIO_puts(BIO *bp, const char *buf); +int BIO_indent(BIO *b, int indent, int max); +long BIO_ctrl(BIO *bp, int cmd, long larg, void *parg); +long BIO_callback_ctrl(BIO *b, int cmd, BIO_info_cb *fp); +void *BIO_ptr_ctrl(BIO *bp, int cmd, long larg); +long BIO_int_ctrl(BIO *bp, int cmd, long larg, int iarg); +BIO *BIO_push(BIO *b, BIO *append); +BIO *BIO_pop(BIO *b); +void BIO_free_all(BIO *a); +BIO *BIO_find_type(BIO *b, int bio_type); +BIO *BIO_next(BIO *b); +void BIO_set_next(BIO *b, BIO *next); +BIO *BIO_get_retry_BIO(BIO *bio, int *reason); +int BIO_get_retry_reason(BIO *bio); +void BIO_set_retry_reason(BIO *bio, int reason); +BIO *BIO_dup_chain(BIO *in); + +int BIO_nread0(BIO *bio, char **buf); +int BIO_nread(BIO *bio, char **buf, int num); +int BIO_nwrite0(BIO *bio, char **buf); +int BIO_nwrite(BIO *bio, char **buf, int num); + +long BIO_debug_callback(BIO *bio, int cmd, const char *argp, int argi, + long argl, long ret); + +const BIO_METHOD *BIO_s_mem(void); +const BIO_METHOD *BIO_s_secmem(void); +BIO *BIO_new_mem_buf(const void *buf, int len); +# ifndef OPENSSL_NO_SOCK +const BIO_METHOD *BIO_s_socket(void); +const BIO_METHOD *BIO_s_connect(void); +const BIO_METHOD *BIO_s_accept(void); +# endif +const BIO_METHOD *BIO_s_fd(void); +const BIO_METHOD *BIO_s_log(void); +const BIO_METHOD *BIO_s_bio(void); +const BIO_METHOD *BIO_s_null(void); +const BIO_METHOD *BIO_f_null(void); +const BIO_METHOD *BIO_f_buffer(void); +const BIO_METHOD *BIO_f_linebuffer(void); +const BIO_METHOD *BIO_f_nbio_test(void); +# ifndef OPENSSL_NO_DGRAM +const BIO_METHOD *BIO_s_datagram(void); +int BIO_dgram_non_fatal_error(int error); +BIO *BIO_new_dgram(int fd, int close_flag); +# ifndef OPENSSL_NO_SCTP +const BIO_METHOD *BIO_s_datagram_sctp(void); +BIO *BIO_new_dgram_sctp(int fd, int close_flag); +int BIO_dgram_is_sctp(BIO *bio); +int BIO_dgram_sctp_notification_cb(BIO *b, + void (*handle_notifications) (BIO *bio, + void *context, + void *buf), + void *context); +int BIO_dgram_sctp_wait_for_dry(BIO *b); +int BIO_dgram_sctp_msg_waiting(BIO *b); +# endif +# endif + +# ifndef OPENSSL_NO_SOCK +int BIO_sock_should_retry(int i); +int BIO_sock_non_fatal_error(int error); +# endif + +int BIO_fd_should_retry(int i); +int BIO_fd_non_fatal_error(int error); +int BIO_dump_cb(int (*cb) (const void *data, size_t len, void *u), + void *u, const char *s, int len); +int BIO_dump_indent_cb(int (*cb) (const void *data, size_t len, void *u), + void *u, const char *s, int len, int indent); +int BIO_dump(BIO *b, const char *bytes, int len); +int BIO_dump_indent(BIO *b, const char *bytes, int len, int indent); +# ifndef OPENSSL_NO_STDIO +int BIO_dump_fp(FILE *fp, const char *s, int len); +int BIO_dump_indent_fp(FILE *fp, const char *s, int len, int indent); +# endif +int BIO_hex_string(BIO *out, int indent, int width, unsigned char *data, + int datalen); + +# ifndef OPENSSL_NO_SOCK +BIO_ADDR *BIO_ADDR_new(void); +int BIO_ADDR_rawmake(BIO_ADDR *ap, int family, + const void *where, size_t wherelen, unsigned short port); +void BIO_ADDR_free(BIO_ADDR *); +void BIO_ADDR_clear(BIO_ADDR *ap); +int BIO_ADDR_family(const BIO_ADDR *ap); +int BIO_ADDR_rawaddress(const BIO_ADDR *ap, void *p, size_t *l); +unsigned short BIO_ADDR_rawport(const BIO_ADDR *ap); +char *BIO_ADDR_hostname_string(const BIO_ADDR *ap, int numeric); +char *BIO_ADDR_service_string(const BIO_ADDR *ap, int numeric); +char *BIO_ADDR_path_string(const BIO_ADDR *ap); + +const BIO_ADDRINFO *BIO_ADDRINFO_next(const BIO_ADDRINFO *bai); +int BIO_ADDRINFO_family(const BIO_ADDRINFO *bai); +int BIO_ADDRINFO_socktype(const BIO_ADDRINFO *bai); +int BIO_ADDRINFO_protocol(const BIO_ADDRINFO *bai); +const BIO_ADDR *BIO_ADDRINFO_address(const BIO_ADDRINFO *bai); +void BIO_ADDRINFO_free(BIO_ADDRINFO *bai); + +enum BIO_hostserv_priorities { + BIO_PARSE_PRIO_HOST, BIO_PARSE_PRIO_SERV +}; +int BIO_parse_hostserv(const char *hostserv, char **host, char **service, + enum BIO_hostserv_priorities hostserv_prio); +enum BIO_lookup_type { + BIO_LOOKUP_CLIENT, BIO_LOOKUP_SERVER +}; +int BIO_lookup(const char *host, const char *service, + enum BIO_lookup_type lookup_type, + int family, int socktype, BIO_ADDRINFO **res); +int BIO_lookup_ex(const char *host, const char *service, + int lookup_type, int family, int socktype, int protocol, + BIO_ADDRINFO **res); +int BIO_sock_error(int sock); +int BIO_socket_ioctl(int fd, long type, void *arg); +int BIO_socket_nbio(int fd, int mode); +int BIO_sock_init(void); +# if OPENSSL_API_COMPAT < 0x10100000L +# define BIO_sock_cleanup() while(0) continue +# endif +int BIO_set_tcp_ndelay(int sock, int turn_on); + +DEPRECATEDIN_1_1_0(struct hostent *BIO_gethostbyname(const char *name)) +DEPRECATEDIN_1_1_0(int BIO_get_port(const char *str, unsigned short *port_ptr)) +DEPRECATEDIN_1_1_0(int BIO_get_host_ip(const char *str, unsigned char *ip)) +DEPRECATEDIN_1_1_0(int BIO_get_accept_socket(char *host_port, int mode)) +DEPRECATEDIN_1_1_0(int BIO_accept(int sock, char **ip_port)) + +union BIO_sock_info_u { + BIO_ADDR *addr; +}; +enum BIO_sock_info_type { + BIO_SOCK_INFO_ADDRESS +}; +int BIO_sock_info(int sock, + enum BIO_sock_info_type type, union BIO_sock_info_u *info); + +# define BIO_SOCK_REUSEADDR 0x01 +# define BIO_SOCK_V6_ONLY 0x02 +# define BIO_SOCK_KEEPALIVE 0x04 +# define BIO_SOCK_NONBLOCK 0x08 +# define BIO_SOCK_NODELAY 0x10 + +int BIO_socket(int domain, int socktype, int protocol, int options); +int BIO_connect(int sock, const BIO_ADDR *addr, int options); +int BIO_bind(int sock, const BIO_ADDR *addr, int options); +int BIO_listen(int sock, const BIO_ADDR *addr, int options); +int BIO_accept_ex(int accept_sock, BIO_ADDR *addr, int options); +int BIO_closesocket(int sock); + +BIO *BIO_new_socket(int sock, int close_flag); +BIO *BIO_new_connect(const char *host_port); +BIO *BIO_new_accept(const char *host_port); +# endif /* OPENSSL_NO_SOCK*/ + +BIO *BIO_new_fd(int fd, int close_flag); + +int BIO_new_bio_pair(BIO **bio1, size_t writebuf1, + BIO **bio2, size_t writebuf2); +/* + * If successful, returns 1 and in *bio1, *bio2 two BIO pair endpoints. + * Otherwise returns 0 and sets *bio1 and *bio2 to NULL. Size 0 uses default + * value. + */ + +void BIO_copy_next_retry(BIO *b); + +/* + * long BIO_ghbn_ctrl(int cmd,int iarg,char *parg); + */ + +# define ossl_bio__attr__(x) +# if defined(__GNUC__) && defined(__STDC_VERSION__) \ + && !defined(__APPLE__) + /* + * Because we support the 'z' modifier, which made its appearance in C99, + * we can't use __attribute__ with pre C99 dialects. + */ +# if __STDC_VERSION__ >= 199901L +# undef ossl_bio__attr__ +# define ossl_bio__attr__ __attribute__ +# if __GNUC__*10 + __GNUC_MINOR__ >= 44 +# define ossl_bio__printf__ __gnu_printf__ +# else +# define ossl_bio__printf__ __printf__ +# endif +# endif +# endif +int BIO_printf(BIO *bio, const char *format, ...) +ossl_bio__attr__((__format__(ossl_bio__printf__, 2, 3))); +int BIO_vprintf(BIO *bio, const char *format, va_list args) +ossl_bio__attr__((__format__(ossl_bio__printf__, 2, 0))); +int BIO_snprintf(char *buf, size_t n, const char *format, ...) +ossl_bio__attr__((__format__(ossl_bio__printf__, 3, 4))); +int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args) +ossl_bio__attr__((__format__(ossl_bio__printf__, 3, 0))); +# undef ossl_bio__attr__ +# undef ossl_bio__printf__ + + +BIO_METHOD *BIO_meth_new(int type, const char *name); +void BIO_meth_free(BIO_METHOD *biom); +int (*BIO_meth_get_write(const BIO_METHOD *biom)) (BIO *, const char *, int); +int (*BIO_meth_get_write_ex(const BIO_METHOD *biom)) (BIO *, const char *, size_t, + size_t *); +int BIO_meth_set_write(BIO_METHOD *biom, + int (*write) (BIO *, const char *, int)); +int BIO_meth_set_write_ex(BIO_METHOD *biom, + int (*bwrite) (BIO *, const char *, size_t, size_t *)); +int (*BIO_meth_get_read(const BIO_METHOD *biom)) (BIO *, char *, int); +int (*BIO_meth_get_read_ex(const BIO_METHOD *biom)) (BIO *, char *, size_t, size_t *); +int BIO_meth_set_read(BIO_METHOD *biom, + int (*read) (BIO *, char *, int)); +int BIO_meth_set_read_ex(BIO_METHOD *biom, + int (*bread) (BIO *, char *, size_t, size_t *)); +int (*BIO_meth_get_puts(const BIO_METHOD *biom)) (BIO *, const char *); +int BIO_meth_set_puts(BIO_METHOD *biom, + int (*puts) (BIO *, const char *)); +int (*BIO_meth_get_gets(const BIO_METHOD *biom)) (BIO *, char *, int); +int BIO_meth_set_gets(BIO_METHOD *biom, + int (*gets) (BIO *, char *, int)); +long (*BIO_meth_get_ctrl(const BIO_METHOD *biom)) (BIO *, int, long, void *); +int BIO_meth_set_ctrl(BIO_METHOD *biom, + long (*ctrl) (BIO *, int, long, void *)); +int (*BIO_meth_get_create(const BIO_METHOD *bion)) (BIO *); +int BIO_meth_set_create(BIO_METHOD *biom, int (*create) (BIO *)); +int (*BIO_meth_get_destroy(const BIO_METHOD *biom)) (BIO *); +int BIO_meth_set_destroy(BIO_METHOD *biom, int (*destroy) (BIO *)); +long (*BIO_meth_get_callback_ctrl(const BIO_METHOD *biom)) + (BIO *, int, BIO_info_cb *); +int BIO_meth_set_callback_ctrl(BIO_METHOD *biom, + long (*callback_ctrl) (BIO *, int, + BIO_info_cb *)); + +# ifdef __cplusplus +} +# endif +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/bioerr.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/bioerr.h new file mode 100644 index 0000000..46e2c96 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/bioerr.h @@ -0,0 +1,124 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_BIOERR_H +# define HEADER_BIOERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_BIO_strings(void); + +/* + * BIO function codes. + */ +# define BIO_F_ACPT_STATE 100 +# define BIO_F_ADDRINFO_WRAP 148 +# define BIO_F_ADDR_STRINGS 134 +# define BIO_F_BIO_ACCEPT 101 +# define BIO_F_BIO_ACCEPT_EX 137 +# define BIO_F_BIO_ACCEPT_NEW 152 +# define BIO_F_BIO_ADDR_NEW 144 +# define BIO_F_BIO_BIND 147 +# define BIO_F_BIO_CALLBACK_CTRL 131 +# define BIO_F_BIO_CONNECT 138 +# define BIO_F_BIO_CONNECT_NEW 153 +# define BIO_F_BIO_CTRL 103 +# define BIO_F_BIO_GETS 104 +# define BIO_F_BIO_GET_HOST_IP 106 +# define BIO_F_BIO_GET_NEW_INDEX 102 +# define BIO_F_BIO_GET_PORT 107 +# define BIO_F_BIO_LISTEN 139 +# define BIO_F_BIO_LOOKUP 135 +# define BIO_F_BIO_LOOKUP_EX 143 +# define BIO_F_BIO_MAKE_PAIR 121 +# define BIO_F_BIO_METH_NEW 146 +# define BIO_F_BIO_NEW 108 +# define BIO_F_BIO_NEW_DGRAM_SCTP 145 +# define BIO_F_BIO_NEW_FILE 109 +# define BIO_F_BIO_NEW_MEM_BUF 126 +# define BIO_F_BIO_NREAD 123 +# define BIO_F_BIO_NREAD0 124 +# define BIO_F_BIO_NWRITE 125 +# define BIO_F_BIO_NWRITE0 122 +# define BIO_F_BIO_PARSE_HOSTSERV 136 +# define BIO_F_BIO_PUTS 110 +# define BIO_F_BIO_READ 111 +# define BIO_F_BIO_READ_EX 105 +# define BIO_F_BIO_READ_INTERN 120 +# define BIO_F_BIO_SOCKET 140 +# define BIO_F_BIO_SOCKET_NBIO 142 +# define BIO_F_BIO_SOCK_INFO 141 +# define BIO_F_BIO_SOCK_INIT 112 +# define BIO_F_BIO_WRITE 113 +# define BIO_F_BIO_WRITE_EX 119 +# define BIO_F_BIO_WRITE_INTERN 128 +# define BIO_F_BUFFER_CTRL 114 +# define BIO_F_CONN_CTRL 127 +# define BIO_F_CONN_STATE 115 +# define BIO_F_DGRAM_SCTP_NEW 149 +# define BIO_F_DGRAM_SCTP_READ 132 +# define BIO_F_DGRAM_SCTP_WRITE 133 +# define BIO_F_DOAPR_OUTCH 150 +# define BIO_F_FILE_CTRL 116 +# define BIO_F_FILE_READ 130 +# define BIO_F_LINEBUFFER_CTRL 129 +# define BIO_F_LINEBUFFER_NEW 151 +# define BIO_F_MEM_WRITE 117 +# define BIO_F_NBIOF_NEW 154 +# define BIO_F_SLG_WRITE 155 +# define BIO_F_SSL_NEW 118 + +/* + * BIO reason codes. + */ +# define BIO_R_ACCEPT_ERROR 100 +# define BIO_R_ADDRINFO_ADDR_IS_NOT_AF_INET 141 +# define BIO_R_AMBIGUOUS_HOST_OR_SERVICE 129 +# define BIO_R_BAD_FOPEN_MODE 101 +# define BIO_R_BROKEN_PIPE 124 +# define BIO_R_CONNECT_ERROR 103 +# define BIO_R_GETHOSTBYNAME_ADDR_IS_NOT_AF_INET 107 +# define BIO_R_GETSOCKNAME_ERROR 132 +# define BIO_R_GETSOCKNAME_TRUNCATED_ADDRESS 133 +# define BIO_R_GETTING_SOCKTYPE 134 +# define BIO_R_INVALID_ARGUMENT 125 +# define BIO_R_INVALID_SOCKET 135 +# define BIO_R_IN_USE 123 +# define BIO_R_LENGTH_TOO_LONG 102 +# define BIO_R_LISTEN_V6_ONLY 136 +# define BIO_R_LOOKUP_RETURNED_NOTHING 142 +# define BIO_R_MALFORMED_HOST_OR_SERVICE 130 +# define BIO_R_NBIO_CONNECT_ERROR 110 +# define BIO_R_NO_ACCEPT_ADDR_OR_SERVICE_SPECIFIED 143 +# define BIO_R_NO_HOSTNAME_OR_SERVICE_SPECIFIED 144 +# define BIO_R_NO_PORT_DEFINED 113 +# define BIO_R_NO_SUCH_FILE 128 +# define BIO_R_NULL_PARAMETER 115 +# define BIO_R_UNABLE_TO_BIND_SOCKET 117 +# define BIO_R_UNABLE_TO_CREATE_SOCKET 118 +# define BIO_R_UNABLE_TO_KEEPALIVE 137 +# define BIO_R_UNABLE_TO_LISTEN_SOCKET 119 +# define BIO_R_UNABLE_TO_NODELAY 138 +# define BIO_R_UNABLE_TO_REUSEADDR 139 +# define BIO_R_UNAVAILABLE_IP_FAMILY 145 +# define BIO_R_UNINITIALIZED 120 +# define BIO_R_UNKNOWN_INFO_TYPE 140 +# define BIO_R_UNSUPPORTED_IP_FAMILY 146 +# define BIO_R_UNSUPPORTED_METHOD 121 +# define BIO_R_UNSUPPORTED_PROTOCOL_FAMILY 131 +# define BIO_R_WRITE_TO_READ_ONLY_BIO 126 +# define BIO_R_WSASTARTUP 122 + +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/blowfish.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/blowfish.h new file mode 100644 index 0000000..cd3e460 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/blowfish.h @@ -0,0 +1,61 @@ +/* + * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_BLOWFISH_H +# define HEADER_BLOWFISH_H + +# include + +# ifndef OPENSSL_NO_BF +# include +# ifdef __cplusplus +extern "C" { +# endif + +# define BF_ENCRYPT 1 +# define BF_DECRYPT 0 + +/*- + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * ! BF_LONG has to be at least 32 bits wide. ! + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + */ +# define BF_LONG unsigned int + +# define BF_ROUNDS 16 +# define BF_BLOCK 8 + +typedef struct bf_key_st { + BF_LONG P[BF_ROUNDS + 2]; + BF_LONG S[4 * 256]; +} BF_KEY; + +void BF_set_key(BF_KEY *key, int len, const unsigned char *data); + +void BF_encrypt(BF_LONG *data, const BF_KEY *key); +void BF_decrypt(BF_LONG *data, const BF_KEY *key); + +void BF_ecb_encrypt(const unsigned char *in, unsigned char *out, + const BF_KEY *key, int enc); +void BF_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, + const BF_KEY *schedule, unsigned char *ivec, int enc); +void BF_cfb64_encrypt(const unsigned char *in, unsigned char *out, + long length, const BF_KEY *schedule, + unsigned char *ivec, int *num, int enc); +void BF_ofb64_encrypt(const unsigned char *in, unsigned char *out, + long length, const BF_KEY *schedule, + unsigned char *ivec, int *num); +const char *BF_options(void); + +# ifdef __cplusplus +} +# endif +# endif + +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/bn.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/bn.h new file mode 100644 index 0000000..8af05d0 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/bn.h @@ -0,0 +1,539 @@ +/* + * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. + * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_BN_H +# define HEADER_BN_H + +# include +# ifndef OPENSSL_NO_STDIO +# include +# endif +# include +# include +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * 64-bit processor with LP64 ABI + */ +# ifdef SIXTY_FOUR_BIT_LONG +# define BN_ULONG unsigned long +# define BN_BYTES 8 +# endif + +/* + * 64-bit processor other than LP64 ABI + */ +# ifdef SIXTY_FOUR_BIT +# define BN_ULONG unsigned long long +# define BN_BYTES 8 +# endif + +# ifdef THIRTY_TWO_BIT +# define BN_ULONG unsigned int +# define BN_BYTES 4 +# endif + +# define BN_BITS2 (BN_BYTES * 8) +# define BN_BITS (BN_BITS2 * 2) +# define BN_TBIT ((BN_ULONG)1 << (BN_BITS2 - 1)) + +# define BN_FLG_MALLOCED 0x01 +# define BN_FLG_STATIC_DATA 0x02 + +/* + * avoid leaking exponent information through timing, + * BN_mod_exp_mont() will call BN_mod_exp_mont_consttime, + * BN_div() will call BN_div_no_branch, + * BN_mod_inverse() will call BN_mod_inverse_no_branch. + */ +# define BN_FLG_CONSTTIME 0x04 +# define BN_FLG_SECURE 0x08 + +# if OPENSSL_API_COMPAT < 0x00908000L +/* deprecated name for the flag */ +# define BN_FLG_EXP_CONSTTIME BN_FLG_CONSTTIME +# define BN_FLG_FREE 0x8000 /* used for debugging */ +# endif + +void BN_set_flags(BIGNUM *b, int n); +int BN_get_flags(const BIGNUM *b, int n); + +/* Values for |top| in BN_rand() */ +#define BN_RAND_TOP_ANY -1 +#define BN_RAND_TOP_ONE 0 +#define BN_RAND_TOP_TWO 1 + +/* Values for |bottom| in BN_rand() */ +#define BN_RAND_BOTTOM_ANY 0 +#define BN_RAND_BOTTOM_ODD 1 + +/* + * get a clone of a BIGNUM with changed flags, for *temporary* use only (the + * two BIGNUMs cannot be used in parallel!). Also only for *read only* use. The + * value |dest| should be a newly allocated BIGNUM obtained via BN_new() that + * has not been otherwise initialised or used. + */ +void BN_with_flags(BIGNUM *dest, const BIGNUM *b, int flags); + +/* Wrapper function to make using BN_GENCB easier */ +int BN_GENCB_call(BN_GENCB *cb, int a, int b); + +BN_GENCB *BN_GENCB_new(void); +void BN_GENCB_free(BN_GENCB *cb); + +/* Populate a BN_GENCB structure with an "old"-style callback */ +void BN_GENCB_set_old(BN_GENCB *gencb, void (*callback) (int, int, void *), + void *cb_arg); + +/* Populate a BN_GENCB structure with a "new"-style callback */ +void BN_GENCB_set(BN_GENCB *gencb, int (*callback) (int, int, BN_GENCB *), + void *cb_arg); + +void *BN_GENCB_get_arg(BN_GENCB *cb); + +# define BN_prime_checks 0 /* default: select number of iterations based + * on the size of the number */ + +/* + * BN_prime_checks_for_size() returns the number of Miller-Rabin iterations + * that will be done for checking that a random number is probably prime. The + * error rate for accepting a composite number as prime depends on the size of + * the prime |b|. The error rates used are for calculating an RSA key with 2 primes, + * and so the level is what you would expect for a key of double the size of the + * prime. + * + * This table is generated using the algorithm of FIPS PUB 186-4 + * Digital Signature Standard (DSS), section F.1, page 117. + * (https://dx.doi.org/10.6028/NIST.FIPS.186-4) + * + * The following magma script was used to generate the output: + * securitybits:=125; + * k:=1024; + * for t:=1 to 65 do + * for M:=3 to Floor(2*Sqrt(k-1)-1) do + * S:=0; + * // Sum over m + * for m:=3 to M do + * s:=0; + * // Sum over j + * for j:=2 to m do + * s+:=(RealField(32)!2)^-(j+(k-1)/j); + * end for; + * S+:=2^(m-(m-1)*t)*s; + * end for; + * A:=2^(k-2-M*t); + * B:=8*(Pi(RealField(32))^2-6)/3*2^(k-2)*S; + * pkt:=2.00743*Log(2)*k*2^-k*(A+B); + * seclevel:=Floor(-Log(2,pkt)); + * if seclevel ge securitybits then + * printf "k: %5o, security: %o bits (t: %o, M: %o)\n",k,seclevel,t,M; + * break; + * end if; + * end for; + * if seclevel ge securitybits then break; end if; + * end for; + * + * It can be run online at: + * http://magma.maths.usyd.edu.au/calc + * + * And will output: + * k: 1024, security: 129 bits (t: 6, M: 23) + * + * k is the number of bits of the prime, securitybits is the level we want to + * reach. + * + * prime length | RSA key size | # MR tests | security level + * -------------+--------------|------------+--------------- + * (b) >= 6394 | >= 12788 | 3 | 256 bit + * (b) >= 3747 | >= 7494 | 3 | 192 bit + * (b) >= 1345 | >= 2690 | 4 | 128 bit + * (b) >= 1080 | >= 2160 | 5 | 128 bit + * (b) >= 852 | >= 1704 | 5 | 112 bit + * (b) >= 476 | >= 952 | 5 | 80 bit + * (b) >= 400 | >= 800 | 6 | 80 bit + * (b) >= 347 | >= 694 | 7 | 80 bit + * (b) >= 308 | >= 616 | 8 | 80 bit + * (b) >= 55 | >= 110 | 27 | 64 bit + * (b) >= 6 | >= 12 | 34 | 64 bit + */ + +# define BN_prime_checks_for_size(b) ((b) >= 3747 ? 3 : \ + (b) >= 1345 ? 4 : \ + (b) >= 476 ? 5 : \ + (b) >= 400 ? 6 : \ + (b) >= 347 ? 7 : \ + (b) >= 308 ? 8 : \ + (b) >= 55 ? 27 : \ + /* b >= 6 */ 34) + +# define BN_num_bytes(a) ((BN_num_bits(a)+7)/8) + +int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w); +int BN_is_zero(const BIGNUM *a); +int BN_is_one(const BIGNUM *a); +int BN_is_word(const BIGNUM *a, const BN_ULONG w); +int BN_is_odd(const BIGNUM *a); + +# define BN_one(a) (BN_set_word((a),1)) + +void BN_zero_ex(BIGNUM *a); + +# if OPENSSL_API_COMPAT >= 0x00908000L +# define BN_zero(a) BN_zero_ex(a) +# else +# define BN_zero(a) (BN_set_word((a),0)) +# endif + +const BIGNUM *BN_value_one(void); +char *BN_options(void); +BN_CTX *BN_CTX_new(void); +BN_CTX *BN_CTX_secure_new(void); +void BN_CTX_free(BN_CTX *c); +void BN_CTX_start(BN_CTX *ctx); +BIGNUM *BN_CTX_get(BN_CTX *ctx); +void BN_CTX_end(BN_CTX *ctx); +int BN_rand(BIGNUM *rnd, int bits, int top, int bottom); +int BN_priv_rand(BIGNUM *rnd, int bits, int top, int bottom); +int BN_rand_range(BIGNUM *rnd, const BIGNUM *range); +int BN_priv_rand_range(BIGNUM *rnd, const BIGNUM *range); +int BN_pseudo_rand(BIGNUM *rnd, int bits, int top, int bottom); +int BN_pseudo_rand_range(BIGNUM *rnd, const BIGNUM *range); +int BN_num_bits(const BIGNUM *a); +int BN_num_bits_word(BN_ULONG l); +int BN_security_bits(int L, int N); +BIGNUM *BN_new(void); +BIGNUM *BN_secure_new(void); +void BN_clear_free(BIGNUM *a); +BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b); +void BN_swap(BIGNUM *a, BIGNUM *b); +BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret); +int BN_bn2bin(const BIGNUM *a, unsigned char *to); +int BN_bn2binpad(const BIGNUM *a, unsigned char *to, int tolen); +BIGNUM *BN_lebin2bn(const unsigned char *s, int len, BIGNUM *ret); +int BN_bn2lebinpad(const BIGNUM *a, unsigned char *to, int tolen); +BIGNUM *BN_mpi2bn(const unsigned char *s, int len, BIGNUM *ret); +int BN_bn2mpi(const BIGNUM *a, unsigned char *to); +int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); +int BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); +int BN_uadd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); +int BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); +int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); +int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx); +/** BN_set_negative sets sign of a BIGNUM + * \param b pointer to the BIGNUM object + * \param n 0 if the BIGNUM b should be positive and a value != 0 otherwise + */ +void BN_set_negative(BIGNUM *b, int n); +/** BN_is_negative returns 1 if the BIGNUM is negative + * \param b pointer to the BIGNUM object + * \return 1 if a < 0 and 0 otherwise + */ +int BN_is_negative(const BIGNUM *b); + +int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d, + BN_CTX *ctx); +# define BN_mod(rem,m,d,ctx) BN_div(NULL,(rem),(m),(d),(ctx)) +int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx); +int BN_mod_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, + BN_CTX *ctx); +int BN_mod_add_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, + const BIGNUM *m); +int BN_mod_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, + BN_CTX *ctx); +int BN_mod_sub_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, + const BIGNUM *m); +int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, + BN_CTX *ctx); +int BN_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx); +int BN_mod_lshift1(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx); +int BN_mod_lshift1_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *m); +int BN_mod_lshift(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m, + BN_CTX *ctx); +int BN_mod_lshift_quick(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m); + +BN_ULONG BN_mod_word(const BIGNUM *a, BN_ULONG w); +BN_ULONG BN_div_word(BIGNUM *a, BN_ULONG w); +int BN_mul_word(BIGNUM *a, BN_ULONG w); +int BN_add_word(BIGNUM *a, BN_ULONG w); +int BN_sub_word(BIGNUM *a, BN_ULONG w); +int BN_set_word(BIGNUM *a, BN_ULONG w); +BN_ULONG BN_get_word(const BIGNUM *a); + +int BN_cmp(const BIGNUM *a, const BIGNUM *b); +void BN_free(BIGNUM *a); +int BN_is_bit_set(const BIGNUM *a, int n); +int BN_lshift(BIGNUM *r, const BIGNUM *a, int n); +int BN_lshift1(BIGNUM *r, const BIGNUM *a); +int BN_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); + +int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, + const BIGNUM *m, BN_CTX *ctx); +int BN_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, + const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); +int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, + const BIGNUM *m, BN_CTX *ctx, + BN_MONT_CTX *in_mont); +int BN_mod_exp_mont_word(BIGNUM *r, BN_ULONG a, const BIGNUM *p, + const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); +int BN_mod_exp2_mont(BIGNUM *r, const BIGNUM *a1, const BIGNUM *p1, + const BIGNUM *a2, const BIGNUM *p2, const BIGNUM *m, + BN_CTX *ctx, BN_MONT_CTX *m_ctx); +int BN_mod_exp_simple(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, + const BIGNUM *m, BN_CTX *ctx); + +int BN_mask_bits(BIGNUM *a, int n); +# ifndef OPENSSL_NO_STDIO +int BN_print_fp(FILE *fp, const BIGNUM *a); +# endif +int BN_print(BIO *bio, const BIGNUM *a); +int BN_reciprocal(BIGNUM *r, const BIGNUM *m, int len, BN_CTX *ctx); +int BN_rshift(BIGNUM *r, const BIGNUM *a, int n); +int BN_rshift1(BIGNUM *r, const BIGNUM *a); +void BN_clear(BIGNUM *a); +BIGNUM *BN_dup(const BIGNUM *a); +int BN_ucmp(const BIGNUM *a, const BIGNUM *b); +int BN_set_bit(BIGNUM *a, int n); +int BN_clear_bit(BIGNUM *a, int n); +char *BN_bn2hex(const BIGNUM *a); +char *BN_bn2dec(const BIGNUM *a); +int BN_hex2bn(BIGNUM **a, const char *str); +int BN_dec2bn(BIGNUM **a, const char *str); +int BN_asc2bn(BIGNUM **a, const char *str); +int BN_gcd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); +int BN_kronecker(const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); /* returns + * -2 for + * error */ +BIGNUM *BN_mod_inverse(BIGNUM *ret, + const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx); +BIGNUM *BN_mod_sqrt(BIGNUM *ret, + const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx); + +void BN_consttime_swap(BN_ULONG swap, BIGNUM *a, BIGNUM *b, int nwords); + +/* Deprecated versions */ +DEPRECATEDIN_0_9_8(BIGNUM *BN_generate_prime(BIGNUM *ret, int bits, int safe, + const BIGNUM *add, + const BIGNUM *rem, + void (*callback) (int, int, + void *), + void *cb_arg)) +DEPRECATEDIN_0_9_8(int + BN_is_prime(const BIGNUM *p, int nchecks, + void (*callback) (int, int, void *), + BN_CTX *ctx, void *cb_arg)) +DEPRECATEDIN_0_9_8(int + BN_is_prime_fasttest(const BIGNUM *p, int nchecks, + void (*callback) (int, int, void *), + BN_CTX *ctx, void *cb_arg, + int do_trial_division)) + +/* Newer versions */ +int BN_generate_prime_ex(BIGNUM *ret, int bits, int safe, const BIGNUM *add, + const BIGNUM *rem, BN_GENCB *cb); +int BN_is_prime_ex(const BIGNUM *p, int nchecks, BN_CTX *ctx, BN_GENCB *cb); +int BN_is_prime_fasttest_ex(const BIGNUM *p, int nchecks, BN_CTX *ctx, + int do_trial_division, BN_GENCB *cb); + +int BN_X931_generate_Xpq(BIGNUM *Xp, BIGNUM *Xq, int nbits, BN_CTX *ctx); + +int BN_X931_derive_prime_ex(BIGNUM *p, BIGNUM *p1, BIGNUM *p2, + const BIGNUM *Xp, const BIGNUM *Xp1, + const BIGNUM *Xp2, const BIGNUM *e, BN_CTX *ctx, + BN_GENCB *cb); +int BN_X931_generate_prime_ex(BIGNUM *p, BIGNUM *p1, BIGNUM *p2, BIGNUM *Xp1, + BIGNUM *Xp2, const BIGNUM *Xp, const BIGNUM *e, + BN_CTX *ctx, BN_GENCB *cb); + +BN_MONT_CTX *BN_MONT_CTX_new(void); +int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, + BN_MONT_CTX *mont, BN_CTX *ctx); +int BN_to_montgomery(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont, + BN_CTX *ctx); +int BN_from_montgomery(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont, + BN_CTX *ctx); +void BN_MONT_CTX_free(BN_MONT_CTX *mont); +int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx); +BN_MONT_CTX *BN_MONT_CTX_copy(BN_MONT_CTX *to, BN_MONT_CTX *from); +BN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, CRYPTO_RWLOCK *lock, + const BIGNUM *mod, BN_CTX *ctx); + +/* BN_BLINDING flags */ +# define BN_BLINDING_NO_UPDATE 0x00000001 +# define BN_BLINDING_NO_RECREATE 0x00000002 + +BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, BIGNUM *mod); +void BN_BLINDING_free(BN_BLINDING *b); +int BN_BLINDING_update(BN_BLINDING *b, BN_CTX *ctx); +int BN_BLINDING_convert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx); +int BN_BLINDING_invert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx); +int BN_BLINDING_convert_ex(BIGNUM *n, BIGNUM *r, BN_BLINDING *b, BN_CTX *); +int BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b, + BN_CTX *); + +int BN_BLINDING_is_current_thread(BN_BLINDING *b); +void BN_BLINDING_set_current_thread(BN_BLINDING *b); +int BN_BLINDING_lock(BN_BLINDING *b); +int BN_BLINDING_unlock(BN_BLINDING *b); + +unsigned long BN_BLINDING_get_flags(const BN_BLINDING *); +void BN_BLINDING_set_flags(BN_BLINDING *, unsigned long); +BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b, + const BIGNUM *e, BIGNUM *m, BN_CTX *ctx, + int (*bn_mod_exp) (BIGNUM *r, + const BIGNUM *a, + const BIGNUM *p, + const BIGNUM *m, + BN_CTX *ctx, + BN_MONT_CTX *m_ctx), + BN_MONT_CTX *m_ctx); + +DEPRECATEDIN_0_9_8(void BN_set_params(int mul, int high, int low, int mont)) +DEPRECATEDIN_0_9_8(int BN_get_params(int which)) /* 0, mul, 1 high, 2 low, 3 + * mont */ + +BN_RECP_CTX *BN_RECP_CTX_new(void); +void BN_RECP_CTX_free(BN_RECP_CTX *recp); +int BN_RECP_CTX_set(BN_RECP_CTX *recp, const BIGNUM *rdiv, BN_CTX *ctx); +int BN_mod_mul_reciprocal(BIGNUM *r, const BIGNUM *x, const BIGNUM *y, + BN_RECP_CTX *recp, BN_CTX *ctx); +int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, + const BIGNUM *m, BN_CTX *ctx); +int BN_div_recp(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, + BN_RECP_CTX *recp, BN_CTX *ctx); + +# ifndef OPENSSL_NO_EC2M + +/* + * Functions for arithmetic over binary polynomials represented by BIGNUMs. + * The BIGNUM::neg property of BIGNUMs representing binary polynomials is + * ignored. Note that input arguments are not const so that their bit arrays + * can be expanded to the appropriate size if needed. + */ + +/* + * r = a + b + */ +int BN_GF2m_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); +# define BN_GF2m_sub(r, a, b) BN_GF2m_add(r, a, b) +/* + * r=a mod p + */ +int BN_GF2m_mod(BIGNUM *r, const BIGNUM *a, const BIGNUM *p); +/* r = (a * b) mod p */ +int BN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, + const BIGNUM *p, BN_CTX *ctx); +/* r = (a * a) mod p */ +int BN_GF2m_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); +/* r = (1 / b) mod p */ +int BN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *b, const BIGNUM *p, BN_CTX *ctx); +/* r = (a / b) mod p */ +int BN_GF2m_mod_div(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, + const BIGNUM *p, BN_CTX *ctx); +/* r = (a ^ b) mod p */ +int BN_GF2m_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, + const BIGNUM *p, BN_CTX *ctx); +/* r = sqrt(a) mod p */ +int BN_GF2m_mod_sqrt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, + BN_CTX *ctx); +/* r^2 + r = a mod p */ +int BN_GF2m_mod_solve_quad(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, + BN_CTX *ctx); +# define BN_GF2m_cmp(a, b) BN_ucmp((a), (b)) +/*- + * Some functions allow for representation of the irreducible polynomials + * as an unsigned int[], say p. The irreducible f(t) is then of the form: + * t^p[0] + t^p[1] + ... + t^p[k] + * where m = p[0] > p[1] > ... > p[k] = 0. + */ +/* r = a mod p */ +int BN_GF2m_mod_arr(BIGNUM *r, const BIGNUM *a, const int p[]); +/* r = (a * b) mod p */ +int BN_GF2m_mod_mul_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, + const int p[], BN_CTX *ctx); +/* r = (a * a) mod p */ +int BN_GF2m_mod_sqr_arr(BIGNUM *r, const BIGNUM *a, const int p[], + BN_CTX *ctx); +/* r = (1 / b) mod p */ +int BN_GF2m_mod_inv_arr(BIGNUM *r, const BIGNUM *b, const int p[], + BN_CTX *ctx); +/* r = (a / b) mod p */ +int BN_GF2m_mod_div_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, + const int p[], BN_CTX *ctx); +/* r = (a ^ b) mod p */ +int BN_GF2m_mod_exp_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, + const int p[], BN_CTX *ctx); +/* r = sqrt(a) mod p */ +int BN_GF2m_mod_sqrt_arr(BIGNUM *r, const BIGNUM *a, + const int p[], BN_CTX *ctx); +/* r^2 + r = a mod p */ +int BN_GF2m_mod_solve_quad_arr(BIGNUM *r, const BIGNUM *a, + const int p[], BN_CTX *ctx); +int BN_GF2m_poly2arr(const BIGNUM *a, int p[], int max); +int BN_GF2m_arr2poly(const int p[], BIGNUM *a); + +# endif + +/* + * faster mod functions for the 'NIST primes' 0 <= a < p^2 + */ +int BN_nist_mod_192(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); +int BN_nist_mod_224(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); +int BN_nist_mod_256(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); +int BN_nist_mod_384(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); +int BN_nist_mod_521(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); + +const BIGNUM *BN_get0_nist_prime_192(void); +const BIGNUM *BN_get0_nist_prime_224(void); +const BIGNUM *BN_get0_nist_prime_256(void); +const BIGNUM *BN_get0_nist_prime_384(void); +const BIGNUM *BN_get0_nist_prime_521(void); + +int (*BN_nist_mod_func(const BIGNUM *p)) (BIGNUM *r, const BIGNUM *a, + const BIGNUM *field, BN_CTX *ctx); + +int BN_generate_dsa_nonce(BIGNUM *out, const BIGNUM *range, + const BIGNUM *priv, const unsigned char *message, + size_t message_len, BN_CTX *ctx); + +/* Primes from RFC 2409 */ +BIGNUM *BN_get_rfc2409_prime_768(BIGNUM *bn); +BIGNUM *BN_get_rfc2409_prime_1024(BIGNUM *bn); + +/* Primes from RFC 3526 */ +BIGNUM *BN_get_rfc3526_prime_1536(BIGNUM *bn); +BIGNUM *BN_get_rfc3526_prime_2048(BIGNUM *bn); +BIGNUM *BN_get_rfc3526_prime_3072(BIGNUM *bn); +BIGNUM *BN_get_rfc3526_prime_4096(BIGNUM *bn); +BIGNUM *BN_get_rfc3526_prime_6144(BIGNUM *bn); +BIGNUM *BN_get_rfc3526_prime_8192(BIGNUM *bn); + +# if OPENSSL_API_COMPAT < 0x10100000L +# define get_rfc2409_prime_768 BN_get_rfc2409_prime_768 +# define get_rfc2409_prime_1024 BN_get_rfc2409_prime_1024 +# define get_rfc3526_prime_1536 BN_get_rfc3526_prime_1536 +# define get_rfc3526_prime_2048 BN_get_rfc3526_prime_2048 +# define get_rfc3526_prime_3072 BN_get_rfc3526_prime_3072 +# define get_rfc3526_prime_4096 BN_get_rfc3526_prime_4096 +# define get_rfc3526_prime_6144 BN_get_rfc3526_prime_6144 +# define get_rfc3526_prime_8192 BN_get_rfc3526_prime_8192 +# endif + +int BN_bntest_rand(BIGNUM *rnd, int bits, int top, int bottom); + + +# ifdef __cplusplus +} +# endif +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/bnerr.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/bnerr.h new file mode 100644 index 0000000..9f3c7cf --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/bnerr.h @@ -0,0 +1,100 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_BNERR_H +# define HEADER_BNERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_BN_strings(void); + +/* + * BN function codes. + */ +# define BN_F_BNRAND 127 +# define BN_F_BNRAND_RANGE 138 +# define BN_F_BN_BLINDING_CONVERT_EX 100 +# define BN_F_BN_BLINDING_CREATE_PARAM 128 +# define BN_F_BN_BLINDING_INVERT_EX 101 +# define BN_F_BN_BLINDING_NEW 102 +# define BN_F_BN_BLINDING_UPDATE 103 +# define BN_F_BN_BN2DEC 104 +# define BN_F_BN_BN2HEX 105 +# define BN_F_BN_COMPUTE_WNAF 142 +# define BN_F_BN_CTX_GET 116 +# define BN_F_BN_CTX_NEW 106 +# define BN_F_BN_CTX_START 129 +# define BN_F_BN_DIV 107 +# define BN_F_BN_DIV_RECP 130 +# define BN_F_BN_EXP 123 +# define BN_F_BN_EXPAND_INTERNAL 120 +# define BN_F_BN_GENCB_NEW 143 +# define BN_F_BN_GENERATE_DSA_NONCE 140 +# define BN_F_BN_GENERATE_PRIME_EX 141 +# define BN_F_BN_GF2M_MOD 131 +# define BN_F_BN_GF2M_MOD_EXP 132 +# define BN_F_BN_GF2M_MOD_MUL 133 +# define BN_F_BN_GF2M_MOD_SOLVE_QUAD 134 +# define BN_F_BN_GF2M_MOD_SOLVE_QUAD_ARR 135 +# define BN_F_BN_GF2M_MOD_SQR 136 +# define BN_F_BN_GF2M_MOD_SQRT 137 +# define BN_F_BN_LSHIFT 145 +# define BN_F_BN_MOD_EXP2_MONT 118 +# define BN_F_BN_MOD_EXP_MONT 109 +# define BN_F_BN_MOD_EXP_MONT_CONSTTIME 124 +# define BN_F_BN_MOD_EXP_MONT_WORD 117 +# define BN_F_BN_MOD_EXP_RECP 125 +# define BN_F_BN_MOD_EXP_SIMPLE 126 +# define BN_F_BN_MOD_INVERSE 110 +# define BN_F_BN_MOD_INVERSE_NO_BRANCH 139 +# define BN_F_BN_MOD_LSHIFT_QUICK 119 +# define BN_F_BN_MOD_SQRT 121 +# define BN_F_BN_MONT_CTX_NEW 149 +# define BN_F_BN_MPI2BN 112 +# define BN_F_BN_NEW 113 +# define BN_F_BN_POOL_GET 147 +# define BN_F_BN_RAND 114 +# define BN_F_BN_RAND_RANGE 122 +# define BN_F_BN_RECP_CTX_NEW 150 +# define BN_F_BN_RSHIFT 146 +# define BN_F_BN_SET_WORDS 144 +# define BN_F_BN_STACK_PUSH 148 +# define BN_F_BN_USUB 115 + +/* + * BN reason codes. + */ +# define BN_R_ARG2_LT_ARG3 100 +# define BN_R_BAD_RECIPROCAL 101 +# define BN_R_BIGNUM_TOO_LONG 114 +# define BN_R_BITS_TOO_SMALL 118 +# define BN_R_CALLED_WITH_EVEN_MODULUS 102 +# define BN_R_DIV_BY_ZERO 103 +# define BN_R_ENCODING_ERROR 104 +# define BN_R_EXPAND_ON_STATIC_BIGNUM_DATA 105 +# define BN_R_INPUT_NOT_REDUCED 110 +# define BN_R_INVALID_LENGTH 106 +# define BN_R_INVALID_RANGE 115 +# define BN_R_INVALID_SHIFT 119 +# define BN_R_NOT_A_SQUARE 111 +# define BN_R_NOT_INITIALIZED 107 +# define BN_R_NO_INVERSE 108 +# define BN_R_NO_SOLUTION 116 +# define BN_R_PRIVATE_KEY_TOO_LARGE 117 +# define BN_R_P_IS_NOT_PRIME 112 +# define BN_R_TOO_MANY_ITERATIONS 113 +# define BN_R_TOO_MANY_TEMPORARY_VARIABLES 109 + +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/buffer.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/buffer.h new file mode 100644 index 0000000..d276576 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/buffer.h @@ -0,0 +1,58 @@ +/* + * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_BUFFER_H +# define HEADER_BUFFER_H + +# include +# ifndef HEADER_CRYPTO_H +# include +# endif +# include + + +#ifdef __cplusplus +extern "C" { +#endif + +# include +# include + +/* + * These names are outdated as of OpenSSL 1.1; a future release + * will move them to be deprecated. + */ +# define BUF_strdup(s) OPENSSL_strdup(s) +# define BUF_strndup(s, size) OPENSSL_strndup(s, size) +# define BUF_memdup(data, size) OPENSSL_memdup(data, size) +# define BUF_strlcpy(dst, src, size) OPENSSL_strlcpy(dst, src, size) +# define BUF_strlcat(dst, src, size) OPENSSL_strlcat(dst, src, size) +# define BUF_strnlen(str, maxlen) OPENSSL_strnlen(str, maxlen) + +struct buf_mem_st { + size_t length; /* current number of bytes */ + char *data; + size_t max; /* size of buffer */ + unsigned long flags; +}; + +# define BUF_MEM_FLAG_SECURE 0x01 + +BUF_MEM *BUF_MEM_new(void); +BUF_MEM *BUF_MEM_new_ex(unsigned long flags); +void BUF_MEM_free(BUF_MEM *a); +size_t BUF_MEM_grow(BUF_MEM *str, size_t len); +size_t BUF_MEM_grow_clean(BUF_MEM *str, size_t len); +void BUF_reverse(unsigned char *out, const unsigned char *in, size_t siz); + + +# ifdef __cplusplus +} +# endif +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/buffererr.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/buffererr.h new file mode 100644 index 0000000..04f6ff7 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/buffererr.h @@ -0,0 +1,34 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_BUFERR_H +# define HEADER_BUFERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_BUF_strings(void); + +/* + * BUF function codes. + */ +# define BUF_F_BUF_MEM_GROW 100 +# define BUF_F_BUF_MEM_GROW_CLEAN 105 +# define BUF_F_BUF_MEM_NEW 101 + +/* + * BUF reason codes. + */ + +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/camellia.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/camellia.h new file mode 100644 index 0000000..151f3c1 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/camellia.h @@ -0,0 +1,83 @@ +/* + * Copyright 2006-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_CAMELLIA_H +# define HEADER_CAMELLIA_H + +# include + +# ifndef OPENSSL_NO_CAMELLIA +# include +#ifdef __cplusplus +extern "C" { +#endif + +# define CAMELLIA_ENCRYPT 1 +# define CAMELLIA_DECRYPT 0 + +/* + * Because array size can't be a const in C, the following two are macros. + * Both sizes are in bytes. + */ + +/* This should be a hidden type, but EVP requires that the size be known */ + +# define CAMELLIA_BLOCK_SIZE 16 +# define CAMELLIA_TABLE_BYTE_LEN 272 +# define CAMELLIA_TABLE_WORD_LEN (CAMELLIA_TABLE_BYTE_LEN / 4) + +typedef unsigned int KEY_TABLE_TYPE[CAMELLIA_TABLE_WORD_LEN]; /* to match + * with WORD */ + +struct camellia_key_st { + union { + double d; /* ensures 64-bit align */ + KEY_TABLE_TYPE rd_key; + } u; + int grand_rounds; +}; +typedef struct camellia_key_st CAMELLIA_KEY; + +int Camellia_set_key(const unsigned char *userKey, const int bits, + CAMELLIA_KEY *key); + +void Camellia_encrypt(const unsigned char *in, unsigned char *out, + const CAMELLIA_KEY *key); +void Camellia_decrypt(const unsigned char *in, unsigned char *out, + const CAMELLIA_KEY *key); + +void Camellia_ecb_encrypt(const unsigned char *in, unsigned char *out, + const CAMELLIA_KEY *key, const int enc); +void Camellia_cbc_encrypt(const unsigned char *in, unsigned char *out, + size_t length, const CAMELLIA_KEY *key, + unsigned char *ivec, const int enc); +void Camellia_cfb128_encrypt(const unsigned char *in, unsigned char *out, + size_t length, const CAMELLIA_KEY *key, + unsigned char *ivec, int *num, const int enc); +void Camellia_cfb1_encrypt(const unsigned char *in, unsigned char *out, + size_t length, const CAMELLIA_KEY *key, + unsigned char *ivec, int *num, const int enc); +void Camellia_cfb8_encrypt(const unsigned char *in, unsigned char *out, + size_t length, const CAMELLIA_KEY *key, + unsigned char *ivec, int *num, const int enc); +void Camellia_ofb128_encrypt(const unsigned char *in, unsigned char *out, + size_t length, const CAMELLIA_KEY *key, + unsigned char *ivec, int *num); +void Camellia_ctr128_encrypt(const unsigned char *in, unsigned char *out, + size_t length, const CAMELLIA_KEY *key, + unsigned char ivec[CAMELLIA_BLOCK_SIZE], + unsigned char ecount_buf[CAMELLIA_BLOCK_SIZE], + unsigned int *num); + +# ifdef __cplusplus +} +# endif +# endif + +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/cast.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/cast.h new file mode 100644 index 0000000..2cc89ae --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/cast.h @@ -0,0 +1,53 @@ +/* + * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_CAST_H +# define HEADER_CAST_H + +# include + +# ifndef OPENSSL_NO_CAST +# ifdef __cplusplus +extern "C" { +# endif + +# define CAST_ENCRYPT 1 +# define CAST_DECRYPT 0 + +# define CAST_LONG unsigned int + +# define CAST_BLOCK 8 +# define CAST_KEY_LENGTH 16 + +typedef struct cast_key_st { + CAST_LONG data[32]; + int short_key; /* Use reduced rounds for short key */ +} CAST_KEY; + +void CAST_set_key(CAST_KEY *key, int len, const unsigned char *data); +void CAST_ecb_encrypt(const unsigned char *in, unsigned char *out, + const CAST_KEY *key, int enc); +void CAST_encrypt(CAST_LONG *data, const CAST_KEY *key); +void CAST_decrypt(CAST_LONG *data, const CAST_KEY *key); +void CAST_cbc_encrypt(const unsigned char *in, unsigned char *out, + long length, const CAST_KEY *ks, unsigned char *iv, + int enc); +void CAST_cfb64_encrypt(const unsigned char *in, unsigned char *out, + long length, const CAST_KEY *schedule, + unsigned char *ivec, int *num, int enc); +void CAST_ofb64_encrypt(const unsigned char *in, unsigned char *out, + long length, const CAST_KEY *schedule, + unsigned char *ivec, int *num); + +# ifdef __cplusplus +} +# endif +# endif + +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/cmac.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/cmac.h new file mode 100644 index 0000000..3535a9a --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/cmac.h @@ -0,0 +1,41 @@ +/* + * Copyright 2010-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_CMAC_H +# define HEADER_CMAC_H + +# ifndef OPENSSL_NO_CMAC + +#ifdef __cplusplus +extern "C" { +#endif + +# include + +/* Opaque */ +typedef struct CMAC_CTX_st CMAC_CTX; + +CMAC_CTX *CMAC_CTX_new(void); +void CMAC_CTX_cleanup(CMAC_CTX *ctx); +void CMAC_CTX_free(CMAC_CTX *ctx); +EVP_CIPHER_CTX *CMAC_CTX_get0_cipher_ctx(CMAC_CTX *ctx); +int CMAC_CTX_copy(CMAC_CTX *out, const CMAC_CTX *in); + +int CMAC_Init(CMAC_CTX *ctx, const void *key, size_t keylen, + const EVP_CIPHER *cipher, ENGINE *impl); +int CMAC_Update(CMAC_CTX *ctx, const void *data, size_t dlen); +int CMAC_Final(CMAC_CTX *ctx, unsigned char *out, size_t *poutlen); +int CMAC_resume(CMAC_CTX *ctx); + +#ifdef __cplusplus +} +#endif + +# endif +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/cms.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/cms.h new file mode 100644 index 0000000..c762796 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/cms.h @@ -0,0 +1,339 @@ +/* + * Copyright 2008-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_CMS_H +# define HEADER_CMS_H + +# include + +# ifndef OPENSSL_NO_CMS +# include +# include +# include +# ifdef __cplusplus +extern "C" { +# endif + +typedef struct CMS_ContentInfo_st CMS_ContentInfo; +typedef struct CMS_SignerInfo_st CMS_SignerInfo; +typedef struct CMS_CertificateChoices CMS_CertificateChoices; +typedef struct CMS_RevocationInfoChoice_st CMS_RevocationInfoChoice; +typedef struct CMS_RecipientInfo_st CMS_RecipientInfo; +typedef struct CMS_ReceiptRequest_st CMS_ReceiptRequest; +typedef struct CMS_Receipt_st CMS_Receipt; +typedef struct CMS_RecipientEncryptedKey_st CMS_RecipientEncryptedKey; +typedef struct CMS_OtherKeyAttribute_st CMS_OtherKeyAttribute; + +DEFINE_STACK_OF(CMS_SignerInfo) +DEFINE_STACK_OF(CMS_RecipientEncryptedKey) +DEFINE_STACK_OF(CMS_RecipientInfo) +DEFINE_STACK_OF(CMS_RevocationInfoChoice) +DECLARE_ASN1_FUNCTIONS(CMS_ContentInfo) +DECLARE_ASN1_FUNCTIONS(CMS_ReceiptRequest) +DECLARE_ASN1_PRINT_FUNCTION(CMS_ContentInfo) + +# define CMS_SIGNERINFO_ISSUER_SERIAL 0 +# define CMS_SIGNERINFO_KEYIDENTIFIER 1 + +# define CMS_RECIPINFO_NONE -1 +# define CMS_RECIPINFO_TRANS 0 +# define CMS_RECIPINFO_AGREE 1 +# define CMS_RECIPINFO_KEK 2 +# define CMS_RECIPINFO_PASS 3 +# define CMS_RECIPINFO_OTHER 4 + +/* S/MIME related flags */ + +# define CMS_TEXT 0x1 +# define CMS_NOCERTS 0x2 +# define CMS_NO_CONTENT_VERIFY 0x4 +# define CMS_NO_ATTR_VERIFY 0x8 +# define CMS_NOSIGS \ + (CMS_NO_CONTENT_VERIFY|CMS_NO_ATTR_VERIFY) +# define CMS_NOINTERN 0x10 +# define CMS_NO_SIGNER_CERT_VERIFY 0x20 +# define CMS_NOVERIFY 0x20 +# define CMS_DETACHED 0x40 +# define CMS_BINARY 0x80 +# define CMS_NOATTR 0x100 +# define CMS_NOSMIMECAP 0x200 +# define CMS_NOOLDMIMETYPE 0x400 +# define CMS_CRLFEOL 0x800 +# define CMS_STREAM 0x1000 +# define CMS_NOCRL 0x2000 +# define CMS_PARTIAL 0x4000 +# define CMS_REUSE_DIGEST 0x8000 +# define CMS_USE_KEYID 0x10000 +# define CMS_DEBUG_DECRYPT 0x20000 +# define CMS_KEY_PARAM 0x40000 +# define CMS_ASCIICRLF 0x80000 + +const ASN1_OBJECT *CMS_get0_type(const CMS_ContentInfo *cms); + +BIO *CMS_dataInit(CMS_ContentInfo *cms, BIO *icont); +int CMS_dataFinal(CMS_ContentInfo *cms, BIO *bio); + +ASN1_OCTET_STRING **CMS_get0_content(CMS_ContentInfo *cms); +int CMS_is_detached(CMS_ContentInfo *cms); +int CMS_set_detached(CMS_ContentInfo *cms, int detached); + +# ifdef HEADER_PEM_H +DECLARE_PEM_rw_const(CMS, CMS_ContentInfo) +# endif +int CMS_stream(unsigned char ***boundary, CMS_ContentInfo *cms); +CMS_ContentInfo *d2i_CMS_bio(BIO *bp, CMS_ContentInfo **cms); +int i2d_CMS_bio(BIO *bp, CMS_ContentInfo *cms); + +BIO *BIO_new_CMS(BIO *out, CMS_ContentInfo *cms); +int i2d_CMS_bio_stream(BIO *out, CMS_ContentInfo *cms, BIO *in, int flags); +int PEM_write_bio_CMS_stream(BIO *out, CMS_ContentInfo *cms, BIO *in, + int flags); +CMS_ContentInfo *SMIME_read_CMS(BIO *bio, BIO **bcont); +int SMIME_write_CMS(BIO *bio, CMS_ContentInfo *cms, BIO *data, int flags); + +int CMS_final(CMS_ContentInfo *cms, BIO *data, BIO *dcont, + unsigned int flags); + +CMS_ContentInfo *CMS_sign(X509 *signcert, EVP_PKEY *pkey, + STACK_OF(X509) *certs, BIO *data, + unsigned int flags); + +CMS_ContentInfo *CMS_sign_receipt(CMS_SignerInfo *si, + X509 *signcert, EVP_PKEY *pkey, + STACK_OF(X509) *certs, unsigned int flags); + +int CMS_data(CMS_ContentInfo *cms, BIO *out, unsigned int flags); +CMS_ContentInfo *CMS_data_create(BIO *in, unsigned int flags); + +int CMS_digest_verify(CMS_ContentInfo *cms, BIO *dcont, BIO *out, + unsigned int flags); +CMS_ContentInfo *CMS_digest_create(BIO *in, const EVP_MD *md, + unsigned int flags); + +int CMS_EncryptedData_decrypt(CMS_ContentInfo *cms, + const unsigned char *key, size_t keylen, + BIO *dcont, BIO *out, unsigned int flags); + +CMS_ContentInfo *CMS_EncryptedData_encrypt(BIO *in, const EVP_CIPHER *cipher, + const unsigned char *key, + size_t keylen, unsigned int flags); + +int CMS_EncryptedData_set1_key(CMS_ContentInfo *cms, const EVP_CIPHER *ciph, + const unsigned char *key, size_t keylen); + +int CMS_verify(CMS_ContentInfo *cms, STACK_OF(X509) *certs, + X509_STORE *store, BIO *dcont, BIO *out, unsigned int flags); + +int CMS_verify_receipt(CMS_ContentInfo *rcms, CMS_ContentInfo *ocms, + STACK_OF(X509) *certs, + X509_STORE *store, unsigned int flags); + +STACK_OF(X509) *CMS_get0_signers(CMS_ContentInfo *cms); + +CMS_ContentInfo *CMS_encrypt(STACK_OF(X509) *certs, BIO *in, + const EVP_CIPHER *cipher, unsigned int flags); + +int CMS_decrypt(CMS_ContentInfo *cms, EVP_PKEY *pkey, X509 *cert, + BIO *dcont, BIO *out, unsigned int flags); + +int CMS_decrypt_set1_pkey(CMS_ContentInfo *cms, EVP_PKEY *pk, X509 *cert); +int CMS_decrypt_set1_key(CMS_ContentInfo *cms, + unsigned char *key, size_t keylen, + const unsigned char *id, size_t idlen); +int CMS_decrypt_set1_password(CMS_ContentInfo *cms, + unsigned char *pass, ossl_ssize_t passlen); + +STACK_OF(CMS_RecipientInfo) *CMS_get0_RecipientInfos(CMS_ContentInfo *cms); +int CMS_RecipientInfo_type(CMS_RecipientInfo *ri); +EVP_PKEY_CTX *CMS_RecipientInfo_get0_pkey_ctx(CMS_RecipientInfo *ri); +CMS_ContentInfo *CMS_EnvelopedData_create(const EVP_CIPHER *cipher); +CMS_RecipientInfo *CMS_add1_recipient_cert(CMS_ContentInfo *cms, + X509 *recip, unsigned int flags); +int CMS_RecipientInfo_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pkey); +int CMS_RecipientInfo_ktri_cert_cmp(CMS_RecipientInfo *ri, X509 *cert); +int CMS_RecipientInfo_ktri_get0_algs(CMS_RecipientInfo *ri, + EVP_PKEY **pk, X509 **recip, + X509_ALGOR **palg); +int CMS_RecipientInfo_ktri_get0_signer_id(CMS_RecipientInfo *ri, + ASN1_OCTET_STRING **keyid, + X509_NAME **issuer, + ASN1_INTEGER **sno); + +CMS_RecipientInfo *CMS_add0_recipient_key(CMS_ContentInfo *cms, int nid, + unsigned char *key, size_t keylen, + unsigned char *id, size_t idlen, + ASN1_GENERALIZEDTIME *date, + ASN1_OBJECT *otherTypeId, + ASN1_TYPE *otherType); + +int CMS_RecipientInfo_kekri_get0_id(CMS_RecipientInfo *ri, + X509_ALGOR **palg, + ASN1_OCTET_STRING **pid, + ASN1_GENERALIZEDTIME **pdate, + ASN1_OBJECT **potherid, + ASN1_TYPE **pothertype); + +int CMS_RecipientInfo_set0_key(CMS_RecipientInfo *ri, + unsigned char *key, size_t keylen); + +int CMS_RecipientInfo_kekri_id_cmp(CMS_RecipientInfo *ri, + const unsigned char *id, size_t idlen); + +int CMS_RecipientInfo_set0_password(CMS_RecipientInfo *ri, + unsigned char *pass, + ossl_ssize_t passlen); + +CMS_RecipientInfo *CMS_add0_recipient_password(CMS_ContentInfo *cms, + int iter, int wrap_nid, + int pbe_nid, + unsigned char *pass, + ossl_ssize_t passlen, + const EVP_CIPHER *kekciph); + +int CMS_RecipientInfo_decrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri); +int CMS_RecipientInfo_encrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri); + +int CMS_uncompress(CMS_ContentInfo *cms, BIO *dcont, BIO *out, + unsigned int flags); +CMS_ContentInfo *CMS_compress(BIO *in, int comp_nid, unsigned int flags); + +int CMS_set1_eContentType(CMS_ContentInfo *cms, const ASN1_OBJECT *oid); +const ASN1_OBJECT *CMS_get0_eContentType(CMS_ContentInfo *cms); + +CMS_CertificateChoices *CMS_add0_CertificateChoices(CMS_ContentInfo *cms); +int CMS_add0_cert(CMS_ContentInfo *cms, X509 *cert); +int CMS_add1_cert(CMS_ContentInfo *cms, X509 *cert); +STACK_OF(X509) *CMS_get1_certs(CMS_ContentInfo *cms); + +CMS_RevocationInfoChoice *CMS_add0_RevocationInfoChoice(CMS_ContentInfo *cms); +int CMS_add0_crl(CMS_ContentInfo *cms, X509_CRL *crl); +int CMS_add1_crl(CMS_ContentInfo *cms, X509_CRL *crl); +STACK_OF(X509_CRL) *CMS_get1_crls(CMS_ContentInfo *cms); + +int CMS_SignedData_init(CMS_ContentInfo *cms); +CMS_SignerInfo *CMS_add1_signer(CMS_ContentInfo *cms, + X509 *signer, EVP_PKEY *pk, const EVP_MD *md, + unsigned int flags); +EVP_PKEY_CTX *CMS_SignerInfo_get0_pkey_ctx(CMS_SignerInfo *si); +EVP_MD_CTX *CMS_SignerInfo_get0_md_ctx(CMS_SignerInfo *si); +STACK_OF(CMS_SignerInfo) *CMS_get0_SignerInfos(CMS_ContentInfo *cms); + +void CMS_SignerInfo_set1_signer_cert(CMS_SignerInfo *si, X509 *signer); +int CMS_SignerInfo_get0_signer_id(CMS_SignerInfo *si, + ASN1_OCTET_STRING **keyid, + X509_NAME **issuer, ASN1_INTEGER **sno); +int CMS_SignerInfo_cert_cmp(CMS_SignerInfo *si, X509 *cert); +int CMS_set1_signers_certs(CMS_ContentInfo *cms, STACK_OF(X509) *certs, + unsigned int flags); +void CMS_SignerInfo_get0_algs(CMS_SignerInfo *si, EVP_PKEY **pk, + X509 **signer, X509_ALGOR **pdig, + X509_ALGOR **psig); +ASN1_OCTET_STRING *CMS_SignerInfo_get0_signature(CMS_SignerInfo *si); +int CMS_SignerInfo_sign(CMS_SignerInfo *si); +int CMS_SignerInfo_verify(CMS_SignerInfo *si); +int CMS_SignerInfo_verify_content(CMS_SignerInfo *si, BIO *chain); + +int CMS_add_smimecap(CMS_SignerInfo *si, STACK_OF(X509_ALGOR) *algs); +int CMS_add_simple_smimecap(STACK_OF(X509_ALGOR) **algs, + int algnid, int keysize); +int CMS_add_standard_smimecap(STACK_OF(X509_ALGOR) **smcap); + +int CMS_signed_get_attr_count(const CMS_SignerInfo *si); +int CMS_signed_get_attr_by_NID(const CMS_SignerInfo *si, int nid, + int lastpos); +int CMS_signed_get_attr_by_OBJ(const CMS_SignerInfo *si, const ASN1_OBJECT *obj, + int lastpos); +X509_ATTRIBUTE *CMS_signed_get_attr(const CMS_SignerInfo *si, int loc); +X509_ATTRIBUTE *CMS_signed_delete_attr(CMS_SignerInfo *si, int loc); +int CMS_signed_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr); +int CMS_signed_add1_attr_by_OBJ(CMS_SignerInfo *si, + const ASN1_OBJECT *obj, int type, + const void *bytes, int len); +int CMS_signed_add1_attr_by_NID(CMS_SignerInfo *si, + int nid, int type, + const void *bytes, int len); +int CMS_signed_add1_attr_by_txt(CMS_SignerInfo *si, + const char *attrname, int type, + const void *bytes, int len); +void *CMS_signed_get0_data_by_OBJ(CMS_SignerInfo *si, const ASN1_OBJECT *oid, + int lastpos, int type); + +int CMS_unsigned_get_attr_count(const CMS_SignerInfo *si); +int CMS_unsigned_get_attr_by_NID(const CMS_SignerInfo *si, int nid, + int lastpos); +int CMS_unsigned_get_attr_by_OBJ(const CMS_SignerInfo *si, + const ASN1_OBJECT *obj, int lastpos); +X509_ATTRIBUTE *CMS_unsigned_get_attr(const CMS_SignerInfo *si, int loc); +X509_ATTRIBUTE *CMS_unsigned_delete_attr(CMS_SignerInfo *si, int loc); +int CMS_unsigned_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr); +int CMS_unsigned_add1_attr_by_OBJ(CMS_SignerInfo *si, + const ASN1_OBJECT *obj, int type, + const void *bytes, int len); +int CMS_unsigned_add1_attr_by_NID(CMS_SignerInfo *si, + int nid, int type, + const void *bytes, int len); +int CMS_unsigned_add1_attr_by_txt(CMS_SignerInfo *si, + const char *attrname, int type, + const void *bytes, int len); +void *CMS_unsigned_get0_data_by_OBJ(CMS_SignerInfo *si, ASN1_OBJECT *oid, + int lastpos, int type); + +int CMS_get1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest **prr); +CMS_ReceiptRequest *CMS_ReceiptRequest_create0(unsigned char *id, int idlen, + int allorfirst, + STACK_OF(GENERAL_NAMES) + *receiptList, STACK_OF(GENERAL_NAMES) + *receiptsTo); +int CMS_add1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest *rr); +void CMS_ReceiptRequest_get0_values(CMS_ReceiptRequest *rr, + ASN1_STRING **pcid, + int *pallorfirst, + STACK_OF(GENERAL_NAMES) **plist, + STACK_OF(GENERAL_NAMES) **prto); +int CMS_RecipientInfo_kari_get0_alg(CMS_RecipientInfo *ri, + X509_ALGOR **palg, + ASN1_OCTET_STRING **pukm); +STACK_OF(CMS_RecipientEncryptedKey) +*CMS_RecipientInfo_kari_get0_reks(CMS_RecipientInfo *ri); + +int CMS_RecipientInfo_kari_get0_orig_id(CMS_RecipientInfo *ri, + X509_ALGOR **pubalg, + ASN1_BIT_STRING **pubkey, + ASN1_OCTET_STRING **keyid, + X509_NAME **issuer, + ASN1_INTEGER **sno); + +int CMS_RecipientInfo_kari_orig_id_cmp(CMS_RecipientInfo *ri, X509 *cert); + +int CMS_RecipientEncryptedKey_get0_id(CMS_RecipientEncryptedKey *rek, + ASN1_OCTET_STRING **keyid, + ASN1_GENERALIZEDTIME **tm, + CMS_OtherKeyAttribute **other, + X509_NAME **issuer, ASN1_INTEGER **sno); +int CMS_RecipientEncryptedKey_cert_cmp(CMS_RecipientEncryptedKey *rek, + X509 *cert); +int CMS_RecipientInfo_kari_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pk); +EVP_CIPHER_CTX *CMS_RecipientInfo_kari_get0_ctx(CMS_RecipientInfo *ri); +int CMS_RecipientInfo_kari_decrypt(CMS_ContentInfo *cms, + CMS_RecipientInfo *ri, + CMS_RecipientEncryptedKey *rek); + +int CMS_SharedInfo_encode(unsigned char **pder, X509_ALGOR *kekalg, + ASN1_OCTET_STRING *ukm, int keylen); + +/* Backward compatibility for spelling errors. */ +# define CMS_R_UNKNOWN_DIGEST_ALGORITM CMS_R_UNKNOWN_DIGEST_ALGORITHM +# define CMS_R_UNSUPPORTED_RECPIENTINFO_TYPE \ + CMS_R_UNSUPPORTED_RECIPIENTINFO_TYPE + +# ifdef __cplusplus +} +# endif +# endif +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/cmserr.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/cmserr.h new file mode 100644 index 0000000..7dbc13d --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/cmserr.h @@ -0,0 +1,202 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_CMSERR_H +# define HEADER_CMSERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# include + +# ifndef OPENSSL_NO_CMS + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_CMS_strings(void); + +/* + * CMS function codes. + */ +# define CMS_F_CHECK_CONTENT 99 +# define CMS_F_CMS_ADD0_CERT 164 +# define CMS_F_CMS_ADD0_RECIPIENT_KEY 100 +# define CMS_F_CMS_ADD0_RECIPIENT_PASSWORD 165 +# define CMS_F_CMS_ADD1_RECEIPTREQUEST 158 +# define CMS_F_CMS_ADD1_RECIPIENT_CERT 101 +# define CMS_F_CMS_ADD1_SIGNER 102 +# define CMS_F_CMS_ADD1_SIGNINGTIME 103 +# define CMS_F_CMS_COMPRESS 104 +# define CMS_F_CMS_COMPRESSEDDATA_CREATE 105 +# define CMS_F_CMS_COMPRESSEDDATA_INIT_BIO 106 +# define CMS_F_CMS_COPY_CONTENT 107 +# define CMS_F_CMS_COPY_MESSAGEDIGEST 108 +# define CMS_F_CMS_DATA 109 +# define CMS_F_CMS_DATAFINAL 110 +# define CMS_F_CMS_DATAINIT 111 +# define CMS_F_CMS_DECRYPT 112 +# define CMS_F_CMS_DECRYPT_SET1_KEY 113 +# define CMS_F_CMS_DECRYPT_SET1_PASSWORD 166 +# define CMS_F_CMS_DECRYPT_SET1_PKEY 114 +# define CMS_F_CMS_DIGESTALGORITHM_FIND_CTX 115 +# define CMS_F_CMS_DIGESTALGORITHM_INIT_BIO 116 +# define CMS_F_CMS_DIGESTEDDATA_DO_FINAL 117 +# define CMS_F_CMS_DIGEST_VERIFY 118 +# define CMS_F_CMS_ENCODE_RECEIPT 161 +# define CMS_F_CMS_ENCRYPT 119 +# define CMS_F_CMS_ENCRYPTEDCONTENT_INIT 179 +# define CMS_F_CMS_ENCRYPTEDCONTENT_INIT_BIO 120 +# define CMS_F_CMS_ENCRYPTEDDATA_DECRYPT 121 +# define CMS_F_CMS_ENCRYPTEDDATA_ENCRYPT 122 +# define CMS_F_CMS_ENCRYPTEDDATA_SET1_KEY 123 +# define CMS_F_CMS_ENVELOPEDDATA_CREATE 124 +# define CMS_F_CMS_ENVELOPEDDATA_INIT_BIO 125 +# define CMS_F_CMS_ENVELOPED_DATA_INIT 126 +# define CMS_F_CMS_ENV_ASN1_CTRL 171 +# define CMS_F_CMS_FINAL 127 +# define CMS_F_CMS_GET0_CERTIFICATE_CHOICES 128 +# define CMS_F_CMS_GET0_CONTENT 129 +# define CMS_F_CMS_GET0_ECONTENT_TYPE 130 +# define CMS_F_CMS_GET0_ENVELOPED 131 +# define CMS_F_CMS_GET0_REVOCATION_CHOICES 132 +# define CMS_F_CMS_GET0_SIGNED 133 +# define CMS_F_CMS_MSGSIGDIGEST_ADD1 162 +# define CMS_F_CMS_RECEIPTREQUEST_CREATE0 159 +# define CMS_F_CMS_RECEIPT_VERIFY 160 +# define CMS_F_CMS_RECIPIENTINFO_DECRYPT 134 +# define CMS_F_CMS_RECIPIENTINFO_ENCRYPT 169 +# define CMS_F_CMS_RECIPIENTINFO_KARI_ENCRYPT 178 +# define CMS_F_CMS_RECIPIENTINFO_KARI_GET0_ALG 175 +# define CMS_F_CMS_RECIPIENTINFO_KARI_GET0_ORIG_ID 173 +# define CMS_F_CMS_RECIPIENTINFO_KARI_GET0_REKS 172 +# define CMS_F_CMS_RECIPIENTINFO_KARI_ORIG_ID_CMP 174 +# define CMS_F_CMS_RECIPIENTINFO_KEKRI_DECRYPT 135 +# define CMS_F_CMS_RECIPIENTINFO_KEKRI_ENCRYPT 136 +# define CMS_F_CMS_RECIPIENTINFO_KEKRI_GET0_ID 137 +# define CMS_F_CMS_RECIPIENTINFO_KEKRI_ID_CMP 138 +# define CMS_F_CMS_RECIPIENTINFO_KTRI_CERT_CMP 139 +# define CMS_F_CMS_RECIPIENTINFO_KTRI_DECRYPT 140 +# define CMS_F_CMS_RECIPIENTINFO_KTRI_ENCRYPT 141 +# define CMS_F_CMS_RECIPIENTINFO_KTRI_GET0_ALGS 142 +# define CMS_F_CMS_RECIPIENTINFO_KTRI_GET0_SIGNER_ID 143 +# define CMS_F_CMS_RECIPIENTINFO_PWRI_CRYPT 167 +# define CMS_F_CMS_RECIPIENTINFO_SET0_KEY 144 +# define CMS_F_CMS_RECIPIENTINFO_SET0_PASSWORD 168 +# define CMS_F_CMS_RECIPIENTINFO_SET0_PKEY 145 +# define CMS_F_CMS_SD_ASN1_CTRL 170 +# define CMS_F_CMS_SET1_IAS 176 +# define CMS_F_CMS_SET1_KEYID 177 +# define CMS_F_CMS_SET1_SIGNERIDENTIFIER 146 +# define CMS_F_CMS_SET_DETACHED 147 +# define CMS_F_CMS_SIGN 148 +# define CMS_F_CMS_SIGNED_DATA_INIT 149 +# define CMS_F_CMS_SIGNERINFO_CONTENT_SIGN 150 +# define CMS_F_CMS_SIGNERINFO_SIGN 151 +# define CMS_F_CMS_SIGNERINFO_VERIFY 152 +# define CMS_F_CMS_SIGNERINFO_VERIFY_CERT 153 +# define CMS_F_CMS_SIGNERINFO_VERIFY_CONTENT 154 +# define CMS_F_CMS_SIGN_RECEIPT 163 +# define CMS_F_CMS_SI_CHECK_ATTRIBUTES 183 +# define CMS_F_CMS_STREAM 155 +# define CMS_F_CMS_UNCOMPRESS 156 +# define CMS_F_CMS_VERIFY 157 +# define CMS_F_KEK_UNWRAP_KEY 180 + +/* + * CMS reason codes. + */ +# define CMS_R_ADD_SIGNER_ERROR 99 +# define CMS_R_ATTRIBUTE_ERROR 161 +# define CMS_R_CERTIFICATE_ALREADY_PRESENT 175 +# define CMS_R_CERTIFICATE_HAS_NO_KEYID 160 +# define CMS_R_CERTIFICATE_VERIFY_ERROR 100 +# define CMS_R_CIPHER_INITIALISATION_ERROR 101 +# define CMS_R_CIPHER_PARAMETER_INITIALISATION_ERROR 102 +# define CMS_R_CMS_DATAFINAL_ERROR 103 +# define CMS_R_CMS_LIB 104 +# define CMS_R_CONTENTIDENTIFIER_MISMATCH 170 +# define CMS_R_CONTENT_NOT_FOUND 105 +# define CMS_R_CONTENT_TYPE_MISMATCH 171 +# define CMS_R_CONTENT_TYPE_NOT_COMPRESSED_DATA 106 +# define CMS_R_CONTENT_TYPE_NOT_ENVELOPED_DATA 107 +# define CMS_R_CONTENT_TYPE_NOT_SIGNED_DATA 108 +# define CMS_R_CONTENT_VERIFY_ERROR 109 +# define CMS_R_CTRL_ERROR 110 +# define CMS_R_CTRL_FAILURE 111 +# define CMS_R_DECRYPT_ERROR 112 +# define CMS_R_ERROR_GETTING_PUBLIC_KEY 113 +# define CMS_R_ERROR_READING_MESSAGEDIGEST_ATTRIBUTE 114 +# define CMS_R_ERROR_SETTING_KEY 115 +# define CMS_R_ERROR_SETTING_RECIPIENTINFO 116 +# define CMS_R_INVALID_ENCRYPTED_KEY_LENGTH 117 +# define CMS_R_INVALID_KEY_ENCRYPTION_PARAMETER 176 +# define CMS_R_INVALID_KEY_LENGTH 118 +# define CMS_R_MD_BIO_INIT_ERROR 119 +# define CMS_R_MESSAGEDIGEST_ATTRIBUTE_WRONG_LENGTH 120 +# define CMS_R_MESSAGEDIGEST_WRONG_LENGTH 121 +# define CMS_R_MSGSIGDIGEST_ERROR 172 +# define CMS_R_MSGSIGDIGEST_VERIFICATION_FAILURE 162 +# define CMS_R_MSGSIGDIGEST_WRONG_LENGTH 163 +# define CMS_R_NEED_ONE_SIGNER 164 +# define CMS_R_NOT_A_SIGNED_RECEIPT 165 +# define CMS_R_NOT_ENCRYPTED_DATA 122 +# define CMS_R_NOT_KEK 123 +# define CMS_R_NOT_KEY_AGREEMENT 181 +# define CMS_R_NOT_KEY_TRANSPORT 124 +# define CMS_R_NOT_PWRI 177 +# define CMS_R_NOT_SUPPORTED_FOR_THIS_KEY_TYPE 125 +# define CMS_R_NO_CIPHER 126 +# define CMS_R_NO_CONTENT 127 +# define CMS_R_NO_CONTENT_TYPE 173 +# define CMS_R_NO_DEFAULT_DIGEST 128 +# define CMS_R_NO_DIGEST_SET 129 +# define CMS_R_NO_KEY 130 +# define CMS_R_NO_KEY_OR_CERT 174 +# define CMS_R_NO_MATCHING_DIGEST 131 +# define CMS_R_NO_MATCHING_RECIPIENT 132 +# define CMS_R_NO_MATCHING_SIGNATURE 166 +# define CMS_R_NO_MSGSIGDIGEST 167 +# define CMS_R_NO_PASSWORD 178 +# define CMS_R_NO_PRIVATE_KEY 133 +# define CMS_R_NO_PUBLIC_KEY 134 +# define CMS_R_NO_RECEIPT_REQUEST 168 +# define CMS_R_NO_SIGNERS 135 +# define CMS_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 136 +# define CMS_R_RECEIPT_DECODE_ERROR 169 +# define CMS_R_RECIPIENT_ERROR 137 +# define CMS_R_SIGNER_CERTIFICATE_NOT_FOUND 138 +# define CMS_R_SIGNFINAL_ERROR 139 +# define CMS_R_SMIME_TEXT_ERROR 140 +# define CMS_R_STORE_INIT_ERROR 141 +# define CMS_R_TYPE_NOT_COMPRESSED_DATA 142 +# define CMS_R_TYPE_NOT_DATA 143 +# define CMS_R_TYPE_NOT_DIGESTED_DATA 144 +# define CMS_R_TYPE_NOT_ENCRYPTED_DATA 145 +# define CMS_R_TYPE_NOT_ENVELOPED_DATA 146 +# define CMS_R_UNABLE_TO_FINALIZE_CONTEXT 147 +# define CMS_R_UNKNOWN_CIPHER 148 +# define CMS_R_UNKNOWN_DIGEST_ALGORITHM 149 +# define CMS_R_UNKNOWN_ID 150 +# define CMS_R_UNSUPPORTED_COMPRESSION_ALGORITHM 151 +# define CMS_R_UNSUPPORTED_CONTENT_TYPE 152 +# define CMS_R_UNSUPPORTED_KEK_ALGORITHM 153 +# define CMS_R_UNSUPPORTED_KEY_ENCRYPTION_ALGORITHM 179 +# define CMS_R_UNSUPPORTED_RECIPIENTINFO_TYPE 155 +# define CMS_R_UNSUPPORTED_RECIPIENT_TYPE 154 +# define CMS_R_UNSUPPORTED_TYPE 156 +# define CMS_R_UNWRAP_ERROR 157 +# define CMS_R_UNWRAP_FAILURE 180 +# define CMS_R_VERIFICATION_FAILURE 158 +# define CMS_R_WRAP_ERROR 159 + +# endif +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/comp.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/comp.h new file mode 100644 index 0000000..d814d3c --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/comp.h @@ -0,0 +1,53 @@ +/* + * Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_COMP_H +# define HEADER_COMP_H + +# include + +# ifndef OPENSSL_NO_COMP +# include +# include +# ifdef __cplusplus +extern "C" { +# endif + + + +COMP_CTX *COMP_CTX_new(COMP_METHOD *meth); +const COMP_METHOD *COMP_CTX_get_method(const COMP_CTX *ctx); +int COMP_CTX_get_type(const COMP_CTX* comp); +int COMP_get_type(const COMP_METHOD *meth); +const char *COMP_get_name(const COMP_METHOD *meth); +void COMP_CTX_free(COMP_CTX *ctx); + +int COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen, + unsigned char *in, int ilen); +int COMP_expand_block(COMP_CTX *ctx, unsigned char *out, int olen, + unsigned char *in, int ilen); + +COMP_METHOD *COMP_zlib(void); + +#if OPENSSL_API_COMPAT < 0x10100000L +#define COMP_zlib_cleanup() while(0) continue +#endif + +# ifdef HEADER_BIO_H +# ifdef ZLIB +const BIO_METHOD *BIO_f_zlib(void); +# endif +# endif + + +# ifdef __cplusplus +} +# endif +# endif +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/comperr.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/comperr.h new file mode 100644 index 0000000..90231e9 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/comperr.h @@ -0,0 +1,44 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_COMPERR_H +# define HEADER_COMPERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# include + +# ifndef OPENSSL_NO_COMP + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_COMP_strings(void); + +/* + * COMP function codes. + */ +# define COMP_F_BIO_ZLIB_FLUSH 99 +# define COMP_F_BIO_ZLIB_NEW 100 +# define COMP_F_BIO_ZLIB_READ 101 +# define COMP_F_BIO_ZLIB_WRITE 102 +# define COMP_F_COMP_CTX_NEW 103 + +/* + * COMP reason codes. + */ +# define COMP_R_ZLIB_DEFLATE_ERROR 99 +# define COMP_R_ZLIB_INFLATE_ERROR 100 +# define COMP_R_ZLIB_NOT_SUPPORTED 101 + +# endif +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/conf.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/conf.h new file mode 100644 index 0000000..7336cd2 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/conf.h @@ -0,0 +1,168 @@ +/* + * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_CONF_H +# define HEADER_CONF_H + +# include +# include +# include +# include +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { + char *section; + char *name; + char *value; +} CONF_VALUE; + +DEFINE_STACK_OF(CONF_VALUE) +DEFINE_LHASH_OF(CONF_VALUE); + +struct conf_st; +struct conf_method_st; +typedef struct conf_method_st CONF_METHOD; + +struct conf_method_st { + const char *name; + CONF *(*create) (CONF_METHOD *meth); + int (*init) (CONF *conf); + int (*destroy) (CONF *conf); + int (*destroy_data) (CONF *conf); + int (*load_bio) (CONF *conf, BIO *bp, long *eline); + int (*dump) (const CONF *conf, BIO *bp); + int (*is_number) (const CONF *conf, char c); + int (*to_int) (const CONF *conf, char c); + int (*load) (CONF *conf, const char *name, long *eline); +}; + +/* Module definitions */ + +typedef struct conf_imodule_st CONF_IMODULE; +typedef struct conf_module_st CONF_MODULE; + +DEFINE_STACK_OF(CONF_MODULE) +DEFINE_STACK_OF(CONF_IMODULE) + +/* DSO module function typedefs */ +typedef int conf_init_func (CONF_IMODULE *md, const CONF *cnf); +typedef void conf_finish_func (CONF_IMODULE *md); + +# define CONF_MFLAGS_IGNORE_ERRORS 0x1 +# define CONF_MFLAGS_IGNORE_RETURN_CODES 0x2 +# define CONF_MFLAGS_SILENT 0x4 +# define CONF_MFLAGS_NO_DSO 0x8 +# define CONF_MFLAGS_IGNORE_MISSING_FILE 0x10 +# define CONF_MFLAGS_DEFAULT_SECTION 0x20 + +int CONF_set_default_method(CONF_METHOD *meth); +void CONF_set_nconf(CONF *conf, LHASH_OF(CONF_VALUE) *hash); +LHASH_OF(CONF_VALUE) *CONF_load(LHASH_OF(CONF_VALUE) *conf, const char *file, + long *eline); +# ifndef OPENSSL_NO_STDIO +LHASH_OF(CONF_VALUE) *CONF_load_fp(LHASH_OF(CONF_VALUE) *conf, FILE *fp, + long *eline); +# endif +LHASH_OF(CONF_VALUE) *CONF_load_bio(LHASH_OF(CONF_VALUE) *conf, BIO *bp, + long *eline); +STACK_OF(CONF_VALUE) *CONF_get_section(LHASH_OF(CONF_VALUE) *conf, + const char *section); +char *CONF_get_string(LHASH_OF(CONF_VALUE) *conf, const char *group, + const char *name); +long CONF_get_number(LHASH_OF(CONF_VALUE) *conf, const char *group, + const char *name); +void CONF_free(LHASH_OF(CONF_VALUE) *conf); +#ifndef OPENSSL_NO_STDIO +int CONF_dump_fp(LHASH_OF(CONF_VALUE) *conf, FILE *out); +#endif +int CONF_dump_bio(LHASH_OF(CONF_VALUE) *conf, BIO *out); + +DEPRECATEDIN_1_1_0(void OPENSSL_config(const char *config_name)) + +#if OPENSSL_API_COMPAT < 0x10100000L +# define OPENSSL_no_config() \ + OPENSSL_init_crypto(OPENSSL_INIT_NO_LOAD_CONFIG, NULL) +#endif + +/* + * New conf code. The semantics are different from the functions above. If + * that wasn't the case, the above functions would have been replaced + */ + +struct conf_st { + CONF_METHOD *meth; + void *meth_data; + LHASH_OF(CONF_VALUE) *data; +}; + +CONF *NCONF_new(CONF_METHOD *meth); +CONF_METHOD *NCONF_default(void); +CONF_METHOD *NCONF_WIN32(void); +void NCONF_free(CONF *conf); +void NCONF_free_data(CONF *conf); + +int NCONF_load(CONF *conf, const char *file, long *eline); +# ifndef OPENSSL_NO_STDIO +int NCONF_load_fp(CONF *conf, FILE *fp, long *eline); +# endif +int NCONF_load_bio(CONF *conf, BIO *bp, long *eline); +STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf, + const char *section); +char *NCONF_get_string(const CONF *conf, const char *group, const char *name); +int NCONF_get_number_e(const CONF *conf, const char *group, const char *name, + long *result); +#ifndef OPENSSL_NO_STDIO +int NCONF_dump_fp(const CONF *conf, FILE *out); +#endif +int NCONF_dump_bio(const CONF *conf, BIO *out); + +#define NCONF_get_number(c,g,n,r) NCONF_get_number_e(c,g,n,r) + +/* Module functions */ + +int CONF_modules_load(const CONF *cnf, const char *appname, + unsigned long flags); +int CONF_modules_load_file(const char *filename, const char *appname, + unsigned long flags); +void CONF_modules_unload(int all); +void CONF_modules_finish(void); +#if OPENSSL_API_COMPAT < 0x10100000L +# define CONF_modules_free() while(0) continue +#endif +int CONF_module_add(const char *name, conf_init_func *ifunc, + conf_finish_func *ffunc); + +const char *CONF_imodule_get_name(const CONF_IMODULE *md); +const char *CONF_imodule_get_value(const CONF_IMODULE *md); +void *CONF_imodule_get_usr_data(const CONF_IMODULE *md); +void CONF_imodule_set_usr_data(CONF_IMODULE *md, void *usr_data); +CONF_MODULE *CONF_imodule_get_module(const CONF_IMODULE *md); +unsigned long CONF_imodule_get_flags(const CONF_IMODULE *md); +void CONF_imodule_set_flags(CONF_IMODULE *md, unsigned long flags); +void *CONF_module_get_usr_data(CONF_MODULE *pmod); +void CONF_module_set_usr_data(CONF_MODULE *pmod, void *usr_data); + +char *CONF_get1_default_config_file(void); + +int CONF_parse_list(const char *list, int sep, int nospc, + int (*list_cb) (const char *elem, int len, void *usr), + void *arg); + +void OPENSSL_load_builtin_modules(void); + + +# ifdef __cplusplus +} +# endif +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/conf_api.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/conf_api.h new file mode 100644 index 0000000..a0275ad --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/conf_api.h @@ -0,0 +1,40 @@ +/* + * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_CONF_API_H +# define HEADER_CONF_API_H + +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Up until OpenSSL 0.9.5a, this was new_section */ +CONF_VALUE *_CONF_new_section(CONF *conf, const char *section); +/* Up until OpenSSL 0.9.5a, this was get_section */ +CONF_VALUE *_CONF_get_section(const CONF *conf, const char *section); +/* Up until OpenSSL 0.9.5a, this was CONF_get_section */ +STACK_OF(CONF_VALUE) *_CONF_get_section_values(const CONF *conf, + const char *section); + +int _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value); +char *_CONF_get_string(const CONF *conf, const char *section, + const char *name); +long _CONF_get_number(const CONF *conf, const char *section, + const char *name); + +int _CONF_new_data(CONF *conf); +void _CONF_free_data(CONF *conf); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/conferr.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/conferr.h new file mode 100644 index 0000000..32b9229 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/conferr.h @@ -0,0 +1,76 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_CONFERR_H +# define HEADER_CONFERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_CONF_strings(void); + +/* + * CONF function codes. + */ +# define CONF_F_CONF_DUMP_FP 104 +# define CONF_F_CONF_LOAD 100 +# define CONF_F_CONF_LOAD_FP 103 +# define CONF_F_CONF_PARSE_LIST 119 +# define CONF_F_DEF_LOAD 120 +# define CONF_F_DEF_LOAD_BIO 121 +# define CONF_F_GET_NEXT_FILE 107 +# define CONF_F_MODULE_ADD 122 +# define CONF_F_MODULE_INIT 115 +# define CONF_F_MODULE_LOAD_DSO 117 +# define CONF_F_MODULE_RUN 118 +# define CONF_F_NCONF_DUMP_BIO 105 +# define CONF_F_NCONF_DUMP_FP 106 +# define CONF_F_NCONF_GET_NUMBER_E 112 +# define CONF_F_NCONF_GET_SECTION 108 +# define CONF_F_NCONF_GET_STRING 109 +# define CONF_F_NCONF_LOAD 113 +# define CONF_F_NCONF_LOAD_BIO 110 +# define CONF_F_NCONF_LOAD_FP 114 +# define CONF_F_NCONF_NEW 111 +# define CONF_F_PROCESS_INCLUDE 116 +# define CONF_F_SSL_MODULE_INIT 123 +# define CONF_F_STR_COPY 101 + +/* + * CONF reason codes. + */ +# define CONF_R_ERROR_LOADING_DSO 110 +# define CONF_R_LIST_CANNOT_BE_NULL 115 +# define CONF_R_MISSING_CLOSE_SQUARE_BRACKET 100 +# define CONF_R_MISSING_EQUAL_SIGN 101 +# define CONF_R_MISSING_INIT_FUNCTION 112 +# define CONF_R_MODULE_INITIALIZATION_ERROR 109 +# define CONF_R_NO_CLOSE_BRACE 102 +# define CONF_R_NO_CONF 105 +# define CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE 106 +# define CONF_R_NO_SECTION 107 +# define CONF_R_NO_SUCH_FILE 114 +# define CONF_R_NO_VALUE 108 +# define CONF_R_NUMBER_TOO_LARGE 121 +# define CONF_R_RECURSIVE_DIRECTORY_INCLUDE 111 +# define CONF_R_SSL_COMMAND_SECTION_EMPTY 117 +# define CONF_R_SSL_COMMAND_SECTION_NOT_FOUND 118 +# define CONF_R_SSL_SECTION_EMPTY 119 +# define CONF_R_SSL_SECTION_NOT_FOUND 120 +# define CONF_R_UNABLE_TO_CREATE_NEW_SECTION 103 +# define CONF_R_UNKNOWN_MODULE_NAME 113 +# define CONF_R_VARIABLE_EXPANSION_TOO_LONG 116 +# define CONF_R_VARIABLE_HAS_NO_VALUE 104 + +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/crypto.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/crypto.h new file mode 100644 index 0000000..7d0b526 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/crypto.h @@ -0,0 +1,445 @@ +/* + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_CRYPTO_H +# define HEADER_CRYPTO_H + +# include +# include + +# include + +# ifndef OPENSSL_NO_STDIO +# include +# endif + +# include +# include +# include +# include +# include + +# ifdef CHARSET_EBCDIC +# include +# endif + +/* + * Resolve problems on some operating systems with symbol names that clash + * one way or another + */ +# include + +# if OPENSSL_API_COMPAT < 0x10100000L +# include +# endif + +#ifdef __cplusplus +extern "C" { +#endif + +# if OPENSSL_API_COMPAT < 0x10100000L +# define SSLeay OpenSSL_version_num +# define SSLeay_version OpenSSL_version +# define SSLEAY_VERSION_NUMBER OPENSSL_VERSION_NUMBER +# define SSLEAY_VERSION OPENSSL_VERSION +# define SSLEAY_CFLAGS OPENSSL_CFLAGS +# define SSLEAY_BUILT_ON OPENSSL_BUILT_ON +# define SSLEAY_PLATFORM OPENSSL_PLATFORM +# define SSLEAY_DIR OPENSSL_DIR + +/* + * Old type for allocating dynamic locks. No longer used. Use the new thread + * API instead. + */ +typedef struct { + int dummy; +} CRYPTO_dynlock; + +# endif /* OPENSSL_API_COMPAT */ + +typedef void CRYPTO_RWLOCK; + +CRYPTO_RWLOCK *CRYPTO_THREAD_lock_new(void); +int CRYPTO_THREAD_read_lock(CRYPTO_RWLOCK *lock); +int CRYPTO_THREAD_write_lock(CRYPTO_RWLOCK *lock); +int CRYPTO_THREAD_unlock(CRYPTO_RWLOCK *lock); +void CRYPTO_THREAD_lock_free(CRYPTO_RWLOCK *lock); + +int CRYPTO_atomic_add(int *val, int amount, int *ret, CRYPTO_RWLOCK *lock); + +/* + * The following can be used to detect memory leaks in the library. If + * used, it turns on malloc checking + */ +# define CRYPTO_MEM_CHECK_OFF 0x0 /* Control only */ +# define CRYPTO_MEM_CHECK_ON 0x1 /* Control and mode bit */ +# define CRYPTO_MEM_CHECK_ENABLE 0x2 /* Control and mode bit */ +# define CRYPTO_MEM_CHECK_DISABLE 0x3 /* Control only */ + +struct crypto_ex_data_st { + STACK_OF(void) *sk; +}; +DEFINE_STACK_OF(void) + +/* + * Per class, we have a STACK of function pointers. + */ +# define CRYPTO_EX_INDEX_SSL 0 +# define CRYPTO_EX_INDEX_SSL_CTX 1 +# define CRYPTO_EX_INDEX_SSL_SESSION 2 +# define CRYPTO_EX_INDEX_X509 3 +# define CRYPTO_EX_INDEX_X509_STORE 4 +# define CRYPTO_EX_INDEX_X509_STORE_CTX 5 +# define CRYPTO_EX_INDEX_DH 6 +# define CRYPTO_EX_INDEX_DSA 7 +# define CRYPTO_EX_INDEX_EC_KEY 8 +# define CRYPTO_EX_INDEX_RSA 9 +# define CRYPTO_EX_INDEX_ENGINE 10 +# define CRYPTO_EX_INDEX_UI 11 +# define CRYPTO_EX_INDEX_BIO 12 +# define CRYPTO_EX_INDEX_APP 13 +# define CRYPTO_EX_INDEX_UI_METHOD 14 +# define CRYPTO_EX_INDEX_DRBG 15 +# define CRYPTO_EX_INDEX__COUNT 16 + +/* No longer needed, so this is a no-op */ +#define OPENSSL_malloc_init() while(0) continue + +int CRYPTO_mem_ctrl(int mode); + +# define OPENSSL_malloc(num) \ + CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE) +# define OPENSSL_zalloc(num) \ + CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE) +# define OPENSSL_realloc(addr, num) \ + CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE) +# define OPENSSL_clear_realloc(addr, old_num, num) \ + CRYPTO_clear_realloc(addr, old_num, num, OPENSSL_FILE, OPENSSL_LINE) +# define OPENSSL_clear_free(addr, num) \ + CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE) +# define OPENSSL_free(addr) \ + CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE) +# define OPENSSL_memdup(str, s) \ + CRYPTO_memdup((str), s, OPENSSL_FILE, OPENSSL_LINE) +# define OPENSSL_strdup(str) \ + CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE) +# define OPENSSL_strndup(str, n) \ + CRYPTO_strndup(str, n, OPENSSL_FILE, OPENSSL_LINE) +# define OPENSSL_secure_malloc(num) \ + CRYPTO_secure_malloc(num, OPENSSL_FILE, OPENSSL_LINE) +# define OPENSSL_secure_zalloc(num) \ + CRYPTO_secure_zalloc(num, OPENSSL_FILE, OPENSSL_LINE) +# define OPENSSL_secure_free(addr) \ + CRYPTO_secure_free(addr, OPENSSL_FILE, OPENSSL_LINE) +# define OPENSSL_secure_clear_free(addr, num) \ + CRYPTO_secure_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE) +# define OPENSSL_secure_actual_size(ptr) \ + CRYPTO_secure_actual_size(ptr) + +size_t OPENSSL_strlcpy(char *dst, const char *src, size_t siz); +size_t OPENSSL_strlcat(char *dst, const char *src, size_t siz); +size_t OPENSSL_strnlen(const char *str, size_t maxlen); +char *OPENSSL_buf2hexstr(const unsigned char *buffer, long len); +unsigned char *OPENSSL_hexstr2buf(const char *str, long *len); +int OPENSSL_hexchar2int(unsigned char c); + +# define OPENSSL_MALLOC_MAX_NELEMS(type) (((1U<<(sizeof(int)*8-1))-1)/sizeof(type)) + +unsigned long OpenSSL_version_num(void); +const char *OpenSSL_version(int type); +# define OPENSSL_VERSION 0 +# define OPENSSL_CFLAGS 1 +# define OPENSSL_BUILT_ON 2 +# define OPENSSL_PLATFORM 3 +# define OPENSSL_DIR 4 +# define OPENSSL_ENGINES_DIR 5 + +int OPENSSL_issetugid(void); + +typedef void CRYPTO_EX_new (void *parent, void *ptr, CRYPTO_EX_DATA *ad, + int idx, long argl, void *argp); +typedef void CRYPTO_EX_free (void *parent, void *ptr, CRYPTO_EX_DATA *ad, + int idx, long argl, void *argp); +typedef int CRYPTO_EX_dup (CRYPTO_EX_DATA *to, const CRYPTO_EX_DATA *from, + void *from_d, int idx, long argl, void *argp); +__owur int CRYPTO_get_ex_new_index(int class_index, long argl, void *argp, + CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, + CRYPTO_EX_free *free_func); +/* No longer use an index. */ +int CRYPTO_free_ex_index(int class_index, int idx); + +/* + * Initialise/duplicate/free CRYPTO_EX_DATA variables corresponding to a + * given class (invokes whatever per-class callbacks are applicable) + */ +int CRYPTO_new_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad); +int CRYPTO_dup_ex_data(int class_index, CRYPTO_EX_DATA *to, + const CRYPTO_EX_DATA *from); + +void CRYPTO_free_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad); + +/* + * Get/set data in a CRYPTO_EX_DATA variable corresponding to a particular + * index (relative to the class type involved) + */ +int CRYPTO_set_ex_data(CRYPTO_EX_DATA *ad, int idx, void *val); +void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx); + +# if OPENSSL_API_COMPAT < 0x10100000L +/* + * This function cleans up all "ex_data" state. It mustn't be called under + * potential race-conditions. + */ +# define CRYPTO_cleanup_all_ex_data() while(0) continue + +/* + * The old locking functions have been removed completely without compatibility + * macros. This is because the old functions either could not properly report + * errors, or the returned error values were not clearly documented. + * Replacing the locking functions with no-ops would cause race condition + * issues in the affected applications. It is far better for them to fail at + * compile time. + * On the other hand, the locking callbacks are no longer used. Consequently, + * the callback management functions can be safely replaced with no-op macros. + */ +# define CRYPTO_num_locks() (1) +# define CRYPTO_set_locking_callback(func) +# define CRYPTO_get_locking_callback() (NULL) +# define CRYPTO_set_add_lock_callback(func) +# define CRYPTO_get_add_lock_callback() (NULL) + +/* + * These defines where used in combination with the old locking callbacks, + * they are not called anymore, but old code that's not called might still + * use them. + */ +# define CRYPTO_LOCK 1 +# define CRYPTO_UNLOCK 2 +# define CRYPTO_READ 4 +# define CRYPTO_WRITE 8 + +/* This structure is no longer used */ +typedef struct crypto_threadid_st { + int dummy; +} CRYPTO_THREADID; +/* Only use CRYPTO_THREADID_set_[numeric|pointer]() within callbacks */ +# define CRYPTO_THREADID_set_numeric(id, val) +# define CRYPTO_THREADID_set_pointer(id, ptr) +# define CRYPTO_THREADID_set_callback(threadid_func) (0) +# define CRYPTO_THREADID_get_callback() (NULL) +# define CRYPTO_THREADID_current(id) +# define CRYPTO_THREADID_cmp(a, b) (-1) +# define CRYPTO_THREADID_cpy(dest, src) +# define CRYPTO_THREADID_hash(id) (0UL) + +# if OPENSSL_API_COMPAT < 0x10000000L +# define CRYPTO_set_id_callback(func) +# define CRYPTO_get_id_callback() (NULL) +# define CRYPTO_thread_id() (0UL) +# endif /* OPENSSL_API_COMPAT < 0x10000000L */ + +# define CRYPTO_set_dynlock_create_callback(dyn_create_function) +# define CRYPTO_set_dynlock_lock_callback(dyn_lock_function) +# define CRYPTO_set_dynlock_destroy_callback(dyn_destroy_function) +# define CRYPTO_get_dynlock_create_callback() (NULL) +# define CRYPTO_get_dynlock_lock_callback() (NULL) +# define CRYPTO_get_dynlock_destroy_callback() (NULL) +# endif /* OPENSSL_API_COMPAT < 0x10100000L */ + +int CRYPTO_set_mem_functions( + void *(*m) (size_t, const char *, int), + void *(*r) (void *, size_t, const char *, int), + void (*f) (void *, const char *, int)); +int CRYPTO_set_mem_debug(int flag); +void CRYPTO_get_mem_functions( + void *(**m) (size_t, const char *, int), + void *(**r) (void *, size_t, const char *, int), + void (**f) (void *, const char *, int)); + +void *CRYPTO_malloc(size_t num, const char *file, int line); +void *CRYPTO_zalloc(size_t num, const char *file, int line); +void *CRYPTO_memdup(const void *str, size_t siz, const char *file, int line); +char *CRYPTO_strdup(const char *str, const char *file, int line); +char *CRYPTO_strndup(const char *str, size_t s, const char *file, int line); +void CRYPTO_free(void *ptr, const char *file, int line); +void CRYPTO_clear_free(void *ptr, size_t num, const char *file, int line); +void *CRYPTO_realloc(void *addr, size_t num, const char *file, int line); +void *CRYPTO_clear_realloc(void *addr, size_t old_num, size_t num, + const char *file, int line); + +int CRYPTO_secure_malloc_init(size_t sz, int minsize); +int CRYPTO_secure_malloc_done(void); +void *CRYPTO_secure_malloc(size_t num, const char *file, int line); +void *CRYPTO_secure_zalloc(size_t num, const char *file, int line); +void CRYPTO_secure_free(void *ptr, const char *file, int line); +void CRYPTO_secure_clear_free(void *ptr, size_t num, + const char *file, int line); +int CRYPTO_secure_allocated(const void *ptr); +int CRYPTO_secure_malloc_initialized(void); +size_t CRYPTO_secure_actual_size(void *ptr); +size_t CRYPTO_secure_used(void); + +void OPENSSL_cleanse(void *ptr, size_t len); + +# ifndef OPENSSL_NO_CRYPTO_MDEBUG +# define OPENSSL_mem_debug_push(info) \ + CRYPTO_mem_debug_push(info, OPENSSL_FILE, OPENSSL_LINE) +# define OPENSSL_mem_debug_pop() \ + CRYPTO_mem_debug_pop() +int CRYPTO_mem_debug_push(const char *info, const char *file, int line); +int CRYPTO_mem_debug_pop(void); +void CRYPTO_get_alloc_counts(int *mcount, int *rcount, int *fcount); + +/*- + * Debugging functions (enabled by CRYPTO_set_mem_debug(1)) + * The flag argument has the following significance: + * 0: called before the actual memory allocation has taken place + * 1: called after the actual memory allocation has taken place + */ +void CRYPTO_mem_debug_malloc(void *addr, size_t num, int flag, + const char *file, int line); +void CRYPTO_mem_debug_realloc(void *addr1, void *addr2, size_t num, int flag, + const char *file, int line); +void CRYPTO_mem_debug_free(void *addr, int flag, + const char *file, int line); + +int CRYPTO_mem_leaks_cb(int (*cb) (const char *str, size_t len, void *u), + void *u); +# ifndef OPENSSL_NO_STDIO +int CRYPTO_mem_leaks_fp(FILE *); +# endif +int CRYPTO_mem_leaks(BIO *bio); +# endif + +/* die if we have to */ +ossl_noreturn void OPENSSL_die(const char *assertion, const char *file, int line); +# if OPENSSL_API_COMPAT < 0x10100000L +# define OpenSSLDie(f,l,a) OPENSSL_die((a),(f),(l)) +# endif +# define OPENSSL_assert(e) \ + (void)((e) ? 0 : (OPENSSL_die("assertion failed: " #e, OPENSSL_FILE, OPENSSL_LINE), 1)) + +int OPENSSL_isservice(void); + +int FIPS_mode(void); +int FIPS_mode_set(int r); + +void OPENSSL_init(void); +# ifdef OPENSSL_SYS_UNIX +void OPENSSL_fork_prepare(void); +void OPENSSL_fork_parent(void); +void OPENSSL_fork_child(void); +# endif + +struct tm *OPENSSL_gmtime(const time_t *timer, struct tm *result); +int OPENSSL_gmtime_adj(struct tm *tm, int offset_day, long offset_sec); +int OPENSSL_gmtime_diff(int *pday, int *psec, + const struct tm *from, const struct tm *to); + +/* + * CRYPTO_memcmp returns zero iff the |len| bytes at |a| and |b| are equal. + * It takes an amount of time dependent on |len|, but independent of the + * contents of |a| and |b|. Unlike memcmp, it cannot be used to put elements + * into a defined order as the return value when a != b is undefined, other + * than to be non-zero. + */ +int CRYPTO_memcmp(const void * in_a, const void * in_b, size_t len); + +/* Standard initialisation options */ +# define OPENSSL_INIT_NO_LOAD_CRYPTO_STRINGS 0x00000001L +# define OPENSSL_INIT_LOAD_CRYPTO_STRINGS 0x00000002L +# define OPENSSL_INIT_ADD_ALL_CIPHERS 0x00000004L +# define OPENSSL_INIT_ADD_ALL_DIGESTS 0x00000008L +# define OPENSSL_INIT_NO_ADD_ALL_CIPHERS 0x00000010L +# define OPENSSL_INIT_NO_ADD_ALL_DIGESTS 0x00000020L +# define OPENSSL_INIT_LOAD_CONFIG 0x00000040L +# define OPENSSL_INIT_NO_LOAD_CONFIG 0x00000080L +# define OPENSSL_INIT_ASYNC 0x00000100L +# define OPENSSL_INIT_ENGINE_RDRAND 0x00000200L +# define OPENSSL_INIT_ENGINE_DYNAMIC 0x00000400L +# define OPENSSL_INIT_ENGINE_OPENSSL 0x00000800L +# define OPENSSL_INIT_ENGINE_CRYPTODEV 0x00001000L +# define OPENSSL_INIT_ENGINE_CAPI 0x00002000L +# define OPENSSL_INIT_ENGINE_PADLOCK 0x00004000L +# define OPENSSL_INIT_ENGINE_AFALG 0x00008000L +/* OPENSSL_INIT_ZLIB 0x00010000L */ +# define OPENSSL_INIT_ATFORK 0x00020000L +/* OPENSSL_INIT_BASE_ONLY 0x00040000L */ +# define OPENSSL_INIT_NO_ATEXIT 0x00080000L +/* OPENSSL_INIT flag range 0xfff00000 reserved for OPENSSL_init_ssl() */ +/* Max OPENSSL_INIT flag value is 0x80000000 */ + +/* openssl and dasync not counted as builtin */ +# define OPENSSL_INIT_ENGINE_ALL_BUILTIN \ + (OPENSSL_INIT_ENGINE_RDRAND | OPENSSL_INIT_ENGINE_DYNAMIC \ + | OPENSSL_INIT_ENGINE_CRYPTODEV | OPENSSL_INIT_ENGINE_CAPI | \ + OPENSSL_INIT_ENGINE_PADLOCK) + + +/* Library initialisation functions */ +void OPENSSL_cleanup(void); +int OPENSSL_init_crypto(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings); +int OPENSSL_atexit(void (*handler)(void)); +void OPENSSL_thread_stop(void); + +/* Low-level control of initialization */ +OPENSSL_INIT_SETTINGS *OPENSSL_INIT_new(void); +# ifndef OPENSSL_NO_STDIO +int OPENSSL_INIT_set_config_filename(OPENSSL_INIT_SETTINGS *settings, + const char *config_filename); +void OPENSSL_INIT_set_config_file_flags(OPENSSL_INIT_SETTINGS *settings, + unsigned long flags); +int OPENSSL_INIT_set_config_appname(OPENSSL_INIT_SETTINGS *settings, + const char *config_appname); +# endif +void OPENSSL_INIT_free(OPENSSL_INIT_SETTINGS *settings); + +# if defined(OPENSSL_THREADS) && !defined(CRYPTO_TDEBUG) +# if defined(_WIN32) +# if defined(BASETYPES) || defined(_WINDEF_H) +/* application has to include in order to use this */ +typedef DWORD CRYPTO_THREAD_LOCAL; +typedef DWORD CRYPTO_THREAD_ID; + +typedef LONG CRYPTO_ONCE; +# define CRYPTO_ONCE_STATIC_INIT 0 +# endif +# else +# include +typedef pthread_once_t CRYPTO_ONCE; +typedef pthread_key_t CRYPTO_THREAD_LOCAL; +typedef pthread_t CRYPTO_THREAD_ID; + +# define CRYPTO_ONCE_STATIC_INIT PTHREAD_ONCE_INIT +# endif +# endif + +# if !defined(CRYPTO_ONCE_STATIC_INIT) +typedef unsigned int CRYPTO_ONCE; +typedef unsigned int CRYPTO_THREAD_LOCAL; +typedef unsigned int CRYPTO_THREAD_ID; +# define CRYPTO_ONCE_STATIC_INIT 0 +# endif + +int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void)); + +int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void (*cleanup)(void *)); +void *CRYPTO_THREAD_get_local(CRYPTO_THREAD_LOCAL *key); +int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val); +int CRYPTO_THREAD_cleanup_local(CRYPTO_THREAD_LOCAL *key); + +CRYPTO_THREAD_ID CRYPTO_THREAD_get_current_id(void); +int CRYPTO_THREAD_compare_id(CRYPTO_THREAD_ID a, CRYPTO_THREAD_ID b); + + +# ifdef __cplusplus +} +# endif +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/cryptoerr.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/cryptoerr.h new file mode 100644 index 0000000..3db5a4e --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/cryptoerr.h @@ -0,0 +1,57 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_CRYPTOERR_H +# define HEADER_CRYPTOERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_CRYPTO_strings(void); + +/* + * CRYPTO function codes. + */ +# define CRYPTO_F_CMAC_CTX_NEW 120 +# define CRYPTO_F_CRYPTO_DUP_EX_DATA 110 +# define CRYPTO_F_CRYPTO_FREE_EX_DATA 111 +# define CRYPTO_F_CRYPTO_GET_EX_NEW_INDEX 100 +# define CRYPTO_F_CRYPTO_MEMDUP 115 +# define CRYPTO_F_CRYPTO_NEW_EX_DATA 112 +# define CRYPTO_F_CRYPTO_OCB128_COPY_CTX 121 +# define CRYPTO_F_CRYPTO_OCB128_INIT 122 +# define CRYPTO_F_CRYPTO_SET_EX_DATA 102 +# define CRYPTO_F_FIPS_MODE_SET 109 +# define CRYPTO_F_GET_AND_LOCK 113 +# define CRYPTO_F_OPENSSL_ATEXIT 114 +# define CRYPTO_F_OPENSSL_BUF2HEXSTR 117 +# define CRYPTO_F_OPENSSL_FOPEN 119 +# define CRYPTO_F_OPENSSL_HEXSTR2BUF 118 +# define CRYPTO_F_OPENSSL_INIT_CRYPTO 116 +# define CRYPTO_F_OPENSSL_LH_NEW 126 +# define CRYPTO_F_OPENSSL_SK_DEEP_COPY 127 +# define CRYPTO_F_OPENSSL_SK_DUP 128 +# define CRYPTO_F_PKEY_HMAC_INIT 123 +# define CRYPTO_F_PKEY_POLY1305_INIT 124 +# define CRYPTO_F_PKEY_SIPHASH_INIT 125 +# define CRYPTO_F_SK_RESERVE 129 + +/* + * CRYPTO reason codes. + */ +# define CRYPTO_R_FIPS_MODE_NOT_SUPPORTED 101 +# define CRYPTO_R_ILLEGAL_HEX_DIGIT 102 +# define CRYPTO_R_ODD_NUMBER_OF_DIGITS 103 + +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/ct.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/ct.h new file mode 100644 index 0000000..ebdba34 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/ct.h @@ -0,0 +1,474 @@ +/* + * Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_CT_H +# define HEADER_CT_H + +# include + +# ifndef OPENSSL_NO_CT +# include +# include +# include +# include +# ifdef __cplusplus +extern "C" { +# endif + + +/* Minimum RSA key size, from RFC6962 */ +# define SCT_MIN_RSA_BITS 2048 + +/* All hashes are SHA256 in v1 of Certificate Transparency */ +# define CT_V1_HASHLEN SHA256_DIGEST_LENGTH + +typedef enum { + CT_LOG_ENTRY_TYPE_NOT_SET = -1, + CT_LOG_ENTRY_TYPE_X509 = 0, + CT_LOG_ENTRY_TYPE_PRECERT = 1 +} ct_log_entry_type_t; + +typedef enum { + SCT_VERSION_NOT_SET = -1, + SCT_VERSION_V1 = 0 +} sct_version_t; + +typedef enum { + SCT_SOURCE_UNKNOWN, + SCT_SOURCE_TLS_EXTENSION, + SCT_SOURCE_X509V3_EXTENSION, + SCT_SOURCE_OCSP_STAPLED_RESPONSE +} sct_source_t; + +typedef enum { + SCT_VALIDATION_STATUS_NOT_SET, + SCT_VALIDATION_STATUS_UNKNOWN_LOG, + SCT_VALIDATION_STATUS_VALID, + SCT_VALIDATION_STATUS_INVALID, + SCT_VALIDATION_STATUS_UNVERIFIED, + SCT_VALIDATION_STATUS_UNKNOWN_VERSION +} sct_validation_status_t; + +DEFINE_STACK_OF(SCT) +DEFINE_STACK_OF(CTLOG) + +/****************************************** + * CT policy evaluation context functions * + ******************************************/ + +/* + * Creates a new, empty policy evaluation context. + * The caller is responsible for calling CT_POLICY_EVAL_CTX_free when finished + * with the CT_POLICY_EVAL_CTX. + */ +CT_POLICY_EVAL_CTX *CT_POLICY_EVAL_CTX_new(void); + +/* Deletes a policy evaluation context and anything it owns. */ +void CT_POLICY_EVAL_CTX_free(CT_POLICY_EVAL_CTX *ctx); + +/* Gets the peer certificate that the SCTs are for */ +X509* CT_POLICY_EVAL_CTX_get0_cert(const CT_POLICY_EVAL_CTX *ctx); + +/* + * Sets the certificate associated with the received SCTs. + * Increments the reference count of cert. + * Returns 1 on success, 0 otherwise. + */ +int CT_POLICY_EVAL_CTX_set1_cert(CT_POLICY_EVAL_CTX *ctx, X509 *cert); + +/* Gets the issuer of the aforementioned certificate */ +X509* CT_POLICY_EVAL_CTX_get0_issuer(const CT_POLICY_EVAL_CTX *ctx); + +/* + * Sets the issuer of the certificate associated with the received SCTs. + * Increments the reference count of issuer. + * Returns 1 on success, 0 otherwise. + */ +int CT_POLICY_EVAL_CTX_set1_issuer(CT_POLICY_EVAL_CTX *ctx, X509 *issuer); + +/* Gets the CT logs that are trusted sources of SCTs */ +const CTLOG_STORE *CT_POLICY_EVAL_CTX_get0_log_store(const CT_POLICY_EVAL_CTX *ctx); + +/* Sets the log store that is in use. It must outlive the CT_POLICY_EVAL_CTX. */ +void CT_POLICY_EVAL_CTX_set_shared_CTLOG_STORE(CT_POLICY_EVAL_CTX *ctx, + CTLOG_STORE *log_store); + +/* + * Gets the time, in milliseconds since the Unix epoch, that will be used as the + * current time when checking whether an SCT was issued in the future. + * Such SCTs will fail validation, as required by RFC6962. + */ +uint64_t CT_POLICY_EVAL_CTX_get_time(const CT_POLICY_EVAL_CTX *ctx); + +/* + * Sets the time to evaluate SCTs against, in milliseconds since the Unix epoch. + * If an SCT's timestamp is after this time, it will be interpreted as having + * been issued in the future. RFC6962 states that "TLS clients MUST reject SCTs + * whose timestamp is in the future", so an SCT will not validate in this case. + */ +void CT_POLICY_EVAL_CTX_set_time(CT_POLICY_EVAL_CTX *ctx, uint64_t time_in_ms); + +/***************** + * SCT functions * + *****************/ + +/* + * Creates a new, blank SCT. + * The caller is responsible for calling SCT_free when finished with the SCT. + */ +SCT *SCT_new(void); + +/* + * Creates a new SCT from some base64-encoded strings. + * The caller is responsible for calling SCT_free when finished with the SCT. + */ +SCT *SCT_new_from_base64(unsigned char version, + const char *logid_base64, + ct_log_entry_type_t entry_type, + uint64_t timestamp, + const char *extensions_base64, + const char *signature_base64); + +/* + * Frees the SCT and the underlying data structures. + */ +void SCT_free(SCT *sct); + +/* + * Free a stack of SCTs, and the underlying SCTs themselves. + * Intended to be compatible with X509V3_EXT_FREE. + */ +void SCT_LIST_free(STACK_OF(SCT) *a); + +/* + * Returns the version of the SCT. + */ +sct_version_t SCT_get_version(const SCT *sct); + +/* + * Set the version of an SCT. + * Returns 1 on success, 0 if the version is unrecognized. + */ +__owur int SCT_set_version(SCT *sct, sct_version_t version); + +/* + * Returns the log entry type of the SCT. + */ +ct_log_entry_type_t SCT_get_log_entry_type(const SCT *sct); + +/* + * Set the log entry type of an SCT. + * Returns 1 on success, 0 otherwise. + */ +__owur int SCT_set_log_entry_type(SCT *sct, ct_log_entry_type_t entry_type); + +/* + * Gets the ID of the log that an SCT came from. + * Ownership of the log ID remains with the SCT. + * Returns the length of the log ID. + */ +size_t SCT_get0_log_id(const SCT *sct, unsigned char **log_id); + +/* + * Set the log ID of an SCT to point directly to the *log_id specified. + * The SCT takes ownership of the specified pointer. + * Returns 1 on success, 0 otherwise. + */ +__owur int SCT_set0_log_id(SCT *sct, unsigned char *log_id, size_t log_id_len); + +/* + * Set the log ID of an SCT. + * This makes a copy of the log_id. + * Returns 1 on success, 0 otherwise. + */ +__owur int SCT_set1_log_id(SCT *sct, const unsigned char *log_id, + size_t log_id_len); + +/* + * Returns the timestamp for the SCT (epoch time in milliseconds). + */ +uint64_t SCT_get_timestamp(const SCT *sct); + +/* + * Set the timestamp of an SCT (epoch time in milliseconds). + */ +void SCT_set_timestamp(SCT *sct, uint64_t timestamp); + +/* + * Return the NID for the signature used by the SCT. + * For CT v1, this will be either NID_sha256WithRSAEncryption or + * NID_ecdsa_with_SHA256 (or NID_undef if incorrect/unset). + */ +int SCT_get_signature_nid(const SCT *sct); + +/* + * Set the signature type of an SCT + * For CT v1, this should be either NID_sha256WithRSAEncryption or + * NID_ecdsa_with_SHA256. + * Returns 1 on success, 0 otherwise. + */ +__owur int SCT_set_signature_nid(SCT *sct, int nid); + +/* + * Set *ext to point to the extension data for the SCT. ext must not be NULL. + * The SCT retains ownership of this pointer. + * Returns length of the data pointed to. + */ +size_t SCT_get0_extensions(const SCT *sct, unsigned char **ext); + +/* + * Set the extensions of an SCT to point directly to the *ext specified. + * The SCT takes ownership of the specified pointer. + */ +void SCT_set0_extensions(SCT *sct, unsigned char *ext, size_t ext_len); + +/* + * Set the extensions of an SCT. + * This takes a copy of the ext. + * Returns 1 on success, 0 otherwise. + */ +__owur int SCT_set1_extensions(SCT *sct, const unsigned char *ext, + size_t ext_len); + +/* + * Set *sig to point to the signature for the SCT. sig must not be NULL. + * The SCT retains ownership of this pointer. + * Returns length of the data pointed to. + */ +size_t SCT_get0_signature(const SCT *sct, unsigned char **sig); + +/* + * Set the signature of an SCT to point directly to the *sig specified. + * The SCT takes ownership of the specified pointer. + */ +void SCT_set0_signature(SCT *sct, unsigned char *sig, size_t sig_len); + +/* + * Set the signature of an SCT to be a copy of the *sig specified. + * Returns 1 on success, 0 otherwise. + */ +__owur int SCT_set1_signature(SCT *sct, const unsigned char *sig, + size_t sig_len); + +/* + * The origin of this SCT, e.g. TLS extension, OCSP response, etc. + */ +sct_source_t SCT_get_source(const SCT *sct); + +/* + * Set the origin of this SCT, e.g. TLS extension, OCSP response, etc. + * Returns 1 on success, 0 otherwise. + */ +__owur int SCT_set_source(SCT *sct, sct_source_t source); + +/* + * Returns a text string describing the validation status of |sct|. + */ +const char *SCT_validation_status_string(const SCT *sct); + +/* + * Pretty-prints an |sct| to |out|. + * It will be indented by the number of spaces specified by |indent|. + * If |logs| is not NULL, it will be used to lookup the CT log that the SCT came + * from, so that the log name can be printed. + */ +void SCT_print(const SCT *sct, BIO *out, int indent, const CTLOG_STORE *logs); + +/* + * Pretty-prints an |sct_list| to |out|. + * It will be indented by the number of spaces specified by |indent|. + * SCTs will be delimited by |separator|. + * If |logs| is not NULL, it will be used to lookup the CT log that each SCT + * came from, so that the log names can be printed. + */ +void SCT_LIST_print(const STACK_OF(SCT) *sct_list, BIO *out, int indent, + const char *separator, const CTLOG_STORE *logs); + +/* + * Gets the last result of validating this SCT. + * If it has not been validated yet, returns SCT_VALIDATION_STATUS_NOT_SET. + */ +sct_validation_status_t SCT_get_validation_status(const SCT *sct); + +/* + * Validates the given SCT with the provided context. + * Sets the "validation_status" field of the SCT. + * Returns 1 if the SCT is valid and the signature verifies. + * Returns 0 if the SCT is invalid or could not be verified. + * Returns -1 if an error occurs. + */ +__owur int SCT_validate(SCT *sct, const CT_POLICY_EVAL_CTX *ctx); + +/* + * Validates the given list of SCTs with the provided context. + * Sets the "validation_status" field of each SCT. + * Returns 1 if there are no invalid SCTs and all signatures verify. + * Returns 0 if at least one SCT is invalid or could not be verified. + * Returns a negative integer if an error occurs. + */ +__owur int SCT_LIST_validate(const STACK_OF(SCT) *scts, + CT_POLICY_EVAL_CTX *ctx); + + +/********************************* + * SCT parsing and serialisation * + *********************************/ + +/* + * Serialize (to TLS format) a stack of SCTs and return the length. + * "a" must not be NULL. + * If "pp" is NULL, just return the length of what would have been serialized. + * If "pp" is not NULL and "*pp" is null, function will allocate a new pointer + * for data that caller is responsible for freeing (only if function returns + * successfully). + * If "pp" is NULL and "*pp" is not NULL, caller is responsible for ensuring + * that "*pp" is large enough to accept all of the serialized data. + * Returns < 0 on error, >= 0 indicating bytes written (or would have been) + * on success. + */ +__owur int i2o_SCT_LIST(const STACK_OF(SCT) *a, unsigned char **pp); + +/* + * Convert TLS format SCT list to a stack of SCTs. + * If "a" or "*a" is NULL, a new stack will be created that the caller is + * responsible for freeing (by calling SCT_LIST_free). + * "**pp" and "*pp" must not be NULL. + * Upon success, "*pp" will point to after the last bytes read, and a stack + * will be returned. + * Upon failure, a NULL pointer will be returned, and the position of "*pp" is + * not defined. + */ +STACK_OF(SCT) *o2i_SCT_LIST(STACK_OF(SCT) **a, const unsigned char **pp, + size_t len); + +/* + * Serialize (to DER format) a stack of SCTs and return the length. + * "a" must not be NULL. + * If "pp" is NULL, just returns the length of what would have been serialized. + * If "pp" is not NULL and "*pp" is null, function will allocate a new pointer + * for data that caller is responsible for freeing (only if function returns + * successfully). + * If "pp" is NULL and "*pp" is not NULL, caller is responsible for ensuring + * that "*pp" is large enough to accept all of the serialized data. + * Returns < 0 on error, >= 0 indicating bytes written (or would have been) + * on success. + */ +__owur int i2d_SCT_LIST(const STACK_OF(SCT) *a, unsigned char **pp); + +/* + * Parses an SCT list in DER format and returns it. + * If "a" or "*a" is NULL, a new stack will be created that the caller is + * responsible for freeing (by calling SCT_LIST_free). + * "**pp" and "*pp" must not be NULL. + * Upon success, "*pp" will point to after the last bytes read, and a stack + * will be returned. + * Upon failure, a NULL pointer will be returned, and the position of "*pp" is + * not defined. + */ +STACK_OF(SCT) *d2i_SCT_LIST(STACK_OF(SCT) **a, const unsigned char **pp, + long len); + +/* + * Serialize (to TLS format) an |sct| and write it to |out|. + * If |out| is null, no SCT will be output but the length will still be returned. + * If |out| points to a null pointer, a string will be allocated to hold the + * TLS-format SCT. It is the responsibility of the caller to free it. + * If |out| points to an allocated string, the TLS-format SCT will be written + * to it. + * The length of the SCT in TLS format will be returned. + */ +__owur int i2o_SCT(const SCT *sct, unsigned char **out); + +/* + * Parses an SCT in TLS format and returns it. + * If |psct| is not null, it will end up pointing to the parsed SCT. If it + * already points to a non-null pointer, the pointer will be free'd. + * |in| should be a pointer to a string containing the TLS-format SCT. + * |in| will be advanced to the end of the SCT if parsing succeeds. + * |len| should be the length of the SCT in |in|. + * Returns NULL if an error occurs. + * If the SCT is an unsupported version, only the SCT's 'sct' and 'sct_len' + * fields will be populated (with |in| and |len| respectively). + */ +SCT *o2i_SCT(SCT **psct, const unsigned char **in, size_t len); + +/******************** + * CT log functions * + ********************/ + +/* + * Creates a new CT log instance with the given |public_key| and |name|. + * Takes ownership of |public_key| but copies |name|. + * Returns NULL if malloc fails or if |public_key| cannot be converted to DER. + * Should be deleted by the caller using CTLOG_free when no longer needed. + */ +CTLOG *CTLOG_new(EVP_PKEY *public_key, const char *name); + +/* + * Creates a new CTLOG instance with the base64-encoded SubjectPublicKeyInfo DER + * in |pkey_base64|. The |name| is a string to help users identify this log. + * Returns 1 on success, 0 on failure. + * Should be deleted by the caller using CTLOG_free when no longer needed. + */ +int CTLOG_new_from_base64(CTLOG ** ct_log, + const char *pkey_base64, const char *name); + +/* + * Deletes a CT log instance and its fields. + */ +void CTLOG_free(CTLOG *log); + +/* Gets the name of the CT log */ +const char *CTLOG_get0_name(const CTLOG *log); +/* Gets the ID of the CT log */ +void CTLOG_get0_log_id(const CTLOG *log, const uint8_t **log_id, + size_t *log_id_len); +/* Gets the public key of the CT log */ +EVP_PKEY *CTLOG_get0_public_key(const CTLOG *log); + +/************************** + * CT log store functions * + **************************/ + +/* + * Creates a new CT log store. + * Should be deleted by the caller using CTLOG_STORE_free when no longer needed. + */ +CTLOG_STORE *CTLOG_STORE_new(void); + +/* + * Deletes a CT log store and all of the CT log instances held within. + */ +void CTLOG_STORE_free(CTLOG_STORE *store); + +/* + * Finds a CT log in the store based on its log ID. + * Returns the CT log, or NULL if no match is found. + */ +const CTLOG *CTLOG_STORE_get0_log_by_id(const CTLOG_STORE *store, + const uint8_t *log_id, + size_t log_id_len); + +/* + * Loads a CT log list into a |store| from a |file|. + * Returns 1 if loading is successful, or 0 otherwise. + */ +__owur int CTLOG_STORE_load_file(CTLOG_STORE *store, const char *file); + +/* + * Loads the default CT log list into a |store|. + * Returns 1 if loading is successful, or 0 otherwise. + */ +__owur int CTLOG_STORE_load_default_file(CTLOG_STORE *store); + +# ifdef __cplusplus +} +# endif +# endif +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/cterr.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/cterr.h new file mode 100644 index 0000000..feb7bc5 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/cterr.h @@ -0,0 +1,80 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_CTERR_H +# define HEADER_CTERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# include + +# ifndef OPENSSL_NO_CT + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_CT_strings(void); + +/* + * CT function codes. + */ +# define CT_F_CTLOG_NEW 117 +# define CT_F_CTLOG_NEW_FROM_BASE64 118 +# define CT_F_CTLOG_NEW_FROM_CONF 119 +# define CT_F_CTLOG_STORE_LOAD_CTX_NEW 122 +# define CT_F_CTLOG_STORE_LOAD_FILE 123 +# define CT_F_CTLOG_STORE_LOAD_LOG 130 +# define CT_F_CTLOG_STORE_NEW 131 +# define CT_F_CT_BASE64_DECODE 124 +# define CT_F_CT_POLICY_EVAL_CTX_NEW 133 +# define CT_F_CT_V1_LOG_ID_FROM_PKEY 125 +# define CT_F_I2O_SCT 107 +# define CT_F_I2O_SCT_LIST 108 +# define CT_F_I2O_SCT_SIGNATURE 109 +# define CT_F_O2I_SCT 110 +# define CT_F_O2I_SCT_LIST 111 +# define CT_F_O2I_SCT_SIGNATURE 112 +# define CT_F_SCT_CTX_NEW 126 +# define CT_F_SCT_CTX_VERIFY 128 +# define CT_F_SCT_NEW 100 +# define CT_F_SCT_NEW_FROM_BASE64 127 +# define CT_F_SCT_SET0_LOG_ID 101 +# define CT_F_SCT_SET1_EXTENSIONS 114 +# define CT_F_SCT_SET1_LOG_ID 115 +# define CT_F_SCT_SET1_SIGNATURE 116 +# define CT_F_SCT_SET_LOG_ENTRY_TYPE 102 +# define CT_F_SCT_SET_SIGNATURE_NID 103 +# define CT_F_SCT_SET_VERSION 104 + +/* + * CT reason codes. + */ +# define CT_R_BASE64_DECODE_ERROR 108 +# define CT_R_INVALID_LOG_ID_LENGTH 100 +# define CT_R_LOG_CONF_INVALID 109 +# define CT_R_LOG_CONF_INVALID_KEY 110 +# define CT_R_LOG_CONF_MISSING_DESCRIPTION 111 +# define CT_R_LOG_CONF_MISSING_KEY 112 +# define CT_R_LOG_KEY_INVALID 113 +# define CT_R_SCT_FUTURE_TIMESTAMP 116 +# define CT_R_SCT_INVALID 104 +# define CT_R_SCT_INVALID_SIGNATURE 107 +# define CT_R_SCT_LIST_INVALID 105 +# define CT_R_SCT_LOG_ID_MISMATCH 114 +# define CT_R_SCT_NOT_SET 106 +# define CT_R_SCT_UNSUPPORTED_VERSION 115 +# define CT_R_UNRECOGNIZED_SIGNATURE_NID 101 +# define CT_R_UNSUPPORTED_ENTRY_TYPE 102 +# define CT_R_UNSUPPORTED_VERSION 103 + +# endif +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/des.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/des.h new file mode 100644 index 0000000..be4abbd --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/des.h @@ -0,0 +1,174 @@ +/* + * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_DES_H +# define HEADER_DES_H + +# include + +# ifndef OPENSSL_NO_DES +# ifdef __cplusplus +extern "C" { +# endif +# include + +typedef unsigned int DES_LONG; + +# ifdef OPENSSL_BUILD_SHLIBCRYPTO +# undef OPENSSL_EXTERN +# define OPENSSL_EXTERN OPENSSL_EXPORT +# endif + +typedef unsigned char DES_cblock[8]; +typedef /* const */ unsigned char const_DES_cblock[8]; +/* + * With "const", gcc 2.8.1 on Solaris thinks that DES_cblock * and + * const_DES_cblock * are incompatible pointer types. + */ + +typedef struct DES_ks { + union { + DES_cblock cblock; + /* + * make sure things are correct size on machines with 8 byte longs + */ + DES_LONG deslong[2]; + } ks[16]; +} DES_key_schedule; + +# define DES_KEY_SZ (sizeof(DES_cblock)) +# define DES_SCHEDULE_SZ (sizeof(DES_key_schedule)) + +# define DES_ENCRYPT 1 +# define DES_DECRYPT 0 + +# define DES_CBC_MODE 0 +# define DES_PCBC_MODE 1 + +# define DES_ecb2_encrypt(i,o,k1,k2,e) \ + DES_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e)) + +# define DES_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \ + DES_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e)) + +# define DES_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \ + DES_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e)) + +# define DES_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \ + DES_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n)) + +OPENSSL_DECLARE_GLOBAL(int, DES_check_key); /* defaults to false */ +# define DES_check_key OPENSSL_GLOBAL_REF(DES_check_key) + +const char *DES_options(void); +void DES_ecb3_encrypt(const_DES_cblock *input, DES_cblock *output, + DES_key_schedule *ks1, DES_key_schedule *ks2, + DES_key_schedule *ks3, int enc); +DES_LONG DES_cbc_cksum(const unsigned char *input, DES_cblock *output, + long length, DES_key_schedule *schedule, + const_DES_cblock *ivec); +/* DES_cbc_encrypt does not update the IV! Use DES_ncbc_encrypt instead. */ +void DES_cbc_encrypt(const unsigned char *input, unsigned char *output, + long length, DES_key_schedule *schedule, + DES_cblock *ivec, int enc); +void DES_ncbc_encrypt(const unsigned char *input, unsigned char *output, + long length, DES_key_schedule *schedule, + DES_cblock *ivec, int enc); +void DES_xcbc_encrypt(const unsigned char *input, unsigned char *output, + long length, DES_key_schedule *schedule, + DES_cblock *ivec, const_DES_cblock *inw, + const_DES_cblock *outw, int enc); +void DES_cfb_encrypt(const unsigned char *in, unsigned char *out, int numbits, + long length, DES_key_schedule *schedule, + DES_cblock *ivec, int enc); +void DES_ecb_encrypt(const_DES_cblock *input, DES_cblock *output, + DES_key_schedule *ks, int enc); + +/* + * This is the DES encryption function that gets called by just about every + * other DES routine in the library. You should not use this function except + * to implement 'modes' of DES. I say this because the functions that call + * this routine do the conversion from 'char *' to long, and this needs to be + * done to make sure 'non-aligned' memory access do not occur. The + * characters are loaded 'little endian'. Data is a pointer to 2 unsigned + * long's and ks is the DES_key_schedule to use. enc, is non zero specifies + * encryption, zero if decryption. + */ +void DES_encrypt1(DES_LONG *data, DES_key_schedule *ks, int enc); + +/* + * This functions is the same as DES_encrypt1() except that the DES initial + * permutation (IP) and final permutation (FP) have been left out. As for + * DES_encrypt1(), you should not use this function. It is used by the + * routines in the library that implement triple DES. IP() DES_encrypt2() + * DES_encrypt2() DES_encrypt2() FP() is the same as DES_encrypt1() + * DES_encrypt1() DES_encrypt1() except faster :-). + */ +void DES_encrypt2(DES_LONG *data, DES_key_schedule *ks, int enc); + +void DES_encrypt3(DES_LONG *data, DES_key_schedule *ks1, + DES_key_schedule *ks2, DES_key_schedule *ks3); +void DES_decrypt3(DES_LONG *data, DES_key_schedule *ks1, + DES_key_schedule *ks2, DES_key_schedule *ks3); +void DES_ede3_cbc_encrypt(const unsigned char *input, unsigned char *output, + long length, + DES_key_schedule *ks1, DES_key_schedule *ks2, + DES_key_schedule *ks3, DES_cblock *ivec, int enc); +void DES_ede3_cfb64_encrypt(const unsigned char *in, unsigned char *out, + long length, DES_key_schedule *ks1, + DES_key_schedule *ks2, DES_key_schedule *ks3, + DES_cblock *ivec, int *num, int enc); +void DES_ede3_cfb_encrypt(const unsigned char *in, unsigned char *out, + int numbits, long length, DES_key_schedule *ks1, + DES_key_schedule *ks2, DES_key_schedule *ks3, + DES_cblock *ivec, int enc); +void DES_ede3_ofb64_encrypt(const unsigned char *in, unsigned char *out, + long length, DES_key_schedule *ks1, + DES_key_schedule *ks2, DES_key_schedule *ks3, + DES_cblock *ivec, int *num); +char *DES_fcrypt(const char *buf, const char *salt, char *ret); +char *DES_crypt(const char *buf, const char *salt); +void DES_ofb_encrypt(const unsigned char *in, unsigned char *out, int numbits, + long length, DES_key_schedule *schedule, + DES_cblock *ivec); +void DES_pcbc_encrypt(const unsigned char *input, unsigned char *output, + long length, DES_key_schedule *schedule, + DES_cblock *ivec, int enc); +DES_LONG DES_quad_cksum(const unsigned char *input, DES_cblock output[], + long length, int out_count, DES_cblock *seed); +int DES_random_key(DES_cblock *ret); +void DES_set_odd_parity(DES_cblock *key); +int DES_check_key_parity(const_DES_cblock *key); +int DES_is_weak_key(const_DES_cblock *key); +/* + * DES_set_key (= set_key = DES_key_sched = key_sched) calls + * DES_set_key_checked if global variable DES_check_key is set, + * DES_set_key_unchecked otherwise. + */ +int DES_set_key(const_DES_cblock *key, DES_key_schedule *schedule); +int DES_key_sched(const_DES_cblock *key, DES_key_schedule *schedule); +int DES_set_key_checked(const_DES_cblock *key, DES_key_schedule *schedule); +void DES_set_key_unchecked(const_DES_cblock *key, DES_key_schedule *schedule); +void DES_string_to_key(const char *str, DES_cblock *key); +void DES_string_to_2keys(const char *str, DES_cblock *key1, DES_cblock *key2); +void DES_cfb64_encrypt(const unsigned char *in, unsigned char *out, + long length, DES_key_schedule *schedule, + DES_cblock *ivec, int *num, int enc); +void DES_ofb64_encrypt(const unsigned char *in, unsigned char *out, + long length, DES_key_schedule *schedule, + DES_cblock *ivec, int *num); + +# define DES_fixup_key_parity DES_set_odd_parity + +# ifdef __cplusplus +} +# endif +# endif + +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/dh.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/dh.h new file mode 100644 index 0000000..3527540 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/dh.h @@ -0,0 +1,340 @@ +/* + * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_DH_H +# define HEADER_DH_H + +# include + +# ifndef OPENSSL_NO_DH +# include +# include +# include +# include +# if OPENSSL_API_COMPAT < 0x10100000L +# include +# endif +# include + +# ifdef __cplusplus +extern "C" { +# endif + +# ifndef OPENSSL_DH_MAX_MODULUS_BITS +# define OPENSSL_DH_MAX_MODULUS_BITS 10000 +# endif + +# define OPENSSL_DH_FIPS_MIN_MODULUS_BITS 1024 + +# define DH_FLAG_CACHE_MONT_P 0x01 + +# if OPENSSL_API_COMPAT < 0x10100000L +/* + * Does nothing. Previously this switched off constant time behaviour. + */ +# define DH_FLAG_NO_EXP_CONSTTIME 0x00 +# endif + +/* + * If this flag is set the DH method is FIPS compliant and can be used in + * FIPS mode. This is set in the validated module method. If an application + * sets this flag in its own methods it is its responsibility to ensure the + * result is compliant. + */ + +# define DH_FLAG_FIPS_METHOD 0x0400 + +/* + * If this flag is set the operations normally disabled in FIPS mode are + * permitted it is then the applications responsibility to ensure that the + * usage is compliant. + */ + +# define DH_FLAG_NON_FIPS_ALLOW 0x0400 + +/* Already defined in ossl_typ.h */ +/* typedef struct dh_st DH; */ +/* typedef struct dh_method DH_METHOD; */ + +DECLARE_ASN1_ITEM(DHparams) + +# define DH_GENERATOR_2 2 +/* #define DH_GENERATOR_3 3 */ +# define DH_GENERATOR_5 5 + +/* DH_check error codes */ +# define DH_CHECK_P_NOT_PRIME 0x01 +# define DH_CHECK_P_NOT_SAFE_PRIME 0x02 +# define DH_UNABLE_TO_CHECK_GENERATOR 0x04 +# define DH_NOT_SUITABLE_GENERATOR 0x08 +# define DH_CHECK_Q_NOT_PRIME 0x10 +# define DH_CHECK_INVALID_Q_VALUE 0x20 +# define DH_CHECK_INVALID_J_VALUE 0x40 + +/* DH_check_pub_key error codes */ +# define DH_CHECK_PUBKEY_TOO_SMALL 0x01 +# define DH_CHECK_PUBKEY_TOO_LARGE 0x02 +# define DH_CHECK_PUBKEY_INVALID 0x04 + +/* + * primes p where (p-1)/2 is prime too are called "safe"; we define this for + * backward compatibility: + */ +# define DH_CHECK_P_NOT_STRONG_PRIME DH_CHECK_P_NOT_SAFE_PRIME + +# define d2i_DHparams_fp(fp,x) \ + (DH *)ASN1_d2i_fp((char *(*)())DH_new, \ + (char *(*)())d2i_DHparams, \ + (fp), \ + (unsigned char **)(x)) +# define i2d_DHparams_fp(fp,x) \ + ASN1_i2d_fp(i2d_DHparams,(fp), (unsigned char *)(x)) +# define d2i_DHparams_bio(bp,x) \ + ASN1_d2i_bio_of(DH, DH_new, d2i_DHparams, bp, x) +# define i2d_DHparams_bio(bp,x) \ + ASN1_i2d_bio_of_const(DH,i2d_DHparams,bp,x) + +# define d2i_DHxparams_fp(fp,x) \ + (DH *)ASN1_d2i_fp((char *(*)())DH_new, \ + (char *(*)())d2i_DHxparams, \ + (fp), \ + (unsigned char **)(x)) +# define i2d_DHxparams_fp(fp,x) \ + ASN1_i2d_fp(i2d_DHxparams,(fp), (unsigned char *)(x)) +# define d2i_DHxparams_bio(bp,x) \ + ASN1_d2i_bio_of(DH, DH_new, d2i_DHxparams, bp, x) +# define i2d_DHxparams_bio(bp,x) \ + ASN1_i2d_bio_of_const(DH, i2d_DHxparams, bp, x) + +DH *DHparams_dup(DH *); + +const DH_METHOD *DH_OpenSSL(void); + +void DH_set_default_method(const DH_METHOD *meth); +const DH_METHOD *DH_get_default_method(void); +int DH_set_method(DH *dh, const DH_METHOD *meth); +DH *DH_new_method(ENGINE *engine); + +DH *DH_new(void); +void DH_free(DH *dh); +int DH_up_ref(DH *dh); +int DH_bits(const DH *dh); +int DH_size(const DH *dh); +int DH_security_bits(const DH *dh); +#define DH_get_ex_new_index(l, p, newf, dupf, freef) \ + CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_DH, l, p, newf, dupf, freef) +int DH_set_ex_data(DH *d, int idx, void *arg); +void *DH_get_ex_data(DH *d, int idx); + +/* Deprecated version */ +DEPRECATEDIN_0_9_8(DH *DH_generate_parameters(int prime_len, int generator, + void (*callback) (int, int, + void *), + void *cb_arg)) + +/* New version */ +int DH_generate_parameters_ex(DH *dh, int prime_len, int generator, + BN_GENCB *cb); + +int DH_check_params_ex(const DH *dh); +int DH_check_ex(const DH *dh); +int DH_check_pub_key_ex(const DH *dh, const BIGNUM *pub_key); +int DH_check_params(const DH *dh, int *ret); +int DH_check(const DH *dh, int *codes); +int DH_check_pub_key(const DH *dh, const BIGNUM *pub_key, int *codes); +int DH_generate_key(DH *dh); +int DH_compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh); +int DH_compute_key_padded(unsigned char *key, const BIGNUM *pub_key, DH *dh); +DH *d2i_DHparams(DH **a, const unsigned char **pp, long length); +int i2d_DHparams(const DH *a, unsigned char **pp); +DH *d2i_DHxparams(DH **a, const unsigned char **pp, long length); +int i2d_DHxparams(const DH *a, unsigned char **pp); +# ifndef OPENSSL_NO_STDIO +int DHparams_print_fp(FILE *fp, const DH *x); +# endif +int DHparams_print(BIO *bp, const DH *x); + +/* RFC 5114 parameters */ +DH *DH_get_1024_160(void); +DH *DH_get_2048_224(void); +DH *DH_get_2048_256(void); + +/* Named parameters, currently RFC7919 */ +DH *DH_new_by_nid(int nid); +int DH_get_nid(const DH *dh); + +# ifndef OPENSSL_NO_CMS +/* RFC2631 KDF */ +int DH_KDF_X9_42(unsigned char *out, size_t outlen, + const unsigned char *Z, size_t Zlen, + ASN1_OBJECT *key_oid, + const unsigned char *ukm, size_t ukmlen, const EVP_MD *md); +# endif + +void DH_get0_pqg(const DH *dh, + const BIGNUM **p, const BIGNUM **q, const BIGNUM **g); +int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g); +void DH_get0_key(const DH *dh, + const BIGNUM **pub_key, const BIGNUM **priv_key); +int DH_set0_key(DH *dh, BIGNUM *pub_key, BIGNUM *priv_key); +const BIGNUM *DH_get0_p(const DH *dh); +const BIGNUM *DH_get0_q(const DH *dh); +const BIGNUM *DH_get0_g(const DH *dh); +const BIGNUM *DH_get0_priv_key(const DH *dh); +const BIGNUM *DH_get0_pub_key(const DH *dh); +void DH_clear_flags(DH *dh, int flags); +int DH_test_flags(const DH *dh, int flags); +void DH_set_flags(DH *dh, int flags); +ENGINE *DH_get0_engine(DH *d); +long DH_get_length(const DH *dh); +int DH_set_length(DH *dh, long length); + +DH_METHOD *DH_meth_new(const char *name, int flags); +void DH_meth_free(DH_METHOD *dhm); +DH_METHOD *DH_meth_dup(const DH_METHOD *dhm); +const char *DH_meth_get0_name(const DH_METHOD *dhm); +int DH_meth_set1_name(DH_METHOD *dhm, const char *name); +int DH_meth_get_flags(const DH_METHOD *dhm); +int DH_meth_set_flags(DH_METHOD *dhm, int flags); +void *DH_meth_get0_app_data(const DH_METHOD *dhm); +int DH_meth_set0_app_data(DH_METHOD *dhm, void *app_data); +int (*DH_meth_get_generate_key(const DH_METHOD *dhm)) (DH *); +int DH_meth_set_generate_key(DH_METHOD *dhm, int (*generate_key) (DH *)); +int (*DH_meth_get_compute_key(const DH_METHOD *dhm)) + (unsigned char *key, const BIGNUM *pub_key, DH *dh); +int DH_meth_set_compute_key(DH_METHOD *dhm, + int (*compute_key) (unsigned char *key, const BIGNUM *pub_key, DH *dh)); +int (*DH_meth_get_bn_mod_exp(const DH_METHOD *dhm)) + (const DH *, BIGNUM *, const BIGNUM *, const BIGNUM *, const BIGNUM *, + BN_CTX *, BN_MONT_CTX *); +int DH_meth_set_bn_mod_exp(DH_METHOD *dhm, + int (*bn_mod_exp) (const DH *, BIGNUM *, const BIGNUM *, const BIGNUM *, + const BIGNUM *, BN_CTX *, BN_MONT_CTX *)); +int (*DH_meth_get_init(const DH_METHOD *dhm))(DH *); +int DH_meth_set_init(DH_METHOD *dhm, int (*init)(DH *)); +int (*DH_meth_get_finish(const DH_METHOD *dhm)) (DH *); +int DH_meth_set_finish(DH_METHOD *dhm, int (*finish) (DH *)); +int (*DH_meth_get_generate_params(const DH_METHOD *dhm)) + (DH *, int, int, BN_GENCB *); +int DH_meth_set_generate_params(DH_METHOD *dhm, + int (*generate_params) (DH *, int, int, BN_GENCB *)); + + +# define EVP_PKEY_CTX_set_dh_paramgen_prime_len(ctx, len) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \ + EVP_PKEY_CTRL_DH_PARAMGEN_PRIME_LEN, len, NULL) + +# define EVP_PKEY_CTX_set_dh_paramgen_subprime_len(ctx, len) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \ + EVP_PKEY_CTRL_DH_PARAMGEN_SUBPRIME_LEN, len, NULL) + +# define EVP_PKEY_CTX_set_dh_paramgen_type(ctx, typ) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \ + EVP_PKEY_CTRL_DH_PARAMGEN_TYPE, typ, NULL) + +# define EVP_PKEY_CTX_set_dh_paramgen_generator(ctx, gen) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \ + EVP_PKEY_CTRL_DH_PARAMGEN_GENERATOR, gen, NULL) + +# define EVP_PKEY_CTX_set_dh_rfc5114(ctx, gen) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, EVP_PKEY_OP_PARAMGEN, \ + EVP_PKEY_CTRL_DH_RFC5114, gen, NULL) + +# define EVP_PKEY_CTX_set_dhx_rfc5114(ctx, gen) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, EVP_PKEY_OP_PARAMGEN, \ + EVP_PKEY_CTRL_DH_RFC5114, gen, NULL) + +# define EVP_PKEY_CTX_set_dh_nid(ctx, nid) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, \ + EVP_PKEY_OP_PARAMGEN | EVP_PKEY_OP_KEYGEN, \ + EVP_PKEY_CTRL_DH_NID, nid, NULL) + +# define EVP_PKEY_CTX_set_dh_pad(ctx, pad) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_DH_PAD, pad, NULL) + +# define EVP_PKEY_CTX_set_dh_kdf_type(ctx, kdf) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_DH_KDF_TYPE, kdf, NULL) + +# define EVP_PKEY_CTX_get_dh_kdf_type(ctx) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_DH_KDF_TYPE, -2, NULL) + +# define EVP_PKEY_CTX_set0_dh_kdf_oid(ctx, oid) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_DH_KDF_OID, 0, (void *)(oid)) + +# define EVP_PKEY_CTX_get0_dh_kdf_oid(ctx, poid) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_GET_DH_KDF_OID, 0, (void *)(poid)) + +# define EVP_PKEY_CTX_set_dh_kdf_md(ctx, md) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_DH_KDF_MD, 0, (void *)(md)) + +# define EVP_PKEY_CTX_get_dh_kdf_md(ctx, pmd) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_GET_DH_KDF_MD, 0, (void *)(pmd)) + +# define EVP_PKEY_CTX_set_dh_kdf_outlen(ctx, len) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_DH_KDF_OUTLEN, len, NULL) + +# define EVP_PKEY_CTX_get_dh_kdf_outlen(ctx, plen) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_GET_DH_KDF_OUTLEN, 0, (void *)(plen)) + +# define EVP_PKEY_CTX_set0_dh_kdf_ukm(ctx, p, plen) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_DH_KDF_UKM, plen, (void *)(p)) + +# define EVP_PKEY_CTX_get0_dh_kdf_ukm(ctx, p) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_GET_DH_KDF_UKM, 0, (void *)(p)) + +# define EVP_PKEY_CTRL_DH_PARAMGEN_PRIME_LEN (EVP_PKEY_ALG_CTRL + 1) +# define EVP_PKEY_CTRL_DH_PARAMGEN_GENERATOR (EVP_PKEY_ALG_CTRL + 2) +# define EVP_PKEY_CTRL_DH_RFC5114 (EVP_PKEY_ALG_CTRL + 3) +# define EVP_PKEY_CTRL_DH_PARAMGEN_SUBPRIME_LEN (EVP_PKEY_ALG_CTRL + 4) +# define EVP_PKEY_CTRL_DH_PARAMGEN_TYPE (EVP_PKEY_ALG_CTRL + 5) +# define EVP_PKEY_CTRL_DH_KDF_TYPE (EVP_PKEY_ALG_CTRL + 6) +# define EVP_PKEY_CTRL_DH_KDF_MD (EVP_PKEY_ALG_CTRL + 7) +# define EVP_PKEY_CTRL_GET_DH_KDF_MD (EVP_PKEY_ALG_CTRL + 8) +# define EVP_PKEY_CTRL_DH_KDF_OUTLEN (EVP_PKEY_ALG_CTRL + 9) +# define EVP_PKEY_CTRL_GET_DH_KDF_OUTLEN (EVP_PKEY_ALG_CTRL + 10) +# define EVP_PKEY_CTRL_DH_KDF_UKM (EVP_PKEY_ALG_CTRL + 11) +# define EVP_PKEY_CTRL_GET_DH_KDF_UKM (EVP_PKEY_ALG_CTRL + 12) +# define EVP_PKEY_CTRL_DH_KDF_OID (EVP_PKEY_ALG_CTRL + 13) +# define EVP_PKEY_CTRL_GET_DH_KDF_OID (EVP_PKEY_ALG_CTRL + 14) +# define EVP_PKEY_CTRL_DH_NID (EVP_PKEY_ALG_CTRL + 15) +# define EVP_PKEY_CTRL_DH_PAD (EVP_PKEY_ALG_CTRL + 16) + +/* KDF types */ +# define EVP_PKEY_DH_KDF_NONE 1 +# ifndef OPENSSL_NO_CMS +# define EVP_PKEY_DH_KDF_X9_42 2 +# endif + + +# ifdef __cplusplus +} +# endif +# endif +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/dherr.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/dherr.h new file mode 100644 index 0000000..916b3be --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/dherr.h @@ -0,0 +1,88 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_DHERR_H +# define HEADER_DHERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# include + +# ifndef OPENSSL_NO_DH + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_DH_strings(void); + +/* + * DH function codes. + */ +# define DH_F_COMPUTE_KEY 102 +# define DH_F_DHPARAMS_PRINT_FP 101 +# define DH_F_DH_BUILTIN_GENPARAMS 106 +# define DH_F_DH_CHECK_EX 121 +# define DH_F_DH_CHECK_PARAMS_EX 122 +# define DH_F_DH_CHECK_PUB_KEY_EX 123 +# define DH_F_DH_CMS_DECRYPT 114 +# define DH_F_DH_CMS_SET_PEERKEY 115 +# define DH_F_DH_CMS_SET_SHARED_INFO 116 +# define DH_F_DH_METH_DUP 117 +# define DH_F_DH_METH_NEW 118 +# define DH_F_DH_METH_SET1_NAME 119 +# define DH_F_DH_NEW_BY_NID 104 +# define DH_F_DH_NEW_METHOD 105 +# define DH_F_DH_PARAM_DECODE 107 +# define DH_F_DH_PKEY_PUBLIC_CHECK 124 +# define DH_F_DH_PRIV_DECODE 110 +# define DH_F_DH_PRIV_ENCODE 111 +# define DH_F_DH_PUB_DECODE 108 +# define DH_F_DH_PUB_ENCODE 109 +# define DH_F_DO_DH_PRINT 100 +# define DH_F_GENERATE_KEY 103 +# define DH_F_PKEY_DH_CTRL_STR 120 +# define DH_F_PKEY_DH_DERIVE 112 +# define DH_F_PKEY_DH_INIT 125 +# define DH_F_PKEY_DH_KEYGEN 113 + +/* + * DH reason codes. + */ +# define DH_R_BAD_GENERATOR 101 +# define DH_R_BN_DECODE_ERROR 109 +# define DH_R_BN_ERROR 106 +# define DH_R_CHECK_INVALID_J_VALUE 115 +# define DH_R_CHECK_INVALID_Q_VALUE 116 +# define DH_R_CHECK_PUBKEY_INVALID 122 +# define DH_R_CHECK_PUBKEY_TOO_LARGE 123 +# define DH_R_CHECK_PUBKEY_TOO_SMALL 124 +# define DH_R_CHECK_P_NOT_PRIME 117 +# define DH_R_CHECK_P_NOT_SAFE_PRIME 118 +# define DH_R_CHECK_Q_NOT_PRIME 119 +# define DH_R_DECODE_ERROR 104 +# define DH_R_INVALID_PARAMETER_NAME 110 +# define DH_R_INVALID_PARAMETER_NID 114 +# define DH_R_INVALID_PUBKEY 102 +# define DH_R_KDF_PARAMETER_ERROR 112 +# define DH_R_KEYS_NOT_SET 108 +# define DH_R_MISSING_PUBKEY 125 +# define DH_R_MODULUS_TOO_LARGE 103 +# define DH_R_NOT_SUITABLE_GENERATOR 120 +# define DH_R_NO_PARAMETERS_SET 107 +# define DH_R_NO_PRIVATE_VALUE 100 +# define DH_R_PARAMETER_ENCODING_ERROR 105 +# define DH_R_PEER_KEY_ERROR 111 +# define DH_R_SHARED_INFO_ERROR 113 +# define DH_R_UNABLE_TO_CHECK_GENERATOR 121 + +# endif +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/dsa.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/dsa.h new file mode 100644 index 0000000..6d8a18a --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/dsa.h @@ -0,0 +1,244 @@ +/* + * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_DSA_H +# define HEADER_DSA_H + +# include + +# ifndef OPENSSL_NO_DSA +# ifdef __cplusplus +extern "C" { +# endif +# include +# include +# include +# include +# include +# if OPENSSL_API_COMPAT < 0x10100000L +# include +# endif +# include + +# ifndef OPENSSL_DSA_MAX_MODULUS_BITS +# define OPENSSL_DSA_MAX_MODULUS_BITS 10000 +# endif + +# define OPENSSL_DSA_FIPS_MIN_MODULUS_BITS 1024 + +# define DSA_FLAG_CACHE_MONT_P 0x01 +# if OPENSSL_API_COMPAT < 0x10100000L +/* + * Does nothing. Previously this switched off constant time behaviour. + */ +# define DSA_FLAG_NO_EXP_CONSTTIME 0x00 +# endif + +/* + * If this flag is set the DSA method is FIPS compliant and can be used in + * FIPS mode. This is set in the validated module method. If an application + * sets this flag in its own methods it is its responsibility to ensure the + * result is compliant. + */ + +# define DSA_FLAG_FIPS_METHOD 0x0400 + +/* + * If this flag is set the operations normally disabled in FIPS mode are + * permitted it is then the applications responsibility to ensure that the + * usage is compliant. + */ + +# define DSA_FLAG_NON_FIPS_ALLOW 0x0400 +# define DSA_FLAG_FIPS_CHECKED 0x0800 + +/* Already defined in ossl_typ.h */ +/* typedef struct dsa_st DSA; */ +/* typedef struct dsa_method DSA_METHOD; */ + +typedef struct DSA_SIG_st DSA_SIG; + +# define d2i_DSAparams_fp(fp,x) (DSA *)ASN1_d2i_fp((char *(*)())DSA_new, \ + (char *(*)())d2i_DSAparams,(fp),(unsigned char **)(x)) +# define i2d_DSAparams_fp(fp,x) ASN1_i2d_fp(i2d_DSAparams,(fp), \ + (unsigned char *)(x)) +# define d2i_DSAparams_bio(bp,x) ASN1_d2i_bio_of(DSA,DSA_new,d2i_DSAparams,bp,x) +# define i2d_DSAparams_bio(bp,x) ASN1_i2d_bio_of_const(DSA,i2d_DSAparams,bp,x) + +DSA *DSAparams_dup(DSA *x); +DSA_SIG *DSA_SIG_new(void); +void DSA_SIG_free(DSA_SIG *a); +int i2d_DSA_SIG(const DSA_SIG *a, unsigned char **pp); +DSA_SIG *d2i_DSA_SIG(DSA_SIG **v, const unsigned char **pp, long length); +void DSA_SIG_get0(const DSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps); +int DSA_SIG_set0(DSA_SIG *sig, BIGNUM *r, BIGNUM *s); + +DSA_SIG *DSA_do_sign(const unsigned char *dgst, int dlen, DSA *dsa); +int DSA_do_verify(const unsigned char *dgst, int dgst_len, + DSA_SIG *sig, DSA *dsa); + +const DSA_METHOD *DSA_OpenSSL(void); + +void DSA_set_default_method(const DSA_METHOD *); +const DSA_METHOD *DSA_get_default_method(void); +int DSA_set_method(DSA *dsa, const DSA_METHOD *); +const DSA_METHOD *DSA_get_method(DSA *d); + +DSA *DSA_new(void); +DSA *DSA_new_method(ENGINE *engine); +void DSA_free(DSA *r); +/* "up" the DSA object's reference count */ +int DSA_up_ref(DSA *r); +int DSA_size(const DSA *); +int DSA_bits(const DSA *d); +int DSA_security_bits(const DSA *d); + /* next 4 return -1 on error */ +DEPRECATEDIN_1_2_0(int DSA_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp)) +int DSA_sign(int type, const unsigned char *dgst, int dlen, + unsigned char *sig, unsigned int *siglen, DSA *dsa); +int DSA_verify(int type, const unsigned char *dgst, int dgst_len, + const unsigned char *sigbuf, int siglen, DSA *dsa); +#define DSA_get_ex_new_index(l, p, newf, dupf, freef) \ + CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_DSA, l, p, newf, dupf, freef) +int DSA_set_ex_data(DSA *d, int idx, void *arg); +void *DSA_get_ex_data(DSA *d, int idx); + +DSA *d2i_DSAPublicKey(DSA **a, const unsigned char **pp, long length); +DSA *d2i_DSAPrivateKey(DSA **a, const unsigned char **pp, long length); +DSA *d2i_DSAparams(DSA **a, const unsigned char **pp, long length); + +/* Deprecated version */ +DEPRECATEDIN_0_9_8(DSA *DSA_generate_parameters(int bits, + unsigned char *seed, + int seed_len, + int *counter_ret, + unsigned long *h_ret, void + (*callback) (int, int, + void *), + void *cb_arg)) + +/* New version */ +int DSA_generate_parameters_ex(DSA *dsa, int bits, + const unsigned char *seed, int seed_len, + int *counter_ret, unsigned long *h_ret, + BN_GENCB *cb); + +int DSA_generate_key(DSA *a); +int i2d_DSAPublicKey(const DSA *a, unsigned char **pp); +int i2d_DSAPrivateKey(const DSA *a, unsigned char **pp); +int i2d_DSAparams(const DSA *a, unsigned char **pp); + +int DSAparams_print(BIO *bp, const DSA *x); +int DSA_print(BIO *bp, const DSA *x, int off); +# ifndef OPENSSL_NO_STDIO +int DSAparams_print_fp(FILE *fp, const DSA *x); +int DSA_print_fp(FILE *bp, const DSA *x, int off); +# endif + +# define DSS_prime_checks 64 +/* + * Primality test according to FIPS PUB 186-4, Appendix C.3. Since we only + * have one value here we set the number of checks to 64 which is the 128 bit + * security level that is the highest level and valid for creating a 3072 bit + * DSA key. + */ +# define DSA_is_prime(n, callback, cb_arg) \ + BN_is_prime(n, DSS_prime_checks, callback, NULL, cb_arg) + +# ifndef OPENSSL_NO_DH +/* + * Convert DSA structure (key or just parameters) into DH structure (be + * careful to avoid small subgroup attacks when using this!) + */ +DH *DSA_dup_DH(const DSA *r); +# endif + +# define EVP_PKEY_CTX_set_dsa_paramgen_bits(ctx, nbits) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DSA, EVP_PKEY_OP_PARAMGEN, \ + EVP_PKEY_CTRL_DSA_PARAMGEN_BITS, nbits, NULL) +# define EVP_PKEY_CTX_set_dsa_paramgen_q_bits(ctx, qbits) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DSA, EVP_PKEY_OP_PARAMGEN, \ + EVP_PKEY_CTRL_DSA_PARAMGEN_Q_BITS, qbits, NULL) +# define EVP_PKEY_CTX_set_dsa_paramgen_md(ctx, md) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DSA, EVP_PKEY_OP_PARAMGEN, \ + EVP_PKEY_CTRL_DSA_PARAMGEN_MD, 0, (void *)(md)) + +# define EVP_PKEY_CTRL_DSA_PARAMGEN_BITS (EVP_PKEY_ALG_CTRL + 1) +# define EVP_PKEY_CTRL_DSA_PARAMGEN_Q_BITS (EVP_PKEY_ALG_CTRL + 2) +# define EVP_PKEY_CTRL_DSA_PARAMGEN_MD (EVP_PKEY_ALG_CTRL + 3) + +void DSA_get0_pqg(const DSA *d, + const BIGNUM **p, const BIGNUM **q, const BIGNUM **g); +int DSA_set0_pqg(DSA *d, BIGNUM *p, BIGNUM *q, BIGNUM *g); +void DSA_get0_key(const DSA *d, + const BIGNUM **pub_key, const BIGNUM **priv_key); +int DSA_set0_key(DSA *d, BIGNUM *pub_key, BIGNUM *priv_key); +const BIGNUM *DSA_get0_p(const DSA *d); +const BIGNUM *DSA_get0_q(const DSA *d); +const BIGNUM *DSA_get0_g(const DSA *d); +const BIGNUM *DSA_get0_pub_key(const DSA *d); +const BIGNUM *DSA_get0_priv_key(const DSA *d); +void DSA_clear_flags(DSA *d, int flags); +int DSA_test_flags(const DSA *d, int flags); +void DSA_set_flags(DSA *d, int flags); +ENGINE *DSA_get0_engine(DSA *d); + +DSA_METHOD *DSA_meth_new(const char *name, int flags); +void DSA_meth_free(DSA_METHOD *dsam); +DSA_METHOD *DSA_meth_dup(const DSA_METHOD *dsam); +const char *DSA_meth_get0_name(const DSA_METHOD *dsam); +int DSA_meth_set1_name(DSA_METHOD *dsam, const char *name); +int DSA_meth_get_flags(const DSA_METHOD *dsam); +int DSA_meth_set_flags(DSA_METHOD *dsam, int flags); +void *DSA_meth_get0_app_data(const DSA_METHOD *dsam); +int DSA_meth_set0_app_data(DSA_METHOD *dsam, void *app_data); +DSA_SIG *(*DSA_meth_get_sign(const DSA_METHOD *dsam)) + (const unsigned char *, int, DSA *); +int DSA_meth_set_sign(DSA_METHOD *dsam, + DSA_SIG *(*sign) (const unsigned char *, int, DSA *)); +int (*DSA_meth_get_sign_setup(const DSA_METHOD *dsam)) + (DSA *, BN_CTX *, BIGNUM **, BIGNUM **); +int DSA_meth_set_sign_setup(DSA_METHOD *dsam, + int (*sign_setup) (DSA *, BN_CTX *, BIGNUM **, BIGNUM **)); +int (*DSA_meth_get_verify(const DSA_METHOD *dsam)) + (const unsigned char *, int, DSA_SIG *, DSA *); +int DSA_meth_set_verify(DSA_METHOD *dsam, + int (*verify) (const unsigned char *, int, DSA_SIG *, DSA *)); +int (*DSA_meth_get_mod_exp(const DSA_METHOD *dsam)) + (DSA *, BIGNUM *, const BIGNUM *, const BIGNUM *, const BIGNUM *, + const BIGNUM *, const BIGNUM *, BN_CTX *, BN_MONT_CTX *); +int DSA_meth_set_mod_exp(DSA_METHOD *dsam, + int (*mod_exp) (DSA *, BIGNUM *, const BIGNUM *, const BIGNUM *, + const BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *, + BN_MONT_CTX *)); +int (*DSA_meth_get_bn_mod_exp(const DSA_METHOD *dsam)) + (DSA *, BIGNUM *, const BIGNUM *, const BIGNUM *, const BIGNUM *, + BN_CTX *, BN_MONT_CTX *); +int DSA_meth_set_bn_mod_exp(DSA_METHOD *dsam, + int (*bn_mod_exp) (DSA *, BIGNUM *, const BIGNUM *, const BIGNUM *, + const BIGNUM *, BN_CTX *, BN_MONT_CTX *)); +int (*DSA_meth_get_init(const DSA_METHOD *dsam))(DSA *); +int DSA_meth_set_init(DSA_METHOD *dsam, int (*init)(DSA *)); +int (*DSA_meth_get_finish(const DSA_METHOD *dsam)) (DSA *); +int DSA_meth_set_finish(DSA_METHOD *dsam, int (*finish) (DSA *)); +int (*DSA_meth_get_paramgen(const DSA_METHOD *dsam)) + (DSA *, int, const unsigned char *, int, int *, unsigned long *, + BN_GENCB *); +int DSA_meth_set_paramgen(DSA_METHOD *dsam, + int (*paramgen) (DSA *, int, const unsigned char *, int, int *, + unsigned long *, BN_GENCB *)); +int (*DSA_meth_get_keygen(const DSA_METHOD *dsam)) (DSA *); +int DSA_meth_set_keygen(DSA_METHOD *dsam, int (*keygen) (DSA *)); + + +# ifdef __cplusplus +} +# endif +# endif +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/dsaerr.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/dsaerr.h new file mode 100644 index 0000000..495a1ac --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/dsaerr.h @@ -0,0 +1,72 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_DSAERR_H +# define HEADER_DSAERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# include + +# ifndef OPENSSL_NO_DSA + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_DSA_strings(void); + +/* + * DSA function codes. + */ +# define DSA_F_DSAPARAMS_PRINT 100 +# define DSA_F_DSAPARAMS_PRINT_FP 101 +# define DSA_F_DSA_BUILTIN_PARAMGEN 125 +# define DSA_F_DSA_BUILTIN_PARAMGEN2 126 +# define DSA_F_DSA_DO_SIGN 112 +# define DSA_F_DSA_DO_VERIFY 113 +# define DSA_F_DSA_METH_DUP 127 +# define DSA_F_DSA_METH_NEW 128 +# define DSA_F_DSA_METH_SET1_NAME 129 +# define DSA_F_DSA_NEW_METHOD 103 +# define DSA_F_DSA_PARAM_DECODE 119 +# define DSA_F_DSA_PRINT_FP 105 +# define DSA_F_DSA_PRIV_DECODE 115 +# define DSA_F_DSA_PRIV_ENCODE 116 +# define DSA_F_DSA_PUB_DECODE 117 +# define DSA_F_DSA_PUB_ENCODE 118 +# define DSA_F_DSA_SIGN 106 +# define DSA_F_DSA_SIGN_SETUP 107 +# define DSA_F_DSA_SIG_NEW 102 +# define DSA_F_OLD_DSA_PRIV_DECODE 122 +# define DSA_F_PKEY_DSA_CTRL 120 +# define DSA_F_PKEY_DSA_CTRL_STR 104 +# define DSA_F_PKEY_DSA_KEYGEN 121 + +/* + * DSA reason codes. + */ +# define DSA_R_BAD_Q_VALUE 102 +# define DSA_R_BN_DECODE_ERROR 108 +# define DSA_R_BN_ERROR 109 +# define DSA_R_DECODE_ERROR 104 +# define DSA_R_INVALID_DIGEST_TYPE 106 +# define DSA_R_INVALID_PARAMETERS 112 +# define DSA_R_MISSING_PARAMETERS 101 +# define DSA_R_MISSING_PRIVATE_KEY 111 +# define DSA_R_MODULUS_TOO_LARGE 103 +# define DSA_R_NO_PARAMETERS_SET 107 +# define DSA_R_PARAMETER_ENCODING_ERROR 105 +# define DSA_R_Q_NOT_PRIME 113 +# define DSA_R_SEED_LEN_SMALL 110 + +# endif +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/dtls1.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/dtls1.h new file mode 100644 index 0000000..d55ca9c --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/dtls1.h @@ -0,0 +1,55 @@ +/* + * Copyright 2005-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_DTLS1_H +# define HEADER_DTLS1_H + +#ifdef __cplusplus +extern "C" { +#endif + +# define DTLS1_VERSION 0xFEFF +# define DTLS1_2_VERSION 0xFEFD +# define DTLS_MIN_VERSION DTLS1_VERSION +# define DTLS_MAX_VERSION DTLS1_2_VERSION +# define DTLS1_VERSION_MAJOR 0xFE + +# define DTLS1_BAD_VER 0x0100 + +/* Special value for method supporting multiple versions */ +# define DTLS_ANY_VERSION 0x1FFFF + +/* lengths of messages */ +/* + * Actually the max cookie length in DTLS is 255. But we can't change this now + * due to compatibility concerns. + */ +# define DTLS1_COOKIE_LENGTH 256 + +# define DTLS1_RT_HEADER_LENGTH 13 + +# define DTLS1_HM_HEADER_LENGTH 12 + +# define DTLS1_HM_BAD_FRAGMENT -2 +# define DTLS1_HM_FRAGMENT_RETRY -3 + +# define DTLS1_CCS_HEADER_LENGTH 1 + +# define DTLS1_AL_HEADER_LENGTH 2 + +/* Timeout multipliers */ +# define DTLS1_TMO_READ_COUNT 2 +# define DTLS1_TMO_WRITE_COUNT 2 + +# define DTLS1_TMO_ALERT_COUNT 12 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/e_os2.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/e_os2.h new file mode 100644 index 0000000..97a776c --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/e_os2.h @@ -0,0 +1,300 @@ +/* + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_E_OS2_H +# define HEADER_E_OS2_H + +# include + +#ifdef __cplusplus +extern "C" { +#endif + +/****************************************************************************** + * Detect operating systems. This probably needs completing. + * The result is that at least one OPENSSL_SYS_os macro should be defined. + * However, if none is defined, Unix is assumed. + **/ + +# define OPENSSL_SYS_UNIX + +/* --------------------- Microsoft operating systems ---------------------- */ + +/* + * Note that MSDOS actually denotes 32-bit environments running on top of + * MS-DOS, such as DJGPP one. + */ +# if defined(OPENSSL_SYS_MSDOS) +# undef OPENSSL_SYS_UNIX +# endif + +/* + * For 32 bit environment, there seems to be the CygWin environment and then + * all the others that try to do the same thing Microsoft does... + */ +/* + * UEFI lives here because it might be built with a Microsoft toolchain and + * we need to avoid the false positive match on Windows. + */ +# if defined(OPENSSL_SYS_UEFI) +# undef OPENSSL_SYS_UNIX +# elif defined(OPENSSL_SYS_UWIN) +# undef OPENSSL_SYS_UNIX +# define OPENSSL_SYS_WIN32_UWIN +# else +# if defined(__CYGWIN__) || defined(OPENSSL_SYS_CYGWIN) +# define OPENSSL_SYS_WIN32_CYGWIN +# else +# if defined(_WIN32) || defined(OPENSSL_SYS_WIN32) +# undef OPENSSL_SYS_UNIX +# if !defined(OPENSSL_SYS_WIN32) +# define OPENSSL_SYS_WIN32 +# endif +# endif +# if defined(_WIN64) || defined(OPENSSL_SYS_WIN64) +# undef OPENSSL_SYS_UNIX +# if !defined(OPENSSL_SYS_WIN64) +# define OPENSSL_SYS_WIN64 +# endif +# endif +# if defined(OPENSSL_SYS_WINNT) +# undef OPENSSL_SYS_UNIX +# endif +# if defined(OPENSSL_SYS_WINCE) +# undef OPENSSL_SYS_UNIX +# endif +# endif +# endif + +/* Anything that tries to look like Microsoft is "Windows" */ +# if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WIN64) || defined(OPENSSL_SYS_WINNT) || defined(OPENSSL_SYS_WINCE) +# undef OPENSSL_SYS_UNIX +# define OPENSSL_SYS_WINDOWS +# ifndef OPENSSL_SYS_MSDOS +# define OPENSSL_SYS_MSDOS +# endif +# endif + +/* + * DLL settings. This part is a bit tough, because it's up to the + * application implementor how he or she will link the application, so it + * requires some macro to be used. + */ +# ifdef OPENSSL_SYS_WINDOWS +# ifndef OPENSSL_OPT_WINDLL +# if defined(_WINDLL) /* This is used when building OpenSSL to + * indicate that DLL linkage should be used */ +# define OPENSSL_OPT_WINDLL +# endif +# endif +# endif + +/* ------------------------------- OpenVMS -------------------------------- */ +# if defined(__VMS) || defined(VMS) || defined(OPENSSL_SYS_VMS) +# if !defined(OPENSSL_SYS_VMS) +# undef OPENSSL_SYS_UNIX +# endif +# define OPENSSL_SYS_VMS +# if defined(__DECC) +# define OPENSSL_SYS_VMS_DECC +# elif defined(__DECCXX) +# define OPENSSL_SYS_VMS_DECC +# define OPENSSL_SYS_VMS_DECCXX +# else +# define OPENSSL_SYS_VMS_NODECC +# endif +# endif + +/* -------------------------------- Unix ---------------------------------- */ +# ifdef OPENSSL_SYS_UNIX +# if defined(linux) || defined(__linux__) && !defined(OPENSSL_SYS_LINUX) +# define OPENSSL_SYS_LINUX +# endif +# if defined(_AIX) && !defined(OPENSSL_SYS_AIX) +# define OPENSSL_SYS_AIX +# endif +# endif + +/* -------------------------------- VOS ----------------------------------- */ +# if defined(__VOS__) && !defined(OPENSSL_SYS_VOS) +# define OPENSSL_SYS_VOS +# ifdef __HPPA__ +# define OPENSSL_SYS_VOS_HPPA +# endif +# ifdef __IA32__ +# define OPENSSL_SYS_VOS_IA32 +# endif +# endif + +/** + * That's it for OS-specific stuff + *****************************************************************************/ + +/* Specials for I/O an exit */ +# ifdef OPENSSL_SYS_MSDOS +# define OPENSSL_UNISTD_IO +# define OPENSSL_DECLARE_EXIT extern void exit(int); +# else +# define OPENSSL_UNISTD_IO OPENSSL_UNISTD +# define OPENSSL_DECLARE_EXIT /* declared in unistd.h */ +# endif + +/*- + * OPENSSL_EXTERN is normally used to declare a symbol with possible extra + * attributes to handle its presence in a shared library. + * OPENSSL_EXPORT is used to define a symbol with extra possible attributes + * to make it visible in a shared library. + * Care needs to be taken when a header file is used both to declare and + * define symbols. Basically, for any library that exports some global + * variables, the following code must be present in the header file that + * declares them, before OPENSSL_EXTERN is used: + * + * #ifdef SOME_BUILD_FLAG_MACRO + * # undef OPENSSL_EXTERN + * # define OPENSSL_EXTERN OPENSSL_EXPORT + * #endif + * + * The default is to have OPENSSL_EXPORT and OPENSSL_EXTERN + * have some generally sensible values. + */ + +# if defined(OPENSSL_SYS_WINDOWS) && defined(OPENSSL_OPT_WINDLL) +# define OPENSSL_EXPORT extern __declspec(dllexport) +# define OPENSSL_EXTERN extern __declspec(dllimport) +# else +# define OPENSSL_EXPORT extern +# define OPENSSL_EXTERN extern +# endif + +/*- + * Macros to allow global variables to be reached through function calls when + * required (if a shared library version requires it, for example. + * The way it's done allows definitions like this: + * + * // in foobar.c + * OPENSSL_IMPLEMENT_GLOBAL(int,foobar,0) + * // in foobar.h + * OPENSSL_DECLARE_GLOBAL(int,foobar); + * #define foobar OPENSSL_GLOBAL_REF(foobar) + */ +# ifdef OPENSSL_EXPORT_VAR_AS_FUNCTION +# define OPENSSL_IMPLEMENT_GLOBAL(type,name,value) \ + type *_shadow_##name(void) \ + { static type _hide_##name=value; return &_hide_##name; } +# define OPENSSL_DECLARE_GLOBAL(type,name) type *_shadow_##name(void) +# define OPENSSL_GLOBAL_REF(name) (*(_shadow_##name())) +# else +# define OPENSSL_IMPLEMENT_GLOBAL(type,name,value) type _shadow_##name=value; +# define OPENSSL_DECLARE_GLOBAL(type,name) OPENSSL_EXPORT type _shadow_##name +# define OPENSSL_GLOBAL_REF(name) _shadow_##name +# endif + +# ifdef _WIN32 +# ifdef _WIN64 +# define ossl_ssize_t __int64 +# define OSSL_SSIZE_MAX _I64_MAX +# else +# define ossl_ssize_t int +# define OSSL_SSIZE_MAX INT_MAX +# endif +# endif + +# if defined(OPENSSL_SYS_UEFI) && !defined(ossl_ssize_t) +# define ossl_ssize_t INTN +# define OSSL_SSIZE_MAX MAX_INTN +# endif + +# ifndef ossl_ssize_t +# define ossl_ssize_t ssize_t +# if defined(SSIZE_MAX) +# define OSSL_SSIZE_MAX SSIZE_MAX +# elif defined(_POSIX_SSIZE_MAX) +# define OSSL_SSIZE_MAX _POSIX_SSIZE_MAX +# else +# define OSSL_SSIZE_MAX ((ssize_t)(SIZE_MAX>>1)) +# endif +# endif + +# ifdef DEBUG_UNUSED +# define __owur __attribute__((__warn_unused_result__)) +# else +# define __owur +# endif + +/* Standard integer types */ +# if defined(OPENSSL_SYS_UEFI) +typedef INT8 int8_t; +typedef UINT8 uint8_t; +typedef INT16 int16_t; +typedef UINT16 uint16_t; +typedef INT32 int32_t; +typedef UINT32 uint32_t; +typedef INT64 int64_t; +typedef UINT64 uint64_t; +# elif (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \ + defined(__osf__) || defined(__sgi) || defined(__hpux) || \ + defined(OPENSSL_SYS_VMS) || defined (__OpenBSD__) +# include +# elif defined(_MSC_VER) && _MSC_VER<=1500 +/* + * minimally required typdefs for systems not supporting inttypes.h or + * stdint.h: currently just older VC++ + */ +typedef signed char int8_t; +typedef unsigned char uint8_t; +typedef short int16_t; +typedef unsigned short uint16_t; +typedef int int32_t; +typedef unsigned int uint32_t; +typedef __int64 int64_t; +typedef unsigned __int64 uint64_t; +# else +# include +# endif + +/* ossl_inline: portable inline definition usable in public headers */ +# if !defined(inline) && !defined(__cplusplus) +# if defined(__STDC_VERSION__) && __STDC_VERSION__>=199901L + /* just use inline */ +# define ossl_inline inline +# elif defined(__GNUC__) && __GNUC__>=2 +# define ossl_inline __inline__ +# elif defined(_MSC_VER) + /* + * Visual Studio: inline is available in C++ only, however + * __inline is available for C, see + * http://msdn.microsoft.com/en-us/library/z8y1yy88.aspx + */ +# define ossl_inline __inline +# else +# define ossl_inline +# endif +# else +# define ossl_inline inline +# endif + +# if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L +# define ossl_noreturn _Noreturn +# elif defined(__GNUC__) && __GNUC__ >= 2 +# define ossl_noreturn __attribute__((noreturn)) +# else +# define ossl_noreturn +# endif + +/* ossl_unused: portable unused attribute for use in public headers */ +# if defined(__GNUC__) +# define ossl_unused __attribute__((unused)) +# else +# define ossl_unused +# endif + +#ifdef __cplusplus +} +#endif +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/ebcdic.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/ebcdic.h new file mode 100644 index 0000000..aa01285 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/ebcdic.h @@ -0,0 +1,33 @@ +/* + * Copyright 1999-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_EBCDIC_H +# define HEADER_EBCDIC_H + +# include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Avoid name clashes with other applications */ +# define os_toascii _openssl_os_toascii +# define os_toebcdic _openssl_os_toebcdic +# define ebcdic2ascii _openssl_ebcdic2ascii +# define ascii2ebcdic _openssl_ascii2ebcdic + +extern const unsigned char os_toascii[256]; +extern const unsigned char os_toebcdic[256]; +void *ebcdic2ascii(void *dest, const void *srce, size_t count); +void *ascii2ebcdic(void *dest, const void *srce, size_t count); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/ec.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/ec.h new file mode 100644 index 0000000..5af9ebd --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/ec.h @@ -0,0 +1,1479 @@ +/* + * Copyright 2002-2019 The OpenSSL Project Authors. All Rights Reserved. + * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_EC_H +# define HEADER_EC_H + +# include + +# ifndef OPENSSL_NO_EC +# include +# include +# if OPENSSL_API_COMPAT < 0x10100000L +# include +# endif +# include +# ifdef __cplusplus +extern "C" { +# endif + +# ifndef OPENSSL_ECC_MAX_FIELD_BITS +# define OPENSSL_ECC_MAX_FIELD_BITS 661 +# endif + +/** Enum for the point conversion form as defined in X9.62 (ECDSA) + * for the encoding of a elliptic curve point (x,y) */ +typedef enum { + /** the point is encoded as z||x, where the octet z specifies + * which solution of the quadratic equation y is */ + POINT_CONVERSION_COMPRESSED = 2, + /** the point is encoded as z||x||y, where z is the octet 0x04 */ + POINT_CONVERSION_UNCOMPRESSED = 4, + /** the point is encoded as z||x||y, where the octet z specifies + * which solution of the quadratic equation y is */ + POINT_CONVERSION_HYBRID = 6 +} point_conversion_form_t; + +typedef struct ec_method_st EC_METHOD; +typedef struct ec_group_st EC_GROUP; +typedef struct ec_point_st EC_POINT; +typedef struct ecpk_parameters_st ECPKPARAMETERS; +typedef struct ec_parameters_st ECPARAMETERS; + +/********************************************************************/ +/* EC_METHODs for curves over GF(p) */ +/********************************************************************/ + +/** Returns the basic GFp ec methods which provides the basis for the + * optimized methods. + * \return EC_METHOD object + */ +const EC_METHOD *EC_GFp_simple_method(void); + +/** Returns GFp methods using montgomery multiplication. + * \return EC_METHOD object + */ +const EC_METHOD *EC_GFp_mont_method(void); + +/** Returns GFp methods using optimized methods for NIST recommended curves + * \return EC_METHOD object + */ +const EC_METHOD *EC_GFp_nist_method(void); + +# ifndef OPENSSL_NO_EC_NISTP_64_GCC_128 +/** Returns 64-bit optimized methods for nistp224 + * \return EC_METHOD object + */ +const EC_METHOD *EC_GFp_nistp224_method(void); + +/** Returns 64-bit optimized methods for nistp256 + * \return EC_METHOD object + */ +const EC_METHOD *EC_GFp_nistp256_method(void); + +/** Returns 64-bit optimized methods for nistp521 + * \return EC_METHOD object + */ +const EC_METHOD *EC_GFp_nistp521_method(void); +# endif + +# ifndef OPENSSL_NO_EC2M +/********************************************************************/ +/* EC_METHOD for curves over GF(2^m) */ +/********************************************************************/ + +/** Returns the basic GF2m ec method + * \return EC_METHOD object + */ +const EC_METHOD *EC_GF2m_simple_method(void); + +# endif + +/********************************************************************/ +/* EC_GROUP functions */ +/********************************************************************/ + +/** Creates a new EC_GROUP object + * \param meth EC_METHOD to use + * \return newly created EC_GROUP object or NULL in case of an error. + */ +EC_GROUP *EC_GROUP_new(const EC_METHOD *meth); + +/** Frees a EC_GROUP object + * \param group EC_GROUP object to be freed. + */ +void EC_GROUP_free(EC_GROUP *group); + +/** Clears and frees a EC_GROUP object + * \param group EC_GROUP object to be cleared and freed. + */ +void EC_GROUP_clear_free(EC_GROUP *group); + +/** Copies EC_GROUP objects. Note: both EC_GROUPs must use the same EC_METHOD. + * \param dst destination EC_GROUP object + * \param src source EC_GROUP object + * \return 1 on success and 0 if an error occurred. + */ +int EC_GROUP_copy(EC_GROUP *dst, const EC_GROUP *src); + +/** Creates a new EC_GROUP object and copies the copies the content + * form src to the newly created EC_KEY object + * \param src source EC_GROUP object + * \return newly created EC_GROUP object or NULL in case of an error. + */ +EC_GROUP *EC_GROUP_dup(const EC_GROUP *src); + +/** Returns the EC_METHOD of the EC_GROUP object. + * \param group EC_GROUP object + * \return EC_METHOD used in this EC_GROUP object. + */ +const EC_METHOD *EC_GROUP_method_of(const EC_GROUP *group); + +/** Returns the field type of the EC_METHOD. + * \param meth EC_METHOD object + * \return NID of the underlying field type OID. + */ +int EC_METHOD_get_field_type(const EC_METHOD *meth); + +/** Sets the generator and its order/cofactor of a EC_GROUP object. + * \param group EC_GROUP object + * \param generator EC_POINT object with the generator. + * \param order the order of the group generated by the generator. + * \param cofactor the index of the sub-group generated by the generator + * in the group of all points on the elliptic curve. + * \return 1 on success and 0 if an error occurred + */ +int EC_GROUP_set_generator(EC_GROUP *group, const EC_POINT *generator, + const BIGNUM *order, const BIGNUM *cofactor); + +/** Returns the generator of a EC_GROUP object. + * \param group EC_GROUP object + * \return the currently used generator (possibly NULL). + */ +const EC_POINT *EC_GROUP_get0_generator(const EC_GROUP *group); + +/** Returns the montgomery data for order(Generator) + * \param group EC_GROUP object + * \return the currently used montgomery data (possibly NULL). +*/ +BN_MONT_CTX *EC_GROUP_get_mont_data(const EC_GROUP *group); + +/** Gets the order of a EC_GROUP + * \param group EC_GROUP object + * \param order BIGNUM to which the order is copied + * \param ctx unused + * \return 1 on success and 0 if an error occurred + */ +int EC_GROUP_get_order(const EC_GROUP *group, BIGNUM *order, BN_CTX *ctx); + +/** Gets the order of an EC_GROUP + * \param group EC_GROUP object + * \return the group order + */ +const BIGNUM *EC_GROUP_get0_order(const EC_GROUP *group); + +/** Gets the number of bits of the order of an EC_GROUP + * \param group EC_GROUP object + * \return number of bits of group order. + */ +int EC_GROUP_order_bits(const EC_GROUP *group); + +/** Gets the cofactor of a EC_GROUP + * \param group EC_GROUP object + * \param cofactor BIGNUM to which the cofactor is copied + * \param ctx unused + * \return 1 on success and 0 if an error occurred + */ +int EC_GROUP_get_cofactor(const EC_GROUP *group, BIGNUM *cofactor, + BN_CTX *ctx); + +/** Gets the cofactor of an EC_GROUP + * \param group EC_GROUP object + * \return the group cofactor + */ +const BIGNUM *EC_GROUP_get0_cofactor(const EC_GROUP *group); + +/** Sets the name of a EC_GROUP object + * \param group EC_GROUP object + * \param nid NID of the curve name OID + */ +void EC_GROUP_set_curve_name(EC_GROUP *group, int nid); + +/** Returns the curve name of a EC_GROUP object + * \param group EC_GROUP object + * \return NID of the curve name OID or 0 if not set. + */ +int EC_GROUP_get_curve_name(const EC_GROUP *group); + +void EC_GROUP_set_asn1_flag(EC_GROUP *group, int flag); +int EC_GROUP_get_asn1_flag(const EC_GROUP *group); + +void EC_GROUP_set_point_conversion_form(EC_GROUP *group, + point_conversion_form_t form); +point_conversion_form_t EC_GROUP_get_point_conversion_form(const EC_GROUP *); + +unsigned char *EC_GROUP_get0_seed(const EC_GROUP *x); +size_t EC_GROUP_get_seed_len(const EC_GROUP *); +size_t EC_GROUP_set_seed(EC_GROUP *, const unsigned char *, size_t len); + +/** Sets the parameters of a ec curve defined by y^2 = x^3 + a*x + b (for GFp) + * or y^2 + x*y = x^3 + a*x^2 + b (for GF2m) + * \param group EC_GROUP object + * \param p BIGNUM with the prime number (GFp) or the polynomial + * defining the underlying field (GF2m) + * \param a BIGNUM with parameter a of the equation + * \param b BIGNUM with parameter b of the equation + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +int EC_GROUP_set_curve(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, + const BIGNUM *b, BN_CTX *ctx); + +/** Gets the parameters of the ec curve defined by y^2 = x^3 + a*x + b (for GFp) + * or y^2 + x*y = x^3 + a*x^2 + b (for GF2m) + * \param group EC_GROUP object + * \param p BIGNUM with the prime number (GFp) or the polynomial + * defining the underlying field (GF2m) + * \param a BIGNUM for parameter a of the equation + * \param b BIGNUM for parameter b of the equation + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +int EC_GROUP_get_curve(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b, + BN_CTX *ctx); + +/** Sets the parameters of an ec curve. Synonym for EC_GROUP_set_curve + * \param group EC_GROUP object + * \param p BIGNUM with the prime number (GFp) or the polynomial + * defining the underlying field (GF2m) + * \param a BIGNUM with parameter a of the equation + * \param b BIGNUM with parameter b of the equation + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +DEPRECATEDIN_1_2_0(int EC_GROUP_set_curve_GFp(EC_GROUP *group, const BIGNUM *p, + const BIGNUM *a, const BIGNUM *b, + BN_CTX *ctx)) + +/** Gets the parameters of an ec curve. Synonym for EC_GROUP_get_curve + * \param group EC_GROUP object + * \param p BIGNUM with the prime number (GFp) or the polynomial + * defining the underlying field (GF2m) + * \param a BIGNUM for parameter a of the equation + * \param b BIGNUM for parameter b of the equation + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +DEPRECATEDIN_1_2_0(int EC_GROUP_get_curve_GFp(const EC_GROUP *group, BIGNUM *p, + BIGNUM *a, BIGNUM *b, + BN_CTX *ctx)) + +# ifndef OPENSSL_NO_EC2M +/** Sets the parameter of an ec curve. Synonym for EC_GROUP_set_curve + * \param group EC_GROUP object + * \param p BIGNUM with the prime number (GFp) or the polynomial + * defining the underlying field (GF2m) + * \param a BIGNUM with parameter a of the equation + * \param b BIGNUM with parameter b of the equation + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +DEPRECATEDIN_1_2_0(int EC_GROUP_set_curve_GF2m(EC_GROUP *group, const BIGNUM *p, + const BIGNUM *a, const BIGNUM *b, + BN_CTX *ctx)) + +/** Gets the parameters of an ec curve. Synonym for EC_GROUP_get_curve + * \param group EC_GROUP object + * \param p BIGNUM with the prime number (GFp) or the polynomial + * defining the underlying field (GF2m) + * \param a BIGNUM for parameter a of the equation + * \param b BIGNUM for parameter b of the equation + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +DEPRECATEDIN_1_2_0(int EC_GROUP_get_curve_GF2m(const EC_GROUP *group, BIGNUM *p, + BIGNUM *a, BIGNUM *b, + BN_CTX *ctx)) +# endif +/** Returns the number of bits needed to represent a field element + * \param group EC_GROUP object + * \return number of bits needed to represent a field element + */ +int EC_GROUP_get_degree(const EC_GROUP *group); + +/** Checks whether the parameter in the EC_GROUP define a valid ec group + * \param group EC_GROUP object + * \param ctx BN_CTX object (optional) + * \return 1 if group is a valid ec group and 0 otherwise + */ +int EC_GROUP_check(const EC_GROUP *group, BN_CTX *ctx); + +/** Checks whether the discriminant of the elliptic curve is zero or not + * \param group EC_GROUP object + * \param ctx BN_CTX object (optional) + * \return 1 if the discriminant is not zero and 0 otherwise + */ +int EC_GROUP_check_discriminant(const EC_GROUP *group, BN_CTX *ctx); + +/** Compares two EC_GROUP objects + * \param a first EC_GROUP object + * \param b second EC_GROUP object + * \param ctx BN_CTX object (optional) + * \return 0 if the groups are equal, 1 if not, or -1 on error + */ +int EC_GROUP_cmp(const EC_GROUP *a, const EC_GROUP *b, BN_CTX *ctx); + +/* + * EC_GROUP_new_GF*() calls EC_GROUP_new() and EC_GROUP_set_GF*() after + * choosing an appropriate EC_METHOD + */ + +/** Creates a new EC_GROUP object with the specified parameters defined + * over GFp (defined by the equation y^2 = x^3 + a*x + b) + * \param p BIGNUM with the prime number + * \param a BIGNUM with the parameter a of the equation + * \param b BIGNUM with the parameter b of the equation + * \param ctx BN_CTX object (optional) + * \return newly created EC_GROUP object with the specified parameters + */ +EC_GROUP *EC_GROUP_new_curve_GFp(const BIGNUM *p, const BIGNUM *a, + const BIGNUM *b, BN_CTX *ctx); +# ifndef OPENSSL_NO_EC2M +/** Creates a new EC_GROUP object with the specified parameters defined + * over GF2m (defined by the equation y^2 + x*y = x^3 + a*x^2 + b) + * \param p BIGNUM with the polynomial defining the underlying field + * \param a BIGNUM with the parameter a of the equation + * \param b BIGNUM with the parameter b of the equation + * \param ctx BN_CTX object (optional) + * \return newly created EC_GROUP object with the specified parameters + */ +EC_GROUP *EC_GROUP_new_curve_GF2m(const BIGNUM *p, const BIGNUM *a, + const BIGNUM *b, BN_CTX *ctx); +# endif + +/** Creates a EC_GROUP object with a curve specified by a NID + * \param nid NID of the OID of the curve name + * \return newly created EC_GROUP object with specified curve or NULL + * if an error occurred + */ +EC_GROUP *EC_GROUP_new_by_curve_name(int nid); + +/** Creates a new EC_GROUP object from an ECPARAMETERS object + * \param params pointer to the ECPARAMETERS object + * \return newly created EC_GROUP object with specified curve or NULL + * if an error occurred + */ +EC_GROUP *EC_GROUP_new_from_ecparameters(const ECPARAMETERS *params); + +/** Creates an ECPARAMETERS object for the given EC_GROUP object. + * \param group pointer to the EC_GROUP object + * \param params pointer to an existing ECPARAMETERS object or NULL + * \return pointer to the new ECPARAMETERS object or NULL + * if an error occurred. + */ +ECPARAMETERS *EC_GROUP_get_ecparameters(const EC_GROUP *group, + ECPARAMETERS *params); + +/** Creates a new EC_GROUP object from an ECPKPARAMETERS object + * \param params pointer to an existing ECPKPARAMETERS object, or NULL + * \return newly created EC_GROUP object with specified curve, or NULL + * if an error occurred + */ +EC_GROUP *EC_GROUP_new_from_ecpkparameters(const ECPKPARAMETERS *params); + +/** Creates an ECPKPARAMETERS object for the given EC_GROUP object. + * \param group pointer to the EC_GROUP object + * \param params pointer to an existing ECPKPARAMETERS object or NULL + * \return pointer to the new ECPKPARAMETERS object or NULL + * if an error occurred. + */ +ECPKPARAMETERS *EC_GROUP_get_ecpkparameters(const EC_GROUP *group, + ECPKPARAMETERS *params); + +/********************************************************************/ +/* handling of internal curves */ +/********************************************************************/ + +typedef struct { + int nid; + const char *comment; +} EC_builtin_curve; + +/* + * EC_builtin_curves(EC_builtin_curve *r, size_t size) returns number of all + * available curves or zero if a error occurred. In case r is not zero, + * nitems EC_builtin_curve structures are filled with the data of the first + * nitems internal groups + */ +size_t EC_get_builtin_curves(EC_builtin_curve *r, size_t nitems); + +const char *EC_curve_nid2nist(int nid); +int EC_curve_nist2nid(const char *name); + +/********************************************************************/ +/* EC_POINT functions */ +/********************************************************************/ + +/** Creates a new EC_POINT object for the specified EC_GROUP + * \param group EC_GROUP the underlying EC_GROUP object + * \return newly created EC_POINT object or NULL if an error occurred + */ +EC_POINT *EC_POINT_new(const EC_GROUP *group); + +/** Frees a EC_POINT object + * \param point EC_POINT object to be freed + */ +void EC_POINT_free(EC_POINT *point); + +/** Clears and frees a EC_POINT object + * \param point EC_POINT object to be cleared and freed + */ +void EC_POINT_clear_free(EC_POINT *point); + +/** Copies EC_POINT object + * \param dst destination EC_POINT object + * \param src source EC_POINT object + * \return 1 on success and 0 if an error occurred + */ +int EC_POINT_copy(EC_POINT *dst, const EC_POINT *src); + +/** Creates a new EC_POINT object and copies the content of the supplied + * EC_POINT + * \param src source EC_POINT object + * \param group underlying the EC_GROUP object + * \return newly created EC_POINT object or NULL if an error occurred + */ +EC_POINT *EC_POINT_dup(const EC_POINT *src, const EC_GROUP *group); + +/** Returns the EC_METHOD used in EC_POINT object + * \param point EC_POINT object + * \return the EC_METHOD used + */ +const EC_METHOD *EC_POINT_method_of(const EC_POINT *point); + +/** Sets a point to infinity (neutral element) + * \param group underlying EC_GROUP object + * \param point EC_POINT to set to infinity + * \return 1 on success and 0 if an error occurred + */ +int EC_POINT_set_to_infinity(const EC_GROUP *group, EC_POINT *point); + +/** Sets the jacobian projective coordinates of a EC_POINT over GFp + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param x BIGNUM with the x-coordinate + * \param y BIGNUM with the y-coordinate + * \param z BIGNUM with the z-coordinate + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +int EC_POINT_set_Jprojective_coordinates_GFp(const EC_GROUP *group, + EC_POINT *p, const BIGNUM *x, + const BIGNUM *y, const BIGNUM *z, + BN_CTX *ctx); + +/** Gets the jacobian projective coordinates of a EC_POINT over GFp + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param x BIGNUM for the x-coordinate + * \param y BIGNUM for the y-coordinate + * \param z BIGNUM for the z-coordinate + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +int EC_POINT_get_Jprojective_coordinates_GFp(const EC_GROUP *group, + const EC_POINT *p, BIGNUM *x, + BIGNUM *y, BIGNUM *z, + BN_CTX *ctx); + +/** Sets the affine coordinates of an EC_POINT + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param x BIGNUM with the x-coordinate + * \param y BIGNUM with the y-coordinate + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +int EC_POINT_set_affine_coordinates(const EC_GROUP *group, EC_POINT *p, + const BIGNUM *x, const BIGNUM *y, + BN_CTX *ctx); + +/** Gets the affine coordinates of an EC_POINT. + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param x BIGNUM for the x-coordinate + * \param y BIGNUM for the y-coordinate + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +int EC_POINT_get_affine_coordinates(const EC_GROUP *group, const EC_POINT *p, + BIGNUM *x, BIGNUM *y, BN_CTX *ctx); + +/** Sets the affine coordinates of an EC_POINT. A synonym of + * EC_POINT_set_affine_coordinates + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param x BIGNUM with the x-coordinate + * \param y BIGNUM with the y-coordinate + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +DEPRECATEDIN_1_2_0(int EC_POINT_set_affine_coordinates_GFp(const EC_GROUP *group, + EC_POINT *p, + const BIGNUM *x, + const BIGNUM *y, + BN_CTX *ctx)) + +/** Gets the affine coordinates of an EC_POINT. A synonym of + * EC_POINT_get_affine_coordinates + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param x BIGNUM for the x-coordinate + * \param y BIGNUM for the y-coordinate + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +DEPRECATEDIN_1_2_0(int EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *group, + const EC_POINT *p, + BIGNUM *x, + BIGNUM *y, + BN_CTX *ctx)) + +/** Sets the x9.62 compressed coordinates of a EC_POINT + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param x BIGNUM with x-coordinate + * \param y_bit integer with the y-Bit (either 0 or 1) + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +int EC_POINT_set_compressed_coordinates(const EC_GROUP *group, EC_POINT *p, + const BIGNUM *x, int y_bit, + BN_CTX *ctx); + +/** Sets the x9.62 compressed coordinates of a EC_POINT. A synonym of + * EC_POINT_set_compressed_coordinates + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param x BIGNUM with x-coordinate + * \param y_bit integer with the y-Bit (either 0 or 1) + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +DEPRECATEDIN_1_2_0(int EC_POINT_set_compressed_coordinates_GFp(const EC_GROUP *group, + EC_POINT *p, + const BIGNUM *x, + int y_bit, + BN_CTX *ctx)) +# ifndef OPENSSL_NO_EC2M +/** Sets the affine coordinates of an EC_POINT. A synonym of + * EC_POINT_set_affine_coordinates + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param x BIGNUM with the x-coordinate + * \param y BIGNUM with the y-coordinate + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +DEPRECATEDIN_1_2_0(int EC_POINT_set_affine_coordinates_GF2m(const EC_GROUP *group, + EC_POINT *p, + const BIGNUM *x, + const BIGNUM *y, + BN_CTX *ctx)) + +/** Gets the affine coordinates of an EC_POINT. A synonym of + * EC_POINT_get_affine_coordinates + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param x BIGNUM for the x-coordinate + * \param y BIGNUM for the y-coordinate + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +DEPRECATEDIN_1_2_0(int EC_POINT_get_affine_coordinates_GF2m(const EC_GROUP *group, + const EC_POINT *p, + BIGNUM *x, + BIGNUM *y, + BN_CTX *ctx)) + +/** Sets the x9.62 compressed coordinates of a EC_POINT. A synonym of + * EC_POINT_set_compressed_coordinates + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param x BIGNUM with x-coordinate + * \param y_bit integer with the y-Bit (either 0 or 1) + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +DEPRECATEDIN_1_2_0(int EC_POINT_set_compressed_coordinates_GF2m(const EC_GROUP *group, + EC_POINT *p, + const BIGNUM *x, + int y_bit, + BN_CTX *ctx)) +# endif +/** Encodes a EC_POINT object to a octet string + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param form point conversion form + * \param buf memory buffer for the result. If NULL the function returns + * required buffer size. + * \param len length of the memory buffer + * \param ctx BN_CTX object (optional) + * \return the length of the encoded octet string or 0 if an error occurred + */ +size_t EC_POINT_point2oct(const EC_GROUP *group, const EC_POINT *p, + point_conversion_form_t form, + unsigned char *buf, size_t len, BN_CTX *ctx); + +/** Decodes a EC_POINT from a octet string + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param buf memory buffer with the encoded ec point + * \param len length of the encoded ec point + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +int EC_POINT_oct2point(const EC_GROUP *group, EC_POINT *p, + const unsigned char *buf, size_t len, BN_CTX *ctx); + +/** Encodes an EC_POINT object to an allocated octet string + * \param group underlying EC_GROUP object + * \param point EC_POINT object + * \param form point conversion form + * \param pbuf returns pointer to allocated buffer + * \param ctx BN_CTX object (optional) + * \return the length of the encoded octet string or 0 if an error occurred + */ +size_t EC_POINT_point2buf(const EC_GROUP *group, const EC_POINT *point, + point_conversion_form_t form, + unsigned char **pbuf, BN_CTX *ctx); + +/* other interfaces to point2oct/oct2point: */ +BIGNUM *EC_POINT_point2bn(const EC_GROUP *, const EC_POINT *, + point_conversion_form_t form, BIGNUM *, BN_CTX *); +EC_POINT *EC_POINT_bn2point(const EC_GROUP *, const BIGNUM *, + EC_POINT *, BN_CTX *); +char *EC_POINT_point2hex(const EC_GROUP *, const EC_POINT *, + point_conversion_form_t form, BN_CTX *); +EC_POINT *EC_POINT_hex2point(const EC_GROUP *, const char *, + EC_POINT *, BN_CTX *); + +/********************************************************************/ +/* functions for doing EC_POINT arithmetic */ +/********************************************************************/ + +/** Computes the sum of two EC_POINT + * \param group underlying EC_GROUP object + * \param r EC_POINT object for the result (r = a + b) + * \param a EC_POINT object with the first summand + * \param b EC_POINT object with the second summand + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +int EC_POINT_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, + const EC_POINT *b, BN_CTX *ctx); + +/** Computes the double of a EC_POINT + * \param group underlying EC_GROUP object + * \param r EC_POINT object for the result (r = 2 * a) + * \param a EC_POINT object + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +int EC_POINT_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, + BN_CTX *ctx); + +/** Computes the inverse of a EC_POINT + * \param group underlying EC_GROUP object + * \param a EC_POINT object to be inverted (it's used for the result as well) + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +int EC_POINT_invert(const EC_GROUP *group, EC_POINT *a, BN_CTX *ctx); + +/** Checks whether the point is the neutral element of the group + * \param group the underlying EC_GROUP object + * \param p EC_POINT object + * \return 1 if the point is the neutral element and 0 otherwise + */ +int EC_POINT_is_at_infinity(const EC_GROUP *group, const EC_POINT *p); + +/** Checks whether the point is on the curve + * \param group underlying EC_GROUP object + * \param point EC_POINT object to check + * \param ctx BN_CTX object (optional) + * \return 1 if the point is on the curve, 0 if not, or -1 on error + */ +int EC_POINT_is_on_curve(const EC_GROUP *group, const EC_POINT *point, + BN_CTX *ctx); + +/** Compares two EC_POINTs + * \param group underlying EC_GROUP object + * \param a first EC_POINT object + * \param b second EC_POINT object + * \param ctx BN_CTX object (optional) + * \return 1 if the points are not equal, 0 if they are, or -1 on error + */ +int EC_POINT_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b, + BN_CTX *ctx); + +int EC_POINT_make_affine(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx); +int EC_POINTs_make_affine(const EC_GROUP *group, size_t num, + EC_POINT *points[], BN_CTX *ctx); + +/** Computes r = generator * n + sum_{i=0}^{num-1} p[i] * m[i] + * \param group underlying EC_GROUP object + * \param r EC_POINT object for the result + * \param n BIGNUM with the multiplier for the group generator (optional) + * \param num number further summands + * \param p array of size num of EC_POINT objects + * \param m array of size num of BIGNUM objects + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *n, + size_t num, const EC_POINT *p[], const BIGNUM *m[], + BN_CTX *ctx); + +/** Computes r = generator * n + q * m + * \param group underlying EC_GROUP object + * \param r EC_POINT object for the result + * \param n BIGNUM with the multiplier for the group generator (optional) + * \param q EC_POINT object with the first factor of the second summand + * \param m BIGNUM with the second factor of the second summand + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +int EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *n, + const EC_POINT *q, const BIGNUM *m, BN_CTX *ctx); + +/** Stores multiples of generator for faster point multiplication + * \param group EC_GROUP object + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +int EC_GROUP_precompute_mult(EC_GROUP *group, BN_CTX *ctx); + +/** Reports whether a precomputation has been done + * \param group EC_GROUP object + * \return 1 if a pre-computation has been done and 0 otherwise + */ +int EC_GROUP_have_precompute_mult(const EC_GROUP *group); + +/********************************************************************/ +/* ASN1 stuff */ +/********************************************************************/ + +DECLARE_ASN1_ITEM(ECPKPARAMETERS) +DECLARE_ASN1_ALLOC_FUNCTIONS(ECPKPARAMETERS) +DECLARE_ASN1_ITEM(ECPARAMETERS) +DECLARE_ASN1_ALLOC_FUNCTIONS(ECPARAMETERS) + +/* + * EC_GROUP_get_basis_type() returns the NID of the basis type used to + * represent the field elements + */ +int EC_GROUP_get_basis_type(const EC_GROUP *); +# ifndef OPENSSL_NO_EC2M +int EC_GROUP_get_trinomial_basis(const EC_GROUP *, unsigned int *k); +int EC_GROUP_get_pentanomial_basis(const EC_GROUP *, unsigned int *k1, + unsigned int *k2, unsigned int *k3); +# endif + +# define OPENSSL_EC_EXPLICIT_CURVE 0x000 +# define OPENSSL_EC_NAMED_CURVE 0x001 + +EC_GROUP *d2i_ECPKParameters(EC_GROUP **, const unsigned char **in, long len); +int i2d_ECPKParameters(const EC_GROUP *, unsigned char **out); + +# define d2i_ECPKParameters_bio(bp,x) ASN1_d2i_bio_of(EC_GROUP,NULL,d2i_ECPKParameters,bp,x) +# define i2d_ECPKParameters_bio(bp,x) ASN1_i2d_bio_of_const(EC_GROUP,i2d_ECPKParameters,bp,x) +# define d2i_ECPKParameters_fp(fp,x) (EC_GROUP *)ASN1_d2i_fp(NULL, \ + (char *(*)())d2i_ECPKParameters,(fp),(unsigned char **)(x)) +# define i2d_ECPKParameters_fp(fp,x) ASN1_i2d_fp(i2d_ECPKParameters,(fp), \ + (unsigned char *)(x)) + +int ECPKParameters_print(BIO *bp, const EC_GROUP *x, int off); +# ifndef OPENSSL_NO_STDIO +int ECPKParameters_print_fp(FILE *fp, const EC_GROUP *x, int off); +# endif + +/********************************************************************/ +/* EC_KEY functions */ +/********************************************************************/ + +/* some values for the encoding_flag */ +# define EC_PKEY_NO_PARAMETERS 0x001 +# define EC_PKEY_NO_PUBKEY 0x002 + +/* some values for the flags field */ +# define EC_FLAG_NON_FIPS_ALLOW 0x1 +# define EC_FLAG_FIPS_CHECKED 0x2 +# define EC_FLAG_COFACTOR_ECDH 0x1000 + +/** Creates a new EC_KEY object. + * \return EC_KEY object or NULL if an error occurred. + */ +EC_KEY *EC_KEY_new(void); + +int EC_KEY_get_flags(const EC_KEY *key); + +void EC_KEY_set_flags(EC_KEY *key, int flags); + +void EC_KEY_clear_flags(EC_KEY *key, int flags); + +/** Creates a new EC_KEY object using a named curve as underlying + * EC_GROUP object. + * \param nid NID of the named curve. + * \return EC_KEY object or NULL if an error occurred. + */ +EC_KEY *EC_KEY_new_by_curve_name(int nid); + +/** Frees a EC_KEY object. + * \param key EC_KEY object to be freed. + */ +void EC_KEY_free(EC_KEY *key); + +/** Copies a EC_KEY object. + * \param dst destination EC_KEY object + * \param src src EC_KEY object + * \return dst or NULL if an error occurred. + */ +EC_KEY *EC_KEY_copy(EC_KEY *dst, const EC_KEY *src); + +/** Creates a new EC_KEY object and copies the content from src to it. + * \param src the source EC_KEY object + * \return newly created EC_KEY object or NULL if an error occurred. + */ +EC_KEY *EC_KEY_dup(const EC_KEY *src); + +/** Increases the internal reference count of a EC_KEY object. + * \param key EC_KEY object + * \return 1 on success and 0 if an error occurred. + */ +int EC_KEY_up_ref(EC_KEY *key); + +/** Returns the ENGINE object of a EC_KEY object + * \param eckey EC_KEY object + * \return the ENGINE object (possibly NULL). + */ +ENGINE *EC_KEY_get0_engine(const EC_KEY *eckey); + +/** Returns the EC_GROUP object of a EC_KEY object + * \param key EC_KEY object + * \return the EC_GROUP object (possibly NULL). + */ +const EC_GROUP *EC_KEY_get0_group(const EC_KEY *key); + +/** Sets the EC_GROUP of a EC_KEY object. + * \param key EC_KEY object + * \param group EC_GROUP to use in the EC_KEY object (note: the EC_KEY + * object will use an own copy of the EC_GROUP). + * \return 1 on success and 0 if an error occurred. + */ +int EC_KEY_set_group(EC_KEY *key, const EC_GROUP *group); + +/** Returns the private key of a EC_KEY object. + * \param key EC_KEY object + * \return a BIGNUM with the private key (possibly NULL). + */ +const BIGNUM *EC_KEY_get0_private_key(const EC_KEY *key); + +/** Sets the private key of a EC_KEY object. + * \param key EC_KEY object + * \param prv BIGNUM with the private key (note: the EC_KEY object + * will use an own copy of the BIGNUM). + * \return 1 on success and 0 if an error occurred. + */ +int EC_KEY_set_private_key(EC_KEY *key, const BIGNUM *prv); + +/** Returns the public key of a EC_KEY object. + * \param key the EC_KEY object + * \return a EC_POINT object with the public key (possibly NULL) + */ +const EC_POINT *EC_KEY_get0_public_key(const EC_KEY *key); + +/** Sets the public key of a EC_KEY object. + * \param key EC_KEY object + * \param pub EC_POINT object with the public key (note: the EC_KEY object + * will use an own copy of the EC_POINT object). + * \return 1 on success and 0 if an error occurred. + */ +int EC_KEY_set_public_key(EC_KEY *key, const EC_POINT *pub); + +unsigned EC_KEY_get_enc_flags(const EC_KEY *key); +void EC_KEY_set_enc_flags(EC_KEY *eckey, unsigned int flags); +point_conversion_form_t EC_KEY_get_conv_form(const EC_KEY *key); +void EC_KEY_set_conv_form(EC_KEY *eckey, point_conversion_form_t cform); + +#define EC_KEY_get_ex_new_index(l, p, newf, dupf, freef) \ + CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_EC_KEY, l, p, newf, dupf, freef) +int EC_KEY_set_ex_data(EC_KEY *key, int idx, void *arg); +void *EC_KEY_get_ex_data(const EC_KEY *key, int idx); + +/* wrapper functions for the underlying EC_GROUP object */ +void EC_KEY_set_asn1_flag(EC_KEY *eckey, int asn1_flag); + +/** Creates a table of pre-computed multiples of the generator to + * accelerate further EC_KEY operations. + * \param key EC_KEY object + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred. + */ +int EC_KEY_precompute_mult(EC_KEY *key, BN_CTX *ctx); + +/** Creates a new ec private (and optional a new public) key. + * \param key EC_KEY object + * \return 1 on success and 0 if an error occurred. + */ +int EC_KEY_generate_key(EC_KEY *key); + +/** Verifies that a private and/or public key is valid. + * \param key the EC_KEY object + * \return 1 on success and 0 otherwise. + */ +int EC_KEY_check_key(const EC_KEY *key); + +/** Indicates if an EC_KEY can be used for signing. + * \param eckey the EC_KEY object + * \return 1 if can can sign and 0 otherwise. + */ +int EC_KEY_can_sign(const EC_KEY *eckey); + +/** Sets a public key from affine coordinates performing + * necessary NIST PKV tests. + * \param key the EC_KEY object + * \param x public key x coordinate + * \param y public key y coordinate + * \return 1 on success and 0 otherwise. + */ +int EC_KEY_set_public_key_affine_coordinates(EC_KEY *key, BIGNUM *x, + BIGNUM *y); + +/** Encodes an EC_KEY public key to an allocated octet string + * \param key key to encode + * \param form point conversion form + * \param pbuf returns pointer to allocated buffer + * \param ctx BN_CTX object (optional) + * \return the length of the encoded octet string or 0 if an error occurred + */ +size_t EC_KEY_key2buf(const EC_KEY *key, point_conversion_form_t form, + unsigned char **pbuf, BN_CTX *ctx); + +/** Decodes a EC_KEY public key from a octet string + * \param key key to decode + * \param buf memory buffer with the encoded ec point + * \param len length of the encoded ec point + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ + +int EC_KEY_oct2key(EC_KEY *key, const unsigned char *buf, size_t len, + BN_CTX *ctx); + +/** Decodes an EC_KEY private key from an octet string + * \param key key to decode + * \param buf memory buffer with the encoded private key + * \param len length of the encoded key + * \return 1 on success and 0 if an error occurred + */ + +int EC_KEY_oct2priv(EC_KEY *key, const unsigned char *buf, size_t len); + +/** Encodes a EC_KEY private key to an octet string + * \param key key to encode + * \param buf memory buffer for the result. If NULL the function returns + * required buffer size. + * \param len length of the memory buffer + * \return the length of the encoded octet string or 0 if an error occurred + */ + +size_t EC_KEY_priv2oct(const EC_KEY *key, unsigned char *buf, size_t len); + +/** Encodes an EC_KEY private key to an allocated octet string + * \param eckey key to encode + * \param pbuf returns pointer to allocated buffer + * \return the length of the encoded octet string or 0 if an error occurred + */ +size_t EC_KEY_priv2buf(const EC_KEY *eckey, unsigned char **pbuf); + +/********************************************************************/ +/* de- and encoding functions for SEC1 ECPrivateKey */ +/********************************************************************/ + +/** Decodes a private key from a memory buffer. + * \param key a pointer to a EC_KEY object which should be used (or NULL) + * \param in pointer to memory with the DER encoded private key + * \param len length of the DER encoded private key + * \return the decoded private key or NULL if an error occurred. + */ +EC_KEY *d2i_ECPrivateKey(EC_KEY **key, const unsigned char **in, long len); + +/** Encodes a private key object and stores the result in a buffer. + * \param key the EC_KEY object to encode + * \param out the buffer for the result (if NULL the function returns number + * of bytes needed). + * \return 1 on success and 0 if an error occurred. + */ +int i2d_ECPrivateKey(EC_KEY *key, unsigned char **out); + +/********************************************************************/ +/* de- and encoding functions for EC parameters */ +/********************************************************************/ + +/** Decodes ec parameter from a memory buffer. + * \param key a pointer to a EC_KEY object which should be used (or NULL) + * \param in pointer to memory with the DER encoded ec parameters + * \param len length of the DER encoded ec parameters + * \return a EC_KEY object with the decoded parameters or NULL if an error + * occurred. + */ +EC_KEY *d2i_ECParameters(EC_KEY **key, const unsigned char **in, long len); + +/** Encodes ec parameter and stores the result in a buffer. + * \param key the EC_KEY object with ec parameters to encode + * \param out the buffer for the result (if NULL the function returns number + * of bytes needed). + * \return 1 on success and 0 if an error occurred. + */ +int i2d_ECParameters(EC_KEY *key, unsigned char **out); + +/********************************************************************/ +/* de- and encoding functions for EC public key */ +/* (octet string, not DER -- hence 'o2i' and 'i2o') */ +/********************************************************************/ + +/** Decodes a ec public key from a octet string. + * \param key a pointer to a EC_KEY object which should be used + * \param in memory buffer with the encoded public key + * \param len length of the encoded public key + * \return EC_KEY object with decoded public key or NULL if an error + * occurred. + */ +EC_KEY *o2i_ECPublicKey(EC_KEY **key, const unsigned char **in, long len); + +/** Encodes a ec public key in an octet string. + * \param key the EC_KEY object with the public key + * \param out the buffer for the result (if NULL the function returns number + * of bytes needed). + * \return 1 on success and 0 if an error occurred + */ +int i2o_ECPublicKey(const EC_KEY *key, unsigned char **out); + +/** Prints out the ec parameters on human readable form. + * \param bp BIO object to which the information is printed + * \param key EC_KEY object + * \return 1 on success and 0 if an error occurred + */ +int ECParameters_print(BIO *bp, const EC_KEY *key); + +/** Prints out the contents of a EC_KEY object + * \param bp BIO object to which the information is printed + * \param key EC_KEY object + * \param off line offset + * \return 1 on success and 0 if an error occurred + */ +int EC_KEY_print(BIO *bp, const EC_KEY *key, int off); + +# ifndef OPENSSL_NO_STDIO +/** Prints out the ec parameters on human readable form. + * \param fp file descriptor to which the information is printed + * \param key EC_KEY object + * \return 1 on success and 0 if an error occurred + */ +int ECParameters_print_fp(FILE *fp, const EC_KEY *key); + +/** Prints out the contents of a EC_KEY object + * \param fp file descriptor to which the information is printed + * \param key EC_KEY object + * \param off line offset + * \return 1 on success and 0 if an error occurred + */ +int EC_KEY_print_fp(FILE *fp, const EC_KEY *key, int off); + +# endif + +const EC_KEY_METHOD *EC_KEY_OpenSSL(void); +const EC_KEY_METHOD *EC_KEY_get_default_method(void); +void EC_KEY_set_default_method(const EC_KEY_METHOD *meth); +const EC_KEY_METHOD *EC_KEY_get_method(const EC_KEY *key); +int EC_KEY_set_method(EC_KEY *key, const EC_KEY_METHOD *meth); +EC_KEY *EC_KEY_new_method(ENGINE *engine); + +/** The old name for ecdh_KDF_X9_63 + * The ECDH KDF specification has been mistakingly attributed to ANSI X9.62, + * it is actually specified in ANSI X9.63. + * This identifier is retained for backwards compatibility + */ +int ECDH_KDF_X9_62(unsigned char *out, size_t outlen, + const unsigned char *Z, size_t Zlen, + const unsigned char *sinfo, size_t sinfolen, + const EVP_MD *md); + +int ECDH_compute_key(void *out, size_t outlen, const EC_POINT *pub_key, + const EC_KEY *ecdh, + void *(*KDF) (const void *in, size_t inlen, + void *out, size_t *outlen)); + +typedef struct ECDSA_SIG_st ECDSA_SIG; + +/** Allocates and initialize a ECDSA_SIG structure + * \return pointer to a ECDSA_SIG structure or NULL if an error occurred + */ +ECDSA_SIG *ECDSA_SIG_new(void); + +/** frees a ECDSA_SIG structure + * \param sig pointer to the ECDSA_SIG structure + */ +void ECDSA_SIG_free(ECDSA_SIG *sig); + +/** DER encode content of ECDSA_SIG object (note: this function modifies *pp + * (*pp += length of the DER encoded signature)). + * \param sig pointer to the ECDSA_SIG object + * \param pp pointer to a unsigned char pointer for the output or NULL + * \return the length of the DER encoded ECDSA_SIG object or a negative value + * on error + */ +int i2d_ECDSA_SIG(const ECDSA_SIG *sig, unsigned char **pp); + +/** Decodes a DER encoded ECDSA signature (note: this function changes *pp + * (*pp += len)). + * \param sig pointer to ECDSA_SIG pointer (may be NULL) + * \param pp memory buffer with the DER encoded signature + * \param len length of the buffer + * \return pointer to the decoded ECDSA_SIG structure (or NULL) + */ +ECDSA_SIG *d2i_ECDSA_SIG(ECDSA_SIG **sig, const unsigned char **pp, long len); + +/** Accessor for r and s fields of ECDSA_SIG + * \param sig pointer to ECDSA_SIG structure + * \param pr pointer to BIGNUM pointer for r (may be NULL) + * \param ps pointer to BIGNUM pointer for s (may be NULL) + */ +void ECDSA_SIG_get0(const ECDSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps); + +/** Accessor for r field of ECDSA_SIG + * \param sig pointer to ECDSA_SIG structure + */ +const BIGNUM *ECDSA_SIG_get0_r(const ECDSA_SIG *sig); + +/** Accessor for s field of ECDSA_SIG + * \param sig pointer to ECDSA_SIG structure + */ +const BIGNUM *ECDSA_SIG_get0_s(const ECDSA_SIG *sig); + +/** Setter for r and s fields of ECDSA_SIG + * \param sig pointer to ECDSA_SIG structure + * \param r pointer to BIGNUM for r (may be NULL) + * \param s pointer to BIGNUM for s (may be NULL) + */ +int ECDSA_SIG_set0(ECDSA_SIG *sig, BIGNUM *r, BIGNUM *s); + +/** Computes the ECDSA signature of the given hash value using + * the supplied private key and returns the created signature. + * \param dgst pointer to the hash value + * \param dgst_len length of the hash value + * \param eckey EC_KEY object containing a private EC key + * \return pointer to a ECDSA_SIG structure or NULL if an error occurred + */ +ECDSA_SIG *ECDSA_do_sign(const unsigned char *dgst, int dgst_len, + EC_KEY *eckey); + +/** Computes ECDSA signature of a given hash value using the supplied + * private key (note: sig must point to ECDSA_size(eckey) bytes of memory). + * \param dgst pointer to the hash value to sign + * \param dgstlen length of the hash value + * \param kinv BIGNUM with a pre-computed inverse k (optional) + * \param rp BIGNUM with a pre-computed rp value (optional), + * see ECDSA_sign_setup + * \param eckey EC_KEY object containing a private EC key + * \return pointer to a ECDSA_SIG structure or NULL if an error occurred + */ +ECDSA_SIG *ECDSA_do_sign_ex(const unsigned char *dgst, int dgstlen, + const BIGNUM *kinv, const BIGNUM *rp, + EC_KEY *eckey); + +/** Verifies that the supplied signature is a valid ECDSA + * signature of the supplied hash value using the supplied public key. + * \param dgst pointer to the hash value + * \param dgst_len length of the hash value + * \param sig ECDSA_SIG structure + * \param eckey EC_KEY object containing a public EC key + * \return 1 if the signature is valid, 0 if the signature is invalid + * and -1 on error + */ +int ECDSA_do_verify(const unsigned char *dgst, int dgst_len, + const ECDSA_SIG *sig, EC_KEY *eckey); + +/** Precompute parts of the signing operation + * \param eckey EC_KEY object containing a private EC key + * \param ctx BN_CTX object (optional) + * \param kinv BIGNUM pointer for the inverse of k + * \param rp BIGNUM pointer for x coordinate of k * generator + * \return 1 on success and 0 otherwise + */ +int ECDSA_sign_setup(EC_KEY *eckey, BN_CTX *ctx, BIGNUM **kinv, BIGNUM **rp); + +/** Computes ECDSA signature of a given hash value using the supplied + * private key (note: sig must point to ECDSA_size(eckey) bytes of memory). + * \param type this parameter is ignored + * \param dgst pointer to the hash value to sign + * \param dgstlen length of the hash value + * \param sig memory for the DER encoded created signature + * \param siglen pointer to the length of the returned signature + * \param eckey EC_KEY object containing a private EC key + * \return 1 on success and 0 otherwise + */ +int ECDSA_sign(int type, const unsigned char *dgst, int dgstlen, + unsigned char *sig, unsigned int *siglen, EC_KEY *eckey); + +/** Computes ECDSA signature of a given hash value using the supplied + * private key (note: sig must point to ECDSA_size(eckey) bytes of memory). + * \param type this parameter is ignored + * \param dgst pointer to the hash value to sign + * \param dgstlen length of the hash value + * \param sig buffer to hold the DER encoded signature + * \param siglen pointer to the length of the returned signature + * \param kinv BIGNUM with a pre-computed inverse k (optional) + * \param rp BIGNUM with a pre-computed rp value (optional), + * see ECDSA_sign_setup + * \param eckey EC_KEY object containing a private EC key + * \return 1 on success and 0 otherwise + */ +int ECDSA_sign_ex(int type, const unsigned char *dgst, int dgstlen, + unsigned char *sig, unsigned int *siglen, + const BIGNUM *kinv, const BIGNUM *rp, EC_KEY *eckey); + +/** Verifies that the given signature is valid ECDSA signature + * of the supplied hash value using the specified public key. + * \param type this parameter is ignored + * \param dgst pointer to the hash value + * \param dgstlen length of the hash value + * \param sig pointer to the DER encoded signature + * \param siglen length of the DER encoded signature + * \param eckey EC_KEY object containing a public EC key + * \return 1 if the signature is valid, 0 if the signature is invalid + * and -1 on error + */ +int ECDSA_verify(int type, const unsigned char *dgst, int dgstlen, + const unsigned char *sig, int siglen, EC_KEY *eckey); + +/** Returns the maximum length of the DER encoded signature + * \param eckey EC_KEY object + * \return numbers of bytes required for the DER encoded signature + */ +int ECDSA_size(const EC_KEY *eckey); + +/********************************************************************/ +/* EC_KEY_METHOD constructors, destructors, writers and accessors */ +/********************************************************************/ + +EC_KEY_METHOD *EC_KEY_METHOD_new(const EC_KEY_METHOD *meth); +void EC_KEY_METHOD_free(EC_KEY_METHOD *meth); +void EC_KEY_METHOD_set_init(EC_KEY_METHOD *meth, + int (*init)(EC_KEY *key), + void (*finish)(EC_KEY *key), + int (*copy)(EC_KEY *dest, const EC_KEY *src), + int (*set_group)(EC_KEY *key, const EC_GROUP *grp), + int (*set_private)(EC_KEY *key, + const BIGNUM *priv_key), + int (*set_public)(EC_KEY *key, + const EC_POINT *pub_key)); + +void EC_KEY_METHOD_set_keygen(EC_KEY_METHOD *meth, + int (*keygen)(EC_KEY *key)); + +void EC_KEY_METHOD_set_compute_key(EC_KEY_METHOD *meth, + int (*ckey)(unsigned char **psec, + size_t *pseclen, + const EC_POINT *pub_key, + const EC_KEY *ecdh)); + +void EC_KEY_METHOD_set_sign(EC_KEY_METHOD *meth, + int (*sign)(int type, const unsigned char *dgst, + int dlen, unsigned char *sig, + unsigned int *siglen, + const BIGNUM *kinv, const BIGNUM *r, + EC_KEY *eckey), + int (*sign_setup)(EC_KEY *eckey, BN_CTX *ctx_in, + BIGNUM **kinvp, BIGNUM **rp), + ECDSA_SIG *(*sign_sig)(const unsigned char *dgst, + int dgst_len, + const BIGNUM *in_kinv, + const BIGNUM *in_r, + EC_KEY *eckey)); + +void EC_KEY_METHOD_set_verify(EC_KEY_METHOD *meth, + int (*verify)(int type, const unsigned + char *dgst, int dgst_len, + const unsigned char *sigbuf, + int sig_len, EC_KEY *eckey), + int (*verify_sig)(const unsigned char *dgst, + int dgst_len, + const ECDSA_SIG *sig, + EC_KEY *eckey)); + +void EC_KEY_METHOD_get_init(const EC_KEY_METHOD *meth, + int (**pinit)(EC_KEY *key), + void (**pfinish)(EC_KEY *key), + int (**pcopy)(EC_KEY *dest, const EC_KEY *src), + int (**pset_group)(EC_KEY *key, + const EC_GROUP *grp), + int (**pset_private)(EC_KEY *key, + const BIGNUM *priv_key), + int (**pset_public)(EC_KEY *key, + const EC_POINT *pub_key)); + +void EC_KEY_METHOD_get_keygen(const EC_KEY_METHOD *meth, + int (**pkeygen)(EC_KEY *key)); + +void EC_KEY_METHOD_get_compute_key(const EC_KEY_METHOD *meth, + int (**pck)(unsigned char **psec, + size_t *pseclen, + const EC_POINT *pub_key, + const EC_KEY *ecdh)); + +void EC_KEY_METHOD_get_sign(const EC_KEY_METHOD *meth, + int (**psign)(int type, const unsigned char *dgst, + int dlen, unsigned char *sig, + unsigned int *siglen, + const BIGNUM *kinv, const BIGNUM *r, + EC_KEY *eckey), + int (**psign_setup)(EC_KEY *eckey, BN_CTX *ctx_in, + BIGNUM **kinvp, BIGNUM **rp), + ECDSA_SIG *(**psign_sig)(const unsigned char *dgst, + int dgst_len, + const BIGNUM *in_kinv, + const BIGNUM *in_r, + EC_KEY *eckey)); + +void EC_KEY_METHOD_get_verify(const EC_KEY_METHOD *meth, + int (**pverify)(int type, const unsigned + char *dgst, int dgst_len, + const unsigned char *sigbuf, + int sig_len, EC_KEY *eckey), + int (**pverify_sig)(const unsigned char *dgst, + int dgst_len, + const ECDSA_SIG *sig, + EC_KEY *eckey)); + +# define ECParameters_dup(x) ASN1_dup_of(EC_KEY,i2d_ECParameters,d2i_ECParameters,x) + +# ifndef __cplusplus +# if defined(__SUNPRO_C) +# if __SUNPRO_C >= 0x520 +# pragma error_messages (default,E_ARRAY_OF_INCOMPLETE_NONAME,E_ARRAY_OF_INCOMPLETE) +# endif +# endif +# endif + +# define EVP_PKEY_CTX_set_ec_paramgen_curve_nid(ctx, nid) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ + EVP_PKEY_OP_PARAMGEN|EVP_PKEY_OP_KEYGEN, \ + EVP_PKEY_CTRL_EC_PARAMGEN_CURVE_NID, nid, NULL) + +# define EVP_PKEY_CTX_set_ec_param_enc(ctx, flag) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ + EVP_PKEY_OP_PARAMGEN|EVP_PKEY_OP_KEYGEN, \ + EVP_PKEY_CTRL_EC_PARAM_ENC, flag, NULL) + +# define EVP_PKEY_CTX_set_ecdh_cofactor_mode(ctx, flag) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_EC_ECDH_COFACTOR, flag, NULL) + +# define EVP_PKEY_CTX_get_ecdh_cofactor_mode(ctx) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_EC_ECDH_COFACTOR, -2, NULL) + +# define EVP_PKEY_CTX_set_ecdh_kdf_type(ctx, kdf) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_EC_KDF_TYPE, kdf, NULL) + +# define EVP_PKEY_CTX_get_ecdh_kdf_type(ctx) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_EC_KDF_TYPE, -2, NULL) + +# define EVP_PKEY_CTX_set_ecdh_kdf_md(ctx, md) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_EC_KDF_MD, 0, (void *)(md)) + +# define EVP_PKEY_CTX_get_ecdh_kdf_md(ctx, pmd) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_GET_EC_KDF_MD, 0, (void *)(pmd)) + +# define EVP_PKEY_CTX_set_ecdh_kdf_outlen(ctx, len) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_EC_KDF_OUTLEN, len, NULL) + +# define EVP_PKEY_CTX_get_ecdh_kdf_outlen(ctx, plen) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_GET_EC_KDF_OUTLEN, 0, \ + (void *)(plen)) + +# define EVP_PKEY_CTX_set0_ecdh_kdf_ukm(ctx, p, plen) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_EC_KDF_UKM, plen, (void *)(p)) + +# define EVP_PKEY_CTX_get0_ecdh_kdf_ukm(ctx, p) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_GET_EC_KDF_UKM, 0, (void *)(p)) + +/* SM2 will skip the operation check so no need to pass operation here */ +# define EVP_PKEY_CTX_set1_id(ctx, id, id_len) \ + EVP_PKEY_CTX_ctrl(ctx, -1, -1, \ + EVP_PKEY_CTRL_SET1_ID, (int)id_len, (void*)(id)) + +# define EVP_PKEY_CTX_get1_id(ctx, id) \ + EVP_PKEY_CTX_ctrl(ctx, -1, -1, \ + EVP_PKEY_CTRL_GET1_ID, 0, (void*)(id)) + +# define EVP_PKEY_CTX_get1_id_len(ctx, id_len) \ + EVP_PKEY_CTX_ctrl(ctx, -1, -1, \ + EVP_PKEY_CTRL_GET1_ID_LEN, 0, (void*)(id_len)) + +# define EVP_PKEY_CTRL_EC_PARAMGEN_CURVE_NID (EVP_PKEY_ALG_CTRL + 1) +# define EVP_PKEY_CTRL_EC_PARAM_ENC (EVP_PKEY_ALG_CTRL + 2) +# define EVP_PKEY_CTRL_EC_ECDH_COFACTOR (EVP_PKEY_ALG_CTRL + 3) +# define EVP_PKEY_CTRL_EC_KDF_TYPE (EVP_PKEY_ALG_CTRL + 4) +# define EVP_PKEY_CTRL_EC_KDF_MD (EVP_PKEY_ALG_CTRL + 5) +# define EVP_PKEY_CTRL_GET_EC_KDF_MD (EVP_PKEY_ALG_CTRL + 6) +# define EVP_PKEY_CTRL_EC_KDF_OUTLEN (EVP_PKEY_ALG_CTRL + 7) +# define EVP_PKEY_CTRL_GET_EC_KDF_OUTLEN (EVP_PKEY_ALG_CTRL + 8) +# define EVP_PKEY_CTRL_EC_KDF_UKM (EVP_PKEY_ALG_CTRL + 9) +# define EVP_PKEY_CTRL_GET_EC_KDF_UKM (EVP_PKEY_ALG_CTRL + 10) +# define EVP_PKEY_CTRL_SET1_ID (EVP_PKEY_ALG_CTRL + 11) +# define EVP_PKEY_CTRL_GET1_ID (EVP_PKEY_ALG_CTRL + 12) +# define EVP_PKEY_CTRL_GET1_ID_LEN (EVP_PKEY_ALG_CTRL + 13) +/* KDF types */ +# define EVP_PKEY_ECDH_KDF_NONE 1 +# define EVP_PKEY_ECDH_KDF_X9_63 2 +/** The old name for EVP_PKEY_ECDH_KDF_X9_63 + * The ECDH KDF specification has been mistakingly attributed to ANSI X9.62, + * it is actually specified in ANSI X9.63. + * This identifier is retained for backwards compatibility + */ +# define EVP_PKEY_ECDH_KDF_X9_62 EVP_PKEY_ECDH_KDF_X9_63 + + +# ifdef __cplusplus +} +# endif +# endif +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/ecdh.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/ecdh.h new file mode 100644 index 0000000..681f3d5 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/ecdh.h @@ -0,0 +1,10 @@ +/* + * Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#include diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/ecdsa.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/ecdsa.h new file mode 100644 index 0000000..681f3d5 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/ecdsa.h @@ -0,0 +1,10 @@ +/* + * Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#include diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/ecerr.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/ecerr.h new file mode 100644 index 0000000..f7b9183 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/ecerr.h @@ -0,0 +1,275 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_ECERR_H +# define HEADER_ECERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# include + +# ifndef OPENSSL_NO_EC + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_EC_strings(void); + +/* + * EC function codes. + */ +# define EC_F_BN_TO_FELEM 224 +# define EC_F_D2I_ECPARAMETERS 144 +# define EC_F_D2I_ECPKPARAMETERS 145 +# define EC_F_D2I_ECPRIVATEKEY 146 +# define EC_F_DO_EC_KEY_PRINT 221 +# define EC_F_ECDH_CMS_DECRYPT 238 +# define EC_F_ECDH_CMS_SET_SHARED_INFO 239 +# define EC_F_ECDH_COMPUTE_KEY 246 +# define EC_F_ECDH_SIMPLE_COMPUTE_KEY 257 +# define EC_F_ECDSA_DO_SIGN_EX 251 +# define EC_F_ECDSA_DO_VERIFY 252 +# define EC_F_ECDSA_SIGN_EX 254 +# define EC_F_ECDSA_SIGN_SETUP 248 +# define EC_F_ECDSA_SIG_NEW 265 +# define EC_F_ECDSA_VERIFY 253 +# define EC_F_ECD_ITEM_VERIFY 270 +# define EC_F_ECKEY_PARAM2TYPE 223 +# define EC_F_ECKEY_PARAM_DECODE 212 +# define EC_F_ECKEY_PRIV_DECODE 213 +# define EC_F_ECKEY_PRIV_ENCODE 214 +# define EC_F_ECKEY_PUB_DECODE 215 +# define EC_F_ECKEY_PUB_ENCODE 216 +# define EC_F_ECKEY_TYPE2PARAM 220 +# define EC_F_ECPARAMETERS_PRINT 147 +# define EC_F_ECPARAMETERS_PRINT_FP 148 +# define EC_F_ECPKPARAMETERS_PRINT 149 +# define EC_F_ECPKPARAMETERS_PRINT_FP 150 +# define EC_F_ECP_NISTZ256_GET_AFFINE 240 +# define EC_F_ECP_NISTZ256_INV_MOD_ORD 275 +# define EC_F_ECP_NISTZ256_MULT_PRECOMPUTE 243 +# define EC_F_ECP_NISTZ256_POINTS_MUL 241 +# define EC_F_ECP_NISTZ256_PRE_COMP_NEW 244 +# define EC_F_ECP_NISTZ256_WINDOWED_MUL 242 +# define EC_F_ECX_KEY_OP 266 +# define EC_F_ECX_PRIV_ENCODE 267 +# define EC_F_ECX_PUB_ENCODE 268 +# define EC_F_EC_ASN1_GROUP2CURVE 153 +# define EC_F_EC_ASN1_GROUP2FIELDID 154 +# define EC_F_EC_GF2M_MONTGOMERY_POINT_MULTIPLY 208 +# define EC_F_EC_GF2M_SIMPLE_FIELD_INV 296 +# define EC_F_EC_GF2M_SIMPLE_GROUP_CHECK_DISCRIMINANT 159 +# define EC_F_EC_GF2M_SIMPLE_GROUP_SET_CURVE 195 +# define EC_F_EC_GF2M_SIMPLE_LADDER_POST 285 +# define EC_F_EC_GF2M_SIMPLE_LADDER_PRE 288 +# define EC_F_EC_GF2M_SIMPLE_OCT2POINT 160 +# define EC_F_EC_GF2M_SIMPLE_POINT2OCT 161 +# define EC_F_EC_GF2M_SIMPLE_POINTS_MUL 289 +# define EC_F_EC_GF2M_SIMPLE_POINT_GET_AFFINE_COORDINATES 162 +# define EC_F_EC_GF2M_SIMPLE_POINT_SET_AFFINE_COORDINATES 163 +# define EC_F_EC_GF2M_SIMPLE_SET_COMPRESSED_COORDINATES 164 +# define EC_F_EC_GFP_MONT_FIELD_DECODE 133 +# define EC_F_EC_GFP_MONT_FIELD_ENCODE 134 +# define EC_F_EC_GFP_MONT_FIELD_INV 297 +# define EC_F_EC_GFP_MONT_FIELD_MUL 131 +# define EC_F_EC_GFP_MONT_FIELD_SET_TO_ONE 209 +# define EC_F_EC_GFP_MONT_FIELD_SQR 132 +# define EC_F_EC_GFP_MONT_GROUP_SET_CURVE 189 +# define EC_F_EC_GFP_NISTP224_GROUP_SET_CURVE 225 +# define EC_F_EC_GFP_NISTP224_POINTS_MUL 228 +# define EC_F_EC_GFP_NISTP224_POINT_GET_AFFINE_COORDINATES 226 +# define EC_F_EC_GFP_NISTP256_GROUP_SET_CURVE 230 +# define EC_F_EC_GFP_NISTP256_POINTS_MUL 231 +# define EC_F_EC_GFP_NISTP256_POINT_GET_AFFINE_COORDINATES 232 +# define EC_F_EC_GFP_NISTP521_GROUP_SET_CURVE 233 +# define EC_F_EC_GFP_NISTP521_POINTS_MUL 234 +# define EC_F_EC_GFP_NISTP521_POINT_GET_AFFINE_COORDINATES 235 +# define EC_F_EC_GFP_NIST_FIELD_MUL 200 +# define EC_F_EC_GFP_NIST_FIELD_SQR 201 +# define EC_F_EC_GFP_NIST_GROUP_SET_CURVE 202 +# define EC_F_EC_GFP_SIMPLE_BLIND_COORDINATES 287 +# define EC_F_EC_GFP_SIMPLE_FIELD_INV 298 +# define EC_F_EC_GFP_SIMPLE_GROUP_CHECK_DISCRIMINANT 165 +# define EC_F_EC_GFP_SIMPLE_GROUP_SET_CURVE 166 +# define EC_F_EC_GFP_SIMPLE_MAKE_AFFINE 102 +# define EC_F_EC_GFP_SIMPLE_OCT2POINT 103 +# define EC_F_EC_GFP_SIMPLE_POINT2OCT 104 +# define EC_F_EC_GFP_SIMPLE_POINTS_MAKE_AFFINE 137 +# define EC_F_EC_GFP_SIMPLE_POINT_GET_AFFINE_COORDINATES 167 +# define EC_F_EC_GFP_SIMPLE_POINT_SET_AFFINE_COORDINATES 168 +# define EC_F_EC_GFP_SIMPLE_SET_COMPRESSED_COORDINATES 169 +# define EC_F_EC_GROUP_CHECK 170 +# define EC_F_EC_GROUP_CHECK_DISCRIMINANT 171 +# define EC_F_EC_GROUP_COPY 106 +# define EC_F_EC_GROUP_GET_CURVE 291 +# define EC_F_EC_GROUP_GET_CURVE_GF2M 172 +# define EC_F_EC_GROUP_GET_CURVE_GFP 130 +# define EC_F_EC_GROUP_GET_DEGREE 173 +# define EC_F_EC_GROUP_GET_ECPARAMETERS 261 +# define EC_F_EC_GROUP_GET_ECPKPARAMETERS 262 +# define EC_F_EC_GROUP_GET_PENTANOMIAL_BASIS 193 +# define EC_F_EC_GROUP_GET_TRINOMIAL_BASIS 194 +# define EC_F_EC_GROUP_NEW 108 +# define EC_F_EC_GROUP_NEW_BY_CURVE_NAME 174 +# define EC_F_EC_GROUP_NEW_FROM_DATA 175 +# define EC_F_EC_GROUP_NEW_FROM_ECPARAMETERS 263 +# define EC_F_EC_GROUP_NEW_FROM_ECPKPARAMETERS 264 +# define EC_F_EC_GROUP_SET_CURVE 292 +# define EC_F_EC_GROUP_SET_CURVE_GF2M 176 +# define EC_F_EC_GROUP_SET_CURVE_GFP 109 +# define EC_F_EC_GROUP_SET_GENERATOR 111 +# define EC_F_EC_GROUP_SET_SEED 286 +# define EC_F_EC_KEY_CHECK_KEY 177 +# define EC_F_EC_KEY_COPY 178 +# define EC_F_EC_KEY_GENERATE_KEY 179 +# define EC_F_EC_KEY_NEW 182 +# define EC_F_EC_KEY_NEW_METHOD 245 +# define EC_F_EC_KEY_OCT2PRIV 255 +# define EC_F_EC_KEY_PRINT 180 +# define EC_F_EC_KEY_PRINT_FP 181 +# define EC_F_EC_KEY_PRIV2BUF 279 +# define EC_F_EC_KEY_PRIV2OCT 256 +# define EC_F_EC_KEY_SET_PUBLIC_KEY_AFFINE_COORDINATES 229 +# define EC_F_EC_KEY_SIMPLE_CHECK_KEY 258 +# define EC_F_EC_KEY_SIMPLE_OCT2PRIV 259 +# define EC_F_EC_KEY_SIMPLE_PRIV2OCT 260 +# define EC_F_EC_PKEY_CHECK 273 +# define EC_F_EC_PKEY_PARAM_CHECK 274 +# define EC_F_EC_POINTS_MAKE_AFFINE 136 +# define EC_F_EC_POINTS_MUL 290 +# define EC_F_EC_POINT_ADD 112 +# define EC_F_EC_POINT_BN2POINT 280 +# define EC_F_EC_POINT_CMP 113 +# define EC_F_EC_POINT_COPY 114 +# define EC_F_EC_POINT_DBL 115 +# define EC_F_EC_POINT_GET_AFFINE_COORDINATES 293 +# define EC_F_EC_POINT_GET_AFFINE_COORDINATES_GF2M 183 +# define EC_F_EC_POINT_GET_AFFINE_COORDINATES_GFP 116 +# define EC_F_EC_POINT_GET_JPROJECTIVE_COORDINATES_GFP 117 +# define EC_F_EC_POINT_INVERT 210 +# define EC_F_EC_POINT_IS_AT_INFINITY 118 +# define EC_F_EC_POINT_IS_ON_CURVE 119 +# define EC_F_EC_POINT_MAKE_AFFINE 120 +# define EC_F_EC_POINT_NEW 121 +# define EC_F_EC_POINT_OCT2POINT 122 +# define EC_F_EC_POINT_POINT2BUF 281 +# define EC_F_EC_POINT_POINT2OCT 123 +# define EC_F_EC_POINT_SET_AFFINE_COORDINATES 294 +# define EC_F_EC_POINT_SET_AFFINE_COORDINATES_GF2M 185 +# define EC_F_EC_POINT_SET_AFFINE_COORDINATES_GFP 124 +# define EC_F_EC_POINT_SET_COMPRESSED_COORDINATES 295 +# define EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GF2M 186 +# define EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GFP 125 +# define EC_F_EC_POINT_SET_JPROJECTIVE_COORDINATES_GFP 126 +# define EC_F_EC_POINT_SET_TO_INFINITY 127 +# define EC_F_EC_PRE_COMP_NEW 196 +# define EC_F_EC_SCALAR_MUL_LADDER 284 +# define EC_F_EC_WNAF_MUL 187 +# define EC_F_EC_WNAF_PRECOMPUTE_MULT 188 +# define EC_F_I2D_ECPARAMETERS 190 +# define EC_F_I2D_ECPKPARAMETERS 191 +# define EC_F_I2D_ECPRIVATEKEY 192 +# define EC_F_I2O_ECPUBLICKEY 151 +# define EC_F_NISTP224_PRE_COMP_NEW 227 +# define EC_F_NISTP256_PRE_COMP_NEW 236 +# define EC_F_NISTP521_PRE_COMP_NEW 237 +# define EC_F_O2I_ECPUBLICKEY 152 +# define EC_F_OLD_EC_PRIV_DECODE 222 +# define EC_F_OSSL_ECDH_COMPUTE_KEY 247 +# define EC_F_OSSL_ECDSA_SIGN_SIG 249 +# define EC_F_OSSL_ECDSA_VERIFY_SIG 250 +# define EC_F_PKEY_ECD_CTRL 271 +# define EC_F_PKEY_ECD_DIGESTSIGN 272 +# define EC_F_PKEY_ECD_DIGESTSIGN25519 276 +# define EC_F_PKEY_ECD_DIGESTSIGN448 277 +# define EC_F_PKEY_ECX_DERIVE 269 +# define EC_F_PKEY_EC_CTRL 197 +# define EC_F_PKEY_EC_CTRL_STR 198 +# define EC_F_PKEY_EC_DERIVE 217 +# define EC_F_PKEY_EC_INIT 282 +# define EC_F_PKEY_EC_KDF_DERIVE 283 +# define EC_F_PKEY_EC_KEYGEN 199 +# define EC_F_PKEY_EC_PARAMGEN 219 +# define EC_F_PKEY_EC_SIGN 218 +# define EC_F_VALIDATE_ECX_DERIVE 278 + +/* + * EC reason codes. + */ +# define EC_R_ASN1_ERROR 115 +# define EC_R_BAD_SIGNATURE 156 +# define EC_R_BIGNUM_OUT_OF_RANGE 144 +# define EC_R_BUFFER_TOO_SMALL 100 +# define EC_R_CANNOT_INVERT 165 +# define EC_R_COORDINATES_OUT_OF_RANGE 146 +# define EC_R_CURVE_DOES_NOT_SUPPORT_ECDH 160 +# define EC_R_CURVE_DOES_NOT_SUPPORT_SIGNING 159 +# define EC_R_D2I_ECPKPARAMETERS_FAILURE 117 +# define EC_R_DECODE_ERROR 142 +# define EC_R_DISCRIMINANT_IS_ZERO 118 +# define EC_R_EC_GROUP_NEW_BY_NAME_FAILURE 119 +# define EC_R_FIELD_TOO_LARGE 143 +# define EC_R_GF2M_NOT_SUPPORTED 147 +# define EC_R_GROUP2PKPARAMETERS_FAILURE 120 +# define EC_R_I2D_ECPKPARAMETERS_FAILURE 121 +# define EC_R_INCOMPATIBLE_OBJECTS 101 +# define EC_R_INVALID_ARGUMENT 112 +# define EC_R_INVALID_COMPRESSED_POINT 110 +# define EC_R_INVALID_COMPRESSION_BIT 109 +# define EC_R_INVALID_CURVE 141 +# define EC_R_INVALID_DIGEST 151 +# define EC_R_INVALID_DIGEST_TYPE 138 +# define EC_R_INVALID_ENCODING 102 +# define EC_R_INVALID_FIELD 103 +# define EC_R_INVALID_FORM 104 +# define EC_R_INVALID_GROUP_ORDER 122 +# define EC_R_INVALID_KEY 116 +# define EC_R_INVALID_OUTPUT_LENGTH 161 +# define EC_R_INVALID_PEER_KEY 133 +# define EC_R_INVALID_PENTANOMIAL_BASIS 132 +# define EC_R_INVALID_PRIVATE_KEY 123 +# define EC_R_INVALID_TRINOMIAL_BASIS 137 +# define EC_R_KDF_PARAMETER_ERROR 148 +# define EC_R_KEYS_NOT_SET 140 +# define EC_R_LADDER_POST_FAILURE 136 +# define EC_R_LADDER_PRE_FAILURE 153 +# define EC_R_LADDER_STEP_FAILURE 162 +# define EC_R_MISSING_PARAMETERS 124 +# define EC_R_MISSING_PRIVATE_KEY 125 +# define EC_R_NEED_NEW_SETUP_VALUES 157 +# define EC_R_NOT_A_NIST_PRIME 135 +# define EC_R_NOT_IMPLEMENTED 126 +# define EC_R_NOT_INITIALIZED 111 +# define EC_R_NO_PARAMETERS_SET 139 +# define EC_R_NO_PRIVATE_VALUE 154 +# define EC_R_OPERATION_NOT_SUPPORTED 152 +# define EC_R_PASSED_NULL_PARAMETER 134 +# define EC_R_PEER_KEY_ERROR 149 +# define EC_R_PKPARAMETERS2GROUP_FAILURE 127 +# define EC_R_POINT_ARITHMETIC_FAILURE 155 +# define EC_R_POINT_AT_INFINITY 106 +# define EC_R_POINT_COORDINATES_BLIND_FAILURE 163 +# define EC_R_POINT_IS_NOT_ON_CURVE 107 +# define EC_R_RANDOM_NUMBER_GENERATION_FAILED 158 +# define EC_R_SHARED_INFO_ERROR 150 +# define EC_R_SLOT_FULL 108 +# define EC_R_UNDEFINED_GENERATOR 113 +# define EC_R_UNDEFINED_ORDER 128 +# define EC_R_UNKNOWN_COFACTOR 164 +# define EC_R_UNKNOWN_GROUP 129 +# define EC_R_UNKNOWN_ORDER 114 +# define EC_R_UNSUPPORTED_FIELD 131 +# define EC_R_WRONG_CURVE_PARAMETERS 145 +# define EC_R_WRONG_ORDER 130 + +# endif +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/engine.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/engine.h new file mode 100644 index 0000000..0780f0f --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/engine.h @@ -0,0 +1,751 @@ +/* + * Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved. + * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_ENGINE_H +# define HEADER_ENGINE_H + +# include + +# ifndef OPENSSL_NO_ENGINE +# if OPENSSL_API_COMPAT < 0x10100000L +# include +# include +# include +# include +# include +# include +# include +# include +# endif +# include +# include +# include +# include +# ifdef __cplusplus +extern "C" { +# endif + +/* + * These flags are used to control combinations of algorithm (methods) by + * bitwise "OR"ing. + */ +# define ENGINE_METHOD_RSA (unsigned int)0x0001 +# define ENGINE_METHOD_DSA (unsigned int)0x0002 +# define ENGINE_METHOD_DH (unsigned int)0x0004 +# define ENGINE_METHOD_RAND (unsigned int)0x0008 +# define ENGINE_METHOD_CIPHERS (unsigned int)0x0040 +# define ENGINE_METHOD_DIGESTS (unsigned int)0x0080 +# define ENGINE_METHOD_PKEY_METHS (unsigned int)0x0200 +# define ENGINE_METHOD_PKEY_ASN1_METHS (unsigned int)0x0400 +# define ENGINE_METHOD_EC (unsigned int)0x0800 +/* Obvious all-or-nothing cases. */ +# define ENGINE_METHOD_ALL (unsigned int)0xFFFF +# define ENGINE_METHOD_NONE (unsigned int)0x0000 + +/* + * This(ese) flag(s) controls behaviour of the ENGINE_TABLE mechanism used + * internally to control registration of ENGINE implementations, and can be + * set by ENGINE_set_table_flags(). The "NOINIT" flag prevents attempts to + * initialise registered ENGINEs if they are not already initialised. + */ +# define ENGINE_TABLE_FLAG_NOINIT (unsigned int)0x0001 + +/* ENGINE flags that can be set by ENGINE_set_flags(). */ +/* Not used */ +/* #define ENGINE_FLAGS_MALLOCED 0x0001 */ + +/* + * This flag is for ENGINEs that wish to handle the various 'CMD'-related + * control commands on their own. Without this flag, ENGINE_ctrl() handles + * these control commands on behalf of the ENGINE using their "cmd_defns" + * data. + */ +# define ENGINE_FLAGS_MANUAL_CMD_CTRL (int)0x0002 + +/* + * This flag is for ENGINEs who return new duplicate structures when found + * via "ENGINE_by_id()". When an ENGINE must store state (eg. if + * ENGINE_ctrl() commands are called in sequence as part of some stateful + * process like key-generation setup and execution), it can set this flag - + * then each attempt to obtain the ENGINE will result in it being copied into + * a new structure. Normally, ENGINEs don't declare this flag so + * ENGINE_by_id() just increments the existing ENGINE's structural reference + * count. + */ +# define ENGINE_FLAGS_BY_ID_COPY (int)0x0004 + +/* + * This flag if for an ENGINE that does not want its methods registered as + * part of ENGINE_register_all_complete() for example if the methods are not + * usable as default methods. + */ + +# define ENGINE_FLAGS_NO_REGISTER_ALL (int)0x0008 + +/* + * ENGINEs can support their own command types, and these flags are used in + * ENGINE_CTRL_GET_CMD_FLAGS to indicate to the caller what kind of input + * each command expects. Currently only numeric and string input is + * supported. If a control command supports none of the _NUMERIC, _STRING, or + * _NO_INPUT options, then it is regarded as an "internal" control command - + * and not for use in config setting situations. As such, they're not + * available to the ENGINE_ctrl_cmd_string() function, only raw ENGINE_ctrl() + * access. Changes to this list of 'command types' should be reflected + * carefully in ENGINE_cmd_is_executable() and ENGINE_ctrl_cmd_string(). + */ + +/* accepts a 'long' input value (3rd parameter to ENGINE_ctrl) */ +# define ENGINE_CMD_FLAG_NUMERIC (unsigned int)0x0001 +/* + * accepts string input (cast from 'void*' to 'const char *', 4th parameter + * to ENGINE_ctrl) + */ +# define ENGINE_CMD_FLAG_STRING (unsigned int)0x0002 +/* + * Indicates that the control command takes *no* input. Ie. the control + * command is unparameterised. + */ +# define ENGINE_CMD_FLAG_NO_INPUT (unsigned int)0x0004 +/* + * Indicates that the control command is internal. This control command won't + * be shown in any output, and is only usable through the ENGINE_ctrl_cmd() + * function. + */ +# define ENGINE_CMD_FLAG_INTERNAL (unsigned int)0x0008 + +/* + * NB: These 3 control commands are deprecated and should not be used. + * ENGINEs relying on these commands should compile conditional support for + * compatibility (eg. if these symbols are defined) but should also migrate + * the same functionality to their own ENGINE-specific control functions that + * can be "discovered" by calling applications. The fact these control + * commands wouldn't be "executable" (ie. usable by text-based config) + * doesn't change the fact that application code can find and use them + * without requiring per-ENGINE hacking. + */ + +/* + * These flags are used to tell the ctrl function what should be done. All + * command numbers are shared between all engines, even if some don't make + * sense to some engines. In such a case, they do nothing but return the + * error ENGINE_R_CTRL_COMMAND_NOT_IMPLEMENTED. + */ +# define ENGINE_CTRL_SET_LOGSTREAM 1 +# define ENGINE_CTRL_SET_PASSWORD_CALLBACK 2 +# define ENGINE_CTRL_HUP 3/* Close and reinitialise + * any handles/connections + * etc. */ +# define ENGINE_CTRL_SET_USER_INTERFACE 4/* Alternative to callback */ +# define ENGINE_CTRL_SET_CALLBACK_DATA 5/* User-specific data, used + * when calling the password + * callback and the user + * interface */ +# define ENGINE_CTRL_LOAD_CONFIGURATION 6/* Load a configuration, + * given a string that + * represents a file name + * or so */ +# define ENGINE_CTRL_LOAD_SECTION 7/* Load data from a given + * section in the already + * loaded configuration */ + +/* + * These control commands allow an application to deal with an arbitrary + * engine in a dynamic way. Warn: Negative return values indicate errors FOR + * THESE COMMANDS because zero is used to indicate 'end-of-list'. Other + * commands, including ENGINE-specific command types, return zero for an + * error. An ENGINE can choose to implement these ctrl functions, and can + * internally manage things however it chooses - it does so by setting the + * ENGINE_FLAGS_MANUAL_CMD_CTRL flag (using ENGINE_set_flags()). Otherwise + * the ENGINE_ctrl() code handles this on the ENGINE's behalf using the + * cmd_defns data (set using ENGINE_set_cmd_defns()). This means an ENGINE's + * ctrl() handler need only implement its own commands - the above "meta" + * commands will be taken care of. + */ + +/* + * Returns non-zero if the supplied ENGINE has a ctrl() handler. If "not", + * then all the remaining control commands will return failure, so it is + * worth checking this first if the caller is trying to "discover" the + * engine's capabilities and doesn't want errors generated unnecessarily. + */ +# define ENGINE_CTRL_HAS_CTRL_FUNCTION 10 +/* + * Returns a positive command number for the first command supported by the + * engine. Returns zero if no ctrl commands are supported. + */ +# define ENGINE_CTRL_GET_FIRST_CMD_TYPE 11 +/* + * The 'long' argument specifies a command implemented by the engine, and the + * return value is the next command supported, or zero if there are no more. + */ +# define ENGINE_CTRL_GET_NEXT_CMD_TYPE 12 +/* + * The 'void*' argument is a command name (cast from 'const char *'), and the + * return value is the command that corresponds to it. + */ +# define ENGINE_CTRL_GET_CMD_FROM_NAME 13 +/* + * The next two allow a command to be converted into its corresponding string + * form. In each case, the 'long' argument supplies the command. In the + * NAME_LEN case, the return value is the length of the command name (not + * counting a trailing EOL). In the NAME case, the 'void*' argument must be a + * string buffer large enough, and it will be populated with the name of the + * command (WITH a trailing EOL). + */ +# define ENGINE_CTRL_GET_NAME_LEN_FROM_CMD 14 +# define ENGINE_CTRL_GET_NAME_FROM_CMD 15 +/* The next two are similar but give a "short description" of a command. */ +# define ENGINE_CTRL_GET_DESC_LEN_FROM_CMD 16 +# define ENGINE_CTRL_GET_DESC_FROM_CMD 17 +/* + * With this command, the return value is the OR'd combination of + * ENGINE_CMD_FLAG_*** values that indicate what kind of input a given + * engine-specific ctrl command expects. + */ +# define ENGINE_CTRL_GET_CMD_FLAGS 18 + +/* + * ENGINE implementations should start the numbering of their own control + * commands from this value. (ie. ENGINE_CMD_BASE, ENGINE_CMD_BASE + 1, etc). + */ +# define ENGINE_CMD_BASE 200 + +/* + * NB: These 2 nCipher "chil" control commands are deprecated, and their + * functionality is now available through ENGINE-specific control commands + * (exposed through the above-mentioned 'CMD'-handling). Code using these 2 + * commands should be migrated to the more general command handling before + * these are removed. + */ + +/* Flags specific to the nCipher "chil" engine */ +# define ENGINE_CTRL_CHIL_SET_FORKCHECK 100 + /* + * Depending on the value of the (long)i argument, this sets or + * unsets the SimpleForkCheck flag in the CHIL API to enable or + * disable checking and workarounds for applications that fork(). + */ +# define ENGINE_CTRL_CHIL_NO_LOCKING 101 + /* + * This prevents the initialisation function from providing mutex + * callbacks to the nCipher library. + */ + +/* + * If an ENGINE supports its own specific control commands and wishes the + * framework to handle the above 'ENGINE_CMD_***'-manipulation commands on + * its behalf, it should supply a null-terminated array of ENGINE_CMD_DEFN + * entries to ENGINE_set_cmd_defns(). It should also implement a ctrl() + * handler that supports the stated commands (ie. the "cmd_num" entries as + * described by the array). NB: The array must be ordered in increasing order + * of cmd_num. "null-terminated" means that the last ENGINE_CMD_DEFN element + * has cmd_num set to zero and/or cmd_name set to NULL. + */ +typedef struct ENGINE_CMD_DEFN_st { + unsigned int cmd_num; /* The command number */ + const char *cmd_name; /* The command name itself */ + const char *cmd_desc; /* A short description of the command */ + unsigned int cmd_flags; /* The input the command expects */ +} ENGINE_CMD_DEFN; + +/* Generic function pointer */ +typedef int (*ENGINE_GEN_FUNC_PTR) (void); +/* Generic function pointer taking no arguments */ +typedef int (*ENGINE_GEN_INT_FUNC_PTR) (ENGINE *); +/* Specific control function pointer */ +typedef int (*ENGINE_CTRL_FUNC_PTR) (ENGINE *, int, long, void *, + void (*f) (void)); +/* Generic load_key function pointer */ +typedef EVP_PKEY *(*ENGINE_LOAD_KEY_PTR)(ENGINE *, const char *, + UI_METHOD *ui_method, + void *callback_data); +typedef int (*ENGINE_SSL_CLIENT_CERT_PTR) (ENGINE *, SSL *ssl, + STACK_OF(X509_NAME) *ca_dn, + X509 **pcert, EVP_PKEY **pkey, + STACK_OF(X509) **pother, + UI_METHOD *ui_method, + void *callback_data); +/*- + * These callback types are for an ENGINE's handler for cipher and digest logic. + * These handlers have these prototypes; + * int foo(ENGINE *e, const EVP_CIPHER **cipher, const int **nids, int nid); + * int foo(ENGINE *e, const EVP_MD **digest, const int **nids, int nid); + * Looking at how to implement these handlers in the case of cipher support, if + * the framework wants the EVP_CIPHER for 'nid', it will call; + * foo(e, &p_evp_cipher, NULL, nid); (return zero for failure) + * If the framework wants a list of supported 'nid's, it will call; + * foo(e, NULL, &p_nids, 0); (returns number of 'nids' or -1 for error) + */ +/* + * Returns to a pointer to the array of supported cipher 'nid's. If the + * second parameter is non-NULL it is set to the size of the returned array. + */ +typedef int (*ENGINE_CIPHERS_PTR) (ENGINE *, const EVP_CIPHER **, + const int **, int); +typedef int (*ENGINE_DIGESTS_PTR) (ENGINE *, const EVP_MD **, const int **, + int); +typedef int (*ENGINE_PKEY_METHS_PTR) (ENGINE *, EVP_PKEY_METHOD **, + const int **, int); +typedef int (*ENGINE_PKEY_ASN1_METHS_PTR) (ENGINE *, EVP_PKEY_ASN1_METHOD **, + const int **, int); +/* + * STRUCTURE functions ... all of these functions deal with pointers to + * ENGINE structures where the pointers have a "structural reference". This + * means that their reference is to allowed access to the structure but it + * does not imply that the structure is functional. To simply increment or + * decrement the structural reference count, use ENGINE_by_id and + * ENGINE_free. NB: This is not required when iterating using ENGINE_get_next + * as it will automatically decrement the structural reference count of the + * "current" ENGINE and increment the structural reference count of the + * ENGINE it returns (unless it is NULL). + */ + +/* Get the first/last "ENGINE" type available. */ +ENGINE *ENGINE_get_first(void); +ENGINE *ENGINE_get_last(void); +/* Iterate to the next/previous "ENGINE" type (NULL = end of the list). */ +ENGINE *ENGINE_get_next(ENGINE *e); +ENGINE *ENGINE_get_prev(ENGINE *e); +/* Add another "ENGINE" type into the array. */ +int ENGINE_add(ENGINE *e); +/* Remove an existing "ENGINE" type from the array. */ +int ENGINE_remove(ENGINE *e); +/* Retrieve an engine from the list by its unique "id" value. */ +ENGINE *ENGINE_by_id(const char *id); + +#if OPENSSL_API_COMPAT < 0x10100000L +# define ENGINE_load_openssl() \ + OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_OPENSSL, NULL) +# define ENGINE_load_dynamic() \ + OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_DYNAMIC, NULL) +# ifndef OPENSSL_NO_STATIC_ENGINE +# define ENGINE_load_padlock() \ + OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_PADLOCK, NULL) +# define ENGINE_load_capi() \ + OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_CAPI, NULL) +# define ENGINE_load_afalg() \ + OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_AFALG, NULL) +# endif +# define ENGINE_load_cryptodev() \ + OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_CRYPTODEV, NULL) +# define ENGINE_load_rdrand() \ + OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_RDRAND, NULL) +#endif +void ENGINE_load_builtin_engines(void); + +/* + * Get and set global flags (ENGINE_TABLE_FLAG_***) for the implementation + * "registry" handling. + */ +unsigned int ENGINE_get_table_flags(void); +void ENGINE_set_table_flags(unsigned int flags); + +/*- Manage registration of ENGINEs per "table". For each type, there are 3 + * functions; + * ENGINE_register_***(e) - registers the implementation from 'e' (if it has one) + * ENGINE_unregister_***(e) - unregister the implementation from 'e' + * ENGINE_register_all_***() - call ENGINE_register_***() for each 'e' in the list + * Cleanup is automatically registered from each table when required. + */ + +int ENGINE_register_RSA(ENGINE *e); +void ENGINE_unregister_RSA(ENGINE *e); +void ENGINE_register_all_RSA(void); + +int ENGINE_register_DSA(ENGINE *e); +void ENGINE_unregister_DSA(ENGINE *e); +void ENGINE_register_all_DSA(void); + +int ENGINE_register_EC(ENGINE *e); +void ENGINE_unregister_EC(ENGINE *e); +void ENGINE_register_all_EC(void); + +int ENGINE_register_DH(ENGINE *e); +void ENGINE_unregister_DH(ENGINE *e); +void ENGINE_register_all_DH(void); + +int ENGINE_register_RAND(ENGINE *e); +void ENGINE_unregister_RAND(ENGINE *e); +void ENGINE_register_all_RAND(void); + +int ENGINE_register_ciphers(ENGINE *e); +void ENGINE_unregister_ciphers(ENGINE *e); +void ENGINE_register_all_ciphers(void); + +int ENGINE_register_digests(ENGINE *e); +void ENGINE_unregister_digests(ENGINE *e); +void ENGINE_register_all_digests(void); + +int ENGINE_register_pkey_meths(ENGINE *e); +void ENGINE_unregister_pkey_meths(ENGINE *e); +void ENGINE_register_all_pkey_meths(void); + +int ENGINE_register_pkey_asn1_meths(ENGINE *e); +void ENGINE_unregister_pkey_asn1_meths(ENGINE *e); +void ENGINE_register_all_pkey_asn1_meths(void); + +/* + * These functions register all support from the above categories. Note, use + * of these functions can result in static linkage of code your application + * may not need. If you only need a subset of functionality, consider using + * more selective initialisation. + */ +int ENGINE_register_complete(ENGINE *e); +int ENGINE_register_all_complete(void); + +/* + * Send parameterised control commands to the engine. The possibilities to + * send down an integer, a pointer to data or a function pointer are + * provided. Any of the parameters may or may not be NULL, depending on the + * command number. In actuality, this function only requires a structural + * (rather than functional) reference to an engine, but many control commands + * may require the engine be functional. The caller should be aware of trying + * commands that require an operational ENGINE, and only use functional + * references in such situations. + */ +int ENGINE_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f) (void)); + +/* + * This function tests if an ENGINE-specific command is usable as a + * "setting". Eg. in an application's config file that gets processed through + * ENGINE_ctrl_cmd_string(). If this returns zero, it is not available to + * ENGINE_ctrl_cmd_string(), only ENGINE_ctrl(). + */ +int ENGINE_cmd_is_executable(ENGINE *e, int cmd); + +/* + * This function works like ENGINE_ctrl() with the exception of taking a + * command name instead of a command number, and can handle optional + * commands. See the comment on ENGINE_ctrl_cmd_string() for an explanation + * on how to use the cmd_name and cmd_optional. + */ +int ENGINE_ctrl_cmd(ENGINE *e, const char *cmd_name, + long i, void *p, void (*f) (void), int cmd_optional); + +/* + * This function passes a command-name and argument to an ENGINE. The + * cmd_name is converted to a command number and the control command is + * called using 'arg' as an argument (unless the ENGINE doesn't support such + * a command, in which case no control command is called). The command is + * checked for input flags, and if necessary the argument will be converted + * to a numeric value. If cmd_optional is non-zero, then if the ENGINE + * doesn't support the given cmd_name the return value will be success + * anyway. This function is intended for applications to use so that users + * (or config files) can supply engine-specific config data to the ENGINE at + * run-time to control behaviour of specific engines. As such, it shouldn't + * be used for calling ENGINE_ctrl() functions that return data, deal with + * binary data, or that are otherwise supposed to be used directly through + * ENGINE_ctrl() in application code. Any "return" data from an ENGINE_ctrl() + * operation in this function will be lost - the return value is interpreted + * as failure if the return value is zero, success otherwise, and this + * function returns a boolean value as a result. In other words, vendors of + * 'ENGINE'-enabled devices should write ENGINE implementations with + * parameterisations that work in this scheme, so that compliant ENGINE-based + * applications can work consistently with the same configuration for the + * same ENGINE-enabled devices, across applications. + */ +int ENGINE_ctrl_cmd_string(ENGINE *e, const char *cmd_name, const char *arg, + int cmd_optional); + +/* + * These functions are useful for manufacturing new ENGINE structures. They + * don't address reference counting at all - one uses them to populate an + * ENGINE structure with personalised implementations of things prior to + * using it directly or adding it to the builtin ENGINE list in OpenSSL. + * These are also here so that the ENGINE structure doesn't have to be + * exposed and break binary compatibility! + */ +ENGINE *ENGINE_new(void); +int ENGINE_free(ENGINE *e); +int ENGINE_up_ref(ENGINE *e); +int ENGINE_set_id(ENGINE *e, const char *id); +int ENGINE_set_name(ENGINE *e, const char *name); +int ENGINE_set_RSA(ENGINE *e, const RSA_METHOD *rsa_meth); +int ENGINE_set_DSA(ENGINE *e, const DSA_METHOD *dsa_meth); +int ENGINE_set_EC(ENGINE *e, const EC_KEY_METHOD *ecdsa_meth); +int ENGINE_set_DH(ENGINE *e, const DH_METHOD *dh_meth); +int ENGINE_set_RAND(ENGINE *e, const RAND_METHOD *rand_meth); +int ENGINE_set_destroy_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR destroy_f); +int ENGINE_set_init_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR init_f); +int ENGINE_set_finish_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR finish_f); +int ENGINE_set_ctrl_function(ENGINE *e, ENGINE_CTRL_FUNC_PTR ctrl_f); +int ENGINE_set_load_privkey_function(ENGINE *e, + ENGINE_LOAD_KEY_PTR loadpriv_f); +int ENGINE_set_load_pubkey_function(ENGINE *e, ENGINE_LOAD_KEY_PTR loadpub_f); +int ENGINE_set_load_ssl_client_cert_function(ENGINE *e, + ENGINE_SSL_CLIENT_CERT_PTR + loadssl_f); +int ENGINE_set_ciphers(ENGINE *e, ENGINE_CIPHERS_PTR f); +int ENGINE_set_digests(ENGINE *e, ENGINE_DIGESTS_PTR f); +int ENGINE_set_pkey_meths(ENGINE *e, ENGINE_PKEY_METHS_PTR f); +int ENGINE_set_pkey_asn1_meths(ENGINE *e, ENGINE_PKEY_ASN1_METHS_PTR f); +int ENGINE_set_flags(ENGINE *e, int flags); +int ENGINE_set_cmd_defns(ENGINE *e, const ENGINE_CMD_DEFN *defns); +/* These functions allow control over any per-structure ENGINE data. */ +#define ENGINE_get_ex_new_index(l, p, newf, dupf, freef) \ + CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_ENGINE, l, p, newf, dupf, freef) +int ENGINE_set_ex_data(ENGINE *e, int idx, void *arg); +void *ENGINE_get_ex_data(const ENGINE *e, int idx); + +#if OPENSSL_API_COMPAT < 0x10100000L +/* + * This function previously cleaned up anything that needs it. Auto-deinit will + * now take care of it so it is no longer required to call this function. + */ +# define ENGINE_cleanup() while(0) continue +#endif + +/* + * These return values from within the ENGINE structure. These can be useful + * with functional references as well as structural references - it depends + * which you obtained. Using the result for functional purposes if you only + * obtained a structural reference may be problematic! + */ +const char *ENGINE_get_id(const ENGINE *e); +const char *ENGINE_get_name(const ENGINE *e); +const RSA_METHOD *ENGINE_get_RSA(const ENGINE *e); +const DSA_METHOD *ENGINE_get_DSA(const ENGINE *e); +const EC_KEY_METHOD *ENGINE_get_EC(const ENGINE *e); +const DH_METHOD *ENGINE_get_DH(const ENGINE *e); +const RAND_METHOD *ENGINE_get_RAND(const ENGINE *e); +ENGINE_GEN_INT_FUNC_PTR ENGINE_get_destroy_function(const ENGINE *e); +ENGINE_GEN_INT_FUNC_PTR ENGINE_get_init_function(const ENGINE *e); +ENGINE_GEN_INT_FUNC_PTR ENGINE_get_finish_function(const ENGINE *e); +ENGINE_CTRL_FUNC_PTR ENGINE_get_ctrl_function(const ENGINE *e); +ENGINE_LOAD_KEY_PTR ENGINE_get_load_privkey_function(const ENGINE *e); +ENGINE_LOAD_KEY_PTR ENGINE_get_load_pubkey_function(const ENGINE *e); +ENGINE_SSL_CLIENT_CERT_PTR ENGINE_get_ssl_client_cert_function(const ENGINE + *e); +ENGINE_CIPHERS_PTR ENGINE_get_ciphers(const ENGINE *e); +ENGINE_DIGESTS_PTR ENGINE_get_digests(const ENGINE *e); +ENGINE_PKEY_METHS_PTR ENGINE_get_pkey_meths(const ENGINE *e); +ENGINE_PKEY_ASN1_METHS_PTR ENGINE_get_pkey_asn1_meths(const ENGINE *e); +const EVP_CIPHER *ENGINE_get_cipher(ENGINE *e, int nid); +const EVP_MD *ENGINE_get_digest(ENGINE *e, int nid); +const EVP_PKEY_METHOD *ENGINE_get_pkey_meth(ENGINE *e, int nid); +const EVP_PKEY_ASN1_METHOD *ENGINE_get_pkey_asn1_meth(ENGINE *e, int nid); +const EVP_PKEY_ASN1_METHOD *ENGINE_get_pkey_asn1_meth_str(ENGINE *e, + const char *str, + int len); +const EVP_PKEY_ASN1_METHOD *ENGINE_pkey_asn1_find_str(ENGINE **pe, + const char *str, + int len); +const ENGINE_CMD_DEFN *ENGINE_get_cmd_defns(const ENGINE *e); +int ENGINE_get_flags(const ENGINE *e); + +/* + * FUNCTIONAL functions. These functions deal with ENGINE structures that + * have (or will) be initialised for use. Broadly speaking, the structural + * functions are useful for iterating the list of available engine types, + * creating new engine types, and other "list" operations. These functions + * actually deal with ENGINEs that are to be used. As such these functions + * can fail (if applicable) when particular engines are unavailable - eg. if + * a hardware accelerator is not attached or not functioning correctly. Each + * ENGINE has 2 reference counts; structural and functional. Every time a + * functional reference is obtained or released, a corresponding structural + * reference is automatically obtained or released too. + */ + +/* + * Initialise a engine type for use (or up its reference count if it's + * already in use). This will fail if the engine is not currently operational + * and cannot initialise. + */ +int ENGINE_init(ENGINE *e); +/* + * Free a functional reference to a engine type. This does not require a + * corresponding call to ENGINE_free as it also releases a structural + * reference. + */ +int ENGINE_finish(ENGINE *e); + +/* + * The following functions handle keys that are stored in some secondary + * location, handled by the engine. The storage may be on a card or + * whatever. + */ +EVP_PKEY *ENGINE_load_private_key(ENGINE *e, const char *key_id, + UI_METHOD *ui_method, void *callback_data); +EVP_PKEY *ENGINE_load_public_key(ENGINE *e, const char *key_id, + UI_METHOD *ui_method, void *callback_data); +int ENGINE_load_ssl_client_cert(ENGINE *e, SSL *s, + STACK_OF(X509_NAME) *ca_dn, X509 **pcert, + EVP_PKEY **ppkey, STACK_OF(X509) **pother, + UI_METHOD *ui_method, void *callback_data); + +/* + * This returns a pointer for the current ENGINE structure that is (by + * default) performing any RSA operations. The value returned is an + * incremented reference, so it should be free'd (ENGINE_finish) before it is + * discarded. + */ +ENGINE *ENGINE_get_default_RSA(void); +/* Same for the other "methods" */ +ENGINE *ENGINE_get_default_DSA(void); +ENGINE *ENGINE_get_default_EC(void); +ENGINE *ENGINE_get_default_DH(void); +ENGINE *ENGINE_get_default_RAND(void); +/* + * These functions can be used to get a functional reference to perform + * ciphering or digesting corresponding to "nid". + */ +ENGINE *ENGINE_get_cipher_engine(int nid); +ENGINE *ENGINE_get_digest_engine(int nid); +ENGINE *ENGINE_get_pkey_meth_engine(int nid); +ENGINE *ENGINE_get_pkey_asn1_meth_engine(int nid); + +/* + * This sets a new default ENGINE structure for performing RSA operations. If + * the result is non-zero (success) then the ENGINE structure will have had + * its reference count up'd so the caller should still free their own + * reference 'e'. + */ +int ENGINE_set_default_RSA(ENGINE *e); +int ENGINE_set_default_string(ENGINE *e, const char *def_list); +/* Same for the other "methods" */ +int ENGINE_set_default_DSA(ENGINE *e); +int ENGINE_set_default_EC(ENGINE *e); +int ENGINE_set_default_DH(ENGINE *e); +int ENGINE_set_default_RAND(ENGINE *e); +int ENGINE_set_default_ciphers(ENGINE *e); +int ENGINE_set_default_digests(ENGINE *e); +int ENGINE_set_default_pkey_meths(ENGINE *e); +int ENGINE_set_default_pkey_asn1_meths(ENGINE *e); + +/* + * The combination "set" - the flags are bitwise "OR"d from the + * ENGINE_METHOD_*** defines above. As with the "ENGINE_register_complete()" + * function, this function can result in unnecessary static linkage. If your + * application requires only specific functionality, consider using more + * selective functions. + */ +int ENGINE_set_default(ENGINE *e, unsigned int flags); + +void ENGINE_add_conf_module(void); + +/* Deprecated functions ... */ +/* int ENGINE_clear_defaults(void); */ + +/**************************/ +/* DYNAMIC ENGINE SUPPORT */ +/**************************/ + +/* Binary/behaviour compatibility levels */ +# define OSSL_DYNAMIC_VERSION (unsigned long)0x00030000 +/* + * Binary versions older than this are too old for us (whether we're a loader + * or a loadee) + */ +# define OSSL_DYNAMIC_OLDEST (unsigned long)0x00030000 + +/* + * When compiling an ENGINE entirely as an external shared library, loadable + * by the "dynamic" ENGINE, these types are needed. The 'dynamic_fns' + * structure type provides the calling application's (or library's) error + * functionality and memory management function pointers to the loaded + * library. These should be used/set in the loaded library code so that the + * loading application's 'state' will be used/changed in all operations. The + * 'static_state' pointer allows the loaded library to know if it shares the + * same static data as the calling application (or library), and thus whether + * these callbacks need to be set or not. + */ +typedef void *(*dyn_MEM_malloc_fn) (size_t, const char *, int); +typedef void *(*dyn_MEM_realloc_fn) (void *, size_t, const char *, int); +typedef void (*dyn_MEM_free_fn) (void *, const char *, int); +typedef struct st_dynamic_MEM_fns { + dyn_MEM_malloc_fn malloc_fn; + dyn_MEM_realloc_fn realloc_fn; + dyn_MEM_free_fn free_fn; +} dynamic_MEM_fns; +/* + * FIXME: Perhaps the memory and locking code (crypto.h) should declare and + * use these types so we (and any other dependent code) can simplify a bit?? + */ +/* The top-level structure */ +typedef struct st_dynamic_fns { + void *static_state; + dynamic_MEM_fns mem_fns; +} dynamic_fns; + +/* + * The version checking function should be of this prototype. NB: The + * ossl_version value passed in is the OSSL_DYNAMIC_VERSION of the loading + * code. If this function returns zero, it indicates a (potential) version + * incompatibility and the loaded library doesn't believe it can proceed. + * Otherwise, the returned value is the (latest) version supported by the + * loading library. The loader may still decide that the loaded code's + * version is unsatisfactory and could veto the load. The function is + * expected to be implemented with the symbol name "v_check", and a default + * implementation can be fully instantiated with + * IMPLEMENT_DYNAMIC_CHECK_FN(). + */ +typedef unsigned long (*dynamic_v_check_fn) (unsigned long ossl_version); +# define IMPLEMENT_DYNAMIC_CHECK_FN() \ + OPENSSL_EXPORT unsigned long v_check(unsigned long v); \ + OPENSSL_EXPORT unsigned long v_check(unsigned long v) { \ + if (v >= OSSL_DYNAMIC_OLDEST) return OSSL_DYNAMIC_VERSION; \ + return 0; } + +/* + * This function is passed the ENGINE structure to initialise with its own + * function and command settings. It should not adjust the structural or + * functional reference counts. If this function returns zero, (a) the load + * will be aborted, (b) the previous ENGINE state will be memcpy'd back onto + * the structure, and (c) the shared library will be unloaded. So + * implementations should do their own internal cleanup in failure + * circumstances otherwise they could leak. The 'id' parameter, if non-NULL, + * represents the ENGINE id that the loader is looking for. If this is NULL, + * the shared library can choose to return failure or to initialise a + * 'default' ENGINE. If non-NULL, the shared library must initialise only an + * ENGINE matching the passed 'id'. The function is expected to be + * implemented with the symbol name "bind_engine". A standard implementation + * can be instantiated with IMPLEMENT_DYNAMIC_BIND_FN(fn) where the parameter + * 'fn' is a callback function that populates the ENGINE structure and + * returns an int value (zero for failure). 'fn' should have prototype; + * [static] int fn(ENGINE *e, const char *id); + */ +typedef int (*dynamic_bind_engine) (ENGINE *e, const char *id, + const dynamic_fns *fns); +# define IMPLEMENT_DYNAMIC_BIND_FN(fn) \ + OPENSSL_EXPORT \ + int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns); \ + OPENSSL_EXPORT \ + int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns) { \ + if (ENGINE_get_static_state() == fns->static_state) goto skip_cbs; \ + CRYPTO_set_mem_functions(fns->mem_fns.malloc_fn, \ + fns->mem_fns.realloc_fn, \ + fns->mem_fns.free_fn); \ + skip_cbs: \ + if (!fn(e, id)) return 0; \ + return 1; } + +/* + * If the loading application (or library) and the loaded ENGINE library + * share the same static data (eg. they're both dynamically linked to the + * same libcrypto.so) we need a way to avoid trying to set system callbacks - + * this would fail, and for the same reason that it's unnecessary to try. If + * the loaded ENGINE has (or gets from through the loader) its own copy of + * the libcrypto static data, we will need to set the callbacks. The easiest + * way to detect this is to have a function that returns a pointer to some + * static data and let the loading application and loaded ENGINE compare + * their respective values. + */ +void *ENGINE_get_static_state(void); + +# if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) +DEPRECATEDIN_1_1_0(void ENGINE_setup_bsd_cryptodev(void)) +# endif + + +# ifdef __cplusplus +} +# endif +# endif +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/engineerr.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/engineerr.h new file mode 100644 index 0000000..05e84bd --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/engineerr.h @@ -0,0 +1,111 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_ENGINEERR_H +# define HEADER_ENGINEERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# include + +# ifndef OPENSSL_NO_ENGINE + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_ENGINE_strings(void); + +/* + * ENGINE function codes. + */ +# define ENGINE_F_DIGEST_UPDATE 198 +# define ENGINE_F_DYNAMIC_CTRL 180 +# define ENGINE_F_DYNAMIC_GET_DATA_CTX 181 +# define ENGINE_F_DYNAMIC_LOAD 182 +# define ENGINE_F_DYNAMIC_SET_DATA_CTX 183 +# define ENGINE_F_ENGINE_ADD 105 +# define ENGINE_F_ENGINE_BY_ID 106 +# define ENGINE_F_ENGINE_CMD_IS_EXECUTABLE 170 +# define ENGINE_F_ENGINE_CTRL 142 +# define ENGINE_F_ENGINE_CTRL_CMD 178 +# define ENGINE_F_ENGINE_CTRL_CMD_STRING 171 +# define ENGINE_F_ENGINE_FINISH 107 +# define ENGINE_F_ENGINE_GET_CIPHER 185 +# define ENGINE_F_ENGINE_GET_DIGEST 186 +# define ENGINE_F_ENGINE_GET_FIRST 195 +# define ENGINE_F_ENGINE_GET_LAST 196 +# define ENGINE_F_ENGINE_GET_NEXT 115 +# define ENGINE_F_ENGINE_GET_PKEY_ASN1_METH 193 +# define ENGINE_F_ENGINE_GET_PKEY_METH 192 +# define ENGINE_F_ENGINE_GET_PREV 116 +# define ENGINE_F_ENGINE_INIT 119 +# define ENGINE_F_ENGINE_LIST_ADD 120 +# define ENGINE_F_ENGINE_LIST_REMOVE 121 +# define ENGINE_F_ENGINE_LOAD_PRIVATE_KEY 150 +# define ENGINE_F_ENGINE_LOAD_PUBLIC_KEY 151 +# define ENGINE_F_ENGINE_LOAD_SSL_CLIENT_CERT 194 +# define ENGINE_F_ENGINE_NEW 122 +# define ENGINE_F_ENGINE_PKEY_ASN1_FIND_STR 197 +# define ENGINE_F_ENGINE_REMOVE 123 +# define ENGINE_F_ENGINE_SET_DEFAULT_STRING 189 +# define ENGINE_F_ENGINE_SET_ID 129 +# define ENGINE_F_ENGINE_SET_NAME 130 +# define ENGINE_F_ENGINE_TABLE_REGISTER 184 +# define ENGINE_F_ENGINE_UNLOCKED_FINISH 191 +# define ENGINE_F_ENGINE_UP_REF 190 +# define ENGINE_F_INT_CLEANUP_ITEM 199 +# define ENGINE_F_INT_CTRL_HELPER 172 +# define ENGINE_F_INT_ENGINE_CONFIGURE 188 +# define ENGINE_F_INT_ENGINE_MODULE_INIT 187 +# define ENGINE_F_OSSL_HMAC_INIT 200 + +/* + * ENGINE reason codes. + */ +# define ENGINE_R_ALREADY_LOADED 100 +# define ENGINE_R_ARGUMENT_IS_NOT_A_NUMBER 133 +# define ENGINE_R_CMD_NOT_EXECUTABLE 134 +# define ENGINE_R_COMMAND_TAKES_INPUT 135 +# define ENGINE_R_COMMAND_TAKES_NO_INPUT 136 +# define ENGINE_R_CONFLICTING_ENGINE_ID 103 +# define ENGINE_R_CTRL_COMMAND_NOT_IMPLEMENTED 119 +# define ENGINE_R_DSO_FAILURE 104 +# define ENGINE_R_DSO_NOT_FOUND 132 +# define ENGINE_R_ENGINES_SECTION_ERROR 148 +# define ENGINE_R_ENGINE_CONFIGURATION_ERROR 102 +# define ENGINE_R_ENGINE_IS_NOT_IN_LIST 105 +# define ENGINE_R_ENGINE_SECTION_ERROR 149 +# define ENGINE_R_FAILED_LOADING_PRIVATE_KEY 128 +# define ENGINE_R_FAILED_LOADING_PUBLIC_KEY 129 +# define ENGINE_R_FINISH_FAILED 106 +# define ENGINE_R_ID_OR_NAME_MISSING 108 +# define ENGINE_R_INIT_FAILED 109 +# define ENGINE_R_INTERNAL_LIST_ERROR 110 +# define ENGINE_R_INVALID_ARGUMENT 143 +# define ENGINE_R_INVALID_CMD_NAME 137 +# define ENGINE_R_INVALID_CMD_NUMBER 138 +# define ENGINE_R_INVALID_INIT_VALUE 151 +# define ENGINE_R_INVALID_STRING 150 +# define ENGINE_R_NOT_INITIALISED 117 +# define ENGINE_R_NOT_LOADED 112 +# define ENGINE_R_NO_CONTROL_FUNCTION 120 +# define ENGINE_R_NO_INDEX 144 +# define ENGINE_R_NO_LOAD_FUNCTION 125 +# define ENGINE_R_NO_REFERENCE 130 +# define ENGINE_R_NO_SUCH_ENGINE 116 +# define ENGINE_R_UNIMPLEMENTED_CIPHER 146 +# define ENGINE_R_UNIMPLEMENTED_DIGEST 147 +# define ENGINE_R_UNIMPLEMENTED_PUBLIC_KEY_METHOD 101 +# define ENGINE_R_VERSION_INCOMPATIBILITY 145 + +# endif +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/err.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/err.h new file mode 100644 index 0000000..b49f881 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/err.h @@ -0,0 +1,274 @@ +/* + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_ERR_H +# define HEADER_ERR_H + +# include + +# ifndef OPENSSL_NO_STDIO +# include +# include +# endif + +# include +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + +# ifndef OPENSSL_NO_ERR +# define ERR_PUT_error(a,b,c,d,e) ERR_put_error(a,b,c,d,e) +# else +# define ERR_PUT_error(a,b,c,d,e) ERR_put_error(a,b,c,NULL,0) +# endif + +# include + +# define ERR_TXT_MALLOCED 0x01 +# define ERR_TXT_STRING 0x02 + +# define ERR_FLAG_MARK 0x01 +# define ERR_FLAG_CLEAR 0x02 + +# define ERR_NUM_ERRORS 16 +typedef struct err_state_st { + int err_flags[ERR_NUM_ERRORS]; + unsigned long err_buffer[ERR_NUM_ERRORS]; + char *err_data[ERR_NUM_ERRORS]; + int err_data_flags[ERR_NUM_ERRORS]; + const char *err_file[ERR_NUM_ERRORS]; + int err_line[ERR_NUM_ERRORS]; + int top, bottom; +} ERR_STATE; + +/* library */ +# define ERR_LIB_NONE 1 +# define ERR_LIB_SYS 2 +# define ERR_LIB_BN 3 +# define ERR_LIB_RSA 4 +# define ERR_LIB_DH 5 +# define ERR_LIB_EVP 6 +# define ERR_LIB_BUF 7 +# define ERR_LIB_OBJ 8 +# define ERR_LIB_PEM 9 +# define ERR_LIB_DSA 10 +# define ERR_LIB_X509 11 +/* #define ERR_LIB_METH 12 */ +# define ERR_LIB_ASN1 13 +# define ERR_LIB_CONF 14 +# define ERR_LIB_CRYPTO 15 +# define ERR_LIB_EC 16 +# define ERR_LIB_SSL 20 +/* #define ERR_LIB_SSL23 21 */ +/* #define ERR_LIB_SSL2 22 */ +/* #define ERR_LIB_SSL3 23 */ +/* #define ERR_LIB_RSAREF 30 */ +/* #define ERR_LIB_PROXY 31 */ +# define ERR_LIB_BIO 32 +# define ERR_LIB_PKCS7 33 +# define ERR_LIB_X509V3 34 +# define ERR_LIB_PKCS12 35 +# define ERR_LIB_RAND 36 +# define ERR_LIB_DSO 37 +# define ERR_LIB_ENGINE 38 +# define ERR_LIB_OCSP 39 +# define ERR_LIB_UI 40 +# define ERR_LIB_COMP 41 +# define ERR_LIB_ECDSA 42 +# define ERR_LIB_ECDH 43 +# define ERR_LIB_OSSL_STORE 44 +# define ERR_LIB_FIPS 45 +# define ERR_LIB_CMS 46 +# define ERR_LIB_TS 47 +# define ERR_LIB_HMAC 48 +/* # define ERR_LIB_JPAKE 49 */ +# define ERR_LIB_CT 50 +# define ERR_LIB_ASYNC 51 +# define ERR_LIB_KDF 52 +# define ERR_LIB_SM2 53 + +# define ERR_LIB_USER 128 + +# define SYSerr(f,r) ERR_PUT_error(ERR_LIB_SYS,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define BNerr(f,r) ERR_PUT_error(ERR_LIB_BN,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define RSAerr(f,r) ERR_PUT_error(ERR_LIB_RSA,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define DHerr(f,r) ERR_PUT_error(ERR_LIB_DH,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define EVPerr(f,r) ERR_PUT_error(ERR_LIB_EVP,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define BUFerr(f,r) ERR_PUT_error(ERR_LIB_BUF,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define OBJerr(f,r) ERR_PUT_error(ERR_LIB_OBJ,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define PEMerr(f,r) ERR_PUT_error(ERR_LIB_PEM,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define DSAerr(f,r) ERR_PUT_error(ERR_LIB_DSA,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define X509err(f,r) ERR_PUT_error(ERR_LIB_X509,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define CONFerr(f,r) ERR_PUT_error(ERR_LIB_CONF,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define CRYPTOerr(f,r) ERR_PUT_error(ERR_LIB_CRYPTO,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define ECerr(f,r) ERR_PUT_error(ERR_LIB_EC,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define SSLerr(f,r) ERR_PUT_error(ERR_LIB_SSL,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define BIOerr(f,r) ERR_PUT_error(ERR_LIB_BIO,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define PKCS7err(f,r) ERR_PUT_error(ERR_LIB_PKCS7,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define X509V3err(f,r) ERR_PUT_error(ERR_LIB_X509V3,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define PKCS12err(f,r) ERR_PUT_error(ERR_LIB_PKCS12,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define RANDerr(f,r) ERR_PUT_error(ERR_LIB_RAND,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define DSOerr(f,r) ERR_PUT_error(ERR_LIB_DSO,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define ENGINEerr(f,r) ERR_PUT_error(ERR_LIB_ENGINE,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define OCSPerr(f,r) ERR_PUT_error(ERR_LIB_OCSP,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define UIerr(f,r) ERR_PUT_error(ERR_LIB_UI,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define COMPerr(f,r) ERR_PUT_error(ERR_LIB_COMP,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define ECDSAerr(f,r) ERR_PUT_error(ERR_LIB_ECDSA,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define ECDHerr(f,r) ERR_PUT_error(ERR_LIB_ECDH,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define OSSL_STOREerr(f,r) ERR_PUT_error(ERR_LIB_OSSL_STORE,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define FIPSerr(f,r) ERR_PUT_error(ERR_LIB_FIPS,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define CMSerr(f,r) ERR_PUT_error(ERR_LIB_CMS,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define TSerr(f,r) ERR_PUT_error(ERR_LIB_TS,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define HMACerr(f,r) ERR_PUT_error(ERR_LIB_HMAC,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define CTerr(f,r) ERR_PUT_error(ERR_LIB_CT,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define ASYNCerr(f,r) ERR_PUT_error(ERR_LIB_ASYNC,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define KDFerr(f,r) ERR_PUT_error(ERR_LIB_KDF,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define SM2err(f,r) ERR_PUT_error(ERR_LIB_SM2,(f),(r),OPENSSL_FILE,OPENSSL_LINE) + +# define ERR_PACK(l,f,r) ( \ + (((unsigned int)(l) & 0x0FF) << 24L) | \ + (((unsigned int)(f) & 0xFFF) << 12L) | \ + (((unsigned int)(r) & 0xFFF) ) ) +# define ERR_GET_LIB(l) (int)(((l) >> 24L) & 0x0FFL) +# define ERR_GET_FUNC(l) (int)(((l) >> 12L) & 0xFFFL) +# define ERR_GET_REASON(l) (int)( (l) & 0xFFFL) +# define ERR_FATAL_ERROR(l) (int)( (l) & ERR_R_FATAL) + +/* OS functions */ +# define SYS_F_FOPEN 1 +# define SYS_F_CONNECT 2 +# define SYS_F_GETSERVBYNAME 3 +# define SYS_F_SOCKET 4 +# define SYS_F_IOCTLSOCKET 5 +# define SYS_F_BIND 6 +# define SYS_F_LISTEN 7 +# define SYS_F_ACCEPT 8 +# define SYS_F_WSASTARTUP 9/* Winsock stuff */ +# define SYS_F_OPENDIR 10 +# define SYS_F_FREAD 11 +# define SYS_F_GETADDRINFO 12 +# define SYS_F_GETNAMEINFO 13 +# define SYS_F_SETSOCKOPT 14 +# define SYS_F_GETSOCKOPT 15 +# define SYS_F_GETSOCKNAME 16 +# define SYS_F_GETHOSTBYNAME 17 +# define SYS_F_FFLUSH 18 +# define SYS_F_OPEN 19 +# define SYS_F_CLOSE 20 +# define SYS_F_IOCTL 21 +# define SYS_F_STAT 22 +# define SYS_F_FCNTL 23 +# define SYS_F_FSTAT 24 + +/* reasons */ +# define ERR_R_SYS_LIB ERR_LIB_SYS/* 2 */ +# define ERR_R_BN_LIB ERR_LIB_BN/* 3 */ +# define ERR_R_RSA_LIB ERR_LIB_RSA/* 4 */ +# define ERR_R_DH_LIB ERR_LIB_DH/* 5 */ +# define ERR_R_EVP_LIB ERR_LIB_EVP/* 6 */ +# define ERR_R_BUF_LIB ERR_LIB_BUF/* 7 */ +# define ERR_R_OBJ_LIB ERR_LIB_OBJ/* 8 */ +# define ERR_R_PEM_LIB ERR_LIB_PEM/* 9 */ +# define ERR_R_DSA_LIB ERR_LIB_DSA/* 10 */ +# define ERR_R_X509_LIB ERR_LIB_X509/* 11 */ +# define ERR_R_ASN1_LIB ERR_LIB_ASN1/* 13 */ +# define ERR_R_EC_LIB ERR_LIB_EC/* 16 */ +# define ERR_R_BIO_LIB ERR_LIB_BIO/* 32 */ +# define ERR_R_PKCS7_LIB ERR_LIB_PKCS7/* 33 */ +# define ERR_R_X509V3_LIB ERR_LIB_X509V3/* 34 */ +# define ERR_R_ENGINE_LIB ERR_LIB_ENGINE/* 38 */ +# define ERR_R_UI_LIB ERR_LIB_UI/* 40 */ +# define ERR_R_ECDSA_LIB ERR_LIB_ECDSA/* 42 */ +# define ERR_R_OSSL_STORE_LIB ERR_LIB_OSSL_STORE/* 44 */ + +# define ERR_R_NESTED_ASN1_ERROR 58 +# define ERR_R_MISSING_ASN1_EOS 63 + +/* fatal error */ +# define ERR_R_FATAL 64 +# define ERR_R_MALLOC_FAILURE (1|ERR_R_FATAL) +# define ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED (2|ERR_R_FATAL) +# define ERR_R_PASSED_NULL_PARAMETER (3|ERR_R_FATAL) +# define ERR_R_INTERNAL_ERROR (4|ERR_R_FATAL) +# define ERR_R_DISABLED (5|ERR_R_FATAL) +# define ERR_R_INIT_FAIL (6|ERR_R_FATAL) +# define ERR_R_PASSED_INVALID_ARGUMENT (7) +# define ERR_R_OPERATION_FAIL (8|ERR_R_FATAL) + +/* + * 99 is the maximum possible ERR_R_... code, higher values are reserved for + * the individual libraries + */ + +typedef struct ERR_string_data_st { + unsigned long error; + const char *string; +} ERR_STRING_DATA; + +DEFINE_LHASH_OF(ERR_STRING_DATA); + +void ERR_put_error(int lib, int func, int reason, const char *file, int line); +void ERR_set_error_data(char *data, int flags); + +unsigned long ERR_get_error(void); +unsigned long ERR_get_error_line(const char **file, int *line); +unsigned long ERR_get_error_line_data(const char **file, int *line, + const char **data, int *flags); +unsigned long ERR_peek_error(void); +unsigned long ERR_peek_error_line(const char **file, int *line); +unsigned long ERR_peek_error_line_data(const char **file, int *line, + const char **data, int *flags); +unsigned long ERR_peek_last_error(void); +unsigned long ERR_peek_last_error_line(const char **file, int *line); +unsigned long ERR_peek_last_error_line_data(const char **file, int *line, + const char **data, int *flags); +void ERR_clear_error(void); +char *ERR_error_string(unsigned long e, char *buf); +void ERR_error_string_n(unsigned long e, char *buf, size_t len); +const char *ERR_lib_error_string(unsigned long e); +const char *ERR_func_error_string(unsigned long e); +const char *ERR_reason_error_string(unsigned long e); +void ERR_print_errors_cb(int (*cb) (const char *str, size_t len, void *u), + void *u); +# ifndef OPENSSL_NO_STDIO +void ERR_print_errors_fp(FILE *fp); +# endif +void ERR_print_errors(BIO *bp); +void ERR_add_error_data(int num, ...); +void ERR_add_error_vdata(int num, va_list args); +int ERR_load_strings(int lib, ERR_STRING_DATA *str); +int ERR_load_strings_const(const ERR_STRING_DATA *str); +int ERR_unload_strings(int lib, ERR_STRING_DATA *str); +int ERR_load_ERR_strings(void); + +#if OPENSSL_API_COMPAT < 0x10100000L +# define ERR_load_crypto_strings() \ + OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL) +# define ERR_free_strings() while(0) continue +#endif + +DEPRECATEDIN_1_1_0(void ERR_remove_thread_state(void *)) +DEPRECATEDIN_1_0_0(void ERR_remove_state(unsigned long pid)) +ERR_STATE *ERR_get_state(void); + +int ERR_get_next_error_library(void); + +int ERR_set_mark(void); +int ERR_pop_to_mark(void); +int ERR_clear_last_mark(void); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/evp.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/evp.h new file mode 100644 index 0000000..a411f3f --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/evp.h @@ -0,0 +1,1666 @@ +/* + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_ENVELOPE_H +# define HEADER_ENVELOPE_H + +# include +# include +# include +# include +# include + +# define EVP_MAX_MD_SIZE 64/* longest known is SHA512 */ +# define EVP_MAX_KEY_LENGTH 64 +# define EVP_MAX_IV_LENGTH 16 +# define EVP_MAX_BLOCK_LENGTH 32 + +# define PKCS5_SALT_LEN 8 +/* Default PKCS#5 iteration count */ +# define PKCS5_DEFAULT_ITER 2048 + +# include + +# define EVP_PK_RSA 0x0001 +# define EVP_PK_DSA 0x0002 +# define EVP_PK_DH 0x0004 +# define EVP_PK_EC 0x0008 +# define EVP_PKT_SIGN 0x0010 +# define EVP_PKT_ENC 0x0020 +# define EVP_PKT_EXCH 0x0040 +# define EVP_PKS_RSA 0x0100 +# define EVP_PKS_DSA 0x0200 +# define EVP_PKS_EC 0x0400 + +# define EVP_PKEY_NONE NID_undef +# define EVP_PKEY_RSA NID_rsaEncryption +# define EVP_PKEY_RSA2 NID_rsa +# define EVP_PKEY_RSA_PSS NID_rsassaPss +# define EVP_PKEY_DSA NID_dsa +# define EVP_PKEY_DSA1 NID_dsa_2 +# define EVP_PKEY_DSA2 NID_dsaWithSHA +# define EVP_PKEY_DSA3 NID_dsaWithSHA1 +# define EVP_PKEY_DSA4 NID_dsaWithSHA1_2 +# define EVP_PKEY_DH NID_dhKeyAgreement +# define EVP_PKEY_DHX NID_dhpublicnumber +# define EVP_PKEY_EC NID_X9_62_id_ecPublicKey +# define EVP_PKEY_SM2 NID_sm2 +# define EVP_PKEY_HMAC NID_hmac +# define EVP_PKEY_CMAC NID_cmac +# define EVP_PKEY_SCRYPT NID_id_scrypt +# define EVP_PKEY_TLS1_PRF NID_tls1_prf +# define EVP_PKEY_HKDF NID_hkdf +# define EVP_PKEY_POLY1305 NID_poly1305 +# define EVP_PKEY_SIPHASH NID_siphash +# define EVP_PKEY_X25519 NID_X25519 +# define EVP_PKEY_ED25519 NID_ED25519 +# define EVP_PKEY_X448 NID_X448 +# define EVP_PKEY_ED448 NID_ED448 + +#ifdef __cplusplus +extern "C" { +#endif + +# define EVP_PKEY_MO_SIGN 0x0001 +# define EVP_PKEY_MO_VERIFY 0x0002 +# define EVP_PKEY_MO_ENCRYPT 0x0004 +# define EVP_PKEY_MO_DECRYPT 0x0008 + +# ifndef EVP_MD +EVP_MD *EVP_MD_meth_new(int md_type, int pkey_type); +EVP_MD *EVP_MD_meth_dup(const EVP_MD *md); +void EVP_MD_meth_free(EVP_MD *md); + +int EVP_MD_meth_set_input_blocksize(EVP_MD *md, int blocksize); +int EVP_MD_meth_set_result_size(EVP_MD *md, int resultsize); +int EVP_MD_meth_set_app_datasize(EVP_MD *md, int datasize); +int EVP_MD_meth_set_flags(EVP_MD *md, unsigned long flags); +int EVP_MD_meth_set_init(EVP_MD *md, int (*init)(EVP_MD_CTX *ctx)); +int EVP_MD_meth_set_update(EVP_MD *md, int (*update)(EVP_MD_CTX *ctx, + const void *data, + size_t count)); +int EVP_MD_meth_set_final(EVP_MD *md, int (*final)(EVP_MD_CTX *ctx, + unsigned char *md)); +int EVP_MD_meth_set_copy(EVP_MD *md, int (*copy)(EVP_MD_CTX *to, + const EVP_MD_CTX *from)); +int EVP_MD_meth_set_cleanup(EVP_MD *md, int (*cleanup)(EVP_MD_CTX *ctx)); +int EVP_MD_meth_set_ctrl(EVP_MD *md, int (*ctrl)(EVP_MD_CTX *ctx, int cmd, + int p1, void *p2)); + +int EVP_MD_meth_get_input_blocksize(const EVP_MD *md); +int EVP_MD_meth_get_result_size(const EVP_MD *md); +int EVP_MD_meth_get_app_datasize(const EVP_MD *md); +unsigned long EVP_MD_meth_get_flags(const EVP_MD *md); +int (*EVP_MD_meth_get_init(const EVP_MD *md))(EVP_MD_CTX *ctx); +int (*EVP_MD_meth_get_update(const EVP_MD *md))(EVP_MD_CTX *ctx, + const void *data, + size_t count); +int (*EVP_MD_meth_get_final(const EVP_MD *md))(EVP_MD_CTX *ctx, + unsigned char *md); +int (*EVP_MD_meth_get_copy(const EVP_MD *md))(EVP_MD_CTX *to, + const EVP_MD_CTX *from); +int (*EVP_MD_meth_get_cleanup(const EVP_MD *md))(EVP_MD_CTX *ctx); +int (*EVP_MD_meth_get_ctrl(const EVP_MD *md))(EVP_MD_CTX *ctx, int cmd, + int p1, void *p2); + +/* digest can only handle a single block */ +# define EVP_MD_FLAG_ONESHOT 0x0001 + +/* digest is extensible-output function, XOF */ +# define EVP_MD_FLAG_XOF 0x0002 + +/* DigestAlgorithmIdentifier flags... */ + +# define EVP_MD_FLAG_DIGALGID_MASK 0x0018 + +/* NULL or absent parameter accepted. Use NULL */ + +# define EVP_MD_FLAG_DIGALGID_NULL 0x0000 + +/* NULL or absent parameter accepted. Use NULL for PKCS#1 otherwise absent */ + +# define EVP_MD_FLAG_DIGALGID_ABSENT 0x0008 + +/* Custom handling via ctrl */ + +# define EVP_MD_FLAG_DIGALGID_CUSTOM 0x0018 + +/* Note if suitable for use in FIPS mode */ +# define EVP_MD_FLAG_FIPS 0x0400 + +/* Digest ctrls */ + +# define EVP_MD_CTRL_DIGALGID 0x1 +# define EVP_MD_CTRL_MICALG 0x2 +# define EVP_MD_CTRL_XOF_LEN 0x3 + +/* Minimum Algorithm specific ctrl value */ + +# define EVP_MD_CTRL_ALG_CTRL 0x1000 + +# endif /* !EVP_MD */ + +/* values for EVP_MD_CTX flags */ + +# define EVP_MD_CTX_FLAG_ONESHOT 0x0001/* digest update will be + * called once only */ +# define EVP_MD_CTX_FLAG_CLEANED 0x0002/* context has already been + * cleaned */ +# define EVP_MD_CTX_FLAG_REUSE 0x0004/* Don't free up ctx->md_data + * in EVP_MD_CTX_reset */ +/* + * FIPS and pad options are ignored in 1.0.0, definitions are here so we + * don't accidentally reuse the values for other purposes. + */ + +# define EVP_MD_CTX_FLAG_NON_FIPS_ALLOW 0x0008/* Allow use of non FIPS + * digest in FIPS mode */ + +/* + * The following PAD options are also currently ignored in 1.0.0, digest + * parameters are handled through EVP_DigestSign*() and EVP_DigestVerify*() + * instead. + */ +# define EVP_MD_CTX_FLAG_PAD_MASK 0xF0/* RSA mode to use */ +# define EVP_MD_CTX_FLAG_PAD_PKCS1 0x00/* PKCS#1 v1.5 mode */ +# define EVP_MD_CTX_FLAG_PAD_X931 0x10/* X9.31 mode */ +# define EVP_MD_CTX_FLAG_PAD_PSS 0x20/* PSS mode */ + +# define EVP_MD_CTX_FLAG_NO_INIT 0x0100/* Don't initialize md_data */ +/* + * Some functions such as EVP_DigestSign only finalise copies of internal + * contexts so additional data can be included after the finalisation call. + * This is inefficient if this functionality is not required: it is disabled + * if the following flag is set. + */ +# define EVP_MD_CTX_FLAG_FINALISE 0x0200 +/* NOTE: 0x0400 is reserved for internal usage */ + +EVP_CIPHER *EVP_CIPHER_meth_new(int cipher_type, int block_size, int key_len); +EVP_CIPHER *EVP_CIPHER_meth_dup(const EVP_CIPHER *cipher); +void EVP_CIPHER_meth_free(EVP_CIPHER *cipher); + +int EVP_CIPHER_meth_set_iv_length(EVP_CIPHER *cipher, int iv_len); +int EVP_CIPHER_meth_set_flags(EVP_CIPHER *cipher, unsigned long flags); +int EVP_CIPHER_meth_set_impl_ctx_size(EVP_CIPHER *cipher, int ctx_size); +int EVP_CIPHER_meth_set_init(EVP_CIPHER *cipher, + int (*init) (EVP_CIPHER_CTX *ctx, + const unsigned char *key, + const unsigned char *iv, + int enc)); +int EVP_CIPHER_meth_set_do_cipher(EVP_CIPHER *cipher, + int (*do_cipher) (EVP_CIPHER_CTX *ctx, + unsigned char *out, + const unsigned char *in, + size_t inl)); +int EVP_CIPHER_meth_set_cleanup(EVP_CIPHER *cipher, + int (*cleanup) (EVP_CIPHER_CTX *)); +int EVP_CIPHER_meth_set_set_asn1_params(EVP_CIPHER *cipher, + int (*set_asn1_parameters) (EVP_CIPHER_CTX *, + ASN1_TYPE *)); +int EVP_CIPHER_meth_set_get_asn1_params(EVP_CIPHER *cipher, + int (*get_asn1_parameters) (EVP_CIPHER_CTX *, + ASN1_TYPE *)); +int EVP_CIPHER_meth_set_ctrl(EVP_CIPHER *cipher, + int (*ctrl) (EVP_CIPHER_CTX *, int type, + int arg, void *ptr)); + +int (*EVP_CIPHER_meth_get_init(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *ctx, + const unsigned char *key, + const unsigned char *iv, + int enc); +int (*EVP_CIPHER_meth_get_do_cipher(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *ctx, + unsigned char *out, + const unsigned char *in, + size_t inl); +int (*EVP_CIPHER_meth_get_cleanup(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *); +int (*EVP_CIPHER_meth_get_set_asn1_params(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *, + ASN1_TYPE *); +int (*EVP_CIPHER_meth_get_get_asn1_params(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *, + ASN1_TYPE *); +int (*EVP_CIPHER_meth_get_ctrl(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *, + int type, int arg, + void *ptr); + +/* Values for cipher flags */ + +/* Modes for ciphers */ + +# define EVP_CIPH_STREAM_CIPHER 0x0 +# define EVP_CIPH_ECB_MODE 0x1 +# define EVP_CIPH_CBC_MODE 0x2 +# define EVP_CIPH_CFB_MODE 0x3 +# define EVP_CIPH_OFB_MODE 0x4 +# define EVP_CIPH_CTR_MODE 0x5 +# define EVP_CIPH_GCM_MODE 0x6 +# define EVP_CIPH_CCM_MODE 0x7 +# define EVP_CIPH_XTS_MODE 0x10001 +# define EVP_CIPH_WRAP_MODE 0x10002 +# define EVP_CIPH_OCB_MODE 0x10003 +# define EVP_CIPH_MODE 0xF0007 +/* Set if variable length cipher */ +# define EVP_CIPH_VARIABLE_LENGTH 0x8 +/* Set if the iv handling should be done by the cipher itself */ +# define EVP_CIPH_CUSTOM_IV 0x10 +/* Set if the cipher's init() function should be called if key is NULL */ +# define EVP_CIPH_ALWAYS_CALL_INIT 0x20 +/* Call ctrl() to init cipher parameters */ +# define EVP_CIPH_CTRL_INIT 0x40 +/* Don't use standard key length function */ +# define EVP_CIPH_CUSTOM_KEY_LENGTH 0x80 +/* Don't use standard block padding */ +# define EVP_CIPH_NO_PADDING 0x100 +/* cipher handles random key generation */ +# define EVP_CIPH_RAND_KEY 0x200 +/* cipher has its own additional copying logic */ +# define EVP_CIPH_CUSTOM_COPY 0x400 +/* Don't use standard iv length function */ +# define EVP_CIPH_CUSTOM_IV_LENGTH 0x800 +/* Allow use default ASN1 get/set iv */ +# define EVP_CIPH_FLAG_DEFAULT_ASN1 0x1000 +/* Buffer length in bits not bytes: CFB1 mode only */ +# define EVP_CIPH_FLAG_LENGTH_BITS 0x2000 +/* Note if suitable for use in FIPS mode */ +# define EVP_CIPH_FLAG_FIPS 0x4000 +/* Allow non FIPS cipher in FIPS mode */ +# define EVP_CIPH_FLAG_NON_FIPS_ALLOW 0x8000 +/* + * Cipher handles any and all padding logic as well as finalisation. + */ +# define EVP_CIPH_FLAG_CUSTOM_CIPHER 0x100000 +# define EVP_CIPH_FLAG_AEAD_CIPHER 0x200000 +# define EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK 0x400000 +/* Cipher can handle pipeline operations */ +# define EVP_CIPH_FLAG_PIPELINE 0X800000 + +/* + * Cipher context flag to indicate we can handle wrap mode: if allowed in + * older applications it could overflow buffers. + */ + +# define EVP_CIPHER_CTX_FLAG_WRAP_ALLOW 0x1 + +/* ctrl() values */ + +# define EVP_CTRL_INIT 0x0 +# define EVP_CTRL_SET_KEY_LENGTH 0x1 +# define EVP_CTRL_GET_RC2_KEY_BITS 0x2 +# define EVP_CTRL_SET_RC2_KEY_BITS 0x3 +# define EVP_CTRL_GET_RC5_ROUNDS 0x4 +# define EVP_CTRL_SET_RC5_ROUNDS 0x5 +# define EVP_CTRL_RAND_KEY 0x6 +# define EVP_CTRL_PBE_PRF_NID 0x7 +# define EVP_CTRL_COPY 0x8 +# define EVP_CTRL_AEAD_SET_IVLEN 0x9 +# define EVP_CTRL_AEAD_GET_TAG 0x10 +# define EVP_CTRL_AEAD_SET_TAG 0x11 +# define EVP_CTRL_AEAD_SET_IV_FIXED 0x12 +# define EVP_CTRL_GCM_SET_IVLEN EVP_CTRL_AEAD_SET_IVLEN +# define EVP_CTRL_GCM_GET_TAG EVP_CTRL_AEAD_GET_TAG +# define EVP_CTRL_GCM_SET_TAG EVP_CTRL_AEAD_SET_TAG +# define EVP_CTRL_GCM_SET_IV_FIXED EVP_CTRL_AEAD_SET_IV_FIXED +# define EVP_CTRL_GCM_IV_GEN 0x13 +# define EVP_CTRL_CCM_SET_IVLEN EVP_CTRL_AEAD_SET_IVLEN +# define EVP_CTRL_CCM_GET_TAG EVP_CTRL_AEAD_GET_TAG +# define EVP_CTRL_CCM_SET_TAG EVP_CTRL_AEAD_SET_TAG +# define EVP_CTRL_CCM_SET_IV_FIXED EVP_CTRL_AEAD_SET_IV_FIXED +# define EVP_CTRL_CCM_SET_L 0x14 +# define EVP_CTRL_CCM_SET_MSGLEN 0x15 +/* + * AEAD cipher deduces payload length and returns number of bytes required to + * store MAC and eventual padding. Subsequent call to EVP_Cipher even + * appends/verifies MAC. + */ +# define EVP_CTRL_AEAD_TLS1_AAD 0x16 +/* Used by composite AEAD ciphers, no-op in GCM, CCM... */ +# define EVP_CTRL_AEAD_SET_MAC_KEY 0x17 +/* Set the GCM invocation field, decrypt only */ +# define EVP_CTRL_GCM_SET_IV_INV 0x18 + +# define EVP_CTRL_TLS1_1_MULTIBLOCK_AAD 0x19 +# define EVP_CTRL_TLS1_1_MULTIBLOCK_ENCRYPT 0x1a +# define EVP_CTRL_TLS1_1_MULTIBLOCK_DECRYPT 0x1b +# define EVP_CTRL_TLS1_1_MULTIBLOCK_MAX_BUFSIZE 0x1c + +# define EVP_CTRL_SSL3_MASTER_SECRET 0x1d + +/* EVP_CTRL_SET_SBOX takes the char * specifying S-boxes */ +# define EVP_CTRL_SET_SBOX 0x1e +/* + * EVP_CTRL_SBOX_USED takes a 'size_t' and 'char *', pointing at a + * pre-allocated buffer with specified size + */ +# define EVP_CTRL_SBOX_USED 0x1f +/* EVP_CTRL_KEY_MESH takes 'size_t' number of bytes to mesh the key after, + * 0 switches meshing off + */ +# define EVP_CTRL_KEY_MESH 0x20 +/* EVP_CTRL_BLOCK_PADDING_MODE takes the padding mode */ +# define EVP_CTRL_BLOCK_PADDING_MODE 0x21 + +/* Set the output buffers to use for a pipelined operation */ +# define EVP_CTRL_SET_PIPELINE_OUTPUT_BUFS 0x22 +/* Set the input buffers to use for a pipelined operation */ +# define EVP_CTRL_SET_PIPELINE_INPUT_BUFS 0x23 +/* Set the input buffer lengths to use for a pipelined operation */ +# define EVP_CTRL_SET_PIPELINE_INPUT_LENS 0x24 + +# define EVP_CTRL_GET_IVLEN 0x25 + +/* Padding modes */ +#define EVP_PADDING_PKCS7 1 +#define EVP_PADDING_ISO7816_4 2 +#define EVP_PADDING_ANSI923 3 +#define EVP_PADDING_ISO10126 4 +#define EVP_PADDING_ZERO 5 + +/* RFC 5246 defines additional data to be 13 bytes in length */ +# define EVP_AEAD_TLS1_AAD_LEN 13 + +typedef struct { + unsigned char *out; + const unsigned char *inp; + size_t len; + unsigned int interleave; +} EVP_CTRL_TLS1_1_MULTIBLOCK_PARAM; + +/* GCM TLS constants */ +/* Length of fixed part of IV derived from PRF */ +# define EVP_GCM_TLS_FIXED_IV_LEN 4 +/* Length of explicit part of IV part of TLS records */ +# define EVP_GCM_TLS_EXPLICIT_IV_LEN 8 +/* Length of tag for TLS */ +# define EVP_GCM_TLS_TAG_LEN 16 + +/* CCM TLS constants */ +/* Length of fixed part of IV derived from PRF */ +# define EVP_CCM_TLS_FIXED_IV_LEN 4 +/* Length of explicit part of IV part of TLS records */ +# define EVP_CCM_TLS_EXPLICIT_IV_LEN 8 +/* Total length of CCM IV length for TLS */ +# define EVP_CCM_TLS_IV_LEN 12 +/* Length of tag for TLS */ +# define EVP_CCM_TLS_TAG_LEN 16 +/* Length of CCM8 tag for TLS */ +# define EVP_CCM8_TLS_TAG_LEN 8 + +/* Length of tag for TLS */ +# define EVP_CHACHAPOLY_TLS_TAG_LEN 16 + +typedef struct evp_cipher_info_st { + const EVP_CIPHER *cipher; + unsigned char iv[EVP_MAX_IV_LENGTH]; +} EVP_CIPHER_INFO; + + +/* Password based encryption function */ +typedef int (EVP_PBE_KEYGEN) (EVP_CIPHER_CTX *ctx, const char *pass, + int passlen, ASN1_TYPE *param, + const EVP_CIPHER *cipher, const EVP_MD *md, + int en_de); + +# ifndef OPENSSL_NO_RSA +# define EVP_PKEY_assign_RSA(pkey,rsa) EVP_PKEY_assign((pkey),EVP_PKEY_RSA,\ + (char *)(rsa)) +# endif + +# ifndef OPENSSL_NO_DSA +# define EVP_PKEY_assign_DSA(pkey,dsa) EVP_PKEY_assign((pkey),EVP_PKEY_DSA,\ + (char *)(dsa)) +# endif + +# ifndef OPENSSL_NO_DH +# define EVP_PKEY_assign_DH(pkey,dh) EVP_PKEY_assign((pkey),EVP_PKEY_DH,\ + (char *)(dh)) +# endif + +# ifndef OPENSSL_NO_EC +# define EVP_PKEY_assign_EC_KEY(pkey,eckey) EVP_PKEY_assign((pkey),EVP_PKEY_EC,\ + (char *)(eckey)) +# endif +# ifndef OPENSSL_NO_SIPHASH +# define EVP_PKEY_assign_SIPHASH(pkey,shkey) EVP_PKEY_assign((pkey),EVP_PKEY_SIPHASH,\ + (char *)(shkey)) +# endif + +# ifndef OPENSSL_NO_POLY1305 +# define EVP_PKEY_assign_POLY1305(pkey,polykey) EVP_PKEY_assign((pkey),EVP_PKEY_POLY1305,\ + (char *)(polykey)) +# endif + +/* Add some extra combinations */ +# define EVP_get_digestbynid(a) EVP_get_digestbyname(OBJ_nid2sn(a)) +# define EVP_get_digestbyobj(a) EVP_get_digestbynid(OBJ_obj2nid(a)) +# define EVP_get_cipherbynid(a) EVP_get_cipherbyname(OBJ_nid2sn(a)) +# define EVP_get_cipherbyobj(a) EVP_get_cipherbynid(OBJ_obj2nid(a)) + +int EVP_MD_type(const EVP_MD *md); +# define EVP_MD_nid(e) EVP_MD_type(e) +# define EVP_MD_name(e) OBJ_nid2sn(EVP_MD_nid(e)) +int EVP_MD_pkey_type(const EVP_MD *md); +int EVP_MD_size(const EVP_MD *md); +int EVP_MD_block_size(const EVP_MD *md); +unsigned long EVP_MD_flags(const EVP_MD *md); + +const EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx); +int (*EVP_MD_CTX_update_fn(EVP_MD_CTX *ctx))(EVP_MD_CTX *ctx, + const void *data, size_t count); +void EVP_MD_CTX_set_update_fn(EVP_MD_CTX *ctx, + int (*update) (EVP_MD_CTX *ctx, + const void *data, size_t count)); +# define EVP_MD_CTX_size(e) EVP_MD_size(EVP_MD_CTX_md(e)) +# define EVP_MD_CTX_block_size(e) EVP_MD_block_size(EVP_MD_CTX_md(e)) +# define EVP_MD_CTX_type(e) EVP_MD_type(EVP_MD_CTX_md(e)) +EVP_PKEY_CTX *EVP_MD_CTX_pkey_ctx(const EVP_MD_CTX *ctx); +void EVP_MD_CTX_set_pkey_ctx(EVP_MD_CTX *ctx, EVP_PKEY_CTX *pctx); +void *EVP_MD_CTX_md_data(const EVP_MD_CTX *ctx); + +int EVP_CIPHER_nid(const EVP_CIPHER *cipher); +# define EVP_CIPHER_name(e) OBJ_nid2sn(EVP_CIPHER_nid(e)) +int EVP_CIPHER_block_size(const EVP_CIPHER *cipher); +int EVP_CIPHER_impl_ctx_size(const EVP_CIPHER *cipher); +int EVP_CIPHER_key_length(const EVP_CIPHER *cipher); +int EVP_CIPHER_iv_length(const EVP_CIPHER *cipher); +unsigned long EVP_CIPHER_flags(const EVP_CIPHER *cipher); +# define EVP_CIPHER_mode(e) (EVP_CIPHER_flags(e) & EVP_CIPH_MODE) + +const EVP_CIPHER *EVP_CIPHER_CTX_cipher(const EVP_CIPHER_CTX *ctx); +int EVP_CIPHER_CTX_encrypting(const EVP_CIPHER_CTX *ctx); +int EVP_CIPHER_CTX_nid(const EVP_CIPHER_CTX *ctx); +int EVP_CIPHER_CTX_block_size(const EVP_CIPHER_CTX *ctx); +int EVP_CIPHER_CTX_key_length(const EVP_CIPHER_CTX *ctx); +int EVP_CIPHER_CTX_iv_length(const EVP_CIPHER_CTX *ctx); +const unsigned char *EVP_CIPHER_CTX_iv(const EVP_CIPHER_CTX *ctx); +const unsigned char *EVP_CIPHER_CTX_original_iv(const EVP_CIPHER_CTX *ctx); +unsigned char *EVP_CIPHER_CTX_iv_noconst(EVP_CIPHER_CTX *ctx); +unsigned char *EVP_CIPHER_CTX_buf_noconst(EVP_CIPHER_CTX *ctx); +int EVP_CIPHER_CTX_num(const EVP_CIPHER_CTX *ctx); +void EVP_CIPHER_CTX_set_num(EVP_CIPHER_CTX *ctx, int num); +int EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, const EVP_CIPHER_CTX *in); +void *EVP_CIPHER_CTX_get_app_data(const EVP_CIPHER_CTX *ctx); +void EVP_CIPHER_CTX_set_app_data(EVP_CIPHER_CTX *ctx, void *data); +void *EVP_CIPHER_CTX_get_cipher_data(const EVP_CIPHER_CTX *ctx); +void *EVP_CIPHER_CTX_set_cipher_data(EVP_CIPHER_CTX *ctx, void *cipher_data); +# define EVP_CIPHER_CTX_type(c) EVP_CIPHER_type(EVP_CIPHER_CTX_cipher(c)) +# if OPENSSL_API_COMPAT < 0x10100000L +# define EVP_CIPHER_CTX_flags(c) EVP_CIPHER_flags(EVP_CIPHER_CTX_cipher(c)) +# endif +# define EVP_CIPHER_CTX_mode(c) EVP_CIPHER_mode(EVP_CIPHER_CTX_cipher(c)) + +# define EVP_ENCODE_LENGTH(l) ((((l)+2)/3*4)+((l)/48+1)*2+80) +# define EVP_DECODE_LENGTH(l) (((l)+3)/4*3+80) + +# define EVP_SignInit_ex(a,b,c) EVP_DigestInit_ex(a,b,c) +# define EVP_SignInit(a,b) EVP_DigestInit(a,b) +# define EVP_SignUpdate(a,b,c) EVP_DigestUpdate(a,b,c) +# define EVP_VerifyInit_ex(a,b,c) EVP_DigestInit_ex(a,b,c) +# define EVP_VerifyInit(a,b) EVP_DigestInit(a,b) +# define EVP_VerifyUpdate(a,b,c) EVP_DigestUpdate(a,b,c) +# define EVP_OpenUpdate(a,b,c,d,e) EVP_DecryptUpdate(a,b,c,d,e) +# define EVP_SealUpdate(a,b,c,d,e) EVP_EncryptUpdate(a,b,c,d,e) +# define EVP_DigestSignUpdate(a,b,c) EVP_DigestUpdate(a,b,c) +# define EVP_DigestVerifyUpdate(a,b,c) EVP_DigestUpdate(a,b,c) + +# ifdef CONST_STRICT +void BIO_set_md(BIO *, const EVP_MD *md); +# else +# define BIO_set_md(b,md) BIO_ctrl(b,BIO_C_SET_MD,0,(char *)(md)) +# endif +# define BIO_get_md(b,mdp) BIO_ctrl(b,BIO_C_GET_MD,0,(char *)(mdp)) +# define BIO_get_md_ctx(b,mdcp) BIO_ctrl(b,BIO_C_GET_MD_CTX,0, \ + (char *)(mdcp)) +# define BIO_set_md_ctx(b,mdcp) BIO_ctrl(b,BIO_C_SET_MD_CTX,0, \ + (char *)(mdcp)) +# define BIO_get_cipher_status(b) BIO_ctrl(b,BIO_C_GET_CIPHER_STATUS,0,NULL) +# define BIO_get_cipher_ctx(b,c_pp) BIO_ctrl(b,BIO_C_GET_CIPHER_CTX,0, \ + (char *)(c_pp)) + +/*__owur*/ int EVP_Cipher(EVP_CIPHER_CTX *c, + unsigned char *out, + const unsigned char *in, unsigned int inl); + +# define EVP_add_cipher_alias(n,alias) \ + OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n)) +# define EVP_add_digest_alias(n,alias) \ + OBJ_NAME_add((alias),OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS,(n)) +# define EVP_delete_cipher_alias(alias) \ + OBJ_NAME_remove(alias,OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS); +# define EVP_delete_digest_alias(alias) \ + OBJ_NAME_remove(alias,OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS); + +int EVP_MD_CTX_ctrl(EVP_MD_CTX *ctx, int cmd, int p1, void *p2); +EVP_MD_CTX *EVP_MD_CTX_new(void); +int EVP_MD_CTX_reset(EVP_MD_CTX *ctx); +void EVP_MD_CTX_free(EVP_MD_CTX *ctx); +# define EVP_MD_CTX_create() EVP_MD_CTX_new() +# define EVP_MD_CTX_init(ctx) EVP_MD_CTX_reset((ctx)) +# define EVP_MD_CTX_destroy(ctx) EVP_MD_CTX_free((ctx)) +__owur int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out, const EVP_MD_CTX *in); +void EVP_MD_CTX_set_flags(EVP_MD_CTX *ctx, int flags); +void EVP_MD_CTX_clear_flags(EVP_MD_CTX *ctx, int flags); +int EVP_MD_CTX_test_flags(const EVP_MD_CTX *ctx, int flags); +__owur int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, + ENGINE *impl); +__owur int EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *d, + size_t cnt); +__owur int EVP_DigestFinal_ex(EVP_MD_CTX *ctx, unsigned char *md, + unsigned int *s); +__owur int EVP_Digest(const void *data, size_t count, + unsigned char *md, unsigned int *size, + const EVP_MD *type, ENGINE *impl); + +__owur int EVP_MD_CTX_copy(EVP_MD_CTX *out, const EVP_MD_CTX *in); +__owur int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type); +__owur int EVP_DigestFinal(EVP_MD_CTX *ctx, unsigned char *md, + unsigned int *s); +__owur int EVP_DigestFinalXOF(EVP_MD_CTX *ctx, unsigned char *md, + size_t len); + +int EVP_read_pw_string(char *buf, int length, const char *prompt, int verify); +int EVP_read_pw_string_min(char *buf, int minlen, int maxlen, + const char *prompt, int verify); +void EVP_set_pw_prompt(const char *prompt); +char *EVP_get_pw_prompt(void); + +__owur int EVP_BytesToKey(const EVP_CIPHER *type, const EVP_MD *md, + const unsigned char *salt, + const unsigned char *data, int datal, int count, + unsigned char *key, unsigned char *iv); + +void EVP_CIPHER_CTX_set_flags(EVP_CIPHER_CTX *ctx, int flags); +void EVP_CIPHER_CTX_clear_flags(EVP_CIPHER_CTX *ctx, int flags); +int EVP_CIPHER_CTX_test_flags(const EVP_CIPHER_CTX *ctx, int flags); + +__owur int EVP_EncryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, + const unsigned char *key, const unsigned char *iv); +/*__owur*/ int EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx, + const EVP_CIPHER *cipher, ENGINE *impl, + const unsigned char *key, + const unsigned char *iv); +/*__owur*/ int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, + int *outl, const unsigned char *in, int inl); +/*__owur*/ int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, + int *outl); +/*__owur*/ int EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, + int *outl); + +__owur int EVP_DecryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, + const unsigned char *key, const unsigned char *iv); +/*__owur*/ int EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx, + const EVP_CIPHER *cipher, ENGINE *impl, + const unsigned char *key, + const unsigned char *iv); +/*__owur*/ int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, + int *outl, const unsigned char *in, int inl); +__owur int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, + int *outl); +/*__owur*/ int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, + int *outl); + +__owur int EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, + const unsigned char *key, const unsigned char *iv, + int enc); +/*__owur*/ int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, + const EVP_CIPHER *cipher, ENGINE *impl, + const unsigned char *key, + const unsigned char *iv, int enc); +__owur int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, + int *outl, const unsigned char *in, int inl); +__owur int EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, + int *outl); +__owur int EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, + int *outl); + +__owur int EVP_SignFinal(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *s, + EVP_PKEY *pkey); + +__owur int EVP_DigestSign(EVP_MD_CTX *ctx, unsigned char *sigret, + size_t *siglen, const unsigned char *tbs, + size_t tbslen); + +__owur int EVP_VerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sigbuf, + unsigned int siglen, EVP_PKEY *pkey); + +__owur int EVP_DigestVerify(EVP_MD_CTX *ctx, const unsigned char *sigret, + size_t siglen, const unsigned char *tbs, + size_t tbslen); + +/*__owur*/ int EVP_DigestSignInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, + const EVP_MD *type, ENGINE *e, + EVP_PKEY *pkey); +__owur int EVP_DigestSignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, + size_t *siglen); + +__owur int EVP_DigestVerifyInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, + const EVP_MD *type, ENGINE *e, + EVP_PKEY *pkey); +__owur int EVP_DigestVerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sig, + size_t siglen); + +# ifndef OPENSSL_NO_RSA +__owur int EVP_OpenInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, + const unsigned char *ek, int ekl, + const unsigned char *iv, EVP_PKEY *priv); +__owur int EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); + +__owur int EVP_SealInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, + unsigned char **ek, int *ekl, unsigned char *iv, + EVP_PKEY **pubk, int npubk); +__owur int EVP_SealFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); +# endif + +EVP_ENCODE_CTX *EVP_ENCODE_CTX_new(void); +void EVP_ENCODE_CTX_free(EVP_ENCODE_CTX *ctx); +int EVP_ENCODE_CTX_copy(EVP_ENCODE_CTX *dctx, EVP_ENCODE_CTX *sctx); +int EVP_ENCODE_CTX_num(EVP_ENCODE_CTX *ctx); +void EVP_EncodeInit(EVP_ENCODE_CTX *ctx); +int EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, + const unsigned char *in, int inl); +void EVP_EncodeFinal(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl); +int EVP_EncodeBlock(unsigned char *t, const unsigned char *f, int n); + +void EVP_DecodeInit(EVP_ENCODE_CTX *ctx); +int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, + const unsigned char *in, int inl); +int EVP_DecodeFinal(EVP_ENCODE_CTX *ctx, unsigned + char *out, int *outl); +int EVP_DecodeBlock(unsigned char *t, const unsigned char *f, int n); + +# if OPENSSL_API_COMPAT < 0x10100000L +# define EVP_CIPHER_CTX_init(c) EVP_CIPHER_CTX_reset(c) +# define EVP_CIPHER_CTX_cleanup(c) EVP_CIPHER_CTX_reset(c) +# endif +EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void); +int EVP_CIPHER_CTX_reset(EVP_CIPHER_CTX *c); +void EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *c); +int EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *x, int keylen); +int EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *c, int pad); +int EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr); +int EVP_CIPHER_CTX_rand_key(EVP_CIPHER_CTX *ctx, unsigned char *key); + +const BIO_METHOD *BIO_f_md(void); +const BIO_METHOD *BIO_f_base64(void); +const BIO_METHOD *BIO_f_cipher(void); +const BIO_METHOD *BIO_f_reliable(void); +__owur int BIO_set_cipher(BIO *b, const EVP_CIPHER *c, const unsigned char *k, + const unsigned char *i, int enc); + +const EVP_MD *EVP_md_null(void); +# ifndef OPENSSL_NO_MD2 +const EVP_MD *EVP_md2(void); +# endif +# ifndef OPENSSL_NO_MD4 +const EVP_MD *EVP_md4(void); +# endif +# ifndef OPENSSL_NO_MD5 +const EVP_MD *EVP_md5(void); +const EVP_MD *EVP_md5_sha1(void); +# endif +# ifndef OPENSSL_NO_BLAKE2 +const EVP_MD *EVP_blake2b512(void); +const EVP_MD *EVP_blake2s256(void); +# endif +const EVP_MD *EVP_sha1(void); +const EVP_MD *EVP_sha224(void); +const EVP_MD *EVP_sha256(void); +const EVP_MD *EVP_sha384(void); +const EVP_MD *EVP_sha512(void); +const EVP_MD *EVP_sha512_224(void); +const EVP_MD *EVP_sha512_256(void); +const EVP_MD *EVP_sha3_224(void); +const EVP_MD *EVP_sha3_256(void); +const EVP_MD *EVP_sha3_384(void); +const EVP_MD *EVP_sha3_512(void); +const EVP_MD *EVP_shake128(void); +const EVP_MD *EVP_shake256(void); +# ifndef OPENSSL_NO_MDC2 +const EVP_MD *EVP_mdc2(void); +# endif +# ifndef OPENSSL_NO_RMD160 +const EVP_MD *EVP_ripemd160(void); +# endif +# ifndef OPENSSL_NO_WHIRLPOOL +const EVP_MD *EVP_whirlpool(void); +# endif +# ifndef OPENSSL_NO_SM3 +const EVP_MD *EVP_sm3(void); +# endif +const EVP_CIPHER *EVP_enc_null(void); /* does nothing :-) */ +# ifndef OPENSSL_NO_DES +const EVP_CIPHER *EVP_des_ecb(void); +const EVP_CIPHER *EVP_des_ede(void); +const EVP_CIPHER *EVP_des_ede3(void); +const EVP_CIPHER *EVP_des_ede_ecb(void); +const EVP_CIPHER *EVP_des_ede3_ecb(void); +const EVP_CIPHER *EVP_des_cfb64(void); +# define EVP_des_cfb EVP_des_cfb64 +const EVP_CIPHER *EVP_des_cfb1(void); +const EVP_CIPHER *EVP_des_cfb8(void); +const EVP_CIPHER *EVP_des_ede_cfb64(void); +# define EVP_des_ede_cfb EVP_des_ede_cfb64 +const EVP_CIPHER *EVP_des_ede3_cfb64(void); +# define EVP_des_ede3_cfb EVP_des_ede3_cfb64 +const EVP_CIPHER *EVP_des_ede3_cfb1(void); +const EVP_CIPHER *EVP_des_ede3_cfb8(void); +const EVP_CIPHER *EVP_des_ofb(void); +const EVP_CIPHER *EVP_des_ede_ofb(void); +const EVP_CIPHER *EVP_des_ede3_ofb(void); +const EVP_CIPHER *EVP_des_cbc(void); +const EVP_CIPHER *EVP_des_ede_cbc(void); +const EVP_CIPHER *EVP_des_ede3_cbc(void); +const EVP_CIPHER *EVP_desx_cbc(void); +const EVP_CIPHER *EVP_des_ede3_wrap(void); +/* + * This should now be supported through the dev_crypto ENGINE. But also, why + * are rc4 and md5 declarations made here inside a "NO_DES" precompiler + * branch? + */ +# endif +# ifndef OPENSSL_NO_RC4 +const EVP_CIPHER *EVP_rc4(void); +const EVP_CIPHER *EVP_rc4_40(void); +# ifndef OPENSSL_NO_MD5 +const EVP_CIPHER *EVP_rc4_hmac_md5(void); +# endif +# endif +# ifndef OPENSSL_NO_IDEA +const EVP_CIPHER *EVP_idea_ecb(void); +const EVP_CIPHER *EVP_idea_cfb64(void); +# define EVP_idea_cfb EVP_idea_cfb64 +const EVP_CIPHER *EVP_idea_ofb(void); +const EVP_CIPHER *EVP_idea_cbc(void); +# endif +# ifndef OPENSSL_NO_RC2 +const EVP_CIPHER *EVP_rc2_ecb(void); +const EVP_CIPHER *EVP_rc2_cbc(void); +const EVP_CIPHER *EVP_rc2_40_cbc(void); +const EVP_CIPHER *EVP_rc2_64_cbc(void); +const EVP_CIPHER *EVP_rc2_cfb64(void); +# define EVP_rc2_cfb EVP_rc2_cfb64 +const EVP_CIPHER *EVP_rc2_ofb(void); +# endif +# ifndef OPENSSL_NO_BF +const EVP_CIPHER *EVP_bf_ecb(void); +const EVP_CIPHER *EVP_bf_cbc(void); +const EVP_CIPHER *EVP_bf_cfb64(void); +# define EVP_bf_cfb EVP_bf_cfb64 +const EVP_CIPHER *EVP_bf_ofb(void); +# endif +# ifndef OPENSSL_NO_CAST +const EVP_CIPHER *EVP_cast5_ecb(void); +const EVP_CIPHER *EVP_cast5_cbc(void); +const EVP_CIPHER *EVP_cast5_cfb64(void); +# define EVP_cast5_cfb EVP_cast5_cfb64 +const EVP_CIPHER *EVP_cast5_ofb(void); +# endif +# ifndef OPENSSL_NO_RC5 +const EVP_CIPHER *EVP_rc5_32_12_16_cbc(void); +const EVP_CIPHER *EVP_rc5_32_12_16_ecb(void); +const EVP_CIPHER *EVP_rc5_32_12_16_cfb64(void); +# define EVP_rc5_32_12_16_cfb EVP_rc5_32_12_16_cfb64 +const EVP_CIPHER *EVP_rc5_32_12_16_ofb(void); +# endif +const EVP_CIPHER *EVP_aes_128_ecb(void); +const EVP_CIPHER *EVP_aes_128_cbc(void); +const EVP_CIPHER *EVP_aes_128_cfb1(void); +const EVP_CIPHER *EVP_aes_128_cfb8(void); +const EVP_CIPHER *EVP_aes_128_cfb128(void); +# define EVP_aes_128_cfb EVP_aes_128_cfb128 +const EVP_CIPHER *EVP_aes_128_ofb(void); +const EVP_CIPHER *EVP_aes_128_ctr(void); +const EVP_CIPHER *EVP_aes_128_ccm(void); +const EVP_CIPHER *EVP_aes_128_gcm(void); +const EVP_CIPHER *EVP_aes_128_xts(void); +const EVP_CIPHER *EVP_aes_128_wrap(void); +const EVP_CIPHER *EVP_aes_128_wrap_pad(void); +# ifndef OPENSSL_NO_OCB +const EVP_CIPHER *EVP_aes_128_ocb(void); +# endif +const EVP_CIPHER *EVP_aes_192_ecb(void); +const EVP_CIPHER *EVP_aes_192_cbc(void); +const EVP_CIPHER *EVP_aes_192_cfb1(void); +const EVP_CIPHER *EVP_aes_192_cfb8(void); +const EVP_CIPHER *EVP_aes_192_cfb128(void); +# define EVP_aes_192_cfb EVP_aes_192_cfb128 +const EVP_CIPHER *EVP_aes_192_ofb(void); +const EVP_CIPHER *EVP_aes_192_ctr(void); +const EVP_CIPHER *EVP_aes_192_ccm(void); +const EVP_CIPHER *EVP_aes_192_gcm(void); +const EVP_CIPHER *EVP_aes_192_wrap(void); +const EVP_CIPHER *EVP_aes_192_wrap_pad(void); +# ifndef OPENSSL_NO_OCB +const EVP_CIPHER *EVP_aes_192_ocb(void); +# endif +const EVP_CIPHER *EVP_aes_256_ecb(void); +const EVP_CIPHER *EVP_aes_256_cbc(void); +const EVP_CIPHER *EVP_aes_256_cfb1(void); +const EVP_CIPHER *EVP_aes_256_cfb8(void); +const EVP_CIPHER *EVP_aes_256_cfb128(void); +# define EVP_aes_256_cfb EVP_aes_256_cfb128 +const EVP_CIPHER *EVP_aes_256_ofb(void); +const EVP_CIPHER *EVP_aes_256_ctr(void); +const EVP_CIPHER *EVP_aes_256_ccm(void); +const EVP_CIPHER *EVP_aes_256_gcm(void); +const EVP_CIPHER *EVP_aes_256_xts(void); +const EVP_CIPHER *EVP_aes_256_wrap(void); +const EVP_CIPHER *EVP_aes_256_wrap_pad(void); +# ifndef OPENSSL_NO_OCB +const EVP_CIPHER *EVP_aes_256_ocb(void); +# endif +const EVP_CIPHER *EVP_aes_128_cbc_hmac_sha1(void); +const EVP_CIPHER *EVP_aes_256_cbc_hmac_sha1(void); +const EVP_CIPHER *EVP_aes_128_cbc_hmac_sha256(void); +const EVP_CIPHER *EVP_aes_256_cbc_hmac_sha256(void); +# ifndef OPENSSL_NO_ARIA +const EVP_CIPHER *EVP_aria_128_ecb(void); +const EVP_CIPHER *EVP_aria_128_cbc(void); +const EVP_CIPHER *EVP_aria_128_cfb1(void); +const EVP_CIPHER *EVP_aria_128_cfb8(void); +const EVP_CIPHER *EVP_aria_128_cfb128(void); +# define EVP_aria_128_cfb EVP_aria_128_cfb128 +const EVP_CIPHER *EVP_aria_128_ctr(void); +const EVP_CIPHER *EVP_aria_128_ofb(void); +const EVP_CIPHER *EVP_aria_128_gcm(void); +const EVP_CIPHER *EVP_aria_128_ccm(void); +const EVP_CIPHER *EVP_aria_192_ecb(void); +const EVP_CIPHER *EVP_aria_192_cbc(void); +const EVP_CIPHER *EVP_aria_192_cfb1(void); +const EVP_CIPHER *EVP_aria_192_cfb8(void); +const EVP_CIPHER *EVP_aria_192_cfb128(void); +# define EVP_aria_192_cfb EVP_aria_192_cfb128 +const EVP_CIPHER *EVP_aria_192_ctr(void); +const EVP_CIPHER *EVP_aria_192_ofb(void); +const EVP_CIPHER *EVP_aria_192_gcm(void); +const EVP_CIPHER *EVP_aria_192_ccm(void); +const EVP_CIPHER *EVP_aria_256_ecb(void); +const EVP_CIPHER *EVP_aria_256_cbc(void); +const EVP_CIPHER *EVP_aria_256_cfb1(void); +const EVP_CIPHER *EVP_aria_256_cfb8(void); +const EVP_CIPHER *EVP_aria_256_cfb128(void); +# define EVP_aria_256_cfb EVP_aria_256_cfb128 +const EVP_CIPHER *EVP_aria_256_ctr(void); +const EVP_CIPHER *EVP_aria_256_ofb(void); +const EVP_CIPHER *EVP_aria_256_gcm(void); +const EVP_CIPHER *EVP_aria_256_ccm(void); +# endif +# ifndef OPENSSL_NO_CAMELLIA +const EVP_CIPHER *EVP_camellia_128_ecb(void); +const EVP_CIPHER *EVP_camellia_128_cbc(void); +const EVP_CIPHER *EVP_camellia_128_cfb1(void); +const EVP_CIPHER *EVP_camellia_128_cfb8(void); +const EVP_CIPHER *EVP_camellia_128_cfb128(void); +# define EVP_camellia_128_cfb EVP_camellia_128_cfb128 +const EVP_CIPHER *EVP_camellia_128_ofb(void); +const EVP_CIPHER *EVP_camellia_128_ctr(void); +const EVP_CIPHER *EVP_camellia_192_ecb(void); +const EVP_CIPHER *EVP_camellia_192_cbc(void); +const EVP_CIPHER *EVP_camellia_192_cfb1(void); +const EVP_CIPHER *EVP_camellia_192_cfb8(void); +const EVP_CIPHER *EVP_camellia_192_cfb128(void); +# define EVP_camellia_192_cfb EVP_camellia_192_cfb128 +const EVP_CIPHER *EVP_camellia_192_ofb(void); +const EVP_CIPHER *EVP_camellia_192_ctr(void); +const EVP_CIPHER *EVP_camellia_256_ecb(void); +const EVP_CIPHER *EVP_camellia_256_cbc(void); +const EVP_CIPHER *EVP_camellia_256_cfb1(void); +const EVP_CIPHER *EVP_camellia_256_cfb8(void); +const EVP_CIPHER *EVP_camellia_256_cfb128(void); +# define EVP_camellia_256_cfb EVP_camellia_256_cfb128 +const EVP_CIPHER *EVP_camellia_256_ofb(void); +const EVP_CIPHER *EVP_camellia_256_ctr(void); +# endif +# ifndef OPENSSL_NO_CHACHA +const EVP_CIPHER *EVP_chacha20(void); +# ifndef OPENSSL_NO_POLY1305 +const EVP_CIPHER *EVP_chacha20_poly1305(void); +# endif +# endif + +# ifndef OPENSSL_NO_SEED +const EVP_CIPHER *EVP_seed_ecb(void); +const EVP_CIPHER *EVP_seed_cbc(void); +const EVP_CIPHER *EVP_seed_cfb128(void); +# define EVP_seed_cfb EVP_seed_cfb128 +const EVP_CIPHER *EVP_seed_ofb(void); +# endif + +# ifndef OPENSSL_NO_SM4 +const EVP_CIPHER *EVP_sm4_ecb(void); +const EVP_CIPHER *EVP_sm4_cbc(void); +const EVP_CIPHER *EVP_sm4_cfb128(void); +# define EVP_sm4_cfb EVP_sm4_cfb128 +const EVP_CIPHER *EVP_sm4_ofb(void); +const EVP_CIPHER *EVP_sm4_ctr(void); +# endif + +# if OPENSSL_API_COMPAT < 0x10100000L +# define OPENSSL_add_all_algorithms_conf() \ + OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS \ + | OPENSSL_INIT_ADD_ALL_DIGESTS \ + | OPENSSL_INIT_LOAD_CONFIG, NULL) +# define OPENSSL_add_all_algorithms_noconf() \ + OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS \ + | OPENSSL_INIT_ADD_ALL_DIGESTS, NULL) + +# ifdef OPENSSL_LOAD_CONF +# define OpenSSL_add_all_algorithms() OPENSSL_add_all_algorithms_conf() +# else +# define OpenSSL_add_all_algorithms() OPENSSL_add_all_algorithms_noconf() +# endif + +# define OpenSSL_add_all_ciphers() \ + OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS, NULL) +# define OpenSSL_add_all_digests() \ + OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_DIGESTS, NULL) + +# define EVP_cleanup() while(0) continue +# endif + +int EVP_add_cipher(const EVP_CIPHER *cipher); +int EVP_add_digest(const EVP_MD *digest); + +const EVP_CIPHER *EVP_get_cipherbyname(const char *name); +const EVP_MD *EVP_get_digestbyname(const char *name); + +void EVP_CIPHER_do_all(void (*fn) (const EVP_CIPHER *ciph, + const char *from, const char *to, void *x), + void *arg); +void EVP_CIPHER_do_all_sorted(void (*fn) + (const EVP_CIPHER *ciph, const char *from, + const char *to, void *x), void *arg); + +void EVP_MD_do_all(void (*fn) (const EVP_MD *ciph, + const char *from, const char *to, void *x), + void *arg); +void EVP_MD_do_all_sorted(void (*fn) + (const EVP_MD *ciph, const char *from, + const char *to, void *x), void *arg); + +int EVP_PKEY_decrypt_old(unsigned char *dec_key, + const unsigned char *enc_key, int enc_key_len, + EVP_PKEY *private_key); +int EVP_PKEY_encrypt_old(unsigned char *enc_key, + const unsigned char *key, int key_len, + EVP_PKEY *pub_key); +int EVP_PKEY_type(int type); +int EVP_PKEY_id(const EVP_PKEY *pkey); +int EVP_PKEY_base_id(const EVP_PKEY *pkey); +int EVP_PKEY_bits(const EVP_PKEY *pkey); +int EVP_PKEY_security_bits(const EVP_PKEY *pkey); +int EVP_PKEY_size(const EVP_PKEY *pkey); +int EVP_PKEY_set_type(EVP_PKEY *pkey, int type); +int EVP_PKEY_set_type_str(EVP_PKEY *pkey, const char *str, int len); +int EVP_PKEY_set_alias_type(EVP_PKEY *pkey, int type); +# ifndef OPENSSL_NO_ENGINE +int EVP_PKEY_set1_engine(EVP_PKEY *pkey, ENGINE *e); +ENGINE *EVP_PKEY_get0_engine(const EVP_PKEY *pkey); +# endif +int EVP_PKEY_assign(EVP_PKEY *pkey, int type, void *key); +void *EVP_PKEY_get0(const EVP_PKEY *pkey); +const unsigned char *EVP_PKEY_get0_hmac(const EVP_PKEY *pkey, size_t *len); +# ifndef OPENSSL_NO_POLY1305 +const unsigned char *EVP_PKEY_get0_poly1305(const EVP_PKEY *pkey, size_t *len); +# endif +# ifndef OPENSSL_NO_SIPHASH +const unsigned char *EVP_PKEY_get0_siphash(const EVP_PKEY *pkey, size_t *len); +# endif + +# ifndef OPENSSL_NO_RSA +struct rsa_st; +int EVP_PKEY_set1_RSA(EVP_PKEY *pkey, struct rsa_st *key); +struct rsa_st *EVP_PKEY_get0_RSA(EVP_PKEY *pkey); +struct rsa_st *EVP_PKEY_get1_RSA(EVP_PKEY *pkey); +# endif +# ifndef OPENSSL_NO_DSA +struct dsa_st; +int EVP_PKEY_set1_DSA(EVP_PKEY *pkey, struct dsa_st *key); +struct dsa_st *EVP_PKEY_get0_DSA(EVP_PKEY *pkey); +struct dsa_st *EVP_PKEY_get1_DSA(EVP_PKEY *pkey); +# endif +# ifndef OPENSSL_NO_DH +struct dh_st; +int EVP_PKEY_set1_DH(EVP_PKEY *pkey, struct dh_st *key); +struct dh_st *EVP_PKEY_get0_DH(EVP_PKEY *pkey); +struct dh_st *EVP_PKEY_get1_DH(EVP_PKEY *pkey); +# endif +# ifndef OPENSSL_NO_EC +struct ec_key_st; +int EVP_PKEY_set1_EC_KEY(EVP_PKEY *pkey, struct ec_key_st *key); +struct ec_key_st *EVP_PKEY_get0_EC_KEY(EVP_PKEY *pkey); +struct ec_key_st *EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey); +# endif + +EVP_PKEY *EVP_PKEY_new(void); +int EVP_PKEY_up_ref(EVP_PKEY *pkey); +void EVP_PKEY_free(EVP_PKEY *pkey); + +EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, const unsigned char **pp, + long length); +int i2d_PublicKey(EVP_PKEY *a, unsigned char **pp); + +EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, const unsigned char **pp, + long length); +EVP_PKEY *d2i_AutoPrivateKey(EVP_PKEY **a, const unsigned char **pp, + long length); +int i2d_PrivateKey(EVP_PKEY *a, unsigned char **pp); + +int EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from); +int EVP_PKEY_missing_parameters(const EVP_PKEY *pkey); +int EVP_PKEY_save_parameters(EVP_PKEY *pkey, int mode); +int EVP_PKEY_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b); + +int EVP_PKEY_cmp(const EVP_PKEY *a, const EVP_PKEY *b); + +int EVP_PKEY_print_public(BIO *out, const EVP_PKEY *pkey, + int indent, ASN1_PCTX *pctx); +int EVP_PKEY_print_private(BIO *out, const EVP_PKEY *pkey, + int indent, ASN1_PCTX *pctx); +int EVP_PKEY_print_params(BIO *out, const EVP_PKEY *pkey, + int indent, ASN1_PCTX *pctx); + +int EVP_PKEY_get_default_digest_nid(EVP_PKEY *pkey, int *pnid); + +int EVP_PKEY_set1_tls_encodedpoint(EVP_PKEY *pkey, + const unsigned char *pt, size_t ptlen); +size_t EVP_PKEY_get1_tls_encodedpoint(EVP_PKEY *pkey, unsigned char **ppt); + +int EVP_CIPHER_type(const EVP_CIPHER *ctx); + +/* calls methods */ +int EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *c, ASN1_TYPE *type); +int EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *c, ASN1_TYPE *type); + +/* These are used by EVP_CIPHER methods */ +int EVP_CIPHER_set_asn1_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type); +int EVP_CIPHER_get_asn1_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type); + +/* PKCS5 password based encryption */ +int PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, + ASN1_TYPE *param, const EVP_CIPHER *cipher, + const EVP_MD *md, int en_de); +int PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen, + const unsigned char *salt, int saltlen, int iter, + int keylen, unsigned char *out); +int PKCS5_PBKDF2_HMAC(const char *pass, int passlen, + const unsigned char *salt, int saltlen, int iter, + const EVP_MD *digest, int keylen, unsigned char *out); +int PKCS5_v2_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, + ASN1_TYPE *param, const EVP_CIPHER *cipher, + const EVP_MD *md, int en_de); + +#ifndef OPENSSL_NO_SCRYPT +int EVP_PBE_scrypt(const char *pass, size_t passlen, + const unsigned char *salt, size_t saltlen, + uint64_t N, uint64_t r, uint64_t p, uint64_t maxmem, + unsigned char *key, size_t keylen); + +int PKCS5_v2_scrypt_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, + int passlen, ASN1_TYPE *param, + const EVP_CIPHER *c, const EVP_MD *md, int en_de); +#endif + +void PKCS5_PBE_add(void); + +int EVP_PBE_CipherInit(ASN1_OBJECT *pbe_obj, const char *pass, int passlen, + ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de); + +/* PBE type */ + +/* Can appear as the outermost AlgorithmIdentifier */ +# define EVP_PBE_TYPE_OUTER 0x0 +/* Is an PRF type OID */ +# define EVP_PBE_TYPE_PRF 0x1 +/* Is a PKCS#5 v2.0 KDF */ +# define EVP_PBE_TYPE_KDF 0x2 + +int EVP_PBE_alg_add_type(int pbe_type, int pbe_nid, int cipher_nid, + int md_nid, EVP_PBE_KEYGEN *keygen); +int EVP_PBE_alg_add(int nid, const EVP_CIPHER *cipher, const EVP_MD *md, + EVP_PBE_KEYGEN *keygen); +int EVP_PBE_find(int type, int pbe_nid, int *pcnid, int *pmnid, + EVP_PBE_KEYGEN **pkeygen); +void EVP_PBE_cleanup(void); +int EVP_PBE_get(int *ptype, int *ppbe_nid, size_t num); + +# define ASN1_PKEY_ALIAS 0x1 +# define ASN1_PKEY_DYNAMIC 0x2 +# define ASN1_PKEY_SIGPARAM_NULL 0x4 + +# define ASN1_PKEY_CTRL_PKCS7_SIGN 0x1 +# define ASN1_PKEY_CTRL_PKCS7_ENCRYPT 0x2 +# define ASN1_PKEY_CTRL_DEFAULT_MD_NID 0x3 +# define ASN1_PKEY_CTRL_CMS_SIGN 0x5 +# define ASN1_PKEY_CTRL_CMS_ENVELOPE 0x7 +# define ASN1_PKEY_CTRL_CMS_RI_TYPE 0x8 + +# define ASN1_PKEY_CTRL_SET1_TLS_ENCPT 0x9 +# define ASN1_PKEY_CTRL_GET1_TLS_ENCPT 0xa + +int EVP_PKEY_asn1_get_count(void); +const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_get0(int idx); +const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find(ENGINE **pe, int type); +const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find_str(ENGINE **pe, + const char *str, int len); +int EVP_PKEY_asn1_add0(const EVP_PKEY_ASN1_METHOD *ameth); +int EVP_PKEY_asn1_add_alias(int to, int from); +int EVP_PKEY_asn1_get0_info(int *ppkey_id, int *pkey_base_id, + int *ppkey_flags, const char **pinfo, + const char **ppem_str, + const EVP_PKEY_ASN1_METHOD *ameth); + +const EVP_PKEY_ASN1_METHOD *EVP_PKEY_get0_asn1(const EVP_PKEY *pkey); +EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_new(int id, int flags, + const char *pem_str, + const char *info); +void EVP_PKEY_asn1_copy(EVP_PKEY_ASN1_METHOD *dst, + const EVP_PKEY_ASN1_METHOD *src); +void EVP_PKEY_asn1_free(EVP_PKEY_ASN1_METHOD *ameth); +void EVP_PKEY_asn1_set_public(EVP_PKEY_ASN1_METHOD *ameth, + int (*pub_decode) (EVP_PKEY *pk, + X509_PUBKEY *pub), + int (*pub_encode) (X509_PUBKEY *pub, + const EVP_PKEY *pk), + int (*pub_cmp) (const EVP_PKEY *a, + const EVP_PKEY *b), + int (*pub_print) (BIO *out, + const EVP_PKEY *pkey, + int indent, ASN1_PCTX *pctx), + int (*pkey_size) (const EVP_PKEY *pk), + int (*pkey_bits) (const EVP_PKEY *pk)); +void EVP_PKEY_asn1_set_private(EVP_PKEY_ASN1_METHOD *ameth, + int (*priv_decode) (EVP_PKEY *pk, + const PKCS8_PRIV_KEY_INFO + *p8inf), + int (*priv_encode) (PKCS8_PRIV_KEY_INFO *p8, + const EVP_PKEY *pk), + int (*priv_print) (BIO *out, + const EVP_PKEY *pkey, + int indent, + ASN1_PCTX *pctx)); +void EVP_PKEY_asn1_set_param(EVP_PKEY_ASN1_METHOD *ameth, + int (*param_decode) (EVP_PKEY *pkey, + const unsigned char **pder, + int derlen), + int (*param_encode) (const EVP_PKEY *pkey, + unsigned char **pder), + int (*param_missing) (const EVP_PKEY *pk), + int (*param_copy) (EVP_PKEY *to, + const EVP_PKEY *from), + int (*param_cmp) (const EVP_PKEY *a, + const EVP_PKEY *b), + int (*param_print) (BIO *out, + const EVP_PKEY *pkey, + int indent, + ASN1_PCTX *pctx)); + +void EVP_PKEY_asn1_set_free(EVP_PKEY_ASN1_METHOD *ameth, + void (*pkey_free) (EVP_PKEY *pkey)); +void EVP_PKEY_asn1_set_ctrl(EVP_PKEY_ASN1_METHOD *ameth, + int (*pkey_ctrl) (EVP_PKEY *pkey, int op, + long arg1, void *arg2)); +void EVP_PKEY_asn1_set_item(EVP_PKEY_ASN1_METHOD *ameth, + int (*item_verify) (EVP_MD_CTX *ctx, + const ASN1_ITEM *it, + void *asn, + X509_ALGOR *a, + ASN1_BIT_STRING *sig, + EVP_PKEY *pkey), + int (*item_sign) (EVP_MD_CTX *ctx, + const ASN1_ITEM *it, + void *asn, + X509_ALGOR *alg1, + X509_ALGOR *alg2, + ASN1_BIT_STRING *sig)); + +void EVP_PKEY_asn1_set_siginf(EVP_PKEY_ASN1_METHOD *ameth, + int (*siginf_set) (X509_SIG_INFO *siginf, + const X509_ALGOR *alg, + const ASN1_STRING *sig)); + +void EVP_PKEY_asn1_set_check(EVP_PKEY_ASN1_METHOD *ameth, + int (*pkey_check) (const EVP_PKEY *pk)); + +void EVP_PKEY_asn1_set_public_check(EVP_PKEY_ASN1_METHOD *ameth, + int (*pkey_pub_check) (const EVP_PKEY *pk)); + +void EVP_PKEY_asn1_set_param_check(EVP_PKEY_ASN1_METHOD *ameth, + int (*pkey_param_check) (const EVP_PKEY *pk)); + +void EVP_PKEY_asn1_set_set_priv_key(EVP_PKEY_ASN1_METHOD *ameth, + int (*set_priv_key) (EVP_PKEY *pk, + const unsigned char + *priv, + size_t len)); +void EVP_PKEY_asn1_set_set_pub_key(EVP_PKEY_ASN1_METHOD *ameth, + int (*set_pub_key) (EVP_PKEY *pk, + const unsigned char *pub, + size_t len)); +void EVP_PKEY_asn1_set_get_priv_key(EVP_PKEY_ASN1_METHOD *ameth, + int (*get_priv_key) (const EVP_PKEY *pk, + unsigned char *priv, + size_t *len)); +void EVP_PKEY_asn1_set_get_pub_key(EVP_PKEY_ASN1_METHOD *ameth, + int (*get_pub_key) (const EVP_PKEY *pk, + unsigned char *pub, + size_t *len)); + +void EVP_PKEY_asn1_set_security_bits(EVP_PKEY_ASN1_METHOD *ameth, + int (*pkey_security_bits) (const EVP_PKEY + *pk)); + +# define EVP_PKEY_OP_UNDEFINED 0 +# define EVP_PKEY_OP_PARAMGEN (1<<1) +# define EVP_PKEY_OP_KEYGEN (1<<2) +# define EVP_PKEY_OP_SIGN (1<<3) +# define EVP_PKEY_OP_VERIFY (1<<4) +# define EVP_PKEY_OP_VERIFYRECOVER (1<<5) +# define EVP_PKEY_OP_SIGNCTX (1<<6) +# define EVP_PKEY_OP_VERIFYCTX (1<<7) +# define EVP_PKEY_OP_ENCRYPT (1<<8) +# define EVP_PKEY_OP_DECRYPT (1<<9) +# define EVP_PKEY_OP_DERIVE (1<<10) + +# define EVP_PKEY_OP_TYPE_SIG \ + (EVP_PKEY_OP_SIGN | EVP_PKEY_OP_VERIFY | EVP_PKEY_OP_VERIFYRECOVER \ + | EVP_PKEY_OP_SIGNCTX | EVP_PKEY_OP_VERIFYCTX) + +# define EVP_PKEY_OP_TYPE_CRYPT \ + (EVP_PKEY_OP_ENCRYPT | EVP_PKEY_OP_DECRYPT) + +# define EVP_PKEY_OP_TYPE_NOGEN \ + (EVP_PKEY_OP_TYPE_SIG | EVP_PKEY_OP_TYPE_CRYPT | EVP_PKEY_OP_DERIVE) + +# define EVP_PKEY_OP_TYPE_GEN \ + (EVP_PKEY_OP_PARAMGEN | EVP_PKEY_OP_KEYGEN) + +# define EVP_PKEY_CTX_set_signature_md(ctx, md) \ + EVP_PKEY_CTX_ctrl(ctx, -1, EVP_PKEY_OP_TYPE_SIG, \ + EVP_PKEY_CTRL_MD, 0, (void *)(md)) + +# define EVP_PKEY_CTX_get_signature_md(ctx, pmd) \ + EVP_PKEY_CTX_ctrl(ctx, -1, EVP_PKEY_OP_TYPE_SIG, \ + EVP_PKEY_CTRL_GET_MD, 0, (void *)(pmd)) + +# define EVP_PKEY_CTX_set_mac_key(ctx, key, len) \ + EVP_PKEY_CTX_ctrl(ctx, -1, EVP_PKEY_OP_KEYGEN, \ + EVP_PKEY_CTRL_SET_MAC_KEY, len, (void *)(key)) + +# define EVP_PKEY_CTRL_MD 1 +# define EVP_PKEY_CTRL_PEER_KEY 2 + +# define EVP_PKEY_CTRL_PKCS7_ENCRYPT 3 +# define EVP_PKEY_CTRL_PKCS7_DECRYPT 4 + +# define EVP_PKEY_CTRL_PKCS7_SIGN 5 + +# define EVP_PKEY_CTRL_SET_MAC_KEY 6 + +# define EVP_PKEY_CTRL_DIGESTINIT 7 + +/* Used by GOST key encryption in TLS */ +# define EVP_PKEY_CTRL_SET_IV 8 + +# define EVP_PKEY_CTRL_CMS_ENCRYPT 9 +# define EVP_PKEY_CTRL_CMS_DECRYPT 10 +# define EVP_PKEY_CTRL_CMS_SIGN 11 + +# define EVP_PKEY_CTRL_CIPHER 12 + +# define EVP_PKEY_CTRL_GET_MD 13 + +# define EVP_PKEY_CTRL_SET_DIGEST_SIZE 14 + +# define EVP_PKEY_ALG_CTRL 0x1000 + +# define EVP_PKEY_FLAG_AUTOARGLEN 2 +/* + * Method handles all operations: don't assume any digest related defaults. + */ +# define EVP_PKEY_FLAG_SIGCTX_CUSTOM 4 + +const EVP_PKEY_METHOD *EVP_PKEY_meth_find(int type); +EVP_PKEY_METHOD *EVP_PKEY_meth_new(int id, int flags); +void EVP_PKEY_meth_get0_info(int *ppkey_id, int *pflags, + const EVP_PKEY_METHOD *meth); +void EVP_PKEY_meth_copy(EVP_PKEY_METHOD *dst, const EVP_PKEY_METHOD *src); +void EVP_PKEY_meth_free(EVP_PKEY_METHOD *pmeth); +int EVP_PKEY_meth_add0(const EVP_PKEY_METHOD *pmeth); +int EVP_PKEY_meth_remove(const EVP_PKEY_METHOD *pmeth); +size_t EVP_PKEY_meth_get_count(void); +const EVP_PKEY_METHOD *EVP_PKEY_meth_get0(size_t idx); + +EVP_PKEY_CTX *EVP_PKEY_CTX_new(EVP_PKEY *pkey, ENGINE *e); +EVP_PKEY_CTX *EVP_PKEY_CTX_new_id(int id, ENGINE *e); +EVP_PKEY_CTX *EVP_PKEY_CTX_dup(EVP_PKEY_CTX *ctx); +void EVP_PKEY_CTX_free(EVP_PKEY_CTX *ctx); + +int EVP_PKEY_CTX_ctrl(EVP_PKEY_CTX *ctx, int keytype, int optype, + int cmd, int p1, void *p2); +int EVP_PKEY_CTX_ctrl_str(EVP_PKEY_CTX *ctx, const char *type, + const char *value); +int EVP_PKEY_CTX_ctrl_uint64(EVP_PKEY_CTX *ctx, int keytype, int optype, + int cmd, uint64_t value); + +int EVP_PKEY_CTX_str2ctrl(EVP_PKEY_CTX *ctx, int cmd, const char *str); +int EVP_PKEY_CTX_hex2ctrl(EVP_PKEY_CTX *ctx, int cmd, const char *hex); + +int EVP_PKEY_CTX_md(EVP_PKEY_CTX *ctx, int optype, int cmd, const char *md); + +int EVP_PKEY_CTX_get_operation(EVP_PKEY_CTX *ctx); +void EVP_PKEY_CTX_set0_keygen_info(EVP_PKEY_CTX *ctx, int *dat, int datlen); + +EVP_PKEY *EVP_PKEY_new_mac_key(int type, ENGINE *e, + const unsigned char *key, int keylen); +EVP_PKEY *EVP_PKEY_new_raw_private_key(int type, ENGINE *e, + const unsigned char *priv, + size_t len); +EVP_PKEY *EVP_PKEY_new_raw_public_key(int type, ENGINE *e, + const unsigned char *pub, + size_t len); +int EVP_PKEY_get_raw_private_key(const EVP_PKEY *pkey, unsigned char *priv, + size_t *len); +int EVP_PKEY_get_raw_public_key(const EVP_PKEY *pkey, unsigned char *pub, + size_t *len); + +EVP_PKEY *EVP_PKEY_new_CMAC_key(ENGINE *e, const unsigned char *priv, + size_t len, const EVP_CIPHER *cipher); + +void EVP_PKEY_CTX_set_data(EVP_PKEY_CTX *ctx, void *data); +void *EVP_PKEY_CTX_get_data(EVP_PKEY_CTX *ctx); +EVP_PKEY *EVP_PKEY_CTX_get0_pkey(EVP_PKEY_CTX *ctx); + +EVP_PKEY *EVP_PKEY_CTX_get0_peerkey(EVP_PKEY_CTX *ctx); + +void EVP_PKEY_CTX_set_app_data(EVP_PKEY_CTX *ctx, void *data); +void *EVP_PKEY_CTX_get_app_data(EVP_PKEY_CTX *ctx); + +int EVP_PKEY_sign_init(EVP_PKEY_CTX *ctx); +int EVP_PKEY_sign(EVP_PKEY_CTX *ctx, + unsigned char *sig, size_t *siglen, + const unsigned char *tbs, size_t tbslen); +int EVP_PKEY_verify_init(EVP_PKEY_CTX *ctx); +int EVP_PKEY_verify(EVP_PKEY_CTX *ctx, + const unsigned char *sig, size_t siglen, + const unsigned char *tbs, size_t tbslen); +int EVP_PKEY_verify_recover_init(EVP_PKEY_CTX *ctx); +int EVP_PKEY_verify_recover(EVP_PKEY_CTX *ctx, + unsigned char *rout, size_t *routlen, + const unsigned char *sig, size_t siglen); +int EVP_PKEY_encrypt_init(EVP_PKEY_CTX *ctx); +int EVP_PKEY_encrypt(EVP_PKEY_CTX *ctx, + unsigned char *out, size_t *outlen, + const unsigned char *in, size_t inlen); +int EVP_PKEY_decrypt_init(EVP_PKEY_CTX *ctx); +int EVP_PKEY_decrypt(EVP_PKEY_CTX *ctx, + unsigned char *out, size_t *outlen, + const unsigned char *in, size_t inlen); + +int EVP_PKEY_derive_init(EVP_PKEY_CTX *ctx); +int EVP_PKEY_derive_set_peer(EVP_PKEY_CTX *ctx, EVP_PKEY *peer); +int EVP_PKEY_derive(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen); + +typedef int EVP_PKEY_gen_cb(EVP_PKEY_CTX *ctx); + +int EVP_PKEY_paramgen_init(EVP_PKEY_CTX *ctx); +int EVP_PKEY_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey); +int EVP_PKEY_keygen_init(EVP_PKEY_CTX *ctx); +int EVP_PKEY_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey); +int EVP_PKEY_check(EVP_PKEY_CTX *ctx); +int EVP_PKEY_public_check(EVP_PKEY_CTX *ctx); +int EVP_PKEY_param_check(EVP_PKEY_CTX *ctx); + +void EVP_PKEY_CTX_set_cb(EVP_PKEY_CTX *ctx, EVP_PKEY_gen_cb *cb); +EVP_PKEY_gen_cb *EVP_PKEY_CTX_get_cb(EVP_PKEY_CTX *ctx); + +int EVP_PKEY_CTX_get_keygen_info(EVP_PKEY_CTX *ctx, int idx); + +void EVP_PKEY_meth_set_init(EVP_PKEY_METHOD *pmeth, + int (*init) (EVP_PKEY_CTX *ctx)); + +void EVP_PKEY_meth_set_copy(EVP_PKEY_METHOD *pmeth, + int (*copy) (EVP_PKEY_CTX *dst, + EVP_PKEY_CTX *src)); + +void EVP_PKEY_meth_set_cleanup(EVP_PKEY_METHOD *pmeth, + void (*cleanup) (EVP_PKEY_CTX *ctx)); + +void EVP_PKEY_meth_set_paramgen(EVP_PKEY_METHOD *pmeth, + int (*paramgen_init) (EVP_PKEY_CTX *ctx), + int (*paramgen) (EVP_PKEY_CTX *ctx, + EVP_PKEY *pkey)); + +void EVP_PKEY_meth_set_keygen(EVP_PKEY_METHOD *pmeth, + int (*keygen_init) (EVP_PKEY_CTX *ctx), + int (*keygen) (EVP_PKEY_CTX *ctx, + EVP_PKEY *pkey)); + +void EVP_PKEY_meth_set_sign(EVP_PKEY_METHOD *pmeth, + int (*sign_init) (EVP_PKEY_CTX *ctx), + int (*sign) (EVP_PKEY_CTX *ctx, + unsigned char *sig, size_t *siglen, + const unsigned char *tbs, + size_t tbslen)); + +void EVP_PKEY_meth_set_verify(EVP_PKEY_METHOD *pmeth, + int (*verify_init) (EVP_PKEY_CTX *ctx), + int (*verify) (EVP_PKEY_CTX *ctx, + const unsigned char *sig, + size_t siglen, + const unsigned char *tbs, + size_t tbslen)); + +void EVP_PKEY_meth_set_verify_recover(EVP_PKEY_METHOD *pmeth, + int (*verify_recover_init) (EVP_PKEY_CTX + *ctx), + int (*verify_recover) (EVP_PKEY_CTX + *ctx, + unsigned char + *sig, + size_t *siglen, + const unsigned + char *tbs, + size_t tbslen)); + +void EVP_PKEY_meth_set_signctx(EVP_PKEY_METHOD *pmeth, + int (*signctx_init) (EVP_PKEY_CTX *ctx, + EVP_MD_CTX *mctx), + int (*signctx) (EVP_PKEY_CTX *ctx, + unsigned char *sig, + size_t *siglen, + EVP_MD_CTX *mctx)); + +void EVP_PKEY_meth_set_verifyctx(EVP_PKEY_METHOD *pmeth, + int (*verifyctx_init) (EVP_PKEY_CTX *ctx, + EVP_MD_CTX *mctx), + int (*verifyctx) (EVP_PKEY_CTX *ctx, + const unsigned char *sig, + int siglen, + EVP_MD_CTX *mctx)); + +void EVP_PKEY_meth_set_encrypt(EVP_PKEY_METHOD *pmeth, + int (*encrypt_init) (EVP_PKEY_CTX *ctx), + int (*encryptfn) (EVP_PKEY_CTX *ctx, + unsigned char *out, + size_t *outlen, + const unsigned char *in, + size_t inlen)); + +void EVP_PKEY_meth_set_decrypt(EVP_PKEY_METHOD *pmeth, + int (*decrypt_init) (EVP_PKEY_CTX *ctx), + int (*decrypt) (EVP_PKEY_CTX *ctx, + unsigned char *out, + size_t *outlen, + const unsigned char *in, + size_t inlen)); + +void EVP_PKEY_meth_set_derive(EVP_PKEY_METHOD *pmeth, + int (*derive_init) (EVP_PKEY_CTX *ctx), + int (*derive) (EVP_PKEY_CTX *ctx, + unsigned char *key, + size_t *keylen)); + +void EVP_PKEY_meth_set_ctrl(EVP_PKEY_METHOD *pmeth, + int (*ctrl) (EVP_PKEY_CTX *ctx, int type, int p1, + void *p2), + int (*ctrl_str) (EVP_PKEY_CTX *ctx, + const char *type, + const char *value)); + +void EVP_PKEY_meth_set_digestsign(EVP_PKEY_METHOD *pmeth, + int (*digestsign) (EVP_MD_CTX *ctx, + unsigned char *sig, + size_t *siglen, + const unsigned char *tbs, + size_t tbslen)); + +void EVP_PKEY_meth_set_digestverify(EVP_PKEY_METHOD *pmeth, + int (*digestverify) (EVP_MD_CTX *ctx, + const unsigned char *sig, + size_t siglen, + const unsigned char *tbs, + size_t tbslen)); + +void EVP_PKEY_meth_set_check(EVP_PKEY_METHOD *pmeth, + int (*check) (EVP_PKEY *pkey)); + +void EVP_PKEY_meth_set_public_check(EVP_PKEY_METHOD *pmeth, + int (*check) (EVP_PKEY *pkey)); + +void EVP_PKEY_meth_set_param_check(EVP_PKEY_METHOD *pmeth, + int (*check) (EVP_PKEY *pkey)); + +void EVP_PKEY_meth_set_digest_custom(EVP_PKEY_METHOD *pmeth, + int (*digest_custom) (EVP_PKEY_CTX *ctx, + EVP_MD_CTX *mctx)); + +void EVP_PKEY_meth_get_init(const EVP_PKEY_METHOD *pmeth, + int (**pinit) (EVP_PKEY_CTX *ctx)); + +void EVP_PKEY_meth_get_copy(const EVP_PKEY_METHOD *pmeth, + int (**pcopy) (EVP_PKEY_CTX *dst, + EVP_PKEY_CTX *src)); + +void EVP_PKEY_meth_get_cleanup(const EVP_PKEY_METHOD *pmeth, + void (**pcleanup) (EVP_PKEY_CTX *ctx)); + +void EVP_PKEY_meth_get_paramgen(const EVP_PKEY_METHOD *pmeth, + int (**pparamgen_init) (EVP_PKEY_CTX *ctx), + int (**pparamgen) (EVP_PKEY_CTX *ctx, + EVP_PKEY *pkey)); + +void EVP_PKEY_meth_get_keygen(const EVP_PKEY_METHOD *pmeth, + int (**pkeygen_init) (EVP_PKEY_CTX *ctx), + int (**pkeygen) (EVP_PKEY_CTX *ctx, + EVP_PKEY *pkey)); + +void EVP_PKEY_meth_get_sign(const EVP_PKEY_METHOD *pmeth, + int (**psign_init) (EVP_PKEY_CTX *ctx), + int (**psign) (EVP_PKEY_CTX *ctx, + unsigned char *sig, size_t *siglen, + const unsigned char *tbs, + size_t tbslen)); + +void EVP_PKEY_meth_get_verify(const EVP_PKEY_METHOD *pmeth, + int (**pverify_init) (EVP_PKEY_CTX *ctx), + int (**pverify) (EVP_PKEY_CTX *ctx, + const unsigned char *sig, + size_t siglen, + const unsigned char *tbs, + size_t tbslen)); + +void EVP_PKEY_meth_get_verify_recover(const EVP_PKEY_METHOD *pmeth, + int (**pverify_recover_init) (EVP_PKEY_CTX + *ctx), + int (**pverify_recover) (EVP_PKEY_CTX + *ctx, + unsigned char + *sig, + size_t *siglen, + const unsigned + char *tbs, + size_t tbslen)); + +void EVP_PKEY_meth_get_signctx(const EVP_PKEY_METHOD *pmeth, + int (**psignctx_init) (EVP_PKEY_CTX *ctx, + EVP_MD_CTX *mctx), + int (**psignctx) (EVP_PKEY_CTX *ctx, + unsigned char *sig, + size_t *siglen, + EVP_MD_CTX *mctx)); + +void EVP_PKEY_meth_get_verifyctx(const EVP_PKEY_METHOD *pmeth, + int (**pverifyctx_init) (EVP_PKEY_CTX *ctx, + EVP_MD_CTX *mctx), + int (**pverifyctx) (EVP_PKEY_CTX *ctx, + const unsigned char *sig, + int siglen, + EVP_MD_CTX *mctx)); + +void EVP_PKEY_meth_get_encrypt(const EVP_PKEY_METHOD *pmeth, + int (**pencrypt_init) (EVP_PKEY_CTX *ctx), + int (**pencryptfn) (EVP_PKEY_CTX *ctx, + unsigned char *out, + size_t *outlen, + const unsigned char *in, + size_t inlen)); + +void EVP_PKEY_meth_get_decrypt(const EVP_PKEY_METHOD *pmeth, + int (**pdecrypt_init) (EVP_PKEY_CTX *ctx), + int (**pdecrypt) (EVP_PKEY_CTX *ctx, + unsigned char *out, + size_t *outlen, + const unsigned char *in, + size_t inlen)); + +void EVP_PKEY_meth_get_derive(const EVP_PKEY_METHOD *pmeth, + int (**pderive_init) (EVP_PKEY_CTX *ctx), + int (**pderive) (EVP_PKEY_CTX *ctx, + unsigned char *key, + size_t *keylen)); + +void EVP_PKEY_meth_get_ctrl(const EVP_PKEY_METHOD *pmeth, + int (**pctrl) (EVP_PKEY_CTX *ctx, int type, int p1, + void *p2), + int (**pctrl_str) (EVP_PKEY_CTX *ctx, + const char *type, + const char *value)); + +void EVP_PKEY_meth_get_digestsign(EVP_PKEY_METHOD *pmeth, + int (**digestsign) (EVP_MD_CTX *ctx, + unsigned char *sig, + size_t *siglen, + const unsigned char *tbs, + size_t tbslen)); + +void EVP_PKEY_meth_get_digestverify(EVP_PKEY_METHOD *pmeth, + int (**digestverify) (EVP_MD_CTX *ctx, + const unsigned char *sig, + size_t siglen, + const unsigned char *tbs, + size_t tbslen)); + +void EVP_PKEY_meth_get_check(const EVP_PKEY_METHOD *pmeth, + int (**pcheck) (EVP_PKEY *pkey)); + +void EVP_PKEY_meth_get_public_check(const EVP_PKEY_METHOD *pmeth, + int (**pcheck) (EVP_PKEY *pkey)); + +void EVP_PKEY_meth_get_param_check(const EVP_PKEY_METHOD *pmeth, + int (**pcheck) (EVP_PKEY *pkey)); + +void EVP_PKEY_meth_get_digest_custom(EVP_PKEY_METHOD *pmeth, + int (**pdigest_custom) (EVP_PKEY_CTX *ctx, + EVP_MD_CTX *mctx)); +void EVP_add_alg_module(void); + + +# ifdef __cplusplus +} +# endif +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/evperr.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/evperr.h new file mode 100644 index 0000000..d2b26ea --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/evperr.h @@ -0,0 +1,205 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_EVPERR_H +# define HEADER_EVPERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_EVP_strings(void); + +/* + * EVP function codes. + */ +# define EVP_F_AESNI_INIT_KEY 165 +# define EVP_F_AESNI_XTS_INIT_KEY 207 +# define EVP_F_AES_GCM_CTRL 196 +# define EVP_F_AES_INIT_KEY 133 +# define EVP_F_AES_OCB_CIPHER 169 +# define EVP_F_AES_T4_INIT_KEY 178 +# define EVP_F_AES_T4_XTS_INIT_KEY 208 +# define EVP_F_AES_WRAP_CIPHER 170 +# define EVP_F_AES_XTS_INIT_KEY 209 +# define EVP_F_ALG_MODULE_INIT 177 +# define EVP_F_ARIA_CCM_INIT_KEY 175 +# define EVP_F_ARIA_GCM_CTRL 197 +# define EVP_F_ARIA_GCM_INIT_KEY 176 +# define EVP_F_ARIA_INIT_KEY 185 +# define EVP_F_B64_NEW 198 +# define EVP_F_CAMELLIA_INIT_KEY 159 +# define EVP_F_CHACHA20_POLY1305_CTRL 182 +# define EVP_F_CMLL_T4_INIT_KEY 179 +# define EVP_F_DES_EDE3_WRAP_CIPHER 171 +# define EVP_F_DO_SIGVER_INIT 161 +# define EVP_F_ENC_NEW 199 +# define EVP_F_EVP_CIPHERINIT_EX 123 +# define EVP_F_EVP_CIPHER_ASN1_TO_PARAM 204 +# define EVP_F_EVP_CIPHER_CTX_COPY 163 +# define EVP_F_EVP_CIPHER_CTX_CTRL 124 +# define EVP_F_EVP_CIPHER_CTX_SET_KEY_LENGTH 122 +# define EVP_F_EVP_CIPHER_PARAM_TO_ASN1 205 +# define EVP_F_EVP_DECRYPTFINAL_EX 101 +# define EVP_F_EVP_DECRYPTUPDATE 166 +# define EVP_F_EVP_DIGESTFINALXOF 174 +# define EVP_F_EVP_DIGESTINIT_EX 128 +# define EVP_F_EVP_ENCRYPTDECRYPTUPDATE 219 +# define EVP_F_EVP_ENCRYPTFINAL_EX 127 +# define EVP_F_EVP_ENCRYPTUPDATE 167 +# define EVP_F_EVP_MD_CTX_COPY_EX 110 +# define EVP_F_EVP_MD_SIZE 162 +# define EVP_F_EVP_OPENINIT 102 +# define EVP_F_EVP_PBE_ALG_ADD 115 +# define EVP_F_EVP_PBE_ALG_ADD_TYPE 160 +# define EVP_F_EVP_PBE_CIPHERINIT 116 +# define EVP_F_EVP_PBE_SCRYPT 181 +# define EVP_F_EVP_PKCS82PKEY 111 +# define EVP_F_EVP_PKEY2PKCS8 113 +# define EVP_F_EVP_PKEY_ASN1_ADD0 188 +# define EVP_F_EVP_PKEY_CHECK 186 +# define EVP_F_EVP_PKEY_COPY_PARAMETERS 103 +# define EVP_F_EVP_PKEY_CTX_CTRL 137 +# define EVP_F_EVP_PKEY_CTX_CTRL_STR 150 +# define EVP_F_EVP_PKEY_CTX_DUP 156 +# define EVP_F_EVP_PKEY_CTX_MD 168 +# define EVP_F_EVP_PKEY_DECRYPT 104 +# define EVP_F_EVP_PKEY_DECRYPT_INIT 138 +# define EVP_F_EVP_PKEY_DECRYPT_OLD 151 +# define EVP_F_EVP_PKEY_DERIVE 153 +# define EVP_F_EVP_PKEY_DERIVE_INIT 154 +# define EVP_F_EVP_PKEY_DERIVE_SET_PEER 155 +# define EVP_F_EVP_PKEY_ENCRYPT 105 +# define EVP_F_EVP_PKEY_ENCRYPT_INIT 139 +# define EVP_F_EVP_PKEY_ENCRYPT_OLD 152 +# define EVP_F_EVP_PKEY_GET0_DH 119 +# define EVP_F_EVP_PKEY_GET0_DSA 120 +# define EVP_F_EVP_PKEY_GET0_EC_KEY 131 +# define EVP_F_EVP_PKEY_GET0_HMAC 183 +# define EVP_F_EVP_PKEY_GET0_POLY1305 184 +# define EVP_F_EVP_PKEY_GET0_RSA 121 +# define EVP_F_EVP_PKEY_GET0_SIPHASH 172 +# define EVP_F_EVP_PKEY_GET_RAW_PRIVATE_KEY 202 +# define EVP_F_EVP_PKEY_GET_RAW_PUBLIC_KEY 203 +# define EVP_F_EVP_PKEY_KEYGEN 146 +# define EVP_F_EVP_PKEY_KEYGEN_INIT 147 +# define EVP_F_EVP_PKEY_METH_ADD0 194 +# define EVP_F_EVP_PKEY_METH_NEW 195 +# define EVP_F_EVP_PKEY_NEW 106 +# define EVP_F_EVP_PKEY_NEW_CMAC_KEY 193 +# define EVP_F_EVP_PKEY_NEW_RAW_PRIVATE_KEY 191 +# define EVP_F_EVP_PKEY_NEW_RAW_PUBLIC_KEY 192 +# define EVP_F_EVP_PKEY_PARAMGEN 148 +# define EVP_F_EVP_PKEY_PARAMGEN_INIT 149 +# define EVP_F_EVP_PKEY_PARAM_CHECK 189 +# define EVP_F_EVP_PKEY_PUBLIC_CHECK 190 +# define EVP_F_EVP_PKEY_SET1_ENGINE 187 +# define EVP_F_EVP_PKEY_SET_ALIAS_TYPE 206 +# define EVP_F_EVP_PKEY_SIGN 140 +# define EVP_F_EVP_PKEY_SIGN_INIT 141 +# define EVP_F_EVP_PKEY_VERIFY 142 +# define EVP_F_EVP_PKEY_VERIFY_INIT 143 +# define EVP_F_EVP_PKEY_VERIFY_RECOVER 144 +# define EVP_F_EVP_PKEY_VERIFY_RECOVER_INIT 145 +# define EVP_F_EVP_SIGNFINAL 107 +# define EVP_F_EVP_VERIFYFINAL 108 +# define EVP_F_INT_CTX_NEW 157 +# define EVP_F_OK_NEW 200 +# define EVP_F_PKCS5_PBE_KEYIVGEN 117 +# define EVP_F_PKCS5_V2_PBE_KEYIVGEN 118 +# define EVP_F_PKCS5_V2_PBKDF2_KEYIVGEN 164 +# define EVP_F_PKCS5_V2_SCRYPT_KEYIVGEN 180 +# define EVP_F_PKEY_SET_TYPE 158 +# define EVP_F_RC2_MAGIC_TO_METH 109 +# define EVP_F_RC5_CTRL 125 +# define EVP_F_R_32_12_16_INIT_KEY 242 +# define EVP_F_S390X_AES_GCM_CTRL 201 +# define EVP_F_UPDATE 173 + +/* + * EVP reason codes. + */ +# define EVP_R_AES_KEY_SETUP_FAILED 143 +# define EVP_R_ARIA_KEY_SETUP_FAILED 176 +# define EVP_R_BAD_DECRYPT 100 +# define EVP_R_BAD_KEY_LENGTH 195 +# define EVP_R_BUFFER_TOO_SMALL 155 +# define EVP_R_CAMELLIA_KEY_SETUP_FAILED 157 +# define EVP_R_CIPHER_PARAMETER_ERROR 122 +# define EVP_R_COMMAND_NOT_SUPPORTED 147 +# define EVP_R_COPY_ERROR 173 +# define EVP_R_CTRL_NOT_IMPLEMENTED 132 +# define EVP_R_CTRL_OPERATION_NOT_IMPLEMENTED 133 +# define EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH 138 +# define EVP_R_DECODE_ERROR 114 +# define EVP_R_DIFFERENT_KEY_TYPES 101 +# define EVP_R_DIFFERENT_PARAMETERS 153 +# define EVP_R_ERROR_LOADING_SECTION 165 +# define EVP_R_ERROR_SETTING_FIPS_MODE 166 +# define EVP_R_EXPECTING_AN_HMAC_KEY 174 +# define EVP_R_EXPECTING_AN_RSA_KEY 127 +# define EVP_R_EXPECTING_A_DH_KEY 128 +# define EVP_R_EXPECTING_A_DSA_KEY 129 +# define EVP_R_EXPECTING_A_EC_KEY 142 +# define EVP_R_EXPECTING_A_POLY1305_KEY 164 +# define EVP_R_EXPECTING_A_SIPHASH_KEY 175 +# define EVP_R_FIPS_MODE_NOT_SUPPORTED 167 +# define EVP_R_GET_RAW_KEY_FAILED 182 +# define EVP_R_ILLEGAL_SCRYPT_PARAMETERS 171 +# define EVP_R_INITIALIZATION_ERROR 134 +# define EVP_R_INPUT_NOT_INITIALIZED 111 +# define EVP_R_INVALID_DIGEST 152 +# define EVP_R_INVALID_FIPS_MODE 168 +# define EVP_R_INVALID_IV_LENGTH 194 +# define EVP_R_INVALID_KEY 163 +# define EVP_R_INVALID_KEY_LENGTH 130 +# define EVP_R_INVALID_OPERATION 148 +# define EVP_R_KEYGEN_FAILURE 120 +# define EVP_R_KEY_SETUP_FAILED 180 +# define EVP_R_MEMORY_LIMIT_EXCEEDED 172 +# define EVP_R_MESSAGE_DIGEST_IS_NULL 159 +# define EVP_R_METHOD_NOT_SUPPORTED 144 +# define EVP_R_MISSING_PARAMETERS 103 +# define EVP_R_NOT_XOF_OR_INVALID_LENGTH 178 +# define EVP_R_NO_CIPHER_SET 131 +# define EVP_R_NO_DEFAULT_DIGEST 158 +# define EVP_R_NO_DIGEST_SET 139 +# define EVP_R_NO_KEY_SET 154 +# define EVP_R_NO_OPERATION_SET 149 +# define EVP_R_ONLY_ONESHOT_SUPPORTED 177 +# define EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE 150 +# define EVP_R_OPERATON_NOT_INITIALIZED 151 +# define EVP_R_PARTIALLY_OVERLAPPING 162 +# define EVP_R_PBKDF2_ERROR 181 +# define EVP_R_PKEY_APPLICATION_ASN1_METHOD_ALREADY_REGISTERED 179 +# define EVP_R_PRIVATE_KEY_DECODE_ERROR 145 +# define EVP_R_PRIVATE_KEY_ENCODE_ERROR 146 +# define EVP_R_PUBLIC_KEY_NOT_RSA 106 +# define EVP_R_UNKNOWN_CIPHER 160 +# define EVP_R_UNKNOWN_DIGEST 161 +# define EVP_R_UNKNOWN_OPTION 169 +# define EVP_R_UNKNOWN_PBE_ALGORITHM 121 +# define EVP_R_UNSUPPORTED_ALGORITHM 156 +# define EVP_R_UNSUPPORTED_CIPHER 107 +# define EVP_R_UNSUPPORTED_KEYLENGTH 123 +# define EVP_R_UNSUPPORTED_KEY_DERIVATION_FUNCTION 124 +# define EVP_R_UNSUPPORTED_KEY_SIZE 108 +# define EVP_R_UNSUPPORTED_NUMBER_OF_ROUNDS 135 +# define EVP_R_UNSUPPORTED_PRF 125 +# define EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM 118 +# define EVP_R_UNSUPPORTED_SALT_TYPE 126 +# define EVP_R_WRAP_MODE_NOT_ALLOWED 170 +# define EVP_R_WRONG_FINAL_BLOCK_LENGTH 109 +# define EVP_R_XTS_DUPLICATED_KEYS 183 + +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/hmac.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/hmac.h new file mode 100644 index 0000000..458efc1 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/hmac.h @@ -0,0 +1,51 @@ +/* + * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_HMAC_H +# define HEADER_HMAC_H + +# include + +# include + +# if OPENSSL_API_COMPAT < 0x10200000L +# define HMAC_MAX_MD_CBLOCK 128 /* Deprecated */ +# endif + +#ifdef __cplusplus +extern "C" { +#endif + +size_t HMAC_size(const HMAC_CTX *e); +HMAC_CTX *HMAC_CTX_new(void); +int HMAC_CTX_reset(HMAC_CTX *ctx); +void HMAC_CTX_free(HMAC_CTX *ctx); + +DEPRECATEDIN_1_1_0(__owur int HMAC_Init(HMAC_CTX *ctx, const void *key, int len, + const EVP_MD *md)) + +/*__owur*/ int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, + const EVP_MD *md, ENGINE *impl); +/*__owur*/ int HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, + size_t len); +/*__owur*/ int HMAC_Final(HMAC_CTX *ctx, unsigned char *md, + unsigned int *len); +unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len, + const unsigned char *d, size_t n, unsigned char *md, + unsigned int *md_len); +__owur int HMAC_CTX_copy(HMAC_CTX *dctx, HMAC_CTX *sctx); + +void HMAC_CTX_set_flags(HMAC_CTX *ctx, unsigned long flags); +const EVP_MD *HMAC_CTX_get_md(const HMAC_CTX *ctx); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/idea.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/idea.h new file mode 100644 index 0000000..4334f3e --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/idea.h @@ -0,0 +1,64 @@ +/* + * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_IDEA_H +# define HEADER_IDEA_H + +# include + +# ifndef OPENSSL_NO_IDEA +# ifdef __cplusplus +extern "C" { +# endif + +typedef unsigned int IDEA_INT; + +# define IDEA_ENCRYPT 1 +# define IDEA_DECRYPT 0 + +# define IDEA_BLOCK 8 +# define IDEA_KEY_LENGTH 16 + +typedef struct idea_key_st { + IDEA_INT data[9][6]; +} IDEA_KEY_SCHEDULE; + +const char *IDEA_options(void); +void IDEA_ecb_encrypt(const unsigned char *in, unsigned char *out, + IDEA_KEY_SCHEDULE *ks); +void IDEA_set_encrypt_key(const unsigned char *key, IDEA_KEY_SCHEDULE *ks); +void IDEA_set_decrypt_key(IDEA_KEY_SCHEDULE *ek, IDEA_KEY_SCHEDULE *dk); +void IDEA_cbc_encrypt(const unsigned char *in, unsigned char *out, + long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv, + int enc); +void IDEA_cfb64_encrypt(const unsigned char *in, unsigned char *out, + long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv, + int *num, int enc); +void IDEA_ofb64_encrypt(const unsigned char *in, unsigned char *out, + long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv, + int *num); +void IDEA_encrypt(unsigned long *in, IDEA_KEY_SCHEDULE *ks); + +# if OPENSSL_API_COMPAT < 0x10100000L +# define idea_options IDEA_options +# define idea_ecb_encrypt IDEA_ecb_encrypt +# define idea_set_encrypt_key IDEA_set_encrypt_key +# define idea_set_decrypt_key IDEA_set_decrypt_key +# define idea_cbc_encrypt IDEA_cbc_encrypt +# define idea_cfb64_encrypt IDEA_cfb64_encrypt +# define idea_ofb64_encrypt IDEA_ofb64_encrypt +# define idea_encrypt IDEA_encrypt +# endif + +# ifdef __cplusplus +} +# endif +# endif + +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/kdf.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/kdf.h new file mode 100644 index 0000000..5abd4c3 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/kdf.h @@ -0,0 +1,97 @@ +/* + * Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_KDF_H +# define HEADER_KDF_H + +# include +#ifdef __cplusplus +extern "C" { +#endif + +# define EVP_PKEY_CTRL_TLS_MD (EVP_PKEY_ALG_CTRL) +# define EVP_PKEY_CTRL_TLS_SECRET (EVP_PKEY_ALG_CTRL + 1) +# define EVP_PKEY_CTRL_TLS_SEED (EVP_PKEY_ALG_CTRL + 2) +# define EVP_PKEY_CTRL_HKDF_MD (EVP_PKEY_ALG_CTRL + 3) +# define EVP_PKEY_CTRL_HKDF_SALT (EVP_PKEY_ALG_CTRL + 4) +# define EVP_PKEY_CTRL_HKDF_KEY (EVP_PKEY_ALG_CTRL + 5) +# define EVP_PKEY_CTRL_HKDF_INFO (EVP_PKEY_ALG_CTRL + 6) +# define EVP_PKEY_CTRL_HKDF_MODE (EVP_PKEY_ALG_CTRL + 7) +# define EVP_PKEY_CTRL_PASS (EVP_PKEY_ALG_CTRL + 8) +# define EVP_PKEY_CTRL_SCRYPT_SALT (EVP_PKEY_ALG_CTRL + 9) +# define EVP_PKEY_CTRL_SCRYPT_N (EVP_PKEY_ALG_CTRL + 10) +# define EVP_PKEY_CTRL_SCRYPT_R (EVP_PKEY_ALG_CTRL + 11) +# define EVP_PKEY_CTRL_SCRYPT_P (EVP_PKEY_ALG_CTRL + 12) +# define EVP_PKEY_CTRL_SCRYPT_MAXMEM_BYTES (EVP_PKEY_ALG_CTRL + 13) + +# define EVP_PKEY_HKDEF_MODE_EXTRACT_AND_EXPAND 0 +# define EVP_PKEY_HKDEF_MODE_EXTRACT_ONLY 1 +# define EVP_PKEY_HKDEF_MODE_EXPAND_ONLY 2 + +# define EVP_PKEY_CTX_set_tls1_prf_md(pctx, md) \ + EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_TLS_MD, 0, (void *)(md)) + +# define EVP_PKEY_CTX_set1_tls1_prf_secret(pctx, sec, seclen) \ + EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_TLS_SECRET, seclen, (void *)(sec)) + +# define EVP_PKEY_CTX_add1_tls1_prf_seed(pctx, seed, seedlen) \ + EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_TLS_SEED, seedlen, (void *)(seed)) + +# define EVP_PKEY_CTX_set_hkdf_md(pctx, md) \ + EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_HKDF_MD, 0, (void *)(md)) + +# define EVP_PKEY_CTX_set1_hkdf_salt(pctx, salt, saltlen) \ + EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_HKDF_SALT, saltlen, (void *)(salt)) + +# define EVP_PKEY_CTX_set1_hkdf_key(pctx, key, keylen) \ + EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_HKDF_KEY, keylen, (void *)(key)) + +# define EVP_PKEY_CTX_add1_hkdf_info(pctx, info, infolen) \ + EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_HKDF_INFO, infolen, (void *)(info)) + +# define EVP_PKEY_CTX_hkdf_mode(pctx, mode) \ + EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_HKDF_MODE, mode, NULL) + +# define EVP_PKEY_CTX_set1_pbe_pass(pctx, pass, passlen) \ + EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_PASS, passlen, (void *)(pass)) + +# define EVP_PKEY_CTX_set1_scrypt_salt(pctx, salt, saltlen) \ + EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_SCRYPT_SALT, saltlen, (void *)(salt)) + +# define EVP_PKEY_CTX_set_scrypt_N(pctx, n) \ + EVP_PKEY_CTX_ctrl_uint64(pctx, -1, EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_SCRYPT_N, n) + +# define EVP_PKEY_CTX_set_scrypt_r(pctx, r) \ + EVP_PKEY_CTX_ctrl_uint64(pctx, -1, EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_SCRYPT_R, r) + +# define EVP_PKEY_CTX_set_scrypt_p(pctx, p) \ + EVP_PKEY_CTX_ctrl_uint64(pctx, -1, EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_SCRYPT_P, p) + +# define EVP_PKEY_CTX_set_scrypt_maxmem_bytes(pctx, maxmem_bytes) \ + EVP_PKEY_CTX_ctrl_uint64(pctx, -1, EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_SCRYPT_MAXMEM_BYTES, maxmem_bytes) + + +# ifdef __cplusplus +} +# endif +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/kdferr.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/kdferr.h new file mode 100644 index 0000000..3f51bd0 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/kdferr.h @@ -0,0 +1,55 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_KDFERR_H +# define HEADER_KDFERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_KDF_strings(void); + +/* + * KDF function codes. + */ +# define KDF_F_PKEY_HKDF_CTRL_STR 103 +# define KDF_F_PKEY_HKDF_DERIVE 102 +# define KDF_F_PKEY_HKDF_INIT 108 +# define KDF_F_PKEY_SCRYPT_CTRL_STR 104 +# define KDF_F_PKEY_SCRYPT_CTRL_UINT64 105 +# define KDF_F_PKEY_SCRYPT_DERIVE 109 +# define KDF_F_PKEY_SCRYPT_INIT 106 +# define KDF_F_PKEY_SCRYPT_SET_MEMBUF 107 +# define KDF_F_PKEY_TLS1_PRF_CTRL_STR 100 +# define KDF_F_PKEY_TLS1_PRF_DERIVE 101 +# define KDF_F_PKEY_TLS1_PRF_INIT 110 +# define KDF_F_TLS1_PRF_ALG 111 + +/* + * KDF reason codes. + */ +# define KDF_R_INVALID_DIGEST 100 +# define KDF_R_MISSING_ITERATION_COUNT 109 +# define KDF_R_MISSING_KEY 104 +# define KDF_R_MISSING_MESSAGE_DIGEST 105 +# define KDF_R_MISSING_PARAMETER 101 +# define KDF_R_MISSING_PASS 110 +# define KDF_R_MISSING_SALT 111 +# define KDF_R_MISSING_SECRET 107 +# define KDF_R_MISSING_SEED 106 +# define KDF_R_UNKNOWN_PARAMETER_TYPE 103 +# define KDF_R_VALUE_ERROR 108 +# define KDF_R_VALUE_MISSING 102 + +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/lhash.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/lhash.h new file mode 100644 index 0000000..2e42d72 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/lhash.h @@ -0,0 +1,241 @@ +/* + * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +/* + * Header for dynamic hash table routines Author - Eric Young + */ + +#ifndef HEADER_LHASH_H +# define HEADER_LHASH_H + +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct lhash_node_st OPENSSL_LH_NODE; +typedef int (*OPENSSL_LH_COMPFUNC) (const void *, const void *); +typedef unsigned long (*OPENSSL_LH_HASHFUNC) (const void *); +typedef void (*OPENSSL_LH_DOALL_FUNC) (void *); +typedef void (*OPENSSL_LH_DOALL_FUNCARG) (void *, void *); +typedef struct lhash_st OPENSSL_LHASH; + +/* + * Macros for declaring and implementing type-safe wrappers for LHASH + * callbacks. This way, callbacks can be provided to LHASH structures without + * function pointer casting and the macro-defined callbacks provide + * per-variable casting before deferring to the underlying type-specific + * callbacks. NB: It is possible to place a "static" in front of both the + * DECLARE and IMPLEMENT macros if the functions are strictly internal. + */ + +/* First: "hash" functions */ +# define DECLARE_LHASH_HASH_FN(name, o_type) \ + unsigned long name##_LHASH_HASH(const void *); +# define IMPLEMENT_LHASH_HASH_FN(name, o_type) \ + unsigned long name##_LHASH_HASH(const void *arg) { \ + const o_type *a = arg; \ + return name##_hash(a); } +# define LHASH_HASH_FN(name) name##_LHASH_HASH + +/* Second: "compare" functions */ +# define DECLARE_LHASH_COMP_FN(name, o_type) \ + int name##_LHASH_COMP(const void *, const void *); +# define IMPLEMENT_LHASH_COMP_FN(name, o_type) \ + int name##_LHASH_COMP(const void *arg1, const void *arg2) { \ + const o_type *a = arg1; \ + const o_type *b = arg2; \ + return name##_cmp(a,b); } +# define LHASH_COMP_FN(name) name##_LHASH_COMP + +/* Fourth: "doall_arg" functions */ +# define DECLARE_LHASH_DOALL_ARG_FN(name, o_type, a_type) \ + void name##_LHASH_DOALL_ARG(void *, void *); +# define IMPLEMENT_LHASH_DOALL_ARG_FN(name, o_type, a_type) \ + void name##_LHASH_DOALL_ARG(void *arg1, void *arg2) { \ + o_type *a = arg1; \ + a_type *b = arg2; \ + name##_doall_arg(a, b); } +# define LHASH_DOALL_ARG_FN(name) name##_LHASH_DOALL_ARG + + +# define LH_LOAD_MULT 256 + +int OPENSSL_LH_error(OPENSSL_LHASH *lh); +OPENSSL_LHASH *OPENSSL_LH_new(OPENSSL_LH_HASHFUNC h, OPENSSL_LH_COMPFUNC c); +void OPENSSL_LH_free(OPENSSL_LHASH *lh); +void *OPENSSL_LH_insert(OPENSSL_LHASH *lh, void *data); +void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data); +void *OPENSSL_LH_retrieve(OPENSSL_LHASH *lh, const void *data); +void OPENSSL_LH_doall(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNC func); +void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg); +unsigned long OPENSSL_LH_strhash(const char *c); +unsigned long OPENSSL_LH_num_items(const OPENSSL_LHASH *lh); +unsigned long OPENSSL_LH_get_down_load(const OPENSSL_LHASH *lh); +void OPENSSL_LH_set_down_load(OPENSSL_LHASH *lh, unsigned long down_load); + +# ifndef OPENSSL_NO_STDIO +void OPENSSL_LH_stats(const OPENSSL_LHASH *lh, FILE *fp); +void OPENSSL_LH_node_stats(const OPENSSL_LHASH *lh, FILE *fp); +void OPENSSL_LH_node_usage_stats(const OPENSSL_LHASH *lh, FILE *fp); +# endif +void OPENSSL_LH_stats_bio(const OPENSSL_LHASH *lh, BIO *out); +void OPENSSL_LH_node_stats_bio(const OPENSSL_LHASH *lh, BIO *out); +void OPENSSL_LH_node_usage_stats_bio(const OPENSSL_LHASH *lh, BIO *out); + +# if OPENSSL_API_COMPAT < 0x10100000L +# define _LHASH OPENSSL_LHASH +# define LHASH_NODE OPENSSL_LH_NODE +# define lh_error OPENSSL_LH_error +# define lh_new OPENSSL_LH_new +# define lh_free OPENSSL_LH_free +# define lh_insert OPENSSL_LH_insert +# define lh_delete OPENSSL_LH_delete +# define lh_retrieve OPENSSL_LH_retrieve +# define lh_doall OPENSSL_LH_doall +# define lh_doall_arg OPENSSL_LH_doall_arg +# define lh_strhash OPENSSL_LH_strhash +# define lh_num_items OPENSSL_LH_num_items +# ifndef OPENSSL_NO_STDIO +# define lh_stats OPENSSL_LH_stats +# define lh_node_stats OPENSSL_LH_node_stats +# define lh_node_usage_stats OPENSSL_LH_node_usage_stats +# endif +# define lh_stats_bio OPENSSL_LH_stats_bio +# define lh_node_stats_bio OPENSSL_LH_node_stats_bio +# define lh_node_usage_stats_bio OPENSSL_LH_node_usage_stats_bio +# endif + +/* Type checking... */ + +# define LHASH_OF(type) struct lhash_st_##type + +# define DEFINE_LHASH_OF(type) \ + LHASH_OF(type) { union lh_##type##_dummy { void* d1; unsigned long d2; int d3; } dummy; }; \ + static ossl_unused ossl_inline LHASH_OF(type) *lh_##type##_new(unsigned long (*hfn)(const type *), \ + int (*cfn)(const type *, const type *)) \ + { \ + return (LHASH_OF(type) *) \ + OPENSSL_LH_new((OPENSSL_LH_HASHFUNC)hfn, (OPENSSL_LH_COMPFUNC)cfn); \ + } \ + static ossl_unused ossl_inline void lh_##type##_free(LHASH_OF(type) *lh) \ + { \ + OPENSSL_LH_free((OPENSSL_LHASH *)lh); \ + } \ + static ossl_unused ossl_inline type *lh_##type##_insert(LHASH_OF(type) *lh, type *d) \ + { \ + return (type *)OPENSSL_LH_insert((OPENSSL_LHASH *)lh, d); \ + } \ + static ossl_unused ossl_inline type *lh_##type##_delete(LHASH_OF(type) *lh, const type *d) \ + { \ + return (type *)OPENSSL_LH_delete((OPENSSL_LHASH *)lh, d); \ + } \ + static ossl_unused ossl_inline type *lh_##type##_retrieve(LHASH_OF(type) *lh, const type *d) \ + { \ + return (type *)OPENSSL_LH_retrieve((OPENSSL_LHASH *)lh, d); \ + } \ + static ossl_unused ossl_inline int lh_##type##_error(LHASH_OF(type) *lh) \ + { \ + return OPENSSL_LH_error((OPENSSL_LHASH *)lh); \ + } \ + static ossl_unused ossl_inline unsigned long lh_##type##_num_items(LHASH_OF(type) *lh) \ + { \ + return OPENSSL_LH_num_items((OPENSSL_LHASH *)lh); \ + } \ + static ossl_unused ossl_inline void lh_##type##_node_stats_bio(const LHASH_OF(type) *lh, BIO *out) \ + { \ + OPENSSL_LH_node_stats_bio((const OPENSSL_LHASH *)lh, out); \ + } \ + static ossl_unused ossl_inline void lh_##type##_node_usage_stats_bio(const LHASH_OF(type) *lh, BIO *out) \ + { \ + OPENSSL_LH_node_usage_stats_bio((const OPENSSL_LHASH *)lh, out); \ + } \ + static ossl_unused ossl_inline void lh_##type##_stats_bio(const LHASH_OF(type) *lh, BIO *out) \ + { \ + OPENSSL_LH_stats_bio((const OPENSSL_LHASH *)lh, out); \ + } \ + static ossl_unused ossl_inline unsigned long lh_##type##_get_down_load(LHASH_OF(type) *lh) \ + { \ + return OPENSSL_LH_get_down_load((OPENSSL_LHASH *)lh); \ + } \ + static ossl_unused ossl_inline void lh_##type##_set_down_load(LHASH_OF(type) *lh, unsigned long dl) \ + { \ + OPENSSL_LH_set_down_load((OPENSSL_LHASH *)lh, dl); \ + } \ + static ossl_unused ossl_inline void lh_##type##_doall(LHASH_OF(type) *lh, \ + void (*doall)(type *)) \ + { \ + OPENSSL_LH_doall((OPENSSL_LHASH *)lh, (OPENSSL_LH_DOALL_FUNC)doall); \ + } \ + LHASH_OF(type) + +#define IMPLEMENT_LHASH_DOALL_ARG_CONST(type, argtype) \ + int_implement_lhash_doall(type, argtype, const type) + +#define IMPLEMENT_LHASH_DOALL_ARG(type, argtype) \ + int_implement_lhash_doall(type, argtype, type) + +#define int_implement_lhash_doall(type, argtype, cbargtype) \ + static ossl_unused ossl_inline void \ + lh_##type##_doall_##argtype(LHASH_OF(type) *lh, \ + void (*fn)(cbargtype *, argtype *), \ + argtype *arg) \ + { \ + OPENSSL_LH_doall_arg((OPENSSL_LHASH *)lh, (OPENSSL_LH_DOALL_FUNCARG)fn, (void *)arg); \ + } \ + LHASH_OF(type) + +DEFINE_LHASH_OF(OPENSSL_STRING); +# ifdef _MSC_VER +/* + * push and pop this warning: + * warning C4090: 'function': different 'const' qualifiers + */ +# pragma warning (push) +# pragma warning (disable: 4090) +# endif + +DEFINE_LHASH_OF(OPENSSL_CSTRING); + +# ifdef _MSC_VER +# pragma warning (pop) +# endif + +/* + * If called without higher optimization (min. -xO3) the Oracle Developer + * Studio compiler generates code for the defined (static inline) functions + * above. + * This would later lead to the linker complaining about missing symbols when + * this header file is included but the resulting object is not linked against + * the Crypto library (openssl#6912). + */ +# ifdef __SUNPRO_C +# pragma weak OPENSSL_LH_new +# pragma weak OPENSSL_LH_free +# pragma weak OPENSSL_LH_insert +# pragma weak OPENSSL_LH_delete +# pragma weak OPENSSL_LH_retrieve +# pragma weak OPENSSL_LH_error +# pragma weak OPENSSL_LH_num_items +# pragma weak OPENSSL_LH_node_stats_bio +# pragma weak OPENSSL_LH_node_usage_stats_bio +# pragma weak OPENSSL_LH_stats_bio +# pragma weak OPENSSL_LH_get_down_load +# pragma weak OPENSSL_LH_set_down_load +# pragma weak OPENSSL_LH_doall +# pragma weak OPENSSL_LH_doall_arg +# endif /* __SUNPRO_C */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/md2.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/md2.h new file mode 100644 index 0000000..7faf8e3 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/md2.h @@ -0,0 +1,44 @@ +/* + * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_MD2_H +# define HEADER_MD2_H + +# include + +# ifndef OPENSSL_NO_MD2 +# include +# ifdef __cplusplus +extern "C" { +# endif + +typedef unsigned char MD2_INT; + +# define MD2_DIGEST_LENGTH 16 +# define MD2_BLOCK 16 + +typedef struct MD2state_st { + unsigned int num; + unsigned char data[MD2_BLOCK]; + MD2_INT cksm[MD2_BLOCK]; + MD2_INT state[MD2_BLOCK]; +} MD2_CTX; + +const char *MD2_options(void); +int MD2_Init(MD2_CTX *c); +int MD2_Update(MD2_CTX *c, const unsigned char *data, size_t len); +int MD2_Final(unsigned char *md, MD2_CTX *c); +unsigned char *MD2(const unsigned char *d, size_t n, unsigned char *md); + +# ifdef __cplusplus +} +# endif +# endif + +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/md4.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/md4.h new file mode 100644 index 0000000..940e29d --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/md4.h @@ -0,0 +1,51 @@ +/* + * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_MD4_H +# define HEADER_MD4_H + +# include + +# ifndef OPENSSL_NO_MD4 +# include +# include +# ifdef __cplusplus +extern "C" { +# endif + +/*- + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * ! MD4_LONG has to be at least 32 bits wide. ! + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + */ +# define MD4_LONG unsigned int + +# define MD4_CBLOCK 64 +# define MD4_LBLOCK (MD4_CBLOCK/4) +# define MD4_DIGEST_LENGTH 16 + +typedef struct MD4state_st { + MD4_LONG A, B, C, D; + MD4_LONG Nl, Nh; + MD4_LONG data[MD4_LBLOCK]; + unsigned int num; +} MD4_CTX; + +int MD4_Init(MD4_CTX *c); +int MD4_Update(MD4_CTX *c, const void *data, size_t len); +int MD4_Final(unsigned char *md, MD4_CTX *c); +unsigned char *MD4(const unsigned char *d, size_t n, unsigned char *md); +void MD4_Transform(MD4_CTX *c, const unsigned char *b); + +# ifdef __cplusplus +} +# endif +# endif + +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/md5.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/md5.h new file mode 100644 index 0000000..2deb772 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/md5.h @@ -0,0 +1,50 @@ +/* + * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_MD5_H +# define HEADER_MD5_H + +# include + +# ifndef OPENSSL_NO_MD5 +# include +# include +# ifdef __cplusplus +extern "C" { +# endif + +/* + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * ! MD5_LONG has to be at least 32 bits wide. ! + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + */ +# define MD5_LONG unsigned int + +# define MD5_CBLOCK 64 +# define MD5_LBLOCK (MD5_CBLOCK/4) +# define MD5_DIGEST_LENGTH 16 + +typedef struct MD5state_st { + MD5_LONG A, B, C, D; + MD5_LONG Nl, Nh; + MD5_LONG data[MD5_LBLOCK]; + unsigned int num; +} MD5_CTX; + +int MD5_Init(MD5_CTX *c); +int MD5_Update(MD5_CTX *c, const void *data, size_t len); +int MD5_Final(unsigned char *md, MD5_CTX *c); +unsigned char *MD5(const unsigned char *d, size_t n, unsigned char *md); +void MD5_Transform(MD5_CTX *c, const unsigned char *b); +# ifdef __cplusplus +} +# endif +# endif + +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/mdc2.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/mdc2.h new file mode 100644 index 0000000..aabd2bf --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/mdc2.h @@ -0,0 +1,42 @@ +/* + * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_MDC2_H +# define HEADER_MDC2_H + +# include + +#ifndef OPENSSL_NO_MDC2 +# include +# include +# ifdef __cplusplus +extern "C" { +# endif + +# define MDC2_BLOCK 8 +# define MDC2_DIGEST_LENGTH 16 + +typedef struct mdc2_ctx_st { + unsigned int num; + unsigned char data[MDC2_BLOCK]; + DES_cblock h, hh; + int pad_type; /* either 1 or 2, default 1 */ +} MDC2_CTX; + +int MDC2_Init(MDC2_CTX *c); +int MDC2_Update(MDC2_CTX *c, const unsigned char *data, size_t len); +int MDC2_Final(unsigned char *md, MDC2_CTX *c); +unsigned char *MDC2(const unsigned char *d, size_t n, unsigned char *md); + +# ifdef __cplusplus +} +# endif +# endif + +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/modes.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/modes.h new file mode 100644 index 0000000..d544f98 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/modes.h @@ -0,0 +1,208 @@ +/* + * Copyright 2008-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_MODES_H +# define HEADER_MODES_H + +# include + +# ifdef __cplusplus +extern "C" { +# endif +typedef void (*block128_f) (const unsigned char in[16], + unsigned char out[16], const void *key); + +typedef void (*cbc128_f) (const unsigned char *in, unsigned char *out, + size_t len, const void *key, + unsigned char ivec[16], int enc); + +typedef void (*ctr128_f) (const unsigned char *in, unsigned char *out, + size_t blocks, const void *key, + const unsigned char ivec[16]); + +typedef void (*ccm128_f) (const unsigned char *in, unsigned char *out, + size_t blocks, const void *key, + const unsigned char ivec[16], + unsigned char cmac[16]); + +void CRYPTO_cbc128_encrypt(const unsigned char *in, unsigned char *out, + size_t len, const void *key, + unsigned char ivec[16], block128_f block); +void CRYPTO_cbc128_decrypt(const unsigned char *in, unsigned char *out, + size_t len, const void *key, + unsigned char ivec[16], block128_f block); + +void CRYPTO_ctr128_encrypt(const unsigned char *in, unsigned char *out, + size_t len, const void *key, + unsigned char ivec[16], + unsigned char ecount_buf[16], unsigned int *num, + block128_f block); + +void CRYPTO_ctr128_encrypt_ctr32(const unsigned char *in, unsigned char *out, + size_t len, const void *key, + unsigned char ivec[16], + unsigned char ecount_buf[16], + unsigned int *num, ctr128_f ctr); + +void CRYPTO_ofb128_encrypt(const unsigned char *in, unsigned char *out, + size_t len, const void *key, + unsigned char ivec[16], int *num, + block128_f block); + +void CRYPTO_cfb128_encrypt(const unsigned char *in, unsigned char *out, + size_t len, const void *key, + unsigned char ivec[16], int *num, + int enc, block128_f block); +void CRYPTO_cfb128_8_encrypt(const unsigned char *in, unsigned char *out, + size_t length, const void *key, + unsigned char ivec[16], int *num, + int enc, block128_f block); +void CRYPTO_cfb128_1_encrypt(const unsigned char *in, unsigned char *out, + size_t bits, const void *key, + unsigned char ivec[16], int *num, + int enc, block128_f block); + +size_t CRYPTO_cts128_encrypt_block(const unsigned char *in, + unsigned char *out, size_t len, + const void *key, unsigned char ivec[16], + block128_f block); +size_t CRYPTO_cts128_encrypt(const unsigned char *in, unsigned char *out, + size_t len, const void *key, + unsigned char ivec[16], cbc128_f cbc); +size_t CRYPTO_cts128_decrypt_block(const unsigned char *in, + unsigned char *out, size_t len, + const void *key, unsigned char ivec[16], + block128_f block); +size_t CRYPTO_cts128_decrypt(const unsigned char *in, unsigned char *out, + size_t len, const void *key, + unsigned char ivec[16], cbc128_f cbc); + +size_t CRYPTO_nistcts128_encrypt_block(const unsigned char *in, + unsigned char *out, size_t len, + const void *key, + unsigned char ivec[16], + block128_f block); +size_t CRYPTO_nistcts128_encrypt(const unsigned char *in, unsigned char *out, + size_t len, const void *key, + unsigned char ivec[16], cbc128_f cbc); +size_t CRYPTO_nistcts128_decrypt_block(const unsigned char *in, + unsigned char *out, size_t len, + const void *key, + unsigned char ivec[16], + block128_f block); +size_t CRYPTO_nistcts128_decrypt(const unsigned char *in, unsigned char *out, + size_t len, const void *key, + unsigned char ivec[16], cbc128_f cbc); + +typedef struct gcm128_context GCM128_CONTEXT; + +GCM128_CONTEXT *CRYPTO_gcm128_new(void *key, block128_f block); +void CRYPTO_gcm128_init(GCM128_CONTEXT *ctx, void *key, block128_f block); +void CRYPTO_gcm128_setiv(GCM128_CONTEXT *ctx, const unsigned char *iv, + size_t len); +int CRYPTO_gcm128_aad(GCM128_CONTEXT *ctx, const unsigned char *aad, + size_t len); +int CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx, + const unsigned char *in, unsigned char *out, + size_t len); +int CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx, + const unsigned char *in, unsigned char *out, + size_t len); +int CRYPTO_gcm128_encrypt_ctr32(GCM128_CONTEXT *ctx, + const unsigned char *in, unsigned char *out, + size_t len, ctr128_f stream); +int CRYPTO_gcm128_decrypt_ctr32(GCM128_CONTEXT *ctx, + const unsigned char *in, unsigned char *out, + size_t len, ctr128_f stream); +int CRYPTO_gcm128_finish(GCM128_CONTEXT *ctx, const unsigned char *tag, + size_t len); +void CRYPTO_gcm128_tag(GCM128_CONTEXT *ctx, unsigned char *tag, size_t len); +void CRYPTO_gcm128_release(GCM128_CONTEXT *ctx); + +typedef struct ccm128_context CCM128_CONTEXT; + +void CRYPTO_ccm128_init(CCM128_CONTEXT *ctx, + unsigned int M, unsigned int L, void *key, + block128_f block); +int CRYPTO_ccm128_setiv(CCM128_CONTEXT *ctx, const unsigned char *nonce, + size_t nlen, size_t mlen); +void CRYPTO_ccm128_aad(CCM128_CONTEXT *ctx, const unsigned char *aad, + size_t alen); +int CRYPTO_ccm128_encrypt(CCM128_CONTEXT *ctx, const unsigned char *inp, + unsigned char *out, size_t len); +int CRYPTO_ccm128_decrypt(CCM128_CONTEXT *ctx, const unsigned char *inp, + unsigned char *out, size_t len); +int CRYPTO_ccm128_encrypt_ccm64(CCM128_CONTEXT *ctx, const unsigned char *inp, + unsigned char *out, size_t len, + ccm128_f stream); +int CRYPTO_ccm128_decrypt_ccm64(CCM128_CONTEXT *ctx, const unsigned char *inp, + unsigned char *out, size_t len, + ccm128_f stream); +size_t CRYPTO_ccm128_tag(CCM128_CONTEXT *ctx, unsigned char *tag, size_t len); + +typedef struct xts128_context XTS128_CONTEXT; + +int CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx, + const unsigned char iv[16], + const unsigned char *inp, unsigned char *out, + size_t len, int enc); + +size_t CRYPTO_128_wrap(void *key, const unsigned char *iv, + unsigned char *out, + const unsigned char *in, size_t inlen, + block128_f block); + +size_t CRYPTO_128_unwrap(void *key, const unsigned char *iv, + unsigned char *out, + const unsigned char *in, size_t inlen, + block128_f block); +size_t CRYPTO_128_wrap_pad(void *key, const unsigned char *icv, + unsigned char *out, const unsigned char *in, + size_t inlen, block128_f block); +size_t CRYPTO_128_unwrap_pad(void *key, const unsigned char *icv, + unsigned char *out, const unsigned char *in, + size_t inlen, block128_f block); + +# ifndef OPENSSL_NO_OCB +typedef struct ocb128_context OCB128_CONTEXT; + +typedef void (*ocb128_f) (const unsigned char *in, unsigned char *out, + size_t blocks, const void *key, + size_t start_block_num, + unsigned char offset_i[16], + const unsigned char L_[][16], + unsigned char checksum[16]); + +OCB128_CONTEXT *CRYPTO_ocb128_new(void *keyenc, void *keydec, + block128_f encrypt, block128_f decrypt, + ocb128_f stream); +int CRYPTO_ocb128_init(OCB128_CONTEXT *ctx, void *keyenc, void *keydec, + block128_f encrypt, block128_f decrypt, + ocb128_f stream); +int CRYPTO_ocb128_copy_ctx(OCB128_CONTEXT *dest, OCB128_CONTEXT *src, + void *keyenc, void *keydec); +int CRYPTO_ocb128_setiv(OCB128_CONTEXT *ctx, const unsigned char *iv, + size_t len, size_t taglen); +int CRYPTO_ocb128_aad(OCB128_CONTEXT *ctx, const unsigned char *aad, + size_t len); +int CRYPTO_ocb128_encrypt(OCB128_CONTEXT *ctx, const unsigned char *in, + unsigned char *out, size_t len); +int CRYPTO_ocb128_decrypt(OCB128_CONTEXT *ctx, const unsigned char *in, + unsigned char *out, size_t len); +int CRYPTO_ocb128_finish(OCB128_CONTEXT *ctx, const unsigned char *tag, + size_t len); +int CRYPTO_ocb128_tag(OCB128_CONTEXT *ctx, unsigned char *tag, size_t len); +void CRYPTO_ocb128_cleanup(OCB128_CONTEXT *ctx); +# endif /* OPENSSL_NO_OCB */ + +# ifdef __cplusplus +} +# endif + +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/obj_mac.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/obj_mac.h new file mode 100644 index 0000000..483fc05 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/obj_mac.h @@ -0,0 +1,5198 @@ +/* + * WARNING: do not edit! + * Generated by crypto/objects/objects.pl + * + * Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved. + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#define SN_undef "UNDEF" +#define LN_undef "undefined" +#define NID_undef 0 +#define OBJ_undef 0L + +#define SN_itu_t "ITU-T" +#define LN_itu_t "itu-t" +#define NID_itu_t 645 +#define OBJ_itu_t 0L + +#define NID_ccitt 404 +#define OBJ_ccitt OBJ_itu_t + +#define SN_iso "ISO" +#define LN_iso "iso" +#define NID_iso 181 +#define OBJ_iso 1L + +#define SN_joint_iso_itu_t "JOINT-ISO-ITU-T" +#define LN_joint_iso_itu_t "joint-iso-itu-t" +#define NID_joint_iso_itu_t 646 +#define OBJ_joint_iso_itu_t 2L + +#define NID_joint_iso_ccitt 393 +#define OBJ_joint_iso_ccitt OBJ_joint_iso_itu_t + +#define SN_member_body "member-body" +#define LN_member_body "ISO Member Body" +#define NID_member_body 182 +#define OBJ_member_body OBJ_iso,2L + +#define SN_identified_organization "identified-organization" +#define NID_identified_organization 676 +#define OBJ_identified_organization OBJ_iso,3L + +#define SN_hmac_md5 "HMAC-MD5" +#define LN_hmac_md5 "hmac-md5" +#define NID_hmac_md5 780 +#define OBJ_hmac_md5 OBJ_identified_organization,6L,1L,5L,5L,8L,1L,1L + +#define SN_hmac_sha1 "HMAC-SHA1" +#define LN_hmac_sha1 "hmac-sha1" +#define NID_hmac_sha1 781 +#define OBJ_hmac_sha1 OBJ_identified_organization,6L,1L,5L,5L,8L,1L,2L + +#define SN_x509ExtAdmission "x509ExtAdmission" +#define LN_x509ExtAdmission "Professional Information or basis for Admission" +#define NID_x509ExtAdmission 1093 +#define OBJ_x509ExtAdmission OBJ_identified_organization,36L,8L,3L,3L + +#define SN_certicom_arc "certicom-arc" +#define NID_certicom_arc 677 +#define OBJ_certicom_arc OBJ_identified_organization,132L + +#define SN_ieee "ieee" +#define NID_ieee 1170 +#define OBJ_ieee OBJ_identified_organization,111L + +#define SN_ieee_siswg "ieee-siswg" +#define LN_ieee_siswg "IEEE Security in Storage Working Group" +#define NID_ieee_siswg 1171 +#define OBJ_ieee_siswg OBJ_ieee,2L,1619L + +#define SN_international_organizations "international-organizations" +#define LN_international_organizations "International Organizations" +#define NID_international_organizations 647 +#define OBJ_international_organizations OBJ_joint_iso_itu_t,23L + +#define SN_wap "wap" +#define NID_wap 678 +#define OBJ_wap OBJ_international_organizations,43L + +#define SN_wap_wsg "wap-wsg" +#define NID_wap_wsg 679 +#define OBJ_wap_wsg OBJ_wap,1L + +#define SN_selected_attribute_types "selected-attribute-types" +#define LN_selected_attribute_types "Selected Attribute Types" +#define NID_selected_attribute_types 394 +#define OBJ_selected_attribute_types OBJ_joint_iso_itu_t,5L,1L,5L + +#define SN_clearance "clearance" +#define NID_clearance 395 +#define OBJ_clearance OBJ_selected_attribute_types,55L + +#define SN_ISO_US "ISO-US" +#define LN_ISO_US "ISO US Member Body" +#define NID_ISO_US 183 +#define OBJ_ISO_US OBJ_member_body,840L + +#define SN_X9_57 "X9-57" +#define LN_X9_57 "X9.57" +#define NID_X9_57 184 +#define OBJ_X9_57 OBJ_ISO_US,10040L + +#define SN_X9cm "X9cm" +#define LN_X9cm "X9.57 CM ?" +#define NID_X9cm 185 +#define OBJ_X9cm OBJ_X9_57,4L + +#define SN_ISO_CN "ISO-CN" +#define LN_ISO_CN "ISO CN Member Body" +#define NID_ISO_CN 1140 +#define OBJ_ISO_CN OBJ_member_body,156L + +#define SN_oscca "oscca" +#define NID_oscca 1141 +#define OBJ_oscca OBJ_ISO_CN,10197L + +#define SN_sm_scheme "sm-scheme" +#define NID_sm_scheme 1142 +#define OBJ_sm_scheme OBJ_oscca,1L + +#define SN_dsa "DSA" +#define LN_dsa "dsaEncryption" +#define NID_dsa 116 +#define OBJ_dsa OBJ_X9cm,1L + +#define SN_dsaWithSHA1 "DSA-SHA1" +#define LN_dsaWithSHA1 "dsaWithSHA1" +#define NID_dsaWithSHA1 113 +#define OBJ_dsaWithSHA1 OBJ_X9cm,3L + +#define SN_ansi_X9_62 "ansi-X9-62" +#define LN_ansi_X9_62 "ANSI X9.62" +#define NID_ansi_X9_62 405 +#define OBJ_ansi_X9_62 OBJ_ISO_US,10045L + +#define OBJ_X9_62_id_fieldType OBJ_ansi_X9_62,1L + +#define SN_X9_62_prime_field "prime-field" +#define NID_X9_62_prime_field 406 +#define OBJ_X9_62_prime_field OBJ_X9_62_id_fieldType,1L + +#define SN_X9_62_characteristic_two_field "characteristic-two-field" +#define NID_X9_62_characteristic_two_field 407 +#define OBJ_X9_62_characteristic_two_field OBJ_X9_62_id_fieldType,2L + +#define SN_X9_62_id_characteristic_two_basis "id-characteristic-two-basis" +#define NID_X9_62_id_characteristic_two_basis 680 +#define OBJ_X9_62_id_characteristic_two_basis OBJ_X9_62_characteristic_two_field,3L + +#define SN_X9_62_onBasis "onBasis" +#define NID_X9_62_onBasis 681 +#define OBJ_X9_62_onBasis OBJ_X9_62_id_characteristic_two_basis,1L + +#define SN_X9_62_tpBasis "tpBasis" +#define NID_X9_62_tpBasis 682 +#define OBJ_X9_62_tpBasis OBJ_X9_62_id_characteristic_two_basis,2L + +#define SN_X9_62_ppBasis "ppBasis" +#define NID_X9_62_ppBasis 683 +#define OBJ_X9_62_ppBasis OBJ_X9_62_id_characteristic_two_basis,3L + +#define OBJ_X9_62_id_publicKeyType OBJ_ansi_X9_62,2L + +#define SN_X9_62_id_ecPublicKey "id-ecPublicKey" +#define NID_X9_62_id_ecPublicKey 408 +#define OBJ_X9_62_id_ecPublicKey OBJ_X9_62_id_publicKeyType,1L + +#define OBJ_X9_62_ellipticCurve OBJ_ansi_X9_62,3L + +#define OBJ_X9_62_c_TwoCurve OBJ_X9_62_ellipticCurve,0L + +#define SN_X9_62_c2pnb163v1 "c2pnb163v1" +#define NID_X9_62_c2pnb163v1 684 +#define OBJ_X9_62_c2pnb163v1 OBJ_X9_62_c_TwoCurve,1L + +#define SN_X9_62_c2pnb163v2 "c2pnb163v2" +#define NID_X9_62_c2pnb163v2 685 +#define OBJ_X9_62_c2pnb163v2 OBJ_X9_62_c_TwoCurve,2L + +#define SN_X9_62_c2pnb163v3 "c2pnb163v3" +#define NID_X9_62_c2pnb163v3 686 +#define OBJ_X9_62_c2pnb163v3 OBJ_X9_62_c_TwoCurve,3L + +#define SN_X9_62_c2pnb176v1 "c2pnb176v1" +#define NID_X9_62_c2pnb176v1 687 +#define OBJ_X9_62_c2pnb176v1 OBJ_X9_62_c_TwoCurve,4L + +#define SN_X9_62_c2tnb191v1 "c2tnb191v1" +#define NID_X9_62_c2tnb191v1 688 +#define OBJ_X9_62_c2tnb191v1 OBJ_X9_62_c_TwoCurve,5L + +#define SN_X9_62_c2tnb191v2 "c2tnb191v2" +#define NID_X9_62_c2tnb191v2 689 +#define OBJ_X9_62_c2tnb191v2 OBJ_X9_62_c_TwoCurve,6L + +#define SN_X9_62_c2tnb191v3 "c2tnb191v3" +#define NID_X9_62_c2tnb191v3 690 +#define OBJ_X9_62_c2tnb191v3 OBJ_X9_62_c_TwoCurve,7L + +#define SN_X9_62_c2onb191v4 "c2onb191v4" +#define NID_X9_62_c2onb191v4 691 +#define OBJ_X9_62_c2onb191v4 OBJ_X9_62_c_TwoCurve,8L + +#define SN_X9_62_c2onb191v5 "c2onb191v5" +#define NID_X9_62_c2onb191v5 692 +#define OBJ_X9_62_c2onb191v5 OBJ_X9_62_c_TwoCurve,9L + +#define SN_X9_62_c2pnb208w1 "c2pnb208w1" +#define NID_X9_62_c2pnb208w1 693 +#define OBJ_X9_62_c2pnb208w1 OBJ_X9_62_c_TwoCurve,10L + +#define SN_X9_62_c2tnb239v1 "c2tnb239v1" +#define NID_X9_62_c2tnb239v1 694 +#define OBJ_X9_62_c2tnb239v1 OBJ_X9_62_c_TwoCurve,11L + +#define SN_X9_62_c2tnb239v2 "c2tnb239v2" +#define NID_X9_62_c2tnb239v2 695 +#define OBJ_X9_62_c2tnb239v2 OBJ_X9_62_c_TwoCurve,12L + +#define SN_X9_62_c2tnb239v3 "c2tnb239v3" +#define NID_X9_62_c2tnb239v3 696 +#define OBJ_X9_62_c2tnb239v3 OBJ_X9_62_c_TwoCurve,13L + +#define SN_X9_62_c2onb239v4 "c2onb239v4" +#define NID_X9_62_c2onb239v4 697 +#define OBJ_X9_62_c2onb239v4 OBJ_X9_62_c_TwoCurve,14L + +#define SN_X9_62_c2onb239v5 "c2onb239v5" +#define NID_X9_62_c2onb239v5 698 +#define OBJ_X9_62_c2onb239v5 OBJ_X9_62_c_TwoCurve,15L + +#define SN_X9_62_c2pnb272w1 "c2pnb272w1" +#define NID_X9_62_c2pnb272w1 699 +#define OBJ_X9_62_c2pnb272w1 OBJ_X9_62_c_TwoCurve,16L + +#define SN_X9_62_c2pnb304w1 "c2pnb304w1" +#define NID_X9_62_c2pnb304w1 700 +#define OBJ_X9_62_c2pnb304w1 OBJ_X9_62_c_TwoCurve,17L + +#define SN_X9_62_c2tnb359v1 "c2tnb359v1" +#define NID_X9_62_c2tnb359v1 701 +#define OBJ_X9_62_c2tnb359v1 OBJ_X9_62_c_TwoCurve,18L + +#define SN_X9_62_c2pnb368w1 "c2pnb368w1" +#define NID_X9_62_c2pnb368w1 702 +#define OBJ_X9_62_c2pnb368w1 OBJ_X9_62_c_TwoCurve,19L + +#define SN_X9_62_c2tnb431r1 "c2tnb431r1" +#define NID_X9_62_c2tnb431r1 703 +#define OBJ_X9_62_c2tnb431r1 OBJ_X9_62_c_TwoCurve,20L + +#define OBJ_X9_62_primeCurve OBJ_X9_62_ellipticCurve,1L + +#define SN_X9_62_prime192v1 "prime192v1" +#define NID_X9_62_prime192v1 409 +#define OBJ_X9_62_prime192v1 OBJ_X9_62_primeCurve,1L + +#define SN_X9_62_prime192v2 "prime192v2" +#define NID_X9_62_prime192v2 410 +#define OBJ_X9_62_prime192v2 OBJ_X9_62_primeCurve,2L + +#define SN_X9_62_prime192v3 "prime192v3" +#define NID_X9_62_prime192v3 411 +#define OBJ_X9_62_prime192v3 OBJ_X9_62_primeCurve,3L + +#define SN_X9_62_prime239v1 "prime239v1" +#define NID_X9_62_prime239v1 412 +#define OBJ_X9_62_prime239v1 OBJ_X9_62_primeCurve,4L + +#define SN_X9_62_prime239v2 "prime239v2" +#define NID_X9_62_prime239v2 413 +#define OBJ_X9_62_prime239v2 OBJ_X9_62_primeCurve,5L + +#define SN_X9_62_prime239v3 "prime239v3" +#define NID_X9_62_prime239v3 414 +#define OBJ_X9_62_prime239v3 OBJ_X9_62_primeCurve,6L + +#define SN_X9_62_prime256v1 "prime256v1" +#define NID_X9_62_prime256v1 415 +#define OBJ_X9_62_prime256v1 OBJ_X9_62_primeCurve,7L + +#define OBJ_X9_62_id_ecSigType OBJ_ansi_X9_62,4L + +#define SN_ecdsa_with_SHA1 "ecdsa-with-SHA1" +#define NID_ecdsa_with_SHA1 416 +#define OBJ_ecdsa_with_SHA1 OBJ_X9_62_id_ecSigType,1L + +#define SN_ecdsa_with_Recommended "ecdsa-with-Recommended" +#define NID_ecdsa_with_Recommended 791 +#define OBJ_ecdsa_with_Recommended OBJ_X9_62_id_ecSigType,2L + +#define SN_ecdsa_with_Specified "ecdsa-with-Specified" +#define NID_ecdsa_with_Specified 792 +#define OBJ_ecdsa_with_Specified OBJ_X9_62_id_ecSigType,3L + +#define SN_ecdsa_with_SHA224 "ecdsa-with-SHA224" +#define NID_ecdsa_with_SHA224 793 +#define OBJ_ecdsa_with_SHA224 OBJ_ecdsa_with_Specified,1L + +#define SN_ecdsa_with_SHA256 "ecdsa-with-SHA256" +#define NID_ecdsa_with_SHA256 794 +#define OBJ_ecdsa_with_SHA256 OBJ_ecdsa_with_Specified,2L + +#define SN_ecdsa_with_SHA384 "ecdsa-with-SHA384" +#define NID_ecdsa_with_SHA384 795 +#define OBJ_ecdsa_with_SHA384 OBJ_ecdsa_with_Specified,3L + +#define SN_ecdsa_with_SHA512 "ecdsa-with-SHA512" +#define NID_ecdsa_with_SHA512 796 +#define OBJ_ecdsa_with_SHA512 OBJ_ecdsa_with_Specified,4L + +#define OBJ_secg_ellipticCurve OBJ_certicom_arc,0L + +#define SN_secp112r1 "secp112r1" +#define NID_secp112r1 704 +#define OBJ_secp112r1 OBJ_secg_ellipticCurve,6L + +#define SN_secp112r2 "secp112r2" +#define NID_secp112r2 705 +#define OBJ_secp112r2 OBJ_secg_ellipticCurve,7L + +#define SN_secp128r1 "secp128r1" +#define NID_secp128r1 706 +#define OBJ_secp128r1 OBJ_secg_ellipticCurve,28L + +#define SN_secp128r2 "secp128r2" +#define NID_secp128r2 707 +#define OBJ_secp128r2 OBJ_secg_ellipticCurve,29L + +#define SN_secp160k1 "secp160k1" +#define NID_secp160k1 708 +#define OBJ_secp160k1 OBJ_secg_ellipticCurve,9L + +#define SN_secp160r1 "secp160r1" +#define NID_secp160r1 709 +#define OBJ_secp160r1 OBJ_secg_ellipticCurve,8L + +#define SN_secp160r2 "secp160r2" +#define NID_secp160r2 710 +#define OBJ_secp160r2 OBJ_secg_ellipticCurve,30L + +#define SN_secp192k1 "secp192k1" +#define NID_secp192k1 711 +#define OBJ_secp192k1 OBJ_secg_ellipticCurve,31L + +#define SN_secp224k1 "secp224k1" +#define NID_secp224k1 712 +#define OBJ_secp224k1 OBJ_secg_ellipticCurve,32L + +#define SN_secp224r1 "secp224r1" +#define NID_secp224r1 713 +#define OBJ_secp224r1 OBJ_secg_ellipticCurve,33L + +#define SN_secp256k1 "secp256k1" +#define NID_secp256k1 714 +#define OBJ_secp256k1 OBJ_secg_ellipticCurve,10L + +#define SN_secp384r1 "secp384r1" +#define NID_secp384r1 715 +#define OBJ_secp384r1 OBJ_secg_ellipticCurve,34L + +#define SN_secp521r1 "secp521r1" +#define NID_secp521r1 716 +#define OBJ_secp521r1 OBJ_secg_ellipticCurve,35L + +#define SN_sect113r1 "sect113r1" +#define NID_sect113r1 717 +#define OBJ_sect113r1 OBJ_secg_ellipticCurve,4L + +#define SN_sect113r2 "sect113r2" +#define NID_sect113r2 718 +#define OBJ_sect113r2 OBJ_secg_ellipticCurve,5L + +#define SN_sect131r1 "sect131r1" +#define NID_sect131r1 719 +#define OBJ_sect131r1 OBJ_secg_ellipticCurve,22L + +#define SN_sect131r2 "sect131r2" +#define NID_sect131r2 720 +#define OBJ_sect131r2 OBJ_secg_ellipticCurve,23L + +#define SN_sect163k1 "sect163k1" +#define NID_sect163k1 721 +#define OBJ_sect163k1 OBJ_secg_ellipticCurve,1L + +#define SN_sect163r1 "sect163r1" +#define NID_sect163r1 722 +#define OBJ_sect163r1 OBJ_secg_ellipticCurve,2L + +#define SN_sect163r2 "sect163r2" +#define NID_sect163r2 723 +#define OBJ_sect163r2 OBJ_secg_ellipticCurve,15L + +#define SN_sect193r1 "sect193r1" +#define NID_sect193r1 724 +#define OBJ_sect193r1 OBJ_secg_ellipticCurve,24L + +#define SN_sect193r2 "sect193r2" +#define NID_sect193r2 725 +#define OBJ_sect193r2 OBJ_secg_ellipticCurve,25L + +#define SN_sect233k1 "sect233k1" +#define NID_sect233k1 726 +#define OBJ_sect233k1 OBJ_secg_ellipticCurve,26L + +#define SN_sect233r1 "sect233r1" +#define NID_sect233r1 727 +#define OBJ_sect233r1 OBJ_secg_ellipticCurve,27L + +#define SN_sect239k1 "sect239k1" +#define NID_sect239k1 728 +#define OBJ_sect239k1 OBJ_secg_ellipticCurve,3L + +#define SN_sect283k1 "sect283k1" +#define NID_sect283k1 729 +#define OBJ_sect283k1 OBJ_secg_ellipticCurve,16L + +#define SN_sect283r1 "sect283r1" +#define NID_sect283r1 730 +#define OBJ_sect283r1 OBJ_secg_ellipticCurve,17L + +#define SN_sect409k1 "sect409k1" +#define NID_sect409k1 731 +#define OBJ_sect409k1 OBJ_secg_ellipticCurve,36L + +#define SN_sect409r1 "sect409r1" +#define NID_sect409r1 732 +#define OBJ_sect409r1 OBJ_secg_ellipticCurve,37L + +#define SN_sect571k1 "sect571k1" +#define NID_sect571k1 733 +#define OBJ_sect571k1 OBJ_secg_ellipticCurve,38L + +#define SN_sect571r1 "sect571r1" +#define NID_sect571r1 734 +#define OBJ_sect571r1 OBJ_secg_ellipticCurve,39L + +#define OBJ_wap_wsg_idm_ecid OBJ_wap_wsg,4L + +#define SN_wap_wsg_idm_ecid_wtls1 "wap-wsg-idm-ecid-wtls1" +#define NID_wap_wsg_idm_ecid_wtls1 735 +#define OBJ_wap_wsg_idm_ecid_wtls1 OBJ_wap_wsg_idm_ecid,1L + +#define SN_wap_wsg_idm_ecid_wtls3 "wap-wsg-idm-ecid-wtls3" +#define NID_wap_wsg_idm_ecid_wtls3 736 +#define OBJ_wap_wsg_idm_ecid_wtls3 OBJ_wap_wsg_idm_ecid,3L + +#define SN_wap_wsg_idm_ecid_wtls4 "wap-wsg-idm-ecid-wtls4" +#define NID_wap_wsg_idm_ecid_wtls4 737 +#define OBJ_wap_wsg_idm_ecid_wtls4 OBJ_wap_wsg_idm_ecid,4L + +#define SN_wap_wsg_idm_ecid_wtls5 "wap-wsg-idm-ecid-wtls5" +#define NID_wap_wsg_idm_ecid_wtls5 738 +#define OBJ_wap_wsg_idm_ecid_wtls5 OBJ_wap_wsg_idm_ecid,5L + +#define SN_wap_wsg_idm_ecid_wtls6 "wap-wsg-idm-ecid-wtls6" +#define NID_wap_wsg_idm_ecid_wtls6 739 +#define OBJ_wap_wsg_idm_ecid_wtls6 OBJ_wap_wsg_idm_ecid,6L + +#define SN_wap_wsg_idm_ecid_wtls7 "wap-wsg-idm-ecid-wtls7" +#define NID_wap_wsg_idm_ecid_wtls7 740 +#define OBJ_wap_wsg_idm_ecid_wtls7 OBJ_wap_wsg_idm_ecid,7L + +#define SN_wap_wsg_idm_ecid_wtls8 "wap-wsg-idm-ecid-wtls8" +#define NID_wap_wsg_idm_ecid_wtls8 741 +#define OBJ_wap_wsg_idm_ecid_wtls8 OBJ_wap_wsg_idm_ecid,8L + +#define SN_wap_wsg_idm_ecid_wtls9 "wap-wsg-idm-ecid-wtls9" +#define NID_wap_wsg_idm_ecid_wtls9 742 +#define OBJ_wap_wsg_idm_ecid_wtls9 OBJ_wap_wsg_idm_ecid,9L + +#define SN_wap_wsg_idm_ecid_wtls10 "wap-wsg-idm-ecid-wtls10" +#define NID_wap_wsg_idm_ecid_wtls10 743 +#define OBJ_wap_wsg_idm_ecid_wtls10 OBJ_wap_wsg_idm_ecid,10L + +#define SN_wap_wsg_idm_ecid_wtls11 "wap-wsg-idm-ecid-wtls11" +#define NID_wap_wsg_idm_ecid_wtls11 744 +#define OBJ_wap_wsg_idm_ecid_wtls11 OBJ_wap_wsg_idm_ecid,11L + +#define SN_wap_wsg_idm_ecid_wtls12 "wap-wsg-idm-ecid-wtls12" +#define NID_wap_wsg_idm_ecid_wtls12 745 +#define OBJ_wap_wsg_idm_ecid_wtls12 OBJ_wap_wsg_idm_ecid,12L + +#define SN_cast5_cbc "CAST5-CBC" +#define LN_cast5_cbc "cast5-cbc" +#define NID_cast5_cbc 108 +#define OBJ_cast5_cbc OBJ_ISO_US,113533L,7L,66L,10L + +#define SN_cast5_ecb "CAST5-ECB" +#define LN_cast5_ecb "cast5-ecb" +#define NID_cast5_ecb 109 + +#define SN_cast5_cfb64 "CAST5-CFB" +#define LN_cast5_cfb64 "cast5-cfb" +#define NID_cast5_cfb64 110 + +#define SN_cast5_ofb64 "CAST5-OFB" +#define LN_cast5_ofb64 "cast5-ofb" +#define NID_cast5_ofb64 111 + +#define LN_pbeWithMD5AndCast5_CBC "pbeWithMD5AndCast5CBC" +#define NID_pbeWithMD5AndCast5_CBC 112 +#define OBJ_pbeWithMD5AndCast5_CBC OBJ_ISO_US,113533L,7L,66L,12L + +#define SN_id_PasswordBasedMAC "id-PasswordBasedMAC" +#define LN_id_PasswordBasedMAC "password based MAC" +#define NID_id_PasswordBasedMAC 782 +#define OBJ_id_PasswordBasedMAC OBJ_ISO_US,113533L,7L,66L,13L + +#define SN_id_DHBasedMac "id-DHBasedMac" +#define LN_id_DHBasedMac "Diffie-Hellman based MAC" +#define NID_id_DHBasedMac 783 +#define OBJ_id_DHBasedMac OBJ_ISO_US,113533L,7L,66L,30L + +#define SN_rsadsi "rsadsi" +#define LN_rsadsi "RSA Data Security, Inc." +#define NID_rsadsi 1 +#define OBJ_rsadsi OBJ_ISO_US,113549L + +#define SN_pkcs "pkcs" +#define LN_pkcs "RSA Data Security, Inc. PKCS" +#define NID_pkcs 2 +#define OBJ_pkcs OBJ_rsadsi,1L + +#define SN_pkcs1 "pkcs1" +#define NID_pkcs1 186 +#define OBJ_pkcs1 OBJ_pkcs,1L + +#define LN_rsaEncryption "rsaEncryption" +#define NID_rsaEncryption 6 +#define OBJ_rsaEncryption OBJ_pkcs1,1L + +#define SN_md2WithRSAEncryption "RSA-MD2" +#define LN_md2WithRSAEncryption "md2WithRSAEncryption" +#define NID_md2WithRSAEncryption 7 +#define OBJ_md2WithRSAEncryption OBJ_pkcs1,2L + +#define SN_md4WithRSAEncryption "RSA-MD4" +#define LN_md4WithRSAEncryption "md4WithRSAEncryption" +#define NID_md4WithRSAEncryption 396 +#define OBJ_md4WithRSAEncryption OBJ_pkcs1,3L + +#define SN_md5WithRSAEncryption "RSA-MD5" +#define LN_md5WithRSAEncryption "md5WithRSAEncryption" +#define NID_md5WithRSAEncryption 8 +#define OBJ_md5WithRSAEncryption OBJ_pkcs1,4L + +#define SN_sha1WithRSAEncryption "RSA-SHA1" +#define LN_sha1WithRSAEncryption "sha1WithRSAEncryption" +#define NID_sha1WithRSAEncryption 65 +#define OBJ_sha1WithRSAEncryption OBJ_pkcs1,5L + +#define SN_rsaesOaep "RSAES-OAEP" +#define LN_rsaesOaep "rsaesOaep" +#define NID_rsaesOaep 919 +#define OBJ_rsaesOaep OBJ_pkcs1,7L + +#define SN_mgf1 "MGF1" +#define LN_mgf1 "mgf1" +#define NID_mgf1 911 +#define OBJ_mgf1 OBJ_pkcs1,8L + +#define SN_pSpecified "PSPECIFIED" +#define LN_pSpecified "pSpecified" +#define NID_pSpecified 935 +#define OBJ_pSpecified OBJ_pkcs1,9L + +#define SN_rsassaPss "RSASSA-PSS" +#define LN_rsassaPss "rsassaPss" +#define NID_rsassaPss 912 +#define OBJ_rsassaPss OBJ_pkcs1,10L + +#define SN_sha256WithRSAEncryption "RSA-SHA256" +#define LN_sha256WithRSAEncryption "sha256WithRSAEncryption" +#define NID_sha256WithRSAEncryption 668 +#define OBJ_sha256WithRSAEncryption OBJ_pkcs1,11L + +#define SN_sha384WithRSAEncryption "RSA-SHA384" +#define LN_sha384WithRSAEncryption "sha384WithRSAEncryption" +#define NID_sha384WithRSAEncryption 669 +#define OBJ_sha384WithRSAEncryption OBJ_pkcs1,12L + +#define SN_sha512WithRSAEncryption "RSA-SHA512" +#define LN_sha512WithRSAEncryption "sha512WithRSAEncryption" +#define NID_sha512WithRSAEncryption 670 +#define OBJ_sha512WithRSAEncryption OBJ_pkcs1,13L + +#define SN_sha224WithRSAEncryption "RSA-SHA224" +#define LN_sha224WithRSAEncryption "sha224WithRSAEncryption" +#define NID_sha224WithRSAEncryption 671 +#define OBJ_sha224WithRSAEncryption OBJ_pkcs1,14L + +#define SN_sha512_224WithRSAEncryption "RSA-SHA512/224" +#define LN_sha512_224WithRSAEncryption "sha512-224WithRSAEncryption" +#define NID_sha512_224WithRSAEncryption 1145 +#define OBJ_sha512_224WithRSAEncryption OBJ_pkcs1,15L + +#define SN_sha512_256WithRSAEncryption "RSA-SHA512/256" +#define LN_sha512_256WithRSAEncryption "sha512-256WithRSAEncryption" +#define NID_sha512_256WithRSAEncryption 1146 +#define OBJ_sha512_256WithRSAEncryption OBJ_pkcs1,16L + +#define SN_pkcs3 "pkcs3" +#define NID_pkcs3 27 +#define OBJ_pkcs3 OBJ_pkcs,3L + +#define LN_dhKeyAgreement "dhKeyAgreement" +#define NID_dhKeyAgreement 28 +#define OBJ_dhKeyAgreement OBJ_pkcs3,1L + +#define SN_pkcs5 "pkcs5" +#define NID_pkcs5 187 +#define OBJ_pkcs5 OBJ_pkcs,5L + +#define SN_pbeWithMD2AndDES_CBC "PBE-MD2-DES" +#define LN_pbeWithMD2AndDES_CBC "pbeWithMD2AndDES-CBC" +#define NID_pbeWithMD2AndDES_CBC 9 +#define OBJ_pbeWithMD2AndDES_CBC OBJ_pkcs5,1L + +#define SN_pbeWithMD5AndDES_CBC "PBE-MD5-DES" +#define LN_pbeWithMD5AndDES_CBC "pbeWithMD5AndDES-CBC" +#define NID_pbeWithMD5AndDES_CBC 10 +#define OBJ_pbeWithMD5AndDES_CBC OBJ_pkcs5,3L + +#define SN_pbeWithMD2AndRC2_CBC "PBE-MD2-RC2-64" +#define LN_pbeWithMD2AndRC2_CBC "pbeWithMD2AndRC2-CBC" +#define NID_pbeWithMD2AndRC2_CBC 168 +#define OBJ_pbeWithMD2AndRC2_CBC OBJ_pkcs5,4L + +#define SN_pbeWithMD5AndRC2_CBC "PBE-MD5-RC2-64" +#define LN_pbeWithMD5AndRC2_CBC "pbeWithMD5AndRC2-CBC" +#define NID_pbeWithMD5AndRC2_CBC 169 +#define OBJ_pbeWithMD5AndRC2_CBC OBJ_pkcs5,6L + +#define SN_pbeWithSHA1AndDES_CBC "PBE-SHA1-DES" +#define LN_pbeWithSHA1AndDES_CBC "pbeWithSHA1AndDES-CBC" +#define NID_pbeWithSHA1AndDES_CBC 170 +#define OBJ_pbeWithSHA1AndDES_CBC OBJ_pkcs5,10L + +#define SN_pbeWithSHA1AndRC2_CBC "PBE-SHA1-RC2-64" +#define LN_pbeWithSHA1AndRC2_CBC "pbeWithSHA1AndRC2-CBC" +#define NID_pbeWithSHA1AndRC2_CBC 68 +#define OBJ_pbeWithSHA1AndRC2_CBC OBJ_pkcs5,11L + +#define LN_id_pbkdf2 "PBKDF2" +#define NID_id_pbkdf2 69 +#define OBJ_id_pbkdf2 OBJ_pkcs5,12L + +#define LN_pbes2 "PBES2" +#define NID_pbes2 161 +#define OBJ_pbes2 OBJ_pkcs5,13L + +#define LN_pbmac1 "PBMAC1" +#define NID_pbmac1 162 +#define OBJ_pbmac1 OBJ_pkcs5,14L + +#define SN_pkcs7 "pkcs7" +#define NID_pkcs7 20 +#define OBJ_pkcs7 OBJ_pkcs,7L + +#define LN_pkcs7_data "pkcs7-data" +#define NID_pkcs7_data 21 +#define OBJ_pkcs7_data OBJ_pkcs7,1L + +#define LN_pkcs7_signed "pkcs7-signedData" +#define NID_pkcs7_signed 22 +#define OBJ_pkcs7_signed OBJ_pkcs7,2L + +#define LN_pkcs7_enveloped "pkcs7-envelopedData" +#define NID_pkcs7_enveloped 23 +#define OBJ_pkcs7_enveloped OBJ_pkcs7,3L + +#define LN_pkcs7_signedAndEnveloped "pkcs7-signedAndEnvelopedData" +#define NID_pkcs7_signedAndEnveloped 24 +#define OBJ_pkcs7_signedAndEnveloped OBJ_pkcs7,4L + +#define LN_pkcs7_digest "pkcs7-digestData" +#define NID_pkcs7_digest 25 +#define OBJ_pkcs7_digest OBJ_pkcs7,5L + +#define LN_pkcs7_encrypted "pkcs7-encryptedData" +#define NID_pkcs7_encrypted 26 +#define OBJ_pkcs7_encrypted OBJ_pkcs7,6L + +#define SN_pkcs9 "pkcs9" +#define NID_pkcs9 47 +#define OBJ_pkcs9 OBJ_pkcs,9L + +#define LN_pkcs9_emailAddress "emailAddress" +#define NID_pkcs9_emailAddress 48 +#define OBJ_pkcs9_emailAddress OBJ_pkcs9,1L + +#define LN_pkcs9_unstructuredName "unstructuredName" +#define NID_pkcs9_unstructuredName 49 +#define OBJ_pkcs9_unstructuredName OBJ_pkcs9,2L + +#define LN_pkcs9_contentType "contentType" +#define NID_pkcs9_contentType 50 +#define OBJ_pkcs9_contentType OBJ_pkcs9,3L + +#define LN_pkcs9_messageDigest "messageDigest" +#define NID_pkcs9_messageDigest 51 +#define OBJ_pkcs9_messageDigest OBJ_pkcs9,4L + +#define LN_pkcs9_signingTime "signingTime" +#define NID_pkcs9_signingTime 52 +#define OBJ_pkcs9_signingTime OBJ_pkcs9,5L + +#define LN_pkcs9_countersignature "countersignature" +#define NID_pkcs9_countersignature 53 +#define OBJ_pkcs9_countersignature OBJ_pkcs9,6L + +#define LN_pkcs9_challengePassword "challengePassword" +#define NID_pkcs9_challengePassword 54 +#define OBJ_pkcs9_challengePassword OBJ_pkcs9,7L + +#define LN_pkcs9_unstructuredAddress "unstructuredAddress" +#define NID_pkcs9_unstructuredAddress 55 +#define OBJ_pkcs9_unstructuredAddress OBJ_pkcs9,8L + +#define LN_pkcs9_extCertAttributes "extendedCertificateAttributes" +#define NID_pkcs9_extCertAttributes 56 +#define OBJ_pkcs9_extCertAttributes OBJ_pkcs9,9L + +#define SN_ext_req "extReq" +#define LN_ext_req "Extension Request" +#define NID_ext_req 172 +#define OBJ_ext_req OBJ_pkcs9,14L + +#define SN_SMIMECapabilities "SMIME-CAPS" +#define LN_SMIMECapabilities "S/MIME Capabilities" +#define NID_SMIMECapabilities 167 +#define OBJ_SMIMECapabilities OBJ_pkcs9,15L + +#define SN_SMIME "SMIME" +#define LN_SMIME "S/MIME" +#define NID_SMIME 188 +#define OBJ_SMIME OBJ_pkcs9,16L + +#define SN_id_smime_mod "id-smime-mod" +#define NID_id_smime_mod 189 +#define OBJ_id_smime_mod OBJ_SMIME,0L + +#define SN_id_smime_ct "id-smime-ct" +#define NID_id_smime_ct 190 +#define OBJ_id_smime_ct OBJ_SMIME,1L + +#define SN_id_smime_aa "id-smime-aa" +#define NID_id_smime_aa 191 +#define OBJ_id_smime_aa OBJ_SMIME,2L + +#define SN_id_smime_alg "id-smime-alg" +#define NID_id_smime_alg 192 +#define OBJ_id_smime_alg OBJ_SMIME,3L + +#define SN_id_smime_cd "id-smime-cd" +#define NID_id_smime_cd 193 +#define OBJ_id_smime_cd OBJ_SMIME,4L + +#define SN_id_smime_spq "id-smime-spq" +#define NID_id_smime_spq 194 +#define OBJ_id_smime_spq OBJ_SMIME,5L + +#define SN_id_smime_cti "id-smime-cti" +#define NID_id_smime_cti 195 +#define OBJ_id_smime_cti OBJ_SMIME,6L + +#define SN_id_smime_mod_cms "id-smime-mod-cms" +#define NID_id_smime_mod_cms 196 +#define OBJ_id_smime_mod_cms OBJ_id_smime_mod,1L + +#define SN_id_smime_mod_ess "id-smime-mod-ess" +#define NID_id_smime_mod_ess 197 +#define OBJ_id_smime_mod_ess OBJ_id_smime_mod,2L + +#define SN_id_smime_mod_oid "id-smime-mod-oid" +#define NID_id_smime_mod_oid 198 +#define OBJ_id_smime_mod_oid OBJ_id_smime_mod,3L + +#define SN_id_smime_mod_msg_v3 "id-smime-mod-msg-v3" +#define NID_id_smime_mod_msg_v3 199 +#define OBJ_id_smime_mod_msg_v3 OBJ_id_smime_mod,4L + +#define SN_id_smime_mod_ets_eSignature_88 "id-smime-mod-ets-eSignature-88" +#define NID_id_smime_mod_ets_eSignature_88 200 +#define OBJ_id_smime_mod_ets_eSignature_88 OBJ_id_smime_mod,5L + +#define SN_id_smime_mod_ets_eSignature_97 "id-smime-mod-ets-eSignature-97" +#define NID_id_smime_mod_ets_eSignature_97 201 +#define OBJ_id_smime_mod_ets_eSignature_97 OBJ_id_smime_mod,6L + +#define SN_id_smime_mod_ets_eSigPolicy_88 "id-smime-mod-ets-eSigPolicy-88" +#define NID_id_smime_mod_ets_eSigPolicy_88 202 +#define OBJ_id_smime_mod_ets_eSigPolicy_88 OBJ_id_smime_mod,7L + +#define SN_id_smime_mod_ets_eSigPolicy_97 "id-smime-mod-ets-eSigPolicy-97" +#define NID_id_smime_mod_ets_eSigPolicy_97 203 +#define OBJ_id_smime_mod_ets_eSigPolicy_97 OBJ_id_smime_mod,8L + +#define SN_id_smime_ct_receipt "id-smime-ct-receipt" +#define NID_id_smime_ct_receipt 204 +#define OBJ_id_smime_ct_receipt OBJ_id_smime_ct,1L + +#define SN_id_smime_ct_authData "id-smime-ct-authData" +#define NID_id_smime_ct_authData 205 +#define OBJ_id_smime_ct_authData OBJ_id_smime_ct,2L + +#define SN_id_smime_ct_publishCert "id-smime-ct-publishCert" +#define NID_id_smime_ct_publishCert 206 +#define OBJ_id_smime_ct_publishCert OBJ_id_smime_ct,3L + +#define SN_id_smime_ct_TSTInfo "id-smime-ct-TSTInfo" +#define NID_id_smime_ct_TSTInfo 207 +#define OBJ_id_smime_ct_TSTInfo OBJ_id_smime_ct,4L + +#define SN_id_smime_ct_TDTInfo "id-smime-ct-TDTInfo" +#define NID_id_smime_ct_TDTInfo 208 +#define OBJ_id_smime_ct_TDTInfo OBJ_id_smime_ct,5L + +#define SN_id_smime_ct_contentInfo "id-smime-ct-contentInfo" +#define NID_id_smime_ct_contentInfo 209 +#define OBJ_id_smime_ct_contentInfo OBJ_id_smime_ct,6L + +#define SN_id_smime_ct_DVCSRequestData "id-smime-ct-DVCSRequestData" +#define NID_id_smime_ct_DVCSRequestData 210 +#define OBJ_id_smime_ct_DVCSRequestData OBJ_id_smime_ct,7L + +#define SN_id_smime_ct_DVCSResponseData "id-smime-ct-DVCSResponseData" +#define NID_id_smime_ct_DVCSResponseData 211 +#define OBJ_id_smime_ct_DVCSResponseData OBJ_id_smime_ct,8L + +#define SN_id_smime_ct_compressedData "id-smime-ct-compressedData" +#define NID_id_smime_ct_compressedData 786 +#define OBJ_id_smime_ct_compressedData OBJ_id_smime_ct,9L + +#define SN_id_smime_ct_contentCollection "id-smime-ct-contentCollection" +#define NID_id_smime_ct_contentCollection 1058 +#define OBJ_id_smime_ct_contentCollection OBJ_id_smime_ct,19L + +#define SN_id_smime_ct_authEnvelopedData "id-smime-ct-authEnvelopedData" +#define NID_id_smime_ct_authEnvelopedData 1059 +#define OBJ_id_smime_ct_authEnvelopedData OBJ_id_smime_ct,23L + +#define SN_id_ct_asciiTextWithCRLF "id-ct-asciiTextWithCRLF" +#define NID_id_ct_asciiTextWithCRLF 787 +#define OBJ_id_ct_asciiTextWithCRLF OBJ_id_smime_ct,27L + +#define SN_id_ct_xml "id-ct-xml" +#define NID_id_ct_xml 1060 +#define OBJ_id_ct_xml OBJ_id_smime_ct,28L + +#define SN_id_smime_aa_receiptRequest "id-smime-aa-receiptRequest" +#define NID_id_smime_aa_receiptRequest 212 +#define OBJ_id_smime_aa_receiptRequest OBJ_id_smime_aa,1L + +#define SN_id_smime_aa_securityLabel "id-smime-aa-securityLabel" +#define NID_id_smime_aa_securityLabel 213 +#define OBJ_id_smime_aa_securityLabel OBJ_id_smime_aa,2L + +#define SN_id_smime_aa_mlExpandHistory "id-smime-aa-mlExpandHistory" +#define NID_id_smime_aa_mlExpandHistory 214 +#define OBJ_id_smime_aa_mlExpandHistory OBJ_id_smime_aa,3L + +#define SN_id_smime_aa_contentHint "id-smime-aa-contentHint" +#define NID_id_smime_aa_contentHint 215 +#define OBJ_id_smime_aa_contentHint OBJ_id_smime_aa,4L + +#define SN_id_smime_aa_msgSigDigest "id-smime-aa-msgSigDigest" +#define NID_id_smime_aa_msgSigDigest 216 +#define OBJ_id_smime_aa_msgSigDigest OBJ_id_smime_aa,5L + +#define SN_id_smime_aa_encapContentType "id-smime-aa-encapContentType" +#define NID_id_smime_aa_encapContentType 217 +#define OBJ_id_smime_aa_encapContentType OBJ_id_smime_aa,6L + +#define SN_id_smime_aa_contentIdentifier "id-smime-aa-contentIdentifier" +#define NID_id_smime_aa_contentIdentifier 218 +#define OBJ_id_smime_aa_contentIdentifier OBJ_id_smime_aa,7L + +#define SN_id_smime_aa_macValue "id-smime-aa-macValue" +#define NID_id_smime_aa_macValue 219 +#define OBJ_id_smime_aa_macValue OBJ_id_smime_aa,8L + +#define SN_id_smime_aa_equivalentLabels "id-smime-aa-equivalentLabels" +#define NID_id_smime_aa_equivalentLabels 220 +#define OBJ_id_smime_aa_equivalentLabels OBJ_id_smime_aa,9L + +#define SN_id_smime_aa_contentReference "id-smime-aa-contentReference" +#define NID_id_smime_aa_contentReference 221 +#define OBJ_id_smime_aa_contentReference OBJ_id_smime_aa,10L + +#define SN_id_smime_aa_encrypKeyPref "id-smime-aa-encrypKeyPref" +#define NID_id_smime_aa_encrypKeyPref 222 +#define OBJ_id_smime_aa_encrypKeyPref OBJ_id_smime_aa,11L + +#define SN_id_smime_aa_signingCertificate "id-smime-aa-signingCertificate" +#define NID_id_smime_aa_signingCertificate 223 +#define OBJ_id_smime_aa_signingCertificate OBJ_id_smime_aa,12L + +#define SN_id_smime_aa_smimeEncryptCerts "id-smime-aa-smimeEncryptCerts" +#define NID_id_smime_aa_smimeEncryptCerts 224 +#define OBJ_id_smime_aa_smimeEncryptCerts OBJ_id_smime_aa,13L + +#define SN_id_smime_aa_timeStampToken "id-smime-aa-timeStampToken" +#define NID_id_smime_aa_timeStampToken 225 +#define OBJ_id_smime_aa_timeStampToken OBJ_id_smime_aa,14L + +#define SN_id_smime_aa_ets_sigPolicyId "id-smime-aa-ets-sigPolicyId" +#define NID_id_smime_aa_ets_sigPolicyId 226 +#define OBJ_id_smime_aa_ets_sigPolicyId OBJ_id_smime_aa,15L + +#define SN_id_smime_aa_ets_commitmentType "id-smime-aa-ets-commitmentType" +#define NID_id_smime_aa_ets_commitmentType 227 +#define OBJ_id_smime_aa_ets_commitmentType OBJ_id_smime_aa,16L + +#define SN_id_smime_aa_ets_signerLocation "id-smime-aa-ets-signerLocation" +#define NID_id_smime_aa_ets_signerLocation 228 +#define OBJ_id_smime_aa_ets_signerLocation OBJ_id_smime_aa,17L + +#define SN_id_smime_aa_ets_signerAttr "id-smime-aa-ets-signerAttr" +#define NID_id_smime_aa_ets_signerAttr 229 +#define OBJ_id_smime_aa_ets_signerAttr OBJ_id_smime_aa,18L + +#define SN_id_smime_aa_ets_otherSigCert "id-smime-aa-ets-otherSigCert" +#define NID_id_smime_aa_ets_otherSigCert 230 +#define OBJ_id_smime_aa_ets_otherSigCert OBJ_id_smime_aa,19L + +#define SN_id_smime_aa_ets_contentTimestamp "id-smime-aa-ets-contentTimestamp" +#define NID_id_smime_aa_ets_contentTimestamp 231 +#define OBJ_id_smime_aa_ets_contentTimestamp OBJ_id_smime_aa,20L + +#define SN_id_smime_aa_ets_CertificateRefs "id-smime-aa-ets-CertificateRefs" +#define NID_id_smime_aa_ets_CertificateRefs 232 +#define OBJ_id_smime_aa_ets_CertificateRefs OBJ_id_smime_aa,21L + +#define SN_id_smime_aa_ets_RevocationRefs "id-smime-aa-ets-RevocationRefs" +#define NID_id_smime_aa_ets_RevocationRefs 233 +#define OBJ_id_smime_aa_ets_RevocationRefs OBJ_id_smime_aa,22L + +#define SN_id_smime_aa_ets_certValues "id-smime-aa-ets-certValues" +#define NID_id_smime_aa_ets_certValues 234 +#define OBJ_id_smime_aa_ets_certValues OBJ_id_smime_aa,23L + +#define SN_id_smime_aa_ets_revocationValues "id-smime-aa-ets-revocationValues" +#define NID_id_smime_aa_ets_revocationValues 235 +#define OBJ_id_smime_aa_ets_revocationValues OBJ_id_smime_aa,24L + +#define SN_id_smime_aa_ets_escTimeStamp "id-smime-aa-ets-escTimeStamp" +#define NID_id_smime_aa_ets_escTimeStamp 236 +#define OBJ_id_smime_aa_ets_escTimeStamp OBJ_id_smime_aa,25L + +#define SN_id_smime_aa_ets_certCRLTimestamp "id-smime-aa-ets-certCRLTimestamp" +#define NID_id_smime_aa_ets_certCRLTimestamp 237 +#define OBJ_id_smime_aa_ets_certCRLTimestamp OBJ_id_smime_aa,26L + +#define SN_id_smime_aa_ets_archiveTimeStamp "id-smime-aa-ets-archiveTimeStamp" +#define NID_id_smime_aa_ets_archiveTimeStamp 238 +#define OBJ_id_smime_aa_ets_archiveTimeStamp OBJ_id_smime_aa,27L + +#define SN_id_smime_aa_signatureType "id-smime-aa-signatureType" +#define NID_id_smime_aa_signatureType 239 +#define OBJ_id_smime_aa_signatureType OBJ_id_smime_aa,28L + +#define SN_id_smime_aa_dvcs_dvc "id-smime-aa-dvcs-dvc" +#define NID_id_smime_aa_dvcs_dvc 240 +#define OBJ_id_smime_aa_dvcs_dvc OBJ_id_smime_aa,29L + +#define SN_id_smime_aa_signingCertificateV2 "id-smime-aa-signingCertificateV2" +#define NID_id_smime_aa_signingCertificateV2 1086 +#define OBJ_id_smime_aa_signingCertificateV2 OBJ_id_smime_aa,47L + +#define SN_id_smime_alg_ESDHwith3DES "id-smime-alg-ESDHwith3DES" +#define NID_id_smime_alg_ESDHwith3DES 241 +#define OBJ_id_smime_alg_ESDHwith3DES OBJ_id_smime_alg,1L + +#define SN_id_smime_alg_ESDHwithRC2 "id-smime-alg-ESDHwithRC2" +#define NID_id_smime_alg_ESDHwithRC2 242 +#define OBJ_id_smime_alg_ESDHwithRC2 OBJ_id_smime_alg,2L + +#define SN_id_smime_alg_3DESwrap "id-smime-alg-3DESwrap" +#define NID_id_smime_alg_3DESwrap 243 +#define OBJ_id_smime_alg_3DESwrap OBJ_id_smime_alg,3L + +#define SN_id_smime_alg_RC2wrap "id-smime-alg-RC2wrap" +#define NID_id_smime_alg_RC2wrap 244 +#define OBJ_id_smime_alg_RC2wrap OBJ_id_smime_alg,4L + +#define SN_id_smime_alg_ESDH "id-smime-alg-ESDH" +#define NID_id_smime_alg_ESDH 245 +#define OBJ_id_smime_alg_ESDH OBJ_id_smime_alg,5L + +#define SN_id_smime_alg_CMS3DESwrap "id-smime-alg-CMS3DESwrap" +#define NID_id_smime_alg_CMS3DESwrap 246 +#define OBJ_id_smime_alg_CMS3DESwrap OBJ_id_smime_alg,6L + +#define SN_id_smime_alg_CMSRC2wrap "id-smime-alg-CMSRC2wrap" +#define NID_id_smime_alg_CMSRC2wrap 247 +#define OBJ_id_smime_alg_CMSRC2wrap OBJ_id_smime_alg,7L + +#define SN_id_alg_PWRI_KEK "id-alg-PWRI-KEK" +#define NID_id_alg_PWRI_KEK 893 +#define OBJ_id_alg_PWRI_KEK OBJ_id_smime_alg,9L + +#define SN_id_smime_cd_ldap "id-smime-cd-ldap" +#define NID_id_smime_cd_ldap 248 +#define OBJ_id_smime_cd_ldap OBJ_id_smime_cd,1L + +#define SN_id_smime_spq_ets_sqt_uri "id-smime-spq-ets-sqt-uri" +#define NID_id_smime_spq_ets_sqt_uri 249 +#define OBJ_id_smime_spq_ets_sqt_uri OBJ_id_smime_spq,1L + +#define SN_id_smime_spq_ets_sqt_unotice "id-smime-spq-ets-sqt-unotice" +#define NID_id_smime_spq_ets_sqt_unotice 250 +#define OBJ_id_smime_spq_ets_sqt_unotice OBJ_id_smime_spq,2L + +#define SN_id_smime_cti_ets_proofOfOrigin "id-smime-cti-ets-proofOfOrigin" +#define NID_id_smime_cti_ets_proofOfOrigin 251 +#define OBJ_id_smime_cti_ets_proofOfOrigin OBJ_id_smime_cti,1L + +#define SN_id_smime_cti_ets_proofOfReceipt "id-smime-cti-ets-proofOfReceipt" +#define NID_id_smime_cti_ets_proofOfReceipt 252 +#define OBJ_id_smime_cti_ets_proofOfReceipt OBJ_id_smime_cti,2L + +#define SN_id_smime_cti_ets_proofOfDelivery "id-smime-cti-ets-proofOfDelivery" +#define NID_id_smime_cti_ets_proofOfDelivery 253 +#define OBJ_id_smime_cti_ets_proofOfDelivery OBJ_id_smime_cti,3L + +#define SN_id_smime_cti_ets_proofOfSender "id-smime-cti-ets-proofOfSender" +#define NID_id_smime_cti_ets_proofOfSender 254 +#define OBJ_id_smime_cti_ets_proofOfSender OBJ_id_smime_cti,4L + +#define SN_id_smime_cti_ets_proofOfApproval "id-smime-cti-ets-proofOfApproval" +#define NID_id_smime_cti_ets_proofOfApproval 255 +#define OBJ_id_smime_cti_ets_proofOfApproval OBJ_id_smime_cti,5L + +#define SN_id_smime_cti_ets_proofOfCreation "id-smime-cti-ets-proofOfCreation" +#define NID_id_smime_cti_ets_proofOfCreation 256 +#define OBJ_id_smime_cti_ets_proofOfCreation OBJ_id_smime_cti,6L + +#define LN_friendlyName "friendlyName" +#define NID_friendlyName 156 +#define OBJ_friendlyName OBJ_pkcs9,20L + +#define LN_localKeyID "localKeyID" +#define NID_localKeyID 157 +#define OBJ_localKeyID OBJ_pkcs9,21L + +#define SN_ms_csp_name "CSPName" +#define LN_ms_csp_name "Microsoft CSP Name" +#define NID_ms_csp_name 417 +#define OBJ_ms_csp_name 1L,3L,6L,1L,4L,1L,311L,17L,1L + +#define SN_LocalKeySet "LocalKeySet" +#define LN_LocalKeySet "Microsoft Local Key set" +#define NID_LocalKeySet 856 +#define OBJ_LocalKeySet 1L,3L,6L,1L,4L,1L,311L,17L,2L + +#define OBJ_certTypes OBJ_pkcs9,22L + +#define LN_x509Certificate "x509Certificate" +#define NID_x509Certificate 158 +#define OBJ_x509Certificate OBJ_certTypes,1L + +#define LN_sdsiCertificate "sdsiCertificate" +#define NID_sdsiCertificate 159 +#define OBJ_sdsiCertificate OBJ_certTypes,2L + +#define OBJ_crlTypes OBJ_pkcs9,23L + +#define LN_x509Crl "x509Crl" +#define NID_x509Crl 160 +#define OBJ_x509Crl OBJ_crlTypes,1L + +#define OBJ_pkcs12 OBJ_pkcs,12L + +#define OBJ_pkcs12_pbeids OBJ_pkcs12,1L + +#define SN_pbe_WithSHA1And128BitRC4 "PBE-SHA1-RC4-128" +#define LN_pbe_WithSHA1And128BitRC4 "pbeWithSHA1And128BitRC4" +#define NID_pbe_WithSHA1And128BitRC4 144 +#define OBJ_pbe_WithSHA1And128BitRC4 OBJ_pkcs12_pbeids,1L + +#define SN_pbe_WithSHA1And40BitRC4 "PBE-SHA1-RC4-40" +#define LN_pbe_WithSHA1And40BitRC4 "pbeWithSHA1And40BitRC4" +#define NID_pbe_WithSHA1And40BitRC4 145 +#define OBJ_pbe_WithSHA1And40BitRC4 OBJ_pkcs12_pbeids,2L + +#define SN_pbe_WithSHA1And3_Key_TripleDES_CBC "PBE-SHA1-3DES" +#define LN_pbe_WithSHA1And3_Key_TripleDES_CBC "pbeWithSHA1And3-KeyTripleDES-CBC" +#define NID_pbe_WithSHA1And3_Key_TripleDES_CBC 146 +#define OBJ_pbe_WithSHA1And3_Key_TripleDES_CBC OBJ_pkcs12_pbeids,3L + +#define SN_pbe_WithSHA1And2_Key_TripleDES_CBC "PBE-SHA1-2DES" +#define LN_pbe_WithSHA1And2_Key_TripleDES_CBC "pbeWithSHA1And2-KeyTripleDES-CBC" +#define NID_pbe_WithSHA1And2_Key_TripleDES_CBC 147 +#define OBJ_pbe_WithSHA1And2_Key_TripleDES_CBC OBJ_pkcs12_pbeids,4L + +#define SN_pbe_WithSHA1And128BitRC2_CBC "PBE-SHA1-RC2-128" +#define LN_pbe_WithSHA1And128BitRC2_CBC "pbeWithSHA1And128BitRC2-CBC" +#define NID_pbe_WithSHA1And128BitRC2_CBC 148 +#define OBJ_pbe_WithSHA1And128BitRC2_CBC OBJ_pkcs12_pbeids,5L + +#define SN_pbe_WithSHA1And40BitRC2_CBC "PBE-SHA1-RC2-40" +#define LN_pbe_WithSHA1And40BitRC2_CBC "pbeWithSHA1And40BitRC2-CBC" +#define NID_pbe_WithSHA1And40BitRC2_CBC 149 +#define OBJ_pbe_WithSHA1And40BitRC2_CBC OBJ_pkcs12_pbeids,6L + +#define OBJ_pkcs12_Version1 OBJ_pkcs12,10L + +#define OBJ_pkcs12_BagIds OBJ_pkcs12_Version1,1L + +#define LN_keyBag "keyBag" +#define NID_keyBag 150 +#define OBJ_keyBag OBJ_pkcs12_BagIds,1L + +#define LN_pkcs8ShroudedKeyBag "pkcs8ShroudedKeyBag" +#define NID_pkcs8ShroudedKeyBag 151 +#define OBJ_pkcs8ShroudedKeyBag OBJ_pkcs12_BagIds,2L + +#define LN_certBag "certBag" +#define NID_certBag 152 +#define OBJ_certBag OBJ_pkcs12_BagIds,3L + +#define LN_crlBag "crlBag" +#define NID_crlBag 153 +#define OBJ_crlBag OBJ_pkcs12_BagIds,4L + +#define LN_secretBag "secretBag" +#define NID_secretBag 154 +#define OBJ_secretBag OBJ_pkcs12_BagIds,5L + +#define LN_safeContentsBag "safeContentsBag" +#define NID_safeContentsBag 155 +#define OBJ_safeContentsBag OBJ_pkcs12_BagIds,6L + +#define SN_md2 "MD2" +#define LN_md2 "md2" +#define NID_md2 3 +#define OBJ_md2 OBJ_rsadsi,2L,2L + +#define SN_md4 "MD4" +#define LN_md4 "md4" +#define NID_md4 257 +#define OBJ_md4 OBJ_rsadsi,2L,4L + +#define SN_md5 "MD5" +#define LN_md5 "md5" +#define NID_md5 4 +#define OBJ_md5 OBJ_rsadsi,2L,5L + +#define SN_md5_sha1 "MD5-SHA1" +#define LN_md5_sha1 "md5-sha1" +#define NID_md5_sha1 114 + +#define LN_hmacWithMD5 "hmacWithMD5" +#define NID_hmacWithMD5 797 +#define OBJ_hmacWithMD5 OBJ_rsadsi,2L,6L + +#define LN_hmacWithSHA1 "hmacWithSHA1" +#define NID_hmacWithSHA1 163 +#define OBJ_hmacWithSHA1 OBJ_rsadsi,2L,7L + +#define SN_sm2 "SM2" +#define LN_sm2 "sm2" +#define NID_sm2 1172 +#define OBJ_sm2 OBJ_sm_scheme,301L + +#define SN_sm3 "SM3" +#define LN_sm3 "sm3" +#define NID_sm3 1143 +#define OBJ_sm3 OBJ_sm_scheme,401L + +#define SN_sm3WithRSAEncryption "RSA-SM3" +#define LN_sm3WithRSAEncryption "sm3WithRSAEncryption" +#define NID_sm3WithRSAEncryption 1144 +#define OBJ_sm3WithRSAEncryption OBJ_sm_scheme,504L + +#define LN_hmacWithSHA224 "hmacWithSHA224" +#define NID_hmacWithSHA224 798 +#define OBJ_hmacWithSHA224 OBJ_rsadsi,2L,8L + +#define LN_hmacWithSHA256 "hmacWithSHA256" +#define NID_hmacWithSHA256 799 +#define OBJ_hmacWithSHA256 OBJ_rsadsi,2L,9L + +#define LN_hmacWithSHA384 "hmacWithSHA384" +#define NID_hmacWithSHA384 800 +#define OBJ_hmacWithSHA384 OBJ_rsadsi,2L,10L + +#define LN_hmacWithSHA512 "hmacWithSHA512" +#define NID_hmacWithSHA512 801 +#define OBJ_hmacWithSHA512 OBJ_rsadsi,2L,11L + +#define LN_hmacWithSHA512_224 "hmacWithSHA512-224" +#define NID_hmacWithSHA512_224 1193 +#define OBJ_hmacWithSHA512_224 OBJ_rsadsi,2L,12L + +#define LN_hmacWithSHA512_256 "hmacWithSHA512-256" +#define NID_hmacWithSHA512_256 1194 +#define OBJ_hmacWithSHA512_256 OBJ_rsadsi,2L,13L + +#define SN_rc2_cbc "RC2-CBC" +#define LN_rc2_cbc "rc2-cbc" +#define NID_rc2_cbc 37 +#define OBJ_rc2_cbc OBJ_rsadsi,3L,2L + +#define SN_rc2_ecb "RC2-ECB" +#define LN_rc2_ecb "rc2-ecb" +#define NID_rc2_ecb 38 + +#define SN_rc2_cfb64 "RC2-CFB" +#define LN_rc2_cfb64 "rc2-cfb" +#define NID_rc2_cfb64 39 + +#define SN_rc2_ofb64 "RC2-OFB" +#define LN_rc2_ofb64 "rc2-ofb" +#define NID_rc2_ofb64 40 + +#define SN_rc2_40_cbc "RC2-40-CBC" +#define LN_rc2_40_cbc "rc2-40-cbc" +#define NID_rc2_40_cbc 98 + +#define SN_rc2_64_cbc "RC2-64-CBC" +#define LN_rc2_64_cbc "rc2-64-cbc" +#define NID_rc2_64_cbc 166 + +#define SN_rc4 "RC4" +#define LN_rc4 "rc4" +#define NID_rc4 5 +#define OBJ_rc4 OBJ_rsadsi,3L,4L + +#define SN_rc4_40 "RC4-40" +#define LN_rc4_40 "rc4-40" +#define NID_rc4_40 97 + +#define SN_des_ede3_cbc "DES-EDE3-CBC" +#define LN_des_ede3_cbc "des-ede3-cbc" +#define NID_des_ede3_cbc 44 +#define OBJ_des_ede3_cbc OBJ_rsadsi,3L,7L + +#define SN_rc5_cbc "RC5-CBC" +#define LN_rc5_cbc "rc5-cbc" +#define NID_rc5_cbc 120 +#define OBJ_rc5_cbc OBJ_rsadsi,3L,8L + +#define SN_rc5_ecb "RC5-ECB" +#define LN_rc5_ecb "rc5-ecb" +#define NID_rc5_ecb 121 + +#define SN_rc5_cfb64 "RC5-CFB" +#define LN_rc5_cfb64 "rc5-cfb" +#define NID_rc5_cfb64 122 + +#define SN_rc5_ofb64 "RC5-OFB" +#define LN_rc5_ofb64 "rc5-ofb" +#define NID_rc5_ofb64 123 + +#define SN_ms_ext_req "msExtReq" +#define LN_ms_ext_req "Microsoft Extension Request" +#define NID_ms_ext_req 171 +#define OBJ_ms_ext_req 1L,3L,6L,1L,4L,1L,311L,2L,1L,14L + +#define SN_ms_code_ind "msCodeInd" +#define LN_ms_code_ind "Microsoft Individual Code Signing" +#define NID_ms_code_ind 134 +#define OBJ_ms_code_ind 1L,3L,6L,1L,4L,1L,311L,2L,1L,21L + +#define SN_ms_code_com "msCodeCom" +#define LN_ms_code_com "Microsoft Commercial Code Signing" +#define NID_ms_code_com 135 +#define OBJ_ms_code_com 1L,3L,6L,1L,4L,1L,311L,2L,1L,22L + +#define SN_ms_ctl_sign "msCTLSign" +#define LN_ms_ctl_sign "Microsoft Trust List Signing" +#define NID_ms_ctl_sign 136 +#define OBJ_ms_ctl_sign 1L,3L,6L,1L,4L,1L,311L,10L,3L,1L + +#define SN_ms_sgc "msSGC" +#define LN_ms_sgc "Microsoft Server Gated Crypto" +#define NID_ms_sgc 137 +#define OBJ_ms_sgc 1L,3L,6L,1L,4L,1L,311L,10L,3L,3L + +#define SN_ms_efs "msEFS" +#define LN_ms_efs "Microsoft Encrypted File System" +#define NID_ms_efs 138 +#define OBJ_ms_efs 1L,3L,6L,1L,4L,1L,311L,10L,3L,4L + +#define SN_ms_smartcard_login "msSmartcardLogin" +#define LN_ms_smartcard_login "Microsoft Smartcard Login" +#define NID_ms_smartcard_login 648 +#define OBJ_ms_smartcard_login 1L,3L,6L,1L,4L,1L,311L,20L,2L,2L + +#define SN_ms_upn "msUPN" +#define LN_ms_upn "Microsoft User Principal Name" +#define NID_ms_upn 649 +#define OBJ_ms_upn 1L,3L,6L,1L,4L,1L,311L,20L,2L,3L + +#define SN_idea_cbc "IDEA-CBC" +#define LN_idea_cbc "idea-cbc" +#define NID_idea_cbc 34 +#define OBJ_idea_cbc 1L,3L,6L,1L,4L,1L,188L,7L,1L,1L,2L + +#define SN_idea_ecb "IDEA-ECB" +#define LN_idea_ecb "idea-ecb" +#define NID_idea_ecb 36 + +#define SN_idea_cfb64 "IDEA-CFB" +#define LN_idea_cfb64 "idea-cfb" +#define NID_idea_cfb64 35 + +#define SN_idea_ofb64 "IDEA-OFB" +#define LN_idea_ofb64 "idea-ofb" +#define NID_idea_ofb64 46 + +#define SN_bf_cbc "BF-CBC" +#define LN_bf_cbc "bf-cbc" +#define NID_bf_cbc 91 +#define OBJ_bf_cbc 1L,3L,6L,1L,4L,1L,3029L,1L,2L + +#define SN_bf_ecb "BF-ECB" +#define LN_bf_ecb "bf-ecb" +#define NID_bf_ecb 92 + +#define SN_bf_cfb64 "BF-CFB" +#define LN_bf_cfb64 "bf-cfb" +#define NID_bf_cfb64 93 + +#define SN_bf_ofb64 "BF-OFB" +#define LN_bf_ofb64 "bf-ofb" +#define NID_bf_ofb64 94 + +#define SN_id_pkix "PKIX" +#define NID_id_pkix 127 +#define OBJ_id_pkix 1L,3L,6L,1L,5L,5L,7L + +#define SN_id_pkix_mod "id-pkix-mod" +#define NID_id_pkix_mod 258 +#define OBJ_id_pkix_mod OBJ_id_pkix,0L + +#define SN_id_pe "id-pe" +#define NID_id_pe 175 +#define OBJ_id_pe OBJ_id_pkix,1L + +#define SN_id_qt "id-qt" +#define NID_id_qt 259 +#define OBJ_id_qt OBJ_id_pkix,2L + +#define SN_id_kp "id-kp" +#define NID_id_kp 128 +#define OBJ_id_kp OBJ_id_pkix,3L + +#define SN_id_it "id-it" +#define NID_id_it 260 +#define OBJ_id_it OBJ_id_pkix,4L + +#define SN_id_pkip "id-pkip" +#define NID_id_pkip 261 +#define OBJ_id_pkip OBJ_id_pkix,5L + +#define SN_id_alg "id-alg" +#define NID_id_alg 262 +#define OBJ_id_alg OBJ_id_pkix,6L + +#define SN_id_cmc "id-cmc" +#define NID_id_cmc 263 +#define OBJ_id_cmc OBJ_id_pkix,7L + +#define SN_id_on "id-on" +#define NID_id_on 264 +#define OBJ_id_on OBJ_id_pkix,8L + +#define SN_id_pda "id-pda" +#define NID_id_pda 265 +#define OBJ_id_pda OBJ_id_pkix,9L + +#define SN_id_aca "id-aca" +#define NID_id_aca 266 +#define OBJ_id_aca OBJ_id_pkix,10L + +#define SN_id_qcs "id-qcs" +#define NID_id_qcs 267 +#define OBJ_id_qcs OBJ_id_pkix,11L + +#define SN_id_cct "id-cct" +#define NID_id_cct 268 +#define OBJ_id_cct OBJ_id_pkix,12L + +#define SN_id_ppl "id-ppl" +#define NID_id_ppl 662 +#define OBJ_id_ppl OBJ_id_pkix,21L + +#define SN_id_ad "id-ad" +#define NID_id_ad 176 +#define OBJ_id_ad OBJ_id_pkix,48L + +#define SN_id_pkix1_explicit_88 "id-pkix1-explicit-88" +#define NID_id_pkix1_explicit_88 269 +#define OBJ_id_pkix1_explicit_88 OBJ_id_pkix_mod,1L + +#define SN_id_pkix1_implicit_88 "id-pkix1-implicit-88" +#define NID_id_pkix1_implicit_88 270 +#define OBJ_id_pkix1_implicit_88 OBJ_id_pkix_mod,2L + +#define SN_id_pkix1_explicit_93 "id-pkix1-explicit-93" +#define NID_id_pkix1_explicit_93 271 +#define OBJ_id_pkix1_explicit_93 OBJ_id_pkix_mod,3L + +#define SN_id_pkix1_implicit_93 "id-pkix1-implicit-93" +#define NID_id_pkix1_implicit_93 272 +#define OBJ_id_pkix1_implicit_93 OBJ_id_pkix_mod,4L + +#define SN_id_mod_crmf "id-mod-crmf" +#define NID_id_mod_crmf 273 +#define OBJ_id_mod_crmf OBJ_id_pkix_mod,5L + +#define SN_id_mod_cmc "id-mod-cmc" +#define NID_id_mod_cmc 274 +#define OBJ_id_mod_cmc OBJ_id_pkix_mod,6L + +#define SN_id_mod_kea_profile_88 "id-mod-kea-profile-88" +#define NID_id_mod_kea_profile_88 275 +#define OBJ_id_mod_kea_profile_88 OBJ_id_pkix_mod,7L + +#define SN_id_mod_kea_profile_93 "id-mod-kea-profile-93" +#define NID_id_mod_kea_profile_93 276 +#define OBJ_id_mod_kea_profile_93 OBJ_id_pkix_mod,8L + +#define SN_id_mod_cmp "id-mod-cmp" +#define NID_id_mod_cmp 277 +#define OBJ_id_mod_cmp OBJ_id_pkix_mod,9L + +#define SN_id_mod_qualified_cert_88 "id-mod-qualified-cert-88" +#define NID_id_mod_qualified_cert_88 278 +#define OBJ_id_mod_qualified_cert_88 OBJ_id_pkix_mod,10L + +#define SN_id_mod_qualified_cert_93 "id-mod-qualified-cert-93" +#define NID_id_mod_qualified_cert_93 279 +#define OBJ_id_mod_qualified_cert_93 OBJ_id_pkix_mod,11L + +#define SN_id_mod_attribute_cert "id-mod-attribute-cert" +#define NID_id_mod_attribute_cert 280 +#define OBJ_id_mod_attribute_cert OBJ_id_pkix_mod,12L + +#define SN_id_mod_timestamp_protocol "id-mod-timestamp-protocol" +#define NID_id_mod_timestamp_protocol 281 +#define OBJ_id_mod_timestamp_protocol OBJ_id_pkix_mod,13L + +#define SN_id_mod_ocsp "id-mod-ocsp" +#define NID_id_mod_ocsp 282 +#define OBJ_id_mod_ocsp OBJ_id_pkix_mod,14L + +#define SN_id_mod_dvcs "id-mod-dvcs" +#define NID_id_mod_dvcs 283 +#define OBJ_id_mod_dvcs OBJ_id_pkix_mod,15L + +#define SN_id_mod_cmp2000 "id-mod-cmp2000" +#define NID_id_mod_cmp2000 284 +#define OBJ_id_mod_cmp2000 OBJ_id_pkix_mod,16L + +#define SN_info_access "authorityInfoAccess" +#define LN_info_access "Authority Information Access" +#define NID_info_access 177 +#define OBJ_info_access OBJ_id_pe,1L + +#define SN_biometricInfo "biometricInfo" +#define LN_biometricInfo "Biometric Info" +#define NID_biometricInfo 285 +#define OBJ_biometricInfo OBJ_id_pe,2L + +#define SN_qcStatements "qcStatements" +#define NID_qcStatements 286 +#define OBJ_qcStatements OBJ_id_pe,3L + +#define SN_ac_auditEntity "ac-auditEntity" +#define NID_ac_auditEntity 287 +#define OBJ_ac_auditEntity OBJ_id_pe,4L + +#define SN_ac_targeting "ac-targeting" +#define NID_ac_targeting 288 +#define OBJ_ac_targeting OBJ_id_pe,5L + +#define SN_aaControls "aaControls" +#define NID_aaControls 289 +#define OBJ_aaControls OBJ_id_pe,6L + +#define SN_sbgp_ipAddrBlock "sbgp-ipAddrBlock" +#define NID_sbgp_ipAddrBlock 290 +#define OBJ_sbgp_ipAddrBlock OBJ_id_pe,7L + +#define SN_sbgp_autonomousSysNum "sbgp-autonomousSysNum" +#define NID_sbgp_autonomousSysNum 291 +#define OBJ_sbgp_autonomousSysNum OBJ_id_pe,8L + +#define SN_sbgp_routerIdentifier "sbgp-routerIdentifier" +#define NID_sbgp_routerIdentifier 292 +#define OBJ_sbgp_routerIdentifier OBJ_id_pe,9L + +#define SN_ac_proxying "ac-proxying" +#define NID_ac_proxying 397 +#define OBJ_ac_proxying OBJ_id_pe,10L + +#define SN_sinfo_access "subjectInfoAccess" +#define LN_sinfo_access "Subject Information Access" +#define NID_sinfo_access 398 +#define OBJ_sinfo_access OBJ_id_pe,11L + +#define SN_proxyCertInfo "proxyCertInfo" +#define LN_proxyCertInfo "Proxy Certificate Information" +#define NID_proxyCertInfo 663 +#define OBJ_proxyCertInfo OBJ_id_pe,14L + +#define SN_tlsfeature "tlsfeature" +#define LN_tlsfeature "TLS Feature" +#define NID_tlsfeature 1020 +#define OBJ_tlsfeature OBJ_id_pe,24L + +#define SN_id_qt_cps "id-qt-cps" +#define LN_id_qt_cps "Policy Qualifier CPS" +#define NID_id_qt_cps 164 +#define OBJ_id_qt_cps OBJ_id_qt,1L + +#define SN_id_qt_unotice "id-qt-unotice" +#define LN_id_qt_unotice "Policy Qualifier User Notice" +#define NID_id_qt_unotice 165 +#define OBJ_id_qt_unotice OBJ_id_qt,2L + +#define SN_textNotice "textNotice" +#define NID_textNotice 293 +#define OBJ_textNotice OBJ_id_qt,3L + +#define SN_server_auth "serverAuth" +#define LN_server_auth "TLS Web Server Authentication" +#define NID_server_auth 129 +#define OBJ_server_auth OBJ_id_kp,1L + +#define SN_client_auth "clientAuth" +#define LN_client_auth "TLS Web Client Authentication" +#define NID_client_auth 130 +#define OBJ_client_auth OBJ_id_kp,2L + +#define SN_code_sign "codeSigning" +#define LN_code_sign "Code Signing" +#define NID_code_sign 131 +#define OBJ_code_sign OBJ_id_kp,3L + +#define SN_email_protect "emailProtection" +#define LN_email_protect "E-mail Protection" +#define NID_email_protect 132 +#define OBJ_email_protect OBJ_id_kp,4L + +#define SN_ipsecEndSystem "ipsecEndSystem" +#define LN_ipsecEndSystem "IPSec End System" +#define NID_ipsecEndSystem 294 +#define OBJ_ipsecEndSystem OBJ_id_kp,5L + +#define SN_ipsecTunnel "ipsecTunnel" +#define LN_ipsecTunnel "IPSec Tunnel" +#define NID_ipsecTunnel 295 +#define OBJ_ipsecTunnel OBJ_id_kp,6L + +#define SN_ipsecUser "ipsecUser" +#define LN_ipsecUser "IPSec User" +#define NID_ipsecUser 296 +#define OBJ_ipsecUser OBJ_id_kp,7L + +#define SN_time_stamp "timeStamping" +#define LN_time_stamp "Time Stamping" +#define NID_time_stamp 133 +#define OBJ_time_stamp OBJ_id_kp,8L + +#define SN_OCSP_sign "OCSPSigning" +#define LN_OCSP_sign "OCSP Signing" +#define NID_OCSP_sign 180 +#define OBJ_OCSP_sign OBJ_id_kp,9L + +#define SN_dvcs "DVCS" +#define LN_dvcs "dvcs" +#define NID_dvcs 297 +#define OBJ_dvcs OBJ_id_kp,10L + +#define SN_ipsec_IKE "ipsecIKE" +#define LN_ipsec_IKE "ipsec Internet Key Exchange" +#define NID_ipsec_IKE 1022 +#define OBJ_ipsec_IKE OBJ_id_kp,17L + +#define SN_capwapAC "capwapAC" +#define LN_capwapAC "Ctrl/provision WAP Access" +#define NID_capwapAC 1023 +#define OBJ_capwapAC OBJ_id_kp,18L + +#define SN_capwapWTP "capwapWTP" +#define LN_capwapWTP "Ctrl/Provision WAP Termination" +#define NID_capwapWTP 1024 +#define OBJ_capwapWTP OBJ_id_kp,19L + +#define SN_sshClient "secureShellClient" +#define LN_sshClient "SSH Client" +#define NID_sshClient 1025 +#define OBJ_sshClient OBJ_id_kp,21L + +#define SN_sshServer "secureShellServer" +#define LN_sshServer "SSH Server" +#define NID_sshServer 1026 +#define OBJ_sshServer OBJ_id_kp,22L + +#define SN_sendRouter "sendRouter" +#define LN_sendRouter "Send Router" +#define NID_sendRouter 1027 +#define OBJ_sendRouter OBJ_id_kp,23L + +#define SN_sendProxiedRouter "sendProxiedRouter" +#define LN_sendProxiedRouter "Send Proxied Router" +#define NID_sendProxiedRouter 1028 +#define OBJ_sendProxiedRouter OBJ_id_kp,24L + +#define SN_sendOwner "sendOwner" +#define LN_sendOwner "Send Owner" +#define NID_sendOwner 1029 +#define OBJ_sendOwner OBJ_id_kp,25L + +#define SN_sendProxiedOwner "sendProxiedOwner" +#define LN_sendProxiedOwner "Send Proxied Owner" +#define NID_sendProxiedOwner 1030 +#define OBJ_sendProxiedOwner OBJ_id_kp,26L + +#define SN_cmcCA "cmcCA" +#define LN_cmcCA "CMC Certificate Authority" +#define NID_cmcCA 1131 +#define OBJ_cmcCA OBJ_id_kp,27L + +#define SN_cmcRA "cmcRA" +#define LN_cmcRA "CMC Registration Authority" +#define NID_cmcRA 1132 +#define OBJ_cmcRA OBJ_id_kp,28L + +#define SN_id_it_caProtEncCert "id-it-caProtEncCert" +#define NID_id_it_caProtEncCert 298 +#define OBJ_id_it_caProtEncCert OBJ_id_it,1L + +#define SN_id_it_signKeyPairTypes "id-it-signKeyPairTypes" +#define NID_id_it_signKeyPairTypes 299 +#define OBJ_id_it_signKeyPairTypes OBJ_id_it,2L + +#define SN_id_it_encKeyPairTypes "id-it-encKeyPairTypes" +#define NID_id_it_encKeyPairTypes 300 +#define OBJ_id_it_encKeyPairTypes OBJ_id_it,3L + +#define SN_id_it_preferredSymmAlg "id-it-preferredSymmAlg" +#define NID_id_it_preferredSymmAlg 301 +#define OBJ_id_it_preferredSymmAlg OBJ_id_it,4L + +#define SN_id_it_caKeyUpdateInfo "id-it-caKeyUpdateInfo" +#define NID_id_it_caKeyUpdateInfo 302 +#define OBJ_id_it_caKeyUpdateInfo OBJ_id_it,5L + +#define SN_id_it_currentCRL "id-it-currentCRL" +#define NID_id_it_currentCRL 303 +#define OBJ_id_it_currentCRL OBJ_id_it,6L + +#define SN_id_it_unsupportedOIDs "id-it-unsupportedOIDs" +#define NID_id_it_unsupportedOIDs 304 +#define OBJ_id_it_unsupportedOIDs OBJ_id_it,7L + +#define SN_id_it_subscriptionRequest "id-it-subscriptionRequest" +#define NID_id_it_subscriptionRequest 305 +#define OBJ_id_it_subscriptionRequest OBJ_id_it,8L + +#define SN_id_it_subscriptionResponse "id-it-subscriptionResponse" +#define NID_id_it_subscriptionResponse 306 +#define OBJ_id_it_subscriptionResponse OBJ_id_it,9L + +#define SN_id_it_keyPairParamReq "id-it-keyPairParamReq" +#define NID_id_it_keyPairParamReq 307 +#define OBJ_id_it_keyPairParamReq OBJ_id_it,10L + +#define SN_id_it_keyPairParamRep "id-it-keyPairParamRep" +#define NID_id_it_keyPairParamRep 308 +#define OBJ_id_it_keyPairParamRep OBJ_id_it,11L + +#define SN_id_it_revPassphrase "id-it-revPassphrase" +#define NID_id_it_revPassphrase 309 +#define OBJ_id_it_revPassphrase OBJ_id_it,12L + +#define SN_id_it_implicitConfirm "id-it-implicitConfirm" +#define NID_id_it_implicitConfirm 310 +#define OBJ_id_it_implicitConfirm OBJ_id_it,13L + +#define SN_id_it_confirmWaitTime "id-it-confirmWaitTime" +#define NID_id_it_confirmWaitTime 311 +#define OBJ_id_it_confirmWaitTime OBJ_id_it,14L + +#define SN_id_it_origPKIMessage "id-it-origPKIMessage" +#define NID_id_it_origPKIMessage 312 +#define OBJ_id_it_origPKIMessage OBJ_id_it,15L + +#define SN_id_it_suppLangTags "id-it-suppLangTags" +#define NID_id_it_suppLangTags 784 +#define OBJ_id_it_suppLangTags OBJ_id_it,16L + +#define SN_id_regCtrl "id-regCtrl" +#define NID_id_regCtrl 313 +#define OBJ_id_regCtrl OBJ_id_pkip,1L + +#define SN_id_regInfo "id-regInfo" +#define NID_id_regInfo 314 +#define OBJ_id_regInfo OBJ_id_pkip,2L + +#define SN_id_regCtrl_regToken "id-regCtrl-regToken" +#define NID_id_regCtrl_regToken 315 +#define OBJ_id_regCtrl_regToken OBJ_id_regCtrl,1L + +#define SN_id_regCtrl_authenticator "id-regCtrl-authenticator" +#define NID_id_regCtrl_authenticator 316 +#define OBJ_id_regCtrl_authenticator OBJ_id_regCtrl,2L + +#define SN_id_regCtrl_pkiPublicationInfo "id-regCtrl-pkiPublicationInfo" +#define NID_id_regCtrl_pkiPublicationInfo 317 +#define OBJ_id_regCtrl_pkiPublicationInfo OBJ_id_regCtrl,3L + +#define SN_id_regCtrl_pkiArchiveOptions "id-regCtrl-pkiArchiveOptions" +#define NID_id_regCtrl_pkiArchiveOptions 318 +#define OBJ_id_regCtrl_pkiArchiveOptions OBJ_id_regCtrl,4L + +#define SN_id_regCtrl_oldCertID "id-regCtrl-oldCertID" +#define NID_id_regCtrl_oldCertID 319 +#define OBJ_id_regCtrl_oldCertID OBJ_id_regCtrl,5L + +#define SN_id_regCtrl_protocolEncrKey "id-regCtrl-protocolEncrKey" +#define NID_id_regCtrl_protocolEncrKey 320 +#define OBJ_id_regCtrl_protocolEncrKey OBJ_id_regCtrl,6L + +#define SN_id_regInfo_utf8Pairs "id-regInfo-utf8Pairs" +#define NID_id_regInfo_utf8Pairs 321 +#define OBJ_id_regInfo_utf8Pairs OBJ_id_regInfo,1L + +#define SN_id_regInfo_certReq "id-regInfo-certReq" +#define NID_id_regInfo_certReq 322 +#define OBJ_id_regInfo_certReq OBJ_id_regInfo,2L + +#define SN_id_alg_des40 "id-alg-des40" +#define NID_id_alg_des40 323 +#define OBJ_id_alg_des40 OBJ_id_alg,1L + +#define SN_id_alg_noSignature "id-alg-noSignature" +#define NID_id_alg_noSignature 324 +#define OBJ_id_alg_noSignature OBJ_id_alg,2L + +#define SN_id_alg_dh_sig_hmac_sha1 "id-alg-dh-sig-hmac-sha1" +#define NID_id_alg_dh_sig_hmac_sha1 325 +#define OBJ_id_alg_dh_sig_hmac_sha1 OBJ_id_alg,3L + +#define SN_id_alg_dh_pop "id-alg-dh-pop" +#define NID_id_alg_dh_pop 326 +#define OBJ_id_alg_dh_pop OBJ_id_alg,4L + +#define SN_id_cmc_statusInfo "id-cmc-statusInfo" +#define NID_id_cmc_statusInfo 327 +#define OBJ_id_cmc_statusInfo OBJ_id_cmc,1L + +#define SN_id_cmc_identification "id-cmc-identification" +#define NID_id_cmc_identification 328 +#define OBJ_id_cmc_identification OBJ_id_cmc,2L + +#define SN_id_cmc_identityProof "id-cmc-identityProof" +#define NID_id_cmc_identityProof 329 +#define OBJ_id_cmc_identityProof OBJ_id_cmc,3L + +#define SN_id_cmc_dataReturn "id-cmc-dataReturn" +#define NID_id_cmc_dataReturn 330 +#define OBJ_id_cmc_dataReturn OBJ_id_cmc,4L + +#define SN_id_cmc_transactionId "id-cmc-transactionId" +#define NID_id_cmc_transactionId 331 +#define OBJ_id_cmc_transactionId OBJ_id_cmc,5L + +#define SN_id_cmc_senderNonce "id-cmc-senderNonce" +#define NID_id_cmc_senderNonce 332 +#define OBJ_id_cmc_senderNonce OBJ_id_cmc,6L + +#define SN_id_cmc_recipientNonce "id-cmc-recipientNonce" +#define NID_id_cmc_recipientNonce 333 +#define OBJ_id_cmc_recipientNonce OBJ_id_cmc,7L + +#define SN_id_cmc_addExtensions "id-cmc-addExtensions" +#define NID_id_cmc_addExtensions 334 +#define OBJ_id_cmc_addExtensions OBJ_id_cmc,8L + +#define SN_id_cmc_encryptedPOP "id-cmc-encryptedPOP" +#define NID_id_cmc_encryptedPOP 335 +#define OBJ_id_cmc_encryptedPOP OBJ_id_cmc,9L + +#define SN_id_cmc_decryptedPOP "id-cmc-decryptedPOP" +#define NID_id_cmc_decryptedPOP 336 +#define OBJ_id_cmc_decryptedPOP OBJ_id_cmc,10L + +#define SN_id_cmc_lraPOPWitness "id-cmc-lraPOPWitness" +#define NID_id_cmc_lraPOPWitness 337 +#define OBJ_id_cmc_lraPOPWitness OBJ_id_cmc,11L + +#define SN_id_cmc_getCert "id-cmc-getCert" +#define NID_id_cmc_getCert 338 +#define OBJ_id_cmc_getCert OBJ_id_cmc,15L + +#define SN_id_cmc_getCRL "id-cmc-getCRL" +#define NID_id_cmc_getCRL 339 +#define OBJ_id_cmc_getCRL OBJ_id_cmc,16L + +#define SN_id_cmc_revokeRequest "id-cmc-revokeRequest" +#define NID_id_cmc_revokeRequest 340 +#define OBJ_id_cmc_revokeRequest OBJ_id_cmc,17L + +#define SN_id_cmc_regInfo "id-cmc-regInfo" +#define NID_id_cmc_regInfo 341 +#define OBJ_id_cmc_regInfo OBJ_id_cmc,18L + +#define SN_id_cmc_responseInfo "id-cmc-responseInfo" +#define NID_id_cmc_responseInfo 342 +#define OBJ_id_cmc_responseInfo OBJ_id_cmc,19L + +#define SN_id_cmc_queryPending "id-cmc-queryPending" +#define NID_id_cmc_queryPending 343 +#define OBJ_id_cmc_queryPending OBJ_id_cmc,21L + +#define SN_id_cmc_popLinkRandom "id-cmc-popLinkRandom" +#define NID_id_cmc_popLinkRandom 344 +#define OBJ_id_cmc_popLinkRandom OBJ_id_cmc,22L + +#define SN_id_cmc_popLinkWitness "id-cmc-popLinkWitness" +#define NID_id_cmc_popLinkWitness 345 +#define OBJ_id_cmc_popLinkWitness OBJ_id_cmc,23L + +#define SN_id_cmc_confirmCertAcceptance "id-cmc-confirmCertAcceptance" +#define NID_id_cmc_confirmCertAcceptance 346 +#define OBJ_id_cmc_confirmCertAcceptance OBJ_id_cmc,24L + +#define SN_id_on_personalData "id-on-personalData" +#define NID_id_on_personalData 347 +#define OBJ_id_on_personalData OBJ_id_on,1L + +#define SN_id_on_permanentIdentifier "id-on-permanentIdentifier" +#define LN_id_on_permanentIdentifier "Permanent Identifier" +#define NID_id_on_permanentIdentifier 858 +#define OBJ_id_on_permanentIdentifier OBJ_id_on,3L + +#define SN_id_pda_dateOfBirth "id-pda-dateOfBirth" +#define NID_id_pda_dateOfBirth 348 +#define OBJ_id_pda_dateOfBirth OBJ_id_pda,1L + +#define SN_id_pda_placeOfBirth "id-pda-placeOfBirth" +#define NID_id_pda_placeOfBirth 349 +#define OBJ_id_pda_placeOfBirth OBJ_id_pda,2L + +#define SN_id_pda_gender "id-pda-gender" +#define NID_id_pda_gender 351 +#define OBJ_id_pda_gender OBJ_id_pda,3L + +#define SN_id_pda_countryOfCitizenship "id-pda-countryOfCitizenship" +#define NID_id_pda_countryOfCitizenship 352 +#define OBJ_id_pda_countryOfCitizenship OBJ_id_pda,4L + +#define SN_id_pda_countryOfResidence "id-pda-countryOfResidence" +#define NID_id_pda_countryOfResidence 353 +#define OBJ_id_pda_countryOfResidence OBJ_id_pda,5L + +#define SN_id_aca_authenticationInfo "id-aca-authenticationInfo" +#define NID_id_aca_authenticationInfo 354 +#define OBJ_id_aca_authenticationInfo OBJ_id_aca,1L + +#define SN_id_aca_accessIdentity "id-aca-accessIdentity" +#define NID_id_aca_accessIdentity 355 +#define OBJ_id_aca_accessIdentity OBJ_id_aca,2L + +#define SN_id_aca_chargingIdentity "id-aca-chargingIdentity" +#define NID_id_aca_chargingIdentity 356 +#define OBJ_id_aca_chargingIdentity OBJ_id_aca,3L + +#define SN_id_aca_group "id-aca-group" +#define NID_id_aca_group 357 +#define OBJ_id_aca_group OBJ_id_aca,4L + +#define SN_id_aca_role "id-aca-role" +#define NID_id_aca_role 358 +#define OBJ_id_aca_role OBJ_id_aca,5L + +#define SN_id_aca_encAttrs "id-aca-encAttrs" +#define NID_id_aca_encAttrs 399 +#define OBJ_id_aca_encAttrs OBJ_id_aca,6L + +#define SN_id_qcs_pkixQCSyntax_v1 "id-qcs-pkixQCSyntax-v1" +#define NID_id_qcs_pkixQCSyntax_v1 359 +#define OBJ_id_qcs_pkixQCSyntax_v1 OBJ_id_qcs,1L + +#define SN_id_cct_crs "id-cct-crs" +#define NID_id_cct_crs 360 +#define OBJ_id_cct_crs OBJ_id_cct,1L + +#define SN_id_cct_PKIData "id-cct-PKIData" +#define NID_id_cct_PKIData 361 +#define OBJ_id_cct_PKIData OBJ_id_cct,2L + +#define SN_id_cct_PKIResponse "id-cct-PKIResponse" +#define NID_id_cct_PKIResponse 362 +#define OBJ_id_cct_PKIResponse OBJ_id_cct,3L + +#define SN_id_ppl_anyLanguage "id-ppl-anyLanguage" +#define LN_id_ppl_anyLanguage "Any language" +#define NID_id_ppl_anyLanguage 664 +#define OBJ_id_ppl_anyLanguage OBJ_id_ppl,0L + +#define SN_id_ppl_inheritAll "id-ppl-inheritAll" +#define LN_id_ppl_inheritAll "Inherit all" +#define NID_id_ppl_inheritAll 665 +#define OBJ_id_ppl_inheritAll OBJ_id_ppl,1L + +#define SN_Independent "id-ppl-independent" +#define LN_Independent "Independent" +#define NID_Independent 667 +#define OBJ_Independent OBJ_id_ppl,2L + +#define SN_ad_OCSP "OCSP" +#define LN_ad_OCSP "OCSP" +#define NID_ad_OCSP 178 +#define OBJ_ad_OCSP OBJ_id_ad,1L + +#define SN_ad_ca_issuers "caIssuers" +#define LN_ad_ca_issuers "CA Issuers" +#define NID_ad_ca_issuers 179 +#define OBJ_ad_ca_issuers OBJ_id_ad,2L + +#define SN_ad_timeStamping "ad_timestamping" +#define LN_ad_timeStamping "AD Time Stamping" +#define NID_ad_timeStamping 363 +#define OBJ_ad_timeStamping OBJ_id_ad,3L + +#define SN_ad_dvcs "AD_DVCS" +#define LN_ad_dvcs "ad dvcs" +#define NID_ad_dvcs 364 +#define OBJ_ad_dvcs OBJ_id_ad,4L + +#define SN_caRepository "caRepository" +#define LN_caRepository "CA Repository" +#define NID_caRepository 785 +#define OBJ_caRepository OBJ_id_ad,5L + +#define OBJ_id_pkix_OCSP OBJ_ad_OCSP + +#define SN_id_pkix_OCSP_basic "basicOCSPResponse" +#define LN_id_pkix_OCSP_basic "Basic OCSP Response" +#define NID_id_pkix_OCSP_basic 365 +#define OBJ_id_pkix_OCSP_basic OBJ_id_pkix_OCSP,1L + +#define SN_id_pkix_OCSP_Nonce "Nonce" +#define LN_id_pkix_OCSP_Nonce "OCSP Nonce" +#define NID_id_pkix_OCSP_Nonce 366 +#define OBJ_id_pkix_OCSP_Nonce OBJ_id_pkix_OCSP,2L + +#define SN_id_pkix_OCSP_CrlID "CrlID" +#define LN_id_pkix_OCSP_CrlID "OCSP CRL ID" +#define NID_id_pkix_OCSP_CrlID 367 +#define OBJ_id_pkix_OCSP_CrlID OBJ_id_pkix_OCSP,3L + +#define SN_id_pkix_OCSP_acceptableResponses "acceptableResponses" +#define LN_id_pkix_OCSP_acceptableResponses "Acceptable OCSP Responses" +#define NID_id_pkix_OCSP_acceptableResponses 368 +#define OBJ_id_pkix_OCSP_acceptableResponses OBJ_id_pkix_OCSP,4L + +#define SN_id_pkix_OCSP_noCheck "noCheck" +#define LN_id_pkix_OCSP_noCheck "OCSP No Check" +#define NID_id_pkix_OCSP_noCheck 369 +#define OBJ_id_pkix_OCSP_noCheck OBJ_id_pkix_OCSP,5L + +#define SN_id_pkix_OCSP_archiveCutoff "archiveCutoff" +#define LN_id_pkix_OCSP_archiveCutoff "OCSP Archive Cutoff" +#define NID_id_pkix_OCSP_archiveCutoff 370 +#define OBJ_id_pkix_OCSP_archiveCutoff OBJ_id_pkix_OCSP,6L + +#define SN_id_pkix_OCSP_serviceLocator "serviceLocator" +#define LN_id_pkix_OCSP_serviceLocator "OCSP Service Locator" +#define NID_id_pkix_OCSP_serviceLocator 371 +#define OBJ_id_pkix_OCSP_serviceLocator OBJ_id_pkix_OCSP,7L + +#define SN_id_pkix_OCSP_extendedStatus "extendedStatus" +#define LN_id_pkix_OCSP_extendedStatus "Extended OCSP Status" +#define NID_id_pkix_OCSP_extendedStatus 372 +#define OBJ_id_pkix_OCSP_extendedStatus OBJ_id_pkix_OCSP,8L + +#define SN_id_pkix_OCSP_valid "valid" +#define NID_id_pkix_OCSP_valid 373 +#define OBJ_id_pkix_OCSP_valid OBJ_id_pkix_OCSP,9L + +#define SN_id_pkix_OCSP_path "path" +#define NID_id_pkix_OCSP_path 374 +#define OBJ_id_pkix_OCSP_path OBJ_id_pkix_OCSP,10L + +#define SN_id_pkix_OCSP_trustRoot "trustRoot" +#define LN_id_pkix_OCSP_trustRoot "Trust Root" +#define NID_id_pkix_OCSP_trustRoot 375 +#define OBJ_id_pkix_OCSP_trustRoot OBJ_id_pkix_OCSP,11L + +#define SN_algorithm "algorithm" +#define LN_algorithm "algorithm" +#define NID_algorithm 376 +#define OBJ_algorithm 1L,3L,14L,3L,2L + +#define SN_md5WithRSA "RSA-NP-MD5" +#define LN_md5WithRSA "md5WithRSA" +#define NID_md5WithRSA 104 +#define OBJ_md5WithRSA OBJ_algorithm,3L + +#define SN_des_ecb "DES-ECB" +#define LN_des_ecb "des-ecb" +#define NID_des_ecb 29 +#define OBJ_des_ecb OBJ_algorithm,6L + +#define SN_des_cbc "DES-CBC" +#define LN_des_cbc "des-cbc" +#define NID_des_cbc 31 +#define OBJ_des_cbc OBJ_algorithm,7L + +#define SN_des_ofb64 "DES-OFB" +#define LN_des_ofb64 "des-ofb" +#define NID_des_ofb64 45 +#define OBJ_des_ofb64 OBJ_algorithm,8L + +#define SN_des_cfb64 "DES-CFB" +#define LN_des_cfb64 "des-cfb" +#define NID_des_cfb64 30 +#define OBJ_des_cfb64 OBJ_algorithm,9L + +#define SN_rsaSignature "rsaSignature" +#define NID_rsaSignature 377 +#define OBJ_rsaSignature OBJ_algorithm,11L + +#define SN_dsa_2 "DSA-old" +#define LN_dsa_2 "dsaEncryption-old" +#define NID_dsa_2 67 +#define OBJ_dsa_2 OBJ_algorithm,12L + +#define SN_dsaWithSHA "DSA-SHA" +#define LN_dsaWithSHA "dsaWithSHA" +#define NID_dsaWithSHA 66 +#define OBJ_dsaWithSHA OBJ_algorithm,13L + +#define SN_shaWithRSAEncryption "RSA-SHA" +#define LN_shaWithRSAEncryption "shaWithRSAEncryption" +#define NID_shaWithRSAEncryption 42 +#define OBJ_shaWithRSAEncryption OBJ_algorithm,15L + +#define SN_des_ede_ecb "DES-EDE" +#define LN_des_ede_ecb "des-ede" +#define NID_des_ede_ecb 32 +#define OBJ_des_ede_ecb OBJ_algorithm,17L + +#define SN_des_ede3_ecb "DES-EDE3" +#define LN_des_ede3_ecb "des-ede3" +#define NID_des_ede3_ecb 33 + +#define SN_des_ede_cbc "DES-EDE-CBC" +#define LN_des_ede_cbc "des-ede-cbc" +#define NID_des_ede_cbc 43 + +#define SN_des_ede_cfb64 "DES-EDE-CFB" +#define LN_des_ede_cfb64 "des-ede-cfb" +#define NID_des_ede_cfb64 60 + +#define SN_des_ede3_cfb64 "DES-EDE3-CFB" +#define LN_des_ede3_cfb64 "des-ede3-cfb" +#define NID_des_ede3_cfb64 61 + +#define SN_des_ede_ofb64 "DES-EDE-OFB" +#define LN_des_ede_ofb64 "des-ede-ofb" +#define NID_des_ede_ofb64 62 + +#define SN_des_ede3_ofb64 "DES-EDE3-OFB" +#define LN_des_ede3_ofb64 "des-ede3-ofb" +#define NID_des_ede3_ofb64 63 + +#define SN_desx_cbc "DESX-CBC" +#define LN_desx_cbc "desx-cbc" +#define NID_desx_cbc 80 + +#define SN_sha "SHA" +#define LN_sha "sha" +#define NID_sha 41 +#define OBJ_sha OBJ_algorithm,18L + +#define SN_sha1 "SHA1" +#define LN_sha1 "sha1" +#define NID_sha1 64 +#define OBJ_sha1 OBJ_algorithm,26L + +#define SN_dsaWithSHA1_2 "DSA-SHA1-old" +#define LN_dsaWithSHA1_2 "dsaWithSHA1-old" +#define NID_dsaWithSHA1_2 70 +#define OBJ_dsaWithSHA1_2 OBJ_algorithm,27L + +#define SN_sha1WithRSA "RSA-SHA1-2" +#define LN_sha1WithRSA "sha1WithRSA" +#define NID_sha1WithRSA 115 +#define OBJ_sha1WithRSA OBJ_algorithm,29L + +#define SN_ripemd160 "RIPEMD160" +#define LN_ripemd160 "ripemd160" +#define NID_ripemd160 117 +#define OBJ_ripemd160 1L,3L,36L,3L,2L,1L + +#define SN_ripemd160WithRSA "RSA-RIPEMD160" +#define LN_ripemd160WithRSA "ripemd160WithRSA" +#define NID_ripemd160WithRSA 119 +#define OBJ_ripemd160WithRSA 1L,3L,36L,3L,3L,1L,2L + +#define SN_blake2b512 "BLAKE2b512" +#define LN_blake2b512 "blake2b512" +#define NID_blake2b512 1056 +#define OBJ_blake2b512 1L,3L,6L,1L,4L,1L,1722L,12L,2L,1L,16L + +#define SN_blake2s256 "BLAKE2s256" +#define LN_blake2s256 "blake2s256" +#define NID_blake2s256 1057 +#define OBJ_blake2s256 1L,3L,6L,1L,4L,1L,1722L,12L,2L,2L,8L + +#define SN_sxnet "SXNetID" +#define LN_sxnet "Strong Extranet ID" +#define NID_sxnet 143 +#define OBJ_sxnet 1L,3L,101L,1L,4L,1L + +#define SN_X500 "X500" +#define LN_X500 "directory services (X.500)" +#define NID_X500 11 +#define OBJ_X500 2L,5L + +#define SN_X509 "X509" +#define NID_X509 12 +#define OBJ_X509 OBJ_X500,4L + +#define SN_commonName "CN" +#define LN_commonName "commonName" +#define NID_commonName 13 +#define OBJ_commonName OBJ_X509,3L + +#define SN_surname "SN" +#define LN_surname "surname" +#define NID_surname 100 +#define OBJ_surname OBJ_X509,4L + +#define LN_serialNumber "serialNumber" +#define NID_serialNumber 105 +#define OBJ_serialNumber OBJ_X509,5L + +#define SN_countryName "C" +#define LN_countryName "countryName" +#define NID_countryName 14 +#define OBJ_countryName OBJ_X509,6L + +#define SN_localityName "L" +#define LN_localityName "localityName" +#define NID_localityName 15 +#define OBJ_localityName OBJ_X509,7L + +#define SN_stateOrProvinceName "ST" +#define LN_stateOrProvinceName "stateOrProvinceName" +#define NID_stateOrProvinceName 16 +#define OBJ_stateOrProvinceName OBJ_X509,8L + +#define SN_streetAddress "street" +#define LN_streetAddress "streetAddress" +#define NID_streetAddress 660 +#define OBJ_streetAddress OBJ_X509,9L + +#define SN_organizationName "O" +#define LN_organizationName "organizationName" +#define NID_organizationName 17 +#define OBJ_organizationName OBJ_X509,10L + +#define SN_organizationalUnitName "OU" +#define LN_organizationalUnitName "organizationalUnitName" +#define NID_organizationalUnitName 18 +#define OBJ_organizationalUnitName OBJ_X509,11L + +#define SN_title "title" +#define LN_title "title" +#define NID_title 106 +#define OBJ_title OBJ_X509,12L + +#define LN_description "description" +#define NID_description 107 +#define OBJ_description OBJ_X509,13L + +#define LN_searchGuide "searchGuide" +#define NID_searchGuide 859 +#define OBJ_searchGuide OBJ_X509,14L + +#define LN_businessCategory "businessCategory" +#define NID_businessCategory 860 +#define OBJ_businessCategory OBJ_X509,15L + +#define LN_postalAddress "postalAddress" +#define NID_postalAddress 861 +#define OBJ_postalAddress OBJ_X509,16L + +#define LN_postalCode "postalCode" +#define NID_postalCode 661 +#define OBJ_postalCode OBJ_X509,17L + +#define LN_postOfficeBox "postOfficeBox" +#define NID_postOfficeBox 862 +#define OBJ_postOfficeBox OBJ_X509,18L + +#define LN_physicalDeliveryOfficeName "physicalDeliveryOfficeName" +#define NID_physicalDeliveryOfficeName 863 +#define OBJ_physicalDeliveryOfficeName OBJ_X509,19L + +#define LN_telephoneNumber "telephoneNumber" +#define NID_telephoneNumber 864 +#define OBJ_telephoneNumber OBJ_X509,20L + +#define LN_telexNumber "telexNumber" +#define NID_telexNumber 865 +#define OBJ_telexNumber OBJ_X509,21L + +#define LN_teletexTerminalIdentifier "teletexTerminalIdentifier" +#define NID_teletexTerminalIdentifier 866 +#define OBJ_teletexTerminalIdentifier OBJ_X509,22L + +#define LN_facsimileTelephoneNumber "facsimileTelephoneNumber" +#define NID_facsimileTelephoneNumber 867 +#define OBJ_facsimileTelephoneNumber OBJ_X509,23L + +#define LN_x121Address "x121Address" +#define NID_x121Address 868 +#define OBJ_x121Address OBJ_X509,24L + +#define LN_internationaliSDNNumber "internationaliSDNNumber" +#define NID_internationaliSDNNumber 869 +#define OBJ_internationaliSDNNumber OBJ_X509,25L + +#define LN_registeredAddress "registeredAddress" +#define NID_registeredAddress 870 +#define OBJ_registeredAddress OBJ_X509,26L + +#define LN_destinationIndicator "destinationIndicator" +#define NID_destinationIndicator 871 +#define OBJ_destinationIndicator OBJ_X509,27L + +#define LN_preferredDeliveryMethod "preferredDeliveryMethod" +#define NID_preferredDeliveryMethod 872 +#define OBJ_preferredDeliveryMethod OBJ_X509,28L + +#define LN_presentationAddress "presentationAddress" +#define NID_presentationAddress 873 +#define OBJ_presentationAddress OBJ_X509,29L + +#define LN_supportedApplicationContext "supportedApplicationContext" +#define NID_supportedApplicationContext 874 +#define OBJ_supportedApplicationContext OBJ_X509,30L + +#define SN_member "member" +#define NID_member 875 +#define OBJ_member OBJ_X509,31L + +#define SN_owner "owner" +#define NID_owner 876 +#define OBJ_owner OBJ_X509,32L + +#define LN_roleOccupant "roleOccupant" +#define NID_roleOccupant 877 +#define OBJ_roleOccupant OBJ_X509,33L + +#define SN_seeAlso "seeAlso" +#define NID_seeAlso 878 +#define OBJ_seeAlso OBJ_X509,34L + +#define LN_userPassword "userPassword" +#define NID_userPassword 879 +#define OBJ_userPassword OBJ_X509,35L + +#define LN_userCertificate "userCertificate" +#define NID_userCertificate 880 +#define OBJ_userCertificate OBJ_X509,36L + +#define LN_cACertificate "cACertificate" +#define NID_cACertificate 881 +#define OBJ_cACertificate OBJ_X509,37L + +#define LN_authorityRevocationList "authorityRevocationList" +#define NID_authorityRevocationList 882 +#define OBJ_authorityRevocationList OBJ_X509,38L + +#define LN_certificateRevocationList "certificateRevocationList" +#define NID_certificateRevocationList 883 +#define OBJ_certificateRevocationList OBJ_X509,39L + +#define LN_crossCertificatePair "crossCertificatePair" +#define NID_crossCertificatePair 884 +#define OBJ_crossCertificatePair OBJ_X509,40L + +#define SN_name "name" +#define LN_name "name" +#define NID_name 173 +#define OBJ_name OBJ_X509,41L + +#define SN_givenName "GN" +#define LN_givenName "givenName" +#define NID_givenName 99 +#define OBJ_givenName OBJ_X509,42L + +#define SN_initials "initials" +#define LN_initials "initials" +#define NID_initials 101 +#define OBJ_initials OBJ_X509,43L + +#define LN_generationQualifier "generationQualifier" +#define NID_generationQualifier 509 +#define OBJ_generationQualifier OBJ_X509,44L + +#define LN_x500UniqueIdentifier "x500UniqueIdentifier" +#define NID_x500UniqueIdentifier 503 +#define OBJ_x500UniqueIdentifier OBJ_X509,45L + +#define SN_dnQualifier "dnQualifier" +#define LN_dnQualifier "dnQualifier" +#define NID_dnQualifier 174 +#define OBJ_dnQualifier OBJ_X509,46L + +#define LN_enhancedSearchGuide "enhancedSearchGuide" +#define NID_enhancedSearchGuide 885 +#define OBJ_enhancedSearchGuide OBJ_X509,47L + +#define LN_protocolInformation "protocolInformation" +#define NID_protocolInformation 886 +#define OBJ_protocolInformation OBJ_X509,48L + +#define LN_distinguishedName "distinguishedName" +#define NID_distinguishedName 887 +#define OBJ_distinguishedName OBJ_X509,49L + +#define LN_uniqueMember "uniqueMember" +#define NID_uniqueMember 888 +#define OBJ_uniqueMember OBJ_X509,50L + +#define LN_houseIdentifier "houseIdentifier" +#define NID_houseIdentifier 889 +#define OBJ_houseIdentifier OBJ_X509,51L + +#define LN_supportedAlgorithms "supportedAlgorithms" +#define NID_supportedAlgorithms 890 +#define OBJ_supportedAlgorithms OBJ_X509,52L + +#define LN_deltaRevocationList "deltaRevocationList" +#define NID_deltaRevocationList 891 +#define OBJ_deltaRevocationList OBJ_X509,53L + +#define SN_dmdName "dmdName" +#define NID_dmdName 892 +#define OBJ_dmdName OBJ_X509,54L + +#define LN_pseudonym "pseudonym" +#define NID_pseudonym 510 +#define OBJ_pseudonym OBJ_X509,65L + +#define SN_role "role" +#define LN_role "role" +#define NID_role 400 +#define OBJ_role OBJ_X509,72L + +#define LN_organizationIdentifier "organizationIdentifier" +#define NID_organizationIdentifier 1089 +#define OBJ_organizationIdentifier OBJ_X509,97L + +#define SN_countryCode3c "c3" +#define LN_countryCode3c "countryCode3c" +#define NID_countryCode3c 1090 +#define OBJ_countryCode3c OBJ_X509,98L + +#define SN_countryCode3n "n3" +#define LN_countryCode3n "countryCode3n" +#define NID_countryCode3n 1091 +#define OBJ_countryCode3n OBJ_X509,99L + +#define LN_dnsName "dnsName" +#define NID_dnsName 1092 +#define OBJ_dnsName OBJ_X509,100L + +#define SN_X500algorithms "X500algorithms" +#define LN_X500algorithms "directory services - algorithms" +#define NID_X500algorithms 378 +#define OBJ_X500algorithms OBJ_X500,8L + +#define SN_rsa "RSA" +#define LN_rsa "rsa" +#define NID_rsa 19 +#define OBJ_rsa OBJ_X500algorithms,1L,1L + +#define SN_mdc2WithRSA "RSA-MDC2" +#define LN_mdc2WithRSA "mdc2WithRSA" +#define NID_mdc2WithRSA 96 +#define OBJ_mdc2WithRSA OBJ_X500algorithms,3L,100L + +#define SN_mdc2 "MDC2" +#define LN_mdc2 "mdc2" +#define NID_mdc2 95 +#define OBJ_mdc2 OBJ_X500algorithms,3L,101L + +#define SN_id_ce "id-ce" +#define NID_id_ce 81 +#define OBJ_id_ce OBJ_X500,29L + +#define SN_subject_directory_attributes "subjectDirectoryAttributes" +#define LN_subject_directory_attributes "X509v3 Subject Directory Attributes" +#define NID_subject_directory_attributes 769 +#define OBJ_subject_directory_attributes OBJ_id_ce,9L + +#define SN_subject_key_identifier "subjectKeyIdentifier" +#define LN_subject_key_identifier "X509v3 Subject Key Identifier" +#define NID_subject_key_identifier 82 +#define OBJ_subject_key_identifier OBJ_id_ce,14L + +#define SN_key_usage "keyUsage" +#define LN_key_usage "X509v3 Key Usage" +#define NID_key_usage 83 +#define OBJ_key_usage OBJ_id_ce,15L + +#define SN_private_key_usage_period "privateKeyUsagePeriod" +#define LN_private_key_usage_period "X509v3 Private Key Usage Period" +#define NID_private_key_usage_period 84 +#define OBJ_private_key_usage_period OBJ_id_ce,16L + +#define SN_subject_alt_name "subjectAltName" +#define LN_subject_alt_name "X509v3 Subject Alternative Name" +#define NID_subject_alt_name 85 +#define OBJ_subject_alt_name OBJ_id_ce,17L + +#define SN_issuer_alt_name "issuerAltName" +#define LN_issuer_alt_name "X509v3 Issuer Alternative Name" +#define NID_issuer_alt_name 86 +#define OBJ_issuer_alt_name OBJ_id_ce,18L + +#define SN_basic_constraints "basicConstraints" +#define LN_basic_constraints "X509v3 Basic Constraints" +#define NID_basic_constraints 87 +#define OBJ_basic_constraints OBJ_id_ce,19L + +#define SN_crl_number "crlNumber" +#define LN_crl_number "X509v3 CRL Number" +#define NID_crl_number 88 +#define OBJ_crl_number OBJ_id_ce,20L + +#define SN_crl_reason "CRLReason" +#define LN_crl_reason "X509v3 CRL Reason Code" +#define NID_crl_reason 141 +#define OBJ_crl_reason OBJ_id_ce,21L + +#define SN_invalidity_date "invalidityDate" +#define LN_invalidity_date "Invalidity Date" +#define NID_invalidity_date 142 +#define OBJ_invalidity_date OBJ_id_ce,24L + +#define SN_delta_crl "deltaCRL" +#define LN_delta_crl "X509v3 Delta CRL Indicator" +#define NID_delta_crl 140 +#define OBJ_delta_crl OBJ_id_ce,27L + +#define SN_issuing_distribution_point "issuingDistributionPoint" +#define LN_issuing_distribution_point "X509v3 Issuing Distribution Point" +#define NID_issuing_distribution_point 770 +#define OBJ_issuing_distribution_point OBJ_id_ce,28L + +#define SN_certificate_issuer "certificateIssuer" +#define LN_certificate_issuer "X509v3 Certificate Issuer" +#define NID_certificate_issuer 771 +#define OBJ_certificate_issuer OBJ_id_ce,29L + +#define SN_name_constraints "nameConstraints" +#define LN_name_constraints "X509v3 Name Constraints" +#define NID_name_constraints 666 +#define OBJ_name_constraints OBJ_id_ce,30L + +#define SN_crl_distribution_points "crlDistributionPoints" +#define LN_crl_distribution_points "X509v3 CRL Distribution Points" +#define NID_crl_distribution_points 103 +#define OBJ_crl_distribution_points OBJ_id_ce,31L + +#define SN_certificate_policies "certificatePolicies" +#define LN_certificate_policies "X509v3 Certificate Policies" +#define NID_certificate_policies 89 +#define OBJ_certificate_policies OBJ_id_ce,32L + +#define SN_any_policy "anyPolicy" +#define LN_any_policy "X509v3 Any Policy" +#define NID_any_policy 746 +#define OBJ_any_policy OBJ_certificate_policies,0L + +#define SN_policy_mappings "policyMappings" +#define LN_policy_mappings "X509v3 Policy Mappings" +#define NID_policy_mappings 747 +#define OBJ_policy_mappings OBJ_id_ce,33L + +#define SN_authority_key_identifier "authorityKeyIdentifier" +#define LN_authority_key_identifier "X509v3 Authority Key Identifier" +#define NID_authority_key_identifier 90 +#define OBJ_authority_key_identifier OBJ_id_ce,35L + +#define SN_policy_constraints "policyConstraints" +#define LN_policy_constraints "X509v3 Policy Constraints" +#define NID_policy_constraints 401 +#define OBJ_policy_constraints OBJ_id_ce,36L + +#define SN_ext_key_usage "extendedKeyUsage" +#define LN_ext_key_usage "X509v3 Extended Key Usage" +#define NID_ext_key_usage 126 +#define OBJ_ext_key_usage OBJ_id_ce,37L + +#define SN_freshest_crl "freshestCRL" +#define LN_freshest_crl "X509v3 Freshest CRL" +#define NID_freshest_crl 857 +#define OBJ_freshest_crl OBJ_id_ce,46L + +#define SN_inhibit_any_policy "inhibitAnyPolicy" +#define LN_inhibit_any_policy "X509v3 Inhibit Any Policy" +#define NID_inhibit_any_policy 748 +#define OBJ_inhibit_any_policy OBJ_id_ce,54L + +#define SN_target_information "targetInformation" +#define LN_target_information "X509v3 AC Targeting" +#define NID_target_information 402 +#define OBJ_target_information OBJ_id_ce,55L + +#define SN_no_rev_avail "noRevAvail" +#define LN_no_rev_avail "X509v3 No Revocation Available" +#define NID_no_rev_avail 403 +#define OBJ_no_rev_avail OBJ_id_ce,56L + +#define SN_anyExtendedKeyUsage "anyExtendedKeyUsage" +#define LN_anyExtendedKeyUsage "Any Extended Key Usage" +#define NID_anyExtendedKeyUsage 910 +#define OBJ_anyExtendedKeyUsage OBJ_ext_key_usage,0L + +#define SN_netscape "Netscape" +#define LN_netscape "Netscape Communications Corp." +#define NID_netscape 57 +#define OBJ_netscape 2L,16L,840L,1L,113730L + +#define SN_netscape_cert_extension "nsCertExt" +#define LN_netscape_cert_extension "Netscape Certificate Extension" +#define NID_netscape_cert_extension 58 +#define OBJ_netscape_cert_extension OBJ_netscape,1L + +#define SN_netscape_data_type "nsDataType" +#define LN_netscape_data_type "Netscape Data Type" +#define NID_netscape_data_type 59 +#define OBJ_netscape_data_type OBJ_netscape,2L + +#define SN_netscape_cert_type "nsCertType" +#define LN_netscape_cert_type "Netscape Cert Type" +#define NID_netscape_cert_type 71 +#define OBJ_netscape_cert_type OBJ_netscape_cert_extension,1L + +#define SN_netscape_base_url "nsBaseUrl" +#define LN_netscape_base_url "Netscape Base Url" +#define NID_netscape_base_url 72 +#define OBJ_netscape_base_url OBJ_netscape_cert_extension,2L + +#define SN_netscape_revocation_url "nsRevocationUrl" +#define LN_netscape_revocation_url "Netscape Revocation Url" +#define NID_netscape_revocation_url 73 +#define OBJ_netscape_revocation_url OBJ_netscape_cert_extension,3L + +#define SN_netscape_ca_revocation_url "nsCaRevocationUrl" +#define LN_netscape_ca_revocation_url "Netscape CA Revocation Url" +#define NID_netscape_ca_revocation_url 74 +#define OBJ_netscape_ca_revocation_url OBJ_netscape_cert_extension,4L + +#define SN_netscape_renewal_url "nsRenewalUrl" +#define LN_netscape_renewal_url "Netscape Renewal Url" +#define NID_netscape_renewal_url 75 +#define OBJ_netscape_renewal_url OBJ_netscape_cert_extension,7L + +#define SN_netscape_ca_policy_url "nsCaPolicyUrl" +#define LN_netscape_ca_policy_url "Netscape CA Policy Url" +#define NID_netscape_ca_policy_url 76 +#define OBJ_netscape_ca_policy_url OBJ_netscape_cert_extension,8L + +#define SN_netscape_ssl_server_name "nsSslServerName" +#define LN_netscape_ssl_server_name "Netscape SSL Server Name" +#define NID_netscape_ssl_server_name 77 +#define OBJ_netscape_ssl_server_name OBJ_netscape_cert_extension,12L + +#define SN_netscape_comment "nsComment" +#define LN_netscape_comment "Netscape Comment" +#define NID_netscape_comment 78 +#define OBJ_netscape_comment OBJ_netscape_cert_extension,13L + +#define SN_netscape_cert_sequence "nsCertSequence" +#define LN_netscape_cert_sequence "Netscape Certificate Sequence" +#define NID_netscape_cert_sequence 79 +#define OBJ_netscape_cert_sequence OBJ_netscape_data_type,5L + +#define SN_ns_sgc "nsSGC" +#define LN_ns_sgc "Netscape Server Gated Crypto" +#define NID_ns_sgc 139 +#define OBJ_ns_sgc OBJ_netscape,4L,1L + +#define SN_org "ORG" +#define LN_org "org" +#define NID_org 379 +#define OBJ_org OBJ_iso,3L + +#define SN_dod "DOD" +#define LN_dod "dod" +#define NID_dod 380 +#define OBJ_dod OBJ_org,6L + +#define SN_iana "IANA" +#define LN_iana "iana" +#define NID_iana 381 +#define OBJ_iana OBJ_dod,1L + +#define OBJ_internet OBJ_iana + +#define SN_Directory "directory" +#define LN_Directory "Directory" +#define NID_Directory 382 +#define OBJ_Directory OBJ_internet,1L + +#define SN_Management "mgmt" +#define LN_Management "Management" +#define NID_Management 383 +#define OBJ_Management OBJ_internet,2L + +#define SN_Experimental "experimental" +#define LN_Experimental "Experimental" +#define NID_Experimental 384 +#define OBJ_Experimental OBJ_internet,3L + +#define SN_Private "private" +#define LN_Private "Private" +#define NID_Private 385 +#define OBJ_Private OBJ_internet,4L + +#define SN_Security "security" +#define LN_Security "Security" +#define NID_Security 386 +#define OBJ_Security OBJ_internet,5L + +#define SN_SNMPv2 "snmpv2" +#define LN_SNMPv2 "SNMPv2" +#define NID_SNMPv2 387 +#define OBJ_SNMPv2 OBJ_internet,6L + +#define LN_Mail "Mail" +#define NID_Mail 388 +#define OBJ_Mail OBJ_internet,7L + +#define SN_Enterprises "enterprises" +#define LN_Enterprises "Enterprises" +#define NID_Enterprises 389 +#define OBJ_Enterprises OBJ_Private,1L + +#define SN_dcObject "dcobject" +#define LN_dcObject "dcObject" +#define NID_dcObject 390 +#define OBJ_dcObject OBJ_Enterprises,1466L,344L + +#define SN_mime_mhs "mime-mhs" +#define LN_mime_mhs "MIME MHS" +#define NID_mime_mhs 504 +#define OBJ_mime_mhs OBJ_Mail,1L + +#define SN_mime_mhs_headings "mime-mhs-headings" +#define LN_mime_mhs_headings "mime-mhs-headings" +#define NID_mime_mhs_headings 505 +#define OBJ_mime_mhs_headings OBJ_mime_mhs,1L + +#define SN_mime_mhs_bodies "mime-mhs-bodies" +#define LN_mime_mhs_bodies "mime-mhs-bodies" +#define NID_mime_mhs_bodies 506 +#define OBJ_mime_mhs_bodies OBJ_mime_mhs,2L + +#define SN_id_hex_partial_message "id-hex-partial-message" +#define LN_id_hex_partial_message "id-hex-partial-message" +#define NID_id_hex_partial_message 507 +#define OBJ_id_hex_partial_message OBJ_mime_mhs_headings,1L + +#define SN_id_hex_multipart_message "id-hex-multipart-message" +#define LN_id_hex_multipart_message "id-hex-multipart-message" +#define NID_id_hex_multipart_message 508 +#define OBJ_id_hex_multipart_message OBJ_mime_mhs_headings,2L + +#define SN_zlib_compression "ZLIB" +#define LN_zlib_compression "zlib compression" +#define NID_zlib_compression 125 +#define OBJ_zlib_compression OBJ_id_smime_alg,8L + +#define OBJ_csor 2L,16L,840L,1L,101L,3L + +#define OBJ_nistAlgorithms OBJ_csor,4L + +#define OBJ_aes OBJ_nistAlgorithms,1L + +#define SN_aes_128_ecb "AES-128-ECB" +#define LN_aes_128_ecb "aes-128-ecb" +#define NID_aes_128_ecb 418 +#define OBJ_aes_128_ecb OBJ_aes,1L + +#define SN_aes_128_cbc "AES-128-CBC" +#define LN_aes_128_cbc "aes-128-cbc" +#define NID_aes_128_cbc 419 +#define OBJ_aes_128_cbc OBJ_aes,2L + +#define SN_aes_128_ofb128 "AES-128-OFB" +#define LN_aes_128_ofb128 "aes-128-ofb" +#define NID_aes_128_ofb128 420 +#define OBJ_aes_128_ofb128 OBJ_aes,3L + +#define SN_aes_128_cfb128 "AES-128-CFB" +#define LN_aes_128_cfb128 "aes-128-cfb" +#define NID_aes_128_cfb128 421 +#define OBJ_aes_128_cfb128 OBJ_aes,4L + +#define SN_id_aes128_wrap "id-aes128-wrap" +#define NID_id_aes128_wrap 788 +#define OBJ_id_aes128_wrap OBJ_aes,5L + +#define SN_aes_128_gcm "id-aes128-GCM" +#define LN_aes_128_gcm "aes-128-gcm" +#define NID_aes_128_gcm 895 +#define OBJ_aes_128_gcm OBJ_aes,6L + +#define SN_aes_128_ccm "id-aes128-CCM" +#define LN_aes_128_ccm "aes-128-ccm" +#define NID_aes_128_ccm 896 +#define OBJ_aes_128_ccm OBJ_aes,7L + +#define SN_id_aes128_wrap_pad "id-aes128-wrap-pad" +#define NID_id_aes128_wrap_pad 897 +#define OBJ_id_aes128_wrap_pad OBJ_aes,8L + +#define SN_aes_192_ecb "AES-192-ECB" +#define LN_aes_192_ecb "aes-192-ecb" +#define NID_aes_192_ecb 422 +#define OBJ_aes_192_ecb OBJ_aes,21L + +#define SN_aes_192_cbc "AES-192-CBC" +#define LN_aes_192_cbc "aes-192-cbc" +#define NID_aes_192_cbc 423 +#define OBJ_aes_192_cbc OBJ_aes,22L + +#define SN_aes_192_ofb128 "AES-192-OFB" +#define LN_aes_192_ofb128 "aes-192-ofb" +#define NID_aes_192_ofb128 424 +#define OBJ_aes_192_ofb128 OBJ_aes,23L + +#define SN_aes_192_cfb128 "AES-192-CFB" +#define LN_aes_192_cfb128 "aes-192-cfb" +#define NID_aes_192_cfb128 425 +#define OBJ_aes_192_cfb128 OBJ_aes,24L + +#define SN_id_aes192_wrap "id-aes192-wrap" +#define NID_id_aes192_wrap 789 +#define OBJ_id_aes192_wrap OBJ_aes,25L + +#define SN_aes_192_gcm "id-aes192-GCM" +#define LN_aes_192_gcm "aes-192-gcm" +#define NID_aes_192_gcm 898 +#define OBJ_aes_192_gcm OBJ_aes,26L + +#define SN_aes_192_ccm "id-aes192-CCM" +#define LN_aes_192_ccm "aes-192-ccm" +#define NID_aes_192_ccm 899 +#define OBJ_aes_192_ccm OBJ_aes,27L + +#define SN_id_aes192_wrap_pad "id-aes192-wrap-pad" +#define NID_id_aes192_wrap_pad 900 +#define OBJ_id_aes192_wrap_pad OBJ_aes,28L + +#define SN_aes_256_ecb "AES-256-ECB" +#define LN_aes_256_ecb "aes-256-ecb" +#define NID_aes_256_ecb 426 +#define OBJ_aes_256_ecb OBJ_aes,41L + +#define SN_aes_256_cbc "AES-256-CBC" +#define LN_aes_256_cbc "aes-256-cbc" +#define NID_aes_256_cbc 427 +#define OBJ_aes_256_cbc OBJ_aes,42L + +#define SN_aes_256_ofb128 "AES-256-OFB" +#define LN_aes_256_ofb128 "aes-256-ofb" +#define NID_aes_256_ofb128 428 +#define OBJ_aes_256_ofb128 OBJ_aes,43L + +#define SN_aes_256_cfb128 "AES-256-CFB" +#define LN_aes_256_cfb128 "aes-256-cfb" +#define NID_aes_256_cfb128 429 +#define OBJ_aes_256_cfb128 OBJ_aes,44L + +#define SN_id_aes256_wrap "id-aes256-wrap" +#define NID_id_aes256_wrap 790 +#define OBJ_id_aes256_wrap OBJ_aes,45L + +#define SN_aes_256_gcm "id-aes256-GCM" +#define LN_aes_256_gcm "aes-256-gcm" +#define NID_aes_256_gcm 901 +#define OBJ_aes_256_gcm OBJ_aes,46L + +#define SN_aes_256_ccm "id-aes256-CCM" +#define LN_aes_256_ccm "aes-256-ccm" +#define NID_aes_256_ccm 902 +#define OBJ_aes_256_ccm OBJ_aes,47L + +#define SN_id_aes256_wrap_pad "id-aes256-wrap-pad" +#define NID_id_aes256_wrap_pad 903 +#define OBJ_id_aes256_wrap_pad OBJ_aes,48L + +#define SN_aes_128_xts "AES-128-XTS" +#define LN_aes_128_xts "aes-128-xts" +#define NID_aes_128_xts 913 +#define OBJ_aes_128_xts OBJ_ieee_siswg,0L,1L,1L + +#define SN_aes_256_xts "AES-256-XTS" +#define LN_aes_256_xts "aes-256-xts" +#define NID_aes_256_xts 914 +#define OBJ_aes_256_xts OBJ_ieee_siswg,0L,1L,2L + +#define SN_aes_128_cfb1 "AES-128-CFB1" +#define LN_aes_128_cfb1 "aes-128-cfb1" +#define NID_aes_128_cfb1 650 + +#define SN_aes_192_cfb1 "AES-192-CFB1" +#define LN_aes_192_cfb1 "aes-192-cfb1" +#define NID_aes_192_cfb1 651 + +#define SN_aes_256_cfb1 "AES-256-CFB1" +#define LN_aes_256_cfb1 "aes-256-cfb1" +#define NID_aes_256_cfb1 652 + +#define SN_aes_128_cfb8 "AES-128-CFB8" +#define LN_aes_128_cfb8 "aes-128-cfb8" +#define NID_aes_128_cfb8 653 + +#define SN_aes_192_cfb8 "AES-192-CFB8" +#define LN_aes_192_cfb8 "aes-192-cfb8" +#define NID_aes_192_cfb8 654 + +#define SN_aes_256_cfb8 "AES-256-CFB8" +#define LN_aes_256_cfb8 "aes-256-cfb8" +#define NID_aes_256_cfb8 655 + +#define SN_aes_128_ctr "AES-128-CTR" +#define LN_aes_128_ctr "aes-128-ctr" +#define NID_aes_128_ctr 904 + +#define SN_aes_192_ctr "AES-192-CTR" +#define LN_aes_192_ctr "aes-192-ctr" +#define NID_aes_192_ctr 905 + +#define SN_aes_256_ctr "AES-256-CTR" +#define LN_aes_256_ctr "aes-256-ctr" +#define NID_aes_256_ctr 906 + +#define SN_aes_128_ocb "AES-128-OCB" +#define LN_aes_128_ocb "aes-128-ocb" +#define NID_aes_128_ocb 958 + +#define SN_aes_192_ocb "AES-192-OCB" +#define LN_aes_192_ocb "aes-192-ocb" +#define NID_aes_192_ocb 959 + +#define SN_aes_256_ocb "AES-256-OCB" +#define LN_aes_256_ocb "aes-256-ocb" +#define NID_aes_256_ocb 960 + +#define SN_des_cfb1 "DES-CFB1" +#define LN_des_cfb1 "des-cfb1" +#define NID_des_cfb1 656 + +#define SN_des_cfb8 "DES-CFB8" +#define LN_des_cfb8 "des-cfb8" +#define NID_des_cfb8 657 + +#define SN_des_ede3_cfb1 "DES-EDE3-CFB1" +#define LN_des_ede3_cfb1 "des-ede3-cfb1" +#define NID_des_ede3_cfb1 658 + +#define SN_des_ede3_cfb8 "DES-EDE3-CFB8" +#define LN_des_ede3_cfb8 "des-ede3-cfb8" +#define NID_des_ede3_cfb8 659 + +#define OBJ_nist_hashalgs OBJ_nistAlgorithms,2L + +#define SN_sha256 "SHA256" +#define LN_sha256 "sha256" +#define NID_sha256 672 +#define OBJ_sha256 OBJ_nist_hashalgs,1L + +#define SN_sha384 "SHA384" +#define LN_sha384 "sha384" +#define NID_sha384 673 +#define OBJ_sha384 OBJ_nist_hashalgs,2L + +#define SN_sha512 "SHA512" +#define LN_sha512 "sha512" +#define NID_sha512 674 +#define OBJ_sha512 OBJ_nist_hashalgs,3L + +#define SN_sha224 "SHA224" +#define LN_sha224 "sha224" +#define NID_sha224 675 +#define OBJ_sha224 OBJ_nist_hashalgs,4L + +#define SN_sha512_224 "SHA512-224" +#define LN_sha512_224 "sha512-224" +#define NID_sha512_224 1094 +#define OBJ_sha512_224 OBJ_nist_hashalgs,5L + +#define SN_sha512_256 "SHA512-256" +#define LN_sha512_256 "sha512-256" +#define NID_sha512_256 1095 +#define OBJ_sha512_256 OBJ_nist_hashalgs,6L + +#define SN_sha3_224 "SHA3-224" +#define LN_sha3_224 "sha3-224" +#define NID_sha3_224 1096 +#define OBJ_sha3_224 OBJ_nist_hashalgs,7L + +#define SN_sha3_256 "SHA3-256" +#define LN_sha3_256 "sha3-256" +#define NID_sha3_256 1097 +#define OBJ_sha3_256 OBJ_nist_hashalgs,8L + +#define SN_sha3_384 "SHA3-384" +#define LN_sha3_384 "sha3-384" +#define NID_sha3_384 1098 +#define OBJ_sha3_384 OBJ_nist_hashalgs,9L + +#define SN_sha3_512 "SHA3-512" +#define LN_sha3_512 "sha3-512" +#define NID_sha3_512 1099 +#define OBJ_sha3_512 OBJ_nist_hashalgs,10L + +#define SN_shake128 "SHAKE128" +#define LN_shake128 "shake128" +#define NID_shake128 1100 +#define OBJ_shake128 OBJ_nist_hashalgs,11L + +#define SN_shake256 "SHAKE256" +#define LN_shake256 "shake256" +#define NID_shake256 1101 +#define OBJ_shake256 OBJ_nist_hashalgs,12L + +#define SN_hmac_sha3_224 "id-hmacWithSHA3-224" +#define LN_hmac_sha3_224 "hmac-sha3-224" +#define NID_hmac_sha3_224 1102 +#define OBJ_hmac_sha3_224 OBJ_nist_hashalgs,13L + +#define SN_hmac_sha3_256 "id-hmacWithSHA3-256" +#define LN_hmac_sha3_256 "hmac-sha3-256" +#define NID_hmac_sha3_256 1103 +#define OBJ_hmac_sha3_256 OBJ_nist_hashalgs,14L + +#define SN_hmac_sha3_384 "id-hmacWithSHA3-384" +#define LN_hmac_sha3_384 "hmac-sha3-384" +#define NID_hmac_sha3_384 1104 +#define OBJ_hmac_sha3_384 OBJ_nist_hashalgs,15L + +#define SN_hmac_sha3_512 "id-hmacWithSHA3-512" +#define LN_hmac_sha3_512 "hmac-sha3-512" +#define NID_hmac_sha3_512 1105 +#define OBJ_hmac_sha3_512 OBJ_nist_hashalgs,16L + +#define OBJ_dsa_with_sha2 OBJ_nistAlgorithms,3L + +#define SN_dsa_with_SHA224 "dsa_with_SHA224" +#define NID_dsa_with_SHA224 802 +#define OBJ_dsa_with_SHA224 OBJ_dsa_with_sha2,1L + +#define SN_dsa_with_SHA256 "dsa_with_SHA256" +#define NID_dsa_with_SHA256 803 +#define OBJ_dsa_with_SHA256 OBJ_dsa_with_sha2,2L + +#define OBJ_sigAlgs OBJ_nistAlgorithms,3L + +#define SN_dsa_with_SHA384 "id-dsa-with-sha384" +#define LN_dsa_with_SHA384 "dsa_with_SHA384" +#define NID_dsa_with_SHA384 1106 +#define OBJ_dsa_with_SHA384 OBJ_sigAlgs,3L + +#define SN_dsa_with_SHA512 "id-dsa-with-sha512" +#define LN_dsa_with_SHA512 "dsa_with_SHA512" +#define NID_dsa_with_SHA512 1107 +#define OBJ_dsa_with_SHA512 OBJ_sigAlgs,4L + +#define SN_dsa_with_SHA3_224 "id-dsa-with-sha3-224" +#define LN_dsa_with_SHA3_224 "dsa_with_SHA3-224" +#define NID_dsa_with_SHA3_224 1108 +#define OBJ_dsa_with_SHA3_224 OBJ_sigAlgs,5L + +#define SN_dsa_with_SHA3_256 "id-dsa-with-sha3-256" +#define LN_dsa_with_SHA3_256 "dsa_with_SHA3-256" +#define NID_dsa_with_SHA3_256 1109 +#define OBJ_dsa_with_SHA3_256 OBJ_sigAlgs,6L + +#define SN_dsa_with_SHA3_384 "id-dsa-with-sha3-384" +#define LN_dsa_with_SHA3_384 "dsa_with_SHA3-384" +#define NID_dsa_with_SHA3_384 1110 +#define OBJ_dsa_with_SHA3_384 OBJ_sigAlgs,7L + +#define SN_dsa_with_SHA3_512 "id-dsa-with-sha3-512" +#define LN_dsa_with_SHA3_512 "dsa_with_SHA3-512" +#define NID_dsa_with_SHA3_512 1111 +#define OBJ_dsa_with_SHA3_512 OBJ_sigAlgs,8L + +#define SN_ecdsa_with_SHA3_224 "id-ecdsa-with-sha3-224" +#define LN_ecdsa_with_SHA3_224 "ecdsa_with_SHA3-224" +#define NID_ecdsa_with_SHA3_224 1112 +#define OBJ_ecdsa_with_SHA3_224 OBJ_sigAlgs,9L + +#define SN_ecdsa_with_SHA3_256 "id-ecdsa-with-sha3-256" +#define LN_ecdsa_with_SHA3_256 "ecdsa_with_SHA3-256" +#define NID_ecdsa_with_SHA3_256 1113 +#define OBJ_ecdsa_with_SHA3_256 OBJ_sigAlgs,10L + +#define SN_ecdsa_with_SHA3_384 "id-ecdsa-with-sha3-384" +#define LN_ecdsa_with_SHA3_384 "ecdsa_with_SHA3-384" +#define NID_ecdsa_with_SHA3_384 1114 +#define OBJ_ecdsa_with_SHA3_384 OBJ_sigAlgs,11L + +#define SN_ecdsa_with_SHA3_512 "id-ecdsa-with-sha3-512" +#define LN_ecdsa_with_SHA3_512 "ecdsa_with_SHA3-512" +#define NID_ecdsa_with_SHA3_512 1115 +#define OBJ_ecdsa_with_SHA3_512 OBJ_sigAlgs,12L + +#define SN_RSA_SHA3_224 "id-rsassa-pkcs1-v1_5-with-sha3-224" +#define LN_RSA_SHA3_224 "RSA-SHA3-224" +#define NID_RSA_SHA3_224 1116 +#define OBJ_RSA_SHA3_224 OBJ_sigAlgs,13L + +#define SN_RSA_SHA3_256 "id-rsassa-pkcs1-v1_5-with-sha3-256" +#define LN_RSA_SHA3_256 "RSA-SHA3-256" +#define NID_RSA_SHA3_256 1117 +#define OBJ_RSA_SHA3_256 OBJ_sigAlgs,14L + +#define SN_RSA_SHA3_384 "id-rsassa-pkcs1-v1_5-with-sha3-384" +#define LN_RSA_SHA3_384 "RSA-SHA3-384" +#define NID_RSA_SHA3_384 1118 +#define OBJ_RSA_SHA3_384 OBJ_sigAlgs,15L + +#define SN_RSA_SHA3_512 "id-rsassa-pkcs1-v1_5-with-sha3-512" +#define LN_RSA_SHA3_512 "RSA-SHA3-512" +#define NID_RSA_SHA3_512 1119 +#define OBJ_RSA_SHA3_512 OBJ_sigAlgs,16L + +#define SN_hold_instruction_code "holdInstructionCode" +#define LN_hold_instruction_code "Hold Instruction Code" +#define NID_hold_instruction_code 430 +#define OBJ_hold_instruction_code OBJ_id_ce,23L + +#define OBJ_holdInstruction OBJ_X9_57,2L + +#define SN_hold_instruction_none "holdInstructionNone" +#define LN_hold_instruction_none "Hold Instruction None" +#define NID_hold_instruction_none 431 +#define OBJ_hold_instruction_none OBJ_holdInstruction,1L + +#define SN_hold_instruction_call_issuer "holdInstructionCallIssuer" +#define LN_hold_instruction_call_issuer "Hold Instruction Call Issuer" +#define NID_hold_instruction_call_issuer 432 +#define OBJ_hold_instruction_call_issuer OBJ_holdInstruction,2L + +#define SN_hold_instruction_reject "holdInstructionReject" +#define LN_hold_instruction_reject "Hold Instruction Reject" +#define NID_hold_instruction_reject 433 +#define OBJ_hold_instruction_reject OBJ_holdInstruction,3L + +#define SN_data "data" +#define NID_data 434 +#define OBJ_data OBJ_itu_t,9L + +#define SN_pss "pss" +#define NID_pss 435 +#define OBJ_pss OBJ_data,2342L + +#define SN_ucl "ucl" +#define NID_ucl 436 +#define OBJ_ucl OBJ_pss,19200300L + +#define SN_pilot "pilot" +#define NID_pilot 437 +#define OBJ_pilot OBJ_ucl,100L + +#define LN_pilotAttributeType "pilotAttributeType" +#define NID_pilotAttributeType 438 +#define OBJ_pilotAttributeType OBJ_pilot,1L + +#define LN_pilotAttributeSyntax "pilotAttributeSyntax" +#define NID_pilotAttributeSyntax 439 +#define OBJ_pilotAttributeSyntax OBJ_pilot,3L + +#define LN_pilotObjectClass "pilotObjectClass" +#define NID_pilotObjectClass 440 +#define OBJ_pilotObjectClass OBJ_pilot,4L + +#define LN_pilotGroups "pilotGroups" +#define NID_pilotGroups 441 +#define OBJ_pilotGroups OBJ_pilot,10L + +#define LN_iA5StringSyntax "iA5StringSyntax" +#define NID_iA5StringSyntax 442 +#define OBJ_iA5StringSyntax OBJ_pilotAttributeSyntax,4L + +#define LN_caseIgnoreIA5StringSyntax "caseIgnoreIA5StringSyntax" +#define NID_caseIgnoreIA5StringSyntax 443 +#define OBJ_caseIgnoreIA5StringSyntax OBJ_pilotAttributeSyntax,5L + +#define LN_pilotObject "pilotObject" +#define NID_pilotObject 444 +#define OBJ_pilotObject OBJ_pilotObjectClass,3L + +#define LN_pilotPerson "pilotPerson" +#define NID_pilotPerson 445 +#define OBJ_pilotPerson OBJ_pilotObjectClass,4L + +#define SN_account "account" +#define NID_account 446 +#define OBJ_account OBJ_pilotObjectClass,5L + +#define SN_document "document" +#define NID_document 447 +#define OBJ_document OBJ_pilotObjectClass,6L + +#define SN_room "room" +#define NID_room 448 +#define OBJ_room OBJ_pilotObjectClass,7L + +#define LN_documentSeries "documentSeries" +#define NID_documentSeries 449 +#define OBJ_documentSeries OBJ_pilotObjectClass,9L + +#define SN_Domain "domain" +#define LN_Domain "Domain" +#define NID_Domain 392 +#define OBJ_Domain OBJ_pilotObjectClass,13L + +#define LN_rFC822localPart "rFC822localPart" +#define NID_rFC822localPart 450 +#define OBJ_rFC822localPart OBJ_pilotObjectClass,14L + +#define LN_dNSDomain "dNSDomain" +#define NID_dNSDomain 451 +#define OBJ_dNSDomain OBJ_pilotObjectClass,15L + +#define LN_domainRelatedObject "domainRelatedObject" +#define NID_domainRelatedObject 452 +#define OBJ_domainRelatedObject OBJ_pilotObjectClass,17L + +#define LN_friendlyCountry "friendlyCountry" +#define NID_friendlyCountry 453 +#define OBJ_friendlyCountry OBJ_pilotObjectClass,18L + +#define LN_simpleSecurityObject "simpleSecurityObject" +#define NID_simpleSecurityObject 454 +#define OBJ_simpleSecurityObject OBJ_pilotObjectClass,19L + +#define LN_pilotOrganization "pilotOrganization" +#define NID_pilotOrganization 455 +#define OBJ_pilotOrganization OBJ_pilotObjectClass,20L + +#define LN_pilotDSA "pilotDSA" +#define NID_pilotDSA 456 +#define OBJ_pilotDSA OBJ_pilotObjectClass,21L + +#define LN_qualityLabelledData "qualityLabelledData" +#define NID_qualityLabelledData 457 +#define OBJ_qualityLabelledData OBJ_pilotObjectClass,22L + +#define SN_userId "UID" +#define LN_userId "userId" +#define NID_userId 458 +#define OBJ_userId OBJ_pilotAttributeType,1L + +#define LN_textEncodedORAddress "textEncodedORAddress" +#define NID_textEncodedORAddress 459 +#define OBJ_textEncodedORAddress OBJ_pilotAttributeType,2L + +#define SN_rfc822Mailbox "mail" +#define LN_rfc822Mailbox "rfc822Mailbox" +#define NID_rfc822Mailbox 460 +#define OBJ_rfc822Mailbox OBJ_pilotAttributeType,3L + +#define SN_info "info" +#define NID_info 461 +#define OBJ_info OBJ_pilotAttributeType,4L + +#define LN_favouriteDrink "favouriteDrink" +#define NID_favouriteDrink 462 +#define OBJ_favouriteDrink OBJ_pilotAttributeType,5L + +#define LN_roomNumber "roomNumber" +#define NID_roomNumber 463 +#define OBJ_roomNumber OBJ_pilotAttributeType,6L + +#define SN_photo "photo" +#define NID_photo 464 +#define OBJ_photo OBJ_pilotAttributeType,7L + +#define LN_userClass "userClass" +#define NID_userClass 465 +#define OBJ_userClass OBJ_pilotAttributeType,8L + +#define SN_host "host" +#define NID_host 466 +#define OBJ_host OBJ_pilotAttributeType,9L + +#define SN_manager "manager" +#define NID_manager 467 +#define OBJ_manager OBJ_pilotAttributeType,10L + +#define LN_documentIdentifier "documentIdentifier" +#define NID_documentIdentifier 468 +#define OBJ_documentIdentifier OBJ_pilotAttributeType,11L + +#define LN_documentTitle "documentTitle" +#define NID_documentTitle 469 +#define OBJ_documentTitle OBJ_pilotAttributeType,12L + +#define LN_documentVersion "documentVersion" +#define NID_documentVersion 470 +#define OBJ_documentVersion OBJ_pilotAttributeType,13L + +#define LN_documentAuthor "documentAuthor" +#define NID_documentAuthor 471 +#define OBJ_documentAuthor OBJ_pilotAttributeType,14L + +#define LN_documentLocation "documentLocation" +#define NID_documentLocation 472 +#define OBJ_documentLocation OBJ_pilotAttributeType,15L + +#define LN_homeTelephoneNumber "homeTelephoneNumber" +#define NID_homeTelephoneNumber 473 +#define OBJ_homeTelephoneNumber OBJ_pilotAttributeType,20L + +#define SN_secretary "secretary" +#define NID_secretary 474 +#define OBJ_secretary OBJ_pilotAttributeType,21L + +#define LN_otherMailbox "otherMailbox" +#define NID_otherMailbox 475 +#define OBJ_otherMailbox OBJ_pilotAttributeType,22L + +#define LN_lastModifiedTime "lastModifiedTime" +#define NID_lastModifiedTime 476 +#define OBJ_lastModifiedTime OBJ_pilotAttributeType,23L + +#define LN_lastModifiedBy "lastModifiedBy" +#define NID_lastModifiedBy 477 +#define OBJ_lastModifiedBy OBJ_pilotAttributeType,24L + +#define SN_domainComponent "DC" +#define LN_domainComponent "domainComponent" +#define NID_domainComponent 391 +#define OBJ_domainComponent OBJ_pilotAttributeType,25L + +#define LN_aRecord "aRecord" +#define NID_aRecord 478 +#define OBJ_aRecord OBJ_pilotAttributeType,26L + +#define LN_pilotAttributeType27 "pilotAttributeType27" +#define NID_pilotAttributeType27 479 +#define OBJ_pilotAttributeType27 OBJ_pilotAttributeType,27L + +#define LN_mXRecord "mXRecord" +#define NID_mXRecord 480 +#define OBJ_mXRecord OBJ_pilotAttributeType,28L + +#define LN_nSRecord "nSRecord" +#define NID_nSRecord 481 +#define OBJ_nSRecord OBJ_pilotAttributeType,29L + +#define LN_sOARecord "sOARecord" +#define NID_sOARecord 482 +#define OBJ_sOARecord OBJ_pilotAttributeType,30L + +#define LN_cNAMERecord "cNAMERecord" +#define NID_cNAMERecord 483 +#define OBJ_cNAMERecord OBJ_pilotAttributeType,31L + +#define LN_associatedDomain "associatedDomain" +#define NID_associatedDomain 484 +#define OBJ_associatedDomain OBJ_pilotAttributeType,37L + +#define LN_associatedName "associatedName" +#define NID_associatedName 485 +#define OBJ_associatedName OBJ_pilotAttributeType,38L + +#define LN_homePostalAddress "homePostalAddress" +#define NID_homePostalAddress 486 +#define OBJ_homePostalAddress OBJ_pilotAttributeType,39L + +#define LN_personalTitle "personalTitle" +#define NID_personalTitle 487 +#define OBJ_personalTitle OBJ_pilotAttributeType,40L + +#define LN_mobileTelephoneNumber "mobileTelephoneNumber" +#define NID_mobileTelephoneNumber 488 +#define OBJ_mobileTelephoneNumber OBJ_pilotAttributeType,41L + +#define LN_pagerTelephoneNumber "pagerTelephoneNumber" +#define NID_pagerTelephoneNumber 489 +#define OBJ_pagerTelephoneNumber OBJ_pilotAttributeType,42L + +#define LN_friendlyCountryName "friendlyCountryName" +#define NID_friendlyCountryName 490 +#define OBJ_friendlyCountryName OBJ_pilotAttributeType,43L + +#define SN_uniqueIdentifier "uid" +#define LN_uniqueIdentifier "uniqueIdentifier" +#define NID_uniqueIdentifier 102 +#define OBJ_uniqueIdentifier OBJ_pilotAttributeType,44L + +#define LN_organizationalStatus "organizationalStatus" +#define NID_organizationalStatus 491 +#define OBJ_organizationalStatus OBJ_pilotAttributeType,45L + +#define LN_janetMailbox "janetMailbox" +#define NID_janetMailbox 492 +#define OBJ_janetMailbox OBJ_pilotAttributeType,46L + +#define LN_mailPreferenceOption "mailPreferenceOption" +#define NID_mailPreferenceOption 493 +#define OBJ_mailPreferenceOption OBJ_pilotAttributeType,47L + +#define LN_buildingName "buildingName" +#define NID_buildingName 494 +#define OBJ_buildingName OBJ_pilotAttributeType,48L + +#define LN_dSAQuality "dSAQuality" +#define NID_dSAQuality 495 +#define OBJ_dSAQuality OBJ_pilotAttributeType,49L + +#define LN_singleLevelQuality "singleLevelQuality" +#define NID_singleLevelQuality 496 +#define OBJ_singleLevelQuality OBJ_pilotAttributeType,50L + +#define LN_subtreeMinimumQuality "subtreeMinimumQuality" +#define NID_subtreeMinimumQuality 497 +#define OBJ_subtreeMinimumQuality OBJ_pilotAttributeType,51L + +#define LN_subtreeMaximumQuality "subtreeMaximumQuality" +#define NID_subtreeMaximumQuality 498 +#define OBJ_subtreeMaximumQuality OBJ_pilotAttributeType,52L + +#define LN_personalSignature "personalSignature" +#define NID_personalSignature 499 +#define OBJ_personalSignature OBJ_pilotAttributeType,53L + +#define LN_dITRedirect "dITRedirect" +#define NID_dITRedirect 500 +#define OBJ_dITRedirect OBJ_pilotAttributeType,54L + +#define SN_audio "audio" +#define NID_audio 501 +#define OBJ_audio OBJ_pilotAttributeType,55L + +#define LN_documentPublisher "documentPublisher" +#define NID_documentPublisher 502 +#define OBJ_documentPublisher OBJ_pilotAttributeType,56L + +#define SN_id_set "id-set" +#define LN_id_set "Secure Electronic Transactions" +#define NID_id_set 512 +#define OBJ_id_set OBJ_international_organizations,42L + +#define SN_set_ctype "set-ctype" +#define LN_set_ctype "content types" +#define NID_set_ctype 513 +#define OBJ_set_ctype OBJ_id_set,0L + +#define SN_set_msgExt "set-msgExt" +#define LN_set_msgExt "message extensions" +#define NID_set_msgExt 514 +#define OBJ_set_msgExt OBJ_id_set,1L + +#define SN_set_attr "set-attr" +#define NID_set_attr 515 +#define OBJ_set_attr OBJ_id_set,3L + +#define SN_set_policy "set-policy" +#define NID_set_policy 516 +#define OBJ_set_policy OBJ_id_set,5L + +#define SN_set_certExt "set-certExt" +#define LN_set_certExt "certificate extensions" +#define NID_set_certExt 517 +#define OBJ_set_certExt OBJ_id_set,7L + +#define SN_set_brand "set-brand" +#define NID_set_brand 518 +#define OBJ_set_brand OBJ_id_set,8L + +#define SN_setct_PANData "setct-PANData" +#define NID_setct_PANData 519 +#define OBJ_setct_PANData OBJ_set_ctype,0L + +#define SN_setct_PANToken "setct-PANToken" +#define NID_setct_PANToken 520 +#define OBJ_setct_PANToken OBJ_set_ctype,1L + +#define SN_setct_PANOnly "setct-PANOnly" +#define NID_setct_PANOnly 521 +#define OBJ_setct_PANOnly OBJ_set_ctype,2L + +#define SN_setct_OIData "setct-OIData" +#define NID_setct_OIData 522 +#define OBJ_setct_OIData OBJ_set_ctype,3L + +#define SN_setct_PI "setct-PI" +#define NID_setct_PI 523 +#define OBJ_setct_PI OBJ_set_ctype,4L + +#define SN_setct_PIData "setct-PIData" +#define NID_setct_PIData 524 +#define OBJ_setct_PIData OBJ_set_ctype,5L + +#define SN_setct_PIDataUnsigned "setct-PIDataUnsigned" +#define NID_setct_PIDataUnsigned 525 +#define OBJ_setct_PIDataUnsigned OBJ_set_ctype,6L + +#define SN_setct_HODInput "setct-HODInput" +#define NID_setct_HODInput 526 +#define OBJ_setct_HODInput OBJ_set_ctype,7L + +#define SN_setct_AuthResBaggage "setct-AuthResBaggage" +#define NID_setct_AuthResBaggage 527 +#define OBJ_setct_AuthResBaggage OBJ_set_ctype,8L + +#define SN_setct_AuthRevReqBaggage "setct-AuthRevReqBaggage" +#define NID_setct_AuthRevReqBaggage 528 +#define OBJ_setct_AuthRevReqBaggage OBJ_set_ctype,9L + +#define SN_setct_AuthRevResBaggage "setct-AuthRevResBaggage" +#define NID_setct_AuthRevResBaggage 529 +#define OBJ_setct_AuthRevResBaggage OBJ_set_ctype,10L + +#define SN_setct_CapTokenSeq "setct-CapTokenSeq" +#define NID_setct_CapTokenSeq 530 +#define OBJ_setct_CapTokenSeq OBJ_set_ctype,11L + +#define SN_setct_PInitResData "setct-PInitResData" +#define NID_setct_PInitResData 531 +#define OBJ_setct_PInitResData OBJ_set_ctype,12L + +#define SN_setct_PI_TBS "setct-PI-TBS" +#define NID_setct_PI_TBS 532 +#define OBJ_setct_PI_TBS OBJ_set_ctype,13L + +#define SN_setct_PResData "setct-PResData" +#define NID_setct_PResData 533 +#define OBJ_setct_PResData OBJ_set_ctype,14L + +#define SN_setct_AuthReqTBS "setct-AuthReqTBS" +#define NID_setct_AuthReqTBS 534 +#define OBJ_setct_AuthReqTBS OBJ_set_ctype,16L + +#define SN_setct_AuthResTBS "setct-AuthResTBS" +#define NID_setct_AuthResTBS 535 +#define OBJ_setct_AuthResTBS OBJ_set_ctype,17L + +#define SN_setct_AuthResTBSX "setct-AuthResTBSX" +#define NID_setct_AuthResTBSX 536 +#define OBJ_setct_AuthResTBSX OBJ_set_ctype,18L + +#define SN_setct_AuthTokenTBS "setct-AuthTokenTBS" +#define NID_setct_AuthTokenTBS 537 +#define OBJ_setct_AuthTokenTBS OBJ_set_ctype,19L + +#define SN_setct_CapTokenData "setct-CapTokenData" +#define NID_setct_CapTokenData 538 +#define OBJ_setct_CapTokenData OBJ_set_ctype,20L + +#define SN_setct_CapTokenTBS "setct-CapTokenTBS" +#define NID_setct_CapTokenTBS 539 +#define OBJ_setct_CapTokenTBS OBJ_set_ctype,21L + +#define SN_setct_AcqCardCodeMsg "setct-AcqCardCodeMsg" +#define NID_setct_AcqCardCodeMsg 540 +#define OBJ_setct_AcqCardCodeMsg OBJ_set_ctype,22L + +#define SN_setct_AuthRevReqTBS "setct-AuthRevReqTBS" +#define NID_setct_AuthRevReqTBS 541 +#define OBJ_setct_AuthRevReqTBS OBJ_set_ctype,23L + +#define SN_setct_AuthRevResData "setct-AuthRevResData" +#define NID_setct_AuthRevResData 542 +#define OBJ_setct_AuthRevResData OBJ_set_ctype,24L + +#define SN_setct_AuthRevResTBS "setct-AuthRevResTBS" +#define NID_setct_AuthRevResTBS 543 +#define OBJ_setct_AuthRevResTBS OBJ_set_ctype,25L + +#define SN_setct_CapReqTBS "setct-CapReqTBS" +#define NID_setct_CapReqTBS 544 +#define OBJ_setct_CapReqTBS OBJ_set_ctype,26L + +#define SN_setct_CapReqTBSX "setct-CapReqTBSX" +#define NID_setct_CapReqTBSX 545 +#define OBJ_setct_CapReqTBSX OBJ_set_ctype,27L + +#define SN_setct_CapResData "setct-CapResData" +#define NID_setct_CapResData 546 +#define OBJ_setct_CapResData OBJ_set_ctype,28L + +#define SN_setct_CapRevReqTBS "setct-CapRevReqTBS" +#define NID_setct_CapRevReqTBS 547 +#define OBJ_setct_CapRevReqTBS OBJ_set_ctype,29L + +#define SN_setct_CapRevReqTBSX "setct-CapRevReqTBSX" +#define NID_setct_CapRevReqTBSX 548 +#define OBJ_setct_CapRevReqTBSX OBJ_set_ctype,30L + +#define SN_setct_CapRevResData "setct-CapRevResData" +#define NID_setct_CapRevResData 549 +#define OBJ_setct_CapRevResData OBJ_set_ctype,31L + +#define SN_setct_CredReqTBS "setct-CredReqTBS" +#define NID_setct_CredReqTBS 550 +#define OBJ_setct_CredReqTBS OBJ_set_ctype,32L + +#define SN_setct_CredReqTBSX "setct-CredReqTBSX" +#define NID_setct_CredReqTBSX 551 +#define OBJ_setct_CredReqTBSX OBJ_set_ctype,33L + +#define SN_setct_CredResData "setct-CredResData" +#define NID_setct_CredResData 552 +#define OBJ_setct_CredResData OBJ_set_ctype,34L + +#define SN_setct_CredRevReqTBS "setct-CredRevReqTBS" +#define NID_setct_CredRevReqTBS 553 +#define OBJ_setct_CredRevReqTBS OBJ_set_ctype,35L + +#define SN_setct_CredRevReqTBSX "setct-CredRevReqTBSX" +#define NID_setct_CredRevReqTBSX 554 +#define OBJ_setct_CredRevReqTBSX OBJ_set_ctype,36L + +#define SN_setct_CredRevResData "setct-CredRevResData" +#define NID_setct_CredRevResData 555 +#define OBJ_setct_CredRevResData OBJ_set_ctype,37L + +#define SN_setct_PCertReqData "setct-PCertReqData" +#define NID_setct_PCertReqData 556 +#define OBJ_setct_PCertReqData OBJ_set_ctype,38L + +#define SN_setct_PCertResTBS "setct-PCertResTBS" +#define NID_setct_PCertResTBS 557 +#define OBJ_setct_PCertResTBS OBJ_set_ctype,39L + +#define SN_setct_BatchAdminReqData "setct-BatchAdminReqData" +#define NID_setct_BatchAdminReqData 558 +#define OBJ_setct_BatchAdminReqData OBJ_set_ctype,40L + +#define SN_setct_BatchAdminResData "setct-BatchAdminResData" +#define NID_setct_BatchAdminResData 559 +#define OBJ_setct_BatchAdminResData OBJ_set_ctype,41L + +#define SN_setct_CardCInitResTBS "setct-CardCInitResTBS" +#define NID_setct_CardCInitResTBS 560 +#define OBJ_setct_CardCInitResTBS OBJ_set_ctype,42L + +#define SN_setct_MeAqCInitResTBS "setct-MeAqCInitResTBS" +#define NID_setct_MeAqCInitResTBS 561 +#define OBJ_setct_MeAqCInitResTBS OBJ_set_ctype,43L + +#define SN_setct_RegFormResTBS "setct-RegFormResTBS" +#define NID_setct_RegFormResTBS 562 +#define OBJ_setct_RegFormResTBS OBJ_set_ctype,44L + +#define SN_setct_CertReqData "setct-CertReqData" +#define NID_setct_CertReqData 563 +#define OBJ_setct_CertReqData OBJ_set_ctype,45L + +#define SN_setct_CertReqTBS "setct-CertReqTBS" +#define NID_setct_CertReqTBS 564 +#define OBJ_setct_CertReqTBS OBJ_set_ctype,46L + +#define SN_setct_CertResData "setct-CertResData" +#define NID_setct_CertResData 565 +#define OBJ_setct_CertResData OBJ_set_ctype,47L + +#define SN_setct_CertInqReqTBS "setct-CertInqReqTBS" +#define NID_setct_CertInqReqTBS 566 +#define OBJ_setct_CertInqReqTBS OBJ_set_ctype,48L + +#define SN_setct_ErrorTBS "setct-ErrorTBS" +#define NID_setct_ErrorTBS 567 +#define OBJ_setct_ErrorTBS OBJ_set_ctype,49L + +#define SN_setct_PIDualSignedTBE "setct-PIDualSignedTBE" +#define NID_setct_PIDualSignedTBE 568 +#define OBJ_setct_PIDualSignedTBE OBJ_set_ctype,50L + +#define SN_setct_PIUnsignedTBE "setct-PIUnsignedTBE" +#define NID_setct_PIUnsignedTBE 569 +#define OBJ_setct_PIUnsignedTBE OBJ_set_ctype,51L + +#define SN_setct_AuthReqTBE "setct-AuthReqTBE" +#define NID_setct_AuthReqTBE 570 +#define OBJ_setct_AuthReqTBE OBJ_set_ctype,52L + +#define SN_setct_AuthResTBE "setct-AuthResTBE" +#define NID_setct_AuthResTBE 571 +#define OBJ_setct_AuthResTBE OBJ_set_ctype,53L + +#define SN_setct_AuthResTBEX "setct-AuthResTBEX" +#define NID_setct_AuthResTBEX 572 +#define OBJ_setct_AuthResTBEX OBJ_set_ctype,54L + +#define SN_setct_AuthTokenTBE "setct-AuthTokenTBE" +#define NID_setct_AuthTokenTBE 573 +#define OBJ_setct_AuthTokenTBE OBJ_set_ctype,55L + +#define SN_setct_CapTokenTBE "setct-CapTokenTBE" +#define NID_setct_CapTokenTBE 574 +#define OBJ_setct_CapTokenTBE OBJ_set_ctype,56L + +#define SN_setct_CapTokenTBEX "setct-CapTokenTBEX" +#define NID_setct_CapTokenTBEX 575 +#define OBJ_setct_CapTokenTBEX OBJ_set_ctype,57L + +#define SN_setct_AcqCardCodeMsgTBE "setct-AcqCardCodeMsgTBE" +#define NID_setct_AcqCardCodeMsgTBE 576 +#define OBJ_setct_AcqCardCodeMsgTBE OBJ_set_ctype,58L + +#define SN_setct_AuthRevReqTBE "setct-AuthRevReqTBE" +#define NID_setct_AuthRevReqTBE 577 +#define OBJ_setct_AuthRevReqTBE OBJ_set_ctype,59L + +#define SN_setct_AuthRevResTBE "setct-AuthRevResTBE" +#define NID_setct_AuthRevResTBE 578 +#define OBJ_setct_AuthRevResTBE OBJ_set_ctype,60L + +#define SN_setct_AuthRevResTBEB "setct-AuthRevResTBEB" +#define NID_setct_AuthRevResTBEB 579 +#define OBJ_setct_AuthRevResTBEB OBJ_set_ctype,61L + +#define SN_setct_CapReqTBE "setct-CapReqTBE" +#define NID_setct_CapReqTBE 580 +#define OBJ_setct_CapReqTBE OBJ_set_ctype,62L + +#define SN_setct_CapReqTBEX "setct-CapReqTBEX" +#define NID_setct_CapReqTBEX 581 +#define OBJ_setct_CapReqTBEX OBJ_set_ctype,63L + +#define SN_setct_CapResTBE "setct-CapResTBE" +#define NID_setct_CapResTBE 582 +#define OBJ_setct_CapResTBE OBJ_set_ctype,64L + +#define SN_setct_CapRevReqTBE "setct-CapRevReqTBE" +#define NID_setct_CapRevReqTBE 583 +#define OBJ_setct_CapRevReqTBE OBJ_set_ctype,65L + +#define SN_setct_CapRevReqTBEX "setct-CapRevReqTBEX" +#define NID_setct_CapRevReqTBEX 584 +#define OBJ_setct_CapRevReqTBEX OBJ_set_ctype,66L + +#define SN_setct_CapRevResTBE "setct-CapRevResTBE" +#define NID_setct_CapRevResTBE 585 +#define OBJ_setct_CapRevResTBE OBJ_set_ctype,67L + +#define SN_setct_CredReqTBE "setct-CredReqTBE" +#define NID_setct_CredReqTBE 586 +#define OBJ_setct_CredReqTBE OBJ_set_ctype,68L + +#define SN_setct_CredReqTBEX "setct-CredReqTBEX" +#define NID_setct_CredReqTBEX 587 +#define OBJ_setct_CredReqTBEX OBJ_set_ctype,69L + +#define SN_setct_CredResTBE "setct-CredResTBE" +#define NID_setct_CredResTBE 588 +#define OBJ_setct_CredResTBE OBJ_set_ctype,70L + +#define SN_setct_CredRevReqTBE "setct-CredRevReqTBE" +#define NID_setct_CredRevReqTBE 589 +#define OBJ_setct_CredRevReqTBE OBJ_set_ctype,71L + +#define SN_setct_CredRevReqTBEX "setct-CredRevReqTBEX" +#define NID_setct_CredRevReqTBEX 590 +#define OBJ_setct_CredRevReqTBEX OBJ_set_ctype,72L + +#define SN_setct_CredRevResTBE "setct-CredRevResTBE" +#define NID_setct_CredRevResTBE 591 +#define OBJ_setct_CredRevResTBE OBJ_set_ctype,73L + +#define SN_setct_BatchAdminReqTBE "setct-BatchAdminReqTBE" +#define NID_setct_BatchAdminReqTBE 592 +#define OBJ_setct_BatchAdminReqTBE OBJ_set_ctype,74L + +#define SN_setct_BatchAdminResTBE "setct-BatchAdminResTBE" +#define NID_setct_BatchAdminResTBE 593 +#define OBJ_setct_BatchAdminResTBE OBJ_set_ctype,75L + +#define SN_setct_RegFormReqTBE "setct-RegFormReqTBE" +#define NID_setct_RegFormReqTBE 594 +#define OBJ_setct_RegFormReqTBE OBJ_set_ctype,76L + +#define SN_setct_CertReqTBE "setct-CertReqTBE" +#define NID_setct_CertReqTBE 595 +#define OBJ_setct_CertReqTBE OBJ_set_ctype,77L + +#define SN_setct_CertReqTBEX "setct-CertReqTBEX" +#define NID_setct_CertReqTBEX 596 +#define OBJ_setct_CertReqTBEX OBJ_set_ctype,78L + +#define SN_setct_CertResTBE "setct-CertResTBE" +#define NID_setct_CertResTBE 597 +#define OBJ_setct_CertResTBE OBJ_set_ctype,79L + +#define SN_setct_CRLNotificationTBS "setct-CRLNotificationTBS" +#define NID_setct_CRLNotificationTBS 598 +#define OBJ_setct_CRLNotificationTBS OBJ_set_ctype,80L + +#define SN_setct_CRLNotificationResTBS "setct-CRLNotificationResTBS" +#define NID_setct_CRLNotificationResTBS 599 +#define OBJ_setct_CRLNotificationResTBS OBJ_set_ctype,81L + +#define SN_setct_BCIDistributionTBS "setct-BCIDistributionTBS" +#define NID_setct_BCIDistributionTBS 600 +#define OBJ_setct_BCIDistributionTBS OBJ_set_ctype,82L + +#define SN_setext_genCrypt "setext-genCrypt" +#define LN_setext_genCrypt "generic cryptogram" +#define NID_setext_genCrypt 601 +#define OBJ_setext_genCrypt OBJ_set_msgExt,1L + +#define SN_setext_miAuth "setext-miAuth" +#define LN_setext_miAuth "merchant initiated auth" +#define NID_setext_miAuth 602 +#define OBJ_setext_miAuth OBJ_set_msgExt,3L + +#define SN_setext_pinSecure "setext-pinSecure" +#define NID_setext_pinSecure 603 +#define OBJ_setext_pinSecure OBJ_set_msgExt,4L + +#define SN_setext_pinAny "setext-pinAny" +#define NID_setext_pinAny 604 +#define OBJ_setext_pinAny OBJ_set_msgExt,5L + +#define SN_setext_track2 "setext-track2" +#define NID_setext_track2 605 +#define OBJ_setext_track2 OBJ_set_msgExt,7L + +#define SN_setext_cv "setext-cv" +#define LN_setext_cv "additional verification" +#define NID_setext_cv 606 +#define OBJ_setext_cv OBJ_set_msgExt,8L + +#define SN_set_policy_root "set-policy-root" +#define NID_set_policy_root 607 +#define OBJ_set_policy_root OBJ_set_policy,0L + +#define SN_setCext_hashedRoot "setCext-hashedRoot" +#define NID_setCext_hashedRoot 608 +#define OBJ_setCext_hashedRoot OBJ_set_certExt,0L + +#define SN_setCext_certType "setCext-certType" +#define NID_setCext_certType 609 +#define OBJ_setCext_certType OBJ_set_certExt,1L + +#define SN_setCext_merchData "setCext-merchData" +#define NID_setCext_merchData 610 +#define OBJ_setCext_merchData OBJ_set_certExt,2L + +#define SN_setCext_cCertRequired "setCext-cCertRequired" +#define NID_setCext_cCertRequired 611 +#define OBJ_setCext_cCertRequired OBJ_set_certExt,3L + +#define SN_setCext_tunneling "setCext-tunneling" +#define NID_setCext_tunneling 612 +#define OBJ_setCext_tunneling OBJ_set_certExt,4L + +#define SN_setCext_setExt "setCext-setExt" +#define NID_setCext_setExt 613 +#define OBJ_setCext_setExt OBJ_set_certExt,5L + +#define SN_setCext_setQualf "setCext-setQualf" +#define NID_setCext_setQualf 614 +#define OBJ_setCext_setQualf OBJ_set_certExt,6L + +#define SN_setCext_PGWYcapabilities "setCext-PGWYcapabilities" +#define NID_setCext_PGWYcapabilities 615 +#define OBJ_setCext_PGWYcapabilities OBJ_set_certExt,7L + +#define SN_setCext_TokenIdentifier "setCext-TokenIdentifier" +#define NID_setCext_TokenIdentifier 616 +#define OBJ_setCext_TokenIdentifier OBJ_set_certExt,8L + +#define SN_setCext_Track2Data "setCext-Track2Data" +#define NID_setCext_Track2Data 617 +#define OBJ_setCext_Track2Data OBJ_set_certExt,9L + +#define SN_setCext_TokenType "setCext-TokenType" +#define NID_setCext_TokenType 618 +#define OBJ_setCext_TokenType OBJ_set_certExt,10L + +#define SN_setCext_IssuerCapabilities "setCext-IssuerCapabilities" +#define NID_setCext_IssuerCapabilities 619 +#define OBJ_setCext_IssuerCapabilities OBJ_set_certExt,11L + +#define SN_setAttr_Cert "setAttr-Cert" +#define NID_setAttr_Cert 620 +#define OBJ_setAttr_Cert OBJ_set_attr,0L + +#define SN_setAttr_PGWYcap "setAttr-PGWYcap" +#define LN_setAttr_PGWYcap "payment gateway capabilities" +#define NID_setAttr_PGWYcap 621 +#define OBJ_setAttr_PGWYcap OBJ_set_attr,1L + +#define SN_setAttr_TokenType "setAttr-TokenType" +#define NID_setAttr_TokenType 622 +#define OBJ_setAttr_TokenType OBJ_set_attr,2L + +#define SN_setAttr_IssCap "setAttr-IssCap" +#define LN_setAttr_IssCap "issuer capabilities" +#define NID_setAttr_IssCap 623 +#define OBJ_setAttr_IssCap OBJ_set_attr,3L + +#define SN_set_rootKeyThumb "set-rootKeyThumb" +#define NID_set_rootKeyThumb 624 +#define OBJ_set_rootKeyThumb OBJ_setAttr_Cert,0L + +#define SN_set_addPolicy "set-addPolicy" +#define NID_set_addPolicy 625 +#define OBJ_set_addPolicy OBJ_setAttr_Cert,1L + +#define SN_setAttr_Token_EMV "setAttr-Token-EMV" +#define NID_setAttr_Token_EMV 626 +#define OBJ_setAttr_Token_EMV OBJ_setAttr_TokenType,1L + +#define SN_setAttr_Token_B0Prime "setAttr-Token-B0Prime" +#define NID_setAttr_Token_B0Prime 627 +#define OBJ_setAttr_Token_B0Prime OBJ_setAttr_TokenType,2L + +#define SN_setAttr_IssCap_CVM "setAttr-IssCap-CVM" +#define NID_setAttr_IssCap_CVM 628 +#define OBJ_setAttr_IssCap_CVM OBJ_setAttr_IssCap,3L + +#define SN_setAttr_IssCap_T2 "setAttr-IssCap-T2" +#define NID_setAttr_IssCap_T2 629 +#define OBJ_setAttr_IssCap_T2 OBJ_setAttr_IssCap,4L + +#define SN_setAttr_IssCap_Sig "setAttr-IssCap-Sig" +#define NID_setAttr_IssCap_Sig 630 +#define OBJ_setAttr_IssCap_Sig OBJ_setAttr_IssCap,5L + +#define SN_setAttr_GenCryptgrm "setAttr-GenCryptgrm" +#define LN_setAttr_GenCryptgrm "generate cryptogram" +#define NID_setAttr_GenCryptgrm 631 +#define OBJ_setAttr_GenCryptgrm OBJ_setAttr_IssCap_CVM,1L + +#define SN_setAttr_T2Enc "setAttr-T2Enc" +#define LN_setAttr_T2Enc "encrypted track 2" +#define NID_setAttr_T2Enc 632 +#define OBJ_setAttr_T2Enc OBJ_setAttr_IssCap_T2,1L + +#define SN_setAttr_T2cleartxt "setAttr-T2cleartxt" +#define LN_setAttr_T2cleartxt "cleartext track 2" +#define NID_setAttr_T2cleartxt 633 +#define OBJ_setAttr_T2cleartxt OBJ_setAttr_IssCap_T2,2L + +#define SN_setAttr_TokICCsig "setAttr-TokICCsig" +#define LN_setAttr_TokICCsig "ICC or token signature" +#define NID_setAttr_TokICCsig 634 +#define OBJ_setAttr_TokICCsig OBJ_setAttr_IssCap_Sig,1L + +#define SN_setAttr_SecDevSig "setAttr-SecDevSig" +#define LN_setAttr_SecDevSig "secure device signature" +#define NID_setAttr_SecDevSig 635 +#define OBJ_setAttr_SecDevSig OBJ_setAttr_IssCap_Sig,2L + +#define SN_set_brand_IATA_ATA "set-brand-IATA-ATA" +#define NID_set_brand_IATA_ATA 636 +#define OBJ_set_brand_IATA_ATA OBJ_set_brand,1L + +#define SN_set_brand_Diners "set-brand-Diners" +#define NID_set_brand_Diners 637 +#define OBJ_set_brand_Diners OBJ_set_brand,30L + +#define SN_set_brand_AmericanExpress "set-brand-AmericanExpress" +#define NID_set_brand_AmericanExpress 638 +#define OBJ_set_brand_AmericanExpress OBJ_set_brand,34L + +#define SN_set_brand_JCB "set-brand-JCB" +#define NID_set_brand_JCB 639 +#define OBJ_set_brand_JCB OBJ_set_brand,35L + +#define SN_set_brand_Visa "set-brand-Visa" +#define NID_set_brand_Visa 640 +#define OBJ_set_brand_Visa OBJ_set_brand,4L + +#define SN_set_brand_MasterCard "set-brand-MasterCard" +#define NID_set_brand_MasterCard 641 +#define OBJ_set_brand_MasterCard OBJ_set_brand,5L + +#define SN_set_brand_Novus "set-brand-Novus" +#define NID_set_brand_Novus 642 +#define OBJ_set_brand_Novus OBJ_set_brand,6011L + +#define SN_des_cdmf "DES-CDMF" +#define LN_des_cdmf "des-cdmf" +#define NID_des_cdmf 643 +#define OBJ_des_cdmf OBJ_rsadsi,3L,10L + +#define SN_rsaOAEPEncryptionSET "rsaOAEPEncryptionSET" +#define NID_rsaOAEPEncryptionSET 644 +#define OBJ_rsaOAEPEncryptionSET OBJ_rsadsi,1L,1L,6L + +#define SN_ipsec3 "Oakley-EC2N-3" +#define LN_ipsec3 "ipsec3" +#define NID_ipsec3 749 + +#define SN_ipsec4 "Oakley-EC2N-4" +#define LN_ipsec4 "ipsec4" +#define NID_ipsec4 750 + +#define SN_whirlpool "whirlpool" +#define NID_whirlpool 804 +#define OBJ_whirlpool OBJ_iso,0L,10118L,3L,0L,55L + +#define SN_cryptopro "cryptopro" +#define NID_cryptopro 805 +#define OBJ_cryptopro OBJ_member_body,643L,2L,2L + +#define SN_cryptocom "cryptocom" +#define NID_cryptocom 806 +#define OBJ_cryptocom OBJ_member_body,643L,2L,9L + +#define SN_id_tc26 "id-tc26" +#define NID_id_tc26 974 +#define OBJ_id_tc26 OBJ_member_body,643L,7L,1L + +#define SN_id_GostR3411_94_with_GostR3410_2001 "id-GostR3411-94-with-GostR3410-2001" +#define LN_id_GostR3411_94_with_GostR3410_2001 "GOST R 34.11-94 with GOST R 34.10-2001" +#define NID_id_GostR3411_94_with_GostR3410_2001 807 +#define OBJ_id_GostR3411_94_with_GostR3410_2001 OBJ_cryptopro,3L + +#define SN_id_GostR3411_94_with_GostR3410_94 "id-GostR3411-94-with-GostR3410-94" +#define LN_id_GostR3411_94_with_GostR3410_94 "GOST R 34.11-94 with GOST R 34.10-94" +#define NID_id_GostR3411_94_with_GostR3410_94 808 +#define OBJ_id_GostR3411_94_with_GostR3410_94 OBJ_cryptopro,4L + +#define SN_id_GostR3411_94 "md_gost94" +#define LN_id_GostR3411_94 "GOST R 34.11-94" +#define NID_id_GostR3411_94 809 +#define OBJ_id_GostR3411_94 OBJ_cryptopro,9L + +#define SN_id_HMACGostR3411_94 "id-HMACGostR3411-94" +#define LN_id_HMACGostR3411_94 "HMAC GOST 34.11-94" +#define NID_id_HMACGostR3411_94 810 +#define OBJ_id_HMACGostR3411_94 OBJ_cryptopro,10L + +#define SN_id_GostR3410_2001 "gost2001" +#define LN_id_GostR3410_2001 "GOST R 34.10-2001" +#define NID_id_GostR3410_2001 811 +#define OBJ_id_GostR3410_2001 OBJ_cryptopro,19L + +#define SN_id_GostR3410_94 "gost94" +#define LN_id_GostR3410_94 "GOST R 34.10-94" +#define NID_id_GostR3410_94 812 +#define OBJ_id_GostR3410_94 OBJ_cryptopro,20L + +#define SN_id_Gost28147_89 "gost89" +#define LN_id_Gost28147_89 "GOST 28147-89" +#define NID_id_Gost28147_89 813 +#define OBJ_id_Gost28147_89 OBJ_cryptopro,21L + +#define SN_gost89_cnt "gost89-cnt" +#define NID_gost89_cnt 814 + +#define SN_gost89_cnt_12 "gost89-cnt-12" +#define NID_gost89_cnt_12 975 + +#define SN_gost89_cbc "gost89-cbc" +#define NID_gost89_cbc 1009 + +#define SN_gost89_ecb "gost89-ecb" +#define NID_gost89_ecb 1010 + +#define SN_gost89_ctr "gost89-ctr" +#define NID_gost89_ctr 1011 + +#define SN_id_Gost28147_89_MAC "gost-mac" +#define LN_id_Gost28147_89_MAC "GOST 28147-89 MAC" +#define NID_id_Gost28147_89_MAC 815 +#define OBJ_id_Gost28147_89_MAC OBJ_cryptopro,22L + +#define SN_gost_mac_12 "gost-mac-12" +#define NID_gost_mac_12 976 + +#define SN_id_GostR3411_94_prf "prf-gostr3411-94" +#define LN_id_GostR3411_94_prf "GOST R 34.11-94 PRF" +#define NID_id_GostR3411_94_prf 816 +#define OBJ_id_GostR3411_94_prf OBJ_cryptopro,23L + +#define SN_id_GostR3410_2001DH "id-GostR3410-2001DH" +#define LN_id_GostR3410_2001DH "GOST R 34.10-2001 DH" +#define NID_id_GostR3410_2001DH 817 +#define OBJ_id_GostR3410_2001DH OBJ_cryptopro,98L + +#define SN_id_GostR3410_94DH "id-GostR3410-94DH" +#define LN_id_GostR3410_94DH "GOST R 34.10-94 DH" +#define NID_id_GostR3410_94DH 818 +#define OBJ_id_GostR3410_94DH OBJ_cryptopro,99L + +#define SN_id_Gost28147_89_CryptoPro_KeyMeshing "id-Gost28147-89-CryptoPro-KeyMeshing" +#define NID_id_Gost28147_89_CryptoPro_KeyMeshing 819 +#define OBJ_id_Gost28147_89_CryptoPro_KeyMeshing OBJ_cryptopro,14L,1L + +#define SN_id_Gost28147_89_None_KeyMeshing "id-Gost28147-89-None-KeyMeshing" +#define NID_id_Gost28147_89_None_KeyMeshing 820 +#define OBJ_id_Gost28147_89_None_KeyMeshing OBJ_cryptopro,14L,0L + +#define SN_id_GostR3411_94_TestParamSet "id-GostR3411-94-TestParamSet" +#define NID_id_GostR3411_94_TestParamSet 821 +#define OBJ_id_GostR3411_94_TestParamSet OBJ_cryptopro,30L,0L + +#define SN_id_GostR3411_94_CryptoProParamSet "id-GostR3411-94-CryptoProParamSet" +#define NID_id_GostR3411_94_CryptoProParamSet 822 +#define OBJ_id_GostR3411_94_CryptoProParamSet OBJ_cryptopro,30L,1L + +#define SN_id_Gost28147_89_TestParamSet "id-Gost28147-89-TestParamSet" +#define NID_id_Gost28147_89_TestParamSet 823 +#define OBJ_id_Gost28147_89_TestParamSet OBJ_cryptopro,31L,0L + +#define SN_id_Gost28147_89_CryptoPro_A_ParamSet "id-Gost28147-89-CryptoPro-A-ParamSet" +#define NID_id_Gost28147_89_CryptoPro_A_ParamSet 824 +#define OBJ_id_Gost28147_89_CryptoPro_A_ParamSet OBJ_cryptopro,31L,1L + +#define SN_id_Gost28147_89_CryptoPro_B_ParamSet "id-Gost28147-89-CryptoPro-B-ParamSet" +#define NID_id_Gost28147_89_CryptoPro_B_ParamSet 825 +#define OBJ_id_Gost28147_89_CryptoPro_B_ParamSet OBJ_cryptopro,31L,2L + +#define SN_id_Gost28147_89_CryptoPro_C_ParamSet "id-Gost28147-89-CryptoPro-C-ParamSet" +#define NID_id_Gost28147_89_CryptoPro_C_ParamSet 826 +#define OBJ_id_Gost28147_89_CryptoPro_C_ParamSet OBJ_cryptopro,31L,3L + +#define SN_id_Gost28147_89_CryptoPro_D_ParamSet "id-Gost28147-89-CryptoPro-D-ParamSet" +#define NID_id_Gost28147_89_CryptoPro_D_ParamSet 827 +#define OBJ_id_Gost28147_89_CryptoPro_D_ParamSet OBJ_cryptopro,31L,4L + +#define SN_id_Gost28147_89_CryptoPro_Oscar_1_1_ParamSet "id-Gost28147-89-CryptoPro-Oscar-1-1-ParamSet" +#define NID_id_Gost28147_89_CryptoPro_Oscar_1_1_ParamSet 828 +#define OBJ_id_Gost28147_89_CryptoPro_Oscar_1_1_ParamSet OBJ_cryptopro,31L,5L + +#define SN_id_Gost28147_89_CryptoPro_Oscar_1_0_ParamSet "id-Gost28147-89-CryptoPro-Oscar-1-0-ParamSet" +#define NID_id_Gost28147_89_CryptoPro_Oscar_1_0_ParamSet 829 +#define OBJ_id_Gost28147_89_CryptoPro_Oscar_1_0_ParamSet OBJ_cryptopro,31L,6L + +#define SN_id_Gost28147_89_CryptoPro_RIC_1_ParamSet "id-Gost28147-89-CryptoPro-RIC-1-ParamSet" +#define NID_id_Gost28147_89_CryptoPro_RIC_1_ParamSet 830 +#define OBJ_id_Gost28147_89_CryptoPro_RIC_1_ParamSet OBJ_cryptopro,31L,7L + +#define SN_id_GostR3410_94_TestParamSet "id-GostR3410-94-TestParamSet" +#define NID_id_GostR3410_94_TestParamSet 831 +#define OBJ_id_GostR3410_94_TestParamSet OBJ_cryptopro,32L,0L + +#define SN_id_GostR3410_94_CryptoPro_A_ParamSet "id-GostR3410-94-CryptoPro-A-ParamSet" +#define NID_id_GostR3410_94_CryptoPro_A_ParamSet 832 +#define OBJ_id_GostR3410_94_CryptoPro_A_ParamSet OBJ_cryptopro,32L,2L + +#define SN_id_GostR3410_94_CryptoPro_B_ParamSet "id-GostR3410-94-CryptoPro-B-ParamSet" +#define NID_id_GostR3410_94_CryptoPro_B_ParamSet 833 +#define OBJ_id_GostR3410_94_CryptoPro_B_ParamSet OBJ_cryptopro,32L,3L + +#define SN_id_GostR3410_94_CryptoPro_C_ParamSet "id-GostR3410-94-CryptoPro-C-ParamSet" +#define NID_id_GostR3410_94_CryptoPro_C_ParamSet 834 +#define OBJ_id_GostR3410_94_CryptoPro_C_ParamSet OBJ_cryptopro,32L,4L + +#define SN_id_GostR3410_94_CryptoPro_D_ParamSet "id-GostR3410-94-CryptoPro-D-ParamSet" +#define NID_id_GostR3410_94_CryptoPro_D_ParamSet 835 +#define OBJ_id_GostR3410_94_CryptoPro_D_ParamSet OBJ_cryptopro,32L,5L + +#define SN_id_GostR3410_94_CryptoPro_XchA_ParamSet "id-GostR3410-94-CryptoPro-XchA-ParamSet" +#define NID_id_GostR3410_94_CryptoPro_XchA_ParamSet 836 +#define OBJ_id_GostR3410_94_CryptoPro_XchA_ParamSet OBJ_cryptopro,33L,1L + +#define SN_id_GostR3410_94_CryptoPro_XchB_ParamSet "id-GostR3410-94-CryptoPro-XchB-ParamSet" +#define NID_id_GostR3410_94_CryptoPro_XchB_ParamSet 837 +#define OBJ_id_GostR3410_94_CryptoPro_XchB_ParamSet OBJ_cryptopro,33L,2L + +#define SN_id_GostR3410_94_CryptoPro_XchC_ParamSet "id-GostR3410-94-CryptoPro-XchC-ParamSet" +#define NID_id_GostR3410_94_CryptoPro_XchC_ParamSet 838 +#define OBJ_id_GostR3410_94_CryptoPro_XchC_ParamSet OBJ_cryptopro,33L,3L + +#define SN_id_GostR3410_2001_TestParamSet "id-GostR3410-2001-TestParamSet" +#define NID_id_GostR3410_2001_TestParamSet 839 +#define OBJ_id_GostR3410_2001_TestParamSet OBJ_cryptopro,35L,0L + +#define SN_id_GostR3410_2001_CryptoPro_A_ParamSet "id-GostR3410-2001-CryptoPro-A-ParamSet" +#define NID_id_GostR3410_2001_CryptoPro_A_ParamSet 840 +#define OBJ_id_GostR3410_2001_CryptoPro_A_ParamSet OBJ_cryptopro,35L,1L + +#define SN_id_GostR3410_2001_CryptoPro_B_ParamSet "id-GostR3410-2001-CryptoPro-B-ParamSet" +#define NID_id_GostR3410_2001_CryptoPro_B_ParamSet 841 +#define OBJ_id_GostR3410_2001_CryptoPro_B_ParamSet OBJ_cryptopro,35L,2L + +#define SN_id_GostR3410_2001_CryptoPro_C_ParamSet "id-GostR3410-2001-CryptoPro-C-ParamSet" +#define NID_id_GostR3410_2001_CryptoPro_C_ParamSet 842 +#define OBJ_id_GostR3410_2001_CryptoPro_C_ParamSet OBJ_cryptopro,35L,3L + +#define SN_id_GostR3410_2001_CryptoPro_XchA_ParamSet "id-GostR3410-2001-CryptoPro-XchA-ParamSet" +#define NID_id_GostR3410_2001_CryptoPro_XchA_ParamSet 843 +#define OBJ_id_GostR3410_2001_CryptoPro_XchA_ParamSet OBJ_cryptopro,36L,0L + +#define SN_id_GostR3410_2001_CryptoPro_XchB_ParamSet "id-GostR3410-2001-CryptoPro-XchB-ParamSet" +#define NID_id_GostR3410_2001_CryptoPro_XchB_ParamSet 844 +#define OBJ_id_GostR3410_2001_CryptoPro_XchB_ParamSet OBJ_cryptopro,36L,1L + +#define SN_id_GostR3410_94_a "id-GostR3410-94-a" +#define NID_id_GostR3410_94_a 845 +#define OBJ_id_GostR3410_94_a OBJ_id_GostR3410_94,1L + +#define SN_id_GostR3410_94_aBis "id-GostR3410-94-aBis" +#define NID_id_GostR3410_94_aBis 846 +#define OBJ_id_GostR3410_94_aBis OBJ_id_GostR3410_94,2L + +#define SN_id_GostR3410_94_b "id-GostR3410-94-b" +#define NID_id_GostR3410_94_b 847 +#define OBJ_id_GostR3410_94_b OBJ_id_GostR3410_94,3L + +#define SN_id_GostR3410_94_bBis "id-GostR3410-94-bBis" +#define NID_id_GostR3410_94_bBis 848 +#define OBJ_id_GostR3410_94_bBis OBJ_id_GostR3410_94,4L + +#define SN_id_Gost28147_89_cc "id-Gost28147-89-cc" +#define LN_id_Gost28147_89_cc "GOST 28147-89 Cryptocom ParamSet" +#define NID_id_Gost28147_89_cc 849 +#define OBJ_id_Gost28147_89_cc OBJ_cryptocom,1L,6L,1L + +#define SN_id_GostR3410_94_cc "gost94cc" +#define LN_id_GostR3410_94_cc "GOST 34.10-94 Cryptocom" +#define NID_id_GostR3410_94_cc 850 +#define OBJ_id_GostR3410_94_cc OBJ_cryptocom,1L,5L,3L + +#define SN_id_GostR3410_2001_cc "gost2001cc" +#define LN_id_GostR3410_2001_cc "GOST 34.10-2001 Cryptocom" +#define NID_id_GostR3410_2001_cc 851 +#define OBJ_id_GostR3410_2001_cc OBJ_cryptocom,1L,5L,4L + +#define SN_id_GostR3411_94_with_GostR3410_94_cc "id-GostR3411-94-with-GostR3410-94-cc" +#define LN_id_GostR3411_94_with_GostR3410_94_cc "GOST R 34.11-94 with GOST R 34.10-94 Cryptocom" +#define NID_id_GostR3411_94_with_GostR3410_94_cc 852 +#define OBJ_id_GostR3411_94_with_GostR3410_94_cc OBJ_cryptocom,1L,3L,3L + +#define SN_id_GostR3411_94_with_GostR3410_2001_cc "id-GostR3411-94-with-GostR3410-2001-cc" +#define LN_id_GostR3411_94_with_GostR3410_2001_cc "GOST R 34.11-94 with GOST R 34.10-2001 Cryptocom" +#define NID_id_GostR3411_94_with_GostR3410_2001_cc 853 +#define OBJ_id_GostR3411_94_with_GostR3410_2001_cc OBJ_cryptocom,1L,3L,4L + +#define SN_id_GostR3410_2001_ParamSet_cc "id-GostR3410-2001-ParamSet-cc" +#define LN_id_GostR3410_2001_ParamSet_cc "GOST R 3410-2001 Parameter Set Cryptocom" +#define NID_id_GostR3410_2001_ParamSet_cc 854 +#define OBJ_id_GostR3410_2001_ParamSet_cc OBJ_cryptocom,1L,8L,1L + +#define SN_id_tc26_algorithms "id-tc26-algorithms" +#define NID_id_tc26_algorithms 977 +#define OBJ_id_tc26_algorithms OBJ_id_tc26,1L + +#define SN_id_tc26_sign "id-tc26-sign" +#define NID_id_tc26_sign 978 +#define OBJ_id_tc26_sign OBJ_id_tc26_algorithms,1L + +#define SN_id_GostR3410_2012_256 "gost2012_256" +#define LN_id_GostR3410_2012_256 "GOST R 34.10-2012 with 256 bit modulus" +#define NID_id_GostR3410_2012_256 979 +#define OBJ_id_GostR3410_2012_256 OBJ_id_tc26_sign,1L + +#define SN_id_GostR3410_2012_512 "gost2012_512" +#define LN_id_GostR3410_2012_512 "GOST R 34.10-2012 with 512 bit modulus" +#define NID_id_GostR3410_2012_512 980 +#define OBJ_id_GostR3410_2012_512 OBJ_id_tc26_sign,2L + +#define SN_id_tc26_digest "id-tc26-digest" +#define NID_id_tc26_digest 981 +#define OBJ_id_tc26_digest OBJ_id_tc26_algorithms,2L + +#define SN_id_GostR3411_2012_256 "md_gost12_256" +#define LN_id_GostR3411_2012_256 "GOST R 34.11-2012 with 256 bit hash" +#define NID_id_GostR3411_2012_256 982 +#define OBJ_id_GostR3411_2012_256 OBJ_id_tc26_digest,2L + +#define SN_id_GostR3411_2012_512 "md_gost12_512" +#define LN_id_GostR3411_2012_512 "GOST R 34.11-2012 with 512 bit hash" +#define NID_id_GostR3411_2012_512 983 +#define OBJ_id_GostR3411_2012_512 OBJ_id_tc26_digest,3L + +#define SN_id_tc26_signwithdigest "id-tc26-signwithdigest" +#define NID_id_tc26_signwithdigest 984 +#define OBJ_id_tc26_signwithdigest OBJ_id_tc26_algorithms,3L + +#define SN_id_tc26_signwithdigest_gost3410_2012_256 "id-tc26-signwithdigest-gost3410-2012-256" +#define LN_id_tc26_signwithdigest_gost3410_2012_256 "GOST R 34.10-2012 with GOST R 34.11-2012 (256 bit)" +#define NID_id_tc26_signwithdigest_gost3410_2012_256 985 +#define OBJ_id_tc26_signwithdigest_gost3410_2012_256 OBJ_id_tc26_signwithdigest,2L + +#define SN_id_tc26_signwithdigest_gost3410_2012_512 "id-tc26-signwithdigest-gost3410-2012-512" +#define LN_id_tc26_signwithdigest_gost3410_2012_512 "GOST R 34.10-2012 with GOST R 34.11-2012 (512 bit)" +#define NID_id_tc26_signwithdigest_gost3410_2012_512 986 +#define OBJ_id_tc26_signwithdigest_gost3410_2012_512 OBJ_id_tc26_signwithdigest,3L + +#define SN_id_tc26_mac "id-tc26-mac" +#define NID_id_tc26_mac 987 +#define OBJ_id_tc26_mac OBJ_id_tc26_algorithms,4L + +#define SN_id_tc26_hmac_gost_3411_2012_256 "id-tc26-hmac-gost-3411-2012-256" +#define LN_id_tc26_hmac_gost_3411_2012_256 "HMAC GOST 34.11-2012 256 bit" +#define NID_id_tc26_hmac_gost_3411_2012_256 988 +#define OBJ_id_tc26_hmac_gost_3411_2012_256 OBJ_id_tc26_mac,1L + +#define SN_id_tc26_hmac_gost_3411_2012_512 "id-tc26-hmac-gost-3411-2012-512" +#define LN_id_tc26_hmac_gost_3411_2012_512 "HMAC GOST 34.11-2012 512 bit" +#define NID_id_tc26_hmac_gost_3411_2012_512 989 +#define OBJ_id_tc26_hmac_gost_3411_2012_512 OBJ_id_tc26_mac,2L + +#define SN_id_tc26_cipher "id-tc26-cipher" +#define NID_id_tc26_cipher 990 +#define OBJ_id_tc26_cipher OBJ_id_tc26_algorithms,5L + +#define SN_id_tc26_cipher_gostr3412_2015_magma "id-tc26-cipher-gostr3412-2015-magma" +#define NID_id_tc26_cipher_gostr3412_2015_magma 1173 +#define OBJ_id_tc26_cipher_gostr3412_2015_magma OBJ_id_tc26_cipher,1L + +#define SN_id_tc26_cipher_gostr3412_2015_magma_ctracpkm "id-tc26-cipher-gostr3412-2015-magma-ctracpkm" +#define NID_id_tc26_cipher_gostr3412_2015_magma_ctracpkm 1174 +#define OBJ_id_tc26_cipher_gostr3412_2015_magma_ctracpkm OBJ_id_tc26_cipher_gostr3412_2015_magma,1L + +#define SN_id_tc26_cipher_gostr3412_2015_magma_ctracpkm_omac "id-tc26-cipher-gostr3412-2015-magma-ctracpkm-omac" +#define NID_id_tc26_cipher_gostr3412_2015_magma_ctracpkm_omac 1175 +#define OBJ_id_tc26_cipher_gostr3412_2015_magma_ctracpkm_omac OBJ_id_tc26_cipher_gostr3412_2015_magma,2L + +#define SN_id_tc26_cipher_gostr3412_2015_kuznyechik "id-tc26-cipher-gostr3412-2015-kuznyechik" +#define NID_id_tc26_cipher_gostr3412_2015_kuznyechik 1176 +#define OBJ_id_tc26_cipher_gostr3412_2015_kuznyechik OBJ_id_tc26_cipher,2L + +#define SN_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm "id-tc26-cipher-gostr3412-2015-kuznyechik-ctracpkm" +#define NID_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm 1177 +#define OBJ_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm OBJ_id_tc26_cipher_gostr3412_2015_kuznyechik,1L + +#define SN_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm_omac "id-tc26-cipher-gostr3412-2015-kuznyechik-ctracpkm-omac" +#define NID_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm_omac 1178 +#define OBJ_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm_omac OBJ_id_tc26_cipher_gostr3412_2015_kuznyechik,2L + +#define SN_id_tc26_agreement "id-tc26-agreement" +#define NID_id_tc26_agreement 991 +#define OBJ_id_tc26_agreement OBJ_id_tc26_algorithms,6L + +#define SN_id_tc26_agreement_gost_3410_2012_256 "id-tc26-agreement-gost-3410-2012-256" +#define NID_id_tc26_agreement_gost_3410_2012_256 992 +#define OBJ_id_tc26_agreement_gost_3410_2012_256 OBJ_id_tc26_agreement,1L + +#define SN_id_tc26_agreement_gost_3410_2012_512 "id-tc26-agreement-gost-3410-2012-512" +#define NID_id_tc26_agreement_gost_3410_2012_512 993 +#define OBJ_id_tc26_agreement_gost_3410_2012_512 OBJ_id_tc26_agreement,2L + +#define SN_id_tc26_wrap "id-tc26-wrap" +#define NID_id_tc26_wrap 1179 +#define OBJ_id_tc26_wrap OBJ_id_tc26_algorithms,7L + +#define SN_id_tc26_wrap_gostr3412_2015_magma "id-tc26-wrap-gostr3412-2015-magma" +#define NID_id_tc26_wrap_gostr3412_2015_magma 1180 +#define OBJ_id_tc26_wrap_gostr3412_2015_magma OBJ_id_tc26_wrap,1L + +#define SN_id_tc26_wrap_gostr3412_2015_magma_kexp15 "id-tc26-wrap-gostr3412-2015-magma-kexp15" +#define NID_id_tc26_wrap_gostr3412_2015_magma_kexp15 1181 +#define OBJ_id_tc26_wrap_gostr3412_2015_magma_kexp15 OBJ_id_tc26_wrap_gostr3412_2015_magma,1L + +#define SN_id_tc26_wrap_gostr3412_2015_kuznyechik "id-tc26-wrap-gostr3412-2015-kuznyechik" +#define NID_id_tc26_wrap_gostr3412_2015_kuznyechik 1182 +#define OBJ_id_tc26_wrap_gostr3412_2015_kuznyechik OBJ_id_tc26_wrap,2L + +#define SN_id_tc26_wrap_gostr3412_2015_kuznyechik_kexp15 "id-tc26-wrap-gostr3412-2015-kuznyechik-kexp15" +#define NID_id_tc26_wrap_gostr3412_2015_kuznyechik_kexp15 1183 +#define OBJ_id_tc26_wrap_gostr3412_2015_kuznyechik_kexp15 OBJ_id_tc26_wrap_gostr3412_2015_kuznyechik,1L + +#define SN_id_tc26_constants "id-tc26-constants" +#define NID_id_tc26_constants 994 +#define OBJ_id_tc26_constants OBJ_id_tc26,2L + +#define SN_id_tc26_sign_constants "id-tc26-sign-constants" +#define NID_id_tc26_sign_constants 995 +#define OBJ_id_tc26_sign_constants OBJ_id_tc26_constants,1L + +#define SN_id_tc26_gost_3410_2012_256_constants "id-tc26-gost-3410-2012-256-constants" +#define NID_id_tc26_gost_3410_2012_256_constants 1147 +#define OBJ_id_tc26_gost_3410_2012_256_constants OBJ_id_tc26_sign_constants,1L + +#define SN_id_tc26_gost_3410_2012_256_paramSetA "id-tc26-gost-3410-2012-256-paramSetA" +#define LN_id_tc26_gost_3410_2012_256_paramSetA "GOST R 34.10-2012 (256 bit) ParamSet A" +#define NID_id_tc26_gost_3410_2012_256_paramSetA 1148 +#define OBJ_id_tc26_gost_3410_2012_256_paramSetA OBJ_id_tc26_gost_3410_2012_256_constants,1L + +#define SN_id_tc26_gost_3410_2012_256_paramSetB "id-tc26-gost-3410-2012-256-paramSetB" +#define LN_id_tc26_gost_3410_2012_256_paramSetB "GOST R 34.10-2012 (256 bit) ParamSet B" +#define NID_id_tc26_gost_3410_2012_256_paramSetB 1184 +#define OBJ_id_tc26_gost_3410_2012_256_paramSetB OBJ_id_tc26_gost_3410_2012_256_constants,2L + +#define SN_id_tc26_gost_3410_2012_256_paramSetC "id-tc26-gost-3410-2012-256-paramSetC" +#define LN_id_tc26_gost_3410_2012_256_paramSetC "GOST R 34.10-2012 (256 bit) ParamSet C" +#define NID_id_tc26_gost_3410_2012_256_paramSetC 1185 +#define OBJ_id_tc26_gost_3410_2012_256_paramSetC OBJ_id_tc26_gost_3410_2012_256_constants,3L + +#define SN_id_tc26_gost_3410_2012_256_paramSetD "id-tc26-gost-3410-2012-256-paramSetD" +#define LN_id_tc26_gost_3410_2012_256_paramSetD "GOST R 34.10-2012 (256 bit) ParamSet D" +#define NID_id_tc26_gost_3410_2012_256_paramSetD 1186 +#define OBJ_id_tc26_gost_3410_2012_256_paramSetD OBJ_id_tc26_gost_3410_2012_256_constants,4L + +#define SN_id_tc26_gost_3410_2012_512_constants "id-tc26-gost-3410-2012-512-constants" +#define NID_id_tc26_gost_3410_2012_512_constants 996 +#define OBJ_id_tc26_gost_3410_2012_512_constants OBJ_id_tc26_sign_constants,2L + +#define SN_id_tc26_gost_3410_2012_512_paramSetTest "id-tc26-gost-3410-2012-512-paramSetTest" +#define LN_id_tc26_gost_3410_2012_512_paramSetTest "GOST R 34.10-2012 (512 bit) testing parameter set" +#define NID_id_tc26_gost_3410_2012_512_paramSetTest 997 +#define OBJ_id_tc26_gost_3410_2012_512_paramSetTest OBJ_id_tc26_gost_3410_2012_512_constants,0L + +#define SN_id_tc26_gost_3410_2012_512_paramSetA "id-tc26-gost-3410-2012-512-paramSetA" +#define LN_id_tc26_gost_3410_2012_512_paramSetA "GOST R 34.10-2012 (512 bit) ParamSet A" +#define NID_id_tc26_gost_3410_2012_512_paramSetA 998 +#define OBJ_id_tc26_gost_3410_2012_512_paramSetA OBJ_id_tc26_gost_3410_2012_512_constants,1L + +#define SN_id_tc26_gost_3410_2012_512_paramSetB "id-tc26-gost-3410-2012-512-paramSetB" +#define LN_id_tc26_gost_3410_2012_512_paramSetB "GOST R 34.10-2012 (512 bit) ParamSet B" +#define NID_id_tc26_gost_3410_2012_512_paramSetB 999 +#define OBJ_id_tc26_gost_3410_2012_512_paramSetB OBJ_id_tc26_gost_3410_2012_512_constants,2L + +#define SN_id_tc26_gost_3410_2012_512_paramSetC "id-tc26-gost-3410-2012-512-paramSetC" +#define LN_id_tc26_gost_3410_2012_512_paramSetC "GOST R 34.10-2012 (512 bit) ParamSet C" +#define NID_id_tc26_gost_3410_2012_512_paramSetC 1149 +#define OBJ_id_tc26_gost_3410_2012_512_paramSetC OBJ_id_tc26_gost_3410_2012_512_constants,3L + +#define SN_id_tc26_digest_constants "id-tc26-digest-constants" +#define NID_id_tc26_digest_constants 1000 +#define OBJ_id_tc26_digest_constants OBJ_id_tc26_constants,2L + +#define SN_id_tc26_cipher_constants "id-tc26-cipher-constants" +#define NID_id_tc26_cipher_constants 1001 +#define OBJ_id_tc26_cipher_constants OBJ_id_tc26_constants,5L + +#define SN_id_tc26_gost_28147_constants "id-tc26-gost-28147-constants" +#define NID_id_tc26_gost_28147_constants 1002 +#define OBJ_id_tc26_gost_28147_constants OBJ_id_tc26_cipher_constants,1L + +#define SN_id_tc26_gost_28147_param_Z "id-tc26-gost-28147-param-Z" +#define LN_id_tc26_gost_28147_param_Z "GOST 28147-89 TC26 parameter set" +#define NID_id_tc26_gost_28147_param_Z 1003 +#define OBJ_id_tc26_gost_28147_param_Z OBJ_id_tc26_gost_28147_constants,1L + +#define SN_INN "INN" +#define LN_INN "INN" +#define NID_INN 1004 +#define OBJ_INN OBJ_member_body,643L,3L,131L,1L,1L + +#define SN_OGRN "OGRN" +#define LN_OGRN "OGRN" +#define NID_OGRN 1005 +#define OBJ_OGRN OBJ_member_body,643L,100L,1L + +#define SN_SNILS "SNILS" +#define LN_SNILS "SNILS" +#define NID_SNILS 1006 +#define OBJ_SNILS OBJ_member_body,643L,100L,3L + +#define SN_subjectSignTool "subjectSignTool" +#define LN_subjectSignTool "Signing Tool of Subject" +#define NID_subjectSignTool 1007 +#define OBJ_subjectSignTool OBJ_member_body,643L,100L,111L + +#define SN_issuerSignTool "issuerSignTool" +#define LN_issuerSignTool "Signing Tool of Issuer" +#define NID_issuerSignTool 1008 +#define OBJ_issuerSignTool OBJ_member_body,643L,100L,112L + +#define SN_grasshopper_ecb "grasshopper-ecb" +#define NID_grasshopper_ecb 1012 + +#define SN_grasshopper_ctr "grasshopper-ctr" +#define NID_grasshopper_ctr 1013 + +#define SN_grasshopper_ofb "grasshopper-ofb" +#define NID_grasshopper_ofb 1014 + +#define SN_grasshopper_cbc "grasshopper-cbc" +#define NID_grasshopper_cbc 1015 + +#define SN_grasshopper_cfb "grasshopper-cfb" +#define NID_grasshopper_cfb 1016 + +#define SN_grasshopper_mac "grasshopper-mac" +#define NID_grasshopper_mac 1017 + +#define SN_magma_ecb "magma-ecb" +#define NID_magma_ecb 1187 + +#define SN_magma_ctr "magma-ctr" +#define NID_magma_ctr 1188 + +#define SN_magma_ofb "magma-ofb" +#define NID_magma_ofb 1189 + +#define SN_magma_cbc "magma-cbc" +#define NID_magma_cbc 1190 + +#define SN_magma_cfb "magma-cfb" +#define NID_magma_cfb 1191 + +#define SN_magma_mac "magma-mac" +#define NID_magma_mac 1192 + +#define SN_camellia_128_cbc "CAMELLIA-128-CBC" +#define LN_camellia_128_cbc "camellia-128-cbc" +#define NID_camellia_128_cbc 751 +#define OBJ_camellia_128_cbc 1L,2L,392L,200011L,61L,1L,1L,1L,2L + +#define SN_camellia_192_cbc "CAMELLIA-192-CBC" +#define LN_camellia_192_cbc "camellia-192-cbc" +#define NID_camellia_192_cbc 752 +#define OBJ_camellia_192_cbc 1L,2L,392L,200011L,61L,1L,1L,1L,3L + +#define SN_camellia_256_cbc "CAMELLIA-256-CBC" +#define LN_camellia_256_cbc "camellia-256-cbc" +#define NID_camellia_256_cbc 753 +#define OBJ_camellia_256_cbc 1L,2L,392L,200011L,61L,1L,1L,1L,4L + +#define SN_id_camellia128_wrap "id-camellia128-wrap" +#define NID_id_camellia128_wrap 907 +#define OBJ_id_camellia128_wrap 1L,2L,392L,200011L,61L,1L,1L,3L,2L + +#define SN_id_camellia192_wrap "id-camellia192-wrap" +#define NID_id_camellia192_wrap 908 +#define OBJ_id_camellia192_wrap 1L,2L,392L,200011L,61L,1L,1L,3L,3L + +#define SN_id_camellia256_wrap "id-camellia256-wrap" +#define NID_id_camellia256_wrap 909 +#define OBJ_id_camellia256_wrap 1L,2L,392L,200011L,61L,1L,1L,3L,4L + +#define OBJ_ntt_ds 0L,3L,4401L,5L + +#define OBJ_camellia OBJ_ntt_ds,3L,1L,9L + +#define SN_camellia_128_ecb "CAMELLIA-128-ECB" +#define LN_camellia_128_ecb "camellia-128-ecb" +#define NID_camellia_128_ecb 754 +#define OBJ_camellia_128_ecb OBJ_camellia,1L + +#define SN_camellia_128_ofb128 "CAMELLIA-128-OFB" +#define LN_camellia_128_ofb128 "camellia-128-ofb" +#define NID_camellia_128_ofb128 766 +#define OBJ_camellia_128_ofb128 OBJ_camellia,3L + +#define SN_camellia_128_cfb128 "CAMELLIA-128-CFB" +#define LN_camellia_128_cfb128 "camellia-128-cfb" +#define NID_camellia_128_cfb128 757 +#define OBJ_camellia_128_cfb128 OBJ_camellia,4L + +#define SN_camellia_128_gcm "CAMELLIA-128-GCM" +#define LN_camellia_128_gcm "camellia-128-gcm" +#define NID_camellia_128_gcm 961 +#define OBJ_camellia_128_gcm OBJ_camellia,6L + +#define SN_camellia_128_ccm "CAMELLIA-128-CCM" +#define LN_camellia_128_ccm "camellia-128-ccm" +#define NID_camellia_128_ccm 962 +#define OBJ_camellia_128_ccm OBJ_camellia,7L + +#define SN_camellia_128_ctr "CAMELLIA-128-CTR" +#define LN_camellia_128_ctr "camellia-128-ctr" +#define NID_camellia_128_ctr 963 +#define OBJ_camellia_128_ctr OBJ_camellia,9L + +#define SN_camellia_128_cmac "CAMELLIA-128-CMAC" +#define LN_camellia_128_cmac "camellia-128-cmac" +#define NID_camellia_128_cmac 964 +#define OBJ_camellia_128_cmac OBJ_camellia,10L + +#define SN_camellia_192_ecb "CAMELLIA-192-ECB" +#define LN_camellia_192_ecb "camellia-192-ecb" +#define NID_camellia_192_ecb 755 +#define OBJ_camellia_192_ecb OBJ_camellia,21L + +#define SN_camellia_192_ofb128 "CAMELLIA-192-OFB" +#define LN_camellia_192_ofb128 "camellia-192-ofb" +#define NID_camellia_192_ofb128 767 +#define OBJ_camellia_192_ofb128 OBJ_camellia,23L + +#define SN_camellia_192_cfb128 "CAMELLIA-192-CFB" +#define LN_camellia_192_cfb128 "camellia-192-cfb" +#define NID_camellia_192_cfb128 758 +#define OBJ_camellia_192_cfb128 OBJ_camellia,24L + +#define SN_camellia_192_gcm "CAMELLIA-192-GCM" +#define LN_camellia_192_gcm "camellia-192-gcm" +#define NID_camellia_192_gcm 965 +#define OBJ_camellia_192_gcm OBJ_camellia,26L + +#define SN_camellia_192_ccm "CAMELLIA-192-CCM" +#define LN_camellia_192_ccm "camellia-192-ccm" +#define NID_camellia_192_ccm 966 +#define OBJ_camellia_192_ccm OBJ_camellia,27L + +#define SN_camellia_192_ctr "CAMELLIA-192-CTR" +#define LN_camellia_192_ctr "camellia-192-ctr" +#define NID_camellia_192_ctr 967 +#define OBJ_camellia_192_ctr OBJ_camellia,29L + +#define SN_camellia_192_cmac "CAMELLIA-192-CMAC" +#define LN_camellia_192_cmac "camellia-192-cmac" +#define NID_camellia_192_cmac 968 +#define OBJ_camellia_192_cmac OBJ_camellia,30L + +#define SN_camellia_256_ecb "CAMELLIA-256-ECB" +#define LN_camellia_256_ecb "camellia-256-ecb" +#define NID_camellia_256_ecb 756 +#define OBJ_camellia_256_ecb OBJ_camellia,41L + +#define SN_camellia_256_ofb128 "CAMELLIA-256-OFB" +#define LN_camellia_256_ofb128 "camellia-256-ofb" +#define NID_camellia_256_ofb128 768 +#define OBJ_camellia_256_ofb128 OBJ_camellia,43L + +#define SN_camellia_256_cfb128 "CAMELLIA-256-CFB" +#define LN_camellia_256_cfb128 "camellia-256-cfb" +#define NID_camellia_256_cfb128 759 +#define OBJ_camellia_256_cfb128 OBJ_camellia,44L + +#define SN_camellia_256_gcm "CAMELLIA-256-GCM" +#define LN_camellia_256_gcm "camellia-256-gcm" +#define NID_camellia_256_gcm 969 +#define OBJ_camellia_256_gcm OBJ_camellia,46L + +#define SN_camellia_256_ccm "CAMELLIA-256-CCM" +#define LN_camellia_256_ccm "camellia-256-ccm" +#define NID_camellia_256_ccm 970 +#define OBJ_camellia_256_ccm OBJ_camellia,47L + +#define SN_camellia_256_ctr "CAMELLIA-256-CTR" +#define LN_camellia_256_ctr "camellia-256-ctr" +#define NID_camellia_256_ctr 971 +#define OBJ_camellia_256_ctr OBJ_camellia,49L + +#define SN_camellia_256_cmac "CAMELLIA-256-CMAC" +#define LN_camellia_256_cmac "camellia-256-cmac" +#define NID_camellia_256_cmac 972 +#define OBJ_camellia_256_cmac OBJ_camellia,50L + +#define SN_camellia_128_cfb1 "CAMELLIA-128-CFB1" +#define LN_camellia_128_cfb1 "camellia-128-cfb1" +#define NID_camellia_128_cfb1 760 + +#define SN_camellia_192_cfb1 "CAMELLIA-192-CFB1" +#define LN_camellia_192_cfb1 "camellia-192-cfb1" +#define NID_camellia_192_cfb1 761 + +#define SN_camellia_256_cfb1 "CAMELLIA-256-CFB1" +#define LN_camellia_256_cfb1 "camellia-256-cfb1" +#define NID_camellia_256_cfb1 762 + +#define SN_camellia_128_cfb8 "CAMELLIA-128-CFB8" +#define LN_camellia_128_cfb8 "camellia-128-cfb8" +#define NID_camellia_128_cfb8 763 + +#define SN_camellia_192_cfb8 "CAMELLIA-192-CFB8" +#define LN_camellia_192_cfb8 "camellia-192-cfb8" +#define NID_camellia_192_cfb8 764 + +#define SN_camellia_256_cfb8 "CAMELLIA-256-CFB8" +#define LN_camellia_256_cfb8 "camellia-256-cfb8" +#define NID_camellia_256_cfb8 765 + +#define OBJ_aria 1L,2L,410L,200046L,1L,1L + +#define SN_aria_128_ecb "ARIA-128-ECB" +#define LN_aria_128_ecb "aria-128-ecb" +#define NID_aria_128_ecb 1065 +#define OBJ_aria_128_ecb OBJ_aria,1L + +#define SN_aria_128_cbc "ARIA-128-CBC" +#define LN_aria_128_cbc "aria-128-cbc" +#define NID_aria_128_cbc 1066 +#define OBJ_aria_128_cbc OBJ_aria,2L + +#define SN_aria_128_cfb128 "ARIA-128-CFB" +#define LN_aria_128_cfb128 "aria-128-cfb" +#define NID_aria_128_cfb128 1067 +#define OBJ_aria_128_cfb128 OBJ_aria,3L + +#define SN_aria_128_ofb128 "ARIA-128-OFB" +#define LN_aria_128_ofb128 "aria-128-ofb" +#define NID_aria_128_ofb128 1068 +#define OBJ_aria_128_ofb128 OBJ_aria,4L + +#define SN_aria_128_ctr "ARIA-128-CTR" +#define LN_aria_128_ctr "aria-128-ctr" +#define NID_aria_128_ctr 1069 +#define OBJ_aria_128_ctr OBJ_aria,5L + +#define SN_aria_192_ecb "ARIA-192-ECB" +#define LN_aria_192_ecb "aria-192-ecb" +#define NID_aria_192_ecb 1070 +#define OBJ_aria_192_ecb OBJ_aria,6L + +#define SN_aria_192_cbc "ARIA-192-CBC" +#define LN_aria_192_cbc "aria-192-cbc" +#define NID_aria_192_cbc 1071 +#define OBJ_aria_192_cbc OBJ_aria,7L + +#define SN_aria_192_cfb128 "ARIA-192-CFB" +#define LN_aria_192_cfb128 "aria-192-cfb" +#define NID_aria_192_cfb128 1072 +#define OBJ_aria_192_cfb128 OBJ_aria,8L + +#define SN_aria_192_ofb128 "ARIA-192-OFB" +#define LN_aria_192_ofb128 "aria-192-ofb" +#define NID_aria_192_ofb128 1073 +#define OBJ_aria_192_ofb128 OBJ_aria,9L + +#define SN_aria_192_ctr "ARIA-192-CTR" +#define LN_aria_192_ctr "aria-192-ctr" +#define NID_aria_192_ctr 1074 +#define OBJ_aria_192_ctr OBJ_aria,10L + +#define SN_aria_256_ecb "ARIA-256-ECB" +#define LN_aria_256_ecb "aria-256-ecb" +#define NID_aria_256_ecb 1075 +#define OBJ_aria_256_ecb OBJ_aria,11L + +#define SN_aria_256_cbc "ARIA-256-CBC" +#define LN_aria_256_cbc "aria-256-cbc" +#define NID_aria_256_cbc 1076 +#define OBJ_aria_256_cbc OBJ_aria,12L + +#define SN_aria_256_cfb128 "ARIA-256-CFB" +#define LN_aria_256_cfb128 "aria-256-cfb" +#define NID_aria_256_cfb128 1077 +#define OBJ_aria_256_cfb128 OBJ_aria,13L + +#define SN_aria_256_ofb128 "ARIA-256-OFB" +#define LN_aria_256_ofb128 "aria-256-ofb" +#define NID_aria_256_ofb128 1078 +#define OBJ_aria_256_ofb128 OBJ_aria,14L + +#define SN_aria_256_ctr "ARIA-256-CTR" +#define LN_aria_256_ctr "aria-256-ctr" +#define NID_aria_256_ctr 1079 +#define OBJ_aria_256_ctr OBJ_aria,15L + +#define SN_aria_128_cfb1 "ARIA-128-CFB1" +#define LN_aria_128_cfb1 "aria-128-cfb1" +#define NID_aria_128_cfb1 1080 + +#define SN_aria_192_cfb1 "ARIA-192-CFB1" +#define LN_aria_192_cfb1 "aria-192-cfb1" +#define NID_aria_192_cfb1 1081 + +#define SN_aria_256_cfb1 "ARIA-256-CFB1" +#define LN_aria_256_cfb1 "aria-256-cfb1" +#define NID_aria_256_cfb1 1082 + +#define SN_aria_128_cfb8 "ARIA-128-CFB8" +#define LN_aria_128_cfb8 "aria-128-cfb8" +#define NID_aria_128_cfb8 1083 + +#define SN_aria_192_cfb8 "ARIA-192-CFB8" +#define LN_aria_192_cfb8 "aria-192-cfb8" +#define NID_aria_192_cfb8 1084 + +#define SN_aria_256_cfb8 "ARIA-256-CFB8" +#define LN_aria_256_cfb8 "aria-256-cfb8" +#define NID_aria_256_cfb8 1085 + +#define SN_aria_128_ccm "ARIA-128-CCM" +#define LN_aria_128_ccm "aria-128-ccm" +#define NID_aria_128_ccm 1120 +#define OBJ_aria_128_ccm OBJ_aria,37L + +#define SN_aria_192_ccm "ARIA-192-CCM" +#define LN_aria_192_ccm "aria-192-ccm" +#define NID_aria_192_ccm 1121 +#define OBJ_aria_192_ccm OBJ_aria,38L + +#define SN_aria_256_ccm "ARIA-256-CCM" +#define LN_aria_256_ccm "aria-256-ccm" +#define NID_aria_256_ccm 1122 +#define OBJ_aria_256_ccm OBJ_aria,39L + +#define SN_aria_128_gcm "ARIA-128-GCM" +#define LN_aria_128_gcm "aria-128-gcm" +#define NID_aria_128_gcm 1123 +#define OBJ_aria_128_gcm OBJ_aria,34L + +#define SN_aria_192_gcm "ARIA-192-GCM" +#define LN_aria_192_gcm "aria-192-gcm" +#define NID_aria_192_gcm 1124 +#define OBJ_aria_192_gcm OBJ_aria,35L + +#define SN_aria_256_gcm "ARIA-256-GCM" +#define LN_aria_256_gcm "aria-256-gcm" +#define NID_aria_256_gcm 1125 +#define OBJ_aria_256_gcm OBJ_aria,36L + +#define SN_kisa "KISA" +#define LN_kisa "kisa" +#define NID_kisa 773 +#define OBJ_kisa OBJ_member_body,410L,200004L + +#define SN_seed_ecb "SEED-ECB" +#define LN_seed_ecb "seed-ecb" +#define NID_seed_ecb 776 +#define OBJ_seed_ecb OBJ_kisa,1L,3L + +#define SN_seed_cbc "SEED-CBC" +#define LN_seed_cbc "seed-cbc" +#define NID_seed_cbc 777 +#define OBJ_seed_cbc OBJ_kisa,1L,4L + +#define SN_seed_cfb128 "SEED-CFB" +#define LN_seed_cfb128 "seed-cfb" +#define NID_seed_cfb128 779 +#define OBJ_seed_cfb128 OBJ_kisa,1L,5L + +#define SN_seed_ofb128 "SEED-OFB" +#define LN_seed_ofb128 "seed-ofb" +#define NID_seed_ofb128 778 +#define OBJ_seed_ofb128 OBJ_kisa,1L,6L + +#define SN_sm4_ecb "SM4-ECB" +#define LN_sm4_ecb "sm4-ecb" +#define NID_sm4_ecb 1133 +#define OBJ_sm4_ecb OBJ_sm_scheme,104L,1L + +#define SN_sm4_cbc "SM4-CBC" +#define LN_sm4_cbc "sm4-cbc" +#define NID_sm4_cbc 1134 +#define OBJ_sm4_cbc OBJ_sm_scheme,104L,2L + +#define SN_sm4_ofb128 "SM4-OFB" +#define LN_sm4_ofb128 "sm4-ofb" +#define NID_sm4_ofb128 1135 +#define OBJ_sm4_ofb128 OBJ_sm_scheme,104L,3L + +#define SN_sm4_cfb128 "SM4-CFB" +#define LN_sm4_cfb128 "sm4-cfb" +#define NID_sm4_cfb128 1137 +#define OBJ_sm4_cfb128 OBJ_sm_scheme,104L,4L + +#define SN_sm4_cfb1 "SM4-CFB1" +#define LN_sm4_cfb1 "sm4-cfb1" +#define NID_sm4_cfb1 1136 +#define OBJ_sm4_cfb1 OBJ_sm_scheme,104L,5L + +#define SN_sm4_cfb8 "SM4-CFB8" +#define LN_sm4_cfb8 "sm4-cfb8" +#define NID_sm4_cfb8 1138 +#define OBJ_sm4_cfb8 OBJ_sm_scheme,104L,6L + +#define SN_sm4_ctr "SM4-CTR" +#define LN_sm4_ctr "sm4-ctr" +#define NID_sm4_ctr 1139 +#define OBJ_sm4_ctr OBJ_sm_scheme,104L,7L + +#define SN_hmac "HMAC" +#define LN_hmac "hmac" +#define NID_hmac 855 + +#define SN_cmac "CMAC" +#define LN_cmac "cmac" +#define NID_cmac 894 + +#define SN_rc4_hmac_md5 "RC4-HMAC-MD5" +#define LN_rc4_hmac_md5 "rc4-hmac-md5" +#define NID_rc4_hmac_md5 915 + +#define SN_aes_128_cbc_hmac_sha1 "AES-128-CBC-HMAC-SHA1" +#define LN_aes_128_cbc_hmac_sha1 "aes-128-cbc-hmac-sha1" +#define NID_aes_128_cbc_hmac_sha1 916 + +#define SN_aes_192_cbc_hmac_sha1 "AES-192-CBC-HMAC-SHA1" +#define LN_aes_192_cbc_hmac_sha1 "aes-192-cbc-hmac-sha1" +#define NID_aes_192_cbc_hmac_sha1 917 + +#define SN_aes_256_cbc_hmac_sha1 "AES-256-CBC-HMAC-SHA1" +#define LN_aes_256_cbc_hmac_sha1 "aes-256-cbc-hmac-sha1" +#define NID_aes_256_cbc_hmac_sha1 918 + +#define SN_aes_128_cbc_hmac_sha256 "AES-128-CBC-HMAC-SHA256" +#define LN_aes_128_cbc_hmac_sha256 "aes-128-cbc-hmac-sha256" +#define NID_aes_128_cbc_hmac_sha256 948 + +#define SN_aes_192_cbc_hmac_sha256 "AES-192-CBC-HMAC-SHA256" +#define LN_aes_192_cbc_hmac_sha256 "aes-192-cbc-hmac-sha256" +#define NID_aes_192_cbc_hmac_sha256 949 + +#define SN_aes_256_cbc_hmac_sha256 "AES-256-CBC-HMAC-SHA256" +#define LN_aes_256_cbc_hmac_sha256 "aes-256-cbc-hmac-sha256" +#define NID_aes_256_cbc_hmac_sha256 950 + +#define SN_chacha20_poly1305 "ChaCha20-Poly1305" +#define LN_chacha20_poly1305 "chacha20-poly1305" +#define NID_chacha20_poly1305 1018 + +#define SN_chacha20 "ChaCha20" +#define LN_chacha20 "chacha20" +#define NID_chacha20 1019 + +#define SN_dhpublicnumber "dhpublicnumber" +#define LN_dhpublicnumber "X9.42 DH" +#define NID_dhpublicnumber 920 +#define OBJ_dhpublicnumber OBJ_ISO_US,10046L,2L,1L + +#define SN_brainpoolP160r1 "brainpoolP160r1" +#define NID_brainpoolP160r1 921 +#define OBJ_brainpoolP160r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,1L + +#define SN_brainpoolP160t1 "brainpoolP160t1" +#define NID_brainpoolP160t1 922 +#define OBJ_brainpoolP160t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,2L + +#define SN_brainpoolP192r1 "brainpoolP192r1" +#define NID_brainpoolP192r1 923 +#define OBJ_brainpoolP192r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,3L + +#define SN_brainpoolP192t1 "brainpoolP192t1" +#define NID_brainpoolP192t1 924 +#define OBJ_brainpoolP192t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,4L + +#define SN_brainpoolP224r1 "brainpoolP224r1" +#define NID_brainpoolP224r1 925 +#define OBJ_brainpoolP224r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,5L + +#define SN_brainpoolP224t1 "brainpoolP224t1" +#define NID_brainpoolP224t1 926 +#define OBJ_brainpoolP224t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,6L + +#define SN_brainpoolP256r1 "brainpoolP256r1" +#define NID_brainpoolP256r1 927 +#define OBJ_brainpoolP256r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,7L + +#define SN_brainpoolP256t1 "brainpoolP256t1" +#define NID_brainpoolP256t1 928 +#define OBJ_brainpoolP256t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,8L + +#define SN_brainpoolP320r1 "brainpoolP320r1" +#define NID_brainpoolP320r1 929 +#define OBJ_brainpoolP320r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,9L + +#define SN_brainpoolP320t1 "brainpoolP320t1" +#define NID_brainpoolP320t1 930 +#define OBJ_brainpoolP320t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,10L + +#define SN_brainpoolP384r1 "brainpoolP384r1" +#define NID_brainpoolP384r1 931 +#define OBJ_brainpoolP384r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,11L + +#define SN_brainpoolP384t1 "brainpoolP384t1" +#define NID_brainpoolP384t1 932 +#define OBJ_brainpoolP384t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,12L + +#define SN_brainpoolP512r1 "brainpoolP512r1" +#define NID_brainpoolP512r1 933 +#define OBJ_brainpoolP512r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,13L + +#define SN_brainpoolP512t1 "brainpoolP512t1" +#define NID_brainpoolP512t1 934 +#define OBJ_brainpoolP512t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,14L + +#define OBJ_x9_63_scheme 1L,3L,133L,16L,840L,63L,0L + +#define OBJ_secg_scheme OBJ_certicom_arc,1L + +#define SN_dhSinglePass_stdDH_sha1kdf_scheme "dhSinglePass-stdDH-sha1kdf-scheme" +#define NID_dhSinglePass_stdDH_sha1kdf_scheme 936 +#define OBJ_dhSinglePass_stdDH_sha1kdf_scheme OBJ_x9_63_scheme,2L + +#define SN_dhSinglePass_stdDH_sha224kdf_scheme "dhSinglePass-stdDH-sha224kdf-scheme" +#define NID_dhSinglePass_stdDH_sha224kdf_scheme 937 +#define OBJ_dhSinglePass_stdDH_sha224kdf_scheme OBJ_secg_scheme,11L,0L + +#define SN_dhSinglePass_stdDH_sha256kdf_scheme "dhSinglePass-stdDH-sha256kdf-scheme" +#define NID_dhSinglePass_stdDH_sha256kdf_scheme 938 +#define OBJ_dhSinglePass_stdDH_sha256kdf_scheme OBJ_secg_scheme,11L,1L + +#define SN_dhSinglePass_stdDH_sha384kdf_scheme "dhSinglePass-stdDH-sha384kdf-scheme" +#define NID_dhSinglePass_stdDH_sha384kdf_scheme 939 +#define OBJ_dhSinglePass_stdDH_sha384kdf_scheme OBJ_secg_scheme,11L,2L + +#define SN_dhSinglePass_stdDH_sha512kdf_scheme "dhSinglePass-stdDH-sha512kdf-scheme" +#define NID_dhSinglePass_stdDH_sha512kdf_scheme 940 +#define OBJ_dhSinglePass_stdDH_sha512kdf_scheme OBJ_secg_scheme,11L,3L + +#define SN_dhSinglePass_cofactorDH_sha1kdf_scheme "dhSinglePass-cofactorDH-sha1kdf-scheme" +#define NID_dhSinglePass_cofactorDH_sha1kdf_scheme 941 +#define OBJ_dhSinglePass_cofactorDH_sha1kdf_scheme OBJ_x9_63_scheme,3L + +#define SN_dhSinglePass_cofactorDH_sha224kdf_scheme "dhSinglePass-cofactorDH-sha224kdf-scheme" +#define NID_dhSinglePass_cofactorDH_sha224kdf_scheme 942 +#define OBJ_dhSinglePass_cofactorDH_sha224kdf_scheme OBJ_secg_scheme,14L,0L + +#define SN_dhSinglePass_cofactorDH_sha256kdf_scheme "dhSinglePass-cofactorDH-sha256kdf-scheme" +#define NID_dhSinglePass_cofactorDH_sha256kdf_scheme 943 +#define OBJ_dhSinglePass_cofactorDH_sha256kdf_scheme OBJ_secg_scheme,14L,1L + +#define SN_dhSinglePass_cofactorDH_sha384kdf_scheme "dhSinglePass-cofactorDH-sha384kdf-scheme" +#define NID_dhSinglePass_cofactorDH_sha384kdf_scheme 944 +#define OBJ_dhSinglePass_cofactorDH_sha384kdf_scheme OBJ_secg_scheme,14L,2L + +#define SN_dhSinglePass_cofactorDH_sha512kdf_scheme "dhSinglePass-cofactorDH-sha512kdf-scheme" +#define NID_dhSinglePass_cofactorDH_sha512kdf_scheme 945 +#define OBJ_dhSinglePass_cofactorDH_sha512kdf_scheme OBJ_secg_scheme,14L,3L + +#define SN_dh_std_kdf "dh-std-kdf" +#define NID_dh_std_kdf 946 + +#define SN_dh_cofactor_kdf "dh-cofactor-kdf" +#define NID_dh_cofactor_kdf 947 + +#define SN_ct_precert_scts "ct_precert_scts" +#define LN_ct_precert_scts "CT Precertificate SCTs" +#define NID_ct_precert_scts 951 +#define OBJ_ct_precert_scts 1L,3L,6L,1L,4L,1L,11129L,2L,4L,2L + +#define SN_ct_precert_poison "ct_precert_poison" +#define LN_ct_precert_poison "CT Precertificate Poison" +#define NID_ct_precert_poison 952 +#define OBJ_ct_precert_poison 1L,3L,6L,1L,4L,1L,11129L,2L,4L,3L + +#define SN_ct_precert_signer "ct_precert_signer" +#define LN_ct_precert_signer "CT Precertificate Signer" +#define NID_ct_precert_signer 953 +#define OBJ_ct_precert_signer 1L,3L,6L,1L,4L,1L,11129L,2L,4L,4L + +#define SN_ct_cert_scts "ct_cert_scts" +#define LN_ct_cert_scts "CT Certificate SCTs" +#define NID_ct_cert_scts 954 +#define OBJ_ct_cert_scts 1L,3L,6L,1L,4L,1L,11129L,2L,4L,5L + +#define SN_jurisdictionLocalityName "jurisdictionL" +#define LN_jurisdictionLocalityName "jurisdictionLocalityName" +#define NID_jurisdictionLocalityName 955 +#define OBJ_jurisdictionLocalityName 1L,3L,6L,1L,4L,1L,311L,60L,2L,1L,1L + +#define SN_jurisdictionStateOrProvinceName "jurisdictionST" +#define LN_jurisdictionStateOrProvinceName "jurisdictionStateOrProvinceName" +#define NID_jurisdictionStateOrProvinceName 956 +#define OBJ_jurisdictionStateOrProvinceName 1L,3L,6L,1L,4L,1L,311L,60L,2L,1L,2L + +#define SN_jurisdictionCountryName "jurisdictionC" +#define LN_jurisdictionCountryName "jurisdictionCountryName" +#define NID_jurisdictionCountryName 957 +#define OBJ_jurisdictionCountryName 1L,3L,6L,1L,4L,1L,311L,60L,2L,1L,3L + +#define SN_id_scrypt "id-scrypt" +#define LN_id_scrypt "scrypt" +#define NID_id_scrypt 973 +#define OBJ_id_scrypt 1L,3L,6L,1L,4L,1L,11591L,4L,11L + +#define SN_tls1_prf "TLS1-PRF" +#define LN_tls1_prf "tls1-prf" +#define NID_tls1_prf 1021 + +#define SN_hkdf "HKDF" +#define LN_hkdf "hkdf" +#define NID_hkdf 1036 + +#define SN_id_pkinit "id-pkinit" +#define NID_id_pkinit 1031 +#define OBJ_id_pkinit 1L,3L,6L,1L,5L,2L,3L + +#define SN_pkInitClientAuth "pkInitClientAuth" +#define LN_pkInitClientAuth "PKINIT Client Auth" +#define NID_pkInitClientAuth 1032 +#define OBJ_pkInitClientAuth OBJ_id_pkinit,4L + +#define SN_pkInitKDC "pkInitKDC" +#define LN_pkInitKDC "Signing KDC Response" +#define NID_pkInitKDC 1033 +#define OBJ_pkInitKDC OBJ_id_pkinit,5L + +#define SN_X25519 "X25519" +#define NID_X25519 1034 +#define OBJ_X25519 1L,3L,101L,110L + +#define SN_X448 "X448" +#define NID_X448 1035 +#define OBJ_X448 1L,3L,101L,111L + +#define SN_ED25519 "ED25519" +#define NID_ED25519 1087 +#define OBJ_ED25519 1L,3L,101L,112L + +#define SN_ED448 "ED448" +#define NID_ED448 1088 +#define OBJ_ED448 1L,3L,101L,113L + +#define SN_kx_rsa "KxRSA" +#define LN_kx_rsa "kx-rsa" +#define NID_kx_rsa 1037 + +#define SN_kx_ecdhe "KxECDHE" +#define LN_kx_ecdhe "kx-ecdhe" +#define NID_kx_ecdhe 1038 + +#define SN_kx_dhe "KxDHE" +#define LN_kx_dhe "kx-dhe" +#define NID_kx_dhe 1039 + +#define SN_kx_ecdhe_psk "KxECDHE-PSK" +#define LN_kx_ecdhe_psk "kx-ecdhe-psk" +#define NID_kx_ecdhe_psk 1040 + +#define SN_kx_dhe_psk "KxDHE-PSK" +#define LN_kx_dhe_psk "kx-dhe-psk" +#define NID_kx_dhe_psk 1041 + +#define SN_kx_rsa_psk "KxRSA_PSK" +#define LN_kx_rsa_psk "kx-rsa-psk" +#define NID_kx_rsa_psk 1042 + +#define SN_kx_psk "KxPSK" +#define LN_kx_psk "kx-psk" +#define NID_kx_psk 1043 + +#define SN_kx_srp "KxSRP" +#define LN_kx_srp "kx-srp" +#define NID_kx_srp 1044 + +#define SN_kx_gost "KxGOST" +#define LN_kx_gost "kx-gost" +#define NID_kx_gost 1045 + +#define SN_kx_any "KxANY" +#define LN_kx_any "kx-any" +#define NID_kx_any 1063 + +#define SN_auth_rsa "AuthRSA" +#define LN_auth_rsa "auth-rsa" +#define NID_auth_rsa 1046 + +#define SN_auth_ecdsa "AuthECDSA" +#define LN_auth_ecdsa "auth-ecdsa" +#define NID_auth_ecdsa 1047 + +#define SN_auth_psk "AuthPSK" +#define LN_auth_psk "auth-psk" +#define NID_auth_psk 1048 + +#define SN_auth_dss "AuthDSS" +#define LN_auth_dss "auth-dss" +#define NID_auth_dss 1049 + +#define SN_auth_gost01 "AuthGOST01" +#define LN_auth_gost01 "auth-gost01" +#define NID_auth_gost01 1050 + +#define SN_auth_gost12 "AuthGOST12" +#define LN_auth_gost12 "auth-gost12" +#define NID_auth_gost12 1051 + +#define SN_auth_srp "AuthSRP" +#define LN_auth_srp "auth-srp" +#define NID_auth_srp 1052 + +#define SN_auth_null "AuthNULL" +#define LN_auth_null "auth-null" +#define NID_auth_null 1053 + +#define SN_auth_any "AuthANY" +#define LN_auth_any "auth-any" +#define NID_auth_any 1064 + +#define SN_poly1305 "Poly1305" +#define LN_poly1305 "poly1305" +#define NID_poly1305 1061 + +#define SN_siphash "SipHash" +#define LN_siphash "siphash" +#define NID_siphash 1062 + +#define SN_ffdhe2048 "ffdhe2048" +#define NID_ffdhe2048 1126 + +#define SN_ffdhe3072 "ffdhe3072" +#define NID_ffdhe3072 1127 + +#define SN_ffdhe4096 "ffdhe4096" +#define NID_ffdhe4096 1128 + +#define SN_ffdhe6144 "ffdhe6144" +#define NID_ffdhe6144 1129 + +#define SN_ffdhe8192 "ffdhe8192" +#define NID_ffdhe8192 1130 + +#define SN_ISO_UA "ISO-UA" +#define NID_ISO_UA 1150 +#define OBJ_ISO_UA OBJ_member_body,804L + +#define SN_ua_pki "ua-pki" +#define NID_ua_pki 1151 +#define OBJ_ua_pki OBJ_ISO_UA,2L,1L,1L,1L + +#define SN_dstu28147 "dstu28147" +#define LN_dstu28147 "DSTU Gost 28147-2009" +#define NID_dstu28147 1152 +#define OBJ_dstu28147 OBJ_ua_pki,1L,1L,1L + +#define SN_dstu28147_ofb "dstu28147-ofb" +#define LN_dstu28147_ofb "DSTU Gost 28147-2009 OFB mode" +#define NID_dstu28147_ofb 1153 +#define OBJ_dstu28147_ofb OBJ_dstu28147,2L + +#define SN_dstu28147_cfb "dstu28147-cfb" +#define LN_dstu28147_cfb "DSTU Gost 28147-2009 CFB mode" +#define NID_dstu28147_cfb 1154 +#define OBJ_dstu28147_cfb OBJ_dstu28147,3L + +#define SN_dstu28147_wrap "dstu28147-wrap" +#define LN_dstu28147_wrap "DSTU Gost 28147-2009 key wrap" +#define NID_dstu28147_wrap 1155 +#define OBJ_dstu28147_wrap OBJ_dstu28147,5L + +#define SN_hmacWithDstu34311 "hmacWithDstu34311" +#define LN_hmacWithDstu34311 "HMAC DSTU Gost 34311-95" +#define NID_hmacWithDstu34311 1156 +#define OBJ_hmacWithDstu34311 OBJ_ua_pki,1L,1L,2L + +#define SN_dstu34311 "dstu34311" +#define LN_dstu34311 "DSTU Gost 34311-95" +#define NID_dstu34311 1157 +#define OBJ_dstu34311 OBJ_ua_pki,1L,2L,1L + +#define SN_dstu4145le "dstu4145le" +#define LN_dstu4145le "DSTU 4145-2002 little endian" +#define NID_dstu4145le 1158 +#define OBJ_dstu4145le OBJ_ua_pki,1L,3L,1L,1L + +#define SN_dstu4145be "dstu4145be" +#define LN_dstu4145be "DSTU 4145-2002 big endian" +#define NID_dstu4145be 1159 +#define OBJ_dstu4145be OBJ_dstu4145le,1L,1L + +#define SN_uacurve0 "uacurve0" +#define LN_uacurve0 "DSTU curve 0" +#define NID_uacurve0 1160 +#define OBJ_uacurve0 OBJ_dstu4145le,2L,0L + +#define SN_uacurve1 "uacurve1" +#define LN_uacurve1 "DSTU curve 1" +#define NID_uacurve1 1161 +#define OBJ_uacurve1 OBJ_dstu4145le,2L,1L + +#define SN_uacurve2 "uacurve2" +#define LN_uacurve2 "DSTU curve 2" +#define NID_uacurve2 1162 +#define OBJ_uacurve2 OBJ_dstu4145le,2L,2L + +#define SN_uacurve3 "uacurve3" +#define LN_uacurve3 "DSTU curve 3" +#define NID_uacurve3 1163 +#define OBJ_uacurve3 OBJ_dstu4145le,2L,3L + +#define SN_uacurve4 "uacurve4" +#define LN_uacurve4 "DSTU curve 4" +#define NID_uacurve4 1164 +#define OBJ_uacurve4 OBJ_dstu4145le,2L,4L + +#define SN_uacurve5 "uacurve5" +#define LN_uacurve5 "DSTU curve 5" +#define NID_uacurve5 1165 +#define OBJ_uacurve5 OBJ_dstu4145le,2L,5L + +#define SN_uacurve6 "uacurve6" +#define LN_uacurve6 "DSTU curve 6" +#define NID_uacurve6 1166 +#define OBJ_uacurve6 OBJ_dstu4145le,2L,6L + +#define SN_uacurve7 "uacurve7" +#define LN_uacurve7 "DSTU curve 7" +#define NID_uacurve7 1167 +#define OBJ_uacurve7 OBJ_dstu4145le,2L,7L + +#define SN_uacurve8 "uacurve8" +#define LN_uacurve8 "DSTU curve 8" +#define NID_uacurve8 1168 +#define OBJ_uacurve8 OBJ_dstu4145le,2L,8L + +#define SN_uacurve9 "uacurve9" +#define LN_uacurve9 "DSTU curve 9" +#define NID_uacurve9 1169 +#define OBJ_uacurve9 OBJ_dstu4145le,2L,9L diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/objects.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/objects.h new file mode 100644 index 0000000..5e8b576 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/objects.h @@ -0,0 +1,175 @@ +/* + * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_OBJECTS_H +# define HEADER_OBJECTS_H + +# include +# include +# include +# include + +# define OBJ_NAME_TYPE_UNDEF 0x00 +# define OBJ_NAME_TYPE_MD_METH 0x01 +# define OBJ_NAME_TYPE_CIPHER_METH 0x02 +# define OBJ_NAME_TYPE_PKEY_METH 0x03 +# define OBJ_NAME_TYPE_COMP_METH 0x04 +# define OBJ_NAME_TYPE_NUM 0x05 + +# define OBJ_NAME_ALIAS 0x8000 + +# define OBJ_BSEARCH_VALUE_ON_NOMATCH 0x01 +# define OBJ_BSEARCH_FIRST_VALUE_ON_MATCH 0x02 + + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct obj_name_st { + int type; + int alias; + const char *name; + const char *data; +} OBJ_NAME; + +# define OBJ_create_and_add_object(a,b,c) OBJ_create(a,b,c) + +int OBJ_NAME_init(void); +int OBJ_NAME_new_index(unsigned long (*hash_func) (const char *), + int (*cmp_func) (const char *, const char *), + void (*free_func) (const char *, int, const char *)); +const char *OBJ_NAME_get(const char *name, int type); +int OBJ_NAME_add(const char *name, int type, const char *data); +int OBJ_NAME_remove(const char *name, int type); +void OBJ_NAME_cleanup(int type); /* -1 for everything */ +void OBJ_NAME_do_all(int type, void (*fn) (const OBJ_NAME *, void *arg), + void *arg); +void OBJ_NAME_do_all_sorted(int type, + void (*fn) (const OBJ_NAME *, void *arg), + void *arg); + +ASN1_OBJECT *OBJ_dup(const ASN1_OBJECT *o); +ASN1_OBJECT *OBJ_nid2obj(int n); +const char *OBJ_nid2ln(int n); +const char *OBJ_nid2sn(int n); +int OBJ_obj2nid(const ASN1_OBJECT *o); +ASN1_OBJECT *OBJ_txt2obj(const char *s, int no_name); +int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name); +int OBJ_txt2nid(const char *s); +int OBJ_ln2nid(const char *s); +int OBJ_sn2nid(const char *s); +int OBJ_cmp(const ASN1_OBJECT *a, const ASN1_OBJECT *b); +const void *OBJ_bsearch_(const void *key, const void *base, int num, int size, + int (*cmp) (const void *, const void *)); +const void *OBJ_bsearch_ex_(const void *key, const void *base, int num, + int size, + int (*cmp) (const void *, const void *), + int flags); + +# define _DECLARE_OBJ_BSEARCH_CMP_FN(scope, type1, type2, nm) \ + static int nm##_cmp_BSEARCH_CMP_FN(const void *, const void *); \ + static int nm##_cmp(type1 const *, type2 const *); \ + scope type2 * OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) + +# define DECLARE_OBJ_BSEARCH_CMP_FN(type1, type2, cmp) \ + _DECLARE_OBJ_BSEARCH_CMP_FN(static, type1, type2, cmp) +# define DECLARE_OBJ_BSEARCH_GLOBAL_CMP_FN(type1, type2, nm) \ + type2 * OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) + +/*- + * Unsolved problem: if a type is actually a pointer type, like + * nid_triple is, then its impossible to get a const where you need + * it. Consider: + * + * typedef int nid_triple[3]; + * const void *a_; + * const nid_triple const *a = a_; + * + * The assignment discards a const because what you really want is: + * + * const int const * const *a = a_; + * + * But if you do that, you lose the fact that a is an array of 3 ints, + * which breaks comparison functions. + * + * Thus we end up having to cast, sadly, or unpack the + * declarations. Or, as I finally did in this case, declare nid_triple + * to be a struct, which it should have been in the first place. + * + * Ben, August 2008. + * + * Also, strictly speaking not all types need be const, but handling + * the non-constness means a lot of complication, and in practice + * comparison routines do always not touch their arguments. + */ + +# define IMPLEMENT_OBJ_BSEARCH_CMP_FN(type1, type2, nm) \ + static int nm##_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_) \ + { \ + type1 const *a = a_; \ + type2 const *b = b_; \ + return nm##_cmp(a,b); \ + } \ + static type2 *OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) \ + { \ + return (type2 *)OBJ_bsearch_(key, base, num, sizeof(type2), \ + nm##_cmp_BSEARCH_CMP_FN); \ + } \ + extern void dummy_prototype(void) + +# define IMPLEMENT_OBJ_BSEARCH_GLOBAL_CMP_FN(type1, type2, nm) \ + static int nm##_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_) \ + { \ + type1 const *a = a_; \ + type2 const *b = b_; \ + return nm##_cmp(a,b); \ + } \ + type2 *OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) \ + { \ + return (type2 *)OBJ_bsearch_(key, base, num, sizeof(type2), \ + nm##_cmp_BSEARCH_CMP_FN); \ + } \ + extern void dummy_prototype(void) + +# define OBJ_bsearch(type1,key,type2,base,num,cmp) \ + ((type2 *)OBJ_bsearch_(CHECKED_PTR_OF(type1,key),CHECKED_PTR_OF(type2,base), \ + num,sizeof(type2), \ + ((void)CHECKED_PTR_OF(type1,cmp##_type_1), \ + (void)CHECKED_PTR_OF(type2,cmp##_type_2), \ + cmp##_BSEARCH_CMP_FN))) + +# define OBJ_bsearch_ex(type1,key,type2,base,num,cmp,flags) \ + ((type2 *)OBJ_bsearch_ex_(CHECKED_PTR_OF(type1,key),CHECKED_PTR_OF(type2,base), \ + num,sizeof(type2), \ + ((void)CHECKED_PTR_OF(type1,cmp##_type_1), \ + (void)type_2=CHECKED_PTR_OF(type2,cmp##_type_2), \ + cmp##_BSEARCH_CMP_FN)),flags) + +int OBJ_new_nid(int num); +int OBJ_add_object(const ASN1_OBJECT *obj); +int OBJ_create(const char *oid, const char *sn, const char *ln); +#if OPENSSL_API_COMPAT < 0x10100000L +# define OBJ_cleanup() while(0) continue +#endif +int OBJ_create_objects(BIO *in); + +size_t OBJ_length(const ASN1_OBJECT *obj); +const unsigned char *OBJ_get0_data(const ASN1_OBJECT *obj); + +int OBJ_find_sigid_algs(int signid, int *pdig_nid, int *ppkey_nid); +int OBJ_find_sigid_by_algs(int *psignid, int dig_nid, int pkey_nid); +int OBJ_add_sigid(int signid, int dig_id, int pkey_id); +void OBJ_sigid_free(void); + + +# ifdef __cplusplus +} +# endif +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/objectserr.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/objectserr.h new file mode 100644 index 0000000..02e166f --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/objectserr.h @@ -0,0 +1,42 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_OBJERR_H +# define HEADER_OBJERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_OBJ_strings(void); + +/* + * OBJ function codes. + */ +# define OBJ_F_OBJ_ADD_OBJECT 105 +# define OBJ_F_OBJ_ADD_SIGID 107 +# define OBJ_F_OBJ_CREATE 100 +# define OBJ_F_OBJ_DUP 101 +# define OBJ_F_OBJ_NAME_NEW_INDEX 106 +# define OBJ_F_OBJ_NID2LN 102 +# define OBJ_F_OBJ_NID2OBJ 103 +# define OBJ_F_OBJ_NID2SN 104 +# define OBJ_F_OBJ_TXT2OBJ 108 + +/* + * OBJ reason codes. + */ +# define OBJ_R_OID_EXISTS 102 +# define OBJ_R_UNKNOWN_NID 101 + +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/ocsp.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/ocsp.h new file mode 100644 index 0000000..4d759a4 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/ocsp.h @@ -0,0 +1,352 @@ +/* + * Copyright 2000-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_OCSP_H +# define HEADER_OCSP_H + +#include + +/* + * These definitions are outside the OPENSSL_NO_OCSP guard because although for + * historical reasons they have OCSP_* names, they can actually be used + * independently of OCSP. E.g. see RFC5280 + */ +/*- + * CRLReason ::= ENUMERATED { + * unspecified (0), + * keyCompromise (1), + * cACompromise (2), + * affiliationChanged (3), + * superseded (4), + * cessationOfOperation (5), + * certificateHold (6), + * removeFromCRL (8) } + */ +# define OCSP_REVOKED_STATUS_NOSTATUS -1 +# define OCSP_REVOKED_STATUS_UNSPECIFIED 0 +# define OCSP_REVOKED_STATUS_KEYCOMPROMISE 1 +# define OCSP_REVOKED_STATUS_CACOMPROMISE 2 +# define OCSP_REVOKED_STATUS_AFFILIATIONCHANGED 3 +# define OCSP_REVOKED_STATUS_SUPERSEDED 4 +# define OCSP_REVOKED_STATUS_CESSATIONOFOPERATION 5 +# define OCSP_REVOKED_STATUS_CERTIFICATEHOLD 6 +# define OCSP_REVOKED_STATUS_REMOVEFROMCRL 8 + + +# ifndef OPENSSL_NO_OCSP + +# include +# include +# include +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Various flags and values */ + +# define OCSP_DEFAULT_NONCE_LENGTH 16 + +# define OCSP_NOCERTS 0x1 +# define OCSP_NOINTERN 0x2 +# define OCSP_NOSIGS 0x4 +# define OCSP_NOCHAIN 0x8 +# define OCSP_NOVERIFY 0x10 +# define OCSP_NOEXPLICIT 0x20 +# define OCSP_NOCASIGN 0x40 +# define OCSP_NODELEGATED 0x80 +# define OCSP_NOCHECKS 0x100 +# define OCSP_TRUSTOTHER 0x200 +# define OCSP_RESPID_KEY 0x400 +# define OCSP_NOTIME 0x800 + +typedef struct ocsp_cert_id_st OCSP_CERTID; + +DEFINE_STACK_OF(OCSP_CERTID) + +typedef struct ocsp_one_request_st OCSP_ONEREQ; + +DEFINE_STACK_OF(OCSP_ONEREQ) + +typedef struct ocsp_req_info_st OCSP_REQINFO; +typedef struct ocsp_signature_st OCSP_SIGNATURE; +typedef struct ocsp_request_st OCSP_REQUEST; + +# define OCSP_RESPONSE_STATUS_SUCCESSFUL 0 +# define OCSP_RESPONSE_STATUS_MALFORMEDREQUEST 1 +# define OCSP_RESPONSE_STATUS_INTERNALERROR 2 +# define OCSP_RESPONSE_STATUS_TRYLATER 3 +# define OCSP_RESPONSE_STATUS_SIGREQUIRED 5 +# define OCSP_RESPONSE_STATUS_UNAUTHORIZED 6 + +typedef struct ocsp_resp_bytes_st OCSP_RESPBYTES; + +# define V_OCSP_RESPID_NAME 0 +# define V_OCSP_RESPID_KEY 1 + +DEFINE_STACK_OF(OCSP_RESPID) + +typedef struct ocsp_revoked_info_st OCSP_REVOKEDINFO; + +# define V_OCSP_CERTSTATUS_GOOD 0 +# define V_OCSP_CERTSTATUS_REVOKED 1 +# define V_OCSP_CERTSTATUS_UNKNOWN 2 + +typedef struct ocsp_cert_status_st OCSP_CERTSTATUS; +typedef struct ocsp_single_response_st OCSP_SINGLERESP; + +DEFINE_STACK_OF(OCSP_SINGLERESP) + +typedef struct ocsp_response_data_st OCSP_RESPDATA; + +typedef struct ocsp_basic_response_st OCSP_BASICRESP; + +typedef struct ocsp_crl_id_st OCSP_CRLID; +typedef struct ocsp_service_locator_st OCSP_SERVICELOC; + +# define PEM_STRING_OCSP_REQUEST "OCSP REQUEST" +# define PEM_STRING_OCSP_RESPONSE "OCSP RESPONSE" + +# define d2i_OCSP_REQUEST_bio(bp,p) ASN1_d2i_bio_of(OCSP_REQUEST,OCSP_REQUEST_new,d2i_OCSP_REQUEST,bp,p) + +# define d2i_OCSP_RESPONSE_bio(bp,p) ASN1_d2i_bio_of(OCSP_RESPONSE,OCSP_RESPONSE_new,d2i_OCSP_RESPONSE,bp,p) + +# define PEM_read_bio_OCSP_REQUEST(bp,x,cb) (OCSP_REQUEST *)PEM_ASN1_read_bio( \ + (char *(*)())d2i_OCSP_REQUEST,PEM_STRING_OCSP_REQUEST, \ + bp,(char **)(x),cb,NULL) + +# define PEM_read_bio_OCSP_RESPONSE(bp,x,cb) (OCSP_RESPONSE *)PEM_ASN1_read_bio(\ + (char *(*)())d2i_OCSP_RESPONSE,PEM_STRING_OCSP_RESPONSE, \ + bp,(char **)(x),cb,NULL) + +# define PEM_write_bio_OCSP_REQUEST(bp,o) \ + PEM_ASN1_write_bio((int (*)())i2d_OCSP_REQUEST,PEM_STRING_OCSP_REQUEST,\ + bp,(char *)(o), NULL,NULL,0,NULL,NULL) + +# define PEM_write_bio_OCSP_RESPONSE(bp,o) \ + PEM_ASN1_write_bio((int (*)())i2d_OCSP_RESPONSE,PEM_STRING_OCSP_RESPONSE,\ + bp,(char *)(o), NULL,NULL,0,NULL,NULL) + +# define i2d_OCSP_RESPONSE_bio(bp,o) ASN1_i2d_bio_of(OCSP_RESPONSE,i2d_OCSP_RESPONSE,bp,o) + +# define i2d_OCSP_REQUEST_bio(bp,o) ASN1_i2d_bio_of(OCSP_REQUEST,i2d_OCSP_REQUEST,bp,o) + +# define ASN1_BIT_STRING_digest(data,type,md,len) \ + ASN1_item_digest(ASN1_ITEM_rptr(ASN1_BIT_STRING),type,data,md,len) + +# define OCSP_CERTSTATUS_dup(cs)\ + (OCSP_CERTSTATUS*)ASN1_dup((int(*)())i2d_OCSP_CERTSTATUS,\ + (char *(*)())d2i_OCSP_CERTSTATUS,(char *)(cs)) + +OCSP_CERTID *OCSP_CERTID_dup(OCSP_CERTID *id); + +OCSP_RESPONSE *OCSP_sendreq_bio(BIO *b, const char *path, OCSP_REQUEST *req); +OCSP_REQ_CTX *OCSP_sendreq_new(BIO *io, const char *path, OCSP_REQUEST *req, + int maxline); +int OCSP_REQ_CTX_nbio(OCSP_REQ_CTX *rctx); +int OCSP_sendreq_nbio(OCSP_RESPONSE **presp, OCSP_REQ_CTX *rctx); +OCSP_REQ_CTX *OCSP_REQ_CTX_new(BIO *io, int maxline); +void OCSP_REQ_CTX_free(OCSP_REQ_CTX *rctx); +void OCSP_set_max_response_length(OCSP_REQ_CTX *rctx, unsigned long len); +int OCSP_REQ_CTX_i2d(OCSP_REQ_CTX *rctx, const ASN1_ITEM *it, + ASN1_VALUE *val); +int OCSP_REQ_CTX_nbio_d2i(OCSP_REQ_CTX *rctx, ASN1_VALUE **pval, + const ASN1_ITEM *it); +BIO *OCSP_REQ_CTX_get0_mem_bio(OCSP_REQ_CTX *rctx); +int OCSP_REQ_CTX_http(OCSP_REQ_CTX *rctx, const char *op, const char *path); +int OCSP_REQ_CTX_set1_req(OCSP_REQ_CTX *rctx, OCSP_REQUEST *req); +int OCSP_REQ_CTX_add1_header(OCSP_REQ_CTX *rctx, + const char *name, const char *value); + +OCSP_CERTID *OCSP_cert_to_id(const EVP_MD *dgst, const X509 *subject, + const X509 *issuer); + +OCSP_CERTID *OCSP_cert_id_new(const EVP_MD *dgst, + const X509_NAME *issuerName, + const ASN1_BIT_STRING *issuerKey, + const ASN1_INTEGER *serialNumber); + +OCSP_ONEREQ *OCSP_request_add0_id(OCSP_REQUEST *req, OCSP_CERTID *cid); + +int OCSP_request_add1_nonce(OCSP_REQUEST *req, unsigned char *val, int len); +int OCSP_basic_add1_nonce(OCSP_BASICRESP *resp, unsigned char *val, int len); +int OCSP_check_nonce(OCSP_REQUEST *req, OCSP_BASICRESP *bs); +int OCSP_copy_nonce(OCSP_BASICRESP *resp, OCSP_REQUEST *req); + +int OCSP_request_set1_name(OCSP_REQUEST *req, X509_NAME *nm); +int OCSP_request_add1_cert(OCSP_REQUEST *req, X509 *cert); + +int OCSP_request_sign(OCSP_REQUEST *req, + X509 *signer, + EVP_PKEY *key, + const EVP_MD *dgst, + STACK_OF(X509) *certs, unsigned long flags); + +int OCSP_response_status(OCSP_RESPONSE *resp); +OCSP_BASICRESP *OCSP_response_get1_basic(OCSP_RESPONSE *resp); + +const ASN1_OCTET_STRING *OCSP_resp_get0_signature(const OCSP_BASICRESP *bs); +const X509_ALGOR *OCSP_resp_get0_tbs_sigalg(const OCSP_BASICRESP *bs); +const OCSP_RESPDATA *OCSP_resp_get0_respdata(const OCSP_BASICRESP *bs); +int OCSP_resp_get0_signer(OCSP_BASICRESP *bs, X509 **signer, + STACK_OF(X509) *extra_certs); + +int OCSP_resp_count(OCSP_BASICRESP *bs); +OCSP_SINGLERESP *OCSP_resp_get0(OCSP_BASICRESP *bs, int idx); +const ASN1_GENERALIZEDTIME *OCSP_resp_get0_produced_at(const OCSP_BASICRESP* bs); +const STACK_OF(X509) *OCSP_resp_get0_certs(const OCSP_BASICRESP *bs); +int OCSP_resp_get0_id(const OCSP_BASICRESP *bs, + const ASN1_OCTET_STRING **pid, + const X509_NAME **pname); +int OCSP_resp_get1_id(const OCSP_BASICRESP *bs, + ASN1_OCTET_STRING **pid, + X509_NAME **pname); + +int OCSP_resp_find(OCSP_BASICRESP *bs, OCSP_CERTID *id, int last); +int OCSP_single_get0_status(OCSP_SINGLERESP *single, int *reason, + ASN1_GENERALIZEDTIME **revtime, + ASN1_GENERALIZEDTIME **thisupd, + ASN1_GENERALIZEDTIME **nextupd); +int OCSP_resp_find_status(OCSP_BASICRESP *bs, OCSP_CERTID *id, int *status, + int *reason, + ASN1_GENERALIZEDTIME **revtime, + ASN1_GENERALIZEDTIME **thisupd, + ASN1_GENERALIZEDTIME **nextupd); +int OCSP_check_validity(ASN1_GENERALIZEDTIME *thisupd, + ASN1_GENERALIZEDTIME *nextupd, long sec, long maxsec); + +int OCSP_request_verify(OCSP_REQUEST *req, STACK_OF(X509) *certs, + X509_STORE *store, unsigned long flags); + +int OCSP_parse_url(const char *url, char **phost, char **pport, char **ppath, + int *pssl); + +int OCSP_id_issuer_cmp(const OCSP_CERTID *a, const OCSP_CERTID *b); +int OCSP_id_cmp(const OCSP_CERTID *a, const OCSP_CERTID *b); + +int OCSP_request_onereq_count(OCSP_REQUEST *req); +OCSP_ONEREQ *OCSP_request_onereq_get0(OCSP_REQUEST *req, int i); +OCSP_CERTID *OCSP_onereq_get0_id(OCSP_ONEREQ *one); +int OCSP_id_get0_info(ASN1_OCTET_STRING **piNameHash, ASN1_OBJECT **pmd, + ASN1_OCTET_STRING **pikeyHash, + ASN1_INTEGER **pserial, OCSP_CERTID *cid); +int OCSP_request_is_signed(OCSP_REQUEST *req); +OCSP_RESPONSE *OCSP_response_create(int status, OCSP_BASICRESP *bs); +OCSP_SINGLERESP *OCSP_basic_add1_status(OCSP_BASICRESP *rsp, + OCSP_CERTID *cid, + int status, int reason, + ASN1_TIME *revtime, + ASN1_TIME *thisupd, + ASN1_TIME *nextupd); +int OCSP_basic_add1_cert(OCSP_BASICRESP *resp, X509 *cert); +int OCSP_basic_sign(OCSP_BASICRESP *brsp, + X509 *signer, EVP_PKEY *key, const EVP_MD *dgst, + STACK_OF(X509) *certs, unsigned long flags); +int OCSP_basic_sign_ctx(OCSP_BASICRESP *brsp, + X509 *signer, EVP_MD_CTX *ctx, + STACK_OF(X509) *certs, unsigned long flags); +int OCSP_RESPID_set_by_name(OCSP_RESPID *respid, X509 *cert); +int OCSP_RESPID_set_by_key(OCSP_RESPID *respid, X509 *cert); +int OCSP_RESPID_match(OCSP_RESPID *respid, X509 *cert); + +X509_EXTENSION *OCSP_crlID_new(const char *url, long *n, char *tim); + +X509_EXTENSION *OCSP_accept_responses_new(char **oids); + +X509_EXTENSION *OCSP_archive_cutoff_new(char *tim); + +X509_EXTENSION *OCSP_url_svcloc_new(X509_NAME *issuer, const char **urls); + +int OCSP_REQUEST_get_ext_count(OCSP_REQUEST *x); +int OCSP_REQUEST_get_ext_by_NID(OCSP_REQUEST *x, int nid, int lastpos); +int OCSP_REQUEST_get_ext_by_OBJ(OCSP_REQUEST *x, const ASN1_OBJECT *obj, + int lastpos); +int OCSP_REQUEST_get_ext_by_critical(OCSP_REQUEST *x, int crit, int lastpos); +X509_EXTENSION *OCSP_REQUEST_get_ext(OCSP_REQUEST *x, int loc); +X509_EXTENSION *OCSP_REQUEST_delete_ext(OCSP_REQUEST *x, int loc); +void *OCSP_REQUEST_get1_ext_d2i(OCSP_REQUEST *x, int nid, int *crit, + int *idx); +int OCSP_REQUEST_add1_ext_i2d(OCSP_REQUEST *x, int nid, void *value, int crit, + unsigned long flags); +int OCSP_REQUEST_add_ext(OCSP_REQUEST *x, X509_EXTENSION *ex, int loc); + +int OCSP_ONEREQ_get_ext_count(OCSP_ONEREQ *x); +int OCSP_ONEREQ_get_ext_by_NID(OCSP_ONEREQ *x, int nid, int lastpos); +int OCSP_ONEREQ_get_ext_by_OBJ(OCSP_ONEREQ *x, const ASN1_OBJECT *obj, int lastpos); +int OCSP_ONEREQ_get_ext_by_critical(OCSP_ONEREQ *x, int crit, int lastpos); +X509_EXTENSION *OCSP_ONEREQ_get_ext(OCSP_ONEREQ *x, int loc); +X509_EXTENSION *OCSP_ONEREQ_delete_ext(OCSP_ONEREQ *x, int loc); +void *OCSP_ONEREQ_get1_ext_d2i(OCSP_ONEREQ *x, int nid, int *crit, int *idx); +int OCSP_ONEREQ_add1_ext_i2d(OCSP_ONEREQ *x, int nid, void *value, int crit, + unsigned long flags); +int OCSP_ONEREQ_add_ext(OCSP_ONEREQ *x, X509_EXTENSION *ex, int loc); + +int OCSP_BASICRESP_get_ext_count(OCSP_BASICRESP *x); +int OCSP_BASICRESP_get_ext_by_NID(OCSP_BASICRESP *x, int nid, int lastpos); +int OCSP_BASICRESP_get_ext_by_OBJ(OCSP_BASICRESP *x, const ASN1_OBJECT *obj, + int lastpos); +int OCSP_BASICRESP_get_ext_by_critical(OCSP_BASICRESP *x, int crit, + int lastpos); +X509_EXTENSION *OCSP_BASICRESP_get_ext(OCSP_BASICRESP *x, int loc); +X509_EXTENSION *OCSP_BASICRESP_delete_ext(OCSP_BASICRESP *x, int loc); +void *OCSP_BASICRESP_get1_ext_d2i(OCSP_BASICRESP *x, int nid, int *crit, + int *idx); +int OCSP_BASICRESP_add1_ext_i2d(OCSP_BASICRESP *x, int nid, void *value, + int crit, unsigned long flags); +int OCSP_BASICRESP_add_ext(OCSP_BASICRESP *x, X509_EXTENSION *ex, int loc); + +int OCSP_SINGLERESP_get_ext_count(OCSP_SINGLERESP *x); +int OCSP_SINGLERESP_get_ext_by_NID(OCSP_SINGLERESP *x, int nid, int lastpos); +int OCSP_SINGLERESP_get_ext_by_OBJ(OCSP_SINGLERESP *x, const ASN1_OBJECT *obj, + int lastpos); +int OCSP_SINGLERESP_get_ext_by_critical(OCSP_SINGLERESP *x, int crit, + int lastpos); +X509_EXTENSION *OCSP_SINGLERESP_get_ext(OCSP_SINGLERESP *x, int loc); +X509_EXTENSION *OCSP_SINGLERESP_delete_ext(OCSP_SINGLERESP *x, int loc); +void *OCSP_SINGLERESP_get1_ext_d2i(OCSP_SINGLERESP *x, int nid, int *crit, + int *idx); +int OCSP_SINGLERESP_add1_ext_i2d(OCSP_SINGLERESP *x, int nid, void *value, + int crit, unsigned long flags); +int OCSP_SINGLERESP_add_ext(OCSP_SINGLERESP *x, X509_EXTENSION *ex, int loc); +const OCSP_CERTID *OCSP_SINGLERESP_get0_id(const OCSP_SINGLERESP *x); + +DECLARE_ASN1_FUNCTIONS(OCSP_SINGLERESP) +DECLARE_ASN1_FUNCTIONS(OCSP_CERTSTATUS) +DECLARE_ASN1_FUNCTIONS(OCSP_REVOKEDINFO) +DECLARE_ASN1_FUNCTIONS(OCSP_BASICRESP) +DECLARE_ASN1_FUNCTIONS(OCSP_RESPDATA) +DECLARE_ASN1_FUNCTIONS(OCSP_RESPID) +DECLARE_ASN1_FUNCTIONS(OCSP_RESPONSE) +DECLARE_ASN1_FUNCTIONS(OCSP_RESPBYTES) +DECLARE_ASN1_FUNCTIONS(OCSP_ONEREQ) +DECLARE_ASN1_FUNCTIONS(OCSP_CERTID) +DECLARE_ASN1_FUNCTIONS(OCSP_REQUEST) +DECLARE_ASN1_FUNCTIONS(OCSP_SIGNATURE) +DECLARE_ASN1_FUNCTIONS(OCSP_REQINFO) +DECLARE_ASN1_FUNCTIONS(OCSP_CRLID) +DECLARE_ASN1_FUNCTIONS(OCSP_SERVICELOC) + +const char *OCSP_response_status_str(long s); +const char *OCSP_cert_status_str(long s); +const char *OCSP_crl_reason_str(long s); + +int OCSP_REQUEST_print(BIO *bp, OCSP_REQUEST *a, unsigned long flags); +int OCSP_RESPONSE_print(BIO *bp, OCSP_RESPONSE *o, unsigned long flags); + +int OCSP_basic_verify(OCSP_BASICRESP *bs, STACK_OF(X509) *certs, + X509_STORE *st, unsigned long flags); + + +# ifdef __cplusplus +} +# endif +# endif +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/ocsperr.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/ocsperr.h new file mode 100644 index 0000000..8dd9e01 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/ocsperr.h @@ -0,0 +1,78 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_OCSPERR_H +# define HEADER_OCSPERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# include + +# ifndef OPENSSL_NO_OCSP + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_OCSP_strings(void); + +/* + * OCSP function codes. + */ +# define OCSP_F_D2I_OCSP_NONCE 102 +# define OCSP_F_OCSP_BASIC_ADD1_STATUS 103 +# define OCSP_F_OCSP_BASIC_SIGN 104 +# define OCSP_F_OCSP_BASIC_SIGN_CTX 119 +# define OCSP_F_OCSP_BASIC_VERIFY 105 +# define OCSP_F_OCSP_CERT_ID_NEW 101 +# define OCSP_F_OCSP_CHECK_DELEGATED 106 +# define OCSP_F_OCSP_CHECK_IDS 107 +# define OCSP_F_OCSP_CHECK_ISSUER 108 +# define OCSP_F_OCSP_CHECK_VALIDITY 115 +# define OCSP_F_OCSP_MATCH_ISSUERID 109 +# define OCSP_F_OCSP_PARSE_URL 114 +# define OCSP_F_OCSP_REQUEST_SIGN 110 +# define OCSP_F_OCSP_REQUEST_VERIFY 116 +# define OCSP_F_OCSP_RESPONSE_GET1_BASIC 111 +# define OCSP_F_PARSE_HTTP_LINE1 118 + +/* + * OCSP reason codes. + */ +# define OCSP_R_CERTIFICATE_VERIFY_ERROR 101 +# define OCSP_R_DIGEST_ERR 102 +# define OCSP_R_ERROR_IN_NEXTUPDATE_FIELD 122 +# define OCSP_R_ERROR_IN_THISUPDATE_FIELD 123 +# define OCSP_R_ERROR_PARSING_URL 121 +# define OCSP_R_MISSING_OCSPSIGNING_USAGE 103 +# define OCSP_R_NEXTUPDATE_BEFORE_THISUPDATE 124 +# define OCSP_R_NOT_BASIC_RESPONSE 104 +# define OCSP_R_NO_CERTIFICATES_IN_CHAIN 105 +# define OCSP_R_NO_RESPONSE_DATA 108 +# define OCSP_R_NO_REVOKED_TIME 109 +# define OCSP_R_NO_SIGNER_KEY 130 +# define OCSP_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 110 +# define OCSP_R_REQUEST_NOT_SIGNED 128 +# define OCSP_R_RESPONSE_CONTAINS_NO_REVOCATION_DATA 111 +# define OCSP_R_ROOT_CA_NOT_TRUSTED 112 +# define OCSP_R_SERVER_RESPONSE_ERROR 114 +# define OCSP_R_SERVER_RESPONSE_PARSE_ERROR 115 +# define OCSP_R_SIGNATURE_FAILURE 117 +# define OCSP_R_SIGNER_CERTIFICATE_NOT_FOUND 118 +# define OCSP_R_STATUS_EXPIRED 125 +# define OCSP_R_STATUS_NOT_YET_VALID 126 +# define OCSP_R_STATUS_TOO_OLD 127 +# define OCSP_R_UNKNOWN_MESSAGE_DIGEST 119 +# define OCSP_R_UNKNOWN_NID 120 +# define OCSP_R_UNSUPPORTED_REQUESTORNAME_TYPE 129 + +# endif +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/opensslconf.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/opensslconf.h new file mode 100644 index 0000000..942b46d --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/opensslconf.h @@ -0,0 +1,195 @@ +/* + * WARNING: do not edit! + * Generated by Makefile from include/openssl/opensslconf.h.in + * + * Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef OPENSSL_ALGORITHM_DEFINES +# error OPENSSL_ALGORITHM_DEFINES no longer supported +#endif + +/* + * OpenSSL was configured with the following options: + */ + +#ifndef OPENSSL_NO_MD2 +# define OPENSSL_NO_MD2 +#endif +#ifndef OPENSSL_NO_RC5 +# define OPENSSL_NO_RC5 +#endif +#ifndef OPENSSL_THREADS +# define OPENSSL_THREADS +#endif +#ifndef OPENSSL_RAND_SEED_OS +# define OPENSSL_RAND_SEED_OS +#endif +#ifndef OPENSSL_NO_AFALGENG +# define OPENSSL_NO_AFALGENG +#endif +#ifndef OPENSSL_NO_ASAN +# define OPENSSL_NO_ASAN +#endif +#ifndef OPENSSL_NO_CRYPTO_MDEBUG +# define OPENSSL_NO_CRYPTO_MDEBUG +#endif +#ifndef OPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE +# define OPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE +#endif +#ifndef OPENSSL_NO_DEVCRYPTOENG +# define OPENSSL_NO_DEVCRYPTOENG +#endif +#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128 +# define OPENSSL_NO_EC_NISTP_64_GCC_128 +#endif +#ifndef OPENSSL_NO_EGD +# define OPENSSL_NO_EGD +#endif +#ifndef OPENSSL_NO_EXTERNAL_TESTS +# define OPENSSL_NO_EXTERNAL_TESTS +#endif +#ifndef OPENSSL_NO_FUZZ_AFL +# define OPENSSL_NO_FUZZ_AFL +#endif +#ifndef OPENSSL_NO_FUZZ_LIBFUZZER +# define OPENSSL_NO_FUZZ_LIBFUZZER +#endif +#ifndef OPENSSL_NO_HEARTBEATS +# define OPENSSL_NO_HEARTBEATS +#endif +#ifndef OPENSSL_NO_MSAN +# define OPENSSL_NO_MSAN +#endif +#ifndef OPENSSL_NO_SCTP +# define OPENSSL_NO_SCTP +#endif +#ifndef OPENSSL_NO_SSL_TRACE +# define OPENSSL_NO_SSL_TRACE +#endif +#ifndef OPENSSL_NO_SSL3 +# define OPENSSL_NO_SSL3 +#endif +#ifndef OPENSSL_NO_SSL3_METHOD +# define OPENSSL_NO_SSL3_METHOD +#endif +#ifndef OPENSSL_NO_UBSAN +# define OPENSSL_NO_UBSAN +#endif +#ifndef OPENSSL_NO_UNIT_TEST +# define OPENSSL_NO_UNIT_TEST +#endif +#ifndef OPENSSL_NO_WEAK_SSL_CIPHERS +# define OPENSSL_NO_WEAK_SSL_CIPHERS +#endif +#ifndef OPENSSL_NO_STATIC_ENGINE +# define OPENSSL_NO_STATIC_ENGINE +#endif + + +/* + * Sometimes OPENSSSL_NO_xxx ends up with an empty file and some compilers + * don't like that. This will hopefully silence them. + */ +#define NON_EMPTY_TRANSLATION_UNIT static void *dummy = &dummy; + +/* + * Applications should use -DOPENSSL_API_COMPAT= to suppress the + * declarations of functions deprecated in or before . Otherwise, they + * still won't see them if the library has been built to disable deprecated + * functions. + */ +#ifndef DECLARE_DEPRECATED +# define DECLARE_DEPRECATED(f) f; +# ifdef __GNUC__ +# if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 0) +# undef DECLARE_DEPRECATED +# define DECLARE_DEPRECATED(f) f __attribute__ ((deprecated)); +# endif +# endif +#endif + +#ifndef OPENSSL_FILE +# ifdef OPENSSL_NO_FILENAMES +# define OPENSSL_FILE "" +# define OPENSSL_LINE 0 +# else +# define OPENSSL_FILE __FILE__ +# define OPENSSL_LINE __LINE__ +# endif +#endif + +#ifndef OPENSSL_MIN_API +# define OPENSSL_MIN_API 0 +#endif + +#if !defined(OPENSSL_API_COMPAT) || OPENSSL_API_COMPAT < OPENSSL_MIN_API +# undef OPENSSL_API_COMPAT +# define OPENSSL_API_COMPAT OPENSSL_MIN_API +#endif + +/* + * Do not deprecate things to be deprecated in version 1.2.0 before the + * OpenSSL version number matches. + */ +#if OPENSSL_VERSION_NUMBER < 0x10200000L +# define DEPRECATEDIN_1_2_0(f) f; +#elif OPENSSL_API_COMPAT < 0x10200000L +# define DEPRECATEDIN_1_2_0(f) DECLARE_DEPRECATED(f) +#else +# define DEPRECATEDIN_1_2_0(f) +#endif + +#if OPENSSL_API_COMPAT < 0x10100000L +# define DEPRECATEDIN_1_1_0(f) DECLARE_DEPRECATED(f) +#else +# define DEPRECATEDIN_1_1_0(f) +#endif + +#if OPENSSL_API_COMPAT < 0x10000000L +# define DEPRECATEDIN_1_0_0(f) DECLARE_DEPRECATED(f) +#else +# define DEPRECATEDIN_1_0_0(f) +#endif + +#if OPENSSL_API_COMPAT < 0x00908000L +# define DEPRECATEDIN_0_9_8(f) DECLARE_DEPRECATED(f) +#else +# define DEPRECATEDIN_0_9_8(f) +#endif + +/* Generate 80386 code? */ +#undef I386_ONLY + +#undef OPENSSL_UNISTD +#define OPENSSL_UNISTD + +#undef OPENSSL_EXPORT_VAR_AS_FUNCTION + +/* + * The following are cipher-specific, but are part of the public API. + */ +#if !defined(OPENSSL_SYS_UEFI) +# undef BN_LLONG +/* Only one for the following should be defined */ +# define SIXTY_FOUR_BIT_LONG +# undef SIXTY_FOUR_BIT +# undef THIRTY_TWO_BIT +#endif + +#define RC4_INT unsigned int + +#ifdef __cplusplus +} +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/opensslv.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/opensslv.h new file mode 100644 index 0000000..17d271f --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/opensslv.h @@ -0,0 +1,101 @@ +/* + * Copyright 1999-2020 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_OPENSSLV_H +# define HEADER_OPENSSLV_H + +#ifdef __cplusplus +extern "C" { +#endif + +/*- + * Numeric release version identifier: + * MNNFFPPS: major minor fix patch status + * The status nibble has one of the values 0 for development, 1 to e for betas + * 1 to 14, and f for release. The patch level is exactly that. + * For example: + * 0.9.3-dev 0x00903000 + * 0.9.3-beta1 0x00903001 + * 0.9.3-beta2-dev 0x00903002 + * 0.9.3-beta2 0x00903002 (same as ...beta2-dev) + * 0.9.3 0x0090300f + * 0.9.3a 0x0090301f + * 0.9.4 0x0090400f + * 1.2.3z 0x102031af + * + * For continuity reasons (because 0.9.5 is already out, and is coded + * 0x00905100), between 0.9.5 and 0.9.6 the coding of the patch level + * part is slightly different, by setting the highest bit. This means + * that 0.9.5a looks like this: 0x0090581f. At 0.9.6, we can start + * with 0x0090600S... + * + * (Prior to 0.9.3-dev a different scheme was used: 0.9.2b is 0x0922.) + * (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for + * major minor fix final patch/beta) + */ +# define OPENSSL_VERSION_NUMBER 0x1010107fL +# define OPENSSL_VERSION_TEXT "OpenSSL 1.1.1g 21 Apr 2020" + +/*- + * The macros below are to be used for shared library (.so, .dll, ...) + * versioning. That kind of versioning works a bit differently between + * operating systems. The most usual scheme is to set a major and a minor + * number, and have the runtime loader check that the major number is equal + * to what it was at application link time, while the minor number has to + * be greater or equal to what it was at application link time. With this + * scheme, the version number is usually part of the file name, like this: + * + * libcrypto.so.0.9 + * + * Some unixen also make a softlink with the major version number only: + * + * libcrypto.so.0 + * + * On Tru64 and IRIX 6.x it works a little bit differently. There, the + * shared library version is stored in the file, and is actually a series + * of versions, separated by colons. The rightmost version present in the + * library when linking an application is stored in the application to be + * matched at run time. When the application is run, a check is done to + * see if the library version stored in the application matches any of the + * versions in the version string of the library itself. + * This version string can be constructed in any way, depending on what + * kind of matching is desired. However, to implement the same scheme as + * the one used in the other unixen, all compatible versions, from lowest + * to highest, should be part of the string. Consecutive builds would + * give the following versions strings: + * + * 3.0 + * 3.0:3.1 + * 3.0:3.1:3.2 + * 4.0 + * 4.0:4.1 + * + * Notice how version 4 is completely incompatible with version, and + * therefore give the breach you can see. + * + * There may be other schemes as well that I haven't yet discovered. + * + * So, here's the way it works here: first of all, the library version + * number doesn't need at all to match the overall OpenSSL version. + * However, it's nice and more understandable if it actually does. + * The current library version is stored in the macro SHLIB_VERSION_NUMBER, + * which is just a piece of text in the format "M.m.e" (Major, minor, edit). + * For the sake of Tru64, IRIX, and any other OS that behaves in similar ways, + * we need to keep a history of version numbers, which is done in the + * macro SHLIB_VERSION_HISTORY. The numbers are separated by colons and + * should only keep the versions that are binary compatible with the current. + */ +# define SHLIB_VERSION_HISTORY "" +# define SHLIB_VERSION_NUMBER "1.1" + + +#ifdef __cplusplus +} +#endif +#endif /* HEADER_OPENSSLV_H */ diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/ossl_typ.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/ossl_typ.h new file mode 100644 index 0000000..e0edfaa --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/ossl_typ.h @@ -0,0 +1,197 @@ +/* + * Copyright 2001-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_OPENSSL_TYPES_H +# define HEADER_OPENSSL_TYPES_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +# include + +# ifdef NO_ASN1_TYPEDEFS +# define ASN1_INTEGER ASN1_STRING +# define ASN1_ENUMERATED ASN1_STRING +# define ASN1_BIT_STRING ASN1_STRING +# define ASN1_OCTET_STRING ASN1_STRING +# define ASN1_PRINTABLESTRING ASN1_STRING +# define ASN1_T61STRING ASN1_STRING +# define ASN1_IA5STRING ASN1_STRING +# define ASN1_UTCTIME ASN1_STRING +# define ASN1_GENERALIZEDTIME ASN1_STRING +# define ASN1_TIME ASN1_STRING +# define ASN1_GENERALSTRING ASN1_STRING +# define ASN1_UNIVERSALSTRING ASN1_STRING +# define ASN1_BMPSTRING ASN1_STRING +# define ASN1_VISIBLESTRING ASN1_STRING +# define ASN1_UTF8STRING ASN1_STRING +# define ASN1_BOOLEAN int +# define ASN1_NULL int +# else +typedef struct asn1_string_st ASN1_INTEGER; +typedef struct asn1_string_st ASN1_ENUMERATED; +typedef struct asn1_string_st ASN1_BIT_STRING; +typedef struct asn1_string_st ASN1_OCTET_STRING; +typedef struct asn1_string_st ASN1_PRINTABLESTRING; +typedef struct asn1_string_st ASN1_T61STRING; +typedef struct asn1_string_st ASN1_IA5STRING; +typedef struct asn1_string_st ASN1_GENERALSTRING; +typedef struct asn1_string_st ASN1_UNIVERSALSTRING; +typedef struct asn1_string_st ASN1_BMPSTRING; +typedef struct asn1_string_st ASN1_UTCTIME; +typedef struct asn1_string_st ASN1_TIME; +typedef struct asn1_string_st ASN1_GENERALIZEDTIME; +typedef struct asn1_string_st ASN1_VISIBLESTRING; +typedef struct asn1_string_st ASN1_UTF8STRING; +typedef struct asn1_string_st ASN1_STRING; +typedef int ASN1_BOOLEAN; +typedef int ASN1_NULL; +# endif + +typedef struct asn1_object_st ASN1_OBJECT; + +typedef struct ASN1_ITEM_st ASN1_ITEM; +typedef struct asn1_pctx_st ASN1_PCTX; +typedef struct asn1_sctx_st ASN1_SCTX; + +# ifdef _WIN32 +# undef X509_NAME +# undef X509_EXTENSIONS +# undef PKCS7_ISSUER_AND_SERIAL +# undef PKCS7_SIGNER_INFO +# undef OCSP_REQUEST +# undef OCSP_RESPONSE +# endif + +# ifdef BIGNUM +# undef BIGNUM +# endif +struct dane_st; +typedef struct bio_st BIO; +typedef struct bignum_st BIGNUM; +typedef struct bignum_ctx BN_CTX; +typedef struct bn_blinding_st BN_BLINDING; +typedef struct bn_mont_ctx_st BN_MONT_CTX; +typedef struct bn_recp_ctx_st BN_RECP_CTX; +typedef struct bn_gencb_st BN_GENCB; + +typedef struct buf_mem_st BUF_MEM; + +typedef struct evp_cipher_st EVP_CIPHER; +typedef struct evp_cipher_ctx_st EVP_CIPHER_CTX; +typedef struct evp_md_st EVP_MD; +typedef struct evp_md_ctx_st EVP_MD_CTX; +typedef struct evp_pkey_st EVP_PKEY; + +typedef struct evp_pkey_asn1_method_st EVP_PKEY_ASN1_METHOD; + +typedef struct evp_pkey_method_st EVP_PKEY_METHOD; +typedef struct evp_pkey_ctx_st EVP_PKEY_CTX; + +typedef struct evp_Encode_Ctx_st EVP_ENCODE_CTX; + +typedef struct hmac_ctx_st HMAC_CTX; + +typedef struct dh_st DH; +typedef struct dh_method DH_METHOD; + +typedef struct dsa_st DSA; +typedef struct dsa_method DSA_METHOD; + +typedef struct rsa_st RSA; +typedef struct rsa_meth_st RSA_METHOD; +typedef struct rsa_pss_params_st RSA_PSS_PARAMS; + +typedef struct ec_key_st EC_KEY; +typedef struct ec_key_method_st EC_KEY_METHOD; + +typedef struct rand_meth_st RAND_METHOD; +typedef struct rand_drbg_st RAND_DRBG; + +typedef struct ssl_dane_st SSL_DANE; +typedef struct x509_st X509; +typedef struct X509_algor_st X509_ALGOR; +typedef struct X509_crl_st X509_CRL; +typedef struct x509_crl_method_st X509_CRL_METHOD; +typedef struct x509_revoked_st X509_REVOKED; +typedef struct X509_name_st X509_NAME; +typedef struct X509_pubkey_st X509_PUBKEY; +typedef struct x509_store_st X509_STORE; +typedef struct x509_store_ctx_st X509_STORE_CTX; + +typedef struct x509_object_st X509_OBJECT; +typedef struct x509_lookup_st X509_LOOKUP; +typedef struct x509_lookup_method_st X509_LOOKUP_METHOD; +typedef struct X509_VERIFY_PARAM_st X509_VERIFY_PARAM; + +typedef struct x509_sig_info_st X509_SIG_INFO; + +typedef struct pkcs8_priv_key_info_st PKCS8_PRIV_KEY_INFO; + +typedef struct v3_ext_ctx X509V3_CTX; +typedef struct conf_st CONF; +typedef struct ossl_init_settings_st OPENSSL_INIT_SETTINGS; + +typedef struct ui_st UI; +typedef struct ui_method_st UI_METHOD; + +typedef struct engine_st ENGINE; +typedef struct ssl_st SSL; +typedef struct ssl_ctx_st SSL_CTX; + +typedef struct comp_ctx_st COMP_CTX; +typedef struct comp_method_st COMP_METHOD; + +typedef struct X509_POLICY_NODE_st X509_POLICY_NODE; +typedef struct X509_POLICY_LEVEL_st X509_POLICY_LEVEL; +typedef struct X509_POLICY_TREE_st X509_POLICY_TREE; +typedef struct X509_POLICY_CACHE_st X509_POLICY_CACHE; + +typedef struct AUTHORITY_KEYID_st AUTHORITY_KEYID; +typedef struct DIST_POINT_st DIST_POINT; +typedef struct ISSUING_DIST_POINT_st ISSUING_DIST_POINT; +typedef struct NAME_CONSTRAINTS_st NAME_CONSTRAINTS; + +typedef struct crypto_ex_data_st CRYPTO_EX_DATA; + +typedef struct ocsp_req_ctx_st OCSP_REQ_CTX; +typedef struct ocsp_response_st OCSP_RESPONSE; +typedef struct ocsp_responder_id_st OCSP_RESPID; + +typedef struct sct_st SCT; +typedef struct sct_ctx_st SCT_CTX; +typedef struct ctlog_st CTLOG; +typedef struct ctlog_store_st CTLOG_STORE; +typedef struct ct_policy_eval_ctx_st CT_POLICY_EVAL_CTX; + +typedef struct ossl_store_info_st OSSL_STORE_INFO; +typedef struct ossl_store_search_st OSSL_STORE_SEARCH; + +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L && \ + defined(INTMAX_MAX) && defined(UINTMAX_MAX) +typedef intmax_t ossl_intmax_t; +typedef uintmax_t ossl_uintmax_t; +#else +/* + * Not long long, because the C-library can only be expected to provide + * strtoll(), strtoull() at the same time as intmax_t and strtoimax(), + * strtoumax(). Since we use these for parsing arguments, we need the + * conversion functions, not just the sizes. + */ +typedef long ossl_intmax_t; +typedef unsigned long ossl_uintmax_t; +#endif + +#ifdef __cplusplus +} +#endif +#endif /* def HEADER_OPENSSL_TYPES_H */ diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/pem.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/pem.h new file mode 100644 index 0000000..2ef5b5d --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/pem.h @@ -0,0 +1,378 @@ +/* + * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_PEM_H +# define HEADER_PEM_H + +# include +# include +# include +# include +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + +# define PEM_BUFSIZE 1024 + +# define PEM_STRING_X509_OLD "X509 CERTIFICATE" +# define PEM_STRING_X509 "CERTIFICATE" +# define PEM_STRING_X509_TRUSTED "TRUSTED CERTIFICATE" +# define PEM_STRING_X509_REQ_OLD "NEW CERTIFICATE REQUEST" +# define PEM_STRING_X509_REQ "CERTIFICATE REQUEST" +# define PEM_STRING_X509_CRL "X509 CRL" +# define PEM_STRING_EVP_PKEY "ANY PRIVATE KEY" +# define PEM_STRING_PUBLIC "PUBLIC KEY" +# define PEM_STRING_RSA "RSA PRIVATE KEY" +# define PEM_STRING_RSA_PUBLIC "RSA PUBLIC KEY" +# define PEM_STRING_DSA "DSA PRIVATE KEY" +# define PEM_STRING_DSA_PUBLIC "DSA PUBLIC KEY" +# define PEM_STRING_PKCS7 "PKCS7" +# define PEM_STRING_PKCS7_SIGNED "PKCS #7 SIGNED DATA" +# define PEM_STRING_PKCS8 "ENCRYPTED PRIVATE KEY" +# define PEM_STRING_PKCS8INF "PRIVATE KEY" +# define PEM_STRING_DHPARAMS "DH PARAMETERS" +# define PEM_STRING_DHXPARAMS "X9.42 DH PARAMETERS" +# define PEM_STRING_SSL_SESSION "SSL SESSION PARAMETERS" +# define PEM_STRING_DSAPARAMS "DSA PARAMETERS" +# define PEM_STRING_ECDSA_PUBLIC "ECDSA PUBLIC KEY" +# define PEM_STRING_ECPARAMETERS "EC PARAMETERS" +# define PEM_STRING_ECPRIVATEKEY "EC PRIVATE KEY" +# define PEM_STRING_PARAMETERS "PARAMETERS" +# define PEM_STRING_CMS "CMS" + +# define PEM_TYPE_ENCRYPTED 10 +# define PEM_TYPE_MIC_ONLY 20 +# define PEM_TYPE_MIC_CLEAR 30 +# define PEM_TYPE_CLEAR 40 + +/* + * These macros make the PEM_read/PEM_write functions easier to maintain and + * write. Now they are all implemented with either: IMPLEMENT_PEM_rw(...) or + * IMPLEMENT_PEM_rw_cb(...) + */ + +# ifdef OPENSSL_NO_STDIO + +# define IMPLEMENT_PEM_read_fp(name, type, str, asn1) /**/ +# define IMPLEMENT_PEM_write_fp(name, type, str, asn1) /**/ +# define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) /**/ +# define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) /**/ +# define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) /**/ +# else + +# define IMPLEMENT_PEM_read_fp(name, type, str, asn1) \ +type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u)\ +{ \ +return PEM_ASN1_read((d2i_of_void *)d2i_##asn1, str,fp,(void **)x,cb,u); \ +} + +# define IMPLEMENT_PEM_write_fp(name, type, str, asn1) \ +int PEM_write_##name(FILE *fp, type *x) \ +{ \ +return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,x,NULL,NULL,0,NULL,NULL); \ +} + +# define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) \ +int PEM_write_##name(FILE *fp, const type *x) \ +{ \ +return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,(void *)x,NULL,NULL,0,NULL,NULL); \ +} + +# define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) \ +int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \ + unsigned char *kstr, int klen, pem_password_cb *cb, \ + void *u) \ + { \ + return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,x,enc,kstr,klen,cb,u); \ + } + +# define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) \ +int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \ + unsigned char *kstr, int klen, pem_password_cb *cb, \ + void *u) \ + { \ + return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,x,enc,kstr,klen,cb,u); \ + } + +# endif + +# define IMPLEMENT_PEM_read_bio(name, type, str, asn1) \ +type *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u)\ +{ \ +return PEM_ASN1_read_bio((d2i_of_void *)d2i_##asn1, str,bp,(void **)x,cb,u); \ +} + +# define IMPLEMENT_PEM_write_bio(name, type, str, asn1) \ +int PEM_write_bio_##name(BIO *bp, type *x) \ +{ \ +return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,x,NULL,NULL,0,NULL,NULL); \ +} + +# define IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \ +int PEM_write_bio_##name(BIO *bp, const type *x) \ +{ \ +return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,(void *)x,NULL,NULL,0,NULL,NULL); \ +} + +# define IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \ +int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ + unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \ + { \ + return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,x,enc,kstr,klen,cb,u); \ + } + +# define IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \ +int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ + unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \ + { \ + return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,(void *)x,enc,kstr,klen,cb,u); \ + } + +# define IMPLEMENT_PEM_write(name, type, str, asn1) \ + IMPLEMENT_PEM_write_bio(name, type, str, asn1) \ + IMPLEMENT_PEM_write_fp(name, type, str, asn1) + +# define IMPLEMENT_PEM_write_const(name, type, str, asn1) \ + IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \ + IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) + +# define IMPLEMENT_PEM_write_cb(name, type, str, asn1) \ + IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \ + IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) + +# define IMPLEMENT_PEM_write_cb_const(name, type, str, asn1) \ + IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \ + IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) + +# define IMPLEMENT_PEM_read(name, type, str, asn1) \ + IMPLEMENT_PEM_read_bio(name, type, str, asn1) \ + IMPLEMENT_PEM_read_fp(name, type, str, asn1) + +# define IMPLEMENT_PEM_rw(name, type, str, asn1) \ + IMPLEMENT_PEM_read(name, type, str, asn1) \ + IMPLEMENT_PEM_write(name, type, str, asn1) + +# define IMPLEMENT_PEM_rw_const(name, type, str, asn1) \ + IMPLEMENT_PEM_read(name, type, str, asn1) \ + IMPLEMENT_PEM_write_const(name, type, str, asn1) + +# define IMPLEMENT_PEM_rw_cb(name, type, str, asn1) \ + IMPLEMENT_PEM_read(name, type, str, asn1) \ + IMPLEMENT_PEM_write_cb(name, type, str, asn1) + +/* These are the same except they are for the declarations */ + +# if defined(OPENSSL_NO_STDIO) + +# define DECLARE_PEM_read_fp(name, type) /**/ +# define DECLARE_PEM_write_fp(name, type) /**/ +# define DECLARE_PEM_write_fp_const(name, type) /**/ +# define DECLARE_PEM_write_cb_fp(name, type) /**/ +# else + +# define DECLARE_PEM_read_fp(name, type) \ + type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u); + +# define DECLARE_PEM_write_fp(name, type) \ + int PEM_write_##name(FILE *fp, type *x); + +# define DECLARE_PEM_write_fp_const(name, type) \ + int PEM_write_##name(FILE *fp, const type *x); + +# define DECLARE_PEM_write_cb_fp(name, type) \ + int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \ + unsigned char *kstr, int klen, pem_password_cb *cb, void *u); + +# endif + +# define DECLARE_PEM_read_bio(name, type) \ + type *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u); + +# define DECLARE_PEM_write_bio(name, type) \ + int PEM_write_bio_##name(BIO *bp, type *x); + +# define DECLARE_PEM_write_bio_const(name, type) \ + int PEM_write_bio_##name(BIO *bp, const type *x); + +# define DECLARE_PEM_write_cb_bio(name, type) \ + int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ + unsigned char *kstr, int klen, pem_password_cb *cb, void *u); + +# define DECLARE_PEM_write(name, type) \ + DECLARE_PEM_write_bio(name, type) \ + DECLARE_PEM_write_fp(name, type) +# define DECLARE_PEM_write_const(name, type) \ + DECLARE_PEM_write_bio_const(name, type) \ + DECLARE_PEM_write_fp_const(name, type) +# define DECLARE_PEM_write_cb(name, type) \ + DECLARE_PEM_write_cb_bio(name, type) \ + DECLARE_PEM_write_cb_fp(name, type) +# define DECLARE_PEM_read(name, type) \ + DECLARE_PEM_read_bio(name, type) \ + DECLARE_PEM_read_fp(name, type) +# define DECLARE_PEM_rw(name, type) \ + DECLARE_PEM_read(name, type) \ + DECLARE_PEM_write(name, type) +# define DECLARE_PEM_rw_const(name, type) \ + DECLARE_PEM_read(name, type) \ + DECLARE_PEM_write_const(name, type) +# define DECLARE_PEM_rw_cb(name, type) \ + DECLARE_PEM_read(name, type) \ + DECLARE_PEM_write_cb(name, type) +typedef int pem_password_cb (char *buf, int size, int rwflag, void *userdata); + +int PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher); +int PEM_do_header(EVP_CIPHER_INFO *cipher, unsigned char *data, long *len, + pem_password_cb *callback, void *u); + +int PEM_read_bio(BIO *bp, char **name, char **header, + unsigned char **data, long *len); +# define PEM_FLAG_SECURE 0x1 +# define PEM_FLAG_EAY_COMPATIBLE 0x2 +# define PEM_FLAG_ONLY_B64 0x4 +int PEM_read_bio_ex(BIO *bp, char **name, char **header, + unsigned char **data, long *len, unsigned int flags); +int PEM_bytes_read_bio_secmem(unsigned char **pdata, long *plen, char **pnm, + const char *name, BIO *bp, pem_password_cb *cb, + void *u); +int PEM_write_bio(BIO *bp, const char *name, const char *hdr, + const unsigned char *data, long len); +int PEM_bytes_read_bio(unsigned char **pdata, long *plen, char **pnm, + const char *name, BIO *bp, pem_password_cb *cb, + void *u); +void *PEM_ASN1_read_bio(d2i_of_void *d2i, const char *name, BIO *bp, void **x, + pem_password_cb *cb, void *u); +int PEM_ASN1_write_bio(i2d_of_void *i2d, const char *name, BIO *bp, void *x, + const EVP_CIPHER *enc, unsigned char *kstr, int klen, + pem_password_cb *cb, void *u); + +STACK_OF(X509_INFO) *PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk, + pem_password_cb *cb, void *u); +int PEM_X509_INFO_write_bio(BIO *bp, X509_INFO *xi, EVP_CIPHER *enc, + unsigned char *kstr, int klen, + pem_password_cb *cd, void *u); + +#ifndef OPENSSL_NO_STDIO +int PEM_read(FILE *fp, char **name, char **header, + unsigned char **data, long *len); +int PEM_write(FILE *fp, const char *name, const char *hdr, + const unsigned char *data, long len); +void *PEM_ASN1_read(d2i_of_void *d2i, const char *name, FILE *fp, void **x, + pem_password_cb *cb, void *u); +int PEM_ASN1_write(i2d_of_void *i2d, const char *name, FILE *fp, + void *x, const EVP_CIPHER *enc, unsigned char *kstr, + int klen, pem_password_cb *callback, void *u); +STACK_OF(X509_INFO) *PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk, + pem_password_cb *cb, void *u); +#endif + +int PEM_SignInit(EVP_MD_CTX *ctx, EVP_MD *type); +int PEM_SignUpdate(EVP_MD_CTX *ctx, unsigned char *d, unsigned int cnt); +int PEM_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, + unsigned int *siglen, EVP_PKEY *pkey); + +/* The default pem_password_cb that's used internally */ +int PEM_def_callback(char *buf, int num, int rwflag, void *userdata); +void PEM_proc_type(char *buf, int type); +void PEM_dek_info(char *buf, const char *type, int len, char *str); + +# include + +DECLARE_PEM_rw(X509, X509) +DECLARE_PEM_rw(X509_AUX, X509) +DECLARE_PEM_rw(X509_REQ, X509_REQ) +DECLARE_PEM_write(X509_REQ_NEW, X509_REQ) +DECLARE_PEM_rw(X509_CRL, X509_CRL) +DECLARE_PEM_rw(PKCS7, PKCS7) +DECLARE_PEM_rw(NETSCAPE_CERT_SEQUENCE, NETSCAPE_CERT_SEQUENCE) +DECLARE_PEM_rw(PKCS8, X509_SIG) +DECLARE_PEM_rw(PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO) +# ifndef OPENSSL_NO_RSA +DECLARE_PEM_rw_cb(RSAPrivateKey, RSA) +DECLARE_PEM_rw_const(RSAPublicKey, RSA) +DECLARE_PEM_rw(RSA_PUBKEY, RSA) +# endif +# ifndef OPENSSL_NO_DSA +DECLARE_PEM_rw_cb(DSAPrivateKey, DSA) +DECLARE_PEM_rw(DSA_PUBKEY, DSA) +DECLARE_PEM_rw_const(DSAparams, DSA) +# endif +# ifndef OPENSSL_NO_EC +DECLARE_PEM_rw_const(ECPKParameters, EC_GROUP) +DECLARE_PEM_rw_cb(ECPrivateKey, EC_KEY) +DECLARE_PEM_rw(EC_PUBKEY, EC_KEY) +# endif +# ifndef OPENSSL_NO_DH +DECLARE_PEM_rw_const(DHparams, DH) +DECLARE_PEM_write_const(DHxparams, DH) +# endif +DECLARE_PEM_rw_cb(PrivateKey, EVP_PKEY) +DECLARE_PEM_rw(PUBKEY, EVP_PKEY) + +int PEM_write_bio_PrivateKey_traditional(BIO *bp, EVP_PKEY *x, + const EVP_CIPHER *enc, + unsigned char *kstr, int klen, + pem_password_cb *cb, void *u); + +int PEM_write_bio_PKCS8PrivateKey_nid(BIO *bp, EVP_PKEY *x, int nid, + char *kstr, int klen, + pem_password_cb *cb, void *u); +int PEM_write_bio_PKCS8PrivateKey(BIO *, EVP_PKEY *, const EVP_CIPHER *, + char *, int, pem_password_cb *, void *); +int i2d_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc, + char *kstr, int klen, + pem_password_cb *cb, void *u); +int i2d_PKCS8PrivateKey_nid_bio(BIO *bp, EVP_PKEY *x, int nid, + char *kstr, int klen, + pem_password_cb *cb, void *u); +EVP_PKEY *d2i_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, + void *u); + +# ifndef OPENSSL_NO_STDIO +int i2d_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc, + char *kstr, int klen, + pem_password_cb *cb, void *u); +int i2d_PKCS8PrivateKey_nid_fp(FILE *fp, EVP_PKEY *x, int nid, + char *kstr, int klen, + pem_password_cb *cb, void *u); +int PEM_write_PKCS8PrivateKey_nid(FILE *fp, EVP_PKEY *x, int nid, + char *kstr, int klen, + pem_password_cb *cb, void *u); + +EVP_PKEY *d2i_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY **x, pem_password_cb *cb, + void *u); + +int PEM_write_PKCS8PrivateKey(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc, + char *kstr, int klen, pem_password_cb *cd, + void *u); +# endif +EVP_PKEY *PEM_read_bio_Parameters(BIO *bp, EVP_PKEY **x); +int PEM_write_bio_Parameters(BIO *bp, EVP_PKEY *x); + +# ifndef OPENSSL_NO_DSA +EVP_PKEY *b2i_PrivateKey(const unsigned char **in, long length); +EVP_PKEY *b2i_PublicKey(const unsigned char **in, long length); +EVP_PKEY *b2i_PrivateKey_bio(BIO *in); +EVP_PKEY *b2i_PublicKey_bio(BIO *in); +int i2b_PrivateKey_bio(BIO *out, EVP_PKEY *pk); +int i2b_PublicKey_bio(BIO *out, EVP_PKEY *pk); +# ifndef OPENSSL_NO_RC4 +EVP_PKEY *b2i_PVK_bio(BIO *in, pem_password_cb *cb, void *u); +int i2b_PVK_bio(BIO *out, EVP_PKEY *pk, int enclevel, + pem_password_cb *cb, void *u); +# endif +# endif + +# ifdef __cplusplus +} +# endif +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/pem2.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/pem2.h new file mode 100644 index 0000000..038fe79 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/pem2.h @@ -0,0 +1,13 @@ +/* + * Copyright 1999-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_PEM2_H +# define HEADER_PEM2_H +# include +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/pemerr.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/pemerr.h new file mode 100644 index 0000000..0c45918 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/pemerr.h @@ -0,0 +1,103 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_PEMERR_H +# define HEADER_PEMERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_PEM_strings(void); + +/* + * PEM function codes. + */ +# define PEM_F_B2I_DSS 127 +# define PEM_F_B2I_PVK_BIO 128 +# define PEM_F_B2I_RSA 129 +# define PEM_F_CHECK_BITLEN_DSA 130 +# define PEM_F_CHECK_BITLEN_RSA 131 +# define PEM_F_D2I_PKCS8PRIVATEKEY_BIO 120 +# define PEM_F_D2I_PKCS8PRIVATEKEY_FP 121 +# define PEM_F_DO_B2I 132 +# define PEM_F_DO_B2I_BIO 133 +# define PEM_F_DO_BLOB_HEADER 134 +# define PEM_F_DO_I2B 146 +# define PEM_F_DO_PK8PKEY 126 +# define PEM_F_DO_PK8PKEY_FP 125 +# define PEM_F_DO_PVK_BODY 135 +# define PEM_F_DO_PVK_HEADER 136 +# define PEM_F_GET_HEADER_AND_DATA 143 +# define PEM_F_GET_NAME 144 +# define PEM_F_I2B_PVK 137 +# define PEM_F_I2B_PVK_BIO 138 +# define PEM_F_LOAD_IV 101 +# define PEM_F_PEM_ASN1_READ 102 +# define PEM_F_PEM_ASN1_READ_BIO 103 +# define PEM_F_PEM_ASN1_WRITE 104 +# define PEM_F_PEM_ASN1_WRITE_BIO 105 +# define PEM_F_PEM_DEF_CALLBACK 100 +# define PEM_F_PEM_DO_HEADER 106 +# define PEM_F_PEM_GET_EVP_CIPHER_INFO 107 +# define PEM_F_PEM_READ 108 +# define PEM_F_PEM_READ_BIO 109 +# define PEM_F_PEM_READ_BIO_DHPARAMS 141 +# define PEM_F_PEM_READ_BIO_EX 145 +# define PEM_F_PEM_READ_BIO_PARAMETERS 140 +# define PEM_F_PEM_READ_BIO_PRIVATEKEY 123 +# define PEM_F_PEM_READ_DHPARAMS 142 +# define PEM_F_PEM_READ_PRIVATEKEY 124 +# define PEM_F_PEM_SIGNFINAL 112 +# define PEM_F_PEM_WRITE 113 +# define PEM_F_PEM_WRITE_BIO 114 +# define PEM_F_PEM_WRITE_PRIVATEKEY 139 +# define PEM_F_PEM_X509_INFO_READ 115 +# define PEM_F_PEM_X509_INFO_READ_BIO 116 +# define PEM_F_PEM_X509_INFO_WRITE_BIO 117 + +/* + * PEM reason codes. + */ +# define PEM_R_BAD_BASE64_DECODE 100 +# define PEM_R_BAD_DECRYPT 101 +# define PEM_R_BAD_END_LINE 102 +# define PEM_R_BAD_IV_CHARS 103 +# define PEM_R_BAD_MAGIC_NUMBER 116 +# define PEM_R_BAD_PASSWORD_READ 104 +# define PEM_R_BAD_VERSION_NUMBER 117 +# define PEM_R_BIO_WRITE_FAILURE 118 +# define PEM_R_CIPHER_IS_NULL 127 +# define PEM_R_ERROR_CONVERTING_PRIVATE_KEY 115 +# define PEM_R_EXPECTING_PRIVATE_KEY_BLOB 119 +# define PEM_R_EXPECTING_PUBLIC_KEY_BLOB 120 +# define PEM_R_HEADER_TOO_LONG 128 +# define PEM_R_INCONSISTENT_HEADER 121 +# define PEM_R_KEYBLOB_HEADER_PARSE_ERROR 122 +# define PEM_R_KEYBLOB_TOO_SHORT 123 +# define PEM_R_MISSING_DEK_IV 129 +# define PEM_R_NOT_DEK_INFO 105 +# define PEM_R_NOT_ENCRYPTED 106 +# define PEM_R_NOT_PROC_TYPE 107 +# define PEM_R_NO_START_LINE 108 +# define PEM_R_PROBLEMS_GETTING_PASSWORD 109 +# define PEM_R_PVK_DATA_TOO_SHORT 124 +# define PEM_R_PVK_TOO_SHORT 125 +# define PEM_R_READ_KEY 111 +# define PEM_R_SHORT_HEADER 112 +# define PEM_R_UNEXPECTED_DEK_IV 130 +# define PEM_R_UNSUPPORTED_CIPHER 113 +# define PEM_R_UNSUPPORTED_ENCRYPTION 114 +# define PEM_R_UNSUPPORTED_KEY_COMPONENTS 126 + +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/pkcs12.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/pkcs12.h new file mode 100644 index 0000000..3f43dad --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/pkcs12.h @@ -0,0 +1,223 @@ +/* + * Copyright 1999-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_PKCS12_H +# define HEADER_PKCS12_H + +# include +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + +# define PKCS12_KEY_ID 1 +# define PKCS12_IV_ID 2 +# define PKCS12_MAC_ID 3 + +/* Default iteration count */ +# ifndef PKCS12_DEFAULT_ITER +# define PKCS12_DEFAULT_ITER PKCS5_DEFAULT_ITER +# endif + +# define PKCS12_MAC_KEY_LENGTH 20 + +# define PKCS12_SALT_LEN 8 + +/* It's not clear if these are actually needed... */ +# define PKCS12_key_gen PKCS12_key_gen_utf8 +# define PKCS12_add_friendlyname PKCS12_add_friendlyname_utf8 + +/* MS key usage constants */ + +# define KEY_EX 0x10 +# define KEY_SIG 0x80 + +typedef struct PKCS12_MAC_DATA_st PKCS12_MAC_DATA; + +typedef struct PKCS12_st PKCS12; + +typedef struct PKCS12_SAFEBAG_st PKCS12_SAFEBAG; + +DEFINE_STACK_OF(PKCS12_SAFEBAG) + +typedef struct pkcs12_bag_st PKCS12_BAGS; + +# define PKCS12_ERROR 0 +# define PKCS12_OK 1 + +/* Compatibility macros */ + +#if OPENSSL_API_COMPAT < 0x10100000L + +# define M_PKCS12_bag_type PKCS12_bag_type +# define M_PKCS12_cert_bag_type PKCS12_cert_bag_type +# define M_PKCS12_crl_bag_type PKCS12_cert_bag_type + +# define PKCS12_certbag2x509 PKCS12_SAFEBAG_get1_cert +# define PKCS12_certbag2scrl PKCS12_SAFEBAG_get1_crl +# define PKCS12_bag_type PKCS12_SAFEBAG_get_nid +# define PKCS12_cert_bag_type PKCS12_SAFEBAG_get_bag_nid +# define PKCS12_x5092certbag PKCS12_SAFEBAG_create_cert +# define PKCS12_x509crl2certbag PKCS12_SAFEBAG_create_crl +# define PKCS12_MAKE_KEYBAG PKCS12_SAFEBAG_create0_p8inf +# define PKCS12_MAKE_SHKEYBAG PKCS12_SAFEBAG_create_pkcs8_encrypt + +#endif + +DEPRECATEDIN_1_1_0(ASN1_TYPE *PKCS12_get_attr(const PKCS12_SAFEBAG *bag, int attr_nid)) + +ASN1_TYPE *PKCS8_get_attr(PKCS8_PRIV_KEY_INFO *p8, int attr_nid); +int PKCS12_mac_present(const PKCS12 *p12); +void PKCS12_get0_mac(const ASN1_OCTET_STRING **pmac, + const X509_ALGOR **pmacalg, + const ASN1_OCTET_STRING **psalt, + const ASN1_INTEGER **piter, + const PKCS12 *p12); + +const ASN1_TYPE *PKCS12_SAFEBAG_get0_attr(const PKCS12_SAFEBAG *bag, + int attr_nid); +const ASN1_OBJECT *PKCS12_SAFEBAG_get0_type(const PKCS12_SAFEBAG *bag); +int PKCS12_SAFEBAG_get_nid(const PKCS12_SAFEBAG *bag); +int PKCS12_SAFEBAG_get_bag_nid(const PKCS12_SAFEBAG *bag); + +X509 *PKCS12_SAFEBAG_get1_cert(const PKCS12_SAFEBAG *bag); +X509_CRL *PKCS12_SAFEBAG_get1_crl(const PKCS12_SAFEBAG *bag); +const STACK_OF(PKCS12_SAFEBAG) * +PKCS12_SAFEBAG_get0_safes(const PKCS12_SAFEBAG *bag); +const PKCS8_PRIV_KEY_INFO *PKCS12_SAFEBAG_get0_p8inf(const PKCS12_SAFEBAG *bag); +const X509_SIG *PKCS12_SAFEBAG_get0_pkcs8(const PKCS12_SAFEBAG *bag); + +PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_cert(X509 *x509); +PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_crl(X509_CRL *crl); +PKCS12_SAFEBAG *PKCS12_SAFEBAG_create0_p8inf(PKCS8_PRIV_KEY_INFO *p8); +PKCS12_SAFEBAG *PKCS12_SAFEBAG_create0_pkcs8(X509_SIG *p8); +PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_pkcs8_encrypt(int pbe_nid, + const char *pass, + int passlen, + unsigned char *salt, + int saltlen, int iter, + PKCS8_PRIV_KEY_INFO *p8inf); + +PKCS12_SAFEBAG *PKCS12_item_pack_safebag(void *obj, const ASN1_ITEM *it, + int nid1, int nid2); +PKCS8_PRIV_KEY_INFO *PKCS8_decrypt(const X509_SIG *p8, const char *pass, + int passlen); +PKCS8_PRIV_KEY_INFO *PKCS12_decrypt_skey(const PKCS12_SAFEBAG *bag, + const char *pass, int passlen); +X509_SIG *PKCS8_encrypt(int pbe_nid, const EVP_CIPHER *cipher, + const char *pass, int passlen, unsigned char *salt, + int saltlen, int iter, PKCS8_PRIV_KEY_INFO *p8); +X509_SIG *PKCS8_set0_pbe(const char *pass, int passlen, + PKCS8_PRIV_KEY_INFO *p8inf, X509_ALGOR *pbe); +PKCS7 *PKCS12_pack_p7data(STACK_OF(PKCS12_SAFEBAG) *sk); +STACK_OF(PKCS12_SAFEBAG) *PKCS12_unpack_p7data(PKCS7 *p7); +PKCS7 *PKCS12_pack_p7encdata(int pbe_nid, const char *pass, int passlen, + unsigned char *salt, int saltlen, int iter, + STACK_OF(PKCS12_SAFEBAG) *bags); +STACK_OF(PKCS12_SAFEBAG) *PKCS12_unpack_p7encdata(PKCS7 *p7, const char *pass, + int passlen); + +int PKCS12_pack_authsafes(PKCS12 *p12, STACK_OF(PKCS7) *safes); +STACK_OF(PKCS7) *PKCS12_unpack_authsafes(const PKCS12 *p12); + +int PKCS12_add_localkeyid(PKCS12_SAFEBAG *bag, unsigned char *name, + int namelen); +int PKCS12_add_friendlyname_asc(PKCS12_SAFEBAG *bag, const char *name, + int namelen); +int PKCS12_add_friendlyname_utf8(PKCS12_SAFEBAG *bag, const char *name, + int namelen); +int PKCS12_add_CSPName_asc(PKCS12_SAFEBAG *bag, const char *name, + int namelen); +int PKCS12_add_friendlyname_uni(PKCS12_SAFEBAG *bag, + const unsigned char *name, int namelen); +int PKCS8_add_keyusage(PKCS8_PRIV_KEY_INFO *p8, int usage); +ASN1_TYPE *PKCS12_get_attr_gen(const STACK_OF(X509_ATTRIBUTE) *attrs, + int attr_nid); +char *PKCS12_get_friendlyname(PKCS12_SAFEBAG *bag); +const STACK_OF(X509_ATTRIBUTE) * +PKCS12_SAFEBAG_get0_attrs(const PKCS12_SAFEBAG *bag); +unsigned char *PKCS12_pbe_crypt(const X509_ALGOR *algor, + const char *pass, int passlen, + const unsigned char *in, int inlen, + unsigned char **data, int *datalen, + int en_de); +void *PKCS12_item_decrypt_d2i(const X509_ALGOR *algor, const ASN1_ITEM *it, + const char *pass, int passlen, + const ASN1_OCTET_STRING *oct, int zbuf); +ASN1_OCTET_STRING *PKCS12_item_i2d_encrypt(X509_ALGOR *algor, + const ASN1_ITEM *it, + const char *pass, int passlen, + void *obj, int zbuf); +PKCS12 *PKCS12_init(int mode); +int PKCS12_key_gen_asc(const char *pass, int passlen, unsigned char *salt, + int saltlen, int id, int iter, int n, + unsigned char *out, const EVP_MD *md_type); +int PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt, + int saltlen, int id, int iter, int n, + unsigned char *out, const EVP_MD *md_type); +int PKCS12_key_gen_utf8(const char *pass, int passlen, unsigned char *salt, + int saltlen, int id, int iter, int n, + unsigned char *out, const EVP_MD *md_type); +int PKCS12_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, + ASN1_TYPE *param, const EVP_CIPHER *cipher, + const EVP_MD *md_type, int en_de); +int PKCS12_gen_mac(PKCS12 *p12, const char *pass, int passlen, + unsigned char *mac, unsigned int *maclen); +int PKCS12_verify_mac(PKCS12 *p12, const char *pass, int passlen); +int PKCS12_set_mac(PKCS12 *p12, const char *pass, int passlen, + unsigned char *salt, int saltlen, int iter, + const EVP_MD *md_type); +int PKCS12_setup_mac(PKCS12 *p12, int iter, unsigned char *salt, + int saltlen, const EVP_MD *md_type); +unsigned char *OPENSSL_asc2uni(const char *asc, int asclen, + unsigned char **uni, int *unilen); +char *OPENSSL_uni2asc(const unsigned char *uni, int unilen); +unsigned char *OPENSSL_utf82uni(const char *asc, int asclen, + unsigned char **uni, int *unilen); +char *OPENSSL_uni2utf8(const unsigned char *uni, int unilen); + +DECLARE_ASN1_FUNCTIONS(PKCS12) +DECLARE_ASN1_FUNCTIONS(PKCS12_MAC_DATA) +DECLARE_ASN1_FUNCTIONS(PKCS12_SAFEBAG) +DECLARE_ASN1_FUNCTIONS(PKCS12_BAGS) + +DECLARE_ASN1_ITEM(PKCS12_SAFEBAGS) +DECLARE_ASN1_ITEM(PKCS12_AUTHSAFES) + +void PKCS12_PBE_add(void); +int PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert, + STACK_OF(X509) **ca); +PKCS12 *PKCS12_create(const char *pass, const char *name, EVP_PKEY *pkey, + X509 *cert, STACK_OF(X509) *ca, int nid_key, int nid_cert, + int iter, int mac_iter, int keytype); + +PKCS12_SAFEBAG *PKCS12_add_cert(STACK_OF(PKCS12_SAFEBAG) **pbags, X509 *cert); +PKCS12_SAFEBAG *PKCS12_add_key(STACK_OF(PKCS12_SAFEBAG) **pbags, + EVP_PKEY *key, int key_usage, int iter, + int key_nid, const char *pass); +int PKCS12_add_safe(STACK_OF(PKCS7) **psafes, STACK_OF(PKCS12_SAFEBAG) *bags, + int safe_nid, int iter, const char *pass); +PKCS12 *PKCS12_add_safes(STACK_OF(PKCS7) *safes, int p7_nid); + +int i2d_PKCS12_bio(BIO *bp, PKCS12 *p12); +# ifndef OPENSSL_NO_STDIO +int i2d_PKCS12_fp(FILE *fp, PKCS12 *p12); +# endif +PKCS12 *d2i_PKCS12_bio(BIO *bp, PKCS12 **p12); +# ifndef OPENSSL_NO_STDIO +PKCS12 *d2i_PKCS12_fp(FILE *fp, PKCS12 **p12); +# endif +int PKCS12_newpass(PKCS12 *p12, const char *oldpass, const char *newpass); + +# ifdef __cplusplus +} +# endif +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/pkcs12err.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/pkcs12err.h new file mode 100644 index 0000000..eff5eb2 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/pkcs12err.h @@ -0,0 +1,81 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_PKCS12ERR_H +# define HEADER_PKCS12ERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_PKCS12_strings(void); + +/* + * PKCS12 function codes. + */ +# define PKCS12_F_OPENSSL_ASC2UNI 121 +# define PKCS12_F_OPENSSL_UNI2ASC 124 +# define PKCS12_F_OPENSSL_UNI2UTF8 127 +# define PKCS12_F_OPENSSL_UTF82UNI 129 +# define PKCS12_F_PKCS12_CREATE 105 +# define PKCS12_F_PKCS12_GEN_MAC 107 +# define PKCS12_F_PKCS12_INIT 109 +# define PKCS12_F_PKCS12_ITEM_DECRYPT_D2I 106 +# define PKCS12_F_PKCS12_ITEM_I2D_ENCRYPT 108 +# define PKCS12_F_PKCS12_ITEM_PACK_SAFEBAG 117 +# define PKCS12_F_PKCS12_KEY_GEN_ASC 110 +# define PKCS12_F_PKCS12_KEY_GEN_UNI 111 +# define PKCS12_F_PKCS12_KEY_GEN_UTF8 116 +# define PKCS12_F_PKCS12_NEWPASS 128 +# define PKCS12_F_PKCS12_PACK_P7DATA 114 +# define PKCS12_F_PKCS12_PACK_P7ENCDATA 115 +# define PKCS12_F_PKCS12_PARSE 118 +# define PKCS12_F_PKCS12_PBE_CRYPT 119 +# define PKCS12_F_PKCS12_PBE_KEYIVGEN 120 +# define PKCS12_F_PKCS12_SAFEBAG_CREATE0_P8INF 112 +# define PKCS12_F_PKCS12_SAFEBAG_CREATE0_PKCS8 113 +# define PKCS12_F_PKCS12_SAFEBAG_CREATE_PKCS8_ENCRYPT 133 +# define PKCS12_F_PKCS12_SETUP_MAC 122 +# define PKCS12_F_PKCS12_SET_MAC 123 +# define PKCS12_F_PKCS12_UNPACK_AUTHSAFES 130 +# define PKCS12_F_PKCS12_UNPACK_P7DATA 131 +# define PKCS12_F_PKCS12_VERIFY_MAC 126 +# define PKCS12_F_PKCS8_ENCRYPT 125 +# define PKCS12_F_PKCS8_SET0_PBE 132 + +/* + * PKCS12 reason codes. + */ +# define PKCS12_R_CANT_PACK_STRUCTURE 100 +# define PKCS12_R_CONTENT_TYPE_NOT_DATA 121 +# define PKCS12_R_DECODE_ERROR 101 +# define PKCS12_R_ENCODE_ERROR 102 +# define PKCS12_R_ENCRYPT_ERROR 103 +# define PKCS12_R_ERROR_SETTING_ENCRYPTED_DATA_TYPE 120 +# define PKCS12_R_INVALID_NULL_ARGUMENT 104 +# define PKCS12_R_INVALID_NULL_PKCS12_POINTER 105 +# define PKCS12_R_IV_GEN_ERROR 106 +# define PKCS12_R_KEY_GEN_ERROR 107 +# define PKCS12_R_MAC_ABSENT 108 +# define PKCS12_R_MAC_GENERATION_ERROR 109 +# define PKCS12_R_MAC_SETUP_ERROR 110 +# define PKCS12_R_MAC_STRING_SET_ERROR 111 +# define PKCS12_R_MAC_VERIFY_FAILURE 113 +# define PKCS12_R_PARSE_ERROR 114 +# define PKCS12_R_PKCS12_ALGOR_CIPHERINIT_ERROR 115 +# define PKCS12_R_PKCS12_CIPHERFINAL_ERROR 116 +# define PKCS12_R_PKCS12_PBE_CRYPT_ERROR 117 +# define PKCS12_R_UNKNOWN_DIGEST_ALGORITHM 118 +# define PKCS12_R_UNSUPPORTED_PKCS12_MODE 119 + +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/pkcs7.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/pkcs7.h new file mode 100644 index 0000000..9b66e00 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/pkcs7.h @@ -0,0 +1,319 @@ +/* + * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_PKCS7_H +# define HEADER_PKCS7_H + +# include +# include +# include + +# include +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + +/*- +Encryption_ID DES-CBC +Digest_ID MD5 +Digest_Encryption_ID rsaEncryption +Key_Encryption_ID rsaEncryption +*/ + +typedef struct pkcs7_issuer_and_serial_st { + X509_NAME *issuer; + ASN1_INTEGER *serial; +} PKCS7_ISSUER_AND_SERIAL; + +typedef struct pkcs7_signer_info_st { + ASN1_INTEGER *version; /* version 1 */ + PKCS7_ISSUER_AND_SERIAL *issuer_and_serial; + X509_ALGOR *digest_alg; + STACK_OF(X509_ATTRIBUTE) *auth_attr; /* [ 0 ] */ + X509_ALGOR *digest_enc_alg; + ASN1_OCTET_STRING *enc_digest; + STACK_OF(X509_ATTRIBUTE) *unauth_attr; /* [ 1 ] */ + /* The private key to sign with */ + EVP_PKEY *pkey; +} PKCS7_SIGNER_INFO; + +DEFINE_STACK_OF(PKCS7_SIGNER_INFO) + +typedef struct pkcs7_recip_info_st { + ASN1_INTEGER *version; /* version 0 */ + PKCS7_ISSUER_AND_SERIAL *issuer_and_serial; + X509_ALGOR *key_enc_algor; + ASN1_OCTET_STRING *enc_key; + X509 *cert; /* get the pub-key from this */ +} PKCS7_RECIP_INFO; + +DEFINE_STACK_OF(PKCS7_RECIP_INFO) + +typedef struct pkcs7_signed_st { + ASN1_INTEGER *version; /* version 1 */ + STACK_OF(X509_ALGOR) *md_algs; /* md used */ + STACK_OF(X509) *cert; /* [ 0 ] */ + STACK_OF(X509_CRL) *crl; /* [ 1 ] */ + STACK_OF(PKCS7_SIGNER_INFO) *signer_info; + struct pkcs7_st *contents; +} PKCS7_SIGNED; +/* + * The above structure is very very similar to PKCS7_SIGN_ENVELOPE. How about + * merging the two + */ + +typedef struct pkcs7_enc_content_st { + ASN1_OBJECT *content_type; + X509_ALGOR *algorithm; + ASN1_OCTET_STRING *enc_data; /* [ 0 ] */ + const EVP_CIPHER *cipher; +} PKCS7_ENC_CONTENT; + +typedef struct pkcs7_enveloped_st { + ASN1_INTEGER *version; /* version 0 */ + STACK_OF(PKCS7_RECIP_INFO) *recipientinfo; + PKCS7_ENC_CONTENT *enc_data; +} PKCS7_ENVELOPE; + +typedef struct pkcs7_signedandenveloped_st { + ASN1_INTEGER *version; /* version 1 */ + STACK_OF(X509_ALGOR) *md_algs; /* md used */ + STACK_OF(X509) *cert; /* [ 0 ] */ + STACK_OF(X509_CRL) *crl; /* [ 1 ] */ + STACK_OF(PKCS7_SIGNER_INFO) *signer_info; + PKCS7_ENC_CONTENT *enc_data; + STACK_OF(PKCS7_RECIP_INFO) *recipientinfo; +} PKCS7_SIGN_ENVELOPE; + +typedef struct pkcs7_digest_st { + ASN1_INTEGER *version; /* version 0 */ + X509_ALGOR *md; /* md used */ + struct pkcs7_st *contents; + ASN1_OCTET_STRING *digest; +} PKCS7_DIGEST; + +typedef struct pkcs7_encrypted_st { + ASN1_INTEGER *version; /* version 0 */ + PKCS7_ENC_CONTENT *enc_data; +} PKCS7_ENCRYPT; + +typedef struct pkcs7_st { + /* + * The following is non NULL if it contains ASN1 encoding of this + * structure + */ + unsigned char *asn1; + long length; +# define PKCS7_S_HEADER 0 +# define PKCS7_S_BODY 1 +# define PKCS7_S_TAIL 2 + int state; /* used during processing */ + int detached; + ASN1_OBJECT *type; + /* content as defined by the type */ + /* + * all encryption/message digests are applied to the 'contents', leaving + * out the 'type' field. + */ + union { + char *ptr; + /* NID_pkcs7_data */ + ASN1_OCTET_STRING *data; + /* NID_pkcs7_signed */ + PKCS7_SIGNED *sign; + /* NID_pkcs7_enveloped */ + PKCS7_ENVELOPE *enveloped; + /* NID_pkcs7_signedAndEnveloped */ + PKCS7_SIGN_ENVELOPE *signed_and_enveloped; + /* NID_pkcs7_digest */ + PKCS7_DIGEST *digest; + /* NID_pkcs7_encrypted */ + PKCS7_ENCRYPT *encrypted; + /* Anything else */ + ASN1_TYPE *other; + } d; +} PKCS7; + +DEFINE_STACK_OF(PKCS7) + +# define PKCS7_OP_SET_DETACHED_SIGNATURE 1 +# define PKCS7_OP_GET_DETACHED_SIGNATURE 2 + +# define PKCS7_get_signed_attributes(si) ((si)->auth_attr) +# define PKCS7_get_attributes(si) ((si)->unauth_attr) + +# define PKCS7_type_is_signed(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_signed) +# define PKCS7_type_is_encrypted(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_encrypted) +# define PKCS7_type_is_enveloped(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_enveloped) +# define PKCS7_type_is_signedAndEnveloped(a) \ + (OBJ_obj2nid((a)->type) == NID_pkcs7_signedAndEnveloped) +# define PKCS7_type_is_data(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_data) +# define PKCS7_type_is_digest(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_digest) + +# define PKCS7_set_detached(p,v) \ + PKCS7_ctrl(p,PKCS7_OP_SET_DETACHED_SIGNATURE,v,NULL) +# define PKCS7_get_detached(p) \ + PKCS7_ctrl(p,PKCS7_OP_GET_DETACHED_SIGNATURE,0,NULL) + +# define PKCS7_is_detached(p7) (PKCS7_type_is_signed(p7) && PKCS7_get_detached(p7)) + +/* S/MIME related flags */ + +# define PKCS7_TEXT 0x1 +# define PKCS7_NOCERTS 0x2 +# define PKCS7_NOSIGS 0x4 +# define PKCS7_NOCHAIN 0x8 +# define PKCS7_NOINTERN 0x10 +# define PKCS7_NOVERIFY 0x20 +# define PKCS7_DETACHED 0x40 +# define PKCS7_BINARY 0x80 +# define PKCS7_NOATTR 0x100 +# define PKCS7_NOSMIMECAP 0x200 +# define PKCS7_NOOLDMIMETYPE 0x400 +# define PKCS7_CRLFEOL 0x800 +# define PKCS7_STREAM 0x1000 +# define PKCS7_NOCRL 0x2000 +# define PKCS7_PARTIAL 0x4000 +# define PKCS7_REUSE_DIGEST 0x8000 +# define PKCS7_NO_DUAL_CONTENT 0x10000 + +/* Flags: for compatibility with older code */ + +# define SMIME_TEXT PKCS7_TEXT +# define SMIME_NOCERTS PKCS7_NOCERTS +# define SMIME_NOSIGS PKCS7_NOSIGS +# define SMIME_NOCHAIN PKCS7_NOCHAIN +# define SMIME_NOINTERN PKCS7_NOINTERN +# define SMIME_NOVERIFY PKCS7_NOVERIFY +# define SMIME_DETACHED PKCS7_DETACHED +# define SMIME_BINARY PKCS7_BINARY +# define SMIME_NOATTR PKCS7_NOATTR + +/* CRLF ASCII canonicalisation */ +# define SMIME_ASCIICRLF 0x80000 + +DECLARE_ASN1_FUNCTIONS(PKCS7_ISSUER_AND_SERIAL) + +int PKCS7_ISSUER_AND_SERIAL_digest(PKCS7_ISSUER_AND_SERIAL *data, + const EVP_MD *type, unsigned char *md, + unsigned int *len); +# ifndef OPENSSL_NO_STDIO +PKCS7 *d2i_PKCS7_fp(FILE *fp, PKCS7 **p7); +int i2d_PKCS7_fp(FILE *fp, PKCS7 *p7); +# endif +PKCS7 *PKCS7_dup(PKCS7 *p7); +PKCS7 *d2i_PKCS7_bio(BIO *bp, PKCS7 **p7); +int i2d_PKCS7_bio(BIO *bp, PKCS7 *p7); +int i2d_PKCS7_bio_stream(BIO *out, PKCS7 *p7, BIO *in, int flags); +int PEM_write_bio_PKCS7_stream(BIO *out, PKCS7 *p7, BIO *in, int flags); + +DECLARE_ASN1_FUNCTIONS(PKCS7_SIGNER_INFO) +DECLARE_ASN1_FUNCTIONS(PKCS7_RECIP_INFO) +DECLARE_ASN1_FUNCTIONS(PKCS7_SIGNED) +DECLARE_ASN1_FUNCTIONS(PKCS7_ENC_CONTENT) +DECLARE_ASN1_FUNCTIONS(PKCS7_ENVELOPE) +DECLARE_ASN1_FUNCTIONS(PKCS7_SIGN_ENVELOPE) +DECLARE_ASN1_FUNCTIONS(PKCS7_DIGEST) +DECLARE_ASN1_FUNCTIONS(PKCS7_ENCRYPT) +DECLARE_ASN1_FUNCTIONS(PKCS7) + +DECLARE_ASN1_ITEM(PKCS7_ATTR_SIGN) +DECLARE_ASN1_ITEM(PKCS7_ATTR_VERIFY) + +DECLARE_ASN1_NDEF_FUNCTION(PKCS7) +DECLARE_ASN1_PRINT_FUNCTION(PKCS7) + +long PKCS7_ctrl(PKCS7 *p7, int cmd, long larg, char *parg); + +int PKCS7_set_type(PKCS7 *p7, int type); +int PKCS7_set0_type_other(PKCS7 *p7, int type, ASN1_TYPE *other); +int PKCS7_set_content(PKCS7 *p7, PKCS7 *p7_data); +int PKCS7_SIGNER_INFO_set(PKCS7_SIGNER_INFO *p7i, X509 *x509, EVP_PKEY *pkey, + const EVP_MD *dgst); +int PKCS7_SIGNER_INFO_sign(PKCS7_SIGNER_INFO *si); +int PKCS7_add_signer(PKCS7 *p7, PKCS7_SIGNER_INFO *p7i); +int PKCS7_add_certificate(PKCS7 *p7, X509 *x509); +int PKCS7_add_crl(PKCS7 *p7, X509_CRL *x509); +int PKCS7_content_new(PKCS7 *p7, int nid); +int PKCS7_dataVerify(X509_STORE *cert_store, X509_STORE_CTX *ctx, + BIO *bio, PKCS7 *p7, PKCS7_SIGNER_INFO *si); +int PKCS7_signatureVerify(BIO *bio, PKCS7 *p7, PKCS7_SIGNER_INFO *si, + X509 *x509); + +BIO *PKCS7_dataInit(PKCS7 *p7, BIO *bio); +int PKCS7_dataFinal(PKCS7 *p7, BIO *bio); +BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert); + +PKCS7_SIGNER_INFO *PKCS7_add_signature(PKCS7 *p7, X509 *x509, + EVP_PKEY *pkey, const EVP_MD *dgst); +X509 *PKCS7_cert_from_signer_info(PKCS7 *p7, PKCS7_SIGNER_INFO *si); +int PKCS7_set_digest(PKCS7 *p7, const EVP_MD *md); +STACK_OF(PKCS7_SIGNER_INFO) *PKCS7_get_signer_info(PKCS7 *p7); + +PKCS7_RECIP_INFO *PKCS7_add_recipient(PKCS7 *p7, X509 *x509); +void PKCS7_SIGNER_INFO_get0_algs(PKCS7_SIGNER_INFO *si, EVP_PKEY **pk, + X509_ALGOR **pdig, X509_ALGOR **psig); +void PKCS7_RECIP_INFO_get0_alg(PKCS7_RECIP_INFO *ri, X509_ALGOR **penc); +int PKCS7_add_recipient_info(PKCS7 *p7, PKCS7_RECIP_INFO *ri); +int PKCS7_RECIP_INFO_set(PKCS7_RECIP_INFO *p7i, X509 *x509); +int PKCS7_set_cipher(PKCS7 *p7, const EVP_CIPHER *cipher); +int PKCS7_stream(unsigned char ***boundary, PKCS7 *p7); + +PKCS7_ISSUER_AND_SERIAL *PKCS7_get_issuer_and_serial(PKCS7 *p7, int idx); +ASN1_OCTET_STRING *PKCS7_digest_from_attributes(STACK_OF(X509_ATTRIBUTE) *sk); +int PKCS7_add_signed_attribute(PKCS7_SIGNER_INFO *p7si, int nid, int type, + void *data); +int PKCS7_add_attribute(PKCS7_SIGNER_INFO *p7si, int nid, int atrtype, + void *value); +ASN1_TYPE *PKCS7_get_attribute(PKCS7_SIGNER_INFO *si, int nid); +ASN1_TYPE *PKCS7_get_signed_attribute(PKCS7_SIGNER_INFO *si, int nid); +int PKCS7_set_signed_attributes(PKCS7_SIGNER_INFO *p7si, + STACK_OF(X509_ATTRIBUTE) *sk); +int PKCS7_set_attributes(PKCS7_SIGNER_INFO *p7si, + STACK_OF(X509_ATTRIBUTE) *sk); + +PKCS7 *PKCS7_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs, + BIO *data, int flags); + +PKCS7_SIGNER_INFO *PKCS7_sign_add_signer(PKCS7 *p7, + X509 *signcert, EVP_PKEY *pkey, + const EVP_MD *md, int flags); + +int PKCS7_final(PKCS7 *p7, BIO *data, int flags); +int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store, + BIO *indata, BIO *out, int flags); +STACK_OF(X509) *PKCS7_get0_signers(PKCS7 *p7, STACK_OF(X509) *certs, + int flags); +PKCS7 *PKCS7_encrypt(STACK_OF(X509) *certs, BIO *in, const EVP_CIPHER *cipher, + int flags); +int PKCS7_decrypt(PKCS7 *p7, EVP_PKEY *pkey, X509 *cert, BIO *data, + int flags); + +int PKCS7_add_attrib_smimecap(PKCS7_SIGNER_INFO *si, + STACK_OF(X509_ALGOR) *cap); +STACK_OF(X509_ALGOR) *PKCS7_get_smimecap(PKCS7_SIGNER_INFO *si); +int PKCS7_simple_smimecap(STACK_OF(X509_ALGOR) *sk, int nid, int arg); + +int PKCS7_add_attrib_content_type(PKCS7_SIGNER_INFO *si, ASN1_OBJECT *coid); +int PKCS7_add0_attrib_signing_time(PKCS7_SIGNER_INFO *si, ASN1_TIME *t); +int PKCS7_add1_attrib_digest(PKCS7_SIGNER_INFO *si, + const unsigned char *md, int mdlen); + +int SMIME_write_PKCS7(BIO *bio, PKCS7 *p7, BIO *data, int flags); +PKCS7 *SMIME_read_PKCS7(BIO *bio, BIO **bcont); + +BIO *BIO_new_PKCS7(BIO *out, PKCS7 *p7); + +# ifdef __cplusplus +} +# endif +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/pkcs7err.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/pkcs7err.h new file mode 100644 index 0000000..02e0299 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/pkcs7err.h @@ -0,0 +1,103 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_PKCS7ERR_H +# define HEADER_PKCS7ERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_PKCS7_strings(void); + +/* + * PKCS7 function codes. + */ +# define PKCS7_F_DO_PKCS7_SIGNED_ATTRIB 136 +# define PKCS7_F_PKCS7_ADD0_ATTRIB_SIGNING_TIME 135 +# define PKCS7_F_PKCS7_ADD_ATTRIB_SMIMECAP 118 +# define PKCS7_F_PKCS7_ADD_CERTIFICATE 100 +# define PKCS7_F_PKCS7_ADD_CRL 101 +# define PKCS7_F_PKCS7_ADD_RECIPIENT_INFO 102 +# define PKCS7_F_PKCS7_ADD_SIGNATURE 131 +# define PKCS7_F_PKCS7_ADD_SIGNER 103 +# define PKCS7_F_PKCS7_BIO_ADD_DIGEST 125 +# define PKCS7_F_PKCS7_COPY_EXISTING_DIGEST 138 +# define PKCS7_F_PKCS7_CTRL 104 +# define PKCS7_F_PKCS7_DATADECODE 112 +# define PKCS7_F_PKCS7_DATAFINAL 128 +# define PKCS7_F_PKCS7_DATAINIT 105 +# define PKCS7_F_PKCS7_DATAVERIFY 107 +# define PKCS7_F_PKCS7_DECRYPT 114 +# define PKCS7_F_PKCS7_DECRYPT_RINFO 133 +# define PKCS7_F_PKCS7_ENCODE_RINFO 132 +# define PKCS7_F_PKCS7_ENCRYPT 115 +# define PKCS7_F_PKCS7_FINAL 134 +# define PKCS7_F_PKCS7_FIND_DIGEST 127 +# define PKCS7_F_PKCS7_GET0_SIGNERS 124 +# define PKCS7_F_PKCS7_RECIP_INFO_SET 130 +# define PKCS7_F_PKCS7_SET_CIPHER 108 +# define PKCS7_F_PKCS7_SET_CONTENT 109 +# define PKCS7_F_PKCS7_SET_DIGEST 126 +# define PKCS7_F_PKCS7_SET_TYPE 110 +# define PKCS7_F_PKCS7_SIGN 116 +# define PKCS7_F_PKCS7_SIGNATUREVERIFY 113 +# define PKCS7_F_PKCS7_SIGNER_INFO_SET 129 +# define PKCS7_F_PKCS7_SIGNER_INFO_SIGN 139 +# define PKCS7_F_PKCS7_SIGN_ADD_SIGNER 137 +# define PKCS7_F_PKCS7_SIMPLE_SMIMECAP 119 +# define PKCS7_F_PKCS7_VERIFY 117 + +/* + * PKCS7 reason codes. + */ +# define PKCS7_R_CERTIFICATE_VERIFY_ERROR 117 +# define PKCS7_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER 144 +# define PKCS7_R_CIPHER_NOT_INITIALIZED 116 +# define PKCS7_R_CONTENT_AND_DATA_PRESENT 118 +# define PKCS7_R_CTRL_ERROR 152 +# define PKCS7_R_DECRYPT_ERROR 119 +# define PKCS7_R_DIGEST_FAILURE 101 +# define PKCS7_R_ENCRYPTION_CTRL_FAILURE 149 +# define PKCS7_R_ENCRYPTION_NOT_SUPPORTED_FOR_THIS_KEY_TYPE 150 +# define PKCS7_R_ERROR_ADDING_RECIPIENT 120 +# define PKCS7_R_ERROR_SETTING_CIPHER 121 +# define PKCS7_R_INVALID_NULL_POINTER 143 +# define PKCS7_R_INVALID_SIGNED_DATA_TYPE 155 +# define PKCS7_R_NO_CONTENT 122 +# define PKCS7_R_NO_DEFAULT_DIGEST 151 +# define PKCS7_R_NO_MATCHING_DIGEST_TYPE_FOUND 154 +# define PKCS7_R_NO_RECIPIENT_MATCHES_CERTIFICATE 115 +# define PKCS7_R_NO_SIGNATURES_ON_DATA 123 +# define PKCS7_R_NO_SIGNERS 142 +# define PKCS7_R_OPERATION_NOT_SUPPORTED_ON_THIS_TYPE 104 +# define PKCS7_R_PKCS7_ADD_SIGNATURE_ERROR 124 +# define PKCS7_R_PKCS7_ADD_SIGNER_ERROR 153 +# define PKCS7_R_PKCS7_DATASIGN 145 +# define PKCS7_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 127 +# define PKCS7_R_SIGNATURE_FAILURE 105 +# define PKCS7_R_SIGNER_CERTIFICATE_NOT_FOUND 128 +# define PKCS7_R_SIGNING_CTRL_FAILURE 147 +# define PKCS7_R_SIGNING_NOT_SUPPORTED_FOR_THIS_KEY_TYPE 148 +# define PKCS7_R_SMIME_TEXT_ERROR 129 +# define PKCS7_R_UNABLE_TO_FIND_CERTIFICATE 106 +# define PKCS7_R_UNABLE_TO_FIND_MEM_BIO 107 +# define PKCS7_R_UNABLE_TO_FIND_MESSAGE_DIGEST 108 +# define PKCS7_R_UNKNOWN_DIGEST_TYPE 109 +# define PKCS7_R_UNKNOWN_OPERATION 110 +# define PKCS7_R_UNSUPPORTED_CIPHER_TYPE 111 +# define PKCS7_R_UNSUPPORTED_CONTENT_TYPE 112 +# define PKCS7_R_WRONG_CONTENT_TYPE 113 +# define PKCS7_R_WRONG_PKCS7_TYPE 114 + +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/rand.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/rand.h new file mode 100644 index 0000000..38a2a27 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/rand.h @@ -0,0 +1,77 @@ +/* + * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_RAND_H +# define HEADER_RAND_H + +# include +# include +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + +struct rand_meth_st { + int (*seed) (const void *buf, int num); + int (*bytes) (unsigned char *buf, int num); + void (*cleanup) (void); + int (*add) (const void *buf, int num, double randomness); + int (*pseudorand) (unsigned char *buf, int num); + int (*status) (void); +}; + +int RAND_set_rand_method(const RAND_METHOD *meth); +const RAND_METHOD *RAND_get_rand_method(void); +# ifndef OPENSSL_NO_ENGINE +int RAND_set_rand_engine(ENGINE *engine); +# endif + +RAND_METHOD *RAND_OpenSSL(void); + +# if OPENSSL_API_COMPAT < 0x10100000L +# define RAND_cleanup() while(0) continue +# endif +int RAND_bytes(unsigned char *buf, int num); +int RAND_priv_bytes(unsigned char *buf, int num); +DEPRECATEDIN_1_1_0(int RAND_pseudo_bytes(unsigned char *buf, int num)) + +void RAND_seed(const void *buf, int num); +void RAND_keep_random_devices_open(int keep); + +# if defined(__ANDROID__) && defined(__NDK_FPABI__) +__NDK_FPABI__ /* __attribute__((pcs("aapcs"))) on ARM */ +# endif +void RAND_add(const void *buf, int num, double randomness); +int RAND_load_file(const char *file, long max_bytes); +int RAND_write_file(const char *file); +const char *RAND_file_name(char *file, size_t num); +int RAND_status(void); + +# ifndef OPENSSL_NO_EGD +int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes); +int RAND_egd(const char *path); +int RAND_egd_bytes(const char *path, int bytes); +# endif + +int RAND_poll(void); + +# if defined(_WIN32) && (defined(BASETYPES) || defined(_WINDEF_H)) +/* application has to include in order to use these */ +DEPRECATEDIN_1_1_0(void RAND_screen(void)) +DEPRECATEDIN_1_1_0(int RAND_event(UINT, WPARAM, LPARAM)) +# endif + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/rand_drbg.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/rand_drbg.h new file mode 100644 index 0000000..45b731b --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/rand_drbg.h @@ -0,0 +1,130 @@ +/* + * Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_DRBG_RAND_H +# define HEADER_DRBG_RAND_H + +# include +# include +# include + +/* + * RAND_DRBG flags + * + * Note: if new flags are added, the constant `rand_drbg_used_flags` + * in drbg_lib.c needs to be updated accordingly. + */ + +/* In CTR mode, disable derivation function ctr_df */ +# define RAND_DRBG_FLAG_CTR_NO_DF 0x1 + + +# if OPENSSL_API_COMPAT < 0x10200000L +/* This #define was replaced by an internal constant and should not be used. */ +# define RAND_DRBG_USED_FLAGS (RAND_DRBG_FLAG_CTR_NO_DF) +# endif + +/* + * Default security strength (in the sense of [NIST SP 800-90Ar1]) + * + * NIST SP 800-90Ar1 supports the strength of the DRBG being smaller than that + * of the cipher by collecting less entropy. The current DRBG implementation + * does not take RAND_DRBG_STRENGTH into account and sets the strength of the + * DRBG to that of the cipher. + * + * RAND_DRBG_STRENGTH is currently only used for the legacy RAND + * implementation. + * + * Currently supported ciphers are: NID_aes_128_ctr, NID_aes_192_ctr and + * NID_aes_256_ctr + */ +# define RAND_DRBG_STRENGTH 256 +/* Default drbg type */ +# define RAND_DRBG_TYPE NID_aes_256_ctr +/* Default drbg flags */ +# define RAND_DRBG_FLAGS 0 + + +# ifdef __cplusplus +extern "C" { +# endif + +/* + * Object lifetime functions. + */ +RAND_DRBG *RAND_DRBG_new(int type, unsigned int flags, RAND_DRBG *parent); +RAND_DRBG *RAND_DRBG_secure_new(int type, unsigned int flags, RAND_DRBG *parent); +int RAND_DRBG_set(RAND_DRBG *drbg, int type, unsigned int flags); +int RAND_DRBG_set_defaults(int type, unsigned int flags); +int RAND_DRBG_instantiate(RAND_DRBG *drbg, + const unsigned char *pers, size_t perslen); +int RAND_DRBG_uninstantiate(RAND_DRBG *drbg); +void RAND_DRBG_free(RAND_DRBG *drbg); + +/* + * Object "use" functions. + */ +int RAND_DRBG_reseed(RAND_DRBG *drbg, + const unsigned char *adin, size_t adinlen, + int prediction_resistance); +int RAND_DRBG_generate(RAND_DRBG *drbg, unsigned char *out, size_t outlen, + int prediction_resistance, + const unsigned char *adin, size_t adinlen); +int RAND_DRBG_bytes(RAND_DRBG *drbg, unsigned char *out, size_t outlen); + +int RAND_DRBG_set_reseed_interval(RAND_DRBG *drbg, unsigned int interval); +int RAND_DRBG_set_reseed_time_interval(RAND_DRBG *drbg, time_t interval); + +int RAND_DRBG_set_reseed_defaults( + unsigned int master_reseed_interval, + unsigned int slave_reseed_interval, + time_t master_reseed_time_interval, + time_t slave_reseed_time_interval + ); + +RAND_DRBG *RAND_DRBG_get0_master(void); +RAND_DRBG *RAND_DRBG_get0_public(void); +RAND_DRBG *RAND_DRBG_get0_private(void); + +/* + * EXDATA + */ +# define RAND_DRBG_get_ex_new_index(l, p, newf, dupf, freef) \ + CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_DRBG, l, p, newf, dupf, freef) +int RAND_DRBG_set_ex_data(RAND_DRBG *drbg, int idx, void *arg); +void *RAND_DRBG_get_ex_data(const RAND_DRBG *drbg, int idx); + +/* + * Callback function typedefs + */ +typedef size_t (*RAND_DRBG_get_entropy_fn)(RAND_DRBG *drbg, + unsigned char **pout, + int entropy, size_t min_len, + size_t max_len, + int prediction_resistance); +typedef void (*RAND_DRBG_cleanup_entropy_fn)(RAND_DRBG *ctx, + unsigned char *out, size_t outlen); +typedef size_t (*RAND_DRBG_get_nonce_fn)(RAND_DRBG *drbg, unsigned char **pout, + int entropy, size_t min_len, + size_t max_len); +typedef void (*RAND_DRBG_cleanup_nonce_fn)(RAND_DRBG *drbg, + unsigned char *out, size_t outlen); + +int RAND_DRBG_set_callbacks(RAND_DRBG *drbg, + RAND_DRBG_get_entropy_fn get_entropy, + RAND_DRBG_cleanup_entropy_fn cleanup_entropy, + RAND_DRBG_get_nonce_fn get_nonce, + RAND_DRBG_cleanup_nonce_fn cleanup_nonce); + + +# ifdef __cplusplus +} +# endif + +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/randerr.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/randerr.h new file mode 100644 index 0000000..79d5790 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/randerr.h @@ -0,0 +1,94 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_RANDERR_H +# define HEADER_RANDERR_H + +# include + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_RAND_strings(void); + +/* + * RAND function codes. + */ +# define RAND_F_DATA_COLLECT_METHOD 127 +# define RAND_F_DRBG_BYTES 101 +# define RAND_F_DRBG_GET_ENTROPY 105 +# define RAND_F_DRBG_SETUP 117 +# define RAND_F_GET_ENTROPY 106 +# define RAND_F_RAND_BYTES 100 +# define RAND_F_RAND_DRBG_ENABLE_LOCKING 119 +# define RAND_F_RAND_DRBG_GENERATE 107 +# define RAND_F_RAND_DRBG_GET_ENTROPY 120 +# define RAND_F_RAND_DRBG_GET_NONCE 123 +# define RAND_F_RAND_DRBG_INSTANTIATE 108 +# define RAND_F_RAND_DRBG_NEW 109 +# define RAND_F_RAND_DRBG_RESEED 110 +# define RAND_F_RAND_DRBG_RESTART 102 +# define RAND_F_RAND_DRBG_SET 104 +# define RAND_F_RAND_DRBG_SET_DEFAULTS 121 +# define RAND_F_RAND_DRBG_UNINSTANTIATE 118 +# define RAND_F_RAND_LOAD_FILE 111 +# define RAND_F_RAND_POOL_ACQUIRE_ENTROPY 122 +# define RAND_F_RAND_POOL_ADD 103 +# define RAND_F_RAND_POOL_ADD_BEGIN 113 +# define RAND_F_RAND_POOL_ADD_END 114 +# define RAND_F_RAND_POOL_ATTACH 124 +# define RAND_F_RAND_POOL_BYTES_NEEDED 115 +# define RAND_F_RAND_POOL_GROW 125 +# define RAND_F_RAND_POOL_NEW 116 +# define RAND_F_RAND_PSEUDO_BYTES 126 +# define RAND_F_RAND_WRITE_FILE 112 + +/* + * RAND reason codes. + */ +# define RAND_R_ADDITIONAL_INPUT_TOO_LONG 102 +# define RAND_R_ALREADY_INSTANTIATED 103 +# define RAND_R_ARGUMENT_OUT_OF_RANGE 105 +# define RAND_R_CANNOT_OPEN_FILE 121 +# define RAND_R_DRBG_ALREADY_INITIALIZED 129 +# define RAND_R_DRBG_NOT_INITIALISED 104 +# define RAND_R_ENTROPY_INPUT_TOO_LONG 106 +# define RAND_R_ENTROPY_OUT_OF_RANGE 124 +# define RAND_R_ERROR_ENTROPY_POOL_WAS_IGNORED 127 +# define RAND_R_ERROR_INITIALISING_DRBG 107 +# define RAND_R_ERROR_INSTANTIATING_DRBG 108 +# define RAND_R_ERROR_RETRIEVING_ADDITIONAL_INPUT 109 +# define RAND_R_ERROR_RETRIEVING_ENTROPY 110 +# define RAND_R_ERROR_RETRIEVING_NONCE 111 +# define RAND_R_FAILED_TO_CREATE_LOCK 126 +# define RAND_R_FUNC_NOT_IMPLEMENTED 101 +# define RAND_R_FWRITE_ERROR 123 +# define RAND_R_GENERATE_ERROR 112 +# define RAND_R_INTERNAL_ERROR 113 +# define RAND_R_IN_ERROR_STATE 114 +# define RAND_R_NOT_A_REGULAR_FILE 122 +# define RAND_R_NOT_INSTANTIATED 115 +# define RAND_R_NO_DRBG_IMPLEMENTATION_SELECTED 128 +# define RAND_R_PARENT_LOCKING_NOT_ENABLED 130 +# define RAND_R_PARENT_STRENGTH_TOO_WEAK 131 +# define RAND_R_PERSONALISATION_STRING_TOO_LONG 116 +# define RAND_R_PREDICTION_RESISTANCE_NOT_SUPPORTED 133 +# define RAND_R_PRNG_NOT_SEEDED 100 +# define RAND_R_RANDOM_POOL_OVERFLOW 125 +# define RAND_R_RANDOM_POOL_UNDERFLOW 134 +# define RAND_R_REQUEST_TOO_LARGE_FOR_DRBG 117 +# define RAND_R_RESEED_ERROR 118 +# define RAND_R_SELFTEST_FAILURE 119 +# define RAND_R_TOO_LITTLE_NONCE_REQUESTED 135 +# define RAND_R_TOO_MUCH_NONCE_REQUESTED 136 +# define RAND_R_UNSUPPORTED_DRBG_FLAGS 132 +# define RAND_R_UNSUPPORTED_DRBG_TYPE 120 + +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/rc2.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/rc2.h new file mode 100644 index 0000000..585f9e4 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/rc2.h @@ -0,0 +1,51 @@ +/* + * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_RC2_H +# define HEADER_RC2_H + +# include + +# ifndef OPENSSL_NO_RC2 +# ifdef __cplusplus +extern "C" { +# endif + +typedef unsigned int RC2_INT; + +# define RC2_ENCRYPT 1 +# define RC2_DECRYPT 0 + +# define RC2_BLOCK 8 +# define RC2_KEY_LENGTH 16 + +typedef struct rc2_key_st { + RC2_INT data[64]; +} RC2_KEY; + +void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data, int bits); +void RC2_ecb_encrypt(const unsigned char *in, unsigned char *out, + RC2_KEY *key, int enc); +void RC2_encrypt(unsigned long *data, RC2_KEY *key); +void RC2_decrypt(unsigned long *data, RC2_KEY *key); +void RC2_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, + RC2_KEY *ks, unsigned char *iv, int enc); +void RC2_cfb64_encrypt(const unsigned char *in, unsigned char *out, + long length, RC2_KEY *schedule, unsigned char *ivec, + int *num, int enc); +void RC2_ofb64_encrypt(const unsigned char *in, unsigned char *out, + long length, RC2_KEY *schedule, unsigned char *ivec, + int *num); + +# ifdef __cplusplus +} +# endif +# endif + +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/rc4.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/rc4.h new file mode 100644 index 0000000..86803b3 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/rc4.h @@ -0,0 +1,36 @@ +/* + * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_RC4_H +# define HEADER_RC4_H + +# include + +# ifndef OPENSSL_NO_RC4 +# include +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct rc4_key_st { + RC4_INT x, y; + RC4_INT data[256]; +} RC4_KEY; + +const char *RC4_options(void); +void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data); +void RC4(RC4_KEY *key, size_t len, const unsigned char *indata, + unsigned char *outdata); + +# ifdef __cplusplus +} +# endif +# endif + +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/rc5.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/rc5.h new file mode 100644 index 0000000..793f88e --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/rc5.h @@ -0,0 +1,63 @@ +/* + * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_RC5_H +# define HEADER_RC5_H + +# include + +# ifndef OPENSSL_NO_RC5 +# ifdef __cplusplus +extern "C" { +# endif + +# define RC5_ENCRYPT 1 +# define RC5_DECRYPT 0 + +# define RC5_32_INT unsigned int + +# define RC5_32_BLOCK 8 +# define RC5_32_KEY_LENGTH 16/* This is a default, max is 255 */ + +/* + * This are the only values supported. Tweak the code if you want more The + * most supported modes will be RC5-32/12/16 RC5-32/16/8 + */ +# define RC5_8_ROUNDS 8 +# define RC5_12_ROUNDS 12 +# define RC5_16_ROUNDS 16 + +typedef struct rc5_key_st { + /* Number of rounds */ + int rounds; + RC5_32_INT data[2 * (RC5_16_ROUNDS + 1)]; +} RC5_32_KEY; + +void RC5_32_set_key(RC5_32_KEY *key, int len, const unsigned char *data, + int rounds); +void RC5_32_ecb_encrypt(const unsigned char *in, unsigned char *out, + RC5_32_KEY *key, int enc); +void RC5_32_encrypt(unsigned long *data, RC5_32_KEY *key); +void RC5_32_decrypt(unsigned long *data, RC5_32_KEY *key); +void RC5_32_cbc_encrypt(const unsigned char *in, unsigned char *out, + long length, RC5_32_KEY *ks, unsigned char *iv, + int enc); +void RC5_32_cfb64_encrypt(const unsigned char *in, unsigned char *out, + long length, RC5_32_KEY *schedule, + unsigned char *ivec, int *num, int enc); +void RC5_32_ofb64_encrypt(const unsigned char *in, unsigned char *out, + long length, RC5_32_KEY *schedule, + unsigned char *ivec, int *num); + +# ifdef __cplusplus +} +# endif +# endif + +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/ripemd.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/ripemd.h new file mode 100644 index 0000000..c42026a --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/ripemd.h @@ -0,0 +1,47 @@ +/* + * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_RIPEMD_H +# define HEADER_RIPEMD_H + +# include + +#ifndef OPENSSL_NO_RMD160 +# include +# include +# ifdef __cplusplus +extern "C" { +# endif + +# define RIPEMD160_LONG unsigned int + +# define RIPEMD160_CBLOCK 64 +# define RIPEMD160_LBLOCK (RIPEMD160_CBLOCK/4) +# define RIPEMD160_DIGEST_LENGTH 20 + +typedef struct RIPEMD160state_st { + RIPEMD160_LONG A, B, C, D, E; + RIPEMD160_LONG Nl, Nh; + RIPEMD160_LONG data[RIPEMD160_LBLOCK]; + unsigned int num; +} RIPEMD160_CTX; + +int RIPEMD160_Init(RIPEMD160_CTX *c); +int RIPEMD160_Update(RIPEMD160_CTX *c, const void *data, size_t len); +int RIPEMD160_Final(unsigned char *md, RIPEMD160_CTX *c); +unsigned char *RIPEMD160(const unsigned char *d, size_t n, unsigned char *md); +void RIPEMD160_Transform(RIPEMD160_CTX *c, const unsigned char *b); + +# ifdef __cplusplus +} +# endif +# endif + + +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/rsa.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/rsa.h new file mode 100644 index 0000000..5e76365 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/rsa.h @@ -0,0 +1,513 @@ +/* + * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_RSA_H +# define HEADER_RSA_H + +# include + +# ifndef OPENSSL_NO_RSA +# include +# include +# include +# include +# if OPENSSL_API_COMPAT < 0x10100000L +# include +# endif +# include +# ifdef __cplusplus +extern "C" { +# endif + +/* The types RSA and RSA_METHOD are defined in ossl_typ.h */ + +# ifndef OPENSSL_RSA_MAX_MODULUS_BITS +# define OPENSSL_RSA_MAX_MODULUS_BITS 16384 +# endif + +# define OPENSSL_RSA_FIPS_MIN_MODULUS_BITS 1024 + +# ifndef OPENSSL_RSA_SMALL_MODULUS_BITS +# define OPENSSL_RSA_SMALL_MODULUS_BITS 3072 +# endif +# ifndef OPENSSL_RSA_MAX_PUBEXP_BITS + +/* exponent limit enforced for "large" modulus only */ +# define OPENSSL_RSA_MAX_PUBEXP_BITS 64 +# endif + +# define RSA_3 0x3L +# define RSA_F4 0x10001L + +/* based on RFC 8017 appendix A.1.2 */ +# define RSA_ASN1_VERSION_DEFAULT 0 +# define RSA_ASN1_VERSION_MULTI 1 + +# define RSA_DEFAULT_PRIME_NUM 2 + +# define RSA_METHOD_FLAG_NO_CHECK 0x0001/* don't check pub/private + * match */ + +# define RSA_FLAG_CACHE_PUBLIC 0x0002 +# define RSA_FLAG_CACHE_PRIVATE 0x0004 +# define RSA_FLAG_BLINDING 0x0008 +# define RSA_FLAG_THREAD_SAFE 0x0010 +/* + * This flag means the private key operations will be handled by rsa_mod_exp + * and that they do not depend on the private key components being present: + * for example a key stored in external hardware. Without this flag + * bn_mod_exp gets called when private key components are absent. + */ +# define RSA_FLAG_EXT_PKEY 0x0020 + +/* + * new with 0.9.6j and 0.9.7b; the built-in + * RSA implementation now uses blinding by + * default (ignoring RSA_FLAG_BLINDING), + * but other engines might not need it + */ +# define RSA_FLAG_NO_BLINDING 0x0080 +# if OPENSSL_API_COMPAT < 0x10100000L +/* + * Does nothing. Previously this switched off constant time behaviour. + */ +# define RSA_FLAG_NO_CONSTTIME 0x0000 +# endif +# if OPENSSL_API_COMPAT < 0x00908000L +/* deprecated name for the flag*/ +/* + * new with 0.9.7h; the built-in RSA + * implementation now uses constant time + * modular exponentiation for secret exponents + * by default. This flag causes the + * faster variable sliding window method to + * be used for all exponents. + */ +# define RSA_FLAG_NO_EXP_CONSTTIME RSA_FLAG_NO_CONSTTIME +# endif + +# define EVP_PKEY_CTX_set_rsa_padding(ctx, pad) \ + RSA_pkey_ctx_ctrl(ctx, -1, EVP_PKEY_CTRL_RSA_PADDING, pad, NULL) + +# define EVP_PKEY_CTX_get_rsa_padding(ctx, ppad) \ + RSA_pkey_ctx_ctrl(ctx, -1, EVP_PKEY_CTRL_GET_RSA_PADDING, 0, ppad) + +# define EVP_PKEY_CTX_set_rsa_pss_saltlen(ctx, len) \ + RSA_pkey_ctx_ctrl(ctx, (EVP_PKEY_OP_SIGN|EVP_PKEY_OP_VERIFY), \ + EVP_PKEY_CTRL_RSA_PSS_SALTLEN, len, NULL) +/* Salt length matches digest */ +# define RSA_PSS_SALTLEN_DIGEST -1 +/* Verify only: auto detect salt length */ +# define RSA_PSS_SALTLEN_AUTO -2 +/* Set salt length to maximum possible */ +# define RSA_PSS_SALTLEN_MAX -3 +/* Old compatible max salt length for sign only */ +# define RSA_PSS_SALTLEN_MAX_SIGN -2 + +# define EVP_PKEY_CTX_set_rsa_pss_keygen_saltlen(ctx, len) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA_PSS, EVP_PKEY_OP_KEYGEN, \ + EVP_PKEY_CTRL_RSA_PSS_SALTLEN, len, NULL) + +# define EVP_PKEY_CTX_get_rsa_pss_saltlen(ctx, plen) \ + RSA_pkey_ctx_ctrl(ctx, (EVP_PKEY_OP_SIGN|EVP_PKEY_OP_VERIFY), \ + EVP_PKEY_CTRL_GET_RSA_PSS_SALTLEN, 0, plen) + +# define EVP_PKEY_CTX_set_rsa_keygen_bits(ctx, bits) \ + RSA_pkey_ctx_ctrl(ctx, EVP_PKEY_OP_KEYGEN, \ + EVP_PKEY_CTRL_RSA_KEYGEN_BITS, bits, NULL) + +# define EVP_PKEY_CTX_set_rsa_keygen_pubexp(ctx, pubexp) \ + RSA_pkey_ctx_ctrl(ctx, EVP_PKEY_OP_KEYGEN, \ + EVP_PKEY_CTRL_RSA_KEYGEN_PUBEXP, 0, pubexp) + +# define EVP_PKEY_CTX_set_rsa_keygen_primes(ctx, primes) \ + RSA_pkey_ctx_ctrl(ctx, EVP_PKEY_OP_KEYGEN, \ + EVP_PKEY_CTRL_RSA_KEYGEN_PRIMES, primes, NULL) + +# define EVP_PKEY_CTX_set_rsa_mgf1_md(ctx, md) \ + RSA_pkey_ctx_ctrl(ctx, EVP_PKEY_OP_TYPE_SIG | EVP_PKEY_OP_TYPE_CRYPT, \ + EVP_PKEY_CTRL_RSA_MGF1_MD, 0, (void *)(md)) + +# define EVP_PKEY_CTX_set_rsa_pss_keygen_mgf1_md(ctx, md) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA_PSS, EVP_PKEY_OP_KEYGEN, \ + EVP_PKEY_CTRL_RSA_MGF1_MD, 0, (void *)(md)) + +# define EVP_PKEY_CTX_set_rsa_oaep_md(ctx, md) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_TYPE_CRYPT, \ + EVP_PKEY_CTRL_RSA_OAEP_MD, 0, (void *)(md)) + +# define EVP_PKEY_CTX_get_rsa_mgf1_md(ctx, pmd) \ + RSA_pkey_ctx_ctrl(ctx, EVP_PKEY_OP_TYPE_SIG | EVP_PKEY_OP_TYPE_CRYPT, \ + EVP_PKEY_CTRL_GET_RSA_MGF1_MD, 0, (void *)(pmd)) + +# define EVP_PKEY_CTX_get_rsa_oaep_md(ctx, pmd) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_TYPE_CRYPT, \ + EVP_PKEY_CTRL_GET_RSA_OAEP_MD, 0, (void *)(pmd)) + +# define EVP_PKEY_CTX_set0_rsa_oaep_label(ctx, l, llen) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_TYPE_CRYPT, \ + EVP_PKEY_CTRL_RSA_OAEP_LABEL, llen, (void *)(l)) + +# define EVP_PKEY_CTX_get0_rsa_oaep_label(ctx, l) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_TYPE_CRYPT, \ + EVP_PKEY_CTRL_GET_RSA_OAEP_LABEL, 0, (void *)(l)) + +# define EVP_PKEY_CTX_set_rsa_pss_keygen_md(ctx, md) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA_PSS, \ + EVP_PKEY_OP_KEYGEN, EVP_PKEY_CTRL_MD, \ + 0, (void *)(md)) + +# define EVP_PKEY_CTRL_RSA_PADDING (EVP_PKEY_ALG_CTRL + 1) +# define EVP_PKEY_CTRL_RSA_PSS_SALTLEN (EVP_PKEY_ALG_CTRL + 2) + +# define EVP_PKEY_CTRL_RSA_KEYGEN_BITS (EVP_PKEY_ALG_CTRL + 3) +# define EVP_PKEY_CTRL_RSA_KEYGEN_PUBEXP (EVP_PKEY_ALG_CTRL + 4) +# define EVP_PKEY_CTRL_RSA_MGF1_MD (EVP_PKEY_ALG_CTRL + 5) + +# define EVP_PKEY_CTRL_GET_RSA_PADDING (EVP_PKEY_ALG_CTRL + 6) +# define EVP_PKEY_CTRL_GET_RSA_PSS_SALTLEN (EVP_PKEY_ALG_CTRL + 7) +# define EVP_PKEY_CTRL_GET_RSA_MGF1_MD (EVP_PKEY_ALG_CTRL + 8) + +# define EVP_PKEY_CTRL_RSA_OAEP_MD (EVP_PKEY_ALG_CTRL + 9) +# define EVP_PKEY_CTRL_RSA_OAEP_LABEL (EVP_PKEY_ALG_CTRL + 10) + +# define EVP_PKEY_CTRL_GET_RSA_OAEP_MD (EVP_PKEY_ALG_CTRL + 11) +# define EVP_PKEY_CTRL_GET_RSA_OAEP_LABEL (EVP_PKEY_ALG_CTRL + 12) + +# define EVP_PKEY_CTRL_RSA_KEYGEN_PRIMES (EVP_PKEY_ALG_CTRL + 13) + +# define RSA_PKCS1_PADDING 1 +# define RSA_SSLV23_PADDING 2 +# define RSA_NO_PADDING 3 +# define RSA_PKCS1_OAEP_PADDING 4 +# define RSA_X931_PADDING 5 +/* EVP_PKEY_ only */ +# define RSA_PKCS1_PSS_PADDING 6 + +# define RSA_PKCS1_PADDING_SIZE 11 + +# define RSA_set_app_data(s,arg) RSA_set_ex_data(s,0,arg) +# define RSA_get_app_data(s) RSA_get_ex_data(s,0) + +RSA *RSA_new(void); +RSA *RSA_new_method(ENGINE *engine); +int RSA_bits(const RSA *rsa); +int RSA_size(const RSA *rsa); +int RSA_security_bits(const RSA *rsa); + +int RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d); +int RSA_set0_factors(RSA *r, BIGNUM *p, BIGNUM *q); +int RSA_set0_crt_params(RSA *r,BIGNUM *dmp1, BIGNUM *dmq1, BIGNUM *iqmp); +int RSA_set0_multi_prime_params(RSA *r, BIGNUM *primes[], BIGNUM *exps[], + BIGNUM *coeffs[], int pnum); +void RSA_get0_key(const RSA *r, + const BIGNUM **n, const BIGNUM **e, const BIGNUM **d); +void RSA_get0_factors(const RSA *r, const BIGNUM **p, const BIGNUM **q); +int RSA_get_multi_prime_extra_count(const RSA *r); +int RSA_get0_multi_prime_factors(const RSA *r, const BIGNUM *primes[]); +void RSA_get0_crt_params(const RSA *r, + const BIGNUM **dmp1, const BIGNUM **dmq1, + const BIGNUM **iqmp); +int RSA_get0_multi_prime_crt_params(const RSA *r, const BIGNUM *exps[], + const BIGNUM *coeffs[]); +const BIGNUM *RSA_get0_n(const RSA *d); +const BIGNUM *RSA_get0_e(const RSA *d); +const BIGNUM *RSA_get0_d(const RSA *d); +const BIGNUM *RSA_get0_p(const RSA *d); +const BIGNUM *RSA_get0_q(const RSA *d); +const BIGNUM *RSA_get0_dmp1(const RSA *r); +const BIGNUM *RSA_get0_dmq1(const RSA *r); +const BIGNUM *RSA_get0_iqmp(const RSA *r); +const RSA_PSS_PARAMS *RSA_get0_pss_params(const RSA *r); +void RSA_clear_flags(RSA *r, int flags); +int RSA_test_flags(const RSA *r, int flags); +void RSA_set_flags(RSA *r, int flags); +int RSA_get_version(RSA *r); +ENGINE *RSA_get0_engine(const RSA *r); + +/* Deprecated version */ +DEPRECATEDIN_0_9_8(RSA *RSA_generate_key(int bits, unsigned long e, void + (*callback) (int, int, void *), + void *cb_arg)) + +/* New version */ +int RSA_generate_key_ex(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb); +/* Multi-prime version */ +int RSA_generate_multi_prime_key(RSA *rsa, int bits, int primes, + BIGNUM *e, BN_GENCB *cb); + +int RSA_X931_derive_ex(RSA *rsa, BIGNUM *p1, BIGNUM *p2, BIGNUM *q1, + BIGNUM *q2, const BIGNUM *Xp1, const BIGNUM *Xp2, + const BIGNUM *Xp, const BIGNUM *Xq1, const BIGNUM *Xq2, + const BIGNUM *Xq, const BIGNUM *e, BN_GENCB *cb); +int RSA_X931_generate_key_ex(RSA *rsa, int bits, const BIGNUM *e, + BN_GENCB *cb); + +int RSA_check_key(const RSA *); +int RSA_check_key_ex(const RSA *, BN_GENCB *cb); + /* next 4 return -1 on error */ +int RSA_public_encrypt(int flen, const unsigned char *from, + unsigned char *to, RSA *rsa, int padding); +int RSA_private_encrypt(int flen, const unsigned char *from, + unsigned char *to, RSA *rsa, int padding); +int RSA_public_decrypt(int flen, const unsigned char *from, + unsigned char *to, RSA *rsa, int padding); +int RSA_private_decrypt(int flen, const unsigned char *from, + unsigned char *to, RSA *rsa, int padding); +void RSA_free(RSA *r); +/* "up" the RSA object's reference count */ +int RSA_up_ref(RSA *r); + +int RSA_flags(const RSA *r); + +void RSA_set_default_method(const RSA_METHOD *meth); +const RSA_METHOD *RSA_get_default_method(void); +const RSA_METHOD *RSA_null_method(void); +const RSA_METHOD *RSA_get_method(const RSA *rsa); +int RSA_set_method(RSA *rsa, const RSA_METHOD *meth); + +/* these are the actual RSA functions */ +const RSA_METHOD *RSA_PKCS1_OpenSSL(void); + +int RSA_pkey_ctx_ctrl(EVP_PKEY_CTX *ctx, int optype, int cmd, int p1, void *p2); + +DECLARE_ASN1_ENCODE_FUNCTIONS_const(RSA, RSAPublicKey) +DECLARE_ASN1_ENCODE_FUNCTIONS_const(RSA, RSAPrivateKey) + +struct rsa_pss_params_st { + X509_ALGOR *hashAlgorithm; + X509_ALGOR *maskGenAlgorithm; + ASN1_INTEGER *saltLength; + ASN1_INTEGER *trailerField; + /* Decoded hash algorithm from maskGenAlgorithm */ + X509_ALGOR *maskHash; +}; + +DECLARE_ASN1_FUNCTIONS(RSA_PSS_PARAMS) + +typedef struct rsa_oaep_params_st { + X509_ALGOR *hashFunc; + X509_ALGOR *maskGenFunc; + X509_ALGOR *pSourceFunc; + /* Decoded hash algorithm from maskGenFunc */ + X509_ALGOR *maskHash; +} RSA_OAEP_PARAMS; + +DECLARE_ASN1_FUNCTIONS(RSA_OAEP_PARAMS) + +# ifndef OPENSSL_NO_STDIO +int RSA_print_fp(FILE *fp, const RSA *r, int offset); +# endif + +int RSA_print(BIO *bp, const RSA *r, int offset); + +/* + * The following 2 functions sign and verify a X509_SIG ASN1 object inside + * PKCS#1 padded RSA encryption + */ +int RSA_sign(int type, const unsigned char *m, unsigned int m_length, + unsigned char *sigret, unsigned int *siglen, RSA *rsa); +int RSA_verify(int type, const unsigned char *m, unsigned int m_length, + const unsigned char *sigbuf, unsigned int siglen, RSA *rsa); + +/* + * The following 2 function sign and verify a ASN1_OCTET_STRING object inside + * PKCS#1 padded RSA encryption + */ +int RSA_sign_ASN1_OCTET_STRING(int type, + const unsigned char *m, unsigned int m_length, + unsigned char *sigret, unsigned int *siglen, + RSA *rsa); +int RSA_verify_ASN1_OCTET_STRING(int type, const unsigned char *m, + unsigned int m_length, unsigned char *sigbuf, + unsigned int siglen, RSA *rsa); + +int RSA_blinding_on(RSA *rsa, BN_CTX *ctx); +void RSA_blinding_off(RSA *rsa); +BN_BLINDING *RSA_setup_blinding(RSA *rsa, BN_CTX *ctx); + +int RSA_padding_add_PKCS1_type_1(unsigned char *to, int tlen, + const unsigned char *f, int fl); +int RSA_padding_check_PKCS1_type_1(unsigned char *to, int tlen, + const unsigned char *f, int fl, + int rsa_len); +int RSA_padding_add_PKCS1_type_2(unsigned char *to, int tlen, + const unsigned char *f, int fl); +int RSA_padding_check_PKCS1_type_2(unsigned char *to, int tlen, + const unsigned char *f, int fl, + int rsa_len); +int PKCS1_MGF1(unsigned char *mask, long len, const unsigned char *seed, + long seedlen, const EVP_MD *dgst); +int RSA_padding_add_PKCS1_OAEP(unsigned char *to, int tlen, + const unsigned char *f, int fl, + const unsigned char *p, int pl); +int RSA_padding_check_PKCS1_OAEP(unsigned char *to, int tlen, + const unsigned char *f, int fl, int rsa_len, + const unsigned char *p, int pl); +int RSA_padding_add_PKCS1_OAEP_mgf1(unsigned char *to, int tlen, + const unsigned char *from, int flen, + const unsigned char *param, int plen, + const EVP_MD *md, const EVP_MD *mgf1md); +int RSA_padding_check_PKCS1_OAEP_mgf1(unsigned char *to, int tlen, + const unsigned char *from, int flen, + int num, const unsigned char *param, + int plen, const EVP_MD *md, + const EVP_MD *mgf1md); +int RSA_padding_add_SSLv23(unsigned char *to, int tlen, + const unsigned char *f, int fl); +int RSA_padding_check_SSLv23(unsigned char *to, int tlen, + const unsigned char *f, int fl, int rsa_len); +int RSA_padding_add_none(unsigned char *to, int tlen, const unsigned char *f, + int fl); +int RSA_padding_check_none(unsigned char *to, int tlen, + const unsigned char *f, int fl, int rsa_len); +int RSA_padding_add_X931(unsigned char *to, int tlen, const unsigned char *f, + int fl); +int RSA_padding_check_X931(unsigned char *to, int tlen, + const unsigned char *f, int fl, int rsa_len); +int RSA_X931_hash_id(int nid); + +int RSA_verify_PKCS1_PSS(RSA *rsa, const unsigned char *mHash, + const EVP_MD *Hash, const unsigned char *EM, + int sLen); +int RSA_padding_add_PKCS1_PSS(RSA *rsa, unsigned char *EM, + const unsigned char *mHash, const EVP_MD *Hash, + int sLen); + +int RSA_verify_PKCS1_PSS_mgf1(RSA *rsa, const unsigned char *mHash, + const EVP_MD *Hash, const EVP_MD *mgf1Hash, + const unsigned char *EM, int sLen); + +int RSA_padding_add_PKCS1_PSS_mgf1(RSA *rsa, unsigned char *EM, + const unsigned char *mHash, + const EVP_MD *Hash, const EVP_MD *mgf1Hash, + int sLen); + +#define RSA_get_ex_new_index(l, p, newf, dupf, freef) \ + CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_RSA, l, p, newf, dupf, freef) +int RSA_set_ex_data(RSA *r, int idx, void *arg); +void *RSA_get_ex_data(const RSA *r, int idx); + +RSA *RSAPublicKey_dup(RSA *rsa); +RSA *RSAPrivateKey_dup(RSA *rsa); + +/* + * If this flag is set the RSA method is FIPS compliant and can be used in + * FIPS mode. This is set in the validated module method. If an application + * sets this flag in its own methods it is its responsibility to ensure the + * result is compliant. + */ + +# define RSA_FLAG_FIPS_METHOD 0x0400 + +/* + * If this flag is set the operations normally disabled in FIPS mode are + * permitted it is then the applications responsibility to ensure that the + * usage is compliant. + */ + +# define RSA_FLAG_NON_FIPS_ALLOW 0x0400 +/* + * Application has decided PRNG is good enough to generate a key: don't + * check. + */ +# define RSA_FLAG_CHECKED 0x0800 + +RSA_METHOD *RSA_meth_new(const char *name, int flags); +void RSA_meth_free(RSA_METHOD *meth); +RSA_METHOD *RSA_meth_dup(const RSA_METHOD *meth); +const char *RSA_meth_get0_name(const RSA_METHOD *meth); +int RSA_meth_set1_name(RSA_METHOD *meth, const char *name); +int RSA_meth_get_flags(const RSA_METHOD *meth); +int RSA_meth_set_flags(RSA_METHOD *meth, int flags); +void *RSA_meth_get0_app_data(const RSA_METHOD *meth); +int RSA_meth_set0_app_data(RSA_METHOD *meth, void *app_data); +int (*RSA_meth_get_pub_enc(const RSA_METHOD *meth)) + (int flen, const unsigned char *from, + unsigned char *to, RSA *rsa, int padding); +int RSA_meth_set_pub_enc(RSA_METHOD *rsa, + int (*pub_enc) (int flen, const unsigned char *from, + unsigned char *to, RSA *rsa, + int padding)); +int (*RSA_meth_get_pub_dec(const RSA_METHOD *meth)) + (int flen, const unsigned char *from, + unsigned char *to, RSA *rsa, int padding); +int RSA_meth_set_pub_dec(RSA_METHOD *rsa, + int (*pub_dec) (int flen, const unsigned char *from, + unsigned char *to, RSA *rsa, + int padding)); +int (*RSA_meth_get_priv_enc(const RSA_METHOD *meth)) + (int flen, const unsigned char *from, + unsigned char *to, RSA *rsa, int padding); +int RSA_meth_set_priv_enc(RSA_METHOD *rsa, + int (*priv_enc) (int flen, const unsigned char *from, + unsigned char *to, RSA *rsa, + int padding)); +int (*RSA_meth_get_priv_dec(const RSA_METHOD *meth)) + (int flen, const unsigned char *from, + unsigned char *to, RSA *rsa, int padding); +int RSA_meth_set_priv_dec(RSA_METHOD *rsa, + int (*priv_dec) (int flen, const unsigned char *from, + unsigned char *to, RSA *rsa, + int padding)); +int (*RSA_meth_get_mod_exp(const RSA_METHOD *meth)) + (BIGNUM *r0, const BIGNUM *i, RSA *rsa, BN_CTX *ctx); +int RSA_meth_set_mod_exp(RSA_METHOD *rsa, + int (*mod_exp) (BIGNUM *r0, const BIGNUM *i, RSA *rsa, + BN_CTX *ctx)); +int (*RSA_meth_get_bn_mod_exp(const RSA_METHOD *meth)) + (BIGNUM *r, const BIGNUM *a, const BIGNUM *p, + const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); +int RSA_meth_set_bn_mod_exp(RSA_METHOD *rsa, + int (*bn_mod_exp) (BIGNUM *r, + const BIGNUM *a, + const BIGNUM *p, + const BIGNUM *m, + BN_CTX *ctx, + BN_MONT_CTX *m_ctx)); +int (*RSA_meth_get_init(const RSA_METHOD *meth)) (RSA *rsa); +int RSA_meth_set_init(RSA_METHOD *rsa, int (*init) (RSA *rsa)); +int (*RSA_meth_get_finish(const RSA_METHOD *meth)) (RSA *rsa); +int RSA_meth_set_finish(RSA_METHOD *rsa, int (*finish) (RSA *rsa)); +int (*RSA_meth_get_sign(const RSA_METHOD *meth)) + (int type, + const unsigned char *m, unsigned int m_length, + unsigned char *sigret, unsigned int *siglen, + const RSA *rsa); +int RSA_meth_set_sign(RSA_METHOD *rsa, + int (*sign) (int type, const unsigned char *m, + unsigned int m_length, + unsigned char *sigret, unsigned int *siglen, + const RSA *rsa)); +int (*RSA_meth_get_verify(const RSA_METHOD *meth)) + (int dtype, const unsigned char *m, + unsigned int m_length, const unsigned char *sigbuf, + unsigned int siglen, const RSA *rsa); +int RSA_meth_set_verify(RSA_METHOD *rsa, + int (*verify) (int dtype, const unsigned char *m, + unsigned int m_length, + const unsigned char *sigbuf, + unsigned int siglen, const RSA *rsa)); +int (*RSA_meth_get_keygen(const RSA_METHOD *meth)) + (RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb); +int RSA_meth_set_keygen(RSA_METHOD *rsa, + int (*keygen) (RSA *rsa, int bits, BIGNUM *e, + BN_GENCB *cb)); +int (*RSA_meth_get_multi_prime_keygen(const RSA_METHOD *meth)) + (RSA *rsa, int bits, int primes, BIGNUM *e, BN_GENCB *cb); +int RSA_meth_set_multi_prime_keygen(RSA_METHOD *meth, + int (*keygen) (RSA *rsa, int bits, + int primes, BIGNUM *e, + BN_GENCB *cb)); + +# ifdef __cplusplus +} +# endif +# endif +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/rsaerr.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/rsaerr.h new file mode 100644 index 0000000..59b15e1 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/rsaerr.h @@ -0,0 +1,167 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_RSAERR_H +# define HEADER_RSAERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_RSA_strings(void); + +/* + * RSA function codes. + */ +# define RSA_F_CHECK_PADDING_MD 140 +# define RSA_F_ENCODE_PKCS1 146 +# define RSA_F_INT_RSA_VERIFY 145 +# define RSA_F_OLD_RSA_PRIV_DECODE 147 +# define RSA_F_PKEY_PSS_INIT 165 +# define RSA_F_PKEY_RSA_CTRL 143 +# define RSA_F_PKEY_RSA_CTRL_STR 144 +# define RSA_F_PKEY_RSA_SIGN 142 +# define RSA_F_PKEY_RSA_VERIFY 149 +# define RSA_F_PKEY_RSA_VERIFYRECOVER 141 +# define RSA_F_RSA_ALGOR_TO_MD 156 +# define RSA_F_RSA_BUILTIN_KEYGEN 129 +# define RSA_F_RSA_CHECK_KEY 123 +# define RSA_F_RSA_CHECK_KEY_EX 160 +# define RSA_F_RSA_CMS_DECRYPT 159 +# define RSA_F_RSA_CMS_VERIFY 158 +# define RSA_F_RSA_ITEM_VERIFY 148 +# define RSA_F_RSA_METH_DUP 161 +# define RSA_F_RSA_METH_NEW 162 +# define RSA_F_RSA_METH_SET1_NAME 163 +# define RSA_F_RSA_MGF1_TO_MD 157 +# define RSA_F_RSA_MULTIP_INFO_NEW 166 +# define RSA_F_RSA_NEW_METHOD 106 +# define RSA_F_RSA_NULL 124 +# define RSA_F_RSA_NULL_PRIVATE_DECRYPT 132 +# define RSA_F_RSA_NULL_PRIVATE_ENCRYPT 133 +# define RSA_F_RSA_NULL_PUBLIC_DECRYPT 134 +# define RSA_F_RSA_NULL_PUBLIC_ENCRYPT 135 +# define RSA_F_RSA_OSSL_PRIVATE_DECRYPT 101 +# define RSA_F_RSA_OSSL_PRIVATE_ENCRYPT 102 +# define RSA_F_RSA_OSSL_PUBLIC_DECRYPT 103 +# define RSA_F_RSA_OSSL_PUBLIC_ENCRYPT 104 +# define RSA_F_RSA_PADDING_ADD_NONE 107 +# define RSA_F_RSA_PADDING_ADD_PKCS1_OAEP 121 +# define RSA_F_RSA_PADDING_ADD_PKCS1_OAEP_MGF1 154 +# define RSA_F_RSA_PADDING_ADD_PKCS1_PSS 125 +# define RSA_F_RSA_PADDING_ADD_PKCS1_PSS_MGF1 152 +# define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_1 108 +# define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_2 109 +# define RSA_F_RSA_PADDING_ADD_SSLV23 110 +# define RSA_F_RSA_PADDING_ADD_X931 127 +# define RSA_F_RSA_PADDING_CHECK_NONE 111 +# define RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP 122 +# define RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP_MGF1 153 +# define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_1 112 +# define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_2 113 +# define RSA_F_RSA_PADDING_CHECK_SSLV23 114 +# define RSA_F_RSA_PADDING_CHECK_X931 128 +# define RSA_F_RSA_PARAM_DECODE 164 +# define RSA_F_RSA_PRINT 115 +# define RSA_F_RSA_PRINT_FP 116 +# define RSA_F_RSA_PRIV_DECODE 150 +# define RSA_F_RSA_PRIV_ENCODE 138 +# define RSA_F_RSA_PSS_GET_PARAM 151 +# define RSA_F_RSA_PSS_TO_CTX 155 +# define RSA_F_RSA_PUB_DECODE 139 +# define RSA_F_RSA_SETUP_BLINDING 136 +# define RSA_F_RSA_SIGN 117 +# define RSA_F_RSA_SIGN_ASN1_OCTET_STRING 118 +# define RSA_F_RSA_VERIFY 119 +# define RSA_F_RSA_VERIFY_ASN1_OCTET_STRING 120 +# define RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1 126 +# define RSA_F_SETUP_TBUF 167 + +/* + * RSA reason codes. + */ +# define RSA_R_ALGORITHM_MISMATCH 100 +# define RSA_R_BAD_E_VALUE 101 +# define RSA_R_BAD_FIXED_HEADER_DECRYPT 102 +# define RSA_R_BAD_PAD_BYTE_COUNT 103 +# define RSA_R_BAD_SIGNATURE 104 +# define RSA_R_BLOCK_TYPE_IS_NOT_01 106 +# define RSA_R_BLOCK_TYPE_IS_NOT_02 107 +# define RSA_R_DATA_GREATER_THAN_MOD_LEN 108 +# define RSA_R_DATA_TOO_LARGE 109 +# define RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE 110 +# define RSA_R_DATA_TOO_LARGE_FOR_MODULUS 132 +# define RSA_R_DATA_TOO_SMALL 111 +# define RSA_R_DATA_TOO_SMALL_FOR_KEY_SIZE 122 +# define RSA_R_DIGEST_DOES_NOT_MATCH 158 +# define RSA_R_DIGEST_NOT_ALLOWED 145 +# define RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY 112 +# define RSA_R_DMP1_NOT_CONGRUENT_TO_D 124 +# define RSA_R_DMQ1_NOT_CONGRUENT_TO_D 125 +# define RSA_R_D_E_NOT_CONGRUENT_TO_1 123 +# define RSA_R_FIRST_OCTET_INVALID 133 +# define RSA_R_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE 144 +# define RSA_R_INVALID_DIGEST 157 +# define RSA_R_INVALID_DIGEST_LENGTH 143 +# define RSA_R_INVALID_HEADER 137 +# define RSA_R_INVALID_LABEL 160 +# define RSA_R_INVALID_MESSAGE_LENGTH 131 +# define RSA_R_INVALID_MGF1_MD 156 +# define RSA_R_INVALID_MULTI_PRIME_KEY 167 +# define RSA_R_INVALID_OAEP_PARAMETERS 161 +# define RSA_R_INVALID_PADDING 138 +# define RSA_R_INVALID_PADDING_MODE 141 +# define RSA_R_INVALID_PSS_PARAMETERS 149 +# define RSA_R_INVALID_PSS_SALTLEN 146 +# define RSA_R_INVALID_SALT_LENGTH 150 +# define RSA_R_INVALID_TRAILER 139 +# define RSA_R_INVALID_X931_DIGEST 142 +# define RSA_R_IQMP_NOT_INVERSE_OF_Q 126 +# define RSA_R_KEY_PRIME_NUM_INVALID 165 +# define RSA_R_KEY_SIZE_TOO_SMALL 120 +# define RSA_R_LAST_OCTET_INVALID 134 +# define RSA_R_MISSING_PRIVATE_KEY 179 +# define RSA_R_MGF1_DIGEST_NOT_ALLOWED 152 +# define RSA_R_MODULUS_TOO_LARGE 105 +# define RSA_R_MP_COEFFICIENT_NOT_INVERSE_OF_R 168 +# define RSA_R_MP_EXPONENT_NOT_CONGRUENT_TO_D 169 +# define RSA_R_MP_R_NOT_PRIME 170 +# define RSA_R_NO_PUBLIC_EXPONENT 140 +# define RSA_R_NULL_BEFORE_BLOCK_MISSING 113 +# define RSA_R_N_DOES_NOT_EQUAL_PRODUCT_OF_PRIMES 172 +# define RSA_R_N_DOES_NOT_EQUAL_P_Q 127 +# define RSA_R_OAEP_DECODING_ERROR 121 +# define RSA_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE 148 +# define RSA_R_PADDING_CHECK_FAILED 114 +# define RSA_R_PKCS_DECODING_ERROR 159 +# define RSA_R_PSS_SALTLEN_TOO_SMALL 164 +# define RSA_R_P_NOT_PRIME 128 +# define RSA_R_Q_NOT_PRIME 129 +# define RSA_R_RSA_OPERATIONS_NOT_SUPPORTED 130 +# define RSA_R_SLEN_CHECK_FAILED 136 +# define RSA_R_SLEN_RECOVERY_FAILED 135 +# define RSA_R_SSLV3_ROLLBACK_ATTACK 115 +# define RSA_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 116 +# define RSA_R_UNKNOWN_ALGORITHM_TYPE 117 +# define RSA_R_UNKNOWN_DIGEST 166 +# define RSA_R_UNKNOWN_MASK_DIGEST 151 +# define RSA_R_UNKNOWN_PADDING_TYPE 118 +# define RSA_R_UNSUPPORTED_ENCRYPTION_TYPE 162 +# define RSA_R_UNSUPPORTED_LABEL_SOURCE 163 +# define RSA_R_UNSUPPORTED_MASK_ALGORITHM 153 +# define RSA_R_UNSUPPORTED_MASK_PARAMETER 154 +# define RSA_R_UNSUPPORTED_SIGNATURE_TYPE 155 +# define RSA_R_VALUE_MISSING 147 +# define RSA_R_WRONG_SIGNATURE_LENGTH 119 + +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/safestack.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/safestack.h new file mode 100644 index 0000000..38b5578 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/safestack.h @@ -0,0 +1,207 @@ +/* + * Copyright 1999-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_SAFESTACK_H +# define HEADER_SAFESTACK_H + +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + +# define STACK_OF(type) struct stack_st_##type + +# define SKM_DEFINE_STACK_OF(t1, t2, t3) \ + STACK_OF(t1); \ + typedef int (*sk_##t1##_compfunc)(const t3 * const *a, const t3 *const *b); \ + typedef void (*sk_##t1##_freefunc)(t3 *a); \ + typedef t3 * (*sk_##t1##_copyfunc)(const t3 *a); \ + static ossl_unused ossl_inline int sk_##t1##_num(const STACK_OF(t1) *sk) \ + { \ + return OPENSSL_sk_num((const OPENSSL_STACK *)sk); \ + } \ + static ossl_unused ossl_inline t2 *sk_##t1##_value(const STACK_OF(t1) *sk, int idx) \ + { \ + return (t2 *)OPENSSL_sk_value((const OPENSSL_STACK *)sk, idx); \ + } \ + static ossl_unused ossl_inline STACK_OF(t1) *sk_##t1##_new(sk_##t1##_compfunc compare) \ + { \ + return (STACK_OF(t1) *)OPENSSL_sk_new((OPENSSL_sk_compfunc)compare); \ + } \ + static ossl_unused ossl_inline STACK_OF(t1) *sk_##t1##_new_null(void) \ + { \ + return (STACK_OF(t1) *)OPENSSL_sk_new_null(); \ + } \ + static ossl_unused ossl_inline STACK_OF(t1) *sk_##t1##_new_reserve(sk_##t1##_compfunc compare, int n) \ + { \ + return (STACK_OF(t1) *)OPENSSL_sk_new_reserve((OPENSSL_sk_compfunc)compare, n); \ + } \ + static ossl_unused ossl_inline int sk_##t1##_reserve(STACK_OF(t1) *sk, int n) \ + { \ + return OPENSSL_sk_reserve((OPENSSL_STACK *)sk, n); \ + } \ + static ossl_unused ossl_inline void sk_##t1##_free(STACK_OF(t1) *sk) \ + { \ + OPENSSL_sk_free((OPENSSL_STACK *)sk); \ + } \ + static ossl_unused ossl_inline void sk_##t1##_zero(STACK_OF(t1) *sk) \ + { \ + OPENSSL_sk_zero((OPENSSL_STACK *)sk); \ + } \ + static ossl_unused ossl_inline t2 *sk_##t1##_delete(STACK_OF(t1) *sk, int i) \ + { \ + return (t2 *)OPENSSL_sk_delete((OPENSSL_STACK *)sk, i); \ + } \ + static ossl_unused ossl_inline t2 *sk_##t1##_delete_ptr(STACK_OF(t1) *sk, t2 *ptr) \ + { \ + return (t2 *)OPENSSL_sk_delete_ptr((OPENSSL_STACK *)sk, \ + (const void *)ptr); \ + } \ + static ossl_unused ossl_inline int sk_##t1##_push(STACK_OF(t1) *sk, t2 *ptr) \ + { \ + return OPENSSL_sk_push((OPENSSL_STACK *)sk, (const void *)ptr); \ + } \ + static ossl_unused ossl_inline int sk_##t1##_unshift(STACK_OF(t1) *sk, t2 *ptr) \ + { \ + return OPENSSL_sk_unshift((OPENSSL_STACK *)sk, (const void *)ptr); \ + } \ + static ossl_unused ossl_inline t2 *sk_##t1##_pop(STACK_OF(t1) *sk) \ + { \ + return (t2 *)OPENSSL_sk_pop((OPENSSL_STACK *)sk); \ + } \ + static ossl_unused ossl_inline t2 *sk_##t1##_shift(STACK_OF(t1) *sk) \ + { \ + return (t2 *)OPENSSL_sk_shift((OPENSSL_STACK *)sk); \ + } \ + static ossl_unused ossl_inline void sk_##t1##_pop_free(STACK_OF(t1) *sk, sk_##t1##_freefunc freefunc) \ + { \ + OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \ + } \ + static ossl_unused ossl_inline int sk_##t1##_insert(STACK_OF(t1) *sk, t2 *ptr, int idx) \ + { \ + return OPENSSL_sk_insert((OPENSSL_STACK *)sk, (const void *)ptr, idx); \ + } \ + static ossl_unused ossl_inline t2 *sk_##t1##_set(STACK_OF(t1) *sk, int idx, t2 *ptr) \ + { \ + return (t2 *)OPENSSL_sk_set((OPENSSL_STACK *)sk, idx, (const void *)ptr); \ + } \ + static ossl_unused ossl_inline int sk_##t1##_find(STACK_OF(t1) *sk, t2 *ptr) \ + { \ + return OPENSSL_sk_find((OPENSSL_STACK *)sk, (const void *)ptr); \ + } \ + static ossl_unused ossl_inline int sk_##t1##_find_ex(STACK_OF(t1) *sk, t2 *ptr) \ + { \ + return OPENSSL_sk_find_ex((OPENSSL_STACK *)sk, (const void *)ptr); \ + } \ + static ossl_unused ossl_inline void sk_##t1##_sort(STACK_OF(t1) *sk) \ + { \ + OPENSSL_sk_sort((OPENSSL_STACK *)sk); \ + } \ + static ossl_unused ossl_inline int sk_##t1##_is_sorted(const STACK_OF(t1) *sk) \ + { \ + return OPENSSL_sk_is_sorted((const OPENSSL_STACK *)sk); \ + } \ + static ossl_unused ossl_inline STACK_OF(t1) * sk_##t1##_dup(const STACK_OF(t1) *sk) \ + { \ + return (STACK_OF(t1) *)OPENSSL_sk_dup((const OPENSSL_STACK *)sk); \ + } \ + static ossl_unused ossl_inline STACK_OF(t1) *sk_##t1##_deep_copy(const STACK_OF(t1) *sk, \ + sk_##t1##_copyfunc copyfunc, \ + sk_##t1##_freefunc freefunc) \ + { \ + return (STACK_OF(t1) *)OPENSSL_sk_deep_copy((const OPENSSL_STACK *)sk, \ + (OPENSSL_sk_copyfunc)copyfunc, \ + (OPENSSL_sk_freefunc)freefunc); \ + } \ + static ossl_unused ossl_inline sk_##t1##_compfunc sk_##t1##_set_cmp_func(STACK_OF(t1) *sk, sk_##t1##_compfunc compare) \ + { \ + return (sk_##t1##_compfunc)OPENSSL_sk_set_cmp_func((OPENSSL_STACK *)sk, (OPENSSL_sk_compfunc)compare); \ + } + +# define DEFINE_SPECIAL_STACK_OF(t1, t2) SKM_DEFINE_STACK_OF(t1, t2, t2) +# define DEFINE_STACK_OF(t) SKM_DEFINE_STACK_OF(t, t, t) +# define DEFINE_SPECIAL_STACK_OF_CONST(t1, t2) \ + SKM_DEFINE_STACK_OF(t1, const t2, t2) +# define DEFINE_STACK_OF_CONST(t) SKM_DEFINE_STACK_OF(t, const t, t) + +/*- + * Strings are special: normally an lhash entry will point to a single + * (somewhat) mutable object. In the case of strings: + * + * a) Instead of a single char, there is an array of chars, NUL-terminated. + * b) The string may have be immutable. + * + * So, they need their own declarations. Especially important for + * type-checking tools, such as Deputy. + * + * In practice, however, it appears to be hard to have a const + * string. For now, I'm settling for dealing with the fact it is a + * string at all. + */ +typedef char *OPENSSL_STRING; +typedef const char *OPENSSL_CSTRING; + +/*- + * Confusingly, LHASH_OF(STRING) deals with char ** throughout, but + * STACK_OF(STRING) is really more like STACK_OF(char), only, as mentioned + * above, instead of a single char each entry is a NUL-terminated array of + * chars. So, we have to implement STRING specially for STACK_OF. This is + * dealt with in the autogenerated macros below. + */ +DEFINE_SPECIAL_STACK_OF(OPENSSL_STRING, char) +DEFINE_SPECIAL_STACK_OF_CONST(OPENSSL_CSTRING, char) + +/* + * Similarly, we sometimes use a block of characters, NOT nul-terminated. + * These should also be distinguished from "normal" stacks. + */ +typedef void *OPENSSL_BLOCK; +DEFINE_SPECIAL_STACK_OF(OPENSSL_BLOCK, void) + +/* + * If called without higher optimization (min. -xO3) the Oracle Developer + * Studio compiler generates code for the defined (static inline) functions + * above. + * This would later lead to the linker complaining about missing symbols when + * this header file is included but the resulting object is not linked against + * the Crypto library (openssl#6912). + */ +# ifdef __SUNPRO_C +# pragma weak OPENSSL_sk_num +# pragma weak OPENSSL_sk_value +# pragma weak OPENSSL_sk_new +# pragma weak OPENSSL_sk_new_null +# pragma weak OPENSSL_sk_new_reserve +# pragma weak OPENSSL_sk_reserve +# pragma weak OPENSSL_sk_free +# pragma weak OPENSSL_sk_zero +# pragma weak OPENSSL_sk_delete +# pragma weak OPENSSL_sk_delete_ptr +# pragma weak OPENSSL_sk_push +# pragma weak OPENSSL_sk_unshift +# pragma weak OPENSSL_sk_pop +# pragma weak OPENSSL_sk_shift +# pragma weak OPENSSL_sk_pop_free +# pragma weak OPENSSL_sk_insert +# pragma weak OPENSSL_sk_set +# pragma weak OPENSSL_sk_find +# pragma weak OPENSSL_sk_find_ex +# pragma weak OPENSSL_sk_sort +# pragma weak OPENSSL_sk_is_sorted +# pragma weak OPENSSL_sk_dup +# pragma weak OPENSSL_sk_deep_copy +# pragma weak OPENSSL_sk_set_cmp_func +# endif /* __SUNPRO_C */ + +# ifdef __cplusplus +} +# endif +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/seed.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/seed.h new file mode 100644 index 0000000..de10b08 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/seed.h @@ -0,0 +1,96 @@ +/* + * Copyright 2007-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +/* + * Copyright (c) 2007 KISA(Korea Information Security Agency). All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Neither the name of author nor the names of its contributors may + * be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef HEADER_SEED_H +# define HEADER_SEED_H + +# include + +# ifndef OPENSSL_NO_SEED +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + +/* look whether we need 'long' to get 32 bits */ +# ifdef AES_LONG +# ifndef SEED_LONG +# define SEED_LONG 1 +# endif +# endif + +# include + +# define SEED_BLOCK_SIZE 16 +# define SEED_KEY_LENGTH 16 + +typedef struct seed_key_st { +# ifdef SEED_LONG + unsigned long data[32]; +# else + unsigned int data[32]; +# endif +} SEED_KEY_SCHEDULE; + +void SEED_set_key(const unsigned char rawkey[SEED_KEY_LENGTH], + SEED_KEY_SCHEDULE *ks); + +void SEED_encrypt(const unsigned char s[SEED_BLOCK_SIZE], + unsigned char d[SEED_BLOCK_SIZE], + const SEED_KEY_SCHEDULE *ks); +void SEED_decrypt(const unsigned char s[SEED_BLOCK_SIZE], + unsigned char d[SEED_BLOCK_SIZE], + const SEED_KEY_SCHEDULE *ks); + +void SEED_ecb_encrypt(const unsigned char *in, unsigned char *out, + const SEED_KEY_SCHEDULE *ks, int enc); +void SEED_cbc_encrypt(const unsigned char *in, unsigned char *out, size_t len, + const SEED_KEY_SCHEDULE *ks, + unsigned char ivec[SEED_BLOCK_SIZE], int enc); +void SEED_cfb128_encrypt(const unsigned char *in, unsigned char *out, + size_t len, const SEED_KEY_SCHEDULE *ks, + unsigned char ivec[SEED_BLOCK_SIZE], int *num, + int enc); +void SEED_ofb128_encrypt(const unsigned char *in, unsigned char *out, + size_t len, const SEED_KEY_SCHEDULE *ks, + unsigned char ivec[SEED_BLOCK_SIZE], int *num); + +# ifdef __cplusplus +} +# endif +# endif + +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/sha.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/sha.h new file mode 100644 index 0000000..6a1eb0d --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/sha.h @@ -0,0 +1,119 @@ +/* + * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_SHA_H +# define HEADER_SHA_H + +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + +/*- + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * ! SHA_LONG has to be at least 32 bits wide. ! + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + */ +# define SHA_LONG unsigned int + +# define SHA_LBLOCK 16 +# define SHA_CBLOCK (SHA_LBLOCK*4)/* SHA treats input data as a + * contiguous array of 32 bit wide + * big-endian values. */ +# define SHA_LAST_BLOCK (SHA_CBLOCK-8) +# define SHA_DIGEST_LENGTH 20 + +typedef struct SHAstate_st { + SHA_LONG h0, h1, h2, h3, h4; + SHA_LONG Nl, Nh; + SHA_LONG data[SHA_LBLOCK]; + unsigned int num; +} SHA_CTX; + +int SHA1_Init(SHA_CTX *c); +int SHA1_Update(SHA_CTX *c, const void *data, size_t len); +int SHA1_Final(unsigned char *md, SHA_CTX *c); +unsigned char *SHA1(const unsigned char *d, size_t n, unsigned char *md); +void SHA1_Transform(SHA_CTX *c, const unsigned char *data); + +# define SHA256_CBLOCK (SHA_LBLOCK*4)/* SHA-256 treats input data as a + * contiguous array of 32 bit wide + * big-endian values. */ + +typedef struct SHA256state_st { + SHA_LONG h[8]; + SHA_LONG Nl, Nh; + SHA_LONG data[SHA_LBLOCK]; + unsigned int num, md_len; +} SHA256_CTX; + +int SHA224_Init(SHA256_CTX *c); +int SHA224_Update(SHA256_CTX *c, const void *data, size_t len); +int SHA224_Final(unsigned char *md, SHA256_CTX *c); +unsigned char *SHA224(const unsigned char *d, size_t n, unsigned char *md); +int SHA256_Init(SHA256_CTX *c); +int SHA256_Update(SHA256_CTX *c, const void *data, size_t len); +int SHA256_Final(unsigned char *md, SHA256_CTX *c); +unsigned char *SHA256(const unsigned char *d, size_t n, unsigned char *md); +void SHA256_Transform(SHA256_CTX *c, const unsigned char *data); + +# define SHA224_DIGEST_LENGTH 28 +# define SHA256_DIGEST_LENGTH 32 +# define SHA384_DIGEST_LENGTH 48 +# define SHA512_DIGEST_LENGTH 64 + +/* + * Unlike 32-bit digest algorithms, SHA-512 *relies* on SHA_LONG64 + * being exactly 64-bit wide. See Implementation Notes in sha512.c + * for further details. + */ +/* + * SHA-512 treats input data as a + * contiguous array of 64 bit + * wide big-endian values. + */ +# define SHA512_CBLOCK (SHA_LBLOCK*8) +# if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32__) +# define SHA_LONG64 unsigned __int64 +# define U64(C) C##UI64 +# elif defined(__arch64__) +# define SHA_LONG64 unsigned long +# define U64(C) C##UL +# else +# define SHA_LONG64 unsigned long long +# define U64(C) C##ULL +# endif + +typedef struct SHA512state_st { + SHA_LONG64 h[8]; + SHA_LONG64 Nl, Nh; + union { + SHA_LONG64 d[SHA_LBLOCK]; + unsigned char p[SHA512_CBLOCK]; + } u; + unsigned int num, md_len; +} SHA512_CTX; + +int SHA384_Init(SHA512_CTX *c); +int SHA384_Update(SHA512_CTX *c, const void *data, size_t len); +int SHA384_Final(unsigned char *md, SHA512_CTX *c); +unsigned char *SHA384(const unsigned char *d, size_t n, unsigned char *md); +int SHA512_Init(SHA512_CTX *c); +int SHA512_Update(SHA512_CTX *c, const void *data, size_t len); +int SHA512_Final(unsigned char *md, SHA512_CTX *c); +unsigned char *SHA512(const unsigned char *d, size_t n, unsigned char *md); +void SHA512_Transform(SHA512_CTX *c, const unsigned char *data); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/srp.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/srp.h new file mode 100644 index 0000000..aaf1355 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/srp.h @@ -0,0 +1,135 @@ +/* + * Copyright 2004-2018 The OpenSSL Project Authors. All Rights Reserved. + * Copyright (c) 2004, EdelKey Project. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + * + * Originally written by Christophe Renou and Peter Sylvester, + * for the EdelKey project. + */ + +#ifndef HEADER_SRP_H +# define HEADER_SRP_H + +#include + +#ifndef OPENSSL_NO_SRP +# include +# include +# include +# include +# include + +# ifdef __cplusplus +extern "C" { +# endif + +typedef struct SRP_gN_cache_st { + char *b64_bn; + BIGNUM *bn; +} SRP_gN_cache; + + +DEFINE_STACK_OF(SRP_gN_cache) + +typedef struct SRP_user_pwd_st { + /* Owned by us. */ + char *id; + BIGNUM *s; + BIGNUM *v; + /* Not owned by us. */ + const BIGNUM *g; + const BIGNUM *N; + /* Owned by us. */ + char *info; +} SRP_user_pwd; + +void SRP_user_pwd_free(SRP_user_pwd *user_pwd); + +DEFINE_STACK_OF(SRP_user_pwd) + +typedef struct SRP_VBASE_st { + STACK_OF(SRP_user_pwd) *users_pwd; + STACK_OF(SRP_gN_cache) *gN_cache; +/* to simulate a user */ + char *seed_key; + const BIGNUM *default_g; + const BIGNUM *default_N; +} SRP_VBASE; + +/* + * Internal structure storing N and g pair + */ +typedef struct SRP_gN_st { + char *id; + const BIGNUM *g; + const BIGNUM *N; +} SRP_gN; + +DEFINE_STACK_OF(SRP_gN) + +SRP_VBASE *SRP_VBASE_new(char *seed_key); +void SRP_VBASE_free(SRP_VBASE *vb); +int SRP_VBASE_init(SRP_VBASE *vb, char *verifier_file); + +/* This method ignores the configured seed and fails for an unknown user. */ +DEPRECATEDIN_1_1_0(SRP_user_pwd *SRP_VBASE_get_by_user(SRP_VBASE *vb, char *username)) +/* NOTE: unlike in SRP_VBASE_get_by_user, caller owns the returned pointer.*/ +SRP_user_pwd *SRP_VBASE_get1_by_user(SRP_VBASE *vb, char *username); + +char *SRP_create_verifier(const char *user, const char *pass, char **salt, + char **verifier, const char *N, const char *g); +int SRP_create_verifier_BN(const char *user, const char *pass, BIGNUM **salt, + BIGNUM **verifier, const BIGNUM *N, + const BIGNUM *g); + +# define SRP_NO_ERROR 0 +# define SRP_ERR_VBASE_INCOMPLETE_FILE 1 +# define SRP_ERR_VBASE_BN_LIB 2 +# define SRP_ERR_OPEN_FILE 3 +# define SRP_ERR_MEMORY 4 + +# define DB_srptype 0 +# define DB_srpverifier 1 +# define DB_srpsalt 2 +# define DB_srpid 3 +# define DB_srpgN 4 +# define DB_srpinfo 5 +# undef DB_NUMBER +# define DB_NUMBER 6 + +# define DB_SRP_INDEX 'I' +# define DB_SRP_VALID 'V' +# define DB_SRP_REVOKED 'R' +# define DB_SRP_MODIF 'v' + +/* see srp.c */ +char *SRP_check_known_gN_param(const BIGNUM *g, const BIGNUM *N); +SRP_gN *SRP_get_default_gN(const char *id); + +/* server side .... */ +BIGNUM *SRP_Calc_server_key(const BIGNUM *A, const BIGNUM *v, const BIGNUM *u, + const BIGNUM *b, const BIGNUM *N); +BIGNUM *SRP_Calc_B(const BIGNUM *b, const BIGNUM *N, const BIGNUM *g, + const BIGNUM *v); +int SRP_Verify_A_mod_N(const BIGNUM *A, const BIGNUM *N); +BIGNUM *SRP_Calc_u(const BIGNUM *A, const BIGNUM *B, const BIGNUM *N); + +/* client side .... */ +BIGNUM *SRP_Calc_x(const BIGNUM *s, const char *user, const char *pass); +BIGNUM *SRP_Calc_A(const BIGNUM *a, const BIGNUM *N, const BIGNUM *g); +BIGNUM *SRP_Calc_client_key(const BIGNUM *N, const BIGNUM *B, const BIGNUM *g, + const BIGNUM *x, const BIGNUM *a, const BIGNUM *u); +int SRP_Verify_B_mod_N(const BIGNUM *B, const BIGNUM *N); + +# define SRP_MINIMAL_N 1024 + +# ifdef __cplusplus +} +# endif +# endif + +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/srtp.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/srtp.h new file mode 100644 index 0000000..0b57c23 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/srtp.h @@ -0,0 +1,50 @@ +/* + * Copyright 2011-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +/* + * DTLS code by Eric Rescorla + * + * Copyright (C) 2006, Network Resonance, Inc. Copyright (C) 2011, RTFM, Inc. + */ + +#ifndef HEADER_D1_SRTP_H +# define HEADER_D1_SRTP_H + +# include + +#ifdef __cplusplus +extern "C" { +#endif + +# define SRTP_AES128_CM_SHA1_80 0x0001 +# define SRTP_AES128_CM_SHA1_32 0x0002 +# define SRTP_AES128_F8_SHA1_80 0x0003 +# define SRTP_AES128_F8_SHA1_32 0x0004 +# define SRTP_NULL_SHA1_80 0x0005 +# define SRTP_NULL_SHA1_32 0x0006 + +/* AEAD SRTP protection profiles from RFC 7714 */ +# define SRTP_AEAD_AES_128_GCM 0x0007 +# define SRTP_AEAD_AES_256_GCM 0x0008 + +# ifndef OPENSSL_NO_SRTP + +__owur int SSL_CTX_set_tlsext_use_srtp(SSL_CTX *ctx, const char *profiles); +__owur int SSL_set_tlsext_use_srtp(SSL *ssl, const char *profiles); + +__owur STACK_OF(SRTP_PROTECTION_PROFILE) *SSL_get_srtp_profiles(SSL *ssl); +__owur SRTP_PROTECTION_PROFILE *SSL_get_selected_srtp_profile(SSL *s); + +# endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/ssl.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/ssl.h new file mode 100644 index 0000000..6724ccf --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/ssl.h @@ -0,0 +1,2438 @@ +/* + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved + * Copyright 2005 Nokia. All rights reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_SSL_H +# define HEADER_SSL_H + +# include +# include +# include +# include +# if OPENSSL_API_COMPAT < 0x10100000L +# include +# include +# include +# endif +# include +# include +# include +# include + +# include +# include +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + +/* OpenSSL version number for ASN.1 encoding of the session information */ +/*- + * Version 0 - initial version + * Version 1 - added the optional peer certificate + */ +# define SSL_SESSION_ASN1_VERSION 0x0001 + +# define SSL_MAX_SSL_SESSION_ID_LENGTH 32 +# define SSL_MAX_SID_CTX_LENGTH 32 + +# define SSL_MIN_RSA_MODULUS_LENGTH_IN_BYTES (512/8) +# define SSL_MAX_KEY_ARG_LENGTH 8 +# define SSL_MAX_MASTER_KEY_LENGTH 48 + +/* The maximum number of encrypt/decrypt pipelines we can support */ +# define SSL_MAX_PIPELINES 32 + +/* text strings for the ciphers */ + +/* These are used to specify which ciphers to use and not to use */ + +# define SSL_TXT_LOW "LOW" +# define SSL_TXT_MEDIUM "MEDIUM" +# define SSL_TXT_HIGH "HIGH" +# define SSL_TXT_FIPS "FIPS" + +# define SSL_TXT_aNULL "aNULL" +# define SSL_TXT_eNULL "eNULL" +# define SSL_TXT_NULL "NULL" + +# define SSL_TXT_kRSA "kRSA" +# define SSL_TXT_kDHr "kDHr"/* this cipher class has been removed */ +# define SSL_TXT_kDHd "kDHd"/* this cipher class has been removed */ +# define SSL_TXT_kDH "kDH"/* this cipher class has been removed */ +# define SSL_TXT_kEDH "kEDH"/* alias for kDHE */ +# define SSL_TXT_kDHE "kDHE" +# define SSL_TXT_kECDHr "kECDHr"/* this cipher class has been removed */ +# define SSL_TXT_kECDHe "kECDHe"/* this cipher class has been removed */ +# define SSL_TXT_kECDH "kECDH"/* this cipher class has been removed */ +# define SSL_TXT_kEECDH "kEECDH"/* alias for kECDHE */ +# define SSL_TXT_kECDHE "kECDHE" +# define SSL_TXT_kPSK "kPSK" +# define SSL_TXT_kRSAPSK "kRSAPSK" +# define SSL_TXT_kECDHEPSK "kECDHEPSK" +# define SSL_TXT_kDHEPSK "kDHEPSK" +# define SSL_TXT_kGOST "kGOST" +# define SSL_TXT_kSRP "kSRP" + +# define SSL_TXT_aRSA "aRSA" +# define SSL_TXT_aDSS "aDSS" +# define SSL_TXT_aDH "aDH"/* this cipher class has been removed */ +# define SSL_TXT_aECDH "aECDH"/* this cipher class has been removed */ +# define SSL_TXT_aECDSA "aECDSA" +# define SSL_TXT_aPSK "aPSK" +# define SSL_TXT_aGOST94 "aGOST94" +# define SSL_TXT_aGOST01 "aGOST01" +# define SSL_TXT_aGOST12 "aGOST12" +# define SSL_TXT_aGOST "aGOST" +# define SSL_TXT_aSRP "aSRP" + +# define SSL_TXT_DSS "DSS" +# define SSL_TXT_DH "DH" +# define SSL_TXT_DHE "DHE"/* same as "kDHE:-ADH" */ +# define SSL_TXT_EDH "EDH"/* alias for DHE */ +# define SSL_TXT_ADH "ADH" +# define SSL_TXT_RSA "RSA" +# define SSL_TXT_ECDH "ECDH" +# define SSL_TXT_EECDH "EECDH"/* alias for ECDHE" */ +# define SSL_TXT_ECDHE "ECDHE"/* same as "kECDHE:-AECDH" */ +# define SSL_TXT_AECDH "AECDH" +# define SSL_TXT_ECDSA "ECDSA" +# define SSL_TXT_PSK "PSK" +# define SSL_TXT_SRP "SRP" + +# define SSL_TXT_DES "DES" +# define SSL_TXT_3DES "3DES" +# define SSL_TXT_RC4 "RC4" +# define SSL_TXT_RC2 "RC2" +# define SSL_TXT_IDEA "IDEA" +# define SSL_TXT_SEED "SEED" +# define SSL_TXT_AES128 "AES128" +# define SSL_TXT_AES256 "AES256" +# define SSL_TXT_AES "AES" +# define SSL_TXT_AES_GCM "AESGCM" +# define SSL_TXT_AES_CCM "AESCCM" +# define SSL_TXT_AES_CCM_8 "AESCCM8" +# define SSL_TXT_CAMELLIA128 "CAMELLIA128" +# define SSL_TXT_CAMELLIA256 "CAMELLIA256" +# define SSL_TXT_CAMELLIA "CAMELLIA" +# define SSL_TXT_CHACHA20 "CHACHA20" +# define SSL_TXT_GOST "GOST89" +# define SSL_TXT_ARIA "ARIA" +# define SSL_TXT_ARIA_GCM "ARIAGCM" +# define SSL_TXT_ARIA128 "ARIA128" +# define SSL_TXT_ARIA256 "ARIA256" + +# define SSL_TXT_MD5 "MD5" +# define SSL_TXT_SHA1 "SHA1" +# define SSL_TXT_SHA "SHA"/* same as "SHA1" */ +# define SSL_TXT_GOST94 "GOST94" +# define SSL_TXT_GOST89MAC "GOST89MAC" +# define SSL_TXT_GOST12 "GOST12" +# define SSL_TXT_GOST89MAC12 "GOST89MAC12" +# define SSL_TXT_SHA256 "SHA256" +# define SSL_TXT_SHA384 "SHA384" + +# define SSL_TXT_SSLV3 "SSLv3" +# define SSL_TXT_TLSV1 "TLSv1" +# define SSL_TXT_TLSV1_1 "TLSv1.1" +# define SSL_TXT_TLSV1_2 "TLSv1.2" + +# define SSL_TXT_ALL "ALL" + +/*- + * COMPLEMENTOF* definitions. These identifiers are used to (de-select) + * ciphers normally not being used. + * Example: "RC4" will activate all ciphers using RC4 including ciphers + * without authentication, which would normally disabled by DEFAULT (due + * the "!ADH" being part of default). Therefore "RC4:!COMPLEMENTOFDEFAULT" + * will make sure that it is also disabled in the specific selection. + * COMPLEMENTOF* identifiers are portable between version, as adjustments + * to the default cipher setup will also be included here. + * + * COMPLEMENTOFDEFAULT does not experience the same special treatment that + * DEFAULT gets, as only selection is being done and no sorting as needed + * for DEFAULT. + */ +# define SSL_TXT_CMPALL "COMPLEMENTOFALL" +# define SSL_TXT_CMPDEF "COMPLEMENTOFDEFAULT" + +/* + * The following cipher list is used by default. It also is substituted when + * an application-defined cipher list string starts with 'DEFAULT'. + * This applies to ciphersuites for TLSv1.2 and below. + */ +# define SSL_DEFAULT_CIPHER_LIST "ALL:!COMPLEMENTOFDEFAULT:!eNULL" +/* This is the default set of TLSv1.3 ciphersuites */ +# if !defined(OPENSSL_NO_CHACHA) && !defined(OPENSSL_NO_POLY1305) +# define TLS_DEFAULT_CIPHERSUITES "TLS_AES_256_GCM_SHA384:" \ + "TLS_CHACHA20_POLY1305_SHA256:" \ + "TLS_AES_128_GCM_SHA256" +# else +# define TLS_DEFAULT_CIPHERSUITES "TLS_AES_256_GCM_SHA384:" \ + "TLS_AES_128_GCM_SHA256" +#endif +/* + * As of OpenSSL 1.0.0, ssl_create_cipher_list() in ssl/ssl_ciph.c always + * starts with a reasonable order, and all we have to do for DEFAULT is + * throwing out anonymous and unencrypted ciphersuites! (The latter are not + * actually enabled by ALL, but "ALL:RSA" would enable some of them.) + */ + +/* Used in SSL_set_shutdown()/SSL_get_shutdown(); */ +# define SSL_SENT_SHUTDOWN 1 +# define SSL_RECEIVED_SHUTDOWN 2 + +#ifdef __cplusplus +} +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +# define SSL_FILETYPE_ASN1 X509_FILETYPE_ASN1 +# define SSL_FILETYPE_PEM X509_FILETYPE_PEM + +/* + * This is needed to stop compilers complaining about the 'struct ssl_st *' + * function parameters used to prototype callbacks in SSL_CTX. + */ +typedef struct ssl_st *ssl_crock_st; +typedef struct tls_session_ticket_ext_st TLS_SESSION_TICKET_EXT; +typedef struct ssl_method_st SSL_METHOD; +typedef struct ssl_cipher_st SSL_CIPHER; +typedef struct ssl_session_st SSL_SESSION; +typedef struct tls_sigalgs_st TLS_SIGALGS; +typedef struct ssl_conf_ctx_st SSL_CONF_CTX; +typedef struct ssl_comp_st SSL_COMP; + +STACK_OF(SSL_CIPHER); +STACK_OF(SSL_COMP); + +/* SRTP protection profiles for use with the use_srtp extension (RFC 5764)*/ +typedef struct srtp_protection_profile_st { + const char *name; + unsigned long id; +} SRTP_PROTECTION_PROFILE; + +DEFINE_STACK_OF(SRTP_PROTECTION_PROFILE) + +typedef int (*tls_session_ticket_ext_cb_fn)(SSL *s, const unsigned char *data, + int len, void *arg); +typedef int (*tls_session_secret_cb_fn)(SSL *s, void *secret, int *secret_len, + STACK_OF(SSL_CIPHER) *peer_ciphers, + const SSL_CIPHER **cipher, void *arg); + +/* Extension context codes */ +/* This extension is only allowed in TLS */ +#define SSL_EXT_TLS_ONLY 0x0001 +/* This extension is only allowed in DTLS */ +#define SSL_EXT_DTLS_ONLY 0x0002 +/* Some extensions may be allowed in DTLS but we don't implement them for it */ +#define SSL_EXT_TLS_IMPLEMENTATION_ONLY 0x0004 +/* Most extensions are not defined for SSLv3 but EXT_TYPE_renegotiate is */ +#define SSL_EXT_SSL3_ALLOWED 0x0008 +/* Extension is only defined for TLS1.2 and below */ +#define SSL_EXT_TLS1_2_AND_BELOW_ONLY 0x0010 +/* Extension is only defined for TLS1.3 and above */ +#define SSL_EXT_TLS1_3_ONLY 0x0020 +/* Ignore this extension during parsing if we are resuming */ +#define SSL_EXT_IGNORE_ON_RESUMPTION 0x0040 +#define SSL_EXT_CLIENT_HELLO 0x0080 +/* Really means TLS1.2 or below */ +#define SSL_EXT_TLS1_2_SERVER_HELLO 0x0100 +#define SSL_EXT_TLS1_3_SERVER_HELLO 0x0200 +#define SSL_EXT_TLS1_3_ENCRYPTED_EXTENSIONS 0x0400 +#define SSL_EXT_TLS1_3_HELLO_RETRY_REQUEST 0x0800 +#define SSL_EXT_TLS1_3_CERTIFICATE 0x1000 +#define SSL_EXT_TLS1_3_NEW_SESSION_TICKET 0x2000 +#define SSL_EXT_TLS1_3_CERTIFICATE_REQUEST 0x4000 + +/* Typedefs for handling custom extensions */ + +typedef int (*custom_ext_add_cb)(SSL *s, unsigned int ext_type, + const unsigned char **out, size_t *outlen, + int *al, void *add_arg); + +typedef void (*custom_ext_free_cb)(SSL *s, unsigned int ext_type, + const unsigned char *out, void *add_arg); + +typedef int (*custom_ext_parse_cb)(SSL *s, unsigned int ext_type, + const unsigned char *in, size_t inlen, + int *al, void *parse_arg); + + +typedef int (*SSL_custom_ext_add_cb_ex)(SSL *s, unsigned int ext_type, + unsigned int context, + const unsigned char **out, + size_t *outlen, X509 *x, + size_t chainidx, + int *al, void *add_arg); + +typedef void (*SSL_custom_ext_free_cb_ex)(SSL *s, unsigned int ext_type, + unsigned int context, + const unsigned char *out, + void *add_arg); + +typedef int (*SSL_custom_ext_parse_cb_ex)(SSL *s, unsigned int ext_type, + unsigned int context, + const unsigned char *in, + size_t inlen, X509 *x, + size_t chainidx, + int *al, void *parse_arg); + +/* Typedef for verification callback */ +typedef int (*SSL_verify_cb)(int preverify_ok, X509_STORE_CTX *x509_ctx); + +/* + * Some values are reserved until OpenSSL 1.2.0 because they were previously + * included in SSL_OP_ALL in a 1.1.x release. + * + * Reserved value (until OpenSSL 1.2.0) 0x00000001U + * Reserved value (until OpenSSL 1.2.0) 0x00000002U + */ +/* Allow initial connection to servers that don't support RI */ +# define SSL_OP_LEGACY_SERVER_CONNECT 0x00000004U + +/* Reserved value (until OpenSSL 1.2.0) 0x00000008U */ +# define SSL_OP_TLSEXT_PADDING 0x00000010U +/* Reserved value (until OpenSSL 1.2.0) 0x00000020U */ +# define SSL_OP_SAFARI_ECDHE_ECDSA_BUG 0x00000040U +/* + * Reserved value (until OpenSSL 1.2.0) 0x00000080U + * Reserved value (until OpenSSL 1.2.0) 0x00000100U + * Reserved value (until OpenSSL 1.2.0) 0x00000200U + */ + +/* In TLSv1.3 allow a non-(ec)dhe based kex_mode */ +# define SSL_OP_ALLOW_NO_DHE_KEX 0x00000400U + +/* + * Disable SSL 3.0/TLS 1.0 CBC vulnerability workaround that was added in + * OpenSSL 0.9.6d. Usually (depending on the application protocol) the + * workaround is not needed. Unfortunately some broken SSL/TLS + * implementations cannot handle it at all, which is why we include it in + * SSL_OP_ALL. Added in 0.9.6e + */ +# define SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS 0x00000800U + +/* DTLS options */ +# define SSL_OP_NO_QUERY_MTU 0x00001000U +/* Turn on Cookie Exchange (on relevant for servers) */ +# define SSL_OP_COOKIE_EXCHANGE 0x00002000U +/* Don't use RFC4507 ticket extension */ +# define SSL_OP_NO_TICKET 0x00004000U +# ifndef OPENSSL_NO_DTLS1_METHOD +/* Use Cisco's "speshul" version of DTLS_BAD_VER + * (only with deprecated DTLSv1_client_method()) */ +# define SSL_OP_CISCO_ANYCONNECT 0x00008000U +# endif + +/* As server, disallow session resumption on renegotiation */ +# define SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION 0x00010000U +/* Don't use compression even if supported */ +# define SSL_OP_NO_COMPRESSION 0x00020000U +/* Permit unsafe legacy renegotiation */ +# define SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION 0x00040000U +/* Disable encrypt-then-mac */ +# define SSL_OP_NO_ENCRYPT_THEN_MAC 0x00080000U + +/* + * Enable TLSv1.3 Compatibility mode. This is on by default. A future version + * of OpenSSL may have this disabled by default. + */ +# define SSL_OP_ENABLE_MIDDLEBOX_COMPAT 0x00100000U + +/* Prioritize Chacha20Poly1305 when client does. + * Modifies SSL_OP_CIPHER_SERVER_PREFERENCE */ +# define SSL_OP_PRIORITIZE_CHACHA 0x00200000U + +/* + * Set on servers to choose the cipher according to the server's preferences + */ +# define SSL_OP_CIPHER_SERVER_PREFERENCE 0x00400000U +/* + * If set, a server will allow a client to issue a SSLv3.0 version number as + * latest version supported in the premaster secret, even when TLSv1.0 + * (version 3.1) was announced in the client hello. Normally this is + * forbidden to prevent version rollback attacks. + */ +# define SSL_OP_TLS_ROLLBACK_BUG 0x00800000U + +/* + * Switches off automatic TLSv1.3 anti-replay protection for early data. This + * is a server-side option only (no effect on the client). + */ +# define SSL_OP_NO_ANTI_REPLAY 0x01000000U + +# define SSL_OP_NO_SSLv3 0x02000000U +# define SSL_OP_NO_TLSv1 0x04000000U +# define SSL_OP_NO_TLSv1_2 0x08000000U +# define SSL_OP_NO_TLSv1_1 0x10000000U +# define SSL_OP_NO_TLSv1_3 0x20000000U + +# define SSL_OP_NO_DTLSv1 0x04000000U +# define SSL_OP_NO_DTLSv1_2 0x08000000U + +# define SSL_OP_NO_SSL_MASK (SSL_OP_NO_SSLv3|\ + SSL_OP_NO_TLSv1|SSL_OP_NO_TLSv1_1|SSL_OP_NO_TLSv1_2|SSL_OP_NO_TLSv1_3) +# define SSL_OP_NO_DTLS_MASK (SSL_OP_NO_DTLSv1|SSL_OP_NO_DTLSv1_2) + +/* Disallow all renegotiation */ +# define SSL_OP_NO_RENEGOTIATION 0x40000000U + +/* + * Make server add server-hello extension from early version of cryptopro + * draft, when GOST ciphersuite is negotiated. Required for interoperability + * with CryptoPro CSP 3.x + */ +# define SSL_OP_CRYPTOPRO_TLSEXT_BUG 0x80000000U + +/* + * SSL_OP_ALL: various bug workarounds that should be rather harmless. + * This used to be 0x000FFFFFL before 0.9.7. + * This used to be 0x80000BFFU before 1.1.1. + */ +# define SSL_OP_ALL (SSL_OP_CRYPTOPRO_TLSEXT_BUG|\ + SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS|\ + SSL_OP_LEGACY_SERVER_CONNECT|\ + SSL_OP_TLSEXT_PADDING|\ + SSL_OP_SAFARI_ECDHE_ECDSA_BUG) + +/* OBSOLETE OPTIONS: retained for compatibility */ + +/* Removed from OpenSSL 1.1.0. Was 0x00000001L */ +/* Related to removed SSLv2. */ +# define SSL_OP_MICROSOFT_SESS_ID_BUG 0x0 +/* Removed from OpenSSL 1.1.0. Was 0x00000002L */ +/* Related to removed SSLv2. */ +# define SSL_OP_NETSCAPE_CHALLENGE_BUG 0x0 +/* Removed from OpenSSL 0.9.8q and 1.0.0c. Was 0x00000008L */ +/* Dead forever, see CVE-2010-4180 */ +# define SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG 0x0 +/* Removed from OpenSSL 1.0.1h and 1.0.2. Was 0x00000010L */ +/* Refers to ancient SSLREF and SSLv2. */ +# define SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG 0x0 +/* Removed from OpenSSL 1.1.0. Was 0x00000020 */ +# define SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER 0x0 +/* Removed from OpenSSL 0.9.7h and 0.9.8b. Was 0x00000040L */ +# define SSL_OP_MSIE_SSLV2_RSA_PADDING 0x0 +/* Removed from OpenSSL 1.1.0. Was 0x00000080 */ +/* Ancient SSLeay version. */ +# define SSL_OP_SSLEAY_080_CLIENT_DH_BUG 0x0 +/* Removed from OpenSSL 1.1.0. Was 0x00000100L */ +# define SSL_OP_TLS_D5_BUG 0x0 +/* Removed from OpenSSL 1.1.0. Was 0x00000200L */ +# define SSL_OP_TLS_BLOCK_PADDING_BUG 0x0 +/* Removed from OpenSSL 1.1.0. Was 0x00080000L */ +# define SSL_OP_SINGLE_ECDH_USE 0x0 +/* Removed from OpenSSL 1.1.0. Was 0x00100000L */ +# define SSL_OP_SINGLE_DH_USE 0x0 +/* Removed from OpenSSL 1.0.1k and 1.0.2. Was 0x00200000L */ +# define SSL_OP_EPHEMERAL_RSA 0x0 +/* Removed from OpenSSL 1.1.0. Was 0x01000000L */ +# define SSL_OP_NO_SSLv2 0x0 +/* Removed from OpenSSL 1.0.1. Was 0x08000000L */ +# define SSL_OP_PKCS1_CHECK_1 0x0 +/* Removed from OpenSSL 1.0.1. Was 0x10000000L */ +# define SSL_OP_PKCS1_CHECK_2 0x0 +/* Removed from OpenSSL 1.1.0. Was 0x20000000L */ +# define SSL_OP_NETSCAPE_CA_DN_BUG 0x0 +/* Removed from OpenSSL 1.1.0. Was 0x40000000L */ +# define SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG 0x0 + +/* + * Allow SSL_write(..., n) to return r with 0 < r < n (i.e. report success + * when just a single record has been written): + */ +# define SSL_MODE_ENABLE_PARTIAL_WRITE 0x00000001U +/* + * Make it possible to retry SSL_write() with changed buffer location (buffer + * contents must stay the same!); this is not the default to avoid the + * misconception that non-blocking SSL_write() behaves like non-blocking + * write(): + */ +# define SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER 0x00000002U +/* + * Never bother the application with retries if the transport is blocking: + */ +# define SSL_MODE_AUTO_RETRY 0x00000004U +/* Don't attempt to automatically build certificate chain */ +# define SSL_MODE_NO_AUTO_CHAIN 0x00000008U +/* + * Save RAM by releasing read and write buffers when they're empty. (SSL3 and + * TLS only.) Released buffers are freed. + */ +# define SSL_MODE_RELEASE_BUFFERS 0x00000010U +/* + * Send the current time in the Random fields of the ClientHello and + * ServerHello records for compatibility with hypothetical implementations + * that require it. + */ +# define SSL_MODE_SEND_CLIENTHELLO_TIME 0x00000020U +# define SSL_MODE_SEND_SERVERHELLO_TIME 0x00000040U +/* + * Send TLS_FALLBACK_SCSV in the ClientHello. To be set only by applications + * that reconnect with a downgraded protocol version; see + * draft-ietf-tls-downgrade-scsv-00 for details. DO NOT ENABLE THIS if your + * application attempts a normal handshake. Only use this in explicit + * fallback retries, following the guidance in + * draft-ietf-tls-downgrade-scsv-00. + */ +# define SSL_MODE_SEND_FALLBACK_SCSV 0x00000080U +/* + * Support Asynchronous operation + */ +# define SSL_MODE_ASYNC 0x00000100U + +/* + * When using DTLS/SCTP, include the terminating zero in the label + * used for computing the endpoint-pair shared secret. Required for + * interoperability with implementations having this bug like these + * older version of OpenSSL: + * - OpenSSL 1.0.0 series + * - OpenSSL 1.0.1 series + * - OpenSSL 1.0.2 series + * - OpenSSL 1.1.0 series + * - OpenSSL 1.1.1 and 1.1.1a + */ +# define SSL_MODE_DTLS_SCTP_LABEL_LENGTH_BUG 0x00000400U + +/* Cert related flags */ +/* + * Many implementations ignore some aspects of the TLS standards such as + * enforcing certificate chain algorithms. When this is set we enforce them. + */ +# define SSL_CERT_FLAG_TLS_STRICT 0x00000001U + +/* Suite B modes, takes same values as certificate verify flags */ +# define SSL_CERT_FLAG_SUITEB_128_LOS_ONLY 0x10000 +/* Suite B 192 bit only mode */ +# define SSL_CERT_FLAG_SUITEB_192_LOS 0x20000 +/* Suite B 128 bit mode allowing 192 bit algorithms */ +# define SSL_CERT_FLAG_SUITEB_128_LOS 0x30000 + +/* Perform all sorts of protocol violations for testing purposes */ +# define SSL_CERT_FLAG_BROKEN_PROTOCOL 0x10000000 + +/* Flags for building certificate chains */ +/* Treat any existing certificates as untrusted CAs */ +# define SSL_BUILD_CHAIN_FLAG_UNTRUSTED 0x1 +/* Don't include root CA in chain */ +# define SSL_BUILD_CHAIN_FLAG_NO_ROOT 0x2 +/* Just check certificates already there */ +# define SSL_BUILD_CHAIN_FLAG_CHECK 0x4 +/* Ignore verification errors */ +# define SSL_BUILD_CHAIN_FLAG_IGNORE_ERROR 0x8 +/* Clear verification errors from queue */ +# define SSL_BUILD_CHAIN_FLAG_CLEAR_ERROR 0x10 + +/* Flags returned by SSL_check_chain */ +/* Certificate can be used with this session */ +# define CERT_PKEY_VALID 0x1 +/* Certificate can also be used for signing */ +# define CERT_PKEY_SIGN 0x2 +/* EE certificate signing algorithm OK */ +# define CERT_PKEY_EE_SIGNATURE 0x10 +/* CA signature algorithms OK */ +# define CERT_PKEY_CA_SIGNATURE 0x20 +/* EE certificate parameters OK */ +# define CERT_PKEY_EE_PARAM 0x40 +/* CA certificate parameters OK */ +# define CERT_PKEY_CA_PARAM 0x80 +/* Signing explicitly allowed as opposed to SHA1 fallback */ +# define CERT_PKEY_EXPLICIT_SIGN 0x100 +/* Client CA issuer names match (always set for server cert) */ +# define CERT_PKEY_ISSUER_NAME 0x200 +/* Cert type matches client types (always set for server cert) */ +# define CERT_PKEY_CERT_TYPE 0x400 +/* Cert chain suitable to Suite B */ +# define CERT_PKEY_SUITEB 0x800 + +# define SSL_CONF_FLAG_CMDLINE 0x1 +# define SSL_CONF_FLAG_FILE 0x2 +# define SSL_CONF_FLAG_CLIENT 0x4 +# define SSL_CONF_FLAG_SERVER 0x8 +# define SSL_CONF_FLAG_SHOW_ERRORS 0x10 +# define SSL_CONF_FLAG_CERTIFICATE 0x20 +# define SSL_CONF_FLAG_REQUIRE_PRIVATE 0x40 +/* Configuration value types */ +# define SSL_CONF_TYPE_UNKNOWN 0x0 +# define SSL_CONF_TYPE_STRING 0x1 +# define SSL_CONF_TYPE_FILE 0x2 +# define SSL_CONF_TYPE_DIR 0x3 +# define SSL_CONF_TYPE_NONE 0x4 + +/* Maximum length of the application-controlled segment of a a TLSv1.3 cookie */ +# define SSL_COOKIE_LENGTH 4096 + +/* + * Note: SSL[_CTX]_set_{options,mode} use |= op on the previous value, they + * cannot be used to clear bits. + */ + +unsigned long SSL_CTX_get_options(const SSL_CTX *ctx); +unsigned long SSL_get_options(const SSL *s); +unsigned long SSL_CTX_clear_options(SSL_CTX *ctx, unsigned long op); +unsigned long SSL_clear_options(SSL *s, unsigned long op); +unsigned long SSL_CTX_set_options(SSL_CTX *ctx, unsigned long op); +unsigned long SSL_set_options(SSL *s, unsigned long op); + +# define SSL_CTX_set_mode(ctx,op) \ + SSL_CTX_ctrl((ctx),SSL_CTRL_MODE,(op),NULL) +# define SSL_CTX_clear_mode(ctx,op) \ + SSL_CTX_ctrl((ctx),SSL_CTRL_CLEAR_MODE,(op),NULL) +# define SSL_CTX_get_mode(ctx) \ + SSL_CTX_ctrl((ctx),SSL_CTRL_MODE,0,NULL) +# define SSL_clear_mode(ssl,op) \ + SSL_ctrl((ssl),SSL_CTRL_CLEAR_MODE,(op),NULL) +# define SSL_set_mode(ssl,op) \ + SSL_ctrl((ssl),SSL_CTRL_MODE,(op),NULL) +# define SSL_get_mode(ssl) \ + SSL_ctrl((ssl),SSL_CTRL_MODE,0,NULL) +# define SSL_set_mtu(ssl, mtu) \ + SSL_ctrl((ssl),SSL_CTRL_SET_MTU,(mtu),NULL) +# define DTLS_set_link_mtu(ssl, mtu) \ + SSL_ctrl((ssl),DTLS_CTRL_SET_LINK_MTU,(mtu),NULL) +# define DTLS_get_link_min_mtu(ssl) \ + SSL_ctrl((ssl),DTLS_CTRL_GET_LINK_MIN_MTU,0,NULL) + +# define SSL_get_secure_renegotiation_support(ssl) \ + SSL_ctrl((ssl), SSL_CTRL_GET_RI_SUPPORT, 0, NULL) + +# ifndef OPENSSL_NO_HEARTBEATS +# define SSL_heartbeat(ssl) \ + SSL_ctrl((ssl),SSL_CTRL_DTLS_EXT_SEND_HEARTBEAT,0,NULL) +# endif + +# define SSL_CTX_set_cert_flags(ctx,op) \ + SSL_CTX_ctrl((ctx),SSL_CTRL_CERT_FLAGS,(op),NULL) +# define SSL_set_cert_flags(s,op) \ + SSL_ctrl((s),SSL_CTRL_CERT_FLAGS,(op),NULL) +# define SSL_CTX_clear_cert_flags(ctx,op) \ + SSL_CTX_ctrl((ctx),SSL_CTRL_CLEAR_CERT_FLAGS,(op),NULL) +# define SSL_clear_cert_flags(s,op) \ + SSL_ctrl((s),SSL_CTRL_CLEAR_CERT_FLAGS,(op),NULL) + +void SSL_CTX_set_msg_callback(SSL_CTX *ctx, + void (*cb) (int write_p, int version, + int content_type, const void *buf, + size_t len, SSL *ssl, void *arg)); +void SSL_set_msg_callback(SSL *ssl, + void (*cb) (int write_p, int version, + int content_type, const void *buf, + size_t len, SSL *ssl, void *arg)); +# define SSL_CTX_set_msg_callback_arg(ctx, arg) SSL_CTX_ctrl((ctx), SSL_CTRL_SET_MSG_CALLBACK_ARG, 0, (arg)) +# define SSL_set_msg_callback_arg(ssl, arg) SSL_ctrl((ssl), SSL_CTRL_SET_MSG_CALLBACK_ARG, 0, (arg)) + +# define SSL_get_extms_support(s) \ + SSL_ctrl((s),SSL_CTRL_GET_EXTMS_SUPPORT,0,NULL) + +# ifndef OPENSSL_NO_SRP + +/* see tls_srp.c */ +__owur int SSL_SRP_CTX_init(SSL *s); +__owur int SSL_CTX_SRP_CTX_init(SSL_CTX *ctx); +int SSL_SRP_CTX_free(SSL *ctx); +int SSL_CTX_SRP_CTX_free(SSL_CTX *ctx); +__owur int SSL_srp_server_param_with_username(SSL *s, int *ad); +__owur int SRP_Calc_A_param(SSL *s); + +# endif + +/* 100k max cert list */ +# define SSL_MAX_CERT_LIST_DEFAULT 1024*100 + +# define SSL_SESSION_CACHE_MAX_SIZE_DEFAULT (1024*20) + +/* + * This callback type is used inside SSL_CTX, SSL, and in the functions that + * set them. It is used to override the generation of SSL/TLS session IDs in + * a server. Return value should be zero on an error, non-zero to proceed. + * Also, callbacks should themselves check if the id they generate is unique + * otherwise the SSL handshake will fail with an error - callbacks can do + * this using the 'ssl' value they're passed by; + * SSL_has_matching_session_id(ssl, id, *id_len) The length value passed in + * is set at the maximum size the session ID can be. In SSLv3/TLSv1 it is 32 + * bytes. The callback can alter this length to be less if desired. It is + * also an error for the callback to set the size to zero. + */ +typedef int (*GEN_SESSION_CB) (SSL *ssl, unsigned char *id, + unsigned int *id_len); + +# define SSL_SESS_CACHE_OFF 0x0000 +# define SSL_SESS_CACHE_CLIENT 0x0001 +# define SSL_SESS_CACHE_SERVER 0x0002 +# define SSL_SESS_CACHE_BOTH (SSL_SESS_CACHE_CLIENT|SSL_SESS_CACHE_SERVER) +# define SSL_SESS_CACHE_NO_AUTO_CLEAR 0x0080 +/* enough comments already ... see SSL_CTX_set_session_cache_mode(3) */ +# define SSL_SESS_CACHE_NO_INTERNAL_LOOKUP 0x0100 +# define SSL_SESS_CACHE_NO_INTERNAL_STORE 0x0200 +# define SSL_SESS_CACHE_NO_INTERNAL \ + (SSL_SESS_CACHE_NO_INTERNAL_LOOKUP|SSL_SESS_CACHE_NO_INTERNAL_STORE) + +LHASH_OF(SSL_SESSION) *SSL_CTX_sessions(SSL_CTX *ctx); +# define SSL_CTX_sess_number(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_NUMBER,0,NULL) +# define SSL_CTX_sess_connect(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CONNECT,0,NULL) +# define SSL_CTX_sess_connect_good(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CONNECT_GOOD,0,NULL) +# define SSL_CTX_sess_connect_renegotiate(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CONNECT_RENEGOTIATE,0,NULL) +# define SSL_CTX_sess_accept(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_ACCEPT,0,NULL) +# define SSL_CTX_sess_accept_renegotiate(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_ACCEPT_RENEGOTIATE,0,NULL) +# define SSL_CTX_sess_accept_good(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_ACCEPT_GOOD,0,NULL) +# define SSL_CTX_sess_hits(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_HIT,0,NULL) +# define SSL_CTX_sess_cb_hits(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CB_HIT,0,NULL) +# define SSL_CTX_sess_misses(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_MISSES,0,NULL) +# define SSL_CTX_sess_timeouts(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_TIMEOUTS,0,NULL) +# define SSL_CTX_sess_cache_full(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CACHE_FULL,0,NULL) + +void SSL_CTX_sess_set_new_cb(SSL_CTX *ctx, + int (*new_session_cb) (struct ssl_st *ssl, + SSL_SESSION *sess)); +int (*SSL_CTX_sess_get_new_cb(SSL_CTX *ctx)) (struct ssl_st *ssl, + SSL_SESSION *sess); +void SSL_CTX_sess_set_remove_cb(SSL_CTX *ctx, + void (*remove_session_cb) (struct ssl_ctx_st + *ctx, + SSL_SESSION *sess)); +void (*SSL_CTX_sess_get_remove_cb(SSL_CTX *ctx)) (struct ssl_ctx_st *ctx, + SSL_SESSION *sess); +void SSL_CTX_sess_set_get_cb(SSL_CTX *ctx, + SSL_SESSION *(*get_session_cb) (struct ssl_st + *ssl, + const unsigned char + *data, int len, + int *copy)); +SSL_SESSION *(*SSL_CTX_sess_get_get_cb(SSL_CTX *ctx)) (struct ssl_st *ssl, + const unsigned char *data, + int len, int *copy); +void SSL_CTX_set_info_callback(SSL_CTX *ctx, + void (*cb) (const SSL *ssl, int type, int val)); +void (*SSL_CTX_get_info_callback(SSL_CTX *ctx)) (const SSL *ssl, int type, + int val); +void SSL_CTX_set_client_cert_cb(SSL_CTX *ctx, + int (*client_cert_cb) (SSL *ssl, X509 **x509, + EVP_PKEY **pkey)); +int (*SSL_CTX_get_client_cert_cb(SSL_CTX *ctx)) (SSL *ssl, X509 **x509, + EVP_PKEY **pkey); +# ifndef OPENSSL_NO_ENGINE +__owur int SSL_CTX_set_client_cert_engine(SSL_CTX *ctx, ENGINE *e); +# endif +void SSL_CTX_set_cookie_generate_cb(SSL_CTX *ctx, + int (*app_gen_cookie_cb) (SSL *ssl, + unsigned char + *cookie, + unsigned int + *cookie_len)); +void SSL_CTX_set_cookie_verify_cb(SSL_CTX *ctx, + int (*app_verify_cookie_cb) (SSL *ssl, + const unsigned + char *cookie, + unsigned int + cookie_len)); + +void SSL_CTX_set_stateless_cookie_generate_cb( + SSL_CTX *ctx, + int (*gen_stateless_cookie_cb) (SSL *ssl, + unsigned char *cookie, + size_t *cookie_len)); +void SSL_CTX_set_stateless_cookie_verify_cb( + SSL_CTX *ctx, + int (*verify_stateless_cookie_cb) (SSL *ssl, + const unsigned char *cookie, + size_t cookie_len)); +# ifndef OPENSSL_NO_NEXTPROTONEG + +typedef int (*SSL_CTX_npn_advertised_cb_func)(SSL *ssl, + const unsigned char **out, + unsigned int *outlen, + void *arg); +void SSL_CTX_set_next_protos_advertised_cb(SSL_CTX *s, + SSL_CTX_npn_advertised_cb_func cb, + void *arg); +# define SSL_CTX_set_npn_advertised_cb SSL_CTX_set_next_protos_advertised_cb + +typedef int (*SSL_CTX_npn_select_cb_func)(SSL *s, + unsigned char **out, + unsigned char *outlen, + const unsigned char *in, + unsigned int inlen, + void *arg); +void SSL_CTX_set_next_proto_select_cb(SSL_CTX *s, + SSL_CTX_npn_select_cb_func cb, + void *arg); +# define SSL_CTX_set_npn_select_cb SSL_CTX_set_next_proto_select_cb + +void SSL_get0_next_proto_negotiated(const SSL *s, const unsigned char **data, + unsigned *len); +# define SSL_get0_npn_negotiated SSL_get0_next_proto_negotiated +# endif + +__owur int SSL_select_next_proto(unsigned char **out, unsigned char *outlen, + const unsigned char *in, unsigned int inlen, + const unsigned char *client, + unsigned int client_len); + +# define OPENSSL_NPN_UNSUPPORTED 0 +# define OPENSSL_NPN_NEGOTIATED 1 +# define OPENSSL_NPN_NO_OVERLAP 2 + +__owur int SSL_CTX_set_alpn_protos(SSL_CTX *ctx, const unsigned char *protos, + unsigned int protos_len); +__owur int SSL_set_alpn_protos(SSL *ssl, const unsigned char *protos, + unsigned int protos_len); +typedef int (*SSL_CTX_alpn_select_cb_func)(SSL *ssl, + const unsigned char **out, + unsigned char *outlen, + const unsigned char *in, + unsigned int inlen, + void *arg); +void SSL_CTX_set_alpn_select_cb(SSL_CTX *ctx, + SSL_CTX_alpn_select_cb_func cb, + void *arg); +void SSL_get0_alpn_selected(const SSL *ssl, const unsigned char **data, + unsigned int *len); + +# ifndef OPENSSL_NO_PSK +/* + * the maximum length of the buffer given to callbacks containing the + * resulting identity/psk + */ +# define PSK_MAX_IDENTITY_LEN 128 +# define PSK_MAX_PSK_LEN 256 +typedef unsigned int (*SSL_psk_client_cb_func)(SSL *ssl, + const char *hint, + char *identity, + unsigned int max_identity_len, + unsigned char *psk, + unsigned int max_psk_len); +void SSL_CTX_set_psk_client_callback(SSL_CTX *ctx, SSL_psk_client_cb_func cb); +void SSL_set_psk_client_callback(SSL *ssl, SSL_psk_client_cb_func cb); + +typedef unsigned int (*SSL_psk_server_cb_func)(SSL *ssl, + const char *identity, + unsigned char *psk, + unsigned int max_psk_len); +void SSL_CTX_set_psk_server_callback(SSL_CTX *ctx, SSL_psk_server_cb_func cb); +void SSL_set_psk_server_callback(SSL *ssl, SSL_psk_server_cb_func cb); + +__owur int SSL_CTX_use_psk_identity_hint(SSL_CTX *ctx, const char *identity_hint); +__owur int SSL_use_psk_identity_hint(SSL *s, const char *identity_hint); +const char *SSL_get_psk_identity_hint(const SSL *s); +const char *SSL_get_psk_identity(const SSL *s); +# endif + +typedef int (*SSL_psk_find_session_cb_func)(SSL *ssl, + const unsigned char *identity, + size_t identity_len, + SSL_SESSION **sess); +typedef int (*SSL_psk_use_session_cb_func)(SSL *ssl, const EVP_MD *md, + const unsigned char **id, + size_t *idlen, + SSL_SESSION **sess); + +void SSL_set_psk_find_session_callback(SSL *s, SSL_psk_find_session_cb_func cb); +void SSL_CTX_set_psk_find_session_callback(SSL_CTX *ctx, + SSL_psk_find_session_cb_func cb); +void SSL_set_psk_use_session_callback(SSL *s, SSL_psk_use_session_cb_func cb); +void SSL_CTX_set_psk_use_session_callback(SSL_CTX *ctx, + SSL_psk_use_session_cb_func cb); + +/* Register callbacks to handle custom TLS Extensions for client or server. */ + +__owur int SSL_CTX_has_client_custom_ext(const SSL_CTX *ctx, + unsigned int ext_type); + +__owur int SSL_CTX_add_client_custom_ext(SSL_CTX *ctx, + unsigned int ext_type, + custom_ext_add_cb add_cb, + custom_ext_free_cb free_cb, + void *add_arg, + custom_ext_parse_cb parse_cb, + void *parse_arg); + +__owur int SSL_CTX_add_server_custom_ext(SSL_CTX *ctx, + unsigned int ext_type, + custom_ext_add_cb add_cb, + custom_ext_free_cb free_cb, + void *add_arg, + custom_ext_parse_cb parse_cb, + void *parse_arg); + +__owur int SSL_CTX_add_custom_ext(SSL_CTX *ctx, unsigned int ext_type, + unsigned int context, + SSL_custom_ext_add_cb_ex add_cb, + SSL_custom_ext_free_cb_ex free_cb, + void *add_arg, + SSL_custom_ext_parse_cb_ex parse_cb, + void *parse_arg); + +__owur int SSL_extension_supported(unsigned int ext_type); + +# define SSL_NOTHING 1 +# define SSL_WRITING 2 +# define SSL_READING 3 +# define SSL_X509_LOOKUP 4 +# define SSL_ASYNC_PAUSED 5 +# define SSL_ASYNC_NO_JOBS 6 +# define SSL_CLIENT_HELLO_CB 7 + +/* These will only be used when doing non-blocking IO */ +# define SSL_want_nothing(s) (SSL_want(s) == SSL_NOTHING) +# define SSL_want_read(s) (SSL_want(s) == SSL_READING) +# define SSL_want_write(s) (SSL_want(s) == SSL_WRITING) +# define SSL_want_x509_lookup(s) (SSL_want(s) == SSL_X509_LOOKUP) +# define SSL_want_async(s) (SSL_want(s) == SSL_ASYNC_PAUSED) +# define SSL_want_async_job(s) (SSL_want(s) == SSL_ASYNC_NO_JOBS) +# define SSL_want_client_hello_cb(s) (SSL_want(s) == SSL_CLIENT_HELLO_CB) + +# define SSL_MAC_FLAG_READ_MAC_STREAM 1 +# define SSL_MAC_FLAG_WRITE_MAC_STREAM 2 + +/* + * A callback for logging out TLS key material. This callback should log out + * |line| followed by a newline. + */ +typedef void (*SSL_CTX_keylog_cb_func)(const SSL *ssl, const char *line); + +/* + * SSL_CTX_set_keylog_callback configures a callback to log key material. This + * is intended for debugging use with tools like Wireshark. The cb function + * should log line followed by a newline. + */ +void SSL_CTX_set_keylog_callback(SSL_CTX *ctx, SSL_CTX_keylog_cb_func cb); + +/* + * SSL_CTX_get_keylog_callback returns the callback configured by + * SSL_CTX_set_keylog_callback. + */ +SSL_CTX_keylog_cb_func SSL_CTX_get_keylog_callback(const SSL_CTX *ctx); + +int SSL_CTX_set_max_early_data(SSL_CTX *ctx, uint32_t max_early_data); +uint32_t SSL_CTX_get_max_early_data(const SSL_CTX *ctx); +int SSL_set_max_early_data(SSL *s, uint32_t max_early_data); +uint32_t SSL_get_max_early_data(const SSL *s); +int SSL_CTX_set_recv_max_early_data(SSL_CTX *ctx, uint32_t recv_max_early_data); +uint32_t SSL_CTX_get_recv_max_early_data(const SSL_CTX *ctx); +int SSL_set_recv_max_early_data(SSL *s, uint32_t recv_max_early_data); +uint32_t SSL_get_recv_max_early_data(const SSL *s); + +#ifdef __cplusplus +} +#endif + +# include +# include +# include /* This is mostly sslv3 with a few tweaks */ +# include /* Datagram TLS */ +# include /* Support for the use_srtp extension */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * These need to be after the above set of includes due to a compiler bug + * in VisualStudio 2015 + */ +DEFINE_STACK_OF_CONST(SSL_CIPHER) +DEFINE_STACK_OF(SSL_COMP) + +/* compatibility */ +# define SSL_set_app_data(s,arg) (SSL_set_ex_data(s,0,(char *)(arg))) +# define SSL_get_app_data(s) (SSL_get_ex_data(s,0)) +# define SSL_SESSION_set_app_data(s,a) (SSL_SESSION_set_ex_data(s,0, \ + (char *)(a))) +# define SSL_SESSION_get_app_data(s) (SSL_SESSION_get_ex_data(s,0)) +# define SSL_CTX_get_app_data(ctx) (SSL_CTX_get_ex_data(ctx,0)) +# define SSL_CTX_set_app_data(ctx,arg) (SSL_CTX_set_ex_data(ctx,0, \ + (char *)(arg))) +DEPRECATEDIN_1_1_0(void SSL_set_debug(SSL *s, int debug)) + +/* TLSv1.3 KeyUpdate message types */ +/* -1 used so that this is an invalid value for the on-the-wire protocol */ +#define SSL_KEY_UPDATE_NONE -1 +/* Values as defined for the on-the-wire protocol */ +#define SSL_KEY_UPDATE_NOT_REQUESTED 0 +#define SSL_KEY_UPDATE_REQUESTED 1 + +/* + * The valid handshake states (one for each type message sent and one for each + * type of message received). There are also two "special" states: + * TLS = TLS or DTLS state + * DTLS = DTLS specific state + * CR/SR = Client Read/Server Read + * CW/SW = Client Write/Server Write + * + * The "special" states are: + * TLS_ST_BEFORE = No handshake has been initiated yet + * TLS_ST_OK = A handshake has been successfully completed + */ +typedef enum { + TLS_ST_BEFORE, + TLS_ST_OK, + DTLS_ST_CR_HELLO_VERIFY_REQUEST, + TLS_ST_CR_SRVR_HELLO, + TLS_ST_CR_CERT, + TLS_ST_CR_CERT_STATUS, + TLS_ST_CR_KEY_EXCH, + TLS_ST_CR_CERT_REQ, + TLS_ST_CR_SRVR_DONE, + TLS_ST_CR_SESSION_TICKET, + TLS_ST_CR_CHANGE, + TLS_ST_CR_FINISHED, + TLS_ST_CW_CLNT_HELLO, + TLS_ST_CW_CERT, + TLS_ST_CW_KEY_EXCH, + TLS_ST_CW_CERT_VRFY, + TLS_ST_CW_CHANGE, + TLS_ST_CW_NEXT_PROTO, + TLS_ST_CW_FINISHED, + TLS_ST_SW_HELLO_REQ, + TLS_ST_SR_CLNT_HELLO, + DTLS_ST_SW_HELLO_VERIFY_REQUEST, + TLS_ST_SW_SRVR_HELLO, + TLS_ST_SW_CERT, + TLS_ST_SW_KEY_EXCH, + TLS_ST_SW_CERT_REQ, + TLS_ST_SW_SRVR_DONE, + TLS_ST_SR_CERT, + TLS_ST_SR_KEY_EXCH, + TLS_ST_SR_CERT_VRFY, + TLS_ST_SR_NEXT_PROTO, + TLS_ST_SR_CHANGE, + TLS_ST_SR_FINISHED, + TLS_ST_SW_SESSION_TICKET, + TLS_ST_SW_CERT_STATUS, + TLS_ST_SW_CHANGE, + TLS_ST_SW_FINISHED, + TLS_ST_SW_ENCRYPTED_EXTENSIONS, + TLS_ST_CR_ENCRYPTED_EXTENSIONS, + TLS_ST_CR_CERT_VRFY, + TLS_ST_SW_CERT_VRFY, + TLS_ST_CR_HELLO_REQ, + TLS_ST_SW_KEY_UPDATE, + TLS_ST_CW_KEY_UPDATE, + TLS_ST_SR_KEY_UPDATE, + TLS_ST_CR_KEY_UPDATE, + TLS_ST_EARLY_DATA, + TLS_ST_PENDING_EARLY_DATA_END, + TLS_ST_CW_END_OF_EARLY_DATA, + TLS_ST_SR_END_OF_EARLY_DATA +} OSSL_HANDSHAKE_STATE; + +/* + * Most of the following state values are no longer used and are defined to be + * the closest equivalent value in the current state machine code. Not all + * defines have an equivalent and are set to a dummy value (-1). SSL_ST_CONNECT + * and SSL_ST_ACCEPT are still in use in the definition of SSL_CB_ACCEPT_LOOP, + * SSL_CB_ACCEPT_EXIT, SSL_CB_CONNECT_LOOP and SSL_CB_CONNECT_EXIT. + */ + +# define SSL_ST_CONNECT 0x1000 +# define SSL_ST_ACCEPT 0x2000 + +# define SSL_ST_MASK 0x0FFF + +# define SSL_CB_LOOP 0x01 +# define SSL_CB_EXIT 0x02 +# define SSL_CB_READ 0x04 +# define SSL_CB_WRITE 0x08 +# define SSL_CB_ALERT 0x4000/* used in callback */ +# define SSL_CB_READ_ALERT (SSL_CB_ALERT|SSL_CB_READ) +# define SSL_CB_WRITE_ALERT (SSL_CB_ALERT|SSL_CB_WRITE) +# define SSL_CB_ACCEPT_LOOP (SSL_ST_ACCEPT|SSL_CB_LOOP) +# define SSL_CB_ACCEPT_EXIT (SSL_ST_ACCEPT|SSL_CB_EXIT) +# define SSL_CB_CONNECT_LOOP (SSL_ST_CONNECT|SSL_CB_LOOP) +# define SSL_CB_CONNECT_EXIT (SSL_ST_CONNECT|SSL_CB_EXIT) +# define SSL_CB_HANDSHAKE_START 0x10 +# define SSL_CB_HANDSHAKE_DONE 0x20 + +/* Is the SSL_connection established? */ +# define SSL_in_connect_init(a) (SSL_in_init(a) && !SSL_is_server(a)) +# define SSL_in_accept_init(a) (SSL_in_init(a) && SSL_is_server(a)) +int SSL_in_init(const SSL *s); +int SSL_in_before(const SSL *s); +int SSL_is_init_finished(const SSL *s); + +/* + * The following 3 states are kept in ssl->rlayer.rstate when reads fail, you + * should not need these + */ +# define SSL_ST_READ_HEADER 0xF0 +# define SSL_ST_READ_BODY 0xF1 +# define SSL_ST_READ_DONE 0xF2 + +/*- + * Obtain latest Finished message + * -- that we sent (SSL_get_finished) + * -- that we expected from peer (SSL_get_peer_finished). + * Returns length (0 == no Finished so far), copies up to 'count' bytes. + */ +size_t SSL_get_finished(const SSL *s, void *buf, size_t count); +size_t SSL_get_peer_finished(const SSL *s, void *buf, size_t count); + +/* + * use either SSL_VERIFY_NONE or SSL_VERIFY_PEER, the last 3 options are + * 'ored' with SSL_VERIFY_PEER if they are desired + */ +# define SSL_VERIFY_NONE 0x00 +# define SSL_VERIFY_PEER 0x01 +# define SSL_VERIFY_FAIL_IF_NO_PEER_CERT 0x02 +# define SSL_VERIFY_CLIENT_ONCE 0x04 +# define SSL_VERIFY_POST_HANDSHAKE 0x08 + +# if OPENSSL_API_COMPAT < 0x10100000L +# define OpenSSL_add_ssl_algorithms() SSL_library_init() +# define SSLeay_add_ssl_algorithms() SSL_library_init() +# endif + +/* More backward compatibility */ +# define SSL_get_cipher(s) \ + SSL_CIPHER_get_name(SSL_get_current_cipher(s)) +# define SSL_get_cipher_bits(s,np) \ + SSL_CIPHER_get_bits(SSL_get_current_cipher(s),np) +# define SSL_get_cipher_version(s) \ + SSL_CIPHER_get_version(SSL_get_current_cipher(s)) +# define SSL_get_cipher_name(s) \ + SSL_CIPHER_get_name(SSL_get_current_cipher(s)) +# define SSL_get_time(a) SSL_SESSION_get_time(a) +# define SSL_set_time(a,b) SSL_SESSION_set_time((a),(b)) +# define SSL_get_timeout(a) SSL_SESSION_get_timeout(a) +# define SSL_set_timeout(a,b) SSL_SESSION_set_timeout((a),(b)) + +# define d2i_SSL_SESSION_bio(bp,s_id) ASN1_d2i_bio_of(SSL_SESSION,SSL_SESSION_new,d2i_SSL_SESSION,bp,s_id) +# define i2d_SSL_SESSION_bio(bp,s_id) ASN1_i2d_bio_of(SSL_SESSION,i2d_SSL_SESSION,bp,s_id) + +DECLARE_PEM_rw(SSL_SESSION, SSL_SESSION) +# define SSL_AD_REASON_OFFSET 1000/* offset to get SSL_R_... value + * from SSL_AD_... */ +/* These alert types are for SSLv3 and TLSv1 */ +# define SSL_AD_CLOSE_NOTIFY SSL3_AD_CLOSE_NOTIFY +/* fatal */ +# define SSL_AD_UNEXPECTED_MESSAGE SSL3_AD_UNEXPECTED_MESSAGE +/* fatal */ +# define SSL_AD_BAD_RECORD_MAC SSL3_AD_BAD_RECORD_MAC +# define SSL_AD_DECRYPTION_FAILED TLS1_AD_DECRYPTION_FAILED +# define SSL_AD_RECORD_OVERFLOW TLS1_AD_RECORD_OVERFLOW +/* fatal */ +# define SSL_AD_DECOMPRESSION_FAILURE SSL3_AD_DECOMPRESSION_FAILURE +/* fatal */ +# define SSL_AD_HANDSHAKE_FAILURE SSL3_AD_HANDSHAKE_FAILURE +/* Not for TLS */ +# define SSL_AD_NO_CERTIFICATE SSL3_AD_NO_CERTIFICATE +# define SSL_AD_BAD_CERTIFICATE SSL3_AD_BAD_CERTIFICATE +# define SSL_AD_UNSUPPORTED_CERTIFICATE SSL3_AD_UNSUPPORTED_CERTIFICATE +# define SSL_AD_CERTIFICATE_REVOKED SSL3_AD_CERTIFICATE_REVOKED +# define SSL_AD_CERTIFICATE_EXPIRED SSL3_AD_CERTIFICATE_EXPIRED +# define SSL_AD_CERTIFICATE_UNKNOWN SSL3_AD_CERTIFICATE_UNKNOWN +/* fatal */ +# define SSL_AD_ILLEGAL_PARAMETER SSL3_AD_ILLEGAL_PARAMETER +/* fatal */ +# define SSL_AD_UNKNOWN_CA TLS1_AD_UNKNOWN_CA +/* fatal */ +# define SSL_AD_ACCESS_DENIED TLS1_AD_ACCESS_DENIED +/* fatal */ +# define SSL_AD_DECODE_ERROR TLS1_AD_DECODE_ERROR +# define SSL_AD_DECRYPT_ERROR TLS1_AD_DECRYPT_ERROR +/* fatal */ +# define SSL_AD_EXPORT_RESTRICTION TLS1_AD_EXPORT_RESTRICTION +/* fatal */ +# define SSL_AD_PROTOCOL_VERSION TLS1_AD_PROTOCOL_VERSION +/* fatal */ +# define SSL_AD_INSUFFICIENT_SECURITY TLS1_AD_INSUFFICIENT_SECURITY +/* fatal */ +# define SSL_AD_INTERNAL_ERROR TLS1_AD_INTERNAL_ERROR +# define SSL_AD_USER_CANCELLED TLS1_AD_USER_CANCELLED +# define SSL_AD_NO_RENEGOTIATION TLS1_AD_NO_RENEGOTIATION +# define SSL_AD_MISSING_EXTENSION TLS13_AD_MISSING_EXTENSION +# define SSL_AD_CERTIFICATE_REQUIRED TLS13_AD_CERTIFICATE_REQUIRED +# define SSL_AD_UNSUPPORTED_EXTENSION TLS1_AD_UNSUPPORTED_EXTENSION +# define SSL_AD_CERTIFICATE_UNOBTAINABLE TLS1_AD_CERTIFICATE_UNOBTAINABLE +# define SSL_AD_UNRECOGNIZED_NAME TLS1_AD_UNRECOGNIZED_NAME +# define SSL_AD_BAD_CERTIFICATE_STATUS_RESPONSE TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE +# define SSL_AD_BAD_CERTIFICATE_HASH_VALUE TLS1_AD_BAD_CERTIFICATE_HASH_VALUE +/* fatal */ +# define SSL_AD_UNKNOWN_PSK_IDENTITY TLS1_AD_UNKNOWN_PSK_IDENTITY +/* fatal */ +# define SSL_AD_INAPPROPRIATE_FALLBACK TLS1_AD_INAPPROPRIATE_FALLBACK +# define SSL_AD_NO_APPLICATION_PROTOCOL TLS1_AD_NO_APPLICATION_PROTOCOL +# define SSL_ERROR_NONE 0 +# define SSL_ERROR_SSL 1 +# define SSL_ERROR_WANT_READ 2 +# define SSL_ERROR_WANT_WRITE 3 +# define SSL_ERROR_WANT_X509_LOOKUP 4 +# define SSL_ERROR_SYSCALL 5/* look at error stack/return + * value/errno */ +# define SSL_ERROR_ZERO_RETURN 6 +# define SSL_ERROR_WANT_CONNECT 7 +# define SSL_ERROR_WANT_ACCEPT 8 +# define SSL_ERROR_WANT_ASYNC 9 +# define SSL_ERROR_WANT_ASYNC_JOB 10 +# define SSL_ERROR_WANT_CLIENT_HELLO_CB 11 +# define SSL_CTRL_SET_TMP_DH 3 +# define SSL_CTRL_SET_TMP_ECDH 4 +# define SSL_CTRL_SET_TMP_DH_CB 6 +# define SSL_CTRL_GET_CLIENT_CERT_REQUEST 9 +# define SSL_CTRL_GET_NUM_RENEGOTIATIONS 10 +# define SSL_CTRL_CLEAR_NUM_RENEGOTIATIONS 11 +# define SSL_CTRL_GET_TOTAL_RENEGOTIATIONS 12 +# define SSL_CTRL_GET_FLAGS 13 +# define SSL_CTRL_EXTRA_CHAIN_CERT 14 +# define SSL_CTRL_SET_MSG_CALLBACK 15 +# define SSL_CTRL_SET_MSG_CALLBACK_ARG 16 +/* only applies to datagram connections */ +# define SSL_CTRL_SET_MTU 17 +/* Stats */ +# define SSL_CTRL_SESS_NUMBER 20 +# define SSL_CTRL_SESS_CONNECT 21 +# define SSL_CTRL_SESS_CONNECT_GOOD 22 +# define SSL_CTRL_SESS_CONNECT_RENEGOTIATE 23 +# define SSL_CTRL_SESS_ACCEPT 24 +# define SSL_CTRL_SESS_ACCEPT_GOOD 25 +# define SSL_CTRL_SESS_ACCEPT_RENEGOTIATE 26 +# define SSL_CTRL_SESS_HIT 27 +# define SSL_CTRL_SESS_CB_HIT 28 +# define SSL_CTRL_SESS_MISSES 29 +# define SSL_CTRL_SESS_TIMEOUTS 30 +# define SSL_CTRL_SESS_CACHE_FULL 31 +# define SSL_CTRL_MODE 33 +# define SSL_CTRL_GET_READ_AHEAD 40 +# define SSL_CTRL_SET_READ_AHEAD 41 +# define SSL_CTRL_SET_SESS_CACHE_SIZE 42 +# define SSL_CTRL_GET_SESS_CACHE_SIZE 43 +# define SSL_CTRL_SET_SESS_CACHE_MODE 44 +# define SSL_CTRL_GET_SESS_CACHE_MODE 45 +# define SSL_CTRL_GET_MAX_CERT_LIST 50 +# define SSL_CTRL_SET_MAX_CERT_LIST 51 +# define SSL_CTRL_SET_MAX_SEND_FRAGMENT 52 +/* see tls1.h for macros based on these */ +# define SSL_CTRL_SET_TLSEXT_SERVERNAME_CB 53 +# define SSL_CTRL_SET_TLSEXT_SERVERNAME_ARG 54 +# define SSL_CTRL_SET_TLSEXT_HOSTNAME 55 +# define SSL_CTRL_SET_TLSEXT_DEBUG_CB 56 +# define SSL_CTRL_SET_TLSEXT_DEBUG_ARG 57 +# define SSL_CTRL_GET_TLSEXT_TICKET_KEYS 58 +# define SSL_CTRL_SET_TLSEXT_TICKET_KEYS 59 +/*# define SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT 60 */ +/*# define SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT_CB 61 */ +/*# define SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT_CB_ARG 62 */ +# define SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB 63 +# define SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB_ARG 64 +# define SSL_CTRL_SET_TLSEXT_STATUS_REQ_TYPE 65 +# define SSL_CTRL_GET_TLSEXT_STATUS_REQ_EXTS 66 +# define SSL_CTRL_SET_TLSEXT_STATUS_REQ_EXTS 67 +# define SSL_CTRL_GET_TLSEXT_STATUS_REQ_IDS 68 +# define SSL_CTRL_SET_TLSEXT_STATUS_REQ_IDS 69 +# define SSL_CTRL_GET_TLSEXT_STATUS_REQ_OCSP_RESP 70 +# define SSL_CTRL_SET_TLSEXT_STATUS_REQ_OCSP_RESP 71 +# define SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB 72 +# define SSL_CTRL_SET_TLS_EXT_SRP_USERNAME_CB 75 +# define SSL_CTRL_SET_SRP_VERIFY_PARAM_CB 76 +# define SSL_CTRL_SET_SRP_GIVE_CLIENT_PWD_CB 77 +# define SSL_CTRL_SET_SRP_ARG 78 +# define SSL_CTRL_SET_TLS_EXT_SRP_USERNAME 79 +# define SSL_CTRL_SET_TLS_EXT_SRP_STRENGTH 80 +# define SSL_CTRL_SET_TLS_EXT_SRP_PASSWORD 81 +# ifndef OPENSSL_NO_HEARTBEATS +# define SSL_CTRL_DTLS_EXT_SEND_HEARTBEAT 85 +# define SSL_CTRL_GET_DTLS_EXT_HEARTBEAT_PENDING 86 +# define SSL_CTRL_SET_DTLS_EXT_HEARTBEAT_NO_REQUESTS 87 +# endif +# define DTLS_CTRL_GET_TIMEOUT 73 +# define DTLS_CTRL_HANDLE_TIMEOUT 74 +# define SSL_CTRL_GET_RI_SUPPORT 76 +# define SSL_CTRL_CLEAR_MODE 78 +# define SSL_CTRL_SET_NOT_RESUMABLE_SESS_CB 79 +# define SSL_CTRL_GET_EXTRA_CHAIN_CERTS 82 +# define SSL_CTRL_CLEAR_EXTRA_CHAIN_CERTS 83 +# define SSL_CTRL_CHAIN 88 +# define SSL_CTRL_CHAIN_CERT 89 +# define SSL_CTRL_GET_GROUPS 90 +# define SSL_CTRL_SET_GROUPS 91 +# define SSL_CTRL_SET_GROUPS_LIST 92 +# define SSL_CTRL_GET_SHARED_GROUP 93 +# define SSL_CTRL_SET_SIGALGS 97 +# define SSL_CTRL_SET_SIGALGS_LIST 98 +# define SSL_CTRL_CERT_FLAGS 99 +# define SSL_CTRL_CLEAR_CERT_FLAGS 100 +# define SSL_CTRL_SET_CLIENT_SIGALGS 101 +# define SSL_CTRL_SET_CLIENT_SIGALGS_LIST 102 +# define SSL_CTRL_GET_CLIENT_CERT_TYPES 103 +# define SSL_CTRL_SET_CLIENT_CERT_TYPES 104 +# define SSL_CTRL_BUILD_CERT_CHAIN 105 +# define SSL_CTRL_SET_VERIFY_CERT_STORE 106 +# define SSL_CTRL_SET_CHAIN_CERT_STORE 107 +# define SSL_CTRL_GET_PEER_SIGNATURE_NID 108 +# define SSL_CTRL_GET_PEER_TMP_KEY 109 +# define SSL_CTRL_GET_RAW_CIPHERLIST 110 +# define SSL_CTRL_GET_EC_POINT_FORMATS 111 +# define SSL_CTRL_GET_CHAIN_CERTS 115 +# define SSL_CTRL_SELECT_CURRENT_CERT 116 +# define SSL_CTRL_SET_CURRENT_CERT 117 +# define SSL_CTRL_SET_DH_AUTO 118 +# define DTLS_CTRL_SET_LINK_MTU 120 +# define DTLS_CTRL_GET_LINK_MIN_MTU 121 +# define SSL_CTRL_GET_EXTMS_SUPPORT 122 +# define SSL_CTRL_SET_MIN_PROTO_VERSION 123 +# define SSL_CTRL_SET_MAX_PROTO_VERSION 124 +# define SSL_CTRL_SET_SPLIT_SEND_FRAGMENT 125 +# define SSL_CTRL_SET_MAX_PIPELINES 126 +# define SSL_CTRL_GET_TLSEXT_STATUS_REQ_TYPE 127 +# define SSL_CTRL_GET_TLSEXT_STATUS_REQ_CB 128 +# define SSL_CTRL_GET_TLSEXT_STATUS_REQ_CB_ARG 129 +# define SSL_CTRL_GET_MIN_PROTO_VERSION 130 +# define SSL_CTRL_GET_MAX_PROTO_VERSION 131 +# define SSL_CTRL_GET_SIGNATURE_NID 132 +# define SSL_CTRL_GET_TMP_KEY 133 +# define SSL_CERT_SET_FIRST 1 +# define SSL_CERT_SET_NEXT 2 +# define SSL_CERT_SET_SERVER 3 +# define DTLSv1_get_timeout(ssl, arg) \ + SSL_ctrl(ssl,DTLS_CTRL_GET_TIMEOUT,0, (void *)(arg)) +# define DTLSv1_handle_timeout(ssl) \ + SSL_ctrl(ssl,DTLS_CTRL_HANDLE_TIMEOUT,0, NULL) +# define SSL_num_renegotiations(ssl) \ + SSL_ctrl((ssl),SSL_CTRL_GET_NUM_RENEGOTIATIONS,0,NULL) +# define SSL_clear_num_renegotiations(ssl) \ + SSL_ctrl((ssl),SSL_CTRL_CLEAR_NUM_RENEGOTIATIONS,0,NULL) +# define SSL_total_renegotiations(ssl) \ + SSL_ctrl((ssl),SSL_CTRL_GET_TOTAL_RENEGOTIATIONS,0,NULL) +# define SSL_CTX_set_tmp_dh(ctx,dh) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_DH,0,(char *)(dh)) +# define SSL_CTX_set_tmp_ecdh(ctx,ecdh) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_ECDH,0,(char *)(ecdh)) +# define SSL_CTX_set_dh_auto(ctx, onoff) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_DH_AUTO,onoff,NULL) +# define SSL_set_dh_auto(s, onoff) \ + SSL_ctrl(s,SSL_CTRL_SET_DH_AUTO,onoff,NULL) +# define SSL_set_tmp_dh(ssl,dh) \ + SSL_ctrl(ssl,SSL_CTRL_SET_TMP_DH,0,(char *)(dh)) +# define SSL_set_tmp_ecdh(ssl,ecdh) \ + SSL_ctrl(ssl,SSL_CTRL_SET_TMP_ECDH,0,(char *)(ecdh)) +# define SSL_CTX_add_extra_chain_cert(ctx,x509) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_EXTRA_CHAIN_CERT,0,(char *)(x509)) +# define SSL_CTX_get_extra_chain_certs(ctx,px509) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_GET_EXTRA_CHAIN_CERTS,0,px509) +# define SSL_CTX_get_extra_chain_certs_only(ctx,px509) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_GET_EXTRA_CHAIN_CERTS,1,px509) +# define SSL_CTX_clear_extra_chain_certs(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_CLEAR_EXTRA_CHAIN_CERTS,0,NULL) +# define SSL_CTX_set0_chain(ctx,sk) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_CHAIN,0,(char *)(sk)) +# define SSL_CTX_set1_chain(ctx,sk) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_CHAIN,1,(char *)(sk)) +# define SSL_CTX_add0_chain_cert(ctx,x509) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_CHAIN_CERT,0,(char *)(x509)) +# define SSL_CTX_add1_chain_cert(ctx,x509) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_CHAIN_CERT,1,(char *)(x509)) +# define SSL_CTX_get0_chain_certs(ctx,px509) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_GET_CHAIN_CERTS,0,px509) +# define SSL_CTX_clear_chain_certs(ctx) \ + SSL_CTX_set0_chain(ctx,NULL) +# define SSL_CTX_build_cert_chain(ctx, flags) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_BUILD_CERT_CHAIN, flags, NULL) +# define SSL_CTX_select_current_cert(ctx,x509) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SELECT_CURRENT_CERT,0,(char *)(x509)) +# define SSL_CTX_set_current_cert(ctx, op) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CURRENT_CERT, op, NULL) +# define SSL_CTX_set0_verify_cert_store(ctx,st) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_VERIFY_CERT_STORE,0,(char *)(st)) +# define SSL_CTX_set1_verify_cert_store(ctx,st) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_VERIFY_CERT_STORE,1,(char *)(st)) +# define SSL_CTX_set0_chain_cert_store(ctx,st) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CHAIN_CERT_STORE,0,(char *)(st)) +# define SSL_CTX_set1_chain_cert_store(ctx,st) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CHAIN_CERT_STORE,1,(char *)(st)) +# define SSL_set0_chain(s,sk) \ + SSL_ctrl(s,SSL_CTRL_CHAIN,0,(char *)(sk)) +# define SSL_set1_chain(s,sk) \ + SSL_ctrl(s,SSL_CTRL_CHAIN,1,(char *)(sk)) +# define SSL_add0_chain_cert(s,x509) \ + SSL_ctrl(s,SSL_CTRL_CHAIN_CERT,0,(char *)(x509)) +# define SSL_add1_chain_cert(s,x509) \ + SSL_ctrl(s,SSL_CTRL_CHAIN_CERT,1,(char *)(x509)) +# define SSL_get0_chain_certs(s,px509) \ + SSL_ctrl(s,SSL_CTRL_GET_CHAIN_CERTS,0,px509) +# define SSL_clear_chain_certs(s) \ + SSL_set0_chain(s,NULL) +# define SSL_build_cert_chain(s, flags) \ + SSL_ctrl(s,SSL_CTRL_BUILD_CERT_CHAIN, flags, NULL) +# define SSL_select_current_cert(s,x509) \ + SSL_ctrl(s,SSL_CTRL_SELECT_CURRENT_CERT,0,(char *)(x509)) +# define SSL_set_current_cert(s,op) \ + SSL_ctrl(s,SSL_CTRL_SET_CURRENT_CERT, op, NULL) +# define SSL_set0_verify_cert_store(s,st) \ + SSL_ctrl(s,SSL_CTRL_SET_VERIFY_CERT_STORE,0,(char *)(st)) +# define SSL_set1_verify_cert_store(s,st) \ + SSL_ctrl(s,SSL_CTRL_SET_VERIFY_CERT_STORE,1,(char *)(st)) +# define SSL_set0_chain_cert_store(s,st) \ + SSL_ctrl(s,SSL_CTRL_SET_CHAIN_CERT_STORE,0,(char *)(st)) +# define SSL_set1_chain_cert_store(s,st) \ + SSL_ctrl(s,SSL_CTRL_SET_CHAIN_CERT_STORE,1,(char *)(st)) +# define SSL_get1_groups(s, glist) \ + SSL_ctrl(s,SSL_CTRL_GET_GROUPS,0,(int*)(glist)) +# define SSL_CTX_set1_groups(ctx, glist, glistlen) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_GROUPS,glistlen,(char *)(glist)) +# define SSL_CTX_set1_groups_list(ctx, s) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_GROUPS_LIST,0,(char *)(s)) +# define SSL_set1_groups(s, glist, glistlen) \ + SSL_ctrl(s,SSL_CTRL_SET_GROUPS,glistlen,(char *)(glist)) +# define SSL_set1_groups_list(s, str) \ + SSL_ctrl(s,SSL_CTRL_SET_GROUPS_LIST,0,(char *)(str)) +# define SSL_get_shared_group(s, n) \ + SSL_ctrl(s,SSL_CTRL_GET_SHARED_GROUP,n,NULL) +# define SSL_CTX_set1_sigalgs(ctx, slist, slistlen) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SIGALGS,slistlen,(int *)(slist)) +# define SSL_CTX_set1_sigalgs_list(ctx, s) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SIGALGS_LIST,0,(char *)(s)) +# define SSL_set1_sigalgs(s, slist, slistlen) \ + SSL_ctrl(s,SSL_CTRL_SET_SIGALGS,slistlen,(int *)(slist)) +# define SSL_set1_sigalgs_list(s, str) \ + SSL_ctrl(s,SSL_CTRL_SET_SIGALGS_LIST,0,(char *)(str)) +# define SSL_CTX_set1_client_sigalgs(ctx, slist, slistlen) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CLIENT_SIGALGS,slistlen,(int *)(slist)) +# define SSL_CTX_set1_client_sigalgs_list(ctx, s) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CLIENT_SIGALGS_LIST,0,(char *)(s)) +# define SSL_set1_client_sigalgs(s, slist, slistlen) \ + SSL_ctrl(s,SSL_CTRL_SET_CLIENT_SIGALGS,slistlen,(int *)(slist)) +# define SSL_set1_client_sigalgs_list(s, str) \ + SSL_ctrl(s,SSL_CTRL_SET_CLIENT_SIGALGS_LIST,0,(char *)(str)) +# define SSL_get0_certificate_types(s, clist) \ + SSL_ctrl(s, SSL_CTRL_GET_CLIENT_CERT_TYPES, 0, (char *)(clist)) +# define SSL_CTX_set1_client_certificate_types(ctx, clist, clistlen) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CLIENT_CERT_TYPES,clistlen, \ + (char *)(clist)) +# define SSL_set1_client_certificate_types(s, clist, clistlen) \ + SSL_ctrl(s,SSL_CTRL_SET_CLIENT_CERT_TYPES,clistlen,(char *)(clist)) +# define SSL_get_signature_nid(s, pn) \ + SSL_ctrl(s,SSL_CTRL_GET_SIGNATURE_NID,0,pn) +# define SSL_get_peer_signature_nid(s, pn) \ + SSL_ctrl(s,SSL_CTRL_GET_PEER_SIGNATURE_NID,0,pn) +# define SSL_get_peer_tmp_key(s, pk) \ + SSL_ctrl(s,SSL_CTRL_GET_PEER_TMP_KEY,0,pk) +# define SSL_get_tmp_key(s, pk) \ + SSL_ctrl(s,SSL_CTRL_GET_TMP_KEY,0,pk) +# define SSL_get0_raw_cipherlist(s, plst) \ + SSL_ctrl(s,SSL_CTRL_GET_RAW_CIPHERLIST,0,plst) +# define SSL_get0_ec_point_formats(s, plst) \ + SSL_ctrl(s,SSL_CTRL_GET_EC_POINT_FORMATS,0,plst) +# define SSL_CTX_set_min_proto_version(ctx, version) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_MIN_PROTO_VERSION, version, NULL) +# define SSL_CTX_set_max_proto_version(ctx, version) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_MAX_PROTO_VERSION, version, NULL) +# define SSL_CTX_get_min_proto_version(ctx) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_GET_MIN_PROTO_VERSION, 0, NULL) +# define SSL_CTX_get_max_proto_version(ctx) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_GET_MAX_PROTO_VERSION, 0, NULL) +# define SSL_set_min_proto_version(s, version) \ + SSL_ctrl(s, SSL_CTRL_SET_MIN_PROTO_VERSION, version, NULL) +# define SSL_set_max_proto_version(s, version) \ + SSL_ctrl(s, SSL_CTRL_SET_MAX_PROTO_VERSION, version, NULL) +# define SSL_get_min_proto_version(s) \ + SSL_ctrl(s, SSL_CTRL_GET_MIN_PROTO_VERSION, 0, NULL) +# define SSL_get_max_proto_version(s) \ + SSL_ctrl(s, SSL_CTRL_GET_MAX_PROTO_VERSION, 0, NULL) + +/* Backwards compatibility, original 1.1.0 names */ +# define SSL_CTRL_GET_SERVER_TMP_KEY \ + SSL_CTRL_GET_PEER_TMP_KEY +# define SSL_get_server_tmp_key(s, pk) \ + SSL_get_peer_tmp_key(s, pk) + +/* + * The following symbol names are old and obsolete. They are kept + * for compatibility reasons only and should not be used anymore. + */ +# define SSL_CTRL_GET_CURVES SSL_CTRL_GET_GROUPS +# define SSL_CTRL_SET_CURVES SSL_CTRL_SET_GROUPS +# define SSL_CTRL_SET_CURVES_LIST SSL_CTRL_SET_GROUPS_LIST +# define SSL_CTRL_GET_SHARED_CURVE SSL_CTRL_GET_SHARED_GROUP + +# define SSL_get1_curves SSL_get1_groups +# define SSL_CTX_set1_curves SSL_CTX_set1_groups +# define SSL_CTX_set1_curves_list SSL_CTX_set1_groups_list +# define SSL_set1_curves SSL_set1_groups +# define SSL_set1_curves_list SSL_set1_groups_list +# define SSL_get_shared_curve SSL_get_shared_group + + +# if OPENSSL_API_COMPAT < 0x10100000L +/* Provide some compatibility macros for removed functionality. */ +# define SSL_CTX_need_tmp_RSA(ctx) 0 +# define SSL_CTX_set_tmp_rsa(ctx,rsa) 1 +# define SSL_need_tmp_RSA(ssl) 0 +# define SSL_set_tmp_rsa(ssl,rsa) 1 +# define SSL_CTX_set_ecdh_auto(dummy, onoff) ((onoff) != 0) +# define SSL_set_ecdh_auto(dummy, onoff) ((onoff) != 0) +/* + * We "pretend" to call the callback to avoid warnings about unused static + * functions. + */ +# define SSL_CTX_set_tmp_rsa_callback(ctx, cb) while(0) (cb)(NULL, 0, 0) +# define SSL_set_tmp_rsa_callback(ssl, cb) while(0) (cb)(NULL, 0, 0) +# endif +__owur const BIO_METHOD *BIO_f_ssl(void); +__owur BIO *BIO_new_ssl(SSL_CTX *ctx, int client); +__owur BIO *BIO_new_ssl_connect(SSL_CTX *ctx); +__owur BIO *BIO_new_buffer_ssl_connect(SSL_CTX *ctx); +__owur int BIO_ssl_copy_session_id(BIO *to, BIO *from); +void BIO_ssl_shutdown(BIO *ssl_bio); + +__owur int SSL_CTX_set_cipher_list(SSL_CTX *, const char *str); +__owur SSL_CTX *SSL_CTX_new(const SSL_METHOD *meth); +int SSL_CTX_up_ref(SSL_CTX *ctx); +void SSL_CTX_free(SSL_CTX *); +__owur long SSL_CTX_set_timeout(SSL_CTX *ctx, long t); +__owur long SSL_CTX_get_timeout(const SSL_CTX *ctx); +__owur X509_STORE *SSL_CTX_get_cert_store(const SSL_CTX *); +void SSL_CTX_set_cert_store(SSL_CTX *, X509_STORE *); +void SSL_CTX_set1_cert_store(SSL_CTX *, X509_STORE *); +__owur int SSL_want(const SSL *s); +__owur int SSL_clear(SSL *s); + +void SSL_CTX_flush_sessions(SSL_CTX *ctx, long tm); + +__owur const SSL_CIPHER *SSL_get_current_cipher(const SSL *s); +__owur const SSL_CIPHER *SSL_get_pending_cipher(const SSL *s); +__owur int SSL_CIPHER_get_bits(const SSL_CIPHER *c, int *alg_bits); +__owur const char *SSL_CIPHER_get_version(const SSL_CIPHER *c); +__owur const char *SSL_CIPHER_get_name(const SSL_CIPHER *c); +__owur const char *SSL_CIPHER_standard_name(const SSL_CIPHER *c); +__owur const char *OPENSSL_cipher_name(const char *rfc_name); +__owur uint32_t SSL_CIPHER_get_id(const SSL_CIPHER *c); +__owur uint16_t SSL_CIPHER_get_protocol_id(const SSL_CIPHER *c); +__owur int SSL_CIPHER_get_kx_nid(const SSL_CIPHER *c); +__owur int SSL_CIPHER_get_auth_nid(const SSL_CIPHER *c); +__owur const EVP_MD *SSL_CIPHER_get_handshake_digest(const SSL_CIPHER *c); +__owur int SSL_CIPHER_is_aead(const SSL_CIPHER *c); + +__owur int SSL_get_fd(const SSL *s); +__owur int SSL_get_rfd(const SSL *s); +__owur int SSL_get_wfd(const SSL *s); +__owur const char *SSL_get_cipher_list(const SSL *s, int n); +__owur char *SSL_get_shared_ciphers(const SSL *s, char *buf, int size); +__owur int SSL_get_read_ahead(const SSL *s); +__owur int SSL_pending(const SSL *s); +__owur int SSL_has_pending(const SSL *s); +# ifndef OPENSSL_NO_SOCK +__owur int SSL_set_fd(SSL *s, int fd); +__owur int SSL_set_rfd(SSL *s, int fd); +__owur int SSL_set_wfd(SSL *s, int fd); +# endif +void SSL_set0_rbio(SSL *s, BIO *rbio); +void SSL_set0_wbio(SSL *s, BIO *wbio); +void SSL_set_bio(SSL *s, BIO *rbio, BIO *wbio); +__owur BIO *SSL_get_rbio(const SSL *s); +__owur BIO *SSL_get_wbio(const SSL *s); +__owur int SSL_set_cipher_list(SSL *s, const char *str); +__owur int SSL_CTX_set_ciphersuites(SSL_CTX *ctx, const char *str); +__owur int SSL_set_ciphersuites(SSL *s, const char *str); +void SSL_set_read_ahead(SSL *s, int yes); +__owur int SSL_get_verify_mode(const SSL *s); +__owur int SSL_get_verify_depth(const SSL *s); +__owur SSL_verify_cb SSL_get_verify_callback(const SSL *s); +void SSL_set_verify(SSL *s, int mode, SSL_verify_cb callback); +void SSL_set_verify_depth(SSL *s, int depth); +void SSL_set_cert_cb(SSL *s, int (*cb) (SSL *ssl, void *arg), void *arg); +# ifndef OPENSSL_NO_RSA +__owur int SSL_use_RSAPrivateKey(SSL *ssl, RSA *rsa); +__owur int SSL_use_RSAPrivateKey_ASN1(SSL *ssl, const unsigned char *d, + long len); +# endif +__owur int SSL_use_PrivateKey(SSL *ssl, EVP_PKEY *pkey); +__owur int SSL_use_PrivateKey_ASN1(int pk, SSL *ssl, const unsigned char *d, + long len); +__owur int SSL_use_certificate(SSL *ssl, X509 *x); +__owur int SSL_use_certificate_ASN1(SSL *ssl, const unsigned char *d, int len); +__owur int SSL_use_cert_and_key(SSL *ssl, X509 *x509, EVP_PKEY *privatekey, + STACK_OF(X509) *chain, int override); + + +/* serverinfo file format versions */ +# define SSL_SERVERINFOV1 1 +# define SSL_SERVERINFOV2 2 + +/* Set serverinfo data for the current active cert. */ +__owur int SSL_CTX_use_serverinfo(SSL_CTX *ctx, const unsigned char *serverinfo, + size_t serverinfo_length); +__owur int SSL_CTX_use_serverinfo_ex(SSL_CTX *ctx, unsigned int version, + const unsigned char *serverinfo, + size_t serverinfo_length); +__owur int SSL_CTX_use_serverinfo_file(SSL_CTX *ctx, const char *file); + +#ifndef OPENSSL_NO_RSA +__owur int SSL_use_RSAPrivateKey_file(SSL *ssl, const char *file, int type); +#endif + +__owur int SSL_use_PrivateKey_file(SSL *ssl, const char *file, int type); +__owur int SSL_use_certificate_file(SSL *ssl, const char *file, int type); + +#ifndef OPENSSL_NO_RSA +__owur int SSL_CTX_use_RSAPrivateKey_file(SSL_CTX *ctx, const char *file, + int type); +#endif +__owur int SSL_CTX_use_PrivateKey_file(SSL_CTX *ctx, const char *file, + int type); +__owur int SSL_CTX_use_certificate_file(SSL_CTX *ctx, const char *file, + int type); +/* PEM type */ +__owur int SSL_CTX_use_certificate_chain_file(SSL_CTX *ctx, const char *file); +__owur int SSL_use_certificate_chain_file(SSL *ssl, const char *file); +__owur STACK_OF(X509_NAME) *SSL_load_client_CA_file(const char *file); +__owur int SSL_add_file_cert_subjects_to_stack(STACK_OF(X509_NAME) *stackCAs, + const char *file); +int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stackCAs, + const char *dir); + +# if OPENSSL_API_COMPAT < 0x10100000L +# define SSL_load_error_strings() \ + OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS \ + | OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL) +# endif + +__owur const char *SSL_state_string(const SSL *s); +__owur const char *SSL_rstate_string(const SSL *s); +__owur const char *SSL_state_string_long(const SSL *s); +__owur const char *SSL_rstate_string_long(const SSL *s); +__owur long SSL_SESSION_get_time(const SSL_SESSION *s); +__owur long SSL_SESSION_set_time(SSL_SESSION *s, long t); +__owur long SSL_SESSION_get_timeout(const SSL_SESSION *s); +__owur long SSL_SESSION_set_timeout(SSL_SESSION *s, long t); +__owur int SSL_SESSION_get_protocol_version(const SSL_SESSION *s); +__owur int SSL_SESSION_set_protocol_version(SSL_SESSION *s, int version); + +__owur const char *SSL_SESSION_get0_hostname(const SSL_SESSION *s); +__owur int SSL_SESSION_set1_hostname(SSL_SESSION *s, const char *hostname); +void SSL_SESSION_get0_alpn_selected(const SSL_SESSION *s, + const unsigned char **alpn, + size_t *len); +__owur int SSL_SESSION_set1_alpn_selected(SSL_SESSION *s, + const unsigned char *alpn, + size_t len); +__owur const SSL_CIPHER *SSL_SESSION_get0_cipher(const SSL_SESSION *s); +__owur int SSL_SESSION_set_cipher(SSL_SESSION *s, const SSL_CIPHER *cipher); +__owur int SSL_SESSION_has_ticket(const SSL_SESSION *s); +__owur unsigned long SSL_SESSION_get_ticket_lifetime_hint(const SSL_SESSION *s); +void SSL_SESSION_get0_ticket(const SSL_SESSION *s, const unsigned char **tick, + size_t *len); +__owur uint32_t SSL_SESSION_get_max_early_data(const SSL_SESSION *s); +__owur int SSL_SESSION_set_max_early_data(SSL_SESSION *s, + uint32_t max_early_data); +__owur int SSL_copy_session_id(SSL *to, const SSL *from); +__owur X509 *SSL_SESSION_get0_peer(SSL_SESSION *s); +__owur int SSL_SESSION_set1_id_context(SSL_SESSION *s, + const unsigned char *sid_ctx, + unsigned int sid_ctx_len); +__owur int SSL_SESSION_set1_id(SSL_SESSION *s, const unsigned char *sid, + unsigned int sid_len); +__owur int SSL_SESSION_is_resumable(const SSL_SESSION *s); + +__owur SSL_SESSION *SSL_SESSION_new(void); +__owur SSL_SESSION *SSL_SESSION_dup(SSL_SESSION *src); +const unsigned char *SSL_SESSION_get_id(const SSL_SESSION *s, + unsigned int *len); +const unsigned char *SSL_SESSION_get0_id_context(const SSL_SESSION *s, + unsigned int *len); +__owur unsigned int SSL_SESSION_get_compress_id(const SSL_SESSION *s); +# ifndef OPENSSL_NO_STDIO +int SSL_SESSION_print_fp(FILE *fp, const SSL_SESSION *ses); +# endif +int SSL_SESSION_print(BIO *fp, const SSL_SESSION *ses); +int SSL_SESSION_print_keylog(BIO *bp, const SSL_SESSION *x); +int SSL_SESSION_up_ref(SSL_SESSION *ses); +void SSL_SESSION_free(SSL_SESSION *ses); +__owur int i2d_SSL_SESSION(SSL_SESSION *in, unsigned char **pp); +__owur int SSL_set_session(SSL *to, SSL_SESSION *session); +int SSL_CTX_add_session(SSL_CTX *ctx, SSL_SESSION *session); +int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *session); +__owur int SSL_CTX_set_generate_session_id(SSL_CTX *ctx, GEN_SESSION_CB cb); +__owur int SSL_set_generate_session_id(SSL *s, GEN_SESSION_CB cb); +__owur int SSL_has_matching_session_id(const SSL *s, + const unsigned char *id, + unsigned int id_len); +SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp, + long length); + +# ifdef HEADER_X509_H +__owur X509 *SSL_get_peer_certificate(const SSL *s); +# endif + +__owur STACK_OF(X509) *SSL_get_peer_cert_chain(const SSL *s); + +__owur int SSL_CTX_get_verify_mode(const SSL_CTX *ctx); +__owur int SSL_CTX_get_verify_depth(const SSL_CTX *ctx); +__owur SSL_verify_cb SSL_CTX_get_verify_callback(const SSL_CTX *ctx); +void SSL_CTX_set_verify(SSL_CTX *ctx, int mode, SSL_verify_cb callback); +void SSL_CTX_set_verify_depth(SSL_CTX *ctx, int depth); +void SSL_CTX_set_cert_verify_callback(SSL_CTX *ctx, + int (*cb) (X509_STORE_CTX *, void *), + void *arg); +void SSL_CTX_set_cert_cb(SSL_CTX *c, int (*cb) (SSL *ssl, void *arg), + void *arg); +# ifndef OPENSSL_NO_RSA +__owur int SSL_CTX_use_RSAPrivateKey(SSL_CTX *ctx, RSA *rsa); +__owur int SSL_CTX_use_RSAPrivateKey_ASN1(SSL_CTX *ctx, const unsigned char *d, + long len); +# endif +__owur int SSL_CTX_use_PrivateKey(SSL_CTX *ctx, EVP_PKEY *pkey); +__owur int SSL_CTX_use_PrivateKey_ASN1(int pk, SSL_CTX *ctx, + const unsigned char *d, long len); +__owur int SSL_CTX_use_certificate(SSL_CTX *ctx, X509 *x); +__owur int SSL_CTX_use_certificate_ASN1(SSL_CTX *ctx, int len, + const unsigned char *d); +__owur int SSL_CTX_use_cert_and_key(SSL_CTX *ctx, X509 *x509, EVP_PKEY *privatekey, + STACK_OF(X509) *chain, int override); + +void SSL_CTX_set_default_passwd_cb(SSL_CTX *ctx, pem_password_cb *cb); +void SSL_CTX_set_default_passwd_cb_userdata(SSL_CTX *ctx, void *u); +pem_password_cb *SSL_CTX_get_default_passwd_cb(SSL_CTX *ctx); +void *SSL_CTX_get_default_passwd_cb_userdata(SSL_CTX *ctx); +void SSL_set_default_passwd_cb(SSL *s, pem_password_cb *cb); +void SSL_set_default_passwd_cb_userdata(SSL *s, void *u); +pem_password_cb *SSL_get_default_passwd_cb(SSL *s); +void *SSL_get_default_passwd_cb_userdata(SSL *s); + +__owur int SSL_CTX_check_private_key(const SSL_CTX *ctx); +__owur int SSL_check_private_key(const SSL *ctx); + +__owur int SSL_CTX_set_session_id_context(SSL_CTX *ctx, + const unsigned char *sid_ctx, + unsigned int sid_ctx_len); + +SSL *SSL_new(SSL_CTX *ctx); +int SSL_up_ref(SSL *s); +int SSL_is_dtls(const SSL *s); +__owur int SSL_set_session_id_context(SSL *ssl, const unsigned char *sid_ctx, + unsigned int sid_ctx_len); + +__owur int SSL_CTX_set_purpose(SSL_CTX *ctx, int purpose); +__owur int SSL_set_purpose(SSL *ssl, int purpose); +__owur int SSL_CTX_set_trust(SSL_CTX *ctx, int trust); +__owur int SSL_set_trust(SSL *ssl, int trust); + +__owur int SSL_set1_host(SSL *s, const char *hostname); +__owur int SSL_add1_host(SSL *s, const char *hostname); +__owur const char *SSL_get0_peername(SSL *s); +void SSL_set_hostflags(SSL *s, unsigned int flags); + +__owur int SSL_CTX_dane_enable(SSL_CTX *ctx); +__owur int SSL_CTX_dane_mtype_set(SSL_CTX *ctx, const EVP_MD *md, + uint8_t mtype, uint8_t ord); +__owur int SSL_dane_enable(SSL *s, const char *basedomain); +__owur int SSL_dane_tlsa_add(SSL *s, uint8_t usage, uint8_t selector, + uint8_t mtype, unsigned const char *data, size_t dlen); +__owur int SSL_get0_dane_authority(SSL *s, X509 **mcert, EVP_PKEY **mspki); +__owur int SSL_get0_dane_tlsa(SSL *s, uint8_t *usage, uint8_t *selector, + uint8_t *mtype, unsigned const char **data, + size_t *dlen); +/* + * Bridge opacity barrier between libcrypt and libssl, also needed to support + * offline testing in test/danetest.c + */ +SSL_DANE *SSL_get0_dane(SSL *ssl); +/* + * DANE flags + */ +unsigned long SSL_CTX_dane_set_flags(SSL_CTX *ctx, unsigned long flags); +unsigned long SSL_CTX_dane_clear_flags(SSL_CTX *ctx, unsigned long flags); +unsigned long SSL_dane_set_flags(SSL *ssl, unsigned long flags); +unsigned long SSL_dane_clear_flags(SSL *ssl, unsigned long flags); + +__owur int SSL_CTX_set1_param(SSL_CTX *ctx, X509_VERIFY_PARAM *vpm); +__owur int SSL_set1_param(SSL *ssl, X509_VERIFY_PARAM *vpm); + +__owur X509_VERIFY_PARAM *SSL_CTX_get0_param(SSL_CTX *ctx); +__owur X509_VERIFY_PARAM *SSL_get0_param(SSL *ssl); + +# ifndef OPENSSL_NO_SRP +int SSL_CTX_set_srp_username(SSL_CTX *ctx, char *name); +int SSL_CTX_set_srp_password(SSL_CTX *ctx, char *password); +int SSL_CTX_set_srp_strength(SSL_CTX *ctx, int strength); +int SSL_CTX_set_srp_client_pwd_callback(SSL_CTX *ctx, + char *(*cb) (SSL *, void *)); +int SSL_CTX_set_srp_verify_param_callback(SSL_CTX *ctx, + int (*cb) (SSL *, void *)); +int SSL_CTX_set_srp_username_callback(SSL_CTX *ctx, + int (*cb) (SSL *, int *, void *)); +int SSL_CTX_set_srp_cb_arg(SSL_CTX *ctx, void *arg); + +int SSL_set_srp_server_param(SSL *s, const BIGNUM *N, const BIGNUM *g, + BIGNUM *sa, BIGNUM *v, char *info); +int SSL_set_srp_server_param_pw(SSL *s, const char *user, const char *pass, + const char *grp); + +__owur BIGNUM *SSL_get_srp_g(SSL *s); +__owur BIGNUM *SSL_get_srp_N(SSL *s); + +__owur char *SSL_get_srp_username(SSL *s); +__owur char *SSL_get_srp_userinfo(SSL *s); +# endif + +/* + * ClientHello callback and helpers. + */ + +# define SSL_CLIENT_HELLO_SUCCESS 1 +# define SSL_CLIENT_HELLO_ERROR 0 +# define SSL_CLIENT_HELLO_RETRY (-1) + +typedef int (*SSL_client_hello_cb_fn) (SSL *s, int *al, void *arg); +void SSL_CTX_set_client_hello_cb(SSL_CTX *c, SSL_client_hello_cb_fn cb, + void *arg); +int SSL_client_hello_isv2(SSL *s); +unsigned int SSL_client_hello_get0_legacy_version(SSL *s); +size_t SSL_client_hello_get0_random(SSL *s, const unsigned char **out); +size_t SSL_client_hello_get0_session_id(SSL *s, const unsigned char **out); +size_t SSL_client_hello_get0_ciphers(SSL *s, const unsigned char **out); +size_t SSL_client_hello_get0_compression_methods(SSL *s, + const unsigned char **out); +int SSL_client_hello_get1_extensions_present(SSL *s, int **out, size_t *outlen); +int SSL_client_hello_get0_ext(SSL *s, unsigned int type, + const unsigned char **out, size_t *outlen); + +void SSL_certs_clear(SSL *s); +void SSL_free(SSL *ssl); +# ifdef OSSL_ASYNC_FD +/* + * Windows application developer has to include windows.h to use these. + */ +__owur int SSL_waiting_for_async(SSL *s); +__owur int SSL_get_all_async_fds(SSL *s, OSSL_ASYNC_FD *fds, size_t *numfds); +__owur int SSL_get_changed_async_fds(SSL *s, OSSL_ASYNC_FD *addfd, + size_t *numaddfds, OSSL_ASYNC_FD *delfd, + size_t *numdelfds); +# endif +__owur int SSL_accept(SSL *ssl); +__owur int SSL_stateless(SSL *s); +__owur int SSL_connect(SSL *ssl); +__owur int SSL_read(SSL *ssl, void *buf, int num); +__owur int SSL_read_ex(SSL *ssl, void *buf, size_t num, size_t *readbytes); + +# define SSL_READ_EARLY_DATA_ERROR 0 +# define SSL_READ_EARLY_DATA_SUCCESS 1 +# define SSL_READ_EARLY_DATA_FINISH 2 + +__owur int SSL_read_early_data(SSL *s, void *buf, size_t num, + size_t *readbytes); +__owur int SSL_peek(SSL *ssl, void *buf, int num); +__owur int SSL_peek_ex(SSL *ssl, void *buf, size_t num, size_t *readbytes); +__owur int SSL_write(SSL *ssl, const void *buf, int num); +__owur int SSL_write_ex(SSL *s, const void *buf, size_t num, size_t *written); +__owur int SSL_write_early_data(SSL *s, const void *buf, size_t num, + size_t *written); +long SSL_ctrl(SSL *ssl, int cmd, long larg, void *parg); +long SSL_callback_ctrl(SSL *, int, void (*)(void)); +long SSL_CTX_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg); +long SSL_CTX_callback_ctrl(SSL_CTX *, int, void (*)(void)); + +# define SSL_EARLY_DATA_NOT_SENT 0 +# define SSL_EARLY_DATA_REJECTED 1 +# define SSL_EARLY_DATA_ACCEPTED 2 + +__owur int SSL_get_early_data_status(const SSL *s); + +__owur int SSL_get_error(const SSL *s, int ret_code); +__owur const char *SSL_get_version(const SSL *s); + +/* This sets the 'default' SSL version that SSL_new() will create */ +__owur int SSL_CTX_set_ssl_version(SSL_CTX *ctx, const SSL_METHOD *meth); + +# ifndef OPENSSL_NO_SSL3_METHOD +DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *SSLv3_method(void)) /* SSLv3 */ +DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *SSLv3_server_method(void)) +DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *SSLv3_client_method(void)) +# endif + +#define SSLv23_method TLS_method +#define SSLv23_server_method TLS_server_method +#define SSLv23_client_method TLS_client_method + +/* Negotiate highest available SSL/TLS version */ +__owur const SSL_METHOD *TLS_method(void); +__owur const SSL_METHOD *TLS_server_method(void); +__owur const SSL_METHOD *TLS_client_method(void); + +# ifndef OPENSSL_NO_TLS1_METHOD +DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_method(void)) /* TLSv1.0 */ +DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_server_method(void)) +DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_client_method(void)) +# endif + +# ifndef OPENSSL_NO_TLS1_1_METHOD +DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_1_method(void)) /* TLSv1.1 */ +DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_1_server_method(void)) +DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_1_client_method(void)) +# endif + +# ifndef OPENSSL_NO_TLS1_2_METHOD +DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_2_method(void)) /* TLSv1.2 */ +DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_2_server_method(void)) +DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_2_client_method(void)) +# endif + +# ifndef OPENSSL_NO_DTLS1_METHOD +DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_method(void)) /* DTLSv1.0 */ +DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_server_method(void)) +DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_client_method(void)) +# endif + +# ifndef OPENSSL_NO_DTLS1_2_METHOD +/* DTLSv1.2 */ +DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_2_method(void)) +DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_2_server_method(void)) +DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_2_client_method(void)) +# endif + +__owur const SSL_METHOD *DTLS_method(void); /* DTLS 1.0 and 1.2 */ +__owur const SSL_METHOD *DTLS_server_method(void); /* DTLS 1.0 and 1.2 */ +__owur const SSL_METHOD *DTLS_client_method(void); /* DTLS 1.0 and 1.2 */ + +__owur size_t DTLS_get_data_mtu(const SSL *s); + +__owur STACK_OF(SSL_CIPHER) *SSL_get_ciphers(const SSL *s); +__owur STACK_OF(SSL_CIPHER) *SSL_CTX_get_ciphers(const SSL_CTX *ctx); +__owur STACK_OF(SSL_CIPHER) *SSL_get_client_ciphers(const SSL *s); +__owur STACK_OF(SSL_CIPHER) *SSL_get1_supported_ciphers(SSL *s); + +__owur int SSL_do_handshake(SSL *s); +int SSL_key_update(SSL *s, int updatetype); +int SSL_get_key_update_type(const SSL *s); +int SSL_renegotiate(SSL *s); +int SSL_renegotiate_abbreviated(SSL *s); +__owur int SSL_renegotiate_pending(const SSL *s); +int SSL_shutdown(SSL *s); +__owur int SSL_verify_client_post_handshake(SSL *s); +void SSL_CTX_set_post_handshake_auth(SSL_CTX *ctx, int val); +void SSL_set_post_handshake_auth(SSL *s, int val); + +__owur const SSL_METHOD *SSL_CTX_get_ssl_method(const SSL_CTX *ctx); +__owur const SSL_METHOD *SSL_get_ssl_method(const SSL *s); +__owur int SSL_set_ssl_method(SSL *s, const SSL_METHOD *method); +__owur const char *SSL_alert_type_string_long(int value); +__owur const char *SSL_alert_type_string(int value); +__owur const char *SSL_alert_desc_string_long(int value); +__owur const char *SSL_alert_desc_string(int value); + +void SSL_set0_CA_list(SSL *s, STACK_OF(X509_NAME) *name_list); +void SSL_CTX_set0_CA_list(SSL_CTX *ctx, STACK_OF(X509_NAME) *name_list); +__owur const STACK_OF(X509_NAME) *SSL_get0_CA_list(const SSL *s); +__owur const STACK_OF(X509_NAME) *SSL_CTX_get0_CA_list(const SSL_CTX *ctx); +__owur int SSL_add1_to_CA_list(SSL *ssl, const X509 *x); +__owur int SSL_CTX_add1_to_CA_list(SSL_CTX *ctx, const X509 *x); +__owur const STACK_OF(X509_NAME) *SSL_get0_peer_CA_list(const SSL *s); + +void SSL_set_client_CA_list(SSL *s, STACK_OF(X509_NAME) *name_list); +void SSL_CTX_set_client_CA_list(SSL_CTX *ctx, STACK_OF(X509_NAME) *name_list); +__owur STACK_OF(X509_NAME) *SSL_get_client_CA_list(const SSL *s); +__owur STACK_OF(X509_NAME) *SSL_CTX_get_client_CA_list(const SSL_CTX *s); +__owur int SSL_add_client_CA(SSL *ssl, X509 *x); +__owur int SSL_CTX_add_client_CA(SSL_CTX *ctx, X509 *x); + +void SSL_set_connect_state(SSL *s); +void SSL_set_accept_state(SSL *s); + +__owur long SSL_get_default_timeout(const SSL *s); + +# if OPENSSL_API_COMPAT < 0x10100000L +# define SSL_library_init() OPENSSL_init_ssl(0, NULL) +# endif + +__owur char *SSL_CIPHER_description(const SSL_CIPHER *, char *buf, int size); +__owur STACK_OF(X509_NAME) *SSL_dup_CA_list(const STACK_OF(X509_NAME) *sk); + +__owur SSL *SSL_dup(SSL *ssl); + +__owur X509 *SSL_get_certificate(const SSL *ssl); +/* + * EVP_PKEY + */ +struct evp_pkey_st *SSL_get_privatekey(const SSL *ssl); + +__owur X509 *SSL_CTX_get0_certificate(const SSL_CTX *ctx); +__owur EVP_PKEY *SSL_CTX_get0_privatekey(const SSL_CTX *ctx); + +void SSL_CTX_set_quiet_shutdown(SSL_CTX *ctx, int mode); +__owur int SSL_CTX_get_quiet_shutdown(const SSL_CTX *ctx); +void SSL_set_quiet_shutdown(SSL *ssl, int mode); +__owur int SSL_get_quiet_shutdown(const SSL *ssl); +void SSL_set_shutdown(SSL *ssl, int mode); +__owur int SSL_get_shutdown(const SSL *ssl); +__owur int SSL_version(const SSL *ssl); +__owur int SSL_client_version(const SSL *s); +__owur int SSL_CTX_set_default_verify_paths(SSL_CTX *ctx); +__owur int SSL_CTX_set_default_verify_dir(SSL_CTX *ctx); +__owur int SSL_CTX_set_default_verify_file(SSL_CTX *ctx); +__owur int SSL_CTX_load_verify_locations(SSL_CTX *ctx, const char *CAfile, + const char *CApath); +# define SSL_get0_session SSL_get_session/* just peek at pointer */ +__owur SSL_SESSION *SSL_get_session(const SSL *ssl); +__owur SSL_SESSION *SSL_get1_session(SSL *ssl); /* obtain a reference count */ +__owur SSL_CTX *SSL_get_SSL_CTX(const SSL *ssl); +SSL_CTX *SSL_set_SSL_CTX(SSL *ssl, SSL_CTX *ctx); +void SSL_set_info_callback(SSL *ssl, + void (*cb) (const SSL *ssl, int type, int val)); +void (*SSL_get_info_callback(const SSL *ssl)) (const SSL *ssl, int type, + int val); +__owur OSSL_HANDSHAKE_STATE SSL_get_state(const SSL *ssl); + +void SSL_set_verify_result(SSL *ssl, long v); +__owur long SSL_get_verify_result(const SSL *ssl); +__owur STACK_OF(X509) *SSL_get0_verified_chain(const SSL *s); + +__owur size_t SSL_get_client_random(const SSL *ssl, unsigned char *out, + size_t outlen); +__owur size_t SSL_get_server_random(const SSL *ssl, unsigned char *out, + size_t outlen); +__owur size_t SSL_SESSION_get_master_key(const SSL_SESSION *sess, + unsigned char *out, size_t outlen); +__owur int SSL_SESSION_set1_master_key(SSL_SESSION *sess, + const unsigned char *in, size_t len); +uint8_t SSL_SESSION_get_max_fragment_length(const SSL_SESSION *sess); + +#define SSL_get_ex_new_index(l, p, newf, dupf, freef) \ + CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_SSL, l, p, newf, dupf, freef) +__owur int SSL_set_ex_data(SSL *ssl, int idx, void *data); +void *SSL_get_ex_data(const SSL *ssl, int idx); +#define SSL_SESSION_get_ex_new_index(l, p, newf, dupf, freef) \ + CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_SSL_SESSION, l, p, newf, dupf, freef) +__owur int SSL_SESSION_set_ex_data(SSL_SESSION *ss, int idx, void *data); +void *SSL_SESSION_get_ex_data(const SSL_SESSION *ss, int idx); +#define SSL_CTX_get_ex_new_index(l, p, newf, dupf, freef) \ + CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_SSL_CTX, l, p, newf, dupf, freef) +__owur int SSL_CTX_set_ex_data(SSL_CTX *ssl, int idx, void *data); +void *SSL_CTX_get_ex_data(const SSL_CTX *ssl, int idx); + +__owur int SSL_get_ex_data_X509_STORE_CTX_idx(void); + +# define SSL_CTX_sess_set_cache_size(ctx,t) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SESS_CACHE_SIZE,t,NULL) +# define SSL_CTX_sess_get_cache_size(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_GET_SESS_CACHE_SIZE,0,NULL) +# define SSL_CTX_set_session_cache_mode(ctx,m) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SESS_CACHE_MODE,m,NULL) +# define SSL_CTX_get_session_cache_mode(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_GET_SESS_CACHE_MODE,0,NULL) + +# define SSL_CTX_get_default_read_ahead(ctx) SSL_CTX_get_read_ahead(ctx) +# define SSL_CTX_set_default_read_ahead(ctx,m) SSL_CTX_set_read_ahead(ctx,m) +# define SSL_CTX_get_read_ahead(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_GET_READ_AHEAD,0,NULL) +# define SSL_CTX_set_read_ahead(ctx,m) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_READ_AHEAD,m,NULL) +# define SSL_CTX_get_max_cert_list(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_GET_MAX_CERT_LIST,0,NULL) +# define SSL_CTX_set_max_cert_list(ctx,m) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_MAX_CERT_LIST,m,NULL) +# define SSL_get_max_cert_list(ssl) \ + SSL_ctrl(ssl,SSL_CTRL_GET_MAX_CERT_LIST,0,NULL) +# define SSL_set_max_cert_list(ssl,m) \ + SSL_ctrl(ssl,SSL_CTRL_SET_MAX_CERT_LIST,m,NULL) + +# define SSL_CTX_set_max_send_fragment(ctx,m) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_MAX_SEND_FRAGMENT,m,NULL) +# define SSL_set_max_send_fragment(ssl,m) \ + SSL_ctrl(ssl,SSL_CTRL_SET_MAX_SEND_FRAGMENT,m,NULL) +# define SSL_CTX_set_split_send_fragment(ctx,m) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SPLIT_SEND_FRAGMENT,m,NULL) +# define SSL_set_split_send_fragment(ssl,m) \ + SSL_ctrl(ssl,SSL_CTRL_SET_SPLIT_SEND_FRAGMENT,m,NULL) +# define SSL_CTX_set_max_pipelines(ctx,m) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_MAX_PIPELINES,m,NULL) +# define SSL_set_max_pipelines(ssl,m) \ + SSL_ctrl(ssl,SSL_CTRL_SET_MAX_PIPELINES,m,NULL) + +void SSL_CTX_set_default_read_buffer_len(SSL_CTX *ctx, size_t len); +void SSL_set_default_read_buffer_len(SSL *s, size_t len); + +# ifndef OPENSSL_NO_DH +/* NB: the |keylength| is only applicable when is_export is true */ +void SSL_CTX_set_tmp_dh_callback(SSL_CTX *ctx, + DH *(*dh) (SSL *ssl, int is_export, + int keylength)); +void SSL_set_tmp_dh_callback(SSL *ssl, + DH *(*dh) (SSL *ssl, int is_export, + int keylength)); +# endif + +__owur const COMP_METHOD *SSL_get_current_compression(const SSL *s); +__owur const COMP_METHOD *SSL_get_current_expansion(const SSL *s); +__owur const char *SSL_COMP_get_name(const COMP_METHOD *comp); +__owur const char *SSL_COMP_get0_name(const SSL_COMP *comp); +__owur int SSL_COMP_get_id(const SSL_COMP *comp); +STACK_OF(SSL_COMP) *SSL_COMP_get_compression_methods(void); +__owur STACK_OF(SSL_COMP) *SSL_COMP_set0_compression_methods(STACK_OF(SSL_COMP) + *meths); +# if OPENSSL_API_COMPAT < 0x10100000L +# define SSL_COMP_free_compression_methods() while(0) continue +# endif +__owur int SSL_COMP_add_compression_method(int id, COMP_METHOD *cm); + +const SSL_CIPHER *SSL_CIPHER_find(SSL *ssl, const unsigned char *ptr); +int SSL_CIPHER_get_cipher_nid(const SSL_CIPHER *c); +int SSL_CIPHER_get_digest_nid(const SSL_CIPHER *c); +int SSL_bytes_to_cipher_list(SSL *s, const unsigned char *bytes, size_t len, + int isv2format, STACK_OF(SSL_CIPHER) **sk, + STACK_OF(SSL_CIPHER) **scsvs); + +/* TLS extensions functions */ +__owur int SSL_set_session_ticket_ext(SSL *s, void *ext_data, int ext_len); + +__owur int SSL_set_session_ticket_ext_cb(SSL *s, + tls_session_ticket_ext_cb_fn cb, + void *arg); + +/* Pre-shared secret session resumption functions */ +__owur int SSL_set_session_secret_cb(SSL *s, + tls_session_secret_cb_fn session_secret_cb, + void *arg); + +void SSL_CTX_set_not_resumable_session_callback(SSL_CTX *ctx, + int (*cb) (SSL *ssl, + int + is_forward_secure)); + +void SSL_set_not_resumable_session_callback(SSL *ssl, + int (*cb) (SSL *ssl, + int is_forward_secure)); + +void SSL_CTX_set_record_padding_callback(SSL_CTX *ctx, + size_t (*cb) (SSL *ssl, int type, + size_t len, void *arg)); +void SSL_CTX_set_record_padding_callback_arg(SSL_CTX *ctx, void *arg); +void *SSL_CTX_get_record_padding_callback_arg(const SSL_CTX *ctx); +int SSL_CTX_set_block_padding(SSL_CTX *ctx, size_t block_size); + +void SSL_set_record_padding_callback(SSL *ssl, + size_t (*cb) (SSL *ssl, int type, + size_t len, void *arg)); +void SSL_set_record_padding_callback_arg(SSL *ssl, void *arg); +void *SSL_get_record_padding_callback_arg(const SSL *ssl); +int SSL_set_block_padding(SSL *ssl, size_t block_size); + +int SSL_set_num_tickets(SSL *s, size_t num_tickets); +size_t SSL_get_num_tickets(const SSL *s); +int SSL_CTX_set_num_tickets(SSL_CTX *ctx, size_t num_tickets); +size_t SSL_CTX_get_num_tickets(const SSL_CTX *ctx); + +# if OPENSSL_API_COMPAT < 0x10100000L +# define SSL_cache_hit(s) SSL_session_reused(s) +# endif + +__owur int SSL_session_reused(const SSL *s); +__owur int SSL_is_server(const SSL *s); + +__owur __owur SSL_CONF_CTX *SSL_CONF_CTX_new(void); +int SSL_CONF_CTX_finish(SSL_CONF_CTX *cctx); +void SSL_CONF_CTX_free(SSL_CONF_CTX *cctx); +unsigned int SSL_CONF_CTX_set_flags(SSL_CONF_CTX *cctx, unsigned int flags); +__owur unsigned int SSL_CONF_CTX_clear_flags(SSL_CONF_CTX *cctx, + unsigned int flags); +__owur int SSL_CONF_CTX_set1_prefix(SSL_CONF_CTX *cctx, const char *pre); + +void SSL_CONF_CTX_set_ssl(SSL_CONF_CTX *cctx, SSL *ssl); +void SSL_CONF_CTX_set_ssl_ctx(SSL_CONF_CTX *cctx, SSL_CTX *ctx); + +__owur int SSL_CONF_cmd(SSL_CONF_CTX *cctx, const char *cmd, const char *value); +__owur int SSL_CONF_cmd_argv(SSL_CONF_CTX *cctx, int *pargc, char ***pargv); +__owur int SSL_CONF_cmd_value_type(SSL_CONF_CTX *cctx, const char *cmd); + +void SSL_add_ssl_module(void); +int SSL_config(SSL *s, const char *name); +int SSL_CTX_config(SSL_CTX *ctx, const char *name); + +# ifndef OPENSSL_NO_SSL_TRACE +void SSL_trace(int write_p, int version, int content_type, + const void *buf, size_t len, SSL *ssl, void *arg); +# endif + +# ifndef OPENSSL_NO_SOCK +int DTLSv1_listen(SSL *s, BIO_ADDR *client); +# endif + +# ifndef OPENSSL_NO_CT + +/* + * A callback for verifying that the received SCTs are sufficient. + * Expected to return 1 if they are sufficient, otherwise 0. + * May return a negative integer if an error occurs. + * A connection should be aborted if the SCTs are deemed insufficient. + */ +typedef int (*ssl_ct_validation_cb)(const CT_POLICY_EVAL_CTX *ctx, + const STACK_OF(SCT) *scts, void *arg); + +/* + * Sets a |callback| that is invoked upon receipt of ServerHelloDone to validate + * the received SCTs. + * If the callback returns a non-positive result, the connection is terminated. + * Call this function before beginning a handshake. + * If a NULL |callback| is provided, SCT validation is disabled. + * |arg| is arbitrary userdata that will be passed to the callback whenever it + * is invoked. Ownership of |arg| remains with the caller. + * + * NOTE: A side-effect of setting a CT callback is that an OCSP stapled response + * will be requested. + */ +int SSL_set_ct_validation_callback(SSL *s, ssl_ct_validation_cb callback, + void *arg); +int SSL_CTX_set_ct_validation_callback(SSL_CTX *ctx, + ssl_ct_validation_cb callback, + void *arg); +#define SSL_disable_ct(s) \ + ((void) SSL_set_validation_callback((s), NULL, NULL)) +#define SSL_CTX_disable_ct(ctx) \ + ((void) SSL_CTX_set_validation_callback((ctx), NULL, NULL)) + +/* + * The validation type enumerates the available behaviours of the built-in SSL + * CT validation callback selected via SSL_enable_ct() and SSL_CTX_enable_ct(). + * The underlying callback is a static function in libssl. + */ +enum { + SSL_CT_VALIDATION_PERMISSIVE = 0, + SSL_CT_VALIDATION_STRICT +}; + +/* + * Enable CT by setting up a callback that implements one of the built-in + * validation variants. The SSL_CT_VALIDATION_PERMISSIVE variant always + * continues the handshake, the application can make appropriate decisions at + * handshake completion. The SSL_CT_VALIDATION_STRICT variant requires at + * least one valid SCT, or else handshake termination will be requested. The + * handshake may continue anyway if SSL_VERIFY_NONE is in effect. + */ +int SSL_enable_ct(SSL *s, int validation_mode); +int SSL_CTX_enable_ct(SSL_CTX *ctx, int validation_mode); + +/* + * Report whether a non-NULL callback is enabled. + */ +int SSL_ct_is_enabled(const SSL *s); +int SSL_CTX_ct_is_enabled(const SSL_CTX *ctx); + +/* Gets the SCTs received from a connection */ +const STACK_OF(SCT) *SSL_get0_peer_scts(SSL *s); + +/* + * Loads the CT log list from the default location. + * If a CTLOG_STORE has previously been set using SSL_CTX_set_ctlog_store, + * the log information loaded from this file will be appended to the + * CTLOG_STORE. + * Returns 1 on success, 0 otherwise. + */ +int SSL_CTX_set_default_ctlog_list_file(SSL_CTX *ctx); + +/* + * Loads the CT log list from the specified file path. + * If a CTLOG_STORE has previously been set using SSL_CTX_set_ctlog_store, + * the log information loaded from this file will be appended to the + * CTLOG_STORE. + * Returns 1 on success, 0 otherwise. + */ +int SSL_CTX_set_ctlog_list_file(SSL_CTX *ctx, const char *path); + +/* + * Sets the CT log list used by all SSL connections created from this SSL_CTX. + * Ownership of the CTLOG_STORE is transferred to the SSL_CTX. + */ +void SSL_CTX_set0_ctlog_store(SSL_CTX *ctx, CTLOG_STORE *logs); + +/* + * Gets the CT log list used by all SSL connections created from this SSL_CTX. + * This will be NULL unless one of the following functions has been called: + * - SSL_CTX_set_default_ctlog_list_file + * - SSL_CTX_set_ctlog_list_file + * - SSL_CTX_set_ctlog_store + */ +const CTLOG_STORE *SSL_CTX_get0_ctlog_store(const SSL_CTX *ctx); + +# endif /* OPENSSL_NO_CT */ + +/* What the "other" parameter contains in security callback */ +/* Mask for type */ +# define SSL_SECOP_OTHER_TYPE 0xffff0000 +# define SSL_SECOP_OTHER_NONE 0 +# define SSL_SECOP_OTHER_CIPHER (1 << 16) +# define SSL_SECOP_OTHER_CURVE (2 << 16) +# define SSL_SECOP_OTHER_DH (3 << 16) +# define SSL_SECOP_OTHER_PKEY (4 << 16) +# define SSL_SECOP_OTHER_SIGALG (5 << 16) +# define SSL_SECOP_OTHER_CERT (6 << 16) + +/* Indicated operation refers to peer key or certificate */ +# define SSL_SECOP_PEER 0x1000 + +/* Values for "op" parameter in security callback */ + +/* Called to filter ciphers */ +/* Ciphers client supports */ +# define SSL_SECOP_CIPHER_SUPPORTED (1 | SSL_SECOP_OTHER_CIPHER) +/* Cipher shared by client/server */ +# define SSL_SECOP_CIPHER_SHARED (2 | SSL_SECOP_OTHER_CIPHER) +/* Sanity check of cipher server selects */ +# define SSL_SECOP_CIPHER_CHECK (3 | SSL_SECOP_OTHER_CIPHER) +/* Curves supported by client */ +# define SSL_SECOP_CURVE_SUPPORTED (4 | SSL_SECOP_OTHER_CURVE) +/* Curves shared by client/server */ +# define SSL_SECOP_CURVE_SHARED (5 | SSL_SECOP_OTHER_CURVE) +/* Sanity check of curve server selects */ +# define SSL_SECOP_CURVE_CHECK (6 | SSL_SECOP_OTHER_CURVE) +/* Temporary DH key */ +# define SSL_SECOP_TMP_DH (7 | SSL_SECOP_OTHER_PKEY) +/* SSL/TLS version */ +# define SSL_SECOP_VERSION (9 | SSL_SECOP_OTHER_NONE) +/* Session tickets */ +# define SSL_SECOP_TICKET (10 | SSL_SECOP_OTHER_NONE) +/* Supported signature algorithms sent to peer */ +# define SSL_SECOP_SIGALG_SUPPORTED (11 | SSL_SECOP_OTHER_SIGALG) +/* Shared signature algorithm */ +# define SSL_SECOP_SIGALG_SHARED (12 | SSL_SECOP_OTHER_SIGALG) +/* Sanity check signature algorithm allowed */ +# define SSL_SECOP_SIGALG_CHECK (13 | SSL_SECOP_OTHER_SIGALG) +/* Used to get mask of supported public key signature algorithms */ +# define SSL_SECOP_SIGALG_MASK (14 | SSL_SECOP_OTHER_SIGALG) +/* Use to see if compression is allowed */ +# define SSL_SECOP_COMPRESSION (15 | SSL_SECOP_OTHER_NONE) +/* EE key in certificate */ +# define SSL_SECOP_EE_KEY (16 | SSL_SECOP_OTHER_CERT) +/* CA key in certificate */ +# define SSL_SECOP_CA_KEY (17 | SSL_SECOP_OTHER_CERT) +/* CA digest algorithm in certificate */ +# define SSL_SECOP_CA_MD (18 | SSL_SECOP_OTHER_CERT) +/* Peer EE key in certificate */ +# define SSL_SECOP_PEER_EE_KEY (SSL_SECOP_EE_KEY | SSL_SECOP_PEER) +/* Peer CA key in certificate */ +# define SSL_SECOP_PEER_CA_KEY (SSL_SECOP_CA_KEY | SSL_SECOP_PEER) +/* Peer CA digest algorithm in certificate */ +# define SSL_SECOP_PEER_CA_MD (SSL_SECOP_CA_MD | SSL_SECOP_PEER) + +void SSL_set_security_level(SSL *s, int level); +__owur int SSL_get_security_level(const SSL *s); +void SSL_set_security_callback(SSL *s, + int (*cb) (const SSL *s, const SSL_CTX *ctx, + int op, int bits, int nid, + void *other, void *ex)); +int (*SSL_get_security_callback(const SSL *s)) (const SSL *s, + const SSL_CTX *ctx, int op, + int bits, int nid, void *other, + void *ex); +void SSL_set0_security_ex_data(SSL *s, void *ex); +__owur void *SSL_get0_security_ex_data(const SSL *s); + +void SSL_CTX_set_security_level(SSL_CTX *ctx, int level); +__owur int SSL_CTX_get_security_level(const SSL_CTX *ctx); +void SSL_CTX_set_security_callback(SSL_CTX *ctx, + int (*cb) (const SSL *s, const SSL_CTX *ctx, + int op, int bits, int nid, + void *other, void *ex)); +int (*SSL_CTX_get_security_callback(const SSL_CTX *ctx)) (const SSL *s, + const SSL_CTX *ctx, + int op, int bits, + int nid, + void *other, + void *ex); +void SSL_CTX_set0_security_ex_data(SSL_CTX *ctx, void *ex); +__owur void *SSL_CTX_get0_security_ex_data(const SSL_CTX *ctx); + +/* OPENSSL_INIT flag 0x010000 reserved for internal use */ +# define OPENSSL_INIT_NO_LOAD_SSL_STRINGS 0x00100000L +# define OPENSSL_INIT_LOAD_SSL_STRINGS 0x00200000L + +# define OPENSSL_INIT_SSL_DEFAULT \ + (OPENSSL_INIT_LOAD_SSL_STRINGS | OPENSSL_INIT_LOAD_CRYPTO_STRINGS) + +int OPENSSL_init_ssl(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings); + +# ifndef OPENSSL_NO_UNIT_TEST +__owur const struct openssl_ssl_test_functions *SSL_test_functions(void); +# endif + +__owur int SSL_free_buffers(SSL *ssl); +__owur int SSL_alloc_buffers(SSL *ssl); + +/* Status codes passed to the decrypt session ticket callback. Some of these + * are for internal use only and are never passed to the callback. */ +typedef int SSL_TICKET_STATUS; + +/* Support for ticket appdata */ +/* fatal error, malloc failure */ +# define SSL_TICKET_FATAL_ERR_MALLOC 0 +/* fatal error, either from parsing or decrypting the ticket */ +# define SSL_TICKET_FATAL_ERR_OTHER 1 +/* No ticket present */ +# define SSL_TICKET_NONE 2 +/* Empty ticket present */ +# define SSL_TICKET_EMPTY 3 +/* the ticket couldn't be decrypted */ +# define SSL_TICKET_NO_DECRYPT 4 +/* a ticket was successfully decrypted */ +# define SSL_TICKET_SUCCESS 5 +/* same as above but the ticket needs to be renewed */ +# define SSL_TICKET_SUCCESS_RENEW 6 + +/* Return codes for the decrypt session ticket callback */ +typedef int SSL_TICKET_RETURN; + +/* An error occurred */ +#define SSL_TICKET_RETURN_ABORT 0 +/* Do not use the ticket, do not send a renewed ticket to the client */ +#define SSL_TICKET_RETURN_IGNORE 1 +/* Do not use the ticket, send a renewed ticket to the client */ +#define SSL_TICKET_RETURN_IGNORE_RENEW 2 +/* Use the ticket, do not send a renewed ticket to the client */ +#define SSL_TICKET_RETURN_USE 3 +/* Use the ticket, send a renewed ticket to the client */ +#define SSL_TICKET_RETURN_USE_RENEW 4 + +typedef int (*SSL_CTX_generate_session_ticket_fn)(SSL *s, void *arg); +typedef SSL_TICKET_RETURN (*SSL_CTX_decrypt_session_ticket_fn)(SSL *s, SSL_SESSION *ss, + const unsigned char *keyname, + size_t keyname_length, + SSL_TICKET_STATUS status, + void *arg); +int SSL_CTX_set_session_ticket_cb(SSL_CTX *ctx, + SSL_CTX_generate_session_ticket_fn gen_cb, + SSL_CTX_decrypt_session_ticket_fn dec_cb, + void *arg); +int SSL_SESSION_set1_ticket_appdata(SSL_SESSION *ss, const void *data, size_t len); +int SSL_SESSION_get0_ticket_appdata(SSL_SESSION *ss, void **data, size_t *len); + +extern const char SSL_version_str[]; + +typedef unsigned int (*DTLS_timer_cb)(SSL *s, unsigned int timer_us); + +void DTLS_set_timer_cb(SSL *s, DTLS_timer_cb cb); + + +typedef int (*SSL_allow_early_data_cb_fn)(SSL *s, void *arg); +void SSL_CTX_set_allow_early_data_cb(SSL_CTX *ctx, + SSL_allow_early_data_cb_fn cb, + void *arg); +void SSL_set_allow_early_data_cb(SSL *s, + SSL_allow_early_data_cb_fn cb, + void *arg); + +# ifdef __cplusplus +} +# endif +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/ssl2.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/ssl2.h new file mode 100644 index 0000000..5321bd2 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/ssl2.h @@ -0,0 +1,24 @@ +/* + * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_SSL2_H +# define HEADER_SSL2_H + +#ifdef __cplusplus +extern "C" { +#endif + +# define SSL2_VERSION 0x0002 + +# define SSL2_MT_CLIENT_HELLO 1 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/ssl3.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/ssl3.h new file mode 100644 index 0000000..8d01fcc --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/ssl3.h @@ -0,0 +1,339 @@ +/* + * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. + * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_SSL3_H +# define HEADER_SSL3_H + +# include +# include +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Signalling cipher suite value from RFC 5746 + * (TLS_EMPTY_RENEGOTIATION_INFO_SCSV) + */ +# define SSL3_CK_SCSV 0x030000FF + +/* + * Signalling cipher suite value from draft-ietf-tls-downgrade-scsv-00 + * (TLS_FALLBACK_SCSV) + */ +# define SSL3_CK_FALLBACK_SCSV 0x03005600 + +# define SSL3_CK_RSA_NULL_MD5 0x03000001 +# define SSL3_CK_RSA_NULL_SHA 0x03000002 +# define SSL3_CK_RSA_RC4_40_MD5 0x03000003 +# define SSL3_CK_RSA_RC4_128_MD5 0x03000004 +# define SSL3_CK_RSA_RC4_128_SHA 0x03000005 +# define SSL3_CK_RSA_RC2_40_MD5 0x03000006 +# define SSL3_CK_RSA_IDEA_128_SHA 0x03000007 +# define SSL3_CK_RSA_DES_40_CBC_SHA 0x03000008 +# define SSL3_CK_RSA_DES_64_CBC_SHA 0x03000009 +# define SSL3_CK_RSA_DES_192_CBC3_SHA 0x0300000A + +# define SSL3_CK_DH_DSS_DES_40_CBC_SHA 0x0300000B +# define SSL3_CK_DH_DSS_DES_64_CBC_SHA 0x0300000C +# define SSL3_CK_DH_DSS_DES_192_CBC3_SHA 0x0300000D +# define SSL3_CK_DH_RSA_DES_40_CBC_SHA 0x0300000E +# define SSL3_CK_DH_RSA_DES_64_CBC_SHA 0x0300000F +# define SSL3_CK_DH_RSA_DES_192_CBC3_SHA 0x03000010 + +# define SSL3_CK_DHE_DSS_DES_40_CBC_SHA 0x03000011 +# define SSL3_CK_EDH_DSS_DES_40_CBC_SHA SSL3_CK_DHE_DSS_DES_40_CBC_SHA +# define SSL3_CK_DHE_DSS_DES_64_CBC_SHA 0x03000012 +# define SSL3_CK_EDH_DSS_DES_64_CBC_SHA SSL3_CK_DHE_DSS_DES_64_CBC_SHA +# define SSL3_CK_DHE_DSS_DES_192_CBC3_SHA 0x03000013 +# define SSL3_CK_EDH_DSS_DES_192_CBC3_SHA SSL3_CK_DHE_DSS_DES_192_CBC3_SHA +# define SSL3_CK_DHE_RSA_DES_40_CBC_SHA 0x03000014 +# define SSL3_CK_EDH_RSA_DES_40_CBC_SHA SSL3_CK_DHE_RSA_DES_40_CBC_SHA +# define SSL3_CK_DHE_RSA_DES_64_CBC_SHA 0x03000015 +# define SSL3_CK_EDH_RSA_DES_64_CBC_SHA SSL3_CK_DHE_RSA_DES_64_CBC_SHA +# define SSL3_CK_DHE_RSA_DES_192_CBC3_SHA 0x03000016 +# define SSL3_CK_EDH_RSA_DES_192_CBC3_SHA SSL3_CK_DHE_RSA_DES_192_CBC3_SHA + +# define SSL3_CK_ADH_RC4_40_MD5 0x03000017 +# define SSL3_CK_ADH_RC4_128_MD5 0x03000018 +# define SSL3_CK_ADH_DES_40_CBC_SHA 0x03000019 +# define SSL3_CK_ADH_DES_64_CBC_SHA 0x0300001A +# define SSL3_CK_ADH_DES_192_CBC_SHA 0x0300001B + +/* a bundle of RFC standard cipher names, generated from ssl3_ciphers[] */ +# define SSL3_RFC_RSA_NULL_MD5 "TLS_RSA_WITH_NULL_MD5" +# define SSL3_RFC_RSA_NULL_SHA "TLS_RSA_WITH_NULL_SHA" +# define SSL3_RFC_RSA_DES_192_CBC3_SHA "TLS_RSA_WITH_3DES_EDE_CBC_SHA" +# define SSL3_RFC_DHE_DSS_DES_192_CBC3_SHA "TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA" +# define SSL3_RFC_DHE_RSA_DES_192_CBC3_SHA "TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA" +# define SSL3_RFC_ADH_DES_192_CBC_SHA "TLS_DH_anon_WITH_3DES_EDE_CBC_SHA" +# define SSL3_RFC_RSA_IDEA_128_SHA "TLS_RSA_WITH_IDEA_CBC_SHA" +# define SSL3_RFC_RSA_RC4_128_MD5 "TLS_RSA_WITH_RC4_128_MD5" +# define SSL3_RFC_RSA_RC4_128_SHA "TLS_RSA_WITH_RC4_128_SHA" +# define SSL3_RFC_ADH_RC4_128_MD5 "TLS_DH_anon_WITH_RC4_128_MD5" + +# define SSL3_TXT_RSA_NULL_MD5 "NULL-MD5" +# define SSL3_TXT_RSA_NULL_SHA "NULL-SHA" +# define SSL3_TXT_RSA_RC4_40_MD5 "EXP-RC4-MD5" +# define SSL3_TXT_RSA_RC4_128_MD5 "RC4-MD5" +# define SSL3_TXT_RSA_RC4_128_SHA "RC4-SHA" +# define SSL3_TXT_RSA_RC2_40_MD5 "EXP-RC2-CBC-MD5" +# define SSL3_TXT_RSA_IDEA_128_SHA "IDEA-CBC-SHA" +# define SSL3_TXT_RSA_DES_40_CBC_SHA "EXP-DES-CBC-SHA" +# define SSL3_TXT_RSA_DES_64_CBC_SHA "DES-CBC-SHA" +# define SSL3_TXT_RSA_DES_192_CBC3_SHA "DES-CBC3-SHA" + +# define SSL3_TXT_DH_DSS_DES_40_CBC_SHA "EXP-DH-DSS-DES-CBC-SHA" +# define SSL3_TXT_DH_DSS_DES_64_CBC_SHA "DH-DSS-DES-CBC-SHA" +# define SSL3_TXT_DH_DSS_DES_192_CBC3_SHA "DH-DSS-DES-CBC3-SHA" +# define SSL3_TXT_DH_RSA_DES_40_CBC_SHA "EXP-DH-RSA-DES-CBC-SHA" +# define SSL3_TXT_DH_RSA_DES_64_CBC_SHA "DH-RSA-DES-CBC-SHA" +# define SSL3_TXT_DH_RSA_DES_192_CBC3_SHA "DH-RSA-DES-CBC3-SHA" + +# define SSL3_TXT_DHE_DSS_DES_40_CBC_SHA "EXP-DHE-DSS-DES-CBC-SHA" +# define SSL3_TXT_DHE_DSS_DES_64_CBC_SHA "DHE-DSS-DES-CBC-SHA" +# define SSL3_TXT_DHE_DSS_DES_192_CBC3_SHA "DHE-DSS-DES-CBC3-SHA" +# define SSL3_TXT_DHE_RSA_DES_40_CBC_SHA "EXP-DHE-RSA-DES-CBC-SHA" +# define SSL3_TXT_DHE_RSA_DES_64_CBC_SHA "DHE-RSA-DES-CBC-SHA" +# define SSL3_TXT_DHE_RSA_DES_192_CBC3_SHA "DHE-RSA-DES-CBC3-SHA" + +/* + * This next block of six "EDH" labels is for backward compatibility with + * older versions of OpenSSL. New code should use the six "DHE" labels above + * instead: + */ +# define SSL3_TXT_EDH_DSS_DES_40_CBC_SHA "EXP-EDH-DSS-DES-CBC-SHA" +# define SSL3_TXT_EDH_DSS_DES_64_CBC_SHA "EDH-DSS-DES-CBC-SHA" +# define SSL3_TXT_EDH_DSS_DES_192_CBC3_SHA "EDH-DSS-DES-CBC3-SHA" +# define SSL3_TXT_EDH_RSA_DES_40_CBC_SHA "EXP-EDH-RSA-DES-CBC-SHA" +# define SSL3_TXT_EDH_RSA_DES_64_CBC_SHA "EDH-RSA-DES-CBC-SHA" +# define SSL3_TXT_EDH_RSA_DES_192_CBC3_SHA "EDH-RSA-DES-CBC3-SHA" + +# define SSL3_TXT_ADH_RC4_40_MD5 "EXP-ADH-RC4-MD5" +# define SSL3_TXT_ADH_RC4_128_MD5 "ADH-RC4-MD5" +# define SSL3_TXT_ADH_DES_40_CBC_SHA "EXP-ADH-DES-CBC-SHA" +# define SSL3_TXT_ADH_DES_64_CBC_SHA "ADH-DES-CBC-SHA" +# define SSL3_TXT_ADH_DES_192_CBC_SHA "ADH-DES-CBC3-SHA" + +# define SSL3_SSL_SESSION_ID_LENGTH 32 +# define SSL3_MAX_SSL_SESSION_ID_LENGTH 32 + +# define SSL3_MASTER_SECRET_SIZE 48 +# define SSL3_RANDOM_SIZE 32 +# define SSL3_SESSION_ID_SIZE 32 +# define SSL3_RT_HEADER_LENGTH 5 + +# define SSL3_HM_HEADER_LENGTH 4 + +# ifndef SSL3_ALIGN_PAYLOAD + /* + * Some will argue that this increases memory footprint, but it's not + * actually true. Point is that malloc has to return at least 64-bit aligned + * pointers, meaning that allocating 5 bytes wastes 3 bytes in either case. + * Suggested pre-gaping simply moves these wasted bytes from the end of + * allocated region to its front, but makes data payload aligned, which + * improves performance:-) + */ +# define SSL3_ALIGN_PAYLOAD 8 +# else +# if (SSL3_ALIGN_PAYLOAD&(SSL3_ALIGN_PAYLOAD-1))!=0 +# error "insane SSL3_ALIGN_PAYLOAD" +# undef SSL3_ALIGN_PAYLOAD +# endif +# endif + +/* + * This is the maximum MAC (digest) size used by the SSL library. Currently + * maximum of 20 is used by SHA1, but we reserve for future extension for + * 512-bit hashes. + */ + +# define SSL3_RT_MAX_MD_SIZE 64 + +/* + * Maximum block size used in all ciphersuites. Currently 16 for AES. + */ + +# define SSL_RT_MAX_CIPHER_BLOCK_SIZE 16 + +# define SSL3_RT_MAX_EXTRA (16384) + +/* Maximum plaintext length: defined by SSL/TLS standards */ +# define SSL3_RT_MAX_PLAIN_LENGTH 16384 +/* Maximum compression overhead: defined by SSL/TLS standards */ +# define SSL3_RT_MAX_COMPRESSED_OVERHEAD 1024 + +/* + * The standards give a maximum encryption overhead of 1024 bytes. In + * practice the value is lower than this. The overhead is the maximum number + * of padding bytes (256) plus the mac size. + */ +# define SSL3_RT_MAX_ENCRYPTED_OVERHEAD (256 + SSL3_RT_MAX_MD_SIZE) +# define SSL3_RT_MAX_TLS13_ENCRYPTED_OVERHEAD 256 + +/* + * OpenSSL currently only uses a padding length of at most one block so the + * send overhead is smaller. + */ + +# define SSL3_RT_SEND_MAX_ENCRYPTED_OVERHEAD \ + (SSL_RT_MAX_CIPHER_BLOCK_SIZE + SSL3_RT_MAX_MD_SIZE) + +/* If compression isn't used don't include the compression overhead */ + +# ifdef OPENSSL_NO_COMP +# define SSL3_RT_MAX_COMPRESSED_LENGTH SSL3_RT_MAX_PLAIN_LENGTH +# else +# define SSL3_RT_MAX_COMPRESSED_LENGTH \ + (SSL3_RT_MAX_PLAIN_LENGTH+SSL3_RT_MAX_COMPRESSED_OVERHEAD) +# endif +# define SSL3_RT_MAX_ENCRYPTED_LENGTH \ + (SSL3_RT_MAX_ENCRYPTED_OVERHEAD+SSL3_RT_MAX_COMPRESSED_LENGTH) +# define SSL3_RT_MAX_TLS13_ENCRYPTED_LENGTH \ + (SSL3_RT_MAX_PLAIN_LENGTH + SSL3_RT_MAX_TLS13_ENCRYPTED_OVERHEAD) +# define SSL3_RT_MAX_PACKET_SIZE \ + (SSL3_RT_MAX_ENCRYPTED_LENGTH+SSL3_RT_HEADER_LENGTH) + +# define SSL3_MD_CLIENT_FINISHED_CONST "\x43\x4C\x4E\x54" +# define SSL3_MD_SERVER_FINISHED_CONST "\x53\x52\x56\x52" + +# define SSL3_VERSION 0x0300 +# define SSL3_VERSION_MAJOR 0x03 +# define SSL3_VERSION_MINOR 0x00 + +# define SSL3_RT_CHANGE_CIPHER_SPEC 20 +# define SSL3_RT_ALERT 21 +# define SSL3_RT_HANDSHAKE 22 +# define SSL3_RT_APPLICATION_DATA 23 +# define DTLS1_RT_HEARTBEAT 24 + +/* Pseudo content types to indicate additional parameters */ +# define TLS1_RT_CRYPTO 0x1000 +# define TLS1_RT_CRYPTO_PREMASTER (TLS1_RT_CRYPTO | 0x1) +# define TLS1_RT_CRYPTO_CLIENT_RANDOM (TLS1_RT_CRYPTO | 0x2) +# define TLS1_RT_CRYPTO_SERVER_RANDOM (TLS1_RT_CRYPTO | 0x3) +# define TLS1_RT_CRYPTO_MASTER (TLS1_RT_CRYPTO | 0x4) + +# define TLS1_RT_CRYPTO_READ 0x0000 +# define TLS1_RT_CRYPTO_WRITE 0x0100 +# define TLS1_RT_CRYPTO_MAC (TLS1_RT_CRYPTO | 0x5) +# define TLS1_RT_CRYPTO_KEY (TLS1_RT_CRYPTO | 0x6) +# define TLS1_RT_CRYPTO_IV (TLS1_RT_CRYPTO | 0x7) +# define TLS1_RT_CRYPTO_FIXED_IV (TLS1_RT_CRYPTO | 0x8) + +/* Pseudo content types for SSL/TLS header info */ +# define SSL3_RT_HEADER 0x100 +# define SSL3_RT_INNER_CONTENT_TYPE 0x101 + +# define SSL3_AL_WARNING 1 +# define SSL3_AL_FATAL 2 + +# define SSL3_AD_CLOSE_NOTIFY 0 +# define SSL3_AD_UNEXPECTED_MESSAGE 10/* fatal */ +# define SSL3_AD_BAD_RECORD_MAC 20/* fatal */ +# define SSL3_AD_DECOMPRESSION_FAILURE 30/* fatal */ +# define SSL3_AD_HANDSHAKE_FAILURE 40/* fatal */ +# define SSL3_AD_NO_CERTIFICATE 41 +# define SSL3_AD_BAD_CERTIFICATE 42 +# define SSL3_AD_UNSUPPORTED_CERTIFICATE 43 +# define SSL3_AD_CERTIFICATE_REVOKED 44 +# define SSL3_AD_CERTIFICATE_EXPIRED 45 +# define SSL3_AD_CERTIFICATE_UNKNOWN 46 +# define SSL3_AD_ILLEGAL_PARAMETER 47/* fatal */ + +# define TLS1_HB_REQUEST 1 +# define TLS1_HB_RESPONSE 2 + + +# define SSL3_CT_RSA_SIGN 1 +# define SSL3_CT_DSS_SIGN 2 +# define SSL3_CT_RSA_FIXED_DH 3 +# define SSL3_CT_DSS_FIXED_DH 4 +# define SSL3_CT_RSA_EPHEMERAL_DH 5 +# define SSL3_CT_DSS_EPHEMERAL_DH 6 +# define SSL3_CT_FORTEZZA_DMS 20 +/* + * SSL3_CT_NUMBER is used to size arrays and it must be large enough to + * contain all of the cert types defined for *either* SSLv3 and TLSv1. + */ +# define SSL3_CT_NUMBER 10 + +# if defined(TLS_CT_NUMBER) +# if TLS_CT_NUMBER != SSL3_CT_NUMBER +# error "SSL/TLS CT_NUMBER values do not match" +# endif +# endif + +/* No longer used as of OpenSSL 1.1.1 */ +# define SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS 0x0001 + +/* Removed from OpenSSL 1.1.0 */ +# define TLS1_FLAGS_TLS_PADDING_BUG 0x0 + +# define TLS1_FLAGS_SKIP_CERT_VERIFY 0x0010 + +/* Set if we encrypt then mac instead of usual mac then encrypt */ +# define TLS1_FLAGS_ENCRYPT_THEN_MAC_READ 0x0100 +# define TLS1_FLAGS_ENCRYPT_THEN_MAC TLS1_FLAGS_ENCRYPT_THEN_MAC_READ + +/* Set if extended master secret extension received from peer */ +# define TLS1_FLAGS_RECEIVED_EXTMS 0x0200 + +# define TLS1_FLAGS_ENCRYPT_THEN_MAC_WRITE 0x0400 + +# define TLS1_FLAGS_STATELESS 0x0800 + +# define SSL3_MT_HELLO_REQUEST 0 +# define SSL3_MT_CLIENT_HELLO 1 +# define SSL3_MT_SERVER_HELLO 2 +# define SSL3_MT_NEWSESSION_TICKET 4 +# define SSL3_MT_END_OF_EARLY_DATA 5 +# define SSL3_MT_ENCRYPTED_EXTENSIONS 8 +# define SSL3_MT_CERTIFICATE 11 +# define SSL3_MT_SERVER_KEY_EXCHANGE 12 +# define SSL3_MT_CERTIFICATE_REQUEST 13 +# define SSL3_MT_SERVER_DONE 14 +# define SSL3_MT_CERTIFICATE_VERIFY 15 +# define SSL3_MT_CLIENT_KEY_EXCHANGE 16 +# define SSL3_MT_FINISHED 20 +# define SSL3_MT_CERTIFICATE_URL 21 +# define SSL3_MT_CERTIFICATE_STATUS 22 +# define SSL3_MT_SUPPLEMENTAL_DATA 23 +# define SSL3_MT_KEY_UPDATE 24 +# ifndef OPENSSL_NO_NEXTPROTONEG +# define SSL3_MT_NEXT_PROTO 67 +# endif +# define SSL3_MT_MESSAGE_HASH 254 +# define DTLS1_MT_HELLO_VERIFY_REQUEST 3 + +/* Dummy message type for handling CCS like a normal handshake message */ +# define SSL3_MT_CHANGE_CIPHER_SPEC 0x0101 + +# define SSL3_MT_CCS 1 + +/* These are used when changing over to a new cipher */ +# define SSL3_CC_READ 0x001 +# define SSL3_CC_WRITE 0x002 +# define SSL3_CC_CLIENT 0x010 +# define SSL3_CC_SERVER 0x020 +# define SSL3_CC_EARLY 0x040 +# define SSL3_CC_HANDSHAKE 0x080 +# define SSL3_CC_APPLICATION 0x100 +# define SSL3_CHANGE_CIPHER_CLIENT_WRITE (SSL3_CC_CLIENT|SSL3_CC_WRITE) +# define SSL3_CHANGE_CIPHER_SERVER_READ (SSL3_CC_SERVER|SSL3_CC_READ) +# define SSL3_CHANGE_CIPHER_CLIENT_READ (SSL3_CC_CLIENT|SSL3_CC_READ) +# define SSL3_CHANGE_CIPHER_SERVER_WRITE (SSL3_CC_SERVER|SSL3_CC_WRITE) + +#ifdef __cplusplus +} +#endif +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/sslerr.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/sslerr.h new file mode 100644 index 0000000..82983d3 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/sslerr.h @@ -0,0 +1,773 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_SSLERR_H +# define HEADER_SSLERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_SSL_strings(void); + +/* + * SSL function codes. + */ +# define SSL_F_ADD_CLIENT_KEY_SHARE_EXT 438 +# define SSL_F_ADD_KEY_SHARE 512 +# define SSL_F_BYTES_TO_CIPHER_LIST 519 +# define SSL_F_CHECK_SUITEB_CIPHER_LIST 331 +# define SSL_F_CIPHERSUITE_CB 622 +# define SSL_F_CONSTRUCT_CA_NAMES 552 +# define SSL_F_CONSTRUCT_KEY_EXCHANGE_TBS 553 +# define SSL_F_CONSTRUCT_STATEFUL_TICKET 636 +# define SSL_F_CONSTRUCT_STATELESS_TICKET 637 +# define SSL_F_CREATE_SYNTHETIC_MESSAGE_HASH 539 +# define SSL_F_CREATE_TICKET_PREQUEL 638 +# define SSL_F_CT_MOVE_SCTS 345 +# define SSL_F_CT_STRICT 349 +# define SSL_F_CUSTOM_EXT_ADD 554 +# define SSL_F_CUSTOM_EXT_PARSE 555 +# define SSL_F_D2I_SSL_SESSION 103 +# define SSL_F_DANE_CTX_ENABLE 347 +# define SSL_F_DANE_MTYPE_SET 393 +# define SSL_F_DANE_TLSA_ADD 394 +# define SSL_F_DERIVE_SECRET_KEY_AND_IV 514 +# define SSL_F_DO_DTLS1_WRITE 245 +# define SSL_F_DO_SSL3_WRITE 104 +# define SSL_F_DTLS1_BUFFER_RECORD 247 +# define SSL_F_DTLS1_CHECK_TIMEOUT_NUM 318 +# define SSL_F_DTLS1_HEARTBEAT 305 +# define SSL_F_DTLS1_HM_FRAGMENT_NEW 623 +# define SSL_F_DTLS1_PREPROCESS_FRAGMENT 288 +# define SSL_F_DTLS1_PROCESS_BUFFERED_RECORDS 424 +# define SSL_F_DTLS1_PROCESS_RECORD 257 +# define SSL_F_DTLS1_READ_BYTES 258 +# define SSL_F_DTLS1_READ_FAILED 339 +# define SSL_F_DTLS1_RETRANSMIT_MESSAGE 390 +# define SSL_F_DTLS1_WRITE_APP_DATA_BYTES 268 +# define SSL_F_DTLS1_WRITE_BYTES 545 +# define SSL_F_DTLSV1_LISTEN 350 +# define SSL_F_DTLS_CONSTRUCT_CHANGE_CIPHER_SPEC 371 +# define SSL_F_DTLS_CONSTRUCT_HELLO_VERIFY_REQUEST 385 +# define SSL_F_DTLS_GET_REASSEMBLED_MESSAGE 370 +# define SSL_F_DTLS_PROCESS_HELLO_VERIFY 386 +# define SSL_F_DTLS_RECORD_LAYER_NEW 635 +# define SSL_F_DTLS_WAIT_FOR_DRY 592 +# define SSL_F_EARLY_DATA_COUNT_OK 532 +# define SSL_F_FINAL_EARLY_DATA 556 +# define SSL_F_FINAL_EC_PT_FORMATS 485 +# define SSL_F_FINAL_EMS 486 +# define SSL_F_FINAL_KEY_SHARE 503 +# define SSL_F_FINAL_MAXFRAGMENTLEN 557 +# define SSL_F_FINAL_RENEGOTIATE 483 +# define SSL_F_FINAL_SERVER_NAME 558 +# define SSL_F_FINAL_SIG_ALGS 497 +# define SSL_F_GET_CERT_VERIFY_TBS_DATA 588 +# define SSL_F_NSS_KEYLOG_INT 500 +# define SSL_F_OPENSSL_INIT_SSL 342 +# define SSL_F_OSSL_STATEM_CLIENT13_READ_TRANSITION 436 +# define SSL_F_OSSL_STATEM_CLIENT13_WRITE_TRANSITION 598 +# define SSL_F_OSSL_STATEM_CLIENT_CONSTRUCT_MESSAGE 430 +# define SSL_F_OSSL_STATEM_CLIENT_POST_PROCESS_MESSAGE 593 +# define SSL_F_OSSL_STATEM_CLIENT_PROCESS_MESSAGE 594 +# define SSL_F_OSSL_STATEM_CLIENT_READ_TRANSITION 417 +# define SSL_F_OSSL_STATEM_CLIENT_WRITE_TRANSITION 599 +# define SSL_F_OSSL_STATEM_SERVER13_READ_TRANSITION 437 +# define SSL_F_OSSL_STATEM_SERVER13_WRITE_TRANSITION 600 +# define SSL_F_OSSL_STATEM_SERVER_CONSTRUCT_MESSAGE 431 +# define SSL_F_OSSL_STATEM_SERVER_POST_PROCESS_MESSAGE 601 +# define SSL_F_OSSL_STATEM_SERVER_POST_WORK 602 +# define SSL_F_OSSL_STATEM_SERVER_PRE_WORK 640 +# define SSL_F_OSSL_STATEM_SERVER_PROCESS_MESSAGE 603 +# define SSL_F_OSSL_STATEM_SERVER_READ_TRANSITION 418 +# define SSL_F_OSSL_STATEM_SERVER_WRITE_TRANSITION 604 +# define SSL_F_PARSE_CA_NAMES 541 +# define SSL_F_PITEM_NEW 624 +# define SSL_F_PQUEUE_NEW 625 +# define SSL_F_PROCESS_KEY_SHARE_EXT 439 +# define SSL_F_READ_STATE_MACHINE 352 +# define SSL_F_SET_CLIENT_CIPHERSUITE 540 +# define SSL_F_SRP_GENERATE_CLIENT_MASTER_SECRET 595 +# define SSL_F_SRP_GENERATE_SERVER_MASTER_SECRET 589 +# define SSL_F_SRP_VERIFY_SERVER_PARAM 596 +# define SSL_F_SSL3_CHANGE_CIPHER_STATE 129 +# define SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM 130 +# define SSL_F_SSL3_CTRL 213 +# define SSL_F_SSL3_CTX_CTRL 133 +# define SSL_F_SSL3_DIGEST_CACHED_RECORDS 293 +# define SSL_F_SSL3_DO_CHANGE_CIPHER_SPEC 292 +# define SSL_F_SSL3_ENC 608 +# define SSL_F_SSL3_FINAL_FINISH_MAC 285 +# define SSL_F_SSL3_FINISH_MAC 587 +# define SSL_F_SSL3_GENERATE_KEY_BLOCK 238 +# define SSL_F_SSL3_GENERATE_MASTER_SECRET 388 +# define SSL_F_SSL3_GET_RECORD 143 +# define SSL_F_SSL3_INIT_FINISHED_MAC 397 +# define SSL_F_SSL3_OUTPUT_CERT_CHAIN 147 +# define SSL_F_SSL3_READ_BYTES 148 +# define SSL_F_SSL3_READ_N 149 +# define SSL_F_SSL3_SETUP_KEY_BLOCK 157 +# define SSL_F_SSL3_SETUP_READ_BUFFER 156 +# define SSL_F_SSL3_SETUP_WRITE_BUFFER 291 +# define SSL_F_SSL3_WRITE_BYTES 158 +# define SSL_F_SSL3_WRITE_PENDING 159 +# define SSL_F_SSL_ADD_CERT_CHAIN 316 +# define SSL_F_SSL_ADD_CERT_TO_BUF 319 +# define SSL_F_SSL_ADD_CERT_TO_WPACKET 493 +# define SSL_F_SSL_ADD_CLIENTHELLO_RENEGOTIATE_EXT 298 +# define SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT 277 +# define SSL_F_SSL_ADD_CLIENTHELLO_USE_SRTP_EXT 307 +# define SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK 215 +# define SSL_F_SSL_ADD_FILE_CERT_SUBJECTS_TO_STACK 216 +# define SSL_F_SSL_ADD_SERVERHELLO_RENEGOTIATE_EXT 299 +# define SSL_F_SSL_ADD_SERVERHELLO_TLSEXT 278 +# define SSL_F_SSL_ADD_SERVERHELLO_USE_SRTP_EXT 308 +# define SSL_F_SSL_BAD_METHOD 160 +# define SSL_F_SSL_BUILD_CERT_CHAIN 332 +# define SSL_F_SSL_BYTES_TO_CIPHER_LIST 161 +# define SSL_F_SSL_CACHE_CIPHERLIST 520 +# define SSL_F_SSL_CERT_ADD0_CHAIN_CERT 346 +# define SSL_F_SSL_CERT_DUP 221 +# define SSL_F_SSL_CERT_NEW 162 +# define SSL_F_SSL_CERT_SET0_CHAIN 340 +# define SSL_F_SSL_CHECK_PRIVATE_KEY 163 +# define SSL_F_SSL_CHECK_SERVERHELLO_TLSEXT 280 +# define SSL_F_SSL_CHECK_SRP_EXT_CLIENTHELLO 606 +# define SSL_F_SSL_CHECK_SRVR_ECC_CERT_AND_ALG 279 +# define SSL_F_SSL_CHOOSE_CLIENT_VERSION 607 +# define SSL_F_SSL_CIPHER_DESCRIPTION 626 +# define SSL_F_SSL_CIPHER_LIST_TO_BYTES 425 +# define SSL_F_SSL_CIPHER_PROCESS_RULESTR 230 +# define SSL_F_SSL_CIPHER_STRENGTH_SORT 231 +# define SSL_F_SSL_CLEAR 164 +# define SSL_F_SSL_CLIENT_HELLO_GET1_EXTENSIONS_PRESENT 627 +# define SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD 165 +# define SSL_F_SSL_CONF_CMD 334 +# define SSL_F_SSL_CREATE_CIPHER_LIST 166 +# define SSL_F_SSL_CTRL 232 +# define SSL_F_SSL_CTX_CHECK_PRIVATE_KEY 168 +# define SSL_F_SSL_CTX_ENABLE_CT 398 +# define SSL_F_SSL_CTX_MAKE_PROFILES 309 +# define SSL_F_SSL_CTX_NEW 169 +# define SSL_F_SSL_CTX_SET_ALPN_PROTOS 343 +# define SSL_F_SSL_CTX_SET_CIPHER_LIST 269 +# define SSL_F_SSL_CTX_SET_CLIENT_CERT_ENGINE 290 +# define SSL_F_SSL_CTX_SET_CT_VALIDATION_CALLBACK 396 +# define SSL_F_SSL_CTX_SET_SESSION_ID_CONTEXT 219 +# define SSL_F_SSL_CTX_SET_SSL_VERSION 170 +# define SSL_F_SSL_CTX_SET_TLSEXT_MAX_FRAGMENT_LENGTH 551 +# define SSL_F_SSL_CTX_USE_CERTIFICATE 171 +# define SSL_F_SSL_CTX_USE_CERTIFICATE_ASN1 172 +# define SSL_F_SSL_CTX_USE_CERTIFICATE_FILE 173 +# define SSL_F_SSL_CTX_USE_PRIVATEKEY 174 +# define SSL_F_SSL_CTX_USE_PRIVATEKEY_ASN1 175 +# define SSL_F_SSL_CTX_USE_PRIVATEKEY_FILE 176 +# define SSL_F_SSL_CTX_USE_PSK_IDENTITY_HINT 272 +# define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY 177 +# define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY_ASN1 178 +# define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY_FILE 179 +# define SSL_F_SSL_CTX_USE_SERVERINFO 336 +# define SSL_F_SSL_CTX_USE_SERVERINFO_EX 543 +# define SSL_F_SSL_CTX_USE_SERVERINFO_FILE 337 +# define SSL_F_SSL_DANE_DUP 403 +# define SSL_F_SSL_DANE_ENABLE 395 +# define SSL_F_SSL_DERIVE 590 +# define SSL_F_SSL_DO_CONFIG 391 +# define SSL_F_SSL_DO_HANDSHAKE 180 +# define SSL_F_SSL_DUP_CA_LIST 408 +# define SSL_F_SSL_ENABLE_CT 402 +# define SSL_F_SSL_GENERATE_PKEY_GROUP 559 +# define SSL_F_SSL_GENERATE_SESSION_ID 547 +# define SSL_F_SSL_GET_NEW_SESSION 181 +# define SSL_F_SSL_GET_PREV_SESSION 217 +# define SSL_F_SSL_GET_SERVER_CERT_INDEX 322 +# define SSL_F_SSL_GET_SIGN_PKEY 183 +# define SSL_F_SSL_HANDSHAKE_HASH 560 +# define SSL_F_SSL_INIT_WBIO_BUFFER 184 +# define SSL_F_SSL_KEY_UPDATE 515 +# define SSL_F_SSL_LOAD_CLIENT_CA_FILE 185 +# define SSL_F_SSL_LOG_MASTER_SECRET 498 +# define SSL_F_SSL_LOG_RSA_CLIENT_KEY_EXCHANGE 499 +# define SSL_F_SSL_MODULE_INIT 392 +# define SSL_F_SSL_NEW 186 +# define SSL_F_SSL_NEXT_PROTO_VALIDATE 565 +# define SSL_F_SSL_PARSE_CLIENTHELLO_RENEGOTIATE_EXT 300 +# define SSL_F_SSL_PARSE_CLIENTHELLO_TLSEXT 302 +# define SSL_F_SSL_PARSE_CLIENTHELLO_USE_SRTP_EXT 310 +# define SSL_F_SSL_PARSE_SERVERHELLO_RENEGOTIATE_EXT 301 +# define SSL_F_SSL_PARSE_SERVERHELLO_TLSEXT 303 +# define SSL_F_SSL_PARSE_SERVERHELLO_USE_SRTP_EXT 311 +# define SSL_F_SSL_PEEK 270 +# define SSL_F_SSL_PEEK_EX 432 +# define SSL_F_SSL_PEEK_INTERNAL 522 +# define SSL_F_SSL_READ 223 +# define SSL_F_SSL_READ_EARLY_DATA 529 +# define SSL_F_SSL_READ_EX 434 +# define SSL_F_SSL_READ_INTERNAL 523 +# define SSL_F_SSL_RENEGOTIATE 516 +# define SSL_F_SSL_RENEGOTIATE_ABBREVIATED 546 +# define SSL_F_SSL_SCAN_CLIENTHELLO_TLSEXT 320 +# define SSL_F_SSL_SCAN_SERVERHELLO_TLSEXT 321 +# define SSL_F_SSL_SESSION_DUP 348 +# define SSL_F_SSL_SESSION_NEW 189 +# define SSL_F_SSL_SESSION_PRINT_FP 190 +# define SSL_F_SSL_SESSION_SET1_ID 423 +# define SSL_F_SSL_SESSION_SET1_ID_CONTEXT 312 +# define SSL_F_SSL_SET_ALPN_PROTOS 344 +# define SSL_F_SSL_SET_CERT 191 +# define SSL_F_SSL_SET_CERT_AND_KEY 621 +# define SSL_F_SSL_SET_CIPHER_LIST 271 +# define SSL_F_SSL_SET_CT_VALIDATION_CALLBACK 399 +# define SSL_F_SSL_SET_FD 192 +# define SSL_F_SSL_SET_PKEY 193 +# define SSL_F_SSL_SET_RFD 194 +# define SSL_F_SSL_SET_SESSION 195 +# define SSL_F_SSL_SET_SESSION_ID_CONTEXT 218 +# define SSL_F_SSL_SET_SESSION_TICKET_EXT 294 +# define SSL_F_SSL_SET_TLSEXT_MAX_FRAGMENT_LENGTH 550 +# define SSL_F_SSL_SET_WFD 196 +# define SSL_F_SSL_SHUTDOWN 224 +# define SSL_F_SSL_SRP_CTX_INIT 313 +# define SSL_F_SSL_START_ASYNC_JOB 389 +# define SSL_F_SSL_UNDEFINED_FUNCTION 197 +# define SSL_F_SSL_UNDEFINED_VOID_FUNCTION 244 +# define SSL_F_SSL_USE_CERTIFICATE 198 +# define SSL_F_SSL_USE_CERTIFICATE_ASN1 199 +# define SSL_F_SSL_USE_CERTIFICATE_FILE 200 +# define SSL_F_SSL_USE_PRIVATEKEY 201 +# define SSL_F_SSL_USE_PRIVATEKEY_ASN1 202 +# define SSL_F_SSL_USE_PRIVATEKEY_FILE 203 +# define SSL_F_SSL_USE_PSK_IDENTITY_HINT 273 +# define SSL_F_SSL_USE_RSAPRIVATEKEY 204 +# define SSL_F_SSL_USE_RSAPRIVATEKEY_ASN1 205 +# define SSL_F_SSL_USE_RSAPRIVATEKEY_FILE 206 +# define SSL_F_SSL_VALIDATE_CT 400 +# define SSL_F_SSL_VERIFY_CERT_CHAIN 207 +# define SSL_F_SSL_VERIFY_CLIENT_POST_HANDSHAKE 616 +# define SSL_F_SSL_WRITE 208 +# define SSL_F_SSL_WRITE_EARLY_DATA 526 +# define SSL_F_SSL_WRITE_EARLY_FINISH 527 +# define SSL_F_SSL_WRITE_EX 433 +# define SSL_F_SSL_WRITE_INTERNAL 524 +# define SSL_F_STATE_MACHINE 353 +# define SSL_F_TLS12_CHECK_PEER_SIGALG 333 +# define SSL_F_TLS12_COPY_SIGALGS 533 +# define SSL_F_TLS13_CHANGE_CIPHER_STATE 440 +# define SSL_F_TLS13_ENC 609 +# define SSL_F_TLS13_FINAL_FINISH_MAC 605 +# define SSL_F_TLS13_GENERATE_SECRET 591 +# define SSL_F_TLS13_HKDF_EXPAND 561 +# define SSL_F_TLS13_RESTORE_HANDSHAKE_DIGEST_FOR_PHA 617 +# define SSL_F_TLS13_SAVE_HANDSHAKE_DIGEST_FOR_PHA 618 +# define SSL_F_TLS13_SETUP_KEY_BLOCK 441 +# define SSL_F_TLS1_CHANGE_CIPHER_STATE 209 +# define SSL_F_TLS1_CHECK_DUPLICATE_EXTENSIONS 341 +# define SSL_F_TLS1_ENC 401 +# define SSL_F_TLS1_EXPORT_KEYING_MATERIAL 314 +# define SSL_F_TLS1_GET_CURVELIST 338 +# define SSL_F_TLS1_PRF 284 +# define SSL_F_TLS1_SAVE_U16 628 +# define SSL_F_TLS1_SETUP_KEY_BLOCK 211 +# define SSL_F_TLS1_SET_GROUPS 629 +# define SSL_F_TLS1_SET_RAW_SIGALGS 630 +# define SSL_F_TLS1_SET_SERVER_SIGALGS 335 +# define SSL_F_TLS1_SET_SHARED_SIGALGS 631 +# define SSL_F_TLS1_SET_SIGALGS 632 +# define SSL_F_TLS_CHOOSE_SIGALG 513 +# define SSL_F_TLS_CLIENT_KEY_EXCHANGE_POST_WORK 354 +# define SSL_F_TLS_COLLECT_EXTENSIONS 435 +# define SSL_F_TLS_CONSTRUCT_CERTIFICATE_AUTHORITIES 542 +# define SSL_F_TLS_CONSTRUCT_CERTIFICATE_REQUEST 372 +# define SSL_F_TLS_CONSTRUCT_CERT_STATUS 429 +# define SSL_F_TLS_CONSTRUCT_CERT_STATUS_BODY 494 +# define SSL_F_TLS_CONSTRUCT_CERT_VERIFY 496 +# define SSL_F_TLS_CONSTRUCT_CHANGE_CIPHER_SPEC 427 +# define SSL_F_TLS_CONSTRUCT_CKE_DHE 404 +# define SSL_F_TLS_CONSTRUCT_CKE_ECDHE 405 +# define SSL_F_TLS_CONSTRUCT_CKE_GOST 406 +# define SSL_F_TLS_CONSTRUCT_CKE_PSK_PREAMBLE 407 +# define SSL_F_TLS_CONSTRUCT_CKE_RSA 409 +# define SSL_F_TLS_CONSTRUCT_CKE_SRP 410 +# define SSL_F_TLS_CONSTRUCT_CLIENT_CERTIFICATE 484 +# define SSL_F_TLS_CONSTRUCT_CLIENT_HELLO 487 +# define SSL_F_TLS_CONSTRUCT_CLIENT_KEY_EXCHANGE 488 +# define SSL_F_TLS_CONSTRUCT_CLIENT_VERIFY 489 +# define SSL_F_TLS_CONSTRUCT_CTOS_ALPN 466 +# define SSL_F_TLS_CONSTRUCT_CTOS_CERTIFICATE 355 +# define SSL_F_TLS_CONSTRUCT_CTOS_COOKIE 535 +# define SSL_F_TLS_CONSTRUCT_CTOS_EARLY_DATA 530 +# define SSL_F_TLS_CONSTRUCT_CTOS_EC_PT_FORMATS 467 +# define SSL_F_TLS_CONSTRUCT_CTOS_EMS 468 +# define SSL_F_TLS_CONSTRUCT_CTOS_ETM 469 +# define SSL_F_TLS_CONSTRUCT_CTOS_HELLO 356 +# define SSL_F_TLS_CONSTRUCT_CTOS_KEY_EXCHANGE 357 +# define SSL_F_TLS_CONSTRUCT_CTOS_KEY_SHARE 470 +# define SSL_F_TLS_CONSTRUCT_CTOS_MAXFRAGMENTLEN 549 +# define SSL_F_TLS_CONSTRUCT_CTOS_NPN 471 +# define SSL_F_TLS_CONSTRUCT_CTOS_PADDING 472 +# define SSL_F_TLS_CONSTRUCT_CTOS_POST_HANDSHAKE_AUTH 619 +# define SSL_F_TLS_CONSTRUCT_CTOS_PSK 501 +# define SSL_F_TLS_CONSTRUCT_CTOS_PSK_KEX_MODES 509 +# define SSL_F_TLS_CONSTRUCT_CTOS_RENEGOTIATE 473 +# define SSL_F_TLS_CONSTRUCT_CTOS_SCT 474 +# define SSL_F_TLS_CONSTRUCT_CTOS_SERVER_NAME 475 +# define SSL_F_TLS_CONSTRUCT_CTOS_SESSION_TICKET 476 +# define SSL_F_TLS_CONSTRUCT_CTOS_SIG_ALGS 477 +# define SSL_F_TLS_CONSTRUCT_CTOS_SRP 478 +# define SSL_F_TLS_CONSTRUCT_CTOS_STATUS_REQUEST 479 +# define SSL_F_TLS_CONSTRUCT_CTOS_SUPPORTED_GROUPS 480 +# define SSL_F_TLS_CONSTRUCT_CTOS_SUPPORTED_VERSIONS 481 +# define SSL_F_TLS_CONSTRUCT_CTOS_USE_SRTP 482 +# define SSL_F_TLS_CONSTRUCT_CTOS_VERIFY 358 +# define SSL_F_TLS_CONSTRUCT_ENCRYPTED_EXTENSIONS 443 +# define SSL_F_TLS_CONSTRUCT_END_OF_EARLY_DATA 536 +# define SSL_F_TLS_CONSTRUCT_EXTENSIONS 447 +# define SSL_F_TLS_CONSTRUCT_FINISHED 359 +# define SSL_F_TLS_CONSTRUCT_HELLO_REQUEST 373 +# define SSL_F_TLS_CONSTRUCT_HELLO_RETRY_REQUEST 510 +# define SSL_F_TLS_CONSTRUCT_KEY_UPDATE 517 +# define SSL_F_TLS_CONSTRUCT_NEW_SESSION_TICKET 428 +# define SSL_F_TLS_CONSTRUCT_NEXT_PROTO 426 +# define SSL_F_TLS_CONSTRUCT_SERVER_CERTIFICATE 490 +# define SSL_F_TLS_CONSTRUCT_SERVER_HELLO 491 +# define SSL_F_TLS_CONSTRUCT_SERVER_KEY_EXCHANGE 492 +# define SSL_F_TLS_CONSTRUCT_STOC_ALPN 451 +# define SSL_F_TLS_CONSTRUCT_STOC_CERTIFICATE 374 +# define SSL_F_TLS_CONSTRUCT_STOC_COOKIE 613 +# define SSL_F_TLS_CONSTRUCT_STOC_CRYPTOPRO_BUG 452 +# define SSL_F_TLS_CONSTRUCT_STOC_DONE 375 +# define SSL_F_TLS_CONSTRUCT_STOC_EARLY_DATA 531 +# define SSL_F_TLS_CONSTRUCT_STOC_EARLY_DATA_INFO 525 +# define SSL_F_TLS_CONSTRUCT_STOC_EC_PT_FORMATS 453 +# define SSL_F_TLS_CONSTRUCT_STOC_EMS 454 +# define SSL_F_TLS_CONSTRUCT_STOC_ETM 455 +# define SSL_F_TLS_CONSTRUCT_STOC_HELLO 376 +# define SSL_F_TLS_CONSTRUCT_STOC_KEY_EXCHANGE 377 +# define SSL_F_TLS_CONSTRUCT_STOC_KEY_SHARE 456 +# define SSL_F_TLS_CONSTRUCT_STOC_MAXFRAGMENTLEN 548 +# define SSL_F_TLS_CONSTRUCT_STOC_NEXT_PROTO_NEG 457 +# define SSL_F_TLS_CONSTRUCT_STOC_PSK 504 +# define SSL_F_TLS_CONSTRUCT_STOC_RENEGOTIATE 458 +# define SSL_F_TLS_CONSTRUCT_STOC_SERVER_NAME 459 +# define SSL_F_TLS_CONSTRUCT_STOC_SESSION_TICKET 460 +# define SSL_F_TLS_CONSTRUCT_STOC_STATUS_REQUEST 461 +# define SSL_F_TLS_CONSTRUCT_STOC_SUPPORTED_GROUPS 544 +# define SSL_F_TLS_CONSTRUCT_STOC_SUPPORTED_VERSIONS 611 +# define SSL_F_TLS_CONSTRUCT_STOC_USE_SRTP 462 +# define SSL_F_TLS_EARLY_POST_PROCESS_CLIENT_HELLO 521 +# define SSL_F_TLS_FINISH_HANDSHAKE 597 +# define SSL_F_TLS_GET_MESSAGE_BODY 351 +# define SSL_F_TLS_GET_MESSAGE_HEADER 387 +# define SSL_F_TLS_HANDLE_ALPN 562 +# define SSL_F_TLS_HANDLE_STATUS_REQUEST 563 +# define SSL_F_TLS_PARSE_CERTIFICATE_AUTHORITIES 566 +# define SSL_F_TLS_PARSE_CLIENTHELLO_TLSEXT 449 +# define SSL_F_TLS_PARSE_CTOS_ALPN 567 +# define SSL_F_TLS_PARSE_CTOS_COOKIE 614 +# define SSL_F_TLS_PARSE_CTOS_EARLY_DATA 568 +# define SSL_F_TLS_PARSE_CTOS_EC_PT_FORMATS 569 +# define SSL_F_TLS_PARSE_CTOS_EMS 570 +# define SSL_F_TLS_PARSE_CTOS_KEY_SHARE 463 +# define SSL_F_TLS_PARSE_CTOS_MAXFRAGMENTLEN 571 +# define SSL_F_TLS_PARSE_CTOS_POST_HANDSHAKE_AUTH 620 +# define SSL_F_TLS_PARSE_CTOS_PSK 505 +# define SSL_F_TLS_PARSE_CTOS_PSK_KEX_MODES 572 +# define SSL_F_TLS_PARSE_CTOS_RENEGOTIATE 464 +# define SSL_F_TLS_PARSE_CTOS_SERVER_NAME 573 +# define SSL_F_TLS_PARSE_CTOS_SESSION_TICKET 574 +# define SSL_F_TLS_PARSE_CTOS_SIG_ALGS 575 +# define SSL_F_TLS_PARSE_CTOS_SIG_ALGS_CERT 615 +# define SSL_F_TLS_PARSE_CTOS_SRP 576 +# define SSL_F_TLS_PARSE_CTOS_STATUS_REQUEST 577 +# define SSL_F_TLS_PARSE_CTOS_SUPPORTED_GROUPS 578 +# define SSL_F_TLS_PARSE_CTOS_USE_SRTP 465 +# define SSL_F_TLS_PARSE_STOC_ALPN 579 +# define SSL_F_TLS_PARSE_STOC_COOKIE 534 +# define SSL_F_TLS_PARSE_STOC_EARLY_DATA 538 +# define SSL_F_TLS_PARSE_STOC_EARLY_DATA_INFO 528 +# define SSL_F_TLS_PARSE_STOC_EC_PT_FORMATS 580 +# define SSL_F_TLS_PARSE_STOC_KEY_SHARE 445 +# define SSL_F_TLS_PARSE_STOC_MAXFRAGMENTLEN 581 +# define SSL_F_TLS_PARSE_STOC_NPN 582 +# define SSL_F_TLS_PARSE_STOC_PSK 502 +# define SSL_F_TLS_PARSE_STOC_RENEGOTIATE 448 +# define SSL_F_TLS_PARSE_STOC_SCT 564 +# define SSL_F_TLS_PARSE_STOC_SERVER_NAME 583 +# define SSL_F_TLS_PARSE_STOC_SESSION_TICKET 584 +# define SSL_F_TLS_PARSE_STOC_STATUS_REQUEST 585 +# define SSL_F_TLS_PARSE_STOC_SUPPORTED_VERSIONS 612 +# define SSL_F_TLS_PARSE_STOC_USE_SRTP 446 +# define SSL_F_TLS_POST_PROCESS_CLIENT_HELLO 378 +# define SSL_F_TLS_POST_PROCESS_CLIENT_KEY_EXCHANGE 384 +# define SSL_F_TLS_PREPARE_CLIENT_CERTIFICATE 360 +# define SSL_F_TLS_PROCESS_AS_HELLO_RETRY_REQUEST 610 +# define SSL_F_TLS_PROCESS_CERTIFICATE_REQUEST 361 +# define SSL_F_TLS_PROCESS_CERT_STATUS 362 +# define SSL_F_TLS_PROCESS_CERT_STATUS_BODY 495 +# define SSL_F_TLS_PROCESS_CERT_VERIFY 379 +# define SSL_F_TLS_PROCESS_CHANGE_CIPHER_SPEC 363 +# define SSL_F_TLS_PROCESS_CKE_DHE 411 +# define SSL_F_TLS_PROCESS_CKE_ECDHE 412 +# define SSL_F_TLS_PROCESS_CKE_GOST 413 +# define SSL_F_TLS_PROCESS_CKE_PSK_PREAMBLE 414 +# define SSL_F_TLS_PROCESS_CKE_RSA 415 +# define SSL_F_TLS_PROCESS_CKE_SRP 416 +# define SSL_F_TLS_PROCESS_CLIENT_CERTIFICATE 380 +# define SSL_F_TLS_PROCESS_CLIENT_HELLO 381 +# define SSL_F_TLS_PROCESS_CLIENT_KEY_EXCHANGE 382 +# define SSL_F_TLS_PROCESS_ENCRYPTED_EXTENSIONS 444 +# define SSL_F_TLS_PROCESS_END_OF_EARLY_DATA 537 +# define SSL_F_TLS_PROCESS_FINISHED 364 +# define SSL_F_TLS_PROCESS_HELLO_REQ 507 +# define SSL_F_TLS_PROCESS_HELLO_RETRY_REQUEST 511 +# define SSL_F_TLS_PROCESS_INITIAL_SERVER_FLIGHT 442 +# define SSL_F_TLS_PROCESS_KEY_EXCHANGE 365 +# define SSL_F_TLS_PROCESS_KEY_UPDATE 518 +# define SSL_F_TLS_PROCESS_NEW_SESSION_TICKET 366 +# define SSL_F_TLS_PROCESS_NEXT_PROTO 383 +# define SSL_F_TLS_PROCESS_SERVER_CERTIFICATE 367 +# define SSL_F_TLS_PROCESS_SERVER_DONE 368 +# define SSL_F_TLS_PROCESS_SERVER_HELLO 369 +# define SSL_F_TLS_PROCESS_SKE_DHE 419 +# define SSL_F_TLS_PROCESS_SKE_ECDHE 420 +# define SSL_F_TLS_PROCESS_SKE_PSK_PREAMBLE 421 +# define SSL_F_TLS_PROCESS_SKE_SRP 422 +# define SSL_F_TLS_PSK_DO_BINDER 506 +# define SSL_F_TLS_SCAN_CLIENTHELLO_TLSEXT 450 +# define SSL_F_TLS_SETUP_HANDSHAKE 508 +# define SSL_F_USE_CERTIFICATE_CHAIN_FILE 220 +# define SSL_F_WPACKET_INTERN_INIT_LEN 633 +# define SSL_F_WPACKET_START_SUB_PACKET_LEN__ 634 +# define SSL_F_WRITE_STATE_MACHINE 586 + +/* + * SSL reason codes. + */ +# define SSL_R_APPLICATION_DATA_AFTER_CLOSE_NOTIFY 291 +# define SSL_R_APP_DATA_IN_HANDSHAKE 100 +# define SSL_R_ATTEMPT_TO_REUSE_SESSION_IN_DIFFERENT_CONTEXT 272 +# define SSL_R_AT_LEAST_TLS_1_0_NEEDED_IN_FIPS_MODE 143 +# define SSL_R_AT_LEAST_TLS_1_2_NEEDED_IN_SUITEB_MODE 158 +# define SSL_R_BAD_CHANGE_CIPHER_SPEC 103 +# define SSL_R_BAD_CIPHER 186 +# define SSL_R_BAD_DATA 390 +# define SSL_R_BAD_DATA_RETURNED_BY_CALLBACK 106 +# define SSL_R_BAD_DECOMPRESSION 107 +# define SSL_R_BAD_DH_VALUE 102 +# define SSL_R_BAD_DIGEST_LENGTH 111 +# define SSL_R_BAD_EARLY_DATA 233 +# define SSL_R_BAD_ECC_CERT 304 +# define SSL_R_BAD_ECPOINT 306 +# define SSL_R_BAD_EXTENSION 110 +# define SSL_R_BAD_HANDSHAKE_LENGTH 332 +# define SSL_R_BAD_HANDSHAKE_STATE 236 +# define SSL_R_BAD_HELLO_REQUEST 105 +# define SSL_R_BAD_HRR_VERSION 263 +# define SSL_R_BAD_KEY_SHARE 108 +# define SSL_R_BAD_KEY_UPDATE 122 +# define SSL_R_BAD_LEGACY_VERSION 292 +# define SSL_R_BAD_LENGTH 271 +# define SSL_R_BAD_PACKET 240 +# define SSL_R_BAD_PACKET_LENGTH 115 +# define SSL_R_BAD_PROTOCOL_VERSION_NUMBER 116 +# define SSL_R_BAD_PSK 219 +# define SSL_R_BAD_PSK_IDENTITY 114 +# define SSL_R_BAD_RECORD_TYPE 443 +# define SSL_R_BAD_RSA_ENCRYPT 119 +# define SSL_R_BAD_SIGNATURE 123 +# define SSL_R_BAD_SRP_A_LENGTH 347 +# define SSL_R_BAD_SRP_PARAMETERS 371 +# define SSL_R_BAD_SRTP_MKI_VALUE 352 +# define SSL_R_BAD_SRTP_PROTECTION_PROFILE_LIST 353 +# define SSL_R_BAD_SSL_FILETYPE 124 +# define SSL_R_BAD_VALUE 384 +# define SSL_R_BAD_WRITE_RETRY 127 +# define SSL_R_BINDER_DOES_NOT_VERIFY 253 +# define SSL_R_BIO_NOT_SET 128 +# define SSL_R_BLOCK_CIPHER_PAD_IS_WRONG 129 +# define SSL_R_BN_LIB 130 +# define SSL_R_CALLBACK_FAILED 234 +# define SSL_R_CANNOT_CHANGE_CIPHER 109 +# define SSL_R_CA_DN_LENGTH_MISMATCH 131 +# define SSL_R_CA_KEY_TOO_SMALL 397 +# define SSL_R_CA_MD_TOO_WEAK 398 +# define SSL_R_CCS_RECEIVED_EARLY 133 +# define SSL_R_CERTIFICATE_VERIFY_FAILED 134 +# define SSL_R_CERT_CB_ERROR 377 +# define SSL_R_CERT_LENGTH_MISMATCH 135 +# define SSL_R_CIPHERSUITE_DIGEST_HAS_CHANGED 218 +# define SSL_R_CIPHER_CODE_WRONG_LENGTH 137 +# define SSL_R_CIPHER_OR_HASH_UNAVAILABLE 138 +# define SSL_R_CLIENTHELLO_TLSEXT 226 +# define SSL_R_COMPRESSED_LENGTH_TOO_LONG 140 +# define SSL_R_COMPRESSION_DISABLED 343 +# define SSL_R_COMPRESSION_FAILURE 141 +# define SSL_R_COMPRESSION_ID_NOT_WITHIN_PRIVATE_RANGE 307 +# define SSL_R_COMPRESSION_LIBRARY_ERROR 142 +# define SSL_R_CONNECTION_TYPE_NOT_SET 144 +# define SSL_R_CONTEXT_NOT_DANE_ENABLED 167 +# define SSL_R_COOKIE_GEN_CALLBACK_FAILURE 400 +# define SSL_R_COOKIE_MISMATCH 308 +# define SSL_R_CUSTOM_EXT_HANDLER_ALREADY_INSTALLED 206 +# define SSL_R_DANE_ALREADY_ENABLED 172 +# define SSL_R_DANE_CANNOT_OVERRIDE_MTYPE_FULL 173 +# define SSL_R_DANE_NOT_ENABLED 175 +# define SSL_R_DANE_TLSA_BAD_CERTIFICATE 180 +# define SSL_R_DANE_TLSA_BAD_CERTIFICATE_USAGE 184 +# define SSL_R_DANE_TLSA_BAD_DATA_LENGTH 189 +# define SSL_R_DANE_TLSA_BAD_DIGEST_LENGTH 192 +# define SSL_R_DANE_TLSA_BAD_MATCHING_TYPE 200 +# define SSL_R_DANE_TLSA_BAD_PUBLIC_KEY 201 +# define SSL_R_DANE_TLSA_BAD_SELECTOR 202 +# define SSL_R_DANE_TLSA_NULL_DATA 203 +# define SSL_R_DATA_BETWEEN_CCS_AND_FINISHED 145 +# define SSL_R_DATA_LENGTH_TOO_LONG 146 +# define SSL_R_DECRYPTION_FAILED 147 +# define SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC 281 +# define SSL_R_DH_KEY_TOO_SMALL 394 +# define SSL_R_DH_PUBLIC_VALUE_LENGTH_IS_WRONG 148 +# define SSL_R_DIGEST_CHECK_FAILED 149 +# define SSL_R_DTLS_MESSAGE_TOO_BIG 334 +# define SSL_R_DUPLICATE_COMPRESSION_ID 309 +# define SSL_R_ECC_CERT_NOT_FOR_SIGNING 318 +# define SSL_R_ECDH_REQUIRED_FOR_SUITEB_MODE 374 +# define SSL_R_EE_KEY_TOO_SMALL 399 +# define SSL_R_EMPTY_SRTP_PROTECTION_PROFILE_LIST 354 +# define SSL_R_ENCRYPTED_LENGTH_TOO_LONG 150 +# define SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST 151 +# define SSL_R_ERROR_SETTING_TLSA_BASE_DOMAIN 204 +# define SSL_R_EXCEEDS_MAX_FRAGMENT_SIZE 194 +# define SSL_R_EXCESSIVE_MESSAGE_SIZE 152 +# define SSL_R_EXTENSION_NOT_RECEIVED 279 +# define SSL_R_EXTRA_DATA_IN_MESSAGE 153 +# define SSL_R_EXT_LENGTH_MISMATCH 163 +# define SSL_R_FAILED_TO_INIT_ASYNC 405 +# define SSL_R_FRAGMENTED_CLIENT_HELLO 401 +# define SSL_R_GOT_A_FIN_BEFORE_A_CCS 154 +# define SSL_R_HTTPS_PROXY_REQUEST 155 +# define SSL_R_HTTP_REQUEST 156 +# define SSL_R_ILLEGAL_POINT_COMPRESSION 162 +# define SSL_R_ILLEGAL_SUITEB_DIGEST 380 +# define SSL_R_INAPPROPRIATE_FALLBACK 373 +# define SSL_R_INCONSISTENT_COMPRESSION 340 +# define SSL_R_INCONSISTENT_EARLY_DATA_ALPN 222 +# define SSL_R_INCONSISTENT_EARLY_DATA_SNI 231 +# define SSL_R_INCONSISTENT_EXTMS 104 +# define SSL_R_INSUFFICIENT_SECURITY 241 +# define SSL_R_INVALID_ALERT 205 +# define SSL_R_INVALID_CCS_MESSAGE 260 +# define SSL_R_INVALID_CERTIFICATE_OR_ALG 238 +# define SSL_R_INVALID_COMMAND 280 +# define SSL_R_INVALID_COMPRESSION_ALGORITHM 341 +# define SSL_R_INVALID_CONFIG 283 +# define SSL_R_INVALID_CONFIGURATION_NAME 113 +# define SSL_R_INVALID_CONTEXT 282 +# define SSL_R_INVALID_CT_VALIDATION_TYPE 212 +# define SSL_R_INVALID_KEY_UPDATE_TYPE 120 +# define SSL_R_INVALID_MAX_EARLY_DATA 174 +# define SSL_R_INVALID_NULL_CMD_NAME 385 +# define SSL_R_INVALID_SEQUENCE_NUMBER 402 +# define SSL_R_INVALID_SERVERINFO_DATA 388 +# define SSL_R_INVALID_SESSION_ID 999 +# define SSL_R_INVALID_SRP_USERNAME 357 +# define SSL_R_INVALID_STATUS_RESPONSE 328 +# define SSL_R_INVALID_TICKET_KEYS_LENGTH 325 +# define SSL_R_LENGTH_MISMATCH 159 +# define SSL_R_LENGTH_TOO_LONG 404 +# define SSL_R_LENGTH_TOO_SHORT 160 +# define SSL_R_LIBRARY_BUG 274 +# define SSL_R_LIBRARY_HAS_NO_CIPHERS 161 +# define SSL_R_MISSING_DSA_SIGNING_CERT 165 +# define SSL_R_MISSING_ECDSA_SIGNING_CERT 381 +# define SSL_R_MISSING_FATAL 256 +# define SSL_R_MISSING_PARAMETERS 290 +# define SSL_R_MISSING_RSA_CERTIFICATE 168 +# define SSL_R_MISSING_RSA_ENCRYPTING_CERT 169 +# define SSL_R_MISSING_RSA_SIGNING_CERT 170 +# define SSL_R_MISSING_SIGALGS_EXTENSION 112 +# define SSL_R_MISSING_SIGNING_CERT 221 +# define SSL_R_MISSING_SRP_PARAM 358 +# define SSL_R_MISSING_SUPPORTED_GROUPS_EXTENSION 209 +# define SSL_R_MISSING_TMP_DH_KEY 171 +# define SSL_R_MISSING_TMP_ECDH_KEY 311 +# define SSL_R_MIXED_HANDSHAKE_AND_NON_HANDSHAKE_DATA 293 +# define SSL_R_NOT_ON_RECORD_BOUNDARY 182 +# define SSL_R_NOT_REPLACING_CERTIFICATE 289 +# define SSL_R_NOT_SERVER 284 +# define SSL_R_NO_APPLICATION_PROTOCOL 235 +# define SSL_R_NO_CERTIFICATES_RETURNED 176 +# define SSL_R_NO_CERTIFICATE_ASSIGNED 177 +# define SSL_R_NO_CERTIFICATE_SET 179 +# define SSL_R_NO_CHANGE_FOLLOWING_HRR 214 +# define SSL_R_NO_CIPHERS_AVAILABLE 181 +# define SSL_R_NO_CIPHERS_SPECIFIED 183 +# define SSL_R_NO_CIPHER_MATCH 185 +# define SSL_R_NO_CLIENT_CERT_METHOD 331 +# define SSL_R_NO_COMPRESSION_SPECIFIED 187 +# define SSL_R_NO_COOKIE_CALLBACK_SET 287 +# define SSL_R_NO_GOST_CERTIFICATE_SENT_BY_PEER 330 +# define SSL_R_NO_METHOD_SPECIFIED 188 +# define SSL_R_NO_PEM_EXTENSIONS 389 +# define SSL_R_NO_PRIVATE_KEY_ASSIGNED 190 +# define SSL_R_NO_PROTOCOLS_AVAILABLE 191 +# define SSL_R_NO_RENEGOTIATION 339 +# define SSL_R_NO_REQUIRED_DIGEST 324 +# define SSL_R_NO_SHARED_CIPHER 193 +# define SSL_R_NO_SHARED_GROUPS 410 +# define SSL_R_NO_SHARED_SIGNATURE_ALGORITHMS 376 +# define SSL_R_NO_SRTP_PROFILES 359 +# define SSL_R_NO_SUITABLE_KEY_SHARE 101 +# define SSL_R_NO_SUITABLE_SIGNATURE_ALGORITHM 118 +# define SSL_R_NO_VALID_SCTS 216 +# define SSL_R_NO_VERIFY_COOKIE_CALLBACK 403 +# define SSL_R_NULL_SSL_CTX 195 +# define SSL_R_NULL_SSL_METHOD_PASSED 196 +# define SSL_R_OLD_SESSION_CIPHER_NOT_RETURNED 197 +# define SSL_R_OLD_SESSION_COMPRESSION_ALGORITHM_NOT_RETURNED 344 +# define SSL_R_OVERFLOW_ERROR 237 +# define SSL_R_PACKET_LENGTH_TOO_LONG 198 +# define SSL_R_PARSE_TLSEXT 227 +# define SSL_R_PATH_TOO_LONG 270 +# define SSL_R_PEER_DID_NOT_RETURN_A_CERTIFICATE 199 +# define SSL_R_PEM_NAME_BAD_PREFIX 391 +# define SSL_R_PEM_NAME_TOO_SHORT 392 +# define SSL_R_PIPELINE_FAILURE 406 +# define SSL_R_POST_HANDSHAKE_AUTH_ENCODING_ERR 278 +# define SSL_R_PRIVATE_KEY_MISMATCH 288 +# define SSL_R_PROTOCOL_IS_SHUTDOWN 207 +# define SSL_R_PSK_IDENTITY_NOT_FOUND 223 +# define SSL_R_PSK_NO_CLIENT_CB 224 +# define SSL_R_PSK_NO_SERVER_CB 225 +# define SSL_R_READ_BIO_NOT_SET 211 +# define SSL_R_READ_TIMEOUT_EXPIRED 312 +# define SSL_R_RECORD_LENGTH_MISMATCH 213 +# define SSL_R_RECORD_TOO_SMALL 298 +# define SSL_R_RENEGOTIATE_EXT_TOO_LONG 335 +# define SSL_R_RENEGOTIATION_ENCODING_ERR 336 +# define SSL_R_RENEGOTIATION_MISMATCH 337 +# define SSL_R_REQUEST_PENDING 285 +# define SSL_R_REQUEST_SENT 286 +# define SSL_R_REQUIRED_CIPHER_MISSING 215 +# define SSL_R_REQUIRED_COMPRESSION_ALGORITHM_MISSING 342 +# define SSL_R_SCSV_RECEIVED_WHEN_RENEGOTIATING 345 +# define SSL_R_SCT_VERIFICATION_FAILED 208 +# define SSL_R_SERVERHELLO_TLSEXT 275 +# define SSL_R_SESSION_ID_CONTEXT_UNINITIALIZED 277 +# define SSL_R_SHUTDOWN_WHILE_IN_INIT 407 +# define SSL_R_SIGNATURE_ALGORITHMS_ERROR 360 +# define SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE 220 +# define SSL_R_SRP_A_CALC 361 +# define SSL_R_SRTP_COULD_NOT_ALLOCATE_PROFILES 362 +# define SSL_R_SRTP_PROTECTION_PROFILE_LIST_TOO_LONG 363 +# define SSL_R_SRTP_UNKNOWN_PROTECTION_PROFILE 364 +# define SSL_R_SSL3_EXT_INVALID_MAX_FRAGMENT_LENGTH 232 +# define SSL_R_SSL3_EXT_INVALID_SERVERNAME 319 +# define SSL_R_SSL3_EXT_INVALID_SERVERNAME_TYPE 320 +# define SSL_R_SSL3_SESSION_ID_TOO_LONG 300 +# define SSL_R_SSLV3_ALERT_BAD_CERTIFICATE 1042 +# define SSL_R_SSLV3_ALERT_BAD_RECORD_MAC 1020 +# define SSL_R_SSLV3_ALERT_CERTIFICATE_EXPIRED 1045 +# define SSL_R_SSLV3_ALERT_CERTIFICATE_REVOKED 1044 +# define SSL_R_SSLV3_ALERT_CERTIFICATE_UNKNOWN 1046 +# define SSL_R_SSLV3_ALERT_DECOMPRESSION_FAILURE 1030 +# define SSL_R_SSLV3_ALERT_HANDSHAKE_FAILURE 1040 +# define SSL_R_SSLV3_ALERT_ILLEGAL_PARAMETER 1047 +# define SSL_R_SSLV3_ALERT_NO_CERTIFICATE 1041 +# define SSL_R_SSLV3_ALERT_UNEXPECTED_MESSAGE 1010 +# define SSL_R_SSLV3_ALERT_UNSUPPORTED_CERTIFICATE 1043 +# define SSL_R_SSL_COMMAND_SECTION_EMPTY 117 +# define SSL_R_SSL_COMMAND_SECTION_NOT_FOUND 125 +# define SSL_R_SSL_CTX_HAS_NO_DEFAULT_SSL_VERSION 228 +# define SSL_R_SSL_HANDSHAKE_FAILURE 229 +# define SSL_R_SSL_LIBRARY_HAS_NO_CIPHERS 230 +# define SSL_R_SSL_NEGATIVE_LENGTH 372 +# define SSL_R_SSL_SECTION_EMPTY 126 +# define SSL_R_SSL_SECTION_NOT_FOUND 136 +# define SSL_R_SSL_SESSION_ID_CALLBACK_FAILED 301 +# define SSL_R_SSL_SESSION_ID_CONFLICT 302 +# define SSL_R_SSL_SESSION_ID_CONTEXT_TOO_LONG 273 +# define SSL_R_SSL_SESSION_ID_HAS_BAD_LENGTH 303 +# define SSL_R_SSL_SESSION_ID_TOO_LONG 408 +# define SSL_R_SSL_SESSION_VERSION_MISMATCH 210 +# define SSL_R_STILL_IN_INIT 121 +# define SSL_R_TLSV13_ALERT_CERTIFICATE_REQUIRED 1116 +# define SSL_R_TLSV13_ALERT_MISSING_EXTENSION 1109 +# define SSL_R_TLSV1_ALERT_ACCESS_DENIED 1049 +# define SSL_R_TLSV1_ALERT_DECODE_ERROR 1050 +# define SSL_R_TLSV1_ALERT_DECRYPTION_FAILED 1021 +# define SSL_R_TLSV1_ALERT_DECRYPT_ERROR 1051 +# define SSL_R_TLSV1_ALERT_EXPORT_RESTRICTION 1060 +# define SSL_R_TLSV1_ALERT_INAPPROPRIATE_FALLBACK 1086 +# define SSL_R_TLSV1_ALERT_INSUFFICIENT_SECURITY 1071 +# define SSL_R_TLSV1_ALERT_INTERNAL_ERROR 1080 +# define SSL_R_TLSV1_ALERT_NO_RENEGOTIATION 1100 +# define SSL_R_TLSV1_ALERT_PROTOCOL_VERSION 1070 +# define SSL_R_TLSV1_ALERT_RECORD_OVERFLOW 1022 +# define SSL_R_TLSV1_ALERT_UNKNOWN_CA 1048 +# define SSL_R_TLSV1_ALERT_USER_CANCELLED 1090 +# define SSL_R_TLSV1_BAD_CERTIFICATE_HASH_VALUE 1114 +# define SSL_R_TLSV1_BAD_CERTIFICATE_STATUS_RESPONSE 1113 +# define SSL_R_TLSV1_CERTIFICATE_UNOBTAINABLE 1111 +# define SSL_R_TLSV1_UNRECOGNIZED_NAME 1112 +# define SSL_R_TLSV1_UNSUPPORTED_EXTENSION 1110 +# define SSL_R_TLS_HEARTBEAT_PEER_DOESNT_ACCEPT 365 +# define SSL_R_TLS_HEARTBEAT_PENDING 366 +# define SSL_R_TLS_ILLEGAL_EXPORTER_LABEL 367 +# define SSL_R_TLS_INVALID_ECPOINTFORMAT_LIST 157 +# define SSL_R_TOO_MANY_KEY_UPDATES 132 +# define SSL_R_TOO_MANY_WARN_ALERTS 409 +# define SSL_R_TOO_MUCH_EARLY_DATA 164 +# define SSL_R_UNABLE_TO_FIND_ECDH_PARAMETERS 314 +# define SSL_R_UNABLE_TO_FIND_PUBLIC_KEY_PARAMETERS 239 +# define SSL_R_UNABLE_TO_LOAD_SSL3_MD5_ROUTINES 242 +# define SSL_R_UNABLE_TO_LOAD_SSL3_SHA1_ROUTINES 243 +# define SSL_R_UNEXPECTED_CCS_MESSAGE 262 +# define SSL_R_UNEXPECTED_END_OF_EARLY_DATA 178 +# define SSL_R_UNEXPECTED_MESSAGE 244 +# define SSL_R_UNEXPECTED_RECORD 245 +# define SSL_R_UNINITIALIZED 276 +# define SSL_R_UNKNOWN_ALERT_TYPE 246 +# define SSL_R_UNKNOWN_CERTIFICATE_TYPE 247 +# define SSL_R_UNKNOWN_CIPHER_RETURNED 248 +# define SSL_R_UNKNOWN_CIPHER_TYPE 249 +# define SSL_R_UNKNOWN_CMD_NAME 386 +# define SSL_R_UNKNOWN_COMMAND 139 +# define SSL_R_UNKNOWN_DIGEST 368 +# define SSL_R_UNKNOWN_KEY_EXCHANGE_TYPE 250 +# define SSL_R_UNKNOWN_PKEY_TYPE 251 +# define SSL_R_UNKNOWN_PROTOCOL 252 +# define SSL_R_UNKNOWN_SSL_VERSION 254 +# define SSL_R_UNKNOWN_STATE 255 +# define SSL_R_UNSAFE_LEGACY_RENEGOTIATION_DISABLED 338 +# define SSL_R_UNSOLICITED_EXTENSION 217 +# define SSL_R_UNSUPPORTED_COMPRESSION_ALGORITHM 257 +# define SSL_R_UNSUPPORTED_ELLIPTIC_CURVE 315 +# define SSL_R_UNSUPPORTED_PROTOCOL 258 +# define SSL_R_UNSUPPORTED_SSL_VERSION 259 +# define SSL_R_UNSUPPORTED_STATUS_TYPE 329 +# define SSL_R_USE_SRTP_NOT_NEGOTIATED 369 +# define SSL_R_VERSION_TOO_HIGH 166 +# define SSL_R_VERSION_TOO_LOW 396 +# define SSL_R_WRONG_CERTIFICATE_TYPE 383 +# define SSL_R_WRONG_CIPHER_RETURNED 261 +# define SSL_R_WRONG_CURVE 378 +# define SSL_R_WRONG_SIGNATURE_LENGTH 264 +# define SSL_R_WRONG_SIGNATURE_SIZE 265 +# define SSL_R_WRONG_SIGNATURE_TYPE 370 +# define SSL_R_WRONG_SSL_VERSION 266 +# define SSL_R_WRONG_VERSION_NUMBER 267 +# define SSL_R_X509_LIB 268 +# define SSL_R_X509_VERIFICATION_SETUP_PROBLEMS 269 + +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/stack.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/stack.h new file mode 100644 index 0000000..cfc0750 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/stack.h @@ -0,0 +1,83 @@ +/* + * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_STACK_H +# define HEADER_STACK_H + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct stack_st OPENSSL_STACK; /* Use STACK_OF(...) instead */ + +typedef int (*OPENSSL_sk_compfunc)(const void *, const void *); +typedef void (*OPENSSL_sk_freefunc)(void *); +typedef void *(*OPENSSL_sk_copyfunc)(const void *); + +int OPENSSL_sk_num(const OPENSSL_STACK *); +void *OPENSSL_sk_value(const OPENSSL_STACK *, int); + +void *OPENSSL_sk_set(OPENSSL_STACK *st, int i, const void *data); + +OPENSSL_STACK *OPENSSL_sk_new(OPENSSL_sk_compfunc cmp); +OPENSSL_STACK *OPENSSL_sk_new_null(void); +OPENSSL_STACK *OPENSSL_sk_new_reserve(OPENSSL_sk_compfunc c, int n); +int OPENSSL_sk_reserve(OPENSSL_STACK *st, int n); +void OPENSSL_sk_free(OPENSSL_STACK *); +void OPENSSL_sk_pop_free(OPENSSL_STACK *st, void (*func) (void *)); +OPENSSL_STACK *OPENSSL_sk_deep_copy(const OPENSSL_STACK *, + OPENSSL_sk_copyfunc c, + OPENSSL_sk_freefunc f); +int OPENSSL_sk_insert(OPENSSL_STACK *sk, const void *data, int where); +void *OPENSSL_sk_delete(OPENSSL_STACK *st, int loc); +void *OPENSSL_sk_delete_ptr(OPENSSL_STACK *st, const void *p); +int OPENSSL_sk_find(OPENSSL_STACK *st, const void *data); +int OPENSSL_sk_find_ex(OPENSSL_STACK *st, const void *data); +int OPENSSL_sk_push(OPENSSL_STACK *st, const void *data); +int OPENSSL_sk_unshift(OPENSSL_STACK *st, const void *data); +void *OPENSSL_sk_shift(OPENSSL_STACK *st); +void *OPENSSL_sk_pop(OPENSSL_STACK *st); +void OPENSSL_sk_zero(OPENSSL_STACK *st); +OPENSSL_sk_compfunc OPENSSL_sk_set_cmp_func(OPENSSL_STACK *sk, + OPENSSL_sk_compfunc cmp); +OPENSSL_STACK *OPENSSL_sk_dup(const OPENSSL_STACK *st); +void OPENSSL_sk_sort(OPENSSL_STACK *st); +int OPENSSL_sk_is_sorted(const OPENSSL_STACK *st); + +# if OPENSSL_API_COMPAT < 0x10100000L +# define _STACK OPENSSL_STACK +# define sk_num OPENSSL_sk_num +# define sk_value OPENSSL_sk_value +# define sk_set OPENSSL_sk_set +# define sk_new OPENSSL_sk_new +# define sk_new_null OPENSSL_sk_new_null +# define sk_free OPENSSL_sk_free +# define sk_pop_free OPENSSL_sk_pop_free +# define sk_deep_copy OPENSSL_sk_deep_copy +# define sk_insert OPENSSL_sk_insert +# define sk_delete OPENSSL_sk_delete +# define sk_delete_ptr OPENSSL_sk_delete_ptr +# define sk_find OPENSSL_sk_find +# define sk_find_ex OPENSSL_sk_find_ex +# define sk_push OPENSSL_sk_push +# define sk_unshift OPENSSL_sk_unshift +# define sk_shift OPENSSL_sk_shift +# define sk_pop OPENSSL_sk_pop +# define sk_zero OPENSSL_sk_zero +# define sk_set_cmp_func OPENSSL_sk_set_cmp_func +# define sk_dup OPENSSL_sk_dup +# define sk_sort OPENSSL_sk_sort +# define sk_is_sorted OPENSSL_sk_is_sorted +# endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/store.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/store.h new file mode 100644 index 0000000..a40a733 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/store.h @@ -0,0 +1,266 @@ +/* + * Copyright 2016-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_OSSL_STORE_H +# define HEADER_OSSL_STORE_H + +# include +# include +# include +# include + +# ifdef __cplusplus +extern "C" { +# endif + +/*- + * The main OSSL_STORE functions. + * ------------------------------ + * + * These allow applications to open a channel to a resource with supported + * data (keys, certs, crls, ...), read the data a piece at a time and decide + * what to do with it, and finally close. + */ + +typedef struct ossl_store_ctx_st OSSL_STORE_CTX; + +/* + * Typedef for the OSSL_STORE_INFO post processing callback. This can be used + * to massage the given OSSL_STORE_INFO, or to drop it entirely (by returning + * NULL). + */ +typedef OSSL_STORE_INFO *(*OSSL_STORE_post_process_info_fn)(OSSL_STORE_INFO *, + void *); + +/* + * Open a channel given a URI. The given UI method will be used any time the + * loader needs extra input, for example when a password or pin is needed, and + * will be passed the same user data every time it's needed in this context. + * + * Returns a context reference which represents the channel to communicate + * through. + */ +OSSL_STORE_CTX *OSSL_STORE_open(const char *uri, const UI_METHOD *ui_method, + void *ui_data, + OSSL_STORE_post_process_info_fn post_process, + void *post_process_data); + +/* + * Control / fine tune the OSSL_STORE channel. |cmd| determines what is to be + * done, and depends on the underlying loader (use OSSL_STORE_get0_scheme to + * determine which loader is used), except for common commands (see below). + * Each command takes different arguments. + */ +int OSSL_STORE_ctrl(OSSL_STORE_CTX *ctx, int cmd, ... /* args */); +int OSSL_STORE_vctrl(OSSL_STORE_CTX *ctx, int cmd, va_list args); + +/* + * Common ctrl commands that different loaders may choose to support. + */ +/* int on = 0 or 1; STORE_ctrl(ctx, STORE_C_USE_SECMEM, &on); */ +# define OSSL_STORE_C_USE_SECMEM 1 +/* Where custom commands start */ +# define OSSL_STORE_C_CUSTOM_START 100 + +/* + * Read one data item (a key, a cert, a CRL) that is supported by the OSSL_STORE + * functionality, given a context. + * Returns a OSSL_STORE_INFO pointer, from which OpenSSL typed data can be + * extracted with OSSL_STORE_INFO_get0_PKEY(), OSSL_STORE_INFO_get0_CERT(), ... + * NULL is returned on error, which may include that the data found at the URI + * can't be figured out for certain or is ambiguous. + */ +OSSL_STORE_INFO *OSSL_STORE_load(OSSL_STORE_CTX *ctx); + +/* + * Check if end of data (end of file) is reached + * Returns 1 on end, 0 otherwise. + */ +int OSSL_STORE_eof(OSSL_STORE_CTX *ctx); + +/* + * Check if an error occurred + * Returns 1 if it did, 0 otherwise. + */ +int OSSL_STORE_error(OSSL_STORE_CTX *ctx); + +/* + * Close the channel + * Returns 1 on success, 0 on error. + */ +int OSSL_STORE_close(OSSL_STORE_CTX *ctx); + + +/*- + * Extracting OpenSSL types from and creating new OSSL_STORE_INFOs + * --------------------------------------------------------------- + */ + +/* + * Types of data that can be ossl_stored in a OSSL_STORE_INFO. + * OSSL_STORE_INFO_NAME is typically found when getting a listing of + * available "files" / "tokens" / what have you. + */ +# define OSSL_STORE_INFO_NAME 1 /* char * */ +# define OSSL_STORE_INFO_PARAMS 2 /* EVP_PKEY * */ +# define OSSL_STORE_INFO_PKEY 3 /* EVP_PKEY * */ +# define OSSL_STORE_INFO_CERT 4 /* X509 * */ +# define OSSL_STORE_INFO_CRL 5 /* X509_CRL * */ + +/* + * Functions to generate OSSL_STORE_INFOs, one function for each type we + * support having in them, as well as a generic constructor. + * + * In all cases, ownership of the object is transferred to the OSSL_STORE_INFO + * and will therefore be freed when the OSSL_STORE_INFO is freed. + */ +OSSL_STORE_INFO *OSSL_STORE_INFO_new_NAME(char *name); +int OSSL_STORE_INFO_set0_NAME_description(OSSL_STORE_INFO *info, char *desc); +OSSL_STORE_INFO *OSSL_STORE_INFO_new_PARAMS(EVP_PKEY *params); +OSSL_STORE_INFO *OSSL_STORE_INFO_new_PKEY(EVP_PKEY *pkey); +OSSL_STORE_INFO *OSSL_STORE_INFO_new_CERT(X509 *x509); +OSSL_STORE_INFO *OSSL_STORE_INFO_new_CRL(X509_CRL *crl); + +/* + * Functions to try to extract data from a OSSL_STORE_INFO. + */ +int OSSL_STORE_INFO_get_type(const OSSL_STORE_INFO *info); +const char *OSSL_STORE_INFO_get0_NAME(const OSSL_STORE_INFO *info); +char *OSSL_STORE_INFO_get1_NAME(const OSSL_STORE_INFO *info); +const char *OSSL_STORE_INFO_get0_NAME_description(const OSSL_STORE_INFO *info); +char *OSSL_STORE_INFO_get1_NAME_description(const OSSL_STORE_INFO *info); +EVP_PKEY *OSSL_STORE_INFO_get0_PARAMS(const OSSL_STORE_INFO *info); +EVP_PKEY *OSSL_STORE_INFO_get1_PARAMS(const OSSL_STORE_INFO *info); +EVP_PKEY *OSSL_STORE_INFO_get0_PKEY(const OSSL_STORE_INFO *info); +EVP_PKEY *OSSL_STORE_INFO_get1_PKEY(const OSSL_STORE_INFO *info); +X509 *OSSL_STORE_INFO_get0_CERT(const OSSL_STORE_INFO *info); +X509 *OSSL_STORE_INFO_get1_CERT(const OSSL_STORE_INFO *info); +X509_CRL *OSSL_STORE_INFO_get0_CRL(const OSSL_STORE_INFO *info); +X509_CRL *OSSL_STORE_INFO_get1_CRL(const OSSL_STORE_INFO *info); + +const char *OSSL_STORE_INFO_type_string(int type); + +/* + * Free the OSSL_STORE_INFO + */ +void OSSL_STORE_INFO_free(OSSL_STORE_INFO *info); + + +/*- + * Functions to construct a search URI from a base URI and search criteria + * ----------------------------------------------------------------------- + */ + +/* OSSL_STORE search types */ +# define OSSL_STORE_SEARCH_BY_NAME 1 /* subject in certs, issuer in CRLs */ +# define OSSL_STORE_SEARCH_BY_ISSUER_SERIAL 2 +# define OSSL_STORE_SEARCH_BY_KEY_FINGERPRINT 3 +# define OSSL_STORE_SEARCH_BY_ALIAS 4 + +/* To check what search types the scheme handler supports */ +int OSSL_STORE_supports_search(OSSL_STORE_CTX *ctx, int search_type); + +/* Search term constructors */ +/* + * The input is considered to be owned by the caller, and must therefore + * remain present throughout the lifetime of the returned OSSL_STORE_SEARCH + */ +OSSL_STORE_SEARCH *OSSL_STORE_SEARCH_by_name(X509_NAME *name); +OSSL_STORE_SEARCH *OSSL_STORE_SEARCH_by_issuer_serial(X509_NAME *name, + const ASN1_INTEGER + *serial); +OSSL_STORE_SEARCH *OSSL_STORE_SEARCH_by_key_fingerprint(const EVP_MD *digest, + const unsigned char + *bytes, size_t len); +OSSL_STORE_SEARCH *OSSL_STORE_SEARCH_by_alias(const char *alias); + +/* Search term destructor */ +void OSSL_STORE_SEARCH_free(OSSL_STORE_SEARCH *search); + +/* Search term accessors */ +int OSSL_STORE_SEARCH_get_type(const OSSL_STORE_SEARCH *criterion); +X509_NAME *OSSL_STORE_SEARCH_get0_name(OSSL_STORE_SEARCH *criterion); +const ASN1_INTEGER *OSSL_STORE_SEARCH_get0_serial(const OSSL_STORE_SEARCH + *criterion); +const unsigned char *OSSL_STORE_SEARCH_get0_bytes(const OSSL_STORE_SEARCH + *criterion, size_t *length); +const char *OSSL_STORE_SEARCH_get0_string(const OSSL_STORE_SEARCH *criterion); +const EVP_MD *OSSL_STORE_SEARCH_get0_digest(const OSSL_STORE_SEARCH *criterion); + +/* + * Add search criterion and expected return type (which can be unspecified) + * to the loading channel. This MUST happen before the first OSSL_STORE_load(). + */ +int OSSL_STORE_expect(OSSL_STORE_CTX *ctx, int expected_type); +int OSSL_STORE_find(OSSL_STORE_CTX *ctx, OSSL_STORE_SEARCH *search); + + +/*- + * Function to register a loader for the given URI scheme. + * ------------------------------------------------------- + * + * The loader receives all the main components of an URI except for the + * scheme. + */ + +typedef struct ossl_store_loader_st OSSL_STORE_LOADER; +OSSL_STORE_LOADER *OSSL_STORE_LOADER_new(ENGINE *e, const char *scheme); +const ENGINE *OSSL_STORE_LOADER_get0_engine(const OSSL_STORE_LOADER *loader); +const char *OSSL_STORE_LOADER_get0_scheme(const OSSL_STORE_LOADER *loader); +/* struct ossl_store_loader_ctx_st is defined differently by each loader */ +typedef struct ossl_store_loader_ctx_st OSSL_STORE_LOADER_CTX; +typedef OSSL_STORE_LOADER_CTX *(*OSSL_STORE_open_fn)(const OSSL_STORE_LOADER + *loader, + const char *uri, + const UI_METHOD *ui_method, + void *ui_data); +int OSSL_STORE_LOADER_set_open(OSSL_STORE_LOADER *loader, + OSSL_STORE_open_fn open_function); +typedef int (*OSSL_STORE_ctrl_fn)(OSSL_STORE_LOADER_CTX *ctx, int cmd, + va_list args); +int OSSL_STORE_LOADER_set_ctrl(OSSL_STORE_LOADER *loader, + OSSL_STORE_ctrl_fn ctrl_function); +typedef int (*OSSL_STORE_expect_fn)(OSSL_STORE_LOADER_CTX *ctx, int expected); +int OSSL_STORE_LOADER_set_expect(OSSL_STORE_LOADER *loader, + OSSL_STORE_expect_fn expect_function); +typedef int (*OSSL_STORE_find_fn)(OSSL_STORE_LOADER_CTX *ctx, + OSSL_STORE_SEARCH *criteria); +int OSSL_STORE_LOADER_set_find(OSSL_STORE_LOADER *loader, + OSSL_STORE_find_fn find_function); +typedef OSSL_STORE_INFO *(*OSSL_STORE_load_fn)(OSSL_STORE_LOADER_CTX *ctx, + const UI_METHOD *ui_method, + void *ui_data); +int OSSL_STORE_LOADER_set_load(OSSL_STORE_LOADER *loader, + OSSL_STORE_load_fn load_function); +typedef int (*OSSL_STORE_eof_fn)(OSSL_STORE_LOADER_CTX *ctx); +int OSSL_STORE_LOADER_set_eof(OSSL_STORE_LOADER *loader, + OSSL_STORE_eof_fn eof_function); +typedef int (*OSSL_STORE_error_fn)(OSSL_STORE_LOADER_CTX *ctx); +int OSSL_STORE_LOADER_set_error(OSSL_STORE_LOADER *loader, + OSSL_STORE_error_fn error_function); +typedef int (*OSSL_STORE_close_fn)(OSSL_STORE_LOADER_CTX *ctx); +int OSSL_STORE_LOADER_set_close(OSSL_STORE_LOADER *loader, + OSSL_STORE_close_fn close_function); +void OSSL_STORE_LOADER_free(OSSL_STORE_LOADER *loader); + +int OSSL_STORE_register_loader(OSSL_STORE_LOADER *loader); +OSSL_STORE_LOADER *OSSL_STORE_unregister_loader(const char *scheme); + +/*- + * Functions to list STORE loaders + * ------------------------------- + */ +int OSSL_STORE_do_all_loaders(void (*do_function) (const OSSL_STORE_LOADER + *loader, void *do_arg), + void *do_arg); + +# ifdef __cplusplus +} +# endif +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/storeerr.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/storeerr.h new file mode 100644 index 0000000..190eab0 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/storeerr.h @@ -0,0 +1,91 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_OSSL_STOREERR_H +# define HEADER_OSSL_STOREERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_OSSL_STORE_strings(void); + +/* + * OSSL_STORE function codes. + */ +# define OSSL_STORE_F_FILE_CTRL 129 +# define OSSL_STORE_F_FILE_FIND 138 +# define OSSL_STORE_F_FILE_GET_PASS 118 +# define OSSL_STORE_F_FILE_LOAD 119 +# define OSSL_STORE_F_FILE_LOAD_TRY_DECODE 124 +# define OSSL_STORE_F_FILE_NAME_TO_URI 126 +# define OSSL_STORE_F_FILE_OPEN 120 +# define OSSL_STORE_F_OSSL_STORE_ATTACH_PEM_BIO 127 +# define OSSL_STORE_F_OSSL_STORE_EXPECT 130 +# define OSSL_STORE_F_OSSL_STORE_FILE_ATTACH_PEM_BIO_INT 128 +# define OSSL_STORE_F_OSSL_STORE_FIND 131 +# define OSSL_STORE_F_OSSL_STORE_GET0_LOADER_INT 100 +# define OSSL_STORE_F_OSSL_STORE_INFO_GET1_CERT 101 +# define OSSL_STORE_F_OSSL_STORE_INFO_GET1_CRL 102 +# define OSSL_STORE_F_OSSL_STORE_INFO_GET1_NAME 103 +# define OSSL_STORE_F_OSSL_STORE_INFO_GET1_NAME_DESCRIPTION 135 +# define OSSL_STORE_F_OSSL_STORE_INFO_GET1_PARAMS 104 +# define OSSL_STORE_F_OSSL_STORE_INFO_GET1_PKEY 105 +# define OSSL_STORE_F_OSSL_STORE_INFO_NEW_CERT 106 +# define OSSL_STORE_F_OSSL_STORE_INFO_NEW_CRL 107 +# define OSSL_STORE_F_OSSL_STORE_INFO_NEW_EMBEDDED 123 +# define OSSL_STORE_F_OSSL_STORE_INFO_NEW_NAME 109 +# define OSSL_STORE_F_OSSL_STORE_INFO_NEW_PARAMS 110 +# define OSSL_STORE_F_OSSL_STORE_INFO_NEW_PKEY 111 +# define OSSL_STORE_F_OSSL_STORE_INFO_SET0_NAME_DESCRIPTION 134 +# define OSSL_STORE_F_OSSL_STORE_INIT_ONCE 112 +# define OSSL_STORE_F_OSSL_STORE_LOADER_NEW 113 +# define OSSL_STORE_F_OSSL_STORE_OPEN 114 +# define OSSL_STORE_F_OSSL_STORE_OPEN_INT 115 +# define OSSL_STORE_F_OSSL_STORE_REGISTER_LOADER_INT 117 +# define OSSL_STORE_F_OSSL_STORE_SEARCH_BY_ALIAS 132 +# define OSSL_STORE_F_OSSL_STORE_SEARCH_BY_ISSUER_SERIAL 133 +# define OSSL_STORE_F_OSSL_STORE_SEARCH_BY_KEY_FINGERPRINT 136 +# define OSSL_STORE_F_OSSL_STORE_SEARCH_BY_NAME 137 +# define OSSL_STORE_F_OSSL_STORE_UNREGISTER_LOADER_INT 116 +# define OSSL_STORE_F_TRY_DECODE_PARAMS 121 +# define OSSL_STORE_F_TRY_DECODE_PKCS12 122 +# define OSSL_STORE_F_TRY_DECODE_PKCS8ENCRYPTED 125 + +/* + * OSSL_STORE reason codes. + */ +# define OSSL_STORE_R_AMBIGUOUS_CONTENT_TYPE 107 +# define OSSL_STORE_R_BAD_PASSWORD_READ 115 +# define OSSL_STORE_R_ERROR_VERIFYING_PKCS12_MAC 113 +# define OSSL_STORE_R_FINGERPRINT_SIZE_DOES_NOT_MATCH_DIGEST 121 +# define OSSL_STORE_R_INVALID_SCHEME 106 +# define OSSL_STORE_R_IS_NOT_A 112 +# define OSSL_STORE_R_LOADER_INCOMPLETE 116 +# define OSSL_STORE_R_LOADING_STARTED 117 +# define OSSL_STORE_R_NOT_A_CERTIFICATE 100 +# define OSSL_STORE_R_NOT_A_CRL 101 +# define OSSL_STORE_R_NOT_A_KEY 102 +# define OSSL_STORE_R_NOT_A_NAME 103 +# define OSSL_STORE_R_NOT_PARAMETERS 104 +# define OSSL_STORE_R_PASSPHRASE_CALLBACK_ERROR 114 +# define OSSL_STORE_R_PATH_MUST_BE_ABSOLUTE 108 +# define OSSL_STORE_R_SEARCH_ONLY_SUPPORTED_FOR_DIRECTORIES 119 +# define OSSL_STORE_R_UI_PROCESS_INTERRUPTED_OR_CANCELLED 109 +# define OSSL_STORE_R_UNREGISTERED_SCHEME 105 +# define OSSL_STORE_R_UNSUPPORTED_CONTENT_TYPE 110 +# define OSSL_STORE_R_UNSUPPORTED_OPERATION 118 +# define OSSL_STORE_R_UNSUPPORTED_SEARCH_TYPE 120 +# define OSSL_STORE_R_URI_AUTHORITY_UNSUPPORTED 111 + +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/symhacks.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/symhacks.h new file mode 100644 index 0000000..156ea6e --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/symhacks.h @@ -0,0 +1,37 @@ +/* + * Copyright 1999-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_SYMHACKS_H +# define HEADER_SYMHACKS_H + +# include + +/* Case insensitive linking causes problems.... */ +# if defined(OPENSSL_SYS_VMS) +# undef ERR_load_CRYPTO_strings +# define ERR_load_CRYPTO_strings ERR_load_CRYPTOlib_strings +# undef OCSP_crlID_new +# define OCSP_crlID_new OCSP_crlID2_new + +# undef d2i_ECPARAMETERS +# define d2i_ECPARAMETERS d2i_UC_ECPARAMETERS +# undef i2d_ECPARAMETERS +# define i2d_ECPARAMETERS i2d_UC_ECPARAMETERS +# undef d2i_ECPKPARAMETERS +# define d2i_ECPKPARAMETERS d2i_UC_ECPKPARAMETERS +# undef i2d_ECPKPARAMETERS +# define i2d_ECPKPARAMETERS i2d_UC_ECPKPARAMETERS + +/* This one clashes with CMS_data_create */ +# undef cms_Data_create +# define cms_Data_create priv_cms_Data_create + +# endif + +#endif /* ! defined HEADER_VMS_IDHACKS_H */ diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/tls1.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/tls1.h new file mode 100644 index 0000000..76d9fda --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/tls1.h @@ -0,0 +1,1237 @@ +/* + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved + * Copyright 2005 Nokia. All rights reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_TLS1_H +# define HEADER_TLS1_H + +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Default security level if not overridden at config time */ +# ifndef OPENSSL_TLS_SECURITY_LEVEL +# define OPENSSL_TLS_SECURITY_LEVEL 1 +# endif + +# define TLS1_VERSION 0x0301 +# define TLS1_1_VERSION 0x0302 +# define TLS1_2_VERSION 0x0303 +# define TLS1_3_VERSION 0x0304 +# define TLS_MAX_VERSION TLS1_3_VERSION + +/* Special value for method supporting multiple versions */ +# define TLS_ANY_VERSION 0x10000 + +# define TLS1_VERSION_MAJOR 0x03 +# define TLS1_VERSION_MINOR 0x01 + +# define TLS1_1_VERSION_MAJOR 0x03 +# define TLS1_1_VERSION_MINOR 0x02 + +# define TLS1_2_VERSION_MAJOR 0x03 +# define TLS1_2_VERSION_MINOR 0x03 + +# define TLS1_get_version(s) \ + ((SSL_version(s) >> 8) == TLS1_VERSION_MAJOR ? SSL_version(s) : 0) + +# define TLS1_get_client_version(s) \ + ((SSL_client_version(s) >> 8) == TLS1_VERSION_MAJOR ? SSL_client_version(s) : 0) + +# define TLS1_AD_DECRYPTION_FAILED 21 +# define TLS1_AD_RECORD_OVERFLOW 22 +# define TLS1_AD_UNKNOWN_CA 48/* fatal */ +# define TLS1_AD_ACCESS_DENIED 49/* fatal */ +# define TLS1_AD_DECODE_ERROR 50/* fatal */ +# define TLS1_AD_DECRYPT_ERROR 51 +# define TLS1_AD_EXPORT_RESTRICTION 60/* fatal */ +# define TLS1_AD_PROTOCOL_VERSION 70/* fatal */ +# define TLS1_AD_INSUFFICIENT_SECURITY 71/* fatal */ +# define TLS1_AD_INTERNAL_ERROR 80/* fatal */ +# define TLS1_AD_INAPPROPRIATE_FALLBACK 86/* fatal */ +# define TLS1_AD_USER_CANCELLED 90 +# define TLS1_AD_NO_RENEGOTIATION 100 +/* TLSv1.3 alerts */ +# define TLS13_AD_MISSING_EXTENSION 109 /* fatal */ +# define TLS13_AD_CERTIFICATE_REQUIRED 116 /* fatal */ +/* codes 110-114 are from RFC3546 */ +# define TLS1_AD_UNSUPPORTED_EXTENSION 110 +# define TLS1_AD_CERTIFICATE_UNOBTAINABLE 111 +# define TLS1_AD_UNRECOGNIZED_NAME 112 +# define TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE 113 +# define TLS1_AD_BAD_CERTIFICATE_HASH_VALUE 114 +# define TLS1_AD_UNKNOWN_PSK_IDENTITY 115/* fatal */ +# define TLS1_AD_NO_APPLICATION_PROTOCOL 120 /* fatal */ + +/* ExtensionType values from RFC3546 / RFC4366 / RFC6066 */ +# define TLSEXT_TYPE_server_name 0 +# define TLSEXT_TYPE_max_fragment_length 1 +# define TLSEXT_TYPE_client_certificate_url 2 +# define TLSEXT_TYPE_trusted_ca_keys 3 +# define TLSEXT_TYPE_truncated_hmac 4 +# define TLSEXT_TYPE_status_request 5 +/* ExtensionType values from RFC4681 */ +# define TLSEXT_TYPE_user_mapping 6 +/* ExtensionType values from RFC5878 */ +# define TLSEXT_TYPE_client_authz 7 +# define TLSEXT_TYPE_server_authz 8 +/* ExtensionType values from RFC6091 */ +# define TLSEXT_TYPE_cert_type 9 + +/* ExtensionType values from RFC4492 */ +/* + * Prior to TLSv1.3 the supported_groups extension was known as + * elliptic_curves + */ +# define TLSEXT_TYPE_supported_groups 10 +# define TLSEXT_TYPE_elliptic_curves TLSEXT_TYPE_supported_groups +# define TLSEXT_TYPE_ec_point_formats 11 + + +/* ExtensionType value from RFC5054 */ +# define TLSEXT_TYPE_srp 12 + +/* ExtensionType values from RFC5246 */ +# define TLSEXT_TYPE_signature_algorithms 13 + +/* ExtensionType value from RFC5764 */ +# define TLSEXT_TYPE_use_srtp 14 + +/* ExtensionType value from RFC5620 */ +# define TLSEXT_TYPE_heartbeat 15 + +/* ExtensionType value from RFC7301 */ +# define TLSEXT_TYPE_application_layer_protocol_negotiation 16 + +/* + * Extension type for Certificate Transparency + * https://tools.ietf.org/html/rfc6962#section-3.3.1 + */ +# define TLSEXT_TYPE_signed_certificate_timestamp 18 + +/* + * ExtensionType value for TLS padding extension. + * http://tools.ietf.org/html/draft-agl-tls-padding + */ +# define TLSEXT_TYPE_padding 21 + +/* ExtensionType value from RFC7366 */ +# define TLSEXT_TYPE_encrypt_then_mac 22 + +/* ExtensionType value from RFC7627 */ +# define TLSEXT_TYPE_extended_master_secret 23 + +/* ExtensionType value from RFC4507 */ +# define TLSEXT_TYPE_session_ticket 35 + +/* As defined for TLS1.3 */ +# define TLSEXT_TYPE_psk 41 +# define TLSEXT_TYPE_early_data 42 +# define TLSEXT_TYPE_supported_versions 43 +# define TLSEXT_TYPE_cookie 44 +# define TLSEXT_TYPE_psk_kex_modes 45 +# define TLSEXT_TYPE_certificate_authorities 47 +# define TLSEXT_TYPE_post_handshake_auth 49 +# define TLSEXT_TYPE_signature_algorithms_cert 50 +# define TLSEXT_TYPE_key_share 51 + +/* Temporary extension type */ +# define TLSEXT_TYPE_renegotiate 0xff01 + +# ifndef OPENSSL_NO_NEXTPROTONEG +/* This is not an IANA defined extension number */ +# define TLSEXT_TYPE_next_proto_neg 13172 +# endif + +/* NameType value from RFC3546 */ +# define TLSEXT_NAMETYPE_host_name 0 +/* status request value from RFC3546 */ +# define TLSEXT_STATUSTYPE_ocsp 1 + +/* ECPointFormat values from RFC4492 */ +# define TLSEXT_ECPOINTFORMAT_first 0 +# define TLSEXT_ECPOINTFORMAT_uncompressed 0 +# define TLSEXT_ECPOINTFORMAT_ansiX962_compressed_prime 1 +# define TLSEXT_ECPOINTFORMAT_ansiX962_compressed_char2 2 +# define TLSEXT_ECPOINTFORMAT_last 2 + +/* Signature and hash algorithms from RFC5246 */ +# define TLSEXT_signature_anonymous 0 +# define TLSEXT_signature_rsa 1 +# define TLSEXT_signature_dsa 2 +# define TLSEXT_signature_ecdsa 3 +# define TLSEXT_signature_gostr34102001 237 +# define TLSEXT_signature_gostr34102012_256 238 +# define TLSEXT_signature_gostr34102012_512 239 + +/* Total number of different signature algorithms */ +# define TLSEXT_signature_num 7 + +# define TLSEXT_hash_none 0 +# define TLSEXT_hash_md5 1 +# define TLSEXT_hash_sha1 2 +# define TLSEXT_hash_sha224 3 +# define TLSEXT_hash_sha256 4 +# define TLSEXT_hash_sha384 5 +# define TLSEXT_hash_sha512 6 +# define TLSEXT_hash_gostr3411 237 +# define TLSEXT_hash_gostr34112012_256 238 +# define TLSEXT_hash_gostr34112012_512 239 + +/* Total number of different digest algorithms */ + +# define TLSEXT_hash_num 10 + +/* Flag set for unrecognised algorithms */ +# define TLSEXT_nid_unknown 0x1000000 + +/* ECC curves */ + +# define TLSEXT_curve_P_256 23 +# define TLSEXT_curve_P_384 24 + +/* OpenSSL value to disable maximum fragment length extension */ +# define TLSEXT_max_fragment_length_DISABLED 0 +/* Allowed values for max fragment length extension */ +# define TLSEXT_max_fragment_length_512 1 +# define TLSEXT_max_fragment_length_1024 2 +# define TLSEXT_max_fragment_length_2048 3 +# define TLSEXT_max_fragment_length_4096 4 + +int SSL_CTX_set_tlsext_max_fragment_length(SSL_CTX *ctx, uint8_t mode); +int SSL_set_tlsext_max_fragment_length(SSL *ssl, uint8_t mode); + +# define TLSEXT_MAXLEN_host_name 255 + +__owur const char *SSL_get_servername(const SSL *s, const int type); +__owur int SSL_get_servername_type(const SSL *s); +/* + * SSL_export_keying_material exports a value derived from the master secret, + * as specified in RFC 5705. It writes |olen| bytes to |out| given a label and + * optional context. (Since a zero length context is allowed, the |use_context| + * flag controls whether a context is included.) It returns 1 on success and + * 0 or -1 otherwise. + */ +__owur int SSL_export_keying_material(SSL *s, unsigned char *out, size_t olen, + const char *label, size_t llen, + const unsigned char *context, + size_t contextlen, int use_context); + +/* + * SSL_export_keying_material_early exports a value derived from the + * early exporter master secret, as specified in + * https://tools.ietf.org/html/draft-ietf-tls-tls13-23. It writes + * |olen| bytes to |out| given a label and optional context. It + * returns 1 on success and 0 otherwise. + */ +__owur int SSL_export_keying_material_early(SSL *s, unsigned char *out, + size_t olen, const char *label, + size_t llen, + const unsigned char *context, + size_t contextlen); + +int SSL_get_peer_signature_type_nid(const SSL *s, int *pnid); +int SSL_get_signature_type_nid(const SSL *s, int *pnid); + +int SSL_get_sigalgs(SSL *s, int idx, + int *psign, int *phash, int *psignandhash, + unsigned char *rsig, unsigned char *rhash); + +int SSL_get_shared_sigalgs(SSL *s, int idx, + int *psign, int *phash, int *psignandhash, + unsigned char *rsig, unsigned char *rhash); + +__owur int SSL_check_chain(SSL *s, X509 *x, EVP_PKEY *pk, STACK_OF(X509) *chain); + +# define SSL_set_tlsext_host_name(s,name) \ + SSL_ctrl(s,SSL_CTRL_SET_TLSEXT_HOSTNAME,TLSEXT_NAMETYPE_host_name,\ + (void *)name) + +# define SSL_set_tlsext_debug_callback(ssl, cb) \ + SSL_callback_ctrl(ssl,SSL_CTRL_SET_TLSEXT_DEBUG_CB,\ + (void (*)(void))cb) + +# define SSL_set_tlsext_debug_arg(ssl, arg) \ + SSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_DEBUG_ARG,0,arg) + +# define SSL_get_tlsext_status_type(ssl) \ + SSL_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_TYPE,0,NULL) + +# define SSL_set_tlsext_status_type(ssl, type) \ + SSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_TYPE,type,NULL) + +# define SSL_get_tlsext_status_exts(ssl, arg) \ + SSL_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_EXTS,0,arg) + +# define SSL_set_tlsext_status_exts(ssl, arg) \ + SSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_EXTS,0,arg) + +# define SSL_get_tlsext_status_ids(ssl, arg) \ + SSL_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_IDS,0,arg) + +# define SSL_set_tlsext_status_ids(ssl, arg) \ + SSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_IDS,0,arg) + +# define SSL_get_tlsext_status_ocsp_resp(ssl, arg) \ + SSL_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_OCSP_RESP,0,arg) + +# define SSL_set_tlsext_status_ocsp_resp(ssl, arg, arglen) \ + SSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_OCSP_RESP,arglen,arg) + +# define SSL_CTX_set_tlsext_servername_callback(ctx, cb) \ + SSL_CTX_callback_ctrl(ctx,SSL_CTRL_SET_TLSEXT_SERVERNAME_CB,\ + (void (*)(void))cb) + +# define SSL_TLSEXT_ERR_OK 0 +# define SSL_TLSEXT_ERR_ALERT_WARNING 1 +# define SSL_TLSEXT_ERR_ALERT_FATAL 2 +# define SSL_TLSEXT_ERR_NOACK 3 + +# define SSL_CTX_set_tlsext_servername_arg(ctx, arg) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TLSEXT_SERVERNAME_ARG,0,arg) + +# define SSL_CTX_get_tlsext_ticket_keys(ctx, keys, keylen) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_GET_TLSEXT_TICKET_KEYS,keylen,keys) +# define SSL_CTX_set_tlsext_ticket_keys(ctx, keys, keylen) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TLSEXT_TICKET_KEYS,keylen,keys) + +# define SSL_CTX_get_tlsext_status_cb(ssl, cb) \ + SSL_CTX_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_CB,0,(void *)cb) +# define SSL_CTX_set_tlsext_status_cb(ssl, cb) \ + SSL_CTX_callback_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB,\ + (void (*)(void))cb) + +# define SSL_CTX_get_tlsext_status_arg(ssl, arg) \ + SSL_CTX_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_CB_ARG,0,arg) +# define SSL_CTX_set_tlsext_status_arg(ssl, arg) \ + SSL_CTX_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB_ARG,0,arg) + +# define SSL_CTX_set_tlsext_status_type(ssl, type) \ + SSL_CTX_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_TYPE,type,NULL) + +# define SSL_CTX_get_tlsext_status_type(ssl) \ + SSL_CTX_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_TYPE,0,NULL) + +# define SSL_CTX_set_tlsext_ticket_key_cb(ssl, cb) \ + SSL_CTX_callback_ctrl(ssl,SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB,\ + (void (*)(void))cb) + +# ifndef OPENSSL_NO_HEARTBEATS +# define SSL_DTLSEXT_HB_ENABLED 0x01 +# define SSL_DTLSEXT_HB_DONT_SEND_REQUESTS 0x02 +# define SSL_DTLSEXT_HB_DONT_RECV_REQUESTS 0x04 +# define SSL_get_dtlsext_heartbeat_pending(ssl) \ + SSL_ctrl(ssl,SSL_CTRL_GET_DTLS_EXT_HEARTBEAT_PENDING,0,NULL) +# define SSL_set_dtlsext_heartbeat_no_requests(ssl, arg) \ + SSL_ctrl(ssl,SSL_CTRL_SET_DTLS_EXT_HEARTBEAT_NO_REQUESTS,arg,NULL) + +# if OPENSSL_API_COMPAT < 0x10100000L +# define SSL_CTRL_TLS_EXT_SEND_HEARTBEAT \ + SSL_CTRL_DTLS_EXT_SEND_HEARTBEAT +# define SSL_CTRL_GET_TLS_EXT_HEARTBEAT_PENDING \ + SSL_CTRL_GET_DTLS_EXT_HEARTBEAT_PENDING +# define SSL_CTRL_SET_TLS_EXT_HEARTBEAT_NO_REQUESTS \ + SSL_CTRL_SET_DTLS_EXT_HEARTBEAT_NO_REQUESTS +# define SSL_TLSEXT_HB_ENABLED \ + SSL_DTLSEXT_HB_ENABLED +# define SSL_TLSEXT_HB_DONT_SEND_REQUESTS \ + SSL_DTLSEXT_HB_DONT_SEND_REQUESTS +# define SSL_TLSEXT_HB_DONT_RECV_REQUESTS \ + SSL_DTLSEXT_HB_DONT_RECV_REQUESTS +# define SSL_get_tlsext_heartbeat_pending(ssl) \ + SSL_get_dtlsext_heartbeat_pending(ssl) +# define SSL_set_tlsext_heartbeat_no_requests(ssl, arg) \ + SSL_set_dtlsext_heartbeat_no_requests(ssl,arg) +# endif +# endif + +/* PSK ciphersuites from 4279 */ +# define TLS1_CK_PSK_WITH_RC4_128_SHA 0x0300008A +# define TLS1_CK_PSK_WITH_3DES_EDE_CBC_SHA 0x0300008B +# define TLS1_CK_PSK_WITH_AES_128_CBC_SHA 0x0300008C +# define TLS1_CK_PSK_WITH_AES_256_CBC_SHA 0x0300008D +# define TLS1_CK_DHE_PSK_WITH_RC4_128_SHA 0x0300008E +# define TLS1_CK_DHE_PSK_WITH_3DES_EDE_CBC_SHA 0x0300008F +# define TLS1_CK_DHE_PSK_WITH_AES_128_CBC_SHA 0x03000090 +# define TLS1_CK_DHE_PSK_WITH_AES_256_CBC_SHA 0x03000091 +# define TLS1_CK_RSA_PSK_WITH_RC4_128_SHA 0x03000092 +# define TLS1_CK_RSA_PSK_WITH_3DES_EDE_CBC_SHA 0x03000093 +# define TLS1_CK_RSA_PSK_WITH_AES_128_CBC_SHA 0x03000094 +# define TLS1_CK_RSA_PSK_WITH_AES_256_CBC_SHA 0x03000095 + +/* PSK ciphersuites from 5487 */ +# define TLS1_CK_PSK_WITH_AES_128_GCM_SHA256 0x030000A8 +# define TLS1_CK_PSK_WITH_AES_256_GCM_SHA384 0x030000A9 +# define TLS1_CK_DHE_PSK_WITH_AES_128_GCM_SHA256 0x030000AA +# define TLS1_CK_DHE_PSK_WITH_AES_256_GCM_SHA384 0x030000AB +# define TLS1_CK_RSA_PSK_WITH_AES_128_GCM_SHA256 0x030000AC +# define TLS1_CK_RSA_PSK_WITH_AES_256_GCM_SHA384 0x030000AD +# define TLS1_CK_PSK_WITH_AES_128_CBC_SHA256 0x030000AE +# define TLS1_CK_PSK_WITH_AES_256_CBC_SHA384 0x030000AF +# define TLS1_CK_PSK_WITH_NULL_SHA256 0x030000B0 +# define TLS1_CK_PSK_WITH_NULL_SHA384 0x030000B1 +# define TLS1_CK_DHE_PSK_WITH_AES_128_CBC_SHA256 0x030000B2 +# define TLS1_CK_DHE_PSK_WITH_AES_256_CBC_SHA384 0x030000B3 +# define TLS1_CK_DHE_PSK_WITH_NULL_SHA256 0x030000B4 +# define TLS1_CK_DHE_PSK_WITH_NULL_SHA384 0x030000B5 +# define TLS1_CK_RSA_PSK_WITH_AES_128_CBC_SHA256 0x030000B6 +# define TLS1_CK_RSA_PSK_WITH_AES_256_CBC_SHA384 0x030000B7 +# define TLS1_CK_RSA_PSK_WITH_NULL_SHA256 0x030000B8 +# define TLS1_CK_RSA_PSK_WITH_NULL_SHA384 0x030000B9 + +/* NULL PSK ciphersuites from RFC4785 */ +# define TLS1_CK_PSK_WITH_NULL_SHA 0x0300002C +# define TLS1_CK_DHE_PSK_WITH_NULL_SHA 0x0300002D +# define TLS1_CK_RSA_PSK_WITH_NULL_SHA 0x0300002E + +/* AES ciphersuites from RFC3268 */ +# define TLS1_CK_RSA_WITH_AES_128_SHA 0x0300002F +# define TLS1_CK_DH_DSS_WITH_AES_128_SHA 0x03000030 +# define TLS1_CK_DH_RSA_WITH_AES_128_SHA 0x03000031 +# define TLS1_CK_DHE_DSS_WITH_AES_128_SHA 0x03000032 +# define TLS1_CK_DHE_RSA_WITH_AES_128_SHA 0x03000033 +# define TLS1_CK_ADH_WITH_AES_128_SHA 0x03000034 +# define TLS1_CK_RSA_WITH_AES_256_SHA 0x03000035 +# define TLS1_CK_DH_DSS_WITH_AES_256_SHA 0x03000036 +# define TLS1_CK_DH_RSA_WITH_AES_256_SHA 0x03000037 +# define TLS1_CK_DHE_DSS_WITH_AES_256_SHA 0x03000038 +# define TLS1_CK_DHE_RSA_WITH_AES_256_SHA 0x03000039 +# define TLS1_CK_ADH_WITH_AES_256_SHA 0x0300003A + +/* TLS v1.2 ciphersuites */ +# define TLS1_CK_RSA_WITH_NULL_SHA256 0x0300003B +# define TLS1_CK_RSA_WITH_AES_128_SHA256 0x0300003C +# define TLS1_CK_RSA_WITH_AES_256_SHA256 0x0300003D +# define TLS1_CK_DH_DSS_WITH_AES_128_SHA256 0x0300003E +# define TLS1_CK_DH_RSA_WITH_AES_128_SHA256 0x0300003F +# define TLS1_CK_DHE_DSS_WITH_AES_128_SHA256 0x03000040 + +/* Camellia ciphersuites from RFC4132 */ +# define TLS1_CK_RSA_WITH_CAMELLIA_128_CBC_SHA 0x03000041 +# define TLS1_CK_DH_DSS_WITH_CAMELLIA_128_CBC_SHA 0x03000042 +# define TLS1_CK_DH_RSA_WITH_CAMELLIA_128_CBC_SHA 0x03000043 +# define TLS1_CK_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA 0x03000044 +# define TLS1_CK_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA 0x03000045 +# define TLS1_CK_ADH_WITH_CAMELLIA_128_CBC_SHA 0x03000046 + +/* TLS v1.2 ciphersuites */ +# define TLS1_CK_DHE_RSA_WITH_AES_128_SHA256 0x03000067 +# define TLS1_CK_DH_DSS_WITH_AES_256_SHA256 0x03000068 +# define TLS1_CK_DH_RSA_WITH_AES_256_SHA256 0x03000069 +# define TLS1_CK_DHE_DSS_WITH_AES_256_SHA256 0x0300006A +# define TLS1_CK_DHE_RSA_WITH_AES_256_SHA256 0x0300006B +# define TLS1_CK_ADH_WITH_AES_128_SHA256 0x0300006C +# define TLS1_CK_ADH_WITH_AES_256_SHA256 0x0300006D + +/* Camellia ciphersuites from RFC4132 */ +# define TLS1_CK_RSA_WITH_CAMELLIA_256_CBC_SHA 0x03000084 +# define TLS1_CK_DH_DSS_WITH_CAMELLIA_256_CBC_SHA 0x03000085 +# define TLS1_CK_DH_RSA_WITH_CAMELLIA_256_CBC_SHA 0x03000086 +# define TLS1_CK_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA 0x03000087 +# define TLS1_CK_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA 0x03000088 +# define TLS1_CK_ADH_WITH_CAMELLIA_256_CBC_SHA 0x03000089 + +/* SEED ciphersuites from RFC4162 */ +# define TLS1_CK_RSA_WITH_SEED_SHA 0x03000096 +# define TLS1_CK_DH_DSS_WITH_SEED_SHA 0x03000097 +# define TLS1_CK_DH_RSA_WITH_SEED_SHA 0x03000098 +# define TLS1_CK_DHE_DSS_WITH_SEED_SHA 0x03000099 +# define TLS1_CK_DHE_RSA_WITH_SEED_SHA 0x0300009A +# define TLS1_CK_ADH_WITH_SEED_SHA 0x0300009B + +/* TLS v1.2 GCM ciphersuites from RFC5288 */ +# define TLS1_CK_RSA_WITH_AES_128_GCM_SHA256 0x0300009C +# define TLS1_CK_RSA_WITH_AES_256_GCM_SHA384 0x0300009D +# define TLS1_CK_DHE_RSA_WITH_AES_128_GCM_SHA256 0x0300009E +# define TLS1_CK_DHE_RSA_WITH_AES_256_GCM_SHA384 0x0300009F +# define TLS1_CK_DH_RSA_WITH_AES_128_GCM_SHA256 0x030000A0 +# define TLS1_CK_DH_RSA_WITH_AES_256_GCM_SHA384 0x030000A1 +# define TLS1_CK_DHE_DSS_WITH_AES_128_GCM_SHA256 0x030000A2 +# define TLS1_CK_DHE_DSS_WITH_AES_256_GCM_SHA384 0x030000A3 +# define TLS1_CK_DH_DSS_WITH_AES_128_GCM_SHA256 0x030000A4 +# define TLS1_CK_DH_DSS_WITH_AES_256_GCM_SHA384 0x030000A5 +# define TLS1_CK_ADH_WITH_AES_128_GCM_SHA256 0x030000A6 +# define TLS1_CK_ADH_WITH_AES_256_GCM_SHA384 0x030000A7 + +/* CCM ciphersuites from RFC6655 */ +# define TLS1_CK_RSA_WITH_AES_128_CCM 0x0300C09C +# define TLS1_CK_RSA_WITH_AES_256_CCM 0x0300C09D +# define TLS1_CK_DHE_RSA_WITH_AES_128_CCM 0x0300C09E +# define TLS1_CK_DHE_RSA_WITH_AES_256_CCM 0x0300C09F +# define TLS1_CK_RSA_WITH_AES_128_CCM_8 0x0300C0A0 +# define TLS1_CK_RSA_WITH_AES_256_CCM_8 0x0300C0A1 +# define TLS1_CK_DHE_RSA_WITH_AES_128_CCM_8 0x0300C0A2 +# define TLS1_CK_DHE_RSA_WITH_AES_256_CCM_8 0x0300C0A3 +# define TLS1_CK_PSK_WITH_AES_128_CCM 0x0300C0A4 +# define TLS1_CK_PSK_WITH_AES_256_CCM 0x0300C0A5 +# define TLS1_CK_DHE_PSK_WITH_AES_128_CCM 0x0300C0A6 +# define TLS1_CK_DHE_PSK_WITH_AES_256_CCM 0x0300C0A7 +# define TLS1_CK_PSK_WITH_AES_128_CCM_8 0x0300C0A8 +# define TLS1_CK_PSK_WITH_AES_256_CCM_8 0x0300C0A9 +# define TLS1_CK_DHE_PSK_WITH_AES_128_CCM_8 0x0300C0AA +# define TLS1_CK_DHE_PSK_WITH_AES_256_CCM_8 0x0300C0AB + +/* CCM ciphersuites from RFC7251 */ +# define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_CCM 0x0300C0AC +# define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_CCM 0x0300C0AD +# define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_CCM_8 0x0300C0AE +# define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_CCM_8 0x0300C0AF + +/* TLS 1.2 Camellia SHA-256 ciphersuites from RFC5932 */ +# define TLS1_CK_RSA_WITH_CAMELLIA_128_CBC_SHA256 0x030000BA +# define TLS1_CK_DH_DSS_WITH_CAMELLIA_128_CBC_SHA256 0x030000BB +# define TLS1_CK_DH_RSA_WITH_CAMELLIA_128_CBC_SHA256 0x030000BC +# define TLS1_CK_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA256 0x030000BD +# define TLS1_CK_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 0x030000BE +# define TLS1_CK_ADH_WITH_CAMELLIA_128_CBC_SHA256 0x030000BF + +# define TLS1_CK_RSA_WITH_CAMELLIA_256_CBC_SHA256 0x030000C0 +# define TLS1_CK_DH_DSS_WITH_CAMELLIA_256_CBC_SHA256 0x030000C1 +# define TLS1_CK_DH_RSA_WITH_CAMELLIA_256_CBC_SHA256 0x030000C2 +# define TLS1_CK_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA256 0x030000C3 +# define TLS1_CK_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256 0x030000C4 +# define TLS1_CK_ADH_WITH_CAMELLIA_256_CBC_SHA256 0x030000C5 + +/* ECC ciphersuites from RFC4492 */ +# define TLS1_CK_ECDH_ECDSA_WITH_NULL_SHA 0x0300C001 +# define TLS1_CK_ECDH_ECDSA_WITH_RC4_128_SHA 0x0300C002 +# define TLS1_CK_ECDH_ECDSA_WITH_DES_192_CBC3_SHA 0x0300C003 +# define TLS1_CK_ECDH_ECDSA_WITH_AES_128_CBC_SHA 0x0300C004 +# define TLS1_CK_ECDH_ECDSA_WITH_AES_256_CBC_SHA 0x0300C005 + +# define TLS1_CK_ECDHE_ECDSA_WITH_NULL_SHA 0x0300C006 +# define TLS1_CK_ECDHE_ECDSA_WITH_RC4_128_SHA 0x0300C007 +# define TLS1_CK_ECDHE_ECDSA_WITH_DES_192_CBC3_SHA 0x0300C008 +# define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_CBC_SHA 0x0300C009 +# define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_CBC_SHA 0x0300C00A + +# define TLS1_CK_ECDH_RSA_WITH_NULL_SHA 0x0300C00B +# define TLS1_CK_ECDH_RSA_WITH_RC4_128_SHA 0x0300C00C +# define TLS1_CK_ECDH_RSA_WITH_DES_192_CBC3_SHA 0x0300C00D +# define TLS1_CK_ECDH_RSA_WITH_AES_128_CBC_SHA 0x0300C00E +# define TLS1_CK_ECDH_RSA_WITH_AES_256_CBC_SHA 0x0300C00F + +# define TLS1_CK_ECDHE_RSA_WITH_NULL_SHA 0x0300C010 +# define TLS1_CK_ECDHE_RSA_WITH_RC4_128_SHA 0x0300C011 +# define TLS1_CK_ECDHE_RSA_WITH_DES_192_CBC3_SHA 0x0300C012 +# define TLS1_CK_ECDHE_RSA_WITH_AES_128_CBC_SHA 0x0300C013 +# define TLS1_CK_ECDHE_RSA_WITH_AES_256_CBC_SHA 0x0300C014 + +# define TLS1_CK_ECDH_anon_WITH_NULL_SHA 0x0300C015 +# define TLS1_CK_ECDH_anon_WITH_RC4_128_SHA 0x0300C016 +# define TLS1_CK_ECDH_anon_WITH_DES_192_CBC3_SHA 0x0300C017 +# define TLS1_CK_ECDH_anon_WITH_AES_128_CBC_SHA 0x0300C018 +# define TLS1_CK_ECDH_anon_WITH_AES_256_CBC_SHA 0x0300C019 + +/* SRP ciphersuites from RFC 5054 */ +# define TLS1_CK_SRP_SHA_WITH_3DES_EDE_CBC_SHA 0x0300C01A +# define TLS1_CK_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA 0x0300C01B +# define TLS1_CK_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA 0x0300C01C +# define TLS1_CK_SRP_SHA_WITH_AES_128_CBC_SHA 0x0300C01D +# define TLS1_CK_SRP_SHA_RSA_WITH_AES_128_CBC_SHA 0x0300C01E +# define TLS1_CK_SRP_SHA_DSS_WITH_AES_128_CBC_SHA 0x0300C01F +# define TLS1_CK_SRP_SHA_WITH_AES_256_CBC_SHA 0x0300C020 +# define TLS1_CK_SRP_SHA_RSA_WITH_AES_256_CBC_SHA 0x0300C021 +# define TLS1_CK_SRP_SHA_DSS_WITH_AES_256_CBC_SHA 0x0300C022 + +/* ECDH HMAC based ciphersuites from RFC5289 */ +# define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_SHA256 0x0300C023 +# define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_SHA384 0x0300C024 +# define TLS1_CK_ECDH_ECDSA_WITH_AES_128_SHA256 0x0300C025 +# define TLS1_CK_ECDH_ECDSA_WITH_AES_256_SHA384 0x0300C026 +# define TLS1_CK_ECDHE_RSA_WITH_AES_128_SHA256 0x0300C027 +# define TLS1_CK_ECDHE_RSA_WITH_AES_256_SHA384 0x0300C028 +# define TLS1_CK_ECDH_RSA_WITH_AES_128_SHA256 0x0300C029 +# define TLS1_CK_ECDH_RSA_WITH_AES_256_SHA384 0x0300C02A + +/* ECDH GCM based ciphersuites from RFC5289 */ +# define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 0x0300C02B +# define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 0x0300C02C +# define TLS1_CK_ECDH_ECDSA_WITH_AES_128_GCM_SHA256 0x0300C02D +# define TLS1_CK_ECDH_ECDSA_WITH_AES_256_GCM_SHA384 0x0300C02E +# define TLS1_CK_ECDHE_RSA_WITH_AES_128_GCM_SHA256 0x0300C02F +# define TLS1_CK_ECDHE_RSA_WITH_AES_256_GCM_SHA384 0x0300C030 +# define TLS1_CK_ECDH_RSA_WITH_AES_128_GCM_SHA256 0x0300C031 +# define TLS1_CK_ECDH_RSA_WITH_AES_256_GCM_SHA384 0x0300C032 + +/* ECDHE PSK ciphersuites from RFC5489 */ +# define TLS1_CK_ECDHE_PSK_WITH_RC4_128_SHA 0x0300C033 +# define TLS1_CK_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA 0x0300C034 +# define TLS1_CK_ECDHE_PSK_WITH_AES_128_CBC_SHA 0x0300C035 +# define TLS1_CK_ECDHE_PSK_WITH_AES_256_CBC_SHA 0x0300C036 + +# define TLS1_CK_ECDHE_PSK_WITH_AES_128_CBC_SHA256 0x0300C037 +# define TLS1_CK_ECDHE_PSK_WITH_AES_256_CBC_SHA384 0x0300C038 + +/* NULL PSK ciphersuites from RFC4785 */ +# define TLS1_CK_ECDHE_PSK_WITH_NULL_SHA 0x0300C039 +# define TLS1_CK_ECDHE_PSK_WITH_NULL_SHA256 0x0300C03A +# define TLS1_CK_ECDHE_PSK_WITH_NULL_SHA384 0x0300C03B + +/* Camellia-CBC ciphersuites from RFC6367 */ +# define TLS1_CK_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 0x0300C072 +# define TLS1_CK_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 0x0300C073 +# define TLS1_CK_ECDH_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 0x0300C074 +# define TLS1_CK_ECDH_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 0x0300C075 +# define TLS1_CK_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 0x0300C076 +# define TLS1_CK_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384 0x0300C077 +# define TLS1_CK_ECDH_RSA_WITH_CAMELLIA_128_CBC_SHA256 0x0300C078 +# define TLS1_CK_ECDH_RSA_WITH_CAMELLIA_256_CBC_SHA384 0x0300C079 + +# define TLS1_CK_PSK_WITH_CAMELLIA_128_CBC_SHA256 0x0300C094 +# define TLS1_CK_PSK_WITH_CAMELLIA_256_CBC_SHA384 0x0300C095 +# define TLS1_CK_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 0x0300C096 +# define TLS1_CK_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 0x0300C097 +# define TLS1_CK_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256 0x0300C098 +# define TLS1_CK_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384 0x0300C099 +# define TLS1_CK_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 0x0300C09A +# define TLS1_CK_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 0x0300C09B + +/* draft-ietf-tls-chacha20-poly1305-03 */ +# define TLS1_CK_ECDHE_RSA_WITH_CHACHA20_POLY1305 0x0300CCA8 +# define TLS1_CK_ECDHE_ECDSA_WITH_CHACHA20_POLY1305 0x0300CCA9 +# define TLS1_CK_DHE_RSA_WITH_CHACHA20_POLY1305 0x0300CCAA +# define TLS1_CK_PSK_WITH_CHACHA20_POLY1305 0x0300CCAB +# define TLS1_CK_ECDHE_PSK_WITH_CHACHA20_POLY1305 0x0300CCAC +# define TLS1_CK_DHE_PSK_WITH_CHACHA20_POLY1305 0x0300CCAD +# define TLS1_CK_RSA_PSK_WITH_CHACHA20_POLY1305 0x0300CCAE + +/* TLS v1.3 ciphersuites */ +# define TLS1_3_CK_AES_128_GCM_SHA256 0x03001301 +# define TLS1_3_CK_AES_256_GCM_SHA384 0x03001302 +# define TLS1_3_CK_CHACHA20_POLY1305_SHA256 0x03001303 +# define TLS1_3_CK_AES_128_CCM_SHA256 0x03001304 +# define TLS1_3_CK_AES_128_CCM_8_SHA256 0x03001305 + +/* Aria ciphersuites from RFC6209 */ +# define TLS1_CK_RSA_WITH_ARIA_128_GCM_SHA256 0x0300C050 +# define TLS1_CK_RSA_WITH_ARIA_256_GCM_SHA384 0x0300C051 +# define TLS1_CK_DHE_RSA_WITH_ARIA_128_GCM_SHA256 0x0300C052 +# define TLS1_CK_DHE_RSA_WITH_ARIA_256_GCM_SHA384 0x0300C053 +# define TLS1_CK_DH_RSA_WITH_ARIA_128_GCM_SHA256 0x0300C054 +# define TLS1_CK_DH_RSA_WITH_ARIA_256_GCM_SHA384 0x0300C055 +# define TLS1_CK_DHE_DSS_WITH_ARIA_128_GCM_SHA256 0x0300C056 +# define TLS1_CK_DHE_DSS_WITH_ARIA_256_GCM_SHA384 0x0300C057 +# define TLS1_CK_DH_DSS_WITH_ARIA_128_GCM_SHA256 0x0300C058 +# define TLS1_CK_DH_DSS_WITH_ARIA_256_GCM_SHA384 0x0300C059 +# define TLS1_CK_DH_anon_WITH_ARIA_128_GCM_SHA256 0x0300C05A +# define TLS1_CK_DH_anon_WITH_ARIA_256_GCM_SHA384 0x0300C05B +# define TLS1_CK_ECDHE_ECDSA_WITH_ARIA_128_GCM_SHA256 0x0300C05C +# define TLS1_CK_ECDHE_ECDSA_WITH_ARIA_256_GCM_SHA384 0x0300C05D +# define TLS1_CK_ECDH_ECDSA_WITH_ARIA_128_GCM_SHA256 0x0300C05E +# define TLS1_CK_ECDH_ECDSA_WITH_ARIA_256_GCM_SHA384 0x0300C05F +# define TLS1_CK_ECDHE_RSA_WITH_ARIA_128_GCM_SHA256 0x0300C060 +# define TLS1_CK_ECDHE_RSA_WITH_ARIA_256_GCM_SHA384 0x0300C061 +# define TLS1_CK_ECDH_RSA_WITH_ARIA_128_GCM_SHA256 0x0300C062 +# define TLS1_CK_ECDH_RSA_WITH_ARIA_256_GCM_SHA384 0x0300C063 +# define TLS1_CK_PSK_WITH_ARIA_128_GCM_SHA256 0x0300C06A +# define TLS1_CK_PSK_WITH_ARIA_256_GCM_SHA384 0x0300C06B +# define TLS1_CK_DHE_PSK_WITH_ARIA_128_GCM_SHA256 0x0300C06C +# define TLS1_CK_DHE_PSK_WITH_ARIA_256_GCM_SHA384 0x0300C06D +# define TLS1_CK_RSA_PSK_WITH_ARIA_128_GCM_SHA256 0x0300C06E +# define TLS1_CK_RSA_PSK_WITH_ARIA_256_GCM_SHA384 0x0300C06F + +/* a bundle of RFC standard cipher names, generated from ssl3_ciphers[] */ +# define TLS1_RFC_RSA_WITH_AES_128_SHA "TLS_RSA_WITH_AES_128_CBC_SHA" +# define TLS1_RFC_DHE_DSS_WITH_AES_128_SHA "TLS_DHE_DSS_WITH_AES_128_CBC_SHA" +# define TLS1_RFC_DHE_RSA_WITH_AES_128_SHA "TLS_DHE_RSA_WITH_AES_128_CBC_SHA" +# define TLS1_RFC_ADH_WITH_AES_128_SHA "TLS_DH_anon_WITH_AES_128_CBC_SHA" +# define TLS1_RFC_RSA_WITH_AES_256_SHA "TLS_RSA_WITH_AES_256_CBC_SHA" +# define TLS1_RFC_DHE_DSS_WITH_AES_256_SHA "TLS_DHE_DSS_WITH_AES_256_CBC_SHA" +# define TLS1_RFC_DHE_RSA_WITH_AES_256_SHA "TLS_DHE_RSA_WITH_AES_256_CBC_SHA" +# define TLS1_RFC_ADH_WITH_AES_256_SHA "TLS_DH_anon_WITH_AES_256_CBC_SHA" +# define TLS1_RFC_RSA_WITH_NULL_SHA256 "TLS_RSA_WITH_NULL_SHA256" +# define TLS1_RFC_RSA_WITH_AES_128_SHA256 "TLS_RSA_WITH_AES_128_CBC_SHA256" +# define TLS1_RFC_RSA_WITH_AES_256_SHA256 "TLS_RSA_WITH_AES_256_CBC_SHA256" +# define TLS1_RFC_DHE_DSS_WITH_AES_128_SHA256 "TLS_DHE_DSS_WITH_AES_128_CBC_SHA256" +# define TLS1_RFC_DHE_RSA_WITH_AES_128_SHA256 "TLS_DHE_RSA_WITH_AES_128_CBC_SHA256" +# define TLS1_RFC_DHE_DSS_WITH_AES_256_SHA256 "TLS_DHE_DSS_WITH_AES_256_CBC_SHA256" +# define TLS1_RFC_DHE_RSA_WITH_AES_256_SHA256 "TLS_DHE_RSA_WITH_AES_256_CBC_SHA256" +# define TLS1_RFC_ADH_WITH_AES_128_SHA256 "TLS_DH_anon_WITH_AES_128_CBC_SHA256" +# define TLS1_RFC_ADH_WITH_AES_256_SHA256 "TLS_DH_anon_WITH_AES_256_CBC_SHA256" +# define TLS1_RFC_RSA_WITH_AES_128_GCM_SHA256 "TLS_RSA_WITH_AES_128_GCM_SHA256" +# define TLS1_RFC_RSA_WITH_AES_256_GCM_SHA384 "TLS_RSA_WITH_AES_256_GCM_SHA384" +# define TLS1_RFC_DHE_RSA_WITH_AES_128_GCM_SHA256 "TLS_DHE_RSA_WITH_AES_128_GCM_SHA256" +# define TLS1_RFC_DHE_RSA_WITH_AES_256_GCM_SHA384 "TLS_DHE_RSA_WITH_AES_256_GCM_SHA384" +# define TLS1_RFC_DHE_DSS_WITH_AES_128_GCM_SHA256 "TLS_DHE_DSS_WITH_AES_128_GCM_SHA256" +# define TLS1_RFC_DHE_DSS_WITH_AES_256_GCM_SHA384 "TLS_DHE_DSS_WITH_AES_256_GCM_SHA384" +# define TLS1_RFC_ADH_WITH_AES_128_GCM_SHA256 "TLS_DH_anon_WITH_AES_128_GCM_SHA256" +# define TLS1_RFC_ADH_WITH_AES_256_GCM_SHA384 "TLS_DH_anon_WITH_AES_256_GCM_SHA384" +# define TLS1_RFC_RSA_WITH_AES_128_CCM "TLS_RSA_WITH_AES_128_CCM" +# define TLS1_RFC_RSA_WITH_AES_256_CCM "TLS_RSA_WITH_AES_256_CCM" +# define TLS1_RFC_DHE_RSA_WITH_AES_128_CCM "TLS_DHE_RSA_WITH_AES_128_CCM" +# define TLS1_RFC_DHE_RSA_WITH_AES_256_CCM "TLS_DHE_RSA_WITH_AES_256_CCM" +# define TLS1_RFC_RSA_WITH_AES_128_CCM_8 "TLS_RSA_WITH_AES_128_CCM_8" +# define TLS1_RFC_RSA_WITH_AES_256_CCM_8 "TLS_RSA_WITH_AES_256_CCM_8" +# define TLS1_RFC_DHE_RSA_WITH_AES_128_CCM_8 "TLS_DHE_RSA_WITH_AES_128_CCM_8" +# define TLS1_RFC_DHE_RSA_WITH_AES_256_CCM_8 "TLS_DHE_RSA_WITH_AES_256_CCM_8" +# define TLS1_RFC_PSK_WITH_AES_128_CCM "TLS_PSK_WITH_AES_128_CCM" +# define TLS1_RFC_PSK_WITH_AES_256_CCM "TLS_PSK_WITH_AES_256_CCM" +# define TLS1_RFC_DHE_PSK_WITH_AES_128_CCM "TLS_DHE_PSK_WITH_AES_128_CCM" +# define TLS1_RFC_DHE_PSK_WITH_AES_256_CCM "TLS_DHE_PSK_WITH_AES_256_CCM" +# define TLS1_RFC_PSK_WITH_AES_128_CCM_8 "TLS_PSK_WITH_AES_128_CCM_8" +# define TLS1_RFC_PSK_WITH_AES_256_CCM_8 "TLS_PSK_WITH_AES_256_CCM_8" +# define TLS1_RFC_DHE_PSK_WITH_AES_128_CCM_8 "TLS_PSK_DHE_WITH_AES_128_CCM_8" +# define TLS1_RFC_DHE_PSK_WITH_AES_256_CCM_8 "TLS_PSK_DHE_WITH_AES_256_CCM_8" +# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_128_CCM "TLS_ECDHE_ECDSA_WITH_AES_128_CCM" +# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_256_CCM "TLS_ECDHE_ECDSA_WITH_AES_256_CCM" +# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_128_CCM_8 "TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8" +# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_256_CCM_8 "TLS_ECDHE_ECDSA_WITH_AES_256_CCM_8" +# define TLS1_3_RFC_AES_128_GCM_SHA256 "TLS_AES_128_GCM_SHA256" +# define TLS1_3_RFC_AES_256_GCM_SHA384 "TLS_AES_256_GCM_SHA384" +# define TLS1_3_RFC_CHACHA20_POLY1305_SHA256 "TLS_CHACHA20_POLY1305_SHA256" +# define TLS1_3_RFC_AES_128_CCM_SHA256 "TLS_AES_128_CCM_SHA256" +# define TLS1_3_RFC_AES_128_CCM_8_SHA256 "TLS_AES_128_CCM_8_SHA256" +# define TLS1_RFC_ECDHE_ECDSA_WITH_NULL_SHA "TLS_ECDHE_ECDSA_WITH_NULL_SHA" +# define TLS1_RFC_ECDHE_ECDSA_WITH_DES_192_CBC3_SHA "TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA" +# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_128_CBC_SHA "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA" +# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_256_CBC_SHA "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA" +# define TLS1_RFC_ECDHE_RSA_WITH_NULL_SHA "TLS_ECDHE_RSA_WITH_NULL_SHA" +# define TLS1_RFC_ECDHE_RSA_WITH_DES_192_CBC3_SHA "TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA" +# define TLS1_RFC_ECDHE_RSA_WITH_AES_128_CBC_SHA "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA" +# define TLS1_RFC_ECDHE_RSA_WITH_AES_256_CBC_SHA "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA" +# define TLS1_RFC_ECDH_anon_WITH_NULL_SHA "TLS_ECDH_anon_WITH_NULL_SHA" +# define TLS1_RFC_ECDH_anon_WITH_DES_192_CBC3_SHA "TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA" +# define TLS1_RFC_ECDH_anon_WITH_AES_128_CBC_SHA "TLS_ECDH_anon_WITH_AES_128_CBC_SHA" +# define TLS1_RFC_ECDH_anon_WITH_AES_256_CBC_SHA "TLS_ECDH_anon_WITH_AES_256_CBC_SHA" +# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_128_SHA256 "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256" +# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_256_SHA384 "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384" +# define TLS1_RFC_ECDHE_RSA_WITH_AES_128_SHA256 "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256" +# define TLS1_RFC_ECDHE_RSA_WITH_AES_256_SHA384 "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384" +# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256" +# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384" +# define TLS1_RFC_ECDHE_RSA_WITH_AES_128_GCM_SHA256 "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256" +# define TLS1_RFC_ECDHE_RSA_WITH_AES_256_GCM_SHA384 "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384" +# define TLS1_RFC_PSK_WITH_NULL_SHA "TLS_PSK_WITH_NULL_SHA" +# define TLS1_RFC_DHE_PSK_WITH_NULL_SHA "TLS_DHE_PSK_WITH_NULL_SHA" +# define TLS1_RFC_RSA_PSK_WITH_NULL_SHA "TLS_RSA_PSK_WITH_NULL_SHA" +# define TLS1_RFC_PSK_WITH_3DES_EDE_CBC_SHA "TLS_PSK_WITH_3DES_EDE_CBC_SHA" +# define TLS1_RFC_PSK_WITH_AES_128_CBC_SHA "TLS_PSK_WITH_AES_128_CBC_SHA" +# define TLS1_RFC_PSK_WITH_AES_256_CBC_SHA "TLS_PSK_WITH_AES_256_CBC_SHA" +# define TLS1_RFC_DHE_PSK_WITH_3DES_EDE_CBC_SHA "TLS_DHE_PSK_WITH_3DES_EDE_CBC_SHA" +# define TLS1_RFC_DHE_PSK_WITH_AES_128_CBC_SHA "TLS_DHE_PSK_WITH_AES_128_CBC_SHA" +# define TLS1_RFC_DHE_PSK_WITH_AES_256_CBC_SHA "TLS_DHE_PSK_WITH_AES_256_CBC_SHA" +# define TLS1_RFC_RSA_PSK_WITH_3DES_EDE_CBC_SHA "TLS_RSA_PSK_WITH_3DES_EDE_CBC_SHA" +# define TLS1_RFC_RSA_PSK_WITH_AES_128_CBC_SHA "TLS_RSA_PSK_WITH_AES_128_CBC_SHA" +# define TLS1_RFC_RSA_PSK_WITH_AES_256_CBC_SHA "TLS_RSA_PSK_WITH_AES_256_CBC_SHA" +# define TLS1_RFC_PSK_WITH_AES_128_GCM_SHA256 "TLS_PSK_WITH_AES_128_GCM_SHA256" +# define TLS1_RFC_PSK_WITH_AES_256_GCM_SHA384 "TLS_PSK_WITH_AES_256_GCM_SHA384" +# define TLS1_RFC_DHE_PSK_WITH_AES_128_GCM_SHA256 "TLS_DHE_PSK_WITH_AES_128_GCM_SHA256" +# define TLS1_RFC_DHE_PSK_WITH_AES_256_GCM_SHA384 "TLS_DHE_PSK_WITH_AES_256_GCM_SHA384" +# define TLS1_RFC_RSA_PSK_WITH_AES_128_GCM_SHA256 "TLS_RSA_PSK_WITH_AES_128_GCM_SHA256" +# define TLS1_RFC_RSA_PSK_WITH_AES_256_GCM_SHA384 "TLS_RSA_PSK_WITH_AES_256_GCM_SHA384" +# define TLS1_RFC_PSK_WITH_AES_128_CBC_SHA256 "TLS_PSK_WITH_AES_128_CBC_SHA256" +# define TLS1_RFC_PSK_WITH_AES_256_CBC_SHA384 "TLS_PSK_WITH_AES_256_CBC_SHA384" +# define TLS1_RFC_PSK_WITH_NULL_SHA256 "TLS_PSK_WITH_NULL_SHA256" +# define TLS1_RFC_PSK_WITH_NULL_SHA384 "TLS_PSK_WITH_NULL_SHA384" +# define TLS1_RFC_DHE_PSK_WITH_AES_128_CBC_SHA256 "TLS_DHE_PSK_WITH_AES_128_CBC_SHA256" +# define TLS1_RFC_DHE_PSK_WITH_AES_256_CBC_SHA384 "TLS_DHE_PSK_WITH_AES_256_CBC_SHA384" +# define TLS1_RFC_DHE_PSK_WITH_NULL_SHA256 "TLS_DHE_PSK_WITH_NULL_SHA256" +# define TLS1_RFC_DHE_PSK_WITH_NULL_SHA384 "TLS_DHE_PSK_WITH_NULL_SHA384" +# define TLS1_RFC_RSA_PSK_WITH_AES_128_CBC_SHA256 "TLS_RSA_PSK_WITH_AES_128_CBC_SHA256" +# define TLS1_RFC_RSA_PSK_WITH_AES_256_CBC_SHA384 "TLS_RSA_PSK_WITH_AES_256_CBC_SHA384" +# define TLS1_RFC_RSA_PSK_WITH_NULL_SHA256 "TLS_RSA_PSK_WITH_NULL_SHA256" +# define TLS1_RFC_RSA_PSK_WITH_NULL_SHA384 "TLS_RSA_PSK_WITH_NULL_SHA384" +# define TLS1_RFC_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA "TLS_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA" +# define TLS1_RFC_ECDHE_PSK_WITH_AES_128_CBC_SHA "TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA" +# define TLS1_RFC_ECDHE_PSK_WITH_AES_256_CBC_SHA "TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA" +# define TLS1_RFC_ECDHE_PSK_WITH_AES_128_CBC_SHA256 "TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256" +# define TLS1_RFC_ECDHE_PSK_WITH_AES_256_CBC_SHA384 "TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA384" +# define TLS1_RFC_ECDHE_PSK_WITH_NULL_SHA "TLS_ECDHE_PSK_WITH_NULL_SHA" +# define TLS1_RFC_ECDHE_PSK_WITH_NULL_SHA256 "TLS_ECDHE_PSK_WITH_NULL_SHA256" +# define TLS1_RFC_ECDHE_PSK_WITH_NULL_SHA384 "TLS_ECDHE_PSK_WITH_NULL_SHA384" +# define TLS1_RFC_SRP_SHA_WITH_3DES_EDE_CBC_SHA "TLS_SRP_SHA_WITH_3DES_EDE_CBC_SHA" +# define TLS1_RFC_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA "TLS_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA" +# define TLS1_RFC_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA "TLS_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA" +# define TLS1_RFC_SRP_SHA_WITH_AES_128_CBC_SHA "TLS_SRP_SHA_WITH_AES_128_CBC_SHA" +# define TLS1_RFC_SRP_SHA_RSA_WITH_AES_128_CBC_SHA "TLS_SRP_SHA_RSA_WITH_AES_128_CBC_SHA" +# define TLS1_RFC_SRP_SHA_DSS_WITH_AES_128_CBC_SHA "TLS_SRP_SHA_DSS_WITH_AES_128_CBC_SHA" +# define TLS1_RFC_SRP_SHA_WITH_AES_256_CBC_SHA "TLS_SRP_SHA_WITH_AES_256_CBC_SHA" +# define TLS1_RFC_SRP_SHA_RSA_WITH_AES_256_CBC_SHA "TLS_SRP_SHA_RSA_WITH_AES_256_CBC_SHA" +# define TLS1_RFC_SRP_SHA_DSS_WITH_AES_256_CBC_SHA "TLS_SRP_SHA_DSS_WITH_AES_256_CBC_SHA" +# define TLS1_RFC_DHE_RSA_WITH_CHACHA20_POLY1305 "TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256" +# define TLS1_RFC_ECDHE_RSA_WITH_CHACHA20_POLY1305 "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256" +# define TLS1_RFC_ECDHE_ECDSA_WITH_CHACHA20_POLY1305 "TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256" +# define TLS1_RFC_PSK_WITH_CHACHA20_POLY1305 "TLS_PSK_WITH_CHACHA20_POLY1305_SHA256" +# define TLS1_RFC_ECDHE_PSK_WITH_CHACHA20_POLY1305 "TLS_ECDHE_PSK_WITH_CHACHA20_POLY1305_SHA256" +# define TLS1_RFC_DHE_PSK_WITH_CHACHA20_POLY1305 "TLS_DHE_PSK_WITH_CHACHA20_POLY1305_SHA256" +# define TLS1_RFC_RSA_PSK_WITH_CHACHA20_POLY1305 "TLS_RSA_PSK_WITH_CHACHA20_POLY1305_SHA256" +# define TLS1_RFC_RSA_WITH_CAMELLIA_128_CBC_SHA256 "TLS_RSA_WITH_CAMELLIA_128_CBC_SHA256" +# define TLS1_RFC_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA256 "TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA256" +# define TLS1_RFC_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 "TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256" +# define TLS1_RFC_ADH_WITH_CAMELLIA_128_CBC_SHA256 "TLS_DH_anon_WITH_CAMELLIA_128_CBC_SHA256" +# define TLS1_RFC_RSA_WITH_CAMELLIA_256_CBC_SHA256 "TLS_RSA_WITH_CAMELLIA_256_CBC_SHA256" +# define TLS1_RFC_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA256 "TLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA256" +# define TLS1_RFC_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256 "TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256" +# define TLS1_RFC_ADH_WITH_CAMELLIA_256_CBC_SHA256 "TLS_DH_anon_WITH_CAMELLIA_256_CBC_SHA256" +# define TLS1_RFC_RSA_WITH_CAMELLIA_256_CBC_SHA "TLS_RSA_WITH_CAMELLIA_256_CBC_SHA" +# define TLS1_RFC_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA "TLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA" +# define TLS1_RFC_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA "TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA" +# define TLS1_RFC_ADH_WITH_CAMELLIA_256_CBC_SHA "TLS_DH_anon_WITH_CAMELLIA_256_CBC_SHA" +# define TLS1_RFC_RSA_WITH_CAMELLIA_128_CBC_SHA "TLS_RSA_WITH_CAMELLIA_128_CBC_SHA" +# define TLS1_RFC_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA "TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA" +# define TLS1_RFC_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA "TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA" +# define TLS1_RFC_ADH_WITH_CAMELLIA_128_CBC_SHA "TLS_DH_anon_WITH_CAMELLIA_128_CBC_SHA" +# define TLS1_RFC_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 "TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256" +# define TLS1_RFC_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 "TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384" +# define TLS1_RFC_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 "TLS_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256" +# define TLS1_RFC_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384 "TLS_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384" +# define TLS1_RFC_PSK_WITH_CAMELLIA_128_CBC_SHA256 "TLS_PSK_WITH_CAMELLIA_128_CBC_SHA256" +# define TLS1_RFC_PSK_WITH_CAMELLIA_256_CBC_SHA384 "TLS_PSK_WITH_CAMELLIA_256_CBC_SHA384" +# define TLS1_RFC_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 "TLS_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256" +# define TLS1_RFC_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 "TLS_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384" +# define TLS1_RFC_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256 "TLS_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256" +# define TLS1_RFC_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384 "TLS_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384" +# define TLS1_RFC_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 "TLS_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256" +# define TLS1_RFC_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 "TLS_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384" +# define TLS1_RFC_RSA_WITH_SEED_SHA "TLS_RSA_WITH_SEED_CBC_SHA" +# define TLS1_RFC_DHE_DSS_WITH_SEED_SHA "TLS_DHE_DSS_WITH_SEED_CBC_SHA" +# define TLS1_RFC_DHE_RSA_WITH_SEED_SHA "TLS_DHE_RSA_WITH_SEED_CBC_SHA" +# define TLS1_RFC_ADH_WITH_SEED_SHA "TLS_DH_anon_WITH_SEED_CBC_SHA" +# define TLS1_RFC_ECDHE_PSK_WITH_RC4_128_SHA "TLS_ECDHE_PSK_WITH_RC4_128_SHA" +# define TLS1_RFC_ECDH_anon_WITH_RC4_128_SHA "TLS_ECDH_anon_WITH_RC4_128_SHA" +# define TLS1_RFC_ECDHE_ECDSA_WITH_RC4_128_SHA "TLS_ECDHE_ECDSA_WITH_RC4_128_SHA" +# define TLS1_RFC_ECDHE_RSA_WITH_RC4_128_SHA "TLS_ECDHE_RSA_WITH_RC4_128_SHA" +# define TLS1_RFC_PSK_WITH_RC4_128_SHA "TLS_PSK_WITH_RC4_128_SHA" +# define TLS1_RFC_RSA_PSK_WITH_RC4_128_SHA "TLS_RSA_PSK_WITH_RC4_128_SHA" +# define TLS1_RFC_DHE_PSK_WITH_RC4_128_SHA "TLS_DHE_PSK_WITH_RC4_128_SHA" +# define TLS1_RFC_RSA_WITH_ARIA_128_GCM_SHA256 "TLS_RSA_WITH_ARIA_128_GCM_SHA256" +# define TLS1_RFC_RSA_WITH_ARIA_256_GCM_SHA384 "TLS_RSA_WITH_ARIA_256_GCM_SHA384" +# define TLS1_RFC_DHE_RSA_WITH_ARIA_128_GCM_SHA256 "TLS_DHE_RSA_WITH_ARIA_128_GCM_SHA256" +# define TLS1_RFC_DHE_RSA_WITH_ARIA_256_GCM_SHA384 "TLS_DHE_RSA_WITH_ARIA_256_GCM_SHA384" +# define TLS1_RFC_DH_RSA_WITH_ARIA_128_GCM_SHA256 "TLS_DH_RSA_WITH_ARIA_128_GCM_SHA256" +# define TLS1_RFC_DH_RSA_WITH_ARIA_256_GCM_SHA384 "TLS_DH_RSA_WITH_ARIA_256_GCM_SHA384" +# define TLS1_RFC_DHE_DSS_WITH_ARIA_128_GCM_SHA256 "TLS_DHE_DSS_WITH_ARIA_128_GCM_SHA256" +# define TLS1_RFC_DHE_DSS_WITH_ARIA_256_GCM_SHA384 "TLS_DHE_DSS_WITH_ARIA_256_GCM_SHA384" +# define TLS1_RFC_DH_DSS_WITH_ARIA_128_GCM_SHA256 "TLS_DH_DSS_WITH_ARIA_128_GCM_SHA256" +# define TLS1_RFC_DH_DSS_WITH_ARIA_256_GCM_SHA384 "TLS_DH_DSS_WITH_ARIA_256_GCM_SHA384" +# define TLS1_RFC_DH_anon_WITH_ARIA_128_GCM_SHA256 "TLS_DH_anon_WITH_ARIA_128_GCM_SHA256" +# define TLS1_RFC_DH_anon_WITH_ARIA_256_GCM_SHA384 "TLS_DH_anon_WITH_ARIA_256_GCM_SHA384" +# define TLS1_RFC_ECDHE_ECDSA_WITH_ARIA_128_GCM_SHA256 "TLS_ECDHE_ECDSA_WITH_ARIA_128_GCM_SHA256" +# define TLS1_RFC_ECDHE_ECDSA_WITH_ARIA_256_GCM_SHA384 "TLS_ECDHE_ECDSA_WITH_ARIA_256_GCM_SHA384" +# define TLS1_RFC_ECDH_ECDSA_WITH_ARIA_128_GCM_SHA256 "TLS_ECDH_ECDSA_WITH_ARIA_128_GCM_SHA256" +# define TLS1_RFC_ECDH_ECDSA_WITH_ARIA_256_GCM_SHA384 "TLS_ECDH_ECDSA_WITH_ARIA_256_GCM_SHA384" +# define TLS1_RFC_ECDHE_RSA_WITH_ARIA_128_GCM_SHA256 "TLS_ECDHE_RSA_WITH_ARIA_128_GCM_SHA256" +# define TLS1_RFC_ECDHE_RSA_WITH_ARIA_256_GCM_SHA384 "TLS_ECDHE_RSA_WITH_ARIA_256_GCM_SHA384" +# define TLS1_RFC_ECDH_RSA_WITH_ARIA_128_GCM_SHA256 "TLS_ECDH_RSA_WITH_ARIA_128_GCM_SHA256" +# define TLS1_RFC_ECDH_RSA_WITH_ARIA_256_GCM_SHA384 "TLS_ECDH_RSA_WITH_ARIA_256_GCM_SHA384" +# define TLS1_RFC_PSK_WITH_ARIA_128_GCM_SHA256 "TLS_PSK_WITH_ARIA_128_GCM_SHA256" +# define TLS1_RFC_PSK_WITH_ARIA_256_GCM_SHA384 "TLS_PSK_WITH_ARIA_256_GCM_SHA384" +# define TLS1_RFC_DHE_PSK_WITH_ARIA_128_GCM_SHA256 "TLS_DHE_PSK_WITH_ARIA_128_GCM_SHA256" +# define TLS1_RFC_DHE_PSK_WITH_ARIA_256_GCM_SHA384 "TLS_DHE_PSK_WITH_ARIA_256_GCM_SHA384" +# define TLS1_RFC_RSA_PSK_WITH_ARIA_128_GCM_SHA256 "TLS_RSA_PSK_WITH_ARIA_128_GCM_SHA256" +# define TLS1_RFC_RSA_PSK_WITH_ARIA_256_GCM_SHA384 "TLS_RSA_PSK_WITH_ARIA_256_GCM_SHA384" + + +/* + * XXX Backward compatibility alert: Older versions of OpenSSL gave some DHE + * ciphers names with "EDH" instead of "DHE". Going forward, we should be + * using DHE everywhere, though we may indefinitely maintain aliases for + * users or configurations that used "EDH" + */ +# define TLS1_TXT_DHE_DSS_WITH_RC4_128_SHA "DHE-DSS-RC4-SHA" + +# define TLS1_TXT_PSK_WITH_NULL_SHA "PSK-NULL-SHA" +# define TLS1_TXT_DHE_PSK_WITH_NULL_SHA "DHE-PSK-NULL-SHA" +# define TLS1_TXT_RSA_PSK_WITH_NULL_SHA "RSA-PSK-NULL-SHA" + +/* AES ciphersuites from RFC3268 */ +# define TLS1_TXT_RSA_WITH_AES_128_SHA "AES128-SHA" +# define TLS1_TXT_DH_DSS_WITH_AES_128_SHA "DH-DSS-AES128-SHA" +# define TLS1_TXT_DH_RSA_WITH_AES_128_SHA "DH-RSA-AES128-SHA" +# define TLS1_TXT_DHE_DSS_WITH_AES_128_SHA "DHE-DSS-AES128-SHA" +# define TLS1_TXT_DHE_RSA_WITH_AES_128_SHA "DHE-RSA-AES128-SHA" +# define TLS1_TXT_ADH_WITH_AES_128_SHA "ADH-AES128-SHA" + +# define TLS1_TXT_RSA_WITH_AES_256_SHA "AES256-SHA" +# define TLS1_TXT_DH_DSS_WITH_AES_256_SHA "DH-DSS-AES256-SHA" +# define TLS1_TXT_DH_RSA_WITH_AES_256_SHA "DH-RSA-AES256-SHA" +# define TLS1_TXT_DHE_DSS_WITH_AES_256_SHA "DHE-DSS-AES256-SHA" +# define TLS1_TXT_DHE_RSA_WITH_AES_256_SHA "DHE-RSA-AES256-SHA" +# define TLS1_TXT_ADH_WITH_AES_256_SHA "ADH-AES256-SHA" + +/* ECC ciphersuites from RFC4492 */ +# define TLS1_TXT_ECDH_ECDSA_WITH_NULL_SHA "ECDH-ECDSA-NULL-SHA" +# define TLS1_TXT_ECDH_ECDSA_WITH_RC4_128_SHA "ECDH-ECDSA-RC4-SHA" +# define TLS1_TXT_ECDH_ECDSA_WITH_DES_192_CBC3_SHA "ECDH-ECDSA-DES-CBC3-SHA" +# define TLS1_TXT_ECDH_ECDSA_WITH_AES_128_CBC_SHA "ECDH-ECDSA-AES128-SHA" +# define TLS1_TXT_ECDH_ECDSA_WITH_AES_256_CBC_SHA "ECDH-ECDSA-AES256-SHA" + +# define TLS1_TXT_ECDHE_ECDSA_WITH_NULL_SHA "ECDHE-ECDSA-NULL-SHA" +# define TLS1_TXT_ECDHE_ECDSA_WITH_RC4_128_SHA "ECDHE-ECDSA-RC4-SHA" +# define TLS1_TXT_ECDHE_ECDSA_WITH_DES_192_CBC3_SHA "ECDHE-ECDSA-DES-CBC3-SHA" +# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_CBC_SHA "ECDHE-ECDSA-AES128-SHA" +# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_CBC_SHA "ECDHE-ECDSA-AES256-SHA" + +# define TLS1_TXT_ECDH_RSA_WITH_NULL_SHA "ECDH-RSA-NULL-SHA" +# define TLS1_TXT_ECDH_RSA_WITH_RC4_128_SHA "ECDH-RSA-RC4-SHA" +# define TLS1_TXT_ECDH_RSA_WITH_DES_192_CBC3_SHA "ECDH-RSA-DES-CBC3-SHA" +# define TLS1_TXT_ECDH_RSA_WITH_AES_128_CBC_SHA "ECDH-RSA-AES128-SHA" +# define TLS1_TXT_ECDH_RSA_WITH_AES_256_CBC_SHA "ECDH-RSA-AES256-SHA" + +# define TLS1_TXT_ECDHE_RSA_WITH_NULL_SHA "ECDHE-RSA-NULL-SHA" +# define TLS1_TXT_ECDHE_RSA_WITH_RC4_128_SHA "ECDHE-RSA-RC4-SHA" +# define TLS1_TXT_ECDHE_RSA_WITH_DES_192_CBC3_SHA "ECDHE-RSA-DES-CBC3-SHA" +# define TLS1_TXT_ECDHE_RSA_WITH_AES_128_CBC_SHA "ECDHE-RSA-AES128-SHA" +# define TLS1_TXT_ECDHE_RSA_WITH_AES_256_CBC_SHA "ECDHE-RSA-AES256-SHA" + +# define TLS1_TXT_ECDH_anon_WITH_NULL_SHA "AECDH-NULL-SHA" +# define TLS1_TXT_ECDH_anon_WITH_RC4_128_SHA "AECDH-RC4-SHA" +# define TLS1_TXT_ECDH_anon_WITH_DES_192_CBC3_SHA "AECDH-DES-CBC3-SHA" +# define TLS1_TXT_ECDH_anon_WITH_AES_128_CBC_SHA "AECDH-AES128-SHA" +# define TLS1_TXT_ECDH_anon_WITH_AES_256_CBC_SHA "AECDH-AES256-SHA" + +/* PSK ciphersuites from RFC 4279 */ +# define TLS1_TXT_PSK_WITH_RC4_128_SHA "PSK-RC4-SHA" +# define TLS1_TXT_PSK_WITH_3DES_EDE_CBC_SHA "PSK-3DES-EDE-CBC-SHA" +# define TLS1_TXT_PSK_WITH_AES_128_CBC_SHA "PSK-AES128-CBC-SHA" +# define TLS1_TXT_PSK_WITH_AES_256_CBC_SHA "PSK-AES256-CBC-SHA" + +# define TLS1_TXT_DHE_PSK_WITH_RC4_128_SHA "DHE-PSK-RC4-SHA" +# define TLS1_TXT_DHE_PSK_WITH_3DES_EDE_CBC_SHA "DHE-PSK-3DES-EDE-CBC-SHA" +# define TLS1_TXT_DHE_PSK_WITH_AES_128_CBC_SHA "DHE-PSK-AES128-CBC-SHA" +# define TLS1_TXT_DHE_PSK_WITH_AES_256_CBC_SHA "DHE-PSK-AES256-CBC-SHA" +# define TLS1_TXT_RSA_PSK_WITH_RC4_128_SHA "RSA-PSK-RC4-SHA" +# define TLS1_TXT_RSA_PSK_WITH_3DES_EDE_CBC_SHA "RSA-PSK-3DES-EDE-CBC-SHA" +# define TLS1_TXT_RSA_PSK_WITH_AES_128_CBC_SHA "RSA-PSK-AES128-CBC-SHA" +# define TLS1_TXT_RSA_PSK_WITH_AES_256_CBC_SHA "RSA-PSK-AES256-CBC-SHA" + +/* PSK ciphersuites from RFC 5487 */ +# define TLS1_TXT_PSK_WITH_AES_128_GCM_SHA256 "PSK-AES128-GCM-SHA256" +# define TLS1_TXT_PSK_WITH_AES_256_GCM_SHA384 "PSK-AES256-GCM-SHA384" +# define TLS1_TXT_DHE_PSK_WITH_AES_128_GCM_SHA256 "DHE-PSK-AES128-GCM-SHA256" +# define TLS1_TXT_DHE_PSK_WITH_AES_256_GCM_SHA384 "DHE-PSK-AES256-GCM-SHA384" +# define TLS1_TXT_RSA_PSK_WITH_AES_128_GCM_SHA256 "RSA-PSK-AES128-GCM-SHA256" +# define TLS1_TXT_RSA_PSK_WITH_AES_256_GCM_SHA384 "RSA-PSK-AES256-GCM-SHA384" + +# define TLS1_TXT_PSK_WITH_AES_128_CBC_SHA256 "PSK-AES128-CBC-SHA256" +# define TLS1_TXT_PSK_WITH_AES_256_CBC_SHA384 "PSK-AES256-CBC-SHA384" +# define TLS1_TXT_PSK_WITH_NULL_SHA256 "PSK-NULL-SHA256" +# define TLS1_TXT_PSK_WITH_NULL_SHA384 "PSK-NULL-SHA384" + +# define TLS1_TXT_DHE_PSK_WITH_AES_128_CBC_SHA256 "DHE-PSK-AES128-CBC-SHA256" +# define TLS1_TXT_DHE_PSK_WITH_AES_256_CBC_SHA384 "DHE-PSK-AES256-CBC-SHA384" +# define TLS1_TXT_DHE_PSK_WITH_NULL_SHA256 "DHE-PSK-NULL-SHA256" +# define TLS1_TXT_DHE_PSK_WITH_NULL_SHA384 "DHE-PSK-NULL-SHA384" + +# define TLS1_TXT_RSA_PSK_WITH_AES_128_CBC_SHA256 "RSA-PSK-AES128-CBC-SHA256" +# define TLS1_TXT_RSA_PSK_WITH_AES_256_CBC_SHA384 "RSA-PSK-AES256-CBC-SHA384" +# define TLS1_TXT_RSA_PSK_WITH_NULL_SHA256 "RSA-PSK-NULL-SHA256" +# define TLS1_TXT_RSA_PSK_WITH_NULL_SHA384 "RSA-PSK-NULL-SHA384" + +/* SRP ciphersuite from RFC 5054 */ +# define TLS1_TXT_SRP_SHA_WITH_3DES_EDE_CBC_SHA "SRP-3DES-EDE-CBC-SHA" +# define TLS1_TXT_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA "SRP-RSA-3DES-EDE-CBC-SHA" +# define TLS1_TXT_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA "SRP-DSS-3DES-EDE-CBC-SHA" +# define TLS1_TXT_SRP_SHA_WITH_AES_128_CBC_SHA "SRP-AES-128-CBC-SHA" +# define TLS1_TXT_SRP_SHA_RSA_WITH_AES_128_CBC_SHA "SRP-RSA-AES-128-CBC-SHA" +# define TLS1_TXT_SRP_SHA_DSS_WITH_AES_128_CBC_SHA "SRP-DSS-AES-128-CBC-SHA" +# define TLS1_TXT_SRP_SHA_WITH_AES_256_CBC_SHA "SRP-AES-256-CBC-SHA" +# define TLS1_TXT_SRP_SHA_RSA_WITH_AES_256_CBC_SHA "SRP-RSA-AES-256-CBC-SHA" +# define TLS1_TXT_SRP_SHA_DSS_WITH_AES_256_CBC_SHA "SRP-DSS-AES-256-CBC-SHA" + +/* Camellia ciphersuites from RFC4132 */ +# define TLS1_TXT_RSA_WITH_CAMELLIA_128_CBC_SHA "CAMELLIA128-SHA" +# define TLS1_TXT_DH_DSS_WITH_CAMELLIA_128_CBC_SHA "DH-DSS-CAMELLIA128-SHA" +# define TLS1_TXT_DH_RSA_WITH_CAMELLIA_128_CBC_SHA "DH-RSA-CAMELLIA128-SHA" +# define TLS1_TXT_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA "DHE-DSS-CAMELLIA128-SHA" +# define TLS1_TXT_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA "DHE-RSA-CAMELLIA128-SHA" +# define TLS1_TXT_ADH_WITH_CAMELLIA_128_CBC_SHA "ADH-CAMELLIA128-SHA" + +# define TLS1_TXT_RSA_WITH_CAMELLIA_256_CBC_SHA "CAMELLIA256-SHA" +# define TLS1_TXT_DH_DSS_WITH_CAMELLIA_256_CBC_SHA "DH-DSS-CAMELLIA256-SHA" +# define TLS1_TXT_DH_RSA_WITH_CAMELLIA_256_CBC_SHA "DH-RSA-CAMELLIA256-SHA" +# define TLS1_TXT_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA "DHE-DSS-CAMELLIA256-SHA" +# define TLS1_TXT_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA "DHE-RSA-CAMELLIA256-SHA" +# define TLS1_TXT_ADH_WITH_CAMELLIA_256_CBC_SHA "ADH-CAMELLIA256-SHA" + +/* TLS 1.2 Camellia SHA-256 ciphersuites from RFC5932 */ +# define TLS1_TXT_RSA_WITH_CAMELLIA_128_CBC_SHA256 "CAMELLIA128-SHA256" +# define TLS1_TXT_DH_DSS_WITH_CAMELLIA_128_CBC_SHA256 "DH-DSS-CAMELLIA128-SHA256" +# define TLS1_TXT_DH_RSA_WITH_CAMELLIA_128_CBC_SHA256 "DH-RSA-CAMELLIA128-SHA256" +# define TLS1_TXT_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA256 "DHE-DSS-CAMELLIA128-SHA256" +# define TLS1_TXT_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 "DHE-RSA-CAMELLIA128-SHA256" +# define TLS1_TXT_ADH_WITH_CAMELLIA_128_CBC_SHA256 "ADH-CAMELLIA128-SHA256" + +# define TLS1_TXT_RSA_WITH_CAMELLIA_256_CBC_SHA256 "CAMELLIA256-SHA256" +# define TLS1_TXT_DH_DSS_WITH_CAMELLIA_256_CBC_SHA256 "DH-DSS-CAMELLIA256-SHA256" +# define TLS1_TXT_DH_RSA_WITH_CAMELLIA_256_CBC_SHA256 "DH-RSA-CAMELLIA256-SHA256" +# define TLS1_TXT_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA256 "DHE-DSS-CAMELLIA256-SHA256" +# define TLS1_TXT_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256 "DHE-RSA-CAMELLIA256-SHA256" +# define TLS1_TXT_ADH_WITH_CAMELLIA_256_CBC_SHA256 "ADH-CAMELLIA256-SHA256" + +# define TLS1_TXT_PSK_WITH_CAMELLIA_128_CBC_SHA256 "PSK-CAMELLIA128-SHA256" +# define TLS1_TXT_PSK_WITH_CAMELLIA_256_CBC_SHA384 "PSK-CAMELLIA256-SHA384" +# define TLS1_TXT_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 "DHE-PSK-CAMELLIA128-SHA256" +# define TLS1_TXT_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 "DHE-PSK-CAMELLIA256-SHA384" +# define TLS1_TXT_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256 "RSA-PSK-CAMELLIA128-SHA256" +# define TLS1_TXT_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384 "RSA-PSK-CAMELLIA256-SHA384" +# define TLS1_TXT_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 "ECDHE-PSK-CAMELLIA128-SHA256" +# define TLS1_TXT_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 "ECDHE-PSK-CAMELLIA256-SHA384" + +/* SEED ciphersuites from RFC4162 */ +# define TLS1_TXT_RSA_WITH_SEED_SHA "SEED-SHA" +# define TLS1_TXT_DH_DSS_WITH_SEED_SHA "DH-DSS-SEED-SHA" +# define TLS1_TXT_DH_RSA_WITH_SEED_SHA "DH-RSA-SEED-SHA" +# define TLS1_TXT_DHE_DSS_WITH_SEED_SHA "DHE-DSS-SEED-SHA" +# define TLS1_TXT_DHE_RSA_WITH_SEED_SHA "DHE-RSA-SEED-SHA" +# define TLS1_TXT_ADH_WITH_SEED_SHA "ADH-SEED-SHA" + +/* TLS v1.2 ciphersuites */ +# define TLS1_TXT_RSA_WITH_NULL_SHA256 "NULL-SHA256" +# define TLS1_TXT_RSA_WITH_AES_128_SHA256 "AES128-SHA256" +# define TLS1_TXT_RSA_WITH_AES_256_SHA256 "AES256-SHA256" +# define TLS1_TXT_DH_DSS_WITH_AES_128_SHA256 "DH-DSS-AES128-SHA256" +# define TLS1_TXT_DH_RSA_WITH_AES_128_SHA256 "DH-RSA-AES128-SHA256" +# define TLS1_TXT_DHE_DSS_WITH_AES_128_SHA256 "DHE-DSS-AES128-SHA256" +# define TLS1_TXT_DHE_RSA_WITH_AES_128_SHA256 "DHE-RSA-AES128-SHA256" +# define TLS1_TXT_DH_DSS_WITH_AES_256_SHA256 "DH-DSS-AES256-SHA256" +# define TLS1_TXT_DH_RSA_WITH_AES_256_SHA256 "DH-RSA-AES256-SHA256" +# define TLS1_TXT_DHE_DSS_WITH_AES_256_SHA256 "DHE-DSS-AES256-SHA256" +# define TLS1_TXT_DHE_RSA_WITH_AES_256_SHA256 "DHE-RSA-AES256-SHA256" +# define TLS1_TXT_ADH_WITH_AES_128_SHA256 "ADH-AES128-SHA256" +# define TLS1_TXT_ADH_WITH_AES_256_SHA256 "ADH-AES256-SHA256" + +/* TLS v1.2 GCM ciphersuites from RFC5288 */ +# define TLS1_TXT_RSA_WITH_AES_128_GCM_SHA256 "AES128-GCM-SHA256" +# define TLS1_TXT_RSA_WITH_AES_256_GCM_SHA384 "AES256-GCM-SHA384" +# define TLS1_TXT_DHE_RSA_WITH_AES_128_GCM_SHA256 "DHE-RSA-AES128-GCM-SHA256" +# define TLS1_TXT_DHE_RSA_WITH_AES_256_GCM_SHA384 "DHE-RSA-AES256-GCM-SHA384" +# define TLS1_TXT_DH_RSA_WITH_AES_128_GCM_SHA256 "DH-RSA-AES128-GCM-SHA256" +# define TLS1_TXT_DH_RSA_WITH_AES_256_GCM_SHA384 "DH-RSA-AES256-GCM-SHA384" +# define TLS1_TXT_DHE_DSS_WITH_AES_128_GCM_SHA256 "DHE-DSS-AES128-GCM-SHA256" +# define TLS1_TXT_DHE_DSS_WITH_AES_256_GCM_SHA384 "DHE-DSS-AES256-GCM-SHA384" +# define TLS1_TXT_DH_DSS_WITH_AES_128_GCM_SHA256 "DH-DSS-AES128-GCM-SHA256" +# define TLS1_TXT_DH_DSS_WITH_AES_256_GCM_SHA384 "DH-DSS-AES256-GCM-SHA384" +# define TLS1_TXT_ADH_WITH_AES_128_GCM_SHA256 "ADH-AES128-GCM-SHA256" +# define TLS1_TXT_ADH_WITH_AES_256_GCM_SHA384 "ADH-AES256-GCM-SHA384" + +/* CCM ciphersuites from RFC6655 */ +# define TLS1_TXT_RSA_WITH_AES_128_CCM "AES128-CCM" +# define TLS1_TXT_RSA_WITH_AES_256_CCM "AES256-CCM" +# define TLS1_TXT_DHE_RSA_WITH_AES_128_CCM "DHE-RSA-AES128-CCM" +# define TLS1_TXT_DHE_RSA_WITH_AES_256_CCM "DHE-RSA-AES256-CCM" + +# define TLS1_TXT_RSA_WITH_AES_128_CCM_8 "AES128-CCM8" +# define TLS1_TXT_RSA_WITH_AES_256_CCM_8 "AES256-CCM8" +# define TLS1_TXT_DHE_RSA_WITH_AES_128_CCM_8 "DHE-RSA-AES128-CCM8" +# define TLS1_TXT_DHE_RSA_WITH_AES_256_CCM_8 "DHE-RSA-AES256-CCM8" + +# define TLS1_TXT_PSK_WITH_AES_128_CCM "PSK-AES128-CCM" +# define TLS1_TXT_PSK_WITH_AES_256_CCM "PSK-AES256-CCM" +# define TLS1_TXT_DHE_PSK_WITH_AES_128_CCM "DHE-PSK-AES128-CCM" +# define TLS1_TXT_DHE_PSK_WITH_AES_256_CCM "DHE-PSK-AES256-CCM" + +# define TLS1_TXT_PSK_WITH_AES_128_CCM_8 "PSK-AES128-CCM8" +# define TLS1_TXT_PSK_WITH_AES_256_CCM_8 "PSK-AES256-CCM8" +# define TLS1_TXT_DHE_PSK_WITH_AES_128_CCM_8 "DHE-PSK-AES128-CCM8" +# define TLS1_TXT_DHE_PSK_WITH_AES_256_CCM_8 "DHE-PSK-AES256-CCM8" + +/* CCM ciphersuites from RFC7251 */ +# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_CCM "ECDHE-ECDSA-AES128-CCM" +# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_CCM "ECDHE-ECDSA-AES256-CCM" +# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_CCM_8 "ECDHE-ECDSA-AES128-CCM8" +# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_CCM_8 "ECDHE-ECDSA-AES256-CCM8" + +/* ECDH HMAC based ciphersuites from RFC5289 */ +# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_SHA256 "ECDHE-ECDSA-AES128-SHA256" +# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_SHA384 "ECDHE-ECDSA-AES256-SHA384" +# define TLS1_TXT_ECDH_ECDSA_WITH_AES_128_SHA256 "ECDH-ECDSA-AES128-SHA256" +# define TLS1_TXT_ECDH_ECDSA_WITH_AES_256_SHA384 "ECDH-ECDSA-AES256-SHA384" +# define TLS1_TXT_ECDHE_RSA_WITH_AES_128_SHA256 "ECDHE-RSA-AES128-SHA256" +# define TLS1_TXT_ECDHE_RSA_WITH_AES_256_SHA384 "ECDHE-RSA-AES256-SHA384" +# define TLS1_TXT_ECDH_RSA_WITH_AES_128_SHA256 "ECDH-RSA-AES128-SHA256" +# define TLS1_TXT_ECDH_RSA_WITH_AES_256_SHA384 "ECDH-RSA-AES256-SHA384" + +/* ECDH GCM based ciphersuites from RFC5289 */ +# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 "ECDHE-ECDSA-AES128-GCM-SHA256" +# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 "ECDHE-ECDSA-AES256-GCM-SHA384" +# define TLS1_TXT_ECDH_ECDSA_WITH_AES_128_GCM_SHA256 "ECDH-ECDSA-AES128-GCM-SHA256" +# define TLS1_TXT_ECDH_ECDSA_WITH_AES_256_GCM_SHA384 "ECDH-ECDSA-AES256-GCM-SHA384" +# define TLS1_TXT_ECDHE_RSA_WITH_AES_128_GCM_SHA256 "ECDHE-RSA-AES128-GCM-SHA256" +# define TLS1_TXT_ECDHE_RSA_WITH_AES_256_GCM_SHA384 "ECDHE-RSA-AES256-GCM-SHA384" +# define TLS1_TXT_ECDH_RSA_WITH_AES_128_GCM_SHA256 "ECDH-RSA-AES128-GCM-SHA256" +# define TLS1_TXT_ECDH_RSA_WITH_AES_256_GCM_SHA384 "ECDH-RSA-AES256-GCM-SHA384" + +/* TLS v1.2 PSK GCM ciphersuites from RFC5487 */ +# define TLS1_TXT_PSK_WITH_AES_128_GCM_SHA256 "PSK-AES128-GCM-SHA256" +# define TLS1_TXT_PSK_WITH_AES_256_GCM_SHA384 "PSK-AES256-GCM-SHA384" + +/* ECDHE PSK ciphersuites from RFC 5489 */ +# define TLS1_TXT_ECDHE_PSK_WITH_RC4_128_SHA "ECDHE-PSK-RC4-SHA" +# define TLS1_TXT_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA "ECDHE-PSK-3DES-EDE-CBC-SHA" +# define TLS1_TXT_ECDHE_PSK_WITH_AES_128_CBC_SHA "ECDHE-PSK-AES128-CBC-SHA" +# define TLS1_TXT_ECDHE_PSK_WITH_AES_256_CBC_SHA "ECDHE-PSK-AES256-CBC-SHA" + +# define TLS1_TXT_ECDHE_PSK_WITH_AES_128_CBC_SHA256 "ECDHE-PSK-AES128-CBC-SHA256" +# define TLS1_TXT_ECDHE_PSK_WITH_AES_256_CBC_SHA384 "ECDHE-PSK-AES256-CBC-SHA384" + +# define TLS1_TXT_ECDHE_PSK_WITH_NULL_SHA "ECDHE-PSK-NULL-SHA" +# define TLS1_TXT_ECDHE_PSK_WITH_NULL_SHA256 "ECDHE-PSK-NULL-SHA256" +# define TLS1_TXT_ECDHE_PSK_WITH_NULL_SHA384 "ECDHE-PSK-NULL-SHA384" + +/* Camellia-CBC ciphersuites from RFC6367 */ +# define TLS1_TXT_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 "ECDHE-ECDSA-CAMELLIA128-SHA256" +# define TLS1_TXT_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 "ECDHE-ECDSA-CAMELLIA256-SHA384" +# define TLS1_TXT_ECDH_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 "ECDH-ECDSA-CAMELLIA128-SHA256" +# define TLS1_TXT_ECDH_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 "ECDH-ECDSA-CAMELLIA256-SHA384" +# define TLS1_TXT_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 "ECDHE-RSA-CAMELLIA128-SHA256" +# define TLS1_TXT_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384 "ECDHE-RSA-CAMELLIA256-SHA384" +# define TLS1_TXT_ECDH_RSA_WITH_CAMELLIA_128_CBC_SHA256 "ECDH-RSA-CAMELLIA128-SHA256" +# define TLS1_TXT_ECDH_RSA_WITH_CAMELLIA_256_CBC_SHA384 "ECDH-RSA-CAMELLIA256-SHA384" + +/* draft-ietf-tls-chacha20-poly1305-03 */ +# define TLS1_TXT_ECDHE_RSA_WITH_CHACHA20_POLY1305 "ECDHE-RSA-CHACHA20-POLY1305" +# define TLS1_TXT_ECDHE_ECDSA_WITH_CHACHA20_POLY1305 "ECDHE-ECDSA-CHACHA20-POLY1305" +# define TLS1_TXT_DHE_RSA_WITH_CHACHA20_POLY1305 "DHE-RSA-CHACHA20-POLY1305" +# define TLS1_TXT_PSK_WITH_CHACHA20_POLY1305 "PSK-CHACHA20-POLY1305" +# define TLS1_TXT_ECDHE_PSK_WITH_CHACHA20_POLY1305 "ECDHE-PSK-CHACHA20-POLY1305" +# define TLS1_TXT_DHE_PSK_WITH_CHACHA20_POLY1305 "DHE-PSK-CHACHA20-POLY1305" +# define TLS1_TXT_RSA_PSK_WITH_CHACHA20_POLY1305 "RSA-PSK-CHACHA20-POLY1305" + +/* Aria ciphersuites from RFC6209 */ +# define TLS1_TXT_RSA_WITH_ARIA_128_GCM_SHA256 "ARIA128-GCM-SHA256" +# define TLS1_TXT_RSA_WITH_ARIA_256_GCM_SHA384 "ARIA256-GCM-SHA384" +# define TLS1_TXT_DHE_RSA_WITH_ARIA_128_GCM_SHA256 "DHE-RSA-ARIA128-GCM-SHA256" +# define TLS1_TXT_DHE_RSA_WITH_ARIA_256_GCM_SHA384 "DHE-RSA-ARIA256-GCM-SHA384" +# define TLS1_TXT_DH_RSA_WITH_ARIA_128_GCM_SHA256 "DH-RSA-ARIA128-GCM-SHA256" +# define TLS1_TXT_DH_RSA_WITH_ARIA_256_GCM_SHA384 "DH-RSA-ARIA256-GCM-SHA384" +# define TLS1_TXT_DHE_DSS_WITH_ARIA_128_GCM_SHA256 "DHE-DSS-ARIA128-GCM-SHA256" +# define TLS1_TXT_DHE_DSS_WITH_ARIA_256_GCM_SHA384 "DHE-DSS-ARIA256-GCM-SHA384" +# define TLS1_TXT_DH_DSS_WITH_ARIA_128_GCM_SHA256 "DH-DSS-ARIA128-GCM-SHA256" +# define TLS1_TXT_DH_DSS_WITH_ARIA_256_GCM_SHA384 "DH-DSS-ARIA256-GCM-SHA384" +# define TLS1_TXT_DH_anon_WITH_ARIA_128_GCM_SHA256 "ADH-ARIA128-GCM-SHA256" +# define TLS1_TXT_DH_anon_WITH_ARIA_256_GCM_SHA384 "ADH-ARIA256-GCM-SHA384" +# define TLS1_TXT_ECDHE_ECDSA_WITH_ARIA_128_GCM_SHA256 "ECDHE-ECDSA-ARIA128-GCM-SHA256" +# define TLS1_TXT_ECDHE_ECDSA_WITH_ARIA_256_GCM_SHA384 "ECDHE-ECDSA-ARIA256-GCM-SHA384" +# define TLS1_TXT_ECDH_ECDSA_WITH_ARIA_128_GCM_SHA256 "ECDH-ECDSA-ARIA128-GCM-SHA256" +# define TLS1_TXT_ECDH_ECDSA_WITH_ARIA_256_GCM_SHA384 "ECDH-ECDSA-ARIA256-GCM-SHA384" +# define TLS1_TXT_ECDHE_RSA_WITH_ARIA_128_GCM_SHA256 "ECDHE-ARIA128-GCM-SHA256" +# define TLS1_TXT_ECDHE_RSA_WITH_ARIA_256_GCM_SHA384 "ECDHE-ARIA256-GCM-SHA384" +# define TLS1_TXT_ECDH_RSA_WITH_ARIA_128_GCM_SHA256 "ECDH-ARIA128-GCM-SHA256" +# define TLS1_TXT_ECDH_RSA_WITH_ARIA_256_GCM_SHA384 "ECDH-ARIA256-GCM-SHA384" +# define TLS1_TXT_PSK_WITH_ARIA_128_GCM_SHA256 "PSK-ARIA128-GCM-SHA256" +# define TLS1_TXT_PSK_WITH_ARIA_256_GCM_SHA384 "PSK-ARIA256-GCM-SHA384" +# define TLS1_TXT_DHE_PSK_WITH_ARIA_128_GCM_SHA256 "DHE-PSK-ARIA128-GCM-SHA256" +# define TLS1_TXT_DHE_PSK_WITH_ARIA_256_GCM_SHA384 "DHE-PSK-ARIA256-GCM-SHA384" +# define TLS1_TXT_RSA_PSK_WITH_ARIA_128_GCM_SHA256 "RSA-PSK-ARIA128-GCM-SHA256" +# define TLS1_TXT_RSA_PSK_WITH_ARIA_256_GCM_SHA384 "RSA-PSK-ARIA256-GCM-SHA384" + +# define TLS_CT_RSA_SIGN 1 +# define TLS_CT_DSS_SIGN 2 +# define TLS_CT_RSA_FIXED_DH 3 +# define TLS_CT_DSS_FIXED_DH 4 +# define TLS_CT_ECDSA_SIGN 64 +# define TLS_CT_RSA_FIXED_ECDH 65 +# define TLS_CT_ECDSA_FIXED_ECDH 66 +# define TLS_CT_GOST01_SIGN 22 +# define TLS_CT_GOST12_SIGN 238 +# define TLS_CT_GOST12_512_SIGN 239 + +/* + * when correcting this number, correct also SSL3_CT_NUMBER in ssl3.h (see + * comment there) + */ +# define TLS_CT_NUMBER 10 + +# if defined(SSL3_CT_NUMBER) +# if TLS_CT_NUMBER != SSL3_CT_NUMBER +# error "SSL/TLS CT_NUMBER values do not match" +# endif +# endif + +# define TLS1_FINISH_MAC_LENGTH 12 + +# define TLS_MD_MAX_CONST_SIZE 22 +# define TLS_MD_CLIENT_FINISH_CONST "client finished" +# define TLS_MD_CLIENT_FINISH_CONST_SIZE 15 +# define TLS_MD_SERVER_FINISH_CONST "server finished" +# define TLS_MD_SERVER_FINISH_CONST_SIZE 15 +# define TLS_MD_KEY_EXPANSION_CONST "key expansion" +# define TLS_MD_KEY_EXPANSION_CONST_SIZE 13 +# define TLS_MD_CLIENT_WRITE_KEY_CONST "client write key" +# define TLS_MD_CLIENT_WRITE_KEY_CONST_SIZE 16 +# define TLS_MD_SERVER_WRITE_KEY_CONST "server write key" +# define TLS_MD_SERVER_WRITE_KEY_CONST_SIZE 16 +# define TLS_MD_IV_BLOCK_CONST "IV block" +# define TLS_MD_IV_BLOCK_CONST_SIZE 8 +# define TLS_MD_MASTER_SECRET_CONST "master secret" +# define TLS_MD_MASTER_SECRET_CONST_SIZE 13 +# define TLS_MD_EXTENDED_MASTER_SECRET_CONST "extended master secret" +# define TLS_MD_EXTENDED_MASTER_SECRET_CONST_SIZE 22 + +# ifdef CHARSET_EBCDIC +# undef TLS_MD_CLIENT_FINISH_CONST +/* + * client finished + */ +# define TLS_MD_CLIENT_FINISH_CONST "\x63\x6c\x69\x65\x6e\x74\x20\x66\x69\x6e\x69\x73\x68\x65\x64" + +# undef TLS_MD_SERVER_FINISH_CONST +/* + * server finished + */ +# define TLS_MD_SERVER_FINISH_CONST "\x73\x65\x72\x76\x65\x72\x20\x66\x69\x6e\x69\x73\x68\x65\x64" + +# undef TLS_MD_SERVER_WRITE_KEY_CONST +/* + * server write key + */ +# define TLS_MD_SERVER_WRITE_KEY_CONST "\x73\x65\x72\x76\x65\x72\x20\x77\x72\x69\x74\x65\x20\x6b\x65\x79" + +# undef TLS_MD_KEY_EXPANSION_CONST +/* + * key expansion + */ +# define TLS_MD_KEY_EXPANSION_CONST "\x6b\x65\x79\x20\x65\x78\x70\x61\x6e\x73\x69\x6f\x6e" + +# undef TLS_MD_CLIENT_WRITE_KEY_CONST +/* + * client write key + */ +# define TLS_MD_CLIENT_WRITE_KEY_CONST "\x63\x6c\x69\x65\x6e\x74\x20\x77\x72\x69\x74\x65\x20\x6b\x65\x79" + +# undef TLS_MD_SERVER_WRITE_KEY_CONST +/* + * server write key + */ +# define TLS_MD_SERVER_WRITE_KEY_CONST "\x73\x65\x72\x76\x65\x72\x20\x77\x72\x69\x74\x65\x20\x6b\x65\x79" + +# undef TLS_MD_IV_BLOCK_CONST +/* + * IV block + */ +# define TLS_MD_IV_BLOCK_CONST "\x49\x56\x20\x62\x6c\x6f\x63\x6b" + +# undef TLS_MD_MASTER_SECRET_CONST +/* + * master secret + */ +# define TLS_MD_MASTER_SECRET_CONST "\x6d\x61\x73\x74\x65\x72\x20\x73\x65\x63\x72\x65\x74" +# undef TLS_MD_EXTENDED_MASTER_SECRET_CONST +/* + * extended master secret + */ +# define TLS_MD_EXTENDED_MASTER_SECRET_CONST "\x65\x78\x74\x65\x6e\x64\x65\x64\x20\x6d\x61\x73\x74\x65\x72\x20\x73\x65\x63\x72\x65\x74" +# endif + +/* TLS Session Ticket extension struct */ +struct tls_session_ticket_ext_st { + unsigned short length; + void *data; +}; + +#ifdef __cplusplus +} +#endif +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/ts.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/ts.h new file mode 100644 index 0000000..3b58aa5 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/ts.h @@ -0,0 +1,559 @@ +/* + * Copyright 2006-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_TS_H +# define HEADER_TS_H + +# include + +# ifndef OPENSSL_NO_TS +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# ifdef __cplusplus +extern "C" { +# endif + +# include +# include + +typedef struct TS_msg_imprint_st TS_MSG_IMPRINT; +typedef struct TS_req_st TS_REQ; +typedef struct TS_accuracy_st TS_ACCURACY; +typedef struct TS_tst_info_st TS_TST_INFO; + +/* Possible values for status. */ +# define TS_STATUS_GRANTED 0 +# define TS_STATUS_GRANTED_WITH_MODS 1 +# define TS_STATUS_REJECTION 2 +# define TS_STATUS_WAITING 3 +# define TS_STATUS_REVOCATION_WARNING 4 +# define TS_STATUS_REVOCATION_NOTIFICATION 5 + +/* Possible values for failure_info. */ +# define TS_INFO_BAD_ALG 0 +# define TS_INFO_BAD_REQUEST 2 +# define TS_INFO_BAD_DATA_FORMAT 5 +# define TS_INFO_TIME_NOT_AVAILABLE 14 +# define TS_INFO_UNACCEPTED_POLICY 15 +# define TS_INFO_UNACCEPTED_EXTENSION 16 +# define TS_INFO_ADD_INFO_NOT_AVAILABLE 17 +# define TS_INFO_SYSTEM_FAILURE 25 + + +typedef struct TS_status_info_st TS_STATUS_INFO; +typedef struct ESS_issuer_serial ESS_ISSUER_SERIAL; +typedef struct ESS_cert_id ESS_CERT_ID; +typedef struct ESS_signing_cert ESS_SIGNING_CERT; + +DEFINE_STACK_OF(ESS_CERT_ID) + +typedef struct ESS_cert_id_v2_st ESS_CERT_ID_V2; +typedef struct ESS_signing_cert_v2_st ESS_SIGNING_CERT_V2; + +DEFINE_STACK_OF(ESS_CERT_ID_V2) + +typedef struct TS_resp_st TS_RESP; + +TS_REQ *TS_REQ_new(void); +void TS_REQ_free(TS_REQ *a); +int i2d_TS_REQ(const TS_REQ *a, unsigned char **pp); +TS_REQ *d2i_TS_REQ(TS_REQ **a, const unsigned char **pp, long length); + +TS_REQ *TS_REQ_dup(TS_REQ *a); + +#ifndef OPENSSL_NO_STDIO +TS_REQ *d2i_TS_REQ_fp(FILE *fp, TS_REQ **a); +int i2d_TS_REQ_fp(FILE *fp, TS_REQ *a); +#endif +TS_REQ *d2i_TS_REQ_bio(BIO *fp, TS_REQ **a); +int i2d_TS_REQ_bio(BIO *fp, TS_REQ *a); + +TS_MSG_IMPRINT *TS_MSG_IMPRINT_new(void); +void TS_MSG_IMPRINT_free(TS_MSG_IMPRINT *a); +int i2d_TS_MSG_IMPRINT(const TS_MSG_IMPRINT *a, unsigned char **pp); +TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT(TS_MSG_IMPRINT **a, + const unsigned char **pp, long length); + +TS_MSG_IMPRINT *TS_MSG_IMPRINT_dup(TS_MSG_IMPRINT *a); + +#ifndef OPENSSL_NO_STDIO +TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT_fp(FILE *fp, TS_MSG_IMPRINT **a); +int i2d_TS_MSG_IMPRINT_fp(FILE *fp, TS_MSG_IMPRINT *a); +#endif +TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT_bio(BIO *bio, TS_MSG_IMPRINT **a); +int i2d_TS_MSG_IMPRINT_bio(BIO *bio, TS_MSG_IMPRINT *a); + +TS_RESP *TS_RESP_new(void); +void TS_RESP_free(TS_RESP *a); +int i2d_TS_RESP(const TS_RESP *a, unsigned char **pp); +TS_RESP *d2i_TS_RESP(TS_RESP **a, const unsigned char **pp, long length); +TS_TST_INFO *PKCS7_to_TS_TST_INFO(PKCS7 *token); +TS_RESP *TS_RESP_dup(TS_RESP *a); + +#ifndef OPENSSL_NO_STDIO +TS_RESP *d2i_TS_RESP_fp(FILE *fp, TS_RESP **a); +int i2d_TS_RESP_fp(FILE *fp, TS_RESP *a); +#endif +TS_RESP *d2i_TS_RESP_bio(BIO *bio, TS_RESP **a); +int i2d_TS_RESP_bio(BIO *bio, TS_RESP *a); + +TS_STATUS_INFO *TS_STATUS_INFO_new(void); +void TS_STATUS_INFO_free(TS_STATUS_INFO *a); +int i2d_TS_STATUS_INFO(const TS_STATUS_INFO *a, unsigned char **pp); +TS_STATUS_INFO *d2i_TS_STATUS_INFO(TS_STATUS_INFO **a, + const unsigned char **pp, long length); +TS_STATUS_INFO *TS_STATUS_INFO_dup(TS_STATUS_INFO *a); + +TS_TST_INFO *TS_TST_INFO_new(void); +void TS_TST_INFO_free(TS_TST_INFO *a); +int i2d_TS_TST_INFO(const TS_TST_INFO *a, unsigned char **pp); +TS_TST_INFO *d2i_TS_TST_INFO(TS_TST_INFO **a, const unsigned char **pp, + long length); +TS_TST_INFO *TS_TST_INFO_dup(TS_TST_INFO *a); + +#ifndef OPENSSL_NO_STDIO +TS_TST_INFO *d2i_TS_TST_INFO_fp(FILE *fp, TS_TST_INFO **a); +int i2d_TS_TST_INFO_fp(FILE *fp, TS_TST_INFO *a); +#endif +TS_TST_INFO *d2i_TS_TST_INFO_bio(BIO *bio, TS_TST_INFO **a); +int i2d_TS_TST_INFO_bio(BIO *bio, TS_TST_INFO *a); + +TS_ACCURACY *TS_ACCURACY_new(void); +void TS_ACCURACY_free(TS_ACCURACY *a); +int i2d_TS_ACCURACY(const TS_ACCURACY *a, unsigned char **pp); +TS_ACCURACY *d2i_TS_ACCURACY(TS_ACCURACY **a, const unsigned char **pp, + long length); +TS_ACCURACY *TS_ACCURACY_dup(TS_ACCURACY *a); + +ESS_ISSUER_SERIAL *ESS_ISSUER_SERIAL_new(void); +void ESS_ISSUER_SERIAL_free(ESS_ISSUER_SERIAL *a); +int i2d_ESS_ISSUER_SERIAL(const ESS_ISSUER_SERIAL *a, unsigned char **pp); +ESS_ISSUER_SERIAL *d2i_ESS_ISSUER_SERIAL(ESS_ISSUER_SERIAL **a, + const unsigned char **pp, + long length); +ESS_ISSUER_SERIAL *ESS_ISSUER_SERIAL_dup(ESS_ISSUER_SERIAL *a); + +ESS_CERT_ID *ESS_CERT_ID_new(void); +void ESS_CERT_ID_free(ESS_CERT_ID *a); +int i2d_ESS_CERT_ID(const ESS_CERT_ID *a, unsigned char **pp); +ESS_CERT_ID *d2i_ESS_CERT_ID(ESS_CERT_ID **a, const unsigned char **pp, + long length); +ESS_CERT_ID *ESS_CERT_ID_dup(ESS_CERT_ID *a); + +ESS_SIGNING_CERT *ESS_SIGNING_CERT_new(void); +void ESS_SIGNING_CERT_free(ESS_SIGNING_CERT *a); +int i2d_ESS_SIGNING_CERT(const ESS_SIGNING_CERT *a, unsigned char **pp); +ESS_SIGNING_CERT *d2i_ESS_SIGNING_CERT(ESS_SIGNING_CERT **a, + const unsigned char **pp, long length); +ESS_SIGNING_CERT *ESS_SIGNING_CERT_dup(ESS_SIGNING_CERT *a); + +ESS_CERT_ID_V2 *ESS_CERT_ID_V2_new(void); +void ESS_CERT_ID_V2_free(ESS_CERT_ID_V2 *a); +int i2d_ESS_CERT_ID_V2(const ESS_CERT_ID_V2 *a, unsigned char **pp); +ESS_CERT_ID_V2 *d2i_ESS_CERT_ID_V2(ESS_CERT_ID_V2 **a, + const unsigned char **pp, long length); +ESS_CERT_ID_V2 *ESS_CERT_ID_V2_dup(ESS_CERT_ID_V2 *a); + +ESS_SIGNING_CERT_V2 *ESS_SIGNING_CERT_V2_new(void); +void ESS_SIGNING_CERT_V2_free(ESS_SIGNING_CERT_V2 *a); +int i2d_ESS_SIGNING_CERT_V2(const ESS_SIGNING_CERT_V2 *a, unsigned char **pp); +ESS_SIGNING_CERT_V2 *d2i_ESS_SIGNING_CERT_V2(ESS_SIGNING_CERT_V2 **a, + const unsigned char **pp, + long length); +ESS_SIGNING_CERT_V2 *ESS_SIGNING_CERT_V2_dup(ESS_SIGNING_CERT_V2 *a); + +int TS_REQ_set_version(TS_REQ *a, long version); +long TS_REQ_get_version(const TS_REQ *a); + +int TS_STATUS_INFO_set_status(TS_STATUS_INFO *a, int i); +const ASN1_INTEGER *TS_STATUS_INFO_get0_status(const TS_STATUS_INFO *a); + +const STACK_OF(ASN1_UTF8STRING) * +TS_STATUS_INFO_get0_text(const TS_STATUS_INFO *a); + +const ASN1_BIT_STRING * +TS_STATUS_INFO_get0_failure_info(const TS_STATUS_INFO *a); + +int TS_REQ_set_msg_imprint(TS_REQ *a, TS_MSG_IMPRINT *msg_imprint); +TS_MSG_IMPRINT *TS_REQ_get_msg_imprint(TS_REQ *a); + +int TS_MSG_IMPRINT_set_algo(TS_MSG_IMPRINT *a, X509_ALGOR *alg); +X509_ALGOR *TS_MSG_IMPRINT_get_algo(TS_MSG_IMPRINT *a); + +int TS_MSG_IMPRINT_set_msg(TS_MSG_IMPRINT *a, unsigned char *d, int len); +ASN1_OCTET_STRING *TS_MSG_IMPRINT_get_msg(TS_MSG_IMPRINT *a); + +int TS_REQ_set_policy_id(TS_REQ *a, const ASN1_OBJECT *policy); +ASN1_OBJECT *TS_REQ_get_policy_id(TS_REQ *a); + +int TS_REQ_set_nonce(TS_REQ *a, const ASN1_INTEGER *nonce); +const ASN1_INTEGER *TS_REQ_get_nonce(const TS_REQ *a); + +int TS_REQ_set_cert_req(TS_REQ *a, int cert_req); +int TS_REQ_get_cert_req(const TS_REQ *a); + +STACK_OF(X509_EXTENSION) *TS_REQ_get_exts(TS_REQ *a); +void TS_REQ_ext_free(TS_REQ *a); +int TS_REQ_get_ext_count(TS_REQ *a); +int TS_REQ_get_ext_by_NID(TS_REQ *a, int nid, int lastpos); +int TS_REQ_get_ext_by_OBJ(TS_REQ *a, const ASN1_OBJECT *obj, int lastpos); +int TS_REQ_get_ext_by_critical(TS_REQ *a, int crit, int lastpos); +X509_EXTENSION *TS_REQ_get_ext(TS_REQ *a, int loc); +X509_EXTENSION *TS_REQ_delete_ext(TS_REQ *a, int loc); +int TS_REQ_add_ext(TS_REQ *a, X509_EXTENSION *ex, int loc); +void *TS_REQ_get_ext_d2i(TS_REQ *a, int nid, int *crit, int *idx); + +/* Function declarations for TS_REQ defined in ts/ts_req_print.c */ + +int TS_REQ_print_bio(BIO *bio, TS_REQ *a); + +/* Function declarations for TS_RESP defined in ts/ts_resp_utils.c */ + +int TS_RESP_set_status_info(TS_RESP *a, TS_STATUS_INFO *info); +TS_STATUS_INFO *TS_RESP_get_status_info(TS_RESP *a); + +/* Caller loses ownership of PKCS7 and TS_TST_INFO objects. */ +void TS_RESP_set_tst_info(TS_RESP *a, PKCS7 *p7, TS_TST_INFO *tst_info); +PKCS7 *TS_RESP_get_token(TS_RESP *a); +TS_TST_INFO *TS_RESP_get_tst_info(TS_RESP *a); + +int TS_TST_INFO_set_version(TS_TST_INFO *a, long version); +long TS_TST_INFO_get_version(const TS_TST_INFO *a); + +int TS_TST_INFO_set_policy_id(TS_TST_INFO *a, ASN1_OBJECT *policy_id); +ASN1_OBJECT *TS_TST_INFO_get_policy_id(TS_TST_INFO *a); + +int TS_TST_INFO_set_msg_imprint(TS_TST_INFO *a, TS_MSG_IMPRINT *msg_imprint); +TS_MSG_IMPRINT *TS_TST_INFO_get_msg_imprint(TS_TST_INFO *a); + +int TS_TST_INFO_set_serial(TS_TST_INFO *a, const ASN1_INTEGER *serial); +const ASN1_INTEGER *TS_TST_INFO_get_serial(const TS_TST_INFO *a); + +int TS_TST_INFO_set_time(TS_TST_INFO *a, const ASN1_GENERALIZEDTIME *gtime); +const ASN1_GENERALIZEDTIME *TS_TST_INFO_get_time(const TS_TST_INFO *a); + +int TS_TST_INFO_set_accuracy(TS_TST_INFO *a, TS_ACCURACY *accuracy); +TS_ACCURACY *TS_TST_INFO_get_accuracy(TS_TST_INFO *a); + +int TS_ACCURACY_set_seconds(TS_ACCURACY *a, const ASN1_INTEGER *seconds); +const ASN1_INTEGER *TS_ACCURACY_get_seconds(const TS_ACCURACY *a); + +int TS_ACCURACY_set_millis(TS_ACCURACY *a, const ASN1_INTEGER *millis); +const ASN1_INTEGER *TS_ACCURACY_get_millis(const TS_ACCURACY *a); + +int TS_ACCURACY_set_micros(TS_ACCURACY *a, const ASN1_INTEGER *micros); +const ASN1_INTEGER *TS_ACCURACY_get_micros(const TS_ACCURACY *a); + +int TS_TST_INFO_set_ordering(TS_TST_INFO *a, int ordering); +int TS_TST_INFO_get_ordering(const TS_TST_INFO *a); + +int TS_TST_INFO_set_nonce(TS_TST_INFO *a, const ASN1_INTEGER *nonce); +const ASN1_INTEGER *TS_TST_INFO_get_nonce(const TS_TST_INFO *a); + +int TS_TST_INFO_set_tsa(TS_TST_INFO *a, GENERAL_NAME *tsa); +GENERAL_NAME *TS_TST_INFO_get_tsa(TS_TST_INFO *a); + +STACK_OF(X509_EXTENSION) *TS_TST_INFO_get_exts(TS_TST_INFO *a); +void TS_TST_INFO_ext_free(TS_TST_INFO *a); +int TS_TST_INFO_get_ext_count(TS_TST_INFO *a); +int TS_TST_INFO_get_ext_by_NID(TS_TST_INFO *a, int nid, int lastpos); +int TS_TST_INFO_get_ext_by_OBJ(TS_TST_INFO *a, const ASN1_OBJECT *obj, + int lastpos); +int TS_TST_INFO_get_ext_by_critical(TS_TST_INFO *a, int crit, int lastpos); +X509_EXTENSION *TS_TST_INFO_get_ext(TS_TST_INFO *a, int loc); +X509_EXTENSION *TS_TST_INFO_delete_ext(TS_TST_INFO *a, int loc); +int TS_TST_INFO_add_ext(TS_TST_INFO *a, X509_EXTENSION *ex, int loc); +void *TS_TST_INFO_get_ext_d2i(TS_TST_INFO *a, int nid, int *crit, int *idx); + +/* + * Declarations related to response generation, defined in ts/ts_resp_sign.c. + */ + +/* Optional flags for response generation. */ + +/* Don't include the TSA name in response. */ +# define TS_TSA_NAME 0x01 + +/* Set ordering to true in response. */ +# define TS_ORDERING 0x02 + +/* + * Include the signer certificate and the other specified certificates in + * the ESS signing certificate attribute beside the PKCS7 signed data. + * Only the signer certificates is included by default. + */ +# define TS_ESS_CERT_ID_CHAIN 0x04 + +/* Forward declaration. */ +struct TS_resp_ctx; + +/* This must return a unique number less than 160 bits long. */ +typedef ASN1_INTEGER *(*TS_serial_cb) (struct TS_resp_ctx *, void *); + +/* + * This must return the seconds and microseconds since Jan 1, 1970 in the sec + * and usec variables allocated by the caller. Return non-zero for success + * and zero for failure. + */ +typedef int (*TS_time_cb) (struct TS_resp_ctx *, void *, long *sec, + long *usec); + +/* + * This must process the given extension. It can modify the TS_TST_INFO + * object of the context. Return values: !0 (processed), 0 (error, it must + * set the status info/failure info of the response). + */ +typedef int (*TS_extension_cb) (struct TS_resp_ctx *, X509_EXTENSION *, + void *); + +typedef struct TS_resp_ctx TS_RESP_CTX; + +DEFINE_STACK_OF_CONST(EVP_MD) + +/* Creates a response context that can be used for generating responses. */ +TS_RESP_CTX *TS_RESP_CTX_new(void); +void TS_RESP_CTX_free(TS_RESP_CTX *ctx); + +/* This parameter must be set. */ +int TS_RESP_CTX_set_signer_cert(TS_RESP_CTX *ctx, X509 *signer); + +/* This parameter must be set. */ +int TS_RESP_CTX_set_signer_key(TS_RESP_CTX *ctx, EVP_PKEY *key); + +int TS_RESP_CTX_set_signer_digest(TS_RESP_CTX *ctx, + const EVP_MD *signer_digest); +int TS_RESP_CTX_set_ess_cert_id_digest(TS_RESP_CTX *ctx, const EVP_MD *md); + +/* This parameter must be set. */ +int TS_RESP_CTX_set_def_policy(TS_RESP_CTX *ctx, const ASN1_OBJECT *def_policy); + +/* No additional certs are included in the response by default. */ +int TS_RESP_CTX_set_certs(TS_RESP_CTX *ctx, STACK_OF(X509) *certs); + +/* + * Adds a new acceptable policy, only the default policy is accepted by + * default. + */ +int TS_RESP_CTX_add_policy(TS_RESP_CTX *ctx, const ASN1_OBJECT *policy); + +/* + * Adds a new acceptable message digest. Note that no message digests are + * accepted by default. The md argument is shared with the caller. + */ +int TS_RESP_CTX_add_md(TS_RESP_CTX *ctx, const EVP_MD *md); + +/* Accuracy is not included by default. */ +int TS_RESP_CTX_set_accuracy(TS_RESP_CTX *ctx, + int secs, int millis, int micros); + +/* + * Clock precision digits, i.e. the number of decimal digits: '0' means sec, + * '3' msec, '6' usec, and so on. Default is 0. + */ +int TS_RESP_CTX_set_clock_precision_digits(TS_RESP_CTX *ctx, + unsigned clock_precision_digits); +/* At most we accept usec precision. */ +# define TS_MAX_CLOCK_PRECISION_DIGITS 6 + +/* Maximum status message length */ +# define TS_MAX_STATUS_LENGTH (1024 * 1024) + +/* No flags are set by default. */ +void TS_RESP_CTX_add_flags(TS_RESP_CTX *ctx, int flags); + +/* Default callback always returns a constant. */ +void TS_RESP_CTX_set_serial_cb(TS_RESP_CTX *ctx, TS_serial_cb cb, void *data); + +/* Default callback uses the gettimeofday() and gmtime() system calls. */ +void TS_RESP_CTX_set_time_cb(TS_RESP_CTX *ctx, TS_time_cb cb, void *data); + +/* + * Default callback rejects all extensions. The extension callback is called + * when the TS_TST_INFO object is already set up and not signed yet. + */ +/* FIXME: extension handling is not tested yet. */ +void TS_RESP_CTX_set_extension_cb(TS_RESP_CTX *ctx, + TS_extension_cb cb, void *data); + +/* The following methods can be used in the callbacks. */ +int TS_RESP_CTX_set_status_info(TS_RESP_CTX *ctx, + int status, const char *text); + +/* Sets the status info only if it is still TS_STATUS_GRANTED. */ +int TS_RESP_CTX_set_status_info_cond(TS_RESP_CTX *ctx, + int status, const char *text); + +int TS_RESP_CTX_add_failure_info(TS_RESP_CTX *ctx, int failure); + +/* The get methods below can be used in the extension callback. */ +TS_REQ *TS_RESP_CTX_get_request(TS_RESP_CTX *ctx); + +TS_TST_INFO *TS_RESP_CTX_get_tst_info(TS_RESP_CTX *ctx); + +/* + * Creates the signed TS_TST_INFO and puts it in TS_RESP. + * In case of errors it sets the status info properly. + * Returns NULL only in case of memory allocation/fatal error. + */ +TS_RESP *TS_RESP_create_response(TS_RESP_CTX *ctx, BIO *req_bio); + +/* + * Declarations related to response verification, + * they are defined in ts/ts_resp_verify.c. + */ + +int TS_RESP_verify_signature(PKCS7 *token, STACK_OF(X509) *certs, + X509_STORE *store, X509 **signer_out); + +/* Context structure for the generic verify method. */ + +/* Verify the signer's certificate and the signature of the response. */ +# define TS_VFY_SIGNATURE (1u << 0) +/* Verify the version number of the response. */ +# define TS_VFY_VERSION (1u << 1) +/* Verify if the policy supplied by the user matches the policy of the TSA. */ +# define TS_VFY_POLICY (1u << 2) +/* + * Verify the message imprint provided by the user. This flag should not be + * specified with TS_VFY_DATA. + */ +# define TS_VFY_IMPRINT (1u << 3) +/* + * Verify the message imprint computed by the verify method from the user + * provided data and the MD algorithm of the response. This flag should not + * be specified with TS_VFY_IMPRINT. + */ +# define TS_VFY_DATA (1u << 4) +/* Verify the nonce value. */ +# define TS_VFY_NONCE (1u << 5) +/* Verify if the TSA name field matches the signer certificate. */ +# define TS_VFY_SIGNER (1u << 6) +/* Verify if the TSA name field equals to the user provided name. */ +# define TS_VFY_TSA_NAME (1u << 7) + +/* You can use the following convenience constants. */ +# define TS_VFY_ALL_IMPRINT (TS_VFY_SIGNATURE \ + | TS_VFY_VERSION \ + | TS_VFY_POLICY \ + | TS_VFY_IMPRINT \ + | TS_VFY_NONCE \ + | TS_VFY_SIGNER \ + | TS_VFY_TSA_NAME) +# define TS_VFY_ALL_DATA (TS_VFY_SIGNATURE \ + | TS_VFY_VERSION \ + | TS_VFY_POLICY \ + | TS_VFY_DATA \ + | TS_VFY_NONCE \ + | TS_VFY_SIGNER \ + | TS_VFY_TSA_NAME) + +typedef struct TS_verify_ctx TS_VERIFY_CTX; + +int TS_RESP_verify_response(TS_VERIFY_CTX *ctx, TS_RESP *response); +int TS_RESP_verify_token(TS_VERIFY_CTX *ctx, PKCS7 *token); + +/* + * Declarations related to response verification context, + */ +TS_VERIFY_CTX *TS_VERIFY_CTX_new(void); +void TS_VERIFY_CTX_init(TS_VERIFY_CTX *ctx); +void TS_VERIFY_CTX_free(TS_VERIFY_CTX *ctx); +void TS_VERIFY_CTX_cleanup(TS_VERIFY_CTX *ctx); +int TS_VERIFY_CTX_set_flags(TS_VERIFY_CTX *ctx, int f); +int TS_VERIFY_CTX_add_flags(TS_VERIFY_CTX *ctx, int f); +BIO *TS_VERIFY_CTX_set_data(TS_VERIFY_CTX *ctx, BIO *b); +unsigned char *TS_VERIFY_CTX_set_imprint(TS_VERIFY_CTX *ctx, + unsigned char *hexstr, long len); +X509_STORE *TS_VERIFY_CTX_set_store(TS_VERIFY_CTX *ctx, X509_STORE *s); +STACK_OF(X509) *TS_VERIFY_CTS_set_certs(TS_VERIFY_CTX *ctx, STACK_OF(X509) *certs); + +/*- + * If ctx is NULL, it allocates and returns a new object, otherwise + * it returns ctx. It initialises all the members as follows: + * flags = TS_VFY_ALL_IMPRINT & ~(TS_VFY_TSA_NAME | TS_VFY_SIGNATURE) + * certs = NULL + * store = NULL + * policy = policy from the request or NULL if absent (in this case + * TS_VFY_POLICY is cleared from flags as well) + * md_alg = MD algorithm from request + * imprint, imprint_len = imprint from request + * data = NULL + * nonce, nonce_len = nonce from the request or NULL if absent (in this case + * TS_VFY_NONCE is cleared from flags as well) + * tsa_name = NULL + * Important: after calling this method TS_VFY_SIGNATURE should be added! + */ +TS_VERIFY_CTX *TS_REQ_to_TS_VERIFY_CTX(TS_REQ *req, TS_VERIFY_CTX *ctx); + +/* Function declarations for TS_RESP defined in ts/ts_resp_print.c */ + +int TS_RESP_print_bio(BIO *bio, TS_RESP *a); +int TS_STATUS_INFO_print_bio(BIO *bio, TS_STATUS_INFO *a); +int TS_TST_INFO_print_bio(BIO *bio, TS_TST_INFO *a); + +/* Common utility functions defined in ts/ts_lib.c */ + +int TS_ASN1_INTEGER_print_bio(BIO *bio, const ASN1_INTEGER *num); +int TS_OBJ_print_bio(BIO *bio, const ASN1_OBJECT *obj); +int TS_ext_print_bio(BIO *bio, const STACK_OF(X509_EXTENSION) *extensions); +int TS_X509_ALGOR_print_bio(BIO *bio, const X509_ALGOR *alg); +int TS_MSG_IMPRINT_print_bio(BIO *bio, TS_MSG_IMPRINT *msg); + +/* + * Function declarations for handling configuration options, defined in + * ts/ts_conf.c + */ + +X509 *TS_CONF_load_cert(const char *file); +STACK_OF(X509) *TS_CONF_load_certs(const char *file); +EVP_PKEY *TS_CONF_load_key(const char *file, const char *pass); +const char *TS_CONF_get_tsa_section(CONF *conf, const char *section); +int TS_CONF_set_serial(CONF *conf, const char *section, TS_serial_cb cb, + TS_RESP_CTX *ctx); +#ifndef OPENSSL_NO_ENGINE +int TS_CONF_set_crypto_device(CONF *conf, const char *section, + const char *device); +int TS_CONF_set_default_engine(const char *name); +#endif +int TS_CONF_set_signer_cert(CONF *conf, const char *section, + const char *cert, TS_RESP_CTX *ctx); +int TS_CONF_set_certs(CONF *conf, const char *section, const char *certs, + TS_RESP_CTX *ctx); +int TS_CONF_set_signer_key(CONF *conf, const char *section, + const char *key, const char *pass, + TS_RESP_CTX *ctx); +int TS_CONF_set_signer_digest(CONF *conf, const char *section, + const char *md, TS_RESP_CTX *ctx); +int TS_CONF_set_def_policy(CONF *conf, const char *section, + const char *policy, TS_RESP_CTX *ctx); +int TS_CONF_set_policies(CONF *conf, const char *section, TS_RESP_CTX *ctx); +int TS_CONF_set_digests(CONF *conf, const char *section, TS_RESP_CTX *ctx); +int TS_CONF_set_accuracy(CONF *conf, const char *section, TS_RESP_CTX *ctx); +int TS_CONF_set_clock_precision_digits(CONF *conf, const char *section, + TS_RESP_CTX *ctx); +int TS_CONF_set_ordering(CONF *conf, const char *section, TS_RESP_CTX *ctx); +int TS_CONF_set_tsa_name(CONF *conf, const char *section, TS_RESP_CTX *ctx); +int TS_CONF_set_ess_cert_id_chain(CONF *conf, const char *section, + TS_RESP_CTX *ctx); +int TS_CONF_set_ess_cert_id_digest(CONF *conf, const char *section, + TS_RESP_CTX *ctx); + +# ifdef __cplusplus +} +# endif +# endif +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/tserr.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/tserr.h new file mode 100644 index 0000000..07f2333 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/tserr.h @@ -0,0 +1,132 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_TSERR_H +# define HEADER_TSERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# include + +# ifndef OPENSSL_NO_TS + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_TS_strings(void); + +/* + * TS function codes. + */ +# define TS_F_DEF_SERIAL_CB 110 +# define TS_F_DEF_TIME_CB 111 +# define TS_F_ESS_ADD_SIGNING_CERT 112 +# define TS_F_ESS_ADD_SIGNING_CERT_V2 147 +# define TS_F_ESS_CERT_ID_NEW_INIT 113 +# define TS_F_ESS_CERT_ID_V2_NEW_INIT 156 +# define TS_F_ESS_SIGNING_CERT_NEW_INIT 114 +# define TS_F_ESS_SIGNING_CERT_V2_NEW_INIT 157 +# define TS_F_INT_TS_RESP_VERIFY_TOKEN 149 +# define TS_F_PKCS7_TO_TS_TST_INFO 148 +# define TS_F_TS_ACCURACY_SET_MICROS 115 +# define TS_F_TS_ACCURACY_SET_MILLIS 116 +# define TS_F_TS_ACCURACY_SET_SECONDS 117 +# define TS_F_TS_CHECK_IMPRINTS 100 +# define TS_F_TS_CHECK_NONCES 101 +# define TS_F_TS_CHECK_POLICY 102 +# define TS_F_TS_CHECK_SIGNING_CERTS 103 +# define TS_F_TS_CHECK_STATUS_INFO 104 +# define TS_F_TS_COMPUTE_IMPRINT 145 +# define TS_F_TS_CONF_INVALID 151 +# define TS_F_TS_CONF_LOAD_CERT 153 +# define TS_F_TS_CONF_LOAD_CERTS 154 +# define TS_F_TS_CONF_LOAD_KEY 155 +# define TS_F_TS_CONF_LOOKUP_FAIL 152 +# define TS_F_TS_CONF_SET_DEFAULT_ENGINE 146 +# define TS_F_TS_GET_STATUS_TEXT 105 +# define TS_F_TS_MSG_IMPRINT_SET_ALGO 118 +# define TS_F_TS_REQ_SET_MSG_IMPRINT 119 +# define TS_F_TS_REQ_SET_NONCE 120 +# define TS_F_TS_REQ_SET_POLICY_ID 121 +# define TS_F_TS_RESP_CREATE_RESPONSE 122 +# define TS_F_TS_RESP_CREATE_TST_INFO 123 +# define TS_F_TS_RESP_CTX_ADD_FAILURE_INFO 124 +# define TS_F_TS_RESP_CTX_ADD_MD 125 +# define TS_F_TS_RESP_CTX_ADD_POLICY 126 +# define TS_F_TS_RESP_CTX_NEW 127 +# define TS_F_TS_RESP_CTX_SET_ACCURACY 128 +# define TS_F_TS_RESP_CTX_SET_CERTS 129 +# define TS_F_TS_RESP_CTX_SET_DEF_POLICY 130 +# define TS_F_TS_RESP_CTX_SET_SIGNER_CERT 131 +# define TS_F_TS_RESP_CTX_SET_STATUS_INFO 132 +# define TS_F_TS_RESP_GET_POLICY 133 +# define TS_F_TS_RESP_SET_GENTIME_WITH_PRECISION 134 +# define TS_F_TS_RESP_SET_STATUS_INFO 135 +# define TS_F_TS_RESP_SET_TST_INFO 150 +# define TS_F_TS_RESP_SIGN 136 +# define TS_F_TS_RESP_VERIFY_SIGNATURE 106 +# define TS_F_TS_TST_INFO_SET_ACCURACY 137 +# define TS_F_TS_TST_INFO_SET_MSG_IMPRINT 138 +# define TS_F_TS_TST_INFO_SET_NONCE 139 +# define TS_F_TS_TST_INFO_SET_POLICY_ID 140 +# define TS_F_TS_TST_INFO_SET_SERIAL 141 +# define TS_F_TS_TST_INFO_SET_TIME 142 +# define TS_F_TS_TST_INFO_SET_TSA 143 +# define TS_F_TS_VERIFY 108 +# define TS_F_TS_VERIFY_CERT 109 +# define TS_F_TS_VERIFY_CTX_NEW 144 + +/* + * TS reason codes. + */ +# define TS_R_BAD_PKCS7_TYPE 132 +# define TS_R_BAD_TYPE 133 +# define TS_R_CANNOT_LOAD_CERT 137 +# define TS_R_CANNOT_LOAD_KEY 138 +# define TS_R_CERTIFICATE_VERIFY_ERROR 100 +# define TS_R_COULD_NOT_SET_ENGINE 127 +# define TS_R_COULD_NOT_SET_TIME 115 +# define TS_R_DETACHED_CONTENT 134 +# define TS_R_ESS_ADD_SIGNING_CERT_ERROR 116 +# define TS_R_ESS_ADD_SIGNING_CERT_V2_ERROR 139 +# define TS_R_ESS_SIGNING_CERTIFICATE_ERROR 101 +# define TS_R_INVALID_NULL_POINTER 102 +# define TS_R_INVALID_SIGNER_CERTIFICATE_PURPOSE 117 +# define TS_R_MESSAGE_IMPRINT_MISMATCH 103 +# define TS_R_NONCE_MISMATCH 104 +# define TS_R_NONCE_NOT_RETURNED 105 +# define TS_R_NO_CONTENT 106 +# define TS_R_NO_TIME_STAMP_TOKEN 107 +# define TS_R_PKCS7_ADD_SIGNATURE_ERROR 118 +# define TS_R_PKCS7_ADD_SIGNED_ATTR_ERROR 119 +# define TS_R_PKCS7_TO_TS_TST_INFO_FAILED 129 +# define TS_R_POLICY_MISMATCH 108 +# define TS_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 120 +# define TS_R_RESPONSE_SETUP_ERROR 121 +# define TS_R_SIGNATURE_FAILURE 109 +# define TS_R_THERE_MUST_BE_ONE_SIGNER 110 +# define TS_R_TIME_SYSCALL_ERROR 122 +# define TS_R_TOKEN_NOT_PRESENT 130 +# define TS_R_TOKEN_PRESENT 131 +# define TS_R_TSA_NAME_MISMATCH 111 +# define TS_R_TSA_UNTRUSTED 112 +# define TS_R_TST_INFO_SETUP_ERROR 123 +# define TS_R_TS_DATASIGN 124 +# define TS_R_UNACCEPTABLE_POLICY 125 +# define TS_R_UNSUPPORTED_MD_ALGORITHM 126 +# define TS_R_UNSUPPORTED_VERSION 113 +# define TS_R_VAR_BAD_VALUE 135 +# define TS_R_VAR_LOOKUP_FAILURE 136 +# define TS_R_WRONG_CONTENT_TYPE 114 + +# endif +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/txt_db.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/txt_db.h new file mode 100644 index 0000000..ec981a4 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/txt_db.h @@ -0,0 +1,57 @@ +/* + * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_TXT_DB_H +# define HEADER_TXT_DB_H + +# include +# include +# include +# include + +# define DB_ERROR_OK 0 +# define DB_ERROR_MALLOC 1 +# define DB_ERROR_INDEX_CLASH 2 +# define DB_ERROR_INDEX_OUT_OF_RANGE 3 +# define DB_ERROR_NO_INDEX 4 +# define DB_ERROR_INSERT_INDEX_CLASH 5 +# define DB_ERROR_WRONG_NUM_FIELDS 6 + +#ifdef __cplusplus +extern "C" { +#endif + +typedef OPENSSL_STRING *OPENSSL_PSTRING; +DEFINE_SPECIAL_STACK_OF(OPENSSL_PSTRING, OPENSSL_STRING) + +typedef struct txt_db_st { + int num_fields; + STACK_OF(OPENSSL_PSTRING) *data; + LHASH_OF(OPENSSL_STRING) **index; + int (**qual) (OPENSSL_STRING *); + long error; + long arg1; + long arg2; + OPENSSL_STRING *arg_row; +} TXT_DB; + +TXT_DB *TXT_DB_read(BIO *in, int num); +long TXT_DB_write(BIO *out, TXT_DB *db); +int TXT_DB_create_index(TXT_DB *db, int field, int (*qual) (OPENSSL_STRING *), + OPENSSL_LH_HASHFUNC hash, OPENSSL_LH_COMPFUNC cmp); +void TXT_DB_free(TXT_DB *db); +OPENSSL_STRING *TXT_DB_get_by_index(TXT_DB *db, int idx, + OPENSSL_STRING *value); +int TXT_DB_insert(TXT_DB *db, OPENSSL_STRING *value); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/ui.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/ui.h new file mode 100644 index 0000000..7c721ec --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/ui.h @@ -0,0 +1,368 @@ +/* + * Copyright 2001-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_UI_H +# define HEADER_UI_H + +# include + +# if OPENSSL_API_COMPAT < 0x10100000L +# include +# endif +# include +# include +# include +# include + +/* For compatibility reasons, the macro OPENSSL_NO_UI is currently retained */ +# if OPENSSL_API_COMPAT < 0x10200000L +# ifdef OPENSSL_NO_UI_CONSOLE +# define OPENSSL_NO_UI +# endif +# endif + +# ifdef __cplusplus +extern "C" { +# endif + +/* + * All the following functions return -1 or NULL on error and in some cases + * (UI_process()) -2 if interrupted or in some other way cancelled. When + * everything is fine, they return 0, a positive value or a non-NULL pointer, + * all depending on their purpose. + */ + +/* Creators and destructor. */ +UI *UI_new(void); +UI *UI_new_method(const UI_METHOD *method); +void UI_free(UI *ui); + +/*- + The following functions are used to add strings to be printed and prompt + strings to prompt for data. The names are UI_{add,dup}__string + and UI_{add,dup}_input_boolean. + + UI_{add,dup}__string have the following meanings: + add add a text or prompt string. The pointers given to these + functions are used verbatim, no copying is done. + dup make a copy of the text or prompt string, then add the copy + to the collection of strings in the user interface. + + The function is a name for the functionality that the given + string shall be used for. It can be one of: + input use the string as data prompt. + verify use the string as verification prompt. This + is used to verify a previous input. + info use the string for informational output. + error use the string for error output. + Honestly, there's currently no difference between info and error for the + moment. + + UI_{add,dup}_input_boolean have the same semantics for "add" and "dup", + and are typically used when one wants to prompt for a yes/no response. + + All of the functions in this group take a UI and a prompt string. + The string input and verify addition functions also take a flag argument, + a buffer for the result to end up with, a minimum input size and a maximum + input size (the result buffer MUST be large enough to be able to contain + the maximum number of characters). Additionally, the verify addition + functions takes another buffer to compare the result against. + The boolean input functions take an action description string (which should + be safe to ignore if the expected user action is obvious, for example with + a dialog box with an OK button and a Cancel button), a string of acceptable + characters to mean OK and to mean Cancel. The two last strings are checked + to make sure they don't have common characters. Additionally, the same + flag argument as for the string input is taken, as well as a result buffer. + The result buffer is required to be at least one byte long. Depending on + the answer, the first character from the OK or the Cancel character strings + will be stored in the first byte of the result buffer. No NUL will be + added, so the result is *not* a string. + + On success, the all return an index of the added information. That index + is useful when retrieving results with UI_get0_result(). */ +int UI_add_input_string(UI *ui, const char *prompt, int flags, + char *result_buf, int minsize, int maxsize); +int UI_dup_input_string(UI *ui, const char *prompt, int flags, + char *result_buf, int minsize, int maxsize); +int UI_add_verify_string(UI *ui, const char *prompt, int flags, + char *result_buf, int minsize, int maxsize, + const char *test_buf); +int UI_dup_verify_string(UI *ui, const char *prompt, int flags, + char *result_buf, int minsize, int maxsize, + const char *test_buf); +int UI_add_input_boolean(UI *ui, const char *prompt, const char *action_desc, + const char *ok_chars, const char *cancel_chars, + int flags, char *result_buf); +int UI_dup_input_boolean(UI *ui, const char *prompt, const char *action_desc, + const char *ok_chars, const char *cancel_chars, + int flags, char *result_buf); +int UI_add_info_string(UI *ui, const char *text); +int UI_dup_info_string(UI *ui, const char *text); +int UI_add_error_string(UI *ui, const char *text); +int UI_dup_error_string(UI *ui, const char *text); + +/* These are the possible flags. They can be or'ed together. */ +/* Use to have echoing of input */ +# define UI_INPUT_FLAG_ECHO 0x01 +/* + * Use a default password. Where that password is found is completely up to + * the application, it might for example be in the user data set with + * UI_add_user_data(). It is not recommended to have more than one input in + * each UI being marked with this flag, or the application might get + * confused. + */ +# define UI_INPUT_FLAG_DEFAULT_PWD 0x02 + +/*- + * The user of these routines may want to define flags of their own. The core + * UI won't look at those, but will pass them on to the method routines. They + * must use higher bits so they don't get confused with the UI bits above. + * UI_INPUT_FLAG_USER_BASE tells which is the lowest bit to use. A good + * example of use is this: + * + * #define MY_UI_FLAG1 (0x01 << UI_INPUT_FLAG_USER_BASE) + * +*/ +# define UI_INPUT_FLAG_USER_BASE 16 + +/*- + * The following function helps construct a prompt. object_desc is a + * textual short description of the object, for example "pass phrase", + * and object_name is the name of the object (might be a card name or + * a file name. + * The returned string shall always be allocated on the heap with + * OPENSSL_malloc(), and need to be free'd with OPENSSL_free(). + * + * If the ui_method doesn't contain a pointer to a user-defined prompt + * constructor, a default string is built, looking like this: + * + * "Enter {object_desc} for {object_name}:" + * + * So, if object_desc has the value "pass phrase" and object_name has + * the value "foo.key", the resulting string is: + * + * "Enter pass phrase for foo.key:" +*/ +char *UI_construct_prompt(UI *ui_method, + const char *object_desc, const char *object_name); + +/* + * The following function is used to store a pointer to user-specific data. + * Any previous such pointer will be returned and replaced. + * + * For callback purposes, this function makes a lot more sense than using + * ex_data, since the latter requires that different parts of OpenSSL or + * applications share the same ex_data index. + * + * Note that the UI_OpenSSL() method completely ignores the user data. Other + * methods may not, however. + */ +void *UI_add_user_data(UI *ui, void *user_data); +/* + * Alternatively, this function is used to duplicate the user data. + * This uses the duplicator method function. The destroy function will + * be used to free the user data in this case. + */ +int UI_dup_user_data(UI *ui, void *user_data); +/* We need a user data retrieving function as well. */ +void *UI_get0_user_data(UI *ui); + +/* Return the result associated with a prompt given with the index i. */ +const char *UI_get0_result(UI *ui, int i); +int UI_get_result_length(UI *ui, int i); + +/* When all strings have been added, process the whole thing. */ +int UI_process(UI *ui); + +/* + * Give a user interface parameterised control commands. This can be used to + * send down an integer, a data pointer or a function pointer, as well as be + * used to get information from a UI. + */ +int UI_ctrl(UI *ui, int cmd, long i, void *p, void (*f) (void)); + +/* The commands */ +/* + * Use UI_CONTROL_PRINT_ERRORS with the value 1 to have UI_process print the + * OpenSSL error stack before printing any info or added error messages and + * before any prompting. + */ +# define UI_CTRL_PRINT_ERRORS 1 +/* + * Check if a UI_process() is possible to do again with the same instance of + * a user interface. This makes UI_ctrl() return 1 if it is redoable, and 0 + * if not. + */ +# define UI_CTRL_IS_REDOABLE 2 + +/* Some methods may use extra data */ +# define UI_set_app_data(s,arg) UI_set_ex_data(s,0,arg) +# define UI_get_app_data(s) UI_get_ex_data(s,0) + +# define UI_get_ex_new_index(l, p, newf, dupf, freef) \ + CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_UI, l, p, newf, dupf, freef) +int UI_set_ex_data(UI *r, int idx, void *arg); +void *UI_get_ex_data(UI *r, int idx); + +/* Use specific methods instead of the built-in one */ +void UI_set_default_method(const UI_METHOD *meth); +const UI_METHOD *UI_get_default_method(void); +const UI_METHOD *UI_get_method(UI *ui); +const UI_METHOD *UI_set_method(UI *ui, const UI_METHOD *meth); + +# ifndef OPENSSL_NO_UI_CONSOLE + +/* The method with all the built-in thingies */ +UI_METHOD *UI_OpenSSL(void); + +# endif + +/* + * NULL method. Literally does nothing, but may serve as a placeholder + * to avoid internal default. + */ +const UI_METHOD *UI_null(void); + +/* ---------- For method writers ---------- */ +/*- + A method contains a number of functions that implement the low level + of the User Interface. The functions are: + + an opener This function starts a session, maybe by opening + a channel to a tty, or by opening a window. + a writer This function is called to write a given string, + maybe to the tty, maybe as a field label in a + window. + a flusher This function is called to flush everything that + has been output so far. It can be used to actually + display a dialog box after it has been built. + a reader This function is called to read a given prompt, + maybe from the tty, maybe from a field in a + window. Note that it's called with all string + structures, not only the prompt ones, so it must + check such things itself. + a closer This function closes the session, maybe by closing + the channel to the tty, or closing the window. + + All these functions are expected to return: + + 0 on error. + 1 on success. + -1 on out-of-band events, for example if some prompting has + been canceled (by pressing Ctrl-C, for example). This is + only checked when returned by the flusher or the reader. + + The way this is used, the opener is first called, then the writer for all + strings, then the flusher, then the reader for all strings and finally the + closer. Note that if you want to prompt from a terminal or other command + line interface, the best is to have the reader also write the prompts + instead of having the writer do it. If you want to prompt from a dialog + box, the writer can be used to build up the contents of the box, and the + flusher to actually display the box and run the event loop until all data + has been given, after which the reader only grabs the given data and puts + them back into the UI strings. + + All method functions take a UI as argument. Additionally, the writer and + the reader take a UI_STRING. +*/ + +/* + * The UI_STRING type is the data structure that contains all the needed info + * about a string or a prompt, including test data for a verification prompt. + */ +typedef struct ui_string_st UI_STRING; +DEFINE_STACK_OF(UI_STRING) + +/* + * The different types of strings that are currently supported. This is only + * needed by method authors. + */ +enum UI_string_types { + UIT_NONE = 0, + UIT_PROMPT, /* Prompt for a string */ + UIT_VERIFY, /* Prompt for a string and verify */ + UIT_BOOLEAN, /* Prompt for a yes/no response */ + UIT_INFO, /* Send info to the user */ + UIT_ERROR /* Send an error message to the user */ +}; + +/* Create and manipulate methods */ +UI_METHOD *UI_create_method(const char *name); +void UI_destroy_method(UI_METHOD *ui_method); +int UI_method_set_opener(UI_METHOD *method, int (*opener) (UI *ui)); +int UI_method_set_writer(UI_METHOD *method, + int (*writer) (UI *ui, UI_STRING *uis)); +int UI_method_set_flusher(UI_METHOD *method, int (*flusher) (UI *ui)); +int UI_method_set_reader(UI_METHOD *method, + int (*reader) (UI *ui, UI_STRING *uis)); +int UI_method_set_closer(UI_METHOD *method, int (*closer) (UI *ui)); +int UI_method_set_data_duplicator(UI_METHOD *method, + void *(*duplicator) (UI *ui, void *ui_data), + void (*destructor)(UI *ui, void *ui_data)); +int UI_method_set_prompt_constructor(UI_METHOD *method, + char *(*prompt_constructor) (UI *ui, + const char + *object_desc, + const char + *object_name)); +int UI_method_set_ex_data(UI_METHOD *method, int idx, void *data); +int (*UI_method_get_opener(const UI_METHOD *method)) (UI *); +int (*UI_method_get_writer(const UI_METHOD *method)) (UI *, UI_STRING *); +int (*UI_method_get_flusher(const UI_METHOD *method)) (UI *); +int (*UI_method_get_reader(const UI_METHOD *method)) (UI *, UI_STRING *); +int (*UI_method_get_closer(const UI_METHOD *method)) (UI *); +char *(*UI_method_get_prompt_constructor(const UI_METHOD *method)) + (UI *, const char *, const char *); +void *(*UI_method_get_data_duplicator(const UI_METHOD *method)) (UI *, void *); +void (*UI_method_get_data_destructor(const UI_METHOD *method)) (UI *, void *); +const void *UI_method_get_ex_data(const UI_METHOD *method, int idx); + +/* + * The following functions are helpers for method writers to access relevant + * data from a UI_STRING. + */ + +/* Return type of the UI_STRING */ +enum UI_string_types UI_get_string_type(UI_STRING *uis); +/* Return input flags of the UI_STRING */ +int UI_get_input_flags(UI_STRING *uis); +/* Return the actual string to output (the prompt, info or error) */ +const char *UI_get0_output_string(UI_STRING *uis); +/* + * Return the optional action string to output (the boolean prompt + * instruction) + */ +const char *UI_get0_action_string(UI_STRING *uis); +/* Return the result of a prompt */ +const char *UI_get0_result_string(UI_STRING *uis); +int UI_get_result_string_length(UI_STRING *uis); +/* + * Return the string to test the result against. Only useful with verifies. + */ +const char *UI_get0_test_string(UI_STRING *uis); +/* Return the required minimum size of the result */ +int UI_get_result_minsize(UI_STRING *uis); +/* Return the required maximum size of the result */ +int UI_get_result_maxsize(UI_STRING *uis); +/* Set the result of a UI_STRING. */ +int UI_set_result(UI *ui, UI_STRING *uis, const char *result); +int UI_set_result_ex(UI *ui, UI_STRING *uis, const char *result, int len); + +/* A couple of popular utility functions */ +int UI_UTIL_read_pw_string(char *buf, int length, const char *prompt, + int verify); +int UI_UTIL_read_pw(char *buf, char *buff, int size, const char *prompt, + int verify); +UI_METHOD *UI_UTIL_wrap_read_pem_callback(pem_password_cb *cb, int rwflag); + + +# ifdef __cplusplus +} +# endif +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/uierr.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/uierr.h new file mode 100644 index 0000000..bd68864 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/uierr.h @@ -0,0 +1,65 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_UIERR_H +# define HEADER_UIERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_UI_strings(void); + +/* + * UI function codes. + */ +# define UI_F_CLOSE_CONSOLE 115 +# define UI_F_ECHO_CONSOLE 116 +# define UI_F_GENERAL_ALLOCATE_BOOLEAN 108 +# define UI_F_GENERAL_ALLOCATE_PROMPT 109 +# define UI_F_NOECHO_CONSOLE 117 +# define UI_F_OPEN_CONSOLE 114 +# define UI_F_UI_CONSTRUCT_PROMPT 121 +# define UI_F_UI_CREATE_METHOD 112 +# define UI_F_UI_CTRL 111 +# define UI_F_UI_DUP_ERROR_STRING 101 +# define UI_F_UI_DUP_INFO_STRING 102 +# define UI_F_UI_DUP_INPUT_BOOLEAN 110 +# define UI_F_UI_DUP_INPUT_STRING 103 +# define UI_F_UI_DUP_USER_DATA 118 +# define UI_F_UI_DUP_VERIFY_STRING 106 +# define UI_F_UI_GET0_RESULT 107 +# define UI_F_UI_GET_RESULT_LENGTH 119 +# define UI_F_UI_NEW_METHOD 104 +# define UI_F_UI_PROCESS 113 +# define UI_F_UI_SET_RESULT 105 +# define UI_F_UI_SET_RESULT_EX 120 + +/* + * UI reason codes. + */ +# define UI_R_COMMON_OK_AND_CANCEL_CHARACTERS 104 +# define UI_R_INDEX_TOO_LARGE 102 +# define UI_R_INDEX_TOO_SMALL 103 +# define UI_R_NO_RESULT_BUFFER 105 +# define UI_R_PROCESSING_ERROR 107 +# define UI_R_RESULT_TOO_LARGE 100 +# define UI_R_RESULT_TOO_SMALL 101 +# define UI_R_SYSASSIGN_ERROR 109 +# define UI_R_SYSDASSGN_ERROR 110 +# define UI_R_SYSQIOW_ERROR 111 +# define UI_R_UNKNOWN_CONTROL_COMMAND 106 +# define UI_R_UNKNOWN_TTYGET_ERRNO_VALUE 108 +# define UI_R_USER_DATA_DUPLICATION_UNSUPPORTED 112 + +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/whrlpool.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/whrlpool.h new file mode 100644 index 0000000..20ea350 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/whrlpool.h @@ -0,0 +1,48 @@ +/* + * Copyright 2005-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_WHRLPOOL_H +# define HEADER_WHRLPOOL_H + +#include + +# ifndef OPENSSL_NO_WHIRLPOOL +# include +# include +# ifdef __cplusplus +extern "C" { +# endif + +# define WHIRLPOOL_DIGEST_LENGTH (512/8) +# define WHIRLPOOL_BBLOCK 512 +# define WHIRLPOOL_COUNTER (256/8) + +typedef struct { + union { + unsigned char c[WHIRLPOOL_DIGEST_LENGTH]; + /* double q is here to ensure 64-bit alignment */ + double q[WHIRLPOOL_DIGEST_LENGTH / sizeof(double)]; + } H; + unsigned char data[WHIRLPOOL_BBLOCK / 8]; + unsigned int bitoff; + size_t bitlen[WHIRLPOOL_COUNTER / sizeof(size_t)]; +} WHIRLPOOL_CTX; + +int WHIRLPOOL_Init(WHIRLPOOL_CTX *c); +int WHIRLPOOL_Update(WHIRLPOOL_CTX *c, const void *inp, size_t bytes); +void WHIRLPOOL_BitUpdate(WHIRLPOOL_CTX *c, const void *inp, size_t bits); +int WHIRLPOOL_Final(unsigned char *md, WHIRLPOOL_CTX *c); +unsigned char *WHIRLPOOL(const void *inp, size_t bytes, unsigned char *md); + +# ifdef __cplusplus +} +# endif +# endif + +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/x509.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/x509.h new file mode 100644 index 0000000..39ca0ba --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/x509.h @@ -0,0 +1,1047 @@ +/* + * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. + * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_X509_H +# define HEADER_X509_H + +# include +# include +# include +# include +# include +# include +# include +# include +# include + +# if OPENSSL_API_COMPAT < 0x10100000L +# include +# include +# include +# endif + +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + + +/* Flags for X509_get_signature_info() */ +/* Signature info is valid */ +# define X509_SIG_INFO_VALID 0x1 +/* Signature is suitable for TLS use */ +# define X509_SIG_INFO_TLS 0x2 + +# define X509_FILETYPE_PEM 1 +# define X509_FILETYPE_ASN1 2 +# define X509_FILETYPE_DEFAULT 3 + +# define X509v3_KU_DIGITAL_SIGNATURE 0x0080 +# define X509v3_KU_NON_REPUDIATION 0x0040 +# define X509v3_KU_KEY_ENCIPHERMENT 0x0020 +# define X509v3_KU_DATA_ENCIPHERMENT 0x0010 +# define X509v3_KU_KEY_AGREEMENT 0x0008 +# define X509v3_KU_KEY_CERT_SIGN 0x0004 +# define X509v3_KU_CRL_SIGN 0x0002 +# define X509v3_KU_ENCIPHER_ONLY 0x0001 +# define X509v3_KU_DECIPHER_ONLY 0x8000 +# define X509v3_KU_UNDEF 0xffff + +struct X509_algor_st { + ASN1_OBJECT *algorithm; + ASN1_TYPE *parameter; +} /* X509_ALGOR */ ; + +typedef STACK_OF(X509_ALGOR) X509_ALGORS; + +typedef struct X509_val_st { + ASN1_TIME *notBefore; + ASN1_TIME *notAfter; +} X509_VAL; + +typedef struct X509_sig_st X509_SIG; + +typedef struct X509_name_entry_st X509_NAME_ENTRY; + +DEFINE_STACK_OF(X509_NAME_ENTRY) + +DEFINE_STACK_OF(X509_NAME) + +# define X509_EX_V_NETSCAPE_HACK 0x8000 +# define X509_EX_V_INIT 0x0001 +typedef struct X509_extension_st X509_EXTENSION; + +typedef STACK_OF(X509_EXTENSION) X509_EXTENSIONS; + +DEFINE_STACK_OF(X509_EXTENSION) + +typedef struct x509_attributes_st X509_ATTRIBUTE; + +DEFINE_STACK_OF(X509_ATTRIBUTE) + +typedef struct X509_req_info_st X509_REQ_INFO; + +typedef struct X509_req_st X509_REQ; + +typedef struct x509_cert_aux_st X509_CERT_AUX; + +typedef struct x509_cinf_st X509_CINF; + +DEFINE_STACK_OF(X509) + +/* This is used for a table of trust checking functions */ + +typedef struct x509_trust_st { + int trust; + int flags; + int (*check_trust) (struct x509_trust_st *, X509 *, int); + char *name; + int arg1; + void *arg2; +} X509_TRUST; + +DEFINE_STACK_OF(X509_TRUST) + +/* standard trust ids */ + +# define X509_TRUST_DEFAULT 0 /* Only valid in purpose settings */ + +# define X509_TRUST_COMPAT 1 +# define X509_TRUST_SSL_CLIENT 2 +# define X509_TRUST_SSL_SERVER 3 +# define X509_TRUST_EMAIL 4 +# define X509_TRUST_OBJECT_SIGN 5 +# define X509_TRUST_OCSP_SIGN 6 +# define X509_TRUST_OCSP_REQUEST 7 +# define X509_TRUST_TSA 8 + +/* Keep these up to date! */ +# define X509_TRUST_MIN 1 +# define X509_TRUST_MAX 8 + +/* trust_flags values */ +# define X509_TRUST_DYNAMIC (1U << 0) +# define X509_TRUST_DYNAMIC_NAME (1U << 1) +/* No compat trust if self-signed, preempts "DO_SS" */ +# define X509_TRUST_NO_SS_COMPAT (1U << 2) +/* Compat trust if no explicit accepted trust EKUs */ +# define X509_TRUST_DO_SS_COMPAT (1U << 3) +/* Accept "anyEKU" as a wildcard trust OID */ +# define X509_TRUST_OK_ANY_EKU (1U << 4) + +/* check_trust return codes */ + +# define X509_TRUST_TRUSTED 1 +# define X509_TRUST_REJECTED 2 +# define X509_TRUST_UNTRUSTED 3 + +/* Flags for X509_print_ex() */ + +# define X509_FLAG_COMPAT 0 +# define X509_FLAG_NO_HEADER 1L +# define X509_FLAG_NO_VERSION (1L << 1) +# define X509_FLAG_NO_SERIAL (1L << 2) +# define X509_FLAG_NO_SIGNAME (1L << 3) +# define X509_FLAG_NO_ISSUER (1L << 4) +# define X509_FLAG_NO_VALIDITY (1L << 5) +# define X509_FLAG_NO_SUBJECT (1L << 6) +# define X509_FLAG_NO_PUBKEY (1L << 7) +# define X509_FLAG_NO_EXTENSIONS (1L << 8) +# define X509_FLAG_NO_SIGDUMP (1L << 9) +# define X509_FLAG_NO_AUX (1L << 10) +# define X509_FLAG_NO_ATTRIBUTES (1L << 11) +# define X509_FLAG_NO_IDS (1L << 12) + +/* Flags specific to X509_NAME_print_ex() */ + +/* The field separator information */ + +# define XN_FLAG_SEP_MASK (0xf << 16) + +# define XN_FLAG_COMPAT 0/* Traditional; use old X509_NAME_print */ +# define XN_FLAG_SEP_COMMA_PLUS (1 << 16)/* RFC2253 ,+ */ +# define XN_FLAG_SEP_CPLUS_SPC (2 << 16)/* ,+ spaced: more readable */ +# define XN_FLAG_SEP_SPLUS_SPC (3 << 16)/* ;+ spaced */ +# define XN_FLAG_SEP_MULTILINE (4 << 16)/* One line per field */ + +# define XN_FLAG_DN_REV (1 << 20)/* Reverse DN order */ + +/* How the field name is shown */ + +# define XN_FLAG_FN_MASK (0x3 << 21) + +# define XN_FLAG_FN_SN 0/* Object short name */ +# define XN_FLAG_FN_LN (1 << 21)/* Object long name */ +# define XN_FLAG_FN_OID (2 << 21)/* Always use OIDs */ +# define XN_FLAG_FN_NONE (3 << 21)/* No field names */ + +# define XN_FLAG_SPC_EQ (1 << 23)/* Put spaces round '=' */ + +/* + * This determines if we dump fields we don't recognise: RFC2253 requires + * this. + */ + +# define XN_FLAG_DUMP_UNKNOWN_FIELDS (1 << 24) + +# define XN_FLAG_FN_ALIGN (1 << 25)/* Align field names to 20 + * characters */ + +/* Complete set of RFC2253 flags */ + +# define XN_FLAG_RFC2253 (ASN1_STRFLGS_RFC2253 | \ + XN_FLAG_SEP_COMMA_PLUS | \ + XN_FLAG_DN_REV | \ + XN_FLAG_FN_SN | \ + XN_FLAG_DUMP_UNKNOWN_FIELDS) + +/* readable oneline form */ + +# define XN_FLAG_ONELINE (ASN1_STRFLGS_RFC2253 | \ + ASN1_STRFLGS_ESC_QUOTE | \ + XN_FLAG_SEP_CPLUS_SPC | \ + XN_FLAG_SPC_EQ | \ + XN_FLAG_FN_SN) + +/* readable multiline form */ + +# define XN_FLAG_MULTILINE (ASN1_STRFLGS_ESC_CTRL | \ + ASN1_STRFLGS_ESC_MSB | \ + XN_FLAG_SEP_MULTILINE | \ + XN_FLAG_SPC_EQ | \ + XN_FLAG_FN_LN | \ + XN_FLAG_FN_ALIGN) + +DEFINE_STACK_OF(X509_REVOKED) + +typedef struct X509_crl_info_st X509_CRL_INFO; + +DEFINE_STACK_OF(X509_CRL) + +typedef struct private_key_st { + int version; + /* The PKCS#8 data types */ + X509_ALGOR *enc_algor; + ASN1_OCTET_STRING *enc_pkey; /* encrypted pub key */ + /* When decrypted, the following will not be NULL */ + EVP_PKEY *dec_pkey; + /* used to encrypt and decrypt */ + int key_length; + char *key_data; + int key_free; /* true if we should auto free key_data */ + /* expanded version of 'enc_algor' */ + EVP_CIPHER_INFO cipher; +} X509_PKEY; + +typedef struct X509_info_st { + X509 *x509; + X509_CRL *crl; + X509_PKEY *x_pkey; + EVP_CIPHER_INFO enc_cipher; + int enc_len; + char *enc_data; +} X509_INFO; + +DEFINE_STACK_OF(X509_INFO) + +/* + * The next 2 structures and their 8 routines are used to manipulate Netscape's + * spki structures - useful if you are writing a CA web page + */ +typedef struct Netscape_spkac_st { + X509_PUBKEY *pubkey; + ASN1_IA5STRING *challenge; /* challenge sent in atlas >= PR2 */ +} NETSCAPE_SPKAC; + +typedef struct Netscape_spki_st { + NETSCAPE_SPKAC *spkac; /* signed public key and challenge */ + X509_ALGOR sig_algor; + ASN1_BIT_STRING *signature; +} NETSCAPE_SPKI; + +/* Netscape certificate sequence structure */ +typedef struct Netscape_certificate_sequence { + ASN1_OBJECT *type; + STACK_OF(X509) *certs; +} NETSCAPE_CERT_SEQUENCE; + +/*- Unused (and iv length is wrong) +typedef struct CBCParameter_st + { + unsigned char iv[8]; + } CBC_PARAM; +*/ + +/* Password based encryption structure */ + +typedef struct PBEPARAM_st { + ASN1_OCTET_STRING *salt; + ASN1_INTEGER *iter; +} PBEPARAM; + +/* Password based encryption V2 structures */ + +typedef struct PBE2PARAM_st { + X509_ALGOR *keyfunc; + X509_ALGOR *encryption; +} PBE2PARAM; + +typedef struct PBKDF2PARAM_st { +/* Usually OCTET STRING but could be anything */ + ASN1_TYPE *salt; + ASN1_INTEGER *iter; + ASN1_INTEGER *keylength; + X509_ALGOR *prf; +} PBKDF2PARAM; + +#ifndef OPENSSL_NO_SCRYPT +typedef struct SCRYPT_PARAMS_st { + ASN1_OCTET_STRING *salt; + ASN1_INTEGER *costParameter; + ASN1_INTEGER *blockSize; + ASN1_INTEGER *parallelizationParameter; + ASN1_INTEGER *keyLength; +} SCRYPT_PARAMS; +#endif + +#ifdef __cplusplus +} +#endif + +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + +# define X509_EXT_PACK_UNKNOWN 1 +# define X509_EXT_PACK_STRING 2 + +# define X509_extract_key(x) X509_get_pubkey(x)/*****/ +# define X509_REQ_extract_key(a) X509_REQ_get_pubkey(a) +# define X509_name_cmp(a,b) X509_NAME_cmp((a),(b)) + +void X509_CRL_set_default_method(const X509_CRL_METHOD *meth); +X509_CRL_METHOD *X509_CRL_METHOD_new(int (*crl_init) (X509_CRL *crl), + int (*crl_free) (X509_CRL *crl), + int (*crl_lookup) (X509_CRL *crl, + X509_REVOKED **ret, + ASN1_INTEGER *ser, + X509_NAME *issuer), + int (*crl_verify) (X509_CRL *crl, + EVP_PKEY *pk)); +void X509_CRL_METHOD_free(X509_CRL_METHOD *m); + +void X509_CRL_set_meth_data(X509_CRL *crl, void *dat); +void *X509_CRL_get_meth_data(X509_CRL *crl); + +const char *X509_verify_cert_error_string(long n); + +int X509_verify(X509 *a, EVP_PKEY *r); + +int X509_REQ_verify(X509_REQ *a, EVP_PKEY *r); +int X509_CRL_verify(X509_CRL *a, EVP_PKEY *r); +int NETSCAPE_SPKI_verify(NETSCAPE_SPKI *a, EVP_PKEY *r); + +NETSCAPE_SPKI *NETSCAPE_SPKI_b64_decode(const char *str, int len); +char *NETSCAPE_SPKI_b64_encode(NETSCAPE_SPKI *x); +EVP_PKEY *NETSCAPE_SPKI_get_pubkey(NETSCAPE_SPKI *x); +int NETSCAPE_SPKI_set_pubkey(NETSCAPE_SPKI *x, EVP_PKEY *pkey); + +int NETSCAPE_SPKI_print(BIO *out, NETSCAPE_SPKI *spki); + +int X509_signature_dump(BIO *bp, const ASN1_STRING *sig, int indent); +int X509_signature_print(BIO *bp, const X509_ALGOR *alg, + const ASN1_STRING *sig); + +int X509_sign(X509 *x, EVP_PKEY *pkey, const EVP_MD *md); +int X509_sign_ctx(X509 *x, EVP_MD_CTX *ctx); +# ifndef OPENSSL_NO_OCSP +int X509_http_nbio(OCSP_REQ_CTX *rctx, X509 **pcert); +# endif +int X509_REQ_sign(X509_REQ *x, EVP_PKEY *pkey, const EVP_MD *md); +int X509_REQ_sign_ctx(X509_REQ *x, EVP_MD_CTX *ctx); +int X509_CRL_sign(X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *md); +int X509_CRL_sign_ctx(X509_CRL *x, EVP_MD_CTX *ctx); +# ifndef OPENSSL_NO_OCSP +int X509_CRL_http_nbio(OCSP_REQ_CTX *rctx, X509_CRL **pcrl); +# endif +int NETSCAPE_SPKI_sign(NETSCAPE_SPKI *x, EVP_PKEY *pkey, const EVP_MD *md); + +int X509_pubkey_digest(const X509 *data, const EVP_MD *type, + unsigned char *md, unsigned int *len); +int X509_digest(const X509 *data, const EVP_MD *type, + unsigned char *md, unsigned int *len); +int X509_CRL_digest(const X509_CRL *data, const EVP_MD *type, + unsigned char *md, unsigned int *len); +int X509_REQ_digest(const X509_REQ *data, const EVP_MD *type, + unsigned char *md, unsigned int *len); +int X509_NAME_digest(const X509_NAME *data, const EVP_MD *type, + unsigned char *md, unsigned int *len); + +# ifndef OPENSSL_NO_STDIO +X509 *d2i_X509_fp(FILE *fp, X509 **x509); +int i2d_X509_fp(FILE *fp, X509 *x509); +X509_CRL *d2i_X509_CRL_fp(FILE *fp, X509_CRL **crl); +int i2d_X509_CRL_fp(FILE *fp, X509_CRL *crl); +X509_REQ *d2i_X509_REQ_fp(FILE *fp, X509_REQ **req); +int i2d_X509_REQ_fp(FILE *fp, X509_REQ *req); +# ifndef OPENSSL_NO_RSA +RSA *d2i_RSAPrivateKey_fp(FILE *fp, RSA **rsa); +int i2d_RSAPrivateKey_fp(FILE *fp, RSA *rsa); +RSA *d2i_RSAPublicKey_fp(FILE *fp, RSA **rsa); +int i2d_RSAPublicKey_fp(FILE *fp, RSA *rsa); +RSA *d2i_RSA_PUBKEY_fp(FILE *fp, RSA **rsa); +int i2d_RSA_PUBKEY_fp(FILE *fp, RSA *rsa); +# endif +# ifndef OPENSSL_NO_DSA +DSA *d2i_DSA_PUBKEY_fp(FILE *fp, DSA **dsa); +int i2d_DSA_PUBKEY_fp(FILE *fp, DSA *dsa); +DSA *d2i_DSAPrivateKey_fp(FILE *fp, DSA **dsa); +int i2d_DSAPrivateKey_fp(FILE *fp, DSA *dsa); +# endif +# ifndef OPENSSL_NO_EC +EC_KEY *d2i_EC_PUBKEY_fp(FILE *fp, EC_KEY **eckey); +int i2d_EC_PUBKEY_fp(FILE *fp, EC_KEY *eckey); +EC_KEY *d2i_ECPrivateKey_fp(FILE *fp, EC_KEY **eckey); +int i2d_ECPrivateKey_fp(FILE *fp, EC_KEY *eckey); +# endif +X509_SIG *d2i_PKCS8_fp(FILE *fp, X509_SIG **p8); +int i2d_PKCS8_fp(FILE *fp, X509_SIG *p8); +PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_fp(FILE *fp, + PKCS8_PRIV_KEY_INFO **p8inf); +int i2d_PKCS8_PRIV_KEY_INFO_fp(FILE *fp, PKCS8_PRIV_KEY_INFO *p8inf); +int i2d_PKCS8PrivateKeyInfo_fp(FILE *fp, EVP_PKEY *key); +int i2d_PrivateKey_fp(FILE *fp, EVP_PKEY *pkey); +EVP_PKEY *d2i_PrivateKey_fp(FILE *fp, EVP_PKEY **a); +int i2d_PUBKEY_fp(FILE *fp, EVP_PKEY *pkey); +EVP_PKEY *d2i_PUBKEY_fp(FILE *fp, EVP_PKEY **a); +# endif + +X509 *d2i_X509_bio(BIO *bp, X509 **x509); +int i2d_X509_bio(BIO *bp, X509 *x509); +X509_CRL *d2i_X509_CRL_bio(BIO *bp, X509_CRL **crl); +int i2d_X509_CRL_bio(BIO *bp, X509_CRL *crl); +X509_REQ *d2i_X509_REQ_bio(BIO *bp, X509_REQ **req); +int i2d_X509_REQ_bio(BIO *bp, X509_REQ *req); +# ifndef OPENSSL_NO_RSA +RSA *d2i_RSAPrivateKey_bio(BIO *bp, RSA **rsa); +int i2d_RSAPrivateKey_bio(BIO *bp, RSA *rsa); +RSA *d2i_RSAPublicKey_bio(BIO *bp, RSA **rsa); +int i2d_RSAPublicKey_bio(BIO *bp, RSA *rsa); +RSA *d2i_RSA_PUBKEY_bio(BIO *bp, RSA **rsa); +int i2d_RSA_PUBKEY_bio(BIO *bp, RSA *rsa); +# endif +# ifndef OPENSSL_NO_DSA +DSA *d2i_DSA_PUBKEY_bio(BIO *bp, DSA **dsa); +int i2d_DSA_PUBKEY_bio(BIO *bp, DSA *dsa); +DSA *d2i_DSAPrivateKey_bio(BIO *bp, DSA **dsa); +int i2d_DSAPrivateKey_bio(BIO *bp, DSA *dsa); +# endif +# ifndef OPENSSL_NO_EC +EC_KEY *d2i_EC_PUBKEY_bio(BIO *bp, EC_KEY **eckey); +int i2d_EC_PUBKEY_bio(BIO *bp, EC_KEY *eckey); +EC_KEY *d2i_ECPrivateKey_bio(BIO *bp, EC_KEY **eckey); +int i2d_ECPrivateKey_bio(BIO *bp, EC_KEY *eckey); +# endif +X509_SIG *d2i_PKCS8_bio(BIO *bp, X509_SIG **p8); +int i2d_PKCS8_bio(BIO *bp, X509_SIG *p8); +PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_bio(BIO *bp, + PKCS8_PRIV_KEY_INFO **p8inf); +int i2d_PKCS8_PRIV_KEY_INFO_bio(BIO *bp, PKCS8_PRIV_KEY_INFO *p8inf); +int i2d_PKCS8PrivateKeyInfo_bio(BIO *bp, EVP_PKEY *key); +int i2d_PrivateKey_bio(BIO *bp, EVP_PKEY *pkey); +EVP_PKEY *d2i_PrivateKey_bio(BIO *bp, EVP_PKEY **a); +int i2d_PUBKEY_bio(BIO *bp, EVP_PKEY *pkey); +EVP_PKEY *d2i_PUBKEY_bio(BIO *bp, EVP_PKEY **a); + +X509 *X509_dup(X509 *x509); +X509_ATTRIBUTE *X509_ATTRIBUTE_dup(X509_ATTRIBUTE *xa); +X509_EXTENSION *X509_EXTENSION_dup(X509_EXTENSION *ex); +X509_CRL *X509_CRL_dup(X509_CRL *crl); +X509_REVOKED *X509_REVOKED_dup(X509_REVOKED *rev); +X509_REQ *X509_REQ_dup(X509_REQ *req); +X509_ALGOR *X509_ALGOR_dup(X509_ALGOR *xn); +int X509_ALGOR_set0(X509_ALGOR *alg, ASN1_OBJECT *aobj, int ptype, + void *pval); +void X509_ALGOR_get0(const ASN1_OBJECT **paobj, int *pptype, + const void **ppval, const X509_ALGOR *algor); +void X509_ALGOR_set_md(X509_ALGOR *alg, const EVP_MD *md); +int X509_ALGOR_cmp(const X509_ALGOR *a, const X509_ALGOR *b); + +X509_NAME *X509_NAME_dup(X509_NAME *xn); +X509_NAME_ENTRY *X509_NAME_ENTRY_dup(X509_NAME_ENTRY *ne); + +int X509_cmp_time(const ASN1_TIME *s, time_t *t); +int X509_cmp_current_time(const ASN1_TIME *s); +ASN1_TIME *X509_time_adj(ASN1_TIME *s, long adj, time_t *t); +ASN1_TIME *X509_time_adj_ex(ASN1_TIME *s, + int offset_day, long offset_sec, time_t *t); +ASN1_TIME *X509_gmtime_adj(ASN1_TIME *s, long adj); + +const char *X509_get_default_cert_area(void); +const char *X509_get_default_cert_dir(void); +const char *X509_get_default_cert_file(void); +const char *X509_get_default_cert_dir_env(void); +const char *X509_get_default_cert_file_env(void); +const char *X509_get_default_private_dir(void); + +X509_REQ *X509_to_X509_REQ(X509 *x, EVP_PKEY *pkey, const EVP_MD *md); +X509 *X509_REQ_to_X509(X509_REQ *r, int days, EVP_PKEY *pkey); + +DECLARE_ASN1_FUNCTIONS(X509_ALGOR) +DECLARE_ASN1_ENCODE_FUNCTIONS(X509_ALGORS, X509_ALGORS, X509_ALGORS) +DECLARE_ASN1_FUNCTIONS(X509_VAL) + +DECLARE_ASN1_FUNCTIONS(X509_PUBKEY) + +int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey); +EVP_PKEY *X509_PUBKEY_get0(X509_PUBKEY *key); +EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key); +int X509_get_pubkey_parameters(EVP_PKEY *pkey, STACK_OF(X509) *chain); +long X509_get_pathlen(X509 *x); +int i2d_PUBKEY(EVP_PKEY *a, unsigned char **pp); +EVP_PKEY *d2i_PUBKEY(EVP_PKEY **a, const unsigned char **pp, long length); +# ifndef OPENSSL_NO_RSA +int i2d_RSA_PUBKEY(RSA *a, unsigned char **pp); +RSA *d2i_RSA_PUBKEY(RSA **a, const unsigned char **pp, long length); +# endif +# ifndef OPENSSL_NO_DSA +int i2d_DSA_PUBKEY(DSA *a, unsigned char **pp); +DSA *d2i_DSA_PUBKEY(DSA **a, const unsigned char **pp, long length); +# endif +# ifndef OPENSSL_NO_EC +int i2d_EC_PUBKEY(EC_KEY *a, unsigned char **pp); +EC_KEY *d2i_EC_PUBKEY(EC_KEY **a, const unsigned char **pp, long length); +# endif + +DECLARE_ASN1_FUNCTIONS(X509_SIG) +void X509_SIG_get0(const X509_SIG *sig, const X509_ALGOR **palg, + const ASN1_OCTET_STRING **pdigest); +void X509_SIG_getm(X509_SIG *sig, X509_ALGOR **palg, + ASN1_OCTET_STRING **pdigest); + +DECLARE_ASN1_FUNCTIONS(X509_REQ_INFO) +DECLARE_ASN1_FUNCTIONS(X509_REQ) + +DECLARE_ASN1_FUNCTIONS(X509_ATTRIBUTE) +X509_ATTRIBUTE *X509_ATTRIBUTE_create(int nid, int atrtype, void *value); + +DECLARE_ASN1_FUNCTIONS(X509_EXTENSION) +DECLARE_ASN1_ENCODE_FUNCTIONS(X509_EXTENSIONS, X509_EXTENSIONS, X509_EXTENSIONS) + +DECLARE_ASN1_FUNCTIONS(X509_NAME_ENTRY) + +DECLARE_ASN1_FUNCTIONS(X509_NAME) + +int X509_NAME_set(X509_NAME **xn, X509_NAME *name); + +DECLARE_ASN1_FUNCTIONS(X509_CINF) + +DECLARE_ASN1_FUNCTIONS(X509) +DECLARE_ASN1_FUNCTIONS(X509_CERT_AUX) + +#define X509_get_ex_new_index(l, p, newf, dupf, freef) \ + CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_X509, l, p, newf, dupf, freef) +int X509_set_ex_data(X509 *r, int idx, void *arg); +void *X509_get_ex_data(X509 *r, int idx); +int i2d_X509_AUX(X509 *a, unsigned char **pp); +X509 *d2i_X509_AUX(X509 **a, const unsigned char **pp, long length); + +int i2d_re_X509_tbs(X509 *x, unsigned char **pp); + +int X509_SIG_INFO_get(const X509_SIG_INFO *siginf, int *mdnid, int *pknid, + int *secbits, uint32_t *flags); +void X509_SIG_INFO_set(X509_SIG_INFO *siginf, int mdnid, int pknid, + int secbits, uint32_t flags); + +int X509_get_signature_info(X509 *x, int *mdnid, int *pknid, int *secbits, + uint32_t *flags); + +void X509_get0_signature(const ASN1_BIT_STRING **psig, + const X509_ALGOR **palg, const X509 *x); +int X509_get_signature_nid(const X509 *x); + +int X509_trusted(const X509 *x); +int X509_alias_set1(X509 *x, const unsigned char *name, int len); +int X509_keyid_set1(X509 *x, const unsigned char *id, int len); +unsigned char *X509_alias_get0(X509 *x, int *len); +unsigned char *X509_keyid_get0(X509 *x, int *len); +int (*X509_TRUST_set_default(int (*trust) (int, X509 *, int))) (int, X509 *, + int); +int X509_TRUST_set(int *t, int trust); +int X509_add1_trust_object(X509 *x, const ASN1_OBJECT *obj); +int X509_add1_reject_object(X509 *x, const ASN1_OBJECT *obj); +void X509_trust_clear(X509 *x); +void X509_reject_clear(X509 *x); + +STACK_OF(ASN1_OBJECT) *X509_get0_trust_objects(X509 *x); +STACK_OF(ASN1_OBJECT) *X509_get0_reject_objects(X509 *x); + +DECLARE_ASN1_FUNCTIONS(X509_REVOKED) +DECLARE_ASN1_FUNCTIONS(X509_CRL_INFO) +DECLARE_ASN1_FUNCTIONS(X509_CRL) + +int X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev); +int X509_CRL_get0_by_serial(X509_CRL *crl, + X509_REVOKED **ret, ASN1_INTEGER *serial); +int X509_CRL_get0_by_cert(X509_CRL *crl, X509_REVOKED **ret, X509 *x); + +X509_PKEY *X509_PKEY_new(void); +void X509_PKEY_free(X509_PKEY *a); + +DECLARE_ASN1_FUNCTIONS(NETSCAPE_SPKI) +DECLARE_ASN1_FUNCTIONS(NETSCAPE_SPKAC) +DECLARE_ASN1_FUNCTIONS(NETSCAPE_CERT_SEQUENCE) + +X509_INFO *X509_INFO_new(void); +void X509_INFO_free(X509_INFO *a); +char *X509_NAME_oneline(const X509_NAME *a, char *buf, int size); + +int ASN1_verify(i2d_of_void *i2d, X509_ALGOR *algor1, + ASN1_BIT_STRING *signature, char *data, EVP_PKEY *pkey); + +int ASN1_digest(i2d_of_void *i2d, const EVP_MD *type, char *data, + unsigned char *md, unsigned int *len); + +int ASN1_sign(i2d_of_void *i2d, X509_ALGOR *algor1, + X509_ALGOR *algor2, ASN1_BIT_STRING *signature, + char *data, EVP_PKEY *pkey, const EVP_MD *type); + +int ASN1_item_digest(const ASN1_ITEM *it, const EVP_MD *type, void *data, + unsigned char *md, unsigned int *len); + +int ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *algor1, + ASN1_BIT_STRING *signature, void *data, EVP_PKEY *pkey); + +int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, + X509_ALGOR *algor2, ASN1_BIT_STRING *signature, void *data, + EVP_PKEY *pkey, const EVP_MD *type); +int ASN1_item_sign_ctx(const ASN1_ITEM *it, X509_ALGOR *algor1, + X509_ALGOR *algor2, ASN1_BIT_STRING *signature, + void *asn, EVP_MD_CTX *ctx); + +long X509_get_version(const X509 *x); +int X509_set_version(X509 *x, long version); +int X509_set_serialNumber(X509 *x, ASN1_INTEGER *serial); +ASN1_INTEGER *X509_get_serialNumber(X509 *x); +const ASN1_INTEGER *X509_get0_serialNumber(const X509 *x); +int X509_set_issuer_name(X509 *x, X509_NAME *name); +X509_NAME *X509_get_issuer_name(const X509 *a); +int X509_set_subject_name(X509 *x, X509_NAME *name); +X509_NAME *X509_get_subject_name(const X509 *a); +const ASN1_TIME * X509_get0_notBefore(const X509 *x); +ASN1_TIME *X509_getm_notBefore(const X509 *x); +int X509_set1_notBefore(X509 *x, const ASN1_TIME *tm); +const ASN1_TIME *X509_get0_notAfter(const X509 *x); +ASN1_TIME *X509_getm_notAfter(const X509 *x); +int X509_set1_notAfter(X509 *x, const ASN1_TIME *tm); +int X509_set_pubkey(X509 *x, EVP_PKEY *pkey); +int X509_up_ref(X509 *x); +int X509_get_signature_type(const X509 *x); + +# if OPENSSL_API_COMPAT < 0x10100000L +# define X509_get_notBefore X509_getm_notBefore +# define X509_get_notAfter X509_getm_notAfter +# define X509_set_notBefore X509_set1_notBefore +# define X509_set_notAfter X509_set1_notAfter +#endif + + +/* + * This one is only used so that a binary form can output, as in + * i2d_X509_PUBKEY(X509_get_X509_PUBKEY(x), &buf) + */ +X509_PUBKEY *X509_get_X509_PUBKEY(const X509 *x); +const STACK_OF(X509_EXTENSION) *X509_get0_extensions(const X509 *x); +void X509_get0_uids(const X509 *x, const ASN1_BIT_STRING **piuid, + const ASN1_BIT_STRING **psuid); +const X509_ALGOR *X509_get0_tbs_sigalg(const X509 *x); + +EVP_PKEY *X509_get0_pubkey(const X509 *x); +EVP_PKEY *X509_get_pubkey(X509 *x); +ASN1_BIT_STRING *X509_get0_pubkey_bitstr(const X509 *x); +int X509_certificate_type(const X509 *x, const EVP_PKEY *pubkey); + +long X509_REQ_get_version(const X509_REQ *req); +int X509_REQ_set_version(X509_REQ *x, long version); +X509_NAME *X509_REQ_get_subject_name(const X509_REQ *req); +int X509_REQ_set_subject_name(X509_REQ *req, X509_NAME *name); +void X509_REQ_get0_signature(const X509_REQ *req, const ASN1_BIT_STRING **psig, + const X509_ALGOR **palg); +int X509_REQ_get_signature_nid(const X509_REQ *req); +int i2d_re_X509_REQ_tbs(X509_REQ *req, unsigned char **pp); +int X509_REQ_set_pubkey(X509_REQ *x, EVP_PKEY *pkey); +EVP_PKEY *X509_REQ_get_pubkey(X509_REQ *req); +EVP_PKEY *X509_REQ_get0_pubkey(X509_REQ *req); +X509_PUBKEY *X509_REQ_get_X509_PUBKEY(X509_REQ *req); +int X509_REQ_extension_nid(int nid); +int *X509_REQ_get_extension_nids(void); +void X509_REQ_set_extension_nids(int *nids); +STACK_OF(X509_EXTENSION) *X509_REQ_get_extensions(X509_REQ *req); +int X509_REQ_add_extensions_nid(X509_REQ *req, STACK_OF(X509_EXTENSION) *exts, + int nid); +int X509_REQ_add_extensions(X509_REQ *req, STACK_OF(X509_EXTENSION) *exts); +int X509_REQ_get_attr_count(const X509_REQ *req); +int X509_REQ_get_attr_by_NID(const X509_REQ *req, int nid, int lastpos); +int X509_REQ_get_attr_by_OBJ(const X509_REQ *req, const ASN1_OBJECT *obj, + int lastpos); +X509_ATTRIBUTE *X509_REQ_get_attr(const X509_REQ *req, int loc); +X509_ATTRIBUTE *X509_REQ_delete_attr(X509_REQ *req, int loc); +int X509_REQ_add1_attr(X509_REQ *req, X509_ATTRIBUTE *attr); +int X509_REQ_add1_attr_by_OBJ(X509_REQ *req, + const ASN1_OBJECT *obj, int type, + const unsigned char *bytes, int len); +int X509_REQ_add1_attr_by_NID(X509_REQ *req, + int nid, int type, + const unsigned char *bytes, int len); +int X509_REQ_add1_attr_by_txt(X509_REQ *req, + const char *attrname, int type, + const unsigned char *bytes, int len); + +int X509_CRL_set_version(X509_CRL *x, long version); +int X509_CRL_set_issuer_name(X509_CRL *x, X509_NAME *name); +int X509_CRL_set1_lastUpdate(X509_CRL *x, const ASN1_TIME *tm); +int X509_CRL_set1_nextUpdate(X509_CRL *x, const ASN1_TIME *tm); +int X509_CRL_sort(X509_CRL *crl); +int X509_CRL_up_ref(X509_CRL *crl); + +# if OPENSSL_API_COMPAT < 0x10100000L +# define X509_CRL_set_lastUpdate X509_CRL_set1_lastUpdate +# define X509_CRL_set_nextUpdate X509_CRL_set1_nextUpdate +#endif + +long X509_CRL_get_version(const X509_CRL *crl); +const ASN1_TIME *X509_CRL_get0_lastUpdate(const X509_CRL *crl); +const ASN1_TIME *X509_CRL_get0_nextUpdate(const X509_CRL *crl); +DEPRECATEDIN_1_1_0(ASN1_TIME *X509_CRL_get_lastUpdate(X509_CRL *crl)) +DEPRECATEDIN_1_1_0(ASN1_TIME *X509_CRL_get_nextUpdate(X509_CRL *crl)) +X509_NAME *X509_CRL_get_issuer(const X509_CRL *crl); +const STACK_OF(X509_EXTENSION) *X509_CRL_get0_extensions(const X509_CRL *crl); +STACK_OF(X509_REVOKED) *X509_CRL_get_REVOKED(X509_CRL *crl); +void X509_CRL_get0_signature(const X509_CRL *crl, const ASN1_BIT_STRING **psig, + const X509_ALGOR **palg); +int X509_CRL_get_signature_nid(const X509_CRL *crl); +int i2d_re_X509_CRL_tbs(X509_CRL *req, unsigned char **pp); + +const ASN1_INTEGER *X509_REVOKED_get0_serialNumber(const X509_REVOKED *x); +int X509_REVOKED_set_serialNumber(X509_REVOKED *x, ASN1_INTEGER *serial); +const ASN1_TIME *X509_REVOKED_get0_revocationDate(const X509_REVOKED *x); +int X509_REVOKED_set_revocationDate(X509_REVOKED *r, ASN1_TIME *tm); +const STACK_OF(X509_EXTENSION) * +X509_REVOKED_get0_extensions(const X509_REVOKED *r); + +X509_CRL *X509_CRL_diff(X509_CRL *base, X509_CRL *newer, + EVP_PKEY *skey, const EVP_MD *md, unsigned int flags); + +int X509_REQ_check_private_key(X509_REQ *x509, EVP_PKEY *pkey); + +int X509_check_private_key(const X509 *x509, const EVP_PKEY *pkey); +int X509_chain_check_suiteb(int *perror_depth, + X509 *x, STACK_OF(X509) *chain, + unsigned long flags); +int X509_CRL_check_suiteb(X509_CRL *crl, EVP_PKEY *pk, unsigned long flags); +STACK_OF(X509) *X509_chain_up_ref(STACK_OF(X509) *chain); + +int X509_issuer_and_serial_cmp(const X509 *a, const X509 *b); +unsigned long X509_issuer_and_serial_hash(X509 *a); + +int X509_issuer_name_cmp(const X509 *a, const X509 *b); +unsigned long X509_issuer_name_hash(X509 *a); + +int X509_subject_name_cmp(const X509 *a, const X509 *b); +unsigned long X509_subject_name_hash(X509 *x); + +# ifndef OPENSSL_NO_MD5 +unsigned long X509_issuer_name_hash_old(X509 *a); +unsigned long X509_subject_name_hash_old(X509 *x); +# endif + +int X509_cmp(const X509 *a, const X509 *b); +int X509_NAME_cmp(const X509_NAME *a, const X509_NAME *b); +unsigned long X509_NAME_hash(X509_NAME *x); +unsigned long X509_NAME_hash_old(X509_NAME *x); + +int X509_CRL_cmp(const X509_CRL *a, const X509_CRL *b); +int X509_CRL_match(const X509_CRL *a, const X509_CRL *b); +int X509_aux_print(BIO *out, X509 *x, int indent); +# ifndef OPENSSL_NO_STDIO +int X509_print_ex_fp(FILE *bp, X509 *x, unsigned long nmflag, + unsigned long cflag); +int X509_print_fp(FILE *bp, X509 *x); +int X509_CRL_print_fp(FILE *bp, X509_CRL *x); +int X509_REQ_print_fp(FILE *bp, X509_REQ *req); +int X509_NAME_print_ex_fp(FILE *fp, const X509_NAME *nm, int indent, + unsigned long flags); +# endif + +int X509_NAME_print(BIO *bp, const X509_NAME *name, int obase); +int X509_NAME_print_ex(BIO *out, const X509_NAME *nm, int indent, + unsigned long flags); +int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflag, + unsigned long cflag); +int X509_print(BIO *bp, X509 *x); +int X509_ocspid_print(BIO *bp, X509 *x); +int X509_CRL_print_ex(BIO *out, X509_CRL *x, unsigned long nmflag); +int X509_CRL_print(BIO *bp, X509_CRL *x); +int X509_REQ_print_ex(BIO *bp, X509_REQ *x, unsigned long nmflag, + unsigned long cflag); +int X509_REQ_print(BIO *bp, X509_REQ *req); + +int X509_NAME_entry_count(const X509_NAME *name); +int X509_NAME_get_text_by_NID(X509_NAME *name, int nid, char *buf, int len); +int X509_NAME_get_text_by_OBJ(X509_NAME *name, const ASN1_OBJECT *obj, + char *buf, int len); + +/* + * NOTE: you should be passing -1, not 0 as lastpos. The functions that use + * lastpos, search after that position on. + */ +int X509_NAME_get_index_by_NID(X509_NAME *name, int nid, int lastpos); +int X509_NAME_get_index_by_OBJ(X509_NAME *name, const ASN1_OBJECT *obj, + int lastpos); +X509_NAME_ENTRY *X509_NAME_get_entry(const X509_NAME *name, int loc); +X509_NAME_ENTRY *X509_NAME_delete_entry(X509_NAME *name, int loc); +int X509_NAME_add_entry(X509_NAME *name, const X509_NAME_ENTRY *ne, + int loc, int set); +int X509_NAME_add_entry_by_OBJ(X509_NAME *name, const ASN1_OBJECT *obj, int type, + const unsigned char *bytes, int len, int loc, + int set); +int X509_NAME_add_entry_by_NID(X509_NAME *name, int nid, int type, + const unsigned char *bytes, int len, int loc, + int set); +X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_txt(X509_NAME_ENTRY **ne, + const char *field, int type, + const unsigned char *bytes, + int len); +X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_NID(X509_NAME_ENTRY **ne, int nid, + int type, + const unsigned char *bytes, + int len); +int X509_NAME_add_entry_by_txt(X509_NAME *name, const char *field, int type, + const unsigned char *bytes, int len, int loc, + int set); +X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_OBJ(X509_NAME_ENTRY **ne, + const ASN1_OBJECT *obj, int type, + const unsigned char *bytes, + int len); +int X509_NAME_ENTRY_set_object(X509_NAME_ENTRY *ne, const ASN1_OBJECT *obj); +int X509_NAME_ENTRY_set_data(X509_NAME_ENTRY *ne, int type, + const unsigned char *bytes, int len); +ASN1_OBJECT *X509_NAME_ENTRY_get_object(const X509_NAME_ENTRY *ne); +ASN1_STRING * X509_NAME_ENTRY_get_data(const X509_NAME_ENTRY *ne); +int X509_NAME_ENTRY_set(const X509_NAME_ENTRY *ne); + +int X509_NAME_get0_der(X509_NAME *nm, const unsigned char **pder, + size_t *pderlen); + +int X509v3_get_ext_count(const STACK_OF(X509_EXTENSION) *x); +int X509v3_get_ext_by_NID(const STACK_OF(X509_EXTENSION) *x, + int nid, int lastpos); +int X509v3_get_ext_by_OBJ(const STACK_OF(X509_EXTENSION) *x, + const ASN1_OBJECT *obj, int lastpos); +int X509v3_get_ext_by_critical(const STACK_OF(X509_EXTENSION) *x, + int crit, int lastpos); +X509_EXTENSION *X509v3_get_ext(const STACK_OF(X509_EXTENSION) *x, int loc); +X509_EXTENSION *X509v3_delete_ext(STACK_OF(X509_EXTENSION) *x, int loc); +STACK_OF(X509_EXTENSION) *X509v3_add_ext(STACK_OF(X509_EXTENSION) **x, + X509_EXTENSION *ex, int loc); + +int X509_get_ext_count(const X509 *x); +int X509_get_ext_by_NID(const X509 *x, int nid, int lastpos); +int X509_get_ext_by_OBJ(const X509 *x, const ASN1_OBJECT *obj, int lastpos); +int X509_get_ext_by_critical(const X509 *x, int crit, int lastpos); +X509_EXTENSION *X509_get_ext(const X509 *x, int loc); +X509_EXTENSION *X509_delete_ext(X509 *x, int loc); +int X509_add_ext(X509 *x, X509_EXTENSION *ex, int loc); +void *X509_get_ext_d2i(const X509 *x, int nid, int *crit, int *idx); +int X509_add1_ext_i2d(X509 *x, int nid, void *value, int crit, + unsigned long flags); + +int X509_CRL_get_ext_count(const X509_CRL *x); +int X509_CRL_get_ext_by_NID(const X509_CRL *x, int nid, int lastpos); +int X509_CRL_get_ext_by_OBJ(const X509_CRL *x, const ASN1_OBJECT *obj, + int lastpos); +int X509_CRL_get_ext_by_critical(const X509_CRL *x, int crit, int lastpos); +X509_EXTENSION *X509_CRL_get_ext(const X509_CRL *x, int loc); +X509_EXTENSION *X509_CRL_delete_ext(X509_CRL *x, int loc); +int X509_CRL_add_ext(X509_CRL *x, X509_EXTENSION *ex, int loc); +void *X509_CRL_get_ext_d2i(const X509_CRL *x, int nid, int *crit, int *idx); +int X509_CRL_add1_ext_i2d(X509_CRL *x, int nid, void *value, int crit, + unsigned long flags); + +int X509_REVOKED_get_ext_count(const X509_REVOKED *x); +int X509_REVOKED_get_ext_by_NID(const X509_REVOKED *x, int nid, int lastpos); +int X509_REVOKED_get_ext_by_OBJ(const X509_REVOKED *x, const ASN1_OBJECT *obj, + int lastpos); +int X509_REVOKED_get_ext_by_critical(const X509_REVOKED *x, int crit, + int lastpos); +X509_EXTENSION *X509_REVOKED_get_ext(const X509_REVOKED *x, int loc); +X509_EXTENSION *X509_REVOKED_delete_ext(X509_REVOKED *x, int loc); +int X509_REVOKED_add_ext(X509_REVOKED *x, X509_EXTENSION *ex, int loc); +void *X509_REVOKED_get_ext_d2i(const X509_REVOKED *x, int nid, int *crit, + int *idx); +int X509_REVOKED_add1_ext_i2d(X509_REVOKED *x, int nid, void *value, int crit, + unsigned long flags); + +X509_EXTENSION *X509_EXTENSION_create_by_NID(X509_EXTENSION **ex, + int nid, int crit, + ASN1_OCTET_STRING *data); +X509_EXTENSION *X509_EXTENSION_create_by_OBJ(X509_EXTENSION **ex, + const ASN1_OBJECT *obj, int crit, + ASN1_OCTET_STRING *data); +int X509_EXTENSION_set_object(X509_EXTENSION *ex, const ASN1_OBJECT *obj); +int X509_EXTENSION_set_critical(X509_EXTENSION *ex, int crit); +int X509_EXTENSION_set_data(X509_EXTENSION *ex, ASN1_OCTET_STRING *data); +ASN1_OBJECT *X509_EXTENSION_get_object(X509_EXTENSION *ex); +ASN1_OCTET_STRING *X509_EXTENSION_get_data(X509_EXTENSION *ne); +int X509_EXTENSION_get_critical(const X509_EXTENSION *ex); + +int X509at_get_attr_count(const STACK_OF(X509_ATTRIBUTE) *x); +int X509at_get_attr_by_NID(const STACK_OF(X509_ATTRIBUTE) *x, int nid, + int lastpos); +int X509at_get_attr_by_OBJ(const STACK_OF(X509_ATTRIBUTE) *sk, + const ASN1_OBJECT *obj, int lastpos); +X509_ATTRIBUTE *X509at_get_attr(const STACK_OF(X509_ATTRIBUTE) *x, int loc); +X509_ATTRIBUTE *X509at_delete_attr(STACK_OF(X509_ATTRIBUTE) *x, int loc); +STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr(STACK_OF(X509_ATTRIBUTE) **x, + X509_ATTRIBUTE *attr); +STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_OBJ(STACK_OF(X509_ATTRIBUTE) + **x, const ASN1_OBJECT *obj, + int type, + const unsigned char *bytes, + int len); +STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_NID(STACK_OF(X509_ATTRIBUTE) + **x, int nid, int type, + const unsigned char *bytes, + int len); +STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_txt(STACK_OF(X509_ATTRIBUTE) + **x, const char *attrname, + int type, + const unsigned char *bytes, + int len); +void *X509at_get0_data_by_OBJ(STACK_OF(X509_ATTRIBUTE) *x, + const ASN1_OBJECT *obj, int lastpos, int type); +X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_NID(X509_ATTRIBUTE **attr, int nid, + int atrtype, const void *data, + int len); +X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_OBJ(X509_ATTRIBUTE **attr, + const ASN1_OBJECT *obj, + int atrtype, const void *data, + int len); +X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_txt(X509_ATTRIBUTE **attr, + const char *atrname, int type, + const unsigned char *bytes, + int len); +int X509_ATTRIBUTE_set1_object(X509_ATTRIBUTE *attr, const ASN1_OBJECT *obj); +int X509_ATTRIBUTE_set1_data(X509_ATTRIBUTE *attr, int attrtype, + const void *data, int len); +void *X509_ATTRIBUTE_get0_data(X509_ATTRIBUTE *attr, int idx, int atrtype, + void *data); +int X509_ATTRIBUTE_count(const X509_ATTRIBUTE *attr); +ASN1_OBJECT *X509_ATTRIBUTE_get0_object(X509_ATTRIBUTE *attr); +ASN1_TYPE *X509_ATTRIBUTE_get0_type(X509_ATTRIBUTE *attr, int idx); + +int EVP_PKEY_get_attr_count(const EVP_PKEY *key); +int EVP_PKEY_get_attr_by_NID(const EVP_PKEY *key, int nid, int lastpos); +int EVP_PKEY_get_attr_by_OBJ(const EVP_PKEY *key, const ASN1_OBJECT *obj, + int lastpos); +X509_ATTRIBUTE *EVP_PKEY_get_attr(const EVP_PKEY *key, int loc); +X509_ATTRIBUTE *EVP_PKEY_delete_attr(EVP_PKEY *key, int loc); +int EVP_PKEY_add1_attr(EVP_PKEY *key, X509_ATTRIBUTE *attr); +int EVP_PKEY_add1_attr_by_OBJ(EVP_PKEY *key, + const ASN1_OBJECT *obj, int type, + const unsigned char *bytes, int len); +int EVP_PKEY_add1_attr_by_NID(EVP_PKEY *key, + int nid, int type, + const unsigned char *bytes, int len); +int EVP_PKEY_add1_attr_by_txt(EVP_PKEY *key, + const char *attrname, int type, + const unsigned char *bytes, int len); + +int X509_verify_cert(X509_STORE_CTX *ctx); + +/* lookup a cert from a X509 STACK */ +X509 *X509_find_by_issuer_and_serial(STACK_OF(X509) *sk, X509_NAME *name, + ASN1_INTEGER *serial); +X509 *X509_find_by_subject(STACK_OF(X509) *sk, X509_NAME *name); + +DECLARE_ASN1_FUNCTIONS(PBEPARAM) +DECLARE_ASN1_FUNCTIONS(PBE2PARAM) +DECLARE_ASN1_FUNCTIONS(PBKDF2PARAM) +#ifndef OPENSSL_NO_SCRYPT +DECLARE_ASN1_FUNCTIONS(SCRYPT_PARAMS) +#endif + +int PKCS5_pbe_set0_algor(X509_ALGOR *algor, int alg, int iter, + const unsigned char *salt, int saltlen); + +X509_ALGOR *PKCS5_pbe_set(int alg, int iter, + const unsigned char *salt, int saltlen); +X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter, + unsigned char *salt, int saltlen); +X509_ALGOR *PKCS5_pbe2_set_iv(const EVP_CIPHER *cipher, int iter, + unsigned char *salt, int saltlen, + unsigned char *aiv, int prf_nid); + +#ifndef OPENSSL_NO_SCRYPT +X509_ALGOR *PKCS5_pbe2_set_scrypt(const EVP_CIPHER *cipher, + const unsigned char *salt, int saltlen, + unsigned char *aiv, uint64_t N, uint64_t r, + uint64_t p); +#endif + +X509_ALGOR *PKCS5_pbkdf2_set(int iter, unsigned char *salt, int saltlen, + int prf_nid, int keylen); + +/* PKCS#8 utilities */ + +DECLARE_ASN1_FUNCTIONS(PKCS8_PRIV_KEY_INFO) + +EVP_PKEY *EVP_PKCS82PKEY(const PKCS8_PRIV_KEY_INFO *p8); +PKCS8_PRIV_KEY_INFO *EVP_PKEY2PKCS8(EVP_PKEY *pkey); + +int PKCS8_pkey_set0(PKCS8_PRIV_KEY_INFO *priv, ASN1_OBJECT *aobj, + int version, int ptype, void *pval, + unsigned char *penc, int penclen); +int PKCS8_pkey_get0(const ASN1_OBJECT **ppkalg, + const unsigned char **pk, int *ppklen, + const X509_ALGOR **pa, const PKCS8_PRIV_KEY_INFO *p8); + +const STACK_OF(X509_ATTRIBUTE) * +PKCS8_pkey_get0_attrs(const PKCS8_PRIV_KEY_INFO *p8); +int PKCS8_pkey_add1_attr_by_NID(PKCS8_PRIV_KEY_INFO *p8, int nid, int type, + const unsigned char *bytes, int len); + +int X509_PUBKEY_set0_param(X509_PUBKEY *pub, ASN1_OBJECT *aobj, + int ptype, void *pval, + unsigned char *penc, int penclen); +int X509_PUBKEY_get0_param(ASN1_OBJECT **ppkalg, + const unsigned char **pk, int *ppklen, + X509_ALGOR **pa, X509_PUBKEY *pub); + +int X509_check_trust(X509 *x, int id, int flags); +int X509_TRUST_get_count(void); +X509_TRUST *X509_TRUST_get0(int idx); +int X509_TRUST_get_by_id(int id); +int X509_TRUST_add(int id, int flags, int (*ck) (X509_TRUST *, X509 *, int), + const char *name, int arg1, void *arg2); +void X509_TRUST_cleanup(void); +int X509_TRUST_get_flags(const X509_TRUST *xp); +char *X509_TRUST_get0_name(const X509_TRUST *xp); +int X509_TRUST_get_trust(const X509_TRUST *xp); + +# ifdef __cplusplus +} +# endif +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/x509_vfy.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/x509_vfy.h new file mode 100644 index 0000000..adb8bce --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/x509_vfy.h @@ -0,0 +1,628 @@ +/* + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_X509_VFY_H +# define HEADER_X509_VFY_H + +/* + * Protect against recursion, x509.h and x509_vfy.h each include the other. + */ +# ifndef HEADER_X509_H +# include +# endif + +# include +# include +# include +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + +/*- +SSL_CTX -> X509_STORE + -> X509_LOOKUP + ->X509_LOOKUP_METHOD + -> X509_LOOKUP + ->X509_LOOKUP_METHOD + +SSL -> X509_STORE_CTX + ->X509_STORE + +The X509_STORE holds the tables etc for verification stuff. +A X509_STORE_CTX is used while validating a single certificate. +The X509_STORE has X509_LOOKUPs for looking up certs. +The X509_STORE then calls a function to actually verify the +certificate chain. +*/ + +typedef enum { + X509_LU_NONE = 0, + X509_LU_X509, X509_LU_CRL +} X509_LOOKUP_TYPE; + +#if OPENSSL_API_COMPAT < 0x10100000L +#define X509_LU_RETRY -1 +#define X509_LU_FAIL 0 +#endif + +DEFINE_STACK_OF(X509_LOOKUP) +DEFINE_STACK_OF(X509_OBJECT) +DEFINE_STACK_OF(X509_VERIFY_PARAM) + +int X509_STORE_set_depth(X509_STORE *store, int depth); + +typedef int (*X509_STORE_CTX_verify_cb)(int, X509_STORE_CTX *); +typedef int (*X509_STORE_CTX_verify_fn)(X509_STORE_CTX *); +typedef int (*X509_STORE_CTX_get_issuer_fn)(X509 **issuer, + X509_STORE_CTX *ctx, X509 *x); +typedef int (*X509_STORE_CTX_check_issued_fn)(X509_STORE_CTX *ctx, + X509 *x, X509 *issuer); +typedef int (*X509_STORE_CTX_check_revocation_fn)(X509_STORE_CTX *ctx); +typedef int (*X509_STORE_CTX_get_crl_fn)(X509_STORE_CTX *ctx, + X509_CRL **crl, X509 *x); +typedef int (*X509_STORE_CTX_check_crl_fn)(X509_STORE_CTX *ctx, X509_CRL *crl); +typedef int (*X509_STORE_CTX_cert_crl_fn)(X509_STORE_CTX *ctx, + X509_CRL *crl, X509 *x); +typedef int (*X509_STORE_CTX_check_policy_fn)(X509_STORE_CTX *ctx); +typedef STACK_OF(X509) *(*X509_STORE_CTX_lookup_certs_fn)(X509_STORE_CTX *ctx, + X509_NAME *nm); +typedef STACK_OF(X509_CRL) *(*X509_STORE_CTX_lookup_crls_fn)(X509_STORE_CTX *ctx, + X509_NAME *nm); +typedef int (*X509_STORE_CTX_cleanup_fn)(X509_STORE_CTX *ctx); + + +void X509_STORE_CTX_set_depth(X509_STORE_CTX *ctx, int depth); + +# define X509_STORE_CTX_set_app_data(ctx,data) \ + X509_STORE_CTX_set_ex_data(ctx,0,data) +# define X509_STORE_CTX_get_app_data(ctx) \ + X509_STORE_CTX_get_ex_data(ctx,0) + +# define X509_L_FILE_LOAD 1 +# define X509_L_ADD_DIR 2 + +# define X509_LOOKUP_load_file(x,name,type) \ + X509_LOOKUP_ctrl((x),X509_L_FILE_LOAD,(name),(long)(type),NULL) + +# define X509_LOOKUP_add_dir(x,name,type) \ + X509_LOOKUP_ctrl((x),X509_L_ADD_DIR,(name),(long)(type),NULL) + +# define X509_V_OK 0 +# define X509_V_ERR_UNSPECIFIED 1 +# define X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT 2 +# define X509_V_ERR_UNABLE_TO_GET_CRL 3 +# define X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE 4 +# define X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE 5 +# define X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY 6 +# define X509_V_ERR_CERT_SIGNATURE_FAILURE 7 +# define X509_V_ERR_CRL_SIGNATURE_FAILURE 8 +# define X509_V_ERR_CERT_NOT_YET_VALID 9 +# define X509_V_ERR_CERT_HAS_EXPIRED 10 +# define X509_V_ERR_CRL_NOT_YET_VALID 11 +# define X509_V_ERR_CRL_HAS_EXPIRED 12 +# define X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD 13 +# define X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD 14 +# define X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD 15 +# define X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD 16 +# define X509_V_ERR_OUT_OF_MEM 17 +# define X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT 18 +# define X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN 19 +# define X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY 20 +# define X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE 21 +# define X509_V_ERR_CERT_CHAIN_TOO_LONG 22 +# define X509_V_ERR_CERT_REVOKED 23 +# define X509_V_ERR_INVALID_CA 24 +# define X509_V_ERR_PATH_LENGTH_EXCEEDED 25 +# define X509_V_ERR_INVALID_PURPOSE 26 +# define X509_V_ERR_CERT_UNTRUSTED 27 +# define X509_V_ERR_CERT_REJECTED 28 +/* These are 'informational' when looking for issuer cert */ +# define X509_V_ERR_SUBJECT_ISSUER_MISMATCH 29 +# define X509_V_ERR_AKID_SKID_MISMATCH 30 +# define X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH 31 +# define X509_V_ERR_KEYUSAGE_NO_CERTSIGN 32 +# define X509_V_ERR_UNABLE_TO_GET_CRL_ISSUER 33 +# define X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION 34 +# define X509_V_ERR_KEYUSAGE_NO_CRL_SIGN 35 +# define X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION 36 +# define X509_V_ERR_INVALID_NON_CA 37 +# define X509_V_ERR_PROXY_PATH_LENGTH_EXCEEDED 38 +# define X509_V_ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE 39 +# define X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED 40 +# define X509_V_ERR_INVALID_EXTENSION 41 +# define X509_V_ERR_INVALID_POLICY_EXTENSION 42 +# define X509_V_ERR_NO_EXPLICIT_POLICY 43 +# define X509_V_ERR_DIFFERENT_CRL_SCOPE 44 +# define X509_V_ERR_UNSUPPORTED_EXTENSION_FEATURE 45 +# define X509_V_ERR_UNNESTED_RESOURCE 46 +# define X509_V_ERR_PERMITTED_VIOLATION 47 +# define X509_V_ERR_EXCLUDED_VIOLATION 48 +# define X509_V_ERR_SUBTREE_MINMAX 49 +/* The application is not happy */ +# define X509_V_ERR_APPLICATION_VERIFICATION 50 +# define X509_V_ERR_UNSUPPORTED_CONSTRAINT_TYPE 51 +# define X509_V_ERR_UNSUPPORTED_CONSTRAINT_SYNTAX 52 +# define X509_V_ERR_UNSUPPORTED_NAME_SYNTAX 53 +# define X509_V_ERR_CRL_PATH_VALIDATION_ERROR 54 +/* Another issuer check debug option */ +# define X509_V_ERR_PATH_LOOP 55 +/* Suite B mode algorithm violation */ +# define X509_V_ERR_SUITE_B_INVALID_VERSION 56 +# define X509_V_ERR_SUITE_B_INVALID_ALGORITHM 57 +# define X509_V_ERR_SUITE_B_INVALID_CURVE 58 +# define X509_V_ERR_SUITE_B_INVALID_SIGNATURE_ALGORITHM 59 +# define X509_V_ERR_SUITE_B_LOS_NOT_ALLOWED 60 +# define X509_V_ERR_SUITE_B_CANNOT_SIGN_P_384_WITH_P_256 61 +/* Host, email and IP check errors */ +# define X509_V_ERR_HOSTNAME_MISMATCH 62 +# define X509_V_ERR_EMAIL_MISMATCH 63 +# define X509_V_ERR_IP_ADDRESS_MISMATCH 64 +/* DANE TLSA errors */ +# define X509_V_ERR_DANE_NO_MATCH 65 +/* security level errors */ +# define X509_V_ERR_EE_KEY_TOO_SMALL 66 +# define X509_V_ERR_CA_KEY_TOO_SMALL 67 +# define X509_V_ERR_CA_MD_TOO_WEAK 68 +/* Caller error */ +# define X509_V_ERR_INVALID_CALL 69 +/* Issuer lookup error */ +# define X509_V_ERR_STORE_LOOKUP 70 +/* Certificate transparency */ +# define X509_V_ERR_NO_VALID_SCTS 71 + +# define X509_V_ERR_PROXY_SUBJECT_NAME_VIOLATION 72 +/* OCSP status errors */ +# define X509_V_ERR_OCSP_VERIFY_NEEDED 73 /* Need OCSP verification */ +# define X509_V_ERR_OCSP_VERIFY_FAILED 74 /* Couldn't verify cert through OCSP */ +# define X509_V_ERR_OCSP_CERT_UNKNOWN 75 /* Certificate wasn't recognized by the OCSP responder */ + +/* Certificate verify flags */ + +# if OPENSSL_API_COMPAT < 0x10100000L +# define X509_V_FLAG_CB_ISSUER_CHECK 0x0 /* Deprecated */ +# endif +/* Use check time instead of current time */ +# define X509_V_FLAG_USE_CHECK_TIME 0x2 +/* Lookup CRLs */ +# define X509_V_FLAG_CRL_CHECK 0x4 +/* Lookup CRLs for whole chain */ +# define X509_V_FLAG_CRL_CHECK_ALL 0x8 +/* Ignore unhandled critical extensions */ +# define X509_V_FLAG_IGNORE_CRITICAL 0x10 +/* Disable workarounds for broken certificates */ +# define X509_V_FLAG_X509_STRICT 0x20 +/* Enable proxy certificate validation */ +# define X509_V_FLAG_ALLOW_PROXY_CERTS 0x40 +/* Enable policy checking */ +# define X509_V_FLAG_POLICY_CHECK 0x80 +/* Policy variable require-explicit-policy */ +# define X509_V_FLAG_EXPLICIT_POLICY 0x100 +/* Policy variable inhibit-any-policy */ +# define X509_V_FLAG_INHIBIT_ANY 0x200 +/* Policy variable inhibit-policy-mapping */ +# define X509_V_FLAG_INHIBIT_MAP 0x400 +/* Notify callback that policy is OK */ +# define X509_V_FLAG_NOTIFY_POLICY 0x800 +/* Extended CRL features such as indirect CRLs, alternate CRL signing keys */ +# define X509_V_FLAG_EXTENDED_CRL_SUPPORT 0x1000 +/* Delta CRL support */ +# define X509_V_FLAG_USE_DELTAS 0x2000 +/* Check self-signed CA signature */ +# define X509_V_FLAG_CHECK_SS_SIGNATURE 0x4000 +/* Use trusted store first */ +# define X509_V_FLAG_TRUSTED_FIRST 0x8000 +/* Suite B 128 bit only mode: not normally used */ +# define X509_V_FLAG_SUITEB_128_LOS_ONLY 0x10000 +/* Suite B 192 bit only mode */ +# define X509_V_FLAG_SUITEB_192_LOS 0x20000 +/* Suite B 128 bit mode allowing 192 bit algorithms */ +# define X509_V_FLAG_SUITEB_128_LOS 0x30000 +/* Allow partial chains if at least one certificate is in trusted store */ +# define X509_V_FLAG_PARTIAL_CHAIN 0x80000 +/* + * If the initial chain is not trusted, do not attempt to build an alternative + * chain. Alternate chain checking was introduced in 1.1.0. Setting this flag + * will force the behaviour to match that of previous versions. + */ +# define X509_V_FLAG_NO_ALT_CHAINS 0x100000 +/* Do not check certificate/CRL validity against current time */ +# define X509_V_FLAG_NO_CHECK_TIME 0x200000 + +# define X509_VP_FLAG_DEFAULT 0x1 +# define X509_VP_FLAG_OVERWRITE 0x2 +# define X509_VP_FLAG_RESET_FLAGS 0x4 +# define X509_VP_FLAG_LOCKED 0x8 +# define X509_VP_FLAG_ONCE 0x10 + +/* Internal use: mask of policy related options */ +# define X509_V_FLAG_POLICY_MASK (X509_V_FLAG_POLICY_CHECK \ + | X509_V_FLAG_EXPLICIT_POLICY \ + | X509_V_FLAG_INHIBIT_ANY \ + | X509_V_FLAG_INHIBIT_MAP) + +int X509_OBJECT_idx_by_subject(STACK_OF(X509_OBJECT) *h, X509_LOOKUP_TYPE type, + X509_NAME *name); +X509_OBJECT *X509_OBJECT_retrieve_by_subject(STACK_OF(X509_OBJECT) *h, + X509_LOOKUP_TYPE type, + X509_NAME *name); +X509_OBJECT *X509_OBJECT_retrieve_match(STACK_OF(X509_OBJECT) *h, + X509_OBJECT *x); +int X509_OBJECT_up_ref_count(X509_OBJECT *a); +X509_OBJECT *X509_OBJECT_new(void); +void X509_OBJECT_free(X509_OBJECT *a); +X509_LOOKUP_TYPE X509_OBJECT_get_type(const X509_OBJECT *a); +X509 *X509_OBJECT_get0_X509(const X509_OBJECT *a); +int X509_OBJECT_set1_X509(X509_OBJECT *a, X509 *obj); +X509_CRL *X509_OBJECT_get0_X509_CRL(X509_OBJECT *a); +int X509_OBJECT_set1_X509_CRL(X509_OBJECT *a, X509_CRL *obj); +X509_STORE *X509_STORE_new(void); +void X509_STORE_free(X509_STORE *v); +int X509_STORE_lock(X509_STORE *ctx); +int X509_STORE_unlock(X509_STORE *ctx); +int X509_STORE_up_ref(X509_STORE *v); +STACK_OF(X509_OBJECT) *X509_STORE_get0_objects(X509_STORE *v); + +STACK_OF(X509) *X509_STORE_CTX_get1_certs(X509_STORE_CTX *st, X509_NAME *nm); +STACK_OF(X509_CRL) *X509_STORE_CTX_get1_crls(X509_STORE_CTX *st, X509_NAME *nm); +int X509_STORE_set_flags(X509_STORE *ctx, unsigned long flags); +int X509_STORE_set_purpose(X509_STORE *ctx, int purpose); +int X509_STORE_set_trust(X509_STORE *ctx, int trust); +int X509_STORE_set1_param(X509_STORE *ctx, X509_VERIFY_PARAM *pm); +X509_VERIFY_PARAM *X509_STORE_get0_param(X509_STORE *ctx); + +void X509_STORE_set_verify(X509_STORE *ctx, X509_STORE_CTX_verify_fn verify); +#define X509_STORE_set_verify_func(ctx, func) \ + X509_STORE_set_verify((ctx),(func)) +void X509_STORE_CTX_set_verify(X509_STORE_CTX *ctx, + X509_STORE_CTX_verify_fn verify); +X509_STORE_CTX_verify_fn X509_STORE_get_verify(X509_STORE *ctx); +void X509_STORE_set_verify_cb(X509_STORE *ctx, + X509_STORE_CTX_verify_cb verify_cb); +# define X509_STORE_set_verify_cb_func(ctx,func) \ + X509_STORE_set_verify_cb((ctx),(func)) +X509_STORE_CTX_verify_cb X509_STORE_get_verify_cb(X509_STORE *ctx); +void X509_STORE_set_get_issuer(X509_STORE *ctx, + X509_STORE_CTX_get_issuer_fn get_issuer); +X509_STORE_CTX_get_issuer_fn X509_STORE_get_get_issuer(X509_STORE *ctx); +void X509_STORE_set_check_issued(X509_STORE *ctx, + X509_STORE_CTX_check_issued_fn check_issued); +X509_STORE_CTX_check_issued_fn X509_STORE_get_check_issued(X509_STORE *ctx); +void X509_STORE_set_check_revocation(X509_STORE *ctx, + X509_STORE_CTX_check_revocation_fn check_revocation); +X509_STORE_CTX_check_revocation_fn X509_STORE_get_check_revocation(X509_STORE *ctx); +void X509_STORE_set_get_crl(X509_STORE *ctx, + X509_STORE_CTX_get_crl_fn get_crl); +X509_STORE_CTX_get_crl_fn X509_STORE_get_get_crl(X509_STORE *ctx); +void X509_STORE_set_check_crl(X509_STORE *ctx, + X509_STORE_CTX_check_crl_fn check_crl); +X509_STORE_CTX_check_crl_fn X509_STORE_get_check_crl(X509_STORE *ctx); +void X509_STORE_set_cert_crl(X509_STORE *ctx, + X509_STORE_CTX_cert_crl_fn cert_crl); +X509_STORE_CTX_cert_crl_fn X509_STORE_get_cert_crl(X509_STORE *ctx); +void X509_STORE_set_check_policy(X509_STORE *ctx, + X509_STORE_CTX_check_policy_fn check_policy); +X509_STORE_CTX_check_policy_fn X509_STORE_get_check_policy(X509_STORE *ctx); +void X509_STORE_set_lookup_certs(X509_STORE *ctx, + X509_STORE_CTX_lookup_certs_fn lookup_certs); +X509_STORE_CTX_lookup_certs_fn X509_STORE_get_lookup_certs(X509_STORE *ctx); +void X509_STORE_set_lookup_crls(X509_STORE *ctx, + X509_STORE_CTX_lookup_crls_fn lookup_crls); +#define X509_STORE_set_lookup_crls_cb(ctx, func) \ + X509_STORE_set_lookup_crls((ctx), (func)) +X509_STORE_CTX_lookup_crls_fn X509_STORE_get_lookup_crls(X509_STORE *ctx); +void X509_STORE_set_cleanup(X509_STORE *ctx, + X509_STORE_CTX_cleanup_fn cleanup); +X509_STORE_CTX_cleanup_fn X509_STORE_get_cleanup(X509_STORE *ctx); + +#define X509_STORE_get_ex_new_index(l, p, newf, dupf, freef) \ + CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_X509_STORE, l, p, newf, dupf, freef) +int X509_STORE_set_ex_data(X509_STORE *ctx, int idx, void *data); +void *X509_STORE_get_ex_data(X509_STORE *ctx, int idx); + +X509_STORE_CTX *X509_STORE_CTX_new(void); + +int X509_STORE_CTX_get1_issuer(X509 **issuer, X509_STORE_CTX *ctx, X509 *x); + +void X509_STORE_CTX_free(X509_STORE_CTX *ctx); +int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, + X509 *x509, STACK_OF(X509) *chain); +void X509_STORE_CTX_set0_trusted_stack(X509_STORE_CTX *ctx, STACK_OF(X509) *sk); +void X509_STORE_CTX_cleanup(X509_STORE_CTX *ctx); + +X509_STORE *X509_STORE_CTX_get0_store(X509_STORE_CTX *ctx); +X509 *X509_STORE_CTX_get0_cert(X509_STORE_CTX *ctx); +STACK_OF(X509)* X509_STORE_CTX_get0_untrusted(X509_STORE_CTX *ctx); +void X509_STORE_CTX_set0_untrusted(X509_STORE_CTX *ctx, STACK_OF(X509) *sk); +void X509_STORE_CTX_set_verify_cb(X509_STORE_CTX *ctx, + X509_STORE_CTX_verify_cb verify); +X509_STORE_CTX_verify_cb X509_STORE_CTX_get_verify_cb(X509_STORE_CTX *ctx); +X509_STORE_CTX_verify_fn X509_STORE_CTX_get_verify(X509_STORE_CTX *ctx); +X509_STORE_CTX_get_issuer_fn X509_STORE_CTX_get_get_issuer(X509_STORE_CTX *ctx); +X509_STORE_CTX_check_issued_fn X509_STORE_CTX_get_check_issued(X509_STORE_CTX *ctx); +X509_STORE_CTX_check_revocation_fn X509_STORE_CTX_get_check_revocation(X509_STORE_CTX *ctx); +X509_STORE_CTX_get_crl_fn X509_STORE_CTX_get_get_crl(X509_STORE_CTX *ctx); +X509_STORE_CTX_check_crl_fn X509_STORE_CTX_get_check_crl(X509_STORE_CTX *ctx); +X509_STORE_CTX_cert_crl_fn X509_STORE_CTX_get_cert_crl(X509_STORE_CTX *ctx); +X509_STORE_CTX_check_policy_fn X509_STORE_CTX_get_check_policy(X509_STORE_CTX *ctx); +X509_STORE_CTX_lookup_certs_fn X509_STORE_CTX_get_lookup_certs(X509_STORE_CTX *ctx); +X509_STORE_CTX_lookup_crls_fn X509_STORE_CTX_get_lookup_crls(X509_STORE_CTX *ctx); +X509_STORE_CTX_cleanup_fn X509_STORE_CTX_get_cleanup(X509_STORE_CTX *ctx); + +#if OPENSSL_API_COMPAT < 0x10100000L +# define X509_STORE_CTX_get_chain X509_STORE_CTX_get0_chain +# define X509_STORE_CTX_set_chain X509_STORE_CTX_set0_untrusted +# define X509_STORE_CTX_trusted_stack X509_STORE_CTX_set0_trusted_stack +# define X509_STORE_get_by_subject X509_STORE_CTX_get_by_subject +# define X509_STORE_get1_certs X509_STORE_CTX_get1_certs +# define X509_STORE_get1_crls X509_STORE_CTX_get1_crls +/* the following macro is misspelled; use X509_STORE_get1_certs instead */ +# define X509_STORE_get1_cert X509_STORE_CTX_get1_certs +/* the following macro is misspelled; use X509_STORE_get1_crls instead */ +# define X509_STORE_get1_crl X509_STORE_CTX_get1_crls +#endif + +X509_LOOKUP *X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m); +X509_LOOKUP_METHOD *X509_LOOKUP_hash_dir(void); +X509_LOOKUP_METHOD *X509_LOOKUP_file(void); + +typedef int (*X509_LOOKUP_ctrl_fn)(X509_LOOKUP *ctx, int cmd, const char *argc, + long argl, char **ret); +typedef int (*X509_LOOKUP_get_by_subject_fn)(X509_LOOKUP *ctx, + X509_LOOKUP_TYPE type, + X509_NAME *name, + X509_OBJECT *ret); +typedef int (*X509_LOOKUP_get_by_issuer_serial_fn)(X509_LOOKUP *ctx, + X509_LOOKUP_TYPE type, + X509_NAME *name, + ASN1_INTEGER *serial, + X509_OBJECT *ret); +typedef int (*X509_LOOKUP_get_by_fingerprint_fn)(X509_LOOKUP *ctx, + X509_LOOKUP_TYPE type, + const unsigned char* bytes, + int len, + X509_OBJECT *ret); +typedef int (*X509_LOOKUP_get_by_alias_fn)(X509_LOOKUP *ctx, + X509_LOOKUP_TYPE type, + const char *str, + int len, + X509_OBJECT *ret); + +X509_LOOKUP_METHOD *X509_LOOKUP_meth_new(const char *name); +void X509_LOOKUP_meth_free(X509_LOOKUP_METHOD *method); + +int X509_LOOKUP_meth_set_new_item(X509_LOOKUP_METHOD *method, + int (*new_item) (X509_LOOKUP *ctx)); +int (*X509_LOOKUP_meth_get_new_item(const X509_LOOKUP_METHOD* method)) + (X509_LOOKUP *ctx); + +int X509_LOOKUP_meth_set_free(X509_LOOKUP_METHOD *method, + void (*free_fn) (X509_LOOKUP *ctx)); +void (*X509_LOOKUP_meth_get_free(const X509_LOOKUP_METHOD* method)) + (X509_LOOKUP *ctx); + +int X509_LOOKUP_meth_set_init(X509_LOOKUP_METHOD *method, + int (*init) (X509_LOOKUP *ctx)); +int (*X509_LOOKUP_meth_get_init(const X509_LOOKUP_METHOD* method)) + (X509_LOOKUP *ctx); + +int X509_LOOKUP_meth_set_shutdown(X509_LOOKUP_METHOD *method, + int (*shutdown) (X509_LOOKUP *ctx)); +int (*X509_LOOKUP_meth_get_shutdown(const X509_LOOKUP_METHOD* method)) + (X509_LOOKUP *ctx); + +int X509_LOOKUP_meth_set_ctrl(X509_LOOKUP_METHOD *method, + X509_LOOKUP_ctrl_fn ctrl_fn); +X509_LOOKUP_ctrl_fn X509_LOOKUP_meth_get_ctrl(const X509_LOOKUP_METHOD *method); + +int X509_LOOKUP_meth_set_get_by_subject(X509_LOOKUP_METHOD *method, + X509_LOOKUP_get_by_subject_fn fn); +X509_LOOKUP_get_by_subject_fn X509_LOOKUP_meth_get_get_by_subject( + const X509_LOOKUP_METHOD *method); + +int X509_LOOKUP_meth_set_get_by_issuer_serial(X509_LOOKUP_METHOD *method, + X509_LOOKUP_get_by_issuer_serial_fn fn); +X509_LOOKUP_get_by_issuer_serial_fn X509_LOOKUP_meth_get_get_by_issuer_serial( + const X509_LOOKUP_METHOD *method); + +int X509_LOOKUP_meth_set_get_by_fingerprint(X509_LOOKUP_METHOD *method, + X509_LOOKUP_get_by_fingerprint_fn fn); +X509_LOOKUP_get_by_fingerprint_fn X509_LOOKUP_meth_get_get_by_fingerprint( + const X509_LOOKUP_METHOD *method); + +int X509_LOOKUP_meth_set_get_by_alias(X509_LOOKUP_METHOD *method, + X509_LOOKUP_get_by_alias_fn fn); +X509_LOOKUP_get_by_alias_fn X509_LOOKUP_meth_get_get_by_alias( + const X509_LOOKUP_METHOD *method); + + +int X509_STORE_add_cert(X509_STORE *ctx, X509 *x); +int X509_STORE_add_crl(X509_STORE *ctx, X509_CRL *x); + +int X509_STORE_CTX_get_by_subject(X509_STORE_CTX *vs, X509_LOOKUP_TYPE type, + X509_NAME *name, X509_OBJECT *ret); +X509_OBJECT *X509_STORE_CTX_get_obj_by_subject(X509_STORE_CTX *vs, + X509_LOOKUP_TYPE type, + X509_NAME *name); + +int X509_LOOKUP_ctrl(X509_LOOKUP *ctx, int cmd, const char *argc, + long argl, char **ret); + +int X509_load_cert_file(X509_LOOKUP *ctx, const char *file, int type); +int X509_load_crl_file(X509_LOOKUP *ctx, const char *file, int type); +int X509_load_cert_crl_file(X509_LOOKUP *ctx, const char *file, int type); + +X509_LOOKUP *X509_LOOKUP_new(X509_LOOKUP_METHOD *method); +void X509_LOOKUP_free(X509_LOOKUP *ctx); +int X509_LOOKUP_init(X509_LOOKUP *ctx); +int X509_LOOKUP_by_subject(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, + X509_NAME *name, X509_OBJECT *ret); +int X509_LOOKUP_by_issuer_serial(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, + X509_NAME *name, ASN1_INTEGER *serial, + X509_OBJECT *ret); +int X509_LOOKUP_by_fingerprint(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, + const unsigned char *bytes, int len, + X509_OBJECT *ret); +int X509_LOOKUP_by_alias(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, + const char *str, int len, X509_OBJECT *ret); +int X509_LOOKUP_set_method_data(X509_LOOKUP *ctx, void *data); +void *X509_LOOKUP_get_method_data(const X509_LOOKUP *ctx); +X509_STORE *X509_LOOKUP_get_store(const X509_LOOKUP *ctx); +int X509_LOOKUP_shutdown(X509_LOOKUP *ctx); + +int X509_STORE_load_locations(X509_STORE *ctx, + const char *file, const char *dir); +int X509_STORE_set_default_paths(X509_STORE *ctx); + +#define X509_STORE_CTX_get_ex_new_index(l, p, newf, dupf, freef) \ + CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_X509_STORE_CTX, l, p, newf, dupf, freef) +int X509_STORE_CTX_set_ex_data(X509_STORE_CTX *ctx, int idx, void *data); +void *X509_STORE_CTX_get_ex_data(X509_STORE_CTX *ctx, int idx); +int X509_STORE_CTX_get_error(X509_STORE_CTX *ctx); +void X509_STORE_CTX_set_error(X509_STORE_CTX *ctx, int s); +int X509_STORE_CTX_get_error_depth(X509_STORE_CTX *ctx); +void X509_STORE_CTX_set_error_depth(X509_STORE_CTX *ctx, int depth); +X509 *X509_STORE_CTX_get_current_cert(X509_STORE_CTX *ctx); +void X509_STORE_CTX_set_current_cert(X509_STORE_CTX *ctx, X509 *x); +X509 *X509_STORE_CTX_get0_current_issuer(X509_STORE_CTX *ctx); +X509_CRL *X509_STORE_CTX_get0_current_crl(X509_STORE_CTX *ctx); +X509_STORE_CTX *X509_STORE_CTX_get0_parent_ctx(X509_STORE_CTX *ctx); +STACK_OF(X509) *X509_STORE_CTX_get0_chain(X509_STORE_CTX *ctx); +STACK_OF(X509) *X509_STORE_CTX_get1_chain(X509_STORE_CTX *ctx); +void X509_STORE_CTX_set_cert(X509_STORE_CTX *c, X509 *x); +void X509_STORE_CTX_set0_verified_chain(X509_STORE_CTX *c, STACK_OF(X509) *sk); +void X509_STORE_CTX_set0_crls(X509_STORE_CTX *c, STACK_OF(X509_CRL) *sk); +int X509_STORE_CTX_set_purpose(X509_STORE_CTX *ctx, int purpose); +int X509_STORE_CTX_set_trust(X509_STORE_CTX *ctx, int trust); +int X509_STORE_CTX_purpose_inherit(X509_STORE_CTX *ctx, int def_purpose, + int purpose, int trust); +void X509_STORE_CTX_set_flags(X509_STORE_CTX *ctx, unsigned long flags); +void X509_STORE_CTX_set_time(X509_STORE_CTX *ctx, unsigned long flags, + time_t t); + +X509_POLICY_TREE *X509_STORE_CTX_get0_policy_tree(X509_STORE_CTX *ctx); +int X509_STORE_CTX_get_explicit_policy(X509_STORE_CTX *ctx); +int X509_STORE_CTX_get_num_untrusted(X509_STORE_CTX *ctx); + +X509_VERIFY_PARAM *X509_STORE_CTX_get0_param(X509_STORE_CTX *ctx); +void X509_STORE_CTX_set0_param(X509_STORE_CTX *ctx, X509_VERIFY_PARAM *param); +int X509_STORE_CTX_set_default(X509_STORE_CTX *ctx, const char *name); + +/* + * Bridge opacity barrier between libcrypt and libssl, also needed to support + * offline testing in test/danetest.c + */ +void X509_STORE_CTX_set0_dane(X509_STORE_CTX *ctx, SSL_DANE *dane); +#define DANE_FLAG_NO_DANE_EE_NAMECHECKS (1L << 0) + +/* X509_VERIFY_PARAM functions */ + +X509_VERIFY_PARAM *X509_VERIFY_PARAM_new(void); +void X509_VERIFY_PARAM_free(X509_VERIFY_PARAM *param); +int X509_VERIFY_PARAM_inherit(X509_VERIFY_PARAM *to, + const X509_VERIFY_PARAM *from); +int X509_VERIFY_PARAM_set1(X509_VERIFY_PARAM *to, + const X509_VERIFY_PARAM *from); +int X509_VERIFY_PARAM_set1_name(X509_VERIFY_PARAM *param, const char *name); +int X509_VERIFY_PARAM_set_flags(X509_VERIFY_PARAM *param, + unsigned long flags); +int X509_VERIFY_PARAM_clear_flags(X509_VERIFY_PARAM *param, + unsigned long flags); +unsigned long X509_VERIFY_PARAM_get_flags(X509_VERIFY_PARAM *param); +int X509_VERIFY_PARAM_set_purpose(X509_VERIFY_PARAM *param, int purpose); +int X509_VERIFY_PARAM_set_trust(X509_VERIFY_PARAM *param, int trust); +void X509_VERIFY_PARAM_set_depth(X509_VERIFY_PARAM *param, int depth); +void X509_VERIFY_PARAM_set_auth_level(X509_VERIFY_PARAM *param, int auth_level); +time_t X509_VERIFY_PARAM_get_time(const X509_VERIFY_PARAM *param); +void X509_VERIFY_PARAM_set_time(X509_VERIFY_PARAM *param, time_t t); +int X509_VERIFY_PARAM_add0_policy(X509_VERIFY_PARAM *param, + ASN1_OBJECT *policy); +int X509_VERIFY_PARAM_set1_policies(X509_VERIFY_PARAM *param, + STACK_OF(ASN1_OBJECT) *policies); + +int X509_VERIFY_PARAM_set_inh_flags(X509_VERIFY_PARAM *param, + uint32_t flags); +uint32_t X509_VERIFY_PARAM_get_inh_flags(const X509_VERIFY_PARAM *param); + +int X509_VERIFY_PARAM_set1_host(X509_VERIFY_PARAM *param, + const char *name, size_t namelen); +int X509_VERIFY_PARAM_add1_host(X509_VERIFY_PARAM *param, + const char *name, size_t namelen); +void X509_VERIFY_PARAM_set_hostflags(X509_VERIFY_PARAM *param, + unsigned int flags); +unsigned int X509_VERIFY_PARAM_get_hostflags(const X509_VERIFY_PARAM *param); +char *X509_VERIFY_PARAM_get0_peername(X509_VERIFY_PARAM *); +void X509_VERIFY_PARAM_move_peername(X509_VERIFY_PARAM *, X509_VERIFY_PARAM *); +int X509_VERIFY_PARAM_set1_email(X509_VERIFY_PARAM *param, + const char *email, size_t emaillen); +int X509_VERIFY_PARAM_set1_ip(X509_VERIFY_PARAM *param, + const unsigned char *ip, size_t iplen); +int X509_VERIFY_PARAM_set1_ip_asc(X509_VERIFY_PARAM *param, + const char *ipasc); + +int X509_VERIFY_PARAM_get_depth(const X509_VERIFY_PARAM *param); +int X509_VERIFY_PARAM_get_auth_level(const X509_VERIFY_PARAM *param); +const char *X509_VERIFY_PARAM_get0_name(const X509_VERIFY_PARAM *param); + +int X509_VERIFY_PARAM_add0_table(X509_VERIFY_PARAM *param); +int X509_VERIFY_PARAM_get_count(void); +const X509_VERIFY_PARAM *X509_VERIFY_PARAM_get0(int id); +const X509_VERIFY_PARAM *X509_VERIFY_PARAM_lookup(const char *name); +void X509_VERIFY_PARAM_table_cleanup(void); + +/* Non positive return values are errors */ +#define X509_PCY_TREE_FAILURE -2 /* Failure to satisfy explicit policy */ +#define X509_PCY_TREE_INVALID -1 /* Inconsistent or invalid extensions */ +#define X509_PCY_TREE_INTERNAL 0 /* Internal error, most likely malloc */ + +/* + * Positive return values form a bit mask, all but the first are internal to + * the library and don't appear in results from X509_policy_check(). + */ +#define X509_PCY_TREE_VALID 1 /* The policy tree is valid */ +#define X509_PCY_TREE_EMPTY 2 /* The policy tree is empty */ +#define X509_PCY_TREE_EXPLICIT 4 /* Explicit policy required */ + +int X509_policy_check(X509_POLICY_TREE **ptree, int *pexplicit_policy, + STACK_OF(X509) *certs, + STACK_OF(ASN1_OBJECT) *policy_oids, unsigned int flags); + +void X509_policy_tree_free(X509_POLICY_TREE *tree); + +int X509_policy_tree_level_count(const X509_POLICY_TREE *tree); +X509_POLICY_LEVEL *X509_policy_tree_get0_level(const X509_POLICY_TREE *tree, + int i); + +STACK_OF(X509_POLICY_NODE) *X509_policy_tree_get0_policies(const + X509_POLICY_TREE + *tree); + +STACK_OF(X509_POLICY_NODE) *X509_policy_tree_get0_user_policies(const + X509_POLICY_TREE + *tree); + +int X509_policy_level_node_count(X509_POLICY_LEVEL *level); + +X509_POLICY_NODE *X509_policy_level_get0_node(X509_POLICY_LEVEL *level, + int i); + +const ASN1_OBJECT *X509_policy_node_get0_policy(const X509_POLICY_NODE *node); + +STACK_OF(POLICYQUALINFO) *X509_policy_node_get0_qualifiers(const + X509_POLICY_NODE + *node); +const X509_POLICY_NODE *X509_policy_node_get0_parent(const X509_POLICY_NODE + *node); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/x509err.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/x509err.h new file mode 100644 index 0000000..0273853 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/x509err.h @@ -0,0 +1,130 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_X509ERR_H +# define HEADER_X509ERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_X509_strings(void); + +/* + * X509 function codes. + */ +# define X509_F_ADD_CERT_DIR 100 +# define X509_F_BUILD_CHAIN 106 +# define X509_F_BY_FILE_CTRL 101 +# define X509_F_CHECK_NAME_CONSTRAINTS 149 +# define X509_F_CHECK_POLICY 145 +# define X509_F_DANE_I2D 107 +# define X509_F_DIR_CTRL 102 +# define X509_F_GET_CERT_BY_SUBJECT 103 +# define X509_F_I2D_X509_AUX 151 +# define X509_F_LOOKUP_CERTS_SK 152 +# define X509_F_NETSCAPE_SPKI_B64_DECODE 129 +# define X509_F_NETSCAPE_SPKI_B64_ENCODE 130 +# define X509_F_NEW_DIR 153 +# define X509_F_X509AT_ADD1_ATTR 135 +# define X509_F_X509V3_ADD_EXT 104 +# define X509_F_X509_ATTRIBUTE_CREATE_BY_NID 136 +# define X509_F_X509_ATTRIBUTE_CREATE_BY_OBJ 137 +# define X509_F_X509_ATTRIBUTE_CREATE_BY_TXT 140 +# define X509_F_X509_ATTRIBUTE_GET0_DATA 139 +# define X509_F_X509_ATTRIBUTE_SET1_DATA 138 +# define X509_F_X509_CHECK_PRIVATE_KEY 128 +# define X509_F_X509_CRL_DIFF 105 +# define X509_F_X509_CRL_METHOD_NEW 154 +# define X509_F_X509_CRL_PRINT_FP 147 +# define X509_F_X509_EXTENSION_CREATE_BY_NID 108 +# define X509_F_X509_EXTENSION_CREATE_BY_OBJ 109 +# define X509_F_X509_GET_PUBKEY_PARAMETERS 110 +# define X509_F_X509_LOAD_CERT_CRL_FILE 132 +# define X509_F_X509_LOAD_CERT_FILE 111 +# define X509_F_X509_LOAD_CRL_FILE 112 +# define X509_F_X509_LOOKUP_METH_NEW 160 +# define X509_F_X509_LOOKUP_NEW 155 +# define X509_F_X509_NAME_ADD_ENTRY 113 +# define X509_F_X509_NAME_CANON 156 +# define X509_F_X509_NAME_ENTRY_CREATE_BY_NID 114 +# define X509_F_X509_NAME_ENTRY_CREATE_BY_TXT 131 +# define X509_F_X509_NAME_ENTRY_SET_OBJECT 115 +# define X509_F_X509_NAME_ONELINE 116 +# define X509_F_X509_NAME_PRINT 117 +# define X509_F_X509_OBJECT_NEW 150 +# define X509_F_X509_PRINT_EX_FP 118 +# define X509_F_X509_PUBKEY_DECODE 148 +# define X509_F_X509_PUBKEY_GET0 119 +# define X509_F_X509_PUBKEY_SET 120 +# define X509_F_X509_REQ_CHECK_PRIVATE_KEY 144 +# define X509_F_X509_REQ_PRINT_EX 121 +# define X509_F_X509_REQ_PRINT_FP 122 +# define X509_F_X509_REQ_TO_X509 123 +# define X509_F_X509_STORE_ADD_CERT 124 +# define X509_F_X509_STORE_ADD_CRL 125 +# define X509_F_X509_STORE_ADD_LOOKUP 157 +# define X509_F_X509_STORE_CTX_GET1_ISSUER 146 +# define X509_F_X509_STORE_CTX_INIT 143 +# define X509_F_X509_STORE_CTX_NEW 142 +# define X509_F_X509_STORE_CTX_PURPOSE_INHERIT 134 +# define X509_F_X509_STORE_NEW 158 +# define X509_F_X509_TO_X509_REQ 126 +# define X509_F_X509_TRUST_ADD 133 +# define X509_F_X509_TRUST_SET 141 +# define X509_F_X509_VERIFY_CERT 127 +# define X509_F_X509_VERIFY_PARAM_NEW 159 + +/* + * X509 reason codes. + */ +# define X509_R_AKID_MISMATCH 110 +# define X509_R_BAD_SELECTOR 133 +# define X509_R_BAD_X509_FILETYPE 100 +# define X509_R_BASE64_DECODE_ERROR 118 +# define X509_R_CANT_CHECK_DH_KEY 114 +# define X509_R_CERT_ALREADY_IN_HASH_TABLE 101 +# define X509_R_CRL_ALREADY_DELTA 127 +# define X509_R_CRL_VERIFY_FAILURE 131 +# define X509_R_IDP_MISMATCH 128 +# define X509_R_INVALID_ATTRIBUTES 138 +# define X509_R_INVALID_DIRECTORY 113 +# define X509_R_INVALID_FIELD_NAME 119 +# define X509_R_INVALID_TRUST 123 +# define X509_R_ISSUER_MISMATCH 129 +# define X509_R_KEY_TYPE_MISMATCH 115 +# define X509_R_KEY_VALUES_MISMATCH 116 +# define X509_R_LOADING_CERT_DIR 103 +# define X509_R_LOADING_DEFAULTS 104 +# define X509_R_METHOD_NOT_SUPPORTED 124 +# define X509_R_NAME_TOO_LONG 134 +# define X509_R_NEWER_CRL_NOT_NEWER 132 +# define X509_R_NO_CERTIFICATE_FOUND 135 +# define X509_R_NO_CERTIFICATE_OR_CRL_FOUND 136 +# define X509_R_NO_CERT_SET_FOR_US_TO_VERIFY 105 +# define X509_R_NO_CRL_FOUND 137 +# define X509_R_NO_CRL_NUMBER 130 +# define X509_R_PUBLIC_KEY_DECODE_ERROR 125 +# define X509_R_PUBLIC_KEY_ENCODE_ERROR 126 +# define X509_R_SHOULD_RETRY 106 +# define X509_R_UNABLE_TO_FIND_PARAMETERS_IN_CHAIN 107 +# define X509_R_UNABLE_TO_GET_CERTS_PUBLIC_KEY 108 +# define X509_R_UNKNOWN_KEY_TYPE 117 +# define X509_R_UNKNOWN_NID 109 +# define X509_R_UNKNOWN_PURPOSE_ID 121 +# define X509_R_UNKNOWN_TRUST_ID 120 +# define X509_R_UNSUPPORTED_ALGORITHM 111 +# define X509_R_WRONG_LOOKUP_TYPE 112 +# define X509_R_WRONG_TYPE 122 + +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/x509v3.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/x509v3.h new file mode 100644 index 0000000..6c6eca3 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/x509v3.h @@ -0,0 +1,937 @@ +/* + * Copyright 1999-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_X509V3_H +# define HEADER_X509V3_H + +# include +# include +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward reference */ +struct v3_ext_method; +struct v3_ext_ctx; + +/* Useful typedefs */ + +typedef void *(*X509V3_EXT_NEW)(void); +typedef void (*X509V3_EXT_FREE) (void *); +typedef void *(*X509V3_EXT_D2I)(void *, const unsigned char **, long); +typedef int (*X509V3_EXT_I2D) (void *, unsigned char **); +typedef STACK_OF(CONF_VALUE) * + (*X509V3_EXT_I2V) (const struct v3_ext_method *method, void *ext, + STACK_OF(CONF_VALUE) *extlist); +typedef void *(*X509V3_EXT_V2I)(const struct v3_ext_method *method, + struct v3_ext_ctx *ctx, + STACK_OF(CONF_VALUE) *values); +typedef char *(*X509V3_EXT_I2S)(const struct v3_ext_method *method, + void *ext); +typedef void *(*X509V3_EXT_S2I)(const struct v3_ext_method *method, + struct v3_ext_ctx *ctx, const char *str); +typedef int (*X509V3_EXT_I2R) (const struct v3_ext_method *method, void *ext, + BIO *out, int indent); +typedef void *(*X509V3_EXT_R2I)(const struct v3_ext_method *method, + struct v3_ext_ctx *ctx, const char *str); + +/* V3 extension structure */ + +struct v3_ext_method { + int ext_nid; + int ext_flags; +/* If this is set the following four fields are ignored */ + ASN1_ITEM_EXP *it; +/* Old style ASN1 calls */ + X509V3_EXT_NEW ext_new; + X509V3_EXT_FREE ext_free; + X509V3_EXT_D2I d2i; + X509V3_EXT_I2D i2d; +/* The following pair is used for string extensions */ + X509V3_EXT_I2S i2s; + X509V3_EXT_S2I s2i; +/* The following pair is used for multi-valued extensions */ + X509V3_EXT_I2V i2v; + X509V3_EXT_V2I v2i; +/* The following are used for raw extensions */ + X509V3_EXT_I2R i2r; + X509V3_EXT_R2I r2i; + void *usr_data; /* Any extension specific data */ +}; + +typedef struct X509V3_CONF_METHOD_st { + char *(*get_string) (void *db, const char *section, const char *value); + STACK_OF(CONF_VALUE) *(*get_section) (void *db, const char *section); + void (*free_string) (void *db, char *string); + void (*free_section) (void *db, STACK_OF(CONF_VALUE) *section); +} X509V3_CONF_METHOD; + +/* Context specific info */ +struct v3_ext_ctx { +# define CTX_TEST 0x1 +# define X509V3_CTX_REPLACE 0x2 + int flags; + X509 *issuer_cert; + X509 *subject_cert; + X509_REQ *subject_req; + X509_CRL *crl; + X509V3_CONF_METHOD *db_meth; + void *db; +/* Maybe more here */ +}; + +typedef struct v3_ext_method X509V3_EXT_METHOD; + +DEFINE_STACK_OF(X509V3_EXT_METHOD) + +/* ext_flags values */ +# define X509V3_EXT_DYNAMIC 0x1 +# define X509V3_EXT_CTX_DEP 0x2 +# define X509V3_EXT_MULTILINE 0x4 + +typedef BIT_STRING_BITNAME ENUMERATED_NAMES; + +typedef struct BASIC_CONSTRAINTS_st { + int ca; + ASN1_INTEGER *pathlen; +} BASIC_CONSTRAINTS; + +typedef struct PKEY_USAGE_PERIOD_st { + ASN1_GENERALIZEDTIME *notBefore; + ASN1_GENERALIZEDTIME *notAfter; +} PKEY_USAGE_PERIOD; + +typedef struct otherName_st { + ASN1_OBJECT *type_id; + ASN1_TYPE *value; +} OTHERNAME; + +typedef struct EDIPartyName_st { + ASN1_STRING *nameAssigner; + ASN1_STRING *partyName; +} EDIPARTYNAME; + +typedef struct GENERAL_NAME_st { +# define GEN_OTHERNAME 0 +# define GEN_EMAIL 1 +# define GEN_DNS 2 +# define GEN_X400 3 +# define GEN_DIRNAME 4 +# define GEN_EDIPARTY 5 +# define GEN_URI 6 +# define GEN_IPADD 7 +# define GEN_RID 8 + int type; + union { + char *ptr; + OTHERNAME *otherName; /* otherName */ + ASN1_IA5STRING *rfc822Name; + ASN1_IA5STRING *dNSName; + ASN1_TYPE *x400Address; + X509_NAME *directoryName; + EDIPARTYNAME *ediPartyName; + ASN1_IA5STRING *uniformResourceIdentifier; + ASN1_OCTET_STRING *iPAddress; + ASN1_OBJECT *registeredID; + /* Old names */ + ASN1_OCTET_STRING *ip; /* iPAddress */ + X509_NAME *dirn; /* dirn */ + ASN1_IA5STRING *ia5; /* rfc822Name, dNSName, + * uniformResourceIdentifier */ + ASN1_OBJECT *rid; /* registeredID */ + ASN1_TYPE *other; /* x400Address */ + } d; +} GENERAL_NAME; + +typedef struct ACCESS_DESCRIPTION_st { + ASN1_OBJECT *method; + GENERAL_NAME *location; +} ACCESS_DESCRIPTION; + +typedef STACK_OF(ACCESS_DESCRIPTION) AUTHORITY_INFO_ACCESS; + +typedef STACK_OF(ASN1_OBJECT) EXTENDED_KEY_USAGE; + +typedef STACK_OF(ASN1_INTEGER) TLS_FEATURE; + +DEFINE_STACK_OF(GENERAL_NAME) +typedef STACK_OF(GENERAL_NAME) GENERAL_NAMES; +DEFINE_STACK_OF(GENERAL_NAMES) + +DEFINE_STACK_OF(ACCESS_DESCRIPTION) + +typedef struct DIST_POINT_NAME_st { + int type; + union { + GENERAL_NAMES *fullname; + STACK_OF(X509_NAME_ENTRY) *relativename; + } name; +/* If relativename then this contains the full distribution point name */ + X509_NAME *dpname; +} DIST_POINT_NAME; +/* All existing reasons */ +# define CRLDP_ALL_REASONS 0x807f + +# define CRL_REASON_NONE -1 +# define CRL_REASON_UNSPECIFIED 0 +# define CRL_REASON_KEY_COMPROMISE 1 +# define CRL_REASON_CA_COMPROMISE 2 +# define CRL_REASON_AFFILIATION_CHANGED 3 +# define CRL_REASON_SUPERSEDED 4 +# define CRL_REASON_CESSATION_OF_OPERATION 5 +# define CRL_REASON_CERTIFICATE_HOLD 6 +# define CRL_REASON_REMOVE_FROM_CRL 8 +# define CRL_REASON_PRIVILEGE_WITHDRAWN 9 +# define CRL_REASON_AA_COMPROMISE 10 + +struct DIST_POINT_st { + DIST_POINT_NAME *distpoint; + ASN1_BIT_STRING *reasons; + GENERAL_NAMES *CRLissuer; + int dp_reasons; +}; + +typedef STACK_OF(DIST_POINT) CRL_DIST_POINTS; + +DEFINE_STACK_OF(DIST_POINT) + +struct AUTHORITY_KEYID_st { + ASN1_OCTET_STRING *keyid; + GENERAL_NAMES *issuer; + ASN1_INTEGER *serial; +}; + +/* Strong extranet structures */ + +typedef struct SXNET_ID_st { + ASN1_INTEGER *zone; + ASN1_OCTET_STRING *user; +} SXNETID; + +DEFINE_STACK_OF(SXNETID) + +typedef struct SXNET_st { + ASN1_INTEGER *version; + STACK_OF(SXNETID) *ids; +} SXNET; + +typedef struct NOTICEREF_st { + ASN1_STRING *organization; + STACK_OF(ASN1_INTEGER) *noticenos; +} NOTICEREF; + +typedef struct USERNOTICE_st { + NOTICEREF *noticeref; + ASN1_STRING *exptext; +} USERNOTICE; + +typedef struct POLICYQUALINFO_st { + ASN1_OBJECT *pqualid; + union { + ASN1_IA5STRING *cpsuri; + USERNOTICE *usernotice; + ASN1_TYPE *other; + } d; +} POLICYQUALINFO; + +DEFINE_STACK_OF(POLICYQUALINFO) + +typedef struct POLICYINFO_st { + ASN1_OBJECT *policyid; + STACK_OF(POLICYQUALINFO) *qualifiers; +} POLICYINFO; + +typedef STACK_OF(POLICYINFO) CERTIFICATEPOLICIES; + +DEFINE_STACK_OF(POLICYINFO) + +typedef struct POLICY_MAPPING_st { + ASN1_OBJECT *issuerDomainPolicy; + ASN1_OBJECT *subjectDomainPolicy; +} POLICY_MAPPING; + +DEFINE_STACK_OF(POLICY_MAPPING) + +typedef STACK_OF(POLICY_MAPPING) POLICY_MAPPINGS; + +typedef struct GENERAL_SUBTREE_st { + GENERAL_NAME *base; + ASN1_INTEGER *minimum; + ASN1_INTEGER *maximum; +} GENERAL_SUBTREE; + +DEFINE_STACK_OF(GENERAL_SUBTREE) + +struct NAME_CONSTRAINTS_st { + STACK_OF(GENERAL_SUBTREE) *permittedSubtrees; + STACK_OF(GENERAL_SUBTREE) *excludedSubtrees; +}; + +typedef struct POLICY_CONSTRAINTS_st { + ASN1_INTEGER *requireExplicitPolicy; + ASN1_INTEGER *inhibitPolicyMapping; +} POLICY_CONSTRAINTS; + +/* Proxy certificate structures, see RFC 3820 */ +typedef struct PROXY_POLICY_st { + ASN1_OBJECT *policyLanguage; + ASN1_OCTET_STRING *policy; +} PROXY_POLICY; + +typedef struct PROXY_CERT_INFO_EXTENSION_st { + ASN1_INTEGER *pcPathLengthConstraint; + PROXY_POLICY *proxyPolicy; +} PROXY_CERT_INFO_EXTENSION; + +DECLARE_ASN1_FUNCTIONS(PROXY_POLICY) +DECLARE_ASN1_FUNCTIONS(PROXY_CERT_INFO_EXTENSION) + +struct ISSUING_DIST_POINT_st { + DIST_POINT_NAME *distpoint; + int onlyuser; + int onlyCA; + ASN1_BIT_STRING *onlysomereasons; + int indirectCRL; + int onlyattr; +}; + +/* Values in idp_flags field */ +/* IDP present */ +# define IDP_PRESENT 0x1 +/* IDP values inconsistent */ +# define IDP_INVALID 0x2 +/* onlyuser true */ +# define IDP_ONLYUSER 0x4 +/* onlyCA true */ +# define IDP_ONLYCA 0x8 +/* onlyattr true */ +# define IDP_ONLYATTR 0x10 +/* indirectCRL true */ +# define IDP_INDIRECT 0x20 +/* onlysomereasons present */ +# define IDP_REASONS 0x40 + +# define X509V3_conf_err(val) ERR_add_error_data(6, \ + "section:", (val)->section, \ + ",name:", (val)->name, ",value:", (val)->value) + +# define X509V3_set_ctx_test(ctx) \ + X509V3_set_ctx(ctx, NULL, NULL, NULL, NULL, CTX_TEST) +# define X509V3_set_ctx_nodb(ctx) (ctx)->db = NULL; + +# define EXT_BITSTRING(nid, table) { nid, 0, ASN1_ITEM_ref(ASN1_BIT_STRING), \ + 0,0,0,0, \ + 0,0, \ + (X509V3_EXT_I2V)i2v_ASN1_BIT_STRING, \ + (X509V3_EXT_V2I)v2i_ASN1_BIT_STRING, \ + NULL, NULL, \ + table} + +# define EXT_IA5STRING(nid) { nid, 0, ASN1_ITEM_ref(ASN1_IA5STRING), \ + 0,0,0,0, \ + (X509V3_EXT_I2S)i2s_ASN1_IA5STRING, \ + (X509V3_EXT_S2I)s2i_ASN1_IA5STRING, \ + 0,0,0,0, \ + NULL} + +# define EXT_END { -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} + +/* X509_PURPOSE stuff */ + +# define EXFLAG_BCONS 0x1 +# define EXFLAG_KUSAGE 0x2 +# define EXFLAG_XKUSAGE 0x4 +# define EXFLAG_NSCERT 0x8 + +# define EXFLAG_CA 0x10 +/* Really self issued not necessarily self signed */ +# define EXFLAG_SI 0x20 +# define EXFLAG_V1 0x40 +# define EXFLAG_INVALID 0x80 +/* EXFLAG_SET is set to indicate that some values have been precomputed */ +# define EXFLAG_SET 0x100 +# define EXFLAG_CRITICAL 0x200 +# define EXFLAG_PROXY 0x400 + +# define EXFLAG_INVALID_POLICY 0x800 +# define EXFLAG_FRESHEST 0x1000 +/* Self signed */ +# define EXFLAG_SS 0x2000 + +# define KU_DIGITAL_SIGNATURE 0x0080 +# define KU_NON_REPUDIATION 0x0040 +# define KU_KEY_ENCIPHERMENT 0x0020 +# define KU_DATA_ENCIPHERMENT 0x0010 +# define KU_KEY_AGREEMENT 0x0008 +# define KU_KEY_CERT_SIGN 0x0004 +# define KU_CRL_SIGN 0x0002 +# define KU_ENCIPHER_ONLY 0x0001 +# define KU_DECIPHER_ONLY 0x8000 + +# define NS_SSL_CLIENT 0x80 +# define NS_SSL_SERVER 0x40 +# define NS_SMIME 0x20 +# define NS_OBJSIGN 0x10 +# define NS_SSL_CA 0x04 +# define NS_SMIME_CA 0x02 +# define NS_OBJSIGN_CA 0x01 +# define NS_ANY_CA (NS_SSL_CA|NS_SMIME_CA|NS_OBJSIGN_CA) + +# define XKU_SSL_SERVER 0x1 +# define XKU_SSL_CLIENT 0x2 +# define XKU_SMIME 0x4 +# define XKU_CODE_SIGN 0x8 +# define XKU_SGC 0x10 +# define XKU_OCSP_SIGN 0x20 +# define XKU_TIMESTAMP 0x40 +# define XKU_DVCS 0x80 +# define XKU_ANYEKU 0x100 + +# define X509_PURPOSE_DYNAMIC 0x1 +# define X509_PURPOSE_DYNAMIC_NAME 0x2 + +typedef struct x509_purpose_st { + int purpose; + int trust; /* Default trust ID */ + int flags; + int (*check_purpose) (const struct x509_purpose_st *, const X509 *, int); + char *name; + char *sname; + void *usr_data; +} X509_PURPOSE; + +# define X509_PURPOSE_SSL_CLIENT 1 +# define X509_PURPOSE_SSL_SERVER 2 +# define X509_PURPOSE_NS_SSL_SERVER 3 +# define X509_PURPOSE_SMIME_SIGN 4 +# define X509_PURPOSE_SMIME_ENCRYPT 5 +# define X509_PURPOSE_CRL_SIGN 6 +# define X509_PURPOSE_ANY 7 +# define X509_PURPOSE_OCSP_HELPER 8 +# define X509_PURPOSE_TIMESTAMP_SIGN 9 + +# define X509_PURPOSE_MIN 1 +# define X509_PURPOSE_MAX 9 + +/* Flags for X509V3_EXT_print() */ + +# define X509V3_EXT_UNKNOWN_MASK (0xfL << 16) +/* Return error for unknown extensions */ +# define X509V3_EXT_DEFAULT 0 +/* Print error for unknown extensions */ +# define X509V3_EXT_ERROR_UNKNOWN (1L << 16) +/* ASN1 parse unknown extensions */ +# define X509V3_EXT_PARSE_UNKNOWN (2L << 16) +/* BIO_dump unknown extensions */ +# define X509V3_EXT_DUMP_UNKNOWN (3L << 16) + +/* Flags for X509V3_add1_i2d */ + +# define X509V3_ADD_OP_MASK 0xfL +# define X509V3_ADD_DEFAULT 0L +# define X509V3_ADD_APPEND 1L +# define X509V3_ADD_REPLACE 2L +# define X509V3_ADD_REPLACE_EXISTING 3L +# define X509V3_ADD_KEEP_EXISTING 4L +# define X509V3_ADD_DELETE 5L +# define X509V3_ADD_SILENT 0x10 + +DEFINE_STACK_OF(X509_PURPOSE) + +DECLARE_ASN1_FUNCTIONS(BASIC_CONSTRAINTS) + +DECLARE_ASN1_FUNCTIONS(SXNET) +DECLARE_ASN1_FUNCTIONS(SXNETID) + +int SXNET_add_id_asc(SXNET **psx, const char *zone, const char *user, int userlen); +int SXNET_add_id_ulong(SXNET **psx, unsigned long lzone, const char *user, + int userlen); +int SXNET_add_id_INTEGER(SXNET **psx, ASN1_INTEGER *izone, const char *user, + int userlen); + +ASN1_OCTET_STRING *SXNET_get_id_asc(SXNET *sx, const char *zone); +ASN1_OCTET_STRING *SXNET_get_id_ulong(SXNET *sx, unsigned long lzone); +ASN1_OCTET_STRING *SXNET_get_id_INTEGER(SXNET *sx, ASN1_INTEGER *zone); + +DECLARE_ASN1_FUNCTIONS(AUTHORITY_KEYID) + +DECLARE_ASN1_FUNCTIONS(PKEY_USAGE_PERIOD) + +DECLARE_ASN1_FUNCTIONS(GENERAL_NAME) +GENERAL_NAME *GENERAL_NAME_dup(GENERAL_NAME *a); +int GENERAL_NAME_cmp(GENERAL_NAME *a, GENERAL_NAME *b); + +ASN1_BIT_STRING *v2i_ASN1_BIT_STRING(X509V3_EXT_METHOD *method, + X509V3_CTX *ctx, + STACK_OF(CONF_VALUE) *nval); +STACK_OF(CONF_VALUE) *i2v_ASN1_BIT_STRING(X509V3_EXT_METHOD *method, + ASN1_BIT_STRING *bits, + STACK_OF(CONF_VALUE) *extlist); +char *i2s_ASN1_IA5STRING(X509V3_EXT_METHOD *method, ASN1_IA5STRING *ia5); +ASN1_IA5STRING *s2i_ASN1_IA5STRING(X509V3_EXT_METHOD *method, + X509V3_CTX *ctx, const char *str); + +STACK_OF(CONF_VALUE) *i2v_GENERAL_NAME(X509V3_EXT_METHOD *method, + GENERAL_NAME *gen, + STACK_OF(CONF_VALUE) *ret); +int GENERAL_NAME_print(BIO *out, GENERAL_NAME *gen); + +DECLARE_ASN1_FUNCTIONS(GENERAL_NAMES) + +STACK_OF(CONF_VALUE) *i2v_GENERAL_NAMES(X509V3_EXT_METHOD *method, + GENERAL_NAMES *gen, + STACK_OF(CONF_VALUE) *extlist); +GENERAL_NAMES *v2i_GENERAL_NAMES(const X509V3_EXT_METHOD *method, + X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval); + +DECLARE_ASN1_FUNCTIONS(OTHERNAME) +DECLARE_ASN1_FUNCTIONS(EDIPARTYNAME) +int OTHERNAME_cmp(OTHERNAME *a, OTHERNAME *b); +void GENERAL_NAME_set0_value(GENERAL_NAME *a, int type, void *value); +void *GENERAL_NAME_get0_value(const GENERAL_NAME *a, int *ptype); +int GENERAL_NAME_set0_othername(GENERAL_NAME *gen, + ASN1_OBJECT *oid, ASN1_TYPE *value); +int GENERAL_NAME_get0_otherName(const GENERAL_NAME *gen, + ASN1_OBJECT **poid, ASN1_TYPE **pvalue); + +char *i2s_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, + const ASN1_OCTET_STRING *ia5); +ASN1_OCTET_STRING *s2i_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, + X509V3_CTX *ctx, const char *str); + +DECLARE_ASN1_FUNCTIONS(EXTENDED_KEY_USAGE) +int i2a_ACCESS_DESCRIPTION(BIO *bp, const ACCESS_DESCRIPTION *a); + +DECLARE_ASN1_ALLOC_FUNCTIONS(TLS_FEATURE) + +DECLARE_ASN1_FUNCTIONS(CERTIFICATEPOLICIES) +DECLARE_ASN1_FUNCTIONS(POLICYINFO) +DECLARE_ASN1_FUNCTIONS(POLICYQUALINFO) +DECLARE_ASN1_FUNCTIONS(USERNOTICE) +DECLARE_ASN1_FUNCTIONS(NOTICEREF) + +DECLARE_ASN1_FUNCTIONS(CRL_DIST_POINTS) +DECLARE_ASN1_FUNCTIONS(DIST_POINT) +DECLARE_ASN1_FUNCTIONS(DIST_POINT_NAME) +DECLARE_ASN1_FUNCTIONS(ISSUING_DIST_POINT) + +int DIST_POINT_set_dpname(DIST_POINT_NAME *dpn, X509_NAME *iname); + +int NAME_CONSTRAINTS_check(X509 *x, NAME_CONSTRAINTS *nc); +int NAME_CONSTRAINTS_check_CN(X509 *x, NAME_CONSTRAINTS *nc); + +DECLARE_ASN1_FUNCTIONS(ACCESS_DESCRIPTION) +DECLARE_ASN1_FUNCTIONS(AUTHORITY_INFO_ACCESS) + +DECLARE_ASN1_ITEM(POLICY_MAPPING) +DECLARE_ASN1_ALLOC_FUNCTIONS(POLICY_MAPPING) +DECLARE_ASN1_ITEM(POLICY_MAPPINGS) + +DECLARE_ASN1_ITEM(GENERAL_SUBTREE) +DECLARE_ASN1_ALLOC_FUNCTIONS(GENERAL_SUBTREE) + +DECLARE_ASN1_ITEM(NAME_CONSTRAINTS) +DECLARE_ASN1_ALLOC_FUNCTIONS(NAME_CONSTRAINTS) + +DECLARE_ASN1_ALLOC_FUNCTIONS(POLICY_CONSTRAINTS) +DECLARE_ASN1_ITEM(POLICY_CONSTRAINTS) + +GENERAL_NAME *a2i_GENERAL_NAME(GENERAL_NAME *out, + const X509V3_EXT_METHOD *method, + X509V3_CTX *ctx, int gen_type, + const char *value, int is_nc); + +# ifdef HEADER_CONF_H +GENERAL_NAME *v2i_GENERAL_NAME(const X509V3_EXT_METHOD *method, + X509V3_CTX *ctx, CONF_VALUE *cnf); +GENERAL_NAME *v2i_GENERAL_NAME_ex(GENERAL_NAME *out, + const X509V3_EXT_METHOD *method, + X509V3_CTX *ctx, CONF_VALUE *cnf, + int is_nc); +void X509V3_conf_free(CONF_VALUE *val); + +X509_EXTENSION *X509V3_EXT_nconf_nid(CONF *conf, X509V3_CTX *ctx, int ext_nid, + const char *value); +X509_EXTENSION *X509V3_EXT_nconf(CONF *conf, X509V3_CTX *ctx, const char *name, + const char *value); +int X509V3_EXT_add_nconf_sk(CONF *conf, X509V3_CTX *ctx, const char *section, + STACK_OF(X509_EXTENSION) **sk); +int X509V3_EXT_add_nconf(CONF *conf, X509V3_CTX *ctx, const char *section, + X509 *cert); +int X509V3_EXT_REQ_add_nconf(CONF *conf, X509V3_CTX *ctx, const char *section, + X509_REQ *req); +int X509V3_EXT_CRL_add_nconf(CONF *conf, X509V3_CTX *ctx, const char *section, + X509_CRL *crl); + +X509_EXTENSION *X509V3_EXT_conf_nid(LHASH_OF(CONF_VALUE) *conf, + X509V3_CTX *ctx, int ext_nid, + const char *value); +X509_EXTENSION *X509V3_EXT_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, + const char *name, const char *value); +int X509V3_EXT_add_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, + const char *section, X509 *cert); +int X509V3_EXT_REQ_add_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, + const char *section, X509_REQ *req); +int X509V3_EXT_CRL_add_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, + const char *section, X509_CRL *crl); + +int X509V3_add_value_bool_nf(const char *name, int asn1_bool, + STACK_OF(CONF_VALUE) **extlist); +int X509V3_get_value_bool(const CONF_VALUE *value, int *asn1_bool); +int X509V3_get_value_int(const CONF_VALUE *value, ASN1_INTEGER **aint); +void X509V3_set_nconf(X509V3_CTX *ctx, CONF *conf); +void X509V3_set_conf_lhash(X509V3_CTX *ctx, LHASH_OF(CONF_VALUE) *lhash); +# endif + +char *X509V3_get_string(X509V3_CTX *ctx, const char *name, const char *section); +STACK_OF(CONF_VALUE) *X509V3_get_section(X509V3_CTX *ctx, const char *section); +void X509V3_string_free(X509V3_CTX *ctx, char *str); +void X509V3_section_free(X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *section); +void X509V3_set_ctx(X509V3_CTX *ctx, X509 *issuer, X509 *subject, + X509_REQ *req, X509_CRL *crl, int flags); + +int X509V3_add_value(const char *name, const char *value, + STACK_OF(CONF_VALUE) **extlist); +int X509V3_add_value_uchar(const char *name, const unsigned char *value, + STACK_OF(CONF_VALUE) **extlist); +int X509V3_add_value_bool(const char *name, int asn1_bool, + STACK_OF(CONF_VALUE) **extlist); +int X509V3_add_value_int(const char *name, const ASN1_INTEGER *aint, + STACK_OF(CONF_VALUE) **extlist); +char *i2s_ASN1_INTEGER(X509V3_EXT_METHOD *meth, const ASN1_INTEGER *aint); +ASN1_INTEGER *s2i_ASN1_INTEGER(X509V3_EXT_METHOD *meth, const char *value); +char *i2s_ASN1_ENUMERATED(X509V3_EXT_METHOD *meth, const ASN1_ENUMERATED *aint); +char *i2s_ASN1_ENUMERATED_TABLE(X509V3_EXT_METHOD *meth, + const ASN1_ENUMERATED *aint); +int X509V3_EXT_add(X509V3_EXT_METHOD *ext); +int X509V3_EXT_add_list(X509V3_EXT_METHOD *extlist); +int X509V3_EXT_add_alias(int nid_to, int nid_from); +void X509V3_EXT_cleanup(void); + +const X509V3_EXT_METHOD *X509V3_EXT_get(X509_EXTENSION *ext); +const X509V3_EXT_METHOD *X509V3_EXT_get_nid(int nid); +int X509V3_add_standard_extensions(void); +STACK_OF(CONF_VALUE) *X509V3_parse_list(const char *line); +void *X509V3_EXT_d2i(X509_EXTENSION *ext); +void *X509V3_get_d2i(const STACK_OF(X509_EXTENSION) *x, int nid, int *crit, + int *idx); + +X509_EXTENSION *X509V3_EXT_i2d(int ext_nid, int crit, void *ext_struc); +int X509V3_add1_i2d(STACK_OF(X509_EXTENSION) **x, int nid, void *value, + int crit, unsigned long flags); + +#if OPENSSL_API_COMPAT < 0x10100000L +/* The new declarations are in crypto.h, but the old ones were here. */ +# define hex_to_string OPENSSL_buf2hexstr +# define string_to_hex OPENSSL_hexstr2buf +#endif + +void X509V3_EXT_val_prn(BIO *out, STACK_OF(CONF_VALUE) *val, int indent, + int ml); +int X509V3_EXT_print(BIO *out, X509_EXTENSION *ext, unsigned long flag, + int indent); +#ifndef OPENSSL_NO_STDIO +int X509V3_EXT_print_fp(FILE *out, X509_EXTENSION *ext, int flag, int indent); +#endif +int X509V3_extensions_print(BIO *out, const char *title, + const STACK_OF(X509_EXTENSION) *exts, + unsigned long flag, int indent); + +int X509_check_ca(X509 *x); +int X509_check_purpose(X509 *x, int id, int ca); +int X509_supported_extension(X509_EXTENSION *ex); +int X509_PURPOSE_set(int *p, int purpose); +int X509_check_issued(X509 *issuer, X509 *subject); +int X509_check_akid(X509 *issuer, AUTHORITY_KEYID *akid); +void X509_set_proxy_flag(X509 *x); +void X509_set_proxy_pathlen(X509 *x, long l); +long X509_get_proxy_pathlen(X509 *x); + +uint32_t X509_get_extension_flags(X509 *x); +uint32_t X509_get_key_usage(X509 *x); +uint32_t X509_get_extended_key_usage(X509 *x); +const ASN1_OCTET_STRING *X509_get0_subject_key_id(X509 *x); +const ASN1_OCTET_STRING *X509_get0_authority_key_id(X509 *x); +const GENERAL_NAMES *X509_get0_authority_issuer(X509 *x); +const ASN1_INTEGER *X509_get0_authority_serial(X509 *x); + +int X509_PURPOSE_get_count(void); +X509_PURPOSE *X509_PURPOSE_get0(int idx); +int X509_PURPOSE_get_by_sname(const char *sname); +int X509_PURPOSE_get_by_id(int id); +int X509_PURPOSE_add(int id, int trust, int flags, + int (*ck) (const X509_PURPOSE *, const X509 *, int), + const char *name, const char *sname, void *arg); +char *X509_PURPOSE_get0_name(const X509_PURPOSE *xp); +char *X509_PURPOSE_get0_sname(const X509_PURPOSE *xp); +int X509_PURPOSE_get_trust(const X509_PURPOSE *xp); +void X509_PURPOSE_cleanup(void); +int X509_PURPOSE_get_id(const X509_PURPOSE *); + +STACK_OF(OPENSSL_STRING) *X509_get1_email(X509 *x); +STACK_OF(OPENSSL_STRING) *X509_REQ_get1_email(X509_REQ *x); +void X509_email_free(STACK_OF(OPENSSL_STRING) *sk); +STACK_OF(OPENSSL_STRING) *X509_get1_ocsp(X509 *x); +/* Flags for X509_check_* functions */ + +/* + * Always check subject name for host match even if subject alt names present + */ +# define X509_CHECK_FLAG_ALWAYS_CHECK_SUBJECT 0x1 +/* Disable wildcard matching for dnsName fields and common name. */ +# define X509_CHECK_FLAG_NO_WILDCARDS 0x2 +/* Wildcards must not match a partial label. */ +# define X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS 0x4 +/* Allow (non-partial) wildcards to match multiple labels. */ +# define X509_CHECK_FLAG_MULTI_LABEL_WILDCARDS 0x8 +/* Constraint verifier subdomain patterns to match a single labels. */ +# define X509_CHECK_FLAG_SINGLE_LABEL_SUBDOMAINS 0x10 +/* Never check the subject CN */ +# define X509_CHECK_FLAG_NEVER_CHECK_SUBJECT 0x20 +/* + * Match reference identifiers starting with "." to any sub-domain. + * This is a non-public flag, turned on implicitly when the subject + * reference identity is a DNS name. + */ +# define _X509_CHECK_FLAG_DOT_SUBDOMAINS 0x8000 + +int X509_check_host(X509 *x, const char *chk, size_t chklen, + unsigned int flags, char **peername); +int X509_check_email(X509 *x, const char *chk, size_t chklen, + unsigned int flags); +int X509_check_ip(X509 *x, const unsigned char *chk, size_t chklen, + unsigned int flags); +int X509_check_ip_asc(X509 *x, const char *ipasc, unsigned int flags); + +ASN1_OCTET_STRING *a2i_IPADDRESS(const char *ipasc); +ASN1_OCTET_STRING *a2i_IPADDRESS_NC(const char *ipasc); +int X509V3_NAME_from_section(X509_NAME *nm, STACK_OF(CONF_VALUE) *dn_sk, + unsigned long chtype); + +void X509_POLICY_NODE_print(BIO *out, X509_POLICY_NODE *node, int indent); +DEFINE_STACK_OF(X509_POLICY_NODE) + +#ifndef OPENSSL_NO_RFC3779 +typedef struct ASRange_st { + ASN1_INTEGER *min, *max; +} ASRange; + +# define ASIdOrRange_id 0 +# define ASIdOrRange_range 1 + +typedef struct ASIdOrRange_st { + int type; + union { + ASN1_INTEGER *id; + ASRange *range; + } u; +} ASIdOrRange; + +typedef STACK_OF(ASIdOrRange) ASIdOrRanges; +DEFINE_STACK_OF(ASIdOrRange) + +# define ASIdentifierChoice_inherit 0 +# define ASIdentifierChoice_asIdsOrRanges 1 + +typedef struct ASIdentifierChoice_st { + int type; + union { + ASN1_NULL *inherit; + ASIdOrRanges *asIdsOrRanges; + } u; +} ASIdentifierChoice; + +typedef struct ASIdentifiers_st { + ASIdentifierChoice *asnum, *rdi; +} ASIdentifiers; + +DECLARE_ASN1_FUNCTIONS(ASRange) +DECLARE_ASN1_FUNCTIONS(ASIdOrRange) +DECLARE_ASN1_FUNCTIONS(ASIdentifierChoice) +DECLARE_ASN1_FUNCTIONS(ASIdentifiers) + +typedef struct IPAddressRange_st { + ASN1_BIT_STRING *min, *max; +} IPAddressRange; + +# define IPAddressOrRange_addressPrefix 0 +# define IPAddressOrRange_addressRange 1 + +typedef struct IPAddressOrRange_st { + int type; + union { + ASN1_BIT_STRING *addressPrefix; + IPAddressRange *addressRange; + } u; +} IPAddressOrRange; + +typedef STACK_OF(IPAddressOrRange) IPAddressOrRanges; +DEFINE_STACK_OF(IPAddressOrRange) + +# define IPAddressChoice_inherit 0 +# define IPAddressChoice_addressesOrRanges 1 + +typedef struct IPAddressChoice_st { + int type; + union { + ASN1_NULL *inherit; + IPAddressOrRanges *addressesOrRanges; + } u; +} IPAddressChoice; + +typedef struct IPAddressFamily_st { + ASN1_OCTET_STRING *addressFamily; + IPAddressChoice *ipAddressChoice; +} IPAddressFamily; + +typedef STACK_OF(IPAddressFamily) IPAddrBlocks; +DEFINE_STACK_OF(IPAddressFamily) + +DECLARE_ASN1_FUNCTIONS(IPAddressRange) +DECLARE_ASN1_FUNCTIONS(IPAddressOrRange) +DECLARE_ASN1_FUNCTIONS(IPAddressChoice) +DECLARE_ASN1_FUNCTIONS(IPAddressFamily) + +/* + * API tag for elements of the ASIdentifer SEQUENCE. + */ +# define V3_ASID_ASNUM 0 +# define V3_ASID_RDI 1 + +/* + * AFI values, assigned by IANA. It'd be nice to make the AFI + * handling code totally generic, but there are too many little things + * that would need to be defined for other address families for it to + * be worth the trouble. + */ +# define IANA_AFI_IPV4 1 +# define IANA_AFI_IPV6 2 + +/* + * Utilities to construct and extract values from RFC3779 extensions, + * since some of the encodings (particularly for IP address prefixes + * and ranges) are a bit tedious to work with directly. + */ +int X509v3_asid_add_inherit(ASIdentifiers *asid, int which); +int X509v3_asid_add_id_or_range(ASIdentifiers *asid, int which, + ASN1_INTEGER *min, ASN1_INTEGER *max); +int X509v3_addr_add_inherit(IPAddrBlocks *addr, + const unsigned afi, const unsigned *safi); +int X509v3_addr_add_prefix(IPAddrBlocks *addr, + const unsigned afi, const unsigned *safi, + unsigned char *a, const int prefixlen); +int X509v3_addr_add_range(IPAddrBlocks *addr, + const unsigned afi, const unsigned *safi, + unsigned char *min, unsigned char *max); +unsigned X509v3_addr_get_afi(const IPAddressFamily *f); +int X509v3_addr_get_range(IPAddressOrRange *aor, const unsigned afi, + unsigned char *min, unsigned char *max, + const int length); + +/* + * Canonical forms. + */ +int X509v3_asid_is_canonical(ASIdentifiers *asid); +int X509v3_addr_is_canonical(IPAddrBlocks *addr); +int X509v3_asid_canonize(ASIdentifiers *asid); +int X509v3_addr_canonize(IPAddrBlocks *addr); + +/* + * Tests for inheritance and containment. + */ +int X509v3_asid_inherits(ASIdentifiers *asid); +int X509v3_addr_inherits(IPAddrBlocks *addr); +int X509v3_asid_subset(ASIdentifiers *a, ASIdentifiers *b); +int X509v3_addr_subset(IPAddrBlocks *a, IPAddrBlocks *b); + +/* + * Check whether RFC 3779 extensions nest properly in chains. + */ +int X509v3_asid_validate_path(X509_STORE_CTX *); +int X509v3_addr_validate_path(X509_STORE_CTX *); +int X509v3_asid_validate_resource_set(STACK_OF(X509) *chain, + ASIdentifiers *ext, + int allow_inheritance); +int X509v3_addr_validate_resource_set(STACK_OF(X509) *chain, + IPAddrBlocks *ext, int allow_inheritance); + +#endif /* OPENSSL_NO_RFC3779 */ + +DEFINE_STACK_OF(ASN1_STRING) + +/* + * Admission Syntax + */ +typedef struct NamingAuthority_st NAMING_AUTHORITY; +typedef struct ProfessionInfo_st PROFESSION_INFO; +typedef struct Admissions_st ADMISSIONS; +typedef struct AdmissionSyntax_st ADMISSION_SYNTAX; +DECLARE_ASN1_FUNCTIONS(NAMING_AUTHORITY) +DECLARE_ASN1_FUNCTIONS(PROFESSION_INFO) +DECLARE_ASN1_FUNCTIONS(ADMISSIONS) +DECLARE_ASN1_FUNCTIONS(ADMISSION_SYNTAX) +DEFINE_STACK_OF(ADMISSIONS) +DEFINE_STACK_OF(PROFESSION_INFO) +typedef STACK_OF(PROFESSION_INFO) PROFESSION_INFOS; + +const ASN1_OBJECT *NAMING_AUTHORITY_get0_authorityId( + const NAMING_AUTHORITY *n); +const ASN1_IA5STRING *NAMING_AUTHORITY_get0_authorityURL( + const NAMING_AUTHORITY *n); +const ASN1_STRING *NAMING_AUTHORITY_get0_authorityText( + const NAMING_AUTHORITY *n); +void NAMING_AUTHORITY_set0_authorityId(NAMING_AUTHORITY *n, + ASN1_OBJECT* namingAuthorityId); +void NAMING_AUTHORITY_set0_authorityURL(NAMING_AUTHORITY *n, + ASN1_IA5STRING* namingAuthorityUrl); +void NAMING_AUTHORITY_set0_authorityText(NAMING_AUTHORITY *n, + ASN1_STRING* namingAuthorityText); + +const GENERAL_NAME *ADMISSION_SYNTAX_get0_admissionAuthority( + const ADMISSION_SYNTAX *as); +void ADMISSION_SYNTAX_set0_admissionAuthority( + ADMISSION_SYNTAX *as, GENERAL_NAME *aa); +const STACK_OF(ADMISSIONS) *ADMISSION_SYNTAX_get0_contentsOfAdmissions( + const ADMISSION_SYNTAX *as); +void ADMISSION_SYNTAX_set0_contentsOfAdmissions( + ADMISSION_SYNTAX *as, STACK_OF(ADMISSIONS) *a); +const GENERAL_NAME *ADMISSIONS_get0_admissionAuthority(const ADMISSIONS *a); +void ADMISSIONS_set0_admissionAuthority(ADMISSIONS *a, GENERAL_NAME *aa); +const NAMING_AUTHORITY *ADMISSIONS_get0_namingAuthority(const ADMISSIONS *a); +void ADMISSIONS_set0_namingAuthority(ADMISSIONS *a, NAMING_AUTHORITY *na); +const PROFESSION_INFOS *ADMISSIONS_get0_professionInfos(const ADMISSIONS *a); +void ADMISSIONS_set0_professionInfos(ADMISSIONS *a, PROFESSION_INFOS *pi); +const ASN1_OCTET_STRING *PROFESSION_INFO_get0_addProfessionInfo( + const PROFESSION_INFO *pi); +void PROFESSION_INFO_set0_addProfessionInfo( + PROFESSION_INFO *pi, ASN1_OCTET_STRING *aos); +const NAMING_AUTHORITY *PROFESSION_INFO_get0_namingAuthority( + const PROFESSION_INFO *pi); +void PROFESSION_INFO_set0_namingAuthority( + PROFESSION_INFO *pi, NAMING_AUTHORITY *na); +const STACK_OF(ASN1_STRING) *PROFESSION_INFO_get0_professionItems( + const PROFESSION_INFO *pi); +void PROFESSION_INFO_set0_professionItems( + PROFESSION_INFO *pi, STACK_OF(ASN1_STRING) *as); +const STACK_OF(ASN1_OBJECT) *PROFESSION_INFO_get0_professionOIDs( + const PROFESSION_INFO *pi); +void PROFESSION_INFO_set0_professionOIDs( + PROFESSION_INFO *pi, STACK_OF(ASN1_OBJECT) *po); +const ASN1_PRINTABLESTRING *PROFESSION_INFO_get0_registrationNumber( + const PROFESSION_INFO *pi); +void PROFESSION_INFO_set0_registrationNumber( + PROFESSION_INFO *pi, ASN1_PRINTABLESTRING *rn); + +# ifdef __cplusplus +} +# endif +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/x509v3err.h b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/x509v3err.h new file mode 100644 index 0000000..5f25442 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/include/openssl/x509v3err.h @@ -0,0 +1,162 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_X509V3ERR_H +# define HEADER_X509V3ERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_X509V3_strings(void); + +/* + * X509V3 function codes. + */ +# define X509V3_F_A2I_GENERAL_NAME 164 +# define X509V3_F_ADDR_VALIDATE_PATH_INTERNAL 166 +# define X509V3_F_ASIDENTIFIERCHOICE_CANONIZE 161 +# define X509V3_F_ASIDENTIFIERCHOICE_IS_CANONICAL 162 +# define X509V3_F_BIGNUM_TO_STRING 167 +# define X509V3_F_COPY_EMAIL 122 +# define X509V3_F_COPY_ISSUER 123 +# define X509V3_F_DO_DIRNAME 144 +# define X509V3_F_DO_EXT_I2D 135 +# define X509V3_F_DO_EXT_NCONF 151 +# define X509V3_F_GNAMES_FROM_SECTNAME 156 +# define X509V3_F_I2S_ASN1_ENUMERATED 121 +# define X509V3_F_I2S_ASN1_IA5STRING 149 +# define X509V3_F_I2S_ASN1_INTEGER 120 +# define X509V3_F_I2V_AUTHORITY_INFO_ACCESS 138 +# define X509V3_F_LEVEL_ADD_NODE 168 +# define X509V3_F_NOTICE_SECTION 132 +# define X509V3_F_NREF_NOS 133 +# define X509V3_F_POLICY_CACHE_CREATE 169 +# define X509V3_F_POLICY_CACHE_NEW 170 +# define X509V3_F_POLICY_DATA_NEW 171 +# define X509V3_F_POLICY_SECTION 131 +# define X509V3_F_PROCESS_PCI_VALUE 150 +# define X509V3_F_R2I_CERTPOL 130 +# define X509V3_F_R2I_PCI 155 +# define X509V3_F_S2I_ASN1_IA5STRING 100 +# define X509V3_F_S2I_ASN1_INTEGER 108 +# define X509V3_F_S2I_ASN1_OCTET_STRING 112 +# define X509V3_F_S2I_SKEY_ID 115 +# define X509V3_F_SET_DIST_POINT_NAME 158 +# define X509V3_F_SXNET_ADD_ID_ASC 125 +# define X509V3_F_SXNET_ADD_ID_INTEGER 126 +# define X509V3_F_SXNET_ADD_ID_ULONG 127 +# define X509V3_F_SXNET_GET_ID_ASC 128 +# define X509V3_F_SXNET_GET_ID_ULONG 129 +# define X509V3_F_TREE_INIT 172 +# define X509V3_F_V2I_ASIDENTIFIERS 163 +# define X509V3_F_V2I_ASN1_BIT_STRING 101 +# define X509V3_F_V2I_AUTHORITY_INFO_ACCESS 139 +# define X509V3_F_V2I_AUTHORITY_KEYID 119 +# define X509V3_F_V2I_BASIC_CONSTRAINTS 102 +# define X509V3_F_V2I_CRLD 134 +# define X509V3_F_V2I_EXTENDED_KEY_USAGE 103 +# define X509V3_F_V2I_GENERAL_NAMES 118 +# define X509V3_F_V2I_GENERAL_NAME_EX 117 +# define X509V3_F_V2I_IDP 157 +# define X509V3_F_V2I_IPADDRBLOCKS 159 +# define X509V3_F_V2I_ISSUER_ALT 153 +# define X509V3_F_V2I_NAME_CONSTRAINTS 147 +# define X509V3_F_V2I_POLICY_CONSTRAINTS 146 +# define X509V3_F_V2I_POLICY_MAPPINGS 145 +# define X509V3_F_V2I_SUBJECT_ALT 154 +# define X509V3_F_V2I_TLS_FEATURE 165 +# define X509V3_F_V3_GENERIC_EXTENSION 116 +# define X509V3_F_X509V3_ADD1_I2D 140 +# define X509V3_F_X509V3_ADD_VALUE 105 +# define X509V3_F_X509V3_EXT_ADD 104 +# define X509V3_F_X509V3_EXT_ADD_ALIAS 106 +# define X509V3_F_X509V3_EXT_I2D 136 +# define X509V3_F_X509V3_EXT_NCONF 152 +# define X509V3_F_X509V3_GET_SECTION 142 +# define X509V3_F_X509V3_GET_STRING 143 +# define X509V3_F_X509V3_GET_VALUE_BOOL 110 +# define X509V3_F_X509V3_PARSE_LIST 109 +# define X509V3_F_X509_PURPOSE_ADD 137 +# define X509V3_F_X509_PURPOSE_SET 141 + +/* + * X509V3 reason codes. + */ +# define X509V3_R_BAD_IP_ADDRESS 118 +# define X509V3_R_BAD_OBJECT 119 +# define X509V3_R_BN_DEC2BN_ERROR 100 +# define X509V3_R_BN_TO_ASN1_INTEGER_ERROR 101 +# define X509V3_R_DIRNAME_ERROR 149 +# define X509V3_R_DISTPOINT_ALREADY_SET 160 +# define X509V3_R_DUPLICATE_ZONE_ID 133 +# define X509V3_R_ERROR_CONVERTING_ZONE 131 +# define X509V3_R_ERROR_CREATING_EXTENSION 144 +# define X509V3_R_ERROR_IN_EXTENSION 128 +# define X509V3_R_EXPECTED_A_SECTION_NAME 137 +# define X509V3_R_EXTENSION_EXISTS 145 +# define X509V3_R_EXTENSION_NAME_ERROR 115 +# define X509V3_R_EXTENSION_NOT_FOUND 102 +# define X509V3_R_EXTENSION_SETTING_NOT_SUPPORTED 103 +# define X509V3_R_EXTENSION_VALUE_ERROR 116 +# define X509V3_R_ILLEGAL_EMPTY_EXTENSION 151 +# define X509V3_R_INCORRECT_POLICY_SYNTAX_TAG 152 +# define X509V3_R_INVALID_ASNUMBER 162 +# define X509V3_R_INVALID_ASRANGE 163 +# define X509V3_R_INVALID_BOOLEAN_STRING 104 +# define X509V3_R_INVALID_EXTENSION_STRING 105 +# define X509V3_R_INVALID_INHERITANCE 165 +# define X509V3_R_INVALID_IPADDRESS 166 +# define X509V3_R_INVALID_MULTIPLE_RDNS 161 +# define X509V3_R_INVALID_NAME 106 +# define X509V3_R_INVALID_NULL_ARGUMENT 107 +# define X509V3_R_INVALID_NULL_NAME 108 +# define X509V3_R_INVALID_NULL_VALUE 109 +# define X509V3_R_INVALID_NUMBER 140 +# define X509V3_R_INVALID_NUMBERS 141 +# define X509V3_R_INVALID_OBJECT_IDENTIFIER 110 +# define X509V3_R_INVALID_OPTION 138 +# define X509V3_R_INVALID_POLICY_IDENTIFIER 134 +# define X509V3_R_INVALID_PROXY_POLICY_SETTING 153 +# define X509V3_R_INVALID_PURPOSE 146 +# define X509V3_R_INVALID_SAFI 164 +# define X509V3_R_INVALID_SECTION 135 +# define X509V3_R_INVALID_SYNTAX 143 +# define X509V3_R_ISSUER_DECODE_ERROR 126 +# define X509V3_R_MISSING_VALUE 124 +# define X509V3_R_NEED_ORGANIZATION_AND_NUMBERS 142 +# define X509V3_R_NO_CONFIG_DATABASE 136 +# define X509V3_R_NO_ISSUER_CERTIFICATE 121 +# define X509V3_R_NO_ISSUER_DETAILS 127 +# define X509V3_R_NO_POLICY_IDENTIFIER 139 +# define X509V3_R_NO_PROXY_CERT_POLICY_LANGUAGE_DEFINED 154 +# define X509V3_R_NO_PUBLIC_KEY 114 +# define X509V3_R_NO_SUBJECT_DETAILS 125 +# define X509V3_R_OPERATION_NOT_DEFINED 148 +# define X509V3_R_OTHERNAME_ERROR 147 +# define X509V3_R_POLICY_LANGUAGE_ALREADY_DEFINED 155 +# define X509V3_R_POLICY_PATH_LENGTH 156 +# define X509V3_R_POLICY_PATH_LENGTH_ALREADY_DEFINED 157 +# define X509V3_R_POLICY_WHEN_PROXY_LANGUAGE_REQUIRES_NO_POLICY 159 +# define X509V3_R_SECTION_NOT_FOUND 150 +# define X509V3_R_UNABLE_TO_GET_ISSUER_DETAILS 122 +# define X509V3_R_UNABLE_TO_GET_ISSUER_KEYID 123 +# define X509V3_R_UNKNOWN_BIT_STRING_ARGUMENT 111 +# define X509V3_R_UNKNOWN_EXTENSION 129 +# define X509V3_R_UNKNOWN_EXTENSION_NAME 130 +# define X509V3_R_UNKNOWN_OPTION 120 +# define X509V3_R_UNSUPPORTED_OPTION 117 +# define X509V3_R_UNSUPPORTED_TYPE 167 +# define X509V3_R_USER_TOO_LONG 132 + +#endif diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/lib/android/libcrypto.so b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/lib/android/libcrypto.so new file mode 100644 index 0000000..9893bf4 Binary files /dev/null and b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/lib/android/libcrypto.so differ diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/lib/android/libssl.so b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/lib/android/libssl.so new file mode 100644 index 0000000..23650ee Binary files /dev/null and b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/lib/android/libssl.so differ diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/lib/ios/libcrypto.a b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/lib/ios/libcrypto.a new file mode 100644 index 0000000..523169d Binary files /dev/null and b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/lib/ios/libcrypto.a differ diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/lib/ios/libssl.a b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/lib/ios/libssl.a new file mode 100644 index 0000000..6a0e901 Binary files /dev/null and b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/lib/ios/libssl.a differ diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/lib/linux/libcrypto.so.1.1 b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/lib/linux/libcrypto.so.1.1 new file mode 100644 index 0000000..0741b46 Binary files /dev/null and b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/lib/linux/libcrypto.so.1.1 differ diff --git a/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/lib/linux/libssl.so.1.1 b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/lib/linux/libssl.so.1.1 new file mode 100644 index 0000000..f0d49a7 Binary files /dev/null and b/MediaClient/happytime-onvif-client-library1/OnvifClientLibrary/openssl/lib/linux/libssl.so.1.1 differ diff --git a/MediaClient/happytime-onvif-client-library1/OnvifTest.sln b/MediaClient/happytime-onvif-client-library1/OnvifTest.sln new file mode 100644 index 0000000..176c709 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifTest.sln @@ -0,0 +1,37 @@ + +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}") = "OnvifTest", "OnvifTest\OnvifTest.vcxproj", "{07B68620-49A2-49E9-BE75-5FBFDBD51A94}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OnvifTest2", "OnvifTest2\OnvifTest2.vcxproj", "{DA689200-DC98-4BEF-A991-9AE67F89BA86}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OnvifTest3", "OnvifTest3\OnvifTest3.vcxproj", "{06F85A1A-C2D4-4696-8D30-2E4BD8FFF5AF}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {07B68620-49A2-49E9-BE75-5FBFDBD51A94}.Debug|x64.ActiveCfg = Debug|x64 + {07B68620-49A2-49E9-BE75-5FBFDBD51A94}.Debug|x64.Build.0 = Debug|x64 + {07B68620-49A2-49E9-BE75-5FBFDBD51A94}.Release|x64.ActiveCfg = Release|x64 + {07B68620-49A2-49E9-BE75-5FBFDBD51A94}.Release|x64.Build.0 = Release|x64 + {DA689200-DC98-4BEF-A991-9AE67F89BA86}.Debug|x64.ActiveCfg = Debug|x64 + {DA689200-DC98-4BEF-A991-9AE67F89BA86}.Debug|x64.Build.0 = Debug|x64 + {DA689200-DC98-4BEF-A991-9AE67F89BA86}.Release|x64.ActiveCfg = Release|x64 + {DA689200-DC98-4BEF-A991-9AE67F89BA86}.Release|x64.Build.0 = Release|x64 + {06F85A1A-C2D4-4696-8D30-2E4BD8FFF5AF}.Debug|x64.ActiveCfg = Debug|x64 + {06F85A1A-C2D4-4696-8D30-2E4BD8FFF5AF}.Debug|x64.Build.0 = Debug|x64 + {06F85A1A-C2D4-4696-8D30-2E4BD8FFF5AF}.Release|x64.ActiveCfg = Release|x64 + {06F85A1A-C2D4-4696-8D30-2E4BD8FFF5AF}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {B24194E2-6BE2-4F5C-8F33-CE7BD871EF69} + EndGlobalSection +EndGlobal diff --git a/MediaClient/happytime-onvif-client-library1/OnvifTest/OnvifTest.cpp b/MediaClient/happytime-onvif-client-library1/OnvifTest/OnvifTest.cpp new file mode 100644 index 0000000..941800e --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifTest/OnvifTest.cpp @@ -0,0 +1,5194 @@ +/*************************************************************************************** + * + * 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.h" +#include "http_parse.h" +#include "onvif.h" +#include "onvif_probe.h" +#include "onvif_event.h" +#include "onvif_api.h" +#include "config.h" +#include "linked_list.h" + +/***************************************************************************************/ +PPSN_CTX * m_dev_fl; // device free list +PPSN_CTX * m_dev_ul; // device used list + +BOOL m_bStateDetect; // device state detect flag +pthread_t m_hStateDetect; // device state detect threand handler + +#define MAX_DEV_NUMS 10 + +/***************************************************************************************/ + +ONVIF_DEVICE_EX * findDevice(ONVIF_DEVICE_EX * pdevice) +{ + ONVIF_DEVICE_EX * p_dev = (ONVIF_DEVICE_EX *) pps_lookup_start(m_dev_ul); + while (p_dev) + { + if (strcmp(p_dev->onvif_device.binfo.XAddr.host, pdevice->onvif_device.binfo.XAddr.host) == 0 && + p_dev->onvif_device.binfo.XAddr.port == pdevice->onvif_device.binfo.XAddr.port) + { + break; + } + + p_dev = (ONVIF_DEVICE_EX *) pps_lookup_next(m_dev_ul, p_dev); + } + + pps_lookup_end(m_dev_ul); + + return p_dev; +} + +ONVIF_DEVICE_EX * findDeviceByEndpointReference(char * p_EndpointReference) +{ + ONVIF_DEVICE_EX * p_dev = (ONVIF_DEVICE_EX *) pps_lookup_start(m_dev_ul); + while (p_dev) + { + if (strcmp(p_dev->onvif_device.binfo.EndpointReference, p_EndpointReference) == 0) + { + break; + } + + p_dev = (ONVIF_DEVICE_EX *) pps_lookup_next(m_dev_ul, p_dev); + } + + pps_lookup_end(m_dev_ul); + + return p_dev; +} + +ONVIF_DEVICE_EX * addDevice(ONVIF_DEVICE_EX * pdevice) +{ + ONVIF_DEVICE_EX * p_dev = (ONVIF_DEVICE_EX *) pps_fl_pop(m_dev_fl); + if (p_dev) + { + memcpy(p_dev, pdevice, sizeof(ONVIF_DEVICE_EX)); + p_dev->p_user = 0; + p_dev->onvif_device.events.init_term_time = 60; + + // set device login information + onvif_SetAuthInfo(&p_dev->onvif_device, "admin", "admin"); + + // set auth method + onvif_SetAuthMethod(&p_dev->onvif_device, AuthMethod_UsernameToken); + + // set request timeout + onvif_SetReqTimeout(&p_dev->onvif_device, 5000); + + pps_ctx_ul_add(m_dev_ul, p_dev); + } + + return p_dev; +} + +void onvifServiceCapabilitiesTest(ONVIF_DEVICE_EX * p_dev) +{ + BOOL ret; + + // device service capabilities + tds_GetServiceCapabilities_RES tds; + memset(&tds, 0, sizeof(tds)); + + ret = onvif_tds_GetServiceCapabilities(&p_dev->onvif_device, NULL, &tds); + + printf("onvif_tds_GetServiceCapabilities return ret = %d\n", ret); + + // media service capabilities + trt_GetServiceCapabilities_RES trt; + memset(&trt, 0, sizeof(trt)); + + ret = onvif_trt_GetServiceCapabilities(&p_dev->onvif_device, NULL, &trt); + + printf("onvif_trt_GetServiceCapabilities return ret = %d\n", ret); + + // ptz service capabilities + ptz_GetServiceCapabilities_RES ptz; + memset(&ptz, 0, sizeof(ptz)); + + ret = onvif_ptz_GetServiceCapabilities(&p_dev->onvif_device, NULL, &ptz); + + printf("onvif_ptz_GetServiceCapabilities return ret = %d\n", ret); + + // event service capabilities + tev_GetServiceCapabilities_RES tev; + memset(&tev, 0, sizeof(tev)); + + ret = onvif_tev_GetServiceCapabilities(&p_dev->onvif_device, NULL, &tev); + + printf("onvif_tev_GetServiceCapabilities return ret = %d\n", ret); + + // imaging service capabilities + img_GetServiceCapabilities_RES img; + memset(&img, 0, sizeof(img)); + + ret = onvif_img_GetServiceCapabilities(&p_dev->onvif_device, NULL, &img); + + printf("onvif_img_GetServiceCapabilities return ret = %d\n", ret); + + // analytics service capabilities + tan_GetServiceCapabilities_RES tan; + memset(&tan, 0, sizeof(tan)); + + ret = onvif_tan_GetServiceCapabilities(&p_dev->onvif_device, NULL, &tan); + + printf("onvif_tan_GetServiceCapabilities return ret = %d\n", ret); + + // media2 service capabilities + tr2_GetServiceCapabilities_RES tr2; + memset(&tr2, 0, sizeof(tr2)); + + ret = onvif_tr2_GetServiceCapabilities(&p_dev->onvif_device, NULL, &tr2); + + printf("onvif_tr2_GetServiceCapabilities return ret = %d\n", ret); + +#ifdef DEVICEIO_SUPPORT + // deviceIO service capabilities + tmd_GetServiceCapabilities_RES tmd; + memset(&tmd, 0, sizeof(tmd)); + + ret = onvif_tmd_GetServiceCapabilities(&p_dev->onvif_device, NULL, &tmd); + + printf("onvif_tmd_GetServiceCapabilities return ret = %d\n", ret); +#endif + +#ifdef PROFILE_G_SUPPORT + // recording service capabilities + trc_GetServiceCapabilities_RES trc; + memset(&trc, 0, sizeof(trc)); + + ret = onvif_trc_GetServiceCapabilities(&p_dev->onvif_device, NULL, &trc); + + printf("onvif_trc_GetServiceCapabilities return ret = %d\n", ret); + + // replay service capabilities + trp_GetServiceCapabilities_RES trp; + memset(&trp, 0, sizeof(trp)); + + ret = onvif_trp_GetServiceCapabilities(&p_dev->onvif_device, NULL, &trp); + + printf("onvif_trp_GetServiceCapabilities return ret = %d\n", ret); + + // search service capabilities + tse_GetServiceCapabilities_RES tse; + memset(&tse, 0, sizeof(tse)); + + ret = onvif_tse_GetServiceCapabilities(&p_dev->onvif_device, NULL, &tse); + + printf("onvif_tse_GetServiceCapabilities return ret = %d\n", ret); +#endif + +#ifdef PROFILE_C_SUPPORT + // access control service capabilities + tac_GetServiceCapabilities_RES tac; + memset(&tac, 0, sizeof(tac)); + + ret = onvif_tac_GetServiceCapabilities(&p_dev->onvif_device, NULL, &tac); + + printf("onvif_tac_GetServiceCapabilities return ret = %d\n", ret); + + // door control service capabilities + tdc_GetServiceCapabilities_RES tdc; + memset(&tdc, 0, sizeof(tdc)); + + ret = onvif_tdc_GetServiceCapabilities(&p_dev->onvif_device, NULL, &tdc); + + printf("onvif_tdc_GetServiceCapabilities return ret = %d\n", ret); +#endif + +#ifdef THERMAL_SUPPORT + // thermal service capabilities + tth_GetServiceCapabilities_RES tth; + memset(&tth, 0, sizeof(tth)); + + ret = onvif_tth_GetServiceCapabilities(&p_dev->onvif_device, NULL, &tth); + + printf("onvif_tth_GetServiceCapabilities return ret = %d\n", ret); +#endif + +#ifdef CREDENTIAL_SUPPORT + // crendential service capabilities + tcr_GetServiceCapabilities_RES tcr; + memset(&tcr, 0, sizeof(tcr)); + + ret = onvif_tcr_GetServiceCapabilities(&p_dev->onvif_device, NULL, &tcr); + + printf("onvif_tcr_GetServiceCapabilities return ret = %d\n", ret); +#endif + +#ifdef ACCESS_RULES + // access rules service capabilities + tar_GetServiceCapabilities_RES tar; + memset(&tar, 0, sizeof(tar)); + + ret = onvif_tar_GetServiceCapabilities(&p_dev->onvif_device, NULL, &tar); + + printf("onvif_tar_GetServiceCapabilities return ret = %d\n", ret); +#endif + +#ifdef SCHEDULE_SUPPORT + // schedule service capabilities + tsc_GetServiceCapabilities_RES tsc; + memset(&tsc, 0, sizeof(tsc)); + + ret = onvif_tsc_GetServiceCapabilities(&p_dev->onvif_device, NULL, &tsc); + + printf("onvif_tsc_GetServiceCapabilities return ret = %d\n", ret); +#endif + +#ifdef RECEIVER_SUPPORT + // receiver service capabilities + trv_GetServiceCapabilities_RES trv; + memset(&trv, 0, sizeof(trv)); + + ret = onvif_trv_GetServiceCapabilities(&p_dev->onvif_device, NULL, &trv); + + printf("onvif_trv_GetServiceCapabilities return ret = %d\n", ret); +#endif + +#ifdef PROVISIONING_SUPPORT + // provisioning service capabilities + tpv_GetServiceCapabilities_RES tpv; + memset(&trv, 0, sizeof(trv)); + + ret = onvif_tpv_GetServiceCapabilities(&p_dev->onvif_device, NULL, &tpv); + + printf("onvif_tpv_GetServiceCapabilities return ret = %d\n", ret); +#endif + +} + +void onvifNetworkTest(ONVIF_DEVICE_EX * p_dev) +{ + BOOL ret; + + while (1) + { + tds_GetNetworkInterfaces_RES res; + memset(&res, 0, sizeof(res)); + + ret = onvif_tds_GetNetworkInterfaces(&p_dev->onvif_device, NULL, &res); + + printf("onvif_tds_GetNetworkInterfaces return ret = %d\n", ret); + + onvif_free_NetworkInterfaces(&res.NetworkInterfaces); + break; + } + + while (1) + { + tds_GetScopes_RES res; + memset(&res, 0, sizeof(res)); + + ret = onvif_tds_GetScopes(&p_dev->onvif_device, NULL, &res); + + printf("onvif_tds_GetScopes return ret = %d\n", ret); + + break; + } + + while (1) + { + tds_GetNetworkDefaultGateway_RES res; + memset(&res, 0, sizeof(res)); + + ret = onvif_tds_GetNetworkDefaultGateway(&p_dev->onvif_device, NULL, &res); + + printf("onvif_tds_GetNetworkDefaultGateway return ret = %d\n", ret); + + break; + } + + while (1) + { + tds_GetDNS_RES res; + memset(&res, 0, sizeof(res)); + + ret = onvif_tds_GetDNS(&p_dev->onvif_device, NULL, &res); + + printf("onvif_tds_GetDNS return ret = %d\n", ret); + + break; + } + + while (1) + { + tds_GetZeroConfiguration_RES res; + memset(&res, 0, sizeof(res)); + + ret = onvif_tds_GetZeroConfiguration(&p_dev->onvif_device, NULL, &res); + + printf("onvif_tds_GetZeroConfiguration return ret = %d\n", ret); + + break; + } +} + +void onvifMediaTest(ONVIF_DEVICE_EX * p_dev) +{ + BOOL ret; + + while (1) + { + // GetAudioOutputs + trt_GetAudioOutputs_RES res; + memset(&res, 0, sizeof(res)); + + ret = onvif_trt_GetAudioOutputs(&p_dev->onvif_device, NULL, &res); + + printf("onvif_trt_GetAudioOutputs return ret = %d\n", ret); + + if (!ret || NULL == res.AudioOutputs) + { + break; + } + + // GetAudioOutputConfigurations + trt_GetAudioOutputConfigurations_RES res1; + memset(&res1, 0, sizeof(res1)); + + ret = onvif_trt_GetAudioOutputConfigurations(&p_dev->onvif_device, NULL, &res1); + + printf("onvif_trt_GetAudioOutputConfigurations return ret = %d\n", ret); + + if (ret && res1.Configurations) + { + // GetAudioOutputConfiguration + trt_GetAudioOutputConfiguration_REQ req2; + trt_GetAudioOutputConfiguration_RES res2; + + memset(&req2, 0, sizeof(req2)); + memset(&res2, 0, sizeof(res2)); + + strcpy(req2.ConfigurationToken, res1.Configurations->Configuration.token); + + ret = onvif_trt_GetAudioOutputConfiguration(&p_dev->onvif_device, &req2, &res2); + + printf("onvif_trt_GetAudioOutputConfiguration return ret = %d\n", ret); + + // SetAudioOutputConfiguration + trt_SetAudioOutputConfiguration_REQ req3; + memset(&req3, 0, sizeof(req3)); + + memcpy(&req3.Configuration, &res2.Configuration, sizeof(onvif_AudioOutputConfiguration)); + strcpy(req3.Configuration.Name, "test"); + + ret = onvif_trt_SetAudioOutputConfiguration(&p_dev->onvif_device, &req3, NULL); + + printf("onvif_trt_SetAudioOutputConfiguration return ret = %d\n", ret); + + // AddAudioOutputConfiguration + trt_AddAudioOutputConfiguration_REQ req4; + memset(&req4, 0, sizeof(req4)); + + strcpy(req4.ProfileToken, p_dev->onvif_device.curProfile->token); + strcpy(req4.ConfigurationToken, res2.Configuration.token); + + ret = onvif_trt_AddAudioOutputConfiguration(&p_dev->onvif_device, &req4, NULL); + + printf("onvif_trt_AddAudioOutputConfiguration return ret = %d\n", ret); + + // RemoveAudioOutputConfiguration + trt_RemoveAudioOutputConfiguration_REQ req5; + memset(&req5, 0, sizeof(req5)); + + strcpy(req5.ProfileToken, p_dev->onvif_device.curProfile->token); + + ret = onvif_trt_RemoveAudioOutputConfiguration(&p_dev->onvif_device, &req5, NULL); + + printf("onvif_trt_RemoveAudioOutputConfiguration return ret = %d\n", ret); + + onvif_free_AudioOutputConfigurations(&res1.Configurations); + } + + // GetAudioDecoderConfigurations + trt_GetAudioDecoderConfigurations_RES res6; + memset(&res6, 0, sizeof(res6)); + + ret = onvif_trt_GetAudioDecoderConfigurations(&p_dev->onvif_device, NULL, &res6); + + printf("onvif_trt_GetAudioDecoderConfigurations return ret = %d\n", ret); + + if (ret && res6.Configurations) + { + // GetAudioDecoderConfiguration + trt_GetAudioDecoderConfiguration_REQ req7; + trt_GetAudioDecoderConfiguration_RES res7; + + memset(&req7, 0, sizeof(req7)); + memset(&res7, 0, sizeof(res7)); + + strcpy(req7.ConfigurationToken, res6.Configurations->Configuration.token); + + ret = onvif_trt_GetAudioDecoderConfiguration(&p_dev->onvif_device, &req7, &res7); + + printf("onvif_trt_GetAudioDecoderConfiguration return ret = %d\n", ret); + + // onvif_SetAudioDecoderConfiguration + trt_SetAudioDecoderConfiguration_REQ req8; + memset(&req8, 0, sizeof(req8)); + + memcpy(&req8.Configuration, &res7.Configuration, sizeof(onvif_AudioDecoderConfiguration)); + strcpy(req8.Configuration.Name, "test"); + + ret = onvif_trt_SetAudioDecoderConfiguration(&p_dev->onvif_device, &req8, NULL); + + printf("onvif_trt_SetAudioDecoderConfiguration return ret = %d\n", ret); + + // AddAudioDecoderConfiguration + trt_AddAudioDecoderConfiguration_REQ req9; + memset(&req9, 0, sizeof(req9)); + + strcpy(req9.ProfileToken, p_dev->onvif_device.curProfile->token); + strcpy(req9.ConfigurationToken, res7.Configuration.token); + + ret = onvif_trt_AddAudioDecoderConfiguration(&p_dev->onvif_device, &req9, NULL); + + printf("onvif_trt_AddAudioDecoderConfiguration return ret = %d\n", ret); + + // RemoveAudioDecoderConfiguration + trt_RemoveAudioDecoderConfiguration_REQ req10; + memset(&req10, 0, sizeof(req10)); + + strcpy(req10.ProfileToken, p_dev->onvif_device.curProfile->token); + + ret = onvif_trt_RemoveAudioDecoderConfiguration(&p_dev->onvif_device, &req10, NULL); + + printf("onvif_trt_RemoveAudioDecoderConfiguration return ret = %d\n", ret); + + onvif_free_AudioDecoderConfigurations(&res6.Configurations); + } + + onvif_free_AudioOutputs(&res.AudioOutputs); + + break; + } + + while (1) + { + // GetMetadataConfigurations + trt_GetMetadataConfigurations_RES res; + memset(&res, 0, sizeof(res)); + + ret = onvif_trt_GetMetadataConfigurations(&p_dev->onvif_device, NULL, &res); + + printf("onvif_trt_GetMetadataConfigurations return ret = %d\n", ret); + + if (NULL == res.Configurations) + { + break; + } + + // GetMetadataConfiguration + trt_GetMetadataConfiguration_REQ req1; + trt_GetMetadataConfiguration_RES res1; + + memset(&req1, 0, sizeof(req1)); + memset(&res1, 0, sizeof(res1)); + + strcpy(req1.ConfigurationToken, res.Configurations->Configuration.token); + + ret = onvif_trt_GetMetadataConfiguration(&p_dev->onvif_device, &req1, &res1); + + printf("onvif_trt_GetMetadataConfiguration return ret = %d\n", ret); + + onvif_free_Configs(&res1.Configuration.AnalyticsEngineConfiguration.AnalyticsModule); + + // GetMetadataConfigurationOptions + trt_GetMetadataConfigurationOptions_RES res2; + + memset(&res2, 0, sizeof(res2)); + + ret = onvif_trt_GetMetadataConfigurationOptions(&p_dev->onvif_device, NULL, &res2); + + printf("onvif_trt_GetMetadataConfigurationOptions return ret = %d\n", ret); + + // SetMetadataConfiguration + trt_SetMetadataConfiguration_REQ req3; + + memcpy(&req3.Configuration, &res.Configurations->Configuration, sizeof(onvif_MetadataConfiguration)); + req3.ForcePersistence = FALSE; + req3.Configuration.PTZStatus.Status = !req3.Configuration.PTZStatus.Status; + + ret = onvif_trt_SetMetadataConfiguration(&p_dev->onvif_device, &req3, NULL); + + printf("onvif_trt_SetMetadataConfiguration return ret = %d\n", ret); + + // SetMetadataConfiguration + req3.Configuration.PTZStatus.Status = !req3.Configuration.PTZStatus.Status; + + ret = onvif_trt_SetMetadataConfiguration(&p_dev->onvif_device, &req3, NULL); + + printf("onvif_trt_SetMetadataConfiguration return ret = %d\n", ret); + + if (p_dev->onvif_device.curProfile) + { + // AddMetadataConfiguration + trt_AddMetadataConfiguration_REQ req4; + + strcpy(req4.ConfigurationToken, res.Configurations->Configuration.token); + strcpy(req4.ProfileToken, p_dev->onvif_device.curProfile->token); + + ret = onvif_trt_AddMetadataConfiguration(&p_dev->onvif_device, &req4, NULL); + + printf("onvif_trt_AddMetadataConfiguration return ret = %d\n", ret); + + // RemoveMetadataConfiguration + trt_RemoveMetadataConfiguration_REQ req5; + + strcpy(req5.ProfileToken, p_dev->onvif_device.curProfile->token); + + ret = onvif_trt_RemoveMetadataConfiguration(&p_dev->onvif_device, &req5, NULL); + + printf("onvif_trt_RemoveMetadataConfiguration return ret = %d\n", ret); + } + + // free resource + onvif_free_MetadataConfigurations(&res.Configurations); + + break; + } + + while (1) + { + // GetVideoAnalyticsConfigurations + trt_GetVideoAnalyticsConfigurations_RES res; + memset(&res, 0, sizeof(res)); + + ret = onvif_trt_GetVideoAnalyticsConfigurations(&p_dev->onvif_device, NULL, &res); + + printf("onvif_trt_GetVideoAnalyticsConfigurations return ret = %d\n", ret); + + if (NULL == res.Configurations) + { + break; + } + + // GetVideoAnalyticsConfiguration + trt_GetVideoAnalyticsConfiguration_REQ req1; + trt_GetVideoAnalyticsConfiguration_RES res1; + + memset(&req1, 0, sizeof(req1)); + memset(&res1, 0, sizeof(res1)); + + strcpy(req1.ConfigurationToken, res.Configurations->Configuration.token); + + ret = onvif_trt_GetVideoAnalyticsConfiguration(&p_dev->onvif_device, &req1, &res1); + + printf("onvif_trt_GetVideoAnalyticsConfiguration return ret = %d\n", ret); + + onvif_free_Configs(&res1.Configuration.AnalyticsEngineConfiguration.AnalyticsModule); + onvif_free_Configs(&res1.Configuration.RuleEngineConfiguration.Rule); + + // SetVideoAnalyticsConfiguration + trt_SetVideoAnalyticsConfiguration_REQ req2; + + memcpy(&req2.Configuration, &res.Configurations->Configuration, sizeof(onvif_VideoAnalyticsConfiguration)); + req2.ForcePersistence = FALSE; + strcpy(req2.Configuration.Name, "video_analytics_test"); + + ret = onvif_trt_SetVideoAnalyticsConfiguration(&p_dev->onvif_device, &req2, NULL); + + printf("onvif_trt_SetVideoAnalyticsConfiguration return ret = %d\n", ret); + + // SetVideoAnalyticsConfiguration + memcpy(&req2.Configuration, &res.Configurations->Configuration, sizeof(onvif_VideoAnalyticsConfiguration)); + + ret = onvif_trt_SetVideoAnalyticsConfiguration(&p_dev->onvif_device, &req2, NULL); + + printf("onvif_trt_SetVideoAnalyticsConfiguration return ret = %d\n", ret); + + if (p_dev->onvif_device.curProfile) + { + // AddMetadataConfiguration + trt_AddVideoAnalyticsConfiguration_REQ req3; + + strcpy(req3.ConfigurationToken, res.Configurations->Configuration.token); + strcpy(req3.ProfileToken, p_dev->onvif_device.curProfile->token); + + ret = onvif_trt_AddVideoAnalyticsConfiguration(&p_dev->onvif_device, &req3, NULL); + + printf("onvif_trt_AddVideoAnalyticsConfiguration return ret = %d\n", ret); + + // RemoveMetadataConfiguration + trt_RemoveVideoAnalyticsConfiguration_REQ req4; + + strcpy(req4.ProfileToken, p_dev->onvif_device.curProfile->token); + + ret = onvif_trt_RemoveVideoAnalyticsConfiguration(&p_dev->onvif_device, &req4, NULL); + + printf("onvif_trt_RemoveVideoAnalyticsConfiguration return ret = %d\n", ret); + } + + // free resource + onvif_free_VideoAnalyticsConfigurations(&res.Configurations); + + break; + } +} + +void onvifUserTest(ONVIF_DEVICE_EX * p_dev) +{ + BOOL ret; + char username[32]; + + // CreateUsers + tds_CreateUsers_REQ req; + memset(&req, 0, sizeof(req)); + + snprintf(username, sizeof(username), "testuser%d", rand()%1000); + + strcpy(req.User.Username, username); + req.User.PasswordFlag = 1; + strcpy(req.User.Password, "testpass"); + req.User.UserLevel = UserLevel_Administrator; + + ret = onvif_tds_CreateUsers(&p_dev->onvif_device, &req, NULL); + + printf("onvif_tds_CreateUsers return ret = %d\n", ret); + + if (!ret) + { + return; + } + + onvif_SetAuthInfo(&p_dev->onvif_device, username, "testpass"); + + // GetNetworkProtocols + tds_GetNetworkProtocols_REQ req1; + tds_GetNetworkProtocols_RES res1; + + memset(&req1, 0, sizeof(req1)); + memset(&res1, 0, sizeof(res1)); + + ret = onvif_tds_GetNetworkProtocols(&p_dev->onvif_device, &req1, &res1); + + printf("onvif_tds_GetNetworkProtocols return ret = %d\n", ret); + +} + +void onvifGeoLocationTest(ONVIF_DEVICE_EX * p_dev) +{ + BOOL ret; + + // GetGeoLocation + tds_GetGeoLocation_RES res; + + memset(&res, 0, sizeof(res)); + + ret = onvif_tds_GetGeoLocation(&p_dev->onvif_device, NULL, &res); + + printf("onvif_tds_GetGeoLocation return ret = %d\n", ret); + + if (NULL == res.Location) + { + LocationEntityList * p_item = onvif_add_LocationEntity(&res.Location); + + p_item->Location.EntityFlag = 1; + strcpy(p_item->Location.Entity, "VideoSource"); + p_item->Location.TokenFlag = 1; + strcpy(p_item->Location.Token, "VideoSourceToken"); + p_item->Location.GeoLocationFlag = 1; + p_item->Location.GeoLocation.lonFlag = 1; + p_item->Location.GeoLocation.lon = 100.0; + p_item->Location.GeoLocation.latFlag = 1; + p_item->Location.GeoLocation.lat = 100.0; + p_item->Location.GeoLocation.elevationFlag = 1; + p_item->Location.GeoLocation.elevation = 100.0; + } + + // SetGeoLocation + tds_SetGeoLocation_REQ req1; + + req1.Location = res.Location; + + ret = onvif_tds_SetGeoLocation(&p_dev->onvif_device, &req1, NULL); + + printf("onvif_tds_SetGeoLocation return ret = %d\n", ret); + + // DeleteGeoLocation + tds_DeleteGeoLocation_REQ req2; + + req2.Location = res.Location; + + ret = onvif_tds_DeleteGeoLocation(&p_dev->onvif_device, &req2, NULL); + + printf("onvif_tds_DeleteGeoLocation return ret = %d\n", ret); + + // SetGeoLocation + tds_SetGeoLocation_REQ req3; + + req3.Location = res.Location; + + ret = onvif_tds_SetGeoLocation(&p_dev->onvif_device, &req3, NULL); + + printf("onvif_tds_SetGeoLocation return ret = %d\n", ret); + + onvif_free_LocationEntitis(&res.Location); +} + +void onvifImageTest(ONVIF_DEVICE_EX * p_dev) +{ + BOOL ret; + + while (1) + { + // GetVideoSources + trt_GetVideoSources_RES res; + memset(&res, 0, sizeof(res)); + + ret = onvif_trt_GetVideoSources(&p_dev->onvif_device, NULL, &res); + + printf("onvif_trt_GetVideoSources return ret = %d\n", ret); + + if (!ret || NULL == res.VideoSources) + { + break; + } + + // GetMoveOptions + img_GetMoveOptions_REQ req1; + img_GetMoveOptions_RES res1; + + memset(&req1, 0, sizeof(req1)); + memset(&res1, 0, sizeof(res1)); + + strcpy(req1.VideoSourceToken, res.VideoSources->VideoSource.token); + + ret = onvif_img_GetMoveOptions(&p_dev->onvif_device, &req1, &res1); + + printf("onvif_img_GetMoveOptions return ret = %d\n", ret); + + if (ret && res1.MoveOptions.ContinuousFlag) + { + // Move + img_Move_REQ req2; + memset(&req2, 0, sizeof(req2)); + + strcpy(req2.VideoSourceToken, res.VideoSources->VideoSource.token); + req2.Focus.ContinuousFlag = 1; + req2.Focus.Continuous.Speed = res1.MoveOptions.Continuous.Speed.Min; + + ret = onvif_img_Move(&p_dev->onvif_device, &req2, NULL); + + printf("onvif_img_Move return ret = %d\n", ret); + + // Stop + img_Stop_REQ req3; + memset(&req3, 0, sizeof(req3)); + + strcpy(req3.VideoSourceToken, res.VideoSources->VideoSource.token); + + ret = onvif_img_Stop(&p_dev->onvif_device, &req3, NULL); + + printf("onvif_img_Stop return ret = %d\n", ret); + } + + if (p_dev->onvif_device.Capabilities.image.Presets) + { + // GetPresets + img_GetPresets_REQ req4; + img_GetPresets_RES res4; + + memset(&req4, 0, sizeof(req4)); + memset(&res4, 0, sizeof(res4)); + + strcpy(req4.VideoSourceToken, res.VideoSources->VideoSource.token); + + ret = onvif_img_GetPresets(&p_dev->onvif_device, &req4, &res4); + + printf("onvif_img_GetPresets return ret = %d\n", ret); + + // GetCurrentPreset + img_GetCurrentPreset_REQ req5; + img_GetCurrentPreset_RES res5; + + memset(&req5, 0, sizeof(req5)); + memset(&res5, 0, sizeof(res5)); + + strcpy(req5.VideoSourceToken, res.VideoSources->VideoSource.token); + + ret = onvif_img_GetCurrentPreset(&p_dev->onvif_device, &req5, &res5); + + printf("onvif_img_GetCurrentPreset return ret = %d\n", ret); + + if (res4.Preset && p_dev->onvif_device.Capabilities.image.AdaptablePreset) + { + // SetCurrentPreset + img_SetCurrentPreset_REQ req6; + memset(&req6, 0, sizeof(req6)); + + strcpy(req6.VideoSourceToken, res.VideoSources->VideoSource.token); + strcpy(req6.PresetToken, res4.Preset->Preset.token); + + ret = onvif_img_SetCurrentPreset(&p_dev->onvif_device, &req6, NULL); + + printf("onvif_img_SetCurrentPreset return ret = %d\n", ret); + + // SetCurrentPreset, resume + strcpy(req6.PresetToken, res5.Preset.token); + + ret = onvif_img_SetCurrentPreset(&p_dev->onvif_device, &req6, NULL); + + printf("onvif_img_SetCurrentPreset return ret = %d\n", ret); + } + + onvif_free_ImagingPresets(&res4.Preset); + } + + onvif_free_VideoSources(&res.VideoSources); + + break; + } +} + +#ifdef DEVICEIO_SUPPORT + +void onvifDeviceIOTest(ONVIF_DEVICE_EX * p_dev) +{ + BOOL ret; + + // GetRelayoutputs + tmd_GetRelayOutputs_RES res; + + memset(&res, 0, sizeof(res)); + + ret = onvif_tmd_GetRelayOutputs(&p_dev->onvif_device, NULL, &res); + + printf("onvif_tmd_GetRelayOutputs return ret = %d\n", ret); + + if (NULL == res.RelayOutputs) + { + return; + } + + // SetRelayOutputSettings + tmd_SetRelayOutputSettings_REQ req1; + + memset(&req1, 0, sizeof(req1)); + + memcpy(&req1.RelayOutput, &res.RelayOutputs->RelayOutput, sizeof(onvif_RelayOutput)); + + req1.RelayOutput.Properties.IdleState = RelayIdleState_open; + req1.RelayOutput.Properties.DelayTime = 20; + + ret = onvif_tmd_SetRelayOutputSettings(&p_dev->onvif_device, &req1, NULL); + + printf("onvif_tmd_SetRelayOutputSettings return ret = %d\n", ret); + + // SetRelayOutputSettings + tmd_SetRelayOutputSettings_REQ req2; + + memset(&req2, 0, sizeof(req2)); + + memcpy(&req2.RelayOutput, &res.RelayOutputs->RelayOutput, sizeof(onvif_RelayOutput)); + + ret = onvif_tmd_SetRelayOutputSettings(&p_dev->onvif_device, &req2, NULL); + + printf("onvif_tmd_SetRelayOutputSettings return ret = %d\n", ret); + + // SetRelayoutputState + tmd_SetRelayOutputState_REQ req3; + + memset(&req3, 0, sizeof(req3)); + + strcpy(req3.RelayOutputToken, res.RelayOutputs->RelayOutput.token); + req3.LogicalState = RelayLogicalState_inactive; + + ret = onvif_tmd_SetRelayOutputState(&p_dev->onvif_device, &req3, NULL); + + printf("onvif_tmd_SetRelayOutputState return ret = %d\n", ret); + + // SetRelayoutputState + tmd_SetRelayOutputState_REQ req4; + + memset(&req4, 0, sizeof(req4)); + + strcpy(req4.RelayOutputToken, res.RelayOutputs->RelayOutput.token); + req4.LogicalState = RelayLogicalState_active; + + ret = onvif_tmd_SetRelayOutputState(&p_dev->onvif_device, &req4, NULL); + + printf("onvif_tmd_SetRelayOutputState return ret = %d\n", ret); + + // GetRelayOutputOptions + tmd_GetRelayOutputOptions_REQ req5; + tmd_GetRelayOutputOptions_RES res5; + + memset(&req5, 0, sizeof(req5)); + memset(&res5, 0, sizeof(res5)); + + req5.RelayOutputTokenFlag = 1; + strcpy(req5.RelayOutputToken, res.RelayOutputs->RelayOutput.token); + + ret = onvif_tmd_GetRelayOutputOptions(&p_dev->onvif_device, &req5, &res5); + + printf("onvif_tmd_GetRelayOutputOptions return ret = %d\n", ret); + + onvif_free_RelayOutputOptions(&res5.RelayOutputOptions); + + onvif_free_RelayOutputs(&res.RelayOutputs); + + // GetDigitalInputs + tmd_GetDigitalInputs_RES res6; + + memset(&res6, 0, sizeof(res6)); + + ret = onvif_tmd_GetDigitalInputs(&p_dev->onvif_device, NULL, &res6); + + printf("onvif_tmd_GetDigitalInputs return ret = %d\n", ret); + + if (NULL == res6.DigitalInputs) + { + return; + } + + // GetDigitalInputConfigurationOptions + tmd_GetDigitalInputConfigurationOptions_REQ req7; + tmd_GetDigitalInputConfigurationOptions_RES res7; + + memset(&req7, 0, sizeof(req7)); + memset(&res7, 0, sizeof(res7)); + + req7.TokenFlag = 1; + strcpy(req7.Token, res6.DigitalInputs->DigitalInput.token); + + ret = onvif_tmd_GetDigitalInputConfigurationOptions(&p_dev->onvif_device, &req7, &res7); + + printf("onvif_tmd_GetDigitalInputConfigurationOptions return ret = %d\n", ret); + + // SetDigitalInputConfigurations + tmd_SetDigitalInputConfigurations_REQ req8; + + memset(&req8, 0, sizeof(req8)); + + req8.DigitalInputs = res6.DigitalInputs; + req8.DigitalInputs->DigitalInput.IdleStateFlag = 1; + req8.DigitalInputs->DigitalInput.IdleState = DigitalIdleState_open; + + ret = onvif_tmd_SetDigitalInputConfigurations(&p_dev->onvif_device, &req8, NULL); + + printf("onvif_tmd_SetDigitalInputConfigurations return ret = %d\n", ret); + + // SetDigitalInputConfigurations + tmd_SetDigitalInputConfigurations_REQ req9; + + memset(&req9, 0, sizeof(req9)); + + req8.DigitalInputs = res6.DigitalInputs; + + ret = onvif_tmd_SetDigitalInputConfigurations(&p_dev->onvif_device, &req9, NULL); + + printf("onvif_tmd_SetDigitalInputConfigurations return ret = %d\n", ret); + + onvif_free_DigitalInputs(&res6.DigitalInputs); +} + +#endif // end of DEVICEIO_SUPPORT + +void onvifMedia2Test(ONVIF_DEVICE_EX * p_dev) +{ + BOOL ret; + + while (1) + { + // GetAudioEncoderConfigurationOptions + tr2_GetAudioEncoderConfigurationOptions_REQ req; + tr2_GetAudioEncoderConfigurationOptions_RES res; + + memset(&req, 0, sizeof(req)); + memset(&res, 0, sizeof(res)); + + ret = onvif_tr2_GetAudioEncoderConfigurationOptions(&p_dev->onvif_device, &req, &res); + if (ret) + { + onvif_free_AudioEncoder2ConfigurationOptions(&res.Options); + } + + printf("onvif_tr2_GetAudioEncoderConfigurationOptions return ret = %d\n", ret); + + break; + } + + while (1) + { + // GetAudioEncoderConfigurations + tr2_GetAudioEncoderConfigurations_REQ req; + tr2_GetAudioEncoderConfigurations_RES res; + + memset(&req, 0, sizeof(req)); + memset(&res, 0, sizeof(res)); + + ret = onvif_tr2_GetAudioEncoderConfigurations(&p_dev->onvif_device, &req, &res); + + printf("onvif_tr2_GetAudioEncoderConfigurations return ret = %d\n", ret); + + if (!ret || NULL == res.Configurations) + { + break; + } + + // SetAudioEncoderConfiguration + tr2_SetAudioEncoderConfiguration_REQ req1; + tr2_SetAudioEncoderConfiguration_RES res1; + + memset(&req1, 0, sizeof(req1)); + memset(&res1, 0, sizeof(res1)); + + memcpy(&req1.Configuration, &res.Configurations->Configuration, sizeof(onvif_AudioEncoder2Configuration)); + + ret = onvif_tr2_SetAudioEncoderConfiguration(&p_dev->onvif_device, &req1, &res1); + + printf("onvif_tr2_SetAudioEncoderConfiguration return ret = %d\n", ret); + + onvif_free_AudioEncoder2Configurations(&res.Configurations); + + break; + } + + while (1) + { + // GetAudioSourceConfigurationOptions + tr2_GetAudioSourceConfigurationOptions_REQ req; + tr2_GetAudioSourceConfigurationOptions_RES res; + + memset(&req, 0, sizeof(req)); + memset(&res, 0, sizeof(res)); + + ret = onvif_tr2_GetAudioSourceConfigurationOptions(&p_dev->onvif_device, &req, &res); + + printf("onvif_tr2_GetAudioSourceConfigurationOptions return ret = %d\n", ret); + + break; + } + + while (1) + { + // GetAudioSourceConfigurations + tr2_GetAudioSourceConfigurations_REQ req; + tr2_GetAudioSourceConfigurations_RES res; + + memset(&req, 0, sizeof(req)); + memset(&res, 0, sizeof(res)); + + ret = onvif_tr2_GetAudioSourceConfigurations(&p_dev->onvif_device, &req, &res); + + printf("onvif_tr2_GetAudioSourceConfigurations return ret = %d\n", ret); + + if (!ret || NULL == res.Configurations) + { + break; + } + + // SetAudioSourceConfiguration + tr2_SetAudioSourceConfiguration_REQ req1; + tr2_SetAudioSourceConfiguration_RES res1; + + memset(&req1, 0, sizeof(req1)); + memset(&res1, 0, sizeof(res1)); + + memcpy(&req1.Configuration, &res.Configurations->Configuration, sizeof(onvif_AudioSourceConfiguration)); + + ret = onvif_tr2_SetAudioSourceConfiguration(&p_dev->onvif_device, &req1, &res1); + + printf("onvif_tr2_SetAudioSourceConfiguration return ret = %d\n", ret); + + onvif_free_AudioSourceConfigurations(&res.Configurations); + + break; + } + + while (1) + { + // GetVideoEncoderConfigurationOptions + tr2_GetVideoEncoderConfigurationOptions_REQ req; + tr2_GetVideoEncoderConfigurationOptions_RES res; + + memset(&req, 0, sizeof(req)); + memset(&res, 0, sizeof(res)); + + ret = onvif_tr2_GetVideoEncoderConfigurationOptions(&p_dev->onvif_device, &req, &res); + if (ret) + { + onvif_free_VideoEncoder2ConfigurationOptions(&res.Options); + } + + printf("onvif_tr2_GetVideoEncoderConfigurationOptions return ret = %d\n", ret); + + break; + } + + while (1) + { + // GetVideoEncoderConfigurations + tr2_GetVideoEncoderConfigurations_REQ req; + tr2_GetVideoEncoderConfigurations_RES res; + + memset(&req, 0, sizeof(req)); + memset(&res, 0, sizeof(res)); + + ret = onvif_tr2_GetVideoEncoderConfigurations(&p_dev->onvif_device, &req, &res); + + printf("onvif_tr2_GetVideoEncoderConfigurations return ret = %d\n", ret); + + if (!ret || NULL == res.Configurations) + { + break; + } + + // SetVideoEncoderConfiguration + tr2_SetVideoEncoderConfiguration_REQ req1; + tr2_SetVideoEncoderConfiguration_RES res1; + + memset(&req1, 0, sizeof(req1)); + memset(&res1, 0, sizeof(res1)); + + memcpy(&req1.Configuration, &res.Configurations->Configuration, sizeof(onvif_VideoEncoder2Configuration)); + + ret = onvif_tr2_SetVideoEncoderConfiguration(&p_dev->onvif_device, &req1, &res1); + + printf("onvif_tr2_SetVideoEncoderConfiguration return ret = %d\n", ret); + + onvif_free_VideoEncoder2Configurations(&res.Configurations); + + break; + } + + while (1) + { + // GetVideoSourceConfigurationOptions + tr2_GetVideoSourceConfigurationOptions_REQ req; + tr2_GetVideoSourceConfigurationOptions_RES res; + + memset(&req, 0, sizeof(req)); + memset(&res, 0, sizeof(res)); + + ret = onvif_tr2_GetVideoSourceConfigurationOptions(&p_dev->onvif_device, &req, &res); + + printf("onvif_tr2_GetVideoSourceConfigurationOptions return ret = %d\n", ret); + + break; + } + + while (1) + { + // GetVideoSourceConfigurations + tr2_GetVideoSourceConfigurations_REQ req; + tr2_GetVideoSourceConfigurations_RES res; + + memset(&req, 0, sizeof(req)); + memset(&res, 0, sizeof(res)); + + ret = onvif_tr2_GetVideoSourceConfigurations(&p_dev->onvif_device, &req, &res); + + printf("onvif_tr2_GetVideoSourceConfigurations return ret = %d\n", ret); + + if (!ret || NULL == res.Configurations) + { + break; + } + + // SetVideoSourceConfiguration + tr2_SetVideoSourceConfiguration_REQ req1; + tr2_SetVideoSourceConfiguration_RES res1; + + memset(&req1, 0, sizeof(req1)); + memset(&res1, 0, sizeof(res1)); + + memcpy(&req1.Configuration, &res.Configurations->Configuration, sizeof(onvif_VideoSourceConfiguration)); + + ret = onvif_tr2_SetVideoSourceConfiguration(&p_dev->onvif_device, &req1, &res1); + + printf("onvif_tr2_SetVideoSourceConfiguration return ret = %d\n", ret); + + // GetVideoEncoderInstances + tr2_GetVideoEncoderInstances_REQ req2; + tr2_GetVideoEncoderInstances_RES res2; + + memset(&req2, 0, sizeof(req2)); + memset(&res2, 0, sizeof(res2)); + + strcpy(req2.ConfigurationToken, res.Configurations->Configuration.token); + + ret = onvif_tr2_GetVideoEncoderInstances(&p_dev->onvif_device, &req2, &res2); + + printf("onvif_tr2_GetVideoEncoderInstances return ret = %d\n", ret); + + onvif_free_VideoSourceConfigurations(&res.Configurations); + + break; + } + + { + // GetMetadataConfigurationOptions + tr2_GetMetadataConfigurationOptions_REQ req; + tr2_GetMetadataConfigurationOptions_RES res; + + memset(&req, 0, sizeof(req)); + memset(&res, 0, sizeof(res)); + + ret = onvif_tr2_GetMetadataConfigurationOptions(&p_dev->onvif_device, &req, &res); + + printf("onvif_tr2_GetMetadataConfigurationOptions return ret = %d\n", ret); + } + + { + // GetMetadataConfigurations + tr2_GetMetadataConfigurations_REQ req; + tr2_GetMetadataConfigurations_RES res; + + memset(&req, 0, sizeof(req)); + memset(&res, 0, sizeof(res)); + + ret = onvif_tr2_GetMetadataConfigurations(&p_dev->onvif_device, &req, &res); + if (ret) + { + onvif_free_MetadataConfigurations(&res.Configurations); + } + + printf("onvif_tr2_GetMetadataConfigurations return ret = %d\n", ret); + } + + while (1) + { + // GetProfiles + tr2_GetProfiles_REQ req; + tr2_GetProfiles_RES res; + + memset(&req, 0, sizeof(req)); + memset(&res, 0, sizeof(res)); + + ret = onvif_tr2_GetProfiles(&p_dev->onvif_device, &req, &res); + + printf("onvif_tr2_GetProfiles return ret = %d\n", ret); + + if (!ret || NULL == res.Profiles) + { + break; + } + + // GetStreamUri + tr2_GetStreamUri_REQ req1; + tr2_GetStreamUri_RES res1; + + memset(&req1, 0, sizeof(req1)); + memset(&res1, 0, sizeof(res1)); + + strcpy(req1.Protocol, "RtspUnicast"); + strcpy(req1.ProfileToken, res.Profiles->MediaProfile.token); + + ret = onvif_tr2_GetStreamUri(&p_dev->onvif_device, &req1, &res1); + + printf("onvif_tr2_GetStreamUri return ret = %d\n", ret); + + if (ret) + { + printf("onvif_tr2_GetStreamUri, profile=%s, uri=%s\n", req1.ProfileToken, res1.Uri); + } + + // SetSynchronizationPoint + tr2_SetSynchronizationPoint_REQ req2; + tr2_SetSynchronizationPoint_RES res2; + + memset(&req2, 0, sizeof(req2)); + memset(&res2, 0, sizeof(res2)); + + strcpy(req2.ProfileToken, res.Profiles->MediaProfile.token); + + ret = onvif_tr2_SetSynchronizationPoint(&p_dev->onvif_device, &req2, &res2); + + printf("onvif_tr2_SetSynchronizationPoint return ret = %d\n", ret); + + // AddConfiguration + tr2_AddConfiguration_REQ req3; + tr2_AddConfiguration_RES res3; + + memset(&req3, 0, sizeof(req3)); + memset(&res3, 0, sizeof(res3)); + + req3.sizeConfiguration = 1; + strcpy(req3.Configuration[0].Type, "All"); + strcpy(req3.ProfileToken, res.Profiles->MediaProfile.token); + + ret = onvif_tr2_AddConfiguration(&p_dev->onvif_device, &req3, &res3); + + printf("onvif_tr2_AddConfiguration return ret = %d\n", ret); + + // free profiles + onvif_free_MediaProfiles(&res.Profiles); + + break; + } + + while (1) + { + // CreateProfile + tr2_CreateProfile_REQ req; + tr2_CreateProfile_RES res; + + memset(&req, 0, sizeof(req)); + memset(&res, 0, sizeof(res)); + + strcpy(req.Name, "test"); + + ret = onvif_tr2_CreateProfile(&p_dev->onvif_device, &req, &res); + + printf("onvif_tr2_CreateProfile return ret = %d\n", ret); + + if (ret) + { + printf("onvif_tr2_CreateProfile token = %s\n", res.Token); + } + else + { + break; + } + + // DeleteProfile + tr2_DeleteProfile_REQ req1; + tr2_DeleteProfile_RES res1; + + memset(&req1, 0, sizeof(req1)); + memset(&res1, 0, sizeof(res1)); + + strcpy(req1.Token, res.Token); + + ret = onvif_tr2_DeleteProfile(&p_dev->onvif_device, &req1, &res1); + + printf("onvif_tr2_DeleteProfile return ret = %d\n", ret); + + + break; + } + + while (1) + { + // GetAudioOutputConfigurations + tr2_GetAudioOutputConfigurations_REQ req; + tr2_GetAudioOutputConfigurations_RES res; + + memset(&req, 0, sizeof(req)); + memset(&res, 0, sizeof(res)); + + ret = onvif_tr2_GetAudioOutputConfigurations(&p_dev->onvif_device, &req, &res); + + printf("onvif_tr2_GetAudioOutputConfigurations return ret = %d\n", ret); + + if (!ret || NULL == res.Configurations) + { + break; + } + + // SetAudioOutputConfiguration + tr2_SetAudioOutputConfiguration_REQ req1; + + memset(&req1, 0, sizeof(req1)); + + memcpy(&req1.Configuration, &res.Configurations->Configuration, sizeof(onvif_AudioOutputConfiguration)); + + ret = onvif_tr2_SetAudioOutputConfiguration(&p_dev->onvif_device, &req1, NULL); + + printf("onvif_tr2_SetAudioOutputConfiguration return ret = %d\n", ret); + + onvif_free_AudioOutputConfigurations(&res.Configurations); + + break; + } + + while (1) + { + // GetAudioOutputConfigurationOptions + tr2_GetAudioOutputConfigurationOptions_REQ req; + tr2_GetAudioOutputConfigurationOptions_RES res; + + memset(&req, 0, sizeof(req)); + memset(&res, 0, sizeof(res)); + + ret = onvif_tr2_GetAudioOutputConfigurationOptions(&p_dev->onvif_device, &req, &res); + + printf("onvif_tr2_GetAudioOutputConfigurationOptions return ret = %d\n", ret); + + break; + } + + while (1) + { + // GetAudioDecoderConfigurations + tr2_GetAudioDecoderConfigurations_REQ req; + tr2_GetAudioDecoderConfigurations_RES res; + + memset(&req, 0, sizeof(req)); + memset(&res, 0, sizeof(res)); + + ret = onvif_tr2_GetAudioDecoderConfigurations(&p_dev->onvif_device, &req, &res); + + printf("onvif_tr2_GetAudioDecoderConfigurations return ret = %d\n", ret); + + if (!ret || NULL == res.Configurations) + { + break; + } + + // SetAudioDecoderConfiguration + tr2_SetAudioDecoderConfiguration_REQ req1; + + memset(&req1, 0, sizeof(req1)); + + memcpy(&req1.Configuration, &res.Configurations->Configuration, sizeof(onvif_AudioDecoderConfiguration)); + + ret = onvif_tr2_SetAudioDecoderConfiguration(&p_dev->onvif_device, &req1, NULL); + + printf("onvif_tr2_SetAudioDecoderConfiguration return ret = %d\n", ret); + + onvif_free_AudioDecoderConfigurations(&res.Configurations); + + break; + } + + while (1) + { + // GetAudioDecoderConfigurationOptions + tr2_GetAudioDecoderConfigurationOptions_REQ req; + tr2_GetAudioDecoderConfigurationOptions_RES res; + + memset(&req, 0, sizeof(req)); + memset(&res, 0, sizeof(res)); + + ret = onvif_tr2_GetAudioDecoderConfigurationOptions(&p_dev->onvif_device, &req, &res); + + printf("onvif_tr2_GetAudioDecoderConfigurationOptions return ret = %d\n", ret); + + onvif_free_AudioEncoder2ConfigurationOptions(&res.Options); + + break; + } + + while (1) + { + // GetProfiles + tr2_GetProfiles_REQ req; + tr2_GetProfiles_RES res; + + memset(&req, 0, sizeof(req)); + memset(&res, 0, sizeof(res)); + + ret = onvif_tr2_GetProfiles(&p_dev->onvif_device, &req, &res); + + printf("onvif_tr2_GetProfiles return ret = %d\n", ret); + + if (!ret || NULL == res.Profiles) + { + break; + } + + // GetSnapshotUri + tr2_GetSnapshotUri_REQ req1; + tr2_GetSnapshotUri_RES res1; + + memset(&req1, 0, sizeof(req1)); + memset(&res1, 0, sizeof(res1)); + + strcpy(req1.ProfileToken, res.Profiles->MediaProfile.token); + + ret = onvif_tr2_GetSnapshotUri(&p_dev->onvif_device, &req1, &res1); + + printf("onvif_tr2_GetSnapshotUri return ret = %d\n", ret); + + // StartMulticastStreaming + tr2_StartMulticastStreaming_REQ req2; + tr2_StartMulticastStreaming_RES res2; + + memset(&req2, 0, sizeof(req2)); + memset(&res2, 0, sizeof(res2)); + + strcpy(req2.ProfileToken, res.Profiles->MediaProfile.token); + + ret = onvif_tr2_StartMulticastStreaming(&p_dev->onvif_device, &req2, &res2); + + printf("onvif_tr2_StartMulticastStreaming return ret = %d\n", ret); + + + // StopMulticastStreaming + tr2_StopMulticastStreaming_REQ req3; + tr2_StopMulticastStreaming_RES res3; + + memset(&req3, 0, sizeof(req3)); + memset(&res3, 0, sizeof(res3)); + + strcpy(req3.ProfileToken, res.Profiles->MediaProfile.token); + + ret = onvif_tr2_StopMulticastStreaming(&p_dev->onvif_device, &req3, &res3); + + printf("onvif_tr2_StopMulticastStreaming return ret = %d\n", ret); + + + onvif_free_MediaProfiles(&res.Profiles); + + break; + } + + while (1) + { + // GetVideoSourceConfigurations + tr2_GetVideoSourceConfigurations_REQ req; + tr2_GetVideoSourceConfigurations_RES res; + + memset(&req, 0, sizeof(req)); + memset(&res, 0, sizeof(res)); + + ret = onvif_tr2_GetVideoSourceConfigurations(&p_dev->onvif_device, &req, &res); + + printf("onvif_tr2_GetVideoSourceConfigurations return ret = %d\n", ret); + + if (!ret || NULL == res.Configurations) + { + break; + } + + // GetVideoSourceModes + tr2_GetVideoSourceModes_REQ req1; + tr2_GetVideoSourceModes_RES res1; + + memset(&req1, 0, sizeof(req1)); + memset(&res1, 0, sizeof(res1)); + + strcpy(req1.VideoSourceToken, res.Configurations->Configuration.SourceToken); + + ret = onvif_tr2_GetVideoSourceModes(&p_dev->onvif_device, &req1, &res1); + + printf("onvif_tr2_GetVideoSourceModes return ret = %d\n", ret); + + if (!ret || NULL == res1.VideoSourceModes) + { + onvif_free_VideoSourceConfigurations(&res.Configurations); + break; + } + + // SetVideoSourceMode + tr2_SetVideoSourceMode_REQ req2; + tr2_SetVideoSourceMode_RES res2; + + memset(&req2, 0, sizeof(req2)); + memset(&res2, 0, sizeof(res2)); + + strcpy(req2.VideoSourceToken, res.Configurations->Configuration.SourceToken); + strcpy(req2.VideoSourceModeToken, res1.VideoSourceModes->VideoSourceMode.token); + + ret = onvif_tr2_SetVideoSourceMode(&p_dev->onvif_device, &req2, &res2); + + printf("onvif_tr2_SetVideoSourceMode return ret = %d\n", ret); + + + onvif_free_VideoSourceModes(&res1.VideoSourceModes); + onvif_free_VideoSourceConfigurations(&res.Configurations); + + break; + } + +} + +void onvifMedia2OSDTest(ONVIF_DEVICE_EX * p_dev) +{ + BOOL ret; + + while (1) + { + // GetVideoSourceConfigurations + tr2_GetVideoSourceConfigurations_REQ req; + tr2_GetVideoSourceConfigurations_RES res; + + memset(&req, 0, sizeof(req)); + memset(&res, 0, sizeof(res)); + + ret = onvif_tr2_GetVideoSourceConfigurations(&p_dev->onvif_device, &req, &res); + + printf("onvif_tr2_GetVideoSourceConfigurations return ret = %d\n", ret); + + if (!ret || NULL == res.Configurations) + { + break; + } + + // GetOSDOptions + tr2_GetOSDOptions_REQ req1; + tr2_GetOSDOptions_RES res1; + + memset(&req1, 0, sizeof(req1)); + memset(&res1, 0, sizeof(res1)); + + strcpy(req1.ConfigurationToken, res.Configurations->Configuration.token); + + ret = onvif_tr2_GetOSDOptions(&p_dev->onvif_device, &req1, &res1); + + printf("onvif_tr2_GetOSDOptions return ret = %d\n", ret); + + onvif_free_VideoSourceConfigurations(&res.Configurations); + + break; + } + + while (1) + { + // GetVideoSourceConfigurations + tr2_GetVideoSourceConfigurations_REQ req; + tr2_GetVideoSourceConfigurations_RES res; + + memset(&req, 0, sizeof(req)); + memset(&res, 0, sizeof(res)); + + ret = onvif_tr2_GetVideoSourceConfigurations(&p_dev->onvif_device, &req, &res); + + printf("onvif_tr2_GetVideoSourceConfigurations return ret = %d\n", ret); + + if (!ret || NULL == res.Configurations) + { + break; + } + + // CreateOSD + tr2_CreateOSD_REQ req1; + tr2_CreateOSD_RES res1; + + memset(&req1, 0, sizeof(req1)); + memset(&res1, 0, sizeof(res1)); + + req1.OSD.Type = OSDType_Text; + strcpy(req1.OSD.VideoSourceConfigurationToken, res.Configurations->Configuration.token); + req1.OSD.Position.Type = OSDPosType_UpperRight; + req1.OSD.TextStringFlag = 1; + req1.OSD.TextString.Type = OSDTextType_Plain; + req1.OSD.TextString.PlainTextFlag = 1; + strcpy(req1.OSD.TextString.PlainText, "test"); + + ret = onvif_tr2_CreateOSD(&p_dev->onvif_device, &req1, &res1); + + printf("onvif_tr2_CreateOSD return ret = %d\n", ret); + + // GetOSDs + tr2_GetOSDs_REQ req2; + tr2_GetOSDs_RES res2; + + memset(&req2, 0, sizeof(req2)); + memset(&res2, 0, sizeof(res2)); + + ret = onvif_tr2_GetOSDs(&p_dev->onvif_device, &req2, &res2); + + printf("onvif_tr2_GetOSDs return ret = %d\n", ret); + + if (!ret || NULL == res2.OSDs) + { + onvif_free_VideoSourceConfigurations(&res.Configurations); + break; + } + + // SetOSD + tr2_SetOSD_REQ req3; + tr2_SetOSD_RES res3; + + memset(&req3, 0, sizeof(req3)); + memset(&res3, 0, sizeof(res3)); + + memcpy(&req3.OSD, &res2.OSDs->OSD, sizeof(onvif_OSDConfiguration)); + + ret = onvif_tr2_SetOSD(&p_dev->onvif_device, &req3, &res3); + + printf("onvif_tr2_SetOSD return ret = %d\n", ret); + + // DeleteOSD + tr2_DeleteOSD_REQ req4; + + memset(&req4, 0, sizeof(req4)); + + strcpy(req4.OSDToken, res1.OSDToken); + + ret = onvif_tr2_DeleteOSD(&p_dev->onvif_device, &req4, NULL); + + printf("onvif_tr2_DeleteOSD return ret = %d\n", ret); + + + onvif_free_OSDConfigurations(&res2.OSDs); + onvif_free_VideoSourceConfigurations(&res.Configurations); + + break; + } +} + +void onvifMedia2MaskTest(ONVIF_DEVICE_EX * p_dev) +{ + BOOL ret; + + // GetVideoSourceConfigurations + tr2_GetVideoSourceConfigurations_REQ req; + tr2_GetVideoSourceConfigurations_RES res; + + memset(&req, 0, sizeof(req)); + memset(&res, 0, sizeof(res)); + + ret = onvif_tr2_GetVideoSourceConfigurations(&p_dev->onvif_device, &req, &res); + + printf("onvif_tr2_GetVideoSourceConfigurations return ret = %d\n", ret); + + if (!ret || NULL == res.Configurations) + { + return; + } + + // CreateMask + tr2_CreateMask_REQ req1; + tr2_CreateMask_RES res1; + + memset(&req1, 0, sizeof(req1)); + memset(&res1, 0, sizeof(res1)); + + strcpy(req1.Mask.ConfigurationToken, res.Configurations->Configuration.token); + req1.Mask.Polygon.sizePoint = 5; + req1.Mask.Polygon.Point[0].x = 0; + req1.Mask.Polygon.Point[0].y = 0; + req1.Mask.Polygon.Point[1].x = 400; + req1.Mask.Polygon.Point[1].y = 0; + req1.Mask.Polygon.Point[2].x = 400; + req1.Mask.Polygon.Point[2].y = 400; + req1.Mask.Polygon.Point[3].x = 0; + req1.Mask.Polygon.Point[3].y = 400; + req1.Mask.Polygon.Point[4].x = 0; + req1.Mask.Polygon.Point[4].y = 0; + + strcpy(req1.Mask.Type, "Pixelated"); + req1.Mask.Enabled = TRUE; + + ret = onvif_tr2_CreateMask(&p_dev->onvif_device, &req1, &res1); + + printf("onvif_tr2_CreateMask return ret = %d\n", ret); + + // GetMasks + tr2_GetMasks_REQ req2; + tr2_GetMasks_RES res2; + + memset(&req2, 0, sizeof(req2)); + memset(&res2, 0, sizeof(res2)); + + ret = onvif_tr2_GetMasks(&p_dev->onvif_device, &req2, &res2); + + printf("onvif_tr2_GetMasks return ret = %d\n", ret); + + // GetMaskOptions + tr2_GetMaskOptions_REQ req3; + tr2_GetMaskOptions_RES res3; + + memset(&req3, 0, sizeof(req3)); + memset(&res3, 0, sizeof(res3)); + + strcpy(req3.ConfigurationToken, res.Configurations->Configuration.token); + + ret = onvif_tr2_GetMaskOptions(&p_dev->onvif_device, &req3, &res3); + + printf("onvif_tr2_GetMaskOptions return ret = %d\n", ret); + + // SetMask + tr2_SetMask_REQ req4; + tr2_SetMask_RES res4; + + memset(&req4, 0, sizeof(req4)); + memset(&res4, 0, sizeof(res4)); + + memcpy(&req4.Mask, &req1.Mask, sizeof(onvif_Mask)); + req4.Mask.Enabled = FALSE; + strcpy(req4.Mask.token, res1.Token); + + ret = onvif_tr2_SetMask(&p_dev->onvif_device, &req4, &res4); + + printf("onvif_tr2_SetMask return ret = %d\n", ret); + + // DeleteMask + tr2_DeleteMask_REQ req5; + tr2_DeleteMask_RES res5; + + memset(&req5, 0, sizeof(req5)); + memset(&res5, 0, sizeof(res5)); + + strcpy(req5.Token, res1.Token); + + ret = onvif_tr2_DeleteMask(&p_dev->onvif_device, &req5, &res5); + + printf("onvif_tr2_DeleteMask return ret = %d\n", ret); + + + // free resources + onvif_free_Masks(&res2.Masks); + onvif_free_VideoSourceConfigurations(&res.Configurations); +} + +void onvifAnalyticsTest(ONVIF_DEVICE_EX * p_dev) +{ + BOOL ret; + + // GetVideoAnalyticsConfigurations + + trt_GetVideoAnalyticsConfigurations_RES res; + + memset(&res, 0, sizeof(res)); + + ret = onvif_trt_GetVideoAnalyticsConfigurations(&p_dev->onvif_device, NULL, &res); + + printf("onvif_trt_GetVideoAnalyticsConfigurations return ret = %d\n", ret); + + if (NULL == res.Configurations) + { + return; + } + + while (1) + { + // GetSupportedAnalyticsModules + + tan_GetSupportedAnalyticsModules_REQ req1; + tan_GetSupportedAnalyticsModules_RES res1; + + memset(&req1, 0, sizeof(req1)); + memset(&res1, 0, sizeof(res1)); + + strcpy(req1.ConfigurationToken, res.Configurations->Configuration.token); + + ret = onvif_tan_GetSupportedAnalyticsModules(&p_dev->onvif_device, &req1, &res1); + + printf("onvif_tan_GetSupportedAnalyticsModules return ret = %d\n", ret); + + // GetAnalyticsModules + + tan_GetAnalyticsModules_REQ req2; + tan_GetAnalyticsModules_RES res2; + + memset(&req2, 0, sizeof(req2)); + memset(&res2, 0, sizeof(res2)); + + strcpy(req2.ConfigurationToken, res.Configurations->Configuration.token); + + ret = onvif_tan_GetAnalyticsModules(&p_dev->onvif_device, &req2, &res2); + + printf("onvif_tan_GetAnalyticsModules return ret = %d\n", ret); + + onvif_free_Configs(&res2.AnalyticsModule); + + // GetAnalyticsModuleOptions + + tan_GetAnalyticsModuleOptions_REQ req3; + tan_GetAnalyticsModuleOptions_RES res3; + + memset(&req3, 0, sizeof(req3)); + memset(&res3, 0, sizeof(res3)); + + strcpy(req3.ConfigurationToken, res.Configurations->Configuration.token); + + ret = onvif_tan_GetAnalyticsModuleOptions(&p_dev->onvif_device, &req3, &res3); + + printf("onvif_tan_GetAnalyticsModuleOptions return ret = %d\n", ret); + + onvif_free_AnalyticsModuleConfigOptions(&res3.Options); + + onvif_free_ConfigDescriptions(&res1.SupportedAnalyticsModules.AnalyticsModuleDescription); + + break; + } + + while (1) + { + // GetSupportedRules + + tan_GetSupportedRules_REQ req1; + tan_GetSupportedRules_RES res1; + + memset(&req1, 0, sizeof(req1)); + memset(&res1, 0, sizeof(res1)); + + strcpy(req1.ConfigurationToken, res.Configurations->Configuration.token); + + ret = onvif_tan_GetSupportedRules(&p_dev->onvif_device, &req1, &res1); + + printf("onvif_tan_GetSupportedRules return ret = %d\n", ret); + + // GetRules + + tan_GetRules_REQ req2; + tan_GetRules_RES res2; + + memset(&req2, 0, sizeof(req2)); + memset(&res2, 0, sizeof(res2)); + + strcpy(req2.ConfigurationToken, res.Configurations->Configuration.token); + + ret = onvif_tan_GetRules(&p_dev->onvif_device, &req2, &res2); + + printf("onvif_tan_GetRules return ret = %d\n", ret); + + onvif_free_Configs(&res2.Rule); + + // GetRuleOptions + + tan_GetRuleOptions_REQ req3; + tan_GetRuleOptions_RES res3; + + memset(&req3, 0, sizeof(req3)); + memset(&res3, 0, sizeof(res3)); + + strcpy(req3.ConfigurationToken, res.Configurations->Configuration.token); + + ret = onvif_tan_GetRuleOptions(&p_dev->onvif_device, &req3, &res3); + + printf("onvif_tan_GetRuleOptions return ret = %d\n", ret); + + onvif_free_ConfigOptions(&res3.RuleOptions); + + onvif_free_ConfigDescriptions(&res1.SupportedRules.RuleDescription); + + break; + } + + onvif_free_VideoAnalyticsConfigurations(&res.Configurations); + + // GetSupportedMetadata + + tan_GetSupportedMetadata_REQ req4; + tan_GetSupportedMetadata_RES res4; + + memset(&req4, 0, sizeof(req4)); + memset(&res4, 0, sizeof(res4)); + + ret = onvif_tan_GetSupportedMetadata(&p_dev->onvif_device, &req4, &res4); + + printf("onvif_tan_GetSupportedMetadata return ret = %d\n", ret); + + onvif_free_MetadataInfo(&res4.AnalyticsModule); +} + +#ifdef PROFILE_C_SUPPORT + +void onvifAccessControlTest(ONVIF_DEVICE_EX * p_dev) +{ + BOOL ret; + + while (1) + { + // GetAccessPointInfoList + tac_GetAccessPointInfoList_RES res; + + memset(&res, 0, sizeof(res)); + + ret = onvif_tac_GetAccessPointInfoList(&p_dev->onvif_device, NULL, &res); + + printf("onvif_tac_GetAccessPointInfoList return ret = %d\n", ret); + + if (!ret || !res.AccessPointInfo) + { + break; + } + + // GetAccessPointInfo + tac_GetAccessPointInfo_REQ req1; + tac_GetAccessPointInfo_RES res1; + + memset(&req1, 0, sizeof(req1)); + memset(&res1, 0, sizeof(res1)); + + strcpy(req1.token[0], res.AccessPointInfo->AccessPointInfo.token); + + ret = onvif_tac_GetAccessPointInfo(&p_dev->onvif_device, &req1, &res1); + + printf("onvif_tac_GetAccessPointInfo return ret = %d\n", ret); + + if (ret) + { + onvif_free_AccessPoints(&res1.AccessPointInfo); + } + + onvif_free_AccessPoints(&res.AccessPointInfo); + + break; + } + + while (1) + { + // GetAreaInfoList + tac_GetAreaInfoList_RES res; + + memset(&res, 0, sizeof(res)); + + ret = onvif_tac_GetAreaInfoList(&p_dev->onvif_device, NULL, &res); + + printf("onvif_tac_GetAreaInfoList return ret = %d\n", ret); + + if (!ret || !res.AreaInfo) + { + break; + } + + // GetAreaInfo + tac_GetAreaInfo_REQ req1; + tac_GetAreaInfo_RES res1; + + memset(&req1, 0, sizeof(req1)); + memset(&res1, 0, sizeof(res1)); + + strcpy(req1.token[0], res.AreaInfo->AreaInfo.token); + + ret = onvif_tac_GetAreaInfo(&p_dev->onvif_device, &req1, &res1); + + printf("onvif_tac_GetAreaInfo return ret = %d\n", ret); + + if (ret) + { + onvif_free_Areas(&res1.AreaInfo); + } + + onvif_free_Areas(&res.AreaInfo); + + break; + } + + while (1) + { + // GetAccessPointInfoList + tac_GetAccessPointInfoList_RES res; + + memset(&res, 0, sizeof(res)); + + ret = onvif_tac_GetAccessPointInfoList(&p_dev->onvif_device, NULL, &res); + + printf("onvif_tac_GetAccessPointInfoList return ret = %d\n", ret); + + if (!ret || !res.AccessPointInfo) + { + break; + } + + // GetAccessPointState + tac_GetAccessPointState_REQ req1; + tac_GetAccessPointState_RES res1; + + memset(&req1, 0, sizeof(req1)); + memset(&res1, 0, sizeof(res1)); + + strcpy(req1.Token, res.AccessPointInfo->AccessPointInfo.token); + + ret = onvif_tac_GetAccessPointState(&p_dev->onvif_device, &req1, &res1); + + printf("onvif_tac_GetAccessPointState return ret = %d\n", ret); + + // EnableAccessPoint + tac_EnableAccessPoint_REQ req2; + + memset(&req2, 0, sizeof(req2)); + + strcpy(req2.Token, res.AccessPointInfo->AccessPointInfo.token); + + ret = onvif_tac_EnableAccessPoint(&p_dev->onvif_device, &req2, NULL); + + printf("onvif_tac_EnableAccessPoint return ret = %d\n", ret); + + // GetAccessPointState + memset(&res1, 0, sizeof(res1)); + + ret = onvif_tac_GetAccessPointState(&p_dev->onvif_device, &req1, &res1); + + printf("onvif_tac_GetAccessPointState return ret = %d\n", ret); + + // DisableAccessPoint + tac_DisableAccessPoint_REQ req3; + + memset(&req3, 0, sizeof(req3)); + + strcpy(req3.Token, res.AccessPointInfo->AccessPointInfo.token); + + ret = onvif_tac_DisableAccessPoint(&p_dev->onvif_device, &req3, NULL); + + printf("onvif_tac_DisableAccessPoint return ret = %d\n", ret); + + // GetAccessPointState + memset(&res1, 0, sizeof(res1)); + + ret = onvif_tac_GetAccessPointState(&p_dev->onvif_device, &req1, &res1); + + printf("onvif_tac_GetAccessPointState return ret = %d\n", ret); + + onvif_free_AccessPoints(&res.AccessPointInfo); + + break; + } +} + +void onvifDoorControlTest(ONVIF_DEVICE_EX * p_dev) +{ + BOOL ret; + + while (1) + { + // GetDoorList + tdc_GetDoorList_RES res; + + memset(&res, 0, sizeof(res)); + + ret = onvif_tdc_GetDoorList(&p_dev->onvif_device, NULL, &res); + + printf("onvif_tdc_GetDoorList return ret = %d\n", ret); + + if (!ret || !res.Door) + { + break; + } + + // GetDoors + tdc_GetDoors_REQ req1; + tdc_GetDoors_RES res1; + + memset(&req1, 0, sizeof(req1)); + memset(&res1, 0, sizeof(res1)); + + strcpy(req1.token[0], res.Door->Door.DoorInfo.token); + + ret = onvif_tdc_GetDoors(&p_dev->onvif_device, &req1, &res1); + + printf("onvif_tdc_GetDoors return ret = %d\n", ret); + + if (ret) + { + onvif_free_Doors(&res1.Door); + } + + onvif_free_Doors(&res.Door); + + break; + } + + while (p_dev->onvif_device.Capabilities.doorcontrol.DoorManagementSupported) + { + // CreateDoor + tdc_CreateDoor_REQ req; + tdc_CreateDoor_RES res; + + memset(&req, 0, sizeof(req)); + memset(&res, 0, sizeof(res)); + + strcpy(req.Door.DoorInfo.Name, "testname"); + req.Door.DoorInfo.DescriptionFlag = 1; + strcpy(req.Door.DoorInfo.Description, "testdesc"); + req.Door.DoorInfo.Capabilities.Access = 1; + req.Door.DoorInfo.Capabilities.Lock = 1; + req.Door.DoorInfo.Capabilities.Unlock = 1; + req.Door.DoorInfo.Capabilities.Block = 1; + req.Door.DoorInfo.Capabilities.DoubleLock = 1; + + ret = onvif_tdc_CreateDoor(&p_dev->onvif_device, &req, &res); + + printf("onvif_tdc_CreateDoor return ret = %d\n", ret); + + // SetDoor + tdc_SetDoor_REQ req2; + memset(&req2, 0, sizeof(req2)); + + memcpy(&req2.Door, &req.Door, sizeof(onvif_Door)); + strcpy(req2.Door.DoorInfo.token, res.Token); + strcpy(req2.Door.DoorInfo.Name, "testname1"); + + ret = onvif_tdc_SetDoor(&p_dev->onvif_device, &req2, NULL); + + printf("onvif_tdc_SetDoor return ret = %d\n", ret); + + // ModifyDoor + tdc_ModifyDoor_REQ req3; + memset(&req3, 0, sizeof(req3)); + + memcpy(&req3.Door, &req.Door, sizeof(onvif_Door)); + strcpy(req3.Door.DoorInfo.token, res.Token); + strcpy(req3.Door.DoorInfo.Name, "testname2"); + + ret = onvif_tdc_ModifyDoor(&p_dev->onvif_device, &req3, NULL); + + printf("onvif_tdc_ModifyDoor return ret = %d\n", ret); + + // DeleteDoor + tdc_DeleteDoor_REQ req4; + memset(&req4, 0, sizeof(req4)); + + strcpy(req4.Token, res.Token); + + ret = onvif_tdc_DeleteDoor(&p_dev->onvif_device, &req4, NULL); + + printf("onvif_tdc_DeleteDoor return ret = %d\n", ret); + + break; + } + + while (1) + { + // GetDoorInfoList + tdc_GetDoorInfoList_RES res; + + memset(&res, 0, sizeof(res)); + + ret = onvif_tdc_GetDoorInfoList(&p_dev->onvif_device, NULL, &res); + + printf("onvif_tdc_GetDoorInfoList return ret = %d\n", ret); + + if (!ret || !res.DoorInfo) + { + break; + } + + // GetDoorInfo + tdc_GetDoorInfo_REQ req1; + tdc_GetDoorInfo_RES res1; + + memset(&req1, 0, sizeof(req1)); + memset(&res1, 0, sizeof(res1)); + + strcpy(req1.token[0], res.DoorInfo->DoorInfo.token); + + ret = onvif_tdc_GetDoorInfo(&p_dev->onvif_device, &req1, &res1); + + printf("onvif_tdc_GetDoorInfo return ret = %d\n", ret); + + if (ret) + { + onvif_free_DoorInfos(&res1.DoorInfo); + } + + onvif_free_DoorInfos(&res.DoorInfo); + + break; + } + + while (1) + { + // GetDoorInfoList + tdc_GetDoorInfoList_RES res; + + memset(&res, 0, sizeof(res)); + + ret = onvif_tdc_GetDoorInfoList(&p_dev->onvif_device, NULL, &res); + + printf("onvif_tdc_GetDoorInfoList return ret = %d\n", ret); + + if (!ret || !res.DoorInfo) + { + break; + } + + // GetDoorState + tdc_GetDoorState_REQ req1; + tdc_GetDoorState_RES res1; + + memset(&req1, 0, sizeof(req1)); + memset(&res1, 0, sizeof(res1)); + + strcpy(req1.Token, res.DoorInfo->DoorInfo.token); + + ret = onvif_tdc_GetDoorState(&p_dev->onvif_device, &req1, &res1); + + printf("onvif_tdc_GetDoorState return ret = %d\n", ret); + + onvif_free_DoorInfos(&res.DoorInfo); + + break; + } + + while (1) + { + // GetDoorInfoList + tdc_GetDoorInfoList_RES res; + + memset(&res, 0, sizeof(res)); + + ret = onvif_tdc_GetDoorInfoList(&p_dev->onvif_device, NULL, &res); + + printf("onvif_tdc_GetDoorInfoList return ret = %d\n", ret); + + if (!ret || !res.DoorInfo) + { + break; + } + + if (res.DoorInfo->DoorInfo.Capabilities.Access) + { + // AccessDoor + tdc_AccessDoor_REQ req; + + memset(&req, 0, sizeof(req)); + + strcpy(req.Token, res.DoorInfo->DoorInfo.token); + + ret = onvif_tdc_AccessDoor(&p_dev->onvif_device, &req, NULL); + + printf("onvif_tdc_AccessDoor return ret = %d\n", ret); + } + + if (res.DoorInfo->DoorInfo.Capabilities.Lock) + { + // LockDoor + tdc_LockDoor_REQ req; + + memset(&req, 0, sizeof(req)); + + strcpy(req.Token, res.DoorInfo->DoorInfo.token); + + ret = onvif_tdc_LockDoor(&p_dev->onvif_device, &req, NULL); + + printf("onvif_tdc_LockDoor return ret = %d\n", ret); + } + + if (res.DoorInfo->DoorInfo.Capabilities.Unlock) + { + // UnlockDoor + tdc_UnlockDoor_REQ req; + + memset(&req, 0, sizeof(req)); + + strcpy(req.Token, res.DoorInfo->DoorInfo.token); + + ret = onvif_tdc_UnlockDoor(&p_dev->onvif_device, &req, NULL); + + printf("onvif_tdc_UnlockDoor return ret = %d\n", ret); + } + + if (res.DoorInfo->DoorInfo.Capabilities.DoubleLock) + { + // DoubleLockDoor + tdc_DoubleLockDoor_REQ req; + + memset(&req, 0, sizeof(req)); + + strcpy(req.Token, res.DoorInfo->DoorInfo.token); + + ret = onvif_tdc_DoubleLockDoor(&p_dev->onvif_device, &req, NULL); + + printf("onvif_tdc_DoubleLockDoor return ret = %d\n", ret); + } + + if (res.DoorInfo->DoorInfo.Capabilities.Block) + { + // BlockDoor + tdc_BlockDoor_REQ req; + + memset(&req, 0, sizeof(req)); + + strcpy(req.Token, res.DoorInfo->DoorInfo.token); + + ret = onvif_tdc_BlockDoor(&p_dev->onvif_device, &req, NULL); + + printf("onvif_tdc_BlockDoor return ret = %d\n", ret); + } + + if (res.DoorInfo->DoorInfo.Capabilities.LockDown) + { + // LockDownDoor + tdc_LockDownDoor_REQ req; + + memset(&req, 0, sizeof(req)); + + strcpy(req.Token, res.DoorInfo->DoorInfo.token); + + ret = onvif_tdc_LockDownDoor(&p_dev->onvif_device, &req, NULL); + + printf("onvif_tdc_LockDownDoor return ret = %d\n", ret); + } + + if (res.DoorInfo->DoorInfo.Capabilities.LockDown) + { + // LockDownReleaseDoor + tdc_LockDownReleaseDoor_REQ req; + + memset(&req, 0, sizeof(req)); + + strcpy(req.Token, res.DoorInfo->DoorInfo.token); + + ret = onvif_tdc_LockDownReleaseDoor(&p_dev->onvif_device, &req, NULL); + + printf("onvif_tdc_LockDownReleaseDoor return ret = %d\n", ret); + } + + if (res.DoorInfo->DoorInfo.Capabilities.LockOpen) + { + // LockOpenDoor + tdc_LockOpenDoor_REQ req; + + memset(&req, 0, sizeof(req)); + + strcpy(req.Token, res.DoorInfo->DoorInfo.token); + + ret = onvif_tdc_LockOpenDoor(&p_dev->onvif_device, &req, NULL); + + printf("onvif_tdc_LockOpenDoor return ret = %d\n", ret); + } + + if (res.DoorInfo->DoorInfo.Capabilities.LockOpen) + { + // LockOpenReleaseDoor + tdc_LockOpenReleaseDoor_REQ req; + + memset(&req, 0, sizeof(req)); + + strcpy(req.Token, res.DoorInfo->DoorInfo.token); + + ret = onvif_tdc_LockOpenReleaseDoor(&p_dev->onvif_device, &req, NULL); + + printf("onvif_tdc_LockOpenReleaseDoor return ret = %d\n", ret); + } + + onvif_free_DoorInfos(&res.DoorInfo); + + break; + } +} + +#endif // end of PROFILE_C_SUPPORT + +#ifdef PROFILE_G_SUPPORT + +void onvifRecordingTest(ONVIF_DEVICE_EX * p_dev) +{ + BOOL ret; + + while (p_dev->onvif_device.Capabilities.recording.DynamicRecordings) + { + // CreateRecording + trc_CreateRecording_REQ req; + trc_CreateRecording_RES res; + + memset(&req, 0, sizeof(req)); + memset(&res, 0, sizeof(res)); + + strcpy(req.RecordingConfiguration.Source.SourceId, "test"); + strcpy(req.RecordingConfiguration.Source.Name, "test"); + strcpy(req.RecordingConfiguration.Source.Location, "test"); + strcpy(req.RecordingConfiguration.Source.Description, "test"); + strcpy(req.RecordingConfiguration.Source.Address, "test"); + strcpy(req.RecordingConfiguration.Content, "test"); + + ret = onvif_trc_CreateRecording(&p_dev->onvif_device, &req, &res); + + printf("onvif_trc_CreateRecording return ret = %d\n", ret); + + if (!ret) + { + break; + } + + // GetRecordings + trc_GetRecordings_RES res1; + memset(&res1, 0, sizeof(res1)); + + ret = onvif_trc_GetRecordings(&p_dev->onvif_device, NULL, &res1); + + printf("onvif_trc_GetRecordings return ret = %d\n", ret); + + if (!ret || NULL == res1.Recordings) + { + break; + } + + // SetRecordingConfiguration + trc_SetRecordingConfiguration_REQ req2; + memset(&req2, 0, sizeof(req2)); + + strcpy(req2.RecordingToken, res.RecordingToken); + memcpy(&req2.RecordingConfiguration, &res1.Recordings->Recording.Configuration, sizeof(onvif_RecordingConfiguration)); + + ret = onvif_trc_SetRecordingConfiguration(&p_dev->onvif_device, &req2, NULL); + + printf("onvif_trc_SetRecordingConfiguration return ret = %d\n", ret); + + // GetRecordingConfiguration + trc_GetRecordingConfiguration_REQ req3; + trc_GetRecordingConfiguration_RES res3; + + memset(&req3, 0, sizeof(req3)); + memset(&res3, 0, sizeof(res3)); + + strcpy(req3.RecordingToken, res.RecordingToken); + + ret = onvif_trc_GetRecordingConfiguration(&p_dev->onvif_device, &req3, &res3); + + printf("onvif_trc_GetRecordingConfiguration return ret = %d\n", ret); + + // GetRecordingOptions + trc_GetRecordingOptions_REQ req4; + trc_GetRecordingOptions_RES res4; + + memset(&req4, 0, sizeof(req4)); + memset(&res4, 0, sizeof(res4)); + + strcpy(req4.RecordingToken, res.RecordingToken); + + ret = onvif_trc_GetRecordingOptions(&p_dev->onvif_device, &req4, &res4); + + printf("onvif_trc_GetRecordingOptions return ret = %d\n", ret); + + // CreateTrack + trc_CreateTrack_REQ req5; + trc_CreateTrack_RES res5; + + memset(&req5, 0, sizeof(req5)); + memset(&res5, 0, sizeof(res5)); + + strcpy(req5.RecordingToken, res.RecordingToken); + req5.TrackConfiguration.TrackType = TrackType_Video; + strcpy(req5.TrackConfiguration.Description, "trackdesc"); + + ret = onvif_trc_CreateTrack(&p_dev->onvif_device, &req5, &res5); + + printf("onvif_trc_CreateTrack return ret = %d\n", ret); + + if (ret) + { + // GetTrackConfiguration + trc_GetTrackConfiguration_REQ req6; + trc_GetTrackConfiguration_RES res6; + + memset(&req6, 0, sizeof(req6)); + memset(&res6, 0, sizeof(res6)); + + strcpy(req6.RecordingToken, res.RecordingToken); + strcpy(req6.TrackToken, res5.TrackToken); + + ret = onvif_trc_GetTrackConfiguration(&p_dev->onvif_device, &req6, &res6); + + printf("onvif_trc_GetTrackConfiguration return ret = %d\n", ret); + + // SetTrackConfiguration + trc_SetTrackConfiguration_REQ req7; + + memset(&req7, 0, sizeof(req7)); + + strcpy(req7.RecordingToken, res.RecordingToken); + strcpy(req7.TrackToken, res5.TrackToken); + memcpy(&req7.TrackConfiguration, &res6.TrackConfiguration, sizeof(onvif_TrackConfiguration)); + + ret = onvif_trc_SetTrackConfiguration(&p_dev->onvif_device, &req7, NULL); + + printf("onvif_trc_SetTrackConfiguration return ret = %d\n", ret); + + // DeleteTrack + trc_DeleteTrack_REQ req8; + + memset(&req8, 0, sizeof(req8)); + + strcpy(req8.RecordingToken, res.RecordingToken); + strcpy(req8.TrackToken, res5.TrackToken); + + ret = onvif_trc_DeleteTrack(&p_dev->onvif_device, &req8, NULL); + + printf("onvif_trc_DeleteTrack return ret = %d\n", ret); + } + + // CreateRecordingJob + trc_CreateRecordingJob_REQ req9; + trc_CreateRecordingJob_RES res9; + + memset(&req9, 0, sizeof(req9)); + memset(&res9, 0, sizeof(res9)); + + strcpy(req9.JobConfiguration.RecordingToken, res.RecordingToken); + strcpy(req9.JobConfiguration.Mode, "Idle"); + req9.JobConfiguration.Priority = 1; + + ret = onvif_trc_CreateRecordingJob(&p_dev->onvif_device, &req9, &res9); + + printf("onvif_trc_CreateRecordingJob return ret = %d\n", ret); + + // GetRecordingJobs + trc_GetRecordingJobs_RES res10; + + memset(&res10, 0, sizeof(res10)); + + ret = onvif_trc_GetRecordingJobs(&p_dev->onvif_device, NULL, &res10); + + printf("onvif_trc_GetRecordingJobs return ret = %d\n", ret); + + if (ret && res10.RecordingJobs) + { + onvif_free_RecordingJobs(&res10.RecordingJobs); + } + + // GetRecordingJobConfiguration + trc_GetRecordingJobConfiguration_REQ req11; + trc_GetRecordingJobConfiguration_RES res11; + + memset(&req11, 0, sizeof(req11)); + memset(&res11, 0, sizeof(res11)); + + strcpy(req11.JobToken, res9.JobToken); + + ret = onvif_trc_GetRecordingJobConfiguration(&p_dev->onvif_device, &req11, &res11); + + printf("onvif_trc_GetRecordingJobConfiguration return ret = %d\n", ret); + + // SetRecordingJobConfiguration + trc_SetRecordingJobConfiguration_REQ req12; + trc_SetRecordingJobConfiguration_RES res12; + + memset(&req12, 0, sizeof(req12)); + memset(&res12, 0, sizeof(res12)); + + strcpy(req12.JobToken, res9.JobToken); + memcpy(&req12.JobConfiguration, &res11.JobConfiguration, sizeof(onvif_RecordingJobConfiguration)); + + ret = onvif_trc_SetRecordingJobConfiguration(&p_dev->onvif_device, &req12, &res12); + + printf("onvif_trc_SetRecordingJobConfiguration return ret = %d\n", ret); + + // SetRecordingJobMode + trc_SetRecordingJobMode_REQ req13; + + memset(&req13, 0, sizeof(req13)); + + strcpy(req13.JobToken, res9.JobToken); + strcpy(req13.Mode, "Active"); + + ret = onvif_trc_SetRecordingJobMode(&p_dev->onvif_device, &req13, NULL); + + printf("onvif_trc_SetRecordingJobMode return ret = %d\n", ret); + + // GetRecordingJobState + trc_GetRecordingJobState_REQ req14; + trc_GetRecordingJobState_RES res14; + + memset(&req14, 0, sizeof(req14)); + memset(&res14, 0, sizeof(res14)); + + strcpy(req14.JobToken, res9.JobToken); + + ret = onvif_trc_GetRecordingJobState(&p_dev->onvif_device, &req14, &res14); + + printf("onvif_trc_GetRecordingJobState return ret = %d\n", ret); + + // SetRecordingJobMode + trc_SetRecordingJobMode_REQ req15; + + memset(&req15, 0, sizeof(req15)); + + strcpy(req15.JobToken, res9.JobToken); + strcpy(req15.Mode, "Idle"); + + ret = onvif_trc_SetRecordingJobMode(&p_dev->onvif_device, &req15, NULL); + + printf("onvif_trc_SetRecordingJobMode return ret = %d\n", ret); + + // DeleteRecordingJob + trc_DeleteRecordingJob_REQ req16; + + memset(&req16, 0, sizeof(req16)); + + strcpy(req16.JobToken, res9.JobToken); + + ret = onvif_trc_DeleteRecordingJob(&p_dev->onvif_device, &req16, NULL); + + printf("onvif_trc_DeleteRecordingJob return ret = %d\n", ret); + + // DeleteRecording + trc_DeleteRecording_REQ req17; + + memset(&req17, 0, sizeof(req17)); + + strcpy(req17.RecordingToken, res.RecordingToken); + + ret = onvif_trc_DeleteRecording(&p_dev->onvif_device, &req17, NULL); + + printf("onvif_trc_DeleteRecording return ret = %d\n", ret); + + onvif_free_Recordings(&res1.Recordings); + + break; + } +} + +void onvifSearchTest(ONVIF_DEVICE_EX * p_dev) +{ + BOOL ret; + + tse_GetRecordingSummary_RES res; + memset(&res, 0, sizeof(res)); + + ret = onvif_tse_GetRecordingSummary(&p_dev->onvif_device, NULL, &res); + + printf("onvif_tse_GetRecordingSummary return ret = %d\n", ret); + + while (1) + { + tse_FindRecordings_REQ req1; + tse_FindRecordings_RES res1; + + memset(&req1, 0, sizeof(req1)); + memset(&res1, 0, sizeof(res1)); + + req1.KeepAliveTime = 10; + req1.MaxMatchesFlag = 1; + req1.MaxMatches = 1; + + ret = onvif_tse_FindRecordings(&p_dev->onvif_device, &req1, &res1); + + printf("onvif_tse_FindRecordings return ret = %d\n", ret); + + if (ret) + { + sleep(3); + + tse_GetRecordingSearchResults_REQ req2; + tse_GetRecordingSearchResults_RES res2; + + memset(&req2, 0, sizeof(req2)); + memset(&res2, 0, sizeof(res2)); + + strcpy(req2.SearchToken, res1.SearchToken); + + ret = onvif_tse_GetRecordingSearchResults(&p_dev->onvif_device, &req2, &res2); + + printf("onvif_tse_GetRecordingSearchResults return ret = %d\n", ret); + + onvif_free_RecordingInformations(&res2.ResultList.RecordInformation); + + tse_EndSearch_REQ req3; + tse_EndSearch_RES res3; + + memset(&req3, 0, sizeof(req3)); + memset(&res3, 0, sizeof(res3)); + + strcpy(req3.SearchToken, res1.SearchToken); + + ret = onvif_tse_EndSearch(&p_dev->onvif_device, &req3, &res3); + + printf("onvif_tse_EndSearch return ret = %d\n", ret); + } + + break; + } + + while (1) + { + tse_FindEvents_REQ req1; + tse_FindEvents_RES res1; + + memset(&req1, 0, sizeof(req1)); + memset(&res1, 0, sizeof(res1)); + + req1.KeepAliveTime = 10; + req1.MaxMatchesFlag = 1; + req1.MaxMatches = 1; + + ret = onvif_tse_FindEvents(&p_dev->onvif_device, &req1, &res1); + + printf("onvif_tse_FindEvents return ret = %d\n", ret); + + if (ret) + { + sleep(3); + + tse_GetEventSearchResults_REQ req2; + tse_GetEventSearchResults_RES res2; + + memset(&req2, 0, sizeof(req2)); + memset(&res2, 0, sizeof(res2)); + + strcpy(req2.SearchToken, res1.SearchToken); + + ret = onvif_tse_GetEventSearchResults(&p_dev->onvif_device, &req2, &res2); + + printf("onvif_tse_GetEventSearchResults return ret = %d\n", ret); + + onvif_free_FindEventResults(&res2.ResultList.Result); + + tse_EndSearch_REQ req3; + tse_EndSearch_RES res3; + + memset(&req3, 0, sizeof(req3)); + memset(&res3, 0, sizeof(res3)); + + strcpy(req3.SearchToken, res1.SearchToken); + + ret = onvif_tse_EndSearch(&p_dev->onvif_device, &req3, &res3); + + printf("onvif_tse_EndSearch return ret = %d\n", ret); + } + + break; + } + + while (1) + { + tse_FindMetadata_REQ req1; + tse_FindMetadata_RES res1; + + memset(&req1, 0, sizeof(req1)); + memset(&res1, 0, sizeof(res1)); + + req1.KeepAliveTime = 10; + req1.MaxMatchesFlag = 1; + req1.MaxMatches = 1; + + ret = onvif_tse_FindMetadata(&p_dev->onvif_device, &req1, &res1); + + printf("onvif_tse_FindMetadata return ret = %d\n", ret); + + if (ret) + { + sleep(3); + + tse_GetMetadataSearchResults_REQ req2; + tse_GetMetadataSearchResults_RES res2; + + memset(&req2, 0, sizeof(req2)); + memset(&res2, 0, sizeof(res2)); + + strcpy(req2.SearchToken, res1.SearchToken); + + ret = onvif_tse_GetMetadataSearchResults(&p_dev->onvif_device, &req2, &res2); + + printf("onvif_tse_GetMetadataSearchResults return ret = %d\n", ret); + + onvif_free_FindMetadataResults(&res2.ResultList.Result); + + tse_EndSearch_REQ req3; + tse_EndSearch_RES res3; + + memset(&req3, 0, sizeof(req3)); + memset(&res3, 0, sizeof(res3)); + + strcpy(req3.SearchToken, res1.SearchToken); + + ret = onvif_tse_EndSearch(&p_dev->onvif_device, &req3, &res3); + + printf("onvif_tse_EndSearch return ret = %d\n", ret); + } + + break; + } + + while (1) + { + tse_FindPTZPosition_REQ req1; + tse_FindPTZPosition_RES res1; + + memset(&req1, 0, sizeof(req1)); + memset(&res1, 0, sizeof(res1)); + + req1.KeepAliveTime = 10; + req1.MaxMatchesFlag = 1; + req1.MaxMatches = 1; + + ret = onvif_tse_FindPTZPosition(&p_dev->onvif_device, &req1, &res1); + + printf("onvif_tse_FindPTZPosition return ret = %d\n", ret); + + if (ret) + { + sleep(3); + + tse_GetPTZPositionSearchResults_REQ req2; + tse_GetPTZPositionSearchResults_RES res2; + + memset(&req2, 0, sizeof(req2)); + memset(&res2, 0, sizeof(res2)); + + strcpy(req2.SearchToken, res1.SearchToken); + + ret = onvif_tse_GetPTZPositionSearchResults(&p_dev->onvif_device, &req2, &res2); + + printf("onvif_tse_GetPTZPositionSearchResults return ret = %d\n", ret); + + onvif_free_FindPTZPositionResults(&res2.ResultList.Result); + + tse_EndSearch_REQ req3; + tse_EndSearch_RES res3; + + memset(&req3, 0, sizeof(req3)); + memset(&res3, 0, sizeof(res3)); + + strcpy(req3.SearchToken, res1.SearchToken); + + ret = onvif_tse_EndSearch(&p_dev->onvif_device, &req3, &res3); + + printf("onvif_tse_EndSearch return ret = %d\n", ret); + } + + break; + } +} + +void onvifReplayTest(ONVIF_DEVICE_EX * p_dev) +{ + BOOL ret; + + // GetReplayConfiguration + trp_GetReplayConfiguration_RES res; + memset(&res, 0, sizeof(res)); + + ret = onvif_trp_GetReplayConfiguration(&p_dev->onvif_device, NULL, &res); + + printf("onvif_trp_GetReplayConfiguration return ret = %d\n", ret); + + // SetReplayConfiguration + trp_SetReplayConfiguration_REQ req2; + memset(&req2, 0, sizeof(req2)); + + req2.Configuration.SessionTimeout = 120; + + ret = onvif_trp_SetReplayConfiguration(&p_dev->onvif_device, &req2, NULL); + + printf("onvif_trp_SetReplayConfiguration return ret = %d\n", ret); + + // GetRecordings + trc_GetRecordings_RES res3; + memset(&res3, 0, sizeof(res3)); + + ret = onvif_trc_GetRecordings(&p_dev->onvif_device, NULL, &res3); + + printf("onvif_trc_GetRecordings return ret = %d\n", ret); + + if (res3.Recordings) + { + trp_GetReplayUri_REQ req4; + trp_GetReplayUri_RES res4; + + memset(&req4, 0, sizeof(req4)); + memset(&res4, 0, sizeof(res4)); + + strcpy(req4.RecordingToken, res3.Recordings->Recording.RecordingToken); + req4.StreamSetup.Stream = StreamType_RTP_Unicast; + req4.StreamSetup.Transport.Protocol = TransportProtocol_UDP; + + ret = onvif_trp_GetReplayUri(&p_dev->onvif_device, &req4, &res4); + + printf("onvif_trp_GetReplayUri return ret = %d\n", ret); + if (ret) + { + printf("replay uri : %s\n", res4.Uri); + } + + onvif_free_Recordings(&res3.Recordings); + } + + // SetReplayConfiguration + trp_SetReplayConfiguration_REQ req5; + memset(&req5, 0, sizeof(req5)); + + req2.Configuration.SessionTimeout = res.Configuration.SessionTimeout; + + ret = onvif_trp_SetReplayConfiguration(&p_dev->onvif_device, &req5, NULL); + + printf("onvif_trp_SetReplayConfiguration return ret = %d\n", ret); + +} + +#endif // end of PROFILE_G_SUPPORT + +#ifdef THERMAL_SUPPORT + +void onvifThermalTest(ONVIF_DEVICE_EX * p_dev) +{ + BOOL ret; + + // GetConfigurations + tth_GetConfigurations_RES res; + memset(&res, 0, sizeof(res)); + + ret = onvif_tth_GetConfigurations(&p_dev->onvif_device, NULL, &res); + + printf("onvif_tth_GetConfigurations return ret = %d\n", ret); + + if (res.Configurations) + { + // GetConfiguration + tth_GetConfiguration_REQ req1; + tth_GetConfiguration_RES res1; + + memset(&req1, 0, sizeof(req1)); + memset(&res1, 0, sizeof(res1)); + + strcpy(req1.VideoSourceToken, res.Configurations->token); + + ret = onvif_tth_GetConfiguration(&p_dev->onvif_device, &req1, &res1); + + printf("onvif_tth_GetConfiguration return ret = %d\n", ret); + + // GetConfigurationOptions + tth_GetConfigurationOptions_REQ req2; + tth_GetConfigurationOptions_RES res2; + + memset(&req2, 0, sizeof(req2)); + memset(&res2, 0, sizeof(res2)); + + strcpy(req2.VideoSourceToken, res.Configurations->token); + + ret = onvif_tth_GetConfigurationOptions(&p_dev->onvif_device, &req2, &res2); + + printf("onvif_tth_GetConfigurationOptions return ret = %d\n", ret); + + if (res2.Options.ColorPalette) + { + onvif_free_ColorPalettes(&res2.Options.ColorPalette); + } + + if (res2.Options.NUCTable) + { + onvif_free_NUCTables(&res2.Options.NUCTable); + } + + // SetConfiguration + tth_SetConfiguration_REQ req3; + memset(&req3, 0, sizeof(req3)); + + strcpy(req3.VideoSourceToken, res.Configurations->token); + memcpy(&req3.Configuration, &res.Configurations->Configuration, sizeof(onvif_ThermalConfiguration)); + + ret = onvif_tth_SetConfiguration(&p_dev->onvif_device, &req3, NULL); + + printf("onvif_tth_SetConfiguration return ret = %d\n", ret); + + // GetRadiometryConfiguration + tth_GetRadiometryConfiguration_REQ req4; + tth_GetRadiometryConfiguration_RES res4; + + memset(&req4, 0, sizeof(req4)); + memset(&res4, 0, sizeof(res4)); + + strcpy(req4.VideoSourceToken, res.Configurations->token); + + ret = onvif_tth_GetRadiometryConfiguration(&p_dev->onvif_device, &req4, &res4); + + printf("onvif_tth_GetRadiometryConfiguration return ret = %d\n", ret); + + if (ret) + { + // onvif_tth_SetRadiometryConfiguration + tth_SetRadiometryConfiguration_REQ req5; + memset(&req5, 0, sizeof(req5)); + + strcpy(req5.VideoSourceToken, res.Configurations->token); + memcpy(&req5.Configuration, &res4.Configuration, sizeof(onvif_RadiometryConfiguration)); + + ret = onvif_tth_SetRadiometryConfiguration(&p_dev->onvif_device, &req5, NULL); + + printf("onvif_tth_SetRadiometryConfiguration return ret = %d\n", ret); + } + + // GetRadiometryConfigurationOptions + tth_GetRadiometryConfigurationOptions_REQ req6; + tth_GetRadiometryConfigurationOptions_RES res6; + + memset(&req6, 0, sizeof(req6)); + memset(&res6, 0, sizeof(res6)); + + strcpy(req6.VideoSourceToken, res.Configurations->token); + + ret = onvif_tth_GetRadiometryConfigurationOptions(&p_dev->onvif_device, &req6, &res6); + + printf("onvif_tth_GetRadiometryConfigurationOptions return ret = %d\n", ret); + + + onvif_free_ThermalConfigurations(&res.Configurations); + } + +} + +#endif // end of THERMAL_SUPPORT + +#ifdef CREDENTIAL_SUPPORT + +void onvifCredentialTest(ONVIF_DEVICE_EX * p_device) +{ + uint32 i; + BOOL ret; + + // GetCredentialList + tcr_GetCredentialList_REQ req; + tcr_GetCredentialList_RES res; + + memset(&req, 0, sizeof(req)); + memset(&res, 0, sizeof(res)); + + ret = onvif_tcr_GetCredentialList(&p_device->onvif_device, &req, &res); + + printf("onvif_tcr_GetCredentialList return ret = %d\n", ret); + + if (!ret) + { + return; + } + + // GetCredentials + tcr_GetCredentials_REQ req1; + tcr_GetCredentials_RES res1; + + memset(&req1, 0, sizeof(req1)); + memset(&res1, 0, sizeof(res1)); + + for (i = 0; i < res.sizeCredential; i++) + { + req1.sizeToken++; + strcpy(req1.Token[i], res.Credential[i].token); + } + + ret = onvif_tcr_GetCredentials(&p_device->onvif_device, &req1, &res1); + + printf("onvif_tcr_GetCredentials return ret = %d\n", ret); + + // GetCredentialInfo + tcr_GetCredentialInfo_REQ req2; + tcr_GetCredentialInfo_RES res2; + + memset(&req2, 0, sizeof(req2)); + memset(&res2, 0, sizeof(res2)); + + for (i = 0; i < res.sizeCredential; i++) + { + req2.sizeToken++; + strcpy(req2.Token[i], res.Credential[i].token); + } + + ret = onvif_tcr_GetCredentialInfo(&p_device->onvif_device, &req2, &res2); + + printf("onvif_tcr_GetCredentialInfo return ret = %d\n", ret); + + // GetCredentialInfoList + tcr_GetCredentialInfoList_REQ req3; + tcr_GetCredentialInfoList_RES res3; + + memset(&req3, 0, sizeof(req3)); + memset(&res3, 0, sizeof(res3)); + + ret = onvif_tcr_GetCredentialInfoList(&p_device->onvif_device, &req3, &res3); + + printf("onvif_tcr_GetCredentialInfoList return ret = %d\n", ret); + + if (res.sizeCredential > 0) + { + // GetCredentialState + tcr_GetCredentialState_REQ req4; + tcr_GetCredentialState_RES res4; + + memset(&req4, 0, sizeof(req4)); + memset(&res4, 0, sizeof(res4)); + + strcpy(req4.Token, res.Credential[0].token); + + ret = onvif_tcr_GetCredentialState(&p_device->onvif_device, &req4, &res4); + + printf("onvif_tcr_GetCredentialState return ret = %d\n", ret); + + // EnableCredential + tcr_EnableCredential_REQ req5; + + memset(&req5, 0, sizeof(req5)); + + strcpy(req5.Token, res.Credential[0].token); + + ret = onvif_tcr_EnableCredential(&p_device->onvif_device, &req5, NULL); + + printf("onvif_tcr_EnableCredential return ret = %d\n", ret); + + // DisableCredential + tcr_DisableCredential_REQ req6; + + memset(&req6, 0, sizeof(req6)); + + strcpy(req6.Token, res.Credential[0].token); + + ret = onvif_tcr_DisableCredential(&p_device->onvif_device, &req6, NULL); + + printf("onvif_tcr_DisableCredential return ret = %d\n", ret); + + // ResetAntipassbackViolation + tcr_ResetAntipassbackViolation_REQ req7; + + memset(&req7, 0, sizeof(req7)); + + strcpy(req7.CredentialToken, res.Credential[0].token); + + ret = onvif_tcr_ResetAntipassbackViolation(&p_device->onvif_device, &req7, NULL); + + printf("onvif_tcr_ResetAntipassbackViolation return ret = %d\n", ret); + + // CreateCredential + tcr_CreateCredential_REQ req8; + tcr_CreateCredential_RES res8; + + memset(&req8, 0, sizeof(req8)); + memset(&res8, 0, sizeof(res8)); + + memcpy(&req8.Credential, &res.Credential[0], sizeof(onvif_Credential)); + memcpy(&req8.State, &res4.State, sizeof(onvif_CredentialState)); + + strcpy(req8.Credential.token, ""); + strcpy(req8.Credential.Description, "test"); + + ret = onvif_tcr_CreateCredential(&p_device->onvif_device, &req8, &res8); + + printf("onvif_tcr_CreateCredential return ret = %d\n", ret); + + // ModifyCredential + tcr_ModifyCredential_REQ req9; + memset(&req9, 0, sizeof(req9)); + + strcpy(req9.Credential.token, res8.Token); + strcpy(req9.Credential.Description, "test11"); + + ret = onvif_tcr_ModifyCredential(&p_device->onvif_device, &req9, NULL); + + printf("onvif_tcr_ModifyCredential return ret = %d\n", ret); + + // DeleteCredential + tcr_DeleteCredential_REQ req10; + memset(&req10, 0, sizeof(req10)); + + strcpy(req10.Token, res8.Token); + + ret = onvif_tcr_DeleteCredential(&p_device->onvif_device, &req10, NULL); + + printf("onvif_tcr_DeleteCredential return ret = %d\n", ret); + + // GetSupportedFormatTypes + tcr_GetSupportedFormatTypes_REQ req11; + tcr_GetSupportedFormatTypes_RES res11; + + memset(&req11, 0, sizeof(req11)); + memset(&res11, 0, sizeof(res11)); + + strcpy(req11.CredentialIdentifierTypeName, "pt:Card"); + + ret = onvif_tcr_GetSupportedFormatTypes(&p_device->onvif_device, &req11, &res11); + + printf("onvif_tcr_GetSupportedFormatTypes return ret = %d\n", ret); + + // GetCredentialIdentifiers + tcr_GetCredentialIdentifiers_REQ req12; + tcr_GetCredentialIdentifiers_RES res12; + + memset(&req12, 0, sizeof(req12)); + memset(&res12, 0, sizeof(res12)); + + strcpy(req12.CredentialToken, res.Credential[0].token); + + ret = onvif_tcr_GetCredentialIdentifiers(&p_device->onvif_device, &req12, &res12); + + printf("onvif_tcr_GetCredentialIdentifiers return ret = %d\n", ret); + + // GetCredentialAccessProfiles + tcr_GetCredentialAccessProfiles_REQ req13; + tcr_GetCredentialAccessProfiles_RES res13; + + memset(&req13, 0, sizeof(req13)); + memset(&res13, 0, sizeof(res13)); + + strcpy(req13.CredentialToken, res.Credential[0].token); + + ret = onvif_tcr_GetCredentialAccessProfiles(&p_device->onvif_device, &req13, &res13); + + printf("onvif_tcr_GetCredentialAccessProfiles return ret = %d\n", ret); + } +} + +#endif // end of CREDENTIAL_SUPPORT + +#ifdef ACCESS_RULES + +void onvifAccessRulesTest(ONVIF_DEVICE_EX * p_device) +{ + uint32 i; + BOOL ret; + + // GetAccessProfileList + tar_GetAccessProfileList_REQ req; + tar_GetAccessProfileList_RES res; + + memset(&req, 0, sizeof(req)); + memset(&res, 0, sizeof(res)); + + ret = onvif_tar_GetAccessProfileList(&p_device->onvif_device, &req, &res); + + printf("onvif_tar_GetAccessProfileList return ret = %d\n", ret); + + if (!ret) + { + return; + } + + // GetAccessProfiles + tar_GetAccessProfiles_REQ req1; + tar_GetAccessProfiles_RES res1; + + memset(&req1, 0, sizeof(req1)); + memset(&res1, 0, sizeof(res1)); + + for (i = 0; i < res.sizeAccessProfile; i++) + { + req1.sizeToken++; + strcpy(req1.Token[i], res.AccessProfile[i].token); + } + + ret = onvif_tar_GetAccessProfiles(&p_device->onvif_device, &req1, &res1); + + printf("onvif_tar_GetAccessProfiles return ret = %d\n", ret); + + // GetAccessProfileInfoList + tar_GetAccessProfileInfoList_REQ req2; + tar_GetAccessProfileInfoList_RES res2; + + memset(&req2, 0, sizeof(req2)); + memset(&res2, 0, sizeof(res2)); + + ret = onvif_tar_GetAccessProfileInfoList(&p_device->onvif_device, &req2, &res2); + + printf("onvif_tar_GetAccessProfileInfoList return ret = %d\n", ret); + + // GetAccessProfileInfo + tar_GetAccessProfileInfo_REQ req3; + tar_GetAccessProfileInfo_RES res3; + + memset(&req3, 0, sizeof(req3)); + memset(&res3, 0, sizeof(res3)); + + for (i = 0; i < res.sizeAccessProfile; i++) + { + req1.sizeToken++; + strcpy(req3.Token[i], res.AccessProfile[i].token); + } + + ret = onvif_tar_GetAccessProfileInfo(&p_device->onvif_device, &req3, &res3); + + printf("onvif_tar_GetAccessProfileInfo return ret = %d\n", ret); + + if (res.sizeAccessProfile > 0) + { + // CreateAccessProfile + tar_CreateAccessProfile_REQ req4; + tar_CreateAccessProfile_RES res4; + + memset(&req4, 0, sizeof(req4)); + memset(&res4, 0, sizeof(res4)); + + memcpy(&req4.AccessProfile, &res.AccessProfile[0], sizeof(onvif_AccessProfile)); + strcpy(req4.AccessProfile.token, ""); + strcpy(req4.AccessProfile.Name, "test"); + strcpy(req4.AccessProfile.Description, "test"); + + ret = onvif_tar_CreateAccessProfile(&p_device->onvif_device, &req4, &res4); + + printf("onvif_tar_CreateAccessProfile return ret = %d\n", ret); + + // ModifyAccessProfile + tar_ModifyAccessProfile_REQ req5; + + memset(&req5, 0, sizeof(req5)); + + memcpy(&req5.AccessProfile, &res.AccessProfile[0], sizeof(onvif_AccessProfile)); + strcpy(req5.AccessProfile.token, res4.Token); + strcpy(req5.AccessProfile.Name, "test11"); + strcpy(req5.AccessProfile.Description, "test11"); + + ret = onvif_tar_ModifyAccessProfile(&p_device->onvif_device, &req5, NULL); + + printf("onvif_tar_ModifyAccessProfile return ret = %d\n", ret); + + // DeleteAccessProfile + tar_DeleteAccessProfile_REQ req6; + + memset(&req6, 0, sizeof(req6)); + + strcpy(req6.Token, res4.Token); + + ret = onvif_tar_DeleteAccessProfile(&p_device->onvif_device, &req6, NULL); + + printf("onvif_tar_DeleteAccessProfile return ret = %d\n", ret); + } +} + +#endif // end of ACCESS_RULES + +#ifdef SCHEDULE_SUPPORT + +void onvifScheduleTest(ONVIF_DEVICE_EX * p_device) +{ + uint32 i; + BOOL ret; + + // GetScheduleList + tsc_GetScheduleList_REQ req; + tsc_GetScheduleList_RES res; + + memset(&req, 0, sizeof(req)); + memset(&res, 0, sizeof(res)); + + ret = onvif_tsc_GetScheduleList(&p_device->onvif_device, &req, &res); + + printf("onvif_tsc_GetScheduleList return ret = %d\n", ret); + + if (!ret) + { + return; + } + + // GetSchedules + tsc_GetSchedules_REQ req1; + tsc_GetSchedules_RES res1; + + memset(&req1, 0, sizeof(req1)); + memset(&res1, 0, sizeof(res1)); + + for (i = 0; i < res.sizeSchedule; i++) + { + req1.sizeToken++; + strcpy(req1.Token[i], res.Schedule[i].token); + } + + ret = onvif_tsc_GetSchedules(&p_device->onvif_device, &req1, &res1); + + printf("onvif_tsc_GetSchedules return ret = %d\n", ret); + + // GetScheduleInfoList + tsc_GetScheduleInfoList_REQ req2; + tsc_GetScheduleInfoList_RES res2; + + memset(&req2, 0, sizeof(req2)); + memset(&res2, 0, sizeof(res2)); + + ret = onvif_tsc_GetScheduleInfoList(&p_device->onvif_device, &req2, &res2); + + printf("onvif_tsc_GetScheduleInfoList return ret = %d\n", ret); + + // GetScheduleInfo + tsc_GetScheduleInfo_REQ req3; + tsc_GetScheduleInfo_RES res3; + + memset(&req3, 0, sizeof(req3)); + memset(&res3, 0, sizeof(res3)); + + for (i = 0; i < res.sizeSchedule; i++) + { + req1.sizeToken++; + strcpy(req3.Token[i], res.Schedule[i].token); + } + + ret = onvif_tsc_GetScheduleInfo(&p_device->onvif_device, &req3, &res3); + + printf("onvif_tsc_GetScheduleInfo return ret = %d\n", ret); + + // CreateSchedule + tsc_CreateSchedule_REQ req4; + tsc_CreateSchedule_RES res4; + + memset(&req4, 0, sizeof(req4)); + memset(&res4, 0, sizeof(res4)); + + strcpy(req4.Schedule.token, ""); + strcpy(req4.Schedule.Name, "test"); + req4.Schedule.DescriptionFlag = 1; + strcpy(req4.Schedule.Description, "test"); + strcpy(req4.Schedule.Standard, "BEGIN:VCALENDAR\r\n" + "BEGIN:VEVENT\r\n" + "SUMMARY:Access 24*7\r\n" + "DTSTART:19700101T000000\r\n" + "DTEND:19700102T000000\r\n" + "RRULE:FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR,SA,SU\r\n" + "END:VEVENT\r\n" + "END:VCALENDAR"); + + ret = onvif_tsc_CreateSchedule(&p_device->onvif_device, &req4, &res4); + + printf("onvif_tsc_CreateSchedule return ret = %d\n", ret); + + // ModifySchedule + tsc_ModifySchedule_REQ req5; + + memset(&req5, 0, sizeof(req5)); + + strcpy(req5.Schedule.token, res4.Token); + strcpy(req5.Schedule.Name, "test11"); + req5.Schedule.DescriptionFlag = 1; + strcpy(req5.Schedule.Description, "test11"); + strcpy(req4.Schedule.Standard, "BEGIN:VCALENDAR\r\n" + "BEGIN:VEVENT\r\n" + "SUMMARY:Access 24*7\r\n" + "DTSTART:19700101T000000\r\n" + "DTEND:19700102T000000\r\n" + "RRULE:FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR,SA,SU\r\n" + "END:VEVENT\r\n" + "END:VCALENDAR"); + + ret = onvif_tsc_ModifySchedule(&p_device->onvif_device, &req5, NULL); + + printf("onvif_tsc_ModifySchedule return ret = %d\n", ret); + + // GetScheduleState + tsc_GetScheduleState_REQ req6; + tsc_GetScheduleState_RES res6; + + memset(&req6, 0, sizeof(req6)); + memset(&res6, 0, sizeof(res6)); + + strcpy(req6.Token, res4.Token); + + ret = onvif_tsc_GetScheduleState(&p_device->onvif_device, &req6, &res6); + + printf("onvif_tsc_GetScheduleState return ret = %d\n", ret); + + // DeleteSchedule + tsc_DeleteSchedule_REQ req7; + + memset(&req7, 0, sizeof(req7)); + + strcpy(req7.Token, res4.Token); + + ret = onvif_tsc_DeleteSchedule(&p_device->onvif_device, &req7, NULL); + + printf("onvif_tsc_DeleteSchedule return ret = %d\n", ret); +} + +void onvifSpecialDayGroupTest(ONVIF_DEVICE_EX * p_device) +{ + uint32 i; + BOOL ret; + + // GetSpecialDayGroupList + tsc_GetSpecialDayGroupList_REQ req; + tsc_GetSpecialDayGroupList_RES res; + + memset(&req, 0, sizeof(req)); + memset(&res, 0, sizeof(res)); + + ret = onvif_tsc_GetSpecialDayGroupList(&p_device->onvif_device, &req, &res); + + printf("onvif_tsc_GetSpecialDayGroupList return ret = %d\n", ret); + + if (!ret) + { + return; + } + + // GetSpecialDayGroups + tsc_GetSpecialDayGroups_REQ req1; + tsc_GetSpecialDayGroups_RES res1; + + memset(&req1, 0, sizeof(req1)); + memset(&res1, 0, sizeof(res1)); + + for (i = 0; i < res.sizeSpecialDayGroup; i++) + { + req1.sizeToken++; + strcpy(req1.Token[i], res.SpecialDayGroup[i].token); + } + + ret = onvif_tsc_GetSpecialDayGroups(&p_device->onvif_device, &req1, &res1); + + printf("onvif_tsc_GetSpecialDayGroups return ret = %d\n", ret); + + // GetSpecialDayGroupInfoList + tsc_GetSpecialDayGroupInfoList_REQ req2; + tsc_GetSpecialDayGroupInfoList_RES res2; + + memset(&req2, 0, sizeof(req2)); + memset(&res2, 0, sizeof(res2)); + + ret = onvif_tsc_GetSpecialDayGroupInfoList(&p_device->onvif_device, &req2, &res2); + + printf("onvif_tsc_GetSpecialDayGroupInfoList return ret = %d\n", ret); + + // GetSpecialDayGroupInfo + tsc_GetSpecialDayGroupInfo_REQ req3; + tsc_GetSpecialDayGroupInfo_RES res3; + + memset(&req3, 0, sizeof(req3)); + memset(&res3, 0, sizeof(res3)); + + for (i = 0; i < res.sizeSpecialDayGroup; i++) + { + req1.sizeToken++; + strcpy(req3.Token[i], res.SpecialDayGroup[i].token); + } + + ret = onvif_tsc_GetSpecialDayGroupInfo(&p_device->onvif_device, &req3, &res3); + + printf("onvif_tsc_GetSpecialDayGroupInfo return ret = %d\n", ret); + + // CreateSpecialDayGroup + tsc_CreateSpecialDayGroup_REQ req4; + tsc_CreateSpecialDayGroup_RES res4; + + memset(&req4, 0, sizeof(req4)); + memset(&res4, 0, sizeof(res4)); + + strcpy(req4.SpecialDayGroup.token, ""); + strcpy(req4.SpecialDayGroup.Name, "test"); + req4.SpecialDayGroup.DescriptionFlag = 1; + strcpy(req4.SpecialDayGroup.Description, "test"); + req4.SpecialDayGroup.DaysFlag = 1; + strcpy(req4.SpecialDayGroup.Days, "BEGIN:VCALENDAR\r\n" + "PRODID:VERSION:2.0\r\n" + "BEGIN:VEVENT\r\n" + "SUMMARY:Christmas day\r\n" + "DTSTART:20141225T000000\r\n" + "DTEND:20141226T000000\r\n" + "UID:Holiday@ONVIF.com\r\n" + "END:VEVENT\r\n" + "END:VCALENDAR\r\n"); + + ret = onvif_tsc_CreateSpecialDayGroup(&p_device->onvif_device, &req4, &res4); + + printf("onvif_tsc_CreateSpecialDayGroup return ret = %d\n", ret); + + // ModifySpecialDayGroup + tsc_ModifySpecialDayGroup_REQ req5; + + memset(&req5, 0, sizeof(req5)); + + strcpy(req5.SpecialDayGroup.token, res4.Token); + strcpy(req5.SpecialDayGroup.Name, "test11"); + req5.SpecialDayGroup.DescriptionFlag = 1; + strcpy(req5.SpecialDayGroup.Description, "test11"); + req5.SpecialDayGroup.DaysFlag = 1; + strcpy(req4.SpecialDayGroup.Days, "BEGIN:VCALENDAR\r\n" + "BEGIN:VEVENT\r\n" + "SUMMARY:Access 24*7\r\n" + "DTSTART:19700101T000000\r\n" + "DTEND:19700102T000000\r\n" + "RRULE:FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR,SA,SU\r\n" + "END:VEVENT\r\n" + "END:VCALENDAR"); + + ret = onvif_tsc_ModifySpecialDayGroup(&p_device->onvif_device, &req5, NULL); + + printf("onvif_tsc_ModifySpecialDayGroup return ret = %d\n", ret); + + // DeleteSpecialDayGroup + tsc_DeleteSpecialDayGroup_REQ req6; + + memset(&req6, 0, sizeof(req6)); + + strcpy(req6.Token, res4.Token); + + ret = onvif_tsc_DeleteSpecialDayGroup(&p_device->onvif_device, &req6, NULL); + + printf("onvif_tsc_DeleteSpecialDayGroup return ret = %d\n", ret); +} + +#endif // end of SCHEDULE_SUPPORT + +#ifdef RECEIVER_SUPPORT + +void onvifReceiverTest(ONVIF_DEVICE_EX * p_device) +{ + BOOL ret; + + // GetReceivers + trv_GetReceivers_RES res; + + memset(&res, 0, sizeof(res)); + + ret = onvif_trv_GetReceivers(&p_device->onvif_device, NULL, &res); + + printf("onvif_trv_GetReceivers return ret = %d\n", ret); + + onvif_free_Receivers(&res.Receivers); + + // CreateReceiver + trv_CreateReceiver_REQ req1; + trv_CreateReceiver_RES res1; + + memset(&req1, 0, sizeof(req1)); + memset(&res1, 0, sizeof(res1)); + + req1.Configuration.Mode = ReceiverMode_NeverConnect; + strcpy(req1.Configuration.MediaUri, "rtsp://192.168.0.1/test.264"); + req1.Configuration.StreamSetup.Stream = StreamType_RTP_Unicast; + req1.Configuration.StreamSetup.Transport.Protocol = TransportProtocol_RTSP; + + ret = onvif_trv_CreateReceiver(&p_device->onvif_device, &req1, &res1); + + printf("onvif_trv_CreateReceiver return ret = %d\n", ret); + + if (!ret) + { + return; + } + + // GetReceiver + trv_GetReceiver_REQ req2; + trv_GetReceiver_RES res2; + + memset(&req2, 0, sizeof(req2)); + memset(&res2, 0, sizeof(res2)); + + strcpy(req2.ReceiverToken, res1.Receiver.Token); + + ret = onvif_trv_GetReceiver(&p_device->onvif_device, &req2, &res2); + + printf("onvif_trv_GetReceiver return ret = %d\n", ret); + + // ConfigureReceiver + trv_ConfigureReceiver_REQ req3; + + memset(&req3, 0, sizeof(req3)); + + strcpy(req3.ReceiverToken, res1.Receiver.Token); + memcpy(&req3.Configuration, &res1.Receiver.Configuration, sizeof(onvif_ReceiverConfiguration)); + strcpy(req3.Configuration.MediaUri, "rtsp://192.168.0.2/test.264"); + + ret = onvif_trv_ConfigureReceiver(&p_device->onvif_device, &req3, NULL); + + printf("onvif_trv_ConfigureReceiver return ret = %d\n", ret); + + // SetReceiverMode + trv_SetReceiverMode_REQ req4; + + memset(&req4, 0, sizeof(req4)); + + strcpy(req4.ReceiverToken, res1.Receiver.Token); + req4.Mode = ReceiverMode_AlwaysConnect; + + ret = onvif_trv_SetReceiverMode(&p_device->onvif_device, &req4, NULL); + + printf("onvif_trv_SetReceiverMode return ret = %d\n", ret); + + // GetReceiverState + trv_GetReceiverState_REQ req5; + trv_GetReceiverState_RES res5; + + memset(&req5, 0, sizeof(req5)); + memset(&res5, 0, sizeof(res5)); + + strcpy(req5.ReceiverToken, res1.Receiver.Token); + + ret = onvif_trv_GetReceiverState(&p_device->onvif_device, &req5, &res5); + + printf("onvif_trv_GetReceiverState return ret = %d\n", ret); + + // DeleteReceiver + trv_DeleteReceiver_REQ req6; + + memset(&req6, 0, sizeof(req6)); + + strcpy(req6.ReceiverToken, res1.Receiver.Token); + + ret = onvif_trv_DeleteReceiver(&p_device->onvif_device, &req6, NULL); + + printf("onvif_trv_DeleteReceiver return ret = %d\n", ret); + +} + +#endif // end of RECEIVER_SUPPORT + +#ifdef IPFILTER_SUPPORT + +void onvifIPAddressFilterTest(ONVIF_DEVICE_EX * p_device) +{ + BOOL ret; + + // GetIPAddressFilter + tds_GetIPAddressFilter_RES res; + + memset(&res, 0, sizeof(res)); + + ret = onvif_tds_GetIPAddressFilter(&p_device->onvif_device, NULL, &res); + + printf("onvif_tds_GetIPAddressFilter return ret = %d\n", ret); + + // SetIPAddressFilter + tds_SetIPAddressFilter_REQ req1; + + memset(&req1, 0, sizeof(req1)); + + memcpy(&req1.IPAddressFilter, &res.IPAddressFilter, sizeof(onvif_IPAddressFilter)); + + strcpy(req1.IPAddressFilter.IPv4Address[0].Address, "192.168.10.1"); + req1.IPAddressFilter.IPv4Address[0].PrefixLength = 24; + + ret = onvif_tds_SetIPAddressFilter(&p_device->onvif_device, &req1, NULL); + + printf("onvif_tds_SetIPAddressFilter return ret = %d\n", ret); + + // AddIPAddressFilter + tds_AddIPAddressFilter_REQ req2; + + memset(&req2, 0, sizeof(req2)); + + strcpy(req2.IPAddressFilter.IPv4Address[0].Address, "192.168.10.2"); + req2.IPAddressFilter.IPv4Address[0].PrefixLength = 24; + + ret = onvif_tds_AddIPAddressFilter(&p_device->onvif_device, &req2, NULL); + + printf("onvif_tds_AddIPAddressFilter return ret = %d\n", ret); + + // RemoveIPAddressFilter + tds_RemoveIPAddressFilter_REQ req3; + + memset(&req3, 0, sizeof(req3)); + + memcpy(&req3.IPAddressFilter, &req2.IPAddressFilter, sizeof(onvif_IPAddressFilter)); + + ret = onvif_tds_RemoveIPAddressFilter(&p_device->onvif_device, &req3, NULL); + + printf("onvif_tds_RemoveIPAddressFilter return ret = %d\n", ret); + + // SetIPAddressFilter + tds_SetIPAddressFilter_REQ req4; + + memset(&req4, 0, sizeof(req4)); + + memcpy(&req1.IPAddressFilter, &res.IPAddressFilter, sizeof(onvif_IPAddressFilter)); + + ret = onvif_tds_SetIPAddressFilter(&p_device->onvif_device, &req4, NULL); + + printf("onvif_tds_SetIPAddressFilter return ret = %d\n", ret); + + // GetIPAddressFilter + tds_GetIPAddressFilter_RES res5; + + memset(&res5, 0, sizeof(res5)); + + ret = onvif_tds_GetIPAddressFilter(&p_device->onvif_device, NULL, &res5); + + printf("onvif_tds_GetIPAddressFilter return ret = %d\n", ret); + +} + +#endif // end of IPFILTER_SUPPORT + +#ifdef PROVISIONING_SUPPORT + +void onvifProvisioningTest(ONVIF_DEVICE_EX * p_device) +{ + BOOL ret; + + // GetVideoSources + trt_GetVideoSources_RES res; + memset(&res, 0, sizeof(res)); + + ret = onvif_trt_GetVideoSources(&p_device->onvif_device, NULL, &res); + + printf("onvif_trt_GetVideoSources return ret = %d\n", ret); + + if (res.VideoSources) + { + // GetUsage + tpv_GetUsage_REQ req1; + tpv_GetUsage_RES res1; + + memset(&req1, 0, sizeof(req1)); + memset(&res1, 0, sizeof(res1)); + + strcpy(req1.VideoSource, res.VideoSources->VideoSource.token); + + ret = onvif_tpv_GetUsage(&p_device->onvif_device, &req1, &res1); + + printf("onvif_tpv_GetUsage return ret = %d\n", ret); + + // PanMove + tpv_PanMove_REQ req2; + memset(&req2, 0, sizeof(req2)); + + strcpy(req2.VideoSource, res.VideoSources->VideoSource.token); + req2.Direction = PanDirection_Left; + + ret = onvif_tpv_PanMove(&p_device->onvif_device, &req2, NULL); + + printf("onvif_tpv_PanMove return ret = %d\n", ret); + + // Stop + tpv_Stop_REQ req3; + memset(&req3, 0, sizeof(req3)); + + strcpy(req3.VideoSource, res.VideoSources->VideoSource.token); + + ret = onvif_tpv_Stop(&p_device->onvif_device, &req3, NULL); + + printf("onvif_tpv_Stop return ret = %d\n", ret); + + // TiltMove + tpv_TiltMove_REQ req4; + memset(&req4, 0, sizeof(req4)); + + strcpy(req4.VideoSource, res.VideoSources->VideoSource.token); + req4.Direction = TiltDirection_Up; + + ret = onvif_tpv_TiltMove(&p_device->onvif_device, &req4, NULL); + + printf("onvif_tpv_TiltMove return ret = %d\n", ret); + + // Stop + ret = onvif_tpv_Stop(&p_device->onvif_device, &req3, NULL); + + printf("onvif_tpv_Stop return ret = %d\n", ret); + + // ZoomMove + tpv_ZoomMove_REQ req5; + memset(&req5, 0, sizeof(req5)); + + strcpy(req5.VideoSource, res.VideoSources->VideoSource.token); + req5.Direction = ZoomDirection_Wide; + + ret = onvif_tpv_ZoomMove(&p_device->onvif_device, &req5, NULL); + + printf("onvif_tpv_ZoomMove return ret = %d\n", ret); + + // Stop + ret = onvif_tpv_Stop(&p_device->onvif_device, &req3, NULL); + + printf("onvif_tpv_Stop return ret = %d\n", ret); + + // RollMove + tpv_RollMove_REQ req6; + memset(&req6, 0, sizeof(req6)); + + strcpy(req6.VideoSource, res.VideoSources->VideoSource.token); + req6.Direction = RollDirection_Clockwise; + + ret = onvif_tpv_RollMove(&p_device->onvif_device, &req6, NULL); + + printf("onvif_tpv_RollMove return ret = %d\n", ret); + + // Stop + ret = onvif_tpv_Stop(&p_device->onvif_device, &req3, NULL); + + printf("onvif_tpv_Stop return ret = %d\n", ret); + + // FocusMove + tpv_FocusMove_REQ req7; + memset(&req7, 0, sizeof(req7)); + + strcpy(req7.VideoSource, res.VideoSources->VideoSource.token); + req7.Direction = FocusDirection_Near; + + ret = onvif_tpv_FocusMove(&p_device->onvif_device, &req7, NULL); + + printf("onvif_tpv_FocusMove return ret = %d\n", ret); + + // Stop + ret = onvif_tpv_Stop(&p_device->onvif_device, &req3, NULL); + + printf("onvif_tpv_Stop return ret = %d\n", ret); + } + + onvif_free_VideoSources(&res.VideoSources); +} + +#endif // end of PROVISIONING_SUPPORT + +void onvifSystemMaintainTest(ONVIF_DEVICE_EX * p_device) +{ + BOOL ret; + + ret = SystemBackup(&p_device->onvif_device, "onvifsystem.backup"); + + printf("SystemBackup return ret = %d\n", ret); + + if (ret) + { + //ret = SystemRestore(&p_device->onvif_device, "onvifsystem.backup"); + //printf("SystemRestore return ret = %d\n", ret); + } + + tds_GetSystemLog_REQ req; + tds_GetSystemLog_RES res; + + req.LogType = SystemLogType_System; + + ret = onvif_tds_GetSystemLog(&p_device->onvif_device, &req, &res); + + printf("onvif_tds_GetSystemLog return ret = %d\n", ret); + + req.LogType = SystemLogType_Access; + + ret = onvif_tds_GetSystemLog(&p_device->onvif_device, &req, &res); + + printf("onvif_tds_GetSystemLog return ret = %d\n", ret); + +} + +BOOL parseEventTopic1(XMLN * p_node, LINKED_LIST * p_list) +{ + BOOL ret = FALSE; + XMLN * p_child = p_node; + + while (p_child) + { + //if (p_child->f_attrib && + // p_child->f_attrib->name && + // p_child->f_attrib->data && + // soap_strcmp(p_child->f_attrib->name, "topic") == 0 && + // strcasecmp(p_child->f_attrib->data, "true") == 0) + if (soap_strcmp(p_child->name, "MessageDescription") != 0) + { + ret = TRUE; + + h_list_add_at_back(p_list, p_child); + + p_child = p_child->f_child; + } + else + { + break; + } + } + + return ret; +} + +void printEventTopic(LINKED_LIST * p_list) +{ + char topic[512] = {'\0'}; + + LINKED_NODE * p_node = h_list_lookup_start(p_list); + while (p_node) + { + XMLN * p_xmln = (XMLN *)p_node->p_data; + + if (topic[0] != '\0') + { + strcat(topic, "/"); + strcat(topic, p_xmln->name); + } + else + { + strcpy(topic, p_xmln->name); + } + + p_node = h_list_lookup_next(p_list, p_node); + } + h_list_lookup_end(p_list); + + printf("topic : %s\r\n", topic); +} + +void parseEventTopic(char * xml) +{ + LINKED_LIST * p_list = h_list_create(FALSE); + + XMLN * p_root = xxx_hxml_parse(xml, (int)strlen(xml)); + if (p_root) + { + XMLN * p_child = p_root->f_child; + while (p_child) + { + if (parseEventTopic1(p_child, p_list)) + { + printEventTopic(p_list); + } + + LINKED_NODE * p_node = h_list_get_from_back(p_list); + if (p_node) + { + p_child = (XMLN *)p_node->p_data; + + h_list_remove_from_back(p_list); + + if (p_child) + { + p_child = p_child->next; + } + + while (NULL == p_child) + { + p_node = h_list_get_from_back(p_list); + if (p_node) + { + p_child = (XMLN *)p_node->p_data; + + h_list_remove_from_back(p_list); + + if (p_child) + { + p_child = p_child->next; + } + } + else + { + break; + } + } + } + else + { + p_child = p_child->next; + } + } + } + + xml_node_del(p_root); + + h_list_free_container(p_list); +} + +void onvifEventTest(ONVIF_DEVICE_EX * p_device) +{ + BOOL ret; + + tev_GetEventProperties_RES res; + memset(&res, 0, sizeof(res)); + + ret = onvif_tev_GetEventProperties(&p_device->onvif_device, NULL, &res); + + printf("onvif_tev_GetEventProperties return ret = %d\r\n", ret); + + if (ret) + { + parseEventTopic(res.TopicSet); + } + + // printf("TopicSet = %s\r\n", res.TopicSet); + + FreeBuff((uint8 *)res.TopicSet); + + if (p_device->onvif_device.Capabilities.events.WSPullPointSupport == 1) + { + ret = CreatePullPointSubscription(&p_device->onvif_device); + + printf("CreatePullPointSubscription return ret = %d\r\n", ret); + + tev_PullMessages_RES res2; + memset(&res2, 0, sizeof(res2)); + + ret = PullMessages(&p_device->onvif_device, 60, 1, &res2); + + printf("PullMessages return ret = %d\r\n", ret); + + onvif_free_NotificationMessages(&res2.NotifyMessages); + } +} + +void onvifPTZTest(ONVIF_DEVICE_EX * p_device) +{ + BOOL ret; + + if (p_device->onvif_device.curProfile->ptz_cfg) + { + // GetConfigurationOptions + ptz_GetConfigurationOptions_REQ req; + ptz_GetConfigurationOptions_RES res; + + memset(&res, 0, sizeof(res)); + strcpy(req.ConfigurationToken, p_device->onvif_device.curProfile->ptz_cfg->Configuration.token); + + ret = onvif_ptz_GetConfigurationOptions(&p_device->onvif_device, &req, &res); + + printf("onvif_ptz_GetConfigurationOptions return ret = %d\n", ret); + } + + if (p_device->onvif_device.ptz_node) + { + // GetNode + ptz_GetNode_REQ req1; + ptz_GetNode_RES res1; + + memset(&req1, 0, sizeof(req1)); + memset(&res1, 0, sizeof(res1)); + + strcpy(req1.NodeToken, p_device->onvif_device.ptz_node->PTZNode.token); + + ret = onvif_ptz_GetNode(&p_device->onvif_device, &req1, &res1); + + printf("onvif_ptz_GetNode return ret = %d\n", ret); + + if (p_device->onvif_device.ptz_node->PTZNode.GeoMove && + p_device->onvif_device.profiles) + { + // GeoMove + ptz_GeoMove_REQ req2; + memset(&req2, 0, sizeof(req2)); + + strcpy(req2.ProfileToken, p_device->onvif_device.profiles->token); + req2.Target.lonFlag = 1; + req2.Target.lon = 20.2; + req2.Target.latFlag = 1; + req2.Target.lat = 84.3; + req2.Target.elevationFlag = 1; + req2.Target.elevation = 100.0; + + ret = onvif_ptz_GeoMove(&p_device->onvif_device, &req2, NULL); + + printf("onvif_ptz_GeoMove return ret = %d\n", ret); + } + } +} + +void onvifPTZTest2(ONVIF_DEVICE_EX * p_device) +{ + BOOL ret; + + // CreatePresetTour + ptz_CreatePresetTour_REQ req; + ptz_CreatePresetTour_RES res; + + memset(&req, 0, sizeof(req)); + memset(&res, 0, sizeof(res)); + + strcpy(req.ProfileToken, p_device->onvif_device.curProfile->token); + + ret = onvif_ptz_CreatePresetTour(&p_device->onvif_device, &req, &res); + + printf("onvif_ptz_CreatePresetTour return ret = %d\n", ret); + + if (!ret) + { + return; + } + + // GetPresetTours + ptz_GetPresetTours_REQ req1; + ptz_GetPresetTours_RES res1; + + memset(&req1, 0, sizeof(req1)); + memset(&res1, 0, sizeof(res1)); + + strcpy(req1.ProfileToken, p_device->onvif_device.curProfile->token); + + ret = onvif_ptz_GetPresetTours(&p_device->onvif_device, &req1, &res1); + + printf("onvif_ptz_GetPresetTours return ret = %d\n", ret); + + onvif_free_PresetTours(&res1.PresetTour); + + // GetPresetTour + ptz_GetPresetTour_REQ req2; + ptz_GetPresetTour_RES res2; + + memset(&req2, 0, sizeof(req2)); + memset(&res2, 0, sizeof(res2)); + + strcpy(req2.ProfileToken, p_device->onvif_device.curProfile->token); + strcpy(req2.PresetTourToken, res.PresetTourToken); + + ret = onvif_ptz_GetPresetTour(&p_device->onvif_device, &req2, &res2); + + printf("onvif_ptz_GetPresetTour return ret = %d\n", ret); + + // ModifyPresetTour + ptz_ModifyPresetTour_REQ req3; + + memset(&req3, 0, sizeof(req3)); + + strcpy(req3.ProfileToken, p_device->onvif_device.curProfile->token); + memcpy(&req3.PresetTour, &res2.PresetTour, sizeof(onvif_PresetTour)); + + strcpy(req3.PresetTour.Name, "test"); + + ret = onvif_ptz_ModifyPresetTour(&p_device->onvif_device, &req3, NULL); + + printf("onvif_ptz_ModifyPresetTour return ret = %d\n", ret); + + // OperatePresetTour + ptz_OperatePresetTour_REQ req4; + + memset(&req4, 0, sizeof(req4)); + + strcpy(req4.ProfileToken, p_device->onvif_device.curProfile->token); + strcpy(req4.PresetTourToken, res.PresetTourToken); + + req4.Operation = PTZPresetTourOperation_Start; + + ret = onvif_ptz_OperatePresetTour(&p_device->onvif_device, &req4, NULL); + + printf("onvif_ptz_OperatePresetTour return ret = %d\n", ret); + + // GetPresetTourOptions + ptz_GetPresetTourOptions_REQ req5; + ptz_GetPresetTourOptions_RES res5; + + memset(&req5, 0, sizeof(req5)); + memset(&res5, 0, sizeof(res5)); + + strcpy(req5.ProfileToken, p_device->onvif_device.curProfile->token); + strcpy(req5.PresetTourToken, res.PresetTourToken); + + ret = onvif_ptz_GetPresetTourOptions(&p_device->onvif_device, &req5, &res5); + + printf("onvif_ptz_GetPresetTourOptions return ret = %d\n", ret); + + // GetPresetTour + ptz_GetPresetTour_REQ req6; + ptz_GetPresetTour_RES res6; + + memset(&req6, 0, sizeof(req6)); + memset(&res6, 0, sizeof(res6)); + + strcpy(req6.ProfileToken, p_device->onvif_device.curProfile->token); + strcpy(req6.PresetTourToken, res.PresetTourToken); + + ret = onvif_ptz_GetPresetTour(&p_device->onvif_device, &req6, &res6); + + printf("onvif_ptz_GetPresetTour return ret = %d\n", ret); + + // RemovePresetTour + ptz_RemovePresetTour_REQ req7; + + memset(&req7, 0, sizeof(req7)); + + strcpy(req7.ProfileToken, p_device->onvif_device.curProfile->token); + strcpy(req7.PresetTourToken, res.PresetTourToken); + + ret = onvif_ptz_RemovePresetTour(&p_device->onvif_device, &req7, NULL); + + printf("onvif_ptz_RemovePresetTour return ret = %d\n", ret); +} + +BOOL mediaProfile2Profile(ONVIF_DEVICE_EX * p_device) +{ + onvif_free_profiles(&p_device->onvif_device.profiles); + + MediaProfileList * p_mediaProfile = p_device->onvif_device.media_profiles; + while (p_mediaProfile) + { + ONVIF_PROFILE * p_profile = onvif_add_profile(&p_device->onvif_device.profiles); + if (p_profile) + { + p_profile->fixed = p_mediaProfile->MediaProfile.fixed; + strcpy(p_profile->name, p_mediaProfile->MediaProfile.Name); + strcpy(p_profile->token, p_mediaProfile->MediaProfile.token); + strcpy(p_profile->stream_uri, p_mediaProfile->MediaProfile.stream_uri); + } + + p_mediaProfile = p_mediaProfile->next; + } + + return TRUE; +} + +BOOL getDevInfo1(ONVIF_DEVICE_EX * p_device) +{ + GetProfiles(&p_device->onvif_device); + + GetStreamUris(&p_device->onvif_device, TransportProtocol_RTSP); + + return TRUE; +} + +BOOL getDevInfo2(ONVIF_DEVICE_EX * p_device) +{ + if (!tr2_GetProfiles(&p_device->onvif_device)) + { + return FALSE; + } + + if (!tr2_GetStreamUris(&p_device->onvif_device, "RTSP")) + { + return FALSE; + } + + mediaProfile2Profile(p_device); + + return TRUE; +} + +void * getDevInfoThread(void * argv) +{ + char profileToken[ONVIF_TOKEN_LEN]; + ONVIF_PROFILE * p_profile = NULL; + ONVIF_DEVICE_EX * p_device = (ONVIF_DEVICE_EX *) argv; + + GetSystemDateAndTime(&p_device->onvif_device); + + GetCapabilities(&p_device->onvif_device); + + GetServices(&p_device->onvif_device); + + GetDeviceInformation(&p_device->onvif_device); + + GetVideoSources(&p_device->onvif_device); + + GetImagingSettings(&p_device->onvif_device); + + GetVideoSourceConfigurations(&p_device->onvif_device); + + GetVideoEncoderConfigurations(&p_device->onvif_device); + + if (GetAudioSources(&p_device->onvif_device)) + { + GetAudioSourceConfigurations(&p_device->onvif_device); + + GetAudioEncoderConfigurations(&p_device->onvif_device); + } + + if (p_device->onvif_device.Capabilities.ptz.support) + { + GetNodes(&p_device->onvif_device); + + GetConfigurations(&p_device->onvif_device); + } + + /* save currrent profile token */ + + if (p_device->onvif_device.curProfile) + { + strcpy(profileToken, p_device->onvif_device.curProfile->token); + } + else + { + memset(profileToken, 0, sizeof(profileToken)); + } + + if (p_device->onvif_device.Capabilities.media2.support) + { + if (!getDevInfo2(p_device)) + { + getDevInfo1(p_device); + } + } + else + { + getDevInfo1(p_device); + } + + /* resume current profile */ + if (profileToken[0] != '\0') + { + p_profile = onvif_find_profile(p_device->onvif_device.profiles, profileToken); + } + + if (NULL == p_profile) + { + p_profile = p_device->onvif_device.profiles; + } + + p_device->onvif_device.curProfile = p_profile; + + if (p_device->onvif_device.curProfile == NULL) + { + p_device->thread_handler = 0; + return NULL; + } + + if (p_profile) + { + int len; + uint8 * p_buff; + + if (GetSnapshot(&p_device->onvif_device, p_profile->token, &p_buff, &len)) + { + if (p_device->snapshot) + { + FreeBuff(p_device->snapshot); + p_device->snapshot = NULL; + p_device->snapshot_len = 0; + } + + p_device->snapshot = p_buff; + p_device->snapshot_len = len; + + // save the snapshot to file, for test + char name[256] = {'\0'}; + snprintf(name, sizeof(name), "%d.jpg", len); + FILE * file = fopen(name, "wb"); + fwrite(p_buff, sizeof(char), len, file); + fclose(file); + } + } + + onvifServiceCapabilitiesTest(p_device); + + if (p_device->onvif_device.Capabilities.events.support == 1) + { + onvifEventTest(p_device); + } + + if (p_device->onvif_device.Capabilities.events.support == 1 && + p_device->onvif_device.events.subscribe == FALSE) + { + Subscribe(&p_device->onvif_device, pps_get_index(m_dev_ul, p_device)); + } + + if (p_device->onvif_device.Capabilities.ptz.support) + { + onvifPTZTest(p_device); + + onvifPTZTest2(p_device); + } + + onvifNetworkTest(p_device); + + onvifMediaTest(p_device); + + onvifUserTest(p_device); + + onvifGeoLocationTest(p_device); + + if (p_device->onvif_device.Capabilities.image.support) + { + onvifImageTest(p_device); + } + +#ifdef DEVICEIO_SUPPORT + if (p_device->onvif_device.Capabilities.deviceIO.support) + { + onvifDeviceIOTest(p_device); + } +#endif + + if (p_device->onvif_device.Capabilities.media2.support) + { + onvifMedia2Test(p_device); + + if (p_device->onvif_device.Capabilities.media2.OSD) + { + onvifMedia2OSDTest(p_device); + } + + if (p_device->onvif_device.Capabilities.media2.Mask) + { + onvifMedia2MaskTest(p_device); + } + } + + if (p_device->onvif_device.Capabilities.analytics.support) + { + onvifAnalyticsTest(p_device); + } + +#ifdef PROFILE_C_SUPPORT + if (p_device->onvif_device.Capabilities.accesscontrol.support) + { + onvifAccessControlTest(p_device); + } + + if (p_device->onvif_device.Capabilities.doorcontrol.support) + { + onvifDoorControlTest(p_device); + } +#endif + +#ifdef PROFILE_G_SUPPORT + if (p_device->onvif_device.Capabilities.recording.support) + { + onvifRecordingTest(p_device); + } + + if (p_device->onvif_device.Capabilities.search.support) + { + onvifSearchTest(p_device); + } + + if (p_device->onvif_device.Capabilities.replay.support) + { + onvifReplayTest(p_device); + } +#endif + +#ifdef THERMAL_SUPPORT + if (p_device->onvif_device.Capabilities.thermal.support) + { + onvifThermalTest(p_device); + } +#endif + +#ifdef CREDENTIAL_SUPPORT + if (p_device->onvif_device.Capabilities.credential.support) + { + onvifCredentialTest(p_device); + } +#endif + +#ifdef ACCESS_RULES + if (p_device->onvif_device.Capabilities.accessrules.support) + { + onvifAccessRulesTest(p_device); + } +#endif + +#ifdef SCHEDULE_SUPPORT + if (p_device->onvif_device.Capabilities.schedule.support) + { + onvifScheduleTest(p_device); + onvifSpecialDayGroupTest(p_device); + } +#endif + +#ifdef RECEIVER_SUPPORT + if (p_device->onvif_device.Capabilities.receiver.support) + { + onvifReceiverTest(p_device); + } +#endif + +#ifdef IPFILTER_SUPPORT + if (p_device->onvif_device.Capabilities.device.IPFilter) + { + onvifIPAddressFilterTest(p_device); + } +#endif + +#ifdef PROVISIONING_SUPPORT + if (p_device->onvif_device.Capabilities.provisioning.support) + { + onvifProvisioningTest(p_device); + } +#endif + + onvifSystemMaintainTest(p_device); + + p_device->thread_handler = 0; + + return NULL; +} + +ONVIF_DEVICE_EX * findDeviceByNotify(Notify_REQ * p_notify) +{ + int index = -1; + ONVIF_DEVICE_EX * p_dev = NULL; + + sscanf(p_notify->PostUrl, "/subscription%d", &index); + if (index >= 0) + { + p_dev = (ONVIF_DEVICE_EX *) pps_get_node_by_index(m_dev_ul, index); + } + + return p_dev; +} + +void updateDevice(ONVIF_DEVICE_EX * p_device) +{ + if (NULL == p_device) + { + return; + } + + // The current thread has not ended + if (p_device->thread_handler) + { + return; + } + + BOOL need_update = FALSE; + + if (p_device->need_update) + { + need_update = TRUE; + } + + if (!p_device->onvif_device.authFailed) + { + if (NULL == p_device->onvif_device.curProfile) + { + need_update = TRUE; + } + else if (p_device->onvif_device.curProfile->stream_uri[0] == '\0') + { + need_update = TRUE; + } + } + + if (need_update) + { + p_device->need_update = 0; + p_device->thread_handler = sys_os_create_thread((void *)getDevInfoThread, p_device); + } +} + +/** + * devices state detect threand + */ +void stateDetectThread(void * argv) +{ + int count = 0; + + while (m_bStateDetect) + { + if (count++ < 30) + { + sleep(1); + continue; + } + else + { + count = 0; + } + + int deviceNums = pps_node_count(m_dev_ul); + + for (int i = 0; i < deviceNums; i++) + { + if (!m_bStateDetect) + { + break; + } + + ONVIF_DEVICE_EX * p_device = (ONVIF_DEVICE_EX *) pps_get_node_by_index(m_dev_ul, i); + if (p_device) + { + int state = p_device->state; + + GetSystemDateAndTime(&p_device->onvif_device); + + if (p_device->onvif_device.errCode == ONVIF_ERR_ConnFailure) + { + p_device->state = 0; + } + else + { + p_device->state = 1; + } + + if (state != p_device->state) + { + if (p_device->state) + { + updateDevice(p_device); + } + } + } + } + } + + m_hStateDetect = 0; +} + +/** + * start devices state detect + */ +void startStateDetect() +{ + m_bStateDetect = TRUE; + m_hStateDetect = sys_os_create_thread((void *)stateDetectThread, NULL); +} + +/** + * stop devices state detect + */ +void stopStateDetect() +{ + m_bStateDetect = FALSE; + + while (m_hStateDetect) + { + usleep(10*1000); + } +} + +/** + * onvif device probed callback + */ +void probeCallback(DEVICE_BINFO * p_res, int msgtype, void * p_data) +{ + ONVIF_DEVICE_EX * p_dev = NULL; + ONVIF_DEVICE_EX device; + memset(&device, 0, sizeof(ONVIF_DEVICE_EX)); + + if (msgtype == PROBE_MSGTYPE_MATCH || msgtype == PROBE_MSGTYPE_HELLO) + { + memcpy(&device.onvif_device.binfo, p_res, sizeof(DEVICE_BINFO)); + device.state = 1; + + p_dev = findDevice(&device); + if (p_dev == NULL) + { + printf("Found device. ip : %s, port : %d\n", p_res->XAddr.host, p_res->XAddr.port); + + p_dev = addDevice(&device); + if (p_dev) + { + updateDevice(p_dev); + } + } + else + { + updateDevice(p_dev); + } + } + else if (msgtype == PROBE_MSGTYPE_BYE) + { + p_dev = findDeviceByEndpointReference(p_res->EndpointReference); + if (p_dev) + { + p_dev->state = 0; + } + } +} + +/** + * onvif event notify callback + */ +void eventNotifyCallback(Notify_REQ * p_req, void * p_data) +{ + ONVIF_DEVICE_EX * p_dev; + NotificationMessageList * p_notify = p_req->notify; + + p_dev = findDeviceByNotify(p_req); + if (p_dev) + { + onvif_device_add_NotificationMessages(&p_dev->onvif_device, p_notify); + + p_dev->onvif_device.events.notify_nums += onvif_get_NotificationMessages_nums(p_notify); + + // max save 100 event notify + if (p_dev->onvif_device.events.notify_nums > 100) + { + p_dev->onvif_device.events.notify_nums -= + onvif_device_free_NotificationMessages(&p_dev->onvif_device, p_dev->onvif_device.events.notify_nums - 100); + } + } +} + +/** + * onvif event subscribe disconnect callback + */ +void subscribeDisconnectCallback(ONVIF_DEVICE * p_dev, void * p_data) +{ + printf("\r\nsubscribeDisconnectCallback, %s\r\n", p_dev->binfo.XAddr.host); +} + +/** + * free device memory + */ +void freeDevice(ONVIF_DEVICE_EX * p_dev) +{ + if (NULL == p_dev) + { + return; + } + + while (p_dev->thread_handler) + { + usleep(1000); + } + + onvif_free_device(&p_dev->onvif_device); + + if (p_dev->snapshot) + { + FreeBuff(p_dev->snapshot); + p_dev->snapshot = NULL; + p_dev->snapshot_len = 0; + } +} + +void clearDevices() +{ + ONVIF_DEVICE_EX * next_dev; + ONVIF_DEVICE_EX * dev = (ONVIF_DEVICE_EX *) pps_lookup_start(m_dev_ul); + while (dev) + { + next_dev = (ONVIF_DEVICE_EX *) pps_lookup_next(m_dev_ul, dev); + + freeDevice(dev); + + dev = next_dev; + } + + pps_lookup_end(m_dev_ul); +} + +void ptzLeftUpper(ONVIF_DEVICE_EX * p_dev) +{ + if (NULL == p_dev || + !p_dev->onvif_device.Capabilities.ptz.support || + NULL == p_dev->onvif_device.curProfile) + { + return; + } + + ptz_ContinuousMove_REQ req; + memset(&req, 0, sizeof(req)); + + req.Velocity.PanTiltFlag = 1; + req.Velocity.PanTilt.x = -0.5; + req.Velocity.PanTilt.y = 0.5; + strcpy(req.ProfileToken, p_dev->onvif_device.curProfile->token); + + onvif_ptz_ContinuousMove(&p_dev->onvif_device, &req, NULL); +} + +void ptzUpper(ONVIF_DEVICE_EX * p_dev) +{ + if (NULL == p_dev || + !p_dev->onvif_device.Capabilities.ptz.support || + NULL == p_dev->onvif_device.curProfile) + { + return; + } + + ptz_ContinuousMove_REQ req; + memset(&req, 0, sizeof(req)); + + req.Velocity.PanTiltFlag = 1; + req.Velocity.PanTilt.x = 0; + req.Velocity.PanTilt.y = 0.5; + strcpy(req.ProfileToken, p_dev->onvif_device.curProfile->token); + + onvif_ptz_ContinuousMove(&p_dev->onvif_device, &req, NULL); +} + +void ptzRightUpper(ONVIF_DEVICE_EX * p_dev) +{ + if (NULL == p_dev || + !p_dev->onvif_device.Capabilities.ptz.support || + NULL == p_dev->onvif_device.curProfile) + { + return; + } + + ptz_ContinuousMove_REQ req; + memset(&req, 0, sizeof(req)); + + req.Velocity.PanTiltFlag = 1; + req.Velocity.PanTilt.x = 0.5; + req.Velocity.PanTilt.y = 0.5; + strcpy(req.ProfileToken, p_dev->onvif_device.curProfile->token); + + onvif_ptz_ContinuousMove(&p_dev->onvif_device, &req, NULL); +} + +void ptzPTZLeft(ONVIF_DEVICE_EX * p_dev) +{ + if (NULL == p_dev || + !p_dev->onvif_device.Capabilities.ptz.support || + NULL == p_dev->onvif_device.curProfile) + { + return; + } + + ptz_ContinuousMove_REQ req; + memset(&req, 0, sizeof(req)); + + req.Velocity.PanTiltFlag = 1; + req.Velocity.PanTilt.x = -0.5; + req.Velocity.PanTilt.y = 0; + strcpy(req.ProfileToken, p_dev->onvif_device.curProfile->token); + + onvif_ptz_ContinuousMove(&p_dev->onvif_device, &req, NULL); +} + +void ptzRight(ONVIF_DEVICE_EX * p_dev) +{ + if (NULL == p_dev || + !p_dev->onvif_device.Capabilities.ptz.support || + NULL == p_dev->onvif_device.curProfile) + { + return; + } + + ptz_ContinuousMove_REQ req; + memset(&req, 0, sizeof(req)); + + req.Velocity.PanTiltFlag = 1; + req.Velocity.PanTilt.x = 0.5; + req.Velocity.PanTilt.y = 0; + strcpy(req.ProfileToken, p_dev->onvif_device.curProfile->token); + + onvif_ptz_ContinuousMove(&p_dev->onvif_device, &req, NULL); +} + +void ptzLeftDown(ONVIF_DEVICE_EX * p_dev) +{ + if (NULL == p_dev || + !p_dev->onvif_device.Capabilities.ptz.support || + NULL == p_dev->onvif_device.curProfile) + { + return; + } + + ptz_ContinuousMove_REQ req; + memset(&req, 0, sizeof(req)); + + req.Velocity.PanTiltFlag = 1; + req.Velocity.PanTilt.x = -0.5; + req.Velocity.PanTilt.y = -0.5; + strcpy(req.ProfileToken, p_dev->onvif_device.curProfile->token); + + onvif_ptz_ContinuousMove(&p_dev->onvif_device, &req, NULL); +} + +void ptzDown(ONVIF_DEVICE_EX * p_dev) +{ + if (NULL == p_dev || + !p_dev->onvif_device.Capabilities.ptz.support || + NULL == p_dev->onvif_device.curProfile) + { + return; + } + + ptz_ContinuousMove_REQ req; + memset(&req, 0, sizeof(req)); + + req.Velocity.PanTiltFlag = 1; + req.Velocity.PanTilt.x = 0; + req.Velocity.PanTilt.y = -0.5; + strcpy(req.ProfileToken, p_dev->onvif_device.curProfile->token); + + onvif_ptz_ContinuousMove(&p_dev->onvif_device, &req, NULL); +} + +void ptzRightDown(ONVIF_DEVICE_EX * p_dev) +{ + if (NULL == p_dev || + !p_dev->onvif_device.Capabilities.ptz.support || + NULL == p_dev->onvif_device.curProfile) + { + return; + } + + ptz_ContinuousMove_REQ req; + memset(&req, 0, sizeof(req)); + + req.Velocity.PanTiltFlag = 1; + req.Velocity.PanTilt.x = 0.5; + req.Velocity.PanTilt.y = -0.5; + strcpy(req.ProfileToken, p_dev->onvif_device.curProfile->token); + + onvif_ptz_ContinuousMove(&p_dev->onvif_device, &req, NULL); +} + +void ptzZoomIn(ONVIF_DEVICE_EX * p_dev) +{ + if (NULL == p_dev || + !p_dev->onvif_device.Capabilities.ptz.support || + NULL == p_dev->onvif_device.curProfile) + { + return; + } + + ptz_ContinuousMove_REQ req; + memset(&req, 0, sizeof(req)); + + req.Velocity.ZoomFlag = 1; + req.Velocity.Zoom.x = -0.5; + strcpy(req.ProfileToken, p_dev->onvif_device.curProfile->token); + + onvif_ptz_ContinuousMove(&p_dev->onvif_device, &req, NULL); +} + +void ptzZoomOut(ONVIF_DEVICE_EX * p_dev) +{ + if (NULL == p_dev || + !p_dev->onvif_device.Capabilities.ptz.support || + NULL == p_dev->onvif_device.curProfile) + { + return; + } + + ptz_ContinuousMove_REQ req; + memset(&req, 0, sizeof(req)); + + req.Velocity.ZoomFlag = 1; + req.Velocity.Zoom.x = 0.5; + strcpy(req.ProfileToken, p_dev->onvif_device.curProfile->token); + + onvif_ptz_ContinuousMove(&p_dev->onvif_device, &req, NULL); +} + +void ptzHome(ONVIF_DEVICE_EX * p_dev) +{ + if (NULL == p_dev || + !p_dev->onvif_device.Capabilities.ptz.support || + NULL == p_dev->onvif_device.curProfile) + { + return; + } + + ptz_GotoHomePosition_REQ req; + memset(&req, 0, sizeof(req)); + + strcpy(req.ProfileToken, p_dev->onvif_device.curProfile->token); + + onvif_ptz_GotoHomePosition(&p_dev->onvif_device, &req, NULL); +} + +void ptzStop(ONVIF_DEVICE_EX * p_dev) +{ + if (NULL == p_dev || + !p_dev->onvif_device.Capabilities.ptz.support || + NULL == p_dev->onvif_device.curProfile) + { + return; + } + + ptz_Stop_REQ req; + memset(&req, 0, sizeof(req)); + + req.ZoomFlag = 1; + req.Zoom = TRUE; + req.PanTiltFlag = 1; + req.PanTilt = TRUE; + strcpy(req.ProfileToken, p_dev->onvif_device.curProfile->token); + + onvif_ptz_Stop(&p_dev->onvif_device, &req, NULL); +} + + +int main(int argc, char* argv[]) +{ + network_init(); + + // open log file + log_init("onviftest.log"); + log_set_level(HT_LOG_DBG); + + // init sys buffer + sys_buf_init(10 * MAX_DEV_NUMS); + + // init http message buffer + http_msg_buf_init(10 * MAX_DEV_NUMS); + + // max support 100 devices + m_dev_fl = pps_ctx_fl_init(100, sizeof(ONVIF_DEVICE_EX), TRUE); + m_dev_ul = pps_ctx_ul_init(m_dev_fl, TRUE); + + // init event handler + // bind the http server to 0.0.0.0:30100 + onvif_event_init(NULL, 30100, MAX_DEV_NUMS); + + // set event callback + onvif_set_event_notify_cb(eventNotifyCallback, 0); + + // set event subscribe disconnect callback + onvif_set_subscribe_disconnect_cb(subscribeDisconnectCallback, 0); + + // set probe callback + set_probe_cb(probeCallback, 0); + + // start probe thread + start_probe(NULL, 30); + + // start device state detect + startStateDetect(); + + for (;;) + { + if (getchar() == 'q') + { + break; + } + + sleep(1); + } + + stopStateDetect(); + + stop_probe(); + + onvif_event_deinit(); + + clearDevices(); + + pps_ul_free(m_dev_ul); + pps_fl_free(m_dev_fl); + + http_msg_buf_deinit(); + sys_buf_deinit(); + + log_close(); + + return 0; +} + + + diff --git a/MediaClient/happytime-onvif-client-library1/OnvifTest/OnvifTest.vcxproj b/MediaClient/happytime-onvif-client-library1/OnvifTest/OnvifTest.vcxproj new file mode 100644 index 0000000..02f183d --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifTest/OnvifTest.vcxproj @@ -0,0 +1,202 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {07B68620-49A2-49E9-BE75-5FBFDBD51A94} + OnvifTest + Win32Proj + 10.0 + + + + Application + Unicode + true + v143 + + + Application + Unicode + true + v143 + + + Application + Unicode + v143 + + + Application + Unicode + v143 + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + ..\bin\x86\ + ..\bin\x64\ + $(Platform)\$(ProjectName)\$(Configuration)\ + $(Platform)\$(ProjectName)\$(Configuration)\ + true + true + ..\bin\x86\ + ..\bin\x64\ + $(Platform)\$(ProjectName)\$(Configuration)\ + $(Platform)\$(ProjectName)\$(Configuration)\ + false + false + AllRules.ruleset + AllRules.ruleset + + + + + AllRules.ruleset + AllRules.ruleset + + + + + $(ProjectName)D + $(ProjectName)D + + + + Disabled + .;..\OnvifClientLibrary\bm;..\OnvifClientLibrary\http;..\OnvifClientLibrary\onvif;%(AdditionalIncludeDirectories) + _DEBUG;_CONSOLE;PROFILE_C_SUPPORT;PROFILE_G_SUPPORT;THERMAL_SUPPORT;CREDENTIAL_SUPPORT;ACCESS_RULES;SCHEDULE_SUPPORT;RECEIVER_SUPPORT;IPFILTER_SUPPORT;DEVICEIO_SUPPORT;PROVISIONING_SUPPORT;%(PreprocessorDefinitions) + false + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + 4996;%(DisableSpecificWarnings) + + + winmm.lib;OnvifClientLibrary.lib;%(AdditionalDependencies) + $(OutDir)\$(ProjectName)D.exe + ..\lib\x86;..\OnvifClientLibrary\openssl\lib\x86;%(AdditionalLibraryDirectories) + true + Console + MachineX86 + + + + + Disabled + .;..\OnvifClientLibrary\bm;..\OnvifClientLibrary\http;..\OnvifClientLibrary\onvif;%(AdditionalIncludeDirectories) + _DEBUG;_CONSOLE;PROFILE_C_SUPPORT;PROFILE_G_SUPPORT;THERMAL_SUPPORT;CREDENTIAL_SUPPORT;ACCESS_RULES;SCHEDULE_SUPPORT;RECEIVER_SUPPORT;IPFILTER_SUPPORT;DEVICEIO_SUPPORT;PROVISIONING_SUPPORT;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + 4996;%(DisableSpecificWarnings) + + + ws2_32.lib;OnvifClientLibrary.lib;%(AdditionalDependencies) + $(OutDir)\$(ProjectName)D.exe + ..\lib\x64;..\OnvifClientLibrary\openssl\lib\x64;%(AdditionalLibraryDirectories) + true + Console + + + + + MaxSpeed + true + .;..\OnvifClientLibrary\bm;..\OnvifClientLibrary\http;..\OnvifClientLibrary\onvif;%(AdditionalIncludeDirectories) + NDEBUG;_CONSOLE;PROFILE_C_SUPPORT;PROFILE_G_SUPPORT;THERMAL_SUPPORT;CREDENTIAL_SUPPORT;ACCESS_RULES;SCHEDULE_SUPPORT;RECEIVER_SUPPORT;IPFILTER_SUPPORT;DEVICEIO_SUPPORT;PROVISIONING_SUPPORT;%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level3 + ProgramDatabase + 4996;%(DisableSpecificWarnings) + + + winmm.lib;OnvifClientLibrary.lib;%(AdditionalDependencies) + $(OutDir)\$(ProjectName).exe + ..\lib\x86;..\OnvifClientLibrary\openssl\lib\x86;%(AdditionalLibraryDirectories) + true + Console + true + true + MachineX86 + + + + + MaxSpeed + true + .;..\OnvifClientLibrary\bm;..\OnvifClientLibrary\http;..\OnvifClientLibrary\onvif;%(AdditionalIncludeDirectories) + NDEBUG;_CONSOLE;PROFILE_C_SUPPORT;PROFILE_G_SUPPORT;THERMAL_SUPPORT;CREDENTIAL_SUPPORT;ACCESS_RULES;SCHEDULE_SUPPORT;RECEIVER_SUPPORT;IPFILTER_SUPPORT;DEVICEIO_SUPPORT;PROVISIONING_SUPPORT;%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level3 + ProgramDatabase + 4996;%(DisableSpecificWarnings) + + + OnvifClientLibrary.lib;ws2_32.lib;%(AdditionalDependencies) + $(OutDir)\$(ProjectName).exe + ..\lib\x64;..\OnvifClientLibrary\openssl\lib\x64;%(AdditionalLibraryDirectories) + true + Console + true + true + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MediaClient/happytime-onvif-client-library1/OnvifTest/config.h b/MediaClient/happytime-onvif-client-library1/OnvifTest/config.h new file mode 100644 index 0000000..7e4e49f --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifTest/config.h @@ -0,0 +1,47 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef CONFIG_H +#define CONFIG_H + +#include "sys_inc.h" +#include "onvif.h" + + +typedef struct +{ + ONVIF_DEVICE onvif_device; + + int flags; // FLAG_MANUAL mean added manual, other auto discovery device + int state; // 0 -- offline; 1 -- online + + void * p_user; // user data + + pthread_t thread_handler; // get information thread handler + BOOL need_update; // if update device information + + int snapshot_len; // devcie snapshot buffer length + uint8 * snapshot; // device snapshot buffer +} ONVIF_DEVICE_EX; + + +#endif + + + diff --git a/MediaClient/happytime-onvif-client-library1/OnvifTest/mac.mk b/MediaClient/happytime-onvif-client-library1/OnvifTest/mac.mk new file mode 100644 index 0000000..7673dd9 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifTest/mac.mk @@ -0,0 +1,66 @@ +################OPTION################### +OUTPUT = onviftest +CCOMPILE = gcc +CPPCOMPILE = g++ +COMPILEOPTION = -g -c -Wall +COMPILEOPTION += -DIOS +COMPILEOPTION += -DPROFILE_C_SUPPORT +COMPILEOPTION += -DPROFILE_G_SUPPORT +COMPILEOPTION += -DTHERMAL_SUPPORT +COMPILEOPTION += -DCREDENTIAL_SUPPORT +COMPILEOPTION += -DACCESS_RULES +COMPILEOPTION += -DSCHEDULE_SUPPORT +COMPILEOPTION += -DRECEIVER_SUPPORT +COMPILEOPTION += -DIPFILTER_SUPPORT +COMPILEOPTION += -DDEVICEIO_SUPPORT +COMPILEOPTION += -DPROVISIONING_SUPPORT +COMPILEOPTION += -DHTTPS +LINK = g++ +LINKOPTION = -g -o $(OUTPUT) +INCLUDEDIR += -I../OnvifClientLibrary/bm +INCLUDEDIR += -I../OnvifClientLibrary/http +INCLUDEDIR += -I../OnvifClientLibrary/onvif +LIBDIRS += -L../OnvifClientLibrary +LIBDIRS += -L../OnvifClientLibrary/openssl/lib/linux +OBJS = OnvifTest.o +SHAREDLIB += -lonvifclient +SHAREDLIB += -lpthread + +ifneq ($(findstring HTTPS, $(COMPILEOPTION)),) +SHAREDLIB += -lcrypto +SHAREDLIB += -lssl +endif + +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 + diff --git a/MediaClient/happytime-onvif-client-library1/OnvifTest/onviftest-1.log b/MediaClient/happytime-onvif-client-library1/OnvifTest/onviftest-1.log new file mode 100644 index 0000000..a248e7e --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifTest/onviftest-1.log @@ -0,0 +1,1848 @@ +[2024-07-20 05:06:43] : [INFO] net_buf_init, num = 100 +[2024-07-20 05:06:43] : [INFO] hdrv_buf_init, num = 800 +[2024-07-20 05:06:43] : [INFO] onvif_probe_thread, probe init, ip=10.5.0.2 +[2024-07-20 05:06:43] : [INFO] onvif_probe_thread, probe init, ip=192.168.1.23 +[2024-07-20 05:06:43] : [DEBUG] onvif_probe_net_rx, len = 787, rbuf =
uuid:5b8e293d-4aaf-5e7c-191a-299c57cb1158urn:schemas-xmlsoap-org:ws:2005:04:discoveryhttp://schemas.xmlsoap.org/ws/2005/04/discovery/Probe
tds:Device
+[2024-07-20 05:06:43] : [DEBUG] onvif_probe_net_rx, len = 787, rbuf =
uuid:44af418e-695d-2f11-5519-352c2bc4115furn:schemas-xmlsoap-org:ws:2005:04:discoveryhttp://schemas.xmlsoap.org/ws/2005/04/discovery/Probe
tds:Device
+[2024-07-20 05:06:43] : [DEBUG] onvif_probe_net_rx, len = 803, rbuf =
uuid:501f3566-5a06-06c7-771a-6f6401c8115burn:schemas-xmlsoap-org:ws:2005:04:discoveryhttp://schemas.xmlsoap.org/ws/2005/04/discovery/Probe
dn:NetworkVideoTransmitter
+[2024-07-20 05:06:43] : [DEBUG] onvif_probe_net_rx, len = 803, rbuf =
uuid:39404db7-78b3-575c-3318-7af555c01162urn:schemas-xmlsoap-org:ws:2005:04:discoveryhttp://schemas.xmlsoap.org/ws/2005/04/discovery/Probe
dn:NetworkVideoTransmitter
+[2024-07-20 05:06:43] : [DEBUG] onvif_probe_net_rx, len = 1327, rbuf = +http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymoushttp://schemas.xmlsoap.org/ws/2005/04/discovery/ProbeMatchesurn:uuid:af492b39-b377-4d6c-bc8b-e797b89d31a1uuid:44af418e-695d-2f11-5519-352c2bc4115furn:uuid:5e337fc0-be64-4e8c-84bd-754270482921wsdp:Device pub:Computerhttp://ANSNAS:5357/5e337fc0-be64-4e8c-84bd-7542704829212 + +[2024-07-20 05:06:43] : [DEBUG] onvif_probe_net_rx, len = 1327, rbuf = +http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymoushttp://schemas.xmlsoap.org/ws/2005/04/discovery/ProbeMatchesurn:uuid:06ee5b24-e61e-4052-8f6e-9bf5b87308cduuid:39404db7-78b3-575c-3318-7af555c01162urn:uuid:5e337fc0-be64-4e8c-84bd-754270482921wsdp:Device pub:Computerhttp://ANSNAS:5357/5e337fc0-be64-4e8c-84bd-7542704829212 + +[2024-07-20 05:06:43] : [DEBUG] onvif_probe_net_rx, len = 4025, rbuf = +uuid:2419d68a-2dd2-21b2-a205-EC:71:DB:F8:53:B6uuid:44af418e-695d-2f11-5519-352c2bc4115fhttp://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymoushttp://schemas.xmlsoap.org/ws/2005/04/discovery/ProbeMatchesurn:uuid:2419d68a-2dd2-21b2-a205-EC:71:DB:F8:53:B6ttltdn:NetworkVideoTransmitter onvif://www.onvif.org/type/video_encoder onvif://www.onvif.org/location/country/china onvif://www.onvif.org/type/network_video_transmitter onvif://www.onvif.org/hardware/IPC-122 onvif://www.onvif.org/Profile/Streaming onvif://www.onvif.org/name/IPC-BOhttp://192.168.1.87:8000/onvif/device_service1 + +[2024-07-20 05:06:43] : [DEBUG] onvif_probe_net_rx, len = 4025, rbuf = +uuid:2419d68a-2dd2-21b2-a205-EC:71:DB:F8:53:B6uuid:39404db7-78b3-575c-3318-7af555c01162http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymoushttp://schemas.xmlsoap.org/ws/2005/04/discovery/ProbeMatchesurn:uuid:2419d68a-2dd2-21b2-a205-EC:71:DB:F8:53:B6ttltdn:NetworkVideoTransmitter onvif://www.onvif.org/type/video_encoder onvif://www.onvif.org/location/country/china onvif://www.onvif.org/type/network_video_transmitter onvif://www.onvif.org/hardware/IPC-122 onvif://www.onvif.org/Profile/Streaming onvif://www.onvif.org/name/IPC-BOhttp://192.168.1.87:8000/onvif/device_service1 + +[2024-07-20 05:06:43] : [DEBUG] TX >> POST /onvif/device_service HTTP/1.1 +Host: 192.168.1.87:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetSystemDateAndTime" +Content-Length: 2282 +Connection: close + +[2024-07-20 05:06:43] : [DEBUG] adminmfpVTYuZp7Idh9fB9VdJuUs+Uhk=OWFiOTQzY2E1NDAwMDAyOQ==2024-07-19T19:06:43Z + +[2024-07-20 05:06:43] : [DEBUG] onvif_probe_net_rx, len = 4026, rbuf = +uuid:2419d68a-2dd2-21b2-a205-ec:71:db:f2:bc:9euuid:44af418e-695d-2f11-5519-352c2bc4115fhttp://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymoushttp://schemas.xmlsoap.org/ws/2005/04/discovery/ProbeMatchesurn:uuid:2419d68a-2dd2-21b2-a205-ec:71:db:f2:bc:9ettltdn:NetworkVideoTransmitter onvif://www.onvif.org/type/video_encoder onvif://www.onvif.org/location/country/china onvif://www.onvif.org/type/network_video_transmitter onvif://www.onvif.org/hardware/IPC-122 onvif://www.onvif.org/Profile/Streaming onvif://www.onvif.org/name/IPC-BOhttp://192.168.1.237:8000/onvif/device_service1 + +[2024-07-20 05:06:43] : [DEBUG] TX >> POST /onvif/device_service HTTP/1.1 +Host: 192.168.1.237:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetSystemDateAndTime" +Content-Length: 2282 +Connection: close + +[2024-07-20 05:06:43] : [DEBUG] adminDpdL5svvTU0GDiPSe7vpah055GQ=OWFiOTQzY2E1NTAwMDAyOQ==2024-07-19T19:06:43Z + +[2024-07-20 05:06:43] : [DEBUG] RX from 192.168.1.87 << HTTP/1.1 200 OK +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetSystemDateAndTime" +Content-Length: 3645 +Connection: close + + +[2024-07-20 05:06:43] : [DEBUG] +ManualfalseGMT+8:00:00DST+7:00:00,M3.2.0/02:00:00,M10.5.0/02:00:00196422024719116422024719 + + +[2024-07-20 05:06:43] : [DEBUG] onvif_probe_net_rx, len = 4026, rbuf = +uuid:2419d68a-2dd2-21b2-a205-ec:71:db:f2:bc:9euuid:44af418e-695d-2f11-5519-352c2bc4115fhttp://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymoushttp://schemas.xmlsoap.org/ws/2005/04/discovery/ProbeMatchesurn:uuid:2419d68a-2dd2-21b2-a205-ec:71:db:f2:bc:9ettltdn:NetworkVideoTransmitter onvif://www.onvif.org/type/video_encoder onvif://www.onvif.org/location/country/china onvif://www.onvif.org/type/network_video_transmitter onvif://www.onvif.org/hardware/IPC-122 onvif://www.onvif.org/Profile/Streaming onvif://www.onvif.org/name/IPC-BOhttp://192.168.1.237:8000/onvif/device_service1 + +[2024-07-20 05:06:43] : [DEBUG] TX >> POST /onvif/device_service HTTP/1.1 +Host: 192.168.1.87:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetCapabilities" +Content-Length: 2329 +Connection: close + +[2024-07-20 05:06:43] : [DEBUG] adminOzB9uLrwRngnFknnYWVN+OalKx8=OWFiOTQzY2E1NjAwNDgyMw==2024-07-19T19:06:42ZAll + +[2024-07-20 05:06:43] : [DEBUG] onvif_probe_net_rx, len = 4026, rbuf = +uuid:2419d68a-2dd2-21b2-a205-5c:c3:36:56:71:cauuid:44af418e-695d-2f11-5519-352c2bc4115fhttp://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymoushttp://schemas.xmlsoap.org/ws/2005/04/discovery/ProbeMatchesurn:uuid:2419d68a-2dd2-21b2-a205-5c:c3:36:56:71:cattltdn:NetworkVideoTransmitter onvif://www.onvif.org/type/video_encoder onvif://www.onvif.org/location/country/china onvif://www.onvif.org/type/network_video_transmitter onvif://www.onvif.org/hardware/IPC-122 onvif://www.onvif.org/Profile/Streaming onvif://www.onvif.org/name/IPC-BOhttp://192.168.1.175:8000/onvif/device_service1 + +[2024-07-20 05:06:43] : [DEBUG] onvif_probe_net_rx, len = 3187, rbuf = +uuid:00070524-2232-0132-2421-4c50dddae079uuid:44af418e-695d-2f11-5519-352c2bc4115fhttp://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymoushttp://schemas.xmlsoap.org/ws/2005/04/discovery/ProbeMatchesurn:uuid:00070524-2232-0132-2421-4c50dddae079tds:Device tdn:NetworkVideoTransmitter onvif://www.onvif.org/type/video_encoder onvif://www.onvif.org/location/country/china onvif://www.onvif.org/type/network_video_transmitter onvif://www.onvif.org/Profile/Streaming onvif://www.onvif.org/Profile/T onvif://www.onvif.org/name/IPC-BO onvif://www.onvif.org/hardware/E1Pro onvif://www.onvif.org/name/IPChttp://192.168.1.203:8000/onvif/device_service1 + +[2024-07-20 05:06:43] : [DEBUG] onvif_probe_net_rx, len = 3187, rbuf = +uuid:00070524-2019-2208-0016-4c50dd42bed2uuid:44af418e-695d-2f11-5519-352c2bc4115fhttp://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymoushttp://schemas.xmlsoap.org/ws/2005/04/discovery/ProbeMatchesurn:uuid:00070524-2019-2208-0016-4c50dd42bed2tds:Device tdn:NetworkVideoTransmitter onvif://www.onvif.org/type/video_encoder onvif://www.onvif.org/location/country/china onvif://www.onvif.org/type/network_video_transmitter onvif://www.onvif.org/Profile/Streaming onvif://www.onvif.org/Profile/T onvif://www.onvif.org/name/IPC-BO onvif://www.onvif.org/hardware/E1Pro onvif://www.onvif.org/name/IPChttp://192.168.1.202:8000/onvif/device_service1 + +[2024-07-20 05:06:43] : [DEBUG] onvif_probe_net_rx, len = 4026, rbuf = +uuid:2419d68a-2dd2-21b2-a205-ec:71:db:f2:bc:9euuid:39404db7-78b3-575c-3318-7af555c01162http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymoushttp://schemas.xmlsoap.org/ws/2005/04/discovery/ProbeMatchesurn:uuid:2419d68a-2dd2-21b2-a205-ec:71:db:f2:bc:9ettltdn:NetworkVideoTransmitter onvif://www.onvif.org/type/video_encoder onvif://www.onvif.org/location/country/china onvif://www.onvif.org/type/network_video_transmitter onvif://www.onvif.org/hardware/IPC-122 onvif://www.onvif.org/Profile/Streaming onvif://www.onvif.org/name/IPC-BOhttp://192.168.1.237:8000/onvif/device_service1 + +[2024-07-20 05:06:43] : [DEBUG] RX from 192.168.1.87 << HTTP/1.1 200 OK +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetCapabilities" +Content-Length: 5061 +Connection: close + + +[2024-07-20 05:06:43] : [DEBUG] +http://192.168.1.87:8000/onvif/analytics_servicefalsefalsehttp://192.168.1.87:8000/onvif/device_servicefalsefalsefalsefalsefalsefalsetruefalsefalsefalse21falsefalsefalsefalsefalsefalsefalsefalsehttp://192.168.1.87:8000/onvif/event_servicetruetruefalsehttp://192.168.1.87:8000/onvif/imaging_servicehttp://192.168.1.87:8000/onvif/media_servicefalsetruetrue10http://192.168.1.87:8000/onvif/ptz_service + + +[2024-07-20 05:06:43] : [DEBUG] onvif_probe_net_rx, len = 4026, rbuf = +uuid:2419d68a-2dd2-21b2-a205-5c:c3:36:56:71:cauuid:44af418e-695d-2f11-5519-352c2bc4115fhttp://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymoushttp://schemas.xmlsoap.org/ws/2005/04/discovery/ProbeMatchesurn:uuid:2419d68a-2dd2-21b2-a205-5c:c3:36:56:71:cattltdn:NetworkVideoTransmitter onvif://www.onvif.org/type/video_encoder onvif://www.onvif.org/location/country/china onvif://www.onvif.org/type/network_video_transmitter onvif://www.onvif.org/hardware/IPC-122 onvif://www.onvif.org/Profile/Streaming onvif://www.onvif.org/name/IPC-BOhttp://192.168.1.175:8000/onvif/device_service1 + +[2024-07-20 05:06:43] : [DEBUG] TX >> POST /onvif/device_service HTTP/1.1 +Host: 192.168.1.87:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetServices" +Content-Length: 2340 +Connection: close + +[2024-07-20 05:06:43] : [DEBUG] adminsfIVumj5PnCb4z9+7K8zN2yJco0=OWFiOTQzY2E1YTAwMThiZQ==2024-07-19T19:06:42Ztrue + +[2024-07-20 05:06:43] : [DEBUG] TX >> POST /onvif/device_service HTTP/1.1 +Host: 192.168.1.175:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetSystemDateAndTime" +Content-Length: 2282 +Connection: close + +[2024-07-20 05:06:43] : [DEBUG] adminfwfWNnUcQEQcRV8EdzGiGqFyZlc=OWFiOTQzY2E1NzAwMDAyOQ==2024-07-19T19:06:43Z + +[2024-07-20 05:06:43] : [DEBUG] RX from 192.168.1.237 << HTTP/1.1 200 OK +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetSystemDateAndTime" +Content-Length: 3646 +Connection: close + + +[2024-07-20 05:06:43] : [DEBUG] +ManualfalseGMT-10:00:00DST-11:00:00,M10.1.0/02:00:00,M4.1.0/03:00:0019642202471956422024720 + + +[2024-07-20 05:06:43] : [DEBUG] onvif_probe_net_rx, len = 4026, rbuf = +uuid:2419d68a-2dd2-21b2-a205-ec:71:db:f2:bc:9euuid:39404db7-78b3-575c-3318-7af555c01162http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymoushttp://schemas.xmlsoap.org/ws/2005/04/discovery/ProbeMatchesurn:uuid:2419d68a-2dd2-21b2-a205-ec:71:db:f2:bc:9ettltdn:NetworkVideoTransmitter onvif://www.onvif.org/type/video_encoder onvif://www.onvif.org/location/country/china onvif://www.onvif.org/type/network_video_transmitter onvif://www.onvif.org/hardware/IPC-122 onvif://www.onvif.org/Profile/Streaming onvif://www.onvif.org/name/IPC-BOhttp://192.168.1.237:8000/onvif/device_service1 + +[2024-07-20 05:06:43] : [DEBUG] onvif_probe_net_rx, len = 3187, rbuf = +uuid:00070524-2232-0132-2421-4c50dddae079uuid:44af418e-695d-2f11-5519-352c2bc4115fhttp://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymoushttp://schemas.xmlsoap.org/ws/2005/04/discovery/ProbeMatchesurn:uuid:00070524-2232-0132-2421-4c50dddae079tds:Device tdn:NetworkVideoTransmitter onvif://www.onvif.org/type/video_encoder onvif://www.onvif.org/location/country/china onvif://www.onvif.org/type/network_video_transmitter onvif://www.onvif.org/Profile/Streaming onvif://www.onvif.org/Profile/T onvif://www.onvif.org/name/IPC-BO onvif://www.onvif.org/hardware/E1Pro onvif://www.onvif.org/name/IPChttp://192.168.1.203:8000/onvif/device_service1 + +[2024-07-20 05:06:43] : [DEBUG] TX >> POST /onvif/device_service HTTP/1.1 +Host: 192.168.1.203:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetSystemDateAndTime" +Content-Length: 2282 +Connection: close + +[2024-07-20 05:06:43] : [DEBUG] adminjYcPdx7AmDva/bu4anjNClyQqa8=OWFiOTQzY2E1ODAwMDAyOQ==2024-07-19T19:06:43Z + +[2024-07-20 05:06:43] : [DEBUG] RX from 192.168.1.87 << HTTP/1.1 200 OK +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetServices" +Content-Length: 4133 +Connection: close + + +[2024-07-20 05:06:43] : [DEBUG] +http://www.onvif.org/ver10/device/wsdlhttp://192.168.1.87:8000/onvif/device_service21http://www.onvif.org/ver20/analytics/wsdlhttp://192.168.1.87:8000/onvif/analytics_service21http://www.onvif.org/ver20/imaging/wsdlhttp://192.168.1.87:8000/onvif/imaging_service21http://www.onvif.org/ver10/media/wsdlhttp://192.168.1.87:8000/onvif/media_service21http://www.onvif.org/ver10/events/wsdlhttp://192.168.1.87:8000/onvif/event_service21 + + +[2024-07-20 05:06:43] : [DEBUG] TX >> POST /onvif/device_service HTTP/1.1 +Host: 192.168.1.237:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetCapabilities" +Content-Length: 2329 +Connection: close + +[2024-07-20 05:06:43] : [DEBUG] adminnGtXKrdp+6ms6PmmoQdVjwIhLuc=OWFiOTQzY2E1YjAwNDgyMw==2024-07-19T19:06:42ZAll + +[2024-07-20 05:06:43] : [DEBUG] onvif_probe_net_rx, len = 3187, rbuf = +uuid:00070524-2019-2208-0016-4c50dd42bed2uuid:44af418e-695d-2f11-5519-352c2bc4115fhttp://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymoushttp://schemas.xmlsoap.org/ws/2005/04/discovery/ProbeMatchesurn:uuid:00070524-2019-2208-0016-4c50dd42bed2tds:Device tdn:NetworkVideoTransmitter onvif://www.onvif.org/type/video_encoder onvif://www.onvif.org/location/country/china onvif://www.onvif.org/type/network_video_transmitter onvif://www.onvif.org/Profile/Streaming onvif://www.onvif.org/Profile/T onvif://www.onvif.org/name/IPC-BO onvif://www.onvif.org/hardware/E1Pro onvif://www.onvif.org/name/IPChttp://192.168.1.202:8000/onvif/device_service1 + +[2024-07-20 05:06:43] : [DEBUG] TX >> POST /onvif/device_service HTTP/1.1 +Host: 192.168.1.202:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetSystemDateAndTime" +Content-Length: 2282 +Connection: close + +[2024-07-20 05:06:43] : [DEBUG] adming78ahXhpkEZtnJxx5hkcH1bvNi4=OWFiOTQzY2E1OTAwMDAyOQ==2024-07-19T19:06:43Z + +[2024-07-20 05:06:43] : [DEBUG] TX >> POST /onvif/device_service HTTP/1.1 +Host: 192.168.1.87:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetDeviceInformation" +Content-Length: 2282 +Connection: close + +[2024-07-20 05:06:43] : [DEBUG] adminXFKW74PZm9m0HgrWrxIkCNvkhMM=OWFiOTQzY2E1YzAwNjc4NA==2024-07-19T19:06:42Z + +[2024-07-20 05:06:43] : [DEBUG] onvif_probe_net_rx, len = 4026, rbuf = +uuid:2419d68a-2dd2-21b2-a205-5c:c3:36:56:71:cauuid:39404db7-78b3-575c-3318-7af555c01162http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymoushttp://schemas.xmlsoap.org/ws/2005/04/discovery/ProbeMatchesurn:uuid:2419d68a-2dd2-21b2-a205-5c:c3:36:56:71:cattltdn:NetworkVideoTransmitter onvif://www.onvif.org/type/video_encoder onvif://www.onvif.org/location/country/china onvif://www.onvif.org/type/network_video_transmitter onvif://www.onvif.org/hardware/IPC-122 onvif://www.onvif.org/Profile/Streaming onvif://www.onvif.org/name/IPC-BOhttp://192.168.1.175:8000/onvif/device_service1 + +[2024-07-20 05:06:43] : [DEBUG] onvif_probe_net_rx, len = 3187, rbuf = +uuid:00070524-2019-2208-0016-4c50dd42bed2uuid:39404db7-78b3-575c-3318-7af555c01162http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymoushttp://schemas.xmlsoap.org/ws/2005/04/discovery/ProbeMatchesurn:uuid:00070524-2019-2208-0016-4c50dd42bed2tds:Device tdn:NetworkVideoTransmitter onvif://www.onvif.org/type/video_encoder onvif://www.onvif.org/location/country/china onvif://www.onvif.org/type/network_video_transmitter onvif://www.onvif.org/Profile/Streaming onvif://www.onvif.org/Profile/T onvif://www.onvif.org/name/IPC-BO onvif://www.onvif.org/hardware/E1Pro onvif://www.onvif.org/name/IPChttp://192.168.1.202:8000/onvif/device_service1 + +[2024-07-20 05:06:43] : [DEBUG] RX from 192.168.1.87 << HTTP/1.1 400 Bad Request +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 3267 +Connection: close + + +[2024-07-20 05:06:43] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedSender not Authorized + + +[2024-07-20 05:06:43] : [DEBUG] onvif_probe_net_rx, len = 3187, rbuf = +uuid:00070524-2232-0132-2421-4c50dddae079uuid:39404db7-78b3-575c-3318-7af555c01162http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymoushttp://schemas.xmlsoap.org/ws/2005/04/discovery/ProbeMatchesurn:uuid:00070524-2232-0132-2421-4c50dddae079tds:Device tdn:NetworkVideoTransmitter onvif://www.onvif.org/type/video_encoder onvif://www.onvif.org/location/country/china onvif://www.onvif.org/type/network_video_transmitter onvif://www.onvif.org/Profile/Streaming onvif://www.onvif.org/Profile/T onvif://www.onvif.org/name/IPC-BO onvif://www.onvif.org/hardware/E1Pro onvif://www.onvif.org/name/IPChttp://192.168.1.203:8000/onvif/device_service1 + +[2024-07-20 05:06:43] : [DEBUG] RX from 192.168.1.175 << HTTP/1.1 200 OK +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetSystemDateAndTime" +Content-Length: 3646 +Connection: close + + +[2024-07-20 05:06:43] : [DEBUG] +ManualfalseGMT-10:00:00DST-11:00:00,M10.1.0/02:00:00,M4.1.0/03:00:0019642202471956422024720 + + +[2024-07-20 05:06:43] : [DEBUG] onvif_probe_net_rx, len = 4026, rbuf = +uuid:2419d68a-2dd2-21b2-a205-5c:c3:36:56:71:cauuid:39404db7-78b3-575c-3318-7af555c01162http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymoushttp://schemas.xmlsoap.org/ws/2005/04/discovery/ProbeMatchesurn:uuid:2419d68a-2dd2-21b2-a205-5c:c3:36:56:71:cattltdn:NetworkVideoTransmitter onvif://www.onvif.org/type/video_encoder onvif://www.onvif.org/location/country/china onvif://www.onvif.org/type/network_video_transmitter onvif://www.onvif.org/hardware/IPC-122 onvif://www.onvif.org/Profile/Streaming onvif://www.onvif.org/name/IPC-BOhttp://192.168.1.175:8000/onvif/device_service1 + +[2024-07-20 05:06:43] : [DEBUG] TX >> POST /onvif/device_service HTTP/1.1 +Host: 192.168.1.175:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetCapabilities" +Content-Length: 2329 +Connection: close + +[2024-07-20 05:06:43] : [DEBUG] adminzZeLueymOtttNAQv7XAHTYj6ToI=OWFiOTQzY2E1ZDAwNDgyMw==2024-07-19T19:06:42ZAll + +[2024-07-20 05:06:43] : [DEBUG] RX from 192.168.1.202 << HTTP/1.1 200 OK +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetSystemDateAndTime" +Content-Length: 3352 +Connection: close + + +[2024-07-20 05:06:43] : [DEBUG] +adming78ahXhpkEZtnJxx5hkcH1bvNi4=OWFiOTQzY2E1OTAwMDAyOQ==2024-07-19T19:06:43ZNTPtrueCST-10:00:00DST-10:00:00,M10.1.0/02:00:00,M4.1.0/03:00:0019642202471956422024720 + + +[2024-07-20 05:06:43] : [DEBUG] onvif_probe_net_rx, len = 3187, rbuf = +uuid:00070524-2019-2208-0016-4c50dd42bed2uuid:39404db7-78b3-575c-3318-7af555c01162http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymoushttp://schemas.xmlsoap.org/ws/2005/04/discovery/ProbeMatchesurn:uuid:00070524-2019-2208-0016-4c50dd42bed2tds:Device tdn:NetworkVideoTransmitter onvif://www.onvif.org/type/video_encoder onvif://www.onvif.org/location/country/china onvif://www.onvif.org/type/network_video_transmitter onvif://www.onvif.org/Profile/Streaming onvif://www.onvif.org/Profile/T onvif://www.onvif.org/name/IPC-BO onvif://www.onvif.org/hardware/E1Pro onvif://www.onvif.org/name/IPChttp://192.168.1.202:8000/onvif/device_service1 + +[2024-07-20 05:06:43] : [DEBUG] TX >> POST /onvif/device_service HTTP/1.1 +Host: 192.168.1.202:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetCapabilities" +Content-Length: 2329 +Connection: close + +[2024-07-20 05:06:43] : [DEBUG] RX from 192.168.1.203 << HTTP/1.1 200 OK +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetSystemDateAndTime" +Content-Length: 3352 +Connection: close + + +[2024-07-20 05:06:43] : [DEBUG] adminwEv6miFuzOZSKumK5LTCSoh19rc=OWFiOTQzY2E1ZTAwNDgyMw==2024-07-19T19:06:42ZAll + +[2024-07-20 05:06:43] : [DEBUG] +adminjYcPdx7AmDva/bu4anjNClyQqa8=OWFiOTQzY2E1ODAwMDAyOQ==2024-07-19T19:06:43ZNTPtrueCST-10:00:00DST-10:00:00,M10.1.0/02:00:00,M4.1.0/03:00:0019642202471956422024720 + + +[2024-07-20 05:06:43] : [DEBUG] onvif_probe_net_rx, len = 3187, rbuf = +uuid:00070524-2232-0132-2421-4c50dddae079uuid:39404db7-78b3-575c-3318-7af555c01162http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymoushttp://schemas.xmlsoap.org/ws/2005/04/discovery/ProbeMatchesurn:uuid:00070524-2232-0132-2421-4c50dddae079tds:Device tdn:NetworkVideoTransmitter onvif://www.onvif.org/type/video_encoder onvif://www.onvif.org/location/country/china onvif://www.onvif.org/type/network_video_transmitter onvif://www.onvif.org/Profile/Streaming onvif://www.onvif.org/Profile/T onvif://www.onvif.org/name/IPC-BO onvif://www.onvif.org/hardware/E1Pro onvif://www.onvif.org/name/IPChttp://192.168.1.203:8000/onvif/device_service1 + +[2024-07-20 05:06:43] : [DEBUG] RX from 192.168.1.237 << HTTP/1.1 200 OK +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetCapabilities" +Content-Length: 5068 +Connection: close + + +[2024-07-20 05:06:43] : [DEBUG] +http://192.168.1.237:8000/onvif/analytics_servicefalsefalsehttp://192.168.1.237:8000/onvif/device_servicefalsefalsefalsefalsefalsefalsetruefalsefalsefalse210falsefalsefalsefalsefalsefalsefalsefalsehttp://192.168.1.237:8000/onvif/event_servicetruetruefalsehttp://192.168.1.237:8000/onvif/imaging_servicehttp://192.168.1.237:8000/onvif/media_servicefalsetruetrue10http://192.168.1.237:8000/onvif/ptz_service + + +[2024-07-20 05:06:43] : [DEBUG] TX >> POST /onvif/device_service HTTP/1.1 +Host: 192.168.1.203:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetCapabilities" +Content-Length: 2329 +Connection: close + +[2024-07-20 05:06:43] : [DEBUG] admin92m2DV2eO1K01HuXb2hN+hhlUmY=OWFiOTQzY2E1ZjAwNDgyMw==2024-07-19T19:06:42ZAll + +[2024-07-20 05:06:43] : [DEBUG] RX from 192.168.1.175 << HTTP/1.1 200 OK +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetCapabilities" +Content-Length: 5068 +Connection: close + + +[2024-07-20 05:06:43] : [DEBUG] TX >> POST /onvif/device_service HTTP/1.1 +Host: 192.168.1.237:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetServices" +Content-Length: 2340 +Connection: close + +[2024-07-20 05:06:43] : [DEBUG] admin8vsxVKbB4noYRp8g7I7yTMMeUbM=OWFiOTQzY2E2MDAwMThiZQ==2024-07-19T19:06:42Ztrue + +[2024-07-20 05:06:43] : [DEBUG] +http://192.168.1.175:8000/onvif/analytics_servicefalsefalsehttp://192.168.1.175:8000/onvif/device_servicefalsefalsefalsefalsefalsefalsetruefalsefalsefalse210falsefalsefalsefalsefalsefalsefalsefalsehttp://192.168.1.175:8000/onvif/event_servicetruetruefalsehttp://192.168.1.175:8000/onvif/imaging_servicehttp://192.168.1.175:8000/onvif/media_servicefalsetruetrue10http://192.168.1.175:8000/onvif/ptz_service + + +[2024-07-20 05:06:43] : [DEBUG] TX >> POST /onvif/device_service HTTP/1.1 +Host: 192.168.1.175:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetServices" +Content-Length: 2340 +Connection: close + +[2024-07-20 05:06:43] : [DEBUG] admin75lRdqMkuwUShwj3m2I6RdKvnx0=OWFiOTQzY2E2MTAwMThiZQ==2024-07-19T19:06:42Ztrue + +[2024-07-20 05:06:43] : [DEBUG] RX from 192.168.1.237 << HTTP/1.1 200 OK +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetServices" +Content-Length: 4138 +Connection: close + + +[2024-07-20 05:06:43] : [DEBUG] +http://www.onvif.org/ver10/device/wsdlhttp://192.168.1.237:8000/onvif/device_service21http://www.onvif.org/ver20/analytics/wsdlhttp://192.168.1.237:8000/onvif/analytics_service21http://www.onvif.org/ver20/imaging/wsdlhttp://192.168.1.237:8000/onvif/imaging_service21http://www.onvif.org/ver10/media/wsdlhttp://192.168.1.237:8000/onvif/media_service21http://www.onvif.org/ver10/events/wsdlhttp://192.168.1.237:8000/onvif/event_service21 + + +[2024-07-20 05:06:43] : [DEBUG] TX >> POST /onvif/device_service HTTP/1.1 +Host: 192.168.1.237:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetDeviceInformation" +Content-Length: 2282 +Connection: close + +[2024-07-20 05:06:43] : [DEBUG] adminxT+r1xceIE+eGsjWNaJd9EToBLw=OWFiOTQzY2E2MjAwNjc4NA==2024-07-19T19:06:42Z + +[2024-07-20 05:06:43] : [DEBUG] RX from 192.168.1.237 << HTTP/1.1 400 Bad Request +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 3267 +Connection: close + + +[2024-07-20 05:06:43] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedSender not Authorized + + +[2024-07-20 05:06:43] : [DEBUG] RX from 192.168.1.175 << HTTP/1.1 200 OK +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetServices" +Content-Length: 4138 +Connection: close + + +[2024-07-20 05:06:43] : [DEBUG] +http://www.onvif.org/ver10/device/wsdlhttp://192.168.1.175:8000/onvif/device_service21http://www.onvif.org/ver20/analytics/wsdlhttp://192.168.1.175:8000/onvif/analytics_service21http://www.onvif.org/ver20/imaging/wsdlhttp://192.168.1.175:8000/onvif/imaging_service21http://www.onvif.org/ver10/media/wsdlhttp://192.168.1.175:8000/onvif/media_service21http://www.onvif.org/ver10/events/wsdlhttp://192.168.1.175:8000/onvif/event_service21 + + +[2024-07-20 05:06:43] : [DEBUG] TX >> POST /onvif/device_service HTTP/1.1 +Host: 192.168.1.175:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetDeviceInformation" +Content-Length: 2282 +Connection: close + +[2024-07-20 05:06:43] : [DEBUG] adminfVnNuInQ87WNO6cjwRq/R4vb92c=OWFiOTQzY2E2MzAwNjc4NA==2024-07-19T19:06:42Z + +[2024-07-20 05:06:43] : [DEBUG] RX from 192.168.1.175 << HTTP/1.1 400 Bad Request +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 3267 +Connection: close + + +[2024-07-20 05:06:43] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedSender not Authorized + + +[2024-07-20 05:06:43] : [DEBUG] RX from 192.168.1.202 << HTTP/1.1 200 OK +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetCapabilities" +Content-Length: 4929 +Connection: close + + +[2024-07-20 05:06:43] : [DEBUG] +adminwEv6miFuzOZSKumK5LTCSoh19rc=OWFiOTQzY2E1ZTAwNDgyMw==2024-07-19T19:06:42Zhttp://192.168.1.202:8000/onvif/device_servicefalsefalsefalsefalsetruetruefalsefalsefalsefalse216falsefalsefalsefalsefalsefalsefalsefalsehttp://192.168.1.202:8000/onvif/event_servicetruetruefalsehttp://192.168.1.202:8000/onvif/imaging_servicehttp://192.168.1.202:8000/onvif/media_servicefalsetruetrue10http://192.168.1.202:8000/onvif/ptz_servicehttp://192.168.1.202:8000/onvif/deviceIO_service10100 + + +[2024-07-20 05:06:43] : [DEBUG] TX >> POST /onvif/device_service HTTP/1.1 +Host: 192.168.1.202:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetServices" +Content-Length: 2340 +Connection: close + +[2024-07-20 05:06:43] : [DEBUG] adminpo2YwL7kiuKJLTitsv7JVvabWdo=OWFiOTQzY2E2NDAwMThiZQ==2024-07-19T19:06:42Ztrue + +[2024-07-20 05:06:44] : [DEBUG] TX >> POST /onvif/device_service HTTP/1.1 +Host: 192.168.1.87:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetDeviceInformation" +Content-Length: 2282 +Connection: close + +[2024-07-20 05:06:44] : [DEBUG] admin5lDBsK63N9C/h8Sokcc1BJ4O71E=OWFiOTQ0Y2E2NTAwNGFlMQ==2024-07-19T19:06:43Z + +[2024-07-20 05:06:44] : [DEBUG] RX from 192.168.1.87 << HTTP/1.1 400 Bad Request +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 3267 +Connection: close + + +[2024-07-20 05:06:44] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedSender not Authorized + + +[2024-07-20 05:06:44] : [DEBUG] RX from 192.168.1.202 << HTTP/1.1 200 OK +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetServices" +Content-Length: 6165 +Connection: close + + +[2024-07-20 05:06:44] : [DEBUG] +adminpo2YwL7kiuKJLTitsv7JVvabWdo=OWFiOTQzY2E2NDAwMThiZQ==2024-07-19T19:06:42Zhttp://www.onvif.org/ver10/device/wsdlhttp://192.168.1.202:8000/onvif/device_service 216http://www.onvif.org/ver20/imaging/wsdlhttp://192.168.1.202:8000/onvif/imaging_service196http://www.onvif.org/ver10/deviceIO/wsdlhttp://192.168.1.202:8000/onvif/deviceIO_service196http://www.onvif.org/ver20/ptz/wsdlhttp://192.168.1.202:8000/onvif/ptz_service2012http://www.onvif.org/ver10/media/wsdlhttp://192.168.1.202:8000/onvif/media_service206http://www.onvif.org/ver20/media/wsdlhttp://192.168.1.202:8000/onvif/Media2216http://www.onvif.org/ver10/events/wsdlhttp://192.168.1.202:8000/onvif/event_service216 + + +[2024-07-20 05:06:44] : [DEBUG] RX from 192.168.1.203 << HTTP/1.1 200 OK +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetCapabilities" +Content-Length: 4929 +Connection: close + + +[2024-07-20 05:06:44] : [DEBUG] +admin92m2DV2eO1K01HuXb2hN+hhlUmY=OWFiOTQzY2E1ZjAwNDgyMw==2024-07-19T19:06:42Zhttp://192.168.1.203:8000/onvif/device_servicefalsefalsefalsefalsetruetruefalsefalsefalsefalse216falsefalsefalsefalsefalsefalsefalsefalsehttp://192.168.1.203:8000/onvif/event_servicetruetruefalsehttp://192.168.1.203:8000/onvif/imaging_servicehttp://192.168.1.203:8000/onvif/media_servicefalsetruetrue10http://192.168.1.203:8000/onvif/ptz_servicehttp://192.168.1.203:8000/onvif/deviceIO_service10100 + + +[2024-07-20 05:06:44] : [DEBUG] TX >> POST /onvif/device_service HTTP/1.1 +Host: 192.168.1.202:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetDeviceInformation" +Content-Length: 2282 +Connection: close + +[2024-07-20 05:06:44] : [DEBUG] adminIeUriIlksOf504ioLNlQyX9uhh0=OWFiOTQ0Y2E2NjAwNjc4NA==2024-07-19T19:06:43Z + +[2024-07-20 05:06:44] : [DEBUG] TX >> POST /onvif/device_service HTTP/1.1 +Host: 192.168.1.203:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetServices" +Content-Length: 2340 +Connection: close + +[2024-07-20 05:06:44] : [DEBUG] admintcQgsWW3wfm32NZLr93v9HG5d1U=OWFiOTQ0Y2E2NzAwMThiZQ==2024-07-19T19:06:43Ztrue + +[2024-07-20 05:06:44] : [DEBUG] RX from 192.168.1.203 << HTTP/1.1 200 OK +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetServices" +Content-Length: 6165 +Connection: close + + +[2024-07-20 05:06:44] : [DEBUG] +admintcQgsWW3wfm32NZLr93v9HG5d1U=OWFiOTQ0Y2E2NzAwMThiZQ==2024-07-19T19:06:43Zhttp://www.onvif.org/ver10/device/wsdlhttp://192.168.1.203:8000/onvif/device_service 216http://www.onvif.org/ver20/imaging/wsdlhttp://192.168.1.203:8000/onvif/imaging_service196http://www.onvif.org/ver10/deviceIO/wsdlhttp://192.168.1.203:8000/onvif/deviceIO_service196http://www.onvif.org/ver20/ptz/wsdlhttp://192.168.1.203:8000/onvif/ptz_service2012http://www.onvif.org/ver10/media/wsdlhttp://192.168.1.203:8000/onvif/media_service206http://www.onvif.org/ver20/media/wsdlhttp://192.168.1.203:8000/onvif/Media2216http://www.onvif.org/ver10/events/wsdlhttp://192.168.1.203:8000/onvif/event_service216 + + +[2024-07-20 05:06:44] : [DEBUG] TX >> POST /onvif/device_service HTTP/1.1 +Host: 192.168.1.203:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetDeviceInformation" +Content-Length: 2282 +Connection: close + +[2024-07-20 05:06:44] : [DEBUG] adminfVJ0HxZ0kV1MpTLhEoKAp7oYpeA=OWFiOTQ0Y2E2ODAwNjc4NA==2024-07-19T19:06:43Z + +[2024-07-20 05:06:44] : [DEBUG] RX from 192.168.1.203 << HTTP/1.1 401 Unauthorized +WWW-Authenticate: Digest algorithm=MD5, realm="camara", qop="auth", nonce="669ab943cb84067a5e16", opaque="f8f12333" +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 2474 +Connection: close + + +[2024-07-20 05:06:44] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedError 401: HTTP 401 Unauthorized + + +[2024-07-20 05:06:44] : [DEBUG] TX >> POST /onvif/device_service HTTP/1.1 +Host: 192.168.1.203:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetDeviceInformation" +Content-Length: 2282 +Authorization: Digest username="admin", realm="camara", nonce="669ab943cb84067a5e16", uri="/onvif/device_service", response="9a9e6fd54734b71426ee30cdc8cf557e", opaque="f8f12333", qop="auth", cnonce="00002CD600003D6C", nc=00000001, algorithm=MD5 +Connection: close + +[2024-07-20 05:06:44] : [DEBUG] adminteQnFGh2HwLUKBnHy7o4VlDE/yI=OWFiOTQ0Y2E2OTAwNGFlMQ==2024-07-19T19:06:43Z + +[2024-07-20 05:06:44] : [DEBUG] TX >> POST /onvif/device_service HTTP/1.1 +Host: 192.168.1.237:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetDeviceInformation" +Content-Length: 2282 +Connection: close + +[2024-07-20 05:06:44] : [DEBUG] admin9/NApWfyWy9yvIE5Dp+k64YbybY=OWFiOTQ0Y2E2YTAwNGFlMQ==2024-07-19T19:06:43Z + +[2024-07-20 05:06:44] : [DEBUG] RX from 192.168.1.203 << HTTP/1.1 401 Unauthorized +WWW-Authenticate: Digest algorithm=MD5, realm="camara", qop="auth", nonce="669ab943cb85606c54b8", opaque="3af2844d" +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 2474 +Connection: close + + +[2024-07-20 05:06:44] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedError 401: HTTP 401 Unauthorized + + +[2024-07-20 05:06:44] : [DEBUG] RX from 192.168.1.237 << HTTP/1.1 400 Bad Request +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 3267 +Connection: close + + +[2024-07-20 05:06:44] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedSender not Authorized + + +[2024-07-20 05:06:44] : [DEBUG] RX from 192.168.1.202 << HTTP/1.1 400 Bad Request +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 2548 +Connection: close + + +[2024-07-20 05:06:44] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedThe device is locked because of entering wrong username/password many times.Please try it after 5 minutes! + + +[2024-07-20 05:06:44] : [DEBUG] TX >> POST /onvif/device_service HTTP/1.1 +Host: 192.168.1.175:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetDeviceInformation" +Content-Length: 2282 +Connection: close + +[2024-07-20 05:06:44] : [DEBUG] adminjon+TOcJZaxT0ZbOueWuI9QREow=OWFiOTQ0Y2E2YjAwNGFlMQ==2024-07-19T19:06:43Z + +[2024-07-20 05:06:44] : [DEBUG] RX from 192.168.1.175 << HTTP/1.1 400 Bad Request +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 3267 +Connection: close + + +[2024-07-20 05:06:44] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedSender not Authorized + + +[2024-07-20 05:06:44] : [DEBUG] TX >> POST /onvif/device_service HTTP/1.1 +Host: 192.168.1.87:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetDeviceInformation" +Content-Length: 2282 +Connection: close + +[2024-07-20 05:06:44] : [DEBUG] adminPrdbnqfzHyD9Q3vz6lBKoU43NQo=OWFiOTQ0Y2E2YzAwM2Q2Yw==2024-07-19T19:06:43Z + +[2024-07-20 05:06:44] : [DEBUG] RX from 192.168.1.87 << HTTP/1.1 400 Bad Request +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 3267 +Connection: close + + +[2024-07-20 05:06:44] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedSender not Authorized + + +[2024-07-20 05:06:44] : [DEBUG] TX >> POST /onvif/device_service HTTP/1.1 +Host: 192.168.1.203:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetDeviceInformation" +Content-Length: 2282 +Connection: close + +[2024-07-20 05:06:44] : [DEBUG] adminbMKemzG+NNyVmai+lWtwPJCLpIk=OWFiOTQ0Y2E2ZDAwNzJhZQ==2024-07-19T19:06:43Z + +[2024-07-20 05:06:44] : [DEBUG] TX >> POST /onvif/device_service HTTP/1.1 +Host: 192.168.1.237:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetDeviceInformation" +Content-Length: 2282 +Connection: close + +[2024-07-20 05:06:44] : [DEBUG] adminutH/Xta8KTZ2YqFpD1UvSsrxPRk=OWFiOTQ0Y2E2ZTAwM2Q2Yw==2024-07-19T19:06:43Z + +[2024-07-20 05:06:44] : [DEBUG] TX >> POST /onvif/device_service HTTP/1.1 +Host: 192.168.1.202:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetDeviceInformation" +Content-Length: 2282 +Connection: close + +[2024-07-20 05:06:44] : [DEBUG] adminxCQGzqJMEKwXmTaBNNlvfdQU5Ls=OWFiOTQ0Y2E2ZjAwNGFlMQ==2024-07-19T19:06:43Z + +[2024-07-20 05:06:44] : [DEBUG] RX from 192.168.1.237 << HTTP/1.1 400 Bad Request +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 3267 +Connection: close + + +[2024-07-20 05:06:44] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedSender not Authorized + + +[2024-07-20 05:06:44] : [DEBUG] RX from 192.168.1.203 << HTTP/1.1 401 Unauthorized +WWW-Authenticate: Digest algorithm=MD5, realm="camara", qop="auth", nonce="669ab944cb868f467e88", opaque="0b57f302" +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 2474 +Connection: close + + +[2024-07-20 05:06:44] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedError 401: HTTP 401 Unauthorized + + +[2024-07-20 05:06:44] : [DEBUG] RX from 192.168.1.202 << HTTP/1.1 400 Bad Request +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 2548 +Connection: close + + +[2024-07-20 05:06:44] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedThe device is locked because of entering wrong username/password many times.Please try it after 5 minutes! + + +[2024-07-20 05:06:44] : [DEBUG] TX >> POST /onvif/device_service HTTP/1.1 +Host: 192.168.1.175:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetDeviceInformation" +Content-Length: 2282 +Connection: close + +[2024-07-20 05:06:44] : [DEBUG] admin7ftU+XGnhyWzhrjXq8X9rd/RpmM=OWFiOTQ0Y2E3MDAwM2Q2Yw==2024-07-19T19:06:43Z + +[2024-07-20 05:06:44] : [DEBUG] RX from 192.168.1.175 << HTTP/1.1 400 Bad Request +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 3267 +Connection: close + + +[2024-07-20 05:06:44] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedSender not Authorized + + +[2024-07-20 05:06:45] : [DEBUG] TX >> POST /onvif/device_service HTTP/1.1 +Host: 192.168.1.87:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetDeviceInformation" +Content-Length: 2282 +Connection: close + +[2024-07-20 05:06:45] : [DEBUG] adminD0w7E05QjsDzoFSRgAR8ylvwm7U=OWFiOTQ1Y2E3MTAwMmNkNg==2024-07-19T19:06:44Z + +[2024-07-20 05:06:45] : [DEBUG] RX from 192.168.1.87 << HTTP/1.1 400 Bad Request +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 3267 +Connection: close + + +[2024-07-20 05:06:45] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedSender not Authorized + + +[2024-07-20 05:06:45] : [DEBUG] TX >> POST /onvif/device_service HTTP/1.1 +Host: 192.168.1.237:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetDeviceInformation" +Content-Length: 2282 +Connection: close + +[2024-07-20 05:06:45] : [DEBUG] adminEqqEBYD/IhLQVNz7LEuY3gB1jzU=OWFiOTQ1Y2E3MjAwMmNkNg==2024-07-19T19:06:44Z + +[2024-07-20 05:06:45] : [DEBUG] TX >> POST /onvif/device_service HTTP/1.1 +Host: 192.168.1.203:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetDeviceInformation" +Content-Length: 2282 +Connection: close + +[2024-07-20 05:06:45] : [DEBUG] adminSIAMUag8tuIaiAKEaINFb4t7z8s=OWFiOTQ1Y2E3MzAwNjk1Mg==2024-07-19T19:06:44Z + +[2024-07-20 05:06:45] : [DEBUG] RX from 192.168.1.237 << HTTP/1.1 400 Bad Request +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 3267 +Connection: close + + +[2024-07-20 05:06:45] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedSender not Authorized + + +[2024-07-20 05:06:45] : [DEBUG] RX from 192.168.1.203 << HTTP/1.1 401 Unauthorized +WWW-Authenticate: Digest algorithm=MD5, realm="camara", qop="auth", nonce="669ab944cb87de6900be", opaque="b5907c77" +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 2474 +Connection: close + + +[2024-07-20 05:06:45] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedError 401: HTTP 401 Unauthorized + + +[2024-07-20 05:06:45] : [DEBUG] TX >> POST /onvif/device_service HTTP/1.1 +Host: 192.168.1.202:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetDeviceInformation" +Content-Length: 2282 +Connection: close + +[2024-07-20 05:06:45] : [DEBUG] admin9sr3EDoejYywalLWTcLuUGrsHW0=OWFiOTQ1Y2E3NDAwM2Q2Yw==2024-07-19T19:06:44Z + +[2024-07-20 05:06:45] : [DEBUG] RX from 192.168.1.202 << HTTP/1.1 400 Bad Request +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 2548 +Connection: close + + +[2024-07-20 05:06:45] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedThe device is locked because of entering wrong username/password many times.Please try it after 5 minutes! + + +[2024-07-20 05:06:45] : [DEBUG] TX >> POST /onvif/device_service HTTP/1.1 +Host: 192.168.1.175:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetDeviceInformation" +Content-Length: 2282 +Connection: close + +[2024-07-20 05:06:45] : [DEBUG] adminfh40EmbHAXKTN8OuXvQHZeUEhHU=OWFiOTQ1Y2E3NTAwMmNkNg==2024-07-19T19:06:44Z + +[2024-07-20 05:06:45] : [DEBUG] RX from 192.168.1.175 << HTTP/1.1 400 Bad Request +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 3267 +Connection: close + + +[2024-07-20 05:06:45] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedSender not Authorized + + +[2024-07-20 05:06:45] : [DEBUG] TX >> POST /onvif/device_service HTTP/1.1 +Host: 192.168.1.87:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetDeviceInformation" +Content-Length: 2282 +Connection: close + +[2024-07-20 05:06:45] : [DEBUG] adminazYF+Wd/kOUWq0y2Aa+ekWcyXWU=OWFiOTQ1Y2E3NjAwNzJhZQ==2024-07-19T19:06:44Z + +[2024-07-20 05:06:45] : [DEBUG] RX from 192.168.1.87 << HTTP/1.1 400 Bad Request +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 3267 +Connection: close + + +[2024-07-20 05:06:45] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedSender not Authorized + + +[2024-07-20 05:06:45] : [DEBUG] TX >> POST /onvif/media_service HTTP/1.1 +Host: 192.168.1.87:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/media/wsdl/GetVideoSources" +Content-Length: 2277 +Connection: close + +[2024-07-20 05:06:45] : [DEBUG] adminTaGqJrzKMeX+OEznbKbGqP66Okc=OWFiOTQ1Y2E3NzAwNjk1Mg==2024-07-19T19:06:44Z + +[2024-07-20 05:06:45] : [DEBUG] RX from 192.168.1.87 << HTTP/1.1 400 Bad Request +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 3267 +Connection: close + + +[2024-07-20 05:06:45] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedSender not Authorized + + +[2024-07-20 05:06:45] : [DEBUG] TX >> POST /onvif/media_service HTTP/1.1 +Host: 192.168.1.87:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/media/wsdl/GetVideoSourceConfigurations" +Content-Length: 2290 +Connection: close + +[2024-07-20 05:06:45] : [DEBUG] adminI5hcnHyTEGCLNsxVNt0Rz/1378Q=OWFiOTQ1Y2E3ODAwNWY5MA==2024-07-19T19:06:44Z + +[2024-07-20 05:06:45] : [DEBUG] RX from 192.168.1.87 << HTTP/1.1 400 Bad Request +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 3267 +Connection: close + + +[2024-07-20 05:06:45] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedSender not Authorized + + +[2024-07-20 05:06:45] : [DEBUG] TX >> POST /onvif/media_service HTTP/1.1 +Host: 192.168.1.87:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/media/wsdl/GetVideoEncoderConfigurations" +Content-Length: 2291 +Connection: close + +[2024-07-20 05:06:45] : [DEBUG] adminDOqq/N53UyqUeIT+hqPwmRaMu6g=OWFiOTQ1Y2E3OTAwMTY0OQ==2024-07-19T19:06:44Z + +[2024-07-20 05:06:45] : [DEBUG] RX from 192.168.1.87 << HTTP/1.1 400 Bad Request +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 3267 +Connection: close + + +[2024-07-20 05:06:45] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedSender not Authorized + + +[2024-07-20 05:06:45] : [DEBUG] TX >> POST /onvif/media_service HTTP/1.1 +Host: 192.168.1.87:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/media/wsdl/GetAudioSources" +Content-Length: 2277 +Connection: close + +[2024-07-20 05:06:45] : [DEBUG] adminshZHMr6eLIWZLMKx41hbbw61V+s=OWFiOTQ1Y2E3YTAwNmRmMQ==2024-07-19T19:06:44Z + +[2024-07-20 05:06:45] : [DEBUG] RX from 192.168.1.87 << HTTP/1.1 400 Bad Request +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 3267 +Connection: close + + +[2024-07-20 05:06:45] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedSender not Authorized + + +[2024-07-20 05:06:45] : [DEBUG] TX >> POST /onvif/ptz_service HTTP/1.1 +Host: 192.168.1.87:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver20/ptz/wsdl/GetNodes" +Content-Length: 2271 +Connection: close + +[2024-07-20 05:06:45] : [DEBUG] adminjtN19gzJeQvFE2zg2qiQAPt7khA=OWFiOTQ1Y2E3YjAwNWFmMQ==2024-07-19T19:06:44Z + +[2024-07-20 05:06:45] : [DEBUG] RX from 192.168.1.87 << HTTP/1.1 400 Bad Request +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 3267 +Connection: close + + +[2024-07-20 05:06:45] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedSender not Authorized + + +[2024-07-20 05:06:45] : [DEBUG] TX >> POST /onvif/ptz_service HTTP/1.1 +Host: 192.168.1.87:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver20/ptz/wsdl/GetConfigurations" +Content-Length: 2280 +Connection: close + +[2024-07-20 05:06:45] : [DEBUG] adminXbB4gVZ0HC806nHOQcePtinCW0w=OWFiOTQ1Y2E3YzAwNDFiYg==2024-07-19T19:06:44Z + +[2024-07-20 05:06:45] : [DEBUG] RX from 192.168.1.87 << HTTP/1.1 400 Bad Request +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 3267 +Connection: close + + +[2024-07-20 05:06:45] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedSender not Authorized + + +[2024-07-20 05:06:45] : [DEBUG] TX >> POST /onvif/media_service HTTP/1.1 +Host: 192.168.1.87:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/media/wsdl/GetProfiles" +Content-Length: 2273 +Connection: close + +[2024-07-20 05:06:45] : [DEBUG] TX >> POST /onvif/device_service HTTP/1.1 +Host: 192.168.1.237:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetDeviceInformation" +Content-Length: 2282 +Connection: close + +[2024-07-20 05:06:45] : [DEBUG] adminHubAZjbNt9Rk8S96uHkk+TFjfKo=OWFiOTQ1Y2E3ZDAwMjZlOQ==2024-07-19T19:06:44Z + +[2024-07-20 05:06:45] : [DEBUG] admin9/mHSwRmaBlUUBCPOtJhYg+hRlA=OWFiOTQ1Y2E3ZTAwNzJhZQ==2024-07-19T19:06:44Z + +[2024-07-20 05:06:45] : [DEBUG] TX >> POST /onvif/device_service HTTP/1.1 +Host: 192.168.1.203:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetDeviceInformation" +Content-Length: 2282 +Connection: close + +[2024-07-20 05:06:45] : [DEBUG] admincbw1fQZ/KhoZqz6j7fheoR+2Hnk=OWFiOTQ1Y2E3ZjAwNWY5MA==2024-07-19T19:06:44Z + +[2024-07-20 05:06:45] : [DEBUG] RX from 192.168.1.87 << HTTP/1.1 400 Bad Request +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 3267 +Connection: close + + +[2024-07-20 05:06:45] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedSender not Authorized + + +[2024-07-20 05:06:45] : [DEBUG] RX from 192.168.1.237 << HTTP/1.1 400 Bad Request +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 3267 +Connection: close + + +[2024-07-20 05:06:45] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedSender not Authorized + + +[2024-07-20 05:06:45] : [DEBUG] RX from 192.168.1.203 << HTTP/1.1 401 Unauthorized +WWW-Authenticate: Digest algorithm=MD5, realm="camara", qop="auth", nonce="669ab945cb8846ffec6e", opaque="b9e70ded" +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 2474 +Connection: close + + +[2024-07-20 05:06:45] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedError 401: HTTP 401 Unauthorized + + +[2024-07-20 05:06:45] : [DEBUG] TX >> POST /onvif/media_service HTTP/1.1 +Host: 192.168.1.237:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/media/wsdl/GetVideoSources" +Content-Length: 2277 +Connection: close + +[2024-07-20 05:06:45] : [DEBUG] adminjrrlWFQNpWHCz3f/H8fAfJXqynM=OWFiOTQ1Y2E4MDAwNjk1Mg==2024-07-19T19:06:44Z + +[2024-07-20 05:06:45] : [DEBUG] TX >> POST /onvif/device_service HTTP/1.1 +Host: 192.168.1.202:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetDeviceInformation" +Content-Length: 2282 +Connection: close + +[2024-07-20 05:06:45] : [DEBUG] adminaE56seOp8Zlszz6is+qYYXibLhs=OWFiOTQ1Y2E4MTAwMmNkNg==2024-07-19T19:06:44Z + +[2024-07-20 05:06:46] : [DEBUG] RX from 192.168.1.237 << HTTP/1.1 400 Bad Request +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 3267 +Connection: close + + +[2024-07-20 05:06:46] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedSender not Authorized + + +[2024-07-20 05:06:46] : [DEBUG] TX >> POST /onvif/media_service HTTP/1.1 +Host: 192.168.1.237:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/media/wsdl/GetVideoSourceConfigurations" +Content-Length: 2290 +Connection: close + +[2024-07-20 05:06:46] : [DEBUG] adminm4MEshA18+7FLbtaalwYrB+DK4k=OWFiOTQ2Y2E4MjAwNWY5MA==2024-07-19T19:06:45Z + +[2024-07-20 05:06:46] : [DEBUG] RX from 192.168.1.202 << HTTP/1.1 400 Bad Request +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 2548 +Connection: close + + +[2024-07-20 05:06:46] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedThe device is locked because of entering wrong username/password many times.Please try it after 5 minutes! + + +[2024-07-20 05:06:46] : [DEBUG] TX >> POST /onvif/device_service HTTP/1.1 +Host: 192.168.1.175:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetDeviceInformation" +Content-Length: 2282 +Connection: close + +[2024-07-20 05:06:46] : [DEBUG] adminN7X+u01dhMG+xeqtYtdkIJJGFHQ=OWFiOTQ2Y2E4MzAwNzJhZQ==2024-07-19T19:06:45Z + +[2024-07-20 05:06:46] : [DEBUG] RX from 192.168.1.237 << HTTP/1.1 400 Bad Request +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 3267 +Connection: close + + +[2024-07-20 05:06:46] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedSender not Authorized + + +[2024-07-20 05:06:46] : [DEBUG] RX from 192.168.1.175 << HTTP/1.1 400 Bad Request +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 3267 +Connection: close + + +[2024-07-20 05:06:46] : [DEBUG] TX >> POST /onvif/media_service HTTP/1.1 +Host: 192.168.1.237:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/media/wsdl/GetVideoEncoderConfigurations" +Content-Length: 2291 +Connection: close + +[2024-07-20 05:06:46] : [DEBUG] adminjd10h271OgJKOMjnySRDTvGC7lU=OWFiOTQ2Y2E4NDAwMTY0OQ==2024-07-19T19:06:45Z + +[2024-07-20 05:06:46] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedSender not Authorized + + +[2024-07-20 05:06:46] : [DEBUG] TX >> POST /onvif/media_service HTTP/1.1 +Host: 192.168.1.175:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/media/wsdl/GetVideoSources" +Content-Length: 2277 +Connection: close + +[2024-07-20 05:06:46] : [DEBUG] adminSPB1TAGbvizIsqmxasrOtMGSJBk=OWFiOTQ2Y2E4NTAwNjk1Mg==2024-07-19T19:06:45Z + +[2024-07-20 05:06:46] : [DEBUG] RX from 192.168.1.237 << HTTP/1.1 400 Bad Request +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 3267 +Connection: close + + +[2024-07-20 05:06:46] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedSender not Authorized + + +[2024-07-20 05:06:46] : [DEBUG] RX from 192.168.1.175 << HTTP/1.1 400 Bad Request +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 3267 +Connection: close + + +[2024-07-20 05:06:46] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedSender not Authorized + + +[2024-07-20 05:06:46] : [DEBUG] TX >> POST /onvif/media_service HTTP/1.1 +Host: 192.168.1.237:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/media/wsdl/GetAudioSources" +Content-Length: 2277 +Connection: close + +[2024-07-20 05:06:46] : [DEBUG] admin9mF92iW0FMEfXuO2ZvOumY0D6n0=OWFiOTQ2Y2E4NjAwNmRmMQ==2024-07-19T19:06:45Z + +[2024-07-20 05:06:46] : [DEBUG] TX >> POST /onvif/media_service HTTP/1.1 +Host: 192.168.1.175:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/media/wsdl/GetVideoSourceConfigurations" +Content-Length: 2290 +Connection: close + +[2024-07-20 05:06:46] : [DEBUG] admin8iz6Dbe8y3ytNp9yD5PdY78sw40=OWFiOTQ2Y2E4NzAwNWY5MA==2024-07-19T19:06:45Z + +[2024-07-20 05:06:46] : [DEBUG] RX from 192.168.1.237 << HTTP/1.1 400 Bad Request +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 3267 +Connection: close + + +[2024-07-20 05:06:46] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedSender not Authorized + + +[2024-07-20 05:06:46] : [DEBUG] RX from 192.168.1.175 << HTTP/1.1 400 Bad Request +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 3267 +Connection: close + + +[2024-07-20 05:06:46] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedSender not Authorized + + +[2024-07-20 05:06:46] : [DEBUG] TX >> POST /onvif/ptz_service HTTP/1.1 +Host: 192.168.1.237:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver20/ptz/wsdl/GetNodes" +Content-Length: 2271 +Connection: close + +[2024-07-20 05:06:46] : [DEBUG] adminis8MJ71qcrRN1EA8PkJXU/B3dgc=OWFiOTQ2Y2E4ODAwNWFmMQ==2024-07-19T19:06:45Z + +[2024-07-20 05:06:46] : [DEBUG] TX >> POST /onvif/media_service HTTP/1.1 +Host: 192.168.1.175:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/media/wsdl/GetVideoEncoderConfigurations" +Content-Length: 2291 +Connection: close + +[2024-07-20 05:06:46] : [DEBUG] adminVYI5fmJCMiDyI9PcAaH9EvaRRuM=OWFiOTQ2Y2E4OTAwMTY0OQ==2024-07-19T19:06:45Z + +[2024-07-20 05:06:46] : [DEBUG] RX from 192.168.1.237 << HTTP/1.1 400 Bad Request +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 3267 +Connection: close + + +[2024-07-20 05:06:46] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedSender not Authorized + + +[2024-07-20 05:06:46] : [DEBUG] TX >> POST /onvif/ptz_service HTTP/1.1 +Host: 192.168.1.237:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver20/ptz/wsdl/GetConfigurations" +Content-Length: 2280 +Connection: close + +[2024-07-20 05:06:46] : [DEBUG] admindSAUulZr49Y8GIDHUyt4cztigr4=OWFiOTQ2Y2E4YTAwNDFiYg==2024-07-19T19:06:45Z + +[2024-07-20 05:06:46] : [DEBUG] RX from 192.168.1.175 << HTTP/1.1 400 Bad Request +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 3267 +Connection: close + + +[2024-07-20 05:06:46] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedSender not Authorized + + +[2024-07-20 05:06:46] : [DEBUG] RX from 192.168.1.237 << HTTP/1.1 400 Bad Request +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 3267 +Connection: close + + +[2024-07-20 05:06:46] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedSender not Authorized + + +[2024-07-20 05:06:46] : [DEBUG] TX >> POST /onvif/media_service HTTP/1.1 +Host: 192.168.1.175:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/media/wsdl/GetAudioSources" +Content-Length: 2277 +Connection: close + +[2024-07-20 05:06:46] : [DEBUG] adminC45gzdvXKkyrqqES8sfkL6dlEtg=OWFiOTQ2Y2E4YjAwNmRmMQ==2024-07-19T19:06:45Z + +[2024-07-20 05:06:46] : [DEBUG] TX >> POST /onvif/media_service HTTP/1.1 +Host: 192.168.1.237:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/media/wsdl/GetProfiles" +Content-Length: 2273 +Connection: close + +[2024-07-20 05:06:46] : [DEBUG] adminVB2yJ2vZ7iAEMctbEzTe4f+V/bk=OWFiOTQ2Y2E4YzAwMjZlOQ==2024-07-19T19:06:45Z + +[2024-07-20 05:06:46] : [DEBUG] RX from 192.168.1.175 << HTTP/1.1 400 Bad Request +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 3267 +Connection: close + + +[2024-07-20 05:06:46] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedSender not Authorized + + +[2024-07-20 05:06:46] : [DEBUG] RX from 192.168.1.237 << HTTP/1.1 400 Bad Request +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 3267 +Connection: close + + +[2024-07-20 05:06:46] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedSender not Authorized + + +[2024-07-20 05:06:46] : [DEBUG] TX >> POST /onvif/ptz_service HTTP/1.1 +Host: 192.168.1.175:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver20/ptz/wsdl/GetNodes" +Content-Length: 2271 +Connection: close + +[2024-07-20 05:06:46] : [DEBUG] adminRwbr4V7y3rFE31/emS2o55c3k28=OWFiOTQ2Y2E4ZDAwNWFmMQ==2024-07-19T19:06:45Z + +[2024-07-20 05:06:46] : [DEBUG] RX from 192.168.1.175 << HTTP/1.1 400 Bad Request +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 3267 +Connection: close + + +[2024-07-20 05:06:46] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedSender not Authorized + + +[2024-07-20 05:06:46] : [DEBUG] TX >> POST /onvif/ptz_service HTTP/1.1 +Host: 192.168.1.175:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver20/ptz/wsdl/GetConfigurations" +Content-Length: 2280 +Connection: close + +[2024-07-20 05:06:46] : [DEBUG] adminqrwl63eCY6+zdHn7GIk78CH0q0c=OWFiOTQ2Y2E4ZTAwNDFiYg==2024-07-19T19:06:45Z + +[2024-07-20 05:06:46] : [DEBUG] RX from 192.168.1.175 << HTTP/1.1 400 Bad Request +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 3267 +Connection: close + + +[2024-07-20 05:06:46] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedSender not Authorized + + +[2024-07-20 05:06:46] : [DEBUG] TX >> POST /onvif/media_service HTTP/1.1 +Host: 192.168.1.175:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/media/wsdl/GetProfiles" +Content-Length: 2273 +Connection: close + +[2024-07-20 05:06:46] : [DEBUG] adminf9JH9ORugMOmgvfyPZbmYPeuHPk=OWFiOTQ2Y2E4ZjAwMjZlOQ==2024-07-19T19:06:45Z + +[2024-07-20 05:06:46] : [DEBUG] RX from 192.168.1.175 << HTTP/1.1 400 Bad Request +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 3267 +Connection: close + + +[2024-07-20 05:06:46] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedSender not Authorized + + +[2024-07-20 05:06:46] : [DEBUG] TX >> POST /onvif/device_service HTTP/1.1 +Host: 192.168.1.203:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetDeviceInformation" +Content-Length: 2282 +Connection: close + +[2024-07-20 05:06:46] : [DEBUG] adminLYJi+9l24G1z7+p9sfVT3GKMYDU=OWFiOTQ2Y2E5MDAwMTY0OQ==2024-07-19T19:06:45Z + +[2024-07-20 05:06:46] : [DEBUG] RX from 192.168.1.203 << HTTP/1.1 401 Unauthorized +WWW-Authenticate: Digest algorithm=MD5, realm="camara", qop="auth", nonce="669ab945cb89746bd529", opaque="288cb6f8" +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 2474 +Connection: close + + +[2024-07-20 05:06:46] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedError 401: HTTP 401 Unauthorized + + +[2024-07-20 05:06:46] : [DEBUG] TX >> POST /onvif/media_service HTTP/1.1 +Host: 192.168.1.203:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/media/wsdl/GetVideoSources" +Content-Length: 2277 +Connection: close + +[2024-07-20 05:06:46] : [DEBUG] admin0k9prug03A3Bn/AX393uMcQumrc=OWFiOTQ2Y2E5MjAwNmRmMQ==2024-07-19T19:06:45Z + +[2024-07-20 05:06:46] : [DEBUG] TX >> POST /onvif/device_service HTTP/1.1 +Host: 192.168.1.202:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetDeviceInformation" +Content-Length: 2282 +Connection: close + +[2024-07-20 05:06:46] : [DEBUG] adminHdpkz5Du95DZvmjP21HwdYM0ZFg=OWFiOTQ2Y2E5MTAwNzJhZQ==2024-07-19T19:06:45Z + +[2024-07-20 05:06:46] : [DEBUG] RX from 192.168.1.203 << HTTP/1.1 401 Unauthorized +WWW-Authenticate: Digest algorithm=MD5, realm="camara", qop="auth", nonce="669ab945cb8a000ae0ad", opaque="128940ee" +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 2474 +Connection: close + + +[2024-07-20 05:06:46] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedError 401: HTTP 401 Unauthorized + + +[2024-07-20 05:06:46] : [DEBUG] TX >> POST /onvif/media_service HTTP/1.1 +Host: 192.168.1.203:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/media/wsdl/GetVideoSources" +Content-Length: 2277 +Authorization: Digest username="admin", realm="camara", nonce="669ab945cb8a000ae0ad", uri="/onvif/media_service", response="c0cde6179d377a4950b583104e94c2d7", opaque="128940ee", qop="auth", cnonce="000026E9000041BB", nc=00000001, algorithm=MD5 +Connection: close + +[2024-07-20 05:06:46] : [DEBUG] adminNqPuabx491cDZA33BY7ImWOby+Q=OWFiOTQ2Y2E5MzAwNWFmMQ==2024-07-19T19:06:45Z + +[2024-07-20 05:06:46] : [DEBUG] RX from 192.168.1.202 << HTTP/1.1 400 Bad Request +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 2548 +Connection: close + + +[2024-07-20 05:06:46] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedThe device is locked because of entering wrong username/password many times.Please try it after 5 minutes! + + +[2024-07-20 05:06:46] : [DEBUG] RX from 192.168.1.203 << HTTP/1.1 401 Unauthorized +WWW-Authenticate: Digest algorithm=MD5, realm="camara", qop="auth", nonce="669ab945cb8b9fb50769", opaque="b74faf3d" +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 2474 +Connection: close + + +[2024-07-20 05:06:46] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedError 401: HTTP 401 Unauthorized + + +[2024-07-20 05:06:46] : [DEBUG] TX >> POST /onvif/media_service HTTP/1.1 +Host: 192.168.1.202:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/media/wsdl/GetVideoSources" +Content-Length: 2277 +Connection: close + +[2024-07-20 05:06:46] : [DEBUG] adminy9lPoDySMFALGkxK9gAY+E8b8Vg=OWFiOTQ2Y2E5NDAwNjk1Mg==2024-07-19T19:06:45Z + +[2024-07-20 05:06:46] : [DEBUG] TX >> POST /onvif/media_service HTTP/1.1 +Host: 192.168.1.203:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/media/wsdl/GetVideoSourceConfigurations" +Content-Length: 2290 +Connection: close + +[2024-07-20 05:06:46] : [DEBUG] admin+nD3rErD77cACq3Dmwd6MAx5rSI=OWFiOTQ2Y2E5NTAwMDFlYg==2024-07-19T19:06:45Z + +[2024-07-20 05:06:46] : [DEBUG] RX from 192.168.1.202 << HTTP/1.1 400 Bad Request +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 2548 +Connection: close + + +[2024-07-20 05:06:46] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedThe device is locked because of entering wrong username/password many times.Please try it after 5 minutes! + + +[2024-07-20 05:06:46] : [DEBUG] RX from 192.168.1.203 << HTTP/1.1 401 Unauthorized +WWW-Authenticate: Digest algorithm=MD5, realm="camara", qop="auth", nonce="669ab945cb8cf07f5cc3", opaque="589e60df" +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 2474 +Connection: close + + +[2024-07-20 05:06:46] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedError 401: HTTP 401 Unauthorized + + +[2024-07-20 05:06:46] : [DEBUG] TX >> POST /onvif/media_service HTTP/1.1 +Host: 192.168.1.202:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/media/wsdl/GetVideoSourceConfigurations" +Content-Length: 2290 +Connection: close + +[2024-07-20 05:06:46] : [DEBUG] admintusEC5ke1jeLDE3+lyEl9iK9E+I=OWFiOTQ2Y2E5NjAwNWY5MA==2024-07-19T19:06:45Z + +[2024-07-20 05:06:46] : [DEBUG] TX >> POST /onvif/media_service HTTP/1.1 +Host: 192.168.1.203:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/media/wsdl/GetVideoSourceConfigurations" +Content-Length: 2290 +Authorization: Digest username="admin", realm="camara", nonce="669ab945cb8cf07f5cc3", uri="/onvif/media_service", response="302bac080a4a79e172c111431b33ebcf", opaque="589e60df", qop="auth", cnonce="000012DB00002EA6", nc=00000001, algorithm=MD5 +Connection: close + +[2024-07-20 05:06:46] : [DEBUG] adminWHcIi4jEuAfaGHNHhG27vWMb+RI=OWFiOTQ2Y2E5NzAwMGJiMw==2024-07-19T19:06:45Z + +[2024-07-20 05:06:46] : [DEBUG] RX from 192.168.1.202 << HTTP/1.1 400 Bad Request +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 2548 +Connection: close + + +[2024-07-20 05:06:46] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedThe device is locked because of entering wrong username/password many times.Please try it after 5 minutes! + + +[2024-07-20 05:06:46] : [DEBUG] TX >> POST /onvif/media_service HTTP/1.1 +Host: 192.168.1.202:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/media/wsdl/GetVideoEncoderConfigurations" +Content-Length: 2291 +Connection: close + +[2024-07-20 05:06:46] : [DEBUG] admin9M1bmuGGnrxk4h9mCsL9vPMgRTs=OWFiOTQ2Y2E5ODAwMTY0OQ==2024-07-19T19:06:45Z + +[2024-07-20 05:06:46] : [DEBUG] RX from 192.168.1.203 << HTTP/1.1 401 Unauthorized +WWW-Authenticate: Digest algorithm=MD5, realm="camara", qop="auth", nonce="669ab945cb8d32e76cd7", opaque="3a41d1e1" +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 2474 +Connection: close + + +[2024-07-20 05:06:46] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedError 401: HTTP 401 Unauthorized + + +[2024-07-20 05:06:46] : [DEBUG] TX >> POST /onvif/media_service HTTP/1.1 +Host: 192.168.1.203:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/media/wsdl/GetVideoEncoderConfigurations" +Content-Length: 2291 +Connection: close + +[2024-07-20 05:06:46] : [DEBUG] admindGHF4whhrCIUk4w3zU2JSJSr7WU=OWFiOTQ2Y2E5OTAwMTUzYw==2024-07-19T19:06:45Z + +[2024-07-20 05:06:46] : [DEBUG] RX from 192.168.1.202 << HTTP/1.1 400 Bad Request +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 2548 +Connection: close + + +[2024-07-20 05:06:46] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedThe device is locked because of entering wrong username/password many times.Please try it after 5 minutes! + + +[2024-07-20 05:06:46] : [DEBUG] TX >> POST /onvif/media_service HTTP/1.1 +Host: 192.168.1.202:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/media/wsdl/GetAudioSources" +Content-Length: 2277 +Connection: close + +[2024-07-20 05:06:46] : [DEBUG] adminRX35dz6ylp8tBIQqkNNHZO9VJB8=OWFiOTQ2Y2E5YTAwNmRmMQ==2024-07-19T19:06:45Z + +[2024-07-20 05:06:46] : [DEBUG] RX from 192.168.1.203 << HTTP/1.1 401 Unauthorized +WWW-Authenticate: Digest algorithm=MD5, realm="camara", qop="auth", nonce="669ab946cb8e85b0067e", opaque="378fd8bb" +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 2474 +Connection: close + + +[2024-07-20 05:06:46] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedError 401: HTTP 401 Unauthorized + + +[2024-07-20 05:06:46] : [DEBUG] RX from 192.168.1.202 << HTTP/1.1 400 Bad Request +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 2548 +Connection: close + + +[2024-07-20 05:06:46] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedThe device is locked because of entering wrong username/password many times.Please try it after 5 minutes! + + +[2024-07-20 05:06:46] : [DEBUG] TX >> POST /onvif/media_service HTTP/1.1 +Host: 192.168.1.203:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/media/wsdl/GetVideoEncoderConfigurations" +Content-Length: 2291 +Authorization: Digest username="admin", realm="camara", nonce="669ab946cb8e85b0067e", uri="/onvif/media_service", response="aa450ca91f8cb7761641f54df9d8ddc8", opaque="378fd8bb", qop="auth", cnonce="00000F3E0000390C", nc=00000001, algorithm=MD5 +Connection: close + +[2024-07-20 05:06:46] : [DEBUG] adminVBEf4GM/dP39m1hL2pQayolmUqs=OWFiOTQ2Y2E5YjAwN2U4Nw==2024-07-19T19:06:45Z + +[2024-07-20 05:06:46] : [DEBUG] TX >> POST /onvif/ptz_service HTTP/1.1 +Host: 192.168.1.202:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver20/ptz/wsdl/GetNodes" +Content-Length: 2271 +Connection: close + +[2024-07-20 05:06:46] : [DEBUG] admintwOD315Sf+6C2aqK8mdVCggvzkM=OWFiOTQ2Y2E5YzAwNWFmMQ==2024-07-19T19:06:45Z + +[2024-07-20 05:06:46] : [DEBUG] RX from 192.168.1.203 << HTTP/1.1 401 Unauthorized +WWW-Authenticate: Digest algorithm=MD5, realm="camara", qop="auth", nonce="669ab946cb8f0a94755b", opaque="b4a479b3" +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 2474 +Connection: close + + +[2024-07-20 05:06:46] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedError 401: HTTP 401 Unauthorized + + +[2024-07-20 05:06:46] : [DEBUG] TX >> POST /onvif/media_service HTTP/1.1 +Host: 192.168.1.203:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/media/wsdl/GetAudioSources" +Content-Length: 2277 +Connection: close + +[2024-07-20 05:06:46] : [DEBUG] admin8FlSByly5A7piMSIXojzFcg1jds=OWFiOTQ2Y2E5ZDAwMDA5OQ==2024-07-19T19:06:45Z + +[2024-07-20 05:06:46] : [DEBUG] RX from 192.168.1.202 << HTTP/1.1 400 Bad Request +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 2548 +Connection: close + + +[2024-07-20 05:06:46] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedThe device is locked because of entering wrong username/password many times.Please try it after 5 minutes! + + +[2024-07-20 05:06:47] : [DEBUG] TX >> POST /onvif/ptz_service HTTP/1.1 +Host: 192.168.1.202:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver20/ptz/wsdl/GetConfigurations" +Content-Length: 2280 +Connection: close + +[2024-07-20 05:06:47] : [DEBUG] admindQRVUCuF2yP+abFxHY1n7wERqEg=OWFiOTQ2Y2E5ZTAwNDFiYg==2024-07-19T19:06:45Z + +[2024-07-20 05:06:47] : [DEBUG] RX from 192.168.1.203 << HTTP/1.1 401 Unauthorized +WWW-Authenticate: Digest algorithm=MD5, realm="camara", qop="auth", nonce="669ab946cb90f8479031", opaque="5f8a6487" +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 2474 +Connection: close + + +[2024-07-20 05:06:47] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedError 401: HTTP 401 Unauthorized + + +[2024-07-20 05:06:47] : [DEBUG] TX >> POST /onvif/media_service HTTP/1.1 +Host: 192.168.1.203:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/media/wsdl/GetAudioSources" +Content-Length: 2277 +Authorization: Digest username="admin", realm="camara", nonce="669ab946cb90f8479031", uri="/onvif/media_service", response="c9e8d342c89aac6778fc15f11b480542", opaque="5f8a6487", qop="auth", cnonce="0000440D0000305E", nc=00000001, algorithm=MD5 +Connection: close + +[2024-07-20 05:06:47] : [DEBUG] adminjbBARfVilF3eh1TYi/G1PYdWyI4=OWFiOTQ3Y2E5ZjAwMDEyNA==2024-07-19T19:06:46Z + +[2024-07-20 05:06:47] : [DEBUG] RX from 192.168.1.202 << HTTP/1.1 400 Bad Request +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 2548 +Connection: close + + +[2024-07-20 05:06:47] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedThe device is locked because of entering wrong username/password many times.Please try it after 5 minutes! + + +[2024-07-20 05:06:47] : [DEBUG] TX >> POST /onvif/Media2 HTTP/1.1 +Host: 192.168.1.202:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver20/media/wsdl/GetProfiles" +Content-Length: 2313 +Connection: close + +[2024-07-20 05:06:47] : [DEBUG] adminsyYMdCbfTGrRh2s3PVZq0bj+WdE=OWFiOTQ3Y2FhMDAwMjZlOQ==2024-07-19T19:06:46ZALL + +[2024-07-20 05:06:47] : [DEBUG] RX from 192.168.1.203 << HTTP/1.1 401 Unauthorized +WWW-Authenticate: Digest algorithm=MD5, realm="camara", qop="auth", nonce="669ab946cb917c61496d", opaque="9f58b100" +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 2474 +Connection: close + + +[2024-07-20 05:06:47] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedError 401: HTTP 401 Unauthorized + + +[2024-07-20 05:06:47] : [DEBUG] RX from 192.168.1.202 << HTTP/1.1 400 Bad Request +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 2548 +Connection: close + + +[2024-07-20 05:06:47] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedThe device is locked because of entering wrong username/password many times.Please try it after 5 minutes! + + +[2024-07-20 05:06:47] : [DEBUG] TX >> POST /onvif/ptz_service HTTP/1.1 +Host: 192.168.1.203:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver20/ptz/wsdl/GetNodes" +Content-Length: 2271 +Connection: close + +[2024-07-20 05:06:47] : [DEBUG] adminBag12qJEpBFpqfccUDlQIBo6ez8=OWFiOTQ3Y2FhMTAwNDkxYw==2024-07-19T19:06:46Z + +[2024-07-20 05:06:47] : [DEBUG] TX >> POST /onvif/media_service HTTP/1.1 +Host: 192.168.1.202:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/media/wsdl/GetProfiles" +Content-Length: 2273 +Connection: close + +[2024-07-20 05:06:47] : [DEBUG] adminfSUtuBw8xDs6jT77nKIAH9qirto=OWFiOTQ3Y2FhMjAwMDFlYg==2024-07-19T19:06:46Z + +[2024-07-20 05:06:47] : [DEBUG] RX from 192.168.1.203 << HTTP/1.1 401 Unauthorized +WWW-Authenticate: Digest algorithm=MD5, realm="camara", qop="auth", nonce="669ab946cb929d436a5f", opaque="dabb351c" +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 2474 +Connection: close + + +[2024-07-20 05:06:47] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedError 401: HTTP 401 Unauthorized + + +[2024-07-20 05:06:47] : [DEBUG] TX >> POST /onvif/ptz_service HTTP/1.1 +Host: 192.168.1.203:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver20/ptz/wsdl/GetNodes" +Content-Length: 2271 +Authorization: Digest username="admin", realm="camara", nonce="669ab946cb929d436a5f", uri="/onvif/ptz_service", response="e12abb168ff605396f9118644ea5041d", opaque="dabb351c", qop="auth", cnonce="0000154700004DB7", nc=00000001, algorithm=MD5 +Connection: close + +[2024-07-20 05:06:47] : [DEBUG] admin9mjB8B2EjYO/royV1TgVNF5f4pg=OWFiOTQ3Y2FhMzAwNGQwNg==2024-07-19T19:06:46Z + +[2024-07-20 05:06:47] : [DEBUG] RX from 192.168.1.202 << HTTP/1.1 400 Bad Request +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 2548 +Connection: close + + +[2024-07-20 05:06:47] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedThe device is locked because of entering wrong username/password many times.Please try it after 5 minutes! + + +[2024-07-20 05:06:47] : [DEBUG] RX from 192.168.1.203 << HTTP/1.1 401 Unauthorized +WWW-Authenticate: Digest algorithm=MD5, realm="camara", qop="auth", nonce="669ab946cb93182d304e", opaque="c0a78d28" +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 2474 +Connection: close + + +[2024-07-20 05:06:47] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedError 401: HTTP 401 Unauthorized + + +[2024-07-20 05:06:47] : [DEBUG] TX >> POST /onvif/ptz_service HTTP/1.1 +Host: 192.168.1.203:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver20/ptz/wsdl/GetConfigurations" +Content-Length: 2280 +Connection: close + +[2024-07-20 05:06:47] : [DEBUG] adminAP6UdRHj7XANCeR/ug9TbtZqh3c=OWFiOTQ3Y2FhNDAwNTRkZQ==2024-07-19T19:06:46Z + +[2024-07-20 05:06:47] : [DEBUG] RX from 192.168.1.203 << HTTP/1.1 401 Unauthorized +WWW-Authenticate: Digest algorithm=MD5, realm="camara", qop="auth", nonce="669ab946cb9417cb6444", opaque="e9e8ec97" +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 2474 +Connection: close + + +[2024-07-20 05:06:47] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedError 401: HTTP 401 Unauthorized + + +[2024-07-20 05:06:47] : [DEBUG] TX >> POST /onvif/ptz_service HTTP/1.1 +Host: 192.168.1.203:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver20/ptz/wsdl/GetConfigurations" +Content-Length: 2280 +Authorization: Digest username="admin", realm="camara", nonce="669ab946cb9417cb6444", uri="/onvif/ptz_service", response="2c9116f365133717121538e75cd04081", opaque="e9e8ec97", qop="auth", cnonce="0000074D00002D12", nc=00000001, algorithm=MD5 +Connection: close + +[2024-07-20 05:06:47] : [DEBUG] admin6tq70pr0z+AvZ/01e64HDnvKbB0=OWFiOTQ3Y2FhNTAwMzliMw==2024-07-19T19:06:46Z + +[2024-07-20 05:06:47] : [DEBUG] RX from 192.168.1.203 << HTTP/1.1 401 Unauthorized +WWW-Authenticate: Digest algorithm=MD5, realm="camara", qop="auth", nonce="669ab946cb95a97d8540", opaque="78979346" +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 2474 +Connection: close + + +[2024-07-20 05:06:47] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedError 401: HTTP 401 Unauthorized + + +[2024-07-20 05:06:47] : [DEBUG] TX >> POST /onvif/Media2 HTTP/1.1 +Host: 192.168.1.203:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver20/media/wsdl/GetProfiles" +Content-Length: 2313 +Connection: close + +[2024-07-20 05:06:47] : [DEBUG] admin3Xq66Agx+dC3EdE9g0xqgTyj+Sc=OWFiOTQ3Y2FhNjAwNGRjOA==2024-07-19T19:06:46ZALL + +[2024-07-20 05:06:47] : [DEBUG] RX from 192.168.1.203 << HTTP/1.1 401 Unauthorized +WWW-Authenticate: Digest algorithm=MD5, realm="camara", qop="auth", nonce="669ab946cb96fc2d93f7", opaque="081873f9" +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 2474 +Connection: close + + +[2024-07-20 05:06:47] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedError 401: HTTP 401 Unauthorized + + +[2024-07-20 05:06:47] : [DEBUG] TX >> POST /onvif/Media2 HTTP/1.1 +Host: 192.168.1.203:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver20/media/wsdl/GetProfiles" +Content-Length: 2313 +Authorization: Digest username="admin", realm="camara", nonce="669ab946cb96fc2d93f7", uri="/onvif/Media2", response="3810abf8c7a4d7e6de91a22de001b6e3", opaque="081873f9", qop="auth", cnonce="0000428B000066BB", nc=00000001, algorithm=MD5 +Connection: close + +[2024-07-20 05:06:47] : [DEBUG] adminsgrgAdADw+ZhMnHeNThRvtYnyhE=OWFiOTQ3Y2FhNzAwNjQ0Mw==2024-07-19T19:06:46ZALL + +[2024-07-20 05:06:47] : [DEBUG] RX from 192.168.1.203 << HTTP/1.1 401 Unauthorized +WWW-Authenticate: Digest algorithm=MD5, realm="camara", qop="auth", nonce="669ab946cb97208faacc", opaque="f1edecd6" +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 2474 +Connection: close + + +[2024-07-20 05:06:47] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedError 401: HTTP 401 Unauthorized + + +[2024-07-20 05:06:47] : [DEBUG] TX >> POST /onvif/media_service HTTP/1.1 +Host: 192.168.1.203:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/media/wsdl/GetProfiles" +Content-Length: 2273 +Connection: close + +[2024-07-20 05:06:47] : [DEBUG] adminiztnVhTxIr2Ljkfgcy1JcTp7PuU=OWFiOTQ3Y2FhODAwMjZhNg==2024-07-19T19:06:46Z + +[2024-07-20 05:06:47] : [DEBUG] RX from 192.168.1.203 << HTTP/1.1 401 Unauthorized +WWW-Authenticate: Digest algorithm=MD5, realm="camara", qop="auth", nonce="669ab946cb986752a468", opaque="e0ab9cf7" +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 2474 +Connection: close + + +[2024-07-20 05:06:47] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedError 401: HTTP 401 Unauthorized + + +[2024-07-20 05:06:47] : [DEBUG] TX >> POST /onvif/media_service HTTP/1.1 +Host: 192.168.1.203:8000 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/media/wsdl/GetProfiles" +Content-Length: 2273 +Authorization: Digest username="admin", realm="camara", nonce="669ab946cb986752a468", uri="/onvif/media_service", response="0bfae8f5abb5dda0ef1a9054bbd21d86", opaque="e0ab9cf7", qop="auth", cnonce="00007A5A00005D03", nc=00000001, algorithm=MD5 +Connection: close + +[2024-07-20 05:06:47] : [DEBUG] adminCSiixU6qVVHuEQW9Wt/hXRla1Ow=OWFiOTQ3Y2FhOTAwNzAxZg==2024-07-19T19:06:46Z + +[2024-07-20 05:06:47] : [DEBUG] RX from 192.168.1.203 << HTTP/1.1 401 Unauthorized +WWW-Authenticate: Digest algorithm=MD5, realm="camara", qop="auth", nonce="669ab946cb9973f55f4f", opaque="43835823" +Server: gSOAP/2.8 +Content-Type: application/soap+xml; charset=utf-8 +Content-Length: 2474 +Connection: close + + +[2024-07-20 05:06:47] : [DEBUG] +SOAP-ENV:Senderter:NotAuthorizedError 401: HTTP 401 Unauthorized + + +[2024-07-20 05:06:51] : [DEBUG] TX >> POST /5e337fc0-be64-4e8c-84bd-754270482921 HTTP/1.1 +Host: ANSNAS:5357 +User-Agent: Happytime onvif client V12.0 +Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetSystemDateAndTime" +Content-Length: 2282 +Connection: close + +[2024-07-20 05:06:51] : [DEBUG] adminfkTiV8IHWlXwjq6TiAdQUoCJQrM=OWFiOTQzY2E1MzAwMDAyOQ==2024-07-19T19:06:43Z + +[2024-07-20 05:06:51] : [DEBUG] RX from ANSNAS << HTTP/1.1 502 Bad Gateway +Server: nginx +Date: Fri, 19 Jul 2024 19:06:50 GMT +Content-Type: text/html +Content-Length: 150 +Connection: close + + +[2024-07-20 05:06:51] : [DEBUG] +502 Bad Gateway + +

502 Bad Gateway

+
nginx
+ + + + +[2024-07-20 05:06:51] : [ERROR] hxml_parse_element_end, cur name[body] != stack name[hr]!!! +[2024-07-20 05:06:51] : [ERROR] xxx_hxml_parse, err[-1] +[2024-07-20 05:06:51] : [WARN] http_onvif_trans, xxx_hxml_parse ret null!!! diff --git a/MediaClient/happytime-onvif-client-library1/OnvifTest/start.sh b/MediaClient/happytime-onvif-client-library1/OnvifTest/start.sh new file mode 100644 index 0000000..2bb6dd5 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifTest/start.sh @@ -0,0 +1,5 @@ +#! /bin/sh + +CUR=$PWD +export LD_LIBRARY_PATH=../OnvifClientLibrary:../OnvifClientLibrary/openssl/lib/linux +./onviftest \ No newline at end of file diff --git a/MediaClient/happytime-onvif-client-library1/OnvifTest/stdafx.cpp b/MediaClient/happytime-onvif-client-library1/OnvifTest/stdafx.cpp new file mode 100644 index 0000000..87b7269 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifTest/stdafx.cpp @@ -0,0 +1,6 @@ + +#include "stdafx.h" + + + + diff --git a/MediaClient/happytime-onvif-client-library1/OnvifTest/stdafx.h b/MediaClient/happytime-onvif-client-library1/OnvifTest/stdafx.h new file mode 100644 index 0000000..09ececa --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifTest/stdafx.h @@ -0,0 +1,15 @@ + +#pragma once + +#include +#include +#include +#include + +#include +#include +#include + +#include + + diff --git a/MediaClient/happytime-onvif-client-library1/OnvifTest2/OnvifTest2.cpp b/MediaClient/happytime-onvif-client-library1/OnvifTest2/OnvifTest2.cpp new file mode 100644 index 0000000..89f112b --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifTest2/OnvifTest2.cpp @@ -0,0 +1,320 @@ +/*************************************************************************************** + * + * 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.h" +#include "http_parse.h" +#include "onvif.h" +#include "onvif_event.h" +#include "onvif_api.h" + +/***************************************************************************************/ + +ONVIF_DEVICE g_device; +ONVIF_DEVICE g_device2; + +#define MAX_DEV_NUMS 10 + +/***************************************************************************************/ + +int getDeviceIndex(ONVIF_DEVICE * p_device) +{ + if (p_device == &g_device) + { + return 0; + } + else if (p_device == &g_device2) + { + return 1; + } + + return -1; +} + +ONVIF_DEVICE * getDeviceByIndex(int index) +{ + if (0 == index) + { + return &g_device; + } + else if (1 == index) + { + return &g_device2; + } + + return NULL; +} + +/** + * onvif event notify callback + */ +void eventNotifyCallback(Notify_REQ * p_req, void * p_data) +{ + NotificationMessageList * p_notify = p_req->notify; + NotificationMessageList * p_tmp = p_notify; + + printf("receive event : \r\n"); + printf("\tposturl : %s\r\n", p_req->PostUrl); + + while (p_tmp) + { + printf("\tTopic : %s\r\n", p_tmp->NotificationMessage.Topic); + + p_tmp = p_tmp->next; + } + + int index = -1; + ONVIF_DEVICE * p_dev = NULL; + + sscanf(p_req->PostUrl, "/subscription%d", &index); + + p_dev = getDeviceByIndex(index); + if (NULL == p_dev) + { + return; + } + + onvif_device_add_NotificationMessages(p_dev, p_notify); + + p_dev->events.notify_nums += onvif_get_NotificationMessages_nums(p_notify); + + // max save 100 event notify + if (p_dev->events.notify_nums > 100) + { + p_dev->events.notify_nums -= onvif_device_free_NotificationMessages(p_dev, p_dev->events.notify_nums - 100); + } +} + +/** + * onvif event subscribe disconnect callback + */ +void subscribeDisconnectCallback(ONVIF_DEVICE * p_dev, void * p_data) +{ + printf("\r\nsubscribeDisconnectCallback, %s\r\n", p_dev->binfo.XAddr.host); + + BOOL ret = FALSE; + + ret = Subscribe(p_dev, getDeviceIndex(p_dev)); + + printf("Subscribe, ret = %d\r\n", ret); +} + +void errorHandler(ONVIF_DEVICE * p_device) +{ + if (p_device->authFailed) // Authentication failed + { + printf("Authentication failed\r\n"); + } + + switch (p_device->errCode) + { + case ONVIF_ERR_ConnFailure: // Connection failed + printf("connect failure\r\n"); + break; + + case ONVIF_ERR_MallocFailure: // Failed to allocate memory + printf("memory malloc failure\r\n"); + break; + + case ONVIF_ERR_NotSupportHttps: // The device requires an HTTPS connection, but the onvif client library does not support it (the HTTPS compilation macro is not enabled) + printf("not support https\r\n"); + break; + + case ONVIF_ERR_RecvTimeout: // Message receiving timeout + printf("message receive timeout\r\n"); + break; + + case ONVIF_ERR_InvalidContentType: // Device response message content is invalid + printf("invalid content type\r\n"); + break; + + case ONVIF_ERR_NullContent: // Device response message has no content + printf("null content\r\n"); + break; + + case ONVIF_ERR_ParseFailed: // Parsing the message failed + printf("message parse failed\r\n"); + break; + + case ONVIF_ERR_HandleFailed: // Message handling failed + printf("message handle failed\r\n"); + break; + + case ONVIF_ERR_HttpResponseError: // The device responded with an error message + printf("code=%s\r\n", p_device->fault.Code); + printf("subcode=%s\r\n", p_device->fault.Subcode); + printf("reason=%s\r\n", p_device->fault.Reason); + break; + + default: + break; + } +} + +int main(int argc, char* argv[]) +{ + network_init(); + + // open log file + log_init("onviftest2.log"); + log_set_level(HT_LOG_DBG); + + // init sys buffer + sys_buf_init(10 * MAX_DEV_NUMS); + + // init http message buffer + http_msg_buf_init(10 * MAX_DEV_NUMS); + + // init event handler + // bind the http server to 0.0.0.0:30100 + onvif_event_init(NULL, 30100, MAX_DEV_NUMS); + + // set event callback + onvif_set_event_notify_cb(eventNotifyCallback, 0); + + // set event subscribe disconnect callback + onvif_set_subscribe_disconnect_cb(subscribeDisconnectCallback, 0); + + // init g_device + memset(&g_device, 0, sizeof(g_device)); + + g_device.binfo.XAddr.https = 0; + g_device.binfo.XAddr.port = 8000; + strcpy(g_device.binfo.XAddr.host, "192.168.1.3"); + strcpy(g_device.binfo.XAddr.url, "/onvif/device_service"); + + // set device login information + onvif_SetAuthInfo(&g_device, "admin", "admin"); + // set auth method + onvif_SetAuthMethod(&g_device, AuthMethod_UsernameToken); + // set request timeout + onvif_SetReqTimeout(&g_device, 5000); + + if (!GetSystemDateAndTime(&g_device)) + { + errorHandler(&g_device); + printf("%s, GetSystemDateAndTime failed\r\n", g_device.binfo.XAddr.host); + } + + if (!GetCapabilities(&g_device)) + { + errorHandler(&g_device); + printf("%s, GetCapabilities failed\r\n", g_device.binfo.XAddr.host); + } + + if (!GetServices(&g_device)) + { + errorHandler(&g_device); + printf("%s, GetServices failed\r\n", g_device.binfo.XAddr.host); + } + + if (!GetDeviceInformation(&g_device)) + { + errorHandler(&g_device); + printf("%s, GetDeviceInformation failed\r\n", g_device.binfo.XAddr.host); + } + + if (g_device.Capabilities.events.support == 1) + { + if (Subscribe(&g_device, getDeviceIndex(&g_device))) + { + printf("Subscribe successful!\r\n"); + } + else + { + errorHandler(&g_device); + printf("Subscribe failed!\r\n"); + } + } + + // init g_device2 + g_device2.binfo.XAddr.https = 0; + g_device2.binfo.XAddr.port = 8000; + strcpy(g_device2.binfo.XAddr.host, "192.168.1.4"); + strcpy(g_device2.binfo.XAddr.url, "/onvif/device_service"); + + // set device login information + onvif_SetAuthInfo(&g_device2, "admin", "admin"); + // set auth method + onvif_SetAuthMethod(&g_device2, AuthMethod_UsernameToken); + // set request timeout + onvif_SetReqTimeout(&g_device2, 5000); + + if (!GetSystemDateAndTime(&g_device2)) + { + errorHandler(&g_device2); + printf("%s, GetSystemDateAndTime failed\r\n", g_device2.binfo.XAddr.host); + } + + if (!GetCapabilities(&g_device2)) + { + errorHandler(&g_device2); + printf("%s, GetCapabilities failed\r\n", g_device2.binfo.XAddr.host); + } + + if (!GetServices(&g_device2)) + { + errorHandler(&g_device2); + printf("%s, GetServices failed\r\n", g_device2.binfo.XAddr.host); + } + + if (!GetDeviceInformation(&g_device2)) + { + errorHandler(&g_device2); + printf("%s, GetDeviceInformation failed\r\n", g_device2.binfo.XAddr.host); + } + + if (g_device2.Capabilities.events.support == 1) + { + if (Subscribe(&g_device2, getDeviceIndex(&g_device2))) + { + printf("Subscribe successful!\r\n"); + } + else + { + errorHandler(&g_device2); + printf("Subscribe failed!\r\n"); + } + } + + for (;;) + { + if (getchar() == 'q') + { + break; + } + + sleep(1); + } + + onvif_free_device(&g_device); + onvif_free_device(&g_device2); + + onvif_event_deinit(); + + http_msg_buf_deinit(); + sys_buf_deinit(); + + log_close(); + + return 0; +} + + + diff --git a/MediaClient/happytime-onvif-client-library1/OnvifTest2/OnvifTest2.vcxproj b/MediaClient/happytime-onvif-client-library1/OnvifTest2/OnvifTest2.vcxproj new file mode 100644 index 0000000..d0cbc58 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifTest2/OnvifTest2.vcxproj @@ -0,0 +1,202 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {DA689200-DC98-4BEF-A991-9AE67F89BA86} + OnvifTest2 + Win32Proj + 10.0 + + + + Application + Unicode + true + v143 + + + Application + Unicode + true + v143 + + + Application + Unicode + v143 + + + Application + Unicode + v143 + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + ..\bin\x86\ + ..\bin\x64\ + $(Platform)\$(ProjectName)\$(Configuration)\ + $(Platform)\$(ProjectName)\$(Configuration)\ + true + true + ..\bin\x86\ + ..\bin\x64\ + $(Platform)\$(ProjectName)\$(Configuration)\ + $(Platform)\$(ProjectName)\$(Configuration)\ + false + false + AllRules.ruleset + AllRules.ruleset + + + + + AllRules.ruleset + AllRules.ruleset + + + + + $(ProjectName)D + $(ProjectName)D + + + + Disabled + .;..\OnvifClientLibrary\bm;..\OnvifClientLibrary\http;..\OnvifClientLibrary\onvif;%(AdditionalIncludeDirectories) + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + false + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + 4996;%(DisableSpecificWarnings) + + + winmm.lib;OnvifClientLibrary.lib;%(AdditionalDependencies) + $(OutDir)\$(ProjectName)D.exe + ..\lib\x86;..\OnvifClientLibrary\openssl\lib\x86;%(AdditionalLibraryDirectories) + true + Console + MachineX86 + + + + + Disabled + .;..\OnvifClientLibrary\bm;..\OnvifClientLibrary\http;..\OnvifClientLibrary\onvif;%(AdditionalIncludeDirectories) + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + 4996;%(DisableSpecificWarnings) + + + ws2_32.lib;OnvifClientLibrary.lib;%(AdditionalDependencies) + $(OutDir)\$(ProjectName)D.exe + ..\lib\x64;..\OnvifClientLibrary\openssl\lib\x64;%(AdditionalLibraryDirectories) + true + Console + + + + + MaxSpeed + true + .;..\OnvifClientLibrary\bm;..\OnvifClientLibrary\http;..\OnvifClientLibrary\onvif;%(AdditionalIncludeDirectories) + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level3 + ProgramDatabase + 4996;%(DisableSpecificWarnings) + + + winmm.lib;OnvifClientLibrary.lib;%(AdditionalDependencies) + $(OutDir)\$(ProjectName).exe + ..\lib\x86;..\OnvifClientLibrary\openssl\lib\x86;%(AdditionalLibraryDirectories) + true + Console + true + true + MachineX86 + + + + + MaxSpeed + true + .;..\OnvifClientLibrary\bm;..\OnvifClientLibrary\http;..\OnvifClientLibrary\onvif;%(AdditionalIncludeDirectories) + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level3 + ProgramDatabase + 4996;%(DisableSpecificWarnings) + + + OnvifClientLibrary.lib;ws2_32.lib;%(AdditionalDependencies) + $(OutDir)\$(ProjectName).exe + ..\lib\x64;..\OnvifClientLibrary\openssl\lib\x64;%(AdditionalLibraryDirectories) + true + Console + true + true + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MediaClient/happytime-onvif-client-library1/OnvifTest2/mac.mk b/MediaClient/happytime-onvif-client-library1/OnvifTest2/mac.mk new file mode 100644 index 0000000..12cb801 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifTest2/mac.mk @@ -0,0 +1,60 @@ +################OPTION################### +OUTPUT = onviftest2 +CCOMPILE = gcc +CPPCOMPILE = g++ +COMPILEOPTION = -g -c -Wall +COMPILEOPTION += -DIOS +COMPILEOPTION += -DPROFILE_C_SUPPORT +COMPILEOPTION += -DPROFILE_G_SUPPORT +COMPILEOPTION += -DTHERMAL_SUPPORT +COMPILEOPTION += -DCREDENTIAL_SUPPORT +COMPILEOPTION += -DACCESS_RULES +COMPILEOPTION += -DSCHEDULE_SUPPORT +COMPILEOPTION += -DRECEIVER_SUPPORT +COMPILEOPTION += -DIPFILTER_SUPPORT +COMPILEOPTION += -DDEVICEIO_SUPPORT +LINK = g++ +LINKOPTION = -g -o $(OUTPUT) +INCLUDEDIR += -I../OnvifClientLibrary/bm +INCLUDEDIR += -I../OnvifClientLibrary/http +INCLUDEDIR += -I../OnvifClientLibrary/onvif +LIBDIRS += -L../OnvifClientLibrary +LIBDIRS += -L../OnvifClientLibrary/openssl/lib/linux +OBJS = OnvifTest2.o +SHAREDLIB += -lcrypto +SHAREDLIB += -lssl +SHAREDLIB += -lonvifclient +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 + diff --git a/MediaClient/happytime-onvif-client-library1/OnvifTest2/start.sh b/MediaClient/happytime-onvif-client-library1/OnvifTest2/start.sh new file mode 100644 index 0000000..083b7fd --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifTest2/start.sh @@ -0,0 +1,5 @@ +#! /bin/sh + +CUR=$PWD +export LD_LIBRARY_PATH=../OnvifClientLibrary:../OnvifClientLibrary/openssl/lib/linux +./onviftest2 \ No newline at end of file diff --git a/MediaClient/happytime-onvif-client-library1/OnvifTest2/stdafx.cpp b/MediaClient/happytime-onvif-client-library1/OnvifTest2/stdafx.cpp new file mode 100644 index 0000000..87b7269 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifTest2/stdafx.cpp @@ -0,0 +1,6 @@ + +#include "stdafx.h" + + + + diff --git a/MediaClient/happytime-onvif-client-library1/OnvifTest2/stdafx.h b/MediaClient/happytime-onvif-client-library1/OnvifTest2/stdafx.h new file mode 100644 index 0000000..09ececa --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifTest2/stdafx.h @@ -0,0 +1,15 @@ + +#pragma once + +#include +#include +#include +#include + +#include +#include +#include + +#include + + diff --git a/MediaClient/happytime-onvif-client-library1/OnvifTest3/OnvifTest3.cpp b/MediaClient/happytime-onvif-client-library1/OnvifTest3/OnvifTest3.cpp new file mode 100644 index 0000000..67ae588 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifTest3/OnvifTest3.cpp @@ -0,0 +1,295 @@ +/*************************************************************************************** + * + * 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.h" +#include "http_parse.h" +#include "onvif.h" +#include "onvif_event.h" +#include "onvif_api.h" + +/***************************************************************************************/ + +ONVIF_DEVICE g_device; +ONVIF_DEVICE g_device2; + +#define MAX_DEV_NUMS 10 + +/***************************************************************************************/ + +int getDeviceIndex(ONVIF_DEVICE * p_device) +{ + if (p_device == &g_device) + { + return 0; + } + else if (p_device == &g_device2) + { + return 1; + } + + return -1; +} + +ONVIF_DEVICE * getDeviceByIndex(int index) +{ + if (0 == index) + { + return &g_device; + } + else if (1 == index) + { + return &g_device2; + } + + return NULL; +} + + +/** + * onvif event notify callback + */ +void eventNotifyCallback(Notify_REQ * p_req, void * p_data) +{ + NotificationMessageList * p_notify = p_req->notify; + NotificationMessageList * p_tmp = p_notify; + + printf("receive event : \r\n"); + printf("\tposturl : %s\r\n", p_req->PostUrl); + + while (p_tmp) + { + printf("\tTopic : %s\r\n", p_tmp->NotificationMessage.Topic); + + p_tmp = p_tmp->next; + } + + int index = -1; + ONVIF_DEVICE * p_dev = NULL; + + sscanf(p_req->PostUrl, "/subscription%d", &index); + + p_dev = getDeviceByIndex(index); + if (NULL == p_dev) + { + return; + } + + onvif_device_add_NotificationMessages(p_dev, p_notify); + + p_dev->events.notify_nums += onvif_get_NotificationMessages_nums(p_notify); + + // max save 100 event notify + if (p_dev->events.notify_nums > 100) + { + p_dev->events.notify_nums -= onvif_device_free_NotificationMessages(p_dev, p_dev->events.notify_nums - 100); + } +} + +/** + * onvif event subscribe disconnect callback + */ +void subscribeDisconnectCallback(ONVIF_DEVICE * p_dev, void * p_data) +{ + printf("\r\nsubscribeDisconnectCallback, %s\r\n", p_dev->binfo.XAddr.host); + + BOOL ret = FALSE; + + ret = Subscribe(p_dev, getDeviceIndex(p_dev)); + + printf("Subscribe, ret = %d\r\n", ret); +} + +void errorHandler(ONVIF_DEVICE * p_device) +{ + if (p_device->authFailed) // Authentication failed + { + printf("Authentication failed\r\n"); + } + + switch (p_device->errCode) + { + case ONVIF_ERR_ConnFailure: // Connection failed + printf("connect failure\r\n"); + break; + + case ONVIF_ERR_MallocFailure: // Failed to allocate memory + printf("memory malloc failure\r\n"); + break; + + case ONVIF_ERR_NotSupportHttps: // The device requires an HTTPS connection, but the onvif client library does not support it (the HTTPS compilation macro is not enabled) + printf("not support https\r\n"); + break; + + case ONVIF_ERR_RecvTimeout: // Message receiving timeout + printf("message receive timeout\r\n"); + break; + + case ONVIF_ERR_InvalidContentType: // Device response message content is invalid + printf("invalid content type\r\n"); + break; + + case ONVIF_ERR_NullContent: // Device response message has no content + printf("null content\r\n"); + break; + + case ONVIF_ERR_ParseFailed: // Parsing the message failed + printf("message parse failed\r\n"); + break; + + case ONVIF_ERR_HandleFailed: // Message handling failed + printf("message handle failed\r\n"); + break; + + case ONVIF_ERR_HttpResponseError: // The device responded with an error message + printf("code=%s\r\n", p_device->fault.Code); + printf("subcode=%s\r\n", p_device->fault.Subcode); + printf("reason=%s\r\n", p_device->fault.Reason); + break; + + default: + break; + } +} + +void * procThread(void * argv) +{ + ONVIF_DEVICE * p_device = (ONVIF_DEVICE *)argv; + + if (!GetSystemDateAndTime(p_device)) + { + errorHandler(p_device); + printf("%s, GetSystemDateAndTime failed\r\n", p_device->binfo.XAddr.host); + } + + if (!GetCapabilities(p_device)) + { + errorHandler(p_device); + printf("%s, GetCapabilities failed\r\n", p_device->binfo.XAddr.host); + } + + if (!GetServices(p_device)) + { + errorHandler(p_device); + printf("%s, GetServices failed\r\n", p_device->binfo.XAddr.host); + } + + if (!GetDeviceInformation(p_device)) + { + errorHandler(p_device); + printf("%s, GetDeviceInformation failed\r\n", p_device->binfo.XAddr.host); + } + + if (p_device->Capabilities.events.support == 1) + { + if (Subscribe(p_device, getDeviceIndex(p_device))) + { + printf("Subscribe successful!\r\n"); + } + else + { + errorHandler(p_device); + printf("Subscribe failed!\r\n"); + } + } + + return NULL; +} + +int main(int argc, char* argv[]) +{ + network_init(); + + // open log file + log_init("onviftest3.log"); + log_set_level(HT_LOG_DBG); + + // init sys buffer + sys_buf_init(10 * MAX_DEV_NUMS); + + // init http message buffer + http_msg_buf_init(10 * MAX_DEV_NUMS); + + // init event handler + // bind the http server to 0.0.0.0:30100 + onvif_event_init(NULL, 30100, 10 * MAX_DEV_NUMS); + + // set event callback + onvif_set_event_notify_cb(eventNotifyCallback, 0); + + // set event subscribe disconnect callback + onvif_set_subscribe_disconnect_cb(subscribeDisconnectCallback, 0); + + // init g_device + memset(&g_device, 0, sizeof(g_device)); + + g_device.binfo.XAddr.https = 0; + g_device.binfo.XAddr.port = 8000; + strcpy(g_device.binfo.XAddr.host, "192.168.1.3"); + strcpy(g_device.binfo.XAddr.url, "/onvif/device_service"); + + // set device login information + onvif_SetAuthInfo(&g_device, "admin", "admin"); + // set auth method + onvif_SetAuthMethod(&g_device, AuthMethod_UsernameToken); + // set request timeout + onvif_SetReqTimeout(&g_device, 5000); + + sys_os_create_thread((void *) procThread, &g_device); + + // init g_device2 + g_device2.binfo.XAddr.https = 0; + g_device2.binfo.XAddr.port = 8000; + strcpy(g_device2.binfo.XAddr.host, "192.168.1.4"); + strcpy(g_device2.binfo.XAddr.url, "/onvif/device_service"); + + // set device login information + onvif_SetAuthInfo(&g_device2, "admin", "admin"); + // set auth method + onvif_SetAuthMethod(&g_device2, AuthMethod_UsernameToken); + // set request timeout + onvif_SetReqTimeout(&g_device2, 5000); + + sys_os_create_thread((void *) procThread, &g_device2); + + for (;;) + { + if (getchar() == 'q') + { + break; + } + + sleep(1); + } + + onvif_free_device(&g_device); + onvif_free_device(&g_device2); + + onvif_event_deinit(); + + http_msg_buf_deinit(); + sys_buf_deinit(); + + log_close(); + + return 0; +} + + + diff --git a/MediaClient/happytime-onvif-client-library1/OnvifTest3/OnvifTest3.vcxproj b/MediaClient/happytime-onvif-client-library1/OnvifTest3/OnvifTest3.vcxproj new file mode 100644 index 0000000..3428757 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifTest3/OnvifTest3.vcxproj @@ -0,0 +1,199 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {06F85A1A-C2D4-4696-8D30-2E4BD8FFF5AF} + OnvifTest2 + Win32Proj + 10.0 + + + + Application + Unicode + true + v143 + + + Application + Unicode + true + v143 + + + Application + Unicode + v143 + + + Application + Unicode + v143 + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + ..\bin\x86\ + ..\bin\x64\ + $(Platform)\$(ProjectName)\$(Configuration)\ + $(Platform)\$(ProjectName)\$(Configuration)\ + true + true + ..\bin\x86\ + ..\bin\x64\ + $(Platform)\$(ProjectName)\$(Configuration)\ + $(Platform)\$(ProjectName)\$(Configuration)\ + false + false + AllRules.ruleset + AllRules.ruleset + + + + + AllRules.ruleset + AllRules.ruleset + + + + + $(ProjectName)D + $(ProjectName)D + + + + Disabled + .;..\OnvifClientLibrary\bm;..\OnvifClientLibrary\http;..\OnvifClientLibrary\onvif;%(AdditionalIncludeDirectories) + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + false + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + 4996;%(DisableSpecificWarnings) + + + winmm.lib;OnvifClientLibrary.lib;%(AdditionalDependencies) + $(OutDir)\$(ProjectName)D.exe + ..\lib\x86;..\OnvifClientLibrary\openssl\lib\x86;%(AdditionalLibraryDirectories) + true + Console + MachineX86 + + + + + Disabled + .;..\OnvifClientLibrary\bm;..\OnvifClientLibrary\http;..\OnvifClientLibrary\onvif;%(AdditionalIncludeDirectories) + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + 4996;%(DisableSpecificWarnings) + + + ws2_32.lib;OnvifClientLibrary.lib;%(AdditionalDependencies) + $(OutDir)\$(ProjectName)D.exe + ..\lib\x64;..\OnvifClientLibrary\openssl\lib\x64;%(AdditionalLibraryDirectories) + true + Console + + + + + MaxSpeed + true + .;..\OnvifClientLibrary\bm;..\OnvifClientLibrary\http;..\OnvifClientLibrary\onvif;%(AdditionalIncludeDirectories) + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level3 + ProgramDatabase + 4996;%(DisableSpecificWarnings) + + + winmm.lib;OnvifClientLibrary.lib;%(AdditionalDependencies) + $(OutDir)\$(ProjectName).exe + ..\lib\x86;..\OnvifClientLibrary\openssl\lib\x86;%(AdditionalLibraryDirectories) + true + Console + true + true + MachineX86 + + + + + MaxSpeed + true + .;..\OnvifClientLibrary\bm;..\OnvifClientLibrary\http;..\OnvifClientLibrary\onvif;%(AdditionalIncludeDirectories) + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level3 + ProgramDatabase + 4996;%(DisableSpecificWarnings) + + + OnvifClientLibrary.lib;ws2_32.lib;%(AdditionalDependencies) + $(OutDir)\$(ProjectName).exe + ..\lib\x64;..\OnvifClientLibrary\openssl\lib\x64;%(AdditionalLibraryDirectories) + true + Console + true + true + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MediaClient/happytime-onvif-client-library1/OnvifTest3/mac.mk b/MediaClient/happytime-onvif-client-library1/OnvifTest3/mac.mk new file mode 100644 index 0000000..2ac6841 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifTest3/mac.mk @@ -0,0 +1,60 @@ +################OPTION################### +OUTPUT = onviftest3 +CCOMPILE = gcc +CPPCOMPILE = g++ +COMPILEOPTION = -g -c -Wall +COMPILEOPTION += -DIOS +COMPILEOPTION += -DPROFILE_C_SUPPORT +COMPILEOPTION += -DPROFILE_G_SUPPORT +COMPILEOPTION += -DTHERMAL_SUPPORT +COMPILEOPTION += -DCREDENTIAL_SUPPORT +COMPILEOPTION += -DACCESS_RULES +COMPILEOPTION += -DSCHEDULE_SUPPORT +COMPILEOPTION += -DRECEIVER_SUPPORT +COMPILEOPTION += -DIPFILTER_SUPPORT +COMPILEOPTION += -DDEVICEIO_SUPPORT +LINK = g++ +LINKOPTION = -g -o $(OUTPUT) +INCLUDEDIR += -I../OnvifClientLibrary/bm +INCLUDEDIR += -I../OnvifClientLibrary/http +INCLUDEDIR += -I../OnvifClientLibrary/onvif +LIBDIRS += -L../OnvifClientLibrary +LIBDIRS += -L../OnvifClientLibrary/openssl/lib/linux +OBJS = OnvifTest3.o +SHAREDLIB += -lcrypto +SHAREDLIB += -lssl +SHAREDLIB += -lonvifclient +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 + diff --git a/MediaClient/happytime-onvif-client-library1/OnvifTest3/start.sh b/MediaClient/happytime-onvif-client-library1/OnvifTest3/start.sh new file mode 100644 index 0000000..0b12817 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifTest3/start.sh @@ -0,0 +1,5 @@ +#! /bin/sh + +CUR=$PWD +export LD_LIBRARY_PATH=../OnvifClientLibrary:../OnvifClientLibrary/openssl/lib/linux +./onviftest3 \ No newline at end of file diff --git a/MediaClient/happytime-onvif-client-library1/OnvifTest3/stdafx.cpp b/MediaClient/happytime-onvif-client-library1/OnvifTest3/stdafx.cpp new file mode 100644 index 0000000..87b7269 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifTest3/stdafx.cpp @@ -0,0 +1,6 @@ + +#include "stdafx.h" + + + + diff --git a/MediaClient/happytime-onvif-client-library1/OnvifTest3/stdafx.h b/MediaClient/happytime-onvif-client-library1/OnvifTest3/stdafx.h new file mode 100644 index 0000000..09ececa --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/OnvifTest3/stdafx.h @@ -0,0 +1,15 @@ + +#pragma once + +#include +#include +#include +#include + +#include +#include +#include + +#include + + diff --git a/MediaClient/happytime-onvif-client-library1/doc/Version b/MediaClient/happytime-onvif-client-library1/doc/Version new file mode 100644 index 0000000..8bafbd7 --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/doc/Version @@ -0,0 +1 @@ +12.0 \ No newline at end of file diff --git a/MediaClient/happytime-onvif-client-library1/doc/developer manual(Onvif client library).pdf b/MediaClient/happytime-onvif-client-library1/doc/developer manual(Onvif client library).pdf new file mode 100644 index 0000000..6cae39f Binary files /dev/null and b/MediaClient/happytime-onvif-client-library1/doc/developer manual(Onvif client library).pdf differ diff --git a/MediaClient/happytime-onvif-client-library1/doc/license.txt b/MediaClient/happytime-onvif-client-library1/doc/license.txt new file mode 100644 index 0000000..22272fe --- /dev/null +++ b/MediaClient/happytime-onvif-client-library1/doc/license.txt @@ -0,0 +1,99 @@ + + Happytimesoft source code license + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 6 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work. + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, grants to You a perpetual, worldwide, non-exclusive, + no-charge, royalty-free, irrevocable copyright license to reproduce, + prepare Derivative Works of, publicly display, publicly perform, + sublicense, and distribute the Work and such Derivative Works in + Object form. + + 3. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Object form. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 4. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 5. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall be liable to You + for damages, including any direct, indirect, special, incidental, + or consequential damages of any character arising as a result of + this License or out of the use or inability to use the Work + (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commerc:qial damages or losses. + + 6. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility. + + END OF TERMS AND CONDITIONS + + 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. + + \ No newline at end of file diff --git a/MediaClient/happytime-onvif-client-library1/lib/android/libonvifclient_arm64-v8a.so b/MediaClient/happytime-onvif-client-library1/lib/android/libonvifclient_arm64-v8a.so new file mode 100644 index 0000000..23effb8 Binary files /dev/null and b/MediaClient/happytime-onvif-client-library1/lib/android/libonvifclient_arm64-v8a.so differ diff --git a/MediaClient/happytime-onvif-client-library1/lib/android/libonvifclient_armeabi-v7a.so b/MediaClient/happytime-onvif-client-library1/lib/android/libonvifclient_armeabi-v7a.so new file mode 100644 index 0000000..9fca54d Binary files /dev/null and b/MediaClient/happytime-onvif-client-library1/lib/android/libonvifclient_armeabi-v7a.so differ diff --git a/MediaClient/happytime-onvif-client-library1/lib/ios/libonvifclient-arm64.so b/MediaClient/happytime-onvif-client-library1/lib/ios/libonvifclient-arm64.so new file mode 100644 index 0000000..47cf8a4 Binary files /dev/null and b/MediaClient/happytime-onvif-client-library1/lib/ios/libonvifclient-arm64.so differ diff --git a/MediaClient/happytime-onvif-client-library1/lib/ios/libonvifclient-armv7.so b/MediaClient/happytime-onvif-client-library1/lib/ios/libonvifclient-armv7.so new file mode 100644 index 0000000..b368a5b Binary files /dev/null and b/MediaClient/happytime-onvif-client-library1/lib/ios/libonvifclient-armv7.so differ diff --git a/MediaClient/happytime-onvif-client-library1/lib/ios/libonvifclient-armv7s.so b/MediaClient/happytime-onvif-client-library1/lib/ios/libonvifclient-armv7s.so new file mode 100644 index 0000000..2b0b392 Binary files /dev/null and b/MediaClient/happytime-onvif-client-library1/lib/ios/libonvifclient-armv7s.so differ diff --git a/MediaClient/happytime-onvif-client-library1/lib/linux/libonvifclient.a b/MediaClient/happytime-onvif-client-library1/lib/linux/libonvifclient.a new file mode 100644 index 0000000..b43513e Binary files /dev/null and b/MediaClient/happytime-onvif-client-library1/lib/linux/libonvifclient.a differ diff --git a/MediaClient/happytime-onvif-client-library1/lib/linux/libonvifclient.so b/MediaClient/happytime-onvif-client-library1/lib/linux/libonvifclient.so new file mode 100644 index 0000000..079d082 Binary files /dev/null and b/MediaClient/happytime-onvif-client-library1/lib/linux/libonvifclient.so differ diff --git a/MediaClient/happytime-onvif-client-library1/lib/mac/libonvifclient.so b/MediaClient/happytime-onvif-client-library1/lib/mac/libonvifclient.so new file mode 100644 index 0000000..1a0f044 Binary files /dev/null and b/MediaClient/happytime-onvif-client-library1/lib/mac/libonvifclient.so differ diff --git a/MediaClient/third/SDL2-2.0.14.tar.gz b/MediaClient/third/SDL2-2.0.14.tar.gz new file mode 100644 index 0000000..b150608 Binary files /dev/null and b/MediaClient/third/SDL2-2.0.14.tar.gz differ diff --git a/MediaClient/third/alsa-lib-1.1.6.tar.bz2 b/MediaClient/third/alsa-lib-1.1.6.tar.bz2 new file mode 100644 index 0000000..fcbdd41 Binary files /dev/null and b/MediaClient/third/alsa-lib-1.1.6.tar.bz2 differ diff --git a/MediaClient/third/openssl-1.1.1g.tar.gz b/MediaClient/third/openssl-1.1.1g.tar.gz new file mode 100644 index 0000000..e768f9e Binary files /dev/null and b/MediaClient/third/openssl-1.1.1g.tar.gz differ diff --git a/MediaClient/third/srt-master.zip b/MediaClient/third/srt-master.zip new file mode 100644 index 0000000..bb58721 Binary files /dev/null and b/MediaClient/third/srt-master.zip differ diff --git a/MediaClient/third/zlib1211.zip b/MediaClient/third/zlib1211.zip new file mode 100644 index 0000000..56fc186 Binary files /dev/null and b/MediaClient/third/zlib1211.zip differ diff --git a/ONVIF/include/bm/base64.h b/ONVIF/include/bm/base64.h new file mode 100644 index 0000000..8e223b5 --- /dev/null +++ b/ONVIF/include/bm/base64.h @@ -0,0 +1,37 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef BASE64_H +#define BASE64_H + +#ifdef __cplusplus +extern "C" { +#endif + +HT_API int base64_encode(uint8 *source, uint32 sourcelen, char *target, uint32 targetlen); +HT_API int base64_decode(const char *source, uint32 sourcelen, uint8 *target, uint32 targetlen); + +#ifdef __cplusplus +} +#endif + + +#endif /* BASE64_H */ + + diff --git a/ONVIF/include/bm/hqueue.h b/ONVIF/include/bm/hqueue.h new file mode 100644 index 0000000..eae000f --- /dev/null +++ b/ONVIF/include/bm/hqueue.h @@ -0,0 +1,74 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef HQUEUE_H +#define HQUEUE_H + + +/***********************************************************/ +#define HQ_PUT_WAIT 0x00000001 +#define HQ_GET_WAIT 0x00000002 +#define HQ_NO_EVENT 0x00000004 + +/***********************************************************/ +typedef struct h_queue +{ + uint32 queue_mode; + uint32 unit_num; + uint32 unit_size; + uint32 front; + uint32 rear; + uint32 queue_buffer; + uint32 count_put_full; + + void * queue_putMutex; + void * queue_nnulEvent; + void * queue_nfulEvent; +} HQUEUE; + + +#ifdef __cplusplus +extern "C" { +#endif + +/***********************************************************/ +HT_API HQUEUE * hqCreate(uint32 unit_num, uint32 unit_size, uint32 queue_mode); +HT_API void hqDelete(HQUEUE * phq); + +HT_API BOOL hqBufPut(HQUEUE * phq,char * buf); +HT_API BOOL hqBufGet(HQUEUE * phq,char * buf); + +HT_API BOOL hqBufIsEmpty(HQUEUE * phq); +HT_API BOOL hqBufIsFull(HQUEUE * phq); + +HT_API char * hqBufGetWait(HQUEUE * phq); +HT_API void hqBufGetWaitPost(HQUEUE * phq); + +HT_API char * hqBufPutPtrWait(HQUEUE * phq); +HT_API void hqBufPutPtrWaitPost(HQUEUE * phq, BOOL bPutFinish); +HT_API BOOL hqBufPeek(HQUEUE * phq,char * buf); + +#ifdef __cplusplus +} +#endif + +#endif // HQUEUE_H + + + diff --git a/ONVIF/include/bm/hxml.h b/ONVIF/include/bm/hxml.h new file mode 100644 index 0000000..657dcb8 --- /dev/null +++ b/ONVIF/include/bm/hxml.h @@ -0,0 +1,60 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef H_XML_H +#define H_XML_H + +#define XML_MAX_STACK_DEPTH 1024 +#define XML_MAX_ATTR_NUM 200 + +typedef struct xmlparser +{ + char * xmlstart; + char * xmlend; + char * ptr; // pointer to current character + int xmlsize; + char * e_stack[XML_MAX_STACK_DEPTH]; + int e_stack_index; + char * attr[XML_MAX_ATTR_NUM]; + void * userdata; + + void (*startElement)(void * userdata, const char * name, const char ** attr); + void (*endElement)(void * userdata, const char * name); + void (*charData)(void * userdata, const char * str, int len); +} XMLPRS; + +#ifdef __cplusplus +extern "C" { +#endif + +HT_API int hxml_parse_header(XMLPRS * parse); +HT_API int hxml_parse_attr(XMLPRS * parse); +HT_API int hxml_parse_element_end(XMLPRS * parse); +HT_API int hxml_parse_element_start(XMLPRS * parse); +HT_API int hxml_parse_element(XMLPRS * parse); +HT_API int hxml_parse(XMLPRS * parse); + +#ifdef __cplusplus +} +#endif + +#endif // H_XML_H + + + diff --git a/ONVIF/include/bm/linked_list.h b/ONVIF/include/bm/linked_list.h new file mode 100644 index 0000000..798bef9 --- /dev/null +++ b/ONVIF/include/bm/linked_list.h @@ -0,0 +1,83 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef LINKED_LIST_H +#define LINKED_LIST_H + +/************************************************************************************/ +typedef struct LINKED_NODE +{ + struct LINKED_NODE * p_next; + struct LINKED_NODE * p_previous; + void * p_data; +} LINKED_NODE; + +/************************************************************************************/ +typedef struct LINKED_LIST +{ + LINKED_NODE * p_first_node; + LINKED_NODE * p_last_node; + void * list_semMutex; +} LINKED_LIST; + + +#ifdef __cplusplus +extern "C" { +#endif + +HT_API LINKED_LIST* h_list_create(BOOL bNeedMutex); +HT_API void h_list_free_container(LINKED_LIST * p_linked_list); +HT_API void h_list_free_all_node(LINKED_LIST * p_linked_list); + +HT_API void h_list_get_ownership(LINKED_LIST * p_linked_list); +HT_API void h_list_giveup_ownership(LINKED_LIST * p_linked_list); + +HT_API BOOL h_list_remove(LINKED_LIST * p_linked_list, LINKED_NODE * p_node); +HT_API BOOL h_list_remove_data(LINKED_LIST * p_linked_list, void * p_data); + +HT_API void h_list_remove_from_front(LINKED_LIST * p_linked_list); +HT_API void h_list_remove_from_front_no_lock(LINKED_LIST * p_linked_list); +HT_API void h_list_remove_from_back(LINKED_LIST * p_linked_list); + +HT_API BOOL h_list_add_at_front(LINKED_LIST * p_linked_list, void * p_item); +HT_API BOOL h_list_add_at_back(LINKED_LIST * p_linked_list, void * p_item); + +HT_API uint32 h_list_get_number_of_nodes(LINKED_LIST * p_linked_list); + +HT_API BOOL h_list_insert(LINKED_LIST * p_linked_list, LINKED_NODE * p_pre_node, void * p_item); + +HT_API LINKED_NODE* h_list_lookup_start(LINKED_LIST * p_linked_list); +HT_API LINKED_NODE* h_list_lookup_next(LINKED_LIST * p_linked_list, LINKED_NODE * p_node); +HT_API void h_list_lookup_end(LINKED_LIST * p_linked_list); + +HT_API LINKED_NODE* h_list_lookback_start(LINKED_LIST * p_linked_list); +HT_API LINKED_NODE* h_list_lookback_next(LINKED_LIST * p_linked_list, LINKED_NODE * p_node); +HT_API void h_list_lookback_end(LINKED_LIST * p_linked_list); + +HT_API BOOL h_list_is_empty(LINKED_LIST * p_list); +HT_API LINKED_NODE* h_list_get_from_front(LINKED_LIST * p_list); +HT_API LINKED_NODE* h_list_get_from_back(LINKED_LIST * p_list); + +#ifdef __cplusplus +} +#endif + +#endif // LINKED_LIST_H + + diff --git a/ONVIF/include/bm/ppstack.h b/ONVIF/include/bm/ppstack.h new file mode 100644 index 0000000..3a4ed0b --- /dev/null +++ b/ONVIF/include/bm/ppstack.h @@ -0,0 +1,110 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef PPSTACK_H +#define PPSTACK_H + + +/***************************************************************************************/ + +typedef struct PPSN // ppstack_node +{ + unsigned long prev_node; + unsigned long next_node; + unsigned long node_flag; // 0:idle 1:in FreeList 2:in UsedList +} PPSN; + +typedef struct PPSN_CTX +{ + char * fl_base; + uint32 head_node; + uint32 tail_node; + uint32 node_num; + uint32 low_offset; + uint32 high_offset; + uint32 unit_size; + void * ctx_mutex; + uint32 pop_cnt; + uint32 push_cnt; +} PPSN_CTX; + +#ifdef __cplusplus +extern "C" { +#endif + +/***************************************************************************************/ + +HT_API PPSN_CTX * pps_ctx_fl_init(unsigned long node_num, unsigned long content_size, BOOL bNeedMutex); +HT_API PPSN_CTX * pps_ctx_fl_init_assign(char * mem_addr, unsigned long mem_len, unsigned long node_num, unsigned long content_size, BOOL bNeedMutex); + +HT_API void pps_fl_free(PPSN_CTX * fl_ctx); +HT_API void pps_fl_reinit(PPSN_CTX * fl_ctx); + +HT_API BOOL pps_fl_push(PPSN_CTX * pps_ctx, void * content_ptr); +HT_API BOOL pps_fl_push_tail(PPSN_CTX * pps_ctx, void * content_ptr); +HT_API void * pps_fl_pop(PPSN_CTX * pps_ctx); + +HT_API PPSN_CTX * pps_ctx_ul_init(PPSN_CTX * fl_ctx, BOOL bNeedMutex); +HT_API BOOL pps_ctx_ul_init_assign(PPSN_CTX * ul_ctx, PPSN_CTX * fl_ctx, BOOL bNeedMutex); +HT_API BOOL pps_ctx_ul_init_nm(PPSN_CTX * fl_ctx, PPSN_CTX * ul_ctx); + +HT_API void pps_ul_reinit(PPSN_CTX * ul_ctx); +HT_API void pps_ul_free(PPSN_CTX * ul_ctx); + +HT_API BOOL pps_ctx_ul_del(PPSN_CTX * ul_ctx, void * content_ptr); +HT_API PPSN * pps_ctx_ul_del_node_unlock(PPSN_CTX * ul_ctx, PPSN * p_node); +HT_API void * pps_ctx_ul_del_unlock(PPSN_CTX * ul_ctx, void * content_ptr); + +HT_API BOOL pps_ctx_ul_add(PPSN_CTX * ul_ctx, void * content_ptr); +HT_API BOOL pps_ctx_ul_add_head(PPSN_CTX * ul_ctx, void * content_ptr); + +HT_API uint32 pps_get_index(PPSN_CTX * pps_ctx, void * content_ptr); +HT_API void * pps_get_node_by_index(PPSN_CTX * pps_ctx, unsigned long index); + +/***************************************************************************************/ +HT_API void * pps_lookup_start(PPSN_CTX * pps_ctx); +HT_API void * pps_lookup_next(PPSN_CTX * pps_ctx, void * ct_ptr); +HT_API void pps_lookup_end(PPSN_CTX * pps_ctx); + +HT_API void * pps_lookback_start(PPSN_CTX * pps_ctx); +HT_API void * pps_lookback_next(PPSN_CTX * pps_ctx, void * ct_ptr); +HT_API void pps_lookback_end(PPSN_CTX * pps_ctx); + +HT_API void pps_wait_mutex(PPSN_CTX * pps_ctx); +HT_API void pps_post_mutex(PPSN_CTX * pps_ctx); + +HT_API BOOL pps_safe_node(PPSN_CTX * pps_ctx, void * content_ptr); +HT_API BOOL pps_idle_node(PPSN_CTX * pps_ctx, void * content_ptr); +HT_API BOOL pps_exist_node(PPSN_CTX * pps_ctx, void * content_ptr); +HT_API BOOL pps_used_node(PPSN_CTX * pps_ctx, void * content_ptr); + +/***************************************************************************************/ +HT_API int pps_node_count(PPSN_CTX * pps_ctx); +HT_API void * pps_get_head_node(PPSN_CTX * pps_ctx); +HT_API void * pps_get_tail_node(PPSN_CTX * pps_ctx); +HT_API void * pps_get_next_node(PPSN_CTX * pps_ctx, void * content_ptr); +HT_API void * pps_get_prev_node(PPSN_CTX * pps_ctx, void * content_ptr); + +#ifdef __cplusplus +} +#endif + +#endif // PPSTACK_H + + diff --git a/ONVIF/include/bm/rfc_md5.h b/ONVIF/include/bm/rfc_md5.h new file mode 100644 index 0000000..2cf5103 --- /dev/null +++ b/ONVIF/include/bm/rfc_md5.h @@ -0,0 +1,46 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef RFC_MD5_H +#define RFC_MD5_H + +typedef struct +{ + uint32 total[2]; + uint32 state[4]; + uint8 buffer[64]; +} md5_context; + + +#ifdef __cplusplus +extern "C"{ +#endif + +HT_API void md5_starts(md5_context *ctx); +HT_API void md5_update(md5_context *ctx, uint8 *input, uint32 length); +HT_API void md5_finish(md5_context *ctx, uint8 digest[16]); + +#ifdef __cplusplus +} +#endif + +#endif + + + diff --git a/ONVIF/include/bm/sha1.h b/ONVIF/include/bm/sha1.h new file mode 100644 index 0000000..f2217ca --- /dev/null +++ b/ONVIF/include/bm/sha1.h @@ -0,0 +1,44 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef _SHA1_H_ +#define _SHA1_H_ + +typedef struct +{ + uint32 total[2]; + uint32 state[5]; + uint8 buffer[64]; +} sha1_context; + +#ifdef __cplusplus +extern "C" { +#endif + +HT_API void sha1_starts(sha1_context * ctx); +HT_API void sha1_update(sha1_context * ctx, uint8 * input, uint32 length); +HT_API void sha1_finish(sha1_context * ctx, uint8 digest[20]); + +#ifdef __cplusplus +} +#endif + +#endif // _SHA1_H_ + + diff --git a/ONVIF/include/bm/stdafx.cpp b/ONVIF/include/bm/stdafx.cpp new file mode 100644 index 0000000..87b7269 --- /dev/null +++ b/ONVIF/include/bm/stdafx.cpp @@ -0,0 +1,6 @@ + +#include "stdafx.h" + + + + diff --git a/ONVIF/include/bm/stdafx.h b/ONVIF/include/bm/stdafx.h new file mode 100644 index 0000000..09ececa --- /dev/null +++ b/ONVIF/include/bm/stdafx.h @@ -0,0 +1,15 @@ + +#pragma once + +#include +#include +#include +#include + +#include +#include +#include + +#include + + diff --git a/ONVIF/include/bm/sys_buf.h b/ONVIF/include/bm/sys_buf.h new file mode 100644 index 0000000..3c06fec --- /dev/null +++ b/ONVIF/include/bm/sys_buf.h @@ -0,0 +1,116 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef SYS_BUF_H +#define SYS_BUF_H + +/***************************************************************************************/ +#define MAX_AVN 8 +#define MAX_AVDESCLEN 500 +#define MAX_USRL 64 +#define MAX_PWDL 32 +#define MAX_NUML 64 +#define MAX_UA_ALT_NUM 8 + + +/***************************************************************************************/ +typedef struct header_value +{ + char header[32]; + char * value_string; +} HDRV; + +typedef struct ua_rtp_info +{ + int rtp_cnt; + uint32 rtp_ssrc; + uint32 rtp_ts; + uint8 rtp_pt; +} UA_RTP_INFO; + +typedef struct +{ + /* rtcp sender statistics */ + + int64 last_rtcp_ntp_time; + int64 first_rtcp_ntp_time; + uint32 packet_count; + uint32 octet_count; + uint32 last_octet_count; + int first_packet; + char cname[64]; +} UA_RTCP_INFO; + +typedef struct http_digest_auth_info +{ + char auth_name[MAX_USRL]; + char auth_pwd[64]; + char auth_uri[256]; + char auth_qop[32]; + char auth_nonce[128]; + char auth_cnonce[128]; + char auth_realm[128]; + char auth_algorithm[32]; + int auth_opaque_flag; + char auth_opaque[128]; + int auth_nc; + char auth_ncstr[12]; + char auth_response[100]; +} HD_AUTH_INFO; + +#ifdef __cplusplus +extern "C" { +#endif + +extern HT_API PPSN_CTX * hdrv_buf_fl; + +/***********************************************************************/ +HT_API BOOL net_buf_init(int num, int size); +HT_API void net_buf_deinit(); + +HT_API char * net_buf_get_idle(); +HT_API void net_buf_free(char * rbuf); +HT_API uint32 net_buf_get_size(); +HT_API uint32 net_buf_idle_num(); + +/***********************************************************************/ +HT_API BOOL hdrv_buf_init(int num); +HT_API void hdrv_buf_deinit(); + +HT_API HDRV * hdrv_buf_get_idle(); +HT_API void hdrv_buf_free(HDRV * pHdrv); +HT_API uint32 hdrv_buf_idle_num(); + +HT_API void hdrv_ctx_ul_init(PPSN_CTX * ul_ctx); +HT_API void hdrv_ctx_free(PPSN_CTX * p_ctx); + +/***********************************************************************/ +HT_API BOOL sys_buf_init(int nums); +HT_API void sys_buf_deinit(); +/***********************************************************************/ + + +#ifdef __cplusplus +} +#endif + +#endif // SYS_BUF_H + + + diff --git a/ONVIF/include/bm/sys_inc.h b/ONVIF/include/bm/sys_inc.h new file mode 100644 index 0000000..5865b91 --- /dev/null +++ b/ONVIF/include/bm/sys_inc.h @@ -0,0 +1,186 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef __SYS_INC_H__ +#define __SYS_INC_H__ + +#if defined(_WIN32) || defined(_WIN64) +#define __WINDOWS_OS__ 1 +#define __LINUX_OS__ 0 +#else +#define __WINDOWS_OS__ 0 +#define __LINUX_OS__ 1 +#endif + +#if __WINDOWS_OS__ + #ifdef HT_EXPORTS + #define HT_API __declspec(dllexport) + #else + #define HT_API __declspec(dllimport) + #endif + + #ifdef HT_STATIC + #undef HT_API + #define HT_API + #endif +#else + #define HT_API +#endif + +/***************************************************************************************/ +//typedef int int32; +typedef unsigned int uint32; +typedef unsigned short uint16; +typedef unsigned char uint8; + + +/***************************************************************************************/ +#if __WINDOWS_OS__ + +#include "stdafx.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include /* _beginthread, _endthread */ +#include +#include + +#define sleep(x) Sleep((x) * 1000) +#define usleep(x) Sleep((x) / 1000) + +#define strcasecmp stricmp +#define strncasecmp strnicmp +#define snprintf _snprintf + +#define pthread_t DWORD + +typedef __int64 int64; +typedef unsigned __int64 uint64; + +#pragma comment(lib, "iphlpapi.lib") +#pragma comment(lib, "ws2_32.lib") + +#elif __LINUX_OS__ + +#include +#include + +#ifndef ANDROID +#include +#endif + +#include +#include +#include +#include + +#ifndef IOS +#include +#include +#include +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef IOS +#include +#endif + +typedef signed char BOOL; +typedef int SOCKET; + +typedef int64_t int64; +typedef uint64_t uint64; + +#define TRUE 1 +#define FALSE 0 + +#define closesocket close + +#endif + +/*************************************************************************/ +#include "sys_log.h" +#include "ppstack.h" +#include "word_analyse.h" +#include "sys_buf.h" +#include "util.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +HT_API void * sys_os_create_mutex(); +HT_API void * sys_os_create_sig(); + +HT_API void sys_os_destroy_sig_mutex(void * ptr); + +HT_API int sys_os_mutex_enter(void * p_sem); +HT_API void sys_os_mutex_leave(void * p_sem); + +HT_API int sys_os_sig_wait(void * p_sig); +HT_API int sys_os_sig_wait_timeout(void * p_sig, uint32 ms); +HT_API void sys_os_sig_sign(void * p_sig); + +HT_API pthread_t sys_os_create_thread(void * thread_func, void * argv); + +HT_API uint32 sys_os_get_ms(); +HT_API uint32 sys_os_get_uptime(); +HT_API char * sys_os_get_socket_error(); +HT_API int sys_os_get_socket_error_num(); + +#ifdef __cplusplus +} +#endif + +#endif // __SYS_INC_H__ + + + diff --git a/ONVIF/include/bm/sys_log.h b/ONVIF/include/bm/sys_log.h new file mode 100644 index 0000000..fcb46b6 --- /dev/null +++ b/ONVIF/include/bm/sys_log.h @@ -0,0 +1,81 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef __H_SYS_LOG_H__ +#define __H_SYS_LOG_H__ + +// log level + +#define HT_LOG_TRC 0 +#define HT_LOG_DBG 1 +#define HT_LOG_INFO 2 +#define HT_LOG_WARN 3 +#define HT_LOG_ERR 4 +#define HT_LOG_FATAL 5 + +typedef struct +{ + FILE * fp; // Log file pointer + void * mutex; // read-write lock + int level; // Log level + uint32 cur_size; // The current write length of the log + uint32 max_size; // Maximum file size in KB + int cur_idx; // Current log file index + int max_idx; // Maximum file indexes + int rewind; // Loop write log flag + int time_init; // Initialize log file names using system time + char name[256]; // Log file name +} HT_LOG_CTX; + +#ifdef __cplusplus +extern "C" { +#endif + +HT_API int log_init(const char * log_fname); +HT_API int log_time_init(const char * fname_prev); +HT_API int log_reinit(const char * log_fname); +HT_API int log_time_reinit(const char * fname_prev); +HT_API void log_close(); +HT_API void log_set_level(int level); +HT_API int log_get_level(); +HT_API void log_set_rewind(int rewind); +HT_API int log_get_rewind(); +HT_API void log_set_max_size(int max_size); +HT_API int log_get_max_size(); +HT_API void log_set_max_idx(int max_idx); +HT_API int log_get_max_idx(); +HT_API int log_lock_start(const char * fmt,...); +HT_API int log_lock_print(const char * fmt,...); +HT_API int log_lock_end(const char * fmt,...); + +#ifdef IOS +HT_API int log_ios_print(int level, const char * fmt,...); +#define log_print log_ios_print +#else +HT_API int log_print(int level, const char * fmt,...); +#endif + +#ifdef __cplusplus +} +#endif + +#endif + + + diff --git a/ONVIF/include/bm/util.h b/ONVIF/include/bm/util.h new file mode 100644 index 0000000..3778ef2 --- /dev/null +++ b/ONVIF/include/bm/util.h @@ -0,0 +1,94 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef __H_UTIL_H__ +#define __H_UTIL_H__ + + +/*************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +/*************************************************************************/ + +#define MIN(a, b) ((a) < (b) ? (a) : (b)) +#define MAX(a, b) ((a) > (b) ? (a) : (b)) + +#define ARRAY_SIZE(ary) (sizeof(ary) / sizeof(ary[0])) + +/*************************************************************************/ +HT_API int get_if_nums(); +HT_API uint32 get_if_ip(int index); +HT_API uint32 get_route_if_ip(uint32 dst_ip); +HT_API uint32 get_default_if_ip(); +HT_API const char * get_local_ip(); +HT_API uint32 get_if_mask(int index); +HT_API uint32 get_route_if_mask(uint32 dst_ip); +HT_API uint32 get_default_if_mask(); +HT_API int is_local_if_net(uint32 destip); +HT_API int get_default_if_mac(uint8 * mac); +HT_API uint32 get_address_by_name(const char * host_name); +HT_API const char * get_default_gateway(); +HT_API const char * get_dns_server(); +HT_API const char * get_mask_by_prefix_len(int len); +HT_API int get_prefix_len_by_mask(const char * mask); +HT_API const char * get_ip_str(uint32 ipaddr /* network byte order */); + + +/*************************************************************************/ +HT_API char * lowercase(char * str); +HT_API char * uppercase(char * str); +HT_API int unicode(char ** dst, char * src); + +HT_API BOOL bin_to_hex_str(uint8 * bin, int binlen, char * hex, int hexlen); +HT_API int hex_str_to_bin(char * hex, int hexlen, uint8 * bin, int binlen); + +HT_API int url_encode(const char * src, const int srcsize, char * dst, const int dstsize); +HT_API int url_decode(char * dst, char const * src, uint32 len); +HT_API void url_split(char const* url, char *proto, int proto_size, char *user, int user_size, char *pass, int pass_size, char *host, int host_size, int *port, char *path, int path_size); + +/*************************************************************************/ +HT_API time_t get_time_by_string(char * p_time_str); +HT_API void get_time_str(char * buff, int len); +HT_API void get_time_str_day_off(time_t nt, char * buff, int len, int dayoff); +HT_API void get_time_str_mon_off(time_t nt, char * buff, int len, int moffset); +HT_API time_t get_time_by_tstring(const char * p_time_str); +HT_API void get_tstring_by_time(time_t t, char * buff, int len); + +HT_API SOCKET tcp_connect_timeout(uint32 rip, int port, int timeout); + +/*************************************************************************/ +HT_API void network_init(); +HT_API void network_deinit(); +HT_API int daemon_init(); + +#if __WINDOWS_OS__ +HT_API int gettimeofday(struct timeval* tp, int* tz); +#endif + +#ifdef __cplusplus +} +#endif + +#endif // __H_UTIL_H__ + + + diff --git a/ONVIF/include/bm/word_analyse.h b/ONVIF/include/bm/word_analyse.h new file mode 100644 index 0000000..c616965 --- /dev/null +++ b/ONVIF/include/bm/word_analyse.h @@ -0,0 +1,55 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef __H_WORD_ANALYSE_H__ +#define __H_WORD_ANALYSE_H__ + +/***************************************************************************************/ +typedef enum word_type +{ + WORD_TYPE_NULL = 0, + WORD_TYPE_STRING, + WORD_TYPE_NUM, + WORD_TYPE_SEPARATOR +} WORD_TYPE; + + +#ifdef __cplusplus +extern "C" { +#endif + +HT_API BOOL is_char(char ch); +HT_API BOOL is_num(char ch); +HT_API BOOL is_separator(char ch); +HT_API BOOL is_ip_address(const char * address); +HT_API BOOL is_integer(char * p_str); + +HT_API BOOL GetLineText(char * buf, int cur_line_offset, int max_len, int * len, int * next_line_offset); +HT_API BOOL GetSipLine(char * p_buf, int max_len, int * len, BOOL * bHaveNextLine); +HT_API BOOL GetLineWord(char * line, int cur_word_offset, int line_max_len, char * word_buf, int buf_len, int * next_word_offset, WORD_TYPE w_t); +HT_API BOOL GetNameValuePair(char * text_buf, int text_len, const char * name, char * value, int value_len); + +#ifdef __cplusplus +} +#endif + +#endif // __H_WORD_ANALYSE_H__ + + + diff --git a/ONVIF/include/bm/xml_node.h b/ONVIF/include/bm/xml_node.h new file mode 100644 index 0000000..ecdeb01 --- /dev/null +++ b/ONVIF/include/bm/xml_node.h @@ -0,0 +1,89 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef XML_NODE_H +#define XML_NODE_H + +/*************************************************************************************** + * + * XML node define + * +***************************************************************************************/ +#define NTYPE_TAG 0 +#define NTYPE_ATTRIB 1 +#define NTYPE_CDATA 2 + +#define NTYPE_LAST 2 +#define NTYPE_UNDEF -1 + +typedef struct XMLN +{ + int flag; // Is the buffer pointed to by data dynamically allocated memory? If so, it needs to be free + const char * name; + uint32 type; + const char * data; + int dlen; + int finish; + struct XMLN * parent; + struct XMLN * f_child; + struct XMLN * l_child; + struct XMLN * prev; + struct XMLN * next; + struct XMLN * f_attrib; + struct XMLN * l_attrib; +} XMLN; + + +#ifdef __cplusplus +extern "C" { +#endif + +/***************************************************************************************/ +HT_API XMLN * xml_node_add(XMLN * parent, const char * name); +HT_API void xml_node_del(XMLN * p_node); +HT_API XMLN * xml_node_get(XMLN * parent, const char * name); + +HT_API int soap_strcmp(const char * str1, const char * str2); +HT_API void soap_strncpy(char * dest, const char * src, int size); +HT_API XMLN * xml_node_soap_get(XMLN * parent, const char * name); + +/***************************************************************************************/ +HT_API XMLN * xml_attr_add(XMLN * p_node, const char * name, const char * value); +HT_API void xml_attr_del(XMLN * p_node, const char * name); +HT_API const char * xml_attr_get(XMLN * p_node, const char * name); +HT_API XMLN * xml_attr_node_get(XMLN * p_node, const char * name); + +/***************************************************************************************/ +HT_API void xml_cdata_set(XMLN * p_node, const char * value, int len); + +/***************************************************************************************/ +HT_API int xml_calc_buf_len(XMLN * p_node); +HT_API int xml_write_buf(XMLN * p_node, char * xml_buf, int buf_len); + +/***************************************************************************************/ +HT_API XMLN * xxx_hxml_parse(char * p_xml, int len); + +#ifdef __cplusplus +} +#endif + +#endif // XML_NODE_H + + + diff --git a/ONVIF/include/http/http.h b/ONVIF/include/http/http.h new file mode 100644 index 0000000..62b19c2 --- /dev/null +++ b/ONVIF/include/http/http.h @@ -0,0 +1,222 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef __H_HTTP_H__ +#define __H_HTTP_H__ + +#include "sys_buf.h" +#include "ppstack.h" + +#ifdef HTTPS +#include "openssl/ssl.h" +#endif + +/***************************************************************************************/ +typedef enum http_request_msg_type +{ + HTTP_MT_NULL = 0, + HTTP_MT_GET, + HTTP_MT_HEAD, + HTTP_MT_MPOST, + HTTP_MT_MSEARCH, + HTTP_MT_NOTIFY, + HTTP_MT_POST, + HTTP_MT_SUBSCRIBE, + HTTP_MT_UNSUBSCRIBE, +} HTTP_MT; + +/***************************************************************************************/ +typedef enum http_content_type +{ + CTT_NULL = 0, + CTT_SDP, + CTT_TXT, + CTT_HTM, + CTT_XML, + CTT_BIN, + CTT_JPG, + CTT_RTSP_TUNNELLED, + CTT_MULTIPART, + CTT_FLV +} HTTPCTT; + +#define ctt_is_string(type) (type == CTT_XML || type == CTT_HTM || type == CTT_TXT || type == CTT_SDP) + + +typedef struct _http_msg_content +{ + uint32 msg_type; + uint32 msg_sub_type; + HDRV first_line; + + PPSN_CTX hdr_ctx; + PPSN_CTX ctt_ctx; + + int hdr_len; + int ctt_len; + HTTPCTT ctt_type; + char boundary[256]; + + char * msg_buf; + int buf_offset; + + uint32 remote_ip; + uint16 remote_port; +} HTTPMSG; + +/*************************************************************************/ +typedef struct http_client +{ + uint32 pass_through : 1; // pass through received data flag + uint32 https : 1; // https flag + uint32 resv : 30; + + SOCKET cfd; // client socket + uint32 rip; // remote ip, network byte order + uint32 rport; // remote port + + char rcv_buf[2052]; // static receiving buffer + char * dyn_recv_buf; // dynamic receiving buffer + int rcv_dlen; // received data length + int hdr_len; // http header length + int ctt_len; // context length + HTTPCTT ctt_type; // context type + char * rbuf; // pointer to rcv_buf or dyn_recv_buf + int mlen; // sizeof(rcv_buf) or size of dyn_recv_buf + + void * p_srv; // pointer to HTTPSRV + int use_count; // use count + + void * userdata; // user data + void * userdata_mutex; // user data mutex + uint32 protocol; // protocol, rtsp over http, websocket etc + +#ifdef HTTPS + SSL * ssl; // https SSL + void * ssl_mutex; // https SSL mutex +#endif +} HTTPCLN; + +typedef struct http_req +{ + uint32 need_auth : 1; // need auth flag + uint32 https : 1; // https flag + uint32 resv : 30; + + SOCKET cfd; // client socket + uint32 port; // server port + char host[256]; // server host + char url[256]; // the request url + + char action[256]; // action + char rcv_buf[2052]; // static receiving buffer + char * dyn_recv_buf; // dynamic receiving buffer + int rcv_dlen; // received data length + int hdr_len; // http header length + int ctt_len; // context length + char boundary[256]; // boundary, for CTT_MULTIPART + char * rbuf; // pointer to rcv_buf or dyn_recv_buf + int mlen; // sizeof(rcv_buf) or size of dyn_recv_buf + + HTTPMSG * rx_msg; // rx message + + int auth_mode; // 0 - baisc; 1 - digest + HD_AUTH_INFO auth_info; // http auth information + +#ifdef HTTPS + SSL * ssl; // https SSL + void * ssl_mutex; // https SSL mutex +#endif +} HTTPREQ; + +/*************************************************************************/ + +/* + * If rx_msg is NULL, the callback should call the http_free_used_cln function to delete p_cln + * If the callback is responsible for deleting rx_msg, it returns TRUE, otherwise it returns FALSE + */ +typedef BOOL (*http_msg_cb)(void * p_srv, HTTPCLN * p_cln, HTTPMSG * rx_msg, void * userdata); + +/* + * Raw data received by http + * p_srv : HTTPSRV + * p_cln : http client user agent + * buff : data buffer + * buflen : data buffer length + * + */ +typedef void (*http_data_cb)(void * p_srv, HTTPCLN * p_cln, char * buff, int buflen, void * userdata); + +/* + * http new connection callback + * p_srv : HTTPSRV + * addr : http client connection address, network byte order + * port : http client connection port, host byte order + * + * Return TRUE, accept the new connection, return FALSE, reject the new connection + */ +typedef BOOL (*http_conn_cb)(void * p_srv, uint32 addr, int port, void * userdata); + +typedef struct http_srv_s +{ + uint32 r_flag : 1; // data receiving flag + uint32 https : 1; // https flag + uint32 resv : 30; + + SOCKET sfd; // server socket + + char host[128]; // local server address + int sport; // server port + uint32 saddr; // server address, network byte order + uint32 max_cln_nums; // max client number + + PPSN_CTX * cln_fl; // client free list + PPSN_CTX * cln_ul; // client used list + + uint32 rx_num; // data receiving thread numbers + pthread_t * rx_tid; // data receiving thread id + + void * mutex_cb; // cabllback mutex + http_msg_cb msg_cb; // http message callback + http_data_cb data_cb; // http data callback + http_conn_cb conn_cb; // http connection callback + void * msg_user; // http message callback user data + void * data_user; // http data callback user data + void * conn_user; // http connection callback user data + +#ifdef EPOLL + int ep_fd; // epoll fd + struct epoll_event * ep_events; // epoll events + int ep_event_num; // epoll event number +#endif + +#ifdef HTTPS + char cert_file[256]; // cert file name + char key_file[256]; // key file name + SSL_CTX * ssl_ctx; // ssl context +#endif +} HTTPSRV; + + + +#endif // __H_HTTP_H__ + + + + diff --git a/ONVIF/include/http/http_cln.h b/ONVIF/include/http/http_cln.h new file mode 100644 index 0000000..0ba585c --- /dev/null +++ b/ONVIF/include/http/http_cln.h @@ -0,0 +1,46 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef HTTP_CLN_H +#define HTTP_CLN_H + +#include "http.h" + +#ifdef __cplusplus +extern "C" { +#endif + +BOOL http_get_digest_params(char * p, int len, HD_AUTH_INFO * p_auth); +BOOL http_get_digest_info(HTTPMSG * rx_msg, HD_AUTH_INFO * auth_info); +BOOL http_calc_auth_digest(HD_AUTH_INFO * auth_info, const char * method); +int http_build_auth_msg(HTTPREQ * p_http, const char * method, char * buff, int buflen); +int http_cln_auth_set(HTTPREQ * p_http, const char * user, const char * pass); +BOOL http_cln_ssl_conn(HTTPREQ * p_http, int timeout); +BOOL http_cln_rx(HTTPREQ * p_http); +int http_cln_tx(HTTPREQ * p_http, const char * p_data, int len); +BOOL http_cln_rx_timeout(HTTPREQ * p_http, int timeout); +void http_cln_free_req(HTTPREQ * p_http); + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/ONVIF/include/http/http_parse.h b/ONVIF/include/http/http_parse.h new file mode 100644 index 0000000..5267035 --- /dev/null +++ b/ONVIF/include/http/http_parse.h @@ -0,0 +1,70 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef HTTP_PARSE_H +#define HTTP_PARSE_H + +#include "sys_inc.h" +#include "http.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +/***********************************************************************/ +HT_API BOOL http_msg_buf_init(int num); +HT_API void http_msg_buf_deinit(); + +/***********************************************************************/ +HT_API BOOL http_is_http_msg(char * msg_buf); +HT_API int http_pkt_find_end(char * p_buf); +HT_API void http_headl_parse(char * pline, int llen, HTTPMSG * p_msg); +HT_API int http_line_parse(char * p_buf, int max_len, char sep_char, PPSN_CTX * p_ctx); +HT_API BOOL http_get_headline_uri(HTTPMSG * rx_msg, char * p_uri, int size); +HT_API int http_ctt_parse(HTTPMSG * p_msg); +HT_API int http_msg_parse(char * msg_buf, int msg_buf_len, HTTPMSG * msg); +HT_API int http_msg_parse_part1(char * p_buf, int buf_len, HTTPMSG * msg); +HT_API int http_msg_parse_part2(char * p_buf, int buf_len, HTTPMSG * msg); +HT_API HDRV * http_find_headline(HTTPMSG * msg, const char * head); +HT_API HDRV * http_find_headline_next(HTTPMSG * msg, const char * head, HDRV * hrv); +HT_API char * http_get_headline(HTTPMSG * msg, const char * head); +HT_API HDRV * http_find_ctt_headline(HTTPMSG * msg, const char * head); +HT_API char * http_get_ctt(HTTPMSG * msg); +HT_API BOOL http_get_auth_digest_info(HTTPMSG * rx_msg, HD_AUTH_INFO * p_auth); + +HT_API HTTPMSG * http_get_msg_buf(int size); +HT_API void http_msg_ctx_init(HTTPMSG * msg); +HT_API void http_free_msg_buf(HTTPMSG * msg); +HT_API uint32 http_idle_msg_buf_num(); + +/***********************************************************************/ +HT_API void http_free_msg(HTTPMSG * msg); +HT_API void http_free_msg_content(HTTPMSG * msg); +HT_API void http_free_msg_ctx(HTTPMSG * msg, int type); + + +#ifdef __cplusplus +} +#endif + +#endif + + + diff --git a/ONVIF/include/http/http_srv.h b/ONVIF/include/http/http_srv.h new file mode 100644 index 0000000..b7efa1b --- /dev/null +++ b/ONVIF/include/http/http_srv.h @@ -0,0 +1,51 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef HTTP_SRV_H +#define HTTP_SRV_H + +#include "sys_inc.h" +#include "http.h" +#include "http_parse.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/***************************************************************************************/ +HT_API int http_srv_init(HTTPSRV * p_srv, const char * saddr, uint16 sport, int cln_num, BOOL https, const char * cert_file, const char * key_file); +HT_API void http_srv_deinit(HTTPSRV * p_srv); +HT_API void http_set_msg_cb(HTTPSRV * p_srv, http_msg_cb cb, void * p_userdata); +HT_API void http_set_data_cb(HTTPSRV * p_srv, http_data_cb cb, void * p_userdata); +HT_API void http_set_conn_cb(HTTPSRV * p_srv, http_conn_cb cb, void * p_userdata); +HT_API int http_srv_cln_tx(HTTPCLN * p_user, const char * p_data, int len); + +/***************************************************************************************/ +HT_API uint32 http_cln_index(HTTPSRV * p_srv, HTTPCLN * p_cln); +HT_API HTTPCLN* http_get_cln_by_index(HTTPSRV * p_srv, unsigned long index); +HT_API HTTPCLN* http_get_idle_cln(HTTPSRV * p_srv); +HT_API void http_free_used_cln(HTTPSRV * p_srv, HTTPCLN * p_cln); + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/ONVIF/include/onvif/onvif.h b/ONVIF/include/onvif/onvif.h new file mode 100644 index 0000000..6cf10d8 --- /dev/null +++ b/ONVIF/include/onvif/onvif.h @@ -0,0 +1,534 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef __H_ONVIF_H__ +#define __H_ONVIF_H__ + +#include "sys_inc.h" +#include "http.h" +#include "onvif_cm.h" +#include "onvif_act.h" + + +/***************************************************************************************/ + +// device type +#define ODT_UNKNOWN 0 // Unknow device type +#define ODT_NVT 1 // ONVIF Network Video Transmitter +#define ODT_NVD 2 // ONVIF Network Video Display +#define ODT_NVS 3 // ONVIF Network video Storage +#define ODT_NVA 4 // ONVIF Network video Analytics + +// device flag +#define FLAG_MANUAL (1 << 0) // manual added device, other auto discovery devices + + +/***************************************************************************************/ +typedef struct +{ + int type; // device type + char EndpointReference[100]; // endpoint reference + int MetadataVersion; // metadata version + + uint32 sizeScopes; // sopes numbers + onvif_Scope scopes[MAX_SCOPE_NUMS]; // scopes + + onvif_XAddr XAddr; // xaddr, include port host, url +} DEVICE_BINFO; + +/***************************************************************************************/ + +// video source list +typedef struct _VideoSourceList +{ + struct _VideoSourceList * next; + + onvif_VideoSource VideoSource; +} VideoSourceList; + +// video source mode list +typedef struct _VideoSourceModeList +{ + struct _VideoSourceModeList * next; + + onvif_VideoSourceMode VideoSourceMode; +} VideoSourceModeList; + +// video source configuration list +typedef struct _VideoSourceConfigurationList +{ + struct _VideoSourceConfigurationList * next; + + onvif_VideoSourceConfiguration Configuration; +} VideoSourceConfigurationList; + +// video encoder configuration list +typedef struct _VideoEncoderConfigurationList +{ + struct _VideoEncoderConfigurationList * next; + + onvif_VideoEncoderConfiguration Configuration; +} VideoEncoderConfigurationList; + +// audio source list +typedef struct _AudioSourceList +{ + struct _AudioSourceList * next; + + onvif_AudioSource AudioSource; +} AudioSourceList; + +// audio source configuration list +typedef struct _AudioSourceConfigurationList +{ + struct _AudioSourceConfigurationList * next; + + onvif_AudioSourceConfiguration Configuration; +} AudioSourceConfigurationList; + +// audio encoder configuration list +typedef struct _AudioEncoderConfigurationList +{ + struct _AudioEncoderConfigurationList * next; + + onvif_AudioEncoderConfiguration Configuration; +} AudioEncoderConfigurationList; + +typedef struct _MetadataConfigurationList +{ + struct _MetadataConfigurationList * next; + + onvif_MetadataConfiguration Configuration; +} MetadataConfigurationList; + +// ptz preset list +typedef struct _PTZPresetList +{ + struct _PTZPresetList * next; + + onvif_PTZPreset PTZPreset; +} PTZPresetList; + +// ptz configuration list +typedef struct _PTZConfigurationList +{ + struct _PTZConfigurationList * next; + + onvif_PTZConfiguration Configuration; +} PTZConfigurationList; + +// ptz node list +typedef struct _PTZNodeList +{ + struct _PTZNodeList * next; + + onvif_PTZNode PTZNode; +} PTZNodeList; + +// preset tour list +typedef struct _PresetTourList +{ + struct _PresetTourList * next; + + onvif_PresetTour PresetTour; +} PresetTourList; + +// video analytics configuration list +typedef struct _VideoAnalyticsConfigurationList +{ + struct _VideoAnalyticsConfigurationList * next; + + ConfigList * rules; // video analytics rule configuration + ConfigList * modules; // video analytics module configuration + + onvif_SupportedRules SupportedRules; // supported rules + + onvif_VideoAnalyticsConfiguration Configuration; +} VideoAnalyticsConfigurationList; + +// network interface list +typedef struct _NetworkInterfaceList +{ + struct _NetworkInterfaceList * next; + + onvif_NetworkInterface NetworkInterface; +} NetworkInterfaceList; + +typedef struct +{ + onvif_NetworkProtocol NetworkProtocol; + onvif_DNSInformation DNSInformation; + onvif_NTPInformation NTPInformation; + onvif_HostnameInformation HostnameInformation; + onvif_NetworkGateway NetworkGateway; + onvif_DiscoveryMode DiscoveryMode; + onvif_NetworkZeroConfiguration ZeroConfiguration; + + NetworkInterfaceList * interfaces; +} ONVIF_NET; + +// user list +typedef struct _UserList +{ + struct _UserList * next; + + onvif_User User; +} UserList; + +// osd configuration list +typedef struct _OSDConfigurationList +{ + struct _OSDConfigurationList * next; + + onvif_OSDConfiguration OSD; +} OSDConfigurationList; + +typedef struct _RecordingList +{ + struct _RecordingList * next; + + onvif_Recording Recording; +} RecordingList; + +typedef struct _RecordingJobList +{ + struct _RecordingJobList * next; + + onvif_RecordingJob RecordingJob; +} RecordingJobList; + +typedef struct _NotificationMessageList +{ + struct _NotificationMessageList * next; + + onvif_NotificationMessage NotificationMessage; +} NotificationMessageList; + +typedef struct +{ + BOOL subscribe; // event subscribed flag + BOOL pullpoint; // create pull point flag + + char reference_addr[256]; // event comsumer address + char producter_addr[256]; // event producter address + char producter_parameters[512]; // event producter reference parameters + + int init_term_time; // termination time, unit is second + time_t renew_time; // the previous renew timestamp + + uint32 notify_nums; // event notify numbers + + NotificationMessageList * notify; // event notify messages +} ONVIF_EVENT; + +typedef struct _ONVIF_PROFILE +{ + struct _ONVIF_PROFILE * next; + + VideoSourceConfigurationList * v_src_cfg; // video source configuration + VideoEncoderConfigurationList * v_enc_cfg; // video encoder configuration + AudioSourceConfigurationList * a_src_cfg; // audio source configuration + AudioEncoderConfigurationList * a_enc_cfg; // audio encoder configuration + PTZConfigurationList * ptz_cfg; // ptz configuration + VideoAnalyticsConfigurationList * va_cfg; // video analytics configuration + MetadataConfigurationList * metadata_cfg; // metadata configuration + + char name[ONVIF_NAME_LEN]; // profile name + char token[ONVIF_TOKEN_LEN]; // profile token + char stream_uri[ONVIF_URI_LEN]; // rtsp stream address + BOOL fixed; // fixed profile flag +} ONVIF_PROFILE; + +typedef struct +{ + uint32 local_ip; // local ip address to connect to server, network byte order + + DEVICE_BINFO binfo; // device basic information + + int timeType; // the device datatime type, 0-invalid time, 1-local time, 2-utc time + onvif_DateTime devTime; // the device datatime + time_t fetchTime; // fetch time + + // request + char username[32]; // login user name, set by user + char password[32]; // login password, set by user + int timeout; // request timeout, uinit is millisecond + + BOOL needAuth; // whether need auth, If TRUE, it indicates that the ws-username-token authentication method is used for authentication + BOOL authFailed; // when login auth failed, set by onvif stack + ONVIF_RET errCode; // error code, set by onvif stack + onvif_Fault fault; // the onvif fault, set by onvif stack, valid when errCode is ONVIF_ERR_HttpResponseError, or please skip it + int retry_cnt; + + ONVIF_PROFILE * curProfile; // current profile pointer, the default pointer the first profile, user can set it (for media service) + + /********************************************************/ + + VideoSourceList * v_src; // the list of video source + AudioSourceList * a_src; // the list of audio source + ONVIF_PROFILE * profiles; // the list of profile (for media service) + MediaProfileList * media_profiles; // the list of media profile (for media service 2) + VideoSourceConfigurationList * v_src_cfg; // the list of video source configuration + AudioSourceConfigurationList * a_src_cfg; // the list of audio source configuration + VideoEncoderConfigurationList * v_enc_cfg; // the list of video encoder configuration + AudioEncoderConfigurationList * a_enc_cfg; // the list of audio encoder configuration + PTZNodeList * ptz_node; // the list of ptz node + PTZConfigurationList * ptz_cfg; // the list of ptz configuration + + /********************************************************/ + ONVIF_EVENT events; // event information + onvif_DeviceInformation DeviceInformation;// device information + onvif_Capabilities Capabilities; // device capabilities +} ONVIF_DEVICE; + + +#ifdef __cplusplus +extern "C" { +#endif + +HT_API void onvif_free_device(ONVIF_DEVICE * p_dev); + +HT_API UserList * onvif_add_User(UserList ** p_head); +HT_API void onvif_free_Users(UserList ** p_head); + +HT_API LocationEntityList * onvif_add_LocationEntity(LocationEntityList ** p_head); +HT_API void onvif_free_LocationEntitis(LocationEntityList ** p_head); + +HT_API StorageConfigurationList * onvif_add_StorageConfiguration(StorageConfigurationList ** p_head); +HT_API void onvif_free_StorageConfigurations(StorageConfigurationList ** p_head); + +HT_API ONVIF_PROFILE * onvif_add_profile(ONVIF_PROFILE ** p_head); +HT_API ONVIF_PROFILE * onvif_find_profile(ONVIF_PROFILE * p_head, const char * token); +HT_API void onvif_free_profile(ONVIF_PROFILE * p_profile); +HT_API void onvif_free_profiles(ONVIF_PROFILE ** p_head); + +HT_API MediaProfileList * onvif_add_MediaProfile(MediaProfileList ** p_head); +HT_API MediaProfileList * onvif_find_MediaProfile(MediaProfileList * p_head, const char * token); +HT_API void onvif_free_MediaProfiles(MediaProfileList ** p_head); + +HT_API VideoSourceList * onvif_add_VideoSource(VideoSourceList ** p_head); +HT_API VideoSourceList * onvif_find_VideoSource(VideoSourceList * p_head, const char * token); +HT_API void onvif_free_VideoSources(VideoSourceList ** p_head); +HT_API VideoSourceList * onvif_get_cur_VideoSource(ONVIF_DEVICE * p_dev); + +HT_API VideoSourceModeList * onvif_add_VideoSourceMode(VideoSourceModeList ** p_head); +HT_API void onvif_free_VideoSourceModes(VideoSourceModeList ** p_head); + +HT_API VideoSourceConfigurationList * onvif_add_VideoSourceConfiguration(VideoSourceConfigurationList ** p_head); +HT_API VideoSourceConfigurationList * onvif_find_VideoSourceConfiguration(VideoSourceConfigurationList * p_head, const char * token); +HT_API void onvif_free_VideoSourceConfigurations(VideoSourceConfigurationList ** p_head); + +HT_API VideoEncoder2ConfigurationList * onvif_add_VideoEncoder2Configuration(VideoEncoder2ConfigurationList ** p_head); +HT_API VideoEncoder2ConfigurationList * onvif_find_VideoEncoder2Configuration(VideoEncoder2ConfigurationList * p_head, const char * token); +HT_API void onvif_free_VideoEncoder2Configurations(VideoEncoder2ConfigurationList ** p_head); + +HT_API NetworkInterfaceList * onvif_add_NetworkInterface(NetworkInterfaceList ** p_head); +HT_API NetworkInterfaceList * onvif_find_NetworkInterface(NetworkInterfaceList * p_head, const char * token); +HT_API void onvif_free_NetworkInterfaces(NetworkInterfaceList ** p_head); + +HT_API Dot11AvailableNetworksList * onvif_add_Dot11AvailableNetworks(Dot11AvailableNetworksList ** p_head); +HT_API void onvif_free_Dot11AvailableNetworks(Dot11AvailableNetworksList ** p_head); + +HT_API OSDConfigurationList * onvif_add_OSDConfiguration(OSDConfigurationList ** p_head); +HT_API OSDConfigurationList * onvif_find_OSDConfiguration(OSDConfigurationList * p_head, const char * token); +HT_API void onvif_free_OSDConfigurations(OSDConfigurationList ** p_head); + +HT_API MetadataConfigurationList * onvif_add_MetadataConfiguration(MetadataConfigurationList ** p_head); +HT_API MetadataConfigurationList * onvif_find_MetadataConfiguration(MetadataConfigurationList * p_head, const char * token); +HT_API void onvif_free_MetadataConfigurations(MetadataConfigurationList ** p_head); + +HT_API VideoEncoderConfigurationList * onvif_add_VideoEncoderConfiguration(VideoEncoderConfigurationList ** p_head); +HT_API VideoEncoderConfigurationList * onvif_find_VideoEncoderConfiguration(VideoEncoderConfigurationList * p_head, const char * token); +HT_API void onvif_free_VideoEncoderConfigurations(VideoEncoderConfigurationList ** p_head); + +HT_API VideoEncoder2ConfigurationOptionsList * onvif_add_VideoEncoder2ConfigurationOptions(VideoEncoder2ConfigurationOptionsList ** p_head); +HT_API VideoEncoder2ConfigurationOptionsList * onvif_find_VideoEncoder2ConfigurationOptions(VideoEncoder2ConfigurationOptionsList * p_head, const char * encoding); +HT_API void onvif_free_VideoEncoder2ConfigurationOptions(VideoEncoder2ConfigurationOptionsList ** p_head); + +HT_API NotificationMessageList * onvif_add_NotificationMessage(NotificationMessageList ** p_head); +HT_API void onvif_free_NotificationMessage(NotificationMessageList * p_message); +HT_API void onvif_free_NotificationMessages(NotificationMessageList ** p_head); +HT_API int onvif_get_NotificationMessages_nums(NotificationMessageList * p_head); + +HT_API void onvif_device_add_NotificationMessages(ONVIF_DEVICE * p_dev, NotificationMessageList * p_notify); +HT_API int onvif_device_free_NotificationMessages(ONVIF_DEVICE * p_dev, int nums); + +HT_API SimpleItemList * onvif_add_SimpleItem(SimpleItemList ** p_head); +HT_API void onvif_free_SimpleItems(SimpleItemList ** p_head); +HT_API const char * onvif_format_SimpleItem(SimpleItemList * p_item); + +HT_API ElementItemList * onvif_add_ElementItem(ElementItemList ** p_head); +HT_API void onvif_free_ElementItems(ElementItemList ** p_head); + +HT_API ImagingPresetList * onvif_add_ImagingPreset(ImagingPresetList ** p_head); +HT_API ImagingPresetList * onvif_find_ImagingPreset(ImagingPresetList * p_head, const char * token); +HT_API void onvif_free_ImagingPresets(ImagingPresetList ** p_head); + +HT_API AudioSourceList * onvif_add_AudioSource(AudioSourceList ** p_head); +HT_API AudioSourceList * onvif_find_AudioSource(AudioSourceList * p_head, const char * token); +HT_API void onvif_free_AudioSources(AudioSourceList ** p_head); + +HT_API AudioSourceConfigurationList * onvif_add_AudioSourceConfiguration(AudioSourceConfigurationList ** p_head); +HT_API AudioSourceConfigurationList * onvif_find_AudioSourceConfiguration(AudioSourceConfigurationList * p_head, const char * token); +HT_API void onvif_free_AudioSourceConfigurations(AudioSourceConfigurationList ** p_head); + +HT_API AudioEncoderConfigurationList * onvif_add_AudioEncoderConfiguration(AudioEncoderConfigurationList ** p_head); +HT_API AudioEncoderConfigurationList * onvif_find_AudioEncoderConfiguration(AudioEncoderConfigurationList * p_head, const char * token); +HT_API void onvif_free_AudioEncoderConfigurations(AudioEncoderConfigurationList ** p_head); + +HT_API AudioEncoder2ConfigurationList * onvif_add_AudioEncoder2Configuration(AudioEncoder2ConfigurationList ** p_head); +HT_API AudioEncoder2ConfigurationList * onvif_find_AudioEncoder2Configuration(AudioEncoder2ConfigurationList * p_head, const char * token); +HT_API void onvif_free_AudioEncoder2Configurations(AudioEncoder2ConfigurationList ** p_head); + +HT_API AudioEncoder2ConfigurationOptionsList * onvif_add_AudioEncoder2ConfigurationOptions(AudioEncoder2ConfigurationOptionsList ** p_head); +HT_API AudioEncoder2ConfigurationOptionsList * onvif_find_AudioEncoder2ConfigurationOptions(AudioEncoder2ConfigurationOptionsList * p_head, const char * encoding); +HT_API void onvif_free_AudioEncoder2ConfigurationOptions(AudioEncoder2ConfigurationOptionsList ** p_head); + +HT_API AudioDecoderConfigurationList * onvif_add_AudioDecoderConfiguration(AudioDecoderConfigurationList ** p_head); +HT_API void onvif_free_AudioDecoderConfigurations(AudioDecoderConfigurationList ** p_head); + +HT_API MaskList * onvif_add_Mask(MaskList ** p_head); +HT_API MaskList * onvif_find_Mask(MaskList * p_head, const char * token); +HT_API void onvif_free_Masks(MaskList ** p_head); + +HT_API PTZNodeList * onvif_add_PTZNode(PTZNodeList ** p_head); +HT_API PTZNodeList * onvif_find_PTZNode(PTZNodeList * p_head, const char * token); +HT_API void onvif_free_PTZNodes(PTZNodeList ** p_head); + +HT_API PTZConfigurationList * onvif_add_PTZConfiguration(PTZConfigurationList ** p_head); +HT_API PTZConfigurationList * onvif_find_PTZConfiguration(PTZConfigurationList * p_head, const char * token); +HT_API void onvif_free_PTZConfigurations(PTZConfigurationList ** p_head); + +HT_API PTZPresetList * onvif_add_PTZPreset(PTZPresetList ** p_head); +HT_API void onvif_free_PTZPresets(PTZPresetList ** p_head); + +HT_API PTZPresetTourSpotList * onvif_add_PTZPresetTourSpot(PTZPresetTourSpotList ** p_head); +HT_API void onvif_free_PTZPresetTourSpots(PTZPresetTourSpotList ** p_head); + +HT_API PresetTourList * onvif_add_PresetTour(PresetTourList ** p_head); +HT_API void onvif_free_PresetTours(PresetTourList ** p_head); + +HT_API ConfigList * onvif_add_Config(ConfigList ** p_head); +HT_API void onvif_free_Config(ConfigList * p_head); +HT_API void onvif_free_Configs(ConfigList ** p_head); +HT_API ConfigList * onvif_find_Config(ConfigList * p_head, const char * name); +HT_API void onvif_remove_Config(ConfigList ** p_head, ConfigList * p_remove); +HT_API ConfigList * onvif_get_prev_Config(ConfigList * p_head, ConfigList * p_found); + +HT_API ConfigDescriptionList * onvif_add_ConfigDescription(ConfigDescriptionList ** p_head); +HT_API void onvif_free_ConfigDescriptions(ConfigDescriptionList ** p_head); + +HT_API ConfigDescription_MessagesList * onvif_add_ConfigDescription_Message(ConfigDescription_MessagesList ** p_head); +HT_API void onvif_free_ConfigDescription_Message(ConfigDescription_MessagesList * p_item); +HT_API void onvif_free_ConfigDescription_Messages(ConfigDescription_MessagesList ** p_head); + +HT_API ConfigOptionsList * onvif_add_ConfigOptions(ConfigOptionsList ** p_head); +HT_API void onvif_free_ConfigOptions(ConfigOptionsList ** p_head); + +HT_API SimpleItemDescriptionList * onvif_add_SimpleItemDescription(SimpleItemDescriptionList ** p_head); +HT_API void onvif_free_SimpleItemDescriptions(SimpleItemDescriptionList ** p_head); + +HT_API VideoAnalyticsConfigurationList * onvif_add_VideoAnalyticsConfiguration(VideoAnalyticsConfigurationList ** p_head); +HT_API void onvif_free_VideoAnalyticsConfiguration(VideoAnalyticsConfigurationList * p_head); +HT_API void onvif_free_VideoAnalyticsConfigurations(VideoAnalyticsConfigurationList ** p_head); + +HT_API AnalyticsModuleConfigOptionsList * onvif_add_AnalyticsModuleConfigOptions(AnalyticsModuleConfigOptionsList ** p_head); +HT_API void onvif_free_AnalyticsModuleConfigOptions(AnalyticsModuleConfigOptionsList ** p_head); + +HT_API MetadataInfoList * onvif_add_MetadataInfo(MetadataInfoList ** p_head); +HT_API void onvif_free_MetadataInfo(MetadataInfoList ** p_head); + +HT_API RecordingList * onvif_add_Recording(RecordingList ** p_head); +HT_API RecordingList * onvif_find_Recording(RecordingList * p_head, const char * token); +HT_API void onvif_free_Recordings(RecordingList ** p_head); + +HT_API TrackList * onvif_add_Track(TrackList ** p_head); +HT_API void onvif_free_Tracks(TrackList ** p_head); +HT_API TrackList * onvif_find_Track(TrackList * p_head, const char * token); + +HT_API RecordingJobList * onvif_add_RecordingJob(RecordingJobList ** p_head); +HT_API RecordingJobList * onvif_find_RecordingJob(RecordingJobList * p_head, const char * token); +HT_API void onvif_free_RecordingJobs(RecordingJobList ** p_head); + +HT_API TrackAttributesList * onvif_add_TrackAttributes(TrackAttributesList ** p_head); +HT_API void onvif_free_TrackAttributes(TrackAttributesList ** p_head); + +HT_API RecordingInformationList * onvif_add_RecordingInformation(RecordingInformationList ** p_head); +HT_API void onvif_free_RecordingInformations(RecordingInformationList ** p_head); + +HT_API FindEventResultList * onvif_add_FindEventResult(FindEventResultList ** p_head); +HT_API void onvif_free_FindEventResults(FindEventResultList ** p_head); + +HT_API FindMetadataResultList * onvif_add_FindMetadataResult(FindMetadataResultList ** p_head); +HT_API void onvif_free_FindMetadataResults(FindMetadataResultList ** p_head); + +HT_API FindPTZPositionResultList * onvif_add_FindPTZPositionResult(FindPTZPositionResultList ** p_head); +HT_API void onvif_free_FindPTZPositionResults(FindPTZPositionResultList ** p_head); + +HT_API AccessPointList * onvif_add_AccessPoint(AccessPointList ** p_head); +HT_API AccessPointList * onvif_find_AccessPoint(AccessPointList * p_head, const char * token); +HT_API void onvif_free_AccessPoints(AccessPointList ** p_head); + +HT_API DoorInfoList * onvif_add_DoorInfo(DoorInfoList ** p_head); +HT_API DoorInfoList * onvif_find_DoorInfo(DoorInfoList * p_head, const char * token); +HT_API void onvif_free_DoorInfos(DoorInfoList ** p_head); + +HT_API DoorList * onvif_add_Door(DoorList ** p_head); +HT_API DoorList * onvif_find_Door(DoorList * p_head, const char * token); +HT_API void onvif_free_Doors(DoorList ** p_head); + +HT_API AreaList * onvif_add_Area(AreaList ** p_head); +HT_API AreaList * onvif_find_Area(AreaList * p_head, const char * token); +HT_API void onvif_free_Areas(AreaList ** p_head); + +HT_API AudioOutputList * onvif_add_AudioOutput(AudioOutputList ** p_head); +HT_API void onvif_free_AudioOutputs(AudioOutputList ** p_head); + +HT_API AudioOutputConfigurationList * onvif_add_AudioOutputConfiguration(AudioOutputConfigurationList ** p_head); +HT_API void onvif_free_AudioOutputConfigurations(AudioOutputConfigurationList ** p_head); + +HT_API RelayOutputOptionsList * onvif_add_RelayOutputOptions(RelayOutputOptionsList ** p_head); +HT_API void onvif_free_RelayOutputOptions(RelayOutputOptionsList ** p_head); + +HT_API RelayOutputList * onvif_add_RelayOutput(RelayOutputList ** p_head); +HT_API RelayOutputList * onvif_find_RelayOutput(RelayOutputList * p_head, const char * token); +HT_API void onvif_free_RelayOutputs(RelayOutputList ** p_head); + +HT_API DigitalInputList * onvif_add_DigitalInput(DigitalInputList ** p_head); +HT_API DigitalInputList * onvif_find_DigitalInput(DigitalInputList * p_head, const char * token); +HT_API void onvif_free_DigitalInputs(DigitalInputList ** p_head); + +HT_API ThermalConfigurationList * onvif_add_ThermalConfiguration(ThermalConfigurationList ** p_head); +HT_API void onvif_free_ThermalConfigurations(ThermalConfigurationList ** p_head); +HT_API ColorPaletteList * onvif_add_ColorPalette(ColorPaletteList ** p_head); +HT_API void onvif_free_ColorPalettes(ColorPaletteList ** p_head); +HT_API NUCTableList * onvif_add_NUCTable(NUCTableList ** p_head); +HT_API void onvif_free_NUCTables(NUCTableList ** p_head); + +HT_API ReceiverList * onvif_add_Receiver(ReceiverList ** p_head); +HT_API ReceiverList * onvif_find_Receiver(ReceiverList * p_head, const char * token); +HT_API void onvif_free_Receivers(ReceiverList ** p_head); + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/ONVIF/include/onvif/onvif_act.h b/ONVIF/include/onvif/onvif_act.h new file mode 100644 index 0000000..1677f8f --- /dev/null +++ b/ONVIF/include/onvif/onvif_act.h @@ -0,0 +1,489 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef ONVIF_ACT_H +#define ONVIF_ACT_H + +/*************************************************************************/ +typedef enum +{ + eActionNull = 0, + + // onvif device service interfaces + etdsGetCapabilities, + etdsGetServices, + etdsGetServiceCapabilities, + etdsGetDeviceInformation, + etdsGetUsers, + etdsCreateUsers, + etdsDeleteUsers, + etdsSetUser, + etdsGetRemoteUser, + etdsSetRemoteUser, + etdsGetNetworkInterfaces, + etdsSetNetworkInterfaces, + etdsGetNTP, + etdsSetNTP, + etdsGetHostname, + etdsSetHostname, + etdsSetHostnameFromDHCP, + etdsGetDNS, + etdsSetDNS, + etdsGetDynamicDNS, + etdsSetDynamicDNS, + etdsGetNetworkProtocols, + etdsSetNetworkProtocols, + etdsGetDiscoveryMode, + etdsSetDiscoveryMode, + etdsGetNetworkDefaultGateway, + etdsSetNetworkDefaultGateway, + etdsGetZeroConfiguration, + etdsSetZeroConfiguration, + etdsGetEndpointReference, + etdsSendAuxiliaryCommand, + etdsGetRelayOutputs, + etdsSetRelayOutputSettings, + etdsSetRelayOutputState, + etdsGetSystemDateAndTime, + etdsSetSystemDateAndTime, + etdsSystemReboot, + etdsSetSystemFactoryDefault, + etdsGetSystemLog, + etdsGetScopes, + etdsSetScopes, + etdsAddScopes, + etdsRemoveScopes, + etdsStartFirmwareUpgrade, + etdsGetSystemUris, + etdsStartSystemRestore, + etdsGetWsdlUrl, + etdsGetDot11Capabilities, + etdsGetDot11Status, + etdsScanAvailableDot11Networks, + etdsGetGeoLocation, + etdsSetGeoLocation, + etdsDeleteGeoLocation, + etdsSetHashingAlgorithm, + etdsGetIPAddressFilter, + etdsSetIPAddressFilter, + etdsAddIPAddressFilter, + etdsRemoveIPAddressFilter, + etdsGetAccessPolicy, + etdsSetAccessPolicy, + etdsGetStorageConfigurations, + etdsCreateStorageConfiguration, + etdsGetStorageConfiguration, + etdsSetStorageConfiguration, + etdsDeleteStorageConfiguration, + + // onvif media service interfaces + etrtGetServiceCapabilities, + etrtGetVideoSources, + etrtGetAudioSources, + etrtCreateProfile, + etrtGetProfile, + etrtGetProfiles, + etrtAddVideoEncoderConfiguration, + etrtAddVideoSourceConfiguration, + etrtAddAudioEncoderConfiguration, + etrtAddAudioSourceConfiguration, + etrtGetVideoSourceModes, + etrtSetVideoSourceMode, + etrtAddPTZConfiguration, + etrtRemoveVideoEncoderConfiguration, + etrtRemoveVideoSourceConfiguration, + etrtRemoveAudioEncoderConfiguration, + etrtRemoveAudioSourceConfiguration, + etrtRemovePTZConfiguration, + etrtDeleteProfile, + etrtGetVideoSourceConfigurations, + etrtGetVideoEncoderConfigurations, + etrtGetAudioSourceConfigurations, + etrtGetAudioEncoderConfigurations, + etrtGetVideoSourceConfiguration, + etrtGetVideoEncoderConfiguration, + etrtGetAudioSourceConfiguration, + etrtGetAudioEncoderConfiguration, + etrtSetVideoSourceConfiguration, + etrtSetVideoEncoderConfiguration, + etrtSetAudioSourceConfiguration, + etrtSetAudioEncoderConfiguration, + etrtGetVideoSourceConfigurationOptions, + etrtGetVideoEncoderConfigurationOptions, + etrtGetAudioSourceConfigurationOptions, + etrtGetAudioEncoderConfigurationOptions, + etrtGetStreamUri, + etrtSetSynchronizationPoint, + etrtGetSnapshotUri, + etrtGetGuaranteedNumberOfVideoEncoderInstances, + etrtGetAudioOutputs, + etrtGetAudioOutputConfigurations, + etrtGetAudioOutputConfiguration, + etrtGetAudioOutputConfigurationOptions, + etrtSetAudioOutputConfiguration, + etrtGetAudioDecoderConfigurations, + etrtGetAudioDecoderConfiguration, + etrtGetAudioDecoderConfigurationOptions, + etrtSetAudioDecoderConfiguration, + etrtAddAudioOutputConfiguration, + etrtAddAudioDecoderConfiguration, + etrtRemoveAudioOutputConfiguration, + etrtRemoveAudioDecoderConfiguration, + etrtGetOSDs, + etrtGetOSD, + etrtSetOSD, + etrtGetOSDOptions, + etrtCreateOSD, + etrtDeleteOSD, + etrtGetVideoAnalyticsConfigurations, + etrtAddVideoAnalyticsConfiguration, + etrtGetVideoAnalyticsConfiguration, + etrtRemoveVideoAnalyticsConfiguration, + etrtSetVideoAnalyticsConfiguration, + etrtGetMetadataConfigurations, + etrtAddMetadataConfiguration, + etrtGetMetadataConfiguration, + etrtRemoveMetadataConfiguration, + etrtSetMetadataConfiguration, + etrtGetMetadataConfigurationOptions, + etrtGetCompatibleVideoEncoderConfigurations, + etrtGetCompatibleAudioEncoderConfigurations, + etrtGetCompatibleVideoAnalyticsConfigurations, + etrtGetCompatibleMetadataConfigurations, + + // onvif media 2 service interfaces + etr2GetServiceCapabilities, + etr2GetVideoEncoderConfigurations, + etr2SetVideoEncoderConfiguration, + etr2GetVideoEncoderConfigurationOptions, + etr2GetProfiles, + etr2CreateProfile, + etr2DeleteProfile, + etr2GetStreamUri, + etr2GetVideoSourceConfigurations, + etr2GetVideoSourceConfigurationOptions, + etr2SetVideoSourceConfiguration, + etr2SetSynchronizationPoint, + etr2GetMetadataConfigurations, + etr2GetMetadataConfigurationOptions, + etr2SetMetadataConfiguration, + etr2GetAudioEncoderConfigurations, + etr2GetAudioSourceConfigurations, + etr2GetAudioSourceConfigurationOptions, + etr2SetAudioSourceConfiguration, + etr2SetAudioEncoderConfiguration, + etr2GetAudioEncoderConfigurationOptions, + etr2AddConfiguration, + etr2RemoveConfiguration, + etr2GetVideoEncoderInstances, + etr2GetAudioOutputConfigurations, + etr2GetAudioOutputConfigurationOptions, + etr2SetAudioOutputConfiguration, + etr2GetAudioDecoderConfigurations, + etr2GetAudioDecoderConfigurationOptions, + etr2SetAudioDecoderConfiguration, + etr2GetSnapshotUri, + etr2StartMulticastStreaming, + etr2StopMulticastStreaming, + etr2GetVideoSourceModes, + etr2SetVideoSourceMode, + etr2CreateOSD, + etr2DeleteOSD, + etr2GetOSDs, + etr2SetOSD, + etr2GetOSDOptions, + etr2GetAnalyticsConfigurations, + etr2GetMasks, + etr2SetMask, + etr2CreateMask, + etr2DeleteMask, + etr2GetMaskOptions, + + // onvif ptz service interfaces + eptzGetServiceCapabilities, + eptzGetNodes, + eptzGetNode, + eptzGetPresets, + eptzSetPreset, + eptzRemovePreset, + eptzGotoPreset, + eptzGotoHomePosition, + eptzSetHomePosition, + eptzGetStatus, + eptzContinuousMove, + eptzRelativeMove, + eptzAbsoluteMove, + eptzStop, + eptzGetConfigurations, + eptzGetConfiguration, + eptzSetConfiguration, + eptzGetConfigurationOptions, + eptzGetPresetTours, + eptzGetPresetTour, + eptzGetPresetTourOptions, + eptzCreatePresetTour, + eptzModifyPresetTour, + eptzOperatePresetTour, + eptzRemovePresetTour, + eptzSendAuxiliaryCommand, + eptzGeoMove, + + // onvif event service interfaces + etevGetServiceCapabilities, + etevGetEventProperties, + etevRenew, + etevUnsubscribe, + etevSubscribe, + etevPauseSubscription, + etevResumeSubscription, + etevCreatePullPointSubscription, + etevDestroyPullPoint, + etevPullMessages, + etevGetMessages, + etevSeek, + etevSetSynchronizationPoint, + + // onvif imaging service interfaces + eimgGetServiceCapabilities, + eimgGetImagingSettings, + eimgSetImagingSettings, + eimgGetOptions, + eimgMove, + eimgStop, + eimgGetStatus, + eimgGetMoveOptions, + eimgGetPresets, + eimgGetCurrentPreset, + eimgSetCurrentPreset, + + // onvif device IO service interfaces + etmdGetServiceCapabilities, + etmdGetRelayOutputs, + etmdGetRelayOutputOptions, + etmdSetRelayOutputSettings, + etmdSetRelayOutputState, + etmdGetDigitalInputs, + etmdGetDigitalInputConfigurationOptions, + etmdSetDigitalInputConfigurations, + + // onvif recording service interfaces + etrcGetServiceCapabilities, + etrcCreateRecording, + etrcDeleteRecording, + etrcGetRecordings, + etrcSetRecordingConfiguration, + etrcGetRecordingConfiguration, + etrcGetRecordingOptions, + etrcCreateTrack, + etrcDeleteTrack, + etrcGetTrackConfiguration, + etrcSetTrackConfiguration, + etrcCreateRecordingJob, + etrcDeleteRecordingJob, + etrcGetRecordingJobs, + etrcSetRecordingJobConfiguration, + etrcGetRecordingJobConfiguration, + etrcSetRecordingJobMode, + etrcGetRecordingJobState, + etrcExportRecordedData, + etrcStopExportRecordedData, + etrcGetExportRecordedDataState, + + // onvif replay service interfaces + etrpGetServiceCapabilities, + etrpGetReplayUri, + etrpGetReplayConfiguration, + etrpSetReplayConfiguration, + + // onvif search service interfaces + etseGetServiceCapabilities, + etseGetRecordingSummary, + etseGetRecordingInformation, + etseGetMediaAttributes, + etseFindRecordings, + etseGetRecordingSearchResults, + etseFindEvents, + etseGetEventSearchResults, + etseFindMetadata, + etseGetMetadataSearchResults, + etseFindPTZPosition, + etseGetPTZPositionSearchResults, + etseGetSearchState, + etseEndSearch, + + // onvif analytics service interfaces + etanGetServiceCapabilities, + etanGetSupportedRules, + etanCreateRules, + etanDeleteRules, + etanGetRules, + etanModifyRules, + etanCreateAnalyticsModules, + etanDeleteAnalyticsModules, + etanGetAnalyticsModules, + etanModifyAnalyticsModules, + etanGetSupportedAnalyticsModules, + etanGetRuleOptions, + etanGetAnalyticsModuleOptions, + etanGetSupportedMetadata, + + // onvif access control service interface + etacGetServiceCapabilities, + etacGetAccessPointInfoList, + etacGetAccessPointInfo, + etacGetAccessPointList, + etacGetAccessPoints, + etacCreateAccessPoint, + etacSetAccessPoint, + etacModifyAccessPoint, + etacDeleteAccessPoint, + etacGetAreaInfoList, + etacGetAreaInfo, + etacGetAreaList, + etacGetAreas, + etacCreateArea, + etacSetArea, + etacModifyArea, + etacDeleteArea, + etacGetAccessPointState, + etacEnableAccessPoint, + etacDisableAccessPoint, + + // onvif door control service interface + etdcGetServiceCapabilities, + etdcGetDoorInfoList, + etdcGetDoorInfo, + etdcGetDoorState, + etdcAccessDoor, + etdcLockDoor, + etdcUnlockDoor, + etdcDoubleLockDoor, + etdcBlockDoor, + etdcLockDownDoor, + etdcLockDownReleaseDoor, + etdcLockOpenDoor, + etdcLockOpenReleaseDoor, + etdcGetDoors, + etdcGetDoorList, + etdcCreateDoor, + etdcSetDoor, + etdcModifyDoor, + etdcDeleteDoor, + + // onvif thermal service interfaces + etthGetServiceCapabilities, + etthGetConfigurations, + etthGetConfiguration, + etthSetConfiguration, + etthGetConfigurationOptions, + etthGetRadiometryConfiguration, + etthSetRadiometryConfiguration, + etthGetRadiometryConfigurationOptions, + + // onvif credential service interfaces + etcrGetServiceCapabilities, + etcrGetCredentialInfo, + etcrGetCredentialInfoList, + etcrGetCredentials, + etcrGetCredentialList, + etcrCreateCredential, + etcrModifyCredential, + etcrDeleteCredential, + etcrGetCredentialState, + etcrEnableCredential, + etcrDisableCredential, + etcrResetAntipassbackViolation, + etcrGetSupportedFormatTypes, + etcrGetCredentialIdentifiers, + etcrSetCredentialIdentifier, + etcrDeleteCredentialIdentifier, + etcrGetCredentialAccessProfiles, + etcrSetCredentialAccessProfiles, + etcrDeleteCredentialAccessProfiles, + + // onvif access rules service interfaces + etarGetServiceCapabilities, + etarGetAccessProfileInfo, + etarGetAccessProfileInfoList, + etarGetAccessProfiles, + etarGetAccessProfileList, + etarCreateAccessProfile, + etarModifyAccessProfile, + etarDeleteAccessProfile, + + // onvif schedule service interface + etscGetServiceCapabilities, + etscGetScheduleInfo, + etscGetScheduleInfoList, + etscGetSchedules, + etscGetScheduleList, + etscCreateSchedule, + etscModifySchedule, + etscDeleteSchedule, + etscGetSpecialDayGroupInfo, + etscGetSpecialDayGroupInfoList, + etscGetSpecialDayGroups, + etscGetSpecialDayGroupList, + etscCreateSpecialDayGroup, + etscModifySpecialDayGroup, + etscDeleteSpecialDayGroup, + etscGetScheduleState, + + // onvif receiver service interface + etrvGetServiceCapabilities, + etrvGetReceivers, + etrvGetReceiver, + etrvCreateReceiver, + etrvDeleteReceiver, + etrvConfigureReceiver, + etrvSetReceiverMode, + etrvGetReceiverState, + + // onvif provisioning service interface + etpvGetServiceCapabilities, + etpvPanMove, + etpvTiltMove, + etpvZoomMove, + etpvRollMove, + etpvFocusMove, + etpvStop, + etpvGetUsage, + + eActionMax +} eOnvifAction; + +typedef struct +{ + eOnvifAction type; + char action_url[256]; +} OVFACTS; + +#ifdef __cplusplus +extern "C" { +#endif + +HT_API OVFACTS * onvif_find_action_by_type(eOnvifAction type); + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/ONVIF/include/onvif/onvif_api.h b/ONVIF/include/onvif/onvif_api.h new file mode 100644 index 0000000..d5d7e75 --- /dev/null +++ b/ONVIF/include/onvif/onvif_api.h @@ -0,0 +1,117 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ +#ifndef ONVIF_API_H +#define ONVIF_API_H + +#include "sys_inc.h" +#include "onvif.h" +#include "onvif_cln.h" + +#ifdef __cplusplus +extern "C" { +#endif + +HT_API BOOL GetCapabilities(ONVIF_DEVICE * p_dev); +HT_API BOOL GetServices(ONVIF_DEVICE * p_dev); +HT_API BOOL GetSystemDateAndTime(ONVIF_DEVICE * p_dev); +HT_API BOOL SetSystemDateAndTime(ONVIF_DEVICE * p_dev); +HT_API BOOL GetDeviceInformation(ONVIF_DEVICE * p_dev); +HT_API BOOL GetProfiles(ONVIF_DEVICE * p_dev); +HT_API BOOL GetStreamUris(ONVIF_DEVICE * p_dev, onvif_TransportProtocol proto); +HT_API BOOL GetVideoSourceConfigurations(ONVIF_DEVICE * p_dev); +HT_API BOOL GetAudioSourceConfigurations(ONVIF_DEVICE * p_dev); +HT_API BOOL GetVideoEncoderConfigurations(ONVIF_DEVICE * p_dev); +HT_API BOOL GetAudioEncoderConfigurations(ONVIF_DEVICE * p_dev); +HT_API BOOL GetNodes(ONVIF_DEVICE * p_dev); +HT_API BOOL GetConfigurations(ONVIF_DEVICE * p_dev); +HT_API BOOL GetVideoSources(ONVIF_DEVICE * p_dev); +HT_API BOOL GetAudioSources(ONVIF_DEVICE * p_dev); +HT_API BOOL GetImagingSettings(ONVIF_DEVICE * p_dev); +HT_API BOOL Subscribe(ONVIF_DEVICE * p_dev, int index); +HT_API BOOL Unsubscribe(ONVIF_DEVICE * p_dev); +HT_API BOOL CreatePullPointSubscription(ONVIF_DEVICE * p_dev); +HT_API BOOL PullMessages(ONVIF_DEVICE * p_dev, int timeout, int message_limit, tev_PullMessages_RES * p_res); + +/** + * @desc Get the device snapshot + * @param + * p_buf [out] return the snapshot buffer + * buflen [out] return the snapshot buffer length + * + * @note if call success, the caller should call FreeSnapshotBuff to free the snapshot buffer + * + */ +HT_API BOOL GetSnapshot(ONVIF_DEVICE * p_dev, const char * profile_token, unsigned char ** p_buf, int * buflen); + +/** + * @desc Free the buffer + * @param + * p_buf the buffer + * + */ +HT_API void FreeBuff(unsigned char * p_buf); + +/** + * @desc Firmware upgrade + * @param + * filename the upgrade filename + * + */ +HT_API BOOL FirmwareUpgrade(ONVIF_DEVICE * p_dev, const char * filename); + +/** + * @desc backup system settings + * @param + * filename , save as system backup + * + */ +HT_API BOOL SystemBackup(ONVIF_DEVICE * p_dev, const char * filename); + +/** + * @desc restore system settings + * @param + * filename the system backup filename + * + */ +HT_API BOOL SystemRestore(ONVIF_DEVICE * p_dev, const char * filename); + +// media service 2 interface +HT_API BOOL tr2_GetProfiles(ONVIF_DEVICE * p_dev); + +/** + * @desc GetStreamUris + * @param + * proto: + * RtspUnicast -- RTSP streaming RTP as UDP Unicast + * RtspMulticast -- RTSP streaming RTP as UDP Multicast + * RTSP -- RTSP streaming RTP over TCP + * RtspOverHttp -- Tunneling both the RTSP control channel and the RTP stream over HTTP or HTTPS + */ +HT_API BOOL tr2_GetStreamUris(ONVIF_DEVICE * p_dev, const char * proto); +HT_API BOOL tr2_GetVideoSourceConfigurations(ONVIF_DEVICE * p_dev); +HT_API BOOL tr2_GetAudioSourceConfigurations(ONVIF_DEVICE * p_dev); + +#ifdef __cplusplus +} +#endif + +#endif + + + diff --git a/ONVIF/include/onvif/onvif_cln.h b/ONVIF/include/onvif/onvif_cln.h new file mode 100644 index 0000000..ee7ab7d --- /dev/null +++ b/ONVIF/include/onvif/onvif_cln.h @@ -0,0 +1,487 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef ONVIF_CLIENT_H +#define ONVIF_CLIENT_H + +#include "onvif.h" +#include "onvif_req.h" +#include "onvif_res.h" + +#ifdef __cplusplus +extern "C" { +#endif + +HT_API void onvif_SetAuthInfo(ONVIF_DEVICE * p_dev, const char * user, const char * pass); +HT_API void onvif_SetAuthMethod(ONVIF_DEVICE * p_dev, onvif_AuthMethod method); +HT_API void onvif_SetReqTimeout(ONVIF_DEVICE * p_dev, int timeout /* millisecond */); +HT_API char * onvif_GetErrString(ONVIF_DEVICE * p_dev); + +// onvif device service interfaces +HT_API BOOL onvif_tds_GetCapabilities(ONVIF_DEVICE * p_dev, tds_GetCapabilities_REQ * p_req, tds_GetCapabilities_RES * p_res); +HT_API BOOL onvif_tds_GetServices(ONVIF_DEVICE * p_dev, tds_GetServices_REQ * p_req, tds_GetServices_RES * p_res); +HT_API BOOL onvif_tds_GetServiceCapabilities(ONVIF_DEVICE * p_dev, tds_GetServiceCapabilities_REQ * p_req, tds_GetServiceCapabilities_RES * p_res); +HT_API BOOL onvif_tds_GetDeviceInformation(ONVIF_DEVICE * p_dev, tds_GetDeviceInformation_REQ * p_req, tds_GetDeviceInformation_RES * p_res); +HT_API BOOL onvif_tds_GetUsers(ONVIF_DEVICE * p_dev, tds_GetUsers_REQ * p_req, tds_GetUsers_RES * p_res); +HT_API BOOL onvif_tds_CreateUsers(ONVIF_DEVICE * p_dev, tds_CreateUsers_REQ * p_req, tds_CreateUsers_RES * p_res); +HT_API BOOL onvif_tds_DeleteUsers(ONVIF_DEVICE * p_dev, tds_DeleteUsers_REQ * p_req, tds_DeleteUsers_RES * p_res); +HT_API BOOL onvif_tds_SetUser(ONVIF_DEVICE * p_dev, tds_SetUser_REQ * p_req, tds_SetUser_RES * p_res); +HT_API BOOL onvif_tds_GetRemoteUser(ONVIF_DEVICE * p_dev, tds_GetRemoteUser_REQ * p_req, tds_GetRemoteUser_RES * p_res); +HT_API BOOL onvif_tds_SetRemoteUser(ONVIF_DEVICE * p_dev, tds_SetRemoteUser_REQ * p_req, tds_SetRemoteUser_RES * p_res); +HT_API BOOL onvif_tds_GetNetworkInterfaces(ONVIF_DEVICE * p_dev, tds_GetNetworkInterfaces_REQ * p_req, tds_GetNetworkInterfaces_RES * p_res); +HT_API BOOL onvif_tds_SetNetworkInterfaces(ONVIF_DEVICE * p_dev, tds_SetNetworkInterfaces_REQ * p_req, tds_SetNetworkInterfaces_RES * p_res); +HT_API BOOL onvif_tds_GetNTP(ONVIF_DEVICE * p_dev, tds_GetNTP_REQ * p_req, tds_GetNTP_RES * p_res); +HT_API BOOL onvif_tds_SetNTP(ONVIF_DEVICE * p_dev, tds_SetNTP_REQ * p_req, tds_SetNTP_RES * p_res); +HT_API BOOL onvif_tds_GetHostname(ONVIF_DEVICE * p_dev, tds_GetHostname_REQ * p_req, tds_GetHostname_RES * p_res); +HT_API BOOL onvif_tds_SetHostname(ONVIF_DEVICE * p_dev, tds_SetHostname_REQ * p_req, tds_SetHostname_RES * p_res); +HT_API BOOL onvif_tds_SetHostnameFromDHCP(ONVIF_DEVICE * p_dev, tds_SetHostnameFromDHCP_REQ * p_req, tds_SetHostnameFromDHCP_RES * p_res); +HT_API BOOL onvif_tds_GetDNS(ONVIF_DEVICE * p_dev, tds_GetDNS_REQ * p_req, tds_GetDNS_RES * p_res); +HT_API BOOL onvif_tds_SetDNS(ONVIF_DEVICE * p_dev, tds_SetDNS_REQ * p_req, tds_SetDNS_RES * p_res); +HT_API BOOL onvif_tds_GetDynamicDNS(ONVIF_DEVICE * p_dev, tds_GetDynamicDNS_REQ * p_req, tds_GetDynamicDNS_RES * p_res); +HT_API BOOL onvif_tds_SetDynamicDNS(ONVIF_DEVICE * p_dev, tds_SetDynamicDNS_REQ * p_req, tds_SetDynamicDNS_RES * p_res); +HT_API BOOL onvif_tds_GetNetworkProtocols(ONVIF_DEVICE * p_dev, tds_GetNetworkProtocols_REQ * p_req, tds_GetNetworkProtocols_RES * p_res); +HT_API BOOL onvif_tds_SetNetworkProtocols(ONVIF_DEVICE * p_dev, tds_SetNetworkProtocols_REQ * p_req, tds_SetNetworkProtocols_RES * p_res); +HT_API BOOL onvif_tds_GetDiscoveryMode(ONVIF_DEVICE * p_dev, tds_GetDiscoveryMode_REQ * p_req, tds_GetDiscoveryMode_RES * p_res); +HT_API BOOL onvif_tds_SetDiscoveryMode(ONVIF_DEVICE * p_dev, tds_SetDiscoveryMode_REQ * p_req, tds_SetDiscoveryMode_RES * p_res); +HT_API BOOL onvif_tds_GetNetworkDefaultGateway(ONVIF_DEVICE * p_dev, tds_GetNetworkDefaultGateway_REQ * p_req, tds_GetNetworkDefaultGateway_RES * p_res); +HT_API BOOL onvif_tds_SetNetworkDefaultGateway(ONVIF_DEVICE * p_dev, tds_SetNetworkDefaultGateway_REQ * p_req, tds_SetNetworkDefaultGateway_RES * p_res); +HT_API BOOL onvif_tds_GetZeroConfiguration(ONVIF_DEVICE * p_dev, tds_GetZeroConfiguration_REQ * p_req, tds_GetZeroConfiguration_RES * p_res); +HT_API BOOL onvif_tds_SetZeroConfiguration(ONVIF_DEVICE * p_dev, tds_SetZeroConfiguration_REQ * p_req, tds_SetZeroConfiguration_RES * p_res); +HT_API BOOL onvif_tds_GetEndpointReference(ONVIF_DEVICE * p_dev, tds_GetEndpointReference_REQ * p_req, tds_GetEndpointReference_RES * p_res); +HT_API BOOL onvif_tds_SendAuxiliaryCommand(ONVIF_DEVICE * p_dev, tds_SendAuxiliaryCommand_REQ * p_req, tds_SendAuxiliaryCommand_RES * p_res); +HT_API BOOL onvif_tds_GetRelayOutputs(ONVIF_DEVICE * p_dev, tds_GetRelayOutputs_REQ * p_req, tds_GetRelayOutputs_RES * p_res); +HT_API BOOL onvif_tds_SetRelayOutputSettings(ONVIF_DEVICE * p_dev, tds_SetRelayOutputSettings_REQ * p_req, tds_SetRelayOutputSettings_RES * p_res); +HT_API BOOL onvif_tds_SetRelayOutputState(ONVIF_DEVICE * p_dev, tds_SetRelayOutputState_REQ * p_req, tds_SetRelayOutputState_RES * p_res); +HT_API BOOL onvif_tds_GetSystemDateAndTime(ONVIF_DEVICE * p_dev, tds_GetSystemDateAndTime_REQ * p_req, tds_GetSystemDateAndTime_RES * p_res); +HT_API BOOL onvif_tds_SetSystemDateAndTime(ONVIF_DEVICE * p_dev, tds_SetSystemDateAndTime_REQ * p_req, tds_SetSystemDateAndTime_RES * p_res); +HT_API BOOL onvif_tds_SystemReboot(ONVIF_DEVICE * p_dev, tds_SystemReboot_REQ * p_req, tds_SystemReboot_RES * p_res); +HT_API BOOL onvif_tds_SetSystemFactoryDefault(ONVIF_DEVICE * p_dev, tds_SetSystemFactoryDefault_REQ * p_req, tds_SetSystemFactoryDefault_RES * p_res); +HT_API BOOL onvif_tds_GetSystemLog(ONVIF_DEVICE * p_dev, tds_GetSystemLog_REQ * p_req, tds_GetSystemLog_RES * p_res); +HT_API BOOL onvif_tds_GetScopes(ONVIF_DEVICE * p_dev, tds_GetScopes_REQ * p_req, tds_GetScopes_RES * p_res); +HT_API BOOL onvif_tds_SetScopes(ONVIF_DEVICE * p_dev, tds_SetScopes_REQ * p_req, tds_SetScopes_RES * p_res); +HT_API BOOL onvif_tds_AddScopes(ONVIF_DEVICE * p_dev, tds_AddScopes_REQ * p_req, tds_AddScopes_RES * p_res); +HT_API BOOL onvif_tds_RemoveScopes(ONVIF_DEVICE * p_dev, tds_RemoveScopes_REQ * p_req, tds_RemoveScopes_RES * p_res); +HT_API BOOL onvif_tds_StartFirmwareUpgrade(ONVIF_DEVICE * p_dev, tds_StartFirmwareUpgrade_REQ * p_req, tds_StartFirmwareUpgrade_RES * p_res); +HT_API BOOL onvif_tds_GetSystemUris(ONVIF_DEVICE * p_dev, tds_GetSystemUris_REQ * p_req, tds_GetSystemUris_RES * p_res); +HT_API BOOL onvif_tds_StartSystemRestore(ONVIF_DEVICE * p_dev, tds_StartSystemRestore_REQ * p_req, tds_StartSystemRestore_RES * p_res); +HT_API BOOL onvif_tds_GetWsdlUrl(ONVIF_DEVICE * p_dev, tds_GetWsdlUrl_REQ * p_req, tds_GetWsdlUrl_RES * p_res); +HT_API BOOL onvif_tds_GetDot11Capabilities(ONVIF_DEVICE * p_dev, tds_GetDot11Capabilities_REQ * p_req, tds_GetDot11Capabilities_RES * p_res); +HT_API BOOL onvif_tds_GetDot11Status(ONVIF_DEVICE * p_dev, tds_GetDot11Status_REQ * p_req, tds_GetDot11Status_RES * p_res); +HT_API BOOL onvif_tds_ScanAvailableDot11Networks(ONVIF_DEVICE * p_dev, tds_ScanAvailableDot11Networks_REQ * p_req, tds_ScanAvailableDot11Networks_RES * p_res); +HT_API BOOL onvif_tds_GetGeoLocation(ONVIF_DEVICE * p_dev, tds_GetGeoLocation_REQ * p_req, tds_GetGeoLocation_RES * p_res); +HT_API BOOL onvif_tds_SetGeoLocation(ONVIF_DEVICE * p_dev, tds_SetGeoLocation_REQ * p_req, tds_SetGeoLocation_RES * p_res); +HT_API BOOL onvif_tds_DeleteGeoLocation(ONVIF_DEVICE * p_dev, tds_DeleteGeoLocation_REQ * p_req, tds_DeleteGeoLocation_RES * p_res); +HT_API BOOL onvif_tds_SetHashingAlgorithm(ONVIF_DEVICE * p_dev, tds_SetHashingAlgorithm_REQ * p_req, tds_SetHashingAlgorithm_RES * p_res); + +// IP address filter interfaces +HT_API BOOL onvif_tds_GetIPAddressFilter(ONVIF_DEVICE * p_dev, tds_GetIPAddressFilter_REQ * p_req, tds_GetIPAddressFilter_RES * p_res); +HT_API BOOL onvif_tds_SetIPAddressFilter(ONVIF_DEVICE * p_dev, tds_SetIPAddressFilter_REQ * p_req, tds_SetIPAddressFilter_RES * p_res); +HT_API BOOL onvif_tds_AddIPAddressFilter(ONVIF_DEVICE * p_dev, tds_AddIPAddressFilter_REQ * p_req, tds_AddIPAddressFilter_RES * p_res); +HT_API BOOL onvif_tds_RemoveIPAddressFilter(ONVIF_DEVICE * p_dev, tds_RemoveIPAddressFilter_REQ * p_req, tds_RemoveIPAddressFilter_RES * p_res); + +// If call succesful, should call free to free p_res->PolicyFile.Data.ptr +HT_API BOOL onvif_tds_GetAccessPolicy(ONVIF_DEVICE * p_dev, tds_GetAccessPolicy_REQ * p_req, tds_GetAccessPolicy_RES * p_res); +HT_API BOOL onvif_tds_SetAccessPolicy(ONVIF_DEVICE * p_dev, tds_SetAccessPolicy_REQ * p_req, tds_SetAccessPolicy_RES * p_res); +HT_API BOOL onvif_tds_GetStorageConfigurations(ONVIF_DEVICE * p_dev, tds_GetStorageConfigurations_REQ * p_req, tds_GetStorageConfigurations_RES * p_res); +HT_API BOOL onvif_tds_CreateStorageConfiguration(ONVIF_DEVICE * p_dev, tds_CreateStorageConfiguration_REQ * p_req, tds_CreateStorageConfiguration_RES * p_res); +HT_API BOOL onvif_tds_GetStorageConfiguration(ONVIF_DEVICE * p_dev, tds_GetStorageConfiguration_REQ * p_req, tds_GetStorageConfiguration_RES * p_res); +HT_API BOOL onvif_tds_SetStorageConfiguration(ONVIF_DEVICE * p_dev, tds_SetStorageConfiguration_REQ * p_req, tds_SetStorageConfiguration_RES * p_res); +HT_API BOOL onvif_tds_DeleteStorageConfiguration(ONVIF_DEVICE * p_dev, tds_DeleteStorageConfiguration_REQ * p_req, tds_DeleteStorageConfiguration_RES * p_res); + +// onvif media service interfaces +HT_API BOOL onvif_trt_GetServiceCapabilities(ONVIF_DEVICE * p_dev, trt_GetServiceCapabilities_REQ * p_req, trt_GetServiceCapabilities_RES * p_res); +HT_API BOOL onvif_trt_GetVideoSources(ONVIF_DEVICE * p_dev, trt_GetVideoSources_REQ * p_req, trt_GetVideoSources_RES * p_res); +HT_API BOOL onvif_trt_GetAudioSources(ONVIF_DEVICE * p_dev, trt_GetAudioSources_REQ * p_req, trt_GetAudioSources_RES * p_res); +HT_API BOOL onvif_trt_CreateProfile(ONVIF_DEVICE * p_dev, trt_CreateProfile_REQ * p_req, trt_CreateProfile_RES * p_res); +HT_API BOOL onvif_trt_GetProfile(ONVIF_DEVICE * p_dev, trt_GetProfile_REQ * p_req, trt_GetProfile_RES * p_res); +HT_API BOOL onvif_trt_GetProfiles(ONVIF_DEVICE * p_dev, trt_GetProfiles_REQ * p_req, trt_GetProfiles_RES * p_res); +HT_API BOOL onvif_trt_AddVideoEncoderConfiguration(ONVIF_DEVICE * p_dev, trt_AddVideoEncoderConfiguration_REQ * p_req, trt_AddVideoEncoderConfiguration_RES * p_res); +HT_API BOOL onvif_trt_AddVideoSourceConfiguration(ONVIF_DEVICE * p_dev, trt_AddVideoSourceConfiguration_REQ * p_req, trt_AddVideoSourceConfiguration_RES * p_res); +HT_API BOOL onvif_trt_AddAudioEncoderConfiguration(ONVIF_DEVICE * p_dev, trt_AddAudioEncoderConfiguration_REQ * p_req, trt_AddAudioEncoderConfiguration_RES * p_res); +HT_API BOOL onvif_trt_AddAudioSourceConfiguration(ONVIF_DEVICE * p_dev, trt_AddAudioSourceConfiguration_REQ * p_req, trt_AddAudioSourceConfiguration_RES * p_res); +HT_API BOOL onvif_trt_GetVideoSourceModes(ONVIF_DEVICE * p_dev, trt_GetVideoSourceModes_REQ * p_req, trt_GetVideoSourceModes_RES * p_res); +HT_API BOOL onvif_trt_SetVideoSourceMode(ONVIF_DEVICE * p_dev, trt_SetVideoSourceMode_REQ * p_req, trt_SetVideoSourceMode_RES * p_res); +HT_API BOOL onvif_trt_AddPTZConfiguration(ONVIF_DEVICE * p_dev, trt_AddPTZConfiguration_REQ * p_req, trt_AddPTZConfiguration_RES * p_res); +HT_API BOOL onvif_trt_RemoveVideoEncoderConfiguration(ONVIF_DEVICE * p_dev, trt_RemoveVideoEncoderConfiguration_REQ * p_req, trt_RemoveVideoEncoderConfiguration_RES * p_res); +HT_API BOOL onvif_trt_RemoveVideoSourceConfiguration(ONVIF_DEVICE * p_dev, trt_RemoveVideoSourceConfiguration_REQ * p_req, trt_RemoveVideoSourceConfiguration_RES * p_res); +HT_API BOOL onvif_trt_RemoveAudioEncoderConfiguration(ONVIF_DEVICE * p_dev, trt_RemoveAudioEncoderConfiguration_REQ * p_req, trt_RemoveAudioEncoderConfiguration_RES * p_res); +HT_API BOOL onvif_trt_RemoveAudioSourceConfiguration(ONVIF_DEVICE * p_dev, trt_RemoveAudioSourceConfiguration_REQ * p_req, trt_RemoveAudioSourceConfiguration_RES * p_res); +HT_API BOOL onvif_trt_RemovePTZConfiguration(ONVIF_DEVICE * p_dev, trt_RemovePTZConfiguration_REQ * p_req, trt_RemovePTZConfiguration_RES * p_res); +HT_API BOOL onvif_trt_DeleteProfile(ONVIF_DEVICE * p_dev, trt_DeleteProfile_REQ * p_req, trt_DeleteProfile_RES * p_res); +HT_API BOOL onvif_trt_GetVideoSourceConfigurations(ONVIF_DEVICE * p_dev, trt_GetVideoSourceConfigurations_REQ * p_req, trt_GetVideoSourceConfigurations_RES * p_res); +HT_API BOOL onvif_trt_GetVideoEncoderConfigurations(ONVIF_DEVICE * p_dev, trt_GetVideoEncoderConfigurations_REQ * p_req, trt_GetVideoEncoderConfigurations_RES * p_res); +HT_API BOOL onvif_trt_GetAudioSourceConfigurations(ONVIF_DEVICE * p_dev, trt_GetAudioSourceConfigurations_REQ * p_req, trt_GetAudioSourceConfigurations_RES * p_res); +HT_API BOOL onvif_trt_GetAudioEncoderConfigurations(ONVIF_DEVICE * p_dev, trt_GetAudioEncoderConfigurations_REQ * p_req, trt_GetAudioEncoderConfigurations_RES * p_res); +HT_API BOOL onvif_trt_GetVideoSourceConfiguration(ONVIF_DEVICE * p_dev, trt_GetVideoSourceConfiguration_REQ * p_req, trt_GetVideoSourceConfiguration_RES * p_res); +HT_API BOOL onvif_trt_GetVideoEncoderConfiguration(ONVIF_DEVICE * p_dev, trt_GetVideoEncoderConfiguration_REQ * p_req, trt_GetVideoEncoderConfiguration_RES * p_res); +HT_API BOOL onvif_trt_GetAudioSourceConfiguration(ONVIF_DEVICE * p_dev, trt_GetAudioSourceConfiguration_REQ * p_req, trt_GetAudioSourceConfiguration_RES * p_res); +HT_API BOOL onvif_trt_GetAudioEncoderConfiguration(ONVIF_DEVICE * p_dev, trt_GetAudioEncoderConfiguration_REQ * p_req, trt_GetAudioEncoderConfiguration_RES * p_res); +HT_API BOOL onvif_trt_SetVideoSourceConfiguration(ONVIF_DEVICE * p_dev, trt_SetVideoSourceConfiguration_REQ * p_req, trt_SetVideoSourceConfiguration_RES * p_res); +HT_API BOOL onvif_trt_SetVideoEncoderConfiguration(ONVIF_DEVICE * p_dev, trt_SetVideoEncoderConfiguration_REQ * p_req, trt_SetVideoEncoderConfiguration_RES * p_res); +HT_API BOOL onvif_trt_SetAudioSourceConfiguration(ONVIF_DEVICE * p_dev, trt_SetAudioSourceConfiguration_REQ * p_req, trt_SetAudioSourceConfiguration_RES * p_res); +HT_API BOOL onvif_trt_SetAudioEncoderConfiguration(ONVIF_DEVICE * p_dev, trt_SetAudioEncoderConfiguration_REQ * p_req, trt_SetAudioEncoderConfiguration_RES * p_res); +HT_API BOOL onvif_trt_GetVideoSourceConfigurationOptions(ONVIF_DEVICE * p_dev, trt_GetVideoSourceConfigurationOptions_REQ * p_req, trt_GetVideoSourceConfigurationOptions_RES * p_res); +HT_API BOOL onvif_trt_GetVideoEncoderConfigurationOptions(ONVIF_DEVICE * p_dev, trt_GetVideoEncoderConfigurationOptions_REQ * p_req, trt_GetVideoEncoderConfigurationOptions_RES * p_res); +HT_API BOOL onvif_trt_GetAudioSourceConfigurationOptions(ONVIF_DEVICE * p_dev, trt_GetAudioSourceConfigurationOptions_REQ * p_req, trt_GetAudioSourceConfigurationOptions_RES * p_res); +HT_API BOOL onvif_trt_GetAudioEncoderConfigurationOptions(ONVIF_DEVICE * p_dev, trt_GetAudioEncoderConfigurationOptions_REQ * p_req, trt_GetAudioEncoderConfigurationOptions_RES * p_res); +HT_API BOOL onvif_trt_GetStreamUri(ONVIF_DEVICE * p_dev, trt_GetStreamUri_REQ * p_req, trt_GetStreamUri_RES * p_res); +HT_API BOOL onvif_trt_SetSynchronizationPoint(ONVIF_DEVICE * p_dev, trt_SetSynchronizationPoint_REQ * p_req, trt_SetSynchronizationPoint_RES * p_res); +HT_API BOOL onvif_trt_GetSnapshotUri(ONVIF_DEVICE * p_dev, trt_GetSnapshotUri_REQ * p_req, trt_GetSnapshotUri_RES * p_res); +HT_API BOOL onvif_trt_GetGuaranteedNumberOfVideoEncoderInstances(ONVIF_DEVICE * p_dev, trt_GetGuaranteedNumberOfVideoEncoderInstances_REQ * p_req, trt_GetGuaranteedNumberOfVideoEncoderInstances_RES * p_res); +HT_API BOOL onvif_trt_GetAudioOutputs(ONVIF_DEVICE * p_dev, trt_GetAudioOutputs_REQ * p_req, trt_GetAudioOutputs_RES * p_res); +HT_API BOOL onvif_trt_GetAudioOutputConfigurations(ONVIF_DEVICE * p_dev, trt_GetAudioOutputConfigurations_REQ * p_req, trt_GetAudioOutputConfigurations_RES * p_res); +HT_API BOOL onvif_trt_GetAudioOutputConfiguration(ONVIF_DEVICE * p_dev, trt_GetAudioOutputConfiguration_REQ * p_req, trt_GetAudioOutputConfiguration_RES * p_res); +HT_API BOOL onvif_trt_GetAudioOutputConfigurationOptions(ONVIF_DEVICE * p_dev, trt_GetAudioOutputConfigurationOptions_REQ * p_req, trt_GetAudioOutputConfigurationOptions_RES * p_res); +HT_API BOOL onvif_trt_SetAudioOutputConfiguration(ONVIF_DEVICE * p_dev, trt_SetAudioOutputConfiguration_REQ * p_req, trt_SetAudioOutputConfiguration_RES * p_res); +HT_API BOOL onvif_trt_GetAudioDecoderConfigurations(ONVIF_DEVICE * p_dev, trt_GetAudioDecoderConfigurations_REQ * p_req, trt_GetAudioDecoderConfigurations_RES * p_res); +HT_API BOOL onvif_trt_GetAudioDecoderConfiguration(ONVIF_DEVICE * p_dev, trt_GetAudioDecoderConfiguration_REQ * p_req, trt_GetAudioDecoderConfiguration_RES * p_res); +HT_API BOOL onvif_trt_GetAudioDecoderConfigurationOptions(ONVIF_DEVICE * p_dev, trt_GetAudioDecoderConfigurationOptions_REQ * p_req, trt_GetAudioDecoderConfigurationOptions_RES * p_res); +HT_API BOOL onvif_trt_SetAudioDecoderConfiguration(ONVIF_DEVICE * p_dev, trt_SetAudioDecoderConfiguration_REQ * p_req, trt_SetAudioDecoderConfiguration_RES * p_res); +HT_API BOOL onvif_trt_AddAudioOutputConfiguration(ONVIF_DEVICE * p_dev, trt_AddAudioOutputConfiguration_REQ * p_req, trt_AddAudioOutputConfiguration_RES * p_res); +HT_API BOOL onvif_trt_AddAudioDecoderConfiguration(ONVIF_DEVICE * p_dev, trt_AddAudioDecoderConfiguration_REQ * p_req, trt_AddAudioDecoderConfiguration_RES * p_res); +HT_API BOOL onvif_trt_RemoveAudioOutputConfiguration(ONVIF_DEVICE * p_dev, trt_RemoveAudioOutputConfiguration_REQ * p_req, trt_RemoveAudioOutputConfiguration_RES * p_res); +HT_API BOOL onvif_trt_RemoveAudioDecoderConfiguration(ONVIF_DEVICE * p_dev, trt_RemoveAudioDecoderConfiguration_REQ * p_req, trt_RemoveAudioDecoderConfiguration_RES * p_res); +HT_API BOOL onvif_trt_GetOSDs(ONVIF_DEVICE * p_dev, trt_GetOSDs_REQ * p_req, trt_GetOSDs_RES * p_res); +HT_API BOOL onvif_trt_GetOSD(ONVIF_DEVICE * p_dev, trt_GetOSD_REQ * p_req, trt_GetOSD_RES * p_res); +HT_API BOOL onvif_trt_SetOSD(ONVIF_DEVICE * p_dev, trt_SetOSD_REQ * p_req, trt_SetOSD_RES * p_res); +HT_API BOOL onvif_trt_GetOSDOptions(ONVIF_DEVICE * p_dev, trt_GetOSDOptions_REQ * p_req, trt_GetOSDOptions_RES * p_res); +HT_API BOOL onvif_trt_CreateOSD(ONVIF_DEVICE * p_dev, trt_CreateOSD_REQ * p_req, trt_CreateOSD_RES * p_res); +HT_API BOOL onvif_trt_DeleteOSD(ONVIF_DEVICE * p_dev, trt_DeleteOSD_REQ * p_req, trt_DeleteOSD_RES * p_res); +HT_API BOOL onvif_trt_GetVideoAnalyticsConfigurations(ONVIF_DEVICE * p_dev, trt_GetVideoAnalyticsConfigurations_REQ * p_req, trt_GetVideoAnalyticsConfigurations_RES * p_res); +HT_API BOOL onvif_trt_AddVideoAnalyticsConfiguration(ONVIF_DEVICE * p_dev, trt_AddVideoAnalyticsConfiguration_REQ * p_req, trt_AddVideoAnalyticsConfiguration_RES * p_res); +HT_API BOOL onvif_trt_GetVideoAnalyticsConfiguration(ONVIF_DEVICE * p_dev, trt_GetVideoAnalyticsConfiguration_REQ * p_req, trt_GetVideoAnalyticsConfiguration_RES * p_res); +HT_API BOOL onvif_trt_RemoveVideoAnalyticsConfiguration(ONVIF_DEVICE * p_dev, trt_RemoveVideoAnalyticsConfiguration_REQ * p_req, trt_RemoveVideoAnalyticsConfiguration_RES * p_res); +HT_API BOOL onvif_trt_SetVideoAnalyticsConfiguration(ONVIF_DEVICE * p_dev, trt_SetVideoAnalyticsConfiguration_REQ * p_req, trt_SetVideoAnalyticsConfiguration_RES * p_res); +HT_API BOOL onvif_trt_GetMetadataConfigurations(ONVIF_DEVICE * p_dev, trt_GetMetadataConfigurations_REQ * p_req, trt_GetMetadataConfigurations_RES * p_res); +HT_API BOOL onvif_trt_AddMetadataConfiguration(ONVIF_DEVICE * p_dev, trt_AddMetadataConfiguration_REQ * p_req, trt_AddMetadataConfiguration_RES * p_res); +HT_API BOOL onvif_trt_GetMetadataConfiguration(ONVIF_DEVICE * p_dev, trt_GetMetadataConfiguration_REQ * p_req, trt_GetMetadataConfiguration_RES * p_res); +HT_API BOOL onvif_trt_RemoveMetadataConfiguration(ONVIF_DEVICE * p_dev, trt_RemoveMetadataConfiguration_REQ * p_req, trt_RemoveMetadataConfiguration_RES * p_res); +HT_API BOOL onvif_trt_SetMetadataConfiguration(ONVIF_DEVICE * p_dev, trt_SetMetadataConfiguration_REQ * p_req, trt_SetMetadataConfiguration_RES * p_res); +HT_API BOOL onvif_trt_GetMetadataConfigurationOptions(ONVIF_DEVICE * p_dev, trt_GetMetadataConfigurationOptions_REQ * p_req, trt_GetMetadataConfigurationOptions_RES * p_res); +HT_API BOOL onvif_trt_GetCompatibleVideoEncoderConfigurations(ONVIF_DEVICE * p_dev, trt_GetCompatibleVideoEncoderConfigurations_REQ * p_req, trt_GetCompatibleVideoEncoderConfigurations_RES * p_res); +HT_API BOOL onvif_trt_GetCompatibleAudioEncoderConfigurations(ONVIF_DEVICE * p_dev, trt_GetCompatibleAudioEncoderConfigurations_REQ * p_req, trt_GetCompatibleAudioEncoderConfigurations_RES * p_res); +HT_API BOOL onvif_trt_GetCompatibleVideoAnalyticsConfigurations(ONVIF_DEVICE * p_dev, trt_GetCompatibleVideoAnalyticsConfigurations_REQ * p_req, trt_GetCompatibleVideoAnalyticsConfigurations_RES * p_res); +HT_API BOOL onvif_trt_GetCompatibleMetadataConfigurations(ONVIF_DEVICE * p_dev, trt_GetCompatibleMetadataConfigurations_REQ * p_req, trt_GetCompatibleMetadataConfigurations_RES * p_res); + +// onvif ptz service interfaces +HT_API BOOL onvif_ptz_GetServiceCapabilities(ONVIF_DEVICE * p_dev, ptz_GetServiceCapabilities_REQ * p_req, ptz_GetServiceCapabilities_RES * p_res); +HT_API BOOL onvif_ptz_GetNodes(ONVIF_DEVICE * p_dev, ptz_GetNodes_REQ * p_req, ptz_GetNodes_RES * p_res); +HT_API BOOL onvif_ptz_GetNode(ONVIF_DEVICE * p_dev, ptz_GetNode_REQ * p_req, ptz_GetNode_RES * p_res); +HT_API BOOL onvif_ptz_GetPresets(ONVIF_DEVICE * p_dev, ptz_GetPresets_REQ * p_req, ptz_GetPresets_RES * p_res); +HT_API BOOL onvif_ptz_SetPreset(ONVIF_DEVICE * p_dev, ptz_SetPreset_REQ * p_req, ptz_SetPreset_RES * p_res); +HT_API BOOL onvif_ptz_RemovePreset(ONVIF_DEVICE * p_dev, ptz_RemovePreset_REQ * p_req, ptz_RemovePreset_RES * p_res); +HT_API BOOL onvif_ptz_GotoPreset(ONVIF_DEVICE * p_dev, ptz_GotoPreset_REQ * p_req, ptz_GotoPreset_RES * p_res); +HT_API BOOL onvif_ptz_GotoHomePosition(ONVIF_DEVICE * p_dev, ptz_GotoHomePosition_REQ * p_req, ptz_GotoHomePosition_RES * p_res); +HT_API BOOL onvif_ptz_SetHomePosition(ONVIF_DEVICE * p_dev, ptz_SetHomePosition_REQ * p_req, ptz_SetHomePosition_RES * p_res); +HT_API BOOL onvif_ptz_GetStatus(ONVIF_DEVICE * p_dev, ptz_GetStatus_REQ * p_req, ptz_GetStatus_RES * p_res); +HT_API BOOL onvif_ptz_ContinuousMove(ONVIF_DEVICE * p_dev, ptz_ContinuousMove_REQ * p_req, ptz_ContinuousMove_RES * p_res); +HT_API BOOL onvif_ptz_RelativeMove(ONVIF_DEVICE * p_dev, ptz_RelativeMove_REQ * p_req, ptz_RelativeMove_RES * p_res); +HT_API BOOL onvif_ptz_AbsoluteMove(ONVIF_DEVICE * p_dev, ptz_AbsoluteMove_REQ * p_req, ptz_AbsoluteMove_RES * p_res); +HT_API BOOL onvif_ptz_Stop(ONVIF_DEVICE * p_dev, ptz_Stop_REQ * p_req, ptz_Stop_RES * p_res); +HT_API BOOL onvif_ptz_GetConfigurations(ONVIF_DEVICE * p_dev, ptz_GetConfigurations_REQ * p_req, ptz_GetConfigurations_RES * p_res); +HT_API BOOL onvif_ptz_GetConfiguration(ONVIF_DEVICE * p_dev, ptz_GetConfiguration_REQ * p_req, ptz_GetConfiguration_RES * p_res); +HT_API BOOL onvif_ptz_SetConfiguration(ONVIF_DEVICE * p_dev, ptz_SetConfiguration_REQ * p_req, ptz_SetConfiguration_RES * p_res); +HT_API BOOL onvif_ptz_GetConfigurationOptions(ONVIF_DEVICE * p_dev, ptz_GetConfigurationOptions_REQ * p_req, ptz_GetConfigurationOptions_RES * p_res); +HT_API BOOL onvif_ptz_GetPresetTours(ONVIF_DEVICE * p_dev, ptz_GetPresetTours_REQ * p_req, ptz_GetPresetTours_RES * p_res); +HT_API BOOL onvif_ptz_GetPresetTour(ONVIF_DEVICE * p_dev, ptz_GetPresetTour_REQ * p_req, ptz_GetPresetTour_RES * p_res); +HT_API BOOL onvif_ptz_GetPresetTourOptions(ONVIF_DEVICE * p_dev, ptz_GetPresetTourOptions_REQ * p_req, ptz_GetPresetTourOptions_RES * p_res); +HT_API BOOL onvif_ptz_CreatePresetTour(ONVIF_DEVICE * p_dev, ptz_CreatePresetTour_REQ * p_req, ptz_CreatePresetTour_RES * p_res); +HT_API BOOL onvif_ptz_ModifyPresetTour(ONVIF_DEVICE * p_dev, ptz_ModifyPresetTour_REQ * p_req, ptz_ModifyPresetTour_RES * p_res); +HT_API BOOL onvif_ptz_OperatePresetTour(ONVIF_DEVICE * p_dev, ptz_OperatePresetTour_REQ * p_req, ptz_OperatePresetTour_RES * p_res); +HT_API BOOL onvif_ptz_RemovePresetTour(ONVIF_DEVICE * p_dev, ptz_RemovePresetTour_REQ * p_req, ptz_RemovePresetTour_RES * p_res); +HT_API BOOL onvif_ptz_SendAuxiliaryCommand(ONVIF_DEVICE * p_dev, ptz_SendAuxiliaryCommand_REQ * p_req, ptz_SendAuxiliaryCommand_RES * p_res); +HT_API BOOL onvif_ptz_GeoMove(ONVIF_DEVICE * p_dev, ptz_GeoMove_REQ * p_req, ptz_GeoMove_RES * p_res); + +// onvif event service interfaces +HT_API BOOL onvif_tev_GetServiceCapabilities(ONVIF_DEVICE * p_dev, tev_GetServiceCapabilities_REQ * p_req, tev_GetServiceCapabilities_RES * p_res); +HT_API BOOL onvif_tev_GetEventProperties(ONVIF_DEVICE * p_dev, tev_GetEventProperties_REQ * p_req, tev_GetEventProperties_RES * p_res); +HT_API BOOL onvif_tev_Renew(ONVIF_DEVICE * p_dev, tev_Renew_REQ * p_req, tev_Renew_RES * p_res); +HT_API BOOL onvif_tev_Unsubscribe(ONVIF_DEVICE * p_dev, tev_Unsubscribe_REQ * p_req, tev_Unsubscribe_RES * p_res); +HT_API BOOL onvif_tev_Subscribe(ONVIF_DEVICE * p_dev, tev_Subscribe_REQ * p_req, tev_Subscribe_RES * p_res); +HT_API BOOL onvif_tev_PauseSubscription(ONVIF_DEVICE * p_dev, tev_PauseSubscription_REQ * p_req, tev_PauseSubscription_RES * p_res); +HT_API BOOL onvif_tev_ResumeSubscription(ONVIF_DEVICE * p_dev, tev_ResumeSubscription_REQ * p_req, tev_ResumeSubscription_RES * p_res); +HT_API BOOL onvif_tev_CreatePullPointSubscription(ONVIF_DEVICE * p_dev, tev_CreatePullPointSubscription_REQ * p_req, tev_CreatePullPointSubscription_RES * p_res); +HT_API BOOL onvif_tev_DestroyPullPoint(ONVIF_DEVICE * p_dev, tev_DestroyPullPoint_REQ * p_req, tev_DestroyPullPoint_RES * p_res); +HT_API BOOL onvif_tev_PullMessages(ONVIF_DEVICE * p_dev, tev_PullMessages_REQ * p_req, tev_PullMessages_RES * p_res); +HT_API BOOL onvif_tev_GetMessages(ONVIF_DEVICE * p_dev, tev_GetMessages_REQ * p_req, tev_GetMessages_RES * p_res); +HT_API BOOL onvif_tev_Seek(ONVIF_DEVICE * p_dev, tev_Seek_REQ * p_req, tev_Seek_RES * p_res); +HT_API BOOL onvif_tev_SetSynchronizationPoint(ONVIF_DEVICE * p_dev, tev_SetSynchronizationPoint_REQ * p_req, tev_SetSynchronizationPoint_RES * p_res); + +// onvif imaging service interfaces +HT_API BOOL onvif_img_GetServiceCapabilities(ONVIF_DEVICE * p_dev, img_GetServiceCapabilities_REQ * p_req, img_GetServiceCapabilities_RES * p_res); +HT_API BOOL onvif_img_GetImagingSettings(ONVIF_DEVICE * p_dev, img_GetImagingSettings_REQ * p_req, img_GetImagingSettings_RES * p_res); +HT_API BOOL onvif_img_SetImagingSettings(ONVIF_DEVICE * p_dev, img_SetImagingSettings_REQ * p_req, img_SetImagingSettings_RES * p_res); +HT_API BOOL onvif_img_GetOptions(ONVIF_DEVICE * p_dev, img_GetOptions_REQ * p_req, img_GetOptions_RES * p_res); +HT_API BOOL onvif_img_Move(ONVIF_DEVICE * p_dev, img_Move_REQ * p_req, img_Move_RES * p_res); +HT_API BOOL onvif_img_Stop(ONVIF_DEVICE * p_dev, img_Stop_REQ * p_req, img_Stop_RES * p_res); +HT_API BOOL onvif_img_GetStatus(ONVIF_DEVICE * p_dev, img_GetStatus_REQ * p_req, img_GetStatus_RES * p_res); +HT_API BOOL onvif_img_GetMoveOptions(ONVIF_DEVICE * p_dev, img_GetMoveOptions_REQ * p_req, img_GetMoveOptions_RES * p_res); +HT_API BOOL onvif_img_GetPresets(ONVIF_DEVICE * p_dev, img_GetPresets_REQ * p_req, img_GetPresets_RES * p_res); +HT_API BOOL onvif_img_GetCurrentPreset(ONVIF_DEVICE * p_dev, img_GetCurrentPreset_REQ * p_req, img_GetCurrentPreset_RES * p_res); +HT_API BOOL onvif_img_SetCurrentPreset(ONVIF_DEVICE * p_dev, img_SetCurrentPreset_REQ * p_req, img_SetCurrentPreset_RES * p_res); + +// onvif device IO service interfaces +HT_API BOOL onvif_tmd_GetServiceCapabilities(ONVIF_DEVICE * p_dev, tmd_GetServiceCapabilities_REQ * p_req, tmd_GetServiceCapabilities_RES * p_res); +HT_API BOOL onvif_tmd_GetRelayOutputs(ONVIF_DEVICE * p_dev, tmd_GetRelayOutputs_REQ * p_req, tmd_GetRelayOutputs_RES * p_res); +HT_API BOOL onvif_tmd_GetRelayOutputOptions(ONVIF_DEVICE * p_dev, tmd_GetRelayOutputOptions_REQ * p_req, tmd_GetRelayOutputOptions_RES * p_res); +HT_API BOOL onvif_tmd_SetRelayOutputSettings(ONVIF_DEVICE * p_dev, tmd_SetRelayOutputSettings_REQ * p_req, tmd_SetRelayOutputSettings_RES * p_res); +HT_API BOOL onvif_tmd_SetRelayOutputState(ONVIF_DEVICE * p_dev, tmd_SetRelayOutputState_REQ * p_req, tmd_SetRelayOutputState_RES * p_res); +HT_API BOOL onvif_tmd_GetDigitalInputs(ONVIF_DEVICE * p_dev, tmd_GetDigitalInputs_REQ * p_req, tmd_GetDigitalInputs_RES * p_res); +HT_API BOOL onvif_tmd_GetDigitalInputConfigurationOptions(ONVIF_DEVICE * p_dev, tmd_GetDigitalInputConfigurationOptions_REQ * p_req, tmd_GetDigitalInputConfigurationOptions_RES * p_res); +HT_API BOOL onvif_tmd_SetDigitalInputConfigurations(ONVIF_DEVICE * p_dev, tmd_SetDigitalInputConfigurations_REQ * p_req, tmd_SetDigitalInputConfigurations_RES * p_res); + +// onvif recording service interfaces +HT_API BOOL onvif_trc_GetServiceCapabilities(ONVIF_DEVICE * p_dev, trc_GetServiceCapabilities_REQ * p_req, trc_GetServiceCapabilities_RES * p_res); +HT_API BOOL onvif_trc_CreateRecording(ONVIF_DEVICE * p_dev, trc_CreateRecording_REQ * p_req, trc_CreateRecording_RES * p_res); +HT_API BOOL onvif_trc_DeleteRecording(ONVIF_DEVICE * p_dev, trc_DeleteRecording_REQ * p_req, trc_DeleteRecording_RES * p_res); +HT_API BOOL onvif_trc_GetRecordings(ONVIF_DEVICE * p_dev, trc_GetRecordings_REQ * p_req, trc_GetRecordings_RES * p_res); +HT_API BOOL onvif_trc_SetRecordingConfiguration(ONVIF_DEVICE * p_dev, trc_SetRecordingConfiguration_REQ * p_req, trc_SetRecordingConfiguration_RES * p_res); +HT_API BOOL onvif_trc_GetRecordingConfiguration(ONVIF_DEVICE * p_dev, trc_GetRecordingConfiguration_REQ * p_req, trc_GetRecordingConfiguration_RES * p_res); +HT_API BOOL onvif_trc_GetRecordingOptions(ONVIF_DEVICE * p_dev, trc_GetRecordingOptions_REQ * p_req, trc_GetRecordingOptions_RES * p_res); +HT_API BOOL onvif_trc_CreateTrack(ONVIF_DEVICE * p_dev, trc_CreateTrack_REQ * p_req, trc_CreateTrack_RES * p_res); +HT_API BOOL onvif_trc_DeleteTrack(ONVIF_DEVICE * p_dev, trc_DeleteTrack_REQ * p_req, trc_DeleteTrack_RES * p_res); +HT_API BOOL onvif_trc_GetTrackConfiguration(ONVIF_DEVICE * p_dev, trc_GetTrackConfiguration_REQ * p_req, trc_GetTrackConfiguration_RES * p_res); +HT_API BOOL onvif_trc_SetTrackConfiguration(ONVIF_DEVICE * p_dev, trc_SetTrackConfiguration_REQ * p_req, trc_SetTrackConfiguration_RES * p_res); +HT_API BOOL onvif_trc_CreateRecordingJob(ONVIF_DEVICE * p_dev, trc_CreateRecordingJob_REQ * p_req, trc_CreateRecordingJob_RES * p_res); +HT_API BOOL onvif_trc_DeleteRecordingJob(ONVIF_DEVICE * p_dev, trc_DeleteRecordingJob_REQ * p_req, trc_DeleteRecordingJob_RES * p_res); +HT_API BOOL onvif_trc_GetRecordingJobs(ONVIF_DEVICE * p_dev, trc_GetRecordingJobs_REQ * p_req, trc_GetRecordingJobs_RES * p_res); +HT_API BOOL onvif_trc_SetRecordingJobConfiguration(ONVIF_DEVICE * p_dev, trc_SetRecordingJobConfiguration_REQ * p_req, trc_SetRecordingJobConfiguration_RES * p_res); +HT_API BOOL onvif_trc_GetRecordingJobConfiguration(ONVIF_DEVICE * p_dev, trc_GetRecordingJobConfiguration_REQ * p_req, trc_GetRecordingJobConfiguration_RES * p_res); +HT_API BOOL onvif_trc_SetRecordingJobMode(ONVIF_DEVICE * p_dev, trc_SetRecordingJobMode_REQ * p_req, trc_SetRecordingJobMode_RES * p_res); +HT_API BOOL onvif_trc_GetRecordingJobState(ONVIF_DEVICE * p_dev, trc_GetRecordingJobState_REQ * p_req, trc_GetRecordingJobState_RES * p_res); +HT_API BOOL onvif_trc_ExportRecordedData(ONVIF_DEVICE * p_dev, trc_ExportRecordedData_REQ * p_req, trc_ExportRecordedData_RES * p_res); +HT_API BOOL onvif_trc_StopExportRecordedData(ONVIF_DEVICE * p_dev, trc_StopExportRecordedData_REQ * p_req, trc_StopExportRecordedData_RES * p_res); +HT_API BOOL onvif_trc_GetExportRecordedDataState(ONVIF_DEVICE * p_dev, trc_GetExportRecordedDataState_REQ * p_req, trc_GetExportRecordedDataState_RES * p_res); + +// onvif replay service interfaces +HT_API BOOL onvif_trp_GetServiceCapabilities(ONVIF_DEVICE * p_dev, trp_GetServiceCapabilities_REQ * p_req, trp_GetServiceCapabilities_RES * p_res); +HT_API BOOL onvif_trp_GetReplayUri(ONVIF_DEVICE * p_dev, trp_GetReplayUri_REQ * p_req, trp_GetReplayUri_RES * p_res); +HT_API BOOL onvif_trp_GetReplayConfiguration(ONVIF_DEVICE * p_dev, trp_GetReplayConfiguration_REQ * p_req, trp_GetReplayConfiguration_RES * p_res); +HT_API BOOL onvif_trp_SetReplayConfiguration(ONVIF_DEVICE * p_dev, trp_SetReplayConfiguration_REQ * p_req, trp_SetReplayConfiguration_RES * p_res); + +// onvif search service interfaces +HT_API BOOL onvif_tse_GetServiceCapabilities(ONVIF_DEVICE * p_dev, tse_GetServiceCapabilities_REQ * p_req, tse_GetServiceCapabilities_RES * p_res); +HT_API BOOL onvif_tse_GetRecordingSummary(ONVIF_DEVICE * p_dev, tse_GetRecordingSummary_REQ * p_req, tse_GetRecordingSummary_RES * p_res); +HT_API BOOL onvif_tse_GetRecordingInformation(ONVIF_DEVICE * p_dev, tse_GetRecordingInformation_REQ * p_req, tse_GetRecordingInformation_RES * p_res); +HT_API BOOL onvif_tse_GetMediaAttributes(ONVIF_DEVICE * p_dev, tse_GetMediaAttributes_REQ * p_req, tse_GetMediaAttributes_RES * p_res); +HT_API BOOL onvif_tse_FindRecordings(ONVIF_DEVICE * p_dev, tse_FindRecordings_REQ * p_req, tse_FindRecordings_RES * p_res); +HT_API BOOL onvif_tse_GetRecordingSearchResults(ONVIF_DEVICE * p_dev, tse_GetRecordingSearchResults_REQ * p_req, tse_GetRecordingSearchResults_RES * p_res); +HT_API BOOL onvif_tse_FindEvents(ONVIF_DEVICE * p_dev, tse_FindEvents_REQ * p_req, tse_FindEvents_RES * p_res); +HT_API BOOL onvif_tse_GetEventSearchResults(ONVIF_DEVICE * p_dev, tse_GetEventSearchResults_REQ * p_req, tse_GetEventSearchResults_RES * p_res); +HT_API BOOL onvif_tse_FindMetadata(ONVIF_DEVICE * p_dev, tse_FindMetadata_REQ * p_req, tse_FindMetadata_RES * p_res); +HT_API BOOL onvif_tse_GetMetadataSearchResults(ONVIF_DEVICE * p_dev, tse_GetMetadataSearchResults_REQ * p_req, tse_GetMetadataSearchResults_RES * p_res); +HT_API BOOL onvif_tse_FindPTZPosition(ONVIF_DEVICE * p_dev, tse_FindPTZPosition_REQ * p_req, tse_FindPTZPosition_RES * p_res); +HT_API BOOL onvif_tse_GetPTZPositionSearchResults(ONVIF_DEVICE * p_dev, tse_GetPTZPositionSearchResults_REQ * p_req, tse_GetPTZPositionSearchResults_RES * p_res); +HT_API BOOL onvif_tse_GetSearchState(ONVIF_DEVICE * p_dev, tse_GetSearchState_REQ * p_req, tse_GetSearchState_RES * p_res); +HT_API BOOL onvif_tse_EndSearch(ONVIF_DEVICE * p_dev, tse_EndSearch_REQ * p_req, tse_EndSearch_RES * p_res); + +// onvif analytics service interfaces +HT_API BOOL onvif_tan_GetServiceCapabilities(ONVIF_DEVICE * p_dev, tan_GetServiceCapabilities_REQ * p_req, tan_GetServiceCapabilities_RES * p_res); +HT_API BOOL onvif_tan_GetSupportedRules(ONVIF_DEVICE * p_dev, tan_GetSupportedRules_REQ * p_req, tan_GetSupportedRules_RES * p_res); +HT_API BOOL onvif_tan_CreateRules(ONVIF_DEVICE * p_dev, tan_CreateRules_REQ * p_req, tan_CreateRules_RES * p_res); +HT_API BOOL onvif_tan_DeleteRules(ONVIF_DEVICE * p_dev, tan_DeleteRules_REQ * p_req, tan_DeleteRules_RES * p_res); +HT_API BOOL onvif_tan_GetRules(ONVIF_DEVICE * p_dev, tan_GetRules_REQ * p_req, tan_GetRules_RES * p_res); +HT_API BOOL onvif_tan_ModifyRules(ONVIF_DEVICE * p_dev, tan_ModifyRules_REQ * p_req, tan_ModifyRules_RES * p_res); +HT_API BOOL onvif_tan_CreateAnalyticsModules(ONVIF_DEVICE * p_dev, tan_CreateAnalyticsModules_REQ * p_req, tan_CreateAnalyticsModules_RES * p_res); +HT_API BOOL onvif_tan_DeleteAnalyticsModules(ONVIF_DEVICE * p_dev, tan_DeleteAnalyticsModules_REQ * p_req, tan_DeleteAnalyticsModules_RES * p_res); +HT_API BOOL onvif_tan_GetAnalyticsModules(ONVIF_DEVICE * p_dev, tan_GetAnalyticsModules_REQ * p_req, tan_GetAnalyticsModules_RES * p_res); +HT_API BOOL onvif_tan_ModifyAnalyticsModules(ONVIF_DEVICE * p_dev, tan_ModifyAnalyticsModules_REQ * p_req, tan_ModifyAnalyticsModules_RES * p_res); +HT_API BOOL onvif_tan_GetSupportedAnalyticsModules(ONVIF_DEVICE * p_dev, tan_GetSupportedAnalyticsModules_REQ * p_req, tan_GetSupportedAnalyticsModules_RES * p_res); +HT_API BOOL onvif_tan_GetRuleOptions(ONVIF_DEVICE * p_dev, tan_GetRuleOptions_REQ * p_req, tan_GetRuleOptions_RES * p_res); +HT_API BOOL onvif_tan_GetAnalyticsModuleOptions(ONVIF_DEVICE * p_dev, tan_GetAnalyticsModuleOptions_REQ * p_req, tan_GetAnalyticsModuleOptions_RES * p_res); +HT_API BOOL onvif_tan_GetSupportedMetadata(ONVIF_DEVICE * p_dev, tan_GetSupportedMetadata_REQ * p_req, tan_GetSupportedMetadata_RES * p_res); + +// onvif media 2 service interfaces +HT_API BOOL onvif_tr2_GetServiceCapabilities(ONVIF_DEVICE * p_dev, tr2_GetServiceCapabilities_REQ * p_req, tr2_GetServiceCapabilities_RES * p_res); +HT_API BOOL onvif_tr2_GetVideoEncoderConfigurations(ONVIF_DEVICE * p_dev, tr2_GetVideoEncoderConfigurations_REQ * p_req, tr2_GetVideoEncoderConfigurations_RES * p_res); +HT_API BOOL onvif_tr2_SetVideoEncoderConfiguration(ONVIF_DEVICE * p_dev, tr2_SetVideoEncoderConfiguration_REQ * p_req, tr2_SetVideoEncoderConfiguration_RES * p_res); +HT_API BOOL onvif_tr2_GetVideoEncoderConfigurationOptions(ONVIF_DEVICE * p_dev, tr2_GetVideoEncoderConfigurationOptions_REQ * p_req, tr2_GetVideoEncoderConfigurationOptions_RES * p_res); +HT_API BOOL onvif_tr2_GetProfiles(ONVIF_DEVICE * p_dev, tr2_GetProfiles_REQ * p_req, tr2_GetProfiles_RES * p_res); +HT_API BOOL onvif_tr2_CreateProfile(ONVIF_DEVICE * p_dev, tr2_CreateProfile_REQ * p_req, tr2_CreateProfile_RES * p_res); +HT_API BOOL onvif_tr2_DeleteProfile(ONVIF_DEVICE * p_dev, tr2_DeleteProfile_REQ * p_req, tr2_DeleteProfile_RES * p_res); +HT_API BOOL onvif_tr2_GetStreamUri(ONVIF_DEVICE * p_dev, tr2_GetStreamUri_REQ * p_req, tr2_GetStreamUri_RES * p_res); +HT_API BOOL onvif_tr2_GetVideoSourceConfigurations(ONVIF_DEVICE * p_dev, tr2_GetVideoSourceConfigurations_REQ * p_req, tr2_GetVideoSourceConfigurations_RES * p_res); +HT_API BOOL onvif_tr2_GetVideoSourceConfigurationOptions(ONVIF_DEVICE * p_dev, tr2_GetVideoSourceConfigurationOptions_REQ * p_req, tr2_GetVideoSourceConfigurationOptions_RES * p_res); +HT_API BOOL onvif_tr2_SetVideoSourceConfiguration(ONVIF_DEVICE * p_dev, tr2_SetVideoSourceConfiguration_REQ * p_req, tr2_SetVideoSourceConfiguration_RES * p_res); +HT_API BOOL onvif_tr2_SetSynchronizationPoint(ONVIF_DEVICE * p_dev, tr2_SetSynchronizationPoint_REQ * p_req, tr2_SetSynchronizationPoint_RES * p_res); +HT_API BOOL onvif_tr2_GetMetadataConfigurations(ONVIF_DEVICE * p_dev, tr2_GetMetadataConfigurations_REQ * p_req, tr2_GetMetadataConfigurations_RES * p_res); +HT_API BOOL onvif_tr2_GetMetadataConfigurationOptions(ONVIF_DEVICE * p_dev, tr2_GetMetadataConfigurationOptions_REQ * p_req, tr2_GetMetadataConfigurationOptions_RES * p_res); +HT_API BOOL onvif_tr2_SetMetadataConfiguration(ONVIF_DEVICE * p_dev, tr2_SetMetadataConfiguration_REQ * p_req, tr2_SetMetadataConfiguration_RES * p_res); +HT_API BOOL onvif_tr2_GetAudioEncoderConfigurations(ONVIF_DEVICE * p_dev, tr2_GetAudioEncoderConfigurations_REQ * p_req, tr2_GetAudioEncoderConfigurations_RES * p_res); +HT_API BOOL onvif_tr2_GetAudioSourceConfigurations(ONVIF_DEVICE * p_dev, tr2_GetAudioSourceConfigurations_REQ * p_req, tr2_GetAudioSourceConfigurations_RES * p_res); +HT_API BOOL onvif_tr2_GetAudioSourceConfigurationOptions(ONVIF_DEVICE * p_dev, tr2_GetAudioSourceConfigurationOptions_REQ * p_req, tr2_GetAudioSourceConfigurationOptions_RES * p_res); +HT_API BOOL onvif_tr2_SetAudioSourceConfiguration(ONVIF_DEVICE * p_dev, tr2_SetAudioSourceConfiguration_REQ * p_req, tr2_SetAudioSourceConfiguration_RES * p_res); +HT_API BOOL onvif_tr2_SetAudioEncoderConfiguration(ONVIF_DEVICE * p_dev, tr2_SetAudioEncoderConfiguration_REQ * p_req, tr2_SetAudioEncoderConfiguration_RES * p_res); +HT_API BOOL onvif_tr2_GetAudioEncoderConfigurationOptions(ONVIF_DEVICE * p_dev, tr2_GetAudioEncoderConfigurationOptions_REQ * p_req, tr2_GetAudioEncoderConfigurationOptions_RES * p_res); +HT_API BOOL onvif_tr2_AddConfiguration(ONVIF_DEVICE * p_dev, tr2_AddConfiguration_REQ * p_req, tr2_AddConfiguration_RES * p_res); +HT_API BOOL onvif_tr2_RemoveConfiguration(ONVIF_DEVICE * p_dev, tr2_RemoveConfiguration_REQ * p_req, tr2_RemoveConfiguration_RES * p_res); +HT_API BOOL onvif_tr2_GetVideoEncoderInstances(ONVIF_DEVICE * p_dev, tr2_GetVideoEncoderInstances_REQ * p_req, tr2_GetVideoEncoderInstances_RES * p_res); +HT_API BOOL onvif_tr2_GetAudioOutputConfigurations(ONVIF_DEVICE * p_dev, tr2_GetAudioOutputConfigurations_REQ * p_req, tr2_GetAudioOutputConfigurations_RES * p_res); +HT_API BOOL onvif_tr2_GetAudioOutputConfigurationOptions(ONVIF_DEVICE * p_dev, tr2_GetAudioOutputConfigurationOptions_REQ * p_req, tr2_GetAudioOutputConfigurationOptions_RES * p_res); +HT_API BOOL onvif_tr2_SetAudioOutputConfiguration(ONVIF_DEVICE * p_dev, tr2_SetAudioOutputConfiguration_REQ * p_req, tr2_SetAudioOutputConfiguration_RES * p_res); +HT_API BOOL onvif_tr2_GetAudioDecoderConfigurations(ONVIF_DEVICE * p_dev, tr2_GetAudioDecoderConfigurations_REQ * p_req, tr2_GetAudioDecoderConfigurations_RES * p_res); +HT_API BOOL onvif_tr2_GetAudioDecoderConfigurationOptions(ONVIF_DEVICE * p_dev, tr2_GetAudioDecoderConfigurationOptions_REQ * p_req, tr2_GetAudioDecoderConfigurationOptions_RES * p_res); +HT_API BOOL onvif_tr2_SetAudioDecoderConfiguration(ONVIF_DEVICE * p_dev, tr2_SetAudioDecoderConfiguration_REQ * p_req, tr2_SetAudioDecoderConfiguration_RES * p_res); +HT_API BOOL onvif_tr2_GetSnapshotUri(ONVIF_DEVICE * p_dev, tr2_GetSnapshotUri_REQ * p_req, tr2_GetSnapshotUri_RES * p_res); +HT_API BOOL onvif_tr2_StartMulticastStreaming(ONVIF_DEVICE * p_dev, tr2_StartMulticastStreaming_REQ * p_req, tr2_StartMulticastStreaming_RES * p_res); +HT_API BOOL onvif_tr2_StopMulticastStreaming(ONVIF_DEVICE * p_dev, tr2_StopMulticastStreaming_REQ * p_req, tr2_StopMulticastStreaming_RES * p_res); +HT_API BOOL onvif_tr2_GetVideoSourceModes(ONVIF_DEVICE * p_dev, tr2_GetVideoSourceModes_REQ * p_req, tr2_GetVideoSourceModes_RES * p_res); +HT_API BOOL onvif_tr2_SetVideoSourceMode(ONVIF_DEVICE * p_dev, tr2_SetVideoSourceMode_REQ * p_req, tr2_SetVideoSourceMode_RES * p_res); +HT_API BOOL onvif_tr2_CreateOSD(ONVIF_DEVICE * p_dev, tr2_CreateOSD_REQ * p_req, tr2_CreateOSD_RES * p_res); +HT_API BOOL onvif_tr2_DeleteOSD(ONVIF_DEVICE * p_dev, tr2_DeleteOSD_REQ * p_req, tr2_DeleteOSD_RES * p_res); +HT_API BOOL onvif_tr2_GetOSDs(ONVIF_DEVICE * p_dev, tr2_GetOSDs_REQ * p_req, tr2_GetOSDs_RES * p_res); +HT_API BOOL onvif_tr2_SetOSD(ONVIF_DEVICE * p_dev, tr2_SetOSD_REQ * p_req, tr2_SetOSD_RES * p_res); +HT_API BOOL onvif_tr2_GetOSDOptions(ONVIF_DEVICE * p_dev, tr2_GetOSDOptions_REQ * p_req, tr2_GetOSDOptions_RES * p_res); +HT_API BOOL onvif_tr2_GetAnalyticsConfigurations(ONVIF_DEVICE * p_dev, tr2_GetAnalyticsConfigurations_REQ * p_req, tr2_GetAnalyticsConfigurations_RES * p_res); +HT_API BOOL onvif_tr2_GetMasks(ONVIF_DEVICE * p_dev, tr2_GetMasks_REQ * p_req, tr2_GetMasks_RES * p_res); +HT_API BOOL onvif_tr2_SetMask(ONVIF_DEVICE * p_dev, tr2_SetMask_REQ * p_req, tr2_SetMask_RES * p_res); +HT_API BOOL onvif_tr2_CreateMask(ONVIF_DEVICE * p_dev, tr2_CreateMask_REQ * p_req, tr2_CreateMask_RES * p_res); +HT_API BOOL onvif_tr2_DeleteMask(ONVIF_DEVICE * p_dev, tr2_DeleteMask_REQ * p_req, tr2_DeleteMask_RES * p_res); +HT_API BOOL onvif_tr2_GetMaskOptions(ONVIF_DEVICE * p_dev, tr2_GetMaskOptions_REQ * p_req, tr2_GetMaskOptions_RES * p_res); + +// access control service interfaces +HT_API BOOL onvif_tac_GetServiceCapabilities(ONVIF_DEVICE * p_dev, tac_GetServiceCapabilities_REQ * p_req, tac_GetServiceCapabilities_RES * p_res); +HT_API BOOL onvif_tac_GetAccessPointInfoList(ONVIF_DEVICE * p_dev, tac_GetAccessPointInfoList_REQ * p_req, tac_GetAccessPointInfoList_RES * p_res); +HT_API BOOL onvif_tac_GetAccessPointInfo(ONVIF_DEVICE * p_dev, tac_GetAccessPointInfo_REQ * p_req, tac_GetAccessPointInfo_RES * p_res); +HT_API BOOL onvif_tac_GetAccessPointList(ONVIF_DEVICE * p_dev, tac_GetAccessPointList_REQ * p_req, tac_GetAccessPointList_RES * p_res); +HT_API BOOL onvif_tac_GetAccessPoints(ONVIF_DEVICE * p_dev, tac_GetAccessPoints_REQ * p_req, tac_GetAccessPoints_RES * p_res); +HT_API BOOL onvif_tac_CreateAccessPoint(ONVIF_DEVICE * p_dev, tac_CreateAccessPoint_REQ * p_req, tac_CreateAccessPoint_RES * p_res); +HT_API BOOL onvif_tac_SetAccessPoint(ONVIF_DEVICE * p_dev, tac_SetAccessPoint_REQ * p_req, tac_SetAccessPoint_RES * p_res); +HT_API BOOL onvif_tac_ModifyAccessPoint(ONVIF_DEVICE * p_dev, tac_ModifyAccessPoint_REQ * p_req, tac_ModifyAccessPoint_RES * p_res); +HT_API BOOL onvif_tac_DeleteAccessPoint(ONVIF_DEVICE * p_dev, tac_DeleteAccessPoint_REQ * p_req, tac_DeleteAccessPoint_RES * p_res); +HT_API BOOL onvif_tac_GetAreaInfoList(ONVIF_DEVICE * p_dev, tac_GetAreaInfoList_REQ * p_req, tac_GetAreaInfoList_RES * p_res); +HT_API BOOL onvif_tac_GetAreaInfo(ONVIF_DEVICE * p_dev, tac_GetAreaInfo_REQ * p_req, tac_GetAreaInfo_RES * p_res); +HT_API BOOL onvif_tac_GetAreaList(ONVIF_DEVICE * p_dev, tac_GetAreaList_REQ * p_req, tac_GetAreaList_RES * p_res); +HT_API BOOL onvif_tac_GetAreas(ONVIF_DEVICE * p_dev, tac_GetAreas_REQ * p_req, tac_GetAreas_RES * p_res); +HT_API BOOL onvif_tac_CreateArea(ONVIF_DEVICE * p_dev, tac_CreateArea_REQ * p_req, tac_CreateArea_RES * p_res); +HT_API BOOL onvif_tac_SetArea(ONVIF_DEVICE * p_dev, tac_SetArea_REQ * p_req, tac_SetArea_RES * p_res); +HT_API BOOL onvif_tac_ModifyArea(ONVIF_DEVICE * p_dev, tac_ModifyArea_REQ * p_req, tac_ModifyArea_RES * p_res); +HT_API BOOL onvif_tac_DeleteArea(ONVIF_DEVICE * p_dev, tac_DeleteArea_REQ * p_req, tac_DeleteArea_RES * p_res); +HT_API BOOL onvif_tac_GetAccessPointState(ONVIF_DEVICE * p_dev, tac_GetAccessPointState_REQ * p_req, tac_GetAccessPointState_RES * p_res); +HT_API BOOL onvif_tac_EnableAccessPoint(ONVIF_DEVICE * p_dev, tac_EnableAccessPoint_REQ * p_req, tac_EnableAccessPoint_RES * p_res); +HT_API BOOL onvif_tac_DisableAccessPoint(ONVIF_DEVICE * p_dev, tac_DisableAccessPoint_REQ * p_req, tac_DisableAccessPoint_RES * p_res); + +// door control service interfaces +HT_API BOOL onvif_tdc_GetServiceCapabilities(ONVIF_DEVICE * p_dev, tdc_GetServiceCapabilities_REQ * p_req, tdc_GetServiceCapabilities_RES * p_res); +HT_API BOOL onvif_tdc_GetDoorInfoList(ONVIF_DEVICE * p_dev, tdc_GetDoorInfoList_REQ * p_req, tdc_GetDoorInfoList_RES * p_res); +HT_API BOOL onvif_tdc_GetDoorInfo(ONVIF_DEVICE * p_dev, tdc_GetDoorInfo_REQ * p_req, tdc_GetDoorInfo_RES * p_res); +HT_API BOOL onvif_tdc_GetDoorState(ONVIF_DEVICE * p_dev, tdc_GetDoorState_REQ * p_req, tdc_GetDoorState_RES * p_res); +HT_API BOOL onvif_tdc_AccessDoor(ONVIF_DEVICE * p_dev, tdc_AccessDoor_REQ * p_req, tdc_AccessDoor_RES * p_res); +HT_API BOOL onvif_tdc_LockDoor(ONVIF_DEVICE * p_dev, tdc_LockDoor_REQ * p_req, tdc_LockDoor_RES * p_res); +HT_API BOOL onvif_tdc_UnlockDoor(ONVIF_DEVICE * p_dev, tdc_UnlockDoor_REQ * p_req, tdc_UnlockDoor_RES * p_res); +HT_API BOOL onvif_tdc_DoubleLockDoor(ONVIF_DEVICE * p_dev, tdc_DoubleLockDoor_REQ * p_req, tdc_DoubleLockDoor_RES * p_res); +HT_API BOOL onvif_tdc_BlockDoor(ONVIF_DEVICE * p_dev, tdc_BlockDoor_REQ * p_req, tdc_BlockDoor_RES * p_res); +HT_API BOOL onvif_tdc_LockDownDoor(ONVIF_DEVICE * p_dev, tdc_LockDownDoor_REQ * p_req, tdc_LockDownDoor_RES * p_res); +HT_API BOOL onvif_tdc_LockDownReleaseDoor(ONVIF_DEVICE * p_dev, tdc_LockDownReleaseDoor_REQ * p_req, tdc_LockDownReleaseDoor_RES * p_res); +HT_API BOOL onvif_tdc_LockOpenDoor(ONVIF_DEVICE * p_dev, tdc_LockOpenDoor_REQ * p_req, tdc_LockOpenDoor_RES * p_res); +HT_API BOOL onvif_tdc_LockOpenReleaseDoor(ONVIF_DEVICE * p_dev, tdc_LockOpenReleaseDoor_REQ * p_req, tdc_LockOpenReleaseDoor_RES * p_res); +HT_API BOOL onvif_tdc_GetDoors(ONVIF_DEVICE * p_dev, tdc_GetDoors_REQ * p_req, tdc_GetDoors_RES * p_res); +HT_API BOOL onvif_tdc_GetDoorList(ONVIF_DEVICE * p_dev, tdc_GetDoorList_REQ * p_req, tdc_GetDoorList_RES * p_res); +HT_API BOOL onvif_tdc_CreateDoor(ONVIF_DEVICE * p_dev, tdc_CreateDoor_REQ * p_req, tdc_CreateDoor_RES * p_res); +HT_API BOOL onvif_tdc_SetDoor(ONVIF_DEVICE * p_dev, tdc_SetDoor_REQ * p_req, tdc_SetDoor_RES * p_res); +HT_API BOOL onvif_tdc_ModifyDoor(ONVIF_DEVICE * p_dev, tdc_ModifyDoor_REQ * p_req, tdc_ModifyDoor_RES * p_res); +HT_API BOOL onvif_tdc_DeleteDoor(ONVIF_DEVICE * p_dev, tdc_DeleteDoor_REQ * p_req, tdc_DeleteDoor_RES * p_res); + +// thermal service interfaces +HT_API BOOL onvif_tth_GetServiceCapabilities(ONVIF_DEVICE * p_dev, tth_GetServiceCapabilities_REQ * p_req, tth_GetServiceCapabilities_RES * p_res); +HT_API BOOL onvif_tth_GetConfigurations(ONVIF_DEVICE * p_dev, tth_GetConfigurations_REQ * p_req, tth_GetConfigurations_RES * p_res); +HT_API BOOL onvif_tth_GetConfiguration(ONVIF_DEVICE * p_dev, tth_GetConfiguration_REQ * p_req, tth_GetConfiguration_RES * p_res); +HT_API BOOL onvif_tth_SetConfiguration(ONVIF_DEVICE * p_dev, tth_SetConfiguration_REQ * p_req, tth_SetConfiguration_RES * p_res); +HT_API BOOL onvif_tth_GetConfigurationOptions(ONVIF_DEVICE * p_dev, tth_GetConfigurationOptions_REQ * p_req, tth_GetConfigurationOptions_RES * p_res); +HT_API BOOL onvif_tth_GetRadiometryConfiguration(ONVIF_DEVICE * p_dev, tth_GetRadiometryConfiguration_REQ * p_req, tth_GetRadiometryConfiguration_RES * p_res); +HT_API BOOL onvif_tth_SetRadiometryConfiguration(ONVIF_DEVICE * p_dev, tth_SetRadiometryConfiguration_REQ * p_req, tth_SetRadiometryConfiguration_RES * p_res); +HT_API BOOL onvif_tth_GetRadiometryConfigurationOptions(ONVIF_DEVICE * p_dev, tth_GetRadiometryConfigurationOptions_REQ * p_req, tth_GetRadiometryConfigurationOptions_RES * p_res); + +// credential service interfaces +HT_API BOOL onvif_tcr_GetServiceCapabilities(ONVIF_DEVICE * p_dev, tcr_GetServiceCapabilities_REQ * p_req, tcr_GetServiceCapabilities_RES * p_res); +HT_API BOOL onvif_tcr_GetCredentialInfo(ONVIF_DEVICE * p_dev, tcr_GetCredentialInfo_REQ * p_req, tcr_GetCredentialInfo_RES * p_res); +HT_API BOOL onvif_tcr_GetCredentialInfoList(ONVIF_DEVICE * p_dev, tcr_GetCredentialInfoList_REQ * p_req, tcr_GetCredentialInfoList_RES * p_res); +HT_API BOOL onvif_tcr_GetCredentials(ONVIF_DEVICE * p_dev, tcr_GetCredentials_REQ * p_req, tcr_GetCredentials_RES * p_res); +HT_API BOOL onvif_tcr_GetCredentialList(ONVIF_DEVICE * p_dev, tcr_GetCredentialList_REQ * p_req, tcr_GetCredentialList_RES * p_res); +HT_API BOOL onvif_tcr_CreateCredential(ONVIF_DEVICE * p_dev, tcr_CreateCredential_REQ * p_req, tcr_CreateCredential_RES * p_res); +HT_API BOOL onvif_tcr_ModifyCredential(ONVIF_DEVICE * p_dev, tcr_ModifyCredential_REQ * p_req, tcr_ModifyCredential_RES * p_res); +HT_API BOOL onvif_tcr_DeleteCredential(ONVIF_DEVICE * p_dev, tcr_DeleteCredential_REQ * p_req, tcr_DeleteCredential_RES * p_res); +HT_API BOOL onvif_tcr_GetCredentialState(ONVIF_DEVICE * p_dev, tcr_GetCredentialState_REQ * p_req, tcr_GetCredentialState_RES * p_res); +HT_API BOOL onvif_tcr_EnableCredential(ONVIF_DEVICE * p_dev, tcr_EnableCredential_REQ * p_req, tcr_EnableCredential_RES * p_res); +HT_API BOOL onvif_tcr_DisableCredential(ONVIF_DEVICE * p_dev, tcr_DisableCredential_REQ * p_req, tcr_DisableCredential_RES * p_res); +HT_API BOOL onvif_tcr_ResetAntipassbackViolation(ONVIF_DEVICE * p_dev, tcr_ResetAntipassbackViolation_REQ * p_req, tcr_ResetAntipassbackViolation_RES * p_res); +HT_API BOOL onvif_tcr_GetSupportedFormatTypes(ONVIF_DEVICE * p_dev, tcr_GetSupportedFormatTypes_REQ * p_req, tcr_GetSupportedFormatTypes_RES * p_res); +HT_API BOOL onvif_tcr_GetCredentialIdentifiers(ONVIF_DEVICE * p_dev, tcr_GetCredentialIdentifiers_REQ * p_req, tcr_GetCredentialIdentifiers_RES * p_res); +HT_API BOOL onvif_tcr_SetCredentialIdentifier(ONVIF_DEVICE * p_dev, tcr_SetCredentialIdentifier_REQ * p_req, tcr_SetCredentialIdentifier_RES * p_res); +HT_API BOOL onvif_tcr_DeleteCredentialIdentifier(ONVIF_DEVICE * p_dev, tcr_DeleteCredentialIdentifier_REQ * p_req, tcr_DeleteCredentialIdentifier_RES * p_res); +HT_API BOOL onvif_tcr_GetCredentialAccessProfiles(ONVIF_DEVICE * p_dev, tcr_GetCredentialAccessProfiles_REQ * p_req, tcr_GetCredentialAccessProfiles_RES * p_res); +HT_API BOOL onvif_tcr_SetCredentialAccessProfiles(ONVIF_DEVICE * p_dev, tcr_SetCredentialAccessProfiles_REQ * p_req, tcr_SetCredentialAccessProfiles_RES * p_res); +HT_API BOOL onvif_tcr_DeleteCredentialAccessProfiles(ONVIF_DEVICE * p_dev, tcr_DeleteCredentialAccessProfiles_REQ * p_req, tcr_DeleteCredentialAccessProfiles_RES * p_res); + +// access rules service interfaces +HT_API BOOL onvif_tar_GetServiceCapabilities(ONVIF_DEVICE * p_dev, tar_GetServiceCapabilities_REQ * p_req, tar_GetServiceCapabilities_RES * p_res); +HT_API BOOL onvif_tar_GetAccessProfileInfo(ONVIF_DEVICE * p_dev, tar_GetAccessProfileInfo_REQ * p_req, tar_GetAccessProfileInfo_RES * p_res); +HT_API BOOL onvif_tar_GetAccessProfileInfoList(ONVIF_DEVICE * p_dev, tar_GetAccessProfileInfoList_REQ * p_req, tar_GetAccessProfileInfoList_RES * p_res); +HT_API BOOL onvif_tar_GetAccessProfiles(ONVIF_DEVICE * p_dev, tar_GetAccessProfiles_REQ * p_req, tar_GetAccessProfiles_RES * p_res); +HT_API BOOL onvif_tar_GetAccessProfileList(ONVIF_DEVICE * p_dev, tar_GetAccessProfileList_REQ * p_req, tar_GetAccessProfileList_RES * p_res); +HT_API BOOL onvif_tar_CreateAccessProfile(ONVIF_DEVICE * p_dev, tar_CreateAccessProfile_REQ * p_req, tar_CreateAccessProfile_RES * p_res); +HT_API BOOL onvif_tar_ModifyAccessProfile(ONVIF_DEVICE * p_dev, tar_ModifyAccessProfile_REQ * p_req, tar_ModifyAccessProfile_RES * p_res); +HT_API BOOL onvif_tar_DeleteAccessProfile(ONVIF_DEVICE * p_dev, tar_DeleteAccessProfile_REQ * p_req, tar_DeleteAccessProfile_RES * p_res); + +// schedule service interface +HT_API BOOL onvif_tsc_GetServiceCapabilities(ONVIF_DEVICE * p_dev, tsc_GetServiceCapabilities_REQ * p_req, tsc_GetServiceCapabilities_RES * p_res); +HT_API BOOL onvif_tsc_GetScheduleInfo(ONVIF_DEVICE * p_dev, tsc_GetScheduleInfo_REQ * p_req, tsc_GetScheduleInfo_RES * p_res); +HT_API BOOL onvif_tsc_GetScheduleInfoList(ONVIF_DEVICE * p_dev, tsc_GetScheduleInfoList_REQ * p_req, tsc_GetScheduleInfoList_RES * p_res); +HT_API BOOL onvif_tsc_GetSchedules(ONVIF_DEVICE * p_dev, tsc_GetSchedules_REQ * p_req, tsc_GetSchedules_RES * p_res); +HT_API BOOL onvif_tsc_GetScheduleList(ONVIF_DEVICE * p_dev, tsc_GetScheduleList_REQ * p_req, tsc_GetScheduleList_RES * p_res); +HT_API BOOL onvif_tsc_CreateSchedule(ONVIF_DEVICE * p_dev, tsc_CreateSchedule_REQ * p_req, tsc_CreateSchedule_RES * p_res); +HT_API BOOL onvif_tsc_ModifySchedule(ONVIF_DEVICE * p_dev, tsc_ModifySchedule_REQ * p_req, tsc_ModifySchedule_RES * p_res); +HT_API BOOL onvif_tsc_DeleteSchedule(ONVIF_DEVICE * p_dev, tsc_DeleteSchedule_REQ * p_req, tsc_DeleteSchedule_RES * p_res); +HT_API BOOL onvif_tsc_GetSpecialDayGroupInfo(ONVIF_DEVICE * p_dev, tsc_GetSpecialDayGroupInfo_REQ * p_req, tsc_GetSpecialDayGroupInfo_RES * p_res); +HT_API BOOL onvif_tsc_GetSpecialDayGroupInfoList(ONVIF_DEVICE * p_dev, tsc_GetSpecialDayGroupInfoList_REQ * p_req, tsc_GetSpecialDayGroupInfoList_RES * p_res); +HT_API BOOL onvif_tsc_GetSpecialDayGroups(ONVIF_DEVICE * p_dev, tsc_GetSpecialDayGroups_REQ * p_req, tsc_GetSpecialDayGroups_RES * p_res); +HT_API BOOL onvif_tsc_GetSpecialDayGroupList(ONVIF_DEVICE * p_dev, tsc_GetSpecialDayGroupList_REQ * p_req, tsc_GetSpecialDayGroupList_RES * p_res); +HT_API BOOL onvif_tsc_CreateSpecialDayGroup(ONVIF_DEVICE * p_dev, tsc_CreateSpecialDayGroup_REQ * p_req, tsc_CreateSpecialDayGroup_RES * p_res); +HT_API BOOL onvif_tsc_ModifySpecialDayGroup(ONVIF_DEVICE * p_dev, tsc_ModifySpecialDayGroup_REQ * p_req, tsc_ModifySpecialDayGroup_RES * p_res); +HT_API BOOL onvif_tsc_DeleteSpecialDayGroup(ONVIF_DEVICE * p_dev, tsc_DeleteSpecialDayGroup_REQ * p_req, tsc_DeleteSpecialDayGroup_RES * p_res); +HT_API BOOL onvif_tsc_GetScheduleState(ONVIF_DEVICE * p_dev, tsc_GetScheduleState_REQ * p_req, tsc_GetScheduleState_RES * p_res); + +// receiver service interfaces +HT_API BOOL onvif_trv_GetServiceCapabilities(ONVIF_DEVICE * p_dev, trv_GetServiceCapabilities_REQ * p_req, trv_GetServiceCapabilities_RES * p_res); +HT_API BOOL onvif_trv_GetReceivers(ONVIF_DEVICE * p_dev, trv_GetReceivers_REQ * p_req, trv_GetReceivers_RES * p_res); +HT_API BOOL onvif_trv_GetReceiver(ONVIF_DEVICE * p_dev, trv_GetReceiver_REQ * p_req, trv_GetReceiver_RES * p_res); +HT_API BOOL onvif_trv_CreateReceiver(ONVIF_DEVICE * p_dev, trv_CreateReceiver_REQ * p_req, trv_CreateReceiver_RES * p_res); +HT_API BOOL onvif_trv_DeleteReceiver(ONVIF_DEVICE * p_dev, trv_DeleteReceiver_REQ * p_req, trv_DeleteReceiver_RES * p_res); +HT_API BOOL onvif_trv_ConfigureReceiver(ONVIF_DEVICE * p_dev, trv_ConfigureReceiver_REQ * p_req, trv_ConfigureReceiver_RES * p_res); +HT_API BOOL onvif_trv_SetReceiverMode(ONVIF_DEVICE * p_dev, trv_SetReceiverMode_REQ * p_req, trv_SetReceiverMode_RES * p_res); +HT_API BOOL onvif_trv_GetReceiverState(ONVIF_DEVICE * p_dev, trv_GetReceiverState_REQ * p_req, trv_GetReceiverState_RES * p_res); + +// provisioning interfaces +HT_API BOOL onvif_tpv_GetServiceCapabilities(ONVIF_DEVICE * p_dev, tpv_GetServiceCapabilities_REQ * p_req, tpv_GetServiceCapabilities_RES * p_res); +HT_API BOOL onvif_tpv_PanMove(ONVIF_DEVICE * p_dev, tpv_PanMove_REQ * p_req, tpv_PanMove_RES * p_res); +HT_API BOOL onvif_tpv_TiltMove(ONVIF_DEVICE * p_dev, tpv_TiltMove_REQ * p_req, tpv_TiltMove_RES * p_res); +HT_API BOOL onvif_tpv_ZoomMove(ONVIF_DEVICE * p_dev, tpv_ZoomMove_REQ * p_req, tpv_ZoomMove_RES * p_res); +HT_API BOOL onvif_tpv_RollMove(ONVIF_DEVICE * p_dev, tpv_RollMove_REQ * p_req, tpv_RollMove_RES * p_res); +HT_API BOOL onvif_tpv_FocusMove(ONVIF_DEVICE * p_dev, tpv_FocusMove_REQ * p_req, tpv_FocusMove_RES * p_res); +HT_API BOOL onvif_tpv_Stop(ONVIF_DEVICE * p_dev, tpv_Stop_REQ * p_req, tpv_Stop_RES * p_res); +HT_API BOOL onvif_tpv_GetUsage(ONVIF_DEVICE * p_dev, tpv_GetUsage_REQ * p_req, tpv_GetUsage_RES * p_res); + + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/ONVIF/include/onvif/onvif_cm.h b/ONVIF/include/onvif/onvif_cm.h new file mode 100644 index 0000000..ed7b78a --- /dev/null +++ b/ONVIF/include/onvif/onvif_cm.h @@ -0,0 +1,5227 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef ONVIF_COMM_H +#define ONVIF_COMM_H + +/***************************************************************************************/ +#define ONVIF_TOKEN_LEN 100 +#define ONVIF_NAME_LEN 100 +#define ONVIF_URI_LEN 300 +#define ONVIF_SCOPE_LEN 128 + +#define MAX_PTZ_PRESETS 100 +#define MAX_DNS_SERVER 2 +#define MAX_SEARCHDOMAIN 4 +#define MAX_NTP_SERVER 2 +#define MAX_SERVER_PORT 4 +#define MAX_GATEWAY 2 +#define MAX_RES_NUMS 32 +#define MAX_SCOPE_NUMS 100 +#define MAX_USERS 10 +#define MAX_IP_ADDRS 4 + +/* Floating point precision */ +#define FPP 0.01 + +#define ACCESS_CTRL_MAX_LIMIT 10 +#define DOOR_CTRL_MAX_LIMIT 10 +#define CREDENTIAL_MAX_LIMIT 10 +#define ACCESSRULES_MAX_LIMIT 10 +#define SCHEDULE_MAX_LIMIT 10 + +/***************************************************************************************/ +typedef enum +{ + ONVIF_OK = 0, + ONVIF_ERR_ConnFailure = -1, // Connection failed + ONVIF_ERR_MallocFailure = -2, // Failed to allocate memory + ONVIF_ERR_NotSupportHttps = -3, // The device requires an HTTPS connection, but the onvif client library does not support it (the HTTPS compilation macro is not enabled) + ONVIF_ERR_RecvTimeout = -4, // Message receiving timeout + ONVIF_ERR_InvalidContentType = -5, // Device response message content is invalid + ONVIF_ERR_NullContent = -6, // Device response message has no content + ONVIF_ERR_ParseFailed = -7, // Parsing the message failed + ONVIF_ERR_HandleFailed = -8, // Message handling failed + ONVIF_ERR_HttpResponseError = -9, // The device responded with an error message +} ONVIF_RET; + +typedef enum +{ + AuthMethod_HttpDigest = 0, // Http digest auth method + AuthMethod_UsernameToken = 1 // Username Token auth method +} onvif_AuthMethod; + +/***************************************************************************************/ + +typedef enum +{ + CapabilityCategory_Invalid = -1, + CapabilityCategory_All = 0, + CapabilityCategory_Analytics = 1, + CapabilityCategory_Device = 2, + CapabilityCategory_Events = 3, + CapabilityCategory_Imaging = 4, + CapabilityCategory_Media = 5, + CapabilityCategory_PTZ = 6, + CapabilityCategory_Recording = 7, + CapabilityCategory_Search = 8, + CapabilityCategory_Replay = 9, + CapabilityCategory_AccessControl = 10, + CapabilityCategory_DoorControl = 11, + CapabilityCategory_DeviceIO = 12, + CapabilityCategory_Media2 = 13, + CapabilityCategory_Thermal = 14, + CapabilityCategory_Credential = 15, + CapabilityCategory_AccessRules = 16, + CapabilityCategory_Schedule = 17, + CapabilityCategory_Receiver = 18, + CapabilityCategory_Provisioning = 19, +} onvif_CapabilityCategory; + +typedef enum +{ + FactoryDefaultType_Hard = 0, // Indicates that a hard factory default is requested + FactoryDefaultType_Soft = 1 // Indicates that a soft factory default is requested +} onvif_FactoryDefaultType; + +typedef enum +{ + SystemLogType_System = 0, // Indicates that a system log is requested + SystemLogType_Access = 1 // Indicates that a access log is requested +} onvif_SystemLogType; + +typedef enum +{ + VideoEncoding_Unknown = -1, + VideoEncoding_JPEG = 0, + VideoEncoding_MPEG4 = 1, + VideoEncoding_H264 = 2 +} onvif_VideoEncoding; + +typedef enum +{ + AudioEncoding_Unknown = -1, + AudioEncoding_G711 = 0, + AudioEncoding_G726 = 1, + AudioEncoding_AAC = 2 +} onvif_AudioEncoding; + +typedef enum H264Profile +{ + H264Profile_Baseline = 0, + H264Profile_Main = 1, + H264Profile_Extended = 2, + H264Profile_High = 3 +} onvif_H264Profile; + +typedef enum +{ + Mpeg4Profile_SP = 0, + Mpeg4Profile_ASP = 1 +} onvif_Mpeg4Profile; + +typedef enum +{ + UserLevel_Administrator = 0, + UserLevel_Operator = 1, + UserLevel_User = 2, + UserLevel_Anonymous = 3, + UserLevel_Extended = 4 +} onvif_UserLevel; + +typedef enum +{ + IPAddressFilterType_Allow = 0, + IPAddressFilterType_Deny = 1 +} onvif_IPAddressFilterType; + +typedef enum MoveStatus +{ + MoveStatus_IDLE = 0, + MoveStatus_MOVING = 1, + MoveStatus_UNKNOWN = 2 +} onvif_MoveStatus; + +// OSD type +typedef enum +{ + OSDType_Text = 0, + OSDType_Image = 1, + OSDType_Extended =2 +} onvif_OSDType; + +// OSD position type +typedef enum +{ + OSDPosType_UpperLeft = 0, + OSDPosType_UpperRight = 1, + OSDPosType_LowerLeft = 2, + OSDPosType_LowerRight = 3, + OSDPosType_Custom = 4 +} onvif_OSDPosType; + +typedef enum +{ + OSDTextType_Plain, // The Plain type means the OSD is shown as a text string which defined in the "PlainText" item + OSDTextType_Date, // The Date type means the OSD is shown as a date, format of which should be present in the "DateFormat" item + OSDTextType_Time, // The Time type means the OSD is shown as a time, format of which should be present in the "TimeFormat" item + OSDTextType_DateAndTime, // The DateAndTime type means the OSD is shown as date and time, format of which should be present in the "DateFormat" and the "TimeFormat" item +} onvif_OSDTextType; + +// BacklightCompensation mode +typedef enum +{ + BacklightCompensationMode_OFF = 0, // Backlight compensation is disabled + BacklightCompensationMode_ON = 1 // Backlight compensation is enabled +} onvif_BacklightCompensationMode; + +// Exposure mode +typedef enum +{ + ExposureMode_AUTO = 0, + ExposureMode_MANUAL = 1 +} onvif_ExposureMode; + +// Exposure Priority +typedef enum +{ + ExposurePriority_LowNoise = 0, + ExposurePriority_FrameRate = 1 +} onvif_ExposurePriority; + +// AutoFocus Mode +typedef enum +{ + AutoFocusMode_AUTO = 0, + AutoFocusMode_MANUAL = 1 +} onvif_AutoFocusMode; + +typedef enum +{ + WideDynamicMode_OFF = 0, + WideDynamicMode_ON = 1 +} onvif_WideDynamicMode; + +typedef enum +{ + IrCutFilterMode_ON = 0, + IrCutFilterMode_OFF = 1, + IrCutFilterMode_AUTO = 2 +} onvif_IrCutFilterMode; + +typedef enum WhiteBalanceMode +{ + WhiteBalanceMode_AUTO = 0, + WhiteBalanceMode_MANUAL = 1 +} onvif_WhiteBalanceMode; + +typedef enum onvif_EFlipMode +{ + EFlipMode_OFF = 0, + EFlipMode_ON = 1, + EFlipMode_Extended = 2 +} onvif_EFlipMode; + +typedef enum +{ + ReverseMode_OFF = 0, + ReverseMode_ON = 1, + ReverseMode_AUTO = 2, + ReverseMode_Extended = 3 +} onvif_ReverseMode; + +typedef enum +{ + DiscoveryMode_Discoverable = 0, + DiscoveryMode_NonDiscoverable = 1 +} onvif_DiscoveryMode; + +typedef enum +{ + SetDateTimeType_Manual = 0, // Indicates that the date and time are set manually + SetDateTimeType_NTP = 1 // Indicates that the date and time are set through NTP +} onvif_SetDateTimeType; + +typedef enum +{ + StreamType_Invalid = -1, + StreamType_RTP_Unicast = 0, + StreamType_RTP_Multicast = 1 +} onvif_StreamType; + +typedef enum +{ + TransportProtocol_Invalid = -1, + TransportProtocol_UDP = 0, + TransportProtocol_TCP = 1, + TransportProtocol_RTSP = 2, + TransportProtocol_HTTP = 3 +} onvif_TransportProtocol; + +typedef enum +{ + TrackType_Invalid = -1, + TrackType_Video = 0, + TrackType_Audio = 1, + TrackType_Metadata = 2, + TrackType_Extended = 3 +} onvif_TrackType; + +typedef enum +{ + DynamicDNSType_NoUpdate = 0, + DynamicDNSType_ClientUpdates = 1, + DynamicDNSType_ServerUpdates = 2 +} onvif_DynamicDNSType; + +typedef enum +{ + PropertyOperation_Invalid = -1, + PropertyOperation_Initialized = 0, + PropertyOperation_Deleted = 1, + PropertyOperation_Changed = 2 +} onvif_PropertyOperation; + +typedef enum +{ + RecordingStatus_Initiated = 0, + RecordingStatus_Recording = 1, + RecordingStatus_Stopped = 2, + RecordingStatus_Removing = 3, + RecordingStatus_Removed = 4, + RecordingStatus_Unknown = 5 +} onvif_RecordingStatus; + +typedef enum +{ + SearchState_Queued = 0, // The search is queued and not yet started. + SearchState_Searching = 1, // The search is underway and not yet completed + SearchState_Completed = 2, // The search has been completed and no new results will be found + SearchState_Unknown = 3 // The state of the search is unknown. (This is not a valid response from GetSearchState.) +} onvif_SearchState; + +typedef enum +{ + RotateMode_OFF = 0, // Enable the Rotate feature. Degree of rotation is specified Degree parameter + RotateMode_ON = 1, // Disable the Rotate feature + RotateMode_AUTO = 2 // Rotate feature is automatically activated by the device +} onvif_RotateMode; + +typedef enum +{ + ScopeDefinition_Fixed = 0, + ScopeDefinition_Configurable = 1 +} onvif_ScopeDefinition; + +// The physical state of a Door +typedef enum +{ + DoorPhysicalState_Unknown = 0, // Value is currently unknown (possibly due to initialization or monitors not giving a conclusive result) + DoorPhysicalState_Open = 1, // Door is open + DoorPhysicalState_Closed = 2, // Door is closed + DoorPhysicalState_Fault = 3 // Door monitor fault is detected +} onvif_DoorPhysicalState; + +// The physical state of a Lock (including Double Lock) +typedef enum +{ + LockPhysicalState_Unknown = 0, // Value is currently not known + LockPhysicalState_Locked = 1, // Lock is activated + LockPhysicalState_Unlocked = 2, // Lock is not activated + LockPhysicalState_Fault = 3 // Lock fault is detected +} onvif_LockPhysicalState; + +// Describes the state of a Door with regard to alarms +typedef enum +{ + DoorAlarmState_Normal = 0, // No alarm + DoorAlarmState_DoorForcedOpen = 1, // Door is forced open + DoorAlarmState_DoorOpenTooLong = 2 // Door is held open too long +} onvif_DoorAlarmState; + +// Describes the state of a Tamper detector +typedef enum +{ + DoorTamperState_Unknown = 0, // Value is currently not known + DoorTamperState_NotInTamper = 1, // No tampering is detected + DoorTamperState_TamperDetected = 2 // Tampering is detected +} onvif_DoorTamperState; + +// Describes the state of a Door fault +typedef enum +{ + DoorFaultState_Unknown = 0, // Fault state is unknown + DoorFaultState_NotInFault = 1, // No fault is detected + DoorFaultState_FaultDetected = 2 // Fault is detected +} onvif_DoorFaultState; + +// DoorMode parameters describe current Door mode from a logical perspective +typedef enum +{ + DoorMode_Unknown = 0, // The Door is in an Unknown state + DoorMode_Locked = 1, // The Door is in a Locked state. In this mode the device shall provide momentary access using the AccessDoor method if supported by the Door instance + DoorMode_Unlocked = 2, // The Door is in an Unlocked (Permanent Access) state. Alarms related to door timing operations such as open too long or forced are masked in this mode + DoorMode_Accessed = 3, // The Door is in an Accessed state (momentary/temporary access). Alarms related to timing operations such as "door forced" are masked in this mode + DoorMode_Blocked = 4, // The Door is in a Blocked state (Door is locked, and AccessDoor requests are ignored, i.e., it is not possible for door to go to Accessed state) + DoorMode_LockedDown = 5, // The Door is in a LockedDown state (Door is locked) until released using the LockDownReleaseDoor command. AccessDoor, LockDoor, UnlockDoor, BlockDoor and + // LockOpenDoor requests are ignored, i.e., it is not possible for door to go to Accessed, Locked, Unlocked, Blocked or LockedOpen state + DoorMode_LockedOpen = 6, // The Door is in a LockedOpen state (Door is unlocked) until released using the LockOpenReleaseDoor command. AccessDoor, LockDoor, UnlockDoor, BlockDoor and + // LockDownDoor requests are ignored, i.e., it is not possible for door to go to Accessed, Locked, Unlocked, Blocked or LockedDown state + DoorMode_DoubleLocked = 7 // The Door is in a Double Locked state - for doors with multiple locks. If the door does not have any DoubleLock, this shall be treated as a normal Locked mode. + // When changing to an Unlocked mode from the DoubleLocked mode, the door may first go to Locked state before unlocking +} onvif_DoorMode; + +typedef enum +{ + RelayMode_Monostable = 0, // After setting the state, the relay returns to its idle state after the specified time + RelayMode_Bistable = 1, // After setting the state, the relay remains in this state +} onvif_RelayMode; + +typedef enum +{ + RelayIdleState_closed = 0, // means that the relay is closed when the relay state is set to 'inactive' through the trigger command and open when the state is set to 'active' through the same command + RelayIdleState_open = 1, // means that the relay is open when the relay state is set to 'inactive' through the trigger command and closed when the state is set to 'active' through the same command +} onvif_RelayIdleState; + +typedef enum +{ + RelayLogicalState_active = 0, // + RelayLogicalState_inactive = 1, // +} onvif_RelayLogicalState; + +typedef enum +{ + DigitalIdleState_closed = 0, + DigitalIdleState_open = 1, +} onvif_DigitalIdleState; + +typedef enum +{ + ParityBit_None = 0, + ParityBit_Even = 1, + ParityBit_Odd = 2, + ParityBit_Mark = 3, + ParityBit_Space = 4, + ParityBit_Extended = 5 +} onvif_ParityBit; + +typedef enum +{ + SerialPortType_RS232 = 0, + SerialPortType_RS422HalfDuplex = 1, + SerialPortType_RS422FullDuplex = 2, + SerialPortType_RS485HalfDuplex = 3, + SerialPortType_RS485FullDuplex = 4, + SerialPortType_Generic = 5 +} onvif_SerialPortType; + +typedef enum +{ + PTZPresetTourOperation_Start = 0, + PTZPresetTourOperation_Stop = 1, + PTZPresetTourOperation_Pause = 2, + PTZPresetTourOperation_Extended = 3 +} onvif_PTZPresetTourOperation; + +typedef enum +{ + PTZPresetTourState_Idle = 0, + PTZPresetTourState_Touring = 1, + PTZPresetTourState_Paused = 2, + PTZPresetTourState_Extended = 3 +} onvif_PTZPresetTourState; + +typedef enum +{ + PTZPresetTourDirection_Forward = 0, + PTZPresetTourDirection_Backward = 1, + PTZPresetTourDirection_Extended = 2 +} onvif_PTZPresetTourDirection; + +typedef enum +{ + Dot11AuthAndMangementSuite_None = 0, + Dot11AuthAndMangementSuite_Dot1X = 1, + Dot11AuthAndMangementSuite_PSK = 2, + Dot11AuthAndMangementSuite_Extended = 3 +} onvif_Dot11AuthAndMangementSuite; + +typedef enum +{ + Dot11Cipher_CCMP = 0, + Dot11Cipher_TKIP = 1, + Dot11Cipher_Any = 2, + Dot11Cipher_Extended = 3 +} onvif_Dot11Cipher; + +typedef enum +{ + Dot11SignalStrength_None = 0, + Dot11SignalStrength_VeryBad = 1, + Dot11SignalStrength_Bad = 2, + Dot11SignalStrength_Good = 3, + Dot11SignalStrength_VeryGood = 4, + Dot11SignalStrength_Extended = 5 +} onvif_Dot11SignalStrength; + +typedef enum +{ + Dot11StationMode_Ad_hoc = 0, + Dot11StationMode_Infrastructure = 1, + Dot11StationMode_Extended = 2 +} onvif_Dot11StationMode; + +typedef enum +{ + Dot11SecurityMode_None = 0, + Dot11SecurityMode_WEP = 1, + Dot11SecurityMode_PSK = 2, + Dot11SecurityMode_Dot1X = 3, + Dot11SecurityMode_Extended = 4 +} onvif_Dot11SecurityMode; + +typedef enum +{ + ReceiverMode_AutoConnect = 0, // The receiver connects on demand, as required by consumers of the media streams + ReceiverMode_AlwaysConnect = 1, // The receiver attempts to maintain a persistent connection to the configured endpoint + ReceiverMode_NeverConnect = 2, // The receiver does not attempt to connect + ReceiverMode_Unknown = 3 // This case should never happen +} onvif_ReceiverMode; + +typedef enum +{ + ReceiverState_NotConnected = 0, // The receiver is not connected + ReceiverState_Connecting = 1, // The receiver is attempting to connect + ReceiverState_Connected = 2, // The receiver is connected + ReceiverState_Unknown = 3 // This case should never happen +} onvif_ReceiverState; + +typedef enum +{ + PanDirection_Left = 0, // Move left in relation to the video source image + PanDirection_Right = 1 // Move right in relation to the video source image +} onvif_PanDirection; + +typedef enum +{ + TiltDirection_Up = 0, // Move up in relation to the video source image + TiltDirection_Down = 1 // Move down in relation to the video source image +} onvif_TiltDirection; + +typedef enum +{ + ZoomDirection_Wide = 0, // Move video source lens toward a wider field of view + ZoomDirection_Telephoto = 1 // Move video source lens toward a narrower field of view +} onvif_ZoomDirection; + +typedef enum +{ + RollDirection_Clockwise = 0, // Move clockwise in relation to the video source image + RollDirection_Counterclockwise = 1, // Move counterclockwise in relation to the video source image + RollDirection_Auto = 2 // Automatically level the device in relation to the video source image +} onvif_RollDirection; + +typedef enum +{ + FocusDirection_Near = 0, // Move to focus on close objects + FocusDirection_Far = 1, // Move to focus on distant objects + FocusDirection_Auto = 2 // Automatically focus for the sharpest video source image +} onvif_FocusDirection; + +/***************************************************************************************/ +typedef struct +{ + char Code[128]; + char Subcode[128]; + char Reason[256]; +} onvif_Fault; + +typedef struct +{ + int https; // https connection + int port; // onvif port + char host[128]; // ip of xaddrs + char url[128]; // /onvif/device_service +} onvif_XAddr; + +typedef struct +{ + int Major; // required + int Minor; // required +} onvif_Version; + +typedef struct +{ + float Min; // required + float Max; // required +} onvif_FloatRange; + +typedef struct +{ + uint32 spaceFlag : 1; // Indicates whether the field space is valid + uint32 reserved : 31; + + float x; // required + float y; // required + char space[256]; // optional +} onvif_Vector; + +typedef struct +{ + uint32 sizeItems; + int Items[10]; // optional +} onvif_IntList; + +typedef struct +{ + int sizeItems; + float Items[10]; // optional +} onvif_FloatList; + +typedef struct +{ + int sizeItems; + + onvif_ParityBit Items[10]; // optional +} onvif_ParityBitList; + +/* device capabilities */ +typedef struct +{ + // network capabilities + uint32 IPFilter : 1; // Indicates support for IP filtering + uint32 ZeroConfiguration : 1; // Indicates support for zeroconf + uint32 IPVersion6 : 1; // Indicates support for IPv6 + uint32 DynDNS : 1; // Indicates support for dynamic DNS configuration + uint32 Dot11Configuration : 1; // Indicates support for IEEE 802.11 configuration + uint32 HostnameFromDHCP : 1; // Indicates support for retrieval of hostname from DHCP + uint32 DHCPv6 : 1; // Indicates support for Stateful IPv6 DHCP + + // system capabilities + uint32 DiscoveryResolve : 1; // Indicates support for WS Discovery resolve requests + uint32 DiscoveryBye : 1; // Indicates support for WS-Discovery Bye + uint32 RemoteDiscovery : 1; // Indicates support for remote discovery + uint32 SystemBackup : 1; // Indicates support for system backup through MTOM + uint32 SystemLogging : 1; // Indicates support for retrieval of system logging through MTOM + uint32 FirmwareUpgrade : 1; // Indicates support for firmware upgrade through MTOM + uint32 HttpFirmwareUpgrade : 1; // Indicates support for system backup through MTOM + uint32 HttpSystemBackup : 1; // Indicates support for system backup through HTTP + uint32 HttpSystemLogging : 1; // Indicates support for retrieval of system logging through HTTP + uint32 HttpSupportInformation : 1; // Indicates support for retrieving support information through HTTP + uint32 StorageConfiguration: 1; // Indicates support for storage configuration interfaces + uint32 DiscoveryNotSupported : 1; // Indicates no support for network discovery + uint32 NetworkConfigNotSupported : 1; // Indicates no support for network configuration + uint32 UserConfigNotSupported : 1; // Indicates no support for user configuration + + // scurity capabilities + uint32 TLS10 : 1; // Indicates support for TLS 1.0 + uint32 TLS11 : 1; // Indicates support for TLS 1.1 + uint32 TLS12 : 1; // Indicates support for TLS 1.2 + uint32 OnboardKeyGeneration: 1; // Indicates support for onboard key generation + uint32 AccessPolicyConfig : 1; // Indicates support for access policy configuration + uint32 DefaultAccessPolicy : 1; // Indicates support for the ONVIF default access policy + uint32 Dot1X : 1; // Indicates support for IEEE 802.1X configuration + uint32 RemoteUserHandling : 1; // Indicates support for remote user configuration. Used when accessing another device + uint32 X509Token : 1; // Indicates support for WS-Security X.509 token + uint32 SAMLToken : 1; // Indicates support for WS-Security SAML token + uint32 KerberosToken : 1; // Indicates support for WS-Security Kerberos token + uint32 UsernameToken : 1; // Indicates support for WS-Security Username token + uint32 HttpDigest : 1; // Indicates support for WS over HTTP digest authenticated communication layer + uint32 RELToken : 1; // Indicates support for WS-Security REL token + uint32 JsonWebToken : 1; // Indicates support for JWT-based authentication with WS-Security Binary Security token + uint32 Auxiliary : 1; // Auxiliary commaond + uint32 Reserved : 27; + + // IO + int InputConnectors; // optional, Number of input connectors + int RelayOutputs; // optional, Number of relay outputs + + int Dot1XConfigurations; // Indicates the maximum number of Dot1X configurations supported by the device + int NTP; // Maximum number of NTP servers supported by the devices SetNTP command + + int SupportedEAPMethods; // EAP Methods supported by the device. + // The int values refer to the IANA EAP Registry + int MaxUsers; // The maximum number of users that the device supports + int MaxUserNameLength; // Maximum number of characters supported for the username by CreateUsers + int MaxPasswordLength; // Maximum number of characters supported for the password by CreateUsers and SetUser + char SecurityPolicies[100]; // Indicates which security policies are supported. + // Options are: ModifyPassword (to be extended with: PasswordComplexity, PasswordHistory, AuthFailureWarning) + char HashingAlgorithms[32]; // Supported hashing algorithms as part of HTTP and RTSP Digest authentication.Example: MD5,SHA-256 + + int MaxStorageConfigurations; // Indicates maximum number of storage configurations supported + int GeoLocationEntries; // If present signals support for geo location. The value signals the supported number of entries + char AutoGeo[256]; // List of supported automatic GeoLocation adjustment supported by the device. Valid items are defined by tds:AutoGeoMode + // Location:Automatic adjustment of the device location + // Heading:Automatic adjustment of the device orientation relative to the compass also called yaw + // Leveling:Automatic adjustment of the deviation from the horizon also called pitch and roll + char StorageTypesSupported[256]; // Enumerates the supported StorageTypes, see tds:StorageType: + // NFS,CIFS,CDMI,FTP + char Addons[256]; // List of supported Addons by the device + + // misc capabilities + char AuxiliaryCommands[256]; // Lists of commands supported by SendAuxiliaryCommand + + uint32 sizeSupportedVersions; // number of Supported Versions + onvif_Version SupportedVersions[10]; // Supported Versions + onvif_Version Version; // required + onvif_XAddr XAddr; +} onvif_DevicesCapabilities; + +/* media capabilities */ +typedef struct +{ + uint32 SnapshotUri : 1; // Indicates if GetSnapshotUri is supported + uint32 Rotation : 1; // Indicates whether or not Rotation feature is supported + uint32 VideoSourceMode : 1; // Indicates the support for changing video source mode + uint32 OSD : 1; // Indicates if OSD is supported + uint32 TemporaryOSDText : 1; // Indicates if TemporaryOSDText is supported + uint32 EXICompression : 1; // Indicates the support for the Efficient XML Interchange (EXI) binary XML format + uint32 RTPMulticast : 1; // Indicates support for RTP multicast + uint32 RTP_TCP : 1; // Indicates support for RTP over TCP + uint32 RTP_RTSP_TCP : 1; // Indicates support for RTP/RTSP/TCP + uint32 NonAggregateControl : 1; // Indicates support for non aggregate RTSP control + uint32 NoRTSPStreaming : 1; // Indicates the device does not support live media streaming via RTSP + uint32 support : 1; // Indication if the device supports media service + uint32 reserved : 20; + + int MaximumNumberOfProfiles; // Maximum number of profiles supported + + onvif_Version Version; // required + onvif_XAddr XAddr; +} onvif_MediaCapabilities; + +/* PTZ capabilities */ +typedef struct +{ + uint32 EFlip : 1; // Indicates whether or not EFlip is supported + uint32 Reverse : 1; // Indicates whether or not reversing of PT control direction is supported + uint32 GetCompatibleConfigurations : 1; // Indicates support for the GetCompatibleConfigurations command + uint32 MoveStatus : 1; // Indicates that the PTZVector includes MoveStatus information + uint32 StatusPosition : 1; // Indicates that the PTZVector includes Position information + uint32 support : 1; // Indication if the device supports ptz service + uint32 reserved : 26; + + char MoveAndTrack[64]; // Indication of the methods of MoveAndTrack that are supported, acceptable values are defined in tt:MoveAndTrackMethod + // PresetToken + // GeoLocation + // PTZVector + // ObjectID + + onvif_Version Version; // required + onvif_XAddr XAddr; +} onvif_PTZCapabilities; + +/* event capabilities */ +typedef struct +{ + uint32 WSSubscriptionPolicySupport : 1; // Indicates that the WS Subscription policy is supported + uint32 WSPullPointSupport : 1; // Indicates that the WS Pull Point is supported + uint32 WSPausableSubscriptionManagerInterfaceSupport : 1; // Indicates that the WS Pausable Subscription Manager Interface is supported + uint32 PersistentNotificationStorage : 1; // Indication if the device supports persistent notification storage + uint32 MetadataOverMQTT : 1; // Indicates that metadata streaming over MQTT is supported + uint32 support : 1; // Indication if the device supports events service + uint32 reserved : 26; + + int MaxNotificationProducers; // Maximum number of supported notification producers as defined by WS-BaseNotification + int MaxPullPoints; // Maximum supported number of notification pull points + char EventBrokerProtocols[100]; // A space separated list of supported event broker protocols as defined by the tev:EventBrokerProtocol datatype + // mqtt + // mqtts + // ws + // wss + int MaxEventBrokers; // Maxiumum number of event broker configurations that can be added to the device + + onvif_Version Version; // required + onvif_XAddr XAddr; +} onvif_EventCapabilities; + +/* image capabilities */ +typedef struct +{ + uint32 ImageStabilization : 1; // Indicates whether or not Image Stabilization feature is supported + uint32 Presets : 1; // Indicates whether or not Presets feature is supported + uint32 AdaptablePreset : 1; // Indicates whether or not imaging preset settings can be updated + uint32 support : 1; // Indication if the device supports image service + uint32 reserved : 28; + + onvif_Version Version; // required + onvif_XAddr XAddr; +} onvif_ImagingCapabilities; + +/* analytics capabilities*/ +typedef struct +{ + uint32 RuleSupport : 1; // Indication that the device supports the rules interface and the rules syntax + uint32 AnalyticsModuleSupport : 1; // Indication that the device supports the scene analytics module interface + uint32 CellBasedSceneDescriptionSupported : 1; // Indication that the device produces the cell based scene description + uint32 RuleOptionsSupported: 1; // Indication that the device supports the GetRuleOptions operation on the rules interface + uint32 AnalyticsModuleOptionsSupported : 1; // Indication that the device supports the GetAnalyticsModuleOptions operation on the analytics interface + uint32 SupportedMetadata : 1; // Indication that the device supports the GetSupportedMetadata operation + uint32 support : 1; // Indication if the device supports Analytics service + uint32 reserved : 25; + + char ImageSendingType[100]; // Indication what kinds of method that the device support for sending image + // Embedded, LocalStorage, RemoteStorage + + onvif_Version Version; // required + onvif_XAddr XAddr; +} onvif_AnalyticsCapabilities; + +/* recording capabilities */ +typedef struct +{ + uint32 ReceiverSource : 1; + uint32 MediaProfileSource : 1; + uint32 DynamicRecordings : 1; // Indication if the device supports dynamic creation and deletion of recordings + uint32 DynamicTracks : 1; // Indication if the device supports dynamic creation and deletion of tracks + uint32 Options : 1; // Indication if the device supports the GetRecordingOptions command + uint32 MetadataRecording : 1; // Indication if the device supports recording metadata + uint32 EventRecording : 1; // Indication that the device supports event triggered recording + uint32 JPEG : 1; // Indication if supports JPEG encoding + uint32 MPEG4 : 1; // Indication if supports MPEG4 encoding + uint32 H264 : 1; // Indication if supports H264 encoding + uint32 H265 : 1; // Indication if supports H265 encoding + uint32 G711 : 1; // Indication if supports G711 encoding + uint32 G726 : 1; // Indication if supports G726 encoding + uint32 AAC : 1; // Indication if supports AAC encoding + uint32 SupportedTargetFormatsFlag : 1; // Indicates whether the field SupportedTargetFormats is valid + uint32 EncryptionEntryLimitFlag : 1; // Indicates whether the field EncryptionEntryLimit is valid + uint32 SupportedEncryptionModesFlag : 1; // Indicates whether the field SupportedEncryptionModes is valid + uint32 support : 1; // Indication if the device supports recording service + uint32 reserved : 14; + + uint32 MaxStringLength; + float MaxRate; // optional, Maximum supported bit rate for all tracks of a recording in kBit/s + float MaxTotalRate; // optional, Maximum supported bit rate for all recordings in kBit/s. + int MaxRecordings; // optional, Maximum number of recordings supported. + int MaxRecordingJobs; // optional, Maximum total number of supported recording jobs by the device + char SupportedExportFileFormats[100]; // optional, Indication that the device supports ExportRecordedData command for the listed export file formats. + // The list shall return at least one export file format value. The value of 'ONVIF' refers to + // ONVIF Export File Format specification + int BeforeEventLimit; // optional, If present a device shall support configuring before event durations up to the given value + int AfterEventLimit; // optional, If present a device shall support configuring after event durations up to the given value + char SupportedTargetFormats[32]; // optional, List of formats supported by the device for recording to an external target. See tt:TargetFormat for a list of definitions + // MP4 - MP4 files with all tracks in a single file + // CMAF - CMAF compliant MP4 files with 1 track per file + int EncryptionEntryLimit; // optional, Number of encryption entries supported per recording. + // By specifying multiple encryption entries per recording, + // different tracks can be encrypted with different configurations + char SupportedEncryptionModes[32]; // optional, Indicates supported encryption modes. See tt:EncryptionMode for a list of definitions. + // CENC - AES-CTR mode full sample and video NAL Subsample encryption, defined in ISO/IEC 23001-7 + // CBCS - AES-CBC mode partial video NAL pattern encryption, defined in ISO/IEC 23001-7 + + onvif_Version Version; // required + onvif_XAddr XAddr; +} onvif_RecordingCapabilities; + +/* search capabilities */ +typedef struct +{ + uint32 MetadataSearch : 1; + uint32 GeneralStartEvents : 1; // Indicates support for general virtual property events in the FindEvents method + uint32 support : 1; // Indication if the device supports search service + uint32 reserved : 29; + + onvif_Version Version; // required + onvif_XAddr XAddr; +} onvif_SearchCapabilities; + +/* replay capabilities */ +typedef struct +{ + uint32 ReversePlayback : 1; // Indicator that the Device supports reverse playback as defined in the ONVIF Streaming Specification + uint32 RTP_RTSP_TCP : 1; // Indicates support for RTP/RTSP/TCP + uint32 support : 1; // Indication if the device supports replay service + uint32 reserved : 29; + + onvif_FloatRange SessionTimeoutRange; // The minimum and maximum valid values supported as session timeout in seconds + + char RTSPWebSocketUri[256]; // If playback streaming over WebSocket is supported, this shall return the RTSP WebSocket URI + + onvif_Version Version; // required + onvif_XAddr XAddr; +} onvif_ReplayCapabilities; + +/* accesscontrol capabilities */ +typedef struct +{ + uint32 support : 1; // Indication if the device supports accesscontrol service + uint32 ClientSuppliedTokenSupported : 1; // Indicates that the client is allowed to supply the token when creating access points and areas + // To enable the use of the commands SetAccessPoint and SetArea, the value must be set to true + uint32 AccessPointManagementSupported : 1; // Indicates that the client can perform CRUD operations (create, read, update and delete) on access points + uint32 AreaManagementSupported : 1; // Indicates that the client can perform CRUD operations (create, read, update and delete) on areas + uint32 reserved : 28; + + int MaxLimit; // The maximum number of entries returned by a single GetList request. + // The device shall never return more than this number of entities in a single response + int MaxAccessPoints; // Indicates the maximum number of access points supported by the device + int MaxAreas; // Indicates the maximum number of areas supported by the device + + + onvif_Version Version; // required + onvif_XAddr XAddr; +} onvif_AccessControlCapabilities; + +/* doorcontrol capabilities */ +typedef struct +{ + uint32 support : 1; // Indication if the device supports doorcontrol service + uint32 ClientSuppliedTokenSupported : 1; // Indicates that the client is allowed to supply the token when creating doors. + // To enable the use of the command SetDoor, the value must be set to true + uint32 DoorManagementSupported : 1; // Indicates that the client can perform CRUD operations (create, read, update and delete) on doors. + // To enable the use of the commands GetDoors, GetDoorList, CreateDoor, ModifyDoor + // and DeleteDoor, the value must be set to true + uint32 reserved : 29; + + int MaxLimit; // The maximum number of entries returned by a single GetList or Get request. + // The device shall never return more than this number of entities in a single response + int MaxDoors; // Indicates the maximum number of doors supported by the device + + onvif_Version Version; // required + onvif_XAddr XAddr; +} onvif_DoorControlCapabilities; + +typedef struct +{ + uint32 VideoSourcesFlag : 1; // Indicates whether the field VideoSources is valid + uint32 VideoOutputsFlag : 1; // Indicates whether the field VideoSources is valid + uint32 AudioSourcesFlag : 1; // Indicates whether the field VideoSources is valid + uint32 AudioOutputsFlag : 1; // Indicates whether the field VideoSources is valid + uint32 RelayOutputsFlag : 1; // Indicates whether the field VideoSources is valid + uint32 SerialPortsFlag : 1; // Indicates whether the field VideoSources is valid + uint32 DigitalInputsFlag : 1; // Indicates whether the field VideoSources is valid + uint32 DigitalInputOptionsFlag : 1; // Indicates whether the field VideoSources is valid + uint32 support : 1; // Indication if the device supports deviceIO service + uint32 reserved : 23; + + int VideoSources; // optional, Number of video sources (defaults to none) + int VideoOutputs; // optional, Number of video outputs (defaults to none) + int AudioSources; // optional, Number of audio sources (defaults to none) + int AudioOutputs; // optional, Number of audio outputs (defaults to none) + int RelayOutputs; // optional, Number of relay outputs (defaults to none) + int SerialPorts; // optional, Number of serial ports (defaults to none) + int DigitalInputs; // optional, Number of digital inputs (defaults to none) + BOOL DigitalInputOptions; // optional, Indicates support for DigitalInput configuration of the idle state (defaults to false) + + onvif_Version Version; // required + onvif_XAddr XAddr; +} onvif_DeviceIOCapabilities; + +typedef struct +{ + uint32 MaximumNumberOfProfilesFlag : 1; // Indicates whether the field MaximumNumberOfProfiles is valid + uint32 ConfigurationsSupportedFlag : 1; // Indicates whether the field ConfigurationsSupported is valid + uint32 Reserved : 30; + + int MaximumNumberOfProfiles; // optional, Maximum number of profiles supported + char ConfigurationsSupported[256]; // optional, Enumerates the configurations supported +} onvif_ProfileCapabilities; + +typedef struct +{ + uint32 RTSPStreaming : 1; // Indicates support for live media streaming via RTSP + uint32 RTPMulticast : 1; // Indicates support for RTP multicast + uint32 RTP_RTSP_TCP : 1; // Indicates support for RTP/RTSP/TCP + uint32 NonAggregateControl : 1; // Indicates support for non aggregate RTSP control + uint32 AutoStartMulticast : 1; // Indicates support for non-RTSP controlled multicast streaming + uint32 SecureRTSPStreaming : 1; // Indicates support for live media streaming via RTSPS and SRTP + uint32 Reserved : 26; + + char RTSPWebSocketUri[256]; // optional, If streaming over websocket supported, RTSP websocket URI is provided. + // The scheme and IP part shall match the one used in the request (e.g. the GetServices request) +} onvif_StreamingCapabilities; + +typedef struct +{ + uint32 TKIP : 1; // required + uint32 ScanAvailableNetworks : 1; // required + uint32 MultipleConfiguration : 1; // required + uint32 AdHocStationMode : 1; // required + uint32 WEP : 1; // required + uint32 Reserved : 27; +} onvif_Dot11Capabilities; + +typedef struct +{ + uint32 SnapshotUri : 1; // Indicates if GetSnapshotUri is supported + uint32 Rotation : 1; // Indicates whether or not Rotation feature is supported + uint32 VideoSourceMode : 1; // Indicates the support for changing video source mode + uint32 OSD : 1; // Indicates if OSD is supported + uint32 TemporaryOSDText : 1; // Indicates if TemporaryOSDText is supported + uint32 Mask : 1; // Indicates if Masking is supported, Indicates support for mask configuration + uint32 SourceMask : 1; // Indicates if SourceMask is supported + // Indicates that privacy masks are only supported at the video source level + // and not the video source configuration level. If this is true any addition, + // deletion or change of a privacy mask done for one video source configuration + // will automatically be applied by the device to a corresponding privacy mask + // for all other video source configuration associated with the same video source. + uint32 support : 1; // Indication if the device supports media service2 + uint32 Reserved : 24; + + onvif_ProfileCapabilities ProfileCapabilities; // required, Media profile capabilities + onvif_StreamingCapabilities StreamingCapabilities; // required, Streaming capabilities + + onvif_Version Version; // required + onvif_XAddr XAddr; +} onvif_MediaCapabilities2; + +typedef struct +{ + uint32 Radiometry : 1; // Indicates whether or not radiometric thermal measurements are supported by the thermal devic + uint32 support : 1; // Indication if the device supports thermal service + uint32 Reserved : 30; + + onvif_Version Version; // required + onvif_XAddr XAddr; +} onvif_ThermalCapabilities; + +typedef struct +{ + uint32 sizeSupportedExemptionType; // sequence of elements + char SupportedExemptionType[10][32]; // optional, A list of exemptions that the device supports. Supported exemptions starting with the + // prefix pt: are reserved to define PACS specific exemption types and these reserved + // exemption types shall all share "pt:" syntax + // pt:ExemptFromAuthentication Supports ExemptedFromAuthentication +} onvif_CredentialCapabilitiesExtension; + +typedef struct +{ + uint32 ExtensionFlag : 1; + uint32 CredentialValiditySupported : 1; // required, Indicates that the device supports credential validity + uint32 CredentialAccessProfileValiditySupported: 1;// required, Indicates that the device supports validity on the association + // between a credential and an access profile + uint32 ValiditySupportsTimeValue : 1; // required, Indicates that the device supports both date and time value for validity. + // If set to false, then the time value is ignored + uint32 ResetAntipassbackSupported : 1; // required, Indicates the device supports resetting of anti-passback violations + // and notifying on anti-passback violations + uint32 ClientSuppliedTokenSupported: 1; // Indicates that the client is allowed to supply the token when creating credentials. + // To enable the use of the command SetCredential, the value must be set to true + uint32 support : 1; // Indication if the device supports credential service + uint32 Reserved : 25; + + uint32 sizeSupportedIdentifierType; // sequence of elements + char SupportedIdentifierType[10][32]; // required, A list of identifier types that the device supports. Supported identifiers starting with + // the prefix pt: are reserved to define PACS specific identifier types and these reserved + // identifier types shall all share the "pt:" syntax + // pt:Card Supports Card identifier type + // pt:PIN Supports PIN identifier type + // pt:Fingerprint Supports Fingerprint biometric identifier type + // pt:Face Supports Face biometric identifier type + // pt:Iris Supports Iris biometric identifier type + // pt:Vein Supports Vein biometric identifier type + // pt:Palm Supports Palm biometric identifier type + // pt:Retina Supports Retina biometric identifier type + uint32 MaxLimit; // required, The maximum number of entries returned by a single request. + // The device shall never return more than this number of entities in a single response + uint32 MaxCredentials; // required, The maximum number of credential supported by the device + uint32 MaxAccessProfilesPerCredential; // required, The maximum number of access profiles for a credential + + char DefaultCredentialSuspensionDuration[20]; // The default time period that the credential will temporary be suspended (e.g. by using the wrong PIN a predetermined number of times). + // The time period is defined as an [ISO 8601] duration string (e.g. PT5M). + + uint32 MaxWhitelistedItems; // optional, The maximum number of whitelisted credential identifiers supported by the device + uint32 MaxBlacklistedItems; // optional, The maximum number of blacklisted credential identifiers supported by the device + + onvif_CredentialCapabilitiesExtension Extension; // optional + + onvif_Version Version; // required + onvif_XAddr XAddr; +} onvif_CredentialCapabilities; + +typedef struct +{ + uint32 MultipleSchedulesPerAccessPointSupported: 1;// required, Indicates whether or not several access policies can refer to the same access point in + // an access profile + uint32 ClientSuppliedTokenSupported : 1; // Indicates that the client is allowed to supply the token when creating access profiles. + // To enable the use of the command SetAccessProfile, the value must be set to true + uint32 support : 1; // Indication if the device supports access rules service + uint32 Reserved : 29; + + uint32 MaxLimit; // required, The maximum number of entries returned by a single GetList or Get + // request. The device shall never return more than this number of entities in a single response + uint32 MaxAccessProfiles; // required, Indicates the maximum number of access profiles supported by the device + uint32 MaxAccessPoliciesPerAccessProfile; // required, Indicates the maximum number of access policies per access profile supported by the device + + onvif_Version Version; // required + onvif_XAddr XAddr; +} onvif_AccessRulesCapabilities; + +typedef struct +{ + uint32 ExtendedRecurrenceSupported : 1; // required, If this capability is supported, then all iCalendar recurrence types shall be supported by the device + uint32 SpecialDaysSupported : 1; // required, If this capability is supported, then the device shall support special days + uint32 StateReportingSupported : 1; // required, If this capability is set to true, the device shall implement the GetScheduleState command, + // and shall notify subscribing clients whenever schedules become active or inactive + uint32 ClientSuppliedTokenSupported : 1; // Indicates that the client is allowed to supply the token when creating schedules and special day groups. + // To enable the use of the commands SetSchedule and SetSpecialDayGroup, the value must be set to true + uint32 support : 1; // Indication if the device supports schedule service + uint32 Reserved : 27; + + uint32 MaxLimit; // required, + uint32 MaxSchedules; // required, + uint32 MaxTimePeriodsPerDay; // required, + uint32 MaxSpecialDayGroups; // required, + uint32 MaxDaysInSpecialDayGroup; // required, + uint32 MaxSpecialDaysSchedules; // required, + + onvif_Version Version; // required + onvif_XAddr XAddr; +} onvif_ScheduleCapabilities; + +typedef struct +{ + uint32 RTP_USCOREMulticast : 1; // required, Indicates that the device can receive RTP multicast streams + uint32 RTP_USCORETCP : 1; // required, Indicates that the device can receive RTP/TCP streams + uint32 RTP_USCORERTSP_USCORETCP : 1; // required, Indicates that the device can receive RTP/RTSP/TCP streams + uint32 support : 1; // Indication if the device supports receiver service + uint32 Reserved : 28; + + int SupportedReceivers; // required, The maximum number of receivers supported by the device + int MaximumRTSPURILength; // required, The maximum allowed length for RTSP URIs (Minimum and default value is 128 octet) + + onvif_Version Version; // required + onvif_XAddr XAddr; +} onvif_ReceiverCapabilities; + +typedef struct +{ + uint32 MaximumPanMovesFlag : 1; // Indicates whether the field MaximumPanMoves is valid + uint32 MaximumTiltMovesFlag : 1; // Indicates whether the field MaximumTiltMoves is valid + uint32 MaximumZoomMovesFlag : 1; // Indicates whether the field MaximumZoomMoves is valid + uint32 MaximumRollMovesFlag : 1; // Indicates whether the field MaximumRollMoves is valid + uint32 AutoLevelFlag : 1; // Indicates whether the field AutoLevel is valid + uint32 MaximumFocusMovesFlag : 1; // Indicates whether the field MaximumFocusMoves is valid + uint32 AutoFocusFlag : 1; // Indicates whether the field AutoFocus is valid + uint32 Reserved : 25; + + char VideoSourceToken[ONVIF_TOKEN_LEN]; // required, Unique identifier of a video source + int MaximumPanMoves; // optional, Lifetime limit of pan moves for this video source. Presence of this attribute indicates support of pan move + int MaximumTiltMoves; // optional, Lifetime limit of tilt moves for this video source. Presence of this attribute indicates support of tilt move + int MaximumZoomMoves; // optional, Lifetime limit of zoom moves for this video source. Presence of this attribute indicates support of zoom move + int MaximumRollMoves; // optional, Lifetime limit of roll moves for this video source. Presence of this attribute indicates support of roll move + BOOL AutoLevel; // optional, Indicates "auto" as a valid enum for Direction in RollMove + int MaximumFocusMoves; // optional, Lifetime limit of focus moves for this video source. Presence of this attribute indicates support of focus move + BOOL AutoFocus; // optional, Indicates "auto" as a valid enum for Direction in FocusMove +} onvif_SourceCapabilities; + +typedef struct +{ + uint32 support : 1; // Indication if the device supports provisioning service + uint32 Reserved : 31; + + int DefaultTimeout; // external, Maximum time before stopping movement after a move operation + + uint32 sizeSource; // sequence of elements + + onvif_SourceCapabilities Source[4]; // optional, Capabilities per video source + + onvif_Version Version; // required + onvif_XAddr XAddr; +} onvif_ProvisioningCapabilities; + +typedef struct +{ + onvif_DevicesCapabilities device; // The capabilities for the device service is returned in the Capabilities element + onvif_EventCapabilities events; // The capabilities for the event service is returned in the Capabilities element + onvif_Dot11Capabilities dot11; // The capabilities for the dot11 + onvif_MediaCapabilities media; // The capabilities for the media service is returned in the Capabilities element + onvif_MediaCapabilities2 media2; // The capabilities for the media service2 is returned in the Capabilities element + onvif_ImagingCapabilities image; // The capabilities for the imaging service is returned in the Capabilities element + onvif_PTZCapabilities ptz; // The capabilities for the PTZ service is returned in the Capabilities element + onvif_AnalyticsCapabilities analytics; // The capabilities for the analytics service is returned in the Capabilities element + onvif_RecordingCapabilities recording; // The capabilities for the recording service is returned in the Capabilities element + onvif_SearchCapabilities search; // The capabilities for the search service is returned in the Capabilities element + onvif_ReplayCapabilities replay; // The capabilities for the replay service is returned in the Capabilities element + onvif_AccessControlCapabilities accesscontrol; // The capabilities for the accesscontrol service is returned in the Capabilities element + onvif_DoorControlCapabilities doorcontrol; // The capabilities for the doorcontrol service is returned in the Capabilities element + onvif_DeviceIOCapabilities deviceIO; // The capabilities for the deviceIO service is returned in the Capabilities element + onvif_ThermalCapabilities thermal; // The capabilities for the thermal service is returned in the Capabilities element + onvif_CredentialCapabilities credential; // The capabilities for the credential service is returned in the Capabilities element + onvif_AccessRulesCapabilities accessrules; // The capabilities for the access rules service is returned in the Capabilities element + onvif_ScheduleCapabilities schedule; // The capabilities for the schedule service is returned in the Capabilities element + onvif_ReceiverCapabilities receiver; // The capabilities for the receiver service is returned in the Capabilities element + onvif_ProvisioningCapabilities provisioning; // The capabilities for the provisioning service is returned in the Capabilities element +} onvif_Capabilities; + +typedef struct +{ + char Manufacturer[64]; // required, The manufactor of the device + char Model[64]; // required, The device model + char FirmwareVersion[64]; // required, The firmware version in the device + char SerialNumber[64]; // required, The serial number of the device + char HardwareId[64]; // required, The hardware ID of the device +} onvif_DeviceInformation; + +typedef struct +{ + int Width; // required + int Height; // required +} onvif_VideoResolution; + +typedef struct +{ + int Min; // required + int Max; // required +} onvif_IntRange; + +typedef struct +{ + int x; // required + int y; // required + int width; // required + int height; // required +} onvif_IntRectangle; + +typedef struct +{ + float bottom; // required + float top; // required + float right; // required + float left; // required +} onvif_Rectangle; + +typedef struct +{ + uint32 LevelFlag : 1; // Indicates whether the field Level is valid + uint32 Reserved : 31; + + onvif_BacklightCompensationMode Mode; // required, Backlight compensation mode (on/off) + float Level; // optional, Optional level parameter (unit unspecified) +} onvif_BacklightCompensation; + +typedef struct +{ + uint32 PriorityFlag : 1; // Indicates whether the field Priority is valid + uint32 MinExposureTimeFlag : 1; // Indicates whether the field MinExposureTime is valid + uint32 MaxExposureTimeFlag : 1; // Indicates whether the field MaxExposureTime is valid + uint32 MinGainFlag : 1; // Indicates whether the field MinGain is valid + uint32 MaxGainFlag : 1; // Indicates whether the field MaxGain is valid + uint32 MinIrisFlag : 1; // Indicates whether the field MinIris is valid + uint32 MaxIrisFlag : 1; // Indicates whether the field MaxIris is valid + uint32 ExposureTimeFlag : 1; // Indicates whether the field ExposureTime is valid + uint32 GainFlag : 1; // Indicates whether the field Gain is valid + uint32 IrisFlag : 1; // Indicates whether the field Iris is valid + uint32 Reserved : 22; + + onvif_ExposureMode Mode; // required, Auto - Enabled the exposure algorithm on the device; Manual - Disabled exposure algorithm on the device + onvif_ExposurePriority Priority; // optional, The exposure priority mode (low noise/framerate) + onvif_Rectangle Window; // required, + + float MinExposureTime; // optional, Minimum value of exposure time range allowed to be used by the algorithm + float MaxExposureTime; // optional, Maximum value of exposure time range allowed to be used by the algorithm + float MinGain; // optional, Minimum value of the sensor gain range that is allowed to be used by the algorithm + float MaxGain; // optional, Maximum value of the sensor gain range that is allowed to be used by the algorithm + float MinIris; // optional, Minimum value of the iris range allowed to be used by the algorithm + float MaxIris; // optional, Maximum value of the iris range allowed to be used by the algorithm + float ExposureTime; // optional, The fixed exposure time used by the image sensor + float Gain; // optional, The fixed gain used by the image sensor (dB) + float Iris; // optional, The fixed attenuation of input light affected by the iris (dB). 0dB maps to a fully opened iris +} onvif_Exposure; + +typedef struct +{ + uint32 DefaultSpeedFlag : 1; // Indicates whether the field DefaultSpeed is valid + uint32 NearLimitFlag : 1; // Indicates whether the field NearLimit is valid + uint32 FarLimitFlag : 1; // Indicates whether the field FarLimit is valid + uint32 Reserved : 29; + + onvif_AutoFocusMode AutoFocusMode; // required, Mode of auto fucus + + float DefaultSpeed; // optional, + float NearLimit; // optional, Parameter to set autofocus near limit (unit: meter) + float FarLimit; // optional, Parameter to set autofocus far limit (unit: meter) +} onvif_FocusConfiguration; + +typedef struct +{ + uint32 LevelFlag : 1; // Indicates whether the field Level is valid + uint32 Reserved : 31; + + onvif_WideDynamicMode Mode; // required, Wide dynamic range mode (on/off), 0-OFF, 1-ON + float Level; // optional, Optional level parameter (unit unspecified) +} onvif_WideDynamicRange; + +typedef struct +{ + uint32 CrGainFlag : 1; // Indicates whether the field CrGain is valid + uint32 CbGainFlag : 1; // Indicates whether the field CbGain is valid + uint32 Reserved : 30; + + onvif_WhiteBalanceMode Mode; // required, 'AUTO' or 'MANUAL' + + float CrGain; // optional, Rgain (unitless) + float CbGain; // optional, Bgain (unitless) +} onvif_WhiteBalance; + +typedef struct +{ + uint32 BacklightCompensationFlag : 1; // Indicates whether the field BacklightCompensation is valid + uint32 BrightnessFlag : 1; // Indicates whether the field Brightness is valid + uint32 ColorSaturationFlag : 1; // Indicates whether the field ColorSaturation is valid + uint32 ContrastFlag : 1; // Indicates whether the field Contrast is valid + uint32 ExposureFlag : 1; // Indicates whether the field Exposure is valid + uint32 FocusFlag : 1; // Indicates whether the field Focus is valid + uint32 IrCutFilterFlag : 1; // Indicates whether the field IrCutFilter is valid + uint32 SharpnessFlag : 1; // Indicates whether the field Sharpness is valid + uint32 WideDynamicRangeFlag : 1; // Indicates whether the field WideDynamicRange is valid + uint32 WhiteBalanceFlag : 1; // Indicates whether the field WhiteBalance is valid + uint32 Reserved : 22; + + onvif_BacklightCompensation BacklightCompensation; // optional, Enabled/disabled BLC mode (on/off) + float Brightness; // optional, Image brightness (unit unspecified) + float ColorSaturation; // optional, Color saturation of the image (unit unspecified) + float Contrast; // optional, Contrast of the image (unit unspecified) + onvif_Exposure Exposure; // optional, Exposure mode of the device + onvif_FocusConfiguration Focus; // optional, Focus configuration + onvif_IrCutFilterMode IrCutFilter; // optional, Infrared Cutoff Filter settings + float Sharpness; // optional, Sharpness of the Video image + onvif_WideDynamicRange WideDynamicRange; // optional, WDR settings + onvif_WhiteBalance WhiteBalance; // optional, White balance settings +} onvif_ImagingSettings; + +typedef struct +{ + uint32 Mode_ON : 1; // Indicates whether mode ON is valid + uint32 Mode_OFF : 1; // Indicates whether mode OFF is valid + uint32 LevelFlag : 1; // Indicates whether the field LevelFlag is valid + uint32 Reserved : 29; + + onvif_FloatRange Level; // optional, Level range of BacklightCompensation +} onvif_BacklightCompensationOptions; + +typedef struct +{ + uint32 Mode_AUTO : 1; // Indicates whether mode AUTO is valid + uint32 Mode_MANUAL : 1; // Indicates whether mode Manual is valid + uint32 Priority_LowNoise : 1; // Indicates whether Priority LowNoise is valid + uint32 Priority_FrameRate : 1; // Indicates whether Priority FrameRate is valid + uint32 MinExposureTimeFlag : 1; // Indicates whether the field MinExposureTime is valid + uint32 MaxExposureTimeFlag : 1; // Indicates whether the field MaxExposureTime is valid + uint32 MinGainFlag : 1; // Indicates whether the field MinGain is valid + uint32 MaxGainFlag : 1; // Indicates whether the field MaxGain is valid + uint32 MinIrisFlag : 1; // Indicates whether the field MinIris is valid + uint32 MaxIrisFlag : 1; // Indicates whether the field MaxIris is valid + uint32 ExposureTimeFlag : 1; // Indicates whether the field ExposureTime is valid + uint32 GainFlag : 1; // Indicates whether the field Gain is valid + uint32 IrisFlag : 1; // Indicates whether the field Iris is valid + uint32 Reserved : 19; + + onvif_FloatRange MinExposureTime; // optional, Valid range of the Minimum ExposureTime + onvif_FloatRange MaxExposureTime; // optional, Valid range of the Maximum ExposureTime + onvif_FloatRange MinGain; // optional, Valid range of the Minimum Gain + onvif_FloatRange MaxGain; // optional, Valid range of the Maximum Gain + onvif_FloatRange MinIris; // optional, Valid range of the Minimum Iris + onvif_FloatRange MaxIris; // optional, Valid range of the Maximum Iris + onvif_FloatRange ExposureTime; // optional, Valid range of the ExposureTime + onvif_FloatRange Gain; // optional, Valid range of the Gain + onvif_FloatRange Iris; // optional, Valid range of the Iris +} onvif_ExposureOptions; + +typedef struct +{ + uint32 AutoFocusModes_AUTO : 1; // Indicates whether mode aUTO is valid + uint32 AutoFocusModes_MANUAL : 1; // Indicates whether mode Manual is valid + uint32 DefaultSpeedFlag : 1; // Indicates whether the field DefaultSpeed is valid + uint32 NearLimitFlag : 1; // Indicates whether the field NearLimit is valid + uint32 FarLimitFlag : 1; // Indicates whether the field FarLimit is valid + uint32 Reserved : 27; + + onvif_FloatRange DefaultSpeed; // optional, Valid range of DefaultSpeed + onvif_FloatRange NearLimit; // optional, Valid range of NearLimit + onvif_FloatRange FarLimit; // optional, Valid range of FarLimit +} onvif_FocusOptions; + +typedef struct +{ + uint32 Mode_ON : 1; // Indicates whether mode ON is valid + uint32 Mode_OFF : 1; // Indicates whether mode OFF is valid + uint32 LevelFlag : 1; // Indicates whether the field Level is valid + uint32 Reserved : 29; + + onvif_FloatRange Level; // optional, Valid range of Level +} onvif_WideDynamicRangeOptions; + +typedef struct +{ + uint32 Mode_AUTO : 1; // Indicates whether mode AUDO is valid + uint32 Mode_MANUAL : 1; // Indicates whether mode Manual is valid + uint32 YrGainFlag : 1; // Indicates whether the field CrGain is valid + uint32 YbGainFlag : 1; // Indicates whether the field CbGain is valid + uint32 Reserved : 28; + + onvif_FloatRange YrGain; // optional, Valid range of YrGain + onvif_FloatRange YbGain; // optional, Valid range of YbGain +} onvif_WhiteBalanceOptions; + +typedef struct +{ + uint32 IrCutFilterMode_ON : 1; // Indicates whether IrCutFilter mode ON is valid + uint32 IrCutFilterMode_OFF : 1; // Indicates whether IrCutFilter mode OFF is valid + uint32 IrCutFilterMode_AUTO : 1; // Indicates whether IrCutFilter mode AUTO is valid + uint32 BacklightCompensationFlag : 1; // Indicates whether the field BacklightCompensation is valid + uint32 BrightnessFlag : 1; // Indicates whether the field Brightness is valid + uint32 ColorSaturationFlag : 1; // Indicates whether the field ColorSaturation is valid + uint32 ContrastFlag : 1; // Indicates whether the field Contrast is valid + uint32 ExposureFlag : 1; // Indicates whether the field Exposure is valid + uint32 FocusFlag : 1; // Indicates whether the field Focus is valid + uint32 SharpnessFlag : 1; // Indicates whether the field Sharpness is valid + uint32 WideDynamicRangeFlag : 1; // Indicates whether the field WideDynamicRange is valid + uint32 WhiteBalanceFlag : 1; // Indicates whether the field WhiteBalance is valid + uint32 Reserved : 20; + + onvif_BacklightCompensationOptions BacklightCompensation; // optional, Valid range of Backlight Compensation + + onvif_FloatRange Brightness; // optional, Valid range of Brightness + onvif_FloatRange ColorSaturation; // optional, alid range of Color Saturation + onvif_FloatRange Contrast; // optional, Valid range of Contrast + + onvif_ExposureOptions Exposure; // optional, Valid range of Exposure + onvif_FocusOptions Focus; // optional, Valid range of Focus + + onvif_FloatRange Sharpness; // optional, Valid range of Sharpness + + onvif_WideDynamicRangeOptions WideDynamicRange; // optional, Valid range of WideDynamicRange + onvif_WhiteBalanceOptions WhiteBalance; // optional, Valid range of WhiteBalance +} onvif_ImagingOptions; + +typedef struct +{ + uint32 ErrorFlag : 1; // Indicates whether the field Error is valid + uint32 Reserved : 31; + + float Position; // required, Status of focus position + onvif_MoveStatus MoveStatus; // required, Status of focus MoveStatus + char Error[100]; // optional, Error status of focus +} onvif_FocusStatus; + +typedef struct +{ + uint32 FocusStatusFlag : 1; // Indicates whether the field FocusStatus is valid + uint32 Reserved : 31; + + onvif_FocusStatus FocusStatus; // optional, Status of focus +} onvif_ImagingStatus; + +typedef struct +{ + uint32 SpeedFlag : 1; + uint32 Reserved : 31; + + onvif_FloatRange Position; // required, Valid ranges of the position + onvif_FloatRange Speed; // optional, Valid ranges of the speed +} onvif_AbsoluteFocusOptions; + +typedef struct +{ + uint32 SpeedFlag : 1; + uint32 Reserved : 31; + + onvif_FloatRange Distance; // required, valid ranges of the distance + onvif_FloatRange Speed; // optional, Valid ranges of the speed +} onvif_RelativeFocusOptions20; + +typedef struct +{ + onvif_FloatRange Speed; // required, Valid ranges of the speed +} onvif_ContinuousFocusOptions; + +typedef struct +{ + uint32 AbsoluteFlag : 1; + uint32 RelativeFlag : 1; + uint32 ContinuousFlag : 1; + uint32 Reserved : 29; + + onvif_AbsoluteFocusOptions Absolute; // optional, Valid ranges for the absolute control + onvif_RelativeFocusOptions20 Relative; // optional, Valid ranges for the relative control + onvif_ContinuousFocusOptions Continuous; // optional, Valid ranges for the continuous control +} onvif_MoveOptions20; + +typedef struct +{ + uint32 SpeedFlag : 1; // Indicates whether the field Speed is valid + uint32 Reserved : 31; + + float Position; // required, Position parameter for the absolute focus control + float Speed; // optional, Speed parameter for the absolute focus control +} onvif_AbsoluteFocus; + +typedef struct +{ + uint32 SpeedFlag : 1; // Indicates whether the field Speed is valid + uint32 Reserved : 31; + + float Distance; // required, Distance parameter for the relative focus control + float Speed; // optional, Speed parameter for the relative focus control +} onvif_RelativeFocus; + +typedef struct +{ + float Speed; // required, Speed parameter for the Continuous focus control +} onvif_ContinuousFocus; + +typedef struct +{ + uint32 AbsoluteFlag : 1; // Indicates whether the field Absolute is valid + uint32 RelativeFlag : 1; // Indicates whether the field Relative is valid + uint32 ContinuousFlag : 1; // Indicates whether the field Continuous is valid + uint32 Reserved : 29; + + onvif_AbsoluteFocus Absolute; // optional, Parameters for the absolute focus control + onvif_RelativeFocus Relative; // optional, Parameters for the relative focus control + onvif_ContinuousFocus Continuous; // optional, Parameter for the continuous focus control +} onvif_FocusMove; + +typedef struct +{ + char Name[ONVIF_NAME_LEN]; // required, Human readable name of the Imaging Preset + char token[ONVIF_TOKEN_LEN]; // required, Unique identifier of this Imaging Preset + char type[64]; // required, Indicates Imaging Preset Type. Use ImagingPresetType + // Describes standard Imaging Preset types, + // used to facilitate Multi-language support and client display. + // "Custom" Type shall be used when Imaging Preset Name does not + // match any of the types included in the standard classification + // Custom + // ClearWeather + // Cloudy + // Fog + // Rain + // Snowing + // Snow + // WDR + // Shade + // Night + // Indoor + // Fluorescent + // Incandescent + // Sodium(Natrium) + // Sunrise(Horizon) + // Sunset(Rear) + // ExtremeHot + // ExtremeCold + // Underwater + // CloseUp + // Motion + // FlickerFree50 + // FlickerFree60 +} onvif_ImagingPreset; + +typedef struct _ImagingPresetList +{ + struct _ImagingPresetList * next; + + onvif_ImagingPreset Preset; +} ImagingPresetList; + +typedef struct +{ + uint32 PasswordFlag : 1; // Indicates whether the field Password is valid + uint32 Reserved : 31; + + char Username[ONVIF_NAME_LEN]; // required + char Password[ONVIF_NAME_LEN]; // optional + + onvif_UserLevel UserLevel; // required +} onvif_User; + +typedef struct +{ + uint32 PasswordFlag : 1; // Indicates whether the field Password is valid + uint32 Reserved : 31; + + char Username[ONVIF_NAME_LEN]; // required + char Password[ONVIF_NAME_LEN]; // optional + + BOOL UseDerivedPassword; // required +} onvif_RemoteUser; + +typedef struct +{ + char Address[100]; // required + int PrefixLength; // required +} onvif_PrefixedIPAddress; + +typedef struct +{ + onvif_IPAddressFilterType Type; // required + onvif_PrefixedIPAddress IPv4Address[20]; // optional + onvif_PrefixedIPAddress IPv6Address[20]; // optional +} onvif_IPAddressFilter; + +typedef struct +{ + uint32 ImagingSettingsFlag : 1; // Indicates whether the field ImagingSettings is valid + uint32 Reserved : 31; + + char token[ONVIF_TOKEN_LEN]; // required + float Framerate; // required, Frame rate in frames per second + + onvif_VideoResolution Resolution; // required, Horizontal and vertical resolution + onvif_ImagingSettings ImagingSettings; // optional +} onvif_VideoSource; + +typedef struct +{ + uint32 DescriptionFlag : 1; // Indicates whether the field Description is valid + uint32 Enabled : 1; //optional, Indication of whether this mode is active. If active this value is true. In case of non-indication, it means as false. + // The value of true shall be had by only one video source mode + uint32 Reboot : 1; // required, After setting the mode if a device starts to reboot this value is true. If a device change the mode without rebooting this value is false. + // If true, configured parameters may not be guaranteed by the device after rebooting + uint32 Reserved : 29; + + float MaxFramerate; // required, Max frame rate in frames per second for this video source mode + + char Encodings[32]; // required, Indication which encodings are supported for this video source. + char Description[128]; // optional, Informative description of this video source mode. This field should be described in English + char token[ONVIF_TOKEN_LEN]; // required, Indicate token for video source mode + + onvif_VideoResolution MaxResolution; // required, Max horizontal and vertical resolution for this video source mode +} onvif_VideoSourceMode; + +typedef struct +{ + uint32 DegreeFlag : 1; // Indicates whether the field Degree is valid + uint32 Reserved : 31; + + onvif_RotateMode Mode; // required, Parameter to enable/disable Rotation feature + + int Degree; // optional, Optional parameter to configure how much degree of clockwise rotation of image for On mode. Omitting this parameter for On mode means 180 degree rotation +} onvif_Rotate; + +typedef struct +{ + uint32 RotateFlag : 1; // Indicates whether the field Rotate is valid + uint32 Reserved : 31; + + onvif_Rotate Rotate; // optional, Optional element to configure rotation of captured image +} onvif_VideoSourceConfigurationExtension; + +typedef struct +{ + uint32 ExtensionFlag : 1; // Indicates whether the field Extension is valid + uint32 Reserved : 31; + + char Name[ONVIF_NAME_LEN]; // required, User readable name. Length up to 64 characters + int UseCount; // required, Number of internal references currently using this configuration. This parameter is read-only and cannot be changed by a set request + char token[ONVIF_TOKEN_LEN]; // required, Token that uniquely refernces this configuration. Length up to 64 characters + char SourceToken[ONVIF_TOKEN_LEN]; // required, Reference to the physical input + + onvif_IntRectangle Bounds; // required, Rectangle specifying the Video capturing area. The capturing area shall not be larger than the whole Video source area + onvif_VideoSourceConfigurationExtension Extension; // optional +} onvif_VideoSourceConfiguration; + + +typedef struct +{ + onvif_IntRange XRange; // required + onvif_IntRange YRange; // required + onvif_IntRange WidthRange; // required + onvif_IntRange HeightRange; // required +} onvif_IntRectangleRange; + +typedef struct +{ + uint32 RotateMode_OFF : 1; // Indicates whether the mode RotateMode_OFF is valid + uint32 RotateMode_ON : 1; // Indicates whether the mode RotateMode_ON is valid + uint32 RotateMode_AUTO : 1; // Indicates whether the mode RotateMode_AUTO is valid + uint32 Reboot : 1; // Signals if a device requires a reboot after changing the rotation. + // If a device can handle rotation changes without rebooting this value shall be set to false. + uint32 Reserved : 28; + + uint32 sizeDegreeList; + int DegreeList[10]; // optional, List of supported degree value for rotation +} onvif_RotateOptions; + +typedef struct +{ + uint32 RotateFlag : 1; // Indicates whether the field Rotate is valid + uint32 Reserved : 31; + + onvif_RotateOptions Rotate; // optional, Options of parameters for Rotation feature +} onvif_VideoSourceConfigurationOptionsExtension; + +typedef struct +{ + uint32 ExtensionFlag : 1; // Indicates whether the field Extension is valid + uint32 MaximumNumberOfProfilesFlag : 1; // Indicates whether the field MaximumNumberOfProfiles is valid + uint32 Reserved : 30; + + onvif_IntRectangleRange BoundsRange; // required + + uint32 sizeVideoSourceTokensAvailable; + char VideoSourceTokensAvailable[10][ONVIF_TOKEN_LEN]; // required + + onvif_VideoSourceConfigurationOptionsExtension Extension; // optional + + int MaximumNumberOfProfiles; // optional, Maximum number of profiles +} onvif_VideoSourceConfigurationOptions; + +typedef struct +{ + uint32 ConstantBitRateFlag : 1; // Indicates whether the field ConstantBitRate is valid + uint32 Reserved : 31; + + int FrameRateLimit; // required, Maximum output framerate in fps. If an EncodingInterval is provided the resulting encoded framerate will be reduced by the given factor + int EncodingInterval; // required, Interval at which images are encoded and transmitted. (A value of 1 means that every frame is encoded, a value of 2 means that every 2nd frame is encoded ...) + int BitrateLimit; // required, the maximum output bitrate in kbps + BOOL ConstantBitRate; // optional, Enforce constant bitrate +} onvif_VideoRateControl; + +typedef struct +{ + int GovLength; // required, Determines the interval in which the I-Frames will be coded. An entry of 1 indicates I-Frames are continuously generated. + // An entry of 2 indicates that every 2nd image is an I-Frame, and 3 only every 3rd frame, etc. The frames in between are coded as P or B Frames. + onvif_Mpeg4Profile Mpeg4Profile; // required, the Mpeg4 profile, either simple profile (SP) or advanced simple profile (ASP) +} onvif_Mpeg4Configuration; + +typedef struct +{ + int GovLength; // required, Group of Video frames length. Determines typically the interval in which the I-Frames will be coded. An entry of 1 indicates I-Frames are continuously generated. + // An entry of 2 indicates that every 2nd image is an I-Frame, and 3 only every 3rd frame, etc. The frames in between are coded as P or B Frames + onvif_H264Profile H264Profile; // required, the H.264 profile, either baseline, main, extended or high +} onvif_H264Configuration; + +typedef struct +{ + char IPv4Address[32]; // required, The multicast address + int Port; // required, The RTP mutlicast destination port. A device may support RTCP. In this case the port value shall be even to allow the corresponding RTCP stream to be mapped + // to the next higher (odd) destination port number as defined in the RTSP specification + int TTL; // required, In case of IPv6 the TTL value is assumed as the hop limit. Note that for IPV6 and administratively scoped IPv4 multicast the primary use for hop limit / TTL is + // to prevent packets from (endlessly) circulating and not limiting scope. In these cases the address contains the scope + BOOL AutoStart; // required, Read only property signalling that streaming is persistant. Use the methods StartMulticastStreaming and StopMulticastStreaming to switch its state +} onvif_MulticastConfiguration; + +typedef struct +{ + uint32 RateControlFlag : 1; // Indicates whether the field RateControl is valid + uint32 MPEG4Flag : 1; // Indicates whether the field MPEG4 is valid + uint32 H264Flag : 1; // Indicates whether the field H264 is valid + uint32 Reserved : 29; + + char Name[ONVIF_NAME_LEN]; // required, User readable name. Length up to 64 characters + int UseCount; // required, Number of internal references currently using this configuration. This parameter is read-only and cannot be changed by a set request + char token[ONVIF_TOKEN_LEN]; // required, Token that uniquely refernces this configuration. Length up to 64 characters + + onvif_VideoEncoding Encoding; // required, Used video codec, either Jpeg, H.264 or Mpeg4 + onvif_VideoResolution Resolution; // required, Configured video resolution + + int Quality; // required, Relative value for the video quantizers and the quality of the video. A high value within supported quality range means higher quality + + onvif_VideoRateControl RateControl; // optional, Optional element to configure rate control related parameters + onvif_Mpeg4Configuration MPEG4; // optional, Optional element to configure Mpeg4 related parameters + onvif_H264Configuration H264; // optional, Optional element to configure H.264 related parameters + + onvif_MulticastConfiguration Multicast; // required, Defines the multicast settings that could be used for video streaming + + int SessionTimeout; // required, The rtsp session timeout for the related video stream, unit is second +} onvif_VideoEncoderConfiguration; + +typedef struct +{ + char token[ONVIF_TOKEN_LEN]; // required + int Channels; // required, number of available audio channels. (1: mono, 2: stereo) +} onvif_AudioSource; + +typedef struct +{ + char Name[ONVIF_NAME_LEN]; // required, User readable name. Length up to 64 characters + int UseCount; // required, Number of internal references currently using this configuration. This parameter is read-only and cannot be changed by a set request + char token[ONVIF_TOKEN_LEN]; // required, Token that uniquely refernces this configuration. Length up to 64 characters + + char SourceToken[ONVIF_TOKEN_LEN]; // required, Token of the Audio Source the configuration applies to +} onvif_AudioSourceConfiguration; + + +typedef struct +{ + char Name[ONVIF_NAME_LEN]; // required, User readable name. Length up to 64 characters + int UseCount; // required, Number of internal references currently using this configuration. This parameter is read-only and cannot be changed by a set request + char token[ONVIF_TOKEN_LEN]; // required, Token that uniquely refernces this configuration. Length up to 64 characters + + onvif_AudioEncoding Encoding; // required, Audio codec used for encoding the audio input (either G.711, G.726 or AAC) + + int Bitrate; // required, The output bitrate in kbps + int SampleRate; // required, The output sample rate in kHz + + onvif_MulticastConfiguration Multicast; // required, Defines the multicast settings that could be used for video streaming + + int SessionTimeout; // required, The rtsp session timeout for the related audio stream, unit is second +} onvif_AudioEncoderConfiguration; + +typedef struct +{ + onvif_AudioEncoding Encoding; // required, The enoding used for audio data (either G.711, G.726 or AAC) + + onvif_IntList BitrateList; // required, List of supported bitrates in kbps for the specified Encoding + onvif_IntList SampleRateList; // required, List of supported Sample Rates in kHz for the specified Encoding +} onvif_AudioEncoderConfigurationOption; + +typedef struct +{ + uint32 sizeOptions; // required, valid Options numbers + onvif_AudioEncoderConfigurationOption Options[3]; // optional, list of supported AudioEncoderConfigurations +} onvif_AudioEncoderConfigurationOptions; + +typedef struct +{ + onvif_VideoResolution ResolutionsAvailable[MAX_RES_NUMS]; // required, List of supported image sizes + + onvif_IntRange FrameRateRange; // required, Supported frame rate in fps (frames per second) + onvif_IntRange EncodingIntervalRange; // required, Supported encoding interval range. The encoding interval corresponds to the number of frames devided by the encoded frames. An encoding interval value of "1" means that all frames are encoded +} onvif_JpegOptions; + +typedef struct +{ + uint32 Mpeg4Profile_SP : 1; // required, Indicates whether the SP profile is valid + uint32 Mpeg4Profile_ASP : 1; // required, Indicates whether the ASP profile is valid + uint32 Reserverd : 30; + + onvif_VideoResolution ResolutionsAvailable[MAX_RES_NUMS]; // required, List of supported image sizes + + onvif_IntRange GovLengthRange; // required, Supported group of Video frames length. This value typically corresponds to the I-Frame distance + onvif_IntRange FrameRateRange; // required, Supported frame rate in fps (frames per second) + onvif_IntRange EncodingIntervalRange; // required, Supported encoding interval range. The encoding interval corresponds to the number of frames devided by the encoded frames. An encoding interval value of "1" means that all frames are encoded +} onvif_Mpeg4Options; + +typedef struct +{ + uint32 H264Profile_Baseline : 1; // required, Indicates whether the Baseline profile is valid + uint32 H264Profile_Main : 1; // required, Indicates whether the Main profile is valid + uint32 H264Profile_Extended : 1; // required, Indicates whether the Extended profile is valid + uint32 H264Profile_High : 1; // required, Indicates whether the High profile is valid + uint32 Reserverd : 28; + + onvif_VideoResolution ResolutionsAvailable[MAX_RES_NUMS]; // required, List of supported image sizes + + onvif_IntRange GovLengthRange; // required, Supported group of Video frames length. This value typically corresponds to the I-Frame distance + onvif_IntRange FrameRateRange; // required, Supported frame rate in fps (frames per second) + onvif_IntRange EncodingIntervalRange; // required, Supported encoding interval range. The encoding interval corresponds to the number of frames devided by the encoded frames. An encoding interval value of "1" means that all frames are encoded +} onvif_H264Options; + +typedef struct +{ + onvif_JpegOptions JpegOptions; // required + onvif_IntRange BitrateRange; // required +} onvif_JpegOptions2; + +typedef struct +{ + onvif_Mpeg4Options Mpeg4Options; // required + onvif_IntRange BitrateRange; // required +} onvif_Mpeg4Options2; + +typedef struct +{ + onvif_H264Options H264Options; // required + onvif_IntRange BitrateRange; // required +} onvif_H264Options2; + +typedef struct +{ + uint32 JPEGFlag : 1; // Indicates whether the field JPEG is valid + uint32 MPEG4Flag : 1; // Indicates whether the field MPEG4 is valid + uint32 H264Flag : 1; // Indicates whether the field H264 is valid + uint32 Reserved : 29; + + onvif_JpegOptions2 JPEG; // optional + onvif_Mpeg4Options2 MPEG4; // optional + onvif_H264Options2 H264; // optional +} onvif_VideoEncoderOptionsExtension; + +typedef struct +{ + uint32 JPEGFlag : 1; // Indicates whether the field JPEG is valid + uint32 MPEG4Flag : 1; // Indicates whether the field MPEG4 is valid + uint32 H264Flag : 1; // Indicates whether the field H264 is valid + uint32 ExtensionFlag : 1; // Indicates whether the field Extension is valid + uint32 Reserved : 28; + + onvif_IntRange QualityRange; // required, Range of the quality values. A high value means higher quality + + onvif_JpegOptions JPEG; // optional, Optional JPEG encoder settings ranges + onvif_Mpeg4Options MPEG4; // optional, Optional MPEG-4 encoder settings ranges + onvif_H264Options H264; // optional, Optional H.264 encoder settings ranges + + onvif_VideoEncoderOptionsExtension Extension; // optional +} onvif_VideoEncoderConfigurationOptions; + +typedef struct +{ + BOOL Status; // required, True if the metadata stream shall contain the PTZ status (IDLE, MOVING or UNKNOWN) + BOOL Position; // required, True if the metadata stream shall contain the PTZ position +} onvif_PTZFilter; + +typedef struct +{ + char Dialect[1024]; // Dialect + char TopicExpression[256]; // TopicExpression +} onvif_EventSubscription; + +typedef struct +{ + uint32 PanTiltStatusSupported : 1; // required, True if the device is able to stream pan or tilt status information + uint32 ZoomStatusSupported : 1; // required, True if the device is able to stream zoom status inforamtion + uint32 PanTiltPositionSupported : 1; // optional, True if the device is able to stream the pan or tilt position + uint32 ZoomPositionSupported : 1; // optional, True if the device is able to stream zoom position information + uint32 Reserved : 28; +} onvif_PTZStatusFilterOptions; + +typedef struct +{ + uint32 sizeCompressionType; // sequence of elements + char CompressionType[4][32]; // optional, List of supported metadata compression type. Its options shall be chosen from tt:MetadataCompressionType +} onvif_MetadataConfigurationOptionsExtension; + +typedef struct +{ + uint32 GeoLocation : 1; // Optional, True if the device is able to stream the Geo Located positions of each target + uint32 ExtensionFlag : 1; // Indicates whether the field Extension is valid + uint32 Reserved : 30; + + onvif_PTZStatusFilterOptions PTZStatusFilterOptions;// required, This message contains the metadata configuration options. If a metadata configuration is specified, + // the options shall concern that particular configuration. If a media profile is specified, the options shall be compatible with that media profile. + // If no tokens are specified, the options shall be considered generic for the device + onvif_MetadataConfigurationOptionsExtension Extension; // Optional +} onvif_MetadataConfigurationOptions; + +typedef struct +{ + uint32 PosFlag : 1; // Indicates whether the field Pos is valid + uint32 Reserved : 31; + + onvif_OSDPosType Type; // required, For OSD position type + + onvif_Vector Pos; // Optional, when Type is Custom, this field is valid +} onvif_OSDPosConfiguration; + + +typedef struct +{ + uint32 ColorspaceFlag : 1; // Indicates whether the field Colorspace is valid + uint32 TransparentFlag : 1; // Indicates whether the field Transparent is valid + uint32 Reserved : 30; + + float X; // required, + float Y; // required, + float Z; // required, + + int Transparent; // Optional, The value range of "Transparent" could be defined by vendors only should follow this rule: the minimum value means non-transparent and the maximum value maens fully transparent + char Colorspace[256]; // Optional, support the following colorspace + // http://www.onvif.org/ver10/colorspace/YCbCr + // http://www.onvif.org/ver10/colorspace/CIELUV + // http://www.onvif.org/ver10/colorspace/CIELAB + // http://www.onvif.org/ver10/colorspace/HSV +} onvif_OSDColor; + +typedef struct +{ + uint32 DateFormatFlag : 1; // Indicates whether the field DateFormat is valid + uint32 TimeFormatFlag : 1; // Indicates whether the field TimeFormat is valid + uint32 FontSizeFlag : 1; // Indicates whether the field FontSize is valid + uint32 FontColorFlag : 1; // Indicates whether the field FontColor is valid + uint32 BackgroundColorFlag : 1; // Indicates whether the field BackgroundColor is valid + uint32 PlainTextFlag : 1; // Indicates whether the field PlainText is valid + uint32 Reserved : 26; + + onvif_OSDTextType Type; // required, + + char DateFormat[64]; // Optional, List of supported OSD date formats. This element shall be present when the value of Type field has Date or DateAndTime. The following DateFormat are defined: + /* + M/d/yyyy - e.g. 3/6/2013 + MM/dd/yyyy - e.g. 03/06/2013 + dd/MM/yyyy - e.g. 06/03/2013 + yyyy/MM/dd - e.g. 2013/03/06 + yyyy-MM-dd - e.g. 2013-06-03 + dddd, MMMM dd, yyyy - e.g. Wednesday, March 06, 2013 + MMMM dd, yyyy - e.g. March 06, 2013 + dd MMMM, yyyy - e.g. 06 March, 2013 + */ + char TimeFormat[64]; // Optional, List of supported OSD time formats. This element shall be present when the value of Type field has Time or DateAndTime. The following TimeFormat are defined: + /* + h:mm:ss tt - e.g. 2:14:21 PM + hh:mm:ss tt - e.g. 02:14:21 PM + H:mm:ss - e.g. 14:14:21 + HH:mm:ss - e.g. 14:14:21 + */ + + int FontSize; // Optional, Font size of the text in pt + + onvif_OSDColor FontColor; // Optional, Font color of the text + onvif_OSDColor BackgroundColor; // Optional, Background color of the text + + char PlainText[256]; // Optional, The content of text to be displayed +} onvif_OSDTextConfiguration; + +typedef struct +{ + char ImgPath[256]; // required, The URI of the image which to be displayed +} onvif_OSDImgConfiguration; + +typedef struct +{ + uint32 TextStringFlag : 1; // Indicates whether the field TextString is valid + uint32 ImageFlag : 1; // Indicates whether the field Image is valid + uint32 Reserved : 30; + + char token[ONVIF_TOKEN_LEN]; // required, OSD config token + char VideoSourceConfigurationToken[ONVIF_TOKEN_LEN]; // required, Reference to the video source configuration + + onvif_OSDType Type; // required, Type of OSD + + onvif_OSDPosConfiguration Position; // required, Position configuration of OSD + onvif_OSDTextConfiguration TextString; // Optional, Text configuration of OSD. It shall be present when the value of Type field is Text + onvif_OSDImgConfiguration Image; // Optional, Image configuration of OSD. It shall be present when the value of Type field is Image +} onvif_OSDConfiguration; + +typedef struct +{ + uint32 ImageFlag : 1; // Indicates whether the field Image is valid + uint32 PlainTextFlag : 1; // Indicates whether the field PlainText is valid + uint32 DateFlag : 1; // Indicates whether the field Date is valid + uint32 TimeFlag : 1; // Indicates whether the field Time is valid + uint32 DateAndTimeFlag : 1; // Indicates whether the field DateAndTime is valid + uint32 Reserved : 27; + + int Total; // required + int Image; // optional + int PlainText; // optional + int Date; // optional + int Time; // optional + int DateAndTime; // optional +} onvif_MaximumNumberOfOSDs; + +typedef struct +{ + uint32 ColorspaceFlag : 1; // Indicates whether the field Colorspace is valid + uint32 LikelihoodFlag : 1; // Indicates whether the field Likelihood is valid + uint32 Reserved : 30; + + float X; // required, + float Y; // required, + float Z; // required, + + char Colorspace[128]; // optional, The following values are acceptable for Colourspace attribute + // http://www.onvif.org/ver10/colorspace/YCbCr - YCbCr + // http://www.onvif.org/ver10/colorspace/RGB - RGB + float Likelihood; // optional, Likelihood that the color is correct +} onvif_Color; + +typedef struct +{ + onvif_FloatRange X; // required + onvif_FloatRange Y; // required + onvif_FloatRange Z; // required + + char Colorspace[128]; // required, The following values are acceptable for Colourspace attribute + // http://www.onvif.org/ver10/colorspace/YCbCr + // http://www.onvif.org/ver10/colorspace/CIELUV + // http://www.onvif.org/ver10/colorspace/CIELAB + // http://www.onvif.org/ver10/colorspace/HSV +} onvif_ColorspaceRange; + +typedef struct +{ + uint32 sizeColorList; + onvif_Color ColorList[10]; // optional, List the supported color + + uint32 sizeColorspaceRange; + onvif_ColorspaceRange ColorspaceRange[10]; // optional, Define the rang of color supported +} onvif_ColorOptions; + +typedef struct +{ + uint32 ColorFlag : 1; // Indicates whether the field Color is valid + uint32 TransparentFlag : 1; // Indicates whether the field Transparent is valid + uint32 Reserved : 30; + + onvif_ColorOptions Color; // optional, Optional list of supported colors + onvif_IntRange Transparent; // optional, Range of the transparent level. Larger means more tranparent +} onvif_OSDColorOptions; + +typedef struct +{ + uint32 OSDTextType_Plain : 1; // Indicates whether support OSD text type plain + uint32 OSDTextType_Date : 1; // Indicates whether support OSD text type date + uint32 OSDTextType_Time : 1; // Indicates whether support OSD text type time + uint32 OSDTextType_DateAndTime : 1; // Indicates whether support OSD text type dateandtime + uint32 FontSizeRangeFlag : 1; // Indicates whether the field FontSizeRange is valid + uint32 FontColorFlag : 1; // Indicates whether the field FontColor is valid + uint32 BackgroundColorFlag : 1; // Indicates whether the field BackgroundColor is valid + uint32 Reserved : 25; + + onvif_IntRange FontSizeRange; // optional, range of the font size value + + uint32 DateFormatSize; + char DateFormat[10][64]; // optional, List of supported date format + + uint32 TimeFormatSize; + char TimeFormat[10][64]; // optional, List of supported time format + + onvif_OSDColorOptions FontColor; // optional, List of supported font color + onvif_OSDColorOptions BackgroundColor; // optional, List of supported background color +} onvif_OSDTextOptions; + +typedef struct +{ + uint32 ImagePathSize; + char ImagePath[10][256]; // required, List of avaiable uris of image +} onvif_OSDImgOptions; + +typedef struct +{ + uint32 OSDType_Text : 1; // Indicates whether support OSD text type + uint32 OSDType_Image : 1; // Indicates whether support OSD image type + uint32 OSDType_Extended : 1; // Indicates whether support OSD extended type + uint32 OSDPosType_UpperLeft : 1; // Indicates whether support OSD position UpperLeft type + uint32 OSDPosType_UpperRight : 1; // Indicates whether support OSD position UpperRight type + uint32 OSDPosType_LowerLeft : 1; // Indicates whether support OSD position LowerLeft type + uint32 OSDPosType_LowerRight : 1; // Indicates whether support OSD position LowerRight type + uint32 OSDPosType_Custom : 1; // Indicates whether support OSD position Custom type + uint32 TextOptionFlag : 1; // Indicates whether the field TextOption is valid + uint32 ImageOptionFlag : 1; // Indicates whether the field ImageOption is valid + uint32 Reserved : 22; + + onvif_MaximumNumberOfOSDs MaximumNumberOfOSDs; // required, The maximum number of OSD configurations supported for the specificate video source configuration. + // If a device limits the number of instances by OSDType, it should indicate the supported number via the related attribute + onvif_OSDTextOptions TextOption; // optional, Option of the OSD text configuration. This element shall be returned if the device is signaling the support for Text + onvif_OSDImgOptions ImageOption; // optional, Option of the OSD image configuration. This element shall be returned if the device is signaling the support for Image +} onvif_OSDConfigurationOptions; + +typedef struct +{ + uint32 spaceFlag : 1; // Indicates whether the field space is valid + uint32 reserved : 31; + + float x; // required + char space[256]; // optional +} onvif_Vector1D; + +typedef struct +{ + uint32 PanTiltFlag : 1; // Indicates whether the field PanTilt is valid + uint32 ZoomFlag : 1; // Indicates whether the field Zoom is valid + uint32 Reserved : 30; + + onvif_Vector PanTilt; // optional, Pan and tilt position. The x component corresponds to pan and the y component to tilt + onvif_Vector1D Zoom; // optional, A zoom position +} onvif_PTZVector; + +typedef struct +{ + uint32 PanTiltFlag : 1; // Indicates whether the field PanTilt is valid + uint32 ZoomFlag : 1; // Indicates whether the field Zoom is valid + uint32 Reserved : 30; + + onvif_Vector PanTilt; // optional, Pan and tilt speed. The x component corresponds to pan and the y component to tilt. If omitted in a request, the current (if any) PanTilt movement should not be affected + onvif_Vector1D Zoom; // optional, A zoom speed. If omitted in a request, the current (if any) Zoom movement should not be affected +} onvif_PTZSpeed; + +typedef struct +{ + uint32 PTZPositionFlag : 1; // Indicates whether the field PTZPosition is valid + uint32 Reserved : 31; + + char Name[ONVIF_NAME_LEN]; // required, A list of preset position name + char token[ONVIF_TOKEN_LEN]; // required + + onvif_PTZVector PTZPosition; // optional, A list of preset position +} onvif_PTZPreset; + +typedef struct +{ + onvif_FloatRange XRange; // required + onvif_FloatRange YRange; // required +} onvif_PanTiltLimits; + +typedef struct +{ + onvif_FloatRange XRange; // required +} onvif_ZoomLimits; + +typedef struct onvif_PTControlDirection +{ + uint32 EFlipFlag : 1; // Indicates whether the field EFlip is valid + uint32 ReverseFlag : 1; // Indicates whether the field Reverse is valid + uint32 Reserved : 30; + + onvif_EFlipMode EFlip; // optional, Optional element to configure related parameters for E-Flip + onvif_ReverseMode Reverse; // optional, Optional element to configure related parameters for reversing of PT Control Direction +} onvif_PTControlDirection; + +typedef struct +{ + uint32 PTControlDirectionFlag : 1; // Indicates whether the field PTControlDirection is valid + uint32 Reserved : 31; + + onvif_PTControlDirection PTControlDirection; // optional, Optional element to configure PT Control Direction related features +} onvif_PTZConfigurationExtension; + +typedef struct +{ + uint32 DefaultPTZSpeedFlag : 1; // Indicates whether the field DefaultPTZSpeed is valid + uint32 DefaultPTZTimeoutFlag : 1; // Indicates whether the field DefaultPTZTimeout is valid + uint32 PanTiltLimitsFlag : 1; // Indicates whether the field PanTiltLimits is valid + uint32 ZoomLimitsFlag : 1; // Indicates whether the field ZoomLimits is valid + uint32 ExtensionFlag : 1; // Indicates whether the field Extension is valid + uint32 MoveRampFlag : 1; // Indicates whether the field MoveRamp is valid + uint32 PresetRampFlag : 1; // Indicates whether the field PresetRamp is valid + uint32 PresetTourRampFlag : 1; // Indicates whether the field PresetTourRamp is valid + uint32 Reserved : 24; + + char Name[ONVIF_NAME_LEN]; // required + int UseCount; // required + char token[ONVIF_TOKEN_LEN]; // required + char NodeToken[ONVIF_TOKEN_LEN]; // required, A mandatory reference to the PTZ Node that the PTZ Configuration belongs to + + onvif_PTZSpeed DefaultPTZSpeed; // optional, If the PTZ Node supports absolute or relative PTZ movements, it shall specify corresponding default Pan/Tilt and Zoom speeds + int DefaultPTZTimeout; // optional, If the PTZ Node supports continuous movements, it shall specify a default timeout, after which the movement stops + onvif_PanTiltLimits PanTiltLimits; // optional, The Pan/Tilt limits element should be present for a PTZ Node that supports an absolute Pan/Tilt. If the element is present it signals the support for configurable Pan/Tilt limits. + // If limits are enabled, the Pan/Tilt movements shall always stay within the specified range. The Pan/Tilt limits are disabled by setting the limits to -INF or +INF + onvif_ZoomLimits ZoomLimits; // optional, The Zoom limits element should be present for a PTZ Node that supports absolute zoom. If the element is present it signals the supports for configurable Zoom limits. + // If limits are enabled the zoom movements shall always stay within the specified range. The Zoom limits are disabled by settings the limits to -INF and +INF + + onvif_PTZConfigurationExtension Extension; // optional + + int MoveRamp; // optional, The optional acceleration ramp used by the device when moving + int PresetRamp; // optional, The optional acceleration ramp used by the device when recalling presets + int PresetTourRamp; // optional, The optional acceleration ramp used by the device when executing PresetTours +} onvif_PTZConfiguration; + +typedef struct +{ + // Indicates which preset tour operations are available for this PTZ Node + + uint32 PTZPresetTourOperation_Start : 1; + uint32 PTZPresetTourOperation_Stop : 1; + uint32 PTZPresetTourOperation_Pause : 1; + uint32 PTZPresetTourOperation_Extended : 1; + uint32 Reserved : 28; + + int MaximumNumberOfPresetTours; // required, Indicates number of preset tours that can be created. Required preset tour operations shall be available for this PTZ Node if one or more preset tour is supported +} onvif_PTZPresetTourSupported; + +typedef struct +{ + uint32 SupportedPresetTourFlag : 1; // Indicates whether the field SupportedPresetTour is valid + uint32 Reserved : 31; + + onvif_PTZPresetTourSupported SupportedPresetTour;// optional, Detail of supported Preset Tour feature +} onvif_PTZNodeExtension; + +typedef struct +{ + char URI[256]; // required, A URI of coordinate systems. + + onvif_FloatRange XRange; // required, A range of x-axis + onvif_FloatRange YRange; // required, A range of y-axis +} onvif_Space2DDescription; + +typedef struct +{ + char URI[256]; // required, A URI of coordinate systems + + onvif_FloatRange XRange; // required, A range of x-axis +} onvif_Space1DDescription; + +typedef struct +{ + uint32 AbsolutePanTiltPositionSpaceFlag : 1; // Indicates whether the field AbsolutePanTiltPositionSpace is valid + uint32 AbsoluteZoomPositionSpaceFlag : 1; // Indicates whether the field AbsoluteZoomPositionSpace is valid + uint32 RelativePanTiltTranslationSpaceFlag : 1; // Indicates whether the field RelativePanTiltTranslationSpace is valid + uint32 RelativeZoomTranslationSpaceFlag : 1; // Indicates whether the field RelativeZoomTranslationSpace is valid + uint32 ContinuousPanTiltVelocitySpaceFlag : 1; // Indicates whether the field ContinuousPanTiltVelocitySpace is valid + uint32 ContinuousZoomVelocitySpaceFlag : 1; // Indicates whether the field ContinuousZoomVelocitySpace is valid + uint32 PanTiltSpeedSpaceFlag : 1; // Indicates whether the field PanTiltSpeedSpace is valid + uint32 ZoomSpeedSpaceFlag : 1; // Indicates whether the field ZoomSpeedSpace is valid + uint32 Reserved : 24; + + onvif_Space2DDescription AbsolutePanTiltPositionSpace; // optional, The Generic Pan/Tilt Position space is provided by every PTZ node that supports absolute Pan/Tilt, since it does not relate to a specific physical range. + // Instead, the range should be defined as the full range of the PTZ unit normalized to the range -1 to 1 resulting in the following space description + onvif_Space1DDescription AbsoluteZoomPositionSpace; // optional, The Generic Zoom Position Space is provided by every PTZ node that supports absolute Zoom, since it does not relate to a specific physical range. + // Instead, the range should be defined as the full range of the Zoom normalized to the range 0 (wide) to 1 (tele). + // There is no assumption about how the generic zoom range is mapped to magnification, FOV or other physical zoom dimension + onvif_Space2DDescription RelativePanTiltTranslationSpace;// optional, The Generic Pan/Tilt translation space is provided by every PTZ node that supports relative Pan/Tilt, since it does not relate to a specific physical range. + // Instead, the range should be defined as the full positive and negative translation range of the PTZ unit normalized to the range -1 to 1, + // where positive translation would mean clockwise rotation or movement in right/up direction resulting in the following space description + onvif_Space1DDescription RelativeZoomTranslationSpace; // optional, The Generic Zoom Translation Space is provided by every PTZ node that supports relative Zoom, since it does not relate to a specific physical range. + // Instead, the corresponding absolute range should be defined as the full positive and negative translation range of the Zoom normalized to the range -1 to1, + // where a positive translation maps to a movement in TELE direction. The translation is signed to indicate direction (negative is to wide, positive is to tele). + // There is no assumption about how the generic zoom range is mapped to magnification, FOV or other physical zoom dimension. This results in the following space description + onvif_Space2DDescription ContinuousPanTiltVelocitySpace; // optional, The generic Pan/Tilt velocity space shall be provided by every PTZ node, since it does not relate to a specific physical range. + // Instead, the range should be defined as a range of the PTZ unit's speed normalized to the range -1 to 1, where a positive velocity would map to clockwise + // rotation or movement in the right/up direction. A signed speed can be independently specified for the pan and tilt component resulting in the following space description + onvif_Space1DDescription ContinuousZoomVelocitySpace; // optional, The generic zoom velocity space specifies a zoom factor velocity without knowing the underlying physical model. The range should be normalized from -1 to 1, + // where a positive velocity would map to TELE direction. A generic zoom velocity space description resembles the following + onvif_Space1DDescription PanTiltSpeedSpace; // optional, The speed space specifies the speed for a Pan/Tilt movement when moving to an absolute position or to a relative translation. + // In contrast to the velocity spaces, speed spaces do not contain any directional information. The speed of a combined Pan/Tilt + // movement is represented by a single non-negative scalar value + onvif_Space1DDescription ZoomSpeedSpace; // optional, The speed space specifies the speed for a Zoom movement when moving to an absolute position or to a relative translation. + // In contrast to the velocity spaces, speed spaces do not contain any directional information +} onvif_PTZSpaces; + +typedef struct +{ + uint32 NameFlag : 1; // Indicates whether the field Name is valid + uint32 ExtensionFlag : 1; // Indicates whether the field Extension is valid + uint32 Reserved : 30; + + char token[ONVIF_TOKEN_LEN]; // required + char Name[ONVIF_NAME_LEN]; // optional, A unique identifier that is used to reference PTZ Nodes + + onvif_PTZSpaces SupportedPTZSpaces; // required, A list of Coordinate Systems available for the PTZ Node. For each Coordinate System, the PTZ Node MUST specify its allowed range + + int MaximumNumberOfPresets; // required, All preset operations MUST be available for this PTZ Node if one preset is supported + BOOL HomeSupported; // required, A boolean operator specifying the availability of a home position. If set to true, the Home Position Operations MUST be available for this PTZ Node + + onvif_PTZNodeExtension Extension; // optional + + BOOL FixedHomePosition; // optional, Indication whether the HomePosition of a Node is fixed or it can be changed via the SetHomePosition command + BOOL GeoMove; // optional, Indication whether the Node supports the geo-referenced move command + + uint32 sizeAuxiliaryCommands; // sequence of elements + char AuxiliaryCommands[10][64]; // optional +} onvif_PTZNode; + + +typedef struct +{ + // Supported options for EFlip feature + uint32 EFlipMode_OFF : 1; + uint32 EFlipMode_ON : 1; + uint32 EFlipMode_Extended : 1; + + // Supported options for Reverse feature + uint32 ReverseMode_OFF : 1; + uint32 ReverseMode_ON : 1; + uint32 ReverseMode_AUTO : 1; + uint32 ReverseMode_Extended : 1; + uint32 Reserved : 25; +} onvif_PTControlDirectionOptions; + +typedef struct +{ + uint32 PTControlDirectionFlag : 1; // Indicates whether the field PTControlDirection is valid + uint32 Reserved : 31; + + onvif_PTZSpaces Spaces; // required, + onvif_IntRange PTZTimeout; // required, A timeout Range within which Timeouts are accepted by the PTZ Node + onvif_PTControlDirectionOptions PTControlDirection; // optional, +} onvif_PTZConfigurationOptions; + +typedef struct +{ + uint32 PanTiltFlag : 1; // Indicates whether the field PanTilt is valid + uint32 ZoomFlag : 1; // Indicates whether the field Zoom is valid + uint32 Reserved : 30; + + onvif_MoveStatus PanTilt; // optional + onvif_MoveStatus Zoom; // optional +} onvif_PTZMoveStatus; + +typedef struct +{ + uint32 PositionFlag : 1; // Indicates whether the field Position is valid + uint32 MoveStatusFlag : 1; // Indicates whether the field MoveStatus is valid + uint32 ErrorFlag : 1; // Indicates whether the field MoveStatus is valid + uint32 Reserved : 29; + + onvif_PTZVector Position; // optional, Specifies the absolute position of the PTZ unit together with the Space references. The default absolute spaces of the corresponding PTZ configuration MUST be referenced within the Position element + onvif_PTZMoveStatus MoveStatus; // optional, Indicates if the Pan/Tilt/Zoom device unit is currently moving, idle or in an unknown state + + char Error[100]; // optional, States a current PTZ error + time_t UtcTime; // required, Specifies the UTC time when this status was generated +} onvif_PTZStatus; + + +typedef struct +{ + uint32 PresetTokenFlag : 1; // Indicates whether the field PresetToken is valid + uint32 HomeFlag : 1; // Indicates whether the field Home is valid + uint32 PTZPositionFlag : 1; // Indicates whether the field PTZPosition is valid + uint32 Reserved : 29; + + char PresetToken[ONVIF_TOKEN_LEN]; // optional, Option to specify the preset position with Preset Token defined in advance + BOOL Home; // optional, Option to specify the preset position with the home position of this PTZ Node. "False" to this parameter shall be treated as an invalid argument + + onvif_PTZVector PTZPosition; // optional, Option to specify the preset position with vector of PTZ node directly +} onvif_PTZPresetTourPresetDetail; + +typedef struct +{ + uint32 SpeedFlag : 1; // Indicates whether the field Speed is valid + uint32 StayTimeFlag : 1; // Indicates whether the field StayTime is valid + uint32 Reserved : 30; + + onvif_PTZPresetTourPresetDetail PresetDetail; // required, Detail definition of preset position of the tour spot + onvif_PTZSpeed Speed; // optional, Optional parameter to specify Pan/Tilt and Zoom speed on moving toward this tour spot + + int StayTime; // optional, Optional parameter to specify time duration of staying on this tour sport +} onvif_PTZPresetTourSpot; + +typedef struct _PTZPresetTourSpotList +{ + struct _PTZPresetTourSpotList * next; + + onvif_PTZPresetTourSpot PTZPresetTourSpot; +} PTZPresetTourSpotList; + +typedef struct +{ + uint32 CurrentTourSpotFlag : 1; // Indicates whether the field CurrentTourSpot is valid + uint32 Reserved : 31; + + onvif_PTZPresetTourState State; // required, Indicates state of this preset tour by Idle/Touring/Paused + onvif_PTZPresetTourSpot CurrentTourSpot; // optional, Indicates a tour spot currently staying +} onvif_PTZPresetTourStatus; + +typedef struct +{ + uint32 RecurringTimeFlag : 1; // Indicates whether the field RecurringTime is valid + uint32 RecurringDurationFlag : 1; // Indicates whether the field RecurringDuration is valid + uint32 DirectionFlag : 1; // Indicates whether the field Direction is valid + uint32 RandomPresetOrderFlag : 1; // Indicates whether the field RandomPresetOrder is valid + uint32 Reserved : 28; + + int RecurringTime; // optional, Optional parameter to specify how many times the preset tour is recurred + int RecurringDuration; // optional, Optional parameter to specify how long time duration the preset tour is recurred + + onvif_PTZPresetTourDirection Direction; // optional, Optional parameter to choose which direction the preset tour goes. Forward shall be chosen in case it is omitted + + BOOL RandomPresetOrder; // optional, Execute presets in random order. If set to true and Direction is also present, Direction will be ignored and presets of the Tour will be recalled randomly +} onvif_PTZPresetTourStartingCondition; + +typedef struct +{ + char Name[ONVIF_NAME_LEN]; // optional, Readable name of the preset tour + char token[ONVIF_TOKEN_LEN]; // required, Unique identifier of this preset tour + + BOOL AutoStart; // required, Auto Start flag of the preset tour. True allows the preset tour to be activated always + + onvif_PTZPresetTourStatus Status; // required, Read only parameters to indicate the status of the preset tour + + onvif_PTZPresetTourStartingCondition StartingCondition; // required, Parameters to specify the detail behavior of the preset tour + + PTZPresetTourSpotList * TourSpot; // optional, A list of detail of touring spots including preset positions + +} onvif_PresetTour; + +typedef struct +{ + int Min; // required, unit is second + int Max; // required, unit is second +} onvif_DurationRange; + +typedef struct +{ + uint32 RecurringTimeFlag : 1; // Indicates whether the field RecurringTime is valid + uint32 RecurringDurationFlag : 1; // Indicates whether the field RecurringDuration is valid + uint32 PTZPresetTourDirection_Forward : 1; // + uint32 PTZPresetTourDirection_Backward : 1; // + uint32 PTZPresetTourDirection_Extended : 1; // + uint32 Reserved : 27; + + onvif_IntRange RecurringTime; // optional, Supported range of Recurring Time + onvif_DurationRange RecurringDuration; // optional, Supported range of Recurring Duration +} onvif_PTZPresetTourStartingConditionOptions; + +typedef struct +{ + uint32 HomeFlag : 1; // Indicates whether the field Home is valid + uint32 PanTiltPositionSpaceFlag : 1; // Indicates whether the field PanTiltPositionSpace is valid + uint32 ZoomPositionSpaceFlag : 1; // Indicates whether the field ZoomPositionSpace is valid + uint32 Reserved : 29; + + uint32 sizePresetToken; + char PresetToken[MAX_PTZ_PRESETS][ONVIF_TOKEN_LEN]; // optional, A list of available Preset Tokens for tour spots + + BOOL Home; // optional, An option to indicate Home postion for tour spots + + onvif_Space2DDescription PanTiltPositionSpace; // optional, Supported range of Pan and Tilt for tour spots + onvif_Space1DDescription ZoomPositionSpace; // optional, Supported range of Zoom for a tour spot +} onvif_PTZPresetTourPresetDetailOptions; + +typedef struct +{ + onvif_PTZPresetTourPresetDetailOptions PresetDetail; // required, Supported options for detail definition of preset position of the tour spot + onvif_DurationRange StayTime; // required, Supported range of stay time for a tour spot +} onvif_PTZPresetTourSpotOptions; + +typedef struct +{ + BOOL AutoStart; // required, Indicates whether or not the AutoStart is supported + + onvif_PTZPresetTourStartingConditionOptions StartingCondition; // required, Supported options for Preset Tour Starting Condition + onvif_PTZPresetTourSpotOptions TourSpot; // required, Supported options for Preset Tour Spot +} onvif_PTZPresetTourOptions; + + +typedef struct +{ + uint32 NameFlag : 1; // Indicates whether the field Name is valid + uint32 MTUFlag : 1; // Indicates whether the field MTU is valid + uint32 Reserved : 30; + + char Name[ONVIF_NAME_LEN]; // optional, Network interface name, for example eth0 + char HwAddress[32]; // required, Network interface MAC address + int MTU; // optional, Maximum transmission unit +} onvif_NetworkInterfaceInfo; + +typedef struct +{ + char Address[32]; // required + int PrefixLength; // required + + BOOL DHCP; // required, Indicates whether or not DHCP is used +} onvif_IPv4Configuration; + +typedef struct +{ + BOOL Enabled; // required, Indicates whether or not IPv4 is enabled + + onvif_IPv4Configuration Config; // required, IPv4 configuration +} onvif_IPv4NetworkInterface; + +typedef struct +{ + uint32 KeyFlag : 1; // Indicates whether the field Key is valid + uint32 PassphraseFlag : 1; // Indicates whether the field Passphrase is valid + uint32 Reserved : 30; + + char Key[256]; // optional, hexBinary, + // According to IEEE802.11-2007 H.4.1 the RSNA PSK consists of 256 bits, + // or 64 octets when represented in hex + // Either Key or Passphrase shall be given, + // if both are supplied Key shall be used by the device and Passphrase ignored. + char Passphrase[128]; // optional, + // According to IEEE802.11-2007 H.4.1 a pass-phrase is + // a sequence of between 8 and 63 ASCII-encoded characters and + // each character in the pass-phrase must have an encoding in the range of 32 to 126 (decimal),inclusive. + // If only Passpharse is supplied the Key shall be derived using the algorithm described in + // IEEE802.11-2007 section H.4 +} onvif_Dot11PSKSet; + +typedef struct +{ + uint32 AlgorithmFlag : 1; // Indicates whether the field Algorithm is valid + uint32 PSKFlag : 1; // Indicates whether the field PSK is valid + uint32 Dot1XFlag : 1; // // Indicates whether the field Dot1X is valid + uint32 Reserved : 29; + + onvif_Dot11SecurityMode Mode; // required + onvif_Dot11Cipher Algorithm; // optional + onvif_Dot11PSKSet PSK; // optional + + char Dot1X[ONVIF_TOKEN_LEN]; // optional +} onvif_Dot11SecurityConfiguration; + +typedef struct +{ + char SSID[32]; // required, hexBinary + + onvif_Dot11StationMode Mode; // required + + char Alias[32]; // required + int Priority; // required, range is 0-31 + + onvif_Dot11SecurityConfiguration Security; // required element of type ns2:Dot11SecurityConfiguration */ +} onvif_Dot11Configuration; + +typedef struct +{ + int InterfaceType; // required, tt:IANA-IfTypes, Integer indicating interface type, for example: 6 is ethernet + // ieee80211(71) + // For valid numbers, please refer to http://www.iana.org/assignments/ianaiftype-mib + uint32 sizeDot11; // sequence of elements + onvif_Dot11Configuration Dot11[4]; // optional +} onvif_NetworkInterfaceExtension; + +typedef struct +{ + uint32 InfoFlag : 1; // Indicates whether the field Info is valid + uint32 IPv4Flag : 1; // Indicates whether the field IPv4 is valid + uint32 ExtensionFlag : 1; // Indicates whether the field Extension is valid + uint32 Reserved : 29; + + char token[ONVIF_TOKEN_LEN]; // required + BOOL Enabled; // required, Indicates whether or not an interface is enabled + + onvif_NetworkInterfaceInfo Info; // optional, Network interface information + onvif_IPv4NetworkInterface IPv4; // optional, IPv4 network interface configuration + onvif_NetworkInterfaceExtension Extension; // optional, +} onvif_NetworkInterface; + +typedef struct +{ + BOOL HTTPFlag; // Indicates if the http protocol required + BOOL HTTPEnabled; // Indicates if the http protocol is enabled or not + BOOL HTTPSFlag; // Indicates if the https protocol required + BOOL HTTPSEnabled; // Indicates if the https protocol is enabled or not + BOOL RTSPFlag; // Indicates if the rtsp protocol required + BOOL RTSPEnabled; // Indicates if the rtsp protocol is enabled or not + + int HTTPPort[MAX_SERVER_PORT]; // The port that is used by the protocol + int HTTPSPort[MAX_SERVER_PORT]; // The port that is used by the protocol + int RTSPPort[MAX_SERVER_PORT]; // The port that is used by the protocol +} onvif_NetworkProtocol; + +typedef struct +{ + uint32 SearchDomainFlag : 1; // Indicates whether the field SearchDomain is valid + uint32 Reserved : 31; + + BOOL FromDHCP; // required, Indicates whether or not DNS information is retrieved from DHCP + char SearchDomain[MAX_SEARCHDOMAIN][64]; // optional, Search domain + char DNSServer[MAX_DNS_SERVER][32]; // required +} onvif_DNSInformation; + +typedef struct +{ + uint32 NameFlag : 1; // Indicates whether the field Name is valid + uint32 TTLFlag : 1; // Indicates whether the field TTL is valid + uint32 Reserved : 30; + + onvif_DynamicDNSType Type; // required, Dynamic DNS type + + char Name[ONVIF_NAME_LEN]; // optional, DNS name + int TTL; // optional, DNS record time to live +} onvif_DynamicDNSInformation; + +typedef struct +{ + BOOL FromDHCP; // required, Indicates if NTP information is to be retrieved by using DHCP + char NTPServer[MAX_NTP_SERVER][32]; // required +} onvif_NTPInformation; + +typedef struct +{ + uint32 NameFlag : 1; // Indicates whether the field Name is valid + uint32 Reserved : 31; + + BOOL FromDHCP; // required, Indicates whether the hostname is obtained from DHCP or not + BOOL RebootNeeded; // required, Indicates whether or not a reboot is required after configuration updates + char Name[ONVIF_NAME_LEN]; // optional, Indicates the hostname +} onvif_HostnameInformation; + +typedef struct +{ + char IPv4Address[MAX_GATEWAY][32]; // required, IPv4 address string +} onvif_NetworkGateway; + +typedef struct +{ + char InterfaceToken[ONVIF_TOKEN_LEN]; // required, Unique identifier of network interface + BOOL Enabled; // required, Indicates whether the zero-configuration is enabled or not + uint32 sizeAddresses; // sequence of elements + char Addresses[4][32]; // optional, The zero-configuration IPv4 address(es) +} onvif_NetworkZeroConfiguration; + +typedef struct +{ + char Uri[ONVIF_URI_LEN]; // required + BOOL InvalidAfterConnect; // required + BOOL InvalidAfterReboot; // required + int Timeout; // required, unit is second +} onvif_MediaUri; + +typedef struct +{ + uint32 BSSIDFlag : 1; + uint32 PairCipherFlag : 1; + uint32 GroupCipherFlag : 1; + uint32 SignalStrengthFlag : 1; + uint32 Reserved : 28; + + char SSID[32]; // required, hexBinary + char BSSID[64]; // optional + + onvif_Dot11Cipher PairCipher; // optional + onvif_Dot11Cipher GroupCipher; // optional + onvif_Dot11SignalStrength SignalStrength; // optional + + char ActiveConfigAlias[32]; // required +} onvif_Dot11Status; + +typedef struct +{ + uint32 BSSIDFlag : 1; + uint32 SignalStrengthFlag : 1; + uint32 Reserved : 30; + + char SSID[32]; // required, hexBinary + char BSSID[64]; // optional + + uint32 sizeAuthAndMangementSuite; // sequence of elements + onvif_Dot11AuthAndMangementSuite AuthAndMangementSuite[4]; // optional + + uint32 sizePairCipher; // sequence of elements + onvif_Dot11Cipher PairCipher[4]; // optional + + uint32 sizeGroupCipher; // sequence of elements + onvif_Dot11Cipher GroupCipher[4]; // optional + + onvif_Dot11SignalStrength SignalStrength; // optional +} onvif_Dot11AvailableNetworks; + +typedef struct _Dot11AvailableNetworksList +{ + struct _Dot11AvailableNetworksList * next; + + onvif_Dot11AvailableNetworks Networks; +} Dot11AvailableNetworksList; + +typedef struct +{ + char TZ[128]; // required, Posix timezone string +} onvif_TimeZone; + +typedef struct +{ + int Hour; // Range is 0 to 23 + int Minute; // Range is 0 to 59 + int Second; // Range is 0 to 61 (typically 59) +} onvif_Time; + +typedef struct +{ + int Year; // + int Month; // Range is 1 to 12 + int Day; // Range is 1 to 31 +} onvif_Date; + +typedef struct +{ + onvif_Time Time; // required + onvif_Date Date; // required +} onvif_DateTime; + +typedef struct +{ + uint32 TimeZoneFlag : 1; // Indicates whether the field TimeZone is valid + uint32 Reserved : 31; + + BOOL DaylightSavings; // required, Informative indicator whether daylight savings is currently on/off + + onvif_SetDateTimeType DateTimeType; // required, Indicates if the time is set manully or through NTP + onvif_TimeZone TimeZone; // optional, Timezone information in Posix format +} onvif_SystemDateTime; + +typedef struct +{ + onvif_ScopeDefinition ScopeDef; // required + + char ScopeItem[128]; // required +} onvif_Scope; + +typedef struct +{ + uint32 lonFlag : 1; // Indicates whether the field lon is valid + uint32 latFlag : 1; // Indicates whether the field lat is valid + uint32 elevationFlag : 1; // Indicates whether the field elevation is valid + uint32 Reserved : 29; + + double lon; // optional, East west location as angle + double lat; // optional, North south location as angle + float elevation; // optional, Hight in meters above sea level +} onvif_GeoLocation; + +typedef struct +{ + uint32 rollFlag : 1; // Indicates whether the field roll is valid + uint32 pitchFlag : 1; // Indicates whether the field pitch is valid + uint32 yawFlag : 1; // Indicates whether the field yaw is valid + uint32 Reserved : 29; + + float roll; // optional, Rotation around the x axis + float pitch; // optional, Rotation around the y axis + float yaw; // optional, Rotation around the z axis +} onvif_GeoOrientation; + +typedef struct +{ + uint32 xFlag : 1; // Indicates whether the field x is valid + uint32 yFlag : 1; // Indicates whether the field y is valid + uint32 zFlag : 1; // Indicates whether the field z is valid + uint32 Reserved : 29; + + float x; // optional, East west location as angle + float y; // optional, North south location as angle + float z; // optional, Offset in meters from the sea level +} onvif_LocalLocation; + +typedef struct +{ + uint32 panFlag : 1; // Indicates whether the field pan is valid + uint32 tiltFlag : 1; // Indicates whether the field tilt is valid + uint32 rollFlag : 1; // Indicates whether the field roll is valid + uint32 Reserved : 29; + + float pan; // optional, Rotation around the y axis + float tilt; // optional, Rotation around the z axis + float roll; // optional, Rotation around the x axis +} onvif_LocalOrientation; + +typedef struct +{ + uint32 GeoLocationFlag : 1; // Indicates whether the field GeoLocation is valid + uint32 GeoOrientationFlag : 1; // Indicates whether the field GeoOrientation is valid + uint32 LocalLocationFlag : 1; // Indicates whether the field LocalLocation is valid + uint32 LocalOrientationFlag : 1; // Indicates whether the field LocalOrientation is valid + uint32 EntityFlag : 1; // Indicates whether the field Entity is valid + uint32 TokenFlag : 1; // Indicates whether the field Token is valid + uint32 FixedFlag : 1; // Indicates whether the field Fixed is valid + uint32 GeoSourceFlag : 1; // Indicates whether the field GeoSource is valid + uint32 AutoGeoFlag : 1; // Indicates whether the field AutoGeo is valid + uint32 Reserved : 23; + + onvif_GeoLocation GeoLocation; // optional, Location on earth + onvif_GeoOrientation GeoOrientation; // optional, Orientation relative to earth + onvif_LocalLocation LocalLocation; // optional, Indoor location offset + onvif_LocalOrientation LocalOrientation; // optional, Indoor orientation offset + + char Entity[200]; // optional, Entity type the entry refers to as defined in tds:Entity + char Token[ONVIF_TOKEN_LEN]; // optional, Optional entity token + BOOL Fixed; // optional, If this value is true the entity cannot be deleted + char GeoSource[256]; // optional, Optional reference to the XAddr of another devices DeviceManagement service + BOOL AutoGeo; // optional, If set the geo location is obtained internally +} onvif_LocationEntity; + +typedef struct _LocationEntityList +{ + struct _LocationEntityList * next; + + onvif_LocationEntity Location; +} LocationEntityList; + +typedef struct +{ + char * ptr; // required, need call free to free the buffer + int size; // required, the ptr buffer length +} onvif_base64Binary; + +typedef struct +{ + uint32 contentTypeFlag : 1; // Indicates whether the field contentType is valid + uint32 Reserved : 31; + + onvif_base64Binary Data; // required, base64 encoded binary data + char contentType[100]; // optional +} onvif_BinaryData; + +typedef struct +{ + uint32 PasswordFlag : 1; // Indicates whether the field Password is valid + uint32 Reserved : 31; + + char UserName[64]; // required, User name + char Password[64]; // optional, optional password +} onvif_UserCredential; + +typedef struct +{ + uint32 LocalPathFlag : 1; // Indicates whether the field LocalPath is valid + uint32 StorageUriFlag : 1; // Indicates whether the field StorageUri is valid + uint32 UserFlag : 1; // Indicates whether the field User is valid + uint32 RegionFlag : 1; // Indicates whether the field Region is valid + uint32 Reserved : 28; + + char LocalPath[256]; // optional, local path + char StorageUri[256]; // optional, Storage server address + + onvif_UserCredential User; // optional, User credential for the storage server + + char type[100]; // required, StorageType lists the acceptable values for type attribute + // NFS, CIFS, CDMI, FTP, ObjectStorageS3, ObjectStorageAzure + char Region[100]; // optinal, Optional region of the storage server +} onvif_StorageConfigurationData; + +typedef struct +{ + char token[ONVIF_TOKEN_LEN]; // required + onvif_StorageConfigurationData Data; // required +} onvif_StorageConfiguration; + +typedef struct _StorageConfigurationList +{ + struct _StorageConfigurationList *next; + + onvif_StorageConfiguration Configuration; +} StorageConfigurationList; + +typedef struct +{ + onvif_TransportProtocol Protocol; // required, Defines the network protocol for streaming, either UDP=RTP/UDP, RTSP=RTP/RTSP/TCP or HTTP=RTP/RTSP/HTTP/TCP +} onvif_Transport; + +typedef struct +{ + onvif_StreamType Stream; // required, Defines if a multicast or unicast stream is requested + onvif_Transport Transport; // required +} onvif_StreamSetup; + +typedef struct +{ + int SessionTimeout; // required, The RTSP session timeout, unit is second +} onvif_ReplayConfiguration; + +typedef struct +{ + char SourceId[128]; // required, Identifier for the source chosen by the client that creates the structure. + // This identifier is opaque to the device. Clients may use any type of URI for this field. A device shall support at least 128 characters + char Name[ONVIF_NAME_LEN]; // required, Informative user readable name of the source, e.g. "Camera23". A device shall support at least 20 characters + char Location[100]; // required, Informative description of the physical location of the source, e.g. the coordinates on a map + char Description[128]; // required, Informative description of the source + char Address[128]; // required, URI provided by the service supplying data to be recorded. A device shall support at least 128 characters +} onvif_RecordingSourceInformation; + +typedef struct +{ + uint32 KeyFlag : 1; // Indicates whether the field Key is valid + uint32 Reserved : 31; + + char KID[64]; // required, Key ID of the associated key for encryption + char Key[1024]; // optional element of type xsd:hexBinary, Key for encrypting content.The device shall not include this parameter when reading + uint32 sizeTrack; // sequence of elements + char Track[4][32]; // optional, Optional list of track tokens to be encrypted + // If no track tokens are specified, all tracks are encrypted and + // no other encryption configurations shall exist for the recording. + // Each track shall only be contained in one encryption configuration. + char Mode[32]; // required, Mode of encryption. See tt:EncryptionMode for a list of definitions and capability trc:SupportedEncryptionModes for the supported encryption modes + // CENC - AES-CTR mode full sample and video NAL Subsample encryption, defined in ISO/IEC 23001-7 + // CBCS - AES-CBC mode partial video NAL pattern encryption, defined in ISO/IEC 23001-7 +} onvif_RecordingEncryption; + +typedef struct +{ + uint32 PrefixFlag : 1; // Indicates whether the field Prefix is valid + uint32 PostfixFlag : 1; // Indicates whether the field Postfix is valid + uint32 SpanDurationFlag : 1; // Indicates whether the field SpanDuration is valid + uint32 SegmentDurationFlag : 1; // Indicates whether the field SegmentDuration is valid + uint32 Reserved : 28; + + char Storage[ONVIF_TOKEN_LEN]; // required , Token of a storage configuration + char Format[32]; // required , Format of the recording.See tt:TargetFormat for a list of definitions and capability trc:SupportedTargetFormats for the supported formats. + // MP4 - MP4 files with all tracks in a single file + // CMAF - CMAF compliant MP4 files with 1 track per file + char Prefix[64]; // optional, Path prefix to be inserted in the object key + char Postfix[64]; // optional, Path postfix to be inserted in the object key + uint32 SpanDuration; // optional, Maximum duration of a span, unit is second + uint32 SegmentDuration; // external, Maximum duration of a segment, unit is second + + uint32 sizeEncryption; // sequence of elements + onvif_RecordingEncryption Encryption[4]; // optional, Optional encryption configuration. + // See capability trc:EncryptionEntryLimit for the number of supported entries. + // By specifying multiple encryption entries per recording, different tracks + // can be encrypted with different configurations. + // Each track shall only be contained in one encryption configuration. +} onvif_RecordingTargetConfiguration; + +typedef struct +{ + uint32 MaximumRetentionTimeFlag : 1; // Indicates whether the field MaximumRetentionTime is valid + uint32 TargetFlag : 1; // Indicates whether the field Target is valid + uint32 Reserved : 30; + + onvif_RecordingSourceInformation Source; // required, Information about the source of the recording + char Content[256]; // required, Informative description of the source + uint32 MaximumRetentionTime; // optional, specifies the maximum time that data in any track within the + // recording shall be stored. The device shall delete any data older than the maximum retention + // time. Such data shall not be accessible anymore. If the MaximumRetentionPeriod is set to 0, + // the device shall not limit the retention time of stored data, except by resource constraints. + // Whatever the value of MaximumRetentionTime, the device may automatically delete + // recordings to free up storage space for new recordings. + // unit is second + onvif_RecordingTargetConfiguration Target; // optional, Optional external storage target configuration +} onvif_RecordingConfiguration; + +typedef struct +{ + onvif_TrackType TrackType; // required, Type of the track. It shall be equal to the strings "Video", "Audio" or "Metadata" + + char Description[100]; // required, Informative description of the track +} onvif_TrackConfiguration; + +typedef struct +{ + uint32 TypeFlag : 1; // Indicates whether the field Type is valid + uint32 Reserved : 31; + + char Token[ONVIF_TOKEN_LEN]; // required, + char Type[256]; // optional, default is "http://www.onvif.org/ver10/schema/Receiver", "http://www.onvif.org/ver10/schema/Profile" +} onvif_SourceReference; + +typedef struct +{ + char SourceTag[64]; // required, If the received RTSP stream contains multiple tracks of the same type, the + // SourceTag differentiates between those Tracks. This field can be ignored in case of recording a local source + char Destination[ONVIF_TOKEN_LEN]; // required, The destination is the tracktoken of the track to which the device shall store the received data +} onvif_RecordingJobTrack; + +typedef struct +{ + uint32 SourceTokenFlag : 1; // Indicates whether the field SourceToken is valid + uint32 AutoCreateReceiverFlag : 1; // Indicates whether the field AutoCreateReceiver is valid + uint32 Reserved : 30; + + onvif_SourceReference SourceToken; // optional, This field shall be a reference to the source of the data. The type of the source + // is determined by the attribute Type in the SourceToken structure. If Type is + // http://www.onvif.org/ver10/schema/Receiver, the token is a ReceiverReference. In this case + // the device shall receive the data over the network. If Type is + // http://www.onvif.org/ver10/schema/Profile, the token identifies a media profile, instructing the + // device to obtain data from a profile that exists on the local device + BOOL AutoCreateReceiver; // optional, If this field is TRUE, and if the SourceToken is omitted, the device + // shall create a receiver object (through the receiver service) and assign the + // ReceiverReference to the SourceToken field. When retrieving the RecordingJobConfiguration + // from the device, the AutoCreateReceiver field shall never be present + + uint32 sizeTracks; + + onvif_RecordingJobTrack Tracks[5]; // optional, List of tracks associated with the recording +} onvif_RecordingJobSource; + +typedef struct +{ + char RecordingToken[ONVIF_TOKEN_LEN]; // required, Identifies the recording to which this job shall store the received data + char Mode[16]; // required, The mode of the job. If it is idle, nothing shall happen. If it is active, the device shall try to obtain data from the receivers. + // A client shall use GetRecordingJobState to determine if data transfer is really taking place + // The only valid values for Mode shall be "Idle" or "Active" + int Priority; // required, This shall be a non-negative number. If there are multiple recording jobs that store data to + // the same track, the device will only store the data for the recording job with the highest + // priority. The priority is specified per recording job, but the device shall determine the priority + // of each track individually. If there are two recording jobs with the same priority, the device + // shall record the data corresponding to the recording job that was activated the latest + uint32 sizeSource; + onvif_RecordingJobSource Source[5]; // optional, Source of the recording + + char ScheduleToken[ONVIF_TOKEN_LEN]; // optional, This attribute adds an additional requirement for activating the recording job. + // If this optional field is provided the job shall only record if the schedule exists and is active. +} onvif_RecordingJobConfiguration; + +typedef struct +{ + uint32 ErrorFlag : 1; // Indicates whether the field Error is valid + uint32 Reserved : 31; + + char SourceTag[64]; // required, Identifies the track of the data source that provides the data + char Destination[ONVIF_TOKEN_LEN]; // required, Indicates the destination track + char Error[100]; // optional, Optionally holds an implementation defined string value that describes the error. The string should be in the English language + char State[16]; // required, Provides the job state of the track. + // The valid values of state shall be "Idle", "Active" and "Error". If state equals "Error", the Error field may be filled in with an implementation defined value +} onvif_RecordingJobStateTrack; + +typedef struct +{ + onvif_SourceReference SourceToken; // required, Identifies the data source of the recording job + char State[16]; // required, Holds the aggregated state over all substructures of RecordingJobStateSource + // Idle : All state values in sub-nodes are "Idle" + // PartiallyActive : The state of some sub-nodes are "active" and some sub-nodes are "idle" + // Active : The state of all sub-nodes is "Active" + // Error : At least one of the sub-nodes has state "Error" + uint32 sizeTrack; + + onvif_RecordingJobStateTrack Track[5]; // optional, +} onvif_RecordingJobStateSource; + +typedef struct +{ + char RecordingToken[ONVIF_TOKEN_LEN]; // required, Identification of the recording that the recording job records to + char State[16]; // required, Holds the aggregated state over the whole RecordingJobInformation structure + // Idle : All state values in sub-nodes are "Idle" + // PartiallyActive : The state of some sub-nodes are "active" and some sub-nodes are "idle" + // Active : The state of all sub-nodes is "Active" + // Error : At least one of the sub-nodes has state "Error" + + uint32 sizeSources; + + onvif_RecordingJobStateSource Sources[5]; // optional, Identifies the data source of the recording job +} onvif_RecordingJobStateInformation; + +typedef struct +{ + uint32 SpareFlag : 1; // Indicates whether the field Spare is valid + uint32 CompatibleSourcesFlag : 1; // Indicates whether the field CompatibleSources is valid + uint32 Reserved : 30; + + int Spare; // optional, Number of spare jobs that can be created for the recording + char CompatibleSources[160]; // optional, A device that supports recording of a restricted set of Media Service Profiles returns the list of profiles that can be recorded on the given Recording +} onvif_JobOptions; + +typedef struct +{ + uint32 SpareTotalFlag : 1; // Indicates whether the field SpareTotal is valid + uint32 SpareVideoFlag : 1; // Indicates whether the field SpareVideo is valid + uint32 SpareAudioFlag : 1; // Indicates whether the field SpareAudio is valid + uint32 SpareMetadataFlag : 1; // Indicates whether the field SpareMetadata is valid + uint32 Reserved : 28; + + int SpareTotal; // optional, Total spare number of tracks that can be added to this recording + int SpareVideo; // optional, Number of spare Video tracks that can be added to this recording + int SpareAudio; // optional, Number of spare Aduio tracks that can be added to this recording + int SpareMetadata; // optional, Number of spare Metadata tracks that can be added to this recording +} onvif_TrackOptions; + +typedef struct +{ + onvif_JobOptions Job; // required, + onvif_TrackOptions Track; // required, +} onvif_RecordingOptions; + +typedef struct +{ + char TrackToken[ONVIF_TOKEN_LEN]; // required + + onvif_TrackConfiguration Configuration; // required +} onvif_Track; + +typedef struct _TrackList +{ + struct _TrackList * next; + + onvif_Track Track; +} TrackList; + +typedef struct +{ + char RecordingToken[ONVIF_TOKEN_LEN]; // required + + onvif_RecordingConfiguration Configuration; // required + + TrackList * Tracks; +} onvif_Recording; + +typedef struct +{ + char JobToken[ONVIF_TOKEN_LEN]; // required + + onvif_RecordingJobConfiguration JobConfiguration; // required +} onvif_RecordingJob; + +typedef struct +{ + char Name[ONVIF_NAME_LEN]; // required, Item name + char Value[ONVIF_TOKEN_LEN]; // required, Item value. The type is defined in the corresponding description +} onvif_SimpleItem; + +typedef struct _SimpleItemList +{ + struct _SimpleItemList * next; + + onvif_SimpleItem SimpleItem; // Value name pair as defined by the corresponding description +} SimpleItemList; + +typedef struct +{ + uint32 AnyFlag : 1; + uint32 Reserverd : 31; + + char Name[ONVIF_NAME_LEN]; // required, Item name + char * Any; // optional +} onvif_ElementItem; + +typedef struct _ElementItemList +{ + struct _ElementItemList * next; + + onvif_ElementItem ElementItem; // Value name pair as defined by the corresponding description +} ElementItemList; + +typedef struct +{ + SimpleItemList * SimpleItem; // optional + ElementItemList * ElementItem; // optional +} onvif_ItemList; + +typedef struct +{ + uint32 PropertyOperationFlag : 1; // Indicates whether the field PropertyOperation is valid + uint32 SourceFlag : 1; // Indicates whether the field Source is valid + uint32 KeyFlag : 1; // Indicates whether the field Key is valid + uint32 DataFlag : 1; // Indicates whether the field Data is valid + uint32 Reserved : 28; + + time_t UtcTime; // required + + onvif_ItemList Source; // optional, Token value pairs that triggered this message. Typically only one item is present + onvif_ItemList Key; // optional element of type tt:ItemList */ + onvif_ItemList Data; // optional element of type tt:ItemList */ + + onvif_PropertyOperation PropertyOperation; // optional +} onvif_Message; + +typedef struct +{ + char ConsumerAddress[256]; // required, + char ProducterAddress[256]; // required, + + char Dialect[256]; // required, + char Topic[256]; // required, + + onvif_Message Message; // required +} onvif_NotificationMessage; + +typedef struct +{ + time_t DataFrom; // required, The earliest point in time where there is recorded data on the device + time_t DataUntil; // required, The most recent point in time where there is recorded data on the device + int NumberRecordings; // required, The device contains this many recordings +} onvif_RecordingSummary; + +typedef struct +{ + char TrackToken[ONVIF_TOKEN_LEN]; // required, + + onvif_TrackType TrackType; // required, Type of the track: "Video", "Audio" or "Metadata". + // The track shall only be able to hold data of that type + + char Description[100]; // required, Informative description of the contents of the track + time_t DataFrom; // required, The start date and time of the oldest recorded data in the track + time_t DataTo; // required, The stop date and time of the newest recorded data in the track +} onvif_TrackInformation; + +typedef struct +{ + uint32 EarliestRecordingFlag : 1; // Indicates whether the field EarliestRecording is valid + uint32 LatestRecordingFlag : 1; // Indicates whether the field LatestRecording is valid + uint32 Reserved : 30; + + char RecordingToken[ONVIF_TOKEN_LEN]; // required, + + onvif_RecordingSourceInformation Source; // required, Information about the source of the recording + + time_t EarliestRecording; // optional, + time_t LatestRecording; // optional, + char Content[256]; // required, + + uint32 sizeTrack; + onvif_TrackInformation Track[5]; // optional, Basic information about the track. Note that a track may represent a single contiguous time span or consist of multiple slices + + onvif_RecordingStatus RecordingStatus; // required, +} onvif_RecordingInformation; + +typedef struct +{ + uint32 BitrateFlag : 1; // Indicates whether the field Bitrate is valid + uint32 Reserved : 31; + + int Bitrate; // optional, Average bitrate in kbps + int Width; // required, The width of the video in pixels + int Height; // required, The height of the video in pixels + + onvif_VideoEncoding Encoding; // required, Used video codec, either Jpeg, H.264 or Mpeg4 + + float Framerate; // required, Average framerate in frames per second +} onvif_VideoAttributes; + +typedef struct +{ + uint32 BitrateFlag : 1; // Indicates whether the field Bitrate is valid + uint32 Reserved : 31; + + int Bitrate; // optional, The bitrate in kbps + + onvif_AudioEncoding Encoding; // required, Audio codec used for encoding the audio (either G.711, G.726 or AAC) + + int Samplerate; // required, The sample rate in kHz +} onvif_AudioAttributes; + +typedef struct +{ + uint32 PtzSpacesFlag : 1; // Indicates whether the field PtzSpaces is valid + uint32 Reserved : 31; + + BOOL CanContainPTZ; // required, Indicates that there can be PTZ data in the metadata track in the specified time interval + BOOL CanContainAnalytics; // required, Indicates that there can be analytics data in the metadata track in the specified time interval + BOOL CanContainNotifications; // required, Indicates that there can be notifications in the metadata track in the specified time interval + char PtzSpaces[256]; // optional, List of all PTZ spaces active for recording. Note that events are only recorded on position changes and + // the actual point of recording may not necessarily contain an event of the specified type +} onvif_MetadataAttributes; + +typedef struct +{ + uint32 VideoAttributesFlag : 1; // Indicates whether the field VideoAttributes is valid + uint32 AudioAttributesFlag : 1; // Indicates whether the field AudioAttributes is valid + uint32 MetadataAttributesFlag : 1; // Indicates whether the field MetadataAttributes is valid + uint32 Reserved : 29; + + onvif_TrackInformation TrackInformation; // required, The basic information about the track. Note that a track may represent a single contiguous time span or consist of multiple slices + onvif_VideoAttributes VideoAttributes; // optional, If the track is a video track, exactly one of this structure shall be present and contain the video attributes + onvif_AudioAttributes AudioAttributes; // optional, If the track is an audio track, exactly one of this structure shall be present and contain the audio attributes + onvif_MetadataAttributes MetadataAttributes; // optional, If the track is an metadata track, exactly one of this structure shall be present and contain the metadata attributes +} onvif_TrackAttributes; + +typedef struct _TrackAttributesList +{ + struct _TrackAttributesList * next; + + onvif_TrackAttributes TrackAttributes; +} TrackAttributesList; + +typedef struct +{ + char RecordingToken[ONVIF_TOKEN_LEN]; // required, A reference to the recording that has these attributes + + uint32 sizeTrackAttributes; + onvif_TrackAttributes TrackAttributes[5]; // optional, A set of attributes for each track + + time_t From; // required, The attributes are valid from this point in time in the recording + time_t Until; // required, The attributes are valid until this point in time in the recording. + // Can be equal to 'From' to indicate that the attributes are only known to be valid for this particular point in time +} onvif_MediaAttributes; + +typedef struct +{ + char StorageToken[ONVIF_TOKEN_LEN]; // required, + char RelativePath[256]; // optional, +} onvif_StorageReferencePath; + +typedef struct +{ + char FileName[256]; // required, Exported file name + float Progress; // required, Normalized percentage completion for uploading the exported file +} onvif_FileProgress; + +typedef struct +{ + uint32 sizeFileProgress; // sequence of elements + onvif_FileProgress FileProgress[100]; // optional, Exported file name and export progress information +} onvif_ArrayOfFileProgress; + +typedef struct +{ + uint32 RecordingInformationFilterFlag : 1; // Indicates whether the field RecordingInformationFilter is valid + uint32 Reserved : 31; + + int sizeIncludedSources; + onvif_SourceReference IncludedSources[10]; // optional, A list of sources that are included in the scope. If this list is included, only data from one of these sources shall be searched + + int sizeIncludedRecordings; + char IncludedRecordings[10][ONVIF_TOKEN_LEN]; // optional, A list of recordings that are included in the scope. If this list is included, only data from one of these recordings shall be searched + + char RecordingInformationFilter[128]; // optional, An xpath expression used to specify what recordings to search. + // Only those recordings with an RecordingInformation structure that matches the filter shall be searched +} onvif_SearchScope; + +typedef struct +{ + onvif_PTZVector MinPosition; // required, + onvif_PTZVector MaxPosition; // required, + + BOOL EnterOrExit; // required, +} onvif_PTZPositionFilter; + +typedef struct +{ + char MetadataStreamFilter[100]; // required +} onvif_MetadataFilter; + +typedef struct _RecordingInformationList +{ + struct _RecordingInformationList * next; + + onvif_RecordingInformation RecordingInformation; +} RecordingInformationList; + +typedef struct +{ + onvif_SearchState SearchState; // required, The state of the search when the result is returned. Indicates if there can be more results, or if the search is completed + + RecordingInformationList * RecordInformation; // optional, A RecordingInformation structure for each found recording matching the search +} onvif_FindRecordingResultList; + +typedef struct +{ + char Address[128]; // required, +} onvif_EndpointReferenceType; + +typedef struct +{ + char Dialect[128]; // required, + char Topic[128]; // required, +} onvif_TopicExpressionType; + +typedef struct +{ + uint32 SubscriptionReferenceFlag : 1; // Indicates whether the field SubscriptionReference is valid + uint32 TopicFlag : 1; // Indicates whether the field Topic is valid + uint32 ProducerReferenceFlag : 1; // Indicates whether the field ProducerReference is valid + uint32 Reserved : 31; + + onvif_EndpointReferenceType SubscriptionReference; // optional, + onvif_TopicExpressionType Topic; // optional, + onvif_EndpointReferenceType ProducerReference; // optional, + onvif_Message Message; // required +} onvif_NotificationMessageHolderType; + +typedef struct +{ + char RecordingToken[ONVIF_TOKEN_LEN]; // required, The recording where this event was found. Empty string if no recording is associated with this event + char TrackToken[ONVIF_TOKEN_LEN]; // required, A reference to the track where this event was found. Empty string if no track is associated with this event + time_t Time; // required, The time when the event occured + + onvif_NotificationMessageHolderType Event; // required, The description of the event + + BOOL StartStateEvent; // required, If true, indicates that the event is a virtual event generated for this particular search session to give the state of a property at the start time of the search +} onvif_FindEventResult; + +typedef struct _FindEventResultList +{ + struct _FindEventResultList * next; + + onvif_FindEventResult Result; +} FindEventResultList; + +typedef struct +{ + onvif_SearchState SearchState; // required, The state of the search when the result is returned. Indicates if there can be more results, or if the search is completed + + FindEventResultList * Result; // optional +} onvif_FindEventResultList; + +typedef struct +{ + char RecordingToken[ONVIF_TOKEN_LEN]; // required, The recording where this event was found. Empty string if no recording is associated with this event + char TrackToken[ONVIF_TOKEN_LEN]; // required, A reference to the track where this event was found. Empty string if no track is associated with this event + time_t Time; // required, The time when the event occured +} onvif_FindMetadataResult; + +typedef struct _FindMetadataResultList +{ + struct _FindMetadataResultList * next; + + onvif_FindMetadataResult Result; +} FindMetadataResultList; + +typedef struct +{ + onvif_SearchState SearchState; // required, The state of the search when the result is returned. Indicates if there can be more results, or if the search is completed + + FindMetadataResultList * Result; // optional +} onvif_FindMetadataResultList; + +typedef struct +{ + char RecordingToken[ONVIF_TOKEN_LEN]; // required + char TrackToken[ONVIF_TOKEN_LEN]; // required + time_t Time; // required + + onvif_PTZVector Position; // required +} onvif_FindPTZPositionResult; + +typedef struct _FindPTZPositionResultList +{ + struct _FindPTZPositionResultList * next; + + onvif_FindPTZPositionResult Result; +} FindPTZPositionResultList; + +typedef struct +{ + onvif_SearchState SearchState; // required, The state of the search when the result is returned. Indicates if there can be more results, or if the search is completed + + FindPTZPositionResultList * Result; // optional +} onvif_FindPTZPositionResultList; + + +////////////////////////////////////////////////////////////////////////// +// Video analytics struct defines +////////////////////////////////////////////////////////////////////////// + +typedef struct +{ + uint32 attrFlag : 1; + uint32 reserved : 31; + + onvif_ItemList Parameters; // required + + char Name[ONVIF_NAME_LEN]; // required + char Type[100]; // required + char attr[256]; +} onvif_Config; + +typedef struct _ConfigList +{ + struct _ConfigList * next; + + onvif_Config Config; +} ConfigList; + +typedef struct +{ + ConfigList * AnalyticsModule; // optional +} onvif_AnalyticsEngineConfiguration; + +typedef struct +{ + ConfigList * Rule; // optional +} onvif_RuleEngineConfiguration; + +typedef struct +{ + char Name[ONVIF_NAME_LEN]; // required + int UseCount; // required + char token[ONVIF_TOKEN_LEN]; // required + + onvif_AnalyticsEngineConfiguration AnalyticsEngineConfiguration; // required + onvif_RuleEngineConfiguration RuleEngineConfiguration; // required +} onvif_VideoAnalyticsConfiguration; + +typedef struct +{ + char Name[ONVIF_NAME_LEN]; // required + char Type[100]; // required +} onvif_SimpleItemDescription; + +typedef struct _SimpleItemDescriptionList +{ + struct _SimpleItemDescriptionList * next; + + onvif_SimpleItemDescription SimpleItemDescription; +} SimpleItemDescriptionList; + +typedef struct +{ + SimpleItemDescriptionList * SimpleItemDescription; + SimpleItemDescriptionList * ElementItemDescription; +} onvif_ItemListDescription; + +typedef struct +{ + uint32 SourceFlag : 1; // Indicates whether the field Source is valid + uint32 KeyFlag : 1; // Indicates whether the field Source is valid + uint32 DataFlag : 1; // Indicates whether the field Source is valid + uint32 IsPropertyFlag : 1; // Indicates whether the field Source is valid + uint32 Reserved : 28; + + onvif_ItemListDescription Source; // optional + onvif_ItemListDescription Key; // optional + onvif_ItemListDescription Data; // optional + + BOOL IsProperty; // optional + char ParentTopic[100]; // required +} onvif_ConfigDescription_Messages; + +typedef struct _ConfigDescription_MessagesList +{ + struct _ConfigDescription_MessagesList * next; + + onvif_ConfigDescription_Messages Messages; +} ConfigDescription_MessagesList; + +typedef struct +{ + uint32 fixedFlag : 1; // Indicates whether the field fixed is valid + uint32 maxInstancesFlag : 1; // Indicates whether the field maxInstances is valid + uint32 Reserved : 30; + + onvif_ItemListDescription Parameters; // required + + ConfigDescription_MessagesList * Messages; + + char Name[ONVIF_NAME_LEN]; // required, The Name attribute (e.g. "tt::LineDetector") uniquely identifies the type of rule, not a type definition in a schema + BOOL fixed; // optional, The fixed attribute signals that it is not allowed to add or remove this type of configuration + int maxInstances; // optional, The maxInstances attribute signals the maximum number of instances per configuration +} onvif_ConfigDescription; + +typedef struct +{ + uint32 RuleTypeFlag : 1; // Indicates whether the field RuleType is valid + uint32 AnalyticsModuleFlag : 1; // Indicates whether the field AnalyticsModule is valid + uint32 Reserved : 30; + + char RuleType[100]; // optional, The RuleType the ConfigOptions applies to if the Name attribute is ambiguous. + char Name[ONVIF_NAME_LEN]; // required, The Name of the SimpleItemDescription/ElementItemDescription + // the ConfigOptions applies to + char Type[100]; // required, Type of the Rule Options represented by a unique QName. + // The Type defines the element contained in this structure + char AnalyticsModule[100]; // optional, Optional name of the analytics module this constraint applies to. + // This option is only necessary in cases where different constraints for elements with the same Name exist. + char * any; +} onvif_ConfigOptions; + +typedef struct _ConfigOptionsList +{ + struct _ConfigOptionsList * next; + + onvif_ConfigOptions Options; +} ConfigOptionsList; + +typedef struct _ConfigDescriptionList +{ + struct _ConfigDescriptionList * next; + + onvif_ConfigDescription ConfigDescription; +} ConfigDescriptionList; + +typedef struct +{ + uint32 LimitFlag : 1; // Indicates whether the field Limit is valid + uint32 Reserved : 31; + + uint32 sizeRuleContentSchemaLocation; + char RuleContentSchemaLocation[10][256]; // optional, Lists the location of all schemas that are referenced in the rules + + ConfigDescriptionList * RuleDescription; // List of rules supported by the Video Analytics configuration + + int Limit; // optional, Maximum number of concurrent instances +} onvif_SupportedRules; + +typedef struct +{ + uint32 sizeAnalyticsModuleContentSchemaLocation; // sequence of elements + char AnalyticsModuleContentSchemaLocation[10][128]; // It optionally contains a list of URLs that provide the location of schema files + // These schema files describe the types and elements used in the analytics module descriptions. + // If the analytics module descriptions reference types or elements of the ONVIF schema file, + // the ONVIF schema file MUST be explicitly listed + + ConfigDescriptionList * AnalyticsModuleDescription; // optional, +} onvif_SupportedAnalyticsModules; + +typedef struct +{ + char Type[128]; // required, Type of the Analytics Module Options represented by a unique QName. + // The Type defines the element contained in this structure +} onvif_AnalyticsModuleConfigOptions; + +typedef struct _AnalyticsModuleConfigOptionsList +{ + struct _AnalyticsModuleConfigOptionsList * next; + + onvif_AnalyticsModuleConfigOptions Options; +} AnalyticsModuleConfigOptionsList; + +typedef struct +{ + char Dialect[128]; + char Expression[256]; +} onvif_EventFilterItem; + +typedef struct +{ + int sizeTopicExpression; + int sizeMessageContent; + + onvif_EventFilterItem TopicExpression[5]; + onvif_EventFilterItem MessageContent[5]; +} onvif_EventFilter; + +typedef struct +{ + uint32 AnalyticsFlag : 1; // Indicates whether the field Analytics is valid + uint32 PTZStatusFlag : 1; // Indicates whether the field PTZStatus is valid + uint32 EventsFlag : 1; // Indicates whether the field Events is valid + uint32 CompressionTypeFlag : 1; // Indicates whether the field CompressionType is valid + uint32 AnalyticsEngineConfigurationFlag : 1; // Indicates whether the field AnalyticsEngineConfiguration is valid + uint32 GeoLocation : 1; // Optional parameter to configure if the metadata stream shall contain the Geo Location coordinates of each target + uint32 ShapePolygon : 1; // Optional parameter to configure if the generated metadata stream should contain shape information as polygon + uint32 Reserved : 25; + + char Name[ONVIF_NAME_LEN]; // required , User readable name. Length up to 64 characters + int UseCount; // required, Number of internal references currently using this configuration. This parameter is read-only and cannot be changed by a set request + char token[ONVIF_TOKEN_LEN]; // required, Token that uniquely refernces this configuration. Length up to 64 characters + BOOL Analytics; // optional, Defines whether the streamed metadata will include metadata from the analytics engines (video, cell motion, audio etc.) + int SessionTimeout; // required, The rtsp session timeout for the related audio stream, unit is second + char CompressionType[100]; // optional, Optional parameter to configure compression type of Metadata payload. Use values from enumeration MetadataCompressionType + // None,GZIP,EXI + + onvif_PTZFilter PTZStatus; // optional, optional element to configure which PTZ related data is to include in the metadata stream + onvif_EventSubscription Events; // optional, Optional element to configure the streaming of events. A client might be interested in receiving all, + // none or some of the events produced by the device: + // To get all events: Include the Events element but do not include a filter. + // To get no events: Do not include the Events element. + // To get only some events: Include the Events element and include a filter in the element. + onvif_MulticastConfiguration Multicast; // required, defines the multicast settings that could be used for video streaming + onvif_AnalyticsEngineConfiguration AnalyticsEngineConfiguration; //optional, Defines whether the streamed metadata will include metadata from the analytics engines (video, cell motion, audio etc.) +} onvif_MetadataConfiguration; + +typedef struct +{ + uint32 attrFlag : 1; + uint32 reserved : 31; + + char Type[128]; // required, Reference to an AnalyticsModule Type + char attr[256]; + char * Frame; // required, Sample frame content starting with the tt:Frame node +} onvif_MetadataInfo; + +typedef struct _MetadataInfoList +{ + struct _MetadataInfoList * next; + + onvif_MetadataInfo MetadataInfo; +} MetadataInfoList; + +// PROFILE C Define Begin + +/** + * The AccessPoint capabilities reflect optional functionality of a particular physical entity. + * Different AccessPoint instances may have different set of capabilities. + * This information maychange during device operation, e.g. if hardware settings are changed. + */ +typedef struct +{ + uint32 DisableAccessPoint : 1; // required, Indicates whether or not this AccessPoint instance supports EnableAccessPoint and DisableAccessPoint commands + uint32 Duress : 1; // optional, Indicates whether or not this AccessPoint instance supports generation of duress events + uint32 AnonymousAccess : 1; // optional, Indicates whether or not this AccessPoint has a REX switch or other input that allows anonymous access + uint32 AccessTaken : 1; // optional, Indicates whether or not this AccessPoint instance supports generation of AccessTaken and AccessNotTaken events. + // If AnonymousAccess and AccessTaken are both true, it indicates that the Anonymous versions of AccessTaken and AccessNotTaken are supported + uint32 ExternalAuthorization : 1; // optional, Indicates whether or not this AccessPoint instance supports the ExternalAuthorization operation and the generation of Request events. + // If AnonymousAccess and ExternalAuthorization are both true, it indicates that the Anonymous version is supported as well + uint32 IdentifierAccess : 1; // optional, Indicates whether or not this access point supports the AccessControl/Request/Identifier + // event to request external authorization. + uint32 SupportedRecognitionTypesFlag : 1; // Indicates whether the field SupportedRecognitionTypes is valid + uint32 SupportedFeedbackTypesFlag : 1; // Indicates whether the field SupportedFeedbackTypes is valid + uint32 Reserved : 24; + + char SupportedRecognitionTypes[200]; // optional, A list of recognition types that the device supports + char SupportedFeedbackTypes[200]; // optional, List of supported feedback types +} onvif_AccessPointCapabilities; + +/** + * The AccessPointInfo structure contains basic information about an AccessPoint instance. + * An AccessPoint defines an entity a Credential can be granted or denied access to. + * TheAccessPointInfo provides basic information on how access is controlled in one direction for adoor (from which area to which area). + * door is the typical device involved, but other type ofdevices may be supported as well. + * Multiple AccessPoints may cover the same Door.A typical case is one AccessPoint for entry and another for exit, both referencingthe same Door. + * An ONVIF compliant device shall provide the following fields for each AccessPoint instance + */ +typedef struct +{ + uint32 DescriptionFlag : 1; // Indicates whether the field Description is valid + uint32 AreaFromFlag : 1; // Indicates whether the field AreaFrom is valid + uint32 AreaToFlag : 1; // Indicates whether the field AreaTo is valid + uint32 EntityTypeFlag : 1; // Indicates whether the field EntityType is valid + uint32 EntityTypeAttrFlag : 1; // Indicates whether the field EntityTypeAttr is valid + uint32 Reserved : 27; + + char token[ONVIF_TOKEN_LEN]; // required + char Name[ONVIF_NAME_LEN]; // required, A user readable name. It shall be up to 64 characters + char Description[1024]; // optional, Optional user readable description for the AccessPoint. It shall be up to 1024 characters + char AreaFrom[ONVIF_TOKEN_LEN]; // optional, Optional reference to the Area from which access is requested + char AreaTo[ONVIF_TOKEN_LEN]; // optional, Optional reference to the Area to which access is requested + char EntityType[100]; // optional, Optional entity type; if missing, a Door type as defined by the ONVIF DoorControl service should be assumed. + // This can also be represented by the QName value "tdc:Door" - where tdc is the namespace of the Door Control service. + // This field is provided for future extensions; it will allow an AccessPoint being extended to cover entity types other than Doors as well + char EntityTypeAttr[256]; + char Entity[ONVIF_TOKEN_LEN]; // required, Reference to the entity used to control access; the entity type may be specified by the optional EntityType field explained below but is typically a Door + + onvif_AccessPointCapabilities Capabilities; // required, The capabilities for the AccessPoint +} onvif_AccessPointInfo; + +typedef struct _AccessPointList +{ + struct _AccessPointList * next; + + uint32 Enabled : 1; // Indicates that the AccessPoint is enabled. By default this field value shall be True, if the DisableAccessPoint capabilities is not supported + uint32 AuthenticationProfileTokenFlag : 1; // Indicates whether the field AuthenticationProfileToken is valid + uint32 Reserved : 30; + + onvif_AccessPointInfo AccessPointInfo; + + char AuthenticationProfileToken[ONVIF_TOKEN_LEN]; // A reference to an authentication profile which defines the authentication behavior of the access point +} AccessPointList; + +/** + * DoorCapabilities reflect optional functionality of a particular physical entity. + * Different door instances may have different set of capabilities. + * This information may change during device operation, e.g. if hardware settings are changed + */ +typedef struct +{ + BOOL Access; // optional, Indicates whether or not this Door instance supports AccessDoor command to perform momentary access + BOOL AccessTimingOverride; // optional, Indicates that this Door instance supports overriding configured timing in the AccessDoor command + BOOL Lock; // optional, Indicates that this Door instance supports LockDoor command to lock the door + BOOL Unlock; // optional, Indicates that this Door instance supports UnlockDoor command to unlock the door + BOOL Block; // optional, Indicates that this Door instance supports BlockDoor command to block the door + BOOL DoubleLock; // optional, Indicates that this Door instance supports DoubleLockDoor command to lock multiple locks on the door + BOOL LockDown; // optional, Indicates that this Door instance supports LockDown (and LockDownRelease) commands to lock the door and put it in LockedDown mode + BOOL LockOpen; // optional, Indicates that this Door instance supports LockOpen (and LockOpenRelease) commands to unlock the door and put it in LockedOpen mode + BOOL DoorMonitor; // optional, Indicates that this Door instance has a DoorMonitor and supports the DoorPhysicalState event + BOOL LockMonitor; // optional, Indicates that this Door instance has a LockMonitor and supports the LockPhysicalState event + BOOL DoubleLockMonitor; // optional, Indicates that this Door instance has a DoubleLockMonitor and supports the DoubleLockPhysicalState event + BOOL Alarm; // optional, Indicates that this Door instance supports door alarm and the DoorAlarm event + BOOL Tamper; // optional, Indicates that this Door instance has a Tamper detector and supports the DoorTamper event + BOOL Fault; // optional, Indicates that this Door instance supports door fault and the DoorFault event +} onvif_DoorCapabilities; + +// Tampering information for a Door +typedef struct +{ + uint32 ReasonFlag : 1; // Indicates whether the field Reason is valid + uint32 Reserved : 31; + + char Reason[100]; // optional, Optional field; Details describing tampering state change (e.g., reason, place and time). + // NOTE: All fields (including this one) which are designed to give end-user prompts can be localized to the customers's native language + onvif_DoorTamperState State; // required, State of the tamper detector +} onvif_DoorTamper; + +// Fault information for a Door +typedef struct +{ + uint32 ReasonFlag : 1; // Indicates whether the field Reason is valid + uint32 Reserved : 31; + + char Reason[100]; // optional, Optional reason for fault + + onvif_DoorFaultState State; // required, Overall fault state for the door; it is of type DoorFaultState. If there are any faults, the value shall be: FaultDetected. + // Details of the detected fault shall be found in the Reason field, and/or the various DoorState fields and/or in extensions to this structure +} onvif_DoorFault; + +// The DoorState structure contains current aggregate runtime status of Door +typedef struct +{ + uint32 DoorPhysicalStateFlag : 1; // Indicates whether the field DoorPhysicalState is valid + uint32 LockPhysicalStateFlag : 1; // Indicates whether the field LockPhysicalState is valid + uint32 DoubleLockPhysicalStateFlag : 1; // Indicates whether the field DoubleLockPhysicalState is valid + uint32 AlarmFlag : 1; // Indicates whether the field Alarm is valid + uint32 TamperFlag : 1; // Indicates whether the field Tamper is valid + uint32 FaultFlag : 1; // Indicates whether the field Fault is valid + uint32 Reserved : 26; + + onvif_DoorPhysicalState DoorPhysicalState; // optional, Physical state of Door; it is of type DoorPhysicalState. + // A device that signals support for DoorMonitor capability for a particular door instance shall provide this field + onvif_LockPhysicalState LockPhysicalState; // optional, Physical state of the Lock; it is of type LockPhysicalState. + // A device that signals support for LockMonitor capability for a particular door instance shall provide this field + onvif_LockPhysicalState DoubleLockPhysicalState; // optional, Physical state of the DoubleLock; it is of type LockPhysicalState. + // A device that signals support for DoubleLockMonitor capability for a particular door instance shall provide this field + onvif_DoorAlarmState Alarm; // optional, Alarm state of the door; it is of type DoorAlarmState. + // A device that signals support for Alarm capability for a particular door instance shall provide this field + onvif_DoorTamper Tamper; // optional, Tampering state of the door; it is of type DoorTamper. + // A device that signals support for Tamper capability for a particular door instance shall provide this field + onvif_DoorFault Fault; // optional, Fault information for door; it is of type DoorFault. + // A device that signals support for Fault capability for a particular door instance shall provide this field + onvif_DoorMode DoorMode; // required, The logical operating mode of the door; it is of type DoorMode. An ONVIF compatible device shall report current operating mode in this field +} onvif_DoorState; + +typedef struct +{ + uint32 ExtendedReleaseTimeFlag : 1; // Indicates whether the field ExtendedReleaseTime is valid + uint32 DelayTimeBeforeRelockFlag : 1; // Indicates whether the field DelayTimeBeforeRelock is valid + uint32 ExtendedOpenTimeFlag : 1; // Indicates whether the field ExtendedOpenTime is valid + uint32 PreAlarmTimeFlag : 1; // Indicates whether the field PreAlarmTime is valid + uint32 Reserved : 28; + + uint32 ReleaseTime; // external, When access is granted (door mode becomes Accessed), the latch is unlocked. + // ReleaseTime is the time from when the latch is unlocked until it is + // relocked again (unless the door is physically opened), unit is second + uint32 OpenTime; // external, The time from when the door is physically opened until the door is set in the + // DoorOpenTooLong alarm state, unit is second + uint32 ExtendedReleaseTime; // optional, Some individuals need extra time to open the door before the latch relocks. + // If supported, ExtendedReleaseTime shall be added to ReleaseTime if UseExtendedTime + // is set to true in the AccessDoor command, unit is second + uint32 DelayTimeBeforeRelock; // optional, If the door is physically opened after access is granted, then DelayTimeBeforeRelock is the time from when the door is physically + // opened until the latch goes back to locked state, unit is second + uint32 ExtendedOpenTime; // optional, Some individuals need extra time to pass through the door. If supported, + // ExtendedOpenTime shall be added to OpenTime if UseExtendedTime + // is set to true in the AccessDoor command. unit is second + uint32 PreAlarmTime; // optional, Before a DoorOpenTooLong alarm state is generated, a signal will sound to indicate that the door must be closed. + // PreAlarmTime defines how long before DoorOpenTooLong the warning signal shall sound, unit is second +} onvif_Timings; + +/** + * The DoorInfo type represents the Door as a physical object. + * The structure contains information and capabilities of a specific door instance + */ +typedef struct +{ + uint32 DescriptionFlag : 1; // Indicates whether the field Description is valid + uint32 Reserved : 31; + + char token[ONVIF_TOKEN_LEN]; // required + char Name[ONVIF_NAME_LEN]; // required, A user readable name. It shall be up to 64 characters + char Description[1024]; // optional, A user readable description. It shall be up to 1024 characters + + onvif_DoorCapabilities Capabilities; // required, The capabilities of the Door +} onvif_DoorInfo; + +typedef struct _DoorInfoList +{ + struct _DoorInfoList * next; + + onvif_DoorInfo DoorInfo; +} DoorInfoList; + +typedef struct +{ + onvif_DoorInfo DoorInfo; // Door information + + char DoorType[64]; // required, The type of door. Is of type text. Can be either one of the following reserved ONVIF types: + // "pt:Door", "pt:ManTrap", "pt:Turnstile", "pt:RevolvingDoor", + // "pt:Barrier", or a custom defined type + onvif_Timings Timings; // required, A structure defining times such as how long the door is unlocked when accessed, extended grant time, etc. +} onvif_Door; + +typedef struct _DoorList +{ + struct _DoorList * next; + + onvif_Door Door; +} DoorList; + +/** + * The AreaInfo structure contains basic information about an Area + */ +typedef struct +{ + uint32 DescriptionFlag : 1; // Indicates whether the field Description is valid + uint32 Reserved : 31; + + char token[ONVIF_TOKEN_LEN]; // required + char Name[ONVIF_NAME_LEN]; // required, A user readable name. It shall be up to 64 characters + char Description[1024]; // optional, A user readable description. It shall be up to 1024 characters +} onvif_AreaInfo; + +typedef struct _AreaList +{ + struct _AreaList * next; + + onvif_AreaInfo AreaInfo; +} AreaList; + + +// PROFILE C Define End + +// DEVICEIO Define Begin + +// A pane layout describes one Video window of a display. It links a pane configuration to a region of the screen +typedef struct +{ + char Pane[ONVIF_TOKEN_LEN]; // required, Reference to the configuration of the streaming and coding parameters + + onvif_Rectangle Area; // required, Describes the location and size of the area on the monitor. + // The area coordinate values are espressed in normalized units [-1.0, 1.0] +} onvif_PaneLayout; + +typedef struct _PaneLayoutList +{ + struct _PaneLayoutList * next; + + onvif_PaneLayout PaneLayout; // required +} PaneLayoutList; + +// A layout describes a set of Video windows that are displayed simultaniously on a display +typedef struct +{ + PaneLayoutList * PaneLayout; // required, List of panes assembling the display layout +} onvif_Layout; + +// Representation of a physical video outputs +typedef struct +{ + uint32 ResolutionFlag : 1; // Indicates whether the field Resolution is valid + uint32 RefreshRateFlag : 1; // Indicates whether the field RefreshRate is valid + uint32 AspectRatioFlag : 1; // Indicates whether the field AspectRatio is valid + uint32 Reserved : 29; + + char token[ONVIF_TOKEN_LEN]; // required, + + onvif_Layout Layout; // required, + onvif_VideoResolution Resolution; // optional, Resolution of the display in Pixel + + float RefreshRate; // optional, Refresh rate of the display in Hertz + float AspectRatio; // optional, Aspect ratio of the display as physical extent of width divided by height +} onvif_VideoOutput; + +typedef struct _VideoOutputList +{ + struct _VideoOutputList * next; + + onvif_VideoOutput VideoOutput; +} VideoOutputList; + +typedef struct +{ + char Name[ONVIF_NAME_LEN]; // required + int UseCount; // required + char token[ONVIF_TOKEN_LEN]; // required + char OutputToken[ONVIF_TOKEN_LEN]; // required +} onvif_VideoOutputConfiguration; + +typedef struct _VideoOutputConfigurationList +{ + struct _VideoOutputConfigurationList * next; + + onvif_VideoOutputConfiguration Configuration; +} VideoOutputConfigurationList; + +typedef struct +{ + char token[ONVIF_TOKEN_LEN]; // required, +} onvif_AudioOutput; + +typedef struct _AudioOutputList +{ + struct _AudioOutputList * next; + + onvif_AudioOutput AudioOutput; +} AudioOutputList; + +typedef struct +{ + uint32 sizeOutputTokensAvailable; + char OutputTokensAvailable[5][ONVIF_TOKEN_LEN]; // required, Tokens of the physical Audio outputs (typically one) + uint32 sizeSendPrimacyOptions; + char SendPrimacyOptions[5][100]; // optional, The following modes for the Send-Primacy are defined: + // www.onvif.org/ver20/HalfDuplex/Server + // www.onvif.org/ver20/HalfDuplex/Client + // www.onvif.org/ver20/HalfDuplex/Auto + + onvif_IntRange OutputLevelRange; // required, Minimum and maximum level range supported for this Output +} onvif_AudioOutputConfigurationOptions; + +typedef struct +{ + uint32 SendPrimacyFlag : 1; // Indicates whether the field SendPrimacy is valid + uint32 Reserved : 31; + + char Name[ONVIF_NAME_LEN]; // required, + int UseCount; // required, + char token[ONVIF_TOKEN_LEN]; // required, + char OutputToken[ONVIF_TOKEN_LEN]; // required, Token of the phsycial Audio output + char SendPrimacy[100]; // optional, The following modes for the Send-Primacy are defined: + // www.onvif.org/ver20/HalfDuplex/Server + // www.onvif.org/ver20/HalfDuplex/Client + // www.onvif.org/ver20/HalfDuplex/Auto + int OutputLevel; // required, Volume setting of the output. The applicable range is defined via the option AudioOutputOptions.OutputLevelRange +} onvif_AudioOutputConfiguration; + +typedef struct _AudioOutputConfigurationList +{ + struct _AudioOutputConfigurationList * next; + + onvif_AudioOutputConfigurationOptions Options; + onvif_AudioOutputConfiguration Configuration; +} AudioOutputConfigurationList; + +typedef struct +{ + onvif_RelayMode Mode; // required, 'Bistable' or 'Monostable' + int DelayTime; // external, Time after which the relay returns to its idle state if it is in monostable mode. + // If the Mode field is set to bistable mode the value of the parameter can be ignored + onvif_RelayIdleState IdleState; // required, 'open' or 'closed' +} onvif_RelayOutputSettings; + +typedef struct +{ + uint32 RelayMode_BistableFlag : 1; + uint32 RelayMode_MonostableFlag : 1; + uint32 DelayTimesFlag : 1; // Indicates whether the field DelayTimes is valid + uint32 DiscreteFlag : 1; // Indicates whether the field Discrete is valid + uint32 Reserved : 28; + + char DelayTimes[100]; // optional, Supported delay time range or discrete values in seconds. This element must be present if MonoStable mode is supported. + BOOL Discrete; // optional, True if the relay only supports the exact values for the DelayTimes listed. Default is false + char token[ONVIF_TOKEN_LEN]; // required, Token of the relay output +} onvif_RelayOutputOptions; + +typedef struct _RelayOutputOptionsList +{ + struct _RelayOutputOptionsList * next; + + onvif_RelayOutputOptions Options; +} RelayOutputOptionsList; + +typedef struct +{ + char token[ONVIF_TOKEN_LEN]; // required + + onvif_RelayOutputSettings Properties; // required +} onvif_RelayOutput; + +typedef struct _RelayOutputList +{ + struct _RelayOutputList * next; + + onvif_RelayOutput RelayOutput; +} RelayOutputList; + +typedef struct +{ + uint32 IdleStateFlag : 1; // Indicates whether the field IdleState is valid + uint32 Reserved : 31; + + char token[ONVIF_TOKEN_LEN]; // required + + onvif_DigitalIdleState IdleState; // optional, Indicate the Digital IdleState status +} onvif_DigitalInput; + +typedef struct +{ + uint32 DigitalIdleState_closedFlag : 1; + uint32 DigitalIdleState_openFlag : 1; + uint32 Reserved : 30; +} onvif_DigitalInputConfigurationOptions; + +typedef struct _DigitalInputList +{ + struct _DigitalInputList * next; + + onvif_DigitalInput DigitalInput; +} DigitalInputList; + +typedef struct +{ + int BaudRate; // required, The transfer bitrate + int CharacterLength; // required, The bit length for each character + float StopBit; // required, The number of stop bits used to terminate each character + char token[ONVIF_TOKEN_LEN]; // required, + + onvif_ParityBit ParityBit; // required, The parity for the data error detection + onvif_SerialPortType type; // required, +} onvif_SerialPortConfiguration; + +typedef struct +{ + onvif_IntList BaudRateList; // required, The list of configurable transfer bitrate + onvif_ParityBitList ParityBitList; // required, The list of configurable parity for the data error detection + onvif_IntList CharacterLengthList; // required, The list of configurable bit length for each character + onvif_FloatList StopBitList; // required, The list of configurable number of stop bits used to terminate each character + + char token[ONVIF_TOKEN_LEN]; // required, +} onvif_SerialPortConfigurationOptions; + +typedef struct +{ + char token[ONVIF_TOKEN_LEN]; // required +} onvif_SerialPort; + +typedef struct _SerialPortList +{ + struct _SerialPortList * next; + + onvif_SerialPortConfiguration Configuration; + onvif_SerialPortConfigurationOptions Options; + onvif_SerialPort SerialPort; +} SerialPortList; + +typedef union +{ + char * Binary; + char * String; +} onvif_union_SerialData; + +typedef struct +{ + int _union_SerialData; // 0 - Binary; 1 - String + + onvif_union_SerialData union_SerialData; +} onvif_SerialData; + +typedef struct +{ + uint32 SerialDataFlag : 1; // Indicates whether the field SerialData is valid + uint32 TimeOutFlag : 1; // Indicates whether the field TimeOut is valid + uint32 DataLengthFlag : 1; // Indicates whether the field DataLength is valid + uint32 DelimiterFlag : 1; // Indicates whether the field Delimiter is valid + uint32 Reserved : 28; + + onvif_SerialData SerialData; // optional, The serial port data + + uint32 TimeOut; // optional, Indicates that the command should be responded back within the specified period of time + int DataLength; // optional, This element may be put in the case that data length returned from the connected serial device is already determined as some fixed bytes length. + // It indicates the length of received data which can be regarded as available + char Delimiter[100]; // optional, This element may be put in the case that the delimiter codes returned from the connected serial device is already known. + // It indicates the termination data sequence of the responded data. In case the string has more than one character a device shall interpret the whole string as a single delimiter. + // Furthermore a device shall return the delimiter character(s) to the client +} onvif_SendReceiveSerialCommand; + + +// DEVICEIO Define End + +// MEDIA2 Define Begin + +typedef struct +{ + uint32 GovLengthRangeFlag : 1; // Indicates whether the field GovLengthRange is valid + uint32 FrameRatesSupportedFlag : 1; // Indicates whether the field FrameRatesSupported is valid + uint32 ProfilesSupportedFlag : 1; // Indicates whether the field ProfilesSupported is valid + uint32 ConstantBitRateSupportedFlag : 1; // Indicates whether the field ConstantBitRateSupported is valid + uint32 MaxAnchorFrameDistanceFlag : 1; // Indicates whether the field MaxAnchorFrameDistance is valid + uint32 ConstantBitRateSupported : 1; // optional, Signal whether enforcing constant bitrate is supported + uint32 GuaranteedFrameRateSupported : 1; // Indicates the support for the GuaranteedFrameRate attribute on the VideoEncoder2Configuration element + uint32 Reserved : 25; + + char Encoding[64]; // required, Mime name of the supported Video format + // JPEG, MP4V-ES, H264, H265 + + onvif_VideoEncoding VideoEncoding; // media server 1 field + + onvif_FloatRange QualityRange; // required, Range of the quality values. A high value means higher quality + onvif_VideoResolution ResolutionsAvailable[MAX_RES_NUMS]; // required, List of supported image sizes + onvif_IntRange BitrateRange; // required, Supported range of encoded bitrate in kbps + + char GovLengthRange[100]; // optional, Lower and Upper bounds for the supported group of Video frames length. + // This value typically corresponds to the I-Frame distance + int MaxAnchorFrameDistance; // optional, Signals support for B-Frames. Upper bound for the supported anchor frame distance (must be larger than one) + char FrameRatesSupported[100]; // optional, List of supported target frame rates in fps (frames per second). + // The list shall be sorted with highest values first + char ProfilesSupported[256]; // optional, List of supported encoder profiles + // Simple + // AdvancedSimple + // Baseline + // Main + // Main10 + // Extended + // High +} onvif_VideoEncoder2ConfigurationOptions; + +typedef struct _VideoEncoder2ConfigurationOptionsList +{ + struct _VideoEncoder2ConfigurationOptionsList * next; + + onvif_VideoEncoder2ConfigurationOptions Options; +} VideoEncoder2ConfigurationOptionsList; + +typedef struct +{ + uint32 ConstantBitRateFlag : 1; // Indicates whether the field ConstantBitRate is valid + uint32 Reserved : 31; + + float FrameRateLimit; // required, Desired frame rate in fps. The actual rate may be lower due to e.g. performance limitations + int BitrateLimit; // required, the maximum output bitrate in kbps + BOOL ConstantBitRate; // optional, Enforce constant bitrate + + int EncodingInterval; // required, The media server field +} onvif_VideoRateControl2; + +typedef struct +{ + uint32 RateControlFlag : 1; // Indicates whether the field RateControl is valid + uint32 MulticastFlag : 1; // Indicates whether the field Multicast is valid + uint32 GovLengthFlag : 1; // Indicates whether the field GovLength is valid + uint32 ProfileFlag : 1; // Indicates whether the field Profile is valid + uint32 AnchorFrameDistanceFlag : 1; // Indicates whether the field AnchorFrameDistance is valid + uint32 GuaranteedFrameRate : 1; // A value of true indicates that frame rate is a fixed value rather than an upper limit, + // and that the video encoder shall prioritize frame rate over all other adaptable + // configuration values such as bitrate. Default is false. + uint32 Reserved : 26; + + char Name[ONVIF_NAME_LEN]; // required + int UseCount; // required + char token[ONVIF_TOKEN_LEN]; // required + char Encoding[64]; // required, Mime name of the supported video format. + // JPEG, MP4V-ES, H264, H265 + onvif_VideoEncoding VideoEncoding; // required, the media 1 service field + + onvif_VideoResolution Resolution; // required, Configured video resolution + onvif_VideoRateControl2 RateControl; // optional, Optional element to configure rate control related parameters + onvif_MulticastConfiguration Multicast; // optional, Defines the multicast settings that could be used for video streaming + + float Quality; // required, Relative value for the video quantizers and the quality of the video. + // A high value within supported quality range means higher quality + int GovLength; // optional, Group of Video frames length. Determines typically the interval in which the I-Frames will be coded. + // An entry of 1 indicates I-Frames are continuously generated. An entry of 2 indicates that every 2nd image is an I-Frame, and 3 only every 3rd frame, etc. + // The frames in between are coded as P or B Frames + char Profile[64]; // optional, The encoder profile + // Simple + // AdvancedSimple + // Baseline + // Main + // Main10 + // Extended + // High + + int AnchorFrameDistance; // Distance between anchor frames of type I-Frame and P-Frame. '1' indicates no B-Frames, '2' indicates that every 2nd frame is encoded as B-Frame, '3' indicates a structure like IBBPBBP..., etc. + + int SessionTimeout; // required, the media service field +} onvif_VideoEncoder2Configuration; + +typedef struct _VideoEncoder2ConfigurationList +{ + struct _VideoEncoder2ConfigurationList * next; + + onvif_VideoEncoder2Configuration Configuration; +} VideoEncoder2ConfigurationList; + +typedef struct +{ + uint32 MulticastFlag : 1; // Indicates whether the field Multicast is valid + uint32 Reserved : 31; + + char Name[ONVIF_NAME_LEN]; // required + int UseCount; // required + char token[ONVIF_TOKEN_LEN]; // required + char Encoding[32]; // required, Mime name of the supported audio format + // PCMU, G726, MP4A-LATM(AAC) + + onvif_AudioEncoding AudioEncoding; // required, the media service field + + onvif_MulticastConfiguration Multicast; // optional, Optional multicast configuration of the audio stream + int Bitrate; // required, The output bitrate in kbps + int SampleRate; // required, The output sample rate in kHz + + int SessionTimeout; // required, the media service field +} onvif_AudioEncoder2Configuration; + +typedef struct +{ + char Encoding[32]; // required, Mime name of the supported audio format + // PCMU, G726, MP4A-LATM(AAC) + onvif_AudioEncoding AudioEncoding; // media server 1 field + + onvif_IntList BitrateList; // required, List of supported bitrates in kbps for the specified Encoding + onvif_IntList SampleRateList; // required, List of supported Sample Rates in kHz for the specified Encoding +} onvif_AudioEncoder2ConfigurationOptions; + +typedef struct _AudioEncoder2ConfigurationOptionsList +{ + struct _AudioEncoder2ConfigurationOptionsList * next; + + onvif_AudioEncoder2ConfigurationOptions Options; +} AudioEncoder2ConfigurationOptionsList; + +typedef struct _AudioEncoder2ConfigurationList +{ + struct _AudioEncoder2ConfigurationList * next; + + onvif_AudioEncoder2Configuration Configuration; +} AudioEncoder2ConfigurationList; + +typedef struct +{ + uint32 TokenFlag : 1; // Indicates whether the field Token is valid + uint32 Reserved : 31; + + char Type[32]; // required, Type of the configuration + // All, VideoSource, VideoEncoder, AudioSource, AudioEncoder, + // AudioOutput, AudioDecoder, Metadata, Analytics, PTZ + char Token[ONVIF_TOKEN_LEN]; // optional, Reference token of an existing configuration +} onvif_ConfigurationRef; + +typedef struct +{ + char Encoding[32]; // required, + int Number; // required, +} onvif_EncoderInstance; + +typedef struct +{ + uint32 sizeCodec; + onvif_EncoderInstance Codec[10]; // optional, If a device limits the number of instances for respective Video Codecs the response + // contains the information how many streams can be set up at the same time per VideoSource + + int Total; // required, The minimum guaranteed total number of encoder instances (applications) per VideoSourceConfiguration. + // The device is able to deliver the Total number of streams +} onvif_EncoderInstanceInfo; + +typedef struct +{ + char Name[ONVIF_NAME_LEN]; // required, + int UseCount; // required, + char token[ONVIF_TOKEN_LEN]; // required, +} onvif_ConfigurationEntity; + +typedef struct +{ + onvif_IntList Bitrate; // required + onvif_IntList SampleRateRange; // required +} onvif_AACDecOptions; + +typedef struct +{ + onvif_IntList Bitrate; // required + onvif_IntList SampleRateRange; // required +} onvif_G711DecOptions; + +typedef struct +{ + onvif_IntList Bitrate; // required + onvif_IntList SampleRateRange; // required +} onvif_G726DecOptions; + +typedef struct +{ + uint32 AACDecOptionsFlag : 1; // Indicates whether the field AACDecOptions is valid + uint32 G711DecOptionsFlag : 1; // Indicates whether the field G711DecOptions is valid + uint32 G726DecOptionsFlag : 1; // Indicates whether the field G726DecOptions is valid + uint32 Reserved : 29; + + onvif_AACDecOptions AACDecOptions; // optional + onvif_G711DecOptions G711DecOptions; // optional + onvif_G726DecOptions G726DecOptions; // optional +} onvif_AudioDecoderConfigurationOptions; + +typedef struct +{ + char Name[ONVIF_NAME_LEN]; // required, + int UseCount; // required, + char token[ONVIF_TOKEN_LEN]; // required, +} onvif_AudioDecoderConfiguration; + +typedef struct _AudioDecoderConfigurationList +{ + struct _AudioDecoderConfigurationList * next; + + onvif_AudioDecoderConfiguration Configuration; +} AudioDecoderConfigurationList; + +typedef struct +{ + uint32 VideoSourceFlag : 1; // Indicates whether the field VideoSource is valid + uint32 AudioSourceFlag : 1; // Indicates whether the field AudioSource is valid + uint32 VideoEncoderFlag : 1; // Indicates whether the field VideoEncoder is valid + uint32 AudioEncoderFlag : 1; // Indicates whether the field AudioEncoder is valid + uint32 AnalyticsFlag : 1; // Indicates whether the field Analytics is valid + uint32 PTZFlag : 1; // Indicates whether the field PTZ is valid + uint32 MetadataFlag : 1; // Indicates whether the field Metadata is valid + uint32 AudioOutputFlag : 1; // Indicates whether the field AudioOutput is valid + uint32 AudioDecoderFlag : 1; // Indicates whether the field AudioDecoder is valid + uint32 Reserved : 23; + + onvif_VideoSourceConfiguration VideoSource; // optional, Optional configuration of the Video input + onvif_AudioSourceConfiguration AudioSource; // optional, Optional configuration of the Audio input + onvif_VideoEncoder2Configuration VideoEncoder; // optional, Optional configuration of the Video encoder + onvif_AudioEncoder2Configuration AudioEncoder; // optional, Optional configuration of the Audio encoder + onvif_VideoAnalyticsConfiguration Analytics; // optional, Optional configuration of the analytics module and rule engine + onvif_PTZConfiguration PTZ; // optional, Optional configuration of the pan tilt zoom unit + onvif_MetadataConfiguration Metadata; // optional, Optional configuration of the metadata stream + onvif_AudioOutputConfiguration AudioOutput; // optional, Optional configuration of the Audio output + onvif_AudioDecoderConfiguration AudioDecoder; // optional, Optional configuration of the Audio decoder +} onvif_ConfigurationSet; + +typedef struct +{ + char Name[ONVIF_NAME_LEN]; // required, User readable name of the profile + + onvif_ConfigurationSet Configurations; // required, The configurations assigned to the profile + + char token[ONVIF_TOKEN_LEN]; // required, Unique identifier of the profile + BOOL fixed; // optional, A value of true signals that the profile cannot be deleted. Default is false + char stream_uri[ONVIF_URI_LEN]; // this profile stream url address +} onvif_MediaProfile; + +typedef struct _MediaProfileList +{ + struct _MediaProfileList * next; + + onvif_MediaProfile MediaProfile; +} MediaProfileList; + +typedef struct +{ + uint32 sizePoint; // sequence of elements + onvif_Vector Point[100]; // required, +} onvif_Polygon; + +typedef struct +{ + uint32 ColorFlag : 1; // Indicates whether the field Color is valid + uint32 Reserved : 31; + + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Token of the VideoSourceConfiguration the Mask is associated with + + onvif_Polygon Polygon; // required, Geometric representation of the mask area + + char Type[64]; // required, + // Color - The masked area is colored with color defined by the Color field + // Pixelated - The masked area is filled in mosaic style to hide details + // Blurred - The masked area is low pass filtered to hide details + onvif_Color Color; // optional, Color of the masked area + + BOOL Enabled; // required, If set the mask will cover the image, otherwise it will be fully transparent + char token[ONVIF_TOKEN_LEN]; // required, Token of the mask +} onvif_Mask; + +typedef struct +{ + int MaxMasks; // required, Maximum supported number of masks per VideoSourceConfiguration + int MaxPoints; // required, Maximum supported number of points per mask + + uint32 sizeTypes; // sequence, + char Types[10][64]; // required, Information which types of tr2:MaskType are supported. + // Valid values are 'Color', 'Pixelated' and 'Blurred' + + onvif_ColorOptions Color; // required, Colors supported + + BOOL RectangleOnly; // optional, Information whether the polygon must have four points and a rectangular shape + BOOL SingleColorOnly; // optional, Indicates the device capability of change in color of privacy mask for one video source + // configuration will automatically be applied to all the privacy masks associated with the same + // video source configuration +} onvif_MaskOptions; + +typedef struct _MaskList +{ + struct _MaskList * next; + + onvif_Mask Mask; +} MaskList; + +// MEDIA2 Define End + +// Thermal Define Begin + +typedef struct +{ + char Name[ONVIF_NAME_LEN]; // required, User readable Color Palette name + char token[ONVIF_TOKEN_LEN]; // required, Unique identifier of this Color Palette + char Type[32]; // required, Indicates Color Palette Type. Can use the following value: + // Custom,Grayscale,BlackHot,WhiteHot,Sepia,Red,Iron,Rain,Rainbow,Isotherm +} onvif_ColorPalette; + +typedef enum +{ + Polarity_WhiteHot = 0, + Polarity_BlackHot = 1 +} onvif_Polarity; + +typedef struct +{ + uint32 LowTemperatureFlag : 1; // Indicates whether the field LowTemperature is valid + uint32 HighTemperatureFlag : 1; // Indicates whether the field HighTemperature is valid + uint32 Reserved : 30; + + char Name[ONVIF_NAME_LEN]; // required, User reabable name for the Non-Uniformity Correction (NUC) Table + char token[ONVIF_TOKEN_LEN]; // required, Unique identifier of this NUC Table + float LowTemperature; // optional, Low Temperature limit for application of NUC Table, in Kelvin + float HighTemperature; // optional, High Temperature limit for application of NUC Table, in Kelvin +} onvif_NUCTable; + +typedef struct +{ + uint32 RunTimeFlag : 1; // Indicates whether the field RunTime is valid + uint32 Reserved : 31; + + BOOL Enabled; // required, Indicates whether the Cooler is enabled (running) or not + float RunTime; // optional, Number of hours the Cooler has been running (unit: hours). Read-only +} onvif_Cooler; + +typedef struct +{ + uint32 NUCTableFlag : 1; // Indicates whether the field NUCTable is valid + uint32 CoolerFlag : 1; // Indicates whether the field Cooler is valid + uint32 Reserved : 30; + + onvif_ColorPalette ColorPalette; // required, Current Color Palette in use by the Thermal Device + onvif_Polarity Polarity; // required, Polarity configuration of the Thermal Device + onvif_NUCTable NUCTable; // optional, Current Non-Uniformity Correction (NUC) Table in use by the Thermal Device + onvif_Cooler Cooler; // optional, Cooler settings of the Thermal Device +} onvif_ThermalConfiguration; + +typedef struct _ThermalConfigurationList +{ + struct _ThermalConfigurationList * next; + + char token[ONVIF_TOKEN_LEN]; // required, Reference token to the thermal VideoSource + + onvif_ThermalConfiguration Configuration; +} ThermalConfigurationList; + +typedef struct _ColorPaletteList +{ + struct _ColorPaletteList * next; + + onvif_ColorPalette ColorPalette; +} ColorPaletteList; + +typedef struct _NUCTableList +{ + struct _NUCTableList * next; + + onvif_NUCTable NUCTable; +} NUCTableList; + +typedef struct +{ + BOOL Enabled; // optional, Indicates the Device allows cooler status to be changed from running (Enabled) to stopped (Disabled), and viceversa +} onvif_CoolerOptions; + +typedef struct +{ + uint32 CoolerOptionsFlag : 1; // Indicates whether the field CoolerOptions is valid + uint32 Reserved : 31; + + ColorPaletteList * ColorPalette; // required, List of Color Palettes available for the requested Thermal VideoSource + NUCTableList * NUCTable; // optional, List of Non-Uniformity Correction (NUC) Tables available for the requested Thermal VideoSource + onvif_CoolerOptions CoolerOptions; // optional, Specifies Cooler Options for cooled thermal devices +} onvif_ThermalConfigurationOptions; + +typedef struct +{ + uint32 RelativeHumidityFlag : 1; // Indicates whether the field RelativeHumidity is valid + uint32 AtmosphericTemperatureFlag : 1; // Indicates whether the field AtmosphericTemperature is valid + uint32 AtmosphericTransmittanceFlag : 1; // Indicates whether the field AtmosphericTransmittance is valid + uint32 ExtOpticsTemperatureFlag : 1; // Indicates whether the field ExtOpticsTemperature is valid + uint32 ExtOpticsTransmittanceFlag : 1; // Indicates whether the field ExtOpticsTransmittance is valid + uint32 Reserved : 27; + + float ReflectedAmbientTemperature; // required, Reflected Ambient Temperature for the environment in which the thermal device and the object being measured is located + float Emissivity; // required, Emissivity of the surface of the object on which temperature is being measured + float DistanceToObject; // required, Distance from the thermal device to the measured object + float RelativeHumidity; // optional, Relative Humidity in the environment in which the measurement is located + float AtmosphericTemperature; // optional, Temperature of the atmosphere between the thermal device and the object being measured + float AtmosphericTransmittance; // optional, Transmittance value for the atmosphere between the thermal device and the object being measured + float ExtOpticsTemperature; // optional, Temperature of the optics elements between the thermal device and the object being measured + float ExtOpticsTransmittance; // optional, Transmittance value for the optics elements between the thermal device and the object being measured +} onvif_RadiometryGlobalParameters; + +typedef struct +{ + uint32 RadiometryGlobalParametersFlag : 1; // Indicates whether the field RadiometryGlobalParameters is valid + uint32 Reserved : 31; + + onvif_RadiometryGlobalParameters RadiometryGlobalParameters; // optional, Global Parameters for Radiometry Measurements. + // Shall exist if Radiometry Capability is reported, and Global Parameters are supported by the device +} onvif_RadiometryConfiguration; + +typedef struct +{ + uint32 RelativeHumidityFlag : 1; // Indicates whether the field RelativeHumidity is valid + uint32 AtmosphericTemperatureFlag : 1; // Indicates whether the field AtmosphericTemperature is valid + uint32 AtmosphericTransmittanceFlag : 1; // Indicates whether the field AtmosphericTransmittance is valid + uint32 ExtOpticsTemperatureFlag : 1; // Indicates whether the field ExtOpticsTemperature is valid + uint32 ExtOpticsTransmittanceFlag : 1; // Indicates whether the field ExtOpticsTransmittance is valid + uint32 Reserved : 27; + + onvif_FloatRange ReflectedAmbientTemperature; // required, Valid range of temperature values, in Kelvin + onvif_FloatRange Emissivity; // required, Valid range of emissivity values for the objects to measure + onvif_FloatRange DistanceToObject; // required, Valid range of distance between camera and object for a valid temperature reading, in meters + onvif_FloatRange RelativeHumidity; // optional, Valid range of relative humidity values, in percentage + onvif_FloatRange AtmosphericTemperature; // optional, Valid range of temperature values, in Kelvin + onvif_FloatRange AtmosphericTransmittance; // optional, Valid range of atmospheric transmittance values + onvif_FloatRange ExtOpticsTemperature; // optional, Valid range of temperature values, in Kelvin + onvif_FloatRange ExtOpticsTransmittance; // optional, Valid range of external optics transmittance +} onvif_RadiometryGlobalParameterOptions; + +typedef struct +{ + uint32 RadiometryGlobalParameterOptionsFlag : 1; // Indicates whether the field RadiometryGlobalParameterOptions is valid + uint32 Reserved : 31; + + onvif_RadiometryGlobalParameterOptions RadiometryGlobalParameterOptions; // optional, Specifies valid ranges and options for the global radiometry parameters + // used as default parameter values for temperature measurement modules (spots and boxes) +} onvif_RadiometryConfigurationOptions; + +// Thermal Define End + +// Credential define start + +typedef struct +{ + uint32 DescriptionFlag : 1; // Indicates whether the field Description is valid + uint32 ValidFromFlag : 1; // Indicates whether the field ValidFrom is valid + uint32 ValidToFlag : 1; // Indicates whether the field ValidTo is valid + uint32 Reserved : 29; + + char token[ONVIF_TOKEN_LEN]; // required, + char Description[1024]; // optional, User readable description for the credential. It shall be up to 1024 characters + char CredentialHolderReference[ONVIF_TOKEN_LEN]; // required, An external reference to a person holding this credential. + // The reference is a username or used ID in an external system, such as a directory + // service + char ValidFrom[64]; // optional, The start date/time validity of the credential. If the + // ValiditySupportsTimeValue capability is set to false, then only date is + // supported (time is ignored) + char ValidTo[64]; // optional, The expiration date/time validity of the credential. If the + // ValiditySupportsTimeValue capability is set to false, then only date is + // supported (time is ignored) +} onvif_CredentialInfo; + +typedef struct +{ + char Name[ONVIF_NAME_LEN]; // required, The name of the credential identifier type, such as pt:Card, pt:PIN, etc + char FormatType[100]; // required, Specifies the format of the credential value for the specified identifier type name +} onvif_CredentialIdentifierType; + +// A credential identifier is a card number, unique card information, PIN or +// biometric information such as fingerprint, iris, vein, face recognition, that can be validated +// in an access point +typedef struct +{ + BOOL Used; // used flag + + onvif_CredentialIdentifierType Type; // required, Contains the details of the credential identifier type. Is of type CredentialIdentifierType + + BOOL ExemptedFromAuthentication; // required, If set to true, this credential identifier is not considered for authentication + + char Value[2048]; // required, The value of the identifier in hexadecimal representation +} onvif_CredentialIdentifier; + +typedef struct +{ + onvif_CredentialIdentifierType Type; // required, Contains the details of the credential identifier type. Is of type CredentialIdentifierType + + char Value[2048]; // required, The value of the identifier in hexadecimal representation +} onvif_CredentialIdentifierItem; + +typedef struct _CredentialIdentifierItemList +{ + struct _CredentialIdentifierItemList * next; + + onvif_CredentialIdentifierItem Item; +} CredentialIdentifierItemList; + +// The association between a credential and an access profile +typedef struct +{ + uint32 Used : 1; // used flag + uint32 ValidFromFlag : 1; // Indicates whether the field ValidFrom is valid + uint32 ValidToFlag : 1; // Indicates whether the field ValidTo is valid + uint32 Reserved : 29; + + char AccessProfileToken[ONVIF_TOKEN_LEN]; // required, The reference token of the associated access profile + char ValidFrom[64]; // optional, The start date/time of the validity for the association between the + // credential and the access profile. If the ValiditySupportsTimeValue capability is set to + // false, then only date is supported (time is ignored) + char ValidTo[64]; // optional, The end date/time of the validity for the association between the + // credential and the access profile. If the ValiditySupportsTimeValue capability is set to + // false, then only date is supported (time is ignored) +} onvif_CredentialAccessProfile; + +typedef struct +{ + uint32 Used : 1; // used flag + uint32 ValueFlag : 1; // Indicates whether the field Value is valid + uint32 Reserved : 30; + + char Name[ONVIF_NAME_LEN]; // required, + char Value[100]; // optional, +} onvif_Attribute; + +// A Credential is a physical/tangible object, a piece of knowledge, or a facet of a person's +// physical being, that enables an individual access to a given physical facility or computer-based +// information system. A credential holds one or more credential identifiers. To gain access one or +// more identifiers may be required + +typedef struct +{ + uint32 DescriptionFlag : 1; // Indicates whether the field Description is valid + uint32 ValidFromFlag : 1; // Indicates whether the field ValidFrom is valid + uint32 ValidToFlag : 1; // Indicates whether the field ValidTo is valid + uint32 Reserved : 29; + + char token[ONVIF_TOKEN_LEN]; // required, + char Description[1024]; // optional, User readable description for the credential. It shall be up to 1024 characters + char CredentialHolderReference[ONVIF_TOKEN_LEN]; // required, An external reference to a person holding this credential. + // The reference is a username or used ID in an external system, such as a directory + // service + char ValidFrom[64]; // optional, The start date/time validity of the credential. If the + // ValiditySupportsTimeValue capability is set to false, then only date is + // supported (time is ignored) + char ValidTo[64]; // optional, The expiration date/time validity of the credential. If the + // ValiditySupportsTimeValue capability is set to false, then only date is + // supported (time is ignored) + + uint32 sizeCredentialIdentifier; // sequence of elements + onvif_CredentialIdentifier CredentialIdentifier[CREDENTIAL_MAX_LIMIT]; // required, A list of credential identifier structures. At least one + // credential identifier is required. Maximum one credential identifier structure + // per type is allowed + + uint32 sizeCredentialAccessProfile; // sequence of elements + onvif_CredentialAccessProfile CredentialAccessProfile[CREDENTIAL_MAX_LIMIT]; // optional, A list of credential access profile structures + + BOOL ExtendedGrantTime; // optional, A boolean indicating that the credential holder needs extra time to get through the door. + // ExtendedReleaseTime will be added to ReleaseTime, and ExtendedOpenTime will be added to OpenTime + + uint32 sizeAttribute; // sequence of elements + onvif_Attribute Attribute[CREDENTIAL_MAX_LIMIT]; // optional, A list of credential attributes as name value pairs. Key names + // starting with the prefix pt: are reserved to define PACS specific attributes + // following the "pt:" syntax +} onvif_Credential; + +typedef struct +{ + BOOL AntipassbackViolated; // required, Indicates if anti-passback is violated for the credential +} onvif_AntipassbackState; + +// The CredentialState structure contains information about the state of the credential and +// optionally the reason of why the credential was disabled + +typedef struct +{ + uint32 ReasonFlag : 1; // Indicates whether the field Reason is valid + uint32 AntipassbackStateFlag : 1; // Indicates whether the field AntipassbackState is valid + uint32 Reserved : 30; + + BOOL Enabled; // required, True if the credential is enabled or false if the credential is disabled + char Reason[100]; // optional, Predefined ONVIF reasons. For any other reason, free text can be used + // pt:CredentialLockedOut + // Access is denied due to credential locked out. + // pt:CredentialBlocked + // Access is denied because the credential has deliberately been blocked by the operator. + // pt:CredentialLost + // Access is denied due to the credential being reported as lost. + // pt:CredentialStolen + // Access is denied due to the credential being reported as stolen + // pt:CredentialDamaged + // Access is denied due to the credential being reported as damaged. + // pt:CredentialDestroyed + // Access is denied due to the credential being reported as destroyed + // pt:CredentialInactivity + // Access is denied due to credential inactivity + // pt:CredentialExpired + // Access is denied because the credential has expired + // pt:CredentialRenewalNeeded + // Access is denied because the credential requires a renewal (e.g. new PIN or + // fingerprint enrollment). + + onvif_AntipassbackState AntipassbackState; // optional, A structure indicating the anti-passback state. This field shall be + // supported if the ResetAntipassbackSupported capability is set to true +} onvif_CredentialState; + +typedef struct +{ + onvif_Credential Credential; // required, A format type supported by the device + onvif_CredentialState CredentialState; // required, User readable description of the credential identifier format type +} onvif_CredentialData; + +typedef struct +{ + char FormatType[100]; // required, A format type supported by the device. A list of supported format types is + // provided in [ISO 16484-5:2014-09 Annex P]. The BACnet type "CUSTOM" is not used. + // Instead device manufacturers can define their own format types + char Description[1024]; // required, User readable description of the credential identifier format type. It + // shall be up to 1024 characters +} onvif_CredentialIdentifierFormatTypeInfo; + +typedef struct _CredentialList +{ + struct _CredentialList * next; + + onvif_Credential Credential; + onvif_CredentialState State; +} CredentialList; + +// Credential define end + +// Access Rules define begin + +typedef struct +{ + uint32 DescriptionFlag : 1; // Indicates whether the field Description is valid + uint32 Reserved : 31; + + char token[ONVIF_TOKEN_LEN]; // required, + char Name[ONVIF_NAME_LEN]; // required, A user readable name. It shall be up to 64 characters + char Description[1024]; // optional, User readable description for the access profile. It shall be up to 1024 characters +} onvif_AccessProfileInfo; + +typedef struct +{ + uint32 EntityTypeFlag : 1; // Indicates whether the field EntityType is valid + uint32 Reserved : 31; + + char ScheduleToken[ONVIF_TOKEN_LEN]; // required, Reference to the schedule used by the access policy + char Entity[ONVIF_TOKEN_LEN]; // required, Reference to the entity used by the rule engine, + // the entity type may be specified by the optional EntityType field + // explained below but is typically an access point + char EntityType[64]; // optional, Optional entity type; if missing, an access point type as defined + // by the ONVIF Access Control service should be assumed. + // This can also be represented by the QName value tac:AccessPoint + // where tac is the namespace of Access Control Service Specification. + // This field is provided for future extensions; + // it will allow an access policy being extended to cover entity types + // other than access points as well +} onvif_AccessPolicy; + +typedef struct +{ + uint32 DescriptionFlag : 1; // Indicates whether the field Description is valid + uint32 Reserved : 31; + + char token[ONVIF_TOKEN_LEN]; // required, + char Name[ONVIF_NAME_LEN]; // required, A user readable name. It shall be up to 64 characters + char Description[1024]; // optional, User readable description for the access profile. It shall be up to 1024 characters + + uint32 sizeAccessPolicy; // sequence of elements + onvif_AccessPolicy AccessPolicy[ACCESSRULES_MAX_LIMIT]; // optional, A list of access policy structures, + // where each access policy defines during which schedule an access point can be accessed +} onvif_AccessProfile; + +typedef struct _AccessProfileList +{ + struct _AccessProfileList * next; + + onvif_AccessProfile AccessProfile; +} AccessProfileList; + + +// Access Rules define end + +// Schedule define begin + +typedef struct +{ + uint32 DescriptionFlag : 1; // Indicates whether the field Description is valid + uint32 Reserved : 31; + + char token[ONVIF_TOKEN_LEN]; // required + char Name[ONVIF_NAME_LEN]; // required, A user readable name. It shall be up to 64 characters + char Description[1024]; // optional, User readable description for the schedule. It shall be up to 1024 characters +} onvif_ScheduleInfo; + +typedef struct +{ + uint32 UntilFlag : 1; // Indicates whether the field Until is valid + uint32 Reserved : 31; + + char From[32]; // required, Indicates the start time + char Until[32]; // optional, Indicates the end time. Is optional, if omitted, the period ends at midnight. + // The end time is exclusive, meaning that that exact moment in time is not + // part of the period. To determine if a moment in time (t) is part of a time period, + // the formula StartTime ≤ t < EndTime is used. +} onvif_TimePeriod; + +typedef struct +{ + char GroupToken[ONVIF_TOKEN_LEN]; // required, Indicates the list of special days in a schedule + + uint32 sizeTimeRange; // sequence of elements + + onvif_TimePeriod TimeRange[SCHEDULE_MAX_LIMIT]; // optional, Indicates the alternate time periods for the list of special days + // (overrides the regular schedule). For example, the regular schedule indicates + // that it is active from 8AM to 5PM on Mondays. However, this particular + // Monday is a special day, and the alternate time periods state that the + // schedule is active from 9 AM to 11 AM and 1 PM to 4 PM. + // If no time periods are defined, then no access is allowed. + // Is of type TimePeriod +} onvif_SpecialDaysSchedule; + +typedef struct +{ + uint32 DescriptionFlag : 1; // Indicates whether the field Description is valid + uint32 Reserved : 31; + + char token[ONVIF_TOKEN_LEN]; // required + char Name[ONVIF_NAME_LEN]; // required, A user readable name. It shall be up to 64 characters + char Description[1024]; // optional, User readable description for the schedule. It shall be up to 1024 characters + char Standard[10*1024]; // required, An iCalendar structure that defines a number of events. Events + // can be recurring or non-recurring. The events can, for instance, + // be used to control when a camera should record or when a facility + // is accessible. Some devices might not be able to fully support + // all the features of iCalendar. Setting the service capability + // ExtendedRecurrenceSupported to false will enable more devices + // to be ONVIF compliant. Is of type string (but contains an iCalendar structure) + uint32 sizeSpecialDays; // sequence of elements + + onvif_SpecialDaysSchedule SpecialDays[SCHEDULE_MAX_LIMIT]; // optional, For devices that are not able to support all the features of iCalendar, + // supporting special days is essential. Each SpecialDaysSchedule + // instance defines an alternate set of time periods that overrides + // the regular schedule for a specified list of special days. + // Is of type SpecialDaysSchedule +} onvif_Schedule; + +typedef struct +{ + uint32 DescriptionFlag : 1; // Indicates whether the field Description is valid + uint32 Reserved : 31; + + char token[ONVIF_TOKEN_LEN]; // required + char Name[ONVIF_NAME_LEN]; // required, A user readable name. It shall be up to 64 characters + char Description[1024]; // optional, User readable description for the schedule. It shall be up to 1024 characters +} onvif_SpecialDayGroupInfo; + +typedef struct +{ + uint32 DescriptionFlag : 1; // Indicates whether the field Description is valid + uint32 DaysFlag : 1; // Indicates whether the field Days is valid + uint32 Reserved : 30; + + char token[ONVIF_TOKEN_LEN]; // required + char Name[ONVIF_NAME_LEN]; // required, A user readable name. It shall be up to 64 characters + char Description[1024]; // optional, User readable description for the schedule. It shall be up to 1024 characters + char Days[4*1024]; // optional, An iCalendar structure that contains a group of special days. + // Is of type string (containing an iCalendar structure) +} onvif_SpecialDayGroup; + +typedef struct +{ + uint32 SpecialDayFlag : 1; // Indicates whether the field SpecialDay is valid + uint32 Reserved : 31; + + BOOL Active; // required, Indicates that the current time is within the boundaries of the schedule + // or its special days schedules's time periods. For example, if this + // schedule is being used for triggering automatic recording on a video source, + // the Active flag will be true when the schedule-based recording is supposed to record + BOOL SpecialDay; // optional, Indicates that the current time is within the boundaries of its special + // days schedules's time periods. For example, if this schedule is being used + // for recording at a lower frame rate on a video source during special days, + // the SpecialDay flag will be true. If special days are not supported by the device, + // this field may be omitted and interpreted as false by the client +} onvif_ScheduleState; + +typedef struct _ScheduleList +{ + struct _ScheduleList * next; + + onvif_Schedule Schedule; + onvif_ScheduleState ScheduleState; + +#ifdef LIBICAL + icalcomponent * comp; +#endif +} ScheduleList; + +typedef struct _SpecialDayGroupList +{ + struct _SpecialDayGroupList * next; + + onvif_SpecialDayGroup SpecialDayGroup; + +#ifdef LIBICAL + icalcomponent * comp; +#endif +} SpecialDayGroupList; + +// Schedule define end + +// Receiver define begin + +typedef struct +{ + onvif_ReceiverMode Mode; // required, connection modes + char MediaUri[256]; // required, Details of the URI to which the receiver should connect + onvif_StreamSetup StreamSetup; // required, Stream connection parameters +} onvif_ReceiverConfiguration; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, Unique identifier of the receiver + + onvif_ReceiverConfiguration Configuration; // required, Describes the configuration of the receiver +} onvif_Receiver; + +typedef struct +{ + onvif_ReceiverState State; // required, The connection state of the receiver + + BOOL AutoCreated; // required, Indicates whether or not the receiver was created automatically +} onvif_ReceiverStateInformation; + +typedef struct _ReceiverList +{ + struct _ReceiverList * next; + + onvif_Receiver Receiver; + onvif_ReceiverStateInformation StateInformation; +} ReceiverList; + +// Receiver define end + +// Provision define begin + +typedef struct +{ + uint32 PanFlag : 1; // Indicates whether the field Pan is valid + uint32 TiltFlag : 1; // Indicates whether the field Tilt is valid + uint32 ZoomFlag : 1; // Indicates whether the field Zoom is valid + uint32 RollFlag : 1; // Indicates whether the field Roll is valid + uint32 FocusFlag : 1; // Indicates whether the field Focus is valid + uint32 Reserved : 27; + + int Pan; // optional, The quantity of pan movement events over the life of the device + int Tilt; // optional, The quantity of tilt movement events over the life of the device + int Zoom; // optional, The quantity of zoom movement events over the life of the device + int Roll; // optional, The quantity of roll movement events over the life of the device + int Focus; // optional, The quantity of focus movement events over the life of the device +} onvif_Usage; + +// Provision define end + +#ifdef __cplusplus +extern "C" { +#endif + + +HT_API const char * onvif_CapabilityCategoryToString(onvif_CapabilityCategory category); +HT_API onvif_CapabilityCategory onvif_StringToCapabilityCategory(const char * str); + +HT_API const char * onvif_FactoryDefaultTypeToString(onvif_FactoryDefaultType type); +HT_API onvif_FactoryDefaultType onvif_StringToFactoryDefaultType(const char * str); + +HT_API const char * onvif_SystemLogTypeToString(onvif_SystemLogType type); +HT_API onvif_SystemLogType onvif_StringToSystemLogType(const char * str); + +HT_API const char * onvif_VideoEncodingToString(onvif_VideoEncoding encoding); +HT_API onvif_VideoEncoding onvif_StringToVideoEncoding(const char * str); + +HT_API const char * onvif_AudioEncodingToString(onvif_AudioEncoding encoding); +HT_API onvif_AudioEncoding onvif_StringToAudioEncoding(const char * str); + +HT_API const char * onvif_H264ProfileToString(onvif_H264Profile profile); +HT_API onvif_H264Profile onvif_StringToH264Profile(const char * str); + +HT_API const char * onvif_Mpeg4ProfileToString(onvif_Mpeg4Profile profile); +HT_API onvif_Mpeg4Profile onvif_StringToMpeg4Profile(const char * str); + +HT_API const char * onvif_UserLevelToString(onvif_UserLevel level); +HT_API onvif_UserLevel onvif_StringToUserLevel(const char * str); + +HT_API const char * onvif_MoveStatusToString(onvif_MoveStatus status); +HT_API onvif_MoveStatus onvif_StringToMoveStatus(const char * str); + +HT_API const char * onvif_OSDTypeToString(onvif_OSDType type); +HT_API onvif_OSDType onvif_StringToOSDType(const char * type); + +HT_API const char * onvif_OSDPosTypeToString(onvif_OSDPosType type); +HT_API onvif_OSDPosType onvif_StringToOSDPosType(const char * type); + +HT_API const char * onvif_OSDTextTypeToString(onvif_OSDTextType type); +HT_API onvif_OSDTextType onvif_StringToOSDTextType(const char * type); + +HT_API const char * onvif_BacklightCompensationModeToString(onvif_BacklightCompensationMode mode); +HT_API onvif_BacklightCompensationMode onvif_StringToBacklightCompensationMode(const char * str); + +HT_API const char * onvif_ExposureModeToString(onvif_ExposureMode mode); +HT_API onvif_ExposureMode onvif_StringToExposureMode(const char * str); + +HT_API const char * onvif_ExposurePriorityToString(onvif_ExposurePriority mode); +HT_API onvif_ExposurePriority onvif_StringToExposurePriority(const char * str); + +HT_API const char * onvif_AutoFocusModeToString(onvif_AutoFocusMode mode); +HT_API onvif_AutoFocusMode onvif_StringToAutoFocusMode(const char * str); + +HT_API const char * onvif_WideDynamicModeToString(onvif_WideDynamicMode mode); +HT_API onvif_WideDynamicMode onvif_StringToWideDynamicMode(const char * str); + +HT_API const char * onvif_IrCutFilterModeToString(onvif_IrCutFilterMode mode); +HT_API onvif_IrCutFilterMode onvif_StringToIrCutFilterMode(const char * str); + +HT_API const char * onvif_WhiteBalanceModeToString(onvif_WhiteBalanceMode mode); +HT_API onvif_WhiteBalanceMode onvif_StringToWhiteBalanceMode(const char * str); + +HT_API const char * onvif_EFlipModeToString(onvif_EFlipMode mode); +HT_API onvif_EFlipMode onvif_StringToEFlipMode(const char * str); + +HT_API const char * onvif_ReverseModeToString(onvif_ReverseMode mode); +HT_API onvif_ReverseMode onvif_StringToReverseMode(const char * str); + +HT_API const char * onvif_DiscoveryModeToString(onvif_DiscoveryMode mode); +HT_API onvif_DiscoveryMode onvif_StringToDiscoveryMode(const char * str); + +HT_API const char * onvif_SetDateTimeTypeToString(onvif_SetDateTimeType type); +HT_API onvif_SetDateTimeType onvif_StringToSetDateTimeType(const char * str); + +HT_API const char * onvif_StreamTypeToString(onvif_StreamType type); +HT_API onvif_StreamType onvif_StringToStreamType(const char * str); + +HT_API const char * onvif_TransportProtocolToString(onvif_TransportProtocol type); +HT_API onvif_TransportProtocol onvif_StringToTransportProtocol(const char * str); + +HT_API const char * onvif_DynamicDNSTypeToString(onvif_DynamicDNSType type); +HT_API onvif_DynamicDNSType onvif_StringToDynamicDNSType(const char * str); + +HT_API const char * onvif_TrackTypeToString(onvif_TrackType type); +HT_API onvif_TrackType onvif_StringToTrackType(const char * str); + +HT_API const char * onvif_PropertyOperationToString(onvif_PropertyOperation type); +HT_API onvif_PropertyOperation onvif_StringToPropertyOperation(const char * str); + +HT_API const char * onvif_RecordingStatusToString(onvif_RecordingStatus status); +HT_API onvif_RecordingStatus onvif_StringToRecordingStatus(const char * str); + +HT_API const char * onvif_SearchStateToString(onvif_SearchState state); +HT_API onvif_SearchState onvif_StringToSearchState(const char * str); + +HT_API const char * onvif_RotateModeToString(onvif_RotateMode mode); +HT_API onvif_RotateMode onvif_StringToRotateMode(const char * str); + +HT_API const char * onvif_ScopeDefinitionToString(onvif_ScopeDefinition def); +HT_API onvif_ScopeDefinition onvif_StringToScopeDefinition(const char * str); + +HT_API const char * onvif_Dot11AuthAndMangementSuiteToString(onvif_Dot11AuthAndMangementSuite req); +HT_API onvif_Dot11AuthAndMangementSuite onvif_StringToDot11AuthAndMangementSuite(const char * str); + +HT_API const char * onvif_Dot11CipherToString(onvif_Dot11Cipher req); +HT_API onvif_Dot11Cipher onvif_StringToDot11Cipher(const char * str); + +HT_API const char * onvif_Dot11SignalStrengthToString(onvif_Dot11SignalStrength req); +HT_API onvif_Dot11SignalStrength onvif_StringToDot11SignalStrength(const char * str); + +HT_API const char * onvif_Dot11StationModeToString(onvif_Dot11StationMode req); +HT_API onvif_Dot11StationMode onvif_StringToDot11StationMode(const char * str); + +HT_API const char * onvif_Dot11SecurityModeToString(onvif_Dot11SecurityMode req); +HT_API onvif_Dot11SecurityMode onvif_StringToDot11SecurityMode(const char * str); + +HT_API const char * onvif_PTZPresetTourOperationToString(onvif_PTZPresetTourOperation op); +HT_API onvif_PTZPresetTourOperation onvif_StringToPTZPresetTourOperation(const char * str); + +HT_API const char * onvif_PTZPresetTourStateToString(onvif_PTZPresetTourState st); +HT_API onvif_PTZPresetTourState onvif_StringToPTZPresetTourState(const char * str); + +HT_API const char * onvif_PTZPresetTourDirectionToString(onvif_PTZPresetTourDirection dir); +HT_API onvif_PTZPresetTourDirection onvif_StringToPTZPresetTourDirection(const char * str); + +HT_API const char * onvif_DoorPhysicalStateToString(onvif_DoorPhysicalState state); +HT_API onvif_DoorPhysicalState onvif_StringToDoorPhysicalState(const char * str); + +HT_API const char * onvif_LockPhysicalStateToString(onvif_LockPhysicalState state); +HT_API onvif_LockPhysicalState onvif_StringToLockPhysicalState(const char * str); + +HT_API const char * onvif_DoorAlarmStateToString(onvif_DoorAlarmState state); +HT_API onvif_DoorAlarmState onvif_StringToDoorAlarmState(const char * str); + +HT_API const char * onvif_DoorTamperStateToString(onvif_DoorTamperState state); +HT_API onvif_DoorTamperState onvif_StringToDoorTamperState(const char * str); + +HT_API const char * onvif_DoorFaultStateToString(onvif_DoorFaultState state); +HT_API onvif_DoorFaultState onvif_StringToDoorFaultState(const char * str); + +HT_API const char * onvif_DoorModeToString(onvif_DoorMode mode); +HT_API onvif_DoorMode onvif_StringToDoorMode(const char * str); + +HT_API const char * onvif_RelayModeToString(onvif_RelayMode mode); +HT_API onvif_RelayMode onvif_StringToRelayMode(const char * str); + +HT_API const char * onvif_RelayIdleStateToString(onvif_RelayIdleState state); +HT_API onvif_RelayIdleState onvif_StringToRelayIdleState(const char * str); + +HT_API const char * onvif_RelayLogicalStateToString(onvif_RelayLogicalState state); +HT_API onvif_RelayLogicalState onvif_StringToRelayLogicalState(const char * str); + +HT_API const char * onvif_DigitalIdleStateToString(onvif_DigitalIdleState state); +HT_API onvif_DigitalIdleState onvif_StringToDigitalIdleState(const char * str); + +HT_API const char * onvif_ParityBitToString(onvif_ParityBit type); +HT_API onvif_ParityBit onvif_StringToParityBit(const char * str); + +HT_API const char * onvif_SerialPortTypeToString(onvif_SerialPortType type); +HT_API onvif_SerialPortType onvif_StringToSerialPortType(const char * str); + +HT_API const char * onvif_PolarityToString(onvif_Polarity type); +HT_API onvif_Polarity onvif_StringToPolarity(const char * str); + +HT_API const char * onvif_ReceiverModeToString(onvif_ReceiverMode mode); +HT_API onvif_ReceiverMode onvif_StringToReceiverMode(const char * str); + +HT_API const char * onvif_ReceiverStateToString(onvif_ReceiverState state); +HT_API onvif_ReceiverState onvif_StringToReceiverState(const char * str); + +HT_API const char * onvif_IPAddressFilterTypeToString(onvif_IPAddressFilterType type); +HT_API onvif_IPAddressFilterType onvif_StringToIPAddressFilterType(const char * str); + +HT_API const char * onvif_PanDirectionToString(onvif_PanDirection dir); +HT_API onvif_PanDirection onvif_StringToPanDirection(const char * str); +HT_API const char * onvif_TiltDirectionToString(onvif_TiltDirection dir); +HT_API onvif_TiltDirection onvif_StringToTiltDirection(const char * str); +HT_API const char * onvif_ZoomDirectionToString(onvif_ZoomDirection dir); +HT_API onvif_ZoomDirection onvif_StringToZoomDirection(const char * str); +HT_API const char * onvif_RollDirectionToString(onvif_RollDirection dir); +HT_API onvif_RollDirection onvif_StringToRollDirection(const char * str); +HT_API const char * onvif_FocusDirectionToString(onvif_FocusDirection dir); +HT_API onvif_FocusDirection onvif_StringToFocusDirection(const char * str); + + +#ifdef __cplusplus +} +#endif + +#endif /* end of ONVIF_COMM_H */ + + + + + diff --git a/ONVIF/include/onvif/onvif_event.h b/ONVIF/include/onvif/onvif_event.h new file mode 100644 index 0000000..77a5b40 --- /dev/null +++ b/ONVIF/include/onvif/onvif_event.h @@ -0,0 +1,117 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef ONVIF_EVENT_H +#define ONVIF_EVENT_H + +#include "sys_inc.h" +#include "onvif.h" +#include "xml_node.h" +#include "onvif_req.h" +#include "http.h" + +typedef struct +{ + BOOL used_flag; + + ONVIF_DEVICE * p_dev; +} ONVIF_TIMER_DEV; + +typedef void (* onvif_event_notify_cb)(Notify_REQ * p_req, void * pdata); +typedef void (* onvif_subscribe_disconnect_cb)(ONVIF_DEVICE * p_dev, void * pdata); + +typedef struct +{ + onvif_event_notify_cb notify_cb; + void * notify_cb_data; + void * notify_cb_mutex; + + onvif_subscribe_disconnect_cb disconnect_cb; + void * disconnect_cb_data; + void * disconnect_cb_mutex; + + HTTPSRV http_srv; // http server for receiving event notify + pthread_t event_timer_id; + int event_timer_run; + PPSN_CTX * event_dev_fl; + PPSN_CTX * event_dev_ul; + int event_dev_max; +} ONVIF_EVENT_CLS; + + +#ifdef __cplusplus +extern "C" { +#endif + + +/** + * init event handler + * + * init http server for receiving event notify messages + * + * http_srv_addr : http server listen address, NULL means listening on all interfaces + * http_srv_port : http server listen port + * max_clients : max support client numbers + * + */ +HT_API BOOL onvif_event_init(const char * http_srv_addr, uint16 http_srv_port, int max_clients); + +/** + * deinit event handler + */ +HT_API void onvif_event_deinit(); + +/** + * set event notify callback + * + * set cb to NULL, disable callback + */ +HT_API void onvif_set_event_notify_cb(onvif_event_notify_cb cb, void * pdata); + +/** + * set event subscribe disconnect callback + * + * set cb to NULL, disable callback + */ +HT_API void onvif_set_subscribe_disconnect_cb(onvif_subscribe_disconnect_cb cb, void * pdata); + +/** + * event notify handler, called by http_soap_process + */ +HT_API void onvif_event_notify(HTTPCLN * p_user, HTTPMSG * rx_msg, XMLN * p_xml); + +/** + * add p_dev to event timer list, send renew request + */ +HT_API BOOL onvif_event_timer_add(ONVIF_DEVICE * p_dev); + +/** + * del p_dev from event timer list + */ +HT_API BOOL onvif_event_timer_del(ONVIF_DEVICE * p_dev); + +#ifdef __cplusplus +} +#endif + + +#endif + + + diff --git a/ONVIF/include/onvif/onvif_http.h b/ONVIF/include/onvif/onvif_http.h new file mode 100644 index 0000000..a444aaf --- /dev/null +++ b/ONVIF/include/onvif/onvif_http.h @@ -0,0 +1,41 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef ONVIF_HTTP_H +#define ONVIF_HTTP_H + +#include "onvif.h" +#include "http.h" + +#ifdef __cplusplus +extern "C" { +#endif + +HT_API BOOL http_onvif_trans(HTTPREQ * p_http, int timeout, eOnvifAction act, ONVIF_DEVICE * p_dev, void * p_req, void * p_res); +HT_API BOOL http_onvif_file_upload(HTTPREQ * p_http, int timeout, const char * filename, ONVIF_DEVICE * p_dev); +HT_API BOOL http_onvif_download(HTTPREQ * p_http, int timeout, uint8 ** pp_buf, int * buflen, ONVIF_DEVICE * p_dev); + +#ifdef __cplusplus +} +#endif + +#endif + + + diff --git a/ONVIF/include/onvif/onvif_pkt.h b/ONVIF/include/onvif/onvif_pkt.h new file mode 100644 index 0000000..29e0b76 --- /dev/null +++ b/ONVIF/include/onvif/onvif_pkt.h @@ -0,0 +1,38 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef ONVIF_PKT_H +#define ONVIF_PKT_H + +#include "sys_inc.h" +#include "onvif.h" + +#ifdef __cplusplus +extern "C" { +#endif + +int build_onvif_req_xml(char * p_buf, int mlen, eOnvifAction type, ONVIF_DEVICE * p_dev, void * p_req); + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/ONVIF/include/onvif/onvif_probe.h b/ONVIF/include/onvif/onvif_probe.h new file mode 100644 index 0000000..be01d15 --- /dev/null +++ b/ONVIF/include/onvif/onvif_probe.h @@ -0,0 +1,123 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef __H_ONVIF_PROBE_H__ +#define __H_ONVIF_PROBE_H__ + +#include "onvif.h" + +#define PROBE_MSGTYPE_MATCH 0 +#define PROBE_MSGTYPE_HELLO 1 +#define PROBE_MSGTYPE_BYE 2 + +#define MAX_PROBE_FD 8 + +/* + * onvif probe callback function + * p_res : the DEVICE_BINFO struct point + * pdata : the user data + * msgypte : + * PROBE_MSGTYPE_MATCH - probe match + * PROBE_MSGTYPE_HELLO - hello + * PROBE_MSGTYPE_BYE - bye + * note : if msgtype = PROBE_MSGTYPE_BYE, only p_res->EndpointReference field is valid, the other fields is invalid + */ +typedef void (* onvif_probe_cb)(DEVICE_BINFO * p_res, int msgtype, void * pdata); + +typedef struct +{ + onvif_probe_cb probe_cb; + void * probe_cb_data; + void * probe_mutex; + pthread_t probe_thread; + SOCKET probe_fd[MAX_PROBE_FD]; + int probe_interval; + BOOL probe_running; + char monitor_reference[100]; + int monitor_msgtype; + onvif_probe_cb monitor_cb; + void * monitor_cb_data; + void * monitor_mutex; +} ONVIF_PROBE_CLS; + + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @desc, set monitor callback function + * + * @param, + * reference - endpoint reference + * msgtype - probe message type + * cb - callback function + * pdata - user data + * +**/ +HT_API void set_monitor_cb(char * reference, int msgtype, onvif_probe_cb cb, void * pdata); + +/** + * @desc, set probe callback function + * + * @param, + * cb - callback function + * pdata - user data + * +**/ +HT_API void set_probe_cb(onvif_probe_cb cb, void * pdata); + +/** + * @desc, set probe interval + * + * @param, + * interval - probe interval, unit is second, default is 30s + * +**/ +HT_API void set_probe_interval(int interval); + +/** + * @desc, start probe thread + * + * @param, + * ip - start probe thread on the specify ip address, it can be NULL, if ip is NULL, it will use the default ip + * interval - probe interval, unit is second, default is 30s +**/ +HT_API int start_probe(const char * ip, int interval); + +/** + * @desc, stop probe thread + * +**/ +HT_API void stop_probe(); + +/** + * @desc, send probe request + * +**/ +HT_API void send_probe_req(); + + +#ifdef __cplusplus +} +#endif + +#endif // __H_ONVIF_PROBE_H__ + + diff --git a/ONVIF/include/onvif/onvif_req.h b/ONVIF/include/onvif/onvif_req.h new file mode 100644 index 0000000..a00edcf --- /dev/null +++ b/ONVIF/include/onvif/onvif_req.h @@ -0,0 +1,2596 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef ONVIF_REQ_H +#define ONVIF_REQ_H + + +/************************************************************************* + * + * onvif request structure + * +**************************************************************************/ + +typedef struct +{ + onvif_CapabilityCategory Category; // optional, List of categories to retrieve capability information on +} tds_GetCapabilities_REQ; + +typedef struct +{ + BOOL IncludeCapability; // required, Indicates if the service capabilities (untyped) should be included in the response. +} tds_GetServices_REQ; + +typedef struct +{ + int dummy; +} tds_GetServiceCapabilities_REQ; + +typedef struct +{ + int dummy; +} tds_GetDeviceInformation_REQ; + +typedef struct +{ + int dummy; +} tds_GetUsers_REQ; + +typedef struct +{ + onvif_User User; // required +} tds_CreateUsers_REQ; + +typedef struct +{ + char Username[ONVIF_NAME_LEN]; // required +} tds_DeleteUsers_REQ; + +typedef struct +{ + onvif_User User; // required +} tds_SetUser_REQ; + +typedef struct +{ + int dummy; +} tds_GetRemoteUser_REQ; + +typedef struct +{ + uint32 RemoteUserFlag : 1; // Indicates whether the field RemoteUser is valid + uint32 Reserved : 31; + + onvif_RemoteUser RemoteUser; // optional +} tds_SetRemoteUser_REQ; + +typedef struct +{ + int dummy; +} tds_GetNetworkInterfaces_REQ; + +typedef struct +{ + onvif_NetworkInterface NetworkInterface; +} tds_SetNetworkInterfaces_REQ; + +typedef struct +{ + int dummy; +} tds_GetNTP_REQ; + +typedef struct +{ + onvif_NTPInformation NTPInformation; +} tds_SetNTP_REQ; + +typedef struct +{ + int dummy; +} tds_GetHostname_REQ; + +typedef struct +{ + char Name[ONVIF_NAME_LEN]; // required +} tds_SetHostname_REQ; + +typedef struct +{ + BOOL FromDHCP; // required, True if the hostname shall be obtained via DHCP +} tds_SetHostnameFromDHCP_REQ; + +typedef struct +{ + int dummy; +} tds_GetDNS_REQ; + +typedef struct +{ + onvif_DNSInformation DNSInformation; +} tds_SetDNS_REQ; + +typedef struct +{ + int dummy; +} tds_GetDynamicDNS_REQ; + +typedef struct +{ + onvif_DynamicDNSInformation DynamicDNSInformation; +} tds_SetDynamicDNS_REQ; + +typedef struct +{ + int dummy; +} tds_GetNetworkProtocols_REQ; + +typedef struct +{ + onvif_NetworkProtocol NetworkProtocol; +} tds_SetNetworkProtocols_REQ; + +typedef struct +{ + int dummy; +} tds_GetDiscoveryMode_REQ; + +typedef struct +{ + onvif_DiscoveryMode DiscoveryMode; // required, Indicator of discovery mode: Discoverable, NonDiscoverable +} tds_SetDiscoveryMode_REQ; + +typedef struct +{ + int dummy; +} tds_GetNetworkDefaultGateway_REQ; + +typedef struct +{ + char IPv4Address[MAX_GATEWAY][32]; // optional, Sets IPv4 gateway address used as default setting +} tds_SetNetworkDefaultGateway_REQ; + +typedef struct +{ + int dummy; +} tds_GetZeroConfiguration_REQ; + +typedef struct +{ + char InterfaceToken[ONVIF_TOKEN_LEN]; // requied, Unique identifier referencing the physical interface + BOOL Enabled; // requied, Specifies if the zero-configuration should be enabled or not +} tds_SetZeroConfiguration_REQ; + +typedef struct +{ + int dummy; +} tds_GetEndpointReference_REQ; + +typedef struct +{ + char AuxiliaryCommand[1024]; // required +} tds_SendAuxiliaryCommand_REQ; + +typedef struct +{ + int dummy; +} tds_GetRelayOutputs_REQ; + +typedef struct +{ + char RelayOutputToken[ONVIF_TOKEN_LEN]; // required + + onvif_RelayOutputSettings Properties; // required +} tds_SetRelayOutputSettings_REQ; + +typedef struct +{ + char RelayOutputToken[ONVIF_TOKEN_LEN]; // required + + onvif_RelayLogicalState LogicalState; // required +} tds_SetRelayOutputState_REQ; + +typedef struct +{ + int dummy; +} tds_GetSystemDateAndTime_REQ; + +typedef struct +{ + uint32 UTCDateTimeFlag : 1; // Indicates whether the field UTCDateTime is valid + uint32 Reserved : 31; + + onvif_SystemDateTime SystemDateTime; // required, + onvif_DateTime UTCDateTime; // optional, Date and time in UTC. If time is obtained via NTP, UTCDateTime has no meaning +} tds_SetSystemDateAndTime_REQ; + +typedef struct +{ + int dummy; +} tds_SystemReboot_REQ; + +typedef struct +{ + onvif_FactoryDefaultType FactoryDefault; // required +} tds_SetSystemFactoryDefault_REQ; + +typedef struct +{ + onvif_SystemLogType LogType; // required, Specifies the type of system log to get +} tds_GetSystemLog_REQ; + +typedef struct +{ + int dummy; +} tds_GetScopes_REQ; + +typedef struct +{ + int sizeScopes; + char Scopes[MAX_SCOPE_NUMS][100]; +} tds_SetScopes_REQ; + +typedef struct +{ + int sizeScopeItem; + char ScopeItem[MAX_SCOPE_NUMS][100]; // required +} tds_AddScopes_REQ; + +typedef struct +{ + int sizeScopeItem; + char ScopeItem[MAX_SCOPE_NUMS][100]; // required +} tds_RemoveScopes_REQ; + +typedef struct +{ + int dummy; +} tds_StartFirmwareUpgrade_REQ; + +typedef struct +{ + int dummy; +} tds_GetSystemUris_REQ; + +typedef struct +{ + int dummy; +} tds_StartSystemRestore_REQ; + +typedef struct +{ + int dummy; +} tds_GetWsdlUrl_REQ; + +typedef struct +{ + int dummy; +} tds_GetDot11Capabilities_REQ; + +typedef struct +{ + char InterfaceToken[ONVIF_TOKEN_LEN]; // required +} tds_GetDot11Status_REQ; + +typedef struct +{ + char InterfaceToken[ONVIF_TOKEN_LEN]; // required +} tds_ScanAvailableDot11Networks_REQ; + +typedef struct +{ + int dummy; +} tds_GetGeoLocation_REQ; + +typedef struct +{ + LocationEntityList * Location; // required +} tds_SetGeoLocation_REQ; + +typedef struct +{ + LocationEntityList * Location; // required +} tds_DeleteGeoLocation_REQ; + +typedef struct +{ + char Algorithm[64]; // required, Hashing algorithm(s) used in HTTP and RTSP Digest Authentication +} tds_SetHashingAlgorithm_REQ; + +typedef struct +{ + int dummy; +} tds_GetIPAddressFilter_REQ; + +typedef struct +{ + onvif_IPAddressFilter IPAddressFilter; // required +} tds_SetIPAddressFilter_REQ; + +typedef struct +{ + onvif_IPAddressFilter IPAddressFilter; // required +} tds_AddIPAddressFilter_REQ; + +typedef struct +{ + onvif_IPAddressFilter IPAddressFilter; // required +} tds_RemoveIPAddressFilter_REQ; + +typedef struct +{ + int dummy; +} tds_GetAccessPolicy_REQ; + +typedef struct +{ + onvif_BinaryData PolicyFile; // required +} tds_SetAccessPolicy_REQ; + +typedef struct +{ + int dummy; +} tds_GetStorageConfigurations_REQ; + +typedef struct +{ + onvif_StorageConfigurationData StorageConfiguration; // required +} tds_CreateStorageConfiguration_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required +} tds_GetStorageConfiguration_REQ; + +typedef struct +{ + onvif_StorageConfiguration StorageConfiguration; // required +} tds_SetStorageConfiguration_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required +} tds_DeleteStorageConfiguration_REQ; + +typedef struct +{ + int dummy; +} trt_GetServiceCapabilities_REQ; + +typedef struct +{ + int dummy; +} trt_GetVideoSources_REQ; + +typedef struct +{ + int dummy; +} trt_GetAudioSources_REQ; + +typedef struct +{ + uint32 TokenFlag : 1; // Indicates whether the field Token is valid + uint32 Reserved : 31; + + char Name[ONVIF_NAME_LEN]; // required, friendly name of the profile to be created + char Token[ONVIF_TOKEN_LEN]; // optional, Optional token, specifying the unique identifier of the new profile +} trt_CreateProfile_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, this command requests a specific profile +} trt_GetProfile_REQ; + +typedef struct +{ + int dummy; +} trt_GetProfiles_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, Reference to the profile where the configuration should be added + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Contains a reference to the VideoEncoderConfiguration to add +} trt_AddVideoEncoderConfiguration_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, Reference to the profile where the configuration should be added + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Contains a reference to the VideoEncoderConfiguration to add +} trt_AddVideoSourceConfiguration_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, Reference to the profile where the configuration should be added + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Contains a reference to the VideoEncoderConfiguration to add +} trt_AddAudioEncoderConfiguration_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, Reference to the profile where the configuration should be added + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Contains a reference to the VideoEncoderConfiguration to add +} trt_AddAudioSourceConfiguration_REQ; + +typedef struct +{ + char VideoSourceToken[ONVIF_TOKEN_LEN]; // required, Contains a video source reference for which a video source mode is requested +} trt_GetVideoSourceModes_REQ; + +typedef struct +{ + char VideoSourceToken[ONVIF_TOKEN_LEN]; // required, Contains a video source reference for which a video source mode is requested + char VideoSourceModeToken[ONVIF_TOKEN_LEN]; // required, Indicate video source mode +} trt_SetVideoSourceMode_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, Reference to the profile where the configuration should be added + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Contains a reference to the VideoEncoderConfiguration to add +} trt_AddPTZConfiguration_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, Contains a reference to the media profile from which the VideoEncoderConfiguration shall be removed +} trt_RemoveVideoEncoderConfiguration_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, Contains a reference to the media profile from which the VideoSourceConfiguration shall be removed +} trt_RemoveVideoSourceConfiguration_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, Contains a reference to the media profile from which the AudioEncoderConfiguration shall be removed +} trt_RemoveAudioEncoderConfiguration_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, Contains a reference to the media profile from which the AudioSourceConfiguration shall be removed +} trt_RemoveAudioSourceConfiguration_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, Contains a reference to the media profile from which the PTZConfiguration shall be removed +} trt_RemovePTZConfiguration_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, This element contains a reference to the profile that should be deleted +} trt_DeleteProfile_REQ; + +typedef struct +{ + int dummy; +} trt_GetVideoSourceConfigurations_REQ; + +typedef struct +{ + int dummy; +} trt_GetVideoEncoderConfigurations_REQ; + +typedef struct +{ + int dummy; +} trt_GetAudioSourceConfigurations_REQ; + +typedef struct +{ + int dummy; +} trt_GetAudioEncoderConfigurations_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Token of the requested video source configuration +} trt_GetVideoSourceConfiguration_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Token of the requested video encoder configuration +} trt_GetVideoEncoderConfiguration_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Token of the requested audio source configuration +} trt_GetAudioSourceConfiguration_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Token of the requested audio encoder configuration +} trt_GetAudioEncoderConfiguration_REQ; + +typedef struct +{ + onvif_VideoSourceConfiguration VideoSourceConfiguration; + + BOOL ForcePersistence; // required, The ForcePersistence element is obsolete and should always be assumed to be true +} trt_SetVideoSourceConfiguration_REQ; + +typedef struct +{ + onvif_VideoEncoderConfiguration VideoEncoderConfiguration; + + BOOL ForcePersistence; // required, The ForcePersistence element is obsolete and should always be assumed to be true +} trt_SetVideoEncoderConfiguration_REQ; + +typedef struct +{ + onvif_AudioSourceConfiguration AudioSourceConfiguration; + + BOOL ForcePersistence; // required, The ForcePersistence element is obsolete and should always be assumed to be true +} trt_SetAudioSourceConfiguration_REQ; + +typedef struct +{ + onvif_AudioEncoderConfiguration AudioEncoderConfiguration; + + BOOL ForcePersistence; // required, The ForcePersistence element is obsolete and should always be assumed to be true +} trt_SetAudioEncoderConfiguration_REQ; + +typedef struct +{ + uint32 ProfileTokenFlag : 1; // Indicates whether the field ProfileToken is valid + uint32 ConfigurationTokenFlag : 1; // Indicates whether the field ConfigurationToken is valid + uint32 Reserved : 30; + + char ProfileToken[ONVIF_TOKEN_LEN]; // optional, Optional ProfileToken that specifies an existing media profile that the options shall be compatible with + char ConfigurationToken[ONVIF_TOKEN_LEN]; // optional, Optional video source configurationToken that specifies an existing configuration that the options are intended for +} trt_GetVideoSourceConfigurationOptions_REQ; + +typedef struct +{ + uint32 ProfileTokenFlag : 1; // Indicates whether the field ProfileToken is valid + uint32 ConfigurationTokenFlag : 1; // Indicates whether the field ConfigurationToken is valid + uint32 Reserved : 30; + + char ProfileToken[ONVIF_TOKEN_LEN]; // optional, Optional ProfileToken that specifies an existing media profile that the options shall be compatible with + char ConfigurationToken[ONVIF_TOKEN_LEN]; // optional, Optional video encoder configuration token that specifies an existing configuration that the options are intended for +} trt_GetVideoEncoderConfigurationOptions_REQ; + +typedef struct +{ + uint32 ProfileTokenFlag : 1; // Indicates whether the field ProfileToken is valid + uint32 ConfigurationTokenFlag : 1; // Indicates whether the field ConfigurationToken is valid + uint32 Reserved : 30; + + char ProfileToken[ONVIF_TOKEN_LEN]; // optional, Optional ProfileToken that specifies an existing media profile that the options shall be compatible with + char ConfigurationToken[ONVIF_TOKEN_LEN]; // optional, Optional audio source configuration token that specifies an existing configuration that the options are intended for +} trt_GetAudioSourceConfigurationOptions_REQ; + +typedef struct +{ + uint32 ProfileTokenFlag : 1; // Indicates whether the field ProfileToken is valid + uint32 ConfigurationTokenFlag : 1; // Indicates whether the field ConfigurationToken is valid + uint32 Reserved : 30; + + char ProfileToken[ONVIF_TOKEN_LEN]; // optional, Optional ProfileToken that specifies an existing media profile that the options shall be compatible with + char ConfigurationToken[ONVIF_TOKEN_LEN]; // optional, Optional audio encoder configuration token that specifies an existing configuration that the options are intended for +} trt_GetAudioEncoderConfigurationOptions_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, The ProfileToken element indicates the media profile to use and will define the configuration of the content of the stream + + onvif_StreamSetup StreamSetup; // required, Stream Setup that should be used with the uri +} trt_GetStreamUri_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, Contains a Profile reference for which a Synchronization Point is requested +} trt_SetSynchronizationPoint_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, The ProfileToken element indicates the media profile to use and will define the source and dimensions of the snapshot +} trt_GetSnapshotUri_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Token of the video source configuration +} trt_GetGuaranteedNumberOfVideoEncoderInstances_REQ; + +typedef struct +{ + int dummy; +} trt_GetAudioOutputs_REQ; + +typedef struct +{ + int dummy; +} trt_GetAudioOutputConfigurations_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Token of the requested audio output configuration +} trt_GetAudioOutputConfiguration_REQ; + +typedef struct +{ + uint32 ConfigurationTokenFlag : 1; // Indicates whether the field ConfigurationToken is valid + uint32 ProfileTokenFlag : 1; // Indicates whether the field ProfileToken is valid + uint32 Reserved : 30; + + char ConfigurationToken[ONVIF_TOKEN_LEN]; // optional, Optional audio output configuration token that specifies an existing configuration that the options are intended for + char ProfileToken[ONVIF_TOKEN_LEN]; // optional, Optional ProfileToken that specifies an existing media profile that the options shall be compatible with +} trt_GetAudioOutputConfigurationOptions_REQ; + +typedef struct +{ + onvif_AudioOutputConfiguration Configuration; // required, Contains the modified audio output configuration. The configuration shall exist in the device + + BOOL ForcePersistence; // required, The ForcePersistence element is obsolete and should always be assumed to be true +} trt_SetAudioOutputConfiguration_REQ; + +typedef struct +{ + int dummy; +} trt_GetAudioDecoderConfigurations_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Token of the requested audio decoder configuration +} trt_GetAudioDecoderConfiguration_REQ; + +typedef struct +{ + uint32 ConfigurationTokenFlag : 1; // Indicates whether the field ConfigurationToken is valid + uint32 ProfileTokenFlag : 1; // Indicates whether the field ProfileToken is valid + uint32 Reserved : 30; + + char ConfigurationToken[ONVIF_TOKEN_LEN]; // optional, Optional audio decoder configuration token that specifies an existing configuration that the options are intended for + char ProfileToken[ONVIF_TOKEN_LEN]; // optional, Optional ProfileToken that specifies an existing media profile that the options shall be compatible with +} trt_GetAudioDecoderConfigurationOptions_REQ; + +typedef struct +{ + onvif_AudioDecoderConfiguration Configuration; // required, Contains the modified audio decoder configuration. The configuration shall exist in the device + + BOOL ForcePersistence; // required, The ForcePersistence element is obsolete and should always be assumed to be true +} trt_SetAudioDecoderConfiguration_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, Reference to the profile where the configuration should be added + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Contains a reference to the AudioOutputConfiguration to add +} trt_AddAudioOutputConfiguration_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, This element contains a reference to the profile where the configuration should be added + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, This element contains a reference to the AudioDecoderConfiguration to add +} trt_AddAudioDecoderConfiguration_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, Contains a reference to the media profile from which the AudioOutputConfiguration shall be removed +} trt_RemoveAudioOutputConfiguration_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, This element contains a reference to the media profile from which the AudioDecoderConfiguration shall be removed +} trt_RemoveAudioDecoderConfiguration_REQ; + +typedef struct +{ + uint32 ConfigurationTokenFlag : 1; // Indicates whether the field ConfigurationToken is valid + uint32 Reserved : 31; + + char ConfigurationToken[ONVIF_TOKEN_LEN]; // optional, Token of the Video Source Configuration, which has OSDs associated with are requested. If token not exist, request all available OSDs +} trt_GetOSDs_REQ; + +typedef struct +{ + char OSDToken[ONVIF_TOKEN_LEN]; // required, The GetOSD command fetches the OSD configuration if the OSD token is known +} trt_GetOSD_REQ; + +typedef struct +{ + onvif_OSDConfiguration OSD; // required, Contains the modified OSD configuration +} trt_SetOSD_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Video Source Configuration Token that specifies an existing video source configuration that the options shall be compatible with +} trt_GetOSDOptions_REQ; + +typedef struct +{ + onvif_OSDConfiguration OSD; // required, Contain the initial OSD configuration for create +} trt_CreateOSD_REQ; + +typedef struct +{ + char OSDToken[ONVIF_TOKEN_LEN]; // required, This element contains a reference to the OSD configuration that should be deleted +} trt_DeleteOSD_REQ; + + +typedef struct +{ + int dummy; +} trt_GetVideoAnalyticsConfigurations_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, Reference to the profile where the configuration should be added + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Contains a reference to the VideoAnalyticsConfiguration to add +} trt_AddVideoAnalyticsConfiguration_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, The requested video analytics configuration +} trt_GetVideoAnalyticsConfiguration_REQ; + +typedef struct +{ + onvif_VideoAnalyticsConfiguration Configuration; // required, Contains the modified video analytics configuration. The configuration shall exist in the device + + BOOL ForcePersistence; // required, The ForcePersistence element is obsolete and should always be assumed to be true +} trt_SetVideoAnalyticsConfiguration_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, Contains a reference to the media profile from which the VideoAnalyticsConfiguration shall be removed +} trt_RemoveVideoAnalyticsConfiguration_REQ; + +typedef struct +{ + int dummy; +} trt_GetMetadataConfigurations_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, Reference to the profile where the configuration should be added + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Contains a reference to the MetadataConfiguration to add +} trt_AddMetadataConfiguration_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, The requested metadata configuration +} trt_GetMetadataConfiguration_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, Contains a reference to the media profile from which the MetadataConfiguration shall be removed +} trt_RemoveMetadataConfiguration_REQ; + +typedef struct +{ + onvif_MetadataConfiguration Configuration; // required, Contains the modified metadata configuration. The configuration shall exist in the device + BOOL ForcePersistence; // required, The ForcePersistence element is obsolete and should always be assumed to be true +} trt_SetMetadataConfiguration_REQ; + +typedef struct +{ + uint32 ConfigurationTokenFlag : 1; // Indicates whether the field ConfigurationToken is valid + uint32 ProfileTokenFlag : 1; // Indicates whether the field ProfileToken is valid + uint32 Reserved : 30; + + char ConfigurationToken[ONVIF_TOKEN_LEN]; // optional, Optional metadata configuration token that specifies an existing configuration that the options are intended for + char ProfileToken[ONVIF_TOKEN_LEN]; // optional, Optional ProfileToken that specifies an existing media profile that the options shall be compatible with +} trt_GetMetadataConfigurationOptions_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required +} trt_GetCompatibleVideoEncoderConfigurations_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required +} trt_GetCompatibleAudioEncoderConfigurations_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required +} trt_GetCompatibleVideoAnalyticsConfigurations_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required +} trt_GetCompatibleMetadataConfigurations_REQ; + +typedef struct +{ + int dummy; +} ptz_GetServiceCapabilities_REQ; + +typedef struct +{ + int dummy; +} ptz_GetNodes_REQ; + +typedef struct +{ + char NodeToken[ONVIF_TOKEN_LEN]; // required, Token of the requested PTZNode +} ptz_GetNode_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, A reference to the MediaProfile where the operation should take place +} ptz_GetPresets_REQ; + +typedef struct +{ + uint32 PresetTokenFlag : 1; // Indicates whether the field PresetToken is valid + uint32 PresetNameFlag : 1; // Indicates whether the field PresetName is valid + uint32 Reserved : 30; + + char ProfileToken[ONVIF_TOKEN_LEN]; // required, A reference to the MediaProfile where the operation should take place + char PresetToken[ONVIF_TOKEN_LEN]; // optional, A requested preset token + char PresetName[ONVIF_NAME_LEN]; // optional, A requested preset name +} ptz_SetPreset_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, A reference to the MediaProfile where the operation should take place + char PresetToken[ONVIF_TOKEN_LEN]; // required, A requested preset token +} ptz_RemovePreset_REQ; + +typedef struct +{ + uint32 SpeedFlag : 1; // Indicates whether the field Speed is valid + uint32 Reserved : 31; + + char ProfileToken[ONVIF_TOKEN_LEN]; // required, A reference to the MediaProfile where the operation should take place + char PresetToken[ONVIF_TOKEN_LEN]; // required, A requested preset token + + onvif_PTZSpeed Speed; // optional, A requested speed.The speed parameter can only be specified when Speed Spaces are available for the PTZ Node +} ptz_GotoPreset_REQ; + +typedef struct +{ + uint32 SpeedFlag : 1; // Indicates whether the field Speed is valid + uint32 Reserved : 31; + + char ProfileToken[ONVIF_TOKEN_LEN]; // required, A reference to the MediaProfile where the operation should take place + + onvif_PTZSpeed Speed; // optional, A requested speed.The speed parameter can only be specified when Speed Spaces are available for the PTZ Node +} ptz_GotoHomePosition_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, A reference to the MediaProfile where the home position should be set +} ptz_SetHomePosition_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, A reference to the MediaProfile where the PTZStatus should be requested +} ptz_GetStatus_REQ; + +typedef struct +{ + uint32 TimeoutFlag : 1; // Indicates whether the field Timeout is valid + uint32 Reserved : 31; + + char ProfileToken[ONVIF_TOKEN_LEN]; // required, A reference to the MediaProfile + + onvif_PTZSpeed Velocity; // required, A Velocity vector specifying the velocity of pan, tilt and zoom + + int Timeout; // optional, An optional Timeout parameter, unit is second +} ptz_ContinuousMove_REQ; + +typedef struct +{ + uint32 SpeedFlag : 1; // Indicates whether the field Speed is valid + uint32 Reserved : 31; + + char ProfileToken[ONVIF_TOKEN_LEN]; // required, A reference to the MediaProfile + + onvif_PTZVector Translation; // required, A positional Translation relative to the current position + onvif_PTZSpeed Speed; // optional, An optional Speed parameter +} ptz_RelativeMove_REQ; + +typedef struct +{ + uint32 SpeedFlag : 1; // Indicates whether the field Speed is valid + uint32 Reserved : 31; + + char ProfileToken[ONVIF_TOKEN_LEN]; // required, A reference to the MediaProfile + + onvif_PTZVector Position; // required, A Position vector specifying the absolute target position + onvif_PTZSpeed Speed; // optional, An optional Speed +} ptz_AbsoluteMove_REQ; + +typedef struct +{ + uint32 PanTiltFlag : 1; // Indicates whether the field PanTilt is valid + uint32 ZoomFlag : 1; // Indicates whether the field Zoom is valid + uint32 Reserved : 30; + + char ProfileToken[ONVIF_TOKEN_LEN]; // required, A reference to the MediaProfile that indicate what should be stopped + + BOOL PanTilt; // optional, Set true when we want to stop ongoing pan and tilt movements.If PanTilt arguments are not present, this command stops these movements + BOOL Zoom; // optional, Set true when we want to stop ongoing zoom movement.If Zoom arguments are not present, this command stops ongoing zoom movement +} ptz_Stop_REQ; + +typedef struct +{ + int dummy; +} ptz_GetConfigurations_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Token of the requested PTZConfiguration +} ptz_GetConfiguration_REQ; + +typedef struct +{ + onvif_PTZConfiguration PTZConfiguration; // required + + BOOL ForcePersistence; // required, Flag that makes configuration persistent. Example: User wants the configuration to exist after reboot +} ptz_SetConfiguration_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Token of an existing configuration that the options are intended for +} ptz_GetConfigurationOptions_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required +} ptz_GetPresetTours_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required + char PresetTourToken[ONVIF_TOKEN_LEN]; // required +} ptz_GetPresetTour_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required + char PresetTourToken[ONVIF_TOKEN_LEN]; // optional +} ptz_GetPresetTourOptions_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required +} ptz_CreatePresetTour_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required + + onvif_PresetTour PresetTour; // required +} ptz_ModifyPresetTour_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required + char PresetTourToken[ONVIF_TOKEN_LEN]; // required + + onvif_PTZPresetTourOperation Operation; // required +} ptz_OperatePresetTour_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required + char PresetTourToken[ONVIF_TOKEN_LEN]; // required +} ptz_RemovePresetTour_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, A reference to the MediaProfile where the operation should take place + char AuxiliaryData[1024]; // required, The Auxiliary request data +} ptz_SendAuxiliaryCommand_REQ; + +typedef struct +{ + uint32 SpeedFlag : 1; // Indicates whether the field Speed is valid + uint32 AreaHeightFlag : 1; // Indicates whether the field AreaHeight is valid + uint32 AreaWidthFlag : 1; // Indicates whether the field AreaHeight is valid + uint32 Reserved : 29; + + char ProfileToken[ONVIF_TOKEN_LEN]; // required, A reference to the MediaProfile + + onvif_GeoLocation Target; // required, The geolocation of the target position + onvif_PTZSpeed Speed; // optional, An optional Speed + + float AreaHeight; // optional, An optional indication of the height of the target/area + float AreaWidth; // optional, An optional indication of the width of the target/area +} ptz_GeoMove_REQ; + +typedef struct +{ + int dummy; +} tev_GetServiceCapabilities_REQ; + +typedef struct +{ + int dummy; +} tev_GetEventProperties_REQ; + +typedef struct +{ + int TerminationTime; +} tev_Renew_REQ; + +typedef struct +{ + int dummy; +} tev_Unsubscribe_REQ; + +typedef struct +{ + uint32 FiltersFlag : 1; + uint32 Reserved : 31; + + char ConsumerReference[256]; + int InitialTerminationTime; // InitialTerminationTime, unit is second + + onvif_EventFilter Filter; +} tev_Subscribe_REQ; + +typedef struct +{ + int dummy; +} tev_PauseSubscription_REQ; + +typedef struct +{ + int dummy; +} tev_ResumeSubscription_REQ; + +typedef struct +{ + uint32 FiltersFlag : 1; + uint32 Reserved : 31; + + int InitialTerminationTime; // InitialTerminationTime, unit is second + + onvif_EventFilter Filter; +} tev_CreatePullPointSubscription_REQ; + +typedef struct +{ + int dummy; +} tev_DestroyPullPoint_REQ; + +typedef struct +{ + int Timeout; // required, Maximum time to block until this method returns, unit is second + int MessageLimit; // required, Upper limit for the number of messages to return at once. A server implementation may decide to return less messages +} tev_PullMessages_REQ; + +typedef struct +{ + int MaximumNumber; // required, Upper limit for the number of messages to return at once. A server implementation may decide to return less messages +} tev_GetMessages_REQ; + +typedef struct +{ + time_t UtcTime; // required, The date and time to match against stored messages. + // When Seek is used in the forward mode a device shall position the pull pointer to include all NotificationMessages in the persistent storage with a UtcTime attribute greater than or equal to the Seek argument. + // When Seek is used in reverse mode a device shall position the pull pointer to include all NotificationMessages in the in the persistent storage with a UtcTime attribute less than or equal to the Seek argument. + BOOL Reverse; // optional, Reverse the pull direction of PullMessages +} tev_Seek_REQ; + +typedef struct +{ + int dummy; +} tev_SetSynchronizationPoint_REQ; + +typedef struct +{ + char PostUrl[200]; + + NotificationMessageList * notify; +} Notify_REQ; + +// imaging service + +typedef struct +{ + int dummy; +} img_GetServiceCapabilities_REQ; + +typedef struct +{ + char VideoSourceToken[ONVIF_TOKEN_LEN]; // required +} img_GetImagingSettings_REQ; + +typedef struct +{ + uint32 ForcePersistenceFlag : 1; // Indicates whether the field ForcePersistence is valid + uint32 Reserved : 31; + + char VideoSourceToken[ONVIF_TOKEN_LEN]; // required + BOOL ForcePersistence; // optional + + onvif_ImagingSettings ImagingSettings; // required +} img_SetImagingSettings_REQ; + +typedef struct +{ + char VideoSourceToken[ONVIF_TOKEN_LEN]; // required, Reference token to the VideoSource for which the imaging parameter options are requested +} img_GetOptions_REQ; + +typedef struct +{ + char VideoSourceToken[ONVIF_TOKEN_LEN]; // required, Reference to the VideoSource for the requested move (focus) operation + + onvif_FocusMove Focus; // required, Content of the requested move (focus) operation +} img_Move_REQ; + +typedef struct +{ + char VideoSourceToken[ONVIF_TOKEN_LEN]; // required, Reference to the VideoSource +} img_Stop_REQ; + +typedef struct +{ + char VideoSourceToken[ONVIF_TOKEN_LEN]; // required, Reference to the VideoSource +} img_GetStatus_REQ; + +typedef struct +{ + char VideoSourceToken[ONVIF_TOKEN_LEN]; // required, Reference to the VideoSource +} img_GetMoveOptions_REQ; + +typedef struct +{ + char VideoSourceToken[ONVIF_TOKEN_LEN]; // required, Reference to the VideoSource +} img_GetPresets_REQ; + +typedef struct +{ + char VideoSourceToken[ONVIF_TOKEN_LEN]; // required, Reference to the VideoSource +} img_GetCurrentPreset_REQ; + +typedef struct +{ + char VideoSourceToken[ONVIF_TOKEN_LEN]; //required, , Reference to the VideoSource + char PresetToken[ONVIF_TOKEN_LEN]; //required, Reference token to the Imaging Preset to be applied to the specified Video Source +} img_SetCurrentPreset_REQ; + +// device IO + +typedef struct +{ + int dummy; +} tmd_GetServiceCapabilities_REQ; + +typedef struct +{ + int dummy; +} tmd_GetRelayOutputs_REQ; + +typedef struct +{ + uint32 RelayOutputTokenFlag : 1; + uint32 Reserved : 31; + + char RelayOutputToken[ONVIF_TOKEN_LEN]; // optional, Optional reference token to the relay for which the options are requested +} tmd_GetRelayOutputOptions_REQ; + +typedef struct +{ + onvif_RelayOutput RelayOutput; // required +} tmd_SetRelayOutputSettings_REQ; + +typedef struct +{ + char RelayOutputToken[ONVIF_TOKEN_LEN]; // required + + onvif_RelayLogicalState LogicalState; // required +} tmd_SetRelayOutputState_REQ; + +typedef struct +{ + int dummy; +} tmd_GetDigitalInputs_REQ; + +typedef struct +{ + uint32 TokenFlag : 1; + uint32 Reserved : 31; + + char Token[ONVIF_TOKEN_LEN]; // optional, +} tmd_GetDigitalInputConfigurationOptions_REQ; + +typedef struct +{ + DigitalInputList * DigitalInputs; +} tmd_SetDigitalInputConfigurations_REQ; + +// recording + +typedef struct +{ + int dummy; +} trc_GetServiceCapabilities_REQ; + +typedef struct +{ + onvif_RecordingConfiguration RecordingConfiguration;// required, Initial configuration for the recording +} trc_CreateRecording_REQ; + +typedef struct +{ + char RecordingToken[ONVIF_TOKEN_LEN]; // required, +} trc_DeleteRecording_REQ; + +typedef struct +{ + int dummy; +} trc_GetRecordings_REQ; + +typedef struct +{ + char RecordingToken[ONVIF_TOKEN_LEN]; // required, Token of the recording that shall be changed + + onvif_RecordingConfiguration RecordingConfiguration;// required, The new configuration +} trc_SetRecordingConfiguration_REQ; + +typedef struct +{ + char RecordingToken[ONVIF_TOKEN_LEN]; // required, +} trc_GetRecordingConfiguration_REQ; + +typedef struct +{ + char RecordingToken[ONVIF_TOKEN_LEN]; // required, +} trc_GetRecordingOptions_REQ; + +typedef struct +{ + char RecordingToken[ONVIF_TOKEN_LEN]; // required, Identifies the recording to which a track shall be added + + onvif_TrackConfiguration TrackConfiguration; // required, The configuration of the new track +} trc_CreateTrack_REQ; + +typedef struct +{ + char RecordingToken[ONVIF_TOKEN_LEN]; // required, Token of the recording the track belongs to + char TrackToken[ONVIF_TOKEN_LEN]; // required, Token of the track to be deleted +} trc_DeleteTrack_REQ; + +typedef struct +{ + char RecordingToken[ONVIF_TOKEN_LEN]; // required, Token of the recording the track belongs to + char TrackToken[ONVIF_TOKEN_LEN]; // required, Token of the track +} trc_GetTrackConfiguration_REQ; + +typedef struct +{ + char RecordingToken[ONVIF_TOKEN_LEN]; // required, Token of the recording the track belongs to + char TrackToken[ONVIF_TOKEN_LEN]; // required, Token of the track to be modified + + onvif_TrackConfiguration TrackConfiguration; // required, New configuration for the track +} trc_SetTrackConfiguration_REQ; + +typedef struct +{ + onvif_RecordingJobConfiguration JobConfiguration; // required, The initial configuration of the new recording job +} trc_CreateRecordingJob_REQ; + +typedef struct +{ + char JobToken[ONVIF_TOKEN_LEN]; // required +} trc_DeleteRecordingJob_REQ; + +typedef struct +{ + int dummy; +} trc_GetRecordingJobs_REQ; + +typedef struct +{ + char JobToken[ONVIF_TOKEN_LEN]; // required, Token of the job to be modified + + onvif_RecordingJobConfiguration JobConfiguration; // required, New configuration of the recording job +} trc_SetRecordingJobConfiguration_REQ; + +typedef struct +{ + char JobToken[ONVIF_TOKEN_LEN]; // required +} trc_GetRecordingJobConfiguration_REQ; + +typedef struct +{ + char JobToken[ONVIF_TOKEN_LEN]; // required, Token of the recording job + char Mode[16]; // required, The new mode for the recording job, The only valid values for Mode shall be "Idle" or "Active" +} trc_SetRecordingJobMode_REQ; + +typedef struct +{ + char JobToken[ONVIF_TOKEN_LEN]; // required +} trc_GetRecordingJobState_REQ; + +typedef struct +{ + time_t StartPoint; // optional, Optional parameter that specifies start time for the exporting + time_t EndPoint; // optional, Optional parameter that specifies end time for the exporting + onvif_SearchScope SearchScope; // required, Indicates the selection criterion on the existing recordings + char FileFormat[32]; // required, Indicates which export file format to be used + onvif_StorageReferencePath StorageDestination; // required, Indicates the target storage and relative directory path +} trc_ExportRecordedData_REQ; + +typedef struct +{ + char OperationToken[ONVIF_TOKEN_LEN]; // required, Unique ExportRecordedData operation token +} trc_StopExportRecordedData_REQ; + +typedef struct +{ + char OperationToken[ONVIF_TOKEN_LEN]; // required, Unique ExportRecordedData operation token +} trc_GetExportRecordedDataState_REQ; + +typedef struct +{ + int dummy; +} trp_GetServiceCapabilities_REQ; + +typedef struct +{ + onvif_StreamSetup StreamSetup; + + char RecordingToken[ONVIF_TOKEN_LEN]; // required. The identifier of the recording to be streamed +} trp_GetReplayUri_REQ; + +typedef struct +{ + int dummy; +} trp_GetReplayConfiguration_REQ; + +typedef struct +{ + onvif_ReplayConfiguration Configuration; // required, Description of the new replay configuration parameters +} trp_SetReplayConfiguration_REQ; + +typedef struct +{ + int dummy; +} tse_GetServiceCapabilities_REQ; + +typedef struct +{ + int dummy; +} tse_GetRecordingSummary_REQ; + +typedef struct +{ + char RecordingToken[ONVIF_TOKEN_LEN]; // Required +} tse_GetRecordingInformation_REQ; + +typedef struct +{ + char RecordingTokens[10][ONVIF_TOKEN_LEN]; // optional + time_t Time; // required +} tse_GetMediaAttributes_REQ; + +typedef struct +{ + uint32 MaxMatchesFlag : 1; // Indicates whether the field MaxMatches is valid + uint32 Reserved : 31; + + onvif_SearchScope Scope; // required + + int MaxMatches; // optional, The search will be completed after this many matches. If not specified, the search will continue until reaching the endpoint or until the session expires + int KeepAliveTime; // required, The time the search session will be kept alive after responding to this and subsequent requests. A device shall support at least values up to ten seconds +} tse_FindRecordings_REQ; + +typedef struct +{ + uint32 MinResultsFlag : 1; // Indicates whether the field MinResults is valid + uint32 MaxResultsFlag : 1; // Indicates whether the field MaxResults is valid + uint32 WaitTimeFlag : 1; // Indicates whether the field WaitTime is valid + uint32 Reserved : 29; + + char SearchToken[ONVIF_TOKEN_LEN]; // required, The search session to get results from + int MinResults; // optional, The minimum number of results to return in one response + int MaxResults; // optional, The maximum number of results to return in one response + int WaitTime; // optional, The maximum time before responding to the request, even if the MinResults parameter is not fulfilled +} tse_GetRecordingSearchResults_REQ; + +typedef struct +{ + uint32 EndPointFlag : 1; // Indicates whether the field EndPoint is valid + uint32 MaxMatchesFlag : 1; // Indicates whether the field MaxMatches is valid + uint32 Reserved : 30; + + time_t StartPoint; // required, The point of time where the search will start + time_t EndPoint; // optional, The point of time where the search will stop. This can be a time before the StartPoint, in which case the search is performed backwards in time + + onvif_SearchScope Scope; // required, + onvif_EventFilter SearchFilter; // required, + + BOOL IncludeStartState; // required, Setting IncludeStartState to true means that the server should return virtual events representing the start state for any recording included in the scope. Start state events are limited to the topics defined in the SearchFilter that have the IsProperty flag set to true + int MaxMatches; // optional, The search will be completed after this many matches. If not specified, the search will continue until reaching the endpoint or until the session expires + int KeepAliveTime; // required, The time the search session will be kept alive after responding to this and subsequent requests. A device shall support at least values up to ten seconds +} tse_FindEvents_REQ; + +typedef struct +{ + uint32 MinResultsFlag : 1; // Indicates whether the field MinResults is valid + uint32 MaxResultsFlag : 1; // Indicates whether the field MaxResults is valid + uint32 WaitTimeFlag : 1; // Indicates whether the field WaitTime is valid + uint32 Reserved : 29; + + char SearchToken[ONVIF_TOKEN_LEN]; // required, The search session to get results from + int MinResults; // optional, The minimum number of results to return in one response + int MaxResults; // optional, The maximum number of results to return in one response + int WaitTime; // optional, The maximum time before responding to the request, even if the MinResults parameter is not fulfilled +} tse_GetEventSearchResults_REQ; + +typedef struct +{ + uint32 EndPointFlag : 1; // Indicates whether the field EndPoint is valid + uint32 MaxMatchesFlag : 1; // Indicates whether the field MaxMatches is valid + uint32 Reserved : 30; + + time_t StartPoint; // required, The point of time where the search will start + time_t EndPoint; // optional, The point of time where the search will stop. This can be a time before the StartPoint, in which case the search is performed backwards in time + + onvif_SearchScope Scope; // required, + onvif_MetadataFilter MetadataFilter; // required, + + int MaxMatches; // optional, The search will be completed after this many matches. If not specified, the search will continue until reaching the endpoint or until the session expires + int KeepAliveTime; // required, The time the search session will be kept alive after responding to this and subsequent requests. A device shall support at least values up to ten seconds +} tse_FindMetadata_REQ; + +typedef struct +{ + uint32 MinResultsFlag : 1; // Indicates whether the field MinResults is valid + uint32 MaxResultsFlag : 1; // Indicates whether the field MaxResults is valid + uint32 WaitTimeFlag : 1; // Indicates whether the field WaitTime is valid + uint32 Reserved : 29; + + char SearchToken[ONVIF_TOKEN_LEN]; // required, The search session to get results from + int MinResults; // optional, The minimum number of results to return in one response + int MaxResults; // optional, The maximum number of results to return in one response + int WaitTime; // optional, The maximum time before responding to the request, even if the MinResults parameter is not fulfilled +} tse_GetMetadataSearchResults_REQ; + +typedef struct +{ + uint32 EndPointFlag : 1; // Indicates whether the field EndPoint is valid + uint32 MaxMatchesFlag : 1; // Indicates whether the field MaxMatches is valid + uint32 Reserved : 30; + + time_t StartPoint; // required, The point of time where the search will start + time_t EndPoint; // optional, The point of time where the search will stop. This can be a time before the StartPoint, in which case the search is performed backwards in time + + onvif_SearchScope Scope; // required, + onvif_PTZPositionFilter SearchFilter; // required, + + int MaxMatches; // optional, The search will be completed after this many matches. If not specified, the search will continue until reaching the endpoint or until the session expires + int KeepAliveTime; // required, The time the search session will be kept alive after responding to this and subsequent requests. A device shall support at least values up to ten seconds +} tse_FindPTZPosition_REQ; + +typedef struct +{ + uint32 MinResultsFlag : 1; // Indicates whether the field MinResults is valid + uint32 MaxResultsFlag : 1; // Indicates whether the field MaxResults is valid + uint32 WaitTimeFlag : 1; // Indicates whether the field WaitTime is valid + uint32 Reserved : 29; + + char SearchToken[ONVIF_TOKEN_LEN]; // required, The search session to get results from + int MinResults; // optional, The minimum number of results to return in one response + int MaxResults; // optional, The maximum number of results to return in one response + int WaitTime; // optional, The maximum time before responding to the request, even if the MinResults parameter is not fulfilled +} tse_GetPTZPositionSearchResults_REQ; + +typedef struct +{ + char SearchToken[ONVIF_TOKEN_LEN]; // required, The search session to get the state from +} tse_GetSearchState_REQ; + +typedef struct +{ + char SearchToken[ONVIF_TOKEN_LEN]; // required, The search session to end +} tse_EndSearch_REQ; + +typedef struct +{ + int dummy; +} tan_GetServiceCapabilities_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, References an existing Video Analytics configuration. The list of available tokens can be obtained + // via the Media service GetVideoAnalyticsConfigurations method +} tan_GetSupportedRules_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Reference to an existing VideoAnalyticsConfiguration + + ConfigList * Rule; // required +} tan_CreateRules_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Reference to an existing VideoAnalyticsConfiguration + + int sizeRuleName; + char RuleName[10][ONVIF_NAME_LEN]; // required, References the specific rule to be deleted (e.g. "MyLineDetector"). +} tan_DeleteRules_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Reference to an existing VideoAnalyticsConfiguration +} tan_GetRules_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Reference to an existing VideoAnalyticsConfiguration + + ConfigList * Rule; // required +} tan_ModifyRules_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Reference to an existing VideoAnalyticsConfiguration + + ConfigList * AnalyticsModule; // required +} tan_CreateAnalyticsModules_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Reference to an existing Video Analytics configuration + + int sizeAnalyticsModuleName; + char AnalyticsModuleName[10][ONVIF_NAME_LEN]; //required, name of the AnalyticsModule to be deleted +} tan_DeleteAnalyticsModules_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Reference to an existing VideoAnalyticsConfiguration +} tan_GetAnalyticsModules_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Reference to an existing VideoAnalyticsConfiguration + + ConfigList * AnalyticsModule; // required +} tan_ModifyAnalyticsModules_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Reference to an existing VideoAnalyticsConfiguration +} tan_GetSupportedAnalyticsModules_REQ; + +typedef struct +{ + uint32 RuleTypeFlag : 1; // Indicates whether the field RuleType is valid + uint32 Reserved : 31; + + char RuleType[128]; // optional, Reference to an SupportedRule Type returned from GetSupportedRules + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, +} tan_GetRuleOptions_REQ; + +typedef struct +{ + char Type[128]; // optional, Reference to an SupportedAnalyticsModule Type returned from GetSupportedAnalyticsModules + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Reference to an existing AnalyticsConfiguration +} tan_GetAnalyticsModuleOptions_REQ; + +typedef struct +{ + char Type[128]; // optional, reference to an AnalyticsModule Type returned from GetSupportedAnalyticsModules +} tan_GetSupportedMetadata_REQ; + +// onvif media service 2 interfaces + +#define TR2_MAX_TYPE 10 +#define TR2_MAX_CONFIGURATION 10 + +typedef struct +{ + int dummy; +} tr2_GetServiceCapabilities_REQ; + +typedef struct +{ + uint32 ConfigurationTokenFlag : 1; + uint32 ProfileTokenFlag : 1; + uint32 Reserved : 30; + + char ConfigurationToken[ONVIF_TOKEN_LEN]; // optional, Token of the requested configuration + char ProfileToken[ONVIF_TOKEN_LEN]; // optional, Contains the token of an existing media profile the configurations shall be compatible with +} tr2_GetConfiguration; + +typedef struct +{ + char Name[ONVIF_NAME_LEN]; // required, friendly name of the profile to be created + + int sizeConfiguration; + onvif_ConfigurationRef Configuration[TR2_MAX_CONFIGURATION]; // optional, Optional set of configurations to be assigned to the profile +} tr2_CreateProfile_REQ; + +typedef struct +{ + uint32 TokenFlag : 1; + uint32 Reserved : 31; + + char Token[ONVIF_TOKEN_LEN]; // optional, Optional token of the requested profile + + int sizeType; + char Type[TR2_MAX_TYPE][32]; // optional, The types shall be provided as defined by tr2:ConfigurationEnumeration + // All, VideoSource, VideoEncoder, AudioSource, AudioEncoder, AudioOutput, + // AudioDecoder, Metadata, Analytics, PTZ +} tr2_GetProfiles_REQ; + +typedef struct +{ + uint32 NameFlag : 1; + uint32 Reserved : 31; + + char ProfileToken[ONVIF_TOKEN_LEN]; // required, Reference to the profile where the configuration should be added + char Name[ONVIF_NAME_LEN]; // optional, Optional item. If present updates the Name property of the profile + + int sizeConfiguration; + onvif_ConfigurationRef Configuration[TR2_MAX_CONFIGURATION]; // optional, List of configurations to be added +} tr2_AddConfiguration_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, This element contains a reference to the media profile + + int sizeConfiguration; + onvif_ConfigurationRef Configuration[TR2_MAX_CONFIGURATION]; // required, List of configurations to be removed +} tr2_RemoveConfiguration_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, This element contains a reference to the profile that should be deleted +} tr2_DeleteProfile_REQ; + +typedef struct +{ + tr2_GetConfiguration GetConfiguration; +} tr2_GetVideoEncoderConfigurations_REQ; + +typedef struct +{ + tr2_GetConfiguration GetConfiguration; +} tr2_GetVideoSourceConfigurations_REQ; + +typedef struct +{ + tr2_GetConfiguration GetConfiguration; +} tr2_GetAudioEncoderConfigurations_REQ; + +typedef struct +{ + tr2_GetConfiguration GetConfiguration; +} tr2_GetAudioSourceConfigurations_REQ; + +typedef struct +{ + tr2_GetConfiguration GetConfiguration; +} tr2_GetMetadataConfigurations_REQ; + +typedef struct +{ + tr2_GetConfiguration GetConfiguration; +} tr2_GetAudioOutputConfigurations_REQ; + +typedef struct +{ + tr2_GetConfiguration GetConfiguration; +} tr2_GetAudioDecoderConfigurations_REQ; + +typedef struct +{ + onvif_VideoEncoder2Configuration Configuration; // Contains the modified video encoder configuration. The configuration shall exist in the device +} tr2_SetVideoEncoderConfiguration_REQ; + +typedef struct +{ + onvif_VideoSourceConfiguration Configuration; // required, Contains the modified video source configuration. The configuration shall exist in the device +} tr2_SetVideoSourceConfiguration_REQ; + +typedef struct +{ + onvif_AudioEncoder2Configuration Configuration; // required, Contains the modified audio encoder configuration. The configuration shall exist in the device +} tr2_SetAudioEncoderConfiguration_REQ; + +typedef struct +{ + onvif_AudioSourceConfiguration Configuration; // required, Contains the modified audio source configuration. The configuration shall exist in the device +} tr2_SetAudioSourceConfiguration_REQ; + +typedef struct +{ + onvif_MetadataConfiguration Configuration; // required, Contains the modified metadata configuration. The configuration shall exist in the device +} tr2_SetMetadataConfiguration_REQ; + +typedef struct +{ + onvif_AudioOutputConfiguration Configuration; // required, Contains the modified audio output configuration. The configuration shall exist in the device +} tr2_SetAudioOutputConfiguration_REQ; + +typedef struct +{ + tr2_GetConfiguration GetConfiguration; +} tr2_GetVideoSourceConfigurationOptions_REQ; + +typedef struct +{ + tr2_GetConfiguration GetConfiguration; +} tr2_GetVideoEncoderConfigurationOptions_REQ; + +typedef struct +{ + tr2_GetConfiguration GetConfiguration; +} tr2_GetAudioSourceConfigurationOptions_REQ; + +typedef struct +{ + tr2_GetConfiguration GetConfiguration; +} tr2_GetAudioEncoderConfigurationOptions_REQ; + +typedef struct +{ + tr2_GetConfiguration GetConfiguration; +} tr2_GetMetadataConfigurationOptions_REQ; + +typedef struct +{ + tr2_GetConfiguration GetConfiguration; +} tr2_GetAudioOutputConfigurationOptions_REQ; + +typedef struct +{ + tr2_GetConfiguration GetConfiguration; +} tr2_GetAudioDecoderConfigurationOptions_REQ; + +typedef struct +{ + onvif_AudioDecoderConfiguration Configuration; +} tr2_SetAudioDecoderConfiguration_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, +} tr2_GetSnapshotUri_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, +} tr2_StartMulticastStreaming_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, +} tr2_StopMulticastStreaming_REQ; + +typedef struct +{ + char VideoSourceToken[ONVIF_TOKEN_LEN]; // required, +} tr2_GetVideoSourceModes_REQ; + +typedef struct +{ + char VideoSourceToken[ONVIF_TOKEN_LEN]; // required, + char VideoSourceModeToken[ONVIF_TOKEN_LEN]; // required, +} tr2_SetVideoSourceMode_REQ; + +typedef struct +{ + onvif_OSDConfiguration OSD; // required, +} tr2_CreateOSD_REQ; + +typedef struct +{ + char OSDToken[ONVIF_TOKEN_LEN]; // required, +} tr2_DeleteOSD_REQ; + +typedef struct +{ + uint32 OSDTokenFlag : 1; + uint32 ConfigurationTokenFlag : 1; + uint32 Reserved : 30; + + char OSDToken[ONVIF_TOKEN_LEN]; // optional, + char ConfigurationToken[ONVIF_TOKEN_LEN]; // optional, +} tr2_GetOSDs_REQ; + +typedef struct +{ + onvif_OSDConfiguration OSD; // required +} tr2_SetOSD_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Video Source Configuration Token that specifies an existing video source configuration that the options shall be compatible with +} tr2_GetOSDOptions_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Token of the video source configuration +} tr2_GetVideoEncoderInstances_REQ; + +typedef struct +{ + char Protocol[32]; // required, Defines the network protocol + // RtspUnicast -- RTSP streaming RTP as UDP Unicast + // RtspMulticast -- RTSP streaming RTP as UDP Multicast + // RTSP -- RTSP streaming RTP over TCP + // RtspOverHttp -- Tunneling both the RTSP control channel and the RTP stream over HTTP or HTTPS + char ProfileToken[ONVIF_TOKEN_LEN]; // required, The ProfileToken element indicates the media profile + // to use and will define the configuration of the content of the stream +} tr2_GetStreamUri_REQ; + +typedef struct +{ + char ProfileToken[ONVIF_TOKEN_LEN]; // required, Contains a Profile reference for which a Synchronization Point is requested +} tr2_SetSynchronizationPoint_REQ; + +typedef struct +{ + tr2_GetConfiguration GetConfiguration; // optional, +} tr2_GetAnalyticsConfigurations_REQ; + +typedef struct +{ + onvif_Mask Mask; // required, Contain the initial mask configuration for create +} tr2_CreateMask_REQ; + +typedef struct +{ + uint32 TokenFlag : 1; // Indicates whether the field Token is valid + uint32 ConfigurationTokenFlag : 1; // Indicates whether the field ConfigurationToken is valid + uint32 Reserved : 30; + + char Token[ONVIF_TOKEN_LEN]; // optional, Optional mask token of an existing mask + char ConfigurationToken[ONVIF_TOKEN_LEN]; // optional, Optional token of a Video Source Configuration +} tr2_GetMasks_REQ; + +typedef struct +{ + onvif_Mask Mask; // required, Mask to be updated +} tr2_SetMask_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, This element contains a reference to the Mask configuration that should be deleted +} tr2_DeleteMask_REQ; + +typedef struct +{ + char ConfigurationToken[ONVIF_TOKEN_LEN]; // required, Video Source Configuration Token that specifies an existing video source configuration that the options shall be compatible with +} tr2_GetMaskOptions_REQ; + +// end of onvif media 2 interfaces + +typedef struct +{ + int dummy; +} tac_GetServiceCapabilities_REQ; + +typedef struct +{ + uint32 LimitFlag : 1; + uint32 StartReferenceFlag : 1; + uint32 Reserved : 30; + + int Limit; // optional, Maximum number of entries to return. If not specified, less than one or higher than what the device supports, the number of items is determined by the device + char StartReference[256]; // optional, Start returning entries from this start reference. If not specified, entries shall start from the beginning of the dataset +} tac_GetAccessPointInfoList_REQ; + +typedef struct +{ + char token[ACCESS_CTRL_MAX_LIMIT][ONVIF_TOKEN_LEN]; // Tokens of AccessPointInfo items to get +} tac_GetAccessPointInfo_REQ; + +typedef struct +{ + uint32 LimitFlag : 1; + uint32 StartReferenceFlag : 1; + uint32 Reserved : 30; + + int Limit; // optional, Maximum number of entries to return. If not specified, less than one or higher than what the device supports, the number of items is determined by the device + char StartReference[256]; // optional, Start returning entries from this start reference. If not specified, entries shall start from the beginning of the dataset +} tac_GetAccessPointList_REQ; + +typedef struct +{ + char token[ACCESS_CTRL_MAX_LIMIT][ONVIF_TOKEN_LEN]; // Tokens of AccessPoint items to get +} tac_GetAccessPoints_REQ; + +typedef struct +{ + uint32 AuthenticationProfileTokenFlag : 1; + uint32 Reserved : 31; + + onvif_AccessPointInfo AccessPoint; // required + + char AuthenticationProfileToken[ONVIF_TOKEN_LEN]; // optional +} tac_CreateAccessPoint_REQ; + +typedef struct +{ + uint32 AuthenticationProfileTokenFlag : 1; + uint32 Reserved : 31; + + onvif_AccessPointInfo AccessPoint; // required + + char AuthenticationProfileToken[ONVIF_TOKEN_LEN]; // optional +} tac_SetAccessPoint_REQ; + +typedef struct +{ + uint32 AuthenticationProfileTokenFlag : 1; + uint32 Reserved : 31; + + onvif_AccessPointInfo AccessPoint; // required + + char AuthenticationProfileToken[ONVIF_TOKEN_LEN]; // optional +} tac_ModifyAccessPoint_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, Token of AccessPoint item to delete +} tac_DeleteAccessPoint_REQ; + +typedef struct +{ + uint32 LimitFlag : 1; + uint32 StartReferenceFlag : 1; + uint32 Reserved : 30; + + int Limit; // optional, Maximum number of entries to return. If not specified, or higher than what the device supports, the number of items shall be determined by the device + char StartReference[256]; // optional, Start returning entries from this start reference. If not specified, entries shall start from the beginning of the dataset +} tac_GetAreaInfoList_REQ; + +typedef struct +{ + char token[ACCESS_CTRL_MAX_LIMIT][ONVIF_TOKEN_LEN]; // Tokens of DoorInfo items to get +} tac_GetAreaInfo_REQ; + +typedef struct +{ + uint32 LimitFlag : 1; + uint32 StartReferenceFlag : 1; + uint32 Reserved : 30; + + int Limit; // optional, Maximum number of entries to return. If not specified, less than one or higher than what the device supports, the number of items is determined by the device + char StartReference[256]; // optional, Start returning entries from this start reference. If not specified, entries shall start from the beginning of the dataset +} tac_GetAreaList_REQ; + +typedef struct +{ + char token[ACCESS_CTRL_MAX_LIMIT][ONVIF_TOKEN_LEN]; // Tokens of Area items to get +} tac_GetAreas_REQ; + +typedef struct +{ + onvif_AreaInfo Area; // required +} tac_CreateArea_REQ; + +typedef struct +{ + onvif_AreaInfo Area; // required +} tac_SetArea_REQ; + +typedef struct +{ + onvif_AreaInfo Area; // required +} tac_ModifyArea_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, Token of Area item to delete +} tac_DeleteArea_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, Token of AccessPoint instance to get AccessPointState for +} tac_GetAccessPointState_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, Token of the AccessPoint instance to enable +} tac_EnableAccessPoint_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, Token of the AccessPoint instance to disable +} tac_DisableAccessPoint_REQ; + +typedef struct +{ + int dummy; +} tdc_GetServiceCapabilities_REQ; + +typedef struct +{ + uint32 LimitFlag : 1; + uint32 StartReferenceFlag : 1; + uint32 Reserved : 30; + + int Limit; // optional, Maximum number of entries to return. If not specified, + // or higher than what the device supports, + // the number of items shall be determined by the device + char StartReference[256]; // optional, Start returning entries from this start reference. If not specified, + // entries shall start from the beginning of the dataset +} tdc_GetDoorInfoList_REQ; + +typedef struct +{ + char token[DOOR_CTRL_MAX_LIMIT][ONVIF_TOKEN_LEN]; // Tokens of DoorInfo items to get +} tdc_GetDoorInfo_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, Token of the Door instance to get the state for +} tdc_GetDoorState_REQ; + +typedef struct +{ + uint32 UseExtendedTimeFlag : 1; + uint32 AccessTimeFlag : 1; + uint32 OpenTooLongTimeFlag : 1; + uint32 PreAlarmTimeFlag : 1; + uint32 Reserved : 28; + + char Token[ONVIF_TOKEN_LEN]; // required, Token of the Door instance to control + BOOL UseExtendedTime; // optional, Indicates that the configured extended time should be used + int AccessTime; // optional, overrides AccessTime if specified + int OpenTooLongTime; // optional, overrides OpenTooLongTime if specified (DOTL) + int PreAlarmTime; // optional, overrides PreAlarmTime if specified +} tdc_AccessDoor_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, Token of the Door instance to control +} tdc_LockDoor_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, Token of the Door instance to control +} tdc_UnlockDoor_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, Token of the Door instance to control +} tdc_DoubleLockDoor_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, Token of the Door instance to control +} tdc_BlockDoor_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, Token of the Door instance to control +} tdc_LockDownDoor_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, Token of the Door instance to control +} tdc_LockDownReleaseDoor_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, Token of the Door instance to control +} tdc_LockOpenDoor_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, Token of the Door instance to control +} tdc_LockOpenReleaseDoor_REQ; + +typedef struct +{ + char token[DOOR_CTRL_MAX_LIMIT][ONVIF_TOKEN_LEN]; // Tokens of Door items to get +} tdc_GetDoors_REQ; + +typedef struct +{ + uint32 LimitFlag : 1; + uint32 StartReferenceFlag : 1; + uint32 Reserved : 30; + + int Limit; // optional, aximum number of entries to return. If not specified, less than one + // or higher than what the device supports, + // the number of items is determined by the device + char StartReference[256]; // optional, Start returning entries from this start reference. If not specified, + // entries shall start from the beginning of the dataset +} tdc_GetDoorList_REQ; + +typedef struct +{ + onvif_Door Door; // required, Door item to create +} tdc_CreateDoor_REQ; + +typedef struct +{ + onvif_Door Door; // required, The Door item to create or modify +} tdc_SetDoor_REQ; + +typedef struct +{ + onvif_Door Door; // required, The details of the door +} tdc_ModifyDoor_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, The Token of the door to delete +} tdc_DeleteDoor_REQ; + +typedef struct +{ + int dummy; +} tth_GetServiceCapabilities_REQ; + +typedef struct +{ + int dummy; +} tth_GetConfigurations_REQ; + +typedef struct +{ + char VideoSourceToken[ONVIF_TOKEN_LEN]; // requied, Reference token to the VideoSource for which the Thermal Settings are requested +} tth_GetConfiguration_REQ; + +typedef struct +{ + char VideoSourceToken[ONVIF_TOKEN_LEN]; // requied, Reference token to the VideoSource for which the Thermal Settings are configured + + onvif_ThermalConfiguration Configuration; // requied, Thermal Settings to be configured +} tth_SetConfiguration_REQ; + +typedef struct +{ + char VideoSourceToken[ONVIF_TOKEN_LEN]; // requied, Reference token to the VideoSource for which the Thermal Configuration Options are requested +} tth_GetConfigurationOptions_REQ; + +typedef struct +{ + char VideoSourceToken[ONVIF_TOKEN_LEN]; // required, Reference token to the VideoSource for which the Radiometry Configuration is requested +} tth_GetRadiometryConfiguration_REQ; + +typedef struct +{ + char VideoSourceToken[ONVIF_TOKEN_LEN]; // required, Reference token to the VideoSource for which the Radiometry settings are configured + + onvif_RadiometryConfiguration Configuration; // required, Radiometry settings to be configured +} tth_SetRadiometryConfiguration_REQ; + +typedef struct +{ + char VideoSourceToken[ONVIF_TOKEN_LEN]; // required, Reference token to the VideoSource for which the Thermal Radiometry Options are requested +} tth_GetRadiometryConfigurationOptions_REQ; + +typedef struct +{ + int dummy; +} tcr_GetServiceCapabilities_REQ; + +typedef struct +{ + int sizeToken; // sequence of elements + char Token[CREDENTIAL_MAX_LIMIT][ONVIF_TOKEN_LEN]; // required, Tokens of CredentialInfo items to get +} tcr_GetCredentialInfo_REQ; + +typedef struct +{ + uint32 LimitFlag : 1; // Indicates whether the field Limit is valid + uint32 StartReferenceFlag : 1; // Indicates whether the field StartReference is valid + uint32 Reserved : 30; + + int Limit; // optional, Maximum number of entries to return. If not specified, less than one or higher + // than what the device supports, the number of items is determined by the device + char StartReference[ONVIF_TOKEN_LEN]; // optional, Start returning entries from this start reference. If not specified, + // entries shall start from the beginning of the dataset +} tcr_GetCredentialInfoList_REQ; + +typedef struct +{ + int sizeToken; // sequence of elements + char Token[CREDENTIAL_MAX_LIMIT][ONVIF_TOKEN_LEN]; // required, Token of Credentials to get +} tcr_GetCredentials_REQ; + +typedef struct +{ + uint32 LimitFlag : 1; // Indicates whether the field Limit is valid + uint32 StartReferenceFlag : 1; // Indicates whether the field StartReference is valid + uint32 Reserved : 30; + + int Limit; // optional, Maximum number of entries to return. If not specified, less than one or higher + // than what the device supports, the number of items is determined by the device + char StartReference[ONVIF_TOKEN_LEN]; // optional, Start returning entries from this start reference. If not specified, + // entries shall start from the beginning of the dataset +} tcr_GetCredentialList_REQ; + +typedef struct +{ + onvif_Credential Credential; // required, The credential to create + onvif_CredentialState State; // required, The state of the credential +} tcr_CreateCredential_REQ; + +typedef struct +{ + onvif_Credential Credential; // required, Details of the credential +} tcr_ModifyCredential_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, The token of the credential to delete +} tcr_DeleteCredential_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, Token of Credential +} tcr_GetCredentialState_REQ; + +typedef struct +{ + uint32 ReasonFlag : 1; // Indicates whether the field ReasonFlag is valid + uint32 Reserved : 31; + + char Token[ONVIF_TOKEN_LEN]; // required, The token of the credential + char Reason[200]; // optional, Reason for enabling the credential +} tcr_EnableCredential_REQ; + +typedef struct +{ + uint32 ReasonFlag : 1; // Indicates whether the field ReasonFlag is valid + uint32 Reserved : 31; + + char Token[ONVIF_TOKEN_LEN]; // required, The token of the credential + char Reason[200]; // optional, Reason for disabling the credential +} tcr_DisableCredential_REQ; + +typedef struct +{ + char CredentialToken[ONVIF_TOKEN_LEN]; // required, Token of the Credential +} tcr_ResetAntipassbackViolation_REQ; + +typedef struct +{ + char CredentialIdentifierTypeName[100]; // required, Name of the credential identifier type +} tcr_GetSupportedFormatTypes_REQ; + +typedef struct +{ + char CredentialToken[ONVIF_TOKEN_LEN]; // required, Token of the Credential +} tcr_GetCredentialIdentifiers_REQ; + +typedef struct +{ + char CredentialToken[ONVIF_TOKEN_LEN]; // required, Token of the Credential + + onvif_CredentialIdentifier CredentialIdentifier; // required, Identifier of the credential +} tcr_SetCredentialIdentifier_REQ; + +typedef struct +{ + char CredentialToken[ONVIF_TOKEN_LEN]; // required, Token of the Credential + char CredentialIdentifierTypeName[100]; // required, Identifier type name of a credential +} tcr_DeleteCredentialIdentifier_REQ; + +typedef struct +{ + char CredentialToken[ONVIF_TOKEN_LEN]; // required, Token of the Credential +} tcr_GetCredentialAccessProfiles_REQ; + +typedef struct +{ + char CredentialToken[ONVIF_TOKEN_LEN]; // required, Token of the Credential + int sizeCredentialAccessProfile; // sequence of elements + + onvif_CredentialAccessProfile CredentialAccessProfile[CREDENTIAL_MAX_LIMIT]; // required, Access Profiles of the credential +} tcr_SetCredentialAccessProfiles_REQ; + +typedef struct +{ + char CredentialToken[ONVIF_TOKEN_LEN]; // required, Token of the Credential + int sizeAccessProfileToken; // sequence of elements + + char AccessProfileToken[CREDENTIAL_MAX_LIMIT][ONVIF_TOKEN_LEN]; // required, Tokens of Access Profiles +} tcr_DeleteCredentialAccessProfiles_REQ; + +typedef struct +{ + int dummy; +} tar_GetServiceCapabilities_REQ; + +typedef struct +{ + int sizeToken; // sequence of elements + char Token[ACCESSRULES_MAX_LIMIT][ONVIF_TOKEN_LEN]; // required, Tokens of CredentialInfo items to get +} tar_GetAccessProfileInfo_REQ; + +typedef struct +{ + uint32 LimitFlag : 1; // Indicates whether the field Limit is valid + uint32 StartReferenceFlag : 1; // Indicates whether the field StartReference is valid + uint32 Reserved : 30; + + int Limit; // optional, Maximum number of entries to return. If not specified, less than one or higher + // than what the device supports, the number of items is determined by the device + char StartReference[ONVIF_TOKEN_LEN]; // optional, Start returning entries from this start reference. If not specified, + // entries shall start from the beginning of the dataset +} tar_GetAccessProfileInfoList_REQ; + +typedef struct +{ + int sizeToken; // sequence of elements + char Token[ACCESSRULES_MAX_LIMIT][ONVIF_TOKEN_LEN]; // required, Tokens of CredentialInfo items to get +} tar_GetAccessProfiles_REQ; + +typedef struct +{ + uint32 LimitFlag : 1; // Indicates whether the field Limit is valid + uint32 StartReferenceFlag : 1; // Indicates whether the field StartReference is valid + uint32 Reserved : 30; + + int Limit; // optional, Maximum number of entries to return. If not specified, less than one or higher + // than what the device supports, the number of items is determined by the device + char StartReference[ONVIF_TOKEN_LEN]; // optional, Start returning entries from this start reference. If not specified, + // entries shall start from the beginning of the dataset +} tar_GetAccessProfileList_REQ; + +typedef struct +{ + onvif_AccessProfile AccessProfile; // required, The AccessProfile to create +} tar_CreateAccessProfile_REQ; + +typedef struct +{ + onvif_AccessProfile AccessProfile; // required, The details of Access Profile +} tar_ModifyAccessProfile_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, The token of the access profile to delete +} tar_DeleteAccessProfile_REQ; + +typedef struct +{ + int dummy; +} tsc_GetServiceCapabilities_REQ; + +typedef struct +{ + int sizeToken; // sequence of elements + char Token[SCHEDULE_MAX_LIMIT][ONVIF_TOKEN_LEN]; // required, Tokens of ScheduleInfo items to get +} tsc_GetScheduleInfo_REQ; + +typedef struct +{ + uint32 LimitFlag : 1; // Indicates whether the field Limit is valid + uint32 StartReferenceFlag : 1; // Indicates whether the field StartReference is valid + uint32 Reserved : 30; + + int Limit; // optional, Maximum number of entries to return. If not specified, less than one + // or higher than what the device supports, the number of items is + // determined by the device + char StartReference[ONVIF_TOKEN_LEN]; // optional, Start returning entries from this start reference. + // If not specified, entries shall start from the beginning of the dataset +} tsc_GetScheduleInfoList_REQ; + +typedef struct +{ + int sizeToken; // sequence of elements + char Token[SCHEDULE_MAX_LIMIT][ONVIF_TOKEN_LEN]; // required, Tokens of Schedule items to get +} tsc_GetSchedules_REQ; + +typedef struct +{ + uint32 LimitFlag : 1; // Indicates whether the field Limit is valid + uint32 StartReferenceFlag : 1; // Indicates whether the field StartReference is valid + uint32 Reserved : 30; + + int Limit; // optional, Maximum number of entries to return. If not specified, less than one + // or higher than what the device supports, the number of items is + // determined by the device + char StartReference[ONVIF_TOKEN_LEN]; // optional, Start returning entries from this start reference. + // If not specified, entries shall start from the beginning of the dataset +} tsc_GetScheduleList_REQ; + +typedef struct +{ + onvif_Schedule Schedule; // required, The Schedule to create +} tsc_CreateSchedule_REQ; + +typedef struct +{ + onvif_Schedule Schedule; // required, The Schedule to modify/update +} tsc_ModifySchedule_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, The token of the schedule to delete +} tsc_DeleteSchedule_REQ; + +typedef struct +{ + int sizeToken; // sequence of elements + char Token[SCHEDULE_MAX_LIMIT][ONVIF_TOKEN_LEN]; // required, Tokens of SpecialDayGroupInfo items to get +} tsc_GetSpecialDayGroupInfo_REQ; + +typedef struct +{ + uint32 LimitFlag : 1; // Indicates whether the field Limit is valid + uint32 StartReferenceFlag : 1; // Indicates whether the field StartReference is valid + uint32 Reserved : 30; + + int Limit; // optional, Maximum number of entries to return. If not specified, less than one + // or higher than what the device supports, the number of items is + // determined by the device + char StartReference[ONVIF_TOKEN_LEN]; // optional, Start returning entries from this start reference. + // If not specified, entries shall start from the beginning of the dataset +} tsc_GetSpecialDayGroupInfoList_REQ; + +typedef struct +{ + int sizeToken; // sequence of elements + char Token[SCHEDULE_MAX_LIMIT][ONVIF_TOKEN_LEN]; // required, Tokens of the SpecialDayGroup items to get +} tsc_GetSpecialDayGroups_REQ; + +typedef struct +{ + uint32 LimitFlag : 1; // Indicates whether the field Limit is valid + uint32 StartReferenceFlag : 1; // Indicates whether the field StartReference is valid + uint32 Reserved : 30; + + int Limit; // optional, Maximum number of entries to return. If not specified, less than one + // or higher than what the device supports, the number of items is + // determined by the device + char StartReference[ONVIF_TOKEN_LEN]; // optional, Start returning entries from this start reference. + // If not specified, entries shall start from the beginning of the dataset +} tsc_GetSpecialDayGroupList_REQ; + +typedef struct +{ + onvif_SpecialDayGroup SpecialDayGroup; // required, The special day group to create +} tsc_CreateSpecialDayGroup_REQ; + +typedef struct +{ + onvif_SpecialDayGroup SpecialDayGroup; // required, The special day group to modify/update +} tsc_ModifySpecialDayGroup_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, The token of the special day group item to delete +} tsc_DeleteSpecialDayGroup_REQ; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, Token of schedule instance to get ScheduleState +} tsc_GetScheduleState_REQ; + +typedef struct +{ + int dummy; +} trv_GetServiceCapabilities_REQ; + +typedef struct +{ + int dummy; +} trv_GetReceivers_REQ; + +typedef struct +{ + char ReceiverToken[ONVIF_TOKEN_LEN]; // required, The token of the receiver to be retrieved +} trv_GetReceiver_REQ; + +typedef struct +{ + onvif_ReceiverConfiguration Configuration; // required, The initial configuration for the new receiver +} trv_CreateReceiver_REQ; + +typedef struct +{ + char ReceiverToken[ONVIF_TOKEN_LEN]; // required, The token of the receiver to be deleted +} trv_DeleteReceiver_REQ; + +typedef struct +{ + char ReceiverToken[ONVIF_TOKEN_LEN]; // required, The token of the receiver to be configured + + onvif_ReceiverConfiguration Configuration; // required, The new configuration for the receiver +} trv_ConfigureReceiver_REQ; + +typedef struct +{ + char ReceiverToken[ONVIF_TOKEN_LEN]; // required, The token of the receiver to be changed + + onvif_ReceiverMode Mode; // required, The new receiver mode +} trv_SetReceiverMode_REQ; + +typedef struct +{ + char ReceiverToken[ONVIF_TOKEN_LEN]; // required, The token of the receiver to be queried +} trv_GetReceiverState_REQ; + +typedef struct +{ + int dummy; +} tpv_GetServiceCapabilities_REQ; + +typedef struct +{ + uint32 TimeoutFlag : 1; // Indicates whether the field Timeout is valid + uint32 Reserved : 31; + + char VideoSource[100]; // required, The video source associated with the provisioning. + + onvif_PanDirection Direction; // required, The direction for PanMove to move the device, "left" or "right" + + int Timeout; // optional, Operation timeout, if less than default timeout, unit is second +} tpv_PanMove_REQ; + +typedef struct +{ + uint32 TimeoutFlag : 1; // Indicates whether the field Timeout is valid + uint32 Reserved : 31; + + char VideoSource[100]; // required, The video source associated with the provisioning + + onvif_TiltDirection Direction; // required, "up" or "down" + + int Timeout; // optional, Operation timeout, if less than default timeout, unit is second +} tpv_TiltMove_REQ; + +typedef struct +{ + uint32 TimeoutFlag : 1; // Indicates whether the field Timeout is valid + uint32 Reserved : 31; + + char VideoSource[100]; // required, The video source associated with the provisioning + + onvif_ZoomDirection Direction; // required, "wide" or "telephoto" + + int Timeout; // optional, Operation timeout, if less than default timeout, unit is second +} tpv_ZoomMove_REQ; + +typedef struct +{ + uint32 TimeoutFlag : 1; // Indicates whether the field Timeout is valid + uint32 Reserved : 31; + + char VideoSource[100]; // required, The video source associated with the provisioning + + onvif_RollDirection Direction; // required, "clockwise", "counterclockwise", or "auto" + + int Timeout; // optional, Operation timeout, if less than default timeout, unit is second +} tpv_RollMove_REQ; + +typedef struct +{ + uint32 TimeoutFlag : 1; // Indicates whether the field Timeout is valid + uint32 Reserved : 31; + + char VideoSource[100]; // required, The video source associated with the provisioning + + onvif_FocusDirection Direction; // required, "near", "far", or "auto" + + int Timeout; // optional, Operation timeout, if less than default timeout, unit is second +} tpv_FocusMove_REQ; + +typedef struct +{ + char VideoSource[100]; // required, The video source associated with the provisioning +} tpv_Stop_REQ; + +typedef struct +{ + char VideoSource[100]; // required, The video source associated with the provisioning +} tpv_GetUsage_REQ; + + +#endif // end of ONVIF_REQ_H + + + diff --git a/ONVIF/include/onvif/onvif_res.h b/ONVIF/include/onvif/onvif_res.h new file mode 100644 index 0000000..ea49365 --- /dev/null +++ b/ONVIF/include/onvif/onvif_res.h @@ -0,0 +1,2263 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef ONVIF_RES_H +#define ONVIF_RES_H + + + +/************************************************************************* + * + * onvif response structure + * +**************************************************************************/ +typedef struct +{ + onvif_Capabilities Capabilities; // required, Capability information +} tds_GetCapabilities_RES; + +typedef struct +{ + onvif_Capabilities Capabilities; // required, Capability information +} tds_GetServices_RES; + +typedef struct +{ + onvif_DevicesCapabilities Capabilities; // required, he capabilities for the device service is returned in the Capabilities element +} tds_GetServiceCapabilities_RES; + +typedef struct +{ + onvif_DeviceInformation DeviceInformation; // required, Device information +} tds_GetDeviceInformation_RES; + +typedef struct +{ + UserList * User; +} tds_GetUsers_RES; + +typedef struct +{ + int dummy; +} tds_CreateUsers_RES; + +typedef struct +{ + int dummy; +} tds_DeleteUsers_RES; + +typedef struct +{ + int dummy; +} tds_SetUser_RES; + +typedef struct +{ + uint32 RemoteUserFlag : 1; // Indicates whether the field RemoteUser is valid + uint32 Reserved : 31; + + onvif_RemoteUser RemoteUser; // optional +} tds_GetRemoteUser_RES; + +typedef struct +{ + int dummy; +} tds_SetRemoteUser_RES; + +typedef struct +{ + NetworkInterfaceList * NetworkInterfaces; // required, List of network interfaces +} tds_GetNetworkInterfaces_RES; + +typedef struct +{ + BOOL RebootNeeded; // required, Indicates whether or not a reboot is required after configuration updates, +} tds_SetNetworkInterfaces_RES; + +typedef struct +{ + onvif_NTPInformation NTPInformation; // required, NTP information +} tds_GetNTP_RES; + +typedef struct +{ + int dummy; +} tds_SetNTP_RES; + +typedef struct +{ + onvif_HostnameInformation HostnameInformation; // required, Host name information +} tds_GetHostname_RES; + +typedef struct +{ + int dummy; +} tds_SetHostname_RES; + +typedef struct +{ + BOOL RebootNeeded; // required, Indicates whether or not a reboot is required after configuration updates +} tds_SetHostnameFromDHCP_RES; + +typedef struct +{ + onvif_DNSInformation DNSInformation; // required, DNS information +} tds_GetDNS_RES; + +typedef struct +{ + int dummy; +} tds_SetDNS_RES; + +typedef struct +{ + onvif_DynamicDNSInformation DynamicDNSInformation; // Dynamic DNS information +} tds_GetDynamicDNS_RES; + +typedef struct +{ + int dummy; +} tds_SetDynamicDNS_RES; + +typedef struct +{ + onvif_NetworkProtocol NetworkProtocols; // Contains defined protocols supported by the device +} tds_GetNetworkProtocols_RES; + +typedef struct +{ + int dummy; +} tds_SetNetworkProtocols_RES; + +typedef struct +{ + onvif_DiscoveryMode DiscoveryMode; // required, Indicator of discovery mode: Discoverable, NonDiscoverable +} tds_GetDiscoveryMode_RES; + +typedef struct +{ + int dummy; +} tds_SetDiscoveryMode_RES; + +typedef struct +{ + char IPv4Address[MAX_GATEWAY][32]; // required, Gets the default IPv4 and IPv6 gateway settings from the device +} tds_GetNetworkDefaultGateway_RES; + +typedef struct +{ + int dummy; +} tds_SetNetworkDefaultGateway_RES; + +typedef struct +{ + onvif_NetworkZeroConfiguration ZeroConfiguration; // Contains the zero-configuration +} tds_GetZeroConfiguration_RES; + +typedef struct +{ + int dummy; +} tds_SetZeroConfiguration_RES; + +typedef struct +{ + char GUID[128]; +} tds_GetEndpointReference_RES; + +typedef struct +{ + uint32 AuxiliaryCommandResponseFlag : 1; // Indicates whether the field AuxiliaryCommandResponse is valid + uint32 Reserved : 31; + + char AuxiliaryCommandResponse[1024]; // optional +} tds_SendAuxiliaryCommand_RES; + +typedef struct +{ + RelayOutputList * RelayOutputs; +} tds_GetRelayOutputs_RES; + +typedef struct +{ + int dummy; +} tds_SetRelayOutputSettings_RES; + +typedef struct +{ + int dummy; +} tds_SetRelayOutputState_RES; + +typedef struct +{ + uint32 UTCDateTimeFlag : 1; // Indicates whether the field UTCDateTime is valid + uint32 LocalDateTimeFlag : 1; // Indicates whether the field LocalDateTime is valid + uint32 Reserved : 30; + + onvif_SystemDateTime SystemDateTime; // required, + onvif_DateTime UTCDateTime; // optional, Date and time in UTC. If time is obtained via NTP, UTCDateTime has no meaning + onvif_DateTime LocalDateTime; // optional, +} tds_GetSystemDateAndTime_RES; + +typedef struct +{ + int dummy; +} tds_SetSystemDateAndTime_RES; + +typedef struct +{ + int dummy; +} tds_SystemReboot_RES; + +typedef struct +{ + int dummy; +} tds_SetSystemFactoryDefault_RES; + +typedef struct +{ + char * String; // optional, Contains the system log information + // The caller should call FreeBuff to free the memory +} tds_GetSystemLog_RES; + +typedef struct +{ + uint32 sizeScopes; + + onvif_Scope Scopes[MAX_SCOPE_NUMS]; +} tds_GetScopes_RES; + +typedef struct +{ + int dummy; +} tds_SetScopes_RES; + +typedef struct +{ + int dummy; +} tds_AddScopes_RES; + +typedef struct +{ + int dummy; +} tds_RemoveScopes_RES; + +typedef struct +{ + char UploadUri[256]; // required + int UploadDelay; // required + int ExpectedDownTime; // required +} tds_StartFirmwareUpgrade_RES; + +typedef struct +{ + uint32 SystemLogUriFlag : 1; // Indicates whether the field SystemLogUri is valid + uint32 AccessLogUriFlag : 1; // Indicates whether the field AccessLogUri is valid + uint32 SupportInfoUriFlag : 1; // Indicates whether the field SupportInfoUri is valid + uint32 SystemBackupUriFlag : 1; // Indicates whether the field SystemBackupUri is valid + uint32 Reserved : 28; + + char SystemLogUri[256]; // optional + char AccessLogUri[256]; // optional + char SupportInfoUri[256]; // optional + char SystemBackupUri[256]; // optional +} tds_GetSystemUris_RES; + +typedef struct +{ + char UploadUri[256]; // required + int ExpectedDownTime; // required +} tds_StartSystemRestore_RES; + +typedef struct +{ + char WsdlUrl[256]; // required +} tds_GetWsdlUrl_RES; + +typedef struct +{ + onvif_Dot11Capabilities Capabilities; // required +} tds_GetDot11Capabilities_RES; + +typedef struct +{ + onvif_Dot11Status Status; // required +} tds_GetDot11Status_RES; + +typedef struct +{ + Dot11AvailableNetworksList * Networks; // optional +} tds_ScanAvailableDot11Networks_RES; + +typedef struct +{ + LocationEntityList * Location; // optional +} tds_GetGeoLocation_RES; + +typedef struct +{ + int dummy; +} tds_SetGeoLocation_RES; + +typedef struct +{ + int dummy; +} tds_DeleteGeoLocation_RES; + +typedef struct +{ + int dummy; +} tds_SetHashingAlgorithm_RES; + +typedef struct +{ + onvif_IPAddressFilter IPAddressFilter; // required +} tds_GetIPAddressFilter_RES; + +typedef struct +{ + int dummy; +} tds_SetIPAddressFilter_RES; + +typedef struct +{ + int dummy; +} tds_AddIPAddressFilter_RES; + +typedef struct +{ + int dummy; +} tds_RemoveIPAddressFilter_RES; + +typedef struct +{ + onvif_BinaryData PolicyFile; // required, need call free function to free PolicyFile.Data.ptr buffer +} tds_GetAccessPolicy_RES; + +typedef struct +{ + int dummy; +} tds_SetAccessPolicy_RES; + +typedef struct +{ + StorageConfigurationList * StorageConfigurations; // optional +} tds_GetStorageConfigurations_RES; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required +} tds_CreateStorageConfiguration_RES; + +typedef struct +{ + onvif_StorageConfiguration StorageConfiguration; // required +} tds_GetStorageConfiguration_RES; + +typedef struct +{ + int dummy; +} tds_SetStorageConfiguration_RES; + +typedef struct +{ + int dummy; +} tds_DeleteStorageConfiguration_RES; + +typedef struct +{ + onvif_MediaCapabilities Capabilities; // required, the capabilities for the media service is returned +} trt_GetServiceCapabilities_RES; + +typedef struct +{ + VideoSourceList * VideoSources; // List of existing Video Sources +} trt_GetVideoSources_RES; + +typedef struct +{ + AudioSourceList * AudioSources; // List of existing Audio Sources +} trt_GetAudioSources_RES; + +typedef struct +{ + ONVIF_PROFILE Profile; // required, returns the new created profile +} trt_CreateProfile_RES; + +typedef struct +{ + ONVIF_PROFILE Profile; // required, returns the requested media profile +} trt_GetProfile_RES; + +typedef struct +{ + ONVIF_PROFILE * Profiles; // lists all profiles that exist in the media service +} trt_GetProfiles_RES; + +typedef struct +{ + int dummy; +} trt_AddVideoEncoderConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_AddVideoSourceConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_AddAudioEncoderConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_AddAudioSourceConfiguration_RES; + +typedef struct +{ + VideoSourceModeList * VideoSourceModes; // Return the information for specified video source mode +} trt_GetVideoSourceModes_RES; + +typedef struct +{ + BOOL Reboot; // The response contains information about rebooting after returning response. When Reboot is set true, a device will reboot automatically after setting mode +} trt_SetVideoSourceMode_RES; + +typedef struct +{ + int dummy; +} trt_AddPTZConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_RemoveVideoEncoderConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_RemoveVideoSourceConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_RemoveAudioEncoderConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_RemoveAudioSourceConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_RemovePTZConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_DeleteProfile_RES; + +typedef struct +{ + VideoSourceConfigurationList * Configurations; // This element contains a list of video source configurations +} trt_GetVideoSourceConfigurations_RES; + +typedef struct +{ + VideoEncoderConfigurationList * Configurations; // This element contains a list of video encoder configurations +} trt_GetVideoEncoderConfigurations_RES; + +typedef struct +{ + AudioSourceConfigurationList * Configurations; // This element contains a list of audio source configurations +} trt_GetAudioSourceConfigurations_RES; + +typedef struct +{ + AudioEncoderConfigurationList * Configurations; // This element contains a list of audio encoder configurations +} trt_GetAudioEncoderConfigurations_RES; + +typedef struct +{ + onvif_VideoSourceConfiguration Configuration; // required, The requested video source configuration +} trt_GetVideoSourceConfiguration_RES; + +typedef struct +{ + onvif_VideoEncoderConfiguration Configuration; // required, The requested video encoder configuration +} trt_GetVideoEncoderConfiguration_RES; + +typedef struct +{ + onvif_AudioSourceConfiguration Configuration; // required, The requested audio source configuration +} trt_GetAudioSourceConfiguration_RES; + +typedef struct +{ + onvif_AudioEncoderConfiguration Configuration; // required, The requested audio encorder configuration +} trt_GetAudioEncoderConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_SetVideoSourceConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_SetVideoEncoderConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_SetAudioSourceConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_SetAudioEncoderConfiguration_RES; + +typedef struct +{ + onvif_VideoSourceConfigurationOptions Options; +} trt_GetVideoSourceConfigurationOptions_RES; + +typedef struct +{ + onvif_VideoEncoderConfigurationOptions Options; // required +} trt_GetVideoEncoderConfigurationOptions_RES; + +typedef struct +{ + int dummy; +} trt_GetAudioSourceConfigurationOptions_RES; + + +typedef struct +{ + onvif_AudioEncoderConfigurationOptions Options; // required +} trt_GetAudioEncoderConfigurationOptions_RES; + +typedef struct +{ + char Uri[ONVIF_URI_LEN]; // required, Stable Uri to be used for requesting the media stream + + int Timeout; // required, Duration how long the Uri is valid. This parameter shall be set to PT0S to indicate that this stream URI is indefinitely valid even if the profile changes + + BOOL InvalidAfterConnect; // required, Indicates if the Uri is only valid until the connection is established. The value shall be set to "false" + BOOL InvalidAfterReboot; // required, Indicates if the Uri is invalid after a reboot of the device. The value shall be set to "false" +} trt_GetStreamUri_RES; + +typedef struct +{ + int dummy; +} trt_SetSynchronizationPoint_RES; + +typedef struct +{ + char Uri[ONVIF_URI_LEN]; // required, Stable Uri to be used for requesting the media stream + + int Timeout; // required, Duration how long the Uri is valid. This parameter shall be set to PT0S to indicate that this stream URI is indefinitely valid even if the profile changes + + BOOL InvalidAfterConnect; // required, Indicates if the Uri is only valid until the connection is established. The value shall be set to "false" + BOOL InvalidAfterReboot; // required, Indicates if the Uri is invalid after a reboot of the device. The value shall be set to "false" +} trt_GetSnapshotUri_RES; + +typedef struct +{ + uint32 JPEGFlag : 1; // Indicates whether the field JPEG is valid + uint32 H264Flag : 1; // Indicates whether the field H264 is valid + uint32 MPEG4Flag : 1; // Indicates whether the field SupportInfoUri is valid + uint32 Reserved : 29; + + int TotalNumber; // required, The minimum guaranteed total number of encoder instances (applications) per VideoSourceConfiguration. The device is able to deliver the TotalNumber of streams + int JPEG; // optional, If a device limits the number of instances for respective Video Codecs the response contains the information how many Jpeg streams can be set up at the same time per VideoSource + int H264; // optional, If a device limits the number of instances for respective Video Codecs the response contains the information how many H264 streams can be set up at the same time per VideoSource + int MPEG4; // optional, If a device limits the number of instances for respective Video Codecs the response contains the information how many Mpeg4 streams can be set up at the same time per VideoSource +} trt_GetGuaranteedNumberOfVideoEncoderInstances_RES; + +typedef struct +{ + AudioOutputList * AudioOutputs; // optional, List of existing Audio Outputs +} trt_GetAudioOutputs_RES; + +typedef struct +{ + AudioOutputConfigurationList * Configurations; // optional, This element contains a list of audio output configurations +} trt_GetAudioOutputConfigurations_RES; + +typedef struct +{ + onvif_AudioOutputConfiguration Configuration; // The requested audio output configuration +} trt_GetAudioOutputConfiguration_RES; + +typedef struct +{ + onvif_AudioOutputConfigurationOptions Options; // required, This message contains the audio output configuration options. + // If a audio output configuration is specified, the options shall concern that particular configuration. + // If a media profile is specified, the options shall be compatible with that media profile. + // If no tokens are specified, the options shall be considered generic for the device +} trt_GetAudioOutputConfigurationOptions_RES; + +typedef struct +{ + int dummy; +} trt_SetAudioOutputConfiguration_RES; + +typedef struct +{ + AudioDecoderConfigurationList * Configurations; // optional, This element contains a list of audio decoder configurations +} trt_GetAudioDecoderConfigurations_RES; + +typedef struct +{ + onvif_AudioDecoderConfiguration Configuration; // The requested audio decoder configuration +} trt_GetAudioDecoderConfiguration_RES; + +typedef struct +{ + onvif_AudioDecoderConfigurationOptions Options; // required, This message contains the audio decoder configuration options. + // If a audio decoder configuration is specified, the options shall concern that particular configuration. + // If a media profile is specified, the options shall be compatible with that media profile. + // If no tokens are specified, the options shall be considered generic for the device +} trt_GetAudioDecoderConfigurationOptions_RES; + +typedef struct +{ + int dummy; +} trt_SetAudioDecoderConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_AddAudioOutputConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_AddAudioDecoderConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_RemoveAudioOutputConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_RemoveAudioDecoderConfiguration_RES; + +typedef struct +{ + OSDConfigurationList * OSDs; // This element contains a list of requested OSDs +} trt_GetOSDs_RES; + +typedef struct +{ + onvif_OSDConfiguration OSD; // required, The requested OSD configuration +} trt_GetOSD_RES; + +typedef struct +{ + int dummy; +} trt_SetOSD_RES; + +typedef struct +{ + onvif_OSDConfigurationOptions OSDOptions; // required, +} trt_GetOSDOptions_RES; + +typedef struct +{ + char OSDToken[ONVIF_TOKEN_LEN]; // required, Returns Token of the newly created OSD +} trt_CreateOSD_RES; + +typedef struct +{ + int dummy; +} trt_DeleteOSD_RES; + +typedef struct +{ + VideoAnalyticsConfigurationList * Configurations; // list of video analytics configurations +} trt_GetVideoAnalyticsConfigurations_RES; + +typedef struct +{ + int dummy; +} trt_AddVideoAnalyticsConfiguration_RES; + +typedef struct +{ + onvif_VideoAnalyticsConfiguration Configuration; // The requested video analytics configuration +} trt_GetVideoAnalyticsConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_RemoveVideoAnalyticsConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_SetVideoAnalyticsConfiguration_RES; + +typedef struct +{ + MetadataConfigurationList * Configurations; // list of metadata configurations +} trt_GetMetadataConfigurations_RES; + +typedef struct +{ + int dummy; +} trt_AddMetadataConfiguration_RES; + +typedef struct +{ + onvif_MetadataConfiguration Configuration; // The requested metadata configuration +} trt_GetMetadataConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_RemoveMetadataConfiguration_RES; + +typedef struct +{ + int dummy; +} trt_SetMetadataConfiguration_RES; + +typedef struct +{ + onvif_MetadataConfigurationOptions Options; // If a metadata configuration is specified, the options shall concern that particular configuration. + // If a media profile is specified, the options shall be compatible with that media profile. + // If no tokens are specified, the options shall be considered generic for the device +} trt_GetMetadataConfigurationOptions_RES; + +typedef struct +{ + VideoEncoderConfigurationList * Configurations; // list of video encoder configurations +} trt_GetCompatibleVideoEncoderConfigurations_RES; + +typedef struct +{ + AudioEncoderConfigurationList * Configurations; // list of audio encoder configurations +} trt_GetCompatibleAudioEncoderConfigurations_RES; + +typedef struct +{ + VideoAnalyticsConfigurationList * Configurations; // list of video analytics configurations +} trt_GetCompatibleVideoAnalyticsConfigurations_RES; + +typedef struct +{ + MetadataConfigurationList * Configurations; // list of metadata configurations +} trt_GetCompatibleMetadataConfigurations_RES; + +typedef struct +{ + onvif_PTZCapabilities Capabilities; // required, the capabilities for the PTZ service is returned +} ptz_GetServiceCapabilities_RES; + +typedef struct +{ + PTZNodeList * PTZNode; // A list of the existing PTZ Nodes on the device +} ptz_GetNodes_RES; + +typedef struct +{ + onvif_PTZNode PTZNode; // required, A requested PTZNode +} ptz_GetNode_RES; + +typedef struct +{ + PTZPresetList * PTZPresets; // A list of presets which are available for the requested MediaProfile +} ptz_GetPresets_RES; + +typedef struct +{ + char PresetToken[ONVIF_TOKEN_LEN]; // required, A token to the Preset which has been set +} ptz_SetPreset_RES; + +typedef struct +{ + int dummy; +} ptz_RemovePreset_RES; + +typedef struct +{ + int dummy; +} ptz_GotoPreset_RES; + +typedef struct +{ + int dummy; +} ptz_GotoHomePosition_RES; + +typedef struct +{ + int dummy; +} ptz_SetHomePosition_RES; + +typedef struct +{ + onvif_PTZStatus PTZStatus; // required, The PTZStatus for the requested MediaProfile +} ptz_GetStatus_RES; + +typedef struct +{ + int dummy; +} ptz_ContinuousMove_RES; + +typedef struct +{ + int dummy; +} ptz_RelativeMove_RES; + +typedef struct +{ + int dummy; +} ptz_AbsoluteMove_RES; + +typedef struct +{ + int dummy; +} ptz_Stop_RES; + +typedef struct +{ + PTZConfigurationList * PTZConfiguration; // A list of all existing PTZConfigurations on the device +} ptz_GetConfigurations_RES; + +typedef struct +{ + onvif_PTZConfiguration PTZConfiguration; // required, A requested PTZConfiguration +} ptz_GetConfiguration_RES; + +typedef struct +{ + int dummy; +} ptz_SetConfiguration_RES; + +typedef struct +{ + onvif_PTZConfigurationOptions PTZConfigurationOptions; // required, The requested PTZ configuration options +} ptz_GetConfigurationOptions_RES; + +typedef struct +{ + PresetTourList * PresetTour; +} ptz_GetPresetTours_RES; + +typedef struct +{ + onvif_PresetTour PresetTour; +} ptz_GetPresetTour_RES; + +typedef struct +{ + onvif_PTZPresetTourOptions Options; +} ptz_GetPresetTourOptions_RES; + +typedef struct +{ + char PresetTourToken[ONVIF_TOKEN_LEN]; // required, +} ptz_CreatePresetTour_RES; + +typedef struct +{ + int dummy; +} ptz_ModifyPresetTour_RES; + +typedef struct +{ + int dummy; +} ptz_OperatePresetTour_RES; + +typedef struct +{ + int dummy; +} ptz_RemovePresetTour_RES; + +typedef struct +{ + char AuxiliaryResponse[1024]; // required, The response contains the auxiliary response +} ptz_SendAuxiliaryCommand_RES; + +typedef struct +{ + int dummy; +} ptz_GeoMove_RES; + +typedef struct +{ + onvif_EventCapabilities Capabilities; // required, The capabilities for the event service +} tev_GetServiceCapabilities_RES; + +typedef struct +{ + uint32 sizeTopicNamespaceLocation; + char TopicNamespaceLocation[10][256]; // required element of type xsd:anyURI + BOOL FixedTopicSet; // required element of type xsd:anyURI + + char * TopicSet; // required, the caller should free the memory + + uint32 sizeTopicExpressionDialect; + char TopicExpressionDialect[10][256]; // required element of type xsd:anyURI + uint32 sizeMessageContentFilterDialect; + char MessageContentFilterDialect[10][256]; // required element of type xsd:anyURI + uint32 sizeProducerPropertiesFilterDialect; + char ProducerPropertiesFilterDialect[10][256]; // optional element of type xsd:anyURI + uint32 sizeMessageContentSchemaLocation; + char MessageContentSchemaLocation[10][256]; // required element of type xsd:anyURI +} tev_GetEventProperties_RES; + +typedef struct +{ + int dummy; +} tev_Renew_RES; + +typedef struct +{ + int dummy; +} tev_Unsubscribe_RES; + +typedef struct +{ + char producter_addr[256]; // required + char ReferenceParameters[512]; // optional +} tev_Subscribe_RES; + +typedef struct +{ + int dummy; +} tev_PauseSubscription_RES; + +typedef struct +{ + int dummy; +} tev_ResumeSubscription_RES; + +typedef struct +{ + char producter_addr[256]; // required, Endpoint reference of the subscription to be used for pulling the messages + char ReferenceParameters[512]; // optional + + time_t CurrentTime; // required, Current time of the server for synchronization purposes + time_t TerminationTime; // required, Date time when the PullPoint will be shut down without further pull requests +} tev_CreatePullPointSubscription_RES; + +typedef struct +{ + int dummy; +} tev_DestroyPullPoint_RES; + +typedef struct +{ + time_t CurrentTime; // required, The date and time when the messages have been delivered by the web server to the client + time_t TerminationTime; // required, Date time when the PullPoint will be shut down without further pull requests + + NotificationMessageList * NotifyMessages; +} tev_PullMessages_RES; + +typedef struct +{ + NotificationMessageList * NotifyMessages; +} tev_GetMessages_RES; + +typedef struct +{ + int dummy; +} tev_Seek_RES; + +typedef struct +{ + int dummy; +} tev_SetSynchronizationPoint_RES; + +// imaging service + +typedef struct +{ + onvif_ImagingCapabilities Capabilities; // required, The capabilities for the imaging service is returned +} img_GetServiceCapabilities_RES; + +typedef struct +{ + onvif_ImagingSettings ImagingSettings; // required, ImagingSettings for the VideoSource that was requested +} img_GetImagingSettings_RES; + +typedef struct +{ + int dummy; +} img_SetImagingSettings_RES; + +typedef struct +{ + onvif_ImagingOptions ImagingOptions; // required, Valid ranges for the imaging parameters that are categorized as device specific +} img_GetOptions_RES; + +typedef struct +{ + int dummy; +} img_Move_RES; + +typedef struct +{ + int dummy; +} img_Stop_RES; + +typedef struct +{ + onvif_ImagingStatus Status; // required, Requested imaging status +} img_GetStatus_RES; + +typedef struct +{ + onvif_MoveOptions20 MoveOptions; // required, Valid ranges for the focus lens move options +} img_GetMoveOptions_RES; + +typedef struct +{ + ImagingPresetList * Preset; // required, List of Imaging Presets which are available for the requested VideoSource. +} img_GetPresets_RES; + +typedef struct +{ + uint32 PresetFlag : 1; // Indicates whether the field Preset is valid + uint32 Reserved : 31; + + onvif_ImagingPreset Preset; // optional, Current Imaging Preset in use for the specified Video Source +} img_GetCurrentPreset_RES; + +typedef struct +{ + int dummy; +} img_SetCurrentPreset_RES; + +// device IO + +typedef struct +{ + onvif_DeviceIOCapabilities Capabilities; // required, the capabilities for the deviceIO service is returned +} tmd_GetServiceCapabilities_RES; + +typedef struct +{ + RelayOutputList * RelayOutputs; +} tmd_GetRelayOutputs_RES; + +typedef struct +{ + RelayOutputOptionsList * RelayOutputOptions; +} tmd_GetRelayOutputOptions_RES; + +typedef struct +{ + int dummy; +} tmd_SetRelayOutputSettings_RES; + +typedef struct +{ + int dummy; +} tmd_SetRelayOutputState_RES; + +typedef struct +{ + DigitalInputList * DigitalInputs; +} tmd_GetDigitalInputs_RES; + +typedef struct +{ + onvif_DigitalInputConfigurationOptions DigitalInputOptions; +} tmd_GetDigitalInputConfigurationOptions_RES; + +typedef struct +{ + int dummy; +} tmd_SetDigitalInputConfigurations_RES; + + +// recording + +typedef struct +{ + onvif_RecordingCapabilities Capabilities; // required, The capabilities for the recording service +} trc_GetServiceCapabilities_RES; + +typedef struct +{ + char RecordingToken[ONVIF_TOKEN_LEN]; // required +} trc_CreateRecording_RES; + +typedef struct +{ + int dummy; +} trc_DeleteRecording_RES; + +typedef struct +{ + RecordingList * Recordings; +} trc_GetRecordings_RES; + +typedef struct +{ + int dummy; +} trc_SetRecordingConfiguration_RES; + +typedef struct +{ + onvif_RecordingConfiguration RecordingConfiguration; +} trc_GetRecordingConfiguration_RES; + +typedef struct +{ + onvif_RecordingOptions Options; +} trc_GetRecordingOptions_RES; + +typedef struct +{ + char TrackToken[ONVIF_TOKEN_LEN]; // required +} trc_CreateTrack_RES; + +typedef struct +{ + int dummy; +} trc_DeleteTrack_RES; + +typedef struct +{ + onvif_TrackConfiguration TrackConfiguration; // required +} trc_GetTrackConfiguration_RES; + +typedef struct +{ + int dummy; +} trc_SetTrackConfiguration_RES; + +typedef struct +{ + char JobToken[ONVIF_TOKEN_LEN]; // required + + onvif_RecordingJobConfiguration JobConfiguration; // required +} trc_CreateRecordingJob_RES; + +typedef struct +{ + int dummy; +} trc_DeleteRecordingJob_RES; + +typedef struct +{ + RecordingJobList * RecordingJobs; +} trc_GetRecordingJobs_RES; + +typedef struct +{ + onvif_RecordingJobConfiguration JobConfiguration; // required +} trc_SetRecordingJobConfiguration_RES; + +typedef struct +{ + onvif_RecordingJobConfiguration JobConfiguration; // required +} trc_GetRecordingJobConfiguration_RES; + +typedef struct +{ + int dummy; +} trc_SetRecordingJobMode_RES; + +typedef struct +{ + onvif_RecordingJobStateInformation State; // required +} trc_GetRecordingJobState_RES; + +typedef struct +{ + char OperationToken[ONVIF_TOKEN_LEN]; // required, Unique operation token for client to associate the relevant events + uint32 sizeFileNames; // sequence of elements + char FileNames[100][256]; // optional, List of exported file names. The device can also use AsyncronousOperationStatus event to publish this list +} trc_ExportRecordedData_RES; + +typedef struct +{ + float Progress; // required, Progress percentage of ExportRecordedData operation + onvif_ArrayOfFileProgress FileProgressStatus; // required, +} trc_StopExportRecordedData_RES; + +typedef struct +{ + float Progress; // required, Progress percentage of ExportRecordedData operation + onvif_ArrayOfFileProgress FileProgressStatus; // required, +} trc_GetExportRecordedDataState_RES; + +typedef struct +{ + onvif_ReplayCapabilities Capabilities; // required, The capabilities for the replay service +} trp_GetServiceCapabilities_RES; + +typedef struct +{ + char Uri[ONVIF_URI_LEN]; // required. The URI to which the client should connect in order to stream the recording +} trp_GetReplayUri_RES; + +typedef struct +{ + onvif_ReplayConfiguration Configuration; // required, The current replay configuration parameters +} trp_GetReplayConfiguration_RES; + +typedef struct +{ + int dummy; +} trp_SetReplayConfiguration_RES; + +typedef struct +{ + onvif_SearchCapabilities Capabilities; // required, The capabilities for the search service +} tse_GetServiceCapabilities_RES; + +typedef struct +{ + time_t DataFrom; // Required. The earliest point in time where there is recorded data on the device. + time_t DataUntil; // Required. The most recent point in time where there is recorded data on the device + int NumberRecordings; // Required. The device contains this many recordings +} tse_GetRecordingSummary_RES; + +typedef struct +{ + onvif_RecordingInformation RecordingInformation; // required +} tse_GetRecordingInformation_RES; + +typedef struct +{ + onvif_MediaAttributes MediaAttributes; +} tse_GetMediaAttributes_RES; + +typedef struct +{ + char SearchToken[ONVIF_TOKEN_LEN]; // Required, A unique reference to the search session created by this request +} tse_FindRecordings_RES; + +typedef struct +{ + onvif_FindRecordingResultList ResultList; +} tse_GetRecordingSearchResults_RES; + +typedef struct +{ + char SearchToken[ONVIF_TOKEN_LEN]; // Required, A unique reference to the search session created by this request +} tse_FindEvents_RES; + +typedef struct +{ + onvif_FindEventResultList ResultList; // Required, +} tse_GetEventSearchResults_RES; + +typedef struct +{ + char SearchToken[ONVIF_TOKEN_LEN]; // Required, A unique reference to the search session created by this request +} tse_FindMetadata_RES; + +typedef struct +{ + onvif_FindMetadataResultList ResultList; // Required, +} tse_GetMetadataSearchResults_RES; + +typedef struct +{ + char SearchToken[ONVIF_TOKEN_LEN]; // Required, A unique reference to the search session created by this request +} tse_FindPTZPosition_RES; + +typedef struct +{ + onvif_FindPTZPositionResultList ResultList; // Required, +} tse_GetPTZPositionSearchResults_RES; + +typedef struct +{ + onvif_SearchState State; +} tse_GetSearchState_RES; + +typedef struct +{ + time_t Endpoint; // Required, The point of time the search had reached when it was ended. It is equal to the EndPoint specified in Find-operation if the search was completed +} tse_EndSearch_RES; + +typedef struct +{ + onvif_AnalyticsCapabilities Capabilities; // required, The capabilities for the Analytics service +} tan_GetServiceCapabilities_RES; + +typedef struct +{ + onvif_SupportedRules SupportedRules; +} tan_GetSupportedRules_RES; + +typedef struct +{ + int dummy; +} tan_CreateRules_RES; + +typedef struct +{ + int dummy; +} tan_DeleteRules_RES; + +typedef struct +{ + ConfigList * Rule; // optional +} tan_GetRules_RES; + +typedef struct +{ + int dummy; +} tan_ModifyRules_RES; + +typedef struct +{ + int dummy; +} tan_CreateAnalyticsModules_RES; + +typedef struct +{ + int dummy; +} tan_DeleteAnalyticsModules_RES; + +typedef struct +{ + ConfigList * AnalyticsModule; // optional +} tan_GetAnalyticsModules_RES; + +typedef struct +{ + int dummy; +} tan_ModifyAnalyticsModules_RES; + +typedef struct +{ + onvif_SupportedAnalyticsModules SupportedAnalyticsModules; // required element of type ns2:SupportedAnalyticsModules +} tan_GetSupportedAnalyticsModules_RES; + +typedef struct +{ + ConfigOptionsList * RuleOptions; // optional, A device shall provide respective ConfigOptions.RuleType for each RuleOption + // if the request does not specify RuleType +} tan_GetRuleOptions_RES; + +typedef struct +{ + AnalyticsModuleConfigOptionsList * Options; // optional, +} tan_GetAnalyticsModuleOptions_RES; + +typedef struct +{ + MetadataInfoList * AnalyticsModule; // optional, +} tan_GetSupportedMetadata_RES; + +// onvif media service 2 interfaces + +typedef struct +{ + onvif_MediaCapabilities2 Capabilities; // required, The capabilities for the medai 2 service +} tr2_GetServiceCapabilities_RES; + +typedef struct +{ + VideoEncoder2ConfigurationList * Configurations; // This element contains a list of video encoder configurations +} tr2_GetVideoEncoderConfigurations_RES; + +typedef struct +{ + VideoEncoder2ConfigurationOptionsList * Options; // required +} tr2_GetVideoEncoderConfigurationOptions_RES; + +typedef struct +{ + int dummy; +} tr2_SetVideoEncoderConfiguration_RES; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, Token assigned by the device for the newly created profile +} tr2_CreateProfile_RES; + +typedef struct +{ + MediaProfileList * Profiles; // Lists all profiles that exist in the media service. + // The response provides the requested types of Configurations as far as available. + // If a profile doesn't contain a type no error shall be provided +} tr2_GetProfiles_RES; + +typedef struct +{ + int dummy; +} tr2_DeleteProfile_RES; + +typedef struct +{ + char Uri[256]; // required, Stable Uri to be used for requesting the media stream +} tr2_GetStreamUri_RES; + +typedef struct +{ + VideoSourceConfigurationList * Configurations; // This element contains a list of video source configurations +} tr2_GetVideoSourceConfigurations_RES; + +typedef struct +{ + onvif_VideoSourceConfigurationOptions Options; // This message contains the video source configuration options. + // If a video source configuration is specified, the options shall concern that particular configuration. + // If a media profile is specified, the options shall be compatible with that media profile. + // If no tokens are specified, the options shall be considered generic for the device +} tr2_GetVideoSourceConfigurationOptions_RES; + +typedef struct +{ + int dummy; +} tr2_SetVideoSourceConfiguration_RES; + +typedef struct +{ + int dummy; +} tr2_SetSynchronizationPoint_RES; + +typedef struct +{ + MetadataConfigurationList * Configurations; // This element contains a list of metadata configurations +} tr2_GetMetadataConfigurations_RES; + +typedef struct +{ + onvif_MetadataConfigurationOptions Options; // This message contains the metadata configuration options. + // If a metadata configuration is specified, the options shall concern that particular configuration. + // If a media profile is specified, the options shall be compatible with that media profile. + // If no tokens are specified, the options shall be considered generic for the device +} tr2_GetMetadataConfigurationOptions_RES; + +typedef struct +{ + int dummy; +} tr2_SetMetadataConfiguration_RES; + +typedef struct +{ + AudioEncoder2ConfigurationList * Configurations; // This element contains a list of audio encoder configurations +} tr2_GetAudioEncoderConfigurations_RES; + +typedef struct +{ + AudioSourceConfigurationList * Configurations; // This element contains a list of audio source configurations +} tr2_GetAudioSourceConfigurations_RES; + +typedef struct +{ + int dummy; +} tr2_GetAudioSourceConfigurationOptions_RES; + +typedef struct +{ + int dummy; +} tr2_SetAudioSourceConfiguration_RES; + +typedef struct +{ + int dummy; +} tr2_SetAudioEncoderConfiguration_RES; + +typedef struct +{ + AudioEncoder2ConfigurationOptionsList * Options; // This message contains the audio encoder configuration options. + // If a audio encoder configuration is specified, the options shall concern that particular configuration. + // If a media profile is specified, the options shall be compatible with that media profile. + // If no tokens are specified, the options shall be considered generic for the device +} tr2_GetAudioEncoderConfigurationOptions_RES; + +typedef struct +{ + int dummy; +} tr2_AddConfiguration_RES; + +typedef struct +{ + int dummy; +} tr2_RemoveConfiguration_RES; + +typedef struct +{ + onvif_EncoderInstanceInfo Info; // required, The minimum guaranteed total number of encoder instances (applications) per VideoSourceConfiguration +} tr2_GetVideoEncoderInstances_RES; + +typedef struct +{ + AudioOutputConfigurationList * Configurations; // optional, This element contains a list of audio output configurations +} tr2_GetAudioOutputConfigurations_RES; + +typedef struct +{ + onvif_AudioOutputConfigurationOptions Options; // required, This message contains the audio output configuration options. + // If a audio output configuration is specified, the options shall concern that particular configuration. + // If a media profile is specified, the options shall be compatible with that media profile. + // If no tokens are specified, the options shall be considered generic for the device +} tr2_GetAudioOutputConfigurationOptions_RES; + +typedef struct +{ + int dummy; +} tr2_SetAudioOutputConfiguration_RES; + +typedef struct +{ + AudioDecoderConfigurationList * Configurations; // optional, This element contains a list of audio decoder configurations +} tr2_GetAudioDecoderConfigurations_RES; + +typedef struct +{ + AudioEncoder2ConfigurationOptionsList * Options; // optional, This message contains the audio decoder configuration options. + // If a audio decoder configuration is specified, the options shall concern that particular configuration. + // If a media profile is specified, the options shall be compatible with that media profile. + // If no tokens are specified, the options shall be considered generic for the device +} tr2_GetAudioDecoderConfigurationOptions_RES; + +typedef struct +{ + int dummy; +} tr2_SetAudioDecoderConfiguration_RES; + +typedef struct +{ + char Uri[512]; // required, Stable Uri to be used for requesting snapshot images +} tr2_GetSnapshotUri_RES; + +typedef struct +{ + int dummy; +} tr2_StartMulticastStreaming_RES; + +typedef struct +{ + int dummy; +} tr2_StopMulticastStreaming_RES; + +typedef struct +{ + VideoSourceModeList * VideoSourceModes; //required, Return the information for specified video source mode +} tr2_GetVideoSourceModes_RES; + +typedef struct +{ + BOOL Reboot; // required, The response contains information about rebooting after returning response. + // When Reboot is set true, a device will reboot automatically after setting mode +} tr2_SetVideoSourceMode_RES; + +typedef struct +{ + char OSDToken[ONVIF_TOKEN_LEN]; // required, Returns Token of the newly created OSD +} tr2_CreateOSD_RES; + +typedef struct +{ + int dummy; +} tr2_DeleteOSD_RES; + +typedef struct +{ + OSDConfigurationList * OSDs; // optional, This element contains a list of requested OSDs +} tr2_GetOSDs_RES; + +typedef struct +{ + int dummy; +} tr2_SetOSD_RES; + +typedef struct +{ + onvif_OSDConfigurationOptions OSDOptions; // required +} tr2_GetOSDOptions_RES; + +typedef struct +{ + VideoAnalyticsConfigurationList * Configurations; // optional, This element contains a list of Analytics configurations +} tr2_GetAnalyticsConfigurations_RES; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, Returns Token of the newly created Mask +} tr2_CreateMask_RES; + +typedef struct +{ + MaskList * Masks; // optional, List of Mask configurations +} tr2_GetMasks_RES; + +typedef struct +{ + int dummy; +} tr2_SetMask_RES; + +typedef struct +{ + int dummy; +} tr2_DeleteMask_RES; + +typedef struct +{ + onvif_MaskOptions Options; // required, +} tr2_GetMaskOptions_RES; + +// end of onvif media 2 interfaces + +typedef struct +{ + onvif_AccessControlCapabilities Capabilities; // required, The capabilities for the access control service +} tac_GetServiceCapabilities_RES; + +typedef struct +{ + uint32 NextStartReferenceFlag : 1; + uint32 Reserved : 31; + + char NextStartReference[ONVIF_TOKEN_LEN]; // optional, StartReference to use in next call to get the following items. If absent, no more items to get + + AccessPointList * AccessPointInfo; // optional, List of AccessPointInfo items +} tac_GetAccessPointInfoList_RES; + +typedef struct +{ + AccessPointList * AccessPointInfo; // List of AccessPointInfo items +} tac_GetAccessPointInfo_RES; + +typedef struct +{ + uint32 NextStartReferenceFlag : 1; + uint32 Reserved : 31; + + char NextStartReference[ONVIF_TOKEN_LEN]; // optional, StartReference to use in next call to get the following items. If absent, no more items to get + + AccessPointList * AccessPoint; // optional, List of AccessPoint items +} tac_GetAccessPointList_RES; + +typedef struct +{ + AccessPointList * AccessPoint; // optional, List of AccessPoint items +} tac_GetAccessPoints_RES; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required +} tac_CreateAccessPoint_RES; + +typedef struct +{ + int dummy; +} tac_SetAccessPoint_RES; + +typedef struct +{ + int dummy; +} tac_ModifyAccessPoint_RES; + +typedef struct +{ + int dummy; +} tac_DeleteAccessPoint_RES; + +typedef struct +{ + uint32 NextStartReferenceFlag : 1; + uint32 Reserved : 31; + + char NextStartReference[ONVIF_TOKEN_LEN]; // optional, StartReference to use in next call to get the following items. If absent, no more items to get + + AreaList * AreaInfo; // optional, List of AreaInfo items +} tac_GetAreaInfoList_RES; + +typedef struct +{ + AreaList * AreaInfo; // List of AreaInfo items +} tac_GetAreaInfo_RES; + +typedef struct +{ + uint32 NextStartReferenceFlag : 1; + uint32 Reserved : 31; + + char NextStartReference[ONVIF_TOKEN_LEN]; // optional, StartReference to use in next call to get the following items. If absent, no more items to get + + AreaList * Area; // optional, List of Area items +} tac_GetAreaList_RES; + +typedef struct +{ + AreaList * Area; // optional, List of Area items +} tac_GetAreas_RES; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required +} tac_CreateArea_RES; + +typedef struct +{ + int dummy; +} tac_SetArea_RES; + +typedef struct +{ + int dummy; +} tac_ModifyArea_RES; + +typedef struct +{ + int dummy; +} tac_DeleteArea_RES; + +typedef struct +{ + BOOL Enabled; // required, Indicates that the AccessPoint is enabled. + // By default this field value shall be True, if the DisableAccessPoint capabilities is not supported +} tac_GetAccessPointState_RES; + +typedef struct +{ + int dummy; +} tac_EnableAccessPoint_RES; + +typedef struct +{ + int dummy; +} tac_DisableAccessPoint_RES; + +typedef struct +{ + onvif_DoorControlCapabilities Capabilities; // required, The capabilities for the door control service +} tdc_GetServiceCapabilities_RES; + +typedef struct +{ + uint32 NextStartReferenceFlag : 1; + uint32 Reserved : 31; + + char NextStartReference[ONVIF_TOKEN_LEN]; // optional, StartReference to use in next call to get the following items. If absent, no more items to get + + DoorInfoList * DoorInfo; // optional, List of DoorInfo items +} tdc_GetDoorInfoList_RES; + +typedef struct +{ + DoorInfoList * DoorInfo; // List of DoorInfo items +} tdc_GetDoorInfo_RES; + +typedef struct +{ + onvif_DoorState DoorState; +} tdc_GetDoorState_RES; + +typedef struct +{ + int dummy; +} tdc_AccessDoor_RES; + +typedef struct +{ + int dummy; +} tdc_LockDoor_RES; + +typedef struct +{ + int dummy; +} tdc_UnlockDoor_RES; + +typedef struct +{ + int dummy; +} tdc_DoubleLockDoor_RES; + +typedef struct +{ + int dummy; +} tdc_BlockDoor_RES; + +typedef struct +{ + int dummy; +} tdc_LockDownDoor_RES; + +typedef struct +{ + int dummy; +} tdc_LockDownReleaseDoor_RES; + +typedef struct +{ + int dummy; +} tdc_LockOpenDoor_RES; + +typedef struct +{ + int dummy; +} tdc_LockOpenReleaseDoor_RES; + +typedef struct +{ + DoorList * Door; // optional, List of Door items +} tdc_GetDoors_RES; + +typedef struct +{ + uint32 NextStartReferenceFlag : 1; + uint32 Reserved : 31; + + char NextStartReference[ONVIF_TOKEN_LEN]; // optional, StartReference to use in next call to get the following items. If absent, no more items to get + + DoorList * Door; // optional, List of Door items +} tdc_GetDoorList_RES; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, Token of created Door item +} tdc_CreateDoor_RES; + +typedef struct +{ + int dummy; +} tdc_SetDoor_RES; + +typedef struct +{ + int dummy; +} tdc_ModifyDoor_RES; + +typedef struct +{ + int dummy; +} tdc_DeleteDoor_RES; + +// thermal service + +typedef struct +{ + onvif_ThermalCapabilities Capabilities; // required, The capabilities for the thermal service +} tth_GetServiceCapabilities_RES; + +typedef struct +{ + ThermalConfigurationList * Configurations; // This element contains a list of thermal VideoSource configurations +} tth_GetConfigurations_RES; + +typedef struct +{ + onvif_ThermalConfiguration Configuration; // required, thermal Settings for the VideoSource that was requested +} tth_GetConfiguration_RES; + +typedef struct +{ + int dummy; +} tth_SetConfiguration_RES; + +typedef struct +{ + onvif_ThermalConfigurationOptions Options; // required, Valid ranges for the Thermal configuration parameters that are categorized as device specific +} tth_GetConfigurationOptions_RES; + +typedef struct +{ + onvif_RadiometryConfiguration Configuration; // required, Radiometry Configuration for the VideoSource that was requested +} tth_GetRadiometryConfiguration_RES; + +typedef struct +{ + int dummy; +} tth_SetRadiometryConfiguration_RES; + +typedef struct +{ + onvif_RadiometryConfigurationOptions Options; // required, Valid ranges for the Thermal Radiometry parameters that are categorized as device specific +} tth_GetRadiometryConfigurationOptions_RES; + +typedef struct +{ + onvif_CredentialCapabilities Capabilities; // required, The capabilities for the credential service +} tcr_GetServiceCapabilities_RES; + +typedef struct +{ + uint32 sizeCredentialInfo; // sequence of elements + + onvif_CredentialInfo CredentialInfo[CREDENTIAL_MAX_LIMIT]; // optional, List of CredentialInfo items +} tcr_GetCredentialInfo_RES; + +typedef struct +{ + uint32 NextStartReferenceFlag : 1; // Indicates whether the field StartReference is valid + uint32 Reserved : 31; + + char NextStartReference[ONVIF_TOKEN_LEN]; // optional, StartReference to use in next call to get the following items. If + // absent, no more items to get + uint32 sizeCredentialInfo; // sequence of elements + + onvif_CredentialInfo CredentialInfo[CREDENTIAL_MAX_LIMIT]; // optional, List of CredentialInfo items +} tcr_GetCredentialInfoList_RES; + +typedef struct +{ + uint32 sizeCredential; // sequence of elements + + onvif_Credential Credential[CREDENTIAL_MAX_LIMIT]; // optional, List of Credential items +} tcr_GetCredentials_RES; + +typedef struct +{ + uint32 NextStartReferenceFlag : 1; // Indicates whether the field StartReference is valid + uint32 Reserved : 31; + + char NextStartReference[ONVIF_TOKEN_LEN]; // optional, StartReference to use in next call to get the following items. If + // absent, no more items to get + uint32 sizeCredential; // sequence of elements + onvif_Credential Credential[CREDENTIAL_MAX_LIMIT]; // optional, List of Credential items +} tcr_GetCredentialList_RES; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, The token of the created credential +} tcr_CreateCredential_RES; + +typedef struct +{ + int dummy; +} tcr_ModifyCredential_RES; + +typedef struct +{ + int dummy; +} tcr_DeleteCredential_RES; + +typedef struct +{ + onvif_CredentialState State; // required, State of the credential +} tcr_GetCredentialState_RES; + +typedef struct +{ + int dummy; +} tcr_EnableCredential_RES; + +typedef struct +{ + int dummy; +} tcr_DisableCredential_RES; + +typedef struct +{ + int dummy; +} tcr_ResetAntipassbackViolation_RES; + +typedef struct +{ + uint32 sizeFormatTypeInfo; // sequence of elements + + onvif_CredentialIdentifierFormatTypeInfo FormatTypeInfo[CREDENTIAL_MAX_LIMIT]; // required, Identifier format types +} tcr_GetSupportedFormatTypes_RES; + +typedef struct +{ + uint32 sizeCredentialIdentifier; // sequence of elements + + onvif_CredentialIdentifier CredentialIdentifier[CREDENTIAL_MAX_LIMIT]; // optional, Identifiers of the credential +} tcr_GetCredentialIdentifiers_RES; + +typedef struct +{ + int dummy; +} tcr_SetCredentialIdentifier_RES; + +typedef struct +{ + int dummy; +} tcr_DeleteCredentialIdentifier_RES; + +typedef struct +{ + uint32 sizeCredentialAccessProfile; // sequence of elements + + onvif_CredentialAccessProfile CredentialAccessProfile[CREDENTIAL_MAX_LIMIT]; // optional, Access Profiles of the credential +} tcr_GetCredentialAccessProfiles_RES; + +typedef struct +{ + int dummy; +} tcr_SetCredentialAccessProfiles_RES; + +typedef struct +{ + int dummy; +} tcr_DeleteCredentialAccessProfiles_RES; + +typedef struct +{ + onvif_AccessRulesCapabilities Capabilities; // required, The capabilities for the access rules service +} tar_GetServiceCapabilities_RES; + +typedef struct +{ + uint32 sizeAccessProfileInfo; // sequence of elements + + onvif_AccessProfileInfo AccessProfileInfo[ACCESSRULES_MAX_LIMIT]; // optional, List of AccessProfileInfo items +} tar_GetAccessProfileInfo_RES; + +typedef struct +{ + uint32 NextStartReferenceFlag : 1; // Indicates whether the field NextStartReference is valid + uint32 Reserved : 31; + + char NextStartReference[ONVIF_TOKEN_LEN]; // optional, + uint32 sizeAccessProfileInfo; // sequence of elements + + onvif_AccessProfileInfo AccessProfileInfo[ACCESSRULES_MAX_LIMIT]; // optional, List of AccessProfileInfo items +} tar_GetAccessProfileInfoList_RES; + +typedef struct +{ + uint32 sizeAccessProfile; // sequence of elements + + onvif_AccessProfile AccessProfile[ACCESSRULES_MAX_LIMIT]; // optional, List of Access Profile items +} tar_GetAccessProfiles_RES; + +typedef struct +{ + uint32 NextStartReferenceFlag : 1; // Indicates whether the field NextStartReference is valid + uint32 Reserved : 31; + + char NextStartReference[ONVIF_TOKEN_LEN]; // optional, + uint32 sizeAccessProfile; // sequence of elements + + onvif_AccessProfile AccessProfile[ACCESSRULES_MAX_LIMIT]; // optional, List of Access Profile items +} tar_GetAccessProfileList_RES; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, The Token of created AccessProfile +} tar_CreateAccessProfile_RES; + +typedef struct +{ + int dummy; +} tar_ModifyAccessProfile_RES; + +typedef struct +{ + int dummy; +} tar_DeleteAccessProfile_RES; + +typedef struct +{ + onvif_ScheduleCapabilities Capabilities; // required, The capabilities for the Schedule service +} tsc_GetServiceCapabilities_RES; + +typedef struct +{ + uint32 sizeScheduleInfo; // sequence of elements + onvif_ScheduleInfo ScheduleInfo[SCHEDULE_MAX_LIMIT]; // optional, List of ScheduleInfo items +} tsc_GetScheduleInfo_RES; + +typedef struct +{ + uint32 NextStartReferenceFlag : 1; // Indicates whether the field StartReference is valid + uint32 Reserved : 31; + + char NextStartReference[ONVIF_TOKEN_LEN]; // optional, StartReference to use in next call to get the following items. If + // absent, no more items to get + uint32 sizeScheduleInfo; // sequence of elements + + onvif_ScheduleInfo ScheduleInfo[SCHEDULE_MAX_LIMIT]; // optional, List of ScheduleInfo items +} tsc_GetScheduleInfoList_RES; + +typedef struct +{ + uint32 sizeSchedule; // sequence of elements + onvif_Schedule Schedule[SCHEDULE_MAX_LIMIT]; // optional, List of schedule items +} tsc_GetSchedules_RES; + +typedef struct +{ + uint32 NextStartReferenceFlag : 1; // Indicates whether the field StartReference is valid + uint32 Reserved : 31; + + char NextStartReference[ONVIF_TOKEN_LEN]; // optional, StartReference to use in next call to get the following items. If + // absent, no more items to get + uint32 sizeSchedule; // sequence of elements + + onvif_Schedule Schedule[SCHEDULE_MAX_LIMIT]; // optional, List of Schedule items +} tsc_GetScheduleList_RES; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, The token of created Schedule +} tsc_CreateSchedule_RES; + +typedef struct +{ + int dummy; +} tsc_ModifySchedule_RES; + +typedef struct +{ + int dummy; +} tsc_DeleteSchedule_RES; + +typedef struct +{ + uint32 sizeSpecialDayGroupInfo; // sequence of elements + onvif_SpecialDayGroupInfo SpecialDayGroupInfo[SCHEDULE_MAX_LIMIT]; // optional, List of SpecialDayGroupInfo items +} tsc_GetSpecialDayGroupInfo_RES; + +typedef struct +{ + uint32 NextStartReferenceFlag : 1; // Indicates whether the field StartReference is valid + uint32 Reserved : 31; + + char NextStartReference[ONVIF_TOKEN_LEN]; // optional, StartReference to use in next call to get the following items. If + // absent, no more items to get + uint32 sizeSpecialDayGroupInfo; // sequence of elements + + onvif_SpecialDayGroupInfo SpecialDayGroupInfo[SCHEDULE_MAX_LIMIT]; // optional, List of SpecialDayGroupInfo items +} tsc_GetSpecialDayGroupInfoList_RES; + +typedef struct +{ + uint32 sizeSpecialDayGroup; // sequence of elements + onvif_SpecialDayGroup SpecialDayGroup[SCHEDULE_MAX_LIMIT]; // optional, List of SpecialDayGroup items +} tsc_GetSpecialDayGroups_RES; + +typedef struct +{ + uint32 NextStartReferenceFlag : 1; // Indicates whether the field StartReference is valid + uint32 Reserved : 31; + + char NextStartReference[ONVIF_TOKEN_LEN]; // optional, StartReference to use in next call to get the following items. If + // absent, no more items to get + uint32 sizeSpecialDayGroup; // sequence of elements + + onvif_SpecialDayGroup SpecialDayGroup[SCHEDULE_MAX_LIMIT]; // optional, List of SpecialDayGroup items +} tsc_GetSpecialDayGroupList_RES; + +typedef struct +{ + char Token[ONVIF_TOKEN_LEN]; // required, The token of created special day group +} tsc_CreateSpecialDayGroup_RES; + +typedef struct +{ + int dummy; +} tsc_ModifySpecialDayGroup_RES; + +typedef struct +{ + int dummy; +} tsc_DeleteSpecialDayGroup_RES; + +typedef struct +{ + onvif_ScheduleState ScheduleState; // required, ScheduleState item +} tsc_GetScheduleState_RES; + +typedef struct +{ + onvif_ReceiverCapabilities Capabilities; // required, The capabilities for the Receiver service +} trv_GetServiceCapabilities_RES; + +typedef struct +{ + ReceiverList * Receivers; // required, A list of all receivers that currently exist on the device +} trv_GetReceivers_RES; + +typedef struct +{ + onvif_Receiver Receiver; // required, The details of the receiver +} trv_GetReceiver_RES; + +typedef struct +{ + onvif_Receiver Receiver; // required, The details of the receiver that was created +} trv_CreateReceiver_RES; + +typedef struct +{ + int dummy; +} trv_DeleteReceiver_RES; + +typedef struct +{ + int dummy; +} trv_ConfigureReceiver_RES; + +typedef struct +{ + int dummy; +} trv_SetReceiverMode_RES; + +typedef struct +{ + onvif_ReceiverStateInformation ReceiverState; // required, Description of the current receiver state +} trv_GetReceiverState_RES; + +typedef struct +{ + onvif_ProvisioningCapabilities Capabilities; // required, The capabilities for the Receiver service +} tpv_GetServiceCapabilities_RES; + +typedef struct +{ + int dummy; +} tpv_PanMove_RES; + +typedef struct +{ + int dummy; +} tpv_TiltMove_RES; + +typedef struct +{ + int dummy; +} tpv_ZoomMove_RES; + +typedef struct +{ +} tpv_RollMove_RES; + +typedef struct +{ + int dummy; +} tpv_FocusMove_RES; + +typedef struct +{ + int dummy; +} tpv_Stop_RES; + +typedef struct +{ + onvif_Usage Usage; // required, The set of lifetime usage values for the provisioning associated with the video source +} tpv_GetUsage_RES; + + +#endif // end of ONVIF_RES_H + + + diff --git a/ONVIF/include/onvif/onvif_utils.h b/ONVIF/include/onvif/onvif_utils.h new file mode 100644 index 0000000..181d2c2 --- /dev/null +++ b/ONVIF/include/onvif/onvif_utils.h @@ -0,0 +1,52 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef _ONVIF_UTILS_H_ +#define _ONVIF_UTILS_H_ + +#include "sys_inc.h" +#include "onvif.h" + +#ifdef __cplusplus +extern "C" { +#endif + +HT_API void onvif_get_time_str(char * buff, int len, int sec_off); +HT_API void onvif_get_time_str_s(char * buff, int len, time_t nowtime, int sec_off); +HT_API BOOL onvif_is_valid_hostname(const char * name); +HT_API BOOL onvif_is_valid_timezone(const char * tz); +HT_API void onvif_get_timezone(char * tz, int len, BOOL * daylight); +HT_API char * onvif_uuid_create(char * uuid, int len); +HT_API time_t onvif_timegm(struct tm *T); +HT_API int onvif_parse_xaddr(const char * pdata, char * host, int hostsize, char * url, int urlsize, int * port, int * https); +HT_API time_t onvif_datetime_to_time_t(onvif_DateTime * p_datetime); +HT_API void onvif_time_t_to_datetime(time_t n, onvif_DateTime * p_datetime); +HT_API char * onvif_format_datetime_str(time_t n, int flag, const char * format, char * buff, int buflen); +HT_API time_t onvif_timegm(struct tm *T); +HT_API int onvif_parse_uri(const char * p_in, char * p_out, int outlen); +HT_API char * onvif_format_float_num(float num, int precision, char * buff, int len); + +#ifdef __cplusplus +} +#endif + + +#endif + + diff --git a/ONVIF/include/onvif/onvif_ver.h b/ONVIF/include/onvif/onvif_ver.h new file mode 100644 index 0000000..b455dd9 --- /dev/null +++ b/ONVIF/include/onvif/onvif_ver.h @@ -0,0 +1,29 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef ONVIF_VER_H +#define ONVIF_VER_H + +#define ONVIF_CLIENT_VERSION "V12.0" + + +#endif + + + diff --git a/ONVIF/include/onvif/soap.h b/ONVIF/include/onvif/soap.h new file mode 100644 index 0000000..dc24ec2 --- /dev/null +++ b/ONVIF/include/onvif/soap.h @@ -0,0 +1,40 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef SOAP_H +#define SOAP_H + +#include "sys_inc.h" +#include "onvif.h" +#include "xml_node.h" + +#ifdef __cplusplus +extern "C" { +#endif + +BOOL onvif_rly_handler(XMLN * p_xml, eOnvifAction act, ONVIF_DEVICE * p_dev, void * p_res); + +#ifdef __cplusplus +} +#endif + + +#endif + + diff --git a/ONVIF/include/onvif/soap_parser.h b/ONVIF/include/onvif/soap_parser.h new file mode 100644 index 0000000..82201cd --- /dev/null +++ b/ONVIF/include/onvif/soap_parser.h @@ -0,0 +1,435 @@ +/*************************************************************************************** + * + * 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. + * +****************************************************************************************/ + +#ifndef SOAP_PARSER_H +#define SOAP_PARSER_H + +#include "sys_inc.h" +#include "onvif.h" +#include "xml_node.h" +#include "onvif_res.h" + +#ifdef __cplusplus +extern "C" { +#endif + +HT_API BOOL parse_Bool(const char * pdata); +HT_API int parse_DeviceType(const char * pdata); +HT_API int parse_XAddr(const char * pdata, onvif_XAddr * p_xaddr); + +int parse_Time(const char * pdata); +BOOL parse_XSDDatetime(const char * s, time_t * p); +BOOL parse_XSDDuration(const char *s, int *a); +BOOL parse_Fault(XMLN * p_node, onvif_Fault * p_res); +BOOL parse_FloatRangeList(const char * p_buff, onvif_FloatRange * p_res); +BOOL parse_IntList(XMLN * p_node, onvif_IntList * p_res); +BOOL parse_IntRange(XMLN * p_node, onvif_IntRange * p_res); +BOOL parse_FloatRange(XMLN * p_node, onvif_FloatRange * p_res); +BOOL parse_EncodingList(const char * p_encoding, onvif_RecordingCapabilities * p_res); +BOOL parse_Vector(XMLN * p_node, onvif_Vector * p_res); +BOOL parse_Vector1D(XMLN * p_node, onvif_Vector1D * p_res); +BOOL parse_PTZSpeed(XMLN * p_node, onvif_PTZSpeed * p_res); +BOOL parse_PTZVector(XMLN * p_node, onvif_PTZVector * p_res); +BOOL parse_AnalyticsCapabilities(XMLN * p_node, onvif_AnalyticsCapabilities * p_res); +BOOL parse_DeviceCapabilities(XMLN * p_node, onvif_DevicesCapabilities * p_res); +BOOL parse_EventsCapabilities(XMLN * p_node, onvif_EventCapabilities * p_res); +BOOL parse_ImageCapabilities(XMLN * p_node, onvif_ImagingCapabilities * p_res); +BOOL parse_MediaCapabilities(XMLN * p_node, onvif_MediaCapabilities * p_res); +BOOL parse_PTZCapabilities(XMLN * p_node, onvif_PTZCapabilities * p_res); +BOOL parse_DeviceIOCapabilities(XMLN * p_node, onvif_DeviceIOCapabilities * p_res); +BOOL parse_RecordingCapabilities(XMLN * p_node, onvif_RecordingCapabilities * p_res); +BOOL parse_SearchCapabilities(XMLN * p_node, onvif_SearchCapabilities * p_res); +BOOL parse_ReplayCapabilities(XMLN * p_node, onvif_ReplayCapabilities * p_res); +BOOL parse_Version(XMLN * p_node, onvif_Version * p_res); +BOOL parse_DeviceServiceCapabilities(XMLN * p_node, onvif_DevicesCapabilities * p_res); +BOOL parse_DeviceService(XMLN * p_node, onvif_DevicesCapabilities * p_res); +BOOL parse_MediaServiceCapabilities(XMLN * p_node, onvif_MediaCapabilities * p_res); +BOOL parse_MediaService(XMLN * p_node, onvif_MediaCapabilities * p_res); +BOOL parse_Media2ServiceCapabilities(XMLN * p_node, onvif_MediaCapabilities2 * p_res); +BOOL parse_Media2Service(XMLN * p_node, onvif_MediaCapabilities2 * p_res); +BOOL parse_EventServiceCapabilities(XMLN * p_node, onvif_EventCapabilities * p_res); +BOOL parse_EventsService(XMLN * p_node, onvif_EventCapabilities * p_res); +BOOL parse_PTZServiceCapabilities(XMLN * p_node, onvif_PTZCapabilities * p_res); +BOOL parse_PTZService(XMLN * p_node, onvif_PTZCapabilities * p_res); +BOOL parse_ImagingServiceCapabilities(XMLN * p_node, onvif_ImagingCapabilities * p_res); +BOOL parse_ImagingService(XMLN * p_node, onvif_ImagingCapabilities * p_res); +BOOL parse_AnalyticsServiceCapabilities(XMLN * p_node, onvif_AnalyticsCapabilities * p_res); +BOOL parse_AnalyticsService(XMLN * p_node, onvif_AnalyticsCapabilities * p_res); +BOOL parse_VideoSourceConfiguration(XMLN * p_node, onvif_VideoSourceConfiguration * p_res); +BOOL parse_AudioSourceConfiguration(XMLN * p_node, onvif_AudioSourceConfiguration * p_res); +BOOL parse_MulticastConfiguration(XMLN * p_node, onvif_MulticastConfiguration * p_res); +BOOL parse_VideoResolution(XMLN * p_node, onvif_VideoResolution * p_res); +BOOL parse_ImagingSettings(XMLN * p_node, onvif_ImagingSettings * p_res); +BOOL parse_VideoSource(XMLN * p_node, onvif_VideoSource * p_res); +BOOL parse_AudioSource(XMLN * p_node, onvif_AudioSource * p_res); +BOOL parse_SimpleItem(XMLN * p_node, onvif_SimpleItem * p_res); +BOOL parse_ElementItem(XMLN * p_node, onvif_ElementItem * p_res); +BOOL parse_ItemList(XMLN * p_node, onvif_ItemList * p_res); +BOOL parse_Config(XMLN * p_node, onvif_Config * p_res); +BOOL parse_VideoEncoderConfiguration(XMLN * p_node, onvif_VideoEncoderConfiguration * p_res); +BOOL parse_AudioEncoderConfiguration(XMLN * p_node, onvif_AudioEncoderConfiguration * p_res); +BOOL parse_PTZConfiguration(XMLN * p_node, onvif_PTZConfiguration * p_res); +BOOL parse_AnalyticsEngineConfiguration(XMLN * p_node, onvif_AnalyticsEngineConfiguration * p_res); +BOOL parse_RuleEngineConfiguration(XMLN * p_node, onvif_RuleEngineConfiguration * p_res); +BOOL parse_VideoAnalyticsConfiguration(XMLN * p_node, onvif_VideoAnalyticsConfiguration * p_res); +BOOL parse_Profile(XMLN * p_node, ONVIF_PROFILE * p_profile); +BOOL parse_Dot11Configuration(XMLN * p_node, onvif_Dot11Configuration * p_res); +BOOL parse_NetworkInterface(XMLN * p_node, onvif_NetworkInterface * p_res); +BOOL parse_User(XMLN * p_node, onvif_User * p_res); +BOOL parse_Datetime(XMLN * p_node, onvif_DateTime * p_datetime); +BOOL parse_Dot11AvailableNetworks(XMLN * p_node, onvif_Dot11AvailableNetworks * p_res); +BOOL parse_LocationEntity(XMLN * p_node, onvif_LocationEntity * p_res); +BOOL parse_PrefixedIPAddress(XMLN * p_node, onvif_PrefixedIPAddress * p_res); +BOOL parse_IPAddressFilter(XMLN * p_node, onvif_IPAddressFilter * p_res); +BOOL parse_UserCredential(XMLN * p_node, onvif_UserCredential * p_res); +BOOL parse_StorageConfigurationData(XMLN * p_node, onvif_StorageConfigurationData * p_res); +BOOL parse_StorageConfiguration(XMLN * p_node, onvif_StorageConfiguration * p_res); +BOOL parse_RelayOutputSettings(XMLN * p_node, onvif_RelayOutputSettings * p_res); + +BOOL parse_tds_GetCapabilities(XMLN * p_node, tds_GetCapabilities_RES * p_res); +BOOL parse_tds_GetServices(XMLN * p_node, tds_GetServices_RES * p_res); +BOOL parse_tds_GetServiceCapabilities(XMLN * p_node, tds_GetServiceCapabilities_RES * p_res); +BOOL parse_tds_GetDeviceInformation(XMLN * p_node, tds_GetDeviceInformation_RES * p_res); +BOOL parse_tds_GetUsers(XMLN * p_node, tds_GetUsers_RES * p_res); +BOOL parse_tds_GetRemoteUser(XMLN * p_node, tds_GetRemoteUser_RES * p_res); +BOOL parse_tds_GetNetworkInterfaces(XMLN * p_node, tds_GetNetworkInterfaces_RES * p_res); +BOOL parse_tds_SetNetworkInterfaces(XMLN * p_node, tds_SetNetworkInterfaces_RES * p_res); +BOOL parse_tds_GetNTP(XMLN * p_node, tds_GetNTP_RES * p_res); +BOOL parse_tds_GetHostname(XMLN * p_node, tds_GetHostname_RES * p_res); +BOOL parse_tds_SetHostnameFromDHCP(XMLN * p_node, tds_SetHostnameFromDHCP_RES * p_res); +BOOL parse_tds_GetDNS(XMLN * p_node, tds_GetDNS_RES * p_res); +BOOL parse_tds_GetDynamicDNS(XMLN * p_node, tds_GetDynamicDNS_RES * p_res); +BOOL parse_tds_GetNetworkProtocols(XMLN * p_node, tds_GetNetworkProtocols_RES * p_res); +BOOL parse_tds_GetDiscoveryMode(XMLN * p_node, tds_GetDiscoveryMode_RES * p_res); +BOOL parse_tds_GetNetworkDefaultGateway(XMLN * p_node, tds_GetNetworkDefaultGateway_RES * p_res); +BOOL parse_tds_GetZeroConfiguration(XMLN * p_node, tds_GetZeroConfiguration_RES * p_res); +BOOL parse_tds_GetEndpointReference(XMLN * p_node, tds_GetEndpointReference_RES * p_res); +BOOL parse_tds_SendAuxiliaryCommand(XMLN * p_node, tds_SendAuxiliaryCommand_RES * p_res); +BOOL parse_tds_GetRelayOutputs(XMLN * p_node, tds_GetRelayOutputs_RES * p_res); +BOOL parse_tds_GetSystemDateAndTime(XMLN * p_node, tds_GetSystemDateAndTime_RES * p_res); +BOOL parse_tds_GetSystemLog(XMLN * p_node, tds_GetSystemLog_RES * p_res); +BOOL parse_tds_GetScopes(XMLN * p_node, tds_GetScopes_RES * p_res); +BOOL parse_tds_StartFirmwareUpgrade(XMLN * p_node, tds_StartFirmwareUpgrade_RES * p_res); +BOOL parse_tds_GetSystemUris(XMLN * p_node, tds_GetSystemUris_RES * p_res); +BOOL parse_tds_StartSystemRestore(XMLN * p_node, tds_StartSystemRestore_RES * p_res); +BOOL parse_tds_GetWsdlUrl(XMLN * p_node, tds_GetWsdlUrl_RES * p_res); +BOOL parse_tds_GetDot11Capabilities(XMLN * p_node, tds_GetDot11Capabilities_RES * p_res); +BOOL parse_tds_GetDot11Status(XMLN * p_node, tds_GetDot11Status_RES * p_res); +BOOL parse_tds_ScanAvailableDot11Networks(XMLN * p_node, tds_ScanAvailableDot11Networks_RES * p_res); +BOOL parse_tds_GetGeoLocation(XMLN * p_node, tds_GetGeoLocation_RES * p_res); +BOOL parse_tds_GetIPAddressFilter(XMLN * p_node, tds_GetIPAddressFilter_RES * p_res); +BOOL parse_tds_GetAccessPolicy(XMLN * p_node, tds_GetAccessPolicy_RES * p_res); +BOOL parse_tds_GetStorageConfigurations(XMLN * p_node, tds_GetStorageConfigurations_RES * p_res); +BOOL parse_tds_CreateStorageConfiguration(XMLN * p_node, tds_CreateStorageConfiguration_RES * p_res); +BOOL parse_tds_GetStorageConfiguration(XMLN * p_node, tds_GetStorageConfiguration_RES * p_res); + +BOOL parse_JPEGOptions(XMLN * p_node, onvif_JpegOptions * p_res); +BOOL parse_MPEG4Options(XMLN * p_node, onvif_Mpeg4Options * p_res); +BOOL parse_H264Options(XMLN * p_node, onvif_H264Options * p_res); +BOOL parse_AudioOutputConfiguration(XMLN * p_node, onvif_AudioOutputConfiguration * p_res); +BOOL parse_AudioDecoderConfiguration(XMLN * p_node, onvif_AudioDecoderConfiguration * p_res); +BOOL parse_VideoSourceMode(XMLN * p_node, onvif_VideoSourceMode * p_res); +BOOL parse_Color(XMLN * p_node, onvif_Color * p_res); +BOOL parse_ColorOptions(XMLN * p_node, onvif_ColorOptions * p_res); +BOOL parse_OSDColorOptions(XMLN * p_node, onvif_OSDColorOptions * p_res); +BOOL parse_OSDOptions(XMLN * p_node, onvif_OSDConfigurationOptions * p_res); +BOOL parse_OSDColor(XMLN * p_node, onvif_OSDColor * p_res); +BOOL parse_OSDConfiguration(XMLN * p_node, onvif_OSDConfiguration * p_res); + +BOOL parse_trt_GetServiceCapabilities(XMLN * p_node, trt_GetServiceCapabilities_RES * p_res); +BOOL parse_trt_GetVideoSources(XMLN * p_node, trt_GetVideoSources_RES * p_res); +BOOL parse_trt_GetAudioSources(XMLN * p_node, trt_GetAudioSources_RES * p_res); +BOOL parse_trt_CreateProfile(XMLN * p_node, trt_CreateProfile_RES * p_res); +BOOL parse_trt_GetProfile(XMLN * p_node, trt_GetProfile_RES * p_res); +BOOL parse_trt_GetProfiles(XMLN * p_node, trt_GetProfiles_RES * p_res); +BOOL parse_trt_GetVideoSourceModes(XMLN * p_node, trt_GetVideoSourceModes_RES * p_res); +BOOL parse_trt_SetVideoSourceMode(XMLN * p_node, trt_SetVideoSourceMode_RES * p_res); +BOOL parse_trt_GetVideoSourceConfigurations(XMLN * p_node, trt_GetVideoSourceConfigurations_RES * p_res); +BOOL parse_trt_GetVideoEncoderConfigurations(XMLN * p_node, trt_GetVideoEncoderConfigurations_RES * p_res); +BOOL parse_trt_GetAudioSourceConfigurations(XMLN * p_node, trt_GetAudioSourceConfigurations_RES * p_res); +BOOL parse_trt_GetAudioEncoderConfigurations(XMLN * p_node, trt_GetAudioEncoderConfigurations_RES * p_res); +BOOL parse_trt_GetVideoSourceConfiguration(XMLN * p_node, trt_GetVideoSourceConfiguration_RES * p_res); +BOOL parse_trt_GetVideoEncoderConfiguration(XMLN * p_node, trt_GetVideoEncoderConfiguration_RES * p_res); +BOOL parse_trt_GetAudioSourceConfiguration(XMLN * p_node, trt_GetAudioSourceConfiguration_RES * p_res); +BOOL parse_trt_GetAudioEncoderConfiguration(XMLN * p_node, trt_GetAudioEncoderConfiguration_RES * p_res); +BOOL parse_trt_GetVideoSourceConfigurationOptions(XMLN * p_node, trt_GetVideoSourceConfigurationOptions_RES * p_res); +BOOL parse_trt_GetVideoEncoderConfigurationOptions(XMLN * p_node, trt_GetVideoEncoderConfigurationOptions_RES * p_res); +BOOL parse_trt_GetAudioEncoderConfigurationOptions(XMLN * p_node, trt_GetAudioEncoderConfigurationOptions_RES * p_res); +BOOL parse_trt_GetStreamUri(XMLN * p_node, trt_GetStreamUri_RES * p_res); +BOOL parse_trt_GetSnapshotUri(XMLN * p_node, trt_GetSnapshotUri_RES * p_res); +BOOL parse_trt_GetGuaranteedNumberOfVideoEncoderInstances(XMLN * p_node, trt_GetGuaranteedNumberOfVideoEncoderInstances_RES * p_res); +BOOL parse_trt_GetAudioOutputs(XMLN * p_node, trt_GetAudioOutputs_RES * p_res); +BOOL parse_trt_GetAudioOutputConfigurations(XMLN * p_node, trt_GetAudioOutputConfigurations_RES * p_res); +BOOL parse_trt_GetAudioOutputConfiguration(XMLN * p_node, trt_GetAudioOutputConfiguration_RES * p_res); +BOOL parse_trt_GetAudioOutputConfigurationOptions(XMLN * p_node, trt_GetAudioOutputConfigurationOptions_RES * p_res); +BOOL parse_trt_GetAudioDecoderConfigurations(XMLN * p_node, trt_GetAudioDecoderConfigurations_RES * p_res); +BOOL parse_trt_GetAudioDecoderConfiguration(XMLN * p_node, trt_GetAudioDecoderConfiguration_RES * p_res); +BOOL parse_trt_GetAudioDecoderConfigurationOptions(XMLN * p_node, trt_GetAudioDecoderConfigurationOptions_RES * p_res); +BOOL parse_trt_GetOSDs(XMLN * p_node, trt_GetOSDs_RES * p_res); +BOOL parse_trt_GetOSD(XMLN * p_node, trt_GetOSD_RES * p_res); +BOOL parse_trt_GetOSDOptions(XMLN * p_node, trt_GetOSDOptions_RES * p_res); +BOOL parse_trt_CreateOSD(XMLN * p_node, trt_CreateOSD_RES * p_res); +BOOL parse_trt_GetVideoAnalyticsConfigurations(XMLN * p_node, trt_GetVideoAnalyticsConfigurations_RES * p_res); +BOOL parse_trt_GetVideoAnalyticsConfiguration(XMLN * p_node, trt_GetVideoAnalyticsConfiguration_RES * p_res); +BOOL parse_trt_GetMetadataConfigurations(XMLN * p_node, trt_GetMetadataConfigurations_RES * p_res); +BOOL parse_trt_GetMetadataConfiguration(XMLN * p_node, trt_GetMetadataConfiguration_RES * p_res); +BOOL parse_trt_GetMetadataConfigurationOptions(XMLN * p_node, trt_GetMetadataConfigurationOptions_RES * p_res); +BOOL parse_trt_GetCompatibleVideoEncoderConfigurations(XMLN * p_node, trt_GetCompatibleVideoEncoderConfigurations_RES * p_res); +BOOL parse_trt_GetCompatibleAudioEncoderConfigurations(XMLN * p_node, trt_GetCompatibleAudioEncoderConfigurations_RES * p_res); +BOOL parse_trt_GetCompatibleVideoAnalyticsConfigurations(XMLN * p_node, trt_GetCompatibleVideoAnalyticsConfigurations_RES * p_res); +BOOL parse_trt_GetCompatibleMetadataConfigurations(XMLN * p_node, trt_GetCompatibleMetadataConfigurations_RES * p_res); + +BOOL parse_Space2DDescription(XMLN * p_node, onvif_Space2DDescription * p_res); +BOOL parse_Space1DDescription(XMLN * p_node, onvif_Space1DDescription * p_res); +BOOL parse_PTZNode(XMLN * p_node, onvif_PTZNode * p_res); +BOOL parse_Preset(XMLN * p_node, onvif_PTZPreset * p_res); +BOOL parse_PTZPresetTourSpot(XMLN * p_node, onvif_PTZPresetTourSpot * p_res); +BOOL parse_PTZPresetTourStatus(XMLN * p_node, onvif_PTZPresetTourStatus * p_res); +BOOL parse_PTZPresetTourStartingCondition(XMLN * p_node, onvif_PTZPresetTourStartingCondition * p_res); +BOOL parse_PresetTour(XMLN * p_node, onvif_PresetTour * p_res); +BOOL parse_DurationRange(XMLN * p_node, onvif_DurationRange * p_res); + +BOOL parse_ptz_GetServiceCapabilities(XMLN * p_node, ptz_GetServiceCapabilities_RES * p_res); +BOOL parse_ptz_GetNodes(XMLN * p_node, ptz_GetNodes_RES * p_res); +BOOL parse_ptz_GetNode(XMLN * p_node, ptz_GetNode_RES * p_res); +BOOL parse_ptz_GetPresets(XMLN * p_node, ptz_GetPresets_RES * p_res); +BOOL parse_ptz_SetPreset(XMLN * p_node, ptz_SetPreset_RES * p_res); +BOOL parse_ptz_GetStatus(XMLN * p_node, ptz_GetStatus_RES * p_res); +BOOL parse_ptz_GetConfigurations(XMLN * p_node, ptz_GetConfigurations_RES * p_res); +BOOL parse_ptz_GetConfiguration(XMLN * p_node, ptz_GetConfiguration_RES * p_res); +BOOL parse_ptz_GetConfigurationOptions(XMLN * p_node, ptz_GetConfigurationOptions_RES * p_res); +BOOL parse_ptz_GetPresetTours(XMLN * p_node, ptz_GetPresetTours_RES * p_res); +BOOL parse_ptz_GetPresetTour(XMLN * p_node, ptz_GetPresetTour_RES * p_res); +BOOL parse_ptz_GetPresetTourOptions(XMLN * p_node, ptz_GetPresetTourOptions_RES * p_res); +BOOL parse_ptz_CreatePresetTour(XMLN * p_node, ptz_CreatePresetTour_RES * p_res); +BOOL parse_ptz_SendAuxiliaryCommand(XMLN * p_node, ptz_SendAuxiliaryCommand_RES * p_res); + +BOOL parse_NotificationMessage(XMLN * p_node, onvif_NotificationMessage * p_res); +BOOL parse_NotifyMessage(XMLN * p_node, NotificationMessageList ** p_res); +BOOL parse_tev_GetServiceCapabilities(XMLN * p_node, tev_GetServiceCapabilities_RES * p_res); +BOOL parse_tev_GetEventProperties(XMLN * p_node, tev_GetEventProperties_RES * p_res); +BOOL parse_tev_Subscribe(XMLN * p_node, tev_Subscribe_RES * p_res); +BOOL parse_tev_CreatePullPointSubscription(XMLN * p_node, tev_CreatePullPointSubscription_RES * p_res); +BOOL parse_tev_PullMessages(XMLN * p_node, tev_PullMessages_RES * p_res); +BOOL parse_tev_GetMessages(XMLN * p_node, tev_GetMessages_RES * p_res); + +BOOL parse_ImagingPreset(XMLN * p_node, onvif_ImagingPreset * p_res); +BOOL parse_img_GetServiceCapabilities(XMLN * p_node, img_GetServiceCapabilities_RES * p_res); +BOOL parse_img_GetImagingSettings(XMLN * p_node, img_GetImagingSettings_RES * p_res); +BOOL parse_img_GetOptions(XMLN * p_node, img_GetOptions_RES * p_res); +BOOL parse_img_GetStatus(XMLN * p_node, img_GetStatus_RES * p_res); +BOOL parse_img_GetMoveOptions(XMLN * p_node, img_GetMoveOptions_RES * p_res); +BOOL parse_img_GetPresets(XMLN * p_node, img_GetPresets_RES * p_res); +BOOL parse_img_GetCurrentPreset(XMLN * p_node, img_GetCurrentPreset_RES * p_res); + +int parse_SimpleItemDescriptions(XMLN * p_node, const char * name, SimpleItemDescriptionList * p_res); +BOOL parse_ItemListDescription(XMLN * p_node, onvif_ItemListDescription * p_res); +BOOL parse_ConfigDescription_Messages(XMLN * p_node, onvif_ConfigDescription_Messages * p_res); +BOOL parse_RuleDescription(XMLN * p_node, onvif_ConfigDescription * p_res); +BOOL parse_ConfigDescription(XMLN * p_node, onvif_ConfigDescription * p_res); +BOOL parse_ConfigOptions(XMLN * p_node, onvif_ConfigOptions * p_res); +BOOL parse_AnalyticsModuleConfigOptions(XMLN * p_node, onvif_AnalyticsModuleConfigOptions * p_res); +BOOL parse_tan_GetServiceCapabilities(XMLN * p_node, tan_GetServiceCapabilities_RES * p_res); +BOOL parse_tan_GetSupportedRules(XMLN * p_node, tan_GetSupportedRules_RES * p_res); +BOOL parse_tan_GetRules(XMLN * p_node, tan_GetRules_RES * p_res); +BOOL parse_tan_GetAnalyticsModules(XMLN * p_node, tan_GetAnalyticsModules_RES * p_res); +BOOL parse_tan_GetSupportedAnalyticsModules(XMLN * p_node, tan_GetSupportedAnalyticsModules_RES * p_res); +BOOL parse_tan_GetRuleOptions(XMLN * p_node, tan_GetRuleOptions_RES * p_res); +BOOL parse_tan_GetAnalyticsModuleOptions(XMLN * p_node, tan_GetAnalyticsModuleOptions_RES * p_res); +BOOL parse_tan_GetSupportedMetadata(XMLN * p_node, tan_GetSupportedMetadata_RES * p_res); + +BOOL parse_VideoEncoder2Configuration(XMLN * p_node, onvif_VideoEncoder2Configuration * p_res); +BOOL parse_VideoEncoder2ConfigurationOptions(XMLN * p_node, onvif_VideoEncoder2ConfigurationOptions * p_res); +BOOL parse_MetadataConfiguration(XMLN * p_node, onvif_MetadataConfiguration * p_res); +BOOL parse_AudioEncoder2Configuration(XMLN * p_node, onvif_AudioEncoder2Configuration * p_res); +BOOL parse_AudioEncoder2ConfigurationOptions(XMLN * p_node, onvif_AudioEncoder2ConfigurationOptions * p_res); +BOOL parse_MediaProfile(XMLN * p_node, onvif_MediaProfile * p_res); +BOOL parse_Polygon(XMLN * p_node, onvif_Polygon * p_res); +BOOL parse_Mask(XMLN * p_node, onvif_Mask * p_res); +BOOL parse_MaskOptions(XMLN * p_node, onvif_MaskOptions * p_res); + +BOOL parse_tr2_GetServiceCapabilities(XMLN * p_node, tr2_GetServiceCapabilities_RES * p_res); +BOOL parse_tr2_GetVideoEncoderConfigurations(XMLN * p_node, tr2_GetVideoEncoderConfigurations_RES * p_res); +BOOL parse_tr2_GetVideoEncoderConfigurationOptions(XMLN * p_node, tr2_GetVideoEncoderConfigurationOptions_RES * p_res); +BOOL parse_tr2_GetProfiles(XMLN * p_node, tr2_GetProfiles_RES * p_res); +BOOL parse_tr2_CreateProfile(XMLN * p_node, tr2_CreateProfile_RES * p_res); +BOOL parse_tr2_GetStreamUri(XMLN * p_node, tr2_GetStreamUri_RES * p_res); +BOOL parse_tr2_GetVideoSourceConfigurations(XMLN * p_node, tr2_GetVideoSourceConfigurations_RES * p_res); +BOOL parse_tr2_GetMetadataConfigurations(XMLN * p_node, tr2_GetMetadataConfigurations_RES * p_res); +BOOL parse_tr2_GetMetadataConfigurationOptions(XMLN * p_node, tr2_GetMetadataConfigurationOptions_RES * p_res); +BOOL parse_tr2_GetAudioEncoderConfigurations(XMLN * p_node, tr2_GetAudioEncoderConfigurations_RES * p_res); +BOOL parse_tr2_GetAudioSourceConfigurations(XMLN * p_node, tr2_GetAudioSourceConfigurations_RES * p_res); +BOOL parse_tr2_GetAudioEncoderConfigurationOptions(XMLN * p_node, tr2_GetAudioEncoderConfigurationOptions_RES * p_res); +BOOL parse_tr2_GetVideoEncoderInstances(XMLN * p_node, tr2_GetVideoEncoderInstances_RES * p_res); +BOOL parse_tr2_GetAudioOutputConfigurations(XMLN * p_node, tr2_GetAudioOutputConfigurations_RES * p_res); +BOOL parse_tr2_GetAudioOutputConfigurationOptions(XMLN * p_node, tr2_GetAudioOutputConfigurationOptions_RES * p_res); +BOOL parse_tr2_GetAudioDecoderConfigurations(XMLN * p_node, tr2_GetAudioDecoderConfigurations_RES * p_res); +BOOL parse_tr2_GetAudioDecoderConfigurationOptions(XMLN * p_node, tr2_GetAudioDecoderConfigurationOptions_RES * p_res); +BOOL parse_tr2_GetSnapshotUri(XMLN * p_node, tr2_GetSnapshotUri_RES * p_res); +BOOL parse_tr2_GetVideoSourceModes(XMLN * p_node, tr2_GetVideoSourceModes_RES * p_res); +BOOL parse_tr2_SetVideoSourceMode(XMLN * p_node, tr2_SetVideoSourceMode_RES * p_res); +BOOL parse_tr2_CreateOSD(XMLN * p_node, tr2_CreateOSD_RES * p_res); +BOOL parse_tr2_GetOSDs(XMLN * p_node, tr2_GetOSDs_RES * p_res); +BOOL parse_tr2_GetOSDOptions(XMLN * p_node, tr2_GetOSDOptions_RES * p_res); +BOOL parse_tr2_GetAnalyticsConfigurations(XMLN * p_node, tr2_GetAnalyticsConfigurations_RES * p_res); +BOOL parse_tr2_GetMasks(XMLN * p_node, tr2_GetMasks_RES * p_res); +BOOL parse_tr2_CreateMask(XMLN * p_node, tr2_CreateMask_RES * p_res); +BOOL parse_tr2_GetMaskOptions(XMLN * p_node, tr2_GetMaskOptions_RES * p_res); + +BOOL parse_DeviceIOServiceCapabilities(XMLN * p_node, onvif_DeviceIOCapabilities * p_res); +BOOL parse_DeviceIOService(XMLN * p_node, onvif_DeviceIOCapabilities * p_res); +BOOL parse_RelayOutput(XMLN * p_node, onvif_RelayOutput * p_res); +BOOL parse_RelayOutputOptions(XMLN * p_node, onvif_RelayOutputOptions * p_res); +BOOL parse_DigitalInput(XMLN * p_node, onvif_DigitalInput * p_res); +BOOL parse_tmd_GetServiceCapabilities(XMLN * p_node, tmd_GetServiceCapabilities_RES * p_res); +BOOL parse_tmd_GetRelayOutputs(XMLN * p_node, tmd_GetRelayOutputs_RES * p_res); +BOOL parse_tmd_GetRelayOutputOptions(XMLN * p_node, tmd_GetRelayOutputOptions_RES * p_res); +BOOL parse_tmd_GetDigitalInputs(XMLN * p_node, tmd_GetDigitalInputs_RES * p_res); +BOOL parse_tmd_GetDigitalInputConfigurationOptions(XMLN * p_node, tmd_GetDigitalInputConfigurationOptions_RES * p_res); + +BOOL parse_RecordingServiceCapabilities(XMLN * p_node, onvif_RecordingCapabilities * p_res); +BOOL parse_RecordingService(XMLN * p_node, onvif_RecordingCapabilities * p_res); +BOOL parse_SearchServiceCapabilities(XMLN * p_node, onvif_SearchCapabilities * p_res); +BOOL parse_SearchService(XMLN * p_node, onvif_SearchCapabilities * p_res); +BOOL parse_ReplayServiceCapabilities(XMLN * p_node, onvif_ReplayCapabilities * p_res); +BOOL parse_ReplayService(XMLN * p_node, onvif_ReplayCapabilities * p_res); +BOOL parse_trc_GetServiceCapabilities(XMLN * p_node, trc_GetServiceCapabilities_RES * p_res); +BOOL parse_trc_CreateRecording(XMLN * p_node, trc_CreateRecording_RES * p_res); +BOOL parse_trc_GetRecordings(XMLN * p_node, trc_GetRecordings_RES * p_res); +BOOL parse_trc_GetRecordingConfiguration(XMLN * p_node, trc_GetRecordingConfiguration_RES * p_res); +BOOL parse_trc_GetRecordingOptions(XMLN * p_node, trc_GetRecordingOptions_RES * p_res); +BOOL parse_trc_CreateTrack(XMLN * p_node, trc_CreateTrack_RES * p_res); +BOOL parse_trc_GetTrackConfiguration(XMLN * p_node, trc_GetTrackConfiguration_RES * p_res); +BOOL parse_trc_CreateRecordingJob(XMLN * p_node, trc_CreateRecordingJob_RES * p_res); +BOOL parse_trc_GetRecordingJobs(XMLN * p_node, trc_GetRecordingJobs_RES * p_res); +BOOL parse_trc_SetRecordingJobConfiguration(XMLN * p_node, trc_SetRecordingJobConfiguration_RES * p_res); +BOOL parse_trc_GetRecordingJobConfiguration(XMLN * p_node, trc_GetRecordingJobConfiguration_RES * p_res); +BOOL parse_trc_GetRecordingJobState(XMLN * p_node, trc_GetRecordingJobState_RES * p_res); +BOOL parse_trc_ExportRecordedData(XMLN * p_node, trc_ExportRecordedData_RES * p_res); +BOOL parse_trc_StopExportRecordedData(XMLN * p_node, trc_StopExportRecordedData_RES * p_res); +BOOL parse_trc_GetExportRecordedDataState(XMLN * p_node, trc_GetExportRecordedDataState_RES * p_res); +BOOL parse_trp_GetServiceCapabilities(XMLN * p_node, trp_GetServiceCapabilities_RES * p_res); +BOOL parse_trp_GetReplayUri(XMLN * p_node, trp_GetReplayUri_RES * p_res); +BOOL parse_trp_GetReplayConfiguration(XMLN * p_node, trp_GetReplayConfiguration_RES * p_res); +BOOL parse_tse_GetServiceCapabilities(XMLN * p_node, tse_GetServiceCapabilities_RES * p_res); +BOOL parse_tse_GetRecordingSummary(XMLN * p_node, tse_GetRecordingSummary_RES * p_res); +BOOL parse_tse_GetRecordingInformation(XMLN * p_node, tse_GetRecordingInformation_RES * p_res); +BOOL parse_tse_GetMediaAttributes(XMLN * p_node, tse_GetMediaAttributes_RES * p_res); +BOOL parse_tse_FindRecordings(XMLN * p_node, tse_FindRecordings_RES * p_res); +BOOL parse_tse_GetRecordingSearchResults(XMLN * p_node, tse_GetRecordingSearchResults_RES * p_res); +BOOL parse_tse_FindEvents(XMLN * p_node, tse_FindEvents_RES * p_res); +BOOL parse_tse_GetEventSearchResults(XMLN * p_node, tse_GetEventSearchResults_RES * p_res); +BOOL parse_tse_FindMetadata(XMLN * p_node, tse_FindMetadata_RES * p_res); +BOOL parse_tse_GetMetadataSearchResults(XMLN * p_node, tse_GetMetadataSearchResults_RES * p_res); +BOOL parse_tse_FindPTZPosition(XMLN * p_node, tse_FindPTZPosition_RES * p_res); +BOOL parse_tse_GetPTZPositionSearchResults(XMLN * p_node, tse_GetPTZPositionSearchResults_RES * p_res); +BOOL parse_tse_GetSearchState(XMLN * p_node, tse_GetSearchState_RES * p_res); +BOOL parse_tse_EndSearch(XMLN * p_node, tse_EndSearch_RES * p_res); + +BOOL parse_AccessControlServiceCapabilities(XMLN * p_node, onvif_AccessControlCapabilities * p_res); +BOOL parse_AccessControlService(XMLN * p_node, onvif_AccessControlCapabilities * p_res); +BOOL parse_DoorControlServiceCapabilities(XMLN * p_node, onvif_DoorControlCapabilities * p_res); +BOOL parse_DoorControlService(XMLN * p_node, onvif_DoorControlCapabilities * p_res); +BOOL parse_tac_GetServiceCapabilities(XMLN * p_node, tac_GetServiceCapabilities_RES * p_res); +BOOL parse_tac_GetAccessPointInfoList(XMLN * p_node, tac_GetAccessPointInfoList_RES * p_res); +BOOL parse_tac_GetAccessPointInfo(XMLN * p_node, tac_GetAccessPointInfo_RES * p_res); +BOOL parse_tac_GetAccessPointList(XMLN * p_node, tac_GetAccessPointList_RES * p_res); +BOOL parse_tac_GetAccessPoints(XMLN * p_node, tac_GetAccessPoints_RES * p_res); +BOOL parse_tac_CreateAccessPoint(XMLN * p_node, tac_CreateAccessPoint_RES * p_res); +BOOL parse_tac_GetAreaInfoList(XMLN * p_node, tac_GetAreaInfoList_RES * p_res); +BOOL parse_tac_GetAreaInfo(XMLN * p_node, tac_GetAreaInfo_RES * p_res); +BOOL parse_tac_GetAreaList(XMLN * p_node, tac_GetAreaList_RES * p_res); +BOOL parse_tac_GetAreas(XMLN * p_node, tac_GetAreas_RES * p_res); +BOOL parse_tac_CreateArea(XMLN * p_node, tac_CreateArea_RES * p_res); +BOOL parse_tac_GetAccessPointState(XMLN * p_node, tac_GetAccessPointState_RES * p_res); +BOOL parse_tdc_GetServiceCapabilities(XMLN * p_node, tdc_GetServiceCapabilities_RES * p_res); +BOOL parse_tdc_GetDoorInfoList(XMLN * p_node, tdc_GetDoorInfoList_RES * p_res); +BOOL parse_tdc_GetDoorInfo(XMLN * p_node, tdc_GetDoorInfo_RES * p_res); +BOOL parse_tdc_GetDoorState(XMLN * p_node, tdc_GetDoorState_RES * p_res); +BOOL parse_tdc_GetDoors(XMLN * p_node, tdc_GetDoors_RES * p_res); +BOOL parse_tdc_GetDoorList(XMLN * p_node, tdc_GetDoorList_RES * p_res); +BOOL parse_tdc_CreateDoor(XMLN * p_node, tdc_CreateDoor_RES * p_res); + +BOOL parse_ThermalServiceCapabilities(XMLN * p_node, onvif_ThermalCapabilities * p_res); +BOOL parse_ThermalService(XMLN * p_node, onvif_ThermalCapabilities * p_res); +BOOL parse_tth_GetServiceCapabilities(XMLN * p_node, tth_GetServiceCapabilities_RES * p_res); +BOOL parse_tth_GetConfigurations(XMLN * p_node, tth_GetConfigurations_RES * p_req); +BOOL parse_tth_GetConfiguration(XMLN * p_node, tth_GetConfiguration_RES * p_req); +BOOL parse_tth_GetConfigurationOptions(XMLN * p_node, tth_GetConfigurationOptions_RES * p_req); +BOOL parse_tth_GetRadiometryConfiguration(XMLN * p_node, tth_GetRadiometryConfiguration_RES * p_req); +BOOL parse_tth_GetRadiometryConfigurationOptions(XMLN * p_node, tth_GetRadiometryConfigurationOptions_RES * p_req); + +BOOL parse_CredentialServiceCapabilities(XMLN * p_node, onvif_CredentialCapabilities * p_res); +BOOL parse_CredentialService(XMLN * p_node, onvif_CredentialCapabilities * p_res); +BOOL parse_tcr_GetServiceCapabilities(XMLN * p_node, tcr_GetServiceCapabilities_RES * p_res); +BOOL parse_tcr_GetCredentialInfo(XMLN * p_node, tcr_GetCredentialInfo_RES * p_res); +BOOL parse_tcr_GetCredentialInfoList(XMLN * p_node, tcr_GetCredentialInfoList_RES * p_res); +BOOL parse_tcr_GetCredentials(XMLN * p_node, tcr_GetCredentials_RES * p_res); +BOOL parse_tcr_GetCredentialList(XMLN * p_node, tcr_GetCredentialList_RES * p_res); +BOOL parse_tcr_CreateCredential(XMLN * p_node, tcr_CreateCredential_RES * p_res); +BOOL parse_tcr_GetCredentialState(XMLN * p_node, tcr_GetCredentialState_RES * p_res); +BOOL parse_tcr_GetSupportedFormatTypes(XMLN * p_node, tcr_GetSupportedFormatTypes_RES * p_res); +BOOL parse_tcr_GetCredentialIdentifiers(XMLN * p_node, tcr_GetCredentialIdentifiers_RES * p_res); +BOOL parse_tcr_GetCredentialAccessProfiles(XMLN * p_node, tcr_GetCredentialAccessProfiles_RES * p_res); + +BOOL parse_AccessRulesServiceCapabilities(XMLN * p_node, onvif_AccessRulesCapabilities * p_res); +BOOL parse_AccessRulesService(XMLN * p_node, onvif_AccessRulesCapabilities * p_res); +BOOL parse_tar_GetServiceCapabilities(XMLN * p_node, tar_GetServiceCapabilities_RES * p_res); +BOOL parse_tar_GetAccessProfileInfo(XMLN * p_node, tar_GetAccessProfileInfo_RES * p_res); +BOOL parse_tar_GetAccessProfileInfoList(XMLN * p_node, tar_GetAccessProfileInfoList_RES * p_res); +BOOL parse_tar_GetAccessProfiles(XMLN * p_node, tar_GetAccessProfiles_RES * p_res); +BOOL parse_tar_GetAccessProfileList(XMLN * p_node, tar_GetAccessProfileList_RES * p_res); +BOOL parse_tar_CreateAccessProfile(XMLN * p_node, tar_CreateAccessProfile_RES * p_res); + +BOOL parse_ScheduleServiceCapabilities(XMLN * p_node, onvif_ScheduleCapabilities * p_res); +BOOL parse_ScheduleService(XMLN * p_node, onvif_ScheduleCapabilities * p_res); +BOOL parse_tsc_GetServiceCapabilities(XMLN * p_node, tsc_GetServiceCapabilities_RES * p_res); +BOOL parse_tsc_GetScheduleInfo(XMLN * p_node, tsc_GetScheduleInfo_RES * p_res); +BOOL parse_tsc_GetScheduleInfoList(XMLN * p_node, tsc_GetScheduleInfoList_RES * p_res); +BOOL parse_tsc_GetSchedules(XMLN * p_node, tsc_GetSchedules_RES * p_res); +BOOL parse_tsc_GetScheduleList(XMLN * p_node, tsc_GetScheduleList_RES * p_res); +BOOL parse_tsc_CreateSchedule(XMLN * p_node, tsc_CreateSchedule_RES * p_res); +BOOL parse_tsc_GetSpecialDayGroupInfo(XMLN * p_node, tsc_GetSpecialDayGroupInfo_RES * p_res); +BOOL parse_tsc_GetSpecialDayGroupInfoList(XMLN * p_node, tsc_GetSpecialDayGroupInfoList_RES * p_res); +BOOL parse_tsc_GetSpecialDayGroups(XMLN * p_node, tsc_GetSpecialDayGroups_RES * p_res); +BOOL parse_tsc_GetSpecialDayGroupList(XMLN * p_node, tsc_GetSpecialDayGroupList_RES * p_res); +BOOL parse_tsc_CreateSpecialDayGroup(XMLN * p_node, tsc_CreateSpecialDayGroup_RES * p_res); +BOOL parse_tsc_GetScheduleState(XMLN * p_node, tsc_GetScheduleState_RES * p_res); + +BOOL parse_ReceiverServiceCapabilities(XMLN * p_node, onvif_ReceiverCapabilities * p_res); +BOOL parse_ReceiverService(XMLN * p_node, onvif_ReceiverCapabilities * p_res); +BOOL parse_trv_GetServiceCapabilities(XMLN * p_node, trv_GetServiceCapabilities_RES * p_res); +BOOL parse_trv_GetReceivers(XMLN * p_node, trv_GetReceivers_RES * p_res); +BOOL parse_trv_GetReceiver(XMLN * p_node, trv_GetReceiver_RES * p_res); +BOOL parse_trv_CreateReceiver(XMLN * p_node, trv_CreateReceiver_RES * p_res); +BOOL parse_trv_GetReceiverState(XMLN * p_node, trv_GetReceiverState_RES * p_res); + +BOOL parse_ProvisioningServiceCapabilities(XMLN * p_node, onvif_ProvisioningCapabilities * p_res); +BOOL parse_ProvisioningService(XMLN * p_node, onvif_ProvisioningCapabilities * p_res); +BOOL parse_tpv_GetServiceCapabilities(XMLN * p_node, tpv_GetServiceCapabilities_RES * p_res); +BOOL parse_tpv_GetUsage(XMLN * p_node, tpv_GetUsage_RES * p_res); + + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/ONVIF/include/openssl/include/openssl/aes.h b/ONVIF/include/openssl/include/openssl/aes.h new file mode 100644 index 0000000..245c552 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/aes.h @@ -0,0 +1,92 @@ +/* + * Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_AES_H +# define HEADER_AES_H + +# include + +# include +# ifdef __cplusplus +extern "C" { +# endif + +# define AES_ENCRYPT 1 +# define AES_DECRYPT 0 + +/* + * Because array size can't be a const in C, the following two are macros. + * Both sizes are in bytes. + */ +# define AES_MAXNR 14 +# define AES_BLOCK_SIZE 16 + +/* This should be a hidden type, but EVP requires that the size be known */ +struct aes_key_st { +# ifdef AES_LONG + unsigned long rd_key[4 * (AES_MAXNR + 1)]; +# else + unsigned int rd_key[4 * (AES_MAXNR + 1)]; +# endif + int rounds; +}; +typedef struct aes_key_st AES_KEY; + +const char *AES_options(void); + +int AES_set_encrypt_key(const unsigned char *userKey, const int bits, + AES_KEY *key); +int AES_set_decrypt_key(const unsigned char *userKey, const int bits, + AES_KEY *key); + +void AES_encrypt(const unsigned char *in, unsigned char *out, + const AES_KEY *key); +void AES_decrypt(const unsigned char *in, unsigned char *out, + const AES_KEY *key); + +void AES_ecb_encrypt(const unsigned char *in, unsigned char *out, + const AES_KEY *key, const int enc); +void AES_cbc_encrypt(const unsigned char *in, unsigned char *out, + size_t length, const AES_KEY *key, + unsigned char *ivec, const int enc); +void AES_cfb128_encrypt(const unsigned char *in, unsigned char *out, + size_t length, const AES_KEY *key, + unsigned char *ivec, int *num, const int enc); +void AES_cfb1_encrypt(const unsigned char *in, unsigned char *out, + size_t length, const AES_KEY *key, + unsigned char *ivec, int *num, const int enc); +void AES_cfb8_encrypt(const unsigned char *in, unsigned char *out, + size_t length, const AES_KEY *key, + unsigned char *ivec, int *num, const int enc); +void AES_ofb128_encrypt(const unsigned char *in, unsigned char *out, + size_t length, const AES_KEY *key, + unsigned char *ivec, int *num); +/* NB: the IV is _two_ blocks long */ +void AES_ige_encrypt(const unsigned char *in, unsigned char *out, + size_t length, const AES_KEY *key, + unsigned char *ivec, const int enc); +/* NB: the IV is _four_ blocks long */ +void AES_bi_ige_encrypt(const unsigned char *in, unsigned char *out, + size_t length, const AES_KEY *key, + const AES_KEY *key2, const unsigned char *ivec, + const int enc); + +int AES_wrap_key(AES_KEY *key, const unsigned char *iv, + unsigned char *out, + const unsigned char *in, unsigned int inlen); +int AES_unwrap_key(AES_KEY *key, const unsigned char *iv, + unsigned char *out, + const unsigned char *in, unsigned int inlen); + + +# ifdef __cplusplus +} +# endif + +#endif diff --git a/ONVIF/include/openssl/include/openssl/asn1.h b/ONVIF/include/openssl/include/openssl/asn1.h new file mode 100644 index 0000000..9522eec --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/asn1.h @@ -0,0 +1,886 @@ +/* + * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_ASN1_H +# define HEADER_ASN1_H + +# include +# include +# include +# include +# include +# include +# include + +# include +# if OPENSSL_API_COMPAT < 0x10100000L +# include +# endif + +# ifdef OPENSSL_BUILD_SHLIBCRYPTO +# undef OPENSSL_EXTERN +# define OPENSSL_EXTERN OPENSSL_EXPORT +# endif + +#ifdef __cplusplus +extern "C" { +#endif + +# define V_ASN1_UNIVERSAL 0x00 +# define V_ASN1_APPLICATION 0x40 +# define V_ASN1_CONTEXT_SPECIFIC 0x80 +# define V_ASN1_PRIVATE 0xc0 + +# define V_ASN1_CONSTRUCTED 0x20 +# define V_ASN1_PRIMITIVE_TAG 0x1f +# define V_ASN1_PRIMATIVE_TAG /*compat*/ V_ASN1_PRIMITIVE_TAG + +# define V_ASN1_APP_CHOOSE -2/* let the recipient choose */ +# define V_ASN1_OTHER -3/* used in ASN1_TYPE */ +# define V_ASN1_ANY -4/* used in ASN1 template code */ + +# define V_ASN1_UNDEF -1 +/* ASN.1 tag values */ +# define V_ASN1_EOC 0 +# define V_ASN1_BOOLEAN 1 /**/ +# define V_ASN1_INTEGER 2 +# define V_ASN1_BIT_STRING 3 +# define V_ASN1_OCTET_STRING 4 +# define V_ASN1_NULL 5 +# define V_ASN1_OBJECT 6 +# define V_ASN1_OBJECT_DESCRIPTOR 7 +# define V_ASN1_EXTERNAL 8 +# define V_ASN1_REAL 9 +# define V_ASN1_ENUMERATED 10 +# define V_ASN1_UTF8STRING 12 +# define V_ASN1_SEQUENCE 16 +# define V_ASN1_SET 17 +# define V_ASN1_NUMERICSTRING 18 /**/ +# define V_ASN1_PRINTABLESTRING 19 +# define V_ASN1_T61STRING 20 +# define V_ASN1_TELETEXSTRING 20/* alias */ +# define V_ASN1_VIDEOTEXSTRING 21 /**/ +# define V_ASN1_IA5STRING 22 +# define V_ASN1_UTCTIME 23 +# define V_ASN1_GENERALIZEDTIME 24 /**/ +# define V_ASN1_GRAPHICSTRING 25 /**/ +# define V_ASN1_ISO64STRING 26 /**/ +# define V_ASN1_VISIBLESTRING 26/* alias */ +# define V_ASN1_GENERALSTRING 27 /**/ +# define V_ASN1_UNIVERSALSTRING 28 /**/ +# define V_ASN1_BMPSTRING 30 + +/* + * NB the constants below are used internally by ASN1_INTEGER + * and ASN1_ENUMERATED to indicate the sign. They are *not* on + * the wire tag values. + */ + +# define V_ASN1_NEG 0x100 +# define V_ASN1_NEG_INTEGER (2 | V_ASN1_NEG) +# define V_ASN1_NEG_ENUMERATED (10 | V_ASN1_NEG) + +/* For use with d2i_ASN1_type_bytes() */ +# define B_ASN1_NUMERICSTRING 0x0001 +# define B_ASN1_PRINTABLESTRING 0x0002 +# define B_ASN1_T61STRING 0x0004 +# define B_ASN1_TELETEXSTRING 0x0004 +# define B_ASN1_VIDEOTEXSTRING 0x0008 +# define B_ASN1_IA5STRING 0x0010 +# define B_ASN1_GRAPHICSTRING 0x0020 +# define B_ASN1_ISO64STRING 0x0040 +# define B_ASN1_VISIBLESTRING 0x0040 +# define B_ASN1_GENERALSTRING 0x0080 +# define B_ASN1_UNIVERSALSTRING 0x0100 +# define B_ASN1_OCTET_STRING 0x0200 +# define B_ASN1_BIT_STRING 0x0400 +# define B_ASN1_BMPSTRING 0x0800 +# define B_ASN1_UNKNOWN 0x1000 +# define B_ASN1_UTF8STRING 0x2000 +# define B_ASN1_UTCTIME 0x4000 +# define B_ASN1_GENERALIZEDTIME 0x8000 +# define B_ASN1_SEQUENCE 0x10000 +/* For use with ASN1_mbstring_copy() */ +# define MBSTRING_FLAG 0x1000 +# define MBSTRING_UTF8 (MBSTRING_FLAG) +# define MBSTRING_ASC (MBSTRING_FLAG|1) +# define MBSTRING_BMP (MBSTRING_FLAG|2) +# define MBSTRING_UNIV (MBSTRING_FLAG|4) +# define SMIME_OLDMIME 0x400 +# define SMIME_CRLFEOL 0x800 +# define SMIME_STREAM 0x1000 + struct X509_algor_st; +DEFINE_STACK_OF(X509_ALGOR) + +# define ASN1_STRING_FLAG_BITS_LEFT 0x08/* Set if 0x07 has bits left value */ +/* + * This indicates that the ASN1_STRING is not a real value but just a place + * holder for the location where indefinite length constructed data should be + * inserted in the memory buffer + */ +# define ASN1_STRING_FLAG_NDEF 0x010 + +/* + * This flag is used by the CMS code to indicate that a string is not + * complete and is a place holder for content when it had all been accessed. + * The flag will be reset when content has been written to it. + */ + +# define ASN1_STRING_FLAG_CONT 0x020 +/* + * This flag is used by ASN1 code to indicate an ASN1_STRING is an MSTRING + * type. + */ +# define ASN1_STRING_FLAG_MSTRING 0x040 +/* String is embedded and only content should be freed */ +# define ASN1_STRING_FLAG_EMBED 0x080 +/* String should be parsed in RFC 5280's time format */ +# define ASN1_STRING_FLAG_X509_TIME 0x100 +/* This is the base type that holds just about everything :-) */ +struct asn1_string_st { + int length; + int type; + unsigned char *data; + /* + * The value of the following field depends on the type being held. It + * is mostly being used for BIT_STRING so if the input data has a + * non-zero 'unused bits' value, it will be handled correctly + */ + long flags; +}; + +/* + * ASN1_ENCODING structure: this is used to save the received encoding of an + * ASN1 type. This is useful to get round problems with invalid encodings + * which can break signatures. + */ + +typedef struct ASN1_ENCODING_st { + unsigned char *enc; /* DER encoding */ + long len; /* Length of encoding */ + int modified; /* set to 1 if 'enc' is invalid */ +} ASN1_ENCODING; + +/* Used with ASN1 LONG type: if a long is set to this it is omitted */ +# define ASN1_LONG_UNDEF 0x7fffffffL + +# define STABLE_FLAGS_MALLOC 0x01 +/* + * A zero passed to ASN1_STRING_TABLE_new_add for the flags is interpreted + * as "don't change" and STABLE_FLAGS_MALLOC is always set. By setting + * STABLE_FLAGS_MALLOC only we can clear the existing value. Use the alias + * STABLE_FLAGS_CLEAR to reflect this. + */ +# define STABLE_FLAGS_CLEAR STABLE_FLAGS_MALLOC +# define STABLE_NO_MASK 0x02 +# define DIRSTRING_TYPE \ + (B_ASN1_PRINTABLESTRING|B_ASN1_T61STRING|B_ASN1_BMPSTRING|B_ASN1_UTF8STRING) +# define PKCS9STRING_TYPE (DIRSTRING_TYPE|B_ASN1_IA5STRING) + +typedef struct asn1_string_table_st { + int nid; + long minsize; + long maxsize; + unsigned long mask; + unsigned long flags; +} ASN1_STRING_TABLE; + +DEFINE_STACK_OF(ASN1_STRING_TABLE) + +/* size limits: this stuff is taken straight from RFC2459 */ + +# define ub_name 32768 +# define ub_common_name 64 +# define ub_locality_name 128 +# define ub_state_name 128 +# define ub_organization_name 64 +# define ub_organization_unit_name 64 +# define ub_title 64 +# define ub_email_address 128 + +/* + * Declarations for template structures: for full definitions see asn1t.h + */ +typedef struct ASN1_TEMPLATE_st ASN1_TEMPLATE; +typedef struct ASN1_TLC_st ASN1_TLC; +/* This is just an opaque pointer */ +typedef struct ASN1_VALUE_st ASN1_VALUE; + +/* Declare ASN1 functions: the implement macro in in asn1t.h */ + +# define DECLARE_ASN1_FUNCTIONS(type) DECLARE_ASN1_FUNCTIONS_name(type, type) + +# define DECLARE_ASN1_ALLOC_FUNCTIONS(type) \ + DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, type) + +# define DECLARE_ASN1_FUNCTIONS_name(type, name) \ + DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \ + DECLARE_ASN1_ENCODE_FUNCTIONS(type, name, name) + +# define DECLARE_ASN1_FUNCTIONS_fname(type, itname, name) \ + DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \ + DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) + +# define DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) \ + type *d2i_##name(type **a, const unsigned char **in, long len); \ + int i2d_##name(type *a, unsigned char **out); \ + DECLARE_ASN1_ITEM(itname) + +# define DECLARE_ASN1_ENCODE_FUNCTIONS_const(type, name) \ + type *d2i_##name(type **a, const unsigned char **in, long len); \ + int i2d_##name(const type *a, unsigned char **out); \ + DECLARE_ASN1_ITEM(name) + +# define DECLARE_ASN1_NDEF_FUNCTION(name) \ + int i2d_##name##_NDEF(name *a, unsigned char **out); + +# define DECLARE_ASN1_FUNCTIONS_const(name) \ + DECLARE_ASN1_ALLOC_FUNCTIONS(name) \ + DECLARE_ASN1_ENCODE_FUNCTIONS_const(name, name) + +# define DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \ + type *name##_new(void); \ + void name##_free(type *a); + +# define DECLARE_ASN1_PRINT_FUNCTION(stname) \ + DECLARE_ASN1_PRINT_FUNCTION_fname(stname, stname) + +# define DECLARE_ASN1_PRINT_FUNCTION_fname(stname, fname) \ + int fname##_print_ctx(BIO *out, stname *x, int indent, \ + const ASN1_PCTX *pctx); + +# define D2I_OF(type) type *(*)(type **,const unsigned char **,long) +# define I2D_OF(type) int (*)(type *,unsigned char **) +# define I2D_OF_const(type) int (*)(const type *,unsigned char **) + +# define CHECKED_D2I_OF(type, d2i) \ + ((d2i_of_void*) (1 ? d2i : ((D2I_OF(type))0))) +# define CHECKED_I2D_OF(type, i2d) \ + ((i2d_of_void*) (1 ? i2d : ((I2D_OF(type))0))) +# define CHECKED_NEW_OF(type, xnew) \ + ((void *(*)(void)) (1 ? xnew : ((type *(*)(void))0))) +# define CHECKED_PTR_OF(type, p) \ + ((void*) (1 ? p : (type*)0)) +# define CHECKED_PPTR_OF(type, p) \ + ((void**) (1 ? p : (type**)0)) + +# define TYPEDEF_D2I_OF(type) typedef type *d2i_of_##type(type **,const unsigned char **,long) +# define TYPEDEF_I2D_OF(type) typedef int i2d_of_##type(type *,unsigned char **) +# define TYPEDEF_D2I2D_OF(type) TYPEDEF_D2I_OF(type); TYPEDEF_I2D_OF(type) + +TYPEDEF_D2I2D_OF(void); + +/*- + * The following macros and typedefs allow an ASN1_ITEM + * to be embedded in a structure and referenced. Since + * the ASN1_ITEM pointers need to be globally accessible + * (possibly from shared libraries) they may exist in + * different forms. On platforms that support it the + * ASN1_ITEM structure itself will be globally exported. + * Other platforms will export a function that returns + * an ASN1_ITEM pointer. + * + * To handle both cases transparently the macros below + * should be used instead of hard coding an ASN1_ITEM + * pointer in a structure. + * + * The structure will look like this: + * + * typedef struct SOMETHING_st { + * ... + * ASN1_ITEM_EXP *iptr; + * ... + * } SOMETHING; + * + * It would be initialised as e.g.: + * + * SOMETHING somevar = {...,ASN1_ITEM_ref(X509),...}; + * + * and the actual pointer extracted with: + * + * const ASN1_ITEM *it = ASN1_ITEM_ptr(somevar.iptr); + * + * Finally an ASN1_ITEM pointer can be extracted from an + * appropriate reference with: ASN1_ITEM_rptr(X509). This + * would be used when a function takes an ASN1_ITEM * argument. + * + */ + +# ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION + +/* ASN1_ITEM pointer exported type */ +typedef const ASN1_ITEM ASN1_ITEM_EXP; + +/* Macro to obtain ASN1_ITEM pointer from exported type */ +# define ASN1_ITEM_ptr(iptr) (iptr) + +/* Macro to include ASN1_ITEM pointer from base type */ +# define ASN1_ITEM_ref(iptr) (&(iptr##_it)) + +# define ASN1_ITEM_rptr(ref) (&(ref##_it)) + +# define DECLARE_ASN1_ITEM(name) \ + OPENSSL_EXTERN const ASN1_ITEM name##_it; + +# else + +/* + * Platforms that can't easily handle shared global variables are declared as + * functions returning ASN1_ITEM pointers. + */ + +/* ASN1_ITEM pointer exported type */ +typedef const ASN1_ITEM *ASN1_ITEM_EXP (void); + +/* Macro to obtain ASN1_ITEM pointer from exported type */ +# define ASN1_ITEM_ptr(iptr) (iptr()) + +/* Macro to include ASN1_ITEM pointer from base type */ +# define ASN1_ITEM_ref(iptr) (iptr##_it) + +# define ASN1_ITEM_rptr(ref) (ref##_it()) + +# define DECLARE_ASN1_ITEM(name) \ + const ASN1_ITEM * name##_it(void); + +# endif + +/* Parameters used by ASN1_STRING_print_ex() */ + +/* + * These determine which characters to escape: RFC2253 special characters, + * control characters and MSB set characters + */ + +# define ASN1_STRFLGS_ESC_2253 1 +# define ASN1_STRFLGS_ESC_CTRL 2 +# define ASN1_STRFLGS_ESC_MSB 4 + +/* + * This flag determines how we do escaping: normally RC2253 backslash only, + * set this to use backslash and quote. + */ + +# define ASN1_STRFLGS_ESC_QUOTE 8 + +/* These three flags are internal use only. */ + +/* Character is a valid PrintableString character */ +# define CHARTYPE_PRINTABLESTRING 0x10 +/* Character needs escaping if it is the first character */ +# define CHARTYPE_FIRST_ESC_2253 0x20 +/* Character needs escaping if it is the last character */ +# define CHARTYPE_LAST_ESC_2253 0x40 + +/* + * NB the internal flags are safely reused below by flags handled at the top + * level. + */ + +/* + * If this is set we convert all character strings to UTF8 first + */ + +# define ASN1_STRFLGS_UTF8_CONVERT 0x10 + +/* + * If this is set we don't attempt to interpret content: just assume all + * strings are 1 byte per character. This will produce some pretty odd + * looking output! + */ + +# define ASN1_STRFLGS_IGNORE_TYPE 0x20 + +/* If this is set we include the string type in the output */ +# define ASN1_STRFLGS_SHOW_TYPE 0x40 + +/* + * This determines which strings to display and which to 'dump' (hex dump of + * content octets or DER encoding). We can only dump non character strings or + * everything. If we don't dump 'unknown' they are interpreted as character + * strings with 1 octet per character and are subject to the usual escaping + * options. + */ + +# define ASN1_STRFLGS_DUMP_ALL 0x80 +# define ASN1_STRFLGS_DUMP_UNKNOWN 0x100 + +/* + * These determine what 'dumping' does, we can dump the content octets or the + * DER encoding: both use the RFC2253 #XXXXX notation. + */ + +# define ASN1_STRFLGS_DUMP_DER 0x200 + +/* + * This flag specifies that RC2254 escaping shall be performed. + */ +#define ASN1_STRFLGS_ESC_2254 0x400 + +/* + * All the string flags consistent with RFC2253, escaping control characters + * isn't essential in RFC2253 but it is advisable anyway. + */ + +# define ASN1_STRFLGS_RFC2253 (ASN1_STRFLGS_ESC_2253 | \ + ASN1_STRFLGS_ESC_CTRL | \ + ASN1_STRFLGS_ESC_MSB | \ + ASN1_STRFLGS_UTF8_CONVERT | \ + ASN1_STRFLGS_DUMP_UNKNOWN | \ + ASN1_STRFLGS_DUMP_DER) + +DEFINE_STACK_OF(ASN1_INTEGER) + +DEFINE_STACK_OF(ASN1_GENERALSTRING) + +DEFINE_STACK_OF(ASN1_UTF8STRING) + +typedef struct asn1_type_st { + int type; + union { + char *ptr; + ASN1_BOOLEAN boolean; + ASN1_STRING *asn1_string; + ASN1_OBJECT *object; + ASN1_INTEGER *integer; + ASN1_ENUMERATED *enumerated; + ASN1_BIT_STRING *bit_string; + ASN1_OCTET_STRING *octet_string; + ASN1_PRINTABLESTRING *printablestring; + ASN1_T61STRING *t61string; + ASN1_IA5STRING *ia5string; + ASN1_GENERALSTRING *generalstring; + ASN1_BMPSTRING *bmpstring; + ASN1_UNIVERSALSTRING *universalstring; + ASN1_UTCTIME *utctime; + ASN1_GENERALIZEDTIME *generalizedtime; + ASN1_VISIBLESTRING *visiblestring; + ASN1_UTF8STRING *utf8string; + /* + * set and sequence are left complete and still contain the set or + * sequence bytes + */ + ASN1_STRING *set; + ASN1_STRING *sequence; + ASN1_VALUE *asn1_value; + } value; +} ASN1_TYPE; + +DEFINE_STACK_OF(ASN1_TYPE) + +typedef STACK_OF(ASN1_TYPE) ASN1_SEQUENCE_ANY; + +DECLARE_ASN1_ENCODE_FUNCTIONS_const(ASN1_SEQUENCE_ANY, ASN1_SEQUENCE_ANY) +DECLARE_ASN1_ENCODE_FUNCTIONS_const(ASN1_SEQUENCE_ANY, ASN1_SET_ANY) + +/* This is used to contain a list of bit names */ +typedef struct BIT_STRING_BITNAME_st { + int bitnum; + const char *lname; + const char *sname; +} BIT_STRING_BITNAME; + +# define B_ASN1_TIME \ + B_ASN1_UTCTIME | \ + B_ASN1_GENERALIZEDTIME + +# define B_ASN1_PRINTABLE \ + B_ASN1_NUMERICSTRING| \ + B_ASN1_PRINTABLESTRING| \ + B_ASN1_T61STRING| \ + B_ASN1_IA5STRING| \ + B_ASN1_BIT_STRING| \ + B_ASN1_UNIVERSALSTRING|\ + B_ASN1_BMPSTRING|\ + B_ASN1_UTF8STRING|\ + B_ASN1_SEQUENCE|\ + B_ASN1_UNKNOWN + +# define B_ASN1_DIRECTORYSTRING \ + B_ASN1_PRINTABLESTRING| \ + B_ASN1_TELETEXSTRING|\ + B_ASN1_BMPSTRING|\ + B_ASN1_UNIVERSALSTRING|\ + B_ASN1_UTF8STRING + +# define B_ASN1_DISPLAYTEXT \ + B_ASN1_IA5STRING| \ + B_ASN1_VISIBLESTRING| \ + B_ASN1_BMPSTRING|\ + B_ASN1_UTF8STRING + +DECLARE_ASN1_FUNCTIONS_fname(ASN1_TYPE, ASN1_ANY, ASN1_TYPE) + +int ASN1_TYPE_get(const ASN1_TYPE *a); +void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value); +int ASN1_TYPE_set1(ASN1_TYPE *a, int type, const void *value); +int ASN1_TYPE_cmp(const ASN1_TYPE *a, const ASN1_TYPE *b); + +ASN1_TYPE *ASN1_TYPE_pack_sequence(const ASN1_ITEM *it, void *s, ASN1_TYPE **t); +void *ASN1_TYPE_unpack_sequence(const ASN1_ITEM *it, const ASN1_TYPE *t); + +ASN1_OBJECT *ASN1_OBJECT_new(void); +void ASN1_OBJECT_free(ASN1_OBJECT *a); +int i2d_ASN1_OBJECT(const ASN1_OBJECT *a, unsigned char **pp); +ASN1_OBJECT *d2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp, + long length); + +DECLARE_ASN1_ITEM(ASN1_OBJECT) + +DEFINE_STACK_OF(ASN1_OBJECT) + +ASN1_STRING *ASN1_STRING_new(void); +void ASN1_STRING_free(ASN1_STRING *a); +void ASN1_STRING_clear_free(ASN1_STRING *a); +int ASN1_STRING_copy(ASN1_STRING *dst, const ASN1_STRING *str); +ASN1_STRING *ASN1_STRING_dup(const ASN1_STRING *a); +ASN1_STRING *ASN1_STRING_type_new(int type); +int ASN1_STRING_cmp(const ASN1_STRING *a, const ASN1_STRING *b); + /* + * Since this is used to store all sorts of things, via macros, for now, + * make its data void * + */ +int ASN1_STRING_set(ASN1_STRING *str, const void *data, int len); +void ASN1_STRING_set0(ASN1_STRING *str, void *data, int len); +int ASN1_STRING_length(const ASN1_STRING *x); +void ASN1_STRING_length_set(ASN1_STRING *x, int n); +int ASN1_STRING_type(const ASN1_STRING *x); +DEPRECATEDIN_1_1_0(unsigned char *ASN1_STRING_data(ASN1_STRING *x)) +const unsigned char *ASN1_STRING_get0_data(const ASN1_STRING *x); + +DECLARE_ASN1_FUNCTIONS(ASN1_BIT_STRING) +int ASN1_BIT_STRING_set(ASN1_BIT_STRING *a, unsigned char *d, int length); +int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value); +int ASN1_BIT_STRING_get_bit(const ASN1_BIT_STRING *a, int n); +int ASN1_BIT_STRING_check(const ASN1_BIT_STRING *a, + const unsigned char *flags, int flags_len); + +int ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs, + BIT_STRING_BITNAME *tbl, int indent); +int ASN1_BIT_STRING_num_asc(const char *name, BIT_STRING_BITNAME *tbl); +int ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, const char *name, int value, + BIT_STRING_BITNAME *tbl); + +DECLARE_ASN1_FUNCTIONS(ASN1_INTEGER) +ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a, const unsigned char **pp, + long length); +ASN1_INTEGER *ASN1_INTEGER_dup(const ASN1_INTEGER *x); +int ASN1_INTEGER_cmp(const ASN1_INTEGER *x, const ASN1_INTEGER *y); + +DECLARE_ASN1_FUNCTIONS(ASN1_ENUMERATED) + +int ASN1_UTCTIME_check(const ASN1_UTCTIME *a); +ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t); +ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t, + int offset_day, long offset_sec); +int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, const char *str); +int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t); + +int ASN1_GENERALIZEDTIME_check(const ASN1_GENERALIZEDTIME *a); +ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s, + time_t t); +ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s, + time_t t, int offset_day, + long offset_sec); +int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str); + +int ASN1_TIME_diff(int *pday, int *psec, + const ASN1_TIME *from, const ASN1_TIME *to); + +DECLARE_ASN1_FUNCTIONS(ASN1_OCTET_STRING) +ASN1_OCTET_STRING *ASN1_OCTET_STRING_dup(const ASN1_OCTET_STRING *a); +int ASN1_OCTET_STRING_cmp(const ASN1_OCTET_STRING *a, + const ASN1_OCTET_STRING *b); +int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *str, const unsigned char *data, + int len); + +DECLARE_ASN1_FUNCTIONS(ASN1_VISIBLESTRING) +DECLARE_ASN1_FUNCTIONS(ASN1_UNIVERSALSTRING) +DECLARE_ASN1_FUNCTIONS(ASN1_UTF8STRING) +DECLARE_ASN1_FUNCTIONS(ASN1_NULL) +DECLARE_ASN1_FUNCTIONS(ASN1_BMPSTRING) + +int UTF8_getc(const unsigned char *str, int len, unsigned long *val); +int UTF8_putc(unsigned char *str, int len, unsigned long value); + +DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, ASN1_PRINTABLE) + +DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, DIRECTORYSTRING) +DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, DISPLAYTEXT) +DECLARE_ASN1_FUNCTIONS(ASN1_PRINTABLESTRING) +DECLARE_ASN1_FUNCTIONS(ASN1_T61STRING) +DECLARE_ASN1_FUNCTIONS(ASN1_IA5STRING) +DECLARE_ASN1_FUNCTIONS(ASN1_GENERALSTRING) +DECLARE_ASN1_FUNCTIONS(ASN1_UTCTIME) +DECLARE_ASN1_FUNCTIONS(ASN1_GENERALIZEDTIME) +DECLARE_ASN1_FUNCTIONS(ASN1_TIME) + +DECLARE_ASN1_ITEM(ASN1_OCTET_STRING_NDEF) + +ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s, time_t t); +ASN1_TIME *ASN1_TIME_adj(ASN1_TIME *s, time_t t, + int offset_day, long offset_sec); +int ASN1_TIME_check(const ASN1_TIME *t); +ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(const ASN1_TIME *t, + ASN1_GENERALIZEDTIME **out); +int ASN1_TIME_set_string(ASN1_TIME *s, const char *str); +int ASN1_TIME_set_string_X509(ASN1_TIME *s, const char *str); +int ASN1_TIME_to_tm(const ASN1_TIME *s, struct tm *tm); +int ASN1_TIME_normalize(ASN1_TIME *s); +int ASN1_TIME_cmp_time_t(const ASN1_TIME *s, time_t t); +int ASN1_TIME_compare(const ASN1_TIME *a, const ASN1_TIME *b); + +int i2a_ASN1_INTEGER(BIO *bp, const ASN1_INTEGER *a); +int a2i_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *bs, char *buf, int size); +int i2a_ASN1_ENUMERATED(BIO *bp, const ASN1_ENUMERATED *a); +int a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size); +int i2a_ASN1_OBJECT(BIO *bp, const ASN1_OBJECT *a); +int a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size); +int i2a_ASN1_STRING(BIO *bp, const ASN1_STRING *a, int type); +int i2t_ASN1_OBJECT(char *buf, int buf_len, const ASN1_OBJECT *a); + +int a2d_ASN1_OBJECT(unsigned char *out, int olen, const char *buf, int num); +ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data, int len, + const char *sn, const char *ln); + +int ASN1_INTEGER_get_int64(int64_t *pr, const ASN1_INTEGER *a); +int ASN1_INTEGER_set_int64(ASN1_INTEGER *a, int64_t r); +int ASN1_INTEGER_get_uint64(uint64_t *pr, const ASN1_INTEGER *a); +int ASN1_INTEGER_set_uint64(ASN1_INTEGER *a, uint64_t r); + +int ASN1_INTEGER_set(ASN1_INTEGER *a, long v); +long ASN1_INTEGER_get(const ASN1_INTEGER *a); +ASN1_INTEGER *BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai); +BIGNUM *ASN1_INTEGER_to_BN(const ASN1_INTEGER *ai, BIGNUM *bn); + +int ASN1_ENUMERATED_get_int64(int64_t *pr, const ASN1_ENUMERATED *a); +int ASN1_ENUMERATED_set_int64(ASN1_ENUMERATED *a, int64_t r); + + +int ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v); +long ASN1_ENUMERATED_get(const ASN1_ENUMERATED *a); +ASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(const BIGNUM *bn, ASN1_ENUMERATED *ai); +BIGNUM *ASN1_ENUMERATED_to_BN(const ASN1_ENUMERATED *ai, BIGNUM *bn); + +/* General */ +/* given a string, return the correct type, max is the maximum length */ +int ASN1_PRINTABLE_type(const unsigned char *s, int max); + +unsigned long ASN1_tag2bit(int tag); + +/* SPECIALS */ +int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag, + int *pclass, long omax); +int ASN1_check_infinite_end(unsigned char **p, long len); +int ASN1_const_check_infinite_end(const unsigned char **p, long len); +void ASN1_put_object(unsigned char **pp, int constructed, int length, + int tag, int xclass); +int ASN1_put_eoc(unsigned char **pp); +int ASN1_object_size(int constructed, int length, int tag); + +/* Used to implement other functions */ +void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, void *x); + +# define ASN1_dup_of(type,i2d,d2i,x) \ + ((type*)ASN1_dup(CHECKED_I2D_OF(type, i2d), \ + CHECKED_D2I_OF(type, d2i), \ + CHECKED_PTR_OF(type, x))) + +# define ASN1_dup_of_const(type,i2d,d2i,x) \ + ((type*)ASN1_dup(CHECKED_I2D_OF(const type, i2d), \ + CHECKED_D2I_OF(type, d2i), \ + CHECKED_PTR_OF(const type, x))) + +void *ASN1_item_dup(const ASN1_ITEM *it, void *x); + +/* ASN1 alloc/free macros for when a type is only used internally */ + +# define M_ASN1_new_of(type) (type *)ASN1_item_new(ASN1_ITEM_rptr(type)) +# define M_ASN1_free_of(x, type) \ + ASN1_item_free(CHECKED_PTR_OF(type, x), ASN1_ITEM_rptr(type)) + +# ifndef OPENSSL_NO_STDIO +void *ASN1_d2i_fp(void *(*xnew) (void), d2i_of_void *d2i, FILE *in, void **x); + +# define ASN1_d2i_fp_of(type,xnew,d2i,in,x) \ + ((type*)ASN1_d2i_fp(CHECKED_NEW_OF(type, xnew), \ + CHECKED_D2I_OF(type, d2i), \ + in, \ + CHECKED_PPTR_OF(type, x))) + +void *ASN1_item_d2i_fp(const ASN1_ITEM *it, FILE *in, void *x); +int ASN1_i2d_fp(i2d_of_void *i2d, FILE *out, void *x); + +# define ASN1_i2d_fp_of(type,i2d,out,x) \ + (ASN1_i2d_fp(CHECKED_I2D_OF(type, i2d), \ + out, \ + CHECKED_PTR_OF(type, x))) + +# define ASN1_i2d_fp_of_const(type,i2d,out,x) \ + (ASN1_i2d_fp(CHECKED_I2D_OF(const type, i2d), \ + out, \ + CHECKED_PTR_OF(const type, x))) + +int ASN1_item_i2d_fp(const ASN1_ITEM *it, FILE *out, void *x); +int ASN1_STRING_print_ex_fp(FILE *fp, const ASN1_STRING *str, unsigned long flags); +# endif + +int ASN1_STRING_to_UTF8(unsigned char **out, const ASN1_STRING *in); + +void *ASN1_d2i_bio(void *(*xnew) (void), d2i_of_void *d2i, BIO *in, void **x); + +# define ASN1_d2i_bio_of(type,xnew,d2i,in,x) \ + ((type*)ASN1_d2i_bio( CHECKED_NEW_OF(type, xnew), \ + CHECKED_D2I_OF(type, d2i), \ + in, \ + CHECKED_PPTR_OF(type, x))) + +void *ASN1_item_d2i_bio(const ASN1_ITEM *it, BIO *in, void *x); +int ASN1_i2d_bio(i2d_of_void *i2d, BIO *out, unsigned char *x); + +# define ASN1_i2d_bio_of(type,i2d,out,x) \ + (ASN1_i2d_bio(CHECKED_I2D_OF(type, i2d), \ + out, \ + CHECKED_PTR_OF(type, x))) + +# define ASN1_i2d_bio_of_const(type,i2d,out,x) \ + (ASN1_i2d_bio(CHECKED_I2D_OF(const type, i2d), \ + out, \ + CHECKED_PTR_OF(const type, x))) + +int ASN1_item_i2d_bio(const ASN1_ITEM *it, BIO *out, void *x); +int ASN1_UTCTIME_print(BIO *fp, const ASN1_UTCTIME *a); +int ASN1_GENERALIZEDTIME_print(BIO *fp, const ASN1_GENERALIZEDTIME *a); +int ASN1_TIME_print(BIO *fp, const ASN1_TIME *a); +int ASN1_STRING_print(BIO *bp, const ASN1_STRING *v); +int ASN1_STRING_print_ex(BIO *out, const ASN1_STRING *str, unsigned long flags); +int ASN1_buf_print(BIO *bp, const unsigned char *buf, size_t buflen, int off); +int ASN1_bn_print(BIO *bp, const char *number, const BIGNUM *num, + unsigned char *buf, int off); +int ASN1_parse(BIO *bp, const unsigned char *pp, long len, int indent); +int ASN1_parse_dump(BIO *bp, const unsigned char *pp, long len, int indent, + int dump); +const char *ASN1_tag2str(int tag); + +/* Used to load and write Netscape format cert */ + +int ASN1_UNIVERSALSTRING_to_string(ASN1_UNIVERSALSTRING *s); + +int ASN1_TYPE_set_octetstring(ASN1_TYPE *a, unsigned char *data, int len); +int ASN1_TYPE_get_octetstring(const ASN1_TYPE *a, unsigned char *data, int max_len); +int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num, + unsigned char *data, int len); +int ASN1_TYPE_get_int_octetstring(const ASN1_TYPE *a, long *num, + unsigned char *data, int max_len); + +void *ASN1_item_unpack(const ASN1_STRING *oct, const ASN1_ITEM *it); + +ASN1_STRING *ASN1_item_pack(void *obj, const ASN1_ITEM *it, + ASN1_OCTET_STRING **oct); + +void ASN1_STRING_set_default_mask(unsigned long mask); +int ASN1_STRING_set_default_mask_asc(const char *p); +unsigned long ASN1_STRING_get_default_mask(void); +int ASN1_mbstring_copy(ASN1_STRING **out, const unsigned char *in, int len, + int inform, unsigned long mask); +int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len, + int inform, unsigned long mask, + long minsize, long maxsize); + +ASN1_STRING *ASN1_STRING_set_by_NID(ASN1_STRING **out, + const unsigned char *in, int inlen, + int inform, int nid); +ASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid); +int ASN1_STRING_TABLE_add(int, long, long, unsigned long, unsigned long); +void ASN1_STRING_TABLE_cleanup(void); + +/* ASN1 template functions */ + +/* Old API compatible functions */ +ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it); +void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it); +ASN1_VALUE *ASN1_item_d2i(ASN1_VALUE **val, const unsigned char **in, + long len, const ASN1_ITEM *it); +int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it); +int ASN1_item_ndef_i2d(ASN1_VALUE *val, unsigned char **out, + const ASN1_ITEM *it); + +void ASN1_add_oid_module(void); +void ASN1_add_stable_module(void); + +ASN1_TYPE *ASN1_generate_nconf(const char *str, CONF *nconf); +ASN1_TYPE *ASN1_generate_v3(const char *str, X509V3_CTX *cnf); +int ASN1_str2mask(const char *str, unsigned long *pmask); + +/* ASN1 Print flags */ + +/* Indicate missing OPTIONAL fields */ +# define ASN1_PCTX_FLAGS_SHOW_ABSENT 0x001 +/* Mark start and end of SEQUENCE */ +# define ASN1_PCTX_FLAGS_SHOW_SEQUENCE 0x002 +/* Mark start and end of SEQUENCE/SET OF */ +# define ASN1_PCTX_FLAGS_SHOW_SSOF 0x004 +/* Show the ASN1 type of primitives */ +# define ASN1_PCTX_FLAGS_SHOW_TYPE 0x008 +/* Don't show ASN1 type of ANY */ +# define ASN1_PCTX_FLAGS_NO_ANY_TYPE 0x010 +/* Don't show ASN1 type of MSTRINGs */ +# define ASN1_PCTX_FLAGS_NO_MSTRING_TYPE 0x020 +/* Don't show field names in SEQUENCE */ +# define ASN1_PCTX_FLAGS_NO_FIELD_NAME 0x040 +/* Show structure names of each SEQUENCE field */ +# define ASN1_PCTX_FLAGS_SHOW_FIELD_STRUCT_NAME 0x080 +/* Don't show structure name even at top level */ +# define ASN1_PCTX_FLAGS_NO_STRUCT_NAME 0x100 + +int ASN1_item_print(BIO *out, ASN1_VALUE *ifld, int indent, + const ASN1_ITEM *it, const ASN1_PCTX *pctx); +ASN1_PCTX *ASN1_PCTX_new(void); +void ASN1_PCTX_free(ASN1_PCTX *p); +unsigned long ASN1_PCTX_get_flags(const ASN1_PCTX *p); +void ASN1_PCTX_set_flags(ASN1_PCTX *p, unsigned long flags); +unsigned long ASN1_PCTX_get_nm_flags(const ASN1_PCTX *p); +void ASN1_PCTX_set_nm_flags(ASN1_PCTX *p, unsigned long flags); +unsigned long ASN1_PCTX_get_cert_flags(const ASN1_PCTX *p); +void ASN1_PCTX_set_cert_flags(ASN1_PCTX *p, unsigned long flags); +unsigned long ASN1_PCTX_get_oid_flags(const ASN1_PCTX *p); +void ASN1_PCTX_set_oid_flags(ASN1_PCTX *p, unsigned long flags); +unsigned long ASN1_PCTX_get_str_flags(const ASN1_PCTX *p); +void ASN1_PCTX_set_str_flags(ASN1_PCTX *p, unsigned long flags); + +ASN1_SCTX *ASN1_SCTX_new(int (*scan_cb) (ASN1_SCTX *ctx)); +void ASN1_SCTX_free(ASN1_SCTX *p); +const ASN1_ITEM *ASN1_SCTX_get_item(ASN1_SCTX *p); +const ASN1_TEMPLATE *ASN1_SCTX_get_template(ASN1_SCTX *p); +unsigned long ASN1_SCTX_get_flags(ASN1_SCTX *p); +void ASN1_SCTX_set_app_data(ASN1_SCTX *p, void *data); +void *ASN1_SCTX_get_app_data(ASN1_SCTX *p); + +const BIO_METHOD *BIO_f_asn1(void); + +BIO *BIO_new_NDEF(BIO *out, ASN1_VALUE *val, const ASN1_ITEM *it); + +int i2d_ASN1_bio_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags, + const ASN1_ITEM *it); +int PEM_write_bio_ASN1_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags, + const char *hdr, const ASN1_ITEM *it); +int SMIME_write_ASN1(BIO *bio, ASN1_VALUE *val, BIO *data, int flags, + int ctype_nid, int econt_nid, + STACK_OF(X509_ALGOR) *mdalgs, const ASN1_ITEM *it); +ASN1_VALUE *SMIME_read_ASN1(BIO *bio, BIO **bcont, const ASN1_ITEM *it); +int SMIME_crlf_copy(BIO *in, BIO *out, int flags); +int SMIME_text(BIO *in, BIO *out); + +const ASN1_ITEM *ASN1_ITEM_lookup(const char *name); +const ASN1_ITEM *ASN1_ITEM_get(size_t i); + +# ifdef __cplusplus +} +# endif +#endif diff --git a/ONVIF/include/openssl/include/openssl/asn1_mac.h b/ONVIF/include/openssl/include/openssl/asn1_mac.h new file mode 100644 index 0000000..7ac1782 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/asn1_mac.h @@ -0,0 +1,10 @@ +/* + * Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#error "This file is obsolete; please update your software." diff --git a/ONVIF/include/openssl/include/openssl/asn1err.h b/ONVIF/include/openssl/include/openssl/asn1err.h new file mode 100644 index 0000000..faed5a5 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/asn1err.h @@ -0,0 +1,256 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_ASN1ERR_H +# define HEADER_ASN1ERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_ASN1_strings(void); + +/* + * ASN1 function codes. + */ +# define ASN1_F_A2D_ASN1_OBJECT 100 +# define ASN1_F_A2I_ASN1_INTEGER 102 +# define ASN1_F_A2I_ASN1_STRING 103 +# define ASN1_F_APPEND_EXP 176 +# define ASN1_F_ASN1_BIO_INIT 113 +# define ASN1_F_ASN1_BIT_STRING_SET_BIT 183 +# define ASN1_F_ASN1_CB 177 +# define ASN1_F_ASN1_CHECK_TLEN 104 +# define ASN1_F_ASN1_COLLECT 106 +# define ASN1_F_ASN1_D2I_EX_PRIMITIVE 108 +# define ASN1_F_ASN1_D2I_FP 109 +# define ASN1_F_ASN1_D2I_READ_BIO 107 +# define ASN1_F_ASN1_DIGEST 184 +# define ASN1_F_ASN1_DO_ADB 110 +# define ASN1_F_ASN1_DO_LOCK 233 +# define ASN1_F_ASN1_DUP 111 +# define ASN1_F_ASN1_ENC_SAVE 115 +# define ASN1_F_ASN1_EX_C2I 204 +# define ASN1_F_ASN1_FIND_END 190 +# define ASN1_F_ASN1_GENERALIZEDTIME_ADJ 216 +# define ASN1_F_ASN1_GENERATE_V3 178 +# define ASN1_F_ASN1_GET_INT64 224 +# define ASN1_F_ASN1_GET_OBJECT 114 +# define ASN1_F_ASN1_GET_UINT64 225 +# define ASN1_F_ASN1_I2D_BIO 116 +# define ASN1_F_ASN1_I2D_FP 117 +# define ASN1_F_ASN1_ITEM_D2I_FP 206 +# define ASN1_F_ASN1_ITEM_DUP 191 +# define ASN1_F_ASN1_ITEM_EMBED_D2I 120 +# define ASN1_F_ASN1_ITEM_EMBED_NEW 121 +# define ASN1_F_ASN1_ITEM_FLAGS_I2D 118 +# define ASN1_F_ASN1_ITEM_I2D_BIO 192 +# define ASN1_F_ASN1_ITEM_I2D_FP 193 +# define ASN1_F_ASN1_ITEM_PACK 198 +# define ASN1_F_ASN1_ITEM_SIGN 195 +# define ASN1_F_ASN1_ITEM_SIGN_CTX 220 +# define ASN1_F_ASN1_ITEM_UNPACK 199 +# define ASN1_F_ASN1_ITEM_VERIFY 197 +# define ASN1_F_ASN1_MBSTRING_NCOPY 122 +# define ASN1_F_ASN1_OBJECT_NEW 123 +# define ASN1_F_ASN1_OUTPUT_DATA 214 +# define ASN1_F_ASN1_PCTX_NEW 205 +# define ASN1_F_ASN1_PRIMITIVE_NEW 119 +# define ASN1_F_ASN1_SCTX_NEW 221 +# define ASN1_F_ASN1_SIGN 128 +# define ASN1_F_ASN1_STR2TYPE 179 +# define ASN1_F_ASN1_STRING_GET_INT64 227 +# define ASN1_F_ASN1_STRING_GET_UINT64 230 +# define ASN1_F_ASN1_STRING_SET 186 +# define ASN1_F_ASN1_STRING_TABLE_ADD 129 +# define ASN1_F_ASN1_STRING_TO_BN 228 +# define ASN1_F_ASN1_STRING_TYPE_NEW 130 +# define ASN1_F_ASN1_TEMPLATE_EX_D2I 132 +# define ASN1_F_ASN1_TEMPLATE_NEW 133 +# define ASN1_F_ASN1_TEMPLATE_NOEXP_D2I 131 +# define ASN1_F_ASN1_TIME_ADJ 217 +# define ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING 134 +# define ASN1_F_ASN1_TYPE_GET_OCTETSTRING 135 +# define ASN1_F_ASN1_UTCTIME_ADJ 218 +# define ASN1_F_ASN1_VERIFY 137 +# define ASN1_F_B64_READ_ASN1 209 +# define ASN1_F_B64_WRITE_ASN1 210 +# define ASN1_F_BIO_NEW_NDEF 208 +# define ASN1_F_BITSTR_CB 180 +# define ASN1_F_BN_TO_ASN1_STRING 229 +# define ASN1_F_C2I_ASN1_BIT_STRING 189 +# define ASN1_F_C2I_ASN1_INTEGER 194 +# define ASN1_F_C2I_ASN1_OBJECT 196 +# define ASN1_F_C2I_IBUF 226 +# define ASN1_F_C2I_UINT64_INT 101 +# define ASN1_F_COLLECT_DATA 140 +# define ASN1_F_D2I_ASN1_OBJECT 147 +# define ASN1_F_D2I_ASN1_UINTEGER 150 +# define ASN1_F_D2I_AUTOPRIVATEKEY 207 +# define ASN1_F_D2I_PRIVATEKEY 154 +# define ASN1_F_D2I_PUBLICKEY 155 +# define ASN1_F_DO_BUF 142 +# define ASN1_F_DO_CREATE 124 +# define ASN1_F_DO_DUMP 125 +# define ASN1_F_DO_TCREATE 222 +# define ASN1_F_I2A_ASN1_OBJECT 126 +# define ASN1_F_I2D_ASN1_BIO_STREAM 211 +# define ASN1_F_I2D_ASN1_OBJECT 143 +# define ASN1_F_I2D_DSA_PUBKEY 161 +# define ASN1_F_I2D_EC_PUBKEY 181 +# define ASN1_F_I2D_PRIVATEKEY 163 +# define ASN1_F_I2D_PUBLICKEY 164 +# define ASN1_F_I2D_RSA_PUBKEY 165 +# define ASN1_F_LONG_C2I 166 +# define ASN1_F_NDEF_PREFIX 127 +# define ASN1_F_NDEF_SUFFIX 136 +# define ASN1_F_OID_MODULE_INIT 174 +# define ASN1_F_PARSE_TAGGING 182 +# define ASN1_F_PKCS5_PBE2_SET_IV 167 +# define ASN1_F_PKCS5_PBE2_SET_SCRYPT 231 +# define ASN1_F_PKCS5_PBE_SET 202 +# define ASN1_F_PKCS5_PBE_SET0_ALGOR 215 +# define ASN1_F_PKCS5_PBKDF2_SET 219 +# define ASN1_F_PKCS5_SCRYPT_SET 232 +# define ASN1_F_SMIME_READ_ASN1 212 +# define ASN1_F_SMIME_TEXT 213 +# define ASN1_F_STABLE_GET 138 +# define ASN1_F_STBL_MODULE_INIT 223 +# define ASN1_F_UINT32_C2I 105 +# define ASN1_F_UINT32_NEW 139 +# define ASN1_F_UINT64_C2I 112 +# define ASN1_F_UINT64_NEW 141 +# define ASN1_F_X509_CRL_ADD0_REVOKED 169 +# define ASN1_F_X509_INFO_NEW 170 +# define ASN1_F_X509_NAME_ENCODE 203 +# define ASN1_F_X509_NAME_EX_D2I 158 +# define ASN1_F_X509_NAME_EX_NEW 171 +# define ASN1_F_X509_PKEY_NEW 173 + +/* + * ASN1 reason codes. + */ +# define ASN1_R_ADDING_OBJECT 171 +# define ASN1_R_ASN1_PARSE_ERROR 203 +# define ASN1_R_ASN1_SIG_PARSE_ERROR 204 +# define ASN1_R_AUX_ERROR 100 +# define ASN1_R_BAD_OBJECT_HEADER 102 +# define ASN1_R_BMPSTRING_IS_WRONG_LENGTH 214 +# define ASN1_R_BN_LIB 105 +# define ASN1_R_BOOLEAN_IS_WRONG_LENGTH 106 +# define ASN1_R_BUFFER_TOO_SMALL 107 +# define ASN1_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER 108 +# define ASN1_R_CONTEXT_NOT_INITIALISED 217 +# define ASN1_R_DATA_IS_WRONG 109 +# define ASN1_R_DECODE_ERROR 110 +# define ASN1_R_DEPTH_EXCEEDED 174 +# define ASN1_R_DIGEST_AND_KEY_TYPE_NOT_SUPPORTED 198 +# define ASN1_R_ENCODE_ERROR 112 +# define ASN1_R_ERROR_GETTING_TIME 173 +# define ASN1_R_ERROR_LOADING_SECTION 172 +# define ASN1_R_ERROR_SETTING_CIPHER_PARAMS 114 +# define ASN1_R_EXPECTING_AN_INTEGER 115 +# define ASN1_R_EXPECTING_AN_OBJECT 116 +# define ASN1_R_EXPLICIT_LENGTH_MISMATCH 119 +# define ASN1_R_EXPLICIT_TAG_NOT_CONSTRUCTED 120 +# define ASN1_R_FIELD_MISSING 121 +# define ASN1_R_FIRST_NUM_TOO_LARGE 122 +# define ASN1_R_HEADER_TOO_LONG 123 +# define ASN1_R_ILLEGAL_BITSTRING_FORMAT 175 +# define ASN1_R_ILLEGAL_BOOLEAN 176 +# define ASN1_R_ILLEGAL_CHARACTERS 124 +# define ASN1_R_ILLEGAL_FORMAT 177 +# define ASN1_R_ILLEGAL_HEX 178 +# define ASN1_R_ILLEGAL_IMPLICIT_TAG 179 +# define ASN1_R_ILLEGAL_INTEGER 180 +# define ASN1_R_ILLEGAL_NEGATIVE_VALUE 226 +# define ASN1_R_ILLEGAL_NESTED_TAGGING 181 +# define ASN1_R_ILLEGAL_NULL 125 +# define ASN1_R_ILLEGAL_NULL_VALUE 182 +# define ASN1_R_ILLEGAL_OBJECT 183 +# define ASN1_R_ILLEGAL_OPTIONAL_ANY 126 +# define ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE 170 +# define ASN1_R_ILLEGAL_PADDING 221 +# define ASN1_R_ILLEGAL_TAGGED_ANY 127 +# define ASN1_R_ILLEGAL_TIME_VALUE 184 +# define ASN1_R_ILLEGAL_ZERO_CONTENT 222 +# define ASN1_R_INTEGER_NOT_ASCII_FORMAT 185 +# define ASN1_R_INTEGER_TOO_LARGE_FOR_LONG 128 +# define ASN1_R_INVALID_BIT_STRING_BITS_LEFT 220 +# define ASN1_R_INVALID_BMPSTRING_LENGTH 129 +# define ASN1_R_INVALID_DIGIT 130 +# define ASN1_R_INVALID_MIME_TYPE 205 +# define ASN1_R_INVALID_MODIFIER 186 +# define ASN1_R_INVALID_NUMBER 187 +# define ASN1_R_INVALID_OBJECT_ENCODING 216 +# define ASN1_R_INVALID_SCRYPT_PARAMETERS 227 +# define ASN1_R_INVALID_SEPARATOR 131 +# define ASN1_R_INVALID_STRING_TABLE_VALUE 218 +# define ASN1_R_INVALID_UNIVERSALSTRING_LENGTH 133 +# define ASN1_R_INVALID_UTF8STRING 134 +# define ASN1_R_INVALID_VALUE 219 +# define ASN1_R_LIST_ERROR 188 +# define ASN1_R_MIME_NO_CONTENT_TYPE 206 +# define ASN1_R_MIME_PARSE_ERROR 207 +# define ASN1_R_MIME_SIG_PARSE_ERROR 208 +# define ASN1_R_MISSING_EOC 137 +# define ASN1_R_MISSING_SECOND_NUMBER 138 +# define ASN1_R_MISSING_VALUE 189 +# define ASN1_R_MSTRING_NOT_UNIVERSAL 139 +# define ASN1_R_MSTRING_WRONG_TAG 140 +# define ASN1_R_NESTED_ASN1_STRING 197 +# define ASN1_R_NESTED_TOO_DEEP 201 +# define ASN1_R_NON_HEX_CHARACTERS 141 +# define ASN1_R_NOT_ASCII_FORMAT 190 +# define ASN1_R_NOT_ENOUGH_DATA 142 +# define ASN1_R_NO_CONTENT_TYPE 209 +# define ASN1_R_NO_MATCHING_CHOICE_TYPE 143 +# define ASN1_R_NO_MULTIPART_BODY_FAILURE 210 +# define ASN1_R_NO_MULTIPART_BOUNDARY 211 +# define ASN1_R_NO_SIG_CONTENT_TYPE 212 +# define ASN1_R_NULL_IS_WRONG_LENGTH 144 +# define ASN1_R_OBJECT_NOT_ASCII_FORMAT 191 +# define ASN1_R_ODD_NUMBER_OF_CHARS 145 +# define ASN1_R_SECOND_NUMBER_TOO_LARGE 147 +# define ASN1_R_SEQUENCE_LENGTH_MISMATCH 148 +# define ASN1_R_SEQUENCE_NOT_CONSTRUCTED 149 +# define ASN1_R_SEQUENCE_OR_SET_NEEDS_CONFIG 192 +# define ASN1_R_SHORT_LINE 150 +# define ASN1_R_SIG_INVALID_MIME_TYPE 213 +# define ASN1_R_STREAMING_NOT_SUPPORTED 202 +# define ASN1_R_STRING_TOO_LONG 151 +# define ASN1_R_STRING_TOO_SHORT 152 +# define ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 154 +# define ASN1_R_TIME_NOT_ASCII_FORMAT 193 +# define ASN1_R_TOO_LARGE 223 +# define ASN1_R_TOO_LONG 155 +# define ASN1_R_TOO_SMALL 224 +# define ASN1_R_TYPE_NOT_CONSTRUCTED 156 +# define ASN1_R_TYPE_NOT_PRIMITIVE 195 +# define ASN1_R_UNEXPECTED_EOC 159 +# define ASN1_R_UNIVERSALSTRING_IS_WRONG_LENGTH 215 +# define ASN1_R_UNKNOWN_FORMAT 160 +# define ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM 161 +# define ASN1_R_UNKNOWN_OBJECT_TYPE 162 +# define ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE 163 +# define ASN1_R_UNKNOWN_SIGNATURE_ALGORITHM 199 +# define ASN1_R_UNKNOWN_TAG 194 +# define ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE 164 +# define ASN1_R_UNSUPPORTED_CIPHER 228 +# define ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE 167 +# define ASN1_R_UNSUPPORTED_TYPE 196 +# define ASN1_R_WRONG_INTEGER_TYPE 225 +# define ASN1_R_WRONG_PUBLIC_KEY_TYPE 200 +# define ASN1_R_WRONG_TAG 168 + +#endif diff --git a/ONVIF/include/openssl/include/openssl/asn1t.h b/ONVIF/include/openssl/include/openssl/asn1t.h new file mode 100644 index 0000000..a450ba0 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/asn1t.h @@ -0,0 +1,945 @@ +/* + * Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_ASN1T_H +# define HEADER_ASN1T_H + +# include +# include +# include + +# ifdef OPENSSL_BUILD_SHLIBCRYPTO +# undef OPENSSL_EXTERN +# define OPENSSL_EXTERN OPENSSL_EXPORT +# endif + +/* ASN1 template defines, structures and functions */ + +#ifdef __cplusplus +extern "C" { +#endif + +# ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION + +/* Macro to obtain ASN1_ADB pointer from a type (only used internally) */ +# define ASN1_ADB_ptr(iptr) ((const ASN1_ADB *)(iptr)) + +/* Macros for start and end of ASN1_ITEM definition */ + +# define ASN1_ITEM_start(itname) \ + const ASN1_ITEM itname##_it = { + +# define static_ASN1_ITEM_start(itname) \ + static const ASN1_ITEM itname##_it = { + +# define ASN1_ITEM_end(itname) \ + }; + +# else + +/* Macro to obtain ASN1_ADB pointer from a type (only used internally) */ +# define ASN1_ADB_ptr(iptr) ((const ASN1_ADB *)((iptr)())) + +/* Macros for start and end of ASN1_ITEM definition */ + +# define ASN1_ITEM_start(itname) \ + const ASN1_ITEM * itname##_it(void) \ + { \ + static const ASN1_ITEM local_it = { + +# define static_ASN1_ITEM_start(itname) \ + static ASN1_ITEM_start(itname) + +# define ASN1_ITEM_end(itname) \ + }; \ + return &local_it; \ + } + +# endif + +/* Macros to aid ASN1 template writing */ + +# define ASN1_ITEM_TEMPLATE(tname) \ + static const ASN1_TEMPLATE tname##_item_tt + +# define ASN1_ITEM_TEMPLATE_END(tname) \ + ;\ + ASN1_ITEM_start(tname) \ + ASN1_ITYPE_PRIMITIVE,\ + -1,\ + &tname##_item_tt,\ + 0,\ + NULL,\ + 0,\ + #tname \ + ASN1_ITEM_end(tname) +# define static_ASN1_ITEM_TEMPLATE_END(tname) \ + ;\ + static_ASN1_ITEM_start(tname) \ + ASN1_ITYPE_PRIMITIVE,\ + -1,\ + &tname##_item_tt,\ + 0,\ + NULL,\ + 0,\ + #tname \ + ASN1_ITEM_end(tname) + +/* This is a ASN1 type which just embeds a template */ + +/*- + * This pair helps declare a SEQUENCE. We can do: + * + * ASN1_SEQUENCE(stname) = { + * ... SEQUENCE components ... + * } ASN1_SEQUENCE_END(stname) + * + * This will produce an ASN1_ITEM called stname_it + * for a structure called stname. + * + * If you want the same structure but a different + * name then use: + * + * ASN1_SEQUENCE(itname) = { + * ... SEQUENCE components ... + * } ASN1_SEQUENCE_END_name(stname, itname) + * + * This will create an item called itname_it using + * a structure called stname. + */ + +# define ASN1_SEQUENCE(tname) \ + static const ASN1_TEMPLATE tname##_seq_tt[] + +# define ASN1_SEQUENCE_END(stname) ASN1_SEQUENCE_END_name(stname, stname) + +# define static_ASN1_SEQUENCE_END(stname) static_ASN1_SEQUENCE_END_name(stname, stname) + +# define ASN1_SEQUENCE_END_name(stname, tname) \ + ;\ + ASN1_ITEM_start(tname) \ + ASN1_ITYPE_SEQUENCE,\ + V_ASN1_SEQUENCE,\ + tname##_seq_tt,\ + sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ + NULL,\ + sizeof(stname),\ + #tname \ + ASN1_ITEM_end(tname) + +# define static_ASN1_SEQUENCE_END_name(stname, tname) \ + ;\ + static_ASN1_ITEM_start(tname) \ + ASN1_ITYPE_SEQUENCE,\ + V_ASN1_SEQUENCE,\ + tname##_seq_tt,\ + sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ + NULL,\ + sizeof(stname),\ + #stname \ + ASN1_ITEM_end(tname) + +# define ASN1_NDEF_SEQUENCE(tname) \ + ASN1_SEQUENCE(tname) + +# define ASN1_NDEF_SEQUENCE_cb(tname, cb) \ + ASN1_SEQUENCE_cb(tname, cb) + +# define ASN1_SEQUENCE_cb(tname, cb) \ + static const ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0}; \ + ASN1_SEQUENCE(tname) + +# define ASN1_BROKEN_SEQUENCE(tname) \ + static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_BROKEN, 0, 0, 0, 0}; \ + ASN1_SEQUENCE(tname) + +# define ASN1_SEQUENCE_ref(tname, cb) \ + static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_REFCOUNT, offsetof(tname, references), offsetof(tname, lock), cb, 0}; \ + ASN1_SEQUENCE(tname) + +# define ASN1_SEQUENCE_enc(tname, enc, cb) \ + static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_ENCODING, 0, 0, cb, offsetof(tname, enc)}; \ + ASN1_SEQUENCE(tname) + +# define ASN1_NDEF_SEQUENCE_END(tname) \ + ;\ + ASN1_ITEM_start(tname) \ + ASN1_ITYPE_NDEF_SEQUENCE,\ + V_ASN1_SEQUENCE,\ + tname##_seq_tt,\ + sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ + NULL,\ + sizeof(tname),\ + #tname \ + ASN1_ITEM_end(tname) +# define static_ASN1_NDEF_SEQUENCE_END(tname) \ + ;\ + static_ASN1_ITEM_start(tname) \ + ASN1_ITYPE_NDEF_SEQUENCE,\ + V_ASN1_SEQUENCE,\ + tname##_seq_tt,\ + sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ + NULL,\ + sizeof(tname),\ + #tname \ + ASN1_ITEM_end(tname) + +# define ASN1_BROKEN_SEQUENCE_END(stname) ASN1_SEQUENCE_END_ref(stname, stname) +# define static_ASN1_BROKEN_SEQUENCE_END(stname) \ + static_ASN1_SEQUENCE_END_ref(stname, stname) + +# define ASN1_SEQUENCE_END_enc(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname) + +# define ASN1_SEQUENCE_END_cb(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname) +# define static_ASN1_SEQUENCE_END_cb(stname, tname) static_ASN1_SEQUENCE_END_ref(stname, tname) + +# define ASN1_SEQUENCE_END_ref(stname, tname) \ + ;\ + ASN1_ITEM_start(tname) \ + ASN1_ITYPE_SEQUENCE,\ + V_ASN1_SEQUENCE,\ + tname##_seq_tt,\ + sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ + &tname##_aux,\ + sizeof(stname),\ + #tname \ + ASN1_ITEM_end(tname) +# define static_ASN1_SEQUENCE_END_ref(stname, tname) \ + ;\ + static_ASN1_ITEM_start(tname) \ + ASN1_ITYPE_SEQUENCE,\ + V_ASN1_SEQUENCE,\ + tname##_seq_tt,\ + sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ + &tname##_aux,\ + sizeof(stname),\ + #stname \ + ASN1_ITEM_end(tname) + +# define ASN1_NDEF_SEQUENCE_END_cb(stname, tname) \ + ;\ + ASN1_ITEM_start(tname) \ + ASN1_ITYPE_NDEF_SEQUENCE,\ + V_ASN1_SEQUENCE,\ + tname##_seq_tt,\ + sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ + &tname##_aux,\ + sizeof(stname),\ + #stname \ + ASN1_ITEM_end(tname) + +/*- + * This pair helps declare a CHOICE type. We can do: + * + * ASN1_CHOICE(chname) = { + * ... CHOICE options ... + * ASN1_CHOICE_END(chname) + * + * This will produce an ASN1_ITEM called chname_it + * for a structure called chname. The structure + * definition must look like this: + * typedef struct { + * int type; + * union { + * ASN1_SOMETHING *opt1; + * ASN1_SOMEOTHER *opt2; + * } value; + * } chname; + * + * the name of the selector must be 'type'. + * to use an alternative selector name use the + * ASN1_CHOICE_END_selector() version. + */ + +# define ASN1_CHOICE(tname) \ + static const ASN1_TEMPLATE tname##_ch_tt[] + +# define ASN1_CHOICE_cb(tname, cb) \ + static const ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0}; \ + ASN1_CHOICE(tname) + +# define ASN1_CHOICE_END(stname) ASN1_CHOICE_END_name(stname, stname) + +# define static_ASN1_CHOICE_END(stname) static_ASN1_CHOICE_END_name(stname, stname) + +# define ASN1_CHOICE_END_name(stname, tname) ASN1_CHOICE_END_selector(stname, tname, type) + +# define static_ASN1_CHOICE_END_name(stname, tname) static_ASN1_CHOICE_END_selector(stname, tname, type) + +# define ASN1_CHOICE_END_selector(stname, tname, selname) \ + ;\ + ASN1_ITEM_start(tname) \ + ASN1_ITYPE_CHOICE,\ + offsetof(stname,selname) ,\ + tname##_ch_tt,\ + sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\ + NULL,\ + sizeof(stname),\ + #stname \ + ASN1_ITEM_end(tname) + +# define static_ASN1_CHOICE_END_selector(stname, tname, selname) \ + ;\ + static_ASN1_ITEM_start(tname) \ + ASN1_ITYPE_CHOICE,\ + offsetof(stname,selname) ,\ + tname##_ch_tt,\ + sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\ + NULL,\ + sizeof(stname),\ + #stname \ + ASN1_ITEM_end(tname) + +# define ASN1_CHOICE_END_cb(stname, tname, selname) \ + ;\ + ASN1_ITEM_start(tname) \ + ASN1_ITYPE_CHOICE,\ + offsetof(stname,selname) ,\ + tname##_ch_tt,\ + sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\ + &tname##_aux,\ + sizeof(stname),\ + #stname \ + ASN1_ITEM_end(tname) + +/* This helps with the template wrapper form of ASN1_ITEM */ + +# define ASN1_EX_TEMPLATE_TYPE(flags, tag, name, type) { \ + (flags), (tag), 0,\ + #name, ASN1_ITEM_ref(type) } + +/* These help with SEQUENCE or CHOICE components */ + +/* used to declare other types */ + +# define ASN1_EX_TYPE(flags, tag, stname, field, type) { \ + (flags), (tag), offsetof(stname, field),\ + #field, ASN1_ITEM_ref(type) } + +/* implicit and explicit helper macros */ + +# define ASN1_IMP_EX(stname, field, type, tag, ex) \ + ASN1_EX_TYPE(ASN1_TFLG_IMPLICIT | (ex), tag, stname, field, type) + +# define ASN1_EXP_EX(stname, field, type, tag, ex) \ + ASN1_EX_TYPE(ASN1_TFLG_EXPLICIT | (ex), tag, stname, field, type) + +/* Any defined by macros: the field used is in the table itself */ + +# ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION +# define ASN1_ADB_OBJECT(tblname) { ASN1_TFLG_ADB_OID, -1, 0, #tblname, (const ASN1_ITEM *)&(tblname##_adb) } +# define ASN1_ADB_INTEGER(tblname) { ASN1_TFLG_ADB_INT, -1, 0, #tblname, (const ASN1_ITEM *)&(tblname##_adb) } +# else +# define ASN1_ADB_OBJECT(tblname) { ASN1_TFLG_ADB_OID, -1, 0, #tblname, tblname##_adb } +# define ASN1_ADB_INTEGER(tblname) { ASN1_TFLG_ADB_INT, -1, 0, #tblname, tblname##_adb } +# endif +/* Plain simple type */ +# define ASN1_SIMPLE(stname, field, type) ASN1_EX_TYPE(0,0, stname, field, type) +/* Embedded simple type */ +# define ASN1_EMBED(stname, field, type) ASN1_EX_TYPE(ASN1_TFLG_EMBED,0, stname, field, type) + +/* OPTIONAL simple type */ +# define ASN1_OPT(stname, field, type) ASN1_EX_TYPE(ASN1_TFLG_OPTIONAL, 0, stname, field, type) +# define ASN1_OPT_EMBED(stname, field, type) ASN1_EX_TYPE(ASN1_TFLG_OPTIONAL|ASN1_TFLG_EMBED, 0, stname, field, type) + +/* IMPLICIT tagged simple type */ +# define ASN1_IMP(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, 0) +# define ASN1_IMP_EMBED(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_EMBED) + +/* IMPLICIT tagged OPTIONAL simple type */ +# define ASN1_IMP_OPT(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL) +# define ASN1_IMP_OPT_EMBED(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL|ASN1_TFLG_EMBED) + +/* Same as above but EXPLICIT */ + +# define ASN1_EXP(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, 0) +# define ASN1_EXP_EMBED(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_EMBED) +# define ASN1_EXP_OPT(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL) +# define ASN1_EXP_OPT_EMBED(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL|ASN1_TFLG_EMBED) + +/* SEQUENCE OF type */ +# define ASN1_SEQUENCE_OF(stname, field, type) \ + ASN1_EX_TYPE(ASN1_TFLG_SEQUENCE_OF, 0, stname, field, type) + +/* OPTIONAL SEQUENCE OF */ +# define ASN1_SEQUENCE_OF_OPT(stname, field, type) \ + ASN1_EX_TYPE(ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL, 0, stname, field, type) + +/* Same as above but for SET OF */ + +# define ASN1_SET_OF(stname, field, type) \ + ASN1_EX_TYPE(ASN1_TFLG_SET_OF, 0, stname, field, type) + +# define ASN1_SET_OF_OPT(stname, field, type) \ + ASN1_EX_TYPE(ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL, 0, stname, field, type) + +/* Finally compound types of SEQUENCE, SET, IMPLICIT, EXPLICIT and OPTIONAL */ + +# define ASN1_IMP_SET_OF(stname, field, type, tag) \ + ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF) + +# define ASN1_EXP_SET_OF(stname, field, type, tag) \ + ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF) + +# define ASN1_IMP_SET_OF_OPT(stname, field, type, tag) \ + ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL) + +# define ASN1_EXP_SET_OF_OPT(stname, field, type, tag) \ + ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL) + +# define ASN1_IMP_SEQUENCE_OF(stname, field, type, tag) \ + ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF) + +# define ASN1_IMP_SEQUENCE_OF_OPT(stname, field, type, tag) \ + ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL) + +# define ASN1_EXP_SEQUENCE_OF(stname, field, type, tag) \ + ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF) + +# define ASN1_EXP_SEQUENCE_OF_OPT(stname, field, type, tag) \ + ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL) + +/* EXPLICIT using indefinite length constructed form */ +# define ASN1_NDEF_EXP(stname, field, type, tag) \ + ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_NDEF) + +/* EXPLICIT OPTIONAL using indefinite length constructed form */ +# define ASN1_NDEF_EXP_OPT(stname, field, type, tag) \ + ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL|ASN1_TFLG_NDEF) + +/* Macros for the ASN1_ADB structure */ + +# define ASN1_ADB(name) \ + static const ASN1_ADB_TABLE name##_adbtbl[] + +# ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION + +# define ASN1_ADB_END(name, flags, field, adb_cb, def, none) \ + ;\ + static const ASN1_ADB name##_adb = {\ + flags,\ + offsetof(name, field),\ + adb_cb,\ + name##_adbtbl,\ + sizeof(name##_adbtbl) / sizeof(ASN1_ADB_TABLE),\ + def,\ + none\ + } + +# else + +# define ASN1_ADB_END(name, flags, field, adb_cb, def, none) \ + ;\ + static const ASN1_ITEM *name##_adb(void) \ + { \ + static const ASN1_ADB internal_adb = \ + {\ + flags,\ + offsetof(name, field),\ + adb_cb,\ + name##_adbtbl,\ + sizeof(name##_adbtbl) / sizeof(ASN1_ADB_TABLE),\ + def,\ + none\ + }; \ + return (const ASN1_ITEM *) &internal_adb; \ + } \ + void dummy_function(void) + +# endif + +# define ADB_ENTRY(val, template) {val, template} + +# define ASN1_ADB_TEMPLATE(name) \ + static const ASN1_TEMPLATE name##_tt + +/* + * This is the ASN1 template structure that defines a wrapper round the + * actual type. It determines the actual position of the field in the value + * structure, various flags such as OPTIONAL and the field name. + */ + +struct ASN1_TEMPLATE_st { + unsigned long flags; /* Various flags */ + long tag; /* tag, not used if no tagging */ + unsigned long offset; /* Offset of this field in structure */ + const char *field_name; /* Field name */ + ASN1_ITEM_EXP *item; /* Relevant ASN1_ITEM or ASN1_ADB */ +}; + +/* Macro to extract ASN1_ITEM and ASN1_ADB pointer from ASN1_TEMPLATE */ + +# define ASN1_TEMPLATE_item(t) (t->item_ptr) +# define ASN1_TEMPLATE_adb(t) (t->item_ptr) + +typedef struct ASN1_ADB_TABLE_st ASN1_ADB_TABLE; +typedef struct ASN1_ADB_st ASN1_ADB; + +struct ASN1_ADB_st { + unsigned long flags; /* Various flags */ + unsigned long offset; /* Offset of selector field */ + int (*adb_cb)(long *psel); /* Application callback */ + const ASN1_ADB_TABLE *tbl; /* Table of possible types */ + long tblcount; /* Number of entries in tbl */ + const ASN1_TEMPLATE *default_tt; /* Type to use if no match */ + const ASN1_TEMPLATE *null_tt; /* Type to use if selector is NULL */ +}; + +struct ASN1_ADB_TABLE_st { + long value; /* NID for an object or value for an int */ + const ASN1_TEMPLATE tt; /* item for this value */ +}; + +/* template flags */ + +/* Field is optional */ +# define ASN1_TFLG_OPTIONAL (0x1) + +/* Field is a SET OF */ +# define ASN1_TFLG_SET_OF (0x1 << 1) + +/* Field is a SEQUENCE OF */ +# define ASN1_TFLG_SEQUENCE_OF (0x2 << 1) + +/* + * Special case: this refers to a SET OF that will be sorted into DER order + * when encoded *and* the corresponding STACK will be modified to match the + * new order. + */ +# define ASN1_TFLG_SET_ORDER (0x3 << 1) + +/* Mask for SET OF or SEQUENCE OF */ +# define ASN1_TFLG_SK_MASK (0x3 << 1) + +/* + * These flags mean the tag should be taken from the tag field. If EXPLICIT + * then the underlying type is used for the inner tag. + */ + +/* IMPLICIT tagging */ +# define ASN1_TFLG_IMPTAG (0x1 << 3) + +/* EXPLICIT tagging, inner tag from underlying type */ +# define ASN1_TFLG_EXPTAG (0x2 << 3) + +# define ASN1_TFLG_TAG_MASK (0x3 << 3) + +/* context specific IMPLICIT */ +# define ASN1_TFLG_IMPLICIT (ASN1_TFLG_IMPTAG|ASN1_TFLG_CONTEXT) + +/* context specific EXPLICIT */ +# define ASN1_TFLG_EXPLICIT (ASN1_TFLG_EXPTAG|ASN1_TFLG_CONTEXT) + +/* + * If tagging is in force these determine the type of tag to use. Otherwise + * the tag is determined by the underlying type. These values reflect the + * actual octet format. + */ + +/* Universal tag */ +# define ASN1_TFLG_UNIVERSAL (0x0<<6) +/* Application tag */ +# define ASN1_TFLG_APPLICATION (0x1<<6) +/* Context specific tag */ +# define ASN1_TFLG_CONTEXT (0x2<<6) +/* Private tag */ +# define ASN1_TFLG_PRIVATE (0x3<<6) + +# define ASN1_TFLG_TAG_CLASS (0x3<<6) + +/* + * These are for ANY DEFINED BY type. In this case the 'item' field points to + * an ASN1_ADB structure which contains a table of values to decode the + * relevant type + */ + +# define ASN1_TFLG_ADB_MASK (0x3<<8) + +# define ASN1_TFLG_ADB_OID (0x1<<8) + +# define ASN1_TFLG_ADB_INT (0x1<<9) + +/* + * This flag when present in a SEQUENCE OF, SET OF or EXPLICIT causes + * indefinite length constructed encoding to be used if required. + */ + +# define ASN1_TFLG_NDEF (0x1<<11) + +/* Field is embedded and not a pointer */ +# define ASN1_TFLG_EMBED (0x1 << 12) + +/* This is the actual ASN1 item itself */ + +struct ASN1_ITEM_st { + char itype; /* The item type, primitive, SEQUENCE, CHOICE + * or extern */ + long utype; /* underlying type */ + const ASN1_TEMPLATE *templates; /* If SEQUENCE or CHOICE this contains + * the contents */ + long tcount; /* Number of templates if SEQUENCE or CHOICE */ + const void *funcs; /* functions that handle this type */ + long size; /* Structure size (usually) */ + const char *sname; /* Structure name */ +}; + +/*- + * These are values for the itype field and + * determine how the type is interpreted. + * + * For PRIMITIVE types the underlying type + * determines the behaviour if items is NULL. + * + * Otherwise templates must contain a single + * template and the type is treated in the + * same way as the type specified in the template. + * + * For SEQUENCE types the templates field points + * to the members, the size field is the + * structure size. + * + * For CHOICE types the templates field points + * to each possible member (typically a union) + * and the 'size' field is the offset of the + * selector. + * + * The 'funcs' field is used for application + * specific functions. + * + * The EXTERN type uses a new style d2i/i2d. + * The new style should be used where possible + * because it avoids things like the d2i IMPLICIT + * hack. + * + * MSTRING is a multiple string type, it is used + * for a CHOICE of character strings where the + * actual strings all occupy an ASN1_STRING + * structure. In this case the 'utype' field + * has a special meaning, it is used as a mask + * of acceptable types using the B_ASN1 constants. + * + * NDEF_SEQUENCE is the same as SEQUENCE except + * that it will use indefinite length constructed + * encoding if requested. + * + */ + +# define ASN1_ITYPE_PRIMITIVE 0x0 + +# define ASN1_ITYPE_SEQUENCE 0x1 + +# define ASN1_ITYPE_CHOICE 0x2 + +# define ASN1_ITYPE_EXTERN 0x4 + +# define ASN1_ITYPE_MSTRING 0x5 + +# define ASN1_ITYPE_NDEF_SEQUENCE 0x6 + +/* + * Cache for ASN1 tag and length, so we don't keep re-reading it for things + * like CHOICE + */ + +struct ASN1_TLC_st { + char valid; /* Values below are valid */ + int ret; /* return value */ + long plen; /* length */ + int ptag; /* class value */ + int pclass; /* class value */ + int hdrlen; /* header length */ +}; + +/* Typedefs for ASN1 function pointers */ +typedef int ASN1_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, + const ASN1_ITEM *it, int tag, int aclass, char opt, + ASN1_TLC *ctx); + +typedef int ASN1_ex_i2d(ASN1_VALUE **pval, unsigned char **out, + const ASN1_ITEM *it, int tag, int aclass); +typedef int ASN1_ex_new_func(ASN1_VALUE **pval, const ASN1_ITEM *it); +typedef void ASN1_ex_free_func(ASN1_VALUE **pval, const ASN1_ITEM *it); + +typedef int ASN1_ex_print_func(BIO *out, ASN1_VALUE **pval, + int indent, const char *fname, + const ASN1_PCTX *pctx); + +typedef int ASN1_primitive_i2c(ASN1_VALUE **pval, unsigned char *cont, + int *putype, const ASN1_ITEM *it); +typedef int ASN1_primitive_c2i(ASN1_VALUE **pval, const unsigned char *cont, + int len, int utype, char *free_cont, + const ASN1_ITEM *it); +typedef int ASN1_primitive_print(BIO *out, ASN1_VALUE **pval, + const ASN1_ITEM *it, int indent, + const ASN1_PCTX *pctx); + +typedef struct ASN1_EXTERN_FUNCS_st { + void *app_data; + ASN1_ex_new_func *asn1_ex_new; + ASN1_ex_free_func *asn1_ex_free; + ASN1_ex_free_func *asn1_ex_clear; + ASN1_ex_d2i *asn1_ex_d2i; + ASN1_ex_i2d *asn1_ex_i2d; + ASN1_ex_print_func *asn1_ex_print; +} ASN1_EXTERN_FUNCS; + +typedef struct ASN1_PRIMITIVE_FUNCS_st { + void *app_data; + unsigned long flags; + ASN1_ex_new_func *prim_new; + ASN1_ex_free_func *prim_free; + ASN1_ex_free_func *prim_clear; + ASN1_primitive_c2i *prim_c2i; + ASN1_primitive_i2c *prim_i2c; + ASN1_primitive_print *prim_print; +} ASN1_PRIMITIVE_FUNCS; + +/* + * This is the ASN1_AUX structure: it handles various miscellaneous + * requirements. For example the use of reference counts and an informational + * callback. The "informational callback" is called at various points during + * the ASN1 encoding and decoding. It can be used to provide minor + * customisation of the structures used. This is most useful where the + * supplied routines *almost* do the right thing but need some extra help at + * a few points. If the callback returns zero then it is assumed a fatal + * error has occurred and the main operation should be abandoned. If major + * changes in the default behaviour are required then an external type is + * more appropriate. + */ + +typedef int ASN1_aux_cb(int operation, ASN1_VALUE **in, const ASN1_ITEM *it, + void *exarg); + +typedef struct ASN1_AUX_st { + void *app_data; + int flags; + int ref_offset; /* Offset of reference value */ + int ref_lock; /* Lock type to use */ + ASN1_aux_cb *asn1_cb; + int enc_offset; /* Offset of ASN1_ENCODING structure */ +} ASN1_AUX; + +/* For print related callbacks exarg points to this structure */ +typedef struct ASN1_PRINT_ARG_st { + BIO *out; + int indent; + const ASN1_PCTX *pctx; +} ASN1_PRINT_ARG; + +/* For streaming related callbacks exarg points to this structure */ +typedef struct ASN1_STREAM_ARG_st { + /* BIO to stream through */ + BIO *out; + /* BIO with filters appended */ + BIO *ndef_bio; + /* Streaming I/O boundary */ + unsigned char **boundary; +} ASN1_STREAM_ARG; + +/* Flags in ASN1_AUX */ + +/* Use a reference count */ +# define ASN1_AFLG_REFCOUNT 1 +/* Save the encoding of structure (useful for signatures) */ +# define ASN1_AFLG_ENCODING 2 +/* The Sequence length is invalid */ +# define ASN1_AFLG_BROKEN 4 + +/* operation values for asn1_cb */ + +# define ASN1_OP_NEW_PRE 0 +# define ASN1_OP_NEW_POST 1 +# define ASN1_OP_FREE_PRE 2 +# define ASN1_OP_FREE_POST 3 +# define ASN1_OP_D2I_PRE 4 +# define ASN1_OP_D2I_POST 5 +# define ASN1_OP_I2D_PRE 6 +# define ASN1_OP_I2D_POST 7 +# define ASN1_OP_PRINT_PRE 8 +# define ASN1_OP_PRINT_POST 9 +# define ASN1_OP_STREAM_PRE 10 +# define ASN1_OP_STREAM_POST 11 +# define ASN1_OP_DETACHED_PRE 12 +# define ASN1_OP_DETACHED_POST 13 + +/* Macro to implement a primitive type */ +# define IMPLEMENT_ASN1_TYPE(stname) IMPLEMENT_ASN1_TYPE_ex(stname, stname, 0) +# define IMPLEMENT_ASN1_TYPE_ex(itname, vname, ex) \ + ASN1_ITEM_start(itname) \ + ASN1_ITYPE_PRIMITIVE, V_##vname, NULL, 0, NULL, ex, #itname \ + ASN1_ITEM_end(itname) + +/* Macro to implement a multi string type */ +# define IMPLEMENT_ASN1_MSTRING(itname, mask) \ + ASN1_ITEM_start(itname) \ + ASN1_ITYPE_MSTRING, mask, NULL, 0, NULL, sizeof(ASN1_STRING), #itname \ + ASN1_ITEM_end(itname) + +# define IMPLEMENT_EXTERN_ASN1(sname, tag, fptrs) \ + ASN1_ITEM_start(sname) \ + ASN1_ITYPE_EXTERN, \ + tag, \ + NULL, \ + 0, \ + &fptrs, \ + 0, \ + #sname \ + ASN1_ITEM_end(sname) + +/* Macro to implement standard functions in terms of ASN1_ITEM structures */ + +# define IMPLEMENT_ASN1_FUNCTIONS(stname) IMPLEMENT_ASN1_FUNCTIONS_fname(stname, stname, stname) + +# define IMPLEMENT_ASN1_FUNCTIONS_name(stname, itname) IMPLEMENT_ASN1_FUNCTIONS_fname(stname, itname, itname) + +# define IMPLEMENT_ASN1_FUNCTIONS_ENCODE_name(stname, itname) \ + IMPLEMENT_ASN1_FUNCTIONS_ENCODE_fname(stname, itname, itname) + +# define IMPLEMENT_STATIC_ASN1_ALLOC_FUNCTIONS(stname) \ + IMPLEMENT_ASN1_ALLOC_FUNCTIONS_pfname(static, stname, stname, stname) + +# define IMPLEMENT_ASN1_ALLOC_FUNCTIONS(stname) \ + IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, stname, stname) + +# define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_pfname(pre, stname, itname, fname) \ + pre stname *fname##_new(void) \ + { \ + return (stname *)ASN1_item_new(ASN1_ITEM_rptr(itname)); \ + } \ + pre void fname##_free(stname *a) \ + { \ + ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \ + } + +# define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) \ + stname *fname##_new(void) \ + { \ + return (stname *)ASN1_item_new(ASN1_ITEM_rptr(itname)); \ + } \ + void fname##_free(stname *a) \ + { \ + ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \ + } + +# define IMPLEMENT_ASN1_FUNCTIONS_fname(stname, itname, fname) \ + IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname) \ + IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) + +# define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname) \ + stname *d2i_##fname(stname **a, const unsigned char **in, long len) \ + { \ + return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\ + } \ + int i2d_##fname(stname *a, unsigned char **out) \ + { \ + return ASN1_item_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\ + } + +# define IMPLEMENT_ASN1_NDEF_FUNCTION(stname) \ + int i2d_##stname##_NDEF(stname *a, unsigned char **out) \ + { \ + return ASN1_item_ndef_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(stname));\ + } + +# define IMPLEMENT_STATIC_ASN1_ENCODE_FUNCTIONS(stname) \ + static stname *d2i_##stname(stname **a, \ + const unsigned char **in, long len) \ + { \ + return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, \ + ASN1_ITEM_rptr(stname)); \ + } \ + static int i2d_##stname(stname *a, unsigned char **out) \ + { \ + return ASN1_item_i2d((ASN1_VALUE *)a, out, \ + ASN1_ITEM_rptr(stname)); \ + } + +/* + * This includes evil casts to remove const: they will go away when full ASN1 + * constification is done. + */ +# define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(stname, itname, fname) \ + stname *d2i_##fname(stname **a, const unsigned char **in, long len) \ + { \ + return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\ + } \ + int i2d_##fname(const stname *a, unsigned char **out) \ + { \ + return ASN1_item_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\ + } + +# define IMPLEMENT_ASN1_DUP_FUNCTION(stname) \ + stname * stname##_dup(stname *x) \ + { \ + return ASN1_item_dup(ASN1_ITEM_rptr(stname), x); \ + } + +# define IMPLEMENT_ASN1_PRINT_FUNCTION(stname) \ + IMPLEMENT_ASN1_PRINT_FUNCTION_fname(stname, stname, stname) + +# define IMPLEMENT_ASN1_PRINT_FUNCTION_fname(stname, itname, fname) \ + int fname##_print_ctx(BIO *out, stname *x, int indent, \ + const ASN1_PCTX *pctx) \ + { \ + return ASN1_item_print(out, (ASN1_VALUE *)x, indent, \ + ASN1_ITEM_rptr(itname), pctx); \ + } + +# define IMPLEMENT_ASN1_FUNCTIONS_const(name) \ + IMPLEMENT_ASN1_FUNCTIONS_const_fname(name, name, name) + +# define IMPLEMENT_ASN1_FUNCTIONS_const_fname(stname, itname, fname) \ + IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(stname, itname, fname) \ + IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) + +/* external definitions for primitive types */ + +DECLARE_ASN1_ITEM(ASN1_BOOLEAN) +DECLARE_ASN1_ITEM(ASN1_TBOOLEAN) +DECLARE_ASN1_ITEM(ASN1_FBOOLEAN) +DECLARE_ASN1_ITEM(ASN1_SEQUENCE) +DECLARE_ASN1_ITEM(CBIGNUM) +DECLARE_ASN1_ITEM(BIGNUM) +DECLARE_ASN1_ITEM(INT32) +DECLARE_ASN1_ITEM(ZINT32) +DECLARE_ASN1_ITEM(UINT32) +DECLARE_ASN1_ITEM(ZUINT32) +DECLARE_ASN1_ITEM(INT64) +DECLARE_ASN1_ITEM(ZINT64) +DECLARE_ASN1_ITEM(UINT64) +DECLARE_ASN1_ITEM(ZUINT64) + +# if OPENSSL_API_COMPAT < 0x10200000L +/* + * LONG and ZLONG are strongly discouraged for use as stored data, as the + * underlying C type (long) differs in size depending on the architecture. + * They are designed with 32-bit longs in mind. + */ +DECLARE_ASN1_ITEM(LONG) +DECLARE_ASN1_ITEM(ZLONG) +# endif + +DEFINE_STACK_OF(ASN1_VALUE) + +/* Functions used internally by the ASN1 code */ + +int ASN1_item_ex_new(ASN1_VALUE **pval, const ASN1_ITEM *it); +void ASN1_item_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it); + +int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, + const ASN1_ITEM *it, int tag, int aclass, char opt, + ASN1_TLC *ctx); + +int ASN1_item_ex_i2d(ASN1_VALUE **pval, unsigned char **out, + const ASN1_ITEM *it, int tag, int aclass); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/ONVIF/include/openssl/include/openssl/async.h b/ONVIF/include/openssl/include/openssl/async.h new file mode 100644 index 0000000..7052b89 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/async.h @@ -0,0 +1,76 @@ +/* + * Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#include + +#ifndef HEADER_ASYNC_H +# define HEADER_ASYNC_H + +#if defined(_WIN32) +# if defined(BASETYPES) || defined(_WINDEF_H) +/* application has to include to use this */ +#define OSSL_ASYNC_FD HANDLE +#define OSSL_BAD_ASYNC_FD INVALID_HANDLE_VALUE +# endif +#else +#define OSSL_ASYNC_FD int +#define OSSL_BAD_ASYNC_FD -1 +#endif +# include + + +# ifdef __cplusplus +extern "C" { +# endif + +typedef struct async_job_st ASYNC_JOB; +typedef struct async_wait_ctx_st ASYNC_WAIT_CTX; + +#define ASYNC_ERR 0 +#define ASYNC_NO_JOBS 1 +#define ASYNC_PAUSE 2 +#define ASYNC_FINISH 3 + +int ASYNC_init_thread(size_t max_size, size_t init_size); +void ASYNC_cleanup_thread(void); + +#ifdef OSSL_ASYNC_FD +ASYNC_WAIT_CTX *ASYNC_WAIT_CTX_new(void); +void ASYNC_WAIT_CTX_free(ASYNC_WAIT_CTX *ctx); +int ASYNC_WAIT_CTX_set_wait_fd(ASYNC_WAIT_CTX *ctx, const void *key, + OSSL_ASYNC_FD fd, + void *custom_data, + void (*cleanup)(ASYNC_WAIT_CTX *, const void *, + OSSL_ASYNC_FD, void *)); +int ASYNC_WAIT_CTX_get_fd(ASYNC_WAIT_CTX *ctx, const void *key, + OSSL_ASYNC_FD *fd, void **custom_data); +int ASYNC_WAIT_CTX_get_all_fds(ASYNC_WAIT_CTX *ctx, OSSL_ASYNC_FD *fd, + size_t *numfds); +int ASYNC_WAIT_CTX_get_changed_fds(ASYNC_WAIT_CTX *ctx, OSSL_ASYNC_FD *addfd, + size_t *numaddfds, OSSL_ASYNC_FD *delfd, + size_t *numdelfds); +int ASYNC_WAIT_CTX_clear_fd(ASYNC_WAIT_CTX *ctx, const void *key); +#endif + +int ASYNC_is_capable(void); + +int ASYNC_start_job(ASYNC_JOB **job, ASYNC_WAIT_CTX *ctx, int *ret, + int (*func)(void *), void *args, size_t size); +int ASYNC_pause_job(void); + +ASYNC_JOB *ASYNC_get_current_job(void); +ASYNC_WAIT_CTX *ASYNC_get_wait_ctx(ASYNC_JOB *job); +void ASYNC_block_pause(void); +void ASYNC_unblock_pause(void); + + +# ifdef __cplusplus +} +# endif +#endif diff --git a/ONVIF/include/openssl/include/openssl/asyncerr.h b/ONVIF/include/openssl/include/openssl/asyncerr.h new file mode 100644 index 0000000..91afbbb --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/asyncerr.h @@ -0,0 +1,42 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_ASYNCERR_H +# define HEADER_ASYNCERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_ASYNC_strings(void); + +/* + * ASYNC function codes. + */ +# define ASYNC_F_ASYNC_CTX_NEW 100 +# define ASYNC_F_ASYNC_INIT_THREAD 101 +# define ASYNC_F_ASYNC_JOB_NEW 102 +# define ASYNC_F_ASYNC_PAUSE_JOB 103 +# define ASYNC_F_ASYNC_START_FUNC 104 +# define ASYNC_F_ASYNC_START_JOB 105 +# define ASYNC_F_ASYNC_WAIT_CTX_SET_WAIT_FD 106 + +/* + * ASYNC reason codes. + */ +# define ASYNC_R_FAILED_TO_SET_POOL 101 +# define ASYNC_R_FAILED_TO_SWAP_CONTEXT 102 +# define ASYNC_R_INIT_FAILED 105 +# define ASYNC_R_INVALID_POOL_SIZE 103 + +#endif diff --git a/ONVIF/include/openssl/include/openssl/bio.h b/ONVIF/include/openssl/include/openssl/bio.h new file mode 100644 index 0000000..ae559a5 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/bio.h @@ -0,0 +1,801 @@ +/* + * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_BIO_H +# define HEADER_BIO_H + +# include + +# ifndef OPENSSL_NO_STDIO +# include +# endif +# include + +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + +/* There are the classes of BIOs */ +# define BIO_TYPE_DESCRIPTOR 0x0100 /* socket, fd, connect or accept */ +# define BIO_TYPE_FILTER 0x0200 +# define BIO_TYPE_SOURCE_SINK 0x0400 + +/* These are the 'types' of BIOs */ +# define BIO_TYPE_NONE 0 +# define BIO_TYPE_MEM ( 1|BIO_TYPE_SOURCE_SINK) +# define BIO_TYPE_FILE ( 2|BIO_TYPE_SOURCE_SINK) + +# define BIO_TYPE_FD ( 4|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR) +# define BIO_TYPE_SOCKET ( 5|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR) +# define BIO_TYPE_NULL ( 6|BIO_TYPE_SOURCE_SINK) +# define BIO_TYPE_SSL ( 7|BIO_TYPE_FILTER) +# define BIO_TYPE_MD ( 8|BIO_TYPE_FILTER) +# define BIO_TYPE_BUFFER ( 9|BIO_TYPE_FILTER) +# define BIO_TYPE_CIPHER (10|BIO_TYPE_FILTER) +# define BIO_TYPE_BASE64 (11|BIO_TYPE_FILTER) +# define BIO_TYPE_CONNECT (12|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR) +# define BIO_TYPE_ACCEPT (13|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR) + +# define BIO_TYPE_NBIO_TEST (16|BIO_TYPE_FILTER)/* server proxy BIO */ +# define BIO_TYPE_NULL_FILTER (17|BIO_TYPE_FILTER) +# define BIO_TYPE_BIO (19|BIO_TYPE_SOURCE_SINK)/* half a BIO pair */ +# define BIO_TYPE_LINEBUFFER (20|BIO_TYPE_FILTER) +# define BIO_TYPE_DGRAM (21|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR) +# define BIO_TYPE_ASN1 (22|BIO_TYPE_FILTER) +# define BIO_TYPE_COMP (23|BIO_TYPE_FILTER) +# ifndef OPENSSL_NO_SCTP +# define BIO_TYPE_DGRAM_SCTP (24|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR) +# endif + +#define BIO_TYPE_START 128 + +/* + * BIO_FILENAME_READ|BIO_CLOSE to open or close on free. + * BIO_set_fp(in,stdin,BIO_NOCLOSE); + */ +# define BIO_NOCLOSE 0x00 +# define BIO_CLOSE 0x01 + +/* + * These are used in the following macros and are passed to BIO_ctrl() + */ +# define BIO_CTRL_RESET 1/* opt - rewind/zero etc */ +# define BIO_CTRL_EOF 2/* opt - are we at the eof */ +# define BIO_CTRL_INFO 3/* opt - extra tit-bits */ +# define BIO_CTRL_SET 4/* man - set the 'IO' type */ +# define BIO_CTRL_GET 5/* man - get the 'IO' type */ +# define BIO_CTRL_PUSH 6/* opt - internal, used to signify change */ +# define BIO_CTRL_POP 7/* opt - internal, used to signify change */ +# define BIO_CTRL_GET_CLOSE 8/* man - set the 'close' on free */ +# define BIO_CTRL_SET_CLOSE 9/* man - set the 'close' on free */ +# define BIO_CTRL_PENDING 10/* opt - is their more data buffered */ +# define BIO_CTRL_FLUSH 11/* opt - 'flush' buffered output */ +# define BIO_CTRL_DUP 12/* man - extra stuff for 'duped' BIO */ +# define BIO_CTRL_WPENDING 13/* opt - number of bytes still to write */ +# define BIO_CTRL_SET_CALLBACK 14/* opt - set callback function */ +# define BIO_CTRL_GET_CALLBACK 15/* opt - set callback function */ + +# define BIO_CTRL_PEEK 29/* BIO_f_buffer special */ +# define BIO_CTRL_SET_FILENAME 30/* BIO_s_file special */ + +/* dgram BIO stuff */ +# define BIO_CTRL_DGRAM_CONNECT 31/* BIO dgram special */ +# define BIO_CTRL_DGRAM_SET_CONNECTED 32/* allow for an externally connected + * socket to be passed in */ +# define BIO_CTRL_DGRAM_SET_RECV_TIMEOUT 33/* setsockopt, essentially */ +# define BIO_CTRL_DGRAM_GET_RECV_TIMEOUT 34/* getsockopt, essentially */ +# define BIO_CTRL_DGRAM_SET_SEND_TIMEOUT 35/* setsockopt, essentially */ +# define BIO_CTRL_DGRAM_GET_SEND_TIMEOUT 36/* getsockopt, essentially */ + +# define BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP 37/* flag whether the last */ +# define BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP 38/* I/O operation tiemd out */ + +/* #ifdef IP_MTU_DISCOVER */ +# define BIO_CTRL_DGRAM_MTU_DISCOVER 39/* set DF bit on egress packets */ +/* #endif */ + +# define BIO_CTRL_DGRAM_QUERY_MTU 40/* as kernel for current MTU */ +# define BIO_CTRL_DGRAM_GET_FALLBACK_MTU 47 +# define BIO_CTRL_DGRAM_GET_MTU 41/* get cached value for MTU */ +# define BIO_CTRL_DGRAM_SET_MTU 42/* set cached value for MTU. + * want to use this if asking + * the kernel fails */ + +# define BIO_CTRL_DGRAM_MTU_EXCEEDED 43/* check whether the MTU was + * exceed in the previous write + * operation */ + +# define BIO_CTRL_DGRAM_GET_PEER 46 +# define BIO_CTRL_DGRAM_SET_PEER 44/* Destination for the data */ + +# define BIO_CTRL_DGRAM_SET_NEXT_TIMEOUT 45/* Next DTLS handshake timeout + * to adjust socket timeouts */ +# define BIO_CTRL_DGRAM_SET_DONT_FRAG 48 + +# define BIO_CTRL_DGRAM_GET_MTU_OVERHEAD 49 + +/* Deliberately outside of OPENSSL_NO_SCTP - used in bss_dgram.c */ +# define BIO_CTRL_DGRAM_SCTP_SET_IN_HANDSHAKE 50 +# ifndef OPENSSL_NO_SCTP +/* SCTP stuff */ +# define BIO_CTRL_DGRAM_SCTP_ADD_AUTH_KEY 51 +# define BIO_CTRL_DGRAM_SCTP_NEXT_AUTH_KEY 52 +# define BIO_CTRL_DGRAM_SCTP_AUTH_CCS_RCVD 53 +# define BIO_CTRL_DGRAM_SCTP_GET_SNDINFO 60 +# define BIO_CTRL_DGRAM_SCTP_SET_SNDINFO 61 +# define BIO_CTRL_DGRAM_SCTP_GET_RCVINFO 62 +# define BIO_CTRL_DGRAM_SCTP_SET_RCVINFO 63 +# define BIO_CTRL_DGRAM_SCTP_GET_PRINFO 64 +# define BIO_CTRL_DGRAM_SCTP_SET_PRINFO 65 +# define BIO_CTRL_DGRAM_SCTP_SAVE_SHUTDOWN 70 +# endif + +# define BIO_CTRL_DGRAM_SET_PEEK_MODE 71 + +/* modifiers */ +# define BIO_FP_READ 0x02 +# define BIO_FP_WRITE 0x04 +# define BIO_FP_APPEND 0x08 +# define BIO_FP_TEXT 0x10 + +# define BIO_FLAGS_READ 0x01 +# define BIO_FLAGS_WRITE 0x02 +# define BIO_FLAGS_IO_SPECIAL 0x04 +# define BIO_FLAGS_RWS (BIO_FLAGS_READ|BIO_FLAGS_WRITE|BIO_FLAGS_IO_SPECIAL) +# define BIO_FLAGS_SHOULD_RETRY 0x08 +# ifndef BIO_FLAGS_UPLINK +/* + * "UPLINK" flag denotes file descriptors provided by application. It + * defaults to 0, as most platforms don't require UPLINK interface. + */ +# define BIO_FLAGS_UPLINK 0 +# endif + +# define BIO_FLAGS_BASE64_NO_NL 0x100 + +/* + * This is used with memory BIOs: + * BIO_FLAGS_MEM_RDONLY means we shouldn't free up or change the data in any way; + * BIO_FLAGS_NONCLEAR_RST means we shouldn't clear data on reset. + */ +# define BIO_FLAGS_MEM_RDONLY 0x200 +# define BIO_FLAGS_NONCLEAR_RST 0x400 +# define BIO_FLAGS_IN_EOF 0x800 + +typedef union bio_addr_st BIO_ADDR; +typedef struct bio_addrinfo_st BIO_ADDRINFO; + +int BIO_get_new_index(void); +void BIO_set_flags(BIO *b, int flags); +int BIO_test_flags(const BIO *b, int flags); +void BIO_clear_flags(BIO *b, int flags); + +# define BIO_get_flags(b) BIO_test_flags(b, ~(0x0)) +# define BIO_set_retry_special(b) \ + BIO_set_flags(b, (BIO_FLAGS_IO_SPECIAL|BIO_FLAGS_SHOULD_RETRY)) +# define BIO_set_retry_read(b) \ + BIO_set_flags(b, (BIO_FLAGS_READ|BIO_FLAGS_SHOULD_RETRY)) +# define BIO_set_retry_write(b) \ + BIO_set_flags(b, (BIO_FLAGS_WRITE|BIO_FLAGS_SHOULD_RETRY)) + +/* These are normally used internally in BIOs */ +# define BIO_clear_retry_flags(b) \ + BIO_clear_flags(b, (BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY)) +# define BIO_get_retry_flags(b) \ + BIO_test_flags(b, (BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY)) + +/* These should be used by the application to tell why we should retry */ +# define BIO_should_read(a) BIO_test_flags(a, BIO_FLAGS_READ) +# define BIO_should_write(a) BIO_test_flags(a, BIO_FLAGS_WRITE) +# define BIO_should_io_special(a) BIO_test_flags(a, BIO_FLAGS_IO_SPECIAL) +# define BIO_retry_type(a) BIO_test_flags(a, BIO_FLAGS_RWS) +# define BIO_should_retry(a) BIO_test_flags(a, BIO_FLAGS_SHOULD_RETRY) + +/* + * The next three are used in conjunction with the BIO_should_io_special() + * condition. After this returns true, BIO *BIO_get_retry_BIO(BIO *bio, int + * *reason); will walk the BIO stack and return the 'reason' for the special + * and the offending BIO. Given a BIO, BIO_get_retry_reason(bio) will return + * the code. + */ +/* + * Returned from the SSL bio when the certificate retrieval code had an error + */ +# define BIO_RR_SSL_X509_LOOKUP 0x01 +/* Returned from the connect BIO when a connect would have blocked */ +# define BIO_RR_CONNECT 0x02 +/* Returned from the accept BIO when an accept would have blocked */ +# define BIO_RR_ACCEPT 0x03 + +/* These are passed by the BIO callback */ +# define BIO_CB_FREE 0x01 +# define BIO_CB_READ 0x02 +# define BIO_CB_WRITE 0x03 +# define BIO_CB_PUTS 0x04 +# define BIO_CB_GETS 0x05 +# define BIO_CB_CTRL 0x06 + +/* + * The callback is called before and after the underling operation, The + * BIO_CB_RETURN flag indicates if it is after the call + */ +# define BIO_CB_RETURN 0x80 +# define BIO_CB_return(a) ((a)|BIO_CB_RETURN) +# define BIO_cb_pre(a) (!((a)&BIO_CB_RETURN)) +# define BIO_cb_post(a) ((a)&BIO_CB_RETURN) + +typedef long (*BIO_callback_fn)(BIO *b, int oper, const char *argp, int argi, + long argl, long ret); +typedef long (*BIO_callback_fn_ex)(BIO *b, int oper, const char *argp, + size_t len, int argi, + long argl, int ret, size_t *processed); +BIO_callback_fn BIO_get_callback(const BIO *b); +void BIO_set_callback(BIO *b, BIO_callback_fn callback); + +BIO_callback_fn_ex BIO_get_callback_ex(const BIO *b); +void BIO_set_callback_ex(BIO *b, BIO_callback_fn_ex callback); + +char *BIO_get_callback_arg(const BIO *b); +void BIO_set_callback_arg(BIO *b, char *arg); + +typedef struct bio_method_st BIO_METHOD; + +const char *BIO_method_name(const BIO *b); +int BIO_method_type(const BIO *b); + +typedef int BIO_info_cb(BIO *, int, int); +typedef BIO_info_cb bio_info_cb; /* backward compatibility */ + +DEFINE_STACK_OF(BIO) + +/* Prefix and suffix callback in ASN1 BIO */ +typedef int asn1_ps_func (BIO *b, unsigned char **pbuf, int *plen, + void *parg); + +# ifndef OPENSSL_NO_SCTP +/* SCTP parameter structs */ +struct bio_dgram_sctp_sndinfo { + uint16_t snd_sid; + uint16_t snd_flags; + uint32_t snd_ppid; + uint32_t snd_context; +}; + +struct bio_dgram_sctp_rcvinfo { + uint16_t rcv_sid; + uint16_t rcv_ssn; + uint16_t rcv_flags; + uint32_t rcv_ppid; + uint32_t rcv_tsn; + uint32_t rcv_cumtsn; + uint32_t rcv_context; +}; + +struct bio_dgram_sctp_prinfo { + uint16_t pr_policy; + uint32_t pr_value; +}; +# endif + +/* + * #define BIO_CONN_get_param_hostname BIO_ctrl + */ + +# define BIO_C_SET_CONNECT 100 +# define BIO_C_DO_STATE_MACHINE 101 +# define BIO_C_SET_NBIO 102 +/* # define BIO_C_SET_PROXY_PARAM 103 */ +# define BIO_C_SET_FD 104 +# define BIO_C_GET_FD 105 +# define BIO_C_SET_FILE_PTR 106 +# define BIO_C_GET_FILE_PTR 107 +# define BIO_C_SET_FILENAME 108 +# define BIO_C_SET_SSL 109 +# define BIO_C_GET_SSL 110 +# define BIO_C_SET_MD 111 +# define BIO_C_GET_MD 112 +# define BIO_C_GET_CIPHER_STATUS 113 +# define BIO_C_SET_BUF_MEM 114 +# define BIO_C_GET_BUF_MEM_PTR 115 +# define BIO_C_GET_BUFF_NUM_LINES 116 +# define BIO_C_SET_BUFF_SIZE 117 +# define BIO_C_SET_ACCEPT 118 +# define BIO_C_SSL_MODE 119 +# define BIO_C_GET_MD_CTX 120 +/* # define BIO_C_GET_PROXY_PARAM 121 */ +# define BIO_C_SET_BUFF_READ_DATA 122/* data to read first */ +# define BIO_C_GET_CONNECT 123 +# define BIO_C_GET_ACCEPT 124 +# define BIO_C_SET_SSL_RENEGOTIATE_BYTES 125 +# define BIO_C_GET_SSL_NUM_RENEGOTIATES 126 +# define BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT 127 +# define BIO_C_FILE_SEEK 128 +# define BIO_C_GET_CIPHER_CTX 129 +# define BIO_C_SET_BUF_MEM_EOF_RETURN 130/* return end of input + * value */ +# define BIO_C_SET_BIND_MODE 131 +# define BIO_C_GET_BIND_MODE 132 +# define BIO_C_FILE_TELL 133 +# define BIO_C_GET_SOCKS 134 +# define BIO_C_SET_SOCKS 135 + +# define BIO_C_SET_WRITE_BUF_SIZE 136/* for BIO_s_bio */ +# define BIO_C_GET_WRITE_BUF_SIZE 137 +# define BIO_C_MAKE_BIO_PAIR 138 +# define BIO_C_DESTROY_BIO_PAIR 139 +# define BIO_C_GET_WRITE_GUARANTEE 140 +# define BIO_C_GET_READ_REQUEST 141 +# define BIO_C_SHUTDOWN_WR 142 +# define BIO_C_NREAD0 143 +# define BIO_C_NREAD 144 +# define BIO_C_NWRITE0 145 +# define BIO_C_NWRITE 146 +# define BIO_C_RESET_READ_REQUEST 147 +# define BIO_C_SET_MD_CTX 148 + +# define BIO_C_SET_PREFIX 149 +# define BIO_C_GET_PREFIX 150 +# define BIO_C_SET_SUFFIX 151 +# define BIO_C_GET_SUFFIX 152 + +# define BIO_C_SET_EX_ARG 153 +# define BIO_C_GET_EX_ARG 154 + +# define BIO_C_SET_CONNECT_MODE 155 + +# define BIO_set_app_data(s,arg) BIO_set_ex_data(s,0,arg) +# define BIO_get_app_data(s) BIO_get_ex_data(s,0) + +# define BIO_set_nbio(b,n) BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL) + +# ifndef OPENSSL_NO_SOCK +/* IP families we support, for BIO_s_connect() and BIO_s_accept() */ +/* Note: the underlying operating system may not support some of them */ +# define BIO_FAMILY_IPV4 4 +# define BIO_FAMILY_IPV6 6 +# define BIO_FAMILY_IPANY 256 + +/* BIO_s_connect() */ +# define BIO_set_conn_hostname(b,name) BIO_ctrl(b,BIO_C_SET_CONNECT,0, \ + (char *)(name)) +# define BIO_set_conn_port(b,port) BIO_ctrl(b,BIO_C_SET_CONNECT,1, \ + (char *)(port)) +# define BIO_set_conn_address(b,addr) BIO_ctrl(b,BIO_C_SET_CONNECT,2, \ + (char *)(addr)) +# define BIO_set_conn_ip_family(b,f) BIO_int_ctrl(b,BIO_C_SET_CONNECT,3,f) +# define BIO_get_conn_hostname(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,0)) +# define BIO_get_conn_port(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,1)) +# define BIO_get_conn_address(b) ((const BIO_ADDR *)BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,2)) +# define BIO_get_conn_ip_family(b) BIO_ctrl(b,BIO_C_GET_CONNECT,3,NULL) +# define BIO_set_conn_mode(b,n) BIO_ctrl(b,BIO_C_SET_CONNECT_MODE,(n),NULL) + +/* BIO_s_accept() */ +# define BIO_set_accept_name(b,name) BIO_ctrl(b,BIO_C_SET_ACCEPT,0, \ + (char *)(name)) +# define BIO_set_accept_port(b,port) BIO_ctrl(b,BIO_C_SET_ACCEPT,1, \ + (char *)(port)) +# define BIO_get_accept_name(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,0)) +# define BIO_get_accept_port(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,1)) +# define BIO_get_peer_name(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,2)) +# define BIO_get_peer_port(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,3)) +/* #define BIO_set_nbio(b,n) BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL) */ +# define BIO_set_nbio_accept(b,n) BIO_ctrl(b,BIO_C_SET_ACCEPT,2,(n)?(void *)"a":NULL) +# define BIO_set_accept_bios(b,bio) BIO_ctrl(b,BIO_C_SET_ACCEPT,3, \ + (char *)(bio)) +# define BIO_set_accept_ip_family(b,f) BIO_int_ctrl(b,BIO_C_SET_ACCEPT,4,f) +# define BIO_get_accept_ip_family(b) BIO_ctrl(b,BIO_C_GET_ACCEPT,4,NULL) + +/* Aliases kept for backward compatibility */ +# define BIO_BIND_NORMAL 0 +# define BIO_BIND_REUSEADDR BIO_SOCK_REUSEADDR +# define BIO_BIND_REUSEADDR_IF_UNUSED BIO_SOCK_REUSEADDR +# define BIO_set_bind_mode(b,mode) BIO_ctrl(b,BIO_C_SET_BIND_MODE,mode,NULL) +# define BIO_get_bind_mode(b) BIO_ctrl(b,BIO_C_GET_BIND_MODE,0,NULL) + +/* BIO_s_accept() and BIO_s_connect() */ +# define BIO_do_connect(b) BIO_do_handshake(b) +# define BIO_do_accept(b) BIO_do_handshake(b) +# endif /* OPENSSL_NO_SOCK */ + +# define BIO_do_handshake(b) BIO_ctrl(b,BIO_C_DO_STATE_MACHINE,0,NULL) + +/* BIO_s_datagram(), BIO_s_fd(), BIO_s_socket(), BIO_s_accept() and BIO_s_connect() */ +# define BIO_set_fd(b,fd,c) BIO_int_ctrl(b,BIO_C_SET_FD,c,fd) +# define BIO_get_fd(b,c) BIO_ctrl(b,BIO_C_GET_FD,0,(char *)(c)) + +/* BIO_s_file() */ +# define BIO_set_fp(b,fp,c) BIO_ctrl(b,BIO_C_SET_FILE_PTR,c,(char *)(fp)) +# define BIO_get_fp(b,fpp) BIO_ctrl(b,BIO_C_GET_FILE_PTR,0,(char *)(fpp)) + +/* BIO_s_fd() and BIO_s_file() */ +# define BIO_seek(b,ofs) (int)BIO_ctrl(b,BIO_C_FILE_SEEK,ofs,NULL) +# define BIO_tell(b) (int)BIO_ctrl(b,BIO_C_FILE_TELL,0,NULL) + +/* + * name is cast to lose const, but might be better to route through a + * function so we can do it safely + */ +# ifdef CONST_STRICT +/* + * If you are wondering why this isn't defined, its because CONST_STRICT is + * purely a compile-time kludge to allow const to be checked. + */ +int BIO_read_filename(BIO *b, const char *name); +# else +# define BIO_read_filename(b,name) (int)BIO_ctrl(b,BIO_C_SET_FILENAME, \ + BIO_CLOSE|BIO_FP_READ,(char *)(name)) +# endif +# define BIO_write_filename(b,name) (int)BIO_ctrl(b,BIO_C_SET_FILENAME, \ + BIO_CLOSE|BIO_FP_WRITE,name) +# define BIO_append_filename(b,name) (int)BIO_ctrl(b,BIO_C_SET_FILENAME, \ + BIO_CLOSE|BIO_FP_APPEND,name) +# define BIO_rw_filename(b,name) (int)BIO_ctrl(b,BIO_C_SET_FILENAME, \ + BIO_CLOSE|BIO_FP_READ|BIO_FP_WRITE,name) + +/* + * WARNING WARNING, this ups the reference count on the read bio of the SSL + * structure. This is because the ssl read BIO is now pointed to by the + * next_bio field in the bio. So when you free the BIO, make sure you are + * doing a BIO_free_all() to catch the underlying BIO. + */ +# define BIO_set_ssl(b,ssl,c) BIO_ctrl(b,BIO_C_SET_SSL,c,(char *)(ssl)) +# define BIO_get_ssl(b,sslp) BIO_ctrl(b,BIO_C_GET_SSL,0,(char *)(sslp)) +# define BIO_set_ssl_mode(b,client) BIO_ctrl(b,BIO_C_SSL_MODE,client,NULL) +# define BIO_set_ssl_renegotiate_bytes(b,num) \ + BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_BYTES,num,NULL) +# define BIO_get_num_renegotiates(b) \ + BIO_ctrl(b,BIO_C_GET_SSL_NUM_RENEGOTIATES,0,NULL) +# define BIO_set_ssl_renegotiate_timeout(b,seconds) \ + BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT,seconds,NULL) + +/* defined in evp.h */ +/* #define BIO_set_md(b,md) BIO_ctrl(b,BIO_C_SET_MD,1,(char *)(md)) */ + +# define BIO_get_mem_data(b,pp) BIO_ctrl(b,BIO_CTRL_INFO,0,(char *)(pp)) +# define BIO_set_mem_buf(b,bm,c) BIO_ctrl(b,BIO_C_SET_BUF_MEM,c,(char *)(bm)) +# define BIO_get_mem_ptr(b,pp) BIO_ctrl(b,BIO_C_GET_BUF_MEM_PTR,0, \ + (char *)(pp)) +# define BIO_set_mem_eof_return(b,v) \ + BIO_ctrl(b,BIO_C_SET_BUF_MEM_EOF_RETURN,v,NULL) + +/* For the BIO_f_buffer() type */ +# define BIO_get_buffer_num_lines(b) BIO_ctrl(b,BIO_C_GET_BUFF_NUM_LINES,0,NULL) +# define BIO_set_buffer_size(b,size) BIO_ctrl(b,BIO_C_SET_BUFF_SIZE,size,NULL) +# define BIO_set_read_buffer_size(b,size) BIO_int_ctrl(b,BIO_C_SET_BUFF_SIZE,size,0) +# define BIO_set_write_buffer_size(b,size) BIO_int_ctrl(b,BIO_C_SET_BUFF_SIZE,size,1) +# define BIO_set_buffer_read_data(b,buf,num) BIO_ctrl(b,BIO_C_SET_BUFF_READ_DATA,num,buf) + +/* Don't use the next one unless you know what you are doing :-) */ +# define BIO_dup_state(b,ret) BIO_ctrl(b,BIO_CTRL_DUP,0,(char *)(ret)) + +# define BIO_reset(b) (int)BIO_ctrl(b,BIO_CTRL_RESET,0,NULL) +# define BIO_eof(b) (int)BIO_ctrl(b,BIO_CTRL_EOF,0,NULL) +# define BIO_set_close(b,c) (int)BIO_ctrl(b,BIO_CTRL_SET_CLOSE,(c),NULL) +# define BIO_get_close(b) (int)BIO_ctrl(b,BIO_CTRL_GET_CLOSE,0,NULL) +# define BIO_pending(b) (int)BIO_ctrl(b,BIO_CTRL_PENDING,0,NULL) +# define BIO_wpending(b) (int)BIO_ctrl(b,BIO_CTRL_WPENDING,0,NULL) +/* ...pending macros have inappropriate return type */ +size_t BIO_ctrl_pending(BIO *b); +size_t BIO_ctrl_wpending(BIO *b); +# define BIO_flush(b) (int)BIO_ctrl(b,BIO_CTRL_FLUSH,0,NULL) +# define BIO_get_info_callback(b,cbp) (int)BIO_ctrl(b,BIO_CTRL_GET_CALLBACK,0, \ + cbp) +# define BIO_set_info_callback(b,cb) (int)BIO_callback_ctrl(b,BIO_CTRL_SET_CALLBACK,cb) + +/* For the BIO_f_buffer() type */ +# define BIO_buffer_get_num_lines(b) BIO_ctrl(b,BIO_CTRL_GET,0,NULL) +# define BIO_buffer_peek(b,s,l) BIO_ctrl(b,BIO_CTRL_PEEK,(l),(s)) + +/* For BIO_s_bio() */ +# define BIO_set_write_buf_size(b,size) (int)BIO_ctrl(b,BIO_C_SET_WRITE_BUF_SIZE,size,NULL) +# define BIO_get_write_buf_size(b,size) (size_t)BIO_ctrl(b,BIO_C_GET_WRITE_BUF_SIZE,size,NULL) +# define BIO_make_bio_pair(b1,b2) (int)BIO_ctrl(b1,BIO_C_MAKE_BIO_PAIR,0,b2) +# define BIO_destroy_bio_pair(b) (int)BIO_ctrl(b,BIO_C_DESTROY_BIO_PAIR,0,NULL) +# define BIO_shutdown_wr(b) (int)BIO_ctrl(b, BIO_C_SHUTDOWN_WR, 0, NULL) +/* macros with inappropriate type -- but ...pending macros use int too: */ +# define BIO_get_write_guarantee(b) (int)BIO_ctrl(b,BIO_C_GET_WRITE_GUARANTEE,0,NULL) +# define BIO_get_read_request(b) (int)BIO_ctrl(b,BIO_C_GET_READ_REQUEST,0,NULL) +size_t BIO_ctrl_get_write_guarantee(BIO *b); +size_t BIO_ctrl_get_read_request(BIO *b); +int BIO_ctrl_reset_read_request(BIO *b); + +/* ctrl macros for dgram */ +# define BIO_ctrl_dgram_connect(b,peer) \ + (int)BIO_ctrl(b,BIO_CTRL_DGRAM_CONNECT,0, (char *)(peer)) +# define BIO_ctrl_set_connected(b,peer) \ + (int)BIO_ctrl(b, BIO_CTRL_DGRAM_SET_CONNECTED, 0, (char *)(peer)) +# define BIO_dgram_recv_timedout(b) \ + (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP, 0, NULL) +# define BIO_dgram_send_timedout(b) \ + (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP, 0, NULL) +# define BIO_dgram_get_peer(b,peer) \ + (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_PEER, 0, (char *)(peer)) +# define BIO_dgram_set_peer(b,peer) \ + (int)BIO_ctrl(b, BIO_CTRL_DGRAM_SET_PEER, 0, (char *)(peer)) +# define BIO_dgram_get_mtu_overhead(b) \ + (unsigned int)BIO_ctrl((b), BIO_CTRL_DGRAM_GET_MTU_OVERHEAD, 0, NULL) + +#define BIO_get_ex_new_index(l, p, newf, dupf, freef) \ + CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_BIO, l, p, newf, dupf, freef) +int BIO_set_ex_data(BIO *bio, int idx, void *data); +void *BIO_get_ex_data(BIO *bio, int idx); +uint64_t BIO_number_read(BIO *bio); +uint64_t BIO_number_written(BIO *bio); + +/* For BIO_f_asn1() */ +int BIO_asn1_set_prefix(BIO *b, asn1_ps_func *prefix, + asn1_ps_func *prefix_free); +int BIO_asn1_get_prefix(BIO *b, asn1_ps_func **pprefix, + asn1_ps_func **pprefix_free); +int BIO_asn1_set_suffix(BIO *b, asn1_ps_func *suffix, + asn1_ps_func *suffix_free); +int BIO_asn1_get_suffix(BIO *b, asn1_ps_func **psuffix, + asn1_ps_func **psuffix_free); + +const BIO_METHOD *BIO_s_file(void); +BIO *BIO_new_file(const char *filename, const char *mode); +# ifndef OPENSSL_NO_STDIO +BIO *BIO_new_fp(FILE *stream, int close_flag); +# endif +BIO *BIO_new(const BIO_METHOD *type); +int BIO_free(BIO *a); +void BIO_set_data(BIO *a, void *ptr); +void *BIO_get_data(BIO *a); +void BIO_set_init(BIO *a, int init); +int BIO_get_init(BIO *a); +void BIO_set_shutdown(BIO *a, int shut); +int BIO_get_shutdown(BIO *a); +void BIO_vfree(BIO *a); +int BIO_up_ref(BIO *a); +int BIO_read(BIO *b, void *data, int dlen); +int BIO_read_ex(BIO *b, void *data, size_t dlen, size_t *readbytes); +int BIO_gets(BIO *bp, char *buf, int size); +int BIO_write(BIO *b, const void *data, int dlen); +int BIO_write_ex(BIO *b, const void *data, size_t dlen, size_t *written); +int BIO_puts(BIO *bp, const char *buf); +int BIO_indent(BIO *b, int indent, int max); +long BIO_ctrl(BIO *bp, int cmd, long larg, void *parg); +long BIO_callback_ctrl(BIO *b, int cmd, BIO_info_cb *fp); +void *BIO_ptr_ctrl(BIO *bp, int cmd, long larg); +long BIO_int_ctrl(BIO *bp, int cmd, long larg, int iarg); +BIO *BIO_push(BIO *b, BIO *append); +BIO *BIO_pop(BIO *b); +void BIO_free_all(BIO *a); +BIO *BIO_find_type(BIO *b, int bio_type); +BIO *BIO_next(BIO *b); +void BIO_set_next(BIO *b, BIO *next); +BIO *BIO_get_retry_BIO(BIO *bio, int *reason); +int BIO_get_retry_reason(BIO *bio); +void BIO_set_retry_reason(BIO *bio, int reason); +BIO *BIO_dup_chain(BIO *in); + +int BIO_nread0(BIO *bio, char **buf); +int BIO_nread(BIO *bio, char **buf, int num); +int BIO_nwrite0(BIO *bio, char **buf); +int BIO_nwrite(BIO *bio, char **buf, int num); + +long BIO_debug_callback(BIO *bio, int cmd, const char *argp, int argi, + long argl, long ret); + +const BIO_METHOD *BIO_s_mem(void); +const BIO_METHOD *BIO_s_secmem(void); +BIO *BIO_new_mem_buf(const void *buf, int len); +# ifndef OPENSSL_NO_SOCK +const BIO_METHOD *BIO_s_socket(void); +const BIO_METHOD *BIO_s_connect(void); +const BIO_METHOD *BIO_s_accept(void); +# endif +const BIO_METHOD *BIO_s_fd(void); +const BIO_METHOD *BIO_s_log(void); +const BIO_METHOD *BIO_s_bio(void); +const BIO_METHOD *BIO_s_null(void); +const BIO_METHOD *BIO_f_null(void); +const BIO_METHOD *BIO_f_buffer(void); +const BIO_METHOD *BIO_f_linebuffer(void); +const BIO_METHOD *BIO_f_nbio_test(void); +# ifndef OPENSSL_NO_DGRAM +const BIO_METHOD *BIO_s_datagram(void); +int BIO_dgram_non_fatal_error(int error); +BIO *BIO_new_dgram(int fd, int close_flag); +# ifndef OPENSSL_NO_SCTP +const BIO_METHOD *BIO_s_datagram_sctp(void); +BIO *BIO_new_dgram_sctp(int fd, int close_flag); +int BIO_dgram_is_sctp(BIO *bio); +int BIO_dgram_sctp_notification_cb(BIO *b, + void (*handle_notifications) (BIO *bio, + void *context, + void *buf), + void *context); +int BIO_dgram_sctp_wait_for_dry(BIO *b); +int BIO_dgram_sctp_msg_waiting(BIO *b); +# endif +# endif + +# ifndef OPENSSL_NO_SOCK +int BIO_sock_should_retry(int i); +int BIO_sock_non_fatal_error(int error); +# endif + +int BIO_fd_should_retry(int i); +int BIO_fd_non_fatal_error(int error); +int BIO_dump_cb(int (*cb) (const void *data, size_t len, void *u), + void *u, const char *s, int len); +int BIO_dump_indent_cb(int (*cb) (const void *data, size_t len, void *u), + void *u, const char *s, int len, int indent); +int BIO_dump(BIO *b, const char *bytes, int len); +int BIO_dump_indent(BIO *b, const char *bytes, int len, int indent); +# ifndef OPENSSL_NO_STDIO +int BIO_dump_fp(FILE *fp, const char *s, int len); +int BIO_dump_indent_fp(FILE *fp, const char *s, int len, int indent); +# endif +int BIO_hex_string(BIO *out, int indent, int width, unsigned char *data, + int datalen); + +# ifndef OPENSSL_NO_SOCK +BIO_ADDR *BIO_ADDR_new(void); +int BIO_ADDR_rawmake(BIO_ADDR *ap, int family, + const void *where, size_t wherelen, unsigned short port); +void BIO_ADDR_free(BIO_ADDR *); +void BIO_ADDR_clear(BIO_ADDR *ap); +int BIO_ADDR_family(const BIO_ADDR *ap); +int BIO_ADDR_rawaddress(const BIO_ADDR *ap, void *p, size_t *l); +unsigned short BIO_ADDR_rawport(const BIO_ADDR *ap); +char *BIO_ADDR_hostname_string(const BIO_ADDR *ap, int numeric); +char *BIO_ADDR_service_string(const BIO_ADDR *ap, int numeric); +char *BIO_ADDR_path_string(const BIO_ADDR *ap); + +const BIO_ADDRINFO *BIO_ADDRINFO_next(const BIO_ADDRINFO *bai); +int BIO_ADDRINFO_family(const BIO_ADDRINFO *bai); +int BIO_ADDRINFO_socktype(const BIO_ADDRINFO *bai); +int BIO_ADDRINFO_protocol(const BIO_ADDRINFO *bai); +const BIO_ADDR *BIO_ADDRINFO_address(const BIO_ADDRINFO *bai); +void BIO_ADDRINFO_free(BIO_ADDRINFO *bai); + +enum BIO_hostserv_priorities { + BIO_PARSE_PRIO_HOST, BIO_PARSE_PRIO_SERV +}; +int BIO_parse_hostserv(const char *hostserv, char **host, char **service, + enum BIO_hostserv_priorities hostserv_prio); +enum BIO_lookup_type { + BIO_LOOKUP_CLIENT, BIO_LOOKUP_SERVER +}; +int BIO_lookup(const char *host, const char *service, + enum BIO_lookup_type lookup_type, + int family, int socktype, BIO_ADDRINFO **res); +int BIO_lookup_ex(const char *host, const char *service, + int lookup_type, int family, int socktype, int protocol, + BIO_ADDRINFO **res); +int BIO_sock_error(int sock); +int BIO_socket_ioctl(int fd, long type, void *arg); +int BIO_socket_nbio(int fd, int mode); +int BIO_sock_init(void); +# if OPENSSL_API_COMPAT < 0x10100000L +# define BIO_sock_cleanup() while(0) continue +# endif +int BIO_set_tcp_ndelay(int sock, int turn_on); + +DEPRECATEDIN_1_1_0(struct hostent *BIO_gethostbyname(const char *name)) +DEPRECATEDIN_1_1_0(int BIO_get_port(const char *str, unsigned short *port_ptr)) +DEPRECATEDIN_1_1_0(int BIO_get_host_ip(const char *str, unsigned char *ip)) +DEPRECATEDIN_1_1_0(int BIO_get_accept_socket(char *host_port, int mode)) +DEPRECATEDIN_1_1_0(int BIO_accept(int sock, char **ip_port)) + +union BIO_sock_info_u { + BIO_ADDR *addr; +}; +enum BIO_sock_info_type { + BIO_SOCK_INFO_ADDRESS +}; +int BIO_sock_info(int sock, + enum BIO_sock_info_type type, union BIO_sock_info_u *info); + +# define BIO_SOCK_REUSEADDR 0x01 +# define BIO_SOCK_V6_ONLY 0x02 +# define BIO_SOCK_KEEPALIVE 0x04 +# define BIO_SOCK_NONBLOCK 0x08 +# define BIO_SOCK_NODELAY 0x10 + +int BIO_socket(int domain, int socktype, int protocol, int options); +int BIO_connect(int sock, const BIO_ADDR *addr, int options); +int BIO_bind(int sock, const BIO_ADDR *addr, int options); +int BIO_listen(int sock, const BIO_ADDR *addr, int options); +int BIO_accept_ex(int accept_sock, BIO_ADDR *addr, int options); +int BIO_closesocket(int sock); + +BIO *BIO_new_socket(int sock, int close_flag); +BIO *BIO_new_connect(const char *host_port); +BIO *BIO_new_accept(const char *host_port); +# endif /* OPENSSL_NO_SOCK*/ + +BIO *BIO_new_fd(int fd, int close_flag); + +int BIO_new_bio_pair(BIO **bio1, size_t writebuf1, + BIO **bio2, size_t writebuf2); +/* + * If successful, returns 1 and in *bio1, *bio2 two BIO pair endpoints. + * Otherwise returns 0 and sets *bio1 and *bio2 to NULL. Size 0 uses default + * value. + */ + +void BIO_copy_next_retry(BIO *b); + +/* + * long BIO_ghbn_ctrl(int cmd,int iarg,char *parg); + */ + +# define ossl_bio__attr__(x) +# if defined(__GNUC__) && defined(__STDC_VERSION__) \ + && !defined(__APPLE__) + /* + * Because we support the 'z' modifier, which made its appearance in C99, + * we can't use __attribute__ with pre C99 dialects. + */ +# if __STDC_VERSION__ >= 199901L +# undef ossl_bio__attr__ +# define ossl_bio__attr__ __attribute__ +# if __GNUC__*10 + __GNUC_MINOR__ >= 44 +# define ossl_bio__printf__ __gnu_printf__ +# else +# define ossl_bio__printf__ __printf__ +# endif +# endif +# endif +int BIO_printf(BIO *bio, const char *format, ...) +ossl_bio__attr__((__format__(ossl_bio__printf__, 2, 3))); +int BIO_vprintf(BIO *bio, const char *format, va_list args) +ossl_bio__attr__((__format__(ossl_bio__printf__, 2, 0))); +int BIO_snprintf(char *buf, size_t n, const char *format, ...) +ossl_bio__attr__((__format__(ossl_bio__printf__, 3, 4))); +int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args) +ossl_bio__attr__((__format__(ossl_bio__printf__, 3, 0))); +# undef ossl_bio__attr__ +# undef ossl_bio__printf__ + + +BIO_METHOD *BIO_meth_new(int type, const char *name); +void BIO_meth_free(BIO_METHOD *biom); +int (*BIO_meth_get_write(const BIO_METHOD *biom)) (BIO *, const char *, int); +int (*BIO_meth_get_write_ex(const BIO_METHOD *biom)) (BIO *, const char *, size_t, + size_t *); +int BIO_meth_set_write(BIO_METHOD *biom, + int (*write) (BIO *, const char *, int)); +int BIO_meth_set_write_ex(BIO_METHOD *biom, + int (*bwrite) (BIO *, const char *, size_t, size_t *)); +int (*BIO_meth_get_read(const BIO_METHOD *biom)) (BIO *, char *, int); +int (*BIO_meth_get_read_ex(const BIO_METHOD *biom)) (BIO *, char *, size_t, size_t *); +int BIO_meth_set_read(BIO_METHOD *biom, + int (*read) (BIO *, char *, int)); +int BIO_meth_set_read_ex(BIO_METHOD *biom, + int (*bread) (BIO *, char *, size_t, size_t *)); +int (*BIO_meth_get_puts(const BIO_METHOD *biom)) (BIO *, const char *); +int BIO_meth_set_puts(BIO_METHOD *biom, + int (*puts) (BIO *, const char *)); +int (*BIO_meth_get_gets(const BIO_METHOD *biom)) (BIO *, char *, int); +int BIO_meth_set_gets(BIO_METHOD *biom, + int (*gets) (BIO *, char *, int)); +long (*BIO_meth_get_ctrl(const BIO_METHOD *biom)) (BIO *, int, long, void *); +int BIO_meth_set_ctrl(BIO_METHOD *biom, + long (*ctrl) (BIO *, int, long, void *)); +int (*BIO_meth_get_create(const BIO_METHOD *bion)) (BIO *); +int BIO_meth_set_create(BIO_METHOD *biom, int (*create) (BIO *)); +int (*BIO_meth_get_destroy(const BIO_METHOD *biom)) (BIO *); +int BIO_meth_set_destroy(BIO_METHOD *biom, int (*destroy) (BIO *)); +long (*BIO_meth_get_callback_ctrl(const BIO_METHOD *biom)) + (BIO *, int, BIO_info_cb *); +int BIO_meth_set_callback_ctrl(BIO_METHOD *biom, + long (*callback_ctrl) (BIO *, int, + BIO_info_cb *)); + +# ifdef __cplusplus +} +# endif +#endif diff --git a/ONVIF/include/openssl/include/openssl/bioerr.h b/ONVIF/include/openssl/include/openssl/bioerr.h new file mode 100644 index 0000000..46e2c96 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/bioerr.h @@ -0,0 +1,124 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_BIOERR_H +# define HEADER_BIOERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_BIO_strings(void); + +/* + * BIO function codes. + */ +# define BIO_F_ACPT_STATE 100 +# define BIO_F_ADDRINFO_WRAP 148 +# define BIO_F_ADDR_STRINGS 134 +# define BIO_F_BIO_ACCEPT 101 +# define BIO_F_BIO_ACCEPT_EX 137 +# define BIO_F_BIO_ACCEPT_NEW 152 +# define BIO_F_BIO_ADDR_NEW 144 +# define BIO_F_BIO_BIND 147 +# define BIO_F_BIO_CALLBACK_CTRL 131 +# define BIO_F_BIO_CONNECT 138 +# define BIO_F_BIO_CONNECT_NEW 153 +# define BIO_F_BIO_CTRL 103 +# define BIO_F_BIO_GETS 104 +# define BIO_F_BIO_GET_HOST_IP 106 +# define BIO_F_BIO_GET_NEW_INDEX 102 +# define BIO_F_BIO_GET_PORT 107 +# define BIO_F_BIO_LISTEN 139 +# define BIO_F_BIO_LOOKUP 135 +# define BIO_F_BIO_LOOKUP_EX 143 +# define BIO_F_BIO_MAKE_PAIR 121 +# define BIO_F_BIO_METH_NEW 146 +# define BIO_F_BIO_NEW 108 +# define BIO_F_BIO_NEW_DGRAM_SCTP 145 +# define BIO_F_BIO_NEW_FILE 109 +# define BIO_F_BIO_NEW_MEM_BUF 126 +# define BIO_F_BIO_NREAD 123 +# define BIO_F_BIO_NREAD0 124 +# define BIO_F_BIO_NWRITE 125 +# define BIO_F_BIO_NWRITE0 122 +# define BIO_F_BIO_PARSE_HOSTSERV 136 +# define BIO_F_BIO_PUTS 110 +# define BIO_F_BIO_READ 111 +# define BIO_F_BIO_READ_EX 105 +# define BIO_F_BIO_READ_INTERN 120 +# define BIO_F_BIO_SOCKET 140 +# define BIO_F_BIO_SOCKET_NBIO 142 +# define BIO_F_BIO_SOCK_INFO 141 +# define BIO_F_BIO_SOCK_INIT 112 +# define BIO_F_BIO_WRITE 113 +# define BIO_F_BIO_WRITE_EX 119 +# define BIO_F_BIO_WRITE_INTERN 128 +# define BIO_F_BUFFER_CTRL 114 +# define BIO_F_CONN_CTRL 127 +# define BIO_F_CONN_STATE 115 +# define BIO_F_DGRAM_SCTP_NEW 149 +# define BIO_F_DGRAM_SCTP_READ 132 +# define BIO_F_DGRAM_SCTP_WRITE 133 +# define BIO_F_DOAPR_OUTCH 150 +# define BIO_F_FILE_CTRL 116 +# define BIO_F_FILE_READ 130 +# define BIO_F_LINEBUFFER_CTRL 129 +# define BIO_F_LINEBUFFER_NEW 151 +# define BIO_F_MEM_WRITE 117 +# define BIO_F_NBIOF_NEW 154 +# define BIO_F_SLG_WRITE 155 +# define BIO_F_SSL_NEW 118 + +/* + * BIO reason codes. + */ +# define BIO_R_ACCEPT_ERROR 100 +# define BIO_R_ADDRINFO_ADDR_IS_NOT_AF_INET 141 +# define BIO_R_AMBIGUOUS_HOST_OR_SERVICE 129 +# define BIO_R_BAD_FOPEN_MODE 101 +# define BIO_R_BROKEN_PIPE 124 +# define BIO_R_CONNECT_ERROR 103 +# define BIO_R_GETHOSTBYNAME_ADDR_IS_NOT_AF_INET 107 +# define BIO_R_GETSOCKNAME_ERROR 132 +# define BIO_R_GETSOCKNAME_TRUNCATED_ADDRESS 133 +# define BIO_R_GETTING_SOCKTYPE 134 +# define BIO_R_INVALID_ARGUMENT 125 +# define BIO_R_INVALID_SOCKET 135 +# define BIO_R_IN_USE 123 +# define BIO_R_LENGTH_TOO_LONG 102 +# define BIO_R_LISTEN_V6_ONLY 136 +# define BIO_R_LOOKUP_RETURNED_NOTHING 142 +# define BIO_R_MALFORMED_HOST_OR_SERVICE 130 +# define BIO_R_NBIO_CONNECT_ERROR 110 +# define BIO_R_NO_ACCEPT_ADDR_OR_SERVICE_SPECIFIED 143 +# define BIO_R_NO_HOSTNAME_OR_SERVICE_SPECIFIED 144 +# define BIO_R_NO_PORT_DEFINED 113 +# define BIO_R_NO_SUCH_FILE 128 +# define BIO_R_NULL_PARAMETER 115 +# define BIO_R_UNABLE_TO_BIND_SOCKET 117 +# define BIO_R_UNABLE_TO_CREATE_SOCKET 118 +# define BIO_R_UNABLE_TO_KEEPALIVE 137 +# define BIO_R_UNABLE_TO_LISTEN_SOCKET 119 +# define BIO_R_UNABLE_TO_NODELAY 138 +# define BIO_R_UNABLE_TO_REUSEADDR 139 +# define BIO_R_UNAVAILABLE_IP_FAMILY 145 +# define BIO_R_UNINITIALIZED 120 +# define BIO_R_UNKNOWN_INFO_TYPE 140 +# define BIO_R_UNSUPPORTED_IP_FAMILY 146 +# define BIO_R_UNSUPPORTED_METHOD 121 +# define BIO_R_UNSUPPORTED_PROTOCOL_FAMILY 131 +# define BIO_R_WRITE_TO_READ_ONLY_BIO 126 +# define BIO_R_WSASTARTUP 122 + +#endif diff --git a/ONVIF/include/openssl/include/openssl/blowfish.h b/ONVIF/include/openssl/include/openssl/blowfish.h new file mode 100644 index 0000000..cd3e460 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/blowfish.h @@ -0,0 +1,61 @@ +/* + * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_BLOWFISH_H +# define HEADER_BLOWFISH_H + +# include + +# ifndef OPENSSL_NO_BF +# include +# ifdef __cplusplus +extern "C" { +# endif + +# define BF_ENCRYPT 1 +# define BF_DECRYPT 0 + +/*- + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * ! BF_LONG has to be at least 32 bits wide. ! + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + */ +# define BF_LONG unsigned int + +# define BF_ROUNDS 16 +# define BF_BLOCK 8 + +typedef struct bf_key_st { + BF_LONG P[BF_ROUNDS + 2]; + BF_LONG S[4 * 256]; +} BF_KEY; + +void BF_set_key(BF_KEY *key, int len, const unsigned char *data); + +void BF_encrypt(BF_LONG *data, const BF_KEY *key); +void BF_decrypt(BF_LONG *data, const BF_KEY *key); + +void BF_ecb_encrypt(const unsigned char *in, unsigned char *out, + const BF_KEY *key, int enc); +void BF_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, + const BF_KEY *schedule, unsigned char *ivec, int enc); +void BF_cfb64_encrypt(const unsigned char *in, unsigned char *out, + long length, const BF_KEY *schedule, + unsigned char *ivec, int *num, int enc); +void BF_ofb64_encrypt(const unsigned char *in, unsigned char *out, + long length, const BF_KEY *schedule, + unsigned char *ivec, int *num); +const char *BF_options(void); + +# ifdef __cplusplus +} +# endif +# endif + +#endif diff --git a/ONVIF/include/openssl/include/openssl/bn.h b/ONVIF/include/openssl/include/openssl/bn.h new file mode 100644 index 0000000..8af05d0 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/bn.h @@ -0,0 +1,539 @@ +/* + * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. + * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_BN_H +# define HEADER_BN_H + +# include +# ifndef OPENSSL_NO_STDIO +# include +# endif +# include +# include +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * 64-bit processor with LP64 ABI + */ +# ifdef SIXTY_FOUR_BIT_LONG +# define BN_ULONG unsigned long +# define BN_BYTES 8 +# endif + +/* + * 64-bit processor other than LP64 ABI + */ +# ifdef SIXTY_FOUR_BIT +# define BN_ULONG unsigned long long +# define BN_BYTES 8 +# endif + +# ifdef THIRTY_TWO_BIT +# define BN_ULONG unsigned int +# define BN_BYTES 4 +# endif + +# define BN_BITS2 (BN_BYTES * 8) +# define BN_BITS (BN_BITS2 * 2) +# define BN_TBIT ((BN_ULONG)1 << (BN_BITS2 - 1)) + +# define BN_FLG_MALLOCED 0x01 +# define BN_FLG_STATIC_DATA 0x02 + +/* + * avoid leaking exponent information through timing, + * BN_mod_exp_mont() will call BN_mod_exp_mont_consttime, + * BN_div() will call BN_div_no_branch, + * BN_mod_inverse() will call BN_mod_inverse_no_branch. + */ +# define BN_FLG_CONSTTIME 0x04 +# define BN_FLG_SECURE 0x08 + +# if OPENSSL_API_COMPAT < 0x00908000L +/* deprecated name for the flag */ +# define BN_FLG_EXP_CONSTTIME BN_FLG_CONSTTIME +# define BN_FLG_FREE 0x8000 /* used for debugging */ +# endif + +void BN_set_flags(BIGNUM *b, int n); +int BN_get_flags(const BIGNUM *b, int n); + +/* Values for |top| in BN_rand() */ +#define BN_RAND_TOP_ANY -1 +#define BN_RAND_TOP_ONE 0 +#define BN_RAND_TOP_TWO 1 + +/* Values for |bottom| in BN_rand() */ +#define BN_RAND_BOTTOM_ANY 0 +#define BN_RAND_BOTTOM_ODD 1 + +/* + * get a clone of a BIGNUM with changed flags, for *temporary* use only (the + * two BIGNUMs cannot be used in parallel!). Also only for *read only* use. The + * value |dest| should be a newly allocated BIGNUM obtained via BN_new() that + * has not been otherwise initialised or used. + */ +void BN_with_flags(BIGNUM *dest, const BIGNUM *b, int flags); + +/* Wrapper function to make using BN_GENCB easier */ +int BN_GENCB_call(BN_GENCB *cb, int a, int b); + +BN_GENCB *BN_GENCB_new(void); +void BN_GENCB_free(BN_GENCB *cb); + +/* Populate a BN_GENCB structure with an "old"-style callback */ +void BN_GENCB_set_old(BN_GENCB *gencb, void (*callback) (int, int, void *), + void *cb_arg); + +/* Populate a BN_GENCB structure with a "new"-style callback */ +void BN_GENCB_set(BN_GENCB *gencb, int (*callback) (int, int, BN_GENCB *), + void *cb_arg); + +void *BN_GENCB_get_arg(BN_GENCB *cb); + +# define BN_prime_checks 0 /* default: select number of iterations based + * on the size of the number */ + +/* + * BN_prime_checks_for_size() returns the number of Miller-Rabin iterations + * that will be done for checking that a random number is probably prime. The + * error rate for accepting a composite number as prime depends on the size of + * the prime |b|. The error rates used are for calculating an RSA key with 2 primes, + * and so the level is what you would expect for a key of double the size of the + * prime. + * + * This table is generated using the algorithm of FIPS PUB 186-4 + * Digital Signature Standard (DSS), section F.1, page 117. + * (https://dx.doi.org/10.6028/NIST.FIPS.186-4) + * + * The following magma script was used to generate the output: + * securitybits:=125; + * k:=1024; + * for t:=1 to 65 do + * for M:=3 to Floor(2*Sqrt(k-1)-1) do + * S:=0; + * // Sum over m + * for m:=3 to M do + * s:=0; + * // Sum over j + * for j:=2 to m do + * s+:=(RealField(32)!2)^-(j+(k-1)/j); + * end for; + * S+:=2^(m-(m-1)*t)*s; + * end for; + * A:=2^(k-2-M*t); + * B:=8*(Pi(RealField(32))^2-6)/3*2^(k-2)*S; + * pkt:=2.00743*Log(2)*k*2^-k*(A+B); + * seclevel:=Floor(-Log(2,pkt)); + * if seclevel ge securitybits then + * printf "k: %5o, security: %o bits (t: %o, M: %o)\n",k,seclevel,t,M; + * break; + * end if; + * end for; + * if seclevel ge securitybits then break; end if; + * end for; + * + * It can be run online at: + * http://magma.maths.usyd.edu.au/calc + * + * And will output: + * k: 1024, security: 129 bits (t: 6, M: 23) + * + * k is the number of bits of the prime, securitybits is the level we want to + * reach. + * + * prime length | RSA key size | # MR tests | security level + * -------------+--------------|------------+--------------- + * (b) >= 6394 | >= 12788 | 3 | 256 bit + * (b) >= 3747 | >= 7494 | 3 | 192 bit + * (b) >= 1345 | >= 2690 | 4 | 128 bit + * (b) >= 1080 | >= 2160 | 5 | 128 bit + * (b) >= 852 | >= 1704 | 5 | 112 bit + * (b) >= 476 | >= 952 | 5 | 80 bit + * (b) >= 400 | >= 800 | 6 | 80 bit + * (b) >= 347 | >= 694 | 7 | 80 bit + * (b) >= 308 | >= 616 | 8 | 80 bit + * (b) >= 55 | >= 110 | 27 | 64 bit + * (b) >= 6 | >= 12 | 34 | 64 bit + */ + +# define BN_prime_checks_for_size(b) ((b) >= 3747 ? 3 : \ + (b) >= 1345 ? 4 : \ + (b) >= 476 ? 5 : \ + (b) >= 400 ? 6 : \ + (b) >= 347 ? 7 : \ + (b) >= 308 ? 8 : \ + (b) >= 55 ? 27 : \ + /* b >= 6 */ 34) + +# define BN_num_bytes(a) ((BN_num_bits(a)+7)/8) + +int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w); +int BN_is_zero(const BIGNUM *a); +int BN_is_one(const BIGNUM *a); +int BN_is_word(const BIGNUM *a, const BN_ULONG w); +int BN_is_odd(const BIGNUM *a); + +# define BN_one(a) (BN_set_word((a),1)) + +void BN_zero_ex(BIGNUM *a); + +# if OPENSSL_API_COMPAT >= 0x00908000L +# define BN_zero(a) BN_zero_ex(a) +# else +# define BN_zero(a) (BN_set_word((a),0)) +# endif + +const BIGNUM *BN_value_one(void); +char *BN_options(void); +BN_CTX *BN_CTX_new(void); +BN_CTX *BN_CTX_secure_new(void); +void BN_CTX_free(BN_CTX *c); +void BN_CTX_start(BN_CTX *ctx); +BIGNUM *BN_CTX_get(BN_CTX *ctx); +void BN_CTX_end(BN_CTX *ctx); +int BN_rand(BIGNUM *rnd, int bits, int top, int bottom); +int BN_priv_rand(BIGNUM *rnd, int bits, int top, int bottom); +int BN_rand_range(BIGNUM *rnd, const BIGNUM *range); +int BN_priv_rand_range(BIGNUM *rnd, const BIGNUM *range); +int BN_pseudo_rand(BIGNUM *rnd, int bits, int top, int bottom); +int BN_pseudo_rand_range(BIGNUM *rnd, const BIGNUM *range); +int BN_num_bits(const BIGNUM *a); +int BN_num_bits_word(BN_ULONG l); +int BN_security_bits(int L, int N); +BIGNUM *BN_new(void); +BIGNUM *BN_secure_new(void); +void BN_clear_free(BIGNUM *a); +BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b); +void BN_swap(BIGNUM *a, BIGNUM *b); +BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret); +int BN_bn2bin(const BIGNUM *a, unsigned char *to); +int BN_bn2binpad(const BIGNUM *a, unsigned char *to, int tolen); +BIGNUM *BN_lebin2bn(const unsigned char *s, int len, BIGNUM *ret); +int BN_bn2lebinpad(const BIGNUM *a, unsigned char *to, int tolen); +BIGNUM *BN_mpi2bn(const unsigned char *s, int len, BIGNUM *ret); +int BN_bn2mpi(const BIGNUM *a, unsigned char *to); +int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); +int BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); +int BN_uadd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); +int BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); +int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); +int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx); +/** BN_set_negative sets sign of a BIGNUM + * \param b pointer to the BIGNUM object + * \param n 0 if the BIGNUM b should be positive and a value != 0 otherwise + */ +void BN_set_negative(BIGNUM *b, int n); +/** BN_is_negative returns 1 if the BIGNUM is negative + * \param b pointer to the BIGNUM object + * \return 1 if a < 0 and 0 otherwise + */ +int BN_is_negative(const BIGNUM *b); + +int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d, + BN_CTX *ctx); +# define BN_mod(rem,m,d,ctx) BN_div(NULL,(rem),(m),(d),(ctx)) +int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx); +int BN_mod_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, + BN_CTX *ctx); +int BN_mod_add_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, + const BIGNUM *m); +int BN_mod_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, + BN_CTX *ctx); +int BN_mod_sub_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, + const BIGNUM *m); +int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, + BN_CTX *ctx); +int BN_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx); +int BN_mod_lshift1(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx); +int BN_mod_lshift1_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *m); +int BN_mod_lshift(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m, + BN_CTX *ctx); +int BN_mod_lshift_quick(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m); + +BN_ULONG BN_mod_word(const BIGNUM *a, BN_ULONG w); +BN_ULONG BN_div_word(BIGNUM *a, BN_ULONG w); +int BN_mul_word(BIGNUM *a, BN_ULONG w); +int BN_add_word(BIGNUM *a, BN_ULONG w); +int BN_sub_word(BIGNUM *a, BN_ULONG w); +int BN_set_word(BIGNUM *a, BN_ULONG w); +BN_ULONG BN_get_word(const BIGNUM *a); + +int BN_cmp(const BIGNUM *a, const BIGNUM *b); +void BN_free(BIGNUM *a); +int BN_is_bit_set(const BIGNUM *a, int n); +int BN_lshift(BIGNUM *r, const BIGNUM *a, int n); +int BN_lshift1(BIGNUM *r, const BIGNUM *a); +int BN_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); + +int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, + const BIGNUM *m, BN_CTX *ctx); +int BN_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, + const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); +int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, + const BIGNUM *m, BN_CTX *ctx, + BN_MONT_CTX *in_mont); +int BN_mod_exp_mont_word(BIGNUM *r, BN_ULONG a, const BIGNUM *p, + const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); +int BN_mod_exp2_mont(BIGNUM *r, const BIGNUM *a1, const BIGNUM *p1, + const BIGNUM *a2, const BIGNUM *p2, const BIGNUM *m, + BN_CTX *ctx, BN_MONT_CTX *m_ctx); +int BN_mod_exp_simple(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, + const BIGNUM *m, BN_CTX *ctx); + +int BN_mask_bits(BIGNUM *a, int n); +# ifndef OPENSSL_NO_STDIO +int BN_print_fp(FILE *fp, const BIGNUM *a); +# endif +int BN_print(BIO *bio, const BIGNUM *a); +int BN_reciprocal(BIGNUM *r, const BIGNUM *m, int len, BN_CTX *ctx); +int BN_rshift(BIGNUM *r, const BIGNUM *a, int n); +int BN_rshift1(BIGNUM *r, const BIGNUM *a); +void BN_clear(BIGNUM *a); +BIGNUM *BN_dup(const BIGNUM *a); +int BN_ucmp(const BIGNUM *a, const BIGNUM *b); +int BN_set_bit(BIGNUM *a, int n); +int BN_clear_bit(BIGNUM *a, int n); +char *BN_bn2hex(const BIGNUM *a); +char *BN_bn2dec(const BIGNUM *a); +int BN_hex2bn(BIGNUM **a, const char *str); +int BN_dec2bn(BIGNUM **a, const char *str); +int BN_asc2bn(BIGNUM **a, const char *str); +int BN_gcd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); +int BN_kronecker(const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); /* returns + * -2 for + * error */ +BIGNUM *BN_mod_inverse(BIGNUM *ret, + const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx); +BIGNUM *BN_mod_sqrt(BIGNUM *ret, + const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx); + +void BN_consttime_swap(BN_ULONG swap, BIGNUM *a, BIGNUM *b, int nwords); + +/* Deprecated versions */ +DEPRECATEDIN_0_9_8(BIGNUM *BN_generate_prime(BIGNUM *ret, int bits, int safe, + const BIGNUM *add, + const BIGNUM *rem, + void (*callback) (int, int, + void *), + void *cb_arg)) +DEPRECATEDIN_0_9_8(int + BN_is_prime(const BIGNUM *p, int nchecks, + void (*callback) (int, int, void *), + BN_CTX *ctx, void *cb_arg)) +DEPRECATEDIN_0_9_8(int + BN_is_prime_fasttest(const BIGNUM *p, int nchecks, + void (*callback) (int, int, void *), + BN_CTX *ctx, void *cb_arg, + int do_trial_division)) + +/* Newer versions */ +int BN_generate_prime_ex(BIGNUM *ret, int bits, int safe, const BIGNUM *add, + const BIGNUM *rem, BN_GENCB *cb); +int BN_is_prime_ex(const BIGNUM *p, int nchecks, BN_CTX *ctx, BN_GENCB *cb); +int BN_is_prime_fasttest_ex(const BIGNUM *p, int nchecks, BN_CTX *ctx, + int do_trial_division, BN_GENCB *cb); + +int BN_X931_generate_Xpq(BIGNUM *Xp, BIGNUM *Xq, int nbits, BN_CTX *ctx); + +int BN_X931_derive_prime_ex(BIGNUM *p, BIGNUM *p1, BIGNUM *p2, + const BIGNUM *Xp, const BIGNUM *Xp1, + const BIGNUM *Xp2, const BIGNUM *e, BN_CTX *ctx, + BN_GENCB *cb); +int BN_X931_generate_prime_ex(BIGNUM *p, BIGNUM *p1, BIGNUM *p2, BIGNUM *Xp1, + BIGNUM *Xp2, const BIGNUM *Xp, const BIGNUM *e, + BN_CTX *ctx, BN_GENCB *cb); + +BN_MONT_CTX *BN_MONT_CTX_new(void); +int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, + BN_MONT_CTX *mont, BN_CTX *ctx); +int BN_to_montgomery(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont, + BN_CTX *ctx); +int BN_from_montgomery(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont, + BN_CTX *ctx); +void BN_MONT_CTX_free(BN_MONT_CTX *mont); +int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx); +BN_MONT_CTX *BN_MONT_CTX_copy(BN_MONT_CTX *to, BN_MONT_CTX *from); +BN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, CRYPTO_RWLOCK *lock, + const BIGNUM *mod, BN_CTX *ctx); + +/* BN_BLINDING flags */ +# define BN_BLINDING_NO_UPDATE 0x00000001 +# define BN_BLINDING_NO_RECREATE 0x00000002 + +BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, BIGNUM *mod); +void BN_BLINDING_free(BN_BLINDING *b); +int BN_BLINDING_update(BN_BLINDING *b, BN_CTX *ctx); +int BN_BLINDING_convert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx); +int BN_BLINDING_invert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx); +int BN_BLINDING_convert_ex(BIGNUM *n, BIGNUM *r, BN_BLINDING *b, BN_CTX *); +int BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b, + BN_CTX *); + +int BN_BLINDING_is_current_thread(BN_BLINDING *b); +void BN_BLINDING_set_current_thread(BN_BLINDING *b); +int BN_BLINDING_lock(BN_BLINDING *b); +int BN_BLINDING_unlock(BN_BLINDING *b); + +unsigned long BN_BLINDING_get_flags(const BN_BLINDING *); +void BN_BLINDING_set_flags(BN_BLINDING *, unsigned long); +BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b, + const BIGNUM *e, BIGNUM *m, BN_CTX *ctx, + int (*bn_mod_exp) (BIGNUM *r, + const BIGNUM *a, + const BIGNUM *p, + const BIGNUM *m, + BN_CTX *ctx, + BN_MONT_CTX *m_ctx), + BN_MONT_CTX *m_ctx); + +DEPRECATEDIN_0_9_8(void BN_set_params(int mul, int high, int low, int mont)) +DEPRECATEDIN_0_9_8(int BN_get_params(int which)) /* 0, mul, 1 high, 2 low, 3 + * mont */ + +BN_RECP_CTX *BN_RECP_CTX_new(void); +void BN_RECP_CTX_free(BN_RECP_CTX *recp); +int BN_RECP_CTX_set(BN_RECP_CTX *recp, const BIGNUM *rdiv, BN_CTX *ctx); +int BN_mod_mul_reciprocal(BIGNUM *r, const BIGNUM *x, const BIGNUM *y, + BN_RECP_CTX *recp, BN_CTX *ctx); +int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, + const BIGNUM *m, BN_CTX *ctx); +int BN_div_recp(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, + BN_RECP_CTX *recp, BN_CTX *ctx); + +# ifndef OPENSSL_NO_EC2M + +/* + * Functions for arithmetic over binary polynomials represented by BIGNUMs. + * The BIGNUM::neg property of BIGNUMs representing binary polynomials is + * ignored. Note that input arguments are not const so that their bit arrays + * can be expanded to the appropriate size if needed. + */ + +/* + * r = a + b + */ +int BN_GF2m_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); +# define BN_GF2m_sub(r, a, b) BN_GF2m_add(r, a, b) +/* + * r=a mod p + */ +int BN_GF2m_mod(BIGNUM *r, const BIGNUM *a, const BIGNUM *p); +/* r = (a * b) mod p */ +int BN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, + const BIGNUM *p, BN_CTX *ctx); +/* r = (a * a) mod p */ +int BN_GF2m_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); +/* r = (1 / b) mod p */ +int BN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *b, const BIGNUM *p, BN_CTX *ctx); +/* r = (a / b) mod p */ +int BN_GF2m_mod_div(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, + const BIGNUM *p, BN_CTX *ctx); +/* r = (a ^ b) mod p */ +int BN_GF2m_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, + const BIGNUM *p, BN_CTX *ctx); +/* r = sqrt(a) mod p */ +int BN_GF2m_mod_sqrt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, + BN_CTX *ctx); +/* r^2 + r = a mod p */ +int BN_GF2m_mod_solve_quad(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, + BN_CTX *ctx); +# define BN_GF2m_cmp(a, b) BN_ucmp((a), (b)) +/*- + * Some functions allow for representation of the irreducible polynomials + * as an unsigned int[], say p. The irreducible f(t) is then of the form: + * t^p[0] + t^p[1] + ... + t^p[k] + * where m = p[0] > p[1] > ... > p[k] = 0. + */ +/* r = a mod p */ +int BN_GF2m_mod_arr(BIGNUM *r, const BIGNUM *a, const int p[]); +/* r = (a * b) mod p */ +int BN_GF2m_mod_mul_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, + const int p[], BN_CTX *ctx); +/* r = (a * a) mod p */ +int BN_GF2m_mod_sqr_arr(BIGNUM *r, const BIGNUM *a, const int p[], + BN_CTX *ctx); +/* r = (1 / b) mod p */ +int BN_GF2m_mod_inv_arr(BIGNUM *r, const BIGNUM *b, const int p[], + BN_CTX *ctx); +/* r = (a / b) mod p */ +int BN_GF2m_mod_div_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, + const int p[], BN_CTX *ctx); +/* r = (a ^ b) mod p */ +int BN_GF2m_mod_exp_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, + const int p[], BN_CTX *ctx); +/* r = sqrt(a) mod p */ +int BN_GF2m_mod_sqrt_arr(BIGNUM *r, const BIGNUM *a, + const int p[], BN_CTX *ctx); +/* r^2 + r = a mod p */ +int BN_GF2m_mod_solve_quad_arr(BIGNUM *r, const BIGNUM *a, + const int p[], BN_CTX *ctx); +int BN_GF2m_poly2arr(const BIGNUM *a, int p[], int max); +int BN_GF2m_arr2poly(const int p[], BIGNUM *a); + +# endif + +/* + * faster mod functions for the 'NIST primes' 0 <= a < p^2 + */ +int BN_nist_mod_192(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); +int BN_nist_mod_224(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); +int BN_nist_mod_256(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); +int BN_nist_mod_384(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); +int BN_nist_mod_521(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); + +const BIGNUM *BN_get0_nist_prime_192(void); +const BIGNUM *BN_get0_nist_prime_224(void); +const BIGNUM *BN_get0_nist_prime_256(void); +const BIGNUM *BN_get0_nist_prime_384(void); +const BIGNUM *BN_get0_nist_prime_521(void); + +int (*BN_nist_mod_func(const BIGNUM *p)) (BIGNUM *r, const BIGNUM *a, + const BIGNUM *field, BN_CTX *ctx); + +int BN_generate_dsa_nonce(BIGNUM *out, const BIGNUM *range, + const BIGNUM *priv, const unsigned char *message, + size_t message_len, BN_CTX *ctx); + +/* Primes from RFC 2409 */ +BIGNUM *BN_get_rfc2409_prime_768(BIGNUM *bn); +BIGNUM *BN_get_rfc2409_prime_1024(BIGNUM *bn); + +/* Primes from RFC 3526 */ +BIGNUM *BN_get_rfc3526_prime_1536(BIGNUM *bn); +BIGNUM *BN_get_rfc3526_prime_2048(BIGNUM *bn); +BIGNUM *BN_get_rfc3526_prime_3072(BIGNUM *bn); +BIGNUM *BN_get_rfc3526_prime_4096(BIGNUM *bn); +BIGNUM *BN_get_rfc3526_prime_6144(BIGNUM *bn); +BIGNUM *BN_get_rfc3526_prime_8192(BIGNUM *bn); + +# if OPENSSL_API_COMPAT < 0x10100000L +# define get_rfc2409_prime_768 BN_get_rfc2409_prime_768 +# define get_rfc2409_prime_1024 BN_get_rfc2409_prime_1024 +# define get_rfc3526_prime_1536 BN_get_rfc3526_prime_1536 +# define get_rfc3526_prime_2048 BN_get_rfc3526_prime_2048 +# define get_rfc3526_prime_3072 BN_get_rfc3526_prime_3072 +# define get_rfc3526_prime_4096 BN_get_rfc3526_prime_4096 +# define get_rfc3526_prime_6144 BN_get_rfc3526_prime_6144 +# define get_rfc3526_prime_8192 BN_get_rfc3526_prime_8192 +# endif + +int BN_bntest_rand(BIGNUM *rnd, int bits, int top, int bottom); + + +# ifdef __cplusplus +} +# endif +#endif diff --git a/ONVIF/include/openssl/include/openssl/bnerr.h b/ONVIF/include/openssl/include/openssl/bnerr.h new file mode 100644 index 0000000..9f3c7cf --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/bnerr.h @@ -0,0 +1,100 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_BNERR_H +# define HEADER_BNERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_BN_strings(void); + +/* + * BN function codes. + */ +# define BN_F_BNRAND 127 +# define BN_F_BNRAND_RANGE 138 +# define BN_F_BN_BLINDING_CONVERT_EX 100 +# define BN_F_BN_BLINDING_CREATE_PARAM 128 +# define BN_F_BN_BLINDING_INVERT_EX 101 +# define BN_F_BN_BLINDING_NEW 102 +# define BN_F_BN_BLINDING_UPDATE 103 +# define BN_F_BN_BN2DEC 104 +# define BN_F_BN_BN2HEX 105 +# define BN_F_BN_COMPUTE_WNAF 142 +# define BN_F_BN_CTX_GET 116 +# define BN_F_BN_CTX_NEW 106 +# define BN_F_BN_CTX_START 129 +# define BN_F_BN_DIV 107 +# define BN_F_BN_DIV_RECP 130 +# define BN_F_BN_EXP 123 +# define BN_F_BN_EXPAND_INTERNAL 120 +# define BN_F_BN_GENCB_NEW 143 +# define BN_F_BN_GENERATE_DSA_NONCE 140 +# define BN_F_BN_GENERATE_PRIME_EX 141 +# define BN_F_BN_GF2M_MOD 131 +# define BN_F_BN_GF2M_MOD_EXP 132 +# define BN_F_BN_GF2M_MOD_MUL 133 +# define BN_F_BN_GF2M_MOD_SOLVE_QUAD 134 +# define BN_F_BN_GF2M_MOD_SOLVE_QUAD_ARR 135 +# define BN_F_BN_GF2M_MOD_SQR 136 +# define BN_F_BN_GF2M_MOD_SQRT 137 +# define BN_F_BN_LSHIFT 145 +# define BN_F_BN_MOD_EXP2_MONT 118 +# define BN_F_BN_MOD_EXP_MONT 109 +# define BN_F_BN_MOD_EXP_MONT_CONSTTIME 124 +# define BN_F_BN_MOD_EXP_MONT_WORD 117 +# define BN_F_BN_MOD_EXP_RECP 125 +# define BN_F_BN_MOD_EXP_SIMPLE 126 +# define BN_F_BN_MOD_INVERSE 110 +# define BN_F_BN_MOD_INVERSE_NO_BRANCH 139 +# define BN_F_BN_MOD_LSHIFT_QUICK 119 +# define BN_F_BN_MOD_SQRT 121 +# define BN_F_BN_MONT_CTX_NEW 149 +# define BN_F_BN_MPI2BN 112 +# define BN_F_BN_NEW 113 +# define BN_F_BN_POOL_GET 147 +# define BN_F_BN_RAND 114 +# define BN_F_BN_RAND_RANGE 122 +# define BN_F_BN_RECP_CTX_NEW 150 +# define BN_F_BN_RSHIFT 146 +# define BN_F_BN_SET_WORDS 144 +# define BN_F_BN_STACK_PUSH 148 +# define BN_F_BN_USUB 115 + +/* + * BN reason codes. + */ +# define BN_R_ARG2_LT_ARG3 100 +# define BN_R_BAD_RECIPROCAL 101 +# define BN_R_BIGNUM_TOO_LONG 114 +# define BN_R_BITS_TOO_SMALL 118 +# define BN_R_CALLED_WITH_EVEN_MODULUS 102 +# define BN_R_DIV_BY_ZERO 103 +# define BN_R_ENCODING_ERROR 104 +# define BN_R_EXPAND_ON_STATIC_BIGNUM_DATA 105 +# define BN_R_INPUT_NOT_REDUCED 110 +# define BN_R_INVALID_LENGTH 106 +# define BN_R_INVALID_RANGE 115 +# define BN_R_INVALID_SHIFT 119 +# define BN_R_NOT_A_SQUARE 111 +# define BN_R_NOT_INITIALIZED 107 +# define BN_R_NO_INVERSE 108 +# define BN_R_NO_SOLUTION 116 +# define BN_R_PRIVATE_KEY_TOO_LARGE 117 +# define BN_R_P_IS_NOT_PRIME 112 +# define BN_R_TOO_MANY_ITERATIONS 113 +# define BN_R_TOO_MANY_TEMPORARY_VARIABLES 109 + +#endif diff --git a/ONVIF/include/openssl/include/openssl/buffer.h b/ONVIF/include/openssl/include/openssl/buffer.h new file mode 100644 index 0000000..d276576 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/buffer.h @@ -0,0 +1,58 @@ +/* + * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_BUFFER_H +# define HEADER_BUFFER_H + +# include +# ifndef HEADER_CRYPTO_H +# include +# endif +# include + + +#ifdef __cplusplus +extern "C" { +#endif + +# include +# include + +/* + * These names are outdated as of OpenSSL 1.1; a future release + * will move them to be deprecated. + */ +# define BUF_strdup(s) OPENSSL_strdup(s) +# define BUF_strndup(s, size) OPENSSL_strndup(s, size) +# define BUF_memdup(data, size) OPENSSL_memdup(data, size) +# define BUF_strlcpy(dst, src, size) OPENSSL_strlcpy(dst, src, size) +# define BUF_strlcat(dst, src, size) OPENSSL_strlcat(dst, src, size) +# define BUF_strnlen(str, maxlen) OPENSSL_strnlen(str, maxlen) + +struct buf_mem_st { + size_t length; /* current number of bytes */ + char *data; + size_t max; /* size of buffer */ + unsigned long flags; +}; + +# define BUF_MEM_FLAG_SECURE 0x01 + +BUF_MEM *BUF_MEM_new(void); +BUF_MEM *BUF_MEM_new_ex(unsigned long flags); +void BUF_MEM_free(BUF_MEM *a); +size_t BUF_MEM_grow(BUF_MEM *str, size_t len); +size_t BUF_MEM_grow_clean(BUF_MEM *str, size_t len); +void BUF_reverse(unsigned char *out, const unsigned char *in, size_t siz); + + +# ifdef __cplusplus +} +# endif +#endif diff --git a/ONVIF/include/openssl/include/openssl/buffererr.h b/ONVIF/include/openssl/include/openssl/buffererr.h new file mode 100644 index 0000000..04f6ff7 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/buffererr.h @@ -0,0 +1,34 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_BUFERR_H +# define HEADER_BUFERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_BUF_strings(void); + +/* + * BUF function codes. + */ +# define BUF_F_BUF_MEM_GROW 100 +# define BUF_F_BUF_MEM_GROW_CLEAN 105 +# define BUF_F_BUF_MEM_NEW 101 + +/* + * BUF reason codes. + */ + +#endif diff --git a/ONVIF/include/openssl/include/openssl/camellia.h b/ONVIF/include/openssl/include/openssl/camellia.h new file mode 100644 index 0000000..151f3c1 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/camellia.h @@ -0,0 +1,83 @@ +/* + * Copyright 2006-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_CAMELLIA_H +# define HEADER_CAMELLIA_H + +# include + +# ifndef OPENSSL_NO_CAMELLIA +# include +#ifdef __cplusplus +extern "C" { +#endif + +# define CAMELLIA_ENCRYPT 1 +# define CAMELLIA_DECRYPT 0 + +/* + * Because array size can't be a const in C, the following two are macros. + * Both sizes are in bytes. + */ + +/* This should be a hidden type, but EVP requires that the size be known */ + +# define CAMELLIA_BLOCK_SIZE 16 +# define CAMELLIA_TABLE_BYTE_LEN 272 +# define CAMELLIA_TABLE_WORD_LEN (CAMELLIA_TABLE_BYTE_LEN / 4) + +typedef unsigned int KEY_TABLE_TYPE[CAMELLIA_TABLE_WORD_LEN]; /* to match + * with WORD */ + +struct camellia_key_st { + union { + double d; /* ensures 64-bit align */ + KEY_TABLE_TYPE rd_key; + } u; + int grand_rounds; +}; +typedef struct camellia_key_st CAMELLIA_KEY; + +int Camellia_set_key(const unsigned char *userKey, const int bits, + CAMELLIA_KEY *key); + +void Camellia_encrypt(const unsigned char *in, unsigned char *out, + const CAMELLIA_KEY *key); +void Camellia_decrypt(const unsigned char *in, unsigned char *out, + const CAMELLIA_KEY *key); + +void Camellia_ecb_encrypt(const unsigned char *in, unsigned char *out, + const CAMELLIA_KEY *key, const int enc); +void Camellia_cbc_encrypt(const unsigned char *in, unsigned char *out, + size_t length, const CAMELLIA_KEY *key, + unsigned char *ivec, const int enc); +void Camellia_cfb128_encrypt(const unsigned char *in, unsigned char *out, + size_t length, const CAMELLIA_KEY *key, + unsigned char *ivec, int *num, const int enc); +void Camellia_cfb1_encrypt(const unsigned char *in, unsigned char *out, + size_t length, const CAMELLIA_KEY *key, + unsigned char *ivec, int *num, const int enc); +void Camellia_cfb8_encrypt(const unsigned char *in, unsigned char *out, + size_t length, const CAMELLIA_KEY *key, + unsigned char *ivec, int *num, const int enc); +void Camellia_ofb128_encrypt(const unsigned char *in, unsigned char *out, + size_t length, const CAMELLIA_KEY *key, + unsigned char *ivec, int *num); +void Camellia_ctr128_encrypt(const unsigned char *in, unsigned char *out, + size_t length, const CAMELLIA_KEY *key, + unsigned char ivec[CAMELLIA_BLOCK_SIZE], + unsigned char ecount_buf[CAMELLIA_BLOCK_SIZE], + unsigned int *num); + +# ifdef __cplusplus +} +# endif +# endif + +#endif diff --git a/ONVIF/include/openssl/include/openssl/cast.h b/ONVIF/include/openssl/include/openssl/cast.h new file mode 100644 index 0000000..2cc89ae --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/cast.h @@ -0,0 +1,53 @@ +/* + * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_CAST_H +# define HEADER_CAST_H + +# include + +# ifndef OPENSSL_NO_CAST +# ifdef __cplusplus +extern "C" { +# endif + +# define CAST_ENCRYPT 1 +# define CAST_DECRYPT 0 + +# define CAST_LONG unsigned int + +# define CAST_BLOCK 8 +# define CAST_KEY_LENGTH 16 + +typedef struct cast_key_st { + CAST_LONG data[32]; + int short_key; /* Use reduced rounds for short key */ +} CAST_KEY; + +void CAST_set_key(CAST_KEY *key, int len, const unsigned char *data); +void CAST_ecb_encrypt(const unsigned char *in, unsigned char *out, + const CAST_KEY *key, int enc); +void CAST_encrypt(CAST_LONG *data, const CAST_KEY *key); +void CAST_decrypt(CAST_LONG *data, const CAST_KEY *key); +void CAST_cbc_encrypt(const unsigned char *in, unsigned char *out, + long length, const CAST_KEY *ks, unsigned char *iv, + int enc); +void CAST_cfb64_encrypt(const unsigned char *in, unsigned char *out, + long length, const CAST_KEY *schedule, + unsigned char *ivec, int *num, int enc); +void CAST_ofb64_encrypt(const unsigned char *in, unsigned char *out, + long length, const CAST_KEY *schedule, + unsigned char *ivec, int *num); + +# ifdef __cplusplus +} +# endif +# endif + +#endif diff --git a/ONVIF/include/openssl/include/openssl/cmac.h b/ONVIF/include/openssl/include/openssl/cmac.h new file mode 100644 index 0000000..3535a9a --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/cmac.h @@ -0,0 +1,41 @@ +/* + * Copyright 2010-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_CMAC_H +# define HEADER_CMAC_H + +# ifndef OPENSSL_NO_CMAC + +#ifdef __cplusplus +extern "C" { +#endif + +# include + +/* Opaque */ +typedef struct CMAC_CTX_st CMAC_CTX; + +CMAC_CTX *CMAC_CTX_new(void); +void CMAC_CTX_cleanup(CMAC_CTX *ctx); +void CMAC_CTX_free(CMAC_CTX *ctx); +EVP_CIPHER_CTX *CMAC_CTX_get0_cipher_ctx(CMAC_CTX *ctx); +int CMAC_CTX_copy(CMAC_CTX *out, const CMAC_CTX *in); + +int CMAC_Init(CMAC_CTX *ctx, const void *key, size_t keylen, + const EVP_CIPHER *cipher, ENGINE *impl); +int CMAC_Update(CMAC_CTX *ctx, const void *data, size_t dlen); +int CMAC_Final(CMAC_CTX *ctx, unsigned char *out, size_t *poutlen); +int CMAC_resume(CMAC_CTX *ctx); + +#ifdef __cplusplus +} +#endif + +# endif +#endif diff --git a/ONVIF/include/openssl/include/openssl/cms.h b/ONVIF/include/openssl/include/openssl/cms.h new file mode 100644 index 0000000..c762796 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/cms.h @@ -0,0 +1,339 @@ +/* + * Copyright 2008-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_CMS_H +# define HEADER_CMS_H + +# include + +# ifndef OPENSSL_NO_CMS +# include +# include +# include +# ifdef __cplusplus +extern "C" { +# endif + +typedef struct CMS_ContentInfo_st CMS_ContentInfo; +typedef struct CMS_SignerInfo_st CMS_SignerInfo; +typedef struct CMS_CertificateChoices CMS_CertificateChoices; +typedef struct CMS_RevocationInfoChoice_st CMS_RevocationInfoChoice; +typedef struct CMS_RecipientInfo_st CMS_RecipientInfo; +typedef struct CMS_ReceiptRequest_st CMS_ReceiptRequest; +typedef struct CMS_Receipt_st CMS_Receipt; +typedef struct CMS_RecipientEncryptedKey_st CMS_RecipientEncryptedKey; +typedef struct CMS_OtherKeyAttribute_st CMS_OtherKeyAttribute; + +DEFINE_STACK_OF(CMS_SignerInfo) +DEFINE_STACK_OF(CMS_RecipientEncryptedKey) +DEFINE_STACK_OF(CMS_RecipientInfo) +DEFINE_STACK_OF(CMS_RevocationInfoChoice) +DECLARE_ASN1_FUNCTIONS(CMS_ContentInfo) +DECLARE_ASN1_FUNCTIONS(CMS_ReceiptRequest) +DECLARE_ASN1_PRINT_FUNCTION(CMS_ContentInfo) + +# define CMS_SIGNERINFO_ISSUER_SERIAL 0 +# define CMS_SIGNERINFO_KEYIDENTIFIER 1 + +# define CMS_RECIPINFO_NONE -1 +# define CMS_RECIPINFO_TRANS 0 +# define CMS_RECIPINFO_AGREE 1 +# define CMS_RECIPINFO_KEK 2 +# define CMS_RECIPINFO_PASS 3 +# define CMS_RECIPINFO_OTHER 4 + +/* S/MIME related flags */ + +# define CMS_TEXT 0x1 +# define CMS_NOCERTS 0x2 +# define CMS_NO_CONTENT_VERIFY 0x4 +# define CMS_NO_ATTR_VERIFY 0x8 +# define CMS_NOSIGS \ + (CMS_NO_CONTENT_VERIFY|CMS_NO_ATTR_VERIFY) +# define CMS_NOINTERN 0x10 +# define CMS_NO_SIGNER_CERT_VERIFY 0x20 +# define CMS_NOVERIFY 0x20 +# define CMS_DETACHED 0x40 +# define CMS_BINARY 0x80 +# define CMS_NOATTR 0x100 +# define CMS_NOSMIMECAP 0x200 +# define CMS_NOOLDMIMETYPE 0x400 +# define CMS_CRLFEOL 0x800 +# define CMS_STREAM 0x1000 +# define CMS_NOCRL 0x2000 +# define CMS_PARTIAL 0x4000 +# define CMS_REUSE_DIGEST 0x8000 +# define CMS_USE_KEYID 0x10000 +# define CMS_DEBUG_DECRYPT 0x20000 +# define CMS_KEY_PARAM 0x40000 +# define CMS_ASCIICRLF 0x80000 + +const ASN1_OBJECT *CMS_get0_type(const CMS_ContentInfo *cms); + +BIO *CMS_dataInit(CMS_ContentInfo *cms, BIO *icont); +int CMS_dataFinal(CMS_ContentInfo *cms, BIO *bio); + +ASN1_OCTET_STRING **CMS_get0_content(CMS_ContentInfo *cms); +int CMS_is_detached(CMS_ContentInfo *cms); +int CMS_set_detached(CMS_ContentInfo *cms, int detached); + +# ifdef HEADER_PEM_H +DECLARE_PEM_rw_const(CMS, CMS_ContentInfo) +# endif +int CMS_stream(unsigned char ***boundary, CMS_ContentInfo *cms); +CMS_ContentInfo *d2i_CMS_bio(BIO *bp, CMS_ContentInfo **cms); +int i2d_CMS_bio(BIO *bp, CMS_ContentInfo *cms); + +BIO *BIO_new_CMS(BIO *out, CMS_ContentInfo *cms); +int i2d_CMS_bio_stream(BIO *out, CMS_ContentInfo *cms, BIO *in, int flags); +int PEM_write_bio_CMS_stream(BIO *out, CMS_ContentInfo *cms, BIO *in, + int flags); +CMS_ContentInfo *SMIME_read_CMS(BIO *bio, BIO **bcont); +int SMIME_write_CMS(BIO *bio, CMS_ContentInfo *cms, BIO *data, int flags); + +int CMS_final(CMS_ContentInfo *cms, BIO *data, BIO *dcont, + unsigned int flags); + +CMS_ContentInfo *CMS_sign(X509 *signcert, EVP_PKEY *pkey, + STACK_OF(X509) *certs, BIO *data, + unsigned int flags); + +CMS_ContentInfo *CMS_sign_receipt(CMS_SignerInfo *si, + X509 *signcert, EVP_PKEY *pkey, + STACK_OF(X509) *certs, unsigned int flags); + +int CMS_data(CMS_ContentInfo *cms, BIO *out, unsigned int flags); +CMS_ContentInfo *CMS_data_create(BIO *in, unsigned int flags); + +int CMS_digest_verify(CMS_ContentInfo *cms, BIO *dcont, BIO *out, + unsigned int flags); +CMS_ContentInfo *CMS_digest_create(BIO *in, const EVP_MD *md, + unsigned int flags); + +int CMS_EncryptedData_decrypt(CMS_ContentInfo *cms, + const unsigned char *key, size_t keylen, + BIO *dcont, BIO *out, unsigned int flags); + +CMS_ContentInfo *CMS_EncryptedData_encrypt(BIO *in, const EVP_CIPHER *cipher, + const unsigned char *key, + size_t keylen, unsigned int flags); + +int CMS_EncryptedData_set1_key(CMS_ContentInfo *cms, const EVP_CIPHER *ciph, + const unsigned char *key, size_t keylen); + +int CMS_verify(CMS_ContentInfo *cms, STACK_OF(X509) *certs, + X509_STORE *store, BIO *dcont, BIO *out, unsigned int flags); + +int CMS_verify_receipt(CMS_ContentInfo *rcms, CMS_ContentInfo *ocms, + STACK_OF(X509) *certs, + X509_STORE *store, unsigned int flags); + +STACK_OF(X509) *CMS_get0_signers(CMS_ContentInfo *cms); + +CMS_ContentInfo *CMS_encrypt(STACK_OF(X509) *certs, BIO *in, + const EVP_CIPHER *cipher, unsigned int flags); + +int CMS_decrypt(CMS_ContentInfo *cms, EVP_PKEY *pkey, X509 *cert, + BIO *dcont, BIO *out, unsigned int flags); + +int CMS_decrypt_set1_pkey(CMS_ContentInfo *cms, EVP_PKEY *pk, X509 *cert); +int CMS_decrypt_set1_key(CMS_ContentInfo *cms, + unsigned char *key, size_t keylen, + const unsigned char *id, size_t idlen); +int CMS_decrypt_set1_password(CMS_ContentInfo *cms, + unsigned char *pass, ossl_ssize_t passlen); + +STACK_OF(CMS_RecipientInfo) *CMS_get0_RecipientInfos(CMS_ContentInfo *cms); +int CMS_RecipientInfo_type(CMS_RecipientInfo *ri); +EVP_PKEY_CTX *CMS_RecipientInfo_get0_pkey_ctx(CMS_RecipientInfo *ri); +CMS_ContentInfo *CMS_EnvelopedData_create(const EVP_CIPHER *cipher); +CMS_RecipientInfo *CMS_add1_recipient_cert(CMS_ContentInfo *cms, + X509 *recip, unsigned int flags); +int CMS_RecipientInfo_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pkey); +int CMS_RecipientInfo_ktri_cert_cmp(CMS_RecipientInfo *ri, X509 *cert); +int CMS_RecipientInfo_ktri_get0_algs(CMS_RecipientInfo *ri, + EVP_PKEY **pk, X509 **recip, + X509_ALGOR **palg); +int CMS_RecipientInfo_ktri_get0_signer_id(CMS_RecipientInfo *ri, + ASN1_OCTET_STRING **keyid, + X509_NAME **issuer, + ASN1_INTEGER **sno); + +CMS_RecipientInfo *CMS_add0_recipient_key(CMS_ContentInfo *cms, int nid, + unsigned char *key, size_t keylen, + unsigned char *id, size_t idlen, + ASN1_GENERALIZEDTIME *date, + ASN1_OBJECT *otherTypeId, + ASN1_TYPE *otherType); + +int CMS_RecipientInfo_kekri_get0_id(CMS_RecipientInfo *ri, + X509_ALGOR **palg, + ASN1_OCTET_STRING **pid, + ASN1_GENERALIZEDTIME **pdate, + ASN1_OBJECT **potherid, + ASN1_TYPE **pothertype); + +int CMS_RecipientInfo_set0_key(CMS_RecipientInfo *ri, + unsigned char *key, size_t keylen); + +int CMS_RecipientInfo_kekri_id_cmp(CMS_RecipientInfo *ri, + const unsigned char *id, size_t idlen); + +int CMS_RecipientInfo_set0_password(CMS_RecipientInfo *ri, + unsigned char *pass, + ossl_ssize_t passlen); + +CMS_RecipientInfo *CMS_add0_recipient_password(CMS_ContentInfo *cms, + int iter, int wrap_nid, + int pbe_nid, + unsigned char *pass, + ossl_ssize_t passlen, + const EVP_CIPHER *kekciph); + +int CMS_RecipientInfo_decrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri); +int CMS_RecipientInfo_encrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri); + +int CMS_uncompress(CMS_ContentInfo *cms, BIO *dcont, BIO *out, + unsigned int flags); +CMS_ContentInfo *CMS_compress(BIO *in, int comp_nid, unsigned int flags); + +int CMS_set1_eContentType(CMS_ContentInfo *cms, const ASN1_OBJECT *oid); +const ASN1_OBJECT *CMS_get0_eContentType(CMS_ContentInfo *cms); + +CMS_CertificateChoices *CMS_add0_CertificateChoices(CMS_ContentInfo *cms); +int CMS_add0_cert(CMS_ContentInfo *cms, X509 *cert); +int CMS_add1_cert(CMS_ContentInfo *cms, X509 *cert); +STACK_OF(X509) *CMS_get1_certs(CMS_ContentInfo *cms); + +CMS_RevocationInfoChoice *CMS_add0_RevocationInfoChoice(CMS_ContentInfo *cms); +int CMS_add0_crl(CMS_ContentInfo *cms, X509_CRL *crl); +int CMS_add1_crl(CMS_ContentInfo *cms, X509_CRL *crl); +STACK_OF(X509_CRL) *CMS_get1_crls(CMS_ContentInfo *cms); + +int CMS_SignedData_init(CMS_ContentInfo *cms); +CMS_SignerInfo *CMS_add1_signer(CMS_ContentInfo *cms, + X509 *signer, EVP_PKEY *pk, const EVP_MD *md, + unsigned int flags); +EVP_PKEY_CTX *CMS_SignerInfo_get0_pkey_ctx(CMS_SignerInfo *si); +EVP_MD_CTX *CMS_SignerInfo_get0_md_ctx(CMS_SignerInfo *si); +STACK_OF(CMS_SignerInfo) *CMS_get0_SignerInfos(CMS_ContentInfo *cms); + +void CMS_SignerInfo_set1_signer_cert(CMS_SignerInfo *si, X509 *signer); +int CMS_SignerInfo_get0_signer_id(CMS_SignerInfo *si, + ASN1_OCTET_STRING **keyid, + X509_NAME **issuer, ASN1_INTEGER **sno); +int CMS_SignerInfo_cert_cmp(CMS_SignerInfo *si, X509 *cert); +int CMS_set1_signers_certs(CMS_ContentInfo *cms, STACK_OF(X509) *certs, + unsigned int flags); +void CMS_SignerInfo_get0_algs(CMS_SignerInfo *si, EVP_PKEY **pk, + X509 **signer, X509_ALGOR **pdig, + X509_ALGOR **psig); +ASN1_OCTET_STRING *CMS_SignerInfo_get0_signature(CMS_SignerInfo *si); +int CMS_SignerInfo_sign(CMS_SignerInfo *si); +int CMS_SignerInfo_verify(CMS_SignerInfo *si); +int CMS_SignerInfo_verify_content(CMS_SignerInfo *si, BIO *chain); + +int CMS_add_smimecap(CMS_SignerInfo *si, STACK_OF(X509_ALGOR) *algs); +int CMS_add_simple_smimecap(STACK_OF(X509_ALGOR) **algs, + int algnid, int keysize); +int CMS_add_standard_smimecap(STACK_OF(X509_ALGOR) **smcap); + +int CMS_signed_get_attr_count(const CMS_SignerInfo *si); +int CMS_signed_get_attr_by_NID(const CMS_SignerInfo *si, int nid, + int lastpos); +int CMS_signed_get_attr_by_OBJ(const CMS_SignerInfo *si, const ASN1_OBJECT *obj, + int lastpos); +X509_ATTRIBUTE *CMS_signed_get_attr(const CMS_SignerInfo *si, int loc); +X509_ATTRIBUTE *CMS_signed_delete_attr(CMS_SignerInfo *si, int loc); +int CMS_signed_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr); +int CMS_signed_add1_attr_by_OBJ(CMS_SignerInfo *si, + const ASN1_OBJECT *obj, int type, + const void *bytes, int len); +int CMS_signed_add1_attr_by_NID(CMS_SignerInfo *si, + int nid, int type, + const void *bytes, int len); +int CMS_signed_add1_attr_by_txt(CMS_SignerInfo *si, + const char *attrname, int type, + const void *bytes, int len); +void *CMS_signed_get0_data_by_OBJ(CMS_SignerInfo *si, const ASN1_OBJECT *oid, + int lastpos, int type); + +int CMS_unsigned_get_attr_count(const CMS_SignerInfo *si); +int CMS_unsigned_get_attr_by_NID(const CMS_SignerInfo *si, int nid, + int lastpos); +int CMS_unsigned_get_attr_by_OBJ(const CMS_SignerInfo *si, + const ASN1_OBJECT *obj, int lastpos); +X509_ATTRIBUTE *CMS_unsigned_get_attr(const CMS_SignerInfo *si, int loc); +X509_ATTRIBUTE *CMS_unsigned_delete_attr(CMS_SignerInfo *si, int loc); +int CMS_unsigned_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr); +int CMS_unsigned_add1_attr_by_OBJ(CMS_SignerInfo *si, + const ASN1_OBJECT *obj, int type, + const void *bytes, int len); +int CMS_unsigned_add1_attr_by_NID(CMS_SignerInfo *si, + int nid, int type, + const void *bytes, int len); +int CMS_unsigned_add1_attr_by_txt(CMS_SignerInfo *si, + const char *attrname, int type, + const void *bytes, int len); +void *CMS_unsigned_get0_data_by_OBJ(CMS_SignerInfo *si, ASN1_OBJECT *oid, + int lastpos, int type); + +int CMS_get1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest **prr); +CMS_ReceiptRequest *CMS_ReceiptRequest_create0(unsigned char *id, int idlen, + int allorfirst, + STACK_OF(GENERAL_NAMES) + *receiptList, STACK_OF(GENERAL_NAMES) + *receiptsTo); +int CMS_add1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest *rr); +void CMS_ReceiptRequest_get0_values(CMS_ReceiptRequest *rr, + ASN1_STRING **pcid, + int *pallorfirst, + STACK_OF(GENERAL_NAMES) **plist, + STACK_OF(GENERAL_NAMES) **prto); +int CMS_RecipientInfo_kari_get0_alg(CMS_RecipientInfo *ri, + X509_ALGOR **palg, + ASN1_OCTET_STRING **pukm); +STACK_OF(CMS_RecipientEncryptedKey) +*CMS_RecipientInfo_kari_get0_reks(CMS_RecipientInfo *ri); + +int CMS_RecipientInfo_kari_get0_orig_id(CMS_RecipientInfo *ri, + X509_ALGOR **pubalg, + ASN1_BIT_STRING **pubkey, + ASN1_OCTET_STRING **keyid, + X509_NAME **issuer, + ASN1_INTEGER **sno); + +int CMS_RecipientInfo_kari_orig_id_cmp(CMS_RecipientInfo *ri, X509 *cert); + +int CMS_RecipientEncryptedKey_get0_id(CMS_RecipientEncryptedKey *rek, + ASN1_OCTET_STRING **keyid, + ASN1_GENERALIZEDTIME **tm, + CMS_OtherKeyAttribute **other, + X509_NAME **issuer, ASN1_INTEGER **sno); +int CMS_RecipientEncryptedKey_cert_cmp(CMS_RecipientEncryptedKey *rek, + X509 *cert); +int CMS_RecipientInfo_kari_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pk); +EVP_CIPHER_CTX *CMS_RecipientInfo_kari_get0_ctx(CMS_RecipientInfo *ri); +int CMS_RecipientInfo_kari_decrypt(CMS_ContentInfo *cms, + CMS_RecipientInfo *ri, + CMS_RecipientEncryptedKey *rek); + +int CMS_SharedInfo_encode(unsigned char **pder, X509_ALGOR *kekalg, + ASN1_OCTET_STRING *ukm, int keylen); + +/* Backward compatibility for spelling errors. */ +# define CMS_R_UNKNOWN_DIGEST_ALGORITM CMS_R_UNKNOWN_DIGEST_ALGORITHM +# define CMS_R_UNSUPPORTED_RECPIENTINFO_TYPE \ + CMS_R_UNSUPPORTED_RECIPIENTINFO_TYPE + +# ifdef __cplusplus +} +# endif +# endif +#endif diff --git a/ONVIF/include/openssl/include/openssl/cmserr.h b/ONVIF/include/openssl/include/openssl/cmserr.h new file mode 100644 index 0000000..7dbc13d --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/cmserr.h @@ -0,0 +1,202 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_CMSERR_H +# define HEADER_CMSERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# include + +# ifndef OPENSSL_NO_CMS + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_CMS_strings(void); + +/* + * CMS function codes. + */ +# define CMS_F_CHECK_CONTENT 99 +# define CMS_F_CMS_ADD0_CERT 164 +# define CMS_F_CMS_ADD0_RECIPIENT_KEY 100 +# define CMS_F_CMS_ADD0_RECIPIENT_PASSWORD 165 +# define CMS_F_CMS_ADD1_RECEIPTREQUEST 158 +# define CMS_F_CMS_ADD1_RECIPIENT_CERT 101 +# define CMS_F_CMS_ADD1_SIGNER 102 +# define CMS_F_CMS_ADD1_SIGNINGTIME 103 +# define CMS_F_CMS_COMPRESS 104 +# define CMS_F_CMS_COMPRESSEDDATA_CREATE 105 +# define CMS_F_CMS_COMPRESSEDDATA_INIT_BIO 106 +# define CMS_F_CMS_COPY_CONTENT 107 +# define CMS_F_CMS_COPY_MESSAGEDIGEST 108 +# define CMS_F_CMS_DATA 109 +# define CMS_F_CMS_DATAFINAL 110 +# define CMS_F_CMS_DATAINIT 111 +# define CMS_F_CMS_DECRYPT 112 +# define CMS_F_CMS_DECRYPT_SET1_KEY 113 +# define CMS_F_CMS_DECRYPT_SET1_PASSWORD 166 +# define CMS_F_CMS_DECRYPT_SET1_PKEY 114 +# define CMS_F_CMS_DIGESTALGORITHM_FIND_CTX 115 +# define CMS_F_CMS_DIGESTALGORITHM_INIT_BIO 116 +# define CMS_F_CMS_DIGESTEDDATA_DO_FINAL 117 +# define CMS_F_CMS_DIGEST_VERIFY 118 +# define CMS_F_CMS_ENCODE_RECEIPT 161 +# define CMS_F_CMS_ENCRYPT 119 +# define CMS_F_CMS_ENCRYPTEDCONTENT_INIT 179 +# define CMS_F_CMS_ENCRYPTEDCONTENT_INIT_BIO 120 +# define CMS_F_CMS_ENCRYPTEDDATA_DECRYPT 121 +# define CMS_F_CMS_ENCRYPTEDDATA_ENCRYPT 122 +# define CMS_F_CMS_ENCRYPTEDDATA_SET1_KEY 123 +# define CMS_F_CMS_ENVELOPEDDATA_CREATE 124 +# define CMS_F_CMS_ENVELOPEDDATA_INIT_BIO 125 +# define CMS_F_CMS_ENVELOPED_DATA_INIT 126 +# define CMS_F_CMS_ENV_ASN1_CTRL 171 +# define CMS_F_CMS_FINAL 127 +# define CMS_F_CMS_GET0_CERTIFICATE_CHOICES 128 +# define CMS_F_CMS_GET0_CONTENT 129 +# define CMS_F_CMS_GET0_ECONTENT_TYPE 130 +# define CMS_F_CMS_GET0_ENVELOPED 131 +# define CMS_F_CMS_GET0_REVOCATION_CHOICES 132 +# define CMS_F_CMS_GET0_SIGNED 133 +# define CMS_F_CMS_MSGSIGDIGEST_ADD1 162 +# define CMS_F_CMS_RECEIPTREQUEST_CREATE0 159 +# define CMS_F_CMS_RECEIPT_VERIFY 160 +# define CMS_F_CMS_RECIPIENTINFO_DECRYPT 134 +# define CMS_F_CMS_RECIPIENTINFO_ENCRYPT 169 +# define CMS_F_CMS_RECIPIENTINFO_KARI_ENCRYPT 178 +# define CMS_F_CMS_RECIPIENTINFO_KARI_GET0_ALG 175 +# define CMS_F_CMS_RECIPIENTINFO_KARI_GET0_ORIG_ID 173 +# define CMS_F_CMS_RECIPIENTINFO_KARI_GET0_REKS 172 +# define CMS_F_CMS_RECIPIENTINFO_KARI_ORIG_ID_CMP 174 +# define CMS_F_CMS_RECIPIENTINFO_KEKRI_DECRYPT 135 +# define CMS_F_CMS_RECIPIENTINFO_KEKRI_ENCRYPT 136 +# define CMS_F_CMS_RECIPIENTINFO_KEKRI_GET0_ID 137 +# define CMS_F_CMS_RECIPIENTINFO_KEKRI_ID_CMP 138 +# define CMS_F_CMS_RECIPIENTINFO_KTRI_CERT_CMP 139 +# define CMS_F_CMS_RECIPIENTINFO_KTRI_DECRYPT 140 +# define CMS_F_CMS_RECIPIENTINFO_KTRI_ENCRYPT 141 +# define CMS_F_CMS_RECIPIENTINFO_KTRI_GET0_ALGS 142 +# define CMS_F_CMS_RECIPIENTINFO_KTRI_GET0_SIGNER_ID 143 +# define CMS_F_CMS_RECIPIENTINFO_PWRI_CRYPT 167 +# define CMS_F_CMS_RECIPIENTINFO_SET0_KEY 144 +# define CMS_F_CMS_RECIPIENTINFO_SET0_PASSWORD 168 +# define CMS_F_CMS_RECIPIENTINFO_SET0_PKEY 145 +# define CMS_F_CMS_SD_ASN1_CTRL 170 +# define CMS_F_CMS_SET1_IAS 176 +# define CMS_F_CMS_SET1_KEYID 177 +# define CMS_F_CMS_SET1_SIGNERIDENTIFIER 146 +# define CMS_F_CMS_SET_DETACHED 147 +# define CMS_F_CMS_SIGN 148 +# define CMS_F_CMS_SIGNED_DATA_INIT 149 +# define CMS_F_CMS_SIGNERINFO_CONTENT_SIGN 150 +# define CMS_F_CMS_SIGNERINFO_SIGN 151 +# define CMS_F_CMS_SIGNERINFO_VERIFY 152 +# define CMS_F_CMS_SIGNERINFO_VERIFY_CERT 153 +# define CMS_F_CMS_SIGNERINFO_VERIFY_CONTENT 154 +# define CMS_F_CMS_SIGN_RECEIPT 163 +# define CMS_F_CMS_SI_CHECK_ATTRIBUTES 183 +# define CMS_F_CMS_STREAM 155 +# define CMS_F_CMS_UNCOMPRESS 156 +# define CMS_F_CMS_VERIFY 157 +# define CMS_F_KEK_UNWRAP_KEY 180 + +/* + * CMS reason codes. + */ +# define CMS_R_ADD_SIGNER_ERROR 99 +# define CMS_R_ATTRIBUTE_ERROR 161 +# define CMS_R_CERTIFICATE_ALREADY_PRESENT 175 +# define CMS_R_CERTIFICATE_HAS_NO_KEYID 160 +# define CMS_R_CERTIFICATE_VERIFY_ERROR 100 +# define CMS_R_CIPHER_INITIALISATION_ERROR 101 +# define CMS_R_CIPHER_PARAMETER_INITIALISATION_ERROR 102 +# define CMS_R_CMS_DATAFINAL_ERROR 103 +# define CMS_R_CMS_LIB 104 +# define CMS_R_CONTENTIDENTIFIER_MISMATCH 170 +# define CMS_R_CONTENT_NOT_FOUND 105 +# define CMS_R_CONTENT_TYPE_MISMATCH 171 +# define CMS_R_CONTENT_TYPE_NOT_COMPRESSED_DATA 106 +# define CMS_R_CONTENT_TYPE_NOT_ENVELOPED_DATA 107 +# define CMS_R_CONTENT_TYPE_NOT_SIGNED_DATA 108 +# define CMS_R_CONTENT_VERIFY_ERROR 109 +# define CMS_R_CTRL_ERROR 110 +# define CMS_R_CTRL_FAILURE 111 +# define CMS_R_DECRYPT_ERROR 112 +# define CMS_R_ERROR_GETTING_PUBLIC_KEY 113 +# define CMS_R_ERROR_READING_MESSAGEDIGEST_ATTRIBUTE 114 +# define CMS_R_ERROR_SETTING_KEY 115 +# define CMS_R_ERROR_SETTING_RECIPIENTINFO 116 +# define CMS_R_INVALID_ENCRYPTED_KEY_LENGTH 117 +# define CMS_R_INVALID_KEY_ENCRYPTION_PARAMETER 176 +# define CMS_R_INVALID_KEY_LENGTH 118 +# define CMS_R_MD_BIO_INIT_ERROR 119 +# define CMS_R_MESSAGEDIGEST_ATTRIBUTE_WRONG_LENGTH 120 +# define CMS_R_MESSAGEDIGEST_WRONG_LENGTH 121 +# define CMS_R_MSGSIGDIGEST_ERROR 172 +# define CMS_R_MSGSIGDIGEST_VERIFICATION_FAILURE 162 +# define CMS_R_MSGSIGDIGEST_WRONG_LENGTH 163 +# define CMS_R_NEED_ONE_SIGNER 164 +# define CMS_R_NOT_A_SIGNED_RECEIPT 165 +# define CMS_R_NOT_ENCRYPTED_DATA 122 +# define CMS_R_NOT_KEK 123 +# define CMS_R_NOT_KEY_AGREEMENT 181 +# define CMS_R_NOT_KEY_TRANSPORT 124 +# define CMS_R_NOT_PWRI 177 +# define CMS_R_NOT_SUPPORTED_FOR_THIS_KEY_TYPE 125 +# define CMS_R_NO_CIPHER 126 +# define CMS_R_NO_CONTENT 127 +# define CMS_R_NO_CONTENT_TYPE 173 +# define CMS_R_NO_DEFAULT_DIGEST 128 +# define CMS_R_NO_DIGEST_SET 129 +# define CMS_R_NO_KEY 130 +# define CMS_R_NO_KEY_OR_CERT 174 +# define CMS_R_NO_MATCHING_DIGEST 131 +# define CMS_R_NO_MATCHING_RECIPIENT 132 +# define CMS_R_NO_MATCHING_SIGNATURE 166 +# define CMS_R_NO_MSGSIGDIGEST 167 +# define CMS_R_NO_PASSWORD 178 +# define CMS_R_NO_PRIVATE_KEY 133 +# define CMS_R_NO_PUBLIC_KEY 134 +# define CMS_R_NO_RECEIPT_REQUEST 168 +# define CMS_R_NO_SIGNERS 135 +# define CMS_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 136 +# define CMS_R_RECEIPT_DECODE_ERROR 169 +# define CMS_R_RECIPIENT_ERROR 137 +# define CMS_R_SIGNER_CERTIFICATE_NOT_FOUND 138 +# define CMS_R_SIGNFINAL_ERROR 139 +# define CMS_R_SMIME_TEXT_ERROR 140 +# define CMS_R_STORE_INIT_ERROR 141 +# define CMS_R_TYPE_NOT_COMPRESSED_DATA 142 +# define CMS_R_TYPE_NOT_DATA 143 +# define CMS_R_TYPE_NOT_DIGESTED_DATA 144 +# define CMS_R_TYPE_NOT_ENCRYPTED_DATA 145 +# define CMS_R_TYPE_NOT_ENVELOPED_DATA 146 +# define CMS_R_UNABLE_TO_FINALIZE_CONTEXT 147 +# define CMS_R_UNKNOWN_CIPHER 148 +# define CMS_R_UNKNOWN_DIGEST_ALGORITHM 149 +# define CMS_R_UNKNOWN_ID 150 +# define CMS_R_UNSUPPORTED_COMPRESSION_ALGORITHM 151 +# define CMS_R_UNSUPPORTED_CONTENT_TYPE 152 +# define CMS_R_UNSUPPORTED_KEK_ALGORITHM 153 +# define CMS_R_UNSUPPORTED_KEY_ENCRYPTION_ALGORITHM 179 +# define CMS_R_UNSUPPORTED_RECIPIENTINFO_TYPE 155 +# define CMS_R_UNSUPPORTED_RECIPIENT_TYPE 154 +# define CMS_R_UNSUPPORTED_TYPE 156 +# define CMS_R_UNWRAP_ERROR 157 +# define CMS_R_UNWRAP_FAILURE 180 +# define CMS_R_VERIFICATION_FAILURE 158 +# define CMS_R_WRAP_ERROR 159 + +# endif +#endif diff --git a/ONVIF/include/openssl/include/openssl/comp.h b/ONVIF/include/openssl/include/openssl/comp.h new file mode 100644 index 0000000..d814d3c --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/comp.h @@ -0,0 +1,53 @@ +/* + * Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_COMP_H +# define HEADER_COMP_H + +# include + +# ifndef OPENSSL_NO_COMP +# include +# include +# ifdef __cplusplus +extern "C" { +# endif + + + +COMP_CTX *COMP_CTX_new(COMP_METHOD *meth); +const COMP_METHOD *COMP_CTX_get_method(const COMP_CTX *ctx); +int COMP_CTX_get_type(const COMP_CTX* comp); +int COMP_get_type(const COMP_METHOD *meth); +const char *COMP_get_name(const COMP_METHOD *meth); +void COMP_CTX_free(COMP_CTX *ctx); + +int COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen, + unsigned char *in, int ilen); +int COMP_expand_block(COMP_CTX *ctx, unsigned char *out, int olen, + unsigned char *in, int ilen); + +COMP_METHOD *COMP_zlib(void); + +#if OPENSSL_API_COMPAT < 0x10100000L +#define COMP_zlib_cleanup() while(0) continue +#endif + +# ifdef HEADER_BIO_H +# ifdef ZLIB +const BIO_METHOD *BIO_f_zlib(void); +# endif +# endif + + +# ifdef __cplusplus +} +# endif +# endif +#endif diff --git a/ONVIF/include/openssl/include/openssl/comperr.h b/ONVIF/include/openssl/include/openssl/comperr.h new file mode 100644 index 0000000..90231e9 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/comperr.h @@ -0,0 +1,44 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_COMPERR_H +# define HEADER_COMPERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# include + +# ifndef OPENSSL_NO_COMP + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_COMP_strings(void); + +/* + * COMP function codes. + */ +# define COMP_F_BIO_ZLIB_FLUSH 99 +# define COMP_F_BIO_ZLIB_NEW 100 +# define COMP_F_BIO_ZLIB_READ 101 +# define COMP_F_BIO_ZLIB_WRITE 102 +# define COMP_F_COMP_CTX_NEW 103 + +/* + * COMP reason codes. + */ +# define COMP_R_ZLIB_DEFLATE_ERROR 99 +# define COMP_R_ZLIB_INFLATE_ERROR 100 +# define COMP_R_ZLIB_NOT_SUPPORTED 101 + +# endif +#endif diff --git a/ONVIF/include/openssl/include/openssl/conf.h b/ONVIF/include/openssl/include/openssl/conf.h new file mode 100644 index 0000000..7336cd2 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/conf.h @@ -0,0 +1,168 @@ +/* + * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_CONF_H +# define HEADER_CONF_H + +# include +# include +# include +# include +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { + char *section; + char *name; + char *value; +} CONF_VALUE; + +DEFINE_STACK_OF(CONF_VALUE) +DEFINE_LHASH_OF(CONF_VALUE); + +struct conf_st; +struct conf_method_st; +typedef struct conf_method_st CONF_METHOD; + +struct conf_method_st { + const char *name; + CONF *(*create) (CONF_METHOD *meth); + int (*init) (CONF *conf); + int (*destroy) (CONF *conf); + int (*destroy_data) (CONF *conf); + int (*load_bio) (CONF *conf, BIO *bp, long *eline); + int (*dump) (const CONF *conf, BIO *bp); + int (*is_number) (const CONF *conf, char c); + int (*to_int) (const CONF *conf, char c); + int (*load) (CONF *conf, const char *name, long *eline); +}; + +/* Module definitions */ + +typedef struct conf_imodule_st CONF_IMODULE; +typedef struct conf_module_st CONF_MODULE; + +DEFINE_STACK_OF(CONF_MODULE) +DEFINE_STACK_OF(CONF_IMODULE) + +/* DSO module function typedefs */ +typedef int conf_init_func (CONF_IMODULE *md, const CONF *cnf); +typedef void conf_finish_func (CONF_IMODULE *md); + +# define CONF_MFLAGS_IGNORE_ERRORS 0x1 +# define CONF_MFLAGS_IGNORE_RETURN_CODES 0x2 +# define CONF_MFLAGS_SILENT 0x4 +# define CONF_MFLAGS_NO_DSO 0x8 +# define CONF_MFLAGS_IGNORE_MISSING_FILE 0x10 +# define CONF_MFLAGS_DEFAULT_SECTION 0x20 + +int CONF_set_default_method(CONF_METHOD *meth); +void CONF_set_nconf(CONF *conf, LHASH_OF(CONF_VALUE) *hash); +LHASH_OF(CONF_VALUE) *CONF_load(LHASH_OF(CONF_VALUE) *conf, const char *file, + long *eline); +# ifndef OPENSSL_NO_STDIO +LHASH_OF(CONF_VALUE) *CONF_load_fp(LHASH_OF(CONF_VALUE) *conf, FILE *fp, + long *eline); +# endif +LHASH_OF(CONF_VALUE) *CONF_load_bio(LHASH_OF(CONF_VALUE) *conf, BIO *bp, + long *eline); +STACK_OF(CONF_VALUE) *CONF_get_section(LHASH_OF(CONF_VALUE) *conf, + const char *section); +char *CONF_get_string(LHASH_OF(CONF_VALUE) *conf, const char *group, + const char *name); +long CONF_get_number(LHASH_OF(CONF_VALUE) *conf, const char *group, + const char *name); +void CONF_free(LHASH_OF(CONF_VALUE) *conf); +#ifndef OPENSSL_NO_STDIO +int CONF_dump_fp(LHASH_OF(CONF_VALUE) *conf, FILE *out); +#endif +int CONF_dump_bio(LHASH_OF(CONF_VALUE) *conf, BIO *out); + +DEPRECATEDIN_1_1_0(void OPENSSL_config(const char *config_name)) + +#if OPENSSL_API_COMPAT < 0x10100000L +# define OPENSSL_no_config() \ + OPENSSL_init_crypto(OPENSSL_INIT_NO_LOAD_CONFIG, NULL) +#endif + +/* + * New conf code. The semantics are different from the functions above. If + * that wasn't the case, the above functions would have been replaced + */ + +struct conf_st { + CONF_METHOD *meth; + void *meth_data; + LHASH_OF(CONF_VALUE) *data; +}; + +CONF *NCONF_new(CONF_METHOD *meth); +CONF_METHOD *NCONF_default(void); +CONF_METHOD *NCONF_WIN32(void); +void NCONF_free(CONF *conf); +void NCONF_free_data(CONF *conf); + +int NCONF_load(CONF *conf, const char *file, long *eline); +# ifndef OPENSSL_NO_STDIO +int NCONF_load_fp(CONF *conf, FILE *fp, long *eline); +# endif +int NCONF_load_bio(CONF *conf, BIO *bp, long *eline); +STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf, + const char *section); +char *NCONF_get_string(const CONF *conf, const char *group, const char *name); +int NCONF_get_number_e(const CONF *conf, const char *group, const char *name, + long *result); +#ifndef OPENSSL_NO_STDIO +int NCONF_dump_fp(const CONF *conf, FILE *out); +#endif +int NCONF_dump_bio(const CONF *conf, BIO *out); + +#define NCONF_get_number(c,g,n,r) NCONF_get_number_e(c,g,n,r) + +/* Module functions */ + +int CONF_modules_load(const CONF *cnf, const char *appname, + unsigned long flags); +int CONF_modules_load_file(const char *filename, const char *appname, + unsigned long flags); +void CONF_modules_unload(int all); +void CONF_modules_finish(void); +#if OPENSSL_API_COMPAT < 0x10100000L +# define CONF_modules_free() while(0) continue +#endif +int CONF_module_add(const char *name, conf_init_func *ifunc, + conf_finish_func *ffunc); + +const char *CONF_imodule_get_name(const CONF_IMODULE *md); +const char *CONF_imodule_get_value(const CONF_IMODULE *md); +void *CONF_imodule_get_usr_data(const CONF_IMODULE *md); +void CONF_imodule_set_usr_data(CONF_IMODULE *md, void *usr_data); +CONF_MODULE *CONF_imodule_get_module(const CONF_IMODULE *md); +unsigned long CONF_imodule_get_flags(const CONF_IMODULE *md); +void CONF_imodule_set_flags(CONF_IMODULE *md, unsigned long flags); +void *CONF_module_get_usr_data(CONF_MODULE *pmod); +void CONF_module_set_usr_data(CONF_MODULE *pmod, void *usr_data); + +char *CONF_get1_default_config_file(void); + +int CONF_parse_list(const char *list, int sep, int nospc, + int (*list_cb) (const char *elem, int len, void *usr), + void *arg); + +void OPENSSL_load_builtin_modules(void); + + +# ifdef __cplusplus +} +# endif +#endif diff --git a/ONVIF/include/openssl/include/openssl/conf_api.h b/ONVIF/include/openssl/include/openssl/conf_api.h new file mode 100644 index 0000000..a0275ad --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/conf_api.h @@ -0,0 +1,40 @@ +/* + * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_CONF_API_H +# define HEADER_CONF_API_H + +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Up until OpenSSL 0.9.5a, this was new_section */ +CONF_VALUE *_CONF_new_section(CONF *conf, const char *section); +/* Up until OpenSSL 0.9.5a, this was get_section */ +CONF_VALUE *_CONF_get_section(const CONF *conf, const char *section); +/* Up until OpenSSL 0.9.5a, this was CONF_get_section */ +STACK_OF(CONF_VALUE) *_CONF_get_section_values(const CONF *conf, + const char *section); + +int _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value); +char *_CONF_get_string(const CONF *conf, const char *section, + const char *name); +long _CONF_get_number(const CONF *conf, const char *section, + const char *name); + +int _CONF_new_data(CONF *conf); +void _CONF_free_data(CONF *conf); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/ONVIF/include/openssl/include/openssl/conferr.h b/ONVIF/include/openssl/include/openssl/conferr.h new file mode 100644 index 0000000..32b9229 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/conferr.h @@ -0,0 +1,76 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_CONFERR_H +# define HEADER_CONFERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_CONF_strings(void); + +/* + * CONF function codes. + */ +# define CONF_F_CONF_DUMP_FP 104 +# define CONF_F_CONF_LOAD 100 +# define CONF_F_CONF_LOAD_FP 103 +# define CONF_F_CONF_PARSE_LIST 119 +# define CONF_F_DEF_LOAD 120 +# define CONF_F_DEF_LOAD_BIO 121 +# define CONF_F_GET_NEXT_FILE 107 +# define CONF_F_MODULE_ADD 122 +# define CONF_F_MODULE_INIT 115 +# define CONF_F_MODULE_LOAD_DSO 117 +# define CONF_F_MODULE_RUN 118 +# define CONF_F_NCONF_DUMP_BIO 105 +# define CONF_F_NCONF_DUMP_FP 106 +# define CONF_F_NCONF_GET_NUMBER_E 112 +# define CONF_F_NCONF_GET_SECTION 108 +# define CONF_F_NCONF_GET_STRING 109 +# define CONF_F_NCONF_LOAD 113 +# define CONF_F_NCONF_LOAD_BIO 110 +# define CONF_F_NCONF_LOAD_FP 114 +# define CONF_F_NCONF_NEW 111 +# define CONF_F_PROCESS_INCLUDE 116 +# define CONF_F_SSL_MODULE_INIT 123 +# define CONF_F_STR_COPY 101 + +/* + * CONF reason codes. + */ +# define CONF_R_ERROR_LOADING_DSO 110 +# define CONF_R_LIST_CANNOT_BE_NULL 115 +# define CONF_R_MISSING_CLOSE_SQUARE_BRACKET 100 +# define CONF_R_MISSING_EQUAL_SIGN 101 +# define CONF_R_MISSING_INIT_FUNCTION 112 +# define CONF_R_MODULE_INITIALIZATION_ERROR 109 +# define CONF_R_NO_CLOSE_BRACE 102 +# define CONF_R_NO_CONF 105 +# define CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE 106 +# define CONF_R_NO_SECTION 107 +# define CONF_R_NO_SUCH_FILE 114 +# define CONF_R_NO_VALUE 108 +# define CONF_R_NUMBER_TOO_LARGE 121 +# define CONF_R_RECURSIVE_DIRECTORY_INCLUDE 111 +# define CONF_R_SSL_COMMAND_SECTION_EMPTY 117 +# define CONF_R_SSL_COMMAND_SECTION_NOT_FOUND 118 +# define CONF_R_SSL_SECTION_EMPTY 119 +# define CONF_R_SSL_SECTION_NOT_FOUND 120 +# define CONF_R_UNABLE_TO_CREATE_NEW_SECTION 103 +# define CONF_R_UNKNOWN_MODULE_NAME 113 +# define CONF_R_VARIABLE_EXPANSION_TOO_LONG 116 +# define CONF_R_VARIABLE_HAS_NO_VALUE 104 + +#endif diff --git a/ONVIF/include/openssl/include/openssl/crypto.h b/ONVIF/include/openssl/include/openssl/crypto.h new file mode 100644 index 0000000..7d0b526 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/crypto.h @@ -0,0 +1,445 @@ +/* + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_CRYPTO_H +# define HEADER_CRYPTO_H + +# include +# include + +# include + +# ifndef OPENSSL_NO_STDIO +# include +# endif + +# include +# include +# include +# include +# include + +# ifdef CHARSET_EBCDIC +# include +# endif + +/* + * Resolve problems on some operating systems with symbol names that clash + * one way or another + */ +# include + +# if OPENSSL_API_COMPAT < 0x10100000L +# include +# endif + +#ifdef __cplusplus +extern "C" { +#endif + +# if OPENSSL_API_COMPAT < 0x10100000L +# define SSLeay OpenSSL_version_num +# define SSLeay_version OpenSSL_version +# define SSLEAY_VERSION_NUMBER OPENSSL_VERSION_NUMBER +# define SSLEAY_VERSION OPENSSL_VERSION +# define SSLEAY_CFLAGS OPENSSL_CFLAGS +# define SSLEAY_BUILT_ON OPENSSL_BUILT_ON +# define SSLEAY_PLATFORM OPENSSL_PLATFORM +# define SSLEAY_DIR OPENSSL_DIR + +/* + * Old type for allocating dynamic locks. No longer used. Use the new thread + * API instead. + */ +typedef struct { + int dummy; +} CRYPTO_dynlock; + +# endif /* OPENSSL_API_COMPAT */ + +typedef void CRYPTO_RWLOCK; + +CRYPTO_RWLOCK *CRYPTO_THREAD_lock_new(void); +int CRYPTO_THREAD_read_lock(CRYPTO_RWLOCK *lock); +int CRYPTO_THREAD_write_lock(CRYPTO_RWLOCK *lock); +int CRYPTO_THREAD_unlock(CRYPTO_RWLOCK *lock); +void CRYPTO_THREAD_lock_free(CRYPTO_RWLOCK *lock); + +int CRYPTO_atomic_add(int *val, int amount, int *ret, CRYPTO_RWLOCK *lock); + +/* + * The following can be used to detect memory leaks in the library. If + * used, it turns on malloc checking + */ +# define CRYPTO_MEM_CHECK_OFF 0x0 /* Control only */ +# define CRYPTO_MEM_CHECK_ON 0x1 /* Control and mode bit */ +# define CRYPTO_MEM_CHECK_ENABLE 0x2 /* Control and mode bit */ +# define CRYPTO_MEM_CHECK_DISABLE 0x3 /* Control only */ + +struct crypto_ex_data_st { + STACK_OF(void) *sk; +}; +DEFINE_STACK_OF(void) + +/* + * Per class, we have a STACK of function pointers. + */ +# define CRYPTO_EX_INDEX_SSL 0 +# define CRYPTO_EX_INDEX_SSL_CTX 1 +# define CRYPTO_EX_INDEX_SSL_SESSION 2 +# define CRYPTO_EX_INDEX_X509 3 +# define CRYPTO_EX_INDEX_X509_STORE 4 +# define CRYPTO_EX_INDEX_X509_STORE_CTX 5 +# define CRYPTO_EX_INDEX_DH 6 +# define CRYPTO_EX_INDEX_DSA 7 +# define CRYPTO_EX_INDEX_EC_KEY 8 +# define CRYPTO_EX_INDEX_RSA 9 +# define CRYPTO_EX_INDEX_ENGINE 10 +# define CRYPTO_EX_INDEX_UI 11 +# define CRYPTO_EX_INDEX_BIO 12 +# define CRYPTO_EX_INDEX_APP 13 +# define CRYPTO_EX_INDEX_UI_METHOD 14 +# define CRYPTO_EX_INDEX_DRBG 15 +# define CRYPTO_EX_INDEX__COUNT 16 + +/* No longer needed, so this is a no-op */ +#define OPENSSL_malloc_init() while(0) continue + +int CRYPTO_mem_ctrl(int mode); + +# define OPENSSL_malloc(num) \ + CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE) +# define OPENSSL_zalloc(num) \ + CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE) +# define OPENSSL_realloc(addr, num) \ + CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE) +# define OPENSSL_clear_realloc(addr, old_num, num) \ + CRYPTO_clear_realloc(addr, old_num, num, OPENSSL_FILE, OPENSSL_LINE) +# define OPENSSL_clear_free(addr, num) \ + CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE) +# define OPENSSL_free(addr) \ + CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE) +# define OPENSSL_memdup(str, s) \ + CRYPTO_memdup((str), s, OPENSSL_FILE, OPENSSL_LINE) +# define OPENSSL_strdup(str) \ + CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE) +# define OPENSSL_strndup(str, n) \ + CRYPTO_strndup(str, n, OPENSSL_FILE, OPENSSL_LINE) +# define OPENSSL_secure_malloc(num) \ + CRYPTO_secure_malloc(num, OPENSSL_FILE, OPENSSL_LINE) +# define OPENSSL_secure_zalloc(num) \ + CRYPTO_secure_zalloc(num, OPENSSL_FILE, OPENSSL_LINE) +# define OPENSSL_secure_free(addr) \ + CRYPTO_secure_free(addr, OPENSSL_FILE, OPENSSL_LINE) +# define OPENSSL_secure_clear_free(addr, num) \ + CRYPTO_secure_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE) +# define OPENSSL_secure_actual_size(ptr) \ + CRYPTO_secure_actual_size(ptr) + +size_t OPENSSL_strlcpy(char *dst, const char *src, size_t siz); +size_t OPENSSL_strlcat(char *dst, const char *src, size_t siz); +size_t OPENSSL_strnlen(const char *str, size_t maxlen); +char *OPENSSL_buf2hexstr(const unsigned char *buffer, long len); +unsigned char *OPENSSL_hexstr2buf(const char *str, long *len); +int OPENSSL_hexchar2int(unsigned char c); + +# define OPENSSL_MALLOC_MAX_NELEMS(type) (((1U<<(sizeof(int)*8-1))-1)/sizeof(type)) + +unsigned long OpenSSL_version_num(void); +const char *OpenSSL_version(int type); +# define OPENSSL_VERSION 0 +# define OPENSSL_CFLAGS 1 +# define OPENSSL_BUILT_ON 2 +# define OPENSSL_PLATFORM 3 +# define OPENSSL_DIR 4 +# define OPENSSL_ENGINES_DIR 5 + +int OPENSSL_issetugid(void); + +typedef void CRYPTO_EX_new (void *parent, void *ptr, CRYPTO_EX_DATA *ad, + int idx, long argl, void *argp); +typedef void CRYPTO_EX_free (void *parent, void *ptr, CRYPTO_EX_DATA *ad, + int idx, long argl, void *argp); +typedef int CRYPTO_EX_dup (CRYPTO_EX_DATA *to, const CRYPTO_EX_DATA *from, + void *from_d, int idx, long argl, void *argp); +__owur int CRYPTO_get_ex_new_index(int class_index, long argl, void *argp, + CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, + CRYPTO_EX_free *free_func); +/* No longer use an index. */ +int CRYPTO_free_ex_index(int class_index, int idx); + +/* + * Initialise/duplicate/free CRYPTO_EX_DATA variables corresponding to a + * given class (invokes whatever per-class callbacks are applicable) + */ +int CRYPTO_new_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad); +int CRYPTO_dup_ex_data(int class_index, CRYPTO_EX_DATA *to, + const CRYPTO_EX_DATA *from); + +void CRYPTO_free_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad); + +/* + * Get/set data in a CRYPTO_EX_DATA variable corresponding to a particular + * index (relative to the class type involved) + */ +int CRYPTO_set_ex_data(CRYPTO_EX_DATA *ad, int idx, void *val); +void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx); + +# if OPENSSL_API_COMPAT < 0x10100000L +/* + * This function cleans up all "ex_data" state. It mustn't be called under + * potential race-conditions. + */ +# define CRYPTO_cleanup_all_ex_data() while(0) continue + +/* + * The old locking functions have been removed completely without compatibility + * macros. This is because the old functions either could not properly report + * errors, or the returned error values were not clearly documented. + * Replacing the locking functions with no-ops would cause race condition + * issues in the affected applications. It is far better for them to fail at + * compile time. + * On the other hand, the locking callbacks are no longer used. Consequently, + * the callback management functions can be safely replaced with no-op macros. + */ +# define CRYPTO_num_locks() (1) +# define CRYPTO_set_locking_callback(func) +# define CRYPTO_get_locking_callback() (NULL) +# define CRYPTO_set_add_lock_callback(func) +# define CRYPTO_get_add_lock_callback() (NULL) + +/* + * These defines where used in combination with the old locking callbacks, + * they are not called anymore, but old code that's not called might still + * use them. + */ +# define CRYPTO_LOCK 1 +# define CRYPTO_UNLOCK 2 +# define CRYPTO_READ 4 +# define CRYPTO_WRITE 8 + +/* This structure is no longer used */ +typedef struct crypto_threadid_st { + int dummy; +} CRYPTO_THREADID; +/* Only use CRYPTO_THREADID_set_[numeric|pointer]() within callbacks */ +# define CRYPTO_THREADID_set_numeric(id, val) +# define CRYPTO_THREADID_set_pointer(id, ptr) +# define CRYPTO_THREADID_set_callback(threadid_func) (0) +# define CRYPTO_THREADID_get_callback() (NULL) +# define CRYPTO_THREADID_current(id) +# define CRYPTO_THREADID_cmp(a, b) (-1) +# define CRYPTO_THREADID_cpy(dest, src) +# define CRYPTO_THREADID_hash(id) (0UL) + +# if OPENSSL_API_COMPAT < 0x10000000L +# define CRYPTO_set_id_callback(func) +# define CRYPTO_get_id_callback() (NULL) +# define CRYPTO_thread_id() (0UL) +# endif /* OPENSSL_API_COMPAT < 0x10000000L */ + +# define CRYPTO_set_dynlock_create_callback(dyn_create_function) +# define CRYPTO_set_dynlock_lock_callback(dyn_lock_function) +# define CRYPTO_set_dynlock_destroy_callback(dyn_destroy_function) +# define CRYPTO_get_dynlock_create_callback() (NULL) +# define CRYPTO_get_dynlock_lock_callback() (NULL) +# define CRYPTO_get_dynlock_destroy_callback() (NULL) +# endif /* OPENSSL_API_COMPAT < 0x10100000L */ + +int CRYPTO_set_mem_functions( + void *(*m) (size_t, const char *, int), + void *(*r) (void *, size_t, const char *, int), + void (*f) (void *, const char *, int)); +int CRYPTO_set_mem_debug(int flag); +void CRYPTO_get_mem_functions( + void *(**m) (size_t, const char *, int), + void *(**r) (void *, size_t, const char *, int), + void (**f) (void *, const char *, int)); + +void *CRYPTO_malloc(size_t num, const char *file, int line); +void *CRYPTO_zalloc(size_t num, const char *file, int line); +void *CRYPTO_memdup(const void *str, size_t siz, const char *file, int line); +char *CRYPTO_strdup(const char *str, const char *file, int line); +char *CRYPTO_strndup(const char *str, size_t s, const char *file, int line); +void CRYPTO_free(void *ptr, const char *file, int line); +void CRYPTO_clear_free(void *ptr, size_t num, const char *file, int line); +void *CRYPTO_realloc(void *addr, size_t num, const char *file, int line); +void *CRYPTO_clear_realloc(void *addr, size_t old_num, size_t num, + const char *file, int line); + +int CRYPTO_secure_malloc_init(size_t sz, int minsize); +int CRYPTO_secure_malloc_done(void); +void *CRYPTO_secure_malloc(size_t num, const char *file, int line); +void *CRYPTO_secure_zalloc(size_t num, const char *file, int line); +void CRYPTO_secure_free(void *ptr, const char *file, int line); +void CRYPTO_secure_clear_free(void *ptr, size_t num, + const char *file, int line); +int CRYPTO_secure_allocated(const void *ptr); +int CRYPTO_secure_malloc_initialized(void); +size_t CRYPTO_secure_actual_size(void *ptr); +size_t CRYPTO_secure_used(void); + +void OPENSSL_cleanse(void *ptr, size_t len); + +# ifndef OPENSSL_NO_CRYPTO_MDEBUG +# define OPENSSL_mem_debug_push(info) \ + CRYPTO_mem_debug_push(info, OPENSSL_FILE, OPENSSL_LINE) +# define OPENSSL_mem_debug_pop() \ + CRYPTO_mem_debug_pop() +int CRYPTO_mem_debug_push(const char *info, const char *file, int line); +int CRYPTO_mem_debug_pop(void); +void CRYPTO_get_alloc_counts(int *mcount, int *rcount, int *fcount); + +/*- + * Debugging functions (enabled by CRYPTO_set_mem_debug(1)) + * The flag argument has the following significance: + * 0: called before the actual memory allocation has taken place + * 1: called after the actual memory allocation has taken place + */ +void CRYPTO_mem_debug_malloc(void *addr, size_t num, int flag, + const char *file, int line); +void CRYPTO_mem_debug_realloc(void *addr1, void *addr2, size_t num, int flag, + const char *file, int line); +void CRYPTO_mem_debug_free(void *addr, int flag, + const char *file, int line); + +int CRYPTO_mem_leaks_cb(int (*cb) (const char *str, size_t len, void *u), + void *u); +# ifndef OPENSSL_NO_STDIO +int CRYPTO_mem_leaks_fp(FILE *); +# endif +int CRYPTO_mem_leaks(BIO *bio); +# endif + +/* die if we have to */ +ossl_noreturn void OPENSSL_die(const char *assertion, const char *file, int line); +# if OPENSSL_API_COMPAT < 0x10100000L +# define OpenSSLDie(f,l,a) OPENSSL_die((a),(f),(l)) +# endif +# define OPENSSL_assert(e) \ + (void)((e) ? 0 : (OPENSSL_die("assertion failed: " #e, OPENSSL_FILE, OPENSSL_LINE), 1)) + +int OPENSSL_isservice(void); + +int FIPS_mode(void); +int FIPS_mode_set(int r); + +void OPENSSL_init(void); +# ifdef OPENSSL_SYS_UNIX +void OPENSSL_fork_prepare(void); +void OPENSSL_fork_parent(void); +void OPENSSL_fork_child(void); +# endif + +struct tm *OPENSSL_gmtime(const time_t *timer, struct tm *result); +int OPENSSL_gmtime_adj(struct tm *tm, int offset_day, long offset_sec); +int OPENSSL_gmtime_diff(int *pday, int *psec, + const struct tm *from, const struct tm *to); + +/* + * CRYPTO_memcmp returns zero iff the |len| bytes at |a| and |b| are equal. + * It takes an amount of time dependent on |len|, but independent of the + * contents of |a| and |b|. Unlike memcmp, it cannot be used to put elements + * into a defined order as the return value when a != b is undefined, other + * than to be non-zero. + */ +int CRYPTO_memcmp(const void * in_a, const void * in_b, size_t len); + +/* Standard initialisation options */ +# define OPENSSL_INIT_NO_LOAD_CRYPTO_STRINGS 0x00000001L +# define OPENSSL_INIT_LOAD_CRYPTO_STRINGS 0x00000002L +# define OPENSSL_INIT_ADD_ALL_CIPHERS 0x00000004L +# define OPENSSL_INIT_ADD_ALL_DIGESTS 0x00000008L +# define OPENSSL_INIT_NO_ADD_ALL_CIPHERS 0x00000010L +# define OPENSSL_INIT_NO_ADD_ALL_DIGESTS 0x00000020L +# define OPENSSL_INIT_LOAD_CONFIG 0x00000040L +# define OPENSSL_INIT_NO_LOAD_CONFIG 0x00000080L +# define OPENSSL_INIT_ASYNC 0x00000100L +# define OPENSSL_INIT_ENGINE_RDRAND 0x00000200L +# define OPENSSL_INIT_ENGINE_DYNAMIC 0x00000400L +# define OPENSSL_INIT_ENGINE_OPENSSL 0x00000800L +# define OPENSSL_INIT_ENGINE_CRYPTODEV 0x00001000L +# define OPENSSL_INIT_ENGINE_CAPI 0x00002000L +# define OPENSSL_INIT_ENGINE_PADLOCK 0x00004000L +# define OPENSSL_INIT_ENGINE_AFALG 0x00008000L +/* OPENSSL_INIT_ZLIB 0x00010000L */ +# define OPENSSL_INIT_ATFORK 0x00020000L +/* OPENSSL_INIT_BASE_ONLY 0x00040000L */ +# define OPENSSL_INIT_NO_ATEXIT 0x00080000L +/* OPENSSL_INIT flag range 0xfff00000 reserved for OPENSSL_init_ssl() */ +/* Max OPENSSL_INIT flag value is 0x80000000 */ + +/* openssl and dasync not counted as builtin */ +# define OPENSSL_INIT_ENGINE_ALL_BUILTIN \ + (OPENSSL_INIT_ENGINE_RDRAND | OPENSSL_INIT_ENGINE_DYNAMIC \ + | OPENSSL_INIT_ENGINE_CRYPTODEV | OPENSSL_INIT_ENGINE_CAPI | \ + OPENSSL_INIT_ENGINE_PADLOCK) + + +/* Library initialisation functions */ +void OPENSSL_cleanup(void); +int OPENSSL_init_crypto(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings); +int OPENSSL_atexit(void (*handler)(void)); +void OPENSSL_thread_stop(void); + +/* Low-level control of initialization */ +OPENSSL_INIT_SETTINGS *OPENSSL_INIT_new(void); +# ifndef OPENSSL_NO_STDIO +int OPENSSL_INIT_set_config_filename(OPENSSL_INIT_SETTINGS *settings, + const char *config_filename); +void OPENSSL_INIT_set_config_file_flags(OPENSSL_INIT_SETTINGS *settings, + unsigned long flags); +int OPENSSL_INIT_set_config_appname(OPENSSL_INIT_SETTINGS *settings, + const char *config_appname); +# endif +void OPENSSL_INIT_free(OPENSSL_INIT_SETTINGS *settings); + +# if defined(OPENSSL_THREADS) && !defined(CRYPTO_TDEBUG) +# if defined(_WIN32) +# if defined(BASETYPES) || defined(_WINDEF_H) +/* application has to include in order to use this */ +typedef DWORD CRYPTO_THREAD_LOCAL; +typedef DWORD CRYPTO_THREAD_ID; + +typedef LONG CRYPTO_ONCE; +# define CRYPTO_ONCE_STATIC_INIT 0 +# endif +# else +# include +typedef pthread_once_t CRYPTO_ONCE; +typedef pthread_key_t CRYPTO_THREAD_LOCAL; +typedef pthread_t CRYPTO_THREAD_ID; + +# define CRYPTO_ONCE_STATIC_INIT PTHREAD_ONCE_INIT +# endif +# endif + +# if !defined(CRYPTO_ONCE_STATIC_INIT) +typedef unsigned int CRYPTO_ONCE; +typedef unsigned int CRYPTO_THREAD_LOCAL; +typedef unsigned int CRYPTO_THREAD_ID; +# define CRYPTO_ONCE_STATIC_INIT 0 +# endif + +int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void)); + +int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void (*cleanup)(void *)); +void *CRYPTO_THREAD_get_local(CRYPTO_THREAD_LOCAL *key); +int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val); +int CRYPTO_THREAD_cleanup_local(CRYPTO_THREAD_LOCAL *key); + +CRYPTO_THREAD_ID CRYPTO_THREAD_get_current_id(void); +int CRYPTO_THREAD_compare_id(CRYPTO_THREAD_ID a, CRYPTO_THREAD_ID b); + + +# ifdef __cplusplus +} +# endif +#endif diff --git a/ONVIF/include/openssl/include/openssl/cryptoerr.h b/ONVIF/include/openssl/include/openssl/cryptoerr.h new file mode 100644 index 0000000..3db5a4e --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/cryptoerr.h @@ -0,0 +1,57 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_CRYPTOERR_H +# define HEADER_CRYPTOERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_CRYPTO_strings(void); + +/* + * CRYPTO function codes. + */ +# define CRYPTO_F_CMAC_CTX_NEW 120 +# define CRYPTO_F_CRYPTO_DUP_EX_DATA 110 +# define CRYPTO_F_CRYPTO_FREE_EX_DATA 111 +# define CRYPTO_F_CRYPTO_GET_EX_NEW_INDEX 100 +# define CRYPTO_F_CRYPTO_MEMDUP 115 +# define CRYPTO_F_CRYPTO_NEW_EX_DATA 112 +# define CRYPTO_F_CRYPTO_OCB128_COPY_CTX 121 +# define CRYPTO_F_CRYPTO_OCB128_INIT 122 +# define CRYPTO_F_CRYPTO_SET_EX_DATA 102 +# define CRYPTO_F_FIPS_MODE_SET 109 +# define CRYPTO_F_GET_AND_LOCK 113 +# define CRYPTO_F_OPENSSL_ATEXIT 114 +# define CRYPTO_F_OPENSSL_BUF2HEXSTR 117 +# define CRYPTO_F_OPENSSL_FOPEN 119 +# define CRYPTO_F_OPENSSL_HEXSTR2BUF 118 +# define CRYPTO_F_OPENSSL_INIT_CRYPTO 116 +# define CRYPTO_F_OPENSSL_LH_NEW 126 +# define CRYPTO_F_OPENSSL_SK_DEEP_COPY 127 +# define CRYPTO_F_OPENSSL_SK_DUP 128 +# define CRYPTO_F_PKEY_HMAC_INIT 123 +# define CRYPTO_F_PKEY_POLY1305_INIT 124 +# define CRYPTO_F_PKEY_SIPHASH_INIT 125 +# define CRYPTO_F_SK_RESERVE 129 + +/* + * CRYPTO reason codes. + */ +# define CRYPTO_R_FIPS_MODE_NOT_SUPPORTED 101 +# define CRYPTO_R_ILLEGAL_HEX_DIGIT 102 +# define CRYPTO_R_ODD_NUMBER_OF_DIGITS 103 + +#endif diff --git a/ONVIF/include/openssl/include/openssl/ct.h b/ONVIF/include/openssl/include/openssl/ct.h new file mode 100644 index 0000000..ebdba34 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/ct.h @@ -0,0 +1,474 @@ +/* + * Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_CT_H +# define HEADER_CT_H + +# include + +# ifndef OPENSSL_NO_CT +# include +# include +# include +# include +# ifdef __cplusplus +extern "C" { +# endif + + +/* Minimum RSA key size, from RFC6962 */ +# define SCT_MIN_RSA_BITS 2048 + +/* All hashes are SHA256 in v1 of Certificate Transparency */ +# define CT_V1_HASHLEN SHA256_DIGEST_LENGTH + +typedef enum { + CT_LOG_ENTRY_TYPE_NOT_SET = -1, + CT_LOG_ENTRY_TYPE_X509 = 0, + CT_LOG_ENTRY_TYPE_PRECERT = 1 +} ct_log_entry_type_t; + +typedef enum { + SCT_VERSION_NOT_SET = -1, + SCT_VERSION_V1 = 0 +} sct_version_t; + +typedef enum { + SCT_SOURCE_UNKNOWN, + SCT_SOURCE_TLS_EXTENSION, + SCT_SOURCE_X509V3_EXTENSION, + SCT_SOURCE_OCSP_STAPLED_RESPONSE +} sct_source_t; + +typedef enum { + SCT_VALIDATION_STATUS_NOT_SET, + SCT_VALIDATION_STATUS_UNKNOWN_LOG, + SCT_VALIDATION_STATUS_VALID, + SCT_VALIDATION_STATUS_INVALID, + SCT_VALIDATION_STATUS_UNVERIFIED, + SCT_VALIDATION_STATUS_UNKNOWN_VERSION +} sct_validation_status_t; + +DEFINE_STACK_OF(SCT) +DEFINE_STACK_OF(CTLOG) + +/****************************************** + * CT policy evaluation context functions * + ******************************************/ + +/* + * Creates a new, empty policy evaluation context. + * The caller is responsible for calling CT_POLICY_EVAL_CTX_free when finished + * with the CT_POLICY_EVAL_CTX. + */ +CT_POLICY_EVAL_CTX *CT_POLICY_EVAL_CTX_new(void); + +/* Deletes a policy evaluation context and anything it owns. */ +void CT_POLICY_EVAL_CTX_free(CT_POLICY_EVAL_CTX *ctx); + +/* Gets the peer certificate that the SCTs are for */ +X509* CT_POLICY_EVAL_CTX_get0_cert(const CT_POLICY_EVAL_CTX *ctx); + +/* + * Sets the certificate associated with the received SCTs. + * Increments the reference count of cert. + * Returns 1 on success, 0 otherwise. + */ +int CT_POLICY_EVAL_CTX_set1_cert(CT_POLICY_EVAL_CTX *ctx, X509 *cert); + +/* Gets the issuer of the aforementioned certificate */ +X509* CT_POLICY_EVAL_CTX_get0_issuer(const CT_POLICY_EVAL_CTX *ctx); + +/* + * Sets the issuer of the certificate associated with the received SCTs. + * Increments the reference count of issuer. + * Returns 1 on success, 0 otherwise. + */ +int CT_POLICY_EVAL_CTX_set1_issuer(CT_POLICY_EVAL_CTX *ctx, X509 *issuer); + +/* Gets the CT logs that are trusted sources of SCTs */ +const CTLOG_STORE *CT_POLICY_EVAL_CTX_get0_log_store(const CT_POLICY_EVAL_CTX *ctx); + +/* Sets the log store that is in use. It must outlive the CT_POLICY_EVAL_CTX. */ +void CT_POLICY_EVAL_CTX_set_shared_CTLOG_STORE(CT_POLICY_EVAL_CTX *ctx, + CTLOG_STORE *log_store); + +/* + * Gets the time, in milliseconds since the Unix epoch, that will be used as the + * current time when checking whether an SCT was issued in the future. + * Such SCTs will fail validation, as required by RFC6962. + */ +uint64_t CT_POLICY_EVAL_CTX_get_time(const CT_POLICY_EVAL_CTX *ctx); + +/* + * Sets the time to evaluate SCTs against, in milliseconds since the Unix epoch. + * If an SCT's timestamp is after this time, it will be interpreted as having + * been issued in the future. RFC6962 states that "TLS clients MUST reject SCTs + * whose timestamp is in the future", so an SCT will not validate in this case. + */ +void CT_POLICY_EVAL_CTX_set_time(CT_POLICY_EVAL_CTX *ctx, uint64_t time_in_ms); + +/***************** + * SCT functions * + *****************/ + +/* + * Creates a new, blank SCT. + * The caller is responsible for calling SCT_free when finished with the SCT. + */ +SCT *SCT_new(void); + +/* + * Creates a new SCT from some base64-encoded strings. + * The caller is responsible for calling SCT_free when finished with the SCT. + */ +SCT *SCT_new_from_base64(unsigned char version, + const char *logid_base64, + ct_log_entry_type_t entry_type, + uint64_t timestamp, + const char *extensions_base64, + const char *signature_base64); + +/* + * Frees the SCT and the underlying data structures. + */ +void SCT_free(SCT *sct); + +/* + * Free a stack of SCTs, and the underlying SCTs themselves. + * Intended to be compatible with X509V3_EXT_FREE. + */ +void SCT_LIST_free(STACK_OF(SCT) *a); + +/* + * Returns the version of the SCT. + */ +sct_version_t SCT_get_version(const SCT *sct); + +/* + * Set the version of an SCT. + * Returns 1 on success, 0 if the version is unrecognized. + */ +__owur int SCT_set_version(SCT *sct, sct_version_t version); + +/* + * Returns the log entry type of the SCT. + */ +ct_log_entry_type_t SCT_get_log_entry_type(const SCT *sct); + +/* + * Set the log entry type of an SCT. + * Returns 1 on success, 0 otherwise. + */ +__owur int SCT_set_log_entry_type(SCT *sct, ct_log_entry_type_t entry_type); + +/* + * Gets the ID of the log that an SCT came from. + * Ownership of the log ID remains with the SCT. + * Returns the length of the log ID. + */ +size_t SCT_get0_log_id(const SCT *sct, unsigned char **log_id); + +/* + * Set the log ID of an SCT to point directly to the *log_id specified. + * The SCT takes ownership of the specified pointer. + * Returns 1 on success, 0 otherwise. + */ +__owur int SCT_set0_log_id(SCT *sct, unsigned char *log_id, size_t log_id_len); + +/* + * Set the log ID of an SCT. + * This makes a copy of the log_id. + * Returns 1 on success, 0 otherwise. + */ +__owur int SCT_set1_log_id(SCT *sct, const unsigned char *log_id, + size_t log_id_len); + +/* + * Returns the timestamp for the SCT (epoch time in milliseconds). + */ +uint64_t SCT_get_timestamp(const SCT *sct); + +/* + * Set the timestamp of an SCT (epoch time in milliseconds). + */ +void SCT_set_timestamp(SCT *sct, uint64_t timestamp); + +/* + * Return the NID for the signature used by the SCT. + * For CT v1, this will be either NID_sha256WithRSAEncryption or + * NID_ecdsa_with_SHA256 (or NID_undef if incorrect/unset). + */ +int SCT_get_signature_nid(const SCT *sct); + +/* + * Set the signature type of an SCT + * For CT v1, this should be either NID_sha256WithRSAEncryption or + * NID_ecdsa_with_SHA256. + * Returns 1 on success, 0 otherwise. + */ +__owur int SCT_set_signature_nid(SCT *sct, int nid); + +/* + * Set *ext to point to the extension data for the SCT. ext must not be NULL. + * The SCT retains ownership of this pointer. + * Returns length of the data pointed to. + */ +size_t SCT_get0_extensions(const SCT *sct, unsigned char **ext); + +/* + * Set the extensions of an SCT to point directly to the *ext specified. + * The SCT takes ownership of the specified pointer. + */ +void SCT_set0_extensions(SCT *sct, unsigned char *ext, size_t ext_len); + +/* + * Set the extensions of an SCT. + * This takes a copy of the ext. + * Returns 1 on success, 0 otherwise. + */ +__owur int SCT_set1_extensions(SCT *sct, const unsigned char *ext, + size_t ext_len); + +/* + * Set *sig to point to the signature for the SCT. sig must not be NULL. + * The SCT retains ownership of this pointer. + * Returns length of the data pointed to. + */ +size_t SCT_get0_signature(const SCT *sct, unsigned char **sig); + +/* + * Set the signature of an SCT to point directly to the *sig specified. + * The SCT takes ownership of the specified pointer. + */ +void SCT_set0_signature(SCT *sct, unsigned char *sig, size_t sig_len); + +/* + * Set the signature of an SCT to be a copy of the *sig specified. + * Returns 1 on success, 0 otherwise. + */ +__owur int SCT_set1_signature(SCT *sct, const unsigned char *sig, + size_t sig_len); + +/* + * The origin of this SCT, e.g. TLS extension, OCSP response, etc. + */ +sct_source_t SCT_get_source(const SCT *sct); + +/* + * Set the origin of this SCT, e.g. TLS extension, OCSP response, etc. + * Returns 1 on success, 0 otherwise. + */ +__owur int SCT_set_source(SCT *sct, sct_source_t source); + +/* + * Returns a text string describing the validation status of |sct|. + */ +const char *SCT_validation_status_string(const SCT *sct); + +/* + * Pretty-prints an |sct| to |out|. + * It will be indented by the number of spaces specified by |indent|. + * If |logs| is not NULL, it will be used to lookup the CT log that the SCT came + * from, so that the log name can be printed. + */ +void SCT_print(const SCT *sct, BIO *out, int indent, const CTLOG_STORE *logs); + +/* + * Pretty-prints an |sct_list| to |out|. + * It will be indented by the number of spaces specified by |indent|. + * SCTs will be delimited by |separator|. + * If |logs| is not NULL, it will be used to lookup the CT log that each SCT + * came from, so that the log names can be printed. + */ +void SCT_LIST_print(const STACK_OF(SCT) *sct_list, BIO *out, int indent, + const char *separator, const CTLOG_STORE *logs); + +/* + * Gets the last result of validating this SCT. + * If it has not been validated yet, returns SCT_VALIDATION_STATUS_NOT_SET. + */ +sct_validation_status_t SCT_get_validation_status(const SCT *sct); + +/* + * Validates the given SCT with the provided context. + * Sets the "validation_status" field of the SCT. + * Returns 1 if the SCT is valid and the signature verifies. + * Returns 0 if the SCT is invalid or could not be verified. + * Returns -1 if an error occurs. + */ +__owur int SCT_validate(SCT *sct, const CT_POLICY_EVAL_CTX *ctx); + +/* + * Validates the given list of SCTs with the provided context. + * Sets the "validation_status" field of each SCT. + * Returns 1 if there are no invalid SCTs and all signatures verify. + * Returns 0 if at least one SCT is invalid or could not be verified. + * Returns a negative integer if an error occurs. + */ +__owur int SCT_LIST_validate(const STACK_OF(SCT) *scts, + CT_POLICY_EVAL_CTX *ctx); + + +/********************************* + * SCT parsing and serialisation * + *********************************/ + +/* + * Serialize (to TLS format) a stack of SCTs and return the length. + * "a" must not be NULL. + * If "pp" is NULL, just return the length of what would have been serialized. + * If "pp" is not NULL and "*pp" is null, function will allocate a new pointer + * for data that caller is responsible for freeing (only if function returns + * successfully). + * If "pp" is NULL and "*pp" is not NULL, caller is responsible for ensuring + * that "*pp" is large enough to accept all of the serialized data. + * Returns < 0 on error, >= 0 indicating bytes written (or would have been) + * on success. + */ +__owur int i2o_SCT_LIST(const STACK_OF(SCT) *a, unsigned char **pp); + +/* + * Convert TLS format SCT list to a stack of SCTs. + * If "a" or "*a" is NULL, a new stack will be created that the caller is + * responsible for freeing (by calling SCT_LIST_free). + * "**pp" and "*pp" must not be NULL. + * Upon success, "*pp" will point to after the last bytes read, and a stack + * will be returned. + * Upon failure, a NULL pointer will be returned, and the position of "*pp" is + * not defined. + */ +STACK_OF(SCT) *o2i_SCT_LIST(STACK_OF(SCT) **a, const unsigned char **pp, + size_t len); + +/* + * Serialize (to DER format) a stack of SCTs and return the length. + * "a" must not be NULL. + * If "pp" is NULL, just returns the length of what would have been serialized. + * If "pp" is not NULL and "*pp" is null, function will allocate a new pointer + * for data that caller is responsible for freeing (only if function returns + * successfully). + * If "pp" is NULL and "*pp" is not NULL, caller is responsible for ensuring + * that "*pp" is large enough to accept all of the serialized data. + * Returns < 0 on error, >= 0 indicating bytes written (or would have been) + * on success. + */ +__owur int i2d_SCT_LIST(const STACK_OF(SCT) *a, unsigned char **pp); + +/* + * Parses an SCT list in DER format and returns it. + * If "a" or "*a" is NULL, a new stack will be created that the caller is + * responsible for freeing (by calling SCT_LIST_free). + * "**pp" and "*pp" must not be NULL. + * Upon success, "*pp" will point to after the last bytes read, and a stack + * will be returned. + * Upon failure, a NULL pointer will be returned, and the position of "*pp" is + * not defined. + */ +STACK_OF(SCT) *d2i_SCT_LIST(STACK_OF(SCT) **a, const unsigned char **pp, + long len); + +/* + * Serialize (to TLS format) an |sct| and write it to |out|. + * If |out| is null, no SCT will be output but the length will still be returned. + * If |out| points to a null pointer, a string will be allocated to hold the + * TLS-format SCT. It is the responsibility of the caller to free it. + * If |out| points to an allocated string, the TLS-format SCT will be written + * to it. + * The length of the SCT in TLS format will be returned. + */ +__owur int i2o_SCT(const SCT *sct, unsigned char **out); + +/* + * Parses an SCT in TLS format and returns it. + * If |psct| is not null, it will end up pointing to the parsed SCT. If it + * already points to a non-null pointer, the pointer will be free'd. + * |in| should be a pointer to a string containing the TLS-format SCT. + * |in| will be advanced to the end of the SCT if parsing succeeds. + * |len| should be the length of the SCT in |in|. + * Returns NULL if an error occurs. + * If the SCT is an unsupported version, only the SCT's 'sct' and 'sct_len' + * fields will be populated (with |in| and |len| respectively). + */ +SCT *o2i_SCT(SCT **psct, const unsigned char **in, size_t len); + +/******************** + * CT log functions * + ********************/ + +/* + * Creates a new CT log instance with the given |public_key| and |name|. + * Takes ownership of |public_key| but copies |name|. + * Returns NULL if malloc fails or if |public_key| cannot be converted to DER. + * Should be deleted by the caller using CTLOG_free when no longer needed. + */ +CTLOG *CTLOG_new(EVP_PKEY *public_key, const char *name); + +/* + * Creates a new CTLOG instance with the base64-encoded SubjectPublicKeyInfo DER + * in |pkey_base64|. The |name| is a string to help users identify this log. + * Returns 1 on success, 0 on failure. + * Should be deleted by the caller using CTLOG_free when no longer needed. + */ +int CTLOG_new_from_base64(CTLOG ** ct_log, + const char *pkey_base64, const char *name); + +/* + * Deletes a CT log instance and its fields. + */ +void CTLOG_free(CTLOG *log); + +/* Gets the name of the CT log */ +const char *CTLOG_get0_name(const CTLOG *log); +/* Gets the ID of the CT log */ +void CTLOG_get0_log_id(const CTLOG *log, const uint8_t **log_id, + size_t *log_id_len); +/* Gets the public key of the CT log */ +EVP_PKEY *CTLOG_get0_public_key(const CTLOG *log); + +/************************** + * CT log store functions * + **************************/ + +/* + * Creates a new CT log store. + * Should be deleted by the caller using CTLOG_STORE_free when no longer needed. + */ +CTLOG_STORE *CTLOG_STORE_new(void); + +/* + * Deletes a CT log store and all of the CT log instances held within. + */ +void CTLOG_STORE_free(CTLOG_STORE *store); + +/* + * Finds a CT log in the store based on its log ID. + * Returns the CT log, or NULL if no match is found. + */ +const CTLOG *CTLOG_STORE_get0_log_by_id(const CTLOG_STORE *store, + const uint8_t *log_id, + size_t log_id_len); + +/* + * Loads a CT log list into a |store| from a |file|. + * Returns 1 if loading is successful, or 0 otherwise. + */ +__owur int CTLOG_STORE_load_file(CTLOG_STORE *store, const char *file); + +/* + * Loads the default CT log list into a |store|. + * Returns 1 if loading is successful, or 0 otherwise. + */ +__owur int CTLOG_STORE_load_default_file(CTLOG_STORE *store); + +# ifdef __cplusplus +} +# endif +# endif +#endif diff --git a/ONVIF/include/openssl/include/openssl/cterr.h b/ONVIF/include/openssl/include/openssl/cterr.h new file mode 100644 index 0000000..feb7bc5 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/cterr.h @@ -0,0 +1,80 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_CTERR_H +# define HEADER_CTERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# include + +# ifndef OPENSSL_NO_CT + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_CT_strings(void); + +/* + * CT function codes. + */ +# define CT_F_CTLOG_NEW 117 +# define CT_F_CTLOG_NEW_FROM_BASE64 118 +# define CT_F_CTLOG_NEW_FROM_CONF 119 +# define CT_F_CTLOG_STORE_LOAD_CTX_NEW 122 +# define CT_F_CTLOG_STORE_LOAD_FILE 123 +# define CT_F_CTLOG_STORE_LOAD_LOG 130 +# define CT_F_CTLOG_STORE_NEW 131 +# define CT_F_CT_BASE64_DECODE 124 +# define CT_F_CT_POLICY_EVAL_CTX_NEW 133 +# define CT_F_CT_V1_LOG_ID_FROM_PKEY 125 +# define CT_F_I2O_SCT 107 +# define CT_F_I2O_SCT_LIST 108 +# define CT_F_I2O_SCT_SIGNATURE 109 +# define CT_F_O2I_SCT 110 +# define CT_F_O2I_SCT_LIST 111 +# define CT_F_O2I_SCT_SIGNATURE 112 +# define CT_F_SCT_CTX_NEW 126 +# define CT_F_SCT_CTX_VERIFY 128 +# define CT_F_SCT_NEW 100 +# define CT_F_SCT_NEW_FROM_BASE64 127 +# define CT_F_SCT_SET0_LOG_ID 101 +# define CT_F_SCT_SET1_EXTENSIONS 114 +# define CT_F_SCT_SET1_LOG_ID 115 +# define CT_F_SCT_SET1_SIGNATURE 116 +# define CT_F_SCT_SET_LOG_ENTRY_TYPE 102 +# define CT_F_SCT_SET_SIGNATURE_NID 103 +# define CT_F_SCT_SET_VERSION 104 + +/* + * CT reason codes. + */ +# define CT_R_BASE64_DECODE_ERROR 108 +# define CT_R_INVALID_LOG_ID_LENGTH 100 +# define CT_R_LOG_CONF_INVALID 109 +# define CT_R_LOG_CONF_INVALID_KEY 110 +# define CT_R_LOG_CONF_MISSING_DESCRIPTION 111 +# define CT_R_LOG_CONF_MISSING_KEY 112 +# define CT_R_LOG_KEY_INVALID 113 +# define CT_R_SCT_FUTURE_TIMESTAMP 116 +# define CT_R_SCT_INVALID 104 +# define CT_R_SCT_INVALID_SIGNATURE 107 +# define CT_R_SCT_LIST_INVALID 105 +# define CT_R_SCT_LOG_ID_MISMATCH 114 +# define CT_R_SCT_NOT_SET 106 +# define CT_R_SCT_UNSUPPORTED_VERSION 115 +# define CT_R_UNRECOGNIZED_SIGNATURE_NID 101 +# define CT_R_UNSUPPORTED_ENTRY_TYPE 102 +# define CT_R_UNSUPPORTED_VERSION 103 + +# endif +#endif diff --git a/ONVIF/include/openssl/include/openssl/des.h b/ONVIF/include/openssl/include/openssl/des.h new file mode 100644 index 0000000..be4abbd --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/des.h @@ -0,0 +1,174 @@ +/* + * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_DES_H +# define HEADER_DES_H + +# include + +# ifndef OPENSSL_NO_DES +# ifdef __cplusplus +extern "C" { +# endif +# include + +typedef unsigned int DES_LONG; + +# ifdef OPENSSL_BUILD_SHLIBCRYPTO +# undef OPENSSL_EXTERN +# define OPENSSL_EXTERN OPENSSL_EXPORT +# endif + +typedef unsigned char DES_cblock[8]; +typedef /* const */ unsigned char const_DES_cblock[8]; +/* + * With "const", gcc 2.8.1 on Solaris thinks that DES_cblock * and + * const_DES_cblock * are incompatible pointer types. + */ + +typedef struct DES_ks { + union { + DES_cblock cblock; + /* + * make sure things are correct size on machines with 8 byte longs + */ + DES_LONG deslong[2]; + } ks[16]; +} DES_key_schedule; + +# define DES_KEY_SZ (sizeof(DES_cblock)) +# define DES_SCHEDULE_SZ (sizeof(DES_key_schedule)) + +# define DES_ENCRYPT 1 +# define DES_DECRYPT 0 + +# define DES_CBC_MODE 0 +# define DES_PCBC_MODE 1 + +# define DES_ecb2_encrypt(i,o,k1,k2,e) \ + DES_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e)) + +# define DES_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \ + DES_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e)) + +# define DES_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \ + DES_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e)) + +# define DES_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \ + DES_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n)) + +OPENSSL_DECLARE_GLOBAL(int, DES_check_key); /* defaults to false */ +# define DES_check_key OPENSSL_GLOBAL_REF(DES_check_key) + +const char *DES_options(void); +void DES_ecb3_encrypt(const_DES_cblock *input, DES_cblock *output, + DES_key_schedule *ks1, DES_key_schedule *ks2, + DES_key_schedule *ks3, int enc); +DES_LONG DES_cbc_cksum(const unsigned char *input, DES_cblock *output, + long length, DES_key_schedule *schedule, + const_DES_cblock *ivec); +/* DES_cbc_encrypt does not update the IV! Use DES_ncbc_encrypt instead. */ +void DES_cbc_encrypt(const unsigned char *input, unsigned char *output, + long length, DES_key_schedule *schedule, + DES_cblock *ivec, int enc); +void DES_ncbc_encrypt(const unsigned char *input, unsigned char *output, + long length, DES_key_schedule *schedule, + DES_cblock *ivec, int enc); +void DES_xcbc_encrypt(const unsigned char *input, unsigned char *output, + long length, DES_key_schedule *schedule, + DES_cblock *ivec, const_DES_cblock *inw, + const_DES_cblock *outw, int enc); +void DES_cfb_encrypt(const unsigned char *in, unsigned char *out, int numbits, + long length, DES_key_schedule *schedule, + DES_cblock *ivec, int enc); +void DES_ecb_encrypt(const_DES_cblock *input, DES_cblock *output, + DES_key_schedule *ks, int enc); + +/* + * This is the DES encryption function that gets called by just about every + * other DES routine in the library. You should not use this function except + * to implement 'modes' of DES. I say this because the functions that call + * this routine do the conversion from 'char *' to long, and this needs to be + * done to make sure 'non-aligned' memory access do not occur. The + * characters are loaded 'little endian'. Data is a pointer to 2 unsigned + * long's and ks is the DES_key_schedule to use. enc, is non zero specifies + * encryption, zero if decryption. + */ +void DES_encrypt1(DES_LONG *data, DES_key_schedule *ks, int enc); + +/* + * This functions is the same as DES_encrypt1() except that the DES initial + * permutation (IP) and final permutation (FP) have been left out. As for + * DES_encrypt1(), you should not use this function. It is used by the + * routines in the library that implement triple DES. IP() DES_encrypt2() + * DES_encrypt2() DES_encrypt2() FP() is the same as DES_encrypt1() + * DES_encrypt1() DES_encrypt1() except faster :-). + */ +void DES_encrypt2(DES_LONG *data, DES_key_schedule *ks, int enc); + +void DES_encrypt3(DES_LONG *data, DES_key_schedule *ks1, + DES_key_schedule *ks2, DES_key_schedule *ks3); +void DES_decrypt3(DES_LONG *data, DES_key_schedule *ks1, + DES_key_schedule *ks2, DES_key_schedule *ks3); +void DES_ede3_cbc_encrypt(const unsigned char *input, unsigned char *output, + long length, + DES_key_schedule *ks1, DES_key_schedule *ks2, + DES_key_schedule *ks3, DES_cblock *ivec, int enc); +void DES_ede3_cfb64_encrypt(const unsigned char *in, unsigned char *out, + long length, DES_key_schedule *ks1, + DES_key_schedule *ks2, DES_key_schedule *ks3, + DES_cblock *ivec, int *num, int enc); +void DES_ede3_cfb_encrypt(const unsigned char *in, unsigned char *out, + int numbits, long length, DES_key_schedule *ks1, + DES_key_schedule *ks2, DES_key_schedule *ks3, + DES_cblock *ivec, int enc); +void DES_ede3_ofb64_encrypt(const unsigned char *in, unsigned char *out, + long length, DES_key_schedule *ks1, + DES_key_schedule *ks2, DES_key_schedule *ks3, + DES_cblock *ivec, int *num); +char *DES_fcrypt(const char *buf, const char *salt, char *ret); +char *DES_crypt(const char *buf, const char *salt); +void DES_ofb_encrypt(const unsigned char *in, unsigned char *out, int numbits, + long length, DES_key_schedule *schedule, + DES_cblock *ivec); +void DES_pcbc_encrypt(const unsigned char *input, unsigned char *output, + long length, DES_key_schedule *schedule, + DES_cblock *ivec, int enc); +DES_LONG DES_quad_cksum(const unsigned char *input, DES_cblock output[], + long length, int out_count, DES_cblock *seed); +int DES_random_key(DES_cblock *ret); +void DES_set_odd_parity(DES_cblock *key); +int DES_check_key_parity(const_DES_cblock *key); +int DES_is_weak_key(const_DES_cblock *key); +/* + * DES_set_key (= set_key = DES_key_sched = key_sched) calls + * DES_set_key_checked if global variable DES_check_key is set, + * DES_set_key_unchecked otherwise. + */ +int DES_set_key(const_DES_cblock *key, DES_key_schedule *schedule); +int DES_key_sched(const_DES_cblock *key, DES_key_schedule *schedule); +int DES_set_key_checked(const_DES_cblock *key, DES_key_schedule *schedule); +void DES_set_key_unchecked(const_DES_cblock *key, DES_key_schedule *schedule); +void DES_string_to_key(const char *str, DES_cblock *key); +void DES_string_to_2keys(const char *str, DES_cblock *key1, DES_cblock *key2); +void DES_cfb64_encrypt(const unsigned char *in, unsigned char *out, + long length, DES_key_schedule *schedule, + DES_cblock *ivec, int *num, int enc); +void DES_ofb64_encrypt(const unsigned char *in, unsigned char *out, + long length, DES_key_schedule *schedule, + DES_cblock *ivec, int *num); + +# define DES_fixup_key_parity DES_set_odd_parity + +# ifdef __cplusplus +} +# endif +# endif + +#endif diff --git a/ONVIF/include/openssl/include/openssl/dh.h b/ONVIF/include/openssl/include/openssl/dh.h new file mode 100644 index 0000000..3527540 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/dh.h @@ -0,0 +1,340 @@ +/* + * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_DH_H +# define HEADER_DH_H + +# include + +# ifndef OPENSSL_NO_DH +# include +# include +# include +# include +# if OPENSSL_API_COMPAT < 0x10100000L +# include +# endif +# include + +# ifdef __cplusplus +extern "C" { +# endif + +# ifndef OPENSSL_DH_MAX_MODULUS_BITS +# define OPENSSL_DH_MAX_MODULUS_BITS 10000 +# endif + +# define OPENSSL_DH_FIPS_MIN_MODULUS_BITS 1024 + +# define DH_FLAG_CACHE_MONT_P 0x01 + +# if OPENSSL_API_COMPAT < 0x10100000L +/* + * Does nothing. Previously this switched off constant time behaviour. + */ +# define DH_FLAG_NO_EXP_CONSTTIME 0x00 +# endif + +/* + * If this flag is set the DH method is FIPS compliant and can be used in + * FIPS mode. This is set in the validated module method. If an application + * sets this flag in its own methods it is its responsibility to ensure the + * result is compliant. + */ + +# define DH_FLAG_FIPS_METHOD 0x0400 + +/* + * If this flag is set the operations normally disabled in FIPS mode are + * permitted it is then the applications responsibility to ensure that the + * usage is compliant. + */ + +# define DH_FLAG_NON_FIPS_ALLOW 0x0400 + +/* Already defined in ossl_typ.h */ +/* typedef struct dh_st DH; */ +/* typedef struct dh_method DH_METHOD; */ + +DECLARE_ASN1_ITEM(DHparams) + +# define DH_GENERATOR_2 2 +/* #define DH_GENERATOR_3 3 */ +# define DH_GENERATOR_5 5 + +/* DH_check error codes */ +# define DH_CHECK_P_NOT_PRIME 0x01 +# define DH_CHECK_P_NOT_SAFE_PRIME 0x02 +# define DH_UNABLE_TO_CHECK_GENERATOR 0x04 +# define DH_NOT_SUITABLE_GENERATOR 0x08 +# define DH_CHECK_Q_NOT_PRIME 0x10 +# define DH_CHECK_INVALID_Q_VALUE 0x20 +# define DH_CHECK_INVALID_J_VALUE 0x40 + +/* DH_check_pub_key error codes */ +# define DH_CHECK_PUBKEY_TOO_SMALL 0x01 +# define DH_CHECK_PUBKEY_TOO_LARGE 0x02 +# define DH_CHECK_PUBKEY_INVALID 0x04 + +/* + * primes p where (p-1)/2 is prime too are called "safe"; we define this for + * backward compatibility: + */ +# define DH_CHECK_P_NOT_STRONG_PRIME DH_CHECK_P_NOT_SAFE_PRIME + +# define d2i_DHparams_fp(fp,x) \ + (DH *)ASN1_d2i_fp((char *(*)())DH_new, \ + (char *(*)())d2i_DHparams, \ + (fp), \ + (unsigned char **)(x)) +# define i2d_DHparams_fp(fp,x) \ + ASN1_i2d_fp(i2d_DHparams,(fp), (unsigned char *)(x)) +# define d2i_DHparams_bio(bp,x) \ + ASN1_d2i_bio_of(DH, DH_new, d2i_DHparams, bp, x) +# define i2d_DHparams_bio(bp,x) \ + ASN1_i2d_bio_of_const(DH,i2d_DHparams,bp,x) + +# define d2i_DHxparams_fp(fp,x) \ + (DH *)ASN1_d2i_fp((char *(*)())DH_new, \ + (char *(*)())d2i_DHxparams, \ + (fp), \ + (unsigned char **)(x)) +# define i2d_DHxparams_fp(fp,x) \ + ASN1_i2d_fp(i2d_DHxparams,(fp), (unsigned char *)(x)) +# define d2i_DHxparams_bio(bp,x) \ + ASN1_d2i_bio_of(DH, DH_new, d2i_DHxparams, bp, x) +# define i2d_DHxparams_bio(bp,x) \ + ASN1_i2d_bio_of_const(DH, i2d_DHxparams, bp, x) + +DH *DHparams_dup(DH *); + +const DH_METHOD *DH_OpenSSL(void); + +void DH_set_default_method(const DH_METHOD *meth); +const DH_METHOD *DH_get_default_method(void); +int DH_set_method(DH *dh, const DH_METHOD *meth); +DH *DH_new_method(ENGINE *engine); + +DH *DH_new(void); +void DH_free(DH *dh); +int DH_up_ref(DH *dh); +int DH_bits(const DH *dh); +int DH_size(const DH *dh); +int DH_security_bits(const DH *dh); +#define DH_get_ex_new_index(l, p, newf, dupf, freef) \ + CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_DH, l, p, newf, dupf, freef) +int DH_set_ex_data(DH *d, int idx, void *arg); +void *DH_get_ex_data(DH *d, int idx); + +/* Deprecated version */ +DEPRECATEDIN_0_9_8(DH *DH_generate_parameters(int prime_len, int generator, + void (*callback) (int, int, + void *), + void *cb_arg)) + +/* New version */ +int DH_generate_parameters_ex(DH *dh, int prime_len, int generator, + BN_GENCB *cb); + +int DH_check_params_ex(const DH *dh); +int DH_check_ex(const DH *dh); +int DH_check_pub_key_ex(const DH *dh, const BIGNUM *pub_key); +int DH_check_params(const DH *dh, int *ret); +int DH_check(const DH *dh, int *codes); +int DH_check_pub_key(const DH *dh, const BIGNUM *pub_key, int *codes); +int DH_generate_key(DH *dh); +int DH_compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh); +int DH_compute_key_padded(unsigned char *key, const BIGNUM *pub_key, DH *dh); +DH *d2i_DHparams(DH **a, const unsigned char **pp, long length); +int i2d_DHparams(const DH *a, unsigned char **pp); +DH *d2i_DHxparams(DH **a, const unsigned char **pp, long length); +int i2d_DHxparams(const DH *a, unsigned char **pp); +# ifndef OPENSSL_NO_STDIO +int DHparams_print_fp(FILE *fp, const DH *x); +# endif +int DHparams_print(BIO *bp, const DH *x); + +/* RFC 5114 parameters */ +DH *DH_get_1024_160(void); +DH *DH_get_2048_224(void); +DH *DH_get_2048_256(void); + +/* Named parameters, currently RFC7919 */ +DH *DH_new_by_nid(int nid); +int DH_get_nid(const DH *dh); + +# ifndef OPENSSL_NO_CMS +/* RFC2631 KDF */ +int DH_KDF_X9_42(unsigned char *out, size_t outlen, + const unsigned char *Z, size_t Zlen, + ASN1_OBJECT *key_oid, + const unsigned char *ukm, size_t ukmlen, const EVP_MD *md); +# endif + +void DH_get0_pqg(const DH *dh, + const BIGNUM **p, const BIGNUM **q, const BIGNUM **g); +int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g); +void DH_get0_key(const DH *dh, + const BIGNUM **pub_key, const BIGNUM **priv_key); +int DH_set0_key(DH *dh, BIGNUM *pub_key, BIGNUM *priv_key); +const BIGNUM *DH_get0_p(const DH *dh); +const BIGNUM *DH_get0_q(const DH *dh); +const BIGNUM *DH_get0_g(const DH *dh); +const BIGNUM *DH_get0_priv_key(const DH *dh); +const BIGNUM *DH_get0_pub_key(const DH *dh); +void DH_clear_flags(DH *dh, int flags); +int DH_test_flags(const DH *dh, int flags); +void DH_set_flags(DH *dh, int flags); +ENGINE *DH_get0_engine(DH *d); +long DH_get_length(const DH *dh); +int DH_set_length(DH *dh, long length); + +DH_METHOD *DH_meth_new(const char *name, int flags); +void DH_meth_free(DH_METHOD *dhm); +DH_METHOD *DH_meth_dup(const DH_METHOD *dhm); +const char *DH_meth_get0_name(const DH_METHOD *dhm); +int DH_meth_set1_name(DH_METHOD *dhm, const char *name); +int DH_meth_get_flags(const DH_METHOD *dhm); +int DH_meth_set_flags(DH_METHOD *dhm, int flags); +void *DH_meth_get0_app_data(const DH_METHOD *dhm); +int DH_meth_set0_app_data(DH_METHOD *dhm, void *app_data); +int (*DH_meth_get_generate_key(const DH_METHOD *dhm)) (DH *); +int DH_meth_set_generate_key(DH_METHOD *dhm, int (*generate_key) (DH *)); +int (*DH_meth_get_compute_key(const DH_METHOD *dhm)) + (unsigned char *key, const BIGNUM *pub_key, DH *dh); +int DH_meth_set_compute_key(DH_METHOD *dhm, + int (*compute_key) (unsigned char *key, const BIGNUM *pub_key, DH *dh)); +int (*DH_meth_get_bn_mod_exp(const DH_METHOD *dhm)) + (const DH *, BIGNUM *, const BIGNUM *, const BIGNUM *, const BIGNUM *, + BN_CTX *, BN_MONT_CTX *); +int DH_meth_set_bn_mod_exp(DH_METHOD *dhm, + int (*bn_mod_exp) (const DH *, BIGNUM *, const BIGNUM *, const BIGNUM *, + const BIGNUM *, BN_CTX *, BN_MONT_CTX *)); +int (*DH_meth_get_init(const DH_METHOD *dhm))(DH *); +int DH_meth_set_init(DH_METHOD *dhm, int (*init)(DH *)); +int (*DH_meth_get_finish(const DH_METHOD *dhm)) (DH *); +int DH_meth_set_finish(DH_METHOD *dhm, int (*finish) (DH *)); +int (*DH_meth_get_generate_params(const DH_METHOD *dhm)) + (DH *, int, int, BN_GENCB *); +int DH_meth_set_generate_params(DH_METHOD *dhm, + int (*generate_params) (DH *, int, int, BN_GENCB *)); + + +# define EVP_PKEY_CTX_set_dh_paramgen_prime_len(ctx, len) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \ + EVP_PKEY_CTRL_DH_PARAMGEN_PRIME_LEN, len, NULL) + +# define EVP_PKEY_CTX_set_dh_paramgen_subprime_len(ctx, len) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \ + EVP_PKEY_CTRL_DH_PARAMGEN_SUBPRIME_LEN, len, NULL) + +# define EVP_PKEY_CTX_set_dh_paramgen_type(ctx, typ) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \ + EVP_PKEY_CTRL_DH_PARAMGEN_TYPE, typ, NULL) + +# define EVP_PKEY_CTX_set_dh_paramgen_generator(ctx, gen) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \ + EVP_PKEY_CTRL_DH_PARAMGEN_GENERATOR, gen, NULL) + +# define EVP_PKEY_CTX_set_dh_rfc5114(ctx, gen) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, EVP_PKEY_OP_PARAMGEN, \ + EVP_PKEY_CTRL_DH_RFC5114, gen, NULL) + +# define EVP_PKEY_CTX_set_dhx_rfc5114(ctx, gen) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, EVP_PKEY_OP_PARAMGEN, \ + EVP_PKEY_CTRL_DH_RFC5114, gen, NULL) + +# define EVP_PKEY_CTX_set_dh_nid(ctx, nid) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, \ + EVP_PKEY_OP_PARAMGEN | EVP_PKEY_OP_KEYGEN, \ + EVP_PKEY_CTRL_DH_NID, nid, NULL) + +# define EVP_PKEY_CTX_set_dh_pad(ctx, pad) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_DH_PAD, pad, NULL) + +# define EVP_PKEY_CTX_set_dh_kdf_type(ctx, kdf) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_DH_KDF_TYPE, kdf, NULL) + +# define EVP_PKEY_CTX_get_dh_kdf_type(ctx) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_DH_KDF_TYPE, -2, NULL) + +# define EVP_PKEY_CTX_set0_dh_kdf_oid(ctx, oid) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_DH_KDF_OID, 0, (void *)(oid)) + +# define EVP_PKEY_CTX_get0_dh_kdf_oid(ctx, poid) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_GET_DH_KDF_OID, 0, (void *)(poid)) + +# define EVP_PKEY_CTX_set_dh_kdf_md(ctx, md) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_DH_KDF_MD, 0, (void *)(md)) + +# define EVP_PKEY_CTX_get_dh_kdf_md(ctx, pmd) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_GET_DH_KDF_MD, 0, (void *)(pmd)) + +# define EVP_PKEY_CTX_set_dh_kdf_outlen(ctx, len) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_DH_KDF_OUTLEN, len, NULL) + +# define EVP_PKEY_CTX_get_dh_kdf_outlen(ctx, plen) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_GET_DH_KDF_OUTLEN, 0, (void *)(plen)) + +# define EVP_PKEY_CTX_set0_dh_kdf_ukm(ctx, p, plen) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_DH_KDF_UKM, plen, (void *)(p)) + +# define EVP_PKEY_CTX_get0_dh_kdf_ukm(ctx, p) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_GET_DH_KDF_UKM, 0, (void *)(p)) + +# define EVP_PKEY_CTRL_DH_PARAMGEN_PRIME_LEN (EVP_PKEY_ALG_CTRL + 1) +# define EVP_PKEY_CTRL_DH_PARAMGEN_GENERATOR (EVP_PKEY_ALG_CTRL + 2) +# define EVP_PKEY_CTRL_DH_RFC5114 (EVP_PKEY_ALG_CTRL + 3) +# define EVP_PKEY_CTRL_DH_PARAMGEN_SUBPRIME_LEN (EVP_PKEY_ALG_CTRL + 4) +# define EVP_PKEY_CTRL_DH_PARAMGEN_TYPE (EVP_PKEY_ALG_CTRL + 5) +# define EVP_PKEY_CTRL_DH_KDF_TYPE (EVP_PKEY_ALG_CTRL + 6) +# define EVP_PKEY_CTRL_DH_KDF_MD (EVP_PKEY_ALG_CTRL + 7) +# define EVP_PKEY_CTRL_GET_DH_KDF_MD (EVP_PKEY_ALG_CTRL + 8) +# define EVP_PKEY_CTRL_DH_KDF_OUTLEN (EVP_PKEY_ALG_CTRL + 9) +# define EVP_PKEY_CTRL_GET_DH_KDF_OUTLEN (EVP_PKEY_ALG_CTRL + 10) +# define EVP_PKEY_CTRL_DH_KDF_UKM (EVP_PKEY_ALG_CTRL + 11) +# define EVP_PKEY_CTRL_GET_DH_KDF_UKM (EVP_PKEY_ALG_CTRL + 12) +# define EVP_PKEY_CTRL_DH_KDF_OID (EVP_PKEY_ALG_CTRL + 13) +# define EVP_PKEY_CTRL_GET_DH_KDF_OID (EVP_PKEY_ALG_CTRL + 14) +# define EVP_PKEY_CTRL_DH_NID (EVP_PKEY_ALG_CTRL + 15) +# define EVP_PKEY_CTRL_DH_PAD (EVP_PKEY_ALG_CTRL + 16) + +/* KDF types */ +# define EVP_PKEY_DH_KDF_NONE 1 +# ifndef OPENSSL_NO_CMS +# define EVP_PKEY_DH_KDF_X9_42 2 +# endif + + +# ifdef __cplusplus +} +# endif +# endif +#endif diff --git a/ONVIF/include/openssl/include/openssl/dherr.h b/ONVIF/include/openssl/include/openssl/dherr.h new file mode 100644 index 0000000..916b3be --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/dherr.h @@ -0,0 +1,88 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_DHERR_H +# define HEADER_DHERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# include + +# ifndef OPENSSL_NO_DH + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_DH_strings(void); + +/* + * DH function codes. + */ +# define DH_F_COMPUTE_KEY 102 +# define DH_F_DHPARAMS_PRINT_FP 101 +# define DH_F_DH_BUILTIN_GENPARAMS 106 +# define DH_F_DH_CHECK_EX 121 +# define DH_F_DH_CHECK_PARAMS_EX 122 +# define DH_F_DH_CHECK_PUB_KEY_EX 123 +# define DH_F_DH_CMS_DECRYPT 114 +# define DH_F_DH_CMS_SET_PEERKEY 115 +# define DH_F_DH_CMS_SET_SHARED_INFO 116 +# define DH_F_DH_METH_DUP 117 +# define DH_F_DH_METH_NEW 118 +# define DH_F_DH_METH_SET1_NAME 119 +# define DH_F_DH_NEW_BY_NID 104 +# define DH_F_DH_NEW_METHOD 105 +# define DH_F_DH_PARAM_DECODE 107 +# define DH_F_DH_PKEY_PUBLIC_CHECK 124 +# define DH_F_DH_PRIV_DECODE 110 +# define DH_F_DH_PRIV_ENCODE 111 +# define DH_F_DH_PUB_DECODE 108 +# define DH_F_DH_PUB_ENCODE 109 +# define DH_F_DO_DH_PRINT 100 +# define DH_F_GENERATE_KEY 103 +# define DH_F_PKEY_DH_CTRL_STR 120 +# define DH_F_PKEY_DH_DERIVE 112 +# define DH_F_PKEY_DH_INIT 125 +# define DH_F_PKEY_DH_KEYGEN 113 + +/* + * DH reason codes. + */ +# define DH_R_BAD_GENERATOR 101 +# define DH_R_BN_DECODE_ERROR 109 +# define DH_R_BN_ERROR 106 +# define DH_R_CHECK_INVALID_J_VALUE 115 +# define DH_R_CHECK_INVALID_Q_VALUE 116 +# define DH_R_CHECK_PUBKEY_INVALID 122 +# define DH_R_CHECK_PUBKEY_TOO_LARGE 123 +# define DH_R_CHECK_PUBKEY_TOO_SMALL 124 +# define DH_R_CHECK_P_NOT_PRIME 117 +# define DH_R_CHECK_P_NOT_SAFE_PRIME 118 +# define DH_R_CHECK_Q_NOT_PRIME 119 +# define DH_R_DECODE_ERROR 104 +# define DH_R_INVALID_PARAMETER_NAME 110 +# define DH_R_INVALID_PARAMETER_NID 114 +# define DH_R_INVALID_PUBKEY 102 +# define DH_R_KDF_PARAMETER_ERROR 112 +# define DH_R_KEYS_NOT_SET 108 +# define DH_R_MISSING_PUBKEY 125 +# define DH_R_MODULUS_TOO_LARGE 103 +# define DH_R_NOT_SUITABLE_GENERATOR 120 +# define DH_R_NO_PARAMETERS_SET 107 +# define DH_R_NO_PRIVATE_VALUE 100 +# define DH_R_PARAMETER_ENCODING_ERROR 105 +# define DH_R_PEER_KEY_ERROR 111 +# define DH_R_SHARED_INFO_ERROR 113 +# define DH_R_UNABLE_TO_CHECK_GENERATOR 121 + +# endif +#endif diff --git a/ONVIF/include/openssl/include/openssl/dsa.h b/ONVIF/include/openssl/include/openssl/dsa.h new file mode 100644 index 0000000..6d8a18a --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/dsa.h @@ -0,0 +1,244 @@ +/* + * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_DSA_H +# define HEADER_DSA_H + +# include + +# ifndef OPENSSL_NO_DSA +# ifdef __cplusplus +extern "C" { +# endif +# include +# include +# include +# include +# include +# if OPENSSL_API_COMPAT < 0x10100000L +# include +# endif +# include + +# ifndef OPENSSL_DSA_MAX_MODULUS_BITS +# define OPENSSL_DSA_MAX_MODULUS_BITS 10000 +# endif + +# define OPENSSL_DSA_FIPS_MIN_MODULUS_BITS 1024 + +# define DSA_FLAG_CACHE_MONT_P 0x01 +# if OPENSSL_API_COMPAT < 0x10100000L +/* + * Does nothing. Previously this switched off constant time behaviour. + */ +# define DSA_FLAG_NO_EXP_CONSTTIME 0x00 +# endif + +/* + * If this flag is set the DSA method is FIPS compliant and can be used in + * FIPS mode. This is set in the validated module method. If an application + * sets this flag in its own methods it is its responsibility to ensure the + * result is compliant. + */ + +# define DSA_FLAG_FIPS_METHOD 0x0400 + +/* + * If this flag is set the operations normally disabled in FIPS mode are + * permitted it is then the applications responsibility to ensure that the + * usage is compliant. + */ + +# define DSA_FLAG_NON_FIPS_ALLOW 0x0400 +# define DSA_FLAG_FIPS_CHECKED 0x0800 + +/* Already defined in ossl_typ.h */ +/* typedef struct dsa_st DSA; */ +/* typedef struct dsa_method DSA_METHOD; */ + +typedef struct DSA_SIG_st DSA_SIG; + +# define d2i_DSAparams_fp(fp,x) (DSA *)ASN1_d2i_fp((char *(*)())DSA_new, \ + (char *(*)())d2i_DSAparams,(fp),(unsigned char **)(x)) +# define i2d_DSAparams_fp(fp,x) ASN1_i2d_fp(i2d_DSAparams,(fp), \ + (unsigned char *)(x)) +# define d2i_DSAparams_bio(bp,x) ASN1_d2i_bio_of(DSA,DSA_new,d2i_DSAparams,bp,x) +# define i2d_DSAparams_bio(bp,x) ASN1_i2d_bio_of_const(DSA,i2d_DSAparams,bp,x) + +DSA *DSAparams_dup(DSA *x); +DSA_SIG *DSA_SIG_new(void); +void DSA_SIG_free(DSA_SIG *a); +int i2d_DSA_SIG(const DSA_SIG *a, unsigned char **pp); +DSA_SIG *d2i_DSA_SIG(DSA_SIG **v, const unsigned char **pp, long length); +void DSA_SIG_get0(const DSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps); +int DSA_SIG_set0(DSA_SIG *sig, BIGNUM *r, BIGNUM *s); + +DSA_SIG *DSA_do_sign(const unsigned char *dgst, int dlen, DSA *dsa); +int DSA_do_verify(const unsigned char *dgst, int dgst_len, + DSA_SIG *sig, DSA *dsa); + +const DSA_METHOD *DSA_OpenSSL(void); + +void DSA_set_default_method(const DSA_METHOD *); +const DSA_METHOD *DSA_get_default_method(void); +int DSA_set_method(DSA *dsa, const DSA_METHOD *); +const DSA_METHOD *DSA_get_method(DSA *d); + +DSA *DSA_new(void); +DSA *DSA_new_method(ENGINE *engine); +void DSA_free(DSA *r); +/* "up" the DSA object's reference count */ +int DSA_up_ref(DSA *r); +int DSA_size(const DSA *); +int DSA_bits(const DSA *d); +int DSA_security_bits(const DSA *d); + /* next 4 return -1 on error */ +DEPRECATEDIN_1_2_0(int DSA_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp)) +int DSA_sign(int type, const unsigned char *dgst, int dlen, + unsigned char *sig, unsigned int *siglen, DSA *dsa); +int DSA_verify(int type, const unsigned char *dgst, int dgst_len, + const unsigned char *sigbuf, int siglen, DSA *dsa); +#define DSA_get_ex_new_index(l, p, newf, dupf, freef) \ + CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_DSA, l, p, newf, dupf, freef) +int DSA_set_ex_data(DSA *d, int idx, void *arg); +void *DSA_get_ex_data(DSA *d, int idx); + +DSA *d2i_DSAPublicKey(DSA **a, const unsigned char **pp, long length); +DSA *d2i_DSAPrivateKey(DSA **a, const unsigned char **pp, long length); +DSA *d2i_DSAparams(DSA **a, const unsigned char **pp, long length); + +/* Deprecated version */ +DEPRECATEDIN_0_9_8(DSA *DSA_generate_parameters(int bits, + unsigned char *seed, + int seed_len, + int *counter_ret, + unsigned long *h_ret, void + (*callback) (int, int, + void *), + void *cb_arg)) + +/* New version */ +int DSA_generate_parameters_ex(DSA *dsa, int bits, + const unsigned char *seed, int seed_len, + int *counter_ret, unsigned long *h_ret, + BN_GENCB *cb); + +int DSA_generate_key(DSA *a); +int i2d_DSAPublicKey(const DSA *a, unsigned char **pp); +int i2d_DSAPrivateKey(const DSA *a, unsigned char **pp); +int i2d_DSAparams(const DSA *a, unsigned char **pp); + +int DSAparams_print(BIO *bp, const DSA *x); +int DSA_print(BIO *bp, const DSA *x, int off); +# ifndef OPENSSL_NO_STDIO +int DSAparams_print_fp(FILE *fp, const DSA *x); +int DSA_print_fp(FILE *bp, const DSA *x, int off); +# endif + +# define DSS_prime_checks 64 +/* + * Primality test according to FIPS PUB 186-4, Appendix C.3. Since we only + * have one value here we set the number of checks to 64 which is the 128 bit + * security level that is the highest level and valid for creating a 3072 bit + * DSA key. + */ +# define DSA_is_prime(n, callback, cb_arg) \ + BN_is_prime(n, DSS_prime_checks, callback, NULL, cb_arg) + +# ifndef OPENSSL_NO_DH +/* + * Convert DSA structure (key or just parameters) into DH structure (be + * careful to avoid small subgroup attacks when using this!) + */ +DH *DSA_dup_DH(const DSA *r); +# endif + +# define EVP_PKEY_CTX_set_dsa_paramgen_bits(ctx, nbits) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DSA, EVP_PKEY_OP_PARAMGEN, \ + EVP_PKEY_CTRL_DSA_PARAMGEN_BITS, nbits, NULL) +# define EVP_PKEY_CTX_set_dsa_paramgen_q_bits(ctx, qbits) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DSA, EVP_PKEY_OP_PARAMGEN, \ + EVP_PKEY_CTRL_DSA_PARAMGEN_Q_BITS, qbits, NULL) +# define EVP_PKEY_CTX_set_dsa_paramgen_md(ctx, md) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DSA, EVP_PKEY_OP_PARAMGEN, \ + EVP_PKEY_CTRL_DSA_PARAMGEN_MD, 0, (void *)(md)) + +# define EVP_PKEY_CTRL_DSA_PARAMGEN_BITS (EVP_PKEY_ALG_CTRL + 1) +# define EVP_PKEY_CTRL_DSA_PARAMGEN_Q_BITS (EVP_PKEY_ALG_CTRL + 2) +# define EVP_PKEY_CTRL_DSA_PARAMGEN_MD (EVP_PKEY_ALG_CTRL + 3) + +void DSA_get0_pqg(const DSA *d, + const BIGNUM **p, const BIGNUM **q, const BIGNUM **g); +int DSA_set0_pqg(DSA *d, BIGNUM *p, BIGNUM *q, BIGNUM *g); +void DSA_get0_key(const DSA *d, + const BIGNUM **pub_key, const BIGNUM **priv_key); +int DSA_set0_key(DSA *d, BIGNUM *pub_key, BIGNUM *priv_key); +const BIGNUM *DSA_get0_p(const DSA *d); +const BIGNUM *DSA_get0_q(const DSA *d); +const BIGNUM *DSA_get0_g(const DSA *d); +const BIGNUM *DSA_get0_pub_key(const DSA *d); +const BIGNUM *DSA_get0_priv_key(const DSA *d); +void DSA_clear_flags(DSA *d, int flags); +int DSA_test_flags(const DSA *d, int flags); +void DSA_set_flags(DSA *d, int flags); +ENGINE *DSA_get0_engine(DSA *d); + +DSA_METHOD *DSA_meth_new(const char *name, int flags); +void DSA_meth_free(DSA_METHOD *dsam); +DSA_METHOD *DSA_meth_dup(const DSA_METHOD *dsam); +const char *DSA_meth_get0_name(const DSA_METHOD *dsam); +int DSA_meth_set1_name(DSA_METHOD *dsam, const char *name); +int DSA_meth_get_flags(const DSA_METHOD *dsam); +int DSA_meth_set_flags(DSA_METHOD *dsam, int flags); +void *DSA_meth_get0_app_data(const DSA_METHOD *dsam); +int DSA_meth_set0_app_data(DSA_METHOD *dsam, void *app_data); +DSA_SIG *(*DSA_meth_get_sign(const DSA_METHOD *dsam)) + (const unsigned char *, int, DSA *); +int DSA_meth_set_sign(DSA_METHOD *dsam, + DSA_SIG *(*sign) (const unsigned char *, int, DSA *)); +int (*DSA_meth_get_sign_setup(const DSA_METHOD *dsam)) + (DSA *, BN_CTX *, BIGNUM **, BIGNUM **); +int DSA_meth_set_sign_setup(DSA_METHOD *dsam, + int (*sign_setup) (DSA *, BN_CTX *, BIGNUM **, BIGNUM **)); +int (*DSA_meth_get_verify(const DSA_METHOD *dsam)) + (const unsigned char *, int, DSA_SIG *, DSA *); +int DSA_meth_set_verify(DSA_METHOD *dsam, + int (*verify) (const unsigned char *, int, DSA_SIG *, DSA *)); +int (*DSA_meth_get_mod_exp(const DSA_METHOD *dsam)) + (DSA *, BIGNUM *, const BIGNUM *, const BIGNUM *, const BIGNUM *, + const BIGNUM *, const BIGNUM *, BN_CTX *, BN_MONT_CTX *); +int DSA_meth_set_mod_exp(DSA_METHOD *dsam, + int (*mod_exp) (DSA *, BIGNUM *, const BIGNUM *, const BIGNUM *, + const BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *, + BN_MONT_CTX *)); +int (*DSA_meth_get_bn_mod_exp(const DSA_METHOD *dsam)) + (DSA *, BIGNUM *, const BIGNUM *, const BIGNUM *, const BIGNUM *, + BN_CTX *, BN_MONT_CTX *); +int DSA_meth_set_bn_mod_exp(DSA_METHOD *dsam, + int (*bn_mod_exp) (DSA *, BIGNUM *, const BIGNUM *, const BIGNUM *, + const BIGNUM *, BN_CTX *, BN_MONT_CTX *)); +int (*DSA_meth_get_init(const DSA_METHOD *dsam))(DSA *); +int DSA_meth_set_init(DSA_METHOD *dsam, int (*init)(DSA *)); +int (*DSA_meth_get_finish(const DSA_METHOD *dsam)) (DSA *); +int DSA_meth_set_finish(DSA_METHOD *dsam, int (*finish) (DSA *)); +int (*DSA_meth_get_paramgen(const DSA_METHOD *dsam)) + (DSA *, int, const unsigned char *, int, int *, unsigned long *, + BN_GENCB *); +int DSA_meth_set_paramgen(DSA_METHOD *dsam, + int (*paramgen) (DSA *, int, const unsigned char *, int, int *, + unsigned long *, BN_GENCB *)); +int (*DSA_meth_get_keygen(const DSA_METHOD *dsam)) (DSA *); +int DSA_meth_set_keygen(DSA_METHOD *dsam, int (*keygen) (DSA *)); + + +# ifdef __cplusplus +} +# endif +# endif +#endif diff --git a/ONVIF/include/openssl/include/openssl/dsaerr.h b/ONVIF/include/openssl/include/openssl/dsaerr.h new file mode 100644 index 0000000..495a1ac --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/dsaerr.h @@ -0,0 +1,72 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_DSAERR_H +# define HEADER_DSAERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# include + +# ifndef OPENSSL_NO_DSA + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_DSA_strings(void); + +/* + * DSA function codes. + */ +# define DSA_F_DSAPARAMS_PRINT 100 +# define DSA_F_DSAPARAMS_PRINT_FP 101 +# define DSA_F_DSA_BUILTIN_PARAMGEN 125 +# define DSA_F_DSA_BUILTIN_PARAMGEN2 126 +# define DSA_F_DSA_DO_SIGN 112 +# define DSA_F_DSA_DO_VERIFY 113 +# define DSA_F_DSA_METH_DUP 127 +# define DSA_F_DSA_METH_NEW 128 +# define DSA_F_DSA_METH_SET1_NAME 129 +# define DSA_F_DSA_NEW_METHOD 103 +# define DSA_F_DSA_PARAM_DECODE 119 +# define DSA_F_DSA_PRINT_FP 105 +# define DSA_F_DSA_PRIV_DECODE 115 +# define DSA_F_DSA_PRIV_ENCODE 116 +# define DSA_F_DSA_PUB_DECODE 117 +# define DSA_F_DSA_PUB_ENCODE 118 +# define DSA_F_DSA_SIGN 106 +# define DSA_F_DSA_SIGN_SETUP 107 +# define DSA_F_DSA_SIG_NEW 102 +# define DSA_F_OLD_DSA_PRIV_DECODE 122 +# define DSA_F_PKEY_DSA_CTRL 120 +# define DSA_F_PKEY_DSA_CTRL_STR 104 +# define DSA_F_PKEY_DSA_KEYGEN 121 + +/* + * DSA reason codes. + */ +# define DSA_R_BAD_Q_VALUE 102 +# define DSA_R_BN_DECODE_ERROR 108 +# define DSA_R_BN_ERROR 109 +# define DSA_R_DECODE_ERROR 104 +# define DSA_R_INVALID_DIGEST_TYPE 106 +# define DSA_R_INVALID_PARAMETERS 112 +# define DSA_R_MISSING_PARAMETERS 101 +# define DSA_R_MISSING_PRIVATE_KEY 111 +# define DSA_R_MODULUS_TOO_LARGE 103 +# define DSA_R_NO_PARAMETERS_SET 107 +# define DSA_R_PARAMETER_ENCODING_ERROR 105 +# define DSA_R_Q_NOT_PRIME 113 +# define DSA_R_SEED_LEN_SMALL 110 + +# endif +#endif diff --git a/ONVIF/include/openssl/include/openssl/dtls1.h b/ONVIF/include/openssl/include/openssl/dtls1.h new file mode 100644 index 0000000..d55ca9c --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/dtls1.h @@ -0,0 +1,55 @@ +/* + * Copyright 2005-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_DTLS1_H +# define HEADER_DTLS1_H + +#ifdef __cplusplus +extern "C" { +#endif + +# define DTLS1_VERSION 0xFEFF +# define DTLS1_2_VERSION 0xFEFD +# define DTLS_MIN_VERSION DTLS1_VERSION +# define DTLS_MAX_VERSION DTLS1_2_VERSION +# define DTLS1_VERSION_MAJOR 0xFE + +# define DTLS1_BAD_VER 0x0100 + +/* Special value for method supporting multiple versions */ +# define DTLS_ANY_VERSION 0x1FFFF + +/* lengths of messages */ +/* + * Actually the max cookie length in DTLS is 255. But we can't change this now + * due to compatibility concerns. + */ +# define DTLS1_COOKIE_LENGTH 256 + +# define DTLS1_RT_HEADER_LENGTH 13 + +# define DTLS1_HM_HEADER_LENGTH 12 + +# define DTLS1_HM_BAD_FRAGMENT -2 +# define DTLS1_HM_FRAGMENT_RETRY -3 + +# define DTLS1_CCS_HEADER_LENGTH 1 + +# define DTLS1_AL_HEADER_LENGTH 2 + +/* Timeout multipliers */ +# define DTLS1_TMO_READ_COUNT 2 +# define DTLS1_TMO_WRITE_COUNT 2 + +# define DTLS1_TMO_ALERT_COUNT 12 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/ONVIF/include/openssl/include/openssl/e_os2.h b/ONVIF/include/openssl/include/openssl/e_os2.h new file mode 100644 index 0000000..97a776c --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/e_os2.h @@ -0,0 +1,300 @@ +/* + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_E_OS2_H +# define HEADER_E_OS2_H + +# include + +#ifdef __cplusplus +extern "C" { +#endif + +/****************************************************************************** + * Detect operating systems. This probably needs completing. + * The result is that at least one OPENSSL_SYS_os macro should be defined. + * However, if none is defined, Unix is assumed. + **/ + +# define OPENSSL_SYS_UNIX + +/* --------------------- Microsoft operating systems ---------------------- */ + +/* + * Note that MSDOS actually denotes 32-bit environments running on top of + * MS-DOS, such as DJGPP one. + */ +# if defined(OPENSSL_SYS_MSDOS) +# undef OPENSSL_SYS_UNIX +# endif + +/* + * For 32 bit environment, there seems to be the CygWin environment and then + * all the others that try to do the same thing Microsoft does... + */ +/* + * UEFI lives here because it might be built with a Microsoft toolchain and + * we need to avoid the false positive match on Windows. + */ +# if defined(OPENSSL_SYS_UEFI) +# undef OPENSSL_SYS_UNIX +# elif defined(OPENSSL_SYS_UWIN) +# undef OPENSSL_SYS_UNIX +# define OPENSSL_SYS_WIN32_UWIN +# else +# if defined(__CYGWIN__) || defined(OPENSSL_SYS_CYGWIN) +# define OPENSSL_SYS_WIN32_CYGWIN +# else +# if defined(_WIN32) || defined(OPENSSL_SYS_WIN32) +# undef OPENSSL_SYS_UNIX +# if !defined(OPENSSL_SYS_WIN32) +# define OPENSSL_SYS_WIN32 +# endif +# endif +# if defined(_WIN64) || defined(OPENSSL_SYS_WIN64) +# undef OPENSSL_SYS_UNIX +# if !defined(OPENSSL_SYS_WIN64) +# define OPENSSL_SYS_WIN64 +# endif +# endif +# if defined(OPENSSL_SYS_WINNT) +# undef OPENSSL_SYS_UNIX +# endif +# if defined(OPENSSL_SYS_WINCE) +# undef OPENSSL_SYS_UNIX +# endif +# endif +# endif + +/* Anything that tries to look like Microsoft is "Windows" */ +# if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WIN64) || defined(OPENSSL_SYS_WINNT) || defined(OPENSSL_SYS_WINCE) +# undef OPENSSL_SYS_UNIX +# define OPENSSL_SYS_WINDOWS +# ifndef OPENSSL_SYS_MSDOS +# define OPENSSL_SYS_MSDOS +# endif +# endif + +/* + * DLL settings. This part is a bit tough, because it's up to the + * application implementor how he or she will link the application, so it + * requires some macro to be used. + */ +# ifdef OPENSSL_SYS_WINDOWS +# ifndef OPENSSL_OPT_WINDLL +# if defined(_WINDLL) /* This is used when building OpenSSL to + * indicate that DLL linkage should be used */ +# define OPENSSL_OPT_WINDLL +# endif +# endif +# endif + +/* ------------------------------- OpenVMS -------------------------------- */ +# if defined(__VMS) || defined(VMS) || defined(OPENSSL_SYS_VMS) +# if !defined(OPENSSL_SYS_VMS) +# undef OPENSSL_SYS_UNIX +# endif +# define OPENSSL_SYS_VMS +# if defined(__DECC) +# define OPENSSL_SYS_VMS_DECC +# elif defined(__DECCXX) +# define OPENSSL_SYS_VMS_DECC +# define OPENSSL_SYS_VMS_DECCXX +# else +# define OPENSSL_SYS_VMS_NODECC +# endif +# endif + +/* -------------------------------- Unix ---------------------------------- */ +# ifdef OPENSSL_SYS_UNIX +# if defined(linux) || defined(__linux__) && !defined(OPENSSL_SYS_LINUX) +# define OPENSSL_SYS_LINUX +# endif +# if defined(_AIX) && !defined(OPENSSL_SYS_AIX) +# define OPENSSL_SYS_AIX +# endif +# endif + +/* -------------------------------- VOS ----------------------------------- */ +# if defined(__VOS__) && !defined(OPENSSL_SYS_VOS) +# define OPENSSL_SYS_VOS +# ifdef __HPPA__ +# define OPENSSL_SYS_VOS_HPPA +# endif +# ifdef __IA32__ +# define OPENSSL_SYS_VOS_IA32 +# endif +# endif + +/** + * That's it for OS-specific stuff + *****************************************************************************/ + +/* Specials for I/O an exit */ +# ifdef OPENSSL_SYS_MSDOS +# define OPENSSL_UNISTD_IO +# define OPENSSL_DECLARE_EXIT extern void exit(int); +# else +# define OPENSSL_UNISTD_IO OPENSSL_UNISTD +# define OPENSSL_DECLARE_EXIT /* declared in unistd.h */ +# endif + +/*- + * OPENSSL_EXTERN is normally used to declare a symbol with possible extra + * attributes to handle its presence in a shared library. + * OPENSSL_EXPORT is used to define a symbol with extra possible attributes + * to make it visible in a shared library. + * Care needs to be taken when a header file is used both to declare and + * define symbols. Basically, for any library that exports some global + * variables, the following code must be present in the header file that + * declares them, before OPENSSL_EXTERN is used: + * + * #ifdef SOME_BUILD_FLAG_MACRO + * # undef OPENSSL_EXTERN + * # define OPENSSL_EXTERN OPENSSL_EXPORT + * #endif + * + * The default is to have OPENSSL_EXPORT and OPENSSL_EXTERN + * have some generally sensible values. + */ + +# if defined(OPENSSL_SYS_WINDOWS) && defined(OPENSSL_OPT_WINDLL) +# define OPENSSL_EXPORT extern __declspec(dllexport) +# define OPENSSL_EXTERN extern __declspec(dllimport) +# else +# define OPENSSL_EXPORT extern +# define OPENSSL_EXTERN extern +# endif + +/*- + * Macros to allow global variables to be reached through function calls when + * required (if a shared library version requires it, for example. + * The way it's done allows definitions like this: + * + * // in foobar.c + * OPENSSL_IMPLEMENT_GLOBAL(int,foobar,0) + * // in foobar.h + * OPENSSL_DECLARE_GLOBAL(int,foobar); + * #define foobar OPENSSL_GLOBAL_REF(foobar) + */ +# ifdef OPENSSL_EXPORT_VAR_AS_FUNCTION +# define OPENSSL_IMPLEMENT_GLOBAL(type,name,value) \ + type *_shadow_##name(void) \ + { static type _hide_##name=value; return &_hide_##name; } +# define OPENSSL_DECLARE_GLOBAL(type,name) type *_shadow_##name(void) +# define OPENSSL_GLOBAL_REF(name) (*(_shadow_##name())) +# else +# define OPENSSL_IMPLEMENT_GLOBAL(type,name,value) type _shadow_##name=value; +# define OPENSSL_DECLARE_GLOBAL(type,name) OPENSSL_EXPORT type _shadow_##name +# define OPENSSL_GLOBAL_REF(name) _shadow_##name +# endif + +# ifdef _WIN32 +# ifdef _WIN64 +# define ossl_ssize_t __int64 +# define OSSL_SSIZE_MAX _I64_MAX +# else +# define ossl_ssize_t int +# define OSSL_SSIZE_MAX INT_MAX +# endif +# endif + +# if defined(OPENSSL_SYS_UEFI) && !defined(ossl_ssize_t) +# define ossl_ssize_t INTN +# define OSSL_SSIZE_MAX MAX_INTN +# endif + +# ifndef ossl_ssize_t +# define ossl_ssize_t ssize_t +# if defined(SSIZE_MAX) +# define OSSL_SSIZE_MAX SSIZE_MAX +# elif defined(_POSIX_SSIZE_MAX) +# define OSSL_SSIZE_MAX _POSIX_SSIZE_MAX +# else +# define OSSL_SSIZE_MAX ((ssize_t)(SIZE_MAX>>1)) +# endif +# endif + +# ifdef DEBUG_UNUSED +# define __owur __attribute__((__warn_unused_result__)) +# else +# define __owur +# endif + +/* Standard integer types */ +# if defined(OPENSSL_SYS_UEFI) +typedef INT8 int8_t; +typedef UINT8 uint8_t; +typedef INT16 int16_t; +typedef UINT16 uint16_t; +typedef INT32 int32_t; +typedef UINT32 uint32_t; +typedef INT64 int64_t; +typedef UINT64 uint64_t; +# elif (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \ + defined(__osf__) || defined(__sgi) || defined(__hpux) || \ + defined(OPENSSL_SYS_VMS) || defined (__OpenBSD__) +# include +# elif defined(_MSC_VER) && _MSC_VER<=1500 +/* + * minimally required typdefs for systems not supporting inttypes.h or + * stdint.h: currently just older VC++ + */ +typedef signed char int8_t; +typedef unsigned char uint8_t; +typedef short int16_t; +typedef unsigned short uint16_t; +typedef int int32_t; +typedef unsigned int uint32_t; +typedef __int64 int64_t; +typedef unsigned __int64 uint64_t; +# else +# include +# endif + +/* ossl_inline: portable inline definition usable in public headers */ +# if !defined(inline) && !defined(__cplusplus) +# if defined(__STDC_VERSION__) && __STDC_VERSION__>=199901L + /* just use inline */ +# define ossl_inline inline +# elif defined(__GNUC__) && __GNUC__>=2 +# define ossl_inline __inline__ +# elif defined(_MSC_VER) + /* + * Visual Studio: inline is available in C++ only, however + * __inline is available for C, see + * http://msdn.microsoft.com/en-us/library/z8y1yy88.aspx + */ +# define ossl_inline __inline +# else +# define ossl_inline +# endif +# else +# define ossl_inline inline +# endif + +# if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L +# define ossl_noreturn _Noreturn +# elif defined(__GNUC__) && __GNUC__ >= 2 +# define ossl_noreturn __attribute__((noreturn)) +# else +# define ossl_noreturn +# endif + +/* ossl_unused: portable unused attribute for use in public headers */ +# if defined(__GNUC__) +# define ossl_unused __attribute__((unused)) +# else +# define ossl_unused +# endif + +#ifdef __cplusplus +} +#endif +#endif diff --git a/ONVIF/include/openssl/include/openssl/ebcdic.h b/ONVIF/include/openssl/include/openssl/ebcdic.h new file mode 100644 index 0000000..aa01285 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/ebcdic.h @@ -0,0 +1,33 @@ +/* + * Copyright 1999-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_EBCDIC_H +# define HEADER_EBCDIC_H + +# include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Avoid name clashes with other applications */ +# define os_toascii _openssl_os_toascii +# define os_toebcdic _openssl_os_toebcdic +# define ebcdic2ascii _openssl_ebcdic2ascii +# define ascii2ebcdic _openssl_ascii2ebcdic + +extern const unsigned char os_toascii[256]; +extern const unsigned char os_toebcdic[256]; +void *ebcdic2ascii(void *dest, const void *srce, size_t count); +void *ascii2ebcdic(void *dest, const void *srce, size_t count); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/ONVIF/include/openssl/include/openssl/ec.h b/ONVIF/include/openssl/include/openssl/ec.h new file mode 100644 index 0000000..5af9ebd --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/ec.h @@ -0,0 +1,1479 @@ +/* + * Copyright 2002-2019 The OpenSSL Project Authors. All Rights Reserved. + * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_EC_H +# define HEADER_EC_H + +# include + +# ifndef OPENSSL_NO_EC +# include +# include +# if OPENSSL_API_COMPAT < 0x10100000L +# include +# endif +# include +# ifdef __cplusplus +extern "C" { +# endif + +# ifndef OPENSSL_ECC_MAX_FIELD_BITS +# define OPENSSL_ECC_MAX_FIELD_BITS 661 +# endif + +/** Enum for the point conversion form as defined in X9.62 (ECDSA) + * for the encoding of a elliptic curve point (x,y) */ +typedef enum { + /** the point is encoded as z||x, where the octet z specifies + * which solution of the quadratic equation y is */ + POINT_CONVERSION_COMPRESSED = 2, + /** the point is encoded as z||x||y, where z is the octet 0x04 */ + POINT_CONVERSION_UNCOMPRESSED = 4, + /** the point is encoded as z||x||y, where the octet z specifies + * which solution of the quadratic equation y is */ + POINT_CONVERSION_HYBRID = 6 +} point_conversion_form_t; + +typedef struct ec_method_st EC_METHOD; +typedef struct ec_group_st EC_GROUP; +typedef struct ec_point_st EC_POINT; +typedef struct ecpk_parameters_st ECPKPARAMETERS; +typedef struct ec_parameters_st ECPARAMETERS; + +/********************************************************************/ +/* EC_METHODs for curves over GF(p) */ +/********************************************************************/ + +/** Returns the basic GFp ec methods which provides the basis for the + * optimized methods. + * \return EC_METHOD object + */ +const EC_METHOD *EC_GFp_simple_method(void); + +/** Returns GFp methods using montgomery multiplication. + * \return EC_METHOD object + */ +const EC_METHOD *EC_GFp_mont_method(void); + +/** Returns GFp methods using optimized methods for NIST recommended curves + * \return EC_METHOD object + */ +const EC_METHOD *EC_GFp_nist_method(void); + +# ifndef OPENSSL_NO_EC_NISTP_64_GCC_128 +/** Returns 64-bit optimized methods for nistp224 + * \return EC_METHOD object + */ +const EC_METHOD *EC_GFp_nistp224_method(void); + +/** Returns 64-bit optimized methods for nistp256 + * \return EC_METHOD object + */ +const EC_METHOD *EC_GFp_nistp256_method(void); + +/** Returns 64-bit optimized methods for nistp521 + * \return EC_METHOD object + */ +const EC_METHOD *EC_GFp_nistp521_method(void); +# endif + +# ifndef OPENSSL_NO_EC2M +/********************************************************************/ +/* EC_METHOD for curves over GF(2^m) */ +/********************************************************************/ + +/** Returns the basic GF2m ec method + * \return EC_METHOD object + */ +const EC_METHOD *EC_GF2m_simple_method(void); + +# endif + +/********************************************************************/ +/* EC_GROUP functions */ +/********************************************************************/ + +/** Creates a new EC_GROUP object + * \param meth EC_METHOD to use + * \return newly created EC_GROUP object or NULL in case of an error. + */ +EC_GROUP *EC_GROUP_new(const EC_METHOD *meth); + +/** Frees a EC_GROUP object + * \param group EC_GROUP object to be freed. + */ +void EC_GROUP_free(EC_GROUP *group); + +/** Clears and frees a EC_GROUP object + * \param group EC_GROUP object to be cleared and freed. + */ +void EC_GROUP_clear_free(EC_GROUP *group); + +/** Copies EC_GROUP objects. Note: both EC_GROUPs must use the same EC_METHOD. + * \param dst destination EC_GROUP object + * \param src source EC_GROUP object + * \return 1 on success and 0 if an error occurred. + */ +int EC_GROUP_copy(EC_GROUP *dst, const EC_GROUP *src); + +/** Creates a new EC_GROUP object and copies the copies the content + * form src to the newly created EC_KEY object + * \param src source EC_GROUP object + * \return newly created EC_GROUP object or NULL in case of an error. + */ +EC_GROUP *EC_GROUP_dup(const EC_GROUP *src); + +/** Returns the EC_METHOD of the EC_GROUP object. + * \param group EC_GROUP object + * \return EC_METHOD used in this EC_GROUP object. + */ +const EC_METHOD *EC_GROUP_method_of(const EC_GROUP *group); + +/** Returns the field type of the EC_METHOD. + * \param meth EC_METHOD object + * \return NID of the underlying field type OID. + */ +int EC_METHOD_get_field_type(const EC_METHOD *meth); + +/** Sets the generator and its order/cofactor of a EC_GROUP object. + * \param group EC_GROUP object + * \param generator EC_POINT object with the generator. + * \param order the order of the group generated by the generator. + * \param cofactor the index of the sub-group generated by the generator + * in the group of all points on the elliptic curve. + * \return 1 on success and 0 if an error occurred + */ +int EC_GROUP_set_generator(EC_GROUP *group, const EC_POINT *generator, + const BIGNUM *order, const BIGNUM *cofactor); + +/** Returns the generator of a EC_GROUP object. + * \param group EC_GROUP object + * \return the currently used generator (possibly NULL). + */ +const EC_POINT *EC_GROUP_get0_generator(const EC_GROUP *group); + +/** Returns the montgomery data for order(Generator) + * \param group EC_GROUP object + * \return the currently used montgomery data (possibly NULL). +*/ +BN_MONT_CTX *EC_GROUP_get_mont_data(const EC_GROUP *group); + +/** Gets the order of a EC_GROUP + * \param group EC_GROUP object + * \param order BIGNUM to which the order is copied + * \param ctx unused + * \return 1 on success and 0 if an error occurred + */ +int EC_GROUP_get_order(const EC_GROUP *group, BIGNUM *order, BN_CTX *ctx); + +/** Gets the order of an EC_GROUP + * \param group EC_GROUP object + * \return the group order + */ +const BIGNUM *EC_GROUP_get0_order(const EC_GROUP *group); + +/** Gets the number of bits of the order of an EC_GROUP + * \param group EC_GROUP object + * \return number of bits of group order. + */ +int EC_GROUP_order_bits(const EC_GROUP *group); + +/** Gets the cofactor of a EC_GROUP + * \param group EC_GROUP object + * \param cofactor BIGNUM to which the cofactor is copied + * \param ctx unused + * \return 1 on success and 0 if an error occurred + */ +int EC_GROUP_get_cofactor(const EC_GROUP *group, BIGNUM *cofactor, + BN_CTX *ctx); + +/** Gets the cofactor of an EC_GROUP + * \param group EC_GROUP object + * \return the group cofactor + */ +const BIGNUM *EC_GROUP_get0_cofactor(const EC_GROUP *group); + +/** Sets the name of a EC_GROUP object + * \param group EC_GROUP object + * \param nid NID of the curve name OID + */ +void EC_GROUP_set_curve_name(EC_GROUP *group, int nid); + +/** Returns the curve name of a EC_GROUP object + * \param group EC_GROUP object + * \return NID of the curve name OID or 0 if not set. + */ +int EC_GROUP_get_curve_name(const EC_GROUP *group); + +void EC_GROUP_set_asn1_flag(EC_GROUP *group, int flag); +int EC_GROUP_get_asn1_flag(const EC_GROUP *group); + +void EC_GROUP_set_point_conversion_form(EC_GROUP *group, + point_conversion_form_t form); +point_conversion_form_t EC_GROUP_get_point_conversion_form(const EC_GROUP *); + +unsigned char *EC_GROUP_get0_seed(const EC_GROUP *x); +size_t EC_GROUP_get_seed_len(const EC_GROUP *); +size_t EC_GROUP_set_seed(EC_GROUP *, const unsigned char *, size_t len); + +/** Sets the parameters of a ec curve defined by y^2 = x^3 + a*x + b (for GFp) + * or y^2 + x*y = x^3 + a*x^2 + b (for GF2m) + * \param group EC_GROUP object + * \param p BIGNUM with the prime number (GFp) or the polynomial + * defining the underlying field (GF2m) + * \param a BIGNUM with parameter a of the equation + * \param b BIGNUM with parameter b of the equation + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +int EC_GROUP_set_curve(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, + const BIGNUM *b, BN_CTX *ctx); + +/** Gets the parameters of the ec curve defined by y^2 = x^3 + a*x + b (for GFp) + * or y^2 + x*y = x^3 + a*x^2 + b (for GF2m) + * \param group EC_GROUP object + * \param p BIGNUM with the prime number (GFp) or the polynomial + * defining the underlying field (GF2m) + * \param a BIGNUM for parameter a of the equation + * \param b BIGNUM for parameter b of the equation + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +int EC_GROUP_get_curve(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b, + BN_CTX *ctx); + +/** Sets the parameters of an ec curve. Synonym for EC_GROUP_set_curve + * \param group EC_GROUP object + * \param p BIGNUM with the prime number (GFp) or the polynomial + * defining the underlying field (GF2m) + * \param a BIGNUM with parameter a of the equation + * \param b BIGNUM with parameter b of the equation + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +DEPRECATEDIN_1_2_0(int EC_GROUP_set_curve_GFp(EC_GROUP *group, const BIGNUM *p, + const BIGNUM *a, const BIGNUM *b, + BN_CTX *ctx)) + +/** Gets the parameters of an ec curve. Synonym for EC_GROUP_get_curve + * \param group EC_GROUP object + * \param p BIGNUM with the prime number (GFp) or the polynomial + * defining the underlying field (GF2m) + * \param a BIGNUM for parameter a of the equation + * \param b BIGNUM for parameter b of the equation + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +DEPRECATEDIN_1_2_0(int EC_GROUP_get_curve_GFp(const EC_GROUP *group, BIGNUM *p, + BIGNUM *a, BIGNUM *b, + BN_CTX *ctx)) + +# ifndef OPENSSL_NO_EC2M +/** Sets the parameter of an ec curve. Synonym for EC_GROUP_set_curve + * \param group EC_GROUP object + * \param p BIGNUM with the prime number (GFp) or the polynomial + * defining the underlying field (GF2m) + * \param a BIGNUM with parameter a of the equation + * \param b BIGNUM with parameter b of the equation + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +DEPRECATEDIN_1_2_0(int EC_GROUP_set_curve_GF2m(EC_GROUP *group, const BIGNUM *p, + const BIGNUM *a, const BIGNUM *b, + BN_CTX *ctx)) + +/** Gets the parameters of an ec curve. Synonym for EC_GROUP_get_curve + * \param group EC_GROUP object + * \param p BIGNUM with the prime number (GFp) or the polynomial + * defining the underlying field (GF2m) + * \param a BIGNUM for parameter a of the equation + * \param b BIGNUM for parameter b of the equation + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +DEPRECATEDIN_1_2_0(int EC_GROUP_get_curve_GF2m(const EC_GROUP *group, BIGNUM *p, + BIGNUM *a, BIGNUM *b, + BN_CTX *ctx)) +# endif +/** Returns the number of bits needed to represent a field element + * \param group EC_GROUP object + * \return number of bits needed to represent a field element + */ +int EC_GROUP_get_degree(const EC_GROUP *group); + +/** Checks whether the parameter in the EC_GROUP define a valid ec group + * \param group EC_GROUP object + * \param ctx BN_CTX object (optional) + * \return 1 if group is a valid ec group and 0 otherwise + */ +int EC_GROUP_check(const EC_GROUP *group, BN_CTX *ctx); + +/** Checks whether the discriminant of the elliptic curve is zero or not + * \param group EC_GROUP object + * \param ctx BN_CTX object (optional) + * \return 1 if the discriminant is not zero and 0 otherwise + */ +int EC_GROUP_check_discriminant(const EC_GROUP *group, BN_CTX *ctx); + +/** Compares two EC_GROUP objects + * \param a first EC_GROUP object + * \param b second EC_GROUP object + * \param ctx BN_CTX object (optional) + * \return 0 if the groups are equal, 1 if not, or -1 on error + */ +int EC_GROUP_cmp(const EC_GROUP *a, const EC_GROUP *b, BN_CTX *ctx); + +/* + * EC_GROUP_new_GF*() calls EC_GROUP_new() and EC_GROUP_set_GF*() after + * choosing an appropriate EC_METHOD + */ + +/** Creates a new EC_GROUP object with the specified parameters defined + * over GFp (defined by the equation y^2 = x^3 + a*x + b) + * \param p BIGNUM with the prime number + * \param a BIGNUM with the parameter a of the equation + * \param b BIGNUM with the parameter b of the equation + * \param ctx BN_CTX object (optional) + * \return newly created EC_GROUP object with the specified parameters + */ +EC_GROUP *EC_GROUP_new_curve_GFp(const BIGNUM *p, const BIGNUM *a, + const BIGNUM *b, BN_CTX *ctx); +# ifndef OPENSSL_NO_EC2M +/** Creates a new EC_GROUP object with the specified parameters defined + * over GF2m (defined by the equation y^2 + x*y = x^3 + a*x^2 + b) + * \param p BIGNUM with the polynomial defining the underlying field + * \param a BIGNUM with the parameter a of the equation + * \param b BIGNUM with the parameter b of the equation + * \param ctx BN_CTX object (optional) + * \return newly created EC_GROUP object with the specified parameters + */ +EC_GROUP *EC_GROUP_new_curve_GF2m(const BIGNUM *p, const BIGNUM *a, + const BIGNUM *b, BN_CTX *ctx); +# endif + +/** Creates a EC_GROUP object with a curve specified by a NID + * \param nid NID of the OID of the curve name + * \return newly created EC_GROUP object with specified curve or NULL + * if an error occurred + */ +EC_GROUP *EC_GROUP_new_by_curve_name(int nid); + +/** Creates a new EC_GROUP object from an ECPARAMETERS object + * \param params pointer to the ECPARAMETERS object + * \return newly created EC_GROUP object with specified curve or NULL + * if an error occurred + */ +EC_GROUP *EC_GROUP_new_from_ecparameters(const ECPARAMETERS *params); + +/** Creates an ECPARAMETERS object for the given EC_GROUP object. + * \param group pointer to the EC_GROUP object + * \param params pointer to an existing ECPARAMETERS object or NULL + * \return pointer to the new ECPARAMETERS object or NULL + * if an error occurred. + */ +ECPARAMETERS *EC_GROUP_get_ecparameters(const EC_GROUP *group, + ECPARAMETERS *params); + +/** Creates a new EC_GROUP object from an ECPKPARAMETERS object + * \param params pointer to an existing ECPKPARAMETERS object, or NULL + * \return newly created EC_GROUP object with specified curve, or NULL + * if an error occurred + */ +EC_GROUP *EC_GROUP_new_from_ecpkparameters(const ECPKPARAMETERS *params); + +/** Creates an ECPKPARAMETERS object for the given EC_GROUP object. + * \param group pointer to the EC_GROUP object + * \param params pointer to an existing ECPKPARAMETERS object or NULL + * \return pointer to the new ECPKPARAMETERS object or NULL + * if an error occurred. + */ +ECPKPARAMETERS *EC_GROUP_get_ecpkparameters(const EC_GROUP *group, + ECPKPARAMETERS *params); + +/********************************************************************/ +/* handling of internal curves */ +/********************************************************************/ + +typedef struct { + int nid; + const char *comment; +} EC_builtin_curve; + +/* + * EC_builtin_curves(EC_builtin_curve *r, size_t size) returns number of all + * available curves or zero if a error occurred. In case r is not zero, + * nitems EC_builtin_curve structures are filled with the data of the first + * nitems internal groups + */ +size_t EC_get_builtin_curves(EC_builtin_curve *r, size_t nitems); + +const char *EC_curve_nid2nist(int nid); +int EC_curve_nist2nid(const char *name); + +/********************************************************************/ +/* EC_POINT functions */ +/********************************************************************/ + +/** Creates a new EC_POINT object for the specified EC_GROUP + * \param group EC_GROUP the underlying EC_GROUP object + * \return newly created EC_POINT object or NULL if an error occurred + */ +EC_POINT *EC_POINT_new(const EC_GROUP *group); + +/** Frees a EC_POINT object + * \param point EC_POINT object to be freed + */ +void EC_POINT_free(EC_POINT *point); + +/** Clears and frees a EC_POINT object + * \param point EC_POINT object to be cleared and freed + */ +void EC_POINT_clear_free(EC_POINT *point); + +/** Copies EC_POINT object + * \param dst destination EC_POINT object + * \param src source EC_POINT object + * \return 1 on success and 0 if an error occurred + */ +int EC_POINT_copy(EC_POINT *dst, const EC_POINT *src); + +/** Creates a new EC_POINT object and copies the content of the supplied + * EC_POINT + * \param src source EC_POINT object + * \param group underlying the EC_GROUP object + * \return newly created EC_POINT object or NULL if an error occurred + */ +EC_POINT *EC_POINT_dup(const EC_POINT *src, const EC_GROUP *group); + +/** Returns the EC_METHOD used in EC_POINT object + * \param point EC_POINT object + * \return the EC_METHOD used + */ +const EC_METHOD *EC_POINT_method_of(const EC_POINT *point); + +/** Sets a point to infinity (neutral element) + * \param group underlying EC_GROUP object + * \param point EC_POINT to set to infinity + * \return 1 on success and 0 if an error occurred + */ +int EC_POINT_set_to_infinity(const EC_GROUP *group, EC_POINT *point); + +/** Sets the jacobian projective coordinates of a EC_POINT over GFp + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param x BIGNUM with the x-coordinate + * \param y BIGNUM with the y-coordinate + * \param z BIGNUM with the z-coordinate + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +int EC_POINT_set_Jprojective_coordinates_GFp(const EC_GROUP *group, + EC_POINT *p, const BIGNUM *x, + const BIGNUM *y, const BIGNUM *z, + BN_CTX *ctx); + +/** Gets the jacobian projective coordinates of a EC_POINT over GFp + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param x BIGNUM for the x-coordinate + * \param y BIGNUM for the y-coordinate + * \param z BIGNUM for the z-coordinate + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +int EC_POINT_get_Jprojective_coordinates_GFp(const EC_GROUP *group, + const EC_POINT *p, BIGNUM *x, + BIGNUM *y, BIGNUM *z, + BN_CTX *ctx); + +/** Sets the affine coordinates of an EC_POINT + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param x BIGNUM with the x-coordinate + * \param y BIGNUM with the y-coordinate + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +int EC_POINT_set_affine_coordinates(const EC_GROUP *group, EC_POINT *p, + const BIGNUM *x, const BIGNUM *y, + BN_CTX *ctx); + +/** Gets the affine coordinates of an EC_POINT. + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param x BIGNUM for the x-coordinate + * \param y BIGNUM for the y-coordinate + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +int EC_POINT_get_affine_coordinates(const EC_GROUP *group, const EC_POINT *p, + BIGNUM *x, BIGNUM *y, BN_CTX *ctx); + +/** Sets the affine coordinates of an EC_POINT. A synonym of + * EC_POINT_set_affine_coordinates + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param x BIGNUM with the x-coordinate + * \param y BIGNUM with the y-coordinate + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +DEPRECATEDIN_1_2_0(int EC_POINT_set_affine_coordinates_GFp(const EC_GROUP *group, + EC_POINT *p, + const BIGNUM *x, + const BIGNUM *y, + BN_CTX *ctx)) + +/** Gets the affine coordinates of an EC_POINT. A synonym of + * EC_POINT_get_affine_coordinates + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param x BIGNUM for the x-coordinate + * \param y BIGNUM for the y-coordinate + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +DEPRECATEDIN_1_2_0(int EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *group, + const EC_POINT *p, + BIGNUM *x, + BIGNUM *y, + BN_CTX *ctx)) + +/** Sets the x9.62 compressed coordinates of a EC_POINT + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param x BIGNUM with x-coordinate + * \param y_bit integer with the y-Bit (either 0 or 1) + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +int EC_POINT_set_compressed_coordinates(const EC_GROUP *group, EC_POINT *p, + const BIGNUM *x, int y_bit, + BN_CTX *ctx); + +/** Sets the x9.62 compressed coordinates of a EC_POINT. A synonym of + * EC_POINT_set_compressed_coordinates + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param x BIGNUM with x-coordinate + * \param y_bit integer with the y-Bit (either 0 or 1) + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +DEPRECATEDIN_1_2_0(int EC_POINT_set_compressed_coordinates_GFp(const EC_GROUP *group, + EC_POINT *p, + const BIGNUM *x, + int y_bit, + BN_CTX *ctx)) +# ifndef OPENSSL_NO_EC2M +/** Sets the affine coordinates of an EC_POINT. A synonym of + * EC_POINT_set_affine_coordinates + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param x BIGNUM with the x-coordinate + * \param y BIGNUM with the y-coordinate + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +DEPRECATEDIN_1_2_0(int EC_POINT_set_affine_coordinates_GF2m(const EC_GROUP *group, + EC_POINT *p, + const BIGNUM *x, + const BIGNUM *y, + BN_CTX *ctx)) + +/** Gets the affine coordinates of an EC_POINT. A synonym of + * EC_POINT_get_affine_coordinates + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param x BIGNUM for the x-coordinate + * \param y BIGNUM for the y-coordinate + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +DEPRECATEDIN_1_2_0(int EC_POINT_get_affine_coordinates_GF2m(const EC_GROUP *group, + const EC_POINT *p, + BIGNUM *x, + BIGNUM *y, + BN_CTX *ctx)) + +/** Sets the x9.62 compressed coordinates of a EC_POINT. A synonym of + * EC_POINT_set_compressed_coordinates + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param x BIGNUM with x-coordinate + * \param y_bit integer with the y-Bit (either 0 or 1) + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +DEPRECATEDIN_1_2_0(int EC_POINT_set_compressed_coordinates_GF2m(const EC_GROUP *group, + EC_POINT *p, + const BIGNUM *x, + int y_bit, + BN_CTX *ctx)) +# endif +/** Encodes a EC_POINT object to a octet string + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param form point conversion form + * \param buf memory buffer for the result. If NULL the function returns + * required buffer size. + * \param len length of the memory buffer + * \param ctx BN_CTX object (optional) + * \return the length of the encoded octet string or 0 if an error occurred + */ +size_t EC_POINT_point2oct(const EC_GROUP *group, const EC_POINT *p, + point_conversion_form_t form, + unsigned char *buf, size_t len, BN_CTX *ctx); + +/** Decodes a EC_POINT from a octet string + * \param group underlying EC_GROUP object + * \param p EC_POINT object + * \param buf memory buffer with the encoded ec point + * \param len length of the encoded ec point + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +int EC_POINT_oct2point(const EC_GROUP *group, EC_POINT *p, + const unsigned char *buf, size_t len, BN_CTX *ctx); + +/** Encodes an EC_POINT object to an allocated octet string + * \param group underlying EC_GROUP object + * \param point EC_POINT object + * \param form point conversion form + * \param pbuf returns pointer to allocated buffer + * \param ctx BN_CTX object (optional) + * \return the length of the encoded octet string or 0 if an error occurred + */ +size_t EC_POINT_point2buf(const EC_GROUP *group, const EC_POINT *point, + point_conversion_form_t form, + unsigned char **pbuf, BN_CTX *ctx); + +/* other interfaces to point2oct/oct2point: */ +BIGNUM *EC_POINT_point2bn(const EC_GROUP *, const EC_POINT *, + point_conversion_form_t form, BIGNUM *, BN_CTX *); +EC_POINT *EC_POINT_bn2point(const EC_GROUP *, const BIGNUM *, + EC_POINT *, BN_CTX *); +char *EC_POINT_point2hex(const EC_GROUP *, const EC_POINT *, + point_conversion_form_t form, BN_CTX *); +EC_POINT *EC_POINT_hex2point(const EC_GROUP *, const char *, + EC_POINT *, BN_CTX *); + +/********************************************************************/ +/* functions for doing EC_POINT arithmetic */ +/********************************************************************/ + +/** Computes the sum of two EC_POINT + * \param group underlying EC_GROUP object + * \param r EC_POINT object for the result (r = a + b) + * \param a EC_POINT object with the first summand + * \param b EC_POINT object with the second summand + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +int EC_POINT_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, + const EC_POINT *b, BN_CTX *ctx); + +/** Computes the double of a EC_POINT + * \param group underlying EC_GROUP object + * \param r EC_POINT object for the result (r = 2 * a) + * \param a EC_POINT object + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +int EC_POINT_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, + BN_CTX *ctx); + +/** Computes the inverse of a EC_POINT + * \param group underlying EC_GROUP object + * \param a EC_POINT object to be inverted (it's used for the result as well) + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +int EC_POINT_invert(const EC_GROUP *group, EC_POINT *a, BN_CTX *ctx); + +/** Checks whether the point is the neutral element of the group + * \param group the underlying EC_GROUP object + * \param p EC_POINT object + * \return 1 if the point is the neutral element and 0 otherwise + */ +int EC_POINT_is_at_infinity(const EC_GROUP *group, const EC_POINT *p); + +/** Checks whether the point is on the curve + * \param group underlying EC_GROUP object + * \param point EC_POINT object to check + * \param ctx BN_CTX object (optional) + * \return 1 if the point is on the curve, 0 if not, or -1 on error + */ +int EC_POINT_is_on_curve(const EC_GROUP *group, const EC_POINT *point, + BN_CTX *ctx); + +/** Compares two EC_POINTs + * \param group underlying EC_GROUP object + * \param a first EC_POINT object + * \param b second EC_POINT object + * \param ctx BN_CTX object (optional) + * \return 1 if the points are not equal, 0 if they are, or -1 on error + */ +int EC_POINT_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b, + BN_CTX *ctx); + +int EC_POINT_make_affine(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx); +int EC_POINTs_make_affine(const EC_GROUP *group, size_t num, + EC_POINT *points[], BN_CTX *ctx); + +/** Computes r = generator * n + sum_{i=0}^{num-1} p[i] * m[i] + * \param group underlying EC_GROUP object + * \param r EC_POINT object for the result + * \param n BIGNUM with the multiplier for the group generator (optional) + * \param num number further summands + * \param p array of size num of EC_POINT objects + * \param m array of size num of BIGNUM objects + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *n, + size_t num, const EC_POINT *p[], const BIGNUM *m[], + BN_CTX *ctx); + +/** Computes r = generator * n + q * m + * \param group underlying EC_GROUP object + * \param r EC_POINT object for the result + * \param n BIGNUM with the multiplier for the group generator (optional) + * \param q EC_POINT object with the first factor of the second summand + * \param m BIGNUM with the second factor of the second summand + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +int EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *n, + const EC_POINT *q, const BIGNUM *m, BN_CTX *ctx); + +/** Stores multiples of generator for faster point multiplication + * \param group EC_GROUP object + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ +int EC_GROUP_precompute_mult(EC_GROUP *group, BN_CTX *ctx); + +/** Reports whether a precomputation has been done + * \param group EC_GROUP object + * \return 1 if a pre-computation has been done and 0 otherwise + */ +int EC_GROUP_have_precompute_mult(const EC_GROUP *group); + +/********************************************************************/ +/* ASN1 stuff */ +/********************************************************************/ + +DECLARE_ASN1_ITEM(ECPKPARAMETERS) +DECLARE_ASN1_ALLOC_FUNCTIONS(ECPKPARAMETERS) +DECLARE_ASN1_ITEM(ECPARAMETERS) +DECLARE_ASN1_ALLOC_FUNCTIONS(ECPARAMETERS) + +/* + * EC_GROUP_get_basis_type() returns the NID of the basis type used to + * represent the field elements + */ +int EC_GROUP_get_basis_type(const EC_GROUP *); +# ifndef OPENSSL_NO_EC2M +int EC_GROUP_get_trinomial_basis(const EC_GROUP *, unsigned int *k); +int EC_GROUP_get_pentanomial_basis(const EC_GROUP *, unsigned int *k1, + unsigned int *k2, unsigned int *k3); +# endif + +# define OPENSSL_EC_EXPLICIT_CURVE 0x000 +# define OPENSSL_EC_NAMED_CURVE 0x001 + +EC_GROUP *d2i_ECPKParameters(EC_GROUP **, const unsigned char **in, long len); +int i2d_ECPKParameters(const EC_GROUP *, unsigned char **out); + +# define d2i_ECPKParameters_bio(bp,x) ASN1_d2i_bio_of(EC_GROUP,NULL,d2i_ECPKParameters,bp,x) +# define i2d_ECPKParameters_bio(bp,x) ASN1_i2d_bio_of_const(EC_GROUP,i2d_ECPKParameters,bp,x) +# define d2i_ECPKParameters_fp(fp,x) (EC_GROUP *)ASN1_d2i_fp(NULL, \ + (char *(*)())d2i_ECPKParameters,(fp),(unsigned char **)(x)) +# define i2d_ECPKParameters_fp(fp,x) ASN1_i2d_fp(i2d_ECPKParameters,(fp), \ + (unsigned char *)(x)) + +int ECPKParameters_print(BIO *bp, const EC_GROUP *x, int off); +# ifndef OPENSSL_NO_STDIO +int ECPKParameters_print_fp(FILE *fp, const EC_GROUP *x, int off); +# endif + +/********************************************************************/ +/* EC_KEY functions */ +/********************************************************************/ + +/* some values for the encoding_flag */ +# define EC_PKEY_NO_PARAMETERS 0x001 +# define EC_PKEY_NO_PUBKEY 0x002 + +/* some values for the flags field */ +# define EC_FLAG_NON_FIPS_ALLOW 0x1 +# define EC_FLAG_FIPS_CHECKED 0x2 +# define EC_FLAG_COFACTOR_ECDH 0x1000 + +/** Creates a new EC_KEY object. + * \return EC_KEY object or NULL if an error occurred. + */ +EC_KEY *EC_KEY_new(void); + +int EC_KEY_get_flags(const EC_KEY *key); + +void EC_KEY_set_flags(EC_KEY *key, int flags); + +void EC_KEY_clear_flags(EC_KEY *key, int flags); + +/** Creates a new EC_KEY object using a named curve as underlying + * EC_GROUP object. + * \param nid NID of the named curve. + * \return EC_KEY object or NULL if an error occurred. + */ +EC_KEY *EC_KEY_new_by_curve_name(int nid); + +/** Frees a EC_KEY object. + * \param key EC_KEY object to be freed. + */ +void EC_KEY_free(EC_KEY *key); + +/** Copies a EC_KEY object. + * \param dst destination EC_KEY object + * \param src src EC_KEY object + * \return dst or NULL if an error occurred. + */ +EC_KEY *EC_KEY_copy(EC_KEY *dst, const EC_KEY *src); + +/** Creates a new EC_KEY object and copies the content from src to it. + * \param src the source EC_KEY object + * \return newly created EC_KEY object or NULL if an error occurred. + */ +EC_KEY *EC_KEY_dup(const EC_KEY *src); + +/** Increases the internal reference count of a EC_KEY object. + * \param key EC_KEY object + * \return 1 on success and 0 if an error occurred. + */ +int EC_KEY_up_ref(EC_KEY *key); + +/** Returns the ENGINE object of a EC_KEY object + * \param eckey EC_KEY object + * \return the ENGINE object (possibly NULL). + */ +ENGINE *EC_KEY_get0_engine(const EC_KEY *eckey); + +/** Returns the EC_GROUP object of a EC_KEY object + * \param key EC_KEY object + * \return the EC_GROUP object (possibly NULL). + */ +const EC_GROUP *EC_KEY_get0_group(const EC_KEY *key); + +/** Sets the EC_GROUP of a EC_KEY object. + * \param key EC_KEY object + * \param group EC_GROUP to use in the EC_KEY object (note: the EC_KEY + * object will use an own copy of the EC_GROUP). + * \return 1 on success and 0 if an error occurred. + */ +int EC_KEY_set_group(EC_KEY *key, const EC_GROUP *group); + +/** Returns the private key of a EC_KEY object. + * \param key EC_KEY object + * \return a BIGNUM with the private key (possibly NULL). + */ +const BIGNUM *EC_KEY_get0_private_key(const EC_KEY *key); + +/** Sets the private key of a EC_KEY object. + * \param key EC_KEY object + * \param prv BIGNUM with the private key (note: the EC_KEY object + * will use an own copy of the BIGNUM). + * \return 1 on success and 0 if an error occurred. + */ +int EC_KEY_set_private_key(EC_KEY *key, const BIGNUM *prv); + +/** Returns the public key of a EC_KEY object. + * \param key the EC_KEY object + * \return a EC_POINT object with the public key (possibly NULL) + */ +const EC_POINT *EC_KEY_get0_public_key(const EC_KEY *key); + +/** Sets the public key of a EC_KEY object. + * \param key EC_KEY object + * \param pub EC_POINT object with the public key (note: the EC_KEY object + * will use an own copy of the EC_POINT object). + * \return 1 on success and 0 if an error occurred. + */ +int EC_KEY_set_public_key(EC_KEY *key, const EC_POINT *pub); + +unsigned EC_KEY_get_enc_flags(const EC_KEY *key); +void EC_KEY_set_enc_flags(EC_KEY *eckey, unsigned int flags); +point_conversion_form_t EC_KEY_get_conv_form(const EC_KEY *key); +void EC_KEY_set_conv_form(EC_KEY *eckey, point_conversion_form_t cform); + +#define EC_KEY_get_ex_new_index(l, p, newf, dupf, freef) \ + CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_EC_KEY, l, p, newf, dupf, freef) +int EC_KEY_set_ex_data(EC_KEY *key, int idx, void *arg); +void *EC_KEY_get_ex_data(const EC_KEY *key, int idx); + +/* wrapper functions for the underlying EC_GROUP object */ +void EC_KEY_set_asn1_flag(EC_KEY *eckey, int asn1_flag); + +/** Creates a table of pre-computed multiples of the generator to + * accelerate further EC_KEY operations. + * \param key EC_KEY object + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred. + */ +int EC_KEY_precompute_mult(EC_KEY *key, BN_CTX *ctx); + +/** Creates a new ec private (and optional a new public) key. + * \param key EC_KEY object + * \return 1 on success and 0 if an error occurred. + */ +int EC_KEY_generate_key(EC_KEY *key); + +/** Verifies that a private and/or public key is valid. + * \param key the EC_KEY object + * \return 1 on success and 0 otherwise. + */ +int EC_KEY_check_key(const EC_KEY *key); + +/** Indicates if an EC_KEY can be used for signing. + * \param eckey the EC_KEY object + * \return 1 if can can sign and 0 otherwise. + */ +int EC_KEY_can_sign(const EC_KEY *eckey); + +/** Sets a public key from affine coordinates performing + * necessary NIST PKV tests. + * \param key the EC_KEY object + * \param x public key x coordinate + * \param y public key y coordinate + * \return 1 on success and 0 otherwise. + */ +int EC_KEY_set_public_key_affine_coordinates(EC_KEY *key, BIGNUM *x, + BIGNUM *y); + +/** Encodes an EC_KEY public key to an allocated octet string + * \param key key to encode + * \param form point conversion form + * \param pbuf returns pointer to allocated buffer + * \param ctx BN_CTX object (optional) + * \return the length of the encoded octet string or 0 if an error occurred + */ +size_t EC_KEY_key2buf(const EC_KEY *key, point_conversion_form_t form, + unsigned char **pbuf, BN_CTX *ctx); + +/** Decodes a EC_KEY public key from a octet string + * \param key key to decode + * \param buf memory buffer with the encoded ec point + * \param len length of the encoded ec point + * \param ctx BN_CTX object (optional) + * \return 1 on success and 0 if an error occurred + */ + +int EC_KEY_oct2key(EC_KEY *key, const unsigned char *buf, size_t len, + BN_CTX *ctx); + +/** Decodes an EC_KEY private key from an octet string + * \param key key to decode + * \param buf memory buffer with the encoded private key + * \param len length of the encoded key + * \return 1 on success and 0 if an error occurred + */ + +int EC_KEY_oct2priv(EC_KEY *key, const unsigned char *buf, size_t len); + +/** Encodes a EC_KEY private key to an octet string + * \param key key to encode + * \param buf memory buffer for the result. If NULL the function returns + * required buffer size. + * \param len length of the memory buffer + * \return the length of the encoded octet string or 0 if an error occurred + */ + +size_t EC_KEY_priv2oct(const EC_KEY *key, unsigned char *buf, size_t len); + +/** Encodes an EC_KEY private key to an allocated octet string + * \param eckey key to encode + * \param pbuf returns pointer to allocated buffer + * \return the length of the encoded octet string or 0 if an error occurred + */ +size_t EC_KEY_priv2buf(const EC_KEY *eckey, unsigned char **pbuf); + +/********************************************************************/ +/* de- and encoding functions for SEC1 ECPrivateKey */ +/********************************************************************/ + +/** Decodes a private key from a memory buffer. + * \param key a pointer to a EC_KEY object which should be used (or NULL) + * \param in pointer to memory with the DER encoded private key + * \param len length of the DER encoded private key + * \return the decoded private key or NULL if an error occurred. + */ +EC_KEY *d2i_ECPrivateKey(EC_KEY **key, const unsigned char **in, long len); + +/** Encodes a private key object and stores the result in a buffer. + * \param key the EC_KEY object to encode + * \param out the buffer for the result (if NULL the function returns number + * of bytes needed). + * \return 1 on success and 0 if an error occurred. + */ +int i2d_ECPrivateKey(EC_KEY *key, unsigned char **out); + +/********************************************************************/ +/* de- and encoding functions for EC parameters */ +/********************************************************************/ + +/** Decodes ec parameter from a memory buffer. + * \param key a pointer to a EC_KEY object which should be used (or NULL) + * \param in pointer to memory with the DER encoded ec parameters + * \param len length of the DER encoded ec parameters + * \return a EC_KEY object with the decoded parameters or NULL if an error + * occurred. + */ +EC_KEY *d2i_ECParameters(EC_KEY **key, const unsigned char **in, long len); + +/** Encodes ec parameter and stores the result in a buffer. + * \param key the EC_KEY object with ec parameters to encode + * \param out the buffer for the result (if NULL the function returns number + * of bytes needed). + * \return 1 on success and 0 if an error occurred. + */ +int i2d_ECParameters(EC_KEY *key, unsigned char **out); + +/********************************************************************/ +/* de- and encoding functions for EC public key */ +/* (octet string, not DER -- hence 'o2i' and 'i2o') */ +/********************************************************************/ + +/** Decodes a ec public key from a octet string. + * \param key a pointer to a EC_KEY object which should be used + * \param in memory buffer with the encoded public key + * \param len length of the encoded public key + * \return EC_KEY object with decoded public key or NULL if an error + * occurred. + */ +EC_KEY *o2i_ECPublicKey(EC_KEY **key, const unsigned char **in, long len); + +/** Encodes a ec public key in an octet string. + * \param key the EC_KEY object with the public key + * \param out the buffer for the result (if NULL the function returns number + * of bytes needed). + * \return 1 on success and 0 if an error occurred + */ +int i2o_ECPublicKey(const EC_KEY *key, unsigned char **out); + +/** Prints out the ec parameters on human readable form. + * \param bp BIO object to which the information is printed + * \param key EC_KEY object + * \return 1 on success and 0 if an error occurred + */ +int ECParameters_print(BIO *bp, const EC_KEY *key); + +/** Prints out the contents of a EC_KEY object + * \param bp BIO object to which the information is printed + * \param key EC_KEY object + * \param off line offset + * \return 1 on success and 0 if an error occurred + */ +int EC_KEY_print(BIO *bp, const EC_KEY *key, int off); + +# ifndef OPENSSL_NO_STDIO +/** Prints out the ec parameters on human readable form. + * \param fp file descriptor to which the information is printed + * \param key EC_KEY object + * \return 1 on success and 0 if an error occurred + */ +int ECParameters_print_fp(FILE *fp, const EC_KEY *key); + +/** Prints out the contents of a EC_KEY object + * \param fp file descriptor to which the information is printed + * \param key EC_KEY object + * \param off line offset + * \return 1 on success and 0 if an error occurred + */ +int EC_KEY_print_fp(FILE *fp, const EC_KEY *key, int off); + +# endif + +const EC_KEY_METHOD *EC_KEY_OpenSSL(void); +const EC_KEY_METHOD *EC_KEY_get_default_method(void); +void EC_KEY_set_default_method(const EC_KEY_METHOD *meth); +const EC_KEY_METHOD *EC_KEY_get_method(const EC_KEY *key); +int EC_KEY_set_method(EC_KEY *key, const EC_KEY_METHOD *meth); +EC_KEY *EC_KEY_new_method(ENGINE *engine); + +/** The old name for ecdh_KDF_X9_63 + * The ECDH KDF specification has been mistakingly attributed to ANSI X9.62, + * it is actually specified in ANSI X9.63. + * This identifier is retained for backwards compatibility + */ +int ECDH_KDF_X9_62(unsigned char *out, size_t outlen, + const unsigned char *Z, size_t Zlen, + const unsigned char *sinfo, size_t sinfolen, + const EVP_MD *md); + +int ECDH_compute_key(void *out, size_t outlen, const EC_POINT *pub_key, + const EC_KEY *ecdh, + void *(*KDF) (const void *in, size_t inlen, + void *out, size_t *outlen)); + +typedef struct ECDSA_SIG_st ECDSA_SIG; + +/** Allocates and initialize a ECDSA_SIG structure + * \return pointer to a ECDSA_SIG structure or NULL if an error occurred + */ +ECDSA_SIG *ECDSA_SIG_new(void); + +/** frees a ECDSA_SIG structure + * \param sig pointer to the ECDSA_SIG structure + */ +void ECDSA_SIG_free(ECDSA_SIG *sig); + +/** DER encode content of ECDSA_SIG object (note: this function modifies *pp + * (*pp += length of the DER encoded signature)). + * \param sig pointer to the ECDSA_SIG object + * \param pp pointer to a unsigned char pointer for the output or NULL + * \return the length of the DER encoded ECDSA_SIG object or a negative value + * on error + */ +int i2d_ECDSA_SIG(const ECDSA_SIG *sig, unsigned char **pp); + +/** Decodes a DER encoded ECDSA signature (note: this function changes *pp + * (*pp += len)). + * \param sig pointer to ECDSA_SIG pointer (may be NULL) + * \param pp memory buffer with the DER encoded signature + * \param len length of the buffer + * \return pointer to the decoded ECDSA_SIG structure (or NULL) + */ +ECDSA_SIG *d2i_ECDSA_SIG(ECDSA_SIG **sig, const unsigned char **pp, long len); + +/** Accessor for r and s fields of ECDSA_SIG + * \param sig pointer to ECDSA_SIG structure + * \param pr pointer to BIGNUM pointer for r (may be NULL) + * \param ps pointer to BIGNUM pointer for s (may be NULL) + */ +void ECDSA_SIG_get0(const ECDSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps); + +/** Accessor for r field of ECDSA_SIG + * \param sig pointer to ECDSA_SIG structure + */ +const BIGNUM *ECDSA_SIG_get0_r(const ECDSA_SIG *sig); + +/** Accessor for s field of ECDSA_SIG + * \param sig pointer to ECDSA_SIG structure + */ +const BIGNUM *ECDSA_SIG_get0_s(const ECDSA_SIG *sig); + +/** Setter for r and s fields of ECDSA_SIG + * \param sig pointer to ECDSA_SIG structure + * \param r pointer to BIGNUM for r (may be NULL) + * \param s pointer to BIGNUM for s (may be NULL) + */ +int ECDSA_SIG_set0(ECDSA_SIG *sig, BIGNUM *r, BIGNUM *s); + +/** Computes the ECDSA signature of the given hash value using + * the supplied private key and returns the created signature. + * \param dgst pointer to the hash value + * \param dgst_len length of the hash value + * \param eckey EC_KEY object containing a private EC key + * \return pointer to a ECDSA_SIG structure or NULL if an error occurred + */ +ECDSA_SIG *ECDSA_do_sign(const unsigned char *dgst, int dgst_len, + EC_KEY *eckey); + +/** Computes ECDSA signature of a given hash value using the supplied + * private key (note: sig must point to ECDSA_size(eckey) bytes of memory). + * \param dgst pointer to the hash value to sign + * \param dgstlen length of the hash value + * \param kinv BIGNUM with a pre-computed inverse k (optional) + * \param rp BIGNUM with a pre-computed rp value (optional), + * see ECDSA_sign_setup + * \param eckey EC_KEY object containing a private EC key + * \return pointer to a ECDSA_SIG structure or NULL if an error occurred + */ +ECDSA_SIG *ECDSA_do_sign_ex(const unsigned char *dgst, int dgstlen, + const BIGNUM *kinv, const BIGNUM *rp, + EC_KEY *eckey); + +/** Verifies that the supplied signature is a valid ECDSA + * signature of the supplied hash value using the supplied public key. + * \param dgst pointer to the hash value + * \param dgst_len length of the hash value + * \param sig ECDSA_SIG structure + * \param eckey EC_KEY object containing a public EC key + * \return 1 if the signature is valid, 0 if the signature is invalid + * and -1 on error + */ +int ECDSA_do_verify(const unsigned char *dgst, int dgst_len, + const ECDSA_SIG *sig, EC_KEY *eckey); + +/** Precompute parts of the signing operation + * \param eckey EC_KEY object containing a private EC key + * \param ctx BN_CTX object (optional) + * \param kinv BIGNUM pointer for the inverse of k + * \param rp BIGNUM pointer for x coordinate of k * generator + * \return 1 on success and 0 otherwise + */ +int ECDSA_sign_setup(EC_KEY *eckey, BN_CTX *ctx, BIGNUM **kinv, BIGNUM **rp); + +/** Computes ECDSA signature of a given hash value using the supplied + * private key (note: sig must point to ECDSA_size(eckey) bytes of memory). + * \param type this parameter is ignored + * \param dgst pointer to the hash value to sign + * \param dgstlen length of the hash value + * \param sig memory for the DER encoded created signature + * \param siglen pointer to the length of the returned signature + * \param eckey EC_KEY object containing a private EC key + * \return 1 on success and 0 otherwise + */ +int ECDSA_sign(int type, const unsigned char *dgst, int dgstlen, + unsigned char *sig, unsigned int *siglen, EC_KEY *eckey); + +/** Computes ECDSA signature of a given hash value using the supplied + * private key (note: sig must point to ECDSA_size(eckey) bytes of memory). + * \param type this parameter is ignored + * \param dgst pointer to the hash value to sign + * \param dgstlen length of the hash value + * \param sig buffer to hold the DER encoded signature + * \param siglen pointer to the length of the returned signature + * \param kinv BIGNUM with a pre-computed inverse k (optional) + * \param rp BIGNUM with a pre-computed rp value (optional), + * see ECDSA_sign_setup + * \param eckey EC_KEY object containing a private EC key + * \return 1 on success and 0 otherwise + */ +int ECDSA_sign_ex(int type, const unsigned char *dgst, int dgstlen, + unsigned char *sig, unsigned int *siglen, + const BIGNUM *kinv, const BIGNUM *rp, EC_KEY *eckey); + +/** Verifies that the given signature is valid ECDSA signature + * of the supplied hash value using the specified public key. + * \param type this parameter is ignored + * \param dgst pointer to the hash value + * \param dgstlen length of the hash value + * \param sig pointer to the DER encoded signature + * \param siglen length of the DER encoded signature + * \param eckey EC_KEY object containing a public EC key + * \return 1 if the signature is valid, 0 if the signature is invalid + * and -1 on error + */ +int ECDSA_verify(int type, const unsigned char *dgst, int dgstlen, + const unsigned char *sig, int siglen, EC_KEY *eckey); + +/** Returns the maximum length of the DER encoded signature + * \param eckey EC_KEY object + * \return numbers of bytes required for the DER encoded signature + */ +int ECDSA_size(const EC_KEY *eckey); + +/********************************************************************/ +/* EC_KEY_METHOD constructors, destructors, writers and accessors */ +/********************************************************************/ + +EC_KEY_METHOD *EC_KEY_METHOD_new(const EC_KEY_METHOD *meth); +void EC_KEY_METHOD_free(EC_KEY_METHOD *meth); +void EC_KEY_METHOD_set_init(EC_KEY_METHOD *meth, + int (*init)(EC_KEY *key), + void (*finish)(EC_KEY *key), + int (*copy)(EC_KEY *dest, const EC_KEY *src), + int (*set_group)(EC_KEY *key, const EC_GROUP *grp), + int (*set_private)(EC_KEY *key, + const BIGNUM *priv_key), + int (*set_public)(EC_KEY *key, + const EC_POINT *pub_key)); + +void EC_KEY_METHOD_set_keygen(EC_KEY_METHOD *meth, + int (*keygen)(EC_KEY *key)); + +void EC_KEY_METHOD_set_compute_key(EC_KEY_METHOD *meth, + int (*ckey)(unsigned char **psec, + size_t *pseclen, + const EC_POINT *pub_key, + const EC_KEY *ecdh)); + +void EC_KEY_METHOD_set_sign(EC_KEY_METHOD *meth, + int (*sign)(int type, const unsigned char *dgst, + int dlen, unsigned char *sig, + unsigned int *siglen, + const BIGNUM *kinv, const BIGNUM *r, + EC_KEY *eckey), + int (*sign_setup)(EC_KEY *eckey, BN_CTX *ctx_in, + BIGNUM **kinvp, BIGNUM **rp), + ECDSA_SIG *(*sign_sig)(const unsigned char *dgst, + int dgst_len, + const BIGNUM *in_kinv, + const BIGNUM *in_r, + EC_KEY *eckey)); + +void EC_KEY_METHOD_set_verify(EC_KEY_METHOD *meth, + int (*verify)(int type, const unsigned + char *dgst, int dgst_len, + const unsigned char *sigbuf, + int sig_len, EC_KEY *eckey), + int (*verify_sig)(const unsigned char *dgst, + int dgst_len, + const ECDSA_SIG *sig, + EC_KEY *eckey)); + +void EC_KEY_METHOD_get_init(const EC_KEY_METHOD *meth, + int (**pinit)(EC_KEY *key), + void (**pfinish)(EC_KEY *key), + int (**pcopy)(EC_KEY *dest, const EC_KEY *src), + int (**pset_group)(EC_KEY *key, + const EC_GROUP *grp), + int (**pset_private)(EC_KEY *key, + const BIGNUM *priv_key), + int (**pset_public)(EC_KEY *key, + const EC_POINT *pub_key)); + +void EC_KEY_METHOD_get_keygen(const EC_KEY_METHOD *meth, + int (**pkeygen)(EC_KEY *key)); + +void EC_KEY_METHOD_get_compute_key(const EC_KEY_METHOD *meth, + int (**pck)(unsigned char **psec, + size_t *pseclen, + const EC_POINT *pub_key, + const EC_KEY *ecdh)); + +void EC_KEY_METHOD_get_sign(const EC_KEY_METHOD *meth, + int (**psign)(int type, const unsigned char *dgst, + int dlen, unsigned char *sig, + unsigned int *siglen, + const BIGNUM *kinv, const BIGNUM *r, + EC_KEY *eckey), + int (**psign_setup)(EC_KEY *eckey, BN_CTX *ctx_in, + BIGNUM **kinvp, BIGNUM **rp), + ECDSA_SIG *(**psign_sig)(const unsigned char *dgst, + int dgst_len, + const BIGNUM *in_kinv, + const BIGNUM *in_r, + EC_KEY *eckey)); + +void EC_KEY_METHOD_get_verify(const EC_KEY_METHOD *meth, + int (**pverify)(int type, const unsigned + char *dgst, int dgst_len, + const unsigned char *sigbuf, + int sig_len, EC_KEY *eckey), + int (**pverify_sig)(const unsigned char *dgst, + int dgst_len, + const ECDSA_SIG *sig, + EC_KEY *eckey)); + +# define ECParameters_dup(x) ASN1_dup_of(EC_KEY,i2d_ECParameters,d2i_ECParameters,x) + +# ifndef __cplusplus +# if defined(__SUNPRO_C) +# if __SUNPRO_C >= 0x520 +# pragma error_messages (default,E_ARRAY_OF_INCOMPLETE_NONAME,E_ARRAY_OF_INCOMPLETE) +# endif +# endif +# endif + +# define EVP_PKEY_CTX_set_ec_paramgen_curve_nid(ctx, nid) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ + EVP_PKEY_OP_PARAMGEN|EVP_PKEY_OP_KEYGEN, \ + EVP_PKEY_CTRL_EC_PARAMGEN_CURVE_NID, nid, NULL) + +# define EVP_PKEY_CTX_set_ec_param_enc(ctx, flag) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ + EVP_PKEY_OP_PARAMGEN|EVP_PKEY_OP_KEYGEN, \ + EVP_PKEY_CTRL_EC_PARAM_ENC, flag, NULL) + +# define EVP_PKEY_CTX_set_ecdh_cofactor_mode(ctx, flag) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_EC_ECDH_COFACTOR, flag, NULL) + +# define EVP_PKEY_CTX_get_ecdh_cofactor_mode(ctx) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_EC_ECDH_COFACTOR, -2, NULL) + +# define EVP_PKEY_CTX_set_ecdh_kdf_type(ctx, kdf) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_EC_KDF_TYPE, kdf, NULL) + +# define EVP_PKEY_CTX_get_ecdh_kdf_type(ctx) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_EC_KDF_TYPE, -2, NULL) + +# define EVP_PKEY_CTX_set_ecdh_kdf_md(ctx, md) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_EC_KDF_MD, 0, (void *)(md)) + +# define EVP_PKEY_CTX_get_ecdh_kdf_md(ctx, pmd) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_GET_EC_KDF_MD, 0, (void *)(pmd)) + +# define EVP_PKEY_CTX_set_ecdh_kdf_outlen(ctx, len) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_EC_KDF_OUTLEN, len, NULL) + +# define EVP_PKEY_CTX_get_ecdh_kdf_outlen(ctx, plen) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_GET_EC_KDF_OUTLEN, 0, \ + (void *)(plen)) + +# define EVP_PKEY_CTX_set0_ecdh_kdf_ukm(ctx, p, plen) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_EC_KDF_UKM, plen, (void *)(p)) + +# define EVP_PKEY_CTX_get0_ecdh_kdf_ukm(ctx, p) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, \ + EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_GET_EC_KDF_UKM, 0, (void *)(p)) + +/* SM2 will skip the operation check so no need to pass operation here */ +# define EVP_PKEY_CTX_set1_id(ctx, id, id_len) \ + EVP_PKEY_CTX_ctrl(ctx, -1, -1, \ + EVP_PKEY_CTRL_SET1_ID, (int)id_len, (void*)(id)) + +# define EVP_PKEY_CTX_get1_id(ctx, id) \ + EVP_PKEY_CTX_ctrl(ctx, -1, -1, \ + EVP_PKEY_CTRL_GET1_ID, 0, (void*)(id)) + +# define EVP_PKEY_CTX_get1_id_len(ctx, id_len) \ + EVP_PKEY_CTX_ctrl(ctx, -1, -1, \ + EVP_PKEY_CTRL_GET1_ID_LEN, 0, (void*)(id_len)) + +# define EVP_PKEY_CTRL_EC_PARAMGEN_CURVE_NID (EVP_PKEY_ALG_CTRL + 1) +# define EVP_PKEY_CTRL_EC_PARAM_ENC (EVP_PKEY_ALG_CTRL + 2) +# define EVP_PKEY_CTRL_EC_ECDH_COFACTOR (EVP_PKEY_ALG_CTRL + 3) +# define EVP_PKEY_CTRL_EC_KDF_TYPE (EVP_PKEY_ALG_CTRL + 4) +# define EVP_PKEY_CTRL_EC_KDF_MD (EVP_PKEY_ALG_CTRL + 5) +# define EVP_PKEY_CTRL_GET_EC_KDF_MD (EVP_PKEY_ALG_CTRL + 6) +# define EVP_PKEY_CTRL_EC_KDF_OUTLEN (EVP_PKEY_ALG_CTRL + 7) +# define EVP_PKEY_CTRL_GET_EC_KDF_OUTLEN (EVP_PKEY_ALG_CTRL + 8) +# define EVP_PKEY_CTRL_EC_KDF_UKM (EVP_PKEY_ALG_CTRL + 9) +# define EVP_PKEY_CTRL_GET_EC_KDF_UKM (EVP_PKEY_ALG_CTRL + 10) +# define EVP_PKEY_CTRL_SET1_ID (EVP_PKEY_ALG_CTRL + 11) +# define EVP_PKEY_CTRL_GET1_ID (EVP_PKEY_ALG_CTRL + 12) +# define EVP_PKEY_CTRL_GET1_ID_LEN (EVP_PKEY_ALG_CTRL + 13) +/* KDF types */ +# define EVP_PKEY_ECDH_KDF_NONE 1 +# define EVP_PKEY_ECDH_KDF_X9_63 2 +/** The old name for EVP_PKEY_ECDH_KDF_X9_63 + * The ECDH KDF specification has been mistakingly attributed to ANSI X9.62, + * it is actually specified in ANSI X9.63. + * This identifier is retained for backwards compatibility + */ +# define EVP_PKEY_ECDH_KDF_X9_62 EVP_PKEY_ECDH_KDF_X9_63 + + +# ifdef __cplusplus +} +# endif +# endif +#endif diff --git a/ONVIF/include/openssl/include/openssl/ecdh.h b/ONVIF/include/openssl/include/openssl/ecdh.h new file mode 100644 index 0000000..681f3d5 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/ecdh.h @@ -0,0 +1,10 @@ +/* + * Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#include diff --git a/ONVIF/include/openssl/include/openssl/ecdsa.h b/ONVIF/include/openssl/include/openssl/ecdsa.h new file mode 100644 index 0000000..681f3d5 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/ecdsa.h @@ -0,0 +1,10 @@ +/* + * Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#include diff --git a/ONVIF/include/openssl/include/openssl/ecerr.h b/ONVIF/include/openssl/include/openssl/ecerr.h new file mode 100644 index 0000000..f7b9183 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/ecerr.h @@ -0,0 +1,275 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_ECERR_H +# define HEADER_ECERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# include + +# ifndef OPENSSL_NO_EC + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_EC_strings(void); + +/* + * EC function codes. + */ +# define EC_F_BN_TO_FELEM 224 +# define EC_F_D2I_ECPARAMETERS 144 +# define EC_F_D2I_ECPKPARAMETERS 145 +# define EC_F_D2I_ECPRIVATEKEY 146 +# define EC_F_DO_EC_KEY_PRINT 221 +# define EC_F_ECDH_CMS_DECRYPT 238 +# define EC_F_ECDH_CMS_SET_SHARED_INFO 239 +# define EC_F_ECDH_COMPUTE_KEY 246 +# define EC_F_ECDH_SIMPLE_COMPUTE_KEY 257 +# define EC_F_ECDSA_DO_SIGN_EX 251 +# define EC_F_ECDSA_DO_VERIFY 252 +# define EC_F_ECDSA_SIGN_EX 254 +# define EC_F_ECDSA_SIGN_SETUP 248 +# define EC_F_ECDSA_SIG_NEW 265 +# define EC_F_ECDSA_VERIFY 253 +# define EC_F_ECD_ITEM_VERIFY 270 +# define EC_F_ECKEY_PARAM2TYPE 223 +# define EC_F_ECKEY_PARAM_DECODE 212 +# define EC_F_ECKEY_PRIV_DECODE 213 +# define EC_F_ECKEY_PRIV_ENCODE 214 +# define EC_F_ECKEY_PUB_DECODE 215 +# define EC_F_ECKEY_PUB_ENCODE 216 +# define EC_F_ECKEY_TYPE2PARAM 220 +# define EC_F_ECPARAMETERS_PRINT 147 +# define EC_F_ECPARAMETERS_PRINT_FP 148 +# define EC_F_ECPKPARAMETERS_PRINT 149 +# define EC_F_ECPKPARAMETERS_PRINT_FP 150 +# define EC_F_ECP_NISTZ256_GET_AFFINE 240 +# define EC_F_ECP_NISTZ256_INV_MOD_ORD 275 +# define EC_F_ECP_NISTZ256_MULT_PRECOMPUTE 243 +# define EC_F_ECP_NISTZ256_POINTS_MUL 241 +# define EC_F_ECP_NISTZ256_PRE_COMP_NEW 244 +# define EC_F_ECP_NISTZ256_WINDOWED_MUL 242 +# define EC_F_ECX_KEY_OP 266 +# define EC_F_ECX_PRIV_ENCODE 267 +# define EC_F_ECX_PUB_ENCODE 268 +# define EC_F_EC_ASN1_GROUP2CURVE 153 +# define EC_F_EC_ASN1_GROUP2FIELDID 154 +# define EC_F_EC_GF2M_MONTGOMERY_POINT_MULTIPLY 208 +# define EC_F_EC_GF2M_SIMPLE_FIELD_INV 296 +# define EC_F_EC_GF2M_SIMPLE_GROUP_CHECK_DISCRIMINANT 159 +# define EC_F_EC_GF2M_SIMPLE_GROUP_SET_CURVE 195 +# define EC_F_EC_GF2M_SIMPLE_LADDER_POST 285 +# define EC_F_EC_GF2M_SIMPLE_LADDER_PRE 288 +# define EC_F_EC_GF2M_SIMPLE_OCT2POINT 160 +# define EC_F_EC_GF2M_SIMPLE_POINT2OCT 161 +# define EC_F_EC_GF2M_SIMPLE_POINTS_MUL 289 +# define EC_F_EC_GF2M_SIMPLE_POINT_GET_AFFINE_COORDINATES 162 +# define EC_F_EC_GF2M_SIMPLE_POINT_SET_AFFINE_COORDINATES 163 +# define EC_F_EC_GF2M_SIMPLE_SET_COMPRESSED_COORDINATES 164 +# define EC_F_EC_GFP_MONT_FIELD_DECODE 133 +# define EC_F_EC_GFP_MONT_FIELD_ENCODE 134 +# define EC_F_EC_GFP_MONT_FIELD_INV 297 +# define EC_F_EC_GFP_MONT_FIELD_MUL 131 +# define EC_F_EC_GFP_MONT_FIELD_SET_TO_ONE 209 +# define EC_F_EC_GFP_MONT_FIELD_SQR 132 +# define EC_F_EC_GFP_MONT_GROUP_SET_CURVE 189 +# define EC_F_EC_GFP_NISTP224_GROUP_SET_CURVE 225 +# define EC_F_EC_GFP_NISTP224_POINTS_MUL 228 +# define EC_F_EC_GFP_NISTP224_POINT_GET_AFFINE_COORDINATES 226 +# define EC_F_EC_GFP_NISTP256_GROUP_SET_CURVE 230 +# define EC_F_EC_GFP_NISTP256_POINTS_MUL 231 +# define EC_F_EC_GFP_NISTP256_POINT_GET_AFFINE_COORDINATES 232 +# define EC_F_EC_GFP_NISTP521_GROUP_SET_CURVE 233 +# define EC_F_EC_GFP_NISTP521_POINTS_MUL 234 +# define EC_F_EC_GFP_NISTP521_POINT_GET_AFFINE_COORDINATES 235 +# define EC_F_EC_GFP_NIST_FIELD_MUL 200 +# define EC_F_EC_GFP_NIST_FIELD_SQR 201 +# define EC_F_EC_GFP_NIST_GROUP_SET_CURVE 202 +# define EC_F_EC_GFP_SIMPLE_BLIND_COORDINATES 287 +# define EC_F_EC_GFP_SIMPLE_FIELD_INV 298 +# define EC_F_EC_GFP_SIMPLE_GROUP_CHECK_DISCRIMINANT 165 +# define EC_F_EC_GFP_SIMPLE_GROUP_SET_CURVE 166 +# define EC_F_EC_GFP_SIMPLE_MAKE_AFFINE 102 +# define EC_F_EC_GFP_SIMPLE_OCT2POINT 103 +# define EC_F_EC_GFP_SIMPLE_POINT2OCT 104 +# define EC_F_EC_GFP_SIMPLE_POINTS_MAKE_AFFINE 137 +# define EC_F_EC_GFP_SIMPLE_POINT_GET_AFFINE_COORDINATES 167 +# define EC_F_EC_GFP_SIMPLE_POINT_SET_AFFINE_COORDINATES 168 +# define EC_F_EC_GFP_SIMPLE_SET_COMPRESSED_COORDINATES 169 +# define EC_F_EC_GROUP_CHECK 170 +# define EC_F_EC_GROUP_CHECK_DISCRIMINANT 171 +# define EC_F_EC_GROUP_COPY 106 +# define EC_F_EC_GROUP_GET_CURVE 291 +# define EC_F_EC_GROUP_GET_CURVE_GF2M 172 +# define EC_F_EC_GROUP_GET_CURVE_GFP 130 +# define EC_F_EC_GROUP_GET_DEGREE 173 +# define EC_F_EC_GROUP_GET_ECPARAMETERS 261 +# define EC_F_EC_GROUP_GET_ECPKPARAMETERS 262 +# define EC_F_EC_GROUP_GET_PENTANOMIAL_BASIS 193 +# define EC_F_EC_GROUP_GET_TRINOMIAL_BASIS 194 +# define EC_F_EC_GROUP_NEW 108 +# define EC_F_EC_GROUP_NEW_BY_CURVE_NAME 174 +# define EC_F_EC_GROUP_NEW_FROM_DATA 175 +# define EC_F_EC_GROUP_NEW_FROM_ECPARAMETERS 263 +# define EC_F_EC_GROUP_NEW_FROM_ECPKPARAMETERS 264 +# define EC_F_EC_GROUP_SET_CURVE 292 +# define EC_F_EC_GROUP_SET_CURVE_GF2M 176 +# define EC_F_EC_GROUP_SET_CURVE_GFP 109 +# define EC_F_EC_GROUP_SET_GENERATOR 111 +# define EC_F_EC_GROUP_SET_SEED 286 +# define EC_F_EC_KEY_CHECK_KEY 177 +# define EC_F_EC_KEY_COPY 178 +# define EC_F_EC_KEY_GENERATE_KEY 179 +# define EC_F_EC_KEY_NEW 182 +# define EC_F_EC_KEY_NEW_METHOD 245 +# define EC_F_EC_KEY_OCT2PRIV 255 +# define EC_F_EC_KEY_PRINT 180 +# define EC_F_EC_KEY_PRINT_FP 181 +# define EC_F_EC_KEY_PRIV2BUF 279 +# define EC_F_EC_KEY_PRIV2OCT 256 +# define EC_F_EC_KEY_SET_PUBLIC_KEY_AFFINE_COORDINATES 229 +# define EC_F_EC_KEY_SIMPLE_CHECK_KEY 258 +# define EC_F_EC_KEY_SIMPLE_OCT2PRIV 259 +# define EC_F_EC_KEY_SIMPLE_PRIV2OCT 260 +# define EC_F_EC_PKEY_CHECK 273 +# define EC_F_EC_PKEY_PARAM_CHECK 274 +# define EC_F_EC_POINTS_MAKE_AFFINE 136 +# define EC_F_EC_POINTS_MUL 290 +# define EC_F_EC_POINT_ADD 112 +# define EC_F_EC_POINT_BN2POINT 280 +# define EC_F_EC_POINT_CMP 113 +# define EC_F_EC_POINT_COPY 114 +# define EC_F_EC_POINT_DBL 115 +# define EC_F_EC_POINT_GET_AFFINE_COORDINATES 293 +# define EC_F_EC_POINT_GET_AFFINE_COORDINATES_GF2M 183 +# define EC_F_EC_POINT_GET_AFFINE_COORDINATES_GFP 116 +# define EC_F_EC_POINT_GET_JPROJECTIVE_COORDINATES_GFP 117 +# define EC_F_EC_POINT_INVERT 210 +# define EC_F_EC_POINT_IS_AT_INFINITY 118 +# define EC_F_EC_POINT_IS_ON_CURVE 119 +# define EC_F_EC_POINT_MAKE_AFFINE 120 +# define EC_F_EC_POINT_NEW 121 +# define EC_F_EC_POINT_OCT2POINT 122 +# define EC_F_EC_POINT_POINT2BUF 281 +# define EC_F_EC_POINT_POINT2OCT 123 +# define EC_F_EC_POINT_SET_AFFINE_COORDINATES 294 +# define EC_F_EC_POINT_SET_AFFINE_COORDINATES_GF2M 185 +# define EC_F_EC_POINT_SET_AFFINE_COORDINATES_GFP 124 +# define EC_F_EC_POINT_SET_COMPRESSED_COORDINATES 295 +# define EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GF2M 186 +# define EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GFP 125 +# define EC_F_EC_POINT_SET_JPROJECTIVE_COORDINATES_GFP 126 +# define EC_F_EC_POINT_SET_TO_INFINITY 127 +# define EC_F_EC_PRE_COMP_NEW 196 +# define EC_F_EC_SCALAR_MUL_LADDER 284 +# define EC_F_EC_WNAF_MUL 187 +# define EC_F_EC_WNAF_PRECOMPUTE_MULT 188 +# define EC_F_I2D_ECPARAMETERS 190 +# define EC_F_I2D_ECPKPARAMETERS 191 +# define EC_F_I2D_ECPRIVATEKEY 192 +# define EC_F_I2O_ECPUBLICKEY 151 +# define EC_F_NISTP224_PRE_COMP_NEW 227 +# define EC_F_NISTP256_PRE_COMP_NEW 236 +# define EC_F_NISTP521_PRE_COMP_NEW 237 +# define EC_F_O2I_ECPUBLICKEY 152 +# define EC_F_OLD_EC_PRIV_DECODE 222 +# define EC_F_OSSL_ECDH_COMPUTE_KEY 247 +# define EC_F_OSSL_ECDSA_SIGN_SIG 249 +# define EC_F_OSSL_ECDSA_VERIFY_SIG 250 +# define EC_F_PKEY_ECD_CTRL 271 +# define EC_F_PKEY_ECD_DIGESTSIGN 272 +# define EC_F_PKEY_ECD_DIGESTSIGN25519 276 +# define EC_F_PKEY_ECD_DIGESTSIGN448 277 +# define EC_F_PKEY_ECX_DERIVE 269 +# define EC_F_PKEY_EC_CTRL 197 +# define EC_F_PKEY_EC_CTRL_STR 198 +# define EC_F_PKEY_EC_DERIVE 217 +# define EC_F_PKEY_EC_INIT 282 +# define EC_F_PKEY_EC_KDF_DERIVE 283 +# define EC_F_PKEY_EC_KEYGEN 199 +# define EC_F_PKEY_EC_PARAMGEN 219 +# define EC_F_PKEY_EC_SIGN 218 +# define EC_F_VALIDATE_ECX_DERIVE 278 + +/* + * EC reason codes. + */ +# define EC_R_ASN1_ERROR 115 +# define EC_R_BAD_SIGNATURE 156 +# define EC_R_BIGNUM_OUT_OF_RANGE 144 +# define EC_R_BUFFER_TOO_SMALL 100 +# define EC_R_CANNOT_INVERT 165 +# define EC_R_COORDINATES_OUT_OF_RANGE 146 +# define EC_R_CURVE_DOES_NOT_SUPPORT_ECDH 160 +# define EC_R_CURVE_DOES_NOT_SUPPORT_SIGNING 159 +# define EC_R_D2I_ECPKPARAMETERS_FAILURE 117 +# define EC_R_DECODE_ERROR 142 +# define EC_R_DISCRIMINANT_IS_ZERO 118 +# define EC_R_EC_GROUP_NEW_BY_NAME_FAILURE 119 +# define EC_R_FIELD_TOO_LARGE 143 +# define EC_R_GF2M_NOT_SUPPORTED 147 +# define EC_R_GROUP2PKPARAMETERS_FAILURE 120 +# define EC_R_I2D_ECPKPARAMETERS_FAILURE 121 +# define EC_R_INCOMPATIBLE_OBJECTS 101 +# define EC_R_INVALID_ARGUMENT 112 +# define EC_R_INVALID_COMPRESSED_POINT 110 +# define EC_R_INVALID_COMPRESSION_BIT 109 +# define EC_R_INVALID_CURVE 141 +# define EC_R_INVALID_DIGEST 151 +# define EC_R_INVALID_DIGEST_TYPE 138 +# define EC_R_INVALID_ENCODING 102 +# define EC_R_INVALID_FIELD 103 +# define EC_R_INVALID_FORM 104 +# define EC_R_INVALID_GROUP_ORDER 122 +# define EC_R_INVALID_KEY 116 +# define EC_R_INVALID_OUTPUT_LENGTH 161 +# define EC_R_INVALID_PEER_KEY 133 +# define EC_R_INVALID_PENTANOMIAL_BASIS 132 +# define EC_R_INVALID_PRIVATE_KEY 123 +# define EC_R_INVALID_TRINOMIAL_BASIS 137 +# define EC_R_KDF_PARAMETER_ERROR 148 +# define EC_R_KEYS_NOT_SET 140 +# define EC_R_LADDER_POST_FAILURE 136 +# define EC_R_LADDER_PRE_FAILURE 153 +# define EC_R_LADDER_STEP_FAILURE 162 +# define EC_R_MISSING_PARAMETERS 124 +# define EC_R_MISSING_PRIVATE_KEY 125 +# define EC_R_NEED_NEW_SETUP_VALUES 157 +# define EC_R_NOT_A_NIST_PRIME 135 +# define EC_R_NOT_IMPLEMENTED 126 +# define EC_R_NOT_INITIALIZED 111 +# define EC_R_NO_PARAMETERS_SET 139 +# define EC_R_NO_PRIVATE_VALUE 154 +# define EC_R_OPERATION_NOT_SUPPORTED 152 +# define EC_R_PASSED_NULL_PARAMETER 134 +# define EC_R_PEER_KEY_ERROR 149 +# define EC_R_PKPARAMETERS2GROUP_FAILURE 127 +# define EC_R_POINT_ARITHMETIC_FAILURE 155 +# define EC_R_POINT_AT_INFINITY 106 +# define EC_R_POINT_COORDINATES_BLIND_FAILURE 163 +# define EC_R_POINT_IS_NOT_ON_CURVE 107 +# define EC_R_RANDOM_NUMBER_GENERATION_FAILED 158 +# define EC_R_SHARED_INFO_ERROR 150 +# define EC_R_SLOT_FULL 108 +# define EC_R_UNDEFINED_GENERATOR 113 +# define EC_R_UNDEFINED_ORDER 128 +# define EC_R_UNKNOWN_COFACTOR 164 +# define EC_R_UNKNOWN_GROUP 129 +# define EC_R_UNKNOWN_ORDER 114 +# define EC_R_UNSUPPORTED_FIELD 131 +# define EC_R_WRONG_CURVE_PARAMETERS 145 +# define EC_R_WRONG_ORDER 130 + +# endif +#endif diff --git a/ONVIF/include/openssl/include/openssl/engine.h b/ONVIF/include/openssl/include/openssl/engine.h new file mode 100644 index 0000000..0780f0f --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/engine.h @@ -0,0 +1,751 @@ +/* + * Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved. + * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_ENGINE_H +# define HEADER_ENGINE_H + +# include + +# ifndef OPENSSL_NO_ENGINE +# if OPENSSL_API_COMPAT < 0x10100000L +# include +# include +# include +# include +# include +# include +# include +# include +# endif +# include +# include +# include +# include +# ifdef __cplusplus +extern "C" { +# endif + +/* + * These flags are used to control combinations of algorithm (methods) by + * bitwise "OR"ing. + */ +# define ENGINE_METHOD_RSA (unsigned int)0x0001 +# define ENGINE_METHOD_DSA (unsigned int)0x0002 +# define ENGINE_METHOD_DH (unsigned int)0x0004 +# define ENGINE_METHOD_RAND (unsigned int)0x0008 +# define ENGINE_METHOD_CIPHERS (unsigned int)0x0040 +# define ENGINE_METHOD_DIGESTS (unsigned int)0x0080 +# define ENGINE_METHOD_PKEY_METHS (unsigned int)0x0200 +# define ENGINE_METHOD_PKEY_ASN1_METHS (unsigned int)0x0400 +# define ENGINE_METHOD_EC (unsigned int)0x0800 +/* Obvious all-or-nothing cases. */ +# define ENGINE_METHOD_ALL (unsigned int)0xFFFF +# define ENGINE_METHOD_NONE (unsigned int)0x0000 + +/* + * This(ese) flag(s) controls behaviour of the ENGINE_TABLE mechanism used + * internally to control registration of ENGINE implementations, and can be + * set by ENGINE_set_table_flags(). The "NOINIT" flag prevents attempts to + * initialise registered ENGINEs if they are not already initialised. + */ +# define ENGINE_TABLE_FLAG_NOINIT (unsigned int)0x0001 + +/* ENGINE flags that can be set by ENGINE_set_flags(). */ +/* Not used */ +/* #define ENGINE_FLAGS_MALLOCED 0x0001 */ + +/* + * This flag is for ENGINEs that wish to handle the various 'CMD'-related + * control commands on their own. Without this flag, ENGINE_ctrl() handles + * these control commands on behalf of the ENGINE using their "cmd_defns" + * data. + */ +# define ENGINE_FLAGS_MANUAL_CMD_CTRL (int)0x0002 + +/* + * This flag is for ENGINEs who return new duplicate structures when found + * via "ENGINE_by_id()". When an ENGINE must store state (eg. if + * ENGINE_ctrl() commands are called in sequence as part of some stateful + * process like key-generation setup and execution), it can set this flag - + * then each attempt to obtain the ENGINE will result in it being copied into + * a new structure. Normally, ENGINEs don't declare this flag so + * ENGINE_by_id() just increments the existing ENGINE's structural reference + * count. + */ +# define ENGINE_FLAGS_BY_ID_COPY (int)0x0004 + +/* + * This flag if for an ENGINE that does not want its methods registered as + * part of ENGINE_register_all_complete() for example if the methods are not + * usable as default methods. + */ + +# define ENGINE_FLAGS_NO_REGISTER_ALL (int)0x0008 + +/* + * ENGINEs can support their own command types, and these flags are used in + * ENGINE_CTRL_GET_CMD_FLAGS to indicate to the caller what kind of input + * each command expects. Currently only numeric and string input is + * supported. If a control command supports none of the _NUMERIC, _STRING, or + * _NO_INPUT options, then it is regarded as an "internal" control command - + * and not for use in config setting situations. As such, they're not + * available to the ENGINE_ctrl_cmd_string() function, only raw ENGINE_ctrl() + * access. Changes to this list of 'command types' should be reflected + * carefully in ENGINE_cmd_is_executable() and ENGINE_ctrl_cmd_string(). + */ + +/* accepts a 'long' input value (3rd parameter to ENGINE_ctrl) */ +# define ENGINE_CMD_FLAG_NUMERIC (unsigned int)0x0001 +/* + * accepts string input (cast from 'void*' to 'const char *', 4th parameter + * to ENGINE_ctrl) + */ +# define ENGINE_CMD_FLAG_STRING (unsigned int)0x0002 +/* + * Indicates that the control command takes *no* input. Ie. the control + * command is unparameterised. + */ +# define ENGINE_CMD_FLAG_NO_INPUT (unsigned int)0x0004 +/* + * Indicates that the control command is internal. This control command won't + * be shown in any output, and is only usable through the ENGINE_ctrl_cmd() + * function. + */ +# define ENGINE_CMD_FLAG_INTERNAL (unsigned int)0x0008 + +/* + * NB: These 3 control commands are deprecated and should not be used. + * ENGINEs relying on these commands should compile conditional support for + * compatibility (eg. if these symbols are defined) but should also migrate + * the same functionality to their own ENGINE-specific control functions that + * can be "discovered" by calling applications. The fact these control + * commands wouldn't be "executable" (ie. usable by text-based config) + * doesn't change the fact that application code can find and use them + * without requiring per-ENGINE hacking. + */ + +/* + * These flags are used to tell the ctrl function what should be done. All + * command numbers are shared between all engines, even if some don't make + * sense to some engines. In such a case, they do nothing but return the + * error ENGINE_R_CTRL_COMMAND_NOT_IMPLEMENTED. + */ +# define ENGINE_CTRL_SET_LOGSTREAM 1 +# define ENGINE_CTRL_SET_PASSWORD_CALLBACK 2 +# define ENGINE_CTRL_HUP 3/* Close and reinitialise + * any handles/connections + * etc. */ +# define ENGINE_CTRL_SET_USER_INTERFACE 4/* Alternative to callback */ +# define ENGINE_CTRL_SET_CALLBACK_DATA 5/* User-specific data, used + * when calling the password + * callback and the user + * interface */ +# define ENGINE_CTRL_LOAD_CONFIGURATION 6/* Load a configuration, + * given a string that + * represents a file name + * or so */ +# define ENGINE_CTRL_LOAD_SECTION 7/* Load data from a given + * section in the already + * loaded configuration */ + +/* + * These control commands allow an application to deal with an arbitrary + * engine in a dynamic way. Warn: Negative return values indicate errors FOR + * THESE COMMANDS because zero is used to indicate 'end-of-list'. Other + * commands, including ENGINE-specific command types, return zero for an + * error. An ENGINE can choose to implement these ctrl functions, and can + * internally manage things however it chooses - it does so by setting the + * ENGINE_FLAGS_MANUAL_CMD_CTRL flag (using ENGINE_set_flags()). Otherwise + * the ENGINE_ctrl() code handles this on the ENGINE's behalf using the + * cmd_defns data (set using ENGINE_set_cmd_defns()). This means an ENGINE's + * ctrl() handler need only implement its own commands - the above "meta" + * commands will be taken care of. + */ + +/* + * Returns non-zero if the supplied ENGINE has a ctrl() handler. If "not", + * then all the remaining control commands will return failure, so it is + * worth checking this first if the caller is trying to "discover" the + * engine's capabilities and doesn't want errors generated unnecessarily. + */ +# define ENGINE_CTRL_HAS_CTRL_FUNCTION 10 +/* + * Returns a positive command number for the first command supported by the + * engine. Returns zero if no ctrl commands are supported. + */ +# define ENGINE_CTRL_GET_FIRST_CMD_TYPE 11 +/* + * The 'long' argument specifies a command implemented by the engine, and the + * return value is the next command supported, or zero if there are no more. + */ +# define ENGINE_CTRL_GET_NEXT_CMD_TYPE 12 +/* + * The 'void*' argument is a command name (cast from 'const char *'), and the + * return value is the command that corresponds to it. + */ +# define ENGINE_CTRL_GET_CMD_FROM_NAME 13 +/* + * The next two allow a command to be converted into its corresponding string + * form. In each case, the 'long' argument supplies the command. In the + * NAME_LEN case, the return value is the length of the command name (not + * counting a trailing EOL). In the NAME case, the 'void*' argument must be a + * string buffer large enough, and it will be populated with the name of the + * command (WITH a trailing EOL). + */ +# define ENGINE_CTRL_GET_NAME_LEN_FROM_CMD 14 +# define ENGINE_CTRL_GET_NAME_FROM_CMD 15 +/* The next two are similar but give a "short description" of a command. */ +# define ENGINE_CTRL_GET_DESC_LEN_FROM_CMD 16 +# define ENGINE_CTRL_GET_DESC_FROM_CMD 17 +/* + * With this command, the return value is the OR'd combination of + * ENGINE_CMD_FLAG_*** values that indicate what kind of input a given + * engine-specific ctrl command expects. + */ +# define ENGINE_CTRL_GET_CMD_FLAGS 18 + +/* + * ENGINE implementations should start the numbering of their own control + * commands from this value. (ie. ENGINE_CMD_BASE, ENGINE_CMD_BASE + 1, etc). + */ +# define ENGINE_CMD_BASE 200 + +/* + * NB: These 2 nCipher "chil" control commands are deprecated, and their + * functionality is now available through ENGINE-specific control commands + * (exposed through the above-mentioned 'CMD'-handling). Code using these 2 + * commands should be migrated to the more general command handling before + * these are removed. + */ + +/* Flags specific to the nCipher "chil" engine */ +# define ENGINE_CTRL_CHIL_SET_FORKCHECK 100 + /* + * Depending on the value of the (long)i argument, this sets or + * unsets the SimpleForkCheck flag in the CHIL API to enable or + * disable checking and workarounds for applications that fork(). + */ +# define ENGINE_CTRL_CHIL_NO_LOCKING 101 + /* + * This prevents the initialisation function from providing mutex + * callbacks to the nCipher library. + */ + +/* + * If an ENGINE supports its own specific control commands and wishes the + * framework to handle the above 'ENGINE_CMD_***'-manipulation commands on + * its behalf, it should supply a null-terminated array of ENGINE_CMD_DEFN + * entries to ENGINE_set_cmd_defns(). It should also implement a ctrl() + * handler that supports the stated commands (ie. the "cmd_num" entries as + * described by the array). NB: The array must be ordered in increasing order + * of cmd_num. "null-terminated" means that the last ENGINE_CMD_DEFN element + * has cmd_num set to zero and/or cmd_name set to NULL. + */ +typedef struct ENGINE_CMD_DEFN_st { + unsigned int cmd_num; /* The command number */ + const char *cmd_name; /* The command name itself */ + const char *cmd_desc; /* A short description of the command */ + unsigned int cmd_flags; /* The input the command expects */ +} ENGINE_CMD_DEFN; + +/* Generic function pointer */ +typedef int (*ENGINE_GEN_FUNC_PTR) (void); +/* Generic function pointer taking no arguments */ +typedef int (*ENGINE_GEN_INT_FUNC_PTR) (ENGINE *); +/* Specific control function pointer */ +typedef int (*ENGINE_CTRL_FUNC_PTR) (ENGINE *, int, long, void *, + void (*f) (void)); +/* Generic load_key function pointer */ +typedef EVP_PKEY *(*ENGINE_LOAD_KEY_PTR)(ENGINE *, const char *, + UI_METHOD *ui_method, + void *callback_data); +typedef int (*ENGINE_SSL_CLIENT_CERT_PTR) (ENGINE *, SSL *ssl, + STACK_OF(X509_NAME) *ca_dn, + X509 **pcert, EVP_PKEY **pkey, + STACK_OF(X509) **pother, + UI_METHOD *ui_method, + void *callback_data); +/*- + * These callback types are for an ENGINE's handler for cipher and digest logic. + * These handlers have these prototypes; + * int foo(ENGINE *e, const EVP_CIPHER **cipher, const int **nids, int nid); + * int foo(ENGINE *e, const EVP_MD **digest, const int **nids, int nid); + * Looking at how to implement these handlers in the case of cipher support, if + * the framework wants the EVP_CIPHER for 'nid', it will call; + * foo(e, &p_evp_cipher, NULL, nid); (return zero for failure) + * If the framework wants a list of supported 'nid's, it will call; + * foo(e, NULL, &p_nids, 0); (returns number of 'nids' or -1 for error) + */ +/* + * Returns to a pointer to the array of supported cipher 'nid's. If the + * second parameter is non-NULL it is set to the size of the returned array. + */ +typedef int (*ENGINE_CIPHERS_PTR) (ENGINE *, const EVP_CIPHER **, + const int **, int); +typedef int (*ENGINE_DIGESTS_PTR) (ENGINE *, const EVP_MD **, const int **, + int); +typedef int (*ENGINE_PKEY_METHS_PTR) (ENGINE *, EVP_PKEY_METHOD **, + const int **, int); +typedef int (*ENGINE_PKEY_ASN1_METHS_PTR) (ENGINE *, EVP_PKEY_ASN1_METHOD **, + const int **, int); +/* + * STRUCTURE functions ... all of these functions deal with pointers to + * ENGINE structures where the pointers have a "structural reference". This + * means that their reference is to allowed access to the structure but it + * does not imply that the structure is functional. To simply increment or + * decrement the structural reference count, use ENGINE_by_id and + * ENGINE_free. NB: This is not required when iterating using ENGINE_get_next + * as it will automatically decrement the structural reference count of the + * "current" ENGINE and increment the structural reference count of the + * ENGINE it returns (unless it is NULL). + */ + +/* Get the first/last "ENGINE" type available. */ +ENGINE *ENGINE_get_first(void); +ENGINE *ENGINE_get_last(void); +/* Iterate to the next/previous "ENGINE" type (NULL = end of the list). */ +ENGINE *ENGINE_get_next(ENGINE *e); +ENGINE *ENGINE_get_prev(ENGINE *e); +/* Add another "ENGINE" type into the array. */ +int ENGINE_add(ENGINE *e); +/* Remove an existing "ENGINE" type from the array. */ +int ENGINE_remove(ENGINE *e); +/* Retrieve an engine from the list by its unique "id" value. */ +ENGINE *ENGINE_by_id(const char *id); + +#if OPENSSL_API_COMPAT < 0x10100000L +# define ENGINE_load_openssl() \ + OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_OPENSSL, NULL) +# define ENGINE_load_dynamic() \ + OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_DYNAMIC, NULL) +# ifndef OPENSSL_NO_STATIC_ENGINE +# define ENGINE_load_padlock() \ + OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_PADLOCK, NULL) +# define ENGINE_load_capi() \ + OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_CAPI, NULL) +# define ENGINE_load_afalg() \ + OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_AFALG, NULL) +# endif +# define ENGINE_load_cryptodev() \ + OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_CRYPTODEV, NULL) +# define ENGINE_load_rdrand() \ + OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_RDRAND, NULL) +#endif +void ENGINE_load_builtin_engines(void); + +/* + * Get and set global flags (ENGINE_TABLE_FLAG_***) for the implementation + * "registry" handling. + */ +unsigned int ENGINE_get_table_flags(void); +void ENGINE_set_table_flags(unsigned int flags); + +/*- Manage registration of ENGINEs per "table". For each type, there are 3 + * functions; + * ENGINE_register_***(e) - registers the implementation from 'e' (if it has one) + * ENGINE_unregister_***(e) - unregister the implementation from 'e' + * ENGINE_register_all_***() - call ENGINE_register_***() for each 'e' in the list + * Cleanup is automatically registered from each table when required. + */ + +int ENGINE_register_RSA(ENGINE *e); +void ENGINE_unregister_RSA(ENGINE *e); +void ENGINE_register_all_RSA(void); + +int ENGINE_register_DSA(ENGINE *e); +void ENGINE_unregister_DSA(ENGINE *e); +void ENGINE_register_all_DSA(void); + +int ENGINE_register_EC(ENGINE *e); +void ENGINE_unregister_EC(ENGINE *e); +void ENGINE_register_all_EC(void); + +int ENGINE_register_DH(ENGINE *e); +void ENGINE_unregister_DH(ENGINE *e); +void ENGINE_register_all_DH(void); + +int ENGINE_register_RAND(ENGINE *e); +void ENGINE_unregister_RAND(ENGINE *e); +void ENGINE_register_all_RAND(void); + +int ENGINE_register_ciphers(ENGINE *e); +void ENGINE_unregister_ciphers(ENGINE *e); +void ENGINE_register_all_ciphers(void); + +int ENGINE_register_digests(ENGINE *e); +void ENGINE_unregister_digests(ENGINE *e); +void ENGINE_register_all_digests(void); + +int ENGINE_register_pkey_meths(ENGINE *e); +void ENGINE_unregister_pkey_meths(ENGINE *e); +void ENGINE_register_all_pkey_meths(void); + +int ENGINE_register_pkey_asn1_meths(ENGINE *e); +void ENGINE_unregister_pkey_asn1_meths(ENGINE *e); +void ENGINE_register_all_pkey_asn1_meths(void); + +/* + * These functions register all support from the above categories. Note, use + * of these functions can result in static linkage of code your application + * may not need. If you only need a subset of functionality, consider using + * more selective initialisation. + */ +int ENGINE_register_complete(ENGINE *e); +int ENGINE_register_all_complete(void); + +/* + * Send parameterised control commands to the engine. The possibilities to + * send down an integer, a pointer to data or a function pointer are + * provided. Any of the parameters may or may not be NULL, depending on the + * command number. In actuality, this function only requires a structural + * (rather than functional) reference to an engine, but many control commands + * may require the engine be functional. The caller should be aware of trying + * commands that require an operational ENGINE, and only use functional + * references in such situations. + */ +int ENGINE_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f) (void)); + +/* + * This function tests if an ENGINE-specific command is usable as a + * "setting". Eg. in an application's config file that gets processed through + * ENGINE_ctrl_cmd_string(). If this returns zero, it is not available to + * ENGINE_ctrl_cmd_string(), only ENGINE_ctrl(). + */ +int ENGINE_cmd_is_executable(ENGINE *e, int cmd); + +/* + * This function works like ENGINE_ctrl() with the exception of taking a + * command name instead of a command number, and can handle optional + * commands. See the comment on ENGINE_ctrl_cmd_string() for an explanation + * on how to use the cmd_name and cmd_optional. + */ +int ENGINE_ctrl_cmd(ENGINE *e, const char *cmd_name, + long i, void *p, void (*f) (void), int cmd_optional); + +/* + * This function passes a command-name and argument to an ENGINE. The + * cmd_name is converted to a command number and the control command is + * called using 'arg' as an argument (unless the ENGINE doesn't support such + * a command, in which case no control command is called). The command is + * checked for input flags, and if necessary the argument will be converted + * to a numeric value. If cmd_optional is non-zero, then if the ENGINE + * doesn't support the given cmd_name the return value will be success + * anyway. This function is intended for applications to use so that users + * (or config files) can supply engine-specific config data to the ENGINE at + * run-time to control behaviour of specific engines. As such, it shouldn't + * be used for calling ENGINE_ctrl() functions that return data, deal with + * binary data, or that are otherwise supposed to be used directly through + * ENGINE_ctrl() in application code. Any "return" data from an ENGINE_ctrl() + * operation in this function will be lost - the return value is interpreted + * as failure if the return value is zero, success otherwise, and this + * function returns a boolean value as a result. In other words, vendors of + * 'ENGINE'-enabled devices should write ENGINE implementations with + * parameterisations that work in this scheme, so that compliant ENGINE-based + * applications can work consistently with the same configuration for the + * same ENGINE-enabled devices, across applications. + */ +int ENGINE_ctrl_cmd_string(ENGINE *e, const char *cmd_name, const char *arg, + int cmd_optional); + +/* + * These functions are useful for manufacturing new ENGINE structures. They + * don't address reference counting at all - one uses them to populate an + * ENGINE structure with personalised implementations of things prior to + * using it directly or adding it to the builtin ENGINE list in OpenSSL. + * These are also here so that the ENGINE structure doesn't have to be + * exposed and break binary compatibility! + */ +ENGINE *ENGINE_new(void); +int ENGINE_free(ENGINE *e); +int ENGINE_up_ref(ENGINE *e); +int ENGINE_set_id(ENGINE *e, const char *id); +int ENGINE_set_name(ENGINE *e, const char *name); +int ENGINE_set_RSA(ENGINE *e, const RSA_METHOD *rsa_meth); +int ENGINE_set_DSA(ENGINE *e, const DSA_METHOD *dsa_meth); +int ENGINE_set_EC(ENGINE *e, const EC_KEY_METHOD *ecdsa_meth); +int ENGINE_set_DH(ENGINE *e, const DH_METHOD *dh_meth); +int ENGINE_set_RAND(ENGINE *e, const RAND_METHOD *rand_meth); +int ENGINE_set_destroy_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR destroy_f); +int ENGINE_set_init_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR init_f); +int ENGINE_set_finish_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR finish_f); +int ENGINE_set_ctrl_function(ENGINE *e, ENGINE_CTRL_FUNC_PTR ctrl_f); +int ENGINE_set_load_privkey_function(ENGINE *e, + ENGINE_LOAD_KEY_PTR loadpriv_f); +int ENGINE_set_load_pubkey_function(ENGINE *e, ENGINE_LOAD_KEY_PTR loadpub_f); +int ENGINE_set_load_ssl_client_cert_function(ENGINE *e, + ENGINE_SSL_CLIENT_CERT_PTR + loadssl_f); +int ENGINE_set_ciphers(ENGINE *e, ENGINE_CIPHERS_PTR f); +int ENGINE_set_digests(ENGINE *e, ENGINE_DIGESTS_PTR f); +int ENGINE_set_pkey_meths(ENGINE *e, ENGINE_PKEY_METHS_PTR f); +int ENGINE_set_pkey_asn1_meths(ENGINE *e, ENGINE_PKEY_ASN1_METHS_PTR f); +int ENGINE_set_flags(ENGINE *e, int flags); +int ENGINE_set_cmd_defns(ENGINE *e, const ENGINE_CMD_DEFN *defns); +/* These functions allow control over any per-structure ENGINE data. */ +#define ENGINE_get_ex_new_index(l, p, newf, dupf, freef) \ + CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_ENGINE, l, p, newf, dupf, freef) +int ENGINE_set_ex_data(ENGINE *e, int idx, void *arg); +void *ENGINE_get_ex_data(const ENGINE *e, int idx); + +#if OPENSSL_API_COMPAT < 0x10100000L +/* + * This function previously cleaned up anything that needs it. Auto-deinit will + * now take care of it so it is no longer required to call this function. + */ +# define ENGINE_cleanup() while(0) continue +#endif + +/* + * These return values from within the ENGINE structure. These can be useful + * with functional references as well as structural references - it depends + * which you obtained. Using the result for functional purposes if you only + * obtained a structural reference may be problematic! + */ +const char *ENGINE_get_id(const ENGINE *e); +const char *ENGINE_get_name(const ENGINE *e); +const RSA_METHOD *ENGINE_get_RSA(const ENGINE *e); +const DSA_METHOD *ENGINE_get_DSA(const ENGINE *e); +const EC_KEY_METHOD *ENGINE_get_EC(const ENGINE *e); +const DH_METHOD *ENGINE_get_DH(const ENGINE *e); +const RAND_METHOD *ENGINE_get_RAND(const ENGINE *e); +ENGINE_GEN_INT_FUNC_PTR ENGINE_get_destroy_function(const ENGINE *e); +ENGINE_GEN_INT_FUNC_PTR ENGINE_get_init_function(const ENGINE *e); +ENGINE_GEN_INT_FUNC_PTR ENGINE_get_finish_function(const ENGINE *e); +ENGINE_CTRL_FUNC_PTR ENGINE_get_ctrl_function(const ENGINE *e); +ENGINE_LOAD_KEY_PTR ENGINE_get_load_privkey_function(const ENGINE *e); +ENGINE_LOAD_KEY_PTR ENGINE_get_load_pubkey_function(const ENGINE *e); +ENGINE_SSL_CLIENT_CERT_PTR ENGINE_get_ssl_client_cert_function(const ENGINE + *e); +ENGINE_CIPHERS_PTR ENGINE_get_ciphers(const ENGINE *e); +ENGINE_DIGESTS_PTR ENGINE_get_digests(const ENGINE *e); +ENGINE_PKEY_METHS_PTR ENGINE_get_pkey_meths(const ENGINE *e); +ENGINE_PKEY_ASN1_METHS_PTR ENGINE_get_pkey_asn1_meths(const ENGINE *e); +const EVP_CIPHER *ENGINE_get_cipher(ENGINE *e, int nid); +const EVP_MD *ENGINE_get_digest(ENGINE *e, int nid); +const EVP_PKEY_METHOD *ENGINE_get_pkey_meth(ENGINE *e, int nid); +const EVP_PKEY_ASN1_METHOD *ENGINE_get_pkey_asn1_meth(ENGINE *e, int nid); +const EVP_PKEY_ASN1_METHOD *ENGINE_get_pkey_asn1_meth_str(ENGINE *e, + const char *str, + int len); +const EVP_PKEY_ASN1_METHOD *ENGINE_pkey_asn1_find_str(ENGINE **pe, + const char *str, + int len); +const ENGINE_CMD_DEFN *ENGINE_get_cmd_defns(const ENGINE *e); +int ENGINE_get_flags(const ENGINE *e); + +/* + * FUNCTIONAL functions. These functions deal with ENGINE structures that + * have (or will) be initialised for use. Broadly speaking, the structural + * functions are useful for iterating the list of available engine types, + * creating new engine types, and other "list" operations. These functions + * actually deal with ENGINEs that are to be used. As such these functions + * can fail (if applicable) when particular engines are unavailable - eg. if + * a hardware accelerator is not attached or not functioning correctly. Each + * ENGINE has 2 reference counts; structural and functional. Every time a + * functional reference is obtained or released, a corresponding structural + * reference is automatically obtained or released too. + */ + +/* + * Initialise a engine type for use (or up its reference count if it's + * already in use). This will fail if the engine is not currently operational + * and cannot initialise. + */ +int ENGINE_init(ENGINE *e); +/* + * Free a functional reference to a engine type. This does not require a + * corresponding call to ENGINE_free as it also releases a structural + * reference. + */ +int ENGINE_finish(ENGINE *e); + +/* + * The following functions handle keys that are stored in some secondary + * location, handled by the engine. The storage may be on a card or + * whatever. + */ +EVP_PKEY *ENGINE_load_private_key(ENGINE *e, const char *key_id, + UI_METHOD *ui_method, void *callback_data); +EVP_PKEY *ENGINE_load_public_key(ENGINE *e, const char *key_id, + UI_METHOD *ui_method, void *callback_data); +int ENGINE_load_ssl_client_cert(ENGINE *e, SSL *s, + STACK_OF(X509_NAME) *ca_dn, X509 **pcert, + EVP_PKEY **ppkey, STACK_OF(X509) **pother, + UI_METHOD *ui_method, void *callback_data); + +/* + * This returns a pointer for the current ENGINE structure that is (by + * default) performing any RSA operations. The value returned is an + * incremented reference, so it should be free'd (ENGINE_finish) before it is + * discarded. + */ +ENGINE *ENGINE_get_default_RSA(void); +/* Same for the other "methods" */ +ENGINE *ENGINE_get_default_DSA(void); +ENGINE *ENGINE_get_default_EC(void); +ENGINE *ENGINE_get_default_DH(void); +ENGINE *ENGINE_get_default_RAND(void); +/* + * These functions can be used to get a functional reference to perform + * ciphering or digesting corresponding to "nid". + */ +ENGINE *ENGINE_get_cipher_engine(int nid); +ENGINE *ENGINE_get_digest_engine(int nid); +ENGINE *ENGINE_get_pkey_meth_engine(int nid); +ENGINE *ENGINE_get_pkey_asn1_meth_engine(int nid); + +/* + * This sets a new default ENGINE structure for performing RSA operations. If + * the result is non-zero (success) then the ENGINE structure will have had + * its reference count up'd so the caller should still free their own + * reference 'e'. + */ +int ENGINE_set_default_RSA(ENGINE *e); +int ENGINE_set_default_string(ENGINE *e, const char *def_list); +/* Same for the other "methods" */ +int ENGINE_set_default_DSA(ENGINE *e); +int ENGINE_set_default_EC(ENGINE *e); +int ENGINE_set_default_DH(ENGINE *e); +int ENGINE_set_default_RAND(ENGINE *e); +int ENGINE_set_default_ciphers(ENGINE *e); +int ENGINE_set_default_digests(ENGINE *e); +int ENGINE_set_default_pkey_meths(ENGINE *e); +int ENGINE_set_default_pkey_asn1_meths(ENGINE *e); + +/* + * The combination "set" - the flags are bitwise "OR"d from the + * ENGINE_METHOD_*** defines above. As with the "ENGINE_register_complete()" + * function, this function can result in unnecessary static linkage. If your + * application requires only specific functionality, consider using more + * selective functions. + */ +int ENGINE_set_default(ENGINE *e, unsigned int flags); + +void ENGINE_add_conf_module(void); + +/* Deprecated functions ... */ +/* int ENGINE_clear_defaults(void); */ + +/**************************/ +/* DYNAMIC ENGINE SUPPORT */ +/**************************/ + +/* Binary/behaviour compatibility levels */ +# define OSSL_DYNAMIC_VERSION (unsigned long)0x00030000 +/* + * Binary versions older than this are too old for us (whether we're a loader + * or a loadee) + */ +# define OSSL_DYNAMIC_OLDEST (unsigned long)0x00030000 + +/* + * When compiling an ENGINE entirely as an external shared library, loadable + * by the "dynamic" ENGINE, these types are needed. The 'dynamic_fns' + * structure type provides the calling application's (or library's) error + * functionality and memory management function pointers to the loaded + * library. These should be used/set in the loaded library code so that the + * loading application's 'state' will be used/changed in all operations. The + * 'static_state' pointer allows the loaded library to know if it shares the + * same static data as the calling application (or library), and thus whether + * these callbacks need to be set or not. + */ +typedef void *(*dyn_MEM_malloc_fn) (size_t, const char *, int); +typedef void *(*dyn_MEM_realloc_fn) (void *, size_t, const char *, int); +typedef void (*dyn_MEM_free_fn) (void *, const char *, int); +typedef struct st_dynamic_MEM_fns { + dyn_MEM_malloc_fn malloc_fn; + dyn_MEM_realloc_fn realloc_fn; + dyn_MEM_free_fn free_fn; +} dynamic_MEM_fns; +/* + * FIXME: Perhaps the memory and locking code (crypto.h) should declare and + * use these types so we (and any other dependent code) can simplify a bit?? + */ +/* The top-level structure */ +typedef struct st_dynamic_fns { + void *static_state; + dynamic_MEM_fns mem_fns; +} dynamic_fns; + +/* + * The version checking function should be of this prototype. NB: The + * ossl_version value passed in is the OSSL_DYNAMIC_VERSION of the loading + * code. If this function returns zero, it indicates a (potential) version + * incompatibility and the loaded library doesn't believe it can proceed. + * Otherwise, the returned value is the (latest) version supported by the + * loading library. The loader may still decide that the loaded code's + * version is unsatisfactory and could veto the load. The function is + * expected to be implemented with the symbol name "v_check", and a default + * implementation can be fully instantiated with + * IMPLEMENT_DYNAMIC_CHECK_FN(). + */ +typedef unsigned long (*dynamic_v_check_fn) (unsigned long ossl_version); +# define IMPLEMENT_DYNAMIC_CHECK_FN() \ + OPENSSL_EXPORT unsigned long v_check(unsigned long v); \ + OPENSSL_EXPORT unsigned long v_check(unsigned long v) { \ + if (v >= OSSL_DYNAMIC_OLDEST) return OSSL_DYNAMIC_VERSION; \ + return 0; } + +/* + * This function is passed the ENGINE structure to initialise with its own + * function and command settings. It should not adjust the structural or + * functional reference counts. If this function returns zero, (a) the load + * will be aborted, (b) the previous ENGINE state will be memcpy'd back onto + * the structure, and (c) the shared library will be unloaded. So + * implementations should do their own internal cleanup in failure + * circumstances otherwise they could leak. The 'id' parameter, if non-NULL, + * represents the ENGINE id that the loader is looking for. If this is NULL, + * the shared library can choose to return failure or to initialise a + * 'default' ENGINE. If non-NULL, the shared library must initialise only an + * ENGINE matching the passed 'id'. The function is expected to be + * implemented with the symbol name "bind_engine". A standard implementation + * can be instantiated with IMPLEMENT_DYNAMIC_BIND_FN(fn) where the parameter + * 'fn' is a callback function that populates the ENGINE structure and + * returns an int value (zero for failure). 'fn' should have prototype; + * [static] int fn(ENGINE *e, const char *id); + */ +typedef int (*dynamic_bind_engine) (ENGINE *e, const char *id, + const dynamic_fns *fns); +# define IMPLEMENT_DYNAMIC_BIND_FN(fn) \ + OPENSSL_EXPORT \ + int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns); \ + OPENSSL_EXPORT \ + int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns) { \ + if (ENGINE_get_static_state() == fns->static_state) goto skip_cbs; \ + CRYPTO_set_mem_functions(fns->mem_fns.malloc_fn, \ + fns->mem_fns.realloc_fn, \ + fns->mem_fns.free_fn); \ + skip_cbs: \ + if (!fn(e, id)) return 0; \ + return 1; } + +/* + * If the loading application (or library) and the loaded ENGINE library + * share the same static data (eg. they're both dynamically linked to the + * same libcrypto.so) we need a way to avoid trying to set system callbacks - + * this would fail, and for the same reason that it's unnecessary to try. If + * the loaded ENGINE has (or gets from through the loader) its own copy of + * the libcrypto static data, we will need to set the callbacks. The easiest + * way to detect this is to have a function that returns a pointer to some + * static data and let the loading application and loaded ENGINE compare + * their respective values. + */ +void *ENGINE_get_static_state(void); + +# if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) +DEPRECATEDIN_1_1_0(void ENGINE_setup_bsd_cryptodev(void)) +# endif + + +# ifdef __cplusplus +} +# endif +# endif +#endif diff --git a/ONVIF/include/openssl/include/openssl/engineerr.h b/ONVIF/include/openssl/include/openssl/engineerr.h new file mode 100644 index 0000000..05e84bd --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/engineerr.h @@ -0,0 +1,111 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_ENGINEERR_H +# define HEADER_ENGINEERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# include + +# ifndef OPENSSL_NO_ENGINE + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_ENGINE_strings(void); + +/* + * ENGINE function codes. + */ +# define ENGINE_F_DIGEST_UPDATE 198 +# define ENGINE_F_DYNAMIC_CTRL 180 +# define ENGINE_F_DYNAMIC_GET_DATA_CTX 181 +# define ENGINE_F_DYNAMIC_LOAD 182 +# define ENGINE_F_DYNAMIC_SET_DATA_CTX 183 +# define ENGINE_F_ENGINE_ADD 105 +# define ENGINE_F_ENGINE_BY_ID 106 +# define ENGINE_F_ENGINE_CMD_IS_EXECUTABLE 170 +# define ENGINE_F_ENGINE_CTRL 142 +# define ENGINE_F_ENGINE_CTRL_CMD 178 +# define ENGINE_F_ENGINE_CTRL_CMD_STRING 171 +# define ENGINE_F_ENGINE_FINISH 107 +# define ENGINE_F_ENGINE_GET_CIPHER 185 +# define ENGINE_F_ENGINE_GET_DIGEST 186 +# define ENGINE_F_ENGINE_GET_FIRST 195 +# define ENGINE_F_ENGINE_GET_LAST 196 +# define ENGINE_F_ENGINE_GET_NEXT 115 +# define ENGINE_F_ENGINE_GET_PKEY_ASN1_METH 193 +# define ENGINE_F_ENGINE_GET_PKEY_METH 192 +# define ENGINE_F_ENGINE_GET_PREV 116 +# define ENGINE_F_ENGINE_INIT 119 +# define ENGINE_F_ENGINE_LIST_ADD 120 +# define ENGINE_F_ENGINE_LIST_REMOVE 121 +# define ENGINE_F_ENGINE_LOAD_PRIVATE_KEY 150 +# define ENGINE_F_ENGINE_LOAD_PUBLIC_KEY 151 +# define ENGINE_F_ENGINE_LOAD_SSL_CLIENT_CERT 194 +# define ENGINE_F_ENGINE_NEW 122 +# define ENGINE_F_ENGINE_PKEY_ASN1_FIND_STR 197 +# define ENGINE_F_ENGINE_REMOVE 123 +# define ENGINE_F_ENGINE_SET_DEFAULT_STRING 189 +# define ENGINE_F_ENGINE_SET_ID 129 +# define ENGINE_F_ENGINE_SET_NAME 130 +# define ENGINE_F_ENGINE_TABLE_REGISTER 184 +# define ENGINE_F_ENGINE_UNLOCKED_FINISH 191 +# define ENGINE_F_ENGINE_UP_REF 190 +# define ENGINE_F_INT_CLEANUP_ITEM 199 +# define ENGINE_F_INT_CTRL_HELPER 172 +# define ENGINE_F_INT_ENGINE_CONFIGURE 188 +# define ENGINE_F_INT_ENGINE_MODULE_INIT 187 +# define ENGINE_F_OSSL_HMAC_INIT 200 + +/* + * ENGINE reason codes. + */ +# define ENGINE_R_ALREADY_LOADED 100 +# define ENGINE_R_ARGUMENT_IS_NOT_A_NUMBER 133 +# define ENGINE_R_CMD_NOT_EXECUTABLE 134 +# define ENGINE_R_COMMAND_TAKES_INPUT 135 +# define ENGINE_R_COMMAND_TAKES_NO_INPUT 136 +# define ENGINE_R_CONFLICTING_ENGINE_ID 103 +# define ENGINE_R_CTRL_COMMAND_NOT_IMPLEMENTED 119 +# define ENGINE_R_DSO_FAILURE 104 +# define ENGINE_R_DSO_NOT_FOUND 132 +# define ENGINE_R_ENGINES_SECTION_ERROR 148 +# define ENGINE_R_ENGINE_CONFIGURATION_ERROR 102 +# define ENGINE_R_ENGINE_IS_NOT_IN_LIST 105 +# define ENGINE_R_ENGINE_SECTION_ERROR 149 +# define ENGINE_R_FAILED_LOADING_PRIVATE_KEY 128 +# define ENGINE_R_FAILED_LOADING_PUBLIC_KEY 129 +# define ENGINE_R_FINISH_FAILED 106 +# define ENGINE_R_ID_OR_NAME_MISSING 108 +# define ENGINE_R_INIT_FAILED 109 +# define ENGINE_R_INTERNAL_LIST_ERROR 110 +# define ENGINE_R_INVALID_ARGUMENT 143 +# define ENGINE_R_INVALID_CMD_NAME 137 +# define ENGINE_R_INVALID_CMD_NUMBER 138 +# define ENGINE_R_INVALID_INIT_VALUE 151 +# define ENGINE_R_INVALID_STRING 150 +# define ENGINE_R_NOT_INITIALISED 117 +# define ENGINE_R_NOT_LOADED 112 +# define ENGINE_R_NO_CONTROL_FUNCTION 120 +# define ENGINE_R_NO_INDEX 144 +# define ENGINE_R_NO_LOAD_FUNCTION 125 +# define ENGINE_R_NO_REFERENCE 130 +# define ENGINE_R_NO_SUCH_ENGINE 116 +# define ENGINE_R_UNIMPLEMENTED_CIPHER 146 +# define ENGINE_R_UNIMPLEMENTED_DIGEST 147 +# define ENGINE_R_UNIMPLEMENTED_PUBLIC_KEY_METHOD 101 +# define ENGINE_R_VERSION_INCOMPATIBILITY 145 + +# endif +#endif diff --git a/ONVIF/include/openssl/include/openssl/err.h b/ONVIF/include/openssl/include/openssl/err.h new file mode 100644 index 0000000..b49f881 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/err.h @@ -0,0 +1,274 @@ +/* + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_ERR_H +# define HEADER_ERR_H + +# include + +# ifndef OPENSSL_NO_STDIO +# include +# include +# endif + +# include +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + +# ifndef OPENSSL_NO_ERR +# define ERR_PUT_error(a,b,c,d,e) ERR_put_error(a,b,c,d,e) +# else +# define ERR_PUT_error(a,b,c,d,e) ERR_put_error(a,b,c,NULL,0) +# endif + +# include + +# define ERR_TXT_MALLOCED 0x01 +# define ERR_TXT_STRING 0x02 + +# define ERR_FLAG_MARK 0x01 +# define ERR_FLAG_CLEAR 0x02 + +# define ERR_NUM_ERRORS 16 +typedef struct err_state_st { + int err_flags[ERR_NUM_ERRORS]; + unsigned long err_buffer[ERR_NUM_ERRORS]; + char *err_data[ERR_NUM_ERRORS]; + int err_data_flags[ERR_NUM_ERRORS]; + const char *err_file[ERR_NUM_ERRORS]; + int err_line[ERR_NUM_ERRORS]; + int top, bottom; +} ERR_STATE; + +/* library */ +# define ERR_LIB_NONE 1 +# define ERR_LIB_SYS 2 +# define ERR_LIB_BN 3 +# define ERR_LIB_RSA 4 +# define ERR_LIB_DH 5 +# define ERR_LIB_EVP 6 +# define ERR_LIB_BUF 7 +# define ERR_LIB_OBJ 8 +# define ERR_LIB_PEM 9 +# define ERR_LIB_DSA 10 +# define ERR_LIB_X509 11 +/* #define ERR_LIB_METH 12 */ +# define ERR_LIB_ASN1 13 +# define ERR_LIB_CONF 14 +# define ERR_LIB_CRYPTO 15 +# define ERR_LIB_EC 16 +# define ERR_LIB_SSL 20 +/* #define ERR_LIB_SSL23 21 */ +/* #define ERR_LIB_SSL2 22 */ +/* #define ERR_LIB_SSL3 23 */ +/* #define ERR_LIB_RSAREF 30 */ +/* #define ERR_LIB_PROXY 31 */ +# define ERR_LIB_BIO 32 +# define ERR_LIB_PKCS7 33 +# define ERR_LIB_X509V3 34 +# define ERR_LIB_PKCS12 35 +# define ERR_LIB_RAND 36 +# define ERR_LIB_DSO 37 +# define ERR_LIB_ENGINE 38 +# define ERR_LIB_OCSP 39 +# define ERR_LIB_UI 40 +# define ERR_LIB_COMP 41 +# define ERR_LIB_ECDSA 42 +# define ERR_LIB_ECDH 43 +# define ERR_LIB_OSSL_STORE 44 +# define ERR_LIB_FIPS 45 +# define ERR_LIB_CMS 46 +# define ERR_LIB_TS 47 +# define ERR_LIB_HMAC 48 +/* # define ERR_LIB_JPAKE 49 */ +# define ERR_LIB_CT 50 +# define ERR_LIB_ASYNC 51 +# define ERR_LIB_KDF 52 +# define ERR_LIB_SM2 53 + +# define ERR_LIB_USER 128 + +# define SYSerr(f,r) ERR_PUT_error(ERR_LIB_SYS,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define BNerr(f,r) ERR_PUT_error(ERR_LIB_BN,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define RSAerr(f,r) ERR_PUT_error(ERR_LIB_RSA,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define DHerr(f,r) ERR_PUT_error(ERR_LIB_DH,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define EVPerr(f,r) ERR_PUT_error(ERR_LIB_EVP,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define BUFerr(f,r) ERR_PUT_error(ERR_LIB_BUF,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define OBJerr(f,r) ERR_PUT_error(ERR_LIB_OBJ,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define PEMerr(f,r) ERR_PUT_error(ERR_LIB_PEM,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define DSAerr(f,r) ERR_PUT_error(ERR_LIB_DSA,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define X509err(f,r) ERR_PUT_error(ERR_LIB_X509,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define CONFerr(f,r) ERR_PUT_error(ERR_LIB_CONF,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define CRYPTOerr(f,r) ERR_PUT_error(ERR_LIB_CRYPTO,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define ECerr(f,r) ERR_PUT_error(ERR_LIB_EC,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define SSLerr(f,r) ERR_PUT_error(ERR_LIB_SSL,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define BIOerr(f,r) ERR_PUT_error(ERR_LIB_BIO,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define PKCS7err(f,r) ERR_PUT_error(ERR_LIB_PKCS7,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define X509V3err(f,r) ERR_PUT_error(ERR_LIB_X509V3,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define PKCS12err(f,r) ERR_PUT_error(ERR_LIB_PKCS12,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define RANDerr(f,r) ERR_PUT_error(ERR_LIB_RAND,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define DSOerr(f,r) ERR_PUT_error(ERR_LIB_DSO,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define ENGINEerr(f,r) ERR_PUT_error(ERR_LIB_ENGINE,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define OCSPerr(f,r) ERR_PUT_error(ERR_LIB_OCSP,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define UIerr(f,r) ERR_PUT_error(ERR_LIB_UI,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define COMPerr(f,r) ERR_PUT_error(ERR_LIB_COMP,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define ECDSAerr(f,r) ERR_PUT_error(ERR_LIB_ECDSA,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define ECDHerr(f,r) ERR_PUT_error(ERR_LIB_ECDH,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define OSSL_STOREerr(f,r) ERR_PUT_error(ERR_LIB_OSSL_STORE,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define FIPSerr(f,r) ERR_PUT_error(ERR_LIB_FIPS,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define CMSerr(f,r) ERR_PUT_error(ERR_LIB_CMS,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define TSerr(f,r) ERR_PUT_error(ERR_LIB_TS,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define HMACerr(f,r) ERR_PUT_error(ERR_LIB_HMAC,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define CTerr(f,r) ERR_PUT_error(ERR_LIB_CT,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define ASYNCerr(f,r) ERR_PUT_error(ERR_LIB_ASYNC,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define KDFerr(f,r) ERR_PUT_error(ERR_LIB_KDF,(f),(r),OPENSSL_FILE,OPENSSL_LINE) +# define SM2err(f,r) ERR_PUT_error(ERR_LIB_SM2,(f),(r),OPENSSL_FILE,OPENSSL_LINE) + +# define ERR_PACK(l,f,r) ( \ + (((unsigned int)(l) & 0x0FF) << 24L) | \ + (((unsigned int)(f) & 0xFFF) << 12L) | \ + (((unsigned int)(r) & 0xFFF) ) ) +# define ERR_GET_LIB(l) (int)(((l) >> 24L) & 0x0FFL) +# define ERR_GET_FUNC(l) (int)(((l) >> 12L) & 0xFFFL) +# define ERR_GET_REASON(l) (int)( (l) & 0xFFFL) +# define ERR_FATAL_ERROR(l) (int)( (l) & ERR_R_FATAL) + +/* OS functions */ +# define SYS_F_FOPEN 1 +# define SYS_F_CONNECT 2 +# define SYS_F_GETSERVBYNAME 3 +# define SYS_F_SOCKET 4 +# define SYS_F_IOCTLSOCKET 5 +# define SYS_F_BIND 6 +# define SYS_F_LISTEN 7 +# define SYS_F_ACCEPT 8 +# define SYS_F_WSASTARTUP 9/* Winsock stuff */ +# define SYS_F_OPENDIR 10 +# define SYS_F_FREAD 11 +# define SYS_F_GETADDRINFO 12 +# define SYS_F_GETNAMEINFO 13 +# define SYS_F_SETSOCKOPT 14 +# define SYS_F_GETSOCKOPT 15 +# define SYS_F_GETSOCKNAME 16 +# define SYS_F_GETHOSTBYNAME 17 +# define SYS_F_FFLUSH 18 +# define SYS_F_OPEN 19 +# define SYS_F_CLOSE 20 +# define SYS_F_IOCTL 21 +# define SYS_F_STAT 22 +# define SYS_F_FCNTL 23 +# define SYS_F_FSTAT 24 + +/* reasons */ +# define ERR_R_SYS_LIB ERR_LIB_SYS/* 2 */ +# define ERR_R_BN_LIB ERR_LIB_BN/* 3 */ +# define ERR_R_RSA_LIB ERR_LIB_RSA/* 4 */ +# define ERR_R_DH_LIB ERR_LIB_DH/* 5 */ +# define ERR_R_EVP_LIB ERR_LIB_EVP/* 6 */ +# define ERR_R_BUF_LIB ERR_LIB_BUF/* 7 */ +# define ERR_R_OBJ_LIB ERR_LIB_OBJ/* 8 */ +# define ERR_R_PEM_LIB ERR_LIB_PEM/* 9 */ +# define ERR_R_DSA_LIB ERR_LIB_DSA/* 10 */ +# define ERR_R_X509_LIB ERR_LIB_X509/* 11 */ +# define ERR_R_ASN1_LIB ERR_LIB_ASN1/* 13 */ +# define ERR_R_EC_LIB ERR_LIB_EC/* 16 */ +# define ERR_R_BIO_LIB ERR_LIB_BIO/* 32 */ +# define ERR_R_PKCS7_LIB ERR_LIB_PKCS7/* 33 */ +# define ERR_R_X509V3_LIB ERR_LIB_X509V3/* 34 */ +# define ERR_R_ENGINE_LIB ERR_LIB_ENGINE/* 38 */ +# define ERR_R_UI_LIB ERR_LIB_UI/* 40 */ +# define ERR_R_ECDSA_LIB ERR_LIB_ECDSA/* 42 */ +# define ERR_R_OSSL_STORE_LIB ERR_LIB_OSSL_STORE/* 44 */ + +# define ERR_R_NESTED_ASN1_ERROR 58 +# define ERR_R_MISSING_ASN1_EOS 63 + +/* fatal error */ +# define ERR_R_FATAL 64 +# define ERR_R_MALLOC_FAILURE (1|ERR_R_FATAL) +# define ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED (2|ERR_R_FATAL) +# define ERR_R_PASSED_NULL_PARAMETER (3|ERR_R_FATAL) +# define ERR_R_INTERNAL_ERROR (4|ERR_R_FATAL) +# define ERR_R_DISABLED (5|ERR_R_FATAL) +# define ERR_R_INIT_FAIL (6|ERR_R_FATAL) +# define ERR_R_PASSED_INVALID_ARGUMENT (7) +# define ERR_R_OPERATION_FAIL (8|ERR_R_FATAL) + +/* + * 99 is the maximum possible ERR_R_... code, higher values are reserved for + * the individual libraries + */ + +typedef struct ERR_string_data_st { + unsigned long error; + const char *string; +} ERR_STRING_DATA; + +DEFINE_LHASH_OF(ERR_STRING_DATA); + +void ERR_put_error(int lib, int func, int reason, const char *file, int line); +void ERR_set_error_data(char *data, int flags); + +unsigned long ERR_get_error(void); +unsigned long ERR_get_error_line(const char **file, int *line); +unsigned long ERR_get_error_line_data(const char **file, int *line, + const char **data, int *flags); +unsigned long ERR_peek_error(void); +unsigned long ERR_peek_error_line(const char **file, int *line); +unsigned long ERR_peek_error_line_data(const char **file, int *line, + const char **data, int *flags); +unsigned long ERR_peek_last_error(void); +unsigned long ERR_peek_last_error_line(const char **file, int *line); +unsigned long ERR_peek_last_error_line_data(const char **file, int *line, + const char **data, int *flags); +void ERR_clear_error(void); +char *ERR_error_string(unsigned long e, char *buf); +void ERR_error_string_n(unsigned long e, char *buf, size_t len); +const char *ERR_lib_error_string(unsigned long e); +const char *ERR_func_error_string(unsigned long e); +const char *ERR_reason_error_string(unsigned long e); +void ERR_print_errors_cb(int (*cb) (const char *str, size_t len, void *u), + void *u); +# ifndef OPENSSL_NO_STDIO +void ERR_print_errors_fp(FILE *fp); +# endif +void ERR_print_errors(BIO *bp); +void ERR_add_error_data(int num, ...); +void ERR_add_error_vdata(int num, va_list args); +int ERR_load_strings(int lib, ERR_STRING_DATA *str); +int ERR_load_strings_const(const ERR_STRING_DATA *str); +int ERR_unload_strings(int lib, ERR_STRING_DATA *str); +int ERR_load_ERR_strings(void); + +#if OPENSSL_API_COMPAT < 0x10100000L +# define ERR_load_crypto_strings() \ + OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL) +# define ERR_free_strings() while(0) continue +#endif + +DEPRECATEDIN_1_1_0(void ERR_remove_thread_state(void *)) +DEPRECATEDIN_1_0_0(void ERR_remove_state(unsigned long pid)) +ERR_STATE *ERR_get_state(void); + +int ERR_get_next_error_library(void); + +int ERR_set_mark(void); +int ERR_pop_to_mark(void); +int ERR_clear_last_mark(void); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/ONVIF/include/openssl/include/openssl/evp.h b/ONVIF/include/openssl/include/openssl/evp.h new file mode 100644 index 0000000..a411f3f --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/evp.h @@ -0,0 +1,1666 @@ +/* + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_ENVELOPE_H +# define HEADER_ENVELOPE_H + +# include +# include +# include +# include +# include + +# define EVP_MAX_MD_SIZE 64/* longest known is SHA512 */ +# define EVP_MAX_KEY_LENGTH 64 +# define EVP_MAX_IV_LENGTH 16 +# define EVP_MAX_BLOCK_LENGTH 32 + +# define PKCS5_SALT_LEN 8 +/* Default PKCS#5 iteration count */ +# define PKCS5_DEFAULT_ITER 2048 + +# include + +# define EVP_PK_RSA 0x0001 +# define EVP_PK_DSA 0x0002 +# define EVP_PK_DH 0x0004 +# define EVP_PK_EC 0x0008 +# define EVP_PKT_SIGN 0x0010 +# define EVP_PKT_ENC 0x0020 +# define EVP_PKT_EXCH 0x0040 +# define EVP_PKS_RSA 0x0100 +# define EVP_PKS_DSA 0x0200 +# define EVP_PKS_EC 0x0400 + +# define EVP_PKEY_NONE NID_undef +# define EVP_PKEY_RSA NID_rsaEncryption +# define EVP_PKEY_RSA2 NID_rsa +# define EVP_PKEY_RSA_PSS NID_rsassaPss +# define EVP_PKEY_DSA NID_dsa +# define EVP_PKEY_DSA1 NID_dsa_2 +# define EVP_PKEY_DSA2 NID_dsaWithSHA +# define EVP_PKEY_DSA3 NID_dsaWithSHA1 +# define EVP_PKEY_DSA4 NID_dsaWithSHA1_2 +# define EVP_PKEY_DH NID_dhKeyAgreement +# define EVP_PKEY_DHX NID_dhpublicnumber +# define EVP_PKEY_EC NID_X9_62_id_ecPublicKey +# define EVP_PKEY_SM2 NID_sm2 +# define EVP_PKEY_HMAC NID_hmac +# define EVP_PKEY_CMAC NID_cmac +# define EVP_PKEY_SCRYPT NID_id_scrypt +# define EVP_PKEY_TLS1_PRF NID_tls1_prf +# define EVP_PKEY_HKDF NID_hkdf +# define EVP_PKEY_POLY1305 NID_poly1305 +# define EVP_PKEY_SIPHASH NID_siphash +# define EVP_PKEY_X25519 NID_X25519 +# define EVP_PKEY_ED25519 NID_ED25519 +# define EVP_PKEY_X448 NID_X448 +# define EVP_PKEY_ED448 NID_ED448 + +#ifdef __cplusplus +extern "C" { +#endif + +# define EVP_PKEY_MO_SIGN 0x0001 +# define EVP_PKEY_MO_VERIFY 0x0002 +# define EVP_PKEY_MO_ENCRYPT 0x0004 +# define EVP_PKEY_MO_DECRYPT 0x0008 + +# ifndef EVP_MD +EVP_MD *EVP_MD_meth_new(int md_type, int pkey_type); +EVP_MD *EVP_MD_meth_dup(const EVP_MD *md); +void EVP_MD_meth_free(EVP_MD *md); + +int EVP_MD_meth_set_input_blocksize(EVP_MD *md, int blocksize); +int EVP_MD_meth_set_result_size(EVP_MD *md, int resultsize); +int EVP_MD_meth_set_app_datasize(EVP_MD *md, int datasize); +int EVP_MD_meth_set_flags(EVP_MD *md, unsigned long flags); +int EVP_MD_meth_set_init(EVP_MD *md, int (*init)(EVP_MD_CTX *ctx)); +int EVP_MD_meth_set_update(EVP_MD *md, int (*update)(EVP_MD_CTX *ctx, + const void *data, + size_t count)); +int EVP_MD_meth_set_final(EVP_MD *md, int (*final)(EVP_MD_CTX *ctx, + unsigned char *md)); +int EVP_MD_meth_set_copy(EVP_MD *md, int (*copy)(EVP_MD_CTX *to, + const EVP_MD_CTX *from)); +int EVP_MD_meth_set_cleanup(EVP_MD *md, int (*cleanup)(EVP_MD_CTX *ctx)); +int EVP_MD_meth_set_ctrl(EVP_MD *md, int (*ctrl)(EVP_MD_CTX *ctx, int cmd, + int p1, void *p2)); + +int EVP_MD_meth_get_input_blocksize(const EVP_MD *md); +int EVP_MD_meth_get_result_size(const EVP_MD *md); +int EVP_MD_meth_get_app_datasize(const EVP_MD *md); +unsigned long EVP_MD_meth_get_flags(const EVP_MD *md); +int (*EVP_MD_meth_get_init(const EVP_MD *md))(EVP_MD_CTX *ctx); +int (*EVP_MD_meth_get_update(const EVP_MD *md))(EVP_MD_CTX *ctx, + const void *data, + size_t count); +int (*EVP_MD_meth_get_final(const EVP_MD *md))(EVP_MD_CTX *ctx, + unsigned char *md); +int (*EVP_MD_meth_get_copy(const EVP_MD *md))(EVP_MD_CTX *to, + const EVP_MD_CTX *from); +int (*EVP_MD_meth_get_cleanup(const EVP_MD *md))(EVP_MD_CTX *ctx); +int (*EVP_MD_meth_get_ctrl(const EVP_MD *md))(EVP_MD_CTX *ctx, int cmd, + int p1, void *p2); + +/* digest can only handle a single block */ +# define EVP_MD_FLAG_ONESHOT 0x0001 + +/* digest is extensible-output function, XOF */ +# define EVP_MD_FLAG_XOF 0x0002 + +/* DigestAlgorithmIdentifier flags... */ + +# define EVP_MD_FLAG_DIGALGID_MASK 0x0018 + +/* NULL or absent parameter accepted. Use NULL */ + +# define EVP_MD_FLAG_DIGALGID_NULL 0x0000 + +/* NULL or absent parameter accepted. Use NULL for PKCS#1 otherwise absent */ + +# define EVP_MD_FLAG_DIGALGID_ABSENT 0x0008 + +/* Custom handling via ctrl */ + +# define EVP_MD_FLAG_DIGALGID_CUSTOM 0x0018 + +/* Note if suitable for use in FIPS mode */ +# define EVP_MD_FLAG_FIPS 0x0400 + +/* Digest ctrls */ + +# define EVP_MD_CTRL_DIGALGID 0x1 +# define EVP_MD_CTRL_MICALG 0x2 +# define EVP_MD_CTRL_XOF_LEN 0x3 + +/* Minimum Algorithm specific ctrl value */ + +# define EVP_MD_CTRL_ALG_CTRL 0x1000 + +# endif /* !EVP_MD */ + +/* values for EVP_MD_CTX flags */ + +# define EVP_MD_CTX_FLAG_ONESHOT 0x0001/* digest update will be + * called once only */ +# define EVP_MD_CTX_FLAG_CLEANED 0x0002/* context has already been + * cleaned */ +# define EVP_MD_CTX_FLAG_REUSE 0x0004/* Don't free up ctx->md_data + * in EVP_MD_CTX_reset */ +/* + * FIPS and pad options are ignored in 1.0.0, definitions are here so we + * don't accidentally reuse the values for other purposes. + */ + +# define EVP_MD_CTX_FLAG_NON_FIPS_ALLOW 0x0008/* Allow use of non FIPS + * digest in FIPS mode */ + +/* + * The following PAD options are also currently ignored in 1.0.0, digest + * parameters are handled through EVP_DigestSign*() and EVP_DigestVerify*() + * instead. + */ +# define EVP_MD_CTX_FLAG_PAD_MASK 0xF0/* RSA mode to use */ +# define EVP_MD_CTX_FLAG_PAD_PKCS1 0x00/* PKCS#1 v1.5 mode */ +# define EVP_MD_CTX_FLAG_PAD_X931 0x10/* X9.31 mode */ +# define EVP_MD_CTX_FLAG_PAD_PSS 0x20/* PSS mode */ + +# define EVP_MD_CTX_FLAG_NO_INIT 0x0100/* Don't initialize md_data */ +/* + * Some functions such as EVP_DigestSign only finalise copies of internal + * contexts so additional data can be included after the finalisation call. + * This is inefficient if this functionality is not required: it is disabled + * if the following flag is set. + */ +# define EVP_MD_CTX_FLAG_FINALISE 0x0200 +/* NOTE: 0x0400 is reserved for internal usage */ + +EVP_CIPHER *EVP_CIPHER_meth_new(int cipher_type, int block_size, int key_len); +EVP_CIPHER *EVP_CIPHER_meth_dup(const EVP_CIPHER *cipher); +void EVP_CIPHER_meth_free(EVP_CIPHER *cipher); + +int EVP_CIPHER_meth_set_iv_length(EVP_CIPHER *cipher, int iv_len); +int EVP_CIPHER_meth_set_flags(EVP_CIPHER *cipher, unsigned long flags); +int EVP_CIPHER_meth_set_impl_ctx_size(EVP_CIPHER *cipher, int ctx_size); +int EVP_CIPHER_meth_set_init(EVP_CIPHER *cipher, + int (*init) (EVP_CIPHER_CTX *ctx, + const unsigned char *key, + const unsigned char *iv, + int enc)); +int EVP_CIPHER_meth_set_do_cipher(EVP_CIPHER *cipher, + int (*do_cipher) (EVP_CIPHER_CTX *ctx, + unsigned char *out, + const unsigned char *in, + size_t inl)); +int EVP_CIPHER_meth_set_cleanup(EVP_CIPHER *cipher, + int (*cleanup) (EVP_CIPHER_CTX *)); +int EVP_CIPHER_meth_set_set_asn1_params(EVP_CIPHER *cipher, + int (*set_asn1_parameters) (EVP_CIPHER_CTX *, + ASN1_TYPE *)); +int EVP_CIPHER_meth_set_get_asn1_params(EVP_CIPHER *cipher, + int (*get_asn1_parameters) (EVP_CIPHER_CTX *, + ASN1_TYPE *)); +int EVP_CIPHER_meth_set_ctrl(EVP_CIPHER *cipher, + int (*ctrl) (EVP_CIPHER_CTX *, int type, + int arg, void *ptr)); + +int (*EVP_CIPHER_meth_get_init(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *ctx, + const unsigned char *key, + const unsigned char *iv, + int enc); +int (*EVP_CIPHER_meth_get_do_cipher(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *ctx, + unsigned char *out, + const unsigned char *in, + size_t inl); +int (*EVP_CIPHER_meth_get_cleanup(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *); +int (*EVP_CIPHER_meth_get_set_asn1_params(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *, + ASN1_TYPE *); +int (*EVP_CIPHER_meth_get_get_asn1_params(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *, + ASN1_TYPE *); +int (*EVP_CIPHER_meth_get_ctrl(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *, + int type, int arg, + void *ptr); + +/* Values for cipher flags */ + +/* Modes for ciphers */ + +# define EVP_CIPH_STREAM_CIPHER 0x0 +# define EVP_CIPH_ECB_MODE 0x1 +# define EVP_CIPH_CBC_MODE 0x2 +# define EVP_CIPH_CFB_MODE 0x3 +# define EVP_CIPH_OFB_MODE 0x4 +# define EVP_CIPH_CTR_MODE 0x5 +# define EVP_CIPH_GCM_MODE 0x6 +# define EVP_CIPH_CCM_MODE 0x7 +# define EVP_CIPH_XTS_MODE 0x10001 +# define EVP_CIPH_WRAP_MODE 0x10002 +# define EVP_CIPH_OCB_MODE 0x10003 +# define EVP_CIPH_MODE 0xF0007 +/* Set if variable length cipher */ +# define EVP_CIPH_VARIABLE_LENGTH 0x8 +/* Set if the iv handling should be done by the cipher itself */ +# define EVP_CIPH_CUSTOM_IV 0x10 +/* Set if the cipher's init() function should be called if key is NULL */ +# define EVP_CIPH_ALWAYS_CALL_INIT 0x20 +/* Call ctrl() to init cipher parameters */ +# define EVP_CIPH_CTRL_INIT 0x40 +/* Don't use standard key length function */ +# define EVP_CIPH_CUSTOM_KEY_LENGTH 0x80 +/* Don't use standard block padding */ +# define EVP_CIPH_NO_PADDING 0x100 +/* cipher handles random key generation */ +# define EVP_CIPH_RAND_KEY 0x200 +/* cipher has its own additional copying logic */ +# define EVP_CIPH_CUSTOM_COPY 0x400 +/* Don't use standard iv length function */ +# define EVP_CIPH_CUSTOM_IV_LENGTH 0x800 +/* Allow use default ASN1 get/set iv */ +# define EVP_CIPH_FLAG_DEFAULT_ASN1 0x1000 +/* Buffer length in bits not bytes: CFB1 mode only */ +# define EVP_CIPH_FLAG_LENGTH_BITS 0x2000 +/* Note if suitable for use in FIPS mode */ +# define EVP_CIPH_FLAG_FIPS 0x4000 +/* Allow non FIPS cipher in FIPS mode */ +# define EVP_CIPH_FLAG_NON_FIPS_ALLOW 0x8000 +/* + * Cipher handles any and all padding logic as well as finalisation. + */ +# define EVP_CIPH_FLAG_CUSTOM_CIPHER 0x100000 +# define EVP_CIPH_FLAG_AEAD_CIPHER 0x200000 +# define EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK 0x400000 +/* Cipher can handle pipeline operations */ +# define EVP_CIPH_FLAG_PIPELINE 0X800000 + +/* + * Cipher context flag to indicate we can handle wrap mode: if allowed in + * older applications it could overflow buffers. + */ + +# define EVP_CIPHER_CTX_FLAG_WRAP_ALLOW 0x1 + +/* ctrl() values */ + +# define EVP_CTRL_INIT 0x0 +# define EVP_CTRL_SET_KEY_LENGTH 0x1 +# define EVP_CTRL_GET_RC2_KEY_BITS 0x2 +# define EVP_CTRL_SET_RC2_KEY_BITS 0x3 +# define EVP_CTRL_GET_RC5_ROUNDS 0x4 +# define EVP_CTRL_SET_RC5_ROUNDS 0x5 +# define EVP_CTRL_RAND_KEY 0x6 +# define EVP_CTRL_PBE_PRF_NID 0x7 +# define EVP_CTRL_COPY 0x8 +# define EVP_CTRL_AEAD_SET_IVLEN 0x9 +# define EVP_CTRL_AEAD_GET_TAG 0x10 +# define EVP_CTRL_AEAD_SET_TAG 0x11 +# define EVP_CTRL_AEAD_SET_IV_FIXED 0x12 +# define EVP_CTRL_GCM_SET_IVLEN EVP_CTRL_AEAD_SET_IVLEN +# define EVP_CTRL_GCM_GET_TAG EVP_CTRL_AEAD_GET_TAG +# define EVP_CTRL_GCM_SET_TAG EVP_CTRL_AEAD_SET_TAG +# define EVP_CTRL_GCM_SET_IV_FIXED EVP_CTRL_AEAD_SET_IV_FIXED +# define EVP_CTRL_GCM_IV_GEN 0x13 +# define EVP_CTRL_CCM_SET_IVLEN EVP_CTRL_AEAD_SET_IVLEN +# define EVP_CTRL_CCM_GET_TAG EVP_CTRL_AEAD_GET_TAG +# define EVP_CTRL_CCM_SET_TAG EVP_CTRL_AEAD_SET_TAG +# define EVP_CTRL_CCM_SET_IV_FIXED EVP_CTRL_AEAD_SET_IV_FIXED +# define EVP_CTRL_CCM_SET_L 0x14 +# define EVP_CTRL_CCM_SET_MSGLEN 0x15 +/* + * AEAD cipher deduces payload length and returns number of bytes required to + * store MAC and eventual padding. Subsequent call to EVP_Cipher even + * appends/verifies MAC. + */ +# define EVP_CTRL_AEAD_TLS1_AAD 0x16 +/* Used by composite AEAD ciphers, no-op in GCM, CCM... */ +# define EVP_CTRL_AEAD_SET_MAC_KEY 0x17 +/* Set the GCM invocation field, decrypt only */ +# define EVP_CTRL_GCM_SET_IV_INV 0x18 + +# define EVP_CTRL_TLS1_1_MULTIBLOCK_AAD 0x19 +# define EVP_CTRL_TLS1_1_MULTIBLOCK_ENCRYPT 0x1a +# define EVP_CTRL_TLS1_1_MULTIBLOCK_DECRYPT 0x1b +# define EVP_CTRL_TLS1_1_MULTIBLOCK_MAX_BUFSIZE 0x1c + +# define EVP_CTRL_SSL3_MASTER_SECRET 0x1d + +/* EVP_CTRL_SET_SBOX takes the char * specifying S-boxes */ +# define EVP_CTRL_SET_SBOX 0x1e +/* + * EVP_CTRL_SBOX_USED takes a 'size_t' and 'char *', pointing at a + * pre-allocated buffer with specified size + */ +# define EVP_CTRL_SBOX_USED 0x1f +/* EVP_CTRL_KEY_MESH takes 'size_t' number of bytes to mesh the key after, + * 0 switches meshing off + */ +# define EVP_CTRL_KEY_MESH 0x20 +/* EVP_CTRL_BLOCK_PADDING_MODE takes the padding mode */ +# define EVP_CTRL_BLOCK_PADDING_MODE 0x21 + +/* Set the output buffers to use for a pipelined operation */ +# define EVP_CTRL_SET_PIPELINE_OUTPUT_BUFS 0x22 +/* Set the input buffers to use for a pipelined operation */ +# define EVP_CTRL_SET_PIPELINE_INPUT_BUFS 0x23 +/* Set the input buffer lengths to use for a pipelined operation */ +# define EVP_CTRL_SET_PIPELINE_INPUT_LENS 0x24 + +# define EVP_CTRL_GET_IVLEN 0x25 + +/* Padding modes */ +#define EVP_PADDING_PKCS7 1 +#define EVP_PADDING_ISO7816_4 2 +#define EVP_PADDING_ANSI923 3 +#define EVP_PADDING_ISO10126 4 +#define EVP_PADDING_ZERO 5 + +/* RFC 5246 defines additional data to be 13 bytes in length */ +# define EVP_AEAD_TLS1_AAD_LEN 13 + +typedef struct { + unsigned char *out; + const unsigned char *inp; + size_t len; + unsigned int interleave; +} EVP_CTRL_TLS1_1_MULTIBLOCK_PARAM; + +/* GCM TLS constants */ +/* Length of fixed part of IV derived from PRF */ +# define EVP_GCM_TLS_FIXED_IV_LEN 4 +/* Length of explicit part of IV part of TLS records */ +# define EVP_GCM_TLS_EXPLICIT_IV_LEN 8 +/* Length of tag for TLS */ +# define EVP_GCM_TLS_TAG_LEN 16 + +/* CCM TLS constants */ +/* Length of fixed part of IV derived from PRF */ +# define EVP_CCM_TLS_FIXED_IV_LEN 4 +/* Length of explicit part of IV part of TLS records */ +# define EVP_CCM_TLS_EXPLICIT_IV_LEN 8 +/* Total length of CCM IV length for TLS */ +# define EVP_CCM_TLS_IV_LEN 12 +/* Length of tag for TLS */ +# define EVP_CCM_TLS_TAG_LEN 16 +/* Length of CCM8 tag for TLS */ +# define EVP_CCM8_TLS_TAG_LEN 8 + +/* Length of tag for TLS */ +# define EVP_CHACHAPOLY_TLS_TAG_LEN 16 + +typedef struct evp_cipher_info_st { + const EVP_CIPHER *cipher; + unsigned char iv[EVP_MAX_IV_LENGTH]; +} EVP_CIPHER_INFO; + + +/* Password based encryption function */ +typedef int (EVP_PBE_KEYGEN) (EVP_CIPHER_CTX *ctx, const char *pass, + int passlen, ASN1_TYPE *param, + const EVP_CIPHER *cipher, const EVP_MD *md, + int en_de); + +# ifndef OPENSSL_NO_RSA +# define EVP_PKEY_assign_RSA(pkey,rsa) EVP_PKEY_assign((pkey),EVP_PKEY_RSA,\ + (char *)(rsa)) +# endif + +# ifndef OPENSSL_NO_DSA +# define EVP_PKEY_assign_DSA(pkey,dsa) EVP_PKEY_assign((pkey),EVP_PKEY_DSA,\ + (char *)(dsa)) +# endif + +# ifndef OPENSSL_NO_DH +# define EVP_PKEY_assign_DH(pkey,dh) EVP_PKEY_assign((pkey),EVP_PKEY_DH,\ + (char *)(dh)) +# endif + +# ifndef OPENSSL_NO_EC +# define EVP_PKEY_assign_EC_KEY(pkey,eckey) EVP_PKEY_assign((pkey),EVP_PKEY_EC,\ + (char *)(eckey)) +# endif +# ifndef OPENSSL_NO_SIPHASH +# define EVP_PKEY_assign_SIPHASH(pkey,shkey) EVP_PKEY_assign((pkey),EVP_PKEY_SIPHASH,\ + (char *)(shkey)) +# endif + +# ifndef OPENSSL_NO_POLY1305 +# define EVP_PKEY_assign_POLY1305(pkey,polykey) EVP_PKEY_assign((pkey),EVP_PKEY_POLY1305,\ + (char *)(polykey)) +# endif + +/* Add some extra combinations */ +# define EVP_get_digestbynid(a) EVP_get_digestbyname(OBJ_nid2sn(a)) +# define EVP_get_digestbyobj(a) EVP_get_digestbynid(OBJ_obj2nid(a)) +# define EVP_get_cipherbynid(a) EVP_get_cipherbyname(OBJ_nid2sn(a)) +# define EVP_get_cipherbyobj(a) EVP_get_cipherbynid(OBJ_obj2nid(a)) + +int EVP_MD_type(const EVP_MD *md); +# define EVP_MD_nid(e) EVP_MD_type(e) +# define EVP_MD_name(e) OBJ_nid2sn(EVP_MD_nid(e)) +int EVP_MD_pkey_type(const EVP_MD *md); +int EVP_MD_size(const EVP_MD *md); +int EVP_MD_block_size(const EVP_MD *md); +unsigned long EVP_MD_flags(const EVP_MD *md); + +const EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx); +int (*EVP_MD_CTX_update_fn(EVP_MD_CTX *ctx))(EVP_MD_CTX *ctx, + const void *data, size_t count); +void EVP_MD_CTX_set_update_fn(EVP_MD_CTX *ctx, + int (*update) (EVP_MD_CTX *ctx, + const void *data, size_t count)); +# define EVP_MD_CTX_size(e) EVP_MD_size(EVP_MD_CTX_md(e)) +# define EVP_MD_CTX_block_size(e) EVP_MD_block_size(EVP_MD_CTX_md(e)) +# define EVP_MD_CTX_type(e) EVP_MD_type(EVP_MD_CTX_md(e)) +EVP_PKEY_CTX *EVP_MD_CTX_pkey_ctx(const EVP_MD_CTX *ctx); +void EVP_MD_CTX_set_pkey_ctx(EVP_MD_CTX *ctx, EVP_PKEY_CTX *pctx); +void *EVP_MD_CTX_md_data(const EVP_MD_CTX *ctx); + +int EVP_CIPHER_nid(const EVP_CIPHER *cipher); +# define EVP_CIPHER_name(e) OBJ_nid2sn(EVP_CIPHER_nid(e)) +int EVP_CIPHER_block_size(const EVP_CIPHER *cipher); +int EVP_CIPHER_impl_ctx_size(const EVP_CIPHER *cipher); +int EVP_CIPHER_key_length(const EVP_CIPHER *cipher); +int EVP_CIPHER_iv_length(const EVP_CIPHER *cipher); +unsigned long EVP_CIPHER_flags(const EVP_CIPHER *cipher); +# define EVP_CIPHER_mode(e) (EVP_CIPHER_flags(e) & EVP_CIPH_MODE) + +const EVP_CIPHER *EVP_CIPHER_CTX_cipher(const EVP_CIPHER_CTX *ctx); +int EVP_CIPHER_CTX_encrypting(const EVP_CIPHER_CTX *ctx); +int EVP_CIPHER_CTX_nid(const EVP_CIPHER_CTX *ctx); +int EVP_CIPHER_CTX_block_size(const EVP_CIPHER_CTX *ctx); +int EVP_CIPHER_CTX_key_length(const EVP_CIPHER_CTX *ctx); +int EVP_CIPHER_CTX_iv_length(const EVP_CIPHER_CTX *ctx); +const unsigned char *EVP_CIPHER_CTX_iv(const EVP_CIPHER_CTX *ctx); +const unsigned char *EVP_CIPHER_CTX_original_iv(const EVP_CIPHER_CTX *ctx); +unsigned char *EVP_CIPHER_CTX_iv_noconst(EVP_CIPHER_CTX *ctx); +unsigned char *EVP_CIPHER_CTX_buf_noconst(EVP_CIPHER_CTX *ctx); +int EVP_CIPHER_CTX_num(const EVP_CIPHER_CTX *ctx); +void EVP_CIPHER_CTX_set_num(EVP_CIPHER_CTX *ctx, int num); +int EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, const EVP_CIPHER_CTX *in); +void *EVP_CIPHER_CTX_get_app_data(const EVP_CIPHER_CTX *ctx); +void EVP_CIPHER_CTX_set_app_data(EVP_CIPHER_CTX *ctx, void *data); +void *EVP_CIPHER_CTX_get_cipher_data(const EVP_CIPHER_CTX *ctx); +void *EVP_CIPHER_CTX_set_cipher_data(EVP_CIPHER_CTX *ctx, void *cipher_data); +# define EVP_CIPHER_CTX_type(c) EVP_CIPHER_type(EVP_CIPHER_CTX_cipher(c)) +# if OPENSSL_API_COMPAT < 0x10100000L +# define EVP_CIPHER_CTX_flags(c) EVP_CIPHER_flags(EVP_CIPHER_CTX_cipher(c)) +# endif +# define EVP_CIPHER_CTX_mode(c) EVP_CIPHER_mode(EVP_CIPHER_CTX_cipher(c)) + +# define EVP_ENCODE_LENGTH(l) ((((l)+2)/3*4)+((l)/48+1)*2+80) +# define EVP_DECODE_LENGTH(l) (((l)+3)/4*3+80) + +# define EVP_SignInit_ex(a,b,c) EVP_DigestInit_ex(a,b,c) +# define EVP_SignInit(a,b) EVP_DigestInit(a,b) +# define EVP_SignUpdate(a,b,c) EVP_DigestUpdate(a,b,c) +# define EVP_VerifyInit_ex(a,b,c) EVP_DigestInit_ex(a,b,c) +# define EVP_VerifyInit(a,b) EVP_DigestInit(a,b) +# define EVP_VerifyUpdate(a,b,c) EVP_DigestUpdate(a,b,c) +# define EVP_OpenUpdate(a,b,c,d,e) EVP_DecryptUpdate(a,b,c,d,e) +# define EVP_SealUpdate(a,b,c,d,e) EVP_EncryptUpdate(a,b,c,d,e) +# define EVP_DigestSignUpdate(a,b,c) EVP_DigestUpdate(a,b,c) +# define EVP_DigestVerifyUpdate(a,b,c) EVP_DigestUpdate(a,b,c) + +# ifdef CONST_STRICT +void BIO_set_md(BIO *, const EVP_MD *md); +# else +# define BIO_set_md(b,md) BIO_ctrl(b,BIO_C_SET_MD,0,(char *)(md)) +# endif +# define BIO_get_md(b,mdp) BIO_ctrl(b,BIO_C_GET_MD,0,(char *)(mdp)) +# define BIO_get_md_ctx(b,mdcp) BIO_ctrl(b,BIO_C_GET_MD_CTX,0, \ + (char *)(mdcp)) +# define BIO_set_md_ctx(b,mdcp) BIO_ctrl(b,BIO_C_SET_MD_CTX,0, \ + (char *)(mdcp)) +# define BIO_get_cipher_status(b) BIO_ctrl(b,BIO_C_GET_CIPHER_STATUS,0,NULL) +# define BIO_get_cipher_ctx(b,c_pp) BIO_ctrl(b,BIO_C_GET_CIPHER_CTX,0, \ + (char *)(c_pp)) + +/*__owur*/ int EVP_Cipher(EVP_CIPHER_CTX *c, + unsigned char *out, + const unsigned char *in, unsigned int inl); + +# define EVP_add_cipher_alias(n,alias) \ + OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n)) +# define EVP_add_digest_alias(n,alias) \ + OBJ_NAME_add((alias),OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS,(n)) +# define EVP_delete_cipher_alias(alias) \ + OBJ_NAME_remove(alias,OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS); +# define EVP_delete_digest_alias(alias) \ + OBJ_NAME_remove(alias,OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS); + +int EVP_MD_CTX_ctrl(EVP_MD_CTX *ctx, int cmd, int p1, void *p2); +EVP_MD_CTX *EVP_MD_CTX_new(void); +int EVP_MD_CTX_reset(EVP_MD_CTX *ctx); +void EVP_MD_CTX_free(EVP_MD_CTX *ctx); +# define EVP_MD_CTX_create() EVP_MD_CTX_new() +# define EVP_MD_CTX_init(ctx) EVP_MD_CTX_reset((ctx)) +# define EVP_MD_CTX_destroy(ctx) EVP_MD_CTX_free((ctx)) +__owur int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out, const EVP_MD_CTX *in); +void EVP_MD_CTX_set_flags(EVP_MD_CTX *ctx, int flags); +void EVP_MD_CTX_clear_flags(EVP_MD_CTX *ctx, int flags); +int EVP_MD_CTX_test_flags(const EVP_MD_CTX *ctx, int flags); +__owur int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, + ENGINE *impl); +__owur int EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *d, + size_t cnt); +__owur int EVP_DigestFinal_ex(EVP_MD_CTX *ctx, unsigned char *md, + unsigned int *s); +__owur int EVP_Digest(const void *data, size_t count, + unsigned char *md, unsigned int *size, + const EVP_MD *type, ENGINE *impl); + +__owur int EVP_MD_CTX_copy(EVP_MD_CTX *out, const EVP_MD_CTX *in); +__owur int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type); +__owur int EVP_DigestFinal(EVP_MD_CTX *ctx, unsigned char *md, + unsigned int *s); +__owur int EVP_DigestFinalXOF(EVP_MD_CTX *ctx, unsigned char *md, + size_t len); + +int EVP_read_pw_string(char *buf, int length, const char *prompt, int verify); +int EVP_read_pw_string_min(char *buf, int minlen, int maxlen, + const char *prompt, int verify); +void EVP_set_pw_prompt(const char *prompt); +char *EVP_get_pw_prompt(void); + +__owur int EVP_BytesToKey(const EVP_CIPHER *type, const EVP_MD *md, + const unsigned char *salt, + const unsigned char *data, int datal, int count, + unsigned char *key, unsigned char *iv); + +void EVP_CIPHER_CTX_set_flags(EVP_CIPHER_CTX *ctx, int flags); +void EVP_CIPHER_CTX_clear_flags(EVP_CIPHER_CTX *ctx, int flags); +int EVP_CIPHER_CTX_test_flags(const EVP_CIPHER_CTX *ctx, int flags); + +__owur int EVP_EncryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, + const unsigned char *key, const unsigned char *iv); +/*__owur*/ int EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx, + const EVP_CIPHER *cipher, ENGINE *impl, + const unsigned char *key, + const unsigned char *iv); +/*__owur*/ int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, + int *outl, const unsigned char *in, int inl); +/*__owur*/ int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, + int *outl); +/*__owur*/ int EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, + int *outl); + +__owur int EVP_DecryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, + const unsigned char *key, const unsigned char *iv); +/*__owur*/ int EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx, + const EVP_CIPHER *cipher, ENGINE *impl, + const unsigned char *key, + const unsigned char *iv); +/*__owur*/ int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, + int *outl, const unsigned char *in, int inl); +__owur int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, + int *outl); +/*__owur*/ int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, + int *outl); + +__owur int EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, + const unsigned char *key, const unsigned char *iv, + int enc); +/*__owur*/ int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, + const EVP_CIPHER *cipher, ENGINE *impl, + const unsigned char *key, + const unsigned char *iv, int enc); +__owur int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, + int *outl, const unsigned char *in, int inl); +__owur int EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, + int *outl); +__owur int EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, + int *outl); + +__owur int EVP_SignFinal(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *s, + EVP_PKEY *pkey); + +__owur int EVP_DigestSign(EVP_MD_CTX *ctx, unsigned char *sigret, + size_t *siglen, const unsigned char *tbs, + size_t tbslen); + +__owur int EVP_VerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sigbuf, + unsigned int siglen, EVP_PKEY *pkey); + +__owur int EVP_DigestVerify(EVP_MD_CTX *ctx, const unsigned char *sigret, + size_t siglen, const unsigned char *tbs, + size_t tbslen); + +/*__owur*/ int EVP_DigestSignInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, + const EVP_MD *type, ENGINE *e, + EVP_PKEY *pkey); +__owur int EVP_DigestSignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, + size_t *siglen); + +__owur int EVP_DigestVerifyInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, + const EVP_MD *type, ENGINE *e, + EVP_PKEY *pkey); +__owur int EVP_DigestVerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sig, + size_t siglen); + +# ifndef OPENSSL_NO_RSA +__owur int EVP_OpenInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, + const unsigned char *ek, int ekl, + const unsigned char *iv, EVP_PKEY *priv); +__owur int EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); + +__owur int EVP_SealInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, + unsigned char **ek, int *ekl, unsigned char *iv, + EVP_PKEY **pubk, int npubk); +__owur int EVP_SealFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); +# endif + +EVP_ENCODE_CTX *EVP_ENCODE_CTX_new(void); +void EVP_ENCODE_CTX_free(EVP_ENCODE_CTX *ctx); +int EVP_ENCODE_CTX_copy(EVP_ENCODE_CTX *dctx, EVP_ENCODE_CTX *sctx); +int EVP_ENCODE_CTX_num(EVP_ENCODE_CTX *ctx); +void EVP_EncodeInit(EVP_ENCODE_CTX *ctx); +int EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, + const unsigned char *in, int inl); +void EVP_EncodeFinal(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl); +int EVP_EncodeBlock(unsigned char *t, const unsigned char *f, int n); + +void EVP_DecodeInit(EVP_ENCODE_CTX *ctx); +int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, + const unsigned char *in, int inl); +int EVP_DecodeFinal(EVP_ENCODE_CTX *ctx, unsigned + char *out, int *outl); +int EVP_DecodeBlock(unsigned char *t, const unsigned char *f, int n); + +# if OPENSSL_API_COMPAT < 0x10100000L +# define EVP_CIPHER_CTX_init(c) EVP_CIPHER_CTX_reset(c) +# define EVP_CIPHER_CTX_cleanup(c) EVP_CIPHER_CTX_reset(c) +# endif +EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void); +int EVP_CIPHER_CTX_reset(EVP_CIPHER_CTX *c); +void EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *c); +int EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *x, int keylen); +int EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *c, int pad); +int EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr); +int EVP_CIPHER_CTX_rand_key(EVP_CIPHER_CTX *ctx, unsigned char *key); + +const BIO_METHOD *BIO_f_md(void); +const BIO_METHOD *BIO_f_base64(void); +const BIO_METHOD *BIO_f_cipher(void); +const BIO_METHOD *BIO_f_reliable(void); +__owur int BIO_set_cipher(BIO *b, const EVP_CIPHER *c, const unsigned char *k, + const unsigned char *i, int enc); + +const EVP_MD *EVP_md_null(void); +# ifndef OPENSSL_NO_MD2 +const EVP_MD *EVP_md2(void); +# endif +# ifndef OPENSSL_NO_MD4 +const EVP_MD *EVP_md4(void); +# endif +# ifndef OPENSSL_NO_MD5 +const EVP_MD *EVP_md5(void); +const EVP_MD *EVP_md5_sha1(void); +# endif +# ifndef OPENSSL_NO_BLAKE2 +const EVP_MD *EVP_blake2b512(void); +const EVP_MD *EVP_blake2s256(void); +# endif +const EVP_MD *EVP_sha1(void); +const EVP_MD *EVP_sha224(void); +const EVP_MD *EVP_sha256(void); +const EVP_MD *EVP_sha384(void); +const EVP_MD *EVP_sha512(void); +const EVP_MD *EVP_sha512_224(void); +const EVP_MD *EVP_sha512_256(void); +const EVP_MD *EVP_sha3_224(void); +const EVP_MD *EVP_sha3_256(void); +const EVP_MD *EVP_sha3_384(void); +const EVP_MD *EVP_sha3_512(void); +const EVP_MD *EVP_shake128(void); +const EVP_MD *EVP_shake256(void); +# ifndef OPENSSL_NO_MDC2 +const EVP_MD *EVP_mdc2(void); +# endif +# ifndef OPENSSL_NO_RMD160 +const EVP_MD *EVP_ripemd160(void); +# endif +# ifndef OPENSSL_NO_WHIRLPOOL +const EVP_MD *EVP_whirlpool(void); +# endif +# ifndef OPENSSL_NO_SM3 +const EVP_MD *EVP_sm3(void); +# endif +const EVP_CIPHER *EVP_enc_null(void); /* does nothing :-) */ +# ifndef OPENSSL_NO_DES +const EVP_CIPHER *EVP_des_ecb(void); +const EVP_CIPHER *EVP_des_ede(void); +const EVP_CIPHER *EVP_des_ede3(void); +const EVP_CIPHER *EVP_des_ede_ecb(void); +const EVP_CIPHER *EVP_des_ede3_ecb(void); +const EVP_CIPHER *EVP_des_cfb64(void); +# define EVP_des_cfb EVP_des_cfb64 +const EVP_CIPHER *EVP_des_cfb1(void); +const EVP_CIPHER *EVP_des_cfb8(void); +const EVP_CIPHER *EVP_des_ede_cfb64(void); +# define EVP_des_ede_cfb EVP_des_ede_cfb64 +const EVP_CIPHER *EVP_des_ede3_cfb64(void); +# define EVP_des_ede3_cfb EVP_des_ede3_cfb64 +const EVP_CIPHER *EVP_des_ede3_cfb1(void); +const EVP_CIPHER *EVP_des_ede3_cfb8(void); +const EVP_CIPHER *EVP_des_ofb(void); +const EVP_CIPHER *EVP_des_ede_ofb(void); +const EVP_CIPHER *EVP_des_ede3_ofb(void); +const EVP_CIPHER *EVP_des_cbc(void); +const EVP_CIPHER *EVP_des_ede_cbc(void); +const EVP_CIPHER *EVP_des_ede3_cbc(void); +const EVP_CIPHER *EVP_desx_cbc(void); +const EVP_CIPHER *EVP_des_ede3_wrap(void); +/* + * This should now be supported through the dev_crypto ENGINE. But also, why + * are rc4 and md5 declarations made here inside a "NO_DES" precompiler + * branch? + */ +# endif +# ifndef OPENSSL_NO_RC4 +const EVP_CIPHER *EVP_rc4(void); +const EVP_CIPHER *EVP_rc4_40(void); +# ifndef OPENSSL_NO_MD5 +const EVP_CIPHER *EVP_rc4_hmac_md5(void); +# endif +# endif +# ifndef OPENSSL_NO_IDEA +const EVP_CIPHER *EVP_idea_ecb(void); +const EVP_CIPHER *EVP_idea_cfb64(void); +# define EVP_idea_cfb EVP_idea_cfb64 +const EVP_CIPHER *EVP_idea_ofb(void); +const EVP_CIPHER *EVP_idea_cbc(void); +# endif +# ifndef OPENSSL_NO_RC2 +const EVP_CIPHER *EVP_rc2_ecb(void); +const EVP_CIPHER *EVP_rc2_cbc(void); +const EVP_CIPHER *EVP_rc2_40_cbc(void); +const EVP_CIPHER *EVP_rc2_64_cbc(void); +const EVP_CIPHER *EVP_rc2_cfb64(void); +# define EVP_rc2_cfb EVP_rc2_cfb64 +const EVP_CIPHER *EVP_rc2_ofb(void); +# endif +# ifndef OPENSSL_NO_BF +const EVP_CIPHER *EVP_bf_ecb(void); +const EVP_CIPHER *EVP_bf_cbc(void); +const EVP_CIPHER *EVP_bf_cfb64(void); +# define EVP_bf_cfb EVP_bf_cfb64 +const EVP_CIPHER *EVP_bf_ofb(void); +# endif +# ifndef OPENSSL_NO_CAST +const EVP_CIPHER *EVP_cast5_ecb(void); +const EVP_CIPHER *EVP_cast5_cbc(void); +const EVP_CIPHER *EVP_cast5_cfb64(void); +# define EVP_cast5_cfb EVP_cast5_cfb64 +const EVP_CIPHER *EVP_cast5_ofb(void); +# endif +# ifndef OPENSSL_NO_RC5 +const EVP_CIPHER *EVP_rc5_32_12_16_cbc(void); +const EVP_CIPHER *EVP_rc5_32_12_16_ecb(void); +const EVP_CIPHER *EVP_rc5_32_12_16_cfb64(void); +# define EVP_rc5_32_12_16_cfb EVP_rc5_32_12_16_cfb64 +const EVP_CIPHER *EVP_rc5_32_12_16_ofb(void); +# endif +const EVP_CIPHER *EVP_aes_128_ecb(void); +const EVP_CIPHER *EVP_aes_128_cbc(void); +const EVP_CIPHER *EVP_aes_128_cfb1(void); +const EVP_CIPHER *EVP_aes_128_cfb8(void); +const EVP_CIPHER *EVP_aes_128_cfb128(void); +# define EVP_aes_128_cfb EVP_aes_128_cfb128 +const EVP_CIPHER *EVP_aes_128_ofb(void); +const EVP_CIPHER *EVP_aes_128_ctr(void); +const EVP_CIPHER *EVP_aes_128_ccm(void); +const EVP_CIPHER *EVP_aes_128_gcm(void); +const EVP_CIPHER *EVP_aes_128_xts(void); +const EVP_CIPHER *EVP_aes_128_wrap(void); +const EVP_CIPHER *EVP_aes_128_wrap_pad(void); +# ifndef OPENSSL_NO_OCB +const EVP_CIPHER *EVP_aes_128_ocb(void); +# endif +const EVP_CIPHER *EVP_aes_192_ecb(void); +const EVP_CIPHER *EVP_aes_192_cbc(void); +const EVP_CIPHER *EVP_aes_192_cfb1(void); +const EVP_CIPHER *EVP_aes_192_cfb8(void); +const EVP_CIPHER *EVP_aes_192_cfb128(void); +# define EVP_aes_192_cfb EVP_aes_192_cfb128 +const EVP_CIPHER *EVP_aes_192_ofb(void); +const EVP_CIPHER *EVP_aes_192_ctr(void); +const EVP_CIPHER *EVP_aes_192_ccm(void); +const EVP_CIPHER *EVP_aes_192_gcm(void); +const EVP_CIPHER *EVP_aes_192_wrap(void); +const EVP_CIPHER *EVP_aes_192_wrap_pad(void); +# ifndef OPENSSL_NO_OCB +const EVP_CIPHER *EVP_aes_192_ocb(void); +# endif +const EVP_CIPHER *EVP_aes_256_ecb(void); +const EVP_CIPHER *EVP_aes_256_cbc(void); +const EVP_CIPHER *EVP_aes_256_cfb1(void); +const EVP_CIPHER *EVP_aes_256_cfb8(void); +const EVP_CIPHER *EVP_aes_256_cfb128(void); +# define EVP_aes_256_cfb EVP_aes_256_cfb128 +const EVP_CIPHER *EVP_aes_256_ofb(void); +const EVP_CIPHER *EVP_aes_256_ctr(void); +const EVP_CIPHER *EVP_aes_256_ccm(void); +const EVP_CIPHER *EVP_aes_256_gcm(void); +const EVP_CIPHER *EVP_aes_256_xts(void); +const EVP_CIPHER *EVP_aes_256_wrap(void); +const EVP_CIPHER *EVP_aes_256_wrap_pad(void); +# ifndef OPENSSL_NO_OCB +const EVP_CIPHER *EVP_aes_256_ocb(void); +# endif +const EVP_CIPHER *EVP_aes_128_cbc_hmac_sha1(void); +const EVP_CIPHER *EVP_aes_256_cbc_hmac_sha1(void); +const EVP_CIPHER *EVP_aes_128_cbc_hmac_sha256(void); +const EVP_CIPHER *EVP_aes_256_cbc_hmac_sha256(void); +# ifndef OPENSSL_NO_ARIA +const EVP_CIPHER *EVP_aria_128_ecb(void); +const EVP_CIPHER *EVP_aria_128_cbc(void); +const EVP_CIPHER *EVP_aria_128_cfb1(void); +const EVP_CIPHER *EVP_aria_128_cfb8(void); +const EVP_CIPHER *EVP_aria_128_cfb128(void); +# define EVP_aria_128_cfb EVP_aria_128_cfb128 +const EVP_CIPHER *EVP_aria_128_ctr(void); +const EVP_CIPHER *EVP_aria_128_ofb(void); +const EVP_CIPHER *EVP_aria_128_gcm(void); +const EVP_CIPHER *EVP_aria_128_ccm(void); +const EVP_CIPHER *EVP_aria_192_ecb(void); +const EVP_CIPHER *EVP_aria_192_cbc(void); +const EVP_CIPHER *EVP_aria_192_cfb1(void); +const EVP_CIPHER *EVP_aria_192_cfb8(void); +const EVP_CIPHER *EVP_aria_192_cfb128(void); +# define EVP_aria_192_cfb EVP_aria_192_cfb128 +const EVP_CIPHER *EVP_aria_192_ctr(void); +const EVP_CIPHER *EVP_aria_192_ofb(void); +const EVP_CIPHER *EVP_aria_192_gcm(void); +const EVP_CIPHER *EVP_aria_192_ccm(void); +const EVP_CIPHER *EVP_aria_256_ecb(void); +const EVP_CIPHER *EVP_aria_256_cbc(void); +const EVP_CIPHER *EVP_aria_256_cfb1(void); +const EVP_CIPHER *EVP_aria_256_cfb8(void); +const EVP_CIPHER *EVP_aria_256_cfb128(void); +# define EVP_aria_256_cfb EVP_aria_256_cfb128 +const EVP_CIPHER *EVP_aria_256_ctr(void); +const EVP_CIPHER *EVP_aria_256_ofb(void); +const EVP_CIPHER *EVP_aria_256_gcm(void); +const EVP_CIPHER *EVP_aria_256_ccm(void); +# endif +# ifndef OPENSSL_NO_CAMELLIA +const EVP_CIPHER *EVP_camellia_128_ecb(void); +const EVP_CIPHER *EVP_camellia_128_cbc(void); +const EVP_CIPHER *EVP_camellia_128_cfb1(void); +const EVP_CIPHER *EVP_camellia_128_cfb8(void); +const EVP_CIPHER *EVP_camellia_128_cfb128(void); +# define EVP_camellia_128_cfb EVP_camellia_128_cfb128 +const EVP_CIPHER *EVP_camellia_128_ofb(void); +const EVP_CIPHER *EVP_camellia_128_ctr(void); +const EVP_CIPHER *EVP_camellia_192_ecb(void); +const EVP_CIPHER *EVP_camellia_192_cbc(void); +const EVP_CIPHER *EVP_camellia_192_cfb1(void); +const EVP_CIPHER *EVP_camellia_192_cfb8(void); +const EVP_CIPHER *EVP_camellia_192_cfb128(void); +# define EVP_camellia_192_cfb EVP_camellia_192_cfb128 +const EVP_CIPHER *EVP_camellia_192_ofb(void); +const EVP_CIPHER *EVP_camellia_192_ctr(void); +const EVP_CIPHER *EVP_camellia_256_ecb(void); +const EVP_CIPHER *EVP_camellia_256_cbc(void); +const EVP_CIPHER *EVP_camellia_256_cfb1(void); +const EVP_CIPHER *EVP_camellia_256_cfb8(void); +const EVP_CIPHER *EVP_camellia_256_cfb128(void); +# define EVP_camellia_256_cfb EVP_camellia_256_cfb128 +const EVP_CIPHER *EVP_camellia_256_ofb(void); +const EVP_CIPHER *EVP_camellia_256_ctr(void); +# endif +# ifndef OPENSSL_NO_CHACHA +const EVP_CIPHER *EVP_chacha20(void); +# ifndef OPENSSL_NO_POLY1305 +const EVP_CIPHER *EVP_chacha20_poly1305(void); +# endif +# endif + +# ifndef OPENSSL_NO_SEED +const EVP_CIPHER *EVP_seed_ecb(void); +const EVP_CIPHER *EVP_seed_cbc(void); +const EVP_CIPHER *EVP_seed_cfb128(void); +# define EVP_seed_cfb EVP_seed_cfb128 +const EVP_CIPHER *EVP_seed_ofb(void); +# endif + +# ifndef OPENSSL_NO_SM4 +const EVP_CIPHER *EVP_sm4_ecb(void); +const EVP_CIPHER *EVP_sm4_cbc(void); +const EVP_CIPHER *EVP_sm4_cfb128(void); +# define EVP_sm4_cfb EVP_sm4_cfb128 +const EVP_CIPHER *EVP_sm4_ofb(void); +const EVP_CIPHER *EVP_sm4_ctr(void); +# endif + +# if OPENSSL_API_COMPAT < 0x10100000L +# define OPENSSL_add_all_algorithms_conf() \ + OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS \ + | OPENSSL_INIT_ADD_ALL_DIGESTS \ + | OPENSSL_INIT_LOAD_CONFIG, NULL) +# define OPENSSL_add_all_algorithms_noconf() \ + OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS \ + | OPENSSL_INIT_ADD_ALL_DIGESTS, NULL) + +# ifdef OPENSSL_LOAD_CONF +# define OpenSSL_add_all_algorithms() OPENSSL_add_all_algorithms_conf() +# else +# define OpenSSL_add_all_algorithms() OPENSSL_add_all_algorithms_noconf() +# endif + +# define OpenSSL_add_all_ciphers() \ + OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS, NULL) +# define OpenSSL_add_all_digests() \ + OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_DIGESTS, NULL) + +# define EVP_cleanup() while(0) continue +# endif + +int EVP_add_cipher(const EVP_CIPHER *cipher); +int EVP_add_digest(const EVP_MD *digest); + +const EVP_CIPHER *EVP_get_cipherbyname(const char *name); +const EVP_MD *EVP_get_digestbyname(const char *name); + +void EVP_CIPHER_do_all(void (*fn) (const EVP_CIPHER *ciph, + const char *from, const char *to, void *x), + void *arg); +void EVP_CIPHER_do_all_sorted(void (*fn) + (const EVP_CIPHER *ciph, const char *from, + const char *to, void *x), void *arg); + +void EVP_MD_do_all(void (*fn) (const EVP_MD *ciph, + const char *from, const char *to, void *x), + void *arg); +void EVP_MD_do_all_sorted(void (*fn) + (const EVP_MD *ciph, const char *from, + const char *to, void *x), void *arg); + +int EVP_PKEY_decrypt_old(unsigned char *dec_key, + const unsigned char *enc_key, int enc_key_len, + EVP_PKEY *private_key); +int EVP_PKEY_encrypt_old(unsigned char *enc_key, + const unsigned char *key, int key_len, + EVP_PKEY *pub_key); +int EVP_PKEY_type(int type); +int EVP_PKEY_id(const EVP_PKEY *pkey); +int EVP_PKEY_base_id(const EVP_PKEY *pkey); +int EVP_PKEY_bits(const EVP_PKEY *pkey); +int EVP_PKEY_security_bits(const EVP_PKEY *pkey); +int EVP_PKEY_size(const EVP_PKEY *pkey); +int EVP_PKEY_set_type(EVP_PKEY *pkey, int type); +int EVP_PKEY_set_type_str(EVP_PKEY *pkey, const char *str, int len); +int EVP_PKEY_set_alias_type(EVP_PKEY *pkey, int type); +# ifndef OPENSSL_NO_ENGINE +int EVP_PKEY_set1_engine(EVP_PKEY *pkey, ENGINE *e); +ENGINE *EVP_PKEY_get0_engine(const EVP_PKEY *pkey); +# endif +int EVP_PKEY_assign(EVP_PKEY *pkey, int type, void *key); +void *EVP_PKEY_get0(const EVP_PKEY *pkey); +const unsigned char *EVP_PKEY_get0_hmac(const EVP_PKEY *pkey, size_t *len); +# ifndef OPENSSL_NO_POLY1305 +const unsigned char *EVP_PKEY_get0_poly1305(const EVP_PKEY *pkey, size_t *len); +# endif +# ifndef OPENSSL_NO_SIPHASH +const unsigned char *EVP_PKEY_get0_siphash(const EVP_PKEY *pkey, size_t *len); +# endif + +# ifndef OPENSSL_NO_RSA +struct rsa_st; +int EVP_PKEY_set1_RSA(EVP_PKEY *pkey, struct rsa_st *key); +struct rsa_st *EVP_PKEY_get0_RSA(EVP_PKEY *pkey); +struct rsa_st *EVP_PKEY_get1_RSA(EVP_PKEY *pkey); +# endif +# ifndef OPENSSL_NO_DSA +struct dsa_st; +int EVP_PKEY_set1_DSA(EVP_PKEY *pkey, struct dsa_st *key); +struct dsa_st *EVP_PKEY_get0_DSA(EVP_PKEY *pkey); +struct dsa_st *EVP_PKEY_get1_DSA(EVP_PKEY *pkey); +# endif +# ifndef OPENSSL_NO_DH +struct dh_st; +int EVP_PKEY_set1_DH(EVP_PKEY *pkey, struct dh_st *key); +struct dh_st *EVP_PKEY_get0_DH(EVP_PKEY *pkey); +struct dh_st *EVP_PKEY_get1_DH(EVP_PKEY *pkey); +# endif +# ifndef OPENSSL_NO_EC +struct ec_key_st; +int EVP_PKEY_set1_EC_KEY(EVP_PKEY *pkey, struct ec_key_st *key); +struct ec_key_st *EVP_PKEY_get0_EC_KEY(EVP_PKEY *pkey); +struct ec_key_st *EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey); +# endif + +EVP_PKEY *EVP_PKEY_new(void); +int EVP_PKEY_up_ref(EVP_PKEY *pkey); +void EVP_PKEY_free(EVP_PKEY *pkey); + +EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, const unsigned char **pp, + long length); +int i2d_PublicKey(EVP_PKEY *a, unsigned char **pp); + +EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, const unsigned char **pp, + long length); +EVP_PKEY *d2i_AutoPrivateKey(EVP_PKEY **a, const unsigned char **pp, + long length); +int i2d_PrivateKey(EVP_PKEY *a, unsigned char **pp); + +int EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from); +int EVP_PKEY_missing_parameters(const EVP_PKEY *pkey); +int EVP_PKEY_save_parameters(EVP_PKEY *pkey, int mode); +int EVP_PKEY_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b); + +int EVP_PKEY_cmp(const EVP_PKEY *a, const EVP_PKEY *b); + +int EVP_PKEY_print_public(BIO *out, const EVP_PKEY *pkey, + int indent, ASN1_PCTX *pctx); +int EVP_PKEY_print_private(BIO *out, const EVP_PKEY *pkey, + int indent, ASN1_PCTX *pctx); +int EVP_PKEY_print_params(BIO *out, const EVP_PKEY *pkey, + int indent, ASN1_PCTX *pctx); + +int EVP_PKEY_get_default_digest_nid(EVP_PKEY *pkey, int *pnid); + +int EVP_PKEY_set1_tls_encodedpoint(EVP_PKEY *pkey, + const unsigned char *pt, size_t ptlen); +size_t EVP_PKEY_get1_tls_encodedpoint(EVP_PKEY *pkey, unsigned char **ppt); + +int EVP_CIPHER_type(const EVP_CIPHER *ctx); + +/* calls methods */ +int EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *c, ASN1_TYPE *type); +int EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *c, ASN1_TYPE *type); + +/* These are used by EVP_CIPHER methods */ +int EVP_CIPHER_set_asn1_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type); +int EVP_CIPHER_get_asn1_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type); + +/* PKCS5 password based encryption */ +int PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, + ASN1_TYPE *param, const EVP_CIPHER *cipher, + const EVP_MD *md, int en_de); +int PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen, + const unsigned char *salt, int saltlen, int iter, + int keylen, unsigned char *out); +int PKCS5_PBKDF2_HMAC(const char *pass, int passlen, + const unsigned char *salt, int saltlen, int iter, + const EVP_MD *digest, int keylen, unsigned char *out); +int PKCS5_v2_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, + ASN1_TYPE *param, const EVP_CIPHER *cipher, + const EVP_MD *md, int en_de); + +#ifndef OPENSSL_NO_SCRYPT +int EVP_PBE_scrypt(const char *pass, size_t passlen, + const unsigned char *salt, size_t saltlen, + uint64_t N, uint64_t r, uint64_t p, uint64_t maxmem, + unsigned char *key, size_t keylen); + +int PKCS5_v2_scrypt_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, + int passlen, ASN1_TYPE *param, + const EVP_CIPHER *c, const EVP_MD *md, int en_de); +#endif + +void PKCS5_PBE_add(void); + +int EVP_PBE_CipherInit(ASN1_OBJECT *pbe_obj, const char *pass, int passlen, + ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de); + +/* PBE type */ + +/* Can appear as the outermost AlgorithmIdentifier */ +# define EVP_PBE_TYPE_OUTER 0x0 +/* Is an PRF type OID */ +# define EVP_PBE_TYPE_PRF 0x1 +/* Is a PKCS#5 v2.0 KDF */ +# define EVP_PBE_TYPE_KDF 0x2 + +int EVP_PBE_alg_add_type(int pbe_type, int pbe_nid, int cipher_nid, + int md_nid, EVP_PBE_KEYGEN *keygen); +int EVP_PBE_alg_add(int nid, const EVP_CIPHER *cipher, const EVP_MD *md, + EVP_PBE_KEYGEN *keygen); +int EVP_PBE_find(int type, int pbe_nid, int *pcnid, int *pmnid, + EVP_PBE_KEYGEN **pkeygen); +void EVP_PBE_cleanup(void); +int EVP_PBE_get(int *ptype, int *ppbe_nid, size_t num); + +# define ASN1_PKEY_ALIAS 0x1 +# define ASN1_PKEY_DYNAMIC 0x2 +# define ASN1_PKEY_SIGPARAM_NULL 0x4 + +# define ASN1_PKEY_CTRL_PKCS7_SIGN 0x1 +# define ASN1_PKEY_CTRL_PKCS7_ENCRYPT 0x2 +# define ASN1_PKEY_CTRL_DEFAULT_MD_NID 0x3 +# define ASN1_PKEY_CTRL_CMS_SIGN 0x5 +# define ASN1_PKEY_CTRL_CMS_ENVELOPE 0x7 +# define ASN1_PKEY_CTRL_CMS_RI_TYPE 0x8 + +# define ASN1_PKEY_CTRL_SET1_TLS_ENCPT 0x9 +# define ASN1_PKEY_CTRL_GET1_TLS_ENCPT 0xa + +int EVP_PKEY_asn1_get_count(void); +const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_get0(int idx); +const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find(ENGINE **pe, int type); +const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find_str(ENGINE **pe, + const char *str, int len); +int EVP_PKEY_asn1_add0(const EVP_PKEY_ASN1_METHOD *ameth); +int EVP_PKEY_asn1_add_alias(int to, int from); +int EVP_PKEY_asn1_get0_info(int *ppkey_id, int *pkey_base_id, + int *ppkey_flags, const char **pinfo, + const char **ppem_str, + const EVP_PKEY_ASN1_METHOD *ameth); + +const EVP_PKEY_ASN1_METHOD *EVP_PKEY_get0_asn1(const EVP_PKEY *pkey); +EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_new(int id, int flags, + const char *pem_str, + const char *info); +void EVP_PKEY_asn1_copy(EVP_PKEY_ASN1_METHOD *dst, + const EVP_PKEY_ASN1_METHOD *src); +void EVP_PKEY_asn1_free(EVP_PKEY_ASN1_METHOD *ameth); +void EVP_PKEY_asn1_set_public(EVP_PKEY_ASN1_METHOD *ameth, + int (*pub_decode) (EVP_PKEY *pk, + X509_PUBKEY *pub), + int (*pub_encode) (X509_PUBKEY *pub, + const EVP_PKEY *pk), + int (*pub_cmp) (const EVP_PKEY *a, + const EVP_PKEY *b), + int (*pub_print) (BIO *out, + const EVP_PKEY *pkey, + int indent, ASN1_PCTX *pctx), + int (*pkey_size) (const EVP_PKEY *pk), + int (*pkey_bits) (const EVP_PKEY *pk)); +void EVP_PKEY_asn1_set_private(EVP_PKEY_ASN1_METHOD *ameth, + int (*priv_decode) (EVP_PKEY *pk, + const PKCS8_PRIV_KEY_INFO + *p8inf), + int (*priv_encode) (PKCS8_PRIV_KEY_INFO *p8, + const EVP_PKEY *pk), + int (*priv_print) (BIO *out, + const EVP_PKEY *pkey, + int indent, + ASN1_PCTX *pctx)); +void EVP_PKEY_asn1_set_param(EVP_PKEY_ASN1_METHOD *ameth, + int (*param_decode) (EVP_PKEY *pkey, + const unsigned char **pder, + int derlen), + int (*param_encode) (const EVP_PKEY *pkey, + unsigned char **pder), + int (*param_missing) (const EVP_PKEY *pk), + int (*param_copy) (EVP_PKEY *to, + const EVP_PKEY *from), + int (*param_cmp) (const EVP_PKEY *a, + const EVP_PKEY *b), + int (*param_print) (BIO *out, + const EVP_PKEY *pkey, + int indent, + ASN1_PCTX *pctx)); + +void EVP_PKEY_asn1_set_free(EVP_PKEY_ASN1_METHOD *ameth, + void (*pkey_free) (EVP_PKEY *pkey)); +void EVP_PKEY_asn1_set_ctrl(EVP_PKEY_ASN1_METHOD *ameth, + int (*pkey_ctrl) (EVP_PKEY *pkey, int op, + long arg1, void *arg2)); +void EVP_PKEY_asn1_set_item(EVP_PKEY_ASN1_METHOD *ameth, + int (*item_verify) (EVP_MD_CTX *ctx, + const ASN1_ITEM *it, + void *asn, + X509_ALGOR *a, + ASN1_BIT_STRING *sig, + EVP_PKEY *pkey), + int (*item_sign) (EVP_MD_CTX *ctx, + const ASN1_ITEM *it, + void *asn, + X509_ALGOR *alg1, + X509_ALGOR *alg2, + ASN1_BIT_STRING *sig)); + +void EVP_PKEY_asn1_set_siginf(EVP_PKEY_ASN1_METHOD *ameth, + int (*siginf_set) (X509_SIG_INFO *siginf, + const X509_ALGOR *alg, + const ASN1_STRING *sig)); + +void EVP_PKEY_asn1_set_check(EVP_PKEY_ASN1_METHOD *ameth, + int (*pkey_check) (const EVP_PKEY *pk)); + +void EVP_PKEY_asn1_set_public_check(EVP_PKEY_ASN1_METHOD *ameth, + int (*pkey_pub_check) (const EVP_PKEY *pk)); + +void EVP_PKEY_asn1_set_param_check(EVP_PKEY_ASN1_METHOD *ameth, + int (*pkey_param_check) (const EVP_PKEY *pk)); + +void EVP_PKEY_asn1_set_set_priv_key(EVP_PKEY_ASN1_METHOD *ameth, + int (*set_priv_key) (EVP_PKEY *pk, + const unsigned char + *priv, + size_t len)); +void EVP_PKEY_asn1_set_set_pub_key(EVP_PKEY_ASN1_METHOD *ameth, + int (*set_pub_key) (EVP_PKEY *pk, + const unsigned char *pub, + size_t len)); +void EVP_PKEY_asn1_set_get_priv_key(EVP_PKEY_ASN1_METHOD *ameth, + int (*get_priv_key) (const EVP_PKEY *pk, + unsigned char *priv, + size_t *len)); +void EVP_PKEY_asn1_set_get_pub_key(EVP_PKEY_ASN1_METHOD *ameth, + int (*get_pub_key) (const EVP_PKEY *pk, + unsigned char *pub, + size_t *len)); + +void EVP_PKEY_asn1_set_security_bits(EVP_PKEY_ASN1_METHOD *ameth, + int (*pkey_security_bits) (const EVP_PKEY + *pk)); + +# define EVP_PKEY_OP_UNDEFINED 0 +# define EVP_PKEY_OP_PARAMGEN (1<<1) +# define EVP_PKEY_OP_KEYGEN (1<<2) +# define EVP_PKEY_OP_SIGN (1<<3) +# define EVP_PKEY_OP_VERIFY (1<<4) +# define EVP_PKEY_OP_VERIFYRECOVER (1<<5) +# define EVP_PKEY_OP_SIGNCTX (1<<6) +# define EVP_PKEY_OP_VERIFYCTX (1<<7) +# define EVP_PKEY_OP_ENCRYPT (1<<8) +# define EVP_PKEY_OP_DECRYPT (1<<9) +# define EVP_PKEY_OP_DERIVE (1<<10) + +# define EVP_PKEY_OP_TYPE_SIG \ + (EVP_PKEY_OP_SIGN | EVP_PKEY_OP_VERIFY | EVP_PKEY_OP_VERIFYRECOVER \ + | EVP_PKEY_OP_SIGNCTX | EVP_PKEY_OP_VERIFYCTX) + +# define EVP_PKEY_OP_TYPE_CRYPT \ + (EVP_PKEY_OP_ENCRYPT | EVP_PKEY_OP_DECRYPT) + +# define EVP_PKEY_OP_TYPE_NOGEN \ + (EVP_PKEY_OP_TYPE_SIG | EVP_PKEY_OP_TYPE_CRYPT | EVP_PKEY_OP_DERIVE) + +# define EVP_PKEY_OP_TYPE_GEN \ + (EVP_PKEY_OP_PARAMGEN | EVP_PKEY_OP_KEYGEN) + +# define EVP_PKEY_CTX_set_signature_md(ctx, md) \ + EVP_PKEY_CTX_ctrl(ctx, -1, EVP_PKEY_OP_TYPE_SIG, \ + EVP_PKEY_CTRL_MD, 0, (void *)(md)) + +# define EVP_PKEY_CTX_get_signature_md(ctx, pmd) \ + EVP_PKEY_CTX_ctrl(ctx, -1, EVP_PKEY_OP_TYPE_SIG, \ + EVP_PKEY_CTRL_GET_MD, 0, (void *)(pmd)) + +# define EVP_PKEY_CTX_set_mac_key(ctx, key, len) \ + EVP_PKEY_CTX_ctrl(ctx, -1, EVP_PKEY_OP_KEYGEN, \ + EVP_PKEY_CTRL_SET_MAC_KEY, len, (void *)(key)) + +# define EVP_PKEY_CTRL_MD 1 +# define EVP_PKEY_CTRL_PEER_KEY 2 + +# define EVP_PKEY_CTRL_PKCS7_ENCRYPT 3 +# define EVP_PKEY_CTRL_PKCS7_DECRYPT 4 + +# define EVP_PKEY_CTRL_PKCS7_SIGN 5 + +# define EVP_PKEY_CTRL_SET_MAC_KEY 6 + +# define EVP_PKEY_CTRL_DIGESTINIT 7 + +/* Used by GOST key encryption in TLS */ +# define EVP_PKEY_CTRL_SET_IV 8 + +# define EVP_PKEY_CTRL_CMS_ENCRYPT 9 +# define EVP_PKEY_CTRL_CMS_DECRYPT 10 +# define EVP_PKEY_CTRL_CMS_SIGN 11 + +# define EVP_PKEY_CTRL_CIPHER 12 + +# define EVP_PKEY_CTRL_GET_MD 13 + +# define EVP_PKEY_CTRL_SET_DIGEST_SIZE 14 + +# define EVP_PKEY_ALG_CTRL 0x1000 + +# define EVP_PKEY_FLAG_AUTOARGLEN 2 +/* + * Method handles all operations: don't assume any digest related defaults. + */ +# define EVP_PKEY_FLAG_SIGCTX_CUSTOM 4 + +const EVP_PKEY_METHOD *EVP_PKEY_meth_find(int type); +EVP_PKEY_METHOD *EVP_PKEY_meth_new(int id, int flags); +void EVP_PKEY_meth_get0_info(int *ppkey_id, int *pflags, + const EVP_PKEY_METHOD *meth); +void EVP_PKEY_meth_copy(EVP_PKEY_METHOD *dst, const EVP_PKEY_METHOD *src); +void EVP_PKEY_meth_free(EVP_PKEY_METHOD *pmeth); +int EVP_PKEY_meth_add0(const EVP_PKEY_METHOD *pmeth); +int EVP_PKEY_meth_remove(const EVP_PKEY_METHOD *pmeth); +size_t EVP_PKEY_meth_get_count(void); +const EVP_PKEY_METHOD *EVP_PKEY_meth_get0(size_t idx); + +EVP_PKEY_CTX *EVP_PKEY_CTX_new(EVP_PKEY *pkey, ENGINE *e); +EVP_PKEY_CTX *EVP_PKEY_CTX_new_id(int id, ENGINE *e); +EVP_PKEY_CTX *EVP_PKEY_CTX_dup(EVP_PKEY_CTX *ctx); +void EVP_PKEY_CTX_free(EVP_PKEY_CTX *ctx); + +int EVP_PKEY_CTX_ctrl(EVP_PKEY_CTX *ctx, int keytype, int optype, + int cmd, int p1, void *p2); +int EVP_PKEY_CTX_ctrl_str(EVP_PKEY_CTX *ctx, const char *type, + const char *value); +int EVP_PKEY_CTX_ctrl_uint64(EVP_PKEY_CTX *ctx, int keytype, int optype, + int cmd, uint64_t value); + +int EVP_PKEY_CTX_str2ctrl(EVP_PKEY_CTX *ctx, int cmd, const char *str); +int EVP_PKEY_CTX_hex2ctrl(EVP_PKEY_CTX *ctx, int cmd, const char *hex); + +int EVP_PKEY_CTX_md(EVP_PKEY_CTX *ctx, int optype, int cmd, const char *md); + +int EVP_PKEY_CTX_get_operation(EVP_PKEY_CTX *ctx); +void EVP_PKEY_CTX_set0_keygen_info(EVP_PKEY_CTX *ctx, int *dat, int datlen); + +EVP_PKEY *EVP_PKEY_new_mac_key(int type, ENGINE *e, + const unsigned char *key, int keylen); +EVP_PKEY *EVP_PKEY_new_raw_private_key(int type, ENGINE *e, + const unsigned char *priv, + size_t len); +EVP_PKEY *EVP_PKEY_new_raw_public_key(int type, ENGINE *e, + const unsigned char *pub, + size_t len); +int EVP_PKEY_get_raw_private_key(const EVP_PKEY *pkey, unsigned char *priv, + size_t *len); +int EVP_PKEY_get_raw_public_key(const EVP_PKEY *pkey, unsigned char *pub, + size_t *len); + +EVP_PKEY *EVP_PKEY_new_CMAC_key(ENGINE *e, const unsigned char *priv, + size_t len, const EVP_CIPHER *cipher); + +void EVP_PKEY_CTX_set_data(EVP_PKEY_CTX *ctx, void *data); +void *EVP_PKEY_CTX_get_data(EVP_PKEY_CTX *ctx); +EVP_PKEY *EVP_PKEY_CTX_get0_pkey(EVP_PKEY_CTX *ctx); + +EVP_PKEY *EVP_PKEY_CTX_get0_peerkey(EVP_PKEY_CTX *ctx); + +void EVP_PKEY_CTX_set_app_data(EVP_PKEY_CTX *ctx, void *data); +void *EVP_PKEY_CTX_get_app_data(EVP_PKEY_CTX *ctx); + +int EVP_PKEY_sign_init(EVP_PKEY_CTX *ctx); +int EVP_PKEY_sign(EVP_PKEY_CTX *ctx, + unsigned char *sig, size_t *siglen, + const unsigned char *tbs, size_t tbslen); +int EVP_PKEY_verify_init(EVP_PKEY_CTX *ctx); +int EVP_PKEY_verify(EVP_PKEY_CTX *ctx, + const unsigned char *sig, size_t siglen, + const unsigned char *tbs, size_t tbslen); +int EVP_PKEY_verify_recover_init(EVP_PKEY_CTX *ctx); +int EVP_PKEY_verify_recover(EVP_PKEY_CTX *ctx, + unsigned char *rout, size_t *routlen, + const unsigned char *sig, size_t siglen); +int EVP_PKEY_encrypt_init(EVP_PKEY_CTX *ctx); +int EVP_PKEY_encrypt(EVP_PKEY_CTX *ctx, + unsigned char *out, size_t *outlen, + const unsigned char *in, size_t inlen); +int EVP_PKEY_decrypt_init(EVP_PKEY_CTX *ctx); +int EVP_PKEY_decrypt(EVP_PKEY_CTX *ctx, + unsigned char *out, size_t *outlen, + const unsigned char *in, size_t inlen); + +int EVP_PKEY_derive_init(EVP_PKEY_CTX *ctx); +int EVP_PKEY_derive_set_peer(EVP_PKEY_CTX *ctx, EVP_PKEY *peer); +int EVP_PKEY_derive(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen); + +typedef int EVP_PKEY_gen_cb(EVP_PKEY_CTX *ctx); + +int EVP_PKEY_paramgen_init(EVP_PKEY_CTX *ctx); +int EVP_PKEY_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey); +int EVP_PKEY_keygen_init(EVP_PKEY_CTX *ctx); +int EVP_PKEY_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey); +int EVP_PKEY_check(EVP_PKEY_CTX *ctx); +int EVP_PKEY_public_check(EVP_PKEY_CTX *ctx); +int EVP_PKEY_param_check(EVP_PKEY_CTX *ctx); + +void EVP_PKEY_CTX_set_cb(EVP_PKEY_CTX *ctx, EVP_PKEY_gen_cb *cb); +EVP_PKEY_gen_cb *EVP_PKEY_CTX_get_cb(EVP_PKEY_CTX *ctx); + +int EVP_PKEY_CTX_get_keygen_info(EVP_PKEY_CTX *ctx, int idx); + +void EVP_PKEY_meth_set_init(EVP_PKEY_METHOD *pmeth, + int (*init) (EVP_PKEY_CTX *ctx)); + +void EVP_PKEY_meth_set_copy(EVP_PKEY_METHOD *pmeth, + int (*copy) (EVP_PKEY_CTX *dst, + EVP_PKEY_CTX *src)); + +void EVP_PKEY_meth_set_cleanup(EVP_PKEY_METHOD *pmeth, + void (*cleanup) (EVP_PKEY_CTX *ctx)); + +void EVP_PKEY_meth_set_paramgen(EVP_PKEY_METHOD *pmeth, + int (*paramgen_init) (EVP_PKEY_CTX *ctx), + int (*paramgen) (EVP_PKEY_CTX *ctx, + EVP_PKEY *pkey)); + +void EVP_PKEY_meth_set_keygen(EVP_PKEY_METHOD *pmeth, + int (*keygen_init) (EVP_PKEY_CTX *ctx), + int (*keygen) (EVP_PKEY_CTX *ctx, + EVP_PKEY *pkey)); + +void EVP_PKEY_meth_set_sign(EVP_PKEY_METHOD *pmeth, + int (*sign_init) (EVP_PKEY_CTX *ctx), + int (*sign) (EVP_PKEY_CTX *ctx, + unsigned char *sig, size_t *siglen, + const unsigned char *tbs, + size_t tbslen)); + +void EVP_PKEY_meth_set_verify(EVP_PKEY_METHOD *pmeth, + int (*verify_init) (EVP_PKEY_CTX *ctx), + int (*verify) (EVP_PKEY_CTX *ctx, + const unsigned char *sig, + size_t siglen, + const unsigned char *tbs, + size_t tbslen)); + +void EVP_PKEY_meth_set_verify_recover(EVP_PKEY_METHOD *pmeth, + int (*verify_recover_init) (EVP_PKEY_CTX + *ctx), + int (*verify_recover) (EVP_PKEY_CTX + *ctx, + unsigned char + *sig, + size_t *siglen, + const unsigned + char *tbs, + size_t tbslen)); + +void EVP_PKEY_meth_set_signctx(EVP_PKEY_METHOD *pmeth, + int (*signctx_init) (EVP_PKEY_CTX *ctx, + EVP_MD_CTX *mctx), + int (*signctx) (EVP_PKEY_CTX *ctx, + unsigned char *sig, + size_t *siglen, + EVP_MD_CTX *mctx)); + +void EVP_PKEY_meth_set_verifyctx(EVP_PKEY_METHOD *pmeth, + int (*verifyctx_init) (EVP_PKEY_CTX *ctx, + EVP_MD_CTX *mctx), + int (*verifyctx) (EVP_PKEY_CTX *ctx, + const unsigned char *sig, + int siglen, + EVP_MD_CTX *mctx)); + +void EVP_PKEY_meth_set_encrypt(EVP_PKEY_METHOD *pmeth, + int (*encrypt_init) (EVP_PKEY_CTX *ctx), + int (*encryptfn) (EVP_PKEY_CTX *ctx, + unsigned char *out, + size_t *outlen, + const unsigned char *in, + size_t inlen)); + +void EVP_PKEY_meth_set_decrypt(EVP_PKEY_METHOD *pmeth, + int (*decrypt_init) (EVP_PKEY_CTX *ctx), + int (*decrypt) (EVP_PKEY_CTX *ctx, + unsigned char *out, + size_t *outlen, + const unsigned char *in, + size_t inlen)); + +void EVP_PKEY_meth_set_derive(EVP_PKEY_METHOD *pmeth, + int (*derive_init) (EVP_PKEY_CTX *ctx), + int (*derive) (EVP_PKEY_CTX *ctx, + unsigned char *key, + size_t *keylen)); + +void EVP_PKEY_meth_set_ctrl(EVP_PKEY_METHOD *pmeth, + int (*ctrl) (EVP_PKEY_CTX *ctx, int type, int p1, + void *p2), + int (*ctrl_str) (EVP_PKEY_CTX *ctx, + const char *type, + const char *value)); + +void EVP_PKEY_meth_set_digestsign(EVP_PKEY_METHOD *pmeth, + int (*digestsign) (EVP_MD_CTX *ctx, + unsigned char *sig, + size_t *siglen, + const unsigned char *tbs, + size_t tbslen)); + +void EVP_PKEY_meth_set_digestverify(EVP_PKEY_METHOD *pmeth, + int (*digestverify) (EVP_MD_CTX *ctx, + const unsigned char *sig, + size_t siglen, + const unsigned char *tbs, + size_t tbslen)); + +void EVP_PKEY_meth_set_check(EVP_PKEY_METHOD *pmeth, + int (*check) (EVP_PKEY *pkey)); + +void EVP_PKEY_meth_set_public_check(EVP_PKEY_METHOD *pmeth, + int (*check) (EVP_PKEY *pkey)); + +void EVP_PKEY_meth_set_param_check(EVP_PKEY_METHOD *pmeth, + int (*check) (EVP_PKEY *pkey)); + +void EVP_PKEY_meth_set_digest_custom(EVP_PKEY_METHOD *pmeth, + int (*digest_custom) (EVP_PKEY_CTX *ctx, + EVP_MD_CTX *mctx)); + +void EVP_PKEY_meth_get_init(const EVP_PKEY_METHOD *pmeth, + int (**pinit) (EVP_PKEY_CTX *ctx)); + +void EVP_PKEY_meth_get_copy(const EVP_PKEY_METHOD *pmeth, + int (**pcopy) (EVP_PKEY_CTX *dst, + EVP_PKEY_CTX *src)); + +void EVP_PKEY_meth_get_cleanup(const EVP_PKEY_METHOD *pmeth, + void (**pcleanup) (EVP_PKEY_CTX *ctx)); + +void EVP_PKEY_meth_get_paramgen(const EVP_PKEY_METHOD *pmeth, + int (**pparamgen_init) (EVP_PKEY_CTX *ctx), + int (**pparamgen) (EVP_PKEY_CTX *ctx, + EVP_PKEY *pkey)); + +void EVP_PKEY_meth_get_keygen(const EVP_PKEY_METHOD *pmeth, + int (**pkeygen_init) (EVP_PKEY_CTX *ctx), + int (**pkeygen) (EVP_PKEY_CTX *ctx, + EVP_PKEY *pkey)); + +void EVP_PKEY_meth_get_sign(const EVP_PKEY_METHOD *pmeth, + int (**psign_init) (EVP_PKEY_CTX *ctx), + int (**psign) (EVP_PKEY_CTX *ctx, + unsigned char *sig, size_t *siglen, + const unsigned char *tbs, + size_t tbslen)); + +void EVP_PKEY_meth_get_verify(const EVP_PKEY_METHOD *pmeth, + int (**pverify_init) (EVP_PKEY_CTX *ctx), + int (**pverify) (EVP_PKEY_CTX *ctx, + const unsigned char *sig, + size_t siglen, + const unsigned char *tbs, + size_t tbslen)); + +void EVP_PKEY_meth_get_verify_recover(const EVP_PKEY_METHOD *pmeth, + int (**pverify_recover_init) (EVP_PKEY_CTX + *ctx), + int (**pverify_recover) (EVP_PKEY_CTX + *ctx, + unsigned char + *sig, + size_t *siglen, + const unsigned + char *tbs, + size_t tbslen)); + +void EVP_PKEY_meth_get_signctx(const EVP_PKEY_METHOD *pmeth, + int (**psignctx_init) (EVP_PKEY_CTX *ctx, + EVP_MD_CTX *mctx), + int (**psignctx) (EVP_PKEY_CTX *ctx, + unsigned char *sig, + size_t *siglen, + EVP_MD_CTX *mctx)); + +void EVP_PKEY_meth_get_verifyctx(const EVP_PKEY_METHOD *pmeth, + int (**pverifyctx_init) (EVP_PKEY_CTX *ctx, + EVP_MD_CTX *mctx), + int (**pverifyctx) (EVP_PKEY_CTX *ctx, + const unsigned char *sig, + int siglen, + EVP_MD_CTX *mctx)); + +void EVP_PKEY_meth_get_encrypt(const EVP_PKEY_METHOD *pmeth, + int (**pencrypt_init) (EVP_PKEY_CTX *ctx), + int (**pencryptfn) (EVP_PKEY_CTX *ctx, + unsigned char *out, + size_t *outlen, + const unsigned char *in, + size_t inlen)); + +void EVP_PKEY_meth_get_decrypt(const EVP_PKEY_METHOD *pmeth, + int (**pdecrypt_init) (EVP_PKEY_CTX *ctx), + int (**pdecrypt) (EVP_PKEY_CTX *ctx, + unsigned char *out, + size_t *outlen, + const unsigned char *in, + size_t inlen)); + +void EVP_PKEY_meth_get_derive(const EVP_PKEY_METHOD *pmeth, + int (**pderive_init) (EVP_PKEY_CTX *ctx), + int (**pderive) (EVP_PKEY_CTX *ctx, + unsigned char *key, + size_t *keylen)); + +void EVP_PKEY_meth_get_ctrl(const EVP_PKEY_METHOD *pmeth, + int (**pctrl) (EVP_PKEY_CTX *ctx, int type, int p1, + void *p2), + int (**pctrl_str) (EVP_PKEY_CTX *ctx, + const char *type, + const char *value)); + +void EVP_PKEY_meth_get_digestsign(EVP_PKEY_METHOD *pmeth, + int (**digestsign) (EVP_MD_CTX *ctx, + unsigned char *sig, + size_t *siglen, + const unsigned char *tbs, + size_t tbslen)); + +void EVP_PKEY_meth_get_digestverify(EVP_PKEY_METHOD *pmeth, + int (**digestverify) (EVP_MD_CTX *ctx, + const unsigned char *sig, + size_t siglen, + const unsigned char *tbs, + size_t tbslen)); + +void EVP_PKEY_meth_get_check(const EVP_PKEY_METHOD *pmeth, + int (**pcheck) (EVP_PKEY *pkey)); + +void EVP_PKEY_meth_get_public_check(const EVP_PKEY_METHOD *pmeth, + int (**pcheck) (EVP_PKEY *pkey)); + +void EVP_PKEY_meth_get_param_check(const EVP_PKEY_METHOD *pmeth, + int (**pcheck) (EVP_PKEY *pkey)); + +void EVP_PKEY_meth_get_digest_custom(EVP_PKEY_METHOD *pmeth, + int (**pdigest_custom) (EVP_PKEY_CTX *ctx, + EVP_MD_CTX *mctx)); +void EVP_add_alg_module(void); + + +# ifdef __cplusplus +} +# endif +#endif diff --git a/ONVIF/include/openssl/include/openssl/evperr.h b/ONVIF/include/openssl/include/openssl/evperr.h new file mode 100644 index 0000000..d2b26ea --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/evperr.h @@ -0,0 +1,205 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_EVPERR_H +# define HEADER_EVPERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_EVP_strings(void); + +/* + * EVP function codes. + */ +# define EVP_F_AESNI_INIT_KEY 165 +# define EVP_F_AESNI_XTS_INIT_KEY 207 +# define EVP_F_AES_GCM_CTRL 196 +# define EVP_F_AES_INIT_KEY 133 +# define EVP_F_AES_OCB_CIPHER 169 +# define EVP_F_AES_T4_INIT_KEY 178 +# define EVP_F_AES_T4_XTS_INIT_KEY 208 +# define EVP_F_AES_WRAP_CIPHER 170 +# define EVP_F_AES_XTS_INIT_KEY 209 +# define EVP_F_ALG_MODULE_INIT 177 +# define EVP_F_ARIA_CCM_INIT_KEY 175 +# define EVP_F_ARIA_GCM_CTRL 197 +# define EVP_F_ARIA_GCM_INIT_KEY 176 +# define EVP_F_ARIA_INIT_KEY 185 +# define EVP_F_B64_NEW 198 +# define EVP_F_CAMELLIA_INIT_KEY 159 +# define EVP_F_CHACHA20_POLY1305_CTRL 182 +# define EVP_F_CMLL_T4_INIT_KEY 179 +# define EVP_F_DES_EDE3_WRAP_CIPHER 171 +# define EVP_F_DO_SIGVER_INIT 161 +# define EVP_F_ENC_NEW 199 +# define EVP_F_EVP_CIPHERINIT_EX 123 +# define EVP_F_EVP_CIPHER_ASN1_TO_PARAM 204 +# define EVP_F_EVP_CIPHER_CTX_COPY 163 +# define EVP_F_EVP_CIPHER_CTX_CTRL 124 +# define EVP_F_EVP_CIPHER_CTX_SET_KEY_LENGTH 122 +# define EVP_F_EVP_CIPHER_PARAM_TO_ASN1 205 +# define EVP_F_EVP_DECRYPTFINAL_EX 101 +# define EVP_F_EVP_DECRYPTUPDATE 166 +# define EVP_F_EVP_DIGESTFINALXOF 174 +# define EVP_F_EVP_DIGESTINIT_EX 128 +# define EVP_F_EVP_ENCRYPTDECRYPTUPDATE 219 +# define EVP_F_EVP_ENCRYPTFINAL_EX 127 +# define EVP_F_EVP_ENCRYPTUPDATE 167 +# define EVP_F_EVP_MD_CTX_COPY_EX 110 +# define EVP_F_EVP_MD_SIZE 162 +# define EVP_F_EVP_OPENINIT 102 +# define EVP_F_EVP_PBE_ALG_ADD 115 +# define EVP_F_EVP_PBE_ALG_ADD_TYPE 160 +# define EVP_F_EVP_PBE_CIPHERINIT 116 +# define EVP_F_EVP_PBE_SCRYPT 181 +# define EVP_F_EVP_PKCS82PKEY 111 +# define EVP_F_EVP_PKEY2PKCS8 113 +# define EVP_F_EVP_PKEY_ASN1_ADD0 188 +# define EVP_F_EVP_PKEY_CHECK 186 +# define EVP_F_EVP_PKEY_COPY_PARAMETERS 103 +# define EVP_F_EVP_PKEY_CTX_CTRL 137 +# define EVP_F_EVP_PKEY_CTX_CTRL_STR 150 +# define EVP_F_EVP_PKEY_CTX_DUP 156 +# define EVP_F_EVP_PKEY_CTX_MD 168 +# define EVP_F_EVP_PKEY_DECRYPT 104 +# define EVP_F_EVP_PKEY_DECRYPT_INIT 138 +# define EVP_F_EVP_PKEY_DECRYPT_OLD 151 +# define EVP_F_EVP_PKEY_DERIVE 153 +# define EVP_F_EVP_PKEY_DERIVE_INIT 154 +# define EVP_F_EVP_PKEY_DERIVE_SET_PEER 155 +# define EVP_F_EVP_PKEY_ENCRYPT 105 +# define EVP_F_EVP_PKEY_ENCRYPT_INIT 139 +# define EVP_F_EVP_PKEY_ENCRYPT_OLD 152 +# define EVP_F_EVP_PKEY_GET0_DH 119 +# define EVP_F_EVP_PKEY_GET0_DSA 120 +# define EVP_F_EVP_PKEY_GET0_EC_KEY 131 +# define EVP_F_EVP_PKEY_GET0_HMAC 183 +# define EVP_F_EVP_PKEY_GET0_POLY1305 184 +# define EVP_F_EVP_PKEY_GET0_RSA 121 +# define EVP_F_EVP_PKEY_GET0_SIPHASH 172 +# define EVP_F_EVP_PKEY_GET_RAW_PRIVATE_KEY 202 +# define EVP_F_EVP_PKEY_GET_RAW_PUBLIC_KEY 203 +# define EVP_F_EVP_PKEY_KEYGEN 146 +# define EVP_F_EVP_PKEY_KEYGEN_INIT 147 +# define EVP_F_EVP_PKEY_METH_ADD0 194 +# define EVP_F_EVP_PKEY_METH_NEW 195 +# define EVP_F_EVP_PKEY_NEW 106 +# define EVP_F_EVP_PKEY_NEW_CMAC_KEY 193 +# define EVP_F_EVP_PKEY_NEW_RAW_PRIVATE_KEY 191 +# define EVP_F_EVP_PKEY_NEW_RAW_PUBLIC_KEY 192 +# define EVP_F_EVP_PKEY_PARAMGEN 148 +# define EVP_F_EVP_PKEY_PARAMGEN_INIT 149 +# define EVP_F_EVP_PKEY_PARAM_CHECK 189 +# define EVP_F_EVP_PKEY_PUBLIC_CHECK 190 +# define EVP_F_EVP_PKEY_SET1_ENGINE 187 +# define EVP_F_EVP_PKEY_SET_ALIAS_TYPE 206 +# define EVP_F_EVP_PKEY_SIGN 140 +# define EVP_F_EVP_PKEY_SIGN_INIT 141 +# define EVP_F_EVP_PKEY_VERIFY 142 +# define EVP_F_EVP_PKEY_VERIFY_INIT 143 +# define EVP_F_EVP_PKEY_VERIFY_RECOVER 144 +# define EVP_F_EVP_PKEY_VERIFY_RECOVER_INIT 145 +# define EVP_F_EVP_SIGNFINAL 107 +# define EVP_F_EVP_VERIFYFINAL 108 +# define EVP_F_INT_CTX_NEW 157 +# define EVP_F_OK_NEW 200 +# define EVP_F_PKCS5_PBE_KEYIVGEN 117 +# define EVP_F_PKCS5_V2_PBE_KEYIVGEN 118 +# define EVP_F_PKCS5_V2_PBKDF2_KEYIVGEN 164 +# define EVP_F_PKCS5_V2_SCRYPT_KEYIVGEN 180 +# define EVP_F_PKEY_SET_TYPE 158 +# define EVP_F_RC2_MAGIC_TO_METH 109 +# define EVP_F_RC5_CTRL 125 +# define EVP_F_R_32_12_16_INIT_KEY 242 +# define EVP_F_S390X_AES_GCM_CTRL 201 +# define EVP_F_UPDATE 173 + +/* + * EVP reason codes. + */ +# define EVP_R_AES_KEY_SETUP_FAILED 143 +# define EVP_R_ARIA_KEY_SETUP_FAILED 176 +# define EVP_R_BAD_DECRYPT 100 +# define EVP_R_BAD_KEY_LENGTH 195 +# define EVP_R_BUFFER_TOO_SMALL 155 +# define EVP_R_CAMELLIA_KEY_SETUP_FAILED 157 +# define EVP_R_CIPHER_PARAMETER_ERROR 122 +# define EVP_R_COMMAND_NOT_SUPPORTED 147 +# define EVP_R_COPY_ERROR 173 +# define EVP_R_CTRL_NOT_IMPLEMENTED 132 +# define EVP_R_CTRL_OPERATION_NOT_IMPLEMENTED 133 +# define EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH 138 +# define EVP_R_DECODE_ERROR 114 +# define EVP_R_DIFFERENT_KEY_TYPES 101 +# define EVP_R_DIFFERENT_PARAMETERS 153 +# define EVP_R_ERROR_LOADING_SECTION 165 +# define EVP_R_ERROR_SETTING_FIPS_MODE 166 +# define EVP_R_EXPECTING_AN_HMAC_KEY 174 +# define EVP_R_EXPECTING_AN_RSA_KEY 127 +# define EVP_R_EXPECTING_A_DH_KEY 128 +# define EVP_R_EXPECTING_A_DSA_KEY 129 +# define EVP_R_EXPECTING_A_EC_KEY 142 +# define EVP_R_EXPECTING_A_POLY1305_KEY 164 +# define EVP_R_EXPECTING_A_SIPHASH_KEY 175 +# define EVP_R_FIPS_MODE_NOT_SUPPORTED 167 +# define EVP_R_GET_RAW_KEY_FAILED 182 +# define EVP_R_ILLEGAL_SCRYPT_PARAMETERS 171 +# define EVP_R_INITIALIZATION_ERROR 134 +# define EVP_R_INPUT_NOT_INITIALIZED 111 +# define EVP_R_INVALID_DIGEST 152 +# define EVP_R_INVALID_FIPS_MODE 168 +# define EVP_R_INVALID_IV_LENGTH 194 +# define EVP_R_INVALID_KEY 163 +# define EVP_R_INVALID_KEY_LENGTH 130 +# define EVP_R_INVALID_OPERATION 148 +# define EVP_R_KEYGEN_FAILURE 120 +# define EVP_R_KEY_SETUP_FAILED 180 +# define EVP_R_MEMORY_LIMIT_EXCEEDED 172 +# define EVP_R_MESSAGE_DIGEST_IS_NULL 159 +# define EVP_R_METHOD_NOT_SUPPORTED 144 +# define EVP_R_MISSING_PARAMETERS 103 +# define EVP_R_NOT_XOF_OR_INVALID_LENGTH 178 +# define EVP_R_NO_CIPHER_SET 131 +# define EVP_R_NO_DEFAULT_DIGEST 158 +# define EVP_R_NO_DIGEST_SET 139 +# define EVP_R_NO_KEY_SET 154 +# define EVP_R_NO_OPERATION_SET 149 +# define EVP_R_ONLY_ONESHOT_SUPPORTED 177 +# define EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE 150 +# define EVP_R_OPERATON_NOT_INITIALIZED 151 +# define EVP_R_PARTIALLY_OVERLAPPING 162 +# define EVP_R_PBKDF2_ERROR 181 +# define EVP_R_PKEY_APPLICATION_ASN1_METHOD_ALREADY_REGISTERED 179 +# define EVP_R_PRIVATE_KEY_DECODE_ERROR 145 +# define EVP_R_PRIVATE_KEY_ENCODE_ERROR 146 +# define EVP_R_PUBLIC_KEY_NOT_RSA 106 +# define EVP_R_UNKNOWN_CIPHER 160 +# define EVP_R_UNKNOWN_DIGEST 161 +# define EVP_R_UNKNOWN_OPTION 169 +# define EVP_R_UNKNOWN_PBE_ALGORITHM 121 +# define EVP_R_UNSUPPORTED_ALGORITHM 156 +# define EVP_R_UNSUPPORTED_CIPHER 107 +# define EVP_R_UNSUPPORTED_KEYLENGTH 123 +# define EVP_R_UNSUPPORTED_KEY_DERIVATION_FUNCTION 124 +# define EVP_R_UNSUPPORTED_KEY_SIZE 108 +# define EVP_R_UNSUPPORTED_NUMBER_OF_ROUNDS 135 +# define EVP_R_UNSUPPORTED_PRF 125 +# define EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM 118 +# define EVP_R_UNSUPPORTED_SALT_TYPE 126 +# define EVP_R_WRAP_MODE_NOT_ALLOWED 170 +# define EVP_R_WRONG_FINAL_BLOCK_LENGTH 109 +# define EVP_R_XTS_DUPLICATED_KEYS 183 + +#endif diff --git a/ONVIF/include/openssl/include/openssl/hmac.h b/ONVIF/include/openssl/include/openssl/hmac.h new file mode 100644 index 0000000..458efc1 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/hmac.h @@ -0,0 +1,51 @@ +/* + * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_HMAC_H +# define HEADER_HMAC_H + +# include + +# include + +# if OPENSSL_API_COMPAT < 0x10200000L +# define HMAC_MAX_MD_CBLOCK 128 /* Deprecated */ +# endif + +#ifdef __cplusplus +extern "C" { +#endif + +size_t HMAC_size(const HMAC_CTX *e); +HMAC_CTX *HMAC_CTX_new(void); +int HMAC_CTX_reset(HMAC_CTX *ctx); +void HMAC_CTX_free(HMAC_CTX *ctx); + +DEPRECATEDIN_1_1_0(__owur int HMAC_Init(HMAC_CTX *ctx, const void *key, int len, + const EVP_MD *md)) + +/*__owur*/ int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, + const EVP_MD *md, ENGINE *impl); +/*__owur*/ int HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, + size_t len); +/*__owur*/ int HMAC_Final(HMAC_CTX *ctx, unsigned char *md, + unsigned int *len); +unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len, + const unsigned char *d, size_t n, unsigned char *md, + unsigned int *md_len); +__owur int HMAC_CTX_copy(HMAC_CTX *dctx, HMAC_CTX *sctx); + +void HMAC_CTX_set_flags(HMAC_CTX *ctx, unsigned long flags); +const EVP_MD *HMAC_CTX_get_md(const HMAC_CTX *ctx); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/ONVIF/include/openssl/include/openssl/idea.h b/ONVIF/include/openssl/include/openssl/idea.h new file mode 100644 index 0000000..4334f3e --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/idea.h @@ -0,0 +1,64 @@ +/* + * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_IDEA_H +# define HEADER_IDEA_H + +# include + +# ifndef OPENSSL_NO_IDEA +# ifdef __cplusplus +extern "C" { +# endif + +typedef unsigned int IDEA_INT; + +# define IDEA_ENCRYPT 1 +# define IDEA_DECRYPT 0 + +# define IDEA_BLOCK 8 +# define IDEA_KEY_LENGTH 16 + +typedef struct idea_key_st { + IDEA_INT data[9][6]; +} IDEA_KEY_SCHEDULE; + +const char *IDEA_options(void); +void IDEA_ecb_encrypt(const unsigned char *in, unsigned char *out, + IDEA_KEY_SCHEDULE *ks); +void IDEA_set_encrypt_key(const unsigned char *key, IDEA_KEY_SCHEDULE *ks); +void IDEA_set_decrypt_key(IDEA_KEY_SCHEDULE *ek, IDEA_KEY_SCHEDULE *dk); +void IDEA_cbc_encrypt(const unsigned char *in, unsigned char *out, + long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv, + int enc); +void IDEA_cfb64_encrypt(const unsigned char *in, unsigned char *out, + long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv, + int *num, int enc); +void IDEA_ofb64_encrypt(const unsigned char *in, unsigned char *out, + long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv, + int *num); +void IDEA_encrypt(unsigned long *in, IDEA_KEY_SCHEDULE *ks); + +# if OPENSSL_API_COMPAT < 0x10100000L +# define idea_options IDEA_options +# define idea_ecb_encrypt IDEA_ecb_encrypt +# define idea_set_encrypt_key IDEA_set_encrypt_key +# define idea_set_decrypt_key IDEA_set_decrypt_key +# define idea_cbc_encrypt IDEA_cbc_encrypt +# define idea_cfb64_encrypt IDEA_cfb64_encrypt +# define idea_ofb64_encrypt IDEA_ofb64_encrypt +# define idea_encrypt IDEA_encrypt +# endif + +# ifdef __cplusplus +} +# endif +# endif + +#endif diff --git a/ONVIF/include/openssl/include/openssl/kdf.h b/ONVIF/include/openssl/include/openssl/kdf.h new file mode 100644 index 0000000..5abd4c3 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/kdf.h @@ -0,0 +1,97 @@ +/* + * Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_KDF_H +# define HEADER_KDF_H + +# include +#ifdef __cplusplus +extern "C" { +#endif + +# define EVP_PKEY_CTRL_TLS_MD (EVP_PKEY_ALG_CTRL) +# define EVP_PKEY_CTRL_TLS_SECRET (EVP_PKEY_ALG_CTRL + 1) +# define EVP_PKEY_CTRL_TLS_SEED (EVP_PKEY_ALG_CTRL + 2) +# define EVP_PKEY_CTRL_HKDF_MD (EVP_PKEY_ALG_CTRL + 3) +# define EVP_PKEY_CTRL_HKDF_SALT (EVP_PKEY_ALG_CTRL + 4) +# define EVP_PKEY_CTRL_HKDF_KEY (EVP_PKEY_ALG_CTRL + 5) +# define EVP_PKEY_CTRL_HKDF_INFO (EVP_PKEY_ALG_CTRL + 6) +# define EVP_PKEY_CTRL_HKDF_MODE (EVP_PKEY_ALG_CTRL + 7) +# define EVP_PKEY_CTRL_PASS (EVP_PKEY_ALG_CTRL + 8) +# define EVP_PKEY_CTRL_SCRYPT_SALT (EVP_PKEY_ALG_CTRL + 9) +# define EVP_PKEY_CTRL_SCRYPT_N (EVP_PKEY_ALG_CTRL + 10) +# define EVP_PKEY_CTRL_SCRYPT_R (EVP_PKEY_ALG_CTRL + 11) +# define EVP_PKEY_CTRL_SCRYPT_P (EVP_PKEY_ALG_CTRL + 12) +# define EVP_PKEY_CTRL_SCRYPT_MAXMEM_BYTES (EVP_PKEY_ALG_CTRL + 13) + +# define EVP_PKEY_HKDEF_MODE_EXTRACT_AND_EXPAND 0 +# define EVP_PKEY_HKDEF_MODE_EXTRACT_ONLY 1 +# define EVP_PKEY_HKDEF_MODE_EXPAND_ONLY 2 + +# define EVP_PKEY_CTX_set_tls1_prf_md(pctx, md) \ + EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_TLS_MD, 0, (void *)(md)) + +# define EVP_PKEY_CTX_set1_tls1_prf_secret(pctx, sec, seclen) \ + EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_TLS_SECRET, seclen, (void *)(sec)) + +# define EVP_PKEY_CTX_add1_tls1_prf_seed(pctx, seed, seedlen) \ + EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_TLS_SEED, seedlen, (void *)(seed)) + +# define EVP_PKEY_CTX_set_hkdf_md(pctx, md) \ + EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_HKDF_MD, 0, (void *)(md)) + +# define EVP_PKEY_CTX_set1_hkdf_salt(pctx, salt, saltlen) \ + EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_HKDF_SALT, saltlen, (void *)(salt)) + +# define EVP_PKEY_CTX_set1_hkdf_key(pctx, key, keylen) \ + EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_HKDF_KEY, keylen, (void *)(key)) + +# define EVP_PKEY_CTX_add1_hkdf_info(pctx, info, infolen) \ + EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_HKDF_INFO, infolen, (void *)(info)) + +# define EVP_PKEY_CTX_hkdf_mode(pctx, mode) \ + EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_HKDF_MODE, mode, NULL) + +# define EVP_PKEY_CTX_set1_pbe_pass(pctx, pass, passlen) \ + EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_PASS, passlen, (void *)(pass)) + +# define EVP_PKEY_CTX_set1_scrypt_salt(pctx, salt, saltlen) \ + EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_SCRYPT_SALT, saltlen, (void *)(salt)) + +# define EVP_PKEY_CTX_set_scrypt_N(pctx, n) \ + EVP_PKEY_CTX_ctrl_uint64(pctx, -1, EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_SCRYPT_N, n) + +# define EVP_PKEY_CTX_set_scrypt_r(pctx, r) \ + EVP_PKEY_CTX_ctrl_uint64(pctx, -1, EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_SCRYPT_R, r) + +# define EVP_PKEY_CTX_set_scrypt_p(pctx, p) \ + EVP_PKEY_CTX_ctrl_uint64(pctx, -1, EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_SCRYPT_P, p) + +# define EVP_PKEY_CTX_set_scrypt_maxmem_bytes(pctx, maxmem_bytes) \ + EVP_PKEY_CTX_ctrl_uint64(pctx, -1, EVP_PKEY_OP_DERIVE, \ + EVP_PKEY_CTRL_SCRYPT_MAXMEM_BYTES, maxmem_bytes) + + +# ifdef __cplusplus +} +# endif +#endif diff --git a/ONVIF/include/openssl/include/openssl/kdferr.h b/ONVIF/include/openssl/include/openssl/kdferr.h new file mode 100644 index 0000000..3f51bd0 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/kdferr.h @@ -0,0 +1,55 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_KDFERR_H +# define HEADER_KDFERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_KDF_strings(void); + +/* + * KDF function codes. + */ +# define KDF_F_PKEY_HKDF_CTRL_STR 103 +# define KDF_F_PKEY_HKDF_DERIVE 102 +# define KDF_F_PKEY_HKDF_INIT 108 +# define KDF_F_PKEY_SCRYPT_CTRL_STR 104 +# define KDF_F_PKEY_SCRYPT_CTRL_UINT64 105 +# define KDF_F_PKEY_SCRYPT_DERIVE 109 +# define KDF_F_PKEY_SCRYPT_INIT 106 +# define KDF_F_PKEY_SCRYPT_SET_MEMBUF 107 +# define KDF_F_PKEY_TLS1_PRF_CTRL_STR 100 +# define KDF_F_PKEY_TLS1_PRF_DERIVE 101 +# define KDF_F_PKEY_TLS1_PRF_INIT 110 +# define KDF_F_TLS1_PRF_ALG 111 + +/* + * KDF reason codes. + */ +# define KDF_R_INVALID_DIGEST 100 +# define KDF_R_MISSING_ITERATION_COUNT 109 +# define KDF_R_MISSING_KEY 104 +# define KDF_R_MISSING_MESSAGE_DIGEST 105 +# define KDF_R_MISSING_PARAMETER 101 +# define KDF_R_MISSING_PASS 110 +# define KDF_R_MISSING_SALT 111 +# define KDF_R_MISSING_SECRET 107 +# define KDF_R_MISSING_SEED 106 +# define KDF_R_UNKNOWN_PARAMETER_TYPE 103 +# define KDF_R_VALUE_ERROR 108 +# define KDF_R_VALUE_MISSING 102 + +#endif diff --git a/ONVIF/include/openssl/include/openssl/lhash.h b/ONVIF/include/openssl/include/openssl/lhash.h new file mode 100644 index 0000000..2e42d72 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/lhash.h @@ -0,0 +1,241 @@ +/* + * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +/* + * Header for dynamic hash table routines Author - Eric Young + */ + +#ifndef HEADER_LHASH_H +# define HEADER_LHASH_H + +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct lhash_node_st OPENSSL_LH_NODE; +typedef int (*OPENSSL_LH_COMPFUNC) (const void *, const void *); +typedef unsigned long (*OPENSSL_LH_HASHFUNC) (const void *); +typedef void (*OPENSSL_LH_DOALL_FUNC) (void *); +typedef void (*OPENSSL_LH_DOALL_FUNCARG) (void *, void *); +typedef struct lhash_st OPENSSL_LHASH; + +/* + * Macros for declaring and implementing type-safe wrappers for LHASH + * callbacks. This way, callbacks can be provided to LHASH structures without + * function pointer casting and the macro-defined callbacks provide + * per-variable casting before deferring to the underlying type-specific + * callbacks. NB: It is possible to place a "static" in front of both the + * DECLARE and IMPLEMENT macros if the functions are strictly internal. + */ + +/* First: "hash" functions */ +# define DECLARE_LHASH_HASH_FN(name, o_type) \ + unsigned long name##_LHASH_HASH(const void *); +# define IMPLEMENT_LHASH_HASH_FN(name, o_type) \ + unsigned long name##_LHASH_HASH(const void *arg) { \ + const o_type *a = arg; \ + return name##_hash(a); } +# define LHASH_HASH_FN(name) name##_LHASH_HASH + +/* Second: "compare" functions */ +# define DECLARE_LHASH_COMP_FN(name, o_type) \ + int name##_LHASH_COMP(const void *, const void *); +# define IMPLEMENT_LHASH_COMP_FN(name, o_type) \ + int name##_LHASH_COMP(const void *arg1, const void *arg2) { \ + const o_type *a = arg1; \ + const o_type *b = arg2; \ + return name##_cmp(a,b); } +# define LHASH_COMP_FN(name) name##_LHASH_COMP + +/* Fourth: "doall_arg" functions */ +# define DECLARE_LHASH_DOALL_ARG_FN(name, o_type, a_type) \ + void name##_LHASH_DOALL_ARG(void *, void *); +# define IMPLEMENT_LHASH_DOALL_ARG_FN(name, o_type, a_type) \ + void name##_LHASH_DOALL_ARG(void *arg1, void *arg2) { \ + o_type *a = arg1; \ + a_type *b = arg2; \ + name##_doall_arg(a, b); } +# define LHASH_DOALL_ARG_FN(name) name##_LHASH_DOALL_ARG + + +# define LH_LOAD_MULT 256 + +int OPENSSL_LH_error(OPENSSL_LHASH *lh); +OPENSSL_LHASH *OPENSSL_LH_new(OPENSSL_LH_HASHFUNC h, OPENSSL_LH_COMPFUNC c); +void OPENSSL_LH_free(OPENSSL_LHASH *lh); +void *OPENSSL_LH_insert(OPENSSL_LHASH *lh, void *data); +void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data); +void *OPENSSL_LH_retrieve(OPENSSL_LHASH *lh, const void *data); +void OPENSSL_LH_doall(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNC func); +void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg); +unsigned long OPENSSL_LH_strhash(const char *c); +unsigned long OPENSSL_LH_num_items(const OPENSSL_LHASH *lh); +unsigned long OPENSSL_LH_get_down_load(const OPENSSL_LHASH *lh); +void OPENSSL_LH_set_down_load(OPENSSL_LHASH *lh, unsigned long down_load); + +# ifndef OPENSSL_NO_STDIO +void OPENSSL_LH_stats(const OPENSSL_LHASH *lh, FILE *fp); +void OPENSSL_LH_node_stats(const OPENSSL_LHASH *lh, FILE *fp); +void OPENSSL_LH_node_usage_stats(const OPENSSL_LHASH *lh, FILE *fp); +# endif +void OPENSSL_LH_stats_bio(const OPENSSL_LHASH *lh, BIO *out); +void OPENSSL_LH_node_stats_bio(const OPENSSL_LHASH *lh, BIO *out); +void OPENSSL_LH_node_usage_stats_bio(const OPENSSL_LHASH *lh, BIO *out); + +# if OPENSSL_API_COMPAT < 0x10100000L +# define _LHASH OPENSSL_LHASH +# define LHASH_NODE OPENSSL_LH_NODE +# define lh_error OPENSSL_LH_error +# define lh_new OPENSSL_LH_new +# define lh_free OPENSSL_LH_free +# define lh_insert OPENSSL_LH_insert +# define lh_delete OPENSSL_LH_delete +# define lh_retrieve OPENSSL_LH_retrieve +# define lh_doall OPENSSL_LH_doall +# define lh_doall_arg OPENSSL_LH_doall_arg +# define lh_strhash OPENSSL_LH_strhash +# define lh_num_items OPENSSL_LH_num_items +# ifndef OPENSSL_NO_STDIO +# define lh_stats OPENSSL_LH_stats +# define lh_node_stats OPENSSL_LH_node_stats +# define lh_node_usage_stats OPENSSL_LH_node_usage_stats +# endif +# define lh_stats_bio OPENSSL_LH_stats_bio +# define lh_node_stats_bio OPENSSL_LH_node_stats_bio +# define lh_node_usage_stats_bio OPENSSL_LH_node_usage_stats_bio +# endif + +/* Type checking... */ + +# define LHASH_OF(type) struct lhash_st_##type + +# define DEFINE_LHASH_OF(type) \ + LHASH_OF(type) { union lh_##type##_dummy { void* d1; unsigned long d2; int d3; } dummy; }; \ + static ossl_unused ossl_inline LHASH_OF(type) *lh_##type##_new(unsigned long (*hfn)(const type *), \ + int (*cfn)(const type *, const type *)) \ + { \ + return (LHASH_OF(type) *) \ + OPENSSL_LH_new((OPENSSL_LH_HASHFUNC)hfn, (OPENSSL_LH_COMPFUNC)cfn); \ + } \ + static ossl_unused ossl_inline void lh_##type##_free(LHASH_OF(type) *lh) \ + { \ + OPENSSL_LH_free((OPENSSL_LHASH *)lh); \ + } \ + static ossl_unused ossl_inline type *lh_##type##_insert(LHASH_OF(type) *lh, type *d) \ + { \ + return (type *)OPENSSL_LH_insert((OPENSSL_LHASH *)lh, d); \ + } \ + static ossl_unused ossl_inline type *lh_##type##_delete(LHASH_OF(type) *lh, const type *d) \ + { \ + return (type *)OPENSSL_LH_delete((OPENSSL_LHASH *)lh, d); \ + } \ + static ossl_unused ossl_inline type *lh_##type##_retrieve(LHASH_OF(type) *lh, const type *d) \ + { \ + return (type *)OPENSSL_LH_retrieve((OPENSSL_LHASH *)lh, d); \ + } \ + static ossl_unused ossl_inline int lh_##type##_error(LHASH_OF(type) *lh) \ + { \ + return OPENSSL_LH_error((OPENSSL_LHASH *)lh); \ + } \ + static ossl_unused ossl_inline unsigned long lh_##type##_num_items(LHASH_OF(type) *lh) \ + { \ + return OPENSSL_LH_num_items((OPENSSL_LHASH *)lh); \ + } \ + static ossl_unused ossl_inline void lh_##type##_node_stats_bio(const LHASH_OF(type) *lh, BIO *out) \ + { \ + OPENSSL_LH_node_stats_bio((const OPENSSL_LHASH *)lh, out); \ + } \ + static ossl_unused ossl_inline void lh_##type##_node_usage_stats_bio(const LHASH_OF(type) *lh, BIO *out) \ + { \ + OPENSSL_LH_node_usage_stats_bio((const OPENSSL_LHASH *)lh, out); \ + } \ + static ossl_unused ossl_inline void lh_##type##_stats_bio(const LHASH_OF(type) *lh, BIO *out) \ + { \ + OPENSSL_LH_stats_bio((const OPENSSL_LHASH *)lh, out); \ + } \ + static ossl_unused ossl_inline unsigned long lh_##type##_get_down_load(LHASH_OF(type) *lh) \ + { \ + return OPENSSL_LH_get_down_load((OPENSSL_LHASH *)lh); \ + } \ + static ossl_unused ossl_inline void lh_##type##_set_down_load(LHASH_OF(type) *lh, unsigned long dl) \ + { \ + OPENSSL_LH_set_down_load((OPENSSL_LHASH *)lh, dl); \ + } \ + static ossl_unused ossl_inline void lh_##type##_doall(LHASH_OF(type) *lh, \ + void (*doall)(type *)) \ + { \ + OPENSSL_LH_doall((OPENSSL_LHASH *)lh, (OPENSSL_LH_DOALL_FUNC)doall); \ + } \ + LHASH_OF(type) + +#define IMPLEMENT_LHASH_DOALL_ARG_CONST(type, argtype) \ + int_implement_lhash_doall(type, argtype, const type) + +#define IMPLEMENT_LHASH_DOALL_ARG(type, argtype) \ + int_implement_lhash_doall(type, argtype, type) + +#define int_implement_lhash_doall(type, argtype, cbargtype) \ + static ossl_unused ossl_inline void \ + lh_##type##_doall_##argtype(LHASH_OF(type) *lh, \ + void (*fn)(cbargtype *, argtype *), \ + argtype *arg) \ + { \ + OPENSSL_LH_doall_arg((OPENSSL_LHASH *)lh, (OPENSSL_LH_DOALL_FUNCARG)fn, (void *)arg); \ + } \ + LHASH_OF(type) + +DEFINE_LHASH_OF(OPENSSL_STRING); +# ifdef _MSC_VER +/* + * push and pop this warning: + * warning C4090: 'function': different 'const' qualifiers + */ +# pragma warning (push) +# pragma warning (disable: 4090) +# endif + +DEFINE_LHASH_OF(OPENSSL_CSTRING); + +# ifdef _MSC_VER +# pragma warning (pop) +# endif + +/* + * If called without higher optimization (min. -xO3) the Oracle Developer + * Studio compiler generates code for the defined (static inline) functions + * above. + * This would later lead to the linker complaining about missing symbols when + * this header file is included but the resulting object is not linked against + * the Crypto library (openssl#6912). + */ +# ifdef __SUNPRO_C +# pragma weak OPENSSL_LH_new +# pragma weak OPENSSL_LH_free +# pragma weak OPENSSL_LH_insert +# pragma weak OPENSSL_LH_delete +# pragma weak OPENSSL_LH_retrieve +# pragma weak OPENSSL_LH_error +# pragma weak OPENSSL_LH_num_items +# pragma weak OPENSSL_LH_node_stats_bio +# pragma weak OPENSSL_LH_node_usage_stats_bio +# pragma weak OPENSSL_LH_stats_bio +# pragma weak OPENSSL_LH_get_down_load +# pragma weak OPENSSL_LH_set_down_load +# pragma weak OPENSSL_LH_doall +# pragma weak OPENSSL_LH_doall_arg +# endif /* __SUNPRO_C */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/ONVIF/include/openssl/include/openssl/md2.h b/ONVIF/include/openssl/include/openssl/md2.h new file mode 100644 index 0000000..7faf8e3 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/md2.h @@ -0,0 +1,44 @@ +/* + * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_MD2_H +# define HEADER_MD2_H + +# include + +# ifndef OPENSSL_NO_MD2 +# include +# ifdef __cplusplus +extern "C" { +# endif + +typedef unsigned char MD2_INT; + +# define MD2_DIGEST_LENGTH 16 +# define MD2_BLOCK 16 + +typedef struct MD2state_st { + unsigned int num; + unsigned char data[MD2_BLOCK]; + MD2_INT cksm[MD2_BLOCK]; + MD2_INT state[MD2_BLOCK]; +} MD2_CTX; + +const char *MD2_options(void); +int MD2_Init(MD2_CTX *c); +int MD2_Update(MD2_CTX *c, const unsigned char *data, size_t len); +int MD2_Final(unsigned char *md, MD2_CTX *c); +unsigned char *MD2(const unsigned char *d, size_t n, unsigned char *md); + +# ifdef __cplusplus +} +# endif +# endif + +#endif diff --git a/ONVIF/include/openssl/include/openssl/md4.h b/ONVIF/include/openssl/include/openssl/md4.h new file mode 100644 index 0000000..940e29d --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/md4.h @@ -0,0 +1,51 @@ +/* + * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_MD4_H +# define HEADER_MD4_H + +# include + +# ifndef OPENSSL_NO_MD4 +# include +# include +# ifdef __cplusplus +extern "C" { +# endif + +/*- + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * ! MD4_LONG has to be at least 32 bits wide. ! + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + */ +# define MD4_LONG unsigned int + +# define MD4_CBLOCK 64 +# define MD4_LBLOCK (MD4_CBLOCK/4) +# define MD4_DIGEST_LENGTH 16 + +typedef struct MD4state_st { + MD4_LONG A, B, C, D; + MD4_LONG Nl, Nh; + MD4_LONG data[MD4_LBLOCK]; + unsigned int num; +} MD4_CTX; + +int MD4_Init(MD4_CTX *c); +int MD4_Update(MD4_CTX *c, const void *data, size_t len); +int MD4_Final(unsigned char *md, MD4_CTX *c); +unsigned char *MD4(const unsigned char *d, size_t n, unsigned char *md); +void MD4_Transform(MD4_CTX *c, const unsigned char *b); + +# ifdef __cplusplus +} +# endif +# endif + +#endif diff --git a/ONVIF/include/openssl/include/openssl/md5.h b/ONVIF/include/openssl/include/openssl/md5.h new file mode 100644 index 0000000..2deb772 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/md5.h @@ -0,0 +1,50 @@ +/* + * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_MD5_H +# define HEADER_MD5_H + +# include + +# ifndef OPENSSL_NO_MD5 +# include +# include +# ifdef __cplusplus +extern "C" { +# endif + +/* + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * ! MD5_LONG has to be at least 32 bits wide. ! + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + */ +# define MD5_LONG unsigned int + +# define MD5_CBLOCK 64 +# define MD5_LBLOCK (MD5_CBLOCK/4) +# define MD5_DIGEST_LENGTH 16 + +typedef struct MD5state_st { + MD5_LONG A, B, C, D; + MD5_LONG Nl, Nh; + MD5_LONG data[MD5_LBLOCK]; + unsigned int num; +} MD5_CTX; + +int MD5_Init(MD5_CTX *c); +int MD5_Update(MD5_CTX *c, const void *data, size_t len); +int MD5_Final(unsigned char *md, MD5_CTX *c); +unsigned char *MD5(const unsigned char *d, size_t n, unsigned char *md); +void MD5_Transform(MD5_CTX *c, const unsigned char *b); +# ifdef __cplusplus +} +# endif +# endif + +#endif diff --git a/ONVIF/include/openssl/include/openssl/mdc2.h b/ONVIF/include/openssl/include/openssl/mdc2.h new file mode 100644 index 0000000..aabd2bf --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/mdc2.h @@ -0,0 +1,42 @@ +/* + * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_MDC2_H +# define HEADER_MDC2_H + +# include + +#ifndef OPENSSL_NO_MDC2 +# include +# include +# ifdef __cplusplus +extern "C" { +# endif + +# define MDC2_BLOCK 8 +# define MDC2_DIGEST_LENGTH 16 + +typedef struct mdc2_ctx_st { + unsigned int num; + unsigned char data[MDC2_BLOCK]; + DES_cblock h, hh; + int pad_type; /* either 1 or 2, default 1 */ +} MDC2_CTX; + +int MDC2_Init(MDC2_CTX *c); +int MDC2_Update(MDC2_CTX *c, const unsigned char *data, size_t len); +int MDC2_Final(unsigned char *md, MDC2_CTX *c); +unsigned char *MDC2(const unsigned char *d, size_t n, unsigned char *md); + +# ifdef __cplusplus +} +# endif +# endif + +#endif diff --git a/ONVIF/include/openssl/include/openssl/modes.h b/ONVIF/include/openssl/include/openssl/modes.h new file mode 100644 index 0000000..d544f98 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/modes.h @@ -0,0 +1,208 @@ +/* + * Copyright 2008-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_MODES_H +# define HEADER_MODES_H + +# include + +# ifdef __cplusplus +extern "C" { +# endif +typedef void (*block128_f) (const unsigned char in[16], + unsigned char out[16], const void *key); + +typedef void (*cbc128_f) (const unsigned char *in, unsigned char *out, + size_t len, const void *key, + unsigned char ivec[16], int enc); + +typedef void (*ctr128_f) (const unsigned char *in, unsigned char *out, + size_t blocks, const void *key, + const unsigned char ivec[16]); + +typedef void (*ccm128_f) (const unsigned char *in, unsigned char *out, + size_t blocks, const void *key, + const unsigned char ivec[16], + unsigned char cmac[16]); + +void CRYPTO_cbc128_encrypt(const unsigned char *in, unsigned char *out, + size_t len, const void *key, + unsigned char ivec[16], block128_f block); +void CRYPTO_cbc128_decrypt(const unsigned char *in, unsigned char *out, + size_t len, const void *key, + unsigned char ivec[16], block128_f block); + +void CRYPTO_ctr128_encrypt(const unsigned char *in, unsigned char *out, + size_t len, const void *key, + unsigned char ivec[16], + unsigned char ecount_buf[16], unsigned int *num, + block128_f block); + +void CRYPTO_ctr128_encrypt_ctr32(const unsigned char *in, unsigned char *out, + size_t len, const void *key, + unsigned char ivec[16], + unsigned char ecount_buf[16], + unsigned int *num, ctr128_f ctr); + +void CRYPTO_ofb128_encrypt(const unsigned char *in, unsigned char *out, + size_t len, const void *key, + unsigned char ivec[16], int *num, + block128_f block); + +void CRYPTO_cfb128_encrypt(const unsigned char *in, unsigned char *out, + size_t len, const void *key, + unsigned char ivec[16], int *num, + int enc, block128_f block); +void CRYPTO_cfb128_8_encrypt(const unsigned char *in, unsigned char *out, + size_t length, const void *key, + unsigned char ivec[16], int *num, + int enc, block128_f block); +void CRYPTO_cfb128_1_encrypt(const unsigned char *in, unsigned char *out, + size_t bits, const void *key, + unsigned char ivec[16], int *num, + int enc, block128_f block); + +size_t CRYPTO_cts128_encrypt_block(const unsigned char *in, + unsigned char *out, size_t len, + const void *key, unsigned char ivec[16], + block128_f block); +size_t CRYPTO_cts128_encrypt(const unsigned char *in, unsigned char *out, + size_t len, const void *key, + unsigned char ivec[16], cbc128_f cbc); +size_t CRYPTO_cts128_decrypt_block(const unsigned char *in, + unsigned char *out, size_t len, + const void *key, unsigned char ivec[16], + block128_f block); +size_t CRYPTO_cts128_decrypt(const unsigned char *in, unsigned char *out, + size_t len, const void *key, + unsigned char ivec[16], cbc128_f cbc); + +size_t CRYPTO_nistcts128_encrypt_block(const unsigned char *in, + unsigned char *out, size_t len, + const void *key, + unsigned char ivec[16], + block128_f block); +size_t CRYPTO_nistcts128_encrypt(const unsigned char *in, unsigned char *out, + size_t len, const void *key, + unsigned char ivec[16], cbc128_f cbc); +size_t CRYPTO_nistcts128_decrypt_block(const unsigned char *in, + unsigned char *out, size_t len, + const void *key, + unsigned char ivec[16], + block128_f block); +size_t CRYPTO_nistcts128_decrypt(const unsigned char *in, unsigned char *out, + size_t len, const void *key, + unsigned char ivec[16], cbc128_f cbc); + +typedef struct gcm128_context GCM128_CONTEXT; + +GCM128_CONTEXT *CRYPTO_gcm128_new(void *key, block128_f block); +void CRYPTO_gcm128_init(GCM128_CONTEXT *ctx, void *key, block128_f block); +void CRYPTO_gcm128_setiv(GCM128_CONTEXT *ctx, const unsigned char *iv, + size_t len); +int CRYPTO_gcm128_aad(GCM128_CONTEXT *ctx, const unsigned char *aad, + size_t len); +int CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx, + const unsigned char *in, unsigned char *out, + size_t len); +int CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx, + const unsigned char *in, unsigned char *out, + size_t len); +int CRYPTO_gcm128_encrypt_ctr32(GCM128_CONTEXT *ctx, + const unsigned char *in, unsigned char *out, + size_t len, ctr128_f stream); +int CRYPTO_gcm128_decrypt_ctr32(GCM128_CONTEXT *ctx, + const unsigned char *in, unsigned char *out, + size_t len, ctr128_f stream); +int CRYPTO_gcm128_finish(GCM128_CONTEXT *ctx, const unsigned char *tag, + size_t len); +void CRYPTO_gcm128_tag(GCM128_CONTEXT *ctx, unsigned char *tag, size_t len); +void CRYPTO_gcm128_release(GCM128_CONTEXT *ctx); + +typedef struct ccm128_context CCM128_CONTEXT; + +void CRYPTO_ccm128_init(CCM128_CONTEXT *ctx, + unsigned int M, unsigned int L, void *key, + block128_f block); +int CRYPTO_ccm128_setiv(CCM128_CONTEXT *ctx, const unsigned char *nonce, + size_t nlen, size_t mlen); +void CRYPTO_ccm128_aad(CCM128_CONTEXT *ctx, const unsigned char *aad, + size_t alen); +int CRYPTO_ccm128_encrypt(CCM128_CONTEXT *ctx, const unsigned char *inp, + unsigned char *out, size_t len); +int CRYPTO_ccm128_decrypt(CCM128_CONTEXT *ctx, const unsigned char *inp, + unsigned char *out, size_t len); +int CRYPTO_ccm128_encrypt_ccm64(CCM128_CONTEXT *ctx, const unsigned char *inp, + unsigned char *out, size_t len, + ccm128_f stream); +int CRYPTO_ccm128_decrypt_ccm64(CCM128_CONTEXT *ctx, const unsigned char *inp, + unsigned char *out, size_t len, + ccm128_f stream); +size_t CRYPTO_ccm128_tag(CCM128_CONTEXT *ctx, unsigned char *tag, size_t len); + +typedef struct xts128_context XTS128_CONTEXT; + +int CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx, + const unsigned char iv[16], + const unsigned char *inp, unsigned char *out, + size_t len, int enc); + +size_t CRYPTO_128_wrap(void *key, const unsigned char *iv, + unsigned char *out, + const unsigned char *in, size_t inlen, + block128_f block); + +size_t CRYPTO_128_unwrap(void *key, const unsigned char *iv, + unsigned char *out, + const unsigned char *in, size_t inlen, + block128_f block); +size_t CRYPTO_128_wrap_pad(void *key, const unsigned char *icv, + unsigned char *out, const unsigned char *in, + size_t inlen, block128_f block); +size_t CRYPTO_128_unwrap_pad(void *key, const unsigned char *icv, + unsigned char *out, const unsigned char *in, + size_t inlen, block128_f block); + +# ifndef OPENSSL_NO_OCB +typedef struct ocb128_context OCB128_CONTEXT; + +typedef void (*ocb128_f) (const unsigned char *in, unsigned char *out, + size_t blocks, const void *key, + size_t start_block_num, + unsigned char offset_i[16], + const unsigned char L_[][16], + unsigned char checksum[16]); + +OCB128_CONTEXT *CRYPTO_ocb128_new(void *keyenc, void *keydec, + block128_f encrypt, block128_f decrypt, + ocb128_f stream); +int CRYPTO_ocb128_init(OCB128_CONTEXT *ctx, void *keyenc, void *keydec, + block128_f encrypt, block128_f decrypt, + ocb128_f stream); +int CRYPTO_ocb128_copy_ctx(OCB128_CONTEXT *dest, OCB128_CONTEXT *src, + void *keyenc, void *keydec); +int CRYPTO_ocb128_setiv(OCB128_CONTEXT *ctx, const unsigned char *iv, + size_t len, size_t taglen); +int CRYPTO_ocb128_aad(OCB128_CONTEXT *ctx, const unsigned char *aad, + size_t len); +int CRYPTO_ocb128_encrypt(OCB128_CONTEXT *ctx, const unsigned char *in, + unsigned char *out, size_t len); +int CRYPTO_ocb128_decrypt(OCB128_CONTEXT *ctx, const unsigned char *in, + unsigned char *out, size_t len); +int CRYPTO_ocb128_finish(OCB128_CONTEXT *ctx, const unsigned char *tag, + size_t len); +int CRYPTO_ocb128_tag(OCB128_CONTEXT *ctx, unsigned char *tag, size_t len); +void CRYPTO_ocb128_cleanup(OCB128_CONTEXT *ctx); +# endif /* OPENSSL_NO_OCB */ + +# ifdef __cplusplus +} +# endif + +#endif diff --git a/ONVIF/include/openssl/include/openssl/obj_mac.h b/ONVIF/include/openssl/include/openssl/obj_mac.h new file mode 100644 index 0000000..483fc05 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/obj_mac.h @@ -0,0 +1,5198 @@ +/* + * WARNING: do not edit! + * Generated by crypto/objects/objects.pl + * + * Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved. + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#define SN_undef "UNDEF" +#define LN_undef "undefined" +#define NID_undef 0 +#define OBJ_undef 0L + +#define SN_itu_t "ITU-T" +#define LN_itu_t "itu-t" +#define NID_itu_t 645 +#define OBJ_itu_t 0L + +#define NID_ccitt 404 +#define OBJ_ccitt OBJ_itu_t + +#define SN_iso "ISO" +#define LN_iso "iso" +#define NID_iso 181 +#define OBJ_iso 1L + +#define SN_joint_iso_itu_t "JOINT-ISO-ITU-T" +#define LN_joint_iso_itu_t "joint-iso-itu-t" +#define NID_joint_iso_itu_t 646 +#define OBJ_joint_iso_itu_t 2L + +#define NID_joint_iso_ccitt 393 +#define OBJ_joint_iso_ccitt OBJ_joint_iso_itu_t + +#define SN_member_body "member-body" +#define LN_member_body "ISO Member Body" +#define NID_member_body 182 +#define OBJ_member_body OBJ_iso,2L + +#define SN_identified_organization "identified-organization" +#define NID_identified_organization 676 +#define OBJ_identified_organization OBJ_iso,3L + +#define SN_hmac_md5 "HMAC-MD5" +#define LN_hmac_md5 "hmac-md5" +#define NID_hmac_md5 780 +#define OBJ_hmac_md5 OBJ_identified_organization,6L,1L,5L,5L,8L,1L,1L + +#define SN_hmac_sha1 "HMAC-SHA1" +#define LN_hmac_sha1 "hmac-sha1" +#define NID_hmac_sha1 781 +#define OBJ_hmac_sha1 OBJ_identified_organization,6L,1L,5L,5L,8L,1L,2L + +#define SN_x509ExtAdmission "x509ExtAdmission" +#define LN_x509ExtAdmission "Professional Information or basis for Admission" +#define NID_x509ExtAdmission 1093 +#define OBJ_x509ExtAdmission OBJ_identified_organization,36L,8L,3L,3L + +#define SN_certicom_arc "certicom-arc" +#define NID_certicom_arc 677 +#define OBJ_certicom_arc OBJ_identified_organization,132L + +#define SN_ieee "ieee" +#define NID_ieee 1170 +#define OBJ_ieee OBJ_identified_organization,111L + +#define SN_ieee_siswg "ieee-siswg" +#define LN_ieee_siswg "IEEE Security in Storage Working Group" +#define NID_ieee_siswg 1171 +#define OBJ_ieee_siswg OBJ_ieee,2L,1619L + +#define SN_international_organizations "international-organizations" +#define LN_international_organizations "International Organizations" +#define NID_international_organizations 647 +#define OBJ_international_organizations OBJ_joint_iso_itu_t,23L + +#define SN_wap "wap" +#define NID_wap 678 +#define OBJ_wap OBJ_international_organizations,43L + +#define SN_wap_wsg "wap-wsg" +#define NID_wap_wsg 679 +#define OBJ_wap_wsg OBJ_wap,1L + +#define SN_selected_attribute_types "selected-attribute-types" +#define LN_selected_attribute_types "Selected Attribute Types" +#define NID_selected_attribute_types 394 +#define OBJ_selected_attribute_types OBJ_joint_iso_itu_t,5L,1L,5L + +#define SN_clearance "clearance" +#define NID_clearance 395 +#define OBJ_clearance OBJ_selected_attribute_types,55L + +#define SN_ISO_US "ISO-US" +#define LN_ISO_US "ISO US Member Body" +#define NID_ISO_US 183 +#define OBJ_ISO_US OBJ_member_body,840L + +#define SN_X9_57 "X9-57" +#define LN_X9_57 "X9.57" +#define NID_X9_57 184 +#define OBJ_X9_57 OBJ_ISO_US,10040L + +#define SN_X9cm "X9cm" +#define LN_X9cm "X9.57 CM ?" +#define NID_X9cm 185 +#define OBJ_X9cm OBJ_X9_57,4L + +#define SN_ISO_CN "ISO-CN" +#define LN_ISO_CN "ISO CN Member Body" +#define NID_ISO_CN 1140 +#define OBJ_ISO_CN OBJ_member_body,156L + +#define SN_oscca "oscca" +#define NID_oscca 1141 +#define OBJ_oscca OBJ_ISO_CN,10197L + +#define SN_sm_scheme "sm-scheme" +#define NID_sm_scheme 1142 +#define OBJ_sm_scheme OBJ_oscca,1L + +#define SN_dsa "DSA" +#define LN_dsa "dsaEncryption" +#define NID_dsa 116 +#define OBJ_dsa OBJ_X9cm,1L + +#define SN_dsaWithSHA1 "DSA-SHA1" +#define LN_dsaWithSHA1 "dsaWithSHA1" +#define NID_dsaWithSHA1 113 +#define OBJ_dsaWithSHA1 OBJ_X9cm,3L + +#define SN_ansi_X9_62 "ansi-X9-62" +#define LN_ansi_X9_62 "ANSI X9.62" +#define NID_ansi_X9_62 405 +#define OBJ_ansi_X9_62 OBJ_ISO_US,10045L + +#define OBJ_X9_62_id_fieldType OBJ_ansi_X9_62,1L + +#define SN_X9_62_prime_field "prime-field" +#define NID_X9_62_prime_field 406 +#define OBJ_X9_62_prime_field OBJ_X9_62_id_fieldType,1L + +#define SN_X9_62_characteristic_two_field "characteristic-two-field" +#define NID_X9_62_characteristic_two_field 407 +#define OBJ_X9_62_characteristic_two_field OBJ_X9_62_id_fieldType,2L + +#define SN_X9_62_id_characteristic_two_basis "id-characteristic-two-basis" +#define NID_X9_62_id_characteristic_two_basis 680 +#define OBJ_X9_62_id_characteristic_two_basis OBJ_X9_62_characteristic_two_field,3L + +#define SN_X9_62_onBasis "onBasis" +#define NID_X9_62_onBasis 681 +#define OBJ_X9_62_onBasis OBJ_X9_62_id_characteristic_two_basis,1L + +#define SN_X9_62_tpBasis "tpBasis" +#define NID_X9_62_tpBasis 682 +#define OBJ_X9_62_tpBasis OBJ_X9_62_id_characteristic_two_basis,2L + +#define SN_X9_62_ppBasis "ppBasis" +#define NID_X9_62_ppBasis 683 +#define OBJ_X9_62_ppBasis OBJ_X9_62_id_characteristic_two_basis,3L + +#define OBJ_X9_62_id_publicKeyType OBJ_ansi_X9_62,2L + +#define SN_X9_62_id_ecPublicKey "id-ecPublicKey" +#define NID_X9_62_id_ecPublicKey 408 +#define OBJ_X9_62_id_ecPublicKey OBJ_X9_62_id_publicKeyType,1L + +#define OBJ_X9_62_ellipticCurve OBJ_ansi_X9_62,3L + +#define OBJ_X9_62_c_TwoCurve OBJ_X9_62_ellipticCurve,0L + +#define SN_X9_62_c2pnb163v1 "c2pnb163v1" +#define NID_X9_62_c2pnb163v1 684 +#define OBJ_X9_62_c2pnb163v1 OBJ_X9_62_c_TwoCurve,1L + +#define SN_X9_62_c2pnb163v2 "c2pnb163v2" +#define NID_X9_62_c2pnb163v2 685 +#define OBJ_X9_62_c2pnb163v2 OBJ_X9_62_c_TwoCurve,2L + +#define SN_X9_62_c2pnb163v3 "c2pnb163v3" +#define NID_X9_62_c2pnb163v3 686 +#define OBJ_X9_62_c2pnb163v3 OBJ_X9_62_c_TwoCurve,3L + +#define SN_X9_62_c2pnb176v1 "c2pnb176v1" +#define NID_X9_62_c2pnb176v1 687 +#define OBJ_X9_62_c2pnb176v1 OBJ_X9_62_c_TwoCurve,4L + +#define SN_X9_62_c2tnb191v1 "c2tnb191v1" +#define NID_X9_62_c2tnb191v1 688 +#define OBJ_X9_62_c2tnb191v1 OBJ_X9_62_c_TwoCurve,5L + +#define SN_X9_62_c2tnb191v2 "c2tnb191v2" +#define NID_X9_62_c2tnb191v2 689 +#define OBJ_X9_62_c2tnb191v2 OBJ_X9_62_c_TwoCurve,6L + +#define SN_X9_62_c2tnb191v3 "c2tnb191v3" +#define NID_X9_62_c2tnb191v3 690 +#define OBJ_X9_62_c2tnb191v3 OBJ_X9_62_c_TwoCurve,7L + +#define SN_X9_62_c2onb191v4 "c2onb191v4" +#define NID_X9_62_c2onb191v4 691 +#define OBJ_X9_62_c2onb191v4 OBJ_X9_62_c_TwoCurve,8L + +#define SN_X9_62_c2onb191v5 "c2onb191v5" +#define NID_X9_62_c2onb191v5 692 +#define OBJ_X9_62_c2onb191v5 OBJ_X9_62_c_TwoCurve,9L + +#define SN_X9_62_c2pnb208w1 "c2pnb208w1" +#define NID_X9_62_c2pnb208w1 693 +#define OBJ_X9_62_c2pnb208w1 OBJ_X9_62_c_TwoCurve,10L + +#define SN_X9_62_c2tnb239v1 "c2tnb239v1" +#define NID_X9_62_c2tnb239v1 694 +#define OBJ_X9_62_c2tnb239v1 OBJ_X9_62_c_TwoCurve,11L + +#define SN_X9_62_c2tnb239v2 "c2tnb239v2" +#define NID_X9_62_c2tnb239v2 695 +#define OBJ_X9_62_c2tnb239v2 OBJ_X9_62_c_TwoCurve,12L + +#define SN_X9_62_c2tnb239v3 "c2tnb239v3" +#define NID_X9_62_c2tnb239v3 696 +#define OBJ_X9_62_c2tnb239v3 OBJ_X9_62_c_TwoCurve,13L + +#define SN_X9_62_c2onb239v4 "c2onb239v4" +#define NID_X9_62_c2onb239v4 697 +#define OBJ_X9_62_c2onb239v4 OBJ_X9_62_c_TwoCurve,14L + +#define SN_X9_62_c2onb239v5 "c2onb239v5" +#define NID_X9_62_c2onb239v5 698 +#define OBJ_X9_62_c2onb239v5 OBJ_X9_62_c_TwoCurve,15L + +#define SN_X9_62_c2pnb272w1 "c2pnb272w1" +#define NID_X9_62_c2pnb272w1 699 +#define OBJ_X9_62_c2pnb272w1 OBJ_X9_62_c_TwoCurve,16L + +#define SN_X9_62_c2pnb304w1 "c2pnb304w1" +#define NID_X9_62_c2pnb304w1 700 +#define OBJ_X9_62_c2pnb304w1 OBJ_X9_62_c_TwoCurve,17L + +#define SN_X9_62_c2tnb359v1 "c2tnb359v1" +#define NID_X9_62_c2tnb359v1 701 +#define OBJ_X9_62_c2tnb359v1 OBJ_X9_62_c_TwoCurve,18L + +#define SN_X9_62_c2pnb368w1 "c2pnb368w1" +#define NID_X9_62_c2pnb368w1 702 +#define OBJ_X9_62_c2pnb368w1 OBJ_X9_62_c_TwoCurve,19L + +#define SN_X9_62_c2tnb431r1 "c2tnb431r1" +#define NID_X9_62_c2tnb431r1 703 +#define OBJ_X9_62_c2tnb431r1 OBJ_X9_62_c_TwoCurve,20L + +#define OBJ_X9_62_primeCurve OBJ_X9_62_ellipticCurve,1L + +#define SN_X9_62_prime192v1 "prime192v1" +#define NID_X9_62_prime192v1 409 +#define OBJ_X9_62_prime192v1 OBJ_X9_62_primeCurve,1L + +#define SN_X9_62_prime192v2 "prime192v2" +#define NID_X9_62_prime192v2 410 +#define OBJ_X9_62_prime192v2 OBJ_X9_62_primeCurve,2L + +#define SN_X9_62_prime192v3 "prime192v3" +#define NID_X9_62_prime192v3 411 +#define OBJ_X9_62_prime192v3 OBJ_X9_62_primeCurve,3L + +#define SN_X9_62_prime239v1 "prime239v1" +#define NID_X9_62_prime239v1 412 +#define OBJ_X9_62_prime239v1 OBJ_X9_62_primeCurve,4L + +#define SN_X9_62_prime239v2 "prime239v2" +#define NID_X9_62_prime239v2 413 +#define OBJ_X9_62_prime239v2 OBJ_X9_62_primeCurve,5L + +#define SN_X9_62_prime239v3 "prime239v3" +#define NID_X9_62_prime239v3 414 +#define OBJ_X9_62_prime239v3 OBJ_X9_62_primeCurve,6L + +#define SN_X9_62_prime256v1 "prime256v1" +#define NID_X9_62_prime256v1 415 +#define OBJ_X9_62_prime256v1 OBJ_X9_62_primeCurve,7L + +#define OBJ_X9_62_id_ecSigType OBJ_ansi_X9_62,4L + +#define SN_ecdsa_with_SHA1 "ecdsa-with-SHA1" +#define NID_ecdsa_with_SHA1 416 +#define OBJ_ecdsa_with_SHA1 OBJ_X9_62_id_ecSigType,1L + +#define SN_ecdsa_with_Recommended "ecdsa-with-Recommended" +#define NID_ecdsa_with_Recommended 791 +#define OBJ_ecdsa_with_Recommended OBJ_X9_62_id_ecSigType,2L + +#define SN_ecdsa_with_Specified "ecdsa-with-Specified" +#define NID_ecdsa_with_Specified 792 +#define OBJ_ecdsa_with_Specified OBJ_X9_62_id_ecSigType,3L + +#define SN_ecdsa_with_SHA224 "ecdsa-with-SHA224" +#define NID_ecdsa_with_SHA224 793 +#define OBJ_ecdsa_with_SHA224 OBJ_ecdsa_with_Specified,1L + +#define SN_ecdsa_with_SHA256 "ecdsa-with-SHA256" +#define NID_ecdsa_with_SHA256 794 +#define OBJ_ecdsa_with_SHA256 OBJ_ecdsa_with_Specified,2L + +#define SN_ecdsa_with_SHA384 "ecdsa-with-SHA384" +#define NID_ecdsa_with_SHA384 795 +#define OBJ_ecdsa_with_SHA384 OBJ_ecdsa_with_Specified,3L + +#define SN_ecdsa_with_SHA512 "ecdsa-with-SHA512" +#define NID_ecdsa_with_SHA512 796 +#define OBJ_ecdsa_with_SHA512 OBJ_ecdsa_with_Specified,4L + +#define OBJ_secg_ellipticCurve OBJ_certicom_arc,0L + +#define SN_secp112r1 "secp112r1" +#define NID_secp112r1 704 +#define OBJ_secp112r1 OBJ_secg_ellipticCurve,6L + +#define SN_secp112r2 "secp112r2" +#define NID_secp112r2 705 +#define OBJ_secp112r2 OBJ_secg_ellipticCurve,7L + +#define SN_secp128r1 "secp128r1" +#define NID_secp128r1 706 +#define OBJ_secp128r1 OBJ_secg_ellipticCurve,28L + +#define SN_secp128r2 "secp128r2" +#define NID_secp128r2 707 +#define OBJ_secp128r2 OBJ_secg_ellipticCurve,29L + +#define SN_secp160k1 "secp160k1" +#define NID_secp160k1 708 +#define OBJ_secp160k1 OBJ_secg_ellipticCurve,9L + +#define SN_secp160r1 "secp160r1" +#define NID_secp160r1 709 +#define OBJ_secp160r1 OBJ_secg_ellipticCurve,8L + +#define SN_secp160r2 "secp160r2" +#define NID_secp160r2 710 +#define OBJ_secp160r2 OBJ_secg_ellipticCurve,30L + +#define SN_secp192k1 "secp192k1" +#define NID_secp192k1 711 +#define OBJ_secp192k1 OBJ_secg_ellipticCurve,31L + +#define SN_secp224k1 "secp224k1" +#define NID_secp224k1 712 +#define OBJ_secp224k1 OBJ_secg_ellipticCurve,32L + +#define SN_secp224r1 "secp224r1" +#define NID_secp224r1 713 +#define OBJ_secp224r1 OBJ_secg_ellipticCurve,33L + +#define SN_secp256k1 "secp256k1" +#define NID_secp256k1 714 +#define OBJ_secp256k1 OBJ_secg_ellipticCurve,10L + +#define SN_secp384r1 "secp384r1" +#define NID_secp384r1 715 +#define OBJ_secp384r1 OBJ_secg_ellipticCurve,34L + +#define SN_secp521r1 "secp521r1" +#define NID_secp521r1 716 +#define OBJ_secp521r1 OBJ_secg_ellipticCurve,35L + +#define SN_sect113r1 "sect113r1" +#define NID_sect113r1 717 +#define OBJ_sect113r1 OBJ_secg_ellipticCurve,4L + +#define SN_sect113r2 "sect113r2" +#define NID_sect113r2 718 +#define OBJ_sect113r2 OBJ_secg_ellipticCurve,5L + +#define SN_sect131r1 "sect131r1" +#define NID_sect131r1 719 +#define OBJ_sect131r1 OBJ_secg_ellipticCurve,22L + +#define SN_sect131r2 "sect131r2" +#define NID_sect131r2 720 +#define OBJ_sect131r2 OBJ_secg_ellipticCurve,23L + +#define SN_sect163k1 "sect163k1" +#define NID_sect163k1 721 +#define OBJ_sect163k1 OBJ_secg_ellipticCurve,1L + +#define SN_sect163r1 "sect163r1" +#define NID_sect163r1 722 +#define OBJ_sect163r1 OBJ_secg_ellipticCurve,2L + +#define SN_sect163r2 "sect163r2" +#define NID_sect163r2 723 +#define OBJ_sect163r2 OBJ_secg_ellipticCurve,15L + +#define SN_sect193r1 "sect193r1" +#define NID_sect193r1 724 +#define OBJ_sect193r1 OBJ_secg_ellipticCurve,24L + +#define SN_sect193r2 "sect193r2" +#define NID_sect193r2 725 +#define OBJ_sect193r2 OBJ_secg_ellipticCurve,25L + +#define SN_sect233k1 "sect233k1" +#define NID_sect233k1 726 +#define OBJ_sect233k1 OBJ_secg_ellipticCurve,26L + +#define SN_sect233r1 "sect233r1" +#define NID_sect233r1 727 +#define OBJ_sect233r1 OBJ_secg_ellipticCurve,27L + +#define SN_sect239k1 "sect239k1" +#define NID_sect239k1 728 +#define OBJ_sect239k1 OBJ_secg_ellipticCurve,3L + +#define SN_sect283k1 "sect283k1" +#define NID_sect283k1 729 +#define OBJ_sect283k1 OBJ_secg_ellipticCurve,16L + +#define SN_sect283r1 "sect283r1" +#define NID_sect283r1 730 +#define OBJ_sect283r1 OBJ_secg_ellipticCurve,17L + +#define SN_sect409k1 "sect409k1" +#define NID_sect409k1 731 +#define OBJ_sect409k1 OBJ_secg_ellipticCurve,36L + +#define SN_sect409r1 "sect409r1" +#define NID_sect409r1 732 +#define OBJ_sect409r1 OBJ_secg_ellipticCurve,37L + +#define SN_sect571k1 "sect571k1" +#define NID_sect571k1 733 +#define OBJ_sect571k1 OBJ_secg_ellipticCurve,38L + +#define SN_sect571r1 "sect571r1" +#define NID_sect571r1 734 +#define OBJ_sect571r1 OBJ_secg_ellipticCurve,39L + +#define OBJ_wap_wsg_idm_ecid OBJ_wap_wsg,4L + +#define SN_wap_wsg_idm_ecid_wtls1 "wap-wsg-idm-ecid-wtls1" +#define NID_wap_wsg_idm_ecid_wtls1 735 +#define OBJ_wap_wsg_idm_ecid_wtls1 OBJ_wap_wsg_idm_ecid,1L + +#define SN_wap_wsg_idm_ecid_wtls3 "wap-wsg-idm-ecid-wtls3" +#define NID_wap_wsg_idm_ecid_wtls3 736 +#define OBJ_wap_wsg_idm_ecid_wtls3 OBJ_wap_wsg_idm_ecid,3L + +#define SN_wap_wsg_idm_ecid_wtls4 "wap-wsg-idm-ecid-wtls4" +#define NID_wap_wsg_idm_ecid_wtls4 737 +#define OBJ_wap_wsg_idm_ecid_wtls4 OBJ_wap_wsg_idm_ecid,4L + +#define SN_wap_wsg_idm_ecid_wtls5 "wap-wsg-idm-ecid-wtls5" +#define NID_wap_wsg_idm_ecid_wtls5 738 +#define OBJ_wap_wsg_idm_ecid_wtls5 OBJ_wap_wsg_idm_ecid,5L + +#define SN_wap_wsg_idm_ecid_wtls6 "wap-wsg-idm-ecid-wtls6" +#define NID_wap_wsg_idm_ecid_wtls6 739 +#define OBJ_wap_wsg_idm_ecid_wtls6 OBJ_wap_wsg_idm_ecid,6L + +#define SN_wap_wsg_idm_ecid_wtls7 "wap-wsg-idm-ecid-wtls7" +#define NID_wap_wsg_idm_ecid_wtls7 740 +#define OBJ_wap_wsg_idm_ecid_wtls7 OBJ_wap_wsg_idm_ecid,7L + +#define SN_wap_wsg_idm_ecid_wtls8 "wap-wsg-idm-ecid-wtls8" +#define NID_wap_wsg_idm_ecid_wtls8 741 +#define OBJ_wap_wsg_idm_ecid_wtls8 OBJ_wap_wsg_idm_ecid,8L + +#define SN_wap_wsg_idm_ecid_wtls9 "wap-wsg-idm-ecid-wtls9" +#define NID_wap_wsg_idm_ecid_wtls9 742 +#define OBJ_wap_wsg_idm_ecid_wtls9 OBJ_wap_wsg_idm_ecid,9L + +#define SN_wap_wsg_idm_ecid_wtls10 "wap-wsg-idm-ecid-wtls10" +#define NID_wap_wsg_idm_ecid_wtls10 743 +#define OBJ_wap_wsg_idm_ecid_wtls10 OBJ_wap_wsg_idm_ecid,10L + +#define SN_wap_wsg_idm_ecid_wtls11 "wap-wsg-idm-ecid-wtls11" +#define NID_wap_wsg_idm_ecid_wtls11 744 +#define OBJ_wap_wsg_idm_ecid_wtls11 OBJ_wap_wsg_idm_ecid,11L + +#define SN_wap_wsg_idm_ecid_wtls12 "wap-wsg-idm-ecid-wtls12" +#define NID_wap_wsg_idm_ecid_wtls12 745 +#define OBJ_wap_wsg_idm_ecid_wtls12 OBJ_wap_wsg_idm_ecid,12L + +#define SN_cast5_cbc "CAST5-CBC" +#define LN_cast5_cbc "cast5-cbc" +#define NID_cast5_cbc 108 +#define OBJ_cast5_cbc OBJ_ISO_US,113533L,7L,66L,10L + +#define SN_cast5_ecb "CAST5-ECB" +#define LN_cast5_ecb "cast5-ecb" +#define NID_cast5_ecb 109 + +#define SN_cast5_cfb64 "CAST5-CFB" +#define LN_cast5_cfb64 "cast5-cfb" +#define NID_cast5_cfb64 110 + +#define SN_cast5_ofb64 "CAST5-OFB" +#define LN_cast5_ofb64 "cast5-ofb" +#define NID_cast5_ofb64 111 + +#define LN_pbeWithMD5AndCast5_CBC "pbeWithMD5AndCast5CBC" +#define NID_pbeWithMD5AndCast5_CBC 112 +#define OBJ_pbeWithMD5AndCast5_CBC OBJ_ISO_US,113533L,7L,66L,12L + +#define SN_id_PasswordBasedMAC "id-PasswordBasedMAC" +#define LN_id_PasswordBasedMAC "password based MAC" +#define NID_id_PasswordBasedMAC 782 +#define OBJ_id_PasswordBasedMAC OBJ_ISO_US,113533L,7L,66L,13L + +#define SN_id_DHBasedMac "id-DHBasedMac" +#define LN_id_DHBasedMac "Diffie-Hellman based MAC" +#define NID_id_DHBasedMac 783 +#define OBJ_id_DHBasedMac OBJ_ISO_US,113533L,7L,66L,30L + +#define SN_rsadsi "rsadsi" +#define LN_rsadsi "RSA Data Security, Inc." +#define NID_rsadsi 1 +#define OBJ_rsadsi OBJ_ISO_US,113549L + +#define SN_pkcs "pkcs" +#define LN_pkcs "RSA Data Security, Inc. PKCS" +#define NID_pkcs 2 +#define OBJ_pkcs OBJ_rsadsi,1L + +#define SN_pkcs1 "pkcs1" +#define NID_pkcs1 186 +#define OBJ_pkcs1 OBJ_pkcs,1L + +#define LN_rsaEncryption "rsaEncryption" +#define NID_rsaEncryption 6 +#define OBJ_rsaEncryption OBJ_pkcs1,1L + +#define SN_md2WithRSAEncryption "RSA-MD2" +#define LN_md2WithRSAEncryption "md2WithRSAEncryption" +#define NID_md2WithRSAEncryption 7 +#define OBJ_md2WithRSAEncryption OBJ_pkcs1,2L + +#define SN_md4WithRSAEncryption "RSA-MD4" +#define LN_md4WithRSAEncryption "md4WithRSAEncryption" +#define NID_md4WithRSAEncryption 396 +#define OBJ_md4WithRSAEncryption OBJ_pkcs1,3L + +#define SN_md5WithRSAEncryption "RSA-MD5" +#define LN_md5WithRSAEncryption "md5WithRSAEncryption" +#define NID_md5WithRSAEncryption 8 +#define OBJ_md5WithRSAEncryption OBJ_pkcs1,4L + +#define SN_sha1WithRSAEncryption "RSA-SHA1" +#define LN_sha1WithRSAEncryption "sha1WithRSAEncryption" +#define NID_sha1WithRSAEncryption 65 +#define OBJ_sha1WithRSAEncryption OBJ_pkcs1,5L + +#define SN_rsaesOaep "RSAES-OAEP" +#define LN_rsaesOaep "rsaesOaep" +#define NID_rsaesOaep 919 +#define OBJ_rsaesOaep OBJ_pkcs1,7L + +#define SN_mgf1 "MGF1" +#define LN_mgf1 "mgf1" +#define NID_mgf1 911 +#define OBJ_mgf1 OBJ_pkcs1,8L + +#define SN_pSpecified "PSPECIFIED" +#define LN_pSpecified "pSpecified" +#define NID_pSpecified 935 +#define OBJ_pSpecified OBJ_pkcs1,9L + +#define SN_rsassaPss "RSASSA-PSS" +#define LN_rsassaPss "rsassaPss" +#define NID_rsassaPss 912 +#define OBJ_rsassaPss OBJ_pkcs1,10L + +#define SN_sha256WithRSAEncryption "RSA-SHA256" +#define LN_sha256WithRSAEncryption "sha256WithRSAEncryption" +#define NID_sha256WithRSAEncryption 668 +#define OBJ_sha256WithRSAEncryption OBJ_pkcs1,11L + +#define SN_sha384WithRSAEncryption "RSA-SHA384" +#define LN_sha384WithRSAEncryption "sha384WithRSAEncryption" +#define NID_sha384WithRSAEncryption 669 +#define OBJ_sha384WithRSAEncryption OBJ_pkcs1,12L + +#define SN_sha512WithRSAEncryption "RSA-SHA512" +#define LN_sha512WithRSAEncryption "sha512WithRSAEncryption" +#define NID_sha512WithRSAEncryption 670 +#define OBJ_sha512WithRSAEncryption OBJ_pkcs1,13L + +#define SN_sha224WithRSAEncryption "RSA-SHA224" +#define LN_sha224WithRSAEncryption "sha224WithRSAEncryption" +#define NID_sha224WithRSAEncryption 671 +#define OBJ_sha224WithRSAEncryption OBJ_pkcs1,14L + +#define SN_sha512_224WithRSAEncryption "RSA-SHA512/224" +#define LN_sha512_224WithRSAEncryption "sha512-224WithRSAEncryption" +#define NID_sha512_224WithRSAEncryption 1145 +#define OBJ_sha512_224WithRSAEncryption OBJ_pkcs1,15L + +#define SN_sha512_256WithRSAEncryption "RSA-SHA512/256" +#define LN_sha512_256WithRSAEncryption "sha512-256WithRSAEncryption" +#define NID_sha512_256WithRSAEncryption 1146 +#define OBJ_sha512_256WithRSAEncryption OBJ_pkcs1,16L + +#define SN_pkcs3 "pkcs3" +#define NID_pkcs3 27 +#define OBJ_pkcs3 OBJ_pkcs,3L + +#define LN_dhKeyAgreement "dhKeyAgreement" +#define NID_dhKeyAgreement 28 +#define OBJ_dhKeyAgreement OBJ_pkcs3,1L + +#define SN_pkcs5 "pkcs5" +#define NID_pkcs5 187 +#define OBJ_pkcs5 OBJ_pkcs,5L + +#define SN_pbeWithMD2AndDES_CBC "PBE-MD2-DES" +#define LN_pbeWithMD2AndDES_CBC "pbeWithMD2AndDES-CBC" +#define NID_pbeWithMD2AndDES_CBC 9 +#define OBJ_pbeWithMD2AndDES_CBC OBJ_pkcs5,1L + +#define SN_pbeWithMD5AndDES_CBC "PBE-MD5-DES" +#define LN_pbeWithMD5AndDES_CBC "pbeWithMD5AndDES-CBC" +#define NID_pbeWithMD5AndDES_CBC 10 +#define OBJ_pbeWithMD5AndDES_CBC OBJ_pkcs5,3L + +#define SN_pbeWithMD2AndRC2_CBC "PBE-MD2-RC2-64" +#define LN_pbeWithMD2AndRC2_CBC "pbeWithMD2AndRC2-CBC" +#define NID_pbeWithMD2AndRC2_CBC 168 +#define OBJ_pbeWithMD2AndRC2_CBC OBJ_pkcs5,4L + +#define SN_pbeWithMD5AndRC2_CBC "PBE-MD5-RC2-64" +#define LN_pbeWithMD5AndRC2_CBC "pbeWithMD5AndRC2-CBC" +#define NID_pbeWithMD5AndRC2_CBC 169 +#define OBJ_pbeWithMD5AndRC2_CBC OBJ_pkcs5,6L + +#define SN_pbeWithSHA1AndDES_CBC "PBE-SHA1-DES" +#define LN_pbeWithSHA1AndDES_CBC "pbeWithSHA1AndDES-CBC" +#define NID_pbeWithSHA1AndDES_CBC 170 +#define OBJ_pbeWithSHA1AndDES_CBC OBJ_pkcs5,10L + +#define SN_pbeWithSHA1AndRC2_CBC "PBE-SHA1-RC2-64" +#define LN_pbeWithSHA1AndRC2_CBC "pbeWithSHA1AndRC2-CBC" +#define NID_pbeWithSHA1AndRC2_CBC 68 +#define OBJ_pbeWithSHA1AndRC2_CBC OBJ_pkcs5,11L + +#define LN_id_pbkdf2 "PBKDF2" +#define NID_id_pbkdf2 69 +#define OBJ_id_pbkdf2 OBJ_pkcs5,12L + +#define LN_pbes2 "PBES2" +#define NID_pbes2 161 +#define OBJ_pbes2 OBJ_pkcs5,13L + +#define LN_pbmac1 "PBMAC1" +#define NID_pbmac1 162 +#define OBJ_pbmac1 OBJ_pkcs5,14L + +#define SN_pkcs7 "pkcs7" +#define NID_pkcs7 20 +#define OBJ_pkcs7 OBJ_pkcs,7L + +#define LN_pkcs7_data "pkcs7-data" +#define NID_pkcs7_data 21 +#define OBJ_pkcs7_data OBJ_pkcs7,1L + +#define LN_pkcs7_signed "pkcs7-signedData" +#define NID_pkcs7_signed 22 +#define OBJ_pkcs7_signed OBJ_pkcs7,2L + +#define LN_pkcs7_enveloped "pkcs7-envelopedData" +#define NID_pkcs7_enveloped 23 +#define OBJ_pkcs7_enveloped OBJ_pkcs7,3L + +#define LN_pkcs7_signedAndEnveloped "pkcs7-signedAndEnvelopedData" +#define NID_pkcs7_signedAndEnveloped 24 +#define OBJ_pkcs7_signedAndEnveloped OBJ_pkcs7,4L + +#define LN_pkcs7_digest "pkcs7-digestData" +#define NID_pkcs7_digest 25 +#define OBJ_pkcs7_digest OBJ_pkcs7,5L + +#define LN_pkcs7_encrypted "pkcs7-encryptedData" +#define NID_pkcs7_encrypted 26 +#define OBJ_pkcs7_encrypted OBJ_pkcs7,6L + +#define SN_pkcs9 "pkcs9" +#define NID_pkcs9 47 +#define OBJ_pkcs9 OBJ_pkcs,9L + +#define LN_pkcs9_emailAddress "emailAddress" +#define NID_pkcs9_emailAddress 48 +#define OBJ_pkcs9_emailAddress OBJ_pkcs9,1L + +#define LN_pkcs9_unstructuredName "unstructuredName" +#define NID_pkcs9_unstructuredName 49 +#define OBJ_pkcs9_unstructuredName OBJ_pkcs9,2L + +#define LN_pkcs9_contentType "contentType" +#define NID_pkcs9_contentType 50 +#define OBJ_pkcs9_contentType OBJ_pkcs9,3L + +#define LN_pkcs9_messageDigest "messageDigest" +#define NID_pkcs9_messageDigest 51 +#define OBJ_pkcs9_messageDigest OBJ_pkcs9,4L + +#define LN_pkcs9_signingTime "signingTime" +#define NID_pkcs9_signingTime 52 +#define OBJ_pkcs9_signingTime OBJ_pkcs9,5L + +#define LN_pkcs9_countersignature "countersignature" +#define NID_pkcs9_countersignature 53 +#define OBJ_pkcs9_countersignature OBJ_pkcs9,6L + +#define LN_pkcs9_challengePassword "challengePassword" +#define NID_pkcs9_challengePassword 54 +#define OBJ_pkcs9_challengePassword OBJ_pkcs9,7L + +#define LN_pkcs9_unstructuredAddress "unstructuredAddress" +#define NID_pkcs9_unstructuredAddress 55 +#define OBJ_pkcs9_unstructuredAddress OBJ_pkcs9,8L + +#define LN_pkcs9_extCertAttributes "extendedCertificateAttributes" +#define NID_pkcs9_extCertAttributes 56 +#define OBJ_pkcs9_extCertAttributes OBJ_pkcs9,9L + +#define SN_ext_req "extReq" +#define LN_ext_req "Extension Request" +#define NID_ext_req 172 +#define OBJ_ext_req OBJ_pkcs9,14L + +#define SN_SMIMECapabilities "SMIME-CAPS" +#define LN_SMIMECapabilities "S/MIME Capabilities" +#define NID_SMIMECapabilities 167 +#define OBJ_SMIMECapabilities OBJ_pkcs9,15L + +#define SN_SMIME "SMIME" +#define LN_SMIME "S/MIME" +#define NID_SMIME 188 +#define OBJ_SMIME OBJ_pkcs9,16L + +#define SN_id_smime_mod "id-smime-mod" +#define NID_id_smime_mod 189 +#define OBJ_id_smime_mod OBJ_SMIME,0L + +#define SN_id_smime_ct "id-smime-ct" +#define NID_id_smime_ct 190 +#define OBJ_id_smime_ct OBJ_SMIME,1L + +#define SN_id_smime_aa "id-smime-aa" +#define NID_id_smime_aa 191 +#define OBJ_id_smime_aa OBJ_SMIME,2L + +#define SN_id_smime_alg "id-smime-alg" +#define NID_id_smime_alg 192 +#define OBJ_id_smime_alg OBJ_SMIME,3L + +#define SN_id_smime_cd "id-smime-cd" +#define NID_id_smime_cd 193 +#define OBJ_id_smime_cd OBJ_SMIME,4L + +#define SN_id_smime_spq "id-smime-spq" +#define NID_id_smime_spq 194 +#define OBJ_id_smime_spq OBJ_SMIME,5L + +#define SN_id_smime_cti "id-smime-cti" +#define NID_id_smime_cti 195 +#define OBJ_id_smime_cti OBJ_SMIME,6L + +#define SN_id_smime_mod_cms "id-smime-mod-cms" +#define NID_id_smime_mod_cms 196 +#define OBJ_id_smime_mod_cms OBJ_id_smime_mod,1L + +#define SN_id_smime_mod_ess "id-smime-mod-ess" +#define NID_id_smime_mod_ess 197 +#define OBJ_id_smime_mod_ess OBJ_id_smime_mod,2L + +#define SN_id_smime_mod_oid "id-smime-mod-oid" +#define NID_id_smime_mod_oid 198 +#define OBJ_id_smime_mod_oid OBJ_id_smime_mod,3L + +#define SN_id_smime_mod_msg_v3 "id-smime-mod-msg-v3" +#define NID_id_smime_mod_msg_v3 199 +#define OBJ_id_smime_mod_msg_v3 OBJ_id_smime_mod,4L + +#define SN_id_smime_mod_ets_eSignature_88 "id-smime-mod-ets-eSignature-88" +#define NID_id_smime_mod_ets_eSignature_88 200 +#define OBJ_id_smime_mod_ets_eSignature_88 OBJ_id_smime_mod,5L + +#define SN_id_smime_mod_ets_eSignature_97 "id-smime-mod-ets-eSignature-97" +#define NID_id_smime_mod_ets_eSignature_97 201 +#define OBJ_id_smime_mod_ets_eSignature_97 OBJ_id_smime_mod,6L + +#define SN_id_smime_mod_ets_eSigPolicy_88 "id-smime-mod-ets-eSigPolicy-88" +#define NID_id_smime_mod_ets_eSigPolicy_88 202 +#define OBJ_id_smime_mod_ets_eSigPolicy_88 OBJ_id_smime_mod,7L + +#define SN_id_smime_mod_ets_eSigPolicy_97 "id-smime-mod-ets-eSigPolicy-97" +#define NID_id_smime_mod_ets_eSigPolicy_97 203 +#define OBJ_id_smime_mod_ets_eSigPolicy_97 OBJ_id_smime_mod,8L + +#define SN_id_smime_ct_receipt "id-smime-ct-receipt" +#define NID_id_smime_ct_receipt 204 +#define OBJ_id_smime_ct_receipt OBJ_id_smime_ct,1L + +#define SN_id_smime_ct_authData "id-smime-ct-authData" +#define NID_id_smime_ct_authData 205 +#define OBJ_id_smime_ct_authData OBJ_id_smime_ct,2L + +#define SN_id_smime_ct_publishCert "id-smime-ct-publishCert" +#define NID_id_smime_ct_publishCert 206 +#define OBJ_id_smime_ct_publishCert OBJ_id_smime_ct,3L + +#define SN_id_smime_ct_TSTInfo "id-smime-ct-TSTInfo" +#define NID_id_smime_ct_TSTInfo 207 +#define OBJ_id_smime_ct_TSTInfo OBJ_id_smime_ct,4L + +#define SN_id_smime_ct_TDTInfo "id-smime-ct-TDTInfo" +#define NID_id_smime_ct_TDTInfo 208 +#define OBJ_id_smime_ct_TDTInfo OBJ_id_smime_ct,5L + +#define SN_id_smime_ct_contentInfo "id-smime-ct-contentInfo" +#define NID_id_smime_ct_contentInfo 209 +#define OBJ_id_smime_ct_contentInfo OBJ_id_smime_ct,6L + +#define SN_id_smime_ct_DVCSRequestData "id-smime-ct-DVCSRequestData" +#define NID_id_smime_ct_DVCSRequestData 210 +#define OBJ_id_smime_ct_DVCSRequestData OBJ_id_smime_ct,7L + +#define SN_id_smime_ct_DVCSResponseData "id-smime-ct-DVCSResponseData" +#define NID_id_smime_ct_DVCSResponseData 211 +#define OBJ_id_smime_ct_DVCSResponseData OBJ_id_smime_ct,8L + +#define SN_id_smime_ct_compressedData "id-smime-ct-compressedData" +#define NID_id_smime_ct_compressedData 786 +#define OBJ_id_smime_ct_compressedData OBJ_id_smime_ct,9L + +#define SN_id_smime_ct_contentCollection "id-smime-ct-contentCollection" +#define NID_id_smime_ct_contentCollection 1058 +#define OBJ_id_smime_ct_contentCollection OBJ_id_smime_ct,19L + +#define SN_id_smime_ct_authEnvelopedData "id-smime-ct-authEnvelopedData" +#define NID_id_smime_ct_authEnvelopedData 1059 +#define OBJ_id_smime_ct_authEnvelopedData OBJ_id_smime_ct,23L + +#define SN_id_ct_asciiTextWithCRLF "id-ct-asciiTextWithCRLF" +#define NID_id_ct_asciiTextWithCRLF 787 +#define OBJ_id_ct_asciiTextWithCRLF OBJ_id_smime_ct,27L + +#define SN_id_ct_xml "id-ct-xml" +#define NID_id_ct_xml 1060 +#define OBJ_id_ct_xml OBJ_id_smime_ct,28L + +#define SN_id_smime_aa_receiptRequest "id-smime-aa-receiptRequest" +#define NID_id_smime_aa_receiptRequest 212 +#define OBJ_id_smime_aa_receiptRequest OBJ_id_smime_aa,1L + +#define SN_id_smime_aa_securityLabel "id-smime-aa-securityLabel" +#define NID_id_smime_aa_securityLabel 213 +#define OBJ_id_smime_aa_securityLabel OBJ_id_smime_aa,2L + +#define SN_id_smime_aa_mlExpandHistory "id-smime-aa-mlExpandHistory" +#define NID_id_smime_aa_mlExpandHistory 214 +#define OBJ_id_smime_aa_mlExpandHistory OBJ_id_smime_aa,3L + +#define SN_id_smime_aa_contentHint "id-smime-aa-contentHint" +#define NID_id_smime_aa_contentHint 215 +#define OBJ_id_smime_aa_contentHint OBJ_id_smime_aa,4L + +#define SN_id_smime_aa_msgSigDigest "id-smime-aa-msgSigDigest" +#define NID_id_smime_aa_msgSigDigest 216 +#define OBJ_id_smime_aa_msgSigDigest OBJ_id_smime_aa,5L + +#define SN_id_smime_aa_encapContentType "id-smime-aa-encapContentType" +#define NID_id_smime_aa_encapContentType 217 +#define OBJ_id_smime_aa_encapContentType OBJ_id_smime_aa,6L + +#define SN_id_smime_aa_contentIdentifier "id-smime-aa-contentIdentifier" +#define NID_id_smime_aa_contentIdentifier 218 +#define OBJ_id_smime_aa_contentIdentifier OBJ_id_smime_aa,7L + +#define SN_id_smime_aa_macValue "id-smime-aa-macValue" +#define NID_id_smime_aa_macValue 219 +#define OBJ_id_smime_aa_macValue OBJ_id_smime_aa,8L + +#define SN_id_smime_aa_equivalentLabels "id-smime-aa-equivalentLabels" +#define NID_id_smime_aa_equivalentLabels 220 +#define OBJ_id_smime_aa_equivalentLabels OBJ_id_smime_aa,9L + +#define SN_id_smime_aa_contentReference "id-smime-aa-contentReference" +#define NID_id_smime_aa_contentReference 221 +#define OBJ_id_smime_aa_contentReference OBJ_id_smime_aa,10L + +#define SN_id_smime_aa_encrypKeyPref "id-smime-aa-encrypKeyPref" +#define NID_id_smime_aa_encrypKeyPref 222 +#define OBJ_id_smime_aa_encrypKeyPref OBJ_id_smime_aa,11L + +#define SN_id_smime_aa_signingCertificate "id-smime-aa-signingCertificate" +#define NID_id_smime_aa_signingCertificate 223 +#define OBJ_id_smime_aa_signingCertificate OBJ_id_smime_aa,12L + +#define SN_id_smime_aa_smimeEncryptCerts "id-smime-aa-smimeEncryptCerts" +#define NID_id_smime_aa_smimeEncryptCerts 224 +#define OBJ_id_smime_aa_smimeEncryptCerts OBJ_id_smime_aa,13L + +#define SN_id_smime_aa_timeStampToken "id-smime-aa-timeStampToken" +#define NID_id_smime_aa_timeStampToken 225 +#define OBJ_id_smime_aa_timeStampToken OBJ_id_smime_aa,14L + +#define SN_id_smime_aa_ets_sigPolicyId "id-smime-aa-ets-sigPolicyId" +#define NID_id_smime_aa_ets_sigPolicyId 226 +#define OBJ_id_smime_aa_ets_sigPolicyId OBJ_id_smime_aa,15L + +#define SN_id_smime_aa_ets_commitmentType "id-smime-aa-ets-commitmentType" +#define NID_id_smime_aa_ets_commitmentType 227 +#define OBJ_id_smime_aa_ets_commitmentType OBJ_id_smime_aa,16L + +#define SN_id_smime_aa_ets_signerLocation "id-smime-aa-ets-signerLocation" +#define NID_id_smime_aa_ets_signerLocation 228 +#define OBJ_id_smime_aa_ets_signerLocation OBJ_id_smime_aa,17L + +#define SN_id_smime_aa_ets_signerAttr "id-smime-aa-ets-signerAttr" +#define NID_id_smime_aa_ets_signerAttr 229 +#define OBJ_id_smime_aa_ets_signerAttr OBJ_id_smime_aa,18L + +#define SN_id_smime_aa_ets_otherSigCert "id-smime-aa-ets-otherSigCert" +#define NID_id_smime_aa_ets_otherSigCert 230 +#define OBJ_id_smime_aa_ets_otherSigCert OBJ_id_smime_aa,19L + +#define SN_id_smime_aa_ets_contentTimestamp "id-smime-aa-ets-contentTimestamp" +#define NID_id_smime_aa_ets_contentTimestamp 231 +#define OBJ_id_smime_aa_ets_contentTimestamp OBJ_id_smime_aa,20L + +#define SN_id_smime_aa_ets_CertificateRefs "id-smime-aa-ets-CertificateRefs" +#define NID_id_smime_aa_ets_CertificateRefs 232 +#define OBJ_id_smime_aa_ets_CertificateRefs OBJ_id_smime_aa,21L + +#define SN_id_smime_aa_ets_RevocationRefs "id-smime-aa-ets-RevocationRefs" +#define NID_id_smime_aa_ets_RevocationRefs 233 +#define OBJ_id_smime_aa_ets_RevocationRefs OBJ_id_smime_aa,22L + +#define SN_id_smime_aa_ets_certValues "id-smime-aa-ets-certValues" +#define NID_id_smime_aa_ets_certValues 234 +#define OBJ_id_smime_aa_ets_certValues OBJ_id_smime_aa,23L + +#define SN_id_smime_aa_ets_revocationValues "id-smime-aa-ets-revocationValues" +#define NID_id_smime_aa_ets_revocationValues 235 +#define OBJ_id_smime_aa_ets_revocationValues OBJ_id_smime_aa,24L + +#define SN_id_smime_aa_ets_escTimeStamp "id-smime-aa-ets-escTimeStamp" +#define NID_id_smime_aa_ets_escTimeStamp 236 +#define OBJ_id_smime_aa_ets_escTimeStamp OBJ_id_smime_aa,25L + +#define SN_id_smime_aa_ets_certCRLTimestamp "id-smime-aa-ets-certCRLTimestamp" +#define NID_id_smime_aa_ets_certCRLTimestamp 237 +#define OBJ_id_smime_aa_ets_certCRLTimestamp OBJ_id_smime_aa,26L + +#define SN_id_smime_aa_ets_archiveTimeStamp "id-smime-aa-ets-archiveTimeStamp" +#define NID_id_smime_aa_ets_archiveTimeStamp 238 +#define OBJ_id_smime_aa_ets_archiveTimeStamp OBJ_id_smime_aa,27L + +#define SN_id_smime_aa_signatureType "id-smime-aa-signatureType" +#define NID_id_smime_aa_signatureType 239 +#define OBJ_id_smime_aa_signatureType OBJ_id_smime_aa,28L + +#define SN_id_smime_aa_dvcs_dvc "id-smime-aa-dvcs-dvc" +#define NID_id_smime_aa_dvcs_dvc 240 +#define OBJ_id_smime_aa_dvcs_dvc OBJ_id_smime_aa,29L + +#define SN_id_smime_aa_signingCertificateV2 "id-smime-aa-signingCertificateV2" +#define NID_id_smime_aa_signingCertificateV2 1086 +#define OBJ_id_smime_aa_signingCertificateV2 OBJ_id_smime_aa,47L + +#define SN_id_smime_alg_ESDHwith3DES "id-smime-alg-ESDHwith3DES" +#define NID_id_smime_alg_ESDHwith3DES 241 +#define OBJ_id_smime_alg_ESDHwith3DES OBJ_id_smime_alg,1L + +#define SN_id_smime_alg_ESDHwithRC2 "id-smime-alg-ESDHwithRC2" +#define NID_id_smime_alg_ESDHwithRC2 242 +#define OBJ_id_smime_alg_ESDHwithRC2 OBJ_id_smime_alg,2L + +#define SN_id_smime_alg_3DESwrap "id-smime-alg-3DESwrap" +#define NID_id_smime_alg_3DESwrap 243 +#define OBJ_id_smime_alg_3DESwrap OBJ_id_smime_alg,3L + +#define SN_id_smime_alg_RC2wrap "id-smime-alg-RC2wrap" +#define NID_id_smime_alg_RC2wrap 244 +#define OBJ_id_smime_alg_RC2wrap OBJ_id_smime_alg,4L + +#define SN_id_smime_alg_ESDH "id-smime-alg-ESDH" +#define NID_id_smime_alg_ESDH 245 +#define OBJ_id_smime_alg_ESDH OBJ_id_smime_alg,5L + +#define SN_id_smime_alg_CMS3DESwrap "id-smime-alg-CMS3DESwrap" +#define NID_id_smime_alg_CMS3DESwrap 246 +#define OBJ_id_smime_alg_CMS3DESwrap OBJ_id_smime_alg,6L + +#define SN_id_smime_alg_CMSRC2wrap "id-smime-alg-CMSRC2wrap" +#define NID_id_smime_alg_CMSRC2wrap 247 +#define OBJ_id_smime_alg_CMSRC2wrap OBJ_id_smime_alg,7L + +#define SN_id_alg_PWRI_KEK "id-alg-PWRI-KEK" +#define NID_id_alg_PWRI_KEK 893 +#define OBJ_id_alg_PWRI_KEK OBJ_id_smime_alg,9L + +#define SN_id_smime_cd_ldap "id-smime-cd-ldap" +#define NID_id_smime_cd_ldap 248 +#define OBJ_id_smime_cd_ldap OBJ_id_smime_cd,1L + +#define SN_id_smime_spq_ets_sqt_uri "id-smime-spq-ets-sqt-uri" +#define NID_id_smime_spq_ets_sqt_uri 249 +#define OBJ_id_smime_spq_ets_sqt_uri OBJ_id_smime_spq,1L + +#define SN_id_smime_spq_ets_sqt_unotice "id-smime-spq-ets-sqt-unotice" +#define NID_id_smime_spq_ets_sqt_unotice 250 +#define OBJ_id_smime_spq_ets_sqt_unotice OBJ_id_smime_spq,2L + +#define SN_id_smime_cti_ets_proofOfOrigin "id-smime-cti-ets-proofOfOrigin" +#define NID_id_smime_cti_ets_proofOfOrigin 251 +#define OBJ_id_smime_cti_ets_proofOfOrigin OBJ_id_smime_cti,1L + +#define SN_id_smime_cti_ets_proofOfReceipt "id-smime-cti-ets-proofOfReceipt" +#define NID_id_smime_cti_ets_proofOfReceipt 252 +#define OBJ_id_smime_cti_ets_proofOfReceipt OBJ_id_smime_cti,2L + +#define SN_id_smime_cti_ets_proofOfDelivery "id-smime-cti-ets-proofOfDelivery" +#define NID_id_smime_cti_ets_proofOfDelivery 253 +#define OBJ_id_smime_cti_ets_proofOfDelivery OBJ_id_smime_cti,3L + +#define SN_id_smime_cti_ets_proofOfSender "id-smime-cti-ets-proofOfSender" +#define NID_id_smime_cti_ets_proofOfSender 254 +#define OBJ_id_smime_cti_ets_proofOfSender OBJ_id_smime_cti,4L + +#define SN_id_smime_cti_ets_proofOfApproval "id-smime-cti-ets-proofOfApproval" +#define NID_id_smime_cti_ets_proofOfApproval 255 +#define OBJ_id_smime_cti_ets_proofOfApproval OBJ_id_smime_cti,5L + +#define SN_id_smime_cti_ets_proofOfCreation "id-smime-cti-ets-proofOfCreation" +#define NID_id_smime_cti_ets_proofOfCreation 256 +#define OBJ_id_smime_cti_ets_proofOfCreation OBJ_id_smime_cti,6L + +#define LN_friendlyName "friendlyName" +#define NID_friendlyName 156 +#define OBJ_friendlyName OBJ_pkcs9,20L + +#define LN_localKeyID "localKeyID" +#define NID_localKeyID 157 +#define OBJ_localKeyID OBJ_pkcs9,21L + +#define SN_ms_csp_name "CSPName" +#define LN_ms_csp_name "Microsoft CSP Name" +#define NID_ms_csp_name 417 +#define OBJ_ms_csp_name 1L,3L,6L,1L,4L,1L,311L,17L,1L + +#define SN_LocalKeySet "LocalKeySet" +#define LN_LocalKeySet "Microsoft Local Key set" +#define NID_LocalKeySet 856 +#define OBJ_LocalKeySet 1L,3L,6L,1L,4L,1L,311L,17L,2L + +#define OBJ_certTypes OBJ_pkcs9,22L + +#define LN_x509Certificate "x509Certificate" +#define NID_x509Certificate 158 +#define OBJ_x509Certificate OBJ_certTypes,1L + +#define LN_sdsiCertificate "sdsiCertificate" +#define NID_sdsiCertificate 159 +#define OBJ_sdsiCertificate OBJ_certTypes,2L + +#define OBJ_crlTypes OBJ_pkcs9,23L + +#define LN_x509Crl "x509Crl" +#define NID_x509Crl 160 +#define OBJ_x509Crl OBJ_crlTypes,1L + +#define OBJ_pkcs12 OBJ_pkcs,12L + +#define OBJ_pkcs12_pbeids OBJ_pkcs12,1L + +#define SN_pbe_WithSHA1And128BitRC4 "PBE-SHA1-RC4-128" +#define LN_pbe_WithSHA1And128BitRC4 "pbeWithSHA1And128BitRC4" +#define NID_pbe_WithSHA1And128BitRC4 144 +#define OBJ_pbe_WithSHA1And128BitRC4 OBJ_pkcs12_pbeids,1L + +#define SN_pbe_WithSHA1And40BitRC4 "PBE-SHA1-RC4-40" +#define LN_pbe_WithSHA1And40BitRC4 "pbeWithSHA1And40BitRC4" +#define NID_pbe_WithSHA1And40BitRC4 145 +#define OBJ_pbe_WithSHA1And40BitRC4 OBJ_pkcs12_pbeids,2L + +#define SN_pbe_WithSHA1And3_Key_TripleDES_CBC "PBE-SHA1-3DES" +#define LN_pbe_WithSHA1And3_Key_TripleDES_CBC "pbeWithSHA1And3-KeyTripleDES-CBC" +#define NID_pbe_WithSHA1And3_Key_TripleDES_CBC 146 +#define OBJ_pbe_WithSHA1And3_Key_TripleDES_CBC OBJ_pkcs12_pbeids,3L + +#define SN_pbe_WithSHA1And2_Key_TripleDES_CBC "PBE-SHA1-2DES" +#define LN_pbe_WithSHA1And2_Key_TripleDES_CBC "pbeWithSHA1And2-KeyTripleDES-CBC" +#define NID_pbe_WithSHA1And2_Key_TripleDES_CBC 147 +#define OBJ_pbe_WithSHA1And2_Key_TripleDES_CBC OBJ_pkcs12_pbeids,4L + +#define SN_pbe_WithSHA1And128BitRC2_CBC "PBE-SHA1-RC2-128" +#define LN_pbe_WithSHA1And128BitRC2_CBC "pbeWithSHA1And128BitRC2-CBC" +#define NID_pbe_WithSHA1And128BitRC2_CBC 148 +#define OBJ_pbe_WithSHA1And128BitRC2_CBC OBJ_pkcs12_pbeids,5L + +#define SN_pbe_WithSHA1And40BitRC2_CBC "PBE-SHA1-RC2-40" +#define LN_pbe_WithSHA1And40BitRC2_CBC "pbeWithSHA1And40BitRC2-CBC" +#define NID_pbe_WithSHA1And40BitRC2_CBC 149 +#define OBJ_pbe_WithSHA1And40BitRC2_CBC OBJ_pkcs12_pbeids,6L + +#define OBJ_pkcs12_Version1 OBJ_pkcs12,10L + +#define OBJ_pkcs12_BagIds OBJ_pkcs12_Version1,1L + +#define LN_keyBag "keyBag" +#define NID_keyBag 150 +#define OBJ_keyBag OBJ_pkcs12_BagIds,1L + +#define LN_pkcs8ShroudedKeyBag "pkcs8ShroudedKeyBag" +#define NID_pkcs8ShroudedKeyBag 151 +#define OBJ_pkcs8ShroudedKeyBag OBJ_pkcs12_BagIds,2L + +#define LN_certBag "certBag" +#define NID_certBag 152 +#define OBJ_certBag OBJ_pkcs12_BagIds,3L + +#define LN_crlBag "crlBag" +#define NID_crlBag 153 +#define OBJ_crlBag OBJ_pkcs12_BagIds,4L + +#define LN_secretBag "secretBag" +#define NID_secretBag 154 +#define OBJ_secretBag OBJ_pkcs12_BagIds,5L + +#define LN_safeContentsBag "safeContentsBag" +#define NID_safeContentsBag 155 +#define OBJ_safeContentsBag OBJ_pkcs12_BagIds,6L + +#define SN_md2 "MD2" +#define LN_md2 "md2" +#define NID_md2 3 +#define OBJ_md2 OBJ_rsadsi,2L,2L + +#define SN_md4 "MD4" +#define LN_md4 "md4" +#define NID_md4 257 +#define OBJ_md4 OBJ_rsadsi,2L,4L + +#define SN_md5 "MD5" +#define LN_md5 "md5" +#define NID_md5 4 +#define OBJ_md5 OBJ_rsadsi,2L,5L + +#define SN_md5_sha1 "MD5-SHA1" +#define LN_md5_sha1 "md5-sha1" +#define NID_md5_sha1 114 + +#define LN_hmacWithMD5 "hmacWithMD5" +#define NID_hmacWithMD5 797 +#define OBJ_hmacWithMD5 OBJ_rsadsi,2L,6L + +#define LN_hmacWithSHA1 "hmacWithSHA1" +#define NID_hmacWithSHA1 163 +#define OBJ_hmacWithSHA1 OBJ_rsadsi,2L,7L + +#define SN_sm2 "SM2" +#define LN_sm2 "sm2" +#define NID_sm2 1172 +#define OBJ_sm2 OBJ_sm_scheme,301L + +#define SN_sm3 "SM3" +#define LN_sm3 "sm3" +#define NID_sm3 1143 +#define OBJ_sm3 OBJ_sm_scheme,401L + +#define SN_sm3WithRSAEncryption "RSA-SM3" +#define LN_sm3WithRSAEncryption "sm3WithRSAEncryption" +#define NID_sm3WithRSAEncryption 1144 +#define OBJ_sm3WithRSAEncryption OBJ_sm_scheme,504L + +#define LN_hmacWithSHA224 "hmacWithSHA224" +#define NID_hmacWithSHA224 798 +#define OBJ_hmacWithSHA224 OBJ_rsadsi,2L,8L + +#define LN_hmacWithSHA256 "hmacWithSHA256" +#define NID_hmacWithSHA256 799 +#define OBJ_hmacWithSHA256 OBJ_rsadsi,2L,9L + +#define LN_hmacWithSHA384 "hmacWithSHA384" +#define NID_hmacWithSHA384 800 +#define OBJ_hmacWithSHA384 OBJ_rsadsi,2L,10L + +#define LN_hmacWithSHA512 "hmacWithSHA512" +#define NID_hmacWithSHA512 801 +#define OBJ_hmacWithSHA512 OBJ_rsadsi,2L,11L + +#define LN_hmacWithSHA512_224 "hmacWithSHA512-224" +#define NID_hmacWithSHA512_224 1193 +#define OBJ_hmacWithSHA512_224 OBJ_rsadsi,2L,12L + +#define LN_hmacWithSHA512_256 "hmacWithSHA512-256" +#define NID_hmacWithSHA512_256 1194 +#define OBJ_hmacWithSHA512_256 OBJ_rsadsi,2L,13L + +#define SN_rc2_cbc "RC2-CBC" +#define LN_rc2_cbc "rc2-cbc" +#define NID_rc2_cbc 37 +#define OBJ_rc2_cbc OBJ_rsadsi,3L,2L + +#define SN_rc2_ecb "RC2-ECB" +#define LN_rc2_ecb "rc2-ecb" +#define NID_rc2_ecb 38 + +#define SN_rc2_cfb64 "RC2-CFB" +#define LN_rc2_cfb64 "rc2-cfb" +#define NID_rc2_cfb64 39 + +#define SN_rc2_ofb64 "RC2-OFB" +#define LN_rc2_ofb64 "rc2-ofb" +#define NID_rc2_ofb64 40 + +#define SN_rc2_40_cbc "RC2-40-CBC" +#define LN_rc2_40_cbc "rc2-40-cbc" +#define NID_rc2_40_cbc 98 + +#define SN_rc2_64_cbc "RC2-64-CBC" +#define LN_rc2_64_cbc "rc2-64-cbc" +#define NID_rc2_64_cbc 166 + +#define SN_rc4 "RC4" +#define LN_rc4 "rc4" +#define NID_rc4 5 +#define OBJ_rc4 OBJ_rsadsi,3L,4L + +#define SN_rc4_40 "RC4-40" +#define LN_rc4_40 "rc4-40" +#define NID_rc4_40 97 + +#define SN_des_ede3_cbc "DES-EDE3-CBC" +#define LN_des_ede3_cbc "des-ede3-cbc" +#define NID_des_ede3_cbc 44 +#define OBJ_des_ede3_cbc OBJ_rsadsi,3L,7L + +#define SN_rc5_cbc "RC5-CBC" +#define LN_rc5_cbc "rc5-cbc" +#define NID_rc5_cbc 120 +#define OBJ_rc5_cbc OBJ_rsadsi,3L,8L + +#define SN_rc5_ecb "RC5-ECB" +#define LN_rc5_ecb "rc5-ecb" +#define NID_rc5_ecb 121 + +#define SN_rc5_cfb64 "RC5-CFB" +#define LN_rc5_cfb64 "rc5-cfb" +#define NID_rc5_cfb64 122 + +#define SN_rc5_ofb64 "RC5-OFB" +#define LN_rc5_ofb64 "rc5-ofb" +#define NID_rc5_ofb64 123 + +#define SN_ms_ext_req "msExtReq" +#define LN_ms_ext_req "Microsoft Extension Request" +#define NID_ms_ext_req 171 +#define OBJ_ms_ext_req 1L,3L,6L,1L,4L,1L,311L,2L,1L,14L + +#define SN_ms_code_ind "msCodeInd" +#define LN_ms_code_ind "Microsoft Individual Code Signing" +#define NID_ms_code_ind 134 +#define OBJ_ms_code_ind 1L,3L,6L,1L,4L,1L,311L,2L,1L,21L + +#define SN_ms_code_com "msCodeCom" +#define LN_ms_code_com "Microsoft Commercial Code Signing" +#define NID_ms_code_com 135 +#define OBJ_ms_code_com 1L,3L,6L,1L,4L,1L,311L,2L,1L,22L + +#define SN_ms_ctl_sign "msCTLSign" +#define LN_ms_ctl_sign "Microsoft Trust List Signing" +#define NID_ms_ctl_sign 136 +#define OBJ_ms_ctl_sign 1L,3L,6L,1L,4L,1L,311L,10L,3L,1L + +#define SN_ms_sgc "msSGC" +#define LN_ms_sgc "Microsoft Server Gated Crypto" +#define NID_ms_sgc 137 +#define OBJ_ms_sgc 1L,3L,6L,1L,4L,1L,311L,10L,3L,3L + +#define SN_ms_efs "msEFS" +#define LN_ms_efs "Microsoft Encrypted File System" +#define NID_ms_efs 138 +#define OBJ_ms_efs 1L,3L,6L,1L,4L,1L,311L,10L,3L,4L + +#define SN_ms_smartcard_login "msSmartcardLogin" +#define LN_ms_smartcard_login "Microsoft Smartcard Login" +#define NID_ms_smartcard_login 648 +#define OBJ_ms_smartcard_login 1L,3L,6L,1L,4L,1L,311L,20L,2L,2L + +#define SN_ms_upn "msUPN" +#define LN_ms_upn "Microsoft User Principal Name" +#define NID_ms_upn 649 +#define OBJ_ms_upn 1L,3L,6L,1L,4L,1L,311L,20L,2L,3L + +#define SN_idea_cbc "IDEA-CBC" +#define LN_idea_cbc "idea-cbc" +#define NID_idea_cbc 34 +#define OBJ_idea_cbc 1L,3L,6L,1L,4L,1L,188L,7L,1L,1L,2L + +#define SN_idea_ecb "IDEA-ECB" +#define LN_idea_ecb "idea-ecb" +#define NID_idea_ecb 36 + +#define SN_idea_cfb64 "IDEA-CFB" +#define LN_idea_cfb64 "idea-cfb" +#define NID_idea_cfb64 35 + +#define SN_idea_ofb64 "IDEA-OFB" +#define LN_idea_ofb64 "idea-ofb" +#define NID_idea_ofb64 46 + +#define SN_bf_cbc "BF-CBC" +#define LN_bf_cbc "bf-cbc" +#define NID_bf_cbc 91 +#define OBJ_bf_cbc 1L,3L,6L,1L,4L,1L,3029L,1L,2L + +#define SN_bf_ecb "BF-ECB" +#define LN_bf_ecb "bf-ecb" +#define NID_bf_ecb 92 + +#define SN_bf_cfb64 "BF-CFB" +#define LN_bf_cfb64 "bf-cfb" +#define NID_bf_cfb64 93 + +#define SN_bf_ofb64 "BF-OFB" +#define LN_bf_ofb64 "bf-ofb" +#define NID_bf_ofb64 94 + +#define SN_id_pkix "PKIX" +#define NID_id_pkix 127 +#define OBJ_id_pkix 1L,3L,6L,1L,5L,5L,7L + +#define SN_id_pkix_mod "id-pkix-mod" +#define NID_id_pkix_mod 258 +#define OBJ_id_pkix_mod OBJ_id_pkix,0L + +#define SN_id_pe "id-pe" +#define NID_id_pe 175 +#define OBJ_id_pe OBJ_id_pkix,1L + +#define SN_id_qt "id-qt" +#define NID_id_qt 259 +#define OBJ_id_qt OBJ_id_pkix,2L + +#define SN_id_kp "id-kp" +#define NID_id_kp 128 +#define OBJ_id_kp OBJ_id_pkix,3L + +#define SN_id_it "id-it" +#define NID_id_it 260 +#define OBJ_id_it OBJ_id_pkix,4L + +#define SN_id_pkip "id-pkip" +#define NID_id_pkip 261 +#define OBJ_id_pkip OBJ_id_pkix,5L + +#define SN_id_alg "id-alg" +#define NID_id_alg 262 +#define OBJ_id_alg OBJ_id_pkix,6L + +#define SN_id_cmc "id-cmc" +#define NID_id_cmc 263 +#define OBJ_id_cmc OBJ_id_pkix,7L + +#define SN_id_on "id-on" +#define NID_id_on 264 +#define OBJ_id_on OBJ_id_pkix,8L + +#define SN_id_pda "id-pda" +#define NID_id_pda 265 +#define OBJ_id_pda OBJ_id_pkix,9L + +#define SN_id_aca "id-aca" +#define NID_id_aca 266 +#define OBJ_id_aca OBJ_id_pkix,10L + +#define SN_id_qcs "id-qcs" +#define NID_id_qcs 267 +#define OBJ_id_qcs OBJ_id_pkix,11L + +#define SN_id_cct "id-cct" +#define NID_id_cct 268 +#define OBJ_id_cct OBJ_id_pkix,12L + +#define SN_id_ppl "id-ppl" +#define NID_id_ppl 662 +#define OBJ_id_ppl OBJ_id_pkix,21L + +#define SN_id_ad "id-ad" +#define NID_id_ad 176 +#define OBJ_id_ad OBJ_id_pkix,48L + +#define SN_id_pkix1_explicit_88 "id-pkix1-explicit-88" +#define NID_id_pkix1_explicit_88 269 +#define OBJ_id_pkix1_explicit_88 OBJ_id_pkix_mod,1L + +#define SN_id_pkix1_implicit_88 "id-pkix1-implicit-88" +#define NID_id_pkix1_implicit_88 270 +#define OBJ_id_pkix1_implicit_88 OBJ_id_pkix_mod,2L + +#define SN_id_pkix1_explicit_93 "id-pkix1-explicit-93" +#define NID_id_pkix1_explicit_93 271 +#define OBJ_id_pkix1_explicit_93 OBJ_id_pkix_mod,3L + +#define SN_id_pkix1_implicit_93 "id-pkix1-implicit-93" +#define NID_id_pkix1_implicit_93 272 +#define OBJ_id_pkix1_implicit_93 OBJ_id_pkix_mod,4L + +#define SN_id_mod_crmf "id-mod-crmf" +#define NID_id_mod_crmf 273 +#define OBJ_id_mod_crmf OBJ_id_pkix_mod,5L + +#define SN_id_mod_cmc "id-mod-cmc" +#define NID_id_mod_cmc 274 +#define OBJ_id_mod_cmc OBJ_id_pkix_mod,6L + +#define SN_id_mod_kea_profile_88 "id-mod-kea-profile-88" +#define NID_id_mod_kea_profile_88 275 +#define OBJ_id_mod_kea_profile_88 OBJ_id_pkix_mod,7L + +#define SN_id_mod_kea_profile_93 "id-mod-kea-profile-93" +#define NID_id_mod_kea_profile_93 276 +#define OBJ_id_mod_kea_profile_93 OBJ_id_pkix_mod,8L + +#define SN_id_mod_cmp "id-mod-cmp" +#define NID_id_mod_cmp 277 +#define OBJ_id_mod_cmp OBJ_id_pkix_mod,9L + +#define SN_id_mod_qualified_cert_88 "id-mod-qualified-cert-88" +#define NID_id_mod_qualified_cert_88 278 +#define OBJ_id_mod_qualified_cert_88 OBJ_id_pkix_mod,10L + +#define SN_id_mod_qualified_cert_93 "id-mod-qualified-cert-93" +#define NID_id_mod_qualified_cert_93 279 +#define OBJ_id_mod_qualified_cert_93 OBJ_id_pkix_mod,11L + +#define SN_id_mod_attribute_cert "id-mod-attribute-cert" +#define NID_id_mod_attribute_cert 280 +#define OBJ_id_mod_attribute_cert OBJ_id_pkix_mod,12L + +#define SN_id_mod_timestamp_protocol "id-mod-timestamp-protocol" +#define NID_id_mod_timestamp_protocol 281 +#define OBJ_id_mod_timestamp_protocol OBJ_id_pkix_mod,13L + +#define SN_id_mod_ocsp "id-mod-ocsp" +#define NID_id_mod_ocsp 282 +#define OBJ_id_mod_ocsp OBJ_id_pkix_mod,14L + +#define SN_id_mod_dvcs "id-mod-dvcs" +#define NID_id_mod_dvcs 283 +#define OBJ_id_mod_dvcs OBJ_id_pkix_mod,15L + +#define SN_id_mod_cmp2000 "id-mod-cmp2000" +#define NID_id_mod_cmp2000 284 +#define OBJ_id_mod_cmp2000 OBJ_id_pkix_mod,16L + +#define SN_info_access "authorityInfoAccess" +#define LN_info_access "Authority Information Access" +#define NID_info_access 177 +#define OBJ_info_access OBJ_id_pe,1L + +#define SN_biometricInfo "biometricInfo" +#define LN_biometricInfo "Biometric Info" +#define NID_biometricInfo 285 +#define OBJ_biometricInfo OBJ_id_pe,2L + +#define SN_qcStatements "qcStatements" +#define NID_qcStatements 286 +#define OBJ_qcStatements OBJ_id_pe,3L + +#define SN_ac_auditEntity "ac-auditEntity" +#define NID_ac_auditEntity 287 +#define OBJ_ac_auditEntity OBJ_id_pe,4L + +#define SN_ac_targeting "ac-targeting" +#define NID_ac_targeting 288 +#define OBJ_ac_targeting OBJ_id_pe,5L + +#define SN_aaControls "aaControls" +#define NID_aaControls 289 +#define OBJ_aaControls OBJ_id_pe,6L + +#define SN_sbgp_ipAddrBlock "sbgp-ipAddrBlock" +#define NID_sbgp_ipAddrBlock 290 +#define OBJ_sbgp_ipAddrBlock OBJ_id_pe,7L + +#define SN_sbgp_autonomousSysNum "sbgp-autonomousSysNum" +#define NID_sbgp_autonomousSysNum 291 +#define OBJ_sbgp_autonomousSysNum OBJ_id_pe,8L + +#define SN_sbgp_routerIdentifier "sbgp-routerIdentifier" +#define NID_sbgp_routerIdentifier 292 +#define OBJ_sbgp_routerIdentifier OBJ_id_pe,9L + +#define SN_ac_proxying "ac-proxying" +#define NID_ac_proxying 397 +#define OBJ_ac_proxying OBJ_id_pe,10L + +#define SN_sinfo_access "subjectInfoAccess" +#define LN_sinfo_access "Subject Information Access" +#define NID_sinfo_access 398 +#define OBJ_sinfo_access OBJ_id_pe,11L + +#define SN_proxyCertInfo "proxyCertInfo" +#define LN_proxyCertInfo "Proxy Certificate Information" +#define NID_proxyCertInfo 663 +#define OBJ_proxyCertInfo OBJ_id_pe,14L + +#define SN_tlsfeature "tlsfeature" +#define LN_tlsfeature "TLS Feature" +#define NID_tlsfeature 1020 +#define OBJ_tlsfeature OBJ_id_pe,24L + +#define SN_id_qt_cps "id-qt-cps" +#define LN_id_qt_cps "Policy Qualifier CPS" +#define NID_id_qt_cps 164 +#define OBJ_id_qt_cps OBJ_id_qt,1L + +#define SN_id_qt_unotice "id-qt-unotice" +#define LN_id_qt_unotice "Policy Qualifier User Notice" +#define NID_id_qt_unotice 165 +#define OBJ_id_qt_unotice OBJ_id_qt,2L + +#define SN_textNotice "textNotice" +#define NID_textNotice 293 +#define OBJ_textNotice OBJ_id_qt,3L + +#define SN_server_auth "serverAuth" +#define LN_server_auth "TLS Web Server Authentication" +#define NID_server_auth 129 +#define OBJ_server_auth OBJ_id_kp,1L + +#define SN_client_auth "clientAuth" +#define LN_client_auth "TLS Web Client Authentication" +#define NID_client_auth 130 +#define OBJ_client_auth OBJ_id_kp,2L + +#define SN_code_sign "codeSigning" +#define LN_code_sign "Code Signing" +#define NID_code_sign 131 +#define OBJ_code_sign OBJ_id_kp,3L + +#define SN_email_protect "emailProtection" +#define LN_email_protect "E-mail Protection" +#define NID_email_protect 132 +#define OBJ_email_protect OBJ_id_kp,4L + +#define SN_ipsecEndSystem "ipsecEndSystem" +#define LN_ipsecEndSystem "IPSec End System" +#define NID_ipsecEndSystem 294 +#define OBJ_ipsecEndSystem OBJ_id_kp,5L + +#define SN_ipsecTunnel "ipsecTunnel" +#define LN_ipsecTunnel "IPSec Tunnel" +#define NID_ipsecTunnel 295 +#define OBJ_ipsecTunnel OBJ_id_kp,6L + +#define SN_ipsecUser "ipsecUser" +#define LN_ipsecUser "IPSec User" +#define NID_ipsecUser 296 +#define OBJ_ipsecUser OBJ_id_kp,7L + +#define SN_time_stamp "timeStamping" +#define LN_time_stamp "Time Stamping" +#define NID_time_stamp 133 +#define OBJ_time_stamp OBJ_id_kp,8L + +#define SN_OCSP_sign "OCSPSigning" +#define LN_OCSP_sign "OCSP Signing" +#define NID_OCSP_sign 180 +#define OBJ_OCSP_sign OBJ_id_kp,9L + +#define SN_dvcs "DVCS" +#define LN_dvcs "dvcs" +#define NID_dvcs 297 +#define OBJ_dvcs OBJ_id_kp,10L + +#define SN_ipsec_IKE "ipsecIKE" +#define LN_ipsec_IKE "ipsec Internet Key Exchange" +#define NID_ipsec_IKE 1022 +#define OBJ_ipsec_IKE OBJ_id_kp,17L + +#define SN_capwapAC "capwapAC" +#define LN_capwapAC "Ctrl/provision WAP Access" +#define NID_capwapAC 1023 +#define OBJ_capwapAC OBJ_id_kp,18L + +#define SN_capwapWTP "capwapWTP" +#define LN_capwapWTP "Ctrl/Provision WAP Termination" +#define NID_capwapWTP 1024 +#define OBJ_capwapWTP OBJ_id_kp,19L + +#define SN_sshClient "secureShellClient" +#define LN_sshClient "SSH Client" +#define NID_sshClient 1025 +#define OBJ_sshClient OBJ_id_kp,21L + +#define SN_sshServer "secureShellServer" +#define LN_sshServer "SSH Server" +#define NID_sshServer 1026 +#define OBJ_sshServer OBJ_id_kp,22L + +#define SN_sendRouter "sendRouter" +#define LN_sendRouter "Send Router" +#define NID_sendRouter 1027 +#define OBJ_sendRouter OBJ_id_kp,23L + +#define SN_sendProxiedRouter "sendProxiedRouter" +#define LN_sendProxiedRouter "Send Proxied Router" +#define NID_sendProxiedRouter 1028 +#define OBJ_sendProxiedRouter OBJ_id_kp,24L + +#define SN_sendOwner "sendOwner" +#define LN_sendOwner "Send Owner" +#define NID_sendOwner 1029 +#define OBJ_sendOwner OBJ_id_kp,25L + +#define SN_sendProxiedOwner "sendProxiedOwner" +#define LN_sendProxiedOwner "Send Proxied Owner" +#define NID_sendProxiedOwner 1030 +#define OBJ_sendProxiedOwner OBJ_id_kp,26L + +#define SN_cmcCA "cmcCA" +#define LN_cmcCA "CMC Certificate Authority" +#define NID_cmcCA 1131 +#define OBJ_cmcCA OBJ_id_kp,27L + +#define SN_cmcRA "cmcRA" +#define LN_cmcRA "CMC Registration Authority" +#define NID_cmcRA 1132 +#define OBJ_cmcRA OBJ_id_kp,28L + +#define SN_id_it_caProtEncCert "id-it-caProtEncCert" +#define NID_id_it_caProtEncCert 298 +#define OBJ_id_it_caProtEncCert OBJ_id_it,1L + +#define SN_id_it_signKeyPairTypes "id-it-signKeyPairTypes" +#define NID_id_it_signKeyPairTypes 299 +#define OBJ_id_it_signKeyPairTypes OBJ_id_it,2L + +#define SN_id_it_encKeyPairTypes "id-it-encKeyPairTypes" +#define NID_id_it_encKeyPairTypes 300 +#define OBJ_id_it_encKeyPairTypes OBJ_id_it,3L + +#define SN_id_it_preferredSymmAlg "id-it-preferredSymmAlg" +#define NID_id_it_preferredSymmAlg 301 +#define OBJ_id_it_preferredSymmAlg OBJ_id_it,4L + +#define SN_id_it_caKeyUpdateInfo "id-it-caKeyUpdateInfo" +#define NID_id_it_caKeyUpdateInfo 302 +#define OBJ_id_it_caKeyUpdateInfo OBJ_id_it,5L + +#define SN_id_it_currentCRL "id-it-currentCRL" +#define NID_id_it_currentCRL 303 +#define OBJ_id_it_currentCRL OBJ_id_it,6L + +#define SN_id_it_unsupportedOIDs "id-it-unsupportedOIDs" +#define NID_id_it_unsupportedOIDs 304 +#define OBJ_id_it_unsupportedOIDs OBJ_id_it,7L + +#define SN_id_it_subscriptionRequest "id-it-subscriptionRequest" +#define NID_id_it_subscriptionRequest 305 +#define OBJ_id_it_subscriptionRequest OBJ_id_it,8L + +#define SN_id_it_subscriptionResponse "id-it-subscriptionResponse" +#define NID_id_it_subscriptionResponse 306 +#define OBJ_id_it_subscriptionResponse OBJ_id_it,9L + +#define SN_id_it_keyPairParamReq "id-it-keyPairParamReq" +#define NID_id_it_keyPairParamReq 307 +#define OBJ_id_it_keyPairParamReq OBJ_id_it,10L + +#define SN_id_it_keyPairParamRep "id-it-keyPairParamRep" +#define NID_id_it_keyPairParamRep 308 +#define OBJ_id_it_keyPairParamRep OBJ_id_it,11L + +#define SN_id_it_revPassphrase "id-it-revPassphrase" +#define NID_id_it_revPassphrase 309 +#define OBJ_id_it_revPassphrase OBJ_id_it,12L + +#define SN_id_it_implicitConfirm "id-it-implicitConfirm" +#define NID_id_it_implicitConfirm 310 +#define OBJ_id_it_implicitConfirm OBJ_id_it,13L + +#define SN_id_it_confirmWaitTime "id-it-confirmWaitTime" +#define NID_id_it_confirmWaitTime 311 +#define OBJ_id_it_confirmWaitTime OBJ_id_it,14L + +#define SN_id_it_origPKIMessage "id-it-origPKIMessage" +#define NID_id_it_origPKIMessage 312 +#define OBJ_id_it_origPKIMessage OBJ_id_it,15L + +#define SN_id_it_suppLangTags "id-it-suppLangTags" +#define NID_id_it_suppLangTags 784 +#define OBJ_id_it_suppLangTags OBJ_id_it,16L + +#define SN_id_regCtrl "id-regCtrl" +#define NID_id_regCtrl 313 +#define OBJ_id_regCtrl OBJ_id_pkip,1L + +#define SN_id_regInfo "id-regInfo" +#define NID_id_regInfo 314 +#define OBJ_id_regInfo OBJ_id_pkip,2L + +#define SN_id_regCtrl_regToken "id-regCtrl-regToken" +#define NID_id_regCtrl_regToken 315 +#define OBJ_id_regCtrl_regToken OBJ_id_regCtrl,1L + +#define SN_id_regCtrl_authenticator "id-regCtrl-authenticator" +#define NID_id_regCtrl_authenticator 316 +#define OBJ_id_regCtrl_authenticator OBJ_id_regCtrl,2L + +#define SN_id_regCtrl_pkiPublicationInfo "id-regCtrl-pkiPublicationInfo" +#define NID_id_regCtrl_pkiPublicationInfo 317 +#define OBJ_id_regCtrl_pkiPublicationInfo OBJ_id_regCtrl,3L + +#define SN_id_regCtrl_pkiArchiveOptions "id-regCtrl-pkiArchiveOptions" +#define NID_id_regCtrl_pkiArchiveOptions 318 +#define OBJ_id_regCtrl_pkiArchiveOptions OBJ_id_regCtrl,4L + +#define SN_id_regCtrl_oldCertID "id-regCtrl-oldCertID" +#define NID_id_regCtrl_oldCertID 319 +#define OBJ_id_regCtrl_oldCertID OBJ_id_regCtrl,5L + +#define SN_id_regCtrl_protocolEncrKey "id-regCtrl-protocolEncrKey" +#define NID_id_regCtrl_protocolEncrKey 320 +#define OBJ_id_regCtrl_protocolEncrKey OBJ_id_regCtrl,6L + +#define SN_id_regInfo_utf8Pairs "id-regInfo-utf8Pairs" +#define NID_id_regInfo_utf8Pairs 321 +#define OBJ_id_regInfo_utf8Pairs OBJ_id_regInfo,1L + +#define SN_id_regInfo_certReq "id-regInfo-certReq" +#define NID_id_regInfo_certReq 322 +#define OBJ_id_regInfo_certReq OBJ_id_regInfo,2L + +#define SN_id_alg_des40 "id-alg-des40" +#define NID_id_alg_des40 323 +#define OBJ_id_alg_des40 OBJ_id_alg,1L + +#define SN_id_alg_noSignature "id-alg-noSignature" +#define NID_id_alg_noSignature 324 +#define OBJ_id_alg_noSignature OBJ_id_alg,2L + +#define SN_id_alg_dh_sig_hmac_sha1 "id-alg-dh-sig-hmac-sha1" +#define NID_id_alg_dh_sig_hmac_sha1 325 +#define OBJ_id_alg_dh_sig_hmac_sha1 OBJ_id_alg,3L + +#define SN_id_alg_dh_pop "id-alg-dh-pop" +#define NID_id_alg_dh_pop 326 +#define OBJ_id_alg_dh_pop OBJ_id_alg,4L + +#define SN_id_cmc_statusInfo "id-cmc-statusInfo" +#define NID_id_cmc_statusInfo 327 +#define OBJ_id_cmc_statusInfo OBJ_id_cmc,1L + +#define SN_id_cmc_identification "id-cmc-identification" +#define NID_id_cmc_identification 328 +#define OBJ_id_cmc_identification OBJ_id_cmc,2L + +#define SN_id_cmc_identityProof "id-cmc-identityProof" +#define NID_id_cmc_identityProof 329 +#define OBJ_id_cmc_identityProof OBJ_id_cmc,3L + +#define SN_id_cmc_dataReturn "id-cmc-dataReturn" +#define NID_id_cmc_dataReturn 330 +#define OBJ_id_cmc_dataReturn OBJ_id_cmc,4L + +#define SN_id_cmc_transactionId "id-cmc-transactionId" +#define NID_id_cmc_transactionId 331 +#define OBJ_id_cmc_transactionId OBJ_id_cmc,5L + +#define SN_id_cmc_senderNonce "id-cmc-senderNonce" +#define NID_id_cmc_senderNonce 332 +#define OBJ_id_cmc_senderNonce OBJ_id_cmc,6L + +#define SN_id_cmc_recipientNonce "id-cmc-recipientNonce" +#define NID_id_cmc_recipientNonce 333 +#define OBJ_id_cmc_recipientNonce OBJ_id_cmc,7L + +#define SN_id_cmc_addExtensions "id-cmc-addExtensions" +#define NID_id_cmc_addExtensions 334 +#define OBJ_id_cmc_addExtensions OBJ_id_cmc,8L + +#define SN_id_cmc_encryptedPOP "id-cmc-encryptedPOP" +#define NID_id_cmc_encryptedPOP 335 +#define OBJ_id_cmc_encryptedPOP OBJ_id_cmc,9L + +#define SN_id_cmc_decryptedPOP "id-cmc-decryptedPOP" +#define NID_id_cmc_decryptedPOP 336 +#define OBJ_id_cmc_decryptedPOP OBJ_id_cmc,10L + +#define SN_id_cmc_lraPOPWitness "id-cmc-lraPOPWitness" +#define NID_id_cmc_lraPOPWitness 337 +#define OBJ_id_cmc_lraPOPWitness OBJ_id_cmc,11L + +#define SN_id_cmc_getCert "id-cmc-getCert" +#define NID_id_cmc_getCert 338 +#define OBJ_id_cmc_getCert OBJ_id_cmc,15L + +#define SN_id_cmc_getCRL "id-cmc-getCRL" +#define NID_id_cmc_getCRL 339 +#define OBJ_id_cmc_getCRL OBJ_id_cmc,16L + +#define SN_id_cmc_revokeRequest "id-cmc-revokeRequest" +#define NID_id_cmc_revokeRequest 340 +#define OBJ_id_cmc_revokeRequest OBJ_id_cmc,17L + +#define SN_id_cmc_regInfo "id-cmc-regInfo" +#define NID_id_cmc_regInfo 341 +#define OBJ_id_cmc_regInfo OBJ_id_cmc,18L + +#define SN_id_cmc_responseInfo "id-cmc-responseInfo" +#define NID_id_cmc_responseInfo 342 +#define OBJ_id_cmc_responseInfo OBJ_id_cmc,19L + +#define SN_id_cmc_queryPending "id-cmc-queryPending" +#define NID_id_cmc_queryPending 343 +#define OBJ_id_cmc_queryPending OBJ_id_cmc,21L + +#define SN_id_cmc_popLinkRandom "id-cmc-popLinkRandom" +#define NID_id_cmc_popLinkRandom 344 +#define OBJ_id_cmc_popLinkRandom OBJ_id_cmc,22L + +#define SN_id_cmc_popLinkWitness "id-cmc-popLinkWitness" +#define NID_id_cmc_popLinkWitness 345 +#define OBJ_id_cmc_popLinkWitness OBJ_id_cmc,23L + +#define SN_id_cmc_confirmCertAcceptance "id-cmc-confirmCertAcceptance" +#define NID_id_cmc_confirmCertAcceptance 346 +#define OBJ_id_cmc_confirmCertAcceptance OBJ_id_cmc,24L + +#define SN_id_on_personalData "id-on-personalData" +#define NID_id_on_personalData 347 +#define OBJ_id_on_personalData OBJ_id_on,1L + +#define SN_id_on_permanentIdentifier "id-on-permanentIdentifier" +#define LN_id_on_permanentIdentifier "Permanent Identifier" +#define NID_id_on_permanentIdentifier 858 +#define OBJ_id_on_permanentIdentifier OBJ_id_on,3L + +#define SN_id_pda_dateOfBirth "id-pda-dateOfBirth" +#define NID_id_pda_dateOfBirth 348 +#define OBJ_id_pda_dateOfBirth OBJ_id_pda,1L + +#define SN_id_pda_placeOfBirth "id-pda-placeOfBirth" +#define NID_id_pda_placeOfBirth 349 +#define OBJ_id_pda_placeOfBirth OBJ_id_pda,2L + +#define SN_id_pda_gender "id-pda-gender" +#define NID_id_pda_gender 351 +#define OBJ_id_pda_gender OBJ_id_pda,3L + +#define SN_id_pda_countryOfCitizenship "id-pda-countryOfCitizenship" +#define NID_id_pda_countryOfCitizenship 352 +#define OBJ_id_pda_countryOfCitizenship OBJ_id_pda,4L + +#define SN_id_pda_countryOfResidence "id-pda-countryOfResidence" +#define NID_id_pda_countryOfResidence 353 +#define OBJ_id_pda_countryOfResidence OBJ_id_pda,5L + +#define SN_id_aca_authenticationInfo "id-aca-authenticationInfo" +#define NID_id_aca_authenticationInfo 354 +#define OBJ_id_aca_authenticationInfo OBJ_id_aca,1L + +#define SN_id_aca_accessIdentity "id-aca-accessIdentity" +#define NID_id_aca_accessIdentity 355 +#define OBJ_id_aca_accessIdentity OBJ_id_aca,2L + +#define SN_id_aca_chargingIdentity "id-aca-chargingIdentity" +#define NID_id_aca_chargingIdentity 356 +#define OBJ_id_aca_chargingIdentity OBJ_id_aca,3L + +#define SN_id_aca_group "id-aca-group" +#define NID_id_aca_group 357 +#define OBJ_id_aca_group OBJ_id_aca,4L + +#define SN_id_aca_role "id-aca-role" +#define NID_id_aca_role 358 +#define OBJ_id_aca_role OBJ_id_aca,5L + +#define SN_id_aca_encAttrs "id-aca-encAttrs" +#define NID_id_aca_encAttrs 399 +#define OBJ_id_aca_encAttrs OBJ_id_aca,6L + +#define SN_id_qcs_pkixQCSyntax_v1 "id-qcs-pkixQCSyntax-v1" +#define NID_id_qcs_pkixQCSyntax_v1 359 +#define OBJ_id_qcs_pkixQCSyntax_v1 OBJ_id_qcs,1L + +#define SN_id_cct_crs "id-cct-crs" +#define NID_id_cct_crs 360 +#define OBJ_id_cct_crs OBJ_id_cct,1L + +#define SN_id_cct_PKIData "id-cct-PKIData" +#define NID_id_cct_PKIData 361 +#define OBJ_id_cct_PKIData OBJ_id_cct,2L + +#define SN_id_cct_PKIResponse "id-cct-PKIResponse" +#define NID_id_cct_PKIResponse 362 +#define OBJ_id_cct_PKIResponse OBJ_id_cct,3L + +#define SN_id_ppl_anyLanguage "id-ppl-anyLanguage" +#define LN_id_ppl_anyLanguage "Any language" +#define NID_id_ppl_anyLanguage 664 +#define OBJ_id_ppl_anyLanguage OBJ_id_ppl,0L + +#define SN_id_ppl_inheritAll "id-ppl-inheritAll" +#define LN_id_ppl_inheritAll "Inherit all" +#define NID_id_ppl_inheritAll 665 +#define OBJ_id_ppl_inheritAll OBJ_id_ppl,1L + +#define SN_Independent "id-ppl-independent" +#define LN_Independent "Independent" +#define NID_Independent 667 +#define OBJ_Independent OBJ_id_ppl,2L + +#define SN_ad_OCSP "OCSP" +#define LN_ad_OCSP "OCSP" +#define NID_ad_OCSP 178 +#define OBJ_ad_OCSP OBJ_id_ad,1L + +#define SN_ad_ca_issuers "caIssuers" +#define LN_ad_ca_issuers "CA Issuers" +#define NID_ad_ca_issuers 179 +#define OBJ_ad_ca_issuers OBJ_id_ad,2L + +#define SN_ad_timeStamping "ad_timestamping" +#define LN_ad_timeStamping "AD Time Stamping" +#define NID_ad_timeStamping 363 +#define OBJ_ad_timeStamping OBJ_id_ad,3L + +#define SN_ad_dvcs "AD_DVCS" +#define LN_ad_dvcs "ad dvcs" +#define NID_ad_dvcs 364 +#define OBJ_ad_dvcs OBJ_id_ad,4L + +#define SN_caRepository "caRepository" +#define LN_caRepository "CA Repository" +#define NID_caRepository 785 +#define OBJ_caRepository OBJ_id_ad,5L + +#define OBJ_id_pkix_OCSP OBJ_ad_OCSP + +#define SN_id_pkix_OCSP_basic "basicOCSPResponse" +#define LN_id_pkix_OCSP_basic "Basic OCSP Response" +#define NID_id_pkix_OCSP_basic 365 +#define OBJ_id_pkix_OCSP_basic OBJ_id_pkix_OCSP,1L + +#define SN_id_pkix_OCSP_Nonce "Nonce" +#define LN_id_pkix_OCSP_Nonce "OCSP Nonce" +#define NID_id_pkix_OCSP_Nonce 366 +#define OBJ_id_pkix_OCSP_Nonce OBJ_id_pkix_OCSP,2L + +#define SN_id_pkix_OCSP_CrlID "CrlID" +#define LN_id_pkix_OCSP_CrlID "OCSP CRL ID" +#define NID_id_pkix_OCSP_CrlID 367 +#define OBJ_id_pkix_OCSP_CrlID OBJ_id_pkix_OCSP,3L + +#define SN_id_pkix_OCSP_acceptableResponses "acceptableResponses" +#define LN_id_pkix_OCSP_acceptableResponses "Acceptable OCSP Responses" +#define NID_id_pkix_OCSP_acceptableResponses 368 +#define OBJ_id_pkix_OCSP_acceptableResponses OBJ_id_pkix_OCSP,4L + +#define SN_id_pkix_OCSP_noCheck "noCheck" +#define LN_id_pkix_OCSP_noCheck "OCSP No Check" +#define NID_id_pkix_OCSP_noCheck 369 +#define OBJ_id_pkix_OCSP_noCheck OBJ_id_pkix_OCSP,5L + +#define SN_id_pkix_OCSP_archiveCutoff "archiveCutoff" +#define LN_id_pkix_OCSP_archiveCutoff "OCSP Archive Cutoff" +#define NID_id_pkix_OCSP_archiveCutoff 370 +#define OBJ_id_pkix_OCSP_archiveCutoff OBJ_id_pkix_OCSP,6L + +#define SN_id_pkix_OCSP_serviceLocator "serviceLocator" +#define LN_id_pkix_OCSP_serviceLocator "OCSP Service Locator" +#define NID_id_pkix_OCSP_serviceLocator 371 +#define OBJ_id_pkix_OCSP_serviceLocator OBJ_id_pkix_OCSP,7L + +#define SN_id_pkix_OCSP_extendedStatus "extendedStatus" +#define LN_id_pkix_OCSP_extendedStatus "Extended OCSP Status" +#define NID_id_pkix_OCSP_extendedStatus 372 +#define OBJ_id_pkix_OCSP_extendedStatus OBJ_id_pkix_OCSP,8L + +#define SN_id_pkix_OCSP_valid "valid" +#define NID_id_pkix_OCSP_valid 373 +#define OBJ_id_pkix_OCSP_valid OBJ_id_pkix_OCSP,9L + +#define SN_id_pkix_OCSP_path "path" +#define NID_id_pkix_OCSP_path 374 +#define OBJ_id_pkix_OCSP_path OBJ_id_pkix_OCSP,10L + +#define SN_id_pkix_OCSP_trustRoot "trustRoot" +#define LN_id_pkix_OCSP_trustRoot "Trust Root" +#define NID_id_pkix_OCSP_trustRoot 375 +#define OBJ_id_pkix_OCSP_trustRoot OBJ_id_pkix_OCSP,11L + +#define SN_algorithm "algorithm" +#define LN_algorithm "algorithm" +#define NID_algorithm 376 +#define OBJ_algorithm 1L,3L,14L,3L,2L + +#define SN_md5WithRSA "RSA-NP-MD5" +#define LN_md5WithRSA "md5WithRSA" +#define NID_md5WithRSA 104 +#define OBJ_md5WithRSA OBJ_algorithm,3L + +#define SN_des_ecb "DES-ECB" +#define LN_des_ecb "des-ecb" +#define NID_des_ecb 29 +#define OBJ_des_ecb OBJ_algorithm,6L + +#define SN_des_cbc "DES-CBC" +#define LN_des_cbc "des-cbc" +#define NID_des_cbc 31 +#define OBJ_des_cbc OBJ_algorithm,7L + +#define SN_des_ofb64 "DES-OFB" +#define LN_des_ofb64 "des-ofb" +#define NID_des_ofb64 45 +#define OBJ_des_ofb64 OBJ_algorithm,8L + +#define SN_des_cfb64 "DES-CFB" +#define LN_des_cfb64 "des-cfb" +#define NID_des_cfb64 30 +#define OBJ_des_cfb64 OBJ_algorithm,9L + +#define SN_rsaSignature "rsaSignature" +#define NID_rsaSignature 377 +#define OBJ_rsaSignature OBJ_algorithm,11L + +#define SN_dsa_2 "DSA-old" +#define LN_dsa_2 "dsaEncryption-old" +#define NID_dsa_2 67 +#define OBJ_dsa_2 OBJ_algorithm,12L + +#define SN_dsaWithSHA "DSA-SHA" +#define LN_dsaWithSHA "dsaWithSHA" +#define NID_dsaWithSHA 66 +#define OBJ_dsaWithSHA OBJ_algorithm,13L + +#define SN_shaWithRSAEncryption "RSA-SHA" +#define LN_shaWithRSAEncryption "shaWithRSAEncryption" +#define NID_shaWithRSAEncryption 42 +#define OBJ_shaWithRSAEncryption OBJ_algorithm,15L + +#define SN_des_ede_ecb "DES-EDE" +#define LN_des_ede_ecb "des-ede" +#define NID_des_ede_ecb 32 +#define OBJ_des_ede_ecb OBJ_algorithm,17L + +#define SN_des_ede3_ecb "DES-EDE3" +#define LN_des_ede3_ecb "des-ede3" +#define NID_des_ede3_ecb 33 + +#define SN_des_ede_cbc "DES-EDE-CBC" +#define LN_des_ede_cbc "des-ede-cbc" +#define NID_des_ede_cbc 43 + +#define SN_des_ede_cfb64 "DES-EDE-CFB" +#define LN_des_ede_cfb64 "des-ede-cfb" +#define NID_des_ede_cfb64 60 + +#define SN_des_ede3_cfb64 "DES-EDE3-CFB" +#define LN_des_ede3_cfb64 "des-ede3-cfb" +#define NID_des_ede3_cfb64 61 + +#define SN_des_ede_ofb64 "DES-EDE-OFB" +#define LN_des_ede_ofb64 "des-ede-ofb" +#define NID_des_ede_ofb64 62 + +#define SN_des_ede3_ofb64 "DES-EDE3-OFB" +#define LN_des_ede3_ofb64 "des-ede3-ofb" +#define NID_des_ede3_ofb64 63 + +#define SN_desx_cbc "DESX-CBC" +#define LN_desx_cbc "desx-cbc" +#define NID_desx_cbc 80 + +#define SN_sha "SHA" +#define LN_sha "sha" +#define NID_sha 41 +#define OBJ_sha OBJ_algorithm,18L + +#define SN_sha1 "SHA1" +#define LN_sha1 "sha1" +#define NID_sha1 64 +#define OBJ_sha1 OBJ_algorithm,26L + +#define SN_dsaWithSHA1_2 "DSA-SHA1-old" +#define LN_dsaWithSHA1_2 "dsaWithSHA1-old" +#define NID_dsaWithSHA1_2 70 +#define OBJ_dsaWithSHA1_2 OBJ_algorithm,27L + +#define SN_sha1WithRSA "RSA-SHA1-2" +#define LN_sha1WithRSA "sha1WithRSA" +#define NID_sha1WithRSA 115 +#define OBJ_sha1WithRSA OBJ_algorithm,29L + +#define SN_ripemd160 "RIPEMD160" +#define LN_ripemd160 "ripemd160" +#define NID_ripemd160 117 +#define OBJ_ripemd160 1L,3L,36L,3L,2L,1L + +#define SN_ripemd160WithRSA "RSA-RIPEMD160" +#define LN_ripemd160WithRSA "ripemd160WithRSA" +#define NID_ripemd160WithRSA 119 +#define OBJ_ripemd160WithRSA 1L,3L,36L,3L,3L,1L,2L + +#define SN_blake2b512 "BLAKE2b512" +#define LN_blake2b512 "blake2b512" +#define NID_blake2b512 1056 +#define OBJ_blake2b512 1L,3L,6L,1L,4L,1L,1722L,12L,2L,1L,16L + +#define SN_blake2s256 "BLAKE2s256" +#define LN_blake2s256 "blake2s256" +#define NID_blake2s256 1057 +#define OBJ_blake2s256 1L,3L,6L,1L,4L,1L,1722L,12L,2L,2L,8L + +#define SN_sxnet "SXNetID" +#define LN_sxnet "Strong Extranet ID" +#define NID_sxnet 143 +#define OBJ_sxnet 1L,3L,101L,1L,4L,1L + +#define SN_X500 "X500" +#define LN_X500 "directory services (X.500)" +#define NID_X500 11 +#define OBJ_X500 2L,5L + +#define SN_X509 "X509" +#define NID_X509 12 +#define OBJ_X509 OBJ_X500,4L + +#define SN_commonName "CN" +#define LN_commonName "commonName" +#define NID_commonName 13 +#define OBJ_commonName OBJ_X509,3L + +#define SN_surname "SN" +#define LN_surname "surname" +#define NID_surname 100 +#define OBJ_surname OBJ_X509,4L + +#define LN_serialNumber "serialNumber" +#define NID_serialNumber 105 +#define OBJ_serialNumber OBJ_X509,5L + +#define SN_countryName "C" +#define LN_countryName "countryName" +#define NID_countryName 14 +#define OBJ_countryName OBJ_X509,6L + +#define SN_localityName "L" +#define LN_localityName "localityName" +#define NID_localityName 15 +#define OBJ_localityName OBJ_X509,7L + +#define SN_stateOrProvinceName "ST" +#define LN_stateOrProvinceName "stateOrProvinceName" +#define NID_stateOrProvinceName 16 +#define OBJ_stateOrProvinceName OBJ_X509,8L + +#define SN_streetAddress "street" +#define LN_streetAddress "streetAddress" +#define NID_streetAddress 660 +#define OBJ_streetAddress OBJ_X509,9L + +#define SN_organizationName "O" +#define LN_organizationName "organizationName" +#define NID_organizationName 17 +#define OBJ_organizationName OBJ_X509,10L + +#define SN_organizationalUnitName "OU" +#define LN_organizationalUnitName "organizationalUnitName" +#define NID_organizationalUnitName 18 +#define OBJ_organizationalUnitName OBJ_X509,11L + +#define SN_title "title" +#define LN_title "title" +#define NID_title 106 +#define OBJ_title OBJ_X509,12L + +#define LN_description "description" +#define NID_description 107 +#define OBJ_description OBJ_X509,13L + +#define LN_searchGuide "searchGuide" +#define NID_searchGuide 859 +#define OBJ_searchGuide OBJ_X509,14L + +#define LN_businessCategory "businessCategory" +#define NID_businessCategory 860 +#define OBJ_businessCategory OBJ_X509,15L + +#define LN_postalAddress "postalAddress" +#define NID_postalAddress 861 +#define OBJ_postalAddress OBJ_X509,16L + +#define LN_postalCode "postalCode" +#define NID_postalCode 661 +#define OBJ_postalCode OBJ_X509,17L + +#define LN_postOfficeBox "postOfficeBox" +#define NID_postOfficeBox 862 +#define OBJ_postOfficeBox OBJ_X509,18L + +#define LN_physicalDeliveryOfficeName "physicalDeliveryOfficeName" +#define NID_physicalDeliveryOfficeName 863 +#define OBJ_physicalDeliveryOfficeName OBJ_X509,19L + +#define LN_telephoneNumber "telephoneNumber" +#define NID_telephoneNumber 864 +#define OBJ_telephoneNumber OBJ_X509,20L + +#define LN_telexNumber "telexNumber" +#define NID_telexNumber 865 +#define OBJ_telexNumber OBJ_X509,21L + +#define LN_teletexTerminalIdentifier "teletexTerminalIdentifier" +#define NID_teletexTerminalIdentifier 866 +#define OBJ_teletexTerminalIdentifier OBJ_X509,22L + +#define LN_facsimileTelephoneNumber "facsimileTelephoneNumber" +#define NID_facsimileTelephoneNumber 867 +#define OBJ_facsimileTelephoneNumber OBJ_X509,23L + +#define LN_x121Address "x121Address" +#define NID_x121Address 868 +#define OBJ_x121Address OBJ_X509,24L + +#define LN_internationaliSDNNumber "internationaliSDNNumber" +#define NID_internationaliSDNNumber 869 +#define OBJ_internationaliSDNNumber OBJ_X509,25L + +#define LN_registeredAddress "registeredAddress" +#define NID_registeredAddress 870 +#define OBJ_registeredAddress OBJ_X509,26L + +#define LN_destinationIndicator "destinationIndicator" +#define NID_destinationIndicator 871 +#define OBJ_destinationIndicator OBJ_X509,27L + +#define LN_preferredDeliveryMethod "preferredDeliveryMethod" +#define NID_preferredDeliveryMethod 872 +#define OBJ_preferredDeliveryMethod OBJ_X509,28L + +#define LN_presentationAddress "presentationAddress" +#define NID_presentationAddress 873 +#define OBJ_presentationAddress OBJ_X509,29L + +#define LN_supportedApplicationContext "supportedApplicationContext" +#define NID_supportedApplicationContext 874 +#define OBJ_supportedApplicationContext OBJ_X509,30L + +#define SN_member "member" +#define NID_member 875 +#define OBJ_member OBJ_X509,31L + +#define SN_owner "owner" +#define NID_owner 876 +#define OBJ_owner OBJ_X509,32L + +#define LN_roleOccupant "roleOccupant" +#define NID_roleOccupant 877 +#define OBJ_roleOccupant OBJ_X509,33L + +#define SN_seeAlso "seeAlso" +#define NID_seeAlso 878 +#define OBJ_seeAlso OBJ_X509,34L + +#define LN_userPassword "userPassword" +#define NID_userPassword 879 +#define OBJ_userPassword OBJ_X509,35L + +#define LN_userCertificate "userCertificate" +#define NID_userCertificate 880 +#define OBJ_userCertificate OBJ_X509,36L + +#define LN_cACertificate "cACertificate" +#define NID_cACertificate 881 +#define OBJ_cACertificate OBJ_X509,37L + +#define LN_authorityRevocationList "authorityRevocationList" +#define NID_authorityRevocationList 882 +#define OBJ_authorityRevocationList OBJ_X509,38L + +#define LN_certificateRevocationList "certificateRevocationList" +#define NID_certificateRevocationList 883 +#define OBJ_certificateRevocationList OBJ_X509,39L + +#define LN_crossCertificatePair "crossCertificatePair" +#define NID_crossCertificatePair 884 +#define OBJ_crossCertificatePair OBJ_X509,40L + +#define SN_name "name" +#define LN_name "name" +#define NID_name 173 +#define OBJ_name OBJ_X509,41L + +#define SN_givenName "GN" +#define LN_givenName "givenName" +#define NID_givenName 99 +#define OBJ_givenName OBJ_X509,42L + +#define SN_initials "initials" +#define LN_initials "initials" +#define NID_initials 101 +#define OBJ_initials OBJ_X509,43L + +#define LN_generationQualifier "generationQualifier" +#define NID_generationQualifier 509 +#define OBJ_generationQualifier OBJ_X509,44L + +#define LN_x500UniqueIdentifier "x500UniqueIdentifier" +#define NID_x500UniqueIdentifier 503 +#define OBJ_x500UniqueIdentifier OBJ_X509,45L + +#define SN_dnQualifier "dnQualifier" +#define LN_dnQualifier "dnQualifier" +#define NID_dnQualifier 174 +#define OBJ_dnQualifier OBJ_X509,46L + +#define LN_enhancedSearchGuide "enhancedSearchGuide" +#define NID_enhancedSearchGuide 885 +#define OBJ_enhancedSearchGuide OBJ_X509,47L + +#define LN_protocolInformation "protocolInformation" +#define NID_protocolInformation 886 +#define OBJ_protocolInformation OBJ_X509,48L + +#define LN_distinguishedName "distinguishedName" +#define NID_distinguishedName 887 +#define OBJ_distinguishedName OBJ_X509,49L + +#define LN_uniqueMember "uniqueMember" +#define NID_uniqueMember 888 +#define OBJ_uniqueMember OBJ_X509,50L + +#define LN_houseIdentifier "houseIdentifier" +#define NID_houseIdentifier 889 +#define OBJ_houseIdentifier OBJ_X509,51L + +#define LN_supportedAlgorithms "supportedAlgorithms" +#define NID_supportedAlgorithms 890 +#define OBJ_supportedAlgorithms OBJ_X509,52L + +#define LN_deltaRevocationList "deltaRevocationList" +#define NID_deltaRevocationList 891 +#define OBJ_deltaRevocationList OBJ_X509,53L + +#define SN_dmdName "dmdName" +#define NID_dmdName 892 +#define OBJ_dmdName OBJ_X509,54L + +#define LN_pseudonym "pseudonym" +#define NID_pseudonym 510 +#define OBJ_pseudonym OBJ_X509,65L + +#define SN_role "role" +#define LN_role "role" +#define NID_role 400 +#define OBJ_role OBJ_X509,72L + +#define LN_organizationIdentifier "organizationIdentifier" +#define NID_organizationIdentifier 1089 +#define OBJ_organizationIdentifier OBJ_X509,97L + +#define SN_countryCode3c "c3" +#define LN_countryCode3c "countryCode3c" +#define NID_countryCode3c 1090 +#define OBJ_countryCode3c OBJ_X509,98L + +#define SN_countryCode3n "n3" +#define LN_countryCode3n "countryCode3n" +#define NID_countryCode3n 1091 +#define OBJ_countryCode3n OBJ_X509,99L + +#define LN_dnsName "dnsName" +#define NID_dnsName 1092 +#define OBJ_dnsName OBJ_X509,100L + +#define SN_X500algorithms "X500algorithms" +#define LN_X500algorithms "directory services - algorithms" +#define NID_X500algorithms 378 +#define OBJ_X500algorithms OBJ_X500,8L + +#define SN_rsa "RSA" +#define LN_rsa "rsa" +#define NID_rsa 19 +#define OBJ_rsa OBJ_X500algorithms,1L,1L + +#define SN_mdc2WithRSA "RSA-MDC2" +#define LN_mdc2WithRSA "mdc2WithRSA" +#define NID_mdc2WithRSA 96 +#define OBJ_mdc2WithRSA OBJ_X500algorithms,3L,100L + +#define SN_mdc2 "MDC2" +#define LN_mdc2 "mdc2" +#define NID_mdc2 95 +#define OBJ_mdc2 OBJ_X500algorithms,3L,101L + +#define SN_id_ce "id-ce" +#define NID_id_ce 81 +#define OBJ_id_ce OBJ_X500,29L + +#define SN_subject_directory_attributes "subjectDirectoryAttributes" +#define LN_subject_directory_attributes "X509v3 Subject Directory Attributes" +#define NID_subject_directory_attributes 769 +#define OBJ_subject_directory_attributes OBJ_id_ce,9L + +#define SN_subject_key_identifier "subjectKeyIdentifier" +#define LN_subject_key_identifier "X509v3 Subject Key Identifier" +#define NID_subject_key_identifier 82 +#define OBJ_subject_key_identifier OBJ_id_ce,14L + +#define SN_key_usage "keyUsage" +#define LN_key_usage "X509v3 Key Usage" +#define NID_key_usage 83 +#define OBJ_key_usage OBJ_id_ce,15L + +#define SN_private_key_usage_period "privateKeyUsagePeriod" +#define LN_private_key_usage_period "X509v3 Private Key Usage Period" +#define NID_private_key_usage_period 84 +#define OBJ_private_key_usage_period OBJ_id_ce,16L + +#define SN_subject_alt_name "subjectAltName" +#define LN_subject_alt_name "X509v3 Subject Alternative Name" +#define NID_subject_alt_name 85 +#define OBJ_subject_alt_name OBJ_id_ce,17L + +#define SN_issuer_alt_name "issuerAltName" +#define LN_issuer_alt_name "X509v3 Issuer Alternative Name" +#define NID_issuer_alt_name 86 +#define OBJ_issuer_alt_name OBJ_id_ce,18L + +#define SN_basic_constraints "basicConstraints" +#define LN_basic_constraints "X509v3 Basic Constraints" +#define NID_basic_constraints 87 +#define OBJ_basic_constraints OBJ_id_ce,19L + +#define SN_crl_number "crlNumber" +#define LN_crl_number "X509v3 CRL Number" +#define NID_crl_number 88 +#define OBJ_crl_number OBJ_id_ce,20L + +#define SN_crl_reason "CRLReason" +#define LN_crl_reason "X509v3 CRL Reason Code" +#define NID_crl_reason 141 +#define OBJ_crl_reason OBJ_id_ce,21L + +#define SN_invalidity_date "invalidityDate" +#define LN_invalidity_date "Invalidity Date" +#define NID_invalidity_date 142 +#define OBJ_invalidity_date OBJ_id_ce,24L + +#define SN_delta_crl "deltaCRL" +#define LN_delta_crl "X509v3 Delta CRL Indicator" +#define NID_delta_crl 140 +#define OBJ_delta_crl OBJ_id_ce,27L + +#define SN_issuing_distribution_point "issuingDistributionPoint" +#define LN_issuing_distribution_point "X509v3 Issuing Distribution Point" +#define NID_issuing_distribution_point 770 +#define OBJ_issuing_distribution_point OBJ_id_ce,28L + +#define SN_certificate_issuer "certificateIssuer" +#define LN_certificate_issuer "X509v3 Certificate Issuer" +#define NID_certificate_issuer 771 +#define OBJ_certificate_issuer OBJ_id_ce,29L + +#define SN_name_constraints "nameConstraints" +#define LN_name_constraints "X509v3 Name Constraints" +#define NID_name_constraints 666 +#define OBJ_name_constraints OBJ_id_ce,30L + +#define SN_crl_distribution_points "crlDistributionPoints" +#define LN_crl_distribution_points "X509v3 CRL Distribution Points" +#define NID_crl_distribution_points 103 +#define OBJ_crl_distribution_points OBJ_id_ce,31L + +#define SN_certificate_policies "certificatePolicies" +#define LN_certificate_policies "X509v3 Certificate Policies" +#define NID_certificate_policies 89 +#define OBJ_certificate_policies OBJ_id_ce,32L + +#define SN_any_policy "anyPolicy" +#define LN_any_policy "X509v3 Any Policy" +#define NID_any_policy 746 +#define OBJ_any_policy OBJ_certificate_policies,0L + +#define SN_policy_mappings "policyMappings" +#define LN_policy_mappings "X509v3 Policy Mappings" +#define NID_policy_mappings 747 +#define OBJ_policy_mappings OBJ_id_ce,33L + +#define SN_authority_key_identifier "authorityKeyIdentifier" +#define LN_authority_key_identifier "X509v3 Authority Key Identifier" +#define NID_authority_key_identifier 90 +#define OBJ_authority_key_identifier OBJ_id_ce,35L + +#define SN_policy_constraints "policyConstraints" +#define LN_policy_constraints "X509v3 Policy Constraints" +#define NID_policy_constraints 401 +#define OBJ_policy_constraints OBJ_id_ce,36L + +#define SN_ext_key_usage "extendedKeyUsage" +#define LN_ext_key_usage "X509v3 Extended Key Usage" +#define NID_ext_key_usage 126 +#define OBJ_ext_key_usage OBJ_id_ce,37L + +#define SN_freshest_crl "freshestCRL" +#define LN_freshest_crl "X509v3 Freshest CRL" +#define NID_freshest_crl 857 +#define OBJ_freshest_crl OBJ_id_ce,46L + +#define SN_inhibit_any_policy "inhibitAnyPolicy" +#define LN_inhibit_any_policy "X509v3 Inhibit Any Policy" +#define NID_inhibit_any_policy 748 +#define OBJ_inhibit_any_policy OBJ_id_ce,54L + +#define SN_target_information "targetInformation" +#define LN_target_information "X509v3 AC Targeting" +#define NID_target_information 402 +#define OBJ_target_information OBJ_id_ce,55L + +#define SN_no_rev_avail "noRevAvail" +#define LN_no_rev_avail "X509v3 No Revocation Available" +#define NID_no_rev_avail 403 +#define OBJ_no_rev_avail OBJ_id_ce,56L + +#define SN_anyExtendedKeyUsage "anyExtendedKeyUsage" +#define LN_anyExtendedKeyUsage "Any Extended Key Usage" +#define NID_anyExtendedKeyUsage 910 +#define OBJ_anyExtendedKeyUsage OBJ_ext_key_usage,0L + +#define SN_netscape "Netscape" +#define LN_netscape "Netscape Communications Corp." +#define NID_netscape 57 +#define OBJ_netscape 2L,16L,840L,1L,113730L + +#define SN_netscape_cert_extension "nsCertExt" +#define LN_netscape_cert_extension "Netscape Certificate Extension" +#define NID_netscape_cert_extension 58 +#define OBJ_netscape_cert_extension OBJ_netscape,1L + +#define SN_netscape_data_type "nsDataType" +#define LN_netscape_data_type "Netscape Data Type" +#define NID_netscape_data_type 59 +#define OBJ_netscape_data_type OBJ_netscape,2L + +#define SN_netscape_cert_type "nsCertType" +#define LN_netscape_cert_type "Netscape Cert Type" +#define NID_netscape_cert_type 71 +#define OBJ_netscape_cert_type OBJ_netscape_cert_extension,1L + +#define SN_netscape_base_url "nsBaseUrl" +#define LN_netscape_base_url "Netscape Base Url" +#define NID_netscape_base_url 72 +#define OBJ_netscape_base_url OBJ_netscape_cert_extension,2L + +#define SN_netscape_revocation_url "nsRevocationUrl" +#define LN_netscape_revocation_url "Netscape Revocation Url" +#define NID_netscape_revocation_url 73 +#define OBJ_netscape_revocation_url OBJ_netscape_cert_extension,3L + +#define SN_netscape_ca_revocation_url "nsCaRevocationUrl" +#define LN_netscape_ca_revocation_url "Netscape CA Revocation Url" +#define NID_netscape_ca_revocation_url 74 +#define OBJ_netscape_ca_revocation_url OBJ_netscape_cert_extension,4L + +#define SN_netscape_renewal_url "nsRenewalUrl" +#define LN_netscape_renewal_url "Netscape Renewal Url" +#define NID_netscape_renewal_url 75 +#define OBJ_netscape_renewal_url OBJ_netscape_cert_extension,7L + +#define SN_netscape_ca_policy_url "nsCaPolicyUrl" +#define LN_netscape_ca_policy_url "Netscape CA Policy Url" +#define NID_netscape_ca_policy_url 76 +#define OBJ_netscape_ca_policy_url OBJ_netscape_cert_extension,8L + +#define SN_netscape_ssl_server_name "nsSslServerName" +#define LN_netscape_ssl_server_name "Netscape SSL Server Name" +#define NID_netscape_ssl_server_name 77 +#define OBJ_netscape_ssl_server_name OBJ_netscape_cert_extension,12L + +#define SN_netscape_comment "nsComment" +#define LN_netscape_comment "Netscape Comment" +#define NID_netscape_comment 78 +#define OBJ_netscape_comment OBJ_netscape_cert_extension,13L + +#define SN_netscape_cert_sequence "nsCertSequence" +#define LN_netscape_cert_sequence "Netscape Certificate Sequence" +#define NID_netscape_cert_sequence 79 +#define OBJ_netscape_cert_sequence OBJ_netscape_data_type,5L + +#define SN_ns_sgc "nsSGC" +#define LN_ns_sgc "Netscape Server Gated Crypto" +#define NID_ns_sgc 139 +#define OBJ_ns_sgc OBJ_netscape,4L,1L + +#define SN_org "ORG" +#define LN_org "org" +#define NID_org 379 +#define OBJ_org OBJ_iso,3L + +#define SN_dod "DOD" +#define LN_dod "dod" +#define NID_dod 380 +#define OBJ_dod OBJ_org,6L + +#define SN_iana "IANA" +#define LN_iana "iana" +#define NID_iana 381 +#define OBJ_iana OBJ_dod,1L + +#define OBJ_internet OBJ_iana + +#define SN_Directory "directory" +#define LN_Directory "Directory" +#define NID_Directory 382 +#define OBJ_Directory OBJ_internet,1L + +#define SN_Management "mgmt" +#define LN_Management "Management" +#define NID_Management 383 +#define OBJ_Management OBJ_internet,2L + +#define SN_Experimental "experimental" +#define LN_Experimental "Experimental" +#define NID_Experimental 384 +#define OBJ_Experimental OBJ_internet,3L + +#define SN_Private "private" +#define LN_Private "Private" +#define NID_Private 385 +#define OBJ_Private OBJ_internet,4L + +#define SN_Security "security" +#define LN_Security "Security" +#define NID_Security 386 +#define OBJ_Security OBJ_internet,5L + +#define SN_SNMPv2 "snmpv2" +#define LN_SNMPv2 "SNMPv2" +#define NID_SNMPv2 387 +#define OBJ_SNMPv2 OBJ_internet,6L + +#define LN_Mail "Mail" +#define NID_Mail 388 +#define OBJ_Mail OBJ_internet,7L + +#define SN_Enterprises "enterprises" +#define LN_Enterprises "Enterprises" +#define NID_Enterprises 389 +#define OBJ_Enterprises OBJ_Private,1L + +#define SN_dcObject "dcobject" +#define LN_dcObject "dcObject" +#define NID_dcObject 390 +#define OBJ_dcObject OBJ_Enterprises,1466L,344L + +#define SN_mime_mhs "mime-mhs" +#define LN_mime_mhs "MIME MHS" +#define NID_mime_mhs 504 +#define OBJ_mime_mhs OBJ_Mail,1L + +#define SN_mime_mhs_headings "mime-mhs-headings" +#define LN_mime_mhs_headings "mime-mhs-headings" +#define NID_mime_mhs_headings 505 +#define OBJ_mime_mhs_headings OBJ_mime_mhs,1L + +#define SN_mime_mhs_bodies "mime-mhs-bodies" +#define LN_mime_mhs_bodies "mime-mhs-bodies" +#define NID_mime_mhs_bodies 506 +#define OBJ_mime_mhs_bodies OBJ_mime_mhs,2L + +#define SN_id_hex_partial_message "id-hex-partial-message" +#define LN_id_hex_partial_message "id-hex-partial-message" +#define NID_id_hex_partial_message 507 +#define OBJ_id_hex_partial_message OBJ_mime_mhs_headings,1L + +#define SN_id_hex_multipart_message "id-hex-multipart-message" +#define LN_id_hex_multipart_message "id-hex-multipart-message" +#define NID_id_hex_multipart_message 508 +#define OBJ_id_hex_multipart_message OBJ_mime_mhs_headings,2L + +#define SN_zlib_compression "ZLIB" +#define LN_zlib_compression "zlib compression" +#define NID_zlib_compression 125 +#define OBJ_zlib_compression OBJ_id_smime_alg,8L + +#define OBJ_csor 2L,16L,840L,1L,101L,3L + +#define OBJ_nistAlgorithms OBJ_csor,4L + +#define OBJ_aes OBJ_nistAlgorithms,1L + +#define SN_aes_128_ecb "AES-128-ECB" +#define LN_aes_128_ecb "aes-128-ecb" +#define NID_aes_128_ecb 418 +#define OBJ_aes_128_ecb OBJ_aes,1L + +#define SN_aes_128_cbc "AES-128-CBC" +#define LN_aes_128_cbc "aes-128-cbc" +#define NID_aes_128_cbc 419 +#define OBJ_aes_128_cbc OBJ_aes,2L + +#define SN_aes_128_ofb128 "AES-128-OFB" +#define LN_aes_128_ofb128 "aes-128-ofb" +#define NID_aes_128_ofb128 420 +#define OBJ_aes_128_ofb128 OBJ_aes,3L + +#define SN_aes_128_cfb128 "AES-128-CFB" +#define LN_aes_128_cfb128 "aes-128-cfb" +#define NID_aes_128_cfb128 421 +#define OBJ_aes_128_cfb128 OBJ_aes,4L + +#define SN_id_aes128_wrap "id-aes128-wrap" +#define NID_id_aes128_wrap 788 +#define OBJ_id_aes128_wrap OBJ_aes,5L + +#define SN_aes_128_gcm "id-aes128-GCM" +#define LN_aes_128_gcm "aes-128-gcm" +#define NID_aes_128_gcm 895 +#define OBJ_aes_128_gcm OBJ_aes,6L + +#define SN_aes_128_ccm "id-aes128-CCM" +#define LN_aes_128_ccm "aes-128-ccm" +#define NID_aes_128_ccm 896 +#define OBJ_aes_128_ccm OBJ_aes,7L + +#define SN_id_aes128_wrap_pad "id-aes128-wrap-pad" +#define NID_id_aes128_wrap_pad 897 +#define OBJ_id_aes128_wrap_pad OBJ_aes,8L + +#define SN_aes_192_ecb "AES-192-ECB" +#define LN_aes_192_ecb "aes-192-ecb" +#define NID_aes_192_ecb 422 +#define OBJ_aes_192_ecb OBJ_aes,21L + +#define SN_aes_192_cbc "AES-192-CBC" +#define LN_aes_192_cbc "aes-192-cbc" +#define NID_aes_192_cbc 423 +#define OBJ_aes_192_cbc OBJ_aes,22L + +#define SN_aes_192_ofb128 "AES-192-OFB" +#define LN_aes_192_ofb128 "aes-192-ofb" +#define NID_aes_192_ofb128 424 +#define OBJ_aes_192_ofb128 OBJ_aes,23L + +#define SN_aes_192_cfb128 "AES-192-CFB" +#define LN_aes_192_cfb128 "aes-192-cfb" +#define NID_aes_192_cfb128 425 +#define OBJ_aes_192_cfb128 OBJ_aes,24L + +#define SN_id_aes192_wrap "id-aes192-wrap" +#define NID_id_aes192_wrap 789 +#define OBJ_id_aes192_wrap OBJ_aes,25L + +#define SN_aes_192_gcm "id-aes192-GCM" +#define LN_aes_192_gcm "aes-192-gcm" +#define NID_aes_192_gcm 898 +#define OBJ_aes_192_gcm OBJ_aes,26L + +#define SN_aes_192_ccm "id-aes192-CCM" +#define LN_aes_192_ccm "aes-192-ccm" +#define NID_aes_192_ccm 899 +#define OBJ_aes_192_ccm OBJ_aes,27L + +#define SN_id_aes192_wrap_pad "id-aes192-wrap-pad" +#define NID_id_aes192_wrap_pad 900 +#define OBJ_id_aes192_wrap_pad OBJ_aes,28L + +#define SN_aes_256_ecb "AES-256-ECB" +#define LN_aes_256_ecb "aes-256-ecb" +#define NID_aes_256_ecb 426 +#define OBJ_aes_256_ecb OBJ_aes,41L + +#define SN_aes_256_cbc "AES-256-CBC" +#define LN_aes_256_cbc "aes-256-cbc" +#define NID_aes_256_cbc 427 +#define OBJ_aes_256_cbc OBJ_aes,42L + +#define SN_aes_256_ofb128 "AES-256-OFB" +#define LN_aes_256_ofb128 "aes-256-ofb" +#define NID_aes_256_ofb128 428 +#define OBJ_aes_256_ofb128 OBJ_aes,43L + +#define SN_aes_256_cfb128 "AES-256-CFB" +#define LN_aes_256_cfb128 "aes-256-cfb" +#define NID_aes_256_cfb128 429 +#define OBJ_aes_256_cfb128 OBJ_aes,44L + +#define SN_id_aes256_wrap "id-aes256-wrap" +#define NID_id_aes256_wrap 790 +#define OBJ_id_aes256_wrap OBJ_aes,45L + +#define SN_aes_256_gcm "id-aes256-GCM" +#define LN_aes_256_gcm "aes-256-gcm" +#define NID_aes_256_gcm 901 +#define OBJ_aes_256_gcm OBJ_aes,46L + +#define SN_aes_256_ccm "id-aes256-CCM" +#define LN_aes_256_ccm "aes-256-ccm" +#define NID_aes_256_ccm 902 +#define OBJ_aes_256_ccm OBJ_aes,47L + +#define SN_id_aes256_wrap_pad "id-aes256-wrap-pad" +#define NID_id_aes256_wrap_pad 903 +#define OBJ_id_aes256_wrap_pad OBJ_aes,48L + +#define SN_aes_128_xts "AES-128-XTS" +#define LN_aes_128_xts "aes-128-xts" +#define NID_aes_128_xts 913 +#define OBJ_aes_128_xts OBJ_ieee_siswg,0L,1L,1L + +#define SN_aes_256_xts "AES-256-XTS" +#define LN_aes_256_xts "aes-256-xts" +#define NID_aes_256_xts 914 +#define OBJ_aes_256_xts OBJ_ieee_siswg,0L,1L,2L + +#define SN_aes_128_cfb1 "AES-128-CFB1" +#define LN_aes_128_cfb1 "aes-128-cfb1" +#define NID_aes_128_cfb1 650 + +#define SN_aes_192_cfb1 "AES-192-CFB1" +#define LN_aes_192_cfb1 "aes-192-cfb1" +#define NID_aes_192_cfb1 651 + +#define SN_aes_256_cfb1 "AES-256-CFB1" +#define LN_aes_256_cfb1 "aes-256-cfb1" +#define NID_aes_256_cfb1 652 + +#define SN_aes_128_cfb8 "AES-128-CFB8" +#define LN_aes_128_cfb8 "aes-128-cfb8" +#define NID_aes_128_cfb8 653 + +#define SN_aes_192_cfb8 "AES-192-CFB8" +#define LN_aes_192_cfb8 "aes-192-cfb8" +#define NID_aes_192_cfb8 654 + +#define SN_aes_256_cfb8 "AES-256-CFB8" +#define LN_aes_256_cfb8 "aes-256-cfb8" +#define NID_aes_256_cfb8 655 + +#define SN_aes_128_ctr "AES-128-CTR" +#define LN_aes_128_ctr "aes-128-ctr" +#define NID_aes_128_ctr 904 + +#define SN_aes_192_ctr "AES-192-CTR" +#define LN_aes_192_ctr "aes-192-ctr" +#define NID_aes_192_ctr 905 + +#define SN_aes_256_ctr "AES-256-CTR" +#define LN_aes_256_ctr "aes-256-ctr" +#define NID_aes_256_ctr 906 + +#define SN_aes_128_ocb "AES-128-OCB" +#define LN_aes_128_ocb "aes-128-ocb" +#define NID_aes_128_ocb 958 + +#define SN_aes_192_ocb "AES-192-OCB" +#define LN_aes_192_ocb "aes-192-ocb" +#define NID_aes_192_ocb 959 + +#define SN_aes_256_ocb "AES-256-OCB" +#define LN_aes_256_ocb "aes-256-ocb" +#define NID_aes_256_ocb 960 + +#define SN_des_cfb1 "DES-CFB1" +#define LN_des_cfb1 "des-cfb1" +#define NID_des_cfb1 656 + +#define SN_des_cfb8 "DES-CFB8" +#define LN_des_cfb8 "des-cfb8" +#define NID_des_cfb8 657 + +#define SN_des_ede3_cfb1 "DES-EDE3-CFB1" +#define LN_des_ede3_cfb1 "des-ede3-cfb1" +#define NID_des_ede3_cfb1 658 + +#define SN_des_ede3_cfb8 "DES-EDE3-CFB8" +#define LN_des_ede3_cfb8 "des-ede3-cfb8" +#define NID_des_ede3_cfb8 659 + +#define OBJ_nist_hashalgs OBJ_nistAlgorithms,2L + +#define SN_sha256 "SHA256" +#define LN_sha256 "sha256" +#define NID_sha256 672 +#define OBJ_sha256 OBJ_nist_hashalgs,1L + +#define SN_sha384 "SHA384" +#define LN_sha384 "sha384" +#define NID_sha384 673 +#define OBJ_sha384 OBJ_nist_hashalgs,2L + +#define SN_sha512 "SHA512" +#define LN_sha512 "sha512" +#define NID_sha512 674 +#define OBJ_sha512 OBJ_nist_hashalgs,3L + +#define SN_sha224 "SHA224" +#define LN_sha224 "sha224" +#define NID_sha224 675 +#define OBJ_sha224 OBJ_nist_hashalgs,4L + +#define SN_sha512_224 "SHA512-224" +#define LN_sha512_224 "sha512-224" +#define NID_sha512_224 1094 +#define OBJ_sha512_224 OBJ_nist_hashalgs,5L + +#define SN_sha512_256 "SHA512-256" +#define LN_sha512_256 "sha512-256" +#define NID_sha512_256 1095 +#define OBJ_sha512_256 OBJ_nist_hashalgs,6L + +#define SN_sha3_224 "SHA3-224" +#define LN_sha3_224 "sha3-224" +#define NID_sha3_224 1096 +#define OBJ_sha3_224 OBJ_nist_hashalgs,7L + +#define SN_sha3_256 "SHA3-256" +#define LN_sha3_256 "sha3-256" +#define NID_sha3_256 1097 +#define OBJ_sha3_256 OBJ_nist_hashalgs,8L + +#define SN_sha3_384 "SHA3-384" +#define LN_sha3_384 "sha3-384" +#define NID_sha3_384 1098 +#define OBJ_sha3_384 OBJ_nist_hashalgs,9L + +#define SN_sha3_512 "SHA3-512" +#define LN_sha3_512 "sha3-512" +#define NID_sha3_512 1099 +#define OBJ_sha3_512 OBJ_nist_hashalgs,10L + +#define SN_shake128 "SHAKE128" +#define LN_shake128 "shake128" +#define NID_shake128 1100 +#define OBJ_shake128 OBJ_nist_hashalgs,11L + +#define SN_shake256 "SHAKE256" +#define LN_shake256 "shake256" +#define NID_shake256 1101 +#define OBJ_shake256 OBJ_nist_hashalgs,12L + +#define SN_hmac_sha3_224 "id-hmacWithSHA3-224" +#define LN_hmac_sha3_224 "hmac-sha3-224" +#define NID_hmac_sha3_224 1102 +#define OBJ_hmac_sha3_224 OBJ_nist_hashalgs,13L + +#define SN_hmac_sha3_256 "id-hmacWithSHA3-256" +#define LN_hmac_sha3_256 "hmac-sha3-256" +#define NID_hmac_sha3_256 1103 +#define OBJ_hmac_sha3_256 OBJ_nist_hashalgs,14L + +#define SN_hmac_sha3_384 "id-hmacWithSHA3-384" +#define LN_hmac_sha3_384 "hmac-sha3-384" +#define NID_hmac_sha3_384 1104 +#define OBJ_hmac_sha3_384 OBJ_nist_hashalgs,15L + +#define SN_hmac_sha3_512 "id-hmacWithSHA3-512" +#define LN_hmac_sha3_512 "hmac-sha3-512" +#define NID_hmac_sha3_512 1105 +#define OBJ_hmac_sha3_512 OBJ_nist_hashalgs,16L + +#define OBJ_dsa_with_sha2 OBJ_nistAlgorithms,3L + +#define SN_dsa_with_SHA224 "dsa_with_SHA224" +#define NID_dsa_with_SHA224 802 +#define OBJ_dsa_with_SHA224 OBJ_dsa_with_sha2,1L + +#define SN_dsa_with_SHA256 "dsa_with_SHA256" +#define NID_dsa_with_SHA256 803 +#define OBJ_dsa_with_SHA256 OBJ_dsa_with_sha2,2L + +#define OBJ_sigAlgs OBJ_nistAlgorithms,3L + +#define SN_dsa_with_SHA384 "id-dsa-with-sha384" +#define LN_dsa_with_SHA384 "dsa_with_SHA384" +#define NID_dsa_with_SHA384 1106 +#define OBJ_dsa_with_SHA384 OBJ_sigAlgs,3L + +#define SN_dsa_with_SHA512 "id-dsa-with-sha512" +#define LN_dsa_with_SHA512 "dsa_with_SHA512" +#define NID_dsa_with_SHA512 1107 +#define OBJ_dsa_with_SHA512 OBJ_sigAlgs,4L + +#define SN_dsa_with_SHA3_224 "id-dsa-with-sha3-224" +#define LN_dsa_with_SHA3_224 "dsa_with_SHA3-224" +#define NID_dsa_with_SHA3_224 1108 +#define OBJ_dsa_with_SHA3_224 OBJ_sigAlgs,5L + +#define SN_dsa_with_SHA3_256 "id-dsa-with-sha3-256" +#define LN_dsa_with_SHA3_256 "dsa_with_SHA3-256" +#define NID_dsa_with_SHA3_256 1109 +#define OBJ_dsa_with_SHA3_256 OBJ_sigAlgs,6L + +#define SN_dsa_with_SHA3_384 "id-dsa-with-sha3-384" +#define LN_dsa_with_SHA3_384 "dsa_with_SHA3-384" +#define NID_dsa_with_SHA3_384 1110 +#define OBJ_dsa_with_SHA3_384 OBJ_sigAlgs,7L + +#define SN_dsa_with_SHA3_512 "id-dsa-with-sha3-512" +#define LN_dsa_with_SHA3_512 "dsa_with_SHA3-512" +#define NID_dsa_with_SHA3_512 1111 +#define OBJ_dsa_with_SHA3_512 OBJ_sigAlgs,8L + +#define SN_ecdsa_with_SHA3_224 "id-ecdsa-with-sha3-224" +#define LN_ecdsa_with_SHA3_224 "ecdsa_with_SHA3-224" +#define NID_ecdsa_with_SHA3_224 1112 +#define OBJ_ecdsa_with_SHA3_224 OBJ_sigAlgs,9L + +#define SN_ecdsa_with_SHA3_256 "id-ecdsa-with-sha3-256" +#define LN_ecdsa_with_SHA3_256 "ecdsa_with_SHA3-256" +#define NID_ecdsa_with_SHA3_256 1113 +#define OBJ_ecdsa_with_SHA3_256 OBJ_sigAlgs,10L + +#define SN_ecdsa_with_SHA3_384 "id-ecdsa-with-sha3-384" +#define LN_ecdsa_with_SHA3_384 "ecdsa_with_SHA3-384" +#define NID_ecdsa_with_SHA3_384 1114 +#define OBJ_ecdsa_with_SHA3_384 OBJ_sigAlgs,11L + +#define SN_ecdsa_with_SHA3_512 "id-ecdsa-with-sha3-512" +#define LN_ecdsa_with_SHA3_512 "ecdsa_with_SHA3-512" +#define NID_ecdsa_with_SHA3_512 1115 +#define OBJ_ecdsa_with_SHA3_512 OBJ_sigAlgs,12L + +#define SN_RSA_SHA3_224 "id-rsassa-pkcs1-v1_5-with-sha3-224" +#define LN_RSA_SHA3_224 "RSA-SHA3-224" +#define NID_RSA_SHA3_224 1116 +#define OBJ_RSA_SHA3_224 OBJ_sigAlgs,13L + +#define SN_RSA_SHA3_256 "id-rsassa-pkcs1-v1_5-with-sha3-256" +#define LN_RSA_SHA3_256 "RSA-SHA3-256" +#define NID_RSA_SHA3_256 1117 +#define OBJ_RSA_SHA3_256 OBJ_sigAlgs,14L + +#define SN_RSA_SHA3_384 "id-rsassa-pkcs1-v1_5-with-sha3-384" +#define LN_RSA_SHA3_384 "RSA-SHA3-384" +#define NID_RSA_SHA3_384 1118 +#define OBJ_RSA_SHA3_384 OBJ_sigAlgs,15L + +#define SN_RSA_SHA3_512 "id-rsassa-pkcs1-v1_5-with-sha3-512" +#define LN_RSA_SHA3_512 "RSA-SHA3-512" +#define NID_RSA_SHA3_512 1119 +#define OBJ_RSA_SHA3_512 OBJ_sigAlgs,16L + +#define SN_hold_instruction_code "holdInstructionCode" +#define LN_hold_instruction_code "Hold Instruction Code" +#define NID_hold_instruction_code 430 +#define OBJ_hold_instruction_code OBJ_id_ce,23L + +#define OBJ_holdInstruction OBJ_X9_57,2L + +#define SN_hold_instruction_none "holdInstructionNone" +#define LN_hold_instruction_none "Hold Instruction None" +#define NID_hold_instruction_none 431 +#define OBJ_hold_instruction_none OBJ_holdInstruction,1L + +#define SN_hold_instruction_call_issuer "holdInstructionCallIssuer" +#define LN_hold_instruction_call_issuer "Hold Instruction Call Issuer" +#define NID_hold_instruction_call_issuer 432 +#define OBJ_hold_instruction_call_issuer OBJ_holdInstruction,2L + +#define SN_hold_instruction_reject "holdInstructionReject" +#define LN_hold_instruction_reject "Hold Instruction Reject" +#define NID_hold_instruction_reject 433 +#define OBJ_hold_instruction_reject OBJ_holdInstruction,3L + +#define SN_data "data" +#define NID_data 434 +#define OBJ_data OBJ_itu_t,9L + +#define SN_pss "pss" +#define NID_pss 435 +#define OBJ_pss OBJ_data,2342L + +#define SN_ucl "ucl" +#define NID_ucl 436 +#define OBJ_ucl OBJ_pss,19200300L + +#define SN_pilot "pilot" +#define NID_pilot 437 +#define OBJ_pilot OBJ_ucl,100L + +#define LN_pilotAttributeType "pilotAttributeType" +#define NID_pilotAttributeType 438 +#define OBJ_pilotAttributeType OBJ_pilot,1L + +#define LN_pilotAttributeSyntax "pilotAttributeSyntax" +#define NID_pilotAttributeSyntax 439 +#define OBJ_pilotAttributeSyntax OBJ_pilot,3L + +#define LN_pilotObjectClass "pilotObjectClass" +#define NID_pilotObjectClass 440 +#define OBJ_pilotObjectClass OBJ_pilot,4L + +#define LN_pilotGroups "pilotGroups" +#define NID_pilotGroups 441 +#define OBJ_pilotGroups OBJ_pilot,10L + +#define LN_iA5StringSyntax "iA5StringSyntax" +#define NID_iA5StringSyntax 442 +#define OBJ_iA5StringSyntax OBJ_pilotAttributeSyntax,4L + +#define LN_caseIgnoreIA5StringSyntax "caseIgnoreIA5StringSyntax" +#define NID_caseIgnoreIA5StringSyntax 443 +#define OBJ_caseIgnoreIA5StringSyntax OBJ_pilotAttributeSyntax,5L + +#define LN_pilotObject "pilotObject" +#define NID_pilotObject 444 +#define OBJ_pilotObject OBJ_pilotObjectClass,3L + +#define LN_pilotPerson "pilotPerson" +#define NID_pilotPerson 445 +#define OBJ_pilotPerson OBJ_pilotObjectClass,4L + +#define SN_account "account" +#define NID_account 446 +#define OBJ_account OBJ_pilotObjectClass,5L + +#define SN_document "document" +#define NID_document 447 +#define OBJ_document OBJ_pilotObjectClass,6L + +#define SN_room "room" +#define NID_room 448 +#define OBJ_room OBJ_pilotObjectClass,7L + +#define LN_documentSeries "documentSeries" +#define NID_documentSeries 449 +#define OBJ_documentSeries OBJ_pilotObjectClass,9L + +#define SN_Domain "domain" +#define LN_Domain "Domain" +#define NID_Domain 392 +#define OBJ_Domain OBJ_pilotObjectClass,13L + +#define LN_rFC822localPart "rFC822localPart" +#define NID_rFC822localPart 450 +#define OBJ_rFC822localPart OBJ_pilotObjectClass,14L + +#define LN_dNSDomain "dNSDomain" +#define NID_dNSDomain 451 +#define OBJ_dNSDomain OBJ_pilotObjectClass,15L + +#define LN_domainRelatedObject "domainRelatedObject" +#define NID_domainRelatedObject 452 +#define OBJ_domainRelatedObject OBJ_pilotObjectClass,17L + +#define LN_friendlyCountry "friendlyCountry" +#define NID_friendlyCountry 453 +#define OBJ_friendlyCountry OBJ_pilotObjectClass,18L + +#define LN_simpleSecurityObject "simpleSecurityObject" +#define NID_simpleSecurityObject 454 +#define OBJ_simpleSecurityObject OBJ_pilotObjectClass,19L + +#define LN_pilotOrganization "pilotOrganization" +#define NID_pilotOrganization 455 +#define OBJ_pilotOrganization OBJ_pilotObjectClass,20L + +#define LN_pilotDSA "pilotDSA" +#define NID_pilotDSA 456 +#define OBJ_pilotDSA OBJ_pilotObjectClass,21L + +#define LN_qualityLabelledData "qualityLabelledData" +#define NID_qualityLabelledData 457 +#define OBJ_qualityLabelledData OBJ_pilotObjectClass,22L + +#define SN_userId "UID" +#define LN_userId "userId" +#define NID_userId 458 +#define OBJ_userId OBJ_pilotAttributeType,1L + +#define LN_textEncodedORAddress "textEncodedORAddress" +#define NID_textEncodedORAddress 459 +#define OBJ_textEncodedORAddress OBJ_pilotAttributeType,2L + +#define SN_rfc822Mailbox "mail" +#define LN_rfc822Mailbox "rfc822Mailbox" +#define NID_rfc822Mailbox 460 +#define OBJ_rfc822Mailbox OBJ_pilotAttributeType,3L + +#define SN_info "info" +#define NID_info 461 +#define OBJ_info OBJ_pilotAttributeType,4L + +#define LN_favouriteDrink "favouriteDrink" +#define NID_favouriteDrink 462 +#define OBJ_favouriteDrink OBJ_pilotAttributeType,5L + +#define LN_roomNumber "roomNumber" +#define NID_roomNumber 463 +#define OBJ_roomNumber OBJ_pilotAttributeType,6L + +#define SN_photo "photo" +#define NID_photo 464 +#define OBJ_photo OBJ_pilotAttributeType,7L + +#define LN_userClass "userClass" +#define NID_userClass 465 +#define OBJ_userClass OBJ_pilotAttributeType,8L + +#define SN_host "host" +#define NID_host 466 +#define OBJ_host OBJ_pilotAttributeType,9L + +#define SN_manager "manager" +#define NID_manager 467 +#define OBJ_manager OBJ_pilotAttributeType,10L + +#define LN_documentIdentifier "documentIdentifier" +#define NID_documentIdentifier 468 +#define OBJ_documentIdentifier OBJ_pilotAttributeType,11L + +#define LN_documentTitle "documentTitle" +#define NID_documentTitle 469 +#define OBJ_documentTitle OBJ_pilotAttributeType,12L + +#define LN_documentVersion "documentVersion" +#define NID_documentVersion 470 +#define OBJ_documentVersion OBJ_pilotAttributeType,13L + +#define LN_documentAuthor "documentAuthor" +#define NID_documentAuthor 471 +#define OBJ_documentAuthor OBJ_pilotAttributeType,14L + +#define LN_documentLocation "documentLocation" +#define NID_documentLocation 472 +#define OBJ_documentLocation OBJ_pilotAttributeType,15L + +#define LN_homeTelephoneNumber "homeTelephoneNumber" +#define NID_homeTelephoneNumber 473 +#define OBJ_homeTelephoneNumber OBJ_pilotAttributeType,20L + +#define SN_secretary "secretary" +#define NID_secretary 474 +#define OBJ_secretary OBJ_pilotAttributeType,21L + +#define LN_otherMailbox "otherMailbox" +#define NID_otherMailbox 475 +#define OBJ_otherMailbox OBJ_pilotAttributeType,22L + +#define LN_lastModifiedTime "lastModifiedTime" +#define NID_lastModifiedTime 476 +#define OBJ_lastModifiedTime OBJ_pilotAttributeType,23L + +#define LN_lastModifiedBy "lastModifiedBy" +#define NID_lastModifiedBy 477 +#define OBJ_lastModifiedBy OBJ_pilotAttributeType,24L + +#define SN_domainComponent "DC" +#define LN_domainComponent "domainComponent" +#define NID_domainComponent 391 +#define OBJ_domainComponent OBJ_pilotAttributeType,25L + +#define LN_aRecord "aRecord" +#define NID_aRecord 478 +#define OBJ_aRecord OBJ_pilotAttributeType,26L + +#define LN_pilotAttributeType27 "pilotAttributeType27" +#define NID_pilotAttributeType27 479 +#define OBJ_pilotAttributeType27 OBJ_pilotAttributeType,27L + +#define LN_mXRecord "mXRecord" +#define NID_mXRecord 480 +#define OBJ_mXRecord OBJ_pilotAttributeType,28L + +#define LN_nSRecord "nSRecord" +#define NID_nSRecord 481 +#define OBJ_nSRecord OBJ_pilotAttributeType,29L + +#define LN_sOARecord "sOARecord" +#define NID_sOARecord 482 +#define OBJ_sOARecord OBJ_pilotAttributeType,30L + +#define LN_cNAMERecord "cNAMERecord" +#define NID_cNAMERecord 483 +#define OBJ_cNAMERecord OBJ_pilotAttributeType,31L + +#define LN_associatedDomain "associatedDomain" +#define NID_associatedDomain 484 +#define OBJ_associatedDomain OBJ_pilotAttributeType,37L + +#define LN_associatedName "associatedName" +#define NID_associatedName 485 +#define OBJ_associatedName OBJ_pilotAttributeType,38L + +#define LN_homePostalAddress "homePostalAddress" +#define NID_homePostalAddress 486 +#define OBJ_homePostalAddress OBJ_pilotAttributeType,39L + +#define LN_personalTitle "personalTitle" +#define NID_personalTitle 487 +#define OBJ_personalTitle OBJ_pilotAttributeType,40L + +#define LN_mobileTelephoneNumber "mobileTelephoneNumber" +#define NID_mobileTelephoneNumber 488 +#define OBJ_mobileTelephoneNumber OBJ_pilotAttributeType,41L + +#define LN_pagerTelephoneNumber "pagerTelephoneNumber" +#define NID_pagerTelephoneNumber 489 +#define OBJ_pagerTelephoneNumber OBJ_pilotAttributeType,42L + +#define LN_friendlyCountryName "friendlyCountryName" +#define NID_friendlyCountryName 490 +#define OBJ_friendlyCountryName OBJ_pilotAttributeType,43L + +#define SN_uniqueIdentifier "uid" +#define LN_uniqueIdentifier "uniqueIdentifier" +#define NID_uniqueIdentifier 102 +#define OBJ_uniqueIdentifier OBJ_pilotAttributeType,44L + +#define LN_organizationalStatus "organizationalStatus" +#define NID_organizationalStatus 491 +#define OBJ_organizationalStatus OBJ_pilotAttributeType,45L + +#define LN_janetMailbox "janetMailbox" +#define NID_janetMailbox 492 +#define OBJ_janetMailbox OBJ_pilotAttributeType,46L + +#define LN_mailPreferenceOption "mailPreferenceOption" +#define NID_mailPreferenceOption 493 +#define OBJ_mailPreferenceOption OBJ_pilotAttributeType,47L + +#define LN_buildingName "buildingName" +#define NID_buildingName 494 +#define OBJ_buildingName OBJ_pilotAttributeType,48L + +#define LN_dSAQuality "dSAQuality" +#define NID_dSAQuality 495 +#define OBJ_dSAQuality OBJ_pilotAttributeType,49L + +#define LN_singleLevelQuality "singleLevelQuality" +#define NID_singleLevelQuality 496 +#define OBJ_singleLevelQuality OBJ_pilotAttributeType,50L + +#define LN_subtreeMinimumQuality "subtreeMinimumQuality" +#define NID_subtreeMinimumQuality 497 +#define OBJ_subtreeMinimumQuality OBJ_pilotAttributeType,51L + +#define LN_subtreeMaximumQuality "subtreeMaximumQuality" +#define NID_subtreeMaximumQuality 498 +#define OBJ_subtreeMaximumQuality OBJ_pilotAttributeType,52L + +#define LN_personalSignature "personalSignature" +#define NID_personalSignature 499 +#define OBJ_personalSignature OBJ_pilotAttributeType,53L + +#define LN_dITRedirect "dITRedirect" +#define NID_dITRedirect 500 +#define OBJ_dITRedirect OBJ_pilotAttributeType,54L + +#define SN_audio "audio" +#define NID_audio 501 +#define OBJ_audio OBJ_pilotAttributeType,55L + +#define LN_documentPublisher "documentPublisher" +#define NID_documentPublisher 502 +#define OBJ_documentPublisher OBJ_pilotAttributeType,56L + +#define SN_id_set "id-set" +#define LN_id_set "Secure Electronic Transactions" +#define NID_id_set 512 +#define OBJ_id_set OBJ_international_organizations,42L + +#define SN_set_ctype "set-ctype" +#define LN_set_ctype "content types" +#define NID_set_ctype 513 +#define OBJ_set_ctype OBJ_id_set,0L + +#define SN_set_msgExt "set-msgExt" +#define LN_set_msgExt "message extensions" +#define NID_set_msgExt 514 +#define OBJ_set_msgExt OBJ_id_set,1L + +#define SN_set_attr "set-attr" +#define NID_set_attr 515 +#define OBJ_set_attr OBJ_id_set,3L + +#define SN_set_policy "set-policy" +#define NID_set_policy 516 +#define OBJ_set_policy OBJ_id_set,5L + +#define SN_set_certExt "set-certExt" +#define LN_set_certExt "certificate extensions" +#define NID_set_certExt 517 +#define OBJ_set_certExt OBJ_id_set,7L + +#define SN_set_brand "set-brand" +#define NID_set_brand 518 +#define OBJ_set_brand OBJ_id_set,8L + +#define SN_setct_PANData "setct-PANData" +#define NID_setct_PANData 519 +#define OBJ_setct_PANData OBJ_set_ctype,0L + +#define SN_setct_PANToken "setct-PANToken" +#define NID_setct_PANToken 520 +#define OBJ_setct_PANToken OBJ_set_ctype,1L + +#define SN_setct_PANOnly "setct-PANOnly" +#define NID_setct_PANOnly 521 +#define OBJ_setct_PANOnly OBJ_set_ctype,2L + +#define SN_setct_OIData "setct-OIData" +#define NID_setct_OIData 522 +#define OBJ_setct_OIData OBJ_set_ctype,3L + +#define SN_setct_PI "setct-PI" +#define NID_setct_PI 523 +#define OBJ_setct_PI OBJ_set_ctype,4L + +#define SN_setct_PIData "setct-PIData" +#define NID_setct_PIData 524 +#define OBJ_setct_PIData OBJ_set_ctype,5L + +#define SN_setct_PIDataUnsigned "setct-PIDataUnsigned" +#define NID_setct_PIDataUnsigned 525 +#define OBJ_setct_PIDataUnsigned OBJ_set_ctype,6L + +#define SN_setct_HODInput "setct-HODInput" +#define NID_setct_HODInput 526 +#define OBJ_setct_HODInput OBJ_set_ctype,7L + +#define SN_setct_AuthResBaggage "setct-AuthResBaggage" +#define NID_setct_AuthResBaggage 527 +#define OBJ_setct_AuthResBaggage OBJ_set_ctype,8L + +#define SN_setct_AuthRevReqBaggage "setct-AuthRevReqBaggage" +#define NID_setct_AuthRevReqBaggage 528 +#define OBJ_setct_AuthRevReqBaggage OBJ_set_ctype,9L + +#define SN_setct_AuthRevResBaggage "setct-AuthRevResBaggage" +#define NID_setct_AuthRevResBaggage 529 +#define OBJ_setct_AuthRevResBaggage OBJ_set_ctype,10L + +#define SN_setct_CapTokenSeq "setct-CapTokenSeq" +#define NID_setct_CapTokenSeq 530 +#define OBJ_setct_CapTokenSeq OBJ_set_ctype,11L + +#define SN_setct_PInitResData "setct-PInitResData" +#define NID_setct_PInitResData 531 +#define OBJ_setct_PInitResData OBJ_set_ctype,12L + +#define SN_setct_PI_TBS "setct-PI-TBS" +#define NID_setct_PI_TBS 532 +#define OBJ_setct_PI_TBS OBJ_set_ctype,13L + +#define SN_setct_PResData "setct-PResData" +#define NID_setct_PResData 533 +#define OBJ_setct_PResData OBJ_set_ctype,14L + +#define SN_setct_AuthReqTBS "setct-AuthReqTBS" +#define NID_setct_AuthReqTBS 534 +#define OBJ_setct_AuthReqTBS OBJ_set_ctype,16L + +#define SN_setct_AuthResTBS "setct-AuthResTBS" +#define NID_setct_AuthResTBS 535 +#define OBJ_setct_AuthResTBS OBJ_set_ctype,17L + +#define SN_setct_AuthResTBSX "setct-AuthResTBSX" +#define NID_setct_AuthResTBSX 536 +#define OBJ_setct_AuthResTBSX OBJ_set_ctype,18L + +#define SN_setct_AuthTokenTBS "setct-AuthTokenTBS" +#define NID_setct_AuthTokenTBS 537 +#define OBJ_setct_AuthTokenTBS OBJ_set_ctype,19L + +#define SN_setct_CapTokenData "setct-CapTokenData" +#define NID_setct_CapTokenData 538 +#define OBJ_setct_CapTokenData OBJ_set_ctype,20L + +#define SN_setct_CapTokenTBS "setct-CapTokenTBS" +#define NID_setct_CapTokenTBS 539 +#define OBJ_setct_CapTokenTBS OBJ_set_ctype,21L + +#define SN_setct_AcqCardCodeMsg "setct-AcqCardCodeMsg" +#define NID_setct_AcqCardCodeMsg 540 +#define OBJ_setct_AcqCardCodeMsg OBJ_set_ctype,22L + +#define SN_setct_AuthRevReqTBS "setct-AuthRevReqTBS" +#define NID_setct_AuthRevReqTBS 541 +#define OBJ_setct_AuthRevReqTBS OBJ_set_ctype,23L + +#define SN_setct_AuthRevResData "setct-AuthRevResData" +#define NID_setct_AuthRevResData 542 +#define OBJ_setct_AuthRevResData OBJ_set_ctype,24L + +#define SN_setct_AuthRevResTBS "setct-AuthRevResTBS" +#define NID_setct_AuthRevResTBS 543 +#define OBJ_setct_AuthRevResTBS OBJ_set_ctype,25L + +#define SN_setct_CapReqTBS "setct-CapReqTBS" +#define NID_setct_CapReqTBS 544 +#define OBJ_setct_CapReqTBS OBJ_set_ctype,26L + +#define SN_setct_CapReqTBSX "setct-CapReqTBSX" +#define NID_setct_CapReqTBSX 545 +#define OBJ_setct_CapReqTBSX OBJ_set_ctype,27L + +#define SN_setct_CapResData "setct-CapResData" +#define NID_setct_CapResData 546 +#define OBJ_setct_CapResData OBJ_set_ctype,28L + +#define SN_setct_CapRevReqTBS "setct-CapRevReqTBS" +#define NID_setct_CapRevReqTBS 547 +#define OBJ_setct_CapRevReqTBS OBJ_set_ctype,29L + +#define SN_setct_CapRevReqTBSX "setct-CapRevReqTBSX" +#define NID_setct_CapRevReqTBSX 548 +#define OBJ_setct_CapRevReqTBSX OBJ_set_ctype,30L + +#define SN_setct_CapRevResData "setct-CapRevResData" +#define NID_setct_CapRevResData 549 +#define OBJ_setct_CapRevResData OBJ_set_ctype,31L + +#define SN_setct_CredReqTBS "setct-CredReqTBS" +#define NID_setct_CredReqTBS 550 +#define OBJ_setct_CredReqTBS OBJ_set_ctype,32L + +#define SN_setct_CredReqTBSX "setct-CredReqTBSX" +#define NID_setct_CredReqTBSX 551 +#define OBJ_setct_CredReqTBSX OBJ_set_ctype,33L + +#define SN_setct_CredResData "setct-CredResData" +#define NID_setct_CredResData 552 +#define OBJ_setct_CredResData OBJ_set_ctype,34L + +#define SN_setct_CredRevReqTBS "setct-CredRevReqTBS" +#define NID_setct_CredRevReqTBS 553 +#define OBJ_setct_CredRevReqTBS OBJ_set_ctype,35L + +#define SN_setct_CredRevReqTBSX "setct-CredRevReqTBSX" +#define NID_setct_CredRevReqTBSX 554 +#define OBJ_setct_CredRevReqTBSX OBJ_set_ctype,36L + +#define SN_setct_CredRevResData "setct-CredRevResData" +#define NID_setct_CredRevResData 555 +#define OBJ_setct_CredRevResData OBJ_set_ctype,37L + +#define SN_setct_PCertReqData "setct-PCertReqData" +#define NID_setct_PCertReqData 556 +#define OBJ_setct_PCertReqData OBJ_set_ctype,38L + +#define SN_setct_PCertResTBS "setct-PCertResTBS" +#define NID_setct_PCertResTBS 557 +#define OBJ_setct_PCertResTBS OBJ_set_ctype,39L + +#define SN_setct_BatchAdminReqData "setct-BatchAdminReqData" +#define NID_setct_BatchAdminReqData 558 +#define OBJ_setct_BatchAdminReqData OBJ_set_ctype,40L + +#define SN_setct_BatchAdminResData "setct-BatchAdminResData" +#define NID_setct_BatchAdminResData 559 +#define OBJ_setct_BatchAdminResData OBJ_set_ctype,41L + +#define SN_setct_CardCInitResTBS "setct-CardCInitResTBS" +#define NID_setct_CardCInitResTBS 560 +#define OBJ_setct_CardCInitResTBS OBJ_set_ctype,42L + +#define SN_setct_MeAqCInitResTBS "setct-MeAqCInitResTBS" +#define NID_setct_MeAqCInitResTBS 561 +#define OBJ_setct_MeAqCInitResTBS OBJ_set_ctype,43L + +#define SN_setct_RegFormResTBS "setct-RegFormResTBS" +#define NID_setct_RegFormResTBS 562 +#define OBJ_setct_RegFormResTBS OBJ_set_ctype,44L + +#define SN_setct_CertReqData "setct-CertReqData" +#define NID_setct_CertReqData 563 +#define OBJ_setct_CertReqData OBJ_set_ctype,45L + +#define SN_setct_CertReqTBS "setct-CertReqTBS" +#define NID_setct_CertReqTBS 564 +#define OBJ_setct_CertReqTBS OBJ_set_ctype,46L + +#define SN_setct_CertResData "setct-CertResData" +#define NID_setct_CertResData 565 +#define OBJ_setct_CertResData OBJ_set_ctype,47L + +#define SN_setct_CertInqReqTBS "setct-CertInqReqTBS" +#define NID_setct_CertInqReqTBS 566 +#define OBJ_setct_CertInqReqTBS OBJ_set_ctype,48L + +#define SN_setct_ErrorTBS "setct-ErrorTBS" +#define NID_setct_ErrorTBS 567 +#define OBJ_setct_ErrorTBS OBJ_set_ctype,49L + +#define SN_setct_PIDualSignedTBE "setct-PIDualSignedTBE" +#define NID_setct_PIDualSignedTBE 568 +#define OBJ_setct_PIDualSignedTBE OBJ_set_ctype,50L + +#define SN_setct_PIUnsignedTBE "setct-PIUnsignedTBE" +#define NID_setct_PIUnsignedTBE 569 +#define OBJ_setct_PIUnsignedTBE OBJ_set_ctype,51L + +#define SN_setct_AuthReqTBE "setct-AuthReqTBE" +#define NID_setct_AuthReqTBE 570 +#define OBJ_setct_AuthReqTBE OBJ_set_ctype,52L + +#define SN_setct_AuthResTBE "setct-AuthResTBE" +#define NID_setct_AuthResTBE 571 +#define OBJ_setct_AuthResTBE OBJ_set_ctype,53L + +#define SN_setct_AuthResTBEX "setct-AuthResTBEX" +#define NID_setct_AuthResTBEX 572 +#define OBJ_setct_AuthResTBEX OBJ_set_ctype,54L + +#define SN_setct_AuthTokenTBE "setct-AuthTokenTBE" +#define NID_setct_AuthTokenTBE 573 +#define OBJ_setct_AuthTokenTBE OBJ_set_ctype,55L + +#define SN_setct_CapTokenTBE "setct-CapTokenTBE" +#define NID_setct_CapTokenTBE 574 +#define OBJ_setct_CapTokenTBE OBJ_set_ctype,56L + +#define SN_setct_CapTokenTBEX "setct-CapTokenTBEX" +#define NID_setct_CapTokenTBEX 575 +#define OBJ_setct_CapTokenTBEX OBJ_set_ctype,57L + +#define SN_setct_AcqCardCodeMsgTBE "setct-AcqCardCodeMsgTBE" +#define NID_setct_AcqCardCodeMsgTBE 576 +#define OBJ_setct_AcqCardCodeMsgTBE OBJ_set_ctype,58L + +#define SN_setct_AuthRevReqTBE "setct-AuthRevReqTBE" +#define NID_setct_AuthRevReqTBE 577 +#define OBJ_setct_AuthRevReqTBE OBJ_set_ctype,59L + +#define SN_setct_AuthRevResTBE "setct-AuthRevResTBE" +#define NID_setct_AuthRevResTBE 578 +#define OBJ_setct_AuthRevResTBE OBJ_set_ctype,60L + +#define SN_setct_AuthRevResTBEB "setct-AuthRevResTBEB" +#define NID_setct_AuthRevResTBEB 579 +#define OBJ_setct_AuthRevResTBEB OBJ_set_ctype,61L + +#define SN_setct_CapReqTBE "setct-CapReqTBE" +#define NID_setct_CapReqTBE 580 +#define OBJ_setct_CapReqTBE OBJ_set_ctype,62L + +#define SN_setct_CapReqTBEX "setct-CapReqTBEX" +#define NID_setct_CapReqTBEX 581 +#define OBJ_setct_CapReqTBEX OBJ_set_ctype,63L + +#define SN_setct_CapResTBE "setct-CapResTBE" +#define NID_setct_CapResTBE 582 +#define OBJ_setct_CapResTBE OBJ_set_ctype,64L + +#define SN_setct_CapRevReqTBE "setct-CapRevReqTBE" +#define NID_setct_CapRevReqTBE 583 +#define OBJ_setct_CapRevReqTBE OBJ_set_ctype,65L + +#define SN_setct_CapRevReqTBEX "setct-CapRevReqTBEX" +#define NID_setct_CapRevReqTBEX 584 +#define OBJ_setct_CapRevReqTBEX OBJ_set_ctype,66L + +#define SN_setct_CapRevResTBE "setct-CapRevResTBE" +#define NID_setct_CapRevResTBE 585 +#define OBJ_setct_CapRevResTBE OBJ_set_ctype,67L + +#define SN_setct_CredReqTBE "setct-CredReqTBE" +#define NID_setct_CredReqTBE 586 +#define OBJ_setct_CredReqTBE OBJ_set_ctype,68L + +#define SN_setct_CredReqTBEX "setct-CredReqTBEX" +#define NID_setct_CredReqTBEX 587 +#define OBJ_setct_CredReqTBEX OBJ_set_ctype,69L + +#define SN_setct_CredResTBE "setct-CredResTBE" +#define NID_setct_CredResTBE 588 +#define OBJ_setct_CredResTBE OBJ_set_ctype,70L + +#define SN_setct_CredRevReqTBE "setct-CredRevReqTBE" +#define NID_setct_CredRevReqTBE 589 +#define OBJ_setct_CredRevReqTBE OBJ_set_ctype,71L + +#define SN_setct_CredRevReqTBEX "setct-CredRevReqTBEX" +#define NID_setct_CredRevReqTBEX 590 +#define OBJ_setct_CredRevReqTBEX OBJ_set_ctype,72L + +#define SN_setct_CredRevResTBE "setct-CredRevResTBE" +#define NID_setct_CredRevResTBE 591 +#define OBJ_setct_CredRevResTBE OBJ_set_ctype,73L + +#define SN_setct_BatchAdminReqTBE "setct-BatchAdminReqTBE" +#define NID_setct_BatchAdminReqTBE 592 +#define OBJ_setct_BatchAdminReqTBE OBJ_set_ctype,74L + +#define SN_setct_BatchAdminResTBE "setct-BatchAdminResTBE" +#define NID_setct_BatchAdminResTBE 593 +#define OBJ_setct_BatchAdminResTBE OBJ_set_ctype,75L + +#define SN_setct_RegFormReqTBE "setct-RegFormReqTBE" +#define NID_setct_RegFormReqTBE 594 +#define OBJ_setct_RegFormReqTBE OBJ_set_ctype,76L + +#define SN_setct_CertReqTBE "setct-CertReqTBE" +#define NID_setct_CertReqTBE 595 +#define OBJ_setct_CertReqTBE OBJ_set_ctype,77L + +#define SN_setct_CertReqTBEX "setct-CertReqTBEX" +#define NID_setct_CertReqTBEX 596 +#define OBJ_setct_CertReqTBEX OBJ_set_ctype,78L + +#define SN_setct_CertResTBE "setct-CertResTBE" +#define NID_setct_CertResTBE 597 +#define OBJ_setct_CertResTBE OBJ_set_ctype,79L + +#define SN_setct_CRLNotificationTBS "setct-CRLNotificationTBS" +#define NID_setct_CRLNotificationTBS 598 +#define OBJ_setct_CRLNotificationTBS OBJ_set_ctype,80L + +#define SN_setct_CRLNotificationResTBS "setct-CRLNotificationResTBS" +#define NID_setct_CRLNotificationResTBS 599 +#define OBJ_setct_CRLNotificationResTBS OBJ_set_ctype,81L + +#define SN_setct_BCIDistributionTBS "setct-BCIDistributionTBS" +#define NID_setct_BCIDistributionTBS 600 +#define OBJ_setct_BCIDistributionTBS OBJ_set_ctype,82L + +#define SN_setext_genCrypt "setext-genCrypt" +#define LN_setext_genCrypt "generic cryptogram" +#define NID_setext_genCrypt 601 +#define OBJ_setext_genCrypt OBJ_set_msgExt,1L + +#define SN_setext_miAuth "setext-miAuth" +#define LN_setext_miAuth "merchant initiated auth" +#define NID_setext_miAuth 602 +#define OBJ_setext_miAuth OBJ_set_msgExt,3L + +#define SN_setext_pinSecure "setext-pinSecure" +#define NID_setext_pinSecure 603 +#define OBJ_setext_pinSecure OBJ_set_msgExt,4L + +#define SN_setext_pinAny "setext-pinAny" +#define NID_setext_pinAny 604 +#define OBJ_setext_pinAny OBJ_set_msgExt,5L + +#define SN_setext_track2 "setext-track2" +#define NID_setext_track2 605 +#define OBJ_setext_track2 OBJ_set_msgExt,7L + +#define SN_setext_cv "setext-cv" +#define LN_setext_cv "additional verification" +#define NID_setext_cv 606 +#define OBJ_setext_cv OBJ_set_msgExt,8L + +#define SN_set_policy_root "set-policy-root" +#define NID_set_policy_root 607 +#define OBJ_set_policy_root OBJ_set_policy,0L + +#define SN_setCext_hashedRoot "setCext-hashedRoot" +#define NID_setCext_hashedRoot 608 +#define OBJ_setCext_hashedRoot OBJ_set_certExt,0L + +#define SN_setCext_certType "setCext-certType" +#define NID_setCext_certType 609 +#define OBJ_setCext_certType OBJ_set_certExt,1L + +#define SN_setCext_merchData "setCext-merchData" +#define NID_setCext_merchData 610 +#define OBJ_setCext_merchData OBJ_set_certExt,2L + +#define SN_setCext_cCertRequired "setCext-cCertRequired" +#define NID_setCext_cCertRequired 611 +#define OBJ_setCext_cCertRequired OBJ_set_certExt,3L + +#define SN_setCext_tunneling "setCext-tunneling" +#define NID_setCext_tunneling 612 +#define OBJ_setCext_tunneling OBJ_set_certExt,4L + +#define SN_setCext_setExt "setCext-setExt" +#define NID_setCext_setExt 613 +#define OBJ_setCext_setExt OBJ_set_certExt,5L + +#define SN_setCext_setQualf "setCext-setQualf" +#define NID_setCext_setQualf 614 +#define OBJ_setCext_setQualf OBJ_set_certExt,6L + +#define SN_setCext_PGWYcapabilities "setCext-PGWYcapabilities" +#define NID_setCext_PGWYcapabilities 615 +#define OBJ_setCext_PGWYcapabilities OBJ_set_certExt,7L + +#define SN_setCext_TokenIdentifier "setCext-TokenIdentifier" +#define NID_setCext_TokenIdentifier 616 +#define OBJ_setCext_TokenIdentifier OBJ_set_certExt,8L + +#define SN_setCext_Track2Data "setCext-Track2Data" +#define NID_setCext_Track2Data 617 +#define OBJ_setCext_Track2Data OBJ_set_certExt,9L + +#define SN_setCext_TokenType "setCext-TokenType" +#define NID_setCext_TokenType 618 +#define OBJ_setCext_TokenType OBJ_set_certExt,10L + +#define SN_setCext_IssuerCapabilities "setCext-IssuerCapabilities" +#define NID_setCext_IssuerCapabilities 619 +#define OBJ_setCext_IssuerCapabilities OBJ_set_certExt,11L + +#define SN_setAttr_Cert "setAttr-Cert" +#define NID_setAttr_Cert 620 +#define OBJ_setAttr_Cert OBJ_set_attr,0L + +#define SN_setAttr_PGWYcap "setAttr-PGWYcap" +#define LN_setAttr_PGWYcap "payment gateway capabilities" +#define NID_setAttr_PGWYcap 621 +#define OBJ_setAttr_PGWYcap OBJ_set_attr,1L + +#define SN_setAttr_TokenType "setAttr-TokenType" +#define NID_setAttr_TokenType 622 +#define OBJ_setAttr_TokenType OBJ_set_attr,2L + +#define SN_setAttr_IssCap "setAttr-IssCap" +#define LN_setAttr_IssCap "issuer capabilities" +#define NID_setAttr_IssCap 623 +#define OBJ_setAttr_IssCap OBJ_set_attr,3L + +#define SN_set_rootKeyThumb "set-rootKeyThumb" +#define NID_set_rootKeyThumb 624 +#define OBJ_set_rootKeyThumb OBJ_setAttr_Cert,0L + +#define SN_set_addPolicy "set-addPolicy" +#define NID_set_addPolicy 625 +#define OBJ_set_addPolicy OBJ_setAttr_Cert,1L + +#define SN_setAttr_Token_EMV "setAttr-Token-EMV" +#define NID_setAttr_Token_EMV 626 +#define OBJ_setAttr_Token_EMV OBJ_setAttr_TokenType,1L + +#define SN_setAttr_Token_B0Prime "setAttr-Token-B0Prime" +#define NID_setAttr_Token_B0Prime 627 +#define OBJ_setAttr_Token_B0Prime OBJ_setAttr_TokenType,2L + +#define SN_setAttr_IssCap_CVM "setAttr-IssCap-CVM" +#define NID_setAttr_IssCap_CVM 628 +#define OBJ_setAttr_IssCap_CVM OBJ_setAttr_IssCap,3L + +#define SN_setAttr_IssCap_T2 "setAttr-IssCap-T2" +#define NID_setAttr_IssCap_T2 629 +#define OBJ_setAttr_IssCap_T2 OBJ_setAttr_IssCap,4L + +#define SN_setAttr_IssCap_Sig "setAttr-IssCap-Sig" +#define NID_setAttr_IssCap_Sig 630 +#define OBJ_setAttr_IssCap_Sig OBJ_setAttr_IssCap,5L + +#define SN_setAttr_GenCryptgrm "setAttr-GenCryptgrm" +#define LN_setAttr_GenCryptgrm "generate cryptogram" +#define NID_setAttr_GenCryptgrm 631 +#define OBJ_setAttr_GenCryptgrm OBJ_setAttr_IssCap_CVM,1L + +#define SN_setAttr_T2Enc "setAttr-T2Enc" +#define LN_setAttr_T2Enc "encrypted track 2" +#define NID_setAttr_T2Enc 632 +#define OBJ_setAttr_T2Enc OBJ_setAttr_IssCap_T2,1L + +#define SN_setAttr_T2cleartxt "setAttr-T2cleartxt" +#define LN_setAttr_T2cleartxt "cleartext track 2" +#define NID_setAttr_T2cleartxt 633 +#define OBJ_setAttr_T2cleartxt OBJ_setAttr_IssCap_T2,2L + +#define SN_setAttr_TokICCsig "setAttr-TokICCsig" +#define LN_setAttr_TokICCsig "ICC or token signature" +#define NID_setAttr_TokICCsig 634 +#define OBJ_setAttr_TokICCsig OBJ_setAttr_IssCap_Sig,1L + +#define SN_setAttr_SecDevSig "setAttr-SecDevSig" +#define LN_setAttr_SecDevSig "secure device signature" +#define NID_setAttr_SecDevSig 635 +#define OBJ_setAttr_SecDevSig OBJ_setAttr_IssCap_Sig,2L + +#define SN_set_brand_IATA_ATA "set-brand-IATA-ATA" +#define NID_set_brand_IATA_ATA 636 +#define OBJ_set_brand_IATA_ATA OBJ_set_brand,1L + +#define SN_set_brand_Diners "set-brand-Diners" +#define NID_set_brand_Diners 637 +#define OBJ_set_brand_Diners OBJ_set_brand,30L + +#define SN_set_brand_AmericanExpress "set-brand-AmericanExpress" +#define NID_set_brand_AmericanExpress 638 +#define OBJ_set_brand_AmericanExpress OBJ_set_brand,34L + +#define SN_set_brand_JCB "set-brand-JCB" +#define NID_set_brand_JCB 639 +#define OBJ_set_brand_JCB OBJ_set_brand,35L + +#define SN_set_brand_Visa "set-brand-Visa" +#define NID_set_brand_Visa 640 +#define OBJ_set_brand_Visa OBJ_set_brand,4L + +#define SN_set_brand_MasterCard "set-brand-MasterCard" +#define NID_set_brand_MasterCard 641 +#define OBJ_set_brand_MasterCard OBJ_set_brand,5L + +#define SN_set_brand_Novus "set-brand-Novus" +#define NID_set_brand_Novus 642 +#define OBJ_set_brand_Novus OBJ_set_brand,6011L + +#define SN_des_cdmf "DES-CDMF" +#define LN_des_cdmf "des-cdmf" +#define NID_des_cdmf 643 +#define OBJ_des_cdmf OBJ_rsadsi,3L,10L + +#define SN_rsaOAEPEncryptionSET "rsaOAEPEncryptionSET" +#define NID_rsaOAEPEncryptionSET 644 +#define OBJ_rsaOAEPEncryptionSET OBJ_rsadsi,1L,1L,6L + +#define SN_ipsec3 "Oakley-EC2N-3" +#define LN_ipsec3 "ipsec3" +#define NID_ipsec3 749 + +#define SN_ipsec4 "Oakley-EC2N-4" +#define LN_ipsec4 "ipsec4" +#define NID_ipsec4 750 + +#define SN_whirlpool "whirlpool" +#define NID_whirlpool 804 +#define OBJ_whirlpool OBJ_iso,0L,10118L,3L,0L,55L + +#define SN_cryptopro "cryptopro" +#define NID_cryptopro 805 +#define OBJ_cryptopro OBJ_member_body,643L,2L,2L + +#define SN_cryptocom "cryptocom" +#define NID_cryptocom 806 +#define OBJ_cryptocom OBJ_member_body,643L,2L,9L + +#define SN_id_tc26 "id-tc26" +#define NID_id_tc26 974 +#define OBJ_id_tc26 OBJ_member_body,643L,7L,1L + +#define SN_id_GostR3411_94_with_GostR3410_2001 "id-GostR3411-94-with-GostR3410-2001" +#define LN_id_GostR3411_94_with_GostR3410_2001 "GOST R 34.11-94 with GOST R 34.10-2001" +#define NID_id_GostR3411_94_with_GostR3410_2001 807 +#define OBJ_id_GostR3411_94_with_GostR3410_2001 OBJ_cryptopro,3L + +#define SN_id_GostR3411_94_with_GostR3410_94 "id-GostR3411-94-with-GostR3410-94" +#define LN_id_GostR3411_94_with_GostR3410_94 "GOST R 34.11-94 with GOST R 34.10-94" +#define NID_id_GostR3411_94_with_GostR3410_94 808 +#define OBJ_id_GostR3411_94_with_GostR3410_94 OBJ_cryptopro,4L + +#define SN_id_GostR3411_94 "md_gost94" +#define LN_id_GostR3411_94 "GOST R 34.11-94" +#define NID_id_GostR3411_94 809 +#define OBJ_id_GostR3411_94 OBJ_cryptopro,9L + +#define SN_id_HMACGostR3411_94 "id-HMACGostR3411-94" +#define LN_id_HMACGostR3411_94 "HMAC GOST 34.11-94" +#define NID_id_HMACGostR3411_94 810 +#define OBJ_id_HMACGostR3411_94 OBJ_cryptopro,10L + +#define SN_id_GostR3410_2001 "gost2001" +#define LN_id_GostR3410_2001 "GOST R 34.10-2001" +#define NID_id_GostR3410_2001 811 +#define OBJ_id_GostR3410_2001 OBJ_cryptopro,19L + +#define SN_id_GostR3410_94 "gost94" +#define LN_id_GostR3410_94 "GOST R 34.10-94" +#define NID_id_GostR3410_94 812 +#define OBJ_id_GostR3410_94 OBJ_cryptopro,20L + +#define SN_id_Gost28147_89 "gost89" +#define LN_id_Gost28147_89 "GOST 28147-89" +#define NID_id_Gost28147_89 813 +#define OBJ_id_Gost28147_89 OBJ_cryptopro,21L + +#define SN_gost89_cnt "gost89-cnt" +#define NID_gost89_cnt 814 + +#define SN_gost89_cnt_12 "gost89-cnt-12" +#define NID_gost89_cnt_12 975 + +#define SN_gost89_cbc "gost89-cbc" +#define NID_gost89_cbc 1009 + +#define SN_gost89_ecb "gost89-ecb" +#define NID_gost89_ecb 1010 + +#define SN_gost89_ctr "gost89-ctr" +#define NID_gost89_ctr 1011 + +#define SN_id_Gost28147_89_MAC "gost-mac" +#define LN_id_Gost28147_89_MAC "GOST 28147-89 MAC" +#define NID_id_Gost28147_89_MAC 815 +#define OBJ_id_Gost28147_89_MAC OBJ_cryptopro,22L + +#define SN_gost_mac_12 "gost-mac-12" +#define NID_gost_mac_12 976 + +#define SN_id_GostR3411_94_prf "prf-gostr3411-94" +#define LN_id_GostR3411_94_prf "GOST R 34.11-94 PRF" +#define NID_id_GostR3411_94_prf 816 +#define OBJ_id_GostR3411_94_prf OBJ_cryptopro,23L + +#define SN_id_GostR3410_2001DH "id-GostR3410-2001DH" +#define LN_id_GostR3410_2001DH "GOST R 34.10-2001 DH" +#define NID_id_GostR3410_2001DH 817 +#define OBJ_id_GostR3410_2001DH OBJ_cryptopro,98L + +#define SN_id_GostR3410_94DH "id-GostR3410-94DH" +#define LN_id_GostR3410_94DH "GOST R 34.10-94 DH" +#define NID_id_GostR3410_94DH 818 +#define OBJ_id_GostR3410_94DH OBJ_cryptopro,99L + +#define SN_id_Gost28147_89_CryptoPro_KeyMeshing "id-Gost28147-89-CryptoPro-KeyMeshing" +#define NID_id_Gost28147_89_CryptoPro_KeyMeshing 819 +#define OBJ_id_Gost28147_89_CryptoPro_KeyMeshing OBJ_cryptopro,14L,1L + +#define SN_id_Gost28147_89_None_KeyMeshing "id-Gost28147-89-None-KeyMeshing" +#define NID_id_Gost28147_89_None_KeyMeshing 820 +#define OBJ_id_Gost28147_89_None_KeyMeshing OBJ_cryptopro,14L,0L + +#define SN_id_GostR3411_94_TestParamSet "id-GostR3411-94-TestParamSet" +#define NID_id_GostR3411_94_TestParamSet 821 +#define OBJ_id_GostR3411_94_TestParamSet OBJ_cryptopro,30L,0L + +#define SN_id_GostR3411_94_CryptoProParamSet "id-GostR3411-94-CryptoProParamSet" +#define NID_id_GostR3411_94_CryptoProParamSet 822 +#define OBJ_id_GostR3411_94_CryptoProParamSet OBJ_cryptopro,30L,1L + +#define SN_id_Gost28147_89_TestParamSet "id-Gost28147-89-TestParamSet" +#define NID_id_Gost28147_89_TestParamSet 823 +#define OBJ_id_Gost28147_89_TestParamSet OBJ_cryptopro,31L,0L + +#define SN_id_Gost28147_89_CryptoPro_A_ParamSet "id-Gost28147-89-CryptoPro-A-ParamSet" +#define NID_id_Gost28147_89_CryptoPro_A_ParamSet 824 +#define OBJ_id_Gost28147_89_CryptoPro_A_ParamSet OBJ_cryptopro,31L,1L + +#define SN_id_Gost28147_89_CryptoPro_B_ParamSet "id-Gost28147-89-CryptoPro-B-ParamSet" +#define NID_id_Gost28147_89_CryptoPro_B_ParamSet 825 +#define OBJ_id_Gost28147_89_CryptoPro_B_ParamSet OBJ_cryptopro,31L,2L + +#define SN_id_Gost28147_89_CryptoPro_C_ParamSet "id-Gost28147-89-CryptoPro-C-ParamSet" +#define NID_id_Gost28147_89_CryptoPro_C_ParamSet 826 +#define OBJ_id_Gost28147_89_CryptoPro_C_ParamSet OBJ_cryptopro,31L,3L + +#define SN_id_Gost28147_89_CryptoPro_D_ParamSet "id-Gost28147-89-CryptoPro-D-ParamSet" +#define NID_id_Gost28147_89_CryptoPro_D_ParamSet 827 +#define OBJ_id_Gost28147_89_CryptoPro_D_ParamSet OBJ_cryptopro,31L,4L + +#define SN_id_Gost28147_89_CryptoPro_Oscar_1_1_ParamSet "id-Gost28147-89-CryptoPro-Oscar-1-1-ParamSet" +#define NID_id_Gost28147_89_CryptoPro_Oscar_1_1_ParamSet 828 +#define OBJ_id_Gost28147_89_CryptoPro_Oscar_1_1_ParamSet OBJ_cryptopro,31L,5L + +#define SN_id_Gost28147_89_CryptoPro_Oscar_1_0_ParamSet "id-Gost28147-89-CryptoPro-Oscar-1-0-ParamSet" +#define NID_id_Gost28147_89_CryptoPro_Oscar_1_0_ParamSet 829 +#define OBJ_id_Gost28147_89_CryptoPro_Oscar_1_0_ParamSet OBJ_cryptopro,31L,6L + +#define SN_id_Gost28147_89_CryptoPro_RIC_1_ParamSet "id-Gost28147-89-CryptoPro-RIC-1-ParamSet" +#define NID_id_Gost28147_89_CryptoPro_RIC_1_ParamSet 830 +#define OBJ_id_Gost28147_89_CryptoPro_RIC_1_ParamSet OBJ_cryptopro,31L,7L + +#define SN_id_GostR3410_94_TestParamSet "id-GostR3410-94-TestParamSet" +#define NID_id_GostR3410_94_TestParamSet 831 +#define OBJ_id_GostR3410_94_TestParamSet OBJ_cryptopro,32L,0L + +#define SN_id_GostR3410_94_CryptoPro_A_ParamSet "id-GostR3410-94-CryptoPro-A-ParamSet" +#define NID_id_GostR3410_94_CryptoPro_A_ParamSet 832 +#define OBJ_id_GostR3410_94_CryptoPro_A_ParamSet OBJ_cryptopro,32L,2L + +#define SN_id_GostR3410_94_CryptoPro_B_ParamSet "id-GostR3410-94-CryptoPro-B-ParamSet" +#define NID_id_GostR3410_94_CryptoPro_B_ParamSet 833 +#define OBJ_id_GostR3410_94_CryptoPro_B_ParamSet OBJ_cryptopro,32L,3L + +#define SN_id_GostR3410_94_CryptoPro_C_ParamSet "id-GostR3410-94-CryptoPro-C-ParamSet" +#define NID_id_GostR3410_94_CryptoPro_C_ParamSet 834 +#define OBJ_id_GostR3410_94_CryptoPro_C_ParamSet OBJ_cryptopro,32L,4L + +#define SN_id_GostR3410_94_CryptoPro_D_ParamSet "id-GostR3410-94-CryptoPro-D-ParamSet" +#define NID_id_GostR3410_94_CryptoPro_D_ParamSet 835 +#define OBJ_id_GostR3410_94_CryptoPro_D_ParamSet OBJ_cryptopro,32L,5L + +#define SN_id_GostR3410_94_CryptoPro_XchA_ParamSet "id-GostR3410-94-CryptoPro-XchA-ParamSet" +#define NID_id_GostR3410_94_CryptoPro_XchA_ParamSet 836 +#define OBJ_id_GostR3410_94_CryptoPro_XchA_ParamSet OBJ_cryptopro,33L,1L + +#define SN_id_GostR3410_94_CryptoPro_XchB_ParamSet "id-GostR3410-94-CryptoPro-XchB-ParamSet" +#define NID_id_GostR3410_94_CryptoPro_XchB_ParamSet 837 +#define OBJ_id_GostR3410_94_CryptoPro_XchB_ParamSet OBJ_cryptopro,33L,2L + +#define SN_id_GostR3410_94_CryptoPro_XchC_ParamSet "id-GostR3410-94-CryptoPro-XchC-ParamSet" +#define NID_id_GostR3410_94_CryptoPro_XchC_ParamSet 838 +#define OBJ_id_GostR3410_94_CryptoPro_XchC_ParamSet OBJ_cryptopro,33L,3L + +#define SN_id_GostR3410_2001_TestParamSet "id-GostR3410-2001-TestParamSet" +#define NID_id_GostR3410_2001_TestParamSet 839 +#define OBJ_id_GostR3410_2001_TestParamSet OBJ_cryptopro,35L,0L + +#define SN_id_GostR3410_2001_CryptoPro_A_ParamSet "id-GostR3410-2001-CryptoPro-A-ParamSet" +#define NID_id_GostR3410_2001_CryptoPro_A_ParamSet 840 +#define OBJ_id_GostR3410_2001_CryptoPro_A_ParamSet OBJ_cryptopro,35L,1L + +#define SN_id_GostR3410_2001_CryptoPro_B_ParamSet "id-GostR3410-2001-CryptoPro-B-ParamSet" +#define NID_id_GostR3410_2001_CryptoPro_B_ParamSet 841 +#define OBJ_id_GostR3410_2001_CryptoPro_B_ParamSet OBJ_cryptopro,35L,2L + +#define SN_id_GostR3410_2001_CryptoPro_C_ParamSet "id-GostR3410-2001-CryptoPro-C-ParamSet" +#define NID_id_GostR3410_2001_CryptoPro_C_ParamSet 842 +#define OBJ_id_GostR3410_2001_CryptoPro_C_ParamSet OBJ_cryptopro,35L,3L + +#define SN_id_GostR3410_2001_CryptoPro_XchA_ParamSet "id-GostR3410-2001-CryptoPro-XchA-ParamSet" +#define NID_id_GostR3410_2001_CryptoPro_XchA_ParamSet 843 +#define OBJ_id_GostR3410_2001_CryptoPro_XchA_ParamSet OBJ_cryptopro,36L,0L + +#define SN_id_GostR3410_2001_CryptoPro_XchB_ParamSet "id-GostR3410-2001-CryptoPro-XchB-ParamSet" +#define NID_id_GostR3410_2001_CryptoPro_XchB_ParamSet 844 +#define OBJ_id_GostR3410_2001_CryptoPro_XchB_ParamSet OBJ_cryptopro,36L,1L + +#define SN_id_GostR3410_94_a "id-GostR3410-94-a" +#define NID_id_GostR3410_94_a 845 +#define OBJ_id_GostR3410_94_a OBJ_id_GostR3410_94,1L + +#define SN_id_GostR3410_94_aBis "id-GostR3410-94-aBis" +#define NID_id_GostR3410_94_aBis 846 +#define OBJ_id_GostR3410_94_aBis OBJ_id_GostR3410_94,2L + +#define SN_id_GostR3410_94_b "id-GostR3410-94-b" +#define NID_id_GostR3410_94_b 847 +#define OBJ_id_GostR3410_94_b OBJ_id_GostR3410_94,3L + +#define SN_id_GostR3410_94_bBis "id-GostR3410-94-bBis" +#define NID_id_GostR3410_94_bBis 848 +#define OBJ_id_GostR3410_94_bBis OBJ_id_GostR3410_94,4L + +#define SN_id_Gost28147_89_cc "id-Gost28147-89-cc" +#define LN_id_Gost28147_89_cc "GOST 28147-89 Cryptocom ParamSet" +#define NID_id_Gost28147_89_cc 849 +#define OBJ_id_Gost28147_89_cc OBJ_cryptocom,1L,6L,1L + +#define SN_id_GostR3410_94_cc "gost94cc" +#define LN_id_GostR3410_94_cc "GOST 34.10-94 Cryptocom" +#define NID_id_GostR3410_94_cc 850 +#define OBJ_id_GostR3410_94_cc OBJ_cryptocom,1L,5L,3L + +#define SN_id_GostR3410_2001_cc "gost2001cc" +#define LN_id_GostR3410_2001_cc "GOST 34.10-2001 Cryptocom" +#define NID_id_GostR3410_2001_cc 851 +#define OBJ_id_GostR3410_2001_cc OBJ_cryptocom,1L,5L,4L + +#define SN_id_GostR3411_94_with_GostR3410_94_cc "id-GostR3411-94-with-GostR3410-94-cc" +#define LN_id_GostR3411_94_with_GostR3410_94_cc "GOST R 34.11-94 with GOST R 34.10-94 Cryptocom" +#define NID_id_GostR3411_94_with_GostR3410_94_cc 852 +#define OBJ_id_GostR3411_94_with_GostR3410_94_cc OBJ_cryptocom,1L,3L,3L + +#define SN_id_GostR3411_94_with_GostR3410_2001_cc "id-GostR3411-94-with-GostR3410-2001-cc" +#define LN_id_GostR3411_94_with_GostR3410_2001_cc "GOST R 34.11-94 with GOST R 34.10-2001 Cryptocom" +#define NID_id_GostR3411_94_with_GostR3410_2001_cc 853 +#define OBJ_id_GostR3411_94_with_GostR3410_2001_cc OBJ_cryptocom,1L,3L,4L + +#define SN_id_GostR3410_2001_ParamSet_cc "id-GostR3410-2001-ParamSet-cc" +#define LN_id_GostR3410_2001_ParamSet_cc "GOST R 3410-2001 Parameter Set Cryptocom" +#define NID_id_GostR3410_2001_ParamSet_cc 854 +#define OBJ_id_GostR3410_2001_ParamSet_cc OBJ_cryptocom,1L,8L,1L + +#define SN_id_tc26_algorithms "id-tc26-algorithms" +#define NID_id_tc26_algorithms 977 +#define OBJ_id_tc26_algorithms OBJ_id_tc26,1L + +#define SN_id_tc26_sign "id-tc26-sign" +#define NID_id_tc26_sign 978 +#define OBJ_id_tc26_sign OBJ_id_tc26_algorithms,1L + +#define SN_id_GostR3410_2012_256 "gost2012_256" +#define LN_id_GostR3410_2012_256 "GOST R 34.10-2012 with 256 bit modulus" +#define NID_id_GostR3410_2012_256 979 +#define OBJ_id_GostR3410_2012_256 OBJ_id_tc26_sign,1L + +#define SN_id_GostR3410_2012_512 "gost2012_512" +#define LN_id_GostR3410_2012_512 "GOST R 34.10-2012 with 512 bit modulus" +#define NID_id_GostR3410_2012_512 980 +#define OBJ_id_GostR3410_2012_512 OBJ_id_tc26_sign,2L + +#define SN_id_tc26_digest "id-tc26-digest" +#define NID_id_tc26_digest 981 +#define OBJ_id_tc26_digest OBJ_id_tc26_algorithms,2L + +#define SN_id_GostR3411_2012_256 "md_gost12_256" +#define LN_id_GostR3411_2012_256 "GOST R 34.11-2012 with 256 bit hash" +#define NID_id_GostR3411_2012_256 982 +#define OBJ_id_GostR3411_2012_256 OBJ_id_tc26_digest,2L + +#define SN_id_GostR3411_2012_512 "md_gost12_512" +#define LN_id_GostR3411_2012_512 "GOST R 34.11-2012 with 512 bit hash" +#define NID_id_GostR3411_2012_512 983 +#define OBJ_id_GostR3411_2012_512 OBJ_id_tc26_digest,3L + +#define SN_id_tc26_signwithdigest "id-tc26-signwithdigest" +#define NID_id_tc26_signwithdigest 984 +#define OBJ_id_tc26_signwithdigest OBJ_id_tc26_algorithms,3L + +#define SN_id_tc26_signwithdigest_gost3410_2012_256 "id-tc26-signwithdigest-gost3410-2012-256" +#define LN_id_tc26_signwithdigest_gost3410_2012_256 "GOST R 34.10-2012 with GOST R 34.11-2012 (256 bit)" +#define NID_id_tc26_signwithdigest_gost3410_2012_256 985 +#define OBJ_id_tc26_signwithdigest_gost3410_2012_256 OBJ_id_tc26_signwithdigest,2L + +#define SN_id_tc26_signwithdigest_gost3410_2012_512 "id-tc26-signwithdigest-gost3410-2012-512" +#define LN_id_tc26_signwithdigest_gost3410_2012_512 "GOST R 34.10-2012 with GOST R 34.11-2012 (512 bit)" +#define NID_id_tc26_signwithdigest_gost3410_2012_512 986 +#define OBJ_id_tc26_signwithdigest_gost3410_2012_512 OBJ_id_tc26_signwithdigest,3L + +#define SN_id_tc26_mac "id-tc26-mac" +#define NID_id_tc26_mac 987 +#define OBJ_id_tc26_mac OBJ_id_tc26_algorithms,4L + +#define SN_id_tc26_hmac_gost_3411_2012_256 "id-tc26-hmac-gost-3411-2012-256" +#define LN_id_tc26_hmac_gost_3411_2012_256 "HMAC GOST 34.11-2012 256 bit" +#define NID_id_tc26_hmac_gost_3411_2012_256 988 +#define OBJ_id_tc26_hmac_gost_3411_2012_256 OBJ_id_tc26_mac,1L + +#define SN_id_tc26_hmac_gost_3411_2012_512 "id-tc26-hmac-gost-3411-2012-512" +#define LN_id_tc26_hmac_gost_3411_2012_512 "HMAC GOST 34.11-2012 512 bit" +#define NID_id_tc26_hmac_gost_3411_2012_512 989 +#define OBJ_id_tc26_hmac_gost_3411_2012_512 OBJ_id_tc26_mac,2L + +#define SN_id_tc26_cipher "id-tc26-cipher" +#define NID_id_tc26_cipher 990 +#define OBJ_id_tc26_cipher OBJ_id_tc26_algorithms,5L + +#define SN_id_tc26_cipher_gostr3412_2015_magma "id-tc26-cipher-gostr3412-2015-magma" +#define NID_id_tc26_cipher_gostr3412_2015_magma 1173 +#define OBJ_id_tc26_cipher_gostr3412_2015_magma OBJ_id_tc26_cipher,1L + +#define SN_id_tc26_cipher_gostr3412_2015_magma_ctracpkm "id-tc26-cipher-gostr3412-2015-magma-ctracpkm" +#define NID_id_tc26_cipher_gostr3412_2015_magma_ctracpkm 1174 +#define OBJ_id_tc26_cipher_gostr3412_2015_magma_ctracpkm OBJ_id_tc26_cipher_gostr3412_2015_magma,1L + +#define SN_id_tc26_cipher_gostr3412_2015_magma_ctracpkm_omac "id-tc26-cipher-gostr3412-2015-magma-ctracpkm-omac" +#define NID_id_tc26_cipher_gostr3412_2015_magma_ctracpkm_omac 1175 +#define OBJ_id_tc26_cipher_gostr3412_2015_magma_ctracpkm_omac OBJ_id_tc26_cipher_gostr3412_2015_magma,2L + +#define SN_id_tc26_cipher_gostr3412_2015_kuznyechik "id-tc26-cipher-gostr3412-2015-kuznyechik" +#define NID_id_tc26_cipher_gostr3412_2015_kuznyechik 1176 +#define OBJ_id_tc26_cipher_gostr3412_2015_kuznyechik OBJ_id_tc26_cipher,2L + +#define SN_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm "id-tc26-cipher-gostr3412-2015-kuznyechik-ctracpkm" +#define NID_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm 1177 +#define OBJ_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm OBJ_id_tc26_cipher_gostr3412_2015_kuznyechik,1L + +#define SN_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm_omac "id-tc26-cipher-gostr3412-2015-kuznyechik-ctracpkm-omac" +#define NID_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm_omac 1178 +#define OBJ_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm_omac OBJ_id_tc26_cipher_gostr3412_2015_kuznyechik,2L + +#define SN_id_tc26_agreement "id-tc26-agreement" +#define NID_id_tc26_agreement 991 +#define OBJ_id_tc26_agreement OBJ_id_tc26_algorithms,6L + +#define SN_id_tc26_agreement_gost_3410_2012_256 "id-tc26-agreement-gost-3410-2012-256" +#define NID_id_tc26_agreement_gost_3410_2012_256 992 +#define OBJ_id_tc26_agreement_gost_3410_2012_256 OBJ_id_tc26_agreement,1L + +#define SN_id_tc26_agreement_gost_3410_2012_512 "id-tc26-agreement-gost-3410-2012-512" +#define NID_id_tc26_agreement_gost_3410_2012_512 993 +#define OBJ_id_tc26_agreement_gost_3410_2012_512 OBJ_id_tc26_agreement,2L + +#define SN_id_tc26_wrap "id-tc26-wrap" +#define NID_id_tc26_wrap 1179 +#define OBJ_id_tc26_wrap OBJ_id_tc26_algorithms,7L + +#define SN_id_tc26_wrap_gostr3412_2015_magma "id-tc26-wrap-gostr3412-2015-magma" +#define NID_id_tc26_wrap_gostr3412_2015_magma 1180 +#define OBJ_id_tc26_wrap_gostr3412_2015_magma OBJ_id_tc26_wrap,1L + +#define SN_id_tc26_wrap_gostr3412_2015_magma_kexp15 "id-tc26-wrap-gostr3412-2015-magma-kexp15" +#define NID_id_tc26_wrap_gostr3412_2015_magma_kexp15 1181 +#define OBJ_id_tc26_wrap_gostr3412_2015_magma_kexp15 OBJ_id_tc26_wrap_gostr3412_2015_magma,1L + +#define SN_id_tc26_wrap_gostr3412_2015_kuznyechik "id-tc26-wrap-gostr3412-2015-kuznyechik" +#define NID_id_tc26_wrap_gostr3412_2015_kuznyechik 1182 +#define OBJ_id_tc26_wrap_gostr3412_2015_kuznyechik OBJ_id_tc26_wrap,2L + +#define SN_id_tc26_wrap_gostr3412_2015_kuznyechik_kexp15 "id-tc26-wrap-gostr3412-2015-kuznyechik-kexp15" +#define NID_id_tc26_wrap_gostr3412_2015_kuznyechik_kexp15 1183 +#define OBJ_id_tc26_wrap_gostr3412_2015_kuznyechik_kexp15 OBJ_id_tc26_wrap_gostr3412_2015_kuznyechik,1L + +#define SN_id_tc26_constants "id-tc26-constants" +#define NID_id_tc26_constants 994 +#define OBJ_id_tc26_constants OBJ_id_tc26,2L + +#define SN_id_tc26_sign_constants "id-tc26-sign-constants" +#define NID_id_tc26_sign_constants 995 +#define OBJ_id_tc26_sign_constants OBJ_id_tc26_constants,1L + +#define SN_id_tc26_gost_3410_2012_256_constants "id-tc26-gost-3410-2012-256-constants" +#define NID_id_tc26_gost_3410_2012_256_constants 1147 +#define OBJ_id_tc26_gost_3410_2012_256_constants OBJ_id_tc26_sign_constants,1L + +#define SN_id_tc26_gost_3410_2012_256_paramSetA "id-tc26-gost-3410-2012-256-paramSetA" +#define LN_id_tc26_gost_3410_2012_256_paramSetA "GOST R 34.10-2012 (256 bit) ParamSet A" +#define NID_id_tc26_gost_3410_2012_256_paramSetA 1148 +#define OBJ_id_tc26_gost_3410_2012_256_paramSetA OBJ_id_tc26_gost_3410_2012_256_constants,1L + +#define SN_id_tc26_gost_3410_2012_256_paramSetB "id-tc26-gost-3410-2012-256-paramSetB" +#define LN_id_tc26_gost_3410_2012_256_paramSetB "GOST R 34.10-2012 (256 bit) ParamSet B" +#define NID_id_tc26_gost_3410_2012_256_paramSetB 1184 +#define OBJ_id_tc26_gost_3410_2012_256_paramSetB OBJ_id_tc26_gost_3410_2012_256_constants,2L + +#define SN_id_tc26_gost_3410_2012_256_paramSetC "id-tc26-gost-3410-2012-256-paramSetC" +#define LN_id_tc26_gost_3410_2012_256_paramSetC "GOST R 34.10-2012 (256 bit) ParamSet C" +#define NID_id_tc26_gost_3410_2012_256_paramSetC 1185 +#define OBJ_id_tc26_gost_3410_2012_256_paramSetC OBJ_id_tc26_gost_3410_2012_256_constants,3L + +#define SN_id_tc26_gost_3410_2012_256_paramSetD "id-tc26-gost-3410-2012-256-paramSetD" +#define LN_id_tc26_gost_3410_2012_256_paramSetD "GOST R 34.10-2012 (256 bit) ParamSet D" +#define NID_id_tc26_gost_3410_2012_256_paramSetD 1186 +#define OBJ_id_tc26_gost_3410_2012_256_paramSetD OBJ_id_tc26_gost_3410_2012_256_constants,4L + +#define SN_id_tc26_gost_3410_2012_512_constants "id-tc26-gost-3410-2012-512-constants" +#define NID_id_tc26_gost_3410_2012_512_constants 996 +#define OBJ_id_tc26_gost_3410_2012_512_constants OBJ_id_tc26_sign_constants,2L + +#define SN_id_tc26_gost_3410_2012_512_paramSetTest "id-tc26-gost-3410-2012-512-paramSetTest" +#define LN_id_tc26_gost_3410_2012_512_paramSetTest "GOST R 34.10-2012 (512 bit) testing parameter set" +#define NID_id_tc26_gost_3410_2012_512_paramSetTest 997 +#define OBJ_id_tc26_gost_3410_2012_512_paramSetTest OBJ_id_tc26_gost_3410_2012_512_constants,0L + +#define SN_id_tc26_gost_3410_2012_512_paramSetA "id-tc26-gost-3410-2012-512-paramSetA" +#define LN_id_tc26_gost_3410_2012_512_paramSetA "GOST R 34.10-2012 (512 bit) ParamSet A" +#define NID_id_tc26_gost_3410_2012_512_paramSetA 998 +#define OBJ_id_tc26_gost_3410_2012_512_paramSetA OBJ_id_tc26_gost_3410_2012_512_constants,1L + +#define SN_id_tc26_gost_3410_2012_512_paramSetB "id-tc26-gost-3410-2012-512-paramSetB" +#define LN_id_tc26_gost_3410_2012_512_paramSetB "GOST R 34.10-2012 (512 bit) ParamSet B" +#define NID_id_tc26_gost_3410_2012_512_paramSetB 999 +#define OBJ_id_tc26_gost_3410_2012_512_paramSetB OBJ_id_tc26_gost_3410_2012_512_constants,2L + +#define SN_id_tc26_gost_3410_2012_512_paramSetC "id-tc26-gost-3410-2012-512-paramSetC" +#define LN_id_tc26_gost_3410_2012_512_paramSetC "GOST R 34.10-2012 (512 bit) ParamSet C" +#define NID_id_tc26_gost_3410_2012_512_paramSetC 1149 +#define OBJ_id_tc26_gost_3410_2012_512_paramSetC OBJ_id_tc26_gost_3410_2012_512_constants,3L + +#define SN_id_tc26_digest_constants "id-tc26-digest-constants" +#define NID_id_tc26_digest_constants 1000 +#define OBJ_id_tc26_digest_constants OBJ_id_tc26_constants,2L + +#define SN_id_tc26_cipher_constants "id-tc26-cipher-constants" +#define NID_id_tc26_cipher_constants 1001 +#define OBJ_id_tc26_cipher_constants OBJ_id_tc26_constants,5L + +#define SN_id_tc26_gost_28147_constants "id-tc26-gost-28147-constants" +#define NID_id_tc26_gost_28147_constants 1002 +#define OBJ_id_tc26_gost_28147_constants OBJ_id_tc26_cipher_constants,1L + +#define SN_id_tc26_gost_28147_param_Z "id-tc26-gost-28147-param-Z" +#define LN_id_tc26_gost_28147_param_Z "GOST 28147-89 TC26 parameter set" +#define NID_id_tc26_gost_28147_param_Z 1003 +#define OBJ_id_tc26_gost_28147_param_Z OBJ_id_tc26_gost_28147_constants,1L + +#define SN_INN "INN" +#define LN_INN "INN" +#define NID_INN 1004 +#define OBJ_INN OBJ_member_body,643L,3L,131L,1L,1L + +#define SN_OGRN "OGRN" +#define LN_OGRN "OGRN" +#define NID_OGRN 1005 +#define OBJ_OGRN OBJ_member_body,643L,100L,1L + +#define SN_SNILS "SNILS" +#define LN_SNILS "SNILS" +#define NID_SNILS 1006 +#define OBJ_SNILS OBJ_member_body,643L,100L,3L + +#define SN_subjectSignTool "subjectSignTool" +#define LN_subjectSignTool "Signing Tool of Subject" +#define NID_subjectSignTool 1007 +#define OBJ_subjectSignTool OBJ_member_body,643L,100L,111L + +#define SN_issuerSignTool "issuerSignTool" +#define LN_issuerSignTool "Signing Tool of Issuer" +#define NID_issuerSignTool 1008 +#define OBJ_issuerSignTool OBJ_member_body,643L,100L,112L + +#define SN_grasshopper_ecb "grasshopper-ecb" +#define NID_grasshopper_ecb 1012 + +#define SN_grasshopper_ctr "grasshopper-ctr" +#define NID_grasshopper_ctr 1013 + +#define SN_grasshopper_ofb "grasshopper-ofb" +#define NID_grasshopper_ofb 1014 + +#define SN_grasshopper_cbc "grasshopper-cbc" +#define NID_grasshopper_cbc 1015 + +#define SN_grasshopper_cfb "grasshopper-cfb" +#define NID_grasshopper_cfb 1016 + +#define SN_grasshopper_mac "grasshopper-mac" +#define NID_grasshopper_mac 1017 + +#define SN_magma_ecb "magma-ecb" +#define NID_magma_ecb 1187 + +#define SN_magma_ctr "magma-ctr" +#define NID_magma_ctr 1188 + +#define SN_magma_ofb "magma-ofb" +#define NID_magma_ofb 1189 + +#define SN_magma_cbc "magma-cbc" +#define NID_magma_cbc 1190 + +#define SN_magma_cfb "magma-cfb" +#define NID_magma_cfb 1191 + +#define SN_magma_mac "magma-mac" +#define NID_magma_mac 1192 + +#define SN_camellia_128_cbc "CAMELLIA-128-CBC" +#define LN_camellia_128_cbc "camellia-128-cbc" +#define NID_camellia_128_cbc 751 +#define OBJ_camellia_128_cbc 1L,2L,392L,200011L,61L,1L,1L,1L,2L + +#define SN_camellia_192_cbc "CAMELLIA-192-CBC" +#define LN_camellia_192_cbc "camellia-192-cbc" +#define NID_camellia_192_cbc 752 +#define OBJ_camellia_192_cbc 1L,2L,392L,200011L,61L,1L,1L,1L,3L + +#define SN_camellia_256_cbc "CAMELLIA-256-CBC" +#define LN_camellia_256_cbc "camellia-256-cbc" +#define NID_camellia_256_cbc 753 +#define OBJ_camellia_256_cbc 1L,2L,392L,200011L,61L,1L,1L,1L,4L + +#define SN_id_camellia128_wrap "id-camellia128-wrap" +#define NID_id_camellia128_wrap 907 +#define OBJ_id_camellia128_wrap 1L,2L,392L,200011L,61L,1L,1L,3L,2L + +#define SN_id_camellia192_wrap "id-camellia192-wrap" +#define NID_id_camellia192_wrap 908 +#define OBJ_id_camellia192_wrap 1L,2L,392L,200011L,61L,1L,1L,3L,3L + +#define SN_id_camellia256_wrap "id-camellia256-wrap" +#define NID_id_camellia256_wrap 909 +#define OBJ_id_camellia256_wrap 1L,2L,392L,200011L,61L,1L,1L,3L,4L + +#define OBJ_ntt_ds 0L,3L,4401L,5L + +#define OBJ_camellia OBJ_ntt_ds,3L,1L,9L + +#define SN_camellia_128_ecb "CAMELLIA-128-ECB" +#define LN_camellia_128_ecb "camellia-128-ecb" +#define NID_camellia_128_ecb 754 +#define OBJ_camellia_128_ecb OBJ_camellia,1L + +#define SN_camellia_128_ofb128 "CAMELLIA-128-OFB" +#define LN_camellia_128_ofb128 "camellia-128-ofb" +#define NID_camellia_128_ofb128 766 +#define OBJ_camellia_128_ofb128 OBJ_camellia,3L + +#define SN_camellia_128_cfb128 "CAMELLIA-128-CFB" +#define LN_camellia_128_cfb128 "camellia-128-cfb" +#define NID_camellia_128_cfb128 757 +#define OBJ_camellia_128_cfb128 OBJ_camellia,4L + +#define SN_camellia_128_gcm "CAMELLIA-128-GCM" +#define LN_camellia_128_gcm "camellia-128-gcm" +#define NID_camellia_128_gcm 961 +#define OBJ_camellia_128_gcm OBJ_camellia,6L + +#define SN_camellia_128_ccm "CAMELLIA-128-CCM" +#define LN_camellia_128_ccm "camellia-128-ccm" +#define NID_camellia_128_ccm 962 +#define OBJ_camellia_128_ccm OBJ_camellia,7L + +#define SN_camellia_128_ctr "CAMELLIA-128-CTR" +#define LN_camellia_128_ctr "camellia-128-ctr" +#define NID_camellia_128_ctr 963 +#define OBJ_camellia_128_ctr OBJ_camellia,9L + +#define SN_camellia_128_cmac "CAMELLIA-128-CMAC" +#define LN_camellia_128_cmac "camellia-128-cmac" +#define NID_camellia_128_cmac 964 +#define OBJ_camellia_128_cmac OBJ_camellia,10L + +#define SN_camellia_192_ecb "CAMELLIA-192-ECB" +#define LN_camellia_192_ecb "camellia-192-ecb" +#define NID_camellia_192_ecb 755 +#define OBJ_camellia_192_ecb OBJ_camellia,21L + +#define SN_camellia_192_ofb128 "CAMELLIA-192-OFB" +#define LN_camellia_192_ofb128 "camellia-192-ofb" +#define NID_camellia_192_ofb128 767 +#define OBJ_camellia_192_ofb128 OBJ_camellia,23L + +#define SN_camellia_192_cfb128 "CAMELLIA-192-CFB" +#define LN_camellia_192_cfb128 "camellia-192-cfb" +#define NID_camellia_192_cfb128 758 +#define OBJ_camellia_192_cfb128 OBJ_camellia,24L + +#define SN_camellia_192_gcm "CAMELLIA-192-GCM" +#define LN_camellia_192_gcm "camellia-192-gcm" +#define NID_camellia_192_gcm 965 +#define OBJ_camellia_192_gcm OBJ_camellia,26L + +#define SN_camellia_192_ccm "CAMELLIA-192-CCM" +#define LN_camellia_192_ccm "camellia-192-ccm" +#define NID_camellia_192_ccm 966 +#define OBJ_camellia_192_ccm OBJ_camellia,27L + +#define SN_camellia_192_ctr "CAMELLIA-192-CTR" +#define LN_camellia_192_ctr "camellia-192-ctr" +#define NID_camellia_192_ctr 967 +#define OBJ_camellia_192_ctr OBJ_camellia,29L + +#define SN_camellia_192_cmac "CAMELLIA-192-CMAC" +#define LN_camellia_192_cmac "camellia-192-cmac" +#define NID_camellia_192_cmac 968 +#define OBJ_camellia_192_cmac OBJ_camellia,30L + +#define SN_camellia_256_ecb "CAMELLIA-256-ECB" +#define LN_camellia_256_ecb "camellia-256-ecb" +#define NID_camellia_256_ecb 756 +#define OBJ_camellia_256_ecb OBJ_camellia,41L + +#define SN_camellia_256_ofb128 "CAMELLIA-256-OFB" +#define LN_camellia_256_ofb128 "camellia-256-ofb" +#define NID_camellia_256_ofb128 768 +#define OBJ_camellia_256_ofb128 OBJ_camellia,43L + +#define SN_camellia_256_cfb128 "CAMELLIA-256-CFB" +#define LN_camellia_256_cfb128 "camellia-256-cfb" +#define NID_camellia_256_cfb128 759 +#define OBJ_camellia_256_cfb128 OBJ_camellia,44L + +#define SN_camellia_256_gcm "CAMELLIA-256-GCM" +#define LN_camellia_256_gcm "camellia-256-gcm" +#define NID_camellia_256_gcm 969 +#define OBJ_camellia_256_gcm OBJ_camellia,46L + +#define SN_camellia_256_ccm "CAMELLIA-256-CCM" +#define LN_camellia_256_ccm "camellia-256-ccm" +#define NID_camellia_256_ccm 970 +#define OBJ_camellia_256_ccm OBJ_camellia,47L + +#define SN_camellia_256_ctr "CAMELLIA-256-CTR" +#define LN_camellia_256_ctr "camellia-256-ctr" +#define NID_camellia_256_ctr 971 +#define OBJ_camellia_256_ctr OBJ_camellia,49L + +#define SN_camellia_256_cmac "CAMELLIA-256-CMAC" +#define LN_camellia_256_cmac "camellia-256-cmac" +#define NID_camellia_256_cmac 972 +#define OBJ_camellia_256_cmac OBJ_camellia,50L + +#define SN_camellia_128_cfb1 "CAMELLIA-128-CFB1" +#define LN_camellia_128_cfb1 "camellia-128-cfb1" +#define NID_camellia_128_cfb1 760 + +#define SN_camellia_192_cfb1 "CAMELLIA-192-CFB1" +#define LN_camellia_192_cfb1 "camellia-192-cfb1" +#define NID_camellia_192_cfb1 761 + +#define SN_camellia_256_cfb1 "CAMELLIA-256-CFB1" +#define LN_camellia_256_cfb1 "camellia-256-cfb1" +#define NID_camellia_256_cfb1 762 + +#define SN_camellia_128_cfb8 "CAMELLIA-128-CFB8" +#define LN_camellia_128_cfb8 "camellia-128-cfb8" +#define NID_camellia_128_cfb8 763 + +#define SN_camellia_192_cfb8 "CAMELLIA-192-CFB8" +#define LN_camellia_192_cfb8 "camellia-192-cfb8" +#define NID_camellia_192_cfb8 764 + +#define SN_camellia_256_cfb8 "CAMELLIA-256-CFB8" +#define LN_camellia_256_cfb8 "camellia-256-cfb8" +#define NID_camellia_256_cfb8 765 + +#define OBJ_aria 1L,2L,410L,200046L,1L,1L + +#define SN_aria_128_ecb "ARIA-128-ECB" +#define LN_aria_128_ecb "aria-128-ecb" +#define NID_aria_128_ecb 1065 +#define OBJ_aria_128_ecb OBJ_aria,1L + +#define SN_aria_128_cbc "ARIA-128-CBC" +#define LN_aria_128_cbc "aria-128-cbc" +#define NID_aria_128_cbc 1066 +#define OBJ_aria_128_cbc OBJ_aria,2L + +#define SN_aria_128_cfb128 "ARIA-128-CFB" +#define LN_aria_128_cfb128 "aria-128-cfb" +#define NID_aria_128_cfb128 1067 +#define OBJ_aria_128_cfb128 OBJ_aria,3L + +#define SN_aria_128_ofb128 "ARIA-128-OFB" +#define LN_aria_128_ofb128 "aria-128-ofb" +#define NID_aria_128_ofb128 1068 +#define OBJ_aria_128_ofb128 OBJ_aria,4L + +#define SN_aria_128_ctr "ARIA-128-CTR" +#define LN_aria_128_ctr "aria-128-ctr" +#define NID_aria_128_ctr 1069 +#define OBJ_aria_128_ctr OBJ_aria,5L + +#define SN_aria_192_ecb "ARIA-192-ECB" +#define LN_aria_192_ecb "aria-192-ecb" +#define NID_aria_192_ecb 1070 +#define OBJ_aria_192_ecb OBJ_aria,6L + +#define SN_aria_192_cbc "ARIA-192-CBC" +#define LN_aria_192_cbc "aria-192-cbc" +#define NID_aria_192_cbc 1071 +#define OBJ_aria_192_cbc OBJ_aria,7L + +#define SN_aria_192_cfb128 "ARIA-192-CFB" +#define LN_aria_192_cfb128 "aria-192-cfb" +#define NID_aria_192_cfb128 1072 +#define OBJ_aria_192_cfb128 OBJ_aria,8L + +#define SN_aria_192_ofb128 "ARIA-192-OFB" +#define LN_aria_192_ofb128 "aria-192-ofb" +#define NID_aria_192_ofb128 1073 +#define OBJ_aria_192_ofb128 OBJ_aria,9L + +#define SN_aria_192_ctr "ARIA-192-CTR" +#define LN_aria_192_ctr "aria-192-ctr" +#define NID_aria_192_ctr 1074 +#define OBJ_aria_192_ctr OBJ_aria,10L + +#define SN_aria_256_ecb "ARIA-256-ECB" +#define LN_aria_256_ecb "aria-256-ecb" +#define NID_aria_256_ecb 1075 +#define OBJ_aria_256_ecb OBJ_aria,11L + +#define SN_aria_256_cbc "ARIA-256-CBC" +#define LN_aria_256_cbc "aria-256-cbc" +#define NID_aria_256_cbc 1076 +#define OBJ_aria_256_cbc OBJ_aria,12L + +#define SN_aria_256_cfb128 "ARIA-256-CFB" +#define LN_aria_256_cfb128 "aria-256-cfb" +#define NID_aria_256_cfb128 1077 +#define OBJ_aria_256_cfb128 OBJ_aria,13L + +#define SN_aria_256_ofb128 "ARIA-256-OFB" +#define LN_aria_256_ofb128 "aria-256-ofb" +#define NID_aria_256_ofb128 1078 +#define OBJ_aria_256_ofb128 OBJ_aria,14L + +#define SN_aria_256_ctr "ARIA-256-CTR" +#define LN_aria_256_ctr "aria-256-ctr" +#define NID_aria_256_ctr 1079 +#define OBJ_aria_256_ctr OBJ_aria,15L + +#define SN_aria_128_cfb1 "ARIA-128-CFB1" +#define LN_aria_128_cfb1 "aria-128-cfb1" +#define NID_aria_128_cfb1 1080 + +#define SN_aria_192_cfb1 "ARIA-192-CFB1" +#define LN_aria_192_cfb1 "aria-192-cfb1" +#define NID_aria_192_cfb1 1081 + +#define SN_aria_256_cfb1 "ARIA-256-CFB1" +#define LN_aria_256_cfb1 "aria-256-cfb1" +#define NID_aria_256_cfb1 1082 + +#define SN_aria_128_cfb8 "ARIA-128-CFB8" +#define LN_aria_128_cfb8 "aria-128-cfb8" +#define NID_aria_128_cfb8 1083 + +#define SN_aria_192_cfb8 "ARIA-192-CFB8" +#define LN_aria_192_cfb8 "aria-192-cfb8" +#define NID_aria_192_cfb8 1084 + +#define SN_aria_256_cfb8 "ARIA-256-CFB8" +#define LN_aria_256_cfb8 "aria-256-cfb8" +#define NID_aria_256_cfb8 1085 + +#define SN_aria_128_ccm "ARIA-128-CCM" +#define LN_aria_128_ccm "aria-128-ccm" +#define NID_aria_128_ccm 1120 +#define OBJ_aria_128_ccm OBJ_aria,37L + +#define SN_aria_192_ccm "ARIA-192-CCM" +#define LN_aria_192_ccm "aria-192-ccm" +#define NID_aria_192_ccm 1121 +#define OBJ_aria_192_ccm OBJ_aria,38L + +#define SN_aria_256_ccm "ARIA-256-CCM" +#define LN_aria_256_ccm "aria-256-ccm" +#define NID_aria_256_ccm 1122 +#define OBJ_aria_256_ccm OBJ_aria,39L + +#define SN_aria_128_gcm "ARIA-128-GCM" +#define LN_aria_128_gcm "aria-128-gcm" +#define NID_aria_128_gcm 1123 +#define OBJ_aria_128_gcm OBJ_aria,34L + +#define SN_aria_192_gcm "ARIA-192-GCM" +#define LN_aria_192_gcm "aria-192-gcm" +#define NID_aria_192_gcm 1124 +#define OBJ_aria_192_gcm OBJ_aria,35L + +#define SN_aria_256_gcm "ARIA-256-GCM" +#define LN_aria_256_gcm "aria-256-gcm" +#define NID_aria_256_gcm 1125 +#define OBJ_aria_256_gcm OBJ_aria,36L + +#define SN_kisa "KISA" +#define LN_kisa "kisa" +#define NID_kisa 773 +#define OBJ_kisa OBJ_member_body,410L,200004L + +#define SN_seed_ecb "SEED-ECB" +#define LN_seed_ecb "seed-ecb" +#define NID_seed_ecb 776 +#define OBJ_seed_ecb OBJ_kisa,1L,3L + +#define SN_seed_cbc "SEED-CBC" +#define LN_seed_cbc "seed-cbc" +#define NID_seed_cbc 777 +#define OBJ_seed_cbc OBJ_kisa,1L,4L + +#define SN_seed_cfb128 "SEED-CFB" +#define LN_seed_cfb128 "seed-cfb" +#define NID_seed_cfb128 779 +#define OBJ_seed_cfb128 OBJ_kisa,1L,5L + +#define SN_seed_ofb128 "SEED-OFB" +#define LN_seed_ofb128 "seed-ofb" +#define NID_seed_ofb128 778 +#define OBJ_seed_ofb128 OBJ_kisa,1L,6L + +#define SN_sm4_ecb "SM4-ECB" +#define LN_sm4_ecb "sm4-ecb" +#define NID_sm4_ecb 1133 +#define OBJ_sm4_ecb OBJ_sm_scheme,104L,1L + +#define SN_sm4_cbc "SM4-CBC" +#define LN_sm4_cbc "sm4-cbc" +#define NID_sm4_cbc 1134 +#define OBJ_sm4_cbc OBJ_sm_scheme,104L,2L + +#define SN_sm4_ofb128 "SM4-OFB" +#define LN_sm4_ofb128 "sm4-ofb" +#define NID_sm4_ofb128 1135 +#define OBJ_sm4_ofb128 OBJ_sm_scheme,104L,3L + +#define SN_sm4_cfb128 "SM4-CFB" +#define LN_sm4_cfb128 "sm4-cfb" +#define NID_sm4_cfb128 1137 +#define OBJ_sm4_cfb128 OBJ_sm_scheme,104L,4L + +#define SN_sm4_cfb1 "SM4-CFB1" +#define LN_sm4_cfb1 "sm4-cfb1" +#define NID_sm4_cfb1 1136 +#define OBJ_sm4_cfb1 OBJ_sm_scheme,104L,5L + +#define SN_sm4_cfb8 "SM4-CFB8" +#define LN_sm4_cfb8 "sm4-cfb8" +#define NID_sm4_cfb8 1138 +#define OBJ_sm4_cfb8 OBJ_sm_scheme,104L,6L + +#define SN_sm4_ctr "SM4-CTR" +#define LN_sm4_ctr "sm4-ctr" +#define NID_sm4_ctr 1139 +#define OBJ_sm4_ctr OBJ_sm_scheme,104L,7L + +#define SN_hmac "HMAC" +#define LN_hmac "hmac" +#define NID_hmac 855 + +#define SN_cmac "CMAC" +#define LN_cmac "cmac" +#define NID_cmac 894 + +#define SN_rc4_hmac_md5 "RC4-HMAC-MD5" +#define LN_rc4_hmac_md5 "rc4-hmac-md5" +#define NID_rc4_hmac_md5 915 + +#define SN_aes_128_cbc_hmac_sha1 "AES-128-CBC-HMAC-SHA1" +#define LN_aes_128_cbc_hmac_sha1 "aes-128-cbc-hmac-sha1" +#define NID_aes_128_cbc_hmac_sha1 916 + +#define SN_aes_192_cbc_hmac_sha1 "AES-192-CBC-HMAC-SHA1" +#define LN_aes_192_cbc_hmac_sha1 "aes-192-cbc-hmac-sha1" +#define NID_aes_192_cbc_hmac_sha1 917 + +#define SN_aes_256_cbc_hmac_sha1 "AES-256-CBC-HMAC-SHA1" +#define LN_aes_256_cbc_hmac_sha1 "aes-256-cbc-hmac-sha1" +#define NID_aes_256_cbc_hmac_sha1 918 + +#define SN_aes_128_cbc_hmac_sha256 "AES-128-CBC-HMAC-SHA256" +#define LN_aes_128_cbc_hmac_sha256 "aes-128-cbc-hmac-sha256" +#define NID_aes_128_cbc_hmac_sha256 948 + +#define SN_aes_192_cbc_hmac_sha256 "AES-192-CBC-HMAC-SHA256" +#define LN_aes_192_cbc_hmac_sha256 "aes-192-cbc-hmac-sha256" +#define NID_aes_192_cbc_hmac_sha256 949 + +#define SN_aes_256_cbc_hmac_sha256 "AES-256-CBC-HMAC-SHA256" +#define LN_aes_256_cbc_hmac_sha256 "aes-256-cbc-hmac-sha256" +#define NID_aes_256_cbc_hmac_sha256 950 + +#define SN_chacha20_poly1305 "ChaCha20-Poly1305" +#define LN_chacha20_poly1305 "chacha20-poly1305" +#define NID_chacha20_poly1305 1018 + +#define SN_chacha20 "ChaCha20" +#define LN_chacha20 "chacha20" +#define NID_chacha20 1019 + +#define SN_dhpublicnumber "dhpublicnumber" +#define LN_dhpublicnumber "X9.42 DH" +#define NID_dhpublicnumber 920 +#define OBJ_dhpublicnumber OBJ_ISO_US,10046L,2L,1L + +#define SN_brainpoolP160r1 "brainpoolP160r1" +#define NID_brainpoolP160r1 921 +#define OBJ_brainpoolP160r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,1L + +#define SN_brainpoolP160t1 "brainpoolP160t1" +#define NID_brainpoolP160t1 922 +#define OBJ_brainpoolP160t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,2L + +#define SN_brainpoolP192r1 "brainpoolP192r1" +#define NID_brainpoolP192r1 923 +#define OBJ_brainpoolP192r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,3L + +#define SN_brainpoolP192t1 "brainpoolP192t1" +#define NID_brainpoolP192t1 924 +#define OBJ_brainpoolP192t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,4L + +#define SN_brainpoolP224r1 "brainpoolP224r1" +#define NID_brainpoolP224r1 925 +#define OBJ_brainpoolP224r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,5L + +#define SN_brainpoolP224t1 "brainpoolP224t1" +#define NID_brainpoolP224t1 926 +#define OBJ_brainpoolP224t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,6L + +#define SN_brainpoolP256r1 "brainpoolP256r1" +#define NID_brainpoolP256r1 927 +#define OBJ_brainpoolP256r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,7L + +#define SN_brainpoolP256t1 "brainpoolP256t1" +#define NID_brainpoolP256t1 928 +#define OBJ_brainpoolP256t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,8L + +#define SN_brainpoolP320r1 "brainpoolP320r1" +#define NID_brainpoolP320r1 929 +#define OBJ_brainpoolP320r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,9L + +#define SN_brainpoolP320t1 "brainpoolP320t1" +#define NID_brainpoolP320t1 930 +#define OBJ_brainpoolP320t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,10L + +#define SN_brainpoolP384r1 "brainpoolP384r1" +#define NID_brainpoolP384r1 931 +#define OBJ_brainpoolP384r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,11L + +#define SN_brainpoolP384t1 "brainpoolP384t1" +#define NID_brainpoolP384t1 932 +#define OBJ_brainpoolP384t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,12L + +#define SN_brainpoolP512r1 "brainpoolP512r1" +#define NID_brainpoolP512r1 933 +#define OBJ_brainpoolP512r1 1L,3L,36L,3L,3L,2L,8L,1L,1L,13L + +#define SN_brainpoolP512t1 "brainpoolP512t1" +#define NID_brainpoolP512t1 934 +#define OBJ_brainpoolP512t1 1L,3L,36L,3L,3L,2L,8L,1L,1L,14L + +#define OBJ_x9_63_scheme 1L,3L,133L,16L,840L,63L,0L + +#define OBJ_secg_scheme OBJ_certicom_arc,1L + +#define SN_dhSinglePass_stdDH_sha1kdf_scheme "dhSinglePass-stdDH-sha1kdf-scheme" +#define NID_dhSinglePass_stdDH_sha1kdf_scheme 936 +#define OBJ_dhSinglePass_stdDH_sha1kdf_scheme OBJ_x9_63_scheme,2L + +#define SN_dhSinglePass_stdDH_sha224kdf_scheme "dhSinglePass-stdDH-sha224kdf-scheme" +#define NID_dhSinglePass_stdDH_sha224kdf_scheme 937 +#define OBJ_dhSinglePass_stdDH_sha224kdf_scheme OBJ_secg_scheme,11L,0L + +#define SN_dhSinglePass_stdDH_sha256kdf_scheme "dhSinglePass-stdDH-sha256kdf-scheme" +#define NID_dhSinglePass_stdDH_sha256kdf_scheme 938 +#define OBJ_dhSinglePass_stdDH_sha256kdf_scheme OBJ_secg_scheme,11L,1L + +#define SN_dhSinglePass_stdDH_sha384kdf_scheme "dhSinglePass-stdDH-sha384kdf-scheme" +#define NID_dhSinglePass_stdDH_sha384kdf_scheme 939 +#define OBJ_dhSinglePass_stdDH_sha384kdf_scheme OBJ_secg_scheme,11L,2L + +#define SN_dhSinglePass_stdDH_sha512kdf_scheme "dhSinglePass-stdDH-sha512kdf-scheme" +#define NID_dhSinglePass_stdDH_sha512kdf_scheme 940 +#define OBJ_dhSinglePass_stdDH_sha512kdf_scheme OBJ_secg_scheme,11L,3L + +#define SN_dhSinglePass_cofactorDH_sha1kdf_scheme "dhSinglePass-cofactorDH-sha1kdf-scheme" +#define NID_dhSinglePass_cofactorDH_sha1kdf_scheme 941 +#define OBJ_dhSinglePass_cofactorDH_sha1kdf_scheme OBJ_x9_63_scheme,3L + +#define SN_dhSinglePass_cofactorDH_sha224kdf_scheme "dhSinglePass-cofactorDH-sha224kdf-scheme" +#define NID_dhSinglePass_cofactorDH_sha224kdf_scheme 942 +#define OBJ_dhSinglePass_cofactorDH_sha224kdf_scheme OBJ_secg_scheme,14L,0L + +#define SN_dhSinglePass_cofactorDH_sha256kdf_scheme "dhSinglePass-cofactorDH-sha256kdf-scheme" +#define NID_dhSinglePass_cofactorDH_sha256kdf_scheme 943 +#define OBJ_dhSinglePass_cofactorDH_sha256kdf_scheme OBJ_secg_scheme,14L,1L + +#define SN_dhSinglePass_cofactorDH_sha384kdf_scheme "dhSinglePass-cofactorDH-sha384kdf-scheme" +#define NID_dhSinglePass_cofactorDH_sha384kdf_scheme 944 +#define OBJ_dhSinglePass_cofactorDH_sha384kdf_scheme OBJ_secg_scheme,14L,2L + +#define SN_dhSinglePass_cofactorDH_sha512kdf_scheme "dhSinglePass-cofactorDH-sha512kdf-scheme" +#define NID_dhSinglePass_cofactorDH_sha512kdf_scheme 945 +#define OBJ_dhSinglePass_cofactorDH_sha512kdf_scheme OBJ_secg_scheme,14L,3L + +#define SN_dh_std_kdf "dh-std-kdf" +#define NID_dh_std_kdf 946 + +#define SN_dh_cofactor_kdf "dh-cofactor-kdf" +#define NID_dh_cofactor_kdf 947 + +#define SN_ct_precert_scts "ct_precert_scts" +#define LN_ct_precert_scts "CT Precertificate SCTs" +#define NID_ct_precert_scts 951 +#define OBJ_ct_precert_scts 1L,3L,6L,1L,4L,1L,11129L,2L,4L,2L + +#define SN_ct_precert_poison "ct_precert_poison" +#define LN_ct_precert_poison "CT Precertificate Poison" +#define NID_ct_precert_poison 952 +#define OBJ_ct_precert_poison 1L,3L,6L,1L,4L,1L,11129L,2L,4L,3L + +#define SN_ct_precert_signer "ct_precert_signer" +#define LN_ct_precert_signer "CT Precertificate Signer" +#define NID_ct_precert_signer 953 +#define OBJ_ct_precert_signer 1L,3L,6L,1L,4L,1L,11129L,2L,4L,4L + +#define SN_ct_cert_scts "ct_cert_scts" +#define LN_ct_cert_scts "CT Certificate SCTs" +#define NID_ct_cert_scts 954 +#define OBJ_ct_cert_scts 1L,3L,6L,1L,4L,1L,11129L,2L,4L,5L + +#define SN_jurisdictionLocalityName "jurisdictionL" +#define LN_jurisdictionLocalityName "jurisdictionLocalityName" +#define NID_jurisdictionLocalityName 955 +#define OBJ_jurisdictionLocalityName 1L,3L,6L,1L,4L,1L,311L,60L,2L,1L,1L + +#define SN_jurisdictionStateOrProvinceName "jurisdictionST" +#define LN_jurisdictionStateOrProvinceName "jurisdictionStateOrProvinceName" +#define NID_jurisdictionStateOrProvinceName 956 +#define OBJ_jurisdictionStateOrProvinceName 1L,3L,6L,1L,4L,1L,311L,60L,2L,1L,2L + +#define SN_jurisdictionCountryName "jurisdictionC" +#define LN_jurisdictionCountryName "jurisdictionCountryName" +#define NID_jurisdictionCountryName 957 +#define OBJ_jurisdictionCountryName 1L,3L,6L,1L,4L,1L,311L,60L,2L,1L,3L + +#define SN_id_scrypt "id-scrypt" +#define LN_id_scrypt "scrypt" +#define NID_id_scrypt 973 +#define OBJ_id_scrypt 1L,3L,6L,1L,4L,1L,11591L,4L,11L + +#define SN_tls1_prf "TLS1-PRF" +#define LN_tls1_prf "tls1-prf" +#define NID_tls1_prf 1021 + +#define SN_hkdf "HKDF" +#define LN_hkdf "hkdf" +#define NID_hkdf 1036 + +#define SN_id_pkinit "id-pkinit" +#define NID_id_pkinit 1031 +#define OBJ_id_pkinit 1L,3L,6L,1L,5L,2L,3L + +#define SN_pkInitClientAuth "pkInitClientAuth" +#define LN_pkInitClientAuth "PKINIT Client Auth" +#define NID_pkInitClientAuth 1032 +#define OBJ_pkInitClientAuth OBJ_id_pkinit,4L + +#define SN_pkInitKDC "pkInitKDC" +#define LN_pkInitKDC "Signing KDC Response" +#define NID_pkInitKDC 1033 +#define OBJ_pkInitKDC OBJ_id_pkinit,5L + +#define SN_X25519 "X25519" +#define NID_X25519 1034 +#define OBJ_X25519 1L,3L,101L,110L + +#define SN_X448 "X448" +#define NID_X448 1035 +#define OBJ_X448 1L,3L,101L,111L + +#define SN_ED25519 "ED25519" +#define NID_ED25519 1087 +#define OBJ_ED25519 1L,3L,101L,112L + +#define SN_ED448 "ED448" +#define NID_ED448 1088 +#define OBJ_ED448 1L,3L,101L,113L + +#define SN_kx_rsa "KxRSA" +#define LN_kx_rsa "kx-rsa" +#define NID_kx_rsa 1037 + +#define SN_kx_ecdhe "KxECDHE" +#define LN_kx_ecdhe "kx-ecdhe" +#define NID_kx_ecdhe 1038 + +#define SN_kx_dhe "KxDHE" +#define LN_kx_dhe "kx-dhe" +#define NID_kx_dhe 1039 + +#define SN_kx_ecdhe_psk "KxECDHE-PSK" +#define LN_kx_ecdhe_psk "kx-ecdhe-psk" +#define NID_kx_ecdhe_psk 1040 + +#define SN_kx_dhe_psk "KxDHE-PSK" +#define LN_kx_dhe_psk "kx-dhe-psk" +#define NID_kx_dhe_psk 1041 + +#define SN_kx_rsa_psk "KxRSA_PSK" +#define LN_kx_rsa_psk "kx-rsa-psk" +#define NID_kx_rsa_psk 1042 + +#define SN_kx_psk "KxPSK" +#define LN_kx_psk "kx-psk" +#define NID_kx_psk 1043 + +#define SN_kx_srp "KxSRP" +#define LN_kx_srp "kx-srp" +#define NID_kx_srp 1044 + +#define SN_kx_gost "KxGOST" +#define LN_kx_gost "kx-gost" +#define NID_kx_gost 1045 + +#define SN_kx_any "KxANY" +#define LN_kx_any "kx-any" +#define NID_kx_any 1063 + +#define SN_auth_rsa "AuthRSA" +#define LN_auth_rsa "auth-rsa" +#define NID_auth_rsa 1046 + +#define SN_auth_ecdsa "AuthECDSA" +#define LN_auth_ecdsa "auth-ecdsa" +#define NID_auth_ecdsa 1047 + +#define SN_auth_psk "AuthPSK" +#define LN_auth_psk "auth-psk" +#define NID_auth_psk 1048 + +#define SN_auth_dss "AuthDSS" +#define LN_auth_dss "auth-dss" +#define NID_auth_dss 1049 + +#define SN_auth_gost01 "AuthGOST01" +#define LN_auth_gost01 "auth-gost01" +#define NID_auth_gost01 1050 + +#define SN_auth_gost12 "AuthGOST12" +#define LN_auth_gost12 "auth-gost12" +#define NID_auth_gost12 1051 + +#define SN_auth_srp "AuthSRP" +#define LN_auth_srp "auth-srp" +#define NID_auth_srp 1052 + +#define SN_auth_null "AuthNULL" +#define LN_auth_null "auth-null" +#define NID_auth_null 1053 + +#define SN_auth_any "AuthANY" +#define LN_auth_any "auth-any" +#define NID_auth_any 1064 + +#define SN_poly1305 "Poly1305" +#define LN_poly1305 "poly1305" +#define NID_poly1305 1061 + +#define SN_siphash "SipHash" +#define LN_siphash "siphash" +#define NID_siphash 1062 + +#define SN_ffdhe2048 "ffdhe2048" +#define NID_ffdhe2048 1126 + +#define SN_ffdhe3072 "ffdhe3072" +#define NID_ffdhe3072 1127 + +#define SN_ffdhe4096 "ffdhe4096" +#define NID_ffdhe4096 1128 + +#define SN_ffdhe6144 "ffdhe6144" +#define NID_ffdhe6144 1129 + +#define SN_ffdhe8192 "ffdhe8192" +#define NID_ffdhe8192 1130 + +#define SN_ISO_UA "ISO-UA" +#define NID_ISO_UA 1150 +#define OBJ_ISO_UA OBJ_member_body,804L + +#define SN_ua_pki "ua-pki" +#define NID_ua_pki 1151 +#define OBJ_ua_pki OBJ_ISO_UA,2L,1L,1L,1L + +#define SN_dstu28147 "dstu28147" +#define LN_dstu28147 "DSTU Gost 28147-2009" +#define NID_dstu28147 1152 +#define OBJ_dstu28147 OBJ_ua_pki,1L,1L,1L + +#define SN_dstu28147_ofb "dstu28147-ofb" +#define LN_dstu28147_ofb "DSTU Gost 28147-2009 OFB mode" +#define NID_dstu28147_ofb 1153 +#define OBJ_dstu28147_ofb OBJ_dstu28147,2L + +#define SN_dstu28147_cfb "dstu28147-cfb" +#define LN_dstu28147_cfb "DSTU Gost 28147-2009 CFB mode" +#define NID_dstu28147_cfb 1154 +#define OBJ_dstu28147_cfb OBJ_dstu28147,3L + +#define SN_dstu28147_wrap "dstu28147-wrap" +#define LN_dstu28147_wrap "DSTU Gost 28147-2009 key wrap" +#define NID_dstu28147_wrap 1155 +#define OBJ_dstu28147_wrap OBJ_dstu28147,5L + +#define SN_hmacWithDstu34311 "hmacWithDstu34311" +#define LN_hmacWithDstu34311 "HMAC DSTU Gost 34311-95" +#define NID_hmacWithDstu34311 1156 +#define OBJ_hmacWithDstu34311 OBJ_ua_pki,1L,1L,2L + +#define SN_dstu34311 "dstu34311" +#define LN_dstu34311 "DSTU Gost 34311-95" +#define NID_dstu34311 1157 +#define OBJ_dstu34311 OBJ_ua_pki,1L,2L,1L + +#define SN_dstu4145le "dstu4145le" +#define LN_dstu4145le "DSTU 4145-2002 little endian" +#define NID_dstu4145le 1158 +#define OBJ_dstu4145le OBJ_ua_pki,1L,3L,1L,1L + +#define SN_dstu4145be "dstu4145be" +#define LN_dstu4145be "DSTU 4145-2002 big endian" +#define NID_dstu4145be 1159 +#define OBJ_dstu4145be OBJ_dstu4145le,1L,1L + +#define SN_uacurve0 "uacurve0" +#define LN_uacurve0 "DSTU curve 0" +#define NID_uacurve0 1160 +#define OBJ_uacurve0 OBJ_dstu4145le,2L,0L + +#define SN_uacurve1 "uacurve1" +#define LN_uacurve1 "DSTU curve 1" +#define NID_uacurve1 1161 +#define OBJ_uacurve1 OBJ_dstu4145le,2L,1L + +#define SN_uacurve2 "uacurve2" +#define LN_uacurve2 "DSTU curve 2" +#define NID_uacurve2 1162 +#define OBJ_uacurve2 OBJ_dstu4145le,2L,2L + +#define SN_uacurve3 "uacurve3" +#define LN_uacurve3 "DSTU curve 3" +#define NID_uacurve3 1163 +#define OBJ_uacurve3 OBJ_dstu4145le,2L,3L + +#define SN_uacurve4 "uacurve4" +#define LN_uacurve4 "DSTU curve 4" +#define NID_uacurve4 1164 +#define OBJ_uacurve4 OBJ_dstu4145le,2L,4L + +#define SN_uacurve5 "uacurve5" +#define LN_uacurve5 "DSTU curve 5" +#define NID_uacurve5 1165 +#define OBJ_uacurve5 OBJ_dstu4145le,2L,5L + +#define SN_uacurve6 "uacurve6" +#define LN_uacurve6 "DSTU curve 6" +#define NID_uacurve6 1166 +#define OBJ_uacurve6 OBJ_dstu4145le,2L,6L + +#define SN_uacurve7 "uacurve7" +#define LN_uacurve7 "DSTU curve 7" +#define NID_uacurve7 1167 +#define OBJ_uacurve7 OBJ_dstu4145le,2L,7L + +#define SN_uacurve8 "uacurve8" +#define LN_uacurve8 "DSTU curve 8" +#define NID_uacurve8 1168 +#define OBJ_uacurve8 OBJ_dstu4145le,2L,8L + +#define SN_uacurve9 "uacurve9" +#define LN_uacurve9 "DSTU curve 9" +#define NID_uacurve9 1169 +#define OBJ_uacurve9 OBJ_dstu4145le,2L,9L diff --git a/ONVIF/include/openssl/include/openssl/objects.h b/ONVIF/include/openssl/include/openssl/objects.h new file mode 100644 index 0000000..5e8b576 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/objects.h @@ -0,0 +1,175 @@ +/* + * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_OBJECTS_H +# define HEADER_OBJECTS_H + +# include +# include +# include +# include + +# define OBJ_NAME_TYPE_UNDEF 0x00 +# define OBJ_NAME_TYPE_MD_METH 0x01 +# define OBJ_NAME_TYPE_CIPHER_METH 0x02 +# define OBJ_NAME_TYPE_PKEY_METH 0x03 +# define OBJ_NAME_TYPE_COMP_METH 0x04 +# define OBJ_NAME_TYPE_NUM 0x05 + +# define OBJ_NAME_ALIAS 0x8000 + +# define OBJ_BSEARCH_VALUE_ON_NOMATCH 0x01 +# define OBJ_BSEARCH_FIRST_VALUE_ON_MATCH 0x02 + + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct obj_name_st { + int type; + int alias; + const char *name; + const char *data; +} OBJ_NAME; + +# define OBJ_create_and_add_object(a,b,c) OBJ_create(a,b,c) + +int OBJ_NAME_init(void); +int OBJ_NAME_new_index(unsigned long (*hash_func) (const char *), + int (*cmp_func) (const char *, const char *), + void (*free_func) (const char *, int, const char *)); +const char *OBJ_NAME_get(const char *name, int type); +int OBJ_NAME_add(const char *name, int type, const char *data); +int OBJ_NAME_remove(const char *name, int type); +void OBJ_NAME_cleanup(int type); /* -1 for everything */ +void OBJ_NAME_do_all(int type, void (*fn) (const OBJ_NAME *, void *arg), + void *arg); +void OBJ_NAME_do_all_sorted(int type, + void (*fn) (const OBJ_NAME *, void *arg), + void *arg); + +ASN1_OBJECT *OBJ_dup(const ASN1_OBJECT *o); +ASN1_OBJECT *OBJ_nid2obj(int n); +const char *OBJ_nid2ln(int n); +const char *OBJ_nid2sn(int n); +int OBJ_obj2nid(const ASN1_OBJECT *o); +ASN1_OBJECT *OBJ_txt2obj(const char *s, int no_name); +int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name); +int OBJ_txt2nid(const char *s); +int OBJ_ln2nid(const char *s); +int OBJ_sn2nid(const char *s); +int OBJ_cmp(const ASN1_OBJECT *a, const ASN1_OBJECT *b); +const void *OBJ_bsearch_(const void *key, const void *base, int num, int size, + int (*cmp) (const void *, const void *)); +const void *OBJ_bsearch_ex_(const void *key, const void *base, int num, + int size, + int (*cmp) (const void *, const void *), + int flags); + +# define _DECLARE_OBJ_BSEARCH_CMP_FN(scope, type1, type2, nm) \ + static int nm##_cmp_BSEARCH_CMP_FN(const void *, const void *); \ + static int nm##_cmp(type1 const *, type2 const *); \ + scope type2 * OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) + +# define DECLARE_OBJ_BSEARCH_CMP_FN(type1, type2, cmp) \ + _DECLARE_OBJ_BSEARCH_CMP_FN(static, type1, type2, cmp) +# define DECLARE_OBJ_BSEARCH_GLOBAL_CMP_FN(type1, type2, nm) \ + type2 * OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) + +/*- + * Unsolved problem: if a type is actually a pointer type, like + * nid_triple is, then its impossible to get a const where you need + * it. Consider: + * + * typedef int nid_triple[3]; + * const void *a_; + * const nid_triple const *a = a_; + * + * The assignment discards a const because what you really want is: + * + * const int const * const *a = a_; + * + * But if you do that, you lose the fact that a is an array of 3 ints, + * which breaks comparison functions. + * + * Thus we end up having to cast, sadly, or unpack the + * declarations. Or, as I finally did in this case, declare nid_triple + * to be a struct, which it should have been in the first place. + * + * Ben, August 2008. + * + * Also, strictly speaking not all types need be const, but handling + * the non-constness means a lot of complication, and in practice + * comparison routines do always not touch their arguments. + */ + +# define IMPLEMENT_OBJ_BSEARCH_CMP_FN(type1, type2, nm) \ + static int nm##_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_) \ + { \ + type1 const *a = a_; \ + type2 const *b = b_; \ + return nm##_cmp(a,b); \ + } \ + static type2 *OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) \ + { \ + return (type2 *)OBJ_bsearch_(key, base, num, sizeof(type2), \ + nm##_cmp_BSEARCH_CMP_FN); \ + } \ + extern void dummy_prototype(void) + +# define IMPLEMENT_OBJ_BSEARCH_GLOBAL_CMP_FN(type1, type2, nm) \ + static int nm##_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_) \ + { \ + type1 const *a = a_; \ + type2 const *b = b_; \ + return nm##_cmp(a,b); \ + } \ + type2 *OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) \ + { \ + return (type2 *)OBJ_bsearch_(key, base, num, sizeof(type2), \ + nm##_cmp_BSEARCH_CMP_FN); \ + } \ + extern void dummy_prototype(void) + +# define OBJ_bsearch(type1,key,type2,base,num,cmp) \ + ((type2 *)OBJ_bsearch_(CHECKED_PTR_OF(type1,key),CHECKED_PTR_OF(type2,base), \ + num,sizeof(type2), \ + ((void)CHECKED_PTR_OF(type1,cmp##_type_1), \ + (void)CHECKED_PTR_OF(type2,cmp##_type_2), \ + cmp##_BSEARCH_CMP_FN))) + +# define OBJ_bsearch_ex(type1,key,type2,base,num,cmp,flags) \ + ((type2 *)OBJ_bsearch_ex_(CHECKED_PTR_OF(type1,key),CHECKED_PTR_OF(type2,base), \ + num,sizeof(type2), \ + ((void)CHECKED_PTR_OF(type1,cmp##_type_1), \ + (void)type_2=CHECKED_PTR_OF(type2,cmp##_type_2), \ + cmp##_BSEARCH_CMP_FN)),flags) + +int OBJ_new_nid(int num); +int OBJ_add_object(const ASN1_OBJECT *obj); +int OBJ_create(const char *oid, const char *sn, const char *ln); +#if OPENSSL_API_COMPAT < 0x10100000L +# define OBJ_cleanup() while(0) continue +#endif +int OBJ_create_objects(BIO *in); + +size_t OBJ_length(const ASN1_OBJECT *obj); +const unsigned char *OBJ_get0_data(const ASN1_OBJECT *obj); + +int OBJ_find_sigid_algs(int signid, int *pdig_nid, int *ppkey_nid); +int OBJ_find_sigid_by_algs(int *psignid, int dig_nid, int pkey_nid); +int OBJ_add_sigid(int signid, int dig_id, int pkey_id); +void OBJ_sigid_free(void); + + +# ifdef __cplusplus +} +# endif +#endif diff --git a/ONVIF/include/openssl/include/openssl/objectserr.h b/ONVIF/include/openssl/include/openssl/objectserr.h new file mode 100644 index 0000000..02e166f --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/objectserr.h @@ -0,0 +1,42 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_OBJERR_H +# define HEADER_OBJERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_OBJ_strings(void); + +/* + * OBJ function codes. + */ +# define OBJ_F_OBJ_ADD_OBJECT 105 +# define OBJ_F_OBJ_ADD_SIGID 107 +# define OBJ_F_OBJ_CREATE 100 +# define OBJ_F_OBJ_DUP 101 +# define OBJ_F_OBJ_NAME_NEW_INDEX 106 +# define OBJ_F_OBJ_NID2LN 102 +# define OBJ_F_OBJ_NID2OBJ 103 +# define OBJ_F_OBJ_NID2SN 104 +# define OBJ_F_OBJ_TXT2OBJ 108 + +/* + * OBJ reason codes. + */ +# define OBJ_R_OID_EXISTS 102 +# define OBJ_R_UNKNOWN_NID 101 + +#endif diff --git a/ONVIF/include/openssl/include/openssl/ocsp.h b/ONVIF/include/openssl/include/openssl/ocsp.h new file mode 100644 index 0000000..4d759a4 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/ocsp.h @@ -0,0 +1,352 @@ +/* + * Copyright 2000-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_OCSP_H +# define HEADER_OCSP_H + +#include + +/* + * These definitions are outside the OPENSSL_NO_OCSP guard because although for + * historical reasons they have OCSP_* names, they can actually be used + * independently of OCSP. E.g. see RFC5280 + */ +/*- + * CRLReason ::= ENUMERATED { + * unspecified (0), + * keyCompromise (1), + * cACompromise (2), + * affiliationChanged (3), + * superseded (4), + * cessationOfOperation (5), + * certificateHold (6), + * removeFromCRL (8) } + */ +# define OCSP_REVOKED_STATUS_NOSTATUS -1 +# define OCSP_REVOKED_STATUS_UNSPECIFIED 0 +# define OCSP_REVOKED_STATUS_KEYCOMPROMISE 1 +# define OCSP_REVOKED_STATUS_CACOMPROMISE 2 +# define OCSP_REVOKED_STATUS_AFFILIATIONCHANGED 3 +# define OCSP_REVOKED_STATUS_SUPERSEDED 4 +# define OCSP_REVOKED_STATUS_CESSATIONOFOPERATION 5 +# define OCSP_REVOKED_STATUS_CERTIFICATEHOLD 6 +# define OCSP_REVOKED_STATUS_REMOVEFROMCRL 8 + + +# ifndef OPENSSL_NO_OCSP + +# include +# include +# include +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Various flags and values */ + +# define OCSP_DEFAULT_NONCE_LENGTH 16 + +# define OCSP_NOCERTS 0x1 +# define OCSP_NOINTERN 0x2 +# define OCSP_NOSIGS 0x4 +# define OCSP_NOCHAIN 0x8 +# define OCSP_NOVERIFY 0x10 +# define OCSP_NOEXPLICIT 0x20 +# define OCSP_NOCASIGN 0x40 +# define OCSP_NODELEGATED 0x80 +# define OCSP_NOCHECKS 0x100 +# define OCSP_TRUSTOTHER 0x200 +# define OCSP_RESPID_KEY 0x400 +# define OCSP_NOTIME 0x800 + +typedef struct ocsp_cert_id_st OCSP_CERTID; + +DEFINE_STACK_OF(OCSP_CERTID) + +typedef struct ocsp_one_request_st OCSP_ONEREQ; + +DEFINE_STACK_OF(OCSP_ONEREQ) + +typedef struct ocsp_req_info_st OCSP_REQINFO; +typedef struct ocsp_signature_st OCSP_SIGNATURE; +typedef struct ocsp_request_st OCSP_REQUEST; + +# define OCSP_RESPONSE_STATUS_SUCCESSFUL 0 +# define OCSP_RESPONSE_STATUS_MALFORMEDREQUEST 1 +# define OCSP_RESPONSE_STATUS_INTERNALERROR 2 +# define OCSP_RESPONSE_STATUS_TRYLATER 3 +# define OCSP_RESPONSE_STATUS_SIGREQUIRED 5 +# define OCSP_RESPONSE_STATUS_UNAUTHORIZED 6 + +typedef struct ocsp_resp_bytes_st OCSP_RESPBYTES; + +# define V_OCSP_RESPID_NAME 0 +# define V_OCSP_RESPID_KEY 1 + +DEFINE_STACK_OF(OCSP_RESPID) + +typedef struct ocsp_revoked_info_st OCSP_REVOKEDINFO; + +# define V_OCSP_CERTSTATUS_GOOD 0 +# define V_OCSP_CERTSTATUS_REVOKED 1 +# define V_OCSP_CERTSTATUS_UNKNOWN 2 + +typedef struct ocsp_cert_status_st OCSP_CERTSTATUS; +typedef struct ocsp_single_response_st OCSP_SINGLERESP; + +DEFINE_STACK_OF(OCSP_SINGLERESP) + +typedef struct ocsp_response_data_st OCSP_RESPDATA; + +typedef struct ocsp_basic_response_st OCSP_BASICRESP; + +typedef struct ocsp_crl_id_st OCSP_CRLID; +typedef struct ocsp_service_locator_st OCSP_SERVICELOC; + +# define PEM_STRING_OCSP_REQUEST "OCSP REQUEST" +# define PEM_STRING_OCSP_RESPONSE "OCSP RESPONSE" + +# define d2i_OCSP_REQUEST_bio(bp,p) ASN1_d2i_bio_of(OCSP_REQUEST,OCSP_REQUEST_new,d2i_OCSP_REQUEST,bp,p) + +# define d2i_OCSP_RESPONSE_bio(bp,p) ASN1_d2i_bio_of(OCSP_RESPONSE,OCSP_RESPONSE_new,d2i_OCSP_RESPONSE,bp,p) + +# define PEM_read_bio_OCSP_REQUEST(bp,x,cb) (OCSP_REQUEST *)PEM_ASN1_read_bio( \ + (char *(*)())d2i_OCSP_REQUEST,PEM_STRING_OCSP_REQUEST, \ + bp,(char **)(x),cb,NULL) + +# define PEM_read_bio_OCSP_RESPONSE(bp,x,cb) (OCSP_RESPONSE *)PEM_ASN1_read_bio(\ + (char *(*)())d2i_OCSP_RESPONSE,PEM_STRING_OCSP_RESPONSE, \ + bp,(char **)(x),cb,NULL) + +# define PEM_write_bio_OCSP_REQUEST(bp,o) \ + PEM_ASN1_write_bio((int (*)())i2d_OCSP_REQUEST,PEM_STRING_OCSP_REQUEST,\ + bp,(char *)(o), NULL,NULL,0,NULL,NULL) + +# define PEM_write_bio_OCSP_RESPONSE(bp,o) \ + PEM_ASN1_write_bio((int (*)())i2d_OCSP_RESPONSE,PEM_STRING_OCSP_RESPONSE,\ + bp,(char *)(o), NULL,NULL,0,NULL,NULL) + +# define i2d_OCSP_RESPONSE_bio(bp,o) ASN1_i2d_bio_of(OCSP_RESPONSE,i2d_OCSP_RESPONSE,bp,o) + +# define i2d_OCSP_REQUEST_bio(bp,o) ASN1_i2d_bio_of(OCSP_REQUEST,i2d_OCSP_REQUEST,bp,o) + +# define ASN1_BIT_STRING_digest(data,type,md,len) \ + ASN1_item_digest(ASN1_ITEM_rptr(ASN1_BIT_STRING),type,data,md,len) + +# define OCSP_CERTSTATUS_dup(cs)\ + (OCSP_CERTSTATUS*)ASN1_dup((int(*)())i2d_OCSP_CERTSTATUS,\ + (char *(*)())d2i_OCSP_CERTSTATUS,(char *)(cs)) + +OCSP_CERTID *OCSP_CERTID_dup(OCSP_CERTID *id); + +OCSP_RESPONSE *OCSP_sendreq_bio(BIO *b, const char *path, OCSP_REQUEST *req); +OCSP_REQ_CTX *OCSP_sendreq_new(BIO *io, const char *path, OCSP_REQUEST *req, + int maxline); +int OCSP_REQ_CTX_nbio(OCSP_REQ_CTX *rctx); +int OCSP_sendreq_nbio(OCSP_RESPONSE **presp, OCSP_REQ_CTX *rctx); +OCSP_REQ_CTX *OCSP_REQ_CTX_new(BIO *io, int maxline); +void OCSP_REQ_CTX_free(OCSP_REQ_CTX *rctx); +void OCSP_set_max_response_length(OCSP_REQ_CTX *rctx, unsigned long len); +int OCSP_REQ_CTX_i2d(OCSP_REQ_CTX *rctx, const ASN1_ITEM *it, + ASN1_VALUE *val); +int OCSP_REQ_CTX_nbio_d2i(OCSP_REQ_CTX *rctx, ASN1_VALUE **pval, + const ASN1_ITEM *it); +BIO *OCSP_REQ_CTX_get0_mem_bio(OCSP_REQ_CTX *rctx); +int OCSP_REQ_CTX_http(OCSP_REQ_CTX *rctx, const char *op, const char *path); +int OCSP_REQ_CTX_set1_req(OCSP_REQ_CTX *rctx, OCSP_REQUEST *req); +int OCSP_REQ_CTX_add1_header(OCSP_REQ_CTX *rctx, + const char *name, const char *value); + +OCSP_CERTID *OCSP_cert_to_id(const EVP_MD *dgst, const X509 *subject, + const X509 *issuer); + +OCSP_CERTID *OCSP_cert_id_new(const EVP_MD *dgst, + const X509_NAME *issuerName, + const ASN1_BIT_STRING *issuerKey, + const ASN1_INTEGER *serialNumber); + +OCSP_ONEREQ *OCSP_request_add0_id(OCSP_REQUEST *req, OCSP_CERTID *cid); + +int OCSP_request_add1_nonce(OCSP_REQUEST *req, unsigned char *val, int len); +int OCSP_basic_add1_nonce(OCSP_BASICRESP *resp, unsigned char *val, int len); +int OCSP_check_nonce(OCSP_REQUEST *req, OCSP_BASICRESP *bs); +int OCSP_copy_nonce(OCSP_BASICRESP *resp, OCSP_REQUEST *req); + +int OCSP_request_set1_name(OCSP_REQUEST *req, X509_NAME *nm); +int OCSP_request_add1_cert(OCSP_REQUEST *req, X509 *cert); + +int OCSP_request_sign(OCSP_REQUEST *req, + X509 *signer, + EVP_PKEY *key, + const EVP_MD *dgst, + STACK_OF(X509) *certs, unsigned long flags); + +int OCSP_response_status(OCSP_RESPONSE *resp); +OCSP_BASICRESP *OCSP_response_get1_basic(OCSP_RESPONSE *resp); + +const ASN1_OCTET_STRING *OCSP_resp_get0_signature(const OCSP_BASICRESP *bs); +const X509_ALGOR *OCSP_resp_get0_tbs_sigalg(const OCSP_BASICRESP *bs); +const OCSP_RESPDATA *OCSP_resp_get0_respdata(const OCSP_BASICRESP *bs); +int OCSP_resp_get0_signer(OCSP_BASICRESP *bs, X509 **signer, + STACK_OF(X509) *extra_certs); + +int OCSP_resp_count(OCSP_BASICRESP *bs); +OCSP_SINGLERESP *OCSP_resp_get0(OCSP_BASICRESP *bs, int idx); +const ASN1_GENERALIZEDTIME *OCSP_resp_get0_produced_at(const OCSP_BASICRESP* bs); +const STACK_OF(X509) *OCSP_resp_get0_certs(const OCSP_BASICRESP *bs); +int OCSP_resp_get0_id(const OCSP_BASICRESP *bs, + const ASN1_OCTET_STRING **pid, + const X509_NAME **pname); +int OCSP_resp_get1_id(const OCSP_BASICRESP *bs, + ASN1_OCTET_STRING **pid, + X509_NAME **pname); + +int OCSP_resp_find(OCSP_BASICRESP *bs, OCSP_CERTID *id, int last); +int OCSP_single_get0_status(OCSP_SINGLERESP *single, int *reason, + ASN1_GENERALIZEDTIME **revtime, + ASN1_GENERALIZEDTIME **thisupd, + ASN1_GENERALIZEDTIME **nextupd); +int OCSP_resp_find_status(OCSP_BASICRESP *bs, OCSP_CERTID *id, int *status, + int *reason, + ASN1_GENERALIZEDTIME **revtime, + ASN1_GENERALIZEDTIME **thisupd, + ASN1_GENERALIZEDTIME **nextupd); +int OCSP_check_validity(ASN1_GENERALIZEDTIME *thisupd, + ASN1_GENERALIZEDTIME *nextupd, long sec, long maxsec); + +int OCSP_request_verify(OCSP_REQUEST *req, STACK_OF(X509) *certs, + X509_STORE *store, unsigned long flags); + +int OCSP_parse_url(const char *url, char **phost, char **pport, char **ppath, + int *pssl); + +int OCSP_id_issuer_cmp(const OCSP_CERTID *a, const OCSP_CERTID *b); +int OCSP_id_cmp(const OCSP_CERTID *a, const OCSP_CERTID *b); + +int OCSP_request_onereq_count(OCSP_REQUEST *req); +OCSP_ONEREQ *OCSP_request_onereq_get0(OCSP_REQUEST *req, int i); +OCSP_CERTID *OCSP_onereq_get0_id(OCSP_ONEREQ *one); +int OCSP_id_get0_info(ASN1_OCTET_STRING **piNameHash, ASN1_OBJECT **pmd, + ASN1_OCTET_STRING **pikeyHash, + ASN1_INTEGER **pserial, OCSP_CERTID *cid); +int OCSP_request_is_signed(OCSP_REQUEST *req); +OCSP_RESPONSE *OCSP_response_create(int status, OCSP_BASICRESP *bs); +OCSP_SINGLERESP *OCSP_basic_add1_status(OCSP_BASICRESP *rsp, + OCSP_CERTID *cid, + int status, int reason, + ASN1_TIME *revtime, + ASN1_TIME *thisupd, + ASN1_TIME *nextupd); +int OCSP_basic_add1_cert(OCSP_BASICRESP *resp, X509 *cert); +int OCSP_basic_sign(OCSP_BASICRESP *brsp, + X509 *signer, EVP_PKEY *key, const EVP_MD *dgst, + STACK_OF(X509) *certs, unsigned long flags); +int OCSP_basic_sign_ctx(OCSP_BASICRESP *brsp, + X509 *signer, EVP_MD_CTX *ctx, + STACK_OF(X509) *certs, unsigned long flags); +int OCSP_RESPID_set_by_name(OCSP_RESPID *respid, X509 *cert); +int OCSP_RESPID_set_by_key(OCSP_RESPID *respid, X509 *cert); +int OCSP_RESPID_match(OCSP_RESPID *respid, X509 *cert); + +X509_EXTENSION *OCSP_crlID_new(const char *url, long *n, char *tim); + +X509_EXTENSION *OCSP_accept_responses_new(char **oids); + +X509_EXTENSION *OCSP_archive_cutoff_new(char *tim); + +X509_EXTENSION *OCSP_url_svcloc_new(X509_NAME *issuer, const char **urls); + +int OCSP_REQUEST_get_ext_count(OCSP_REQUEST *x); +int OCSP_REQUEST_get_ext_by_NID(OCSP_REQUEST *x, int nid, int lastpos); +int OCSP_REQUEST_get_ext_by_OBJ(OCSP_REQUEST *x, const ASN1_OBJECT *obj, + int lastpos); +int OCSP_REQUEST_get_ext_by_critical(OCSP_REQUEST *x, int crit, int lastpos); +X509_EXTENSION *OCSP_REQUEST_get_ext(OCSP_REQUEST *x, int loc); +X509_EXTENSION *OCSP_REQUEST_delete_ext(OCSP_REQUEST *x, int loc); +void *OCSP_REQUEST_get1_ext_d2i(OCSP_REQUEST *x, int nid, int *crit, + int *idx); +int OCSP_REQUEST_add1_ext_i2d(OCSP_REQUEST *x, int nid, void *value, int crit, + unsigned long flags); +int OCSP_REQUEST_add_ext(OCSP_REQUEST *x, X509_EXTENSION *ex, int loc); + +int OCSP_ONEREQ_get_ext_count(OCSP_ONEREQ *x); +int OCSP_ONEREQ_get_ext_by_NID(OCSP_ONEREQ *x, int nid, int lastpos); +int OCSP_ONEREQ_get_ext_by_OBJ(OCSP_ONEREQ *x, const ASN1_OBJECT *obj, int lastpos); +int OCSP_ONEREQ_get_ext_by_critical(OCSP_ONEREQ *x, int crit, int lastpos); +X509_EXTENSION *OCSP_ONEREQ_get_ext(OCSP_ONEREQ *x, int loc); +X509_EXTENSION *OCSP_ONEREQ_delete_ext(OCSP_ONEREQ *x, int loc); +void *OCSP_ONEREQ_get1_ext_d2i(OCSP_ONEREQ *x, int nid, int *crit, int *idx); +int OCSP_ONEREQ_add1_ext_i2d(OCSP_ONEREQ *x, int nid, void *value, int crit, + unsigned long flags); +int OCSP_ONEREQ_add_ext(OCSP_ONEREQ *x, X509_EXTENSION *ex, int loc); + +int OCSP_BASICRESP_get_ext_count(OCSP_BASICRESP *x); +int OCSP_BASICRESP_get_ext_by_NID(OCSP_BASICRESP *x, int nid, int lastpos); +int OCSP_BASICRESP_get_ext_by_OBJ(OCSP_BASICRESP *x, const ASN1_OBJECT *obj, + int lastpos); +int OCSP_BASICRESP_get_ext_by_critical(OCSP_BASICRESP *x, int crit, + int lastpos); +X509_EXTENSION *OCSP_BASICRESP_get_ext(OCSP_BASICRESP *x, int loc); +X509_EXTENSION *OCSP_BASICRESP_delete_ext(OCSP_BASICRESP *x, int loc); +void *OCSP_BASICRESP_get1_ext_d2i(OCSP_BASICRESP *x, int nid, int *crit, + int *idx); +int OCSP_BASICRESP_add1_ext_i2d(OCSP_BASICRESP *x, int nid, void *value, + int crit, unsigned long flags); +int OCSP_BASICRESP_add_ext(OCSP_BASICRESP *x, X509_EXTENSION *ex, int loc); + +int OCSP_SINGLERESP_get_ext_count(OCSP_SINGLERESP *x); +int OCSP_SINGLERESP_get_ext_by_NID(OCSP_SINGLERESP *x, int nid, int lastpos); +int OCSP_SINGLERESP_get_ext_by_OBJ(OCSP_SINGLERESP *x, const ASN1_OBJECT *obj, + int lastpos); +int OCSP_SINGLERESP_get_ext_by_critical(OCSP_SINGLERESP *x, int crit, + int lastpos); +X509_EXTENSION *OCSP_SINGLERESP_get_ext(OCSP_SINGLERESP *x, int loc); +X509_EXTENSION *OCSP_SINGLERESP_delete_ext(OCSP_SINGLERESP *x, int loc); +void *OCSP_SINGLERESP_get1_ext_d2i(OCSP_SINGLERESP *x, int nid, int *crit, + int *idx); +int OCSP_SINGLERESP_add1_ext_i2d(OCSP_SINGLERESP *x, int nid, void *value, + int crit, unsigned long flags); +int OCSP_SINGLERESP_add_ext(OCSP_SINGLERESP *x, X509_EXTENSION *ex, int loc); +const OCSP_CERTID *OCSP_SINGLERESP_get0_id(const OCSP_SINGLERESP *x); + +DECLARE_ASN1_FUNCTIONS(OCSP_SINGLERESP) +DECLARE_ASN1_FUNCTIONS(OCSP_CERTSTATUS) +DECLARE_ASN1_FUNCTIONS(OCSP_REVOKEDINFO) +DECLARE_ASN1_FUNCTIONS(OCSP_BASICRESP) +DECLARE_ASN1_FUNCTIONS(OCSP_RESPDATA) +DECLARE_ASN1_FUNCTIONS(OCSP_RESPID) +DECLARE_ASN1_FUNCTIONS(OCSP_RESPONSE) +DECLARE_ASN1_FUNCTIONS(OCSP_RESPBYTES) +DECLARE_ASN1_FUNCTIONS(OCSP_ONEREQ) +DECLARE_ASN1_FUNCTIONS(OCSP_CERTID) +DECLARE_ASN1_FUNCTIONS(OCSP_REQUEST) +DECLARE_ASN1_FUNCTIONS(OCSP_SIGNATURE) +DECLARE_ASN1_FUNCTIONS(OCSP_REQINFO) +DECLARE_ASN1_FUNCTIONS(OCSP_CRLID) +DECLARE_ASN1_FUNCTIONS(OCSP_SERVICELOC) + +const char *OCSP_response_status_str(long s); +const char *OCSP_cert_status_str(long s); +const char *OCSP_crl_reason_str(long s); + +int OCSP_REQUEST_print(BIO *bp, OCSP_REQUEST *a, unsigned long flags); +int OCSP_RESPONSE_print(BIO *bp, OCSP_RESPONSE *o, unsigned long flags); + +int OCSP_basic_verify(OCSP_BASICRESP *bs, STACK_OF(X509) *certs, + X509_STORE *st, unsigned long flags); + + +# ifdef __cplusplus +} +# endif +# endif +#endif diff --git a/ONVIF/include/openssl/include/openssl/ocsperr.h b/ONVIF/include/openssl/include/openssl/ocsperr.h new file mode 100644 index 0000000..8dd9e01 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/ocsperr.h @@ -0,0 +1,78 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_OCSPERR_H +# define HEADER_OCSPERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# include + +# ifndef OPENSSL_NO_OCSP + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_OCSP_strings(void); + +/* + * OCSP function codes. + */ +# define OCSP_F_D2I_OCSP_NONCE 102 +# define OCSP_F_OCSP_BASIC_ADD1_STATUS 103 +# define OCSP_F_OCSP_BASIC_SIGN 104 +# define OCSP_F_OCSP_BASIC_SIGN_CTX 119 +# define OCSP_F_OCSP_BASIC_VERIFY 105 +# define OCSP_F_OCSP_CERT_ID_NEW 101 +# define OCSP_F_OCSP_CHECK_DELEGATED 106 +# define OCSP_F_OCSP_CHECK_IDS 107 +# define OCSP_F_OCSP_CHECK_ISSUER 108 +# define OCSP_F_OCSP_CHECK_VALIDITY 115 +# define OCSP_F_OCSP_MATCH_ISSUERID 109 +# define OCSP_F_OCSP_PARSE_URL 114 +# define OCSP_F_OCSP_REQUEST_SIGN 110 +# define OCSP_F_OCSP_REQUEST_VERIFY 116 +# define OCSP_F_OCSP_RESPONSE_GET1_BASIC 111 +# define OCSP_F_PARSE_HTTP_LINE1 118 + +/* + * OCSP reason codes. + */ +# define OCSP_R_CERTIFICATE_VERIFY_ERROR 101 +# define OCSP_R_DIGEST_ERR 102 +# define OCSP_R_ERROR_IN_NEXTUPDATE_FIELD 122 +# define OCSP_R_ERROR_IN_THISUPDATE_FIELD 123 +# define OCSP_R_ERROR_PARSING_URL 121 +# define OCSP_R_MISSING_OCSPSIGNING_USAGE 103 +# define OCSP_R_NEXTUPDATE_BEFORE_THISUPDATE 124 +# define OCSP_R_NOT_BASIC_RESPONSE 104 +# define OCSP_R_NO_CERTIFICATES_IN_CHAIN 105 +# define OCSP_R_NO_RESPONSE_DATA 108 +# define OCSP_R_NO_REVOKED_TIME 109 +# define OCSP_R_NO_SIGNER_KEY 130 +# define OCSP_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 110 +# define OCSP_R_REQUEST_NOT_SIGNED 128 +# define OCSP_R_RESPONSE_CONTAINS_NO_REVOCATION_DATA 111 +# define OCSP_R_ROOT_CA_NOT_TRUSTED 112 +# define OCSP_R_SERVER_RESPONSE_ERROR 114 +# define OCSP_R_SERVER_RESPONSE_PARSE_ERROR 115 +# define OCSP_R_SIGNATURE_FAILURE 117 +# define OCSP_R_SIGNER_CERTIFICATE_NOT_FOUND 118 +# define OCSP_R_STATUS_EXPIRED 125 +# define OCSP_R_STATUS_NOT_YET_VALID 126 +# define OCSP_R_STATUS_TOO_OLD 127 +# define OCSP_R_UNKNOWN_MESSAGE_DIGEST 119 +# define OCSP_R_UNKNOWN_NID 120 +# define OCSP_R_UNSUPPORTED_REQUESTORNAME_TYPE 129 + +# endif +#endif diff --git a/ONVIF/include/openssl/include/openssl/opensslconf.h b/ONVIF/include/openssl/include/openssl/opensslconf.h new file mode 100644 index 0000000..942b46d --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/opensslconf.h @@ -0,0 +1,195 @@ +/* + * WARNING: do not edit! + * Generated by Makefile from include/openssl/opensslconf.h.in + * + * Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef OPENSSL_ALGORITHM_DEFINES +# error OPENSSL_ALGORITHM_DEFINES no longer supported +#endif + +/* + * OpenSSL was configured with the following options: + */ + +#ifndef OPENSSL_NO_MD2 +# define OPENSSL_NO_MD2 +#endif +#ifndef OPENSSL_NO_RC5 +# define OPENSSL_NO_RC5 +#endif +#ifndef OPENSSL_THREADS +# define OPENSSL_THREADS +#endif +#ifndef OPENSSL_RAND_SEED_OS +# define OPENSSL_RAND_SEED_OS +#endif +#ifndef OPENSSL_NO_AFALGENG +# define OPENSSL_NO_AFALGENG +#endif +#ifndef OPENSSL_NO_ASAN +# define OPENSSL_NO_ASAN +#endif +#ifndef OPENSSL_NO_CRYPTO_MDEBUG +# define OPENSSL_NO_CRYPTO_MDEBUG +#endif +#ifndef OPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE +# define OPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE +#endif +#ifndef OPENSSL_NO_DEVCRYPTOENG +# define OPENSSL_NO_DEVCRYPTOENG +#endif +#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128 +# define OPENSSL_NO_EC_NISTP_64_GCC_128 +#endif +#ifndef OPENSSL_NO_EGD +# define OPENSSL_NO_EGD +#endif +#ifndef OPENSSL_NO_EXTERNAL_TESTS +# define OPENSSL_NO_EXTERNAL_TESTS +#endif +#ifndef OPENSSL_NO_FUZZ_AFL +# define OPENSSL_NO_FUZZ_AFL +#endif +#ifndef OPENSSL_NO_FUZZ_LIBFUZZER +# define OPENSSL_NO_FUZZ_LIBFUZZER +#endif +#ifndef OPENSSL_NO_HEARTBEATS +# define OPENSSL_NO_HEARTBEATS +#endif +#ifndef OPENSSL_NO_MSAN +# define OPENSSL_NO_MSAN +#endif +#ifndef OPENSSL_NO_SCTP +# define OPENSSL_NO_SCTP +#endif +#ifndef OPENSSL_NO_SSL_TRACE +# define OPENSSL_NO_SSL_TRACE +#endif +#ifndef OPENSSL_NO_SSL3 +# define OPENSSL_NO_SSL3 +#endif +#ifndef OPENSSL_NO_SSL3_METHOD +# define OPENSSL_NO_SSL3_METHOD +#endif +#ifndef OPENSSL_NO_UBSAN +# define OPENSSL_NO_UBSAN +#endif +#ifndef OPENSSL_NO_UNIT_TEST +# define OPENSSL_NO_UNIT_TEST +#endif +#ifndef OPENSSL_NO_WEAK_SSL_CIPHERS +# define OPENSSL_NO_WEAK_SSL_CIPHERS +#endif +#ifndef OPENSSL_NO_STATIC_ENGINE +# define OPENSSL_NO_STATIC_ENGINE +#endif + + +/* + * Sometimes OPENSSSL_NO_xxx ends up with an empty file and some compilers + * don't like that. This will hopefully silence them. + */ +#define NON_EMPTY_TRANSLATION_UNIT static void *dummy = &dummy; + +/* + * Applications should use -DOPENSSL_API_COMPAT= to suppress the + * declarations of functions deprecated in or before . Otherwise, they + * still won't see them if the library has been built to disable deprecated + * functions. + */ +#ifndef DECLARE_DEPRECATED +# define DECLARE_DEPRECATED(f) f; +# ifdef __GNUC__ +# if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 0) +# undef DECLARE_DEPRECATED +# define DECLARE_DEPRECATED(f) f __attribute__ ((deprecated)); +# endif +# endif +#endif + +#ifndef OPENSSL_FILE +# ifdef OPENSSL_NO_FILENAMES +# define OPENSSL_FILE "" +# define OPENSSL_LINE 0 +# else +# define OPENSSL_FILE __FILE__ +# define OPENSSL_LINE __LINE__ +# endif +#endif + +#ifndef OPENSSL_MIN_API +# define OPENSSL_MIN_API 0 +#endif + +#if !defined(OPENSSL_API_COMPAT) || OPENSSL_API_COMPAT < OPENSSL_MIN_API +# undef OPENSSL_API_COMPAT +# define OPENSSL_API_COMPAT OPENSSL_MIN_API +#endif + +/* + * Do not deprecate things to be deprecated in version 1.2.0 before the + * OpenSSL version number matches. + */ +#if OPENSSL_VERSION_NUMBER < 0x10200000L +# define DEPRECATEDIN_1_2_0(f) f; +#elif OPENSSL_API_COMPAT < 0x10200000L +# define DEPRECATEDIN_1_2_0(f) DECLARE_DEPRECATED(f) +#else +# define DEPRECATEDIN_1_2_0(f) +#endif + +#if OPENSSL_API_COMPAT < 0x10100000L +# define DEPRECATEDIN_1_1_0(f) DECLARE_DEPRECATED(f) +#else +# define DEPRECATEDIN_1_1_0(f) +#endif + +#if OPENSSL_API_COMPAT < 0x10000000L +# define DEPRECATEDIN_1_0_0(f) DECLARE_DEPRECATED(f) +#else +# define DEPRECATEDIN_1_0_0(f) +#endif + +#if OPENSSL_API_COMPAT < 0x00908000L +# define DEPRECATEDIN_0_9_8(f) DECLARE_DEPRECATED(f) +#else +# define DEPRECATEDIN_0_9_8(f) +#endif + +/* Generate 80386 code? */ +#undef I386_ONLY + +#undef OPENSSL_UNISTD +#define OPENSSL_UNISTD + +#undef OPENSSL_EXPORT_VAR_AS_FUNCTION + +/* + * The following are cipher-specific, but are part of the public API. + */ +#if !defined(OPENSSL_SYS_UEFI) +# undef BN_LLONG +/* Only one for the following should be defined */ +# define SIXTY_FOUR_BIT_LONG +# undef SIXTY_FOUR_BIT +# undef THIRTY_TWO_BIT +#endif + +#define RC4_INT unsigned int + +#ifdef __cplusplus +} +#endif diff --git a/ONVIF/include/openssl/include/openssl/opensslv.h b/ONVIF/include/openssl/include/openssl/opensslv.h new file mode 100644 index 0000000..17d271f --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/opensslv.h @@ -0,0 +1,101 @@ +/* + * Copyright 1999-2020 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_OPENSSLV_H +# define HEADER_OPENSSLV_H + +#ifdef __cplusplus +extern "C" { +#endif + +/*- + * Numeric release version identifier: + * MNNFFPPS: major minor fix patch status + * The status nibble has one of the values 0 for development, 1 to e for betas + * 1 to 14, and f for release. The patch level is exactly that. + * For example: + * 0.9.3-dev 0x00903000 + * 0.9.3-beta1 0x00903001 + * 0.9.3-beta2-dev 0x00903002 + * 0.9.3-beta2 0x00903002 (same as ...beta2-dev) + * 0.9.3 0x0090300f + * 0.9.3a 0x0090301f + * 0.9.4 0x0090400f + * 1.2.3z 0x102031af + * + * For continuity reasons (because 0.9.5 is already out, and is coded + * 0x00905100), between 0.9.5 and 0.9.6 the coding of the patch level + * part is slightly different, by setting the highest bit. This means + * that 0.9.5a looks like this: 0x0090581f. At 0.9.6, we can start + * with 0x0090600S... + * + * (Prior to 0.9.3-dev a different scheme was used: 0.9.2b is 0x0922.) + * (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for + * major minor fix final patch/beta) + */ +# define OPENSSL_VERSION_NUMBER 0x1010107fL +# define OPENSSL_VERSION_TEXT "OpenSSL 1.1.1g 21 Apr 2020" + +/*- + * The macros below are to be used for shared library (.so, .dll, ...) + * versioning. That kind of versioning works a bit differently between + * operating systems. The most usual scheme is to set a major and a minor + * number, and have the runtime loader check that the major number is equal + * to what it was at application link time, while the minor number has to + * be greater or equal to what it was at application link time. With this + * scheme, the version number is usually part of the file name, like this: + * + * libcrypto.so.0.9 + * + * Some unixen also make a softlink with the major version number only: + * + * libcrypto.so.0 + * + * On Tru64 and IRIX 6.x it works a little bit differently. There, the + * shared library version is stored in the file, and is actually a series + * of versions, separated by colons. The rightmost version present in the + * library when linking an application is stored in the application to be + * matched at run time. When the application is run, a check is done to + * see if the library version stored in the application matches any of the + * versions in the version string of the library itself. + * This version string can be constructed in any way, depending on what + * kind of matching is desired. However, to implement the same scheme as + * the one used in the other unixen, all compatible versions, from lowest + * to highest, should be part of the string. Consecutive builds would + * give the following versions strings: + * + * 3.0 + * 3.0:3.1 + * 3.0:3.1:3.2 + * 4.0 + * 4.0:4.1 + * + * Notice how version 4 is completely incompatible with version, and + * therefore give the breach you can see. + * + * There may be other schemes as well that I haven't yet discovered. + * + * So, here's the way it works here: first of all, the library version + * number doesn't need at all to match the overall OpenSSL version. + * However, it's nice and more understandable if it actually does. + * The current library version is stored in the macro SHLIB_VERSION_NUMBER, + * which is just a piece of text in the format "M.m.e" (Major, minor, edit). + * For the sake of Tru64, IRIX, and any other OS that behaves in similar ways, + * we need to keep a history of version numbers, which is done in the + * macro SHLIB_VERSION_HISTORY. The numbers are separated by colons and + * should only keep the versions that are binary compatible with the current. + */ +# define SHLIB_VERSION_HISTORY "" +# define SHLIB_VERSION_NUMBER "1.1" + + +#ifdef __cplusplus +} +#endif +#endif /* HEADER_OPENSSLV_H */ diff --git a/ONVIF/include/openssl/include/openssl/ossl_typ.h b/ONVIF/include/openssl/include/openssl/ossl_typ.h new file mode 100644 index 0000000..e0edfaa --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/ossl_typ.h @@ -0,0 +1,197 @@ +/* + * Copyright 2001-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_OPENSSL_TYPES_H +# define HEADER_OPENSSL_TYPES_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +# include + +# ifdef NO_ASN1_TYPEDEFS +# define ASN1_INTEGER ASN1_STRING +# define ASN1_ENUMERATED ASN1_STRING +# define ASN1_BIT_STRING ASN1_STRING +# define ASN1_OCTET_STRING ASN1_STRING +# define ASN1_PRINTABLESTRING ASN1_STRING +# define ASN1_T61STRING ASN1_STRING +# define ASN1_IA5STRING ASN1_STRING +# define ASN1_UTCTIME ASN1_STRING +# define ASN1_GENERALIZEDTIME ASN1_STRING +# define ASN1_TIME ASN1_STRING +# define ASN1_GENERALSTRING ASN1_STRING +# define ASN1_UNIVERSALSTRING ASN1_STRING +# define ASN1_BMPSTRING ASN1_STRING +# define ASN1_VISIBLESTRING ASN1_STRING +# define ASN1_UTF8STRING ASN1_STRING +# define ASN1_BOOLEAN int +# define ASN1_NULL int +# else +typedef struct asn1_string_st ASN1_INTEGER; +typedef struct asn1_string_st ASN1_ENUMERATED; +typedef struct asn1_string_st ASN1_BIT_STRING; +typedef struct asn1_string_st ASN1_OCTET_STRING; +typedef struct asn1_string_st ASN1_PRINTABLESTRING; +typedef struct asn1_string_st ASN1_T61STRING; +typedef struct asn1_string_st ASN1_IA5STRING; +typedef struct asn1_string_st ASN1_GENERALSTRING; +typedef struct asn1_string_st ASN1_UNIVERSALSTRING; +typedef struct asn1_string_st ASN1_BMPSTRING; +typedef struct asn1_string_st ASN1_UTCTIME; +typedef struct asn1_string_st ASN1_TIME; +typedef struct asn1_string_st ASN1_GENERALIZEDTIME; +typedef struct asn1_string_st ASN1_VISIBLESTRING; +typedef struct asn1_string_st ASN1_UTF8STRING; +typedef struct asn1_string_st ASN1_STRING; +typedef int ASN1_BOOLEAN; +typedef int ASN1_NULL; +# endif + +typedef struct asn1_object_st ASN1_OBJECT; + +typedef struct ASN1_ITEM_st ASN1_ITEM; +typedef struct asn1_pctx_st ASN1_PCTX; +typedef struct asn1_sctx_st ASN1_SCTX; + +# ifdef _WIN32 +# undef X509_NAME +# undef X509_EXTENSIONS +# undef PKCS7_ISSUER_AND_SERIAL +# undef PKCS7_SIGNER_INFO +# undef OCSP_REQUEST +# undef OCSP_RESPONSE +# endif + +# ifdef BIGNUM +# undef BIGNUM +# endif +struct dane_st; +typedef struct bio_st BIO; +typedef struct bignum_st BIGNUM; +typedef struct bignum_ctx BN_CTX; +typedef struct bn_blinding_st BN_BLINDING; +typedef struct bn_mont_ctx_st BN_MONT_CTX; +typedef struct bn_recp_ctx_st BN_RECP_CTX; +typedef struct bn_gencb_st BN_GENCB; + +typedef struct buf_mem_st BUF_MEM; + +typedef struct evp_cipher_st EVP_CIPHER; +typedef struct evp_cipher_ctx_st EVP_CIPHER_CTX; +typedef struct evp_md_st EVP_MD; +typedef struct evp_md_ctx_st EVP_MD_CTX; +typedef struct evp_pkey_st EVP_PKEY; + +typedef struct evp_pkey_asn1_method_st EVP_PKEY_ASN1_METHOD; + +typedef struct evp_pkey_method_st EVP_PKEY_METHOD; +typedef struct evp_pkey_ctx_st EVP_PKEY_CTX; + +typedef struct evp_Encode_Ctx_st EVP_ENCODE_CTX; + +typedef struct hmac_ctx_st HMAC_CTX; + +typedef struct dh_st DH; +typedef struct dh_method DH_METHOD; + +typedef struct dsa_st DSA; +typedef struct dsa_method DSA_METHOD; + +typedef struct rsa_st RSA; +typedef struct rsa_meth_st RSA_METHOD; +typedef struct rsa_pss_params_st RSA_PSS_PARAMS; + +typedef struct ec_key_st EC_KEY; +typedef struct ec_key_method_st EC_KEY_METHOD; + +typedef struct rand_meth_st RAND_METHOD; +typedef struct rand_drbg_st RAND_DRBG; + +typedef struct ssl_dane_st SSL_DANE; +typedef struct x509_st X509; +typedef struct X509_algor_st X509_ALGOR; +typedef struct X509_crl_st X509_CRL; +typedef struct x509_crl_method_st X509_CRL_METHOD; +typedef struct x509_revoked_st X509_REVOKED; +typedef struct X509_name_st X509_NAME; +typedef struct X509_pubkey_st X509_PUBKEY; +typedef struct x509_store_st X509_STORE; +typedef struct x509_store_ctx_st X509_STORE_CTX; + +typedef struct x509_object_st X509_OBJECT; +typedef struct x509_lookup_st X509_LOOKUP; +typedef struct x509_lookup_method_st X509_LOOKUP_METHOD; +typedef struct X509_VERIFY_PARAM_st X509_VERIFY_PARAM; + +typedef struct x509_sig_info_st X509_SIG_INFO; + +typedef struct pkcs8_priv_key_info_st PKCS8_PRIV_KEY_INFO; + +typedef struct v3_ext_ctx X509V3_CTX; +typedef struct conf_st CONF; +typedef struct ossl_init_settings_st OPENSSL_INIT_SETTINGS; + +typedef struct ui_st UI; +typedef struct ui_method_st UI_METHOD; + +typedef struct engine_st ENGINE; +typedef struct ssl_st SSL; +typedef struct ssl_ctx_st SSL_CTX; + +typedef struct comp_ctx_st COMP_CTX; +typedef struct comp_method_st COMP_METHOD; + +typedef struct X509_POLICY_NODE_st X509_POLICY_NODE; +typedef struct X509_POLICY_LEVEL_st X509_POLICY_LEVEL; +typedef struct X509_POLICY_TREE_st X509_POLICY_TREE; +typedef struct X509_POLICY_CACHE_st X509_POLICY_CACHE; + +typedef struct AUTHORITY_KEYID_st AUTHORITY_KEYID; +typedef struct DIST_POINT_st DIST_POINT; +typedef struct ISSUING_DIST_POINT_st ISSUING_DIST_POINT; +typedef struct NAME_CONSTRAINTS_st NAME_CONSTRAINTS; + +typedef struct crypto_ex_data_st CRYPTO_EX_DATA; + +typedef struct ocsp_req_ctx_st OCSP_REQ_CTX; +typedef struct ocsp_response_st OCSP_RESPONSE; +typedef struct ocsp_responder_id_st OCSP_RESPID; + +typedef struct sct_st SCT; +typedef struct sct_ctx_st SCT_CTX; +typedef struct ctlog_st CTLOG; +typedef struct ctlog_store_st CTLOG_STORE; +typedef struct ct_policy_eval_ctx_st CT_POLICY_EVAL_CTX; + +typedef struct ossl_store_info_st OSSL_STORE_INFO; +typedef struct ossl_store_search_st OSSL_STORE_SEARCH; + +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L && \ + defined(INTMAX_MAX) && defined(UINTMAX_MAX) +typedef intmax_t ossl_intmax_t; +typedef uintmax_t ossl_uintmax_t; +#else +/* + * Not long long, because the C-library can only be expected to provide + * strtoll(), strtoull() at the same time as intmax_t and strtoimax(), + * strtoumax(). Since we use these for parsing arguments, we need the + * conversion functions, not just the sizes. + */ +typedef long ossl_intmax_t; +typedef unsigned long ossl_uintmax_t; +#endif + +#ifdef __cplusplus +} +#endif +#endif /* def HEADER_OPENSSL_TYPES_H */ diff --git a/ONVIF/include/openssl/include/openssl/pem.h b/ONVIF/include/openssl/include/openssl/pem.h new file mode 100644 index 0000000..2ef5b5d --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/pem.h @@ -0,0 +1,378 @@ +/* + * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_PEM_H +# define HEADER_PEM_H + +# include +# include +# include +# include +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + +# define PEM_BUFSIZE 1024 + +# define PEM_STRING_X509_OLD "X509 CERTIFICATE" +# define PEM_STRING_X509 "CERTIFICATE" +# define PEM_STRING_X509_TRUSTED "TRUSTED CERTIFICATE" +# define PEM_STRING_X509_REQ_OLD "NEW CERTIFICATE REQUEST" +# define PEM_STRING_X509_REQ "CERTIFICATE REQUEST" +# define PEM_STRING_X509_CRL "X509 CRL" +# define PEM_STRING_EVP_PKEY "ANY PRIVATE KEY" +# define PEM_STRING_PUBLIC "PUBLIC KEY" +# define PEM_STRING_RSA "RSA PRIVATE KEY" +# define PEM_STRING_RSA_PUBLIC "RSA PUBLIC KEY" +# define PEM_STRING_DSA "DSA PRIVATE KEY" +# define PEM_STRING_DSA_PUBLIC "DSA PUBLIC KEY" +# define PEM_STRING_PKCS7 "PKCS7" +# define PEM_STRING_PKCS7_SIGNED "PKCS #7 SIGNED DATA" +# define PEM_STRING_PKCS8 "ENCRYPTED PRIVATE KEY" +# define PEM_STRING_PKCS8INF "PRIVATE KEY" +# define PEM_STRING_DHPARAMS "DH PARAMETERS" +# define PEM_STRING_DHXPARAMS "X9.42 DH PARAMETERS" +# define PEM_STRING_SSL_SESSION "SSL SESSION PARAMETERS" +# define PEM_STRING_DSAPARAMS "DSA PARAMETERS" +# define PEM_STRING_ECDSA_PUBLIC "ECDSA PUBLIC KEY" +# define PEM_STRING_ECPARAMETERS "EC PARAMETERS" +# define PEM_STRING_ECPRIVATEKEY "EC PRIVATE KEY" +# define PEM_STRING_PARAMETERS "PARAMETERS" +# define PEM_STRING_CMS "CMS" + +# define PEM_TYPE_ENCRYPTED 10 +# define PEM_TYPE_MIC_ONLY 20 +# define PEM_TYPE_MIC_CLEAR 30 +# define PEM_TYPE_CLEAR 40 + +/* + * These macros make the PEM_read/PEM_write functions easier to maintain and + * write. Now they are all implemented with either: IMPLEMENT_PEM_rw(...) or + * IMPLEMENT_PEM_rw_cb(...) + */ + +# ifdef OPENSSL_NO_STDIO + +# define IMPLEMENT_PEM_read_fp(name, type, str, asn1) /**/ +# define IMPLEMENT_PEM_write_fp(name, type, str, asn1) /**/ +# define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) /**/ +# define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) /**/ +# define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) /**/ +# else + +# define IMPLEMENT_PEM_read_fp(name, type, str, asn1) \ +type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u)\ +{ \ +return PEM_ASN1_read((d2i_of_void *)d2i_##asn1, str,fp,(void **)x,cb,u); \ +} + +# define IMPLEMENT_PEM_write_fp(name, type, str, asn1) \ +int PEM_write_##name(FILE *fp, type *x) \ +{ \ +return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,x,NULL,NULL,0,NULL,NULL); \ +} + +# define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) \ +int PEM_write_##name(FILE *fp, const type *x) \ +{ \ +return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,(void *)x,NULL,NULL,0,NULL,NULL); \ +} + +# define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) \ +int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \ + unsigned char *kstr, int klen, pem_password_cb *cb, \ + void *u) \ + { \ + return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,x,enc,kstr,klen,cb,u); \ + } + +# define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) \ +int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \ + unsigned char *kstr, int klen, pem_password_cb *cb, \ + void *u) \ + { \ + return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,x,enc,kstr,klen,cb,u); \ + } + +# endif + +# define IMPLEMENT_PEM_read_bio(name, type, str, asn1) \ +type *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u)\ +{ \ +return PEM_ASN1_read_bio((d2i_of_void *)d2i_##asn1, str,bp,(void **)x,cb,u); \ +} + +# define IMPLEMENT_PEM_write_bio(name, type, str, asn1) \ +int PEM_write_bio_##name(BIO *bp, type *x) \ +{ \ +return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,x,NULL,NULL,0,NULL,NULL); \ +} + +# define IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \ +int PEM_write_bio_##name(BIO *bp, const type *x) \ +{ \ +return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,(void *)x,NULL,NULL,0,NULL,NULL); \ +} + +# define IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \ +int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ + unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \ + { \ + return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,x,enc,kstr,klen,cb,u); \ + } + +# define IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \ +int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ + unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \ + { \ + return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,(void *)x,enc,kstr,klen,cb,u); \ + } + +# define IMPLEMENT_PEM_write(name, type, str, asn1) \ + IMPLEMENT_PEM_write_bio(name, type, str, asn1) \ + IMPLEMENT_PEM_write_fp(name, type, str, asn1) + +# define IMPLEMENT_PEM_write_const(name, type, str, asn1) \ + IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \ + IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) + +# define IMPLEMENT_PEM_write_cb(name, type, str, asn1) \ + IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \ + IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) + +# define IMPLEMENT_PEM_write_cb_const(name, type, str, asn1) \ + IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \ + IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) + +# define IMPLEMENT_PEM_read(name, type, str, asn1) \ + IMPLEMENT_PEM_read_bio(name, type, str, asn1) \ + IMPLEMENT_PEM_read_fp(name, type, str, asn1) + +# define IMPLEMENT_PEM_rw(name, type, str, asn1) \ + IMPLEMENT_PEM_read(name, type, str, asn1) \ + IMPLEMENT_PEM_write(name, type, str, asn1) + +# define IMPLEMENT_PEM_rw_const(name, type, str, asn1) \ + IMPLEMENT_PEM_read(name, type, str, asn1) \ + IMPLEMENT_PEM_write_const(name, type, str, asn1) + +# define IMPLEMENT_PEM_rw_cb(name, type, str, asn1) \ + IMPLEMENT_PEM_read(name, type, str, asn1) \ + IMPLEMENT_PEM_write_cb(name, type, str, asn1) + +/* These are the same except they are for the declarations */ + +# if defined(OPENSSL_NO_STDIO) + +# define DECLARE_PEM_read_fp(name, type) /**/ +# define DECLARE_PEM_write_fp(name, type) /**/ +# define DECLARE_PEM_write_fp_const(name, type) /**/ +# define DECLARE_PEM_write_cb_fp(name, type) /**/ +# else + +# define DECLARE_PEM_read_fp(name, type) \ + type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u); + +# define DECLARE_PEM_write_fp(name, type) \ + int PEM_write_##name(FILE *fp, type *x); + +# define DECLARE_PEM_write_fp_const(name, type) \ + int PEM_write_##name(FILE *fp, const type *x); + +# define DECLARE_PEM_write_cb_fp(name, type) \ + int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \ + unsigned char *kstr, int klen, pem_password_cb *cb, void *u); + +# endif + +# define DECLARE_PEM_read_bio(name, type) \ + type *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u); + +# define DECLARE_PEM_write_bio(name, type) \ + int PEM_write_bio_##name(BIO *bp, type *x); + +# define DECLARE_PEM_write_bio_const(name, type) \ + int PEM_write_bio_##name(BIO *bp, const type *x); + +# define DECLARE_PEM_write_cb_bio(name, type) \ + int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ + unsigned char *kstr, int klen, pem_password_cb *cb, void *u); + +# define DECLARE_PEM_write(name, type) \ + DECLARE_PEM_write_bio(name, type) \ + DECLARE_PEM_write_fp(name, type) +# define DECLARE_PEM_write_const(name, type) \ + DECLARE_PEM_write_bio_const(name, type) \ + DECLARE_PEM_write_fp_const(name, type) +# define DECLARE_PEM_write_cb(name, type) \ + DECLARE_PEM_write_cb_bio(name, type) \ + DECLARE_PEM_write_cb_fp(name, type) +# define DECLARE_PEM_read(name, type) \ + DECLARE_PEM_read_bio(name, type) \ + DECLARE_PEM_read_fp(name, type) +# define DECLARE_PEM_rw(name, type) \ + DECLARE_PEM_read(name, type) \ + DECLARE_PEM_write(name, type) +# define DECLARE_PEM_rw_const(name, type) \ + DECLARE_PEM_read(name, type) \ + DECLARE_PEM_write_const(name, type) +# define DECLARE_PEM_rw_cb(name, type) \ + DECLARE_PEM_read(name, type) \ + DECLARE_PEM_write_cb(name, type) +typedef int pem_password_cb (char *buf, int size, int rwflag, void *userdata); + +int PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher); +int PEM_do_header(EVP_CIPHER_INFO *cipher, unsigned char *data, long *len, + pem_password_cb *callback, void *u); + +int PEM_read_bio(BIO *bp, char **name, char **header, + unsigned char **data, long *len); +# define PEM_FLAG_SECURE 0x1 +# define PEM_FLAG_EAY_COMPATIBLE 0x2 +# define PEM_FLAG_ONLY_B64 0x4 +int PEM_read_bio_ex(BIO *bp, char **name, char **header, + unsigned char **data, long *len, unsigned int flags); +int PEM_bytes_read_bio_secmem(unsigned char **pdata, long *plen, char **pnm, + const char *name, BIO *bp, pem_password_cb *cb, + void *u); +int PEM_write_bio(BIO *bp, const char *name, const char *hdr, + const unsigned char *data, long len); +int PEM_bytes_read_bio(unsigned char **pdata, long *plen, char **pnm, + const char *name, BIO *bp, pem_password_cb *cb, + void *u); +void *PEM_ASN1_read_bio(d2i_of_void *d2i, const char *name, BIO *bp, void **x, + pem_password_cb *cb, void *u); +int PEM_ASN1_write_bio(i2d_of_void *i2d, const char *name, BIO *bp, void *x, + const EVP_CIPHER *enc, unsigned char *kstr, int klen, + pem_password_cb *cb, void *u); + +STACK_OF(X509_INFO) *PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk, + pem_password_cb *cb, void *u); +int PEM_X509_INFO_write_bio(BIO *bp, X509_INFO *xi, EVP_CIPHER *enc, + unsigned char *kstr, int klen, + pem_password_cb *cd, void *u); + +#ifndef OPENSSL_NO_STDIO +int PEM_read(FILE *fp, char **name, char **header, + unsigned char **data, long *len); +int PEM_write(FILE *fp, const char *name, const char *hdr, + const unsigned char *data, long len); +void *PEM_ASN1_read(d2i_of_void *d2i, const char *name, FILE *fp, void **x, + pem_password_cb *cb, void *u); +int PEM_ASN1_write(i2d_of_void *i2d, const char *name, FILE *fp, + void *x, const EVP_CIPHER *enc, unsigned char *kstr, + int klen, pem_password_cb *callback, void *u); +STACK_OF(X509_INFO) *PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk, + pem_password_cb *cb, void *u); +#endif + +int PEM_SignInit(EVP_MD_CTX *ctx, EVP_MD *type); +int PEM_SignUpdate(EVP_MD_CTX *ctx, unsigned char *d, unsigned int cnt); +int PEM_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, + unsigned int *siglen, EVP_PKEY *pkey); + +/* The default pem_password_cb that's used internally */ +int PEM_def_callback(char *buf, int num, int rwflag, void *userdata); +void PEM_proc_type(char *buf, int type); +void PEM_dek_info(char *buf, const char *type, int len, char *str); + +# include + +DECLARE_PEM_rw(X509, X509) +DECLARE_PEM_rw(X509_AUX, X509) +DECLARE_PEM_rw(X509_REQ, X509_REQ) +DECLARE_PEM_write(X509_REQ_NEW, X509_REQ) +DECLARE_PEM_rw(X509_CRL, X509_CRL) +DECLARE_PEM_rw(PKCS7, PKCS7) +DECLARE_PEM_rw(NETSCAPE_CERT_SEQUENCE, NETSCAPE_CERT_SEQUENCE) +DECLARE_PEM_rw(PKCS8, X509_SIG) +DECLARE_PEM_rw(PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO) +# ifndef OPENSSL_NO_RSA +DECLARE_PEM_rw_cb(RSAPrivateKey, RSA) +DECLARE_PEM_rw_const(RSAPublicKey, RSA) +DECLARE_PEM_rw(RSA_PUBKEY, RSA) +# endif +# ifndef OPENSSL_NO_DSA +DECLARE_PEM_rw_cb(DSAPrivateKey, DSA) +DECLARE_PEM_rw(DSA_PUBKEY, DSA) +DECLARE_PEM_rw_const(DSAparams, DSA) +# endif +# ifndef OPENSSL_NO_EC +DECLARE_PEM_rw_const(ECPKParameters, EC_GROUP) +DECLARE_PEM_rw_cb(ECPrivateKey, EC_KEY) +DECLARE_PEM_rw(EC_PUBKEY, EC_KEY) +# endif +# ifndef OPENSSL_NO_DH +DECLARE_PEM_rw_const(DHparams, DH) +DECLARE_PEM_write_const(DHxparams, DH) +# endif +DECLARE_PEM_rw_cb(PrivateKey, EVP_PKEY) +DECLARE_PEM_rw(PUBKEY, EVP_PKEY) + +int PEM_write_bio_PrivateKey_traditional(BIO *bp, EVP_PKEY *x, + const EVP_CIPHER *enc, + unsigned char *kstr, int klen, + pem_password_cb *cb, void *u); + +int PEM_write_bio_PKCS8PrivateKey_nid(BIO *bp, EVP_PKEY *x, int nid, + char *kstr, int klen, + pem_password_cb *cb, void *u); +int PEM_write_bio_PKCS8PrivateKey(BIO *, EVP_PKEY *, const EVP_CIPHER *, + char *, int, pem_password_cb *, void *); +int i2d_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc, + char *kstr, int klen, + pem_password_cb *cb, void *u); +int i2d_PKCS8PrivateKey_nid_bio(BIO *bp, EVP_PKEY *x, int nid, + char *kstr, int klen, + pem_password_cb *cb, void *u); +EVP_PKEY *d2i_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, + void *u); + +# ifndef OPENSSL_NO_STDIO +int i2d_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc, + char *kstr, int klen, + pem_password_cb *cb, void *u); +int i2d_PKCS8PrivateKey_nid_fp(FILE *fp, EVP_PKEY *x, int nid, + char *kstr, int klen, + pem_password_cb *cb, void *u); +int PEM_write_PKCS8PrivateKey_nid(FILE *fp, EVP_PKEY *x, int nid, + char *kstr, int klen, + pem_password_cb *cb, void *u); + +EVP_PKEY *d2i_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY **x, pem_password_cb *cb, + void *u); + +int PEM_write_PKCS8PrivateKey(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc, + char *kstr, int klen, pem_password_cb *cd, + void *u); +# endif +EVP_PKEY *PEM_read_bio_Parameters(BIO *bp, EVP_PKEY **x); +int PEM_write_bio_Parameters(BIO *bp, EVP_PKEY *x); + +# ifndef OPENSSL_NO_DSA +EVP_PKEY *b2i_PrivateKey(const unsigned char **in, long length); +EVP_PKEY *b2i_PublicKey(const unsigned char **in, long length); +EVP_PKEY *b2i_PrivateKey_bio(BIO *in); +EVP_PKEY *b2i_PublicKey_bio(BIO *in); +int i2b_PrivateKey_bio(BIO *out, EVP_PKEY *pk); +int i2b_PublicKey_bio(BIO *out, EVP_PKEY *pk); +# ifndef OPENSSL_NO_RC4 +EVP_PKEY *b2i_PVK_bio(BIO *in, pem_password_cb *cb, void *u); +int i2b_PVK_bio(BIO *out, EVP_PKEY *pk, int enclevel, + pem_password_cb *cb, void *u); +# endif +# endif + +# ifdef __cplusplus +} +# endif +#endif diff --git a/ONVIF/include/openssl/include/openssl/pem2.h b/ONVIF/include/openssl/include/openssl/pem2.h new file mode 100644 index 0000000..038fe79 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/pem2.h @@ -0,0 +1,13 @@ +/* + * Copyright 1999-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_PEM2_H +# define HEADER_PEM2_H +# include +#endif diff --git a/ONVIF/include/openssl/include/openssl/pemerr.h b/ONVIF/include/openssl/include/openssl/pemerr.h new file mode 100644 index 0000000..0c45918 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/pemerr.h @@ -0,0 +1,103 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_PEMERR_H +# define HEADER_PEMERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_PEM_strings(void); + +/* + * PEM function codes. + */ +# define PEM_F_B2I_DSS 127 +# define PEM_F_B2I_PVK_BIO 128 +# define PEM_F_B2I_RSA 129 +# define PEM_F_CHECK_BITLEN_DSA 130 +# define PEM_F_CHECK_BITLEN_RSA 131 +# define PEM_F_D2I_PKCS8PRIVATEKEY_BIO 120 +# define PEM_F_D2I_PKCS8PRIVATEKEY_FP 121 +# define PEM_F_DO_B2I 132 +# define PEM_F_DO_B2I_BIO 133 +# define PEM_F_DO_BLOB_HEADER 134 +# define PEM_F_DO_I2B 146 +# define PEM_F_DO_PK8PKEY 126 +# define PEM_F_DO_PK8PKEY_FP 125 +# define PEM_F_DO_PVK_BODY 135 +# define PEM_F_DO_PVK_HEADER 136 +# define PEM_F_GET_HEADER_AND_DATA 143 +# define PEM_F_GET_NAME 144 +# define PEM_F_I2B_PVK 137 +# define PEM_F_I2B_PVK_BIO 138 +# define PEM_F_LOAD_IV 101 +# define PEM_F_PEM_ASN1_READ 102 +# define PEM_F_PEM_ASN1_READ_BIO 103 +# define PEM_F_PEM_ASN1_WRITE 104 +# define PEM_F_PEM_ASN1_WRITE_BIO 105 +# define PEM_F_PEM_DEF_CALLBACK 100 +# define PEM_F_PEM_DO_HEADER 106 +# define PEM_F_PEM_GET_EVP_CIPHER_INFO 107 +# define PEM_F_PEM_READ 108 +# define PEM_F_PEM_READ_BIO 109 +# define PEM_F_PEM_READ_BIO_DHPARAMS 141 +# define PEM_F_PEM_READ_BIO_EX 145 +# define PEM_F_PEM_READ_BIO_PARAMETERS 140 +# define PEM_F_PEM_READ_BIO_PRIVATEKEY 123 +# define PEM_F_PEM_READ_DHPARAMS 142 +# define PEM_F_PEM_READ_PRIVATEKEY 124 +# define PEM_F_PEM_SIGNFINAL 112 +# define PEM_F_PEM_WRITE 113 +# define PEM_F_PEM_WRITE_BIO 114 +# define PEM_F_PEM_WRITE_PRIVATEKEY 139 +# define PEM_F_PEM_X509_INFO_READ 115 +# define PEM_F_PEM_X509_INFO_READ_BIO 116 +# define PEM_F_PEM_X509_INFO_WRITE_BIO 117 + +/* + * PEM reason codes. + */ +# define PEM_R_BAD_BASE64_DECODE 100 +# define PEM_R_BAD_DECRYPT 101 +# define PEM_R_BAD_END_LINE 102 +# define PEM_R_BAD_IV_CHARS 103 +# define PEM_R_BAD_MAGIC_NUMBER 116 +# define PEM_R_BAD_PASSWORD_READ 104 +# define PEM_R_BAD_VERSION_NUMBER 117 +# define PEM_R_BIO_WRITE_FAILURE 118 +# define PEM_R_CIPHER_IS_NULL 127 +# define PEM_R_ERROR_CONVERTING_PRIVATE_KEY 115 +# define PEM_R_EXPECTING_PRIVATE_KEY_BLOB 119 +# define PEM_R_EXPECTING_PUBLIC_KEY_BLOB 120 +# define PEM_R_HEADER_TOO_LONG 128 +# define PEM_R_INCONSISTENT_HEADER 121 +# define PEM_R_KEYBLOB_HEADER_PARSE_ERROR 122 +# define PEM_R_KEYBLOB_TOO_SHORT 123 +# define PEM_R_MISSING_DEK_IV 129 +# define PEM_R_NOT_DEK_INFO 105 +# define PEM_R_NOT_ENCRYPTED 106 +# define PEM_R_NOT_PROC_TYPE 107 +# define PEM_R_NO_START_LINE 108 +# define PEM_R_PROBLEMS_GETTING_PASSWORD 109 +# define PEM_R_PVK_DATA_TOO_SHORT 124 +# define PEM_R_PVK_TOO_SHORT 125 +# define PEM_R_READ_KEY 111 +# define PEM_R_SHORT_HEADER 112 +# define PEM_R_UNEXPECTED_DEK_IV 130 +# define PEM_R_UNSUPPORTED_CIPHER 113 +# define PEM_R_UNSUPPORTED_ENCRYPTION 114 +# define PEM_R_UNSUPPORTED_KEY_COMPONENTS 126 + +#endif diff --git a/ONVIF/include/openssl/include/openssl/pkcs12.h b/ONVIF/include/openssl/include/openssl/pkcs12.h new file mode 100644 index 0000000..3f43dad --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/pkcs12.h @@ -0,0 +1,223 @@ +/* + * Copyright 1999-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_PKCS12_H +# define HEADER_PKCS12_H + +# include +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + +# define PKCS12_KEY_ID 1 +# define PKCS12_IV_ID 2 +# define PKCS12_MAC_ID 3 + +/* Default iteration count */ +# ifndef PKCS12_DEFAULT_ITER +# define PKCS12_DEFAULT_ITER PKCS5_DEFAULT_ITER +# endif + +# define PKCS12_MAC_KEY_LENGTH 20 + +# define PKCS12_SALT_LEN 8 + +/* It's not clear if these are actually needed... */ +# define PKCS12_key_gen PKCS12_key_gen_utf8 +# define PKCS12_add_friendlyname PKCS12_add_friendlyname_utf8 + +/* MS key usage constants */ + +# define KEY_EX 0x10 +# define KEY_SIG 0x80 + +typedef struct PKCS12_MAC_DATA_st PKCS12_MAC_DATA; + +typedef struct PKCS12_st PKCS12; + +typedef struct PKCS12_SAFEBAG_st PKCS12_SAFEBAG; + +DEFINE_STACK_OF(PKCS12_SAFEBAG) + +typedef struct pkcs12_bag_st PKCS12_BAGS; + +# define PKCS12_ERROR 0 +# define PKCS12_OK 1 + +/* Compatibility macros */ + +#if OPENSSL_API_COMPAT < 0x10100000L + +# define M_PKCS12_bag_type PKCS12_bag_type +# define M_PKCS12_cert_bag_type PKCS12_cert_bag_type +# define M_PKCS12_crl_bag_type PKCS12_cert_bag_type + +# define PKCS12_certbag2x509 PKCS12_SAFEBAG_get1_cert +# define PKCS12_certbag2scrl PKCS12_SAFEBAG_get1_crl +# define PKCS12_bag_type PKCS12_SAFEBAG_get_nid +# define PKCS12_cert_bag_type PKCS12_SAFEBAG_get_bag_nid +# define PKCS12_x5092certbag PKCS12_SAFEBAG_create_cert +# define PKCS12_x509crl2certbag PKCS12_SAFEBAG_create_crl +# define PKCS12_MAKE_KEYBAG PKCS12_SAFEBAG_create0_p8inf +# define PKCS12_MAKE_SHKEYBAG PKCS12_SAFEBAG_create_pkcs8_encrypt + +#endif + +DEPRECATEDIN_1_1_0(ASN1_TYPE *PKCS12_get_attr(const PKCS12_SAFEBAG *bag, int attr_nid)) + +ASN1_TYPE *PKCS8_get_attr(PKCS8_PRIV_KEY_INFO *p8, int attr_nid); +int PKCS12_mac_present(const PKCS12 *p12); +void PKCS12_get0_mac(const ASN1_OCTET_STRING **pmac, + const X509_ALGOR **pmacalg, + const ASN1_OCTET_STRING **psalt, + const ASN1_INTEGER **piter, + const PKCS12 *p12); + +const ASN1_TYPE *PKCS12_SAFEBAG_get0_attr(const PKCS12_SAFEBAG *bag, + int attr_nid); +const ASN1_OBJECT *PKCS12_SAFEBAG_get0_type(const PKCS12_SAFEBAG *bag); +int PKCS12_SAFEBAG_get_nid(const PKCS12_SAFEBAG *bag); +int PKCS12_SAFEBAG_get_bag_nid(const PKCS12_SAFEBAG *bag); + +X509 *PKCS12_SAFEBAG_get1_cert(const PKCS12_SAFEBAG *bag); +X509_CRL *PKCS12_SAFEBAG_get1_crl(const PKCS12_SAFEBAG *bag); +const STACK_OF(PKCS12_SAFEBAG) * +PKCS12_SAFEBAG_get0_safes(const PKCS12_SAFEBAG *bag); +const PKCS8_PRIV_KEY_INFO *PKCS12_SAFEBAG_get0_p8inf(const PKCS12_SAFEBAG *bag); +const X509_SIG *PKCS12_SAFEBAG_get0_pkcs8(const PKCS12_SAFEBAG *bag); + +PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_cert(X509 *x509); +PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_crl(X509_CRL *crl); +PKCS12_SAFEBAG *PKCS12_SAFEBAG_create0_p8inf(PKCS8_PRIV_KEY_INFO *p8); +PKCS12_SAFEBAG *PKCS12_SAFEBAG_create0_pkcs8(X509_SIG *p8); +PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_pkcs8_encrypt(int pbe_nid, + const char *pass, + int passlen, + unsigned char *salt, + int saltlen, int iter, + PKCS8_PRIV_KEY_INFO *p8inf); + +PKCS12_SAFEBAG *PKCS12_item_pack_safebag(void *obj, const ASN1_ITEM *it, + int nid1, int nid2); +PKCS8_PRIV_KEY_INFO *PKCS8_decrypt(const X509_SIG *p8, const char *pass, + int passlen); +PKCS8_PRIV_KEY_INFO *PKCS12_decrypt_skey(const PKCS12_SAFEBAG *bag, + const char *pass, int passlen); +X509_SIG *PKCS8_encrypt(int pbe_nid, const EVP_CIPHER *cipher, + const char *pass, int passlen, unsigned char *salt, + int saltlen, int iter, PKCS8_PRIV_KEY_INFO *p8); +X509_SIG *PKCS8_set0_pbe(const char *pass, int passlen, + PKCS8_PRIV_KEY_INFO *p8inf, X509_ALGOR *pbe); +PKCS7 *PKCS12_pack_p7data(STACK_OF(PKCS12_SAFEBAG) *sk); +STACK_OF(PKCS12_SAFEBAG) *PKCS12_unpack_p7data(PKCS7 *p7); +PKCS7 *PKCS12_pack_p7encdata(int pbe_nid, const char *pass, int passlen, + unsigned char *salt, int saltlen, int iter, + STACK_OF(PKCS12_SAFEBAG) *bags); +STACK_OF(PKCS12_SAFEBAG) *PKCS12_unpack_p7encdata(PKCS7 *p7, const char *pass, + int passlen); + +int PKCS12_pack_authsafes(PKCS12 *p12, STACK_OF(PKCS7) *safes); +STACK_OF(PKCS7) *PKCS12_unpack_authsafes(const PKCS12 *p12); + +int PKCS12_add_localkeyid(PKCS12_SAFEBAG *bag, unsigned char *name, + int namelen); +int PKCS12_add_friendlyname_asc(PKCS12_SAFEBAG *bag, const char *name, + int namelen); +int PKCS12_add_friendlyname_utf8(PKCS12_SAFEBAG *bag, const char *name, + int namelen); +int PKCS12_add_CSPName_asc(PKCS12_SAFEBAG *bag, const char *name, + int namelen); +int PKCS12_add_friendlyname_uni(PKCS12_SAFEBAG *bag, + const unsigned char *name, int namelen); +int PKCS8_add_keyusage(PKCS8_PRIV_KEY_INFO *p8, int usage); +ASN1_TYPE *PKCS12_get_attr_gen(const STACK_OF(X509_ATTRIBUTE) *attrs, + int attr_nid); +char *PKCS12_get_friendlyname(PKCS12_SAFEBAG *bag); +const STACK_OF(X509_ATTRIBUTE) * +PKCS12_SAFEBAG_get0_attrs(const PKCS12_SAFEBAG *bag); +unsigned char *PKCS12_pbe_crypt(const X509_ALGOR *algor, + const char *pass, int passlen, + const unsigned char *in, int inlen, + unsigned char **data, int *datalen, + int en_de); +void *PKCS12_item_decrypt_d2i(const X509_ALGOR *algor, const ASN1_ITEM *it, + const char *pass, int passlen, + const ASN1_OCTET_STRING *oct, int zbuf); +ASN1_OCTET_STRING *PKCS12_item_i2d_encrypt(X509_ALGOR *algor, + const ASN1_ITEM *it, + const char *pass, int passlen, + void *obj, int zbuf); +PKCS12 *PKCS12_init(int mode); +int PKCS12_key_gen_asc(const char *pass, int passlen, unsigned char *salt, + int saltlen, int id, int iter, int n, + unsigned char *out, const EVP_MD *md_type); +int PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt, + int saltlen, int id, int iter, int n, + unsigned char *out, const EVP_MD *md_type); +int PKCS12_key_gen_utf8(const char *pass, int passlen, unsigned char *salt, + int saltlen, int id, int iter, int n, + unsigned char *out, const EVP_MD *md_type); +int PKCS12_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, + ASN1_TYPE *param, const EVP_CIPHER *cipher, + const EVP_MD *md_type, int en_de); +int PKCS12_gen_mac(PKCS12 *p12, const char *pass, int passlen, + unsigned char *mac, unsigned int *maclen); +int PKCS12_verify_mac(PKCS12 *p12, const char *pass, int passlen); +int PKCS12_set_mac(PKCS12 *p12, const char *pass, int passlen, + unsigned char *salt, int saltlen, int iter, + const EVP_MD *md_type); +int PKCS12_setup_mac(PKCS12 *p12, int iter, unsigned char *salt, + int saltlen, const EVP_MD *md_type); +unsigned char *OPENSSL_asc2uni(const char *asc, int asclen, + unsigned char **uni, int *unilen); +char *OPENSSL_uni2asc(const unsigned char *uni, int unilen); +unsigned char *OPENSSL_utf82uni(const char *asc, int asclen, + unsigned char **uni, int *unilen); +char *OPENSSL_uni2utf8(const unsigned char *uni, int unilen); + +DECLARE_ASN1_FUNCTIONS(PKCS12) +DECLARE_ASN1_FUNCTIONS(PKCS12_MAC_DATA) +DECLARE_ASN1_FUNCTIONS(PKCS12_SAFEBAG) +DECLARE_ASN1_FUNCTIONS(PKCS12_BAGS) + +DECLARE_ASN1_ITEM(PKCS12_SAFEBAGS) +DECLARE_ASN1_ITEM(PKCS12_AUTHSAFES) + +void PKCS12_PBE_add(void); +int PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert, + STACK_OF(X509) **ca); +PKCS12 *PKCS12_create(const char *pass, const char *name, EVP_PKEY *pkey, + X509 *cert, STACK_OF(X509) *ca, int nid_key, int nid_cert, + int iter, int mac_iter, int keytype); + +PKCS12_SAFEBAG *PKCS12_add_cert(STACK_OF(PKCS12_SAFEBAG) **pbags, X509 *cert); +PKCS12_SAFEBAG *PKCS12_add_key(STACK_OF(PKCS12_SAFEBAG) **pbags, + EVP_PKEY *key, int key_usage, int iter, + int key_nid, const char *pass); +int PKCS12_add_safe(STACK_OF(PKCS7) **psafes, STACK_OF(PKCS12_SAFEBAG) *bags, + int safe_nid, int iter, const char *pass); +PKCS12 *PKCS12_add_safes(STACK_OF(PKCS7) *safes, int p7_nid); + +int i2d_PKCS12_bio(BIO *bp, PKCS12 *p12); +# ifndef OPENSSL_NO_STDIO +int i2d_PKCS12_fp(FILE *fp, PKCS12 *p12); +# endif +PKCS12 *d2i_PKCS12_bio(BIO *bp, PKCS12 **p12); +# ifndef OPENSSL_NO_STDIO +PKCS12 *d2i_PKCS12_fp(FILE *fp, PKCS12 **p12); +# endif +int PKCS12_newpass(PKCS12 *p12, const char *oldpass, const char *newpass); + +# ifdef __cplusplus +} +# endif +#endif diff --git a/ONVIF/include/openssl/include/openssl/pkcs12err.h b/ONVIF/include/openssl/include/openssl/pkcs12err.h new file mode 100644 index 0000000..eff5eb2 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/pkcs12err.h @@ -0,0 +1,81 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_PKCS12ERR_H +# define HEADER_PKCS12ERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_PKCS12_strings(void); + +/* + * PKCS12 function codes. + */ +# define PKCS12_F_OPENSSL_ASC2UNI 121 +# define PKCS12_F_OPENSSL_UNI2ASC 124 +# define PKCS12_F_OPENSSL_UNI2UTF8 127 +# define PKCS12_F_OPENSSL_UTF82UNI 129 +# define PKCS12_F_PKCS12_CREATE 105 +# define PKCS12_F_PKCS12_GEN_MAC 107 +# define PKCS12_F_PKCS12_INIT 109 +# define PKCS12_F_PKCS12_ITEM_DECRYPT_D2I 106 +# define PKCS12_F_PKCS12_ITEM_I2D_ENCRYPT 108 +# define PKCS12_F_PKCS12_ITEM_PACK_SAFEBAG 117 +# define PKCS12_F_PKCS12_KEY_GEN_ASC 110 +# define PKCS12_F_PKCS12_KEY_GEN_UNI 111 +# define PKCS12_F_PKCS12_KEY_GEN_UTF8 116 +# define PKCS12_F_PKCS12_NEWPASS 128 +# define PKCS12_F_PKCS12_PACK_P7DATA 114 +# define PKCS12_F_PKCS12_PACK_P7ENCDATA 115 +# define PKCS12_F_PKCS12_PARSE 118 +# define PKCS12_F_PKCS12_PBE_CRYPT 119 +# define PKCS12_F_PKCS12_PBE_KEYIVGEN 120 +# define PKCS12_F_PKCS12_SAFEBAG_CREATE0_P8INF 112 +# define PKCS12_F_PKCS12_SAFEBAG_CREATE0_PKCS8 113 +# define PKCS12_F_PKCS12_SAFEBAG_CREATE_PKCS8_ENCRYPT 133 +# define PKCS12_F_PKCS12_SETUP_MAC 122 +# define PKCS12_F_PKCS12_SET_MAC 123 +# define PKCS12_F_PKCS12_UNPACK_AUTHSAFES 130 +# define PKCS12_F_PKCS12_UNPACK_P7DATA 131 +# define PKCS12_F_PKCS12_VERIFY_MAC 126 +# define PKCS12_F_PKCS8_ENCRYPT 125 +# define PKCS12_F_PKCS8_SET0_PBE 132 + +/* + * PKCS12 reason codes. + */ +# define PKCS12_R_CANT_PACK_STRUCTURE 100 +# define PKCS12_R_CONTENT_TYPE_NOT_DATA 121 +# define PKCS12_R_DECODE_ERROR 101 +# define PKCS12_R_ENCODE_ERROR 102 +# define PKCS12_R_ENCRYPT_ERROR 103 +# define PKCS12_R_ERROR_SETTING_ENCRYPTED_DATA_TYPE 120 +# define PKCS12_R_INVALID_NULL_ARGUMENT 104 +# define PKCS12_R_INVALID_NULL_PKCS12_POINTER 105 +# define PKCS12_R_IV_GEN_ERROR 106 +# define PKCS12_R_KEY_GEN_ERROR 107 +# define PKCS12_R_MAC_ABSENT 108 +# define PKCS12_R_MAC_GENERATION_ERROR 109 +# define PKCS12_R_MAC_SETUP_ERROR 110 +# define PKCS12_R_MAC_STRING_SET_ERROR 111 +# define PKCS12_R_MAC_VERIFY_FAILURE 113 +# define PKCS12_R_PARSE_ERROR 114 +# define PKCS12_R_PKCS12_ALGOR_CIPHERINIT_ERROR 115 +# define PKCS12_R_PKCS12_CIPHERFINAL_ERROR 116 +# define PKCS12_R_PKCS12_PBE_CRYPT_ERROR 117 +# define PKCS12_R_UNKNOWN_DIGEST_ALGORITHM 118 +# define PKCS12_R_UNSUPPORTED_PKCS12_MODE 119 + +#endif diff --git a/ONVIF/include/openssl/include/openssl/pkcs7.h b/ONVIF/include/openssl/include/openssl/pkcs7.h new file mode 100644 index 0000000..9b66e00 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/pkcs7.h @@ -0,0 +1,319 @@ +/* + * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_PKCS7_H +# define HEADER_PKCS7_H + +# include +# include +# include + +# include +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + +/*- +Encryption_ID DES-CBC +Digest_ID MD5 +Digest_Encryption_ID rsaEncryption +Key_Encryption_ID rsaEncryption +*/ + +typedef struct pkcs7_issuer_and_serial_st { + X509_NAME *issuer; + ASN1_INTEGER *serial; +} PKCS7_ISSUER_AND_SERIAL; + +typedef struct pkcs7_signer_info_st { + ASN1_INTEGER *version; /* version 1 */ + PKCS7_ISSUER_AND_SERIAL *issuer_and_serial; + X509_ALGOR *digest_alg; + STACK_OF(X509_ATTRIBUTE) *auth_attr; /* [ 0 ] */ + X509_ALGOR *digest_enc_alg; + ASN1_OCTET_STRING *enc_digest; + STACK_OF(X509_ATTRIBUTE) *unauth_attr; /* [ 1 ] */ + /* The private key to sign with */ + EVP_PKEY *pkey; +} PKCS7_SIGNER_INFO; + +DEFINE_STACK_OF(PKCS7_SIGNER_INFO) + +typedef struct pkcs7_recip_info_st { + ASN1_INTEGER *version; /* version 0 */ + PKCS7_ISSUER_AND_SERIAL *issuer_and_serial; + X509_ALGOR *key_enc_algor; + ASN1_OCTET_STRING *enc_key; + X509 *cert; /* get the pub-key from this */ +} PKCS7_RECIP_INFO; + +DEFINE_STACK_OF(PKCS7_RECIP_INFO) + +typedef struct pkcs7_signed_st { + ASN1_INTEGER *version; /* version 1 */ + STACK_OF(X509_ALGOR) *md_algs; /* md used */ + STACK_OF(X509) *cert; /* [ 0 ] */ + STACK_OF(X509_CRL) *crl; /* [ 1 ] */ + STACK_OF(PKCS7_SIGNER_INFO) *signer_info; + struct pkcs7_st *contents; +} PKCS7_SIGNED; +/* + * The above structure is very very similar to PKCS7_SIGN_ENVELOPE. How about + * merging the two + */ + +typedef struct pkcs7_enc_content_st { + ASN1_OBJECT *content_type; + X509_ALGOR *algorithm; + ASN1_OCTET_STRING *enc_data; /* [ 0 ] */ + const EVP_CIPHER *cipher; +} PKCS7_ENC_CONTENT; + +typedef struct pkcs7_enveloped_st { + ASN1_INTEGER *version; /* version 0 */ + STACK_OF(PKCS7_RECIP_INFO) *recipientinfo; + PKCS7_ENC_CONTENT *enc_data; +} PKCS7_ENVELOPE; + +typedef struct pkcs7_signedandenveloped_st { + ASN1_INTEGER *version; /* version 1 */ + STACK_OF(X509_ALGOR) *md_algs; /* md used */ + STACK_OF(X509) *cert; /* [ 0 ] */ + STACK_OF(X509_CRL) *crl; /* [ 1 ] */ + STACK_OF(PKCS7_SIGNER_INFO) *signer_info; + PKCS7_ENC_CONTENT *enc_data; + STACK_OF(PKCS7_RECIP_INFO) *recipientinfo; +} PKCS7_SIGN_ENVELOPE; + +typedef struct pkcs7_digest_st { + ASN1_INTEGER *version; /* version 0 */ + X509_ALGOR *md; /* md used */ + struct pkcs7_st *contents; + ASN1_OCTET_STRING *digest; +} PKCS7_DIGEST; + +typedef struct pkcs7_encrypted_st { + ASN1_INTEGER *version; /* version 0 */ + PKCS7_ENC_CONTENT *enc_data; +} PKCS7_ENCRYPT; + +typedef struct pkcs7_st { + /* + * The following is non NULL if it contains ASN1 encoding of this + * structure + */ + unsigned char *asn1; + long length; +# define PKCS7_S_HEADER 0 +# define PKCS7_S_BODY 1 +# define PKCS7_S_TAIL 2 + int state; /* used during processing */ + int detached; + ASN1_OBJECT *type; + /* content as defined by the type */ + /* + * all encryption/message digests are applied to the 'contents', leaving + * out the 'type' field. + */ + union { + char *ptr; + /* NID_pkcs7_data */ + ASN1_OCTET_STRING *data; + /* NID_pkcs7_signed */ + PKCS7_SIGNED *sign; + /* NID_pkcs7_enveloped */ + PKCS7_ENVELOPE *enveloped; + /* NID_pkcs7_signedAndEnveloped */ + PKCS7_SIGN_ENVELOPE *signed_and_enveloped; + /* NID_pkcs7_digest */ + PKCS7_DIGEST *digest; + /* NID_pkcs7_encrypted */ + PKCS7_ENCRYPT *encrypted; + /* Anything else */ + ASN1_TYPE *other; + } d; +} PKCS7; + +DEFINE_STACK_OF(PKCS7) + +# define PKCS7_OP_SET_DETACHED_SIGNATURE 1 +# define PKCS7_OP_GET_DETACHED_SIGNATURE 2 + +# define PKCS7_get_signed_attributes(si) ((si)->auth_attr) +# define PKCS7_get_attributes(si) ((si)->unauth_attr) + +# define PKCS7_type_is_signed(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_signed) +# define PKCS7_type_is_encrypted(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_encrypted) +# define PKCS7_type_is_enveloped(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_enveloped) +# define PKCS7_type_is_signedAndEnveloped(a) \ + (OBJ_obj2nid((a)->type) == NID_pkcs7_signedAndEnveloped) +# define PKCS7_type_is_data(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_data) +# define PKCS7_type_is_digest(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_digest) + +# define PKCS7_set_detached(p,v) \ + PKCS7_ctrl(p,PKCS7_OP_SET_DETACHED_SIGNATURE,v,NULL) +# define PKCS7_get_detached(p) \ + PKCS7_ctrl(p,PKCS7_OP_GET_DETACHED_SIGNATURE,0,NULL) + +# define PKCS7_is_detached(p7) (PKCS7_type_is_signed(p7) && PKCS7_get_detached(p7)) + +/* S/MIME related flags */ + +# define PKCS7_TEXT 0x1 +# define PKCS7_NOCERTS 0x2 +# define PKCS7_NOSIGS 0x4 +# define PKCS7_NOCHAIN 0x8 +# define PKCS7_NOINTERN 0x10 +# define PKCS7_NOVERIFY 0x20 +# define PKCS7_DETACHED 0x40 +# define PKCS7_BINARY 0x80 +# define PKCS7_NOATTR 0x100 +# define PKCS7_NOSMIMECAP 0x200 +# define PKCS7_NOOLDMIMETYPE 0x400 +# define PKCS7_CRLFEOL 0x800 +# define PKCS7_STREAM 0x1000 +# define PKCS7_NOCRL 0x2000 +# define PKCS7_PARTIAL 0x4000 +# define PKCS7_REUSE_DIGEST 0x8000 +# define PKCS7_NO_DUAL_CONTENT 0x10000 + +/* Flags: for compatibility with older code */ + +# define SMIME_TEXT PKCS7_TEXT +# define SMIME_NOCERTS PKCS7_NOCERTS +# define SMIME_NOSIGS PKCS7_NOSIGS +# define SMIME_NOCHAIN PKCS7_NOCHAIN +# define SMIME_NOINTERN PKCS7_NOINTERN +# define SMIME_NOVERIFY PKCS7_NOVERIFY +# define SMIME_DETACHED PKCS7_DETACHED +# define SMIME_BINARY PKCS7_BINARY +# define SMIME_NOATTR PKCS7_NOATTR + +/* CRLF ASCII canonicalisation */ +# define SMIME_ASCIICRLF 0x80000 + +DECLARE_ASN1_FUNCTIONS(PKCS7_ISSUER_AND_SERIAL) + +int PKCS7_ISSUER_AND_SERIAL_digest(PKCS7_ISSUER_AND_SERIAL *data, + const EVP_MD *type, unsigned char *md, + unsigned int *len); +# ifndef OPENSSL_NO_STDIO +PKCS7 *d2i_PKCS7_fp(FILE *fp, PKCS7 **p7); +int i2d_PKCS7_fp(FILE *fp, PKCS7 *p7); +# endif +PKCS7 *PKCS7_dup(PKCS7 *p7); +PKCS7 *d2i_PKCS7_bio(BIO *bp, PKCS7 **p7); +int i2d_PKCS7_bio(BIO *bp, PKCS7 *p7); +int i2d_PKCS7_bio_stream(BIO *out, PKCS7 *p7, BIO *in, int flags); +int PEM_write_bio_PKCS7_stream(BIO *out, PKCS7 *p7, BIO *in, int flags); + +DECLARE_ASN1_FUNCTIONS(PKCS7_SIGNER_INFO) +DECLARE_ASN1_FUNCTIONS(PKCS7_RECIP_INFO) +DECLARE_ASN1_FUNCTIONS(PKCS7_SIGNED) +DECLARE_ASN1_FUNCTIONS(PKCS7_ENC_CONTENT) +DECLARE_ASN1_FUNCTIONS(PKCS7_ENVELOPE) +DECLARE_ASN1_FUNCTIONS(PKCS7_SIGN_ENVELOPE) +DECLARE_ASN1_FUNCTIONS(PKCS7_DIGEST) +DECLARE_ASN1_FUNCTIONS(PKCS7_ENCRYPT) +DECLARE_ASN1_FUNCTIONS(PKCS7) + +DECLARE_ASN1_ITEM(PKCS7_ATTR_SIGN) +DECLARE_ASN1_ITEM(PKCS7_ATTR_VERIFY) + +DECLARE_ASN1_NDEF_FUNCTION(PKCS7) +DECLARE_ASN1_PRINT_FUNCTION(PKCS7) + +long PKCS7_ctrl(PKCS7 *p7, int cmd, long larg, char *parg); + +int PKCS7_set_type(PKCS7 *p7, int type); +int PKCS7_set0_type_other(PKCS7 *p7, int type, ASN1_TYPE *other); +int PKCS7_set_content(PKCS7 *p7, PKCS7 *p7_data); +int PKCS7_SIGNER_INFO_set(PKCS7_SIGNER_INFO *p7i, X509 *x509, EVP_PKEY *pkey, + const EVP_MD *dgst); +int PKCS7_SIGNER_INFO_sign(PKCS7_SIGNER_INFO *si); +int PKCS7_add_signer(PKCS7 *p7, PKCS7_SIGNER_INFO *p7i); +int PKCS7_add_certificate(PKCS7 *p7, X509 *x509); +int PKCS7_add_crl(PKCS7 *p7, X509_CRL *x509); +int PKCS7_content_new(PKCS7 *p7, int nid); +int PKCS7_dataVerify(X509_STORE *cert_store, X509_STORE_CTX *ctx, + BIO *bio, PKCS7 *p7, PKCS7_SIGNER_INFO *si); +int PKCS7_signatureVerify(BIO *bio, PKCS7 *p7, PKCS7_SIGNER_INFO *si, + X509 *x509); + +BIO *PKCS7_dataInit(PKCS7 *p7, BIO *bio); +int PKCS7_dataFinal(PKCS7 *p7, BIO *bio); +BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert); + +PKCS7_SIGNER_INFO *PKCS7_add_signature(PKCS7 *p7, X509 *x509, + EVP_PKEY *pkey, const EVP_MD *dgst); +X509 *PKCS7_cert_from_signer_info(PKCS7 *p7, PKCS7_SIGNER_INFO *si); +int PKCS7_set_digest(PKCS7 *p7, const EVP_MD *md); +STACK_OF(PKCS7_SIGNER_INFO) *PKCS7_get_signer_info(PKCS7 *p7); + +PKCS7_RECIP_INFO *PKCS7_add_recipient(PKCS7 *p7, X509 *x509); +void PKCS7_SIGNER_INFO_get0_algs(PKCS7_SIGNER_INFO *si, EVP_PKEY **pk, + X509_ALGOR **pdig, X509_ALGOR **psig); +void PKCS7_RECIP_INFO_get0_alg(PKCS7_RECIP_INFO *ri, X509_ALGOR **penc); +int PKCS7_add_recipient_info(PKCS7 *p7, PKCS7_RECIP_INFO *ri); +int PKCS7_RECIP_INFO_set(PKCS7_RECIP_INFO *p7i, X509 *x509); +int PKCS7_set_cipher(PKCS7 *p7, const EVP_CIPHER *cipher); +int PKCS7_stream(unsigned char ***boundary, PKCS7 *p7); + +PKCS7_ISSUER_AND_SERIAL *PKCS7_get_issuer_and_serial(PKCS7 *p7, int idx); +ASN1_OCTET_STRING *PKCS7_digest_from_attributes(STACK_OF(X509_ATTRIBUTE) *sk); +int PKCS7_add_signed_attribute(PKCS7_SIGNER_INFO *p7si, int nid, int type, + void *data); +int PKCS7_add_attribute(PKCS7_SIGNER_INFO *p7si, int nid, int atrtype, + void *value); +ASN1_TYPE *PKCS7_get_attribute(PKCS7_SIGNER_INFO *si, int nid); +ASN1_TYPE *PKCS7_get_signed_attribute(PKCS7_SIGNER_INFO *si, int nid); +int PKCS7_set_signed_attributes(PKCS7_SIGNER_INFO *p7si, + STACK_OF(X509_ATTRIBUTE) *sk); +int PKCS7_set_attributes(PKCS7_SIGNER_INFO *p7si, + STACK_OF(X509_ATTRIBUTE) *sk); + +PKCS7 *PKCS7_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs, + BIO *data, int flags); + +PKCS7_SIGNER_INFO *PKCS7_sign_add_signer(PKCS7 *p7, + X509 *signcert, EVP_PKEY *pkey, + const EVP_MD *md, int flags); + +int PKCS7_final(PKCS7 *p7, BIO *data, int flags); +int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store, + BIO *indata, BIO *out, int flags); +STACK_OF(X509) *PKCS7_get0_signers(PKCS7 *p7, STACK_OF(X509) *certs, + int flags); +PKCS7 *PKCS7_encrypt(STACK_OF(X509) *certs, BIO *in, const EVP_CIPHER *cipher, + int flags); +int PKCS7_decrypt(PKCS7 *p7, EVP_PKEY *pkey, X509 *cert, BIO *data, + int flags); + +int PKCS7_add_attrib_smimecap(PKCS7_SIGNER_INFO *si, + STACK_OF(X509_ALGOR) *cap); +STACK_OF(X509_ALGOR) *PKCS7_get_smimecap(PKCS7_SIGNER_INFO *si); +int PKCS7_simple_smimecap(STACK_OF(X509_ALGOR) *sk, int nid, int arg); + +int PKCS7_add_attrib_content_type(PKCS7_SIGNER_INFO *si, ASN1_OBJECT *coid); +int PKCS7_add0_attrib_signing_time(PKCS7_SIGNER_INFO *si, ASN1_TIME *t); +int PKCS7_add1_attrib_digest(PKCS7_SIGNER_INFO *si, + const unsigned char *md, int mdlen); + +int SMIME_write_PKCS7(BIO *bio, PKCS7 *p7, BIO *data, int flags); +PKCS7 *SMIME_read_PKCS7(BIO *bio, BIO **bcont); + +BIO *BIO_new_PKCS7(BIO *out, PKCS7 *p7); + +# ifdef __cplusplus +} +# endif +#endif diff --git a/ONVIF/include/openssl/include/openssl/pkcs7err.h b/ONVIF/include/openssl/include/openssl/pkcs7err.h new file mode 100644 index 0000000..02e0299 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/pkcs7err.h @@ -0,0 +1,103 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_PKCS7ERR_H +# define HEADER_PKCS7ERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_PKCS7_strings(void); + +/* + * PKCS7 function codes. + */ +# define PKCS7_F_DO_PKCS7_SIGNED_ATTRIB 136 +# define PKCS7_F_PKCS7_ADD0_ATTRIB_SIGNING_TIME 135 +# define PKCS7_F_PKCS7_ADD_ATTRIB_SMIMECAP 118 +# define PKCS7_F_PKCS7_ADD_CERTIFICATE 100 +# define PKCS7_F_PKCS7_ADD_CRL 101 +# define PKCS7_F_PKCS7_ADD_RECIPIENT_INFO 102 +# define PKCS7_F_PKCS7_ADD_SIGNATURE 131 +# define PKCS7_F_PKCS7_ADD_SIGNER 103 +# define PKCS7_F_PKCS7_BIO_ADD_DIGEST 125 +# define PKCS7_F_PKCS7_COPY_EXISTING_DIGEST 138 +# define PKCS7_F_PKCS7_CTRL 104 +# define PKCS7_F_PKCS7_DATADECODE 112 +# define PKCS7_F_PKCS7_DATAFINAL 128 +# define PKCS7_F_PKCS7_DATAINIT 105 +# define PKCS7_F_PKCS7_DATAVERIFY 107 +# define PKCS7_F_PKCS7_DECRYPT 114 +# define PKCS7_F_PKCS7_DECRYPT_RINFO 133 +# define PKCS7_F_PKCS7_ENCODE_RINFO 132 +# define PKCS7_F_PKCS7_ENCRYPT 115 +# define PKCS7_F_PKCS7_FINAL 134 +# define PKCS7_F_PKCS7_FIND_DIGEST 127 +# define PKCS7_F_PKCS7_GET0_SIGNERS 124 +# define PKCS7_F_PKCS7_RECIP_INFO_SET 130 +# define PKCS7_F_PKCS7_SET_CIPHER 108 +# define PKCS7_F_PKCS7_SET_CONTENT 109 +# define PKCS7_F_PKCS7_SET_DIGEST 126 +# define PKCS7_F_PKCS7_SET_TYPE 110 +# define PKCS7_F_PKCS7_SIGN 116 +# define PKCS7_F_PKCS7_SIGNATUREVERIFY 113 +# define PKCS7_F_PKCS7_SIGNER_INFO_SET 129 +# define PKCS7_F_PKCS7_SIGNER_INFO_SIGN 139 +# define PKCS7_F_PKCS7_SIGN_ADD_SIGNER 137 +# define PKCS7_F_PKCS7_SIMPLE_SMIMECAP 119 +# define PKCS7_F_PKCS7_VERIFY 117 + +/* + * PKCS7 reason codes. + */ +# define PKCS7_R_CERTIFICATE_VERIFY_ERROR 117 +# define PKCS7_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER 144 +# define PKCS7_R_CIPHER_NOT_INITIALIZED 116 +# define PKCS7_R_CONTENT_AND_DATA_PRESENT 118 +# define PKCS7_R_CTRL_ERROR 152 +# define PKCS7_R_DECRYPT_ERROR 119 +# define PKCS7_R_DIGEST_FAILURE 101 +# define PKCS7_R_ENCRYPTION_CTRL_FAILURE 149 +# define PKCS7_R_ENCRYPTION_NOT_SUPPORTED_FOR_THIS_KEY_TYPE 150 +# define PKCS7_R_ERROR_ADDING_RECIPIENT 120 +# define PKCS7_R_ERROR_SETTING_CIPHER 121 +# define PKCS7_R_INVALID_NULL_POINTER 143 +# define PKCS7_R_INVALID_SIGNED_DATA_TYPE 155 +# define PKCS7_R_NO_CONTENT 122 +# define PKCS7_R_NO_DEFAULT_DIGEST 151 +# define PKCS7_R_NO_MATCHING_DIGEST_TYPE_FOUND 154 +# define PKCS7_R_NO_RECIPIENT_MATCHES_CERTIFICATE 115 +# define PKCS7_R_NO_SIGNATURES_ON_DATA 123 +# define PKCS7_R_NO_SIGNERS 142 +# define PKCS7_R_OPERATION_NOT_SUPPORTED_ON_THIS_TYPE 104 +# define PKCS7_R_PKCS7_ADD_SIGNATURE_ERROR 124 +# define PKCS7_R_PKCS7_ADD_SIGNER_ERROR 153 +# define PKCS7_R_PKCS7_DATASIGN 145 +# define PKCS7_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 127 +# define PKCS7_R_SIGNATURE_FAILURE 105 +# define PKCS7_R_SIGNER_CERTIFICATE_NOT_FOUND 128 +# define PKCS7_R_SIGNING_CTRL_FAILURE 147 +# define PKCS7_R_SIGNING_NOT_SUPPORTED_FOR_THIS_KEY_TYPE 148 +# define PKCS7_R_SMIME_TEXT_ERROR 129 +# define PKCS7_R_UNABLE_TO_FIND_CERTIFICATE 106 +# define PKCS7_R_UNABLE_TO_FIND_MEM_BIO 107 +# define PKCS7_R_UNABLE_TO_FIND_MESSAGE_DIGEST 108 +# define PKCS7_R_UNKNOWN_DIGEST_TYPE 109 +# define PKCS7_R_UNKNOWN_OPERATION 110 +# define PKCS7_R_UNSUPPORTED_CIPHER_TYPE 111 +# define PKCS7_R_UNSUPPORTED_CONTENT_TYPE 112 +# define PKCS7_R_WRONG_CONTENT_TYPE 113 +# define PKCS7_R_WRONG_PKCS7_TYPE 114 + +#endif diff --git a/ONVIF/include/openssl/include/openssl/rand.h b/ONVIF/include/openssl/include/openssl/rand.h new file mode 100644 index 0000000..38a2a27 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/rand.h @@ -0,0 +1,77 @@ +/* + * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_RAND_H +# define HEADER_RAND_H + +# include +# include +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + +struct rand_meth_st { + int (*seed) (const void *buf, int num); + int (*bytes) (unsigned char *buf, int num); + void (*cleanup) (void); + int (*add) (const void *buf, int num, double randomness); + int (*pseudorand) (unsigned char *buf, int num); + int (*status) (void); +}; + +int RAND_set_rand_method(const RAND_METHOD *meth); +const RAND_METHOD *RAND_get_rand_method(void); +# ifndef OPENSSL_NO_ENGINE +int RAND_set_rand_engine(ENGINE *engine); +# endif + +RAND_METHOD *RAND_OpenSSL(void); + +# if OPENSSL_API_COMPAT < 0x10100000L +# define RAND_cleanup() while(0) continue +# endif +int RAND_bytes(unsigned char *buf, int num); +int RAND_priv_bytes(unsigned char *buf, int num); +DEPRECATEDIN_1_1_0(int RAND_pseudo_bytes(unsigned char *buf, int num)) + +void RAND_seed(const void *buf, int num); +void RAND_keep_random_devices_open(int keep); + +# if defined(__ANDROID__) && defined(__NDK_FPABI__) +__NDK_FPABI__ /* __attribute__((pcs("aapcs"))) on ARM */ +# endif +void RAND_add(const void *buf, int num, double randomness); +int RAND_load_file(const char *file, long max_bytes); +int RAND_write_file(const char *file); +const char *RAND_file_name(char *file, size_t num); +int RAND_status(void); + +# ifndef OPENSSL_NO_EGD +int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes); +int RAND_egd(const char *path); +int RAND_egd_bytes(const char *path, int bytes); +# endif + +int RAND_poll(void); + +# if defined(_WIN32) && (defined(BASETYPES) || defined(_WINDEF_H)) +/* application has to include in order to use these */ +DEPRECATEDIN_1_1_0(void RAND_screen(void)) +DEPRECATEDIN_1_1_0(int RAND_event(UINT, WPARAM, LPARAM)) +# endif + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/ONVIF/include/openssl/include/openssl/rand_drbg.h b/ONVIF/include/openssl/include/openssl/rand_drbg.h new file mode 100644 index 0000000..45b731b --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/rand_drbg.h @@ -0,0 +1,130 @@ +/* + * Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_DRBG_RAND_H +# define HEADER_DRBG_RAND_H + +# include +# include +# include + +/* + * RAND_DRBG flags + * + * Note: if new flags are added, the constant `rand_drbg_used_flags` + * in drbg_lib.c needs to be updated accordingly. + */ + +/* In CTR mode, disable derivation function ctr_df */ +# define RAND_DRBG_FLAG_CTR_NO_DF 0x1 + + +# if OPENSSL_API_COMPAT < 0x10200000L +/* This #define was replaced by an internal constant and should not be used. */ +# define RAND_DRBG_USED_FLAGS (RAND_DRBG_FLAG_CTR_NO_DF) +# endif + +/* + * Default security strength (in the sense of [NIST SP 800-90Ar1]) + * + * NIST SP 800-90Ar1 supports the strength of the DRBG being smaller than that + * of the cipher by collecting less entropy. The current DRBG implementation + * does not take RAND_DRBG_STRENGTH into account and sets the strength of the + * DRBG to that of the cipher. + * + * RAND_DRBG_STRENGTH is currently only used for the legacy RAND + * implementation. + * + * Currently supported ciphers are: NID_aes_128_ctr, NID_aes_192_ctr and + * NID_aes_256_ctr + */ +# define RAND_DRBG_STRENGTH 256 +/* Default drbg type */ +# define RAND_DRBG_TYPE NID_aes_256_ctr +/* Default drbg flags */ +# define RAND_DRBG_FLAGS 0 + + +# ifdef __cplusplus +extern "C" { +# endif + +/* + * Object lifetime functions. + */ +RAND_DRBG *RAND_DRBG_new(int type, unsigned int flags, RAND_DRBG *parent); +RAND_DRBG *RAND_DRBG_secure_new(int type, unsigned int flags, RAND_DRBG *parent); +int RAND_DRBG_set(RAND_DRBG *drbg, int type, unsigned int flags); +int RAND_DRBG_set_defaults(int type, unsigned int flags); +int RAND_DRBG_instantiate(RAND_DRBG *drbg, + const unsigned char *pers, size_t perslen); +int RAND_DRBG_uninstantiate(RAND_DRBG *drbg); +void RAND_DRBG_free(RAND_DRBG *drbg); + +/* + * Object "use" functions. + */ +int RAND_DRBG_reseed(RAND_DRBG *drbg, + const unsigned char *adin, size_t adinlen, + int prediction_resistance); +int RAND_DRBG_generate(RAND_DRBG *drbg, unsigned char *out, size_t outlen, + int prediction_resistance, + const unsigned char *adin, size_t adinlen); +int RAND_DRBG_bytes(RAND_DRBG *drbg, unsigned char *out, size_t outlen); + +int RAND_DRBG_set_reseed_interval(RAND_DRBG *drbg, unsigned int interval); +int RAND_DRBG_set_reseed_time_interval(RAND_DRBG *drbg, time_t interval); + +int RAND_DRBG_set_reseed_defaults( + unsigned int master_reseed_interval, + unsigned int slave_reseed_interval, + time_t master_reseed_time_interval, + time_t slave_reseed_time_interval + ); + +RAND_DRBG *RAND_DRBG_get0_master(void); +RAND_DRBG *RAND_DRBG_get0_public(void); +RAND_DRBG *RAND_DRBG_get0_private(void); + +/* + * EXDATA + */ +# define RAND_DRBG_get_ex_new_index(l, p, newf, dupf, freef) \ + CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_DRBG, l, p, newf, dupf, freef) +int RAND_DRBG_set_ex_data(RAND_DRBG *drbg, int idx, void *arg); +void *RAND_DRBG_get_ex_data(const RAND_DRBG *drbg, int idx); + +/* + * Callback function typedefs + */ +typedef size_t (*RAND_DRBG_get_entropy_fn)(RAND_DRBG *drbg, + unsigned char **pout, + int entropy, size_t min_len, + size_t max_len, + int prediction_resistance); +typedef void (*RAND_DRBG_cleanup_entropy_fn)(RAND_DRBG *ctx, + unsigned char *out, size_t outlen); +typedef size_t (*RAND_DRBG_get_nonce_fn)(RAND_DRBG *drbg, unsigned char **pout, + int entropy, size_t min_len, + size_t max_len); +typedef void (*RAND_DRBG_cleanup_nonce_fn)(RAND_DRBG *drbg, + unsigned char *out, size_t outlen); + +int RAND_DRBG_set_callbacks(RAND_DRBG *drbg, + RAND_DRBG_get_entropy_fn get_entropy, + RAND_DRBG_cleanup_entropy_fn cleanup_entropy, + RAND_DRBG_get_nonce_fn get_nonce, + RAND_DRBG_cleanup_nonce_fn cleanup_nonce); + + +# ifdef __cplusplus +} +# endif + +#endif diff --git a/ONVIF/include/openssl/include/openssl/randerr.h b/ONVIF/include/openssl/include/openssl/randerr.h new file mode 100644 index 0000000..79d5790 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/randerr.h @@ -0,0 +1,94 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_RANDERR_H +# define HEADER_RANDERR_H + +# include + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_RAND_strings(void); + +/* + * RAND function codes. + */ +# define RAND_F_DATA_COLLECT_METHOD 127 +# define RAND_F_DRBG_BYTES 101 +# define RAND_F_DRBG_GET_ENTROPY 105 +# define RAND_F_DRBG_SETUP 117 +# define RAND_F_GET_ENTROPY 106 +# define RAND_F_RAND_BYTES 100 +# define RAND_F_RAND_DRBG_ENABLE_LOCKING 119 +# define RAND_F_RAND_DRBG_GENERATE 107 +# define RAND_F_RAND_DRBG_GET_ENTROPY 120 +# define RAND_F_RAND_DRBG_GET_NONCE 123 +# define RAND_F_RAND_DRBG_INSTANTIATE 108 +# define RAND_F_RAND_DRBG_NEW 109 +# define RAND_F_RAND_DRBG_RESEED 110 +# define RAND_F_RAND_DRBG_RESTART 102 +# define RAND_F_RAND_DRBG_SET 104 +# define RAND_F_RAND_DRBG_SET_DEFAULTS 121 +# define RAND_F_RAND_DRBG_UNINSTANTIATE 118 +# define RAND_F_RAND_LOAD_FILE 111 +# define RAND_F_RAND_POOL_ACQUIRE_ENTROPY 122 +# define RAND_F_RAND_POOL_ADD 103 +# define RAND_F_RAND_POOL_ADD_BEGIN 113 +# define RAND_F_RAND_POOL_ADD_END 114 +# define RAND_F_RAND_POOL_ATTACH 124 +# define RAND_F_RAND_POOL_BYTES_NEEDED 115 +# define RAND_F_RAND_POOL_GROW 125 +# define RAND_F_RAND_POOL_NEW 116 +# define RAND_F_RAND_PSEUDO_BYTES 126 +# define RAND_F_RAND_WRITE_FILE 112 + +/* + * RAND reason codes. + */ +# define RAND_R_ADDITIONAL_INPUT_TOO_LONG 102 +# define RAND_R_ALREADY_INSTANTIATED 103 +# define RAND_R_ARGUMENT_OUT_OF_RANGE 105 +# define RAND_R_CANNOT_OPEN_FILE 121 +# define RAND_R_DRBG_ALREADY_INITIALIZED 129 +# define RAND_R_DRBG_NOT_INITIALISED 104 +# define RAND_R_ENTROPY_INPUT_TOO_LONG 106 +# define RAND_R_ENTROPY_OUT_OF_RANGE 124 +# define RAND_R_ERROR_ENTROPY_POOL_WAS_IGNORED 127 +# define RAND_R_ERROR_INITIALISING_DRBG 107 +# define RAND_R_ERROR_INSTANTIATING_DRBG 108 +# define RAND_R_ERROR_RETRIEVING_ADDITIONAL_INPUT 109 +# define RAND_R_ERROR_RETRIEVING_ENTROPY 110 +# define RAND_R_ERROR_RETRIEVING_NONCE 111 +# define RAND_R_FAILED_TO_CREATE_LOCK 126 +# define RAND_R_FUNC_NOT_IMPLEMENTED 101 +# define RAND_R_FWRITE_ERROR 123 +# define RAND_R_GENERATE_ERROR 112 +# define RAND_R_INTERNAL_ERROR 113 +# define RAND_R_IN_ERROR_STATE 114 +# define RAND_R_NOT_A_REGULAR_FILE 122 +# define RAND_R_NOT_INSTANTIATED 115 +# define RAND_R_NO_DRBG_IMPLEMENTATION_SELECTED 128 +# define RAND_R_PARENT_LOCKING_NOT_ENABLED 130 +# define RAND_R_PARENT_STRENGTH_TOO_WEAK 131 +# define RAND_R_PERSONALISATION_STRING_TOO_LONG 116 +# define RAND_R_PREDICTION_RESISTANCE_NOT_SUPPORTED 133 +# define RAND_R_PRNG_NOT_SEEDED 100 +# define RAND_R_RANDOM_POOL_OVERFLOW 125 +# define RAND_R_RANDOM_POOL_UNDERFLOW 134 +# define RAND_R_REQUEST_TOO_LARGE_FOR_DRBG 117 +# define RAND_R_RESEED_ERROR 118 +# define RAND_R_SELFTEST_FAILURE 119 +# define RAND_R_TOO_LITTLE_NONCE_REQUESTED 135 +# define RAND_R_TOO_MUCH_NONCE_REQUESTED 136 +# define RAND_R_UNSUPPORTED_DRBG_FLAGS 132 +# define RAND_R_UNSUPPORTED_DRBG_TYPE 120 + +#endif diff --git a/ONVIF/include/openssl/include/openssl/rc2.h b/ONVIF/include/openssl/include/openssl/rc2.h new file mode 100644 index 0000000..585f9e4 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/rc2.h @@ -0,0 +1,51 @@ +/* + * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_RC2_H +# define HEADER_RC2_H + +# include + +# ifndef OPENSSL_NO_RC2 +# ifdef __cplusplus +extern "C" { +# endif + +typedef unsigned int RC2_INT; + +# define RC2_ENCRYPT 1 +# define RC2_DECRYPT 0 + +# define RC2_BLOCK 8 +# define RC2_KEY_LENGTH 16 + +typedef struct rc2_key_st { + RC2_INT data[64]; +} RC2_KEY; + +void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data, int bits); +void RC2_ecb_encrypt(const unsigned char *in, unsigned char *out, + RC2_KEY *key, int enc); +void RC2_encrypt(unsigned long *data, RC2_KEY *key); +void RC2_decrypt(unsigned long *data, RC2_KEY *key); +void RC2_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, + RC2_KEY *ks, unsigned char *iv, int enc); +void RC2_cfb64_encrypt(const unsigned char *in, unsigned char *out, + long length, RC2_KEY *schedule, unsigned char *ivec, + int *num, int enc); +void RC2_ofb64_encrypt(const unsigned char *in, unsigned char *out, + long length, RC2_KEY *schedule, unsigned char *ivec, + int *num); + +# ifdef __cplusplus +} +# endif +# endif + +#endif diff --git a/ONVIF/include/openssl/include/openssl/rc4.h b/ONVIF/include/openssl/include/openssl/rc4.h new file mode 100644 index 0000000..86803b3 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/rc4.h @@ -0,0 +1,36 @@ +/* + * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_RC4_H +# define HEADER_RC4_H + +# include + +# ifndef OPENSSL_NO_RC4 +# include +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct rc4_key_st { + RC4_INT x, y; + RC4_INT data[256]; +} RC4_KEY; + +const char *RC4_options(void); +void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data); +void RC4(RC4_KEY *key, size_t len, const unsigned char *indata, + unsigned char *outdata); + +# ifdef __cplusplus +} +# endif +# endif + +#endif diff --git a/ONVIF/include/openssl/include/openssl/rc5.h b/ONVIF/include/openssl/include/openssl/rc5.h new file mode 100644 index 0000000..793f88e --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/rc5.h @@ -0,0 +1,63 @@ +/* + * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_RC5_H +# define HEADER_RC5_H + +# include + +# ifndef OPENSSL_NO_RC5 +# ifdef __cplusplus +extern "C" { +# endif + +# define RC5_ENCRYPT 1 +# define RC5_DECRYPT 0 + +# define RC5_32_INT unsigned int + +# define RC5_32_BLOCK 8 +# define RC5_32_KEY_LENGTH 16/* This is a default, max is 255 */ + +/* + * This are the only values supported. Tweak the code if you want more The + * most supported modes will be RC5-32/12/16 RC5-32/16/8 + */ +# define RC5_8_ROUNDS 8 +# define RC5_12_ROUNDS 12 +# define RC5_16_ROUNDS 16 + +typedef struct rc5_key_st { + /* Number of rounds */ + int rounds; + RC5_32_INT data[2 * (RC5_16_ROUNDS + 1)]; +} RC5_32_KEY; + +void RC5_32_set_key(RC5_32_KEY *key, int len, const unsigned char *data, + int rounds); +void RC5_32_ecb_encrypt(const unsigned char *in, unsigned char *out, + RC5_32_KEY *key, int enc); +void RC5_32_encrypt(unsigned long *data, RC5_32_KEY *key); +void RC5_32_decrypt(unsigned long *data, RC5_32_KEY *key); +void RC5_32_cbc_encrypt(const unsigned char *in, unsigned char *out, + long length, RC5_32_KEY *ks, unsigned char *iv, + int enc); +void RC5_32_cfb64_encrypt(const unsigned char *in, unsigned char *out, + long length, RC5_32_KEY *schedule, + unsigned char *ivec, int *num, int enc); +void RC5_32_ofb64_encrypt(const unsigned char *in, unsigned char *out, + long length, RC5_32_KEY *schedule, + unsigned char *ivec, int *num); + +# ifdef __cplusplus +} +# endif +# endif + +#endif diff --git a/ONVIF/include/openssl/include/openssl/ripemd.h b/ONVIF/include/openssl/include/openssl/ripemd.h new file mode 100644 index 0000000..c42026a --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/ripemd.h @@ -0,0 +1,47 @@ +/* + * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_RIPEMD_H +# define HEADER_RIPEMD_H + +# include + +#ifndef OPENSSL_NO_RMD160 +# include +# include +# ifdef __cplusplus +extern "C" { +# endif + +# define RIPEMD160_LONG unsigned int + +# define RIPEMD160_CBLOCK 64 +# define RIPEMD160_LBLOCK (RIPEMD160_CBLOCK/4) +# define RIPEMD160_DIGEST_LENGTH 20 + +typedef struct RIPEMD160state_st { + RIPEMD160_LONG A, B, C, D, E; + RIPEMD160_LONG Nl, Nh; + RIPEMD160_LONG data[RIPEMD160_LBLOCK]; + unsigned int num; +} RIPEMD160_CTX; + +int RIPEMD160_Init(RIPEMD160_CTX *c); +int RIPEMD160_Update(RIPEMD160_CTX *c, const void *data, size_t len); +int RIPEMD160_Final(unsigned char *md, RIPEMD160_CTX *c); +unsigned char *RIPEMD160(const unsigned char *d, size_t n, unsigned char *md); +void RIPEMD160_Transform(RIPEMD160_CTX *c, const unsigned char *b); + +# ifdef __cplusplus +} +# endif +# endif + + +#endif diff --git a/ONVIF/include/openssl/include/openssl/rsa.h b/ONVIF/include/openssl/include/openssl/rsa.h new file mode 100644 index 0000000..5e76365 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/rsa.h @@ -0,0 +1,513 @@ +/* + * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_RSA_H +# define HEADER_RSA_H + +# include + +# ifndef OPENSSL_NO_RSA +# include +# include +# include +# include +# if OPENSSL_API_COMPAT < 0x10100000L +# include +# endif +# include +# ifdef __cplusplus +extern "C" { +# endif + +/* The types RSA and RSA_METHOD are defined in ossl_typ.h */ + +# ifndef OPENSSL_RSA_MAX_MODULUS_BITS +# define OPENSSL_RSA_MAX_MODULUS_BITS 16384 +# endif + +# define OPENSSL_RSA_FIPS_MIN_MODULUS_BITS 1024 + +# ifndef OPENSSL_RSA_SMALL_MODULUS_BITS +# define OPENSSL_RSA_SMALL_MODULUS_BITS 3072 +# endif +# ifndef OPENSSL_RSA_MAX_PUBEXP_BITS + +/* exponent limit enforced for "large" modulus only */ +# define OPENSSL_RSA_MAX_PUBEXP_BITS 64 +# endif + +# define RSA_3 0x3L +# define RSA_F4 0x10001L + +/* based on RFC 8017 appendix A.1.2 */ +# define RSA_ASN1_VERSION_DEFAULT 0 +# define RSA_ASN1_VERSION_MULTI 1 + +# define RSA_DEFAULT_PRIME_NUM 2 + +# define RSA_METHOD_FLAG_NO_CHECK 0x0001/* don't check pub/private + * match */ + +# define RSA_FLAG_CACHE_PUBLIC 0x0002 +# define RSA_FLAG_CACHE_PRIVATE 0x0004 +# define RSA_FLAG_BLINDING 0x0008 +# define RSA_FLAG_THREAD_SAFE 0x0010 +/* + * This flag means the private key operations will be handled by rsa_mod_exp + * and that they do not depend on the private key components being present: + * for example a key stored in external hardware. Without this flag + * bn_mod_exp gets called when private key components are absent. + */ +# define RSA_FLAG_EXT_PKEY 0x0020 + +/* + * new with 0.9.6j and 0.9.7b; the built-in + * RSA implementation now uses blinding by + * default (ignoring RSA_FLAG_BLINDING), + * but other engines might not need it + */ +# define RSA_FLAG_NO_BLINDING 0x0080 +# if OPENSSL_API_COMPAT < 0x10100000L +/* + * Does nothing. Previously this switched off constant time behaviour. + */ +# define RSA_FLAG_NO_CONSTTIME 0x0000 +# endif +# if OPENSSL_API_COMPAT < 0x00908000L +/* deprecated name for the flag*/ +/* + * new with 0.9.7h; the built-in RSA + * implementation now uses constant time + * modular exponentiation for secret exponents + * by default. This flag causes the + * faster variable sliding window method to + * be used for all exponents. + */ +# define RSA_FLAG_NO_EXP_CONSTTIME RSA_FLAG_NO_CONSTTIME +# endif + +# define EVP_PKEY_CTX_set_rsa_padding(ctx, pad) \ + RSA_pkey_ctx_ctrl(ctx, -1, EVP_PKEY_CTRL_RSA_PADDING, pad, NULL) + +# define EVP_PKEY_CTX_get_rsa_padding(ctx, ppad) \ + RSA_pkey_ctx_ctrl(ctx, -1, EVP_PKEY_CTRL_GET_RSA_PADDING, 0, ppad) + +# define EVP_PKEY_CTX_set_rsa_pss_saltlen(ctx, len) \ + RSA_pkey_ctx_ctrl(ctx, (EVP_PKEY_OP_SIGN|EVP_PKEY_OP_VERIFY), \ + EVP_PKEY_CTRL_RSA_PSS_SALTLEN, len, NULL) +/* Salt length matches digest */ +# define RSA_PSS_SALTLEN_DIGEST -1 +/* Verify only: auto detect salt length */ +# define RSA_PSS_SALTLEN_AUTO -2 +/* Set salt length to maximum possible */ +# define RSA_PSS_SALTLEN_MAX -3 +/* Old compatible max salt length for sign only */ +# define RSA_PSS_SALTLEN_MAX_SIGN -2 + +# define EVP_PKEY_CTX_set_rsa_pss_keygen_saltlen(ctx, len) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA_PSS, EVP_PKEY_OP_KEYGEN, \ + EVP_PKEY_CTRL_RSA_PSS_SALTLEN, len, NULL) + +# define EVP_PKEY_CTX_get_rsa_pss_saltlen(ctx, plen) \ + RSA_pkey_ctx_ctrl(ctx, (EVP_PKEY_OP_SIGN|EVP_PKEY_OP_VERIFY), \ + EVP_PKEY_CTRL_GET_RSA_PSS_SALTLEN, 0, plen) + +# define EVP_PKEY_CTX_set_rsa_keygen_bits(ctx, bits) \ + RSA_pkey_ctx_ctrl(ctx, EVP_PKEY_OP_KEYGEN, \ + EVP_PKEY_CTRL_RSA_KEYGEN_BITS, bits, NULL) + +# define EVP_PKEY_CTX_set_rsa_keygen_pubexp(ctx, pubexp) \ + RSA_pkey_ctx_ctrl(ctx, EVP_PKEY_OP_KEYGEN, \ + EVP_PKEY_CTRL_RSA_KEYGEN_PUBEXP, 0, pubexp) + +# define EVP_PKEY_CTX_set_rsa_keygen_primes(ctx, primes) \ + RSA_pkey_ctx_ctrl(ctx, EVP_PKEY_OP_KEYGEN, \ + EVP_PKEY_CTRL_RSA_KEYGEN_PRIMES, primes, NULL) + +# define EVP_PKEY_CTX_set_rsa_mgf1_md(ctx, md) \ + RSA_pkey_ctx_ctrl(ctx, EVP_PKEY_OP_TYPE_SIG | EVP_PKEY_OP_TYPE_CRYPT, \ + EVP_PKEY_CTRL_RSA_MGF1_MD, 0, (void *)(md)) + +# define EVP_PKEY_CTX_set_rsa_pss_keygen_mgf1_md(ctx, md) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA_PSS, EVP_PKEY_OP_KEYGEN, \ + EVP_PKEY_CTRL_RSA_MGF1_MD, 0, (void *)(md)) + +# define EVP_PKEY_CTX_set_rsa_oaep_md(ctx, md) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_TYPE_CRYPT, \ + EVP_PKEY_CTRL_RSA_OAEP_MD, 0, (void *)(md)) + +# define EVP_PKEY_CTX_get_rsa_mgf1_md(ctx, pmd) \ + RSA_pkey_ctx_ctrl(ctx, EVP_PKEY_OP_TYPE_SIG | EVP_PKEY_OP_TYPE_CRYPT, \ + EVP_PKEY_CTRL_GET_RSA_MGF1_MD, 0, (void *)(pmd)) + +# define EVP_PKEY_CTX_get_rsa_oaep_md(ctx, pmd) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_TYPE_CRYPT, \ + EVP_PKEY_CTRL_GET_RSA_OAEP_MD, 0, (void *)(pmd)) + +# define EVP_PKEY_CTX_set0_rsa_oaep_label(ctx, l, llen) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_TYPE_CRYPT, \ + EVP_PKEY_CTRL_RSA_OAEP_LABEL, llen, (void *)(l)) + +# define EVP_PKEY_CTX_get0_rsa_oaep_label(ctx, l) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_TYPE_CRYPT, \ + EVP_PKEY_CTRL_GET_RSA_OAEP_LABEL, 0, (void *)(l)) + +# define EVP_PKEY_CTX_set_rsa_pss_keygen_md(ctx, md) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA_PSS, \ + EVP_PKEY_OP_KEYGEN, EVP_PKEY_CTRL_MD, \ + 0, (void *)(md)) + +# define EVP_PKEY_CTRL_RSA_PADDING (EVP_PKEY_ALG_CTRL + 1) +# define EVP_PKEY_CTRL_RSA_PSS_SALTLEN (EVP_PKEY_ALG_CTRL + 2) + +# define EVP_PKEY_CTRL_RSA_KEYGEN_BITS (EVP_PKEY_ALG_CTRL + 3) +# define EVP_PKEY_CTRL_RSA_KEYGEN_PUBEXP (EVP_PKEY_ALG_CTRL + 4) +# define EVP_PKEY_CTRL_RSA_MGF1_MD (EVP_PKEY_ALG_CTRL + 5) + +# define EVP_PKEY_CTRL_GET_RSA_PADDING (EVP_PKEY_ALG_CTRL + 6) +# define EVP_PKEY_CTRL_GET_RSA_PSS_SALTLEN (EVP_PKEY_ALG_CTRL + 7) +# define EVP_PKEY_CTRL_GET_RSA_MGF1_MD (EVP_PKEY_ALG_CTRL + 8) + +# define EVP_PKEY_CTRL_RSA_OAEP_MD (EVP_PKEY_ALG_CTRL + 9) +# define EVP_PKEY_CTRL_RSA_OAEP_LABEL (EVP_PKEY_ALG_CTRL + 10) + +# define EVP_PKEY_CTRL_GET_RSA_OAEP_MD (EVP_PKEY_ALG_CTRL + 11) +# define EVP_PKEY_CTRL_GET_RSA_OAEP_LABEL (EVP_PKEY_ALG_CTRL + 12) + +# define EVP_PKEY_CTRL_RSA_KEYGEN_PRIMES (EVP_PKEY_ALG_CTRL + 13) + +# define RSA_PKCS1_PADDING 1 +# define RSA_SSLV23_PADDING 2 +# define RSA_NO_PADDING 3 +# define RSA_PKCS1_OAEP_PADDING 4 +# define RSA_X931_PADDING 5 +/* EVP_PKEY_ only */ +# define RSA_PKCS1_PSS_PADDING 6 + +# define RSA_PKCS1_PADDING_SIZE 11 + +# define RSA_set_app_data(s,arg) RSA_set_ex_data(s,0,arg) +# define RSA_get_app_data(s) RSA_get_ex_data(s,0) + +RSA *RSA_new(void); +RSA *RSA_new_method(ENGINE *engine); +int RSA_bits(const RSA *rsa); +int RSA_size(const RSA *rsa); +int RSA_security_bits(const RSA *rsa); + +int RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d); +int RSA_set0_factors(RSA *r, BIGNUM *p, BIGNUM *q); +int RSA_set0_crt_params(RSA *r,BIGNUM *dmp1, BIGNUM *dmq1, BIGNUM *iqmp); +int RSA_set0_multi_prime_params(RSA *r, BIGNUM *primes[], BIGNUM *exps[], + BIGNUM *coeffs[], int pnum); +void RSA_get0_key(const RSA *r, + const BIGNUM **n, const BIGNUM **e, const BIGNUM **d); +void RSA_get0_factors(const RSA *r, const BIGNUM **p, const BIGNUM **q); +int RSA_get_multi_prime_extra_count(const RSA *r); +int RSA_get0_multi_prime_factors(const RSA *r, const BIGNUM *primes[]); +void RSA_get0_crt_params(const RSA *r, + const BIGNUM **dmp1, const BIGNUM **dmq1, + const BIGNUM **iqmp); +int RSA_get0_multi_prime_crt_params(const RSA *r, const BIGNUM *exps[], + const BIGNUM *coeffs[]); +const BIGNUM *RSA_get0_n(const RSA *d); +const BIGNUM *RSA_get0_e(const RSA *d); +const BIGNUM *RSA_get0_d(const RSA *d); +const BIGNUM *RSA_get0_p(const RSA *d); +const BIGNUM *RSA_get0_q(const RSA *d); +const BIGNUM *RSA_get0_dmp1(const RSA *r); +const BIGNUM *RSA_get0_dmq1(const RSA *r); +const BIGNUM *RSA_get0_iqmp(const RSA *r); +const RSA_PSS_PARAMS *RSA_get0_pss_params(const RSA *r); +void RSA_clear_flags(RSA *r, int flags); +int RSA_test_flags(const RSA *r, int flags); +void RSA_set_flags(RSA *r, int flags); +int RSA_get_version(RSA *r); +ENGINE *RSA_get0_engine(const RSA *r); + +/* Deprecated version */ +DEPRECATEDIN_0_9_8(RSA *RSA_generate_key(int bits, unsigned long e, void + (*callback) (int, int, void *), + void *cb_arg)) + +/* New version */ +int RSA_generate_key_ex(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb); +/* Multi-prime version */ +int RSA_generate_multi_prime_key(RSA *rsa, int bits, int primes, + BIGNUM *e, BN_GENCB *cb); + +int RSA_X931_derive_ex(RSA *rsa, BIGNUM *p1, BIGNUM *p2, BIGNUM *q1, + BIGNUM *q2, const BIGNUM *Xp1, const BIGNUM *Xp2, + const BIGNUM *Xp, const BIGNUM *Xq1, const BIGNUM *Xq2, + const BIGNUM *Xq, const BIGNUM *e, BN_GENCB *cb); +int RSA_X931_generate_key_ex(RSA *rsa, int bits, const BIGNUM *e, + BN_GENCB *cb); + +int RSA_check_key(const RSA *); +int RSA_check_key_ex(const RSA *, BN_GENCB *cb); + /* next 4 return -1 on error */ +int RSA_public_encrypt(int flen, const unsigned char *from, + unsigned char *to, RSA *rsa, int padding); +int RSA_private_encrypt(int flen, const unsigned char *from, + unsigned char *to, RSA *rsa, int padding); +int RSA_public_decrypt(int flen, const unsigned char *from, + unsigned char *to, RSA *rsa, int padding); +int RSA_private_decrypt(int flen, const unsigned char *from, + unsigned char *to, RSA *rsa, int padding); +void RSA_free(RSA *r); +/* "up" the RSA object's reference count */ +int RSA_up_ref(RSA *r); + +int RSA_flags(const RSA *r); + +void RSA_set_default_method(const RSA_METHOD *meth); +const RSA_METHOD *RSA_get_default_method(void); +const RSA_METHOD *RSA_null_method(void); +const RSA_METHOD *RSA_get_method(const RSA *rsa); +int RSA_set_method(RSA *rsa, const RSA_METHOD *meth); + +/* these are the actual RSA functions */ +const RSA_METHOD *RSA_PKCS1_OpenSSL(void); + +int RSA_pkey_ctx_ctrl(EVP_PKEY_CTX *ctx, int optype, int cmd, int p1, void *p2); + +DECLARE_ASN1_ENCODE_FUNCTIONS_const(RSA, RSAPublicKey) +DECLARE_ASN1_ENCODE_FUNCTIONS_const(RSA, RSAPrivateKey) + +struct rsa_pss_params_st { + X509_ALGOR *hashAlgorithm; + X509_ALGOR *maskGenAlgorithm; + ASN1_INTEGER *saltLength; + ASN1_INTEGER *trailerField; + /* Decoded hash algorithm from maskGenAlgorithm */ + X509_ALGOR *maskHash; +}; + +DECLARE_ASN1_FUNCTIONS(RSA_PSS_PARAMS) + +typedef struct rsa_oaep_params_st { + X509_ALGOR *hashFunc; + X509_ALGOR *maskGenFunc; + X509_ALGOR *pSourceFunc; + /* Decoded hash algorithm from maskGenFunc */ + X509_ALGOR *maskHash; +} RSA_OAEP_PARAMS; + +DECLARE_ASN1_FUNCTIONS(RSA_OAEP_PARAMS) + +# ifndef OPENSSL_NO_STDIO +int RSA_print_fp(FILE *fp, const RSA *r, int offset); +# endif + +int RSA_print(BIO *bp, const RSA *r, int offset); + +/* + * The following 2 functions sign and verify a X509_SIG ASN1 object inside + * PKCS#1 padded RSA encryption + */ +int RSA_sign(int type, const unsigned char *m, unsigned int m_length, + unsigned char *sigret, unsigned int *siglen, RSA *rsa); +int RSA_verify(int type, const unsigned char *m, unsigned int m_length, + const unsigned char *sigbuf, unsigned int siglen, RSA *rsa); + +/* + * The following 2 function sign and verify a ASN1_OCTET_STRING object inside + * PKCS#1 padded RSA encryption + */ +int RSA_sign_ASN1_OCTET_STRING(int type, + const unsigned char *m, unsigned int m_length, + unsigned char *sigret, unsigned int *siglen, + RSA *rsa); +int RSA_verify_ASN1_OCTET_STRING(int type, const unsigned char *m, + unsigned int m_length, unsigned char *sigbuf, + unsigned int siglen, RSA *rsa); + +int RSA_blinding_on(RSA *rsa, BN_CTX *ctx); +void RSA_blinding_off(RSA *rsa); +BN_BLINDING *RSA_setup_blinding(RSA *rsa, BN_CTX *ctx); + +int RSA_padding_add_PKCS1_type_1(unsigned char *to, int tlen, + const unsigned char *f, int fl); +int RSA_padding_check_PKCS1_type_1(unsigned char *to, int tlen, + const unsigned char *f, int fl, + int rsa_len); +int RSA_padding_add_PKCS1_type_2(unsigned char *to, int tlen, + const unsigned char *f, int fl); +int RSA_padding_check_PKCS1_type_2(unsigned char *to, int tlen, + const unsigned char *f, int fl, + int rsa_len); +int PKCS1_MGF1(unsigned char *mask, long len, const unsigned char *seed, + long seedlen, const EVP_MD *dgst); +int RSA_padding_add_PKCS1_OAEP(unsigned char *to, int tlen, + const unsigned char *f, int fl, + const unsigned char *p, int pl); +int RSA_padding_check_PKCS1_OAEP(unsigned char *to, int tlen, + const unsigned char *f, int fl, int rsa_len, + const unsigned char *p, int pl); +int RSA_padding_add_PKCS1_OAEP_mgf1(unsigned char *to, int tlen, + const unsigned char *from, int flen, + const unsigned char *param, int plen, + const EVP_MD *md, const EVP_MD *mgf1md); +int RSA_padding_check_PKCS1_OAEP_mgf1(unsigned char *to, int tlen, + const unsigned char *from, int flen, + int num, const unsigned char *param, + int plen, const EVP_MD *md, + const EVP_MD *mgf1md); +int RSA_padding_add_SSLv23(unsigned char *to, int tlen, + const unsigned char *f, int fl); +int RSA_padding_check_SSLv23(unsigned char *to, int tlen, + const unsigned char *f, int fl, int rsa_len); +int RSA_padding_add_none(unsigned char *to, int tlen, const unsigned char *f, + int fl); +int RSA_padding_check_none(unsigned char *to, int tlen, + const unsigned char *f, int fl, int rsa_len); +int RSA_padding_add_X931(unsigned char *to, int tlen, const unsigned char *f, + int fl); +int RSA_padding_check_X931(unsigned char *to, int tlen, + const unsigned char *f, int fl, int rsa_len); +int RSA_X931_hash_id(int nid); + +int RSA_verify_PKCS1_PSS(RSA *rsa, const unsigned char *mHash, + const EVP_MD *Hash, const unsigned char *EM, + int sLen); +int RSA_padding_add_PKCS1_PSS(RSA *rsa, unsigned char *EM, + const unsigned char *mHash, const EVP_MD *Hash, + int sLen); + +int RSA_verify_PKCS1_PSS_mgf1(RSA *rsa, const unsigned char *mHash, + const EVP_MD *Hash, const EVP_MD *mgf1Hash, + const unsigned char *EM, int sLen); + +int RSA_padding_add_PKCS1_PSS_mgf1(RSA *rsa, unsigned char *EM, + const unsigned char *mHash, + const EVP_MD *Hash, const EVP_MD *mgf1Hash, + int sLen); + +#define RSA_get_ex_new_index(l, p, newf, dupf, freef) \ + CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_RSA, l, p, newf, dupf, freef) +int RSA_set_ex_data(RSA *r, int idx, void *arg); +void *RSA_get_ex_data(const RSA *r, int idx); + +RSA *RSAPublicKey_dup(RSA *rsa); +RSA *RSAPrivateKey_dup(RSA *rsa); + +/* + * If this flag is set the RSA method is FIPS compliant and can be used in + * FIPS mode. This is set in the validated module method. If an application + * sets this flag in its own methods it is its responsibility to ensure the + * result is compliant. + */ + +# define RSA_FLAG_FIPS_METHOD 0x0400 + +/* + * If this flag is set the operations normally disabled in FIPS mode are + * permitted it is then the applications responsibility to ensure that the + * usage is compliant. + */ + +# define RSA_FLAG_NON_FIPS_ALLOW 0x0400 +/* + * Application has decided PRNG is good enough to generate a key: don't + * check. + */ +# define RSA_FLAG_CHECKED 0x0800 + +RSA_METHOD *RSA_meth_new(const char *name, int flags); +void RSA_meth_free(RSA_METHOD *meth); +RSA_METHOD *RSA_meth_dup(const RSA_METHOD *meth); +const char *RSA_meth_get0_name(const RSA_METHOD *meth); +int RSA_meth_set1_name(RSA_METHOD *meth, const char *name); +int RSA_meth_get_flags(const RSA_METHOD *meth); +int RSA_meth_set_flags(RSA_METHOD *meth, int flags); +void *RSA_meth_get0_app_data(const RSA_METHOD *meth); +int RSA_meth_set0_app_data(RSA_METHOD *meth, void *app_data); +int (*RSA_meth_get_pub_enc(const RSA_METHOD *meth)) + (int flen, const unsigned char *from, + unsigned char *to, RSA *rsa, int padding); +int RSA_meth_set_pub_enc(RSA_METHOD *rsa, + int (*pub_enc) (int flen, const unsigned char *from, + unsigned char *to, RSA *rsa, + int padding)); +int (*RSA_meth_get_pub_dec(const RSA_METHOD *meth)) + (int flen, const unsigned char *from, + unsigned char *to, RSA *rsa, int padding); +int RSA_meth_set_pub_dec(RSA_METHOD *rsa, + int (*pub_dec) (int flen, const unsigned char *from, + unsigned char *to, RSA *rsa, + int padding)); +int (*RSA_meth_get_priv_enc(const RSA_METHOD *meth)) + (int flen, const unsigned char *from, + unsigned char *to, RSA *rsa, int padding); +int RSA_meth_set_priv_enc(RSA_METHOD *rsa, + int (*priv_enc) (int flen, const unsigned char *from, + unsigned char *to, RSA *rsa, + int padding)); +int (*RSA_meth_get_priv_dec(const RSA_METHOD *meth)) + (int flen, const unsigned char *from, + unsigned char *to, RSA *rsa, int padding); +int RSA_meth_set_priv_dec(RSA_METHOD *rsa, + int (*priv_dec) (int flen, const unsigned char *from, + unsigned char *to, RSA *rsa, + int padding)); +int (*RSA_meth_get_mod_exp(const RSA_METHOD *meth)) + (BIGNUM *r0, const BIGNUM *i, RSA *rsa, BN_CTX *ctx); +int RSA_meth_set_mod_exp(RSA_METHOD *rsa, + int (*mod_exp) (BIGNUM *r0, const BIGNUM *i, RSA *rsa, + BN_CTX *ctx)); +int (*RSA_meth_get_bn_mod_exp(const RSA_METHOD *meth)) + (BIGNUM *r, const BIGNUM *a, const BIGNUM *p, + const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); +int RSA_meth_set_bn_mod_exp(RSA_METHOD *rsa, + int (*bn_mod_exp) (BIGNUM *r, + const BIGNUM *a, + const BIGNUM *p, + const BIGNUM *m, + BN_CTX *ctx, + BN_MONT_CTX *m_ctx)); +int (*RSA_meth_get_init(const RSA_METHOD *meth)) (RSA *rsa); +int RSA_meth_set_init(RSA_METHOD *rsa, int (*init) (RSA *rsa)); +int (*RSA_meth_get_finish(const RSA_METHOD *meth)) (RSA *rsa); +int RSA_meth_set_finish(RSA_METHOD *rsa, int (*finish) (RSA *rsa)); +int (*RSA_meth_get_sign(const RSA_METHOD *meth)) + (int type, + const unsigned char *m, unsigned int m_length, + unsigned char *sigret, unsigned int *siglen, + const RSA *rsa); +int RSA_meth_set_sign(RSA_METHOD *rsa, + int (*sign) (int type, const unsigned char *m, + unsigned int m_length, + unsigned char *sigret, unsigned int *siglen, + const RSA *rsa)); +int (*RSA_meth_get_verify(const RSA_METHOD *meth)) + (int dtype, const unsigned char *m, + unsigned int m_length, const unsigned char *sigbuf, + unsigned int siglen, const RSA *rsa); +int RSA_meth_set_verify(RSA_METHOD *rsa, + int (*verify) (int dtype, const unsigned char *m, + unsigned int m_length, + const unsigned char *sigbuf, + unsigned int siglen, const RSA *rsa)); +int (*RSA_meth_get_keygen(const RSA_METHOD *meth)) + (RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb); +int RSA_meth_set_keygen(RSA_METHOD *rsa, + int (*keygen) (RSA *rsa, int bits, BIGNUM *e, + BN_GENCB *cb)); +int (*RSA_meth_get_multi_prime_keygen(const RSA_METHOD *meth)) + (RSA *rsa, int bits, int primes, BIGNUM *e, BN_GENCB *cb); +int RSA_meth_set_multi_prime_keygen(RSA_METHOD *meth, + int (*keygen) (RSA *rsa, int bits, + int primes, BIGNUM *e, + BN_GENCB *cb)); + +# ifdef __cplusplus +} +# endif +# endif +#endif diff --git a/ONVIF/include/openssl/include/openssl/rsaerr.h b/ONVIF/include/openssl/include/openssl/rsaerr.h new file mode 100644 index 0000000..59b15e1 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/rsaerr.h @@ -0,0 +1,167 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_RSAERR_H +# define HEADER_RSAERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_RSA_strings(void); + +/* + * RSA function codes. + */ +# define RSA_F_CHECK_PADDING_MD 140 +# define RSA_F_ENCODE_PKCS1 146 +# define RSA_F_INT_RSA_VERIFY 145 +# define RSA_F_OLD_RSA_PRIV_DECODE 147 +# define RSA_F_PKEY_PSS_INIT 165 +# define RSA_F_PKEY_RSA_CTRL 143 +# define RSA_F_PKEY_RSA_CTRL_STR 144 +# define RSA_F_PKEY_RSA_SIGN 142 +# define RSA_F_PKEY_RSA_VERIFY 149 +# define RSA_F_PKEY_RSA_VERIFYRECOVER 141 +# define RSA_F_RSA_ALGOR_TO_MD 156 +# define RSA_F_RSA_BUILTIN_KEYGEN 129 +# define RSA_F_RSA_CHECK_KEY 123 +# define RSA_F_RSA_CHECK_KEY_EX 160 +# define RSA_F_RSA_CMS_DECRYPT 159 +# define RSA_F_RSA_CMS_VERIFY 158 +# define RSA_F_RSA_ITEM_VERIFY 148 +# define RSA_F_RSA_METH_DUP 161 +# define RSA_F_RSA_METH_NEW 162 +# define RSA_F_RSA_METH_SET1_NAME 163 +# define RSA_F_RSA_MGF1_TO_MD 157 +# define RSA_F_RSA_MULTIP_INFO_NEW 166 +# define RSA_F_RSA_NEW_METHOD 106 +# define RSA_F_RSA_NULL 124 +# define RSA_F_RSA_NULL_PRIVATE_DECRYPT 132 +# define RSA_F_RSA_NULL_PRIVATE_ENCRYPT 133 +# define RSA_F_RSA_NULL_PUBLIC_DECRYPT 134 +# define RSA_F_RSA_NULL_PUBLIC_ENCRYPT 135 +# define RSA_F_RSA_OSSL_PRIVATE_DECRYPT 101 +# define RSA_F_RSA_OSSL_PRIVATE_ENCRYPT 102 +# define RSA_F_RSA_OSSL_PUBLIC_DECRYPT 103 +# define RSA_F_RSA_OSSL_PUBLIC_ENCRYPT 104 +# define RSA_F_RSA_PADDING_ADD_NONE 107 +# define RSA_F_RSA_PADDING_ADD_PKCS1_OAEP 121 +# define RSA_F_RSA_PADDING_ADD_PKCS1_OAEP_MGF1 154 +# define RSA_F_RSA_PADDING_ADD_PKCS1_PSS 125 +# define RSA_F_RSA_PADDING_ADD_PKCS1_PSS_MGF1 152 +# define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_1 108 +# define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_2 109 +# define RSA_F_RSA_PADDING_ADD_SSLV23 110 +# define RSA_F_RSA_PADDING_ADD_X931 127 +# define RSA_F_RSA_PADDING_CHECK_NONE 111 +# define RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP 122 +# define RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP_MGF1 153 +# define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_1 112 +# define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_2 113 +# define RSA_F_RSA_PADDING_CHECK_SSLV23 114 +# define RSA_F_RSA_PADDING_CHECK_X931 128 +# define RSA_F_RSA_PARAM_DECODE 164 +# define RSA_F_RSA_PRINT 115 +# define RSA_F_RSA_PRINT_FP 116 +# define RSA_F_RSA_PRIV_DECODE 150 +# define RSA_F_RSA_PRIV_ENCODE 138 +# define RSA_F_RSA_PSS_GET_PARAM 151 +# define RSA_F_RSA_PSS_TO_CTX 155 +# define RSA_F_RSA_PUB_DECODE 139 +# define RSA_F_RSA_SETUP_BLINDING 136 +# define RSA_F_RSA_SIGN 117 +# define RSA_F_RSA_SIGN_ASN1_OCTET_STRING 118 +# define RSA_F_RSA_VERIFY 119 +# define RSA_F_RSA_VERIFY_ASN1_OCTET_STRING 120 +# define RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1 126 +# define RSA_F_SETUP_TBUF 167 + +/* + * RSA reason codes. + */ +# define RSA_R_ALGORITHM_MISMATCH 100 +# define RSA_R_BAD_E_VALUE 101 +# define RSA_R_BAD_FIXED_HEADER_DECRYPT 102 +# define RSA_R_BAD_PAD_BYTE_COUNT 103 +# define RSA_R_BAD_SIGNATURE 104 +# define RSA_R_BLOCK_TYPE_IS_NOT_01 106 +# define RSA_R_BLOCK_TYPE_IS_NOT_02 107 +# define RSA_R_DATA_GREATER_THAN_MOD_LEN 108 +# define RSA_R_DATA_TOO_LARGE 109 +# define RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE 110 +# define RSA_R_DATA_TOO_LARGE_FOR_MODULUS 132 +# define RSA_R_DATA_TOO_SMALL 111 +# define RSA_R_DATA_TOO_SMALL_FOR_KEY_SIZE 122 +# define RSA_R_DIGEST_DOES_NOT_MATCH 158 +# define RSA_R_DIGEST_NOT_ALLOWED 145 +# define RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY 112 +# define RSA_R_DMP1_NOT_CONGRUENT_TO_D 124 +# define RSA_R_DMQ1_NOT_CONGRUENT_TO_D 125 +# define RSA_R_D_E_NOT_CONGRUENT_TO_1 123 +# define RSA_R_FIRST_OCTET_INVALID 133 +# define RSA_R_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE 144 +# define RSA_R_INVALID_DIGEST 157 +# define RSA_R_INVALID_DIGEST_LENGTH 143 +# define RSA_R_INVALID_HEADER 137 +# define RSA_R_INVALID_LABEL 160 +# define RSA_R_INVALID_MESSAGE_LENGTH 131 +# define RSA_R_INVALID_MGF1_MD 156 +# define RSA_R_INVALID_MULTI_PRIME_KEY 167 +# define RSA_R_INVALID_OAEP_PARAMETERS 161 +# define RSA_R_INVALID_PADDING 138 +# define RSA_R_INVALID_PADDING_MODE 141 +# define RSA_R_INVALID_PSS_PARAMETERS 149 +# define RSA_R_INVALID_PSS_SALTLEN 146 +# define RSA_R_INVALID_SALT_LENGTH 150 +# define RSA_R_INVALID_TRAILER 139 +# define RSA_R_INVALID_X931_DIGEST 142 +# define RSA_R_IQMP_NOT_INVERSE_OF_Q 126 +# define RSA_R_KEY_PRIME_NUM_INVALID 165 +# define RSA_R_KEY_SIZE_TOO_SMALL 120 +# define RSA_R_LAST_OCTET_INVALID 134 +# define RSA_R_MISSING_PRIVATE_KEY 179 +# define RSA_R_MGF1_DIGEST_NOT_ALLOWED 152 +# define RSA_R_MODULUS_TOO_LARGE 105 +# define RSA_R_MP_COEFFICIENT_NOT_INVERSE_OF_R 168 +# define RSA_R_MP_EXPONENT_NOT_CONGRUENT_TO_D 169 +# define RSA_R_MP_R_NOT_PRIME 170 +# define RSA_R_NO_PUBLIC_EXPONENT 140 +# define RSA_R_NULL_BEFORE_BLOCK_MISSING 113 +# define RSA_R_N_DOES_NOT_EQUAL_PRODUCT_OF_PRIMES 172 +# define RSA_R_N_DOES_NOT_EQUAL_P_Q 127 +# define RSA_R_OAEP_DECODING_ERROR 121 +# define RSA_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE 148 +# define RSA_R_PADDING_CHECK_FAILED 114 +# define RSA_R_PKCS_DECODING_ERROR 159 +# define RSA_R_PSS_SALTLEN_TOO_SMALL 164 +# define RSA_R_P_NOT_PRIME 128 +# define RSA_R_Q_NOT_PRIME 129 +# define RSA_R_RSA_OPERATIONS_NOT_SUPPORTED 130 +# define RSA_R_SLEN_CHECK_FAILED 136 +# define RSA_R_SLEN_RECOVERY_FAILED 135 +# define RSA_R_SSLV3_ROLLBACK_ATTACK 115 +# define RSA_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 116 +# define RSA_R_UNKNOWN_ALGORITHM_TYPE 117 +# define RSA_R_UNKNOWN_DIGEST 166 +# define RSA_R_UNKNOWN_MASK_DIGEST 151 +# define RSA_R_UNKNOWN_PADDING_TYPE 118 +# define RSA_R_UNSUPPORTED_ENCRYPTION_TYPE 162 +# define RSA_R_UNSUPPORTED_LABEL_SOURCE 163 +# define RSA_R_UNSUPPORTED_MASK_ALGORITHM 153 +# define RSA_R_UNSUPPORTED_MASK_PARAMETER 154 +# define RSA_R_UNSUPPORTED_SIGNATURE_TYPE 155 +# define RSA_R_VALUE_MISSING 147 +# define RSA_R_WRONG_SIGNATURE_LENGTH 119 + +#endif diff --git a/ONVIF/include/openssl/include/openssl/safestack.h b/ONVIF/include/openssl/include/openssl/safestack.h new file mode 100644 index 0000000..38b5578 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/safestack.h @@ -0,0 +1,207 @@ +/* + * Copyright 1999-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_SAFESTACK_H +# define HEADER_SAFESTACK_H + +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + +# define STACK_OF(type) struct stack_st_##type + +# define SKM_DEFINE_STACK_OF(t1, t2, t3) \ + STACK_OF(t1); \ + typedef int (*sk_##t1##_compfunc)(const t3 * const *a, const t3 *const *b); \ + typedef void (*sk_##t1##_freefunc)(t3 *a); \ + typedef t3 * (*sk_##t1##_copyfunc)(const t3 *a); \ + static ossl_unused ossl_inline int sk_##t1##_num(const STACK_OF(t1) *sk) \ + { \ + return OPENSSL_sk_num((const OPENSSL_STACK *)sk); \ + } \ + static ossl_unused ossl_inline t2 *sk_##t1##_value(const STACK_OF(t1) *sk, int idx) \ + { \ + return (t2 *)OPENSSL_sk_value((const OPENSSL_STACK *)sk, idx); \ + } \ + static ossl_unused ossl_inline STACK_OF(t1) *sk_##t1##_new(sk_##t1##_compfunc compare) \ + { \ + return (STACK_OF(t1) *)OPENSSL_sk_new((OPENSSL_sk_compfunc)compare); \ + } \ + static ossl_unused ossl_inline STACK_OF(t1) *sk_##t1##_new_null(void) \ + { \ + return (STACK_OF(t1) *)OPENSSL_sk_new_null(); \ + } \ + static ossl_unused ossl_inline STACK_OF(t1) *sk_##t1##_new_reserve(sk_##t1##_compfunc compare, int n) \ + { \ + return (STACK_OF(t1) *)OPENSSL_sk_new_reserve((OPENSSL_sk_compfunc)compare, n); \ + } \ + static ossl_unused ossl_inline int sk_##t1##_reserve(STACK_OF(t1) *sk, int n) \ + { \ + return OPENSSL_sk_reserve((OPENSSL_STACK *)sk, n); \ + } \ + static ossl_unused ossl_inline void sk_##t1##_free(STACK_OF(t1) *sk) \ + { \ + OPENSSL_sk_free((OPENSSL_STACK *)sk); \ + } \ + static ossl_unused ossl_inline void sk_##t1##_zero(STACK_OF(t1) *sk) \ + { \ + OPENSSL_sk_zero((OPENSSL_STACK *)sk); \ + } \ + static ossl_unused ossl_inline t2 *sk_##t1##_delete(STACK_OF(t1) *sk, int i) \ + { \ + return (t2 *)OPENSSL_sk_delete((OPENSSL_STACK *)sk, i); \ + } \ + static ossl_unused ossl_inline t2 *sk_##t1##_delete_ptr(STACK_OF(t1) *sk, t2 *ptr) \ + { \ + return (t2 *)OPENSSL_sk_delete_ptr((OPENSSL_STACK *)sk, \ + (const void *)ptr); \ + } \ + static ossl_unused ossl_inline int sk_##t1##_push(STACK_OF(t1) *sk, t2 *ptr) \ + { \ + return OPENSSL_sk_push((OPENSSL_STACK *)sk, (const void *)ptr); \ + } \ + static ossl_unused ossl_inline int sk_##t1##_unshift(STACK_OF(t1) *sk, t2 *ptr) \ + { \ + return OPENSSL_sk_unshift((OPENSSL_STACK *)sk, (const void *)ptr); \ + } \ + static ossl_unused ossl_inline t2 *sk_##t1##_pop(STACK_OF(t1) *sk) \ + { \ + return (t2 *)OPENSSL_sk_pop((OPENSSL_STACK *)sk); \ + } \ + static ossl_unused ossl_inline t2 *sk_##t1##_shift(STACK_OF(t1) *sk) \ + { \ + return (t2 *)OPENSSL_sk_shift((OPENSSL_STACK *)sk); \ + } \ + static ossl_unused ossl_inline void sk_##t1##_pop_free(STACK_OF(t1) *sk, sk_##t1##_freefunc freefunc) \ + { \ + OPENSSL_sk_pop_free((OPENSSL_STACK *)sk, (OPENSSL_sk_freefunc)freefunc); \ + } \ + static ossl_unused ossl_inline int sk_##t1##_insert(STACK_OF(t1) *sk, t2 *ptr, int idx) \ + { \ + return OPENSSL_sk_insert((OPENSSL_STACK *)sk, (const void *)ptr, idx); \ + } \ + static ossl_unused ossl_inline t2 *sk_##t1##_set(STACK_OF(t1) *sk, int idx, t2 *ptr) \ + { \ + return (t2 *)OPENSSL_sk_set((OPENSSL_STACK *)sk, idx, (const void *)ptr); \ + } \ + static ossl_unused ossl_inline int sk_##t1##_find(STACK_OF(t1) *sk, t2 *ptr) \ + { \ + return OPENSSL_sk_find((OPENSSL_STACK *)sk, (const void *)ptr); \ + } \ + static ossl_unused ossl_inline int sk_##t1##_find_ex(STACK_OF(t1) *sk, t2 *ptr) \ + { \ + return OPENSSL_sk_find_ex((OPENSSL_STACK *)sk, (const void *)ptr); \ + } \ + static ossl_unused ossl_inline void sk_##t1##_sort(STACK_OF(t1) *sk) \ + { \ + OPENSSL_sk_sort((OPENSSL_STACK *)sk); \ + } \ + static ossl_unused ossl_inline int sk_##t1##_is_sorted(const STACK_OF(t1) *sk) \ + { \ + return OPENSSL_sk_is_sorted((const OPENSSL_STACK *)sk); \ + } \ + static ossl_unused ossl_inline STACK_OF(t1) * sk_##t1##_dup(const STACK_OF(t1) *sk) \ + { \ + return (STACK_OF(t1) *)OPENSSL_sk_dup((const OPENSSL_STACK *)sk); \ + } \ + static ossl_unused ossl_inline STACK_OF(t1) *sk_##t1##_deep_copy(const STACK_OF(t1) *sk, \ + sk_##t1##_copyfunc copyfunc, \ + sk_##t1##_freefunc freefunc) \ + { \ + return (STACK_OF(t1) *)OPENSSL_sk_deep_copy((const OPENSSL_STACK *)sk, \ + (OPENSSL_sk_copyfunc)copyfunc, \ + (OPENSSL_sk_freefunc)freefunc); \ + } \ + static ossl_unused ossl_inline sk_##t1##_compfunc sk_##t1##_set_cmp_func(STACK_OF(t1) *sk, sk_##t1##_compfunc compare) \ + { \ + return (sk_##t1##_compfunc)OPENSSL_sk_set_cmp_func((OPENSSL_STACK *)sk, (OPENSSL_sk_compfunc)compare); \ + } + +# define DEFINE_SPECIAL_STACK_OF(t1, t2) SKM_DEFINE_STACK_OF(t1, t2, t2) +# define DEFINE_STACK_OF(t) SKM_DEFINE_STACK_OF(t, t, t) +# define DEFINE_SPECIAL_STACK_OF_CONST(t1, t2) \ + SKM_DEFINE_STACK_OF(t1, const t2, t2) +# define DEFINE_STACK_OF_CONST(t) SKM_DEFINE_STACK_OF(t, const t, t) + +/*- + * Strings are special: normally an lhash entry will point to a single + * (somewhat) mutable object. In the case of strings: + * + * a) Instead of a single char, there is an array of chars, NUL-terminated. + * b) The string may have be immutable. + * + * So, they need their own declarations. Especially important for + * type-checking tools, such as Deputy. + * + * In practice, however, it appears to be hard to have a const + * string. For now, I'm settling for dealing with the fact it is a + * string at all. + */ +typedef char *OPENSSL_STRING; +typedef const char *OPENSSL_CSTRING; + +/*- + * Confusingly, LHASH_OF(STRING) deals with char ** throughout, but + * STACK_OF(STRING) is really more like STACK_OF(char), only, as mentioned + * above, instead of a single char each entry is a NUL-terminated array of + * chars. So, we have to implement STRING specially for STACK_OF. This is + * dealt with in the autogenerated macros below. + */ +DEFINE_SPECIAL_STACK_OF(OPENSSL_STRING, char) +DEFINE_SPECIAL_STACK_OF_CONST(OPENSSL_CSTRING, char) + +/* + * Similarly, we sometimes use a block of characters, NOT nul-terminated. + * These should also be distinguished from "normal" stacks. + */ +typedef void *OPENSSL_BLOCK; +DEFINE_SPECIAL_STACK_OF(OPENSSL_BLOCK, void) + +/* + * If called without higher optimization (min. -xO3) the Oracle Developer + * Studio compiler generates code for the defined (static inline) functions + * above. + * This would later lead to the linker complaining about missing symbols when + * this header file is included but the resulting object is not linked against + * the Crypto library (openssl#6912). + */ +# ifdef __SUNPRO_C +# pragma weak OPENSSL_sk_num +# pragma weak OPENSSL_sk_value +# pragma weak OPENSSL_sk_new +# pragma weak OPENSSL_sk_new_null +# pragma weak OPENSSL_sk_new_reserve +# pragma weak OPENSSL_sk_reserve +# pragma weak OPENSSL_sk_free +# pragma weak OPENSSL_sk_zero +# pragma weak OPENSSL_sk_delete +# pragma weak OPENSSL_sk_delete_ptr +# pragma weak OPENSSL_sk_push +# pragma weak OPENSSL_sk_unshift +# pragma weak OPENSSL_sk_pop +# pragma weak OPENSSL_sk_shift +# pragma weak OPENSSL_sk_pop_free +# pragma weak OPENSSL_sk_insert +# pragma weak OPENSSL_sk_set +# pragma weak OPENSSL_sk_find +# pragma weak OPENSSL_sk_find_ex +# pragma weak OPENSSL_sk_sort +# pragma weak OPENSSL_sk_is_sorted +# pragma weak OPENSSL_sk_dup +# pragma weak OPENSSL_sk_deep_copy +# pragma weak OPENSSL_sk_set_cmp_func +# endif /* __SUNPRO_C */ + +# ifdef __cplusplus +} +# endif +#endif diff --git a/ONVIF/include/openssl/include/openssl/seed.h b/ONVIF/include/openssl/include/openssl/seed.h new file mode 100644 index 0000000..de10b08 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/seed.h @@ -0,0 +1,96 @@ +/* + * Copyright 2007-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +/* + * Copyright (c) 2007 KISA(Korea Information Security Agency). All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Neither the name of author nor the names of its contributors may + * be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef HEADER_SEED_H +# define HEADER_SEED_H + +# include + +# ifndef OPENSSL_NO_SEED +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + +/* look whether we need 'long' to get 32 bits */ +# ifdef AES_LONG +# ifndef SEED_LONG +# define SEED_LONG 1 +# endif +# endif + +# include + +# define SEED_BLOCK_SIZE 16 +# define SEED_KEY_LENGTH 16 + +typedef struct seed_key_st { +# ifdef SEED_LONG + unsigned long data[32]; +# else + unsigned int data[32]; +# endif +} SEED_KEY_SCHEDULE; + +void SEED_set_key(const unsigned char rawkey[SEED_KEY_LENGTH], + SEED_KEY_SCHEDULE *ks); + +void SEED_encrypt(const unsigned char s[SEED_BLOCK_SIZE], + unsigned char d[SEED_BLOCK_SIZE], + const SEED_KEY_SCHEDULE *ks); +void SEED_decrypt(const unsigned char s[SEED_BLOCK_SIZE], + unsigned char d[SEED_BLOCK_SIZE], + const SEED_KEY_SCHEDULE *ks); + +void SEED_ecb_encrypt(const unsigned char *in, unsigned char *out, + const SEED_KEY_SCHEDULE *ks, int enc); +void SEED_cbc_encrypt(const unsigned char *in, unsigned char *out, size_t len, + const SEED_KEY_SCHEDULE *ks, + unsigned char ivec[SEED_BLOCK_SIZE], int enc); +void SEED_cfb128_encrypt(const unsigned char *in, unsigned char *out, + size_t len, const SEED_KEY_SCHEDULE *ks, + unsigned char ivec[SEED_BLOCK_SIZE], int *num, + int enc); +void SEED_ofb128_encrypt(const unsigned char *in, unsigned char *out, + size_t len, const SEED_KEY_SCHEDULE *ks, + unsigned char ivec[SEED_BLOCK_SIZE], int *num); + +# ifdef __cplusplus +} +# endif +# endif + +#endif diff --git a/ONVIF/include/openssl/include/openssl/sha.h b/ONVIF/include/openssl/include/openssl/sha.h new file mode 100644 index 0000000..6a1eb0d --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/sha.h @@ -0,0 +1,119 @@ +/* + * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_SHA_H +# define HEADER_SHA_H + +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + +/*- + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * ! SHA_LONG has to be at least 32 bits wide. ! + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + */ +# define SHA_LONG unsigned int + +# define SHA_LBLOCK 16 +# define SHA_CBLOCK (SHA_LBLOCK*4)/* SHA treats input data as a + * contiguous array of 32 bit wide + * big-endian values. */ +# define SHA_LAST_BLOCK (SHA_CBLOCK-8) +# define SHA_DIGEST_LENGTH 20 + +typedef struct SHAstate_st { + SHA_LONG h0, h1, h2, h3, h4; + SHA_LONG Nl, Nh; + SHA_LONG data[SHA_LBLOCK]; + unsigned int num; +} SHA_CTX; + +int SHA1_Init(SHA_CTX *c); +int SHA1_Update(SHA_CTX *c, const void *data, size_t len); +int SHA1_Final(unsigned char *md, SHA_CTX *c); +unsigned char *SHA1(const unsigned char *d, size_t n, unsigned char *md); +void SHA1_Transform(SHA_CTX *c, const unsigned char *data); + +# define SHA256_CBLOCK (SHA_LBLOCK*4)/* SHA-256 treats input data as a + * contiguous array of 32 bit wide + * big-endian values. */ + +typedef struct SHA256state_st { + SHA_LONG h[8]; + SHA_LONG Nl, Nh; + SHA_LONG data[SHA_LBLOCK]; + unsigned int num, md_len; +} SHA256_CTX; + +int SHA224_Init(SHA256_CTX *c); +int SHA224_Update(SHA256_CTX *c, const void *data, size_t len); +int SHA224_Final(unsigned char *md, SHA256_CTX *c); +unsigned char *SHA224(const unsigned char *d, size_t n, unsigned char *md); +int SHA256_Init(SHA256_CTX *c); +int SHA256_Update(SHA256_CTX *c, const void *data, size_t len); +int SHA256_Final(unsigned char *md, SHA256_CTX *c); +unsigned char *SHA256(const unsigned char *d, size_t n, unsigned char *md); +void SHA256_Transform(SHA256_CTX *c, const unsigned char *data); + +# define SHA224_DIGEST_LENGTH 28 +# define SHA256_DIGEST_LENGTH 32 +# define SHA384_DIGEST_LENGTH 48 +# define SHA512_DIGEST_LENGTH 64 + +/* + * Unlike 32-bit digest algorithms, SHA-512 *relies* on SHA_LONG64 + * being exactly 64-bit wide. See Implementation Notes in sha512.c + * for further details. + */ +/* + * SHA-512 treats input data as a + * contiguous array of 64 bit + * wide big-endian values. + */ +# define SHA512_CBLOCK (SHA_LBLOCK*8) +# if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32__) +# define SHA_LONG64 unsigned __int64 +# define U64(C) C##UI64 +# elif defined(__arch64__) +# define SHA_LONG64 unsigned long +# define U64(C) C##UL +# else +# define SHA_LONG64 unsigned long long +# define U64(C) C##ULL +# endif + +typedef struct SHA512state_st { + SHA_LONG64 h[8]; + SHA_LONG64 Nl, Nh; + union { + SHA_LONG64 d[SHA_LBLOCK]; + unsigned char p[SHA512_CBLOCK]; + } u; + unsigned int num, md_len; +} SHA512_CTX; + +int SHA384_Init(SHA512_CTX *c); +int SHA384_Update(SHA512_CTX *c, const void *data, size_t len); +int SHA384_Final(unsigned char *md, SHA512_CTX *c); +unsigned char *SHA384(const unsigned char *d, size_t n, unsigned char *md); +int SHA512_Init(SHA512_CTX *c); +int SHA512_Update(SHA512_CTX *c, const void *data, size_t len); +int SHA512_Final(unsigned char *md, SHA512_CTX *c); +unsigned char *SHA512(const unsigned char *d, size_t n, unsigned char *md); +void SHA512_Transform(SHA512_CTX *c, const unsigned char *data); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/ONVIF/include/openssl/include/openssl/srp.h b/ONVIF/include/openssl/include/openssl/srp.h new file mode 100644 index 0000000..aaf1355 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/srp.h @@ -0,0 +1,135 @@ +/* + * Copyright 2004-2018 The OpenSSL Project Authors. All Rights Reserved. + * Copyright (c) 2004, EdelKey Project. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + * + * Originally written by Christophe Renou and Peter Sylvester, + * for the EdelKey project. + */ + +#ifndef HEADER_SRP_H +# define HEADER_SRP_H + +#include + +#ifndef OPENSSL_NO_SRP +# include +# include +# include +# include +# include + +# ifdef __cplusplus +extern "C" { +# endif + +typedef struct SRP_gN_cache_st { + char *b64_bn; + BIGNUM *bn; +} SRP_gN_cache; + + +DEFINE_STACK_OF(SRP_gN_cache) + +typedef struct SRP_user_pwd_st { + /* Owned by us. */ + char *id; + BIGNUM *s; + BIGNUM *v; + /* Not owned by us. */ + const BIGNUM *g; + const BIGNUM *N; + /* Owned by us. */ + char *info; +} SRP_user_pwd; + +void SRP_user_pwd_free(SRP_user_pwd *user_pwd); + +DEFINE_STACK_OF(SRP_user_pwd) + +typedef struct SRP_VBASE_st { + STACK_OF(SRP_user_pwd) *users_pwd; + STACK_OF(SRP_gN_cache) *gN_cache; +/* to simulate a user */ + char *seed_key; + const BIGNUM *default_g; + const BIGNUM *default_N; +} SRP_VBASE; + +/* + * Internal structure storing N and g pair + */ +typedef struct SRP_gN_st { + char *id; + const BIGNUM *g; + const BIGNUM *N; +} SRP_gN; + +DEFINE_STACK_OF(SRP_gN) + +SRP_VBASE *SRP_VBASE_new(char *seed_key); +void SRP_VBASE_free(SRP_VBASE *vb); +int SRP_VBASE_init(SRP_VBASE *vb, char *verifier_file); + +/* This method ignores the configured seed and fails for an unknown user. */ +DEPRECATEDIN_1_1_0(SRP_user_pwd *SRP_VBASE_get_by_user(SRP_VBASE *vb, char *username)) +/* NOTE: unlike in SRP_VBASE_get_by_user, caller owns the returned pointer.*/ +SRP_user_pwd *SRP_VBASE_get1_by_user(SRP_VBASE *vb, char *username); + +char *SRP_create_verifier(const char *user, const char *pass, char **salt, + char **verifier, const char *N, const char *g); +int SRP_create_verifier_BN(const char *user, const char *pass, BIGNUM **salt, + BIGNUM **verifier, const BIGNUM *N, + const BIGNUM *g); + +# define SRP_NO_ERROR 0 +# define SRP_ERR_VBASE_INCOMPLETE_FILE 1 +# define SRP_ERR_VBASE_BN_LIB 2 +# define SRP_ERR_OPEN_FILE 3 +# define SRP_ERR_MEMORY 4 + +# define DB_srptype 0 +# define DB_srpverifier 1 +# define DB_srpsalt 2 +# define DB_srpid 3 +# define DB_srpgN 4 +# define DB_srpinfo 5 +# undef DB_NUMBER +# define DB_NUMBER 6 + +# define DB_SRP_INDEX 'I' +# define DB_SRP_VALID 'V' +# define DB_SRP_REVOKED 'R' +# define DB_SRP_MODIF 'v' + +/* see srp.c */ +char *SRP_check_known_gN_param(const BIGNUM *g, const BIGNUM *N); +SRP_gN *SRP_get_default_gN(const char *id); + +/* server side .... */ +BIGNUM *SRP_Calc_server_key(const BIGNUM *A, const BIGNUM *v, const BIGNUM *u, + const BIGNUM *b, const BIGNUM *N); +BIGNUM *SRP_Calc_B(const BIGNUM *b, const BIGNUM *N, const BIGNUM *g, + const BIGNUM *v); +int SRP_Verify_A_mod_N(const BIGNUM *A, const BIGNUM *N); +BIGNUM *SRP_Calc_u(const BIGNUM *A, const BIGNUM *B, const BIGNUM *N); + +/* client side .... */ +BIGNUM *SRP_Calc_x(const BIGNUM *s, const char *user, const char *pass); +BIGNUM *SRP_Calc_A(const BIGNUM *a, const BIGNUM *N, const BIGNUM *g); +BIGNUM *SRP_Calc_client_key(const BIGNUM *N, const BIGNUM *B, const BIGNUM *g, + const BIGNUM *x, const BIGNUM *a, const BIGNUM *u); +int SRP_Verify_B_mod_N(const BIGNUM *B, const BIGNUM *N); + +# define SRP_MINIMAL_N 1024 + +# ifdef __cplusplus +} +# endif +# endif + +#endif diff --git a/ONVIF/include/openssl/include/openssl/srtp.h b/ONVIF/include/openssl/include/openssl/srtp.h new file mode 100644 index 0000000..0b57c23 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/srtp.h @@ -0,0 +1,50 @@ +/* + * Copyright 2011-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +/* + * DTLS code by Eric Rescorla + * + * Copyright (C) 2006, Network Resonance, Inc. Copyright (C) 2011, RTFM, Inc. + */ + +#ifndef HEADER_D1_SRTP_H +# define HEADER_D1_SRTP_H + +# include + +#ifdef __cplusplus +extern "C" { +#endif + +# define SRTP_AES128_CM_SHA1_80 0x0001 +# define SRTP_AES128_CM_SHA1_32 0x0002 +# define SRTP_AES128_F8_SHA1_80 0x0003 +# define SRTP_AES128_F8_SHA1_32 0x0004 +# define SRTP_NULL_SHA1_80 0x0005 +# define SRTP_NULL_SHA1_32 0x0006 + +/* AEAD SRTP protection profiles from RFC 7714 */ +# define SRTP_AEAD_AES_128_GCM 0x0007 +# define SRTP_AEAD_AES_256_GCM 0x0008 + +# ifndef OPENSSL_NO_SRTP + +__owur int SSL_CTX_set_tlsext_use_srtp(SSL_CTX *ctx, const char *profiles); +__owur int SSL_set_tlsext_use_srtp(SSL *ssl, const char *profiles); + +__owur STACK_OF(SRTP_PROTECTION_PROFILE) *SSL_get_srtp_profiles(SSL *ssl); +__owur SRTP_PROTECTION_PROFILE *SSL_get_selected_srtp_profile(SSL *s); + +# endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/ONVIF/include/openssl/include/openssl/ssl.h b/ONVIF/include/openssl/include/openssl/ssl.h new file mode 100644 index 0000000..6724ccf --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/ssl.h @@ -0,0 +1,2438 @@ +/* + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved + * Copyright 2005 Nokia. All rights reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_SSL_H +# define HEADER_SSL_H + +# include +# include +# include +# include +# if OPENSSL_API_COMPAT < 0x10100000L +# include +# include +# include +# endif +# include +# include +# include +# include + +# include +# include +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + +/* OpenSSL version number for ASN.1 encoding of the session information */ +/*- + * Version 0 - initial version + * Version 1 - added the optional peer certificate + */ +# define SSL_SESSION_ASN1_VERSION 0x0001 + +# define SSL_MAX_SSL_SESSION_ID_LENGTH 32 +# define SSL_MAX_SID_CTX_LENGTH 32 + +# define SSL_MIN_RSA_MODULUS_LENGTH_IN_BYTES (512/8) +# define SSL_MAX_KEY_ARG_LENGTH 8 +# define SSL_MAX_MASTER_KEY_LENGTH 48 + +/* The maximum number of encrypt/decrypt pipelines we can support */ +# define SSL_MAX_PIPELINES 32 + +/* text strings for the ciphers */ + +/* These are used to specify which ciphers to use and not to use */ + +# define SSL_TXT_LOW "LOW" +# define SSL_TXT_MEDIUM "MEDIUM" +# define SSL_TXT_HIGH "HIGH" +# define SSL_TXT_FIPS "FIPS" + +# define SSL_TXT_aNULL "aNULL" +# define SSL_TXT_eNULL "eNULL" +# define SSL_TXT_NULL "NULL" + +# define SSL_TXT_kRSA "kRSA" +# define SSL_TXT_kDHr "kDHr"/* this cipher class has been removed */ +# define SSL_TXT_kDHd "kDHd"/* this cipher class has been removed */ +# define SSL_TXT_kDH "kDH"/* this cipher class has been removed */ +# define SSL_TXT_kEDH "kEDH"/* alias for kDHE */ +# define SSL_TXT_kDHE "kDHE" +# define SSL_TXT_kECDHr "kECDHr"/* this cipher class has been removed */ +# define SSL_TXT_kECDHe "kECDHe"/* this cipher class has been removed */ +# define SSL_TXT_kECDH "kECDH"/* this cipher class has been removed */ +# define SSL_TXT_kEECDH "kEECDH"/* alias for kECDHE */ +# define SSL_TXT_kECDHE "kECDHE" +# define SSL_TXT_kPSK "kPSK" +# define SSL_TXT_kRSAPSK "kRSAPSK" +# define SSL_TXT_kECDHEPSK "kECDHEPSK" +# define SSL_TXT_kDHEPSK "kDHEPSK" +# define SSL_TXT_kGOST "kGOST" +# define SSL_TXT_kSRP "kSRP" + +# define SSL_TXT_aRSA "aRSA" +# define SSL_TXT_aDSS "aDSS" +# define SSL_TXT_aDH "aDH"/* this cipher class has been removed */ +# define SSL_TXT_aECDH "aECDH"/* this cipher class has been removed */ +# define SSL_TXT_aECDSA "aECDSA" +# define SSL_TXT_aPSK "aPSK" +# define SSL_TXT_aGOST94 "aGOST94" +# define SSL_TXT_aGOST01 "aGOST01" +# define SSL_TXT_aGOST12 "aGOST12" +# define SSL_TXT_aGOST "aGOST" +# define SSL_TXT_aSRP "aSRP" + +# define SSL_TXT_DSS "DSS" +# define SSL_TXT_DH "DH" +# define SSL_TXT_DHE "DHE"/* same as "kDHE:-ADH" */ +# define SSL_TXT_EDH "EDH"/* alias for DHE */ +# define SSL_TXT_ADH "ADH" +# define SSL_TXT_RSA "RSA" +# define SSL_TXT_ECDH "ECDH" +# define SSL_TXT_EECDH "EECDH"/* alias for ECDHE" */ +# define SSL_TXT_ECDHE "ECDHE"/* same as "kECDHE:-AECDH" */ +# define SSL_TXT_AECDH "AECDH" +# define SSL_TXT_ECDSA "ECDSA" +# define SSL_TXT_PSK "PSK" +# define SSL_TXT_SRP "SRP" + +# define SSL_TXT_DES "DES" +# define SSL_TXT_3DES "3DES" +# define SSL_TXT_RC4 "RC4" +# define SSL_TXT_RC2 "RC2" +# define SSL_TXT_IDEA "IDEA" +# define SSL_TXT_SEED "SEED" +# define SSL_TXT_AES128 "AES128" +# define SSL_TXT_AES256 "AES256" +# define SSL_TXT_AES "AES" +# define SSL_TXT_AES_GCM "AESGCM" +# define SSL_TXT_AES_CCM "AESCCM" +# define SSL_TXT_AES_CCM_8 "AESCCM8" +# define SSL_TXT_CAMELLIA128 "CAMELLIA128" +# define SSL_TXT_CAMELLIA256 "CAMELLIA256" +# define SSL_TXT_CAMELLIA "CAMELLIA" +# define SSL_TXT_CHACHA20 "CHACHA20" +# define SSL_TXT_GOST "GOST89" +# define SSL_TXT_ARIA "ARIA" +# define SSL_TXT_ARIA_GCM "ARIAGCM" +# define SSL_TXT_ARIA128 "ARIA128" +# define SSL_TXT_ARIA256 "ARIA256" + +# define SSL_TXT_MD5 "MD5" +# define SSL_TXT_SHA1 "SHA1" +# define SSL_TXT_SHA "SHA"/* same as "SHA1" */ +# define SSL_TXT_GOST94 "GOST94" +# define SSL_TXT_GOST89MAC "GOST89MAC" +# define SSL_TXT_GOST12 "GOST12" +# define SSL_TXT_GOST89MAC12 "GOST89MAC12" +# define SSL_TXT_SHA256 "SHA256" +# define SSL_TXT_SHA384 "SHA384" + +# define SSL_TXT_SSLV3 "SSLv3" +# define SSL_TXT_TLSV1 "TLSv1" +# define SSL_TXT_TLSV1_1 "TLSv1.1" +# define SSL_TXT_TLSV1_2 "TLSv1.2" + +# define SSL_TXT_ALL "ALL" + +/*- + * COMPLEMENTOF* definitions. These identifiers are used to (de-select) + * ciphers normally not being used. + * Example: "RC4" will activate all ciphers using RC4 including ciphers + * without authentication, which would normally disabled by DEFAULT (due + * the "!ADH" being part of default). Therefore "RC4:!COMPLEMENTOFDEFAULT" + * will make sure that it is also disabled in the specific selection. + * COMPLEMENTOF* identifiers are portable between version, as adjustments + * to the default cipher setup will also be included here. + * + * COMPLEMENTOFDEFAULT does not experience the same special treatment that + * DEFAULT gets, as only selection is being done and no sorting as needed + * for DEFAULT. + */ +# define SSL_TXT_CMPALL "COMPLEMENTOFALL" +# define SSL_TXT_CMPDEF "COMPLEMENTOFDEFAULT" + +/* + * The following cipher list is used by default. It also is substituted when + * an application-defined cipher list string starts with 'DEFAULT'. + * This applies to ciphersuites for TLSv1.2 and below. + */ +# define SSL_DEFAULT_CIPHER_LIST "ALL:!COMPLEMENTOFDEFAULT:!eNULL" +/* This is the default set of TLSv1.3 ciphersuites */ +# if !defined(OPENSSL_NO_CHACHA) && !defined(OPENSSL_NO_POLY1305) +# define TLS_DEFAULT_CIPHERSUITES "TLS_AES_256_GCM_SHA384:" \ + "TLS_CHACHA20_POLY1305_SHA256:" \ + "TLS_AES_128_GCM_SHA256" +# else +# define TLS_DEFAULT_CIPHERSUITES "TLS_AES_256_GCM_SHA384:" \ + "TLS_AES_128_GCM_SHA256" +#endif +/* + * As of OpenSSL 1.0.0, ssl_create_cipher_list() in ssl/ssl_ciph.c always + * starts with a reasonable order, and all we have to do for DEFAULT is + * throwing out anonymous and unencrypted ciphersuites! (The latter are not + * actually enabled by ALL, but "ALL:RSA" would enable some of them.) + */ + +/* Used in SSL_set_shutdown()/SSL_get_shutdown(); */ +# define SSL_SENT_SHUTDOWN 1 +# define SSL_RECEIVED_SHUTDOWN 2 + +#ifdef __cplusplus +} +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +# define SSL_FILETYPE_ASN1 X509_FILETYPE_ASN1 +# define SSL_FILETYPE_PEM X509_FILETYPE_PEM + +/* + * This is needed to stop compilers complaining about the 'struct ssl_st *' + * function parameters used to prototype callbacks in SSL_CTX. + */ +typedef struct ssl_st *ssl_crock_st; +typedef struct tls_session_ticket_ext_st TLS_SESSION_TICKET_EXT; +typedef struct ssl_method_st SSL_METHOD; +typedef struct ssl_cipher_st SSL_CIPHER; +typedef struct ssl_session_st SSL_SESSION; +typedef struct tls_sigalgs_st TLS_SIGALGS; +typedef struct ssl_conf_ctx_st SSL_CONF_CTX; +typedef struct ssl_comp_st SSL_COMP; + +STACK_OF(SSL_CIPHER); +STACK_OF(SSL_COMP); + +/* SRTP protection profiles for use with the use_srtp extension (RFC 5764)*/ +typedef struct srtp_protection_profile_st { + const char *name; + unsigned long id; +} SRTP_PROTECTION_PROFILE; + +DEFINE_STACK_OF(SRTP_PROTECTION_PROFILE) + +typedef int (*tls_session_ticket_ext_cb_fn)(SSL *s, const unsigned char *data, + int len, void *arg); +typedef int (*tls_session_secret_cb_fn)(SSL *s, void *secret, int *secret_len, + STACK_OF(SSL_CIPHER) *peer_ciphers, + const SSL_CIPHER **cipher, void *arg); + +/* Extension context codes */ +/* This extension is only allowed in TLS */ +#define SSL_EXT_TLS_ONLY 0x0001 +/* This extension is only allowed in DTLS */ +#define SSL_EXT_DTLS_ONLY 0x0002 +/* Some extensions may be allowed in DTLS but we don't implement them for it */ +#define SSL_EXT_TLS_IMPLEMENTATION_ONLY 0x0004 +/* Most extensions are not defined for SSLv3 but EXT_TYPE_renegotiate is */ +#define SSL_EXT_SSL3_ALLOWED 0x0008 +/* Extension is only defined for TLS1.2 and below */ +#define SSL_EXT_TLS1_2_AND_BELOW_ONLY 0x0010 +/* Extension is only defined for TLS1.3 and above */ +#define SSL_EXT_TLS1_3_ONLY 0x0020 +/* Ignore this extension during parsing if we are resuming */ +#define SSL_EXT_IGNORE_ON_RESUMPTION 0x0040 +#define SSL_EXT_CLIENT_HELLO 0x0080 +/* Really means TLS1.2 or below */ +#define SSL_EXT_TLS1_2_SERVER_HELLO 0x0100 +#define SSL_EXT_TLS1_3_SERVER_HELLO 0x0200 +#define SSL_EXT_TLS1_3_ENCRYPTED_EXTENSIONS 0x0400 +#define SSL_EXT_TLS1_3_HELLO_RETRY_REQUEST 0x0800 +#define SSL_EXT_TLS1_3_CERTIFICATE 0x1000 +#define SSL_EXT_TLS1_3_NEW_SESSION_TICKET 0x2000 +#define SSL_EXT_TLS1_3_CERTIFICATE_REQUEST 0x4000 + +/* Typedefs for handling custom extensions */ + +typedef int (*custom_ext_add_cb)(SSL *s, unsigned int ext_type, + const unsigned char **out, size_t *outlen, + int *al, void *add_arg); + +typedef void (*custom_ext_free_cb)(SSL *s, unsigned int ext_type, + const unsigned char *out, void *add_arg); + +typedef int (*custom_ext_parse_cb)(SSL *s, unsigned int ext_type, + const unsigned char *in, size_t inlen, + int *al, void *parse_arg); + + +typedef int (*SSL_custom_ext_add_cb_ex)(SSL *s, unsigned int ext_type, + unsigned int context, + const unsigned char **out, + size_t *outlen, X509 *x, + size_t chainidx, + int *al, void *add_arg); + +typedef void (*SSL_custom_ext_free_cb_ex)(SSL *s, unsigned int ext_type, + unsigned int context, + const unsigned char *out, + void *add_arg); + +typedef int (*SSL_custom_ext_parse_cb_ex)(SSL *s, unsigned int ext_type, + unsigned int context, + const unsigned char *in, + size_t inlen, X509 *x, + size_t chainidx, + int *al, void *parse_arg); + +/* Typedef for verification callback */ +typedef int (*SSL_verify_cb)(int preverify_ok, X509_STORE_CTX *x509_ctx); + +/* + * Some values are reserved until OpenSSL 1.2.0 because they were previously + * included in SSL_OP_ALL in a 1.1.x release. + * + * Reserved value (until OpenSSL 1.2.0) 0x00000001U + * Reserved value (until OpenSSL 1.2.0) 0x00000002U + */ +/* Allow initial connection to servers that don't support RI */ +# define SSL_OP_LEGACY_SERVER_CONNECT 0x00000004U + +/* Reserved value (until OpenSSL 1.2.0) 0x00000008U */ +# define SSL_OP_TLSEXT_PADDING 0x00000010U +/* Reserved value (until OpenSSL 1.2.0) 0x00000020U */ +# define SSL_OP_SAFARI_ECDHE_ECDSA_BUG 0x00000040U +/* + * Reserved value (until OpenSSL 1.2.0) 0x00000080U + * Reserved value (until OpenSSL 1.2.0) 0x00000100U + * Reserved value (until OpenSSL 1.2.0) 0x00000200U + */ + +/* In TLSv1.3 allow a non-(ec)dhe based kex_mode */ +# define SSL_OP_ALLOW_NO_DHE_KEX 0x00000400U + +/* + * Disable SSL 3.0/TLS 1.0 CBC vulnerability workaround that was added in + * OpenSSL 0.9.6d. Usually (depending on the application protocol) the + * workaround is not needed. Unfortunately some broken SSL/TLS + * implementations cannot handle it at all, which is why we include it in + * SSL_OP_ALL. Added in 0.9.6e + */ +# define SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS 0x00000800U + +/* DTLS options */ +# define SSL_OP_NO_QUERY_MTU 0x00001000U +/* Turn on Cookie Exchange (on relevant for servers) */ +# define SSL_OP_COOKIE_EXCHANGE 0x00002000U +/* Don't use RFC4507 ticket extension */ +# define SSL_OP_NO_TICKET 0x00004000U +# ifndef OPENSSL_NO_DTLS1_METHOD +/* Use Cisco's "speshul" version of DTLS_BAD_VER + * (only with deprecated DTLSv1_client_method()) */ +# define SSL_OP_CISCO_ANYCONNECT 0x00008000U +# endif + +/* As server, disallow session resumption on renegotiation */ +# define SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION 0x00010000U +/* Don't use compression even if supported */ +# define SSL_OP_NO_COMPRESSION 0x00020000U +/* Permit unsafe legacy renegotiation */ +# define SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION 0x00040000U +/* Disable encrypt-then-mac */ +# define SSL_OP_NO_ENCRYPT_THEN_MAC 0x00080000U + +/* + * Enable TLSv1.3 Compatibility mode. This is on by default. A future version + * of OpenSSL may have this disabled by default. + */ +# define SSL_OP_ENABLE_MIDDLEBOX_COMPAT 0x00100000U + +/* Prioritize Chacha20Poly1305 when client does. + * Modifies SSL_OP_CIPHER_SERVER_PREFERENCE */ +# define SSL_OP_PRIORITIZE_CHACHA 0x00200000U + +/* + * Set on servers to choose the cipher according to the server's preferences + */ +# define SSL_OP_CIPHER_SERVER_PREFERENCE 0x00400000U +/* + * If set, a server will allow a client to issue a SSLv3.0 version number as + * latest version supported in the premaster secret, even when TLSv1.0 + * (version 3.1) was announced in the client hello. Normally this is + * forbidden to prevent version rollback attacks. + */ +# define SSL_OP_TLS_ROLLBACK_BUG 0x00800000U + +/* + * Switches off automatic TLSv1.3 anti-replay protection for early data. This + * is a server-side option only (no effect on the client). + */ +# define SSL_OP_NO_ANTI_REPLAY 0x01000000U + +# define SSL_OP_NO_SSLv3 0x02000000U +# define SSL_OP_NO_TLSv1 0x04000000U +# define SSL_OP_NO_TLSv1_2 0x08000000U +# define SSL_OP_NO_TLSv1_1 0x10000000U +# define SSL_OP_NO_TLSv1_3 0x20000000U + +# define SSL_OP_NO_DTLSv1 0x04000000U +# define SSL_OP_NO_DTLSv1_2 0x08000000U + +# define SSL_OP_NO_SSL_MASK (SSL_OP_NO_SSLv3|\ + SSL_OP_NO_TLSv1|SSL_OP_NO_TLSv1_1|SSL_OP_NO_TLSv1_2|SSL_OP_NO_TLSv1_3) +# define SSL_OP_NO_DTLS_MASK (SSL_OP_NO_DTLSv1|SSL_OP_NO_DTLSv1_2) + +/* Disallow all renegotiation */ +# define SSL_OP_NO_RENEGOTIATION 0x40000000U + +/* + * Make server add server-hello extension from early version of cryptopro + * draft, when GOST ciphersuite is negotiated. Required for interoperability + * with CryptoPro CSP 3.x + */ +# define SSL_OP_CRYPTOPRO_TLSEXT_BUG 0x80000000U + +/* + * SSL_OP_ALL: various bug workarounds that should be rather harmless. + * This used to be 0x000FFFFFL before 0.9.7. + * This used to be 0x80000BFFU before 1.1.1. + */ +# define SSL_OP_ALL (SSL_OP_CRYPTOPRO_TLSEXT_BUG|\ + SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS|\ + SSL_OP_LEGACY_SERVER_CONNECT|\ + SSL_OP_TLSEXT_PADDING|\ + SSL_OP_SAFARI_ECDHE_ECDSA_BUG) + +/* OBSOLETE OPTIONS: retained for compatibility */ + +/* Removed from OpenSSL 1.1.0. Was 0x00000001L */ +/* Related to removed SSLv2. */ +# define SSL_OP_MICROSOFT_SESS_ID_BUG 0x0 +/* Removed from OpenSSL 1.1.0. Was 0x00000002L */ +/* Related to removed SSLv2. */ +# define SSL_OP_NETSCAPE_CHALLENGE_BUG 0x0 +/* Removed from OpenSSL 0.9.8q and 1.0.0c. Was 0x00000008L */ +/* Dead forever, see CVE-2010-4180 */ +# define SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG 0x0 +/* Removed from OpenSSL 1.0.1h and 1.0.2. Was 0x00000010L */ +/* Refers to ancient SSLREF and SSLv2. */ +# define SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG 0x0 +/* Removed from OpenSSL 1.1.0. Was 0x00000020 */ +# define SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER 0x0 +/* Removed from OpenSSL 0.9.7h and 0.9.8b. Was 0x00000040L */ +# define SSL_OP_MSIE_SSLV2_RSA_PADDING 0x0 +/* Removed from OpenSSL 1.1.0. Was 0x00000080 */ +/* Ancient SSLeay version. */ +# define SSL_OP_SSLEAY_080_CLIENT_DH_BUG 0x0 +/* Removed from OpenSSL 1.1.0. Was 0x00000100L */ +# define SSL_OP_TLS_D5_BUG 0x0 +/* Removed from OpenSSL 1.1.0. Was 0x00000200L */ +# define SSL_OP_TLS_BLOCK_PADDING_BUG 0x0 +/* Removed from OpenSSL 1.1.0. Was 0x00080000L */ +# define SSL_OP_SINGLE_ECDH_USE 0x0 +/* Removed from OpenSSL 1.1.0. Was 0x00100000L */ +# define SSL_OP_SINGLE_DH_USE 0x0 +/* Removed from OpenSSL 1.0.1k and 1.0.2. Was 0x00200000L */ +# define SSL_OP_EPHEMERAL_RSA 0x0 +/* Removed from OpenSSL 1.1.0. Was 0x01000000L */ +# define SSL_OP_NO_SSLv2 0x0 +/* Removed from OpenSSL 1.0.1. Was 0x08000000L */ +# define SSL_OP_PKCS1_CHECK_1 0x0 +/* Removed from OpenSSL 1.0.1. Was 0x10000000L */ +# define SSL_OP_PKCS1_CHECK_2 0x0 +/* Removed from OpenSSL 1.1.0. Was 0x20000000L */ +# define SSL_OP_NETSCAPE_CA_DN_BUG 0x0 +/* Removed from OpenSSL 1.1.0. Was 0x40000000L */ +# define SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG 0x0 + +/* + * Allow SSL_write(..., n) to return r with 0 < r < n (i.e. report success + * when just a single record has been written): + */ +# define SSL_MODE_ENABLE_PARTIAL_WRITE 0x00000001U +/* + * Make it possible to retry SSL_write() with changed buffer location (buffer + * contents must stay the same!); this is not the default to avoid the + * misconception that non-blocking SSL_write() behaves like non-blocking + * write(): + */ +# define SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER 0x00000002U +/* + * Never bother the application with retries if the transport is blocking: + */ +# define SSL_MODE_AUTO_RETRY 0x00000004U +/* Don't attempt to automatically build certificate chain */ +# define SSL_MODE_NO_AUTO_CHAIN 0x00000008U +/* + * Save RAM by releasing read and write buffers when they're empty. (SSL3 and + * TLS only.) Released buffers are freed. + */ +# define SSL_MODE_RELEASE_BUFFERS 0x00000010U +/* + * Send the current time in the Random fields of the ClientHello and + * ServerHello records for compatibility with hypothetical implementations + * that require it. + */ +# define SSL_MODE_SEND_CLIENTHELLO_TIME 0x00000020U +# define SSL_MODE_SEND_SERVERHELLO_TIME 0x00000040U +/* + * Send TLS_FALLBACK_SCSV in the ClientHello. To be set only by applications + * that reconnect with a downgraded protocol version; see + * draft-ietf-tls-downgrade-scsv-00 for details. DO NOT ENABLE THIS if your + * application attempts a normal handshake. Only use this in explicit + * fallback retries, following the guidance in + * draft-ietf-tls-downgrade-scsv-00. + */ +# define SSL_MODE_SEND_FALLBACK_SCSV 0x00000080U +/* + * Support Asynchronous operation + */ +# define SSL_MODE_ASYNC 0x00000100U + +/* + * When using DTLS/SCTP, include the terminating zero in the label + * used for computing the endpoint-pair shared secret. Required for + * interoperability with implementations having this bug like these + * older version of OpenSSL: + * - OpenSSL 1.0.0 series + * - OpenSSL 1.0.1 series + * - OpenSSL 1.0.2 series + * - OpenSSL 1.1.0 series + * - OpenSSL 1.1.1 and 1.1.1a + */ +# define SSL_MODE_DTLS_SCTP_LABEL_LENGTH_BUG 0x00000400U + +/* Cert related flags */ +/* + * Many implementations ignore some aspects of the TLS standards such as + * enforcing certificate chain algorithms. When this is set we enforce them. + */ +# define SSL_CERT_FLAG_TLS_STRICT 0x00000001U + +/* Suite B modes, takes same values as certificate verify flags */ +# define SSL_CERT_FLAG_SUITEB_128_LOS_ONLY 0x10000 +/* Suite B 192 bit only mode */ +# define SSL_CERT_FLAG_SUITEB_192_LOS 0x20000 +/* Suite B 128 bit mode allowing 192 bit algorithms */ +# define SSL_CERT_FLAG_SUITEB_128_LOS 0x30000 + +/* Perform all sorts of protocol violations for testing purposes */ +# define SSL_CERT_FLAG_BROKEN_PROTOCOL 0x10000000 + +/* Flags for building certificate chains */ +/* Treat any existing certificates as untrusted CAs */ +# define SSL_BUILD_CHAIN_FLAG_UNTRUSTED 0x1 +/* Don't include root CA in chain */ +# define SSL_BUILD_CHAIN_FLAG_NO_ROOT 0x2 +/* Just check certificates already there */ +# define SSL_BUILD_CHAIN_FLAG_CHECK 0x4 +/* Ignore verification errors */ +# define SSL_BUILD_CHAIN_FLAG_IGNORE_ERROR 0x8 +/* Clear verification errors from queue */ +# define SSL_BUILD_CHAIN_FLAG_CLEAR_ERROR 0x10 + +/* Flags returned by SSL_check_chain */ +/* Certificate can be used with this session */ +# define CERT_PKEY_VALID 0x1 +/* Certificate can also be used for signing */ +# define CERT_PKEY_SIGN 0x2 +/* EE certificate signing algorithm OK */ +# define CERT_PKEY_EE_SIGNATURE 0x10 +/* CA signature algorithms OK */ +# define CERT_PKEY_CA_SIGNATURE 0x20 +/* EE certificate parameters OK */ +# define CERT_PKEY_EE_PARAM 0x40 +/* CA certificate parameters OK */ +# define CERT_PKEY_CA_PARAM 0x80 +/* Signing explicitly allowed as opposed to SHA1 fallback */ +# define CERT_PKEY_EXPLICIT_SIGN 0x100 +/* Client CA issuer names match (always set for server cert) */ +# define CERT_PKEY_ISSUER_NAME 0x200 +/* Cert type matches client types (always set for server cert) */ +# define CERT_PKEY_CERT_TYPE 0x400 +/* Cert chain suitable to Suite B */ +# define CERT_PKEY_SUITEB 0x800 + +# define SSL_CONF_FLAG_CMDLINE 0x1 +# define SSL_CONF_FLAG_FILE 0x2 +# define SSL_CONF_FLAG_CLIENT 0x4 +# define SSL_CONF_FLAG_SERVER 0x8 +# define SSL_CONF_FLAG_SHOW_ERRORS 0x10 +# define SSL_CONF_FLAG_CERTIFICATE 0x20 +# define SSL_CONF_FLAG_REQUIRE_PRIVATE 0x40 +/* Configuration value types */ +# define SSL_CONF_TYPE_UNKNOWN 0x0 +# define SSL_CONF_TYPE_STRING 0x1 +# define SSL_CONF_TYPE_FILE 0x2 +# define SSL_CONF_TYPE_DIR 0x3 +# define SSL_CONF_TYPE_NONE 0x4 + +/* Maximum length of the application-controlled segment of a a TLSv1.3 cookie */ +# define SSL_COOKIE_LENGTH 4096 + +/* + * Note: SSL[_CTX]_set_{options,mode} use |= op on the previous value, they + * cannot be used to clear bits. + */ + +unsigned long SSL_CTX_get_options(const SSL_CTX *ctx); +unsigned long SSL_get_options(const SSL *s); +unsigned long SSL_CTX_clear_options(SSL_CTX *ctx, unsigned long op); +unsigned long SSL_clear_options(SSL *s, unsigned long op); +unsigned long SSL_CTX_set_options(SSL_CTX *ctx, unsigned long op); +unsigned long SSL_set_options(SSL *s, unsigned long op); + +# define SSL_CTX_set_mode(ctx,op) \ + SSL_CTX_ctrl((ctx),SSL_CTRL_MODE,(op),NULL) +# define SSL_CTX_clear_mode(ctx,op) \ + SSL_CTX_ctrl((ctx),SSL_CTRL_CLEAR_MODE,(op),NULL) +# define SSL_CTX_get_mode(ctx) \ + SSL_CTX_ctrl((ctx),SSL_CTRL_MODE,0,NULL) +# define SSL_clear_mode(ssl,op) \ + SSL_ctrl((ssl),SSL_CTRL_CLEAR_MODE,(op),NULL) +# define SSL_set_mode(ssl,op) \ + SSL_ctrl((ssl),SSL_CTRL_MODE,(op),NULL) +# define SSL_get_mode(ssl) \ + SSL_ctrl((ssl),SSL_CTRL_MODE,0,NULL) +# define SSL_set_mtu(ssl, mtu) \ + SSL_ctrl((ssl),SSL_CTRL_SET_MTU,(mtu),NULL) +# define DTLS_set_link_mtu(ssl, mtu) \ + SSL_ctrl((ssl),DTLS_CTRL_SET_LINK_MTU,(mtu),NULL) +# define DTLS_get_link_min_mtu(ssl) \ + SSL_ctrl((ssl),DTLS_CTRL_GET_LINK_MIN_MTU,0,NULL) + +# define SSL_get_secure_renegotiation_support(ssl) \ + SSL_ctrl((ssl), SSL_CTRL_GET_RI_SUPPORT, 0, NULL) + +# ifndef OPENSSL_NO_HEARTBEATS +# define SSL_heartbeat(ssl) \ + SSL_ctrl((ssl),SSL_CTRL_DTLS_EXT_SEND_HEARTBEAT,0,NULL) +# endif + +# define SSL_CTX_set_cert_flags(ctx,op) \ + SSL_CTX_ctrl((ctx),SSL_CTRL_CERT_FLAGS,(op),NULL) +# define SSL_set_cert_flags(s,op) \ + SSL_ctrl((s),SSL_CTRL_CERT_FLAGS,(op),NULL) +# define SSL_CTX_clear_cert_flags(ctx,op) \ + SSL_CTX_ctrl((ctx),SSL_CTRL_CLEAR_CERT_FLAGS,(op),NULL) +# define SSL_clear_cert_flags(s,op) \ + SSL_ctrl((s),SSL_CTRL_CLEAR_CERT_FLAGS,(op),NULL) + +void SSL_CTX_set_msg_callback(SSL_CTX *ctx, + void (*cb) (int write_p, int version, + int content_type, const void *buf, + size_t len, SSL *ssl, void *arg)); +void SSL_set_msg_callback(SSL *ssl, + void (*cb) (int write_p, int version, + int content_type, const void *buf, + size_t len, SSL *ssl, void *arg)); +# define SSL_CTX_set_msg_callback_arg(ctx, arg) SSL_CTX_ctrl((ctx), SSL_CTRL_SET_MSG_CALLBACK_ARG, 0, (arg)) +# define SSL_set_msg_callback_arg(ssl, arg) SSL_ctrl((ssl), SSL_CTRL_SET_MSG_CALLBACK_ARG, 0, (arg)) + +# define SSL_get_extms_support(s) \ + SSL_ctrl((s),SSL_CTRL_GET_EXTMS_SUPPORT,0,NULL) + +# ifndef OPENSSL_NO_SRP + +/* see tls_srp.c */ +__owur int SSL_SRP_CTX_init(SSL *s); +__owur int SSL_CTX_SRP_CTX_init(SSL_CTX *ctx); +int SSL_SRP_CTX_free(SSL *ctx); +int SSL_CTX_SRP_CTX_free(SSL_CTX *ctx); +__owur int SSL_srp_server_param_with_username(SSL *s, int *ad); +__owur int SRP_Calc_A_param(SSL *s); + +# endif + +/* 100k max cert list */ +# define SSL_MAX_CERT_LIST_DEFAULT 1024*100 + +# define SSL_SESSION_CACHE_MAX_SIZE_DEFAULT (1024*20) + +/* + * This callback type is used inside SSL_CTX, SSL, and in the functions that + * set them. It is used to override the generation of SSL/TLS session IDs in + * a server. Return value should be zero on an error, non-zero to proceed. + * Also, callbacks should themselves check if the id they generate is unique + * otherwise the SSL handshake will fail with an error - callbacks can do + * this using the 'ssl' value they're passed by; + * SSL_has_matching_session_id(ssl, id, *id_len) The length value passed in + * is set at the maximum size the session ID can be. In SSLv3/TLSv1 it is 32 + * bytes. The callback can alter this length to be less if desired. It is + * also an error for the callback to set the size to zero. + */ +typedef int (*GEN_SESSION_CB) (SSL *ssl, unsigned char *id, + unsigned int *id_len); + +# define SSL_SESS_CACHE_OFF 0x0000 +# define SSL_SESS_CACHE_CLIENT 0x0001 +# define SSL_SESS_CACHE_SERVER 0x0002 +# define SSL_SESS_CACHE_BOTH (SSL_SESS_CACHE_CLIENT|SSL_SESS_CACHE_SERVER) +# define SSL_SESS_CACHE_NO_AUTO_CLEAR 0x0080 +/* enough comments already ... see SSL_CTX_set_session_cache_mode(3) */ +# define SSL_SESS_CACHE_NO_INTERNAL_LOOKUP 0x0100 +# define SSL_SESS_CACHE_NO_INTERNAL_STORE 0x0200 +# define SSL_SESS_CACHE_NO_INTERNAL \ + (SSL_SESS_CACHE_NO_INTERNAL_LOOKUP|SSL_SESS_CACHE_NO_INTERNAL_STORE) + +LHASH_OF(SSL_SESSION) *SSL_CTX_sessions(SSL_CTX *ctx); +# define SSL_CTX_sess_number(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_NUMBER,0,NULL) +# define SSL_CTX_sess_connect(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CONNECT,0,NULL) +# define SSL_CTX_sess_connect_good(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CONNECT_GOOD,0,NULL) +# define SSL_CTX_sess_connect_renegotiate(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CONNECT_RENEGOTIATE,0,NULL) +# define SSL_CTX_sess_accept(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_ACCEPT,0,NULL) +# define SSL_CTX_sess_accept_renegotiate(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_ACCEPT_RENEGOTIATE,0,NULL) +# define SSL_CTX_sess_accept_good(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_ACCEPT_GOOD,0,NULL) +# define SSL_CTX_sess_hits(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_HIT,0,NULL) +# define SSL_CTX_sess_cb_hits(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CB_HIT,0,NULL) +# define SSL_CTX_sess_misses(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_MISSES,0,NULL) +# define SSL_CTX_sess_timeouts(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_TIMEOUTS,0,NULL) +# define SSL_CTX_sess_cache_full(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CACHE_FULL,0,NULL) + +void SSL_CTX_sess_set_new_cb(SSL_CTX *ctx, + int (*new_session_cb) (struct ssl_st *ssl, + SSL_SESSION *sess)); +int (*SSL_CTX_sess_get_new_cb(SSL_CTX *ctx)) (struct ssl_st *ssl, + SSL_SESSION *sess); +void SSL_CTX_sess_set_remove_cb(SSL_CTX *ctx, + void (*remove_session_cb) (struct ssl_ctx_st + *ctx, + SSL_SESSION *sess)); +void (*SSL_CTX_sess_get_remove_cb(SSL_CTX *ctx)) (struct ssl_ctx_st *ctx, + SSL_SESSION *sess); +void SSL_CTX_sess_set_get_cb(SSL_CTX *ctx, + SSL_SESSION *(*get_session_cb) (struct ssl_st + *ssl, + const unsigned char + *data, int len, + int *copy)); +SSL_SESSION *(*SSL_CTX_sess_get_get_cb(SSL_CTX *ctx)) (struct ssl_st *ssl, + const unsigned char *data, + int len, int *copy); +void SSL_CTX_set_info_callback(SSL_CTX *ctx, + void (*cb) (const SSL *ssl, int type, int val)); +void (*SSL_CTX_get_info_callback(SSL_CTX *ctx)) (const SSL *ssl, int type, + int val); +void SSL_CTX_set_client_cert_cb(SSL_CTX *ctx, + int (*client_cert_cb) (SSL *ssl, X509 **x509, + EVP_PKEY **pkey)); +int (*SSL_CTX_get_client_cert_cb(SSL_CTX *ctx)) (SSL *ssl, X509 **x509, + EVP_PKEY **pkey); +# ifndef OPENSSL_NO_ENGINE +__owur int SSL_CTX_set_client_cert_engine(SSL_CTX *ctx, ENGINE *e); +# endif +void SSL_CTX_set_cookie_generate_cb(SSL_CTX *ctx, + int (*app_gen_cookie_cb) (SSL *ssl, + unsigned char + *cookie, + unsigned int + *cookie_len)); +void SSL_CTX_set_cookie_verify_cb(SSL_CTX *ctx, + int (*app_verify_cookie_cb) (SSL *ssl, + const unsigned + char *cookie, + unsigned int + cookie_len)); + +void SSL_CTX_set_stateless_cookie_generate_cb( + SSL_CTX *ctx, + int (*gen_stateless_cookie_cb) (SSL *ssl, + unsigned char *cookie, + size_t *cookie_len)); +void SSL_CTX_set_stateless_cookie_verify_cb( + SSL_CTX *ctx, + int (*verify_stateless_cookie_cb) (SSL *ssl, + const unsigned char *cookie, + size_t cookie_len)); +# ifndef OPENSSL_NO_NEXTPROTONEG + +typedef int (*SSL_CTX_npn_advertised_cb_func)(SSL *ssl, + const unsigned char **out, + unsigned int *outlen, + void *arg); +void SSL_CTX_set_next_protos_advertised_cb(SSL_CTX *s, + SSL_CTX_npn_advertised_cb_func cb, + void *arg); +# define SSL_CTX_set_npn_advertised_cb SSL_CTX_set_next_protos_advertised_cb + +typedef int (*SSL_CTX_npn_select_cb_func)(SSL *s, + unsigned char **out, + unsigned char *outlen, + const unsigned char *in, + unsigned int inlen, + void *arg); +void SSL_CTX_set_next_proto_select_cb(SSL_CTX *s, + SSL_CTX_npn_select_cb_func cb, + void *arg); +# define SSL_CTX_set_npn_select_cb SSL_CTX_set_next_proto_select_cb + +void SSL_get0_next_proto_negotiated(const SSL *s, const unsigned char **data, + unsigned *len); +# define SSL_get0_npn_negotiated SSL_get0_next_proto_negotiated +# endif + +__owur int SSL_select_next_proto(unsigned char **out, unsigned char *outlen, + const unsigned char *in, unsigned int inlen, + const unsigned char *client, + unsigned int client_len); + +# define OPENSSL_NPN_UNSUPPORTED 0 +# define OPENSSL_NPN_NEGOTIATED 1 +# define OPENSSL_NPN_NO_OVERLAP 2 + +__owur int SSL_CTX_set_alpn_protos(SSL_CTX *ctx, const unsigned char *protos, + unsigned int protos_len); +__owur int SSL_set_alpn_protos(SSL *ssl, const unsigned char *protos, + unsigned int protos_len); +typedef int (*SSL_CTX_alpn_select_cb_func)(SSL *ssl, + const unsigned char **out, + unsigned char *outlen, + const unsigned char *in, + unsigned int inlen, + void *arg); +void SSL_CTX_set_alpn_select_cb(SSL_CTX *ctx, + SSL_CTX_alpn_select_cb_func cb, + void *arg); +void SSL_get0_alpn_selected(const SSL *ssl, const unsigned char **data, + unsigned int *len); + +# ifndef OPENSSL_NO_PSK +/* + * the maximum length of the buffer given to callbacks containing the + * resulting identity/psk + */ +# define PSK_MAX_IDENTITY_LEN 128 +# define PSK_MAX_PSK_LEN 256 +typedef unsigned int (*SSL_psk_client_cb_func)(SSL *ssl, + const char *hint, + char *identity, + unsigned int max_identity_len, + unsigned char *psk, + unsigned int max_psk_len); +void SSL_CTX_set_psk_client_callback(SSL_CTX *ctx, SSL_psk_client_cb_func cb); +void SSL_set_psk_client_callback(SSL *ssl, SSL_psk_client_cb_func cb); + +typedef unsigned int (*SSL_psk_server_cb_func)(SSL *ssl, + const char *identity, + unsigned char *psk, + unsigned int max_psk_len); +void SSL_CTX_set_psk_server_callback(SSL_CTX *ctx, SSL_psk_server_cb_func cb); +void SSL_set_psk_server_callback(SSL *ssl, SSL_psk_server_cb_func cb); + +__owur int SSL_CTX_use_psk_identity_hint(SSL_CTX *ctx, const char *identity_hint); +__owur int SSL_use_psk_identity_hint(SSL *s, const char *identity_hint); +const char *SSL_get_psk_identity_hint(const SSL *s); +const char *SSL_get_psk_identity(const SSL *s); +# endif + +typedef int (*SSL_psk_find_session_cb_func)(SSL *ssl, + const unsigned char *identity, + size_t identity_len, + SSL_SESSION **sess); +typedef int (*SSL_psk_use_session_cb_func)(SSL *ssl, const EVP_MD *md, + const unsigned char **id, + size_t *idlen, + SSL_SESSION **sess); + +void SSL_set_psk_find_session_callback(SSL *s, SSL_psk_find_session_cb_func cb); +void SSL_CTX_set_psk_find_session_callback(SSL_CTX *ctx, + SSL_psk_find_session_cb_func cb); +void SSL_set_psk_use_session_callback(SSL *s, SSL_psk_use_session_cb_func cb); +void SSL_CTX_set_psk_use_session_callback(SSL_CTX *ctx, + SSL_psk_use_session_cb_func cb); + +/* Register callbacks to handle custom TLS Extensions for client or server. */ + +__owur int SSL_CTX_has_client_custom_ext(const SSL_CTX *ctx, + unsigned int ext_type); + +__owur int SSL_CTX_add_client_custom_ext(SSL_CTX *ctx, + unsigned int ext_type, + custom_ext_add_cb add_cb, + custom_ext_free_cb free_cb, + void *add_arg, + custom_ext_parse_cb parse_cb, + void *parse_arg); + +__owur int SSL_CTX_add_server_custom_ext(SSL_CTX *ctx, + unsigned int ext_type, + custom_ext_add_cb add_cb, + custom_ext_free_cb free_cb, + void *add_arg, + custom_ext_parse_cb parse_cb, + void *parse_arg); + +__owur int SSL_CTX_add_custom_ext(SSL_CTX *ctx, unsigned int ext_type, + unsigned int context, + SSL_custom_ext_add_cb_ex add_cb, + SSL_custom_ext_free_cb_ex free_cb, + void *add_arg, + SSL_custom_ext_parse_cb_ex parse_cb, + void *parse_arg); + +__owur int SSL_extension_supported(unsigned int ext_type); + +# define SSL_NOTHING 1 +# define SSL_WRITING 2 +# define SSL_READING 3 +# define SSL_X509_LOOKUP 4 +# define SSL_ASYNC_PAUSED 5 +# define SSL_ASYNC_NO_JOBS 6 +# define SSL_CLIENT_HELLO_CB 7 + +/* These will only be used when doing non-blocking IO */ +# define SSL_want_nothing(s) (SSL_want(s) == SSL_NOTHING) +# define SSL_want_read(s) (SSL_want(s) == SSL_READING) +# define SSL_want_write(s) (SSL_want(s) == SSL_WRITING) +# define SSL_want_x509_lookup(s) (SSL_want(s) == SSL_X509_LOOKUP) +# define SSL_want_async(s) (SSL_want(s) == SSL_ASYNC_PAUSED) +# define SSL_want_async_job(s) (SSL_want(s) == SSL_ASYNC_NO_JOBS) +# define SSL_want_client_hello_cb(s) (SSL_want(s) == SSL_CLIENT_HELLO_CB) + +# define SSL_MAC_FLAG_READ_MAC_STREAM 1 +# define SSL_MAC_FLAG_WRITE_MAC_STREAM 2 + +/* + * A callback for logging out TLS key material. This callback should log out + * |line| followed by a newline. + */ +typedef void (*SSL_CTX_keylog_cb_func)(const SSL *ssl, const char *line); + +/* + * SSL_CTX_set_keylog_callback configures a callback to log key material. This + * is intended for debugging use with tools like Wireshark. The cb function + * should log line followed by a newline. + */ +void SSL_CTX_set_keylog_callback(SSL_CTX *ctx, SSL_CTX_keylog_cb_func cb); + +/* + * SSL_CTX_get_keylog_callback returns the callback configured by + * SSL_CTX_set_keylog_callback. + */ +SSL_CTX_keylog_cb_func SSL_CTX_get_keylog_callback(const SSL_CTX *ctx); + +int SSL_CTX_set_max_early_data(SSL_CTX *ctx, uint32_t max_early_data); +uint32_t SSL_CTX_get_max_early_data(const SSL_CTX *ctx); +int SSL_set_max_early_data(SSL *s, uint32_t max_early_data); +uint32_t SSL_get_max_early_data(const SSL *s); +int SSL_CTX_set_recv_max_early_data(SSL_CTX *ctx, uint32_t recv_max_early_data); +uint32_t SSL_CTX_get_recv_max_early_data(const SSL_CTX *ctx); +int SSL_set_recv_max_early_data(SSL *s, uint32_t recv_max_early_data); +uint32_t SSL_get_recv_max_early_data(const SSL *s); + +#ifdef __cplusplus +} +#endif + +# include +# include +# include /* This is mostly sslv3 with a few tweaks */ +# include /* Datagram TLS */ +# include /* Support for the use_srtp extension */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * These need to be after the above set of includes due to a compiler bug + * in VisualStudio 2015 + */ +DEFINE_STACK_OF_CONST(SSL_CIPHER) +DEFINE_STACK_OF(SSL_COMP) + +/* compatibility */ +# define SSL_set_app_data(s,arg) (SSL_set_ex_data(s,0,(char *)(arg))) +# define SSL_get_app_data(s) (SSL_get_ex_data(s,0)) +# define SSL_SESSION_set_app_data(s,a) (SSL_SESSION_set_ex_data(s,0, \ + (char *)(a))) +# define SSL_SESSION_get_app_data(s) (SSL_SESSION_get_ex_data(s,0)) +# define SSL_CTX_get_app_data(ctx) (SSL_CTX_get_ex_data(ctx,0)) +# define SSL_CTX_set_app_data(ctx,arg) (SSL_CTX_set_ex_data(ctx,0, \ + (char *)(arg))) +DEPRECATEDIN_1_1_0(void SSL_set_debug(SSL *s, int debug)) + +/* TLSv1.3 KeyUpdate message types */ +/* -1 used so that this is an invalid value for the on-the-wire protocol */ +#define SSL_KEY_UPDATE_NONE -1 +/* Values as defined for the on-the-wire protocol */ +#define SSL_KEY_UPDATE_NOT_REQUESTED 0 +#define SSL_KEY_UPDATE_REQUESTED 1 + +/* + * The valid handshake states (one for each type message sent and one for each + * type of message received). There are also two "special" states: + * TLS = TLS or DTLS state + * DTLS = DTLS specific state + * CR/SR = Client Read/Server Read + * CW/SW = Client Write/Server Write + * + * The "special" states are: + * TLS_ST_BEFORE = No handshake has been initiated yet + * TLS_ST_OK = A handshake has been successfully completed + */ +typedef enum { + TLS_ST_BEFORE, + TLS_ST_OK, + DTLS_ST_CR_HELLO_VERIFY_REQUEST, + TLS_ST_CR_SRVR_HELLO, + TLS_ST_CR_CERT, + TLS_ST_CR_CERT_STATUS, + TLS_ST_CR_KEY_EXCH, + TLS_ST_CR_CERT_REQ, + TLS_ST_CR_SRVR_DONE, + TLS_ST_CR_SESSION_TICKET, + TLS_ST_CR_CHANGE, + TLS_ST_CR_FINISHED, + TLS_ST_CW_CLNT_HELLO, + TLS_ST_CW_CERT, + TLS_ST_CW_KEY_EXCH, + TLS_ST_CW_CERT_VRFY, + TLS_ST_CW_CHANGE, + TLS_ST_CW_NEXT_PROTO, + TLS_ST_CW_FINISHED, + TLS_ST_SW_HELLO_REQ, + TLS_ST_SR_CLNT_HELLO, + DTLS_ST_SW_HELLO_VERIFY_REQUEST, + TLS_ST_SW_SRVR_HELLO, + TLS_ST_SW_CERT, + TLS_ST_SW_KEY_EXCH, + TLS_ST_SW_CERT_REQ, + TLS_ST_SW_SRVR_DONE, + TLS_ST_SR_CERT, + TLS_ST_SR_KEY_EXCH, + TLS_ST_SR_CERT_VRFY, + TLS_ST_SR_NEXT_PROTO, + TLS_ST_SR_CHANGE, + TLS_ST_SR_FINISHED, + TLS_ST_SW_SESSION_TICKET, + TLS_ST_SW_CERT_STATUS, + TLS_ST_SW_CHANGE, + TLS_ST_SW_FINISHED, + TLS_ST_SW_ENCRYPTED_EXTENSIONS, + TLS_ST_CR_ENCRYPTED_EXTENSIONS, + TLS_ST_CR_CERT_VRFY, + TLS_ST_SW_CERT_VRFY, + TLS_ST_CR_HELLO_REQ, + TLS_ST_SW_KEY_UPDATE, + TLS_ST_CW_KEY_UPDATE, + TLS_ST_SR_KEY_UPDATE, + TLS_ST_CR_KEY_UPDATE, + TLS_ST_EARLY_DATA, + TLS_ST_PENDING_EARLY_DATA_END, + TLS_ST_CW_END_OF_EARLY_DATA, + TLS_ST_SR_END_OF_EARLY_DATA +} OSSL_HANDSHAKE_STATE; + +/* + * Most of the following state values are no longer used and are defined to be + * the closest equivalent value in the current state machine code. Not all + * defines have an equivalent and are set to a dummy value (-1). SSL_ST_CONNECT + * and SSL_ST_ACCEPT are still in use in the definition of SSL_CB_ACCEPT_LOOP, + * SSL_CB_ACCEPT_EXIT, SSL_CB_CONNECT_LOOP and SSL_CB_CONNECT_EXIT. + */ + +# define SSL_ST_CONNECT 0x1000 +# define SSL_ST_ACCEPT 0x2000 + +# define SSL_ST_MASK 0x0FFF + +# define SSL_CB_LOOP 0x01 +# define SSL_CB_EXIT 0x02 +# define SSL_CB_READ 0x04 +# define SSL_CB_WRITE 0x08 +# define SSL_CB_ALERT 0x4000/* used in callback */ +# define SSL_CB_READ_ALERT (SSL_CB_ALERT|SSL_CB_READ) +# define SSL_CB_WRITE_ALERT (SSL_CB_ALERT|SSL_CB_WRITE) +# define SSL_CB_ACCEPT_LOOP (SSL_ST_ACCEPT|SSL_CB_LOOP) +# define SSL_CB_ACCEPT_EXIT (SSL_ST_ACCEPT|SSL_CB_EXIT) +# define SSL_CB_CONNECT_LOOP (SSL_ST_CONNECT|SSL_CB_LOOP) +# define SSL_CB_CONNECT_EXIT (SSL_ST_CONNECT|SSL_CB_EXIT) +# define SSL_CB_HANDSHAKE_START 0x10 +# define SSL_CB_HANDSHAKE_DONE 0x20 + +/* Is the SSL_connection established? */ +# define SSL_in_connect_init(a) (SSL_in_init(a) && !SSL_is_server(a)) +# define SSL_in_accept_init(a) (SSL_in_init(a) && SSL_is_server(a)) +int SSL_in_init(const SSL *s); +int SSL_in_before(const SSL *s); +int SSL_is_init_finished(const SSL *s); + +/* + * The following 3 states are kept in ssl->rlayer.rstate when reads fail, you + * should not need these + */ +# define SSL_ST_READ_HEADER 0xF0 +# define SSL_ST_READ_BODY 0xF1 +# define SSL_ST_READ_DONE 0xF2 + +/*- + * Obtain latest Finished message + * -- that we sent (SSL_get_finished) + * -- that we expected from peer (SSL_get_peer_finished). + * Returns length (0 == no Finished so far), copies up to 'count' bytes. + */ +size_t SSL_get_finished(const SSL *s, void *buf, size_t count); +size_t SSL_get_peer_finished(const SSL *s, void *buf, size_t count); + +/* + * use either SSL_VERIFY_NONE or SSL_VERIFY_PEER, the last 3 options are + * 'ored' with SSL_VERIFY_PEER if they are desired + */ +# define SSL_VERIFY_NONE 0x00 +# define SSL_VERIFY_PEER 0x01 +# define SSL_VERIFY_FAIL_IF_NO_PEER_CERT 0x02 +# define SSL_VERIFY_CLIENT_ONCE 0x04 +# define SSL_VERIFY_POST_HANDSHAKE 0x08 + +# if OPENSSL_API_COMPAT < 0x10100000L +# define OpenSSL_add_ssl_algorithms() SSL_library_init() +# define SSLeay_add_ssl_algorithms() SSL_library_init() +# endif + +/* More backward compatibility */ +# define SSL_get_cipher(s) \ + SSL_CIPHER_get_name(SSL_get_current_cipher(s)) +# define SSL_get_cipher_bits(s,np) \ + SSL_CIPHER_get_bits(SSL_get_current_cipher(s),np) +# define SSL_get_cipher_version(s) \ + SSL_CIPHER_get_version(SSL_get_current_cipher(s)) +# define SSL_get_cipher_name(s) \ + SSL_CIPHER_get_name(SSL_get_current_cipher(s)) +# define SSL_get_time(a) SSL_SESSION_get_time(a) +# define SSL_set_time(a,b) SSL_SESSION_set_time((a),(b)) +# define SSL_get_timeout(a) SSL_SESSION_get_timeout(a) +# define SSL_set_timeout(a,b) SSL_SESSION_set_timeout((a),(b)) + +# define d2i_SSL_SESSION_bio(bp,s_id) ASN1_d2i_bio_of(SSL_SESSION,SSL_SESSION_new,d2i_SSL_SESSION,bp,s_id) +# define i2d_SSL_SESSION_bio(bp,s_id) ASN1_i2d_bio_of(SSL_SESSION,i2d_SSL_SESSION,bp,s_id) + +DECLARE_PEM_rw(SSL_SESSION, SSL_SESSION) +# define SSL_AD_REASON_OFFSET 1000/* offset to get SSL_R_... value + * from SSL_AD_... */ +/* These alert types are for SSLv3 and TLSv1 */ +# define SSL_AD_CLOSE_NOTIFY SSL3_AD_CLOSE_NOTIFY +/* fatal */ +# define SSL_AD_UNEXPECTED_MESSAGE SSL3_AD_UNEXPECTED_MESSAGE +/* fatal */ +# define SSL_AD_BAD_RECORD_MAC SSL3_AD_BAD_RECORD_MAC +# define SSL_AD_DECRYPTION_FAILED TLS1_AD_DECRYPTION_FAILED +# define SSL_AD_RECORD_OVERFLOW TLS1_AD_RECORD_OVERFLOW +/* fatal */ +# define SSL_AD_DECOMPRESSION_FAILURE SSL3_AD_DECOMPRESSION_FAILURE +/* fatal */ +# define SSL_AD_HANDSHAKE_FAILURE SSL3_AD_HANDSHAKE_FAILURE +/* Not for TLS */ +# define SSL_AD_NO_CERTIFICATE SSL3_AD_NO_CERTIFICATE +# define SSL_AD_BAD_CERTIFICATE SSL3_AD_BAD_CERTIFICATE +# define SSL_AD_UNSUPPORTED_CERTIFICATE SSL3_AD_UNSUPPORTED_CERTIFICATE +# define SSL_AD_CERTIFICATE_REVOKED SSL3_AD_CERTIFICATE_REVOKED +# define SSL_AD_CERTIFICATE_EXPIRED SSL3_AD_CERTIFICATE_EXPIRED +# define SSL_AD_CERTIFICATE_UNKNOWN SSL3_AD_CERTIFICATE_UNKNOWN +/* fatal */ +# define SSL_AD_ILLEGAL_PARAMETER SSL3_AD_ILLEGAL_PARAMETER +/* fatal */ +# define SSL_AD_UNKNOWN_CA TLS1_AD_UNKNOWN_CA +/* fatal */ +# define SSL_AD_ACCESS_DENIED TLS1_AD_ACCESS_DENIED +/* fatal */ +# define SSL_AD_DECODE_ERROR TLS1_AD_DECODE_ERROR +# define SSL_AD_DECRYPT_ERROR TLS1_AD_DECRYPT_ERROR +/* fatal */ +# define SSL_AD_EXPORT_RESTRICTION TLS1_AD_EXPORT_RESTRICTION +/* fatal */ +# define SSL_AD_PROTOCOL_VERSION TLS1_AD_PROTOCOL_VERSION +/* fatal */ +# define SSL_AD_INSUFFICIENT_SECURITY TLS1_AD_INSUFFICIENT_SECURITY +/* fatal */ +# define SSL_AD_INTERNAL_ERROR TLS1_AD_INTERNAL_ERROR +# define SSL_AD_USER_CANCELLED TLS1_AD_USER_CANCELLED +# define SSL_AD_NO_RENEGOTIATION TLS1_AD_NO_RENEGOTIATION +# define SSL_AD_MISSING_EXTENSION TLS13_AD_MISSING_EXTENSION +# define SSL_AD_CERTIFICATE_REQUIRED TLS13_AD_CERTIFICATE_REQUIRED +# define SSL_AD_UNSUPPORTED_EXTENSION TLS1_AD_UNSUPPORTED_EXTENSION +# define SSL_AD_CERTIFICATE_UNOBTAINABLE TLS1_AD_CERTIFICATE_UNOBTAINABLE +# define SSL_AD_UNRECOGNIZED_NAME TLS1_AD_UNRECOGNIZED_NAME +# define SSL_AD_BAD_CERTIFICATE_STATUS_RESPONSE TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE +# define SSL_AD_BAD_CERTIFICATE_HASH_VALUE TLS1_AD_BAD_CERTIFICATE_HASH_VALUE +/* fatal */ +# define SSL_AD_UNKNOWN_PSK_IDENTITY TLS1_AD_UNKNOWN_PSK_IDENTITY +/* fatal */ +# define SSL_AD_INAPPROPRIATE_FALLBACK TLS1_AD_INAPPROPRIATE_FALLBACK +# define SSL_AD_NO_APPLICATION_PROTOCOL TLS1_AD_NO_APPLICATION_PROTOCOL +# define SSL_ERROR_NONE 0 +# define SSL_ERROR_SSL 1 +# define SSL_ERROR_WANT_READ 2 +# define SSL_ERROR_WANT_WRITE 3 +# define SSL_ERROR_WANT_X509_LOOKUP 4 +# define SSL_ERROR_SYSCALL 5/* look at error stack/return + * value/errno */ +# define SSL_ERROR_ZERO_RETURN 6 +# define SSL_ERROR_WANT_CONNECT 7 +# define SSL_ERROR_WANT_ACCEPT 8 +# define SSL_ERROR_WANT_ASYNC 9 +# define SSL_ERROR_WANT_ASYNC_JOB 10 +# define SSL_ERROR_WANT_CLIENT_HELLO_CB 11 +# define SSL_CTRL_SET_TMP_DH 3 +# define SSL_CTRL_SET_TMP_ECDH 4 +# define SSL_CTRL_SET_TMP_DH_CB 6 +# define SSL_CTRL_GET_CLIENT_CERT_REQUEST 9 +# define SSL_CTRL_GET_NUM_RENEGOTIATIONS 10 +# define SSL_CTRL_CLEAR_NUM_RENEGOTIATIONS 11 +# define SSL_CTRL_GET_TOTAL_RENEGOTIATIONS 12 +# define SSL_CTRL_GET_FLAGS 13 +# define SSL_CTRL_EXTRA_CHAIN_CERT 14 +# define SSL_CTRL_SET_MSG_CALLBACK 15 +# define SSL_CTRL_SET_MSG_CALLBACK_ARG 16 +/* only applies to datagram connections */ +# define SSL_CTRL_SET_MTU 17 +/* Stats */ +# define SSL_CTRL_SESS_NUMBER 20 +# define SSL_CTRL_SESS_CONNECT 21 +# define SSL_CTRL_SESS_CONNECT_GOOD 22 +# define SSL_CTRL_SESS_CONNECT_RENEGOTIATE 23 +# define SSL_CTRL_SESS_ACCEPT 24 +# define SSL_CTRL_SESS_ACCEPT_GOOD 25 +# define SSL_CTRL_SESS_ACCEPT_RENEGOTIATE 26 +# define SSL_CTRL_SESS_HIT 27 +# define SSL_CTRL_SESS_CB_HIT 28 +# define SSL_CTRL_SESS_MISSES 29 +# define SSL_CTRL_SESS_TIMEOUTS 30 +# define SSL_CTRL_SESS_CACHE_FULL 31 +# define SSL_CTRL_MODE 33 +# define SSL_CTRL_GET_READ_AHEAD 40 +# define SSL_CTRL_SET_READ_AHEAD 41 +# define SSL_CTRL_SET_SESS_CACHE_SIZE 42 +# define SSL_CTRL_GET_SESS_CACHE_SIZE 43 +# define SSL_CTRL_SET_SESS_CACHE_MODE 44 +# define SSL_CTRL_GET_SESS_CACHE_MODE 45 +# define SSL_CTRL_GET_MAX_CERT_LIST 50 +# define SSL_CTRL_SET_MAX_CERT_LIST 51 +# define SSL_CTRL_SET_MAX_SEND_FRAGMENT 52 +/* see tls1.h for macros based on these */ +# define SSL_CTRL_SET_TLSEXT_SERVERNAME_CB 53 +# define SSL_CTRL_SET_TLSEXT_SERVERNAME_ARG 54 +# define SSL_CTRL_SET_TLSEXT_HOSTNAME 55 +# define SSL_CTRL_SET_TLSEXT_DEBUG_CB 56 +# define SSL_CTRL_SET_TLSEXT_DEBUG_ARG 57 +# define SSL_CTRL_GET_TLSEXT_TICKET_KEYS 58 +# define SSL_CTRL_SET_TLSEXT_TICKET_KEYS 59 +/*# define SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT 60 */ +/*# define SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT_CB 61 */ +/*# define SSL_CTRL_SET_TLSEXT_OPAQUE_PRF_INPUT_CB_ARG 62 */ +# define SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB 63 +# define SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB_ARG 64 +# define SSL_CTRL_SET_TLSEXT_STATUS_REQ_TYPE 65 +# define SSL_CTRL_GET_TLSEXT_STATUS_REQ_EXTS 66 +# define SSL_CTRL_SET_TLSEXT_STATUS_REQ_EXTS 67 +# define SSL_CTRL_GET_TLSEXT_STATUS_REQ_IDS 68 +# define SSL_CTRL_SET_TLSEXT_STATUS_REQ_IDS 69 +# define SSL_CTRL_GET_TLSEXT_STATUS_REQ_OCSP_RESP 70 +# define SSL_CTRL_SET_TLSEXT_STATUS_REQ_OCSP_RESP 71 +# define SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB 72 +# define SSL_CTRL_SET_TLS_EXT_SRP_USERNAME_CB 75 +# define SSL_CTRL_SET_SRP_VERIFY_PARAM_CB 76 +# define SSL_CTRL_SET_SRP_GIVE_CLIENT_PWD_CB 77 +# define SSL_CTRL_SET_SRP_ARG 78 +# define SSL_CTRL_SET_TLS_EXT_SRP_USERNAME 79 +# define SSL_CTRL_SET_TLS_EXT_SRP_STRENGTH 80 +# define SSL_CTRL_SET_TLS_EXT_SRP_PASSWORD 81 +# ifndef OPENSSL_NO_HEARTBEATS +# define SSL_CTRL_DTLS_EXT_SEND_HEARTBEAT 85 +# define SSL_CTRL_GET_DTLS_EXT_HEARTBEAT_PENDING 86 +# define SSL_CTRL_SET_DTLS_EXT_HEARTBEAT_NO_REQUESTS 87 +# endif +# define DTLS_CTRL_GET_TIMEOUT 73 +# define DTLS_CTRL_HANDLE_TIMEOUT 74 +# define SSL_CTRL_GET_RI_SUPPORT 76 +# define SSL_CTRL_CLEAR_MODE 78 +# define SSL_CTRL_SET_NOT_RESUMABLE_SESS_CB 79 +# define SSL_CTRL_GET_EXTRA_CHAIN_CERTS 82 +# define SSL_CTRL_CLEAR_EXTRA_CHAIN_CERTS 83 +# define SSL_CTRL_CHAIN 88 +# define SSL_CTRL_CHAIN_CERT 89 +# define SSL_CTRL_GET_GROUPS 90 +# define SSL_CTRL_SET_GROUPS 91 +# define SSL_CTRL_SET_GROUPS_LIST 92 +# define SSL_CTRL_GET_SHARED_GROUP 93 +# define SSL_CTRL_SET_SIGALGS 97 +# define SSL_CTRL_SET_SIGALGS_LIST 98 +# define SSL_CTRL_CERT_FLAGS 99 +# define SSL_CTRL_CLEAR_CERT_FLAGS 100 +# define SSL_CTRL_SET_CLIENT_SIGALGS 101 +# define SSL_CTRL_SET_CLIENT_SIGALGS_LIST 102 +# define SSL_CTRL_GET_CLIENT_CERT_TYPES 103 +# define SSL_CTRL_SET_CLIENT_CERT_TYPES 104 +# define SSL_CTRL_BUILD_CERT_CHAIN 105 +# define SSL_CTRL_SET_VERIFY_CERT_STORE 106 +# define SSL_CTRL_SET_CHAIN_CERT_STORE 107 +# define SSL_CTRL_GET_PEER_SIGNATURE_NID 108 +# define SSL_CTRL_GET_PEER_TMP_KEY 109 +# define SSL_CTRL_GET_RAW_CIPHERLIST 110 +# define SSL_CTRL_GET_EC_POINT_FORMATS 111 +# define SSL_CTRL_GET_CHAIN_CERTS 115 +# define SSL_CTRL_SELECT_CURRENT_CERT 116 +# define SSL_CTRL_SET_CURRENT_CERT 117 +# define SSL_CTRL_SET_DH_AUTO 118 +# define DTLS_CTRL_SET_LINK_MTU 120 +# define DTLS_CTRL_GET_LINK_MIN_MTU 121 +# define SSL_CTRL_GET_EXTMS_SUPPORT 122 +# define SSL_CTRL_SET_MIN_PROTO_VERSION 123 +# define SSL_CTRL_SET_MAX_PROTO_VERSION 124 +# define SSL_CTRL_SET_SPLIT_SEND_FRAGMENT 125 +# define SSL_CTRL_SET_MAX_PIPELINES 126 +# define SSL_CTRL_GET_TLSEXT_STATUS_REQ_TYPE 127 +# define SSL_CTRL_GET_TLSEXT_STATUS_REQ_CB 128 +# define SSL_CTRL_GET_TLSEXT_STATUS_REQ_CB_ARG 129 +# define SSL_CTRL_GET_MIN_PROTO_VERSION 130 +# define SSL_CTRL_GET_MAX_PROTO_VERSION 131 +# define SSL_CTRL_GET_SIGNATURE_NID 132 +# define SSL_CTRL_GET_TMP_KEY 133 +# define SSL_CERT_SET_FIRST 1 +# define SSL_CERT_SET_NEXT 2 +# define SSL_CERT_SET_SERVER 3 +# define DTLSv1_get_timeout(ssl, arg) \ + SSL_ctrl(ssl,DTLS_CTRL_GET_TIMEOUT,0, (void *)(arg)) +# define DTLSv1_handle_timeout(ssl) \ + SSL_ctrl(ssl,DTLS_CTRL_HANDLE_TIMEOUT,0, NULL) +# define SSL_num_renegotiations(ssl) \ + SSL_ctrl((ssl),SSL_CTRL_GET_NUM_RENEGOTIATIONS,0,NULL) +# define SSL_clear_num_renegotiations(ssl) \ + SSL_ctrl((ssl),SSL_CTRL_CLEAR_NUM_RENEGOTIATIONS,0,NULL) +# define SSL_total_renegotiations(ssl) \ + SSL_ctrl((ssl),SSL_CTRL_GET_TOTAL_RENEGOTIATIONS,0,NULL) +# define SSL_CTX_set_tmp_dh(ctx,dh) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_DH,0,(char *)(dh)) +# define SSL_CTX_set_tmp_ecdh(ctx,ecdh) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_ECDH,0,(char *)(ecdh)) +# define SSL_CTX_set_dh_auto(ctx, onoff) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_DH_AUTO,onoff,NULL) +# define SSL_set_dh_auto(s, onoff) \ + SSL_ctrl(s,SSL_CTRL_SET_DH_AUTO,onoff,NULL) +# define SSL_set_tmp_dh(ssl,dh) \ + SSL_ctrl(ssl,SSL_CTRL_SET_TMP_DH,0,(char *)(dh)) +# define SSL_set_tmp_ecdh(ssl,ecdh) \ + SSL_ctrl(ssl,SSL_CTRL_SET_TMP_ECDH,0,(char *)(ecdh)) +# define SSL_CTX_add_extra_chain_cert(ctx,x509) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_EXTRA_CHAIN_CERT,0,(char *)(x509)) +# define SSL_CTX_get_extra_chain_certs(ctx,px509) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_GET_EXTRA_CHAIN_CERTS,0,px509) +# define SSL_CTX_get_extra_chain_certs_only(ctx,px509) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_GET_EXTRA_CHAIN_CERTS,1,px509) +# define SSL_CTX_clear_extra_chain_certs(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_CLEAR_EXTRA_CHAIN_CERTS,0,NULL) +# define SSL_CTX_set0_chain(ctx,sk) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_CHAIN,0,(char *)(sk)) +# define SSL_CTX_set1_chain(ctx,sk) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_CHAIN,1,(char *)(sk)) +# define SSL_CTX_add0_chain_cert(ctx,x509) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_CHAIN_CERT,0,(char *)(x509)) +# define SSL_CTX_add1_chain_cert(ctx,x509) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_CHAIN_CERT,1,(char *)(x509)) +# define SSL_CTX_get0_chain_certs(ctx,px509) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_GET_CHAIN_CERTS,0,px509) +# define SSL_CTX_clear_chain_certs(ctx) \ + SSL_CTX_set0_chain(ctx,NULL) +# define SSL_CTX_build_cert_chain(ctx, flags) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_BUILD_CERT_CHAIN, flags, NULL) +# define SSL_CTX_select_current_cert(ctx,x509) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SELECT_CURRENT_CERT,0,(char *)(x509)) +# define SSL_CTX_set_current_cert(ctx, op) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CURRENT_CERT, op, NULL) +# define SSL_CTX_set0_verify_cert_store(ctx,st) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_VERIFY_CERT_STORE,0,(char *)(st)) +# define SSL_CTX_set1_verify_cert_store(ctx,st) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_VERIFY_CERT_STORE,1,(char *)(st)) +# define SSL_CTX_set0_chain_cert_store(ctx,st) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CHAIN_CERT_STORE,0,(char *)(st)) +# define SSL_CTX_set1_chain_cert_store(ctx,st) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CHAIN_CERT_STORE,1,(char *)(st)) +# define SSL_set0_chain(s,sk) \ + SSL_ctrl(s,SSL_CTRL_CHAIN,0,(char *)(sk)) +# define SSL_set1_chain(s,sk) \ + SSL_ctrl(s,SSL_CTRL_CHAIN,1,(char *)(sk)) +# define SSL_add0_chain_cert(s,x509) \ + SSL_ctrl(s,SSL_CTRL_CHAIN_CERT,0,(char *)(x509)) +# define SSL_add1_chain_cert(s,x509) \ + SSL_ctrl(s,SSL_CTRL_CHAIN_CERT,1,(char *)(x509)) +# define SSL_get0_chain_certs(s,px509) \ + SSL_ctrl(s,SSL_CTRL_GET_CHAIN_CERTS,0,px509) +# define SSL_clear_chain_certs(s) \ + SSL_set0_chain(s,NULL) +# define SSL_build_cert_chain(s, flags) \ + SSL_ctrl(s,SSL_CTRL_BUILD_CERT_CHAIN, flags, NULL) +# define SSL_select_current_cert(s,x509) \ + SSL_ctrl(s,SSL_CTRL_SELECT_CURRENT_CERT,0,(char *)(x509)) +# define SSL_set_current_cert(s,op) \ + SSL_ctrl(s,SSL_CTRL_SET_CURRENT_CERT, op, NULL) +# define SSL_set0_verify_cert_store(s,st) \ + SSL_ctrl(s,SSL_CTRL_SET_VERIFY_CERT_STORE,0,(char *)(st)) +# define SSL_set1_verify_cert_store(s,st) \ + SSL_ctrl(s,SSL_CTRL_SET_VERIFY_CERT_STORE,1,(char *)(st)) +# define SSL_set0_chain_cert_store(s,st) \ + SSL_ctrl(s,SSL_CTRL_SET_CHAIN_CERT_STORE,0,(char *)(st)) +# define SSL_set1_chain_cert_store(s,st) \ + SSL_ctrl(s,SSL_CTRL_SET_CHAIN_CERT_STORE,1,(char *)(st)) +# define SSL_get1_groups(s, glist) \ + SSL_ctrl(s,SSL_CTRL_GET_GROUPS,0,(int*)(glist)) +# define SSL_CTX_set1_groups(ctx, glist, glistlen) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_GROUPS,glistlen,(char *)(glist)) +# define SSL_CTX_set1_groups_list(ctx, s) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_GROUPS_LIST,0,(char *)(s)) +# define SSL_set1_groups(s, glist, glistlen) \ + SSL_ctrl(s,SSL_CTRL_SET_GROUPS,glistlen,(char *)(glist)) +# define SSL_set1_groups_list(s, str) \ + SSL_ctrl(s,SSL_CTRL_SET_GROUPS_LIST,0,(char *)(str)) +# define SSL_get_shared_group(s, n) \ + SSL_ctrl(s,SSL_CTRL_GET_SHARED_GROUP,n,NULL) +# define SSL_CTX_set1_sigalgs(ctx, slist, slistlen) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SIGALGS,slistlen,(int *)(slist)) +# define SSL_CTX_set1_sigalgs_list(ctx, s) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SIGALGS_LIST,0,(char *)(s)) +# define SSL_set1_sigalgs(s, slist, slistlen) \ + SSL_ctrl(s,SSL_CTRL_SET_SIGALGS,slistlen,(int *)(slist)) +# define SSL_set1_sigalgs_list(s, str) \ + SSL_ctrl(s,SSL_CTRL_SET_SIGALGS_LIST,0,(char *)(str)) +# define SSL_CTX_set1_client_sigalgs(ctx, slist, slistlen) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CLIENT_SIGALGS,slistlen,(int *)(slist)) +# define SSL_CTX_set1_client_sigalgs_list(ctx, s) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CLIENT_SIGALGS_LIST,0,(char *)(s)) +# define SSL_set1_client_sigalgs(s, slist, slistlen) \ + SSL_ctrl(s,SSL_CTRL_SET_CLIENT_SIGALGS,slistlen,(int *)(slist)) +# define SSL_set1_client_sigalgs_list(s, str) \ + SSL_ctrl(s,SSL_CTRL_SET_CLIENT_SIGALGS_LIST,0,(char *)(str)) +# define SSL_get0_certificate_types(s, clist) \ + SSL_ctrl(s, SSL_CTRL_GET_CLIENT_CERT_TYPES, 0, (char *)(clist)) +# define SSL_CTX_set1_client_certificate_types(ctx, clist, clistlen) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_CLIENT_CERT_TYPES,clistlen, \ + (char *)(clist)) +# define SSL_set1_client_certificate_types(s, clist, clistlen) \ + SSL_ctrl(s,SSL_CTRL_SET_CLIENT_CERT_TYPES,clistlen,(char *)(clist)) +# define SSL_get_signature_nid(s, pn) \ + SSL_ctrl(s,SSL_CTRL_GET_SIGNATURE_NID,0,pn) +# define SSL_get_peer_signature_nid(s, pn) \ + SSL_ctrl(s,SSL_CTRL_GET_PEER_SIGNATURE_NID,0,pn) +# define SSL_get_peer_tmp_key(s, pk) \ + SSL_ctrl(s,SSL_CTRL_GET_PEER_TMP_KEY,0,pk) +# define SSL_get_tmp_key(s, pk) \ + SSL_ctrl(s,SSL_CTRL_GET_TMP_KEY,0,pk) +# define SSL_get0_raw_cipherlist(s, plst) \ + SSL_ctrl(s,SSL_CTRL_GET_RAW_CIPHERLIST,0,plst) +# define SSL_get0_ec_point_formats(s, plst) \ + SSL_ctrl(s,SSL_CTRL_GET_EC_POINT_FORMATS,0,plst) +# define SSL_CTX_set_min_proto_version(ctx, version) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_MIN_PROTO_VERSION, version, NULL) +# define SSL_CTX_set_max_proto_version(ctx, version) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_SET_MAX_PROTO_VERSION, version, NULL) +# define SSL_CTX_get_min_proto_version(ctx) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_GET_MIN_PROTO_VERSION, 0, NULL) +# define SSL_CTX_get_max_proto_version(ctx) \ + SSL_CTX_ctrl(ctx, SSL_CTRL_GET_MAX_PROTO_VERSION, 0, NULL) +# define SSL_set_min_proto_version(s, version) \ + SSL_ctrl(s, SSL_CTRL_SET_MIN_PROTO_VERSION, version, NULL) +# define SSL_set_max_proto_version(s, version) \ + SSL_ctrl(s, SSL_CTRL_SET_MAX_PROTO_VERSION, version, NULL) +# define SSL_get_min_proto_version(s) \ + SSL_ctrl(s, SSL_CTRL_GET_MIN_PROTO_VERSION, 0, NULL) +# define SSL_get_max_proto_version(s) \ + SSL_ctrl(s, SSL_CTRL_GET_MAX_PROTO_VERSION, 0, NULL) + +/* Backwards compatibility, original 1.1.0 names */ +# define SSL_CTRL_GET_SERVER_TMP_KEY \ + SSL_CTRL_GET_PEER_TMP_KEY +# define SSL_get_server_tmp_key(s, pk) \ + SSL_get_peer_tmp_key(s, pk) + +/* + * The following symbol names are old and obsolete. They are kept + * for compatibility reasons only and should not be used anymore. + */ +# define SSL_CTRL_GET_CURVES SSL_CTRL_GET_GROUPS +# define SSL_CTRL_SET_CURVES SSL_CTRL_SET_GROUPS +# define SSL_CTRL_SET_CURVES_LIST SSL_CTRL_SET_GROUPS_LIST +# define SSL_CTRL_GET_SHARED_CURVE SSL_CTRL_GET_SHARED_GROUP + +# define SSL_get1_curves SSL_get1_groups +# define SSL_CTX_set1_curves SSL_CTX_set1_groups +# define SSL_CTX_set1_curves_list SSL_CTX_set1_groups_list +# define SSL_set1_curves SSL_set1_groups +# define SSL_set1_curves_list SSL_set1_groups_list +# define SSL_get_shared_curve SSL_get_shared_group + + +# if OPENSSL_API_COMPAT < 0x10100000L +/* Provide some compatibility macros for removed functionality. */ +# define SSL_CTX_need_tmp_RSA(ctx) 0 +# define SSL_CTX_set_tmp_rsa(ctx,rsa) 1 +# define SSL_need_tmp_RSA(ssl) 0 +# define SSL_set_tmp_rsa(ssl,rsa) 1 +# define SSL_CTX_set_ecdh_auto(dummy, onoff) ((onoff) != 0) +# define SSL_set_ecdh_auto(dummy, onoff) ((onoff) != 0) +/* + * We "pretend" to call the callback to avoid warnings about unused static + * functions. + */ +# define SSL_CTX_set_tmp_rsa_callback(ctx, cb) while(0) (cb)(NULL, 0, 0) +# define SSL_set_tmp_rsa_callback(ssl, cb) while(0) (cb)(NULL, 0, 0) +# endif +__owur const BIO_METHOD *BIO_f_ssl(void); +__owur BIO *BIO_new_ssl(SSL_CTX *ctx, int client); +__owur BIO *BIO_new_ssl_connect(SSL_CTX *ctx); +__owur BIO *BIO_new_buffer_ssl_connect(SSL_CTX *ctx); +__owur int BIO_ssl_copy_session_id(BIO *to, BIO *from); +void BIO_ssl_shutdown(BIO *ssl_bio); + +__owur int SSL_CTX_set_cipher_list(SSL_CTX *, const char *str); +__owur SSL_CTX *SSL_CTX_new(const SSL_METHOD *meth); +int SSL_CTX_up_ref(SSL_CTX *ctx); +void SSL_CTX_free(SSL_CTX *); +__owur long SSL_CTX_set_timeout(SSL_CTX *ctx, long t); +__owur long SSL_CTX_get_timeout(const SSL_CTX *ctx); +__owur X509_STORE *SSL_CTX_get_cert_store(const SSL_CTX *); +void SSL_CTX_set_cert_store(SSL_CTX *, X509_STORE *); +void SSL_CTX_set1_cert_store(SSL_CTX *, X509_STORE *); +__owur int SSL_want(const SSL *s); +__owur int SSL_clear(SSL *s); + +void SSL_CTX_flush_sessions(SSL_CTX *ctx, long tm); + +__owur const SSL_CIPHER *SSL_get_current_cipher(const SSL *s); +__owur const SSL_CIPHER *SSL_get_pending_cipher(const SSL *s); +__owur int SSL_CIPHER_get_bits(const SSL_CIPHER *c, int *alg_bits); +__owur const char *SSL_CIPHER_get_version(const SSL_CIPHER *c); +__owur const char *SSL_CIPHER_get_name(const SSL_CIPHER *c); +__owur const char *SSL_CIPHER_standard_name(const SSL_CIPHER *c); +__owur const char *OPENSSL_cipher_name(const char *rfc_name); +__owur uint32_t SSL_CIPHER_get_id(const SSL_CIPHER *c); +__owur uint16_t SSL_CIPHER_get_protocol_id(const SSL_CIPHER *c); +__owur int SSL_CIPHER_get_kx_nid(const SSL_CIPHER *c); +__owur int SSL_CIPHER_get_auth_nid(const SSL_CIPHER *c); +__owur const EVP_MD *SSL_CIPHER_get_handshake_digest(const SSL_CIPHER *c); +__owur int SSL_CIPHER_is_aead(const SSL_CIPHER *c); + +__owur int SSL_get_fd(const SSL *s); +__owur int SSL_get_rfd(const SSL *s); +__owur int SSL_get_wfd(const SSL *s); +__owur const char *SSL_get_cipher_list(const SSL *s, int n); +__owur char *SSL_get_shared_ciphers(const SSL *s, char *buf, int size); +__owur int SSL_get_read_ahead(const SSL *s); +__owur int SSL_pending(const SSL *s); +__owur int SSL_has_pending(const SSL *s); +# ifndef OPENSSL_NO_SOCK +__owur int SSL_set_fd(SSL *s, int fd); +__owur int SSL_set_rfd(SSL *s, int fd); +__owur int SSL_set_wfd(SSL *s, int fd); +# endif +void SSL_set0_rbio(SSL *s, BIO *rbio); +void SSL_set0_wbio(SSL *s, BIO *wbio); +void SSL_set_bio(SSL *s, BIO *rbio, BIO *wbio); +__owur BIO *SSL_get_rbio(const SSL *s); +__owur BIO *SSL_get_wbio(const SSL *s); +__owur int SSL_set_cipher_list(SSL *s, const char *str); +__owur int SSL_CTX_set_ciphersuites(SSL_CTX *ctx, const char *str); +__owur int SSL_set_ciphersuites(SSL *s, const char *str); +void SSL_set_read_ahead(SSL *s, int yes); +__owur int SSL_get_verify_mode(const SSL *s); +__owur int SSL_get_verify_depth(const SSL *s); +__owur SSL_verify_cb SSL_get_verify_callback(const SSL *s); +void SSL_set_verify(SSL *s, int mode, SSL_verify_cb callback); +void SSL_set_verify_depth(SSL *s, int depth); +void SSL_set_cert_cb(SSL *s, int (*cb) (SSL *ssl, void *arg), void *arg); +# ifndef OPENSSL_NO_RSA +__owur int SSL_use_RSAPrivateKey(SSL *ssl, RSA *rsa); +__owur int SSL_use_RSAPrivateKey_ASN1(SSL *ssl, const unsigned char *d, + long len); +# endif +__owur int SSL_use_PrivateKey(SSL *ssl, EVP_PKEY *pkey); +__owur int SSL_use_PrivateKey_ASN1(int pk, SSL *ssl, const unsigned char *d, + long len); +__owur int SSL_use_certificate(SSL *ssl, X509 *x); +__owur int SSL_use_certificate_ASN1(SSL *ssl, const unsigned char *d, int len); +__owur int SSL_use_cert_and_key(SSL *ssl, X509 *x509, EVP_PKEY *privatekey, + STACK_OF(X509) *chain, int override); + + +/* serverinfo file format versions */ +# define SSL_SERVERINFOV1 1 +# define SSL_SERVERINFOV2 2 + +/* Set serverinfo data for the current active cert. */ +__owur int SSL_CTX_use_serverinfo(SSL_CTX *ctx, const unsigned char *serverinfo, + size_t serverinfo_length); +__owur int SSL_CTX_use_serverinfo_ex(SSL_CTX *ctx, unsigned int version, + const unsigned char *serverinfo, + size_t serverinfo_length); +__owur int SSL_CTX_use_serverinfo_file(SSL_CTX *ctx, const char *file); + +#ifndef OPENSSL_NO_RSA +__owur int SSL_use_RSAPrivateKey_file(SSL *ssl, const char *file, int type); +#endif + +__owur int SSL_use_PrivateKey_file(SSL *ssl, const char *file, int type); +__owur int SSL_use_certificate_file(SSL *ssl, const char *file, int type); + +#ifndef OPENSSL_NO_RSA +__owur int SSL_CTX_use_RSAPrivateKey_file(SSL_CTX *ctx, const char *file, + int type); +#endif +__owur int SSL_CTX_use_PrivateKey_file(SSL_CTX *ctx, const char *file, + int type); +__owur int SSL_CTX_use_certificate_file(SSL_CTX *ctx, const char *file, + int type); +/* PEM type */ +__owur int SSL_CTX_use_certificate_chain_file(SSL_CTX *ctx, const char *file); +__owur int SSL_use_certificate_chain_file(SSL *ssl, const char *file); +__owur STACK_OF(X509_NAME) *SSL_load_client_CA_file(const char *file); +__owur int SSL_add_file_cert_subjects_to_stack(STACK_OF(X509_NAME) *stackCAs, + const char *file); +int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stackCAs, + const char *dir); + +# if OPENSSL_API_COMPAT < 0x10100000L +# define SSL_load_error_strings() \ + OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS \ + | OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL) +# endif + +__owur const char *SSL_state_string(const SSL *s); +__owur const char *SSL_rstate_string(const SSL *s); +__owur const char *SSL_state_string_long(const SSL *s); +__owur const char *SSL_rstate_string_long(const SSL *s); +__owur long SSL_SESSION_get_time(const SSL_SESSION *s); +__owur long SSL_SESSION_set_time(SSL_SESSION *s, long t); +__owur long SSL_SESSION_get_timeout(const SSL_SESSION *s); +__owur long SSL_SESSION_set_timeout(SSL_SESSION *s, long t); +__owur int SSL_SESSION_get_protocol_version(const SSL_SESSION *s); +__owur int SSL_SESSION_set_protocol_version(SSL_SESSION *s, int version); + +__owur const char *SSL_SESSION_get0_hostname(const SSL_SESSION *s); +__owur int SSL_SESSION_set1_hostname(SSL_SESSION *s, const char *hostname); +void SSL_SESSION_get0_alpn_selected(const SSL_SESSION *s, + const unsigned char **alpn, + size_t *len); +__owur int SSL_SESSION_set1_alpn_selected(SSL_SESSION *s, + const unsigned char *alpn, + size_t len); +__owur const SSL_CIPHER *SSL_SESSION_get0_cipher(const SSL_SESSION *s); +__owur int SSL_SESSION_set_cipher(SSL_SESSION *s, const SSL_CIPHER *cipher); +__owur int SSL_SESSION_has_ticket(const SSL_SESSION *s); +__owur unsigned long SSL_SESSION_get_ticket_lifetime_hint(const SSL_SESSION *s); +void SSL_SESSION_get0_ticket(const SSL_SESSION *s, const unsigned char **tick, + size_t *len); +__owur uint32_t SSL_SESSION_get_max_early_data(const SSL_SESSION *s); +__owur int SSL_SESSION_set_max_early_data(SSL_SESSION *s, + uint32_t max_early_data); +__owur int SSL_copy_session_id(SSL *to, const SSL *from); +__owur X509 *SSL_SESSION_get0_peer(SSL_SESSION *s); +__owur int SSL_SESSION_set1_id_context(SSL_SESSION *s, + const unsigned char *sid_ctx, + unsigned int sid_ctx_len); +__owur int SSL_SESSION_set1_id(SSL_SESSION *s, const unsigned char *sid, + unsigned int sid_len); +__owur int SSL_SESSION_is_resumable(const SSL_SESSION *s); + +__owur SSL_SESSION *SSL_SESSION_new(void); +__owur SSL_SESSION *SSL_SESSION_dup(SSL_SESSION *src); +const unsigned char *SSL_SESSION_get_id(const SSL_SESSION *s, + unsigned int *len); +const unsigned char *SSL_SESSION_get0_id_context(const SSL_SESSION *s, + unsigned int *len); +__owur unsigned int SSL_SESSION_get_compress_id(const SSL_SESSION *s); +# ifndef OPENSSL_NO_STDIO +int SSL_SESSION_print_fp(FILE *fp, const SSL_SESSION *ses); +# endif +int SSL_SESSION_print(BIO *fp, const SSL_SESSION *ses); +int SSL_SESSION_print_keylog(BIO *bp, const SSL_SESSION *x); +int SSL_SESSION_up_ref(SSL_SESSION *ses); +void SSL_SESSION_free(SSL_SESSION *ses); +__owur int i2d_SSL_SESSION(SSL_SESSION *in, unsigned char **pp); +__owur int SSL_set_session(SSL *to, SSL_SESSION *session); +int SSL_CTX_add_session(SSL_CTX *ctx, SSL_SESSION *session); +int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *session); +__owur int SSL_CTX_set_generate_session_id(SSL_CTX *ctx, GEN_SESSION_CB cb); +__owur int SSL_set_generate_session_id(SSL *s, GEN_SESSION_CB cb); +__owur int SSL_has_matching_session_id(const SSL *s, + const unsigned char *id, + unsigned int id_len); +SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp, + long length); + +# ifdef HEADER_X509_H +__owur X509 *SSL_get_peer_certificate(const SSL *s); +# endif + +__owur STACK_OF(X509) *SSL_get_peer_cert_chain(const SSL *s); + +__owur int SSL_CTX_get_verify_mode(const SSL_CTX *ctx); +__owur int SSL_CTX_get_verify_depth(const SSL_CTX *ctx); +__owur SSL_verify_cb SSL_CTX_get_verify_callback(const SSL_CTX *ctx); +void SSL_CTX_set_verify(SSL_CTX *ctx, int mode, SSL_verify_cb callback); +void SSL_CTX_set_verify_depth(SSL_CTX *ctx, int depth); +void SSL_CTX_set_cert_verify_callback(SSL_CTX *ctx, + int (*cb) (X509_STORE_CTX *, void *), + void *arg); +void SSL_CTX_set_cert_cb(SSL_CTX *c, int (*cb) (SSL *ssl, void *arg), + void *arg); +# ifndef OPENSSL_NO_RSA +__owur int SSL_CTX_use_RSAPrivateKey(SSL_CTX *ctx, RSA *rsa); +__owur int SSL_CTX_use_RSAPrivateKey_ASN1(SSL_CTX *ctx, const unsigned char *d, + long len); +# endif +__owur int SSL_CTX_use_PrivateKey(SSL_CTX *ctx, EVP_PKEY *pkey); +__owur int SSL_CTX_use_PrivateKey_ASN1(int pk, SSL_CTX *ctx, + const unsigned char *d, long len); +__owur int SSL_CTX_use_certificate(SSL_CTX *ctx, X509 *x); +__owur int SSL_CTX_use_certificate_ASN1(SSL_CTX *ctx, int len, + const unsigned char *d); +__owur int SSL_CTX_use_cert_and_key(SSL_CTX *ctx, X509 *x509, EVP_PKEY *privatekey, + STACK_OF(X509) *chain, int override); + +void SSL_CTX_set_default_passwd_cb(SSL_CTX *ctx, pem_password_cb *cb); +void SSL_CTX_set_default_passwd_cb_userdata(SSL_CTX *ctx, void *u); +pem_password_cb *SSL_CTX_get_default_passwd_cb(SSL_CTX *ctx); +void *SSL_CTX_get_default_passwd_cb_userdata(SSL_CTX *ctx); +void SSL_set_default_passwd_cb(SSL *s, pem_password_cb *cb); +void SSL_set_default_passwd_cb_userdata(SSL *s, void *u); +pem_password_cb *SSL_get_default_passwd_cb(SSL *s); +void *SSL_get_default_passwd_cb_userdata(SSL *s); + +__owur int SSL_CTX_check_private_key(const SSL_CTX *ctx); +__owur int SSL_check_private_key(const SSL *ctx); + +__owur int SSL_CTX_set_session_id_context(SSL_CTX *ctx, + const unsigned char *sid_ctx, + unsigned int sid_ctx_len); + +SSL *SSL_new(SSL_CTX *ctx); +int SSL_up_ref(SSL *s); +int SSL_is_dtls(const SSL *s); +__owur int SSL_set_session_id_context(SSL *ssl, const unsigned char *sid_ctx, + unsigned int sid_ctx_len); + +__owur int SSL_CTX_set_purpose(SSL_CTX *ctx, int purpose); +__owur int SSL_set_purpose(SSL *ssl, int purpose); +__owur int SSL_CTX_set_trust(SSL_CTX *ctx, int trust); +__owur int SSL_set_trust(SSL *ssl, int trust); + +__owur int SSL_set1_host(SSL *s, const char *hostname); +__owur int SSL_add1_host(SSL *s, const char *hostname); +__owur const char *SSL_get0_peername(SSL *s); +void SSL_set_hostflags(SSL *s, unsigned int flags); + +__owur int SSL_CTX_dane_enable(SSL_CTX *ctx); +__owur int SSL_CTX_dane_mtype_set(SSL_CTX *ctx, const EVP_MD *md, + uint8_t mtype, uint8_t ord); +__owur int SSL_dane_enable(SSL *s, const char *basedomain); +__owur int SSL_dane_tlsa_add(SSL *s, uint8_t usage, uint8_t selector, + uint8_t mtype, unsigned const char *data, size_t dlen); +__owur int SSL_get0_dane_authority(SSL *s, X509 **mcert, EVP_PKEY **mspki); +__owur int SSL_get0_dane_tlsa(SSL *s, uint8_t *usage, uint8_t *selector, + uint8_t *mtype, unsigned const char **data, + size_t *dlen); +/* + * Bridge opacity barrier between libcrypt and libssl, also needed to support + * offline testing in test/danetest.c + */ +SSL_DANE *SSL_get0_dane(SSL *ssl); +/* + * DANE flags + */ +unsigned long SSL_CTX_dane_set_flags(SSL_CTX *ctx, unsigned long flags); +unsigned long SSL_CTX_dane_clear_flags(SSL_CTX *ctx, unsigned long flags); +unsigned long SSL_dane_set_flags(SSL *ssl, unsigned long flags); +unsigned long SSL_dane_clear_flags(SSL *ssl, unsigned long flags); + +__owur int SSL_CTX_set1_param(SSL_CTX *ctx, X509_VERIFY_PARAM *vpm); +__owur int SSL_set1_param(SSL *ssl, X509_VERIFY_PARAM *vpm); + +__owur X509_VERIFY_PARAM *SSL_CTX_get0_param(SSL_CTX *ctx); +__owur X509_VERIFY_PARAM *SSL_get0_param(SSL *ssl); + +# ifndef OPENSSL_NO_SRP +int SSL_CTX_set_srp_username(SSL_CTX *ctx, char *name); +int SSL_CTX_set_srp_password(SSL_CTX *ctx, char *password); +int SSL_CTX_set_srp_strength(SSL_CTX *ctx, int strength); +int SSL_CTX_set_srp_client_pwd_callback(SSL_CTX *ctx, + char *(*cb) (SSL *, void *)); +int SSL_CTX_set_srp_verify_param_callback(SSL_CTX *ctx, + int (*cb) (SSL *, void *)); +int SSL_CTX_set_srp_username_callback(SSL_CTX *ctx, + int (*cb) (SSL *, int *, void *)); +int SSL_CTX_set_srp_cb_arg(SSL_CTX *ctx, void *arg); + +int SSL_set_srp_server_param(SSL *s, const BIGNUM *N, const BIGNUM *g, + BIGNUM *sa, BIGNUM *v, char *info); +int SSL_set_srp_server_param_pw(SSL *s, const char *user, const char *pass, + const char *grp); + +__owur BIGNUM *SSL_get_srp_g(SSL *s); +__owur BIGNUM *SSL_get_srp_N(SSL *s); + +__owur char *SSL_get_srp_username(SSL *s); +__owur char *SSL_get_srp_userinfo(SSL *s); +# endif + +/* + * ClientHello callback and helpers. + */ + +# define SSL_CLIENT_HELLO_SUCCESS 1 +# define SSL_CLIENT_HELLO_ERROR 0 +# define SSL_CLIENT_HELLO_RETRY (-1) + +typedef int (*SSL_client_hello_cb_fn) (SSL *s, int *al, void *arg); +void SSL_CTX_set_client_hello_cb(SSL_CTX *c, SSL_client_hello_cb_fn cb, + void *arg); +int SSL_client_hello_isv2(SSL *s); +unsigned int SSL_client_hello_get0_legacy_version(SSL *s); +size_t SSL_client_hello_get0_random(SSL *s, const unsigned char **out); +size_t SSL_client_hello_get0_session_id(SSL *s, const unsigned char **out); +size_t SSL_client_hello_get0_ciphers(SSL *s, const unsigned char **out); +size_t SSL_client_hello_get0_compression_methods(SSL *s, + const unsigned char **out); +int SSL_client_hello_get1_extensions_present(SSL *s, int **out, size_t *outlen); +int SSL_client_hello_get0_ext(SSL *s, unsigned int type, + const unsigned char **out, size_t *outlen); + +void SSL_certs_clear(SSL *s); +void SSL_free(SSL *ssl); +# ifdef OSSL_ASYNC_FD +/* + * Windows application developer has to include windows.h to use these. + */ +__owur int SSL_waiting_for_async(SSL *s); +__owur int SSL_get_all_async_fds(SSL *s, OSSL_ASYNC_FD *fds, size_t *numfds); +__owur int SSL_get_changed_async_fds(SSL *s, OSSL_ASYNC_FD *addfd, + size_t *numaddfds, OSSL_ASYNC_FD *delfd, + size_t *numdelfds); +# endif +__owur int SSL_accept(SSL *ssl); +__owur int SSL_stateless(SSL *s); +__owur int SSL_connect(SSL *ssl); +__owur int SSL_read(SSL *ssl, void *buf, int num); +__owur int SSL_read_ex(SSL *ssl, void *buf, size_t num, size_t *readbytes); + +# define SSL_READ_EARLY_DATA_ERROR 0 +# define SSL_READ_EARLY_DATA_SUCCESS 1 +# define SSL_READ_EARLY_DATA_FINISH 2 + +__owur int SSL_read_early_data(SSL *s, void *buf, size_t num, + size_t *readbytes); +__owur int SSL_peek(SSL *ssl, void *buf, int num); +__owur int SSL_peek_ex(SSL *ssl, void *buf, size_t num, size_t *readbytes); +__owur int SSL_write(SSL *ssl, const void *buf, int num); +__owur int SSL_write_ex(SSL *s, const void *buf, size_t num, size_t *written); +__owur int SSL_write_early_data(SSL *s, const void *buf, size_t num, + size_t *written); +long SSL_ctrl(SSL *ssl, int cmd, long larg, void *parg); +long SSL_callback_ctrl(SSL *, int, void (*)(void)); +long SSL_CTX_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg); +long SSL_CTX_callback_ctrl(SSL_CTX *, int, void (*)(void)); + +# define SSL_EARLY_DATA_NOT_SENT 0 +# define SSL_EARLY_DATA_REJECTED 1 +# define SSL_EARLY_DATA_ACCEPTED 2 + +__owur int SSL_get_early_data_status(const SSL *s); + +__owur int SSL_get_error(const SSL *s, int ret_code); +__owur const char *SSL_get_version(const SSL *s); + +/* This sets the 'default' SSL version that SSL_new() will create */ +__owur int SSL_CTX_set_ssl_version(SSL_CTX *ctx, const SSL_METHOD *meth); + +# ifndef OPENSSL_NO_SSL3_METHOD +DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *SSLv3_method(void)) /* SSLv3 */ +DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *SSLv3_server_method(void)) +DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *SSLv3_client_method(void)) +# endif + +#define SSLv23_method TLS_method +#define SSLv23_server_method TLS_server_method +#define SSLv23_client_method TLS_client_method + +/* Negotiate highest available SSL/TLS version */ +__owur const SSL_METHOD *TLS_method(void); +__owur const SSL_METHOD *TLS_server_method(void); +__owur const SSL_METHOD *TLS_client_method(void); + +# ifndef OPENSSL_NO_TLS1_METHOD +DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_method(void)) /* TLSv1.0 */ +DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_server_method(void)) +DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_client_method(void)) +# endif + +# ifndef OPENSSL_NO_TLS1_1_METHOD +DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_1_method(void)) /* TLSv1.1 */ +DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_1_server_method(void)) +DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_1_client_method(void)) +# endif + +# ifndef OPENSSL_NO_TLS1_2_METHOD +DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_2_method(void)) /* TLSv1.2 */ +DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_2_server_method(void)) +DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_2_client_method(void)) +# endif + +# ifndef OPENSSL_NO_DTLS1_METHOD +DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_method(void)) /* DTLSv1.0 */ +DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_server_method(void)) +DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_client_method(void)) +# endif + +# ifndef OPENSSL_NO_DTLS1_2_METHOD +/* DTLSv1.2 */ +DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_2_method(void)) +DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_2_server_method(void)) +DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_2_client_method(void)) +# endif + +__owur const SSL_METHOD *DTLS_method(void); /* DTLS 1.0 and 1.2 */ +__owur const SSL_METHOD *DTLS_server_method(void); /* DTLS 1.0 and 1.2 */ +__owur const SSL_METHOD *DTLS_client_method(void); /* DTLS 1.0 and 1.2 */ + +__owur size_t DTLS_get_data_mtu(const SSL *s); + +__owur STACK_OF(SSL_CIPHER) *SSL_get_ciphers(const SSL *s); +__owur STACK_OF(SSL_CIPHER) *SSL_CTX_get_ciphers(const SSL_CTX *ctx); +__owur STACK_OF(SSL_CIPHER) *SSL_get_client_ciphers(const SSL *s); +__owur STACK_OF(SSL_CIPHER) *SSL_get1_supported_ciphers(SSL *s); + +__owur int SSL_do_handshake(SSL *s); +int SSL_key_update(SSL *s, int updatetype); +int SSL_get_key_update_type(const SSL *s); +int SSL_renegotiate(SSL *s); +int SSL_renegotiate_abbreviated(SSL *s); +__owur int SSL_renegotiate_pending(const SSL *s); +int SSL_shutdown(SSL *s); +__owur int SSL_verify_client_post_handshake(SSL *s); +void SSL_CTX_set_post_handshake_auth(SSL_CTX *ctx, int val); +void SSL_set_post_handshake_auth(SSL *s, int val); + +__owur const SSL_METHOD *SSL_CTX_get_ssl_method(const SSL_CTX *ctx); +__owur const SSL_METHOD *SSL_get_ssl_method(const SSL *s); +__owur int SSL_set_ssl_method(SSL *s, const SSL_METHOD *method); +__owur const char *SSL_alert_type_string_long(int value); +__owur const char *SSL_alert_type_string(int value); +__owur const char *SSL_alert_desc_string_long(int value); +__owur const char *SSL_alert_desc_string(int value); + +void SSL_set0_CA_list(SSL *s, STACK_OF(X509_NAME) *name_list); +void SSL_CTX_set0_CA_list(SSL_CTX *ctx, STACK_OF(X509_NAME) *name_list); +__owur const STACK_OF(X509_NAME) *SSL_get0_CA_list(const SSL *s); +__owur const STACK_OF(X509_NAME) *SSL_CTX_get0_CA_list(const SSL_CTX *ctx); +__owur int SSL_add1_to_CA_list(SSL *ssl, const X509 *x); +__owur int SSL_CTX_add1_to_CA_list(SSL_CTX *ctx, const X509 *x); +__owur const STACK_OF(X509_NAME) *SSL_get0_peer_CA_list(const SSL *s); + +void SSL_set_client_CA_list(SSL *s, STACK_OF(X509_NAME) *name_list); +void SSL_CTX_set_client_CA_list(SSL_CTX *ctx, STACK_OF(X509_NAME) *name_list); +__owur STACK_OF(X509_NAME) *SSL_get_client_CA_list(const SSL *s); +__owur STACK_OF(X509_NAME) *SSL_CTX_get_client_CA_list(const SSL_CTX *s); +__owur int SSL_add_client_CA(SSL *ssl, X509 *x); +__owur int SSL_CTX_add_client_CA(SSL_CTX *ctx, X509 *x); + +void SSL_set_connect_state(SSL *s); +void SSL_set_accept_state(SSL *s); + +__owur long SSL_get_default_timeout(const SSL *s); + +# if OPENSSL_API_COMPAT < 0x10100000L +# define SSL_library_init() OPENSSL_init_ssl(0, NULL) +# endif + +__owur char *SSL_CIPHER_description(const SSL_CIPHER *, char *buf, int size); +__owur STACK_OF(X509_NAME) *SSL_dup_CA_list(const STACK_OF(X509_NAME) *sk); + +__owur SSL *SSL_dup(SSL *ssl); + +__owur X509 *SSL_get_certificate(const SSL *ssl); +/* + * EVP_PKEY + */ +struct evp_pkey_st *SSL_get_privatekey(const SSL *ssl); + +__owur X509 *SSL_CTX_get0_certificate(const SSL_CTX *ctx); +__owur EVP_PKEY *SSL_CTX_get0_privatekey(const SSL_CTX *ctx); + +void SSL_CTX_set_quiet_shutdown(SSL_CTX *ctx, int mode); +__owur int SSL_CTX_get_quiet_shutdown(const SSL_CTX *ctx); +void SSL_set_quiet_shutdown(SSL *ssl, int mode); +__owur int SSL_get_quiet_shutdown(const SSL *ssl); +void SSL_set_shutdown(SSL *ssl, int mode); +__owur int SSL_get_shutdown(const SSL *ssl); +__owur int SSL_version(const SSL *ssl); +__owur int SSL_client_version(const SSL *s); +__owur int SSL_CTX_set_default_verify_paths(SSL_CTX *ctx); +__owur int SSL_CTX_set_default_verify_dir(SSL_CTX *ctx); +__owur int SSL_CTX_set_default_verify_file(SSL_CTX *ctx); +__owur int SSL_CTX_load_verify_locations(SSL_CTX *ctx, const char *CAfile, + const char *CApath); +# define SSL_get0_session SSL_get_session/* just peek at pointer */ +__owur SSL_SESSION *SSL_get_session(const SSL *ssl); +__owur SSL_SESSION *SSL_get1_session(SSL *ssl); /* obtain a reference count */ +__owur SSL_CTX *SSL_get_SSL_CTX(const SSL *ssl); +SSL_CTX *SSL_set_SSL_CTX(SSL *ssl, SSL_CTX *ctx); +void SSL_set_info_callback(SSL *ssl, + void (*cb) (const SSL *ssl, int type, int val)); +void (*SSL_get_info_callback(const SSL *ssl)) (const SSL *ssl, int type, + int val); +__owur OSSL_HANDSHAKE_STATE SSL_get_state(const SSL *ssl); + +void SSL_set_verify_result(SSL *ssl, long v); +__owur long SSL_get_verify_result(const SSL *ssl); +__owur STACK_OF(X509) *SSL_get0_verified_chain(const SSL *s); + +__owur size_t SSL_get_client_random(const SSL *ssl, unsigned char *out, + size_t outlen); +__owur size_t SSL_get_server_random(const SSL *ssl, unsigned char *out, + size_t outlen); +__owur size_t SSL_SESSION_get_master_key(const SSL_SESSION *sess, + unsigned char *out, size_t outlen); +__owur int SSL_SESSION_set1_master_key(SSL_SESSION *sess, + const unsigned char *in, size_t len); +uint8_t SSL_SESSION_get_max_fragment_length(const SSL_SESSION *sess); + +#define SSL_get_ex_new_index(l, p, newf, dupf, freef) \ + CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_SSL, l, p, newf, dupf, freef) +__owur int SSL_set_ex_data(SSL *ssl, int idx, void *data); +void *SSL_get_ex_data(const SSL *ssl, int idx); +#define SSL_SESSION_get_ex_new_index(l, p, newf, dupf, freef) \ + CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_SSL_SESSION, l, p, newf, dupf, freef) +__owur int SSL_SESSION_set_ex_data(SSL_SESSION *ss, int idx, void *data); +void *SSL_SESSION_get_ex_data(const SSL_SESSION *ss, int idx); +#define SSL_CTX_get_ex_new_index(l, p, newf, dupf, freef) \ + CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_SSL_CTX, l, p, newf, dupf, freef) +__owur int SSL_CTX_set_ex_data(SSL_CTX *ssl, int idx, void *data); +void *SSL_CTX_get_ex_data(const SSL_CTX *ssl, int idx); + +__owur int SSL_get_ex_data_X509_STORE_CTX_idx(void); + +# define SSL_CTX_sess_set_cache_size(ctx,t) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SESS_CACHE_SIZE,t,NULL) +# define SSL_CTX_sess_get_cache_size(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_GET_SESS_CACHE_SIZE,0,NULL) +# define SSL_CTX_set_session_cache_mode(ctx,m) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SESS_CACHE_MODE,m,NULL) +# define SSL_CTX_get_session_cache_mode(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_GET_SESS_CACHE_MODE,0,NULL) + +# define SSL_CTX_get_default_read_ahead(ctx) SSL_CTX_get_read_ahead(ctx) +# define SSL_CTX_set_default_read_ahead(ctx,m) SSL_CTX_set_read_ahead(ctx,m) +# define SSL_CTX_get_read_ahead(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_GET_READ_AHEAD,0,NULL) +# define SSL_CTX_set_read_ahead(ctx,m) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_READ_AHEAD,m,NULL) +# define SSL_CTX_get_max_cert_list(ctx) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_GET_MAX_CERT_LIST,0,NULL) +# define SSL_CTX_set_max_cert_list(ctx,m) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_MAX_CERT_LIST,m,NULL) +# define SSL_get_max_cert_list(ssl) \ + SSL_ctrl(ssl,SSL_CTRL_GET_MAX_CERT_LIST,0,NULL) +# define SSL_set_max_cert_list(ssl,m) \ + SSL_ctrl(ssl,SSL_CTRL_SET_MAX_CERT_LIST,m,NULL) + +# define SSL_CTX_set_max_send_fragment(ctx,m) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_MAX_SEND_FRAGMENT,m,NULL) +# define SSL_set_max_send_fragment(ssl,m) \ + SSL_ctrl(ssl,SSL_CTRL_SET_MAX_SEND_FRAGMENT,m,NULL) +# define SSL_CTX_set_split_send_fragment(ctx,m) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SPLIT_SEND_FRAGMENT,m,NULL) +# define SSL_set_split_send_fragment(ssl,m) \ + SSL_ctrl(ssl,SSL_CTRL_SET_SPLIT_SEND_FRAGMENT,m,NULL) +# define SSL_CTX_set_max_pipelines(ctx,m) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_MAX_PIPELINES,m,NULL) +# define SSL_set_max_pipelines(ssl,m) \ + SSL_ctrl(ssl,SSL_CTRL_SET_MAX_PIPELINES,m,NULL) + +void SSL_CTX_set_default_read_buffer_len(SSL_CTX *ctx, size_t len); +void SSL_set_default_read_buffer_len(SSL *s, size_t len); + +# ifndef OPENSSL_NO_DH +/* NB: the |keylength| is only applicable when is_export is true */ +void SSL_CTX_set_tmp_dh_callback(SSL_CTX *ctx, + DH *(*dh) (SSL *ssl, int is_export, + int keylength)); +void SSL_set_tmp_dh_callback(SSL *ssl, + DH *(*dh) (SSL *ssl, int is_export, + int keylength)); +# endif + +__owur const COMP_METHOD *SSL_get_current_compression(const SSL *s); +__owur const COMP_METHOD *SSL_get_current_expansion(const SSL *s); +__owur const char *SSL_COMP_get_name(const COMP_METHOD *comp); +__owur const char *SSL_COMP_get0_name(const SSL_COMP *comp); +__owur int SSL_COMP_get_id(const SSL_COMP *comp); +STACK_OF(SSL_COMP) *SSL_COMP_get_compression_methods(void); +__owur STACK_OF(SSL_COMP) *SSL_COMP_set0_compression_methods(STACK_OF(SSL_COMP) + *meths); +# if OPENSSL_API_COMPAT < 0x10100000L +# define SSL_COMP_free_compression_methods() while(0) continue +# endif +__owur int SSL_COMP_add_compression_method(int id, COMP_METHOD *cm); + +const SSL_CIPHER *SSL_CIPHER_find(SSL *ssl, const unsigned char *ptr); +int SSL_CIPHER_get_cipher_nid(const SSL_CIPHER *c); +int SSL_CIPHER_get_digest_nid(const SSL_CIPHER *c); +int SSL_bytes_to_cipher_list(SSL *s, const unsigned char *bytes, size_t len, + int isv2format, STACK_OF(SSL_CIPHER) **sk, + STACK_OF(SSL_CIPHER) **scsvs); + +/* TLS extensions functions */ +__owur int SSL_set_session_ticket_ext(SSL *s, void *ext_data, int ext_len); + +__owur int SSL_set_session_ticket_ext_cb(SSL *s, + tls_session_ticket_ext_cb_fn cb, + void *arg); + +/* Pre-shared secret session resumption functions */ +__owur int SSL_set_session_secret_cb(SSL *s, + tls_session_secret_cb_fn session_secret_cb, + void *arg); + +void SSL_CTX_set_not_resumable_session_callback(SSL_CTX *ctx, + int (*cb) (SSL *ssl, + int + is_forward_secure)); + +void SSL_set_not_resumable_session_callback(SSL *ssl, + int (*cb) (SSL *ssl, + int is_forward_secure)); + +void SSL_CTX_set_record_padding_callback(SSL_CTX *ctx, + size_t (*cb) (SSL *ssl, int type, + size_t len, void *arg)); +void SSL_CTX_set_record_padding_callback_arg(SSL_CTX *ctx, void *arg); +void *SSL_CTX_get_record_padding_callback_arg(const SSL_CTX *ctx); +int SSL_CTX_set_block_padding(SSL_CTX *ctx, size_t block_size); + +void SSL_set_record_padding_callback(SSL *ssl, + size_t (*cb) (SSL *ssl, int type, + size_t len, void *arg)); +void SSL_set_record_padding_callback_arg(SSL *ssl, void *arg); +void *SSL_get_record_padding_callback_arg(const SSL *ssl); +int SSL_set_block_padding(SSL *ssl, size_t block_size); + +int SSL_set_num_tickets(SSL *s, size_t num_tickets); +size_t SSL_get_num_tickets(const SSL *s); +int SSL_CTX_set_num_tickets(SSL_CTX *ctx, size_t num_tickets); +size_t SSL_CTX_get_num_tickets(const SSL_CTX *ctx); + +# if OPENSSL_API_COMPAT < 0x10100000L +# define SSL_cache_hit(s) SSL_session_reused(s) +# endif + +__owur int SSL_session_reused(const SSL *s); +__owur int SSL_is_server(const SSL *s); + +__owur __owur SSL_CONF_CTX *SSL_CONF_CTX_new(void); +int SSL_CONF_CTX_finish(SSL_CONF_CTX *cctx); +void SSL_CONF_CTX_free(SSL_CONF_CTX *cctx); +unsigned int SSL_CONF_CTX_set_flags(SSL_CONF_CTX *cctx, unsigned int flags); +__owur unsigned int SSL_CONF_CTX_clear_flags(SSL_CONF_CTX *cctx, + unsigned int flags); +__owur int SSL_CONF_CTX_set1_prefix(SSL_CONF_CTX *cctx, const char *pre); + +void SSL_CONF_CTX_set_ssl(SSL_CONF_CTX *cctx, SSL *ssl); +void SSL_CONF_CTX_set_ssl_ctx(SSL_CONF_CTX *cctx, SSL_CTX *ctx); + +__owur int SSL_CONF_cmd(SSL_CONF_CTX *cctx, const char *cmd, const char *value); +__owur int SSL_CONF_cmd_argv(SSL_CONF_CTX *cctx, int *pargc, char ***pargv); +__owur int SSL_CONF_cmd_value_type(SSL_CONF_CTX *cctx, const char *cmd); + +void SSL_add_ssl_module(void); +int SSL_config(SSL *s, const char *name); +int SSL_CTX_config(SSL_CTX *ctx, const char *name); + +# ifndef OPENSSL_NO_SSL_TRACE +void SSL_trace(int write_p, int version, int content_type, + const void *buf, size_t len, SSL *ssl, void *arg); +# endif + +# ifndef OPENSSL_NO_SOCK +int DTLSv1_listen(SSL *s, BIO_ADDR *client); +# endif + +# ifndef OPENSSL_NO_CT + +/* + * A callback for verifying that the received SCTs are sufficient. + * Expected to return 1 if they are sufficient, otherwise 0. + * May return a negative integer if an error occurs. + * A connection should be aborted if the SCTs are deemed insufficient. + */ +typedef int (*ssl_ct_validation_cb)(const CT_POLICY_EVAL_CTX *ctx, + const STACK_OF(SCT) *scts, void *arg); + +/* + * Sets a |callback| that is invoked upon receipt of ServerHelloDone to validate + * the received SCTs. + * If the callback returns a non-positive result, the connection is terminated. + * Call this function before beginning a handshake. + * If a NULL |callback| is provided, SCT validation is disabled. + * |arg| is arbitrary userdata that will be passed to the callback whenever it + * is invoked. Ownership of |arg| remains with the caller. + * + * NOTE: A side-effect of setting a CT callback is that an OCSP stapled response + * will be requested. + */ +int SSL_set_ct_validation_callback(SSL *s, ssl_ct_validation_cb callback, + void *arg); +int SSL_CTX_set_ct_validation_callback(SSL_CTX *ctx, + ssl_ct_validation_cb callback, + void *arg); +#define SSL_disable_ct(s) \ + ((void) SSL_set_validation_callback((s), NULL, NULL)) +#define SSL_CTX_disable_ct(ctx) \ + ((void) SSL_CTX_set_validation_callback((ctx), NULL, NULL)) + +/* + * The validation type enumerates the available behaviours of the built-in SSL + * CT validation callback selected via SSL_enable_ct() and SSL_CTX_enable_ct(). + * The underlying callback is a static function in libssl. + */ +enum { + SSL_CT_VALIDATION_PERMISSIVE = 0, + SSL_CT_VALIDATION_STRICT +}; + +/* + * Enable CT by setting up a callback that implements one of the built-in + * validation variants. The SSL_CT_VALIDATION_PERMISSIVE variant always + * continues the handshake, the application can make appropriate decisions at + * handshake completion. The SSL_CT_VALIDATION_STRICT variant requires at + * least one valid SCT, or else handshake termination will be requested. The + * handshake may continue anyway if SSL_VERIFY_NONE is in effect. + */ +int SSL_enable_ct(SSL *s, int validation_mode); +int SSL_CTX_enable_ct(SSL_CTX *ctx, int validation_mode); + +/* + * Report whether a non-NULL callback is enabled. + */ +int SSL_ct_is_enabled(const SSL *s); +int SSL_CTX_ct_is_enabled(const SSL_CTX *ctx); + +/* Gets the SCTs received from a connection */ +const STACK_OF(SCT) *SSL_get0_peer_scts(SSL *s); + +/* + * Loads the CT log list from the default location. + * If a CTLOG_STORE has previously been set using SSL_CTX_set_ctlog_store, + * the log information loaded from this file will be appended to the + * CTLOG_STORE. + * Returns 1 on success, 0 otherwise. + */ +int SSL_CTX_set_default_ctlog_list_file(SSL_CTX *ctx); + +/* + * Loads the CT log list from the specified file path. + * If a CTLOG_STORE has previously been set using SSL_CTX_set_ctlog_store, + * the log information loaded from this file will be appended to the + * CTLOG_STORE. + * Returns 1 on success, 0 otherwise. + */ +int SSL_CTX_set_ctlog_list_file(SSL_CTX *ctx, const char *path); + +/* + * Sets the CT log list used by all SSL connections created from this SSL_CTX. + * Ownership of the CTLOG_STORE is transferred to the SSL_CTX. + */ +void SSL_CTX_set0_ctlog_store(SSL_CTX *ctx, CTLOG_STORE *logs); + +/* + * Gets the CT log list used by all SSL connections created from this SSL_CTX. + * This will be NULL unless one of the following functions has been called: + * - SSL_CTX_set_default_ctlog_list_file + * - SSL_CTX_set_ctlog_list_file + * - SSL_CTX_set_ctlog_store + */ +const CTLOG_STORE *SSL_CTX_get0_ctlog_store(const SSL_CTX *ctx); + +# endif /* OPENSSL_NO_CT */ + +/* What the "other" parameter contains in security callback */ +/* Mask for type */ +# define SSL_SECOP_OTHER_TYPE 0xffff0000 +# define SSL_SECOP_OTHER_NONE 0 +# define SSL_SECOP_OTHER_CIPHER (1 << 16) +# define SSL_SECOP_OTHER_CURVE (2 << 16) +# define SSL_SECOP_OTHER_DH (3 << 16) +# define SSL_SECOP_OTHER_PKEY (4 << 16) +# define SSL_SECOP_OTHER_SIGALG (5 << 16) +# define SSL_SECOP_OTHER_CERT (6 << 16) + +/* Indicated operation refers to peer key or certificate */ +# define SSL_SECOP_PEER 0x1000 + +/* Values for "op" parameter in security callback */ + +/* Called to filter ciphers */ +/* Ciphers client supports */ +# define SSL_SECOP_CIPHER_SUPPORTED (1 | SSL_SECOP_OTHER_CIPHER) +/* Cipher shared by client/server */ +# define SSL_SECOP_CIPHER_SHARED (2 | SSL_SECOP_OTHER_CIPHER) +/* Sanity check of cipher server selects */ +# define SSL_SECOP_CIPHER_CHECK (3 | SSL_SECOP_OTHER_CIPHER) +/* Curves supported by client */ +# define SSL_SECOP_CURVE_SUPPORTED (4 | SSL_SECOP_OTHER_CURVE) +/* Curves shared by client/server */ +# define SSL_SECOP_CURVE_SHARED (5 | SSL_SECOP_OTHER_CURVE) +/* Sanity check of curve server selects */ +# define SSL_SECOP_CURVE_CHECK (6 | SSL_SECOP_OTHER_CURVE) +/* Temporary DH key */ +# define SSL_SECOP_TMP_DH (7 | SSL_SECOP_OTHER_PKEY) +/* SSL/TLS version */ +# define SSL_SECOP_VERSION (9 | SSL_SECOP_OTHER_NONE) +/* Session tickets */ +# define SSL_SECOP_TICKET (10 | SSL_SECOP_OTHER_NONE) +/* Supported signature algorithms sent to peer */ +# define SSL_SECOP_SIGALG_SUPPORTED (11 | SSL_SECOP_OTHER_SIGALG) +/* Shared signature algorithm */ +# define SSL_SECOP_SIGALG_SHARED (12 | SSL_SECOP_OTHER_SIGALG) +/* Sanity check signature algorithm allowed */ +# define SSL_SECOP_SIGALG_CHECK (13 | SSL_SECOP_OTHER_SIGALG) +/* Used to get mask of supported public key signature algorithms */ +# define SSL_SECOP_SIGALG_MASK (14 | SSL_SECOP_OTHER_SIGALG) +/* Use to see if compression is allowed */ +# define SSL_SECOP_COMPRESSION (15 | SSL_SECOP_OTHER_NONE) +/* EE key in certificate */ +# define SSL_SECOP_EE_KEY (16 | SSL_SECOP_OTHER_CERT) +/* CA key in certificate */ +# define SSL_SECOP_CA_KEY (17 | SSL_SECOP_OTHER_CERT) +/* CA digest algorithm in certificate */ +# define SSL_SECOP_CA_MD (18 | SSL_SECOP_OTHER_CERT) +/* Peer EE key in certificate */ +# define SSL_SECOP_PEER_EE_KEY (SSL_SECOP_EE_KEY | SSL_SECOP_PEER) +/* Peer CA key in certificate */ +# define SSL_SECOP_PEER_CA_KEY (SSL_SECOP_CA_KEY | SSL_SECOP_PEER) +/* Peer CA digest algorithm in certificate */ +# define SSL_SECOP_PEER_CA_MD (SSL_SECOP_CA_MD | SSL_SECOP_PEER) + +void SSL_set_security_level(SSL *s, int level); +__owur int SSL_get_security_level(const SSL *s); +void SSL_set_security_callback(SSL *s, + int (*cb) (const SSL *s, const SSL_CTX *ctx, + int op, int bits, int nid, + void *other, void *ex)); +int (*SSL_get_security_callback(const SSL *s)) (const SSL *s, + const SSL_CTX *ctx, int op, + int bits, int nid, void *other, + void *ex); +void SSL_set0_security_ex_data(SSL *s, void *ex); +__owur void *SSL_get0_security_ex_data(const SSL *s); + +void SSL_CTX_set_security_level(SSL_CTX *ctx, int level); +__owur int SSL_CTX_get_security_level(const SSL_CTX *ctx); +void SSL_CTX_set_security_callback(SSL_CTX *ctx, + int (*cb) (const SSL *s, const SSL_CTX *ctx, + int op, int bits, int nid, + void *other, void *ex)); +int (*SSL_CTX_get_security_callback(const SSL_CTX *ctx)) (const SSL *s, + const SSL_CTX *ctx, + int op, int bits, + int nid, + void *other, + void *ex); +void SSL_CTX_set0_security_ex_data(SSL_CTX *ctx, void *ex); +__owur void *SSL_CTX_get0_security_ex_data(const SSL_CTX *ctx); + +/* OPENSSL_INIT flag 0x010000 reserved for internal use */ +# define OPENSSL_INIT_NO_LOAD_SSL_STRINGS 0x00100000L +# define OPENSSL_INIT_LOAD_SSL_STRINGS 0x00200000L + +# define OPENSSL_INIT_SSL_DEFAULT \ + (OPENSSL_INIT_LOAD_SSL_STRINGS | OPENSSL_INIT_LOAD_CRYPTO_STRINGS) + +int OPENSSL_init_ssl(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings); + +# ifndef OPENSSL_NO_UNIT_TEST +__owur const struct openssl_ssl_test_functions *SSL_test_functions(void); +# endif + +__owur int SSL_free_buffers(SSL *ssl); +__owur int SSL_alloc_buffers(SSL *ssl); + +/* Status codes passed to the decrypt session ticket callback. Some of these + * are for internal use only and are never passed to the callback. */ +typedef int SSL_TICKET_STATUS; + +/* Support for ticket appdata */ +/* fatal error, malloc failure */ +# define SSL_TICKET_FATAL_ERR_MALLOC 0 +/* fatal error, either from parsing or decrypting the ticket */ +# define SSL_TICKET_FATAL_ERR_OTHER 1 +/* No ticket present */ +# define SSL_TICKET_NONE 2 +/* Empty ticket present */ +# define SSL_TICKET_EMPTY 3 +/* the ticket couldn't be decrypted */ +# define SSL_TICKET_NO_DECRYPT 4 +/* a ticket was successfully decrypted */ +# define SSL_TICKET_SUCCESS 5 +/* same as above but the ticket needs to be renewed */ +# define SSL_TICKET_SUCCESS_RENEW 6 + +/* Return codes for the decrypt session ticket callback */ +typedef int SSL_TICKET_RETURN; + +/* An error occurred */ +#define SSL_TICKET_RETURN_ABORT 0 +/* Do not use the ticket, do not send a renewed ticket to the client */ +#define SSL_TICKET_RETURN_IGNORE 1 +/* Do not use the ticket, send a renewed ticket to the client */ +#define SSL_TICKET_RETURN_IGNORE_RENEW 2 +/* Use the ticket, do not send a renewed ticket to the client */ +#define SSL_TICKET_RETURN_USE 3 +/* Use the ticket, send a renewed ticket to the client */ +#define SSL_TICKET_RETURN_USE_RENEW 4 + +typedef int (*SSL_CTX_generate_session_ticket_fn)(SSL *s, void *arg); +typedef SSL_TICKET_RETURN (*SSL_CTX_decrypt_session_ticket_fn)(SSL *s, SSL_SESSION *ss, + const unsigned char *keyname, + size_t keyname_length, + SSL_TICKET_STATUS status, + void *arg); +int SSL_CTX_set_session_ticket_cb(SSL_CTX *ctx, + SSL_CTX_generate_session_ticket_fn gen_cb, + SSL_CTX_decrypt_session_ticket_fn dec_cb, + void *arg); +int SSL_SESSION_set1_ticket_appdata(SSL_SESSION *ss, const void *data, size_t len); +int SSL_SESSION_get0_ticket_appdata(SSL_SESSION *ss, void **data, size_t *len); + +extern const char SSL_version_str[]; + +typedef unsigned int (*DTLS_timer_cb)(SSL *s, unsigned int timer_us); + +void DTLS_set_timer_cb(SSL *s, DTLS_timer_cb cb); + + +typedef int (*SSL_allow_early_data_cb_fn)(SSL *s, void *arg); +void SSL_CTX_set_allow_early_data_cb(SSL_CTX *ctx, + SSL_allow_early_data_cb_fn cb, + void *arg); +void SSL_set_allow_early_data_cb(SSL *s, + SSL_allow_early_data_cb_fn cb, + void *arg); + +# ifdef __cplusplus +} +# endif +#endif diff --git a/ONVIF/include/openssl/include/openssl/ssl2.h b/ONVIF/include/openssl/include/openssl/ssl2.h new file mode 100644 index 0000000..5321bd2 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/ssl2.h @@ -0,0 +1,24 @@ +/* + * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_SSL2_H +# define HEADER_SSL2_H + +#ifdef __cplusplus +extern "C" { +#endif + +# define SSL2_VERSION 0x0002 + +# define SSL2_MT_CLIENT_HELLO 1 + +#ifdef __cplusplus +} +#endif +#endif diff --git a/ONVIF/include/openssl/include/openssl/ssl3.h b/ONVIF/include/openssl/include/openssl/ssl3.h new file mode 100644 index 0000000..8d01fcc --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/ssl3.h @@ -0,0 +1,339 @@ +/* + * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. + * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_SSL3_H +# define HEADER_SSL3_H + +# include +# include +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Signalling cipher suite value from RFC 5746 + * (TLS_EMPTY_RENEGOTIATION_INFO_SCSV) + */ +# define SSL3_CK_SCSV 0x030000FF + +/* + * Signalling cipher suite value from draft-ietf-tls-downgrade-scsv-00 + * (TLS_FALLBACK_SCSV) + */ +# define SSL3_CK_FALLBACK_SCSV 0x03005600 + +# define SSL3_CK_RSA_NULL_MD5 0x03000001 +# define SSL3_CK_RSA_NULL_SHA 0x03000002 +# define SSL3_CK_RSA_RC4_40_MD5 0x03000003 +# define SSL3_CK_RSA_RC4_128_MD5 0x03000004 +# define SSL3_CK_RSA_RC4_128_SHA 0x03000005 +# define SSL3_CK_RSA_RC2_40_MD5 0x03000006 +# define SSL3_CK_RSA_IDEA_128_SHA 0x03000007 +# define SSL3_CK_RSA_DES_40_CBC_SHA 0x03000008 +# define SSL3_CK_RSA_DES_64_CBC_SHA 0x03000009 +# define SSL3_CK_RSA_DES_192_CBC3_SHA 0x0300000A + +# define SSL3_CK_DH_DSS_DES_40_CBC_SHA 0x0300000B +# define SSL3_CK_DH_DSS_DES_64_CBC_SHA 0x0300000C +# define SSL3_CK_DH_DSS_DES_192_CBC3_SHA 0x0300000D +# define SSL3_CK_DH_RSA_DES_40_CBC_SHA 0x0300000E +# define SSL3_CK_DH_RSA_DES_64_CBC_SHA 0x0300000F +# define SSL3_CK_DH_RSA_DES_192_CBC3_SHA 0x03000010 + +# define SSL3_CK_DHE_DSS_DES_40_CBC_SHA 0x03000011 +# define SSL3_CK_EDH_DSS_DES_40_CBC_SHA SSL3_CK_DHE_DSS_DES_40_CBC_SHA +# define SSL3_CK_DHE_DSS_DES_64_CBC_SHA 0x03000012 +# define SSL3_CK_EDH_DSS_DES_64_CBC_SHA SSL3_CK_DHE_DSS_DES_64_CBC_SHA +# define SSL3_CK_DHE_DSS_DES_192_CBC3_SHA 0x03000013 +# define SSL3_CK_EDH_DSS_DES_192_CBC3_SHA SSL3_CK_DHE_DSS_DES_192_CBC3_SHA +# define SSL3_CK_DHE_RSA_DES_40_CBC_SHA 0x03000014 +# define SSL3_CK_EDH_RSA_DES_40_CBC_SHA SSL3_CK_DHE_RSA_DES_40_CBC_SHA +# define SSL3_CK_DHE_RSA_DES_64_CBC_SHA 0x03000015 +# define SSL3_CK_EDH_RSA_DES_64_CBC_SHA SSL3_CK_DHE_RSA_DES_64_CBC_SHA +# define SSL3_CK_DHE_RSA_DES_192_CBC3_SHA 0x03000016 +# define SSL3_CK_EDH_RSA_DES_192_CBC3_SHA SSL3_CK_DHE_RSA_DES_192_CBC3_SHA + +# define SSL3_CK_ADH_RC4_40_MD5 0x03000017 +# define SSL3_CK_ADH_RC4_128_MD5 0x03000018 +# define SSL3_CK_ADH_DES_40_CBC_SHA 0x03000019 +# define SSL3_CK_ADH_DES_64_CBC_SHA 0x0300001A +# define SSL3_CK_ADH_DES_192_CBC_SHA 0x0300001B + +/* a bundle of RFC standard cipher names, generated from ssl3_ciphers[] */ +# define SSL3_RFC_RSA_NULL_MD5 "TLS_RSA_WITH_NULL_MD5" +# define SSL3_RFC_RSA_NULL_SHA "TLS_RSA_WITH_NULL_SHA" +# define SSL3_RFC_RSA_DES_192_CBC3_SHA "TLS_RSA_WITH_3DES_EDE_CBC_SHA" +# define SSL3_RFC_DHE_DSS_DES_192_CBC3_SHA "TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA" +# define SSL3_RFC_DHE_RSA_DES_192_CBC3_SHA "TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA" +# define SSL3_RFC_ADH_DES_192_CBC_SHA "TLS_DH_anon_WITH_3DES_EDE_CBC_SHA" +# define SSL3_RFC_RSA_IDEA_128_SHA "TLS_RSA_WITH_IDEA_CBC_SHA" +# define SSL3_RFC_RSA_RC4_128_MD5 "TLS_RSA_WITH_RC4_128_MD5" +# define SSL3_RFC_RSA_RC4_128_SHA "TLS_RSA_WITH_RC4_128_SHA" +# define SSL3_RFC_ADH_RC4_128_MD5 "TLS_DH_anon_WITH_RC4_128_MD5" + +# define SSL3_TXT_RSA_NULL_MD5 "NULL-MD5" +# define SSL3_TXT_RSA_NULL_SHA "NULL-SHA" +# define SSL3_TXT_RSA_RC4_40_MD5 "EXP-RC4-MD5" +# define SSL3_TXT_RSA_RC4_128_MD5 "RC4-MD5" +# define SSL3_TXT_RSA_RC4_128_SHA "RC4-SHA" +# define SSL3_TXT_RSA_RC2_40_MD5 "EXP-RC2-CBC-MD5" +# define SSL3_TXT_RSA_IDEA_128_SHA "IDEA-CBC-SHA" +# define SSL3_TXT_RSA_DES_40_CBC_SHA "EXP-DES-CBC-SHA" +# define SSL3_TXT_RSA_DES_64_CBC_SHA "DES-CBC-SHA" +# define SSL3_TXT_RSA_DES_192_CBC3_SHA "DES-CBC3-SHA" + +# define SSL3_TXT_DH_DSS_DES_40_CBC_SHA "EXP-DH-DSS-DES-CBC-SHA" +# define SSL3_TXT_DH_DSS_DES_64_CBC_SHA "DH-DSS-DES-CBC-SHA" +# define SSL3_TXT_DH_DSS_DES_192_CBC3_SHA "DH-DSS-DES-CBC3-SHA" +# define SSL3_TXT_DH_RSA_DES_40_CBC_SHA "EXP-DH-RSA-DES-CBC-SHA" +# define SSL3_TXT_DH_RSA_DES_64_CBC_SHA "DH-RSA-DES-CBC-SHA" +# define SSL3_TXT_DH_RSA_DES_192_CBC3_SHA "DH-RSA-DES-CBC3-SHA" + +# define SSL3_TXT_DHE_DSS_DES_40_CBC_SHA "EXP-DHE-DSS-DES-CBC-SHA" +# define SSL3_TXT_DHE_DSS_DES_64_CBC_SHA "DHE-DSS-DES-CBC-SHA" +# define SSL3_TXT_DHE_DSS_DES_192_CBC3_SHA "DHE-DSS-DES-CBC3-SHA" +# define SSL3_TXT_DHE_RSA_DES_40_CBC_SHA "EXP-DHE-RSA-DES-CBC-SHA" +# define SSL3_TXT_DHE_RSA_DES_64_CBC_SHA "DHE-RSA-DES-CBC-SHA" +# define SSL3_TXT_DHE_RSA_DES_192_CBC3_SHA "DHE-RSA-DES-CBC3-SHA" + +/* + * This next block of six "EDH" labels is for backward compatibility with + * older versions of OpenSSL. New code should use the six "DHE" labels above + * instead: + */ +# define SSL3_TXT_EDH_DSS_DES_40_CBC_SHA "EXP-EDH-DSS-DES-CBC-SHA" +# define SSL3_TXT_EDH_DSS_DES_64_CBC_SHA "EDH-DSS-DES-CBC-SHA" +# define SSL3_TXT_EDH_DSS_DES_192_CBC3_SHA "EDH-DSS-DES-CBC3-SHA" +# define SSL3_TXT_EDH_RSA_DES_40_CBC_SHA "EXP-EDH-RSA-DES-CBC-SHA" +# define SSL3_TXT_EDH_RSA_DES_64_CBC_SHA "EDH-RSA-DES-CBC-SHA" +# define SSL3_TXT_EDH_RSA_DES_192_CBC3_SHA "EDH-RSA-DES-CBC3-SHA" + +# define SSL3_TXT_ADH_RC4_40_MD5 "EXP-ADH-RC4-MD5" +# define SSL3_TXT_ADH_RC4_128_MD5 "ADH-RC4-MD5" +# define SSL3_TXT_ADH_DES_40_CBC_SHA "EXP-ADH-DES-CBC-SHA" +# define SSL3_TXT_ADH_DES_64_CBC_SHA "ADH-DES-CBC-SHA" +# define SSL3_TXT_ADH_DES_192_CBC_SHA "ADH-DES-CBC3-SHA" + +# define SSL3_SSL_SESSION_ID_LENGTH 32 +# define SSL3_MAX_SSL_SESSION_ID_LENGTH 32 + +# define SSL3_MASTER_SECRET_SIZE 48 +# define SSL3_RANDOM_SIZE 32 +# define SSL3_SESSION_ID_SIZE 32 +# define SSL3_RT_HEADER_LENGTH 5 + +# define SSL3_HM_HEADER_LENGTH 4 + +# ifndef SSL3_ALIGN_PAYLOAD + /* + * Some will argue that this increases memory footprint, but it's not + * actually true. Point is that malloc has to return at least 64-bit aligned + * pointers, meaning that allocating 5 bytes wastes 3 bytes in either case. + * Suggested pre-gaping simply moves these wasted bytes from the end of + * allocated region to its front, but makes data payload aligned, which + * improves performance:-) + */ +# define SSL3_ALIGN_PAYLOAD 8 +# else +# if (SSL3_ALIGN_PAYLOAD&(SSL3_ALIGN_PAYLOAD-1))!=0 +# error "insane SSL3_ALIGN_PAYLOAD" +# undef SSL3_ALIGN_PAYLOAD +# endif +# endif + +/* + * This is the maximum MAC (digest) size used by the SSL library. Currently + * maximum of 20 is used by SHA1, but we reserve for future extension for + * 512-bit hashes. + */ + +# define SSL3_RT_MAX_MD_SIZE 64 + +/* + * Maximum block size used in all ciphersuites. Currently 16 for AES. + */ + +# define SSL_RT_MAX_CIPHER_BLOCK_SIZE 16 + +# define SSL3_RT_MAX_EXTRA (16384) + +/* Maximum plaintext length: defined by SSL/TLS standards */ +# define SSL3_RT_MAX_PLAIN_LENGTH 16384 +/* Maximum compression overhead: defined by SSL/TLS standards */ +# define SSL3_RT_MAX_COMPRESSED_OVERHEAD 1024 + +/* + * The standards give a maximum encryption overhead of 1024 bytes. In + * practice the value is lower than this. The overhead is the maximum number + * of padding bytes (256) plus the mac size. + */ +# define SSL3_RT_MAX_ENCRYPTED_OVERHEAD (256 + SSL3_RT_MAX_MD_SIZE) +# define SSL3_RT_MAX_TLS13_ENCRYPTED_OVERHEAD 256 + +/* + * OpenSSL currently only uses a padding length of at most one block so the + * send overhead is smaller. + */ + +# define SSL3_RT_SEND_MAX_ENCRYPTED_OVERHEAD \ + (SSL_RT_MAX_CIPHER_BLOCK_SIZE + SSL3_RT_MAX_MD_SIZE) + +/* If compression isn't used don't include the compression overhead */ + +# ifdef OPENSSL_NO_COMP +# define SSL3_RT_MAX_COMPRESSED_LENGTH SSL3_RT_MAX_PLAIN_LENGTH +# else +# define SSL3_RT_MAX_COMPRESSED_LENGTH \ + (SSL3_RT_MAX_PLAIN_LENGTH+SSL3_RT_MAX_COMPRESSED_OVERHEAD) +# endif +# define SSL3_RT_MAX_ENCRYPTED_LENGTH \ + (SSL3_RT_MAX_ENCRYPTED_OVERHEAD+SSL3_RT_MAX_COMPRESSED_LENGTH) +# define SSL3_RT_MAX_TLS13_ENCRYPTED_LENGTH \ + (SSL3_RT_MAX_PLAIN_LENGTH + SSL3_RT_MAX_TLS13_ENCRYPTED_OVERHEAD) +# define SSL3_RT_MAX_PACKET_SIZE \ + (SSL3_RT_MAX_ENCRYPTED_LENGTH+SSL3_RT_HEADER_LENGTH) + +# define SSL3_MD_CLIENT_FINISHED_CONST "\x43\x4C\x4E\x54" +# define SSL3_MD_SERVER_FINISHED_CONST "\x53\x52\x56\x52" + +# define SSL3_VERSION 0x0300 +# define SSL3_VERSION_MAJOR 0x03 +# define SSL3_VERSION_MINOR 0x00 + +# define SSL3_RT_CHANGE_CIPHER_SPEC 20 +# define SSL3_RT_ALERT 21 +# define SSL3_RT_HANDSHAKE 22 +# define SSL3_RT_APPLICATION_DATA 23 +# define DTLS1_RT_HEARTBEAT 24 + +/* Pseudo content types to indicate additional parameters */ +# define TLS1_RT_CRYPTO 0x1000 +# define TLS1_RT_CRYPTO_PREMASTER (TLS1_RT_CRYPTO | 0x1) +# define TLS1_RT_CRYPTO_CLIENT_RANDOM (TLS1_RT_CRYPTO | 0x2) +# define TLS1_RT_CRYPTO_SERVER_RANDOM (TLS1_RT_CRYPTO | 0x3) +# define TLS1_RT_CRYPTO_MASTER (TLS1_RT_CRYPTO | 0x4) + +# define TLS1_RT_CRYPTO_READ 0x0000 +# define TLS1_RT_CRYPTO_WRITE 0x0100 +# define TLS1_RT_CRYPTO_MAC (TLS1_RT_CRYPTO | 0x5) +# define TLS1_RT_CRYPTO_KEY (TLS1_RT_CRYPTO | 0x6) +# define TLS1_RT_CRYPTO_IV (TLS1_RT_CRYPTO | 0x7) +# define TLS1_RT_CRYPTO_FIXED_IV (TLS1_RT_CRYPTO | 0x8) + +/* Pseudo content types for SSL/TLS header info */ +# define SSL3_RT_HEADER 0x100 +# define SSL3_RT_INNER_CONTENT_TYPE 0x101 + +# define SSL3_AL_WARNING 1 +# define SSL3_AL_FATAL 2 + +# define SSL3_AD_CLOSE_NOTIFY 0 +# define SSL3_AD_UNEXPECTED_MESSAGE 10/* fatal */ +# define SSL3_AD_BAD_RECORD_MAC 20/* fatal */ +# define SSL3_AD_DECOMPRESSION_FAILURE 30/* fatal */ +# define SSL3_AD_HANDSHAKE_FAILURE 40/* fatal */ +# define SSL3_AD_NO_CERTIFICATE 41 +# define SSL3_AD_BAD_CERTIFICATE 42 +# define SSL3_AD_UNSUPPORTED_CERTIFICATE 43 +# define SSL3_AD_CERTIFICATE_REVOKED 44 +# define SSL3_AD_CERTIFICATE_EXPIRED 45 +# define SSL3_AD_CERTIFICATE_UNKNOWN 46 +# define SSL3_AD_ILLEGAL_PARAMETER 47/* fatal */ + +# define TLS1_HB_REQUEST 1 +# define TLS1_HB_RESPONSE 2 + + +# define SSL3_CT_RSA_SIGN 1 +# define SSL3_CT_DSS_SIGN 2 +# define SSL3_CT_RSA_FIXED_DH 3 +# define SSL3_CT_DSS_FIXED_DH 4 +# define SSL3_CT_RSA_EPHEMERAL_DH 5 +# define SSL3_CT_DSS_EPHEMERAL_DH 6 +# define SSL3_CT_FORTEZZA_DMS 20 +/* + * SSL3_CT_NUMBER is used to size arrays and it must be large enough to + * contain all of the cert types defined for *either* SSLv3 and TLSv1. + */ +# define SSL3_CT_NUMBER 10 + +# if defined(TLS_CT_NUMBER) +# if TLS_CT_NUMBER != SSL3_CT_NUMBER +# error "SSL/TLS CT_NUMBER values do not match" +# endif +# endif + +/* No longer used as of OpenSSL 1.1.1 */ +# define SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS 0x0001 + +/* Removed from OpenSSL 1.1.0 */ +# define TLS1_FLAGS_TLS_PADDING_BUG 0x0 + +# define TLS1_FLAGS_SKIP_CERT_VERIFY 0x0010 + +/* Set if we encrypt then mac instead of usual mac then encrypt */ +# define TLS1_FLAGS_ENCRYPT_THEN_MAC_READ 0x0100 +# define TLS1_FLAGS_ENCRYPT_THEN_MAC TLS1_FLAGS_ENCRYPT_THEN_MAC_READ + +/* Set if extended master secret extension received from peer */ +# define TLS1_FLAGS_RECEIVED_EXTMS 0x0200 + +# define TLS1_FLAGS_ENCRYPT_THEN_MAC_WRITE 0x0400 + +# define TLS1_FLAGS_STATELESS 0x0800 + +# define SSL3_MT_HELLO_REQUEST 0 +# define SSL3_MT_CLIENT_HELLO 1 +# define SSL3_MT_SERVER_HELLO 2 +# define SSL3_MT_NEWSESSION_TICKET 4 +# define SSL3_MT_END_OF_EARLY_DATA 5 +# define SSL3_MT_ENCRYPTED_EXTENSIONS 8 +# define SSL3_MT_CERTIFICATE 11 +# define SSL3_MT_SERVER_KEY_EXCHANGE 12 +# define SSL3_MT_CERTIFICATE_REQUEST 13 +# define SSL3_MT_SERVER_DONE 14 +# define SSL3_MT_CERTIFICATE_VERIFY 15 +# define SSL3_MT_CLIENT_KEY_EXCHANGE 16 +# define SSL3_MT_FINISHED 20 +# define SSL3_MT_CERTIFICATE_URL 21 +# define SSL3_MT_CERTIFICATE_STATUS 22 +# define SSL3_MT_SUPPLEMENTAL_DATA 23 +# define SSL3_MT_KEY_UPDATE 24 +# ifndef OPENSSL_NO_NEXTPROTONEG +# define SSL3_MT_NEXT_PROTO 67 +# endif +# define SSL3_MT_MESSAGE_HASH 254 +# define DTLS1_MT_HELLO_VERIFY_REQUEST 3 + +/* Dummy message type for handling CCS like a normal handshake message */ +# define SSL3_MT_CHANGE_CIPHER_SPEC 0x0101 + +# define SSL3_MT_CCS 1 + +/* These are used when changing over to a new cipher */ +# define SSL3_CC_READ 0x001 +# define SSL3_CC_WRITE 0x002 +# define SSL3_CC_CLIENT 0x010 +# define SSL3_CC_SERVER 0x020 +# define SSL3_CC_EARLY 0x040 +# define SSL3_CC_HANDSHAKE 0x080 +# define SSL3_CC_APPLICATION 0x100 +# define SSL3_CHANGE_CIPHER_CLIENT_WRITE (SSL3_CC_CLIENT|SSL3_CC_WRITE) +# define SSL3_CHANGE_CIPHER_SERVER_READ (SSL3_CC_SERVER|SSL3_CC_READ) +# define SSL3_CHANGE_CIPHER_CLIENT_READ (SSL3_CC_CLIENT|SSL3_CC_READ) +# define SSL3_CHANGE_CIPHER_SERVER_WRITE (SSL3_CC_SERVER|SSL3_CC_WRITE) + +#ifdef __cplusplus +} +#endif +#endif diff --git a/ONVIF/include/openssl/include/openssl/sslerr.h b/ONVIF/include/openssl/include/openssl/sslerr.h new file mode 100644 index 0000000..82983d3 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/sslerr.h @@ -0,0 +1,773 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_SSLERR_H +# define HEADER_SSLERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_SSL_strings(void); + +/* + * SSL function codes. + */ +# define SSL_F_ADD_CLIENT_KEY_SHARE_EXT 438 +# define SSL_F_ADD_KEY_SHARE 512 +# define SSL_F_BYTES_TO_CIPHER_LIST 519 +# define SSL_F_CHECK_SUITEB_CIPHER_LIST 331 +# define SSL_F_CIPHERSUITE_CB 622 +# define SSL_F_CONSTRUCT_CA_NAMES 552 +# define SSL_F_CONSTRUCT_KEY_EXCHANGE_TBS 553 +# define SSL_F_CONSTRUCT_STATEFUL_TICKET 636 +# define SSL_F_CONSTRUCT_STATELESS_TICKET 637 +# define SSL_F_CREATE_SYNTHETIC_MESSAGE_HASH 539 +# define SSL_F_CREATE_TICKET_PREQUEL 638 +# define SSL_F_CT_MOVE_SCTS 345 +# define SSL_F_CT_STRICT 349 +# define SSL_F_CUSTOM_EXT_ADD 554 +# define SSL_F_CUSTOM_EXT_PARSE 555 +# define SSL_F_D2I_SSL_SESSION 103 +# define SSL_F_DANE_CTX_ENABLE 347 +# define SSL_F_DANE_MTYPE_SET 393 +# define SSL_F_DANE_TLSA_ADD 394 +# define SSL_F_DERIVE_SECRET_KEY_AND_IV 514 +# define SSL_F_DO_DTLS1_WRITE 245 +# define SSL_F_DO_SSL3_WRITE 104 +# define SSL_F_DTLS1_BUFFER_RECORD 247 +# define SSL_F_DTLS1_CHECK_TIMEOUT_NUM 318 +# define SSL_F_DTLS1_HEARTBEAT 305 +# define SSL_F_DTLS1_HM_FRAGMENT_NEW 623 +# define SSL_F_DTLS1_PREPROCESS_FRAGMENT 288 +# define SSL_F_DTLS1_PROCESS_BUFFERED_RECORDS 424 +# define SSL_F_DTLS1_PROCESS_RECORD 257 +# define SSL_F_DTLS1_READ_BYTES 258 +# define SSL_F_DTLS1_READ_FAILED 339 +# define SSL_F_DTLS1_RETRANSMIT_MESSAGE 390 +# define SSL_F_DTLS1_WRITE_APP_DATA_BYTES 268 +# define SSL_F_DTLS1_WRITE_BYTES 545 +# define SSL_F_DTLSV1_LISTEN 350 +# define SSL_F_DTLS_CONSTRUCT_CHANGE_CIPHER_SPEC 371 +# define SSL_F_DTLS_CONSTRUCT_HELLO_VERIFY_REQUEST 385 +# define SSL_F_DTLS_GET_REASSEMBLED_MESSAGE 370 +# define SSL_F_DTLS_PROCESS_HELLO_VERIFY 386 +# define SSL_F_DTLS_RECORD_LAYER_NEW 635 +# define SSL_F_DTLS_WAIT_FOR_DRY 592 +# define SSL_F_EARLY_DATA_COUNT_OK 532 +# define SSL_F_FINAL_EARLY_DATA 556 +# define SSL_F_FINAL_EC_PT_FORMATS 485 +# define SSL_F_FINAL_EMS 486 +# define SSL_F_FINAL_KEY_SHARE 503 +# define SSL_F_FINAL_MAXFRAGMENTLEN 557 +# define SSL_F_FINAL_RENEGOTIATE 483 +# define SSL_F_FINAL_SERVER_NAME 558 +# define SSL_F_FINAL_SIG_ALGS 497 +# define SSL_F_GET_CERT_VERIFY_TBS_DATA 588 +# define SSL_F_NSS_KEYLOG_INT 500 +# define SSL_F_OPENSSL_INIT_SSL 342 +# define SSL_F_OSSL_STATEM_CLIENT13_READ_TRANSITION 436 +# define SSL_F_OSSL_STATEM_CLIENT13_WRITE_TRANSITION 598 +# define SSL_F_OSSL_STATEM_CLIENT_CONSTRUCT_MESSAGE 430 +# define SSL_F_OSSL_STATEM_CLIENT_POST_PROCESS_MESSAGE 593 +# define SSL_F_OSSL_STATEM_CLIENT_PROCESS_MESSAGE 594 +# define SSL_F_OSSL_STATEM_CLIENT_READ_TRANSITION 417 +# define SSL_F_OSSL_STATEM_CLIENT_WRITE_TRANSITION 599 +# define SSL_F_OSSL_STATEM_SERVER13_READ_TRANSITION 437 +# define SSL_F_OSSL_STATEM_SERVER13_WRITE_TRANSITION 600 +# define SSL_F_OSSL_STATEM_SERVER_CONSTRUCT_MESSAGE 431 +# define SSL_F_OSSL_STATEM_SERVER_POST_PROCESS_MESSAGE 601 +# define SSL_F_OSSL_STATEM_SERVER_POST_WORK 602 +# define SSL_F_OSSL_STATEM_SERVER_PRE_WORK 640 +# define SSL_F_OSSL_STATEM_SERVER_PROCESS_MESSAGE 603 +# define SSL_F_OSSL_STATEM_SERVER_READ_TRANSITION 418 +# define SSL_F_OSSL_STATEM_SERVER_WRITE_TRANSITION 604 +# define SSL_F_PARSE_CA_NAMES 541 +# define SSL_F_PITEM_NEW 624 +# define SSL_F_PQUEUE_NEW 625 +# define SSL_F_PROCESS_KEY_SHARE_EXT 439 +# define SSL_F_READ_STATE_MACHINE 352 +# define SSL_F_SET_CLIENT_CIPHERSUITE 540 +# define SSL_F_SRP_GENERATE_CLIENT_MASTER_SECRET 595 +# define SSL_F_SRP_GENERATE_SERVER_MASTER_SECRET 589 +# define SSL_F_SRP_VERIFY_SERVER_PARAM 596 +# define SSL_F_SSL3_CHANGE_CIPHER_STATE 129 +# define SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM 130 +# define SSL_F_SSL3_CTRL 213 +# define SSL_F_SSL3_CTX_CTRL 133 +# define SSL_F_SSL3_DIGEST_CACHED_RECORDS 293 +# define SSL_F_SSL3_DO_CHANGE_CIPHER_SPEC 292 +# define SSL_F_SSL3_ENC 608 +# define SSL_F_SSL3_FINAL_FINISH_MAC 285 +# define SSL_F_SSL3_FINISH_MAC 587 +# define SSL_F_SSL3_GENERATE_KEY_BLOCK 238 +# define SSL_F_SSL3_GENERATE_MASTER_SECRET 388 +# define SSL_F_SSL3_GET_RECORD 143 +# define SSL_F_SSL3_INIT_FINISHED_MAC 397 +# define SSL_F_SSL3_OUTPUT_CERT_CHAIN 147 +# define SSL_F_SSL3_READ_BYTES 148 +# define SSL_F_SSL3_READ_N 149 +# define SSL_F_SSL3_SETUP_KEY_BLOCK 157 +# define SSL_F_SSL3_SETUP_READ_BUFFER 156 +# define SSL_F_SSL3_SETUP_WRITE_BUFFER 291 +# define SSL_F_SSL3_WRITE_BYTES 158 +# define SSL_F_SSL3_WRITE_PENDING 159 +# define SSL_F_SSL_ADD_CERT_CHAIN 316 +# define SSL_F_SSL_ADD_CERT_TO_BUF 319 +# define SSL_F_SSL_ADD_CERT_TO_WPACKET 493 +# define SSL_F_SSL_ADD_CLIENTHELLO_RENEGOTIATE_EXT 298 +# define SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT 277 +# define SSL_F_SSL_ADD_CLIENTHELLO_USE_SRTP_EXT 307 +# define SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK 215 +# define SSL_F_SSL_ADD_FILE_CERT_SUBJECTS_TO_STACK 216 +# define SSL_F_SSL_ADD_SERVERHELLO_RENEGOTIATE_EXT 299 +# define SSL_F_SSL_ADD_SERVERHELLO_TLSEXT 278 +# define SSL_F_SSL_ADD_SERVERHELLO_USE_SRTP_EXT 308 +# define SSL_F_SSL_BAD_METHOD 160 +# define SSL_F_SSL_BUILD_CERT_CHAIN 332 +# define SSL_F_SSL_BYTES_TO_CIPHER_LIST 161 +# define SSL_F_SSL_CACHE_CIPHERLIST 520 +# define SSL_F_SSL_CERT_ADD0_CHAIN_CERT 346 +# define SSL_F_SSL_CERT_DUP 221 +# define SSL_F_SSL_CERT_NEW 162 +# define SSL_F_SSL_CERT_SET0_CHAIN 340 +# define SSL_F_SSL_CHECK_PRIVATE_KEY 163 +# define SSL_F_SSL_CHECK_SERVERHELLO_TLSEXT 280 +# define SSL_F_SSL_CHECK_SRP_EXT_CLIENTHELLO 606 +# define SSL_F_SSL_CHECK_SRVR_ECC_CERT_AND_ALG 279 +# define SSL_F_SSL_CHOOSE_CLIENT_VERSION 607 +# define SSL_F_SSL_CIPHER_DESCRIPTION 626 +# define SSL_F_SSL_CIPHER_LIST_TO_BYTES 425 +# define SSL_F_SSL_CIPHER_PROCESS_RULESTR 230 +# define SSL_F_SSL_CIPHER_STRENGTH_SORT 231 +# define SSL_F_SSL_CLEAR 164 +# define SSL_F_SSL_CLIENT_HELLO_GET1_EXTENSIONS_PRESENT 627 +# define SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD 165 +# define SSL_F_SSL_CONF_CMD 334 +# define SSL_F_SSL_CREATE_CIPHER_LIST 166 +# define SSL_F_SSL_CTRL 232 +# define SSL_F_SSL_CTX_CHECK_PRIVATE_KEY 168 +# define SSL_F_SSL_CTX_ENABLE_CT 398 +# define SSL_F_SSL_CTX_MAKE_PROFILES 309 +# define SSL_F_SSL_CTX_NEW 169 +# define SSL_F_SSL_CTX_SET_ALPN_PROTOS 343 +# define SSL_F_SSL_CTX_SET_CIPHER_LIST 269 +# define SSL_F_SSL_CTX_SET_CLIENT_CERT_ENGINE 290 +# define SSL_F_SSL_CTX_SET_CT_VALIDATION_CALLBACK 396 +# define SSL_F_SSL_CTX_SET_SESSION_ID_CONTEXT 219 +# define SSL_F_SSL_CTX_SET_SSL_VERSION 170 +# define SSL_F_SSL_CTX_SET_TLSEXT_MAX_FRAGMENT_LENGTH 551 +# define SSL_F_SSL_CTX_USE_CERTIFICATE 171 +# define SSL_F_SSL_CTX_USE_CERTIFICATE_ASN1 172 +# define SSL_F_SSL_CTX_USE_CERTIFICATE_FILE 173 +# define SSL_F_SSL_CTX_USE_PRIVATEKEY 174 +# define SSL_F_SSL_CTX_USE_PRIVATEKEY_ASN1 175 +# define SSL_F_SSL_CTX_USE_PRIVATEKEY_FILE 176 +# define SSL_F_SSL_CTX_USE_PSK_IDENTITY_HINT 272 +# define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY 177 +# define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY_ASN1 178 +# define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY_FILE 179 +# define SSL_F_SSL_CTX_USE_SERVERINFO 336 +# define SSL_F_SSL_CTX_USE_SERVERINFO_EX 543 +# define SSL_F_SSL_CTX_USE_SERVERINFO_FILE 337 +# define SSL_F_SSL_DANE_DUP 403 +# define SSL_F_SSL_DANE_ENABLE 395 +# define SSL_F_SSL_DERIVE 590 +# define SSL_F_SSL_DO_CONFIG 391 +# define SSL_F_SSL_DO_HANDSHAKE 180 +# define SSL_F_SSL_DUP_CA_LIST 408 +# define SSL_F_SSL_ENABLE_CT 402 +# define SSL_F_SSL_GENERATE_PKEY_GROUP 559 +# define SSL_F_SSL_GENERATE_SESSION_ID 547 +# define SSL_F_SSL_GET_NEW_SESSION 181 +# define SSL_F_SSL_GET_PREV_SESSION 217 +# define SSL_F_SSL_GET_SERVER_CERT_INDEX 322 +# define SSL_F_SSL_GET_SIGN_PKEY 183 +# define SSL_F_SSL_HANDSHAKE_HASH 560 +# define SSL_F_SSL_INIT_WBIO_BUFFER 184 +# define SSL_F_SSL_KEY_UPDATE 515 +# define SSL_F_SSL_LOAD_CLIENT_CA_FILE 185 +# define SSL_F_SSL_LOG_MASTER_SECRET 498 +# define SSL_F_SSL_LOG_RSA_CLIENT_KEY_EXCHANGE 499 +# define SSL_F_SSL_MODULE_INIT 392 +# define SSL_F_SSL_NEW 186 +# define SSL_F_SSL_NEXT_PROTO_VALIDATE 565 +# define SSL_F_SSL_PARSE_CLIENTHELLO_RENEGOTIATE_EXT 300 +# define SSL_F_SSL_PARSE_CLIENTHELLO_TLSEXT 302 +# define SSL_F_SSL_PARSE_CLIENTHELLO_USE_SRTP_EXT 310 +# define SSL_F_SSL_PARSE_SERVERHELLO_RENEGOTIATE_EXT 301 +# define SSL_F_SSL_PARSE_SERVERHELLO_TLSEXT 303 +# define SSL_F_SSL_PARSE_SERVERHELLO_USE_SRTP_EXT 311 +# define SSL_F_SSL_PEEK 270 +# define SSL_F_SSL_PEEK_EX 432 +# define SSL_F_SSL_PEEK_INTERNAL 522 +# define SSL_F_SSL_READ 223 +# define SSL_F_SSL_READ_EARLY_DATA 529 +# define SSL_F_SSL_READ_EX 434 +# define SSL_F_SSL_READ_INTERNAL 523 +# define SSL_F_SSL_RENEGOTIATE 516 +# define SSL_F_SSL_RENEGOTIATE_ABBREVIATED 546 +# define SSL_F_SSL_SCAN_CLIENTHELLO_TLSEXT 320 +# define SSL_F_SSL_SCAN_SERVERHELLO_TLSEXT 321 +# define SSL_F_SSL_SESSION_DUP 348 +# define SSL_F_SSL_SESSION_NEW 189 +# define SSL_F_SSL_SESSION_PRINT_FP 190 +# define SSL_F_SSL_SESSION_SET1_ID 423 +# define SSL_F_SSL_SESSION_SET1_ID_CONTEXT 312 +# define SSL_F_SSL_SET_ALPN_PROTOS 344 +# define SSL_F_SSL_SET_CERT 191 +# define SSL_F_SSL_SET_CERT_AND_KEY 621 +# define SSL_F_SSL_SET_CIPHER_LIST 271 +# define SSL_F_SSL_SET_CT_VALIDATION_CALLBACK 399 +# define SSL_F_SSL_SET_FD 192 +# define SSL_F_SSL_SET_PKEY 193 +# define SSL_F_SSL_SET_RFD 194 +# define SSL_F_SSL_SET_SESSION 195 +# define SSL_F_SSL_SET_SESSION_ID_CONTEXT 218 +# define SSL_F_SSL_SET_SESSION_TICKET_EXT 294 +# define SSL_F_SSL_SET_TLSEXT_MAX_FRAGMENT_LENGTH 550 +# define SSL_F_SSL_SET_WFD 196 +# define SSL_F_SSL_SHUTDOWN 224 +# define SSL_F_SSL_SRP_CTX_INIT 313 +# define SSL_F_SSL_START_ASYNC_JOB 389 +# define SSL_F_SSL_UNDEFINED_FUNCTION 197 +# define SSL_F_SSL_UNDEFINED_VOID_FUNCTION 244 +# define SSL_F_SSL_USE_CERTIFICATE 198 +# define SSL_F_SSL_USE_CERTIFICATE_ASN1 199 +# define SSL_F_SSL_USE_CERTIFICATE_FILE 200 +# define SSL_F_SSL_USE_PRIVATEKEY 201 +# define SSL_F_SSL_USE_PRIVATEKEY_ASN1 202 +# define SSL_F_SSL_USE_PRIVATEKEY_FILE 203 +# define SSL_F_SSL_USE_PSK_IDENTITY_HINT 273 +# define SSL_F_SSL_USE_RSAPRIVATEKEY 204 +# define SSL_F_SSL_USE_RSAPRIVATEKEY_ASN1 205 +# define SSL_F_SSL_USE_RSAPRIVATEKEY_FILE 206 +# define SSL_F_SSL_VALIDATE_CT 400 +# define SSL_F_SSL_VERIFY_CERT_CHAIN 207 +# define SSL_F_SSL_VERIFY_CLIENT_POST_HANDSHAKE 616 +# define SSL_F_SSL_WRITE 208 +# define SSL_F_SSL_WRITE_EARLY_DATA 526 +# define SSL_F_SSL_WRITE_EARLY_FINISH 527 +# define SSL_F_SSL_WRITE_EX 433 +# define SSL_F_SSL_WRITE_INTERNAL 524 +# define SSL_F_STATE_MACHINE 353 +# define SSL_F_TLS12_CHECK_PEER_SIGALG 333 +# define SSL_F_TLS12_COPY_SIGALGS 533 +# define SSL_F_TLS13_CHANGE_CIPHER_STATE 440 +# define SSL_F_TLS13_ENC 609 +# define SSL_F_TLS13_FINAL_FINISH_MAC 605 +# define SSL_F_TLS13_GENERATE_SECRET 591 +# define SSL_F_TLS13_HKDF_EXPAND 561 +# define SSL_F_TLS13_RESTORE_HANDSHAKE_DIGEST_FOR_PHA 617 +# define SSL_F_TLS13_SAVE_HANDSHAKE_DIGEST_FOR_PHA 618 +# define SSL_F_TLS13_SETUP_KEY_BLOCK 441 +# define SSL_F_TLS1_CHANGE_CIPHER_STATE 209 +# define SSL_F_TLS1_CHECK_DUPLICATE_EXTENSIONS 341 +# define SSL_F_TLS1_ENC 401 +# define SSL_F_TLS1_EXPORT_KEYING_MATERIAL 314 +# define SSL_F_TLS1_GET_CURVELIST 338 +# define SSL_F_TLS1_PRF 284 +# define SSL_F_TLS1_SAVE_U16 628 +# define SSL_F_TLS1_SETUP_KEY_BLOCK 211 +# define SSL_F_TLS1_SET_GROUPS 629 +# define SSL_F_TLS1_SET_RAW_SIGALGS 630 +# define SSL_F_TLS1_SET_SERVER_SIGALGS 335 +# define SSL_F_TLS1_SET_SHARED_SIGALGS 631 +# define SSL_F_TLS1_SET_SIGALGS 632 +# define SSL_F_TLS_CHOOSE_SIGALG 513 +# define SSL_F_TLS_CLIENT_KEY_EXCHANGE_POST_WORK 354 +# define SSL_F_TLS_COLLECT_EXTENSIONS 435 +# define SSL_F_TLS_CONSTRUCT_CERTIFICATE_AUTHORITIES 542 +# define SSL_F_TLS_CONSTRUCT_CERTIFICATE_REQUEST 372 +# define SSL_F_TLS_CONSTRUCT_CERT_STATUS 429 +# define SSL_F_TLS_CONSTRUCT_CERT_STATUS_BODY 494 +# define SSL_F_TLS_CONSTRUCT_CERT_VERIFY 496 +# define SSL_F_TLS_CONSTRUCT_CHANGE_CIPHER_SPEC 427 +# define SSL_F_TLS_CONSTRUCT_CKE_DHE 404 +# define SSL_F_TLS_CONSTRUCT_CKE_ECDHE 405 +# define SSL_F_TLS_CONSTRUCT_CKE_GOST 406 +# define SSL_F_TLS_CONSTRUCT_CKE_PSK_PREAMBLE 407 +# define SSL_F_TLS_CONSTRUCT_CKE_RSA 409 +# define SSL_F_TLS_CONSTRUCT_CKE_SRP 410 +# define SSL_F_TLS_CONSTRUCT_CLIENT_CERTIFICATE 484 +# define SSL_F_TLS_CONSTRUCT_CLIENT_HELLO 487 +# define SSL_F_TLS_CONSTRUCT_CLIENT_KEY_EXCHANGE 488 +# define SSL_F_TLS_CONSTRUCT_CLIENT_VERIFY 489 +# define SSL_F_TLS_CONSTRUCT_CTOS_ALPN 466 +# define SSL_F_TLS_CONSTRUCT_CTOS_CERTIFICATE 355 +# define SSL_F_TLS_CONSTRUCT_CTOS_COOKIE 535 +# define SSL_F_TLS_CONSTRUCT_CTOS_EARLY_DATA 530 +# define SSL_F_TLS_CONSTRUCT_CTOS_EC_PT_FORMATS 467 +# define SSL_F_TLS_CONSTRUCT_CTOS_EMS 468 +# define SSL_F_TLS_CONSTRUCT_CTOS_ETM 469 +# define SSL_F_TLS_CONSTRUCT_CTOS_HELLO 356 +# define SSL_F_TLS_CONSTRUCT_CTOS_KEY_EXCHANGE 357 +# define SSL_F_TLS_CONSTRUCT_CTOS_KEY_SHARE 470 +# define SSL_F_TLS_CONSTRUCT_CTOS_MAXFRAGMENTLEN 549 +# define SSL_F_TLS_CONSTRUCT_CTOS_NPN 471 +# define SSL_F_TLS_CONSTRUCT_CTOS_PADDING 472 +# define SSL_F_TLS_CONSTRUCT_CTOS_POST_HANDSHAKE_AUTH 619 +# define SSL_F_TLS_CONSTRUCT_CTOS_PSK 501 +# define SSL_F_TLS_CONSTRUCT_CTOS_PSK_KEX_MODES 509 +# define SSL_F_TLS_CONSTRUCT_CTOS_RENEGOTIATE 473 +# define SSL_F_TLS_CONSTRUCT_CTOS_SCT 474 +# define SSL_F_TLS_CONSTRUCT_CTOS_SERVER_NAME 475 +# define SSL_F_TLS_CONSTRUCT_CTOS_SESSION_TICKET 476 +# define SSL_F_TLS_CONSTRUCT_CTOS_SIG_ALGS 477 +# define SSL_F_TLS_CONSTRUCT_CTOS_SRP 478 +# define SSL_F_TLS_CONSTRUCT_CTOS_STATUS_REQUEST 479 +# define SSL_F_TLS_CONSTRUCT_CTOS_SUPPORTED_GROUPS 480 +# define SSL_F_TLS_CONSTRUCT_CTOS_SUPPORTED_VERSIONS 481 +# define SSL_F_TLS_CONSTRUCT_CTOS_USE_SRTP 482 +# define SSL_F_TLS_CONSTRUCT_CTOS_VERIFY 358 +# define SSL_F_TLS_CONSTRUCT_ENCRYPTED_EXTENSIONS 443 +# define SSL_F_TLS_CONSTRUCT_END_OF_EARLY_DATA 536 +# define SSL_F_TLS_CONSTRUCT_EXTENSIONS 447 +# define SSL_F_TLS_CONSTRUCT_FINISHED 359 +# define SSL_F_TLS_CONSTRUCT_HELLO_REQUEST 373 +# define SSL_F_TLS_CONSTRUCT_HELLO_RETRY_REQUEST 510 +# define SSL_F_TLS_CONSTRUCT_KEY_UPDATE 517 +# define SSL_F_TLS_CONSTRUCT_NEW_SESSION_TICKET 428 +# define SSL_F_TLS_CONSTRUCT_NEXT_PROTO 426 +# define SSL_F_TLS_CONSTRUCT_SERVER_CERTIFICATE 490 +# define SSL_F_TLS_CONSTRUCT_SERVER_HELLO 491 +# define SSL_F_TLS_CONSTRUCT_SERVER_KEY_EXCHANGE 492 +# define SSL_F_TLS_CONSTRUCT_STOC_ALPN 451 +# define SSL_F_TLS_CONSTRUCT_STOC_CERTIFICATE 374 +# define SSL_F_TLS_CONSTRUCT_STOC_COOKIE 613 +# define SSL_F_TLS_CONSTRUCT_STOC_CRYPTOPRO_BUG 452 +# define SSL_F_TLS_CONSTRUCT_STOC_DONE 375 +# define SSL_F_TLS_CONSTRUCT_STOC_EARLY_DATA 531 +# define SSL_F_TLS_CONSTRUCT_STOC_EARLY_DATA_INFO 525 +# define SSL_F_TLS_CONSTRUCT_STOC_EC_PT_FORMATS 453 +# define SSL_F_TLS_CONSTRUCT_STOC_EMS 454 +# define SSL_F_TLS_CONSTRUCT_STOC_ETM 455 +# define SSL_F_TLS_CONSTRUCT_STOC_HELLO 376 +# define SSL_F_TLS_CONSTRUCT_STOC_KEY_EXCHANGE 377 +# define SSL_F_TLS_CONSTRUCT_STOC_KEY_SHARE 456 +# define SSL_F_TLS_CONSTRUCT_STOC_MAXFRAGMENTLEN 548 +# define SSL_F_TLS_CONSTRUCT_STOC_NEXT_PROTO_NEG 457 +# define SSL_F_TLS_CONSTRUCT_STOC_PSK 504 +# define SSL_F_TLS_CONSTRUCT_STOC_RENEGOTIATE 458 +# define SSL_F_TLS_CONSTRUCT_STOC_SERVER_NAME 459 +# define SSL_F_TLS_CONSTRUCT_STOC_SESSION_TICKET 460 +# define SSL_F_TLS_CONSTRUCT_STOC_STATUS_REQUEST 461 +# define SSL_F_TLS_CONSTRUCT_STOC_SUPPORTED_GROUPS 544 +# define SSL_F_TLS_CONSTRUCT_STOC_SUPPORTED_VERSIONS 611 +# define SSL_F_TLS_CONSTRUCT_STOC_USE_SRTP 462 +# define SSL_F_TLS_EARLY_POST_PROCESS_CLIENT_HELLO 521 +# define SSL_F_TLS_FINISH_HANDSHAKE 597 +# define SSL_F_TLS_GET_MESSAGE_BODY 351 +# define SSL_F_TLS_GET_MESSAGE_HEADER 387 +# define SSL_F_TLS_HANDLE_ALPN 562 +# define SSL_F_TLS_HANDLE_STATUS_REQUEST 563 +# define SSL_F_TLS_PARSE_CERTIFICATE_AUTHORITIES 566 +# define SSL_F_TLS_PARSE_CLIENTHELLO_TLSEXT 449 +# define SSL_F_TLS_PARSE_CTOS_ALPN 567 +# define SSL_F_TLS_PARSE_CTOS_COOKIE 614 +# define SSL_F_TLS_PARSE_CTOS_EARLY_DATA 568 +# define SSL_F_TLS_PARSE_CTOS_EC_PT_FORMATS 569 +# define SSL_F_TLS_PARSE_CTOS_EMS 570 +# define SSL_F_TLS_PARSE_CTOS_KEY_SHARE 463 +# define SSL_F_TLS_PARSE_CTOS_MAXFRAGMENTLEN 571 +# define SSL_F_TLS_PARSE_CTOS_POST_HANDSHAKE_AUTH 620 +# define SSL_F_TLS_PARSE_CTOS_PSK 505 +# define SSL_F_TLS_PARSE_CTOS_PSK_KEX_MODES 572 +# define SSL_F_TLS_PARSE_CTOS_RENEGOTIATE 464 +# define SSL_F_TLS_PARSE_CTOS_SERVER_NAME 573 +# define SSL_F_TLS_PARSE_CTOS_SESSION_TICKET 574 +# define SSL_F_TLS_PARSE_CTOS_SIG_ALGS 575 +# define SSL_F_TLS_PARSE_CTOS_SIG_ALGS_CERT 615 +# define SSL_F_TLS_PARSE_CTOS_SRP 576 +# define SSL_F_TLS_PARSE_CTOS_STATUS_REQUEST 577 +# define SSL_F_TLS_PARSE_CTOS_SUPPORTED_GROUPS 578 +# define SSL_F_TLS_PARSE_CTOS_USE_SRTP 465 +# define SSL_F_TLS_PARSE_STOC_ALPN 579 +# define SSL_F_TLS_PARSE_STOC_COOKIE 534 +# define SSL_F_TLS_PARSE_STOC_EARLY_DATA 538 +# define SSL_F_TLS_PARSE_STOC_EARLY_DATA_INFO 528 +# define SSL_F_TLS_PARSE_STOC_EC_PT_FORMATS 580 +# define SSL_F_TLS_PARSE_STOC_KEY_SHARE 445 +# define SSL_F_TLS_PARSE_STOC_MAXFRAGMENTLEN 581 +# define SSL_F_TLS_PARSE_STOC_NPN 582 +# define SSL_F_TLS_PARSE_STOC_PSK 502 +# define SSL_F_TLS_PARSE_STOC_RENEGOTIATE 448 +# define SSL_F_TLS_PARSE_STOC_SCT 564 +# define SSL_F_TLS_PARSE_STOC_SERVER_NAME 583 +# define SSL_F_TLS_PARSE_STOC_SESSION_TICKET 584 +# define SSL_F_TLS_PARSE_STOC_STATUS_REQUEST 585 +# define SSL_F_TLS_PARSE_STOC_SUPPORTED_VERSIONS 612 +# define SSL_F_TLS_PARSE_STOC_USE_SRTP 446 +# define SSL_F_TLS_POST_PROCESS_CLIENT_HELLO 378 +# define SSL_F_TLS_POST_PROCESS_CLIENT_KEY_EXCHANGE 384 +# define SSL_F_TLS_PREPARE_CLIENT_CERTIFICATE 360 +# define SSL_F_TLS_PROCESS_AS_HELLO_RETRY_REQUEST 610 +# define SSL_F_TLS_PROCESS_CERTIFICATE_REQUEST 361 +# define SSL_F_TLS_PROCESS_CERT_STATUS 362 +# define SSL_F_TLS_PROCESS_CERT_STATUS_BODY 495 +# define SSL_F_TLS_PROCESS_CERT_VERIFY 379 +# define SSL_F_TLS_PROCESS_CHANGE_CIPHER_SPEC 363 +# define SSL_F_TLS_PROCESS_CKE_DHE 411 +# define SSL_F_TLS_PROCESS_CKE_ECDHE 412 +# define SSL_F_TLS_PROCESS_CKE_GOST 413 +# define SSL_F_TLS_PROCESS_CKE_PSK_PREAMBLE 414 +# define SSL_F_TLS_PROCESS_CKE_RSA 415 +# define SSL_F_TLS_PROCESS_CKE_SRP 416 +# define SSL_F_TLS_PROCESS_CLIENT_CERTIFICATE 380 +# define SSL_F_TLS_PROCESS_CLIENT_HELLO 381 +# define SSL_F_TLS_PROCESS_CLIENT_KEY_EXCHANGE 382 +# define SSL_F_TLS_PROCESS_ENCRYPTED_EXTENSIONS 444 +# define SSL_F_TLS_PROCESS_END_OF_EARLY_DATA 537 +# define SSL_F_TLS_PROCESS_FINISHED 364 +# define SSL_F_TLS_PROCESS_HELLO_REQ 507 +# define SSL_F_TLS_PROCESS_HELLO_RETRY_REQUEST 511 +# define SSL_F_TLS_PROCESS_INITIAL_SERVER_FLIGHT 442 +# define SSL_F_TLS_PROCESS_KEY_EXCHANGE 365 +# define SSL_F_TLS_PROCESS_KEY_UPDATE 518 +# define SSL_F_TLS_PROCESS_NEW_SESSION_TICKET 366 +# define SSL_F_TLS_PROCESS_NEXT_PROTO 383 +# define SSL_F_TLS_PROCESS_SERVER_CERTIFICATE 367 +# define SSL_F_TLS_PROCESS_SERVER_DONE 368 +# define SSL_F_TLS_PROCESS_SERVER_HELLO 369 +# define SSL_F_TLS_PROCESS_SKE_DHE 419 +# define SSL_F_TLS_PROCESS_SKE_ECDHE 420 +# define SSL_F_TLS_PROCESS_SKE_PSK_PREAMBLE 421 +# define SSL_F_TLS_PROCESS_SKE_SRP 422 +# define SSL_F_TLS_PSK_DO_BINDER 506 +# define SSL_F_TLS_SCAN_CLIENTHELLO_TLSEXT 450 +# define SSL_F_TLS_SETUP_HANDSHAKE 508 +# define SSL_F_USE_CERTIFICATE_CHAIN_FILE 220 +# define SSL_F_WPACKET_INTERN_INIT_LEN 633 +# define SSL_F_WPACKET_START_SUB_PACKET_LEN__ 634 +# define SSL_F_WRITE_STATE_MACHINE 586 + +/* + * SSL reason codes. + */ +# define SSL_R_APPLICATION_DATA_AFTER_CLOSE_NOTIFY 291 +# define SSL_R_APP_DATA_IN_HANDSHAKE 100 +# define SSL_R_ATTEMPT_TO_REUSE_SESSION_IN_DIFFERENT_CONTEXT 272 +# define SSL_R_AT_LEAST_TLS_1_0_NEEDED_IN_FIPS_MODE 143 +# define SSL_R_AT_LEAST_TLS_1_2_NEEDED_IN_SUITEB_MODE 158 +# define SSL_R_BAD_CHANGE_CIPHER_SPEC 103 +# define SSL_R_BAD_CIPHER 186 +# define SSL_R_BAD_DATA 390 +# define SSL_R_BAD_DATA_RETURNED_BY_CALLBACK 106 +# define SSL_R_BAD_DECOMPRESSION 107 +# define SSL_R_BAD_DH_VALUE 102 +# define SSL_R_BAD_DIGEST_LENGTH 111 +# define SSL_R_BAD_EARLY_DATA 233 +# define SSL_R_BAD_ECC_CERT 304 +# define SSL_R_BAD_ECPOINT 306 +# define SSL_R_BAD_EXTENSION 110 +# define SSL_R_BAD_HANDSHAKE_LENGTH 332 +# define SSL_R_BAD_HANDSHAKE_STATE 236 +# define SSL_R_BAD_HELLO_REQUEST 105 +# define SSL_R_BAD_HRR_VERSION 263 +# define SSL_R_BAD_KEY_SHARE 108 +# define SSL_R_BAD_KEY_UPDATE 122 +# define SSL_R_BAD_LEGACY_VERSION 292 +# define SSL_R_BAD_LENGTH 271 +# define SSL_R_BAD_PACKET 240 +# define SSL_R_BAD_PACKET_LENGTH 115 +# define SSL_R_BAD_PROTOCOL_VERSION_NUMBER 116 +# define SSL_R_BAD_PSK 219 +# define SSL_R_BAD_PSK_IDENTITY 114 +# define SSL_R_BAD_RECORD_TYPE 443 +# define SSL_R_BAD_RSA_ENCRYPT 119 +# define SSL_R_BAD_SIGNATURE 123 +# define SSL_R_BAD_SRP_A_LENGTH 347 +# define SSL_R_BAD_SRP_PARAMETERS 371 +# define SSL_R_BAD_SRTP_MKI_VALUE 352 +# define SSL_R_BAD_SRTP_PROTECTION_PROFILE_LIST 353 +# define SSL_R_BAD_SSL_FILETYPE 124 +# define SSL_R_BAD_VALUE 384 +# define SSL_R_BAD_WRITE_RETRY 127 +# define SSL_R_BINDER_DOES_NOT_VERIFY 253 +# define SSL_R_BIO_NOT_SET 128 +# define SSL_R_BLOCK_CIPHER_PAD_IS_WRONG 129 +# define SSL_R_BN_LIB 130 +# define SSL_R_CALLBACK_FAILED 234 +# define SSL_R_CANNOT_CHANGE_CIPHER 109 +# define SSL_R_CA_DN_LENGTH_MISMATCH 131 +# define SSL_R_CA_KEY_TOO_SMALL 397 +# define SSL_R_CA_MD_TOO_WEAK 398 +# define SSL_R_CCS_RECEIVED_EARLY 133 +# define SSL_R_CERTIFICATE_VERIFY_FAILED 134 +# define SSL_R_CERT_CB_ERROR 377 +# define SSL_R_CERT_LENGTH_MISMATCH 135 +# define SSL_R_CIPHERSUITE_DIGEST_HAS_CHANGED 218 +# define SSL_R_CIPHER_CODE_WRONG_LENGTH 137 +# define SSL_R_CIPHER_OR_HASH_UNAVAILABLE 138 +# define SSL_R_CLIENTHELLO_TLSEXT 226 +# define SSL_R_COMPRESSED_LENGTH_TOO_LONG 140 +# define SSL_R_COMPRESSION_DISABLED 343 +# define SSL_R_COMPRESSION_FAILURE 141 +# define SSL_R_COMPRESSION_ID_NOT_WITHIN_PRIVATE_RANGE 307 +# define SSL_R_COMPRESSION_LIBRARY_ERROR 142 +# define SSL_R_CONNECTION_TYPE_NOT_SET 144 +# define SSL_R_CONTEXT_NOT_DANE_ENABLED 167 +# define SSL_R_COOKIE_GEN_CALLBACK_FAILURE 400 +# define SSL_R_COOKIE_MISMATCH 308 +# define SSL_R_CUSTOM_EXT_HANDLER_ALREADY_INSTALLED 206 +# define SSL_R_DANE_ALREADY_ENABLED 172 +# define SSL_R_DANE_CANNOT_OVERRIDE_MTYPE_FULL 173 +# define SSL_R_DANE_NOT_ENABLED 175 +# define SSL_R_DANE_TLSA_BAD_CERTIFICATE 180 +# define SSL_R_DANE_TLSA_BAD_CERTIFICATE_USAGE 184 +# define SSL_R_DANE_TLSA_BAD_DATA_LENGTH 189 +# define SSL_R_DANE_TLSA_BAD_DIGEST_LENGTH 192 +# define SSL_R_DANE_TLSA_BAD_MATCHING_TYPE 200 +# define SSL_R_DANE_TLSA_BAD_PUBLIC_KEY 201 +# define SSL_R_DANE_TLSA_BAD_SELECTOR 202 +# define SSL_R_DANE_TLSA_NULL_DATA 203 +# define SSL_R_DATA_BETWEEN_CCS_AND_FINISHED 145 +# define SSL_R_DATA_LENGTH_TOO_LONG 146 +# define SSL_R_DECRYPTION_FAILED 147 +# define SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC 281 +# define SSL_R_DH_KEY_TOO_SMALL 394 +# define SSL_R_DH_PUBLIC_VALUE_LENGTH_IS_WRONG 148 +# define SSL_R_DIGEST_CHECK_FAILED 149 +# define SSL_R_DTLS_MESSAGE_TOO_BIG 334 +# define SSL_R_DUPLICATE_COMPRESSION_ID 309 +# define SSL_R_ECC_CERT_NOT_FOR_SIGNING 318 +# define SSL_R_ECDH_REQUIRED_FOR_SUITEB_MODE 374 +# define SSL_R_EE_KEY_TOO_SMALL 399 +# define SSL_R_EMPTY_SRTP_PROTECTION_PROFILE_LIST 354 +# define SSL_R_ENCRYPTED_LENGTH_TOO_LONG 150 +# define SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST 151 +# define SSL_R_ERROR_SETTING_TLSA_BASE_DOMAIN 204 +# define SSL_R_EXCEEDS_MAX_FRAGMENT_SIZE 194 +# define SSL_R_EXCESSIVE_MESSAGE_SIZE 152 +# define SSL_R_EXTENSION_NOT_RECEIVED 279 +# define SSL_R_EXTRA_DATA_IN_MESSAGE 153 +# define SSL_R_EXT_LENGTH_MISMATCH 163 +# define SSL_R_FAILED_TO_INIT_ASYNC 405 +# define SSL_R_FRAGMENTED_CLIENT_HELLO 401 +# define SSL_R_GOT_A_FIN_BEFORE_A_CCS 154 +# define SSL_R_HTTPS_PROXY_REQUEST 155 +# define SSL_R_HTTP_REQUEST 156 +# define SSL_R_ILLEGAL_POINT_COMPRESSION 162 +# define SSL_R_ILLEGAL_SUITEB_DIGEST 380 +# define SSL_R_INAPPROPRIATE_FALLBACK 373 +# define SSL_R_INCONSISTENT_COMPRESSION 340 +# define SSL_R_INCONSISTENT_EARLY_DATA_ALPN 222 +# define SSL_R_INCONSISTENT_EARLY_DATA_SNI 231 +# define SSL_R_INCONSISTENT_EXTMS 104 +# define SSL_R_INSUFFICIENT_SECURITY 241 +# define SSL_R_INVALID_ALERT 205 +# define SSL_R_INVALID_CCS_MESSAGE 260 +# define SSL_R_INVALID_CERTIFICATE_OR_ALG 238 +# define SSL_R_INVALID_COMMAND 280 +# define SSL_R_INVALID_COMPRESSION_ALGORITHM 341 +# define SSL_R_INVALID_CONFIG 283 +# define SSL_R_INVALID_CONFIGURATION_NAME 113 +# define SSL_R_INVALID_CONTEXT 282 +# define SSL_R_INVALID_CT_VALIDATION_TYPE 212 +# define SSL_R_INVALID_KEY_UPDATE_TYPE 120 +# define SSL_R_INVALID_MAX_EARLY_DATA 174 +# define SSL_R_INVALID_NULL_CMD_NAME 385 +# define SSL_R_INVALID_SEQUENCE_NUMBER 402 +# define SSL_R_INVALID_SERVERINFO_DATA 388 +# define SSL_R_INVALID_SESSION_ID 999 +# define SSL_R_INVALID_SRP_USERNAME 357 +# define SSL_R_INVALID_STATUS_RESPONSE 328 +# define SSL_R_INVALID_TICKET_KEYS_LENGTH 325 +# define SSL_R_LENGTH_MISMATCH 159 +# define SSL_R_LENGTH_TOO_LONG 404 +# define SSL_R_LENGTH_TOO_SHORT 160 +# define SSL_R_LIBRARY_BUG 274 +# define SSL_R_LIBRARY_HAS_NO_CIPHERS 161 +# define SSL_R_MISSING_DSA_SIGNING_CERT 165 +# define SSL_R_MISSING_ECDSA_SIGNING_CERT 381 +# define SSL_R_MISSING_FATAL 256 +# define SSL_R_MISSING_PARAMETERS 290 +# define SSL_R_MISSING_RSA_CERTIFICATE 168 +# define SSL_R_MISSING_RSA_ENCRYPTING_CERT 169 +# define SSL_R_MISSING_RSA_SIGNING_CERT 170 +# define SSL_R_MISSING_SIGALGS_EXTENSION 112 +# define SSL_R_MISSING_SIGNING_CERT 221 +# define SSL_R_MISSING_SRP_PARAM 358 +# define SSL_R_MISSING_SUPPORTED_GROUPS_EXTENSION 209 +# define SSL_R_MISSING_TMP_DH_KEY 171 +# define SSL_R_MISSING_TMP_ECDH_KEY 311 +# define SSL_R_MIXED_HANDSHAKE_AND_NON_HANDSHAKE_DATA 293 +# define SSL_R_NOT_ON_RECORD_BOUNDARY 182 +# define SSL_R_NOT_REPLACING_CERTIFICATE 289 +# define SSL_R_NOT_SERVER 284 +# define SSL_R_NO_APPLICATION_PROTOCOL 235 +# define SSL_R_NO_CERTIFICATES_RETURNED 176 +# define SSL_R_NO_CERTIFICATE_ASSIGNED 177 +# define SSL_R_NO_CERTIFICATE_SET 179 +# define SSL_R_NO_CHANGE_FOLLOWING_HRR 214 +# define SSL_R_NO_CIPHERS_AVAILABLE 181 +# define SSL_R_NO_CIPHERS_SPECIFIED 183 +# define SSL_R_NO_CIPHER_MATCH 185 +# define SSL_R_NO_CLIENT_CERT_METHOD 331 +# define SSL_R_NO_COMPRESSION_SPECIFIED 187 +# define SSL_R_NO_COOKIE_CALLBACK_SET 287 +# define SSL_R_NO_GOST_CERTIFICATE_SENT_BY_PEER 330 +# define SSL_R_NO_METHOD_SPECIFIED 188 +# define SSL_R_NO_PEM_EXTENSIONS 389 +# define SSL_R_NO_PRIVATE_KEY_ASSIGNED 190 +# define SSL_R_NO_PROTOCOLS_AVAILABLE 191 +# define SSL_R_NO_RENEGOTIATION 339 +# define SSL_R_NO_REQUIRED_DIGEST 324 +# define SSL_R_NO_SHARED_CIPHER 193 +# define SSL_R_NO_SHARED_GROUPS 410 +# define SSL_R_NO_SHARED_SIGNATURE_ALGORITHMS 376 +# define SSL_R_NO_SRTP_PROFILES 359 +# define SSL_R_NO_SUITABLE_KEY_SHARE 101 +# define SSL_R_NO_SUITABLE_SIGNATURE_ALGORITHM 118 +# define SSL_R_NO_VALID_SCTS 216 +# define SSL_R_NO_VERIFY_COOKIE_CALLBACK 403 +# define SSL_R_NULL_SSL_CTX 195 +# define SSL_R_NULL_SSL_METHOD_PASSED 196 +# define SSL_R_OLD_SESSION_CIPHER_NOT_RETURNED 197 +# define SSL_R_OLD_SESSION_COMPRESSION_ALGORITHM_NOT_RETURNED 344 +# define SSL_R_OVERFLOW_ERROR 237 +# define SSL_R_PACKET_LENGTH_TOO_LONG 198 +# define SSL_R_PARSE_TLSEXT 227 +# define SSL_R_PATH_TOO_LONG 270 +# define SSL_R_PEER_DID_NOT_RETURN_A_CERTIFICATE 199 +# define SSL_R_PEM_NAME_BAD_PREFIX 391 +# define SSL_R_PEM_NAME_TOO_SHORT 392 +# define SSL_R_PIPELINE_FAILURE 406 +# define SSL_R_POST_HANDSHAKE_AUTH_ENCODING_ERR 278 +# define SSL_R_PRIVATE_KEY_MISMATCH 288 +# define SSL_R_PROTOCOL_IS_SHUTDOWN 207 +# define SSL_R_PSK_IDENTITY_NOT_FOUND 223 +# define SSL_R_PSK_NO_CLIENT_CB 224 +# define SSL_R_PSK_NO_SERVER_CB 225 +# define SSL_R_READ_BIO_NOT_SET 211 +# define SSL_R_READ_TIMEOUT_EXPIRED 312 +# define SSL_R_RECORD_LENGTH_MISMATCH 213 +# define SSL_R_RECORD_TOO_SMALL 298 +# define SSL_R_RENEGOTIATE_EXT_TOO_LONG 335 +# define SSL_R_RENEGOTIATION_ENCODING_ERR 336 +# define SSL_R_RENEGOTIATION_MISMATCH 337 +# define SSL_R_REQUEST_PENDING 285 +# define SSL_R_REQUEST_SENT 286 +# define SSL_R_REQUIRED_CIPHER_MISSING 215 +# define SSL_R_REQUIRED_COMPRESSION_ALGORITHM_MISSING 342 +# define SSL_R_SCSV_RECEIVED_WHEN_RENEGOTIATING 345 +# define SSL_R_SCT_VERIFICATION_FAILED 208 +# define SSL_R_SERVERHELLO_TLSEXT 275 +# define SSL_R_SESSION_ID_CONTEXT_UNINITIALIZED 277 +# define SSL_R_SHUTDOWN_WHILE_IN_INIT 407 +# define SSL_R_SIGNATURE_ALGORITHMS_ERROR 360 +# define SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE 220 +# define SSL_R_SRP_A_CALC 361 +# define SSL_R_SRTP_COULD_NOT_ALLOCATE_PROFILES 362 +# define SSL_R_SRTP_PROTECTION_PROFILE_LIST_TOO_LONG 363 +# define SSL_R_SRTP_UNKNOWN_PROTECTION_PROFILE 364 +# define SSL_R_SSL3_EXT_INVALID_MAX_FRAGMENT_LENGTH 232 +# define SSL_R_SSL3_EXT_INVALID_SERVERNAME 319 +# define SSL_R_SSL3_EXT_INVALID_SERVERNAME_TYPE 320 +# define SSL_R_SSL3_SESSION_ID_TOO_LONG 300 +# define SSL_R_SSLV3_ALERT_BAD_CERTIFICATE 1042 +# define SSL_R_SSLV3_ALERT_BAD_RECORD_MAC 1020 +# define SSL_R_SSLV3_ALERT_CERTIFICATE_EXPIRED 1045 +# define SSL_R_SSLV3_ALERT_CERTIFICATE_REVOKED 1044 +# define SSL_R_SSLV3_ALERT_CERTIFICATE_UNKNOWN 1046 +# define SSL_R_SSLV3_ALERT_DECOMPRESSION_FAILURE 1030 +# define SSL_R_SSLV3_ALERT_HANDSHAKE_FAILURE 1040 +# define SSL_R_SSLV3_ALERT_ILLEGAL_PARAMETER 1047 +# define SSL_R_SSLV3_ALERT_NO_CERTIFICATE 1041 +# define SSL_R_SSLV3_ALERT_UNEXPECTED_MESSAGE 1010 +# define SSL_R_SSLV3_ALERT_UNSUPPORTED_CERTIFICATE 1043 +# define SSL_R_SSL_COMMAND_SECTION_EMPTY 117 +# define SSL_R_SSL_COMMAND_SECTION_NOT_FOUND 125 +# define SSL_R_SSL_CTX_HAS_NO_DEFAULT_SSL_VERSION 228 +# define SSL_R_SSL_HANDSHAKE_FAILURE 229 +# define SSL_R_SSL_LIBRARY_HAS_NO_CIPHERS 230 +# define SSL_R_SSL_NEGATIVE_LENGTH 372 +# define SSL_R_SSL_SECTION_EMPTY 126 +# define SSL_R_SSL_SECTION_NOT_FOUND 136 +# define SSL_R_SSL_SESSION_ID_CALLBACK_FAILED 301 +# define SSL_R_SSL_SESSION_ID_CONFLICT 302 +# define SSL_R_SSL_SESSION_ID_CONTEXT_TOO_LONG 273 +# define SSL_R_SSL_SESSION_ID_HAS_BAD_LENGTH 303 +# define SSL_R_SSL_SESSION_ID_TOO_LONG 408 +# define SSL_R_SSL_SESSION_VERSION_MISMATCH 210 +# define SSL_R_STILL_IN_INIT 121 +# define SSL_R_TLSV13_ALERT_CERTIFICATE_REQUIRED 1116 +# define SSL_R_TLSV13_ALERT_MISSING_EXTENSION 1109 +# define SSL_R_TLSV1_ALERT_ACCESS_DENIED 1049 +# define SSL_R_TLSV1_ALERT_DECODE_ERROR 1050 +# define SSL_R_TLSV1_ALERT_DECRYPTION_FAILED 1021 +# define SSL_R_TLSV1_ALERT_DECRYPT_ERROR 1051 +# define SSL_R_TLSV1_ALERT_EXPORT_RESTRICTION 1060 +# define SSL_R_TLSV1_ALERT_INAPPROPRIATE_FALLBACK 1086 +# define SSL_R_TLSV1_ALERT_INSUFFICIENT_SECURITY 1071 +# define SSL_R_TLSV1_ALERT_INTERNAL_ERROR 1080 +# define SSL_R_TLSV1_ALERT_NO_RENEGOTIATION 1100 +# define SSL_R_TLSV1_ALERT_PROTOCOL_VERSION 1070 +# define SSL_R_TLSV1_ALERT_RECORD_OVERFLOW 1022 +# define SSL_R_TLSV1_ALERT_UNKNOWN_CA 1048 +# define SSL_R_TLSV1_ALERT_USER_CANCELLED 1090 +# define SSL_R_TLSV1_BAD_CERTIFICATE_HASH_VALUE 1114 +# define SSL_R_TLSV1_BAD_CERTIFICATE_STATUS_RESPONSE 1113 +# define SSL_R_TLSV1_CERTIFICATE_UNOBTAINABLE 1111 +# define SSL_R_TLSV1_UNRECOGNIZED_NAME 1112 +# define SSL_R_TLSV1_UNSUPPORTED_EXTENSION 1110 +# define SSL_R_TLS_HEARTBEAT_PEER_DOESNT_ACCEPT 365 +# define SSL_R_TLS_HEARTBEAT_PENDING 366 +# define SSL_R_TLS_ILLEGAL_EXPORTER_LABEL 367 +# define SSL_R_TLS_INVALID_ECPOINTFORMAT_LIST 157 +# define SSL_R_TOO_MANY_KEY_UPDATES 132 +# define SSL_R_TOO_MANY_WARN_ALERTS 409 +# define SSL_R_TOO_MUCH_EARLY_DATA 164 +# define SSL_R_UNABLE_TO_FIND_ECDH_PARAMETERS 314 +# define SSL_R_UNABLE_TO_FIND_PUBLIC_KEY_PARAMETERS 239 +# define SSL_R_UNABLE_TO_LOAD_SSL3_MD5_ROUTINES 242 +# define SSL_R_UNABLE_TO_LOAD_SSL3_SHA1_ROUTINES 243 +# define SSL_R_UNEXPECTED_CCS_MESSAGE 262 +# define SSL_R_UNEXPECTED_END_OF_EARLY_DATA 178 +# define SSL_R_UNEXPECTED_MESSAGE 244 +# define SSL_R_UNEXPECTED_RECORD 245 +# define SSL_R_UNINITIALIZED 276 +# define SSL_R_UNKNOWN_ALERT_TYPE 246 +# define SSL_R_UNKNOWN_CERTIFICATE_TYPE 247 +# define SSL_R_UNKNOWN_CIPHER_RETURNED 248 +# define SSL_R_UNKNOWN_CIPHER_TYPE 249 +# define SSL_R_UNKNOWN_CMD_NAME 386 +# define SSL_R_UNKNOWN_COMMAND 139 +# define SSL_R_UNKNOWN_DIGEST 368 +# define SSL_R_UNKNOWN_KEY_EXCHANGE_TYPE 250 +# define SSL_R_UNKNOWN_PKEY_TYPE 251 +# define SSL_R_UNKNOWN_PROTOCOL 252 +# define SSL_R_UNKNOWN_SSL_VERSION 254 +# define SSL_R_UNKNOWN_STATE 255 +# define SSL_R_UNSAFE_LEGACY_RENEGOTIATION_DISABLED 338 +# define SSL_R_UNSOLICITED_EXTENSION 217 +# define SSL_R_UNSUPPORTED_COMPRESSION_ALGORITHM 257 +# define SSL_R_UNSUPPORTED_ELLIPTIC_CURVE 315 +# define SSL_R_UNSUPPORTED_PROTOCOL 258 +# define SSL_R_UNSUPPORTED_SSL_VERSION 259 +# define SSL_R_UNSUPPORTED_STATUS_TYPE 329 +# define SSL_R_USE_SRTP_NOT_NEGOTIATED 369 +# define SSL_R_VERSION_TOO_HIGH 166 +# define SSL_R_VERSION_TOO_LOW 396 +# define SSL_R_WRONG_CERTIFICATE_TYPE 383 +# define SSL_R_WRONG_CIPHER_RETURNED 261 +# define SSL_R_WRONG_CURVE 378 +# define SSL_R_WRONG_SIGNATURE_LENGTH 264 +# define SSL_R_WRONG_SIGNATURE_SIZE 265 +# define SSL_R_WRONG_SIGNATURE_TYPE 370 +# define SSL_R_WRONG_SSL_VERSION 266 +# define SSL_R_WRONG_VERSION_NUMBER 267 +# define SSL_R_X509_LIB 268 +# define SSL_R_X509_VERIFICATION_SETUP_PROBLEMS 269 + +#endif diff --git a/ONVIF/include/openssl/include/openssl/stack.h b/ONVIF/include/openssl/include/openssl/stack.h new file mode 100644 index 0000000..cfc0750 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/stack.h @@ -0,0 +1,83 @@ +/* + * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_STACK_H +# define HEADER_STACK_H + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct stack_st OPENSSL_STACK; /* Use STACK_OF(...) instead */ + +typedef int (*OPENSSL_sk_compfunc)(const void *, const void *); +typedef void (*OPENSSL_sk_freefunc)(void *); +typedef void *(*OPENSSL_sk_copyfunc)(const void *); + +int OPENSSL_sk_num(const OPENSSL_STACK *); +void *OPENSSL_sk_value(const OPENSSL_STACK *, int); + +void *OPENSSL_sk_set(OPENSSL_STACK *st, int i, const void *data); + +OPENSSL_STACK *OPENSSL_sk_new(OPENSSL_sk_compfunc cmp); +OPENSSL_STACK *OPENSSL_sk_new_null(void); +OPENSSL_STACK *OPENSSL_sk_new_reserve(OPENSSL_sk_compfunc c, int n); +int OPENSSL_sk_reserve(OPENSSL_STACK *st, int n); +void OPENSSL_sk_free(OPENSSL_STACK *); +void OPENSSL_sk_pop_free(OPENSSL_STACK *st, void (*func) (void *)); +OPENSSL_STACK *OPENSSL_sk_deep_copy(const OPENSSL_STACK *, + OPENSSL_sk_copyfunc c, + OPENSSL_sk_freefunc f); +int OPENSSL_sk_insert(OPENSSL_STACK *sk, const void *data, int where); +void *OPENSSL_sk_delete(OPENSSL_STACK *st, int loc); +void *OPENSSL_sk_delete_ptr(OPENSSL_STACK *st, const void *p); +int OPENSSL_sk_find(OPENSSL_STACK *st, const void *data); +int OPENSSL_sk_find_ex(OPENSSL_STACK *st, const void *data); +int OPENSSL_sk_push(OPENSSL_STACK *st, const void *data); +int OPENSSL_sk_unshift(OPENSSL_STACK *st, const void *data); +void *OPENSSL_sk_shift(OPENSSL_STACK *st); +void *OPENSSL_sk_pop(OPENSSL_STACK *st); +void OPENSSL_sk_zero(OPENSSL_STACK *st); +OPENSSL_sk_compfunc OPENSSL_sk_set_cmp_func(OPENSSL_STACK *sk, + OPENSSL_sk_compfunc cmp); +OPENSSL_STACK *OPENSSL_sk_dup(const OPENSSL_STACK *st); +void OPENSSL_sk_sort(OPENSSL_STACK *st); +int OPENSSL_sk_is_sorted(const OPENSSL_STACK *st); + +# if OPENSSL_API_COMPAT < 0x10100000L +# define _STACK OPENSSL_STACK +# define sk_num OPENSSL_sk_num +# define sk_value OPENSSL_sk_value +# define sk_set OPENSSL_sk_set +# define sk_new OPENSSL_sk_new +# define sk_new_null OPENSSL_sk_new_null +# define sk_free OPENSSL_sk_free +# define sk_pop_free OPENSSL_sk_pop_free +# define sk_deep_copy OPENSSL_sk_deep_copy +# define sk_insert OPENSSL_sk_insert +# define sk_delete OPENSSL_sk_delete +# define sk_delete_ptr OPENSSL_sk_delete_ptr +# define sk_find OPENSSL_sk_find +# define sk_find_ex OPENSSL_sk_find_ex +# define sk_push OPENSSL_sk_push +# define sk_unshift OPENSSL_sk_unshift +# define sk_shift OPENSSL_sk_shift +# define sk_pop OPENSSL_sk_pop +# define sk_zero OPENSSL_sk_zero +# define sk_set_cmp_func OPENSSL_sk_set_cmp_func +# define sk_dup OPENSSL_sk_dup +# define sk_sort OPENSSL_sk_sort +# define sk_is_sorted OPENSSL_sk_is_sorted +# endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/ONVIF/include/openssl/include/openssl/store.h b/ONVIF/include/openssl/include/openssl/store.h new file mode 100644 index 0000000..a40a733 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/store.h @@ -0,0 +1,266 @@ +/* + * Copyright 2016-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_OSSL_STORE_H +# define HEADER_OSSL_STORE_H + +# include +# include +# include +# include + +# ifdef __cplusplus +extern "C" { +# endif + +/*- + * The main OSSL_STORE functions. + * ------------------------------ + * + * These allow applications to open a channel to a resource with supported + * data (keys, certs, crls, ...), read the data a piece at a time and decide + * what to do with it, and finally close. + */ + +typedef struct ossl_store_ctx_st OSSL_STORE_CTX; + +/* + * Typedef for the OSSL_STORE_INFO post processing callback. This can be used + * to massage the given OSSL_STORE_INFO, or to drop it entirely (by returning + * NULL). + */ +typedef OSSL_STORE_INFO *(*OSSL_STORE_post_process_info_fn)(OSSL_STORE_INFO *, + void *); + +/* + * Open a channel given a URI. The given UI method will be used any time the + * loader needs extra input, for example when a password or pin is needed, and + * will be passed the same user data every time it's needed in this context. + * + * Returns a context reference which represents the channel to communicate + * through. + */ +OSSL_STORE_CTX *OSSL_STORE_open(const char *uri, const UI_METHOD *ui_method, + void *ui_data, + OSSL_STORE_post_process_info_fn post_process, + void *post_process_data); + +/* + * Control / fine tune the OSSL_STORE channel. |cmd| determines what is to be + * done, and depends on the underlying loader (use OSSL_STORE_get0_scheme to + * determine which loader is used), except for common commands (see below). + * Each command takes different arguments. + */ +int OSSL_STORE_ctrl(OSSL_STORE_CTX *ctx, int cmd, ... /* args */); +int OSSL_STORE_vctrl(OSSL_STORE_CTX *ctx, int cmd, va_list args); + +/* + * Common ctrl commands that different loaders may choose to support. + */ +/* int on = 0 or 1; STORE_ctrl(ctx, STORE_C_USE_SECMEM, &on); */ +# define OSSL_STORE_C_USE_SECMEM 1 +/* Where custom commands start */ +# define OSSL_STORE_C_CUSTOM_START 100 + +/* + * Read one data item (a key, a cert, a CRL) that is supported by the OSSL_STORE + * functionality, given a context. + * Returns a OSSL_STORE_INFO pointer, from which OpenSSL typed data can be + * extracted with OSSL_STORE_INFO_get0_PKEY(), OSSL_STORE_INFO_get0_CERT(), ... + * NULL is returned on error, which may include that the data found at the URI + * can't be figured out for certain or is ambiguous. + */ +OSSL_STORE_INFO *OSSL_STORE_load(OSSL_STORE_CTX *ctx); + +/* + * Check if end of data (end of file) is reached + * Returns 1 on end, 0 otherwise. + */ +int OSSL_STORE_eof(OSSL_STORE_CTX *ctx); + +/* + * Check if an error occurred + * Returns 1 if it did, 0 otherwise. + */ +int OSSL_STORE_error(OSSL_STORE_CTX *ctx); + +/* + * Close the channel + * Returns 1 on success, 0 on error. + */ +int OSSL_STORE_close(OSSL_STORE_CTX *ctx); + + +/*- + * Extracting OpenSSL types from and creating new OSSL_STORE_INFOs + * --------------------------------------------------------------- + */ + +/* + * Types of data that can be ossl_stored in a OSSL_STORE_INFO. + * OSSL_STORE_INFO_NAME is typically found when getting a listing of + * available "files" / "tokens" / what have you. + */ +# define OSSL_STORE_INFO_NAME 1 /* char * */ +# define OSSL_STORE_INFO_PARAMS 2 /* EVP_PKEY * */ +# define OSSL_STORE_INFO_PKEY 3 /* EVP_PKEY * */ +# define OSSL_STORE_INFO_CERT 4 /* X509 * */ +# define OSSL_STORE_INFO_CRL 5 /* X509_CRL * */ + +/* + * Functions to generate OSSL_STORE_INFOs, one function for each type we + * support having in them, as well as a generic constructor. + * + * In all cases, ownership of the object is transferred to the OSSL_STORE_INFO + * and will therefore be freed when the OSSL_STORE_INFO is freed. + */ +OSSL_STORE_INFO *OSSL_STORE_INFO_new_NAME(char *name); +int OSSL_STORE_INFO_set0_NAME_description(OSSL_STORE_INFO *info, char *desc); +OSSL_STORE_INFO *OSSL_STORE_INFO_new_PARAMS(EVP_PKEY *params); +OSSL_STORE_INFO *OSSL_STORE_INFO_new_PKEY(EVP_PKEY *pkey); +OSSL_STORE_INFO *OSSL_STORE_INFO_new_CERT(X509 *x509); +OSSL_STORE_INFO *OSSL_STORE_INFO_new_CRL(X509_CRL *crl); + +/* + * Functions to try to extract data from a OSSL_STORE_INFO. + */ +int OSSL_STORE_INFO_get_type(const OSSL_STORE_INFO *info); +const char *OSSL_STORE_INFO_get0_NAME(const OSSL_STORE_INFO *info); +char *OSSL_STORE_INFO_get1_NAME(const OSSL_STORE_INFO *info); +const char *OSSL_STORE_INFO_get0_NAME_description(const OSSL_STORE_INFO *info); +char *OSSL_STORE_INFO_get1_NAME_description(const OSSL_STORE_INFO *info); +EVP_PKEY *OSSL_STORE_INFO_get0_PARAMS(const OSSL_STORE_INFO *info); +EVP_PKEY *OSSL_STORE_INFO_get1_PARAMS(const OSSL_STORE_INFO *info); +EVP_PKEY *OSSL_STORE_INFO_get0_PKEY(const OSSL_STORE_INFO *info); +EVP_PKEY *OSSL_STORE_INFO_get1_PKEY(const OSSL_STORE_INFO *info); +X509 *OSSL_STORE_INFO_get0_CERT(const OSSL_STORE_INFO *info); +X509 *OSSL_STORE_INFO_get1_CERT(const OSSL_STORE_INFO *info); +X509_CRL *OSSL_STORE_INFO_get0_CRL(const OSSL_STORE_INFO *info); +X509_CRL *OSSL_STORE_INFO_get1_CRL(const OSSL_STORE_INFO *info); + +const char *OSSL_STORE_INFO_type_string(int type); + +/* + * Free the OSSL_STORE_INFO + */ +void OSSL_STORE_INFO_free(OSSL_STORE_INFO *info); + + +/*- + * Functions to construct a search URI from a base URI and search criteria + * ----------------------------------------------------------------------- + */ + +/* OSSL_STORE search types */ +# define OSSL_STORE_SEARCH_BY_NAME 1 /* subject in certs, issuer in CRLs */ +# define OSSL_STORE_SEARCH_BY_ISSUER_SERIAL 2 +# define OSSL_STORE_SEARCH_BY_KEY_FINGERPRINT 3 +# define OSSL_STORE_SEARCH_BY_ALIAS 4 + +/* To check what search types the scheme handler supports */ +int OSSL_STORE_supports_search(OSSL_STORE_CTX *ctx, int search_type); + +/* Search term constructors */ +/* + * The input is considered to be owned by the caller, and must therefore + * remain present throughout the lifetime of the returned OSSL_STORE_SEARCH + */ +OSSL_STORE_SEARCH *OSSL_STORE_SEARCH_by_name(X509_NAME *name); +OSSL_STORE_SEARCH *OSSL_STORE_SEARCH_by_issuer_serial(X509_NAME *name, + const ASN1_INTEGER + *serial); +OSSL_STORE_SEARCH *OSSL_STORE_SEARCH_by_key_fingerprint(const EVP_MD *digest, + const unsigned char + *bytes, size_t len); +OSSL_STORE_SEARCH *OSSL_STORE_SEARCH_by_alias(const char *alias); + +/* Search term destructor */ +void OSSL_STORE_SEARCH_free(OSSL_STORE_SEARCH *search); + +/* Search term accessors */ +int OSSL_STORE_SEARCH_get_type(const OSSL_STORE_SEARCH *criterion); +X509_NAME *OSSL_STORE_SEARCH_get0_name(OSSL_STORE_SEARCH *criterion); +const ASN1_INTEGER *OSSL_STORE_SEARCH_get0_serial(const OSSL_STORE_SEARCH + *criterion); +const unsigned char *OSSL_STORE_SEARCH_get0_bytes(const OSSL_STORE_SEARCH + *criterion, size_t *length); +const char *OSSL_STORE_SEARCH_get0_string(const OSSL_STORE_SEARCH *criterion); +const EVP_MD *OSSL_STORE_SEARCH_get0_digest(const OSSL_STORE_SEARCH *criterion); + +/* + * Add search criterion and expected return type (which can be unspecified) + * to the loading channel. This MUST happen before the first OSSL_STORE_load(). + */ +int OSSL_STORE_expect(OSSL_STORE_CTX *ctx, int expected_type); +int OSSL_STORE_find(OSSL_STORE_CTX *ctx, OSSL_STORE_SEARCH *search); + + +/*- + * Function to register a loader for the given URI scheme. + * ------------------------------------------------------- + * + * The loader receives all the main components of an URI except for the + * scheme. + */ + +typedef struct ossl_store_loader_st OSSL_STORE_LOADER; +OSSL_STORE_LOADER *OSSL_STORE_LOADER_new(ENGINE *e, const char *scheme); +const ENGINE *OSSL_STORE_LOADER_get0_engine(const OSSL_STORE_LOADER *loader); +const char *OSSL_STORE_LOADER_get0_scheme(const OSSL_STORE_LOADER *loader); +/* struct ossl_store_loader_ctx_st is defined differently by each loader */ +typedef struct ossl_store_loader_ctx_st OSSL_STORE_LOADER_CTX; +typedef OSSL_STORE_LOADER_CTX *(*OSSL_STORE_open_fn)(const OSSL_STORE_LOADER + *loader, + const char *uri, + const UI_METHOD *ui_method, + void *ui_data); +int OSSL_STORE_LOADER_set_open(OSSL_STORE_LOADER *loader, + OSSL_STORE_open_fn open_function); +typedef int (*OSSL_STORE_ctrl_fn)(OSSL_STORE_LOADER_CTX *ctx, int cmd, + va_list args); +int OSSL_STORE_LOADER_set_ctrl(OSSL_STORE_LOADER *loader, + OSSL_STORE_ctrl_fn ctrl_function); +typedef int (*OSSL_STORE_expect_fn)(OSSL_STORE_LOADER_CTX *ctx, int expected); +int OSSL_STORE_LOADER_set_expect(OSSL_STORE_LOADER *loader, + OSSL_STORE_expect_fn expect_function); +typedef int (*OSSL_STORE_find_fn)(OSSL_STORE_LOADER_CTX *ctx, + OSSL_STORE_SEARCH *criteria); +int OSSL_STORE_LOADER_set_find(OSSL_STORE_LOADER *loader, + OSSL_STORE_find_fn find_function); +typedef OSSL_STORE_INFO *(*OSSL_STORE_load_fn)(OSSL_STORE_LOADER_CTX *ctx, + const UI_METHOD *ui_method, + void *ui_data); +int OSSL_STORE_LOADER_set_load(OSSL_STORE_LOADER *loader, + OSSL_STORE_load_fn load_function); +typedef int (*OSSL_STORE_eof_fn)(OSSL_STORE_LOADER_CTX *ctx); +int OSSL_STORE_LOADER_set_eof(OSSL_STORE_LOADER *loader, + OSSL_STORE_eof_fn eof_function); +typedef int (*OSSL_STORE_error_fn)(OSSL_STORE_LOADER_CTX *ctx); +int OSSL_STORE_LOADER_set_error(OSSL_STORE_LOADER *loader, + OSSL_STORE_error_fn error_function); +typedef int (*OSSL_STORE_close_fn)(OSSL_STORE_LOADER_CTX *ctx); +int OSSL_STORE_LOADER_set_close(OSSL_STORE_LOADER *loader, + OSSL_STORE_close_fn close_function); +void OSSL_STORE_LOADER_free(OSSL_STORE_LOADER *loader); + +int OSSL_STORE_register_loader(OSSL_STORE_LOADER *loader); +OSSL_STORE_LOADER *OSSL_STORE_unregister_loader(const char *scheme); + +/*- + * Functions to list STORE loaders + * ------------------------------- + */ +int OSSL_STORE_do_all_loaders(void (*do_function) (const OSSL_STORE_LOADER + *loader, void *do_arg), + void *do_arg); + +# ifdef __cplusplus +} +# endif +#endif diff --git a/ONVIF/include/openssl/include/openssl/storeerr.h b/ONVIF/include/openssl/include/openssl/storeerr.h new file mode 100644 index 0000000..190eab0 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/storeerr.h @@ -0,0 +1,91 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_OSSL_STOREERR_H +# define HEADER_OSSL_STOREERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_OSSL_STORE_strings(void); + +/* + * OSSL_STORE function codes. + */ +# define OSSL_STORE_F_FILE_CTRL 129 +# define OSSL_STORE_F_FILE_FIND 138 +# define OSSL_STORE_F_FILE_GET_PASS 118 +# define OSSL_STORE_F_FILE_LOAD 119 +# define OSSL_STORE_F_FILE_LOAD_TRY_DECODE 124 +# define OSSL_STORE_F_FILE_NAME_TO_URI 126 +# define OSSL_STORE_F_FILE_OPEN 120 +# define OSSL_STORE_F_OSSL_STORE_ATTACH_PEM_BIO 127 +# define OSSL_STORE_F_OSSL_STORE_EXPECT 130 +# define OSSL_STORE_F_OSSL_STORE_FILE_ATTACH_PEM_BIO_INT 128 +# define OSSL_STORE_F_OSSL_STORE_FIND 131 +# define OSSL_STORE_F_OSSL_STORE_GET0_LOADER_INT 100 +# define OSSL_STORE_F_OSSL_STORE_INFO_GET1_CERT 101 +# define OSSL_STORE_F_OSSL_STORE_INFO_GET1_CRL 102 +# define OSSL_STORE_F_OSSL_STORE_INFO_GET1_NAME 103 +# define OSSL_STORE_F_OSSL_STORE_INFO_GET1_NAME_DESCRIPTION 135 +# define OSSL_STORE_F_OSSL_STORE_INFO_GET1_PARAMS 104 +# define OSSL_STORE_F_OSSL_STORE_INFO_GET1_PKEY 105 +# define OSSL_STORE_F_OSSL_STORE_INFO_NEW_CERT 106 +# define OSSL_STORE_F_OSSL_STORE_INFO_NEW_CRL 107 +# define OSSL_STORE_F_OSSL_STORE_INFO_NEW_EMBEDDED 123 +# define OSSL_STORE_F_OSSL_STORE_INFO_NEW_NAME 109 +# define OSSL_STORE_F_OSSL_STORE_INFO_NEW_PARAMS 110 +# define OSSL_STORE_F_OSSL_STORE_INFO_NEW_PKEY 111 +# define OSSL_STORE_F_OSSL_STORE_INFO_SET0_NAME_DESCRIPTION 134 +# define OSSL_STORE_F_OSSL_STORE_INIT_ONCE 112 +# define OSSL_STORE_F_OSSL_STORE_LOADER_NEW 113 +# define OSSL_STORE_F_OSSL_STORE_OPEN 114 +# define OSSL_STORE_F_OSSL_STORE_OPEN_INT 115 +# define OSSL_STORE_F_OSSL_STORE_REGISTER_LOADER_INT 117 +# define OSSL_STORE_F_OSSL_STORE_SEARCH_BY_ALIAS 132 +# define OSSL_STORE_F_OSSL_STORE_SEARCH_BY_ISSUER_SERIAL 133 +# define OSSL_STORE_F_OSSL_STORE_SEARCH_BY_KEY_FINGERPRINT 136 +# define OSSL_STORE_F_OSSL_STORE_SEARCH_BY_NAME 137 +# define OSSL_STORE_F_OSSL_STORE_UNREGISTER_LOADER_INT 116 +# define OSSL_STORE_F_TRY_DECODE_PARAMS 121 +# define OSSL_STORE_F_TRY_DECODE_PKCS12 122 +# define OSSL_STORE_F_TRY_DECODE_PKCS8ENCRYPTED 125 + +/* + * OSSL_STORE reason codes. + */ +# define OSSL_STORE_R_AMBIGUOUS_CONTENT_TYPE 107 +# define OSSL_STORE_R_BAD_PASSWORD_READ 115 +# define OSSL_STORE_R_ERROR_VERIFYING_PKCS12_MAC 113 +# define OSSL_STORE_R_FINGERPRINT_SIZE_DOES_NOT_MATCH_DIGEST 121 +# define OSSL_STORE_R_INVALID_SCHEME 106 +# define OSSL_STORE_R_IS_NOT_A 112 +# define OSSL_STORE_R_LOADER_INCOMPLETE 116 +# define OSSL_STORE_R_LOADING_STARTED 117 +# define OSSL_STORE_R_NOT_A_CERTIFICATE 100 +# define OSSL_STORE_R_NOT_A_CRL 101 +# define OSSL_STORE_R_NOT_A_KEY 102 +# define OSSL_STORE_R_NOT_A_NAME 103 +# define OSSL_STORE_R_NOT_PARAMETERS 104 +# define OSSL_STORE_R_PASSPHRASE_CALLBACK_ERROR 114 +# define OSSL_STORE_R_PATH_MUST_BE_ABSOLUTE 108 +# define OSSL_STORE_R_SEARCH_ONLY_SUPPORTED_FOR_DIRECTORIES 119 +# define OSSL_STORE_R_UI_PROCESS_INTERRUPTED_OR_CANCELLED 109 +# define OSSL_STORE_R_UNREGISTERED_SCHEME 105 +# define OSSL_STORE_R_UNSUPPORTED_CONTENT_TYPE 110 +# define OSSL_STORE_R_UNSUPPORTED_OPERATION 118 +# define OSSL_STORE_R_UNSUPPORTED_SEARCH_TYPE 120 +# define OSSL_STORE_R_URI_AUTHORITY_UNSUPPORTED 111 + +#endif diff --git a/ONVIF/include/openssl/include/openssl/symhacks.h b/ONVIF/include/openssl/include/openssl/symhacks.h new file mode 100644 index 0000000..156ea6e --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/symhacks.h @@ -0,0 +1,37 @@ +/* + * Copyright 1999-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_SYMHACKS_H +# define HEADER_SYMHACKS_H + +# include + +/* Case insensitive linking causes problems.... */ +# if defined(OPENSSL_SYS_VMS) +# undef ERR_load_CRYPTO_strings +# define ERR_load_CRYPTO_strings ERR_load_CRYPTOlib_strings +# undef OCSP_crlID_new +# define OCSP_crlID_new OCSP_crlID2_new + +# undef d2i_ECPARAMETERS +# define d2i_ECPARAMETERS d2i_UC_ECPARAMETERS +# undef i2d_ECPARAMETERS +# define i2d_ECPARAMETERS i2d_UC_ECPARAMETERS +# undef d2i_ECPKPARAMETERS +# define d2i_ECPKPARAMETERS d2i_UC_ECPKPARAMETERS +# undef i2d_ECPKPARAMETERS +# define i2d_ECPKPARAMETERS i2d_UC_ECPKPARAMETERS + +/* This one clashes with CMS_data_create */ +# undef cms_Data_create +# define cms_Data_create priv_cms_Data_create + +# endif + +#endif /* ! defined HEADER_VMS_IDHACKS_H */ diff --git a/ONVIF/include/openssl/include/openssl/tls1.h b/ONVIF/include/openssl/include/openssl/tls1.h new file mode 100644 index 0000000..76d9fda --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/tls1.h @@ -0,0 +1,1237 @@ +/* + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved + * Copyright 2005 Nokia. All rights reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_TLS1_H +# define HEADER_TLS1_H + +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Default security level if not overridden at config time */ +# ifndef OPENSSL_TLS_SECURITY_LEVEL +# define OPENSSL_TLS_SECURITY_LEVEL 1 +# endif + +# define TLS1_VERSION 0x0301 +# define TLS1_1_VERSION 0x0302 +# define TLS1_2_VERSION 0x0303 +# define TLS1_3_VERSION 0x0304 +# define TLS_MAX_VERSION TLS1_3_VERSION + +/* Special value for method supporting multiple versions */ +# define TLS_ANY_VERSION 0x10000 + +# define TLS1_VERSION_MAJOR 0x03 +# define TLS1_VERSION_MINOR 0x01 + +# define TLS1_1_VERSION_MAJOR 0x03 +# define TLS1_1_VERSION_MINOR 0x02 + +# define TLS1_2_VERSION_MAJOR 0x03 +# define TLS1_2_VERSION_MINOR 0x03 + +# define TLS1_get_version(s) \ + ((SSL_version(s) >> 8) == TLS1_VERSION_MAJOR ? SSL_version(s) : 0) + +# define TLS1_get_client_version(s) \ + ((SSL_client_version(s) >> 8) == TLS1_VERSION_MAJOR ? SSL_client_version(s) : 0) + +# define TLS1_AD_DECRYPTION_FAILED 21 +# define TLS1_AD_RECORD_OVERFLOW 22 +# define TLS1_AD_UNKNOWN_CA 48/* fatal */ +# define TLS1_AD_ACCESS_DENIED 49/* fatal */ +# define TLS1_AD_DECODE_ERROR 50/* fatal */ +# define TLS1_AD_DECRYPT_ERROR 51 +# define TLS1_AD_EXPORT_RESTRICTION 60/* fatal */ +# define TLS1_AD_PROTOCOL_VERSION 70/* fatal */ +# define TLS1_AD_INSUFFICIENT_SECURITY 71/* fatal */ +# define TLS1_AD_INTERNAL_ERROR 80/* fatal */ +# define TLS1_AD_INAPPROPRIATE_FALLBACK 86/* fatal */ +# define TLS1_AD_USER_CANCELLED 90 +# define TLS1_AD_NO_RENEGOTIATION 100 +/* TLSv1.3 alerts */ +# define TLS13_AD_MISSING_EXTENSION 109 /* fatal */ +# define TLS13_AD_CERTIFICATE_REQUIRED 116 /* fatal */ +/* codes 110-114 are from RFC3546 */ +# define TLS1_AD_UNSUPPORTED_EXTENSION 110 +# define TLS1_AD_CERTIFICATE_UNOBTAINABLE 111 +# define TLS1_AD_UNRECOGNIZED_NAME 112 +# define TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE 113 +# define TLS1_AD_BAD_CERTIFICATE_HASH_VALUE 114 +# define TLS1_AD_UNKNOWN_PSK_IDENTITY 115/* fatal */ +# define TLS1_AD_NO_APPLICATION_PROTOCOL 120 /* fatal */ + +/* ExtensionType values from RFC3546 / RFC4366 / RFC6066 */ +# define TLSEXT_TYPE_server_name 0 +# define TLSEXT_TYPE_max_fragment_length 1 +# define TLSEXT_TYPE_client_certificate_url 2 +# define TLSEXT_TYPE_trusted_ca_keys 3 +# define TLSEXT_TYPE_truncated_hmac 4 +# define TLSEXT_TYPE_status_request 5 +/* ExtensionType values from RFC4681 */ +# define TLSEXT_TYPE_user_mapping 6 +/* ExtensionType values from RFC5878 */ +# define TLSEXT_TYPE_client_authz 7 +# define TLSEXT_TYPE_server_authz 8 +/* ExtensionType values from RFC6091 */ +# define TLSEXT_TYPE_cert_type 9 + +/* ExtensionType values from RFC4492 */ +/* + * Prior to TLSv1.3 the supported_groups extension was known as + * elliptic_curves + */ +# define TLSEXT_TYPE_supported_groups 10 +# define TLSEXT_TYPE_elliptic_curves TLSEXT_TYPE_supported_groups +# define TLSEXT_TYPE_ec_point_formats 11 + + +/* ExtensionType value from RFC5054 */ +# define TLSEXT_TYPE_srp 12 + +/* ExtensionType values from RFC5246 */ +# define TLSEXT_TYPE_signature_algorithms 13 + +/* ExtensionType value from RFC5764 */ +# define TLSEXT_TYPE_use_srtp 14 + +/* ExtensionType value from RFC5620 */ +# define TLSEXT_TYPE_heartbeat 15 + +/* ExtensionType value from RFC7301 */ +# define TLSEXT_TYPE_application_layer_protocol_negotiation 16 + +/* + * Extension type for Certificate Transparency + * https://tools.ietf.org/html/rfc6962#section-3.3.1 + */ +# define TLSEXT_TYPE_signed_certificate_timestamp 18 + +/* + * ExtensionType value for TLS padding extension. + * http://tools.ietf.org/html/draft-agl-tls-padding + */ +# define TLSEXT_TYPE_padding 21 + +/* ExtensionType value from RFC7366 */ +# define TLSEXT_TYPE_encrypt_then_mac 22 + +/* ExtensionType value from RFC7627 */ +# define TLSEXT_TYPE_extended_master_secret 23 + +/* ExtensionType value from RFC4507 */ +# define TLSEXT_TYPE_session_ticket 35 + +/* As defined for TLS1.3 */ +# define TLSEXT_TYPE_psk 41 +# define TLSEXT_TYPE_early_data 42 +# define TLSEXT_TYPE_supported_versions 43 +# define TLSEXT_TYPE_cookie 44 +# define TLSEXT_TYPE_psk_kex_modes 45 +# define TLSEXT_TYPE_certificate_authorities 47 +# define TLSEXT_TYPE_post_handshake_auth 49 +# define TLSEXT_TYPE_signature_algorithms_cert 50 +# define TLSEXT_TYPE_key_share 51 + +/* Temporary extension type */ +# define TLSEXT_TYPE_renegotiate 0xff01 + +# ifndef OPENSSL_NO_NEXTPROTONEG +/* This is not an IANA defined extension number */ +# define TLSEXT_TYPE_next_proto_neg 13172 +# endif + +/* NameType value from RFC3546 */ +# define TLSEXT_NAMETYPE_host_name 0 +/* status request value from RFC3546 */ +# define TLSEXT_STATUSTYPE_ocsp 1 + +/* ECPointFormat values from RFC4492 */ +# define TLSEXT_ECPOINTFORMAT_first 0 +# define TLSEXT_ECPOINTFORMAT_uncompressed 0 +# define TLSEXT_ECPOINTFORMAT_ansiX962_compressed_prime 1 +# define TLSEXT_ECPOINTFORMAT_ansiX962_compressed_char2 2 +# define TLSEXT_ECPOINTFORMAT_last 2 + +/* Signature and hash algorithms from RFC5246 */ +# define TLSEXT_signature_anonymous 0 +# define TLSEXT_signature_rsa 1 +# define TLSEXT_signature_dsa 2 +# define TLSEXT_signature_ecdsa 3 +# define TLSEXT_signature_gostr34102001 237 +# define TLSEXT_signature_gostr34102012_256 238 +# define TLSEXT_signature_gostr34102012_512 239 + +/* Total number of different signature algorithms */ +# define TLSEXT_signature_num 7 + +# define TLSEXT_hash_none 0 +# define TLSEXT_hash_md5 1 +# define TLSEXT_hash_sha1 2 +# define TLSEXT_hash_sha224 3 +# define TLSEXT_hash_sha256 4 +# define TLSEXT_hash_sha384 5 +# define TLSEXT_hash_sha512 6 +# define TLSEXT_hash_gostr3411 237 +# define TLSEXT_hash_gostr34112012_256 238 +# define TLSEXT_hash_gostr34112012_512 239 + +/* Total number of different digest algorithms */ + +# define TLSEXT_hash_num 10 + +/* Flag set for unrecognised algorithms */ +# define TLSEXT_nid_unknown 0x1000000 + +/* ECC curves */ + +# define TLSEXT_curve_P_256 23 +# define TLSEXT_curve_P_384 24 + +/* OpenSSL value to disable maximum fragment length extension */ +# define TLSEXT_max_fragment_length_DISABLED 0 +/* Allowed values for max fragment length extension */ +# define TLSEXT_max_fragment_length_512 1 +# define TLSEXT_max_fragment_length_1024 2 +# define TLSEXT_max_fragment_length_2048 3 +# define TLSEXT_max_fragment_length_4096 4 + +int SSL_CTX_set_tlsext_max_fragment_length(SSL_CTX *ctx, uint8_t mode); +int SSL_set_tlsext_max_fragment_length(SSL *ssl, uint8_t mode); + +# define TLSEXT_MAXLEN_host_name 255 + +__owur const char *SSL_get_servername(const SSL *s, const int type); +__owur int SSL_get_servername_type(const SSL *s); +/* + * SSL_export_keying_material exports a value derived from the master secret, + * as specified in RFC 5705. It writes |olen| bytes to |out| given a label and + * optional context. (Since a zero length context is allowed, the |use_context| + * flag controls whether a context is included.) It returns 1 on success and + * 0 or -1 otherwise. + */ +__owur int SSL_export_keying_material(SSL *s, unsigned char *out, size_t olen, + const char *label, size_t llen, + const unsigned char *context, + size_t contextlen, int use_context); + +/* + * SSL_export_keying_material_early exports a value derived from the + * early exporter master secret, as specified in + * https://tools.ietf.org/html/draft-ietf-tls-tls13-23. It writes + * |olen| bytes to |out| given a label and optional context. It + * returns 1 on success and 0 otherwise. + */ +__owur int SSL_export_keying_material_early(SSL *s, unsigned char *out, + size_t olen, const char *label, + size_t llen, + const unsigned char *context, + size_t contextlen); + +int SSL_get_peer_signature_type_nid(const SSL *s, int *pnid); +int SSL_get_signature_type_nid(const SSL *s, int *pnid); + +int SSL_get_sigalgs(SSL *s, int idx, + int *psign, int *phash, int *psignandhash, + unsigned char *rsig, unsigned char *rhash); + +int SSL_get_shared_sigalgs(SSL *s, int idx, + int *psign, int *phash, int *psignandhash, + unsigned char *rsig, unsigned char *rhash); + +__owur int SSL_check_chain(SSL *s, X509 *x, EVP_PKEY *pk, STACK_OF(X509) *chain); + +# define SSL_set_tlsext_host_name(s,name) \ + SSL_ctrl(s,SSL_CTRL_SET_TLSEXT_HOSTNAME,TLSEXT_NAMETYPE_host_name,\ + (void *)name) + +# define SSL_set_tlsext_debug_callback(ssl, cb) \ + SSL_callback_ctrl(ssl,SSL_CTRL_SET_TLSEXT_DEBUG_CB,\ + (void (*)(void))cb) + +# define SSL_set_tlsext_debug_arg(ssl, arg) \ + SSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_DEBUG_ARG,0,arg) + +# define SSL_get_tlsext_status_type(ssl) \ + SSL_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_TYPE,0,NULL) + +# define SSL_set_tlsext_status_type(ssl, type) \ + SSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_TYPE,type,NULL) + +# define SSL_get_tlsext_status_exts(ssl, arg) \ + SSL_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_EXTS,0,arg) + +# define SSL_set_tlsext_status_exts(ssl, arg) \ + SSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_EXTS,0,arg) + +# define SSL_get_tlsext_status_ids(ssl, arg) \ + SSL_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_IDS,0,arg) + +# define SSL_set_tlsext_status_ids(ssl, arg) \ + SSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_IDS,0,arg) + +# define SSL_get_tlsext_status_ocsp_resp(ssl, arg) \ + SSL_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_OCSP_RESP,0,arg) + +# define SSL_set_tlsext_status_ocsp_resp(ssl, arg, arglen) \ + SSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_OCSP_RESP,arglen,arg) + +# define SSL_CTX_set_tlsext_servername_callback(ctx, cb) \ + SSL_CTX_callback_ctrl(ctx,SSL_CTRL_SET_TLSEXT_SERVERNAME_CB,\ + (void (*)(void))cb) + +# define SSL_TLSEXT_ERR_OK 0 +# define SSL_TLSEXT_ERR_ALERT_WARNING 1 +# define SSL_TLSEXT_ERR_ALERT_FATAL 2 +# define SSL_TLSEXT_ERR_NOACK 3 + +# define SSL_CTX_set_tlsext_servername_arg(ctx, arg) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TLSEXT_SERVERNAME_ARG,0,arg) + +# define SSL_CTX_get_tlsext_ticket_keys(ctx, keys, keylen) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_GET_TLSEXT_TICKET_KEYS,keylen,keys) +# define SSL_CTX_set_tlsext_ticket_keys(ctx, keys, keylen) \ + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TLSEXT_TICKET_KEYS,keylen,keys) + +# define SSL_CTX_get_tlsext_status_cb(ssl, cb) \ + SSL_CTX_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_CB,0,(void *)cb) +# define SSL_CTX_set_tlsext_status_cb(ssl, cb) \ + SSL_CTX_callback_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB,\ + (void (*)(void))cb) + +# define SSL_CTX_get_tlsext_status_arg(ssl, arg) \ + SSL_CTX_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_CB_ARG,0,arg) +# define SSL_CTX_set_tlsext_status_arg(ssl, arg) \ + SSL_CTX_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB_ARG,0,arg) + +# define SSL_CTX_set_tlsext_status_type(ssl, type) \ + SSL_CTX_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_TYPE,type,NULL) + +# define SSL_CTX_get_tlsext_status_type(ssl) \ + SSL_CTX_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_TYPE,0,NULL) + +# define SSL_CTX_set_tlsext_ticket_key_cb(ssl, cb) \ + SSL_CTX_callback_ctrl(ssl,SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB,\ + (void (*)(void))cb) + +# ifndef OPENSSL_NO_HEARTBEATS +# define SSL_DTLSEXT_HB_ENABLED 0x01 +# define SSL_DTLSEXT_HB_DONT_SEND_REQUESTS 0x02 +# define SSL_DTLSEXT_HB_DONT_RECV_REQUESTS 0x04 +# define SSL_get_dtlsext_heartbeat_pending(ssl) \ + SSL_ctrl(ssl,SSL_CTRL_GET_DTLS_EXT_HEARTBEAT_PENDING,0,NULL) +# define SSL_set_dtlsext_heartbeat_no_requests(ssl, arg) \ + SSL_ctrl(ssl,SSL_CTRL_SET_DTLS_EXT_HEARTBEAT_NO_REQUESTS,arg,NULL) + +# if OPENSSL_API_COMPAT < 0x10100000L +# define SSL_CTRL_TLS_EXT_SEND_HEARTBEAT \ + SSL_CTRL_DTLS_EXT_SEND_HEARTBEAT +# define SSL_CTRL_GET_TLS_EXT_HEARTBEAT_PENDING \ + SSL_CTRL_GET_DTLS_EXT_HEARTBEAT_PENDING +# define SSL_CTRL_SET_TLS_EXT_HEARTBEAT_NO_REQUESTS \ + SSL_CTRL_SET_DTLS_EXT_HEARTBEAT_NO_REQUESTS +# define SSL_TLSEXT_HB_ENABLED \ + SSL_DTLSEXT_HB_ENABLED +# define SSL_TLSEXT_HB_DONT_SEND_REQUESTS \ + SSL_DTLSEXT_HB_DONT_SEND_REQUESTS +# define SSL_TLSEXT_HB_DONT_RECV_REQUESTS \ + SSL_DTLSEXT_HB_DONT_RECV_REQUESTS +# define SSL_get_tlsext_heartbeat_pending(ssl) \ + SSL_get_dtlsext_heartbeat_pending(ssl) +# define SSL_set_tlsext_heartbeat_no_requests(ssl, arg) \ + SSL_set_dtlsext_heartbeat_no_requests(ssl,arg) +# endif +# endif + +/* PSK ciphersuites from 4279 */ +# define TLS1_CK_PSK_WITH_RC4_128_SHA 0x0300008A +# define TLS1_CK_PSK_WITH_3DES_EDE_CBC_SHA 0x0300008B +# define TLS1_CK_PSK_WITH_AES_128_CBC_SHA 0x0300008C +# define TLS1_CK_PSK_WITH_AES_256_CBC_SHA 0x0300008D +# define TLS1_CK_DHE_PSK_WITH_RC4_128_SHA 0x0300008E +# define TLS1_CK_DHE_PSK_WITH_3DES_EDE_CBC_SHA 0x0300008F +# define TLS1_CK_DHE_PSK_WITH_AES_128_CBC_SHA 0x03000090 +# define TLS1_CK_DHE_PSK_WITH_AES_256_CBC_SHA 0x03000091 +# define TLS1_CK_RSA_PSK_WITH_RC4_128_SHA 0x03000092 +# define TLS1_CK_RSA_PSK_WITH_3DES_EDE_CBC_SHA 0x03000093 +# define TLS1_CK_RSA_PSK_WITH_AES_128_CBC_SHA 0x03000094 +# define TLS1_CK_RSA_PSK_WITH_AES_256_CBC_SHA 0x03000095 + +/* PSK ciphersuites from 5487 */ +# define TLS1_CK_PSK_WITH_AES_128_GCM_SHA256 0x030000A8 +# define TLS1_CK_PSK_WITH_AES_256_GCM_SHA384 0x030000A9 +# define TLS1_CK_DHE_PSK_WITH_AES_128_GCM_SHA256 0x030000AA +# define TLS1_CK_DHE_PSK_WITH_AES_256_GCM_SHA384 0x030000AB +# define TLS1_CK_RSA_PSK_WITH_AES_128_GCM_SHA256 0x030000AC +# define TLS1_CK_RSA_PSK_WITH_AES_256_GCM_SHA384 0x030000AD +# define TLS1_CK_PSK_WITH_AES_128_CBC_SHA256 0x030000AE +# define TLS1_CK_PSK_WITH_AES_256_CBC_SHA384 0x030000AF +# define TLS1_CK_PSK_WITH_NULL_SHA256 0x030000B0 +# define TLS1_CK_PSK_WITH_NULL_SHA384 0x030000B1 +# define TLS1_CK_DHE_PSK_WITH_AES_128_CBC_SHA256 0x030000B2 +# define TLS1_CK_DHE_PSK_WITH_AES_256_CBC_SHA384 0x030000B3 +# define TLS1_CK_DHE_PSK_WITH_NULL_SHA256 0x030000B4 +# define TLS1_CK_DHE_PSK_WITH_NULL_SHA384 0x030000B5 +# define TLS1_CK_RSA_PSK_WITH_AES_128_CBC_SHA256 0x030000B6 +# define TLS1_CK_RSA_PSK_WITH_AES_256_CBC_SHA384 0x030000B7 +# define TLS1_CK_RSA_PSK_WITH_NULL_SHA256 0x030000B8 +# define TLS1_CK_RSA_PSK_WITH_NULL_SHA384 0x030000B9 + +/* NULL PSK ciphersuites from RFC4785 */ +# define TLS1_CK_PSK_WITH_NULL_SHA 0x0300002C +# define TLS1_CK_DHE_PSK_WITH_NULL_SHA 0x0300002D +# define TLS1_CK_RSA_PSK_WITH_NULL_SHA 0x0300002E + +/* AES ciphersuites from RFC3268 */ +# define TLS1_CK_RSA_WITH_AES_128_SHA 0x0300002F +# define TLS1_CK_DH_DSS_WITH_AES_128_SHA 0x03000030 +# define TLS1_CK_DH_RSA_WITH_AES_128_SHA 0x03000031 +# define TLS1_CK_DHE_DSS_WITH_AES_128_SHA 0x03000032 +# define TLS1_CK_DHE_RSA_WITH_AES_128_SHA 0x03000033 +# define TLS1_CK_ADH_WITH_AES_128_SHA 0x03000034 +# define TLS1_CK_RSA_WITH_AES_256_SHA 0x03000035 +# define TLS1_CK_DH_DSS_WITH_AES_256_SHA 0x03000036 +# define TLS1_CK_DH_RSA_WITH_AES_256_SHA 0x03000037 +# define TLS1_CK_DHE_DSS_WITH_AES_256_SHA 0x03000038 +# define TLS1_CK_DHE_RSA_WITH_AES_256_SHA 0x03000039 +# define TLS1_CK_ADH_WITH_AES_256_SHA 0x0300003A + +/* TLS v1.2 ciphersuites */ +# define TLS1_CK_RSA_WITH_NULL_SHA256 0x0300003B +# define TLS1_CK_RSA_WITH_AES_128_SHA256 0x0300003C +# define TLS1_CK_RSA_WITH_AES_256_SHA256 0x0300003D +# define TLS1_CK_DH_DSS_WITH_AES_128_SHA256 0x0300003E +# define TLS1_CK_DH_RSA_WITH_AES_128_SHA256 0x0300003F +# define TLS1_CK_DHE_DSS_WITH_AES_128_SHA256 0x03000040 + +/* Camellia ciphersuites from RFC4132 */ +# define TLS1_CK_RSA_WITH_CAMELLIA_128_CBC_SHA 0x03000041 +# define TLS1_CK_DH_DSS_WITH_CAMELLIA_128_CBC_SHA 0x03000042 +# define TLS1_CK_DH_RSA_WITH_CAMELLIA_128_CBC_SHA 0x03000043 +# define TLS1_CK_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA 0x03000044 +# define TLS1_CK_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA 0x03000045 +# define TLS1_CK_ADH_WITH_CAMELLIA_128_CBC_SHA 0x03000046 + +/* TLS v1.2 ciphersuites */ +# define TLS1_CK_DHE_RSA_WITH_AES_128_SHA256 0x03000067 +# define TLS1_CK_DH_DSS_WITH_AES_256_SHA256 0x03000068 +# define TLS1_CK_DH_RSA_WITH_AES_256_SHA256 0x03000069 +# define TLS1_CK_DHE_DSS_WITH_AES_256_SHA256 0x0300006A +# define TLS1_CK_DHE_RSA_WITH_AES_256_SHA256 0x0300006B +# define TLS1_CK_ADH_WITH_AES_128_SHA256 0x0300006C +# define TLS1_CK_ADH_WITH_AES_256_SHA256 0x0300006D + +/* Camellia ciphersuites from RFC4132 */ +# define TLS1_CK_RSA_WITH_CAMELLIA_256_CBC_SHA 0x03000084 +# define TLS1_CK_DH_DSS_WITH_CAMELLIA_256_CBC_SHA 0x03000085 +# define TLS1_CK_DH_RSA_WITH_CAMELLIA_256_CBC_SHA 0x03000086 +# define TLS1_CK_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA 0x03000087 +# define TLS1_CK_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA 0x03000088 +# define TLS1_CK_ADH_WITH_CAMELLIA_256_CBC_SHA 0x03000089 + +/* SEED ciphersuites from RFC4162 */ +# define TLS1_CK_RSA_WITH_SEED_SHA 0x03000096 +# define TLS1_CK_DH_DSS_WITH_SEED_SHA 0x03000097 +# define TLS1_CK_DH_RSA_WITH_SEED_SHA 0x03000098 +# define TLS1_CK_DHE_DSS_WITH_SEED_SHA 0x03000099 +# define TLS1_CK_DHE_RSA_WITH_SEED_SHA 0x0300009A +# define TLS1_CK_ADH_WITH_SEED_SHA 0x0300009B + +/* TLS v1.2 GCM ciphersuites from RFC5288 */ +# define TLS1_CK_RSA_WITH_AES_128_GCM_SHA256 0x0300009C +# define TLS1_CK_RSA_WITH_AES_256_GCM_SHA384 0x0300009D +# define TLS1_CK_DHE_RSA_WITH_AES_128_GCM_SHA256 0x0300009E +# define TLS1_CK_DHE_RSA_WITH_AES_256_GCM_SHA384 0x0300009F +# define TLS1_CK_DH_RSA_WITH_AES_128_GCM_SHA256 0x030000A0 +# define TLS1_CK_DH_RSA_WITH_AES_256_GCM_SHA384 0x030000A1 +# define TLS1_CK_DHE_DSS_WITH_AES_128_GCM_SHA256 0x030000A2 +# define TLS1_CK_DHE_DSS_WITH_AES_256_GCM_SHA384 0x030000A3 +# define TLS1_CK_DH_DSS_WITH_AES_128_GCM_SHA256 0x030000A4 +# define TLS1_CK_DH_DSS_WITH_AES_256_GCM_SHA384 0x030000A5 +# define TLS1_CK_ADH_WITH_AES_128_GCM_SHA256 0x030000A6 +# define TLS1_CK_ADH_WITH_AES_256_GCM_SHA384 0x030000A7 + +/* CCM ciphersuites from RFC6655 */ +# define TLS1_CK_RSA_WITH_AES_128_CCM 0x0300C09C +# define TLS1_CK_RSA_WITH_AES_256_CCM 0x0300C09D +# define TLS1_CK_DHE_RSA_WITH_AES_128_CCM 0x0300C09E +# define TLS1_CK_DHE_RSA_WITH_AES_256_CCM 0x0300C09F +# define TLS1_CK_RSA_WITH_AES_128_CCM_8 0x0300C0A0 +# define TLS1_CK_RSA_WITH_AES_256_CCM_8 0x0300C0A1 +# define TLS1_CK_DHE_RSA_WITH_AES_128_CCM_8 0x0300C0A2 +# define TLS1_CK_DHE_RSA_WITH_AES_256_CCM_8 0x0300C0A3 +# define TLS1_CK_PSK_WITH_AES_128_CCM 0x0300C0A4 +# define TLS1_CK_PSK_WITH_AES_256_CCM 0x0300C0A5 +# define TLS1_CK_DHE_PSK_WITH_AES_128_CCM 0x0300C0A6 +# define TLS1_CK_DHE_PSK_WITH_AES_256_CCM 0x0300C0A7 +# define TLS1_CK_PSK_WITH_AES_128_CCM_8 0x0300C0A8 +# define TLS1_CK_PSK_WITH_AES_256_CCM_8 0x0300C0A9 +# define TLS1_CK_DHE_PSK_WITH_AES_128_CCM_8 0x0300C0AA +# define TLS1_CK_DHE_PSK_WITH_AES_256_CCM_8 0x0300C0AB + +/* CCM ciphersuites from RFC7251 */ +# define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_CCM 0x0300C0AC +# define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_CCM 0x0300C0AD +# define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_CCM_8 0x0300C0AE +# define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_CCM_8 0x0300C0AF + +/* TLS 1.2 Camellia SHA-256 ciphersuites from RFC5932 */ +# define TLS1_CK_RSA_WITH_CAMELLIA_128_CBC_SHA256 0x030000BA +# define TLS1_CK_DH_DSS_WITH_CAMELLIA_128_CBC_SHA256 0x030000BB +# define TLS1_CK_DH_RSA_WITH_CAMELLIA_128_CBC_SHA256 0x030000BC +# define TLS1_CK_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA256 0x030000BD +# define TLS1_CK_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 0x030000BE +# define TLS1_CK_ADH_WITH_CAMELLIA_128_CBC_SHA256 0x030000BF + +# define TLS1_CK_RSA_WITH_CAMELLIA_256_CBC_SHA256 0x030000C0 +# define TLS1_CK_DH_DSS_WITH_CAMELLIA_256_CBC_SHA256 0x030000C1 +# define TLS1_CK_DH_RSA_WITH_CAMELLIA_256_CBC_SHA256 0x030000C2 +# define TLS1_CK_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA256 0x030000C3 +# define TLS1_CK_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256 0x030000C4 +# define TLS1_CK_ADH_WITH_CAMELLIA_256_CBC_SHA256 0x030000C5 + +/* ECC ciphersuites from RFC4492 */ +# define TLS1_CK_ECDH_ECDSA_WITH_NULL_SHA 0x0300C001 +# define TLS1_CK_ECDH_ECDSA_WITH_RC4_128_SHA 0x0300C002 +# define TLS1_CK_ECDH_ECDSA_WITH_DES_192_CBC3_SHA 0x0300C003 +# define TLS1_CK_ECDH_ECDSA_WITH_AES_128_CBC_SHA 0x0300C004 +# define TLS1_CK_ECDH_ECDSA_WITH_AES_256_CBC_SHA 0x0300C005 + +# define TLS1_CK_ECDHE_ECDSA_WITH_NULL_SHA 0x0300C006 +# define TLS1_CK_ECDHE_ECDSA_WITH_RC4_128_SHA 0x0300C007 +# define TLS1_CK_ECDHE_ECDSA_WITH_DES_192_CBC3_SHA 0x0300C008 +# define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_CBC_SHA 0x0300C009 +# define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_CBC_SHA 0x0300C00A + +# define TLS1_CK_ECDH_RSA_WITH_NULL_SHA 0x0300C00B +# define TLS1_CK_ECDH_RSA_WITH_RC4_128_SHA 0x0300C00C +# define TLS1_CK_ECDH_RSA_WITH_DES_192_CBC3_SHA 0x0300C00D +# define TLS1_CK_ECDH_RSA_WITH_AES_128_CBC_SHA 0x0300C00E +# define TLS1_CK_ECDH_RSA_WITH_AES_256_CBC_SHA 0x0300C00F + +# define TLS1_CK_ECDHE_RSA_WITH_NULL_SHA 0x0300C010 +# define TLS1_CK_ECDHE_RSA_WITH_RC4_128_SHA 0x0300C011 +# define TLS1_CK_ECDHE_RSA_WITH_DES_192_CBC3_SHA 0x0300C012 +# define TLS1_CK_ECDHE_RSA_WITH_AES_128_CBC_SHA 0x0300C013 +# define TLS1_CK_ECDHE_RSA_WITH_AES_256_CBC_SHA 0x0300C014 + +# define TLS1_CK_ECDH_anon_WITH_NULL_SHA 0x0300C015 +# define TLS1_CK_ECDH_anon_WITH_RC4_128_SHA 0x0300C016 +# define TLS1_CK_ECDH_anon_WITH_DES_192_CBC3_SHA 0x0300C017 +# define TLS1_CK_ECDH_anon_WITH_AES_128_CBC_SHA 0x0300C018 +# define TLS1_CK_ECDH_anon_WITH_AES_256_CBC_SHA 0x0300C019 + +/* SRP ciphersuites from RFC 5054 */ +# define TLS1_CK_SRP_SHA_WITH_3DES_EDE_CBC_SHA 0x0300C01A +# define TLS1_CK_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA 0x0300C01B +# define TLS1_CK_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA 0x0300C01C +# define TLS1_CK_SRP_SHA_WITH_AES_128_CBC_SHA 0x0300C01D +# define TLS1_CK_SRP_SHA_RSA_WITH_AES_128_CBC_SHA 0x0300C01E +# define TLS1_CK_SRP_SHA_DSS_WITH_AES_128_CBC_SHA 0x0300C01F +# define TLS1_CK_SRP_SHA_WITH_AES_256_CBC_SHA 0x0300C020 +# define TLS1_CK_SRP_SHA_RSA_WITH_AES_256_CBC_SHA 0x0300C021 +# define TLS1_CK_SRP_SHA_DSS_WITH_AES_256_CBC_SHA 0x0300C022 + +/* ECDH HMAC based ciphersuites from RFC5289 */ +# define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_SHA256 0x0300C023 +# define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_SHA384 0x0300C024 +# define TLS1_CK_ECDH_ECDSA_WITH_AES_128_SHA256 0x0300C025 +# define TLS1_CK_ECDH_ECDSA_WITH_AES_256_SHA384 0x0300C026 +# define TLS1_CK_ECDHE_RSA_WITH_AES_128_SHA256 0x0300C027 +# define TLS1_CK_ECDHE_RSA_WITH_AES_256_SHA384 0x0300C028 +# define TLS1_CK_ECDH_RSA_WITH_AES_128_SHA256 0x0300C029 +# define TLS1_CK_ECDH_RSA_WITH_AES_256_SHA384 0x0300C02A + +/* ECDH GCM based ciphersuites from RFC5289 */ +# define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 0x0300C02B +# define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 0x0300C02C +# define TLS1_CK_ECDH_ECDSA_WITH_AES_128_GCM_SHA256 0x0300C02D +# define TLS1_CK_ECDH_ECDSA_WITH_AES_256_GCM_SHA384 0x0300C02E +# define TLS1_CK_ECDHE_RSA_WITH_AES_128_GCM_SHA256 0x0300C02F +# define TLS1_CK_ECDHE_RSA_WITH_AES_256_GCM_SHA384 0x0300C030 +# define TLS1_CK_ECDH_RSA_WITH_AES_128_GCM_SHA256 0x0300C031 +# define TLS1_CK_ECDH_RSA_WITH_AES_256_GCM_SHA384 0x0300C032 + +/* ECDHE PSK ciphersuites from RFC5489 */ +# define TLS1_CK_ECDHE_PSK_WITH_RC4_128_SHA 0x0300C033 +# define TLS1_CK_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA 0x0300C034 +# define TLS1_CK_ECDHE_PSK_WITH_AES_128_CBC_SHA 0x0300C035 +# define TLS1_CK_ECDHE_PSK_WITH_AES_256_CBC_SHA 0x0300C036 + +# define TLS1_CK_ECDHE_PSK_WITH_AES_128_CBC_SHA256 0x0300C037 +# define TLS1_CK_ECDHE_PSK_WITH_AES_256_CBC_SHA384 0x0300C038 + +/* NULL PSK ciphersuites from RFC4785 */ +# define TLS1_CK_ECDHE_PSK_WITH_NULL_SHA 0x0300C039 +# define TLS1_CK_ECDHE_PSK_WITH_NULL_SHA256 0x0300C03A +# define TLS1_CK_ECDHE_PSK_WITH_NULL_SHA384 0x0300C03B + +/* Camellia-CBC ciphersuites from RFC6367 */ +# define TLS1_CK_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 0x0300C072 +# define TLS1_CK_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 0x0300C073 +# define TLS1_CK_ECDH_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 0x0300C074 +# define TLS1_CK_ECDH_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 0x0300C075 +# define TLS1_CK_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 0x0300C076 +# define TLS1_CK_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384 0x0300C077 +# define TLS1_CK_ECDH_RSA_WITH_CAMELLIA_128_CBC_SHA256 0x0300C078 +# define TLS1_CK_ECDH_RSA_WITH_CAMELLIA_256_CBC_SHA384 0x0300C079 + +# define TLS1_CK_PSK_WITH_CAMELLIA_128_CBC_SHA256 0x0300C094 +# define TLS1_CK_PSK_WITH_CAMELLIA_256_CBC_SHA384 0x0300C095 +# define TLS1_CK_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 0x0300C096 +# define TLS1_CK_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 0x0300C097 +# define TLS1_CK_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256 0x0300C098 +# define TLS1_CK_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384 0x0300C099 +# define TLS1_CK_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 0x0300C09A +# define TLS1_CK_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 0x0300C09B + +/* draft-ietf-tls-chacha20-poly1305-03 */ +# define TLS1_CK_ECDHE_RSA_WITH_CHACHA20_POLY1305 0x0300CCA8 +# define TLS1_CK_ECDHE_ECDSA_WITH_CHACHA20_POLY1305 0x0300CCA9 +# define TLS1_CK_DHE_RSA_WITH_CHACHA20_POLY1305 0x0300CCAA +# define TLS1_CK_PSK_WITH_CHACHA20_POLY1305 0x0300CCAB +# define TLS1_CK_ECDHE_PSK_WITH_CHACHA20_POLY1305 0x0300CCAC +# define TLS1_CK_DHE_PSK_WITH_CHACHA20_POLY1305 0x0300CCAD +# define TLS1_CK_RSA_PSK_WITH_CHACHA20_POLY1305 0x0300CCAE + +/* TLS v1.3 ciphersuites */ +# define TLS1_3_CK_AES_128_GCM_SHA256 0x03001301 +# define TLS1_3_CK_AES_256_GCM_SHA384 0x03001302 +# define TLS1_3_CK_CHACHA20_POLY1305_SHA256 0x03001303 +# define TLS1_3_CK_AES_128_CCM_SHA256 0x03001304 +# define TLS1_3_CK_AES_128_CCM_8_SHA256 0x03001305 + +/* Aria ciphersuites from RFC6209 */ +# define TLS1_CK_RSA_WITH_ARIA_128_GCM_SHA256 0x0300C050 +# define TLS1_CK_RSA_WITH_ARIA_256_GCM_SHA384 0x0300C051 +# define TLS1_CK_DHE_RSA_WITH_ARIA_128_GCM_SHA256 0x0300C052 +# define TLS1_CK_DHE_RSA_WITH_ARIA_256_GCM_SHA384 0x0300C053 +# define TLS1_CK_DH_RSA_WITH_ARIA_128_GCM_SHA256 0x0300C054 +# define TLS1_CK_DH_RSA_WITH_ARIA_256_GCM_SHA384 0x0300C055 +# define TLS1_CK_DHE_DSS_WITH_ARIA_128_GCM_SHA256 0x0300C056 +# define TLS1_CK_DHE_DSS_WITH_ARIA_256_GCM_SHA384 0x0300C057 +# define TLS1_CK_DH_DSS_WITH_ARIA_128_GCM_SHA256 0x0300C058 +# define TLS1_CK_DH_DSS_WITH_ARIA_256_GCM_SHA384 0x0300C059 +# define TLS1_CK_DH_anon_WITH_ARIA_128_GCM_SHA256 0x0300C05A +# define TLS1_CK_DH_anon_WITH_ARIA_256_GCM_SHA384 0x0300C05B +# define TLS1_CK_ECDHE_ECDSA_WITH_ARIA_128_GCM_SHA256 0x0300C05C +# define TLS1_CK_ECDHE_ECDSA_WITH_ARIA_256_GCM_SHA384 0x0300C05D +# define TLS1_CK_ECDH_ECDSA_WITH_ARIA_128_GCM_SHA256 0x0300C05E +# define TLS1_CK_ECDH_ECDSA_WITH_ARIA_256_GCM_SHA384 0x0300C05F +# define TLS1_CK_ECDHE_RSA_WITH_ARIA_128_GCM_SHA256 0x0300C060 +# define TLS1_CK_ECDHE_RSA_WITH_ARIA_256_GCM_SHA384 0x0300C061 +# define TLS1_CK_ECDH_RSA_WITH_ARIA_128_GCM_SHA256 0x0300C062 +# define TLS1_CK_ECDH_RSA_WITH_ARIA_256_GCM_SHA384 0x0300C063 +# define TLS1_CK_PSK_WITH_ARIA_128_GCM_SHA256 0x0300C06A +# define TLS1_CK_PSK_WITH_ARIA_256_GCM_SHA384 0x0300C06B +# define TLS1_CK_DHE_PSK_WITH_ARIA_128_GCM_SHA256 0x0300C06C +# define TLS1_CK_DHE_PSK_WITH_ARIA_256_GCM_SHA384 0x0300C06D +# define TLS1_CK_RSA_PSK_WITH_ARIA_128_GCM_SHA256 0x0300C06E +# define TLS1_CK_RSA_PSK_WITH_ARIA_256_GCM_SHA384 0x0300C06F + +/* a bundle of RFC standard cipher names, generated from ssl3_ciphers[] */ +# define TLS1_RFC_RSA_WITH_AES_128_SHA "TLS_RSA_WITH_AES_128_CBC_SHA" +# define TLS1_RFC_DHE_DSS_WITH_AES_128_SHA "TLS_DHE_DSS_WITH_AES_128_CBC_SHA" +# define TLS1_RFC_DHE_RSA_WITH_AES_128_SHA "TLS_DHE_RSA_WITH_AES_128_CBC_SHA" +# define TLS1_RFC_ADH_WITH_AES_128_SHA "TLS_DH_anon_WITH_AES_128_CBC_SHA" +# define TLS1_RFC_RSA_WITH_AES_256_SHA "TLS_RSA_WITH_AES_256_CBC_SHA" +# define TLS1_RFC_DHE_DSS_WITH_AES_256_SHA "TLS_DHE_DSS_WITH_AES_256_CBC_SHA" +# define TLS1_RFC_DHE_RSA_WITH_AES_256_SHA "TLS_DHE_RSA_WITH_AES_256_CBC_SHA" +# define TLS1_RFC_ADH_WITH_AES_256_SHA "TLS_DH_anon_WITH_AES_256_CBC_SHA" +# define TLS1_RFC_RSA_WITH_NULL_SHA256 "TLS_RSA_WITH_NULL_SHA256" +# define TLS1_RFC_RSA_WITH_AES_128_SHA256 "TLS_RSA_WITH_AES_128_CBC_SHA256" +# define TLS1_RFC_RSA_WITH_AES_256_SHA256 "TLS_RSA_WITH_AES_256_CBC_SHA256" +# define TLS1_RFC_DHE_DSS_WITH_AES_128_SHA256 "TLS_DHE_DSS_WITH_AES_128_CBC_SHA256" +# define TLS1_RFC_DHE_RSA_WITH_AES_128_SHA256 "TLS_DHE_RSA_WITH_AES_128_CBC_SHA256" +# define TLS1_RFC_DHE_DSS_WITH_AES_256_SHA256 "TLS_DHE_DSS_WITH_AES_256_CBC_SHA256" +# define TLS1_RFC_DHE_RSA_WITH_AES_256_SHA256 "TLS_DHE_RSA_WITH_AES_256_CBC_SHA256" +# define TLS1_RFC_ADH_WITH_AES_128_SHA256 "TLS_DH_anon_WITH_AES_128_CBC_SHA256" +# define TLS1_RFC_ADH_WITH_AES_256_SHA256 "TLS_DH_anon_WITH_AES_256_CBC_SHA256" +# define TLS1_RFC_RSA_WITH_AES_128_GCM_SHA256 "TLS_RSA_WITH_AES_128_GCM_SHA256" +# define TLS1_RFC_RSA_WITH_AES_256_GCM_SHA384 "TLS_RSA_WITH_AES_256_GCM_SHA384" +# define TLS1_RFC_DHE_RSA_WITH_AES_128_GCM_SHA256 "TLS_DHE_RSA_WITH_AES_128_GCM_SHA256" +# define TLS1_RFC_DHE_RSA_WITH_AES_256_GCM_SHA384 "TLS_DHE_RSA_WITH_AES_256_GCM_SHA384" +# define TLS1_RFC_DHE_DSS_WITH_AES_128_GCM_SHA256 "TLS_DHE_DSS_WITH_AES_128_GCM_SHA256" +# define TLS1_RFC_DHE_DSS_WITH_AES_256_GCM_SHA384 "TLS_DHE_DSS_WITH_AES_256_GCM_SHA384" +# define TLS1_RFC_ADH_WITH_AES_128_GCM_SHA256 "TLS_DH_anon_WITH_AES_128_GCM_SHA256" +# define TLS1_RFC_ADH_WITH_AES_256_GCM_SHA384 "TLS_DH_anon_WITH_AES_256_GCM_SHA384" +# define TLS1_RFC_RSA_WITH_AES_128_CCM "TLS_RSA_WITH_AES_128_CCM" +# define TLS1_RFC_RSA_WITH_AES_256_CCM "TLS_RSA_WITH_AES_256_CCM" +# define TLS1_RFC_DHE_RSA_WITH_AES_128_CCM "TLS_DHE_RSA_WITH_AES_128_CCM" +# define TLS1_RFC_DHE_RSA_WITH_AES_256_CCM "TLS_DHE_RSA_WITH_AES_256_CCM" +# define TLS1_RFC_RSA_WITH_AES_128_CCM_8 "TLS_RSA_WITH_AES_128_CCM_8" +# define TLS1_RFC_RSA_WITH_AES_256_CCM_8 "TLS_RSA_WITH_AES_256_CCM_8" +# define TLS1_RFC_DHE_RSA_WITH_AES_128_CCM_8 "TLS_DHE_RSA_WITH_AES_128_CCM_8" +# define TLS1_RFC_DHE_RSA_WITH_AES_256_CCM_8 "TLS_DHE_RSA_WITH_AES_256_CCM_8" +# define TLS1_RFC_PSK_WITH_AES_128_CCM "TLS_PSK_WITH_AES_128_CCM" +# define TLS1_RFC_PSK_WITH_AES_256_CCM "TLS_PSK_WITH_AES_256_CCM" +# define TLS1_RFC_DHE_PSK_WITH_AES_128_CCM "TLS_DHE_PSK_WITH_AES_128_CCM" +# define TLS1_RFC_DHE_PSK_WITH_AES_256_CCM "TLS_DHE_PSK_WITH_AES_256_CCM" +# define TLS1_RFC_PSK_WITH_AES_128_CCM_8 "TLS_PSK_WITH_AES_128_CCM_8" +# define TLS1_RFC_PSK_WITH_AES_256_CCM_8 "TLS_PSK_WITH_AES_256_CCM_8" +# define TLS1_RFC_DHE_PSK_WITH_AES_128_CCM_8 "TLS_PSK_DHE_WITH_AES_128_CCM_8" +# define TLS1_RFC_DHE_PSK_WITH_AES_256_CCM_8 "TLS_PSK_DHE_WITH_AES_256_CCM_8" +# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_128_CCM "TLS_ECDHE_ECDSA_WITH_AES_128_CCM" +# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_256_CCM "TLS_ECDHE_ECDSA_WITH_AES_256_CCM" +# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_128_CCM_8 "TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8" +# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_256_CCM_8 "TLS_ECDHE_ECDSA_WITH_AES_256_CCM_8" +# define TLS1_3_RFC_AES_128_GCM_SHA256 "TLS_AES_128_GCM_SHA256" +# define TLS1_3_RFC_AES_256_GCM_SHA384 "TLS_AES_256_GCM_SHA384" +# define TLS1_3_RFC_CHACHA20_POLY1305_SHA256 "TLS_CHACHA20_POLY1305_SHA256" +# define TLS1_3_RFC_AES_128_CCM_SHA256 "TLS_AES_128_CCM_SHA256" +# define TLS1_3_RFC_AES_128_CCM_8_SHA256 "TLS_AES_128_CCM_8_SHA256" +# define TLS1_RFC_ECDHE_ECDSA_WITH_NULL_SHA "TLS_ECDHE_ECDSA_WITH_NULL_SHA" +# define TLS1_RFC_ECDHE_ECDSA_WITH_DES_192_CBC3_SHA "TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA" +# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_128_CBC_SHA "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA" +# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_256_CBC_SHA "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA" +# define TLS1_RFC_ECDHE_RSA_WITH_NULL_SHA "TLS_ECDHE_RSA_WITH_NULL_SHA" +# define TLS1_RFC_ECDHE_RSA_WITH_DES_192_CBC3_SHA "TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA" +# define TLS1_RFC_ECDHE_RSA_WITH_AES_128_CBC_SHA "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA" +# define TLS1_RFC_ECDHE_RSA_WITH_AES_256_CBC_SHA "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA" +# define TLS1_RFC_ECDH_anon_WITH_NULL_SHA "TLS_ECDH_anon_WITH_NULL_SHA" +# define TLS1_RFC_ECDH_anon_WITH_DES_192_CBC3_SHA "TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA" +# define TLS1_RFC_ECDH_anon_WITH_AES_128_CBC_SHA "TLS_ECDH_anon_WITH_AES_128_CBC_SHA" +# define TLS1_RFC_ECDH_anon_WITH_AES_256_CBC_SHA "TLS_ECDH_anon_WITH_AES_256_CBC_SHA" +# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_128_SHA256 "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256" +# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_256_SHA384 "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384" +# define TLS1_RFC_ECDHE_RSA_WITH_AES_128_SHA256 "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256" +# define TLS1_RFC_ECDHE_RSA_WITH_AES_256_SHA384 "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384" +# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256" +# define TLS1_RFC_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384" +# define TLS1_RFC_ECDHE_RSA_WITH_AES_128_GCM_SHA256 "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256" +# define TLS1_RFC_ECDHE_RSA_WITH_AES_256_GCM_SHA384 "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384" +# define TLS1_RFC_PSK_WITH_NULL_SHA "TLS_PSK_WITH_NULL_SHA" +# define TLS1_RFC_DHE_PSK_WITH_NULL_SHA "TLS_DHE_PSK_WITH_NULL_SHA" +# define TLS1_RFC_RSA_PSK_WITH_NULL_SHA "TLS_RSA_PSK_WITH_NULL_SHA" +# define TLS1_RFC_PSK_WITH_3DES_EDE_CBC_SHA "TLS_PSK_WITH_3DES_EDE_CBC_SHA" +# define TLS1_RFC_PSK_WITH_AES_128_CBC_SHA "TLS_PSK_WITH_AES_128_CBC_SHA" +# define TLS1_RFC_PSK_WITH_AES_256_CBC_SHA "TLS_PSK_WITH_AES_256_CBC_SHA" +# define TLS1_RFC_DHE_PSK_WITH_3DES_EDE_CBC_SHA "TLS_DHE_PSK_WITH_3DES_EDE_CBC_SHA" +# define TLS1_RFC_DHE_PSK_WITH_AES_128_CBC_SHA "TLS_DHE_PSK_WITH_AES_128_CBC_SHA" +# define TLS1_RFC_DHE_PSK_WITH_AES_256_CBC_SHA "TLS_DHE_PSK_WITH_AES_256_CBC_SHA" +# define TLS1_RFC_RSA_PSK_WITH_3DES_EDE_CBC_SHA "TLS_RSA_PSK_WITH_3DES_EDE_CBC_SHA" +# define TLS1_RFC_RSA_PSK_WITH_AES_128_CBC_SHA "TLS_RSA_PSK_WITH_AES_128_CBC_SHA" +# define TLS1_RFC_RSA_PSK_WITH_AES_256_CBC_SHA "TLS_RSA_PSK_WITH_AES_256_CBC_SHA" +# define TLS1_RFC_PSK_WITH_AES_128_GCM_SHA256 "TLS_PSK_WITH_AES_128_GCM_SHA256" +# define TLS1_RFC_PSK_WITH_AES_256_GCM_SHA384 "TLS_PSK_WITH_AES_256_GCM_SHA384" +# define TLS1_RFC_DHE_PSK_WITH_AES_128_GCM_SHA256 "TLS_DHE_PSK_WITH_AES_128_GCM_SHA256" +# define TLS1_RFC_DHE_PSK_WITH_AES_256_GCM_SHA384 "TLS_DHE_PSK_WITH_AES_256_GCM_SHA384" +# define TLS1_RFC_RSA_PSK_WITH_AES_128_GCM_SHA256 "TLS_RSA_PSK_WITH_AES_128_GCM_SHA256" +# define TLS1_RFC_RSA_PSK_WITH_AES_256_GCM_SHA384 "TLS_RSA_PSK_WITH_AES_256_GCM_SHA384" +# define TLS1_RFC_PSK_WITH_AES_128_CBC_SHA256 "TLS_PSK_WITH_AES_128_CBC_SHA256" +# define TLS1_RFC_PSK_WITH_AES_256_CBC_SHA384 "TLS_PSK_WITH_AES_256_CBC_SHA384" +# define TLS1_RFC_PSK_WITH_NULL_SHA256 "TLS_PSK_WITH_NULL_SHA256" +# define TLS1_RFC_PSK_WITH_NULL_SHA384 "TLS_PSK_WITH_NULL_SHA384" +# define TLS1_RFC_DHE_PSK_WITH_AES_128_CBC_SHA256 "TLS_DHE_PSK_WITH_AES_128_CBC_SHA256" +# define TLS1_RFC_DHE_PSK_WITH_AES_256_CBC_SHA384 "TLS_DHE_PSK_WITH_AES_256_CBC_SHA384" +# define TLS1_RFC_DHE_PSK_WITH_NULL_SHA256 "TLS_DHE_PSK_WITH_NULL_SHA256" +# define TLS1_RFC_DHE_PSK_WITH_NULL_SHA384 "TLS_DHE_PSK_WITH_NULL_SHA384" +# define TLS1_RFC_RSA_PSK_WITH_AES_128_CBC_SHA256 "TLS_RSA_PSK_WITH_AES_128_CBC_SHA256" +# define TLS1_RFC_RSA_PSK_WITH_AES_256_CBC_SHA384 "TLS_RSA_PSK_WITH_AES_256_CBC_SHA384" +# define TLS1_RFC_RSA_PSK_WITH_NULL_SHA256 "TLS_RSA_PSK_WITH_NULL_SHA256" +# define TLS1_RFC_RSA_PSK_WITH_NULL_SHA384 "TLS_RSA_PSK_WITH_NULL_SHA384" +# define TLS1_RFC_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA "TLS_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA" +# define TLS1_RFC_ECDHE_PSK_WITH_AES_128_CBC_SHA "TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA" +# define TLS1_RFC_ECDHE_PSK_WITH_AES_256_CBC_SHA "TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA" +# define TLS1_RFC_ECDHE_PSK_WITH_AES_128_CBC_SHA256 "TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256" +# define TLS1_RFC_ECDHE_PSK_WITH_AES_256_CBC_SHA384 "TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA384" +# define TLS1_RFC_ECDHE_PSK_WITH_NULL_SHA "TLS_ECDHE_PSK_WITH_NULL_SHA" +# define TLS1_RFC_ECDHE_PSK_WITH_NULL_SHA256 "TLS_ECDHE_PSK_WITH_NULL_SHA256" +# define TLS1_RFC_ECDHE_PSK_WITH_NULL_SHA384 "TLS_ECDHE_PSK_WITH_NULL_SHA384" +# define TLS1_RFC_SRP_SHA_WITH_3DES_EDE_CBC_SHA "TLS_SRP_SHA_WITH_3DES_EDE_CBC_SHA" +# define TLS1_RFC_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA "TLS_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA" +# define TLS1_RFC_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA "TLS_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA" +# define TLS1_RFC_SRP_SHA_WITH_AES_128_CBC_SHA "TLS_SRP_SHA_WITH_AES_128_CBC_SHA" +# define TLS1_RFC_SRP_SHA_RSA_WITH_AES_128_CBC_SHA "TLS_SRP_SHA_RSA_WITH_AES_128_CBC_SHA" +# define TLS1_RFC_SRP_SHA_DSS_WITH_AES_128_CBC_SHA "TLS_SRP_SHA_DSS_WITH_AES_128_CBC_SHA" +# define TLS1_RFC_SRP_SHA_WITH_AES_256_CBC_SHA "TLS_SRP_SHA_WITH_AES_256_CBC_SHA" +# define TLS1_RFC_SRP_SHA_RSA_WITH_AES_256_CBC_SHA "TLS_SRP_SHA_RSA_WITH_AES_256_CBC_SHA" +# define TLS1_RFC_SRP_SHA_DSS_WITH_AES_256_CBC_SHA "TLS_SRP_SHA_DSS_WITH_AES_256_CBC_SHA" +# define TLS1_RFC_DHE_RSA_WITH_CHACHA20_POLY1305 "TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256" +# define TLS1_RFC_ECDHE_RSA_WITH_CHACHA20_POLY1305 "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256" +# define TLS1_RFC_ECDHE_ECDSA_WITH_CHACHA20_POLY1305 "TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256" +# define TLS1_RFC_PSK_WITH_CHACHA20_POLY1305 "TLS_PSK_WITH_CHACHA20_POLY1305_SHA256" +# define TLS1_RFC_ECDHE_PSK_WITH_CHACHA20_POLY1305 "TLS_ECDHE_PSK_WITH_CHACHA20_POLY1305_SHA256" +# define TLS1_RFC_DHE_PSK_WITH_CHACHA20_POLY1305 "TLS_DHE_PSK_WITH_CHACHA20_POLY1305_SHA256" +# define TLS1_RFC_RSA_PSK_WITH_CHACHA20_POLY1305 "TLS_RSA_PSK_WITH_CHACHA20_POLY1305_SHA256" +# define TLS1_RFC_RSA_WITH_CAMELLIA_128_CBC_SHA256 "TLS_RSA_WITH_CAMELLIA_128_CBC_SHA256" +# define TLS1_RFC_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA256 "TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA256" +# define TLS1_RFC_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 "TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256" +# define TLS1_RFC_ADH_WITH_CAMELLIA_128_CBC_SHA256 "TLS_DH_anon_WITH_CAMELLIA_128_CBC_SHA256" +# define TLS1_RFC_RSA_WITH_CAMELLIA_256_CBC_SHA256 "TLS_RSA_WITH_CAMELLIA_256_CBC_SHA256" +# define TLS1_RFC_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA256 "TLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA256" +# define TLS1_RFC_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256 "TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256" +# define TLS1_RFC_ADH_WITH_CAMELLIA_256_CBC_SHA256 "TLS_DH_anon_WITH_CAMELLIA_256_CBC_SHA256" +# define TLS1_RFC_RSA_WITH_CAMELLIA_256_CBC_SHA "TLS_RSA_WITH_CAMELLIA_256_CBC_SHA" +# define TLS1_RFC_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA "TLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA" +# define TLS1_RFC_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA "TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA" +# define TLS1_RFC_ADH_WITH_CAMELLIA_256_CBC_SHA "TLS_DH_anon_WITH_CAMELLIA_256_CBC_SHA" +# define TLS1_RFC_RSA_WITH_CAMELLIA_128_CBC_SHA "TLS_RSA_WITH_CAMELLIA_128_CBC_SHA" +# define TLS1_RFC_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA "TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA" +# define TLS1_RFC_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA "TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA" +# define TLS1_RFC_ADH_WITH_CAMELLIA_128_CBC_SHA "TLS_DH_anon_WITH_CAMELLIA_128_CBC_SHA" +# define TLS1_RFC_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 "TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256" +# define TLS1_RFC_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 "TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384" +# define TLS1_RFC_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 "TLS_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256" +# define TLS1_RFC_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384 "TLS_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384" +# define TLS1_RFC_PSK_WITH_CAMELLIA_128_CBC_SHA256 "TLS_PSK_WITH_CAMELLIA_128_CBC_SHA256" +# define TLS1_RFC_PSK_WITH_CAMELLIA_256_CBC_SHA384 "TLS_PSK_WITH_CAMELLIA_256_CBC_SHA384" +# define TLS1_RFC_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 "TLS_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256" +# define TLS1_RFC_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 "TLS_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384" +# define TLS1_RFC_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256 "TLS_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256" +# define TLS1_RFC_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384 "TLS_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384" +# define TLS1_RFC_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 "TLS_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256" +# define TLS1_RFC_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 "TLS_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384" +# define TLS1_RFC_RSA_WITH_SEED_SHA "TLS_RSA_WITH_SEED_CBC_SHA" +# define TLS1_RFC_DHE_DSS_WITH_SEED_SHA "TLS_DHE_DSS_WITH_SEED_CBC_SHA" +# define TLS1_RFC_DHE_RSA_WITH_SEED_SHA "TLS_DHE_RSA_WITH_SEED_CBC_SHA" +# define TLS1_RFC_ADH_WITH_SEED_SHA "TLS_DH_anon_WITH_SEED_CBC_SHA" +# define TLS1_RFC_ECDHE_PSK_WITH_RC4_128_SHA "TLS_ECDHE_PSK_WITH_RC4_128_SHA" +# define TLS1_RFC_ECDH_anon_WITH_RC4_128_SHA "TLS_ECDH_anon_WITH_RC4_128_SHA" +# define TLS1_RFC_ECDHE_ECDSA_WITH_RC4_128_SHA "TLS_ECDHE_ECDSA_WITH_RC4_128_SHA" +# define TLS1_RFC_ECDHE_RSA_WITH_RC4_128_SHA "TLS_ECDHE_RSA_WITH_RC4_128_SHA" +# define TLS1_RFC_PSK_WITH_RC4_128_SHA "TLS_PSK_WITH_RC4_128_SHA" +# define TLS1_RFC_RSA_PSK_WITH_RC4_128_SHA "TLS_RSA_PSK_WITH_RC4_128_SHA" +# define TLS1_RFC_DHE_PSK_WITH_RC4_128_SHA "TLS_DHE_PSK_WITH_RC4_128_SHA" +# define TLS1_RFC_RSA_WITH_ARIA_128_GCM_SHA256 "TLS_RSA_WITH_ARIA_128_GCM_SHA256" +# define TLS1_RFC_RSA_WITH_ARIA_256_GCM_SHA384 "TLS_RSA_WITH_ARIA_256_GCM_SHA384" +# define TLS1_RFC_DHE_RSA_WITH_ARIA_128_GCM_SHA256 "TLS_DHE_RSA_WITH_ARIA_128_GCM_SHA256" +# define TLS1_RFC_DHE_RSA_WITH_ARIA_256_GCM_SHA384 "TLS_DHE_RSA_WITH_ARIA_256_GCM_SHA384" +# define TLS1_RFC_DH_RSA_WITH_ARIA_128_GCM_SHA256 "TLS_DH_RSA_WITH_ARIA_128_GCM_SHA256" +# define TLS1_RFC_DH_RSA_WITH_ARIA_256_GCM_SHA384 "TLS_DH_RSA_WITH_ARIA_256_GCM_SHA384" +# define TLS1_RFC_DHE_DSS_WITH_ARIA_128_GCM_SHA256 "TLS_DHE_DSS_WITH_ARIA_128_GCM_SHA256" +# define TLS1_RFC_DHE_DSS_WITH_ARIA_256_GCM_SHA384 "TLS_DHE_DSS_WITH_ARIA_256_GCM_SHA384" +# define TLS1_RFC_DH_DSS_WITH_ARIA_128_GCM_SHA256 "TLS_DH_DSS_WITH_ARIA_128_GCM_SHA256" +# define TLS1_RFC_DH_DSS_WITH_ARIA_256_GCM_SHA384 "TLS_DH_DSS_WITH_ARIA_256_GCM_SHA384" +# define TLS1_RFC_DH_anon_WITH_ARIA_128_GCM_SHA256 "TLS_DH_anon_WITH_ARIA_128_GCM_SHA256" +# define TLS1_RFC_DH_anon_WITH_ARIA_256_GCM_SHA384 "TLS_DH_anon_WITH_ARIA_256_GCM_SHA384" +# define TLS1_RFC_ECDHE_ECDSA_WITH_ARIA_128_GCM_SHA256 "TLS_ECDHE_ECDSA_WITH_ARIA_128_GCM_SHA256" +# define TLS1_RFC_ECDHE_ECDSA_WITH_ARIA_256_GCM_SHA384 "TLS_ECDHE_ECDSA_WITH_ARIA_256_GCM_SHA384" +# define TLS1_RFC_ECDH_ECDSA_WITH_ARIA_128_GCM_SHA256 "TLS_ECDH_ECDSA_WITH_ARIA_128_GCM_SHA256" +# define TLS1_RFC_ECDH_ECDSA_WITH_ARIA_256_GCM_SHA384 "TLS_ECDH_ECDSA_WITH_ARIA_256_GCM_SHA384" +# define TLS1_RFC_ECDHE_RSA_WITH_ARIA_128_GCM_SHA256 "TLS_ECDHE_RSA_WITH_ARIA_128_GCM_SHA256" +# define TLS1_RFC_ECDHE_RSA_WITH_ARIA_256_GCM_SHA384 "TLS_ECDHE_RSA_WITH_ARIA_256_GCM_SHA384" +# define TLS1_RFC_ECDH_RSA_WITH_ARIA_128_GCM_SHA256 "TLS_ECDH_RSA_WITH_ARIA_128_GCM_SHA256" +# define TLS1_RFC_ECDH_RSA_WITH_ARIA_256_GCM_SHA384 "TLS_ECDH_RSA_WITH_ARIA_256_GCM_SHA384" +# define TLS1_RFC_PSK_WITH_ARIA_128_GCM_SHA256 "TLS_PSK_WITH_ARIA_128_GCM_SHA256" +# define TLS1_RFC_PSK_WITH_ARIA_256_GCM_SHA384 "TLS_PSK_WITH_ARIA_256_GCM_SHA384" +# define TLS1_RFC_DHE_PSK_WITH_ARIA_128_GCM_SHA256 "TLS_DHE_PSK_WITH_ARIA_128_GCM_SHA256" +# define TLS1_RFC_DHE_PSK_WITH_ARIA_256_GCM_SHA384 "TLS_DHE_PSK_WITH_ARIA_256_GCM_SHA384" +# define TLS1_RFC_RSA_PSK_WITH_ARIA_128_GCM_SHA256 "TLS_RSA_PSK_WITH_ARIA_128_GCM_SHA256" +# define TLS1_RFC_RSA_PSK_WITH_ARIA_256_GCM_SHA384 "TLS_RSA_PSK_WITH_ARIA_256_GCM_SHA384" + + +/* + * XXX Backward compatibility alert: Older versions of OpenSSL gave some DHE + * ciphers names with "EDH" instead of "DHE". Going forward, we should be + * using DHE everywhere, though we may indefinitely maintain aliases for + * users or configurations that used "EDH" + */ +# define TLS1_TXT_DHE_DSS_WITH_RC4_128_SHA "DHE-DSS-RC4-SHA" + +# define TLS1_TXT_PSK_WITH_NULL_SHA "PSK-NULL-SHA" +# define TLS1_TXT_DHE_PSK_WITH_NULL_SHA "DHE-PSK-NULL-SHA" +# define TLS1_TXT_RSA_PSK_WITH_NULL_SHA "RSA-PSK-NULL-SHA" + +/* AES ciphersuites from RFC3268 */ +# define TLS1_TXT_RSA_WITH_AES_128_SHA "AES128-SHA" +# define TLS1_TXT_DH_DSS_WITH_AES_128_SHA "DH-DSS-AES128-SHA" +# define TLS1_TXT_DH_RSA_WITH_AES_128_SHA "DH-RSA-AES128-SHA" +# define TLS1_TXT_DHE_DSS_WITH_AES_128_SHA "DHE-DSS-AES128-SHA" +# define TLS1_TXT_DHE_RSA_WITH_AES_128_SHA "DHE-RSA-AES128-SHA" +# define TLS1_TXT_ADH_WITH_AES_128_SHA "ADH-AES128-SHA" + +# define TLS1_TXT_RSA_WITH_AES_256_SHA "AES256-SHA" +# define TLS1_TXT_DH_DSS_WITH_AES_256_SHA "DH-DSS-AES256-SHA" +# define TLS1_TXT_DH_RSA_WITH_AES_256_SHA "DH-RSA-AES256-SHA" +# define TLS1_TXT_DHE_DSS_WITH_AES_256_SHA "DHE-DSS-AES256-SHA" +# define TLS1_TXT_DHE_RSA_WITH_AES_256_SHA "DHE-RSA-AES256-SHA" +# define TLS1_TXT_ADH_WITH_AES_256_SHA "ADH-AES256-SHA" + +/* ECC ciphersuites from RFC4492 */ +# define TLS1_TXT_ECDH_ECDSA_WITH_NULL_SHA "ECDH-ECDSA-NULL-SHA" +# define TLS1_TXT_ECDH_ECDSA_WITH_RC4_128_SHA "ECDH-ECDSA-RC4-SHA" +# define TLS1_TXT_ECDH_ECDSA_WITH_DES_192_CBC3_SHA "ECDH-ECDSA-DES-CBC3-SHA" +# define TLS1_TXT_ECDH_ECDSA_WITH_AES_128_CBC_SHA "ECDH-ECDSA-AES128-SHA" +# define TLS1_TXT_ECDH_ECDSA_WITH_AES_256_CBC_SHA "ECDH-ECDSA-AES256-SHA" + +# define TLS1_TXT_ECDHE_ECDSA_WITH_NULL_SHA "ECDHE-ECDSA-NULL-SHA" +# define TLS1_TXT_ECDHE_ECDSA_WITH_RC4_128_SHA "ECDHE-ECDSA-RC4-SHA" +# define TLS1_TXT_ECDHE_ECDSA_WITH_DES_192_CBC3_SHA "ECDHE-ECDSA-DES-CBC3-SHA" +# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_CBC_SHA "ECDHE-ECDSA-AES128-SHA" +# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_CBC_SHA "ECDHE-ECDSA-AES256-SHA" + +# define TLS1_TXT_ECDH_RSA_WITH_NULL_SHA "ECDH-RSA-NULL-SHA" +# define TLS1_TXT_ECDH_RSA_WITH_RC4_128_SHA "ECDH-RSA-RC4-SHA" +# define TLS1_TXT_ECDH_RSA_WITH_DES_192_CBC3_SHA "ECDH-RSA-DES-CBC3-SHA" +# define TLS1_TXT_ECDH_RSA_WITH_AES_128_CBC_SHA "ECDH-RSA-AES128-SHA" +# define TLS1_TXT_ECDH_RSA_WITH_AES_256_CBC_SHA "ECDH-RSA-AES256-SHA" + +# define TLS1_TXT_ECDHE_RSA_WITH_NULL_SHA "ECDHE-RSA-NULL-SHA" +# define TLS1_TXT_ECDHE_RSA_WITH_RC4_128_SHA "ECDHE-RSA-RC4-SHA" +# define TLS1_TXT_ECDHE_RSA_WITH_DES_192_CBC3_SHA "ECDHE-RSA-DES-CBC3-SHA" +# define TLS1_TXT_ECDHE_RSA_WITH_AES_128_CBC_SHA "ECDHE-RSA-AES128-SHA" +# define TLS1_TXT_ECDHE_RSA_WITH_AES_256_CBC_SHA "ECDHE-RSA-AES256-SHA" + +# define TLS1_TXT_ECDH_anon_WITH_NULL_SHA "AECDH-NULL-SHA" +# define TLS1_TXT_ECDH_anon_WITH_RC4_128_SHA "AECDH-RC4-SHA" +# define TLS1_TXT_ECDH_anon_WITH_DES_192_CBC3_SHA "AECDH-DES-CBC3-SHA" +# define TLS1_TXT_ECDH_anon_WITH_AES_128_CBC_SHA "AECDH-AES128-SHA" +# define TLS1_TXT_ECDH_anon_WITH_AES_256_CBC_SHA "AECDH-AES256-SHA" + +/* PSK ciphersuites from RFC 4279 */ +# define TLS1_TXT_PSK_WITH_RC4_128_SHA "PSK-RC4-SHA" +# define TLS1_TXT_PSK_WITH_3DES_EDE_CBC_SHA "PSK-3DES-EDE-CBC-SHA" +# define TLS1_TXT_PSK_WITH_AES_128_CBC_SHA "PSK-AES128-CBC-SHA" +# define TLS1_TXT_PSK_WITH_AES_256_CBC_SHA "PSK-AES256-CBC-SHA" + +# define TLS1_TXT_DHE_PSK_WITH_RC4_128_SHA "DHE-PSK-RC4-SHA" +# define TLS1_TXT_DHE_PSK_WITH_3DES_EDE_CBC_SHA "DHE-PSK-3DES-EDE-CBC-SHA" +# define TLS1_TXT_DHE_PSK_WITH_AES_128_CBC_SHA "DHE-PSK-AES128-CBC-SHA" +# define TLS1_TXT_DHE_PSK_WITH_AES_256_CBC_SHA "DHE-PSK-AES256-CBC-SHA" +# define TLS1_TXT_RSA_PSK_WITH_RC4_128_SHA "RSA-PSK-RC4-SHA" +# define TLS1_TXT_RSA_PSK_WITH_3DES_EDE_CBC_SHA "RSA-PSK-3DES-EDE-CBC-SHA" +# define TLS1_TXT_RSA_PSK_WITH_AES_128_CBC_SHA "RSA-PSK-AES128-CBC-SHA" +# define TLS1_TXT_RSA_PSK_WITH_AES_256_CBC_SHA "RSA-PSK-AES256-CBC-SHA" + +/* PSK ciphersuites from RFC 5487 */ +# define TLS1_TXT_PSK_WITH_AES_128_GCM_SHA256 "PSK-AES128-GCM-SHA256" +# define TLS1_TXT_PSK_WITH_AES_256_GCM_SHA384 "PSK-AES256-GCM-SHA384" +# define TLS1_TXT_DHE_PSK_WITH_AES_128_GCM_SHA256 "DHE-PSK-AES128-GCM-SHA256" +# define TLS1_TXT_DHE_PSK_WITH_AES_256_GCM_SHA384 "DHE-PSK-AES256-GCM-SHA384" +# define TLS1_TXT_RSA_PSK_WITH_AES_128_GCM_SHA256 "RSA-PSK-AES128-GCM-SHA256" +# define TLS1_TXT_RSA_PSK_WITH_AES_256_GCM_SHA384 "RSA-PSK-AES256-GCM-SHA384" + +# define TLS1_TXT_PSK_WITH_AES_128_CBC_SHA256 "PSK-AES128-CBC-SHA256" +# define TLS1_TXT_PSK_WITH_AES_256_CBC_SHA384 "PSK-AES256-CBC-SHA384" +# define TLS1_TXT_PSK_WITH_NULL_SHA256 "PSK-NULL-SHA256" +# define TLS1_TXT_PSK_WITH_NULL_SHA384 "PSK-NULL-SHA384" + +# define TLS1_TXT_DHE_PSK_WITH_AES_128_CBC_SHA256 "DHE-PSK-AES128-CBC-SHA256" +# define TLS1_TXT_DHE_PSK_WITH_AES_256_CBC_SHA384 "DHE-PSK-AES256-CBC-SHA384" +# define TLS1_TXT_DHE_PSK_WITH_NULL_SHA256 "DHE-PSK-NULL-SHA256" +# define TLS1_TXT_DHE_PSK_WITH_NULL_SHA384 "DHE-PSK-NULL-SHA384" + +# define TLS1_TXT_RSA_PSK_WITH_AES_128_CBC_SHA256 "RSA-PSK-AES128-CBC-SHA256" +# define TLS1_TXT_RSA_PSK_WITH_AES_256_CBC_SHA384 "RSA-PSK-AES256-CBC-SHA384" +# define TLS1_TXT_RSA_PSK_WITH_NULL_SHA256 "RSA-PSK-NULL-SHA256" +# define TLS1_TXT_RSA_PSK_WITH_NULL_SHA384 "RSA-PSK-NULL-SHA384" + +/* SRP ciphersuite from RFC 5054 */ +# define TLS1_TXT_SRP_SHA_WITH_3DES_EDE_CBC_SHA "SRP-3DES-EDE-CBC-SHA" +# define TLS1_TXT_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA "SRP-RSA-3DES-EDE-CBC-SHA" +# define TLS1_TXT_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA "SRP-DSS-3DES-EDE-CBC-SHA" +# define TLS1_TXT_SRP_SHA_WITH_AES_128_CBC_SHA "SRP-AES-128-CBC-SHA" +# define TLS1_TXT_SRP_SHA_RSA_WITH_AES_128_CBC_SHA "SRP-RSA-AES-128-CBC-SHA" +# define TLS1_TXT_SRP_SHA_DSS_WITH_AES_128_CBC_SHA "SRP-DSS-AES-128-CBC-SHA" +# define TLS1_TXT_SRP_SHA_WITH_AES_256_CBC_SHA "SRP-AES-256-CBC-SHA" +# define TLS1_TXT_SRP_SHA_RSA_WITH_AES_256_CBC_SHA "SRP-RSA-AES-256-CBC-SHA" +# define TLS1_TXT_SRP_SHA_DSS_WITH_AES_256_CBC_SHA "SRP-DSS-AES-256-CBC-SHA" + +/* Camellia ciphersuites from RFC4132 */ +# define TLS1_TXT_RSA_WITH_CAMELLIA_128_CBC_SHA "CAMELLIA128-SHA" +# define TLS1_TXT_DH_DSS_WITH_CAMELLIA_128_CBC_SHA "DH-DSS-CAMELLIA128-SHA" +# define TLS1_TXT_DH_RSA_WITH_CAMELLIA_128_CBC_SHA "DH-RSA-CAMELLIA128-SHA" +# define TLS1_TXT_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA "DHE-DSS-CAMELLIA128-SHA" +# define TLS1_TXT_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA "DHE-RSA-CAMELLIA128-SHA" +# define TLS1_TXT_ADH_WITH_CAMELLIA_128_CBC_SHA "ADH-CAMELLIA128-SHA" + +# define TLS1_TXT_RSA_WITH_CAMELLIA_256_CBC_SHA "CAMELLIA256-SHA" +# define TLS1_TXT_DH_DSS_WITH_CAMELLIA_256_CBC_SHA "DH-DSS-CAMELLIA256-SHA" +# define TLS1_TXT_DH_RSA_WITH_CAMELLIA_256_CBC_SHA "DH-RSA-CAMELLIA256-SHA" +# define TLS1_TXT_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA "DHE-DSS-CAMELLIA256-SHA" +# define TLS1_TXT_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA "DHE-RSA-CAMELLIA256-SHA" +# define TLS1_TXT_ADH_WITH_CAMELLIA_256_CBC_SHA "ADH-CAMELLIA256-SHA" + +/* TLS 1.2 Camellia SHA-256 ciphersuites from RFC5932 */ +# define TLS1_TXT_RSA_WITH_CAMELLIA_128_CBC_SHA256 "CAMELLIA128-SHA256" +# define TLS1_TXT_DH_DSS_WITH_CAMELLIA_128_CBC_SHA256 "DH-DSS-CAMELLIA128-SHA256" +# define TLS1_TXT_DH_RSA_WITH_CAMELLIA_128_CBC_SHA256 "DH-RSA-CAMELLIA128-SHA256" +# define TLS1_TXT_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA256 "DHE-DSS-CAMELLIA128-SHA256" +# define TLS1_TXT_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 "DHE-RSA-CAMELLIA128-SHA256" +# define TLS1_TXT_ADH_WITH_CAMELLIA_128_CBC_SHA256 "ADH-CAMELLIA128-SHA256" + +# define TLS1_TXT_RSA_WITH_CAMELLIA_256_CBC_SHA256 "CAMELLIA256-SHA256" +# define TLS1_TXT_DH_DSS_WITH_CAMELLIA_256_CBC_SHA256 "DH-DSS-CAMELLIA256-SHA256" +# define TLS1_TXT_DH_RSA_WITH_CAMELLIA_256_CBC_SHA256 "DH-RSA-CAMELLIA256-SHA256" +# define TLS1_TXT_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA256 "DHE-DSS-CAMELLIA256-SHA256" +# define TLS1_TXT_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256 "DHE-RSA-CAMELLIA256-SHA256" +# define TLS1_TXT_ADH_WITH_CAMELLIA_256_CBC_SHA256 "ADH-CAMELLIA256-SHA256" + +# define TLS1_TXT_PSK_WITH_CAMELLIA_128_CBC_SHA256 "PSK-CAMELLIA128-SHA256" +# define TLS1_TXT_PSK_WITH_CAMELLIA_256_CBC_SHA384 "PSK-CAMELLIA256-SHA384" +# define TLS1_TXT_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 "DHE-PSK-CAMELLIA128-SHA256" +# define TLS1_TXT_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 "DHE-PSK-CAMELLIA256-SHA384" +# define TLS1_TXT_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256 "RSA-PSK-CAMELLIA128-SHA256" +# define TLS1_TXT_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384 "RSA-PSK-CAMELLIA256-SHA384" +# define TLS1_TXT_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 "ECDHE-PSK-CAMELLIA128-SHA256" +# define TLS1_TXT_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 "ECDHE-PSK-CAMELLIA256-SHA384" + +/* SEED ciphersuites from RFC4162 */ +# define TLS1_TXT_RSA_WITH_SEED_SHA "SEED-SHA" +# define TLS1_TXT_DH_DSS_WITH_SEED_SHA "DH-DSS-SEED-SHA" +# define TLS1_TXT_DH_RSA_WITH_SEED_SHA "DH-RSA-SEED-SHA" +# define TLS1_TXT_DHE_DSS_WITH_SEED_SHA "DHE-DSS-SEED-SHA" +# define TLS1_TXT_DHE_RSA_WITH_SEED_SHA "DHE-RSA-SEED-SHA" +# define TLS1_TXT_ADH_WITH_SEED_SHA "ADH-SEED-SHA" + +/* TLS v1.2 ciphersuites */ +# define TLS1_TXT_RSA_WITH_NULL_SHA256 "NULL-SHA256" +# define TLS1_TXT_RSA_WITH_AES_128_SHA256 "AES128-SHA256" +# define TLS1_TXT_RSA_WITH_AES_256_SHA256 "AES256-SHA256" +# define TLS1_TXT_DH_DSS_WITH_AES_128_SHA256 "DH-DSS-AES128-SHA256" +# define TLS1_TXT_DH_RSA_WITH_AES_128_SHA256 "DH-RSA-AES128-SHA256" +# define TLS1_TXT_DHE_DSS_WITH_AES_128_SHA256 "DHE-DSS-AES128-SHA256" +# define TLS1_TXT_DHE_RSA_WITH_AES_128_SHA256 "DHE-RSA-AES128-SHA256" +# define TLS1_TXT_DH_DSS_WITH_AES_256_SHA256 "DH-DSS-AES256-SHA256" +# define TLS1_TXT_DH_RSA_WITH_AES_256_SHA256 "DH-RSA-AES256-SHA256" +# define TLS1_TXT_DHE_DSS_WITH_AES_256_SHA256 "DHE-DSS-AES256-SHA256" +# define TLS1_TXT_DHE_RSA_WITH_AES_256_SHA256 "DHE-RSA-AES256-SHA256" +# define TLS1_TXT_ADH_WITH_AES_128_SHA256 "ADH-AES128-SHA256" +# define TLS1_TXT_ADH_WITH_AES_256_SHA256 "ADH-AES256-SHA256" + +/* TLS v1.2 GCM ciphersuites from RFC5288 */ +# define TLS1_TXT_RSA_WITH_AES_128_GCM_SHA256 "AES128-GCM-SHA256" +# define TLS1_TXT_RSA_WITH_AES_256_GCM_SHA384 "AES256-GCM-SHA384" +# define TLS1_TXT_DHE_RSA_WITH_AES_128_GCM_SHA256 "DHE-RSA-AES128-GCM-SHA256" +# define TLS1_TXT_DHE_RSA_WITH_AES_256_GCM_SHA384 "DHE-RSA-AES256-GCM-SHA384" +# define TLS1_TXT_DH_RSA_WITH_AES_128_GCM_SHA256 "DH-RSA-AES128-GCM-SHA256" +# define TLS1_TXT_DH_RSA_WITH_AES_256_GCM_SHA384 "DH-RSA-AES256-GCM-SHA384" +# define TLS1_TXT_DHE_DSS_WITH_AES_128_GCM_SHA256 "DHE-DSS-AES128-GCM-SHA256" +# define TLS1_TXT_DHE_DSS_WITH_AES_256_GCM_SHA384 "DHE-DSS-AES256-GCM-SHA384" +# define TLS1_TXT_DH_DSS_WITH_AES_128_GCM_SHA256 "DH-DSS-AES128-GCM-SHA256" +# define TLS1_TXT_DH_DSS_WITH_AES_256_GCM_SHA384 "DH-DSS-AES256-GCM-SHA384" +# define TLS1_TXT_ADH_WITH_AES_128_GCM_SHA256 "ADH-AES128-GCM-SHA256" +# define TLS1_TXT_ADH_WITH_AES_256_GCM_SHA384 "ADH-AES256-GCM-SHA384" + +/* CCM ciphersuites from RFC6655 */ +# define TLS1_TXT_RSA_WITH_AES_128_CCM "AES128-CCM" +# define TLS1_TXT_RSA_WITH_AES_256_CCM "AES256-CCM" +# define TLS1_TXT_DHE_RSA_WITH_AES_128_CCM "DHE-RSA-AES128-CCM" +# define TLS1_TXT_DHE_RSA_WITH_AES_256_CCM "DHE-RSA-AES256-CCM" + +# define TLS1_TXT_RSA_WITH_AES_128_CCM_8 "AES128-CCM8" +# define TLS1_TXT_RSA_WITH_AES_256_CCM_8 "AES256-CCM8" +# define TLS1_TXT_DHE_RSA_WITH_AES_128_CCM_8 "DHE-RSA-AES128-CCM8" +# define TLS1_TXT_DHE_RSA_WITH_AES_256_CCM_8 "DHE-RSA-AES256-CCM8" + +# define TLS1_TXT_PSK_WITH_AES_128_CCM "PSK-AES128-CCM" +# define TLS1_TXT_PSK_WITH_AES_256_CCM "PSK-AES256-CCM" +# define TLS1_TXT_DHE_PSK_WITH_AES_128_CCM "DHE-PSK-AES128-CCM" +# define TLS1_TXT_DHE_PSK_WITH_AES_256_CCM "DHE-PSK-AES256-CCM" + +# define TLS1_TXT_PSK_WITH_AES_128_CCM_8 "PSK-AES128-CCM8" +# define TLS1_TXT_PSK_WITH_AES_256_CCM_8 "PSK-AES256-CCM8" +# define TLS1_TXT_DHE_PSK_WITH_AES_128_CCM_8 "DHE-PSK-AES128-CCM8" +# define TLS1_TXT_DHE_PSK_WITH_AES_256_CCM_8 "DHE-PSK-AES256-CCM8" + +/* CCM ciphersuites from RFC7251 */ +# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_CCM "ECDHE-ECDSA-AES128-CCM" +# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_CCM "ECDHE-ECDSA-AES256-CCM" +# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_CCM_8 "ECDHE-ECDSA-AES128-CCM8" +# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_CCM_8 "ECDHE-ECDSA-AES256-CCM8" + +/* ECDH HMAC based ciphersuites from RFC5289 */ +# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_SHA256 "ECDHE-ECDSA-AES128-SHA256" +# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_SHA384 "ECDHE-ECDSA-AES256-SHA384" +# define TLS1_TXT_ECDH_ECDSA_WITH_AES_128_SHA256 "ECDH-ECDSA-AES128-SHA256" +# define TLS1_TXT_ECDH_ECDSA_WITH_AES_256_SHA384 "ECDH-ECDSA-AES256-SHA384" +# define TLS1_TXT_ECDHE_RSA_WITH_AES_128_SHA256 "ECDHE-RSA-AES128-SHA256" +# define TLS1_TXT_ECDHE_RSA_WITH_AES_256_SHA384 "ECDHE-RSA-AES256-SHA384" +# define TLS1_TXT_ECDH_RSA_WITH_AES_128_SHA256 "ECDH-RSA-AES128-SHA256" +# define TLS1_TXT_ECDH_RSA_WITH_AES_256_SHA384 "ECDH-RSA-AES256-SHA384" + +/* ECDH GCM based ciphersuites from RFC5289 */ +# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 "ECDHE-ECDSA-AES128-GCM-SHA256" +# define TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 "ECDHE-ECDSA-AES256-GCM-SHA384" +# define TLS1_TXT_ECDH_ECDSA_WITH_AES_128_GCM_SHA256 "ECDH-ECDSA-AES128-GCM-SHA256" +# define TLS1_TXT_ECDH_ECDSA_WITH_AES_256_GCM_SHA384 "ECDH-ECDSA-AES256-GCM-SHA384" +# define TLS1_TXT_ECDHE_RSA_WITH_AES_128_GCM_SHA256 "ECDHE-RSA-AES128-GCM-SHA256" +# define TLS1_TXT_ECDHE_RSA_WITH_AES_256_GCM_SHA384 "ECDHE-RSA-AES256-GCM-SHA384" +# define TLS1_TXT_ECDH_RSA_WITH_AES_128_GCM_SHA256 "ECDH-RSA-AES128-GCM-SHA256" +# define TLS1_TXT_ECDH_RSA_WITH_AES_256_GCM_SHA384 "ECDH-RSA-AES256-GCM-SHA384" + +/* TLS v1.2 PSK GCM ciphersuites from RFC5487 */ +# define TLS1_TXT_PSK_WITH_AES_128_GCM_SHA256 "PSK-AES128-GCM-SHA256" +# define TLS1_TXT_PSK_WITH_AES_256_GCM_SHA384 "PSK-AES256-GCM-SHA384" + +/* ECDHE PSK ciphersuites from RFC 5489 */ +# define TLS1_TXT_ECDHE_PSK_WITH_RC4_128_SHA "ECDHE-PSK-RC4-SHA" +# define TLS1_TXT_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA "ECDHE-PSK-3DES-EDE-CBC-SHA" +# define TLS1_TXT_ECDHE_PSK_WITH_AES_128_CBC_SHA "ECDHE-PSK-AES128-CBC-SHA" +# define TLS1_TXT_ECDHE_PSK_WITH_AES_256_CBC_SHA "ECDHE-PSK-AES256-CBC-SHA" + +# define TLS1_TXT_ECDHE_PSK_WITH_AES_128_CBC_SHA256 "ECDHE-PSK-AES128-CBC-SHA256" +# define TLS1_TXT_ECDHE_PSK_WITH_AES_256_CBC_SHA384 "ECDHE-PSK-AES256-CBC-SHA384" + +# define TLS1_TXT_ECDHE_PSK_WITH_NULL_SHA "ECDHE-PSK-NULL-SHA" +# define TLS1_TXT_ECDHE_PSK_WITH_NULL_SHA256 "ECDHE-PSK-NULL-SHA256" +# define TLS1_TXT_ECDHE_PSK_WITH_NULL_SHA384 "ECDHE-PSK-NULL-SHA384" + +/* Camellia-CBC ciphersuites from RFC6367 */ +# define TLS1_TXT_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 "ECDHE-ECDSA-CAMELLIA128-SHA256" +# define TLS1_TXT_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 "ECDHE-ECDSA-CAMELLIA256-SHA384" +# define TLS1_TXT_ECDH_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 "ECDH-ECDSA-CAMELLIA128-SHA256" +# define TLS1_TXT_ECDH_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 "ECDH-ECDSA-CAMELLIA256-SHA384" +# define TLS1_TXT_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 "ECDHE-RSA-CAMELLIA128-SHA256" +# define TLS1_TXT_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384 "ECDHE-RSA-CAMELLIA256-SHA384" +# define TLS1_TXT_ECDH_RSA_WITH_CAMELLIA_128_CBC_SHA256 "ECDH-RSA-CAMELLIA128-SHA256" +# define TLS1_TXT_ECDH_RSA_WITH_CAMELLIA_256_CBC_SHA384 "ECDH-RSA-CAMELLIA256-SHA384" + +/* draft-ietf-tls-chacha20-poly1305-03 */ +# define TLS1_TXT_ECDHE_RSA_WITH_CHACHA20_POLY1305 "ECDHE-RSA-CHACHA20-POLY1305" +# define TLS1_TXT_ECDHE_ECDSA_WITH_CHACHA20_POLY1305 "ECDHE-ECDSA-CHACHA20-POLY1305" +# define TLS1_TXT_DHE_RSA_WITH_CHACHA20_POLY1305 "DHE-RSA-CHACHA20-POLY1305" +# define TLS1_TXT_PSK_WITH_CHACHA20_POLY1305 "PSK-CHACHA20-POLY1305" +# define TLS1_TXT_ECDHE_PSK_WITH_CHACHA20_POLY1305 "ECDHE-PSK-CHACHA20-POLY1305" +# define TLS1_TXT_DHE_PSK_WITH_CHACHA20_POLY1305 "DHE-PSK-CHACHA20-POLY1305" +# define TLS1_TXT_RSA_PSK_WITH_CHACHA20_POLY1305 "RSA-PSK-CHACHA20-POLY1305" + +/* Aria ciphersuites from RFC6209 */ +# define TLS1_TXT_RSA_WITH_ARIA_128_GCM_SHA256 "ARIA128-GCM-SHA256" +# define TLS1_TXT_RSA_WITH_ARIA_256_GCM_SHA384 "ARIA256-GCM-SHA384" +# define TLS1_TXT_DHE_RSA_WITH_ARIA_128_GCM_SHA256 "DHE-RSA-ARIA128-GCM-SHA256" +# define TLS1_TXT_DHE_RSA_WITH_ARIA_256_GCM_SHA384 "DHE-RSA-ARIA256-GCM-SHA384" +# define TLS1_TXT_DH_RSA_WITH_ARIA_128_GCM_SHA256 "DH-RSA-ARIA128-GCM-SHA256" +# define TLS1_TXT_DH_RSA_WITH_ARIA_256_GCM_SHA384 "DH-RSA-ARIA256-GCM-SHA384" +# define TLS1_TXT_DHE_DSS_WITH_ARIA_128_GCM_SHA256 "DHE-DSS-ARIA128-GCM-SHA256" +# define TLS1_TXT_DHE_DSS_WITH_ARIA_256_GCM_SHA384 "DHE-DSS-ARIA256-GCM-SHA384" +# define TLS1_TXT_DH_DSS_WITH_ARIA_128_GCM_SHA256 "DH-DSS-ARIA128-GCM-SHA256" +# define TLS1_TXT_DH_DSS_WITH_ARIA_256_GCM_SHA384 "DH-DSS-ARIA256-GCM-SHA384" +# define TLS1_TXT_DH_anon_WITH_ARIA_128_GCM_SHA256 "ADH-ARIA128-GCM-SHA256" +# define TLS1_TXT_DH_anon_WITH_ARIA_256_GCM_SHA384 "ADH-ARIA256-GCM-SHA384" +# define TLS1_TXT_ECDHE_ECDSA_WITH_ARIA_128_GCM_SHA256 "ECDHE-ECDSA-ARIA128-GCM-SHA256" +# define TLS1_TXT_ECDHE_ECDSA_WITH_ARIA_256_GCM_SHA384 "ECDHE-ECDSA-ARIA256-GCM-SHA384" +# define TLS1_TXT_ECDH_ECDSA_WITH_ARIA_128_GCM_SHA256 "ECDH-ECDSA-ARIA128-GCM-SHA256" +# define TLS1_TXT_ECDH_ECDSA_WITH_ARIA_256_GCM_SHA384 "ECDH-ECDSA-ARIA256-GCM-SHA384" +# define TLS1_TXT_ECDHE_RSA_WITH_ARIA_128_GCM_SHA256 "ECDHE-ARIA128-GCM-SHA256" +# define TLS1_TXT_ECDHE_RSA_WITH_ARIA_256_GCM_SHA384 "ECDHE-ARIA256-GCM-SHA384" +# define TLS1_TXT_ECDH_RSA_WITH_ARIA_128_GCM_SHA256 "ECDH-ARIA128-GCM-SHA256" +# define TLS1_TXT_ECDH_RSA_WITH_ARIA_256_GCM_SHA384 "ECDH-ARIA256-GCM-SHA384" +# define TLS1_TXT_PSK_WITH_ARIA_128_GCM_SHA256 "PSK-ARIA128-GCM-SHA256" +# define TLS1_TXT_PSK_WITH_ARIA_256_GCM_SHA384 "PSK-ARIA256-GCM-SHA384" +# define TLS1_TXT_DHE_PSK_WITH_ARIA_128_GCM_SHA256 "DHE-PSK-ARIA128-GCM-SHA256" +# define TLS1_TXT_DHE_PSK_WITH_ARIA_256_GCM_SHA384 "DHE-PSK-ARIA256-GCM-SHA384" +# define TLS1_TXT_RSA_PSK_WITH_ARIA_128_GCM_SHA256 "RSA-PSK-ARIA128-GCM-SHA256" +# define TLS1_TXT_RSA_PSK_WITH_ARIA_256_GCM_SHA384 "RSA-PSK-ARIA256-GCM-SHA384" + +# define TLS_CT_RSA_SIGN 1 +# define TLS_CT_DSS_SIGN 2 +# define TLS_CT_RSA_FIXED_DH 3 +# define TLS_CT_DSS_FIXED_DH 4 +# define TLS_CT_ECDSA_SIGN 64 +# define TLS_CT_RSA_FIXED_ECDH 65 +# define TLS_CT_ECDSA_FIXED_ECDH 66 +# define TLS_CT_GOST01_SIGN 22 +# define TLS_CT_GOST12_SIGN 238 +# define TLS_CT_GOST12_512_SIGN 239 + +/* + * when correcting this number, correct also SSL3_CT_NUMBER in ssl3.h (see + * comment there) + */ +# define TLS_CT_NUMBER 10 + +# if defined(SSL3_CT_NUMBER) +# if TLS_CT_NUMBER != SSL3_CT_NUMBER +# error "SSL/TLS CT_NUMBER values do not match" +# endif +# endif + +# define TLS1_FINISH_MAC_LENGTH 12 + +# define TLS_MD_MAX_CONST_SIZE 22 +# define TLS_MD_CLIENT_FINISH_CONST "client finished" +# define TLS_MD_CLIENT_FINISH_CONST_SIZE 15 +# define TLS_MD_SERVER_FINISH_CONST "server finished" +# define TLS_MD_SERVER_FINISH_CONST_SIZE 15 +# define TLS_MD_KEY_EXPANSION_CONST "key expansion" +# define TLS_MD_KEY_EXPANSION_CONST_SIZE 13 +# define TLS_MD_CLIENT_WRITE_KEY_CONST "client write key" +# define TLS_MD_CLIENT_WRITE_KEY_CONST_SIZE 16 +# define TLS_MD_SERVER_WRITE_KEY_CONST "server write key" +# define TLS_MD_SERVER_WRITE_KEY_CONST_SIZE 16 +# define TLS_MD_IV_BLOCK_CONST "IV block" +# define TLS_MD_IV_BLOCK_CONST_SIZE 8 +# define TLS_MD_MASTER_SECRET_CONST "master secret" +# define TLS_MD_MASTER_SECRET_CONST_SIZE 13 +# define TLS_MD_EXTENDED_MASTER_SECRET_CONST "extended master secret" +# define TLS_MD_EXTENDED_MASTER_SECRET_CONST_SIZE 22 + +# ifdef CHARSET_EBCDIC +# undef TLS_MD_CLIENT_FINISH_CONST +/* + * client finished + */ +# define TLS_MD_CLIENT_FINISH_CONST "\x63\x6c\x69\x65\x6e\x74\x20\x66\x69\x6e\x69\x73\x68\x65\x64" + +# undef TLS_MD_SERVER_FINISH_CONST +/* + * server finished + */ +# define TLS_MD_SERVER_FINISH_CONST "\x73\x65\x72\x76\x65\x72\x20\x66\x69\x6e\x69\x73\x68\x65\x64" + +# undef TLS_MD_SERVER_WRITE_KEY_CONST +/* + * server write key + */ +# define TLS_MD_SERVER_WRITE_KEY_CONST "\x73\x65\x72\x76\x65\x72\x20\x77\x72\x69\x74\x65\x20\x6b\x65\x79" + +# undef TLS_MD_KEY_EXPANSION_CONST +/* + * key expansion + */ +# define TLS_MD_KEY_EXPANSION_CONST "\x6b\x65\x79\x20\x65\x78\x70\x61\x6e\x73\x69\x6f\x6e" + +# undef TLS_MD_CLIENT_WRITE_KEY_CONST +/* + * client write key + */ +# define TLS_MD_CLIENT_WRITE_KEY_CONST "\x63\x6c\x69\x65\x6e\x74\x20\x77\x72\x69\x74\x65\x20\x6b\x65\x79" + +# undef TLS_MD_SERVER_WRITE_KEY_CONST +/* + * server write key + */ +# define TLS_MD_SERVER_WRITE_KEY_CONST "\x73\x65\x72\x76\x65\x72\x20\x77\x72\x69\x74\x65\x20\x6b\x65\x79" + +# undef TLS_MD_IV_BLOCK_CONST +/* + * IV block + */ +# define TLS_MD_IV_BLOCK_CONST "\x49\x56\x20\x62\x6c\x6f\x63\x6b" + +# undef TLS_MD_MASTER_SECRET_CONST +/* + * master secret + */ +# define TLS_MD_MASTER_SECRET_CONST "\x6d\x61\x73\x74\x65\x72\x20\x73\x65\x63\x72\x65\x74" +# undef TLS_MD_EXTENDED_MASTER_SECRET_CONST +/* + * extended master secret + */ +# define TLS_MD_EXTENDED_MASTER_SECRET_CONST "\x65\x78\x74\x65\x6e\x64\x65\x64\x20\x6d\x61\x73\x74\x65\x72\x20\x73\x65\x63\x72\x65\x74" +# endif + +/* TLS Session Ticket extension struct */ +struct tls_session_ticket_ext_st { + unsigned short length; + void *data; +}; + +#ifdef __cplusplus +} +#endif +#endif diff --git a/ONVIF/include/openssl/include/openssl/ts.h b/ONVIF/include/openssl/include/openssl/ts.h new file mode 100644 index 0000000..3b58aa5 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/ts.h @@ -0,0 +1,559 @@ +/* + * Copyright 2006-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_TS_H +# define HEADER_TS_H + +# include + +# ifndef OPENSSL_NO_TS +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# ifdef __cplusplus +extern "C" { +# endif + +# include +# include + +typedef struct TS_msg_imprint_st TS_MSG_IMPRINT; +typedef struct TS_req_st TS_REQ; +typedef struct TS_accuracy_st TS_ACCURACY; +typedef struct TS_tst_info_st TS_TST_INFO; + +/* Possible values for status. */ +# define TS_STATUS_GRANTED 0 +# define TS_STATUS_GRANTED_WITH_MODS 1 +# define TS_STATUS_REJECTION 2 +# define TS_STATUS_WAITING 3 +# define TS_STATUS_REVOCATION_WARNING 4 +# define TS_STATUS_REVOCATION_NOTIFICATION 5 + +/* Possible values for failure_info. */ +# define TS_INFO_BAD_ALG 0 +# define TS_INFO_BAD_REQUEST 2 +# define TS_INFO_BAD_DATA_FORMAT 5 +# define TS_INFO_TIME_NOT_AVAILABLE 14 +# define TS_INFO_UNACCEPTED_POLICY 15 +# define TS_INFO_UNACCEPTED_EXTENSION 16 +# define TS_INFO_ADD_INFO_NOT_AVAILABLE 17 +# define TS_INFO_SYSTEM_FAILURE 25 + + +typedef struct TS_status_info_st TS_STATUS_INFO; +typedef struct ESS_issuer_serial ESS_ISSUER_SERIAL; +typedef struct ESS_cert_id ESS_CERT_ID; +typedef struct ESS_signing_cert ESS_SIGNING_CERT; + +DEFINE_STACK_OF(ESS_CERT_ID) + +typedef struct ESS_cert_id_v2_st ESS_CERT_ID_V2; +typedef struct ESS_signing_cert_v2_st ESS_SIGNING_CERT_V2; + +DEFINE_STACK_OF(ESS_CERT_ID_V2) + +typedef struct TS_resp_st TS_RESP; + +TS_REQ *TS_REQ_new(void); +void TS_REQ_free(TS_REQ *a); +int i2d_TS_REQ(const TS_REQ *a, unsigned char **pp); +TS_REQ *d2i_TS_REQ(TS_REQ **a, const unsigned char **pp, long length); + +TS_REQ *TS_REQ_dup(TS_REQ *a); + +#ifndef OPENSSL_NO_STDIO +TS_REQ *d2i_TS_REQ_fp(FILE *fp, TS_REQ **a); +int i2d_TS_REQ_fp(FILE *fp, TS_REQ *a); +#endif +TS_REQ *d2i_TS_REQ_bio(BIO *fp, TS_REQ **a); +int i2d_TS_REQ_bio(BIO *fp, TS_REQ *a); + +TS_MSG_IMPRINT *TS_MSG_IMPRINT_new(void); +void TS_MSG_IMPRINT_free(TS_MSG_IMPRINT *a); +int i2d_TS_MSG_IMPRINT(const TS_MSG_IMPRINT *a, unsigned char **pp); +TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT(TS_MSG_IMPRINT **a, + const unsigned char **pp, long length); + +TS_MSG_IMPRINT *TS_MSG_IMPRINT_dup(TS_MSG_IMPRINT *a); + +#ifndef OPENSSL_NO_STDIO +TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT_fp(FILE *fp, TS_MSG_IMPRINT **a); +int i2d_TS_MSG_IMPRINT_fp(FILE *fp, TS_MSG_IMPRINT *a); +#endif +TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT_bio(BIO *bio, TS_MSG_IMPRINT **a); +int i2d_TS_MSG_IMPRINT_bio(BIO *bio, TS_MSG_IMPRINT *a); + +TS_RESP *TS_RESP_new(void); +void TS_RESP_free(TS_RESP *a); +int i2d_TS_RESP(const TS_RESP *a, unsigned char **pp); +TS_RESP *d2i_TS_RESP(TS_RESP **a, const unsigned char **pp, long length); +TS_TST_INFO *PKCS7_to_TS_TST_INFO(PKCS7 *token); +TS_RESP *TS_RESP_dup(TS_RESP *a); + +#ifndef OPENSSL_NO_STDIO +TS_RESP *d2i_TS_RESP_fp(FILE *fp, TS_RESP **a); +int i2d_TS_RESP_fp(FILE *fp, TS_RESP *a); +#endif +TS_RESP *d2i_TS_RESP_bio(BIO *bio, TS_RESP **a); +int i2d_TS_RESP_bio(BIO *bio, TS_RESP *a); + +TS_STATUS_INFO *TS_STATUS_INFO_new(void); +void TS_STATUS_INFO_free(TS_STATUS_INFO *a); +int i2d_TS_STATUS_INFO(const TS_STATUS_INFO *a, unsigned char **pp); +TS_STATUS_INFO *d2i_TS_STATUS_INFO(TS_STATUS_INFO **a, + const unsigned char **pp, long length); +TS_STATUS_INFO *TS_STATUS_INFO_dup(TS_STATUS_INFO *a); + +TS_TST_INFO *TS_TST_INFO_new(void); +void TS_TST_INFO_free(TS_TST_INFO *a); +int i2d_TS_TST_INFO(const TS_TST_INFO *a, unsigned char **pp); +TS_TST_INFO *d2i_TS_TST_INFO(TS_TST_INFO **a, const unsigned char **pp, + long length); +TS_TST_INFO *TS_TST_INFO_dup(TS_TST_INFO *a); + +#ifndef OPENSSL_NO_STDIO +TS_TST_INFO *d2i_TS_TST_INFO_fp(FILE *fp, TS_TST_INFO **a); +int i2d_TS_TST_INFO_fp(FILE *fp, TS_TST_INFO *a); +#endif +TS_TST_INFO *d2i_TS_TST_INFO_bio(BIO *bio, TS_TST_INFO **a); +int i2d_TS_TST_INFO_bio(BIO *bio, TS_TST_INFO *a); + +TS_ACCURACY *TS_ACCURACY_new(void); +void TS_ACCURACY_free(TS_ACCURACY *a); +int i2d_TS_ACCURACY(const TS_ACCURACY *a, unsigned char **pp); +TS_ACCURACY *d2i_TS_ACCURACY(TS_ACCURACY **a, const unsigned char **pp, + long length); +TS_ACCURACY *TS_ACCURACY_dup(TS_ACCURACY *a); + +ESS_ISSUER_SERIAL *ESS_ISSUER_SERIAL_new(void); +void ESS_ISSUER_SERIAL_free(ESS_ISSUER_SERIAL *a); +int i2d_ESS_ISSUER_SERIAL(const ESS_ISSUER_SERIAL *a, unsigned char **pp); +ESS_ISSUER_SERIAL *d2i_ESS_ISSUER_SERIAL(ESS_ISSUER_SERIAL **a, + const unsigned char **pp, + long length); +ESS_ISSUER_SERIAL *ESS_ISSUER_SERIAL_dup(ESS_ISSUER_SERIAL *a); + +ESS_CERT_ID *ESS_CERT_ID_new(void); +void ESS_CERT_ID_free(ESS_CERT_ID *a); +int i2d_ESS_CERT_ID(const ESS_CERT_ID *a, unsigned char **pp); +ESS_CERT_ID *d2i_ESS_CERT_ID(ESS_CERT_ID **a, const unsigned char **pp, + long length); +ESS_CERT_ID *ESS_CERT_ID_dup(ESS_CERT_ID *a); + +ESS_SIGNING_CERT *ESS_SIGNING_CERT_new(void); +void ESS_SIGNING_CERT_free(ESS_SIGNING_CERT *a); +int i2d_ESS_SIGNING_CERT(const ESS_SIGNING_CERT *a, unsigned char **pp); +ESS_SIGNING_CERT *d2i_ESS_SIGNING_CERT(ESS_SIGNING_CERT **a, + const unsigned char **pp, long length); +ESS_SIGNING_CERT *ESS_SIGNING_CERT_dup(ESS_SIGNING_CERT *a); + +ESS_CERT_ID_V2 *ESS_CERT_ID_V2_new(void); +void ESS_CERT_ID_V2_free(ESS_CERT_ID_V2 *a); +int i2d_ESS_CERT_ID_V2(const ESS_CERT_ID_V2 *a, unsigned char **pp); +ESS_CERT_ID_V2 *d2i_ESS_CERT_ID_V2(ESS_CERT_ID_V2 **a, + const unsigned char **pp, long length); +ESS_CERT_ID_V2 *ESS_CERT_ID_V2_dup(ESS_CERT_ID_V2 *a); + +ESS_SIGNING_CERT_V2 *ESS_SIGNING_CERT_V2_new(void); +void ESS_SIGNING_CERT_V2_free(ESS_SIGNING_CERT_V2 *a); +int i2d_ESS_SIGNING_CERT_V2(const ESS_SIGNING_CERT_V2 *a, unsigned char **pp); +ESS_SIGNING_CERT_V2 *d2i_ESS_SIGNING_CERT_V2(ESS_SIGNING_CERT_V2 **a, + const unsigned char **pp, + long length); +ESS_SIGNING_CERT_V2 *ESS_SIGNING_CERT_V2_dup(ESS_SIGNING_CERT_V2 *a); + +int TS_REQ_set_version(TS_REQ *a, long version); +long TS_REQ_get_version(const TS_REQ *a); + +int TS_STATUS_INFO_set_status(TS_STATUS_INFO *a, int i); +const ASN1_INTEGER *TS_STATUS_INFO_get0_status(const TS_STATUS_INFO *a); + +const STACK_OF(ASN1_UTF8STRING) * +TS_STATUS_INFO_get0_text(const TS_STATUS_INFO *a); + +const ASN1_BIT_STRING * +TS_STATUS_INFO_get0_failure_info(const TS_STATUS_INFO *a); + +int TS_REQ_set_msg_imprint(TS_REQ *a, TS_MSG_IMPRINT *msg_imprint); +TS_MSG_IMPRINT *TS_REQ_get_msg_imprint(TS_REQ *a); + +int TS_MSG_IMPRINT_set_algo(TS_MSG_IMPRINT *a, X509_ALGOR *alg); +X509_ALGOR *TS_MSG_IMPRINT_get_algo(TS_MSG_IMPRINT *a); + +int TS_MSG_IMPRINT_set_msg(TS_MSG_IMPRINT *a, unsigned char *d, int len); +ASN1_OCTET_STRING *TS_MSG_IMPRINT_get_msg(TS_MSG_IMPRINT *a); + +int TS_REQ_set_policy_id(TS_REQ *a, const ASN1_OBJECT *policy); +ASN1_OBJECT *TS_REQ_get_policy_id(TS_REQ *a); + +int TS_REQ_set_nonce(TS_REQ *a, const ASN1_INTEGER *nonce); +const ASN1_INTEGER *TS_REQ_get_nonce(const TS_REQ *a); + +int TS_REQ_set_cert_req(TS_REQ *a, int cert_req); +int TS_REQ_get_cert_req(const TS_REQ *a); + +STACK_OF(X509_EXTENSION) *TS_REQ_get_exts(TS_REQ *a); +void TS_REQ_ext_free(TS_REQ *a); +int TS_REQ_get_ext_count(TS_REQ *a); +int TS_REQ_get_ext_by_NID(TS_REQ *a, int nid, int lastpos); +int TS_REQ_get_ext_by_OBJ(TS_REQ *a, const ASN1_OBJECT *obj, int lastpos); +int TS_REQ_get_ext_by_critical(TS_REQ *a, int crit, int lastpos); +X509_EXTENSION *TS_REQ_get_ext(TS_REQ *a, int loc); +X509_EXTENSION *TS_REQ_delete_ext(TS_REQ *a, int loc); +int TS_REQ_add_ext(TS_REQ *a, X509_EXTENSION *ex, int loc); +void *TS_REQ_get_ext_d2i(TS_REQ *a, int nid, int *crit, int *idx); + +/* Function declarations for TS_REQ defined in ts/ts_req_print.c */ + +int TS_REQ_print_bio(BIO *bio, TS_REQ *a); + +/* Function declarations for TS_RESP defined in ts/ts_resp_utils.c */ + +int TS_RESP_set_status_info(TS_RESP *a, TS_STATUS_INFO *info); +TS_STATUS_INFO *TS_RESP_get_status_info(TS_RESP *a); + +/* Caller loses ownership of PKCS7 and TS_TST_INFO objects. */ +void TS_RESP_set_tst_info(TS_RESP *a, PKCS7 *p7, TS_TST_INFO *tst_info); +PKCS7 *TS_RESP_get_token(TS_RESP *a); +TS_TST_INFO *TS_RESP_get_tst_info(TS_RESP *a); + +int TS_TST_INFO_set_version(TS_TST_INFO *a, long version); +long TS_TST_INFO_get_version(const TS_TST_INFO *a); + +int TS_TST_INFO_set_policy_id(TS_TST_INFO *a, ASN1_OBJECT *policy_id); +ASN1_OBJECT *TS_TST_INFO_get_policy_id(TS_TST_INFO *a); + +int TS_TST_INFO_set_msg_imprint(TS_TST_INFO *a, TS_MSG_IMPRINT *msg_imprint); +TS_MSG_IMPRINT *TS_TST_INFO_get_msg_imprint(TS_TST_INFO *a); + +int TS_TST_INFO_set_serial(TS_TST_INFO *a, const ASN1_INTEGER *serial); +const ASN1_INTEGER *TS_TST_INFO_get_serial(const TS_TST_INFO *a); + +int TS_TST_INFO_set_time(TS_TST_INFO *a, const ASN1_GENERALIZEDTIME *gtime); +const ASN1_GENERALIZEDTIME *TS_TST_INFO_get_time(const TS_TST_INFO *a); + +int TS_TST_INFO_set_accuracy(TS_TST_INFO *a, TS_ACCURACY *accuracy); +TS_ACCURACY *TS_TST_INFO_get_accuracy(TS_TST_INFO *a); + +int TS_ACCURACY_set_seconds(TS_ACCURACY *a, const ASN1_INTEGER *seconds); +const ASN1_INTEGER *TS_ACCURACY_get_seconds(const TS_ACCURACY *a); + +int TS_ACCURACY_set_millis(TS_ACCURACY *a, const ASN1_INTEGER *millis); +const ASN1_INTEGER *TS_ACCURACY_get_millis(const TS_ACCURACY *a); + +int TS_ACCURACY_set_micros(TS_ACCURACY *a, const ASN1_INTEGER *micros); +const ASN1_INTEGER *TS_ACCURACY_get_micros(const TS_ACCURACY *a); + +int TS_TST_INFO_set_ordering(TS_TST_INFO *a, int ordering); +int TS_TST_INFO_get_ordering(const TS_TST_INFO *a); + +int TS_TST_INFO_set_nonce(TS_TST_INFO *a, const ASN1_INTEGER *nonce); +const ASN1_INTEGER *TS_TST_INFO_get_nonce(const TS_TST_INFO *a); + +int TS_TST_INFO_set_tsa(TS_TST_INFO *a, GENERAL_NAME *tsa); +GENERAL_NAME *TS_TST_INFO_get_tsa(TS_TST_INFO *a); + +STACK_OF(X509_EXTENSION) *TS_TST_INFO_get_exts(TS_TST_INFO *a); +void TS_TST_INFO_ext_free(TS_TST_INFO *a); +int TS_TST_INFO_get_ext_count(TS_TST_INFO *a); +int TS_TST_INFO_get_ext_by_NID(TS_TST_INFO *a, int nid, int lastpos); +int TS_TST_INFO_get_ext_by_OBJ(TS_TST_INFO *a, const ASN1_OBJECT *obj, + int lastpos); +int TS_TST_INFO_get_ext_by_critical(TS_TST_INFO *a, int crit, int lastpos); +X509_EXTENSION *TS_TST_INFO_get_ext(TS_TST_INFO *a, int loc); +X509_EXTENSION *TS_TST_INFO_delete_ext(TS_TST_INFO *a, int loc); +int TS_TST_INFO_add_ext(TS_TST_INFO *a, X509_EXTENSION *ex, int loc); +void *TS_TST_INFO_get_ext_d2i(TS_TST_INFO *a, int nid, int *crit, int *idx); + +/* + * Declarations related to response generation, defined in ts/ts_resp_sign.c. + */ + +/* Optional flags for response generation. */ + +/* Don't include the TSA name in response. */ +# define TS_TSA_NAME 0x01 + +/* Set ordering to true in response. */ +# define TS_ORDERING 0x02 + +/* + * Include the signer certificate and the other specified certificates in + * the ESS signing certificate attribute beside the PKCS7 signed data. + * Only the signer certificates is included by default. + */ +# define TS_ESS_CERT_ID_CHAIN 0x04 + +/* Forward declaration. */ +struct TS_resp_ctx; + +/* This must return a unique number less than 160 bits long. */ +typedef ASN1_INTEGER *(*TS_serial_cb) (struct TS_resp_ctx *, void *); + +/* + * This must return the seconds and microseconds since Jan 1, 1970 in the sec + * and usec variables allocated by the caller. Return non-zero for success + * and zero for failure. + */ +typedef int (*TS_time_cb) (struct TS_resp_ctx *, void *, long *sec, + long *usec); + +/* + * This must process the given extension. It can modify the TS_TST_INFO + * object of the context. Return values: !0 (processed), 0 (error, it must + * set the status info/failure info of the response). + */ +typedef int (*TS_extension_cb) (struct TS_resp_ctx *, X509_EXTENSION *, + void *); + +typedef struct TS_resp_ctx TS_RESP_CTX; + +DEFINE_STACK_OF_CONST(EVP_MD) + +/* Creates a response context that can be used for generating responses. */ +TS_RESP_CTX *TS_RESP_CTX_new(void); +void TS_RESP_CTX_free(TS_RESP_CTX *ctx); + +/* This parameter must be set. */ +int TS_RESP_CTX_set_signer_cert(TS_RESP_CTX *ctx, X509 *signer); + +/* This parameter must be set. */ +int TS_RESP_CTX_set_signer_key(TS_RESP_CTX *ctx, EVP_PKEY *key); + +int TS_RESP_CTX_set_signer_digest(TS_RESP_CTX *ctx, + const EVP_MD *signer_digest); +int TS_RESP_CTX_set_ess_cert_id_digest(TS_RESP_CTX *ctx, const EVP_MD *md); + +/* This parameter must be set. */ +int TS_RESP_CTX_set_def_policy(TS_RESP_CTX *ctx, const ASN1_OBJECT *def_policy); + +/* No additional certs are included in the response by default. */ +int TS_RESP_CTX_set_certs(TS_RESP_CTX *ctx, STACK_OF(X509) *certs); + +/* + * Adds a new acceptable policy, only the default policy is accepted by + * default. + */ +int TS_RESP_CTX_add_policy(TS_RESP_CTX *ctx, const ASN1_OBJECT *policy); + +/* + * Adds a new acceptable message digest. Note that no message digests are + * accepted by default. The md argument is shared with the caller. + */ +int TS_RESP_CTX_add_md(TS_RESP_CTX *ctx, const EVP_MD *md); + +/* Accuracy is not included by default. */ +int TS_RESP_CTX_set_accuracy(TS_RESP_CTX *ctx, + int secs, int millis, int micros); + +/* + * Clock precision digits, i.e. the number of decimal digits: '0' means sec, + * '3' msec, '6' usec, and so on. Default is 0. + */ +int TS_RESP_CTX_set_clock_precision_digits(TS_RESP_CTX *ctx, + unsigned clock_precision_digits); +/* At most we accept usec precision. */ +# define TS_MAX_CLOCK_PRECISION_DIGITS 6 + +/* Maximum status message length */ +# define TS_MAX_STATUS_LENGTH (1024 * 1024) + +/* No flags are set by default. */ +void TS_RESP_CTX_add_flags(TS_RESP_CTX *ctx, int flags); + +/* Default callback always returns a constant. */ +void TS_RESP_CTX_set_serial_cb(TS_RESP_CTX *ctx, TS_serial_cb cb, void *data); + +/* Default callback uses the gettimeofday() and gmtime() system calls. */ +void TS_RESP_CTX_set_time_cb(TS_RESP_CTX *ctx, TS_time_cb cb, void *data); + +/* + * Default callback rejects all extensions. The extension callback is called + * when the TS_TST_INFO object is already set up and not signed yet. + */ +/* FIXME: extension handling is not tested yet. */ +void TS_RESP_CTX_set_extension_cb(TS_RESP_CTX *ctx, + TS_extension_cb cb, void *data); + +/* The following methods can be used in the callbacks. */ +int TS_RESP_CTX_set_status_info(TS_RESP_CTX *ctx, + int status, const char *text); + +/* Sets the status info only if it is still TS_STATUS_GRANTED. */ +int TS_RESP_CTX_set_status_info_cond(TS_RESP_CTX *ctx, + int status, const char *text); + +int TS_RESP_CTX_add_failure_info(TS_RESP_CTX *ctx, int failure); + +/* The get methods below can be used in the extension callback. */ +TS_REQ *TS_RESP_CTX_get_request(TS_RESP_CTX *ctx); + +TS_TST_INFO *TS_RESP_CTX_get_tst_info(TS_RESP_CTX *ctx); + +/* + * Creates the signed TS_TST_INFO and puts it in TS_RESP. + * In case of errors it sets the status info properly. + * Returns NULL only in case of memory allocation/fatal error. + */ +TS_RESP *TS_RESP_create_response(TS_RESP_CTX *ctx, BIO *req_bio); + +/* + * Declarations related to response verification, + * they are defined in ts/ts_resp_verify.c. + */ + +int TS_RESP_verify_signature(PKCS7 *token, STACK_OF(X509) *certs, + X509_STORE *store, X509 **signer_out); + +/* Context structure for the generic verify method. */ + +/* Verify the signer's certificate and the signature of the response. */ +# define TS_VFY_SIGNATURE (1u << 0) +/* Verify the version number of the response. */ +# define TS_VFY_VERSION (1u << 1) +/* Verify if the policy supplied by the user matches the policy of the TSA. */ +# define TS_VFY_POLICY (1u << 2) +/* + * Verify the message imprint provided by the user. This flag should not be + * specified with TS_VFY_DATA. + */ +# define TS_VFY_IMPRINT (1u << 3) +/* + * Verify the message imprint computed by the verify method from the user + * provided data and the MD algorithm of the response. This flag should not + * be specified with TS_VFY_IMPRINT. + */ +# define TS_VFY_DATA (1u << 4) +/* Verify the nonce value. */ +# define TS_VFY_NONCE (1u << 5) +/* Verify if the TSA name field matches the signer certificate. */ +# define TS_VFY_SIGNER (1u << 6) +/* Verify if the TSA name field equals to the user provided name. */ +# define TS_VFY_TSA_NAME (1u << 7) + +/* You can use the following convenience constants. */ +# define TS_VFY_ALL_IMPRINT (TS_VFY_SIGNATURE \ + | TS_VFY_VERSION \ + | TS_VFY_POLICY \ + | TS_VFY_IMPRINT \ + | TS_VFY_NONCE \ + | TS_VFY_SIGNER \ + | TS_VFY_TSA_NAME) +# define TS_VFY_ALL_DATA (TS_VFY_SIGNATURE \ + | TS_VFY_VERSION \ + | TS_VFY_POLICY \ + | TS_VFY_DATA \ + | TS_VFY_NONCE \ + | TS_VFY_SIGNER \ + | TS_VFY_TSA_NAME) + +typedef struct TS_verify_ctx TS_VERIFY_CTX; + +int TS_RESP_verify_response(TS_VERIFY_CTX *ctx, TS_RESP *response); +int TS_RESP_verify_token(TS_VERIFY_CTX *ctx, PKCS7 *token); + +/* + * Declarations related to response verification context, + */ +TS_VERIFY_CTX *TS_VERIFY_CTX_new(void); +void TS_VERIFY_CTX_init(TS_VERIFY_CTX *ctx); +void TS_VERIFY_CTX_free(TS_VERIFY_CTX *ctx); +void TS_VERIFY_CTX_cleanup(TS_VERIFY_CTX *ctx); +int TS_VERIFY_CTX_set_flags(TS_VERIFY_CTX *ctx, int f); +int TS_VERIFY_CTX_add_flags(TS_VERIFY_CTX *ctx, int f); +BIO *TS_VERIFY_CTX_set_data(TS_VERIFY_CTX *ctx, BIO *b); +unsigned char *TS_VERIFY_CTX_set_imprint(TS_VERIFY_CTX *ctx, + unsigned char *hexstr, long len); +X509_STORE *TS_VERIFY_CTX_set_store(TS_VERIFY_CTX *ctx, X509_STORE *s); +STACK_OF(X509) *TS_VERIFY_CTS_set_certs(TS_VERIFY_CTX *ctx, STACK_OF(X509) *certs); + +/*- + * If ctx is NULL, it allocates and returns a new object, otherwise + * it returns ctx. It initialises all the members as follows: + * flags = TS_VFY_ALL_IMPRINT & ~(TS_VFY_TSA_NAME | TS_VFY_SIGNATURE) + * certs = NULL + * store = NULL + * policy = policy from the request or NULL if absent (in this case + * TS_VFY_POLICY is cleared from flags as well) + * md_alg = MD algorithm from request + * imprint, imprint_len = imprint from request + * data = NULL + * nonce, nonce_len = nonce from the request or NULL if absent (in this case + * TS_VFY_NONCE is cleared from flags as well) + * tsa_name = NULL + * Important: after calling this method TS_VFY_SIGNATURE should be added! + */ +TS_VERIFY_CTX *TS_REQ_to_TS_VERIFY_CTX(TS_REQ *req, TS_VERIFY_CTX *ctx); + +/* Function declarations for TS_RESP defined in ts/ts_resp_print.c */ + +int TS_RESP_print_bio(BIO *bio, TS_RESP *a); +int TS_STATUS_INFO_print_bio(BIO *bio, TS_STATUS_INFO *a); +int TS_TST_INFO_print_bio(BIO *bio, TS_TST_INFO *a); + +/* Common utility functions defined in ts/ts_lib.c */ + +int TS_ASN1_INTEGER_print_bio(BIO *bio, const ASN1_INTEGER *num); +int TS_OBJ_print_bio(BIO *bio, const ASN1_OBJECT *obj); +int TS_ext_print_bio(BIO *bio, const STACK_OF(X509_EXTENSION) *extensions); +int TS_X509_ALGOR_print_bio(BIO *bio, const X509_ALGOR *alg); +int TS_MSG_IMPRINT_print_bio(BIO *bio, TS_MSG_IMPRINT *msg); + +/* + * Function declarations for handling configuration options, defined in + * ts/ts_conf.c + */ + +X509 *TS_CONF_load_cert(const char *file); +STACK_OF(X509) *TS_CONF_load_certs(const char *file); +EVP_PKEY *TS_CONF_load_key(const char *file, const char *pass); +const char *TS_CONF_get_tsa_section(CONF *conf, const char *section); +int TS_CONF_set_serial(CONF *conf, const char *section, TS_serial_cb cb, + TS_RESP_CTX *ctx); +#ifndef OPENSSL_NO_ENGINE +int TS_CONF_set_crypto_device(CONF *conf, const char *section, + const char *device); +int TS_CONF_set_default_engine(const char *name); +#endif +int TS_CONF_set_signer_cert(CONF *conf, const char *section, + const char *cert, TS_RESP_CTX *ctx); +int TS_CONF_set_certs(CONF *conf, const char *section, const char *certs, + TS_RESP_CTX *ctx); +int TS_CONF_set_signer_key(CONF *conf, const char *section, + const char *key, const char *pass, + TS_RESP_CTX *ctx); +int TS_CONF_set_signer_digest(CONF *conf, const char *section, + const char *md, TS_RESP_CTX *ctx); +int TS_CONF_set_def_policy(CONF *conf, const char *section, + const char *policy, TS_RESP_CTX *ctx); +int TS_CONF_set_policies(CONF *conf, const char *section, TS_RESP_CTX *ctx); +int TS_CONF_set_digests(CONF *conf, const char *section, TS_RESP_CTX *ctx); +int TS_CONF_set_accuracy(CONF *conf, const char *section, TS_RESP_CTX *ctx); +int TS_CONF_set_clock_precision_digits(CONF *conf, const char *section, + TS_RESP_CTX *ctx); +int TS_CONF_set_ordering(CONF *conf, const char *section, TS_RESP_CTX *ctx); +int TS_CONF_set_tsa_name(CONF *conf, const char *section, TS_RESP_CTX *ctx); +int TS_CONF_set_ess_cert_id_chain(CONF *conf, const char *section, + TS_RESP_CTX *ctx); +int TS_CONF_set_ess_cert_id_digest(CONF *conf, const char *section, + TS_RESP_CTX *ctx); + +# ifdef __cplusplus +} +# endif +# endif +#endif diff --git a/ONVIF/include/openssl/include/openssl/tserr.h b/ONVIF/include/openssl/include/openssl/tserr.h new file mode 100644 index 0000000..07f2333 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/tserr.h @@ -0,0 +1,132 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_TSERR_H +# define HEADER_TSERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# include + +# ifndef OPENSSL_NO_TS + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_TS_strings(void); + +/* + * TS function codes. + */ +# define TS_F_DEF_SERIAL_CB 110 +# define TS_F_DEF_TIME_CB 111 +# define TS_F_ESS_ADD_SIGNING_CERT 112 +# define TS_F_ESS_ADD_SIGNING_CERT_V2 147 +# define TS_F_ESS_CERT_ID_NEW_INIT 113 +# define TS_F_ESS_CERT_ID_V2_NEW_INIT 156 +# define TS_F_ESS_SIGNING_CERT_NEW_INIT 114 +# define TS_F_ESS_SIGNING_CERT_V2_NEW_INIT 157 +# define TS_F_INT_TS_RESP_VERIFY_TOKEN 149 +# define TS_F_PKCS7_TO_TS_TST_INFO 148 +# define TS_F_TS_ACCURACY_SET_MICROS 115 +# define TS_F_TS_ACCURACY_SET_MILLIS 116 +# define TS_F_TS_ACCURACY_SET_SECONDS 117 +# define TS_F_TS_CHECK_IMPRINTS 100 +# define TS_F_TS_CHECK_NONCES 101 +# define TS_F_TS_CHECK_POLICY 102 +# define TS_F_TS_CHECK_SIGNING_CERTS 103 +# define TS_F_TS_CHECK_STATUS_INFO 104 +# define TS_F_TS_COMPUTE_IMPRINT 145 +# define TS_F_TS_CONF_INVALID 151 +# define TS_F_TS_CONF_LOAD_CERT 153 +# define TS_F_TS_CONF_LOAD_CERTS 154 +# define TS_F_TS_CONF_LOAD_KEY 155 +# define TS_F_TS_CONF_LOOKUP_FAIL 152 +# define TS_F_TS_CONF_SET_DEFAULT_ENGINE 146 +# define TS_F_TS_GET_STATUS_TEXT 105 +# define TS_F_TS_MSG_IMPRINT_SET_ALGO 118 +# define TS_F_TS_REQ_SET_MSG_IMPRINT 119 +# define TS_F_TS_REQ_SET_NONCE 120 +# define TS_F_TS_REQ_SET_POLICY_ID 121 +# define TS_F_TS_RESP_CREATE_RESPONSE 122 +# define TS_F_TS_RESP_CREATE_TST_INFO 123 +# define TS_F_TS_RESP_CTX_ADD_FAILURE_INFO 124 +# define TS_F_TS_RESP_CTX_ADD_MD 125 +# define TS_F_TS_RESP_CTX_ADD_POLICY 126 +# define TS_F_TS_RESP_CTX_NEW 127 +# define TS_F_TS_RESP_CTX_SET_ACCURACY 128 +# define TS_F_TS_RESP_CTX_SET_CERTS 129 +# define TS_F_TS_RESP_CTX_SET_DEF_POLICY 130 +# define TS_F_TS_RESP_CTX_SET_SIGNER_CERT 131 +# define TS_F_TS_RESP_CTX_SET_STATUS_INFO 132 +# define TS_F_TS_RESP_GET_POLICY 133 +# define TS_F_TS_RESP_SET_GENTIME_WITH_PRECISION 134 +# define TS_F_TS_RESP_SET_STATUS_INFO 135 +# define TS_F_TS_RESP_SET_TST_INFO 150 +# define TS_F_TS_RESP_SIGN 136 +# define TS_F_TS_RESP_VERIFY_SIGNATURE 106 +# define TS_F_TS_TST_INFO_SET_ACCURACY 137 +# define TS_F_TS_TST_INFO_SET_MSG_IMPRINT 138 +# define TS_F_TS_TST_INFO_SET_NONCE 139 +# define TS_F_TS_TST_INFO_SET_POLICY_ID 140 +# define TS_F_TS_TST_INFO_SET_SERIAL 141 +# define TS_F_TS_TST_INFO_SET_TIME 142 +# define TS_F_TS_TST_INFO_SET_TSA 143 +# define TS_F_TS_VERIFY 108 +# define TS_F_TS_VERIFY_CERT 109 +# define TS_F_TS_VERIFY_CTX_NEW 144 + +/* + * TS reason codes. + */ +# define TS_R_BAD_PKCS7_TYPE 132 +# define TS_R_BAD_TYPE 133 +# define TS_R_CANNOT_LOAD_CERT 137 +# define TS_R_CANNOT_LOAD_KEY 138 +# define TS_R_CERTIFICATE_VERIFY_ERROR 100 +# define TS_R_COULD_NOT_SET_ENGINE 127 +# define TS_R_COULD_NOT_SET_TIME 115 +# define TS_R_DETACHED_CONTENT 134 +# define TS_R_ESS_ADD_SIGNING_CERT_ERROR 116 +# define TS_R_ESS_ADD_SIGNING_CERT_V2_ERROR 139 +# define TS_R_ESS_SIGNING_CERTIFICATE_ERROR 101 +# define TS_R_INVALID_NULL_POINTER 102 +# define TS_R_INVALID_SIGNER_CERTIFICATE_PURPOSE 117 +# define TS_R_MESSAGE_IMPRINT_MISMATCH 103 +# define TS_R_NONCE_MISMATCH 104 +# define TS_R_NONCE_NOT_RETURNED 105 +# define TS_R_NO_CONTENT 106 +# define TS_R_NO_TIME_STAMP_TOKEN 107 +# define TS_R_PKCS7_ADD_SIGNATURE_ERROR 118 +# define TS_R_PKCS7_ADD_SIGNED_ATTR_ERROR 119 +# define TS_R_PKCS7_TO_TS_TST_INFO_FAILED 129 +# define TS_R_POLICY_MISMATCH 108 +# define TS_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 120 +# define TS_R_RESPONSE_SETUP_ERROR 121 +# define TS_R_SIGNATURE_FAILURE 109 +# define TS_R_THERE_MUST_BE_ONE_SIGNER 110 +# define TS_R_TIME_SYSCALL_ERROR 122 +# define TS_R_TOKEN_NOT_PRESENT 130 +# define TS_R_TOKEN_PRESENT 131 +# define TS_R_TSA_NAME_MISMATCH 111 +# define TS_R_TSA_UNTRUSTED 112 +# define TS_R_TST_INFO_SETUP_ERROR 123 +# define TS_R_TS_DATASIGN 124 +# define TS_R_UNACCEPTABLE_POLICY 125 +# define TS_R_UNSUPPORTED_MD_ALGORITHM 126 +# define TS_R_UNSUPPORTED_VERSION 113 +# define TS_R_VAR_BAD_VALUE 135 +# define TS_R_VAR_LOOKUP_FAILURE 136 +# define TS_R_WRONG_CONTENT_TYPE 114 + +# endif +#endif diff --git a/ONVIF/include/openssl/include/openssl/txt_db.h b/ONVIF/include/openssl/include/openssl/txt_db.h new file mode 100644 index 0000000..ec981a4 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/txt_db.h @@ -0,0 +1,57 @@ +/* + * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_TXT_DB_H +# define HEADER_TXT_DB_H + +# include +# include +# include +# include + +# define DB_ERROR_OK 0 +# define DB_ERROR_MALLOC 1 +# define DB_ERROR_INDEX_CLASH 2 +# define DB_ERROR_INDEX_OUT_OF_RANGE 3 +# define DB_ERROR_NO_INDEX 4 +# define DB_ERROR_INSERT_INDEX_CLASH 5 +# define DB_ERROR_WRONG_NUM_FIELDS 6 + +#ifdef __cplusplus +extern "C" { +#endif + +typedef OPENSSL_STRING *OPENSSL_PSTRING; +DEFINE_SPECIAL_STACK_OF(OPENSSL_PSTRING, OPENSSL_STRING) + +typedef struct txt_db_st { + int num_fields; + STACK_OF(OPENSSL_PSTRING) *data; + LHASH_OF(OPENSSL_STRING) **index; + int (**qual) (OPENSSL_STRING *); + long error; + long arg1; + long arg2; + OPENSSL_STRING *arg_row; +} TXT_DB; + +TXT_DB *TXT_DB_read(BIO *in, int num); +long TXT_DB_write(BIO *out, TXT_DB *db); +int TXT_DB_create_index(TXT_DB *db, int field, int (*qual) (OPENSSL_STRING *), + OPENSSL_LH_HASHFUNC hash, OPENSSL_LH_COMPFUNC cmp); +void TXT_DB_free(TXT_DB *db); +OPENSSL_STRING *TXT_DB_get_by_index(TXT_DB *db, int idx, + OPENSSL_STRING *value); +int TXT_DB_insert(TXT_DB *db, OPENSSL_STRING *value); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/ONVIF/include/openssl/include/openssl/ui.h b/ONVIF/include/openssl/include/openssl/ui.h new file mode 100644 index 0000000..7c721ec --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/ui.h @@ -0,0 +1,368 @@ +/* + * Copyright 2001-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_UI_H +# define HEADER_UI_H + +# include + +# if OPENSSL_API_COMPAT < 0x10100000L +# include +# endif +# include +# include +# include +# include + +/* For compatibility reasons, the macro OPENSSL_NO_UI is currently retained */ +# if OPENSSL_API_COMPAT < 0x10200000L +# ifdef OPENSSL_NO_UI_CONSOLE +# define OPENSSL_NO_UI +# endif +# endif + +# ifdef __cplusplus +extern "C" { +# endif + +/* + * All the following functions return -1 or NULL on error and in some cases + * (UI_process()) -2 if interrupted or in some other way cancelled. When + * everything is fine, they return 0, a positive value or a non-NULL pointer, + * all depending on their purpose. + */ + +/* Creators and destructor. */ +UI *UI_new(void); +UI *UI_new_method(const UI_METHOD *method); +void UI_free(UI *ui); + +/*- + The following functions are used to add strings to be printed and prompt + strings to prompt for data. The names are UI_{add,dup}__string + and UI_{add,dup}_input_boolean. + + UI_{add,dup}__string have the following meanings: + add add a text or prompt string. The pointers given to these + functions are used verbatim, no copying is done. + dup make a copy of the text or prompt string, then add the copy + to the collection of strings in the user interface. + + The function is a name for the functionality that the given + string shall be used for. It can be one of: + input use the string as data prompt. + verify use the string as verification prompt. This + is used to verify a previous input. + info use the string for informational output. + error use the string for error output. + Honestly, there's currently no difference between info and error for the + moment. + + UI_{add,dup}_input_boolean have the same semantics for "add" and "dup", + and are typically used when one wants to prompt for a yes/no response. + + All of the functions in this group take a UI and a prompt string. + The string input and verify addition functions also take a flag argument, + a buffer for the result to end up with, a minimum input size and a maximum + input size (the result buffer MUST be large enough to be able to contain + the maximum number of characters). Additionally, the verify addition + functions takes another buffer to compare the result against. + The boolean input functions take an action description string (which should + be safe to ignore if the expected user action is obvious, for example with + a dialog box with an OK button and a Cancel button), a string of acceptable + characters to mean OK and to mean Cancel. The two last strings are checked + to make sure they don't have common characters. Additionally, the same + flag argument as for the string input is taken, as well as a result buffer. + The result buffer is required to be at least one byte long. Depending on + the answer, the first character from the OK or the Cancel character strings + will be stored in the first byte of the result buffer. No NUL will be + added, so the result is *not* a string. + + On success, the all return an index of the added information. That index + is useful when retrieving results with UI_get0_result(). */ +int UI_add_input_string(UI *ui, const char *prompt, int flags, + char *result_buf, int minsize, int maxsize); +int UI_dup_input_string(UI *ui, const char *prompt, int flags, + char *result_buf, int minsize, int maxsize); +int UI_add_verify_string(UI *ui, const char *prompt, int flags, + char *result_buf, int minsize, int maxsize, + const char *test_buf); +int UI_dup_verify_string(UI *ui, const char *prompt, int flags, + char *result_buf, int minsize, int maxsize, + const char *test_buf); +int UI_add_input_boolean(UI *ui, const char *prompt, const char *action_desc, + const char *ok_chars, const char *cancel_chars, + int flags, char *result_buf); +int UI_dup_input_boolean(UI *ui, const char *prompt, const char *action_desc, + const char *ok_chars, const char *cancel_chars, + int flags, char *result_buf); +int UI_add_info_string(UI *ui, const char *text); +int UI_dup_info_string(UI *ui, const char *text); +int UI_add_error_string(UI *ui, const char *text); +int UI_dup_error_string(UI *ui, const char *text); + +/* These are the possible flags. They can be or'ed together. */ +/* Use to have echoing of input */ +# define UI_INPUT_FLAG_ECHO 0x01 +/* + * Use a default password. Where that password is found is completely up to + * the application, it might for example be in the user data set with + * UI_add_user_data(). It is not recommended to have more than one input in + * each UI being marked with this flag, or the application might get + * confused. + */ +# define UI_INPUT_FLAG_DEFAULT_PWD 0x02 + +/*- + * The user of these routines may want to define flags of their own. The core + * UI won't look at those, but will pass them on to the method routines. They + * must use higher bits so they don't get confused with the UI bits above. + * UI_INPUT_FLAG_USER_BASE tells which is the lowest bit to use. A good + * example of use is this: + * + * #define MY_UI_FLAG1 (0x01 << UI_INPUT_FLAG_USER_BASE) + * +*/ +# define UI_INPUT_FLAG_USER_BASE 16 + +/*- + * The following function helps construct a prompt. object_desc is a + * textual short description of the object, for example "pass phrase", + * and object_name is the name of the object (might be a card name or + * a file name. + * The returned string shall always be allocated on the heap with + * OPENSSL_malloc(), and need to be free'd with OPENSSL_free(). + * + * If the ui_method doesn't contain a pointer to a user-defined prompt + * constructor, a default string is built, looking like this: + * + * "Enter {object_desc} for {object_name}:" + * + * So, if object_desc has the value "pass phrase" and object_name has + * the value "foo.key", the resulting string is: + * + * "Enter pass phrase for foo.key:" +*/ +char *UI_construct_prompt(UI *ui_method, + const char *object_desc, const char *object_name); + +/* + * The following function is used to store a pointer to user-specific data. + * Any previous such pointer will be returned and replaced. + * + * For callback purposes, this function makes a lot more sense than using + * ex_data, since the latter requires that different parts of OpenSSL or + * applications share the same ex_data index. + * + * Note that the UI_OpenSSL() method completely ignores the user data. Other + * methods may not, however. + */ +void *UI_add_user_data(UI *ui, void *user_data); +/* + * Alternatively, this function is used to duplicate the user data. + * This uses the duplicator method function. The destroy function will + * be used to free the user data in this case. + */ +int UI_dup_user_data(UI *ui, void *user_data); +/* We need a user data retrieving function as well. */ +void *UI_get0_user_data(UI *ui); + +/* Return the result associated with a prompt given with the index i. */ +const char *UI_get0_result(UI *ui, int i); +int UI_get_result_length(UI *ui, int i); + +/* When all strings have been added, process the whole thing. */ +int UI_process(UI *ui); + +/* + * Give a user interface parameterised control commands. This can be used to + * send down an integer, a data pointer or a function pointer, as well as be + * used to get information from a UI. + */ +int UI_ctrl(UI *ui, int cmd, long i, void *p, void (*f) (void)); + +/* The commands */ +/* + * Use UI_CONTROL_PRINT_ERRORS with the value 1 to have UI_process print the + * OpenSSL error stack before printing any info or added error messages and + * before any prompting. + */ +# define UI_CTRL_PRINT_ERRORS 1 +/* + * Check if a UI_process() is possible to do again with the same instance of + * a user interface. This makes UI_ctrl() return 1 if it is redoable, and 0 + * if not. + */ +# define UI_CTRL_IS_REDOABLE 2 + +/* Some methods may use extra data */ +# define UI_set_app_data(s,arg) UI_set_ex_data(s,0,arg) +# define UI_get_app_data(s) UI_get_ex_data(s,0) + +# define UI_get_ex_new_index(l, p, newf, dupf, freef) \ + CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_UI, l, p, newf, dupf, freef) +int UI_set_ex_data(UI *r, int idx, void *arg); +void *UI_get_ex_data(UI *r, int idx); + +/* Use specific methods instead of the built-in one */ +void UI_set_default_method(const UI_METHOD *meth); +const UI_METHOD *UI_get_default_method(void); +const UI_METHOD *UI_get_method(UI *ui); +const UI_METHOD *UI_set_method(UI *ui, const UI_METHOD *meth); + +# ifndef OPENSSL_NO_UI_CONSOLE + +/* The method with all the built-in thingies */ +UI_METHOD *UI_OpenSSL(void); + +# endif + +/* + * NULL method. Literally does nothing, but may serve as a placeholder + * to avoid internal default. + */ +const UI_METHOD *UI_null(void); + +/* ---------- For method writers ---------- */ +/*- + A method contains a number of functions that implement the low level + of the User Interface. The functions are: + + an opener This function starts a session, maybe by opening + a channel to a tty, or by opening a window. + a writer This function is called to write a given string, + maybe to the tty, maybe as a field label in a + window. + a flusher This function is called to flush everything that + has been output so far. It can be used to actually + display a dialog box after it has been built. + a reader This function is called to read a given prompt, + maybe from the tty, maybe from a field in a + window. Note that it's called with all string + structures, not only the prompt ones, so it must + check such things itself. + a closer This function closes the session, maybe by closing + the channel to the tty, or closing the window. + + All these functions are expected to return: + + 0 on error. + 1 on success. + -1 on out-of-band events, for example if some prompting has + been canceled (by pressing Ctrl-C, for example). This is + only checked when returned by the flusher or the reader. + + The way this is used, the opener is first called, then the writer for all + strings, then the flusher, then the reader for all strings and finally the + closer. Note that if you want to prompt from a terminal or other command + line interface, the best is to have the reader also write the prompts + instead of having the writer do it. If you want to prompt from a dialog + box, the writer can be used to build up the contents of the box, and the + flusher to actually display the box and run the event loop until all data + has been given, after which the reader only grabs the given data and puts + them back into the UI strings. + + All method functions take a UI as argument. Additionally, the writer and + the reader take a UI_STRING. +*/ + +/* + * The UI_STRING type is the data structure that contains all the needed info + * about a string or a prompt, including test data for a verification prompt. + */ +typedef struct ui_string_st UI_STRING; +DEFINE_STACK_OF(UI_STRING) + +/* + * The different types of strings that are currently supported. This is only + * needed by method authors. + */ +enum UI_string_types { + UIT_NONE = 0, + UIT_PROMPT, /* Prompt for a string */ + UIT_VERIFY, /* Prompt for a string and verify */ + UIT_BOOLEAN, /* Prompt for a yes/no response */ + UIT_INFO, /* Send info to the user */ + UIT_ERROR /* Send an error message to the user */ +}; + +/* Create and manipulate methods */ +UI_METHOD *UI_create_method(const char *name); +void UI_destroy_method(UI_METHOD *ui_method); +int UI_method_set_opener(UI_METHOD *method, int (*opener) (UI *ui)); +int UI_method_set_writer(UI_METHOD *method, + int (*writer) (UI *ui, UI_STRING *uis)); +int UI_method_set_flusher(UI_METHOD *method, int (*flusher) (UI *ui)); +int UI_method_set_reader(UI_METHOD *method, + int (*reader) (UI *ui, UI_STRING *uis)); +int UI_method_set_closer(UI_METHOD *method, int (*closer) (UI *ui)); +int UI_method_set_data_duplicator(UI_METHOD *method, + void *(*duplicator) (UI *ui, void *ui_data), + void (*destructor)(UI *ui, void *ui_data)); +int UI_method_set_prompt_constructor(UI_METHOD *method, + char *(*prompt_constructor) (UI *ui, + const char + *object_desc, + const char + *object_name)); +int UI_method_set_ex_data(UI_METHOD *method, int idx, void *data); +int (*UI_method_get_opener(const UI_METHOD *method)) (UI *); +int (*UI_method_get_writer(const UI_METHOD *method)) (UI *, UI_STRING *); +int (*UI_method_get_flusher(const UI_METHOD *method)) (UI *); +int (*UI_method_get_reader(const UI_METHOD *method)) (UI *, UI_STRING *); +int (*UI_method_get_closer(const UI_METHOD *method)) (UI *); +char *(*UI_method_get_prompt_constructor(const UI_METHOD *method)) + (UI *, const char *, const char *); +void *(*UI_method_get_data_duplicator(const UI_METHOD *method)) (UI *, void *); +void (*UI_method_get_data_destructor(const UI_METHOD *method)) (UI *, void *); +const void *UI_method_get_ex_data(const UI_METHOD *method, int idx); + +/* + * The following functions are helpers for method writers to access relevant + * data from a UI_STRING. + */ + +/* Return type of the UI_STRING */ +enum UI_string_types UI_get_string_type(UI_STRING *uis); +/* Return input flags of the UI_STRING */ +int UI_get_input_flags(UI_STRING *uis); +/* Return the actual string to output (the prompt, info or error) */ +const char *UI_get0_output_string(UI_STRING *uis); +/* + * Return the optional action string to output (the boolean prompt + * instruction) + */ +const char *UI_get0_action_string(UI_STRING *uis); +/* Return the result of a prompt */ +const char *UI_get0_result_string(UI_STRING *uis); +int UI_get_result_string_length(UI_STRING *uis); +/* + * Return the string to test the result against. Only useful with verifies. + */ +const char *UI_get0_test_string(UI_STRING *uis); +/* Return the required minimum size of the result */ +int UI_get_result_minsize(UI_STRING *uis); +/* Return the required maximum size of the result */ +int UI_get_result_maxsize(UI_STRING *uis); +/* Set the result of a UI_STRING. */ +int UI_set_result(UI *ui, UI_STRING *uis, const char *result); +int UI_set_result_ex(UI *ui, UI_STRING *uis, const char *result, int len); + +/* A couple of popular utility functions */ +int UI_UTIL_read_pw_string(char *buf, int length, const char *prompt, + int verify); +int UI_UTIL_read_pw(char *buf, char *buff, int size, const char *prompt, + int verify); +UI_METHOD *UI_UTIL_wrap_read_pem_callback(pem_password_cb *cb, int rwflag); + + +# ifdef __cplusplus +} +# endif +#endif diff --git a/ONVIF/include/openssl/include/openssl/uierr.h b/ONVIF/include/openssl/include/openssl/uierr.h new file mode 100644 index 0000000..bd68864 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/uierr.h @@ -0,0 +1,65 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_UIERR_H +# define HEADER_UIERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_UI_strings(void); + +/* + * UI function codes. + */ +# define UI_F_CLOSE_CONSOLE 115 +# define UI_F_ECHO_CONSOLE 116 +# define UI_F_GENERAL_ALLOCATE_BOOLEAN 108 +# define UI_F_GENERAL_ALLOCATE_PROMPT 109 +# define UI_F_NOECHO_CONSOLE 117 +# define UI_F_OPEN_CONSOLE 114 +# define UI_F_UI_CONSTRUCT_PROMPT 121 +# define UI_F_UI_CREATE_METHOD 112 +# define UI_F_UI_CTRL 111 +# define UI_F_UI_DUP_ERROR_STRING 101 +# define UI_F_UI_DUP_INFO_STRING 102 +# define UI_F_UI_DUP_INPUT_BOOLEAN 110 +# define UI_F_UI_DUP_INPUT_STRING 103 +# define UI_F_UI_DUP_USER_DATA 118 +# define UI_F_UI_DUP_VERIFY_STRING 106 +# define UI_F_UI_GET0_RESULT 107 +# define UI_F_UI_GET_RESULT_LENGTH 119 +# define UI_F_UI_NEW_METHOD 104 +# define UI_F_UI_PROCESS 113 +# define UI_F_UI_SET_RESULT 105 +# define UI_F_UI_SET_RESULT_EX 120 + +/* + * UI reason codes. + */ +# define UI_R_COMMON_OK_AND_CANCEL_CHARACTERS 104 +# define UI_R_INDEX_TOO_LARGE 102 +# define UI_R_INDEX_TOO_SMALL 103 +# define UI_R_NO_RESULT_BUFFER 105 +# define UI_R_PROCESSING_ERROR 107 +# define UI_R_RESULT_TOO_LARGE 100 +# define UI_R_RESULT_TOO_SMALL 101 +# define UI_R_SYSASSIGN_ERROR 109 +# define UI_R_SYSDASSGN_ERROR 110 +# define UI_R_SYSQIOW_ERROR 111 +# define UI_R_UNKNOWN_CONTROL_COMMAND 106 +# define UI_R_UNKNOWN_TTYGET_ERRNO_VALUE 108 +# define UI_R_USER_DATA_DUPLICATION_UNSUPPORTED 112 + +#endif diff --git a/ONVIF/include/openssl/include/openssl/whrlpool.h b/ONVIF/include/openssl/include/openssl/whrlpool.h new file mode 100644 index 0000000..20ea350 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/whrlpool.h @@ -0,0 +1,48 @@ +/* + * Copyright 2005-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_WHRLPOOL_H +# define HEADER_WHRLPOOL_H + +#include + +# ifndef OPENSSL_NO_WHIRLPOOL +# include +# include +# ifdef __cplusplus +extern "C" { +# endif + +# define WHIRLPOOL_DIGEST_LENGTH (512/8) +# define WHIRLPOOL_BBLOCK 512 +# define WHIRLPOOL_COUNTER (256/8) + +typedef struct { + union { + unsigned char c[WHIRLPOOL_DIGEST_LENGTH]; + /* double q is here to ensure 64-bit alignment */ + double q[WHIRLPOOL_DIGEST_LENGTH / sizeof(double)]; + } H; + unsigned char data[WHIRLPOOL_BBLOCK / 8]; + unsigned int bitoff; + size_t bitlen[WHIRLPOOL_COUNTER / sizeof(size_t)]; +} WHIRLPOOL_CTX; + +int WHIRLPOOL_Init(WHIRLPOOL_CTX *c); +int WHIRLPOOL_Update(WHIRLPOOL_CTX *c, const void *inp, size_t bytes); +void WHIRLPOOL_BitUpdate(WHIRLPOOL_CTX *c, const void *inp, size_t bits); +int WHIRLPOOL_Final(unsigned char *md, WHIRLPOOL_CTX *c); +unsigned char *WHIRLPOOL(const void *inp, size_t bytes, unsigned char *md); + +# ifdef __cplusplus +} +# endif +# endif + +#endif diff --git a/ONVIF/include/openssl/include/openssl/x509.h b/ONVIF/include/openssl/include/openssl/x509.h new file mode 100644 index 0000000..39ca0ba --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/x509.h @@ -0,0 +1,1047 @@ +/* + * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. + * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_X509_H +# define HEADER_X509_H + +# include +# include +# include +# include +# include +# include +# include +# include +# include + +# if OPENSSL_API_COMPAT < 0x10100000L +# include +# include +# include +# endif + +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + + +/* Flags for X509_get_signature_info() */ +/* Signature info is valid */ +# define X509_SIG_INFO_VALID 0x1 +/* Signature is suitable for TLS use */ +# define X509_SIG_INFO_TLS 0x2 + +# define X509_FILETYPE_PEM 1 +# define X509_FILETYPE_ASN1 2 +# define X509_FILETYPE_DEFAULT 3 + +# define X509v3_KU_DIGITAL_SIGNATURE 0x0080 +# define X509v3_KU_NON_REPUDIATION 0x0040 +# define X509v3_KU_KEY_ENCIPHERMENT 0x0020 +# define X509v3_KU_DATA_ENCIPHERMENT 0x0010 +# define X509v3_KU_KEY_AGREEMENT 0x0008 +# define X509v3_KU_KEY_CERT_SIGN 0x0004 +# define X509v3_KU_CRL_SIGN 0x0002 +# define X509v3_KU_ENCIPHER_ONLY 0x0001 +# define X509v3_KU_DECIPHER_ONLY 0x8000 +# define X509v3_KU_UNDEF 0xffff + +struct X509_algor_st { + ASN1_OBJECT *algorithm; + ASN1_TYPE *parameter; +} /* X509_ALGOR */ ; + +typedef STACK_OF(X509_ALGOR) X509_ALGORS; + +typedef struct X509_val_st { + ASN1_TIME *notBefore; + ASN1_TIME *notAfter; +} X509_VAL; + +typedef struct X509_sig_st X509_SIG; + +typedef struct X509_name_entry_st X509_NAME_ENTRY; + +DEFINE_STACK_OF(X509_NAME_ENTRY) + +DEFINE_STACK_OF(X509_NAME) + +# define X509_EX_V_NETSCAPE_HACK 0x8000 +# define X509_EX_V_INIT 0x0001 +typedef struct X509_extension_st X509_EXTENSION; + +typedef STACK_OF(X509_EXTENSION) X509_EXTENSIONS; + +DEFINE_STACK_OF(X509_EXTENSION) + +typedef struct x509_attributes_st X509_ATTRIBUTE; + +DEFINE_STACK_OF(X509_ATTRIBUTE) + +typedef struct X509_req_info_st X509_REQ_INFO; + +typedef struct X509_req_st X509_REQ; + +typedef struct x509_cert_aux_st X509_CERT_AUX; + +typedef struct x509_cinf_st X509_CINF; + +DEFINE_STACK_OF(X509) + +/* This is used for a table of trust checking functions */ + +typedef struct x509_trust_st { + int trust; + int flags; + int (*check_trust) (struct x509_trust_st *, X509 *, int); + char *name; + int arg1; + void *arg2; +} X509_TRUST; + +DEFINE_STACK_OF(X509_TRUST) + +/* standard trust ids */ + +# define X509_TRUST_DEFAULT 0 /* Only valid in purpose settings */ + +# define X509_TRUST_COMPAT 1 +# define X509_TRUST_SSL_CLIENT 2 +# define X509_TRUST_SSL_SERVER 3 +# define X509_TRUST_EMAIL 4 +# define X509_TRUST_OBJECT_SIGN 5 +# define X509_TRUST_OCSP_SIGN 6 +# define X509_TRUST_OCSP_REQUEST 7 +# define X509_TRUST_TSA 8 + +/* Keep these up to date! */ +# define X509_TRUST_MIN 1 +# define X509_TRUST_MAX 8 + +/* trust_flags values */ +# define X509_TRUST_DYNAMIC (1U << 0) +# define X509_TRUST_DYNAMIC_NAME (1U << 1) +/* No compat trust if self-signed, preempts "DO_SS" */ +# define X509_TRUST_NO_SS_COMPAT (1U << 2) +/* Compat trust if no explicit accepted trust EKUs */ +# define X509_TRUST_DO_SS_COMPAT (1U << 3) +/* Accept "anyEKU" as a wildcard trust OID */ +# define X509_TRUST_OK_ANY_EKU (1U << 4) + +/* check_trust return codes */ + +# define X509_TRUST_TRUSTED 1 +# define X509_TRUST_REJECTED 2 +# define X509_TRUST_UNTRUSTED 3 + +/* Flags for X509_print_ex() */ + +# define X509_FLAG_COMPAT 0 +# define X509_FLAG_NO_HEADER 1L +# define X509_FLAG_NO_VERSION (1L << 1) +# define X509_FLAG_NO_SERIAL (1L << 2) +# define X509_FLAG_NO_SIGNAME (1L << 3) +# define X509_FLAG_NO_ISSUER (1L << 4) +# define X509_FLAG_NO_VALIDITY (1L << 5) +# define X509_FLAG_NO_SUBJECT (1L << 6) +# define X509_FLAG_NO_PUBKEY (1L << 7) +# define X509_FLAG_NO_EXTENSIONS (1L << 8) +# define X509_FLAG_NO_SIGDUMP (1L << 9) +# define X509_FLAG_NO_AUX (1L << 10) +# define X509_FLAG_NO_ATTRIBUTES (1L << 11) +# define X509_FLAG_NO_IDS (1L << 12) + +/* Flags specific to X509_NAME_print_ex() */ + +/* The field separator information */ + +# define XN_FLAG_SEP_MASK (0xf << 16) + +# define XN_FLAG_COMPAT 0/* Traditional; use old X509_NAME_print */ +# define XN_FLAG_SEP_COMMA_PLUS (1 << 16)/* RFC2253 ,+ */ +# define XN_FLAG_SEP_CPLUS_SPC (2 << 16)/* ,+ spaced: more readable */ +# define XN_FLAG_SEP_SPLUS_SPC (3 << 16)/* ;+ spaced */ +# define XN_FLAG_SEP_MULTILINE (4 << 16)/* One line per field */ + +# define XN_FLAG_DN_REV (1 << 20)/* Reverse DN order */ + +/* How the field name is shown */ + +# define XN_FLAG_FN_MASK (0x3 << 21) + +# define XN_FLAG_FN_SN 0/* Object short name */ +# define XN_FLAG_FN_LN (1 << 21)/* Object long name */ +# define XN_FLAG_FN_OID (2 << 21)/* Always use OIDs */ +# define XN_FLAG_FN_NONE (3 << 21)/* No field names */ + +# define XN_FLAG_SPC_EQ (1 << 23)/* Put spaces round '=' */ + +/* + * This determines if we dump fields we don't recognise: RFC2253 requires + * this. + */ + +# define XN_FLAG_DUMP_UNKNOWN_FIELDS (1 << 24) + +# define XN_FLAG_FN_ALIGN (1 << 25)/* Align field names to 20 + * characters */ + +/* Complete set of RFC2253 flags */ + +# define XN_FLAG_RFC2253 (ASN1_STRFLGS_RFC2253 | \ + XN_FLAG_SEP_COMMA_PLUS | \ + XN_FLAG_DN_REV | \ + XN_FLAG_FN_SN | \ + XN_FLAG_DUMP_UNKNOWN_FIELDS) + +/* readable oneline form */ + +# define XN_FLAG_ONELINE (ASN1_STRFLGS_RFC2253 | \ + ASN1_STRFLGS_ESC_QUOTE | \ + XN_FLAG_SEP_CPLUS_SPC | \ + XN_FLAG_SPC_EQ | \ + XN_FLAG_FN_SN) + +/* readable multiline form */ + +# define XN_FLAG_MULTILINE (ASN1_STRFLGS_ESC_CTRL | \ + ASN1_STRFLGS_ESC_MSB | \ + XN_FLAG_SEP_MULTILINE | \ + XN_FLAG_SPC_EQ | \ + XN_FLAG_FN_LN | \ + XN_FLAG_FN_ALIGN) + +DEFINE_STACK_OF(X509_REVOKED) + +typedef struct X509_crl_info_st X509_CRL_INFO; + +DEFINE_STACK_OF(X509_CRL) + +typedef struct private_key_st { + int version; + /* The PKCS#8 data types */ + X509_ALGOR *enc_algor; + ASN1_OCTET_STRING *enc_pkey; /* encrypted pub key */ + /* When decrypted, the following will not be NULL */ + EVP_PKEY *dec_pkey; + /* used to encrypt and decrypt */ + int key_length; + char *key_data; + int key_free; /* true if we should auto free key_data */ + /* expanded version of 'enc_algor' */ + EVP_CIPHER_INFO cipher; +} X509_PKEY; + +typedef struct X509_info_st { + X509 *x509; + X509_CRL *crl; + X509_PKEY *x_pkey; + EVP_CIPHER_INFO enc_cipher; + int enc_len; + char *enc_data; +} X509_INFO; + +DEFINE_STACK_OF(X509_INFO) + +/* + * The next 2 structures and their 8 routines are used to manipulate Netscape's + * spki structures - useful if you are writing a CA web page + */ +typedef struct Netscape_spkac_st { + X509_PUBKEY *pubkey; + ASN1_IA5STRING *challenge; /* challenge sent in atlas >= PR2 */ +} NETSCAPE_SPKAC; + +typedef struct Netscape_spki_st { + NETSCAPE_SPKAC *spkac; /* signed public key and challenge */ + X509_ALGOR sig_algor; + ASN1_BIT_STRING *signature; +} NETSCAPE_SPKI; + +/* Netscape certificate sequence structure */ +typedef struct Netscape_certificate_sequence { + ASN1_OBJECT *type; + STACK_OF(X509) *certs; +} NETSCAPE_CERT_SEQUENCE; + +/*- Unused (and iv length is wrong) +typedef struct CBCParameter_st + { + unsigned char iv[8]; + } CBC_PARAM; +*/ + +/* Password based encryption structure */ + +typedef struct PBEPARAM_st { + ASN1_OCTET_STRING *salt; + ASN1_INTEGER *iter; +} PBEPARAM; + +/* Password based encryption V2 structures */ + +typedef struct PBE2PARAM_st { + X509_ALGOR *keyfunc; + X509_ALGOR *encryption; +} PBE2PARAM; + +typedef struct PBKDF2PARAM_st { +/* Usually OCTET STRING but could be anything */ + ASN1_TYPE *salt; + ASN1_INTEGER *iter; + ASN1_INTEGER *keylength; + X509_ALGOR *prf; +} PBKDF2PARAM; + +#ifndef OPENSSL_NO_SCRYPT +typedef struct SCRYPT_PARAMS_st { + ASN1_OCTET_STRING *salt; + ASN1_INTEGER *costParameter; + ASN1_INTEGER *blockSize; + ASN1_INTEGER *parallelizationParameter; + ASN1_INTEGER *keyLength; +} SCRYPT_PARAMS; +#endif + +#ifdef __cplusplus +} +#endif + +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + +# define X509_EXT_PACK_UNKNOWN 1 +# define X509_EXT_PACK_STRING 2 + +# define X509_extract_key(x) X509_get_pubkey(x)/*****/ +# define X509_REQ_extract_key(a) X509_REQ_get_pubkey(a) +# define X509_name_cmp(a,b) X509_NAME_cmp((a),(b)) + +void X509_CRL_set_default_method(const X509_CRL_METHOD *meth); +X509_CRL_METHOD *X509_CRL_METHOD_new(int (*crl_init) (X509_CRL *crl), + int (*crl_free) (X509_CRL *crl), + int (*crl_lookup) (X509_CRL *crl, + X509_REVOKED **ret, + ASN1_INTEGER *ser, + X509_NAME *issuer), + int (*crl_verify) (X509_CRL *crl, + EVP_PKEY *pk)); +void X509_CRL_METHOD_free(X509_CRL_METHOD *m); + +void X509_CRL_set_meth_data(X509_CRL *crl, void *dat); +void *X509_CRL_get_meth_data(X509_CRL *crl); + +const char *X509_verify_cert_error_string(long n); + +int X509_verify(X509 *a, EVP_PKEY *r); + +int X509_REQ_verify(X509_REQ *a, EVP_PKEY *r); +int X509_CRL_verify(X509_CRL *a, EVP_PKEY *r); +int NETSCAPE_SPKI_verify(NETSCAPE_SPKI *a, EVP_PKEY *r); + +NETSCAPE_SPKI *NETSCAPE_SPKI_b64_decode(const char *str, int len); +char *NETSCAPE_SPKI_b64_encode(NETSCAPE_SPKI *x); +EVP_PKEY *NETSCAPE_SPKI_get_pubkey(NETSCAPE_SPKI *x); +int NETSCAPE_SPKI_set_pubkey(NETSCAPE_SPKI *x, EVP_PKEY *pkey); + +int NETSCAPE_SPKI_print(BIO *out, NETSCAPE_SPKI *spki); + +int X509_signature_dump(BIO *bp, const ASN1_STRING *sig, int indent); +int X509_signature_print(BIO *bp, const X509_ALGOR *alg, + const ASN1_STRING *sig); + +int X509_sign(X509 *x, EVP_PKEY *pkey, const EVP_MD *md); +int X509_sign_ctx(X509 *x, EVP_MD_CTX *ctx); +# ifndef OPENSSL_NO_OCSP +int X509_http_nbio(OCSP_REQ_CTX *rctx, X509 **pcert); +# endif +int X509_REQ_sign(X509_REQ *x, EVP_PKEY *pkey, const EVP_MD *md); +int X509_REQ_sign_ctx(X509_REQ *x, EVP_MD_CTX *ctx); +int X509_CRL_sign(X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *md); +int X509_CRL_sign_ctx(X509_CRL *x, EVP_MD_CTX *ctx); +# ifndef OPENSSL_NO_OCSP +int X509_CRL_http_nbio(OCSP_REQ_CTX *rctx, X509_CRL **pcrl); +# endif +int NETSCAPE_SPKI_sign(NETSCAPE_SPKI *x, EVP_PKEY *pkey, const EVP_MD *md); + +int X509_pubkey_digest(const X509 *data, const EVP_MD *type, + unsigned char *md, unsigned int *len); +int X509_digest(const X509 *data, const EVP_MD *type, + unsigned char *md, unsigned int *len); +int X509_CRL_digest(const X509_CRL *data, const EVP_MD *type, + unsigned char *md, unsigned int *len); +int X509_REQ_digest(const X509_REQ *data, const EVP_MD *type, + unsigned char *md, unsigned int *len); +int X509_NAME_digest(const X509_NAME *data, const EVP_MD *type, + unsigned char *md, unsigned int *len); + +# ifndef OPENSSL_NO_STDIO +X509 *d2i_X509_fp(FILE *fp, X509 **x509); +int i2d_X509_fp(FILE *fp, X509 *x509); +X509_CRL *d2i_X509_CRL_fp(FILE *fp, X509_CRL **crl); +int i2d_X509_CRL_fp(FILE *fp, X509_CRL *crl); +X509_REQ *d2i_X509_REQ_fp(FILE *fp, X509_REQ **req); +int i2d_X509_REQ_fp(FILE *fp, X509_REQ *req); +# ifndef OPENSSL_NO_RSA +RSA *d2i_RSAPrivateKey_fp(FILE *fp, RSA **rsa); +int i2d_RSAPrivateKey_fp(FILE *fp, RSA *rsa); +RSA *d2i_RSAPublicKey_fp(FILE *fp, RSA **rsa); +int i2d_RSAPublicKey_fp(FILE *fp, RSA *rsa); +RSA *d2i_RSA_PUBKEY_fp(FILE *fp, RSA **rsa); +int i2d_RSA_PUBKEY_fp(FILE *fp, RSA *rsa); +# endif +# ifndef OPENSSL_NO_DSA +DSA *d2i_DSA_PUBKEY_fp(FILE *fp, DSA **dsa); +int i2d_DSA_PUBKEY_fp(FILE *fp, DSA *dsa); +DSA *d2i_DSAPrivateKey_fp(FILE *fp, DSA **dsa); +int i2d_DSAPrivateKey_fp(FILE *fp, DSA *dsa); +# endif +# ifndef OPENSSL_NO_EC +EC_KEY *d2i_EC_PUBKEY_fp(FILE *fp, EC_KEY **eckey); +int i2d_EC_PUBKEY_fp(FILE *fp, EC_KEY *eckey); +EC_KEY *d2i_ECPrivateKey_fp(FILE *fp, EC_KEY **eckey); +int i2d_ECPrivateKey_fp(FILE *fp, EC_KEY *eckey); +# endif +X509_SIG *d2i_PKCS8_fp(FILE *fp, X509_SIG **p8); +int i2d_PKCS8_fp(FILE *fp, X509_SIG *p8); +PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_fp(FILE *fp, + PKCS8_PRIV_KEY_INFO **p8inf); +int i2d_PKCS8_PRIV_KEY_INFO_fp(FILE *fp, PKCS8_PRIV_KEY_INFO *p8inf); +int i2d_PKCS8PrivateKeyInfo_fp(FILE *fp, EVP_PKEY *key); +int i2d_PrivateKey_fp(FILE *fp, EVP_PKEY *pkey); +EVP_PKEY *d2i_PrivateKey_fp(FILE *fp, EVP_PKEY **a); +int i2d_PUBKEY_fp(FILE *fp, EVP_PKEY *pkey); +EVP_PKEY *d2i_PUBKEY_fp(FILE *fp, EVP_PKEY **a); +# endif + +X509 *d2i_X509_bio(BIO *bp, X509 **x509); +int i2d_X509_bio(BIO *bp, X509 *x509); +X509_CRL *d2i_X509_CRL_bio(BIO *bp, X509_CRL **crl); +int i2d_X509_CRL_bio(BIO *bp, X509_CRL *crl); +X509_REQ *d2i_X509_REQ_bio(BIO *bp, X509_REQ **req); +int i2d_X509_REQ_bio(BIO *bp, X509_REQ *req); +# ifndef OPENSSL_NO_RSA +RSA *d2i_RSAPrivateKey_bio(BIO *bp, RSA **rsa); +int i2d_RSAPrivateKey_bio(BIO *bp, RSA *rsa); +RSA *d2i_RSAPublicKey_bio(BIO *bp, RSA **rsa); +int i2d_RSAPublicKey_bio(BIO *bp, RSA *rsa); +RSA *d2i_RSA_PUBKEY_bio(BIO *bp, RSA **rsa); +int i2d_RSA_PUBKEY_bio(BIO *bp, RSA *rsa); +# endif +# ifndef OPENSSL_NO_DSA +DSA *d2i_DSA_PUBKEY_bio(BIO *bp, DSA **dsa); +int i2d_DSA_PUBKEY_bio(BIO *bp, DSA *dsa); +DSA *d2i_DSAPrivateKey_bio(BIO *bp, DSA **dsa); +int i2d_DSAPrivateKey_bio(BIO *bp, DSA *dsa); +# endif +# ifndef OPENSSL_NO_EC +EC_KEY *d2i_EC_PUBKEY_bio(BIO *bp, EC_KEY **eckey); +int i2d_EC_PUBKEY_bio(BIO *bp, EC_KEY *eckey); +EC_KEY *d2i_ECPrivateKey_bio(BIO *bp, EC_KEY **eckey); +int i2d_ECPrivateKey_bio(BIO *bp, EC_KEY *eckey); +# endif +X509_SIG *d2i_PKCS8_bio(BIO *bp, X509_SIG **p8); +int i2d_PKCS8_bio(BIO *bp, X509_SIG *p8); +PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_bio(BIO *bp, + PKCS8_PRIV_KEY_INFO **p8inf); +int i2d_PKCS8_PRIV_KEY_INFO_bio(BIO *bp, PKCS8_PRIV_KEY_INFO *p8inf); +int i2d_PKCS8PrivateKeyInfo_bio(BIO *bp, EVP_PKEY *key); +int i2d_PrivateKey_bio(BIO *bp, EVP_PKEY *pkey); +EVP_PKEY *d2i_PrivateKey_bio(BIO *bp, EVP_PKEY **a); +int i2d_PUBKEY_bio(BIO *bp, EVP_PKEY *pkey); +EVP_PKEY *d2i_PUBKEY_bio(BIO *bp, EVP_PKEY **a); + +X509 *X509_dup(X509 *x509); +X509_ATTRIBUTE *X509_ATTRIBUTE_dup(X509_ATTRIBUTE *xa); +X509_EXTENSION *X509_EXTENSION_dup(X509_EXTENSION *ex); +X509_CRL *X509_CRL_dup(X509_CRL *crl); +X509_REVOKED *X509_REVOKED_dup(X509_REVOKED *rev); +X509_REQ *X509_REQ_dup(X509_REQ *req); +X509_ALGOR *X509_ALGOR_dup(X509_ALGOR *xn); +int X509_ALGOR_set0(X509_ALGOR *alg, ASN1_OBJECT *aobj, int ptype, + void *pval); +void X509_ALGOR_get0(const ASN1_OBJECT **paobj, int *pptype, + const void **ppval, const X509_ALGOR *algor); +void X509_ALGOR_set_md(X509_ALGOR *alg, const EVP_MD *md); +int X509_ALGOR_cmp(const X509_ALGOR *a, const X509_ALGOR *b); + +X509_NAME *X509_NAME_dup(X509_NAME *xn); +X509_NAME_ENTRY *X509_NAME_ENTRY_dup(X509_NAME_ENTRY *ne); + +int X509_cmp_time(const ASN1_TIME *s, time_t *t); +int X509_cmp_current_time(const ASN1_TIME *s); +ASN1_TIME *X509_time_adj(ASN1_TIME *s, long adj, time_t *t); +ASN1_TIME *X509_time_adj_ex(ASN1_TIME *s, + int offset_day, long offset_sec, time_t *t); +ASN1_TIME *X509_gmtime_adj(ASN1_TIME *s, long adj); + +const char *X509_get_default_cert_area(void); +const char *X509_get_default_cert_dir(void); +const char *X509_get_default_cert_file(void); +const char *X509_get_default_cert_dir_env(void); +const char *X509_get_default_cert_file_env(void); +const char *X509_get_default_private_dir(void); + +X509_REQ *X509_to_X509_REQ(X509 *x, EVP_PKEY *pkey, const EVP_MD *md); +X509 *X509_REQ_to_X509(X509_REQ *r, int days, EVP_PKEY *pkey); + +DECLARE_ASN1_FUNCTIONS(X509_ALGOR) +DECLARE_ASN1_ENCODE_FUNCTIONS(X509_ALGORS, X509_ALGORS, X509_ALGORS) +DECLARE_ASN1_FUNCTIONS(X509_VAL) + +DECLARE_ASN1_FUNCTIONS(X509_PUBKEY) + +int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey); +EVP_PKEY *X509_PUBKEY_get0(X509_PUBKEY *key); +EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key); +int X509_get_pubkey_parameters(EVP_PKEY *pkey, STACK_OF(X509) *chain); +long X509_get_pathlen(X509 *x); +int i2d_PUBKEY(EVP_PKEY *a, unsigned char **pp); +EVP_PKEY *d2i_PUBKEY(EVP_PKEY **a, const unsigned char **pp, long length); +# ifndef OPENSSL_NO_RSA +int i2d_RSA_PUBKEY(RSA *a, unsigned char **pp); +RSA *d2i_RSA_PUBKEY(RSA **a, const unsigned char **pp, long length); +# endif +# ifndef OPENSSL_NO_DSA +int i2d_DSA_PUBKEY(DSA *a, unsigned char **pp); +DSA *d2i_DSA_PUBKEY(DSA **a, const unsigned char **pp, long length); +# endif +# ifndef OPENSSL_NO_EC +int i2d_EC_PUBKEY(EC_KEY *a, unsigned char **pp); +EC_KEY *d2i_EC_PUBKEY(EC_KEY **a, const unsigned char **pp, long length); +# endif + +DECLARE_ASN1_FUNCTIONS(X509_SIG) +void X509_SIG_get0(const X509_SIG *sig, const X509_ALGOR **palg, + const ASN1_OCTET_STRING **pdigest); +void X509_SIG_getm(X509_SIG *sig, X509_ALGOR **palg, + ASN1_OCTET_STRING **pdigest); + +DECLARE_ASN1_FUNCTIONS(X509_REQ_INFO) +DECLARE_ASN1_FUNCTIONS(X509_REQ) + +DECLARE_ASN1_FUNCTIONS(X509_ATTRIBUTE) +X509_ATTRIBUTE *X509_ATTRIBUTE_create(int nid, int atrtype, void *value); + +DECLARE_ASN1_FUNCTIONS(X509_EXTENSION) +DECLARE_ASN1_ENCODE_FUNCTIONS(X509_EXTENSIONS, X509_EXTENSIONS, X509_EXTENSIONS) + +DECLARE_ASN1_FUNCTIONS(X509_NAME_ENTRY) + +DECLARE_ASN1_FUNCTIONS(X509_NAME) + +int X509_NAME_set(X509_NAME **xn, X509_NAME *name); + +DECLARE_ASN1_FUNCTIONS(X509_CINF) + +DECLARE_ASN1_FUNCTIONS(X509) +DECLARE_ASN1_FUNCTIONS(X509_CERT_AUX) + +#define X509_get_ex_new_index(l, p, newf, dupf, freef) \ + CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_X509, l, p, newf, dupf, freef) +int X509_set_ex_data(X509 *r, int idx, void *arg); +void *X509_get_ex_data(X509 *r, int idx); +int i2d_X509_AUX(X509 *a, unsigned char **pp); +X509 *d2i_X509_AUX(X509 **a, const unsigned char **pp, long length); + +int i2d_re_X509_tbs(X509 *x, unsigned char **pp); + +int X509_SIG_INFO_get(const X509_SIG_INFO *siginf, int *mdnid, int *pknid, + int *secbits, uint32_t *flags); +void X509_SIG_INFO_set(X509_SIG_INFO *siginf, int mdnid, int pknid, + int secbits, uint32_t flags); + +int X509_get_signature_info(X509 *x, int *mdnid, int *pknid, int *secbits, + uint32_t *flags); + +void X509_get0_signature(const ASN1_BIT_STRING **psig, + const X509_ALGOR **palg, const X509 *x); +int X509_get_signature_nid(const X509 *x); + +int X509_trusted(const X509 *x); +int X509_alias_set1(X509 *x, const unsigned char *name, int len); +int X509_keyid_set1(X509 *x, const unsigned char *id, int len); +unsigned char *X509_alias_get0(X509 *x, int *len); +unsigned char *X509_keyid_get0(X509 *x, int *len); +int (*X509_TRUST_set_default(int (*trust) (int, X509 *, int))) (int, X509 *, + int); +int X509_TRUST_set(int *t, int trust); +int X509_add1_trust_object(X509 *x, const ASN1_OBJECT *obj); +int X509_add1_reject_object(X509 *x, const ASN1_OBJECT *obj); +void X509_trust_clear(X509 *x); +void X509_reject_clear(X509 *x); + +STACK_OF(ASN1_OBJECT) *X509_get0_trust_objects(X509 *x); +STACK_OF(ASN1_OBJECT) *X509_get0_reject_objects(X509 *x); + +DECLARE_ASN1_FUNCTIONS(X509_REVOKED) +DECLARE_ASN1_FUNCTIONS(X509_CRL_INFO) +DECLARE_ASN1_FUNCTIONS(X509_CRL) + +int X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev); +int X509_CRL_get0_by_serial(X509_CRL *crl, + X509_REVOKED **ret, ASN1_INTEGER *serial); +int X509_CRL_get0_by_cert(X509_CRL *crl, X509_REVOKED **ret, X509 *x); + +X509_PKEY *X509_PKEY_new(void); +void X509_PKEY_free(X509_PKEY *a); + +DECLARE_ASN1_FUNCTIONS(NETSCAPE_SPKI) +DECLARE_ASN1_FUNCTIONS(NETSCAPE_SPKAC) +DECLARE_ASN1_FUNCTIONS(NETSCAPE_CERT_SEQUENCE) + +X509_INFO *X509_INFO_new(void); +void X509_INFO_free(X509_INFO *a); +char *X509_NAME_oneline(const X509_NAME *a, char *buf, int size); + +int ASN1_verify(i2d_of_void *i2d, X509_ALGOR *algor1, + ASN1_BIT_STRING *signature, char *data, EVP_PKEY *pkey); + +int ASN1_digest(i2d_of_void *i2d, const EVP_MD *type, char *data, + unsigned char *md, unsigned int *len); + +int ASN1_sign(i2d_of_void *i2d, X509_ALGOR *algor1, + X509_ALGOR *algor2, ASN1_BIT_STRING *signature, + char *data, EVP_PKEY *pkey, const EVP_MD *type); + +int ASN1_item_digest(const ASN1_ITEM *it, const EVP_MD *type, void *data, + unsigned char *md, unsigned int *len); + +int ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *algor1, + ASN1_BIT_STRING *signature, void *data, EVP_PKEY *pkey); + +int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, + X509_ALGOR *algor2, ASN1_BIT_STRING *signature, void *data, + EVP_PKEY *pkey, const EVP_MD *type); +int ASN1_item_sign_ctx(const ASN1_ITEM *it, X509_ALGOR *algor1, + X509_ALGOR *algor2, ASN1_BIT_STRING *signature, + void *asn, EVP_MD_CTX *ctx); + +long X509_get_version(const X509 *x); +int X509_set_version(X509 *x, long version); +int X509_set_serialNumber(X509 *x, ASN1_INTEGER *serial); +ASN1_INTEGER *X509_get_serialNumber(X509 *x); +const ASN1_INTEGER *X509_get0_serialNumber(const X509 *x); +int X509_set_issuer_name(X509 *x, X509_NAME *name); +X509_NAME *X509_get_issuer_name(const X509 *a); +int X509_set_subject_name(X509 *x, X509_NAME *name); +X509_NAME *X509_get_subject_name(const X509 *a); +const ASN1_TIME * X509_get0_notBefore(const X509 *x); +ASN1_TIME *X509_getm_notBefore(const X509 *x); +int X509_set1_notBefore(X509 *x, const ASN1_TIME *tm); +const ASN1_TIME *X509_get0_notAfter(const X509 *x); +ASN1_TIME *X509_getm_notAfter(const X509 *x); +int X509_set1_notAfter(X509 *x, const ASN1_TIME *tm); +int X509_set_pubkey(X509 *x, EVP_PKEY *pkey); +int X509_up_ref(X509 *x); +int X509_get_signature_type(const X509 *x); + +# if OPENSSL_API_COMPAT < 0x10100000L +# define X509_get_notBefore X509_getm_notBefore +# define X509_get_notAfter X509_getm_notAfter +# define X509_set_notBefore X509_set1_notBefore +# define X509_set_notAfter X509_set1_notAfter +#endif + + +/* + * This one is only used so that a binary form can output, as in + * i2d_X509_PUBKEY(X509_get_X509_PUBKEY(x), &buf) + */ +X509_PUBKEY *X509_get_X509_PUBKEY(const X509 *x); +const STACK_OF(X509_EXTENSION) *X509_get0_extensions(const X509 *x); +void X509_get0_uids(const X509 *x, const ASN1_BIT_STRING **piuid, + const ASN1_BIT_STRING **psuid); +const X509_ALGOR *X509_get0_tbs_sigalg(const X509 *x); + +EVP_PKEY *X509_get0_pubkey(const X509 *x); +EVP_PKEY *X509_get_pubkey(X509 *x); +ASN1_BIT_STRING *X509_get0_pubkey_bitstr(const X509 *x); +int X509_certificate_type(const X509 *x, const EVP_PKEY *pubkey); + +long X509_REQ_get_version(const X509_REQ *req); +int X509_REQ_set_version(X509_REQ *x, long version); +X509_NAME *X509_REQ_get_subject_name(const X509_REQ *req); +int X509_REQ_set_subject_name(X509_REQ *req, X509_NAME *name); +void X509_REQ_get0_signature(const X509_REQ *req, const ASN1_BIT_STRING **psig, + const X509_ALGOR **palg); +int X509_REQ_get_signature_nid(const X509_REQ *req); +int i2d_re_X509_REQ_tbs(X509_REQ *req, unsigned char **pp); +int X509_REQ_set_pubkey(X509_REQ *x, EVP_PKEY *pkey); +EVP_PKEY *X509_REQ_get_pubkey(X509_REQ *req); +EVP_PKEY *X509_REQ_get0_pubkey(X509_REQ *req); +X509_PUBKEY *X509_REQ_get_X509_PUBKEY(X509_REQ *req); +int X509_REQ_extension_nid(int nid); +int *X509_REQ_get_extension_nids(void); +void X509_REQ_set_extension_nids(int *nids); +STACK_OF(X509_EXTENSION) *X509_REQ_get_extensions(X509_REQ *req); +int X509_REQ_add_extensions_nid(X509_REQ *req, STACK_OF(X509_EXTENSION) *exts, + int nid); +int X509_REQ_add_extensions(X509_REQ *req, STACK_OF(X509_EXTENSION) *exts); +int X509_REQ_get_attr_count(const X509_REQ *req); +int X509_REQ_get_attr_by_NID(const X509_REQ *req, int nid, int lastpos); +int X509_REQ_get_attr_by_OBJ(const X509_REQ *req, const ASN1_OBJECT *obj, + int lastpos); +X509_ATTRIBUTE *X509_REQ_get_attr(const X509_REQ *req, int loc); +X509_ATTRIBUTE *X509_REQ_delete_attr(X509_REQ *req, int loc); +int X509_REQ_add1_attr(X509_REQ *req, X509_ATTRIBUTE *attr); +int X509_REQ_add1_attr_by_OBJ(X509_REQ *req, + const ASN1_OBJECT *obj, int type, + const unsigned char *bytes, int len); +int X509_REQ_add1_attr_by_NID(X509_REQ *req, + int nid, int type, + const unsigned char *bytes, int len); +int X509_REQ_add1_attr_by_txt(X509_REQ *req, + const char *attrname, int type, + const unsigned char *bytes, int len); + +int X509_CRL_set_version(X509_CRL *x, long version); +int X509_CRL_set_issuer_name(X509_CRL *x, X509_NAME *name); +int X509_CRL_set1_lastUpdate(X509_CRL *x, const ASN1_TIME *tm); +int X509_CRL_set1_nextUpdate(X509_CRL *x, const ASN1_TIME *tm); +int X509_CRL_sort(X509_CRL *crl); +int X509_CRL_up_ref(X509_CRL *crl); + +# if OPENSSL_API_COMPAT < 0x10100000L +# define X509_CRL_set_lastUpdate X509_CRL_set1_lastUpdate +# define X509_CRL_set_nextUpdate X509_CRL_set1_nextUpdate +#endif + +long X509_CRL_get_version(const X509_CRL *crl); +const ASN1_TIME *X509_CRL_get0_lastUpdate(const X509_CRL *crl); +const ASN1_TIME *X509_CRL_get0_nextUpdate(const X509_CRL *crl); +DEPRECATEDIN_1_1_0(ASN1_TIME *X509_CRL_get_lastUpdate(X509_CRL *crl)) +DEPRECATEDIN_1_1_0(ASN1_TIME *X509_CRL_get_nextUpdate(X509_CRL *crl)) +X509_NAME *X509_CRL_get_issuer(const X509_CRL *crl); +const STACK_OF(X509_EXTENSION) *X509_CRL_get0_extensions(const X509_CRL *crl); +STACK_OF(X509_REVOKED) *X509_CRL_get_REVOKED(X509_CRL *crl); +void X509_CRL_get0_signature(const X509_CRL *crl, const ASN1_BIT_STRING **psig, + const X509_ALGOR **palg); +int X509_CRL_get_signature_nid(const X509_CRL *crl); +int i2d_re_X509_CRL_tbs(X509_CRL *req, unsigned char **pp); + +const ASN1_INTEGER *X509_REVOKED_get0_serialNumber(const X509_REVOKED *x); +int X509_REVOKED_set_serialNumber(X509_REVOKED *x, ASN1_INTEGER *serial); +const ASN1_TIME *X509_REVOKED_get0_revocationDate(const X509_REVOKED *x); +int X509_REVOKED_set_revocationDate(X509_REVOKED *r, ASN1_TIME *tm); +const STACK_OF(X509_EXTENSION) * +X509_REVOKED_get0_extensions(const X509_REVOKED *r); + +X509_CRL *X509_CRL_diff(X509_CRL *base, X509_CRL *newer, + EVP_PKEY *skey, const EVP_MD *md, unsigned int flags); + +int X509_REQ_check_private_key(X509_REQ *x509, EVP_PKEY *pkey); + +int X509_check_private_key(const X509 *x509, const EVP_PKEY *pkey); +int X509_chain_check_suiteb(int *perror_depth, + X509 *x, STACK_OF(X509) *chain, + unsigned long flags); +int X509_CRL_check_suiteb(X509_CRL *crl, EVP_PKEY *pk, unsigned long flags); +STACK_OF(X509) *X509_chain_up_ref(STACK_OF(X509) *chain); + +int X509_issuer_and_serial_cmp(const X509 *a, const X509 *b); +unsigned long X509_issuer_and_serial_hash(X509 *a); + +int X509_issuer_name_cmp(const X509 *a, const X509 *b); +unsigned long X509_issuer_name_hash(X509 *a); + +int X509_subject_name_cmp(const X509 *a, const X509 *b); +unsigned long X509_subject_name_hash(X509 *x); + +# ifndef OPENSSL_NO_MD5 +unsigned long X509_issuer_name_hash_old(X509 *a); +unsigned long X509_subject_name_hash_old(X509 *x); +# endif + +int X509_cmp(const X509 *a, const X509 *b); +int X509_NAME_cmp(const X509_NAME *a, const X509_NAME *b); +unsigned long X509_NAME_hash(X509_NAME *x); +unsigned long X509_NAME_hash_old(X509_NAME *x); + +int X509_CRL_cmp(const X509_CRL *a, const X509_CRL *b); +int X509_CRL_match(const X509_CRL *a, const X509_CRL *b); +int X509_aux_print(BIO *out, X509 *x, int indent); +# ifndef OPENSSL_NO_STDIO +int X509_print_ex_fp(FILE *bp, X509 *x, unsigned long nmflag, + unsigned long cflag); +int X509_print_fp(FILE *bp, X509 *x); +int X509_CRL_print_fp(FILE *bp, X509_CRL *x); +int X509_REQ_print_fp(FILE *bp, X509_REQ *req); +int X509_NAME_print_ex_fp(FILE *fp, const X509_NAME *nm, int indent, + unsigned long flags); +# endif + +int X509_NAME_print(BIO *bp, const X509_NAME *name, int obase); +int X509_NAME_print_ex(BIO *out, const X509_NAME *nm, int indent, + unsigned long flags); +int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflag, + unsigned long cflag); +int X509_print(BIO *bp, X509 *x); +int X509_ocspid_print(BIO *bp, X509 *x); +int X509_CRL_print_ex(BIO *out, X509_CRL *x, unsigned long nmflag); +int X509_CRL_print(BIO *bp, X509_CRL *x); +int X509_REQ_print_ex(BIO *bp, X509_REQ *x, unsigned long nmflag, + unsigned long cflag); +int X509_REQ_print(BIO *bp, X509_REQ *req); + +int X509_NAME_entry_count(const X509_NAME *name); +int X509_NAME_get_text_by_NID(X509_NAME *name, int nid, char *buf, int len); +int X509_NAME_get_text_by_OBJ(X509_NAME *name, const ASN1_OBJECT *obj, + char *buf, int len); + +/* + * NOTE: you should be passing -1, not 0 as lastpos. The functions that use + * lastpos, search after that position on. + */ +int X509_NAME_get_index_by_NID(X509_NAME *name, int nid, int lastpos); +int X509_NAME_get_index_by_OBJ(X509_NAME *name, const ASN1_OBJECT *obj, + int lastpos); +X509_NAME_ENTRY *X509_NAME_get_entry(const X509_NAME *name, int loc); +X509_NAME_ENTRY *X509_NAME_delete_entry(X509_NAME *name, int loc); +int X509_NAME_add_entry(X509_NAME *name, const X509_NAME_ENTRY *ne, + int loc, int set); +int X509_NAME_add_entry_by_OBJ(X509_NAME *name, const ASN1_OBJECT *obj, int type, + const unsigned char *bytes, int len, int loc, + int set); +int X509_NAME_add_entry_by_NID(X509_NAME *name, int nid, int type, + const unsigned char *bytes, int len, int loc, + int set); +X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_txt(X509_NAME_ENTRY **ne, + const char *field, int type, + const unsigned char *bytes, + int len); +X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_NID(X509_NAME_ENTRY **ne, int nid, + int type, + const unsigned char *bytes, + int len); +int X509_NAME_add_entry_by_txt(X509_NAME *name, const char *field, int type, + const unsigned char *bytes, int len, int loc, + int set); +X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_OBJ(X509_NAME_ENTRY **ne, + const ASN1_OBJECT *obj, int type, + const unsigned char *bytes, + int len); +int X509_NAME_ENTRY_set_object(X509_NAME_ENTRY *ne, const ASN1_OBJECT *obj); +int X509_NAME_ENTRY_set_data(X509_NAME_ENTRY *ne, int type, + const unsigned char *bytes, int len); +ASN1_OBJECT *X509_NAME_ENTRY_get_object(const X509_NAME_ENTRY *ne); +ASN1_STRING * X509_NAME_ENTRY_get_data(const X509_NAME_ENTRY *ne); +int X509_NAME_ENTRY_set(const X509_NAME_ENTRY *ne); + +int X509_NAME_get0_der(X509_NAME *nm, const unsigned char **pder, + size_t *pderlen); + +int X509v3_get_ext_count(const STACK_OF(X509_EXTENSION) *x); +int X509v3_get_ext_by_NID(const STACK_OF(X509_EXTENSION) *x, + int nid, int lastpos); +int X509v3_get_ext_by_OBJ(const STACK_OF(X509_EXTENSION) *x, + const ASN1_OBJECT *obj, int lastpos); +int X509v3_get_ext_by_critical(const STACK_OF(X509_EXTENSION) *x, + int crit, int lastpos); +X509_EXTENSION *X509v3_get_ext(const STACK_OF(X509_EXTENSION) *x, int loc); +X509_EXTENSION *X509v3_delete_ext(STACK_OF(X509_EXTENSION) *x, int loc); +STACK_OF(X509_EXTENSION) *X509v3_add_ext(STACK_OF(X509_EXTENSION) **x, + X509_EXTENSION *ex, int loc); + +int X509_get_ext_count(const X509 *x); +int X509_get_ext_by_NID(const X509 *x, int nid, int lastpos); +int X509_get_ext_by_OBJ(const X509 *x, const ASN1_OBJECT *obj, int lastpos); +int X509_get_ext_by_critical(const X509 *x, int crit, int lastpos); +X509_EXTENSION *X509_get_ext(const X509 *x, int loc); +X509_EXTENSION *X509_delete_ext(X509 *x, int loc); +int X509_add_ext(X509 *x, X509_EXTENSION *ex, int loc); +void *X509_get_ext_d2i(const X509 *x, int nid, int *crit, int *idx); +int X509_add1_ext_i2d(X509 *x, int nid, void *value, int crit, + unsigned long flags); + +int X509_CRL_get_ext_count(const X509_CRL *x); +int X509_CRL_get_ext_by_NID(const X509_CRL *x, int nid, int lastpos); +int X509_CRL_get_ext_by_OBJ(const X509_CRL *x, const ASN1_OBJECT *obj, + int lastpos); +int X509_CRL_get_ext_by_critical(const X509_CRL *x, int crit, int lastpos); +X509_EXTENSION *X509_CRL_get_ext(const X509_CRL *x, int loc); +X509_EXTENSION *X509_CRL_delete_ext(X509_CRL *x, int loc); +int X509_CRL_add_ext(X509_CRL *x, X509_EXTENSION *ex, int loc); +void *X509_CRL_get_ext_d2i(const X509_CRL *x, int nid, int *crit, int *idx); +int X509_CRL_add1_ext_i2d(X509_CRL *x, int nid, void *value, int crit, + unsigned long flags); + +int X509_REVOKED_get_ext_count(const X509_REVOKED *x); +int X509_REVOKED_get_ext_by_NID(const X509_REVOKED *x, int nid, int lastpos); +int X509_REVOKED_get_ext_by_OBJ(const X509_REVOKED *x, const ASN1_OBJECT *obj, + int lastpos); +int X509_REVOKED_get_ext_by_critical(const X509_REVOKED *x, int crit, + int lastpos); +X509_EXTENSION *X509_REVOKED_get_ext(const X509_REVOKED *x, int loc); +X509_EXTENSION *X509_REVOKED_delete_ext(X509_REVOKED *x, int loc); +int X509_REVOKED_add_ext(X509_REVOKED *x, X509_EXTENSION *ex, int loc); +void *X509_REVOKED_get_ext_d2i(const X509_REVOKED *x, int nid, int *crit, + int *idx); +int X509_REVOKED_add1_ext_i2d(X509_REVOKED *x, int nid, void *value, int crit, + unsigned long flags); + +X509_EXTENSION *X509_EXTENSION_create_by_NID(X509_EXTENSION **ex, + int nid, int crit, + ASN1_OCTET_STRING *data); +X509_EXTENSION *X509_EXTENSION_create_by_OBJ(X509_EXTENSION **ex, + const ASN1_OBJECT *obj, int crit, + ASN1_OCTET_STRING *data); +int X509_EXTENSION_set_object(X509_EXTENSION *ex, const ASN1_OBJECT *obj); +int X509_EXTENSION_set_critical(X509_EXTENSION *ex, int crit); +int X509_EXTENSION_set_data(X509_EXTENSION *ex, ASN1_OCTET_STRING *data); +ASN1_OBJECT *X509_EXTENSION_get_object(X509_EXTENSION *ex); +ASN1_OCTET_STRING *X509_EXTENSION_get_data(X509_EXTENSION *ne); +int X509_EXTENSION_get_critical(const X509_EXTENSION *ex); + +int X509at_get_attr_count(const STACK_OF(X509_ATTRIBUTE) *x); +int X509at_get_attr_by_NID(const STACK_OF(X509_ATTRIBUTE) *x, int nid, + int lastpos); +int X509at_get_attr_by_OBJ(const STACK_OF(X509_ATTRIBUTE) *sk, + const ASN1_OBJECT *obj, int lastpos); +X509_ATTRIBUTE *X509at_get_attr(const STACK_OF(X509_ATTRIBUTE) *x, int loc); +X509_ATTRIBUTE *X509at_delete_attr(STACK_OF(X509_ATTRIBUTE) *x, int loc); +STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr(STACK_OF(X509_ATTRIBUTE) **x, + X509_ATTRIBUTE *attr); +STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_OBJ(STACK_OF(X509_ATTRIBUTE) + **x, const ASN1_OBJECT *obj, + int type, + const unsigned char *bytes, + int len); +STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_NID(STACK_OF(X509_ATTRIBUTE) + **x, int nid, int type, + const unsigned char *bytes, + int len); +STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_txt(STACK_OF(X509_ATTRIBUTE) + **x, const char *attrname, + int type, + const unsigned char *bytes, + int len); +void *X509at_get0_data_by_OBJ(STACK_OF(X509_ATTRIBUTE) *x, + const ASN1_OBJECT *obj, int lastpos, int type); +X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_NID(X509_ATTRIBUTE **attr, int nid, + int atrtype, const void *data, + int len); +X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_OBJ(X509_ATTRIBUTE **attr, + const ASN1_OBJECT *obj, + int atrtype, const void *data, + int len); +X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_txt(X509_ATTRIBUTE **attr, + const char *atrname, int type, + const unsigned char *bytes, + int len); +int X509_ATTRIBUTE_set1_object(X509_ATTRIBUTE *attr, const ASN1_OBJECT *obj); +int X509_ATTRIBUTE_set1_data(X509_ATTRIBUTE *attr, int attrtype, + const void *data, int len); +void *X509_ATTRIBUTE_get0_data(X509_ATTRIBUTE *attr, int idx, int atrtype, + void *data); +int X509_ATTRIBUTE_count(const X509_ATTRIBUTE *attr); +ASN1_OBJECT *X509_ATTRIBUTE_get0_object(X509_ATTRIBUTE *attr); +ASN1_TYPE *X509_ATTRIBUTE_get0_type(X509_ATTRIBUTE *attr, int idx); + +int EVP_PKEY_get_attr_count(const EVP_PKEY *key); +int EVP_PKEY_get_attr_by_NID(const EVP_PKEY *key, int nid, int lastpos); +int EVP_PKEY_get_attr_by_OBJ(const EVP_PKEY *key, const ASN1_OBJECT *obj, + int lastpos); +X509_ATTRIBUTE *EVP_PKEY_get_attr(const EVP_PKEY *key, int loc); +X509_ATTRIBUTE *EVP_PKEY_delete_attr(EVP_PKEY *key, int loc); +int EVP_PKEY_add1_attr(EVP_PKEY *key, X509_ATTRIBUTE *attr); +int EVP_PKEY_add1_attr_by_OBJ(EVP_PKEY *key, + const ASN1_OBJECT *obj, int type, + const unsigned char *bytes, int len); +int EVP_PKEY_add1_attr_by_NID(EVP_PKEY *key, + int nid, int type, + const unsigned char *bytes, int len); +int EVP_PKEY_add1_attr_by_txt(EVP_PKEY *key, + const char *attrname, int type, + const unsigned char *bytes, int len); + +int X509_verify_cert(X509_STORE_CTX *ctx); + +/* lookup a cert from a X509 STACK */ +X509 *X509_find_by_issuer_and_serial(STACK_OF(X509) *sk, X509_NAME *name, + ASN1_INTEGER *serial); +X509 *X509_find_by_subject(STACK_OF(X509) *sk, X509_NAME *name); + +DECLARE_ASN1_FUNCTIONS(PBEPARAM) +DECLARE_ASN1_FUNCTIONS(PBE2PARAM) +DECLARE_ASN1_FUNCTIONS(PBKDF2PARAM) +#ifndef OPENSSL_NO_SCRYPT +DECLARE_ASN1_FUNCTIONS(SCRYPT_PARAMS) +#endif + +int PKCS5_pbe_set0_algor(X509_ALGOR *algor, int alg, int iter, + const unsigned char *salt, int saltlen); + +X509_ALGOR *PKCS5_pbe_set(int alg, int iter, + const unsigned char *salt, int saltlen); +X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter, + unsigned char *salt, int saltlen); +X509_ALGOR *PKCS5_pbe2_set_iv(const EVP_CIPHER *cipher, int iter, + unsigned char *salt, int saltlen, + unsigned char *aiv, int prf_nid); + +#ifndef OPENSSL_NO_SCRYPT +X509_ALGOR *PKCS5_pbe2_set_scrypt(const EVP_CIPHER *cipher, + const unsigned char *salt, int saltlen, + unsigned char *aiv, uint64_t N, uint64_t r, + uint64_t p); +#endif + +X509_ALGOR *PKCS5_pbkdf2_set(int iter, unsigned char *salt, int saltlen, + int prf_nid, int keylen); + +/* PKCS#8 utilities */ + +DECLARE_ASN1_FUNCTIONS(PKCS8_PRIV_KEY_INFO) + +EVP_PKEY *EVP_PKCS82PKEY(const PKCS8_PRIV_KEY_INFO *p8); +PKCS8_PRIV_KEY_INFO *EVP_PKEY2PKCS8(EVP_PKEY *pkey); + +int PKCS8_pkey_set0(PKCS8_PRIV_KEY_INFO *priv, ASN1_OBJECT *aobj, + int version, int ptype, void *pval, + unsigned char *penc, int penclen); +int PKCS8_pkey_get0(const ASN1_OBJECT **ppkalg, + const unsigned char **pk, int *ppklen, + const X509_ALGOR **pa, const PKCS8_PRIV_KEY_INFO *p8); + +const STACK_OF(X509_ATTRIBUTE) * +PKCS8_pkey_get0_attrs(const PKCS8_PRIV_KEY_INFO *p8); +int PKCS8_pkey_add1_attr_by_NID(PKCS8_PRIV_KEY_INFO *p8, int nid, int type, + const unsigned char *bytes, int len); + +int X509_PUBKEY_set0_param(X509_PUBKEY *pub, ASN1_OBJECT *aobj, + int ptype, void *pval, + unsigned char *penc, int penclen); +int X509_PUBKEY_get0_param(ASN1_OBJECT **ppkalg, + const unsigned char **pk, int *ppklen, + X509_ALGOR **pa, X509_PUBKEY *pub); + +int X509_check_trust(X509 *x, int id, int flags); +int X509_TRUST_get_count(void); +X509_TRUST *X509_TRUST_get0(int idx); +int X509_TRUST_get_by_id(int id); +int X509_TRUST_add(int id, int flags, int (*ck) (X509_TRUST *, X509 *, int), + const char *name, int arg1, void *arg2); +void X509_TRUST_cleanup(void); +int X509_TRUST_get_flags(const X509_TRUST *xp); +char *X509_TRUST_get0_name(const X509_TRUST *xp); +int X509_TRUST_get_trust(const X509_TRUST *xp); + +# ifdef __cplusplus +} +# endif +#endif diff --git a/ONVIF/include/openssl/include/openssl/x509_vfy.h b/ONVIF/include/openssl/include/openssl/x509_vfy.h new file mode 100644 index 0000000..adb8bce --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/x509_vfy.h @@ -0,0 +1,628 @@ +/* + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_X509_VFY_H +# define HEADER_X509_VFY_H + +/* + * Protect against recursion, x509.h and x509_vfy.h each include the other. + */ +# ifndef HEADER_X509_H +# include +# endif + +# include +# include +# include +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + +/*- +SSL_CTX -> X509_STORE + -> X509_LOOKUP + ->X509_LOOKUP_METHOD + -> X509_LOOKUP + ->X509_LOOKUP_METHOD + +SSL -> X509_STORE_CTX + ->X509_STORE + +The X509_STORE holds the tables etc for verification stuff. +A X509_STORE_CTX is used while validating a single certificate. +The X509_STORE has X509_LOOKUPs for looking up certs. +The X509_STORE then calls a function to actually verify the +certificate chain. +*/ + +typedef enum { + X509_LU_NONE = 0, + X509_LU_X509, X509_LU_CRL +} X509_LOOKUP_TYPE; + +#if OPENSSL_API_COMPAT < 0x10100000L +#define X509_LU_RETRY -1 +#define X509_LU_FAIL 0 +#endif + +DEFINE_STACK_OF(X509_LOOKUP) +DEFINE_STACK_OF(X509_OBJECT) +DEFINE_STACK_OF(X509_VERIFY_PARAM) + +int X509_STORE_set_depth(X509_STORE *store, int depth); + +typedef int (*X509_STORE_CTX_verify_cb)(int, X509_STORE_CTX *); +typedef int (*X509_STORE_CTX_verify_fn)(X509_STORE_CTX *); +typedef int (*X509_STORE_CTX_get_issuer_fn)(X509 **issuer, + X509_STORE_CTX *ctx, X509 *x); +typedef int (*X509_STORE_CTX_check_issued_fn)(X509_STORE_CTX *ctx, + X509 *x, X509 *issuer); +typedef int (*X509_STORE_CTX_check_revocation_fn)(X509_STORE_CTX *ctx); +typedef int (*X509_STORE_CTX_get_crl_fn)(X509_STORE_CTX *ctx, + X509_CRL **crl, X509 *x); +typedef int (*X509_STORE_CTX_check_crl_fn)(X509_STORE_CTX *ctx, X509_CRL *crl); +typedef int (*X509_STORE_CTX_cert_crl_fn)(X509_STORE_CTX *ctx, + X509_CRL *crl, X509 *x); +typedef int (*X509_STORE_CTX_check_policy_fn)(X509_STORE_CTX *ctx); +typedef STACK_OF(X509) *(*X509_STORE_CTX_lookup_certs_fn)(X509_STORE_CTX *ctx, + X509_NAME *nm); +typedef STACK_OF(X509_CRL) *(*X509_STORE_CTX_lookup_crls_fn)(X509_STORE_CTX *ctx, + X509_NAME *nm); +typedef int (*X509_STORE_CTX_cleanup_fn)(X509_STORE_CTX *ctx); + + +void X509_STORE_CTX_set_depth(X509_STORE_CTX *ctx, int depth); + +# define X509_STORE_CTX_set_app_data(ctx,data) \ + X509_STORE_CTX_set_ex_data(ctx,0,data) +# define X509_STORE_CTX_get_app_data(ctx) \ + X509_STORE_CTX_get_ex_data(ctx,0) + +# define X509_L_FILE_LOAD 1 +# define X509_L_ADD_DIR 2 + +# define X509_LOOKUP_load_file(x,name,type) \ + X509_LOOKUP_ctrl((x),X509_L_FILE_LOAD,(name),(long)(type),NULL) + +# define X509_LOOKUP_add_dir(x,name,type) \ + X509_LOOKUP_ctrl((x),X509_L_ADD_DIR,(name),(long)(type),NULL) + +# define X509_V_OK 0 +# define X509_V_ERR_UNSPECIFIED 1 +# define X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT 2 +# define X509_V_ERR_UNABLE_TO_GET_CRL 3 +# define X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE 4 +# define X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE 5 +# define X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY 6 +# define X509_V_ERR_CERT_SIGNATURE_FAILURE 7 +# define X509_V_ERR_CRL_SIGNATURE_FAILURE 8 +# define X509_V_ERR_CERT_NOT_YET_VALID 9 +# define X509_V_ERR_CERT_HAS_EXPIRED 10 +# define X509_V_ERR_CRL_NOT_YET_VALID 11 +# define X509_V_ERR_CRL_HAS_EXPIRED 12 +# define X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD 13 +# define X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD 14 +# define X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD 15 +# define X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD 16 +# define X509_V_ERR_OUT_OF_MEM 17 +# define X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT 18 +# define X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN 19 +# define X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY 20 +# define X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE 21 +# define X509_V_ERR_CERT_CHAIN_TOO_LONG 22 +# define X509_V_ERR_CERT_REVOKED 23 +# define X509_V_ERR_INVALID_CA 24 +# define X509_V_ERR_PATH_LENGTH_EXCEEDED 25 +# define X509_V_ERR_INVALID_PURPOSE 26 +# define X509_V_ERR_CERT_UNTRUSTED 27 +# define X509_V_ERR_CERT_REJECTED 28 +/* These are 'informational' when looking for issuer cert */ +# define X509_V_ERR_SUBJECT_ISSUER_MISMATCH 29 +# define X509_V_ERR_AKID_SKID_MISMATCH 30 +# define X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH 31 +# define X509_V_ERR_KEYUSAGE_NO_CERTSIGN 32 +# define X509_V_ERR_UNABLE_TO_GET_CRL_ISSUER 33 +# define X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION 34 +# define X509_V_ERR_KEYUSAGE_NO_CRL_SIGN 35 +# define X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION 36 +# define X509_V_ERR_INVALID_NON_CA 37 +# define X509_V_ERR_PROXY_PATH_LENGTH_EXCEEDED 38 +# define X509_V_ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE 39 +# define X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED 40 +# define X509_V_ERR_INVALID_EXTENSION 41 +# define X509_V_ERR_INVALID_POLICY_EXTENSION 42 +# define X509_V_ERR_NO_EXPLICIT_POLICY 43 +# define X509_V_ERR_DIFFERENT_CRL_SCOPE 44 +# define X509_V_ERR_UNSUPPORTED_EXTENSION_FEATURE 45 +# define X509_V_ERR_UNNESTED_RESOURCE 46 +# define X509_V_ERR_PERMITTED_VIOLATION 47 +# define X509_V_ERR_EXCLUDED_VIOLATION 48 +# define X509_V_ERR_SUBTREE_MINMAX 49 +/* The application is not happy */ +# define X509_V_ERR_APPLICATION_VERIFICATION 50 +# define X509_V_ERR_UNSUPPORTED_CONSTRAINT_TYPE 51 +# define X509_V_ERR_UNSUPPORTED_CONSTRAINT_SYNTAX 52 +# define X509_V_ERR_UNSUPPORTED_NAME_SYNTAX 53 +# define X509_V_ERR_CRL_PATH_VALIDATION_ERROR 54 +/* Another issuer check debug option */ +# define X509_V_ERR_PATH_LOOP 55 +/* Suite B mode algorithm violation */ +# define X509_V_ERR_SUITE_B_INVALID_VERSION 56 +# define X509_V_ERR_SUITE_B_INVALID_ALGORITHM 57 +# define X509_V_ERR_SUITE_B_INVALID_CURVE 58 +# define X509_V_ERR_SUITE_B_INVALID_SIGNATURE_ALGORITHM 59 +# define X509_V_ERR_SUITE_B_LOS_NOT_ALLOWED 60 +# define X509_V_ERR_SUITE_B_CANNOT_SIGN_P_384_WITH_P_256 61 +/* Host, email and IP check errors */ +# define X509_V_ERR_HOSTNAME_MISMATCH 62 +# define X509_V_ERR_EMAIL_MISMATCH 63 +# define X509_V_ERR_IP_ADDRESS_MISMATCH 64 +/* DANE TLSA errors */ +# define X509_V_ERR_DANE_NO_MATCH 65 +/* security level errors */ +# define X509_V_ERR_EE_KEY_TOO_SMALL 66 +# define X509_V_ERR_CA_KEY_TOO_SMALL 67 +# define X509_V_ERR_CA_MD_TOO_WEAK 68 +/* Caller error */ +# define X509_V_ERR_INVALID_CALL 69 +/* Issuer lookup error */ +# define X509_V_ERR_STORE_LOOKUP 70 +/* Certificate transparency */ +# define X509_V_ERR_NO_VALID_SCTS 71 + +# define X509_V_ERR_PROXY_SUBJECT_NAME_VIOLATION 72 +/* OCSP status errors */ +# define X509_V_ERR_OCSP_VERIFY_NEEDED 73 /* Need OCSP verification */ +# define X509_V_ERR_OCSP_VERIFY_FAILED 74 /* Couldn't verify cert through OCSP */ +# define X509_V_ERR_OCSP_CERT_UNKNOWN 75 /* Certificate wasn't recognized by the OCSP responder */ + +/* Certificate verify flags */ + +# if OPENSSL_API_COMPAT < 0x10100000L +# define X509_V_FLAG_CB_ISSUER_CHECK 0x0 /* Deprecated */ +# endif +/* Use check time instead of current time */ +# define X509_V_FLAG_USE_CHECK_TIME 0x2 +/* Lookup CRLs */ +# define X509_V_FLAG_CRL_CHECK 0x4 +/* Lookup CRLs for whole chain */ +# define X509_V_FLAG_CRL_CHECK_ALL 0x8 +/* Ignore unhandled critical extensions */ +# define X509_V_FLAG_IGNORE_CRITICAL 0x10 +/* Disable workarounds for broken certificates */ +# define X509_V_FLAG_X509_STRICT 0x20 +/* Enable proxy certificate validation */ +# define X509_V_FLAG_ALLOW_PROXY_CERTS 0x40 +/* Enable policy checking */ +# define X509_V_FLAG_POLICY_CHECK 0x80 +/* Policy variable require-explicit-policy */ +# define X509_V_FLAG_EXPLICIT_POLICY 0x100 +/* Policy variable inhibit-any-policy */ +# define X509_V_FLAG_INHIBIT_ANY 0x200 +/* Policy variable inhibit-policy-mapping */ +# define X509_V_FLAG_INHIBIT_MAP 0x400 +/* Notify callback that policy is OK */ +# define X509_V_FLAG_NOTIFY_POLICY 0x800 +/* Extended CRL features such as indirect CRLs, alternate CRL signing keys */ +# define X509_V_FLAG_EXTENDED_CRL_SUPPORT 0x1000 +/* Delta CRL support */ +# define X509_V_FLAG_USE_DELTAS 0x2000 +/* Check self-signed CA signature */ +# define X509_V_FLAG_CHECK_SS_SIGNATURE 0x4000 +/* Use trusted store first */ +# define X509_V_FLAG_TRUSTED_FIRST 0x8000 +/* Suite B 128 bit only mode: not normally used */ +# define X509_V_FLAG_SUITEB_128_LOS_ONLY 0x10000 +/* Suite B 192 bit only mode */ +# define X509_V_FLAG_SUITEB_192_LOS 0x20000 +/* Suite B 128 bit mode allowing 192 bit algorithms */ +# define X509_V_FLAG_SUITEB_128_LOS 0x30000 +/* Allow partial chains if at least one certificate is in trusted store */ +# define X509_V_FLAG_PARTIAL_CHAIN 0x80000 +/* + * If the initial chain is not trusted, do not attempt to build an alternative + * chain. Alternate chain checking was introduced in 1.1.0. Setting this flag + * will force the behaviour to match that of previous versions. + */ +# define X509_V_FLAG_NO_ALT_CHAINS 0x100000 +/* Do not check certificate/CRL validity against current time */ +# define X509_V_FLAG_NO_CHECK_TIME 0x200000 + +# define X509_VP_FLAG_DEFAULT 0x1 +# define X509_VP_FLAG_OVERWRITE 0x2 +# define X509_VP_FLAG_RESET_FLAGS 0x4 +# define X509_VP_FLAG_LOCKED 0x8 +# define X509_VP_FLAG_ONCE 0x10 + +/* Internal use: mask of policy related options */ +# define X509_V_FLAG_POLICY_MASK (X509_V_FLAG_POLICY_CHECK \ + | X509_V_FLAG_EXPLICIT_POLICY \ + | X509_V_FLAG_INHIBIT_ANY \ + | X509_V_FLAG_INHIBIT_MAP) + +int X509_OBJECT_idx_by_subject(STACK_OF(X509_OBJECT) *h, X509_LOOKUP_TYPE type, + X509_NAME *name); +X509_OBJECT *X509_OBJECT_retrieve_by_subject(STACK_OF(X509_OBJECT) *h, + X509_LOOKUP_TYPE type, + X509_NAME *name); +X509_OBJECT *X509_OBJECT_retrieve_match(STACK_OF(X509_OBJECT) *h, + X509_OBJECT *x); +int X509_OBJECT_up_ref_count(X509_OBJECT *a); +X509_OBJECT *X509_OBJECT_new(void); +void X509_OBJECT_free(X509_OBJECT *a); +X509_LOOKUP_TYPE X509_OBJECT_get_type(const X509_OBJECT *a); +X509 *X509_OBJECT_get0_X509(const X509_OBJECT *a); +int X509_OBJECT_set1_X509(X509_OBJECT *a, X509 *obj); +X509_CRL *X509_OBJECT_get0_X509_CRL(X509_OBJECT *a); +int X509_OBJECT_set1_X509_CRL(X509_OBJECT *a, X509_CRL *obj); +X509_STORE *X509_STORE_new(void); +void X509_STORE_free(X509_STORE *v); +int X509_STORE_lock(X509_STORE *ctx); +int X509_STORE_unlock(X509_STORE *ctx); +int X509_STORE_up_ref(X509_STORE *v); +STACK_OF(X509_OBJECT) *X509_STORE_get0_objects(X509_STORE *v); + +STACK_OF(X509) *X509_STORE_CTX_get1_certs(X509_STORE_CTX *st, X509_NAME *nm); +STACK_OF(X509_CRL) *X509_STORE_CTX_get1_crls(X509_STORE_CTX *st, X509_NAME *nm); +int X509_STORE_set_flags(X509_STORE *ctx, unsigned long flags); +int X509_STORE_set_purpose(X509_STORE *ctx, int purpose); +int X509_STORE_set_trust(X509_STORE *ctx, int trust); +int X509_STORE_set1_param(X509_STORE *ctx, X509_VERIFY_PARAM *pm); +X509_VERIFY_PARAM *X509_STORE_get0_param(X509_STORE *ctx); + +void X509_STORE_set_verify(X509_STORE *ctx, X509_STORE_CTX_verify_fn verify); +#define X509_STORE_set_verify_func(ctx, func) \ + X509_STORE_set_verify((ctx),(func)) +void X509_STORE_CTX_set_verify(X509_STORE_CTX *ctx, + X509_STORE_CTX_verify_fn verify); +X509_STORE_CTX_verify_fn X509_STORE_get_verify(X509_STORE *ctx); +void X509_STORE_set_verify_cb(X509_STORE *ctx, + X509_STORE_CTX_verify_cb verify_cb); +# define X509_STORE_set_verify_cb_func(ctx,func) \ + X509_STORE_set_verify_cb((ctx),(func)) +X509_STORE_CTX_verify_cb X509_STORE_get_verify_cb(X509_STORE *ctx); +void X509_STORE_set_get_issuer(X509_STORE *ctx, + X509_STORE_CTX_get_issuer_fn get_issuer); +X509_STORE_CTX_get_issuer_fn X509_STORE_get_get_issuer(X509_STORE *ctx); +void X509_STORE_set_check_issued(X509_STORE *ctx, + X509_STORE_CTX_check_issued_fn check_issued); +X509_STORE_CTX_check_issued_fn X509_STORE_get_check_issued(X509_STORE *ctx); +void X509_STORE_set_check_revocation(X509_STORE *ctx, + X509_STORE_CTX_check_revocation_fn check_revocation); +X509_STORE_CTX_check_revocation_fn X509_STORE_get_check_revocation(X509_STORE *ctx); +void X509_STORE_set_get_crl(X509_STORE *ctx, + X509_STORE_CTX_get_crl_fn get_crl); +X509_STORE_CTX_get_crl_fn X509_STORE_get_get_crl(X509_STORE *ctx); +void X509_STORE_set_check_crl(X509_STORE *ctx, + X509_STORE_CTX_check_crl_fn check_crl); +X509_STORE_CTX_check_crl_fn X509_STORE_get_check_crl(X509_STORE *ctx); +void X509_STORE_set_cert_crl(X509_STORE *ctx, + X509_STORE_CTX_cert_crl_fn cert_crl); +X509_STORE_CTX_cert_crl_fn X509_STORE_get_cert_crl(X509_STORE *ctx); +void X509_STORE_set_check_policy(X509_STORE *ctx, + X509_STORE_CTX_check_policy_fn check_policy); +X509_STORE_CTX_check_policy_fn X509_STORE_get_check_policy(X509_STORE *ctx); +void X509_STORE_set_lookup_certs(X509_STORE *ctx, + X509_STORE_CTX_lookup_certs_fn lookup_certs); +X509_STORE_CTX_lookup_certs_fn X509_STORE_get_lookup_certs(X509_STORE *ctx); +void X509_STORE_set_lookup_crls(X509_STORE *ctx, + X509_STORE_CTX_lookup_crls_fn lookup_crls); +#define X509_STORE_set_lookup_crls_cb(ctx, func) \ + X509_STORE_set_lookup_crls((ctx), (func)) +X509_STORE_CTX_lookup_crls_fn X509_STORE_get_lookup_crls(X509_STORE *ctx); +void X509_STORE_set_cleanup(X509_STORE *ctx, + X509_STORE_CTX_cleanup_fn cleanup); +X509_STORE_CTX_cleanup_fn X509_STORE_get_cleanup(X509_STORE *ctx); + +#define X509_STORE_get_ex_new_index(l, p, newf, dupf, freef) \ + CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_X509_STORE, l, p, newf, dupf, freef) +int X509_STORE_set_ex_data(X509_STORE *ctx, int idx, void *data); +void *X509_STORE_get_ex_data(X509_STORE *ctx, int idx); + +X509_STORE_CTX *X509_STORE_CTX_new(void); + +int X509_STORE_CTX_get1_issuer(X509 **issuer, X509_STORE_CTX *ctx, X509 *x); + +void X509_STORE_CTX_free(X509_STORE_CTX *ctx); +int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, + X509 *x509, STACK_OF(X509) *chain); +void X509_STORE_CTX_set0_trusted_stack(X509_STORE_CTX *ctx, STACK_OF(X509) *sk); +void X509_STORE_CTX_cleanup(X509_STORE_CTX *ctx); + +X509_STORE *X509_STORE_CTX_get0_store(X509_STORE_CTX *ctx); +X509 *X509_STORE_CTX_get0_cert(X509_STORE_CTX *ctx); +STACK_OF(X509)* X509_STORE_CTX_get0_untrusted(X509_STORE_CTX *ctx); +void X509_STORE_CTX_set0_untrusted(X509_STORE_CTX *ctx, STACK_OF(X509) *sk); +void X509_STORE_CTX_set_verify_cb(X509_STORE_CTX *ctx, + X509_STORE_CTX_verify_cb verify); +X509_STORE_CTX_verify_cb X509_STORE_CTX_get_verify_cb(X509_STORE_CTX *ctx); +X509_STORE_CTX_verify_fn X509_STORE_CTX_get_verify(X509_STORE_CTX *ctx); +X509_STORE_CTX_get_issuer_fn X509_STORE_CTX_get_get_issuer(X509_STORE_CTX *ctx); +X509_STORE_CTX_check_issued_fn X509_STORE_CTX_get_check_issued(X509_STORE_CTX *ctx); +X509_STORE_CTX_check_revocation_fn X509_STORE_CTX_get_check_revocation(X509_STORE_CTX *ctx); +X509_STORE_CTX_get_crl_fn X509_STORE_CTX_get_get_crl(X509_STORE_CTX *ctx); +X509_STORE_CTX_check_crl_fn X509_STORE_CTX_get_check_crl(X509_STORE_CTX *ctx); +X509_STORE_CTX_cert_crl_fn X509_STORE_CTX_get_cert_crl(X509_STORE_CTX *ctx); +X509_STORE_CTX_check_policy_fn X509_STORE_CTX_get_check_policy(X509_STORE_CTX *ctx); +X509_STORE_CTX_lookup_certs_fn X509_STORE_CTX_get_lookup_certs(X509_STORE_CTX *ctx); +X509_STORE_CTX_lookup_crls_fn X509_STORE_CTX_get_lookup_crls(X509_STORE_CTX *ctx); +X509_STORE_CTX_cleanup_fn X509_STORE_CTX_get_cleanup(X509_STORE_CTX *ctx); + +#if OPENSSL_API_COMPAT < 0x10100000L +# define X509_STORE_CTX_get_chain X509_STORE_CTX_get0_chain +# define X509_STORE_CTX_set_chain X509_STORE_CTX_set0_untrusted +# define X509_STORE_CTX_trusted_stack X509_STORE_CTX_set0_trusted_stack +# define X509_STORE_get_by_subject X509_STORE_CTX_get_by_subject +# define X509_STORE_get1_certs X509_STORE_CTX_get1_certs +# define X509_STORE_get1_crls X509_STORE_CTX_get1_crls +/* the following macro is misspelled; use X509_STORE_get1_certs instead */ +# define X509_STORE_get1_cert X509_STORE_CTX_get1_certs +/* the following macro is misspelled; use X509_STORE_get1_crls instead */ +# define X509_STORE_get1_crl X509_STORE_CTX_get1_crls +#endif + +X509_LOOKUP *X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m); +X509_LOOKUP_METHOD *X509_LOOKUP_hash_dir(void); +X509_LOOKUP_METHOD *X509_LOOKUP_file(void); + +typedef int (*X509_LOOKUP_ctrl_fn)(X509_LOOKUP *ctx, int cmd, const char *argc, + long argl, char **ret); +typedef int (*X509_LOOKUP_get_by_subject_fn)(X509_LOOKUP *ctx, + X509_LOOKUP_TYPE type, + X509_NAME *name, + X509_OBJECT *ret); +typedef int (*X509_LOOKUP_get_by_issuer_serial_fn)(X509_LOOKUP *ctx, + X509_LOOKUP_TYPE type, + X509_NAME *name, + ASN1_INTEGER *serial, + X509_OBJECT *ret); +typedef int (*X509_LOOKUP_get_by_fingerprint_fn)(X509_LOOKUP *ctx, + X509_LOOKUP_TYPE type, + const unsigned char* bytes, + int len, + X509_OBJECT *ret); +typedef int (*X509_LOOKUP_get_by_alias_fn)(X509_LOOKUP *ctx, + X509_LOOKUP_TYPE type, + const char *str, + int len, + X509_OBJECT *ret); + +X509_LOOKUP_METHOD *X509_LOOKUP_meth_new(const char *name); +void X509_LOOKUP_meth_free(X509_LOOKUP_METHOD *method); + +int X509_LOOKUP_meth_set_new_item(X509_LOOKUP_METHOD *method, + int (*new_item) (X509_LOOKUP *ctx)); +int (*X509_LOOKUP_meth_get_new_item(const X509_LOOKUP_METHOD* method)) + (X509_LOOKUP *ctx); + +int X509_LOOKUP_meth_set_free(X509_LOOKUP_METHOD *method, + void (*free_fn) (X509_LOOKUP *ctx)); +void (*X509_LOOKUP_meth_get_free(const X509_LOOKUP_METHOD* method)) + (X509_LOOKUP *ctx); + +int X509_LOOKUP_meth_set_init(X509_LOOKUP_METHOD *method, + int (*init) (X509_LOOKUP *ctx)); +int (*X509_LOOKUP_meth_get_init(const X509_LOOKUP_METHOD* method)) + (X509_LOOKUP *ctx); + +int X509_LOOKUP_meth_set_shutdown(X509_LOOKUP_METHOD *method, + int (*shutdown) (X509_LOOKUP *ctx)); +int (*X509_LOOKUP_meth_get_shutdown(const X509_LOOKUP_METHOD* method)) + (X509_LOOKUP *ctx); + +int X509_LOOKUP_meth_set_ctrl(X509_LOOKUP_METHOD *method, + X509_LOOKUP_ctrl_fn ctrl_fn); +X509_LOOKUP_ctrl_fn X509_LOOKUP_meth_get_ctrl(const X509_LOOKUP_METHOD *method); + +int X509_LOOKUP_meth_set_get_by_subject(X509_LOOKUP_METHOD *method, + X509_LOOKUP_get_by_subject_fn fn); +X509_LOOKUP_get_by_subject_fn X509_LOOKUP_meth_get_get_by_subject( + const X509_LOOKUP_METHOD *method); + +int X509_LOOKUP_meth_set_get_by_issuer_serial(X509_LOOKUP_METHOD *method, + X509_LOOKUP_get_by_issuer_serial_fn fn); +X509_LOOKUP_get_by_issuer_serial_fn X509_LOOKUP_meth_get_get_by_issuer_serial( + const X509_LOOKUP_METHOD *method); + +int X509_LOOKUP_meth_set_get_by_fingerprint(X509_LOOKUP_METHOD *method, + X509_LOOKUP_get_by_fingerprint_fn fn); +X509_LOOKUP_get_by_fingerprint_fn X509_LOOKUP_meth_get_get_by_fingerprint( + const X509_LOOKUP_METHOD *method); + +int X509_LOOKUP_meth_set_get_by_alias(X509_LOOKUP_METHOD *method, + X509_LOOKUP_get_by_alias_fn fn); +X509_LOOKUP_get_by_alias_fn X509_LOOKUP_meth_get_get_by_alias( + const X509_LOOKUP_METHOD *method); + + +int X509_STORE_add_cert(X509_STORE *ctx, X509 *x); +int X509_STORE_add_crl(X509_STORE *ctx, X509_CRL *x); + +int X509_STORE_CTX_get_by_subject(X509_STORE_CTX *vs, X509_LOOKUP_TYPE type, + X509_NAME *name, X509_OBJECT *ret); +X509_OBJECT *X509_STORE_CTX_get_obj_by_subject(X509_STORE_CTX *vs, + X509_LOOKUP_TYPE type, + X509_NAME *name); + +int X509_LOOKUP_ctrl(X509_LOOKUP *ctx, int cmd, const char *argc, + long argl, char **ret); + +int X509_load_cert_file(X509_LOOKUP *ctx, const char *file, int type); +int X509_load_crl_file(X509_LOOKUP *ctx, const char *file, int type); +int X509_load_cert_crl_file(X509_LOOKUP *ctx, const char *file, int type); + +X509_LOOKUP *X509_LOOKUP_new(X509_LOOKUP_METHOD *method); +void X509_LOOKUP_free(X509_LOOKUP *ctx); +int X509_LOOKUP_init(X509_LOOKUP *ctx); +int X509_LOOKUP_by_subject(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, + X509_NAME *name, X509_OBJECT *ret); +int X509_LOOKUP_by_issuer_serial(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, + X509_NAME *name, ASN1_INTEGER *serial, + X509_OBJECT *ret); +int X509_LOOKUP_by_fingerprint(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, + const unsigned char *bytes, int len, + X509_OBJECT *ret); +int X509_LOOKUP_by_alias(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, + const char *str, int len, X509_OBJECT *ret); +int X509_LOOKUP_set_method_data(X509_LOOKUP *ctx, void *data); +void *X509_LOOKUP_get_method_data(const X509_LOOKUP *ctx); +X509_STORE *X509_LOOKUP_get_store(const X509_LOOKUP *ctx); +int X509_LOOKUP_shutdown(X509_LOOKUP *ctx); + +int X509_STORE_load_locations(X509_STORE *ctx, + const char *file, const char *dir); +int X509_STORE_set_default_paths(X509_STORE *ctx); + +#define X509_STORE_CTX_get_ex_new_index(l, p, newf, dupf, freef) \ + CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_X509_STORE_CTX, l, p, newf, dupf, freef) +int X509_STORE_CTX_set_ex_data(X509_STORE_CTX *ctx, int idx, void *data); +void *X509_STORE_CTX_get_ex_data(X509_STORE_CTX *ctx, int idx); +int X509_STORE_CTX_get_error(X509_STORE_CTX *ctx); +void X509_STORE_CTX_set_error(X509_STORE_CTX *ctx, int s); +int X509_STORE_CTX_get_error_depth(X509_STORE_CTX *ctx); +void X509_STORE_CTX_set_error_depth(X509_STORE_CTX *ctx, int depth); +X509 *X509_STORE_CTX_get_current_cert(X509_STORE_CTX *ctx); +void X509_STORE_CTX_set_current_cert(X509_STORE_CTX *ctx, X509 *x); +X509 *X509_STORE_CTX_get0_current_issuer(X509_STORE_CTX *ctx); +X509_CRL *X509_STORE_CTX_get0_current_crl(X509_STORE_CTX *ctx); +X509_STORE_CTX *X509_STORE_CTX_get0_parent_ctx(X509_STORE_CTX *ctx); +STACK_OF(X509) *X509_STORE_CTX_get0_chain(X509_STORE_CTX *ctx); +STACK_OF(X509) *X509_STORE_CTX_get1_chain(X509_STORE_CTX *ctx); +void X509_STORE_CTX_set_cert(X509_STORE_CTX *c, X509 *x); +void X509_STORE_CTX_set0_verified_chain(X509_STORE_CTX *c, STACK_OF(X509) *sk); +void X509_STORE_CTX_set0_crls(X509_STORE_CTX *c, STACK_OF(X509_CRL) *sk); +int X509_STORE_CTX_set_purpose(X509_STORE_CTX *ctx, int purpose); +int X509_STORE_CTX_set_trust(X509_STORE_CTX *ctx, int trust); +int X509_STORE_CTX_purpose_inherit(X509_STORE_CTX *ctx, int def_purpose, + int purpose, int trust); +void X509_STORE_CTX_set_flags(X509_STORE_CTX *ctx, unsigned long flags); +void X509_STORE_CTX_set_time(X509_STORE_CTX *ctx, unsigned long flags, + time_t t); + +X509_POLICY_TREE *X509_STORE_CTX_get0_policy_tree(X509_STORE_CTX *ctx); +int X509_STORE_CTX_get_explicit_policy(X509_STORE_CTX *ctx); +int X509_STORE_CTX_get_num_untrusted(X509_STORE_CTX *ctx); + +X509_VERIFY_PARAM *X509_STORE_CTX_get0_param(X509_STORE_CTX *ctx); +void X509_STORE_CTX_set0_param(X509_STORE_CTX *ctx, X509_VERIFY_PARAM *param); +int X509_STORE_CTX_set_default(X509_STORE_CTX *ctx, const char *name); + +/* + * Bridge opacity barrier between libcrypt and libssl, also needed to support + * offline testing in test/danetest.c + */ +void X509_STORE_CTX_set0_dane(X509_STORE_CTX *ctx, SSL_DANE *dane); +#define DANE_FLAG_NO_DANE_EE_NAMECHECKS (1L << 0) + +/* X509_VERIFY_PARAM functions */ + +X509_VERIFY_PARAM *X509_VERIFY_PARAM_new(void); +void X509_VERIFY_PARAM_free(X509_VERIFY_PARAM *param); +int X509_VERIFY_PARAM_inherit(X509_VERIFY_PARAM *to, + const X509_VERIFY_PARAM *from); +int X509_VERIFY_PARAM_set1(X509_VERIFY_PARAM *to, + const X509_VERIFY_PARAM *from); +int X509_VERIFY_PARAM_set1_name(X509_VERIFY_PARAM *param, const char *name); +int X509_VERIFY_PARAM_set_flags(X509_VERIFY_PARAM *param, + unsigned long flags); +int X509_VERIFY_PARAM_clear_flags(X509_VERIFY_PARAM *param, + unsigned long flags); +unsigned long X509_VERIFY_PARAM_get_flags(X509_VERIFY_PARAM *param); +int X509_VERIFY_PARAM_set_purpose(X509_VERIFY_PARAM *param, int purpose); +int X509_VERIFY_PARAM_set_trust(X509_VERIFY_PARAM *param, int trust); +void X509_VERIFY_PARAM_set_depth(X509_VERIFY_PARAM *param, int depth); +void X509_VERIFY_PARAM_set_auth_level(X509_VERIFY_PARAM *param, int auth_level); +time_t X509_VERIFY_PARAM_get_time(const X509_VERIFY_PARAM *param); +void X509_VERIFY_PARAM_set_time(X509_VERIFY_PARAM *param, time_t t); +int X509_VERIFY_PARAM_add0_policy(X509_VERIFY_PARAM *param, + ASN1_OBJECT *policy); +int X509_VERIFY_PARAM_set1_policies(X509_VERIFY_PARAM *param, + STACK_OF(ASN1_OBJECT) *policies); + +int X509_VERIFY_PARAM_set_inh_flags(X509_VERIFY_PARAM *param, + uint32_t flags); +uint32_t X509_VERIFY_PARAM_get_inh_flags(const X509_VERIFY_PARAM *param); + +int X509_VERIFY_PARAM_set1_host(X509_VERIFY_PARAM *param, + const char *name, size_t namelen); +int X509_VERIFY_PARAM_add1_host(X509_VERIFY_PARAM *param, + const char *name, size_t namelen); +void X509_VERIFY_PARAM_set_hostflags(X509_VERIFY_PARAM *param, + unsigned int flags); +unsigned int X509_VERIFY_PARAM_get_hostflags(const X509_VERIFY_PARAM *param); +char *X509_VERIFY_PARAM_get0_peername(X509_VERIFY_PARAM *); +void X509_VERIFY_PARAM_move_peername(X509_VERIFY_PARAM *, X509_VERIFY_PARAM *); +int X509_VERIFY_PARAM_set1_email(X509_VERIFY_PARAM *param, + const char *email, size_t emaillen); +int X509_VERIFY_PARAM_set1_ip(X509_VERIFY_PARAM *param, + const unsigned char *ip, size_t iplen); +int X509_VERIFY_PARAM_set1_ip_asc(X509_VERIFY_PARAM *param, + const char *ipasc); + +int X509_VERIFY_PARAM_get_depth(const X509_VERIFY_PARAM *param); +int X509_VERIFY_PARAM_get_auth_level(const X509_VERIFY_PARAM *param); +const char *X509_VERIFY_PARAM_get0_name(const X509_VERIFY_PARAM *param); + +int X509_VERIFY_PARAM_add0_table(X509_VERIFY_PARAM *param); +int X509_VERIFY_PARAM_get_count(void); +const X509_VERIFY_PARAM *X509_VERIFY_PARAM_get0(int id); +const X509_VERIFY_PARAM *X509_VERIFY_PARAM_lookup(const char *name); +void X509_VERIFY_PARAM_table_cleanup(void); + +/* Non positive return values are errors */ +#define X509_PCY_TREE_FAILURE -2 /* Failure to satisfy explicit policy */ +#define X509_PCY_TREE_INVALID -1 /* Inconsistent or invalid extensions */ +#define X509_PCY_TREE_INTERNAL 0 /* Internal error, most likely malloc */ + +/* + * Positive return values form a bit mask, all but the first are internal to + * the library and don't appear in results from X509_policy_check(). + */ +#define X509_PCY_TREE_VALID 1 /* The policy tree is valid */ +#define X509_PCY_TREE_EMPTY 2 /* The policy tree is empty */ +#define X509_PCY_TREE_EXPLICIT 4 /* Explicit policy required */ + +int X509_policy_check(X509_POLICY_TREE **ptree, int *pexplicit_policy, + STACK_OF(X509) *certs, + STACK_OF(ASN1_OBJECT) *policy_oids, unsigned int flags); + +void X509_policy_tree_free(X509_POLICY_TREE *tree); + +int X509_policy_tree_level_count(const X509_POLICY_TREE *tree); +X509_POLICY_LEVEL *X509_policy_tree_get0_level(const X509_POLICY_TREE *tree, + int i); + +STACK_OF(X509_POLICY_NODE) *X509_policy_tree_get0_policies(const + X509_POLICY_TREE + *tree); + +STACK_OF(X509_POLICY_NODE) *X509_policy_tree_get0_user_policies(const + X509_POLICY_TREE + *tree); + +int X509_policy_level_node_count(X509_POLICY_LEVEL *level); + +X509_POLICY_NODE *X509_policy_level_get0_node(X509_POLICY_LEVEL *level, + int i); + +const ASN1_OBJECT *X509_policy_node_get0_policy(const X509_POLICY_NODE *node); + +STACK_OF(POLICYQUALINFO) *X509_policy_node_get0_qualifiers(const + X509_POLICY_NODE + *node); +const X509_POLICY_NODE *X509_policy_node_get0_parent(const X509_POLICY_NODE + *node); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/ONVIF/include/openssl/include/openssl/x509err.h b/ONVIF/include/openssl/include/openssl/x509err.h new file mode 100644 index 0000000..0273853 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/x509err.h @@ -0,0 +1,130 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_X509ERR_H +# define HEADER_X509ERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_X509_strings(void); + +/* + * X509 function codes. + */ +# define X509_F_ADD_CERT_DIR 100 +# define X509_F_BUILD_CHAIN 106 +# define X509_F_BY_FILE_CTRL 101 +# define X509_F_CHECK_NAME_CONSTRAINTS 149 +# define X509_F_CHECK_POLICY 145 +# define X509_F_DANE_I2D 107 +# define X509_F_DIR_CTRL 102 +# define X509_F_GET_CERT_BY_SUBJECT 103 +# define X509_F_I2D_X509_AUX 151 +# define X509_F_LOOKUP_CERTS_SK 152 +# define X509_F_NETSCAPE_SPKI_B64_DECODE 129 +# define X509_F_NETSCAPE_SPKI_B64_ENCODE 130 +# define X509_F_NEW_DIR 153 +# define X509_F_X509AT_ADD1_ATTR 135 +# define X509_F_X509V3_ADD_EXT 104 +# define X509_F_X509_ATTRIBUTE_CREATE_BY_NID 136 +# define X509_F_X509_ATTRIBUTE_CREATE_BY_OBJ 137 +# define X509_F_X509_ATTRIBUTE_CREATE_BY_TXT 140 +# define X509_F_X509_ATTRIBUTE_GET0_DATA 139 +# define X509_F_X509_ATTRIBUTE_SET1_DATA 138 +# define X509_F_X509_CHECK_PRIVATE_KEY 128 +# define X509_F_X509_CRL_DIFF 105 +# define X509_F_X509_CRL_METHOD_NEW 154 +# define X509_F_X509_CRL_PRINT_FP 147 +# define X509_F_X509_EXTENSION_CREATE_BY_NID 108 +# define X509_F_X509_EXTENSION_CREATE_BY_OBJ 109 +# define X509_F_X509_GET_PUBKEY_PARAMETERS 110 +# define X509_F_X509_LOAD_CERT_CRL_FILE 132 +# define X509_F_X509_LOAD_CERT_FILE 111 +# define X509_F_X509_LOAD_CRL_FILE 112 +# define X509_F_X509_LOOKUP_METH_NEW 160 +# define X509_F_X509_LOOKUP_NEW 155 +# define X509_F_X509_NAME_ADD_ENTRY 113 +# define X509_F_X509_NAME_CANON 156 +# define X509_F_X509_NAME_ENTRY_CREATE_BY_NID 114 +# define X509_F_X509_NAME_ENTRY_CREATE_BY_TXT 131 +# define X509_F_X509_NAME_ENTRY_SET_OBJECT 115 +# define X509_F_X509_NAME_ONELINE 116 +# define X509_F_X509_NAME_PRINT 117 +# define X509_F_X509_OBJECT_NEW 150 +# define X509_F_X509_PRINT_EX_FP 118 +# define X509_F_X509_PUBKEY_DECODE 148 +# define X509_F_X509_PUBKEY_GET0 119 +# define X509_F_X509_PUBKEY_SET 120 +# define X509_F_X509_REQ_CHECK_PRIVATE_KEY 144 +# define X509_F_X509_REQ_PRINT_EX 121 +# define X509_F_X509_REQ_PRINT_FP 122 +# define X509_F_X509_REQ_TO_X509 123 +# define X509_F_X509_STORE_ADD_CERT 124 +# define X509_F_X509_STORE_ADD_CRL 125 +# define X509_F_X509_STORE_ADD_LOOKUP 157 +# define X509_F_X509_STORE_CTX_GET1_ISSUER 146 +# define X509_F_X509_STORE_CTX_INIT 143 +# define X509_F_X509_STORE_CTX_NEW 142 +# define X509_F_X509_STORE_CTX_PURPOSE_INHERIT 134 +# define X509_F_X509_STORE_NEW 158 +# define X509_F_X509_TO_X509_REQ 126 +# define X509_F_X509_TRUST_ADD 133 +# define X509_F_X509_TRUST_SET 141 +# define X509_F_X509_VERIFY_CERT 127 +# define X509_F_X509_VERIFY_PARAM_NEW 159 + +/* + * X509 reason codes. + */ +# define X509_R_AKID_MISMATCH 110 +# define X509_R_BAD_SELECTOR 133 +# define X509_R_BAD_X509_FILETYPE 100 +# define X509_R_BASE64_DECODE_ERROR 118 +# define X509_R_CANT_CHECK_DH_KEY 114 +# define X509_R_CERT_ALREADY_IN_HASH_TABLE 101 +# define X509_R_CRL_ALREADY_DELTA 127 +# define X509_R_CRL_VERIFY_FAILURE 131 +# define X509_R_IDP_MISMATCH 128 +# define X509_R_INVALID_ATTRIBUTES 138 +# define X509_R_INVALID_DIRECTORY 113 +# define X509_R_INVALID_FIELD_NAME 119 +# define X509_R_INVALID_TRUST 123 +# define X509_R_ISSUER_MISMATCH 129 +# define X509_R_KEY_TYPE_MISMATCH 115 +# define X509_R_KEY_VALUES_MISMATCH 116 +# define X509_R_LOADING_CERT_DIR 103 +# define X509_R_LOADING_DEFAULTS 104 +# define X509_R_METHOD_NOT_SUPPORTED 124 +# define X509_R_NAME_TOO_LONG 134 +# define X509_R_NEWER_CRL_NOT_NEWER 132 +# define X509_R_NO_CERTIFICATE_FOUND 135 +# define X509_R_NO_CERTIFICATE_OR_CRL_FOUND 136 +# define X509_R_NO_CERT_SET_FOR_US_TO_VERIFY 105 +# define X509_R_NO_CRL_FOUND 137 +# define X509_R_NO_CRL_NUMBER 130 +# define X509_R_PUBLIC_KEY_DECODE_ERROR 125 +# define X509_R_PUBLIC_KEY_ENCODE_ERROR 126 +# define X509_R_SHOULD_RETRY 106 +# define X509_R_UNABLE_TO_FIND_PARAMETERS_IN_CHAIN 107 +# define X509_R_UNABLE_TO_GET_CERTS_PUBLIC_KEY 108 +# define X509_R_UNKNOWN_KEY_TYPE 117 +# define X509_R_UNKNOWN_NID 109 +# define X509_R_UNKNOWN_PURPOSE_ID 121 +# define X509_R_UNKNOWN_TRUST_ID 120 +# define X509_R_UNSUPPORTED_ALGORITHM 111 +# define X509_R_WRONG_LOOKUP_TYPE 112 +# define X509_R_WRONG_TYPE 122 + +#endif diff --git a/ONVIF/include/openssl/include/openssl/x509v3.h b/ONVIF/include/openssl/include/openssl/x509v3.h new file mode 100644 index 0000000..6c6eca3 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/x509v3.h @@ -0,0 +1,937 @@ +/* + * Copyright 1999-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_X509V3_H +# define HEADER_X509V3_H + +# include +# include +# include +# include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward reference */ +struct v3_ext_method; +struct v3_ext_ctx; + +/* Useful typedefs */ + +typedef void *(*X509V3_EXT_NEW)(void); +typedef void (*X509V3_EXT_FREE) (void *); +typedef void *(*X509V3_EXT_D2I)(void *, const unsigned char **, long); +typedef int (*X509V3_EXT_I2D) (void *, unsigned char **); +typedef STACK_OF(CONF_VALUE) * + (*X509V3_EXT_I2V) (const struct v3_ext_method *method, void *ext, + STACK_OF(CONF_VALUE) *extlist); +typedef void *(*X509V3_EXT_V2I)(const struct v3_ext_method *method, + struct v3_ext_ctx *ctx, + STACK_OF(CONF_VALUE) *values); +typedef char *(*X509V3_EXT_I2S)(const struct v3_ext_method *method, + void *ext); +typedef void *(*X509V3_EXT_S2I)(const struct v3_ext_method *method, + struct v3_ext_ctx *ctx, const char *str); +typedef int (*X509V3_EXT_I2R) (const struct v3_ext_method *method, void *ext, + BIO *out, int indent); +typedef void *(*X509V3_EXT_R2I)(const struct v3_ext_method *method, + struct v3_ext_ctx *ctx, const char *str); + +/* V3 extension structure */ + +struct v3_ext_method { + int ext_nid; + int ext_flags; +/* If this is set the following four fields are ignored */ + ASN1_ITEM_EXP *it; +/* Old style ASN1 calls */ + X509V3_EXT_NEW ext_new; + X509V3_EXT_FREE ext_free; + X509V3_EXT_D2I d2i; + X509V3_EXT_I2D i2d; +/* The following pair is used for string extensions */ + X509V3_EXT_I2S i2s; + X509V3_EXT_S2I s2i; +/* The following pair is used for multi-valued extensions */ + X509V3_EXT_I2V i2v; + X509V3_EXT_V2I v2i; +/* The following are used for raw extensions */ + X509V3_EXT_I2R i2r; + X509V3_EXT_R2I r2i; + void *usr_data; /* Any extension specific data */ +}; + +typedef struct X509V3_CONF_METHOD_st { + char *(*get_string) (void *db, const char *section, const char *value); + STACK_OF(CONF_VALUE) *(*get_section) (void *db, const char *section); + void (*free_string) (void *db, char *string); + void (*free_section) (void *db, STACK_OF(CONF_VALUE) *section); +} X509V3_CONF_METHOD; + +/* Context specific info */ +struct v3_ext_ctx { +# define CTX_TEST 0x1 +# define X509V3_CTX_REPLACE 0x2 + int flags; + X509 *issuer_cert; + X509 *subject_cert; + X509_REQ *subject_req; + X509_CRL *crl; + X509V3_CONF_METHOD *db_meth; + void *db; +/* Maybe more here */ +}; + +typedef struct v3_ext_method X509V3_EXT_METHOD; + +DEFINE_STACK_OF(X509V3_EXT_METHOD) + +/* ext_flags values */ +# define X509V3_EXT_DYNAMIC 0x1 +# define X509V3_EXT_CTX_DEP 0x2 +# define X509V3_EXT_MULTILINE 0x4 + +typedef BIT_STRING_BITNAME ENUMERATED_NAMES; + +typedef struct BASIC_CONSTRAINTS_st { + int ca; + ASN1_INTEGER *pathlen; +} BASIC_CONSTRAINTS; + +typedef struct PKEY_USAGE_PERIOD_st { + ASN1_GENERALIZEDTIME *notBefore; + ASN1_GENERALIZEDTIME *notAfter; +} PKEY_USAGE_PERIOD; + +typedef struct otherName_st { + ASN1_OBJECT *type_id; + ASN1_TYPE *value; +} OTHERNAME; + +typedef struct EDIPartyName_st { + ASN1_STRING *nameAssigner; + ASN1_STRING *partyName; +} EDIPARTYNAME; + +typedef struct GENERAL_NAME_st { +# define GEN_OTHERNAME 0 +# define GEN_EMAIL 1 +# define GEN_DNS 2 +# define GEN_X400 3 +# define GEN_DIRNAME 4 +# define GEN_EDIPARTY 5 +# define GEN_URI 6 +# define GEN_IPADD 7 +# define GEN_RID 8 + int type; + union { + char *ptr; + OTHERNAME *otherName; /* otherName */ + ASN1_IA5STRING *rfc822Name; + ASN1_IA5STRING *dNSName; + ASN1_TYPE *x400Address; + X509_NAME *directoryName; + EDIPARTYNAME *ediPartyName; + ASN1_IA5STRING *uniformResourceIdentifier; + ASN1_OCTET_STRING *iPAddress; + ASN1_OBJECT *registeredID; + /* Old names */ + ASN1_OCTET_STRING *ip; /* iPAddress */ + X509_NAME *dirn; /* dirn */ + ASN1_IA5STRING *ia5; /* rfc822Name, dNSName, + * uniformResourceIdentifier */ + ASN1_OBJECT *rid; /* registeredID */ + ASN1_TYPE *other; /* x400Address */ + } d; +} GENERAL_NAME; + +typedef struct ACCESS_DESCRIPTION_st { + ASN1_OBJECT *method; + GENERAL_NAME *location; +} ACCESS_DESCRIPTION; + +typedef STACK_OF(ACCESS_DESCRIPTION) AUTHORITY_INFO_ACCESS; + +typedef STACK_OF(ASN1_OBJECT) EXTENDED_KEY_USAGE; + +typedef STACK_OF(ASN1_INTEGER) TLS_FEATURE; + +DEFINE_STACK_OF(GENERAL_NAME) +typedef STACK_OF(GENERAL_NAME) GENERAL_NAMES; +DEFINE_STACK_OF(GENERAL_NAMES) + +DEFINE_STACK_OF(ACCESS_DESCRIPTION) + +typedef struct DIST_POINT_NAME_st { + int type; + union { + GENERAL_NAMES *fullname; + STACK_OF(X509_NAME_ENTRY) *relativename; + } name; +/* If relativename then this contains the full distribution point name */ + X509_NAME *dpname; +} DIST_POINT_NAME; +/* All existing reasons */ +# define CRLDP_ALL_REASONS 0x807f + +# define CRL_REASON_NONE -1 +# define CRL_REASON_UNSPECIFIED 0 +# define CRL_REASON_KEY_COMPROMISE 1 +# define CRL_REASON_CA_COMPROMISE 2 +# define CRL_REASON_AFFILIATION_CHANGED 3 +# define CRL_REASON_SUPERSEDED 4 +# define CRL_REASON_CESSATION_OF_OPERATION 5 +# define CRL_REASON_CERTIFICATE_HOLD 6 +# define CRL_REASON_REMOVE_FROM_CRL 8 +# define CRL_REASON_PRIVILEGE_WITHDRAWN 9 +# define CRL_REASON_AA_COMPROMISE 10 + +struct DIST_POINT_st { + DIST_POINT_NAME *distpoint; + ASN1_BIT_STRING *reasons; + GENERAL_NAMES *CRLissuer; + int dp_reasons; +}; + +typedef STACK_OF(DIST_POINT) CRL_DIST_POINTS; + +DEFINE_STACK_OF(DIST_POINT) + +struct AUTHORITY_KEYID_st { + ASN1_OCTET_STRING *keyid; + GENERAL_NAMES *issuer; + ASN1_INTEGER *serial; +}; + +/* Strong extranet structures */ + +typedef struct SXNET_ID_st { + ASN1_INTEGER *zone; + ASN1_OCTET_STRING *user; +} SXNETID; + +DEFINE_STACK_OF(SXNETID) + +typedef struct SXNET_st { + ASN1_INTEGER *version; + STACK_OF(SXNETID) *ids; +} SXNET; + +typedef struct NOTICEREF_st { + ASN1_STRING *organization; + STACK_OF(ASN1_INTEGER) *noticenos; +} NOTICEREF; + +typedef struct USERNOTICE_st { + NOTICEREF *noticeref; + ASN1_STRING *exptext; +} USERNOTICE; + +typedef struct POLICYQUALINFO_st { + ASN1_OBJECT *pqualid; + union { + ASN1_IA5STRING *cpsuri; + USERNOTICE *usernotice; + ASN1_TYPE *other; + } d; +} POLICYQUALINFO; + +DEFINE_STACK_OF(POLICYQUALINFO) + +typedef struct POLICYINFO_st { + ASN1_OBJECT *policyid; + STACK_OF(POLICYQUALINFO) *qualifiers; +} POLICYINFO; + +typedef STACK_OF(POLICYINFO) CERTIFICATEPOLICIES; + +DEFINE_STACK_OF(POLICYINFO) + +typedef struct POLICY_MAPPING_st { + ASN1_OBJECT *issuerDomainPolicy; + ASN1_OBJECT *subjectDomainPolicy; +} POLICY_MAPPING; + +DEFINE_STACK_OF(POLICY_MAPPING) + +typedef STACK_OF(POLICY_MAPPING) POLICY_MAPPINGS; + +typedef struct GENERAL_SUBTREE_st { + GENERAL_NAME *base; + ASN1_INTEGER *minimum; + ASN1_INTEGER *maximum; +} GENERAL_SUBTREE; + +DEFINE_STACK_OF(GENERAL_SUBTREE) + +struct NAME_CONSTRAINTS_st { + STACK_OF(GENERAL_SUBTREE) *permittedSubtrees; + STACK_OF(GENERAL_SUBTREE) *excludedSubtrees; +}; + +typedef struct POLICY_CONSTRAINTS_st { + ASN1_INTEGER *requireExplicitPolicy; + ASN1_INTEGER *inhibitPolicyMapping; +} POLICY_CONSTRAINTS; + +/* Proxy certificate structures, see RFC 3820 */ +typedef struct PROXY_POLICY_st { + ASN1_OBJECT *policyLanguage; + ASN1_OCTET_STRING *policy; +} PROXY_POLICY; + +typedef struct PROXY_CERT_INFO_EXTENSION_st { + ASN1_INTEGER *pcPathLengthConstraint; + PROXY_POLICY *proxyPolicy; +} PROXY_CERT_INFO_EXTENSION; + +DECLARE_ASN1_FUNCTIONS(PROXY_POLICY) +DECLARE_ASN1_FUNCTIONS(PROXY_CERT_INFO_EXTENSION) + +struct ISSUING_DIST_POINT_st { + DIST_POINT_NAME *distpoint; + int onlyuser; + int onlyCA; + ASN1_BIT_STRING *onlysomereasons; + int indirectCRL; + int onlyattr; +}; + +/* Values in idp_flags field */ +/* IDP present */ +# define IDP_PRESENT 0x1 +/* IDP values inconsistent */ +# define IDP_INVALID 0x2 +/* onlyuser true */ +# define IDP_ONLYUSER 0x4 +/* onlyCA true */ +# define IDP_ONLYCA 0x8 +/* onlyattr true */ +# define IDP_ONLYATTR 0x10 +/* indirectCRL true */ +# define IDP_INDIRECT 0x20 +/* onlysomereasons present */ +# define IDP_REASONS 0x40 + +# define X509V3_conf_err(val) ERR_add_error_data(6, \ + "section:", (val)->section, \ + ",name:", (val)->name, ",value:", (val)->value) + +# define X509V3_set_ctx_test(ctx) \ + X509V3_set_ctx(ctx, NULL, NULL, NULL, NULL, CTX_TEST) +# define X509V3_set_ctx_nodb(ctx) (ctx)->db = NULL; + +# define EXT_BITSTRING(nid, table) { nid, 0, ASN1_ITEM_ref(ASN1_BIT_STRING), \ + 0,0,0,0, \ + 0,0, \ + (X509V3_EXT_I2V)i2v_ASN1_BIT_STRING, \ + (X509V3_EXT_V2I)v2i_ASN1_BIT_STRING, \ + NULL, NULL, \ + table} + +# define EXT_IA5STRING(nid) { nid, 0, ASN1_ITEM_ref(ASN1_IA5STRING), \ + 0,0,0,0, \ + (X509V3_EXT_I2S)i2s_ASN1_IA5STRING, \ + (X509V3_EXT_S2I)s2i_ASN1_IA5STRING, \ + 0,0,0,0, \ + NULL} + +# define EXT_END { -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} + +/* X509_PURPOSE stuff */ + +# define EXFLAG_BCONS 0x1 +# define EXFLAG_KUSAGE 0x2 +# define EXFLAG_XKUSAGE 0x4 +# define EXFLAG_NSCERT 0x8 + +# define EXFLAG_CA 0x10 +/* Really self issued not necessarily self signed */ +# define EXFLAG_SI 0x20 +# define EXFLAG_V1 0x40 +# define EXFLAG_INVALID 0x80 +/* EXFLAG_SET is set to indicate that some values have been precomputed */ +# define EXFLAG_SET 0x100 +# define EXFLAG_CRITICAL 0x200 +# define EXFLAG_PROXY 0x400 + +# define EXFLAG_INVALID_POLICY 0x800 +# define EXFLAG_FRESHEST 0x1000 +/* Self signed */ +# define EXFLAG_SS 0x2000 + +# define KU_DIGITAL_SIGNATURE 0x0080 +# define KU_NON_REPUDIATION 0x0040 +# define KU_KEY_ENCIPHERMENT 0x0020 +# define KU_DATA_ENCIPHERMENT 0x0010 +# define KU_KEY_AGREEMENT 0x0008 +# define KU_KEY_CERT_SIGN 0x0004 +# define KU_CRL_SIGN 0x0002 +# define KU_ENCIPHER_ONLY 0x0001 +# define KU_DECIPHER_ONLY 0x8000 + +# define NS_SSL_CLIENT 0x80 +# define NS_SSL_SERVER 0x40 +# define NS_SMIME 0x20 +# define NS_OBJSIGN 0x10 +# define NS_SSL_CA 0x04 +# define NS_SMIME_CA 0x02 +# define NS_OBJSIGN_CA 0x01 +# define NS_ANY_CA (NS_SSL_CA|NS_SMIME_CA|NS_OBJSIGN_CA) + +# define XKU_SSL_SERVER 0x1 +# define XKU_SSL_CLIENT 0x2 +# define XKU_SMIME 0x4 +# define XKU_CODE_SIGN 0x8 +# define XKU_SGC 0x10 +# define XKU_OCSP_SIGN 0x20 +# define XKU_TIMESTAMP 0x40 +# define XKU_DVCS 0x80 +# define XKU_ANYEKU 0x100 + +# define X509_PURPOSE_DYNAMIC 0x1 +# define X509_PURPOSE_DYNAMIC_NAME 0x2 + +typedef struct x509_purpose_st { + int purpose; + int trust; /* Default trust ID */ + int flags; + int (*check_purpose) (const struct x509_purpose_st *, const X509 *, int); + char *name; + char *sname; + void *usr_data; +} X509_PURPOSE; + +# define X509_PURPOSE_SSL_CLIENT 1 +# define X509_PURPOSE_SSL_SERVER 2 +# define X509_PURPOSE_NS_SSL_SERVER 3 +# define X509_PURPOSE_SMIME_SIGN 4 +# define X509_PURPOSE_SMIME_ENCRYPT 5 +# define X509_PURPOSE_CRL_SIGN 6 +# define X509_PURPOSE_ANY 7 +# define X509_PURPOSE_OCSP_HELPER 8 +# define X509_PURPOSE_TIMESTAMP_SIGN 9 + +# define X509_PURPOSE_MIN 1 +# define X509_PURPOSE_MAX 9 + +/* Flags for X509V3_EXT_print() */ + +# define X509V3_EXT_UNKNOWN_MASK (0xfL << 16) +/* Return error for unknown extensions */ +# define X509V3_EXT_DEFAULT 0 +/* Print error for unknown extensions */ +# define X509V3_EXT_ERROR_UNKNOWN (1L << 16) +/* ASN1 parse unknown extensions */ +# define X509V3_EXT_PARSE_UNKNOWN (2L << 16) +/* BIO_dump unknown extensions */ +# define X509V3_EXT_DUMP_UNKNOWN (3L << 16) + +/* Flags for X509V3_add1_i2d */ + +# define X509V3_ADD_OP_MASK 0xfL +# define X509V3_ADD_DEFAULT 0L +# define X509V3_ADD_APPEND 1L +# define X509V3_ADD_REPLACE 2L +# define X509V3_ADD_REPLACE_EXISTING 3L +# define X509V3_ADD_KEEP_EXISTING 4L +# define X509V3_ADD_DELETE 5L +# define X509V3_ADD_SILENT 0x10 + +DEFINE_STACK_OF(X509_PURPOSE) + +DECLARE_ASN1_FUNCTIONS(BASIC_CONSTRAINTS) + +DECLARE_ASN1_FUNCTIONS(SXNET) +DECLARE_ASN1_FUNCTIONS(SXNETID) + +int SXNET_add_id_asc(SXNET **psx, const char *zone, const char *user, int userlen); +int SXNET_add_id_ulong(SXNET **psx, unsigned long lzone, const char *user, + int userlen); +int SXNET_add_id_INTEGER(SXNET **psx, ASN1_INTEGER *izone, const char *user, + int userlen); + +ASN1_OCTET_STRING *SXNET_get_id_asc(SXNET *sx, const char *zone); +ASN1_OCTET_STRING *SXNET_get_id_ulong(SXNET *sx, unsigned long lzone); +ASN1_OCTET_STRING *SXNET_get_id_INTEGER(SXNET *sx, ASN1_INTEGER *zone); + +DECLARE_ASN1_FUNCTIONS(AUTHORITY_KEYID) + +DECLARE_ASN1_FUNCTIONS(PKEY_USAGE_PERIOD) + +DECLARE_ASN1_FUNCTIONS(GENERAL_NAME) +GENERAL_NAME *GENERAL_NAME_dup(GENERAL_NAME *a); +int GENERAL_NAME_cmp(GENERAL_NAME *a, GENERAL_NAME *b); + +ASN1_BIT_STRING *v2i_ASN1_BIT_STRING(X509V3_EXT_METHOD *method, + X509V3_CTX *ctx, + STACK_OF(CONF_VALUE) *nval); +STACK_OF(CONF_VALUE) *i2v_ASN1_BIT_STRING(X509V3_EXT_METHOD *method, + ASN1_BIT_STRING *bits, + STACK_OF(CONF_VALUE) *extlist); +char *i2s_ASN1_IA5STRING(X509V3_EXT_METHOD *method, ASN1_IA5STRING *ia5); +ASN1_IA5STRING *s2i_ASN1_IA5STRING(X509V3_EXT_METHOD *method, + X509V3_CTX *ctx, const char *str); + +STACK_OF(CONF_VALUE) *i2v_GENERAL_NAME(X509V3_EXT_METHOD *method, + GENERAL_NAME *gen, + STACK_OF(CONF_VALUE) *ret); +int GENERAL_NAME_print(BIO *out, GENERAL_NAME *gen); + +DECLARE_ASN1_FUNCTIONS(GENERAL_NAMES) + +STACK_OF(CONF_VALUE) *i2v_GENERAL_NAMES(X509V3_EXT_METHOD *method, + GENERAL_NAMES *gen, + STACK_OF(CONF_VALUE) *extlist); +GENERAL_NAMES *v2i_GENERAL_NAMES(const X509V3_EXT_METHOD *method, + X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval); + +DECLARE_ASN1_FUNCTIONS(OTHERNAME) +DECLARE_ASN1_FUNCTIONS(EDIPARTYNAME) +int OTHERNAME_cmp(OTHERNAME *a, OTHERNAME *b); +void GENERAL_NAME_set0_value(GENERAL_NAME *a, int type, void *value); +void *GENERAL_NAME_get0_value(const GENERAL_NAME *a, int *ptype); +int GENERAL_NAME_set0_othername(GENERAL_NAME *gen, + ASN1_OBJECT *oid, ASN1_TYPE *value); +int GENERAL_NAME_get0_otherName(const GENERAL_NAME *gen, + ASN1_OBJECT **poid, ASN1_TYPE **pvalue); + +char *i2s_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, + const ASN1_OCTET_STRING *ia5); +ASN1_OCTET_STRING *s2i_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, + X509V3_CTX *ctx, const char *str); + +DECLARE_ASN1_FUNCTIONS(EXTENDED_KEY_USAGE) +int i2a_ACCESS_DESCRIPTION(BIO *bp, const ACCESS_DESCRIPTION *a); + +DECLARE_ASN1_ALLOC_FUNCTIONS(TLS_FEATURE) + +DECLARE_ASN1_FUNCTIONS(CERTIFICATEPOLICIES) +DECLARE_ASN1_FUNCTIONS(POLICYINFO) +DECLARE_ASN1_FUNCTIONS(POLICYQUALINFO) +DECLARE_ASN1_FUNCTIONS(USERNOTICE) +DECLARE_ASN1_FUNCTIONS(NOTICEREF) + +DECLARE_ASN1_FUNCTIONS(CRL_DIST_POINTS) +DECLARE_ASN1_FUNCTIONS(DIST_POINT) +DECLARE_ASN1_FUNCTIONS(DIST_POINT_NAME) +DECLARE_ASN1_FUNCTIONS(ISSUING_DIST_POINT) + +int DIST_POINT_set_dpname(DIST_POINT_NAME *dpn, X509_NAME *iname); + +int NAME_CONSTRAINTS_check(X509 *x, NAME_CONSTRAINTS *nc); +int NAME_CONSTRAINTS_check_CN(X509 *x, NAME_CONSTRAINTS *nc); + +DECLARE_ASN1_FUNCTIONS(ACCESS_DESCRIPTION) +DECLARE_ASN1_FUNCTIONS(AUTHORITY_INFO_ACCESS) + +DECLARE_ASN1_ITEM(POLICY_MAPPING) +DECLARE_ASN1_ALLOC_FUNCTIONS(POLICY_MAPPING) +DECLARE_ASN1_ITEM(POLICY_MAPPINGS) + +DECLARE_ASN1_ITEM(GENERAL_SUBTREE) +DECLARE_ASN1_ALLOC_FUNCTIONS(GENERAL_SUBTREE) + +DECLARE_ASN1_ITEM(NAME_CONSTRAINTS) +DECLARE_ASN1_ALLOC_FUNCTIONS(NAME_CONSTRAINTS) + +DECLARE_ASN1_ALLOC_FUNCTIONS(POLICY_CONSTRAINTS) +DECLARE_ASN1_ITEM(POLICY_CONSTRAINTS) + +GENERAL_NAME *a2i_GENERAL_NAME(GENERAL_NAME *out, + const X509V3_EXT_METHOD *method, + X509V3_CTX *ctx, int gen_type, + const char *value, int is_nc); + +# ifdef HEADER_CONF_H +GENERAL_NAME *v2i_GENERAL_NAME(const X509V3_EXT_METHOD *method, + X509V3_CTX *ctx, CONF_VALUE *cnf); +GENERAL_NAME *v2i_GENERAL_NAME_ex(GENERAL_NAME *out, + const X509V3_EXT_METHOD *method, + X509V3_CTX *ctx, CONF_VALUE *cnf, + int is_nc); +void X509V3_conf_free(CONF_VALUE *val); + +X509_EXTENSION *X509V3_EXT_nconf_nid(CONF *conf, X509V3_CTX *ctx, int ext_nid, + const char *value); +X509_EXTENSION *X509V3_EXT_nconf(CONF *conf, X509V3_CTX *ctx, const char *name, + const char *value); +int X509V3_EXT_add_nconf_sk(CONF *conf, X509V3_CTX *ctx, const char *section, + STACK_OF(X509_EXTENSION) **sk); +int X509V3_EXT_add_nconf(CONF *conf, X509V3_CTX *ctx, const char *section, + X509 *cert); +int X509V3_EXT_REQ_add_nconf(CONF *conf, X509V3_CTX *ctx, const char *section, + X509_REQ *req); +int X509V3_EXT_CRL_add_nconf(CONF *conf, X509V3_CTX *ctx, const char *section, + X509_CRL *crl); + +X509_EXTENSION *X509V3_EXT_conf_nid(LHASH_OF(CONF_VALUE) *conf, + X509V3_CTX *ctx, int ext_nid, + const char *value); +X509_EXTENSION *X509V3_EXT_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, + const char *name, const char *value); +int X509V3_EXT_add_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, + const char *section, X509 *cert); +int X509V3_EXT_REQ_add_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, + const char *section, X509_REQ *req); +int X509V3_EXT_CRL_add_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx, + const char *section, X509_CRL *crl); + +int X509V3_add_value_bool_nf(const char *name, int asn1_bool, + STACK_OF(CONF_VALUE) **extlist); +int X509V3_get_value_bool(const CONF_VALUE *value, int *asn1_bool); +int X509V3_get_value_int(const CONF_VALUE *value, ASN1_INTEGER **aint); +void X509V3_set_nconf(X509V3_CTX *ctx, CONF *conf); +void X509V3_set_conf_lhash(X509V3_CTX *ctx, LHASH_OF(CONF_VALUE) *lhash); +# endif + +char *X509V3_get_string(X509V3_CTX *ctx, const char *name, const char *section); +STACK_OF(CONF_VALUE) *X509V3_get_section(X509V3_CTX *ctx, const char *section); +void X509V3_string_free(X509V3_CTX *ctx, char *str); +void X509V3_section_free(X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *section); +void X509V3_set_ctx(X509V3_CTX *ctx, X509 *issuer, X509 *subject, + X509_REQ *req, X509_CRL *crl, int flags); + +int X509V3_add_value(const char *name, const char *value, + STACK_OF(CONF_VALUE) **extlist); +int X509V3_add_value_uchar(const char *name, const unsigned char *value, + STACK_OF(CONF_VALUE) **extlist); +int X509V3_add_value_bool(const char *name, int asn1_bool, + STACK_OF(CONF_VALUE) **extlist); +int X509V3_add_value_int(const char *name, const ASN1_INTEGER *aint, + STACK_OF(CONF_VALUE) **extlist); +char *i2s_ASN1_INTEGER(X509V3_EXT_METHOD *meth, const ASN1_INTEGER *aint); +ASN1_INTEGER *s2i_ASN1_INTEGER(X509V3_EXT_METHOD *meth, const char *value); +char *i2s_ASN1_ENUMERATED(X509V3_EXT_METHOD *meth, const ASN1_ENUMERATED *aint); +char *i2s_ASN1_ENUMERATED_TABLE(X509V3_EXT_METHOD *meth, + const ASN1_ENUMERATED *aint); +int X509V3_EXT_add(X509V3_EXT_METHOD *ext); +int X509V3_EXT_add_list(X509V3_EXT_METHOD *extlist); +int X509V3_EXT_add_alias(int nid_to, int nid_from); +void X509V3_EXT_cleanup(void); + +const X509V3_EXT_METHOD *X509V3_EXT_get(X509_EXTENSION *ext); +const X509V3_EXT_METHOD *X509V3_EXT_get_nid(int nid); +int X509V3_add_standard_extensions(void); +STACK_OF(CONF_VALUE) *X509V3_parse_list(const char *line); +void *X509V3_EXT_d2i(X509_EXTENSION *ext); +void *X509V3_get_d2i(const STACK_OF(X509_EXTENSION) *x, int nid, int *crit, + int *idx); + +X509_EXTENSION *X509V3_EXT_i2d(int ext_nid, int crit, void *ext_struc); +int X509V3_add1_i2d(STACK_OF(X509_EXTENSION) **x, int nid, void *value, + int crit, unsigned long flags); + +#if OPENSSL_API_COMPAT < 0x10100000L +/* The new declarations are in crypto.h, but the old ones were here. */ +# define hex_to_string OPENSSL_buf2hexstr +# define string_to_hex OPENSSL_hexstr2buf +#endif + +void X509V3_EXT_val_prn(BIO *out, STACK_OF(CONF_VALUE) *val, int indent, + int ml); +int X509V3_EXT_print(BIO *out, X509_EXTENSION *ext, unsigned long flag, + int indent); +#ifndef OPENSSL_NO_STDIO +int X509V3_EXT_print_fp(FILE *out, X509_EXTENSION *ext, int flag, int indent); +#endif +int X509V3_extensions_print(BIO *out, const char *title, + const STACK_OF(X509_EXTENSION) *exts, + unsigned long flag, int indent); + +int X509_check_ca(X509 *x); +int X509_check_purpose(X509 *x, int id, int ca); +int X509_supported_extension(X509_EXTENSION *ex); +int X509_PURPOSE_set(int *p, int purpose); +int X509_check_issued(X509 *issuer, X509 *subject); +int X509_check_akid(X509 *issuer, AUTHORITY_KEYID *akid); +void X509_set_proxy_flag(X509 *x); +void X509_set_proxy_pathlen(X509 *x, long l); +long X509_get_proxy_pathlen(X509 *x); + +uint32_t X509_get_extension_flags(X509 *x); +uint32_t X509_get_key_usage(X509 *x); +uint32_t X509_get_extended_key_usage(X509 *x); +const ASN1_OCTET_STRING *X509_get0_subject_key_id(X509 *x); +const ASN1_OCTET_STRING *X509_get0_authority_key_id(X509 *x); +const GENERAL_NAMES *X509_get0_authority_issuer(X509 *x); +const ASN1_INTEGER *X509_get0_authority_serial(X509 *x); + +int X509_PURPOSE_get_count(void); +X509_PURPOSE *X509_PURPOSE_get0(int idx); +int X509_PURPOSE_get_by_sname(const char *sname); +int X509_PURPOSE_get_by_id(int id); +int X509_PURPOSE_add(int id, int trust, int flags, + int (*ck) (const X509_PURPOSE *, const X509 *, int), + const char *name, const char *sname, void *arg); +char *X509_PURPOSE_get0_name(const X509_PURPOSE *xp); +char *X509_PURPOSE_get0_sname(const X509_PURPOSE *xp); +int X509_PURPOSE_get_trust(const X509_PURPOSE *xp); +void X509_PURPOSE_cleanup(void); +int X509_PURPOSE_get_id(const X509_PURPOSE *); + +STACK_OF(OPENSSL_STRING) *X509_get1_email(X509 *x); +STACK_OF(OPENSSL_STRING) *X509_REQ_get1_email(X509_REQ *x); +void X509_email_free(STACK_OF(OPENSSL_STRING) *sk); +STACK_OF(OPENSSL_STRING) *X509_get1_ocsp(X509 *x); +/* Flags for X509_check_* functions */ + +/* + * Always check subject name for host match even if subject alt names present + */ +# define X509_CHECK_FLAG_ALWAYS_CHECK_SUBJECT 0x1 +/* Disable wildcard matching for dnsName fields and common name. */ +# define X509_CHECK_FLAG_NO_WILDCARDS 0x2 +/* Wildcards must not match a partial label. */ +# define X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS 0x4 +/* Allow (non-partial) wildcards to match multiple labels. */ +# define X509_CHECK_FLAG_MULTI_LABEL_WILDCARDS 0x8 +/* Constraint verifier subdomain patterns to match a single labels. */ +# define X509_CHECK_FLAG_SINGLE_LABEL_SUBDOMAINS 0x10 +/* Never check the subject CN */ +# define X509_CHECK_FLAG_NEVER_CHECK_SUBJECT 0x20 +/* + * Match reference identifiers starting with "." to any sub-domain. + * This is a non-public flag, turned on implicitly when the subject + * reference identity is a DNS name. + */ +# define _X509_CHECK_FLAG_DOT_SUBDOMAINS 0x8000 + +int X509_check_host(X509 *x, const char *chk, size_t chklen, + unsigned int flags, char **peername); +int X509_check_email(X509 *x, const char *chk, size_t chklen, + unsigned int flags); +int X509_check_ip(X509 *x, const unsigned char *chk, size_t chklen, + unsigned int flags); +int X509_check_ip_asc(X509 *x, const char *ipasc, unsigned int flags); + +ASN1_OCTET_STRING *a2i_IPADDRESS(const char *ipasc); +ASN1_OCTET_STRING *a2i_IPADDRESS_NC(const char *ipasc); +int X509V3_NAME_from_section(X509_NAME *nm, STACK_OF(CONF_VALUE) *dn_sk, + unsigned long chtype); + +void X509_POLICY_NODE_print(BIO *out, X509_POLICY_NODE *node, int indent); +DEFINE_STACK_OF(X509_POLICY_NODE) + +#ifndef OPENSSL_NO_RFC3779 +typedef struct ASRange_st { + ASN1_INTEGER *min, *max; +} ASRange; + +# define ASIdOrRange_id 0 +# define ASIdOrRange_range 1 + +typedef struct ASIdOrRange_st { + int type; + union { + ASN1_INTEGER *id; + ASRange *range; + } u; +} ASIdOrRange; + +typedef STACK_OF(ASIdOrRange) ASIdOrRanges; +DEFINE_STACK_OF(ASIdOrRange) + +# define ASIdentifierChoice_inherit 0 +# define ASIdentifierChoice_asIdsOrRanges 1 + +typedef struct ASIdentifierChoice_st { + int type; + union { + ASN1_NULL *inherit; + ASIdOrRanges *asIdsOrRanges; + } u; +} ASIdentifierChoice; + +typedef struct ASIdentifiers_st { + ASIdentifierChoice *asnum, *rdi; +} ASIdentifiers; + +DECLARE_ASN1_FUNCTIONS(ASRange) +DECLARE_ASN1_FUNCTIONS(ASIdOrRange) +DECLARE_ASN1_FUNCTIONS(ASIdentifierChoice) +DECLARE_ASN1_FUNCTIONS(ASIdentifiers) + +typedef struct IPAddressRange_st { + ASN1_BIT_STRING *min, *max; +} IPAddressRange; + +# define IPAddressOrRange_addressPrefix 0 +# define IPAddressOrRange_addressRange 1 + +typedef struct IPAddressOrRange_st { + int type; + union { + ASN1_BIT_STRING *addressPrefix; + IPAddressRange *addressRange; + } u; +} IPAddressOrRange; + +typedef STACK_OF(IPAddressOrRange) IPAddressOrRanges; +DEFINE_STACK_OF(IPAddressOrRange) + +# define IPAddressChoice_inherit 0 +# define IPAddressChoice_addressesOrRanges 1 + +typedef struct IPAddressChoice_st { + int type; + union { + ASN1_NULL *inherit; + IPAddressOrRanges *addressesOrRanges; + } u; +} IPAddressChoice; + +typedef struct IPAddressFamily_st { + ASN1_OCTET_STRING *addressFamily; + IPAddressChoice *ipAddressChoice; +} IPAddressFamily; + +typedef STACK_OF(IPAddressFamily) IPAddrBlocks; +DEFINE_STACK_OF(IPAddressFamily) + +DECLARE_ASN1_FUNCTIONS(IPAddressRange) +DECLARE_ASN1_FUNCTIONS(IPAddressOrRange) +DECLARE_ASN1_FUNCTIONS(IPAddressChoice) +DECLARE_ASN1_FUNCTIONS(IPAddressFamily) + +/* + * API tag for elements of the ASIdentifer SEQUENCE. + */ +# define V3_ASID_ASNUM 0 +# define V3_ASID_RDI 1 + +/* + * AFI values, assigned by IANA. It'd be nice to make the AFI + * handling code totally generic, but there are too many little things + * that would need to be defined for other address families for it to + * be worth the trouble. + */ +# define IANA_AFI_IPV4 1 +# define IANA_AFI_IPV6 2 + +/* + * Utilities to construct and extract values from RFC3779 extensions, + * since some of the encodings (particularly for IP address prefixes + * and ranges) are a bit tedious to work with directly. + */ +int X509v3_asid_add_inherit(ASIdentifiers *asid, int which); +int X509v3_asid_add_id_or_range(ASIdentifiers *asid, int which, + ASN1_INTEGER *min, ASN1_INTEGER *max); +int X509v3_addr_add_inherit(IPAddrBlocks *addr, + const unsigned afi, const unsigned *safi); +int X509v3_addr_add_prefix(IPAddrBlocks *addr, + const unsigned afi, const unsigned *safi, + unsigned char *a, const int prefixlen); +int X509v3_addr_add_range(IPAddrBlocks *addr, + const unsigned afi, const unsigned *safi, + unsigned char *min, unsigned char *max); +unsigned X509v3_addr_get_afi(const IPAddressFamily *f); +int X509v3_addr_get_range(IPAddressOrRange *aor, const unsigned afi, + unsigned char *min, unsigned char *max, + const int length); + +/* + * Canonical forms. + */ +int X509v3_asid_is_canonical(ASIdentifiers *asid); +int X509v3_addr_is_canonical(IPAddrBlocks *addr); +int X509v3_asid_canonize(ASIdentifiers *asid); +int X509v3_addr_canonize(IPAddrBlocks *addr); + +/* + * Tests for inheritance and containment. + */ +int X509v3_asid_inherits(ASIdentifiers *asid); +int X509v3_addr_inherits(IPAddrBlocks *addr); +int X509v3_asid_subset(ASIdentifiers *a, ASIdentifiers *b); +int X509v3_addr_subset(IPAddrBlocks *a, IPAddrBlocks *b); + +/* + * Check whether RFC 3779 extensions nest properly in chains. + */ +int X509v3_asid_validate_path(X509_STORE_CTX *); +int X509v3_addr_validate_path(X509_STORE_CTX *); +int X509v3_asid_validate_resource_set(STACK_OF(X509) *chain, + ASIdentifiers *ext, + int allow_inheritance); +int X509v3_addr_validate_resource_set(STACK_OF(X509) *chain, + IPAddrBlocks *ext, int allow_inheritance); + +#endif /* OPENSSL_NO_RFC3779 */ + +DEFINE_STACK_OF(ASN1_STRING) + +/* + * Admission Syntax + */ +typedef struct NamingAuthority_st NAMING_AUTHORITY; +typedef struct ProfessionInfo_st PROFESSION_INFO; +typedef struct Admissions_st ADMISSIONS; +typedef struct AdmissionSyntax_st ADMISSION_SYNTAX; +DECLARE_ASN1_FUNCTIONS(NAMING_AUTHORITY) +DECLARE_ASN1_FUNCTIONS(PROFESSION_INFO) +DECLARE_ASN1_FUNCTIONS(ADMISSIONS) +DECLARE_ASN1_FUNCTIONS(ADMISSION_SYNTAX) +DEFINE_STACK_OF(ADMISSIONS) +DEFINE_STACK_OF(PROFESSION_INFO) +typedef STACK_OF(PROFESSION_INFO) PROFESSION_INFOS; + +const ASN1_OBJECT *NAMING_AUTHORITY_get0_authorityId( + const NAMING_AUTHORITY *n); +const ASN1_IA5STRING *NAMING_AUTHORITY_get0_authorityURL( + const NAMING_AUTHORITY *n); +const ASN1_STRING *NAMING_AUTHORITY_get0_authorityText( + const NAMING_AUTHORITY *n); +void NAMING_AUTHORITY_set0_authorityId(NAMING_AUTHORITY *n, + ASN1_OBJECT* namingAuthorityId); +void NAMING_AUTHORITY_set0_authorityURL(NAMING_AUTHORITY *n, + ASN1_IA5STRING* namingAuthorityUrl); +void NAMING_AUTHORITY_set0_authorityText(NAMING_AUTHORITY *n, + ASN1_STRING* namingAuthorityText); + +const GENERAL_NAME *ADMISSION_SYNTAX_get0_admissionAuthority( + const ADMISSION_SYNTAX *as); +void ADMISSION_SYNTAX_set0_admissionAuthority( + ADMISSION_SYNTAX *as, GENERAL_NAME *aa); +const STACK_OF(ADMISSIONS) *ADMISSION_SYNTAX_get0_contentsOfAdmissions( + const ADMISSION_SYNTAX *as); +void ADMISSION_SYNTAX_set0_contentsOfAdmissions( + ADMISSION_SYNTAX *as, STACK_OF(ADMISSIONS) *a); +const GENERAL_NAME *ADMISSIONS_get0_admissionAuthority(const ADMISSIONS *a); +void ADMISSIONS_set0_admissionAuthority(ADMISSIONS *a, GENERAL_NAME *aa); +const NAMING_AUTHORITY *ADMISSIONS_get0_namingAuthority(const ADMISSIONS *a); +void ADMISSIONS_set0_namingAuthority(ADMISSIONS *a, NAMING_AUTHORITY *na); +const PROFESSION_INFOS *ADMISSIONS_get0_professionInfos(const ADMISSIONS *a); +void ADMISSIONS_set0_professionInfos(ADMISSIONS *a, PROFESSION_INFOS *pi); +const ASN1_OCTET_STRING *PROFESSION_INFO_get0_addProfessionInfo( + const PROFESSION_INFO *pi); +void PROFESSION_INFO_set0_addProfessionInfo( + PROFESSION_INFO *pi, ASN1_OCTET_STRING *aos); +const NAMING_AUTHORITY *PROFESSION_INFO_get0_namingAuthority( + const PROFESSION_INFO *pi); +void PROFESSION_INFO_set0_namingAuthority( + PROFESSION_INFO *pi, NAMING_AUTHORITY *na); +const STACK_OF(ASN1_STRING) *PROFESSION_INFO_get0_professionItems( + const PROFESSION_INFO *pi); +void PROFESSION_INFO_set0_professionItems( + PROFESSION_INFO *pi, STACK_OF(ASN1_STRING) *as); +const STACK_OF(ASN1_OBJECT) *PROFESSION_INFO_get0_professionOIDs( + const PROFESSION_INFO *pi); +void PROFESSION_INFO_set0_professionOIDs( + PROFESSION_INFO *pi, STACK_OF(ASN1_OBJECT) *po); +const ASN1_PRINTABLESTRING *PROFESSION_INFO_get0_registrationNumber( + const PROFESSION_INFO *pi); +void PROFESSION_INFO_set0_registrationNumber( + PROFESSION_INFO *pi, ASN1_PRINTABLESTRING *rn); + +# ifdef __cplusplus +} +# endif +#endif diff --git a/ONVIF/include/openssl/include/openssl/x509v3err.h b/ONVIF/include/openssl/include/openssl/x509v3err.h new file mode 100644 index 0000000..5f25442 --- /dev/null +++ b/ONVIF/include/openssl/include/openssl/x509v3err.h @@ -0,0 +1,162 @@ +/* + * Generated by util/mkerr.pl DO NOT EDIT + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef HEADER_X509V3ERR_H +# define HEADER_X509V3ERR_H + +# ifndef HEADER_SYMHACKS_H +# include +# endif + +# ifdef __cplusplus +extern "C" +# endif +int ERR_load_X509V3_strings(void); + +/* + * X509V3 function codes. + */ +# define X509V3_F_A2I_GENERAL_NAME 164 +# define X509V3_F_ADDR_VALIDATE_PATH_INTERNAL 166 +# define X509V3_F_ASIDENTIFIERCHOICE_CANONIZE 161 +# define X509V3_F_ASIDENTIFIERCHOICE_IS_CANONICAL 162 +# define X509V3_F_BIGNUM_TO_STRING 167 +# define X509V3_F_COPY_EMAIL 122 +# define X509V3_F_COPY_ISSUER 123 +# define X509V3_F_DO_DIRNAME 144 +# define X509V3_F_DO_EXT_I2D 135 +# define X509V3_F_DO_EXT_NCONF 151 +# define X509V3_F_GNAMES_FROM_SECTNAME 156 +# define X509V3_F_I2S_ASN1_ENUMERATED 121 +# define X509V3_F_I2S_ASN1_IA5STRING 149 +# define X509V3_F_I2S_ASN1_INTEGER 120 +# define X509V3_F_I2V_AUTHORITY_INFO_ACCESS 138 +# define X509V3_F_LEVEL_ADD_NODE 168 +# define X509V3_F_NOTICE_SECTION 132 +# define X509V3_F_NREF_NOS 133 +# define X509V3_F_POLICY_CACHE_CREATE 169 +# define X509V3_F_POLICY_CACHE_NEW 170 +# define X509V3_F_POLICY_DATA_NEW 171 +# define X509V3_F_POLICY_SECTION 131 +# define X509V3_F_PROCESS_PCI_VALUE 150 +# define X509V3_F_R2I_CERTPOL 130 +# define X509V3_F_R2I_PCI 155 +# define X509V3_F_S2I_ASN1_IA5STRING 100 +# define X509V3_F_S2I_ASN1_INTEGER 108 +# define X509V3_F_S2I_ASN1_OCTET_STRING 112 +# define X509V3_F_S2I_SKEY_ID 115 +# define X509V3_F_SET_DIST_POINT_NAME 158 +# define X509V3_F_SXNET_ADD_ID_ASC 125 +# define X509V3_F_SXNET_ADD_ID_INTEGER 126 +# define X509V3_F_SXNET_ADD_ID_ULONG 127 +# define X509V3_F_SXNET_GET_ID_ASC 128 +# define X509V3_F_SXNET_GET_ID_ULONG 129 +# define X509V3_F_TREE_INIT 172 +# define X509V3_F_V2I_ASIDENTIFIERS 163 +# define X509V3_F_V2I_ASN1_BIT_STRING 101 +# define X509V3_F_V2I_AUTHORITY_INFO_ACCESS 139 +# define X509V3_F_V2I_AUTHORITY_KEYID 119 +# define X509V3_F_V2I_BASIC_CONSTRAINTS 102 +# define X509V3_F_V2I_CRLD 134 +# define X509V3_F_V2I_EXTENDED_KEY_USAGE 103 +# define X509V3_F_V2I_GENERAL_NAMES 118 +# define X509V3_F_V2I_GENERAL_NAME_EX 117 +# define X509V3_F_V2I_IDP 157 +# define X509V3_F_V2I_IPADDRBLOCKS 159 +# define X509V3_F_V2I_ISSUER_ALT 153 +# define X509V3_F_V2I_NAME_CONSTRAINTS 147 +# define X509V3_F_V2I_POLICY_CONSTRAINTS 146 +# define X509V3_F_V2I_POLICY_MAPPINGS 145 +# define X509V3_F_V2I_SUBJECT_ALT 154 +# define X509V3_F_V2I_TLS_FEATURE 165 +# define X509V3_F_V3_GENERIC_EXTENSION 116 +# define X509V3_F_X509V3_ADD1_I2D 140 +# define X509V3_F_X509V3_ADD_VALUE 105 +# define X509V3_F_X509V3_EXT_ADD 104 +# define X509V3_F_X509V3_EXT_ADD_ALIAS 106 +# define X509V3_F_X509V3_EXT_I2D 136 +# define X509V3_F_X509V3_EXT_NCONF 152 +# define X509V3_F_X509V3_GET_SECTION 142 +# define X509V3_F_X509V3_GET_STRING 143 +# define X509V3_F_X509V3_GET_VALUE_BOOL 110 +# define X509V3_F_X509V3_PARSE_LIST 109 +# define X509V3_F_X509_PURPOSE_ADD 137 +# define X509V3_F_X509_PURPOSE_SET 141 + +/* + * X509V3 reason codes. + */ +# define X509V3_R_BAD_IP_ADDRESS 118 +# define X509V3_R_BAD_OBJECT 119 +# define X509V3_R_BN_DEC2BN_ERROR 100 +# define X509V3_R_BN_TO_ASN1_INTEGER_ERROR 101 +# define X509V3_R_DIRNAME_ERROR 149 +# define X509V3_R_DISTPOINT_ALREADY_SET 160 +# define X509V3_R_DUPLICATE_ZONE_ID 133 +# define X509V3_R_ERROR_CONVERTING_ZONE 131 +# define X509V3_R_ERROR_CREATING_EXTENSION 144 +# define X509V3_R_ERROR_IN_EXTENSION 128 +# define X509V3_R_EXPECTED_A_SECTION_NAME 137 +# define X509V3_R_EXTENSION_EXISTS 145 +# define X509V3_R_EXTENSION_NAME_ERROR 115 +# define X509V3_R_EXTENSION_NOT_FOUND 102 +# define X509V3_R_EXTENSION_SETTING_NOT_SUPPORTED 103 +# define X509V3_R_EXTENSION_VALUE_ERROR 116 +# define X509V3_R_ILLEGAL_EMPTY_EXTENSION 151 +# define X509V3_R_INCORRECT_POLICY_SYNTAX_TAG 152 +# define X509V3_R_INVALID_ASNUMBER 162 +# define X509V3_R_INVALID_ASRANGE 163 +# define X509V3_R_INVALID_BOOLEAN_STRING 104 +# define X509V3_R_INVALID_EXTENSION_STRING 105 +# define X509V3_R_INVALID_INHERITANCE 165 +# define X509V3_R_INVALID_IPADDRESS 166 +# define X509V3_R_INVALID_MULTIPLE_RDNS 161 +# define X509V3_R_INVALID_NAME 106 +# define X509V3_R_INVALID_NULL_ARGUMENT 107 +# define X509V3_R_INVALID_NULL_NAME 108 +# define X509V3_R_INVALID_NULL_VALUE 109 +# define X509V3_R_INVALID_NUMBER 140 +# define X509V3_R_INVALID_NUMBERS 141 +# define X509V3_R_INVALID_OBJECT_IDENTIFIER 110 +# define X509V3_R_INVALID_OPTION 138 +# define X509V3_R_INVALID_POLICY_IDENTIFIER 134 +# define X509V3_R_INVALID_PROXY_POLICY_SETTING 153 +# define X509V3_R_INVALID_PURPOSE 146 +# define X509V3_R_INVALID_SAFI 164 +# define X509V3_R_INVALID_SECTION 135 +# define X509V3_R_INVALID_SYNTAX 143 +# define X509V3_R_ISSUER_DECODE_ERROR 126 +# define X509V3_R_MISSING_VALUE 124 +# define X509V3_R_NEED_ORGANIZATION_AND_NUMBERS 142 +# define X509V3_R_NO_CONFIG_DATABASE 136 +# define X509V3_R_NO_ISSUER_CERTIFICATE 121 +# define X509V3_R_NO_ISSUER_DETAILS 127 +# define X509V3_R_NO_POLICY_IDENTIFIER 139 +# define X509V3_R_NO_PROXY_CERT_POLICY_LANGUAGE_DEFINED 154 +# define X509V3_R_NO_PUBLIC_KEY 114 +# define X509V3_R_NO_SUBJECT_DETAILS 125 +# define X509V3_R_OPERATION_NOT_DEFINED 148 +# define X509V3_R_OTHERNAME_ERROR 147 +# define X509V3_R_POLICY_LANGUAGE_ALREADY_DEFINED 155 +# define X509V3_R_POLICY_PATH_LENGTH 156 +# define X509V3_R_POLICY_PATH_LENGTH_ALREADY_DEFINED 157 +# define X509V3_R_POLICY_WHEN_PROXY_LANGUAGE_REQUIRES_NO_POLICY 159 +# define X509V3_R_SECTION_NOT_FOUND 150 +# define X509V3_R_UNABLE_TO_GET_ISSUER_DETAILS 122 +# define X509V3_R_UNABLE_TO_GET_ISSUER_KEYID 123 +# define X509V3_R_UNKNOWN_BIT_STRING_ARGUMENT 111 +# define X509V3_R_UNKNOWN_EXTENSION 129 +# define X509V3_R_UNKNOWN_EXTENSION_NAME 130 +# define X509V3_R_UNKNOWN_OPTION 120 +# define X509V3_R_UNSUPPORTED_OPTION 117 +# define X509V3_R_UNSUPPORTED_TYPE 167 +# define X509V3_R_USER_TOO_LONG 132 + +#endif diff --git a/ONVIF/include/openssl/lib/android/libcrypto.so b/ONVIF/include/openssl/lib/android/libcrypto.so new file mode 100644 index 0000000..9893bf4 Binary files /dev/null and b/ONVIF/include/openssl/lib/android/libcrypto.so differ diff --git a/ONVIF/include/openssl/lib/android/libssl.so b/ONVIF/include/openssl/lib/android/libssl.so new file mode 100644 index 0000000..23650ee Binary files /dev/null and b/ONVIF/include/openssl/lib/android/libssl.so differ diff --git a/ONVIF/include/openssl/lib/ios/libcrypto.a b/ONVIF/include/openssl/lib/ios/libcrypto.a new file mode 100644 index 0000000..523169d Binary files /dev/null and b/ONVIF/include/openssl/lib/ios/libcrypto.a differ diff --git a/ONVIF/include/openssl/lib/ios/libssl.a b/ONVIF/include/openssl/lib/ios/libssl.a new file mode 100644 index 0000000..6a0e901 Binary files /dev/null and b/ONVIF/include/openssl/lib/ios/libssl.a differ diff --git a/ONVIF/include/openssl/lib/linux/libcrypto.so.1.1 b/ONVIF/include/openssl/lib/linux/libcrypto.so.1.1 new file mode 100644 index 0000000..0741b46 Binary files /dev/null and b/ONVIF/include/openssl/lib/linux/libcrypto.so.1.1 differ diff --git a/ONVIF/include/openssl/lib/linux/libssl.so.1.1 b/ONVIF/include/openssl/lib/linux/libssl.so.1.1 new file mode 100644 index 0000000..f0d49a7 Binary files /dev/null and b/ONVIF/include/openssl/lib/linux/libssl.so.1.1 differ diff --git a/TurboJpeg/Backup/turbojpeg.h b/TurboJpeg/Backup/turbojpeg.h new file mode 100644 index 0000000..0d505df --- /dev/null +++ b/TurboJpeg/Backup/turbojpeg.h @@ -0,0 +1,2426 @@ +/* + * Copyright (C)2009-2015, 2017, 2020-2024 D. R. Commander. + * All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the libjpeg-turbo Project nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS", + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __TURBOJPEG_H__ +#define __TURBOJPEG_H__ + +#include + +#if defined(_WIN32) && defined(DLLDEFINE) +#define DLLEXPORT __declspec(dllexport) +#else +#define DLLEXPORT +#endif +#define DLLCALL + + +/** + * @addtogroup TurboJPEG + * TurboJPEG API. This API provides an interface for generating, decoding, and + * transforming planar YUV and JPEG images in memory. + * + * @anchor YUVnotes + * YUV Image Format Notes + * ---------------------- + * Technically, the JPEG format uses the YCbCr colorspace (which is technically + * not a colorspace but a color transform), but per the convention of the + * digital video community, the TurboJPEG API uses "YUV" to refer to an image + * format consisting of Y, Cb, and Cr image planes. + * + * Each plane is simply a 2D array of bytes, each byte representing the value + * of one of the components (Y, Cb, or Cr) at a particular location in the + * image. The width and height of each plane are determined by the image + * width, height, and level of chrominance subsampling. The luminance plane + * width is the image width padded to the nearest multiple of the horizontal + * subsampling factor (1 in the case of 4:4:4, grayscale, 4:4:0, or 4:4:1; 2 in + * the case of 4:2:2 or 4:2:0; 4 in the case of 4:1:1.) Similarly, the + * luminance plane height is the image height padded to the nearest multiple of + * the vertical subsampling factor (1 in the case of 4:4:4, 4:2:2, grayscale, + * or 4:1:1; 2 in the case of 4:2:0 or 4:4:0; 4 in the case of 4:4:1.) This is + * irrespective of any additional padding that may be specified as an argument + * to the various YUV functions. The chrominance plane width is equal to the + * luminance plane width divided by the horizontal subsampling factor, and the + * chrominance plane height is equal to the luminance plane height divided by + * the vertical subsampling factor. + * + * For example, if the source image is 35 x 35 pixels and 4:2:2 subsampling is + * used, then the luminance plane would be 36 x 35 bytes, and each of the + * chrominance planes would be 18 x 35 bytes. If you specify a row alignment + * of 4 bytes on top of this, then the luminance plane would be 36 x 35 bytes, + * and each of the chrominance planes would be 20 x 35 bytes. + * + * @{ + */ + + +/** + * The number of initialization options + */ +#define TJ_NUMINIT 3 + +/** + * Initialization options + */ +enum TJINIT { + /** + * Initialize the TurboJPEG instance for compression. + */ + TJINIT_COMPRESS, + /** + * Initialize the TurboJPEG instance for decompression. + */ + TJINIT_DECOMPRESS, + /** + * Initialize the TurboJPEG instance for lossless transformation (both + * compression and decompression.) + */ + TJINIT_TRANSFORM +}; + + +/** + * The number of chrominance subsampling options + */ +#define TJ_NUMSAMP 7 + +/** + * Chrominance subsampling options + * + * When pixels are converted from RGB to YCbCr (see #TJCS_YCbCr) or from CMYK + * to YCCK (see #TJCS_YCCK) as part of the JPEG compression process, some of + * the Cb and Cr (chrominance) components can be discarded or averaged together + * to produce a smaller image with little perceptible loss of image quality. + * (The human eye is more sensitive to small changes in brightness than to + * small changes in color.) This is called "chrominance subsampling". + */ +enum TJSAMP { + /** + * 4:4:4 chrominance subsampling (no chrominance subsampling) + * + * The JPEG or YUV image will contain one chrominance component for every + * pixel in the source image. + */ + TJSAMP_444, + /** + * 4:2:2 chrominance subsampling + * + * The JPEG or YUV image will contain one chrominance component for every 2x1 + * block of pixels in the source image. + */ + TJSAMP_422, + /** + * 4:2:0 chrominance subsampling + * + * The JPEG or YUV image will contain one chrominance component for every 2x2 + * block of pixels in the source image. + */ + TJSAMP_420, + /** + * Grayscale + * + * The JPEG or YUV image will contain no chrominance components. + */ + TJSAMP_GRAY, + /** + * 4:4:0 chrominance subsampling + * + * The JPEG or YUV image will contain one chrominance component for every 1x2 + * block of pixels in the source image. + * + * @note 4:4:0 subsampling is not fully accelerated in libjpeg-turbo. + */ + TJSAMP_440, + /** + * 4:1:1 chrominance subsampling + * + * The JPEG or YUV image will contain one chrominance component for every 4x1 + * block of pixels in the source image. All else being equal, a JPEG image + * with 4:1:1 subsampling is almost exactly the same size as a JPEG image + * with 4:2:0 subsampling, and in the aggregate, both subsampling methods + * produce approximately the same perceptual quality. However, 4:1:1 is + * better able to reproduce sharp horizontal features. + * + * @note 4:1:1 subsampling is not fully accelerated in libjpeg-turbo. + */ + TJSAMP_411, + /** + * 4:4:1 chrominance subsampling + * + * The JPEG or YUV image will contain one chrominance component for every 1x4 + * block of pixels in the source image. All else being equal, a JPEG image + * with 4:4:1 subsampling is almost exactly the same size as a JPEG image + * with 4:2:0 subsampling, and in the aggregate, both subsampling methods + * produce approximately the same perceptual quality. However, 4:4:1 is + * better able to reproduce sharp vertical features. + * + * @note 4:4:1 subsampling is not fully accelerated in libjpeg-turbo. + */ + TJSAMP_441, + /** + * Unknown subsampling + * + * The JPEG image uses an unusual type of chrominance subsampling. Such + * images can be decompressed into packed-pixel images, but they cannot be + * - decompressed into planar YUV images, + * - losslessly transformed if #TJXOPT_CROP is specified and #TJXOPT_GRAY is + * not specified, or + * - partially decompressed using a cropping region. + */ + TJSAMP_UNKNOWN = -1 +}; + +/** + * iMCU width (in pixels) for a given level of chrominance subsampling + * + * In a typical lossy JPEG image, 8x8 blocks of DCT coefficients for each + * component are interleaved in a single scan. If the image uses chrominance + * subsampling, then multiple luminance blocks are stored together, followed by + * a single block for each chrominance component. The minimum set of + * full-resolution luminance block(s) and corresponding (possibly subsampled) + * chrominance blocks necessary to represent at least one DCT block per + * component is called a "Minimum Coded Unit" or "MCU". (For example, an MCU + * in an interleaved lossy JPEG image that uses 4:2:2 subsampling consists of + * two luminance blocks followed by one block for each chrominance component.) + * In a non-interleaved lossy JPEG image, each component is stored in a + * separate scan, and an MCU is a single DCT block, so we use the term "iMCU" + * (interleaved MCU) to refer to the equivalent of an MCU in an interleaved + * JPEG image. For the common case of interleaved JPEG images, an iMCU is the + * same as an MCU. + * + * iMCU sizes: + * - 8x8 for no subsampling or grayscale + * - 16x8 for 4:2:2 + * - 8x16 for 4:4:0 + * - 16x16 for 4:2:0 + * - 32x8 for 4:1:1 + * - 8x32 for 4:4:1 + */ +static const int tjMCUWidth[TJ_NUMSAMP] = { 8, 16, 16, 8, 8, 32, 8 }; + +/** + * iMCU height (in pixels) for a given level of chrominance subsampling + * + * In a typical lossy JPEG image, 8x8 blocks of DCT coefficients for each + * component are interleaved in a single scan. If the image uses chrominance + * subsampling, then multiple luminance blocks are stored together, followed by + * a single block for each chrominance component. The minimum set of + * full-resolution luminance block(s) and corresponding (possibly subsampled) + * chrominance blocks necessary to represent at least one DCT block per + * component is called a "Minimum Coded Unit" or "MCU". (For example, an MCU + * in an interleaved lossy JPEG image that uses 4:2:2 subsampling consists of + * two luminance blocks followed by one block for each chrominance component.) + * In a non-interleaved lossy JPEG image, each component is stored in a + * separate scan, and an MCU is a single DCT block, so we use the term "iMCU" + * (interleaved MCU) to refer to the equivalent of an MCU in an interleaved + * JPEG image. For the common case of interleaved JPEG images, an iMCU is the + * same as an MCU. + * + * iMCU sizes: + * - 8x8 for no subsampling or grayscale + * - 16x8 for 4:2:2 + * - 8x16 for 4:4:0 + * - 16x16 for 4:2:0 + * - 32x8 for 4:1:1 + * - 8x32 for 4:4:1 + */ +static const int tjMCUHeight[TJ_NUMSAMP] = { 8, 8, 16, 8, 16, 8, 32 }; + + +/** + * The number of pixel formats + */ +#define TJ_NUMPF 12 + +/** + * Pixel formats + */ +enum TJPF { + /** + * RGB pixel format + * + * The red, green, and blue components in the image are stored in 3-sample + * pixels in the order R, G, B from lowest to highest memory address within + * each pixel. + */ + TJPF_RGB, + /** + * BGR pixel format + * + * The red, green, and blue components in the image are stored in 3-sample + * pixels in the order B, G, R from lowest to highest memory address within + * each pixel. + */ + TJPF_BGR, + /** + * RGBX pixel format + * + * The red, green, and blue components in the image are stored in 4-sample + * pixels in the order R, G, B from lowest to highest memory address within + * each pixel. The X component is ignored when compressing/encoding and + * undefined when decompressing/decoding. + */ + TJPF_RGBX, + /** + * BGRX pixel format + * + * The red, green, and blue components in the image are stored in 4-sample + * pixels in the order B, G, R from lowest to highest memory address within + * each pixel. The X component is ignored when compressing/encoding and + * undefined when decompressing/decoding. + */ + TJPF_BGRX, + /** + * XBGR pixel format + * + * The red, green, and blue components in the image are stored in 4-sample + * pixels in the order R, G, B from highest to lowest memory address within + * each pixel. The X component is ignored when compressing/encoding and + * undefined when decompressing/decoding. + */ + TJPF_XBGR, + /** + * XRGB pixel format + * + * The red, green, and blue components in the image are stored in 4-sample + * pixels in the order B, G, R from highest to lowest memory address within + * each pixel. The X component is ignored when compressing/encoding and + * undefined when decompressing/decoding. + */ + TJPF_XRGB, + /** + * Grayscale pixel format + * + * Each 1-sample pixel represents a luminance (brightness) level from 0 to + * the maximum sample value (255 for 8-bit samples, 4095 for 12-bit samples, + * and 65535 for 16-bit samples.) + */ + TJPF_GRAY, + /** + * RGBA pixel format + * + * This is the same as @ref TJPF_RGBX, except that when + * decompressing/decoding, the X component is guaranteed to be equal to the + * maximum sample value, which can be interpreted as an opaque alpha channel. + */ + TJPF_RGBA, + /** + * BGRA pixel format + * + * This is the same as @ref TJPF_BGRX, except that when + * decompressing/decoding, the X component is guaranteed to be equal to the + * maximum sample value, which can be interpreted as an opaque alpha channel. + */ + TJPF_BGRA, + /** + * ABGR pixel format + * + * This is the same as @ref TJPF_XBGR, except that when + * decompressing/decoding, the X component is guaranteed to be equal to the + * maximum sample value, which can be interpreted as an opaque alpha channel. + */ + TJPF_ABGR, + /** + * ARGB pixel format + * + * This is the same as @ref TJPF_XRGB, except that when + * decompressing/decoding, the X component is guaranteed to be equal to the + * maximum sample value, which can be interpreted as an opaque alpha channel. + */ + TJPF_ARGB, + /** + * CMYK pixel format + * + * Unlike RGB, which is an additive color model used primarily for display, + * CMYK (Cyan/Magenta/Yellow/Key) is a subtractive color model used primarily + * for printing. In the CMYK color model, the value of each color component + * typically corresponds to an amount of cyan, magenta, yellow, or black ink + * that is applied to a white background. In order to convert between CMYK + * and RGB, it is necessary to use a color management system (CMS.) A CMS + * will attempt to map colors within the printer's gamut to perceptually + * similar colors in the display's gamut and vice versa, but the mapping is + * typically not 1:1 or reversible, nor can it be defined with a simple + * formula. Thus, such a conversion is out of scope for a codec library. + * However, the TurboJPEG API allows for compressing packed-pixel CMYK images + * into YCCK JPEG images (see #TJCS_YCCK) and decompressing YCCK JPEG images + * into packed-pixel CMYK images. + */ + TJPF_CMYK, + /** + * Unknown pixel format + * + * Currently this is only used by #tj3LoadImage8(), #tj3LoadImage12(), and + * #tj3LoadImage16(). + */ + TJPF_UNKNOWN = -1 +}; + +/** + * Red offset (in samples) for a given pixel format + * + * This specifies the number of samples that the red component is offset from + * the start of the pixel. For instance, if an 8-bit-per-component pixel of + * format TJPF_BGRX is stored in `unsigned char pixel[]`, then the red + * component is `pixel[tjRedOffset[TJPF_BGRX]]`. The offset is -1 if the pixel + * format does not have a red component. + */ +static const int tjRedOffset[TJ_NUMPF] = { + 0, 2, 0, 2, 3, 1, -1, 0, 2, 3, 1, -1 +}; +/** + * Green offset (in samples) for a given pixel format + * + * This specifies the number of samples that the green component is offset from + * the start of the pixel. For instance, if an 8-bit-per-component pixel of + * format TJPF_BGRX is stored in `unsigned char pixel[]`, then the green + * component is `pixel[tjGreenOffset[TJPF_BGRX]]`. The offset is -1 if the + * pixel format does not have a green component. + */ +static const int tjGreenOffset[TJ_NUMPF] = { + 1, 1, 1, 1, 2, 2, -1, 1, 1, 2, 2, -1 +}; +/** + * Blue offset (in samples) for a given pixel format + * + * This specifies the number of samples that the blue component is offset from + * the start of the pixel. For instance, if an 8-bit-per-component pixel of + * format TJPF_BGRX is stored in `unsigned char pixel[]`, then the blue + * component is `pixel[tjBlueOffset[TJPF_BGRX]]`. The offset is -1 if the + * pixel format does not have a blue component. + */ +static const int tjBlueOffset[TJ_NUMPF] = { + 2, 0, 2, 0, 1, 3, -1, 2, 0, 1, 3, -1 +}; +/** + * Alpha offset (in samples) for a given pixel format + * + * This specifies the number of samples that the alpha component is offset from + * the start of the pixel. For instance, if an 8-bit-per-component pixel of + * format TJPF_BGRA is stored in `unsigned char pixel[]`, then the alpha + * component is `pixel[tjAlphaOffset[TJPF_BGRA]]`. The offset is -1 if the + * pixel format does not have an alpha component. + */ +static const int tjAlphaOffset[TJ_NUMPF] = { + -1, -1, -1, -1, -1, -1, -1, 3, 3, 0, 0, -1 +}; +/** + * Pixel size (in samples) for a given pixel format + */ +static const int tjPixelSize[TJ_NUMPF] = { + 3, 3, 4, 4, 4, 4, 1, 4, 4, 4, 4, 4 +}; + + +/** + * The number of JPEG colorspaces + */ +#define TJ_NUMCS 5 + +/** + * JPEG colorspaces + */ +enum TJCS { + /** + * RGB colorspace + * + * When generating the JPEG image, the R, G, and B components in the source + * image are reordered into image planes, but no colorspace conversion or + * subsampling is performed. RGB JPEG images can be generated from and + * decompressed to packed-pixel images with any of the extended RGB or + * grayscale pixel formats, but they cannot be generated from or + * decompressed to planar YUV images. + */ + TJCS_RGB, + /** + * YCbCr colorspace + * + * YCbCr is not an absolute colorspace but rather a mathematical + * transformation of RGB designed solely for storage and transmission. YCbCr + * images must be converted to RGB before they can be displayed. In the + * YCbCr colorspace, the Y (luminance) component represents the black & white + * portion of the original image, and the Cb and Cr (chrominance) components + * represent the color portion of the original image. Historically, the + * analog equivalent of this transformation allowed the same signal to be + * displayed to both black & white and color televisions, but JPEG images use + * YCbCr primarily because it allows the color data to be optionally + * subsampled in order to reduce network and disk usage. YCbCr is the most + * common JPEG colorspace, and YCbCr JPEG images can be generated from and + * decompressed to packed-pixel images with any of the extended RGB or + * grayscale pixel formats. YCbCr JPEG images can also be generated from + * and decompressed to planar YUV images. + */ + TJCS_YCbCr, + /** + * Grayscale colorspace + * + * The JPEG image retains only the luminance data (Y component), and any + * color data from the source image is discarded. Grayscale JPEG images can + * be generated from and decompressed to packed-pixel images with any of the + * extended RGB or grayscale pixel formats, or they can be generated from + * and decompressed to planar YUV images. + */ + TJCS_GRAY, + /** + * CMYK colorspace + * + * When generating the JPEG image, the C, M, Y, and K components in the + * source image are reordered into image planes, but no colorspace conversion + * or subsampling is performed. CMYK JPEG images can only be generated from + * and decompressed to packed-pixel images with the CMYK pixel format. + */ + TJCS_CMYK, + /** + * YCCK colorspace + * + * YCCK (AKA "YCbCrK") is not an absolute colorspace but rather a + * mathematical transformation of CMYK designed solely for storage and + * transmission. It is to CMYK as YCbCr is to RGB. CMYK pixels can be + * reversibly transformed into YCCK, and as with YCbCr, the chrominance + * components in the YCCK pixels can be subsampled without incurring major + * perceptual loss. YCCK JPEG images can only be generated from and + * decompressed to packed-pixel images with the CMYK pixel format. + */ + TJCS_YCCK +}; + + +/** + * Parameters + */ +enum TJPARAM { + /** + * Error handling behavior + * + * **Value** + * - `0` *[default]* Allow the current compression/decompression/transform + * operation to complete unless a fatal error is encountered. + * - `1` Immediately discontinue the current + * compression/decompression/transform operation if a warning (non-fatal + * error) occurs. + */ + TJPARAM_STOPONWARNING, + /** + * Row order in packed-pixel source/destination images + * + * **Value** + * - `0` *[default]* top-down (X11) order + * - `1` bottom-up (Windows, OpenGL) order + */ + TJPARAM_BOTTOMUP, + /** + * JPEG destination buffer (re)allocation [compression, lossless + * transformation] + * + * **Value** + * - `0` *[default]* Attempt to allocate or reallocate the JPEG destination + * buffer as needed. + * - `1` Generate an error if the JPEG destination buffer is invalid or too + * small. + */ + TJPARAM_NOREALLOC, + /** + * Perceptual quality of lossy JPEG images [compression only] + * + * **Value** + * - `1`-`100` (`1` = worst quality but best compression, `100` = best + * quality but worst compression) *[no default; must be explicitly + * specified]* + */ + TJPARAM_QUALITY, + /** + * Chrominance subsampling level + * + * The JPEG or YUV image uses (decompression, decoding) or will use (lossy + * compression, encoding) the specified level of chrominance subsampling. + * + * **Value** + * - One of the @ref TJSAMP "chrominance subsampling options" *[no default; + * must be explicitly specified for lossy compression, encoding, and + * decoding]* + */ + TJPARAM_SUBSAMP, + /** + * JPEG width (in pixels) [decompression only, read-only] + */ + TJPARAM_JPEGWIDTH, + /** + * JPEG height (in pixels) [decompression only, read-only] + */ + TJPARAM_JPEGHEIGHT, + /** + * JPEG data precision (bits per sample) [decompression only, read-only] + * + * The JPEG image uses the specified number of bits per sample. + * + * **Value** + * - `8`, `12`, or `16` + * + * 12-bit data precision implies #TJPARAM_OPTIMIZE unless #TJPARAM_ARITHMETIC + * is set. + */ + TJPARAM_PRECISION, + /** + * JPEG colorspace + * + * The JPEG image uses (decompression) or will use (lossy compression) the + * specified colorspace. + * + * **Value** + * - One of the @ref TJCS "JPEG colorspaces" *[default for lossy compression: + * automatically selected based on the subsampling level and pixel format]* + */ + TJPARAM_COLORSPACE, + /** + * Chrominance upsampling algorithm [lossy decompression only] + * + * **Value** + * - `0` *[default]* Use smooth upsampling when decompressing a JPEG image + * that was generated using chrominance subsampling. This creates a smooth + * transition between neighboring chrominance components in order to reduce + * upsampling artifacts in the decompressed image. + * - `1` Use the fastest chrominance upsampling algorithm available, which + * may combine upsampling with color conversion. + */ + TJPARAM_FASTUPSAMPLE, + /** + * DCT/IDCT algorithm [lossy compression and decompression] + * + * **Value** + * - `0` *[default]* Use the most accurate DCT/IDCT algorithm available. + * - `1` Use the fastest DCT/IDCT algorithm available. + * + * This parameter is provided mainly for backward compatibility with libjpeg, + * which historically implemented several different DCT/IDCT algorithms + * because of performance limitations with 1990s CPUs. In the libjpeg-turbo + * implementation of the TurboJPEG API: + * - The "fast" and "accurate" DCT/IDCT algorithms perform similarly on + * modern x86/x86-64 CPUs that support AVX2 instructions. + * - The "fast" algorithm is generally only about 5-15% faster than the + * "accurate" algorithm on other types of CPUs. + * - The difference in accuracy between the "fast" and "accurate" algorithms + * is the most pronounced at JPEG quality levels above 90 and tends to be + * more pronounced with decompression than with compression. + * - For JPEG quality levels above 97, the "fast" algorithm degrades and is + * not fully accelerated, so it is slower than the "accurate" algorithm. + */ + TJPARAM_FASTDCT, + /** + * Huffman table optimization [lossy compression, lossless transformation] + * + * **Value** + * - `0` *[default]* The JPEG image will use the default Huffman tables. + * - `1` Optimal Huffman tables will be computed for the JPEG image. For + * lossless transformation, this can also be specified using + * #TJXOPT_OPTIMIZE. + * + * Huffman table optimization improves compression slightly (generally 5% or + * less), but it reduces compression performance considerably. + */ + TJPARAM_OPTIMIZE, + /** + * Progressive JPEG + * + * In a progressive JPEG image, the DCT coefficients are split across + * multiple "scans" of increasing quality. Thus, a low-quality scan + * containing the lowest-frequency DCT coefficients can be transmitted first + * and refined with subsequent higher-quality scans containing + * higher-frequency DCT coefficients. When using Huffman entropy coding, the + * progressive JPEG format also provides an "end-of-bands (EOB) run" feature + * that allows large groups of zeroes, potentially spanning multiple MCUs, + * to be represented using only a few bytes. + * + * **Value** + * - `0` *[default for compression, lossless transformation]* The lossy JPEG + * image is (decompression) or will be (compression, lossless transformation) + * single-scan. + * - `1` The lossy JPEG image is (decompression) or will be (compression, + * lossless transformation) progressive. For lossless transformation, this + * can also be specified using #TJXOPT_PROGRESSIVE. + * + * Progressive JPEG images generally have better compression ratios than + * single-scan JPEG images (much better if the image has large areas of solid + * color), but progressive JPEG compression and decompression is considerably + * slower than single-scan JPEG compression and decompression. Can be + * combined with #TJPARAM_ARITHMETIC. Implies #TJPARAM_OPTIMIZE unless + * #TJPARAM_ARITHMETIC is also set. + */ + TJPARAM_PROGRESSIVE, + /** + * Progressive JPEG scan limit for lossy JPEG images [decompression, lossless + * transformation] + * + * Setting this parameter causes the decompression and transform functions to + * return an error if the number of scans in a progressive JPEG image exceeds + * the specified limit. The primary purpose of this is to allow + * security-critical applications to guard against an exploit of the + * progressive JPEG format described in + * this report. + * + * **Value** + * - maximum number of progressive JPEG scans that the decompression and + * transform functions will process *[default: `0` (no limit)]* + * + * @see #TJPARAM_PROGRESSIVE + */ + TJPARAM_SCANLIMIT, + /** + * Arithmetic entropy coding + * + * **Value** + * - `0` *[default for compression, lossless transformation]* The lossy JPEG + * image uses (decompression) or will use (compression, lossless + * transformation) Huffman entropy coding. + * - `1` The lossy JPEG image uses (decompression) or will use (compression, + * lossless transformation) arithmetic entropy coding. For lossless + * transformation, this can also be specified using #TJXOPT_ARITHMETIC. + * + * Arithmetic entropy coding generally improves compression relative to + * Huffman entropy coding, but it reduces compression and decompression + * performance considerably. Can be combined with #TJPARAM_PROGRESSIVE. + */ + TJPARAM_ARITHMETIC, + /** + * Lossless JPEG + * + * **Value** + * - `0` *[default for compression]* The JPEG image is (decompression) or + * will be (compression) lossy/DCT-based. + * - `1` The JPEG image is (decompression) or will be (compression) + * lossless/predictive. + * + * In most cases, lossless JPEG compression and decompression is considerably + * slower than lossy JPEG compression and decompression, and lossless JPEG + * images are much larger than lossy JPEG images. Thus, lossless JPEG images + * are typically used only for applications that require mathematically + * lossless compression. Also note that the following features are not + * available with lossless JPEG images: + * - Colorspace conversion (lossless JPEG images always use #TJCS_RGB, + * #TJCS_GRAY, or #TJCS_CMYK, depending on the pixel format of the source + * image) + * - Chrominance subsampling (lossless JPEG images always use #TJSAMP_444) + * - JPEG quality selection + * - DCT/IDCT algorithm selection + * - Progressive JPEG + * - Arithmetic entropy coding + * - Compression from/decompression to planar YUV images + * - Decompression scaling + * - Lossless transformation + * + * @see #TJPARAM_LOSSLESSPSV, #TJPARAM_LOSSLESSPT + */ + TJPARAM_LOSSLESS, + /** + * Lossless JPEG predictor selection value (PSV) + * + * **Value** + * - `1`-`7` *[default for compression: `1`]* + * + * Lossless JPEG compression shares no algorithms with lossy JPEG + * compression. Instead, it uses differential pulse-code modulation (DPCM), + * an algorithm whereby each sample is encoded as the difference between the + * sample's value and a "predictor", which is based on the values of + * neighboring samples. If Ra is the sample immediately to the left of the + * current sample, Rb is the sample immediately above the current sample, and + * Rc is the sample diagonally to the left and above the current sample, then + * the relationship between the predictor selection value and the predictor + * is as follows: + * + * PSV | Predictor + * ----|---------- + * 1 | Ra + * 2 | Rb + * 3 | Rc + * 4 | Ra + Rb – Rc + * 5 | Ra + (Rb – Rc) / 2 + * 6 | Rb + (Ra – Rc) / 2 + * 7 | (Ra + Rb) / 2 + * + * Predictors 1-3 are 1-dimensional predictors, whereas Predictors 4-7 are + * 2-dimensional predictors. The best predictor for a particular image + * depends on the image. + * + * @see #TJPARAM_LOSSLESS + */ + TJPARAM_LOSSLESSPSV, + /** + * Lossless JPEG point transform (Pt) + * + * **Value** + * - `0` through ***precision*** *- 1*, where ***precision*** is the JPEG + * data precision in bits *[default for compression: `0`]* + * + * A point transform value of `0` is necessary in order to generate a fully + * lossless JPEG image. (A non-zero point transform value right-shifts the + * input samples by the specified number of bits, which is effectively a form + * of lossy color quantization.) + * + * @see #TJPARAM_LOSSLESS, #TJPARAM_PRECISION + */ + TJPARAM_LOSSLESSPT, + /** + * JPEG restart marker interval in MCUs [lossy compression only] + * + * The nature of entropy coding is such that a corrupt JPEG image cannot + * be decompressed beyond the point of corruption unless it contains restart + * markers. A restart marker stops and restarts the entropy coding algorithm + * so that, if a JPEG image is corrupted, decompression can resume at the + * next marker. Thus, adding more restart markers improves the fault + * tolerance of the JPEG image, but adding too many restart markers can + * adversely affect the compression ratio and performance. + * + * In typical JPEG images, an MCU (Minimum Coded Unit) is the minimum set of + * interleaved "data units" (8x8 DCT blocks if the image is lossy or samples + * if the image is lossless) necessary to represent at least one data unit + * per component. (For example, an MCU in an interleaved lossy JPEG image + * that uses 4:2:2 subsampling consists of two luminance blocks followed by + * one block for each chrominance component.) In single-component or + * non-interleaved JPEG images, an MCU is the same as a data unit. + * + * **Value** + * - the number of MCUs between each restart marker *[default: `0` (no + * restart markers)]* + * + * Setting this parameter to a non-zero value sets #TJPARAM_RESTARTROWS to 0. + */ + TJPARAM_RESTARTBLOCKS, + /** + * JPEG restart marker interval in MCU rows [compression only] + * + * See #TJPARAM_RESTARTBLOCKS for a description of restart markers and MCUs. + * An MCU row is a row of MCUs spanning the entire width of the image. + * + * **Value** + * - the number of MCU rows between each restart marker *[default: `0` (no + * restart markers)]* + * + * Setting this parameter to a non-zero value sets #TJPARAM_RESTARTBLOCKS to + * 0. + */ + TJPARAM_RESTARTROWS, + /** + * JPEG horizontal pixel density + * + * **Value** + * - The JPEG image has (decompression) or will have (compression) the + * specified horizontal pixel density *[default for compression: `1`]*. + * + * This value is stored in or read from the JPEG header. It does not affect + * the contents of the JPEG image. Note that this parameter is set by + * #tj3LoadImage8() when loading a Windows BMP file that contains pixel + * density information, and the value of this parameter is stored to a + * Windows BMP file by #tj3SaveImage8() if the value of #TJPARAM_DENSITYUNITS + * is `2`. + * + * @see TJPARAM_DENSITYUNITS + */ + TJPARAM_XDENSITY, + /** + * JPEG vertical pixel density + * + * **Value** + * - The JPEG image has (decompression) or will have (compression) the + * specified vertical pixel density *[default for compression: `1`]*. + * + * This value is stored in or read from the JPEG header. It does not affect + * the contents of the JPEG image. Note that this parameter is set by + * #tj3LoadImage8() when loading a Windows BMP file that contains pixel + * density information, and the value of this parameter is stored to a + * Windows BMP file by #tj3SaveImage8() if the value of #TJPARAM_DENSITYUNITS + * is `2`. + * + * @see TJPARAM_DENSITYUNITS + */ + TJPARAM_YDENSITY, + /** + * JPEG pixel density units + * + * **Value** + * - `0` *[default for compression]* The pixel density of the JPEG image is + * expressed (decompression) or will be expressed (compression) in unknown + * units. + * - `1` The pixel density of the JPEG image is expressed (decompression) or + * will be expressed (compression) in units of pixels/inch. + * - `2` The pixel density of the JPEG image is expressed (decompression) or + * will be expressed (compression) in units of pixels/cm. + * + * This value is stored in or read from the JPEG header. It does not affect + * the contents of the JPEG image. Note that this parameter is set by + * #tj3LoadImage8() when loading a Windows BMP file that contains pixel + * density information, and the value of this parameter is stored to a + * Windows BMP file by #tj3SaveImage8() if the value is `2`. + * + * @see TJPARAM_XDENSITY, TJPARAM_YDENSITY + */ + TJPARAM_DENSITYUNITS, + /** + * Memory limit for intermediate buffers + * + * **Value** + * - the maximum amount of memory (in megabytes) that will be allocated for + * intermediate buffers, which are used with progressive JPEG compression and + * decompression, Huffman table optimization, lossless JPEG compression, and + * lossless transformation *[default: `0` (no limit)]* + */ + TJPARAM_MAXMEMORY, + /** + * Image size limit [decompression, lossless transformation, packed-pixel + * image loading] + * + * Setting this parameter causes the decompression, transform, and image + * loading functions to return an error if the number of pixels in the source + * image exceeds the specified limit. This allows security-critical + * applications to guard against excessive memory consumption. + * + * **Value** + * - maximum number of pixels that the decompression, transform, and image + * loading functions will process *[default: `0` (no limit)]* + */ + TJPARAM_MAXPIXELS +}; + + +/** + * The number of error codes + */ +#define TJ_NUMERR 2 + +/** + * Error codes + */ +enum TJERR { + /** + * The error was non-fatal and recoverable, but the destination image may + * still be corrupt. + */ + TJERR_WARNING, + /** + * The error was fatal and non-recoverable. + */ + TJERR_FATAL +}; + + +/** + * The number of transform operations + */ +#define TJ_NUMXOP 8 + +/** + * Transform operations for #tj3Transform() + */ +enum TJXOP { + /** + * Do not transform the position of the image pixels. + */ + TJXOP_NONE, + /** + * Flip (mirror) image horizontally. This transform is imperfect if there + * are any partial iMCUs on the right edge (see #TJXOPT_PERFECT.) + */ + TJXOP_HFLIP, + /** + * Flip (mirror) image vertically. This transform is imperfect if there are + * any partial iMCUs on the bottom edge (see #TJXOPT_PERFECT.) + */ + TJXOP_VFLIP, + /** + * Transpose image (flip/mirror along upper left to lower right axis.) This + * transform is always perfect. + */ + TJXOP_TRANSPOSE, + /** + * Transverse transpose image (flip/mirror along upper right to lower left + * axis.) This transform is imperfect if there are any partial iMCUs in the + * image (see #TJXOPT_PERFECT.) + */ + TJXOP_TRANSVERSE, + /** + * Rotate image clockwise by 90 degrees. This transform is imperfect if + * there are any partial iMCUs on the bottom edge (see #TJXOPT_PERFECT.) + */ + TJXOP_ROT90, + /** + * Rotate image 180 degrees. This transform is imperfect if there are any + * partial iMCUs in the image (see #TJXOPT_PERFECT.) + */ + TJXOP_ROT180, + /** + * Rotate image counter-clockwise by 90 degrees. This transform is imperfect + * if there are any partial iMCUs on the right edge (see #TJXOPT_PERFECT.) + */ + TJXOP_ROT270 +}; + + +/** + * This option causes #tj3Transform() to return an error if the transform is + * not perfect. Lossless transforms operate on iMCUs, the size of which + * depends on the level of chrominance subsampling used (see #tjMCUWidth and + * #tjMCUHeight.) If the image's width or height is not evenly divisible by + * the iMCU size, then there will be partial iMCUs on the right and/or bottom + * edges. It is not possible to move these partial iMCUs to the top or left of + * the image, so any transform that would require that is "imperfect." If this + * option is not specified, then any partial iMCUs that cannot be transformed + * will be left in place, which will create odd-looking strips on the right or + * bottom edge of the image. + */ +#define TJXOPT_PERFECT (1 << 0) +/** + * Discard any partial iMCUs that cannot be transformed. + */ +#define TJXOPT_TRIM (1 << 1) +/** + * Enable lossless cropping. See #tj3Transform() for more information. + */ +#define TJXOPT_CROP (1 << 2) +/** + * Discard the color data in the source image, and generate a grayscale + * destination image. + */ +#define TJXOPT_GRAY (1 << 3) +/** + * Do not generate a destination image. (This can be used in conjunction with + * a custom filter to capture the transformed DCT coefficients without + * transcoding them.) + */ +#define TJXOPT_NOOUTPUT (1 << 4) +/** + * Generate a progressive destination image instead of a single-scan + * destination image. Progressive JPEG images generally have better + * compression ratios than single-scan JPEG images (much better if the image + * has large areas of solid color), but progressive JPEG decompression is + * considerably slower than single-scan JPEG decompression. Can be combined + * with #TJXOPT_ARITHMETIC. Implies #TJXOPT_OPTIMIZE unless #TJXOPT_ARITHMETIC + * is also specified. + */ +#define TJXOPT_PROGRESSIVE (1 << 5) +/** + * Do not copy any extra markers (including Exif and ICC profile data) from the + * source image to the destination image. + */ +#define TJXOPT_COPYNONE (1 << 6) +/** + * Enable arithmetic entropy coding in the destination image. Arithmetic + * entropy coding generally improves compression relative to Huffman entropy + * coding (the default), but it reduces decompression performance considerably. + * Can be combined with #TJXOPT_PROGRESSIVE. + */ +#define TJXOPT_ARITHMETIC (1 << 7) +/** + * Enable Huffman table optimization for the destination image. Huffman table + * optimization improves compression slightly (generally 5% or less.) + */ +#define TJXOPT_OPTIMIZE (1 << 8) + + +/** + * Scaling factor + */ +typedef struct { + /** + * Numerator + */ + int num; + /** + * Denominator + */ + int denom; +} tjscalingfactor; + +/** + * Cropping region + */ +typedef struct { + /** + * The left boundary of the cropping region. For lossless transformation, + * this must be evenly divisible by the iMCU width (see #tjMCUWidth) of the + * destination image. For decompression, this must be evenly divisible by + * the scaled iMCU width of the source image. + */ + int x; + /** + * The upper boundary of the cropping region. For lossless transformation, + * this must be evenly divisible by the iMCU height (see #tjMCUHeight) of the + * destination image. + */ + int y; + /** + * The width of the cropping region. Setting this to 0 is the equivalent of + * setting it to the width of the source JPEG image - x. + */ + int w; + /** + * The height of the cropping region. Setting this to 0 is the equivalent of + * setting it to the height of the source JPEG image - y. + */ + int h; +} tjregion; + +/** + * A #tjregion structure that specifies no cropping + */ +static const tjregion TJUNCROPPED = { 0, 0, 0, 0 }; + +/** + * Lossless transform + */ +typedef struct tjtransform { + /** + * Cropping region + */ + tjregion r; + /** + * One of the @ref TJXOP "transform operations" + */ + int op; + /** + * The bitwise OR of one of more of the @ref TJXOPT_ARITHMETIC + * "transform options" + */ + int options; + /** + * Arbitrary data that can be accessed within the body of the callback + * function + */ + void *data; + /** + * A callback function that can be used to modify the DCT coefficients after + * they are losslessly transformed but before they are transcoded to a new + * JPEG image. This allows for custom filters or other transformations to be + * applied in the frequency domain. + * + * @param coeffs pointer to an array of transformed DCT coefficients. (NOTE: + * This pointer is not guaranteed to be valid once the callback returns, so + * applications wishing to hand off the DCT coefficients to another function + * or library should make a copy of them within the body of the callback.) + * + * @param arrayRegion #tjregion structure containing the width and height of + * the array pointed to by `coeffs` as well as its offset relative to the + * component plane. TurboJPEG implementations may choose to split each + * component plane into multiple DCT coefficient arrays and call the callback + * function once for each array. + * + * @param planeRegion #tjregion structure containing the width and height of + * the component plane to which `coeffs` belongs + * + * @param componentID ID number of the component plane to which `coeffs` + * belongs. (Y, Cb, and Cr have, respectively, ID's of 0, 1, and 2 in + * typical JPEG images.) + * + * @param transformID ID number of the transformed image to which `coeffs` + * belongs. This is the same as the index of the transform in the + * `transforms` array that was passed to #tj3Transform(). + * + * @param transform a pointer to a #tjtransform structure that specifies the + * parameters and/or cropping region for this transform + * + * @return 0 if the callback was successful, or -1 if an error occurred. + */ + int (*customFilter) (short *coeffs, tjregion arrayRegion, + tjregion planeRegion, int componentID, int transformID, + struct tjtransform *transform); +} tjtransform; + +/** + * TurboJPEG instance handle + */ +typedef void *tjhandle; + + +/** + * Compute the scaled value of `dimension` using the given scaling factor. + * This macro performs the integer equivalent of `ceil(dimension * + * scalingFactor)`. + */ +#define TJSCALED(dimension, scalingFactor) \ + (((dimension) * scalingFactor.num + scalingFactor.denom - 1) / \ + scalingFactor.denom) + +/** + * A #tjscalingfactor structure that specifies a scaling factor of 1/1 (no + * scaling) + */ +static const tjscalingfactor TJUNSCALED = { 1, 1 }; + + +#ifdef __cplusplus +extern "C" { +#endif + + +/** + * Create a new TurboJPEG instance. + * + * @param initType one of the @ref TJINIT "initialization options" + * + * @return a handle to the newly-created instance, or NULL if an error occurred + * (see #tj3GetErrorStr().) + */ +DLLEXPORT tjhandle tj3Init(int initType); + + +/** + * Destroy a TurboJPEG instance. + * + * @param handle handle to a TurboJPEG instance. If the handle is NULL, then + * this function has no effect. + */ +DLLEXPORT void tj3Destroy(tjhandle handle); + + +/** + * Returns a descriptive error message explaining why the last command failed. + * + * @param handle handle to a TurboJPEG instance, or NULL if the error was + * generated by a global function (but note that retrieving the error message + * for a global function is thread-safe only on platforms that support + * thread-local storage.) + * + * @return a descriptive error message explaining why the last command failed. + */ +DLLEXPORT char *tj3GetErrorStr(tjhandle handle); + + +/** + * Returns a code indicating the severity of the last error. See + * @ref TJERR "Error codes". + * + * @param handle handle to a TurboJPEG instance + * + * @return a code indicating the severity of the last error. See + * @ref TJERR "Error codes". + */ +DLLEXPORT int tj3GetErrorCode(tjhandle handle); + + +/** + * Set the value of a parameter. + * + * @param handle handle to a TurboJPEG instance + * + * @param param one of the @ref TJPARAM "parameters" + * + * @param value value of the parameter (refer to @ref TJPARAM + * "parameter documentation") + * + * @return 0 if successful, or -1 if an error occurred (see #tj3GetErrorStr().) + */ +DLLEXPORT int tj3Set(tjhandle handle, int param, int value); + + +/** + * Get the value of a parameter. + * + * @param handle handle to a TurboJPEG instance + * + * @param param one of the @ref TJPARAM "parameters" + * + * @return the value of the specified parameter, or -1 if the value is unknown. + */ +DLLEXPORT int tj3Get(tjhandle handle, int param); + + +/** + * Allocate a byte buffer for use with TurboJPEG. You should always use this + * function to allocate the JPEG destination buffer(s) for the compression and + * transform functions unless you are disabling automatic buffer (re)allocation + * (by setting #TJPARAM_NOREALLOC.) + * + * @param bytes the number of bytes to allocate + * + * @return a pointer to a newly-allocated buffer with the specified number of + * bytes. + * + * @see tj3Free() + */ +DLLEXPORT void *tj3Alloc(size_t bytes); + + +/** + * Free a byte buffer previously allocated by TurboJPEG. You should always use + * this function to free JPEG destination buffer(s) that were automatically + * (re)allocated by the compression and transform functions or that were + * manually allocated using #tj3Alloc(). + * + * @param buffer address of the buffer to free. If the address is NULL, then + * this function has no effect. + * + * @see tj3Alloc() + */ +DLLEXPORT void tj3Free(void *buffer); + + +/** + * The maximum size of the buffer (in bytes) required to hold a JPEG image with + * the given parameters. The number of bytes returned by this function is + * larger than the size of the uncompressed source image. The reason for this + * is that the JPEG format uses 16-bit coefficients, so it is possible for a + * very high-quality source image with very high-frequency content to expand + * rather than compress when converted to the JPEG format. Such images + * represent very rare corner cases, but since there is no way to predict the + * size of a JPEG image prior to compression, the corner cases have to be + * handled. + * + * @param width width (in pixels) of the image + * + * @param height height (in pixels) of the image + * + * @param jpegSubsamp the level of chrominance subsampling to be used when + * generating the JPEG image (see @ref TJSAMP + * "Chrominance subsampling options".) #TJSAMP_UNKNOWN is treated like + * #TJSAMP_444, since a buffer large enough to hold a JPEG image with no + * subsampling should also be large enough to hold a JPEG image with an + * arbitrary level of subsampling. Note that lossless JPEG images always + * use #TJSAMP_444. + * + * @return the maximum size of the buffer (in bytes) required to hold the + * image, or 0 if the arguments are out of bounds. + */ +DLLEXPORT size_t tj3JPEGBufSize(int width, int height, int jpegSubsamp); + + +/** + * The size of the buffer (in bytes) required to hold a unified planar YUV + * image with the given parameters. + * + * @param width width (in pixels) of the image + * + * @param align row alignment (in bytes) of the image (must be a power of 2.) + * Setting this parameter to n specifies that each row in each plane of the + * image will be padded to the nearest multiple of n bytes (1 = unpadded.) + * + * @param height height (in pixels) of the image + * + * @param subsamp level of chrominance subsampling in the image (see + * @ref TJSAMP "Chrominance subsampling options".) + * + * @return the size of the buffer (in bytes) required to hold the image, or 0 + * if the arguments are out of bounds. + */ +DLLEXPORT size_t tj3YUVBufSize(int width, int align, int height, int subsamp); + + +/** + * The size of the buffer (in bytes) required to hold a YUV image plane with + * the given parameters. + * + * @param componentID ID number of the image plane (0 = Y, 1 = U/Cb, 2 = V/Cr) + * + * @param width width (in pixels) of the YUV image. NOTE: This is the width of + * the whole image, not the plane width. + * + * @param stride bytes per row in the image plane. Setting this to 0 is the + * equivalent of setting it to the plane width. + * + * @param height height (in pixels) of the YUV image. NOTE: This is the height + * of the whole image, not the plane height. + * + * @param subsamp level of chrominance subsampling in the image (see + * @ref TJSAMP "Chrominance subsampling options".) + * + * @return the size of the buffer (in bytes) required to hold the YUV image + * plane, or 0 if the arguments are out of bounds. + */ +DLLEXPORT size_t tj3YUVPlaneSize(int componentID, int width, int stride, + int height, int subsamp); + + +/** + * The plane width of a YUV image plane with the given parameters. Refer to + * @ref YUVnotes "YUV Image Format Notes" for a description of plane width. + * + * @param componentID ID number of the image plane (0 = Y, 1 = U/Cb, 2 = V/Cr) + * + * @param width width (in pixels) of the YUV image + * + * @param subsamp level of chrominance subsampling in the image (see + * @ref TJSAMP "Chrominance subsampling options".) + * + * @return the plane width of a YUV image plane with the given parameters, or 0 + * if the arguments are out of bounds. + */ +DLLEXPORT int tj3YUVPlaneWidth(int componentID, int width, int subsamp); + + +/** + * The plane height of a YUV image plane with the given parameters. Refer to + * @ref YUVnotes "YUV Image Format Notes" for a description of plane height. + * + * @param componentID ID number of the image plane (0 = Y, 1 = U/Cb, 2 = V/Cr) + * + * @param height height (in pixels) of the YUV image + * + * @param subsamp level of chrominance subsampling in the image (see + * @ref TJSAMP "Chrominance subsampling options".) + * + * @return the plane height of a YUV image plane with the given parameters, or + * 0 if the arguments are out of bounds. + */ +DLLEXPORT int tj3YUVPlaneHeight(int componentID, int height, int subsamp); + + +/** + * Compress an 8-bit-per-sample packed-pixel RGB, grayscale, or CMYK image into + * an 8-bit-per-sample JPEG image. + * + * @param handle handle to a TurboJPEG instance that has been initialized for + * compression + * + * @param srcBuf pointer to a buffer containing a packed-pixel RGB, grayscale, + * or CMYK source image to be compressed. This buffer should normally be + * `pitch * height` samples in size. However, you can also use this parameter + * to compress from a specific region of a larger buffer. + * + * @param width width (in pixels) of the source image + * + * @param pitch samples per row in the source image. Normally this should be + * width * #tjPixelSize[pixelFormat], if the image is unpadded. + * (Setting this parameter to 0 is the equivalent of setting it to + * width * #tjPixelSize[pixelFormat].) However, you can also use this + * parameter to specify the row alignment/padding of the source image, to skip + * rows, or to compress from a specific region of a larger buffer. + * + * @param height height (in pixels) of the source image + * + * @param pixelFormat pixel format of the source image (see @ref TJPF + * "Pixel formats".) + * + * @param jpegBuf address of a pointer to a byte buffer that will receive the + * JPEG image. TurboJPEG has the ability to reallocate the JPEG buffer to + * accommodate the size of the JPEG image. Thus, you can choose to: + * -# pre-allocate the JPEG buffer with an arbitrary size using #tj3Alloc() and + * let TurboJPEG grow the buffer as needed, + * -# set `*jpegBuf` to NULL to tell TurboJPEG to allocate the buffer for you, + * or + * -# pre-allocate the buffer to a "worst case" size determined by calling + * #tj3JPEGBufSize(). This should ensure that the buffer never has to be + * re-allocated. (Setting #TJPARAM_NOREALLOC guarantees that it won't be.) + * . + * If you choose option 1, then `*jpegSize` should be set to the size of your + * pre-allocated buffer. In any case, unless you have set #TJPARAM_NOREALLOC, + * you should always check `*jpegBuf` upon return from this function, as it may + * have changed. + * + * @param jpegSize pointer to a size_t variable that holds the size of the JPEG + * buffer. If `*jpegBuf` points to a pre-allocated buffer, then `*jpegSize` + * should be set to the size of the buffer. Upon return, `*jpegSize` will + * contain the size of the JPEG image (in bytes.) If `*jpegBuf` points to a + * JPEG buffer that is being reused from a previous call to one of the JPEG + * compression functions, then `*jpegSize` is ignored. + * + * @return 0 if successful, or -1 if an error occurred (see #tj3GetErrorStr() + * and #tj3GetErrorCode().) + */ +DLLEXPORT int tj3Compress8(tjhandle handle, const unsigned char *srcBuf, + int width, int pitch, int height, int pixelFormat, + unsigned char **jpegBuf, size_t *jpegSize); + +/** + * Compress a 12-bit-per-sample packed-pixel RGB, grayscale, or CMYK image into + * a 12-bit-per-sample JPEG image. + * + * \details \copydetails tj3Compress8() + */ +DLLEXPORT int tj3Compress12(tjhandle handle, const short *srcBuf, int width, + int pitch, int height, int pixelFormat, + unsigned char **jpegBuf, size_t *jpegSize); + +/** + * Compress a 16-bit-per-sample packed-pixel RGB, grayscale, or CMYK image into + * a 16-bit-per-sample lossless JPEG image. + * + * \details \copydetails tj3Compress8() + */ +DLLEXPORT int tj3Compress16(tjhandle handle, const unsigned short *srcBuf, + int width, int pitch, int height, int pixelFormat, + unsigned char **jpegBuf, size_t *jpegSize); + + +/** + * Compress a set of 8-bit-per-sample Y, U (Cb), and V (Cr) image planes into + * an 8-bit-per-sample JPEG image. + * + * @param handle handle to a TurboJPEG instance that has been initialized for + * compression + * + * @param srcPlanes an array of pointers to Y, U (Cb), and V (Cr) image planes + * (or just a Y plane, if compressing a grayscale image) that contain a YUV + * source image to be compressed. These planes can be contiguous or + * non-contiguous in memory. The size of each plane should match the value + * returned by #tj3YUVPlaneSize() for the given image width, height, strides, + * and level of chrominance subsampling (see #TJPARAM_SUBSAMP.) Refer to + * @ref YUVnotes "YUV Image Format Notes" for more details. + * + * @param width width (in pixels) of the source image. If the width is not an + * even multiple of the iMCU width (see #tjMCUWidth), then an intermediate + * buffer copy will be performed. + * + * @param strides an array of integers, each specifying the number of bytes per + * row in the corresponding plane of the YUV source image. Setting the stride + * for any plane to 0 is the same as setting it to the plane width (see + * @ref YUVnotes "YUV Image Format Notes".) If `strides` is NULL, then the + * strides for all planes will be set to their respective plane widths. You + * can adjust the strides in order to specify an arbitrary amount of row + * padding in each plane or to create a JPEG image from a subregion of a larger + * planar YUV image. + * + * @param height height (in pixels) of the source image. If the height is not + * an even multiple of the iMCU height (see #tjMCUHeight), then an intermediate + * buffer copy will be performed. + * + * @param jpegBuf address of a pointer to a byte buffer that will receive the + * JPEG image. TurboJPEG has the ability to reallocate the JPEG buffer to + * accommodate the size of the JPEG image. Thus, you can choose to: + * -# pre-allocate the JPEG buffer with an arbitrary size using #tj3Alloc() and + * let TurboJPEG grow the buffer as needed, + * -# set `*jpegBuf` to NULL to tell TurboJPEG to allocate the buffer for you, + * or + * -# pre-allocate the buffer to a "worst case" size determined by calling + * #tj3JPEGBufSize(). This should ensure that the buffer never has to be + * re-allocated. (Setting #TJPARAM_NOREALLOC guarantees that it won't be.) + * . + * If you choose option 1, then `*jpegSize` should be set to the size of your + * pre-allocated buffer. In any case, unless you have set #TJPARAM_NOREALLOC, + * you should always check `*jpegBuf` upon return from this function, as it may + * have changed. + * + * @param jpegSize pointer to a size_t variable that holds the size of the JPEG + * buffer. If `*jpegBuf` points to a pre-allocated buffer, then `*jpegSize` + * should be set to the size of the buffer. Upon return, `*jpegSize` will + * contain the size of the JPEG image (in bytes.) If `*jpegBuf` points to a + * JPEG buffer that is being reused from a previous call to one of the JPEG + * compression functions, then `*jpegSize` is ignored. + * + * @return 0 if successful, or -1 if an error occurred (see #tj3GetErrorStr() + * and #tj3GetErrorCode().) + */ +DLLEXPORT int tj3CompressFromYUVPlanes8(tjhandle handle, + const unsigned char * const *srcPlanes, + int width, const int *strides, + int height, unsigned char **jpegBuf, + size_t *jpegSize); + + +/** + * Compress an 8-bit-per-sample unified planar YUV image into an + * 8-bit-per-sample JPEG image. + * + * @param handle handle to a TurboJPEG instance that has been initialized for + * compression + * + * @param srcBuf pointer to a buffer containing a unified planar YUV source + * image to be compressed. The size of this buffer should match the value + * returned by #tj3YUVBufSize() for the given image width, height, row + * alignment, and level of chrominance subsampling (see #TJPARAM_SUBSAMP.) The + * Y, U (Cb), and V (Cr) image planes should be stored sequentially in the + * buffer. (Refer to @ref YUVnotes "YUV Image Format Notes".) + * + * @param width width (in pixels) of the source image. If the width is not an + * even multiple of the iMCU width (see #tjMCUWidth), then an intermediate + * buffer copy will be performed. + * + * @param align row alignment (in bytes) of the source image (must be a power + * of 2.) Setting this parameter to n indicates that each row in each plane of + * the source image is padded to the nearest multiple of n bytes + * (1 = unpadded.) + * + * @param height height (in pixels) of the source image. If the height is not + * an even multiple of the iMCU height (see #tjMCUHeight), then an intermediate + * buffer copy will be performed. + * + * @param jpegBuf address of a pointer to a byte buffer that will receive the + * JPEG image. TurboJPEG has the ability to reallocate the JPEG buffer to + * accommodate the size of the JPEG image. Thus, you can choose to: + * -# pre-allocate the JPEG buffer with an arbitrary size using #tj3Alloc() and + * let TurboJPEG grow the buffer as needed, + * -# set `*jpegBuf` to NULL to tell TurboJPEG to allocate the buffer for you, + * or + * -# pre-allocate the buffer to a "worst case" size determined by calling + * #tj3JPEGBufSize(). This should ensure that the buffer never has to be + * re-allocated. (Setting #TJPARAM_NOREALLOC guarantees that it won't be.) + * . + * If you choose option 1, then `*jpegSize` should be set to the size of your + * pre-allocated buffer. In any case, unless you have set #TJPARAM_NOREALLOC, + * you should always check `*jpegBuf` upon return from this function, as it may + * have changed. + * + * @param jpegSize pointer to a size_t variable that holds the size of the JPEG + * buffer. If `*jpegBuf` points to a pre-allocated buffer, then `*jpegSize` + * should be set to the size of the buffer. Upon return, `*jpegSize` will + * contain the size of the JPEG image (in bytes.) If `*jpegBuf` points to a + * JPEG buffer that is being reused from a previous call to one of the JPEG + * compression functions, then `*jpegSize` is ignored. + * + * @return 0 if successful, or -1 if an error occurred (see #tj3GetErrorStr() + * and #tj3GetErrorCode().) + */ +DLLEXPORT int tj3CompressFromYUV8(tjhandle handle, + const unsigned char *srcBuf, int width, + int align, int height, + unsigned char **jpegBuf, size_t *jpegSize); + + +/** + * Encode an 8-bit-per-sample packed-pixel RGB or grayscale image into separate + * 8-bit-per-sample Y, U (Cb), and V (Cr) image planes. This function performs + * color conversion (which is accelerated in the libjpeg-turbo implementation) + * but does not execute any of the other steps in the JPEG compression process. + * + * @param handle handle to a TurboJPEG instance that has been initialized for + * compression + * + * @param srcBuf pointer to a buffer containing a packed-pixel RGB or grayscale + * source image to be encoded. This buffer should normally be `pitch * height` + * bytes in size. However, you can also use this parameter to encode from a + * specific region of a larger buffer. + * + * + * @param width width (in pixels) of the source image + * + * @param pitch bytes per row in the source image. Normally this should be + * width * #tjPixelSize[pixelFormat], if the image is unpadded. + * (Setting this parameter to 0 is the equivalent of setting it to + * width * #tjPixelSize[pixelFormat].) However, you can also use this + * parameter to specify the row alignment/padding of the source image, to skip + * rows, or to encode from a specific region of a larger packed-pixel image. + * + * @param height height (in pixels) of the source image + * + * @param pixelFormat pixel format of the source image (see @ref TJPF + * "Pixel formats".) + * + * @param dstPlanes an array of pointers to Y, U (Cb), and V (Cr) image planes + * (or just a Y plane, if generating a grayscale image) that will receive the + * encoded image. These planes can be contiguous or non-contiguous in memory. + * Use #tj3YUVPlaneSize() to determine the appropriate size for each plane + * based on the image width, height, strides, and level of chrominance + * subsampling (see #TJPARAM_SUBSAMP.) Refer to @ref YUVnotes + * "YUV Image Format Notes" for more details. + * + * @param strides an array of integers, each specifying the number of bytes per + * row in the corresponding plane of the YUV image. Setting the stride for any + * plane to 0 is the same as setting it to the plane width (see @ref YUVnotes + * "YUV Image Format Notes".) If `strides` is NULL, then the strides for all + * planes will be set to their respective plane widths. You can adjust the + * strides in order to add an arbitrary amount of row padding to each plane or + * to encode an RGB or grayscale image into a subregion of a larger planar YUV + * image. + * + * @return 0 if successful, or -1 if an error occurred (see #tj3GetErrorStr() + * and #tj3GetErrorCode().) + */ +DLLEXPORT int tj3EncodeYUVPlanes8(tjhandle handle, const unsigned char *srcBuf, + int width, int pitch, int height, + int pixelFormat, unsigned char **dstPlanes, + int *strides); + + +/** + * Encode an 8-bit-per-sample packed-pixel RGB or grayscale image into an + * 8-bit-per-sample unified planar YUV image. This function performs color + * conversion (which is accelerated in the libjpeg-turbo implementation) but + * does not execute any of the other steps in the JPEG compression process. + * + * @param handle handle to a TurboJPEG instance that has been initialized for + * compression + * + * @param srcBuf pointer to a buffer containing a packed-pixel RGB or grayscale + * source image to be encoded. This buffer should normally be `pitch * height` + * bytes in size. However, you can also use this parameter to encode from a + * specific region of a larger buffer. + * + * @param width width (in pixels) of the source image + * + * @param pitch bytes per row in the source image. Normally this should be + * width * #tjPixelSize[pixelFormat], if the image is unpadded. + * (Setting this parameter to 0 is the equivalent of setting it to + * width * #tjPixelSize[pixelFormat].) However, you can also use this + * parameter to specify the row alignment/padding of the source image, to skip + * rows, or to encode from a specific region of a larger packed-pixel image. + * + * @param height height (in pixels) of the source image + * + * @param pixelFormat pixel format of the source image (see @ref TJPF + * "Pixel formats".) + * + * @param dstBuf pointer to a buffer that will receive the unified planar YUV + * image. Use #tj3YUVBufSize() to determine the appropriate size for this + * buffer based on the image width, height, row alignment, and level of + * chrominance subsampling (see #TJPARAM_SUBSAMP.) The Y, U (Cb), and V (Cr) + * image planes will be stored sequentially in the buffer. (Refer to + * @ref YUVnotes "YUV Image Format Notes".) + * + * @param align row alignment (in bytes) of the YUV image (must be a power of + * 2.) Setting this parameter to n will cause each row in each plane of the + * YUV image to be padded to the nearest multiple of n bytes (1 = unpadded.) + * To generate images suitable for X Video, `align` should be set to 4. + * + * @return 0 if successful, or -1 if an error occurred (see #tj3GetErrorStr() + * and #tj3GetErrorCode().) + */ +DLLEXPORT int tj3EncodeYUV8(tjhandle handle, const unsigned char *srcBuf, + int width, int pitch, int height, int pixelFormat, + unsigned char *dstBuf, int align); + + +/** + * Retrieve information about a JPEG image without decompressing it, or prime + * the decompressor with quantization and Huffman tables. If a JPEG image is + * passed to this function, then the @ref TJPARAM "parameters" that describe + * the JPEG image will be set when the function returns. + * + * @param handle handle to a TurboJPEG instance that has been initialized for + * decompression + * + * @param jpegBuf pointer to a byte buffer containing a JPEG image or an + * "abbreviated table specification" (AKA "tables-only") datastream. Passing a + * tables-only datastream to this function primes the decompressor with + * quantization and Huffman tables that can be used when decompressing + * subsequent "abbreviated image" datastreams. This is useful, for instance, + * when decompressing video streams in which all frames share the same + * quantization and Huffman tables. + * + * @param jpegSize size of the JPEG image or tables-only datastream (in bytes) + * + * @return 0 if successful, or -1 if an error occurred (see #tj3GetErrorStr() + * and #tj3GetErrorCode().) + */ +DLLEXPORT int tj3DecompressHeader(tjhandle handle, + const unsigned char *jpegBuf, + size_t jpegSize); + + +/** + * Returns a list of fractional scaling factors that the JPEG decompressor + * supports. + * + * @param numScalingFactors pointer to an integer variable that will receive + * the number of elements in the list + * + * @return a pointer to a list of fractional scaling factors, or NULL if an + * error is encountered (see #tj3GetErrorStr().) + */ +DLLEXPORT tjscalingfactor *tj3GetScalingFactors(int *numScalingFactors); + + +/** + * Set the scaling factor for subsequent lossy decompression operations. + * + * @param handle handle to a TurboJPEG instance that has been initialized for + * decompression + * + * @param scalingFactor #tjscalingfactor structure that specifies a fractional + * scaling factor that the decompressor supports (see #tj3GetScalingFactors()), + * or #TJUNSCALED for no scaling. Decompression scaling is a function + * of the IDCT algorithm, so scaling factors are generally limited to multiples + * of 1/8. If the entire JPEG image will be decompressed, then the width and + * height of the scaled destination image can be determined by calling + * #TJSCALED() with the JPEG width and height (see #TJPARAM_JPEGWIDTH and + * #TJPARAM_JPEGHEIGHT) and the specified scaling factor. When decompressing + * into a planar YUV image, an intermediate buffer copy will be performed if + * the width or height of the scaled destination image is not an even multiple + * of the iMCU size (see #tjMCUWidth and #tjMCUHeight.) Note that + * decompression scaling is not available (and the specified scaling factor is + * ignored) when decompressing lossless JPEG images (see #TJPARAM_LOSSLESS), + * since the IDCT algorithm is not used with those images. Note also that + * #TJPARAM_FASTDCT is ignored when decompression scaling is enabled. + * + * @return 0 if successful, or -1 if an error occurred (see #tj3GetErrorStr().) + */ +DLLEXPORT int tj3SetScalingFactor(tjhandle handle, + tjscalingfactor scalingFactor); + + +/** + * Set the cropping region for partially decompressing a lossy JPEG image into + * a packed-pixel image + * + * @param handle handle to a TurboJPEG instance that has been initialized for + * decompression + * + * @param croppingRegion #tjregion structure that specifies a subregion of the + * JPEG image to decompress, or #TJUNCROPPED for no cropping. The + * left boundary of the cropping region must be evenly divisible by the scaled + * iMCU width-- #TJSCALED(#tjMCUWidth[subsamp], scalingFactor), where + * `subsamp` is the level of chrominance subsampling in the JPEG image (see + * #TJPARAM_SUBSAMP) and `scalingFactor` is the decompression scaling factor + * (see #tj3SetScalingFactor().) The cropping region should be specified + * relative to the scaled image dimensions. Unless `croppingRegion` is + * #TJUNCROPPED, the JPEG header must be read (see + * #tj3DecompressHeader()) prior to calling this function. + * + * @return 0 if successful, or -1 if an error occurred (see #tj3GetErrorStr().) + */ +DLLEXPORT int tj3SetCroppingRegion(tjhandle handle, tjregion croppingRegion); + + +/** + * Decompress an 8-bit-per-sample JPEG image into an 8-bit-per-sample + * packed-pixel RGB, grayscale, or CMYK image. The @ref TJPARAM "parameters" + * that describe the JPEG image will be set when this function returns. + * + * @param handle handle to a TurboJPEG instance that has been initialized for + * decompression + * + * @param jpegBuf pointer to a byte buffer containing the JPEG image to + * decompress + * + * @param jpegSize size of the JPEG image (in bytes) + * + * @param dstBuf pointer to a buffer that will receive the packed-pixel + * decompressed image. This buffer should normally be + * `pitch * destinationHeight` samples in size. However, you can also use this + * parameter to decompress into a specific region of a larger buffer. NOTE: + * If the JPEG image is lossy, then `destinationHeight` is either the scaled + * JPEG height (see #TJSCALED(), #TJPARAM_JPEGHEIGHT, and + * #tj3SetScalingFactor()) or the height of the cropping region (see + * #tj3SetCroppingRegion().) If the JPEG image is lossless, then + * `destinationHeight` is the JPEG height. + * + * @param pitch samples per row in the destination image. Normally this should + * be set to destinationWidth * #tjPixelSize[pixelFormat], if the + * destination image should be unpadded. (Setting this parameter to 0 is the + * equivalent of setting it to + * destinationWidth * #tjPixelSize[pixelFormat].) However, you can + * also use this parameter to specify the row alignment/padding of the + * destination image, to skip rows, or to decompress into a specific region of + * a larger buffer. NOTE: If the JPEG image is lossy, then `destinationWidth` + * is either the scaled JPEG width (see #TJSCALED(), #TJPARAM_JPEGWIDTH, and + * #tj3SetScalingFactor()) or the width of the cropping region (see + * #tj3SetCroppingRegion().) If the JPEG image is lossless, then + * `destinationWidth` is the JPEG width. + * + * @param pixelFormat pixel format of the destination image (see @ref + * TJPF "Pixel formats".) + * + * @return 0 if successful, or -1 if an error occurred (see #tj3GetErrorStr() + * and #tj3GetErrorCode().) + */ +DLLEXPORT int tj3Decompress8(tjhandle handle, const unsigned char *jpegBuf, + size_t jpegSize, unsigned char *dstBuf, int pitch, + int pixelFormat); + +/** + * Decompress a 12-bit-per-sample JPEG image into a 12-bit-per-sample + * packed-pixel RGB, grayscale, or CMYK image. + * + * \details \copydetails tj3Decompress8() + */ +DLLEXPORT int tj3Decompress12(tjhandle handle, const unsigned char *jpegBuf, + size_t jpegSize, short *dstBuf, int pitch, + int pixelFormat); + +/** + * Decompress a 16-bit-per-sample lossless JPEG image into a 16-bit-per-sample + * packed-pixel RGB, grayscale, or CMYK image. + * + * \details \copydetails tj3Decompress8() + */ +DLLEXPORT int tj3Decompress16(tjhandle handle, const unsigned char *jpegBuf, + size_t jpegSize, unsigned short *dstBuf, + int pitch, int pixelFormat); + + +/** + * Decompress an 8-bit-per-sample JPEG image into separate 8-bit-per-sample Y, + * U (Cb), and V (Cr) image planes. This function performs JPEG decompression + * but leaves out the color conversion step, so a planar YUV image is generated + * instead of a packed-pixel image. The @ref TJPARAM "parameters" that + * describe the JPEG image will be set when this function returns. + * + * @param handle handle to a TurboJPEG instance that has been initialized for + * decompression + * + * @param jpegBuf pointer to a byte buffer containing the JPEG image to + * decompress + * + * @param jpegSize size of the JPEG image (in bytes) + * + * @param dstPlanes an array of pointers to Y, U (Cb), and V (Cr) image planes + * (or just a Y plane, if decompressing a grayscale image) that will receive + * the decompressed image. These planes can be contiguous or non-contiguous in + * memory. Use #tj3YUVPlaneSize() to determine the appropriate size for each + * plane based on the scaled JPEG width and height (see #TJSCALED(), + * #TJPARAM_JPEGWIDTH, #TJPARAM_JPEGHEIGHT, and #tj3SetScalingFactor()), + * strides, and level of chrominance subsampling (see #TJPARAM_SUBSAMP.) Refer + * to @ref YUVnotes "YUV Image Format Notes" for more details. + * + * @param strides an array of integers, each specifying the number of bytes per + * row in the corresponding plane of the YUV image. Setting the stride for any + * plane to 0 is the same as setting it to the scaled plane width (see + * @ref YUVnotes "YUV Image Format Notes".) If `strides` is NULL, then the + * strides for all planes will be set to their respective scaled plane widths. + * You can adjust the strides in order to add an arbitrary amount of row + * padding to each plane or to decompress the JPEG image into a subregion of a + * larger planar YUV image. + * + * @return 0 if successful, or -1 if an error occurred (see #tj3GetErrorStr() + * and #tj3GetErrorCode().) + */ +DLLEXPORT int tj3DecompressToYUVPlanes8(tjhandle handle, + const unsigned char *jpegBuf, + size_t jpegSize, + unsigned char **dstPlanes, + int *strides); + + +/** + * Decompress an 8-bit-per-sample JPEG image into an 8-bit-per-sample unified + * planar YUV image. This function performs JPEG decompression but leaves out + * the color conversion step, so a planar YUV image is generated instead of a + * packed-pixel image. The @ref TJPARAM "parameters" that describe the JPEG + * image will be set when this function returns. + * + * @param handle handle to a TurboJPEG instance that has been initialized for + * decompression + * + * @param jpegBuf pointer to a byte buffer containing the JPEG image to + * decompress + * + * @param jpegSize size of the JPEG image (in bytes) + * + * @param dstBuf pointer to a buffer that will receive the unified planar YUV + * decompressed image. Use #tj3YUVBufSize() to determine the appropriate size + * for this buffer based on the scaled JPEG width and height (see #TJSCALED(), + * #TJPARAM_JPEGWIDTH, #TJPARAM_JPEGHEIGHT, and #tj3SetScalingFactor()), row + * alignment, and level of chrominance subsampling (see #TJPARAM_SUBSAMP.) The + * Y, U (Cb), and V (Cr) image planes will be stored sequentially in the + * buffer. (Refer to @ref YUVnotes "YUV Image Format Notes".) + * + * @param align row alignment (in bytes) of the YUV image (must be a power of + * 2.) Setting this parameter to n will cause each row in each plane of the + * YUV image to be padded to the nearest multiple of n bytes (1 = unpadded.) + * To generate images suitable for X Video, `align` should be set to 4. + * + * @return 0 if successful, or -1 if an error occurred (see #tj3GetErrorStr() + * and #tj3GetErrorCode().) + */ +DLLEXPORT int tj3DecompressToYUV8(tjhandle handle, + const unsigned char *jpegBuf, + size_t jpegSize, + unsigned char *dstBuf, int align); + + +/** + * Decode a set of 8-bit-per-sample Y, U (Cb), and V (Cr) image planes into an + * 8-bit-per-sample packed-pixel RGB or grayscale image. This function + * performs color conversion (which is accelerated in the libjpeg-turbo + * implementation) but does not execute any of the other steps in the JPEG + * decompression process. + * + * @param handle handle to a TurboJPEG instance that has been initialized for + * decompression + * + * @param srcPlanes an array of pointers to Y, U (Cb), and V (Cr) image planes + * (or just a Y plane, if decoding a grayscale image) that contain a YUV image + * to be decoded. These planes can be contiguous or non-contiguous in memory. + * The size of each plane should match the value returned by #tj3YUVPlaneSize() + * for the given image width, height, strides, and level of chrominance + * subsampling (see #TJPARAM_SUBSAMP.) Refer to @ref YUVnotes + * "YUV Image Format Notes" for more details. + * + * @param strides an array of integers, each specifying the number of bytes per + * row in the corresponding plane of the YUV source image. Setting the stride + * for any plane to 0 is the same as setting it to the plane width (see + * @ref YUVnotes "YUV Image Format Notes".) If `strides` is NULL, then the + * strides for all planes will be set to their respective plane widths. You + * can adjust the strides in order to specify an arbitrary amount of row + * padding in each plane or to decode a subregion of a larger planar YUV image. + * + * @param dstBuf pointer to a buffer that will receive the packed-pixel decoded + * image. This buffer should normally be `pitch * height` bytes in size. + * However, you can also use this parameter to decode into a specific region of + * a larger buffer. + * + * @param width width (in pixels) of the source and destination images + * + * @param pitch bytes per row in the destination image. Normally this should + * be set to width * #tjPixelSize[pixelFormat], if the destination + * image should be unpadded. (Setting this parameter to 0 is the equivalent of + * setting it to width * #tjPixelSize[pixelFormat].) However, you can + * also use this parameter to specify the row alignment/padding of the + * destination image, to skip rows, or to decode into a specific region of a + * larger buffer. + * + * @param height height (in pixels) of the source and destination images + * + * @param pixelFormat pixel format of the destination image (see @ref TJPF + * "Pixel formats".) + * + * @return 0 if successful, or -1 if an error occurred (see #tj3GetErrorStr() + * and #tj3GetErrorCode().) + */ +DLLEXPORT int tj3DecodeYUVPlanes8(tjhandle handle, + const unsigned char * const *srcPlanes, + const int *strides, unsigned char *dstBuf, + int width, int pitch, int height, + int pixelFormat); + + +/** + * Decode an 8-bit-per-sample unified planar YUV image into an 8-bit-per-sample + * packed-pixel RGB or grayscale image. This function performs color + * conversion (which is accelerated in the libjpeg-turbo implementation) but + * does not execute any of the other steps in the JPEG decompression process. + * + * @param handle handle to a TurboJPEG instance that has been initialized for + * decompression + * + * @param srcBuf pointer to a buffer containing a unified planar YUV source + * image to be decoded. The size of this buffer should match the value + * returned by #tj3YUVBufSize() for the given image width, height, row + * alignment, and level of chrominance subsampling (see #TJPARAM_SUBSAMP.) The + * Y, U (Cb), and V (Cr) image planes should be stored sequentially in the + * source buffer. (Refer to @ref YUVnotes "YUV Image Format Notes".) + * + * @param align row alignment (in bytes) of the YUV source image (must be a + * power of 2.) Setting this parameter to n indicates that each row in each + * plane of the YUV source image is padded to the nearest multiple of n bytes + * (1 = unpadded.) + * + * @param dstBuf pointer to a buffer that will receive the packed-pixel decoded + * image. This buffer should normally be `pitch * height` bytes in size. + * However, you can also use this parameter to decode into a specific region of + * a larger buffer. + * + * @param width width (in pixels) of the source and destination images + * + * @param pitch bytes per row in the destination image. Normally this should + * be set to width * #tjPixelSize[pixelFormat], if the destination + * image should be unpadded. (Setting this parameter to 0 is the equivalent of + * setting it to width * #tjPixelSize[pixelFormat].) However, you can + * also use this parameter to specify the row alignment/padding of the + * destination image, to skip rows, or to decode into a specific region of a + * larger buffer. + * + * @param height height (in pixels) of the source and destination images + * + * @param pixelFormat pixel format of the destination image (see @ref TJPF + * "Pixel formats".) + * + * @return 0 if successful, or -1 if an error occurred (see #tj3GetErrorStr() + * and #tj3GetErrorCode().) + */ +DLLEXPORT int tj3DecodeYUV8(tjhandle handle, const unsigned char *srcBuf, + int align, unsigned char *dstBuf, int width, + int pitch, int height, int pixelFormat); + + +/** + * Losslessly transform a JPEG image into another JPEG image. Lossless + * transforms work by moving the raw DCT coefficients from one JPEG image + * structure to another without altering the values of the coefficients. While + * this is typically faster than decompressing the image, transforming it, and + * re-compressing it, lossless transforms are not free. Each lossless + * transform requires reading and performing entropy decoding on all of the + * coefficients in the source image, regardless of the size of the destination + * image. Thus, this function provides a means of generating multiple + * transformed images from the same source or applying multiple transformations + * simultaneously, in order to eliminate the need to read the source + * coefficients multiple times. + * + * @param handle handle to a TurboJPEG instance that has been initialized for + * lossless transformation + * + * @param jpegBuf pointer to a byte buffer containing the JPEG source image to + * transform + * + * @param jpegSize size of the JPEG source image (in bytes) + * + * @param n the number of transformed JPEG images to generate + * + * @param dstBufs pointer to an array of n byte buffers. `dstBufs[i]` will + * receive a JPEG image that has been transformed using the parameters in + * `transforms[i]`. TurboJPEG has the ability to reallocate the JPEG + * destination buffer to accommodate the size of the transformed JPEG image. + * Thus, you can choose to: + * -# pre-allocate the JPEG destination buffer with an arbitrary size using + * #tj3Alloc() and let TurboJPEG grow the buffer as needed, + * -# set `dstBufs[i]` to NULL to tell TurboJPEG to allocate the buffer for + * you, or + * -# pre-allocate the buffer to a "worst case" size determined by calling + * #tj3JPEGBufSize() with the transformed or cropped width and height and the + * level of subsampling used in the destination image (taking into account + * grayscale conversion and transposition of the width and height.) Under + * normal circumstances, this should ensure that the buffer never has to be + * re-allocated. (Setting #TJPARAM_NOREALLOC guarantees that it won't be.) + * Note, however, that there are some rare cases (such as transforming images + * with a large amount of embedded Exif or ICC profile data) in which the + * transformed JPEG image will be larger than the worst-case size, and + * #TJPARAM_NOREALLOC cannot be used in those cases unless the embedded data is + * discarded using #TJXOPT_COPYNONE. + * . + * If you choose option 1, then `dstSizes[i]` should be set to the size of your + * pre-allocated buffer. In any case, unless you have set #TJPARAM_NOREALLOC, + * you should always check `dstBufs[i]` upon return from this function, as it + * may have changed. + * + * @param dstSizes pointer to an array of n size_t variables that will receive + * the actual sizes (in bytes) of each transformed JPEG image. If `dstBufs[i]` + * points to a pre-allocated buffer, then `dstSizes[i]` should be set to the + * size of the buffer. Upon return, `dstSizes[i]` will contain the size of the + * transformed JPEG image (in bytes.) + * + * @param transforms pointer to an array of n #tjtransform structures, each of + * which specifies the transform parameters and/or cropping region for the + * corresponding transformed JPEG image. + * + * @return 0 if successful, or -1 if an error occurred (see #tj3GetErrorStr() + * and #tj3GetErrorCode().) + */ +DLLEXPORT int tj3Transform(tjhandle handle, const unsigned char *jpegBuf, + size_t jpegSize, int n, unsigned char **dstBufs, + size_t *dstSizes, const tjtransform *transforms); + + +/** + * Load an 8-bit-per-sample packed-pixel image from disk into memory. + * + * @param handle handle to a TurboJPEG instance + * + * @param filename name of a file containing a packed-pixel image in Windows + * BMP or PBMPLUS (PPM/PGM) format. Windows BMP files require 8-bit-per-sample + * data precision. If the data precision of the PBMPLUS file does not match + * the target data precision, then upconverting or downconverting will be + * performed. + * + * @param width pointer to an integer variable that will receive the width (in + * pixels) of the packed-pixel image + * + * @param align row alignment (in samples) of the packed-pixel buffer to be + * returned (must be a power of 2.) Setting this parameter to n will cause all + * rows in the buffer to be padded to the nearest multiple of n samples + * (1 = unpadded.) + * + * @param height pointer to an integer variable that will receive the height + * (in pixels) of the packed-pixel image + * + * @param pixelFormat pointer to an integer variable that specifies or will + * receive the pixel format of the packed-pixel buffer. The behavior of this + * function varies depending on the value of `*pixelFormat` passed to the + * function: + * - @ref TJPF_UNKNOWN : The packed-pixel buffer returned by this function will + * use the most optimal pixel format for the file type, and `*pixelFormat` will + * contain the ID of that pixel format upon successful return from this + * function. + * - @ref TJPF_GRAY : Only PGM files and 8-bit-per-pixel BMP files with a + * grayscale colormap can be loaded. + * - @ref TJPF_CMYK : The RGB or grayscale pixels stored in the file will be + * converted using a quick & dirty algorithm that is suitable only for testing + * purposes. (Proper conversion between CMYK and other formats requires a + * color management system.) + * - Other @ref TJPF "pixel formats" : The packed-pixel buffer will use the + * specified pixel format, and pixel format conversion will be performed if + * necessary. + * + * @return a pointer to a newly-allocated buffer containing the packed-pixel + * image, converted to the chosen pixel format and with the chosen row + * alignment, or NULL if an error occurred (see #tj3GetErrorStr().) This + * buffer should be freed using #tj3Free(). + */ +DLLEXPORT unsigned char *tj3LoadImage8(tjhandle handle, const char *filename, + int *width, int align, int *height, + int *pixelFormat); + +/** + * Load a 12-bit-per-sample packed-pixel image from disk into memory. + * + * \details \copydetails tj3LoadImage8() + */ +DLLEXPORT short *tj3LoadImage12(tjhandle handle, const char *filename, + int *width, int align, int *height, + int *pixelFormat); + +/** + * Load a 16-bit-per-sample packed-pixel image from disk into memory. + * + * \details \copydetails tj3LoadImage8() + */ +DLLEXPORT unsigned short *tj3LoadImage16(tjhandle handle, const char *filename, + int *width, int align, int *height, + int *pixelFormat); + + +/** + * Save an 8-bit-per-sample packed-pixel image from memory to disk. + * + * @param handle handle to a TurboJPEG instance + * + * @param filename name of a file to which to save the packed-pixel image. The + * image will be stored in Windows BMP or PBMPLUS (PPM/PGM) format, depending + * on the file extension. Windows BMP files require 8-bit-per-sample data + * precision. + * + * @param buffer pointer to a buffer containing a packed-pixel RGB, grayscale, + * or CMYK image to be saved + * + * @param width width (in pixels) of the packed-pixel image + * + * @param pitch samples per row in the packed-pixel image. Setting this + * parameter to 0 is the equivalent of setting it to + * width * #tjPixelSize[pixelFormat]. + * + * @param height height (in pixels) of the packed-pixel image + * + * @param pixelFormat pixel format of the packed-pixel image (see @ref TJPF + * "Pixel formats".) If this parameter is set to @ref TJPF_GRAY, then the + * image will be stored in PGM or 8-bit-per-pixel (indexed color) BMP format. + * Otherwise, the image will be stored in PPM or 24-bit-per-pixel BMP format. + * If this parameter is set to @ref TJPF_CMYK, then the CMYK pixels will be + * converted to RGB using a quick & dirty algorithm that is suitable only for + * testing purposes. (Proper conversion between CMYK and other formats + * requires a color management system.) + * + * @return 0 if successful, or -1 if an error occurred (see #tj3GetErrorStr().) + */ +DLLEXPORT int tj3SaveImage8(tjhandle handle, const char *filename, + const unsigned char *buffer, int width, int pitch, + int height, int pixelFormat); + +/** + * Save a 12-bit-per-sample packed-pixel image from memory to disk. + * + * \details \copydetails tj3SaveImage8() + */ +DLLEXPORT int tj3SaveImage12(tjhandle handle, const char *filename, + const short *buffer, int width, int pitch, + int height, int pixelFormat); + +/** + * Save a 16-bit-per-sample packed-pixel image from memory to disk. + * + * \details \copydetails tj3SaveImage8() + */ +DLLEXPORT int tj3SaveImage16(tjhandle handle, const char *filename, + const unsigned short *buffer, int width, + int pitch, int height, int pixelFormat); + + +/* Backward compatibility functions and macros (nothing to see here) */ + +/* TurboJPEG 1.0+ */ + +#define NUMSUBOPT TJ_NUMSAMP +#define TJ_444 TJSAMP_444 +#define TJ_422 TJSAMP_422 +#define TJ_420 TJSAMP_420 +#define TJ_411 TJSAMP_420 +#define TJ_GRAYSCALE TJSAMP_GRAY + +#define TJ_BGR 1 +#define TJ_BOTTOMUP TJFLAG_BOTTOMUP +#define TJ_FORCEMMX TJFLAG_FORCEMMX +#define TJ_FORCESSE TJFLAG_FORCESSE +#define TJ_FORCESSE2 TJFLAG_FORCESSE2 +#define TJ_ALPHAFIRST 64 +#define TJ_FORCESSE3 TJFLAG_FORCESSE3 +#define TJ_FASTUPSAMPLE TJFLAG_FASTUPSAMPLE + +#define TJPAD(width) (((width) + 3) & (~3)) + +DLLEXPORT unsigned long TJBUFSIZE(int width, int height); + +DLLEXPORT int tjCompress(tjhandle handle, unsigned char *srcBuf, int width, + int pitch, int height, int pixelSize, + unsigned char *dstBuf, unsigned long *compressedSize, + int jpegSubsamp, int jpegQual, int flags); + +DLLEXPORT int tjDecompress(tjhandle handle, unsigned char *jpegBuf, + unsigned long jpegSize, unsigned char *dstBuf, + int width, int pitch, int height, int pixelSize, + int flags); + +DLLEXPORT int tjDecompressHeader(tjhandle handle, unsigned char *jpegBuf, + unsigned long jpegSize, int *width, + int *height); + +DLLEXPORT int tjDestroy(tjhandle handle); + +DLLEXPORT char *tjGetErrorStr(void); + +DLLEXPORT tjhandle tjInitCompress(void); + +DLLEXPORT tjhandle tjInitDecompress(void); + +/* TurboJPEG 1.1+ */ + +#define TJ_YUV 512 + +DLLEXPORT unsigned long TJBUFSIZEYUV(int width, int height, int jpegSubsamp); + +DLLEXPORT int tjDecompressHeader2(tjhandle handle, unsigned char *jpegBuf, + unsigned long jpegSize, int *width, + int *height, int *jpegSubsamp); + +DLLEXPORT int tjDecompressToYUV(tjhandle handle, unsigned char *jpegBuf, + unsigned long jpegSize, unsigned char *dstBuf, + int flags); + +DLLEXPORT int tjEncodeYUV(tjhandle handle, unsigned char *srcBuf, int width, + int pitch, int height, int pixelSize, + unsigned char *dstBuf, int subsamp, int flags); + +/* TurboJPEG 1.2+ */ + +#define TJFLAG_BOTTOMUP 2 +#define TJFLAG_FORCEMMX 8 +#define TJFLAG_FORCESSE 16 +#define TJFLAG_FORCESSE2 32 +#define TJFLAG_FORCESSE3 128 +#define TJFLAG_FASTUPSAMPLE 256 +#define TJFLAG_NOREALLOC 1024 + +DLLEXPORT unsigned char *tjAlloc(int bytes); + +DLLEXPORT unsigned long tjBufSize(int width, int height, int jpegSubsamp); + +DLLEXPORT unsigned long tjBufSizeYUV(int width, int height, int subsamp); + +DLLEXPORT int tjCompress2(tjhandle handle, const unsigned char *srcBuf, + int width, int pitch, int height, int pixelFormat, + unsigned char **jpegBuf, unsigned long *jpegSize, + int jpegSubsamp, int jpegQual, int flags); + +DLLEXPORT int tjDecompress2(tjhandle handle, const unsigned char *jpegBuf, + unsigned long jpegSize, unsigned char *dstBuf, + int width, int pitch, int height, int pixelFormat, + int flags); + +DLLEXPORT int tjEncodeYUV2(tjhandle handle, unsigned char *srcBuf, int width, + int pitch, int height, int pixelFormat, + unsigned char *dstBuf, int subsamp, int flags); + +DLLEXPORT void tjFree(unsigned char *buffer); + +DLLEXPORT tjscalingfactor *tjGetScalingFactors(int *numscalingfactors); + +DLLEXPORT tjhandle tjInitTransform(void); + +DLLEXPORT int tjTransform(tjhandle handle, const unsigned char *jpegBuf, + unsigned long jpegSize, int n, + unsigned char **dstBufs, unsigned long *dstSizes, + tjtransform *transforms, int flags); + +/* TurboJPEG 1.2.1+ */ + +#define TJFLAG_FASTDCT 2048 +#define TJFLAG_ACCURATEDCT 4096 + +/* TurboJPEG 1.4+ */ + +DLLEXPORT unsigned long tjBufSizeYUV2(int width, int align, int height, + int subsamp); + +DLLEXPORT int tjCompressFromYUV(tjhandle handle, const unsigned char *srcBuf, + int width, int align, int height, int subsamp, + unsigned char **jpegBuf, + unsigned long *jpegSize, int jpegQual, + int flags); + +DLLEXPORT int tjCompressFromYUVPlanes(tjhandle handle, + const unsigned char **srcPlanes, + int width, const int *strides, + int height, int subsamp, + unsigned char **jpegBuf, + unsigned long *jpegSize, int jpegQual, + int flags); + +DLLEXPORT int tjDecodeYUV(tjhandle handle, const unsigned char *srcBuf, + int align, int subsamp, unsigned char *dstBuf, + int width, int pitch, int height, int pixelFormat, + int flags); + +DLLEXPORT int tjDecodeYUVPlanes(tjhandle handle, + const unsigned char **srcPlanes, + const int *strides, int subsamp, + unsigned char *dstBuf, int width, int pitch, + int height, int pixelFormat, int flags); + +DLLEXPORT int tjDecompressHeader3(tjhandle handle, + const unsigned char *jpegBuf, + unsigned long jpegSize, int *width, + int *height, int *jpegSubsamp, + int *jpegColorspace); + +DLLEXPORT int tjDecompressToYUV2(tjhandle handle, const unsigned char *jpegBuf, + unsigned long jpegSize, unsigned char *dstBuf, + int width, int align, int height, int flags); + +DLLEXPORT int tjDecompressToYUVPlanes(tjhandle handle, + const unsigned char *jpegBuf, + unsigned long jpegSize, + unsigned char **dstPlanes, int width, + int *strides, int height, int flags); + +DLLEXPORT int tjEncodeYUV3(tjhandle handle, const unsigned char *srcBuf, + int width, int pitch, int height, int pixelFormat, + unsigned char *dstBuf, int align, int subsamp, + int flags); + +DLLEXPORT int tjEncodeYUVPlanes(tjhandle handle, const unsigned char *srcBuf, + int width, int pitch, int height, + int pixelFormat, unsigned char **dstPlanes, + int *strides, int subsamp, int flags); + +DLLEXPORT int tjPlaneHeight(int componentID, int height, int subsamp); + +DLLEXPORT unsigned long tjPlaneSizeYUV(int componentID, int width, int stride, + int height, int subsamp); + +DLLEXPORT int tjPlaneWidth(int componentID, int width, int subsamp); + +/* TurboJPEG 2.0+ */ + +#define TJFLAG_STOPONWARNING 8192 +#define TJFLAG_PROGRESSIVE 16384 + +DLLEXPORT int tjGetErrorCode(tjhandle handle); + +DLLEXPORT char *tjGetErrorStr2(tjhandle handle); + +DLLEXPORT unsigned char *tjLoadImage(const char *filename, int *width, + int align, int *height, int *pixelFormat, + int flags); + +DLLEXPORT int tjSaveImage(const char *filename, unsigned char *buffer, + int width, int pitch, int height, int pixelFormat, + int flags); + +/* TurboJPEG 2.1+ */ + +#define TJFLAG_LIMITSCANS 32768 + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/TurboJpeg/turbojpeg.h b/TurboJpeg/turbojpeg.h new file mode 100644 index 0000000..0d505df --- /dev/null +++ b/TurboJpeg/turbojpeg.h @@ -0,0 +1,2426 @@ +/* + * Copyright (C)2009-2015, 2017, 2020-2024 D. R. Commander. + * All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the libjpeg-turbo Project nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS", + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __TURBOJPEG_H__ +#define __TURBOJPEG_H__ + +#include + +#if defined(_WIN32) && defined(DLLDEFINE) +#define DLLEXPORT __declspec(dllexport) +#else +#define DLLEXPORT +#endif +#define DLLCALL + + +/** + * @addtogroup TurboJPEG + * TurboJPEG API. This API provides an interface for generating, decoding, and + * transforming planar YUV and JPEG images in memory. + * + * @anchor YUVnotes + * YUV Image Format Notes + * ---------------------- + * Technically, the JPEG format uses the YCbCr colorspace (which is technically + * not a colorspace but a color transform), but per the convention of the + * digital video community, the TurboJPEG API uses "YUV" to refer to an image + * format consisting of Y, Cb, and Cr image planes. + * + * Each plane is simply a 2D array of bytes, each byte representing the value + * of one of the components (Y, Cb, or Cr) at a particular location in the + * image. The width and height of each plane are determined by the image + * width, height, and level of chrominance subsampling. The luminance plane + * width is the image width padded to the nearest multiple of the horizontal + * subsampling factor (1 in the case of 4:4:4, grayscale, 4:4:0, or 4:4:1; 2 in + * the case of 4:2:2 or 4:2:0; 4 in the case of 4:1:1.) Similarly, the + * luminance plane height is the image height padded to the nearest multiple of + * the vertical subsampling factor (1 in the case of 4:4:4, 4:2:2, grayscale, + * or 4:1:1; 2 in the case of 4:2:0 or 4:4:0; 4 in the case of 4:4:1.) This is + * irrespective of any additional padding that may be specified as an argument + * to the various YUV functions. The chrominance plane width is equal to the + * luminance plane width divided by the horizontal subsampling factor, and the + * chrominance plane height is equal to the luminance plane height divided by + * the vertical subsampling factor. + * + * For example, if the source image is 35 x 35 pixels and 4:2:2 subsampling is + * used, then the luminance plane would be 36 x 35 bytes, and each of the + * chrominance planes would be 18 x 35 bytes. If you specify a row alignment + * of 4 bytes on top of this, then the luminance plane would be 36 x 35 bytes, + * and each of the chrominance planes would be 20 x 35 bytes. + * + * @{ + */ + + +/** + * The number of initialization options + */ +#define TJ_NUMINIT 3 + +/** + * Initialization options + */ +enum TJINIT { + /** + * Initialize the TurboJPEG instance for compression. + */ + TJINIT_COMPRESS, + /** + * Initialize the TurboJPEG instance for decompression. + */ + TJINIT_DECOMPRESS, + /** + * Initialize the TurboJPEG instance for lossless transformation (both + * compression and decompression.) + */ + TJINIT_TRANSFORM +}; + + +/** + * The number of chrominance subsampling options + */ +#define TJ_NUMSAMP 7 + +/** + * Chrominance subsampling options + * + * When pixels are converted from RGB to YCbCr (see #TJCS_YCbCr) or from CMYK + * to YCCK (see #TJCS_YCCK) as part of the JPEG compression process, some of + * the Cb and Cr (chrominance) components can be discarded or averaged together + * to produce a smaller image with little perceptible loss of image quality. + * (The human eye is more sensitive to small changes in brightness than to + * small changes in color.) This is called "chrominance subsampling". + */ +enum TJSAMP { + /** + * 4:4:4 chrominance subsampling (no chrominance subsampling) + * + * The JPEG or YUV image will contain one chrominance component for every + * pixel in the source image. + */ + TJSAMP_444, + /** + * 4:2:2 chrominance subsampling + * + * The JPEG or YUV image will contain one chrominance component for every 2x1 + * block of pixels in the source image. + */ + TJSAMP_422, + /** + * 4:2:0 chrominance subsampling + * + * The JPEG or YUV image will contain one chrominance component for every 2x2 + * block of pixels in the source image. + */ + TJSAMP_420, + /** + * Grayscale + * + * The JPEG or YUV image will contain no chrominance components. + */ + TJSAMP_GRAY, + /** + * 4:4:0 chrominance subsampling + * + * The JPEG or YUV image will contain one chrominance component for every 1x2 + * block of pixels in the source image. + * + * @note 4:4:0 subsampling is not fully accelerated in libjpeg-turbo. + */ + TJSAMP_440, + /** + * 4:1:1 chrominance subsampling + * + * The JPEG or YUV image will contain one chrominance component for every 4x1 + * block of pixels in the source image. All else being equal, a JPEG image + * with 4:1:1 subsampling is almost exactly the same size as a JPEG image + * with 4:2:0 subsampling, and in the aggregate, both subsampling methods + * produce approximately the same perceptual quality. However, 4:1:1 is + * better able to reproduce sharp horizontal features. + * + * @note 4:1:1 subsampling is not fully accelerated in libjpeg-turbo. + */ + TJSAMP_411, + /** + * 4:4:1 chrominance subsampling + * + * The JPEG or YUV image will contain one chrominance component for every 1x4 + * block of pixels in the source image. All else being equal, a JPEG image + * with 4:4:1 subsampling is almost exactly the same size as a JPEG image + * with 4:2:0 subsampling, and in the aggregate, both subsampling methods + * produce approximately the same perceptual quality. However, 4:4:1 is + * better able to reproduce sharp vertical features. + * + * @note 4:4:1 subsampling is not fully accelerated in libjpeg-turbo. + */ + TJSAMP_441, + /** + * Unknown subsampling + * + * The JPEG image uses an unusual type of chrominance subsampling. Such + * images can be decompressed into packed-pixel images, but they cannot be + * - decompressed into planar YUV images, + * - losslessly transformed if #TJXOPT_CROP is specified and #TJXOPT_GRAY is + * not specified, or + * - partially decompressed using a cropping region. + */ + TJSAMP_UNKNOWN = -1 +}; + +/** + * iMCU width (in pixels) for a given level of chrominance subsampling + * + * In a typical lossy JPEG image, 8x8 blocks of DCT coefficients for each + * component are interleaved in a single scan. If the image uses chrominance + * subsampling, then multiple luminance blocks are stored together, followed by + * a single block for each chrominance component. The minimum set of + * full-resolution luminance block(s) and corresponding (possibly subsampled) + * chrominance blocks necessary to represent at least one DCT block per + * component is called a "Minimum Coded Unit" or "MCU". (For example, an MCU + * in an interleaved lossy JPEG image that uses 4:2:2 subsampling consists of + * two luminance blocks followed by one block for each chrominance component.) + * In a non-interleaved lossy JPEG image, each component is stored in a + * separate scan, and an MCU is a single DCT block, so we use the term "iMCU" + * (interleaved MCU) to refer to the equivalent of an MCU in an interleaved + * JPEG image. For the common case of interleaved JPEG images, an iMCU is the + * same as an MCU. + * + * iMCU sizes: + * - 8x8 for no subsampling or grayscale + * - 16x8 for 4:2:2 + * - 8x16 for 4:4:0 + * - 16x16 for 4:2:0 + * - 32x8 for 4:1:1 + * - 8x32 for 4:4:1 + */ +static const int tjMCUWidth[TJ_NUMSAMP] = { 8, 16, 16, 8, 8, 32, 8 }; + +/** + * iMCU height (in pixels) for a given level of chrominance subsampling + * + * In a typical lossy JPEG image, 8x8 blocks of DCT coefficients for each + * component are interleaved in a single scan. If the image uses chrominance + * subsampling, then multiple luminance blocks are stored together, followed by + * a single block for each chrominance component. The minimum set of + * full-resolution luminance block(s) and corresponding (possibly subsampled) + * chrominance blocks necessary to represent at least one DCT block per + * component is called a "Minimum Coded Unit" or "MCU". (For example, an MCU + * in an interleaved lossy JPEG image that uses 4:2:2 subsampling consists of + * two luminance blocks followed by one block for each chrominance component.) + * In a non-interleaved lossy JPEG image, each component is stored in a + * separate scan, and an MCU is a single DCT block, so we use the term "iMCU" + * (interleaved MCU) to refer to the equivalent of an MCU in an interleaved + * JPEG image. For the common case of interleaved JPEG images, an iMCU is the + * same as an MCU. + * + * iMCU sizes: + * - 8x8 for no subsampling or grayscale + * - 16x8 for 4:2:2 + * - 8x16 for 4:4:0 + * - 16x16 for 4:2:0 + * - 32x8 for 4:1:1 + * - 8x32 for 4:4:1 + */ +static const int tjMCUHeight[TJ_NUMSAMP] = { 8, 8, 16, 8, 16, 8, 32 }; + + +/** + * The number of pixel formats + */ +#define TJ_NUMPF 12 + +/** + * Pixel formats + */ +enum TJPF { + /** + * RGB pixel format + * + * The red, green, and blue components in the image are stored in 3-sample + * pixels in the order R, G, B from lowest to highest memory address within + * each pixel. + */ + TJPF_RGB, + /** + * BGR pixel format + * + * The red, green, and blue components in the image are stored in 3-sample + * pixels in the order B, G, R from lowest to highest memory address within + * each pixel. + */ + TJPF_BGR, + /** + * RGBX pixel format + * + * The red, green, and blue components in the image are stored in 4-sample + * pixels in the order R, G, B from lowest to highest memory address within + * each pixel. The X component is ignored when compressing/encoding and + * undefined when decompressing/decoding. + */ + TJPF_RGBX, + /** + * BGRX pixel format + * + * The red, green, and blue components in the image are stored in 4-sample + * pixels in the order B, G, R from lowest to highest memory address within + * each pixel. The X component is ignored when compressing/encoding and + * undefined when decompressing/decoding. + */ + TJPF_BGRX, + /** + * XBGR pixel format + * + * The red, green, and blue components in the image are stored in 4-sample + * pixels in the order R, G, B from highest to lowest memory address within + * each pixel. The X component is ignored when compressing/encoding and + * undefined when decompressing/decoding. + */ + TJPF_XBGR, + /** + * XRGB pixel format + * + * The red, green, and blue components in the image are stored in 4-sample + * pixels in the order B, G, R from highest to lowest memory address within + * each pixel. The X component is ignored when compressing/encoding and + * undefined when decompressing/decoding. + */ + TJPF_XRGB, + /** + * Grayscale pixel format + * + * Each 1-sample pixel represents a luminance (brightness) level from 0 to + * the maximum sample value (255 for 8-bit samples, 4095 for 12-bit samples, + * and 65535 for 16-bit samples.) + */ + TJPF_GRAY, + /** + * RGBA pixel format + * + * This is the same as @ref TJPF_RGBX, except that when + * decompressing/decoding, the X component is guaranteed to be equal to the + * maximum sample value, which can be interpreted as an opaque alpha channel. + */ + TJPF_RGBA, + /** + * BGRA pixel format + * + * This is the same as @ref TJPF_BGRX, except that when + * decompressing/decoding, the X component is guaranteed to be equal to the + * maximum sample value, which can be interpreted as an opaque alpha channel. + */ + TJPF_BGRA, + /** + * ABGR pixel format + * + * This is the same as @ref TJPF_XBGR, except that when + * decompressing/decoding, the X component is guaranteed to be equal to the + * maximum sample value, which can be interpreted as an opaque alpha channel. + */ + TJPF_ABGR, + /** + * ARGB pixel format + * + * This is the same as @ref TJPF_XRGB, except that when + * decompressing/decoding, the X component is guaranteed to be equal to the + * maximum sample value, which can be interpreted as an opaque alpha channel. + */ + TJPF_ARGB, + /** + * CMYK pixel format + * + * Unlike RGB, which is an additive color model used primarily for display, + * CMYK (Cyan/Magenta/Yellow/Key) is a subtractive color model used primarily + * for printing. In the CMYK color model, the value of each color component + * typically corresponds to an amount of cyan, magenta, yellow, or black ink + * that is applied to a white background. In order to convert between CMYK + * and RGB, it is necessary to use a color management system (CMS.) A CMS + * will attempt to map colors within the printer's gamut to perceptually + * similar colors in the display's gamut and vice versa, but the mapping is + * typically not 1:1 or reversible, nor can it be defined with a simple + * formula. Thus, such a conversion is out of scope for a codec library. + * However, the TurboJPEG API allows for compressing packed-pixel CMYK images + * into YCCK JPEG images (see #TJCS_YCCK) and decompressing YCCK JPEG images + * into packed-pixel CMYK images. + */ + TJPF_CMYK, + /** + * Unknown pixel format + * + * Currently this is only used by #tj3LoadImage8(), #tj3LoadImage12(), and + * #tj3LoadImage16(). + */ + TJPF_UNKNOWN = -1 +}; + +/** + * Red offset (in samples) for a given pixel format + * + * This specifies the number of samples that the red component is offset from + * the start of the pixel. For instance, if an 8-bit-per-component pixel of + * format TJPF_BGRX is stored in `unsigned char pixel[]`, then the red + * component is `pixel[tjRedOffset[TJPF_BGRX]]`. The offset is -1 if the pixel + * format does not have a red component. + */ +static const int tjRedOffset[TJ_NUMPF] = { + 0, 2, 0, 2, 3, 1, -1, 0, 2, 3, 1, -1 +}; +/** + * Green offset (in samples) for a given pixel format + * + * This specifies the number of samples that the green component is offset from + * the start of the pixel. For instance, if an 8-bit-per-component pixel of + * format TJPF_BGRX is stored in `unsigned char pixel[]`, then the green + * component is `pixel[tjGreenOffset[TJPF_BGRX]]`. The offset is -1 if the + * pixel format does not have a green component. + */ +static const int tjGreenOffset[TJ_NUMPF] = { + 1, 1, 1, 1, 2, 2, -1, 1, 1, 2, 2, -1 +}; +/** + * Blue offset (in samples) for a given pixel format + * + * This specifies the number of samples that the blue component is offset from + * the start of the pixel. For instance, if an 8-bit-per-component pixel of + * format TJPF_BGRX is stored in `unsigned char pixel[]`, then the blue + * component is `pixel[tjBlueOffset[TJPF_BGRX]]`. The offset is -1 if the + * pixel format does not have a blue component. + */ +static const int tjBlueOffset[TJ_NUMPF] = { + 2, 0, 2, 0, 1, 3, -1, 2, 0, 1, 3, -1 +}; +/** + * Alpha offset (in samples) for a given pixel format + * + * This specifies the number of samples that the alpha component is offset from + * the start of the pixel. For instance, if an 8-bit-per-component pixel of + * format TJPF_BGRA is stored in `unsigned char pixel[]`, then the alpha + * component is `pixel[tjAlphaOffset[TJPF_BGRA]]`. The offset is -1 if the + * pixel format does not have an alpha component. + */ +static const int tjAlphaOffset[TJ_NUMPF] = { + -1, -1, -1, -1, -1, -1, -1, 3, 3, 0, 0, -1 +}; +/** + * Pixel size (in samples) for a given pixel format + */ +static const int tjPixelSize[TJ_NUMPF] = { + 3, 3, 4, 4, 4, 4, 1, 4, 4, 4, 4, 4 +}; + + +/** + * The number of JPEG colorspaces + */ +#define TJ_NUMCS 5 + +/** + * JPEG colorspaces + */ +enum TJCS { + /** + * RGB colorspace + * + * When generating the JPEG image, the R, G, and B components in the source + * image are reordered into image planes, but no colorspace conversion or + * subsampling is performed. RGB JPEG images can be generated from and + * decompressed to packed-pixel images with any of the extended RGB or + * grayscale pixel formats, but they cannot be generated from or + * decompressed to planar YUV images. + */ + TJCS_RGB, + /** + * YCbCr colorspace + * + * YCbCr is not an absolute colorspace but rather a mathematical + * transformation of RGB designed solely for storage and transmission. YCbCr + * images must be converted to RGB before they can be displayed. In the + * YCbCr colorspace, the Y (luminance) component represents the black & white + * portion of the original image, and the Cb and Cr (chrominance) components + * represent the color portion of the original image. Historically, the + * analog equivalent of this transformation allowed the same signal to be + * displayed to both black & white and color televisions, but JPEG images use + * YCbCr primarily because it allows the color data to be optionally + * subsampled in order to reduce network and disk usage. YCbCr is the most + * common JPEG colorspace, and YCbCr JPEG images can be generated from and + * decompressed to packed-pixel images with any of the extended RGB or + * grayscale pixel formats. YCbCr JPEG images can also be generated from + * and decompressed to planar YUV images. + */ + TJCS_YCbCr, + /** + * Grayscale colorspace + * + * The JPEG image retains only the luminance data (Y component), and any + * color data from the source image is discarded. Grayscale JPEG images can + * be generated from and decompressed to packed-pixel images with any of the + * extended RGB or grayscale pixel formats, or they can be generated from + * and decompressed to planar YUV images. + */ + TJCS_GRAY, + /** + * CMYK colorspace + * + * When generating the JPEG image, the C, M, Y, and K components in the + * source image are reordered into image planes, but no colorspace conversion + * or subsampling is performed. CMYK JPEG images can only be generated from + * and decompressed to packed-pixel images with the CMYK pixel format. + */ + TJCS_CMYK, + /** + * YCCK colorspace + * + * YCCK (AKA "YCbCrK") is not an absolute colorspace but rather a + * mathematical transformation of CMYK designed solely for storage and + * transmission. It is to CMYK as YCbCr is to RGB. CMYK pixels can be + * reversibly transformed into YCCK, and as with YCbCr, the chrominance + * components in the YCCK pixels can be subsampled without incurring major + * perceptual loss. YCCK JPEG images can only be generated from and + * decompressed to packed-pixel images with the CMYK pixel format. + */ + TJCS_YCCK +}; + + +/** + * Parameters + */ +enum TJPARAM { + /** + * Error handling behavior + * + * **Value** + * - `0` *[default]* Allow the current compression/decompression/transform + * operation to complete unless a fatal error is encountered. + * - `1` Immediately discontinue the current + * compression/decompression/transform operation if a warning (non-fatal + * error) occurs. + */ + TJPARAM_STOPONWARNING, + /** + * Row order in packed-pixel source/destination images + * + * **Value** + * - `0` *[default]* top-down (X11) order + * - `1` bottom-up (Windows, OpenGL) order + */ + TJPARAM_BOTTOMUP, + /** + * JPEG destination buffer (re)allocation [compression, lossless + * transformation] + * + * **Value** + * - `0` *[default]* Attempt to allocate or reallocate the JPEG destination + * buffer as needed. + * - `1` Generate an error if the JPEG destination buffer is invalid or too + * small. + */ + TJPARAM_NOREALLOC, + /** + * Perceptual quality of lossy JPEG images [compression only] + * + * **Value** + * - `1`-`100` (`1` = worst quality but best compression, `100` = best + * quality but worst compression) *[no default; must be explicitly + * specified]* + */ + TJPARAM_QUALITY, + /** + * Chrominance subsampling level + * + * The JPEG or YUV image uses (decompression, decoding) or will use (lossy + * compression, encoding) the specified level of chrominance subsampling. + * + * **Value** + * - One of the @ref TJSAMP "chrominance subsampling options" *[no default; + * must be explicitly specified for lossy compression, encoding, and + * decoding]* + */ + TJPARAM_SUBSAMP, + /** + * JPEG width (in pixels) [decompression only, read-only] + */ + TJPARAM_JPEGWIDTH, + /** + * JPEG height (in pixels) [decompression only, read-only] + */ + TJPARAM_JPEGHEIGHT, + /** + * JPEG data precision (bits per sample) [decompression only, read-only] + * + * The JPEG image uses the specified number of bits per sample. + * + * **Value** + * - `8`, `12`, or `16` + * + * 12-bit data precision implies #TJPARAM_OPTIMIZE unless #TJPARAM_ARITHMETIC + * is set. + */ + TJPARAM_PRECISION, + /** + * JPEG colorspace + * + * The JPEG image uses (decompression) or will use (lossy compression) the + * specified colorspace. + * + * **Value** + * - One of the @ref TJCS "JPEG colorspaces" *[default for lossy compression: + * automatically selected based on the subsampling level and pixel format]* + */ + TJPARAM_COLORSPACE, + /** + * Chrominance upsampling algorithm [lossy decompression only] + * + * **Value** + * - `0` *[default]* Use smooth upsampling when decompressing a JPEG image + * that was generated using chrominance subsampling. This creates a smooth + * transition between neighboring chrominance components in order to reduce + * upsampling artifacts in the decompressed image. + * - `1` Use the fastest chrominance upsampling algorithm available, which + * may combine upsampling with color conversion. + */ + TJPARAM_FASTUPSAMPLE, + /** + * DCT/IDCT algorithm [lossy compression and decompression] + * + * **Value** + * - `0` *[default]* Use the most accurate DCT/IDCT algorithm available. + * - `1` Use the fastest DCT/IDCT algorithm available. + * + * This parameter is provided mainly for backward compatibility with libjpeg, + * which historically implemented several different DCT/IDCT algorithms + * because of performance limitations with 1990s CPUs. In the libjpeg-turbo + * implementation of the TurboJPEG API: + * - The "fast" and "accurate" DCT/IDCT algorithms perform similarly on + * modern x86/x86-64 CPUs that support AVX2 instructions. + * - The "fast" algorithm is generally only about 5-15% faster than the + * "accurate" algorithm on other types of CPUs. + * - The difference in accuracy between the "fast" and "accurate" algorithms + * is the most pronounced at JPEG quality levels above 90 and tends to be + * more pronounced with decompression than with compression. + * - For JPEG quality levels above 97, the "fast" algorithm degrades and is + * not fully accelerated, so it is slower than the "accurate" algorithm. + */ + TJPARAM_FASTDCT, + /** + * Huffman table optimization [lossy compression, lossless transformation] + * + * **Value** + * - `0` *[default]* The JPEG image will use the default Huffman tables. + * - `1` Optimal Huffman tables will be computed for the JPEG image. For + * lossless transformation, this can also be specified using + * #TJXOPT_OPTIMIZE. + * + * Huffman table optimization improves compression slightly (generally 5% or + * less), but it reduces compression performance considerably. + */ + TJPARAM_OPTIMIZE, + /** + * Progressive JPEG + * + * In a progressive JPEG image, the DCT coefficients are split across + * multiple "scans" of increasing quality. Thus, a low-quality scan + * containing the lowest-frequency DCT coefficients can be transmitted first + * and refined with subsequent higher-quality scans containing + * higher-frequency DCT coefficients. When using Huffman entropy coding, the + * progressive JPEG format also provides an "end-of-bands (EOB) run" feature + * that allows large groups of zeroes, potentially spanning multiple MCUs, + * to be represented using only a few bytes. + * + * **Value** + * - `0` *[default for compression, lossless transformation]* The lossy JPEG + * image is (decompression) or will be (compression, lossless transformation) + * single-scan. + * - `1` The lossy JPEG image is (decompression) or will be (compression, + * lossless transformation) progressive. For lossless transformation, this + * can also be specified using #TJXOPT_PROGRESSIVE. + * + * Progressive JPEG images generally have better compression ratios than + * single-scan JPEG images (much better if the image has large areas of solid + * color), but progressive JPEG compression and decompression is considerably + * slower than single-scan JPEG compression and decompression. Can be + * combined with #TJPARAM_ARITHMETIC. Implies #TJPARAM_OPTIMIZE unless + * #TJPARAM_ARITHMETIC is also set. + */ + TJPARAM_PROGRESSIVE, + /** + * Progressive JPEG scan limit for lossy JPEG images [decompression, lossless + * transformation] + * + * Setting this parameter causes the decompression and transform functions to + * return an error if the number of scans in a progressive JPEG image exceeds + * the specified limit. The primary purpose of this is to allow + * security-critical applications to guard against an exploit of the + * progressive JPEG format described in + * this report. + * + * **Value** + * - maximum number of progressive JPEG scans that the decompression and + * transform functions will process *[default: `0` (no limit)]* + * + * @see #TJPARAM_PROGRESSIVE + */ + TJPARAM_SCANLIMIT, + /** + * Arithmetic entropy coding + * + * **Value** + * - `0` *[default for compression, lossless transformation]* The lossy JPEG + * image uses (decompression) or will use (compression, lossless + * transformation) Huffman entropy coding. + * - `1` The lossy JPEG image uses (decompression) or will use (compression, + * lossless transformation) arithmetic entropy coding. For lossless + * transformation, this can also be specified using #TJXOPT_ARITHMETIC. + * + * Arithmetic entropy coding generally improves compression relative to + * Huffman entropy coding, but it reduces compression and decompression + * performance considerably. Can be combined with #TJPARAM_PROGRESSIVE. + */ + TJPARAM_ARITHMETIC, + /** + * Lossless JPEG + * + * **Value** + * - `0` *[default for compression]* The JPEG image is (decompression) or + * will be (compression) lossy/DCT-based. + * - `1` The JPEG image is (decompression) or will be (compression) + * lossless/predictive. + * + * In most cases, lossless JPEG compression and decompression is considerably + * slower than lossy JPEG compression and decompression, and lossless JPEG + * images are much larger than lossy JPEG images. Thus, lossless JPEG images + * are typically used only for applications that require mathematically + * lossless compression. Also note that the following features are not + * available with lossless JPEG images: + * - Colorspace conversion (lossless JPEG images always use #TJCS_RGB, + * #TJCS_GRAY, or #TJCS_CMYK, depending on the pixel format of the source + * image) + * - Chrominance subsampling (lossless JPEG images always use #TJSAMP_444) + * - JPEG quality selection + * - DCT/IDCT algorithm selection + * - Progressive JPEG + * - Arithmetic entropy coding + * - Compression from/decompression to planar YUV images + * - Decompression scaling + * - Lossless transformation + * + * @see #TJPARAM_LOSSLESSPSV, #TJPARAM_LOSSLESSPT + */ + TJPARAM_LOSSLESS, + /** + * Lossless JPEG predictor selection value (PSV) + * + * **Value** + * - `1`-`7` *[default for compression: `1`]* + * + * Lossless JPEG compression shares no algorithms with lossy JPEG + * compression. Instead, it uses differential pulse-code modulation (DPCM), + * an algorithm whereby each sample is encoded as the difference between the + * sample's value and a "predictor", which is based on the values of + * neighboring samples. If Ra is the sample immediately to the left of the + * current sample, Rb is the sample immediately above the current sample, and + * Rc is the sample diagonally to the left and above the current sample, then + * the relationship between the predictor selection value and the predictor + * is as follows: + * + * PSV | Predictor + * ----|---------- + * 1 | Ra + * 2 | Rb + * 3 | Rc + * 4 | Ra + Rb – Rc + * 5 | Ra + (Rb – Rc) / 2 + * 6 | Rb + (Ra – Rc) / 2 + * 7 | (Ra + Rb) / 2 + * + * Predictors 1-3 are 1-dimensional predictors, whereas Predictors 4-7 are + * 2-dimensional predictors. The best predictor for a particular image + * depends on the image. + * + * @see #TJPARAM_LOSSLESS + */ + TJPARAM_LOSSLESSPSV, + /** + * Lossless JPEG point transform (Pt) + * + * **Value** + * - `0` through ***precision*** *- 1*, where ***precision*** is the JPEG + * data precision in bits *[default for compression: `0`]* + * + * A point transform value of `0` is necessary in order to generate a fully + * lossless JPEG image. (A non-zero point transform value right-shifts the + * input samples by the specified number of bits, which is effectively a form + * of lossy color quantization.) + * + * @see #TJPARAM_LOSSLESS, #TJPARAM_PRECISION + */ + TJPARAM_LOSSLESSPT, + /** + * JPEG restart marker interval in MCUs [lossy compression only] + * + * The nature of entropy coding is such that a corrupt JPEG image cannot + * be decompressed beyond the point of corruption unless it contains restart + * markers. A restart marker stops and restarts the entropy coding algorithm + * so that, if a JPEG image is corrupted, decompression can resume at the + * next marker. Thus, adding more restart markers improves the fault + * tolerance of the JPEG image, but adding too many restart markers can + * adversely affect the compression ratio and performance. + * + * In typical JPEG images, an MCU (Minimum Coded Unit) is the minimum set of + * interleaved "data units" (8x8 DCT blocks if the image is lossy or samples + * if the image is lossless) necessary to represent at least one data unit + * per component. (For example, an MCU in an interleaved lossy JPEG image + * that uses 4:2:2 subsampling consists of two luminance blocks followed by + * one block for each chrominance component.) In single-component or + * non-interleaved JPEG images, an MCU is the same as a data unit. + * + * **Value** + * - the number of MCUs between each restart marker *[default: `0` (no + * restart markers)]* + * + * Setting this parameter to a non-zero value sets #TJPARAM_RESTARTROWS to 0. + */ + TJPARAM_RESTARTBLOCKS, + /** + * JPEG restart marker interval in MCU rows [compression only] + * + * See #TJPARAM_RESTARTBLOCKS for a description of restart markers and MCUs. + * An MCU row is a row of MCUs spanning the entire width of the image. + * + * **Value** + * - the number of MCU rows between each restart marker *[default: `0` (no + * restart markers)]* + * + * Setting this parameter to a non-zero value sets #TJPARAM_RESTARTBLOCKS to + * 0. + */ + TJPARAM_RESTARTROWS, + /** + * JPEG horizontal pixel density + * + * **Value** + * - The JPEG image has (decompression) or will have (compression) the + * specified horizontal pixel density *[default for compression: `1`]*. + * + * This value is stored in or read from the JPEG header. It does not affect + * the contents of the JPEG image. Note that this parameter is set by + * #tj3LoadImage8() when loading a Windows BMP file that contains pixel + * density information, and the value of this parameter is stored to a + * Windows BMP file by #tj3SaveImage8() if the value of #TJPARAM_DENSITYUNITS + * is `2`. + * + * @see TJPARAM_DENSITYUNITS + */ + TJPARAM_XDENSITY, + /** + * JPEG vertical pixel density + * + * **Value** + * - The JPEG image has (decompression) or will have (compression) the + * specified vertical pixel density *[default for compression: `1`]*. + * + * This value is stored in or read from the JPEG header. It does not affect + * the contents of the JPEG image. Note that this parameter is set by + * #tj3LoadImage8() when loading a Windows BMP file that contains pixel + * density information, and the value of this parameter is stored to a + * Windows BMP file by #tj3SaveImage8() if the value of #TJPARAM_DENSITYUNITS + * is `2`. + * + * @see TJPARAM_DENSITYUNITS + */ + TJPARAM_YDENSITY, + /** + * JPEG pixel density units + * + * **Value** + * - `0` *[default for compression]* The pixel density of the JPEG image is + * expressed (decompression) or will be expressed (compression) in unknown + * units. + * - `1` The pixel density of the JPEG image is expressed (decompression) or + * will be expressed (compression) in units of pixels/inch. + * - `2` The pixel density of the JPEG image is expressed (decompression) or + * will be expressed (compression) in units of pixels/cm. + * + * This value is stored in or read from the JPEG header. It does not affect + * the contents of the JPEG image. Note that this parameter is set by + * #tj3LoadImage8() when loading a Windows BMP file that contains pixel + * density information, and the value of this parameter is stored to a + * Windows BMP file by #tj3SaveImage8() if the value is `2`. + * + * @see TJPARAM_XDENSITY, TJPARAM_YDENSITY + */ + TJPARAM_DENSITYUNITS, + /** + * Memory limit for intermediate buffers + * + * **Value** + * - the maximum amount of memory (in megabytes) that will be allocated for + * intermediate buffers, which are used with progressive JPEG compression and + * decompression, Huffman table optimization, lossless JPEG compression, and + * lossless transformation *[default: `0` (no limit)]* + */ + TJPARAM_MAXMEMORY, + /** + * Image size limit [decompression, lossless transformation, packed-pixel + * image loading] + * + * Setting this parameter causes the decompression, transform, and image + * loading functions to return an error if the number of pixels in the source + * image exceeds the specified limit. This allows security-critical + * applications to guard against excessive memory consumption. + * + * **Value** + * - maximum number of pixels that the decompression, transform, and image + * loading functions will process *[default: `0` (no limit)]* + */ + TJPARAM_MAXPIXELS +}; + + +/** + * The number of error codes + */ +#define TJ_NUMERR 2 + +/** + * Error codes + */ +enum TJERR { + /** + * The error was non-fatal and recoverable, but the destination image may + * still be corrupt. + */ + TJERR_WARNING, + /** + * The error was fatal and non-recoverable. + */ + TJERR_FATAL +}; + + +/** + * The number of transform operations + */ +#define TJ_NUMXOP 8 + +/** + * Transform operations for #tj3Transform() + */ +enum TJXOP { + /** + * Do not transform the position of the image pixels. + */ + TJXOP_NONE, + /** + * Flip (mirror) image horizontally. This transform is imperfect if there + * are any partial iMCUs on the right edge (see #TJXOPT_PERFECT.) + */ + TJXOP_HFLIP, + /** + * Flip (mirror) image vertically. This transform is imperfect if there are + * any partial iMCUs on the bottom edge (see #TJXOPT_PERFECT.) + */ + TJXOP_VFLIP, + /** + * Transpose image (flip/mirror along upper left to lower right axis.) This + * transform is always perfect. + */ + TJXOP_TRANSPOSE, + /** + * Transverse transpose image (flip/mirror along upper right to lower left + * axis.) This transform is imperfect if there are any partial iMCUs in the + * image (see #TJXOPT_PERFECT.) + */ + TJXOP_TRANSVERSE, + /** + * Rotate image clockwise by 90 degrees. This transform is imperfect if + * there are any partial iMCUs on the bottom edge (see #TJXOPT_PERFECT.) + */ + TJXOP_ROT90, + /** + * Rotate image 180 degrees. This transform is imperfect if there are any + * partial iMCUs in the image (see #TJXOPT_PERFECT.) + */ + TJXOP_ROT180, + /** + * Rotate image counter-clockwise by 90 degrees. This transform is imperfect + * if there are any partial iMCUs on the right edge (see #TJXOPT_PERFECT.) + */ + TJXOP_ROT270 +}; + + +/** + * This option causes #tj3Transform() to return an error if the transform is + * not perfect. Lossless transforms operate on iMCUs, the size of which + * depends on the level of chrominance subsampling used (see #tjMCUWidth and + * #tjMCUHeight.) If the image's width or height is not evenly divisible by + * the iMCU size, then there will be partial iMCUs on the right and/or bottom + * edges. It is not possible to move these partial iMCUs to the top or left of + * the image, so any transform that would require that is "imperfect." If this + * option is not specified, then any partial iMCUs that cannot be transformed + * will be left in place, which will create odd-looking strips on the right or + * bottom edge of the image. + */ +#define TJXOPT_PERFECT (1 << 0) +/** + * Discard any partial iMCUs that cannot be transformed. + */ +#define TJXOPT_TRIM (1 << 1) +/** + * Enable lossless cropping. See #tj3Transform() for more information. + */ +#define TJXOPT_CROP (1 << 2) +/** + * Discard the color data in the source image, and generate a grayscale + * destination image. + */ +#define TJXOPT_GRAY (1 << 3) +/** + * Do not generate a destination image. (This can be used in conjunction with + * a custom filter to capture the transformed DCT coefficients without + * transcoding them.) + */ +#define TJXOPT_NOOUTPUT (1 << 4) +/** + * Generate a progressive destination image instead of a single-scan + * destination image. Progressive JPEG images generally have better + * compression ratios than single-scan JPEG images (much better if the image + * has large areas of solid color), but progressive JPEG decompression is + * considerably slower than single-scan JPEG decompression. Can be combined + * with #TJXOPT_ARITHMETIC. Implies #TJXOPT_OPTIMIZE unless #TJXOPT_ARITHMETIC + * is also specified. + */ +#define TJXOPT_PROGRESSIVE (1 << 5) +/** + * Do not copy any extra markers (including Exif and ICC profile data) from the + * source image to the destination image. + */ +#define TJXOPT_COPYNONE (1 << 6) +/** + * Enable arithmetic entropy coding in the destination image. Arithmetic + * entropy coding generally improves compression relative to Huffman entropy + * coding (the default), but it reduces decompression performance considerably. + * Can be combined with #TJXOPT_PROGRESSIVE. + */ +#define TJXOPT_ARITHMETIC (1 << 7) +/** + * Enable Huffman table optimization for the destination image. Huffman table + * optimization improves compression slightly (generally 5% or less.) + */ +#define TJXOPT_OPTIMIZE (1 << 8) + + +/** + * Scaling factor + */ +typedef struct { + /** + * Numerator + */ + int num; + /** + * Denominator + */ + int denom; +} tjscalingfactor; + +/** + * Cropping region + */ +typedef struct { + /** + * The left boundary of the cropping region. For lossless transformation, + * this must be evenly divisible by the iMCU width (see #tjMCUWidth) of the + * destination image. For decompression, this must be evenly divisible by + * the scaled iMCU width of the source image. + */ + int x; + /** + * The upper boundary of the cropping region. For lossless transformation, + * this must be evenly divisible by the iMCU height (see #tjMCUHeight) of the + * destination image. + */ + int y; + /** + * The width of the cropping region. Setting this to 0 is the equivalent of + * setting it to the width of the source JPEG image - x. + */ + int w; + /** + * The height of the cropping region. Setting this to 0 is the equivalent of + * setting it to the height of the source JPEG image - y. + */ + int h; +} tjregion; + +/** + * A #tjregion structure that specifies no cropping + */ +static const tjregion TJUNCROPPED = { 0, 0, 0, 0 }; + +/** + * Lossless transform + */ +typedef struct tjtransform { + /** + * Cropping region + */ + tjregion r; + /** + * One of the @ref TJXOP "transform operations" + */ + int op; + /** + * The bitwise OR of one of more of the @ref TJXOPT_ARITHMETIC + * "transform options" + */ + int options; + /** + * Arbitrary data that can be accessed within the body of the callback + * function + */ + void *data; + /** + * A callback function that can be used to modify the DCT coefficients after + * they are losslessly transformed but before they are transcoded to a new + * JPEG image. This allows for custom filters or other transformations to be + * applied in the frequency domain. + * + * @param coeffs pointer to an array of transformed DCT coefficients. (NOTE: + * This pointer is not guaranteed to be valid once the callback returns, so + * applications wishing to hand off the DCT coefficients to another function + * or library should make a copy of them within the body of the callback.) + * + * @param arrayRegion #tjregion structure containing the width and height of + * the array pointed to by `coeffs` as well as its offset relative to the + * component plane. TurboJPEG implementations may choose to split each + * component plane into multiple DCT coefficient arrays and call the callback + * function once for each array. + * + * @param planeRegion #tjregion structure containing the width and height of + * the component plane to which `coeffs` belongs + * + * @param componentID ID number of the component plane to which `coeffs` + * belongs. (Y, Cb, and Cr have, respectively, ID's of 0, 1, and 2 in + * typical JPEG images.) + * + * @param transformID ID number of the transformed image to which `coeffs` + * belongs. This is the same as the index of the transform in the + * `transforms` array that was passed to #tj3Transform(). + * + * @param transform a pointer to a #tjtransform structure that specifies the + * parameters and/or cropping region for this transform + * + * @return 0 if the callback was successful, or -1 if an error occurred. + */ + int (*customFilter) (short *coeffs, tjregion arrayRegion, + tjregion planeRegion, int componentID, int transformID, + struct tjtransform *transform); +} tjtransform; + +/** + * TurboJPEG instance handle + */ +typedef void *tjhandle; + + +/** + * Compute the scaled value of `dimension` using the given scaling factor. + * This macro performs the integer equivalent of `ceil(dimension * + * scalingFactor)`. + */ +#define TJSCALED(dimension, scalingFactor) \ + (((dimension) * scalingFactor.num + scalingFactor.denom - 1) / \ + scalingFactor.denom) + +/** + * A #tjscalingfactor structure that specifies a scaling factor of 1/1 (no + * scaling) + */ +static const tjscalingfactor TJUNSCALED = { 1, 1 }; + + +#ifdef __cplusplus +extern "C" { +#endif + + +/** + * Create a new TurboJPEG instance. + * + * @param initType one of the @ref TJINIT "initialization options" + * + * @return a handle to the newly-created instance, or NULL if an error occurred + * (see #tj3GetErrorStr().) + */ +DLLEXPORT tjhandle tj3Init(int initType); + + +/** + * Destroy a TurboJPEG instance. + * + * @param handle handle to a TurboJPEG instance. If the handle is NULL, then + * this function has no effect. + */ +DLLEXPORT void tj3Destroy(tjhandle handle); + + +/** + * Returns a descriptive error message explaining why the last command failed. + * + * @param handle handle to a TurboJPEG instance, or NULL if the error was + * generated by a global function (but note that retrieving the error message + * for a global function is thread-safe only on platforms that support + * thread-local storage.) + * + * @return a descriptive error message explaining why the last command failed. + */ +DLLEXPORT char *tj3GetErrorStr(tjhandle handle); + + +/** + * Returns a code indicating the severity of the last error. See + * @ref TJERR "Error codes". + * + * @param handle handle to a TurboJPEG instance + * + * @return a code indicating the severity of the last error. See + * @ref TJERR "Error codes". + */ +DLLEXPORT int tj3GetErrorCode(tjhandle handle); + + +/** + * Set the value of a parameter. + * + * @param handle handle to a TurboJPEG instance + * + * @param param one of the @ref TJPARAM "parameters" + * + * @param value value of the parameter (refer to @ref TJPARAM + * "parameter documentation") + * + * @return 0 if successful, or -1 if an error occurred (see #tj3GetErrorStr().) + */ +DLLEXPORT int tj3Set(tjhandle handle, int param, int value); + + +/** + * Get the value of a parameter. + * + * @param handle handle to a TurboJPEG instance + * + * @param param one of the @ref TJPARAM "parameters" + * + * @return the value of the specified parameter, or -1 if the value is unknown. + */ +DLLEXPORT int tj3Get(tjhandle handle, int param); + + +/** + * Allocate a byte buffer for use with TurboJPEG. You should always use this + * function to allocate the JPEG destination buffer(s) for the compression and + * transform functions unless you are disabling automatic buffer (re)allocation + * (by setting #TJPARAM_NOREALLOC.) + * + * @param bytes the number of bytes to allocate + * + * @return a pointer to a newly-allocated buffer with the specified number of + * bytes. + * + * @see tj3Free() + */ +DLLEXPORT void *tj3Alloc(size_t bytes); + + +/** + * Free a byte buffer previously allocated by TurboJPEG. You should always use + * this function to free JPEG destination buffer(s) that were automatically + * (re)allocated by the compression and transform functions or that were + * manually allocated using #tj3Alloc(). + * + * @param buffer address of the buffer to free. If the address is NULL, then + * this function has no effect. + * + * @see tj3Alloc() + */ +DLLEXPORT void tj3Free(void *buffer); + + +/** + * The maximum size of the buffer (in bytes) required to hold a JPEG image with + * the given parameters. The number of bytes returned by this function is + * larger than the size of the uncompressed source image. The reason for this + * is that the JPEG format uses 16-bit coefficients, so it is possible for a + * very high-quality source image with very high-frequency content to expand + * rather than compress when converted to the JPEG format. Such images + * represent very rare corner cases, but since there is no way to predict the + * size of a JPEG image prior to compression, the corner cases have to be + * handled. + * + * @param width width (in pixels) of the image + * + * @param height height (in pixels) of the image + * + * @param jpegSubsamp the level of chrominance subsampling to be used when + * generating the JPEG image (see @ref TJSAMP + * "Chrominance subsampling options".) #TJSAMP_UNKNOWN is treated like + * #TJSAMP_444, since a buffer large enough to hold a JPEG image with no + * subsampling should also be large enough to hold a JPEG image with an + * arbitrary level of subsampling. Note that lossless JPEG images always + * use #TJSAMP_444. + * + * @return the maximum size of the buffer (in bytes) required to hold the + * image, or 0 if the arguments are out of bounds. + */ +DLLEXPORT size_t tj3JPEGBufSize(int width, int height, int jpegSubsamp); + + +/** + * The size of the buffer (in bytes) required to hold a unified planar YUV + * image with the given parameters. + * + * @param width width (in pixels) of the image + * + * @param align row alignment (in bytes) of the image (must be a power of 2.) + * Setting this parameter to n specifies that each row in each plane of the + * image will be padded to the nearest multiple of n bytes (1 = unpadded.) + * + * @param height height (in pixels) of the image + * + * @param subsamp level of chrominance subsampling in the image (see + * @ref TJSAMP "Chrominance subsampling options".) + * + * @return the size of the buffer (in bytes) required to hold the image, or 0 + * if the arguments are out of bounds. + */ +DLLEXPORT size_t tj3YUVBufSize(int width, int align, int height, int subsamp); + + +/** + * The size of the buffer (in bytes) required to hold a YUV image plane with + * the given parameters. + * + * @param componentID ID number of the image plane (0 = Y, 1 = U/Cb, 2 = V/Cr) + * + * @param width width (in pixels) of the YUV image. NOTE: This is the width of + * the whole image, not the plane width. + * + * @param stride bytes per row in the image plane. Setting this to 0 is the + * equivalent of setting it to the plane width. + * + * @param height height (in pixels) of the YUV image. NOTE: This is the height + * of the whole image, not the plane height. + * + * @param subsamp level of chrominance subsampling in the image (see + * @ref TJSAMP "Chrominance subsampling options".) + * + * @return the size of the buffer (in bytes) required to hold the YUV image + * plane, or 0 if the arguments are out of bounds. + */ +DLLEXPORT size_t tj3YUVPlaneSize(int componentID, int width, int stride, + int height, int subsamp); + + +/** + * The plane width of a YUV image plane with the given parameters. Refer to + * @ref YUVnotes "YUV Image Format Notes" for a description of plane width. + * + * @param componentID ID number of the image plane (0 = Y, 1 = U/Cb, 2 = V/Cr) + * + * @param width width (in pixels) of the YUV image + * + * @param subsamp level of chrominance subsampling in the image (see + * @ref TJSAMP "Chrominance subsampling options".) + * + * @return the plane width of a YUV image plane with the given parameters, or 0 + * if the arguments are out of bounds. + */ +DLLEXPORT int tj3YUVPlaneWidth(int componentID, int width, int subsamp); + + +/** + * The plane height of a YUV image plane with the given parameters. Refer to + * @ref YUVnotes "YUV Image Format Notes" for a description of plane height. + * + * @param componentID ID number of the image plane (0 = Y, 1 = U/Cb, 2 = V/Cr) + * + * @param height height (in pixels) of the YUV image + * + * @param subsamp level of chrominance subsampling in the image (see + * @ref TJSAMP "Chrominance subsampling options".) + * + * @return the plane height of a YUV image plane with the given parameters, or + * 0 if the arguments are out of bounds. + */ +DLLEXPORT int tj3YUVPlaneHeight(int componentID, int height, int subsamp); + + +/** + * Compress an 8-bit-per-sample packed-pixel RGB, grayscale, or CMYK image into + * an 8-bit-per-sample JPEG image. + * + * @param handle handle to a TurboJPEG instance that has been initialized for + * compression + * + * @param srcBuf pointer to a buffer containing a packed-pixel RGB, grayscale, + * or CMYK source image to be compressed. This buffer should normally be + * `pitch * height` samples in size. However, you can also use this parameter + * to compress from a specific region of a larger buffer. + * + * @param width width (in pixels) of the source image + * + * @param pitch samples per row in the source image. Normally this should be + * width * #tjPixelSize[pixelFormat], if the image is unpadded. + * (Setting this parameter to 0 is the equivalent of setting it to + * width * #tjPixelSize[pixelFormat].) However, you can also use this + * parameter to specify the row alignment/padding of the source image, to skip + * rows, or to compress from a specific region of a larger buffer. + * + * @param height height (in pixels) of the source image + * + * @param pixelFormat pixel format of the source image (see @ref TJPF + * "Pixel formats".) + * + * @param jpegBuf address of a pointer to a byte buffer that will receive the + * JPEG image. TurboJPEG has the ability to reallocate the JPEG buffer to + * accommodate the size of the JPEG image. Thus, you can choose to: + * -# pre-allocate the JPEG buffer with an arbitrary size using #tj3Alloc() and + * let TurboJPEG grow the buffer as needed, + * -# set `*jpegBuf` to NULL to tell TurboJPEG to allocate the buffer for you, + * or + * -# pre-allocate the buffer to a "worst case" size determined by calling + * #tj3JPEGBufSize(). This should ensure that the buffer never has to be + * re-allocated. (Setting #TJPARAM_NOREALLOC guarantees that it won't be.) + * . + * If you choose option 1, then `*jpegSize` should be set to the size of your + * pre-allocated buffer. In any case, unless you have set #TJPARAM_NOREALLOC, + * you should always check `*jpegBuf` upon return from this function, as it may + * have changed. + * + * @param jpegSize pointer to a size_t variable that holds the size of the JPEG + * buffer. If `*jpegBuf` points to a pre-allocated buffer, then `*jpegSize` + * should be set to the size of the buffer. Upon return, `*jpegSize` will + * contain the size of the JPEG image (in bytes.) If `*jpegBuf` points to a + * JPEG buffer that is being reused from a previous call to one of the JPEG + * compression functions, then `*jpegSize` is ignored. + * + * @return 0 if successful, or -1 if an error occurred (see #tj3GetErrorStr() + * and #tj3GetErrorCode().) + */ +DLLEXPORT int tj3Compress8(tjhandle handle, const unsigned char *srcBuf, + int width, int pitch, int height, int pixelFormat, + unsigned char **jpegBuf, size_t *jpegSize); + +/** + * Compress a 12-bit-per-sample packed-pixel RGB, grayscale, or CMYK image into + * a 12-bit-per-sample JPEG image. + * + * \details \copydetails tj3Compress8() + */ +DLLEXPORT int tj3Compress12(tjhandle handle, const short *srcBuf, int width, + int pitch, int height, int pixelFormat, + unsigned char **jpegBuf, size_t *jpegSize); + +/** + * Compress a 16-bit-per-sample packed-pixel RGB, grayscale, or CMYK image into + * a 16-bit-per-sample lossless JPEG image. + * + * \details \copydetails tj3Compress8() + */ +DLLEXPORT int tj3Compress16(tjhandle handle, const unsigned short *srcBuf, + int width, int pitch, int height, int pixelFormat, + unsigned char **jpegBuf, size_t *jpegSize); + + +/** + * Compress a set of 8-bit-per-sample Y, U (Cb), and V (Cr) image planes into + * an 8-bit-per-sample JPEG image. + * + * @param handle handle to a TurboJPEG instance that has been initialized for + * compression + * + * @param srcPlanes an array of pointers to Y, U (Cb), and V (Cr) image planes + * (or just a Y plane, if compressing a grayscale image) that contain a YUV + * source image to be compressed. These planes can be contiguous or + * non-contiguous in memory. The size of each plane should match the value + * returned by #tj3YUVPlaneSize() for the given image width, height, strides, + * and level of chrominance subsampling (see #TJPARAM_SUBSAMP.) Refer to + * @ref YUVnotes "YUV Image Format Notes" for more details. + * + * @param width width (in pixels) of the source image. If the width is not an + * even multiple of the iMCU width (see #tjMCUWidth), then an intermediate + * buffer copy will be performed. + * + * @param strides an array of integers, each specifying the number of bytes per + * row in the corresponding plane of the YUV source image. Setting the stride + * for any plane to 0 is the same as setting it to the plane width (see + * @ref YUVnotes "YUV Image Format Notes".) If `strides` is NULL, then the + * strides for all planes will be set to their respective plane widths. You + * can adjust the strides in order to specify an arbitrary amount of row + * padding in each plane or to create a JPEG image from a subregion of a larger + * planar YUV image. + * + * @param height height (in pixels) of the source image. If the height is not + * an even multiple of the iMCU height (see #tjMCUHeight), then an intermediate + * buffer copy will be performed. + * + * @param jpegBuf address of a pointer to a byte buffer that will receive the + * JPEG image. TurboJPEG has the ability to reallocate the JPEG buffer to + * accommodate the size of the JPEG image. Thus, you can choose to: + * -# pre-allocate the JPEG buffer with an arbitrary size using #tj3Alloc() and + * let TurboJPEG grow the buffer as needed, + * -# set `*jpegBuf` to NULL to tell TurboJPEG to allocate the buffer for you, + * or + * -# pre-allocate the buffer to a "worst case" size determined by calling + * #tj3JPEGBufSize(). This should ensure that the buffer never has to be + * re-allocated. (Setting #TJPARAM_NOREALLOC guarantees that it won't be.) + * . + * If you choose option 1, then `*jpegSize` should be set to the size of your + * pre-allocated buffer. In any case, unless you have set #TJPARAM_NOREALLOC, + * you should always check `*jpegBuf` upon return from this function, as it may + * have changed. + * + * @param jpegSize pointer to a size_t variable that holds the size of the JPEG + * buffer. If `*jpegBuf` points to a pre-allocated buffer, then `*jpegSize` + * should be set to the size of the buffer. Upon return, `*jpegSize` will + * contain the size of the JPEG image (in bytes.) If `*jpegBuf` points to a + * JPEG buffer that is being reused from a previous call to one of the JPEG + * compression functions, then `*jpegSize` is ignored. + * + * @return 0 if successful, or -1 if an error occurred (see #tj3GetErrorStr() + * and #tj3GetErrorCode().) + */ +DLLEXPORT int tj3CompressFromYUVPlanes8(tjhandle handle, + const unsigned char * const *srcPlanes, + int width, const int *strides, + int height, unsigned char **jpegBuf, + size_t *jpegSize); + + +/** + * Compress an 8-bit-per-sample unified planar YUV image into an + * 8-bit-per-sample JPEG image. + * + * @param handle handle to a TurboJPEG instance that has been initialized for + * compression + * + * @param srcBuf pointer to a buffer containing a unified planar YUV source + * image to be compressed. The size of this buffer should match the value + * returned by #tj3YUVBufSize() for the given image width, height, row + * alignment, and level of chrominance subsampling (see #TJPARAM_SUBSAMP.) The + * Y, U (Cb), and V (Cr) image planes should be stored sequentially in the + * buffer. (Refer to @ref YUVnotes "YUV Image Format Notes".) + * + * @param width width (in pixels) of the source image. If the width is not an + * even multiple of the iMCU width (see #tjMCUWidth), then an intermediate + * buffer copy will be performed. + * + * @param align row alignment (in bytes) of the source image (must be a power + * of 2.) Setting this parameter to n indicates that each row in each plane of + * the source image is padded to the nearest multiple of n bytes + * (1 = unpadded.) + * + * @param height height (in pixels) of the source image. If the height is not + * an even multiple of the iMCU height (see #tjMCUHeight), then an intermediate + * buffer copy will be performed. + * + * @param jpegBuf address of a pointer to a byte buffer that will receive the + * JPEG image. TurboJPEG has the ability to reallocate the JPEG buffer to + * accommodate the size of the JPEG image. Thus, you can choose to: + * -# pre-allocate the JPEG buffer with an arbitrary size using #tj3Alloc() and + * let TurboJPEG grow the buffer as needed, + * -# set `*jpegBuf` to NULL to tell TurboJPEG to allocate the buffer for you, + * or + * -# pre-allocate the buffer to a "worst case" size determined by calling + * #tj3JPEGBufSize(). This should ensure that the buffer never has to be + * re-allocated. (Setting #TJPARAM_NOREALLOC guarantees that it won't be.) + * . + * If you choose option 1, then `*jpegSize` should be set to the size of your + * pre-allocated buffer. In any case, unless you have set #TJPARAM_NOREALLOC, + * you should always check `*jpegBuf` upon return from this function, as it may + * have changed. + * + * @param jpegSize pointer to a size_t variable that holds the size of the JPEG + * buffer. If `*jpegBuf` points to a pre-allocated buffer, then `*jpegSize` + * should be set to the size of the buffer. Upon return, `*jpegSize` will + * contain the size of the JPEG image (in bytes.) If `*jpegBuf` points to a + * JPEG buffer that is being reused from a previous call to one of the JPEG + * compression functions, then `*jpegSize` is ignored. + * + * @return 0 if successful, or -1 if an error occurred (see #tj3GetErrorStr() + * and #tj3GetErrorCode().) + */ +DLLEXPORT int tj3CompressFromYUV8(tjhandle handle, + const unsigned char *srcBuf, int width, + int align, int height, + unsigned char **jpegBuf, size_t *jpegSize); + + +/** + * Encode an 8-bit-per-sample packed-pixel RGB or grayscale image into separate + * 8-bit-per-sample Y, U (Cb), and V (Cr) image planes. This function performs + * color conversion (which is accelerated in the libjpeg-turbo implementation) + * but does not execute any of the other steps in the JPEG compression process. + * + * @param handle handle to a TurboJPEG instance that has been initialized for + * compression + * + * @param srcBuf pointer to a buffer containing a packed-pixel RGB or grayscale + * source image to be encoded. This buffer should normally be `pitch * height` + * bytes in size. However, you can also use this parameter to encode from a + * specific region of a larger buffer. + * + * + * @param width width (in pixels) of the source image + * + * @param pitch bytes per row in the source image. Normally this should be + * width * #tjPixelSize[pixelFormat], if the image is unpadded. + * (Setting this parameter to 0 is the equivalent of setting it to + * width * #tjPixelSize[pixelFormat].) However, you can also use this + * parameter to specify the row alignment/padding of the source image, to skip + * rows, or to encode from a specific region of a larger packed-pixel image. + * + * @param height height (in pixels) of the source image + * + * @param pixelFormat pixel format of the source image (see @ref TJPF + * "Pixel formats".) + * + * @param dstPlanes an array of pointers to Y, U (Cb), and V (Cr) image planes + * (or just a Y plane, if generating a grayscale image) that will receive the + * encoded image. These planes can be contiguous or non-contiguous in memory. + * Use #tj3YUVPlaneSize() to determine the appropriate size for each plane + * based on the image width, height, strides, and level of chrominance + * subsampling (see #TJPARAM_SUBSAMP.) Refer to @ref YUVnotes + * "YUV Image Format Notes" for more details. + * + * @param strides an array of integers, each specifying the number of bytes per + * row in the corresponding plane of the YUV image. Setting the stride for any + * plane to 0 is the same as setting it to the plane width (see @ref YUVnotes + * "YUV Image Format Notes".) If `strides` is NULL, then the strides for all + * planes will be set to their respective plane widths. You can adjust the + * strides in order to add an arbitrary amount of row padding to each plane or + * to encode an RGB or grayscale image into a subregion of a larger planar YUV + * image. + * + * @return 0 if successful, or -1 if an error occurred (see #tj3GetErrorStr() + * and #tj3GetErrorCode().) + */ +DLLEXPORT int tj3EncodeYUVPlanes8(tjhandle handle, const unsigned char *srcBuf, + int width, int pitch, int height, + int pixelFormat, unsigned char **dstPlanes, + int *strides); + + +/** + * Encode an 8-bit-per-sample packed-pixel RGB or grayscale image into an + * 8-bit-per-sample unified planar YUV image. This function performs color + * conversion (which is accelerated in the libjpeg-turbo implementation) but + * does not execute any of the other steps in the JPEG compression process. + * + * @param handle handle to a TurboJPEG instance that has been initialized for + * compression + * + * @param srcBuf pointer to a buffer containing a packed-pixel RGB or grayscale + * source image to be encoded. This buffer should normally be `pitch * height` + * bytes in size. However, you can also use this parameter to encode from a + * specific region of a larger buffer. + * + * @param width width (in pixels) of the source image + * + * @param pitch bytes per row in the source image. Normally this should be + * width * #tjPixelSize[pixelFormat], if the image is unpadded. + * (Setting this parameter to 0 is the equivalent of setting it to + * width * #tjPixelSize[pixelFormat].) However, you can also use this + * parameter to specify the row alignment/padding of the source image, to skip + * rows, or to encode from a specific region of a larger packed-pixel image. + * + * @param height height (in pixels) of the source image + * + * @param pixelFormat pixel format of the source image (see @ref TJPF + * "Pixel formats".) + * + * @param dstBuf pointer to a buffer that will receive the unified planar YUV + * image. Use #tj3YUVBufSize() to determine the appropriate size for this + * buffer based on the image width, height, row alignment, and level of + * chrominance subsampling (see #TJPARAM_SUBSAMP.) The Y, U (Cb), and V (Cr) + * image planes will be stored sequentially in the buffer. (Refer to + * @ref YUVnotes "YUV Image Format Notes".) + * + * @param align row alignment (in bytes) of the YUV image (must be a power of + * 2.) Setting this parameter to n will cause each row in each plane of the + * YUV image to be padded to the nearest multiple of n bytes (1 = unpadded.) + * To generate images suitable for X Video, `align` should be set to 4. + * + * @return 0 if successful, or -1 if an error occurred (see #tj3GetErrorStr() + * and #tj3GetErrorCode().) + */ +DLLEXPORT int tj3EncodeYUV8(tjhandle handle, const unsigned char *srcBuf, + int width, int pitch, int height, int pixelFormat, + unsigned char *dstBuf, int align); + + +/** + * Retrieve information about a JPEG image without decompressing it, or prime + * the decompressor with quantization and Huffman tables. If a JPEG image is + * passed to this function, then the @ref TJPARAM "parameters" that describe + * the JPEG image will be set when the function returns. + * + * @param handle handle to a TurboJPEG instance that has been initialized for + * decompression + * + * @param jpegBuf pointer to a byte buffer containing a JPEG image or an + * "abbreviated table specification" (AKA "tables-only") datastream. Passing a + * tables-only datastream to this function primes the decompressor with + * quantization and Huffman tables that can be used when decompressing + * subsequent "abbreviated image" datastreams. This is useful, for instance, + * when decompressing video streams in which all frames share the same + * quantization and Huffman tables. + * + * @param jpegSize size of the JPEG image or tables-only datastream (in bytes) + * + * @return 0 if successful, or -1 if an error occurred (see #tj3GetErrorStr() + * and #tj3GetErrorCode().) + */ +DLLEXPORT int tj3DecompressHeader(tjhandle handle, + const unsigned char *jpegBuf, + size_t jpegSize); + + +/** + * Returns a list of fractional scaling factors that the JPEG decompressor + * supports. + * + * @param numScalingFactors pointer to an integer variable that will receive + * the number of elements in the list + * + * @return a pointer to a list of fractional scaling factors, or NULL if an + * error is encountered (see #tj3GetErrorStr().) + */ +DLLEXPORT tjscalingfactor *tj3GetScalingFactors(int *numScalingFactors); + + +/** + * Set the scaling factor for subsequent lossy decompression operations. + * + * @param handle handle to a TurboJPEG instance that has been initialized for + * decompression + * + * @param scalingFactor #tjscalingfactor structure that specifies a fractional + * scaling factor that the decompressor supports (see #tj3GetScalingFactors()), + * or #TJUNSCALED for no scaling. Decompression scaling is a function + * of the IDCT algorithm, so scaling factors are generally limited to multiples + * of 1/8. If the entire JPEG image will be decompressed, then the width and + * height of the scaled destination image can be determined by calling + * #TJSCALED() with the JPEG width and height (see #TJPARAM_JPEGWIDTH and + * #TJPARAM_JPEGHEIGHT) and the specified scaling factor. When decompressing + * into a planar YUV image, an intermediate buffer copy will be performed if + * the width or height of the scaled destination image is not an even multiple + * of the iMCU size (see #tjMCUWidth and #tjMCUHeight.) Note that + * decompression scaling is not available (and the specified scaling factor is + * ignored) when decompressing lossless JPEG images (see #TJPARAM_LOSSLESS), + * since the IDCT algorithm is not used with those images. Note also that + * #TJPARAM_FASTDCT is ignored when decompression scaling is enabled. + * + * @return 0 if successful, or -1 if an error occurred (see #tj3GetErrorStr().) + */ +DLLEXPORT int tj3SetScalingFactor(tjhandle handle, + tjscalingfactor scalingFactor); + + +/** + * Set the cropping region for partially decompressing a lossy JPEG image into + * a packed-pixel image + * + * @param handle handle to a TurboJPEG instance that has been initialized for + * decompression + * + * @param croppingRegion #tjregion structure that specifies a subregion of the + * JPEG image to decompress, or #TJUNCROPPED for no cropping. The + * left boundary of the cropping region must be evenly divisible by the scaled + * iMCU width-- #TJSCALED(#tjMCUWidth[subsamp], scalingFactor), where + * `subsamp` is the level of chrominance subsampling in the JPEG image (see + * #TJPARAM_SUBSAMP) and `scalingFactor` is the decompression scaling factor + * (see #tj3SetScalingFactor().) The cropping region should be specified + * relative to the scaled image dimensions. Unless `croppingRegion` is + * #TJUNCROPPED, the JPEG header must be read (see + * #tj3DecompressHeader()) prior to calling this function. + * + * @return 0 if successful, or -1 if an error occurred (see #tj3GetErrorStr().) + */ +DLLEXPORT int tj3SetCroppingRegion(tjhandle handle, tjregion croppingRegion); + + +/** + * Decompress an 8-bit-per-sample JPEG image into an 8-bit-per-sample + * packed-pixel RGB, grayscale, or CMYK image. The @ref TJPARAM "parameters" + * that describe the JPEG image will be set when this function returns. + * + * @param handle handle to a TurboJPEG instance that has been initialized for + * decompression + * + * @param jpegBuf pointer to a byte buffer containing the JPEG image to + * decompress + * + * @param jpegSize size of the JPEG image (in bytes) + * + * @param dstBuf pointer to a buffer that will receive the packed-pixel + * decompressed image. This buffer should normally be + * `pitch * destinationHeight` samples in size. However, you can also use this + * parameter to decompress into a specific region of a larger buffer. NOTE: + * If the JPEG image is lossy, then `destinationHeight` is either the scaled + * JPEG height (see #TJSCALED(), #TJPARAM_JPEGHEIGHT, and + * #tj3SetScalingFactor()) or the height of the cropping region (see + * #tj3SetCroppingRegion().) If the JPEG image is lossless, then + * `destinationHeight` is the JPEG height. + * + * @param pitch samples per row in the destination image. Normally this should + * be set to destinationWidth * #tjPixelSize[pixelFormat], if the + * destination image should be unpadded. (Setting this parameter to 0 is the + * equivalent of setting it to + * destinationWidth * #tjPixelSize[pixelFormat].) However, you can + * also use this parameter to specify the row alignment/padding of the + * destination image, to skip rows, or to decompress into a specific region of + * a larger buffer. NOTE: If the JPEG image is lossy, then `destinationWidth` + * is either the scaled JPEG width (see #TJSCALED(), #TJPARAM_JPEGWIDTH, and + * #tj3SetScalingFactor()) or the width of the cropping region (see + * #tj3SetCroppingRegion().) If the JPEG image is lossless, then + * `destinationWidth` is the JPEG width. + * + * @param pixelFormat pixel format of the destination image (see @ref + * TJPF "Pixel formats".) + * + * @return 0 if successful, or -1 if an error occurred (see #tj3GetErrorStr() + * and #tj3GetErrorCode().) + */ +DLLEXPORT int tj3Decompress8(tjhandle handle, const unsigned char *jpegBuf, + size_t jpegSize, unsigned char *dstBuf, int pitch, + int pixelFormat); + +/** + * Decompress a 12-bit-per-sample JPEG image into a 12-bit-per-sample + * packed-pixel RGB, grayscale, or CMYK image. + * + * \details \copydetails tj3Decompress8() + */ +DLLEXPORT int tj3Decompress12(tjhandle handle, const unsigned char *jpegBuf, + size_t jpegSize, short *dstBuf, int pitch, + int pixelFormat); + +/** + * Decompress a 16-bit-per-sample lossless JPEG image into a 16-bit-per-sample + * packed-pixel RGB, grayscale, or CMYK image. + * + * \details \copydetails tj3Decompress8() + */ +DLLEXPORT int tj3Decompress16(tjhandle handle, const unsigned char *jpegBuf, + size_t jpegSize, unsigned short *dstBuf, + int pitch, int pixelFormat); + + +/** + * Decompress an 8-bit-per-sample JPEG image into separate 8-bit-per-sample Y, + * U (Cb), and V (Cr) image planes. This function performs JPEG decompression + * but leaves out the color conversion step, so a planar YUV image is generated + * instead of a packed-pixel image. The @ref TJPARAM "parameters" that + * describe the JPEG image will be set when this function returns. + * + * @param handle handle to a TurboJPEG instance that has been initialized for + * decompression + * + * @param jpegBuf pointer to a byte buffer containing the JPEG image to + * decompress + * + * @param jpegSize size of the JPEG image (in bytes) + * + * @param dstPlanes an array of pointers to Y, U (Cb), and V (Cr) image planes + * (or just a Y plane, if decompressing a grayscale image) that will receive + * the decompressed image. These planes can be contiguous or non-contiguous in + * memory. Use #tj3YUVPlaneSize() to determine the appropriate size for each + * plane based on the scaled JPEG width and height (see #TJSCALED(), + * #TJPARAM_JPEGWIDTH, #TJPARAM_JPEGHEIGHT, and #tj3SetScalingFactor()), + * strides, and level of chrominance subsampling (see #TJPARAM_SUBSAMP.) Refer + * to @ref YUVnotes "YUV Image Format Notes" for more details. + * + * @param strides an array of integers, each specifying the number of bytes per + * row in the corresponding plane of the YUV image. Setting the stride for any + * plane to 0 is the same as setting it to the scaled plane width (see + * @ref YUVnotes "YUV Image Format Notes".) If `strides` is NULL, then the + * strides for all planes will be set to their respective scaled plane widths. + * You can adjust the strides in order to add an arbitrary amount of row + * padding to each plane or to decompress the JPEG image into a subregion of a + * larger planar YUV image. + * + * @return 0 if successful, or -1 if an error occurred (see #tj3GetErrorStr() + * and #tj3GetErrorCode().) + */ +DLLEXPORT int tj3DecompressToYUVPlanes8(tjhandle handle, + const unsigned char *jpegBuf, + size_t jpegSize, + unsigned char **dstPlanes, + int *strides); + + +/** + * Decompress an 8-bit-per-sample JPEG image into an 8-bit-per-sample unified + * planar YUV image. This function performs JPEG decompression but leaves out + * the color conversion step, so a planar YUV image is generated instead of a + * packed-pixel image. The @ref TJPARAM "parameters" that describe the JPEG + * image will be set when this function returns. + * + * @param handle handle to a TurboJPEG instance that has been initialized for + * decompression + * + * @param jpegBuf pointer to a byte buffer containing the JPEG image to + * decompress + * + * @param jpegSize size of the JPEG image (in bytes) + * + * @param dstBuf pointer to a buffer that will receive the unified planar YUV + * decompressed image. Use #tj3YUVBufSize() to determine the appropriate size + * for this buffer based on the scaled JPEG width and height (see #TJSCALED(), + * #TJPARAM_JPEGWIDTH, #TJPARAM_JPEGHEIGHT, and #tj3SetScalingFactor()), row + * alignment, and level of chrominance subsampling (see #TJPARAM_SUBSAMP.) The + * Y, U (Cb), and V (Cr) image planes will be stored sequentially in the + * buffer. (Refer to @ref YUVnotes "YUV Image Format Notes".) + * + * @param align row alignment (in bytes) of the YUV image (must be a power of + * 2.) Setting this parameter to n will cause each row in each plane of the + * YUV image to be padded to the nearest multiple of n bytes (1 = unpadded.) + * To generate images suitable for X Video, `align` should be set to 4. + * + * @return 0 if successful, or -1 if an error occurred (see #tj3GetErrorStr() + * and #tj3GetErrorCode().) + */ +DLLEXPORT int tj3DecompressToYUV8(tjhandle handle, + const unsigned char *jpegBuf, + size_t jpegSize, + unsigned char *dstBuf, int align); + + +/** + * Decode a set of 8-bit-per-sample Y, U (Cb), and V (Cr) image planes into an + * 8-bit-per-sample packed-pixel RGB or grayscale image. This function + * performs color conversion (which is accelerated in the libjpeg-turbo + * implementation) but does not execute any of the other steps in the JPEG + * decompression process. + * + * @param handle handle to a TurboJPEG instance that has been initialized for + * decompression + * + * @param srcPlanes an array of pointers to Y, U (Cb), and V (Cr) image planes + * (or just a Y plane, if decoding a grayscale image) that contain a YUV image + * to be decoded. These planes can be contiguous or non-contiguous in memory. + * The size of each plane should match the value returned by #tj3YUVPlaneSize() + * for the given image width, height, strides, and level of chrominance + * subsampling (see #TJPARAM_SUBSAMP.) Refer to @ref YUVnotes + * "YUV Image Format Notes" for more details. + * + * @param strides an array of integers, each specifying the number of bytes per + * row in the corresponding plane of the YUV source image. Setting the stride + * for any plane to 0 is the same as setting it to the plane width (see + * @ref YUVnotes "YUV Image Format Notes".) If `strides` is NULL, then the + * strides for all planes will be set to their respective plane widths. You + * can adjust the strides in order to specify an arbitrary amount of row + * padding in each plane or to decode a subregion of a larger planar YUV image. + * + * @param dstBuf pointer to a buffer that will receive the packed-pixel decoded + * image. This buffer should normally be `pitch * height` bytes in size. + * However, you can also use this parameter to decode into a specific region of + * a larger buffer. + * + * @param width width (in pixels) of the source and destination images + * + * @param pitch bytes per row in the destination image. Normally this should + * be set to width * #tjPixelSize[pixelFormat], if the destination + * image should be unpadded. (Setting this parameter to 0 is the equivalent of + * setting it to width * #tjPixelSize[pixelFormat].) However, you can + * also use this parameter to specify the row alignment/padding of the + * destination image, to skip rows, or to decode into a specific region of a + * larger buffer. + * + * @param height height (in pixels) of the source and destination images + * + * @param pixelFormat pixel format of the destination image (see @ref TJPF + * "Pixel formats".) + * + * @return 0 if successful, or -1 if an error occurred (see #tj3GetErrorStr() + * and #tj3GetErrorCode().) + */ +DLLEXPORT int tj3DecodeYUVPlanes8(tjhandle handle, + const unsigned char * const *srcPlanes, + const int *strides, unsigned char *dstBuf, + int width, int pitch, int height, + int pixelFormat); + + +/** + * Decode an 8-bit-per-sample unified planar YUV image into an 8-bit-per-sample + * packed-pixel RGB or grayscale image. This function performs color + * conversion (which is accelerated in the libjpeg-turbo implementation) but + * does not execute any of the other steps in the JPEG decompression process. + * + * @param handle handle to a TurboJPEG instance that has been initialized for + * decompression + * + * @param srcBuf pointer to a buffer containing a unified planar YUV source + * image to be decoded. The size of this buffer should match the value + * returned by #tj3YUVBufSize() for the given image width, height, row + * alignment, and level of chrominance subsampling (see #TJPARAM_SUBSAMP.) The + * Y, U (Cb), and V (Cr) image planes should be stored sequentially in the + * source buffer. (Refer to @ref YUVnotes "YUV Image Format Notes".) + * + * @param align row alignment (in bytes) of the YUV source image (must be a + * power of 2.) Setting this parameter to n indicates that each row in each + * plane of the YUV source image is padded to the nearest multiple of n bytes + * (1 = unpadded.) + * + * @param dstBuf pointer to a buffer that will receive the packed-pixel decoded + * image. This buffer should normally be `pitch * height` bytes in size. + * However, you can also use this parameter to decode into a specific region of + * a larger buffer. + * + * @param width width (in pixels) of the source and destination images + * + * @param pitch bytes per row in the destination image. Normally this should + * be set to width * #tjPixelSize[pixelFormat], if the destination + * image should be unpadded. (Setting this parameter to 0 is the equivalent of + * setting it to width * #tjPixelSize[pixelFormat].) However, you can + * also use this parameter to specify the row alignment/padding of the + * destination image, to skip rows, or to decode into a specific region of a + * larger buffer. + * + * @param height height (in pixels) of the source and destination images + * + * @param pixelFormat pixel format of the destination image (see @ref TJPF + * "Pixel formats".) + * + * @return 0 if successful, or -1 if an error occurred (see #tj3GetErrorStr() + * and #tj3GetErrorCode().) + */ +DLLEXPORT int tj3DecodeYUV8(tjhandle handle, const unsigned char *srcBuf, + int align, unsigned char *dstBuf, int width, + int pitch, int height, int pixelFormat); + + +/** + * Losslessly transform a JPEG image into another JPEG image. Lossless + * transforms work by moving the raw DCT coefficients from one JPEG image + * structure to another without altering the values of the coefficients. While + * this is typically faster than decompressing the image, transforming it, and + * re-compressing it, lossless transforms are not free. Each lossless + * transform requires reading and performing entropy decoding on all of the + * coefficients in the source image, regardless of the size of the destination + * image. Thus, this function provides a means of generating multiple + * transformed images from the same source or applying multiple transformations + * simultaneously, in order to eliminate the need to read the source + * coefficients multiple times. + * + * @param handle handle to a TurboJPEG instance that has been initialized for + * lossless transformation + * + * @param jpegBuf pointer to a byte buffer containing the JPEG source image to + * transform + * + * @param jpegSize size of the JPEG source image (in bytes) + * + * @param n the number of transformed JPEG images to generate + * + * @param dstBufs pointer to an array of n byte buffers. `dstBufs[i]` will + * receive a JPEG image that has been transformed using the parameters in + * `transforms[i]`. TurboJPEG has the ability to reallocate the JPEG + * destination buffer to accommodate the size of the transformed JPEG image. + * Thus, you can choose to: + * -# pre-allocate the JPEG destination buffer with an arbitrary size using + * #tj3Alloc() and let TurboJPEG grow the buffer as needed, + * -# set `dstBufs[i]` to NULL to tell TurboJPEG to allocate the buffer for + * you, or + * -# pre-allocate the buffer to a "worst case" size determined by calling + * #tj3JPEGBufSize() with the transformed or cropped width and height and the + * level of subsampling used in the destination image (taking into account + * grayscale conversion and transposition of the width and height.) Under + * normal circumstances, this should ensure that the buffer never has to be + * re-allocated. (Setting #TJPARAM_NOREALLOC guarantees that it won't be.) + * Note, however, that there are some rare cases (such as transforming images + * with a large amount of embedded Exif or ICC profile data) in which the + * transformed JPEG image will be larger than the worst-case size, and + * #TJPARAM_NOREALLOC cannot be used in those cases unless the embedded data is + * discarded using #TJXOPT_COPYNONE. + * . + * If you choose option 1, then `dstSizes[i]` should be set to the size of your + * pre-allocated buffer. In any case, unless you have set #TJPARAM_NOREALLOC, + * you should always check `dstBufs[i]` upon return from this function, as it + * may have changed. + * + * @param dstSizes pointer to an array of n size_t variables that will receive + * the actual sizes (in bytes) of each transformed JPEG image. If `dstBufs[i]` + * points to a pre-allocated buffer, then `dstSizes[i]` should be set to the + * size of the buffer. Upon return, `dstSizes[i]` will contain the size of the + * transformed JPEG image (in bytes.) + * + * @param transforms pointer to an array of n #tjtransform structures, each of + * which specifies the transform parameters and/or cropping region for the + * corresponding transformed JPEG image. + * + * @return 0 if successful, or -1 if an error occurred (see #tj3GetErrorStr() + * and #tj3GetErrorCode().) + */ +DLLEXPORT int tj3Transform(tjhandle handle, const unsigned char *jpegBuf, + size_t jpegSize, int n, unsigned char **dstBufs, + size_t *dstSizes, const tjtransform *transforms); + + +/** + * Load an 8-bit-per-sample packed-pixel image from disk into memory. + * + * @param handle handle to a TurboJPEG instance + * + * @param filename name of a file containing a packed-pixel image in Windows + * BMP or PBMPLUS (PPM/PGM) format. Windows BMP files require 8-bit-per-sample + * data precision. If the data precision of the PBMPLUS file does not match + * the target data precision, then upconverting or downconverting will be + * performed. + * + * @param width pointer to an integer variable that will receive the width (in + * pixels) of the packed-pixel image + * + * @param align row alignment (in samples) of the packed-pixel buffer to be + * returned (must be a power of 2.) Setting this parameter to n will cause all + * rows in the buffer to be padded to the nearest multiple of n samples + * (1 = unpadded.) + * + * @param height pointer to an integer variable that will receive the height + * (in pixels) of the packed-pixel image + * + * @param pixelFormat pointer to an integer variable that specifies or will + * receive the pixel format of the packed-pixel buffer. The behavior of this + * function varies depending on the value of `*pixelFormat` passed to the + * function: + * - @ref TJPF_UNKNOWN : The packed-pixel buffer returned by this function will + * use the most optimal pixel format for the file type, and `*pixelFormat` will + * contain the ID of that pixel format upon successful return from this + * function. + * - @ref TJPF_GRAY : Only PGM files and 8-bit-per-pixel BMP files with a + * grayscale colormap can be loaded. + * - @ref TJPF_CMYK : The RGB or grayscale pixels stored in the file will be + * converted using a quick & dirty algorithm that is suitable only for testing + * purposes. (Proper conversion between CMYK and other formats requires a + * color management system.) + * - Other @ref TJPF "pixel formats" : The packed-pixel buffer will use the + * specified pixel format, and pixel format conversion will be performed if + * necessary. + * + * @return a pointer to a newly-allocated buffer containing the packed-pixel + * image, converted to the chosen pixel format and with the chosen row + * alignment, or NULL if an error occurred (see #tj3GetErrorStr().) This + * buffer should be freed using #tj3Free(). + */ +DLLEXPORT unsigned char *tj3LoadImage8(tjhandle handle, const char *filename, + int *width, int align, int *height, + int *pixelFormat); + +/** + * Load a 12-bit-per-sample packed-pixel image from disk into memory. + * + * \details \copydetails tj3LoadImage8() + */ +DLLEXPORT short *tj3LoadImage12(tjhandle handle, const char *filename, + int *width, int align, int *height, + int *pixelFormat); + +/** + * Load a 16-bit-per-sample packed-pixel image from disk into memory. + * + * \details \copydetails tj3LoadImage8() + */ +DLLEXPORT unsigned short *tj3LoadImage16(tjhandle handle, const char *filename, + int *width, int align, int *height, + int *pixelFormat); + + +/** + * Save an 8-bit-per-sample packed-pixel image from memory to disk. + * + * @param handle handle to a TurboJPEG instance + * + * @param filename name of a file to which to save the packed-pixel image. The + * image will be stored in Windows BMP or PBMPLUS (PPM/PGM) format, depending + * on the file extension. Windows BMP files require 8-bit-per-sample data + * precision. + * + * @param buffer pointer to a buffer containing a packed-pixel RGB, grayscale, + * or CMYK image to be saved + * + * @param width width (in pixels) of the packed-pixel image + * + * @param pitch samples per row in the packed-pixel image. Setting this + * parameter to 0 is the equivalent of setting it to + * width * #tjPixelSize[pixelFormat]. + * + * @param height height (in pixels) of the packed-pixel image + * + * @param pixelFormat pixel format of the packed-pixel image (see @ref TJPF + * "Pixel formats".) If this parameter is set to @ref TJPF_GRAY, then the + * image will be stored in PGM or 8-bit-per-pixel (indexed color) BMP format. + * Otherwise, the image will be stored in PPM or 24-bit-per-pixel BMP format. + * If this parameter is set to @ref TJPF_CMYK, then the CMYK pixels will be + * converted to RGB using a quick & dirty algorithm that is suitable only for + * testing purposes. (Proper conversion between CMYK and other formats + * requires a color management system.) + * + * @return 0 if successful, or -1 if an error occurred (see #tj3GetErrorStr().) + */ +DLLEXPORT int tj3SaveImage8(tjhandle handle, const char *filename, + const unsigned char *buffer, int width, int pitch, + int height, int pixelFormat); + +/** + * Save a 12-bit-per-sample packed-pixel image from memory to disk. + * + * \details \copydetails tj3SaveImage8() + */ +DLLEXPORT int tj3SaveImage12(tjhandle handle, const char *filename, + const short *buffer, int width, int pitch, + int height, int pixelFormat); + +/** + * Save a 16-bit-per-sample packed-pixel image from memory to disk. + * + * \details \copydetails tj3SaveImage8() + */ +DLLEXPORT int tj3SaveImage16(tjhandle handle, const char *filename, + const unsigned short *buffer, int width, + int pitch, int height, int pixelFormat); + + +/* Backward compatibility functions and macros (nothing to see here) */ + +/* TurboJPEG 1.0+ */ + +#define NUMSUBOPT TJ_NUMSAMP +#define TJ_444 TJSAMP_444 +#define TJ_422 TJSAMP_422 +#define TJ_420 TJSAMP_420 +#define TJ_411 TJSAMP_420 +#define TJ_GRAYSCALE TJSAMP_GRAY + +#define TJ_BGR 1 +#define TJ_BOTTOMUP TJFLAG_BOTTOMUP +#define TJ_FORCEMMX TJFLAG_FORCEMMX +#define TJ_FORCESSE TJFLAG_FORCESSE +#define TJ_FORCESSE2 TJFLAG_FORCESSE2 +#define TJ_ALPHAFIRST 64 +#define TJ_FORCESSE3 TJFLAG_FORCESSE3 +#define TJ_FASTUPSAMPLE TJFLAG_FASTUPSAMPLE + +#define TJPAD(width) (((width) + 3) & (~3)) + +DLLEXPORT unsigned long TJBUFSIZE(int width, int height); + +DLLEXPORT int tjCompress(tjhandle handle, unsigned char *srcBuf, int width, + int pitch, int height, int pixelSize, + unsigned char *dstBuf, unsigned long *compressedSize, + int jpegSubsamp, int jpegQual, int flags); + +DLLEXPORT int tjDecompress(tjhandle handle, unsigned char *jpegBuf, + unsigned long jpegSize, unsigned char *dstBuf, + int width, int pitch, int height, int pixelSize, + int flags); + +DLLEXPORT int tjDecompressHeader(tjhandle handle, unsigned char *jpegBuf, + unsigned long jpegSize, int *width, + int *height); + +DLLEXPORT int tjDestroy(tjhandle handle); + +DLLEXPORT char *tjGetErrorStr(void); + +DLLEXPORT tjhandle tjInitCompress(void); + +DLLEXPORT tjhandle tjInitDecompress(void); + +/* TurboJPEG 1.1+ */ + +#define TJ_YUV 512 + +DLLEXPORT unsigned long TJBUFSIZEYUV(int width, int height, int jpegSubsamp); + +DLLEXPORT int tjDecompressHeader2(tjhandle handle, unsigned char *jpegBuf, + unsigned long jpegSize, int *width, + int *height, int *jpegSubsamp); + +DLLEXPORT int tjDecompressToYUV(tjhandle handle, unsigned char *jpegBuf, + unsigned long jpegSize, unsigned char *dstBuf, + int flags); + +DLLEXPORT int tjEncodeYUV(tjhandle handle, unsigned char *srcBuf, int width, + int pitch, int height, int pixelSize, + unsigned char *dstBuf, int subsamp, int flags); + +/* TurboJPEG 1.2+ */ + +#define TJFLAG_BOTTOMUP 2 +#define TJFLAG_FORCEMMX 8 +#define TJFLAG_FORCESSE 16 +#define TJFLAG_FORCESSE2 32 +#define TJFLAG_FORCESSE3 128 +#define TJFLAG_FASTUPSAMPLE 256 +#define TJFLAG_NOREALLOC 1024 + +DLLEXPORT unsigned char *tjAlloc(int bytes); + +DLLEXPORT unsigned long tjBufSize(int width, int height, int jpegSubsamp); + +DLLEXPORT unsigned long tjBufSizeYUV(int width, int height, int subsamp); + +DLLEXPORT int tjCompress2(tjhandle handle, const unsigned char *srcBuf, + int width, int pitch, int height, int pixelFormat, + unsigned char **jpegBuf, unsigned long *jpegSize, + int jpegSubsamp, int jpegQual, int flags); + +DLLEXPORT int tjDecompress2(tjhandle handle, const unsigned char *jpegBuf, + unsigned long jpegSize, unsigned char *dstBuf, + int width, int pitch, int height, int pixelFormat, + int flags); + +DLLEXPORT int tjEncodeYUV2(tjhandle handle, unsigned char *srcBuf, int width, + int pitch, int height, int pixelFormat, + unsigned char *dstBuf, int subsamp, int flags); + +DLLEXPORT void tjFree(unsigned char *buffer); + +DLLEXPORT tjscalingfactor *tjGetScalingFactors(int *numscalingfactors); + +DLLEXPORT tjhandle tjInitTransform(void); + +DLLEXPORT int tjTransform(tjhandle handle, const unsigned char *jpegBuf, + unsigned long jpegSize, int n, + unsigned char **dstBufs, unsigned long *dstSizes, + tjtransform *transforms, int flags); + +/* TurboJPEG 1.2.1+ */ + +#define TJFLAG_FASTDCT 2048 +#define TJFLAG_ACCURATEDCT 4096 + +/* TurboJPEG 1.4+ */ + +DLLEXPORT unsigned long tjBufSizeYUV2(int width, int align, int height, + int subsamp); + +DLLEXPORT int tjCompressFromYUV(tjhandle handle, const unsigned char *srcBuf, + int width, int align, int height, int subsamp, + unsigned char **jpegBuf, + unsigned long *jpegSize, int jpegQual, + int flags); + +DLLEXPORT int tjCompressFromYUVPlanes(tjhandle handle, + const unsigned char **srcPlanes, + int width, const int *strides, + int height, int subsamp, + unsigned char **jpegBuf, + unsigned long *jpegSize, int jpegQual, + int flags); + +DLLEXPORT int tjDecodeYUV(tjhandle handle, const unsigned char *srcBuf, + int align, int subsamp, unsigned char *dstBuf, + int width, int pitch, int height, int pixelFormat, + int flags); + +DLLEXPORT int tjDecodeYUVPlanes(tjhandle handle, + const unsigned char **srcPlanes, + const int *strides, int subsamp, + unsigned char *dstBuf, int width, int pitch, + int height, int pixelFormat, int flags); + +DLLEXPORT int tjDecompressHeader3(tjhandle handle, + const unsigned char *jpegBuf, + unsigned long jpegSize, int *width, + int *height, int *jpegSubsamp, + int *jpegColorspace); + +DLLEXPORT int tjDecompressToYUV2(tjhandle handle, const unsigned char *jpegBuf, + unsigned long jpegSize, unsigned char *dstBuf, + int width, int align, int height, int flags); + +DLLEXPORT int tjDecompressToYUVPlanes(tjhandle handle, + const unsigned char *jpegBuf, + unsigned long jpegSize, + unsigned char **dstPlanes, int width, + int *strides, int height, int flags); + +DLLEXPORT int tjEncodeYUV3(tjhandle handle, const unsigned char *srcBuf, + int width, int pitch, int height, int pixelFormat, + unsigned char *dstBuf, int align, int subsamp, + int flags); + +DLLEXPORT int tjEncodeYUVPlanes(tjhandle handle, const unsigned char *srcBuf, + int width, int pitch, int height, + int pixelFormat, unsigned char **dstPlanes, + int *strides, int subsamp, int flags); + +DLLEXPORT int tjPlaneHeight(int componentID, int height, int subsamp); + +DLLEXPORT unsigned long tjPlaneSizeYUV(int componentID, int width, int stride, + int height, int subsamp); + +DLLEXPORT int tjPlaneWidth(int componentID, int width, int subsamp); + +/* TurboJPEG 2.0+ */ + +#define TJFLAG_STOPONWARNING 8192 +#define TJFLAG_PROGRESSIVE 16384 + +DLLEXPORT int tjGetErrorCode(tjhandle handle); + +DLLEXPORT char *tjGetErrorStr2(tjhandle handle); + +DLLEXPORT unsigned char *tjLoadImage(const char *filename, int *width, + int align, int *height, int *pixelFormat, + int flags); + +DLLEXPORT int tjSaveImage(const char *filename, unsigned char *buffer, + int width, int pitch, int height, int pixelFormat, + int flags); + +/* TurboJPEG 2.1+ */ + +#define TJFLAG_LIMITSCANS 32768 + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/ANSGpuConvert.h b/include/ANSGpuConvert.h new file mode 100644 index 0000000..087ceb2 --- /dev/null +++ b/include/ANSGpuConvert.h @@ -0,0 +1,59 @@ +#pragma once +// ANSGpuConvert.h — Cross-DLL GPU NV12→BGR conversion. +// +// ANSODEngine.dll exports ANSGpuNV12ToBGR() (defined in nv12_to_rgb.cu). +// This header provides gpu_nv12_to_bgr() which resolves that export at runtime +// via GetProcAddress — no link dependency on ANSODEngine.lib needed. +// +// Usage in video_player.cpp: +// #include "ANSGpuConvert.h" +// int rc = gpu_nv12_to_bgr(yPlane, yLinesize, uvPlane, uvLinesize, +// bgrOut, bgrStep, width, height, gpuIndex); +// if (rc != 0) { /* fallback to CPU */ } + +#include + +#ifdef _WIN32 +#define WIN32_LEAN_AND_MEAN +#define NOMINMAX +#include +#endif + +// Function signature matching ANSGpuNV12ToBGR export in nv12_to_rgb.cu +typedef int (*ANSGpuNV12ToBGR_Fn)( + const uint8_t* yPlane, int yLinesize, + const uint8_t* uvPlane, int uvLinesize, + uint8_t* bgrOut, int bgrStep, + int width, int height, int gpuIndex); + +// Resolve ANSGpuNV12ToBGR from ANSODEngine.dll at runtime. +// Returns nullptr if ANSODEngine.dll is not loaded or export not found. +inline ANSGpuNV12ToBGR_Fn resolve_gpu_nv12_to_bgr() { +#ifdef _WIN32 + static ANSGpuNV12ToBGR_Fn s_fn = nullptr; + static bool s_tried = false; + if (!s_tried) { + s_tried = true; + HMODULE hMod = GetModuleHandleA("ANSODEngine.dll"); + if (hMod) { + s_fn = reinterpret_cast( + GetProcAddress(hMod, "ANSGpuNV12ToBGR")); + } + } + return s_fn; +#else + return nullptr; +#endif +} + +// Convenience wrapper. Returns 0 on success, negative on error, 1 if not available. +inline int gpu_nv12_to_bgr( + const uint8_t* yPlane, int yLinesize, + const uint8_t* uvPlane, int uvLinesize, + uint8_t* bgrOut, int bgrStep, + int width, int height, int gpuIndex = 0) +{ + auto fn = resolve_gpu_nv12_to_bgr(); + if (!fn) return 1; // ANSODEngine not loaded — caller should use CPU fallback + return fn(yPlane, yLinesize, uvPlane, uvLinesize, bgrOut, bgrStep, width, height, gpuIndex); +} diff --git a/include/ANSGpuFrameRegistry.h b/include/ANSGpuFrameRegistry.h new file mode 100644 index 0000000..e5f3694 --- /dev/null +++ b/include/ANSGpuFrameRegistry.h @@ -0,0 +1,414 @@ +#pragma once +// ANSGpuFrameRegistry.h — Side-table registry associating cv::Mat pointers +// with GPU-friendly NV12 frame data for fast-path inference. +// +// Key: cv::Mat* (the heap-allocated pointer from anscv_mat_new), NOT datastart. +// This survives deep copies (CloneImage_S) because each clone gets its own key +// pointing to the same shared GpuFrameData via reference counting. +// +// When RTSP HW decode produces an NV12 AVFrame, we snapshot the CPU NV12 planes +// into owned buffers and register them keyed by the cv::Mat*. When CloneImage_S +// is called, addRef() links the new Mat* to the same GpuFrameData (refcount++). +// When inference runs, it reads the NV12 data via a thread-local pointer set by +// RunInferenceComplete_LV — no registry lookup needed in the engine hot path. +// +// Cleanup: +// - anscv_mat_delete() calls release() → refcount--; frees when 0 +// - anscv_mat_replace() calls release() on old Mat* → same +// - TTL eviction catches stuck tasks (frames older than 3s with refcount > 0) +// +// Safety layers: +// 1. Refcount cap (64) — prevents runaway refs from bugs +// 2. Frame TTL (3s) — force-frees frames held by stuck tasks +// 3. Global VRAM budget (1GB) — caps GPU cache allocation +// +// Thread-safe: all methods lock internally. +// +// NOTE: This header is FFmpeg-free. CPU NV12 snapshots are owned malloc'd buffers. +// The opaque `avframe`/`cpuAvframe` pointers are retained for ANSCV to free via av_frame_free. + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Safety constants +static constexpr int MAX_FRAME_REFCOUNT = 64; +static constexpr int FRAME_TTL_SECONDS = 3; +static constexpr size_t GPU_CACHE_BUDGET_DEFAULT = 1ULL * 1024 * 1024 * 1024; // 1GB +static constexpr int EVICT_CHECK_INTERVAL_MS = 500; + +struct GpuFrameData { + // --- CPU NV12 snapshot (OWNED malloc'd buffers, independent of decoder) --- + uint8_t* cpuYPlane = nullptr; // malloc'd Y plane copy + uint8_t* cpuUvPlane = nullptr; // malloc'd UV plane copy + int cpuYLinesize = 0; // Bytes per row in Y plane + int cpuUvLinesize = 0; // Bytes per row in UV plane + + // --- GPU upload cache (created on first inference, shared across tasks) --- + void* gpuCacheY = nullptr; // cudaMalloc'd Y on inference GPU + void* gpuCacheUV = nullptr; // cudaMalloc'd UV on inference GPU + size_t gpuCacheYPitch = 0; // Pitch of cached Y plane + size_t gpuCacheUVPitch = 0; // Pitch of cached UV plane + size_t gpuCacheBytes = 0; // Total VRAM bytes (for budget tracking) + int gpuCacheDeviceIdx = -1; // GPU index where cache lives + bool gpuCacheValid = false; // true after first upload + // gpuCacheMutex is NOT here — use the registry mutex for cache creation + + // --- Legacy opaque AVFrame pointers (freed by ANSCV via av_frame_free) --- + void* avframe = nullptr; // Original CUDA or CPU AVFrame (owned) + void* cpuAvframe = nullptr; // CPU fallback AVFrame (owned, may be nullptr) + + // --- Frame metadata --- + int width = 0; + int height = 0; + int pixelFormat = 0; // 23=NV12, 1000=BGR full-res + int gpuIndex = -1; // GPU that decoded this frame + int64_t pts = 0; // Presentation timestamp + bool isCudaDevicePtr = false; // Legacy: true if original was CUDA zero-copy + + // --- Legacy NV12 plane pointers (point into avframe, used during transition) --- + // TODO: Remove once all consumers use cpuYPlane/cpuUvPlane via thread-local + uint8_t* yPlane = nullptr; + uint8_t* uvPlane = nullptr; + int yLinesize = 0; + int uvLinesize = 0; + + // --- Lifecycle --- + std::atomic refcount{1}; + std::chrono::steady_clock::time_point createdAt; + + // Default constructor + GpuFrameData() = default; + + // Move constructor (std::atomic is neither copyable nor movable) + GpuFrameData(GpuFrameData&& o) noexcept + : cpuYPlane(o.cpuYPlane), cpuUvPlane(o.cpuUvPlane) + , cpuYLinesize(o.cpuYLinesize), cpuUvLinesize(o.cpuUvLinesize) + , gpuCacheY(o.gpuCacheY), gpuCacheUV(o.gpuCacheUV) + , gpuCacheYPitch(o.gpuCacheYPitch), gpuCacheUVPitch(o.gpuCacheUVPitch) + , gpuCacheBytes(o.gpuCacheBytes), gpuCacheDeviceIdx(o.gpuCacheDeviceIdx) + , gpuCacheValid(o.gpuCacheValid) + , avframe(o.avframe), cpuAvframe(o.cpuAvframe) + , width(o.width), height(o.height), pixelFormat(o.pixelFormat) + , gpuIndex(o.gpuIndex), pts(o.pts), isCudaDevicePtr(o.isCudaDevicePtr) + , yPlane(o.yPlane), uvPlane(o.uvPlane) + , yLinesize(o.yLinesize), uvLinesize(o.uvLinesize) + , refcount(o.refcount.load()), createdAt(o.createdAt) + { + // Null out source to prevent double-free of owned pointers + o.cpuYPlane = nullptr; + o.cpuUvPlane = nullptr; + o.gpuCacheY = nullptr; + o.gpuCacheUV = nullptr; + o.avframe = nullptr; + o.cpuAvframe = nullptr; + o.yPlane = nullptr; + o.uvPlane = nullptr; + o.gpuCacheBytes = 0; + } + + // No copy + GpuFrameData(const GpuFrameData&) = delete; + GpuFrameData& operator=(const GpuFrameData&) = delete; +}; + +class ANSGpuFrameRegistry { +public: + // Process-wide singleton. On Windows, header-only static locals are per-DLL. + // ANSCV.dll exports ANSGpuFrameRegistry_GetInstance() (defined in + // ANSGpuFrameRegistry.cpp); other DLLs find it via GetProcAddress at runtime. + static ANSGpuFrameRegistry& instance() { +#ifdef _WIN32 + static ANSGpuFrameRegistry* s_inst = resolveProcessWide(); + return *s_inst; +#else + static ANSGpuFrameRegistry reg; + return reg; +#endif + } + + // --- Attach: register a new GpuFrameData keyed by cv::Mat* --- + // Allocates GpuFrameData on heap. Takes ownership of avframe/cpuAvframe. + // Returns old avframe pointer if this Mat* was already registered (caller must av_frame_free). + void* attach(cv::Mat* mat, GpuFrameData&& data) { + if (!mat) return nullptr; + void* oldAvframe = nullptr; + + data.createdAt = std::chrono::steady_clock::now(); + data.refcount.store(1); + + auto* heapData = new GpuFrameData(std::move(data)); + + std::lock_guard lock(m_mutex); + + // If this Mat* already has an entry, release the old one + auto it = m_map.find(mat); + if (it != m_map.end()) { + auto* oldFrame = it->second; + int oldRef = oldFrame->refcount.fetch_sub(1); + if (oldRef <= 1) { + oldAvframe = oldFrame->avframe; + if (oldFrame->cpuAvframe) + m_pendingFree.push_back(oldFrame->cpuAvframe); + freeOwnedBuffers_locked(oldFrame); + m_frameSet.erase(oldFrame); + delete oldFrame; + } + // If oldRef > 1, other clones still reference it — just unlink this Mat* + m_map.erase(it); + } + + m_map[mat] = heapData; + m_frameSet.insert(heapData); + + return oldAvframe; // Caller must av_frame_free if non-null + } + + // --- addRef: link a cloned cv::Mat* to the same GpuFrameData as src --- + // Returns true if successful, false if src not found or refcount cap reached. + bool addRef(cv::Mat* src, cv::Mat* dst) { + if (!src || !dst || src == dst) return false; + + std::lock_guard lock(m_mutex); + + auto it = m_map.find(src); + if (it == m_map.end()) return false; + + auto* frame = it->second; + int current = frame->refcount.load(); + if (current >= MAX_FRAME_REFCOUNT) { + return false; // Cap reached — caller falls back to BGR + } + + frame->refcount.fetch_add(1); + m_map[dst] = frame; + return true; + } + + // --- release: decrement refcount for this Mat*, free if 0 --- + // Returns avframe pointer to free (or nullptr) via pendingFree. + // Caller must drain_pending() and av_frame_free each returned pointer. + void release(cv::Mat* mat) { + if (!mat) return; + + std::lock_guard lock(m_mutex); + + auto it = m_map.find(mat); + if (it == m_map.end()) return; + + auto* frame = it->second; + m_map.erase(it); + + int oldRef = frame->refcount.fetch_sub(1); + if (oldRef <= 1) { + // Last reference — free everything + if (frame->avframe) + m_pendingFree.push_back(frame->avframe); + if (frame->cpuAvframe) + m_pendingFree.push_back(frame->cpuAvframe); + freeOwnedBuffers_locked(frame); + m_frameSet.erase(frame); + delete frame; + } + } + + // --- lookup: find GpuFrameData by cv::Mat* (locking) --- + GpuFrameData* lookup(cv::Mat* mat) { + std::lock_guard lock(m_mutex); + auto it = m_map.find(mat); + return (it != m_map.end()) ? it->second : nullptr; + } + + // --- lookup_unlocked: caller MUST hold lock via acquire_lock() --- + GpuFrameData* lookup_unlocked(cv::Mat* mat) { + auto it = m_map.find(mat); + return (it != m_map.end()) ? it->second : nullptr; + } + + // --- Backward-compat: lookup by datastart (for transition period) --- + // Searches all entries for matching datastart. O(n) — avoid in hot path. + GpuFrameData* lookup_by_datastart(const uchar* datastart) { + std::lock_guard lock(m_mutex); + return lookup_by_datastart_unlocked(datastart); + } + + GpuFrameData* lookup_by_datastart_unlocked(const uchar* datastart) { + if (!datastart) return nullptr; + for (auto& [mat, frame] : m_map) { + if (mat && mat->datastart == datastart) + return frame; + } + return nullptr; + } + + // Acquire the registry lock explicitly. + std::unique_lock acquire_lock() { + return std::unique_lock(m_mutex); + } + + // Number of map entries (Mat* keys) — caller MUST hold lock. + size_t size_unlocked() const { return m_map.size(); } + + // Number of unique frames alive — caller MUST hold lock. + size_t frame_count_unlocked() const { return m_frameSet.size(); } + + // --- Drain pending avframe pointers for caller to av_frame_free --- + std::vector drain_pending() { + std::lock_guard lock(m_mutex); + std::vector result; + result.swap(m_pendingFree); + return result; + } + + // --- Drain pending GPU device pointers for caller to cudaFree --- + std::vector drain_gpu_pending() { + std::lock_guard lock(m_mutex); + std::vector result; + result.swap(m_pendingGpuFree); + return result; + } + + // --- TTL eviction: force-free frames older than FRAME_TTL_SECONDS --- + // Call periodically from camera threads (piggybacked on mat_replace). + void evictStaleFrames() { + auto now = std::chrono::steady_clock::now(); + + // Throttle: skip if called too frequently + { + std::lock_guard lock(m_mutex); + if (now - m_lastEvictCheck < std::chrono::milliseconds(EVICT_CHECK_INTERVAL_MS)) + return; + m_lastEvictCheck = now; + } + + std::lock_guard lock(m_mutex); + for (auto it = m_frameSet.begin(); it != m_frameSet.end(); ) { + auto* frame = *it; + auto age_s = std::chrono::duration_cast( + now - frame->createdAt).count(); + if (age_s > FRAME_TTL_SECONDS && frame->refcount.load() > 0) { + // Force cleanup — remove all Mat* keys pointing to this frame + for (auto jt = m_map.begin(); jt != m_map.end(); ) { + if (jt->second == frame) + jt = m_map.erase(jt); + else + ++jt; + } + // Push avframes to pendingFree + if (frame->avframe) + m_pendingFree.push_back(frame->avframe); + if (frame->cpuAvframe) + m_pendingFree.push_back(frame->cpuAvframe); + freeOwnedBuffers_locked(frame); + it = m_frameSet.erase(it); + delete frame; + } else { + ++it; + } + } + } + + // --- VRAM budget management --- + bool canAllocateGpuCache(size_t bytes) const { + return m_totalGpuCacheBytes.load(std::memory_order_relaxed) + bytes <= m_gpuCacheBudget; + } + + void onGpuCacheCreated(size_t bytes) { + m_totalGpuCacheBytes.fetch_add(bytes, std::memory_order_relaxed); + } + + void onGpuCacheFreed(size_t bytes) { + // Prevent underflow + size_t old = m_totalGpuCacheBytes.load(std::memory_order_relaxed); + while (old >= bytes) { + if (m_totalGpuCacheBytes.compare_exchange_weak(old, old - bytes, + std::memory_order_relaxed)) + break; + } + } + + size_t totalGpuCacheBytes() const { + return m_totalGpuCacheBytes.load(std::memory_order_relaxed); + } + + void setGpuCacheBudget(size_t bytes) { m_gpuCacheBudget = bytes; } + size_t gpuCacheBudget() const { return m_gpuCacheBudget; } + +private: + ANSGpuFrameRegistry() = default; + +#ifdef _WIN32 + static ANSGpuFrameRegistry* resolveProcessWide(); +#endif + + // Free malloc'd CPU NV12 buffers and GPU cache (but NOT avframe/cpuAvframe — + // those go to pendingFree for the caller to av_frame_free). + void freeOwnedBuffers_locked(GpuFrameData* frame) { + if (frame->cpuYPlane) { + std::free(frame->cpuYPlane); + frame->cpuYPlane = nullptr; + } + if (frame->cpuUvPlane) { + std::free(frame->cpuUvPlane); + frame->cpuUvPlane = nullptr; + } + // GPU cache freed via CUDA — caller (ANSODEngine) must handle this + // since we can't call cudaFree from this FFmpeg-free header. + // The gpuCacheBytes are tracked; actual deallocation happens in + // NV12PreprocessHelper or a GPU-aware cleanup path. + if (frame->gpuCacheBytes > 0) { + onGpuCacheFreed(frame->gpuCacheBytes); + // Mark as invalid so no one reads stale pointers + frame->gpuCacheValid = false; + frame->gpuCacheBytes = 0; + // NOTE: gpuCacheY/gpuCacheUV device pointers are leaked here + // unless the caller handles GPU cleanup. This is addressed in + // Step 8 (NV12PreprocessHelper) where cudaFree is available. + // For now, push to a separate GPU-free list. + if (frame->gpuCacheY) + m_pendingGpuFree.push_back(frame->gpuCacheY); + if (frame->gpuCacheUV) + m_pendingGpuFree.push_back(frame->gpuCacheUV); + frame->gpuCacheY = nullptr; + frame->gpuCacheUV = nullptr; + } + } + + std::mutex m_mutex; + std::unordered_map m_map; + std::unordered_set m_frameSet; // All unique frames (for TTL scan) + std::vector m_pendingFree; // AVFrame* pointers to av_frame_free + std::vector m_pendingGpuFree; // CUDA device pointers to cudaFree + std::atomic m_totalGpuCacheBytes{0}; + size_t m_gpuCacheBudget = GPU_CACHE_BUDGET_DEFAULT; + std::chrono::steady_clock::time_point m_lastEvictCheck; +}; + +// ── Convenience free functions (FFmpeg-agnostic) ──────────────────────── + +// Lookup by cv::Mat* pointer (primary key) +inline GpuFrameData* gpu_frame_lookup(cv::Mat* mat) { + return ANSGpuFrameRegistry::instance().lookup(mat); +} + +// Backward-compat: lookup by datastart (O(n) — avoid in hot path) +inline GpuFrameData* gpu_frame_lookup(const uchar* datastart) { + return ANSGpuFrameRegistry::instance().lookup_by_datastart(datastart); +} + +// Add ref: link clone Mat* to same GpuFrameData as src Mat* +inline bool gpu_frame_addref(cv::Mat* src, cv::Mat* dst) { + return ANSGpuFrameRegistry::instance().addRef(src, dst); +} + +// Drain GPU device pointers that need cudaFree. +// Caller must cudaFree each returned pointer. +inline std::vector gpu_frame_drain_gpu_pending() { + return ANSGpuFrameRegistry::instance().drain_gpu_pending(); +} diff --git a/include/anslicensing.h b/include/anslicensing.h new file mode 100644 index 0000000..3fdb165 --- /dev/null +++ b/include/anslicensing.h @@ -0,0 +1,920 @@ +#ifndef __ANSCENTER_LICENSING_H +#define __ANSCENTER_LICENSING_H +#include + +// Error codes for license key library exceptions +#define STATUS_SUCCESS 0 +#define STATUS_GENERIC_ERROR 1 +#define STATUS_OUT_OF_MEMORY 2 +#define STATUS_FIELD_NOT_FOUND 3 +#define STATUS_BUFFER_TOO_SMALL 4 +#define STATUS_INVALID_XML 5 +#define STATUS_INVALID_LICENSE_KEY 6 +#define STATUS_INVALID_KEY_ENCODING 7 +#define STATUS_INVALID_PARAM 8 +#define STATUS_INVALID_SIGNATURE_SIZE 9 +#define STATUS_UNSUPPORTED_VERSION 10 +#define STATUS_NET_ERROR 11 +#define STATUS_INVALID_HARDWARE_ID 12 +#define STATUS_LICENSE_EXPIRED 13 +#define STATUS_INVALID_ACTIVATION_KEY 14 +#define STATUS_PAYMENT_REQUIRED 15 + +// License key textual encoding - a slightly modified version of BASE32 or BASE64 in order to omit confusing characters like o, i, 1, etc. +#define ENCODING_BASE32X 5 +#define ENCODING_BASE64X 6 + +// Data or validation field types +#define FIELD_TYPE_RAW 0 +#define FIELD_TYPE_INTEGER 1 +#define FIELD_TYPE_STRING 2 +#define FIELD_TYPE_DATE14 3 +#define FIELD_TYPE_DATE16 4 +#define FIELD_TYPE_DATE13 5 + +#define PREFER_INTERNET_TIME 0 +#define USE_INTERNET_TIME 1 +#define USE_LOCAL_TIME 2 + +#ifdef _WIN32 + +#ifndef LICENSING_STATIC +#ifdef LICENSING_EXPORTS +#define LICENSING_API __declspec(dllexport) +#define LICENSEKEY_EXTINT +#else +#define LICENSING_API __declspec(dllimport) +#define LICENSEKEY_EXTINT +#endif +#else +#define LICENSING_API +#endif + +#else // !_WIN32 + +#define LICENSING_API + +#endif + +#ifdef __cplusplus +extern "C" +{ +#endif + +void * KeyGenerator_Create(); +void KeyGenerator_Destroy(void * generator); +int KeyGenerator_SetKeyTemplate(void * generator, const void * tmpl); + +int KeyGenerator_SetKeyDataA(void * generator, const char * fieldName, const void * data, int len); +int KeyGenerator_SetKeyDataW(void * generator, const wchar_t * fieldName, const void * data, int len); +#ifdef _UNICODE +#define KeyGenerator_SetKeyData KeyGenerator_SetKeyDataW +#else +#define KeyGenerator_SetKeyData KeyGenerator_SetKeyDataA +#endif + +int KeyGenerator_SetIntKeyDataA(void * generator, const char * fieldName, int data); +int KeyGenerator_SetIntKeyDataW(void * generator, const wchar_t * fieldName, int data); +#ifdef _UNICODE +#define KeyGenerator_SetIntKeyData KeyGenerator_SetIntKeyDataW +#else +#define KeyGenerator_SetIntKeyData KeyGenerator_SetIntKeyDataA +#endif + +int KeyGenerator_SetStringKeyDataA(void * generator, const char * fieldName, const char * data); +int KeyGenerator_SetStringKeyDataW(void * generator, const wchar_t * fieldName, const wchar_t * data); +#ifdef _UNICODE +#define KeyGenerator_SetStringKeyData KeyGenerator_SetStringKeyDataW +#else +#define KeyGenerator_SetStringKeyData KeyGenerator_SetStringKeyDataA +#endif + +int KeyGenerator_SetDateKeyDataA(void * generator, const char * fieldName, int year, int month, int day); +int KeyGenerator_SetDateKeyDataW(void * generator, const wchar_t * fieldName, int year, int month, int day); +#ifdef _UNICODE +#define KeyGenerator_SetDateKeyData KeyGenerator_SetDateKeyDataW +#else +#define KeyGenerator_SetDateKeyData KeyGenerator_SetDateKeyDataA +#endif + +int KeyGenerator_SetValidationDataA(void * generator, const char * fieldName, const void * buf, int len); +int KeyGenerator_SetValidationDataW(void * generator, const wchar_t * fieldName, const void * buf, int len); +#ifdef _UNICODE +#define KeyGenerator_SetValidationData KeyGenerator_SetValidationDataW +#else +#define KeyGenerator_SetValidationData KeyGenerator_SetValidationDataA +#endif + +int KeyGenerator_SetIntValidationDataA(void * generator, const char * fieldName, int data); +int KeyGenerator_SetIntValidationDataW(void * generator, const wchar_t * fieldName, int data); +#ifdef _UNICODE +#define KeyGenerator_SetIntValidationData KeyGenerator_SetIntValidationDataW +#else +#define KeyGenerator_SetIntValidationData KeyGenerator_SetIntValidationDataA +#endif + +int KeyGenerator_SetStringValidationDataA(void * generator, const char * fieldName, const char * data); +int KeyGenerator_SetStringValidationDataW(void * generator, const wchar_t * fieldName, const wchar_t * data); +#ifdef _UNICODE +#define KeyGenerator_SetStringValidationData KeyGenerator_SetStringValidationDataW +#else +#define KeyGenerator_SetStringValidationData KeyGenerator_SetStringValidationDataA +#endif + +int KeyGenerator_GenerateKeyA(void * generator, const char **key); +int KeyGenerator_GenerateKeyW(void * generator, const wchar_t **key); +#ifdef _UNICODE +#define KeyGenerator_GenerateKey KeyGenerator_GenerateKeyW +#else +#define KeyGenerator_GenerateKey KeyGenerator_GenerateKeyA +#endif + +void * KeyValidator_Create(); +void KeyValidator_Destroy(void * validator); +int KeyValidator_SetKeyTemplate(void * validator, const void * tmpl); + +int KeyValidator_SetKeyA(void * validator, const char * key); +int KeyValidator_SetKeyW(void * validator, const wchar_t * key); +#ifdef _UNICODE +#define KeyValidator_SetKey KeyValidator_SetKeyW +#else +#define KeyValidator_SetKey KeyValidator_SetKeyA +#endif + +int KeyValidator_SetValidationDataA(void * validator, const char * fieldName, const void * buf, int len); +int KeyValidator_SetValidationDataW(void * validator, const wchar_t * fieldName, const void * buf, int len); +#ifdef _UNICODE +#define KeyValidator_SetValidationData KeyValidator_SetValidationDataW +#else +#define KeyValidator_SetValidationData KeyValidator_SetValidationDataA +#endif + +int KeyValidator_SetIntValidationDataA(void * validator, const char * fieldName, int data); +int KeyValidator_SetIntValidationDataW(void * validator, const wchar_t * fieldName, int data); +#ifdef _UNICODE +#define KeyValidator_SetIntValidationData KeyValidator_SetIntValidationDataW +#else +#define KeyValidator_SetIntValidationData KeyValidator_SetIntValidationDataA +#endif + +int KeyValidator_SetStringValidationDataA(void * validator, const char * fieldName, const char * data); +int KeyValidator_SetStringValidationDataW(void * validator, const wchar_t * fieldName, const wchar_t * data); +#ifdef _UNICODE +#define KeyValidator_SetStringValidationData KeyValidator_SetStringValidationDataW +#else +#define KeyValidator_SetStringValidationData KeyValidator_SetStringValidationDataA +#endif + +int KeyValidator_IsKeyValid(void * validator); + +int KeyValidator_QueryKeyDataA(void * validator, const char * dataField, void * buf, int * len); +int KeyValidator_QueryKeyDataW(void * validator, const wchar_t * dataField, void * buf, int * len); +#ifdef _UNICODE +#define KeyValidator_QueryKeyData KeyValidator_QueryKeyDataW +#else +#define KeyValidator_QueryKeyData KeyValidator_QueryKeyDataA +#endif + +int KeyValidator_QueryIntKeyDataA(void * validator, const char * dataField, int * data); +int KeyValidator_QueryIntKeyDataW(void * validator, const char * dataField, int * data); +#ifdef _UNICODE +#define KeyValidator_QueryIntKeyData KeyValidator_QueryIntKeyDataW +#else +#define KeyValidator_QueryIntKeyData KeyValidator_QueryIntKeyDataA +#endif + +int KeyValidator_QueryDateKeyDataA(void * validator, const char * dataField, int * year, int * month, int * day); +int KeyValidator_QueryDateKeyDataW(void * validator, const wchar_t * dataField, int * year, int * month, int * day); +#ifdef _UNICODE +#define KeyValidator_QueryDateKeyData KeyValidator_QueryDateKeyDataW +#else +#define KeyValidator_QueryDateKeyData KeyValidator_QueryDateKeyDataA +#endif + +int KeyValidator_QueryValidationDataA(void * validator, const char * dataField, void * buf, int * len); +int KeyValidator_QueryValidationDataW(void * validator, const wchar_t * dataField, void * buf, int * len); +#ifdef _UNICODE +#define KeyValidator_QueryValidationData KeyValidator_QueryValidationDataW +#else +#define KeyValidator_QueryValidationData KeyValidator_QueryValidationDataA +#endif + +void * LicenseTemplate_Create(); +void LicenseTemplate_Destroy(void * tmpl); + +int LicenseTemplate_SetVersion(void * tmpl, int version); +int LicenseTemplate_GetVersion(void * tmpl, int * version); +int LicenseTemplate_SetNumberOfGroups(void * tmpl, int numGroups); +int LicenseTemplate_GetNumberOfGroups(void * tmpl, int * numGroups); +int LicenseTemplate_SetCharactersPerGroup(void * tmpl, int charsPerGroup); +int LicenseTemplate_GetCharactersPerGroup(void * tmpl, int * charsPerGroup); + +int LicenseTemplate_SetGroupSeparatorA(void * tmpl, const char * groupSep); +int LicenseTemplate_SetGroupSeparatorW(void * tmpl, const wchar_t * groupSep); +#ifdef _UNICODE +#define LicenseTemplate_SetGroupSeparator LicenseTemplate_SetGroupSeparatorW +#else +#define LicenseTemplate_SetGroupSeparator LicenseTemplate_SetGroupSeparatorA +#endif + +int LicenseTemplate_GetGroupSeparatorA(void * tmpl, const char **groupSep); +int LicenseTemplate_GetGroupSeparatorW(void * tmpl, const wchar_t **groupSep); +#ifdef _UNICODE +#define LicenseTemplate_GetGroupSeparator LicenseTemplate_GetGroupSeparatorW +#else +#define LicenseTemplate_GetGroupSeparator LicenseTemplate_GetGroupSeparatorA +#endif + +int LicenseTemplate_SetEncoding(void * tmpl, int encoding); +int LicenseTemplate_GetEncoding(void * tmpl, int * encoding); + +int LicenseTemplate_SetHeaderA(void * tmpl, const char * header); +int LicenseTemplate_SetHeaderW(void * tmpl, const wchar_t * header); +#ifdef _UNICODE +#define LicenseTemplate_SetHeader LicenseTemplate_SetHeaderW +#else +#define LicenseTemplate_SetHeader LicenseTemplate_SetHeaderA +#endif + +int LicenseTemplate_GetHeaderA(void * tmpl, const char** header); +int LicenseTemplate_GetHeaderW(void * tmpl, const wchar_t** header); +#ifdef _UNICODE +#define LicenseTemplate_GetHeader LicenseTemplate_GetHeaderW +#else +#define LicenseTemplate_GetHeader LicenseTemplate_GetHeaderA +#endif + +int LicenseTemplate_SetFooterA(void * tmpl, const char * footer); +int LicenseTemplate_SetFooterW(void * tmpl, const wchar_t * footer); +#ifdef _UNICODE +#define LicenseTemplate_SetFooter LicenseTemplate_SetFooterW +#else +#define LicenseTemplate_SetFooter LicenseTemplate_SetFooterA +#endif + +int LicenseTemplate_GetFooterA(void * tmpl, const char **footer); +int LicenseTemplate_GetFooterW(void * tmpl, const wchar_t **footer); +#ifdef _UNICODE +#define LicenseTemplate_GetFooter LicenseTemplate_GetFooterW +#else +#define LicenseTemplate_GetFooter LicenseTemplate_GetFooterA +#endif + +int LicenseTemplate_SetDataSize(void * tmpl, int sizeInBits); +int LicenseTemplate_GetDataSize(void * tmpl, int * sizeInBits); + +int LicenseTemplate_AddDataFieldA(void * tmpl, const char * fieldName, int fieldType, int fieldBitSize, int fieldOffset); +int LicenseTemplate_AddDataFieldW(void * tmpl, const wchar_t * fieldName, int fieldType, int fieldBitSize, int fieldOffset); +#ifdef _UNICODE +#define LicenseTemplate_AddDataField LicenseTemplate_AddDataFieldW +#else +#define LicenseTemplate_AddDataField LicenseTemplate_AddDataFieldA +#endif + +int LicenseTemplate_GetDataFieldA(void * tmpl, const char *fieldName, int * fieldType, int * fieldSize, int * fieldOffset); +int LicenseTemplate_GetDataFieldW(void * tmpl, const wchar_t *fieldName, int * fieldType, int * fieldSize, int * fieldOffset); +#ifdef _UNICODE +#define LicenseTemplate_GetDataField LicenseTemplate_GetDataFieldW +#else +#define LicenseTemplate_GetDataField LicenseTemplate_GetDataFieldA +#endif + +int LicenseTemplate_EnumDataFieldsA(void * tmpl, void **enumHandle, const char **fieldName, int * fieldType, int * fieldSize, int * fieldOffset); +int LicenseTemplate_EnumDataFieldsW(void * tmpl, void **enumHandle, const wchar_t **fieldName, int * fieldType, int * fieldSize, int * fieldOffset); +#ifdef _UNICODE +#define LicenseTemplate_EnumDataFields LicenseTemplate_EnumDataFieldsW +#else +#define LicenseTemplate_EnumDataFields LicenseTemplate_EnumDataFieldsA +#endif + +int LicenseTemplate_SetValidationDataSize(void * tmpl, int sizeInBits); +int LicenseTemplate_GetValidationDataSize(void * tmpl, int * sizeInBits); + +int LicenseTemplate_AddValidationFieldA(void * tmpl, const char * fieldName, int fieldType, int fieldBitSize, int fieldOffset); +int LicenseTemplate_AddValidationFieldW(void * tmpl, const wchar_t * fieldName, int fieldType, int fieldBitSize, int fieldOffset); +#ifdef _UNICODE +#define LicenseTemplate_AddValidationField LicenseTemplate_AddValidationFieldW +#else +#define LicenseTemplate_AddValidationField LicenseTemplate_AddValidationFieldA +#endif + +int LicenseTemplate_GetValidationFieldA(void * tmpl, const char *fieldName, int * fieldType, int * fieldSize, int * fieldOffset); +int LicenseTemplate_GetValidationFieldW(void * tmpl, const wchar_t *fieldName, int * fieldType, int * fieldSize, int * fieldOffset); +#ifdef _UNICODE +#define LicenseTemplate_GetValidationField LicenseTemplate_GetValidationFieldW +#else +#define LicenseTemplate_GetValidationField LicenseTemplate_GetValidationFieldA +#endif + +int LicenseTemplate_EnumValidationFieldsA(void * tmpl, void **enumHandle, const char * fieldName, int * fieldType, int * fieldSize, int * fieldOffset); +int LicenseTemplate_EnumValidationFieldsW(void * tmpl, void **enumHandle, const wchar_t * fieldName, int * fieldType, int * fieldSize, int * fieldOffset); +#ifdef _UNICODE +#define LicenseTemplate_EnumValidationFields LicenseTemplate_EnumValidationFieldsW +#else +#define LicenseTemplate_EnumValidationFields LicenseTemplate_EnumValidationFieldsA +#endif + +int LicenseTemplate_SetSignatureSize(void * tmpl, int signatureSize); +int LicenseTemplate_GetSignatureSize(void * tmpl, int * signatureSize); + +int LicenseTemplate_LoadXml(void * tmpl, const char * xmlTemplate); +int LicenseTemplate_SaveXml(void * tmpl, int savePrivateKey, const char **xmlString); + +int LicenseTemplate_LoadJson(void * tmpl, const char * jsonTemplate); +int LicenseTemplate_SaveJson(void * tmpl, int savePrivateKey, const char **jsonString); + +int LicenseTemplate_SetPublicKeyCertificateA(void * tmpl, const char * base64PublicKey); +int LicenseTemplate_SetPublicKeyCertificateW(void * tmpl, const wchar_t * base64PublicKey); +#ifdef _UNICODE +#define LicenseTemplate_SetPublicKeyCertificate LicenseTemplate_SetPublicKeyCertificateW +#else +#define LicenseTemplate_SetPublicKeyCertificate LicenseTemplate_SetPublicKeyCertificateA +#endif + +int LicenseTemplate_GetPublicKeyCertificateA(void * tmpl, const char **publicKey); +int LicenseTemplate_GetPublicKeyCertificateW(void * tmpl, const wchar_t **publicKey); +#ifdef _UNICODE +#define LicenseTemplate_GetPublicKeyCertificate KeyHelper_GetPublicKeyCertificateW +#else +#define LicenseTemplate_GetPublicKeyCertificate KeyHelper_GetPublicKeyCertificateA +#endif + +int LicenseTemplate_SetPrivateKeyA(void * tmpl, const char * base64PrivateKey); +int LicenseTemplate_SetPrivateKeyW(void * tmpl, const wchar_t * base64PrivateKey); +#ifdef _UNICODE +#define LicenseTemplate_SetPrivateKey LicenseTemplate_SetPrivateKeyW +#else +#define LicenseTemplate_SetPrivateKey LicenseTemplate_SetPrivateKeyA +#endif + +int LicenseTemplate_GetPrivateKeyA(void * tmpl, const char **privateKey); +int LicenseTemplate_GetPrivateKeyW(void * tmpl, const wchar_t **privateKey); +#ifdef _UNICODE +#define LicenseTemplate_GetPrivateKey KeyHelper_GetPrivateKeyW +#else +#define LicenseTemplate_GetPrivateKey KeyHelper_GetPrivateKeyA +#endif + +int LicenseTemplate_GenerateSigningKeyPair(void * tmpl); + +int LicenseTemplate_SetLicensingServiceUrlA(void * tmpl, const char * url); +int LicenseTemplate_SetLicensingServiceUrlW(void * tmpl, const wchar_t * url); +#ifdef _UNICODE +#define LicenseTemplate_SetLicensingServiceUrl LicenseTemplate_SetLicensingServiceUrlW +#else +#define LicenseTemplate_SetLicensingServiceUrl LicenseTemplate_SetLicensingServiceUrlA +#endif + +int LicenseTemplate_GetLicensingServiceUrlA(void * tmpl, const char **url); +int LicenseTemplate_GetLicensingServiceUrlW(void * tmpl, const wchar_t **url); +#ifdef _UNICODE +#define LicenseTemplate_GetLicensingServiceUrl LicenseTemplate_GetLicensingServiceUrlW +#else +#define LicenseTemplate_GetLicensingServiceUrl LicenseTemplate_GetLicensingServiceUrlA +#endif + +int LicenseTemplate_SetTemplateIdA(void * tmpl, const char * templateId); +int LicenseTemplate_SetTemplateIdW(void * tmpl, const wchar_t * templateId); +#ifdef _UNICODE +#define LicenseTemplate_SetTemplateId LicenseTemplate_SetTemplateIdW +#else +#define LicenseTemplate_SetTemplateId LicenseTemplate_SetTemplateIdA +#endif + +int LicenseTemplate_GetTemplateIdA(void * tmpl, const char **templateId); +int LicenseTemplate_GetTemplateIdW(void * tmpl, const wchar_t **templateId); +#ifdef _UNICODE +#define LicenseTemplate_GetTemplateId LicenseTemplate_GetTemplateIdW +#else +#define LicenseTemplate_GetTemplateId LicenseTemplate_GetTemplateIdA +#endif + +int KeyHelper_GetCurrentHardwareIdA(const char **hwid); +int KeyHelper_GetCurrentHardwareIdW(const wchar_t **hwid); +#ifdef _UNICODE +#define KeyHelper_GetCurrentHardwareId KeyHelper_GetCurrentHardwareIdW +#else +#define KeyHelper_GetCurrentHardwareId KeyHelper_GetCurrentHardwareIdA +#endif + +int KeyHelper_MatchCurrentHardwareIdA(const char **hwid); +int KeyHelper_MatchCurrentHardwareIdW(const wchar_t **hwid); +#ifdef _UNICODE +#define KeyHelper_MatchCurrentHardwareId KeyHelper_MatchCurrentHardwareIdW +#else +#define KeyHelper_MatchCurrentHardwareId KeyHelper_MatchCurrentHardwareIdA +#endif + +int SDKRegistration_SetLicenseKeyA(const char * key); +int SDKRegistration_SetLicenseKeyW(const wchar_t * key); +#ifdef _UNICODE +#define SDKRegistration_SetLicenseKey SDKRegistration_SetLicenseKeyW +#else +#define SDKRegistration_SetLicenseKey SDKRegistration_SetLicenseKeyA +#endif + +void LicenseTemplate_SetPropertyA(const char * path, const char * name, const char * value); +void LicenseTemplate_SetPropertyW(const wchar_t * path, const wchar_t * name, const wchar_t * value); +#ifdef _UNICODE +#define LicenseTemplate_SetProperty LicenseTemplate_SetPropertyW +#else +#define LicenseTemplate_SetProperty LicenseTemplate_SetPropertyA +#endif + +const char * LicenseTemplate_GetPropertyA(const char *path, const char *name); +const wchar_t * LicenseTemplate_GetPropertyW(const wchar_t *path, const wchar_t*name); +#ifdef _UNICODE +#define LicenseTemplate_GetProperty LicenseTemplate_GetPropertyW +#else +#define LicenseTemplate_GetProperty LicenseTemplate_GetPropertyA +#endif + +// License class + +void * License_Create(); +void License_Destroy(void *); + +int License_LoadXml(void *, const char * xml); +int License_SaveXml(void * license, const char **xml); + +int License_LoadJson(void *, const char * json); +int License_SaveJson(void * license, const char **json); + +// LicenseValidationArgs class + +void * LicenseValidationArgs_CreateA(void * license, char * licenseKey); +void * LicenseValidationArgs_CreateW(void * license, wchar_t * licenseKey); +#ifdef _UNICODE +#define LicenseValidationArgs_Create LicenseValidationArgs_CreateW +#else +#define LicenseValidationArgs_Create LicenseValidationArgs_CreateA +#endif +void LicenseValidationArgs_Destroy(void*); + +int LicenseValidationArgs_SetIntLicenseKeyValidationDataA(void * args, const char * fieldName, int fieldValue); +int LicenseValidationArgs_SetIntLicenseKeyValidationDataW(void * args, const wchar_t * fieldName, int fieldValue); +#ifdef _UNICODE +#define LicenseValidationArgs_SetIntLicenseKeyValidationData LicenseValidationArgs_SetIntLicenseKeyValidationDataW +#else +#define LicenseValidationArgs_SetIntLicenseKeyValidationData LicenseValidationArgs_SetIntLicenseKeyValidationDataA +#endif + +int LicenseValidationArgs_SetStringLicenseKeyValidationDataA(void * args, const char * fieldName, const char * fieldValue); +int LicenseValidationArgs_SetStringLicenseKeyValidationDataW(void * args, const wchar_t * fieldName, const wchar_t * fieldValue); +#ifdef _UNICODE +#define LicenseValidationArgs_SetStringLicenseKeyValidationData LicenseValidationArgs_SetStringLicenseKeyValidationDataW +#else +#define LicenseValidationArgs_SetStringLicenseKeyValidationData LicenseValidationArgs_SetStringLicenseKeyValidationDataA +#endif + +int LicenseValidationArgs_SetDateLicenseKeyValidationDataA(void * args, const char * fieldName, int year, int month, int day); +int LicenseValidationArgs_SetDateLicenseKeyValidationDataW(void * args, const wchar_t * fieldName, int year, int month, int day); +#ifdef _UNICODE +#define LicenseValidationArgs_SetDateLicenseKeyValidationData LicenseValidationArgs_SetDateLicenseKeyValidationDataW +#else +#define LicenseValidationArgs_SetDateLicenseKeyValidationData LicenseValidationArgs_SetDateLicenseKeyValidationDataA +#endif + +int LicenseValidationArgs_SetLicenseKeyValidationDataA(void * args, const char * fieldName, void * data, int len); +int LicenseValidationArgs_SetLicenseKeyValidationDataW(void * args, const wchar_t * fieldName, void * data, int len); +#ifdef _UNICODE +#define LicenseValidationArgs_SetLicenseKeyValidationData LicenseValidationArgs_SetLicenseKeyValidationDataW +#else +#define LicenseValidationArgs_SetLicenseKeyValidationData LicenseValidationArgs_SetLicenseKeyValidationDataA +#endif + +void * LicensingClient_Create(void * licenseTemplate); +void LicensingClient_Destroy(void *); +int LicensingClient_SetLicenseTemplate(void * client, void * tmpl); +int LicensingClient_ValidateLicense(void * client, void * licenseValidationArgs, void ** licenseValidationResult); + +// LicenseValidationResult "class" + +int LicenseValidationResult_GetLicense(void * result, void ** license); + +int LicenseValidationResult_IsLicenseExpired(void * result); + +int LicenseValidationResult_IsPaymentRequired(void * result); + +int LicenseValidationResult_GetLicenseValidityDays(void * result); + +// Internal use + +int Certificate_SignA(const char * csr, const char * privateKey, const char * signingPrivateKey, const char * signingCertificate, const char * certificateAuthorityUrl, int expYear, int expMonth, int expDay, const char **signedCert); + +#ifdef __cplusplus +} +#endif + +#ifdef __cplusplus + +// Opaque - skip over these +class LicenseTemplateImpl; +class KeyValidatorImpl; +class KeyHelperImpl; +class KeyGeneratorImpl; +class SDKRegistrationImpl; +class LicenseImpl; +class LicenseValidationArgsImpl; +class LicenseValidationResultImpl; +class LicensingClientImpl; + +namespace ANSCENTER +{ + namespace Licensing + { + // Exceptions of this type are thrown by the license key classes + class Exception { + public: + virtual int GetCode() = 0; + virtual const char * GetExceptionMessage() = 0; + virtual void Destroy() = 0; + }; + + // This class represents a template from which a license key can be generated, + // or by which a license key can be validated (see the samples for more). + template + class LICENSING_API LicenseTemplateT { + public: + LicenseTemplateT(); + ~LicenseTemplateT(); + + static LicenseTemplateT<_XCHAR> * Create(); + static void Destroy(LicenseTemplateT<_XCHAR> *); + + void SetVersion(int version); + unsigned GetVersion(); + + // Sets the number of character groups per license key (eg. ABC-DEF-GHL has 3 character groups) + void SetNumberOfGroups(int numGroups); + unsigned GetNumberOfGroups(); + + // Sets the number of characters per group (eg. ABC-DEF-GHL-XYZ has 3 characters per group) + void SetCharactersPerGroup(int charsPerGroup); + unsigned GetCharactersPerGroup(); + + // Sets the string used as a group separator (eg. ABC-DEF-GHL has "-" as a group separator) + void SetGroupSeparator(const _XCHAR * groupSep); + const _XCHAR * GetGroupSeparator(); + + // Sets licese key encoding (BASE32 or BASE64 for now) + void SetEncoding(int encoding); + int GetEncoding(); + + void SetHeader(const _XCHAR * header); + const _XCHAR * GetHeader(); + + void SetFooter(const _XCHAR * footer); + const _XCHAR * GetFooter(); + + // Sets the total size in bits of the license key contained data, excluding the signature + void SetDataSize(int sizeInBits); + unsigned GetDataSize(); + + // Add a data field (a named sequence of bits which will be included in the license key) + void AddDataField(const _XCHAR * fieldName, int fieldType, int fieldBitSize, int offset = -1 ); + bool EnumDataFields(void **enumHandle, const _XCHAR **fieldName, int * fieldType, int * fieldSize, int * offset); + bool GetDataField(const _XCHAR *fieldName, int * fieldType, int * fieldSize, int * fieldOffset); + + // Sets the total size of the validation data in bits + // Validation data is similar to license key data above, + // But it is not included in the license key and is used only for key validation + void SetValidationDataSize(int sizeInBits); + unsigned GetValidationDataSize(); + + // Add a validation field (a named sequence of bits which will be required at validation time) + void AddValidationField(const _XCHAR * fieldName, int fieldType, int fieldBitSize, int offset = -1); + bool EnumValidationFields(void **enumHandle, const _XCHAR **fieldName, int * fieldType, int * fieldSize, int * offset); + bool GetValidationField(const _XCHAR *fieldName, int * fieldType, int * fieldSize, int * fieldOffset); + + void SetSignatureSize(int signatureSize); + unsigned GetSignatureSize(); + + // Loads a template parameters from an XML string. Very handy sometimes. + void LoadXml(const char * xmlTemplate); + + // Saves the template to an XML string. Do not free the returned string, it is statically allocated. + const char * SaveXml(bool savePrivateKey = true); + + // Loads a template parameters from a JSON string. Very handy sometimes. + void LoadJson(const char * jsonTemplate); + + // Saves the template to a JSON string. Do not free the returned string, it is statically allocated. + const char * SaveJson(bool savePrivateKey = true); + + void SetPublicKeyCertificate(const _XCHAR * base64Certificate); + + const _XCHAR * GetPublicKeyCertificate(); + + void SetPrivateKey(const _XCHAR * base64PrivateKey); + + const _XCHAR * GetPrivateKey(); + + void GenerateSigningKeyPair(); + + // Set the url of the web service used to generate keys in the absence of a local private key. This is used for license activation purposes. + void SetLicensingServiceUrl(const _XCHAR * url); + + const _XCHAR * GetLicensingServiceUrl(); + + void SetTemplateId(const _XCHAR * templateId); + + const _XCHAR * GetTemplateId(); + + void SetProperty(const _XCHAR * path, const _XCHAR * name, const _XCHAR * value); + + const _XCHAR * GetProperty(const _XCHAR * path, const _XCHAR * name); + + public: + LicenseTemplateImpl & m_Impl; + }; + + typedef LicenseTemplateT LicenseTemplateA; + typedef LicenseTemplateT LicenseTemplateW; + #ifdef _UNICODE + typedef LicenseTemplateW LicenseTemplate; + #else + typedef LicenseTemplateA LicenseTemplate; + #endif + + // This class is used to validate license keys and also to query their content + template + class LICENSING_API KeyValidatorT { + public: + KeyValidatorT(); + KeyValidatorT(const LicenseTemplateT<_XCHAR> * keyTemplate); + ~KeyValidatorT(); + + static KeyValidatorT<_XCHAR> * Create(); + static void Destroy(KeyValidatorT<_XCHAR> *); + + // Set the template used for validation (the template contains the license key format and the ECC verification key) + void SetKeyTemplate(const LicenseTemplateT<_XCHAR> & keyTemplate); + void SetKeyTemplate(const LicenseTemplateT<_XCHAR> * keyTemplate); + + // Set the license key used for validation and data query + void SetKey(const _XCHAR * key); + + void SetValidationData(const _XCHAR * fieldName, const void * buf, int len); + void SetValidationData(const _XCHAR * fieldName, const _XCHAR * data); + void SetValidationData(const _XCHAR * fieldName, int data); + + // Verifies the license key's signature using the public(verification) ECC key from the template + bool IsKeyValid(); + + // Queries the license key for data. The data is returned in raw format (a byte buffer). + void QueryKeyData(const _XCHAR * dataField, void * buf, int * len); + + int QueryIntKeyData(const _XCHAR * dataField); + + void QueryDateKeyData(const _XCHAR * dataField, int * year, int * month, int * day); + + void QueryValidationData(const _XCHAR * filedName, void * buf, int * len); + + private: + KeyValidatorImpl & m_Impl; + }; + + typedef KeyValidatorT KeyValidatorA; + typedef KeyValidatorT KeyValidatorW; + #ifdef _UNICODE + typedef KeyValidatorW KeyValidator; + #else + typedef KeyValidatorA KeyValidator; + #endif + + template + // This class is used to generate license keys and set their content + class LICENSING_API KeyGeneratorT { + public: + KeyGeneratorT(); + KeyGeneratorT(const LicenseTemplateT<_XCHAR> * keyTemplate); + ~KeyGeneratorT(); + + static KeyGeneratorT<_XCHAR> * Create(); + static void Destroy(KeyGeneratorT<_XCHAR> *); + + // Sets the template from which the license keys are generated. + void SetKeyTemplate(const LicenseTemplateT<_XCHAR> & keyTemplate); + void SetKeyTemplate(const LicenseTemplateT<_XCHAR> * keyTemplate); + + // Sets license key data fields with raw, string or integer values + void SetKeyData(const _XCHAR * fieldName, const void * data, int len); + void SetKeyData(const _XCHAR * fieldName, const _XCHAR * data); + void SetKeyData(const _XCHAR * fieldName, int data); + void SetKeyData(const _XCHAR * fieldName, int year, int month, int day); + + // Sets the validation fields. These are not included in the license key, + // but the license key validates only if these values are also used for validation + void SetValidationData(const _XCHAR * fieldName, const void * data, int len); + void SetValidationData(const _XCHAR * fieldName, const _XCHAR * data); + void SetValidationData(const _XCHAR * fieldName, int data); + + // Generates a license key. The returned string is statically + // allocated (thus it is overriden at the next call), do not try to deallocate it. + const _XCHAR * GenerateKey(); + + private: + KeyGeneratorImpl & m_Impl; + }; + + typedef KeyGeneratorT KeyGeneratorA; + typedef KeyGeneratorT KeyGeneratorW; + #ifdef _UNICODE + typedef KeyGeneratorW KeyGenerator; + #else + typedef KeyGeneratorA KeyGenerator; + #endif + + template + class LICENSING_API LicenseT + { + public: + LicenseT(); + ~LicenseT(); + + void LoadXml(const char * xml); + const char * SaveXml(); + + void LoadJson(const char * json); + const char * SaveJson(); + + void SetLicenseKey(const _XCHAR * licenseKey); + const _XCHAR * GetLicenseKey(); + + void SetLicenseKeyValidationData(void * buf, int len); + void GetLicenseKeyValidationData(void ** buf, int * len); + + void SetActivationKey(const _XCHAR * activationKey); + const _XCHAR * GetActivationKey(); + + void SetHardwareId(const _XCHAR * hardwareId); + const _XCHAR * GetHardwareId(); + + bool IsLease(); + void SetLease(bool isLease); + + public: + LicenseImpl & m_Impl; + }; + + typedef LicenseT LicenseA; + typedef LicenseT LicenseW; +#ifdef _UNICODE + typedef LicenseW License; +#else + typedef LicenseA License; +#endif + + template + class LICENSING_API LicenseValidationArgsT + { + public: + LicenseValidationArgsT(); + ~LicenseValidationArgsT(); + + void SetLicense(const LicenseT<_XCHAR> * license); + void SetLicenseKey(const _XCHAR * licenseKey); + + void SetLicenseKeyValidationData(const _XCHAR * fieldName, int fieldValue); + void SetLicenseKeyValidationData(const _XCHAR * fieldName, const _XCHAR * fieldValue); + void SetLicenseKeyValidationData(const _XCHAR * fieldName, int year, int month, int day); + void SetLicenseKeyValidationData(const _XCHAR * fieldName, void * data, int len); + + public: + LicenseValidationArgsImpl & m_Impl; + }; + + typedef LicenseValidationArgsT LicenseValidationArgsA; + typedef LicenseValidationArgsT LicenseValidationArgsW; +#ifdef _UNICODE + typedef LicenseValidationArgsW LicenseValidationArgs; +#else + typedef LicenseValidationArgsA LicenseValidationArgs; +#endif + + template + class LICENSING_API LicenseValidationResultT + { + public: + LicenseValidationResultT(); + ~LicenseValidationResultT(); + + LicenseT<_XCHAR> * GetLicense(); + bool IsLicenseExpired(); + bool IsPaymentRequired(); + int GetLicenseValidityDays(); + void GetLicenseExpirationDate(int * year, int * month, int * day); + + public: + LicenseValidationResultImpl & m_Impl; + }; + + typedef LicenseValidationResultT LicenseValidationResultA; + typedef LicenseValidationResultT LicenseValidationResultW; +#ifdef _UNICODE + typedef LicenseValidationResultW LicenseValidationResult; +#else + typedef LicenseValidationResultA LicenseValidationResult; +#endif + + template + class LICENSING_API LicensingClientT + { + public: + LicensingClientT(); + ~LicensingClientT(); + + void SetLicensingServiceUrl(const _XCHAR * url); + + void SetLicenseTemplate(LicenseTemplateT<_XCHAR> * tmpl); + void SetLicenseKey(const _XCHAR * key); + + void SetActivationKey(const _XCHAR * key); + const _XCHAR * GetActivationKey(); + + void SetHardwareId(const _XCHAR * hardwareId); + const _XCHAR * GetHardwareId(); + + void SetLicenseKeyValidationData(void * buf, int len); + void SetLicenseTemplateId(const _XCHAR * templateId); + + bool IsLicenseValid(); + + void AcquireLicense(); + + LicenseValidationResultT<_XCHAR> * ValidateLicense(LicenseValidationArgsT<_XCHAR> * args); + + int GetLicenseActivationStatus(); + + void GetLicenseExpirationDate(int * year, int * month, int * day); + + void SetTimeValidationMethod(int method); // method = [PREFER_INTERNET_TIME (default) | USE_INTERNET_TIME | USE_LOCAL_TIME] + + virtual const _XCHAR * GetCurrentHardwareId(); + virtual bool MatchCurrentHardwareId(const _XCHAR * hardwareId); + + private: + LicensingClientImpl & m_Impl; + }; + + typedef LicensingClientT LicensingClientA; + typedef LicensingClientT LicensingClientW; + #ifdef _UNICODE + typedef LicensingClientW LicensingClient; + #else + typedef LicensingClientA LicensingClient; + #endif + + template< typename _XCHAR > + class LICENSING_API KeyHelperT + { + public: + static const _XCHAR * GetCurrentHardwareId(); + static bool MatchCurrentHardwareId(const _XCHAR * hwid); + static bool DetectClockManipulation(int thresholdYear, int thresholdMonth, int thresholdDay); + }; + + typedef KeyHelperT KeyHelperA; + typedef KeyHelperT KeyHelperW; + #ifdef _UNICODE + typedef KeyHelperW KeyHelper; + #else + typedef KeyHelperA KeyHelper; + #endif + + template< typename _XCHAR > + class LICENSING_API SDKRegistrationT + { + public: + static void SetLicenseKey(const _XCHAR * key); + + private: + static SDKRegistrationImpl & m_Impl; + }; + + typedef SDKRegistrationT SDKRegistrationA; + typedef SDKRegistrationT SDKRegistrationW; + #ifdef _UNICODE + typedef SDKRegistrationW SDKRegistration; + #else + typedef SDKRegistrationA SDKRegistration; + #endif + + class LICENSING_API ANSUtility + { + public: + static const char * WString2String(const wchar_t * inputString); + static const wchar_t * String2WString(const char * inputString); + static const char* EncodeBase64Utility(unsigned char* buf, int len, bool padding); + static const char* DecodeBase64Utility(const char* input, int len = -1, int* outlen = nullptr); + }; + }; +}; + +using namespace ANSCENTER::Licensing; + +#endif /* __cplusplus */ +#endif + + diff --git a/include/licensing.h b/include/licensing.h new file mode 100644 index 0000000..fe474aa --- /dev/null +++ b/include/licensing.h @@ -0,0 +1,912 @@ +#ifndef __ANSCENTER_LICENSING_H +#define __ANSCENTER_LICENSING_H + +#include + +// Error codes for license key library exceptions +#define STATUS_SUCCESS 0 +#define STATUS_GENERIC_ERROR 1 +#define STATUS_OUT_OF_MEMORY 2 +#define STATUS_FIELD_NOT_FOUND 3 +#define STATUS_BUFFER_TOO_SMALL 4 +#define STATUS_INVALID_XML 5 +#define STATUS_INVALID_LICENSE_KEY 6 +#define STATUS_INVALID_KEY_ENCODING 7 +#define STATUS_INVALID_PARAM 8 +#define STATUS_INVALID_SIGNATURE_SIZE 9 +#define STATUS_UNSUPPORTED_VERSION 10 +#define STATUS_NET_ERROR 11 +#define STATUS_INVALID_HARDWARE_ID 12 +#define STATUS_LICENSE_EXPIRED 13 +#define STATUS_INVALID_ACTIVATION_KEY 14 +#define STATUS_PAYMENT_REQUIRED 15 + +// License key textual encoding - a slightly modified version of BASE32 or BASE64 in order to omit confusing characters like o, i, 1, etc. +#define ENCODING_BASE32X 5 +#define ENCODING_BASE64X 6 + +// Data or validation field types +#define FIELD_TYPE_RAW 0 +#define FIELD_TYPE_INTEGER 1 +#define FIELD_TYPE_STRING 2 +#define FIELD_TYPE_DATE14 3 +#define FIELD_TYPE_DATE16 4 +#define FIELD_TYPE_DATE13 5 + +#define PREFER_INTERNET_TIME 0 +#define USE_INTERNET_TIME 1 +#define USE_LOCAL_TIME 2 + +#ifdef _WIN32 + +#ifndef LICENSING_STATIC +#ifdef LICENSING_EXPORTS +#define LICENSING_API __declspec(dllexport) +#define LICENSEKEY_EXTINT +#else +#define LICENSING_API __declspec(dllimport) +#define LICENSEKEY_EXTINT +#endif +#else +#define LICENSING_API +#endif + +#else // !_WIN32 + +#define LICENSING_API + +#endif + +#ifdef __cplusplus +extern "C" +{ +#endif + +void * KeyGenerator_Create(); +void KeyGenerator_Destroy(void * generator); +int KeyGenerator_SetKeyTemplate(void * generator, const void * tmpl); + +int KeyGenerator_SetKeyDataA(void * generator, const char * fieldName, const void * data, int len); +int KeyGenerator_SetKeyDataW(void * generator, const wchar_t * fieldName, const void * data, int len); +#ifdef _UNICODE +#define KeyGenerator_SetKeyData KeyGenerator_SetKeyDataW +#else +#define KeyGenerator_SetKeyData KeyGenerator_SetKeyDataA +#endif + +int KeyGenerator_SetIntKeyDataA(void * generator, const char * fieldName, int data); +int KeyGenerator_SetIntKeyDataW(void * generator, const wchar_t * fieldName, int data); +#ifdef _UNICODE +#define KeyGenerator_SetIntKeyData KeyGenerator_SetIntKeyDataW +#else +#define KeyGenerator_SetIntKeyData KeyGenerator_SetIntKeyDataA +#endif + +int KeyGenerator_SetStringKeyDataA(void * generator, const char * fieldName, const char * data); +int KeyGenerator_SetStringKeyDataW(void * generator, const wchar_t * fieldName, const wchar_t * data); +#ifdef _UNICODE +#define KeyGenerator_SetStringKeyData KeyGenerator_SetStringKeyDataW +#else +#define KeyGenerator_SetStringKeyData KeyGenerator_SetStringKeyDataA +#endif + +int KeyGenerator_SetDateKeyDataA(void * generator, const char * fieldName, int year, int month, int day); +int KeyGenerator_SetDateKeyDataW(void * generator, const wchar_t * fieldName, int year, int month, int day); +#ifdef _UNICODE +#define KeyGenerator_SetDateKeyData KeyGenerator_SetDateKeyDataW +#else +#define KeyGenerator_SetDateKeyData KeyGenerator_SetDateKeyDataA +#endif + +int KeyGenerator_SetValidationDataA(void * generator, const char * fieldName, const void * buf, int len); +int KeyGenerator_SetValidationDataW(void * generator, const wchar_t * fieldName, const void * buf, int len); +#ifdef _UNICODE +#define KeyGenerator_SetValidationData KeyGenerator_SetValidationDataW +#else +#define KeyGenerator_SetValidationData KeyGenerator_SetValidationDataA +#endif + +int KeyGenerator_SetIntValidationDataA(void * generator, const char * fieldName, int data); +int KeyGenerator_SetIntValidationDataW(void * generator, const wchar_t * fieldName, int data); +#ifdef _UNICODE +#define KeyGenerator_SetIntValidationData KeyGenerator_SetIntValidationDataW +#else +#define KeyGenerator_SetIntValidationData KeyGenerator_SetIntValidationDataA +#endif + +int KeyGenerator_SetStringValidationDataA(void * generator, const char * fieldName, const char * data); +int KeyGenerator_SetStringValidationDataW(void * generator, const wchar_t * fieldName, const wchar_t * data); +#ifdef _UNICODE +#define KeyGenerator_SetStringValidationData KeyGenerator_SetStringValidationDataW +#else +#define KeyGenerator_SetStringValidationData KeyGenerator_SetStringValidationDataA +#endif + +int KeyGenerator_GenerateKeyA(void * generator, const char **key); +int KeyGenerator_GenerateKeyW(void * generator, const wchar_t **key); +#ifdef _UNICODE +#define KeyGenerator_GenerateKey KeyGenerator_GenerateKeyW +#else +#define KeyGenerator_GenerateKey KeyGenerator_GenerateKeyA +#endif + +void * KeyValidator_Create(); +void KeyValidator_Destroy(void * validator); +int KeyValidator_SetKeyTemplate(void * validator, const void * tmpl); + +int KeyValidator_SetKeyA(void * validator, const char * key); +int KeyValidator_SetKeyW(void * validator, const wchar_t * key); +#ifdef _UNICODE +#define KeyValidator_SetKey KeyValidator_SetKeyW +#else +#define KeyValidator_SetKey KeyValidator_SetKeyA +#endif + +int KeyValidator_SetValidationDataA(void * validator, const char * fieldName, const void * buf, int len); +int KeyValidator_SetValidationDataW(void * validator, const wchar_t * fieldName, const void * buf, int len); +#ifdef _UNICODE +#define KeyValidator_SetValidationData KeyValidator_SetValidationDataW +#else +#define KeyValidator_SetValidationData KeyValidator_SetValidationDataA +#endif + +int KeyValidator_SetIntValidationDataA(void * validator, const char * fieldName, int data); +int KeyValidator_SetIntValidationDataW(void * validator, const wchar_t * fieldName, int data); +#ifdef _UNICODE +#define KeyValidator_SetIntValidationData KeyValidator_SetIntValidationDataW +#else +#define KeyValidator_SetIntValidationData KeyValidator_SetIntValidationDataA +#endif + +int KeyValidator_SetStringValidationDataA(void * validator, const char * fieldName, const char * data); +int KeyValidator_SetStringValidationDataW(void * validator, const wchar_t * fieldName, const wchar_t * data); +#ifdef _UNICODE +#define KeyValidator_SetStringValidationData KeyValidator_SetStringValidationDataW +#else +#define KeyValidator_SetStringValidationData KeyValidator_SetStringValidationDataA +#endif + +int KeyValidator_IsKeyValid(void * validator); + +int KeyValidator_QueryKeyDataA(void * validator, const char * dataField, void * buf, int * len); +int KeyValidator_QueryKeyDataW(void * validator, const wchar_t * dataField, void * buf, int * len); +#ifdef _UNICODE +#define KeyValidator_QueryKeyData KeyValidator_QueryKeyDataW +#else +#define KeyValidator_QueryKeyData KeyValidator_QueryKeyDataA +#endif + +int KeyValidator_QueryIntKeyDataA(void * validator, const char * dataField, int * data); +int KeyValidator_QueryIntKeyDataW(void * validator, const char * dataField, int * data); +#ifdef _UNICODE +#define KeyValidator_QueryIntKeyData KeyValidator_QueryIntKeyDataW +#else +#define KeyValidator_QueryIntKeyData KeyValidator_QueryIntKeyDataA +#endif + +int KeyValidator_QueryDateKeyDataA(void * validator, const char * dataField, int * year, int * month, int * day); +int KeyValidator_QueryDateKeyDataW(void * validator, const wchar_t * dataField, int * year, int * month, int * day); +#ifdef _UNICODE +#define KeyValidator_QueryDateKeyData KeyValidator_QueryDateKeyDataW +#else +#define KeyValidator_QueryDateKeyData KeyValidator_QueryDateKeyDataA +#endif + +int KeyValidator_QueryValidationDataA(void * validator, const char * dataField, void * buf, int * len); +int KeyValidator_QueryValidationDataW(void * validator, const wchar_t * dataField, void * buf, int * len); +#ifdef _UNICODE +#define KeyValidator_QueryValidationData KeyValidator_QueryValidationDataW +#else +#define KeyValidator_QueryValidationData KeyValidator_QueryValidationDataA +#endif + +void * LicenseTemplate_Create(); +void LicenseTemplate_Destroy(void * tmpl); + +int LicenseTemplate_SetVersion(void * tmpl, int version); +int LicenseTemplate_GetVersion(void * tmpl, int * version); +int LicenseTemplate_SetNumberOfGroups(void * tmpl, int numGroups); +int LicenseTemplate_GetNumberOfGroups(void * tmpl, int * numGroups); +int LicenseTemplate_SetCharactersPerGroup(void * tmpl, int charsPerGroup); +int LicenseTemplate_GetCharactersPerGroup(void * tmpl, int * charsPerGroup); + +int LicenseTemplate_SetGroupSeparatorA(void * tmpl, const char * groupSep); +int LicenseTemplate_SetGroupSeparatorW(void * tmpl, const wchar_t * groupSep); +#ifdef _UNICODE +#define LicenseTemplate_SetGroupSeparator LicenseTemplate_SetGroupSeparatorW +#else +#define LicenseTemplate_SetGroupSeparator LicenseTemplate_SetGroupSeparatorA +#endif + +int LicenseTemplate_GetGroupSeparatorA(void * tmpl, const char **groupSep); +int LicenseTemplate_GetGroupSeparatorW(void * tmpl, const wchar_t **groupSep); +#ifdef _UNICODE +#define LicenseTemplate_GetGroupSeparator LicenseTemplate_GetGroupSeparatorW +#else +#define LicenseTemplate_GetGroupSeparator LicenseTemplate_GetGroupSeparatorA +#endif + +int LicenseTemplate_SetEncoding(void * tmpl, int encoding); +int LicenseTemplate_GetEncoding(void * tmpl, int * encoding); + +int LicenseTemplate_SetHeaderA(void * tmpl, const char * header); +int LicenseTemplate_SetHeaderW(void * tmpl, const wchar_t * header); +#ifdef _UNICODE +#define LicenseTemplate_SetHeader LicenseTemplate_SetHeaderW +#else +#define LicenseTemplate_SetHeader LicenseTemplate_SetHeaderA +#endif + +int LicenseTemplate_GetHeaderA(void * tmpl, const char** header); +int LicenseTemplate_GetHeaderW(void * tmpl, const wchar_t** header); +#ifdef _UNICODE +#define LicenseTemplate_GetHeader LicenseTemplate_GetHeaderW +#else +#define LicenseTemplate_GetHeader LicenseTemplate_GetHeaderA +#endif + +int LicenseTemplate_SetFooterA(void * tmpl, const char * footer); +int LicenseTemplate_SetFooterW(void * tmpl, const wchar_t * footer); +#ifdef _UNICODE +#define LicenseTemplate_SetFooter LicenseTemplate_SetFooterW +#else +#define LicenseTemplate_SetFooter LicenseTemplate_SetFooterA +#endif + +int LicenseTemplate_GetFooterA(void * tmpl, const char **footer); +int LicenseTemplate_GetFooterW(void * tmpl, const wchar_t **footer); +#ifdef _UNICODE +#define LicenseTemplate_GetFooter LicenseTemplate_GetFooterW +#else +#define LicenseTemplate_GetFooter LicenseTemplate_GetFooterA +#endif + +int LicenseTemplate_SetDataSize(void * tmpl, int sizeInBits); +int LicenseTemplate_GetDataSize(void * tmpl, int * sizeInBits); + +int LicenseTemplate_AddDataFieldA(void * tmpl, const char * fieldName, int fieldType, int fieldBitSize, int fieldOffset); +int LicenseTemplate_AddDataFieldW(void * tmpl, const wchar_t * fieldName, int fieldType, int fieldBitSize, int fieldOffset); +#ifdef _UNICODE +#define LicenseTemplate_AddDataField LicenseTemplate_AddDataFieldW +#else +#define LicenseTemplate_AddDataField LicenseTemplate_AddDataFieldA +#endif + +int LicenseTemplate_GetDataFieldA(void * tmpl, const char *fieldName, int * fieldType, int * fieldSize, int * fieldOffset); +int LicenseTemplate_GetDataFieldW(void * tmpl, const wchar_t *fieldName, int * fieldType, int * fieldSize, int * fieldOffset); +#ifdef _UNICODE +#define LicenseTemplate_GetDataField LicenseTemplate_GetDataFieldW +#else +#define LicenseTemplate_GetDataField LicenseTemplate_GetDataFieldA +#endif + +int LicenseTemplate_EnumDataFieldsA(void * tmpl, void **enumHandle, const char **fieldName, int * fieldType, int * fieldSize, int * fieldOffset); +int LicenseTemplate_EnumDataFieldsW(void * tmpl, void **enumHandle, const wchar_t **fieldName, int * fieldType, int * fieldSize, int * fieldOffset); +#ifdef _UNICODE +#define LicenseTemplate_EnumDataFields LicenseTemplate_EnumDataFieldsW +#else +#define LicenseTemplate_EnumDataFields LicenseTemplate_EnumDataFieldsA +#endif + +int LicenseTemplate_SetValidationDataSize(void * tmpl, int sizeInBits); +int LicenseTemplate_GetValidationDataSize(void * tmpl, int * sizeInBits); + +int LicenseTemplate_AddValidationFieldA(void * tmpl, const char * fieldName, int fieldType, int fieldBitSize, int fieldOffset); +int LicenseTemplate_AddValidationFieldW(void * tmpl, const wchar_t * fieldName, int fieldType, int fieldBitSize, int fieldOffset); +#ifdef _UNICODE +#define LicenseTemplate_AddValidationField LicenseTemplate_AddValidationFieldW +#else +#define LicenseTemplate_AddValidationField LicenseTemplate_AddValidationFieldA +#endif + +int LicenseTemplate_GetValidationFieldA(void * tmpl, const char *fieldName, int * fieldType, int * fieldSize, int * fieldOffset); +int LicenseTemplate_GetValidationFieldW(void * tmpl, const wchar_t *fieldName, int * fieldType, int * fieldSize, int * fieldOffset); +#ifdef _UNICODE +#define LicenseTemplate_GetValidationField LicenseTemplate_GetValidationFieldW +#else +#define LicenseTemplate_GetValidationField LicenseTemplate_GetValidationFieldA +#endif + +int LicenseTemplate_EnumValidationFieldsA(void * tmpl, void **enumHandle, const char * fieldName, int * fieldType, int * fieldSize, int * fieldOffset); +int LicenseTemplate_EnumValidationFieldsW(void * tmpl, void **enumHandle, const wchar_t * fieldName, int * fieldType, int * fieldSize, int * fieldOffset); +#ifdef _UNICODE +#define LicenseTemplate_EnumValidationFields LicenseTemplate_EnumValidationFieldsW +#else +#define LicenseTemplate_EnumValidationFields LicenseTemplate_EnumValidationFieldsA +#endif + +int LicenseTemplate_SetSignatureSize(void * tmpl, int signatureSize); +int LicenseTemplate_GetSignatureSize(void * tmpl, int * signatureSize); + +int LicenseTemplate_LoadXml(void * tmpl, const char * xmlTemplate); +int LicenseTemplate_SaveXml(void * tmpl, int savePrivateKey, const char **xmlString); + +int LicenseTemplate_LoadJson(void * tmpl, const char * jsonTemplate); +int LicenseTemplate_SaveJson(void * tmpl, int savePrivateKey, const char **jsonString); + +int LicenseTemplate_SetPublicKeyCertificateA(void * tmpl, const char * base64PublicKey); +int LicenseTemplate_SetPublicKeyCertificateW(void * tmpl, const wchar_t * base64PublicKey); +#ifdef _UNICODE +#define LicenseTemplate_SetPublicKeyCertificate LicenseTemplate_SetPublicKeyCertificateW +#else +#define LicenseTemplate_SetPublicKeyCertificate LicenseTemplate_SetPublicKeyCertificateA +#endif + +int LicenseTemplate_GetPublicKeyCertificateA(void * tmpl, const char **publicKey); +int LicenseTemplate_GetPublicKeyCertificateW(void * tmpl, const wchar_t **publicKey); +#ifdef _UNICODE +#define LicenseTemplate_GetPublicKeyCertificate KeyHelper_GetPublicKeyCertificateW +#else +#define LicenseTemplate_GetPublicKeyCertificate KeyHelper_GetPublicKeyCertificateA +#endif + +int LicenseTemplate_SetPrivateKeyA(void * tmpl, const char * base64PrivateKey); +int LicenseTemplate_SetPrivateKeyW(void * tmpl, const wchar_t * base64PrivateKey); +#ifdef _UNICODE +#define LicenseTemplate_SetPrivateKey LicenseTemplate_SetPrivateKeyW +#else +#define LicenseTemplate_SetPrivateKey LicenseTemplate_SetPrivateKeyA +#endif + +int LicenseTemplate_GetPrivateKeyA(void * tmpl, const char **privateKey); +int LicenseTemplate_GetPrivateKeyW(void * tmpl, const wchar_t **privateKey); +#ifdef _UNICODE +#define LicenseTemplate_GetPrivateKey KeyHelper_GetPrivateKeyW +#else +#define LicenseTemplate_GetPrivateKey KeyHelper_GetPrivateKeyA +#endif + +int LicenseTemplate_GenerateSigningKeyPair(void * tmpl); + +int LicenseTemplate_SetLicensingServiceUrlA(void * tmpl, const char * url); +int LicenseTemplate_SetLicensingServiceUrlW(void * tmpl, const wchar_t * url); +#ifdef _UNICODE +#define LicenseTemplate_SetLicensingServiceUrl LicenseTemplate_SetLicensingServiceUrlW +#else +#define LicenseTemplate_SetLicensingServiceUrl LicenseTemplate_SetLicensingServiceUrlA +#endif + +int LicenseTemplate_GetLicensingServiceUrlA(void * tmpl, const char **url); +int LicenseTemplate_GetLicensingServiceUrlW(void * tmpl, const wchar_t **url); +#ifdef _UNICODE +#define LicenseTemplate_GetLicensingServiceUrl LicenseTemplate_GetLicensingServiceUrlW +#else +#define LicenseTemplate_GetLicensingServiceUrl LicenseTemplate_GetLicensingServiceUrlA +#endif + +int LicenseTemplate_SetTemplateIdA(void * tmpl, const char * templateId); +int LicenseTemplate_SetTemplateIdW(void * tmpl, const wchar_t * templateId); +#ifdef _UNICODE +#define LicenseTemplate_SetTemplateId LicenseTemplate_SetTemplateIdW +#else +#define LicenseTemplate_SetTemplateId LicenseTemplate_SetTemplateIdA +#endif + +int LicenseTemplate_GetTemplateIdA(void * tmpl, const char **templateId); +int LicenseTemplate_GetTemplateIdW(void * tmpl, const wchar_t **templateId); +#ifdef _UNICODE +#define LicenseTemplate_GetTemplateId LicenseTemplate_GetTemplateIdW +#else +#define LicenseTemplate_GetTemplateId LicenseTemplate_GetTemplateIdA +#endif + +int KeyHelper_GetCurrentHardwareIdA(const char **hwid); +int KeyHelper_GetCurrentHardwareIdW(const wchar_t **hwid); +#ifdef _UNICODE +#define KeyHelper_GetCurrentHardwareId KeyHelper_GetCurrentHardwareIdW +#else +#define KeyHelper_GetCurrentHardwareId KeyHelper_GetCurrentHardwareIdA +#endif + +int KeyHelper_MatchCurrentHardwareIdA(const char **hwid); +int KeyHelper_MatchCurrentHardwareIdW(const wchar_t **hwid); +#ifdef _UNICODE +#define KeyHelper_MatchCurrentHardwareId KeyHelper_MatchCurrentHardwareIdW +#else +#define KeyHelper_MatchCurrentHardwareId KeyHelper_MatchCurrentHardwareIdA +#endif + +int SDKRegistration_SetLicenseKeyA(const char * key); +int SDKRegistration_SetLicenseKeyW(const wchar_t * key); +#ifdef _UNICODE +#define SDKRegistration_SetLicenseKey SDKRegistration_SetLicenseKeyW +#else +#define SDKRegistration_SetLicenseKey SDKRegistration_SetLicenseKeyA +#endif + +void LicenseTemplate_SetPropertyA(const char * path, const char * name, const char * value); +void LicenseTemplate_SetPropertyW(const wchar_t * path, const wchar_t * name, const wchar_t * value); +#ifdef _UNICODE +#define LicenseTemplate_SetProperty LicenseTemplate_SetPropertyW +#else +#define LicenseTemplate_SetProperty LicenseTemplate_SetPropertyA +#endif + +const char * LicenseTemplate_GetPropertyA(const char *path, const char *name); +const wchar_t * LicenseTemplate_GetPropertyW(const wchar_t *path, const wchar_t*name); +#ifdef _UNICODE +#define LicenseTemplate_GetProperty LicenseTemplate_GetPropertyW +#else +#define LicenseTemplate_GetProperty LicenseTemplate_GetPropertyA +#endif + +// License class + +void * License_Create(); +void License_Destroy(void *); + +int License_LoadXml(void *, const char * xml); +int License_SaveXml(void * license, const char **xml); + +int License_LoadJson(void *, const char * json); +int License_SaveJson(void * license, const char **json); + +// LicenseValidationArgs class + +void * LicenseValidationArgs_CreateA(void * license, char * licenseKey); +void * LicenseValidationArgs_CreateW(void * license, wchar_t * licenseKey); +#ifdef _UNICODE +#define LicenseValidationArgs_Create LicenseValidationArgs_CreateW +#else +#define LicenseValidationArgs_Create LicenseValidationArgs_CreateA +#endif +void LicenseValidationArgs_Destroy(void*); + +int LicenseValidationArgs_SetIntLicenseKeyValidationDataA(void * args, const char * fieldName, int fieldValue); +int LicenseValidationArgs_SetIntLicenseKeyValidationDataW(void * args, const wchar_t * fieldName, int fieldValue); +#ifdef _UNICODE +#define LicenseValidationArgs_SetIntLicenseKeyValidationData LicenseValidationArgs_SetIntLicenseKeyValidationDataW +#else +#define LicenseValidationArgs_SetIntLicenseKeyValidationData LicenseValidationArgs_SetIntLicenseKeyValidationDataA +#endif + +int LicenseValidationArgs_SetStringLicenseKeyValidationDataA(void * args, const char * fieldName, const char * fieldValue); +int LicenseValidationArgs_SetStringLicenseKeyValidationDataW(void * args, const wchar_t * fieldName, const wchar_t * fieldValue); +#ifdef _UNICODE +#define LicenseValidationArgs_SetStringLicenseKeyValidationData LicenseValidationArgs_SetStringLicenseKeyValidationDataW +#else +#define LicenseValidationArgs_SetStringLicenseKeyValidationData LicenseValidationArgs_SetStringLicenseKeyValidationDataA +#endif + +int LicenseValidationArgs_SetDateLicenseKeyValidationDataA(void * args, const char * fieldName, int year, int month, int day); +int LicenseValidationArgs_SetDateLicenseKeyValidationDataW(void * args, const wchar_t * fieldName, int year, int month, int day); +#ifdef _UNICODE +#define LicenseValidationArgs_SetDateLicenseKeyValidationData LicenseValidationArgs_SetDateLicenseKeyValidationDataW +#else +#define LicenseValidationArgs_SetDateLicenseKeyValidationData LicenseValidationArgs_SetDateLicenseKeyValidationDataA +#endif + +int LicenseValidationArgs_SetLicenseKeyValidationDataA(void * args, const char * fieldName, void * data, int len); +int LicenseValidationArgs_SetLicenseKeyValidationDataW(void * args, const wchar_t * fieldName, void * data, int len); +#ifdef _UNICODE +#define LicenseValidationArgs_SetLicenseKeyValidationData LicenseValidationArgs_SetLicenseKeyValidationDataW +#else +#define LicenseValidationArgs_SetLicenseKeyValidationData LicenseValidationArgs_SetLicenseKeyValidationDataA +#endif + +void * LicensingClient_Create(void * licenseTemplate); +void LicensingClient_Destroy(void *); +int LicensingClient_SetLicenseTemplate(void * client, void * tmpl); +int LicensingClient_ValidateLicense(void * client, void * licenseValidationArgs, void ** licenseValidationResult); + +// LicenseValidationResult "class" + +int LicenseValidationResult_GetLicense(void * result, void ** license); + +int LicenseValidationResult_IsLicenseExpired(void * result); + +int LicenseValidationResult_IsPaymentRequired(void * result); + +int LicenseValidationResult_GetLicenseValidityDays(void * result); + +// Internal use + +int Certificate_SignA(const char * csr, const char * privateKey, const char * signingPrivateKey, const char * signingCertificate, const char * certificateAuthorityUrl, int expYear, int expMonth, int expDay, const char **signedCert); + +#ifdef __cplusplus +} +#endif + +#ifdef __cplusplus + +// Opaque - skip over these +class LicenseTemplateImpl; +class KeyValidatorImpl; +class KeyHelperImpl; +class KeyGeneratorImpl; +class SDKRegistrationImpl; +class LicenseImpl; +class LicenseValidationArgsImpl; +class LicenseValidationResultImpl; +class LicensingClientImpl; + +namespace ANSCENTER +{ + namespace Licensing + { + // Exceptions of this type are thrown by the license key classes + class Exception { + public: + virtual int GetCode() = 0; + virtual const char * GetExceptionMessage() = 0; + virtual void Destroy() = 0; + }; + + // This class represents a template from which a license key can be generated, + // or by which a license key can be validated (see the samples for more). + template + class LICENSING_API LicenseTemplateT { + public: + LicenseTemplateT(); + ~LicenseTemplateT(); + + static LicenseTemplateT<_XCHAR> * Create(); + static void Destroy(LicenseTemplateT<_XCHAR> *); + + void SetVersion(int version); + unsigned GetVersion(); + + // Sets the number of character groups per license key (eg. ABC-DEF-GHL has 3 character groups) + void SetNumberOfGroups(int numGroups); + unsigned GetNumberOfGroups(); + + // Sets the number of characters per group (eg. ABC-DEF-GHL-XYZ has 3 characters per group) + void SetCharactersPerGroup(int charsPerGroup); + unsigned GetCharactersPerGroup(); + + // Sets the string used as a group separator (eg. ABC-DEF-GHL has "-" as a group separator) + void SetGroupSeparator(const _XCHAR * groupSep); + const _XCHAR * GetGroupSeparator(); + + // Sets licese key encoding (BASE32 or BASE64 for now) + void SetEncoding(int encoding); + int GetEncoding(); + + void SetHeader(const _XCHAR * header); + const _XCHAR * GetHeader(); + + void SetFooter(const _XCHAR * footer); + const _XCHAR * GetFooter(); + + // Sets the total size in bits of the license key contained data, excluding the signature + void SetDataSize(int sizeInBits); + unsigned GetDataSize(); + + // Add a data field (a named sequence of bits which will be included in the license key) + void AddDataField(const _XCHAR * fieldName, int fieldType, int fieldBitSize, int offset = -1 ); + bool EnumDataFields(void **enumHandle, const _XCHAR **fieldName, int * fieldType, int * fieldSize, int * offset); + bool GetDataField(const _XCHAR *fieldName, int * fieldType, int * fieldSize, int * fieldOffset); + + // Sets the total size of the validation data in bits + // Validation data is similar to license key data above, + // But it is not included in the license key and is used only for key validation + void SetValidationDataSize(int sizeInBits); + unsigned GetValidationDataSize(); + + // Add a validation field (a named sequence of bits which will be required at validation time) + void AddValidationField(const _XCHAR * fieldName, int fieldType, int fieldBitSize, int offset = -1); + bool EnumValidationFields(void **enumHandle, const _XCHAR **fieldName, int * fieldType, int * fieldSize, int * offset); + bool GetValidationField(const _XCHAR *fieldName, int * fieldType, int * fieldSize, int * fieldOffset); + + void SetSignatureSize(int signatureSize); + unsigned GetSignatureSize(); + + // Loads a template parameters from an XML string. Very handy sometimes. + void LoadXml(const char * xmlTemplate); + + // Saves the template to an XML string. Do not free the returned string, it is statically allocated. + const char * SaveXml(bool savePrivateKey = true); + + // Loads a template parameters from a JSON string. Very handy sometimes. + void LoadJson(const char * jsonTemplate); + + // Saves the template to a JSON string. Do not free the returned string, it is statically allocated. + const char * SaveJson(bool savePrivateKey = true); + + void SetPublicKeyCertificate(const _XCHAR * base64Certificate); + + const _XCHAR * GetPublicKeyCertificate(); + + void SetPrivateKey(const _XCHAR * base64PrivateKey); + + const _XCHAR * GetPrivateKey(); + + void GenerateSigningKeyPair(); + + // Set the url of the web service used to generate keys in the absence of a local private key. This is used for license activation purposes. + void SetLicensingServiceUrl(const _XCHAR * url); + + const _XCHAR * GetLicensingServiceUrl(); + + void SetTemplateId(const _XCHAR * templateId); + + const _XCHAR * GetTemplateId(); + + void SetProperty(const _XCHAR * path, const _XCHAR * name, const _XCHAR * value); + + const _XCHAR * GetProperty(const _XCHAR * path, const _XCHAR * name); + + public: + LicenseTemplateImpl & m_Impl; + }; + + typedef LicenseTemplateT LicenseTemplateA; + typedef LicenseTemplateT LicenseTemplateW; + #ifdef _UNICODE + typedef LicenseTemplateW LicenseTemplate; + #else + typedef LicenseTemplateA LicenseTemplate; + #endif + + // This class is used to validate license keys and also to query their content + template + class LICENSING_API KeyValidatorT { + public: + KeyValidatorT(); + KeyValidatorT(const LicenseTemplateT<_XCHAR> * keyTemplate); + ~KeyValidatorT(); + + static KeyValidatorT<_XCHAR> * Create(); + static void Destroy(KeyValidatorT<_XCHAR> *); + + // Set the template used for validation (the template contains the license key format and the ECC verification key) + void SetKeyTemplate(const LicenseTemplateT<_XCHAR> & keyTemplate); + void SetKeyTemplate(const LicenseTemplateT<_XCHAR> * keyTemplate); + + // Set the license key used for validation and data query + void SetKey(const _XCHAR * key); + + void SetValidationData(const _XCHAR * fieldName, const void * buf, int len); + void SetValidationData(const _XCHAR * fieldName, const _XCHAR * data); + void SetValidationData(const _XCHAR * fieldName, int data); + + // Verifies the license key's signature using the public(verification) ECC key from the template + bool IsKeyValid(); + + // Queries the license key for data. The data is returned in raw format (a byte buffer). + void QueryKeyData(const _XCHAR * dataField, void * buf, int * len); + + int QueryIntKeyData(const _XCHAR * dataField); + + void QueryDateKeyData(const _XCHAR * dataField, int * year, int * month, int * day); + + void QueryValidationData(const _XCHAR * filedName, void * buf, int * len); + + private: + KeyValidatorImpl & m_Impl; + }; + + typedef KeyValidatorT KeyValidatorA; + typedef KeyValidatorT KeyValidatorW; + #ifdef _UNICODE + typedef KeyValidatorW KeyValidator; + #else + typedef KeyValidatorA KeyValidator; + #endif + + template + // This class is used to generate license keys and set their content + class LICENSING_API KeyGeneratorT { + public: + KeyGeneratorT(); + KeyGeneratorT(const LicenseTemplateT<_XCHAR> * keyTemplate); + ~KeyGeneratorT(); + + static KeyGeneratorT<_XCHAR> * Create(); + static void Destroy(KeyGeneratorT<_XCHAR> *); + + // Sets the template from which the license keys are generated. + void SetKeyTemplate(const LicenseTemplateT<_XCHAR> & keyTemplate); + void SetKeyTemplate(const LicenseTemplateT<_XCHAR> * keyTemplate); + + // Sets license key data fields with raw, string or integer values + void SetKeyData(const _XCHAR * fieldName, const void * data, int len); + void SetKeyData(const _XCHAR * fieldName, const _XCHAR * data); + void SetKeyData(const _XCHAR * fieldName, int data); + void SetKeyData(const _XCHAR * fieldName, int year, int month, int day); + + // Sets the validation fields. These are not included in the license key, + // but the license key validates only if these values are also used for validation + void SetValidationData(const _XCHAR * fieldName, const void * data, int len); + void SetValidationData(const _XCHAR * fieldName, const _XCHAR * data); + void SetValidationData(const _XCHAR * fieldName, int data); + + // Generates a license key. The returned string is statically + // allocated (thus it is overriden at the next call), do not try to deallocate it. + const _XCHAR * GenerateKey(); + + private: + KeyGeneratorImpl & m_Impl; + }; + + typedef KeyGeneratorT KeyGeneratorA; + typedef KeyGeneratorT KeyGeneratorW; + #ifdef _UNICODE + typedef KeyGeneratorW KeyGenerator; + #else + typedef KeyGeneratorA KeyGenerator; + #endif + + template + class LICENSING_API LicenseT + { + public: + LicenseT(); + ~LicenseT(); + + void LoadXml(const char * xml); + const char * SaveXml(); + + void LoadJson(const char * json); + const char * SaveJson(); + + void SetLicenseKey(const _XCHAR * licenseKey); + const _XCHAR * GetLicenseKey(); + + void SetLicenseKeyValidationData(void * buf, int len); + void GetLicenseKeyValidationData(void ** buf, int * len); + + void SetActivationKey(const _XCHAR * activationKey); + const _XCHAR * GetActivationKey(); + + void SetHardwareId(const _XCHAR * hardwareId); + const _XCHAR * GetHardwareId(); + + bool IsLease(); + void SetLease(bool isLease); + + public: + LicenseImpl & m_Impl; + }; + + typedef LicenseT LicenseA; + typedef LicenseT LicenseW; +#ifdef _UNICODE + typedef LicenseW License; +#else + typedef LicenseA License; +#endif + + template + class LICENSING_API LicenseValidationArgsT + { + public: + LicenseValidationArgsT(); + ~LicenseValidationArgsT(); + + void SetLicense(const LicenseT<_XCHAR> * license); + void SetLicenseKey(const _XCHAR * licenseKey); + + void SetLicenseKeyValidationData(const _XCHAR * fieldName, int fieldValue); + void SetLicenseKeyValidationData(const _XCHAR * fieldName, const _XCHAR * fieldValue); + void SetLicenseKeyValidationData(const _XCHAR * fieldName, int year, int month, int day); + void SetLicenseKeyValidationData(const _XCHAR * fieldName, void * data, int len); + + public: + LicenseValidationArgsImpl & m_Impl; + }; + + typedef LicenseValidationArgsT LicenseValidationArgsA; + typedef LicenseValidationArgsT LicenseValidationArgsW; +#ifdef _UNICODE + typedef LicenseValidationArgsW LicenseValidationArgs; +#else + typedef LicenseValidationArgsA LicenseValidationArgs; +#endif + + template + class LICENSING_API LicenseValidationResultT + { + public: + LicenseValidationResultT(); + ~LicenseValidationResultT(); + + LicenseT<_XCHAR> * GetLicense(); + bool IsLicenseExpired(); + bool IsPaymentRequired(); + int GetLicenseValidityDays(); + void GetLicenseExpirationDate(int * year, int * month, int * day); + + public: + LicenseValidationResultImpl & m_Impl; + }; + + typedef LicenseValidationResultT LicenseValidationResultA; + typedef LicenseValidationResultT LicenseValidationResultW; +#ifdef _UNICODE + typedef LicenseValidationResultW LicenseValidationResult; +#else + typedef LicenseValidationResultA LicenseValidationResult; +#endif + + template + class LICENSING_API LicensingClientT + { + public: + LicensingClientT(); + ~LicensingClientT(); + + void SetLicensingServiceUrl(const _XCHAR * url); + + void SetLicenseTemplate(LicenseTemplateT<_XCHAR> * tmpl); + void SetLicenseKey(const _XCHAR * key); + + void SetActivationKey(const _XCHAR * key); + const _XCHAR * GetActivationKey(); + + void SetHardwareId(const _XCHAR * hardwareId); + const _XCHAR * GetHardwareId(); + + void SetLicenseKeyValidationData(void * buf, int len); + void SetLicenseTemplateId(const _XCHAR * templateId); + + bool IsLicenseValid(); + + void AcquireLicense(); + + LicenseValidationResultT<_XCHAR> * ValidateLicense(LicenseValidationArgsT<_XCHAR> * args); + + int GetLicenseActivationStatus(); + + void GetLicenseExpirationDate(int * year, int * month, int * day); + + void SetTimeValidationMethod(int method); // method = [PREFER_INTERNET_TIME (default) | USE_INTERNET_TIME | USE_LOCAL_TIME] + + virtual const _XCHAR * GetCurrentHardwareId(); + virtual bool MatchCurrentHardwareId(const _XCHAR * hardwareId); + + private: + LicensingClientImpl & m_Impl; + }; + + typedef LicensingClientT LicensingClientA; + typedef LicensingClientT LicensingClientW; + #ifdef _UNICODE + typedef LicensingClientW LicensingClient; + #else + typedef LicensingClientA LicensingClient; + #endif + + template< typename _XCHAR > + class LICENSING_API KeyHelperT + { + public: + static const _XCHAR * GetCurrentHardwareId(); + static bool MatchCurrentHardwareId(const _XCHAR * hwid); + static bool DetectClockManipulation(int thresholdYear, int thresholdMonth, int thresholdDay); + }; + + typedef KeyHelperT KeyHelperA; + typedef KeyHelperT KeyHelperW; + #ifdef _UNICODE + typedef KeyHelperW KeyHelper; + #else + typedef KeyHelperA KeyHelper; + #endif + + template< typename _XCHAR > + class LICENSING_API SDKRegistrationT + { + public: + static void SetLicenseKey(const _XCHAR * key); + + private: + static SDKRegistrationImpl & m_Impl; + }; + + typedef SDKRegistrationT SDKRegistrationA; + typedef SDKRegistrationT SDKRegistrationW; + #ifdef _UNICODE + typedef SDKRegistrationW SDKRegistration; + #else + typedef SDKRegistrationA SDKRegistration; + #endif + }; +}; + +using namespace ANSCENTER::Licensing; + +#endif /* __cplusplus */ +#endif + +